From: support Date: Thu, 6 Apr 2023 15:20:12 +0000 (+0000) Subject: Built motion from commit 1ea47bf4.|2.6.34 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=77bbc5a48582172976bf532fb699f17710a04dcf;p=motion2.git Built motion from commit 1ea47bf4.|2.6.34 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 0c3d32a..49e8f0d 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-04-04T07:41:54.877Z", + "time": "2023-04-06T15:09:26.848Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index d2ff86a..f794d4d 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-04-04T07:41:54.877Z", + "time": "2023-04-06T15:09:26.848Z", "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 87d1f5f..2dde944 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 _0x6af2=['contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','getDataValue','STRING','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x6af2,0x1d9));var _0x26af=function(_0x1c11a6,_0x154a32){_0x1c11a6=_0x1c11a6-0x0;var _0x1d9786=_0x6af2[_0x1c11a6];return _0x1d9786;};'use strict';var Sequelize=require(_0x26af('0x0'));module[_0x26af('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x191a6d){return this[_0x26af('0x2')]('action');}},'action':{'type':Sequelize[_0x26af('0x3')],'allowNull':![],'validate':{'isIn':{'args':[['contactManager',_0x26af('0x4'),_0x26af('0x5'),_0x26af('0x6'),_0x26af('0x7'),_0x26af('0x8'),_0x26af('0x9'),_0x26af('0xa')]],'msg':_0x26af('0xb')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x26af('0x3')](0x1000),'comment':_0x26af('0xc')},'data2':{'type':Sequelize[_0x26af('0x3')](0x1000),'comment':_0x26af('0xd')},'data3':{'type':Sequelize[_0x26af('0x3')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x26af('0x3')](0x1000),'comments':_0x26af('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x26af('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0x26af('0x10')},'data7':{'type':Sequelize[_0x26af('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0xabe0=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','bot','script'];(function(_0x45e98e,_0x169b60){var _0x374dba=function(_0x597612){while(--_0x597612){_0x45e98e['push'](_0x45e98e['shift']());}};_0x374dba(++_0x169b60);}(_0xabe0,0x182));var _0x0abe=function(_0x15601f,_0x35938f){_0x15601f=_0x15601f-0x0;var _0x15d32d=_0xabe0[_0x15601f];return _0x15d32d;};'use strict';var Sequelize=require(_0x0abe('0x0'));module[_0x0abe('0x1')]={'name':{'type':Sequelize[_0x0abe('0x2')],'get':function(_0x2f356a){return this[_0x0abe('0x3')](_0x0abe('0x4'));}},'action':{'type':Sequelize[_0x0abe('0x5')],'allowNull':![],'validate':{'isIn':{'args':[[_0x0abe('0x6'),_0x0abe('0x7'),_0x0abe('0x8'),_0x0abe('0x9'),_0x0abe('0xa'),'browser',_0x0abe('0xb'),_0x0abe('0xc')]],'msg':_0x0abe('0xd')}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize['STRING'](0x1000),'comment':_0x0abe('0xe')},'data2':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comment':_0x0abe('0xf')},'data3':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comment':_0x0abe('0x10')},'data4':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comments':_0x0abe('0x11')},'data5':{'type':Sequelize[_0x0abe('0x5')](0x1000),'comments':'urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]'},'data6':{'type':Sequelize[_0x0abe('0x5')],'comments':_0x0abe('0x12')},'data7':{'type':Sequelize[_0x0abe('0x13')],'comments':_0x0abe('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 25a5892..97e09ba 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 _0xc76f=['params','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','body','find'];(function(_0xbb9dbf,_0x5dafa4){var _0x30223c=function(_0xaa9ca){while(--_0xaa9ca){_0xbb9dbf['push'](_0xbb9dbf['shift']());}};_0x30223c(++_0x5dafa4);}(_0xc76f,0x1ba));var _0xfc76=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc76f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xfc76('0x0'));var rimraf=require(_0xfc76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfc76('0x2'));var rp=require('request-promise');var moment=require(_0xfc76('0x3'));var BPromise=require(_0xfc76('0x4'));var Mustache=require('mustache');var util=require(_0xfc76('0x5'));var path=require(_0xfc76('0x6'));var sox=require(_0xfc76('0x7'));var csv=require('to-csv');var ejs=require(_0xfc76('0x8'));var fs=require('fs');var fs_extra=require(_0xfc76('0x9'));var _=require(_0xfc76('0xa'));var squel=require(_0xfc76('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xfc76('0xc'));var toCsv=require(_0xfc76('0xd'));var querystring=require(_0xfc76('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfc76('0xf'));var as=require(_0xfc76('0x10'));var hardwareService=require(_0xfc76('0x11'));var logger=require(_0xfc76('0x12'))(_0xfc76('0x13'));var utils=require(_0xfc76('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5be805,_0x4d038b){_0x4d038b=_0x4d038b||0xcc;return function(_0x292e29){if(_0x292e29){return _0x5be805[_0xfc76('0x15')](_0x4d038b);}return _0x5be805[_0xfc76('0x16')](_0x4d038b)[_0xfc76('0x17')]();};}function respondWithResult(_0x69fc7a,_0x5e9530){_0x5e9530=_0x5e9530||0xc8;return function(_0x2abee2){if(_0x2abee2){return _0x69fc7a['status'](_0x5e9530)[_0xfc76('0x18')](_0x2abee2);}};}function respondWithFilteredResult(_0x5834e0,_0x45ac7a){return function(_0x4a721c){if(_0x4a721c){var _0x2e71dc=typeof _0x45ac7a[_0xfc76('0x19')]===_0xfc76('0x1a')&&typeof _0x45ac7a[_0xfc76('0x1b')]===_0xfc76('0x1a');var _0x542e1c=_0x4a721c['count'];var _0x44a3c=_0x2e71dc?0x0:_0x45ac7a[_0xfc76('0x19')];var _0x39725e=_0x2e71dc?_0x4a721c[_0xfc76('0x1c')]:_0x45ac7a[_0xfc76('0x19')]+_0x45ac7a[_0xfc76('0x1b')];var _0x49cc6b;if(_0x39725e>=_0x542e1c){_0x39725e=_0x542e1c;_0x49cc6b=0xc8;}else{_0x49cc6b=0xce;}_0x5834e0['status'](_0x49cc6b);return _0x5834e0[_0xfc76('0x1d')](_0xfc76('0x1e'),_0x44a3c+'-'+_0x39725e+'/'+_0x542e1c)[_0xfc76('0x18')](_0x4a721c);}return null;};}function patchUpdates(_0x1a0483){return function(_0x431a64){try{jsonpatch[_0xfc76('0x1f')](_0x431a64,_0x1a0483,!![]);}catch(_0x1a8dbb){return BPromise[_0xfc76('0x20')](_0x1a8dbb);}return _0x431a64['save']();};}function saveUpdates(_0x4e673b,_0x5ad14a){return function(_0x547b3a){if(_0x547b3a){return _0x547b3a[_0xfc76('0x21')](_0x4e673b)[_0xfc76('0x22')](function(_0x4f379e){return _0x4f379e;});}return null;};}function removeEntity(_0x128687,_0xbaffad){return function(_0x4790d6){if(_0x4790d6){return _0x4790d6[_0xfc76('0x23')]()[_0xfc76('0x22')](function(){_0x128687['status'](0xcc)[_0xfc76('0x17')]();});}};}function handleEntityNotFound(_0x2d0421,_0x8d4b8){return function(_0x1c8f3d){if(!_0x1c8f3d){_0x2d0421[_0xfc76('0x15')](0x194);}return _0x1c8f3d;};}function handleError(_0x474f1e,_0x3663a3){_0x3663a3=_0x3663a3||0x1f4;return function(_0x1a70bd){logger[_0xfc76('0x24')](_0x1a70bd[_0xfc76('0x25')]);if(_0x1a70bd['name']){delete _0x1a70bd[_0xfc76('0x26')];}_0x474f1e['status'](_0x3663a3)[_0xfc76('0x27')](_0x1a70bd);};}exports[_0xfc76('0x21')]=function(_0x551b81,_0x2a53c1){if(_0x551b81['body']['id']){delete _0x551b81[_0xfc76('0x28')]['id'];}return db['Action'][_0xfc76('0x29')]({'where':{'id':_0x551b81[_0xfc76('0x2a')]['id']}})[_0xfc76('0x22')](handleEntityNotFound(_0x2a53c1,null))[_0xfc76('0x22')](saveUpdates(_0x551b81['body'],null))[_0xfc76('0x22')](respondWithResult(_0x2a53c1,null))[_0xfc76('0x2b')](handleError(_0x2a53c1,null));};exports['destroy']=function(_0x10504c,_0xce724c){return db['Action']['find']({'where':{'id':_0x10504c[_0xfc76('0x2a')]['id']}})[_0xfc76('0x22')](handleEntityNotFound(_0xce724c,null))['then'](removeEntity(_0xce724c,null))[_0xfc76('0x2b')](handleError(_0xce724c,null));}; \ No newline at end of file +var _0xc216=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','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','offset','undefined','limit','count','set','apply','save','update','then','destroy','error','name','send','body','find','params','catch'];(function(_0x2261d1,_0x514c90){var _0x36c3ce=function(_0x465c49){while(--_0x465c49){_0x2261d1['push'](_0x2261d1['shift']());}};_0x36c3ce(++_0x514c90);}(_0xc216,0xc4));var _0x6c21=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc216[_0x2b5eae];return _0x5f3ac9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c21('0x0'));var zipdir=require(_0x6c21('0x1'));var jsonpatch=require(_0x6c21('0x2'));var rp=require(_0x6c21('0x3'));var moment=require(_0x6c21('0x4'));var BPromise=require(_0x6c21('0x5'));var Mustache=require(_0x6c21('0x6'));var util=require(_0x6c21('0x7'));var path=require('path');var sox=require(_0x6c21('0x8'));var csv=require(_0x6c21('0x9'));var ejs=require(_0x6c21('0xa'));var fs=require('fs');var fs_extra=require(_0x6c21('0xb'));var _=require(_0x6c21('0xc'));var squel=require(_0x6c21('0xd'));var crypto=require(_0x6c21('0xe'));var jsforce=require(_0x6c21('0xf'));var deskjs=require(_0x6c21('0x10'));var toCsv=require(_0x6c21('0x9'));var querystring=require(_0x6c21('0x11'));var Papa=require(_0x6c21('0x12'));var Redis=require(_0x6c21('0x13'));var authService=require(_0x6c21('0x14'));var qs=require(_0x6c21('0x15'));var as=require(_0x6c21('0x16'));var hardwareService=require(_0x6c21('0x17'));var logger=require('../../config/logger')(_0x6c21('0x18'));var utils=require(_0x6c21('0x19'));var config=require(_0x6c21('0x1a'));var licenseUtil=require(_0x6c21('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e5b97,_0x17baa8){_0x17baa8=_0x17baa8||0xcc;return function(_0x552436){if(_0x552436){return _0x1e5b97[_0x6c21('0x1c')](_0x17baa8);}return _0x1e5b97[_0x6c21('0x1d')](_0x17baa8)[_0x6c21('0x1e')]();};}function respondWithResult(_0x1ec8e0,_0x7c50fd){_0x7c50fd=_0x7c50fd||0xc8;return function(_0x24030a){if(_0x24030a){return _0x1ec8e0['status'](_0x7c50fd)[_0x6c21('0x1f')](_0x24030a);}};}function respondWithFilteredResult(_0x29dfe8,_0x3284fc){return function(_0xae5259){if(_0xae5259){var _0x3e7429=typeof _0x3284fc[_0x6c21('0x20')]===_0x6c21('0x21')&&typeof _0x3284fc[_0x6c21('0x22')]===_0x6c21('0x21');var _0x4d976c=_0xae5259[_0x6c21('0x23')];var _0x38de0b=_0x3e7429?0x0:_0x3284fc['offset'];var _0x408219=_0x3e7429?_0xae5259['count']:_0x3284fc[_0x6c21('0x20')]+_0x3284fc['limit'];var _0x1637b6;if(_0x408219>=_0x4d976c){_0x408219=_0x4d976c;_0x1637b6=0xc8;}else{_0x1637b6=0xce;}_0x29dfe8[_0x6c21('0x1d')](_0x1637b6);return _0x29dfe8[_0x6c21('0x24')]('Content-Range',_0x38de0b+'-'+_0x408219+'/'+_0x4d976c)[_0x6c21('0x1f')](_0xae5259);}return null;};}function patchUpdates(_0x505dac){return function(_0x1a476d){try{jsonpatch[_0x6c21('0x25')](_0x1a476d,_0x505dac,!![]);}catch(_0x26af81){return BPromise['reject'](_0x26af81);}return _0x1a476d[_0x6c21('0x26')]();};}function saveUpdates(_0x35ad90,_0x365287){return function(_0xf24cce){if(_0xf24cce){return _0xf24cce[_0x6c21('0x27')](_0x35ad90)[_0x6c21('0x28')](function(_0x1b2c61){return _0x1b2c61;});}return null;};}function removeEntity(_0xd261a3,_0xcaf75c){return function(_0x141c09){if(_0x141c09){return _0x141c09[_0x6c21('0x29')]()[_0x6c21('0x28')](function(){_0xd261a3[_0x6c21('0x1d')](0xcc)[_0x6c21('0x1e')]();});}};}function handleEntityNotFound(_0x365d11,_0x28de92){return function(_0x40ef52){if(!_0x40ef52){_0x365d11[_0x6c21('0x1c')](0x194);}return _0x40ef52;};}function handleError(_0x24ee81,_0x2fb173){_0x2fb173=_0x2fb173||0x1f4;return function(_0x173dea){logger[_0x6c21('0x2a')](_0x173dea['stack']);if(_0x173dea['name']){delete _0x173dea[_0x6c21('0x2b')];}_0x24ee81[_0x6c21('0x1d')](_0x2fb173)[_0x6c21('0x2c')](_0x173dea);};}exports[_0x6c21('0x27')]=function(_0x5d488b,_0x5d8916){if(_0x5d488b[_0x6c21('0x2d')]['id']){delete _0x5d488b[_0x6c21('0x2d')]['id'];}return db['Action'][_0x6c21('0x2e')]({'where':{'id':_0x5d488b['params']['id']}})[_0x6c21('0x28')](handleEntityNotFound(_0x5d8916,null))[_0x6c21('0x28')](saveUpdates(_0x5d488b[_0x6c21('0x2d')],null))[_0x6c21('0x28')](respondWithResult(_0x5d8916,null))['catch'](handleError(_0x5d8916,null));};exports['destroy']=function(_0x5959d1,_0x2e8864){return db['Action'][_0x6c21('0x2e')]({'where':{'id':_0x5959d1[_0x6c21('0x2f')]['id']}})[_0x6c21('0x28')](handleEntityNotFound(_0x2e8864,null))[_0x6c21('0x28')](removeEntity(_0x2e8864,null))[_0x6c21('0x30')](handleError(_0x2e8864,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 47d82a1..011237c 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 _0xa893=['path','rimraf','../../config/environment','./action.attributes','exports','define','Action','lodash','util','moment','bluebird','request-promise'];(function(_0x882c95,_0x2fd99f){var _0x26d96b=function(_0x2d73a6){while(--_0x2d73a6){_0x882c95['push'](_0x882c95['shift']());}};_0x26d96b(++_0x2fd99f);}(_0xa893,0x1c3));var _0x3a89=function(_0x39bc8f,_0x5f4e5d){_0x39bc8f=_0x39bc8f-0x0;var _0x162014=_0xa893[_0x39bc8f];return _0x162014;};'use strict';var _=require(_0x3a89('0x0'));var util=require(_0x3a89('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3a89('0x2'));var BPromise=require(_0x3a89('0x3'));var rp=require(_0x3a89('0x4'));var fs=require('fs');var path=require(_0x3a89('0x5'));var rimraf=require(_0x3a89('0x6'));var config=require(_0x3a89('0x7'));var attributes=require(_0x3a89('0x8'));module[_0x3a89('0x9')]=function(_0x3946e7,_0x1b85d0){return _0x3946e7[_0x3a89('0xa')](_0x3a89('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1d9=['request-promise','rimraf','./action.attributes','exports','tools_actions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd1d9,0x13b));var _0x9d1d=function(_0x154f26,_0x228c67){_0x154f26=_0x154f26-0x0;var _0x2a1b3f=_0xd1d9[_0x154f26];return _0x2a1b3f;};'use strict';var _=require(_0x9d1d('0x0'));var util=require(_0x9d1d('0x1'));var logger=require(_0x9d1d('0x2'))('api');var moment=require(_0x9d1d('0x3'));var BPromise=require(_0x9d1d('0x4'));var rp=require(_0x9d1d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d1d('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d1d('0x7'));module[_0x9d1d('0x8')]=function(_0x1bde9f,_0xad9da9){return _0x1bde9f['define']('Action',attributes,{'tableName':_0x9d1d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index e7737b4..45c9a95 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(_0x37de7d,_0x1e80f4){var _0x53211c=function(_0xdfeb92){while(--_0xdfeb92){_0x37de7d['push'](_0x37de7d['shift']());}};_0x53211c(++_0x1e80f4);}(_0x5fc3,0xa8));var _0x35fc=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x5fc3[_0x13b02f];return _0x12e9a6;};'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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x2d5abe,_0x421434){var _0x4a603c=function(_0x196bac){while(--_0x196bac){_0x2d5abe['push'](_0x2d5abe['shift']());}};_0x4a603c(++_0x421434);}(_0x1261,0x144));var _0x1126=function(_0x380307,_0x440ccd){_0x380307=_0x380307-0x0;var _0x9ea14b=_0x1261[_0x380307];return _0x9ea14b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 92fe177..821edcd 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 _0x94bf=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','/:id','isAuthenticated','delete','destroy','exports','multer','connect-timeout'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x94bf,0x1da));var _0xf94b=function(_0x44c596,_0xe8d581){_0x44c596=_0x44c596-0x0;var _0x37930f=_0x94bf[_0x44c596];return _0x37930f;};'use strict';var multer=require(_0xf94b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf94b('0x1'));var express=require(_0xf94b('0x2'));var router=express[_0xf94b('0x3')]();var fs_extra=require(_0xf94b('0x4'));var auth=require(_0xf94b('0x5'));var interaction=require(_0xf94b('0x6'));var config=require(_0xf94b('0x7'));var controller=require(_0xf94b('0x8'));router['put'](_0xf94b('0x9'),auth[_0xf94b('0xa')](),controller['update']);router[_0xf94b('0xb')](_0xf94b('0x9'),auth[_0xf94b('0xa')](),controller[_0xf94b('0xc')]);module[_0xf94b('0xd')]=router; \ No newline at end of file +var _0x7600=['delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x4c0ca7,_0x267486){var _0x198a33=function(_0xd3c479){while(--_0xd3c479){_0x4c0ca7['push'](_0x4c0ca7['shift']());}};_0x198a33(++_0x267486);}(_0x7600,0xf3));var _0x0760=function(_0xef8146,_0x459c34){_0xef8146=_0xef8146-0x0;var _0x5a6cb0=_0x7600[_0xef8146];return _0x5a6cb0;};'use strict';var multer=require(_0x0760('0x0'));var util=require(_0x0760('0x1'));var path=require(_0x0760('0x2'));var timeout=require(_0x0760('0x3'));var express=require('express');var router=express[_0x0760('0x4')]();var fs_extra=require(_0x0760('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0760('0x6'));var config=require(_0x0760('0x7'));var controller=require(_0x0760('0x8'));router[_0x0760('0x9')](_0x0760('0xa'),auth[_0x0760('0xb')](),controller[_0x0760('0xc')]);router[_0x0760('0xd')](_0x0760('0xa'),auth[_0x0760('0xb')](),controller[_0x0760('0xe')]);module[_0x0760('0xf')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1b37389..922a17f 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 _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x1a8651,_0x5252e4){var _0x50984b=function(_0x37ebfb){while(--_0x37ebfb){_0x1a8651['push'](_0x1a8651['shift']());}};_0x50984b(++_0x5252e4);}(_0xa630,0xbe));var _0x0a63=function(_0x337fb9,_0x2c5935){_0x337fb9=_0x337fb9-0x0;var _0x1e1d20=_0xa630[_0x337fb9];return _0x1e1d20;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xc4aa=['STRING','sequelize','exports'];(function(_0x17de62,_0x561f1b){var _0x1014d4=function(_0x4dd9f1){while(--_0x4dd9f1){_0x17de62['push'](_0x17de62['shift']());}};_0x1014d4(++_0x561f1b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0xc4aa[_0x2235bf];return _0x4c3a64;};'use strict';var Sequelize=require(_0xac4a('0x0'));module[_0xac4a('0x1')]={'name':{'type':Sequelize[_0xac4a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xac4a('0x2')]},'parent':{'type':Sequelize[_0xac4a('0x2')]},'table':{'type':Sequelize[_0xac4a('0x2')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index b91f29a..f1338a5 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 _0xba5c=['COUNT(*)','SELECT','run','runReport','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','dbH','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','include','findAll','rows','catch','show','params','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','get','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','group','condition','value','options','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','operator','field','ValidationErrorItem','select','DESC','includes','clone','output','web','fullPath','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable'];(function(_0x275550,_0x1be9f6){var _0x2655ec=function(_0x6fc2cf){while(--_0x6fc2cf){_0x275550['push'](_0x275550['shift']());}};_0x2655ec(++_0x1be9f6);}(_0xba5c,0x154));var _0xcba5=function(_0x3638dd,_0x238cb4){_0x3638dd=_0x3638dd-0x0;var _0x3ab130=_0xba5c[_0x3638dd];return _0x3ab130;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xcba5('0x0'));var jsonpatch=require(_0xcba5('0x1'));var rp=require(_0xcba5('0x2'));var moment=require(_0xcba5('0x3'));var BPromise=require(_0xcba5('0x4'));var Mustache=require('mustache');var util=require(_0xcba5('0x5'));var path=require(_0xcba5('0x6'));var sox=require(_0xcba5('0x7'));var csv=require(_0xcba5('0x8'));var ejs=require(_0xcba5('0x9'));var fs=require('fs');var fs_extra=require(_0xcba5('0xa'));var _=require(_0xcba5('0xb'));var squel=require('squel');var crypto=require(_0xcba5('0xc'));var jsforce=require(_0xcba5('0xd'));var deskjs=require(_0xcba5('0xe'));var toCsv=require(_0xcba5('0x8'));var querystring=require('querystring');var Papa=require(_0xcba5('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcba5('0x10'));var as=require(_0xcba5('0x11'));var hardwareService=require(_0xcba5('0x12'));var logger=require('../../config/logger')(_0xcba5('0x13'));var utils=require(_0xcba5('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcba5('0x15'));var db=require(_0xcba5('0x16'))['db'];var dbH=require(_0xcba5('0x16'))[_0xcba5('0x17')];function respondWithStatusCode(_0x41adcc,_0x37530e){_0x37530e=_0x37530e||0xcc;return function(_0x1b0cd4){if(_0x1b0cd4){return _0x41adcc['sendStatus'](_0x37530e);}return _0x41adcc[_0xcba5('0x18')](_0x37530e)[_0xcba5('0x19')]();};}function respondWithResult(_0x4adc49,_0x2233a1){_0x2233a1=_0x2233a1||0xc8;return function(_0x592e41){if(_0x592e41){return _0x4adc49['status'](_0x2233a1)[_0xcba5('0x1a')](_0x592e41);}};}function respondWithFilteredResult(_0x350914,_0xfb50e0){return function(_0x3d7f12){if(_0x3d7f12){var _0x3fb0d9=typeof _0xfb50e0[_0xcba5('0x1b')]===_0xcba5('0x1c')&&typeof _0xfb50e0[_0xcba5('0x1d')]===_0xcba5('0x1c');var _0x4f9c5b=_0x3d7f12['count'];var _0xd12b0f=_0x3fb0d9?0x0:_0xfb50e0[_0xcba5('0x1b')];var _0x239744=_0x3fb0d9?_0x3d7f12['count']:_0xfb50e0['offset']+_0xfb50e0[_0xcba5('0x1d')];var _0x514b41;if(_0x239744>=_0x4f9c5b){_0x239744=_0x4f9c5b;_0x514b41=0xc8;}else{_0x514b41=0xce;}_0x350914[_0xcba5('0x18')](_0x514b41);return _0x350914[_0xcba5('0x1e')](_0xcba5('0x1f'),_0xd12b0f+'-'+_0x239744+'/'+_0x4f9c5b)['json'](_0x3d7f12);}return null;};}function patchUpdates(_0x1580b9){return function(_0x36db21){try{jsonpatch[_0xcba5('0x20')](_0x36db21,_0x1580b9,!![]);}catch(_0x3a57f4){return BPromise['reject'](_0x3a57f4);}return _0x36db21[_0xcba5('0x21')]();};}function saveUpdates(_0x56c494,_0x1d3e80){return function(_0x510f6f){if(_0x510f6f){return _0x510f6f[_0xcba5('0x22')](_0x56c494)[_0xcba5('0x23')](function(_0x3addcb){return _0x3addcb;});}return null;};}function removeEntity(_0x4cada7,_0x4205f7){return function(_0x2032b7){if(_0x2032b7){return _0x2032b7[_0xcba5('0x24')]()[_0xcba5('0x23')](function(){var _0x22fe93=_0x2032b7['get']({'plain':!![]});var _0x71a928='CustomReports';return db[_0xcba5('0x25')][_0xcba5('0x24')]({'where':{'type':_0x71a928,'resourceId':_0x22fe93['id']}})[_0xcba5('0x23')](function(){return _0x2032b7;});})[_0xcba5('0x23')](function(){_0x4cada7['status'](0xcc)[_0xcba5('0x19')]();});}};}function handleEntityNotFound(_0x4916cc,_0x3f327d){return function(_0x262e6a){if(!_0x262e6a){_0x4916cc[_0xcba5('0x26')](0x194);}return _0x262e6a;};}function handleError(_0xa5d4b8,_0x3375e8){_0x3375e8=_0x3375e8||0x1f4;return function(_0x21a109){logger[_0xcba5('0x27')](_0x21a109[_0xcba5('0x28')]);if(_0x21a109[_0xcba5('0x29')]){delete _0x21a109[_0xcba5('0x29')];}_0xa5d4b8[_0xcba5('0x18')](_0x3375e8)[_0xcba5('0x2a')](_0x21a109);};}exports[_0xcba5('0x2b')]=function(_0x2c352a,_0x28f6d7){var _0x27899d={},_0x5f00c9={},_0x24fb9b={'count':0x0,'rows':[]};var _0x214aa3=_[_0xcba5('0x2c')](db[_0xcba5('0x2d')][_0xcba5('0x2e')],function(_0x43b0a5){return{'name':_0x43b0a5['fieldName'],'type':_0x43b0a5[_0xcba5('0x2f')][_0xcba5('0x30')]};});_0x5f00c9[_0xcba5('0x31')]=_[_0xcba5('0x2c')](_0x214aa3,_0xcba5('0x29'));_0x5f00c9[_0xcba5('0x32')]=_[_0xcba5('0x33')](_0x2c352a['query']);_0x5f00c9[_0xcba5('0x34')]=_[_0xcba5('0x35')](_0x5f00c9['model'],_0x5f00c9[_0xcba5('0x32')]);_0x27899d[_0xcba5('0x36')]=_[_0xcba5('0x35')](_0x5f00c9[_0xcba5('0x31')],qs[_0xcba5('0x37')](_0x2c352a[_0xcba5('0x32')][_0xcba5('0x37')]));_0x27899d[_0xcba5('0x36')]=_0x27899d[_0xcba5('0x36')][_0xcba5('0x38')]?_0x27899d[_0xcba5('0x36')]:_0x5f00c9['model'];if(!_0x2c352a[_0xcba5('0x32')][_0xcba5('0x39')](_0xcba5('0x3a'))){_0x27899d[_0xcba5('0x1d')]=qs[_0xcba5('0x1d')](_0x2c352a['query']['limit']);_0x27899d['offset']=qs[_0xcba5('0x1b')](_0x2c352a[_0xcba5('0x32')][_0xcba5('0x1b')]);}_0x27899d[_0xcba5('0x3b')]=qs[_0xcba5('0x3c')](_0x2c352a[_0xcba5('0x32')][_0xcba5('0x3c')]);_0x27899d[_0xcba5('0x3d')]=qs[_0xcba5('0x34')](_[_0xcba5('0x3e')](_0x2c352a['query'],_0x5f00c9[_0xcba5('0x34')]),_0x214aa3);if(_0x2c352a['query'][_0xcba5('0x3f')]){_0x27899d[_0xcba5('0x3d')]=_['merge'](_0x27899d[_0xcba5('0x3d')],{'$or':_[_0xcba5('0x2c')](_0x214aa3,function(_0x45ada4){if(_0x45ada4[_0xcba5('0x2f')]!==_0xcba5('0x40')){var _0x187ce2={};_0x187ce2[_0x45ada4[_0xcba5('0x29')]]={'$like':'%'+_0x2c352a[_0xcba5('0x32')][_0xcba5('0x3f')]+'%'};return _0x187ce2;}})});}_0x27899d=_[_0xcba5('0x41')]({},_0x27899d,_0x2c352a['options']);var _0x45faa7={'where':_0x27899d['where']};return db[_0xcba5('0x2d')][_0xcba5('0x42')](_0x45faa7)[_0xcba5('0x23')](function(_0xddad8b){_0x24fb9b['count']=_0xddad8b;if(_0x2c352a[_0xcba5('0x32')][_0xcba5('0x43')]){_0x27899d[_0xcba5('0x44')]=[{'all':!![]}];}return db[_0xcba5('0x2d')][_0xcba5('0x45')](_0x27899d);})[_0xcba5('0x23')](function(_0x247df1){_0x24fb9b[_0xcba5('0x46')]=_0x247df1;return _0x24fb9b;})[_0xcba5('0x23')](respondWithFilteredResult(_0x28f6d7,_0x27899d))[_0xcba5('0x47')](handleError(_0x28f6d7,null));};exports[_0xcba5('0x48')]=function(_0x8307,_0x3cc5f3){var _0x3d33aa={'raw':![],'where':{'id':_0x8307[_0xcba5('0x49')]['id']}},_0x418b3d={};_0x418b3d[_0xcba5('0x31')]=_['keys'](db['AnalyticCustomReport'][_0xcba5('0x2e')]);_0x418b3d[_0xcba5('0x32')]=_[_0xcba5('0x33')](_0x8307[_0xcba5('0x32')]);_0x418b3d[_0xcba5('0x34')]=_[_0xcba5('0x35')](_0x418b3d[_0xcba5('0x31')],_0x418b3d[_0xcba5('0x32')]);_0x3d33aa[_0xcba5('0x36')]=_[_0xcba5('0x35')](_0x418b3d['model'],qs[_0xcba5('0x37')](_0x8307[_0xcba5('0x32')][_0xcba5('0x37')]));_0x3d33aa[_0xcba5('0x36')]=_0x3d33aa['attributes'][_0xcba5('0x38')]?_0x3d33aa[_0xcba5('0x36')]:_0x418b3d[_0xcba5('0x31')];if(_0x8307[_0xcba5('0x32')][_0xcba5('0x43')]){_0x3d33aa[_0xcba5('0x44')]=[{'all':!![]}];}_0x3d33aa=_['merge']({},_0x3d33aa,_0x8307['options']);return db['AnalyticCustomReport'][_0xcba5('0x4a')](_0x3d33aa)[_0xcba5('0x23')](handleEntityNotFound(_0x3cc5f3,null))[_0xcba5('0x23')](respondWithResult(_0x3cc5f3,null))['catch'](handleError(_0x3cc5f3,null));};exports[_0xcba5('0x4b')]=function(_0x57a3fa,_0x2e91c6){return db[_0xcba5('0x2d')][_0xcba5('0x4b')](_0x57a3fa['body'],{})[_0xcba5('0x23')](function(_0x2160be){var _0x845dc9=_0x57a3fa['user']['get']({'plain':!![]});if(!_0x845dc9)throw new Error(_0xcba5('0x4c'));if(_0x845dc9['role']===_0xcba5('0x4d')){var _0x85ebd5=_0x2160be[_0xcba5('0x4e')]({'plain':!![]});var _0x2a85f6=_0xcba5('0x4f');return db[_0xcba5('0x50')][_0xcba5('0x4a')]({'where':{'name':_0x2a85f6,'userProfileId':_0x845dc9[_0xcba5('0x51')]},'raw':!![]})[_0xcba5('0x23')](function(_0x43765d){if(_0x43765d&&_0x43765d[_0xcba5('0x52')]===0x0){return db[_0xcba5('0x25')][_0xcba5('0x4b')]({'name':_0x85ebd5[_0xcba5('0x29')],'resourceId':_0x85ebd5['id'],'type':'CustomReports','sectionId':_0x43765d['id']},{})['then'](function(){return _0x2160be;});}else{return _0x2160be;}})[_0xcba5('0x47')](function(_0x7b4a3d){logger[_0xcba5('0x27')](_0xcba5('0x53'),_0x7b4a3d);throw _0x7b4a3d;});}return _0x2160be;})[_0xcba5('0x23')](respondWithResult(_0x2e91c6,0xc9))['catch'](handleError(_0x2e91c6,null));};exports['update']=function(_0x1dc235,_0x8750ff){if(_0x1dc235[_0xcba5('0x54')]['id']){delete _0x1dc235[_0xcba5('0x54')]['id'];}return db[_0xcba5('0x2d')][_0xcba5('0x4a')]({'where':{'id':_0x1dc235[_0xcba5('0x49')]['id']}})[_0xcba5('0x23')](handleEntityNotFound(_0x8750ff,null))[_0xcba5('0x23')](saveUpdates(_0x1dc235[_0xcba5('0x54')],null))['then'](respondWithResult(_0x8750ff,null))['catch'](handleError(_0x8750ff,null));};exports[_0xcba5('0x24')]=function(_0x525102,_0x1d9f8d){return db[_0xcba5('0x2d')]['find']({'where':{'id':_0x525102[_0xcba5('0x49')]['id']}})[_0xcba5('0x23')](handleEntityNotFound(_0x1d9f8d,null))[_0xcba5('0x23')](removeEntity(_0x1d9f8d,null))[_0xcba5('0x47')](handleError(_0x1d9f8d,null));};exports['preview']=function(_0x2d0273,_0x21a770){var _0xc2acd1=0xa;var _0x1780fe=[_0xcba5('0x55'),_0xcba5('0x56'),_0xcba5('0x57'),_0xcba5('0x58')];var _0xa4f65b={'SUM':_0xcba5('0x59'),'COUNT':_0xcba5('0x5a'),'COUNT DISTINCT':_0xcba5('0x5b'),'MAX':_0xcba5('0x5c'),'MIN':_0xcba5('0x5d'),'AVG':_0xcba5('0x5e'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xcba5('0x5f')};var _0x5239d4={'SEC_TO_TIME':_0xcba5('0x60'),'DATE':_0xcba5('0x61'),'HOUR':_0xcba5('0x62'),'ROUND':_0xcba5('0x63'),'UNIX_TIMESTAMP':_0xcba5('0x64')};var _0x5bfc19=function(_0x10c838){return!_['includes']([_0xcba5('0x65'),_0xcba5('0x66'),_0xcba5('0x67'),_0xcba5('0x68')],_0x10c838);};var _0x43f109=function(_0x2b68d5){if(!_0x2b68d5||!_0x2b68d5[_0xcba5('0x69')][_0xcba5('0x38')]){return'';}for(var _0x489a63='(',_0x387352=0x0;_0x387352<_0x2b68d5['rules']['length'];_0x387352+=0x1){_0x387352>0x0&&(_0x489a63+='\x20'+_0x2b68d5['operator']+'\x20');_0x489a63+=_0x2b68d5['rules'][_0x387352]['group']?_0x43f109(_0x2b68d5['rules'][_0x387352][_0xcba5('0x6a')]):_0x2b68d5[_0xcba5('0x69')][_0x387352]['field']+'\x20'+_0x2b68d5[_0xcba5('0x69')][_0x387352][_0xcba5('0x6b')]+(_0x5bfc19(_0x2b68d5[_0xcba5('0x69')][_0x387352][_0xcba5('0x6b')])?'\x20'+_0x2b68d5[_0xcba5('0x69')][_0x387352][_0xcba5('0x6c')]:'');}return _0x489a63+')';};var _0x192794={'where':{'id':_0x2d0273['params']['id']}},_0x54f11c,_0x39408e,_0x589d16,_0xa96998,_0x1c6ac8;_0x192794=_[_0xcba5('0x41')]({},_0x192794,_0x2d0273[_0xcba5('0x6d')]);return db[_0xcba5('0x2d')][_0xcba5('0x4a')](_0x192794)[_0xcba5('0x23')](function(_0x1df0dd){if(_0x1df0dd){_0x54f11c=_0x1df0dd;return _0x1df0dd[_0xcba5('0x6e')]();}return null;})[_0xcba5('0x23')](function(_0x3bdc00){if(_0x3bdc00){if(!_0x3bdc00[_0xcba5('0x38')]){throw new db[(_0xcba5('0x6f'))]['ValidationErrorItem'](_0xcba5('0x70'),0x193);}_0x39408e=_0x3bdc00;return db[_0xcba5('0x71')][_0xcba5('0x45')]({'raw':!![]});}return null;})['then'](function(_0x4216fd){if(_0x4216fd){_0x589d16=_[_0xcba5('0x72')](_0x4216fd,'id');var _0x31ed6f;var _0x3cff1e=squel['select']();_0x3cff1e[_0xcba5('0x73')](_0x54f11c[_0xcba5('0x74')]);for(var _0x134067=0x0;_0x134067<_0x39408e[_0xcba5('0x38')];_0x134067+=0x1){_0x31ed6f=_0x39408e[_0x134067]['MetricId']?_0x589d16[_0x39408e[_0x134067][_0xcba5('0x75')]][_0xcba5('0x76')]:_0x39408e[_0x134067]['field'];_0x31ed6f=_0x39408e[_0x134067][_0xcba5('0x77')]?_[_0xcba5('0x78')](_0xa4f65b[_0x39408e[_0x134067]['function']],'%s',_0x31ed6f):_0x31ed6f;_0x31ed6f=_0x39408e[_0x134067][_0xcba5('0x79')]?_[_0xcba5('0x78')](_0x5239d4[_0x39408e[_0x134067]['format']],'%s',_0x31ed6f):_0x31ed6f;if(_0x39408e[_0x134067][_0xcba5('0x7a')]){_0x3cff1e[_0xcba5('0x6a')](_0x31ed6f);}_0x39408e[_0x134067][_0xcba5('0x7b')]&&_0x3cff1e[_0xcba5('0x3b')](_0x31ed6f,_0x39408e[_0x134067][_0xcba5('0x7b')]==='DESC'?![]:!![]);_0x3cff1e['field'](_0x31ed6f,_0x39408e[_0x134067][_0xcba5('0x7c')]||_0x31ed6f);}if(_0x54f11c[_0xcba5('0x7d')]){_0x54f11c[_0xcba5('0x7d')]=JSON[_0xcba5('0x7e')](_0x54f11c[_0xcba5('0x7d')]);for(var _0x29083f=0x0;_0x29083f<_0x54f11c[_0xcba5('0x7d')][_0xcba5('0x38')];_0x29083f+=0x1){if(_0x54f11c['joins'][_0x29083f][_0xcba5('0x2f')]&&_['includes'](_0x1780fe,_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x2f')])&&_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x7f')]&&_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x80')]&&_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x81')]){_0x3cff1e[_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x2f')]](_0x54f11c[_0xcba5('0x7d')][_0x29083f]['foreignTable'],null,util[_0xcba5('0x79')](_0xcba5('0x82'),_0x54f11c[_0xcba5('0x74')],_0x54f11c['joins'][_0x29083f][_0xcba5('0x7f')],_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x80')],_0x54f11c[_0xcba5('0x7d')][_0x29083f][_0xcba5('0x81')]));}}}if(_0x54f11c[_0xcba5('0x83')]){_0x54f11c[_0xcba5('0x83')]=JSON[_0xcba5('0x7e')](_0x54f11c[_0xcba5('0x83')]);_0x3cff1e[_0xcba5('0x3d')](_0x43f109(_0x54f11c['conditions']['group']));}_0x1c6ac8=_0x3cff1e['clone']();_0x3cff1e[_0xcba5('0x1d')](_0xc2acd1);_0x3cff1e[_0xcba5('0x1b')](0x0);logger[_0xcba5('0x84')](_0xcba5('0x85'),_0x3cff1e[_0xcba5('0x86')]());return dbH[_0xcba5('0x87')]['query'](_0x3cff1e[_0xcba5('0x86')](),{'type':dbH[_0xcba5('0x87')][_0xcba5('0x88')]['SELECT']});}})['then'](respondWithResult(_0x21a770,null))[_0xcba5('0x47')](handleError(_0x21a770,null));};function runReport(_0x3ae65a,_0x9fbb19,_0x3181e2){var _0x170e3d=_0x9fbb19[_0xcba5('0x29')];var _0x46a38f=0xa;var _0xe511bb=[_0xcba5('0x55'),_0xcba5('0x56'),_0xcba5('0x57'),_0xcba5('0x58')];var _0x1f517b={'SUM':_0xcba5('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xcba5('0x5b'),'MAX':'MAX(%s)','MIN':_0xcba5('0x5d'),'AVG':_0xcba5('0x5e'),'GROUP_CONCAT':_0xcba5('0x89'),'GROUP_CONCAT ASC':_0xcba5('0x8a'),'GROUP_CONCAT DESC':_0xcba5('0x5f')};var _0x41aef3={'SEC_TO_TIME':_0xcba5('0x60'),'DATE':_0xcba5('0x61'),'HOUR':_0xcba5('0x62'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xcba5('0x64')};var _0x6d5e48=function(_0x244a6c){return!_['includes']([_0xcba5('0x65'),_0xcba5('0x66'),_0xcba5('0x67'),_0xcba5('0x68')],_0x244a6c);};var _0x3d1895=function(_0x79a571){if(!_0x79a571||!_0x79a571[_0xcba5('0x69')][_0xcba5('0x38')]){return'';}for(var _0x176f1b='(',_0x5090ae=0x0;_0x5090ae<_0x79a571[_0xcba5('0x69')][_0xcba5('0x38')];_0x5090ae+=0x1){_0x5090ae>0x0&&(_0x176f1b+='\x20'+_0x79a571[_0xcba5('0x8b')]+'\x20');_0x176f1b+=_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x6a')]?_0x3d1895(_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x6a')]):_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x8c')]+'\x20'+_0x79a571['rules'][_0x5090ae][_0xcba5('0x6b')]+(_0x6d5e48(_0x79a571[_0xcba5('0x69')][_0x5090ae]['condition'])?'\x20'+_0x79a571[_0xcba5('0x69')][_0x5090ae][_0xcba5('0x6c')]:'');}return _0x176f1b+')';};var _0x6a6ed0={'where':{'id':_0x3ae65a['id']}},_0x290b2a,_0x57c7c4,_0xe18f8e,_0x5d35b4,_0x1c9ff2;_0x6a6ed0=_[_0xcba5('0x41')]({},_0x6a6ed0,_0x3181e2);return db[_0xcba5('0x2d')]['find'](_0x6a6ed0)[_0xcba5('0x23')](function(_0x261bd4){if(_0x261bd4){_0x290b2a=_0x261bd4;return _0x261bd4[_0xcba5('0x6e')]();}return null;})['then'](function(_0x1abf6b){if(_0x1abf6b){if(!_0x1abf6b[_0xcba5('0x38')]){throw new db[(_0xcba5('0x6f'))][(_0xcba5('0x8d'))](_0xcba5('0x70'),0x193);}_0x57c7c4=_0x1abf6b;return db['AnalyticMetric'][_0xcba5('0x45')]({'raw':!![]});}return null;})[_0xcba5('0x23')](function(_0x10ac0f){if(_0x10ac0f){_0xe18f8e=_[_0xcba5('0x72')](_0x10ac0f,'id');var _0x239da6;var _0x3335e3=squel[_0xcba5('0x8e')]();_0x3335e3[_0xcba5('0x73')](_0x290b2a[_0xcba5('0x74')]);for(var _0x5f08a7=0x0;_0x5f08a7<_0x57c7c4[_0xcba5('0x38')];_0x5f08a7+=0x1){_0x239da6=_0x57c7c4[_0x5f08a7][_0xcba5('0x75')]?_0xe18f8e[_0x57c7c4[_0x5f08a7][_0xcba5('0x75')]]['metric']:_0x57c7c4[_0x5f08a7]['field'];_0x239da6=_0x57c7c4[_0x5f08a7][_0xcba5('0x77')]?_[_0xcba5('0x78')](_0x1f517b[_0x57c7c4[_0x5f08a7][_0xcba5('0x77')]],'%s',_0x239da6):_0x239da6;_0x239da6=_0x57c7c4[_0x5f08a7][_0xcba5('0x79')]?_[_0xcba5('0x78')](_0x41aef3[_0x57c7c4[_0x5f08a7][_0xcba5('0x79')]],'%s',_0x239da6):_0x239da6;if(_0x57c7c4[_0x5f08a7][_0xcba5('0x7a')]){_0x3335e3[_0xcba5('0x6a')](_0x239da6);}_0x57c7c4[_0x5f08a7]['orderBy']&&_0x3335e3[_0xcba5('0x3b')](_0x239da6,_0x57c7c4[_0x5f08a7][_0xcba5('0x7b')]===_0xcba5('0x8f')?![]:!![]);_0x3335e3[_0xcba5('0x8c')](_0x239da6,_0x57c7c4[_0x5f08a7]['alias']||_0x239da6);}if(_0x290b2a[_0xcba5('0x7d')]){_0x290b2a['joins']=JSON[_0xcba5('0x7e')](_0x290b2a[_0xcba5('0x7d')]);for(var _0x344bd2=0x0;_0x344bd2<_0x290b2a[_0xcba5('0x7d')][_0xcba5('0x38')];_0x344bd2+=0x1){if(_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x2f')]&&_[_0xcba5('0x90')](_0xe511bb,_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x2f')])&&_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x7f')]&&_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x80')]&&_0x290b2a['joins'][_0x344bd2]['foreignKey']){_0x3335e3[_0x290b2a[_0xcba5('0x7d')][_0x344bd2]['type']](_0x290b2a[_0xcba5('0x7d')][_0x344bd2]['foreignTable'],null,util[_0xcba5('0x79')](_0xcba5('0x82'),_0x290b2a[_0xcba5('0x74')],_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x7f')],_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x80')],_0x290b2a[_0xcba5('0x7d')][_0x344bd2][_0xcba5('0x81')]));}}}if(_0x290b2a[_0xcba5('0x83')]){_0x290b2a[_0xcba5('0x83')]=JSON[_0xcba5('0x7e')](_0x290b2a[_0xcba5('0x83')]);_0x3335e3[_0xcba5('0x3d')](_0x3d1895(_0x290b2a[_0xcba5('0x83')][_0xcba5('0x6a')]));}_0x1c9ff2=_0x3335e3[_0xcba5('0x91')]();_0x3335e3[_0xcba5('0x1d')](_0x46a38f);_0x3335e3[_0xcba5('0x1b')](0x0);return;}})[_0xcba5('0x23')](function(){if(_0x9fbb19[_0xcba5('0x92')]===_0xcba5('0x93')){return null;}var _0x14557c=_['merge'](_0x9fbb19,{'name':_0x9fbb19[_0xcba5('0x94')]||_0x9fbb19['name']||_0x290b2a[_0xcba5('0x29')],'basename':_0x170e3d,'savename':util[_0xcba5('0x79')](_0xcba5('0x95'),_0x9fbb19[_0xcba5('0x29')]||_0x290b2a[_0xcba5('0x29')],require('randomstring')[_0xcba5('0x96')](0x4),_0x9fbb19[_0xcba5('0x92')]||_0xcba5('0x97')),'reportId':_0x290b2a['id'],'reportType':_0xcba5('0x98')});return db[_0xcba5('0x99')][_0xcba5('0x4b')](_0x14557c,{'raw':!![]});})[_0xcba5('0x23')](function(_0x290183){if(_0x290b2a[_0xcba5('0x74')]===_0xcba5('0x9a')){_0x1c9ff2[_0xcba5('0x3d')](_0x290b2a[_0xcba5('0x74')]+_0xcba5('0x9b'),_0x9fbb19[_0xcba5('0x9c')],_0x9fbb19['endDate']);}else{_0x1c9ff2[_0xcba5('0x3d')](_0x290b2a[_0xcba5('0x74')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x9fbb19[_0xcba5('0x9c')],_0x9fbb19['endDate']);}if(_0x290183){logger['info'](_0xcba5('0x9d'),_0x1c9ff2[_0xcba5('0x86')]());require(_0xcba5('0x9e'))[_0xcba5('0x9f')](path['join'](__dirname,_0xcba5('0xa0'),_0x290183[_0xcba5('0x92')]),[_0x290183['id'],_0x1c9ff2[_0xcba5('0x86')](),path[_0xcba5('0x55')](__dirname,_0xcba5('0xa1'),_0x290183[_0xcba5('0xa2')]),_0x170e3d]);return _0x290183;}else{var _0xa0e481=squel[_0xcba5('0x8e')]();_0xa0e481[_0xcba5('0x73')]('('+_0x1c9ff2[_0xcba5('0x86')]()+')',_0xcba5('0xa3'));_0xa0e481['field'](_0xcba5('0xa4'),_0xcba5('0x42'));_0x1c9ff2[_0xcba5('0x1d')](_0x9fbb19[_0xcba5('0x1d')]||_0x46a38f);_0x1c9ff2[_0xcba5('0x1b')](_0x9fbb19[_0xcba5('0x1b')]||0x0);return dbH[_0xcba5('0x87')][_0xcba5('0x32')](_0xa0e481[_0xcba5('0x86')](),{'type':dbH[_0xcba5('0x87')]['QueryTypes']['SELECT']})[_0xcba5('0x23')](function(_0x3d14cb){if(!_0x3d14cb[_0xcba5('0x38')]){_0x5d35b4=0x0;}else{_0x5d35b4=_0x3d14cb[0x0][_0xcba5('0x42')]||0x0;}return dbH['sequelize'][_0xcba5('0x32')](_0x1c9ff2[_0xcba5('0x86')](),{'type':dbH['sequelize'][_0xcba5('0x88')][_0xcba5('0xa5')]});})[_0xcba5('0x23')](function(_0x48abce){return{'rows':_0x48abce||[],'count':_0x5d35b4};});}});}exports[_0xcba5('0xa6')]=function(_0x32b12b,_0x2a04ad){return runReport(_0x32b12b[_0xcba5('0x49')],_0x32b12b[_0xcba5('0x32')],_0x32b12b[_0xcba5('0x6d')])[_0xcba5('0x23')](respondWithResult(_0x2a04ad,null))[_0xcba5('0x47')](handleError(_0x2a04ad,null));};exports[_0xcba5('0xa7')]=runReport;exports['query']=function(_0x4196e2,_0xa3a8a4){var _0x4e3da5=0xa;var _0x436e4a=[_0xcba5('0x55'),_0xcba5('0x56'),_0xcba5('0x57'),_0xcba5('0x58')];var _0x54547a={'SUM':_0xcba5('0x59'),'COUNT':_0xcba5('0x5a'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0xcba5('0x5d'),'AVG':_0xcba5('0x5e'),'GROUP_CONCAT':_0xcba5('0x89'),'GROUP_CONCAT ASC':_0xcba5('0x8a'),'GROUP_CONCAT DESC':_0xcba5('0x5f')};var _0x5118ef={'SEC_TO_TIME':_0xcba5('0x60'),'DATE':_0xcba5('0x61'),'HOUR':'HOUR(%s)','ROUND':_0xcba5('0x63'),'UNIX_TIMESTAMP':_0xcba5('0x64')};var _0x55dd4e=function(_0x1eee35){return!_[_0xcba5('0x90')]([_0xcba5('0x65'),_0xcba5('0x66'),_0xcba5('0x67'),_0xcba5('0x68')],_0x1eee35);};var _0x2cfab9=function(_0x564bd6){if(!_0x564bd6||!_0x564bd6[_0xcba5('0x69')]['length']){return'';}for(var _0x28f01e='(',_0x332777=0x0;_0x332777<_0x564bd6[_0xcba5('0x69')][_0xcba5('0x38')];_0x332777+=0x1){_0x332777>0x0&&(_0x28f01e+='\x20'+_0x564bd6[_0xcba5('0x8b')]+'\x20');_0x28f01e+=_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6a')]?_0x2cfab9(_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6a')]):_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x8c')]+'\x20'+_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6b')]+(_0x55dd4e(_0x564bd6[_0xcba5('0x69')][_0x332777][_0xcba5('0x6b')])?'\x20'+_0x564bd6['rules'][_0x332777][_0xcba5('0x6c')]:'');}return _0x28f01e+')';};var _0x565338={'where':{'id':_0x4196e2[_0xcba5('0x49')]['id']}},_0x179217,_0x22f7b0,_0x18b783,_0x903a09,_0x4e9724;_0x565338=_[_0xcba5('0x41')]({},_0x565338,_0x4196e2[_0xcba5('0x6d')]);return db[_0xcba5('0x2d')][_0xcba5('0x4a')](_0x565338)[_0xcba5('0x23')](function(_0x512811){if(_0x512811){_0x179217=_0x512811;return _0x512811[_0xcba5('0x6e')]();}return null;})[_0xcba5('0x23')](function(_0x4227ac){if(_0x4227ac){if(!_0x4227ac[_0xcba5('0x38')]){throw new db[(_0xcba5('0x6f'))][(_0xcba5('0x8d'))](_0xcba5('0x70'),0x193);}_0x22f7b0=_0x4227ac;return db['AnalyticMetric'][_0xcba5('0x45')]({'raw':!![]});}return null;})[_0xcba5('0x23')](function(_0x30ed05){if(_0x30ed05){_0x18b783=_['keyBy'](_0x30ed05,'id');var _0x46c214;var _0x5a8e16=squel['select']();_0x5a8e16['from'](_0x179217[_0xcba5('0x74')]);for(var _0x54f67a=0x0;_0x54f67a<_0x22f7b0[_0xcba5('0x38')];_0x54f67a+=0x1){_0x46c214=_0x22f7b0[_0x54f67a]['MetricId']?_0x18b783[_0x22f7b0[_0x54f67a][_0xcba5('0x75')]][_0xcba5('0x76')]:_0x22f7b0[_0x54f67a][_0xcba5('0x8c')];_0x46c214=_0x22f7b0[_0x54f67a][_0xcba5('0x77')]?_['replace'](_0x54547a[_0x22f7b0[_0x54f67a][_0xcba5('0x77')]],'%s',_0x46c214):_0x46c214;_0x46c214=_0x22f7b0[_0x54f67a][_0xcba5('0x79')]?_[_0xcba5('0x78')](_0x5118ef[_0x22f7b0[_0x54f67a]['format']],'%s',_0x46c214):_0x46c214;if(_0x22f7b0[_0x54f67a][_0xcba5('0x7a')]){_0x5a8e16[_0xcba5('0x6a')](_0x46c214);}_0x22f7b0[_0x54f67a][_0xcba5('0x7b')]&&_0x5a8e16[_0xcba5('0x3b')](_0x46c214,_0x22f7b0[_0x54f67a][_0xcba5('0x7b')]===_0xcba5('0x8f')?![]:!![]);_0x5a8e16[_0xcba5('0x8c')](_0x46c214,_0x22f7b0[_0x54f67a]['alias']||_0x46c214);}if(_0x179217[_0xcba5('0x7d')]){_0x179217['joins']=JSON[_0xcba5('0x7e')](_0x179217['joins']);for(var _0x5b778c=0x0;_0x5b778c<_0x179217[_0xcba5('0x7d')][_0xcba5('0x38')];_0x5b778c+=0x1){if(_0x179217['joins'][_0x5b778c]['type']&&_[_0xcba5('0x90')](_0x436e4a,_0x179217[_0xcba5('0x7d')][_0x5b778c]['type'])&&_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x7f')]&&_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x80')]&&_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x81')]){_0x5a8e16[_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x2f')]](_0x179217['joins'][_0x5b778c][_0xcba5('0x80')],null,util[_0xcba5('0x79')]('%s.%s\x20=\x20%s.%s',_0x179217['table'],_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x7f')],_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x80')],_0x179217[_0xcba5('0x7d')][_0x5b778c][_0xcba5('0x81')]));}}}if(_0x179217[_0xcba5('0x83')]){_0x179217[_0xcba5('0x83')]=JSON['parse'](_0x179217[_0xcba5('0x83')]);_0x5a8e16['where'](_0x2cfab9(_0x179217['conditions']['group']));}_0x4e9724=_0x5a8e16[_0xcba5('0x91')]();_0x5a8e16[_0xcba5('0x1d')](_0x4e3da5);_0x5a8e16[_0xcba5('0x1b')](0x0);logger[_0xcba5('0x84')]('Limited\x20Query:',_0x5a8e16['toString']());return dbH[_0xcba5('0x87')][_0xcba5('0x32')](_0x5a8e16[_0xcba5('0x86')](),{'type':dbH[_0xcba5('0x87')]['QueryTypes'][_0xcba5('0xa5')]});}})[_0xcba5('0x23')](function(){return{'sql':_0x4e9724[_0xcba5('0x86')]()};})[_0xcba5('0x23')](respondWithResult(_0xa3a8a4,null))[_0xcba5('0x47')](handleError(_0xa3a8a4,null));}; \ No newline at end of file +var _0x93f4=['CustomReports','UserProfileResource','sendStatus','error','stack','name','index','AnalyticCustomReport','rawAttributes','type','key','map','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','group','field','condition','value','Sequelize','ValidationErrorItem','keyBy','select','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','join','COUNT(%s)','IS\x20EMPTY','operator','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','from','groupBy','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','../../files/reports','savename','countTable','COUNT(*)','run','runReport','MAX(%s)','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','dbH','status','end','json','offset','undefined','count','limit','set','apply','then','destroy','get'];(function(_0x149cbe,_0x37e5b8){var _0x70795=function(_0x4cb85c){while(--_0x4cb85c){_0x149cbe['push'](_0x149cbe['shift']());}};_0x70795(++_0x37e5b8);}(_0x93f4,0x124));var _0x493f=function(_0xb29e9b,_0x6dee8c){_0xb29e9b=_0xb29e9b-0x0;var _0x10b5dc=_0x93f4[_0xb29e9b];return _0x10b5dc;};'use strict';var emlformat=require(_0x493f('0x0'));var rimraf=require(_0x493f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x493f('0x2'));var rp=require('request-promise');var moment=require(_0x493f('0x3'));var BPromise=require(_0x493f('0x4'));var Mustache=require(_0x493f('0x5'));var util=require(_0x493f('0x6'));var path=require(_0x493f('0x7'));var sox=require(_0x493f('0x8'));var csv=require(_0x493f('0x9'));var ejs=require(_0x493f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require(_0x493f('0xe'));var deskjs=require(_0x493f('0xf'));var toCsv=require(_0x493f('0x9'));var querystring=require(_0x493f('0x10'));var Papa=require(_0x493f('0x11'));var Redis=require(_0x493f('0x12'));var authService=require(_0x493f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x493f('0x14'));var hardwareService=require(_0x493f('0x15'));var logger=require('../../config/logger')(_0x493f('0x16'));var utils=require(_0x493f('0x17'));var config=require(_0x493f('0x18'));var licenseUtil=require(_0x493f('0x19'));var db=require(_0x493f('0x1a'))['db'];var dbH=require(_0x493f('0x1a'))[_0x493f('0x1b')];function respondWithStatusCode(_0x4bdc5e,_0x43a352){_0x43a352=_0x43a352||0xcc;return function(_0x436b02){if(_0x436b02){return _0x4bdc5e['sendStatus'](_0x43a352);}return _0x4bdc5e[_0x493f('0x1c')](_0x43a352)[_0x493f('0x1d')]();};}function respondWithResult(_0x2e83df,_0x1e7156){_0x1e7156=_0x1e7156||0xc8;return function(_0x33a910){if(_0x33a910){return _0x2e83df[_0x493f('0x1c')](_0x1e7156)[_0x493f('0x1e')](_0x33a910);}};}function respondWithFilteredResult(_0x13884f,_0x408fe1){return function(_0x2fe523){if(_0x2fe523){var _0x6905d0=typeof _0x408fe1[_0x493f('0x1f')]==='undefined'&&typeof _0x408fe1['limit']===_0x493f('0x20');var _0x208568=_0x2fe523[_0x493f('0x21')];var _0x276eaf=_0x6905d0?0x0:_0x408fe1['offset'];var _0x571a7c=_0x6905d0?_0x2fe523[_0x493f('0x21')]:_0x408fe1['offset']+_0x408fe1[_0x493f('0x22')];var _0x36cef8;if(_0x571a7c>=_0x208568){_0x571a7c=_0x208568;_0x36cef8=0xc8;}else{_0x36cef8=0xce;}_0x13884f[_0x493f('0x1c')](_0x36cef8);return _0x13884f[_0x493f('0x23')]('Content-Range',_0x276eaf+'-'+_0x571a7c+'/'+_0x208568)[_0x493f('0x1e')](_0x2fe523);}return null;};}function patchUpdates(_0x26cd55){return function(_0x1913ef){try{jsonpatch[_0x493f('0x24')](_0x1913ef,_0x26cd55,!![]);}catch(_0x233db6){return BPromise['reject'](_0x233db6);}return _0x1913ef['save']();};}function saveUpdates(_0x43830c,_0xb21fe6){return function(_0x13c0c9){if(_0x13c0c9){return _0x13c0c9['update'](_0x43830c)[_0x493f('0x25')](function(_0x404d47){return _0x404d47;});}return null;};}function removeEntity(_0x3eb068,_0xe9b085){return function(_0x58d06){if(_0x58d06){return _0x58d06[_0x493f('0x26')]()['then'](function(){var _0x3eb381=_0x58d06[_0x493f('0x27')]({'plain':!![]});var _0x2b7108=_0x493f('0x28');return db[_0x493f('0x29')][_0x493f('0x26')]({'where':{'type':_0x2b7108,'resourceId':_0x3eb381['id']}})['then'](function(){return _0x58d06;});})[_0x493f('0x25')](function(){_0x3eb068['status'](0xcc)[_0x493f('0x1d')]();});}};}function handleEntityNotFound(_0x180052,_0x45d0be){return function(_0x4209b8){if(!_0x4209b8){_0x180052[_0x493f('0x2a')](0x194);}return _0x4209b8;};}function handleError(_0xc552c,_0x24681b){_0x24681b=_0x24681b||0x1f4;return function(_0x1dfa3e){logger[_0x493f('0x2b')](_0x1dfa3e[_0x493f('0x2c')]);if(_0x1dfa3e[_0x493f('0x2d')]){delete _0x1dfa3e['name'];}_0xc552c['status'](_0x24681b)['send'](_0x1dfa3e);};}exports[_0x493f('0x2e')]=function(_0x588180,_0x3b4bf3){var _0x4bcf53={},_0x45609b={},_0x352656={'count':0x0,'rows':[]};var _0x5d9347=_['map'](db[_0x493f('0x2f')][_0x493f('0x30')],function(_0x230d35){return{'name':_0x230d35['fieldName'],'type':_0x230d35[_0x493f('0x31')][_0x493f('0x32')]};});_0x45609b['model']=_[_0x493f('0x33')](_0x5d9347,'name');_0x45609b[_0x493f('0x34')]=_['keys'](_0x588180[_0x493f('0x34')]);_0x45609b['filters']=_[_0x493f('0x35')](_0x45609b['model'],_0x45609b['query']);_0x4bcf53['attributes']=_[_0x493f('0x35')](_0x45609b[_0x493f('0x36')],qs['fields'](_0x588180[_0x493f('0x34')][_0x493f('0x37')]));_0x4bcf53[_0x493f('0x38')]=_0x4bcf53[_0x493f('0x38')][_0x493f('0x39')]?_0x4bcf53['attributes']:_0x45609b[_0x493f('0x36')];if(!_0x588180[_0x493f('0x34')][_0x493f('0x3a')](_0x493f('0x3b'))){_0x4bcf53[_0x493f('0x22')]=qs['limit'](_0x588180[_0x493f('0x34')]['limit']);_0x4bcf53[_0x493f('0x1f')]=qs[_0x493f('0x1f')](_0x588180[_0x493f('0x34')]['offset']);}_0x4bcf53[_0x493f('0x3c')]=qs[_0x493f('0x3d')](_0x588180[_0x493f('0x34')]['sort']);_0x4bcf53[_0x493f('0x3e')]=qs['filters'](_[_0x493f('0x3f')](_0x588180[_0x493f('0x34')],_0x45609b[_0x493f('0x40')]),_0x5d9347);if(_0x588180[_0x493f('0x34')][_0x493f('0x41')]){_0x4bcf53['where']=_['merge'](_0x4bcf53[_0x493f('0x3e')],{'$or':_[_0x493f('0x33')](_0x5d9347,function(_0x4ffa01){if(_0x4ffa01[_0x493f('0x31')]!=='VIRTUAL'){var _0x5c259e={};_0x5c259e[_0x4ffa01['name']]={'$like':'%'+_0x588180[_0x493f('0x34')][_0x493f('0x41')]+'%'};return _0x5c259e;}})});}_0x4bcf53=_[_0x493f('0x42')]({},_0x4bcf53,_0x588180[_0x493f('0x43')]);var _0x4c0230={'where':_0x4bcf53[_0x493f('0x3e')]};return db['AnalyticCustomReport'][_0x493f('0x21')](_0x4c0230)[_0x493f('0x25')](function(_0x5ea662){_0x352656[_0x493f('0x21')]=_0x5ea662;if(_0x588180[_0x493f('0x34')][_0x493f('0x44')]){_0x4bcf53[_0x493f('0x45')]=[{'all':!![]}];}return db[_0x493f('0x2f')][_0x493f('0x46')](_0x4bcf53);})[_0x493f('0x25')](function(_0x25d373){_0x352656[_0x493f('0x47')]=_0x25d373;return _0x352656;})[_0x493f('0x25')](respondWithFilteredResult(_0x3b4bf3,_0x4bcf53))[_0x493f('0x48')](handleError(_0x3b4bf3,null));};exports['show']=function(_0x28b3f9,_0x3fc614){var _0x122b1f={'raw':![],'where':{'id':_0x28b3f9['params']['id']}},_0x2b1150={};_0x2b1150['model']=_['keys'](db[_0x493f('0x2f')][_0x493f('0x30')]);_0x2b1150[_0x493f('0x34')]=_['keys'](_0x28b3f9['query']);_0x2b1150[_0x493f('0x40')]=_['intersection'](_0x2b1150[_0x493f('0x36')],_0x2b1150[_0x493f('0x34')]);_0x122b1f['attributes']=_[_0x493f('0x35')](_0x2b1150[_0x493f('0x36')],qs['fields'](_0x28b3f9[_0x493f('0x34')][_0x493f('0x37')]));_0x122b1f[_0x493f('0x38')]=_0x122b1f[_0x493f('0x38')]['length']?_0x122b1f[_0x493f('0x38')]:_0x2b1150[_0x493f('0x36')];if(_0x28b3f9[_0x493f('0x34')][_0x493f('0x44')]){_0x122b1f[_0x493f('0x45')]=[{'all':!![]}];}_0x122b1f=_[_0x493f('0x42')]({},_0x122b1f,_0x28b3f9['options']);return db[_0x493f('0x2f')][_0x493f('0x49')](_0x122b1f)[_0x493f('0x25')](handleEntityNotFound(_0x3fc614,null))[_0x493f('0x25')](respondWithResult(_0x3fc614,null))['catch'](handleError(_0x3fc614,null));};exports['create']=function(_0x5ae1d2,_0x5a61f1){return db[_0x493f('0x2f')][_0x493f('0x4a')](_0x5ae1d2[_0x493f('0x4b')],{})[_0x493f('0x25')](function(_0x32075d){var _0x35dc3e=_0x5ae1d2[_0x493f('0x4c')][_0x493f('0x27')]({'plain':!![]});if(!_0x35dc3e)throw new Error(_0x493f('0x4d'));if(_0x35dc3e['role']===_0x493f('0x4c')){var _0x4ee012=_0x32075d[_0x493f('0x27')]({'plain':!![]});var _0x1dc8d4=_0x493f('0x4e');return db['UserProfileSection'][_0x493f('0x49')]({'where':{'name':_0x1dc8d4,'userProfileId':_0x35dc3e[_0x493f('0x4f')]},'raw':!![]})[_0x493f('0x25')](function(_0x1e8c9b){if(_0x1e8c9b&&_0x1e8c9b[_0x493f('0x50')]===0x0){return db[_0x493f('0x29')][_0x493f('0x4a')]({'name':_0x4ee012[_0x493f('0x2d')],'resourceId':_0x4ee012['id'],'type':'CustomReports','sectionId':_0x1e8c9b['id']},{})[_0x493f('0x25')](function(){return _0x32075d;});}else{return _0x32075d;}})['catch'](function(_0x35b104){logger[_0x493f('0x2b')](_0x493f('0x51'),_0x35b104);throw _0x35b104;});}return _0x32075d;})['then'](respondWithResult(_0x5a61f1,0xc9))[_0x493f('0x48')](handleError(_0x5a61f1,null));};exports[_0x493f('0x52')]=function(_0x414e43,_0x581704){if(_0x414e43[_0x493f('0x4b')]['id']){delete _0x414e43[_0x493f('0x4b')]['id'];}return db[_0x493f('0x2f')][_0x493f('0x49')]({'where':{'id':_0x414e43[_0x493f('0x53')]['id']}})[_0x493f('0x25')](handleEntityNotFound(_0x581704,null))[_0x493f('0x25')](saveUpdates(_0x414e43['body'],null))[_0x493f('0x25')](respondWithResult(_0x581704,null))[_0x493f('0x48')](handleError(_0x581704,null));};exports['destroy']=function(_0x1aa548,_0x565995){return db[_0x493f('0x2f')]['find']({'where':{'id':_0x1aa548[_0x493f('0x53')]['id']}})[_0x493f('0x25')](handleEntityNotFound(_0x565995,null))['then'](removeEntity(_0x565995,null))[_0x493f('0x48')](handleError(_0x565995,null));};exports['preview']=function(_0x9c6e08,_0x2db416){var _0x44ffde=0xa;var _0x5ed462=['join',_0x493f('0x54'),_0x493f('0x55'),_0x493f('0x56')];var _0x2b95d1={'SUM':_0x493f('0x57'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x493f('0x58'),'MAX':'MAX(%s)','MIN':_0x493f('0x59'),'AVG':_0x493f('0x5a'),'GROUP_CONCAT':_0x493f('0x5b'),'GROUP_CONCAT ASC':_0x493f('0x5c'),'GROUP_CONCAT DESC':_0x493f('0x5d')};var _0x2bc93b={'SEC_TO_TIME':_0x493f('0x5e'),'DATE':_0x493f('0x5f'),'HOUR':_0x493f('0x60'),'ROUND':_0x493f('0x61'),'UNIX_TIMESTAMP':_0x493f('0x62')};var _0x1eb8e7=function(_0x23a273){return!_[_0x493f('0x63')]([_0x493f('0x64'),_0x493f('0x65'),'IS\x20EMPTY',_0x493f('0x66')],_0x23a273);};var _0x507376=function(_0x472a06){if(!_0x472a06||!_0x472a06[_0x493f('0x67')][_0x493f('0x39')]){return'';}for(var _0x215327='(',_0x4ebd9b=0x0;_0x4ebd9b<_0x472a06[_0x493f('0x67')]['length'];_0x4ebd9b+=0x1){_0x4ebd9b>0x0&&(_0x215327+='\x20'+_0x472a06['operator']+'\x20');_0x215327+=_0x472a06['rules'][_0x4ebd9b]['group']?_0x507376(_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x68')]):_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x69')]+'\x20'+_0x472a06['rules'][_0x4ebd9b]['condition']+(_0x1eb8e7(_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x6a')])?'\x20'+_0x472a06[_0x493f('0x67')][_0x4ebd9b][_0x493f('0x6b')]:'');}return _0x215327+')';};var _0x54cdbd={'where':{'id':_0x9c6e08[_0x493f('0x53')]['id']}},_0x269988,_0x31c420,_0x276acb,_0x59a0e8,_0x28b988;_0x54cdbd=_[_0x493f('0x42')]({},_0x54cdbd,_0x9c6e08[_0x493f('0x43')]);return db['AnalyticCustomReport'][_0x493f('0x49')](_0x54cdbd)[_0x493f('0x25')](function(_0x5edc4c){if(_0x5edc4c){_0x269988=_0x5edc4c;return _0x5edc4c['getFields']();}return null;})['then'](function(_0x3c8692){if(_0x3c8692){if(!_0x3c8692['length']){throw new db[(_0x493f('0x6c'))][(_0x493f('0x6d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x31c420=_0x3c8692;return db['AnalyticMetric'][_0x493f('0x46')]({'raw':!![]});}return null;})[_0x493f('0x25')](function(_0x2a192d){if(_0x2a192d){_0x276acb=_[_0x493f('0x6e')](_0x2a192d,'id');var _0x17571d;var _0x380e6d=squel[_0x493f('0x6f')]();_0x380e6d['from'](_0x269988[_0x493f('0x70')]);for(var _0x481d7e=0x0;_0x481d7e<_0x31c420[_0x493f('0x39')];_0x481d7e+=0x1){_0x17571d=_0x31c420[_0x481d7e][_0x493f('0x71')]?_0x276acb[_0x31c420[_0x481d7e][_0x493f('0x71')]][_0x493f('0x72')]:_0x31c420[_0x481d7e][_0x493f('0x69')];_0x17571d=_0x31c420[_0x481d7e][_0x493f('0x73')]?_[_0x493f('0x74')](_0x2b95d1[_0x31c420[_0x481d7e][_0x493f('0x73')]],'%s',_0x17571d):_0x17571d;_0x17571d=_0x31c420[_0x481d7e][_0x493f('0x75')]?_[_0x493f('0x74')](_0x2bc93b[_0x31c420[_0x481d7e][_0x493f('0x75')]],'%s',_0x17571d):_0x17571d;if(_0x31c420[_0x481d7e]['groupBy']){_0x380e6d[_0x493f('0x68')](_0x17571d);}_0x31c420[_0x481d7e][_0x493f('0x76')]&&_0x380e6d[_0x493f('0x3c')](_0x17571d,_0x31c420[_0x481d7e]['orderBy']===_0x493f('0x77')?![]:!![]);_0x380e6d[_0x493f('0x69')](_0x17571d,_0x31c420[_0x481d7e][_0x493f('0x78')]||_0x17571d);}if(_0x269988['joins']){_0x269988[_0x493f('0x79')]=JSON['parse'](_0x269988['joins']);for(var _0x1cfa36=0x0;_0x1cfa36<_0x269988[_0x493f('0x79')][_0x493f('0x39')];_0x1cfa36+=0x1){if(_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x31')]&&_[_0x493f('0x63')](_0x5ed462,_0x269988[_0x493f('0x79')][_0x1cfa36]['type'])&&_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7a')]&&_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7b')]&&_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7c')]){_0x380e6d[_0x269988[_0x493f('0x79')][_0x1cfa36]['type']](_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7b')],null,util['format'](_0x493f('0x7d'),_0x269988[_0x493f('0x70')],_0x269988['joins'][_0x1cfa36]['parentKey'],_0x269988[_0x493f('0x79')][_0x1cfa36][_0x493f('0x7b')],_0x269988[_0x493f('0x79')][_0x1cfa36]['foreignKey']));}}}if(_0x269988[_0x493f('0x7e')]){_0x269988[_0x493f('0x7e')]=JSON[_0x493f('0x7f')](_0x269988[_0x493f('0x7e')]);_0x380e6d['where'](_0x507376(_0x269988[_0x493f('0x7e')]['group']));}_0x28b988=_0x380e6d[_0x493f('0x80')]();_0x380e6d['limit'](_0x44ffde);_0x380e6d[_0x493f('0x1f')](0x0);logger[_0x493f('0x81')](_0x493f('0x82'),_0x380e6d[_0x493f('0x83')]());return dbH[_0x493f('0x84')]['query'](_0x380e6d['toString'](),{'type':dbH[_0x493f('0x84')][_0x493f('0x85')][_0x493f('0x86')]});}})[_0x493f('0x25')](respondWithResult(_0x2db416,null))[_0x493f('0x48')](handleError(_0x2db416,null));};function runReport(_0x2a0a75,_0x15a0a5,_0x1a77ee){var _0x268523=_0x15a0a5['name'];var _0x41bf51=0xa;var _0x17aa99=[_0x493f('0x87'),_0x493f('0x54'),_0x493f('0x55'),'cross_join'];var _0x5b9ee3={'SUM':_0x493f('0x57'),'COUNT':_0x493f('0x88'),'COUNT DISTINCT':_0x493f('0x58'),'MAX':'MAX(%s)','MIN':_0x493f('0x59'),'AVG':_0x493f('0x5a'),'GROUP_CONCAT':_0x493f('0x5b'),'GROUP_CONCAT ASC':_0x493f('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x153bf8={'SEC_TO_TIME':_0x493f('0x5e'),'DATE':_0x493f('0x5f'),'HOUR':_0x493f('0x60'),'ROUND':_0x493f('0x61'),'UNIX_TIMESTAMP':_0x493f('0x62')};var _0x4eccc3=function(_0xaf934){return!_[_0x493f('0x63')]([_0x493f('0x64'),'IS\x20NOT\x20NULL',_0x493f('0x89'),'IS\x20NOT\x20EMPTY'],_0xaf934);};var _0x2b1bfe=function(_0x373ce3){if(!_0x373ce3||!_0x373ce3[_0x493f('0x67')]['length']){return'';}for(var _0x300b42='(',_0x5bab0a=0x0;_0x5bab0a<_0x373ce3[_0x493f('0x67')][_0x493f('0x39')];_0x5bab0a+=0x1){_0x5bab0a>0x0&&(_0x300b42+='\x20'+_0x373ce3[_0x493f('0x8a')]+'\x20');_0x300b42+=_0x373ce3['rules'][_0x5bab0a]['group']?_0x2b1bfe(_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x68')]):_0x373ce3['rules'][_0x5bab0a]['field']+'\x20'+_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x6a')]+(_0x4eccc3(_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x6a')])?'\x20'+_0x373ce3[_0x493f('0x67')][_0x5bab0a][_0x493f('0x6b')]:'');}return _0x300b42+')';};var _0x131b58={'where':{'id':_0x2a0a75['id']}},_0x3204dc,_0x22e77d,_0xc628d4,_0xee874b,_0xdb2949;_0x131b58=_[_0x493f('0x42')]({},_0x131b58,_0x1a77ee);return db[_0x493f('0x2f')][_0x493f('0x49')](_0x131b58)['then'](function(_0x1122e9){if(_0x1122e9){_0x3204dc=_0x1122e9;return _0x1122e9[_0x493f('0x8b')]();}return null;})['then'](function(_0xe82b58){if(_0xe82b58){if(!_0xe82b58['length']){throw new db[(_0x493f('0x6c'))][(_0x493f('0x6d'))](_0x493f('0x8c'),0x193);}_0x22e77d=_0xe82b58;return db[_0x493f('0x8d')]['findAll']({'raw':!![]});}return null;})['then'](function(_0xa46a16){if(_0xa46a16){_0xc628d4=_[_0x493f('0x6e')](_0xa46a16,'id');var _0xf24eef;var _0x5895c1=squel[_0x493f('0x6f')]();_0x5895c1[_0x493f('0x8e')](_0x3204dc['table']);for(var _0x1c55d6=0x0;_0x1c55d6<_0x22e77d[_0x493f('0x39')];_0x1c55d6+=0x1){_0xf24eef=_0x22e77d[_0x1c55d6][_0x493f('0x71')]?_0xc628d4[_0x22e77d[_0x1c55d6][_0x493f('0x71')]]['metric']:_0x22e77d[_0x1c55d6][_0x493f('0x69')];_0xf24eef=_0x22e77d[_0x1c55d6][_0x493f('0x73')]?_['replace'](_0x5b9ee3[_0x22e77d[_0x1c55d6]['function']],'%s',_0xf24eef):_0xf24eef;_0xf24eef=_0x22e77d[_0x1c55d6]['format']?_[_0x493f('0x74')](_0x153bf8[_0x22e77d[_0x1c55d6][_0x493f('0x75')]],'%s',_0xf24eef):_0xf24eef;if(_0x22e77d[_0x1c55d6][_0x493f('0x8f')]){_0x5895c1[_0x493f('0x68')](_0xf24eef);}_0x22e77d[_0x1c55d6]['orderBy']&&_0x5895c1['order'](_0xf24eef,_0x22e77d[_0x1c55d6][_0x493f('0x76')]==='DESC'?![]:!![]);_0x5895c1[_0x493f('0x69')](_0xf24eef,_0x22e77d[_0x1c55d6][_0x493f('0x78')]||_0xf24eef);}if(_0x3204dc[_0x493f('0x79')]){_0x3204dc[_0x493f('0x79')]=JSON['parse'](_0x3204dc[_0x493f('0x79')]);for(var _0x10845e=0x0;_0x10845e<_0x3204dc[_0x493f('0x79')][_0x493f('0x39')];_0x10845e+=0x1){if(_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x31')]&&_['includes'](_0x17aa99,_0x3204dc[_0x493f('0x79')][_0x10845e]['type'])&&_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x7a')]&&_0x3204dc[_0x493f('0x79')][_0x10845e]['foreignTable']&&_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x7c')]){_0x5895c1[_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x31')]](_0x3204dc['joins'][_0x10845e][_0x493f('0x7b')],null,util[_0x493f('0x75')](_0x493f('0x7d'),_0x3204dc['table'],_0x3204dc[_0x493f('0x79')][_0x10845e][_0x493f('0x7a')],_0x3204dc[_0x493f('0x79')][_0x10845e]['foreignTable'],_0x3204dc[_0x493f('0x79')][_0x10845e]['foreignKey']));}}}if(_0x3204dc[_0x493f('0x7e')]){_0x3204dc[_0x493f('0x7e')]=JSON[_0x493f('0x7f')](_0x3204dc[_0x493f('0x7e')]);_0x5895c1[_0x493f('0x3e')](_0x2b1bfe(_0x3204dc[_0x493f('0x7e')]['group']));}_0xdb2949=_0x5895c1[_0x493f('0x80')]();_0x5895c1[_0x493f('0x22')](_0x41bf51);_0x5895c1[_0x493f('0x1f')](0x0);return;}})[_0x493f('0x25')](function(){if(_0x15a0a5[_0x493f('0x90')]==='web'){return null;}var _0x44ff76=_['merge'](_0x15a0a5,{'name':_0x15a0a5[_0x493f('0x91')]||_0x15a0a5['name']||_0x3204dc[_0x493f('0x2d')],'basename':_0x268523,'savename':util['format'](_0x493f('0x92'),_0x15a0a5['name']||_0x3204dc[_0x493f('0x2d')],require(_0x493f('0x93'))[_0x493f('0x94')](0x4),_0x15a0a5[_0x493f('0x90')]||_0x493f('0x95')),'reportId':_0x3204dc['id'],'reportType':_0x493f('0x96')});return db[_0x493f('0x97')][_0x493f('0x4a')](_0x44ff76,{'raw':!![]});})[_0x493f('0x25')](function(_0xe73fed){if(_0x3204dc['table']==='cdr'){_0xdb2949[_0x493f('0x3e')](_0x3204dc[_0x493f('0x70')]+_0x493f('0x98'),_0x15a0a5[_0x493f('0x99')],_0x15a0a5['endDate']);}else{_0xdb2949[_0x493f('0x3e')](_0x3204dc[_0x493f('0x70')]+_0x493f('0x9a'),_0x15a0a5['startDate'],_0x15a0a5[_0x493f('0x9b')]);}if(_0xe73fed){logger[_0x493f('0x9c')](_0x493f('0x9d'),_0xdb2949[_0x493f('0x83')]());require(_0x493f('0x9e'))['fork'](path[_0x493f('0x87')](__dirname,'../../components/export/',_0xe73fed[_0x493f('0x90')]),[_0xe73fed['id'],_0xdb2949[_0x493f('0x83')](),path[_0x493f('0x87')](__dirname,_0x493f('0x9f'),_0xe73fed[_0x493f('0xa0')]),_0x268523]);return _0xe73fed;}else{var _0x3859ef=squel[_0x493f('0x6f')]();_0x3859ef[_0x493f('0x8e')]('('+_0xdb2949[_0x493f('0x83')]()+')',_0x493f('0xa1'));_0x3859ef[_0x493f('0x69')](_0x493f('0xa2'),_0x493f('0x21'));_0xdb2949[_0x493f('0x22')](_0x15a0a5['limit']||_0x41bf51);_0xdb2949['offset'](_0x15a0a5[_0x493f('0x1f')]||0x0);return dbH[_0x493f('0x84')]['query'](_0x3859ef[_0x493f('0x83')](),{'type':dbH['sequelize'][_0x493f('0x85')]['SELECT']})[_0x493f('0x25')](function(_0x39bf78){if(!_0x39bf78[_0x493f('0x39')]){_0xee874b=0x0;}else{_0xee874b=_0x39bf78[0x0][_0x493f('0x21')]||0x0;}return dbH[_0x493f('0x84')][_0x493f('0x34')](_0xdb2949[_0x493f('0x83')](),{'type':dbH[_0x493f('0x84')][_0x493f('0x85')][_0x493f('0x86')]});})['then'](function(_0x4ab383){return{'rows':_0x4ab383||[],'count':_0xee874b};});}});}exports[_0x493f('0xa3')]=function(_0x4f232f,_0x3ac606){return runReport(_0x4f232f[_0x493f('0x53')],_0x4f232f[_0x493f('0x34')],_0x4f232f[_0x493f('0x43')])[_0x493f('0x25')](respondWithResult(_0x3ac606,null))[_0x493f('0x48')](handleError(_0x3ac606,null));};exports[_0x493f('0xa4')]=runReport;exports[_0x493f('0x34')]=function(_0x3896a3,_0x1138da){var _0x435789=0xa;var _0x3ae1ea=[_0x493f('0x87'),_0x493f('0x54'),_0x493f('0x55'),_0x493f('0x56')];var _0x35a20a={'SUM':_0x493f('0x57'),'COUNT':_0x493f('0x88'),'COUNT DISTINCT':_0x493f('0x58'),'MAX':_0x493f('0xa5'),'MIN':_0x493f('0x59'),'AVG':_0x493f('0x5a'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x493f('0x5c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x362a15={'SEC_TO_TIME':_0x493f('0x5e'),'DATE':_0x493f('0x5f'),'HOUR':_0x493f('0x60'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x493f('0x62')};var _0x5d7d13=function(_0x39aec6){return!_[_0x493f('0x63')]([_0x493f('0x64'),_0x493f('0x65'),_0x493f('0x89'),'IS\x20NOT\x20EMPTY'],_0x39aec6);};var _0x2fff0c=function(_0x521633){if(!_0x521633||!_0x521633['rules'][_0x493f('0x39')]){return'';}for(var _0x3f28fe='(',_0x54f17f=0x0;_0x54f17f<_0x521633['rules'][_0x493f('0x39')];_0x54f17f+=0x1){_0x54f17f>0x0&&(_0x3f28fe+='\x20'+_0x521633['operator']+'\x20');_0x3f28fe+=_0x521633['rules'][_0x54f17f][_0x493f('0x68')]?_0x2fff0c(_0x521633[_0x493f('0x67')][_0x54f17f][_0x493f('0x68')]):_0x521633['rules'][_0x54f17f]['field']+'\x20'+_0x521633[_0x493f('0x67')][_0x54f17f]['condition']+(_0x5d7d13(_0x521633['rules'][_0x54f17f][_0x493f('0x6a')])?'\x20'+_0x521633[_0x493f('0x67')][_0x54f17f]['value']:'');}return _0x3f28fe+')';};var _0x4dbaf8={'where':{'id':_0x3896a3[_0x493f('0x53')]['id']}},_0x1fdf35,_0x4d5cac,_0x20d5c3,_0x40ea7e,_0x5abf64;_0x4dbaf8=_[_0x493f('0x42')]({},_0x4dbaf8,_0x3896a3[_0x493f('0x43')]);return db['AnalyticCustomReport'][_0x493f('0x49')](_0x4dbaf8)['then'](function(_0x1b745f){if(_0x1b745f){_0x1fdf35=_0x1b745f;return _0x1b745f[_0x493f('0x8b')]();}return null;})[_0x493f('0x25')](function(_0x2531a6){if(_0x2531a6){if(!_0x2531a6[_0x493f('0x39')]){throw new db[(_0x493f('0x6c'))]['ValidationErrorItem'](_0x493f('0x8c'),0x193);}_0x4d5cac=_0x2531a6;return db[_0x493f('0x8d')][_0x493f('0x46')]({'raw':!![]});}return null;})[_0x493f('0x25')](function(_0x3e93a5){if(_0x3e93a5){_0x20d5c3=_['keyBy'](_0x3e93a5,'id');var _0x245265;var _0x3168d1=squel[_0x493f('0x6f')]();_0x3168d1['from'](_0x1fdf35['table']);for(var _0x5a3707=0x0;_0x5a3707<_0x4d5cac['length'];_0x5a3707+=0x1){_0x245265=_0x4d5cac[_0x5a3707][_0x493f('0x71')]?_0x20d5c3[_0x4d5cac[_0x5a3707][_0x493f('0x71')]][_0x493f('0x72')]:_0x4d5cac[_0x5a3707][_0x493f('0x69')];_0x245265=_0x4d5cac[_0x5a3707]['function']?_[_0x493f('0x74')](_0x35a20a[_0x4d5cac[_0x5a3707][_0x493f('0x73')]],'%s',_0x245265):_0x245265;_0x245265=_0x4d5cac[_0x5a3707][_0x493f('0x75')]?_[_0x493f('0x74')](_0x362a15[_0x4d5cac[_0x5a3707][_0x493f('0x75')]],'%s',_0x245265):_0x245265;if(_0x4d5cac[_0x5a3707][_0x493f('0x8f')]){_0x3168d1['group'](_0x245265);}_0x4d5cac[_0x5a3707][_0x493f('0x76')]&&_0x3168d1[_0x493f('0x3c')](_0x245265,_0x4d5cac[_0x5a3707][_0x493f('0x76')]===_0x493f('0x77')?![]:!![]);_0x3168d1[_0x493f('0x69')](_0x245265,_0x4d5cac[_0x5a3707][_0x493f('0x78')]||_0x245265);}if(_0x1fdf35[_0x493f('0x79')]){_0x1fdf35[_0x493f('0x79')]=JSON[_0x493f('0x7f')](_0x1fdf35[_0x493f('0x79')]);for(var _0x956283=0x0;_0x956283<_0x1fdf35[_0x493f('0x79')][_0x493f('0x39')];_0x956283+=0x1){if(_0x1fdf35['joins'][_0x956283]['type']&&_[_0x493f('0x63')](_0x3ae1ea,_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x31')])&&_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7a')]&&_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7b')]&&_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7c')]){_0x3168d1[_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x31')]](_0x1fdf35['joins'][_0x956283][_0x493f('0x7b')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x1fdf35['table'],_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7a')],_0x1fdf35['joins'][_0x956283][_0x493f('0x7b')],_0x1fdf35[_0x493f('0x79')][_0x956283][_0x493f('0x7c')]));}}}if(_0x1fdf35[_0x493f('0x7e')]){_0x1fdf35[_0x493f('0x7e')]=JSON[_0x493f('0x7f')](_0x1fdf35[_0x493f('0x7e')]);_0x3168d1['where'](_0x2fff0c(_0x1fdf35['conditions'][_0x493f('0x68')]));}_0x5abf64=_0x3168d1[_0x493f('0x80')]();_0x3168d1[_0x493f('0x22')](_0x435789);_0x3168d1['offset'](0x0);logger[_0x493f('0x81')](_0x493f('0x82'),_0x3168d1[_0x493f('0x83')]());return dbH[_0x493f('0x84')][_0x493f('0x34')](_0x3168d1['toString'](),{'type':dbH[_0x493f('0x84')][_0x493f('0x85')]['SELECT']});}})['then'](function(){return{'sql':_0x5abf64['toString']()};})[_0x493f('0x25')](respondWithResult(_0x1138da,null))[_0x493f('0x48')](handleError(_0x1138da,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 08da3d7..635aa01 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 _0x8f52=['analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x499be0,_0x44d273){var _0x212ec6=function(_0x44397a){while(--_0x44397a){_0x499be0['push'](_0x499be0['shift']());}};_0x212ec6(++_0x44d273);}(_0x8f52,0x76));var _0x28f5=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x8f52[_0x11dc39];return _0x457277;};'use strict';var _=require('lodash');var util=require(_0x28f5('0x0'));var logger=require(_0x28f5('0x1'))(_0x28f5('0x2'));var moment=require(_0x28f5('0x3'));var BPromise=require(_0x28f5('0x4'));var rp=require(_0x28f5('0x5'));var fs=require('fs');var path=require(_0x28f5('0x6'));var rimraf=require(_0x28f5('0x7'));var config=require(_0x28f5('0x8'));var attributes=require(_0x28f5('0x9'));module[_0x28f5('0xa')]=function(_0x504845,_0x123931){return _0x504845['define'](_0x28f5('0xb'),attributes,{'tableName':_0x28f5('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1052=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x4e8099,_0x1372ed){var _0x535f9e=function(_0x5238c4){while(--_0x5238c4){_0x4e8099['push'](_0x4e8099['shift']());}};_0x535f9e(++_0x1372ed);}(_0x1052,0x168));var _0x2105=function(_0x4c8779,_0x399ca4){_0x4c8779=_0x4c8779-0x0;var _0x55a207=_0x1052[_0x4c8779];return _0x55a207;};'use strict';var _=require(_0x2105('0x0'));var util=require(_0x2105('0x1'));var logger=require(_0x2105('0x2'))(_0x2105('0x3'));var moment=require('moment');var BPromise=require(_0x2105('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2105('0x5'));var rimraf=require(_0x2105('0x6'));var config=require(_0x2105('0x7'));var attributes=require(_0x2105('0x8'));module[_0x2105('0x9')]=function(_0x16f76c,_0x34e4eb){return _0x16f76c[_0x2105('0xa')](_0x2105('0xb'),attributes,{'tableName':'analytics_custom_reports','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 40246b3..c9d568a 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 _0x0794=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','debug'];(function(_0x1541d2,_0x4c1463){var _0x4a7e10=function(_0x48a3a9){while(--_0x48a3a9){_0x1541d2['push'](_0x1541d2['shift']());}};_0x4a7e10(++_0x4c1463);}(_0x0794,0xd5));var _0x4079=function(_0x428d93,_0x16b0ba){_0x428d93=_0x428d93-0x0;var _0x2a2002=_0x0794[_0x428d93];return _0x2a2002;};'use strict';var _=require(_0x4079('0x0'));var util=require(_0x4079('0x1'));var moment=require('moment');var BPromise=require(_0x4079('0x2'));var rs=require(_0x4079('0x3'));var fs=require('fs');var Redis=require(_0x4079('0x4'));var db=require(_0x4079('0x5'))['db'];var utils=require(_0x4079('0x6'));var logger=require(_0x4079('0x7'))('rpc');var config=require(_0x4079('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4079('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x378592,_0x5edcaa,_0x1f1b58){return new BPromise(function(_0x590517,_0x266a5f){return client[_0x4079('0xa')](_0x378592,_0x1f1b58)[_0x4079('0xb')](function(_0x2457eb){logger[_0x4079('0xc')](_0x4079('0xd'),_0x5edcaa,'request\x20sent');logger[_0x4079('0xe')](_0x4079('0xf'),_0x5edcaa,'request\x20sent',JSON['stringify'](_0x2457eb));if(_0x2457eb[_0x4079('0x10')]){if(_0x2457eb[_0x4079('0x10')]['code']===0x1f4){logger[_0x4079('0x10')](_0x4079('0xd'),_0x5edcaa,_0x2457eb[_0x4079('0x10')][_0x4079('0x11')]);return _0x266a5f(_0x2457eb[_0x4079('0x10')]['message']);}logger[_0x4079('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edcaa,_0x2457eb[_0x4079('0x10')][_0x4079('0x11')]);return _0x590517(_0x2457eb[_0x4079('0x10')][_0x4079('0x11')]);}else{logger['info'](_0x4079('0xd'),_0x5edcaa,'request\x20sent');_0x590517(_0x2457eb[_0x4079('0x12')][_0x4079('0x11')]);}})['catch'](function(_0x42d6af){logger[_0x4079('0x10')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5edcaa,_0x42d6af);_0x266a5f(_0x42d6af);});});} \ No newline at end of file +var _0x7768=['../../config/utils','rpc','../../config/environment','client','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb'];(function(_0x2f560e,_0x1cc398){var _0x652c1c=function(_0x320efa){while(--_0x320efa){_0x2f560e['push'](_0x2f560e['shift']());}};_0x652c1c(++_0x1cc398);}(_0x7768,0x1f0));var _0x8776=function(_0x3d9669,_0x471ea2){_0x3d9669=_0x3d9669-0x0;var _0x5c63ea=_0x7768[_0x3d9669];return _0x5c63ea;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8776('0x0'));var BPromise=require(_0x8776('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8776('0x2'));var db=require(_0x8776('0x3'))['db'];var utils=require(_0x8776('0x4'));var logger=require('../../config/logger')(_0x8776('0x5'));var config=require(_0x8776('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8776('0x7')][_0x8776('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f158a,_0x569785,_0xac3149){return new BPromise(function(_0x3be907,_0x5da419){return client[_0x8776('0x9')](_0x1f158a,_0xac3149)['then'](function(_0x14a348){logger[_0x8776('0xa')](_0x8776('0xb'),_0x569785,'request\x20sent');logger[_0x8776('0xc')]('AnalyticCustomReport,\x20%s,\x20%s,\x20%s',_0x569785,_0x8776('0xd'),JSON[_0x8776('0xe')](_0x14a348));if(_0x14a348[_0x8776('0xf')]){if(_0x14a348[_0x8776('0xf')][_0x8776('0x10')]===0x1f4){logger[_0x8776('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x569785,_0x14a348[_0x8776('0xf')][_0x8776('0x11')]);return _0x5da419(_0x14a348[_0x8776('0xf')]['message']);}logger[_0x8776('0xf')](_0x8776('0xb'),_0x569785,_0x14a348[_0x8776('0xf')][_0x8776('0x11')]);return _0x3be907(_0x14a348['error']['message']);}else{logger['info']('AnalyticCustomReport,\x20%s,\x20%s',_0x569785,_0x8776('0xd'));_0x3be907(_0x14a348[_0x8776('0x12')][_0x8776('0x11')]);}})[_0x8776('0x13')](function(_0xe5ac83){logger[_0x8776('0xf')](_0x8776('0xb'),_0x569785,_0xe5ac83);_0x5da419(_0xe5ac83);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 8f44461..a9132da 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 _0xaee4=['../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','isAuthenticated','index','get','show','/:id/preview','preview','/:id/run','run','/:id/query','query','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xaee4,0x65));var _0x4aee=function(_0x70f3ff,_0x3599b0){_0x70f3ff=_0x70f3ff-0x0;var _0x87a145=_0xaee4[_0x70f3ff];return _0x87a145;};'use strict';var multer=require('multer');var util=require(_0x4aee('0x0'));var path=require(_0x4aee('0x1'));var timeout=require(_0x4aee('0x2'));var express=require(_0x4aee('0x3'));var router=express[_0x4aee('0x4')]();var fs_extra=require(_0x4aee('0x5'));var auth=require(_0x4aee('0x6'));var interaction=require(_0x4aee('0x7'));var config=require(_0x4aee('0x8'));var controller=require(_0x4aee('0x9'));router['get']('/',auth[_0x4aee('0xa')](),controller[_0x4aee('0xb')]);router[_0x4aee('0xc')]('/:id',auth[_0x4aee('0xa')](),controller[_0x4aee('0xd')]);router[_0x4aee('0xc')](_0x4aee('0xe'),auth['isAuthenticated'](),controller[_0x4aee('0xf')]);router['get'](_0x4aee('0x10'),auth[_0x4aee('0xa')](),controller[_0x4aee('0x11')]);router[_0x4aee('0xc')](_0x4aee('0x12'),auth[_0x4aee('0xa')](),controller[_0x4aee('0x13')]);router[_0x4aee('0x14')]('/',auth[_0x4aee('0xa')](),controller[_0x4aee('0x15')]);router[_0x4aee('0x16')](_0x4aee('0x17'),auth[_0x4aee('0xa')](),controller[_0x4aee('0x18')]);router[_0x4aee('0x19')]('/:id',auth[_0x4aee('0xa')](),controller['destroy']);module[_0x4aee('0x1a')]=router; \ No newline at end of file +var _0x347e=['put','delete','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','run','/:id/query','query','create'];(function(_0x58943d,_0x18b43e){var _0x238275=function(_0x3e0413){while(--_0x3e0413){_0x58943d['push'](_0x58943d['shift']());}};_0x238275(++_0x18b43e);}(_0x347e,0x18f));var _0xe347=function(_0x434c42,_0x4f687b){_0x434c42=_0x434c42-0x0;var _0x272e65=_0x347e[_0x434c42];return _0x272e65;};'use strict';var multer=require(_0xe347('0x0'));var util=require(_0xe347('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe347('0x2'));var router=express[_0xe347('0x3')]();var fs_extra=require(_0xe347('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe347('0x5'));var config=require(_0xe347('0x6'));var controller=require(_0xe347('0x7'));router[_0xe347('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe347('0x8')](_0xe347('0x9'),auth[_0xe347('0xa')](),controller[_0xe347('0xb')]);router['get'](_0xe347('0xc'),auth[_0xe347('0xa')](),controller[_0xe347('0xd')]);router[_0xe347('0x8')](_0xe347('0xe'),auth[_0xe347('0xa')](),controller[_0xe347('0xf')]);router[_0xe347('0x8')](_0xe347('0x10'),auth[_0xe347('0xa')](),controller[_0xe347('0x11')]);router['post']('/',auth[_0xe347('0xa')](),controller[_0xe347('0x12')]);router[_0xe347('0x13')](_0xe347('0x9'),auth[_0xe347('0xa')](),controller['update']);router[_0xe347('0x14')](_0xe347('0x9'),auth[_0xe347('0xa')](),controller['destroy']);module[_0xe347('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 50801ad..31826d4 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 _0x6f47=['TEXT','exports','STRING'];(function(_0x31259c,_0x31488d){var _0x220546=function(_0x347f7a){while(--_0x347f7a){_0x31259c['push'](_0x31259c['shift']());}};_0x220546(++_0x31488d);}(_0x6f47,0xc7));var _0x76f4=function(_0x576170,_0x1712ae){_0x576170=_0x576170-0x0;var _0x397c70=_0x6f47[_0x576170];return _0x397c70;};'use strict';var Sequelize=require('sequelize');module[_0x76f4('0x0')]={'name':{'type':Sequelize[_0x76f4('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x76f4('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x76f4('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x25a741,_0x5a072a){var _0x245fd3=function(_0x548856){while(--_0x548856){_0x25a741['push'](_0x25a741['shift']());}};_0x245fd3(++_0x5a072a);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index e1b82a0..eff830c 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 _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0xb331b1,_0x1e66e6){var _0x1ba713=function(_0x26ab5e){while(--_0x26ab5e){_0xb331b1['push'](_0xb331b1['shift']());}};_0x1ba713(++_0x1e66e6);}(_0x1967,0x173));var _0x7196=function(_0x3a7497,_0x2a27a4){_0x3a7497=_0x3a7497-0x0;var _0x5b8342=_0x1967[_0x3a7497];return _0x5b8342;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file +var _0x1967=['conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20NOT\x20NULL','table','web','%s-%s.%s','randomstring','output','default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','runReport','select','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','destroy','get','stack','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','DefaultReports','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','join','left_join','right_join','cross_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','foreignTable','%s.%s\x20=\x20%s.%s','parentKey','foreignKey'];(function(_0x39489a,_0x451b19){var _0x4490c4=function(_0x403970){while(--_0x403970){_0x39489a['push'](_0x39489a['shift']());}};_0x4490c4(++_0x451b19);}(_0x1967,0x173));var _0x7196=function(_0x4d0cf9,_0x24f340){_0x4d0cf9=_0x4d0cf9-0x0;var _0x3dfa90=_0x1967[_0x4d0cf9];return _0x3dfa90;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7196('0x0'));var zipdir=require(_0x7196('0x1'));var jsonpatch=require(_0x7196('0x2'));var rp=require(_0x7196('0x3'));var moment=require(_0x7196('0x4'));var BPromise=require(_0x7196('0x5'));var Mustache=require(_0x7196('0x6'));var util=require(_0x7196('0x7'));var path=require(_0x7196('0x8'));var sox=require(_0x7196('0x9'));var csv=require('to-csv');var ejs=require(_0x7196('0xa'));var fs=require('fs');var fs_extra=require(_0x7196('0xb'));var _=require(_0x7196('0xc'));var squel=require(_0x7196('0xd'));var crypto=require(_0x7196('0xe'));var jsforce=require(_0x7196('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7196('0x10'));var querystring=require(_0x7196('0x11'));var Papa=require(_0x7196('0x12'));var Redis=require(_0x7196('0x13'));var authService=require(_0x7196('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7196('0x15'));var logger=require(_0x7196('0x16'))(_0x7196('0x17'));var utils=require(_0x7196('0x18'));var config=require(_0x7196('0x19'));var licenseUtil=require(_0x7196('0x1a'));var db=require(_0x7196('0x1b'))['db'];var dbH=require(_0x7196('0x1b'))[_0x7196('0x1c')];function respondWithStatusCode(_0xba707b,_0x154101){_0x154101=_0x154101||0xcc;return function(_0x4e8c4c){if(_0x4e8c4c){return _0xba707b[_0x7196('0x1d')](_0x154101);}return _0xba707b[_0x7196('0x1e')](_0x154101)[_0x7196('0x1f')]();};}function respondWithResult(_0xf098c1,_0x511aa1){_0x511aa1=_0x511aa1||0xc8;return function(_0x31c778){if(_0x31c778){return _0xf098c1['status'](_0x511aa1)[_0x7196('0x20')](_0x31c778);}};}function respondWithFilteredResult(_0x2590a6,_0xf7e97){return function(_0x3ed1ad){if(_0x3ed1ad){var _0x12dce7=typeof _0xf7e97[_0x7196('0x21')]===_0x7196('0x22')&&typeof _0xf7e97[_0x7196('0x23')]===_0x7196('0x22');var _0x32fe2b=_0x3ed1ad[_0x7196('0x24')];var _0x5b716a=_0x12dce7?0x0:_0xf7e97['offset'];var _0x448f13=_0x12dce7?_0x3ed1ad[_0x7196('0x24')]:_0xf7e97[_0x7196('0x21')]+_0xf7e97['limit'];var _0x39b944;if(_0x448f13>=_0x32fe2b){_0x448f13=_0x32fe2b;_0x39b944=0xc8;}else{_0x39b944=0xce;}_0x2590a6['status'](_0x39b944);return _0x2590a6['set'](_0x7196('0x25'),_0x5b716a+'-'+_0x448f13+'/'+_0x32fe2b)[_0x7196('0x20')](_0x3ed1ad);}return null;};}function patchUpdates(_0x8dee9d){return function(_0x4ddf78){try{jsonpatch['apply'](_0x4ddf78,_0x8dee9d,!![]);}catch(_0x38d291){return BPromise[_0x7196('0x26')](_0x38d291);}return _0x4ddf78['save']();};}function saveUpdates(_0x18649b,_0x27ff84){return function(_0x6e22e5){if(_0x6e22e5){return _0x6e22e5[_0x7196('0x27')](_0x18649b)[_0x7196('0x28')](function(_0x549f34){return _0x549f34;});}return null;};}function removeEntity(_0x3f8178,_0x520d01){return function(_0x3ce9a0){if(_0x3ce9a0){return _0x3ce9a0[_0x7196('0x29')]()[_0x7196('0x28')](function(){var _0xa69810=_0x3ce9a0[_0x7196('0x2a')]({'plain':!![]});var _0x43f6a2='DefaultReports';return db['UserProfileResource'][_0x7196('0x29')]({'where':{'type':_0x43f6a2,'resourceId':_0xa69810['id']}})[_0x7196('0x28')](function(){return _0x3ce9a0;});})[_0x7196('0x28')](function(){_0x3f8178['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x41cfd2,_0x162cfc){return function(_0x675e64){if(!_0x675e64){_0x41cfd2['sendStatus'](0x194);}return _0x675e64;};}function handleError(_0x35eef9,_0x4ecea1){_0x4ecea1=_0x4ecea1||0x1f4;return function(_0x4fd339){logger['error'](_0x4fd339[_0x7196('0x2b')]);if(_0x4fd339[_0x7196('0x2c')]){delete _0x4fd339[_0x7196('0x2c')];}_0x35eef9['status'](_0x4ecea1)[_0x7196('0x2d')](_0x4fd339);};}exports[_0x7196('0x2e')]=function(_0x2f9583,_0xf999e9){var _0x50c386={},_0x39710d={},_0x429160={'count':0x0,'rows':[]};var _0xd07f22=_[_0x7196('0x2f')](db[_0x7196('0x30')][_0x7196('0x31')],function(_0x15c5f0){return{'name':_0x15c5f0[_0x7196('0x32')],'type':_0x15c5f0[_0x7196('0x33')][_0x7196('0x34')]};});_0x39710d[_0x7196('0x35')]=_['map'](_0xd07f22,_0x7196('0x2c'));_0x39710d['query']=_[_0x7196('0x36')](_0x2f9583['query']);_0x39710d[_0x7196('0x37')]=_[_0x7196('0x38')](_0x39710d['model'],_0x39710d[_0x7196('0x39')]);_0x50c386[_0x7196('0x3a')]=_[_0x7196('0x38')](_0x39710d[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x2f9583['query'][_0x7196('0x3b')]));_0x50c386[_0x7196('0x3a')]=_0x50c386[_0x7196('0x3a')][_0x7196('0x3c')]?_0x50c386[_0x7196('0x3a')]:_0x39710d[_0x7196('0x35')];if(!_0x2f9583['query'][_0x7196('0x3d')](_0x7196('0x3e'))){_0x50c386[_0x7196('0x23')]=qs['limit'](_0x2f9583[_0x7196('0x39')][_0x7196('0x23')]);_0x50c386[_0x7196('0x21')]=qs[_0x7196('0x21')](_0x2f9583[_0x7196('0x39')][_0x7196('0x21')]);}_0x50c386[_0x7196('0x3f')]=qs[_0x7196('0x40')](_0x2f9583[_0x7196('0x39')][_0x7196('0x40')]);_0x50c386['where']=qs[_0x7196('0x37')](_[_0x7196('0x41')](_0x2f9583['query'],_0x39710d[_0x7196('0x37')]),_0xd07f22);if(_0x2f9583['query']['filter']){_0x50c386[_0x7196('0x42')]=_[_0x7196('0x43')](_0x50c386['where'],{'$or':_['map'](_0xd07f22,function(_0x1bad95){if(_0x1bad95[_0x7196('0x33')]!==_0x7196('0x44')){var _0x4c2341={};_0x4c2341[_0x1bad95[_0x7196('0x2c')]]={'$like':'%'+_0x2f9583[_0x7196('0x39')][_0x7196('0x45')]+'%'};return _0x4c2341;}})});}_0x50c386=_[_0x7196('0x43')]({},_0x50c386,_0x2f9583[_0x7196('0x46')]);var _0x428d76={'where':_0x50c386[_0x7196('0x42')]};return db[_0x7196('0x30')]['count'](_0x428d76)[_0x7196('0x28')](function(_0xa852e1){_0x429160['count']=_0xa852e1;if(_0x2f9583[_0x7196('0x39')][_0x7196('0x47')]){_0x50c386['include']=[{'all':!![]}];}return db[_0x7196('0x30')][_0x7196('0x48')](_0x50c386);})[_0x7196('0x28')](function(_0x5749e2){_0x429160[_0x7196('0x49')]=_0x5749e2;return _0x429160;})[_0x7196('0x28')](respondWithFilteredResult(_0xf999e9,_0x50c386))['catch'](handleError(_0xf999e9,null));};exports[_0x7196('0x4a')]=function(_0x1a7052,_0x4f0c6c){var _0x335e6f={'raw':!![],'where':{'id':_0x1a7052['params']['id']}},_0x53a5e6={};_0x53a5e6['model']=_['keys'](db['AnalyticDefaultReport'][_0x7196('0x31')]);_0x53a5e6['query']=_[_0x7196('0x36')](_0x1a7052[_0x7196('0x39')]);_0x53a5e6[_0x7196('0x37')]=_[_0x7196('0x38')](_0x53a5e6['model'],_0x53a5e6[_0x7196('0x39')]);_0x335e6f['attributes']=_[_0x7196('0x38')](_0x53a5e6[_0x7196('0x35')],qs[_0x7196('0x3b')](_0x1a7052['query'][_0x7196('0x3b')]));_0x335e6f[_0x7196('0x3a')]=_0x335e6f[_0x7196('0x3a')]['length']?_0x335e6f['attributes']:_0x53a5e6[_0x7196('0x35')];if(_0x1a7052['query'][_0x7196('0x47')]){_0x335e6f['include']=[{'all':!![]}];}_0x335e6f=_['merge']({},_0x335e6f,_0x1a7052[_0x7196('0x46')]);return db['AnalyticDefaultReport']['find'](_0x335e6f)['then'](handleEntityNotFound(_0x4f0c6c,null))[_0x7196('0x28')](respondWithResult(_0x4f0c6c,null))['catch'](handleError(_0x4f0c6c,null));};exports['create']=function(_0x28591e,_0x182c8b){return db[_0x7196('0x30')][_0x7196('0x4b')](_0x28591e['body'],{})[_0x7196('0x28')](function(_0x564688){var _0x36844f=_0x28591e[_0x7196('0x4c')]['get']({'plain':!![]});if(!_0x36844f)throw new Error(_0x7196('0x4d'));if(_0x36844f[_0x7196('0x4e')]===_0x7196('0x4c')){var _0x4fa18f=_0x564688[_0x7196('0x2a')]({'plain':!![]});var _0x5d51aa=_0x7196('0x4f');return db[_0x7196('0x50')][_0x7196('0x51')]({'where':{'name':_0x5d51aa,'userProfileId':_0x36844f[_0x7196('0x52')]},'raw':!![]})[_0x7196('0x28')](function(_0x19733a){if(_0x19733a&&_0x19733a[_0x7196('0x53')]===0x0){return db[_0x7196('0x54')]['create']({'name':_0x4fa18f['name'],'resourceId':_0x4fa18f['id'],'type':_0x7196('0x55'),'sectionId':_0x19733a['id']},{})[_0x7196('0x28')](function(){return _0x564688;});}else{return _0x564688;}})[_0x7196('0x56')](function(_0xe4b032){logger['error'](_0x7196('0x57'),_0xe4b032);throw _0xe4b032;});}return _0x564688;})[_0x7196('0x28')](respondWithResult(_0x182c8b,0xc9))[_0x7196('0x56')](handleError(_0x182c8b,null));};exports[_0x7196('0x27')]=function(_0x9fcfd4,_0x3177c2){if(_0x9fcfd4[_0x7196('0x58')]['id']){delete _0x9fcfd4[_0x7196('0x58')]['id'];}return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x9fcfd4[_0x7196('0x59')]['id']}})['then'](handleEntityNotFound(_0x3177c2,null))[_0x7196('0x28')](saveUpdates(_0x9fcfd4[_0x7196('0x58')],null))[_0x7196('0x28')](respondWithResult(_0x3177c2,null))['catch'](handleError(_0x3177c2,null));};exports[_0x7196('0x29')]=function(_0x5ca1ca,_0x34407d){return db[_0x7196('0x30')][_0x7196('0x51')]({'where':{'id':_0x5ca1ca[_0x7196('0x59')]['id']}})[_0x7196('0x28')](handleEntityNotFound(_0x34407d,null))['then'](removeEntity(_0x34407d,null))[_0x7196('0x56')](handleError(_0x34407d,null));};exports['preview']=function(_0x4be36d,_0x5b9824){var _0x1bc358=0xa;var _0x3be180=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x2d8b3d={'SUM':'SUM(%s)','COUNT':_0x7196('0x5e'),'COUNT DISTINCT':_0x7196('0x5f'),'MAX':_0x7196('0x60'),'MIN':_0x7196('0x61'),'AVG':_0x7196('0x62'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x7196('0x63')};var _0x1c7eb2={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x43ee13=function(_0x13e9d0){return!_[_0x7196('0x69')]([_0x7196('0x6a'),'IS\x20NOT\x20NULL',_0x7196('0x6b'),_0x7196('0x6c')],_0x13e9d0);};var _0x27d5d7=function(_0x33f43b){if(!_0x33f43b||!_0x33f43b['rules'][_0x7196('0x3c')]){return'';}for(var _0x204c3a='(',_0x1f3acc=0x0;_0x1f3acc<_0x33f43b[_0x7196('0x6d')][_0x7196('0x3c')];_0x1f3acc+=0x1){_0x1f3acc>0x0&&(_0x204c3a+='\x20'+_0x33f43b[_0x7196('0x6e')]+'\x20');_0x204c3a+=_0x33f43b[_0x7196('0x6d')][_0x1f3acc]['group']?_0x27d5d7(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x6f')]):_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x70')]+'\x20'+_0x33f43b['rules'][_0x1f3acc][_0x7196('0x71')]+(_0x43ee13(_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x71')])?'\x20'+_0x33f43b[_0x7196('0x6d')][_0x1f3acc][_0x7196('0x72')]:'');}return _0x204c3a+')';};var _0x37c6be={'where':{'id':_0x4be36d['params']['id']}},_0x57065,_0x517dfb,_0x56b2eb,_0x56955e,_0x72f6f1;_0x37c6be=_[_0x7196('0x43')]({},_0x37c6be,_0x4be36d[_0x7196('0x46')]);return db[_0x7196('0x30')][_0x7196('0x51')](_0x37c6be)[_0x7196('0x28')](function(_0x30d44f){if(_0x30d44f){_0x57065=_0x30d44f;return _0x30d44f[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x3881a5){if(_0x3881a5){if(!_0x3881a5['length']){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x517dfb=_0x3881a5;return db[_0x7196('0x76')][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x45e21f){if(_0x45e21f){_0x56b2eb=_[_0x7196('0x77')](_0x45e21f,'id');var _0x2f36f8;var _0x4cc5e3=squel['select']();_0x4cc5e3[_0x7196('0x78')](_0x57065['table']);for(var _0x30d114=0x0;_0x30d114<_0x517dfb['length'];_0x30d114+=0x1){_0x2f36f8=_0x517dfb[_0x30d114][_0x7196('0x79')]?_0x56b2eb[_0x517dfb[_0x30d114][_0x7196('0x79')]][_0x7196('0x7a')]:_0x517dfb[_0x30d114][_0x7196('0x70')];_0x2f36f8=_0x517dfb[_0x30d114]['function']?_['replace'](_0x2d8b3d[_0x517dfb[_0x30d114][_0x7196('0x7b')]],'%s',_0x2f36f8):_0x2f36f8;_0x2f36f8=_0x517dfb[_0x30d114]['format']?_[_0x7196('0x7c')](_0x1c7eb2[_0x517dfb[_0x30d114][_0x7196('0x7d')]],'%s',_0x2f36f8):_0x2f36f8;if(_0x517dfb[_0x30d114][_0x7196('0x7e')]){_0x4cc5e3[_0x7196('0x6f')](_0x2f36f8);}_0x517dfb[_0x30d114][_0x7196('0x7f')]&&_0x4cc5e3[_0x7196('0x3f')](_0x2f36f8,_0x517dfb[_0x30d114]['orderBy']===_0x7196('0x80')?![]:!![]);_0x4cc5e3[_0x7196('0x70')](_0x2f36f8,_0x517dfb[_0x30d114][_0x7196('0x81')]||_0x2f36f8);}if(_0x57065[_0x7196('0x82')]){_0x57065[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x82')]);for(var _0x473c0e=0x0;_0x473c0e<_0x57065[_0x7196('0x82')][_0x7196('0x3c')];_0x473c0e+=0x1){if(_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')]&&_['includes'](_0x3be180,_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x33')])&&_0x57065['joins'][_0x473c0e]['parentKey']&&_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')]&&_0x57065[_0x7196('0x82')][_0x473c0e]['foreignKey']){_0x4cc5e3[_0x57065[_0x7196('0x82')][_0x473c0e]['type']](_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],null,util['format'](_0x7196('0x85'),_0x57065['table'],_0x57065['joins'][_0x473c0e][_0x7196('0x86')],_0x57065[_0x7196('0x82')][_0x473c0e][_0x7196('0x84')],_0x57065['joins'][_0x473c0e][_0x7196('0x87')]));}}}if(_0x57065['conditions']){_0x57065[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x57065[_0x7196('0x88')]);_0x4cc5e3[_0x7196('0x42')](_0x27d5d7(_0x57065[_0x7196('0x88')]['group']));}_0x72f6f1=_0x4cc5e3[_0x7196('0x89')]();_0x4cc5e3[_0x7196('0x23')](_0x1bc358);_0x4cc5e3[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x4cc5e3[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x4cc5e3['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});}})[_0x7196('0x28')](respondWithResult(_0x5b9824,null))['catch'](handleError(_0x5b9824,null));};function runReport(_0x1364f5,_0x2cb53c,_0x4fe2cb){var _0x2e4807=_0x2cb53c['name'];var _0xd6d8cf=0xa;var _0x5318c1=[_0x7196('0x5a'),_0x7196('0x5b'),'right_join',_0x7196('0x5d')];var _0x2b52c0={'SUM':_0x7196('0x90'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7196('0x60'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0x509c4a={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':_0x7196('0x66'),'ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':_0x7196('0x68')};var _0x26048c=function(_0x1a4d17){return!_[_0x7196('0x69')]([_0x7196('0x6a'),_0x7196('0x93'),_0x7196('0x6b'),'IS\x20NOT\x20EMPTY'],_0x1a4d17);};var _0x5acff1=function(_0x32ab6c){if(!_0x32ab6c||!_0x32ab6c['rules']['length']){return'';}for(var _0x2bfdc4='(',_0x1604fa=0x0;_0x1604fa<_0x32ab6c[_0x7196('0x6d')][_0x7196('0x3c')];_0x1604fa+=0x1){_0x1604fa>0x0&&(_0x2bfdc4+='\x20'+_0x32ab6c['operator']+'\x20');_0x2bfdc4+=_0x32ab6c['rules'][_0x1604fa][_0x7196('0x6f')]?_0x5acff1(_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x6f')]):_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['field']+'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa]['condition']+(_0x26048c(_0x32ab6c['rules'][_0x1604fa][_0x7196('0x71')])?'\x20'+_0x32ab6c[_0x7196('0x6d')][_0x1604fa][_0x7196('0x72')]:'');}return _0x2bfdc4+')';};var _0x494418={'where':{'id':_0x1364f5['id']}},_0x400aa5,_0x40d4c3,_0x1824e2,_0x30c54b,_0x10712f;_0x494418=_[_0x7196('0x43')]({},_0x494418,_0x4fe2cb);return db[_0x7196('0x30')][_0x7196('0x51')](_0x494418)['then'](function(_0x9bd2ea){if(_0x9bd2ea){_0x400aa5=_0x9bd2ea;return _0x9bd2ea[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x408760){if(_0x408760){if(!_0x408760[_0x7196('0x3c')]){throw new db['Sequelize'][(_0x7196('0x74'))](_0x7196('0x75'),0x193);}_0x40d4c3=_0x408760;return db[_0x7196('0x76')]['findAll']({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x4b98de){if(_0x4b98de){_0x1824e2=_['keyBy'](_0x4b98de,'id');var _0x1dcf93;var _0x25d323=squel['select']();_0x25d323[_0x7196('0x78')](_0x400aa5[_0x7196('0x94')]);for(var _0x48ceda=0x0;_0x48ceda<_0x40d4c3[_0x7196('0x3c')];_0x48ceda+=0x1){_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x79')]?_0x1824e2[_0x40d4c3[_0x48ceda][_0x7196('0x79')]][_0x7196('0x7a')]:_0x40d4c3[_0x48ceda][_0x7196('0x70')];_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7b')]?_['replace'](_0x2b52c0[_0x40d4c3[_0x48ceda][_0x7196('0x7b')]],'%s',_0x1dcf93):_0x1dcf93;_0x1dcf93=_0x40d4c3[_0x48ceda][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0x509c4a[_0x40d4c3[_0x48ceda]['format']],'%s',_0x1dcf93):_0x1dcf93;if(_0x40d4c3[_0x48ceda]['groupBy']){_0x25d323['group'](_0x1dcf93);}_0x40d4c3[_0x48ceda][_0x7196('0x7f')]&&_0x25d323[_0x7196('0x3f')](_0x1dcf93,_0x40d4c3[_0x48ceda][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x25d323[_0x7196('0x70')](_0x1dcf93,_0x40d4c3[_0x48ceda]['alias']||_0x1dcf93);}if(_0x400aa5[_0x7196('0x82')]){_0x400aa5['joins']=JSON[_0x7196('0x83')](_0x400aa5[_0x7196('0x82')]);for(var _0x33d5bf=0x0;_0x33d5bf<_0x400aa5[_0x7196('0x82')][_0x7196('0x3c')];_0x33d5bf+=0x1){if(_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x33')]&&_['includes'](_0x5318c1,_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type'])&&_0x400aa5['joins'][_0x33d5bf]['parentKey']&&_0x400aa5['joins'][_0x33d5bf]['foreignTable']&&_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]){_0x25d323[_0x400aa5[_0x7196('0x82')][_0x33d5bf]['type']](_0x400aa5[_0x7196('0x82')][_0x33d5bf]['foreignTable'],null,util['format']('%s.%s\x20=\x20%s.%s',_0x400aa5[_0x7196('0x94')],_0x400aa5['joins'][_0x33d5bf][_0x7196('0x86')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x84')],_0x400aa5[_0x7196('0x82')][_0x33d5bf][_0x7196('0x87')]));}}}if(_0x400aa5[_0x7196('0x88')]){_0x400aa5[_0x7196('0x88')]=JSON[_0x7196('0x83')](_0x400aa5['conditions']);_0x25d323[_0x7196('0x42')](_0x5acff1(_0x400aa5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x10712f=_0x25d323['clone']();_0x25d323[_0x7196('0x23')](_0xd6d8cf);_0x25d323[_0x7196('0x21')](0x0);return;}})[_0x7196('0x28')](function(){if(_0x2cb53c['output']===_0x7196('0x95')){return null;}var _0x46a563=_[_0x7196('0x43')](_0x2cb53c,{'name':_0x2cb53c['fullPath']||_0x2cb53c[_0x7196('0x2c')]||_0x400aa5[_0x7196('0x2c')],'basename':_0x2e4807,'savename':util['format'](_0x7196('0x96'),_0x2cb53c['name']||_0x400aa5[_0x7196('0x2c')],require(_0x7196('0x97'))['generate'](0x4),_0x2cb53c[_0x7196('0x98')]||'csv'),'reportId':_0x400aa5['id'],'reportType':_0x7196('0x99')});return db[_0x7196('0x9a')][_0x7196('0x4b')](_0x46a563,{'raw':!![]});})['then'](function(_0xd9619d){if(_0x400aa5[_0x7196('0x94')]===_0x7196('0x9b')){_0x10712f[_0x7196('0x42')](_0x400aa5['table']+_0x7196('0x9c'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}else{_0x10712f['where'](_0x400aa5['table']+_0x7196('0x9f'),_0x2cb53c[_0x7196('0x9d')],_0x2cb53c[_0x7196('0x9e')]);}if(_0xd9619d){logger[_0x7196('0xa0')]('Run\x20Query:',_0x10712f[_0x7196('0x8c')]());require('child_process')[_0x7196('0xa1')](path['join'](__dirname,_0x7196('0xa2'),_0xd9619d[_0x7196('0x98')]),[_0xd9619d['id'],_0x10712f[_0x7196('0x8c')](),path[_0x7196('0x5a')](__dirname,_0x7196('0xa3'),_0xd9619d[_0x7196('0xa4')]),_0x2e4807]);return _0xd9619d;}else{var _0x342fb1=squel['select']();_0x342fb1[_0x7196('0x78')]('('+_0x10712f[_0x7196('0x8c')]()+')',_0x7196('0xa5'));_0x342fb1[_0x7196('0x70')](_0x7196('0xa6'),_0x7196('0x24'));_0x10712f[_0x7196('0x23')](_0x2cb53c[_0x7196('0x23')]||_0xd6d8cf);_0x10712f['offset'](_0x2cb53c[_0x7196('0x21')]||0x0);return dbH[_0x7196('0x8d')]['query'](_0x342fb1[_0x7196('0x8c')](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]})[_0x7196('0x28')](function(_0xdf1ede){if(!_0xdf1ede[_0x7196('0x3c')]){_0x30c54b=0x0;}else{_0x30c54b=_0xdf1ede[0x0]['count']||0x0;}return dbH['sequelize'][_0x7196('0x39')](_0x10712f['toString'](),{'type':dbH[_0x7196('0x8d')][_0x7196('0x8e')][_0x7196('0x8f')]});})[_0x7196('0x28')](function(_0x2df80a){return{'rows':_0x2df80a||[],'count':_0x30c54b};});}});}exports['run']=function(_0x392e74,_0x17ba6d){return runReport(_0x392e74[_0x7196('0x59')],_0x392e74[_0x7196('0x39')],_0x392e74[_0x7196('0x46')])[_0x7196('0x28')](respondWithResult(_0x17ba6d,null))[_0x7196('0x56')](handleError(_0x17ba6d,null));};exports[_0x7196('0xa7')]=runReport;exports[_0x7196('0x39')]=function(_0x5a3c87,_0x58fb86){var _0x51da79=0xa;var _0x144613=[_0x7196('0x5a'),_0x7196('0x5b'),_0x7196('0x5c'),_0x7196('0x5d')];var _0x9055af={'SUM':_0x7196('0x90'),'COUNT':_0x7196('0x5e'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x7196('0x91'),'GROUP_CONCAT ASC':_0x7196('0x92'),'GROUP_CONCAT DESC':_0x7196('0x63')};var _0xab9595={'SEC_TO_TIME':_0x7196('0x64'),'DATE':_0x7196('0x65'),'HOUR':'HOUR(%s)','ROUND':_0x7196('0x67'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5236a0=function(_0x520fe8){return!_['includes'](['IS\x20NULL',_0x7196('0x93'),'IS\x20EMPTY',_0x7196('0x6c')],_0x520fe8);};var _0x425a57=function(_0x302728){if(!_0x302728||!_0x302728[_0x7196('0x6d')][_0x7196('0x3c')]){return'';}for(var _0x14492e='(',_0x58df43=0x0;_0x58df43<_0x302728[_0x7196('0x6d')][_0x7196('0x3c')];_0x58df43+=0x1){_0x58df43>0x0&&(_0x14492e+='\x20'+_0x302728[_0x7196('0x6e')]+'\x20');_0x14492e+=_0x302728['rules'][_0x58df43][_0x7196('0x6f')]?_0x425a57(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x6f')]):_0x302728['rules'][_0x58df43]['field']+'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')]+(_0x5236a0(_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x71')])?'\x20'+_0x302728[_0x7196('0x6d')][_0x58df43][_0x7196('0x72')]:'');}return _0x14492e+')';};var _0x1a8a5a={'where':{'id':_0x5a3c87[_0x7196('0x59')]['id']}},_0x2944e5,_0x3f9385,_0xbd94ef,_0x5d2a56,_0x2fb552;_0x1a8a5a=_['merge']({},_0x1a8a5a,_0x5a3c87[_0x7196('0x46')]);return db[_0x7196('0x30')]['find'](_0x1a8a5a)[_0x7196('0x28')](function(_0x386259){if(_0x386259){_0x2944e5=_0x386259;return _0x386259[_0x7196('0x73')]();}return null;})[_0x7196('0x28')](function(_0x1e7a64){if(_0x1e7a64){if(!_0x1e7a64[_0x7196('0x3c')]){throw new db['Sequelize']['ValidationErrorItem'](_0x7196('0x75'),0x193);}_0x3f9385=_0x1e7a64;return db['AnalyticMetric'][_0x7196('0x48')]({'raw':!![]});}return null;})[_0x7196('0x28')](function(_0x30db09){if(_0x30db09){_0xbd94ef=_['keyBy'](_0x30db09,'id');var _0x4729e1;var _0x66e1e6=squel[_0x7196('0xa8')]();_0x66e1e6[_0x7196('0x78')](_0x2944e5[_0x7196('0x94')]);for(var _0x1e2105=0x0;_0x1e2105<_0x3f9385[_0x7196('0x3c')];_0x1e2105+=0x1){_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x79')]?_0xbd94ef[_0x3f9385[_0x1e2105][_0x7196('0x79')]]['metric']:_0x3f9385[_0x1e2105][_0x7196('0x70')];_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7b')]?_[_0x7196('0x7c')](_0x9055af[_0x3f9385[_0x1e2105][_0x7196('0x7b')]],'%s',_0x4729e1):_0x4729e1;_0x4729e1=_0x3f9385[_0x1e2105][_0x7196('0x7d')]?_[_0x7196('0x7c')](_0xab9595[_0x3f9385[_0x1e2105]['format']],'%s',_0x4729e1):_0x4729e1;if(_0x3f9385[_0x1e2105][_0x7196('0x7e')]){_0x66e1e6['group'](_0x4729e1);}_0x3f9385[_0x1e2105][_0x7196('0x7f')]&&_0x66e1e6[_0x7196('0x3f')](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x7f')]==='DESC'?![]:!![]);_0x66e1e6['field'](_0x4729e1,_0x3f9385[_0x1e2105][_0x7196('0x81')]||_0x4729e1);}if(_0x2944e5[_0x7196('0x82')]){_0x2944e5[_0x7196('0x82')]=JSON[_0x7196('0x83')](_0x2944e5[_0x7196('0x82')]);for(var _0x220315=0x0;_0x220315<_0x2944e5[_0x7196('0x82')][_0x7196('0x3c')];_0x220315+=0x1){if(_0x2944e5['joins'][_0x220315][_0x7196('0x33')]&&_[_0x7196('0x69')](_0x144613,_0x2944e5['joins'][_0x220315][_0x7196('0x33')])&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')]&&_0x2944e5['joins'][_0x220315][_0x7196('0x84')]&&_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]){_0x66e1e6[_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x33')]](_0x2944e5['joins'][_0x220315]['foreignTable'],null,util[_0x7196('0x7d')](_0x7196('0x85'),_0x2944e5[_0x7196('0x94')],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x86')],_0x2944e5[_0x7196('0x82')][_0x220315]['foreignTable'],_0x2944e5[_0x7196('0x82')][_0x220315][_0x7196('0x87')]));}}}if(_0x2944e5[_0x7196('0x88')]){_0x2944e5[_0x7196('0x88')]=JSON['parse'](_0x2944e5[_0x7196('0x88')]);_0x66e1e6[_0x7196('0x42')](_0x425a57(_0x2944e5[_0x7196('0x88')][_0x7196('0x6f')]));}_0x2fb552=_0x66e1e6[_0x7196('0x89')]();_0x66e1e6[_0x7196('0x23')](_0x51da79);_0x66e1e6[_0x7196('0x21')](0x0);logger[_0x7196('0x8a')](_0x7196('0x8b'),_0x66e1e6[_0x7196('0x8c')]());return dbH[_0x7196('0x8d')][_0x7196('0x39')](_0x66e1e6['toString'](),{'type':dbH[_0x7196('0x8d')]['QueryTypes'][_0x7196('0x8f')]});}})['then'](function(){return{'sql':_0x2fb552[_0x7196('0x8c')]()};})['then'](respondWithResult(_0x58fb86,null))[_0x7196('0x56')](handleError(_0x58fb86,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index da78ea2..f45fd1f 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 _0x1749=['exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36edd2,_0x44c0b5){var _0x55bdb7=function(_0x12a3a7){while(--_0x12a3a7){_0x36edd2['push'](_0x36edd2['shift']());}};_0x55bdb7(++_0x44c0b5);}(_0x1749,0xba));var _0x9174=function(_0x4f5b11,_0x44a329){_0x4f5b11=_0x4f5b11-0x0;var _0x1d81a8=_0x1749[_0x4f5b11];return _0x1d81a8;};'use strict';var _=require(_0x9174('0x0'));var util=require(_0x9174('0x1'));var logger=require(_0x9174('0x2'))('api');var moment=require(_0x9174('0x3'));var BPromise=require(_0x9174('0x4'));var rp=require(_0x9174('0x5'));var fs=require('fs');var path=require(_0x9174('0x6'));var rimraf=require(_0x9174('0x7'));var config=require(_0x9174('0x8'));var attributes=require('./analyticDefaultReport.attributes');module[_0x9174('0x9')]=function(_0x85b92d,_0x185cd6){return _0x85b92d[_0x9174('0xa')](_0x9174('0xb'),attributes,{'tableName':_0x9174('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadfa=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x26b9ec,_0x5363de){var _0x2321aa=function(_0x5e8458){while(--_0x5e8458){_0x26b9ec['push'](_0x26b9ec['shift']());}};_0x2321aa(++_0x5363de);}(_0xadfa,0x99));var _0xaadf=function(_0x247175,_0x7f804d){_0x247175=_0x247175-0x0;var _0x14ccf6=_0xadfa[_0x247175];return _0x14ccf6;};'use strict';var _=require(_0xaadf('0x0'));var util=require(_0xaadf('0x1'));var logger=require(_0xaadf('0x2'))('api');var moment=require(_0xaadf('0x3'));var BPromise=require(_0xaadf('0x4'));var rp=require(_0xaadf('0x5'));var fs=require('fs');var path=require(_0xaadf('0x6'));var rimraf=require(_0xaadf('0x7'));var config=require(_0xaadf('0x8'));var attributes=require(_0xaadf('0x9'));module[_0xaadf('0xa')]=function(_0x2db6a2,_0x1abebb){return _0x2db6a2[_0xaadf('0xb')](_0xaadf('0xc'),attributes,{'tableName':_0xaadf('0xd'),'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 9eb36d2..8a17d3f 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 _0x5c1d=['code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','info','AnalyticDefaultReport,\x20%s,\x20%s','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xd988e6,_0x4f84fa){var _0x5b2947=function(_0x405a30){while(--_0x405a30){_0xd988e6['push'](_0xd988e6['shift']());}};_0x5b2947(++_0x4f84fa);}(_0x5c1d,0x1bb));var _0xd5c1=function(_0x7bb360,_0x1984aa){_0x7bb360=_0x7bb360-0x0;var _0x19f0a0=_0x5c1d[_0x7bb360];return _0x19f0a0;};'use strict';var _=require(_0xd5c1('0x0'));var util=require(_0xd5c1('0x1'));var moment=require(_0xd5c1('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd5c1('0x3'));var db=require(_0xd5c1('0x4'))['db'];var utils=require(_0xd5c1('0x5'));var logger=require('../../config/logger')(_0xd5c1('0x6'));var config=require('../../config/environment');var jayson=require(_0xd5c1('0x7'));var client=jayson[_0xd5c1('0x8')][_0xd5c1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42798b,_0x819d2f,_0x258681){return new BPromise(function(_0x3983aa,_0x15ee50){return client[_0xd5c1('0xa')](_0x42798b,_0x258681)['then'](function(_0x4dfc26){logger[_0xd5c1('0xb')](_0xd5c1('0xc'),_0x819d2f,'request\x20sent');logger['debug'](_0xd5c1('0xd'),_0x819d2f,_0xd5c1('0xe'),JSON[_0xd5c1('0xf')](_0x4dfc26));if(_0x4dfc26[_0xd5c1('0x10')]){if(_0x4dfc26[_0xd5c1('0x10')][_0xd5c1('0x11')]===0x1f4){logger[_0xd5c1('0x10')](_0xd5c1('0xc'),_0x819d2f,_0x4dfc26[_0xd5c1('0x10')][_0xd5c1('0x12')]);return _0x15ee50(_0x4dfc26['error'][_0xd5c1('0x12')]);}logger['error'](_0xd5c1('0xc'),_0x819d2f,_0x4dfc26['error'][_0xd5c1('0x12')]);return _0x3983aa(_0x4dfc26['error'][_0xd5c1('0x12')]);}else{logger[_0xd5c1('0xb')](_0xd5c1('0xc'),_0x819d2f,_0xd5c1('0xe'));_0x3983aa(_0x4dfc26['result']['message']);}})[_0xd5c1('0x13')](function(_0x2f4a10){logger[_0xd5c1('0x10')](_0xd5c1('0xc'),_0x819d2f,_0x2f4a10);_0x15ee50(_0x2f4a10);});});} \ No newline at end of file +var _0x93fa=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis'];(function(_0x1a6d6b,_0x1c5439){var _0x170bcd=function(_0x5df420){while(--_0x5df420){_0x1a6d6b['push'](_0x1a6d6b['shift']());}};_0x170bcd(++_0x1c5439);}(_0x93fa,0x141));var _0xa93f=function(_0x56aab0,_0x4afd25){_0x56aab0=_0x56aab0-0x0;var _0xa15bf4=_0x93fa[_0x56aab0];return _0xa15bf4;};'use strict';var _=require(_0xa93f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa93f('0x1'));var rs=require(_0xa93f('0x2'));var fs=require('fs');var Redis=require(_0xa93f('0x3'));var db=require(_0xa93f('0x4'))['db'];var utils=require(_0xa93f('0x5'));var logger=require(_0xa93f('0x6'))(_0xa93f('0x7'));var config=require(_0xa93f('0x8'));var jayson=require(_0xa93f('0x9'));var client=jayson[_0xa93f('0xa')][_0xa93f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb0a3e5,_0x2ff3f7,_0x1ff97e){return new BPromise(function(_0x12e311,_0x27b322){return client[_0xa93f('0xc')](_0xb0a3e5,_0x1ff97e)[_0xa93f('0xd')](function(_0x24ff06){logger[_0xa93f('0xe')](_0xa93f('0xf'),_0x2ff3f7,_0xa93f('0x10'));logger[_0xa93f('0x11')](_0xa93f('0x12'),_0x2ff3f7,_0xa93f('0x10'),JSON[_0xa93f('0x13')](_0x24ff06));if(_0x24ff06[_0xa93f('0x14')]){if(_0x24ff06[_0xa93f('0x14')][_0xa93f('0x15')]===0x1f4){logger[_0xa93f('0x14')](_0xa93f('0xf'),_0x2ff3f7,_0x24ff06[_0xa93f('0x14')][_0xa93f('0x16')]);return _0x27b322(_0x24ff06['error'][_0xa93f('0x16')]);}logger['error'](_0xa93f('0xf'),_0x2ff3f7,_0x24ff06[_0xa93f('0x14')][_0xa93f('0x16')]);return _0x12e311(_0x24ff06[_0xa93f('0x14')][_0xa93f('0x16')]);}else{logger[_0xa93f('0xe')](_0xa93f('0xf'),_0x2ff3f7,_0xa93f('0x10'));_0x12e311(_0x24ff06[_0xa93f('0x17')][_0xa93f('0x16')]);}})[_0xa93f('0x18')](function(_0x5d341a){logger[_0xa93f('0x14')](_0xa93f('0xf'),_0x2ff3f7,_0x5d341a);_0x27b322(_0x5d341a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index d279a74..34bde10 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 _0x08d4=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer'];(function(_0x2f8ef3,_0xc96ff2){var _0x223a26=function(_0x22aa0a){while(--_0x22aa0a){_0x2f8ef3['push'](_0x2f8ef3['shift']());}};_0x223a26(++_0xc96ff2);}(_0x08d4,0x1af));var _0x408d=function(_0x402b42,_0x205681){_0x402b42=_0x402b42-0x0;var _0x1b4560=_0x08d4[_0x402b42];return _0x1b4560;};'use strict';var multer=require(_0x408d('0x0'));var util=require(_0x408d('0x1'));var path=require(_0x408d('0x2'));var timeout=require(_0x408d('0x3'));var express=require(_0x408d('0x4'));var router=express[_0x408d('0x5')]();var fs_extra=require(_0x408d('0x6'));var auth=require(_0x408d('0x7'));var interaction=require(_0x408d('0x8'));var config=require(_0x408d('0x9'));var controller=require('./analyticDefaultReport.controller');router[_0x408d('0xa')]('/',auth[_0x408d('0xb')](),controller[_0x408d('0xc')]);router[_0x408d('0xa')](_0x408d('0xd'),auth[_0x408d('0xb')](),controller[_0x408d('0xe')]);router[_0x408d('0xa')](_0x408d('0xf'),auth[_0x408d('0xb')](),controller[_0x408d('0x10')]);router['get']('/:id/run',auth[_0x408d('0xb')](),controller[_0x408d('0x11')]);router['get'](_0x408d('0x12'),auth['isAuthenticated'](),controller[_0x408d('0x13')]);router[_0x408d('0x14')]('/',auth[_0x408d('0xb')](),controller[_0x408d('0x15')]);router[_0x408d('0x16')]('/:id',auth[_0x408d('0xb')](),controller[_0x408d('0x17')]);router[_0x408d('0x18')](_0x408d('0xd'),auth[_0x408d('0xb')](),controller[_0x408d('0x19')]);module[_0x408d('0x1a')]=router; \ No newline at end of file +var _0x4149=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticDefaultReport.controller','isAuthenticated','index','get','/:id','show','/:id/preview','preview','run','/:id/query','query','post','create','update','delete','destroy','exports','util','path'];(function(_0x2d6a5b,_0x39bb49){var _0x127cda=function(_0x5deff9){while(--_0x5deff9){_0x2d6a5b['push'](_0x2d6a5b['shift']());}};_0x127cda(++_0x39bb49);}(_0x4149,0xa6));var _0x9414=function(_0x32c7aa,_0x238e2f){_0x32c7aa=_0x32c7aa-0x0;var _0x201abc=_0x4149[_0x32c7aa];return _0x201abc;};'use strict';var multer=require('multer');var util=require(_0x9414('0x0'));var path=require(_0x9414('0x1'));var timeout=require(_0x9414('0x2'));var express=require(_0x9414('0x3'));var router=express[_0x9414('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9414('0x5'));var interaction=require(_0x9414('0x6'));var config=require('../../config/environment');var controller=require(_0x9414('0x7'));router['get']('/',auth[_0x9414('0x8')](),controller[_0x9414('0x9')]);router[_0x9414('0xa')](_0x9414('0xb'),auth[_0x9414('0x8')](),controller[_0x9414('0xc')]);router[_0x9414('0xa')](_0x9414('0xd'),auth[_0x9414('0x8')](),controller[_0x9414('0xe')]);router[_0x9414('0xa')]('/:id/run',auth[_0x9414('0x8')](),controller[_0x9414('0xf')]);router[_0x9414('0xa')](_0x9414('0x10'),auth[_0x9414('0x8')](),controller[_0x9414('0x11')]);router[_0x9414('0x12')]('/',auth[_0x9414('0x8')](),controller[_0x9414('0x13')]);router['put'](_0x9414('0xb'),auth['isAuthenticated'](),controller[_0x9414('0x14')]);router[_0x9414('0x15')]('/:id',auth[_0x9414('0x8')](),controller[_0x9414('0x16')]);module[_0x9414('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 4b98df0..95a1edd 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 _0x3e2c=['DATE','Loading','scheduled','manual','INTEGER','sequelize','moment','exports','STRING','ENUM','pdf','xlsx'];(function(_0x4a1315,_0x58b7d5){var _0x16125a=function(_0x4854f7){while(--_0x4854f7){_0x4a1315['push'](_0x4a1315['shift']());}};_0x16125a(++_0x58b7d5);}(_0x3e2c,0x1cd));var _0xc3e2=function(_0x486f8e,_0x52fb5f){_0x486f8e=_0x486f8e-0x0;var _0x528b66=_0x3e2c[_0x486f8e];return _0x528b66;};'use strict';var Sequelize=require(_0xc3e2('0x0'));var moment=require(_0xc3e2('0x1'));module[_0xc3e2('0x2')]={'name':{'type':Sequelize[_0xc3e2('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xc3e2('0x4')]('csv',_0xc3e2('0x5'),_0xc3e2('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xc3e2('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xc3e2('0x7')]},'endDate':{'type':Sequelize[_0xc3e2('0x7')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0xc3e2('0x8')},'type':{'type':Sequelize[_0xc3e2('0x4')]('manual',_0xc3e2('0x9')),'allowNull':![],'defaultValue':_0xc3e2('0xa')},'reportId':{'type':Sequelize[_0xc3e2('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0xc3e2('0x3')]}}; \ No newline at end of file +var _0x8270=['moment','STRING','ENUM','pdf','csv','DATE','Loading','manual','scheduled'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x8270,0xb4));var _0x0827=function(_0x4e44ae,_0x51df27){_0x4e44ae=_0x4e44ae-0x0;var _0x4cb789=_0x8270[_0x4e44ae];return _0x4cb789;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0827('0x0'));module['exports']={'name':{'type':Sequelize[_0x0827('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x0827('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x0827('0x2')]('csv',_0x0827('0x3'),'xlsx'),'allowNull':![],'defaultValue':_0x0827('0x4')},'savename':{'type':Sequelize[_0x0827('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0827('0x5')]},'endDate':{'type':Sequelize[_0x0827('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x0827('0x6')},'type':{'type':Sequelize[_0x0827('0x2')](_0x0827('0x7'),_0x0827('0x8')),'allowNull':![],'defaultValue':_0x0827('0x7')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 3693d97..e1d6fcb 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 _0x7759=['AnalyticExtractedReport','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename','output','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','savename','toLowerCase','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','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','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','get','ExtractedReports','UserProfileResource','error','stack','name','index','map'];(function(_0x451353,_0x19710b){var _0x102315=function(_0x51204c){while(--_0x51204c){_0x451353['push'](_0x451353['shift']());}};_0x102315(++_0x19710b);}(_0x7759,0x194));var _0x9775=function(_0x22662a,_0x1cbd57){_0x22662a=_0x22662a-0x0;var _0x2aba64=_0x7759[_0x22662a];return _0x2aba64;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9775('0x0'));var zipdir=require(_0x9775('0x1'));var jsonpatch=require(_0x9775('0x2'));var rp=require(_0x9775('0x3'));var moment=require('moment');var BPromise=require(_0x9775('0x4'));var Mustache=require(_0x9775('0x5'));var util=require(_0x9775('0x6'));var path=require(_0x9775('0x7'));var sox=require('sox');var csv=require(_0x9775('0x8'));var ejs=require(_0x9775('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9775('0xa'));var squel=require(_0x9775('0xb'));var crypto=require(_0x9775('0xc'));var jsforce=require(_0x9775('0xd'));var deskjs=require(_0x9775('0xe'));var toCsv=require(_0x9775('0x8'));var querystring=require(_0x9775('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9775('0x10'));var qs=require(_0x9775('0x11'));var as=require(_0x9775('0x12'));var hardwareService=require(_0x9775('0x13'));var logger=require(_0x9775('0x14'))('api');var utils=require(_0x9775('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x9775('0x16'));var db=require(_0x9775('0x17'))['db'];function respondWithStatusCode(_0x5b6809,_0xd1c228){_0xd1c228=_0xd1c228||0xcc;return function(_0x282fb5){if(_0x282fb5){return _0x5b6809[_0x9775('0x18')](_0xd1c228);}return _0x5b6809['status'](_0xd1c228)[_0x9775('0x19')]();};}function respondWithResult(_0x253102,_0x4bb0cd){_0x4bb0cd=_0x4bb0cd||0xc8;return function(_0x636671){if(_0x636671){return _0x253102[_0x9775('0x1a')](_0x4bb0cd)[_0x9775('0x1b')](_0x636671);}};}function respondWithFilteredResult(_0x47e5fa,_0x2483f9){return function(_0x584f82){if(_0x584f82){var _0x426fc5=typeof _0x2483f9[_0x9775('0x1c')]===_0x9775('0x1d')&&typeof _0x2483f9[_0x9775('0x1e')]===_0x9775('0x1d');var _0x307af3=_0x584f82[_0x9775('0x1f')];var _0x532fc8=_0x426fc5?0x0:_0x2483f9[_0x9775('0x1c')];var _0x2320e0=_0x426fc5?_0x584f82['count']:_0x2483f9[_0x9775('0x1c')]+_0x2483f9[_0x9775('0x1e')];var _0x1ed595;if(_0x2320e0>=_0x307af3){_0x2320e0=_0x307af3;_0x1ed595=0xc8;}else{_0x1ed595=0xce;}_0x47e5fa[_0x9775('0x1a')](_0x1ed595);return _0x47e5fa[_0x9775('0x20')]('Content-Range',_0x532fc8+'-'+_0x2320e0+'/'+_0x307af3)['json'](_0x584f82);}return null;};}function patchUpdates(_0x38cf19){return function(_0x448f4b){try{jsonpatch['apply'](_0x448f4b,_0x38cf19,!![]);}catch(_0x4d004e){return BPromise[_0x9775('0x21')](_0x4d004e);}return _0x448f4b[_0x9775('0x22')]();};}function saveUpdates(_0x428b48,_0x5a280f){return function(_0x28d255){if(_0x28d255){return _0x28d255[_0x9775('0x23')](_0x428b48)[_0x9775('0x24')](function(_0x5d948a){return _0x5d948a;});}return null;};}function removeEntity(_0x4c1042,_0xfd46de){return function(_0x2247b1){if(_0x2247b1){return _0x2247b1[_0x9775('0x25')]()[_0x9775('0x24')](function(){var _0x9bd5a8=_0x2247b1[_0x9775('0x26')]({'plain':!![]});var _0x2517a4=_0x9775('0x27');return db[_0x9775('0x28')]['destroy']({'where':{'type':_0x2517a4,'resourceId':_0x9bd5a8['id']}})[_0x9775('0x24')](function(){return _0x2247b1;});})['then'](function(){_0x4c1042[_0x9775('0x1a')](0xcc)[_0x9775('0x19')]();});}};}function handleEntityNotFound(_0x5f409e,_0x8806a6){return function(_0x57af3d){if(!_0x57af3d){_0x5f409e[_0x9775('0x18')](0x194);}return _0x57af3d;};}function handleError(_0x1b8d84,_0x173f2b){_0x173f2b=_0x173f2b||0x1f4;return function(_0x1f385b){logger[_0x9775('0x29')](_0x1f385b[_0x9775('0x2a')]);if(_0x1f385b[_0x9775('0x2b')]){delete _0x1f385b['name'];}_0x1b8d84['status'](_0x173f2b)['send'](_0x1f385b);};}exports[_0x9775('0x2c')]=function(_0x5c5751,_0x5e7f1f){var _0x366530={},_0x573909={},_0x3971ef={'count':0x0,'rows':[]};var _0x114b91=_[_0x9775('0x2d')](db[_0x9775('0x2e')][_0x9775('0x2f')],function(_0x55726d){return{'name':_0x55726d['fieldName'],'type':_0x55726d[_0x9775('0x30')][_0x9775('0x31')]};});_0x573909[_0x9775('0x32')]=_[_0x9775('0x2d')](_0x114b91,_0x9775('0x2b'));_0x573909['query']=_[_0x9775('0x33')](_0x5c5751[_0x9775('0x34')]);_0x573909['filters']=_[_0x9775('0x35')](_0x573909[_0x9775('0x32')],_0x573909['query']);_0x366530[_0x9775('0x36')]=_[_0x9775('0x35')](_0x573909[_0x9775('0x32')],qs[_0x9775('0x37')](_0x5c5751[_0x9775('0x34')][_0x9775('0x37')]));_0x366530[_0x9775('0x36')]=_0x366530['attributes'][_0x9775('0x38')]?_0x366530['attributes']:_0x573909[_0x9775('0x32')];if(!_0x5c5751['query']['hasOwnProperty'](_0x9775('0x39'))){_0x366530[_0x9775('0x1e')]=qs[_0x9775('0x1e')](_0x5c5751[_0x9775('0x34')][_0x9775('0x1e')]);_0x366530[_0x9775('0x1c')]=qs[_0x9775('0x1c')](_0x5c5751[_0x9775('0x34')][_0x9775('0x1c')]);}_0x366530['order']=qs[_0x9775('0x3a')](_0x5c5751[_0x9775('0x34')]['sort']);_0x366530['where']=qs[_0x9775('0x3b')](_['pick'](_0x5c5751[_0x9775('0x34')],_0x573909[_0x9775('0x3b')]),_0x114b91);if(_0x5c5751[_0x9775('0x34')][_0x9775('0x3c')]){_0x366530[_0x9775('0x3d')]=_[_0x9775('0x3e')](_0x366530[_0x9775('0x3d')],{'$or':_[_0x9775('0x2d')](_0x114b91,function(_0x30fa76){if(_0x30fa76[_0x9775('0x30')]!==_0x9775('0x3f')){var _0x2466dc={};_0x2466dc[_0x30fa76['name']]={'$like':'%'+_0x5c5751[_0x9775('0x34')][_0x9775('0x3c')]+'%'};return _0x2466dc;}})});}_0x366530=_[_0x9775('0x3e')]({},_0x366530,_0x5c5751[_0x9775('0x40')]);var _0x582ee2={'where':_0x366530[_0x9775('0x3d')]};return db[_0x9775('0x2e')]['count'](_0x582ee2)[_0x9775('0x24')](function(_0x2df0ce){_0x3971ef['count']=_0x2df0ce;if(_0x5c5751[_0x9775('0x34')][_0x9775('0x41')]){_0x366530[_0x9775('0x42')]=[{'all':!![]}];}return db[_0x9775('0x2e')]['findAll'](_0x366530);})[_0x9775('0x24')](function(_0x5c8031){_0x3971ef[_0x9775('0x43')]=_0x5c8031;return _0x3971ef;})['then'](respondWithFilteredResult(_0x5e7f1f,_0x366530))[_0x9775('0x44')](handleError(_0x5e7f1f,null));};exports[_0x9775('0x45')]=function(_0x4e858f,_0x4891db){var _0xcc1c42={'raw':!![],'where':{'id':_0x4e858f[_0x9775('0x46')]['id']}},_0x395970={};_0x395970[_0x9775('0x32')]=_['keys'](db['AnalyticExtractedReport'][_0x9775('0x2f')]);_0x395970[_0x9775('0x34')]=_[_0x9775('0x33')](_0x4e858f[_0x9775('0x34')]);_0x395970[_0x9775('0x3b')]=_[_0x9775('0x35')](_0x395970['model'],_0x395970[_0x9775('0x34')]);_0xcc1c42['attributes']=_[_0x9775('0x35')](_0x395970[_0x9775('0x32')],qs[_0x9775('0x37')](_0x4e858f['query'][_0x9775('0x37')]));_0xcc1c42[_0x9775('0x36')]=_0xcc1c42[_0x9775('0x36')][_0x9775('0x38')]?_0xcc1c42[_0x9775('0x36')]:_0x395970['model'];if(_0x4e858f['query'][_0x9775('0x41')]){_0xcc1c42[_0x9775('0x42')]=[{'all':!![]}];}_0xcc1c42=_['merge']({},_0xcc1c42,_0x4e858f[_0x9775('0x40')]);return db[_0x9775('0x2e')][_0x9775('0x47')](_0xcc1c42)[_0x9775('0x24')](handleEntityNotFound(_0x4891db,null))['then'](respondWithResult(_0x4891db,null))['catch'](handleError(_0x4891db,null));};exports[_0x9775('0x48')]=function(_0x10c69f,_0x383eb9){return db['AnalyticExtractedReport'][_0x9775('0x48')](_0x10c69f[_0x9775('0x49')],{})[_0x9775('0x24')](function(_0x1dd075){var _0xa1687d=_0x10c69f[_0x9775('0x4a')][_0x9775('0x26')]({'plain':!![]});if(!_0xa1687d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1687d[_0x9775('0x4b')]===_0x9775('0x4a')){var _0x527546=_0x1dd075[_0x9775('0x26')]({'plain':!![]});var _0x57e073=_0x9775('0x27');return db[_0x9775('0x4c')][_0x9775('0x47')]({'where':{'name':_0x57e073,'userProfileId':_0xa1687d[_0x9775('0x4d')]},'raw':!![]})[_0x9775('0x24')](function(_0x2cf963){if(_0x2cf963&&_0x2cf963['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x527546[_0x9775('0x2b')],'resourceId':_0x527546['id'],'type':_0x2cf963['name'],'sectionId':_0x2cf963['id']},{})[_0x9775('0x24')](function(){return _0x1dd075;});}else{return _0x1dd075;}})['catch'](function(_0x50dbb0){logger['error'](_0x9775('0x4e'),_0x50dbb0);throw _0x50dbb0;});}return _0x1dd075;})[_0x9775('0x24')](respondWithResult(_0x383eb9,0xc9))['catch'](handleError(_0x383eb9,null));};exports['update']=function(_0x236004,_0x275f00){if(_0x236004['body']['id']){delete _0x236004[_0x9775('0x49')]['id'];}return db[_0x9775('0x2e')][_0x9775('0x47')]({'where':{'id':_0x236004[_0x9775('0x46')]['id']}})[_0x9775('0x24')](handleEntityNotFound(_0x275f00,null))[_0x9775('0x24')](saveUpdates(_0x236004[_0x9775('0x49')],null))[_0x9775('0x24')](respondWithResult(_0x275f00,null))[_0x9775('0x44')](handleError(_0x275f00,null));};exports[_0x9775('0x25')]=function(_0x3bc5f1,_0x1159ff){return db[_0x9775('0x2e')][_0x9775('0x47')]({'where':{'id':_0x3bc5f1[_0x9775('0x46')]['id']}})[_0x9775('0x24')](handleEntityNotFound(_0x1159ff,null))[_0x9775('0x24')](removeEntity(_0x1159ff,null))[_0x9775('0x44')](handleError(_0x1159ff,null));};exports[_0x9775('0x4f')]=function(_0x1b3f96,_0xee0fc0,_0x53fa5d){return db[_0x9775('0x2e')][_0x9775('0x47')]({'where':{'id':_0x1b3f96[_0x9775('0x46')]['id']},'attributes':[_0x9775('0x2b'),_0x9775('0x50'),'savename',_0x9775('0x51')],'raw':!![]})[_0x9775('0x24')](handleEntityNotFound(_0xee0fc0,null))[_0x9775('0x24')](function(_0x1403ff){if(_0x1403ff){if(!fs[_0x9775('0x52')](path['join'](config[_0x9775('0x53')],_0x9775('0x54'),_0x1403ff['savename']))){throw new db['Sequelize'][(_0x9775('0x55'))](_0x9775('0x56'));}if(_0x1b3f96[_0x9775('0x34')][_0x9775('0x57')]){return _0xee0fc0['sendStatus'](0xc8);}return _0xee0fc0[_0x9775('0x4f')](path['join'](config[_0x9775('0x53')],'server/files/reports',_0x1403ff[_0x9775('0x58')]),util['format']('%s.%s',_0x1403ff[_0x9775('0x50')]||_0x1403ff[_0x9775('0x2b')],_0x1403ff[_0x9775('0x51')][_0x9775('0x59')]()));}})['catch'](handleError(_0xee0fc0,null));}; \ No newline at end of file +var _0x7d50=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','get','user','UserProfileSection','UserProfileResource','error','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','exists','download','format','basename','toLowerCase','zip-dir','fast-json-patch','moment','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','ExtractedReports','destroy','sendStatus','stack','name','send','index','map','AnalyticExtractedReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options'];(function(_0x23f44d,_0x5d6a85){var _0x16b62b=function(_0x17b8df){while(--_0x17b8df){_0x23f44d['push'](_0x23f44d['shift']());}};_0x16b62b(++_0x5d6a85);}(_0x7d50,0x7e));var _0x07d5=function(_0x20aeb5,_0x16cd11){_0x20aeb5=_0x20aeb5-0x0;var _0x325c0e=_0x7d50[_0x20aeb5];return _0x325c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x07d5('0x0'));var jsonpatch=require(_0x07d5('0x1'));var rp=require('request-promise');var moment=require(_0x07d5('0x2'));var BPromise=require(_0x07d5('0x3'));var Mustache=require(_0x07d5('0x4'));var util=require(_0x07d5('0x5'));var path=require(_0x07d5('0x6'));var sox=require(_0x07d5('0x7'));var csv=require('to-csv');var ejs=require(_0x07d5('0x8'));var fs=require('fs');var fs_extra=require(_0x07d5('0x9'));var _=require(_0x07d5('0xa'));var squel=require('squel');var crypto=require(_0x07d5('0xb'));var jsforce=require(_0x07d5('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x07d5('0xd'));var querystring=require(_0x07d5('0xe'));var Papa=require(_0x07d5('0xf'));var Redis=require(_0x07d5('0x10'));var authService=require(_0x07d5('0x11'));var qs=require(_0x07d5('0x12'));var as=require(_0x07d5('0x13'));var hardwareService=require(_0x07d5('0x14'));var logger=require(_0x07d5('0x15'))(_0x07d5('0x16'));var utils=require('../../config/utils');var config=require(_0x07d5('0x17'));var licenseUtil=require(_0x07d5('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x46f2ce,_0x5c70ae){_0x5c70ae=_0x5c70ae||0xcc;return function(_0x161e09){if(_0x161e09){return _0x46f2ce['sendStatus'](_0x5c70ae);}return _0x46f2ce[_0x07d5('0x19')](_0x5c70ae)[_0x07d5('0x1a')]();};}function respondWithResult(_0x579385,_0x5de016){_0x5de016=_0x5de016||0xc8;return function(_0x270fb6){if(_0x270fb6){return _0x579385[_0x07d5('0x19')](_0x5de016)[_0x07d5('0x1b')](_0x270fb6);}};}function respondWithFilteredResult(_0x3b3e70,_0x31b20d){return function(_0x1940f0){if(_0x1940f0){var _0x55b268=typeof _0x31b20d[_0x07d5('0x1c')]===_0x07d5('0x1d')&&typeof _0x31b20d[_0x07d5('0x1e')]==='undefined';var _0x1467fc=_0x1940f0[_0x07d5('0x1f')];var _0x2b5859=_0x55b268?0x0:_0x31b20d[_0x07d5('0x1c')];var _0x36b3fb=_0x55b268?_0x1940f0[_0x07d5('0x1f')]:_0x31b20d[_0x07d5('0x1c')]+_0x31b20d['limit'];var _0x23dd12;if(_0x36b3fb>=_0x1467fc){_0x36b3fb=_0x1467fc;_0x23dd12=0xc8;}else{_0x23dd12=0xce;}_0x3b3e70[_0x07d5('0x19')](_0x23dd12);return _0x3b3e70[_0x07d5('0x20')](_0x07d5('0x21'),_0x2b5859+'-'+_0x36b3fb+'/'+_0x1467fc)[_0x07d5('0x1b')](_0x1940f0);}return null;};}function patchUpdates(_0x345320){return function(_0x587469){try{jsonpatch[_0x07d5('0x22')](_0x587469,_0x345320,!![]);}catch(_0x2c8427){return BPromise[_0x07d5('0x23')](_0x2c8427);}return _0x587469['save']();};}function saveUpdates(_0x915e80,_0x2466f5){return function(_0x420aa3){if(_0x420aa3){return _0x420aa3[_0x07d5('0x24')](_0x915e80)[_0x07d5('0x25')](function(_0x5b6371){return _0x5b6371;});}return null;};}function removeEntity(_0x27d40b,_0x40e968){return function(_0x4f253b){if(_0x4f253b){return _0x4f253b['destroy']()[_0x07d5('0x25')](function(){var _0x2e79da=_0x4f253b['get']({'plain':!![]});var _0x2568a8=_0x07d5('0x26');return db['UserProfileResource'][_0x07d5('0x27')]({'where':{'type':_0x2568a8,'resourceId':_0x2e79da['id']}})[_0x07d5('0x25')](function(){return _0x4f253b;});})['then'](function(){_0x27d40b[_0x07d5('0x19')](0xcc)[_0x07d5('0x1a')]();});}};}function handleEntityNotFound(_0x26d527,_0x40cb54){return function(_0x4fc2d8){if(!_0x4fc2d8){_0x26d527[_0x07d5('0x28')](0x194);}return _0x4fc2d8;};}function handleError(_0x62bb73,_0x249208){_0x249208=_0x249208||0x1f4;return function(_0x228782){logger['error'](_0x228782[_0x07d5('0x29')]);if(_0x228782[_0x07d5('0x2a')]){delete _0x228782['name'];}_0x62bb73[_0x07d5('0x19')](_0x249208)[_0x07d5('0x2b')](_0x228782);};}exports[_0x07d5('0x2c')]=function(_0x5ada8c,_0x51e224){var _0x2b9f12={},_0x22a115={},_0x2e6b60={'count':0x0,'rows':[]};var _0x4f52d7=_[_0x07d5('0x2d')](db[_0x07d5('0x2e')]['rawAttributes'],function(_0x1f7507){return{'name':_0x1f7507[_0x07d5('0x2f')],'type':_0x1f7507['type'][_0x07d5('0x30')]};});_0x22a115[_0x07d5('0x31')]=_[_0x07d5('0x2d')](_0x4f52d7,_0x07d5('0x2a'));_0x22a115[_0x07d5('0x32')]=_[_0x07d5('0x33')](_0x5ada8c[_0x07d5('0x32')]);_0x22a115[_0x07d5('0x34')]=_[_0x07d5('0x35')](_0x22a115[_0x07d5('0x31')],_0x22a115[_0x07d5('0x32')]);_0x2b9f12[_0x07d5('0x36')]=_[_0x07d5('0x35')](_0x22a115[_0x07d5('0x31')],qs[_0x07d5('0x37')](_0x5ada8c['query'][_0x07d5('0x37')]));_0x2b9f12[_0x07d5('0x36')]=_0x2b9f12[_0x07d5('0x36')][_0x07d5('0x38')]?_0x2b9f12[_0x07d5('0x36')]:_0x22a115[_0x07d5('0x31')];if(!_0x5ada8c['query'][_0x07d5('0x39')](_0x07d5('0x3a'))){_0x2b9f12[_0x07d5('0x1e')]=qs['limit'](_0x5ada8c['query'][_0x07d5('0x1e')]);_0x2b9f12[_0x07d5('0x1c')]=qs[_0x07d5('0x1c')](_0x5ada8c['query'][_0x07d5('0x1c')]);}_0x2b9f12[_0x07d5('0x3b')]=qs['sort'](_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x3c')]);_0x2b9f12['where']=qs[_0x07d5('0x34')](_[_0x07d5('0x3d')](_0x5ada8c[_0x07d5('0x32')],_0x22a115[_0x07d5('0x34')]),_0x4f52d7);if(_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x3e')]){_0x2b9f12['where']=_[_0x07d5('0x3f')](_0x2b9f12[_0x07d5('0x40')],{'$or':_['map'](_0x4f52d7,function(_0x4ec811){if(_0x4ec811[_0x07d5('0x41')]!==_0x07d5('0x42')){var _0x393c15={};_0x393c15[_0x4ec811[_0x07d5('0x2a')]]={'$like':'%'+_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x3e')]+'%'};return _0x393c15;}})});}_0x2b9f12=_[_0x07d5('0x3f')]({},_0x2b9f12,_0x5ada8c[_0x07d5('0x43')]);var _0x1a85c8={'where':_0x2b9f12['where']};return db[_0x07d5('0x2e')][_0x07d5('0x1f')](_0x1a85c8)[_0x07d5('0x25')](function(_0x166ec8){_0x2e6b60['count']=_0x166ec8;if(_0x5ada8c[_0x07d5('0x32')][_0x07d5('0x44')]){_0x2b9f12[_0x07d5('0x45')]=[{'all':!![]}];}return db[_0x07d5('0x2e')][_0x07d5('0x46')](_0x2b9f12);})[_0x07d5('0x25')](function(_0xc39f3e){_0x2e6b60[_0x07d5('0x47')]=_0xc39f3e;return _0x2e6b60;})[_0x07d5('0x25')](respondWithFilteredResult(_0x51e224,_0x2b9f12))[_0x07d5('0x48')](handleError(_0x51e224,null));};exports[_0x07d5('0x49')]=function(_0x26787a,_0x3c2991){var _0x5950ce={'raw':!![],'where':{'id':_0x26787a[_0x07d5('0x4a')]['id']}},_0xb9b954={};_0xb9b954['model']=_[_0x07d5('0x33')](db[_0x07d5('0x2e')][_0x07d5('0x4b')]);_0xb9b954['query']=_['keys'](_0x26787a[_0x07d5('0x32')]);_0xb9b954['filters']=_[_0x07d5('0x35')](_0xb9b954[_0x07d5('0x31')],_0xb9b954[_0x07d5('0x32')]);_0x5950ce[_0x07d5('0x36')]=_[_0x07d5('0x35')](_0xb9b954[_0x07d5('0x31')],qs[_0x07d5('0x37')](_0x26787a[_0x07d5('0x32')][_0x07d5('0x37')]));_0x5950ce['attributes']=_0x5950ce[_0x07d5('0x36')]['length']?_0x5950ce[_0x07d5('0x36')]:_0xb9b954['model'];if(_0x26787a[_0x07d5('0x32')][_0x07d5('0x44')]){_0x5950ce['include']=[{'all':!![]}];}_0x5950ce=_['merge']({},_0x5950ce,_0x26787a[_0x07d5('0x43')]);return db[_0x07d5('0x2e')][_0x07d5('0x4c')](_0x5950ce)[_0x07d5('0x25')](handleEntityNotFound(_0x3c2991,null))[_0x07d5('0x25')](respondWithResult(_0x3c2991,null))[_0x07d5('0x48')](handleError(_0x3c2991,null));};exports[_0x07d5('0x4d')]=function(_0x444fab,_0x4345a4){return db[_0x07d5('0x2e')][_0x07d5('0x4d')](_0x444fab[_0x07d5('0x4e')],{})[_0x07d5('0x25')](function(_0x43db19){var _0x1f5061=_0x444fab['user'][_0x07d5('0x4f')]({'plain':!![]});if(!_0x1f5061)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1f5061['role']===_0x07d5('0x50')){var _0x2dac65=_0x43db19[_0x07d5('0x4f')]({'plain':!![]});var _0x2e7bee=_0x07d5('0x26');return db[_0x07d5('0x51')]['find']({'where':{'name':_0x2e7bee,'userProfileId':_0x1f5061['userProfileId']},'raw':!![]})[_0x07d5('0x25')](function(_0x27374e){if(_0x27374e&&_0x27374e['autoAssociation']===0x0){return db[_0x07d5('0x52')][_0x07d5('0x4d')]({'name':_0x2dac65[_0x07d5('0x2a')],'resourceId':_0x2dac65['id'],'type':_0x27374e[_0x07d5('0x2a')],'sectionId':_0x27374e['id']},{})[_0x07d5('0x25')](function(){return _0x43db19;});}else{return _0x43db19;}})[_0x07d5('0x48')](function(_0x456b75){logger[_0x07d5('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x456b75);throw _0x456b75;});}return _0x43db19;})[_0x07d5('0x25')](respondWithResult(_0x4345a4,0xc9))[_0x07d5('0x48')](handleError(_0x4345a4,null));};exports['update']=function(_0x332d2e,_0x181119){if(_0x332d2e[_0x07d5('0x4e')]['id']){delete _0x332d2e[_0x07d5('0x4e')]['id'];}return db[_0x07d5('0x2e')]['find']({'where':{'id':_0x332d2e[_0x07d5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x181119,null))[_0x07d5('0x25')](saveUpdates(_0x332d2e[_0x07d5('0x4e')],null))[_0x07d5('0x25')](respondWithResult(_0x181119,null))['catch'](handleError(_0x181119,null));};exports[_0x07d5('0x27')]=function(_0x12c6ec,_0x29431b){return db[_0x07d5('0x2e')][_0x07d5('0x4c')]({'where':{'id':_0x12c6ec[_0x07d5('0x4a')]['id']}})[_0x07d5('0x25')](handleEntityNotFound(_0x29431b,null))['then'](removeEntity(_0x29431b,null))[_0x07d5('0x48')](handleError(_0x29431b,null));};exports['download']=function(_0xfb1401,_0xece9bc,_0x2d4a5a){return db[_0x07d5('0x2e')][_0x07d5('0x4c')]({'where':{'id':_0xfb1401[_0x07d5('0x4a')]['id']},'attributes':[_0x07d5('0x2a'),'basename',_0x07d5('0x54'),_0x07d5('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0xece9bc,null))[_0x07d5('0x25')](function(_0x1eddac){if(_0x1eddac){if(!fs[_0x07d5('0x56')](path[_0x07d5('0x57')](config[_0x07d5('0x58')],_0x07d5('0x59'),_0x1eddac[_0x07d5('0x54')]))){throw new db[(_0x07d5('0x5a'))][(_0x07d5('0x5b'))]('Report\x20not\x20found\x20or\x20empty');}if(_0xfb1401[_0x07d5('0x32')][_0x07d5('0x5c')]){return _0xece9bc[_0x07d5('0x28')](0xc8);}return _0xece9bc[_0x07d5('0x5d')](path['join'](config[_0x07d5('0x58')],'server/files/reports',_0x1eddac[_0x07d5('0x54')]),util[_0x07d5('0x5e')]('%s.%s',_0x1eddac[_0x07d5('0x5f')]||_0x1eddac['name'],_0x1eddac[_0x07d5('0x55')][_0x07d5('0x60')]()));}})['catch'](handleError(_0xece9bc,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 4de52ac..f557dd8 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 _0x10da=['exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','./analyticExtractedReport.attributes'];(function(_0x3854e6,_0x45df01){var _0x1ee60d=function(_0x569ec0){while(--_0x569ec0){_0x3854e6['push'](_0x3854e6['shift']());}};_0x1ee60d(++_0x45df01);}(_0x10da,0x1b0));var _0xa10d=function(_0x48912e,_0x2276f4){_0x48912e=_0x48912e-0x0;var _0x4d00c2=_0x10da[_0x48912e];return _0x4d00c2;};'use strict';var _=require(_0xa10d('0x0'));var util=require(_0xa10d('0x1'));var logger=require(_0xa10d('0x2'))(_0xa10d('0x3'));var moment=require('moment');var BPromise=require(_0xa10d('0x4'));var rp=require(_0xa10d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa10d('0x6'));var config=require('../../config/environment');var attributes=require(_0xa10d('0x7'));module[_0xa10d('0x8')]=function(_0x398681,_0x1443b8){return _0x398681[_0xa10d('0x9')](_0xa10d('0xa'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd37=['path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x5e390e,_0x396801){var _0x34b044=function(_0x59f5d9){while(--_0x59f5d9){_0x5e390e['push'](_0x5e390e['shift']());}};_0x34b044(++_0x396801);}(_0xfd37,0x78));var _0x7fd3=function(_0x2b191e,_0x3f477d){_0x2b191e=_0x2b191e-0x0;var _0x420881=_0xfd37[_0x2b191e];return _0x420881;};'use strict';var _=require(_0x7fd3('0x0'));var util=require(_0x7fd3('0x1'));var logger=require(_0x7fd3('0x2'))(_0x7fd3('0x3'));var moment=require('moment');var BPromise=require(_0x7fd3('0x4'));var rp=require(_0x7fd3('0x5'));var fs=require('fs');var path=require(_0x7fd3('0x6'));var rimraf=require(_0x7fd3('0x7'));var config=require(_0x7fd3('0x8'));var attributes=require(_0x7fd3('0x9'));module[_0x7fd3('0xa')]=function(_0x3d24c8,_0x158d16){return _0x3d24c8[_0x7fd3('0xb')](_0x7fd3('0xc'),attributes,{'tableName':_0x7fd3('0xd'),'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 de852df..91124e9 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 _0xa153=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x59162a,_0x10e547){var _0x35e50d=function(_0x578425){while(--_0x578425){_0x59162a['push'](_0x59162a['shift']());}};_0x35e50d(++_0x10e547);}(_0xa153,0x85));var _0x3a15=function(_0xf8bfc3,_0x29cf48){_0xf8bfc3=_0xf8bfc3-0x0;var _0x4d7a6b=_0xa153[_0xf8bfc3];return _0x4d7a6b;};'use strict';var _=require(_0x3a15('0x0'));var util=require(_0x3a15('0x1'));var moment=require(_0x3a15('0x2'));var BPromise=require(_0x3a15('0x3'));var rs=require(_0x3a15('0x4'));var fs=require('fs');var Redis=require(_0x3a15('0x5'));var db=require(_0x3a15('0x6'))['db'];var utils=require(_0x3a15('0x7'));var logger=require(_0x3a15('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3a15('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x476fb0,_0xd33b23,_0x22eaf8){return new BPromise(function(_0x35b5cc,_0x46bde5){return client['request'](_0x476fb0,_0x22eaf8)[_0x3a15('0xa')](function(_0x21eee8){logger[_0x3a15('0xb')](_0x3a15('0xc'),_0xd33b23,_0x3a15('0xd'));logger[_0x3a15('0xe')](_0x3a15('0xf'),_0xd33b23,_0x3a15('0xd'),JSON[_0x3a15('0x10')](_0x21eee8));if(_0x21eee8['error']){if(_0x21eee8[_0x3a15('0x11')][_0x3a15('0x12')]===0x1f4){logger['error'](_0x3a15('0xc'),_0xd33b23,_0x21eee8['error']['message']);return _0x46bde5(_0x21eee8[_0x3a15('0x11')]['message']);}logger['error'](_0x3a15('0xc'),_0xd33b23,_0x21eee8['error'][_0x3a15('0x13')]);return _0x35b5cc(_0x21eee8[_0x3a15('0x11')][_0x3a15('0x13')]);}else{logger['info'](_0x3a15('0xc'),_0xd33b23,_0x3a15('0xd'));_0x35b5cc(_0x21eee8[_0x3a15('0x14')][_0x3a15('0x13')]);}})[_0x3a15('0x15')](function(_0x5a8111){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0xd33b23,_0x5a8111);_0x46bde5(_0x5a8111);});});} \ No newline at end of file +var _0x4b39=['AnalyticExtractedReport,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x468148,_0x50e263){var _0x2b67ab=function(_0x1baee5){while(--_0x1baee5){_0x468148['push'](_0x468148['shift']());}};_0x2b67ab(++_0x50e263);}(_0x4b39,0x133));var _0x94b3=function(_0x4b17da,_0x3b50b4){_0x4b17da=_0x4b17da-0x0;var _0x1dce95=_0x4b39[_0x4b17da];return _0x1dce95;};'use strict';var _=require(_0x94b3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x94b3('0x1'));var rs=require(_0x94b3('0x2'));var fs=require('fs');var Redis=require(_0x94b3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x94b3('0x4'));var logger=require(_0x94b3('0x5'))(_0x94b3('0x6'));var config=require(_0x94b3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x94b3('0x8')][_0x94b3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x25daa0,_0x547e4d,_0x19a221){return new BPromise(function(_0x538ad5,_0x363a67){return client['request'](_0x25daa0,_0x19a221)[_0x94b3('0xa')](function(_0x4e6307){logger[_0x94b3('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x547e4d,_0x94b3('0xc'));logger['debug'](_0x94b3('0xd'),_0x547e4d,_0x94b3('0xc'),JSON[_0x94b3('0xe')](_0x4e6307));if(_0x4e6307['error']){if(_0x4e6307[_0x94b3('0xf')]['code']===0x1f4){logger[_0x94b3('0xf')](_0x94b3('0x10'),_0x547e4d,_0x4e6307[_0x94b3('0xf')][_0x94b3('0x11')]);return _0x363a67(_0x4e6307['error']['message']);}logger[_0x94b3('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x547e4d,_0x4e6307[_0x94b3('0xf')]['message']);return _0x538ad5(_0x4e6307[_0x94b3('0xf')][_0x94b3('0x11')]);}else{logger['info'](_0x94b3('0x10'),_0x547e4d,_0x94b3('0xc'));_0x538ad5(_0x4e6307['result'][_0x94b3('0x11')]);}})[_0x94b3('0x12')](function(_0x1896ec){logger[_0x94b3('0xf')](_0x94b3('0x10'),_0x547e4d,_0x1896ec);_0x363a67(_0x1896ec);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 9538a1e..4233a3e 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 _0xc6e4=['../../config/environment','get','isAuthenticated','index','show','download','post','create','/:id','delete','destroy','exports','multer','path','Router','fs-extra','../../components/interaction/service'];(function(_0x2371a3,_0x84a147){var _0x41f614=function(_0x219ba7){while(--_0x219ba7){_0x2371a3['push'](_0x2371a3['shift']());}};_0x41f614(++_0x84a147);}(_0xc6e4,0x11c));var _0x4c6e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc6e4[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4c6e('0x0'));var util=require('util');var path=require(_0x4c6e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x4c6e('0x2')]();var fs_extra=require(_0x4c6e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4c6e('0x4'));var config=require(_0x4c6e('0x5'));var controller=require('./analyticExtractedReport.controller');router[_0x4c6e('0x6')]('/',auth[_0x4c6e('0x7')](),controller[_0x4c6e('0x8')]);router['get']('/:id',auth[_0x4c6e('0x7')](),controller[_0x4c6e('0x9')]);router[_0x4c6e('0x6')]('/:id/download',auth['isAuthenticated'](),controller[_0x4c6e('0xa')]);router[_0x4c6e('0xb')]('/',auth[_0x4c6e('0x7')](),controller[_0x4c6e('0xc')]);router['put'](_0x4c6e('0xd'),auth[_0x4c6e('0x7')](),controller['update']);router[_0x4c6e('0xe')](_0x4c6e('0xd'),auth[_0x4c6e('0x7')](),controller[_0x4c6e('0xf')]);module[_0x4c6e('0x10')]=router; \ No newline at end of file +var _0x97c2=['./analyticExtractedReport.controller','get','index','/:id','show','/:id/download','isAuthenticated','download','post','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x29b65b,_0x3b7633){var _0x2d80ba=function(_0x6a7752){while(--_0x6a7752){_0x29b65b['push'](_0x29b65b['shift']());}};_0x2d80ba(++_0x3b7633);}(_0x97c2,0x138));var _0x297c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x97c2[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x297c('0x0'));var util=require(_0x297c('0x1'));var path=require(_0x297c('0x2'));var timeout=require(_0x297c('0x3'));var express=require(_0x297c('0x4'));var router=express[_0x297c('0x5')]();var fs_extra=require(_0x297c('0x6'));var auth=require(_0x297c('0x7'));var interaction=require(_0x297c('0x8'));var config=require(_0x297c('0x9'));var controller=require(_0x297c('0xa'));router[_0x297c('0xb')]('/',auth['isAuthenticated'](),controller[_0x297c('0xc')]);router['get'](_0x297c('0xd'),auth['isAuthenticated'](),controller[_0x297c('0xe')]);router[_0x297c('0xb')](_0x297c('0xf'),auth[_0x297c('0x10')](),controller[_0x297c('0x11')]);router[_0x297c('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x297c('0x13')]('/:id',auth[_0x297c('0x10')](),controller[_0x297c('0x14')]);router['delete']('/:id',auth[_0x297c('0x10')](),controller[_0x297c('0x15')]);module[_0x297c('0x16')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index aa34234..59c649c 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 _0x86f2=['STRING','BOOLEAN','sequelize','TEXT'];(function(_0x5a4795,_0x7db3ad){var _0x3549d6=function(_0x2e66e9){while(--_0x2e66e9){_0x5a4795['push'](_0x5a4795['shift']());}};_0x3549d6(++_0x7db3ad);}(_0x86f2,0x76));var _0x286f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x86f2[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x286f('0x0'));module['exports']={'field':{'type':Sequelize[_0x286f('0x1')]},'alias':{'type':Sequelize[_0x286f('0x2')]},'function':{'type':Sequelize[_0x286f('0x2')]},'format':{'type':Sequelize[_0x286f('0x2')]},'groupBy':{'type':Sequelize[_0x286f('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x286f('0x2')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7f80=['sequelize','exports','TEXT','STRING'];(function(_0x9cae0c,_0x42b12d){var _0x45542e=function(_0x31623a){while(--_0x31623a){_0x9cae0c['push'](_0x9cae0c['shift']());}};_0x45542e(++_0x42b12d);}(_0x7f80,0xec));var _0x07f8=function(_0x51304d,_0x42c2e7){_0x51304d=_0x51304d-0x0;var _0x588e90=_0x7f80[_0x51304d];return _0x588e90;};'use strict';var Sequelize=require(_0x07f8('0x0'));module[_0x07f8('0x1')]={'field':{'type':Sequelize[_0x07f8('0x2')]},'alias':{'type':Sequelize[_0x07f8('0x3')]},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x07f8('0x3')]},'custom':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 7fe080f..e6ce079 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 _0xaffb=['length','options','find','create','body','bulkCreate','bulkDestroy','ids','findOne','transaction','CustomReportId','findAll','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','status','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','rows','catch','params','fields'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaffb,0x1e6));var _0xbaff=function(_0x55d8c5,_0x10287a){_0x55d8c5=_0x55d8c5-0x0;var _0x225ae5=_0xaffb[_0x55d8c5];return _0x225ae5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbaff('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbaff('0x1'));var moment=require(_0xbaff('0x2'));var BPromise=require(_0xbaff('0x3'));var Mustache=require(_0xbaff('0x4'));var util=require(_0xbaff('0x5'));var path=require(_0xbaff('0x6'));var sox=require(_0xbaff('0x7'));var csv=require(_0xbaff('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbaff('0x9'));var squel=require(_0xbaff('0xa'));var crypto=require(_0xbaff('0xb'));var jsforce=require(_0xbaff('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xbaff('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbaff('0xd'));var authService=require(_0xbaff('0xe'));var qs=require(_0xbaff('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xbaff('0x10'))(_0xbaff('0x11'));var utils=require('../../config/utils');var config=require(_0xbaff('0x12'));var licenseUtil=require(_0xbaff('0x13'));var db=require(_0xbaff('0x14'))['db'];function respondWithStatusCode(_0x574fd4,_0x12917f){_0x12917f=_0x12917f||0xcc;return function(_0x578409){if(_0x578409){return _0x574fd4[_0xbaff('0x15')](_0x12917f);}return _0x574fd4['status'](_0x12917f)[_0xbaff('0x16')]();};}function respondWithResult(_0x34420d,_0x23fb1c){_0x23fb1c=_0x23fb1c||0xc8;return function(_0x16e356){if(_0x16e356){return _0x34420d['status'](_0x23fb1c)[_0xbaff('0x17')](_0x16e356);}};}function respondWithFilteredResult(_0x30e3fa,_0x541636){return function(_0x5c4c6c){if(_0x5c4c6c){var _0x1f3506=typeof _0x541636[_0xbaff('0x18')]===_0xbaff('0x19')&&typeof _0x541636['limit']===_0xbaff('0x19');var _0x5a01e0=_0x5c4c6c[_0xbaff('0x1a')];var _0x3947e0=_0x1f3506?0x0:_0x541636[_0xbaff('0x18')];var _0x3f9258=_0x1f3506?_0x5c4c6c[_0xbaff('0x1a')]:_0x541636[_0xbaff('0x18')]+_0x541636[_0xbaff('0x1b')];var _0x5dcb6a;if(_0x3f9258>=_0x5a01e0){_0x3f9258=_0x5a01e0;_0x5dcb6a=0xc8;}else{_0x5dcb6a=0xce;}_0x30e3fa['status'](_0x5dcb6a);return _0x30e3fa[_0xbaff('0x1c')](_0xbaff('0x1d'),_0x3947e0+'-'+_0x3f9258+'/'+_0x5a01e0)[_0xbaff('0x17')](_0x5c4c6c);}return null;};}function patchUpdates(_0x4382de){return function(_0xddf46f){try{jsonpatch[_0xbaff('0x1e')](_0xddf46f,_0x4382de,!![]);}catch(_0x2df365){return BPromise[_0xbaff('0x1f')](_0x2df365);}return _0xddf46f['save']();};}function saveUpdates(_0x4009a4,_0x1fbb65){return function(_0x36b462){if(_0x36b462){return _0x36b462[_0xbaff('0x20')](_0x4009a4)[_0xbaff('0x21')](function(_0x524501){return _0x524501;});}return null;};}function removeEntity(_0x302765,_0x3598d4){return function(_0x52f1e8){if(_0x52f1e8){return _0x52f1e8[_0xbaff('0x22')]()[_0xbaff('0x21')](function(){_0x302765[_0xbaff('0x23')](0xcc)[_0xbaff('0x16')]();});}};}function handleEntityNotFound(_0x444296,_0x4cafc9){return function(_0x36d017){if(!_0x36d017){_0x444296[_0xbaff('0x15')](0x194);}return _0x36d017;};}function handleError(_0x390ce3,_0x340225){_0x340225=_0x340225||0x1f4;return function(_0x4aa8b4){logger[_0xbaff('0x24')](_0x4aa8b4[_0xbaff('0x25')]);if(_0x4aa8b4['name']){delete _0x4aa8b4[_0xbaff('0x26')];}_0x390ce3[_0xbaff('0x23')](_0x340225)[_0xbaff('0x27')](_0x4aa8b4);};}exports[_0xbaff('0x28')]=function(_0x1bd18e,_0x13c91f){var _0x5a096e={},_0x14300c={},_0x62292f={'count':0x0,'rows':[]};var _0x5b6f01=_['map'](db[_0xbaff('0x29')][_0xbaff('0x2a')],function(_0x48d2d1){return{'name':_0x48d2d1[_0xbaff('0x2b')],'type':_0x48d2d1[_0xbaff('0x2c')][_0xbaff('0x2d')]};});_0x14300c[_0xbaff('0x2e')]=_[_0xbaff('0x2f')](_0x5b6f01,_0xbaff('0x26'));_0x14300c[_0xbaff('0x30')]=_[_0xbaff('0x31')](_0x1bd18e[_0xbaff('0x30')]);_0x14300c[_0xbaff('0x32')]=_[_0xbaff('0x33')](_0x14300c['model'],_0x14300c[_0xbaff('0x30')]);_0x5a096e[_0xbaff('0x34')]=_[_0xbaff('0x33')](_0x14300c[_0xbaff('0x2e')],qs['fields'](_0x1bd18e['query']['fields']));_0x5a096e[_0xbaff('0x34')]=_0x5a096e[_0xbaff('0x34')]['length']?_0x5a096e['attributes']:_0x14300c[_0xbaff('0x2e')];if(!_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x35')]('nolimit')){_0x5a096e[_0xbaff('0x1b')]=qs[_0xbaff('0x1b')](_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x1b')]);_0x5a096e[_0xbaff('0x18')]=qs[_0xbaff('0x18')](_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x18')]);}_0x5a096e[_0xbaff('0x36')]=qs[_0xbaff('0x37')](_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x37')]);_0x5a096e['where']=qs['filters'](_[_0xbaff('0x38')](_0x1bd18e[_0xbaff('0x30')],_0x14300c[_0xbaff('0x32')]),_0x5b6f01);if(_0x1bd18e['query'][_0xbaff('0x39')]){_0x5a096e[_0xbaff('0x3a')]=_[_0xbaff('0x3b')](_0x5a096e['where'],{'$or':_[_0xbaff('0x2f')](_0x5b6f01,function(_0x35f980){if(_0x35f980['type']!==_0xbaff('0x3c')){var _0x114fe5={};_0x114fe5[_0x35f980[_0xbaff('0x26')]]={'$like':'%'+_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x39')]+'%'};return _0x114fe5;}})});}_0x5a096e=_[_0xbaff('0x3b')]({},_0x5a096e,_0x1bd18e['options']);var _0x18c543={'where':_0x5a096e[_0xbaff('0x3a')]};return db[_0xbaff('0x29')][_0xbaff('0x1a')](_0x18c543)['then'](function(_0x40c6c7){_0x62292f[_0xbaff('0x1a')]=_0x40c6c7;if(_0x1bd18e[_0xbaff('0x30')][_0xbaff('0x3d')]){_0x5a096e[_0xbaff('0x3e')]=[{'all':!![]}];}return db['AnalyticFieldReport']['findAll'](_0x5a096e);})[_0xbaff('0x21')](function(_0x4c8604){_0x62292f[_0xbaff('0x3f')]=_0x4c8604;return _0x62292f;})[_0xbaff('0x21')](respondWithFilteredResult(_0x13c91f,_0x5a096e))[_0xbaff('0x40')](handleError(_0x13c91f,null));};exports['show']=function(_0x2a7159,_0x2c24ef){var _0x183b9c={'raw':![],'where':{'id':_0x2a7159[_0xbaff('0x41')]['id']}},_0x25262a={};_0x25262a[_0xbaff('0x2e')]=_[_0xbaff('0x31')](db[_0xbaff('0x29')][_0xbaff('0x2a')]);_0x25262a['query']=_['keys'](_0x2a7159['query']);_0x25262a[_0xbaff('0x32')]=_[_0xbaff('0x33')](_0x25262a[_0xbaff('0x2e')],_0x25262a[_0xbaff('0x30')]);_0x183b9c[_0xbaff('0x34')]=_[_0xbaff('0x33')](_0x25262a[_0xbaff('0x2e')],qs['fields'](_0x2a7159[_0xbaff('0x30')][_0xbaff('0x42')]));_0x183b9c['attributes']=_0x183b9c[_0xbaff('0x34')][_0xbaff('0x43')]?_0x183b9c[_0xbaff('0x34')]:_0x25262a['model'];if(_0x2a7159[_0xbaff('0x30')]['includeAll']){_0x183b9c[_0xbaff('0x3e')]=[{'all':!![]}];}_0x183b9c=_['merge']({},_0x183b9c,_0x2a7159[_0xbaff('0x44')]);return db['AnalyticFieldReport'][_0xbaff('0x45')](_0x183b9c)[_0xbaff('0x21')](handleEntityNotFound(_0x2c24ef,null))[_0xbaff('0x21')](respondWithResult(_0x2c24ef,null))[_0xbaff('0x40')](handleError(_0x2c24ef,null));};exports[_0xbaff('0x46')]=function(_0x3fb500,_0x56d08d){return db[_0xbaff('0x29')][_0xbaff('0x46')](_0x3fb500[_0xbaff('0x47')],{})[_0xbaff('0x21')](respondWithResult(_0x56d08d,0xc9))[_0xbaff('0x40')](handleError(_0x56d08d,null));};exports[_0xbaff('0x48')]=function(_0x14c4ac,_0x52bacf){return db[_0xbaff('0x29')][_0xbaff('0x48')](_0x14c4ac[_0xbaff('0x47')],{'raw':![],'individualHooks':!![]})[_0xbaff('0x21')](respondWithResult(_0x52bacf,0xc9))['catch'](handleError(_0x52bacf,null));};exports[_0xbaff('0x20')]=function(_0x980c31,_0x93936c){if(_0x980c31[_0xbaff('0x47')]['id']){delete _0x980c31[_0xbaff('0x47')]['id'];}return db[_0xbaff('0x29')][_0xbaff('0x45')]({'where':{'id':_0x980c31[_0xbaff('0x41')]['id']}})[_0xbaff('0x21')](handleEntityNotFound(_0x93936c,null))['then'](saveUpdates(_0x980c31[_0xbaff('0x47')],null))[_0xbaff('0x21')](respondWithResult(_0x93936c,null))[_0xbaff('0x40')](handleError(_0x93936c,null));};exports[_0xbaff('0x22')]=function(_0x327c53,_0x54bd9f){return db[_0xbaff('0x29')][_0xbaff('0x45')]({'where':{'id':_0x327c53[_0xbaff('0x41')]['id']}})['then'](handleEntityNotFound(_0x54bd9f,null))[_0xbaff('0x21')](removeEntity(_0x54bd9f,null))[_0xbaff('0x40')](handleError(_0x54bd9f,null));};exports[_0xbaff('0x49')]=function(_0x660c88,_0x53b3e3){return db[_0xbaff('0x29')][_0xbaff('0x22')]({'where':{'id':_0x660c88[_0xbaff('0x30')][_0xbaff('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0xbaff('0x21')](respondWithResult(_0x53b3e3,0xcc))[_0xbaff('0x40')](handleError(_0x53b3e3,null));};exports['addFields']=function(_0x24ac62,_0x94618a,_0xbd3a69){return db['AnalyticCustomReport'][_0xbaff('0x4b')]({'where':{'id':_0x24ac62[_0xbaff('0x41')]['id']}})[_0xbaff('0x21')](handleEntityNotFound(_0x94618a,null))[_0xbaff('0x21')](function(_0x4542ba){if(_0x4542ba){return db['sequelize'][_0xbaff('0x4c')](function(_0x4c3771){return db[_0xbaff('0x29')]['destroy']({'where':{'CustomReportId':_0x24ac62[_0xbaff('0x41')]['id']},'transaction':_0x4c3771})[_0xbaff('0x21')](function(_0x14b8c7){var _0x40f159=_[_0xbaff('0x2f')](_0x24ac62[_0xbaff('0x47')],function(_0x197f48){delete _0x197f48['id'];_0x197f48[_0xbaff('0x4d')]=_0x24ac62[_0xbaff('0x41')]['id'];return _0x197f48;});return db[_0xbaff('0x29')][_0xbaff('0x48')](_0x40f159,{'transaction':_0x4c3771});});})[_0xbaff('0x21')](function(){return db['AnalyticFieldReport'][_0xbaff('0x4e')]({'where':{'CustomReportId':_0x24ac62[_0xbaff('0x41')]['id']}});});}})['then'](respondWithResult(_0x94618a,null))['catch'](handleError(_0x94618a,null));}; \ No newline at end of file +var _0x78b9=['moment','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','bulkCreate','bulkDestroy','ids','addFields','AnalyticCustomReport','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','request-promise'];(function(_0xab477c,_0x4ee058){var _0x466db2=function(_0x3b9522){while(--_0x3b9522){_0xab477c['push'](_0xab477c['shift']());}};_0x466db2(++_0x4ee058);}(_0x78b9,0x191));var _0x978b=function(_0x58df49,_0x109194){_0x58df49=_0x58df49-0x0;var _0x123dba=_0x78b9[_0x58df49];return _0x123dba;};'use strict';var emlformat=require(_0x978b('0x0'));var rimraf=require(_0x978b('0x1'));var zipdir=require(_0x978b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x978b('0x3'));var moment=require(_0x978b('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x978b('0x5'));var path=require(_0x978b('0x6'));var sox=require(_0x978b('0x7'));var csv=require(_0x978b('0x8'));var ejs=require(_0x978b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x978b('0xa'));var squel=require(_0x978b('0xb'));var crypto=require('crypto');var jsforce=require(_0x978b('0xc'));var deskjs=require(_0x978b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x978b('0xe'));var Papa=require(_0x978b('0xf'));var Redis=require(_0x978b('0x10'));var authService=require(_0x978b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x978b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x978b('0x13'));var config=require(_0x978b('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x137c02,_0x1c200b){_0x1c200b=_0x1c200b||0xcc;return function(_0x191a39){if(_0x191a39){return _0x137c02['sendStatus'](_0x1c200b);}return _0x137c02[_0x978b('0x15')](_0x1c200b)[_0x978b('0x16')]();};}function respondWithResult(_0x5f19dc,_0x2f6d8a){_0x2f6d8a=_0x2f6d8a||0xc8;return function(_0x2f5a7f){if(_0x2f5a7f){return _0x5f19dc[_0x978b('0x15')](_0x2f6d8a)['json'](_0x2f5a7f);}};}function respondWithFilteredResult(_0x4b0165,_0x1bc253){return function(_0x439dac){if(_0x439dac){var _0x1056f2=typeof _0x1bc253[_0x978b('0x17')]===_0x978b('0x18')&&typeof _0x1bc253[_0x978b('0x19')]===_0x978b('0x18');var _0x3103aa=_0x439dac[_0x978b('0x1a')];var _0xc66865=_0x1056f2?0x0:_0x1bc253[_0x978b('0x17')];var _0x5413de=_0x1056f2?_0x439dac[_0x978b('0x1a')]:_0x1bc253[_0x978b('0x17')]+_0x1bc253['limit'];var _0x56fdd1;if(_0x5413de>=_0x3103aa){_0x5413de=_0x3103aa;_0x56fdd1=0xc8;}else{_0x56fdd1=0xce;}_0x4b0165[_0x978b('0x15')](_0x56fdd1);return _0x4b0165['set'](_0x978b('0x1b'),_0xc66865+'-'+_0x5413de+'/'+_0x3103aa)[_0x978b('0x1c')](_0x439dac);}return null;};}function patchUpdates(_0x396538){return function(_0x1808a6){try{jsonpatch['apply'](_0x1808a6,_0x396538,!![]);}catch(_0x498a50){return BPromise[_0x978b('0x1d')](_0x498a50);}return _0x1808a6[_0x978b('0x1e')]();};}function saveUpdates(_0x9f4a97,_0x343ce3){return function(_0x66c66e){if(_0x66c66e){return _0x66c66e[_0x978b('0x1f')](_0x9f4a97)[_0x978b('0x20')](function(_0x100d01){return _0x100d01;});}return null;};}function removeEntity(_0x384cd1,_0x417ad7){return function(_0x9492c9){if(_0x9492c9){return _0x9492c9[_0x978b('0x21')]()[_0x978b('0x20')](function(){_0x384cd1[_0x978b('0x15')](0xcc)[_0x978b('0x16')]();});}};}function handleEntityNotFound(_0x11208e,_0x5b8d14){return function(_0x3ffebd){if(!_0x3ffebd){_0x11208e[_0x978b('0x22')](0x194);}return _0x3ffebd;};}function handleError(_0x331948,_0x22f2a5){_0x22f2a5=_0x22f2a5||0x1f4;return function(_0x1c07d5){logger[_0x978b('0x23')](_0x1c07d5[_0x978b('0x24')]);if(_0x1c07d5[_0x978b('0x25')]){delete _0x1c07d5['name'];}_0x331948[_0x978b('0x15')](_0x22f2a5)[_0x978b('0x26')](_0x1c07d5);};}exports[_0x978b('0x27')]=function(_0x508a81,_0x40fa30){var _0xb52846={},_0x24fefb={},_0x3aa5ae={'count':0x0,'rows':[]};var _0xc55a67=_[_0x978b('0x28')](db[_0x978b('0x29')][_0x978b('0x2a')],function(_0x233525){return{'name':_0x233525['fieldName'],'type':_0x233525['type'][_0x978b('0x2b')]};});_0x24fefb[_0x978b('0x2c')]=_[_0x978b('0x28')](_0xc55a67,_0x978b('0x25'));_0x24fefb[_0x978b('0x2d')]=_[_0x978b('0x2e')](_0x508a81['query']);_0x24fefb[_0x978b('0x2f')]=_[_0x978b('0x30')](_0x24fefb[_0x978b('0x2c')],_0x24fefb[_0x978b('0x2d')]);_0xb52846['attributes']=_['intersection'](_0x24fefb[_0x978b('0x2c')],qs['fields'](_0x508a81[_0x978b('0x2d')][_0x978b('0x31')]));_0xb52846[_0x978b('0x32')]=_0xb52846[_0x978b('0x32')][_0x978b('0x33')]?_0xb52846['attributes']:_0x24fefb['model'];if(!_0x508a81['query'][_0x978b('0x34')](_0x978b('0x35'))){_0xb52846['limit']=qs[_0x978b('0x19')](_0x508a81[_0x978b('0x2d')]['limit']);_0xb52846[_0x978b('0x17')]=qs[_0x978b('0x17')](_0x508a81[_0x978b('0x2d')][_0x978b('0x17')]);}_0xb52846[_0x978b('0x36')]=qs[_0x978b('0x37')](_0x508a81['query'][_0x978b('0x37')]);_0xb52846[_0x978b('0x38')]=qs[_0x978b('0x2f')](_[_0x978b('0x39')](_0x508a81[_0x978b('0x2d')],_0x24fefb[_0x978b('0x2f')]),_0xc55a67);if(_0x508a81[_0x978b('0x2d')][_0x978b('0x3a')]){_0xb52846['where']=_[_0x978b('0x3b')](_0xb52846['where'],{'$or':_[_0x978b('0x28')](_0xc55a67,function(_0x493d75){if(_0x493d75[_0x978b('0x3c')]!==_0x978b('0x3d')){var _0x32e06b={};_0x32e06b[_0x493d75['name']]={'$like':'%'+_0x508a81[_0x978b('0x2d')]['filter']+'%'};return _0x32e06b;}})});}_0xb52846=_['merge']({},_0xb52846,_0x508a81[_0x978b('0x3e')]);var _0x218737={'where':_0xb52846['where']};return db['AnalyticFieldReport'][_0x978b('0x1a')](_0x218737)[_0x978b('0x20')](function(_0x31b771){_0x3aa5ae['count']=_0x31b771;if(_0x508a81[_0x978b('0x2d')][_0x978b('0x3f')]){_0xb52846['include']=[{'all':!![]}];}return db[_0x978b('0x29')][_0x978b('0x40')](_0xb52846);})['then'](function(_0x5e2b1d){_0x3aa5ae[_0x978b('0x41')]=_0x5e2b1d;return _0x3aa5ae;})[_0x978b('0x20')](respondWithFilteredResult(_0x40fa30,_0xb52846))['catch'](handleError(_0x40fa30,null));};exports[_0x978b('0x42')]=function(_0x433ef2,_0x1e573e){var _0x559e88={'raw':![],'where':{'id':_0x433ef2[_0x978b('0x43')]['id']}},_0x24ff3d={};_0x24ff3d[_0x978b('0x2c')]=_[_0x978b('0x2e')](db[_0x978b('0x29')][_0x978b('0x2a')]);_0x24ff3d[_0x978b('0x2d')]=_[_0x978b('0x2e')](_0x433ef2[_0x978b('0x2d')]);_0x24ff3d[_0x978b('0x2f')]=_['intersection'](_0x24ff3d[_0x978b('0x2c')],_0x24ff3d['query']);_0x559e88[_0x978b('0x32')]=_['intersection'](_0x24ff3d[_0x978b('0x2c')],qs[_0x978b('0x31')](_0x433ef2[_0x978b('0x2d')][_0x978b('0x31')]));_0x559e88['attributes']=_0x559e88[_0x978b('0x32')][_0x978b('0x33')]?_0x559e88[_0x978b('0x32')]:_0x24ff3d[_0x978b('0x2c')];if(_0x433ef2['query']['includeAll']){_0x559e88[_0x978b('0x44')]=[{'all':!![]}];}_0x559e88=_[_0x978b('0x3b')]({},_0x559e88,_0x433ef2[_0x978b('0x3e')]);return db[_0x978b('0x29')][_0x978b('0x45')](_0x559e88)[_0x978b('0x20')](handleEntityNotFound(_0x1e573e,null))[_0x978b('0x20')](respondWithResult(_0x1e573e,null))[_0x978b('0x46')](handleError(_0x1e573e,null));};exports[_0x978b('0x47')]=function(_0x3fa71f,_0x35510e){return db[_0x978b('0x29')][_0x978b('0x47')](_0x3fa71f[_0x978b('0x48')],{})[_0x978b('0x20')](respondWithResult(_0x35510e,0xc9))['catch'](handleError(_0x35510e,null));};exports['bulkCreate']=function(_0x33f857,_0x272345){return db[_0x978b('0x29')][_0x978b('0x49')](_0x33f857[_0x978b('0x48')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x272345,0xc9))['catch'](handleError(_0x272345,null));};exports[_0x978b('0x1f')]=function(_0x26a165,_0x37a24d){if(_0x26a165[_0x978b('0x48')]['id']){delete _0x26a165['body']['id'];}return db[_0x978b('0x29')][_0x978b('0x45')]({'where':{'id':_0x26a165[_0x978b('0x43')]['id']}})[_0x978b('0x20')](handleEntityNotFound(_0x37a24d,null))[_0x978b('0x20')](saveUpdates(_0x26a165[_0x978b('0x48')],null))[_0x978b('0x20')](respondWithResult(_0x37a24d,null))['catch'](handleError(_0x37a24d,null));};exports['destroy']=function(_0x3b28c1,_0x1bc616){return db[_0x978b('0x29')][_0x978b('0x45')]({'where':{'id':_0x3b28c1[_0x978b('0x43')]['id']}})[_0x978b('0x20')](handleEntityNotFound(_0x1bc616,null))[_0x978b('0x20')](removeEntity(_0x1bc616,null))[_0x978b('0x46')](handleError(_0x1bc616,null));};exports[_0x978b('0x4a')]=function(_0x4c2d2d,_0x10578e){return db[_0x978b('0x29')][_0x978b('0x21')]({'where':{'id':_0x4c2d2d[_0x978b('0x2d')][_0x978b('0x4b')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x10578e,0xcc))['catch'](handleError(_0x10578e,null));};exports[_0x978b('0x4c')]=function(_0x292ecf,_0x1ec4c9,_0x356c40){return db[_0x978b('0x4d')]['findOne']({'where':{'id':_0x292ecf[_0x978b('0x43')]['id']}})[_0x978b('0x20')](handleEntityNotFound(_0x1ec4c9,null))[_0x978b('0x20')](function(_0x542ff4){if(_0x542ff4){return db[_0x978b('0x4e')][_0x978b('0x4f')](function(_0x3c1b50){return db[_0x978b('0x29')][_0x978b('0x21')]({'where':{'CustomReportId':_0x292ecf[_0x978b('0x43')]['id']},'transaction':_0x3c1b50})[_0x978b('0x20')](function(_0x558489){var _0xfd41be=_[_0x978b('0x28')](_0x292ecf[_0x978b('0x48')],function(_0x4037f4){delete _0x4037f4['id'];_0x4037f4[_0x978b('0x50')]=_0x292ecf[_0x978b('0x43')]['id'];return _0x4037f4;});return db[_0x978b('0x29')][_0x978b('0x49')](_0xfd41be,{'transaction':_0x3c1b50});});})['then'](function(){return db[_0x978b('0x29')]['findAll']({'where':{'CustomReportId':_0x292ecf['params']['id']}});});}})[_0x978b('0x20')](respondWithResult(_0x1ec4c9,null))[_0x978b('0x46')](handleError(_0x1ec4c9,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4e35902..3129142 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 _0xc9dc=['AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define'];(function(_0x3ec744,_0x340800){var _0x239fba=function(_0x256f79){while(--_0x256f79){_0x3ec744['push'](_0x3ec744['shift']());}};_0x239fba(++_0x340800);}(_0xc9dc,0xda));var _0xcc9d=function(_0x5e8ba5,_0x40e58d){_0x5e8ba5=_0x5e8ba5-0x0;var _0x420ab4=_0xc9dc[_0x5e8ba5];return _0x420ab4;};'use strict';var _=require(_0xcc9d('0x0'));var util=require(_0xcc9d('0x1'));var logger=require(_0xcc9d('0x2'))(_0xcc9d('0x3'));var moment=require(_0xcc9d('0x4'));var BPromise=require(_0xcc9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcc9d('0x6'));var rimraf=require('rimraf');var config=require(_0xcc9d('0x7'));var attributes=require('./analyticFieldReport.attributes');module[_0xcc9d('0x8')]=function(_0x480968,_0xbaf26b){return _0x480968[_0xcc9d('0x9')](_0xcc9d('0xa'),attributes,{'tableName':_0xcc9d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0a2=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xe0a2,0x155));var _0x2e0a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe0a2[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2e0a('0x0'));var util=require(_0x2e0a('0x1'));var logger=require(_0x2e0a('0x2'))('api');var moment=require(_0x2e0a('0x3'));var BPromise=require(_0x2e0a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2e0a('0x5'));var rimraf=require('rimraf');var config=require(_0x2e0a('0x6'));var attributes=require(_0x2e0a('0x7'));module[_0x2e0a('0x8')]=function(_0x32a4bd,_0xdded2a){return _0x32a4bd['define'](_0x2e0a('0x9'),attributes,{'tableName':_0x2e0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 7405631..8da4975 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 _0x25d5=['../../mysqldb','../../config/utils','../../config/logger','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x2921a8,_0x30e287){var _0xc8ff65=function(_0x469ac0){while(--_0x469ac0){_0x2921a8['push'](_0x2921a8['shift']());}};_0xc8ff65(++_0x30e287);}(_0x25d5,0x165));var _0x525d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x525d('0x0'));var moment=require('moment');var BPromise=require(_0x525d('0x1'));var rs=require(_0x525d('0x2'));var fs=require('fs');var Redis=require(_0x525d('0x3'));var db=require(_0x525d('0x4'))['db'];var utils=require(_0x525d('0x5'));var logger=require(_0x525d('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x525d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x17bb4d,_0x2bd3e4,_0x4021c7){return new BPromise(function(_0x56c076,_0x8210c3){return client[_0x525d('0x8')](_0x17bb4d,_0x4021c7)[_0x525d('0x9')](function(_0x439b18){logger[_0x525d('0xa')](_0x525d('0xb'),_0x2bd3e4,_0x525d('0xc'));logger['debug'](_0x525d('0xd'),_0x2bd3e4,_0x525d('0xc'),JSON[_0x525d('0xe')](_0x439b18));if(_0x439b18[_0x525d('0xf')]){if(_0x439b18['error']['code']===0x1f4){logger[_0x525d('0xf')](_0x525d('0xb'),_0x2bd3e4,_0x439b18['error'][_0x525d('0x10')]);return _0x8210c3(_0x439b18[_0x525d('0xf')][_0x525d('0x10')]);}logger[_0x525d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2bd3e4,_0x439b18[_0x525d('0xf')][_0x525d('0x10')]);return _0x56c076(_0x439b18[_0x525d('0xf')][_0x525d('0x10')]);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2bd3e4,_0x525d('0xc'));_0x56c076(_0x439b18[_0x525d('0x11')][_0x525d('0x10')]);}})[_0x525d('0x12')](function(_0x3844f3){logger[_0x525d('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2bd3e4,_0x3844f3);_0x8210c3(_0x3844f3);});});} \ No newline at end of file +var _0xe402=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x42aff9,_0xe4fd11){var _0xa54edd=function(_0x2d3190){while(--_0x2d3190){_0x42aff9['push'](_0x42aff9['shift']());}};_0xa54edd(++_0xe4fd11);}(_0xe402,0x1c5));var _0x2e40=function(_0x2aecf8,_0x22eef6){_0x2aecf8=_0x2aecf8-0x0;var _0x36b77=_0xe402[_0x2aecf8];return _0x36b77;};'use strict';var _=require(_0x2e40('0x0'));var util=require(_0x2e40('0x1'));var moment=require(_0x2e40('0x2'));var BPromise=require(_0x2e40('0x3'));var rs=require(_0x2e40('0x4'));var fs=require('fs');var Redis=require(_0x2e40('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e40('0x6'));var logger=require(_0x2e40('0x7'))('rpc');var config=require(_0x2e40('0x8'));var jayson=require(_0x2e40('0x9'));var client=jayson['client'][_0x2e40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415f63,_0x2345b1,_0x35ce24){return new BPromise(function(_0x59680a,_0x4f745f){return client[_0x2e40('0xb')](_0x415f63,_0x35ce24)[_0x2e40('0xc')](function(_0x1a4a68){logger[_0x2e40('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2345b1,_0x2e40('0xe'));logger[_0x2e40('0xf')](_0x2e40('0x10'),_0x2345b1,_0x2e40('0xe'),JSON[_0x2e40('0x11')](_0x1a4a68));if(_0x1a4a68[_0x2e40('0x12')]){if(_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x13')]===0x1f4){logger['error'](_0x2e40('0x14'),_0x2345b1,_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x15')]);return _0x4f745f(_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x15')]);}logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2345b1,_0x1a4a68[_0x2e40('0x12')][_0x2e40('0x15')]);return _0x59680a(_0x1a4a68[_0x2e40('0x12')]['message']);}else{logger[_0x2e40('0xd')](_0x2e40('0x14'),_0x2345b1,_0x2e40('0xe'));_0x59680a(_0x1a4a68[_0x2e40('0x16')][_0x2e40('0x15')]);}})[_0x2e40('0x17')](function(_0x16f983){logger[_0x2e40('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2345b1,_0x16f983);_0x4f745f(_0x16f983);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 2b2907f..799779c 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(_0x3c9010,_0x970251){var _0x373e8a=function(_0x3a8a9e){while(--_0x3a8a9e){_0x3c9010['push'](_0x3c9010['shift']());}};_0x373e8a(++_0x970251);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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(_0x5dcfe2,_0x397a20){var _0x373e3a=function(_0x54e6d7){while(--_0x54e6d7){_0x5dcfe2['push'](_0x5dcfe2['shift']());}};_0x373e3a(++_0x397a20);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 c8b6b78..ff25487 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 _0x0c1a=['exports','STRING','TEXT','sequelize'];(function(_0x18412f,_0x441675){var _0x130b9d=function(_0x4a3aff){while(--_0x4a3aff){_0x18412f['push'](_0x18412f['shift']());}};_0x130b9d(++_0x441675);}(_0x0c1a,0x127));var _0xa0c1=function(_0xb496cf,_0x45e1fa){_0xb496cf=_0xb496cf-0x0;var _0x769aac=_0x0c1a[_0xb496cf];return _0x769aac;};'use strict';var Sequelize=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]={'name':{'type':Sequelize[_0xa0c1('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0xa0c1('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9a1b=['TEXT','sequelize','STRING'];(function(_0x1bef23,_0x331853){var _0x2c0295=function(_0x1613eb){while(--_0x1613eb){_0x1bef23['push'](_0x1bef23['shift']());}};_0x2c0295(++_0x331853);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x293181,_0x1f01ae){_0x293181=_0x293181-0x0;var _0x20680b=_0x9a1b[_0x293181];return _0x20680b;};'use strict';var Sequelize=require(_0xb9a1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0xb9a1('0x1')]},'metric':{'type':Sequelize[_0xb9a1('0x2')]},'description':{'type':Sequelize[_0xb9a1('0x1')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 7d53070..abbbc49 100644 --- a/server/api/analyticMetric/analyticMetric.controller.js +++ b/server/api/analyticMetric/analyticMetric.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84ab=['UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Metrics','UserProfileResource','error','stack','name','map','AnalyticMetric','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','type','VIRTUAL','includeAll','include','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x84ab,0x12f));var _0xb84a=function(_0x77d310,_0x2b2fe7){_0x77d310=_0x77d310-0x0;var _0x2cdce4=_0x84ab[_0x77d310];return _0x2cdce4;};'use strict';var emlformat=require(_0xb84a('0x0'));var rimraf=require(_0xb84a('0x1'));var zipdir=require(_0xb84a('0x2'));var jsonpatch=require(_0xb84a('0x3'));var rp=require(_0xb84a('0x4'));var moment=require('moment');var BPromise=require(_0xb84a('0x5'));var Mustache=require(_0xb84a('0x6'));var util=require('util');var path=require(_0xb84a('0x7'));var sox=require(_0xb84a('0x8'));var csv=require(_0xb84a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb84a('0xa'));var crypto=require('crypto');var jsforce=require(_0xb84a('0xb'));var deskjs=require(_0xb84a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb84a('0xd'));var Papa=require('papaparse');var Redis=require(_0xb84a('0xe'));var authService=require(_0xb84a('0xf'));var qs=require(_0xb84a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb84a('0x11'));var utils=require(_0xb84a('0x12'));var config=require(_0xb84a('0x13'));var licenseUtil=require(_0xb84a('0x14'));var db=require(_0xb84a('0x15'))['db'];function respondWithStatusCode(_0x4d3758,_0x83444e){_0x83444e=_0x83444e||0xcc;return function(_0x4777dc){if(_0x4777dc){return _0x4d3758[_0xb84a('0x16')](_0x83444e);}return _0x4d3758[_0xb84a('0x17')](_0x83444e)[_0xb84a('0x18')]();};}function respondWithResult(_0x11dfe9,_0x12ccab){_0x12ccab=_0x12ccab||0xc8;return function(_0x475b){if(_0x475b){return _0x11dfe9[_0xb84a('0x17')](_0x12ccab)[_0xb84a('0x19')](_0x475b);}};}function respondWithFilteredResult(_0xc0b2e0,_0x1251ec){return function(_0x5716bd){if(_0x5716bd){var _0x11dd4d=typeof _0x1251ec[_0xb84a('0x1a')]===_0xb84a('0x1b')&&typeof _0x1251ec[_0xb84a('0x1c')]===_0xb84a('0x1b');var _0x1be87a=_0x5716bd[_0xb84a('0x1d')];var _0x34d82f=_0x11dd4d?0x0:_0x1251ec[_0xb84a('0x1a')];var _0x3f7437=_0x11dd4d?_0x5716bd[_0xb84a('0x1d')]:_0x1251ec[_0xb84a('0x1a')]+_0x1251ec[_0xb84a('0x1c')];var _0x200289;if(_0x3f7437>=_0x1be87a){_0x3f7437=_0x1be87a;_0x200289=0xc8;}else{_0x200289=0xce;}_0xc0b2e0['status'](_0x200289);return _0xc0b2e0[_0xb84a('0x1e')](_0xb84a('0x1f'),_0x34d82f+'-'+_0x3f7437+'/'+_0x1be87a)['json'](_0x5716bd);}return null;};}function patchUpdates(_0xac76d3){return function(_0x61ef03){try{jsonpatch[_0xb84a('0x20')](_0x61ef03,_0xac76d3,!![]);}catch(_0x19f637){return BPromise['reject'](_0x19f637);}return _0x61ef03['save']();};}function saveUpdates(_0x1466ae,_0x19097d){return function(_0x2d70fd){if(_0x2d70fd){return _0x2d70fd[_0xb84a('0x21')](_0x1466ae)[_0xb84a('0x22')](function(_0x3b8fb2){return _0x3b8fb2;});}return null;};}function removeEntity(_0x8b28cd,_0x21d0d3){return function(_0x3aa06f){if(_0x3aa06f){return _0x3aa06f[_0xb84a('0x23')]()[_0xb84a('0x22')](function(){var _0x1aab7d=_0x3aa06f[_0xb84a('0x24')]({'plain':!![]});var _0x409df0=_0xb84a('0x25');return db[_0xb84a('0x26')][_0xb84a('0x23')]({'where':{'type':_0x409df0,'resourceId':_0x1aab7d['id']}})[_0xb84a('0x22')](function(){return _0x3aa06f;});})[_0xb84a('0x22')](function(){_0x8b28cd[_0xb84a('0x17')](0xcc)[_0xb84a('0x18')]();});}};}function handleEntityNotFound(_0x1db72c,_0x2fe40d){return function(_0x35d1f7){if(!_0x35d1f7){_0x1db72c[_0xb84a('0x16')](0x194);}return _0x35d1f7;};}function handleError(_0x97d71b,_0x5349ea){_0x5349ea=_0x5349ea||0x1f4;return function(_0x582954){logger[_0xb84a('0x27')](_0x582954[_0xb84a('0x28')]);if(_0x582954['name']){delete _0x582954[_0xb84a('0x29')];}_0x97d71b[_0xb84a('0x17')](_0x5349ea)['send'](_0x582954);};}exports['index']=function(_0x28f2e7,_0x8e9319){var _0x49ba3d={},_0x251778={},_0xba1147={'count':0x0,'rows':[]};var _0x3abc22=_[_0xb84a('0x2a')](db[_0xb84a('0x2b')][_0xb84a('0x2c')],function(_0x34b212){return{'name':_0x34b212[_0xb84a('0x2d')],'type':_0x34b212['type'][_0xb84a('0x2e')]};});_0x251778['model']=_['map'](_0x3abc22,_0xb84a('0x29'));_0x251778[_0xb84a('0x2f')]=_['keys'](_0x28f2e7['query']);_0x251778[_0xb84a('0x30')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],_0x251778[_0xb84a('0x2f')]);_0x49ba3d[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x251778[_0xb84a('0x32')],qs[_0xb84a('0x34')](_0x28f2e7['query'][_0xb84a('0x34')]));_0x49ba3d[_0xb84a('0x33')]=_0x49ba3d[_0xb84a('0x33')][_0xb84a('0x35')]?_0x49ba3d[_0xb84a('0x33')]:_0x251778[_0xb84a('0x32')];if(!_0x28f2e7[_0xb84a('0x2f')]['hasOwnProperty'](_0xb84a('0x36'))){_0x49ba3d['limit']=qs[_0xb84a('0x1c')](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1c')]);_0x49ba3d['offset']=qs['offset'](_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x1a')]);}_0x49ba3d[_0xb84a('0x37')]=qs[_0xb84a('0x38')](_0x28f2e7[_0xb84a('0x2f')]['sort']);_0x49ba3d[_0xb84a('0x39')]=qs[_0xb84a('0x30')](_['pick'](_0x28f2e7[_0xb84a('0x2f')],_0x251778[_0xb84a('0x30')]),_0x3abc22);if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3a')]){_0x49ba3d['where']=_['merge'](_0x49ba3d['where'],{'$or':_[_0xb84a('0x2a')](_0x3abc22,function(_0x11e1ac){if(_0x11e1ac[_0xb84a('0x3b')]!==_0xb84a('0x3c')){var _0x55b0b8={};_0x55b0b8[_0x11e1ac[_0xb84a('0x29')]]={'$like':'%'+_0x28f2e7['query'][_0xb84a('0x3a')]+'%'};return _0x55b0b8;}})});}_0x49ba3d=_['merge']({},_0x49ba3d,_0x28f2e7['options']);var _0x59d7a1={'where':_0x49ba3d[_0xb84a('0x39')]};return db[_0xb84a('0x2b')][_0xb84a('0x1d')](_0x59d7a1)[_0xb84a('0x22')](function(_0x5e547e){_0xba1147[_0xb84a('0x1d')]=_0x5e547e;if(_0x28f2e7[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x49ba3d[_0xb84a('0x3e')]=[{'all':!![]}];}return db['AnalyticMetric']['findAll'](_0x49ba3d);})[_0xb84a('0x22')](function(_0x1f3e04){_0xba1147['rows']=_0x1f3e04;return _0xba1147;})[_0xb84a('0x22')](respondWithFilteredResult(_0x8e9319,_0x49ba3d))[_0xb84a('0x3f')](handleError(_0x8e9319,null));};exports[_0xb84a('0x40')]=function(_0x25280a,_0x3f005b){var _0x241536={'raw':!![],'where':{'id':_0x25280a[_0xb84a('0x41')]['id']}},_0x24d700={};_0x24d700[_0xb84a('0x32')]=_[_0xb84a('0x42')](db[_0xb84a('0x2b')][_0xb84a('0x2c')]);_0x24d700[_0xb84a('0x2f')]=_[_0xb84a('0x42')](_0x25280a[_0xb84a('0x2f')]);_0x24d700['filters']=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],_0x24d700[_0xb84a('0x2f')]);_0x241536[_0xb84a('0x33')]=_[_0xb84a('0x31')](_0x24d700[_0xb84a('0x32')],qs['fields'](_0x25280a[_0xb84a('0x2f')]['fields']));_0x241536[_0xb84a('0x33')]=_0x241536[_0xb84a('0x33')][_0xb84a('0x35')]?_0x241536[_0xb84a('0x33')]:_0x24d700['model'];if(_0x25280a[_0xb84a('0x2f')][_0xb84a('0x3d')]){_0x241536[_0xb84a('0x3e')]=[{'all':!![]}];}_0x241536=_['merge']({},_0x241536,_0x25280a['options']);return db[_0xb84a('0x2b')][_0xb84a('0x43')](_0x241536)[_0xb84a('0x22')](handleEntityNotFound(_0x3f005b,null))['then'](respondWithResult(_0x3f005b,null))['catch'](handleError(_0x3f005b,null));};exports['create']=function(_0x45630d,_0x384a0d){return db[_0xb84a('0x2b')][_0xb84a('0x44')](_0x45630d[_0xb84a('0x45')],{})['then'](function(_0x4b40fe){var _0x5b853a=_0x45630d['user'][_0xb84a('0x24')]({'plain':!![]});if(!_0x5b853a)throw new Error(_0xb84a('0x46'));if(_0x5b853a['role']===_0xb84a('0x47')){var _0xc8bac2=_0x4b40fe[_0xb84a('0x24')]({'plain':!![]});var _0x2f70f0=_0xb84a('0x25');return db[_0xb84a('0x48')]['find']({'where':{'name':_0x2f70f0,'userProfileId':_0x5b853a['userProfileId']},'raw':!![]})[_0xb84a('0x22')](function(_0x50172a){if(_0x50172a&&_0x50172a[_0xb84a('0x49')]===0x0){return db['UserProfileResource']['create']({'name':_0xc8bac2['name'],'resourceId':_0xc8bac2['id'],'type':_0x50172a[_0xb84a('0x29')],'sectionId':_0x50172a['id']},{})[_0xb84a('0x22')](function(){return _0x4b40fe;});}else{return _0x4b40fe;}})[_0xb84a('0x3f')](function(_0x25b6a0){logger[_0xb84a('0x27')](_0xb84a('0x4a'),_0x25b6a0);throw _0x25b6a0;});}return _0x4b40fe;})[_0xb84a('0x22')](respondWithResult(_0x384a0d,0xc9))[_0xb84a('0x3f')](handleError(_0x384a0d,null));};exports['update']=function(_0x5afdd0,_0x4c5bdf){if(_0x5afdd0[_0xb84a('0x45')]['id']){delete _0x5afdd0[_0xb84a('0x45')]['id'];}return db['AnalyticMetric'][_0xb84a('0x43')]({'where':{'id':_0x5afdd0['params']['id']}})['then'](handleEntityNotFound(_0x4c5bdf,null))['then'](saveUpdates(_0x5afdd0[_0xb84a('0x45')],null))[_0xb84a('0x22')](respondWithResult(_0x4c5bdf,null))[_0xb84a('0x3f')](handleError(_0x4c5bdf,null));};exports['destroy']=function(_0x5f757e,_0x2e98bf){return db[_0xb84a('0x2b')]['find']({'where':{'id':_0x5f757e[_0xb84a('0x41')]['id']}})['then'](handleEntityNotFound(_0x2e98bf,null))['then'](removeEntity(_0x2e98bf,null))[_0xb84a('0x3f')](handleError(_0x2e98bf,null));}; \ No newline at end of file +var _0x9c5a=['update','then','get','Metrics','UserProfileResource','destroy','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','length','include','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','save'];(function(_0x20c993,_0xca841c){var _0x3fc1e2=function(_0x1e134f){while(--_0x1e134f){_0x20c993['push'](_0x20c993['shift']());}};_0x3fc1e2(++_0xca841c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xe445b3,_0x26ae0c){_0xe445b3=_0xe445b3-0x0;var _0x266a98=_0x9c5a[_0xe445b3];return _0x266a98;};'use strict';var emlformat=require(_0xa9c5('0x0'));var rimraf=require(_0xa9c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa9c5('0x2'));var rp=require(_0xa9c5('0x3'));var moment=require(_0xa9c5('0x4'));var BPromise=require(_0xa9c5('0x5'));var Mustache=require('mustache');var util=require(_0xa9c5('0x6'));var path=require(_0xa9c5('0x7'));var sox=require('sox');var csv=require(_0xa9c5('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa9c5('0x9'));var _=require(_0xa9c5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa9c5('0xb'));var deskjs=require(_0xa9c5('0xc'));var toCsv=require('to-csv');var querystring=require(_0xa9c5('0xd'));var Papa=require(_0xa9c5('0xe'));var Redis=require('ioredis');var authService=require(_0xa9c5('0xf'));var qs=require(_0xa9c5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa9c5('0x11'))(_0xa9c5('0x12'));var utils=require(_0xa9c5('0x13'));var config=require(_0xa9c5('0x14'));var licenseUtil=require(_0xa9c5('0x15'));var db=require(_0xa9c5('0x16'))['db'];function respondWithStatusCode(_0x51c8d,_0x42d5cf){_0x42d5cf=_0x42d5cf||0xcc;return function(_0x3c5ac7){if(_0x3c5ac7){return _0x51c8d[_0xa9c5('0x17')](_0x42d5cf);}return _0x51c8d['status'](_0x42d5cf)[_0xa9c5('0x18')]();};}function respondWithResult(_0x1276d2,_0x7df76d){_0x7df76d=_0x7df76d||0xc8;return function(_0x3806c4){if(_0x3806c4){return _0x1276d2[_0xa9c5('0x19')](_0x7df76d)[_0xa9c5('0x1a')](_0x3806c4);}};}function respondWithFilteredResult(_0x251099,_0x40b001){return function(_0x19a43e){if(_0x19a43e){var _0xcf13f2=typeof _0x40b001['offset']===_0xa9c5('0x1b')&&typeof _0x40b001[_0xa9c5('0x1c')]===_0xa9c5('0x1b');var _0x55cce5=_0x19a43e[_0xa9c5('0x1d')];var _0x1142d9=_0xcf13f2?0x0:_0x40b001[_0xa9c5('0x1e')];var _0x3b8cf7=_0xcf13f2?_0x19a43e[_0xa9c5('0x1d')]:_0x40b001[_0xa9c5('0x1e')]+_0x40b001[_0xa9c5('0x1c')];var _0x1e5ce6;if(_0x3b8cf7>=_0x55cce5){_0x3b8cf7=_0x55cce5;_0x1e5ce6=0xc8;}else{_0x1e5ce6=0xce;}_0x251099[_0xa9c5('0x19')](_0x1e5ce6);return _0x251099[_0xa9c5('0x1f')](_0xa9c5('0x20'),_0x1142d9+'-'+_0x3b8cf7+'/'+_0x55cce5)[_0xa9c5('0x1a')](_0x19a43e);}return null;};}function patchUpdates(_0x54f8b9){return function(_0x1115ad){try{jsonpatch[_0xa9c5('0x21')](_0x1115ad,_0x54f8b9,!![]);}catch(_0x541c77){return BPromise['reject'](_0x541c77);}return _0x1115ad[_0xa9c5('0x22')]();};}function saveUpdates(_0x366f5c,_0x10b208){return function(_0x3b497a){if(_0x3b497a){return _0x3b497a[_0xa9c5('0x23')](_0x366f5c)[_0xa9c5('0x24')](function(_0x48e2cb){return _0x48e2cb;});}return null;};}function removeEntity(_0x4fa280,_0x3d4e1b){return function(_0x11d395){if(_0x11d395){return _0x11d395['destroy']()[_0xa9c5('0x24')](function(){var _0x424b4c=_0x11d395[_0xa9c5('0x25')]({'plain':!![]});var _0x32fc7d=_0xa9c5('0x26');return db[_0xa9c5('0x27')][_0xa9c5('0x28')]({'where':{'type':_0x32fc7d,'resourceId':_0x424b4c['id']}})['then'](function(){return _0x11d395;});})['then'](function(){_0x4fa280[_0xa9c5('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1762ac,_0x830bad){return function(_0x4caefa){if(!_0x4caefa){_0x1762ac[_0xa9c5('0x17')](0x194);}return _0x4caefa;};}function handleError(_0x320dc0,_0x5f468b){_0x5f468b=_0x5f468b||0x1f4;return function(_0x413edf){logger[_0xa9c5('0x29')](_0x413edf[_0xa9c5('0x2a')]);if(_0x413edf[_0xa9c5('0x2b')]){delete _0x413edf[_0xa9c5('0x2b')];}_0x320dc0['status'](_0x5f468b)[_0xa9c5('0x2c')](_0x413edf);};}exports['index']=function(_0x3c3da7,_0x1ef388){var _0x2eeed1={},_0x541475={},_0xc6d0c1={'count':0x0,'rows':[]};var _0xbe29c5=_['map'](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')],function(_0x431e07){return{'name':_0x431e07[_0xa9c5('0x2f')],'type':_0x431e07[_0xa9c5('0x30')][_0xa9c5('0x31')]};});_0x541475[_0xa9c5('0x32')]=_['map'](_0xbe29c5,_0xa9c5('0x2b'));_0x541475[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0x3c3da7[_0xa9c5('0x33')]);_0x541475[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0x541475[_0xa9c5('0x32')],_0x541475[_0xa9c5('0x33')]);_0x2eeed1['attributes']=_['intersection'](_0x541475[_0xa9c5('0x32')],qs[_0xa9c5('0x37')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x2eeed1[_0xa9c5('0x38')]=_0x2eeed1[_0xa9c5('0x38')]['length']?_0x2eeed1['attributes']:_0x541475['model'];if(!_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x39')]('nolimit')){_0x2eeed1[_0xa9c5('0x1c')]=qs['limit'](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x1c')]);_0x2eeed1[_0xa9c5('0x1e')]=qs[_0xa9c5('0x1e')](_0x3c3da7['query'][_0xa9c5('0x1e')]);}_0x2eeed1[_0xa9c5('0x3a')]=qs[_0xa9c5('0x3b')](_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3b')]);_0x2eeed1[_0xa9c5('0x3c')]=qs[_0xa9c5('0x35')](_[_0xa9c5('0x3d')](_0x3c3da7['query'],_0x541475[_0xa9c5('0x35')]),_0xbe29c5);if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]){_0x2eeed1[_0xa9c5('0x3c')]=_[_0xa9c5('0x3f')](_0x2eeed1[_0xa9c5('0x3c')],{'$or':_['map'](_0xbe29c5,function(_0x307736){if(_0x307736['type']!==_0xa9c5('0x40')){var _0x5c89e7={};_0x5c89e7[_0x307736[_0xa9c5('0x2b')]]={'$like':'%'+_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x3e')]+'%'};return _0x5c89e7;}})});}_0x2eeed1=_['merge']({},_0x2eeed1,_0x3c3da7[_0xa9c5('0x41')]);var _0x1ddd72={'where':_0x2eeed1[_0xa9c5('0x3c')]};return db[_0xa9c5('0x2d')]['count'](_0x1ddd72)[_0xa9c5('0x24')](function(_0x97803f){_0xc6d0c1[_0xa9c5('0x1d')]=_0x97803f;if(_0x3c3da7[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x2eeed1['include']=[{'all':!![]}];}return db[_0xa9c5('0x2d')]['findAll'](_0x2eeed1);})[_0xa9c5('0x24')](function(_0x397614){_0xc6d0c1[_0xa9c5('0x43')]=_0x397614;return _0xc6d0c1;})[_0xa9c5('0x24')](respondWithFilteredResult(_0x1ef388,_0x2eeed1))[_0xa9c5('0x44')](handleError(_0x1ef388,null));};exports[_0xa9c5('0x45')]=function(_0xf35cb3,_0x3e8633){var _0x1f895a={'raw':!![],'where':{'id':_0xf35cb3['params']['id']}},_0xc28b1a={};_0xc28b1a[_0xa9c5('0x32')]=_[_0xa9c5('0x34')](db[_0xa9c5('0x2d')][_0xa9c5('0x2e')]);_0xc28b1a[_0xa9c5('0x33')]=_[_0xa9c5('0x34')](_0xf35cb3['query']);_0xc28b1a[_0xa9c5('0x35')]=_[_0xa9c5('0x36')](_0xc28b1a['model'],_0xc28b1a['query']);_0x1f895a['attributes']=_['intersection'](_0xc28b1a['model'],qs[_0xa9c5('0x37')](_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x37')]));_0x1f895a[_0xa9c5('0x38')]=_0x1f895a[_0xa9c5('0x38')][_0xa9c5('0x46')]?_0x1f895a[_0xa9c5('0x38')]:_0xc28b1a[_0xa9c5('0x32')];if(_0xf35cb3[_0xa9c5('0x33')][_0xa9c5('0x42')]){_0x1f895a[_0xa9c5('0x47')]=[{'all':!![]}];}_0x1f895a=_[_0xa9c5('0x3f')]({},_0x1f895a,_0xf35cb3[_0xa9c5('0x41')]);return db['AnalyticMetric'][_0xa9c5('0x48')](_0x1f895a)['then'](handleEntityNotFound(_0x3e8633,null))[_0xa9c5('0x24')](respondWithResult(_0x3e8633,null))[_0xa9c5('0x44')](handleError(_0x3e8633,null));};exports['create']=function(_0x5cbd33,_0xf00970){return db[_0xa9c5('0x2d')][_0xa9c5('0x49')](_0x5cbd33['body'],{})['then'](function(_0x2333c4){var _0xd03cec=_0x5cbd33['user'][_0xa9c5('0x25')]({'plain':!![]});if(!_0xd03cec)throw new Error(_0xa9c5('0x4a'));if(_0xd03cec[_0xa9c5('0x4b')]===_0xa9c5('0x4c')){var _0x34020f=_0x2333c4[_0xa9c5('0x25')]({'plain':!![]});var _0x4b6fc9='Metrics';return db['UserProfileSection'][_0xa9c5('0x48')]({'where':{'name':_0x4b6fc9,'userProfileId':_0xd03cec[_0xa9c5('0x4d')]},'raw':!![]})[_0xa9c5('0x24')](function(_0xef4d2){if(_0xef4d2&&_0xef4d2[_0xa9c5('0x4e')]===0x0){return db[_0xa9c5('0x27')]['create']({'name':_0x34020f[_0xa9c5('0x2b')],'resourceId':_0x34020f['id'],'type':_0xef4d2[_0xa9c5('0x2b')],'sectionId':_0xef4d2['id']},{})[_0xa9c5('0x24')](function(){return _0x2333c4;});}else{return _0x2333c4;}})[_0xa9c5('0x44')](function(_0xa0b458){logger[_0xa9c5('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa0b458);throw _0xa0b458;});}return _0x2333c4;})['then'](respondWithResult(_0xf00970,0xc9))[_0xa9c5('0x44')](handleError(_0xf00970,null));};exports['update']=function(_0x1b158f,_0x5ea9b0){if(_0x1b158f[_0xa9c5('0x4f')]['id']){delete _0x1b158f[_0xa9c5('0x4f')]['id'];}return db[_0xa9c5('0x2d')]['find']({'where':{'id':_0x1b158f[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x5ea9b0,null))[_0xa9c5('0x24')](saveUpdates(_0x1b158f[_0xa9c5('0x4f')],null))['then'](respondWithResult(_0x5ea9b0,null))['catch'](handleError(_0x5ea9b0,null));};exports[_0xa9c5('0x28')]=function(_0x2b66ee,_0x3205f2){return db['AnalyticMetric'][_0xa9c5('0x48')]({'where':{'id':_0x2b66ee[_0xa9c5('0x50')]['id']}})[_0xa9c5('0x24')](handleEntityNotFound(_0x3205f2,null))[_0xa9c5('0x24')](removeEntity(_0x3205f2,null))[_0xa9c5('0x44')](handleError(_0x3205f2,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index fe0680c..391a13a 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 _0xae30=['../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xc153db,_0x516c10){var _0x4dc97d=function(_0x10fc05){while(--_0x10fc05){_0xc153db['push'](_0xc153db['shift']());}};_0x4dc97d(++_0x516c10);}(_0xae30,0x10a));var _0x0ae3=function(_0x40c9bc,_0x6eb340){_0x40c9bc=_0x40c9bc-0x0;var _0x3acedf=_0xae30[_0x40c9bc];return _0x3acedf;};'use strict';var _=require(_0x0ae3('0x0'));var util=require(_0x0ae3('0x1'));var logger=require(_0x0ae3('0x2'))('api');var moment=require(_0x0ae3('0x3'));var BPromise=require(_0x0ae3('0x4'));var rp=require(_0x0ae3('0x5'));var fs=require('fs');var path=require(_0x0ae3('0x6'));var rimraf=require('rimraf');var config=require(_0x0ae3('0x7'));var attributes=require(_0x0ae3('0x8'));module[_0x0ae3('0x9')]=function(_0x7ce33e,_0x2b8c53){return _0x7ce33e[_0x0ae3('0xa')](_0x0ae3('0xb'),attributes,{'tableName':_0x0ae3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22da=['moment','bluebird','path','rimraf','../../config/environment','./analyticMetric.attributes','AnalyticMetric','analytics_metrics','../../config/logger','api'];(function(_0x2266e6,_0x1c781f){var _0x346c55=function(_0x43bc56){while(--_0x43bc56){_0x2266e6['push'](_0x2266e6['shift']());}};_0x346c55(++_0x1c781f);}(_0x22da,0x80));var _0xa22d=function(_0x247aa1,_0x33fd7b){_0x247aa1=_0x247aa1-0x0;var _0x433190=_0x22da[_0x247aa1];return _0x433190;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa22d('0x0'))(_0xa22d('0x1'));var moment=require(_0xa22d('0x2'));var BPromise=require(_0xa22d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa22d('0x4'));var rimraf=require(_0xa22d('0x5'));var config=require(_0xa22d('0x6'));var attributes=require(_0xa22d('0x7'));module['exports']=function(_0x4007bd,_0x9bc0eb){return _0x4007bd['define'](_0xa22d('0x8'),attributes,{'tableName':_0xa22d('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 e3d0de5..530dead 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 _0x0849=['error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','AnalyticMetric,\x20%s,\x20%s','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x0849,0x1bc));var _0x9084=function(_0xf090bb,_0x4b4d9f){_0xf090bb=_0xf090bb-0x0;var _0x4a57f5=_0x0849[_0xf090bb];return _0x4a57f5;};'use strict';var _=require('lodash');var util=require(_0x9084('0x0'));var moment=require('moment');var BPromise=require(_0x9084('0x1'));var rs=require(_0x9084('0x2'));var fs=require('fs');var Redis=require(_0x9084('0x3'));var db=require(_0x9084('0x4'))['db'];var utils=require(_0x9084('0x5'));var logger=require(_0x9084('0x6'))(_0x9084('0x7'));var config=require('../../config/environment');var jayson=require(_0x9084('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x42c3c2,_0x5f1321,_0x1e506d){return new BPromise(function(_0x179906,_0x461599){return client[_0x9084('0x9')](_0x42c3c2,_0x1e506d)[_0x9084('0xa')](function(_0x35753a){logger[_0x9084('0xb')](_0x9084('0xc'),_0x5f1321,'request\x20sent');logger[_0x9084('0xd')](_0x9084('0xe'),_0x5f1321,_0x9084('0xf'),JSON[_0x9084('0x10')](_0x35753a));if(_0x35753a['error']){if(_0x35753a['error'][_0x9084('0x11')]===0x1f4){logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);return _0x461599(_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);}logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);return _0x179906(_0x35753a[_0x9084('0x12')][_0x9084('0x13')]);}else{logger[_0x9084('0xb')](_0x9084('0xc'),_0x5f1321,_0x9084('0xf'));_0x179906(_0x35753a[_0x9084('0x14')][_0x9084('0x13')]);}})['catch'](function(_0x3e2c10){logger[_0x9084('0x12')](_0x9084('0xc'),_0x5f1321,_0x3e2c10);_0x461599(_0x3e2c10);});});} \ No newline at end of file +var _0xa30d=['debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x3f404d,_0x4210a8){var _0x3a267d=function(_0x8a6881){while(--_0x8a6881){_0x3f404d['push'](_0x3f404d['shift']());}};_0x3a267d(++_0x4210a8);}(_0xa30d,0x115));var _0xda30=function(_0x447db1,_0x11030d){_0x447db1=_0x447db1-0x0;var _0x4269d5=_0xa30d[_0x447db1];return _0x4269d5;};'use strict';var _=require(_0xda30('0x0'));var util=require(_0xda30('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xda30('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xda30('0x3'));var config=require(_0xda30('0x4'));var jayson=require(_0xda30('0x5'));var client=jayson[_0xda30('0x6')][_0xda30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xe150d7,_0x45a108,_0x54f520){return new BPromise(function(_0x4533d0,_0x269d31){return client['request'](_0xe150d7,_0x54f520)['then'](function(_0x33644a){logger[_0xda30('0x8')](_0xda30('0x9'),_0x45a108,_0xda30('0xa'));logger[_0xda30('0xb')](_0xda30('0xc'),_0x45a108,_0xda30('0xa'),JSON[_0xda30('0xd')](_0x33644a));if(_0x33644a[_0xda30('0xe')]){if(_0x33644a[_0xda30('0xe')][_0xda30('0xf')]===0x1f4){logger['error'](_0xda30('0x9'),_0x45a108,_0x33644a[_0xda30('0xe')][_0xda30('0x10')]);return _0x269d31(_0x33644a[_0xda30('0xe')]['message']);}logger['error'](_0xda30('0x9'),_0x45a108,_0x33644a[_0xda30('0xe')][_0xda30('0x10')]);return _0x4533d0(_0x33644a[_0xda30('0xe')]['message']);}else{logger[_0xda30('0x8')](_0xda30('0x9'),_0x45a108,'request\x20sent');_0x4533d0(_0x33644a[_0xda30('0x11')]['message']);}})['catch'](function(_0x3afab3){logger[_0xda30('0xe')](_0xda30('0x9'),_0x45a108,_0x3afab3);_0x269d31(_0x3afab3);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index b993540..37d4f20 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 _0x5785=['../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','put','delete','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x16a637,_0x5eb627){var _0x25126d=function(_0x54e016){while(--_0x54e016){_0x16a637['push'](_0x16a637['shift']());}};_0x25126d(++_0x5eb627);}(_0x5785,0x119));var _0x5578=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0x5785[_0x468b0f];return _0x3e74d9;};'use strict';var multer=require(_0x5578('0x0'));var util=require(_0x5578('0x1'));var path=require(_0x5578('0x2'));var timeout=require(_0x5578('0x3'));var express=require(_0x5578('0x4'));var router=express['Router']();var fs_extra=require(_0x5578('0x5'));var auth=require(_0x5578('0x6'));var interaction=require(_0x5578('0x7'));var config=require(_0x5578('0x8'));var controller=require(_0x5578('0x9'));router[_0x5578('0xa')]('/',auth[_0x5578('0xb')](),controller[_0x5578('0xc')]);router[_0x5578('0xa')](_0x5578('0xd'),auth['isAuthenticated'](),controller[_0x5578('0xe')]);router[_0x5578('0xf')]('/',auth[_0x5578('0xb')](),controller['create']);router[_0x5578('0x10')]('/:id',auth[_0x5578('0xb')](),controller['update']);router[_0x5578('0x11')](_0x5578('0xd'),auth[_0x5578('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x5c1f=['exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','get','isAuthenticated','/:id','show','update','delete','destroy'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c1f,0x1b3));var _0xf5c1=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x5c1f[_0x3f94f9];return _0x46f84f;};'use strict';var multer=require(_0xf5c1('0x0'));var util=require('util');var path=require(_0xf5c1('0x1'));var timeout=require(_0xf5c1('0x2'));var express=require('express');var router=express[_0xf5c1('0x3')]();var fs_extra=require(_0xf5c1('0x4'));var auth=require(_0xf5c1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xf5c1('0x6')]('/',auth[_0xf5c1('0x7')](),controller['index']);router[_0xf5c1('0x6')](_0xf5c1('0x8'),auth[_0xf5c1('0x7')](),controller[_0xf5c1('0x9')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xf5c1('0x8'),auth[_0xf5c1('0x7')](),controller[_0xf5c1('0xa')]);router[_0xf5c1('0xb')](_0xf5c1('0x8'),auth[_0xf5c1('0x7')](),controller[_0xf5c1('0xc')]);module[_0xf5c1('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f6cf58a..e2e08ef 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 _0x5142=['TEXT','sequelize','exports'];(function(_0x58c654,_0x56f774){var _0x1b1164=function(_0x4ed7db){while(--_0x4ed7db){_0x58c654['push'](_0x58c654['shift']());}};_0x1b1164(++_0x56f774);}(_0x5142,0xbb));var _0x2514=function(_0x1e3d2a,_0x103793){_0x1e3d2a=_0x1e3d2a-0x0;var _0x18c87e=_0x5142[_0x1e3d2a];return _0x18c87e;};'use strict';var Sequelize=require(_0x2514('0x0'));module[_0x2514('0x1')]={'tree':{'type':Sequelize[_0x2514('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6b19=['sequelize','exports'];(function(_0x204acd,_0x11f6f6){var _0x2bcf2e=function(_0x418400){while(--_0x418400){_0x204acd['push'](_0x204acd['shift']());}};_0x2bcf2e(++_0x11f6f6);}(_0x6b19,0xe8));var _0x96b1=function(_0x3a726f,_0x94d6c8){_0x3a726f=_0x3a726f-0x0;var _0x3fa939=_0x6b19[_0x3a726f];return _0x3fa939;};'use strict';var Sequelize=require(_0x96b1('0x0'));module[_0x96b1('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 5e0c49f..659e194 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 _0xdd52=['params','keys','includeAll','merge','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','include','findAll','rows','catch','show'];(function(_0x1eccef,_0x1181d4){var _0x51c6f2=function(_0x151fba){while(--_0x151fba){_0x1eccef['push'](_0x1eccef['shift']());}};_0x51c6f2(++_0x1181d4);}(_0xdd52,0xa9));var _0x2dd5=function(_0x11a2e9,_0x3c112b){_0x11a2e9=_0x11a2e9-0x0;var _0x20388f=_0xdd52[_0x11a2e9];return _0x20388f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2dd5('0x0'));var zipdir=require(_0x2dd5('0x1'));var jsonpatch=require(_0x2dd5('0x2'));var rp=require(_0x2dd5('0x3'));var moment=require(_0x2dd5('0x4'));var BPromise=require(_0x2dd5('0x5'));var Mustache=require(_0x2dd5('0x6'));var util=require(_0x2dd5('0x7'));var path=require(_0x2dd5('0x8'));var sox=require(_0x2dd5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2dd5('0xa'));var _=require(_0x2dd5('0xb'));var squel=require(_0x2dd5('0xc'));var crypto=require(_0x2dd5('0xd'));var jsforce=require(_0x2dd5('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x2dd5('0xf'));var querystring=require(_0x2dd5('0x10'));var Papa=require(_0x2dd5('0x11'));var Redis=require(_0x2dd5('0x12'));var authService=require(_0x2dd5('0x13'));var qs=require(_0x2dd5('0x14'));var as=require(_0x2dd5('0x15'));var hardwareService=require(_0x2dd5('0x16'));var logger=require(_0x2dd5('0x17'))(_0x2dd5('0x18'));var utils=require(_0x2dd5('0x19'));var config=require(_0x2dd5('0x1a'));var licenseUtil=require(_0x2dd5('0x1b'));var db=require(_0x2dd5('0x1c'))['db'];function respondWithStatusCode(_0x3b8371,_0xaf3738){_0xaf3738=_0xaf3738||0xcc;return function(_0x293e85){if(_0x293e85){return _0x3b8371[_0x2dd5('0x1d')](_0xaf3738);}return _0x3b8371[_0x2dd5('0x1e')](_0xaf3738)[_0x2dd5('0x1f')]();};}function respondWithResult(_0x5d19be,_0x93d250){_0x93d250=_0x93d250||0xc8;return function(_0x208266){if(_0x208266){return _0x5d19be[_0x2dd5('0x1e')](_0x93d250)[_0x2dd5('0x20')](_0x208266);}};}function respondWithFilteredResult(_0x153cc1,_0x72d724){return function(_0x162fe3){if(_0x162fe3){var _0x203544=typeof _0x72d724[_0x2dd5('0x21')]===_0x2dd5('0x22')&&typeof _0x72d724[_0x2dd5('0x23')]===_0x2dd5('0x22');var _0x2e95d6=_0x162fe3['count'];var _0x1f17e1=_0x203544?0x0:_0x72d724[_0x2dd5('0x21')];var _0x159e30=_0x203544?_0x162fe3[_0x2dd5('0x24')]:_0x72d724['offset']+_0x72d724['limit'];var _0xcc557d;if(_0x159e30>=_0x2e95d6){_0x159e30=_0x2e95d6;_0xcc557d=0xc8;}else{_0xcc557d=0xce;}_0x153cc1['status'](_0xcc557d);return _0x153cc1[_0x2dd5('0x25')]('Content-Range',_0x1f17e1+'-'+_0x159e30+'/'+_0x2e95d6)[_0x2dd5('0x20')](_0x162fe3);}return null;};}function patchUpdates(_0x169f9f){return function(_0x423f1d){try{jsonpatch[_0x2dd5('0x26')](_0x423f1d,_0x169f9f,!![]);}catch(_0x4d67bf){return BPromise[_0x2dd5('0x27')](_0x4d67bf);}return _0x423f1d[_0x2dd5('0x28')]();};}function saveUpdates(_0x3a75da,_0x512280){return function(_0x545e6a){if(_0x545e6a){return _0x545e6a[_0x2dd5('0x29')](_0x3a75da)[_0x2dd5('0x2a')](function(_0x4911cf){return _0x4911cf;});}return null;};}function removeEntity(_0x5bbde9,_0x4e65de){return function(_0x2d6d6b){if(_0x2d6d6b){return _0x2d6d6b[_0x2dd5('0x2b')]()['then'](function(){_0x5bbde9[_0x2dd5('0x1e')](0xcc)[_0x2dd5('0x1f')]();});}};}function handleEntityNotFound(_0x505708,_0x42a6af){return function(_0x4e556e){if(!_0x4e556e){_0x505708['sendStatus'](0x194);}return _0x4e556e;};}function handleError(_0x48f8d5,_0x4f299a){_0x4f299a=_0x4f299a||0x1f4;return function(_0x324075){logger[_0x2dd5('0x2c')](_0x324075[_0x2dd5('0x2d')]);if(_0x324075['name']){delete _0x324075[_0x2dd5('0x2e')];}_0x48f8d5[_0x2dd5('0x1e')](_0x4f299a)[_0x2dd5('0x2f')](_0x324075);};}exports[_0x2dd5('0x30')]=function(_0x4d7066,_0x4614fe){var _0x5bea29={},_0x56aa79={},_0x2cb076={'count':0x0,'rows':[]};var _0x435d18=_[_0x2dd5('0x31')](db[_0x2dd5('0x32')][_0x2dd5('0x33')],function(_0x36d875){return{'name':_0x36d875[_0x2dd5('0x34')],'type':_0x36d875[_0x2dd5('0x35')][_0x2dd5('0x36')]};});_0x56aa79[_0x2dd5('0x37')]=_['map'](_0x435d18,'name');_0x56aa79['query']=_['keys'](_0x4d7066['query']);_0x56aa79[_0x2dd5('0x38')]=_[_0x2dd5('0x39')](_0x56aa79[_0x2dd5('0x37')],_0x56aa79[_0x2dd5('0x3a')]);_0x5bea29[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0x56aa79['model'],qs[_0x2dd5('0x3c')](_0x4d7066['query'][_0x2dd5('0x3c')]));_0x5bea29[_0x2dd5('0x3b')]=_0x5bea29[_0x2dd5('0x3b')][_0x2dd5('0x3d')]?_0x5bea29[_0x2dd5('0x3b')]:_0x56aa79['model'];if(!_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x3e')](_0x2dd5('0x3f'))){_0x5bea29['limit']=qs[_0x2dd5('0x23')](_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x23')]);_0x5bea29[_0x2dd5('0x21')]=qs[_0x2dd5('0x21')](_0x4d7066[_0x2dd5('0x3a')]['offset']);}_0x5bea29['order']=qs[_0x2dd5('0x40')](_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x40')]);_0x5bea29[_0x2dd5('0x41')]=qs['filters'](_['pick'](_0x4d7066[_0x2dd5('0x3a')],_0x56aa79[_0x2dd5('0x38')]),_0x435d18);if(_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x42')]){_0x5bea29[_0x2dd5('0x41')]=_['merge'](_0x5bea29[_0x2dd5('0x41')],{'$or':_['map'](_0x435d18,function(_0x142071){if(_0x142071['type']!==_0x2dd5('0x43')){var _0x36565d={};_0x36565d[_0x142071[_0x2dd5('0x2e')]]={'$like':'%'+_0x4d7066[_0x2dd5('0x3a')][_0x2dd5('0x42')]+'%'};return _0x36565d;}})});}_0x5bea29=_['merge']({},_0x5bea29,_0x4d7066[_0x2dd5('0x44')]);var _0x1dd56e={'where':_0x5bea29['where']};return db['AnalyticTreeReport'][_0x2dd5('0x24')](_0x1dd56e)[_0x2dd5('0x2a')](function(_0x429e0e){_0x2cb076[_0x2dd5('0x24')]=_0x429e0e;if(_0x4d7066['query']['includeAll']){_0x5bea29[_0x2dd5('0x45')]=[{'all':!![]}];}return db[_0x2dd5('0x32')][_0x2dd5('0x46')](_0x5bea29);})[_0x2dd5('0x2a')](function(_0x4e45ac){_0x2cb076[_0x2dd5('0x47')]=_0x4e45ac;return _0x2cb076;})[_0x2dd5('0x2a')](respondWithFilteredResult(_0x4614fe,_0x5bea29))[_0x2dd5('0x48')](handleError(_0x4614fe,null));};exports[_0x2dd5('0x49')]=function(_0x456f24,_0x276f84){var _0x5fa1b1={'raw':!![],'where':{'id':_0x456f24[_0x2dd5('0x4a')]['id']}},_0xc75a25={};_0xc75a25['model']=_[_0x2dd5('0x4b')](db[_0x2dd5('0x32')][_0x2dd5('0x33')]);_0xc75a25['query']=_[_0x2dd5('0x4b')](_0x456f24[_0x2dd5('0x3a')]);_0xc75a25[_0x2dd5('0x38')]=_['intersection'](_0xc75a25[_0x2dd5('0x37')],_0xc75a25['query']);_0x5fa1b1[_0x2dd5('0x3b')]=_[_0x2dd5('0x39')](_0xc75a25[_0x2dd5('0x37')],qs['fields'](_0x456f24[_0x2dd5('0x3a')][_0x2dd5('0x3c')]));_0x5fa1b1[_0x2dd5('0x3b')]=_0x5fa1b1[_0x2dd5('0x3b')][_0x2dd5('0x3d')]?_0x5fa1b1[_0x2dd5('0x3b')]:_0xc75a25[_0x2dd5('0x37')];if(_0x456f24[_0x2dd5('0x3a')][_0x2dd5('0x4c')]){_0x5fa1b1['include']=[{'all':!![]}];}_0x5fa1b1=_[_0x2dd5('0x4d')]({},_0x5fa1b1,_0x456f24[_0x2dd5('0x44')]);return db[_0x2dd5('0x32')][_0x2dd5('0x4e')](_0x5fa1b1)[_0x2dd5('0x2a')](handleEntityNotFound(_0x276f84,null))[_0x2dd5('0x2a')](respondWithResult(_0x276f84,null))[_0x2dd5('0x48')](handleError(_0x276f84,null));};exports['create']=function(_0x2bca55,_0x320cb3){return db[_0x2dd5('0x32')][_0x2dd5('0x4f')](_0x2bca55[_0x2dd5('0x50')],{})[_0x2dd5('0x2a')](respondWithResult(_0x320cb3,0xc9))[_0x2dd5('0x48')](handleError(_0x320cb3,null));};exports[_0x2dd5('0x29')]=function(_0x57d0c2,_0x516909){if(_0x57d0c2[_0x2dd5('0x50')]['id']){delete _0x57d0c2[_0x2dd5('0x50')]['id'];}return db[_0x2dd5('0x32')]['find']({'where':{'id':_0x57d0c2['params']['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x516909,null))[_0x2dd5('0x2a')](saveUpdates(_0x57d0c2[_0x2dd5('0x50')],null))[_0x2dd5('0x2a')](respondWithResult(_0x516909,null))[_0x2dd5('0x48')](handleError(_0x516909,null));};exports[_0x2dd5('0x2b')]=function(_0x565e4d,_0x8a7cf6){return db[_0x2dd5('0x32')]['find']({'where':{'id':_0x565e4d[_0x2dd5('0x4a')]['id']}})[_0x2dd5('0x2a')](handleEntityNotFound(_0x8a7cf6,null))[_0x2dd5('0x2a')](removeEntity(_0x8a7cf6,null))[_0x2dd5('0x48')](handleError(_0x8a7cf6,null));}; \ No newline at end of file +var _0xfec1=['Content-Range','reject','save','update','then','end','error','send','index','map','rawAttributes','fieldName','type','key','model','name','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','AnalyticTreeReport','rows','catch','show','params','keys','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfec1,0x196));var _0x1fec=function(_0x332888,_0x23d697){_0x332888=_0x332888-0x0;var _0x261dff=_0xfec1[_0x332888];return _0x261dff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1fec('0x0'));var zipdir=require(_0x1fec('0x1'));var jsonpatch=require(_0x1fec('0x2'));var rp=require(_0x1fec('0x3'));var moment=require(_0x1fec('0x4'));var BPromise=require(_0x1fec('0x5'));var Mustache=require(_0x1fec('0x6'));var util=require(_0x1fec('0x7'));var path=require('path');var sox=require(_0x1fec('0x8'));var csv=require(_0x1fec('0x9'));var ejs=require(_0x1fec('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1fec('0xb'));var squel=require(_0x1fec('0xc'));var crypto=require('crypto');var jsforce=require(_0x1fec('0xd'));var deskjs=require(_0x1fec('0xe'));var toCsv=require(_0x1fec('0x9'));var querystring=require(_0x1fec('0xf'));var Papa=require(_0x1fec('0x10'));var Redis=require(_0x1fec('0x11'));var authService=require(_0x1fec('0x12'));var qs=require(_0x1fec('0x13'));var as=require(_0x1fec('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1fec('0x15'));var utils=require(_0x1fec('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1fec('0x17'));var db=require(_0x1fec('0x18'))['db'];function respondWithStatusCode(_0x5f3e7b,_0x45c8e1){_0x45c8e1=_0x45c8e1||0xcc;return function(_0x4b4891){if(_0x4b4891){return _0x5f3e7b[_0x1fec('0x19')](_0x45c8e1);}return _0x5f3e7b[_0x1fec('0x1a')](_0x45c8e1)['end']();};}function respondWithResult(_0x238f49,_0x354919){_0x354919=_0x354919||0xc8;return function(_0x253264){if(_0x253264){return _0x238f49[_0x1fec('0x1a')](_0x354919)[_0x1fec('0x1b')](_0x253264);}};}function respondWithFilteredResult(_0x24d04e,_0x285672){return function(_0x56a777){if(_0x56a777){var _0x231576=typeof _0x285672[_0x1fec('0x1c')]===_0x1fec('0x1d')&&typeof _0x285672[_0x1fec('0x1e')]===_0x1fec('0x1d');var _0x5210b1=_0x56a777[_0x1fec('0x1f')];var _0x312d82=_0x231576?0x0:_0x285672['offset'];var _0x198f57=_0x231576?_0x56a777[_0x1fec('0x1f')]:_0x285672[_0x1fec('0x1c')]+_0x285672[_0x1fec('0x1e')];var _0x1b90a2;if(_0x198f57>=_0x5210b1){_0x198f57=_0x5210b1;_0x1b90a2=0xc8;}else{_0x1b90a2=0xce;}_0x24d04e[_0x1fec('0x1a')](_0x1b90a2);return _0x24d04e['set'](_0x1fec('0x20'),_0x312d82+'-'+_0x198f57+'/'+_0x5210b1)['json'](_0x56a777);}return null;};}function patchUpdates(_0x52215a){return function(_0x416da5){try{jsonpatch['apply'](_0x416da5,_0x52215a,!![]);}catch(_0x3bc737){return BPromise[_0x1fec('0x21')](_0x3bc737);}return _0x416da5[_0x1fec('0x22')]();};}function saveUpdates(_0x17fda0,_0x3cc32f){return function(_0x4f5b09){if(_0x4f5b09){return _0x4f5b09[_0x1fec('0x23')](_0x17fda0)[_0x1fec('0x24')](function(_0x5c2e60){return _0x5c2e60;});}return null;};}function removeEntity(_0x1570d3,_0x568e51){return function(_0x538fc1){if(_0x538fc1){return _0x538fc1['destroy']()[_0x1fec('0x24')](function(){_0x1570d3['status'](0xcc)[_0x1fec('0x25')]();});}};}function handleEntityNotFound(_0x525055,_0x3ea836){return function(_0x5b42c6){if(!_0x5b42c6){_0x525055['sendStatus'](0x194);}return _0x5b42c6;};}function handleError(_0x4bb3c2,_0x3d3f9e){_0x3d3f9e=_0x3d3f9e||0x1f4;return function(_0x330279){logger[_0x1fec('0x26')](_0x330279['stack']);if(_0x330279['name']){delete _0x330279['name'];}_0x4bb3c2['status'](_0x3d3f9e)[_0x1fec('0x27')](_0x330279);};}exports[_0x1fec('0x28')]=function(_0x4a7755,_0x6580f1){var _0x32e556={},_0x551df3={},_0x1750b7={'count':0x0,'rows':[]};var _0x2597ee=_[_0x1fec('0x29')](db['AnalyticTreeReport'][_0x1fec('0x2a')],function(_0x13d9d0){return{'name':_0x13d9d0[_0x1fec('0x2b')],'type':_0x13d9d0[_0x1fec('0x2c')][_0x1fec('0x2d')]};});_0x551df3[_0x1fec('0x2e')]=_[_0x1fec('0x29')](_0x2597ee,_0x1fec('0x2f'));_0x551df3[_0x1fec('0x30')]=_['keys'](_0x4a7755[_0x1fec('0x30')]);_0x551df3['filters']=_['intersection'](_0x551df3[_0x1fec('0x2e')],_0x551df3['query']);_0x32e556[_0x1fec('0x31')]=_[_0x1fec('0x32')](_0x551df3[_0x1fec('0x2e')],qs['fields'](_0x4a7755[_0x1fec('0x30')][_0x1fec('0x33')]));_0x32e556[_0x1fec('0x31')]=_0x32e556[_0x1fec('0x31')][_0x1fec('0x34')]?_0x32e556['attributes']:_0x551df3['model'];if(!_0x4a7755[_0x1fec('0x30')][_0x1fec('0x35')]('nolimit')){_0x32e556[_0x1fec('0x1e')]=qs[_0x1fec('0x1e')](_0x4a7755['query'][_0x1fec('0x1e')]);_0x32e556[_0x1fec('0x1c')]=qs[_0x1fec('0x1c')](_0x4a7755[_0x1fec('0x30')][_0x1fec('0x1c')]);}_0x32e556[_0x1fec('0x36')]=qs[_0x1fec('0x37')](_0x4a7755[_0x1fec('0x30')]['sort']);_0x32e556[_0x1fec('0x38')]=qs[_0x1fec('0x39')](_['pick'](_0x4a7755[_0x1fec('0x30')],_0x551df3[_0x1fec('0x39')]),_0x2597ee);if(_0x4a7755[_0x1fec('0x30')][_0x1fec('0x3a')]){_0x32e556[_0x1fec('0x38')]=_[_0x1fec('0x3b')](_0x32e556[_0x1fec('0x38')],{'$or':_[_0x1fec('0x29')](_0x2597ee,function(_0x3d19f){if(_0x3d19f[_0x1fec('0x2c')]!==_0x1fec('0x3c')){var _0x21a56d={};_0x21a56d[_0x3d19f[_0x1fec('0x2f')]]={'$like':'%'+_0x4a7755[_0x1fec('0x30')][_0x1fec('0x3a')]+'%'};return _0x21a56d;}})});}_0x32e556=_[_0x1fec('0x3b')]({},_0x32e556,_0x4a7755['options']);var _0x17aa2c={'where':_0x32e556[_0x1fec('0x38')]};return db['AnalyticTreeReport'][_0x1fec('0x1f')](_0x17aa2c)[_0x1fec('0x24')](function(_0x3a924c){_0x1750b7[_0x1fec('0x1f')]=_0x3a924c;if(_0x4a7755[_0x1fec('0x30')][_0x1fec('0x3d')]){_0x32e556[_0x1fec('0x3e')]=[{'all':!![]}];}return db[_0x1fec('0x3f')]['findAll'](_0x32e556);})['then'](function(_0x58f4fb){_0x1750b7[_0x1fec('0x40')]=_0x58f4fb;return _0x1750b7;})[_0x1fec('0x24')](respondWithFilteredResult(_0x6580f1,_0x32e556))[_0x1fec('0x41')](handleError(_0x6580f1,null));};exports[_0x1fec('0x42')]=function(_0x2b0449,_0x345dc0){var _0x2a2b37={'raw':!![],'where':{'id':_0x2b0449[_0x1fec('0x43')]['id']}},_0x44f6c7={};_0x44f6c7[_0x1fec('0x2e')]=_[_0x1fec('0x44')](db[_0x1fec('0x3f')]['rawAttributes']);_0x44f6c7['query']=_['keys'](_0x2b0449[_0x1fec('0x30')]);_0x44f6c7[_0x1fec('0x39')]=_[_0x1fec('0x32')](_0x44f6c7[_0x1fec('0x2e')],_0x44f6c7[_0x1fec('0x30')]);_0x2a2b37[_0x1fec('0x31')]=_['intersection'](_0x44f6c7[_0x1fec('0x2e')],qs[_0x1fec('0x33')](_0x2b0449[_0x1fec('0x30')][_0x1fec('0x33')]));_0x2a2b37['attributes']=_0x2a2b37[_0x1fec('0x31')]['length']?_0x2a2b37[_0x1fec('0x31')]:_0x44f6c7[_0x1fec('0x2e')];if(_0x2b0449[_0x1fec('0x30')][_0x1fec('0x3d')]){_0x2a2b37['include']=[{'all':!![]}];}_0x2a2b37=_[_0x1fec('0x3b')]({},_0x2a2b37,_0x2b0449['options']);return db[_0x1fec('0x3f')][_0x1fec('0x45')](_0x2a2b37)[_0x1fec('0x24')](handleEntityNotFound(_0x345dc0,null))['then'](respondWithResult(_0x345dc0,null))[_0x1fec('0x41')](handleError(_0x345dc0,null));};exports[_0x1fec('0x46')]=function(_0x456625,_0x1863d3){return db['AnalyticTreeReport'][_0x1fec('0x46')](_0x456625[_0x1fec('0x47')],{})['then'](respondWithResult(_0x1863d3,0xc9))[_0x1fec('0x41')](handleError(_0x1863d3,null));};exports['update']=function(_0x2f2c10,_0x214fe5){if(_0x2f2c10['body']['id']){delete _0x2f2c10[_0x1fec('0x47')]['id'];}return db[_0x1fec('0x3f')][_0x1fec('0x45')]({'where':{'id':_0x2f2c10[_0x1fec('0x43')]['id']}})[_0x1fec('0x24')](handleEntityNotFound(_0x214fe5,null))[_0x1fec('0x24')](saveUpdates(_0x2f2c10[_0x1fec('0x47')],null))[_0x1fec('0x24')](respondWithResult(_0x214fe5,null))[_0x1fec('0x41')](handleError(_0x214fe5,null));};exports[_0x1fec('0x48')]=function(_0x358a98,_0x13b359){return db[_0x1fec('0x3f')][_0x1fec('0x45')]({'where':{'id':_0x358a98[_0x1fec('0x43')]['id']}})[_0x1fec('0x24')](handleEntityNotFound(_0x13b359,null))[_0x1fec('0x24')](removeEntity(_0x13b359,null))[_0x1fec('0x41')](handleError(_0x13b359,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0508fef..af06683 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 _0x5710=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api','moment'];(function(_0x169630,_0x2a57b1){var _0x1641dd=function(_0x5aabbb){while(--_0x5aabbb){_0x169630['push'](_0x169630['shift']());}};_0x1641dd(++_0x2a57b1);}(_0x5710,0xb1));var _0x0571=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x5710[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x0571('0x0'));var util=require(_0x0571('0x1'));var logger=require(_0x0571('0x2'))(_0x0571('0x3'));var moment=require(_0x0571('0x4'));var BPromise=require(_0x0571('0x5'));var rp=require(_0x0571('0x6'));var fs=require('fs');var path=require(_0x0571('0x7'));var rimraf=require(_0x0571('0x8'));var config=require(_0x0571('0x9'));var attributes=require(_0x0571('0xa'));module[_0x0571('0xb')]=function(_0x96ded2,_0x3bbbe7){return _0x96ded2[_0x0571('0xc')]('AnalyticTreeReport',attributes,{'tableName':_0x0571('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x62c8=['../../config/logger','bluebird','request-promise','path','rimraf','./analyticTreeReport.attributes','exports','AnalyticTreeReport','analytics_report_trees','lodash','util'];(function(_0x2c4102,_0x192c7f){var _0x52e02c=function(_0x526df7){while(--_0x526df7){_0x2c4102['push'](_0x2c4102['shift']());}};_0x52e02c(++_0x192c7f);}(_0x62c8,0x169));var _0x862c=function(_0x374a81,_0x571052){_0x374a81=_0x374a81-0x0;var _0x50f580=_0x62c8[_0x374a81];return _0x50f580;};'use strict';var _=require(_0x862c('0x0'));var util=require(_0x862c('0x1'));var logger=require(_0x862c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x862c('0x3'));var rp=require(_0x862c('0x4'));var fs=require('fs');var path=require(_0x862c('0x5'));var rimraf=require(_0x862c('0x6'));var config=require('../../config/environment');var attributes=require(_0x862c('0x7'));module[_0x862c('0x8')]=function(_0x5b6067,_0xdc07c3){return _0x5b6067['define'](_0x862c('0x9'),attributes,{'tableName':_0x862c('0xa'),'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 127a158..ff0ac7d 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2eebf2,_0x15e7ca){var _0x1ca79=function(_0x430405){while(--_0x430405){_0x2eebf2['push'](_0x2eebf2['shift']());}};_0x1ca79(++_0x15e7ca);}(_0x5f2f,0x73));var _0xf5f2=function(_0xe92bc6,_0x35937e){_0xe92bc6=_0xe92bc6-0x0;var _0x4d5b66=_0x5f2f[_0xe92bc6];return _0x4d5b66;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _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(_0x2f1ac4,_0x236a72){var _0x18e1a5=function(_0x18f34b){while(--_0x18f34b){_0x2f1ac4['push'](_0x2f1ac4['shift']());}};_0x18e1a5(++_0x236a72);}(_0x2ef3,0xba));var _0x32ef=function(_0x2af6fd,_0xb2798d){_0x2af6fd=_0x2af6fd-0x0;var _0x2da8d9=_0x2ef3[_0x2af6fd];return _0x2da8d9;};'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 53293c1..1329ae2 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 _0x5ec2=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router'];(function(_0x5f6171,_0x308104){var _0x3e5257=function(_0x42d8ce){while(--_0x42d8ce){_0x5f6171['push'](_0x5f6171['shift']());}};_0x3e5257(++_0x308104);}(_0x5ec2,0x18a));var _0x25ec=function(_0x2e6dee,_0x1a61b0){_0x2e6dee=_0x2e6dee-0x0;var _0x47706=_0x5ec2[_0x2e6dee];return _0x47706;};'use strict';var multer=require(_0x25ec('0x0'));var util=require(_0x25ec('0x1'));var path=require(_0x25ec('0x2'));var timeout=require(_0x25ec('0x3'));var express=require('express');var router=express[_0x25ec('0x4')]();var fs_extra=require(_0x25ec('0x5'));var auth=require(_0x25ec('0x6'));var interaction=require(_0x25ec('0x7'));var config=require(_0x25ec('0x8'));var controller=require(_0x25ec('0x9'));router[_0x25ec('0xa')]('/',auth[_0x25ec('0xb')](),controller['index']);router[_0x25ec('0xa')](_0x25ec('0xc'),auth[_0x25ec('0xb')](),controller['show']);router[_0x25ec('0xd')]('/',auth[_0x25ec('0xb')](),controller[_0x25ec('0xe')]);router[_0x25ec('0xf')](_0x25ec('0xc'),auth['isAuthenticated'](),controller[_0x25ec('0x10')]);router[_0x25ec('0x11')]('/:id',auth[_0x25ec('0xb')](),controller[_0x25ec('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc4a8=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','post'];(function(_0x2d033d,_0x5bf31a){var _0x36ea6c=function(_0x22f07f){while(--_0x22f07f){_0x2d033d['push'](_0x2d033d['shift']());}};_0x36ea6c(++_0x5bf31a);}(_0xc4a8,0x193));var _0x8c4a=function(_0x346b92,_0x286185){_0x346b92=_0x346b92-0x0;var _0x5a8e1c=_0xc4a8[_0x346b92];return _0x5a8e1c;};'use strict';var multer=require(_0x8c4a('0x0'));var util=require(_0x8c4a('0x1'));var path=require(_0x8c4a('0x2'));var timeout=require(_0x8c4a('0x3'));var express=require(_0x8c4a('0x4'));var router=express[_0x8c4a('0x5')]();var fs_extra=require(_0x8c4a('0x6'));var auth=require(_0x8c4a('0x7'));var interaction=require(_0x8c4a('0x8'));var config=require(_0x8c4a('0x9'));var controller=require(_0x8c4a('0xa'));router[_0x8c4a('0xb')]('/',auth[_0x8c4a('0xc')](),controller['index']);router['get'](_0x8c4a('0xd'),auth[_0x8c4a('0xc')](),controller['show']);router[_0x8c4a('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8c4a('0xf')](_0x8c4a('0xd'),auth[_0x8c4a('0xc')](),controller[_0x8c4a('0x10')]);router['delete']('/:id',auth[_0x8c4a('0xc')](),controller[_0x8c4a('0x11')]);module[_0x8c4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7c03353..279c896 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 _0xbb53=['STRING','sequelize','exports'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xbb53,0x121));var _0x3bb5=function(_0x358436,_0x5c3c5f){_0x358436=_0x358436-0x0;var _0x343cb=_0xbb53[_0x358436];return _0x343cb;};'use strict';var Sequelize=require(_0x3bb5('0x0'));module[_0x3bb5('0x1')]={'name':{'type':Sequelize[_0x3bb5('0x2')]},'basename':{'type':Sequelize[_0x3bb5('0x2')]},'type':{'type':Sequelize[_0x3bb5('0x2')]}}; \ No newline at end of file +var _0x8bdf=['sequelize','exports','STRING'];(function(_0x1fa760,_0x1bf063){var _0xd8eda1=function(_0x4a21d6){while(--_0x4a21d6){_0x1fa760['push'](_0x1fa760['shift']());}};_0xd8eda1(++_0x1bf063);}(_0x8bdf,0x1a7));var _0xf8bd=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8bdf[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require(_0xf8bd('0x0'));module[_0xf8bd('0x1')]={'name':{'type':Sequelize[_0xf8bd('0x2')]},'basename':{'type':Sequelize[_0xf8bd('0x2')]},'type':{'type':Sequelize[_0xf8bd('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 5203038..9816eba 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 _0xd387=['params','includeAll','include','options','find','get','updatedAt','body','omit','create','file','originalname','basename','filename','type','mimetype','download','findOne','ChatOfflineMessageId','root','server/files/attachments/','offline-chat/','join','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','sendStatus','error','stack','name','index','map','Attachment','rawAttributes','fieldName','key','keys','query','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','findAll','rows','catch','show'];(function(_0x319cb9,_0x4b8d35){var _0x1735fc=function(_0x43b061){while(--_0x43b061){_0x319cb9['push'](_0x319cb9['shift']());}};_0x1735fc(++_0x4b8d35);}(_0xd387,0x1ca));var _0x7d38=function(_0xb8eb35,_0x3e0b35){_0xb8eb35=_0xb8eb35-0x0;var _0x35cd19=_0xd387[_0xb8eb35];return _0x35cd19;};'use strict';var emlformat=require(_0x7d38('0x0'));var rimraf=require(_0x7d38('0x1'));var zipdir=require(_0x7d38('0x2'));var jsonpatch=require(_0x7d38('0x3'));var rp=require(_0x7d38('0x4'));var moment=require(_0x7d38('0x5'));var BPromise=require(_0x7d38('0x6'));var Mustache=require(_0x7d38('0x7'));var util=require(_0x7d38('0x8'));var path=require(_0x7d38('0x9'));var sox=require('sox');var csv=require(_0x7d38('0xa'));var ejs=require(_0x7d38('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7d38('0xc'));var squel=require(_0x7d38('0xd'));var crypto=require(_0x7d38('0xe'));var jsforce=require(_0x7d38('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x7d38('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7d38('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7d38('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7d38('0x12'))('api');var utils=require(_0x7d38('0x13'));var config=require(_0x7d38('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7d38('0x15'))['db'];function respondWithStatusCode(_0x3f376a,_0x52621f){_0x52621f=_0x52621f||0xcc;return function(_0x5846ab){if(_0x5846ab){return _0x3f376a['sendStatus'](_0x52621f);}return _0x3f376a[_0x7d38('0x16')](_0x52621f)[_0x7d38('0x17')]();};}function respondWithResult(_0xb9a7e9,_0x59945f){_0x59945f=_0x59945f||0xc8;return function(_0x26af27){if(_0x26af27){return _0xb9a7e9[_0x7d38('0x16')](_0x59945f)[_0x7d38('0x18')](_0x26af27);}};}function respondWithFilteredResult(_0x2c075d,_0x1f10fe){return function(_0x12b494){if(_0x12b494){var _0x4b4e5f=typeof _0x1f10fe[_0x7d38('0x19')]===_0x7d38('0x1a')&&typeof _0x1f10fe[_0x7d38('0x1b')]===_0x7d38('0x1a');var _0x24035d=_0x12b494[_0x7d38('0x1c')];var _0x1b8fb1=_0x4b4e5f?0x0:_0x1f10fe[_0x7d38('0x19')];var _0x1e7dec=_0x4b4e5f?_0x12b494['count']:_0x1f10fe[_0x7d38('0x19')]+_0x1f10fe[_0x7d38('0x1b')];var _0x300bd4;if(_0x1e7dec>=_0x24035d){_0x1e7dec=_0x24035d;_0x300bd4=0xc8;}else{_0x300bd4=0xce;}_0x2c075d[_0x7d38('0x16')](_0x300bd4);return _0x2c075d['set'](_0x7d38('0x1d'),_0x1b8fb1+'-'+_0x1e7dec+'/'+_0x24035d)[_0x7d38('0x18')](_0x12b494);}return null;};}function patchUpdates(_0x4ce5fc){return function(_0x275170){try{jsonpatch['apply'](_0x275170,_0x4ce5fc,!![]);}catch(_0x548003){return BPromise[_0x7d38('0x1e')](_0x548003);}return _0x275170[_0x7d38('0x1f')]();};}function saveUpdates(_0xf669ef,_0x2fe995){return function(_0x481614){if(_0x481614){return _0x481614[_0x7d38('0x20')](_0xf669ef)[_0x7d38('0x21')](function(_0x5494d2){return _0x5494d2;});}return null;};}function removeEntity(_0x181a5b,_0x3ad26d){return function(_0xb6da75){if(_0xb6da75){return _0xb6da75['destroy']()[_0x7d38('0x21')](function(){_0x181a5b[_0x7d38('0x16')](0xcc)[_0x7d38('0x17')]();});}};}function handleEntityNotFound(_0x488c70,_0x1ce8dd){return function(_0x54164c){if(!_0x54164c){_0x488c70[_0x7d38('0x22')](0x194);}return _0x54164c;};}function handleError(_0x1e8236,_0x1a5a4a){_0x1a5a4a=_0x1a5a4a||0x1f4;return function(_0x3aaa96){logger[_0x7d38('0x23')](_0x3aaa96[_0x7d38('0x24')]);if(_0x3aaa96['name']){delete _0x3aaa96[_0x7d38('0x25')];}_0x1e8236[_0x7d38('0x16')](_0x1a5a4a)['send'](_0x3aaa96);};}exports[_0x7d38('0x26')]=function(_0x676441,_0x36130c){var _0xd0d3a7={},_0x5a7580={},_0x4d6502={'count':0x0,'rows':[]};var _0x172856=_[_0x7d38('0x27')](db[_0x7d38('0x28')][_0x7d38('0x29')],function(_0x30a2e1){return{'name':_0x30a2e1[_0x7d38('0x2a')],'type':_0x30a2e1['type'][_0x7d38('0x2b')]};});_0x5a7580['model']=_['map'](_0x172856,_0x7d38('0x25'));_0x5a7580['query']=_[_0x7d38('0x2c')](_0x676441[_0x7d38('0x2d')]);_0x5a7580['filters']=_[_0x7d38('0x2e')](_0x5a7580[_0x7d38('0x2f')],_0x5a7580['query']);_0xd0d3a7[_0x7d38('0x30')]=_[_0x7d38('0x2e')](_0x5a7580['model'],qs[_0x7d38('0x31')](_0x676441[_0x7d38('0x2d')][_0x7d38('0x31')]));_0xd0d3a7[_0x7d38('0x30')]=_0xd0d3a7[_0x7d38('0x30')]['length']?_0xd0d3a7['attributes']:_0x5a7580[_0x7d38('0x2f')];if(!_0x676441['query'][_0x7d38('0x32')](_0x7d38('0x33'))){_0xd0d3a7['limit']=qs[_0x7d38('0x1b')](_0x676441[_0x7d38('0x2d')][_0x7d38('0x1b')]);_0xd0d3a7['offset']=qs[_0x7d38('0x19')](_0x676441[_0x7d38('0x2d')][_0x7d38('0x19')]);}_0xd0d3a7[_0x7d38('0x34')]=qs[_0x7d38('0x35')](_0x676441[_0x7d38('0x2d')]['sort']);_0xd0d3a7[_0x7d38('0x36')]=qs[_0x7d38('0x37')](_[_0x7d38('0x38')](_0x676441[_0x7d38('0x2d')],_0x5a7580[_0x7d38('0x37')]),_0x172856);if(_0x676441[_0x7d38('0x2d')]['filter']){_0xd0d3a7[_0x7d38('0x36')]=_[_0x7d38('0x39')](_0xd0d3a7[_0x7d38('0x36')],{'$or':_['map'](_0x172856,function(_0x371371){if(_0x371371['type']!==_0x7d38('0x3a')){var _0x526f81={};_0x526f81[_0x371371[_0x7d38('0x25')]]={'$like':'%'+_0x676441['query'][_0x7d38('0x3b')]+'%'};return _0x526f81;}})});}_0xd0d3a7=_[_0x7d38('0x39')]({},_0xd0d3a7,_0x676441['options']);var _0x4f8dd6={'where':_0xd0d3a7[_0x7d38('0x36')]};return db[_0x7d38('0x28')]['count'](_0x4f8dd6)['then'](function(_0x170d80){_0x4d6502[_0x7d38('0x1c')]=_0x170d80;if(_0x676441[_0x7d38('0x2d')]['includeAll']){_0xd0d3a7['include']=[{'all':!![]}];}return db['Attachment'][_0x7d38('0x3c')](_0xd0d3a7);})[_0x7d38('0x21')](function(_0x1d8a15){_0x4d6502[_0x7d38('0x3d')]=_0x1d8a15;return _0x4d6502;})[_0x7d38('0x21')](respondWithFilteredResult(_0x36130c,_0xd0d3a7))[_0x7d38('0x3e')](handleError(_0x36130c,null));};exports[_0x7d38('0x3f')]=function(_0x5a4834,_0x5c78a9){var _0xb1093a={'raw':!![],'where':{'id':_0x5a4834[_0x7d38('0x40')]['id']}},_0x20c1be={};_0x20c1be[_0x7d38('0x2f')]=_[_0x7d38('0x2c')](db[_0x7d38('0x28')][_0x7d38('0x29')]);_0x20c1be[_0x7d38('0x2d')]=_[_0x7d38('0x2c')](_0x5a4834[_0x7d38('0x2d')]);_0x20c1be['filters']=_['intersection'](_0x20c1be['model'],_0x20c1be['query']);_0xb1093a['attributes']=_['intersection'](_0x20c1be[_0x7d38('0x2f')],qs['fields'](_0x5a4834[_0x7d38('0x2d')][_0x7d38('0x31')]));_0xb1093a[_0x7d38('0x30')]=_0xb1093a[_0x7d38('0x30')]['length']?_0xb1093a[_0x7d38('0x30')]:_0x20c1be[_0x7d38('0x2f')];if(_0x5a4834['query'][_0x7d38('0x41')]){_0xb1093a[_0x7d38('0x42')]=[{'all':!![]}];}_0xb1093a=_[_0x7d38('0x39')]({},_0xb1093a,_0x5a4834[_0x7d38('0x43')]);return db[_0x7d38('0x28')][_0x7d38('0x44')](_0xb1093a)[_0x7d38('0x21')](handleEntityNotFound(_0x5c78a9,null))[_0x7d38('0x21')](respondWithResult(_0x5c78a9,null))[_0x7d38('0x3e')](handleError(_0x5c78a9,null));};exports['clone']=function(_0x25de27,_0x51d563){var _0x236ed9={'where':{'id':_0x25de27[_0x7d38('0x40')]['id']}},_0x371462={};_0x371462[_0x7d38('0x2f')]=_[_0x7d38('0x2c')](db[_0x7d38('0x28')][_0x7d38('0x29')]);_0x236ed9[_0x7d38('0x30')]=_[_0x7d38('0x2e')](_0x371462[_0x7d38('0x2f')],qs['fields'](_0x25de27[_0x7d38('0x2d')][_0x7d38('0x31')]));_0x236ed9[_0x7d38('0x30')]=_0x236ed9[_0x7d38('0x30')]['length']?_0x236ed9[_0x7d38('0x30')]:_0x371462[_0x7d38('0x2f')];if(_0x25de27[_0x7d38('0x2d')][_0x7d38('0x41')]){_0x236ed9[_0x7d38('0x42')]=[{'all':!![]}];}_0x236ed9=_[_0x7d38('0x39')]({},_0x236ed9,_0x25de27[_0x7d38('0x43')]);return db['Attachment'][_0x7d38('0x44')](_0x236ed9)[_0x7d38('0x21')](handleEntityNotFound(_0x51d563,null))[_0x7d38('0x21')](function(_0x5048cc){if(_0x5048cc){var _0x5b45a9=_0x5048cc[_0x7d38('0x45')]({'plain':!![]});_0x5b45a9=qs['omit'](_0x5b45a9,['id','createdAt',_0x7d38('0x46')]);_0x25de27[_0x7d38('0x47')]=_[_0x7d38('0x48')](_0x25de27[_0x7d38('0x47')],['id','createdAt',_0x7d38('0x46')]);return db[_0x7d38('0x28')][_0x7d38('0x49')](_['merge'](_0x5b45a9,_0x25de27[_0x7d38('0x47')]),{'include':_0x25de27[_0x7d38('0x2d')][_0x7d38('0x41')]?[{'all':!![]}]:undefined});}})[_0x7d38('0x21')](respondWithResult(_0x51d563,0xc9))[_0x7d38('0x3e')](handleError(_0x51d563,null));};exports[_0x7d38('0x20')]=function(_0x382a94,_0x3f287b){if(_0x382a94['body']['id']){delete _0x382a94['body']['id'];}return db[_0x7d38('0x28')][_0x7d38('0x44')]({'where':{'id':_0x382a94[_0x7d38('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f287b,null))[_0x7d38('0x21')](saveUpdates(_0x382a94['body'],null))[_0x7d38('0x21')](respondWithResult(_0x3f287b,null))[_0x7d38('0x3e')](handleError(_0x3f287b,null));};exports['destroy']=function(_0x3e4145,_0x28be2a){return db[_0x7d38('0x28')][_0x7d38('0x44')]({'where':{'id':_0x3e4145[_0x7d38('0x40')]['id']}})[_0x7d38('0x21')](handleEntityNotFound(_0x28be2a,null))[_0x7d38('0x21')](removeEntity(_0x28be2a,null))[_0x7d38('0x3e')](handleError(_0x28be2a,null));};exports['create']=function(_0x1b92d6,_0x1c9e80,_0x27fb3c){_0x1b92d6['body']['name']=_0x1b92d6[_0x7d38('0x4a')][_0x7d38('0x4b')];_0x1b92d6[_0x7d38('0x47')][_0x7d38('0x4c')]=_0x1b92d6[_0x7d38('0x4a')][_0x7d38('0x4d')];_0x1b92d6[_0x7d38('0x47')][_0x7d38('0x4e')]=_0x1b92d6['file'][_0x7d38('0x4f')];return db['Attachment'][_0x7d38('0x49')](_0x1b92d6['body'])['then'](respondWithResult(_0x1c9e80,0xc9))[_0x7d38('0x3e')](handleError(_0x1c9e80,null));};exports[_0x7d38('0x50')]=function(_0x45d099,_0x2e3f0e,_0x5695a5){return db[_0x7d38('0x28')][_0x7d38('0x51')]({'where':{'id':_0x45d099[_0x7d38('0x40')]['id']},'raw':!![]})[_0x7d38('0x21')](handleEntityNotFound(_0x2e3f0e,null))['then'](function(_0x13d7c5){if(_0x13d7c5){var _0x4537af=_0x13d7c5[_0x7d38('0x52')]!==null;var _0x209053=path['join'](config[_0x7d38('0x53')],_0x7d38('0x54'));if(_0x4537af){_0x209053=path['join'](_0x209053,_0x7d38('0x55'));}var _0x311e62=path[_0x7d38('0x56')](_0x209053,_0x13d7c5[_0x7d38('0x4c')]);return _0x2e3f0e[_0x7d38('0x50')](_0x311e62);}})[_0x7d38('0x3e')](handleError(_0x2e3f0e,null));}; \ No newline at end of file +var _0xf1d9=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','Attachment','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','then','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','options','find','clone','params','get','updatedAt','body','createdAt','create','file','originalname','basename','filename','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0xf1d9,0x1a9));var _0x9f1d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1d9[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9f1d('0x0'));var rimraf=require(_0x9f1d('0x1'));var zipdir=require(_0x9f1d('0x2'));var jsonpatch=require(_0x9f1d('0x3'));var rp=require(_0x9f1d('0x4'));var moment=require(_0x9f1d('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9f1d('0x6'));var util=require(_0x9f1d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x9f1d('0x8'));var ejs=require(_0x9f1d('0x9'));var fs=require('fs');var fs_extra=require(_0x9f1d('0xa'));var _=require(_0x9f1d('0xb'));var squel=require('squel');var crypto=require(_0x9f1d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f1d('0xd'));var toCsv=require(_0x9f1d('0x8'));var querystring=require('querystring');var Papa=require(_0x9f1d('0xe'));var Redis=require(_0x9f1d('0xf'));var authService=require(_0x9f1d('0x10'));var qs=require(_0x9f1d('0x11'));var as=require(_0x9f1d('0x12'));var hardwareService=require(_0x9f1d('0x13'));var logger=require(_0x9f1d('0x14'))(_0x9f1d('0x15'));var utils=require(_0x9f1d('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9f1d('0x17'));var db=require(_0x9f1d('0x18'))['db'];function respondWithStatusCode(_0x5e28dc,_0x205f19){_0x205f19=_0x205f19||0xcc;return function(_0x58791d){if(_0x58791d){return _0x5e28dc[_0x9f1d('0x19')](_0x205f19);}return _0x5e28dc['status'](_0x205f19)[_0x9f1d('0x1a')]();};}function respondWithResult(_0x5a7564,_0x2501fd){_0x2501fd=_0x2501fd||0xc8;return function(_0x47bba3){if(_0x47bba3){return _0x5a7564[_0x9f1d('0x1b')](_0x2501fd)[_0x9f1d('0x1c')](_0x47bba3);}};}function respondWithFilteredResult(_0x4855d4,_0x5140a5){return function(_0x32d667){if(_0x32d667){var _0x4966f6=typeof _0x5140a5['offset']==='undefined'&&typeof _0x5140a5['limit']==='undefined';var _0x542ad5=_0x32d667[_0x9f1d('0x1d')];var _0x33a1d3=_0x4966f6?0x0:_0x5140a5[_0x9f1d('0x1e')];var _0x24a270=_0x4966f6?_0x32d667['count']:_0x5140a5[_0x9f1d('0x1e')]+_0x5140a5[_0x9f1d('0x1f')];var _0x431f98;if(_0x24a270>=_0x542ad5){_0x24a270=_0x542ad5;_0x431f98=0xc8;}else{_0x431f98=0xce;}_0x4855d4[_0x9f1d('0x1b')](_0x431f98);return _0x4855d4[_0x9f1d('0x20')](_0x9f1d('0x21'),_0x33a1d3+'-'+_0x24a270+'/'+_0x542ad5)[_0x9f1d('0x1c')](_0x32d667);}return null;};}function patchUpdates(_0xdadd76){return function(_0x9382af){try{jsonpatch['apply'](_0x9382af,_0xdadd76,!![]);}catch(_0x39e9b9){return BPromise[_0x9f1d('0x22')](_0x39e9b9);}return _0x9382af[_0x9f1d('0x23')]();};}function saveUpdates(_0x172803,_0x3fcdf1){return function(_0xf95710){if(_0xf95710){return _0xf95710[_0x9f1d('0x24')](_0x172803)['then'](function(_0x2cf093){return _0x2cf093;});}return null;};}function removeEntity(_0x32adbf,_0x199a03){return function(_0xec41b5){if(_0xec41b5){return _0xec41b5[_0x9f1d('0x25')]()['then'](function(){_0x32adbf[_0x9f1d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7264da,_0x5dea66){return function(_0x3a6d63){if(!_0x3a6d63){_0x7264da[_0x9f1d('0x19')](0x194);}return _0x3a6d63;};}function handleError(_0x209691,_0x29ef53){_0x29ef53=_0x29ef53||0x1f4;return function(_0x3304fc){logger[_0x9f1d('0x26')](_0x3304fc[_0x9f1d('0x27')]);if(_0x3304fc['name']){delete _0x3304fc[_0x9f1d('0x28')];}_0x209691[_0x9f1d('0x1b')](_0x29ef53)[_0x9f1d('0x29')](_0x3304fc);};}exports[_0x9f1d('0x2a')]=function(_0xbdf40d,_0x2a538a){var _0x5a1e9e={},_0x5b87e1={},_0xe5425b={'count':0x0,'rows':[]};var _0x8c25ce=_[_0x9f1d('0x2b')](db[_0x9f1d('0x2c')]['rawAttributes'],function(_0x1387a8){return{'name':_0x1387a8['fieldName'],'type':_0x1387a8['type']['key']};});_0x5b87e1[_0x9f1d('0x2d')]=_[_0x9f1d('0x2b')](_0x8c25ce,_0x9f1d('0x28'));_0x5b87e1[_0x9f1d('0x2e')]=_['keys'](_0xbdf40d[_0x9f1d('0x2e')]);_0x5b87e1[_0x9f1d('0x2f')]=_[_0x9f1d('0x30')](_0x5b87e1[_0x9f1d('0x2d')],_0x5b87e1[_0x9f1d('0x2e')]);_0x5a1e9e['attributes']=_['intersection'](_0x5b87e1[_0x9f1d('0x2d')],qs[_0x9f1d('0x31')](_0xbdf40d[_0x9f1d('0x2e')]['fields']));_0x5a1e9e['attributes']=_0x5a1e9e[_0x9f1d('0x32')][_0x9f1d('0x33')]?_0x5a1e9e[_0x9f1d('0x32')]:_0x5b87e1['model'];if(!_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x34')](_0x9f1d('0x35'))){_0x5a1e9e[_0x9f1d('0x1f')]=qs[_0x9f1d('0x1f')](_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x1f')]);_0x5a1e9e[_0x9f1d('0x1e')]=qs[_0x9f1d('0x1e')](_0xbdf40d[_0x9f1d('0x2e')]['offset']);}_0x5a1e9e[_0x9f1d('0x36')]=qs['sort'](_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x37')]);_0x5a1e9e[_0x9f1d('0x38')]=qs[_0x9f1d('0x2f')](_['pick'](_0xbdf40d[_0x9f1d('0x2e')],_0x5b87e1[_0x9f1d('0x2f')]),_0x8c25ce);if(_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x39')]){_0x5a1e9e[_0x9f1d('0x38')]=_[_0x9f1d('0x3a')](_0x5a1e9e['where'],{'$or':_[_0x9f1d('0x2b')](_0x8c25ce,function(_0x1567c2){if(_0x1567c2[_0x9f1d('0x3b')]!==_0x9f1d('0x3c')){var _0x1a3c99={};_0x1a3c99[_0x1567c2['name']]={'$like':'%'+_0xbdf40d[_0x9f1d('0x2e')]['filter']+'%'};return _0x1a3c99;}})});}_0x5a1e9e=_[_0x9f1d('0x3a')]({},_0x5a1e9e,_0xbdf40d['options']);var _0x498141={'where':_0x5a1e9e[_0x9f1d('0x38')]};return db['Attachment'][_0x9f1d('0x1d')](_0x498141)[_0x9f1d('0x3d')](function(_0xfaf88a){_0xe5425b[_0x9f1d('0x1d')]=_0xfaf88a;if(_0xbdf40d[_0x9f1d('0x2e')][_0x9f1d('0x3e')]){_0x5a1e9e[_0x9f1d('0x3f')]=[{'all':!![]}];}return db['Attachment'][_0x9f1d('0x40')](_0x5a1e9e);})[_0x9f1d('0x3d')](function(_0x5a1992){_0xe5425b[_0x9f1d('0x41')]=_0x5a1992;return _0xe5425b;})['then'](respondWithFilteredResult(_0x2a538a,_0x5a1e9e))[_0x9f1d('0x42')](handleError(_0x2a538a,null));};exports[_0x9f1d('0x43')]=function(_0x23ca40,_0x73260b){var _0x56cef3={'raw':!![],'where':{'id':_0x23ca40['params']['id']}},_0x383ef5={};_0x383ef5[_0x9f1d('0x2d')]=_['keys'](db[_0x9f1d('0x2c')][_0x9f1d('0x44')]);_0x383ef5['query']=_[_0x9f1d('0x45')](_0x23ca40[_0x9f1d('0x2e')]);_0x383ef5[_0x9f1d('0x2f')]=_[_0x9f1d('0x30')](_0x383ef5[_0x9f1d('0x2d')],_0x383ef5[_0x9f1d('0x2e')]);_0x56cef3[_0x9f1d('0x32')]=_['intersection'](_0x383ef5[_0x9f1d('0x2d')],qs['fields'](_0x23ca40[_0x9f1d('0x2e')][_0x9f1d('0x31')]));_0x56cef3[_0x9f1d('0x32')]=_0x56cef3['attributes'][_0x9f1d('0x33')]?_0x56cef3[_0x9f1d('0x32')]:_0x383ef5['model'];if(_0x23ca40[_0x9f1d('0x2e')][_0x9f1d('0x3e')]){_0x56cef3[_0x9f1d('0x3f')]=[{'all':!![]}];}_0x56cef3=_[_0x9f1d('0x3a')]({},_0x56cef3,_0x23ca40[_0x9f1d('0x46')]);return db[_0x9f1d('0x2c')][_0x9f1d('0x47')](_0x56cef3)[_0x9f1d('0x3d')](handleEntityNotFound(_0x73260b,null))[_0x9f1d('0x3d')](respondWithResult(_0x73260b,null))['catch'](handleError(_0x73260b,null));};exports[_0x9f1d('0x48')]=function(_0x171b4d,_0x4905a3){var _0x22a3af={'where':{'id':_0x171b4d[_0x9f1d('0x49')]['id']}},_0x29ad15={};_0x29ad15['model']=_[_0x9f1d('0x45')](db[_0x9f1d('0x2c')][_0x9f1d('0x44')]);_0x22a3af[_0x9f1d('0x32')]=_[_0x9f1d('0x30')](_0x29ad15[_0x9f1d('0x2d')],qs[_0x9f1d('0x31')](_0x171b4d[_0x9f1d('0x2e')][_0x9f1d('0x31')]));_0x22a3af[_0x9f1d('0x32')]=_0x22a3af[_0x9f1d('0x32')][_0x9f1d('0x33')]?_0x22a3af[_0x9f1d('0x32')]:_0x29ad15[_0x9f1d('0x2d')];if(_0x171b4d[_0x9f1d('0x2e')]['includeAll']){_0x22a3af[_0x9f1d('0x3f')]=[{'all':!![]}];}_0x22a3af=_[_0x9f1d('0x3a')]({},_0x22a3af,_0x171b4d['options']);return db[_0x9f1d('0x2c')][_0x9f1d('0x47')](_0x22a3af)['then'](handleEntityNotFound(_0x4905a3,null))[_0x9f1d('0x3d')](function(_0x5e414d){if(_0x5e414d){var _0x3d1f6a=_0x5e414d[_0x9f1d('0x4a')]({'plain':!![]});_0x3d1f6a=qs['omit'](_0x3d1f6a,['id','createdAt',_0x9f1d('0x4b')]);_0x171b4d[_0x9f1d('0x4c')]=_['omit'](_0x171b4d[_0x9f1d('0x4c')],['id',_0x9f1d('0x4d'),_0x9f1d('0x4b')]);return db[_0x9f1d('0x2c')][_0x9f1d('0x4e')](_[_0x9f1d('0x3a')](_0x3d1f6a,_0x171b4d[_0x9f1d('0x4c')]),{'include':_0x171b4d[_0x9f1d('0x2e')]['includeAll']?[{'all':!![]}]:undefined});}})[_0x9f1d('0x3d')](respondWithResult(_0x4905a3,0xc9))[_0x9f1d('0x42')](handleError(_0x4905a3,null));};exports[_0x9f1d('0x24')]=function(_0xbf603b,_0x861258){if(_0xbf603b['body']['id']){delete _0xbf603b[_0x9f1d('0x4c')]['id'];}return db[_0x9f1d('0x2c')]['find']({'where':{'id':_0xbf603b[_0x9f1d('0x49')]['id']}})[_0x9f1d('0x3d')](handleEntityNotFound(_0x861258,null))[_0x9f1d('0x3d')](saveUpdates(_0xbf603b[_0x9f1d('0x4c')],null))[_0x9f1d('0x3d')](respondWithResult(_0x861258,null))[_0x9f1d('0x42')](handleError(_0x861258,null));};exports['destroy']=function(_0x1a4fb0,_0x197eaa){return db[_0x9f1d('0x2c')][_0x9f1d('0x47')]({'where':{'id':_0x1a4fb0[_0x9f1d('0x49')]['id']}})[_0x9f1d('0x3d')](handleEntityNotFound(_0x197eaa,null))[_0x9f1d('0x3d')](removeEntity(_0x197eaa,null))[_0x9f1d('0x42')](handleError(_0x197eaa,null));};exports['create']=function(_0xfbb8c5,_0x5cdc31,_0x30ddf7){_0xfbb8c5[_0x9f1d('0x4c')]['name']=_0xfbb8c5[_0x9f1d('0x4f')][_0x9f1d('0x50')];_0xfbb8c5['body'][_0x9f1d('0x51')]=_0xfbb8c5[_0x9f1d('0x4f')][_0x9f1d('0x52')];_0xfbb8c5[_0x9f1d('0x4c')][_0x9f1d('0x3b')]=_0xfbb8c5[_0x9f1d('0x4f')]['mimetype'];return db[_0x9f1d('0x2c')]['create'](_0xfbb8c5[_0x9f1d('0x4c')])[_0x9f1d('0x3d')](respondWithResult(_0x5cdc31,0xc9))[_0x9f1d('0x42')](handleError(_0x5cdc31,null));};exports['download']=function(_0xd6089a,_0x4568f1,_0x38bf92){return db[_0x9f1d('0x2c')][_0x9f1d('0x53')]({'where':{'id':_0xd6089a[_0x9f1d('0x49')]['id']},'raw':!![]})[_0x9f1d('0x3d')](handleEntityNotFound(_0x4568f1,null))[_0x9f1d('0x3d')](function(_0xeaa598){if(_0xeaa598){var _0x498890=_0xeaa598[_0x9f1d('0x54')]!==null;var _0x5e6163=path[_0x9f1d('0x55')](config[_0x9f1d('0x56')],_0x9f1d('0x57'));if(_0x498890){_0x5e6163=path[_0x9f1d('0x55')](_0x5e6163,'offline-chat/');}var _0x5a759e=path[_0x9f1d('0x55')](_0x5e6163,_0xeaa598[_0x9f1d('0x51')]);return _0x4568f1[_0x9f1d('0x58')](_0x5a759e);}})[_0x9f1d('0x42')](handleError(_0x4568f1,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 2a519f5..5569d09 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 _0x4824=['define','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x55ea33,_0x448c1e){var _0x3e4081=function(_0x290b02){while(--_0x290b02){_0x55ea33['push'](_0x55ea33['shift']());}};_0x3e4081(++_0x448c1e);}(_0x4824,0xd9));var _0x4482=function(_0x23ed50,_0x483c69){_0x23ed50=_0x23ed50-0x0;var _0x1eff7d=_0x4824[_0x23ed50];return _0x1eff7d;};'use strict';var _=require(_0x4482('0x0'));var util=require(_0x4482('0x1'));var logger=require(_0x4482('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4482('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4482('0x4'));var rimraf=require(_0x4482('0x5'));var config=require(_0x4482('0x6'));var attributes=require(_0x4482('0x7'));module['exports']=function(_0xa645fc,_0x3fe9fb){return _0xa645fc[_0x4482('0x8')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc978=['request-promise','path','../../config/environment','./attachment.attributes','exports','define','lodash','api','moment','bluebird'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0xc978,0xce));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rp=require(_0x8c97('0x4'));var fs=require('fs');var path=require(_0x8c97('0x5'));var rimraf=require('rimraf');var config=require(_0x8c97('0x6'));var attributes=require(_0x8c97('0x7'));module[_0x8c97('0x8')]=function(_0x398d4c,_0x145a9e){return _0x398d4c[_0x8c97('0x9')]('Attachment',attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index b678bc8..2cc7a6e 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','options','raw'];(function(_0x2f0bfc,_0x1e0d82){var _0x2e4ed1=function(_0x1f3821){while(--_0x1f3821){_0x2f0bfc['push'](_0x2f0bfc['shift']());}};_0x2e4ed1(++_0x1e0d82);}(_0x34e8,0x12c));var _0x834e=function(_0x39bd93,_0x1cd986){_0x39bd93=_0x39bd93-0x0;var _0x368ce7=_0x34e8[_0x39bd93];return _0x368ce7;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('Attachment,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('Attachment,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});}exports[_0x834e('0x19')]=function(_0x211e9a){var _0x34e41a=this;return new Promise(function(_0xb993a1,_0x237947){return db[_0x834e('0x1a')][_0x834e('0x1b')](_0x211e9a['body'],{'raw':_0x211e9a[_0x834e('0x1c')]?_0x211e9a[_0x834e('0x1c')][_0x834e('0x1d')]===undefined?!![]:![]:!![]})[_0x834e('0xd')](function(_0x4ab05d){logger[_0x834e('0xe')](_0x834e('0x19'),_0x211e9a);logger['debug'](_0x834e('0x19'),_0x211e9a,JSON[_0x834e('0x13')](_0x4ab05d));_0xb993a1(_0x4ab05d);})[_0x834e('0x18')](function(_0x5c55ca){logger['error'](_0x834e('0x19'),_0x5c55ca[_0x834e('0x16')],_0x211e9a);_0x237947(_0x34e41a['error'](0x1f4,_0x5c55ca[_0x834e('0x16')]));});});}; \ No newline at end of file +var _0xeea4=['Attachment,\x20%s,\x20%s','message','result','CreateAttachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29e401,_0x4d374d){var _0x4d8b63=function(_0x1a3225){while(--_0x1a3225){_0x29e401['push'](_0x29e401['shift']());}};_0x4d8b63(++_0x4d374d);}(_0xeea4,0x19e));var _0x4eea=function(_0x278fd6,_0x4cd636){_0x278fd6=_0x278fd6-0x0;var _0x1d24ba=_0xeea4[_0x278fd6];return _0x1d24ba;};'use strict';var _=require(_0x4eea('0x0'));var util=require(_0x4eea('0x1'));var moment=require(_0x4eea('0x2'));var BPromise=require(_0x4eea('0x3'));var rs=require(_0x4eea('0x4'));var fs=require('fs');var Redis=require(_0x4eea('0x5'));var db=require(_0x4eea('0x6'))['db'];var utils=require(_0x4eea('0x7'));var logger=require(_0x4eea('0x8'))('rpc');var config=require(_0x4eea('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4eea('0xa')][_0x4eea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d5aa8,_0x48538e,_0x1a2e5e){return new BPromise(function(_0x44116a,_0x4cc630){return client[_0x4eea('0xc')](_0x3d5aa8,_0x1a2e5e)[_0x4eea('0xd')](function(_0x2bba91){logger[_0x4eea('0xe')]('Attachment,\x20%s,\x20%s',_0x48538e,_0x4eea('0xf'));logger[_0x4eea('0x10')](_0x4eea('0x11'),_0x48538e,_0x4eea('0xf'),JSON[_0x4eea('0x12')](_0x2bba91));if(_0x2bba91[_0x4eea('0x13')]){if(_0x2bba91[_0x4eea('0x13')][_0x4eea('0x14')]===0x1f4){logger[_0x4eea('0x13')](_0x4eea('0x15'),_0x48538e,_0x2bba91['error']['message']);return _0x4cc630(_0x2bba91[_0x4eea('0x13')][_0x4eea('0x16')]);}logger[_0x4eea('0x13')](_0x4eea('0x15'),_0x48538e,_0x2bba91[_0x4eea('0x13')][_0x4eea('0x16')]);return _0x44116a(_0x2bba91[_0x4eea('0x13')][_0x4eea('0x16')]);}else{logger['info'](_0x4eea('0x15'),_0x48538e,_0x4eea('0xf'));_0x44116a(_0x2bba91[_0x4eea('0x17')][_0x4eea('0x16')]);}})['catch'](function(_0x446474){logger[_0x4eea('0x13')](_0x4eea('0x15'),_0x48538e,_0x446474);_0x4cc630(_0x446474);});});}exports[_0x4eea('0x18')]=function(_0x27a227){var _0x5bd90b=this;return new Promise(function(_0x1571f3,_0x29de0e){return db['Attachment'][_0x4eea('0x19')](_0x27a227[_0x4eea('0x1a')],{'raw':_0x27a227[_0x4eea('0x1b')]?_0x27a227[_0x4eea('0x1b')][_0x4eea('0x1c')]===undefined?!![]:![]:!![]})[_0x4eea('0xd')](function(_0x56fefc){logger[_0x4eea('0xe')](_0x4eea('0x18'),_0x27a227);logger[_0x4eea('0x10')](_0x4eea('0x18'),_0x27a227,JSON[_0x4eea('0x12')](_0x56fefc));_0x1571f3(_0x56fefc);})['catch'](function(_0x4898e8){logger[_0x4eea('0x13')]('CreateAttachment',_0x4898e8['message'],_0x27a227);_0x29de0e(_0x5bd90b['error'](0x1f4,_0x4898e8[_0x4eea('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 346b227..d5d41d1 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['put','/:id','update','delete','destroy','exports','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','post','/:id/clone','clone','diskStorage','%s-%s','replace','single','file','create'];(function(_0x5891f6,_0x280aef){var _0x33114b=function(_0x580fd8){while(--_0x580fd8){_0x5891f6['push'](_0x5891f6['shift']());}};_0x33114b(++_0x280aef);}(_0x757a,0xde));var _0xa757=function(_0x18f693,_0x312616){_0x18f693=_0x18f693-0x0;var _0x13a5c9=_0x757a[_0x18f693];return _0x13a5c9;};'use strict';var multer=require('multer');var util=require(_0xa757('0x0'));var path=require(_0xa757('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa757('0x2'));var auth=require(_0xa757('0x3'));var interaction=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var controller=require(_0xa757('0x6'));router[_0xa757('0x7')]('/',auth['isAuthenticated'](),controller[_0xa757('0x8')]);router[_0xa757('0x7')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0xa')]);router[_0xa757('0x7')](_0xa757('0xb'),auth[_0xa757('0x9')](),controller['download']);router[_0xa757('0xc')](_0xa757('0xd'),auth[_0xa757('0x9')](),controller[_0xa757('0xe')]);var upload=multer({'storage':multer[_0xa757('0xf')]({'destination':function(_0x188ad5,_0x17408b,_0x483d77){_0x483d77(null,path['join'](config['root'],'server/files/attachments/'));},'filename':function(_0x4db68e,_0x421040,_0x544b45){_0x544b45(null,util['format'](_0xa757('0x10'),Date['now'](),_0x421040['originalname'][_0xa757('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xa757('0xc')]('/',upload[_0xa757('0x12')](_0xa757('0x13')),controller[_0xa757('0x14')]);router[_0xa757('0x15')](_0xa757('0x16'),auth[_0xa757('0x9')](),controller[_0xa757('0x17')]);router[_0xa757('0x18')]('/:id',auth[_0xa757('0x9')](),controller[_0xa757('0x19')]);module[_0xa757('0x1a')]=router; \ No newline at end of file +var _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(_0x1aece3,_0x1360b7){_0x1aece3=_0x1aece3-0x0;var _0x7f3a5a=_0xdb28[_0x1aece3];return _0x7f3a5a;};'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 1e1e60b..0370564 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 _0x697e=['status','send','message','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','online','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../config/environment','activedirectory','undefined','baseDN','url','authenticate','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','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','disabled','blocked','admin','agent','domain','blockedAt','clearBlockUser','getLicense','catch'];(function(_0x2a5bc6,_0x4f72e3){var _0x22348a=function(_0x4bb6a6){while(--_0x4bb6a6){_0x2a5bc6['push'](_0x2a5bc6['shift']());}};_0x22348a(++_0x4f72e3);}(_0x697e,0x178));var _0xe697=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x697e[_0x20a584];return _0x4b41a8;};'use strict';var passport=require(_0xe697('0x0'));var LocalStrategy=require(_0xe697('0x1'))[_0xe697('0x2')];var moment=require(_0xe697('0x3'));var ActiveDirectory=require(_0xe697('0x4'));var BPromise=require(_0xe697('0x5'));var util=require(_0xe697('0x6'));var db=require(_0xe697('0x7'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xe697('0x8'));var logger=require('../../config/logger')('api');function isActiveDirectoryConfigured(_0x4908df){var _0x2cfd52=![];if(typeof _0x4908df[_0xe697('0x9')]!==_0xe697('0xa')){_0x2cfd52=_0x4908df['activedirectory'][_0xe697('0xb')]&&_0x4908df[_0xe697('0x9')][_0xe697('0xc')]&&_0x4908df[_0xe697('0x9')]['domain'];}return _0x2cfd52;}function adAuthenticate(_0x5c845d,_0x33787b,_0x713797){return new BPromise(function(_0x390a7a,_0x53daef){try{var _0x341b76=new ActiveDirectory(_0x5c845d);_0x341b76[_0xe697('0xd')](_0x33787b,_0x713797,function(_0x1bc10e,_0x4286ef){if(_0x1bc10e){logger['error'](_0xe697('0xe'),_0x33787b,util[_0xe697('0xf')](_0x1bc10e,{'showHidden':![],'depth':null}));_0x53daef(_0xe697('0x10'));}else if(!_0x4286ef){logger['error'](_0xe697('0x11'),_0x33787b);_0x53daef(_0xe697('0x10'));}else{_0x390a7a(_0x4286ef);}});}catch(_0x142140){_0x53daef(_0x142140);}});}function ActiveDirectoryAuthenticate(_0x2abd5d,_0x25cc29,_0x31a514,_0x203e48){var _0x12128d,_0x5ce42c;if(!isActiveDirectoryConfigured(config)){logger['error'](_0xe697('0x12'),_0x25cc29);return _0x203e48(null,![],{'message':_0xe697('0x10')});}return db[_0xe697('0x13')][_0xe697('0x14')]({'where':{'id':0x1},'attributes':[_0xe697('0x15'),_0xe697('0x16')],'raw':!![]})[_0xe697('0x17')](function(_0x37f417){_0x12128d=_0x37f417;if(!_0x12128d[_0xe697('0x15')]){logger['error'](_0xe697('0x18'),_0x25cc29);throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return _0x2abd5d['findOne']({'attributes':['id',_0xe697('0x19'),_0xe697('0x1a'),_0xe697('0x1b'),_0xe697('0x1c'),_0xe697('0x1d'),_0xe697('0x1e'),'blockedAt','online'],'where':{'name':_0x25cc29,'role':{'$or':[_0xe697('0x1f'),'user',_0xe697('0x20')]},'adSsoEnabled':!![]}});})['then'](function(_0x26b78d){if(!_0x26b78d||_0x26b78d&&_0x26b78d[_0xe697('0x19')]!==_0x25cc29){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5ce42c=_0x26b78d;var _0xfd7965=_0x5ce42c[_0xe697('0x19')]+'@'+config[_0xe697('0x9')][_0xe697('0x21')];return adAuthenticate(config['activedirectory'],_0xfd7965,_0x31a514);})[_0xe697('0x17')](function(_0x15746f){if(_0x5ce42c[_0xe697('0x1d')]){throw new Error(_0xe697('0x10'));}if(_0x12128d[_0xe697('0x16')]>0x0){if(_0x5ce42c[_0xe697('0x1e')]){if(moment(_0x5ce42c[_0xe697('0x22')])['add'](_0x12128d[_0xe697('0x16')],'minutes')>moment()){throw new Error(_0xe697('0x10'));}return utils[_0xe697('0x23')](_0x5ce42c,0x0,![],null)[_0xe697('0x17')](function(){return utils['getLicense'](_0x5ce42c);})[_0xe697('0x17')](function(){return _0x203e48(null,_0x5ce42c);});}else{return utils[_0xe697('0x24')](_0x5ce42c)[_0xe697('0x17')](function(){return _0x203e48(null,_0x5ce42c);});}}else{return utils['getLicense'](_0x5ce42c)[_0xe697('0x17')](function(){return _0x203e48(null,_0x5ce42c);});}})[_0xe697('0x25')](function(_0x120230){return _0x203e48(null,![],_0x120230);});}function handleError(_0x17e16e,_0x522236,_0x1e9817){return _0x17e16e[_0xe697('0x26')](_0x522236||0x1f4)[_0xe697('0x27')]({'message':_0x1e9817?_0x1e9817[_0xe697('0x28')]||_0x1e9817:''});}exports[_0xe697('0x29')]=function(_0x117bc4,_0x50e40f,_0x22ff8c){passport[_0xe697('0xd')]('ad-login',function(_0x570ae1,_0x4c9381,_0x57840e){var _0x1e8574=_0x570ae1||_0x57840e;if(_0x1e8574){return handleError(_0x50e40f,0x191,_0x1e8574);}if(!_0x4c9381){return handleError(_0x50e40f,0x194,{'message':_0xe697('0x2a')});}else{var _0x1f2f1c={'payload':{'id':_0x4c9381['id'],'role':_0x4c9381['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1f2f1c)[_0xe697('0x17')](function(_0x2ddec3){_0x50e40f['json']({'id':_0x4c9381['id'],'token':_0x2ddec3,'statusCall':'','isAlreadyLogged':_0x4c9381[_0xe697('0x2b')]});});}})(_0x117bc4,_0x50e40f,_0x22ff8c);};passport['use'](_0xe697('0x2c'),new LocalStrategy({'usernameField':_0xe697('0x19'),'passwordField':_0xe697('0x1a')},function(_0x2bb42e,_0x3927d1,_0x5fdd92){return ActiveDirectoryAuthenticate(db[_0xe697('0x2d')],_0x2bb42e,_0x3927d1,_0x5fdd92);})); \ No newline at end of file +var _0xc3ef=['online','User','passport','moment','activedirectory2','bluebird','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','role','disabled','blocked','blockedAt','admin','user','agent','add','minutes','clearBlockUser','getLicense','status','send','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x59b589,_0x11a824){var _0x4782d6=function(_0x24aa49){while(--_0x24aa49){_0x59b589['push'](_0x59b589['shift']());}};_0x4782d6(++_0x11a824);}(_0xc3ef,0x122));var _0xfc3e=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xc3ef[_0x8c43de];return _0xa6591b;};'use strict';var passport=require(_0xfc3e('0x0'));var LocalStrategy=require('passport-local')['Strategy'];var moment=require(_0xfc3e('0x1'));var ActiveDirectory=require(_0xfc3e('0x2'));var BPromise=require(_0xfc3e('0x3'));var util=require('util');var db=require(_0xfc3e('0x4'))['db'];var authService=require(_0xfc3e('0x5'));var utils=require(_0xfc3e('0x6'));var config=require('../../config/environment');var logger=require(_0xfc3e('0x7'))(_0xfc3e('0x8'));function isActiveDirectoryConfigured(_0x419560){var _0x531371=![];if(typeof _0x419560[_0xfc3e('0x9')]!=='undefined'){_0x531371=_0x419560['activedirectory'][_0xfc3e('0xa')]&&_0x419560[_0xfc3e('0x9')][_0xfc3e('0xb')]&&_0x419560[_0xfc3e('0x9')][_0xfc3e('0xc')];}return _0x531371;}function adAuthenticate(_0x48acb3,_0x31f208,_0x24cfbc){return new BPromise(function(_0x5e9e92,_0x514c5e){try{var _0x3246de=new ActiveDirectory(_0x48acb3);_0x3246de[_0xfc3e('0xd')](_0x31f208,_0x24cfbc,function(_0x55e343,_0x5448e4){if(_0x55e343){logger[_0xfc3e('0xe')](_0xfc3e('0xf'),_0x31f208,util[_0xfc3e('0x10')](_0x55e343,{'showHidden':![],'depth':null}));_0x514c5e(_0xfc3e('0x11'));}else if(!_0x5448e4){logger[_0xfc3e('0xe')]('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x31f208);_0x514c5e(_0xfc3e('0x11'));}else{_0x5e9e92(_0x5448e4);}});}catch(_0x2eb7d2){_0x514c5e(_0x2eb7d2);}});}function ActiveDirectoryAuthenticate(_0x16bcf9,_0x4fabdf,_0x4ce346,_0x456c21){var _0x3dd3f5,_0x479d37;if(!isActiveDirectoryConfigured(config)){logger[_0xfc3e('0xe')](_0xfc3e('0x12'),_0x4fabdf);return _0x456c21(null,![],{'message':_0xfc3e('0x11')});}return db[_0xfc3e('0x13')][_0xfc3e('0x14')]({'where':{'id':0x1},'attributes':[_0xfc3e('0x15'),_0xfc3e('0x16')],'raw':!![]})[_0xfc3e('0x17')](function(_0x257cdc){_0x3dd3f5=_0x257cdc;if(!_0x3dd3f5[_0xfc3e('0x15')]){logger[_0xfc3e('0xe')](_0xfc3e('0x18'),_0x4fabdf);throw new Error(_0xfc3e('0x11'));}return _0x16bcf9[_0xfc3e('0x14')]({'attributes':['id',_0xfc3e('0x19'),_0xfc3e('0x1a'),'salt',_0xfc3e('0x1b'),_0xfc3e('0x1c'),_0xfc3e('0x1d'),_0xfc3e('0x1e'),'online'],'where':{'name':_0x4fabdf,'role':{'$or':[_0xfc3e('0x1f'),_0xfc3e('0x20'),_0xfc3e('0x21')]},'adSsoEnabled':!![]}});})['then'](function(_0x4fd6f5){if(!_0x4fd6f5||_0x4fd6f5&&_0x4fd6f5['name']!==_0x4fabdf){throw new Error(_0xfc3e('0x11'));}_0x479d37=_0x4fd6f5;var _0x1ee6ca=_0x479d37['name']+'@'+config[_0xfc3e('0x9')]['domain'];return adAuthenticate(config['activedirectory'],_0x1ee6ca,_0x4ce346);})['then'](function(_0x4f4401){if(_0x479d37['disabled']){throw new Error(_0xfc3e('0x11'));}if(_0x3dd3f5[_0xfc3e('0x16')]>0x0){if(_0x479d37['blocked']){if(moment(_0x479d37['blockedAt'])[_0xfc3e('0x22')](_0x3dd3f5[_0xfc3e('0x16')],_0xfc3e('0x23'))>moment()){throw new Error(_0xfc3e('0x11'));}return utils[_0xfc3e('0x24')](_0x479d37,0x0,![],null)['then'](function(){return utils[_0xfc3e('0x25')](_0x479d37);})[_0xfc3e('0x17')](function(){return _0x456c21(null,_0x479d37);});}else{return utils['getLicense'](_0x479d37)['then'](function(){return _0x456c21(null,_0x479d37);});}}else{return utils[_0xfc3e('0x25')](_0x479d37)[_0xfc3e('0x17')](function(){return _0x456c21(null,_0x479d37);});}})['catch'](function(_0x409d5a){return _0x456c21(null,![],_0x409d5a);});}function handleError(_0x18499a,_0x471801,_0x20b82e){return _0x18499a[_0xfc3e('0x26')](_0x471801||0x1f4)[_0xfc3e('0x27')]({'message':_0x20b82e?_0x20b82e[_0xfc3e('0x28')]||_0x20b82e:''});}exports[_0xfc3e('0x29')]=function(_0x5e4423,_0x5dbea8,_0x261e92){passport[_0xfc3e('0xd')](_0xfc3e('0x2a'),function(_0x5bfeb2,_0x40e8fd,_0x5e5f31){var _0x216108=_0x5bfeb2||_0x5e5f31;if(_0x216108){return handleError(_0x5dbea8,0x191,_0x216108);}if(!_0x40e8fd){return handleError(_0x5dbea8,0x194,{'message':_0xfc3e('0x2b')});}else{var _0x164da0={'payload':{'id':_0x40e8fd['id'],'role':_0x40e8fd['role']},'options':{'expiresIn':0x15180}};return authService[_0xfc3e('0x2c')](_0x164da0)[_0xfc3e('0x17')](function(_0x96a76d){_0x5dbea8[_0xfc3e('0x2d')]({'id':_0x40e8fd['id'],'token':_0x96a76d,'statusCall':'','isAlreadyLogged':_0x40e8fd[_0xfc3e('0x2e')]});});}})(_0x5e4423,_0x5dbea8,_0x261e92);};passport['use'](_0xfc3e('0x2a'),new LocalStrategy({'usernameField':_0xfc3e('0x19'),'passwordField':_0xfc3e('0x1a')},function(_0x465689,_0x498ac8,_0xb3c188){return ActiveDirectoryAuthenticate(db[_0xfc3e('0x2f')],_0x465689,_0x498ac8,_0xb3c188);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index e61e5c3..814d631 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 _0x8202=['./authActiveDirectory.controller','post','login','exports','express'];(function(_0x5d9af0,_0x52930a){var _0x23ac2d=function(_0x35cdb6){while(--_0x35cdb6){_0x5d9af0['push'](_0x5d9af0['shift']());}};_0x23ac2d(++_0x52930a);}(_0x8202,0x1e9));var _0x2820=function(_0xf0abca,_0x23ccaf){_0xf0abca=_0xf0abca-0x0;var _0x242f10=_0x8202[_0xf0abca];return _0x242f10;};'use strict';var express=require(_0x2820('0x0'));var router=express['Router']();var controller=require(_0x2820('0x1'));router[_0x2820('0x2')]('/',controller[_0x2820('0x3')]);module[_0x2820('0x4')]=router; \ No newline at end of file +var _0xf1fc=['post','login','express','Router','./authActiveDirectory.controller'];(function(_0x5e4813,_0x21ef94){var _0x3a18b5=function(_0xe5348){while(--_0xe5348){_0x5e4813['push'](_0x5e4813['shift']());}};_0x3a18b5(++_0x21ef94);}(_0xf1fc,0xfc));var _0xcf1f=function(_0x51fdab,_0x25059f){_0x51fdab=_0x51fdab-0x0;var _0x5ddf22=_0xf1fc[_0x51fdab];return _0x5ddf22;};'use strict';var express=require(_0xcf1f('0x0'));var router=express[_0xcf1f('0x1')]();var controller=require(_0xcf1f('0x2'));router[_0xcf1f('0x3')]('/',controller[_0xcf1f('0x4')]);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 8a4efee..eff82f2 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','../../config/utils','login','google','/login','profile','email','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','Setting','findOne','allowedLoginAttempts','User','find','map','emails','value','admin','user','then','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blocked','blockedAt','add','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb'];(function(_0x428029,_0x1a5eb3){var _0x52033a=function(_0x5d73a8){while(--_0x5d73a8){_0x428029['push'](_0x428029['shift']());}};_0x52033a(++_0x1a5eb3);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var passport=require(_0x7995('0x1'));var GoogleStrategy=require(_0x7995('0x2'))[_0x7995('0x3')];var moment=require('moment');var db=require(_0x7995('0x4'))['db'];var config=require(_0x7995('0x5'));var utils=require(_0x7995('0x6'));exports[_0x7995('0x7')]=passport['authenticate'](_0x7995('0x8'),{'failureRedirect':_0x7995('0x9'),'scope':[_0x7995('0xa'),_0x7995('0xb')],'session':![]});exports[_0x7995('0xc')]=passport[_0x7995('0xd')]('google',{'failureRedirect':_0x7995('0x9'),'session':![]});passport[_0x7995('0xe')](new GoogleStrategy({'clientID':config['google']?config[_0x7995('0x8')][_0x7995('0xf')]:'id','clientSecret':config[_0x7995('0x8')]?config[_0x7995('0x8')][_0x7995('0x10')]:_0x7995('0x11'),'callbackURL':config[_0x7995('0x8')]?config['google'][_0x7995('0x12')]:''},function(_0x41c652,_0x581f22,_0xb0c872,_0x2cb37a){var _0x19a27e,_0x385f00;return db[_0x7995('0x13')][_0x7995('0x14')]({'where':{'id':0x1},'attributes':[_0x7995('0x15'),'blockDuration'],'raw':!![]})['then'](function(_0x2b4e94){_0x19a27e=_0x2b4e94;return db[_0x7995('0x16')][_0x7995('0x17')]({'where':{'email':_[_0x7995('0x18')](_0xb0c872[_0x7995('0x19')],_0x7995('0x1a')),'role':{'$or':[_0x7995('0x1b'),_0x7995('0x1c'),'agent']}}});})[_0x7995('0x1d')](function(_0x565d97){_0x385f00=_0x565d97;if(_0x385f00){if(_0x385f00[_0x7995('0x1e')]){return _0x2cb37a(_0x7995('0x1f'));}else if(_0x19a27e[_0x7995('0x20')]>0x0){if(_0x385f00[_0x7995('0x21')]){if(moment(_0x385f00[_0x7995('0x22')])[_0x7995('0x23')](_0x19a27e['blockDuration'],'minutes')>moment()){return _0x2cb37a(_0x7995('0x1f'));}else{return utils['clearBlockUser'](_0x385f00,0x0,![],null)['then'](function(){return utils[_0x7995('0x24')](_0x385f00);})[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)[_0x7995('0x1d')](function(){return _0x2cb37a(null,_0x385f00);});}}else{return utils['getLicense'](_0x385f00)['then'](function(){return _0x2cb37a(null,_0x385f00);});}}return _0x2cb37a(_0x7995('0x1f'));})[_0x7995('0x25')](function(_0x350fd9){_0x2cb37a(_0x350fd9);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0x7a54,0x106));var _0x47a5=function(_0x2a1645,_0x35d23f){_0x2a1645=_0x2a1645-0x0;var _0x17f545=_0x7a54[_0x2a1645];return _0x17f545;};'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 c397e3b..211389e 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 _0xb879=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','login','get','/callback','callback','setTokenCookie','exports','Router'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xb879,0x15d));var _0x9b87=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb879[_0x1694f5];return _0x5b4321;};'use strict';var express=require('express');var passport=require('passport');var router=express[_0x9b87('0x0')]();var controller=require(_0x9b87('0x1'));var userController=require(_0x9b87('0x2'));var authService=require(_0x9b87('0x3'));router['get']('/',controller[_0x9b87('0x4')]);router[_0x9b87('0x5')](_0x9b87('0x6'),controller[_0x9b87('0x7')],authService['isMiddleware'],userController[_0x9b87('0x4')],authService[_0x9b87('0x8')]);module[_0x9b87('0x9')]=router; \ No newline at end of file +var _0x3dc7=['login','/callback','callback','setTokenCookie','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x3dc7,0x138));var _0x73dc=function(_0x51dc0f,_0x18379f){_0x51dc0f=_0x51dc0f-0x0;var _0x3d004e=_0x3dc7[_0x51dc0f];return _0x3d004e;};'use strict';var express=require(_0x73dc('0x0'));var passport=require(_0x73dc('0x1'));var router=express[_0x73dc('0x2')]();var controller=require(_0x73dc('0x3'));var userController=require(_0x73dc('0x4'));var authService=require(_0x73dc('0x5'));router[_0x73dc('0x6')]('/',controller[_0x73dc('0x7')]);router[_0x73dc('0x6')](_0x73dc('0x8'),controller[_0x73dc('0x9')],authService['isMiddleware'],userController[_0x73dc('0x7')],authService[_0x73dc('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 9cad76b..780560a 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 _0xa5b9=['CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','request','error','format','message','stringify','status','send','login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','Password\x20reset!','use','local-login','util','passport-local','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','then','findOne','name','password','salt','role','blocked','blockedAt','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','loginAttempts','disabled','blockDuration','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp'];(function(_0x15c5b8,_0x3b670f){var _0xd45fe6=function(_0x15a775){while(--_0x15a775){_0x15c5b8['push'](_0x15c5b8['shift']());}};_0xd45fe6(++_0x3b670f);}(_0xa5b9,0x1cc));var _0x9a5b=function(_0x41ba8c,_0x304ef3){_0x41ba8c=_0x41ba8c-0x0;var _0x5245fa=_0xa5b9[_0x41ba8c];return _0x5245fa;};'use strict';var util=require(_0x9a5b('0x0'));var passport=require('passport');var LocalStrategy=require(_0x9a5b('0x1'))['Strategy'];var jayson=require(_0x9a5b('0x2'));var _=require(_0x9a5b('0x3'));var rs=require(_0x9a5b('0x4'));var moment=require(_0x9a5b('0x5'));var db=require(_0x9a5b('0x6'))['db'];var authService=require(_0x9a5b('0x7'));var utils=require(_0x9a5b('0x8'));var client=jayson[_0x9a5b('0x9')][_0x9a5b('0xa')]({'port':0x232b});function localAuthenticate(_0x302ada,_0x599918,_0x4b80a1,_0x34a315){var _0x25a525,_0xd1737a;return db[_0x9a5b('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x9a5b('0xc'),'blockDuration'],'raw':!![]})[_0x9a5b('0xd')](function(_0x413d4c){_0x25a525=_0x413d4c;return _0x302ada[_0x9a5b('0xe')]({'attributes':['id',_0x9a5b('0xf'),_0x9a5b('0x10'),_0x9a5b('0x11'),_0x9a5b('0x12'),'disabled',_0x9a5b('0x13'),_0x9a5b('0x14'),'loginAttempts'],'where':{'name':_0x599918,'role':{'$or':[_0x9a5b('0x15'),_0x9a5b('0x16'),_0x9a5b('0x17')]}}});})[_0x9a5b('0xd')](function(_0x3f8e55){if(!_0x3f8e55||_0x3f8e55&&_0x3f8e55[_0x9a5b('0xf')]!==_0x599918){throw new Error(_0x9a5b('0x18'));}else{_0xd1737a=_0x3f8e55;return _0xd1737a;}})['then'](function(){_0xd1737a[_0x9a5b('0x19')](_0x4b80a1,function(_0x2aa4bc,_0x1d9d2a){var _0x2385d2=_0xd1737a[_0x9a5b('0x1a')]+0x1;if(_0x2aa4bc){return _0x34a315(_0x2aa4bc);}else if(!_0x1d9d2a){if(_0xd1737a[_0x9a5b('0x1b')]){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else if(_0x25a525['allowedLoginAttempts']>0x0){if(_0xd1737a[_0x9a5b('0x13')]){if(_0x25a525[_0x9a5b('0x1c')]>0x0){if(moment(_0xd1737a[_0x9a5b('0x14')])[_0x9a5b('0x1d')](_0x25a525[_0x9a5b('0x1c')],_0x9a5b('0x1e'))>moment()){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else{return utils[_0x9a5b('0x1f')](_0xd1737a,_0x2385d2,![],null)[_0x9a5b('0xd')](function(){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});});}}else{return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2385d2>=_0x25a525[_0x9a5b('0xc')]){return utils[_0x9a5b('0x1f')](_0xd1737a,0x0,!![],moment())[_0x9a5b('0xd')](function(){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});});}else{return utils[_0x9a5b('0x1f')](_0xd1737a,_0x2385d2,![],null)[_0x9a5b('0xd')](function(){return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xd1737a[_0x9a5b('0x1b')]){return _0x34a315(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x25a525[_0x9a5b('0xc')]>0x0){if(_0xd1737a[_0x9a5b('0x13')]){if(_0x25a525['blockDuration']>0x0){if(moment(_0xd1737a[_0x9a5b('0x14')])[_0x9a5b('0x1d')](_0x25a525[_0x9a5b('0x1c')],_0x9a5b('0x1e'))>moment()){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else{return utils[_0x9a5b('0x1f')](_0xd1737a,0x0,![],null)['then'](function(){return utils['getLicense'](_0xd1737a);})[_0x9a5b('0xd')](function(){return _0x34a315(null,_0xd1737a);});}}else{return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}}else{return utils['clearBlockUser'](_0xd1737a,0x0,![],null)[_0x9a5b('0xd')](function(){return utils[_0x9a5b('0x20')](_0xd1737a);})[_0x9a5b('0xd')](function(){return _0x34a315(null,_0xd1737a);})[_0x9a5b('0x21')](function(_0x33eebe){return _0x34a315(null,![],_0x33eebe);});}}else{if(_0xd1737a[_0x9a5b('0x13')]){return _0x34a315(null,![],{'message':_0x9a5b('0x18')});}else{return utils['getLicense'](_0xd1737a)[_0x9a5b('0xd')](function(){return _0x34a315(null,_0xd1737a);});}}}});})['catch'](function(_0x17a7dc){return _0x34a315(null,![],_0x17a7dc);});}function sendServiceMail(_0x2e9038){return db['MailAccount'][_0x9a5b('0x22')]({'where':{'service':!![]},'attributes':['id',_0x9a5b('0xf'),_0x9a5b('0x23')],'include':[{'model':db[_0x9a5b('0x24')],'as':_0x9a5b('0x25'),'include':[{'model':db['CloudProvider'],'as':_0x9a5b('0x26')}]}]})['then'](function(_0x2a3f65){if(!_0x2a3f65){throw new Error(_0x9a5b('0x27'));}var _0xdea8b7=_0x2a3f65[_0x9a5b('0x28')]();var _0x37a49d={'account':_0xdea8b7,'message':_[_0x9a5b('0x29')]({'from':util['format']('\x22%s\x22\x20<%s>',_0x2a3f65[_0x9a5b('0xf')],_0x2a3f65['email']||_0x2a3f65['Smtp'][_0x9a5b('0x16')])},_0x2e9038)};return client[_0x9a5b('0x2a')]('SendMail',_0x37a49d);})[_0x9a5b('0xd')](function(_0x66f609){if(_0x66f609[_0x9a5b('0x2b')]){throw new Error(util[_0x9a5b('0x2c')]('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x66f609[_0x9a5b('0x2b')][_0x9a5b('0x2d')]||JSON[_0x9a5b('0x2e')](_0x66f609[_0x9a5b('0x2b')])));}return!![];});}function handleError(_0x5d17ef,_0x13875f,_0x9fe6dd){return _0x5d17ef[_0x9a5b('0x2f')](_0x13875f||0x1f4)[_0x9a5b('0x30')]({'message':_0x9fe6dd?_0x9fe6dd[_0x9a5b('0x2d')]||_0x9fe6dd:''});}exports[_0x9a5b('0x31')]=function(_0x1fda88,_0x502b72,_0x220f9d){passport[_0x9a5b('0x19')]('local-login',function(_0x2f8704,_0x47a295,_0x42b818){var _0x5ec66c=_0x2f8704||_0x42b818;if(_0x5ec66c){return handleError(_0x502b72,0x191,_0x5ec66c);}if(!_0x47a295){return handleError(_0x502b72,0x194,{'message':_0x9a5b('0x32')});}else{var _0x7c7b1d={'payload':{'id':_0x47a295['id'],'role':_0x47a295[_0x9a5b('0x12')]},'options':{'expiresIn':0x15180}};return authService[_0x9a5b('0x33')](_0x7c7b1d)[_0x9a5b('0xd')](function(_0x3288e0){_0x502b72[_0x9a5b('0x34')]({'id':_0x47a295['id'],'token':_0x3288e0,'statusCall':'','isAlreadyLogged':_0x47a295[_0x9a5b('0x35')]});});}})(_0x1fda88,_0x502b72,_0x220f9d);};exports[_0x9a5b('0x36')]=function(_0x376872,_0x23670e){if(!_0x376872[_0x9a5b('0x37')][_0x9a5b('0x23')]){return handleError(_0x23670e,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0xa1faf8=rs['generate']();_0x376872[_0x9a5b('0x37')][_0x9a5b('0x23')]=_0x376872[_0x9a5b('0x37')]['email'][_0x9a5b('0x38')]()[_0x9a5b('0x39')]();var _0x107a20;return db[_0x9a5b('0xb')][_0x9a5b('0xe')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x9a5b('0x1c')],'raw':!![]})[_0x9a5b('0xd')](function(_0x2d03e2){_0x107a20=_0x2d03e2;return db[_0x9a5b('0x3a')][_0x9a5b('0x22')]({'where':{'email':_0x376872[_0x9a5b('0x37')]['email']}});})[_0x9a5b('0xd')](function(_0x101848){if(!_0x101848){throw new Error(_0x9a5b('0x3b'));}if(_0x101848[_0x9a5b('0x1b')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x101848['blocked']){if(moment(_0x101848[_0x9a5b('0x14')])[_0x9a5b('0x1d')](_0x107a20['blockDuration'],_0x9a5b('0x1e'))>moment()){throw new Error(_0x9a5b('0x3c'));}else{_0x101848['blocked']=![];_0x101848[_0x9a5b('0x14')]=null;}}_0x101848[_0x9a5b('0x3d')]=_0xa1faf8;_0x101848[_0x9a5b('0x3e')]=Date[_0x9a5b('0x3f')]()+0x36ee80;return _0x101848[_0x9a5b('0x40')]();})[_0x9a5b('0xd')](function(){return sendServiceMail({'to':_0x376872[_0x9a5b('0x37')][_0x9a5b('0x23')],'subject':_0x9a5b('0x41'),'text':_0x9a5b('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x9a5b('0x43')+_0x376872['headers'][_0x9a5b('0x44')]+'/reset/'+_0xa1faf8+'\x0a\x0a'+_0x9a5b('0x45')});})[_0x9a5b('0xd')](function(){_0x23670e[_0x9a5b('0x2f')](0xc8)[_0x9a5b('0x30')]({'message':_0x9a5b('0x46')});})[_0x9a5b('0x21')](function(_0x9824b5){return handleError(_0x23670e,0x1f4,_0x9824b5);});};exports[_0x9a5b('0x47')]=function(_0x15ac14,_0x15dcb6){return db[_0x9a5b('0x3a')]['find']({'where':{'resetPasswordToken':_0x15ac14[_0x9a5b('0x48')][_0x9a5b('0x49')],'resetPasswordExpires':{'$gt':Date[_0x9a5b('0x3f')]()}}})[_0x9a5b('0xd')](function(_0x5d4171){if(!_0x5d4171){throw new Error(_0x9a5b('0x4a'));}return db[_0x9a5b('0xb')]['findOne']({'attributes':['id',_0x9a5b('0x4b'),_0x9a5b('0x4c'),_0x9a5b('0x4d')]})[_0x9a5b('0xd')](function(_0x23a0ef){if(_0x23a0ef[_0x9a5b('0x4b')])authService['validatePasswordPattern'](_0x15ac14[_0x9a5b('0x37')][_0x9a5b('0x10')]);if(!_0x23a0ef[_0x9a5b('0x4c')]||!_0x5d4171[_0x9a5b('0x4e')])return _0x5d4171;authService[_0x9a5b('0x4f')](_0x15ac14[_0x9a5b('0x37')][_0x9a5b('0x10')],_0x5d4171[_0x9a5b('0x4e')],_0x23a0ef[_0x9a5b('0x4d')]);return _0x5d4171;})[_0x9a5b('0xd')](function(){_0x5d4171[_0x9a5b('0x10')]=_0x15ac14[_0x9a5b('0x37')]['password'];_0x5d4171[_0x9a5b('0x3d')]=null;_0x5d4171[_0x9a5b('0x3e')]=null;return _0x5d4171[_0x9a5b('0x40')]();});})['then'](function(){_0x15dcb6['status'](0xc8)[_0x9a5b('0x30')]({'message':_0x9a5b('0x50')});})['catch'](function(_0xffaea3){return handleError(_0x15dcb6,0x1f4,_0xffaea3);});};passport[_0x9a5b('0x51')](_0x9a5b('0x52'),new LocalStrategy({'usernameField':_0x9a5b('0xf'),'passwordField':'password'},function(_0x4bab76,_0xa35269,_0x404321){return localAuthenticate(db[_0x9a5b('0x3a')],_0x4bab76,_0xa35269,_0x404321);})); \ No newline at end of file +var _0x8d66=['body','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','resetPasswordToken','Password\x20reset!','use','util','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','http','Setting','allowedLoginAttempts','blockDuration','name','password','salt','role','blocked','blockedAt','admin','user','agent','then','authenticate','loginAttempts','disabled','add','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','Smtp','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','Email\x20parameter\x20is\x20missing','generate','toLowerCase','findOne','User','find'];(function(_0x18bfdb,_0x241d43){var _0x44334c=function(_0x55e999){while(--_0x55e999){_0x18bfdb['push'](_0x18bfdb['shift']());}};_0x44334c(++_0x241d43);}(_0x8d66,0x1c0));var _0x68d6=function(_0x48bb9c,_0x34c5f4){_0x48bb9c=_0x48bb9c-0x0;var _0x31cc55=_0x8d66[_0x48bb9c];return _0x31cc55;};'use strict';var util=require(_0x68d6('0x0'));var passport=require('passport');var LocalStrategy=require(_0x68d6('0x1'))[_0x68d6('0x2')];var jayson=require(_0x68d6('0x3'));var _=require(_0x68d6('0x4'));var rs=require(_0x68d6('0x5'));var moment=require('moment');var db=require(_0x68d6('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x68d6('0x7'));var client=jayson['client'][_0x68d6('0x8')]({'port':0x232b});function localAuthenticate(_0xf9a177,_0x3a58b,_0x5b17cc,_0x1c361d){var _0x48e223,_0x40424e;return db[_0x68d6('0x9')]['findOne']({'where':{'id':0x1},'attributes':[_0x68d6('0xa'),_0x68d6('0xb')],'raw':!![]})['then'](function(_0x5b0366){_0x48e223=_0x5b0366;return _0xf9a177['findOne']({'attributes':['id',_0x68d6('0xc'),_0x68d6('0xd'),_0x68d6('0xe'),_0x68d6('0xf'),'disabled',_0x68d6('0x10'),_0x68d6('0x11'),'loginAttempts'],'where':{'name':_0x3a58b,'role':{'$or':[_0x68d6('0x12'),_0x68d6('0x13'),_0x68d6('0x14')]}}});})['then'](function(_0x2a4dbf){if(!_0x2a4dbf||_0x2a4dbf&&_0x2a4dbf[_0x68d6('0xc')]!==_0x3a58b){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x40424e=_0x2a4dbf;return _0x40424e;}})[_0x68d6('0x15')](function(){_0x40424e[_0x68d6('0x16')](_0x5b17cc,function(_0x183e4f,_0xd2db08){var _0x5a522a=_0x40424e[_0x68d6('0x17')]+0x1;if(_0x183e4f){return _0x1c361d(_0x183e4f);}else if(!_0xd2db08){if(_0x40424e[_0x68d6('0x18')]){return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x48e223['allowedLoginAttempts']>0x0){if(_0x40424e[_0x68d6('0x10')]){if(_0x48e223[_0x68d6('0xb')]>0x0){if(moment(_0x40424e[_0x68d6('0x11')])[_0x68d6('0x19')](_0x48e223['blockDuration'],'minutes')>moment()){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}else{return utils[_0x68d6('0x1b')](_0x40424e,_0x5a522a,![],null)[_0x68d6('0x15')](function(){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});});}}else{return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}}else{if(_0x5a522a>=_0x48e223[_0x68d6('0xa')]){return utils['clearBlockUser'](_0x40424e,0x0,!![],moment())[_0x68d6('0x15')](function(){return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils['clearBlockUser'](_0x40424e,_0x5a522a,![],null)['then'](function(){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});});}}}else{return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}}else{if(_0x40424e[_0x68d6('0x18')]){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}else if(_0x48e223['allowedLoginAttempts']>0x0){if(_0x40424e['blocked']){if(_0x48e223[_0x68d6('0xb')]>0x0){if(moment(_0x40424e[_0x68d6('0x11')])[_0x68d6('0x19')](_0x48e223[_0x68d6('0xb')],_0x68d6('0x1c'))>moment()){return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x68d6('0x1b')](_0x40424e,0x0,![],null)[_0x68d6('0x15')](function(){return utils['getLicense'](_0x40424e);})[_0x68d6('0x15')](function(){return _0x1c361d(null,_0x40424e);});}}else{return _0x1c361d(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x68d6('0x1b')](_0x40424e,0x0,![],null)['then'](function(){return utils[_0x68d6('0x1d')](_0x40424e);})[_0x68d6('0x15')](function(){return _0x1c361d(null,_0x40424e);})[_0x68d6('0x1e')](function(_0x59bb3a){return _0x1c361d(null,![],_0x59bb3a);});}}else{if(_0x40424e[_0x68d6('0x10')]){return _0x1c361d(null,![],{'message':_0x68d6('0x1a')});}else{return utils[_0x68d6('0x1d')](_0x40424e)[_0x68d6('0x15')](function(){return _0x1c361d(null,_0x40424e);});}}}});})[_0x68d6('0x1e')](function(_0x583e1c){return _0x1c361d(null,![],_0x583e1c);});}function sendServiceMail(_0x6be2db){return db[_0x68d6('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x68d6('0xc'),_0x68d6('0x20')],'include':[{'model':db[_0x68d6('0x21')],'as':'Smtp','include':[{'model':db[_0x68d6('0x22')],'as':_0x68d6('0x22')}]}]})[_0x68d6('0x15')](function(_0x3a6c18){if(!_0x3a6c18){throw new Error(_0x68d6('0x23'));}var _0x125743=_0x3a6c18[_0x68d6('0x24')]();var _0x7251bc={'account':_0x125743,'message':_['merge']({'from':util[_0x68d6('0x25')]('\x22%s\x22\x20<%s>',_0x3a6c18['name'],_0x3a6c18[_0x68d6('0x20')]||_0x3a6c18[_0x68d6('0x26')][_0x68d6('0x13')])},_0x6be2db)};return client['request'](_0x68d6('0x27'),_0x7251bc);})[_0x68d6('0x15')](function(_0xc16799){if(_0xc16799['error']){throw new Error(util[_0x68d6('0x25')](_0x68d6('0x28'),_0xc16799['error'][_0x68d6('0x29')]||JSON['stringify'](_0xc16799[_0x68d6('0x2a')])));}return!![];});}function handleError(_0x15b202,_0x31d00b,_0x12067c){return _0x15b202[_0x68d6('0x2b')](_0x31d00b||0x1f4)[_0x68d6('0x2c')]({'message':_0x12067c?_0x12067c[_0x68d6('0x29')]||_0x12067c:''});}exports[_0x68d6('0x2d')]=function(_0x31781d,_0x529626,_0x512448){passport[_0x68d6('0x16')](_0x68d6('0x2e'),function(_0x103cc0,_0x1ad9d6,_0x3931dd){var _0x11c8d0=_0x103cc0||_0x3931dd;if(_0x11c8d0){return handleError(_0x529626,0x191,_0x11c8d0);}if(!_0x1ad9d6){return handleError(_0x529626,0x194,{'message':_0x68d6('0x2f')});}else{var _0x44a44c={'payload':{'id':_0x1ad9d6['id'],'role':_0x1ad9d6[_0x68d6('0xf')]},'options':{'expiresIn':0x15180}};return authService[_0x68d6('0x30')](_0x44a44c)[_0x68d6('0x15')](function(_0x356397){_0x529626['json']({'id':_0x1ad9d6['id'],'token':_0x356397,'statusCall':'','isAlreadyLogged':_0x1ad9d6['online']});});}})(_0x31781d,_0x529626,_0x512448);};exports[_0x68d6('0x31')]=function(_0x32acba,_0x141093){if(!_0x32acba['body'][_0x68d6('0x20')]){return handleError(_0x141093,0x1f4,{'message':_0x68d6('0x32')});}var _0x127908=rs[_0x68d6('0x33')]();_0x32acba['body'][_0x68d6('0x20')]=_0x32acba['body'][_0x68d6('0x20')]['trim']()[_0x68d6('0x34')]();var _0x213c7a;return db[_0x68d6('0x9')][_0x68d6('0x35')]({'where':{'id':0x1},'attributes':[_0x68d6('0xa'),_0x68d6('0xb')],'raw':!![]})[_0x68d6('0x15')](function(_0x4338ba){_0x213c7a=_0x4338ba;return db[_0x68d6('0x36')][_0x68d6('0x37')]({'where':{'email':_0x32acba[_0x68d6('0x38')]['email']}});})['then'](function(_0x47f03c){if(!_0x47f03c){throw new Error(_0x68d6('0x39'));}if(_0x47f03c[_0x68d6('0x18')]){throw new Error(_0x68d6('0x3a'));}if(_0x47f03c[_0x68d6('0x10')]){if(moment(_0x47f03c['blockedAt'])[_0x68d6('0x19')](_0x213c7a[_0x68d6('0xb')],_0x68d6('0x1c'))>moment()){throw new Error(_0x68d6('0x3b'));}else{_0x47f03c[_0x68d6('0x10')]=![];_0x47f03c[_0x68d6('0x11')]=null;}}_0x47f03c['resetPasswordToken']=_0x127908;_0x47f03c[_0x68d6('0x3c')]=Date[_0x68d6('0x3d')]()+0x36ee80;return _0x47f03c[_0x68d6('0x3e')]();})[_0x68d6('0x15')](function(){return sendServiceMail({'to':_0x32acba[_0x68d6('0x38')]['email'],'subject':_0x68d6('0x3f'),'text':_0x68d6('0x40')+_0x68d6('0x41')+_0x68d6('0x42')+_0x32acba[_0x68d6('0x43')][_0x68d6('0x44')]+'/reset/'+_0x127908+'\x0a\x0a'+_0x68d6('0x45')});})['then'](function(){_0x141093[_0x68d6('0x2b')](0xc8)[_0x68d6('0x2c')]({'message':_0x68d6('0x46')});})['catch'](function(_0x4771c0){return handleError(_0x141093,0x1f4,_0x4771c0);});};exports[_0x68d6('0x47')]=function(_0x3f266b,_0x557bbe){return db[_0x68d6('0x36')][_0x68d6('0x37')]({'where':{'resetPasswordToken':_0x3f266b[_0x68d6('0x48')][_0x68d6('0x49')],'resetPasswordExpires':{'$gt':Date['now']()}}})[_0x68d6('0x15')](function(_0x398b73){if(!_0x398b73){throw new Error(_0x68d6('0x4a'));}return db['Setting'][_0x68d6('0x35')]({'attributes':['id',_0x68d6('0x4b'),_0x68d6('0x4c'),'passwordHistoryLimit']})[_0x68d6('0x15')](function(_0x127b1a){if(_0x127b1a[_0x68d6('0x4b')])authService[_0x68d6('0x4d')](_0x3f266b['body'][_0x68d6('0xd')]);if(!_0x127b1a[_0x68d6('0x4c')]||!_0x398b73[_0x68d6('0x4e')])return _0x398b73;authService[_0x68d6('0x4f')](_0x3f266b[_0x68d6('0x38')][_0x68d6('0xd')],_0x398b73[_0x68d6('0x4e')],_0x127b1a[_0x68d6('0x50')]);return _0x398b73;})[_0x68d6('0x15')](function(){_0x398b73[_0x68d6('0xd')]=_0x3f266b[_0x68d6('0x38')][_0x68d6('0xd')];_0x398b73[_0x68d6('0x51')]=null;_0x398b73[_0x68d6('0x3c')]=null;return _0x398b73[_0x68d6('0x3e')]();});})['then'](function(){_0x557bbe[_0x68d6('0x2b')](0xc8)[_0x68d6('0x2c')]({'message':_0x68d6('0x52')});})['catch'](function(_0xe75d77){return handleError(_0x557bbe,0x1f4,_0xe75d77);});};passport[_0x68d6('0x53')](_0x68d6('0x2e'),new LocalStrategy({'usernameField':_0x68d6('0xc'),'passwordField':_0x68d6('0xd')},function(_0x3e26ee,_0x297aca,_0x53bb46){return localAuthenticate(db[_0x68d6('0x36')],_0x3e26ee,_0x297aca,_0x53bb46);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 022744f..3ae3741 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 _0x2cd9=['post','/reset/:token','exports','express','Router','./authLocal.controller','login','/forgot','forgot'];(function(_0x4cb394,_0x2922dd){var _0xfaa442=function(_0x14470f){while(--_0x14470f){_0x4cb394['push'](_0x4cb394['shift']());}};_0xfaa442(++_0x2922dd);}(_0x2cd9,0x135));var _0x92cd=function(_0x454b43,_0xbbd840){_0x454b43=_0x454b43-0x0;var _0x18b44b=_0x2cd9[_0x454b43];return _0x18b44b;};'use strict';var express=require(_0x92cd('0x0'));var router=express[_0x92cd('0x1')]();var controller=require(_0x92cd('0x2'));router['post']('/',controller[_0x92cd('0x3')]);router['post'](_0x92cd('0x4'),controller[_0x92cd('0x5')]);router[_0x92cd('0x6')](_0x92cd('0x7'),controller['reset']);module[_0x92cd('0x8')]=router; \ No newline at end of file +var _0x6914=['Router','./authLocal.controller','post','login','/reset/:token','reset','express'];(function(_0x39b8a8,_0x25ca73){var _0x34737e=function(_0x699b){while(--_0x699b){_0x39b8a8['push'](_0x39b8a8['shift']());}};_0x34737e(++_0x25ca73);}(_0x6914,0xd8));var _0x4691=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x6914[_0x12fc8d];return _0x3f9d04;};'use strict';var express=require(_0x4691('0x0'));var router=express[_0x4691('0x1')]();var controller=require(_0x4691('0x2'));router[_0x4691('0x3')]('/',controller[_0x4691('0x4')]);router[_0x4691('0x3')]('/forgot',controller['forgot']);router['post'](_0x4691('0x5'),controller[_0x4691('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index eb6d89b..9e63b8a 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 _0x3e31=['exports','STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x1b60e6,_0x2e8a31){var _0x1bbb3d=function(_0x3b07f0){while(--_0x3b07f0){_0x1b60e6['push'](_0x1b60e6['shift']());}};_0x1bbb3d(++_0x2e8a31);}(_0x3e31,0xfe));var _0x13e3=function(_0xf3fd05,_0x23ce73){_0xf3fd05=_0xf3fd05-0x0;var _0x7b9231=_0x3e31[_0xf3fd05];return _0x7b9231;};'use strict';var Sequelize=require(_0x13e3('0x0'));module[_0x13e3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x13e3('0x2')]},'description':{'type':Sequelize[_0x13e3('0x2')]},'status':{'type':Sequelize[_0x13e3('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x13e3('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xb3eb=['exports','STRING','INTEGER','sequelize'];(function(_0x5505b7,_0x5e1ab5){var _0x4e58d1=function(_0x368e17){while(--_0x368e17){_0x5505b7['push'](_0x5505b7['shift']());}};_0x4e58d1(++_0x5e1ab5);}(_0xb3eb,0x127));var _0xbb3e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb3eb[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xbb3e('0x0'));module[_0xbb3e('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0xbb3e('0x2')]},'description':{'type':Sequelize[_0xbb3e('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xbb3e('0x3')],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index 5cfe34e..bf6e830 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 _0x1248=['../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','keys','filters','intersection','model','attributes','length','query','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','Automation','includeAll','include','findAll','params','fields','options','find','catch','create','body','addConditions','Condition','ids','getConditions','findOne','addActions','Action','omit','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x56716d,_0x2f6690){var _0x126a2c=function(_0x5bf306){while(--_0x5bf306){_0x56716d['push'](_0x56716d['shift']());}};_0x126a2c(++_0x2f6690);}(_0x1248,0xe9));var _0x8124=function(_0x9f90cf,_0x503641){_0x9f90cf=_0x9f90cf-0x0;var _0x4d2bd3=_0x1248[_0x9f90cf];return _0x4d2bd3;};'use strict';var emlformat=require(_0x8124('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8124('0x1'));var jsonpatch=require(_0x8124('0x2'));var rp=require(_0x8124('0x3'));var moment=require(_0x8124('0x4'));var BPromise=require(_0x8124('0x5'));var Mustache=require(_0x8124('0x6'));var util=require(_0x8124('0x7'));var path=require(_0x8124('0x8'));var sox=require(_0x8124('0x9'));var csv=require(_0x8124('0xa'));var ejs=require(_0x8124('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8124('0xc'));var squel=require(_0x8124('0xd'));var crypto=require('crypto');var jsforce=require(_0x8124('0xe'));var deskjs=require(_0x8124('0xf'));var toCsv=require(_0x8124('0xa'));var querystring=require(_0x8124('0x10'));var Papa=require(_0x8124('0x11'));var Redis=require(_0x8124('0x12'));var authService=require(_0x8124('0x13'));var qs=require(_0x8124('0x14'));var as=require(_0x8124('0x15'));var hardwareService=require(_0x8124('0x16'));var logger=require(_0x8124('0x17'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8124('0x18'));var db=require(_0x8124('0x19'))['db'];function respondWithStatusCode(_0x508a45,_0x4a9785){_0x4a9785=_0x4a9785||0xcc;return function(_0x54d42b){if(_0x54d42b){return _0x508a45[_0x8124('0x1a')](_0x4a9785);}return _0x508a45[_0x8124('0x1b')](_0x4a9785)[_0x8124('0x1c')]();};}function respondWithResult(_0x4fbe93,_0x12b0e6){_0x12b0e6=_0x12b0e6||0xc8;return function(_0xc735a5){if(_0xc735a5){return _0x4fbe93['status'](_0x12b0e6)['json'](_0xc735a5);}};}function respondWithFilteredResult(_0x4a9816,_0x3aaf5d){return function(_0x352064){if(_0x352064){var _0x6bee46=typeof _0x3aaf5d[_0x8124('0x1d')]===_0x8124('0x1e')&&typeof _0x3aaf5d['limit']===_0x8124('0x1e');var _0x732edb=_0x352064[_0x8124('0x1f')];var _0x1b6810=_0x6bee46?0x0:_0x3aaf5d[_0x8124('0x1d')];var _0x441dbd=_0x6bee46?_0x352064[_0x8124('0x1f')]:_0x3aaf5d[_0x8124('0x1d')]+_0x3aaf5d['limit'];var _0x5410aa;if(_0x441dbd>=_0x732edb){_0x441dbd=_0x732edb;_0x5410aa=0xc8;}else{_0x5410aa=0xce;}_0x4a9816[_0x8124('0x1b')](_0x5410aa);return _0x4a9816['set'](_0x8124('0x20'),_0x1b6810+'-'+_0x441dbd+'/'+_0x732edb)[_0x8124('0x21')](_0x352064);}return null;};}function patchUpdates(_0x5f4290){return function(_0x207aec){try{jsonpatch[_0x8124('0x22')](_0x207aec,_0x5f4290,!![]);}catch(_0x5a770d){return BPromise[_0x8124('0x23')](_0x5a770d);}return _0x207aec[_0x8124('0x24')]();};}function saveUpdates(_0x1d77ac,_0x407ea9){return function(_0x33e63d){if(_0x33e63d){return _0x33e63d[_0x8124('0x25')](_0x1d77ac)[_0x8124('0x26')](function(_0x558721){return _0x558721;});}return null;};}function removeEntity(_0xb1d8ec,_0x1003eb){return function(_0x280607){if(_0x280607){return _0x280607[_0x8124('0x27')]()[_0x8124('0x26')](function(){_0xb1d8ec[_0x8124('0x1b')](0xcc)[_0x8124('0x1c')]();});}};}function handleEntityNotFound(_0x5387f4,_0x4db46b){return function(_0x566ac4){if(!_0x566ac4){_0x5387f4['sendStatus'](0x194);}return _0x566ac4;};}function handleError(_0x2a8332,_0x303171){_0x303171=_0x303171||0x1f4;return function(_0xfb5031){logger[_0x8124('0x28')](_0xfb5031[_0x8124('0x29')]);if(_0xfb5031['name']){delete _0xfb5031[_0x8124('0x2a')];}_0x2a8332[_0x8124('0x1b')](_0x303171)[_0x8124('0x2b')](_0xfb5031);};}exports[_0x8124('0x2c')]=function(_0x2bb32c,_0x451d85){var _0x2fca90={},_0x216f17={},_0xb114c2={'count':0x0,'rows':[]};var _0x158a79=_[_0x8124('0x2d')](db['Automation'][_0x8124('0x2e')],function(_0x5b03d3){return{'name':_0x5b03d3[_0x8124('0x2f')],'type':_0x5b03d3[_0x8124('0x30')]['key']};});_0x216f17['model']=_['map'](_0x158a79,_0x8124('0x2a'));_0x216f17['query']=_[_0x8124('0x31')](_0x2bb32c['query']);_0x216f17[_0x8124('0x32')]=_[_0x8124('0x33')](_0x216f17[_0x8124('0x34')],_0x216f17['query']);_0x2fca90[_0x8124('0x35')]=_[_0x8124('0x33')](_0x216f17[_0x8124('0x34')],qs['fields'](_0x2bb32c['query']['fields']));_0x2fca90['attributes']=_0x2fca90[_0x8124('0x35')][_0x8124('0x36')]?_0x2fca90[_0x8124('0x35')]:_0x216f17[_0x8124('0x34')];if(!_0x2bb32c[_0x8124('0x37')][_0x8124('0x38')](_0x8124('0x39'))){_0x2fca90[_0x8124('0x3a')]=qs[_0x8124('0x3a')](_0x2bb32c[_0x8124('0x37')][_0x8124('0x3a')]);_0x2fca90[_0x8124('0x1d')]=qs[_0x8124('0x1d')](_0x2bb32c[_0x8124('0x37')][_0x8124('0x1d')]);}_0x2fca90[_0x8124('0x3b')]=qs[_0x8124('0x3c')](_0x2bb32c['query']['sort']);_0x2fca90['where']=qs[_0x8124('0x32')](_[_0x8124('0x3d')](_0x2bb32c[_0x8124('0x37')],_0x216f17['filters']),_0x158a79);if(_0x2bb32c[_0x8124('0x37')][_0x8124('0x3e')]){_0x2fca90['where']=_[_0x8124('0x3f')](_0x2fca90[_0x8124('0x40')],{'$or':_[_0x8124('0x2d')](_0x158a79,function(_0x21f1d8){if(_0x21f1d8[_0x8124('0x30')]!=='VIRTUAL'){var _0x5439a6={};_0x5439a6[_0x21f1d8[_0x8124('0x2a')]]={'$like':'%'+_0x2bb32c[_0x8124('0x37')]['filter']+'%'};return _0x5439a6;}})});}_0x2fca90=_[_0x8124('0x3f')]({},_0x2fca90,_0x2bb32c['options']);var _0x55478f={'where':_0x2fca90[_0x8124('0x40')]};return db[_0x8124('0x41')][_0x8124('0x1f')](_0x55478f)[_0x8124('0x26')](function(_0x5648ae){_0xb114c2[_0x8124('0x1f')]=_0x5648ae;if(_0x2bb32c[_0x8124('0x37')][_0x8124('0x42')]){_0x2fca90[_0x8124('0x43')]=[{'all':!![]}];}return db[_0x8124('0x41')][_0x8124('0x44')](_0x2fca90);})[_0x8124('0x26')](function(_0x2a6a89){_0xb114c2['rows']=_0x2a6a89;return _0xb114c2;})[_0x8124('0x26')](respondWithFilteredResult(_0x451d85,_0x2fca90))['catch'](handleError(_0x451d85,null));};exports['show']=function(_0x4d2ff8,_0xabaf08){var _0x371e40={'raw':![],'where':{'id':_0x4d2ff8[_0x8124('0x45')]['id']}},_0x35edd7={};_0x35edd7[_0x8124('0x34')]=_[_0x8124('0x31')](db[_0x8124('0x41')][_0x8124('0x2e')]);_0x35edd7[_0x8124('0x37')]=_[_0x8124('0x31')](_0x4d2ff8[_0x8124('0x37')]);_0x35edd7[_0x8124('0x32')]=_[_0x8124('0x33')](_0x35edd7[_0x8124('0x34')],_0x35edd7[_0x8124('0x37')]);_0x371e40[_0x8124('0x35')]=_[_0x8124('0x33')](_0x35edd7['model'],qs[_0x8124('0x46')](_0x4d2ff8[_0x8124('0x37')]['fields']));_0x371e40[_0x8124('0x35')]=_0x371e40[_0x8124('0x35')][_0x8124('0x36')]?_0x371e40[_0x8124('0x35')]:_0x35edd7[_0x8124('0x34')];if(_0x4d2ff8['query'][_0x8124('0x42')]){_0x371e40[_0x8124('0x43')]=[{'all':!![]}];}_0x371e40=_[_0x8124('0x3f')]({},_0x371e40,_0x4d2ff8[_0x8124('0x47')]);return db['Automation'][_0x8124('0x48')](_0x371e40)['then'](handleEntityNotFound(_0xabaf08,null))['then'](respondWithResult(_0xabaf08,null))[_0x8124('0x49')](handleError(_0xabaf08,null));};exports[_0x8124('0x4a')]=function(_0x4ea287,_0x37edb1){return db[_0x8124('0x41')][_0x8124('0x4a')](_0x4ea287[_0x8124('0x4b')],{})['then'](respondWithResult(_0x37edb1,0xc9))[_0x8124('0x49')](handleError(_0x37edb1,null));};exports[_0x8124('0x25')]=function(_0x172414,_0x1f8311){if(_0x172414['body']['id']){delete _0x172414['body']['id'];}return db[_0x8124('0x41')][_0x8124('0x48')]({'where':{'id':_0x172414[_0x8124('0x45')]['id']}})['then'](handleEntityNotFound(_0x1f8311,null))[_0x8124('0x26')](saveUpdates(_0x172414[_0x8124('0x4b')],null))[_0x8124('0x26')](respondWithResult(_0x1f8311,null))[_0x8124('0x49')](handleError(_0x1f8311,null));};exports['destroy']=function(_0x343450,_0x2c878a){return db[_0x8124('0x41')][_0x8124('0x48')]({'where':{'id':_0x343450['params']['id']}})[_0x8124('0x26')](handleEntityNotFound(_0x2c878a,null))[_0x8124('0x26')](removeEntity(_0x2c878a,null))[_0x8124('0x49')](handleError(_0x2c878a,null));};exports[_0x8124('0x4c')]=function(_0xee7f87,_0x20a0c9,_0x4a093f){return db[_0x8124('0x4d')][_0x8124('0x48')]({'where':{'id':_0xee7f87[_0x8124('0x45')]['id']}})['then'](handleEntityNotFound(_0x20a0c9,null))['then'](function(_0x3b6d4c){if(_0x3b6d4c){return _0x3b6d4c[_0x8124('0x4c')](_0xee7f87[_0x8124('0x4b')][_0x8124('0x4e')],_['omit'](_0xee7f87[_0x8124('0x4b')],[_0x8124('0x4e'),'id'])||{});}})[_0x8124('0x26')](respondWithResult(_0x20a0c9,null))[_0x8124('0x49')](handleError(_0x20a0c9,null));};exports[_0x8124('0x4f')]=function(_0x1c6d72,_0x28c5cb,_0x17bb2a){var _0x4edf6f={};var _0x524e1f={};var _0x4da122;var _0x4a82c8;return db[_0x8124('0x41')][_0x8124('0x50')]({'where':{'id':_0x1c6d72[_0x8124('0x45')]['id']}})['then'](handleEntityNotFound(_0x28c5cb,null))[_0x8124('0x26')](function(_0x293981){if(_0x293981){_0x4da122=_0x293981;_0x524e1f[_0x8124('0x34')]=_[_0x8124('0x31')](db[_0x8124('0x4d')][_0x8124('0x2e')]);_0x524e1f['query']=_[_0x8124('0x31')](_0x1c6d72[_0x8124('0x37')]);_0x524e1f[_0x8124('0x32')]=_['intersection'](_0x524e1f[_0x8124('0x34')],_0x524e1f[_0x8124('0x37')]);_0x4edf6f[_0x8124('0x35')]=_[_0x8124('0x33')](_0x524e1f['model'],qs['fields'](_0x1c6d72[_0x8124('0x37')][_0x8124('0x46')]));_0x4edf6f[_0x8124('0x35')]=_0x4edf6f['attributes'][_0x8124('0x36')]?_0x4edf6f[_0x8124('0x35')]:_0x524e1f['model'];_0x4edf6f['order']=qs['sort'](_0x1c6d72[_0x8124('0x37')][_0x8124('0x3c')]);_0x4edf6f[_0x8124('0x40')]=qs['filters'](_[_0x8124('0x3d')](_0x1c6d72['query'],_0x524e1f[_0x8124('0x32')]));if(_0x1c6d72[_0x8124('0x37')][_0x8124('0x3e')]){_0x4edf6f['where']=_[_0x8124('0x3f')](_0x4edf6f['where'],{'$or':_[_0x8124('0x2d')](_0x4edf6f[_0x8124('0x35')],function(_0x325fef){var _0x290ca3={};_0x290ca3[_0x325fef]={'$like':'%'+_0x1c6d72[_0x8124('0x37')][_0x8124('0x3e')]+'%'};return _0x290ca3;})});}_0x4edf6f=_['merge']({},_0x4edf6f,_0x1c6d72[_0x8124('0x47')]);return _0x4da122['getConditions'](_0x4edf6f);}})[_0x8124('0x26')](function(_0x3a9ece){if(_0x3a9ece){_0x4a82c8=_0x3a9ece[_0x8124('0x36')];if(!_0x1c6d72[_0x8124('0x37')]['hasOwnProperty']('nolimit')){_0x4edf6f[_0x8124('0x3a')]=qs[_0x8124('0x3a')](_0x1c6d72[_0x8124('0x37')]['limit']);_0x4edf6f[_0x8124('0x1d')]=qs['offset'](_0x1c6d72[_0x8124('0x37')][_0x8124('0x1d')]);}return _0x4da122[_0x8124('0x4f')](_0x4edf6f);}})[_0x8124('0x26')](function(_0x13c71e){if(_0x13c71e){return _0x13c71e?{'count':_0x4a82c8,'rows':_0x13c71e}:null;}})[_0x8124('0x26')](respondWithResult(_0x28c5cb,null))[_0x8124('0x49')](handleError(_0x28c5cb,null));};exports[_0x8124('0x51')]=function(_0x273d3c,_0x5403b5,_0x5dadfd){return db[_0x8124('0x52')][_0x8124('0x48')]({'where':{'id':_0x273d3c['params']['id']}})[_0x8124('0x26')](handleEntityNotFound(_0x5403b5,null))[_0x8124('0x26')](function(_0x574cc4){if(_0x574cc4){return _0x574cc4[_0x8124('0x51')](_0x273d3c[_0x8124('0x4b')][_0x8124('0x4e')],_[_0x8124('0x53')](_0x273d3c[_0x8124('0x4b')],[_0x8124('0x4e'),'id'])||{});}})[_0x8124('0x26')](respondWithResult(_0x5403b5,null))[_0x8124('0x49')](handleError(_0x5403b5,null));};exports['getActions']=function(_0x25b580,_0x355aa2,_0x202996){var _0xb03614={};var _0x41f1e4={};var _0x41f1a0;var _0x4f7599;return db['Automation'][_0x8124('0x50')]({'where':{'id':_0x25b580['params']['id']}})[_0x8124('0x26')](handleEntityNotFound(_0x355aa2,null))['then'](function(_0x13a140){if(_0x13a140){_0x41f1a0=_0x13a140;_0x41f1e4['model']=_[_0x8124('0x31')](db[_0x8124('0x52')][_0x8124('0x2e')]);_0x41f1e4[_0x8124('0x37')]=_[_0x8124('0x31')](_0x25b580[_0x8124('0x37')]);_0x41f1e4[_0x8124('0x32')]=_[_0x8124('0x33')](_0x41f1e4[_0x8124('0x34')],_0x41f1e4[_0x8124('0x37')]);_0xb03614[_0x8124('0x35')]=_[_0x8124('0x33')](_0x41f1e4['model'],qs[_0x8124('0x46')](_0x25b580[_0x8124('0x37')][_0x8124('0x46')]));_0xb03614['attributes']=_0xb03614[_0x8124('0x35')][_0x8124('0x36')]?_0xb03614[_0x8124('0x35')]:_0x41f1e4['model'];_0xb03614['order']=qs[_0x8124('0x3c')](_0x25b580[_0x8124('0x37')][_0x8124('0x3c')]);_0xb03614[_0x8124('0x40')]=qs['filters'](_[_0x8124('0x3d')](_0x25b580['query'],_0x41f1e4[_0x8124('0x32')]));if(_0x25b580[_0x8124('0x37')][_0x8124('0x3e')]){_0xb03614[_0x8124('0x40')]=_['merge'](_0xb03614['where'],{'$or':_[_0x8124('0x2d')](_0xb03614[_0x8124('0x35')],function(_0x26c669){var _0x1ea639={};_0x1ea639[_0x26c669]={'$like':'%'+_0x25b580[_0x8124('0x37')][_0x8124('0x3e')]+'%'};return _0x1ea639;})});}_0xb03614=_['merge']({},_0xb03614,_0x25b580['options']);return _0x41f1a0[_0x8124('0x54')](_0xb03614);}})[_0x8124('0x26')](function(_0x639570){if(_0x639570){_0x4f7599=_0x639570[_0x8124('0x36')];if(!_0x25b580['query'][_0x8124('0x38')](_0x8124('0x39'))){_0xb03614[_0x8124('0x3a')]=qs[_0x8124('0x3a')](_0x25b580['query']['limit']);_0xb03614[_0x8124('0x1d')]=qs[_0x8124('0x1d')](_0x25b580[_0x8124('0x37')][_0x8124('0x1d')]);}return _0x41f1a0[_0x8124('0x54')](_0xb03614);}})[_0x8124('0x26')](function(_0x137b9d){if(_0x137b9d){return _0x137b9d?{'count':_0x4f7599,'rows':_0x137b9d}:null;}})[_0x8124('0x26')](respondWithResult(_0x355aa2,null))[_0x8124('0x49')](handleError(_0x355aa2,null));}; \ No newline at end of file +var _0x5442=['to-csv','ejs','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','end','stack','name','send','index','map','Automation','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','pick','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','keys','rawAttributes','length','find','create','body','update','addConditions','Condition','ids','getConditions','findOne','Action','omit','getActions','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path'];(function(_0x2afbb0,_0x44f16d){var _0x411ff2=function(_0x5edd7e){while(--_0x5edd7e){_0x2afbb0['push'](_0x2afbb0['shift']());}};_0x411ff2(++_0x44f16d);}(_0x5442,0xf3));var _0x2544=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0x5442[_0x5c7a85];return _0x35290f;};'use strict';var emlformat=require(_0x2544('0x0'));var rimraf=require(_0x2544('0x1'));var zipdir=require(_0x2544('0x2'));var jsonpatch=require(_0x2544('0x3'));var rp=require(_0x2544('0x4'));var moment=require(_0x2544('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2544('0x6'));var util=require(_0x2544('0x7'));var path=require(_0x2544('0x8'));var sox=require('sox');var csv=require(_0x2544('0x9'));var ejs=require(_0x2544('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x2544('0xb'));var crypto=require(_0x2544('0xc'));var jsforce=require(_0x2544('0xd'));var deskjs=require(_0x2544('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2544('0xf'));var Redis=require('ioredis');var authService=require(_0x2544('0x10'));var qs=require(_0x2544('0x11'));var as=require(_0x2544('0x12'));var hardwareService=require(_0x2544('0x13'));var logger=require(_0x2544('0x14'))(_0x2544('0x15'));var utils=require(_0x2544('0x16'));var config=require(_0x2544('0x17'));var licenseUtil=require(_0x2544('0x18'));var db=require(_0x2544('0x19'))['db'];function respondWithStatusCode(_0x303a76,_0x472155){_0x472155=_0x472155||0xcc;return function(_0x14b1a9){if(_0x14b1a9){return _0x303a76[_0x2544('0x1a')](_0x472155);}return _0x303a76['status'](_0x472155)['end']();};}function respondWithResult(_0x3bdb47,_0x451c11){_0x451c11=_0x451c11||0xc8;return function(_0x401e97){if(_0x401e97){return _0x3bdb47[_0x2544('0x1b')](_0x451c11)[_0x2544('0x1c')](_0x401e97);}};}function respondWithFilteredResult(_0x5e5401,_0xca1d77){return function(_0x102a03){if(_0x102a03){var _0x4d934d=typeof _0xca1d77[_0x2544('0x1d')]===_0x2544('0x1e')&&typeof _0xca1d77[_0x2544('0x1f')]===_0x2544('0x1e');var _0xc19ad8=_0x102a03[_0x2544('0x20')];var _0x2870eb=_0x4d934d?0x0:_0xca1d77['offset'];var _0x96cfac=_0x4d934d?_0x102a03[_0x2544('0x20')]:_0xca1d77[_0x2544('0x1d')]+_0xca1d77['limit'];var _0x1e9110;if(_0x96cfac>=_0xc19ad8){_0x96cfac=_0xc19ad8;_0x1e9110=0xc8;}else{_0x1e9110=0xce;}_0x5e5401[_0x2544('0x1b')](_0x1e9110);return _0x5e5401['set'](_0x2544('0x21'),_0x2870eb+'-'+_0x96cfac+'/'+_0xc19ad8)[_0x2544('0x1c')](_0x102a03);}return null;};}function patchUpdates(_0x15fa11){return function(_0x1366d2){try{jsonpatch[_0x2544('0x22')](_0x1366d2,_0x15fa11,!![]);}catch(_0x2be4f8){return BPromise[_0x2544('0x23')](_0x2be4f8);}return _0x1366d2[_0x2544('0x24')]();};}function saveUpdates(_0x3928a7,_0xc0f864){return function(_0x34b1a1){if(_0x34b1a1){return _0x34b1a1['update'](_0x3928a7)[_0x2544('0x25')](function(_0x2b3d7d){return _0x2b3d7d;});}return null;};}function removeEntity(_0x14dfb2,_0x36156d){return function(_0x2dc649){if(_0x2dc649){return _0x2dc649[_0x2544('0x26')]()[_0x2544('0x25')](function(){_0x14dfb2[_0x2544('0x1b')](0xcc)[_0x2544('0x27')]();});}};}function handleEntityNotFound(_0x487b18,_0x3c17ca){return function(_0x36d6ec){if(!_0x36d6ec){_0x487b18[_0x2544('0x1a')](0x194);}return _0x36d6ec;};}function handleError(_0xeec4e6,_0x3d26a6){_0x3d26a6=_0x3d26a6||0x1f4;return function(_0x53ab39){logger['error'](_0x53ab39[_0x2544('0x28')]);if(_0x53ab39[_0x2544('0x29')]){delete _0x53ab39[_0x2544('0x29')];}_0xeec4e6[_0x2544('0x1b')](_0x3d26a6)[_0x2544('0x2a')](_0x53ab39);};}exports[_0x2544('0x2b')]=function(_0x1d289e,_0x3f55ab){var _0x42252={},_0x2029c0={},_0x427ed4={'count':0x0,'rows':[]};var _0x511d6c=_[_0x2544('0x2c')](db[_0x2544('0x2d')]['rawAttributes'],function(_0x401b84){return{'name':_0x401b84['fieldName'],'type':_0x401b84[_0x2544('0x2e')][_0x2544('0x2f')]};});_0x2029c0[_0x2544('0x30')]=_[_0x2544('0x2c')](_0x511d6c,'name');_0x2029c0[_0x2544('0x31')]=_['keys'](_0x1d289e['query']);_0x2029c0[_0x2544('0x32')]=_[_0x2544('0x33')](_0x2029c0[_0x2544('0x30')],_0x2029c0['query']);_0x42252[_0x2544('0x34')]=_[_0x2544('0x33')](_0x2029c0[_0x2544('0x30')],qs['fields'](_0x1d289e['query'][_0x2544('0x35')]));_0x42252[_0x2544('0x34')]=_0x42252[_0x2544('0x34')]['length']?_0x42252[_0x2544('0x34')]:_0x2029c0[_0x2544('0x30')];if(!_0x1d289e['query'][_0x2544('0x36')](_0x2544('0x37'))){_0x42252[_0x2544('0x1f')]=qs['limit'](_0x1d289e['query'][_0x2544('0x1f')]);_0x42252[_0x2544('0x1d')]=qs[_0x2544('0x1d')](_0x1d289e[_0x2544('0x31')][_0x2544('0x1d')]);}_0x42252[_0x2544('0x38')]=qs['sort'](_0x1d289e['query']['sort']);_0x42252['where']=qs[_0x2544('0x32')](_[_0x2544('0x39')](_0x1d289e['query'],_0x2029c0[_0x2544('0x32')]),_0x511d6c);if(_0x1d289e[_0x2544('0x31')][_0x2544('0x3a')]){_0x42252[_0x2544('0x3b')]=_[_0x2544('0x3c')](_0x42252['where'],{'$or':_['map'](_0x511d6c,function(_0x4da934){if(_0x4da934[_0x2544('0x2e')]!==_0x2544('0x3d')){var _0x50bca3={};_0x50bca3[_0x4da934[_0x2544('0x29')]]={'$like':'%'+_0x1d289e[_0x2544('0x31')][_0x2544('0x3a')]+'%'};return _0x50bca3;}})});}_0x42252=_['merge']({},_0x42252,_0x1d289e[_0x2544('0x3e')]);var _0x32fedc={'where':_0x42252['where']};return db['Automation'][_0x2544('0x20')](_0x32fedc)[_0x2544('0x25')](function(_0x19951e){_0x427ed4[_0x2544('0x20')]=_0x19951e;if(_0x1d289e[_0x2544('0x31')][_0x2544('0x3f')]){_0x42252[_0x2544('0x40')]=[{'all':!![]}];}return db[_0x2544('0x2d')]['findAll'](_0x42252);})[_0x2544('0x25')](function(_0x276618){_0x427ed4['rows']=_0x276618;return _0x427ed4;})['then'](respondWithFilteredResult(_0x3f55ab,_0x42252))[_0x2544('0x41')](handleError(_0x3f55ab,null));};exports[_0x2544('0x42')]=function(_0x2a2a4d,_0x551e93){var _0x2c47c5={'raw':![],'where':{'id':_0x2a2a4d[_0x2544('0x43')]['id']}},_0x6df698={};_0x6df698[_0x2544('0x30')]=_[_0x2544('0x44')](db[_0x2544('0x2d')][_0x2544('0x45')]);_0x6df698[_0x2544('0x31')]=_[_0x2544('0x44')](_0x2a2a4d[_0x2544('0x31')]);_0x6df698['filters']=_['intersection'](_0x6df698[_0x2544('0x30')],_0x6df698[_0x2544('0x31')]);_0x2c47c5[_0x2544('0x34')]=_[_0x2544('0x33')](_0x6df698[_0x2544('0x30')],qs['fields'](_0x2a2a4d[_0x2544('0x31')][_0x2544('0x35')]));_0x2c47c5['attributes']=_0x2c47c5['attributes'][_0x2544('0x46')]?_0x2c47c5['attributes']:_0x6df698[_0x2544('0x30')];if(_0x2a2a4d[_0x2544('0x31')][_0x2544('0x3f')]){_0x2c47c5[_0x2544('0x40')]=[{'all':!![]}];}_0x2c47c5=_[_0x2544('0x3c')]({},_0x2c47c5,_0x2a2a4d[_0x2544('0x3e')]);return db[_0x2544('0x2d')][_0x2544('0x47')](_0x2c47c5)[_0x2544('0x25')](handleEntityNotFound(_0x551e93,null))[_0x2544('0x25')](respondWithResult(_0x551e93,null))['catch'](handleError(_0x551e93,null));};exports[_0x2544('0x48')]=function(_0x4e8673,_0x1491ce){return db['Automation'][_0x2544('0x48')](_0x4e8673[_0x2544('0x49')],{})[_0x2544('0x25')](respondWithResult(_0x1491ce,0xc9))[_0x2544('0x41')](handleError(_0x1491ce,null));};exports[_0x2544('0x4a')]=function(_0x493331,_0x30d8d2){if(_0x493331['body']['id']){delete _0x493331[_0x2544('0x49')]['id'];}return db[_0x2544('0x2d')][_0x2544('0x47')]({'where':{'id':_0x493331[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x30d8d2,null))[_0x2544('0x25')](saveUpdates(_0x493331['body'],null))['then'](respondWithResult(_0x30d8d2,null))[_0x2544('0x41')](handleError(_0x30d8d2,null));};exports[_0x2544('0x26')]=function(_0x186b0f,_0x2aeac7){return db['Automation'][_0x2544('0x47')]({'where':{'id':_0x186b0f[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x2aeac7,null))['then'](removeEntity(_0x2aeac7,null))[_0x2544('0x41')](handleError(_0x2aeac7,null));};exports[_0x2544('0x4b')]=function(_0x5b4de5,_0x3701b2,_0x19dfa8){return db[_0x2544('0x4c')][_0x2544('0x47')]({'where':{'id':_0x5b4de5[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x3701b2,null))['then'](function(_0x419720){if(_0x419720){return _0x419720['addConditions'](_0x5b4de5[_0x2544('0x49')][_0x2544('0x4d')],_['omit'](_0x5b4de5['body'],[_0x2544('0x4d'),'id'])||{});}})[_0x2544('0x25')](respondWithResult(_0x3701b2,null))[_0x2544('0x41')](handleError(_0x3701b2,null));};exports[_0x2544('0x4e')]=function(_0x127fd3,_0x241089,_0x2c4149){var _0x46b820={};var _0x39d5d6={};var _0x2007ee;var _0x781233;return db[_0x2544('0x2d')][_0x2544('0x4f')]({'where':{'id':_0x127fd3['params']['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x241089,null))['then'](function(_0x4f0474){if(_0x4f0474){_0x2007ee=_0x4f0474;_0x39d5d6[_0x2544('0x30')]=_[_0x2544('0x44')](db[_0x2544('0x4c')][_0x2544('0x45')]);_0x39d5d6[_0x2544('0x31')]=_[_0x2544('0x44')](_0x127fd3['query']);_0x39d5d6[_0x2544('0x32')]=_['intersection'](_0x39d5d6[_0x2544('0x30')],_0x39d5d6['query']);_0x46b820[_0x2544('0x34')]=_[_0x2544('0x33')](_0x39d5d6[_0x2544('0x30')],qs['fields'](_0x127fd3[_0x2544('0x31')]['fields']));_0x46b820['attributes']=_0x46b820['attributes']['length']?_0x46b820[_0x2544('0x34')]:_0x39d5d6['model'];_0x46b820['order']=qs['sort'](_0x127fd3[_0x2544('0x31')]['sort']);_0x46b820[_0x2544('0x3b')]=qs['filters'](_[_0x2544('0x39')](_0x127fd3[_0x2544('0x31')],_0x39d5d6[_0x2544('0x32')]));if(_0x127fd3[_0x2544('0x31')][_0x2544('0x3a')]){_0x46b820[_0x2544('0x3b')]=_[_0x2544('0x3c')](_0x46b820[_0x2544('0x3b')],{'$or':_[_0x2544('0x2c')](_0x46b820['attributes'],function(_0x3d98f9){var _0xa8f35d={};_0xa8f35d[_0x3d98f9]={'$like':'%'+_0x127fd3['query']['filter']+'%'};return _0xa8f35d;})});}_0x46b820=_[_0x2544('0x3c')]({},_0x46b820,_0x127fd3['options']);return _0x2007ee[_0x2544('0x4e')](_0x46b820);}})[_0x2544('0x25')](function(_0x5f4b42){if(_0x5f4b42){_0x781233=_0x5f4b42[_0x2544('0x46')];if(!_0x127fd3[_0x2544('0x31')][_0x2544('0x36')](_0x2544('0x37'))){_0x46b820[_0x2544('0x1f')]=qs[_0x2544('0x1f')](_0x127fd3[_0x2544('0x31')][_0x2544('0x1f')]);_0x46b820[_0x2544('0x1d')]=qs[_0x2544('0x1d')](_0x127fd3[_0x2544('0x31')][_0x2544('0x1d')]);}return _0x2007ee[_0x2544('0x4e')](_0x46b820);}})['then'](function(_0x40d37b){if(_0x40d37b){return _0x40d37b?{'count':_0x781233,'rows':_0x40d37b}:null;}})['then'](respondWithResult(_0x241089,null))[_0x2544('0x41')](handleError(_0x241089,null));};exports['addActions']=function(_0x40a622,_0x44cd33,_0x4c4d7a){return db[_0x2544('0x50')][_0x2544('0x47')]({'where':{'id':_0x40a622[_0x2544('0x43')]['id']}})['then'](handleEntityNotFound(_0x44cd33,null))[_0x2544('0x25')](function(_0x2d60cf){if(_0x2d60cf){return _0x2d60cf['addActions'](_0x40a622[_0x2544('0x49')][_0x2544('0x4d')],_[_0x2544('0x51')](_0x40a622[_0x2544('0x49')],[_0x2544('0x4d'),'id'])||{});}})['then'](respondWithResult(_0x44cd33,null))[_0x2544('0x41')](handleError(_0x44cd33,null));};exports[_0x2544('0x52')]=function(_0x2dbaef,_0x425275,_0x175247){var _0x1befe4={};var _0x463295={};var _0x585fc9;var _0x17cb78;return db[_0x2544('0x2d')]['findOne']({'where':{'id':_0x2dbaef[_0x2544('0x43')]['id']}})[_0x2544('0x25')](handleEntityNotFound(_0x425275,null))[_0x2544('0x25')](function(_0x448f26){if(_0x448f26){_0x585fc9=_0x448f26;_0x463295[_0x2544('0x30')]=_[_0x2544('0x44')](db[_0x2544('0x50')][_0x2544('0x45')]);_0x463295[_0x2544('0x31')]=_[_0x2544('0x44')](_0x2dbaef[_0x2544('0x31')]);_0x463295['filters']=_[_0x2544('0x33')](_0x463295['model'],_0x463295['query']);_0x1befe4['attributes']=_[_0x2544('0x33')](_0x463295[_0x2544('0x30')],qs[_0x2544('0x35')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x35')]));_0x1befe4['attributes']=_0x1befe4[_0x2544('0x34')][_0x2544('0x46')]?_0x1befe4[_0x2544('0x34')]:_0x463295[_0x2544('0x30')];_0x1befe4[_0x2544('0x38')]=qs[_0x2544('0x53')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x53')]);_0x1befe4[_0x2544('0x3b')]=qs[_0x2544('0x32')](_[_0x2544('0x39')](_0x2dbaef[_0x2544('0x31')],_0x463295[_0x2544('0x32')]));if(_0x2dbaef['query'][_0x2544('0x3a')]){_0x1befe4[_0x2544('0x3b')]=_[_0x2544('0x3c')](_0x1befe4['where'],{'$or':_[_0x2544('0x2c')](_0x1befe4[_0x2544('0x34')],function(_0x522f0f){var _0x5532c4={};_0x5532c4[_0x522f0f]={'$like':'%'+_0x2dbaef['query'][_0x2544('0x3a')]+'%'};return _0x5532c4;})});}_0x1befe4=_[_0x2544('0x3c')]({},_0x1befe4,_0x2dbaef[_0x2544('0x3e')]);return _0x585fc9[_0x2544('0x52')](_0x1befe4);}})[_0x2544('0x25')](function(_0x4f9a45){if(_0x4f9a45){_0x17cb78=_0x4f9a45[_0x2544('0x46')];if(!_0x2dbaef[_0x2544('0x31')]['hasOwnProperty']('nolimit')){_0x1befe4['limit']=qs[_0x2544('0x1f')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x1f')]);_0x1befe4[_0x2544('0x1d')]=qs[_0x2544('0x1d')](_0x2dbaef[_0x2544('0x31')][_0x2544('0x1d')]);}return _0x585fc9[_0x2544('0x52')](_0x1befe4);}})[_0x2544('0x25')](function(_0x2b6616){if(_0x2b6616){return _0x2b6616?{'count':_0x17cb78,'rows':_0x2b6616}:null;}})[_0x2544('0x25')](respondWithResult(_0x425275,null))['catch'](handleError(_0x425275,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 40d6118..763943d 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 _0xb270=['../../config/logger','api','moment','path','rimraf','../../config/environment','./automation.attributes','exports','define','Automation','tools_automations','util'];(function(_0x4b4b0e,_0x6c674){var _0x4c2d91=function(_0x4d440d){while(--_0x4d440d){_0x4b4b0e['push'](_0x4b4b0e['shift']());}};_0x4c2d91(++_0x6c674);}(_0xb270,0x167));var _0x0b27=function(_0x2b0690,_0x4f742f){_0x2b0690=_0x2b0690-0x0;var _0x82be1=_0xb270[_0x2b0690];return _0x82be1;};'use strict';var _=require('lodash');var util=require(_0x0b27('0x0'));var logger=require(_0x0b27('0x1'))(_0x0b27('0x2'));var moment=require(_0x0b27('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b27('0x4'));var rimraf=require(_0x0b27('0x5'));var config=require(_0x0b27('0x6'));var attributes=require(_0x0b27('0x7'));module[_0x0b27('0x8')]=function(_0x2cab45,_0x436017){return _0x2cab45[_0x0b27('0x9')](_0x0b27('0xa'),attributes,{'tableName':_0x0b27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x292a=['./automation.attributes','exports','define','Automation','util','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x492547,_0x4cd3bc){var _0x43c08a=function(_0xbba0c5){while(--_0xbba0c5){_0x492547['push'](_0x492547['shift']());}};_0x43c08a(++_0x4cd3bc);}(_0x292a,0x68));var _0xa292=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x292a[_0xf51c06];return _0x1d5420;};'use strict';var _=require('lodash');var util=require(_0xa292('0x0'));var logger=require(_0xa292('0x1'))(_0xa292('0x2'));var moment=require('moment');var BPromise=require(_0xa292('0x3'));var rp=require(_0xa292('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa292('0x5'));var config=require('../../config/environment');var attributes=require(_0xa292('0x6'));module[_0xa292('0x7')]=function(_0x4f8de3,_0x242c49){return _0x4f8de3[_0xa292('0x8')](_0xa292('0x9'),attributes,{'tableName':'tools_automations','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 dfbab14..41a993d 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 _0x4959=['../../config/logger','rpc','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4959,0x9b));var _0x9495=function(_0x3156c9,_0x3ee8b8){_0x3156c9=_0x3156c9-0x0;var _0x486742=_0x4959[_0x3156c9];return _0x486742;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9495('0x0'));var BPromise=require(_0x9495('0x1'));var rs=require(_0x9495('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9495('0x3'))['db'];var utils=require(_0x9495('0x4'));var logger=require(_0x9495('0x5'))(_0x9495('0x6'));var config=require('../../config/environment');var jayson=require(_0x9495('0x7'));var client=jayson[_0x9495('0x8')][_0x9495('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x21f4e7,_0xd77231,_0x34744d){return new BPromise(function(_0x2a4754,_0x19f08c){return client[_0x9495('0xa')](_0x21f4e7,_0x34744d)[_0x9495('0xb')](function(_0x6b1466){logger['info'](_0x9495('0xc'),_0xd77231,'request\x20sent');logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0xd77231,'request\x20sent',JSON[_0x9495('0xd')](_0x6b1466));if(_0x6b1466[_0x9495('0xe')]){if(_0x6b1466[_0x9495('0xe')][_0x9495('0xf')]===0x1f4){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x19f08c(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);return _0x2a4754(_0x6b1466[_0x9495('0xe')][_0x9495('0x10')]);}else{logger['info'](_0x9495('0xc'),_0xd77231,_0x9495('0x11'));_0x2a4754(_0x6b1466[_0x9495('0x12')][_0x9495('0x10')]);}})[_0x9495('0x13')](function(_0x4c1d9d){logger[_0x9495('0xe')](_0x9495('0xc'),_0xd77231,_0x4c1d9d);_0x19f08c(_0x4c1d9d);});});} \ No newline at end of file +var _0x5a13=['info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','stringify','code','message','error'];(function(_0x2adbeb,_0x5581be){var _0x5e18a6=function(_0x84e42b){while(--_0x84e42b){_0x2adbeb['push'](_0x2adbeb['shift']());}};_0x5e18a6(++_0x5581be);}(_0x5a13,0x145));var _0x35a1=function(_0x11ba2d,_0xb2a851){_0x11ba2d=_0x11ba2d-0x0;var _0x5c3efd=_0x5a13[_0x11ba2d];return _0x5c3efd;};'use strict';var _=require(_0x35a1('0x0'));var util=require(_0x35a1('0x1'));var moment=require('moment');var BPromise=require(_0x35a1('0x2'));var rs=require(_0x35a1('0x3'));var fs=require('fs');var Redis=require(_0x35a1('0x4'));var db=require(_0x35a1('0x5'))['db'];var utils=require(_0x35a1('0x6'));var logger=require(_0x35a1('0x7'))(_0x35a1('0x8'));var config=require(_0x35a1('0x9'));var jayson=require(_0x35a1('0xa'));var client=jayson[_0x35a1('0xb')][_0x35a1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x407b26,_0x10a34f,_0x3aa00e){return new BPromise(function(_0x58afca,_0x57d9fd){return client['request'](_0x407b26,_0x3aa00e)[_0x35a1('0xd')](function(_0x103ec8){logger['info'](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));logger['debug']('Automation,\x20%s,\x20%s,\x20%s',_0x10a34f,_0x35a1('0xf'),JSON[_0x35a1('0x10')](_0x103ec8));if(_0x103ec8['error']){if(_0x103ec8['error'][_0x35a1('0x11')]===0x1f4){logger['error'](_0x35a1('0xe'),_0x10a34f,_0x103ec8['error'][_0x35a1('0x12')]);return _0x57d9fd(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);return _0x58afca(_0x103ec8[_0x35a1('0x13')][_0x35a1('0x12')]);}else{logger[_0x35a1('0x14')](_0x35a1('0xe'),_0x10a34f,_0x35a1('0xf'));_0x58afca(_0x103ec8[_0x35a1('0x15')][_0x35a1('0x12')]);}})[_0x35a1('0x16')](function(_0x251d32){logger[_0x35a1('0x13')](_0x35a1('0xe'),_0x10a34f,_0x251d32);_0x57d9fd(_0x251d32);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index af5dfcc..8a2b500 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 _0xb205=['Router','fs-extra','../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','/:id/actions','getActions','post','create','addActions','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x28e459,_0x1a066b){var _0x5ccc9e=function(_0x36e31a){while(--_0x36e31a){_0x28e459['push'](_0x28e459['shift']());}};_0x5ccc9e(++_0x1a066b);}(_0xb205,0x156));var _0x5b20=function(_0x43a129,_0x17d8ab){_0x43a129=_0x43a129-0x0;var _0x314353=_0xb205[_0x43a129];return _0x314353;};'use strict';var multer=require(_0x5b20('0x0'));var util=require('util');var path=require(_0x5b20('0x1'));var timeout=require(_0x5b20('0x2'));var express=require('express');var router=express[_0x5b20('0x3')]();var fs_extra=require(_0x5b20('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b20('0x5'));var config=require(_0x5b20('0x6'));var controller=require(_0x5b20('0x7'));router[_0x5b20('0x8')]('/',auth[_0x5b20('0x9')](),controller[_0x5b20('0xa')]);router[_0x5b20('0x8')](_0x5b20('0xb'),auth[_0x5b20('0x9')](),controller[_0x5b20('0xc')]);router[_0x5b20('0x8')](_0x5b20('0xd'),auth[_0x5b20('0x9')](),controller['getConditions']);router[_0x5b20('0x8')](_0x5b20('0xe'),auth[_0x5b20('0x9')](),controller[_0x5b20('0xf')]);router[_0x5b20('0x10')]('/',auth[_0x5b20('0x9')](),controller[_0x5b20('0x11')]);router['post']('/:id/conditions',auth[_0x5b20('0x9')](),controller['addConditions']);router[_0x5b20('0x10')](_0x5b20('0xe'),auth[_0x5b20('0x9')](),controller[_0x5b20('0x12')]);router['put'](_0x5b20('0xb'),auth[_0x5b20('0x9')](),controller[_0x5b20('0x13')]);router[_0x5b20('0x14')](_0x5b20('0xb'),auth['isAuthenticated'](),controller[_0x5b20('0x15')]);module[_0x5b20('0x16')]=router; \ No newline at end of file +var _0x0cd6=['/:id/conditions','getConditions','/:id/actions','post','addConditions','addActions','/:id','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','./automation.controller','get','isAuthenticated','show'];(function(_0x3c8b42,_0x3429fa){var _0x6f8135=function(_0x5e4b40){while(--_0x5e4b40){_0x3c8b42['push'](_0x3c8b42['shift']());}};_0x6f8135(++_0x3429fa);}(_0x0cd6,0x113));var _0x60cd=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0x0cd6[_0x26f1b2];return _0x1624a4;};'use strict';var multer=require(_0x60cd('0x0'));var util=require(_0x60cd('0x1'));var path=require('path');var timeout=require(_0x60cd('0x2'));var express=require(_0x60cd('0x3'));var router=express['Router']();var fs_extra=require(_0x60cd('0x4'));var auth=require(_0x60cd('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x60cd('0x6'));router[_0x60cd('0x7')]('/',auth[_0x60cd('0x8')](),controller['index']);router[_0x60cd('0x7')]('/:id',auth[_0x60cd('0x8')](),controller[_0x60cd('0x9')]);router[_0x60cd('0x7')](_0x60cd('0xa'),auth[_0x60cd('0x8')](),controller[_0x60cd('0xb')]);router[_0x60cd('0x7')](_0x60cd('0xc'),auth[_0x60cd('0x8')](),controller['getActions']);router[_0x60cd('0xd')]('/',auth[_0x60cd('0x8')](),controller['create']);router[_0x60cd('0xd')]('/:id/conditions',auth[_0x60cd('0x8')](),controller[_0x60cd('0xe')]);router['post'](_0x60cd('0xc'),auth[_0x60cd('0x8')](),controller[_0x60cd('0xf')]);router['put'](_0x60cd('0x10'),auth[_0x60cd('0x8')](),controller['update']);router[_0x60cd('0x11')]('/:id',auth[_0x60cd('0x8')](),controller[_0x60cd('0x12')]);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 66ce21e..1ebdea5 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 _0x0f46=['name','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','ENUM','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)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING'];(function(_0x53d93e,_0x371336){var _0x11b182=function(_0x3e87fe){while(--_0x3e87fe){_0x53d93e['push'](_0x53d93e['shift']());}};_0x11b182(++_0x371336);}(_0x0f46,0x1a1));var _0x60f4=function(_0x812db,_0x2e8c4d){_0x812db=_0x812db-0x0;var _0xbff811=_0x0f46[_0x812db];return _0xbff811;};'use strict';var Sequelize=require(_0x60f4('0x0'));module[_0x60f4('0x1')]={'name':{'type':Sequelize[_0x60f4('0x2')],'unique':_0x60f4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM']('ivr'),'allowNull':![],'defaultValue':_0x60f4('0x4')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x60f4('0x5')],'defaultValue':0x0,'comment':_0x60f4('0x6')},'limitCalls':{'type':Sequelize[_0x60f4('0x7')](0x4)[_0x60f4('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x60f4('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x60f4('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x60f4('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'comment':_0x60f4('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x60f4('0xe')},'dialTimezone':{'type':Sequelize[_0x60f4('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x60f4('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x60f4('0xf')](_0x60f4('0x10'),'never','onlyIfOpen'),'defaultValue':_0x60f4('0x10')},'dialAMDActive':{'type':Sequelize[_0x60f4('0x5')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0x60f4('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x60f4('0x11')},'dialAMDGreeting':{'type':Sequelize[_0x60f4('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x60f4('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x60f4('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x60f4('0x7')](0x9)[_0x60f4('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x60f4('0x13')},'dialAMDMinWordLength':{'type':Sequelize[_0x60f4('0x7')](0x9)[_0x60f4('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x60f4('0x7')](0x9)[_0x60f4('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x60f4('0x14')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x60f4('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x60f4('0x15')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x60f4('0x16')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x60f4('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x60f4('0xf')](_0x60f4('0x17'),_0x60f4('0x18')),'defaultValue':_0x60f4('0x17')},'dialPrefix':{'type':Sequelize[_0x60f4('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x60f4('0x19')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x60f4('0x1a')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x1b')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0x1c')},'dialDropMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x1d')},'dialDropRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0x1e')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x1f')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x60f4('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x60f4('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x60f4('0x7')](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x60f4('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x60f4('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x60f4('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0x6bfc=['INTEGER','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)','07:00-22:00,*,*,*','ENUM','always','never','BOOLEAN','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','ivr','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','STRING'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x6bfc,0x1da));var _0xc6bf=function(_0x39ddf1,_0x4ddf8a){_0x39ddf1=_0x39ddf1-0x0;var _0xe30e04=_0x6bfc[_0x39ddf1];return _0xe30e04;};'use strict';var Sequelize=require(_0xc6bf('0x0'));module[_0xc6bf('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xc6bf('0x2')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xc6bf('0x3')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0xc6bf('0x4')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc6bf('0x5')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc6bf('0x6')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc6bf('0x6')]},'dialOriginateTimeout':{'type':Sequelize[_0xc6bf('0x7')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x9')},'dialBusyMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'comment':_0xc6bf('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xc6bf('0xd')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc6bf('0x6')],'defaultValue':_0xc6bf('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xc6bf('0xf')](_0xc6bf('0x10'),_0xc6bf('0x11'),'onlyIfOpen'),'defaultValue':_0xc6bf('0x10')},'dialAMDActive':{'type':Sequelize[_0xc6bf('0x12')],'defaultValue':0x0,'comment':_0xc6bf('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xc6bf('0x4')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc6bf('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc6bf('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc6bf('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc6bf('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc6bf('0x7')](0x9)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc6bf('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc6bf('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0xc6bf('0xf')](_0xc6bf('0x19'),_0xc6bf('0x1a')),'defaultValue':_0xc6bf('0x19')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xc6bf('0x4')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc6bf('0x1b')},'dialCutDigit':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc6bf('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0xc6bf('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc6bf('0x23')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc6bf('0x4')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc6bf('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc6bf('0x7')](0x5)[_0xc6bf('0x4')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 3e01ead..522e686 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 _0x0f92=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','clone','find','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getHoppers','findOne','CmHopper','getHopperHistories','CampaignId','CmHopperHistory','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ContactId','ListId','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','select','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','cm_hopper_additional_phones','OrderBy','h.id','ci.item','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','ListId\x20=\x20?','removeBlackLists','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','IvrCampaigns','UserProfileResource','name','send','index','Campaign','fieldName','type'];(function(_0xd94f9c,_0x12791e){var _0x2e867a=function(_0x59d098){while(--_0x59d098){_0xd94f9c['push'](_0xd94f9c['shift']());}};_0x2e867a(++_0x12791e);}(_0x0f92,0xfd));var _0x20f9=function(_0x2d733c,_0x5893ce){_0x2d733c=_0x2d733c-0x0;var _0x10582d=_0x0f92[_0x2d733c];return _0x10582d;};'use strict';var emlformat=require(_0x20f9('0x0'));var rimraf=require(_0x20f9('0x1'));var zipdir=require(_0x20f9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x20f9('0x3'));var moment=require(_0x20f9('0x4'));var BPromise=require(_0x20f9('0x5'));var Mustache=require(_0x20f9('0x6'));var util=require(_0x20f9('0x7'));var path=require(_0x20f9('0x8'));var sox=require(_0x20f9('0x9'));var csv=require(_0x20f9('0xa'));var ejs=require(_0x20f9('0xb'));var fs=require('fs');var fs_extra=require(_0x20f9('0xc'));var _=require(_0x20f9('0xd'));var squel=require('squel');var crypto=require(_0x20f9('0xe'));var jsforce=require(_0x20f9('0xf'));var deskjs=require(_0x20f9('0x10'));var toCsv=require(_0x20f9('0xa'));var querystring=require(_0x20f9('0x11'));var Papa=require('papaparse');var Redis=require(_0x20f9('0x12'));var authService=require(_0x20f9('0x13'));var qs=require(_0x20f9('0x14'));var as=require(_0x20f9('0x15'));var hardwareService=require(_0x20f9('0x16'));var logger=require('../../config/logger')(_0x20f9('0x17'));var utils=require(_0x20f9('0x18'));var config=require(_0x20f9('0x19'));var licenseUtil=require(_0x20f9('0x1a'));var db=require(_0x20f9('0x1b'))['db'];function respondWithStatusCode(_0x44a279,_0x15cc0d){_0x15cc0d=_0x15cc0d||0xcc;return function(_0x128cbf){if(_0x128cbf){return _0x44a279[_0x20f9('0x1c')](_0x15cc0d);}return _0x44a279[_0x20f9('0x1d')](_0x15cc0d)[_0x20f9('0x1e')]();};}function respondWithResult(_0x510cdf,_0x57b2ba){_0x57b2ba=_0x57b2ba||0xc8;return function(_0x56091c){if(_0x56091c){return _0x510cdf['status'](_0x57b2ba)[_0x20f9('0x1f')](_0x56091c);}};}function respondWithFilteredResult(_0x2a8e47,_0x50b9d0){return function(_0x520dd6){if(_0x520dd6){var _0x342fa8=typeof _0x50b9d0[_0x20f9('0x20')]==='undefined'&&typeof _0x50b9d0[_0x20f9('0x21')]==='undefined';var _0x42a7b0=_0x520dd6['count'];var _0x47b815=_0x342fa8?0x0:_0x50b9d0[_0x20f9('0x20')];var _0x55bf75=_0x342fa8?_0x520dd6[_0x20f9('0x22')]:_0x50b9d0[_0x20f9('0x20')]+_0x50b9d0[_0x20f9('0x21')];var _0x1ba7ef;if(_0x55bf75>=_0x42a7b0){_0x55bf75=_0x42a7b0;_0x1ba7ef=0xc8;}else{_0x1ba7ef=0xce;}_0x2a8e47[_0x20f9('0x1d')](_0x1ba7ef);return _0x2a8e47[_0x20f9('0x23')](_0x20f9('0x24'),_0x47b815+'-'+_0x55bf75+'/'+_0x42a7b0)[_0x20f9('0x1f')](_0x520dd6);}return null;};}function patchUpdates(_0x1ab050){return function(_0x7bece3){try{jsonpatch[_0x20f9('0x25')](_0x7bece3,_0x1ab050,!![]);}catch(_0x3e3768){return BPromise[_0x20f9('0x26')](_0x3e3768);}return _0x7bece3['save']();};}function saveUpdates(_0x39fd68,_0x35f54d){return function(_0x555b1a){if(_0x555b1a){return _0x555b1a[_0x20f9('0x27')](_0x39fd68)['then'](function(_0x4497d4){return _0x4497d4;});}return null;};}function removeEntity(_0x525aaa,_0x41cb76){return function(_0x51c604){if(_0x51c604){return _0x51c604[_0x20f9('0x28')]()[_0x20f9('0x29')](function(){var _0x576539=_0x51c604[_0x20f9('0x2a')]({'plain':!![]});var _0x2d466a=_0x20f9('0x2b');return db[_0x20f9('0x2c')]['destroy']({'where':{'type':_0x2d466a,'resourceId':_0x576539['id']}})[_0x20f9('0x29')](function(){return _0x51c604;});})['then'](function(){_0x525aaa['status'](0xcc)[_0x20f9('0x1e')]();});}};}function handleEntityNotFound(_0x180045,_0x3b3379){return function(_0x3b94e3){if(!_0x3b94e3){_0x180045[_0x20f9('0x1c')](0x194);}return _0x3b94e3;};}function handleError(_0x190cc8,_0x64e240){_0x64e240=_0x64e240||0x1f4;return function(_0x21bf24){logger['error'](_0x21bf24['stack']);if(_0x21bf24[_0x20f9('0x2d')]){delete _0x21bf24['name'];}_0x190cc8[_0x20f9('0x1d')](_0x64e240)[_0x20f9('0x2e')](_0x21bf24);};}exports[_0x20f9('0x2f')]=function(_0x39bfde,_0x1d8259){var _0x56eb57={},_0x3d4bf7={},_0x85a502={'count':0x0,'rows':[]};var _0x511acf=_['map'](db[_0x20f9('0x30')]['rawAttributes'],function(_0x460c78){return{'name':_0x460c78[_0x20f9('0x31')],'type':_0x460c78[_0x20f9('0x32')]['key']};});_0x3d4bf7[_0x20f9('0x33')]=_['map'](_0x511acf,_0x20f9('0x2d'));_0x3d4bf7[_0x20f9('0x34')]=_['keys'](_0x39bfde['query']);_0x3d4bf7[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x3d4bf7[_0x20f9('0x33')],_0x3d4bf7['query']);_0x56eb57[_0x20f9('0x37')]=_[_0x20f9('0x36')](_0x3d4bf7[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x39bfde['query'][_0x20f9('0x38')]));_0x56eb57[_0x20f9('0x37')]=_0x56eb57[_0x20f9('0x37')][_0x20f9('0x39')]?_0x56eb57[_0x20f9('0x37')]:_0x3d4bf7[_0x20f9('0x33')];if(!_0x39bfde[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x56eb57[_0x20f9('0x21')]=qs['limit'](_0x39bfde[_0x20f9('0x34')][_0x20f9('0x21')]);_0x56eb57['offset']=qs[_0x20f9('0x20')](_0x39bfde['query'][_0x20f9('0x20')]);}_0x56eb57[_0x20f9('0x3c')]=qs[_0x20f9('0x3d')](_0x39bfde['query']['sort']);_0x56eb57[_0x20f9('0x3e')]=qs[_0x20f9('0x35')](_[_0x20f9('0x3f')](_0x39bfde[_0x20f9('0x34')],_0x3d4bf7[_0x20f9('0x35')]),_0x511acf);if(_0x39bfde[_0x20f9('0x34')][_0x20f9('0x40')]){_0x56eb57['where']=_['merge'](_0x56eb57[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x511acf,function(_0x207369){if(_0x207369[_0x20f9('0x32')]!==_0x20f9('0x42')){var _0x3979e4={};_0x3979e4[_0x207369[_0x20f9('0x2d')]]={'$like':'%'+_0x39bfde[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x3979e4;}})});}_0x56eb57=_[_0x20f9('0x43')]({},_0x56eb57,_0x39bfde[_0x20f9('0x44')]);var _0x57d30b={'where':_0x56eb57['where']};return db[_0x20f9('0x30')][_0x20f9('0x22')](_0x57d30b)['then'](function(_0x1e49fe){_0x85a502['count']=_0x1e49fe;if(_0x39bfde[_0x20f9('0x34')][_0x20f9('0x45')]){_0x56eb57[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x30')][_0x20f9('0x47')](_0x56eb57);})['then'](function(_0x3693b7){_0x85a502[_0x20f9('0x48')]=_0x3693b7;return _0x85a502;})[_0x20f9('0x29')](respondWithFilteredResult(_0x1d8259,_0x56eb57))[_0x20f9('0x49')](handleError(_0x1d8259,null));};exports[_0x20f9('0x4a')]=function(_0x29ff1f,_0x11e65f){var _0x1c2fdd={'raw':![],'where':{'id':_0x29ff1f['params']['id']}},_0x3d97b1={};_0x3d97b1[_0x20f9('0x33')]=_['keys'](db[_0x20f9('0x30')][_0x20f9('0x4b')]);_0x3d97b1[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x29ff1f[_0x20f9('0x34')]);_0x3d97b1[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x3d97b1['model'],_0x3d97b1[_0x20f9('0x34')]);_0x1c2fdd[_0x20f9('0x37')]=_['intersection'](_0x3d97b1['model'],qs[_0x20f9('0x38')](_0x29ff1f[_0x20f9('0x34')][_0x20f9('0x38')]));_0x1c2fdd[_0x20f9('0x37')]=_0x1c2fdd['attributes'][_0x20f9('0x39')]?_0x1c2fdd[_0x20f9('0x37')]:_0x3d97b1['model'];if(_0x29ff1f[_0x20f9('0x34')][_0x20f9('0x45')]){_0x1c2fdd['include']=[{'all':!![]}];}_0x1c2fdd=_[_0x20f9('0x43')]({},_0x1c2fdd,_0x29ff1f[_0x20f9('0x44')]);return db[_0x20f9('0x30')]['find'](_0x1c2fdd)[_0x20f9('0x29')](handleEntityNotFound(_0x11e65f,null))[_0x20f9('0x29')](respondWithResult(_0x11e65f,null))['catch'](handleError(_0x11e65f,null));};exports['create']=function(_0x153a8e,_0x5694e0){return db[_0x20f9('0x30')][_0x20f9('0x4d')](_0x153a8e[_0x20f9('0x4e')],{})[_0x20f9('0x29')](function(_0x10a94d){var _0x5e8e5f=_0x153a8e[_0x20f9('0x4f')][_0x20f9('0x2a')]({'plain':!![]});if(!_0x5e8e5f)throw new Error(_0x20f9('0x50'));if(_0x5e8e5f[_0x20f9('0x51')]===_0x20f9('0x4f')){var _0x261b2b=_0x10a94d[_0x20f9('0x2a')]({'plain':!![]});var _0x4fa068=_0x20f9('0x2b');return db[_0x20f9('0x52')]['find']({'where':{'name':_0x4fa068,'userProfileId':_0x5e8e5f[_0x20f9('0x53')]},'raw':!![]})['then'](function(_0x454948){if(_0x454948&&_0x454948[_0x20f9('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x261b2b[_0x20f9('0x2d')],'resourceId':_0x261b2b['id'],'type':_0x454948[_0x20f9('0x2d')],'sectionId':_0x454948['id']},{})[_0x20f9('0x29')](function(){return _0x10a94d;});}else{return _0x10a94d;}})[_0x20f9('0x49')](function(_0x45475e){logger[_0x20f9('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45475e);throw _0x45475e;});}return _0x10a94d;})[_0x20f9('0x29')](respondWithResult(_0x5694e0,0xc9))[_0x20f9('0x49')](handleError(_0x5694e0,null));};exports[_0x20f9('0x56')]=function(_0x13e638,_0x575b57){var _0x3c3e46={'where':{'id':_0x13e638['params']['id']}},_0x18a97d={};_0x18a97d[_0x20f9('0x33')]=_[_0x20f9('0x4c')](db[_0x20f9('0x30')]['rawAttributes']);_0x3c3e46[_0x20f9('0x37')]=_[_0x20f9('0x36')](_0x18a97d[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x13e638[_0x20f9('0x34')][_0x20f9('0x38')]));_0x3c3e46[_0x20f9('0x37')]=_0x3c3e46[_0x20f9('0x37')]['length']?_0x3c3e46[_0x20f9('0x37')]:_0x18a97d[_0x20f9('0x33')];if(_0x13e638['query'][_0x20f9('0x45')]){_0x3c3e46[_0x20f9('0x46')]=[{'all':!![]}];}_0x3c3e46=_[_0x20f9('0x43')]({},_0x3c3e46,_0x13e638[_0x20f9('0x44')]);return db[_0x20f9('0x30')][_0x20f9('0x57')](_0x3c3e46)[_0x20f9('0x29')](handleEntityNotFound(_0x575b57,null))['then'](function(_0x5e7cec){if(_0x5e7cec){var _0x4046dc=_0x5e7cec[_0x20f9('0x2a')]({'plain':!![]});_0x4046dc=qs[_0x20f9('0x58')](_0x4046dc,['id',_0x20f9('0x59'),_0x20f9('0x5a')]);_0x13e638['body']=_[_0x20f9('0x58')](_0x13e638[_0x20f9('0x4e')],['id','createdAt',_0x20f9('0x5a')]);return db[_0x20f9('0x30')][_0x20f9('0x4d')](_[_0x20f9('0x43')](_0x4046dc,_0x13e638[_0x20f9('0x4e')]),{'include':_0x13e638['query']['includeAll']?[{'all':!![]}]:undefined})[_0x20f9('0x29')](function(_0x15b746){var _0x2c0255=_0x13e638['user'][_0x20f9('0x2a')]({'plain':!![]});if(!_0x2c0255)throw new Error(_0x20f9('0x50'));if(_0x2c0255[_0x20f9('0x51')]===_0x20f9('0x4f')){var _0x502e1d=_0x15b746[_0x20f9('0x2a')]({'plain':!![]});var _0x8c2388=_0x20f9('0x2b');return db[_0x20f9('0x52')][_0x20f9('0x57')]({'where':{'name':_0x8c2388,'userProfileId':_0x2c0255[_0x20f9('0x53')]},'raw':!![]})[_0x20f9('0x29')](function(_0x57514c){if(_0x57514c&&_0x57514c[_0x20f9('0x54')]===0x0){return db[_0x20f9('0x2c')][_0x20f9('0x4d')]({'name':_0x502e1d[_0x20f9('0x2d')],'resourceId':_0x502e1d['id'],'type':_0x57514c[_0x20f9('0x2d')],'sectionId':_0x57514c['id']},{})[_0x20f9('0x29')](function(){return _0x15b746;});}else{return _0x15b746;}})[_0x20f9('0x49')](function(_0x640f44){logger[_0x20f9('0x55')](_0x20f9('0x5b'),_0x640f44);throw _0x640f44;});}return _0x15b746;});}})[_0x20f9('0x29')](respondWithResult(_0x575b57,0xc9))[_0x20f9('0x49')](handleError(_0x575b57,null));};exports['update']=function(_0x3e3ef2,_0x156421){if(_0x3e3ef2[_0x20f9('0x4e')]['id']){delete _0x3e3ef2[_0x20f9('0x4e')]['id'];}return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x3e3ef2[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x156421,null))[_0x20f9('0x29')](saveUpdates(_0x3e3ef2[_0x20f9('0x4e')],null))[_0x20f9('0x29')](respondWithResult(_0x156421,null))['catch'](handleError(_0x156421,null));};exports['destroy']=function(_0x334fe0,_0x49e293){return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x334fe0[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x49e293,null))['then'](removeEntity(_0x49e293,null))[_0x20f9('0x49')](handleError(_0x49e293,null));};exports[_0x20f9('0x5d')]=function(_0x3f62c3,_0x574403,_0x3aa622){var _0x18cb22={'raw':!![],'where':{}};var _0x3b2739={};var _0x3cb783={'count':0x0,'rows':[]};return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x3f62c3[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x574403,null))[_0x20f9('0x29')](function(_0x1d6c14){if(_0x1d6c14){_0x3b2739[_0x20f9('0x33')]=_[_0x20f9('0x4c')](db[_0x20f9('0x5f')][_0x20f9('0x4b')]);_0x3b2739[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x3f62c3['query']);_0x3b2739[_0x20f9('0x35')]=_['intersection'](_0x3b2739[_0x20f9('0x33')],_0x3b2739[_0x20f9('0x34')]);_0x18cb22['attributes']=_[_0x20f9('0x36')](_0x3b2739[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x38')]));_0x18cb22[_0x20f9('0x37')]=_0x18cb22[_0x20f9('0x37')]['length']?_0x18cb22[_0x20f9('0x37')]:_0x3b2739[_0x20f9('0x33')];if(!_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x18cb22[_0x20f9('0x21')]=qs[_0x20f9('0x21')](_0x3f62c3['query']['limit']);_0x18cb22[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x20')]);}_0x18cb22[_0x20f9('0x3c')]=qs[_0x20f9('0x3d')](_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x18cb22['where']=qs[_0x20f9('0x35')](_['pick'](_0x3f62c3['query'],_0x3b2739[_0x20f9('0x35')]));_0x18cb22[_0x20f9('0x3e')]['CampaignId']=_0x1d6c14['id'];if(_0x3f62c3['query']['filter']){_0x18cb22[_0x20f9('0x3e')]=_['merge'](_0x18cb22[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x18cb22[_0x20f9('0x37')],function(_0x24f606){var _0x15638b={};_0x15638b[_0x24f606]={'$like':'%'+_0x3f62c3[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x15638b;})});}_0x18cb22=_[_0x20f9('0x43')]({},_0x18cb22,_0x3f62c3['options']);return db['CmHopper']['count']({'where':_0x18cb22[_0x20f9('0x3e')]})[_0x20f9('0x29')](function(_0x256c14){_0x3cb783['count']=_0x256c14;if(_0x3f62c3['query'][_0x20f9('0x45')]){_0x18cb22[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x5f')][_0x20f9('0x47')](_0x18cb22);})[_0x20f9('0x29')](function(_0x4d7493){_0x3cb783[_0x20f9('0x48')]=_0x4d7493;return _0x3cb783;});}})[_0x20f9('0x29')](respondWithFilteredResult(_0x574403,_0x18cb22))[_0x20f9('0x49')](handleError(_0x574403,null));};exports[_0x20f9('0x60')]=function(_0x4680a0,_0xab2b20,_0xe74ea4){var _0x24d68c={'raw':!![],'where':{}};var _0x44b524={};var _0x12d386={'count':0x0,'rows':[]};return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x4680a0[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0xab2b20,null))[_0x20f9('0x29')](function(_0x4e1813){if(_0x4e1813){_0x44b524[_0x20f9('0x33')]=_[_0x20f9('0x4c')](db['CmHopperHistory'][_0x20f9('0x4b')]);_0x44b524[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x4680a0[_0x20f9('0x34')]);_0x44b524[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x44b524[_0x20f9('0x33')],_0x44b524[_0x20f9('0x34')]);_0x24d68c[_0x20f9('0x37')]=_['intersection'](_0x44b524[_0x20f9('0x33')],qs['fields'](_0x4680a0[_0x20f9('0x34')][_0x20f9('0x38')]));_0x24d68c['attributes']=_0x24d68c[_0x20f9('0x37')][_0x20f9('0x39')]?_0x24d68c[_0x20f9('0x37')]:_0x44b524[_0x20f9('0x33')];if(!_0x4680a0[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x24d68c[_0x20f9('0x21')]=qs[_0x20f9('0x21')](_0x4680a0[_0x20f9('0x34')][_0x20f9('0x21')]);_0x24d68c[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x4680a0[_0x20f9('0x34')][_0x20f9('0x20')]);}_0x24d68c['order']=qs['sort'](_0x4680a0['query'][_0x20f9('0x3d')]);_0x24d68c['where']=qs['filters'](_['pick'](_0x4680a0[_0x20f9('0x34')],_0x44b524[_0x20f9('0x35')]));_0x24d68c[_0x20f9('0x3e')][_0x20f9('0x61')]=_0x4e1813['id'];if(_0x4680a0[_0x20f9('0x34')][_0x20f9('0x40')]){_0x24d68c[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0x24d68c[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x24d68c['attributes'],function(_0x16026b){var _0x29b6ce={};_0x29b6ce[_0x16026b]={'$like':'%'+_0x4680a0[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x29b6ce;})});}_0x24d68c=_['merge']({},_0x24d68c,_0x4680a0['options']);return db[_0x20f9('0x62')][_0x20f9('0x22')]({'where':_0x24d68c[_0x20f9('0x3e')]})['then'](function(_0x28f0b3){_0x12d386[_0x20f9('0x22')]=_0x28f0b3;if(_0x4680a0[_0x20f9('0x34')]['includeAll']){_0x24d68c[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x62')]['findAll'](_0x24d68c);})[_0x20f9('0x29')](function(_0x2fdd2a){_0x12d386[_0x20f9('0x48')]=_0x2fdd2a;return _0x12d386;});}})[_0x20f9('0x29')](respondWithFilteredResult(_0xab2b20,_0x24d68c))['catch'](handleError(_0xab2b20,null));};exports['getHopperFinals']=function(_0x59ca1f,_0x48ec95,_0x4bee73){var _0xcbacf9={'raw':!![],'where':{}};var _0x1f88f8={};var _0x291c7e={'count':0x0,'rows':[]};return db[_0x20f9('0x30')]['findOne']({'where':{'id':_0x59ca1f['params']['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x48ec95,null))['then'](function(_0x263503){if(_0x263503){_0x1f88f8['model']=_[_0x20f9('0x4c')](db[_0x20f9('0x63')][_0x20f9('0x4b')]);_0x1f88f8['query']=_[_0x20f9('0x4c')](_0x59ca1f[_0x20f9('0x34')]);_0x1f88f8[_0x20f9('0x35')]=_['intersection'](_0x1f88f8['model'],_0x1f88f8[_0x20f9('0x34')]);_0xcbacf9[_0x20f9('0x37')]=_[_0x20f9('0x36')](_0x1f88f8['model'],qs[_0x20f9('0x38')](_0x59ca1f['query'][_0x20f9('0x38')]));_0xcbacf9['attributes']=_0xcbacf9[_0x20f9('0x37')][_0x20f9('0x39')]?_0xcbacf9[_0x20f9('0x37')]:_0x1f88f8[_0x20f9('0x33')];if(!_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0xcbacf9[_0x20f9('0x21')]=qs[_0x20f9('0x21')](_0x59ca1f['query'][_0x20f9('0x21')]);_0xcbacf9[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x20')]);}_0xcbacf9['order']=qs[_0x20f9('0x3d')](_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x3d')]);_0xcbacf9['where']=qs[_0x20f9('0x35')](_['pick'](_0x59ca1f[_0x20f9('0x34')],_0x1f88f8[_0x20f9('0x35')]));_0xcbacf9['where'][_0x20f9('0x61')]=_0x263503['id'];if(_0x59ca1f['query']['filter']){_0xcbacf9[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0xcbacf9[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0xcbacf9[_0x20f9('0x37')],function(_0x20a323){var _0x2373f5={};_0x2373f5[_0x20a323]={'$like':'%'+_0x59ca1f[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x2373f5;})});}_0xcbacf9=_[_0x20f9('0x43')]({},_0xcbacf9,_0x59ca1f[_0x20f9('0x44')]);return db['CmHopperFinal'][_0x20f9('0x22')]({'where':_0xcbacf9[_0x20f9('0x3e')]})[_0x20f9('0x29')](function(_0x3dd80e){_0x291c7e[_0x20f9('0x22')]=_0x3dd80e;if(_0x59ca1f['query'][_0x20f9('0x45')]){_0xcbacf9['include']=[{'all':!![]}];}return db['CmHopperFinal'][_0x20f9('0x47')](_0xcbacf9);})[_0x20f9('0x29')](function(_0x1f10f5){_0x291c7e[_0x20f9('0x48')]=_0x1f10f5;return _0x291c7e;});}})['then'](respondWithFilteredResult(_0x48ec95,_0xcbacf9))['catch'](handleError(_0x48ec95,null));};exports[_0x20f9('0x64')]=function(_0x43f05e,_0x213cb6,_0x312e5d){var _0x2ab112={'raw':!![],'where':{}};var _0x4d6b7d={};var _0x4f8e07={'count':0x0,'rows':[]};return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x43f05e[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x213cb6,null))['then'](function(_0x22a1f4){if(_0x22a1f4){_0x4d6b7d[_0x20f9('0x33')]=_['keys'](db[_0x20f9('0x65')][_0x20f9('0x4b')]);_0x4d6b7d[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x43f05e[_0x20f9('0x34')]);_0x4d6b7d[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x4d6b7d['model'],_0x4d6b7d[_0x20f9('0x34')]);_0x2ab112['attributes']=_[_0x20f9('0x36')](_0x4d6b7d['model'],qs[_0x20f9('0x38')](_0x43f05e[_0x20f9('0x34')][_0x20f9('0x38')]));_0x2ab112[_0x20f9('0x37')]=_0x2ab112['attributes'][_0x20f9('0x39')]?_0x2ab112[_0x20f9('0x37')]:_0x4d6b7d['model'];if(!_0x43f05e[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x2ab112[_0x20f9('0x21')]=qs['limit'](_0x43f05e[_0x20f9('0x34')][_0x20f9('0x21')]);_0x2ab112[_0x20f9('0x20')]=qs['offset'](_0x43f05e[_0x20f9('0x34')]['offset']);}_0x2ab112['order']=qs[_0x20f9('0x3d')](_0x43f05e[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x2ab112['where']=qs[_0x20f9('0x35')](_['pick'](_0x43f05e[_0x20f9('0x34')],_0x4d6b7d[_0x20f9('0x35')]));_0x2ab112[_0x20f9('0x3e')][_0x20f9('0x61')]=_0x22a1f4['id'];if(_0x43f05e['query']['filter']){_0x2ab112[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0x2ab112[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x2ab112[_0x20f9('0x37')],function(_0x434269){var _0x1ca22f={};_0x1ca22f[_0x434269]={'$like':'%'+_0x43f05e[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x1ca22f;})});}_0x2ab112=_[_0x20f9('0x43')]({},_0x2ab112,_0x43f05e[_0x20f9('0x44')]);return db[_0x20f9('0x65')][_0x20f9('0x22')]({'where':_0x2ab112[_0x20f9('0x3e')]})[_0x20f9('0x29')](function(_0x548742){_0x4f8e07[_0x20f9('0x22')]=_0x548742;if(_0x43f05e[_0x20f9('0x34')][_0x20f9('0x45')]){_0x2ab112[_0x20f9('0x46')]=[{'all':!![]}];}return db[_0x20f9('0x65')][_0x20f9('0x47')](_0x2ab112);})['then'](function(_0x2689ac){_0x4f8e07['rows']=_0x2689ac;return _0x4f8e07;});}})[_0x20f9('0x29')](respondWithFilteredResult(_0x213cb6,_0x2ab112))['catch'](handleError(_0x213cb6,null));};exports[_0x20f9('0x66')]=function(_0x14a48c,_0x30a713,_0x65e3a){var _0x5925cc={};var _0x5ad507={};var _0x538be1;var _0x7929f5;return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x14a48c['params']['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x30a713,null))[_0x20f9('0x29')](function(_0x221f97){if(_0x221f97){_0x538be1=_0x221f97;_0x5ad507['model']=_[_0x20f9('0x4c')](db[_0x20f9('0x67')][_0x20f9('0x4b')]);_0x5ad507[_0x20f9('0x34')]=_['keys'](_0x14a48c['query']);_0x5ad507['filters']=_[_0x20f9('0x36')](_0x5ad507['model'],_0x5ad507[_0x20f9('0x34')]);_0x5925cc[_0x20f9('0x37')]=_['intersection'](_0x5ad507[_0x20f9('0x33')],qs['fields'](_0x14a48c[_0x20f9('0x34')]['fields']));_0x5925cc[_0x20f9('0x37')]=_0x5925cc[_0x20f9('0x37')][_0x20f9('0x39')]?_0x5925cc[_0x20f9('0x37')]:_0x5ad507['model'];_0x5925cc['order']=qs[_0x20f9('0x3d')](_0x14a48c[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x5925cc[_0x20f9('0x3e')]=qs['filters'](_[_0x20f9('0x3f')](_0x14a48c[_0x20f9('0x34')],_0x5ad507[_0x20f9('0x35')]));if(_0x14a48c[_0x20f9('0x34')][_0x20f9('0x40')]){_0x5925cc[_0x20f9('0x3e')]=_[_0x20f9('0x43')](_0x5925cc[_0x20f9('0x3e')],{'$or':_[_0x20f9('0x41')](_0x5925cc['attributes'],function(_0x54d801){var _0x4483d9={};_0x4483d9[_0x54d801]={'$like':'%'+_0x14a48c[_0x20f9('0x34')][_0x20f9('0x40')]+'%'};return _0x4483d9;})});}_0x5925cc=_[_0x20f9('0x43')]({},_0x5925cc,_0x14a48c[_0x20f9('0x44')]);return _0x538be1['getLists'](_0x5925cc);}})[_0x20f9('0x29')](function(_0x1a1165){if(_0x1a1165){_0x7929f5=_0x1a1165[_0x20f9('0x39')];if(!_0x14a48c[_0x20f9('0x34')]['hasOwnProperty'](_0x20f9('0x3b'))){_0x5925cc['limit']=qs['limit'](_0x14a48c[_0x20f9('0x34')][_0x20f9('0x21')]);_0x5925cc[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x14a48c[_0x20f9('0x34')][_0x20f9('0x20')]);}return _0x538be1['getLists'](_0x5925cc);}})[_0x20f9('0x29')](function(_0x31d1e7){if(_0x31d1e7){return _0x31d1e7?{'count':_0x7929f5,'rows':_0x31d1e7}:null;}})['then'](respondWithResult(_0x30a713,null))[_0x20f9('0x49')](handleError(_0x30a713,null));};exports[_0x20f9('0x68')]=function(_0x5bd33b,_0x1a2f9d,_0x503cca){var _0x2dc66a,_0x488f2a;var _0x1bd3c8=[];var _0x1ce109=moment()[_0x20f9('0x69')]('YYYY-MM-DD\x20HH:mm:ss');return db['Campaign'][_0x20f9('0x57')]({'where':{'id':_0x5bd33b[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x1a2f9d,null))[_0x20f9('0x29')](function(_0xa1aa8e){if(_0xa1aa8e){_0x488f2a=_0xa1aa8e;return _0xa1aa8e[_0x20f9('0x68')](_0x5bd33b[_0x20f9('0x4e')]['ids'],_[_0x20f9('0x58')](_0x5bd33b['body'],[_0x20f9('0x6a'),'id'])||{});}return null;})[_0x20f9('0x6b')](function(_0x2fc634){var _0x3d0708;var _0x5cfb58;_0x2dc66a=_0x2fc634||[];var _0x59bf20=[];if(_0x2fc634){for(var _0x481371=0x0;_0x481371<_0x2fc634[_0x20f9('0x39')];_0x481371+=0x1){var _0x2e6dfd=_0x2fc634[_0x481371][_0x20f9('0x2a')]({'plain':!![]});_0x488f2a['dialCheckDuplicateType']=_0x5bd33b[_0x20f9('0x4e')]['dialCheckDuplicateType']?_0x5bd33b[_0x20f9('0x4e')]['dialCheckDuplicateType']:_0x488f2a[_0x20f9('0x6c')];switch(_0x488f2a[_0x20f9('0x6c')]){case _0x20f9('0x6d'):_0x3d0708=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')]('cm_hopper')[_0x20f9('0x70')](['phone',_0x20f9('0x71'),_0x20f9('0x72'),_0x20f9('0x73'),_0x20f9('0x61'),_0x20f9('0x59'),'updatedAt'],squel['select']()[_0x20f9('0x74')](_0x20f9('0x75'),_0x20f9('0x75'))['field'](_0x20f9('0x76'),_0x20f9('0x71'))['field']('id',_0x20f9('0x72'))[_0x20f9('0x74')](_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')](),_0x20f9('0x73'))['field'](_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')](),'CampaignId')[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27','createdAt')['field']('\x27'+_0x1ce109+'\x27','updatedAt')[_0x20f9('0x79')](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')]('ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')](_0x20f9('0x7c'))[_0x20f9('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x20f9('0x7d')]()['field'](_0x20f9('0x7e'))[_0x20f9('0x79')](_0x20f9('0x7f'))[_0x20f9('0x3e')](_0x20f9('0x80'),_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]()))[_0x20f9('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x20f9('0x74')](_0x20f9('0x81'))[_0x20f9('0x79')](_0x20f9('0x82'))[_0x20f9('0x3e')]('CampaignId\x20=\x20?',_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]())))[_0x20f9('0x78')]();break;case _0x20f9('0x83'):_0x3d0708=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')](_0x20f9('0x82'))[_0x20f9('0x70')]([_0x20f9('0x75'),_0x20f9('0x71'),'ContactId',_0x20f9('0x73'),'CampaignId','createdAt',_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()['field'](_0x20f9('0x75'),_0x20f9('0x75'))[_0x20f9('0x74')](_0x20f9('0x76'),_0x20f9('0x71'))[_0x20f9('0x74')]('id',_0x20f9('0x72'))[_0x20f9('0x74')](_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')](),'ListId')[_0x20f9('0x74')](_0x5bd33b[_0x20f9('0x5c')]['id']['toString'](),'CampaignId')[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x59'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x5a'))['from'](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')]('ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0x20f9('0x3e')](_0x20f9('0x84'),squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x81'))[_0x20f9('0x79')](_0x20f9('0x82'))[_0x20f9('0x3e')]('CampaignId\x20=\x20?',_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]())))['toString']();break;default:_0x3d0708=squel[_0x20f9('0x6e')]()['into']('cm_hopper')['fromQuery']([_0x20f9('0x75'),'scheduledAt',_0x20f9('0x72'),_0x20f9('0x73'),_0x20f9('0x61'),_0x20f9('0x59'),_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x75'),_0x20f9('0x75'))[_0x20f9('0x74')](_0x20f9('0x76'),'scheduledAt')[_0x20f9('0x74')]('id','ContactId')[_0x20f9('0x74')](_0x2e6dfd[_0x20f9('0x77')]['toString'](),_0x20f9('0x73'))[_0x20f9('0x74')](_0x5bd33b['params']['id'][_0x20f9('0x78')](),'CampaignId')[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x59'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27','updatedAt')[_0x20f9('0x79')](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')]('ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')]('phone\x20IS\x20NOT\x20NULL'))[_0x20f9('0x78')]();}_0x5cfb58=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')](_0x20f9('0x85'))[_0x20f9('0x70')](['cmHopperId',_0x20f9('0x71'),_0x20f9('0x75'),_0x20f9('0x86'),_0x20f9('0x59'),_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x87'),'id')[_0x20f9('0x74')]('NOW()',_0x20f9('0x71'))[_0x20f9('0x74')](_0x20f9('0x88'),_0x20f9('0x75'))[_0x20f9('0x74')]('ci.OrderBY',_0x20f9('0x86'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27',_0x20f9('0x59'))[_0x20f9('0x74')]('\x27'+_0x1ce109+'\x27','updatedAt')['from'](_0x20f9('0x89'),'ci')[_0x20f9('0x8a')]('cm_hopper','h',_0x20f9('0x8b'))['where']('h.ListId\x20=\x20?',_0x2e6dfd[_0x20f9('0x77')]['toString']())[_0x20f9('0x3e')](_0x20f9('0x8c'),_0x5bd33b[_0x20f9('0x5c')]['id'][_0x20f9('0x78')]())[_0x20f9('0x3e')](_0x20f9('0x8d'),_0x1ce109))['toString']();_0x59bf20[_0x20f9('0x8e')](db[_0x20f9('0x8f')]['query'](_0x3d0708));_0x1bd3c8['push'](db[_0x20f9('0x8f')][_0x20f9('0x34')](_0x5cfb58));}return BPromise['all'](_0x59bf20);}})[_0x20f9('0x29')](function(){return BPromise[_0x20f9('0x90')](_0x1bd3c8);})[_0x20f9('0x29')](function(){return _0x2dc66a;})[_0x20f9('0x29')](respondWithResult(_0x1a2f9d,null))[_0x20f9('0x49')](handleError(_0x1a2f9d,null));};exports[_0x20f9('0x91')]=function(_0x4deb28,_0xbdf2cf,_0x319926){return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x4deb28['params']['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0xbdf2cf,null))[_0x20f9('0x29')](function(_0x4353d2){if(_0x4353d2){return _0x4353d2[_0x20f9('0x91')](_0x4deb28['query']['ids']);}})[_0x20f9('0x29')](function(_0x4fc9c6){if(_0x4fc9c6){return db[_0x20f9('0x5f')][_0x20f9('0x28')]({'where':{'ListId':_0x4deb28[_0x20f9('0x34')][_0x20f9('0x6a')],'CampaignId':_0x4deb28['params']['id']}})[_0x20f9('0x29')](function(){return _0x4fc9c6;});}})[_0x20f9('0x29')](respondWithStatusCode(_0xbdf2cf,null))['catch'](handleError(_0xbdf2cf,null));};exports['getBlackLists']=function(_0x32ea1b,_0x77e4ab,_0x485b18){var _0x164918={};var _0x1726e3={};var _0x399d19;var _0x408a47;return db[_0x20f9('0x30')][_0x20f9('0x5e')]({'where':{'id':_0x32ea1b[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0x77e4ab,null))[_0x20f9('0x29')](function(_0x68f949){if(_0x68f949){_0x399d19=_0x68f949;_0x1726e3[_0x20f9('0x33')]=_['keys'](db['CmList'][_0x20f9('0x4b')]);_0x1726e3[_0x20f9('0x34')]=_[_0x20f9('0x4c')](_0x32ea1b[_0x20f9('0x34')]);_0x1726e3[_0x20f9('0x35')]=_[_0x20f9('0x36')](_0x1726e3[_0x20f9('0x33')],_0x1726e3[_0x20f9('0x34')]);_0x164918['attributes']=_[_0x20f9('0x36')](_0x1726e3[_0x20f9('0x33')],qs[_0x20f9('0x38')](_0x32ea1b[_0x20f9('0x34')][_0x20f9('0x38')]));_0x164918[_0x20f9('0x37')]=_0x164918[_0x20f9('0x37')][_0x20f9('0x39')]?_0x164918[_0x20f9('0x37')]:_0x1726e3[_0x20f9('0x33')];_0x164918[_0x20f9('0x3c')]=qs[_0x20f9('0x3d')](_0x32ea1b[_0x20f9('0x34')][_0x20f9('0x3d')]);_0x164918[_0x20f9('0x3e')]=qs['filters'](_[_0x20f9('0x3f')](_0x32ea1b[_0x20f9('0x34')],_0x1726e3[_0x20f9('0x35')]));if(_0x32ea1b['query'][_0x20f9('0x40')]){_0x164918[_0x20f9('0x3e')]=_['merge'](_0x164918['where'],{'$or':_['map'](_0x164918[_0x20f9('0x37')],function(_0x1260dd){var _0x834ae6={};_0x834ae6[_0x1260dd]={'$like':'%'+_0x32ea1b['query'][_0x20f9('0x40')]+'%'};return _0x834ae6;})});}_0x164918=_[_0x20f9('0x43')]({},_0x164918,_0x32ea1b[_0x20f9('0x44')]);return _0x399d19[_0x20f9('0x92')](_0x164918);}})[_0x20f9('0x29')](function(_0x7e6695){if(_0x7e6695){_0x408a47=_0x7e6695[_0x20f9('0x39')];if(!_0x32ea1b[_0x20f9('0x34')][_0x20f9('0x3a')](_0x20f9('0x3b'))){_0x164918[_0x20f9('0x21')]=qs['limit'](_0x32ea1b[_0x20f9('0x34')]['limit']);_0x164918[_0x20f9('0x20')]=qs[_0x20f9('0x20')](_0x32ea1b['query'][_0x20f9('0x20')]);}return _0x399d19[_0x20f9('0x92')](_0x164918);}})[_0x20f9('0x29')](function(_0x400c29){if(_0x400c29){return _0x400c29?{'count':_0x408a47,'rows':_0x400c29}:null;}})[_0x20f9('0x29')](respondWithResult(_0x77e4ab,null))['catch'](handleError(_0x77e4ab,null));};exports[_0x20f9('0x93')]=function(_0xaf1354,_0x759a7c,_0x3fa404){var _0x2af093,_0x56bc21;var _0x149a0f=[];var _0x3faad1=moment()['format'](_0x20f9('0x94'));return db['Campaign'][_0x20f9('0x57')]({'where':{'id':_0xaf1354[_0x20f9('0x5c')]['id']}})['then'](handleEntityNotFound(_0x759a7c,null))[_0x20f9('0x29')](function(_0x501fda){if(_0x501fda){_0x56bc21=_0x501fda;return _0x501fda[_0x20f9('0x93')](_0xaf1354['body'][_0x20f9('0x6a')],_[_0x20f9('0x58')](_0xaf1354[_0x20f9('0x4e')],['ids','id'])||{});}return null;})[_0x20f9('0x6b')](function(_0x14d06c){var _0x1be974;var _0x13bdf9;_0x2af093=_0x14d06c||[];var _0x1841f9=[];if(_0x14d06c){for(var _0xb71fb6=0x0;_0xb71fb6<_0x14d06c[_0x20f9('0x39')];_0xb71fb6+=0x1){var _0x460eb9=_0x14d06c[_0xb71fb6][_0x20f9('0x2a')]({'plain':!![]});_0x1be974=squel[_0x20f9('0x6e')]()[_0x20f9('0x6f')](_0x20f9('0x95'))['fromQuery']([_0x20f9('0x75'),_0x20f9('0x72'),'ListId','CampaignId',_0x20f9('0x59'),_0x20f9('0x5a')],squel[_0x20f9('0x7d')]()[_0x20f9('0x74')](_0x20f9('0x75'),'phone')[_0x20f9('0x74')]('id',_0x20f9('0x72'))['field'](_0x460eb9[_0x20f9('0x77')][_0x20f9('0x78')](),'ListId')[_0x20f9('0x74')](_0xaf1354[_0x20f9('0x5c')]['id'][_0x20f9('0x78')](),_0x20f9('0x61'))['field'](_0x20f9('0x76'),'createdAt')[_0x20f9('0x74')](_0x20f9('0x76'),_0x20f9('0x5a'))[_0x20f9('0x79')](_0x20f9('0x7a'))[_0x20f9('0x3e')](_0x20f9('0x7b'))[_0x20f9('0x3e')](_0x20f9('0x96'),_0x460eb9[_0x20f9('0x77')][_0x20f9('0x78')]())[_0x20f9('0x3e')](_0x20f9('0x7c')))['toString']();_0x1841f9['push'](db['sequelize']['query'](_0x1be974));}return BPromise[_0x20f9('0x90')](_0x1841f9);}})[_0x20f9('0x29')](function(){return _0x2af093;})[_0x20f9('0x29')](respondWithResult(_0x759a7c,null))[_0x20f9('0x49')](handleError(_0x759a7c,null));};exports[_0x20f9('0x97')]=function(_0x5c0dde,_0xde96d2,_0x327ad7){return db[_0x20f9('0x30')][_0x20f9('0x57')]({'where':{'id':_0x5c0dde[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](handleEntityNotFound(_0xde96d2,null))[_0x20f9('0x29')](function(_0x166c3f){if(_0x166c3f){return _0x166c3f[_0x20f9('0x97')](_0x5c0dde['query'][_0x20f9('0x6a')]);}})['then'](function(_0x4e64be){if(_0x4e64be){return db[_0x20f9('0x65')]['destroy']({'where':{'ListId':_0x5c0dde['query'][_0x20f9('0x6a')],'CampaignId':_0x5c0dde[_0x20f9('0x5c')]['id']}})[_0x20f9('0x29')](function(){return _0x4e64be;});}})[_0x20f9('0x29')](respondWithStatusCode(_0xde96d2,null))[_0x20f9('0x49')](handleError(_0xde96d2,null));}; \ No newline at end of file +var _0x9bb4=['clone','createdAt','omit','updatedAt','user','error','getHoppers','findOne','CmHopper','hasOwnProperty','order','pick','CampaignId','findAll','getHopperHistories','nolimit','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','ids','spread','dialCheckDuplicateType','always','insert','cm_hopper','fromQuery','phone','scheduledAt','ListId','select','field','NOW()','ContactId','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','into','cmHopperId','h.id','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','IvrCampaigns','UserProfileResource','destroy','stack','name','index','Campaign','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','sort','where','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x157f75,_0x28cb0e){var _0x25a52d=function(_0x5b5856){while(--_0x5b5856){_0x157f75['push'](_0x157f75['shift']());}};_0x25a52d(++_0x28cb0e);}(_0x9bb4,0xd5));var _0x49bb=function(_0x41eab3,_0x2949fa){_0x41eab3=_0x41eab3-0x0;var _0x1318a3=_0x9bb4[_0x41eab3];return _0x1318a3;};'use strict';var emlformat=require(_0x49bb('0x0'));var rimraf=require(_0x49bb('0x1'));var zipdir=require(_0x49bb('0x2'));var jsonpatch=require(_0x49bb('0x3'));var rp=require(_0x49bb('0x4'));var moment=require(_0x49bb('0x5'));var BPromise=require(_0x49bb('0x6'));var Mustache=require(_0x49bb('0x7'));var util=require(_0x49bb('0x8'));var path=require('path');var sox=require(_0x49bb('0x9'));var csv=require(_0x49bb('0xa'));var ejs=require(_0x49bb('0xb'));var fs=require('fs');var fs_extra=require(_0x49bb('0xc'));var _=require('lodash');var squel=require(_0x49bb('0xd'));var crypto=require(_0x49bb('0xe'));var jsforce=require(_0x49bb('0xf'));var deskjs=require(_0x49bb('0x10'));var toCsv=require(_0x49bb('0xa'));var querystring=require('querystring');var Papa=require(_0x49bb('0x11'));var Redis=require('ioredis');var authService=require(_0x49bb('0x12'));var qs=require(_0x49bb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x49bb('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0x49bb('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x49bb('0x16'));var db=require(_0x49bb('0x17'))['db'];function respondWithStatusCode(_0xfab080,_0x3b85fc){_0x3b85fc=_0x3b85fc||0xcc;return function(_0x1ff6d1){if(_0x1ff6d1){return _0xfab080[_0x49bb('0x18')](_0x3b85fc);}return _0xfab080[_0x49bb('0x19')](_0x3b85fc)[_0x49bb('0x1a')]();};}function respondWithResult(_0x3beb36,_0x59472f){_0x59472f=_0x59472f||0xc8;return function(_0x13c850){if(_0x13c850){return _0x3beb36['status'](_0x59472f)[_0x49bb('0x1b')](_0x13c850);}};}function respondWithFilteredResult(_0x1f7573,_0x1f0210){return function(_0x230f20){if(_0x230f20){var _0x145d52=typeof _0x1f0210[_0x49bb('0x1c')]===_0x49bb('0x1d')&&typeof _0x1f0210[_0x49bb('0x1e')]==='undefined';var _0x2d76be=_0x230f20[_0x49bb('0x1f')];var _0x5b45c0=_0x145d52?0x0:_0x1f0210[_0x49bb('0x1c')];var _0x3d41f2=_0x145d52?_0x230f20['count']:_0x1f0210[_0x49bb('0x1c')]+_0x1f0210[_0x49bb('0x1e')];var _0x4af5e0;if(_0x3d41f2>=_0x2d76be){_0x3d41f2=_0x2d76be;_0x4af5e0=0xc8;}else{_0x4af5e0=0xce;}_0x1f7573[_0x49bb('0x19')](_0x4af5e0);return _0x1f7573[_0x49bb('0x20')]('Content-Range',_0x5b45c0+'-'+_0x3d41f2+'/'+_0x2d76be)[_0x49bb('0x1b')](_0x230f20);}return null;};}function patchUpdates(_0x5387ed){return function(_0x1728e9){try{jsonpatch['apply'](_0x1728e9,_0x5387ed,!![]);}catch(_0x47918a){return BPromise[_0x49bb('0x21')](_0x47918a);}return _0x1728e9['save']();};}function saveUpdates(_0x5b18f0,_0x16b8fa){return function(_0x1ade8b){if(_0x1ade8b){return _0x1ade8b[_0x49bb('0x22')](_0x5b18f0)[_0x49bb('0x23')](function(_0x4f2764){return _0x4f2764;});}return null;};}function removeEntity(_0x490c3e,_0x5cacdb){return function(_0x4eae24){if(_0x4eae24){return _0x4eae24['destroy']()[_0x49bb('0x23')](function(){var _0x570847=_0x4eae24['get']({'plain':!![]});var _0x6dac61=_0x49bb('0x24');return db[_0x49bb('0x25')][_0x49bb('0x26')]({'where':{'type':_0x6dac61,'resourceId':_0x570847['id']}})[_0x49bb('0x23')](function(){return _0x4eae24;});})['then'](function(){_0x490c3e[_0x49bb('0x19')](0xcc)[_0x49bb('0x1a')]();});}};}function handleEntityNotFound(_0x1a6afb,_0x712959){return function(_0x5370d7){if(!_0x5370d7){_0x1a6afb[_0x49bb('0x18')](0x194);}return _0x5370d7;};}function handleError(_0x3d025d,_0x3985a6){_0x3985a6=_0x3985a6||0x1f4;return function(_0x47540c){logger['error'](_0x47540c[_0x49bb('0x27')]);if(_0x47540c[_0x49bb('0x28')]){delete _0x47540c[_0x49bb('0x28')];}_0x3d025d[_0x49bb('0x19')](_0x3985a6)['send'](_0x47540c);};}exports[_0x49bb('0x29')]=function(_0x1537ef,_0x5cd7c2){var _0x38108d={},_0x56b65b={},_0x2fbea2={'count':0x0,'rows':[]};var _0x242371=_['map'](db[_0x49bb('0x2a')][_0x49bb('0x2b')],function(_0x521e09){return{'name':_0x521e09[_0x49bb('0x2c')],'type':_0x521e09[_0x49bb('0x2d')][_0x49bb('0x2e')]};});_0x56b65b[_0x49bb('0x2f')]=_[_0x49bb('0x30')](_0x242371,_0x49bb('0x28'));_0x56b65b[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x1537ef['query']);_0x56b65b[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x56b65b[_0x49bb('0x2f')],_0x56b65b[_0x49bb('0x31')]);_0x38108d['attributes']=_[_0x49bb('0x34')](_0x56b65b['model'],qs[_0x49bb('0x35')](_0x1537ef['query'][_0x49bb('0x35')]));_0x38108d['attributes']=_0x38108d[_0x49bb('0x36')][_0x49bb('0x37')]?_0x38108d['attributes']:_0x56b65b['model'];if(!_0x1537ef['query']['hasOwnProperty']('nolimit')){_0x38108d[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x1537ef[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x38108d[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x1537ef[_0x49bb('0x31')]['offset']);}_0x38108d['order']=qs[_0x49bb('0x38')](_0x1537ef[_0x49bb('0x31')]['sort']);_0x38108d[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_['pick'](_0x1537ef['query'],_0x56b65b[_0x49bb('0x33')]),_0x242371);if(_0x1537ef['query'][_0x49bb('0x3a')]){_0x38108d[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x38108d[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x242371,function(_0x72d90e){if(_0x72d90e[_0x49bb('0x2d')]!==_0x49bb('0x3c')){var _0x783852={};_0x783852[_0x72d90e[_0x49bb('0x28')]]={'$like':'%'+_0x1537ef[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x783852;}})});}_0x38108d=_[_0x49bb('0x3b')]({},_0x38108d,_0x1537ef[_0x49bb('0x3d')]);var _0x25c70e={'where':_0x38108d[_0x49bb('0x39')]};return db[_0x49bb('0x2a')][_0x49bb('0x1f')](_0x25c70e)[_0x49bb('0x23')](function(_0x41b969){_0x2fbea2[_0x49bb('0x1f')]=_0x41b969;if(_0x1537ef[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x38108d['include']=[{'all':!![]}];}return db[_0x49bb('0x2a')]['findAll'](_0x38108d);})[_0x49bb('0x23')](function(_0x1eac94){_0x2fbea2[_0x49bb('0x3f')]=_0x1eac94;return _0x2fbea2;})[_0x49bb('0x23')](respondWithFilteredResult(_0x5cd7c2,_0x38108d))[_0x49bb('0x40')](handleError(_0x5cd7c2,null));};exports['show']=function(_0x445e15,_0x31aaee){var _0x138f2b={'raw':![],'where':{'id':_0x445e15[_0x49bb('0x41')]['id']}},_0x46912f={};_0x46912f['model']=_[_0x49bb('0x32')](db[_0x49bb('0x2a')][_0x49bb('0x2b')]);_0x46912f[_0x49bb('0x31')]=_['keys'](_0x445e15['query']);_0x46912f[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x46912f[_0x49bb('0x2f')],_0x46912f[_0x49bb('0x31')]);_0x138f2b[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x46912f['model'],qs[_0x49bb('0x35')](_0x445e15['query'][_0x49bb('0x35')]));_0x138f2b[_0x49bb('0x36')]=_0x138f2b['attributes']['length']?_0x138f2b['attributes']:_0x46912f['model'];if(_0x445e15[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x138f2b[_0x49bb('0x42')]=[{'all':!![]}];}_0x138f2b=_[_0x49bb('0x3b')]({},_0x138f2b,_0x445e15['options']);return db['Campaign'][_0x49bb('0x43')](_0x138f2b)[_0x49bb('0x23')](handleEntityNotFound(_0x31aaee,null))[_0x49bb('0x23')](respondWithResult(_0x31aaee,null))[_0x49bb('0x40')](handleError(_0x31aaee,null));};exports['create']=function(_0x3b0f01,_0x382bc4){return db['Campaign'][_0x49bb('0x44')](_0x3b0f01[_0x49bb('0x45')],{})[_0x49bb('0x23')](function(_0x46bb56){var _0xbad45a=_0x3b0f01['user'][_0x49bb('0x46')]({'plain':!![]});if(!_0xbad45a)throw new Error(_0x49bb('0x47'));if(_0xbad45a[_0x49bb('0x48')]==='user'){var _0x266abf=_0x46bb56[_0x49bb('0x46')]({'plain':!![]});var _0x144a77=_0x49bb('0x24');return db[_0x49bb('0x49')]['find']({'where':{'name':_0x144a77,'userProfileId':_0xbad45a[_0x49bb('0x4a')]},'raw':!![]})[_0x49bb('0x23')](function(_0xfae9ab){if(_0xfae9ab&&_0xfae9ab[_0x49bb('0x4b')]===0x0){return db[_0x49bb('0x25')][_0x49bb('0x44')]({'name':_0x266abf[_0x49bb('0x28')],'resourceId':_0x266abf['id'],'type':_0xfae9ab[_0x49bb('0x28')],'sectionId':_0xfae9ab['id']},{})[_0x49bb('0x23')](function(){return _0x46bb56;});}else{return _0x46bb56;}})[_0x49bb('0x40')](function(_0x2ead0f){logger['error'](_0x49bb('0x4c'),_0x2ead0f);throw _0x2ead0f;});}return _0x46bb56;})[_0x49bb('0x23')](respondWithResult(_0x382bc4,0xc9))[_0x49bb('0x40')](handleError(_0x382bc4,null));};exports[_0x49bb('0x4d')]=function(_0x10327c,_0x3fc2f1){var _0x4151c5={'where':{'id':_0x10327c[_0x49bb('0x41')]['id']}},_0x23e8bc={};_0x23e8bc[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db[_0x49bb('0x2a')][_0x49bb('0x2b')]);_0x4151c5[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x23e8bc[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0x10327c[_0x49bb('0x31')][_0x49bb('0x35')]));_0x4151c5[_0x49bb('0x36')]=_0x4151c5[_0x49bb('0x36')][_0x49bb('0x37')]?_0x4151c5[_0x49bb('0x36')]:_0x23e8bc['model'];if(_0x10327c[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x4151c5[_0x49bb('0x42')]=[{'all':!![]}];}_0x4151c5=_[_0x49bb('0x3b')]({},_0x4151c5,_0x10327c[_0x49bb('0x3d')]);return db[_0x49bb('0x2a')][_0x49bb('0x43')](_0x4151c5)[_0x49bb('0x23')](handleEntityNotFound(_0x3fc2f1,null))[_0x49bb('0x23')](function(_0x348da4){if(_0x348da4){var _0x48a8d6=_0x348da4['get']({'plain':!![]});_0x48a8d6=qs['omit'](_0x48a8d6,['id',_0x49bb('0x4e'),'updatedAt']);_0x10327c[_0x49bb('0x45')]=_[_0x49bb('0x4f')](_0x10327c[_0x49bb('0x45')],['id',_0x49bb('0x4e'),_0x49bb('0x50')]);return db[_0x49bb('0x2a')][_0x49bb('0x44')](_[_0x49bb('0x3b')](_0x48a8d6,_0x10327c['body']),{'include':_0x10327c[_0x49bb('0x31')][_0x49bb('0x3e')]?[{'all':!![]}]:undefined})[_0x49bb('0x23')](function(_0x435761){var _0x225341=_0x10327c[_0x49bb('0x51')][_0x49bb('0x46')]({'plain':!![]});if(!_0x225341)throw new Error(_0x49bb('0x47'));if(_0x225341['role']===_0x49bb('0x51')){var _0x35bb5b=_0x435761[_0x49bb('0x46')]({'plain':!![]});var _0xb2d741='IvrCampaigns';return db[_0x49bb('0x49')][_0x49bb('0x43')]({'where':{'name':_0xb2d741,'userProfileId':_0x225341['userProfileId']},'raw':!![]})[_0x49bb('0x23')](function(_0x36ff04){if(_0x36ff04&&_0x36ff04[_0x49bb('0x4b')]===0x0){return db[_0x49bb('0x25')][_0x49bb('0x44')]({'name':_0x35bb5b['name'],'resourceId':_0x35bb5b['id'],'type':_0x36ff04[_0x49bb('0x28')],'sectionId':_0x36ff04['id']},{})[_0x49bb('0x23')](function(){return _0x435761;});}else{return _0x435761;}})[_0x49bb('0x40')](function(_0x1f273a){logger[_0x49bb('0x52')](_0x49bb('0x4c'),_0x1f273a);throw _0x1f273a;});}return _0x435761;});}})['then'](respondWithResult(_0x3fc2f1,0xc9))[_0x49bb('0x40')](handleError(_0x3fc2f1,null));};exports[_0x49bb('0x22')]=function(_0x56b2e7,_0x4b13e5){if(_0x56b2e7[_0x49bb('0x45')]['id']){delete _0x56b2e7[_0x49bb('0x45')]['id'];}return db['Campaign'][_0x49bb('0x43')]({'where':{'id':_0x56b2e7[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x4b13e5,null))[_0x49bb('0x23')](saveUpdates(_0x56b2e7[_0x49bb('0x45')],null))[_0x49bb('0x23')](respondWithResult(_0x4b13e5,null))['catch'](handleError(_0x4b13e5,null));};exports[_0x49bb('0x26')]=function(_0x4a3906,_0x4478f4){return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x4a3906[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x4478f4,null))[_0x49bb('0x23')](removeEntity(_0x4478f4,null))[_0x49bb('0x40')](handleError(_0x4478f4,null));};exports[_0x49bb('0x53')]=function(_0xcc062f,_0x52ac3b,_0x29a1b7){var _0x28da4a={'raw':!![],'where':{}};var _0x277e04={};var _0x193259={'count':0x0,'rows':[]};return db['Campaign'][_0x49bb('0x54')]({'where':{'id':_0xcc062f[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x52ac3b,null))[_0x49bb('0x23')](function(_0x437d3b){if(_0x437d3b){_0x277e04['model']=_[_0x49bb('0x32')](db[_0x49bb('0x55')][_0x49bb('0x2b')]);_0x277e04[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0xcc062f[_0x49bb('0x31')]);_0x277e04[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x277e04['model'],_0x277e04[_0x49bb('0x31')]);_0x28da4a[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x277e04[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0xcc062f[_0x49bb('0x31')][_0x49bb('0x35')]));_0x28da4a['attributes']=_0x28da4a[_0x49bb('0x36')][_0x49bb('0x37')]?_0x28da4a[_0x49bb('0x36')]:_0x277e04[_0x49bb('0x2f')];if(!_0xcc062f['query'][_0x49bb('0x56')]('nolimit')){_0x28da4a[_0x49bb('0x1e')]=qs['limit'](_0xcc062f['query']['limit']);_0x28da4a[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0xcc062f['query']['offset']);}_0x28da4a[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0xcc062f[_0x49bb('0x31')][_0x49bb('0x38')]);_0x28da4a[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0xcc062f[_0x49bb('0x31')],_0x277e04[_0x49bb('0x33')]));_0x28da4a[_0x49bb('0x39')][_0x49bb('0x59')]=_0x437d3b['id'];if(_0xcc062f['query'][_0x49bb('0x3a')]){_0x28da4a[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x28da4a[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x28da4a[_0x49bb('0x36')],function(_0x3454be){var _0x500af1={};_0x500af1[_0x3454be]={'$like':'%'+_0xcc062f[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x500af1;})});}_0x28da4a=_['merge']({},_0x28da4a,_0xcc062f[_0x49bb('0x3d')]);return db[_0x49bb('0x55')]['count']({'where':_0x28da4a[_0x49bb('0x39')]})[_0x49bb('0x23')](function(_0x37f97b){_0x193259[_0x49bb('0x1f')]=_0x37f97b;if(_0xcc062f[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x28da4a['include']=[{'all':!![]}];}return db['CmHopper'][_0x49bb('0x5a')](_0x28da4a);})[_0x49bb('0x23')](function(_0x1499b6){_0x193259[_0x49bb('0x3f')]=_0x1499b6;return _0x193259;});}})[_0x49bb('0x23')](respondWithFilteredResult(_0x52ac3b,_0x28da4a))[_0x49bb('0x40')](handleError(_0x52ac3b,null));};exports[_0x49bb('0x5b')]=function(_0xc7016a,_0x136726,_0x36db19){var _0x3459de={'raw':!![],'where':{}};var _0x426505={};var _0x81e179={'count':0x0,'rows':[]};return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0xc7016a['params']['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x136726,null))['then'](function(_0x7897dd){if(_0x7897dd){_0x426505[_0x49bb('0x2f')]=_['keys'](db['CmHopperHistory'][_0x49bb('0x2b')]);_0x426505[_0x49bb('0x31')]=_['keys'](_0xc7016a[_0x49bb('0x31')]);_0x426505[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x426505[_0x49bb('0x2f')],_0x426505[_0x49bb('0x31')]);_0x3459de[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x426505[_0x49bb('0x2f')],qs['fields'](_0xc7016a[_0x49bb('0x31')]['fields']));_0x3459de[_0x49bb('0x36')]=_0x3459de[_0x49bb('0x36')][_0x49bb('0x37')]?_0x3459de['attributes']:_0x426505[_0x49bb('0x2f')];if(!_0xc7016a[_0x49bb('0x31')][_0x49bb('0x56')](_0x49bb('0x5c'))){_0x3459de[_0x49bb('0x1e')]=qs['limit'](_0xc7016a[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x3459de[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0xc7016a[_0x49bb('0x31')][_0x49bb('0x1c')]);}_0x3459de[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0xc7016a[_0x49bb('0x31')][_0x49bb('0x38')]);_0x3459de[_0x49bb('0x39')]=qs['filters'](_[_0x49bb('0x58')](_0xc7016a[_0x49bb('0x31')],_0x426505[_0x49bb('0x33')]));_0x3459de[_0x49bb('0x39')]['CampaignId']=_0x7897dd['id'];if(_0xc7016a[_0x49bb('0x31')]['filter']){_0x3459de[_0x49bb('0x39')]=_['merge'](_0x3459de[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x3459de[_0x49bb('0x36')],function(_0x2b953a){var _0x5d4c93={};_0x5d4c93[_0x2b953a]={'$like':'%'+_0xc7016a[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x5d4c93;})});}_0x3459de=_[_0x49bb('0x3b')]({},_0x3459de,_0xc7016a[_0x49bb('0x3d')]);return db[_0x49bb('0x5d')]['count']({'where':_0x3459de[_0x49bb('0x39')]})[_0x49bb('0x23')](function(_0x46fcc5){_0x81e179['count']=_0x46fcc5;if(_0xc7016a[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x3459de['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x49bb('0x5a')](_0x3459de);})[_0x49bb('0x23')](function(_0x2a40aa){_0x81e179[_0x49bb('0x3f')]=_0x2a40aa;return _0x81e179;});}})['then'](respondWithFilteredResult(_0x136726,_0x3459de))[_0x49bb('0x40')](handleError(_0x136726,null));};exports[_0x49bb('0x5e')]=function(_0x535bed,_0x137965,_0x208e1b){var _0x1c9cfb={'raw':!![],'where':{}};var _0x4157ae={};var _0x1b0529={'count':0x0,'rows':[]};return db['Campaign'][_0x49bb('0x54')]({'where':{'id':_0x535bed['params']['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x137965,null))['then'](function(_0x36bf90){if(_0x36bf90){_0x4157ae[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db[_0x49bb('0x5f')][_0x49bb('0x2b')]);_0x4157ae[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x535bed['query']);_0x4157ae[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x4157ae['model'],_0x4157ae[_0x49bb('0x31')]);_0x1c9cfb[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x4157ae[_0x49bb('0x2f')],qs['fields'](_0x535bed['query'][_0x49bb('0x35')]));_0x1c9cfb['attributes']=_0x1c9cfb[_0x49bb('0x36')]['length']?_0x1c9cfb[_0x49bb('0x36')]:_0x4157ae[_0x49bb('0x2f')];if(!_0x535bed[_0x49bb('0x31')][_0x49bb('0x56')]('nolimit')){_0x1c9cfb[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x535bed['query']['limit']);_0x1c9cfb[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x535bed['query'][_0x49bb('0x1c')]);}_0x1c9cfb[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0x535bed['query'][_0x49bb('0x38')]);_0x1c9cfb[_0x49bb('0x39')]=qs['filters'](_['pick'](_0x535bed['query'],_0x4157ae[_0x49bb('0x33')]));_0x1c9cfb[_0x49bb('0x39')][_0x49bb('0x59')]=_0x36bf90['id'];if(_0x535bed[_0x49bb('0x31')][_0x49bb('0x3a')]){_0x1c9cfb['where']=_['merge'](_0x1c9cfb[_0x49bb('0x39')],{'$or':_[_0x49bb('0x30')](_0x1c9cfb['attributes'],function(_0x5b1f07){var _0x378128={};_0x378128[_0x5b1f07]={'$like':'%'+_0x535bed[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x378128;})});}_0x1c9cfb=_['merge']({},_0x1c9cfb,_0x535bed[_0x49bb('0x3d')]);return db[_0x49bb('0x5f')]['count']({'where':_0x1c9cfb[_0x49bb('0x39')]})[_0x49bb('0x23')](function(_0x3b7d47){_0x1b0529[_0x49bb('0x1f')]=_0x3b7d47;if(_0x535bed['query'][_0x49bb('0x3e')]){_0x1c9cfb[_0x49bb('0x42')]=[{'all':!![]}];}return db[_0x49bb('0x5f')][_0x49bb('0x5a')](_0x1c9cfb);})['then'](function(_0x2ccf78){_0x1b0529[_0x49bb('0x3f')]=_0x2ccf78;return _0x1b0529;});}})[_0x49bb('0x23')](respondWithFilteredResult(_0x137965,_0x1c9cfb))[_0x49bb('0x40')](handleError(_0x137965,null));};exports[_0x49bb('0x60')]=function(_0x4e6e43,_0x5a4f59,_0x251fc8){var _0x382bf9={'raw':!![],'where':{}};var _0x5bdf3d={};var _0x1dcaac={'count':0x0,'rows':[]};return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0x4e6e43[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a4f59,null))['then'](function(_0xe5a2){if(_0xe5a2){_0x5bdf3d[_0x49bb('0x2f')]=_['keys'](db['CmHopperBlack'][_0x49bb('0x2b')]);_0x5bdf3d[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x4e6e43['query']);_0x5bdf3d[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x5bdf3d[_0x49bb('0x2f')],_0x5bdf3d[_0x49bb('0x31')]);_0x382bf9[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x5bdf3d[_0x49bb('0x2f')],qs['fields'](_0x4e6e43[_0x49bb('0x31')]['fields']));_0x382bf9[_0x49bb('0x36')]=_0x382bf9[_0x49bb('0x36')][_0x49bb('0x37')]?_0x382bf9['attributes']:_0x5bdf3d[_0x49bb('0x2f')];if(!_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x56')]('nolimit')){_0x382bf9[_0x49bb('0x1e')]=qs['limit'](_0x4e6e43['query'][_0x49bb('0x1e')]);_0x382bf9['offset']=qs[_0x49bb('0x1c')](_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x1c')]);}_0x382bf9[_0x49bb('0x57')]=qs['sort'](_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x38')]);_0x382bf9[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0x4e6e43[_0x49bb('0x31')],_0x5bdf3d[_0x49bb('0x33')]));_0x382bf9[_0x49bb('0x39')][_0x49bb('0x59')]=_0xe5a2['id'];if(_0x4e6e43[_0x49bb('0x31')]['filter']){_0x382bf9[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x382bf9['where'],{'$or':_[_0x49bb('0x30')](_0x382bf9[_0x49bb('0x36')],function(_0x12b674){var _0x2822f7={};_0x2822f7[_0x12b674]={'$like':'%'+_0x4e6e43['query']['filter']+'%'};return _0x2822f7;})});}_0x382bf9=_[_0x49bb('0x3b')]({},_0x382bf9,_0x4e6e43[_0x49bb('0x3d')]);return db[_0x49bb('0x61')]['count']({'where':_0x382bf9['where']})[_0x49bb('0x23')](function(_0xf5c477){_0x1dcaac['count']=_0xf5c477;if(_0x4e6e43[_0x49bb('0x31')][_0x49bb('0x3e')]){_0x382bf9[_0x49bb('0x42')]=[{'all':!![]}];}return db[_0x49bb('0x61')]['findAll'](_0x382bf9);})['then'](function(_0x1770bc){_0x1dcaac[_0x49bb('0x3f')]=_0x1770bc;return _0x1dcaac;});}})[_0x49bb('0x23')](respondWithFilteredResult(_0x5a4f59,_0x382bf9))['catch'](handleError(_0x5a4f59,null));};exports[_0x49bb('0x62')]=function(_0x9f2ff7,_0x3f93bd,_0x504b4f){var _0x582b42={};var _0x2948a0={};var _0x5a861f;var _0xaf6237;return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0x9f2ff7[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x3f93bd,null))[_0x49bb('0x23')](function(_0x59e5c1){if(_0x59e5c1){_0x5a861f=_0x59e5c1;_0x2948a0[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db[_0x49bb('0x63')][_0x49bb('0x2b')]);_0x2948a0[_0x49bb('0x31')]=_[_0x49bb('0x32')](_0x9f2ff7[_0x49bb('0x31')]);_0x2948a0[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x2948a0[_0x49bb('0x2f')],_0x2948a0['query']);_0x582b42[_0x49bb('0x36')]=_[_0x49bb('0x34')](_0x2948a0[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0x9f2ff7[_0x49bb('0x31')]['fields']));_0x582b42[_0x49bb('0x36')]=_0x582b42[_0x49bb('0x36')][_0x49bb('0x37')]?_0x582b42[_0x49bb('0x36')]:_0x2948a0[_0x49bb('0x2f')];_0x582b42[_0x49bb('0x57')]=qs['sort'](_0x9f2ff7['query']['sort']);_0x582b42[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0x9f2ff7[_0x49bb('0x31')],_0x2948a0[_0x49bb('0x33')]));if(_0x9f2ff7[_0x49bb('0x31')][_0x49bb('0x3a')]){_0x582b42[_0x49bb('0x39')]=_[_0x49bb('0x3b')](_0x582b42['where'],{'$or':_[_0x49bb('0x30')](_0x582b42[_0x49bb('0x36')],function(_0x42b52f){var _0x22a2e3={};_0x22a2e3[_0x42b52f]={'$like':'%'+_0x9f2ff7[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x22a2e3;})});}_0x582b42=_[_0x49bb('0x3b')]({},_0x582b42,_0x9f2ff7['options']);return _0x5a861f['getLists'](_0x582b42);}})['then'](function(_0x521567){if(_0x521567){_0xaf6237=_0x521567[_0x49bb('0x37')];if(!_0x9f2ff7['query'][_0x49bb('0x56')](_0x49bb('0x5c'))){_0x582b42[_0x49bb('0x1e')]=qs['limit'](_0x9f2ff7['query']['limit']);_0x582b42[_0x49bb('0x1c')]=qs['offset'](_0x9f2ff7['query']['offset']);}return _0x5a861f[_0x49bb('0x62')](_0x582b42);}})[_0x49bb('0x23')](function(_0x5eec09){if(_0x5eec09){return _0x5eec09?{'count':_0xaf6237,'rows':_0x5eec09}:null;}})['then'](respondWithResult(_0x3f93bd,null))['catch'](handleError(_0x3f93bd,null));};exports['addLists']=function(_0x333a64,_0x4742be,_0x3ef899){var _0x29e5f9,_0x38a3d5;var _0xd2cd1a=[];var _0x3d761d=moment()[_0x49bb('0x64')](_0x49bb('0x65'));return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x333a64[_0x49bb('0x41')]['id']}})['then'](handleEntityNotFound(_0x4742be,null))[_0x49bb('0x23')](function(_0x4092df){if(_0x4092df){_0x38a3d5=_0x4092df;return _0x4092df[_0x49bb('0x66')](_0x333a64[_0x49bb('0x45')][_0x49bb('0x67')],_[_0x49bb('0x4f')](_0x333a64[_0x49bb('0x45')],[_0x49bb('0x67'),'id'])||{});}return null;})[_0x49bb('0x68')](function(_0x534677){var _0x5b27b1;var _0x3d1da9;_0x29e5f9=_0x534677||[];var _0x20a650=[];if(_0x534677){for(var _0x33c254=0x0;_0x33c254<_0x534677[_0x49bb('0x37')];_0x33c254+=0x1){var _0x403726=_0x534677[_0x33c254]['get']({'plain':!![]});_0x38a3d5[_0x49bb('0x69')]=_0x333a64[_0x49bb('0x45')][_0x49bb('0x69')]?_0x333a64[_0x49bb('0x45')][_0x49bb('0x69')]:_0x38a3d5['dialCheckDuplicateType'];switch(_0x38a3d5[_0x49bb('0x69')]){case _0x49bb('0x6a'):_0x5b27b1=squel[_0x49bb('0x6b')]()['into'](_0x49bb('0x6c'))[_0x49bb('0x6d')]([_0x49bb('0x6e'),_0x49bb('0x6f'),'ContactId',_0x49bb('0x70'),_0x49bb('0x59'),_0x49bb('0x4e'),'updatedAt'],squel[_0x49bb('0x71')]()[_0x49bb('0x72')]('phone','phone')[_0x49bb('0x72')](_0x49bb('0x73'),_0x49bb('0x6f'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x403726[_0x49bb('0x75')][_0x49bb('0x76')](),_0x49bb('0x70'))[_0x49bb('0x72')](_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),_0x49bb('0x59'))['field']('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))['from'](_0x49bb('0x77'))['where'](_0x49bb('0x78'))[_0x49bb('0x39')](_0x49bb('0x79'),_0x403726['CmListId'][_0x49bb('0x76')]())[_0x49bb('0x39')](_0x49bb('0x7a'))[_0x49bb('0x39')](_0x49bb('0x7b'),squel[_0x49bb('0x71')]()['field'](_0x49bb('0x7c'))[_0x49bb('0x7d')](_0x49bb('0x7e'))[_0x49bb('0x39')](_0x49bb('0x7f'),_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')]()))[_0x49bb('0x39')](_0x49bb('0x7b'),squel[_0x49bb('0x71')]()[_0x49bb('0x72')]('COALESCE(phone,\x27\x27)')[_0x49bb('0x7d')](_0x49bb('0x6c'))['where'](_0x49bb('0x7f'),_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')]())))[_0x49bb('0x76')]();break;case _0x49bb('0x80'):_0x5b27b1=squel[_0x49bb('0x6b')]()[_0x49bb('0x81')](_0x49bb('0x6c'))[_0x49bb('0x6d')](['phone',_0x49bb('0x6f'),_0x49bb('0x74'),_0x49bb('0x70'),'CampaignId','createdAt','updatedAt'],squel['select']()[_0x49bb('0x72')](_0x49bb('0x6e'),_0x49bb('0x6e'))['field']('NOW()',_0x49bb('0x6f'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x403726[_0x49bb('0x75')][_0x49bb('0x76')](),_0x49bb('0x70'))[_0x49bb('0x72')](_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),_0x49bb('0x59'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))[_0x49bb('0x7d')](_0x49bb('0x77'))[_0x49bb('0x39')](_0x49bb('0x78'))['where'](_0x49bb('0x79'),_0x403726[_0x49bb('0x75')]['toString']())[_0x49bb('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x49bb('0x39')](_0x49bb('0x7b'),squel[_0x49bb('0x71')]()[_0x49bb('0x72')]('COALESCE(phone,\x27\x27)')['from'](_0x49bb('0x6c'))[_0x49bb('0x39')](_0x49bb('0x7f'),_0x333a64['params']['id'][_0x49bb('0x76')]())))['toString']();break;default:_0x5b27b1=squel[_0x49bb('0x6b')]()[_0x49bb('0x81')]('cm_hopper')['fromQuery']([_0x49bb('0x6e'),_0x49bb('0x6f'),_0x49bb('0x74'),_0x49bb('0x70'),_0x49bb('0x59'),_0x49bb('0x4e'),_0x49bb('0x50')],squel[_0x49bb('0x71')]()[_0x49bb('0x72')](_0x49bb('0x6e'),'phone')[_0x49bb('0x72')]('NOW()',_0x49bb('0x6f'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x403726[_0x49bb('0x75')]['toString'](),_0x49bb('0x70'))['field'](_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),'CampaignId')[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))[_0x49bb('0x7d')]('cm_contacts')[_0x49bb('0x39')](_0x49bb('0x78'))[_0x49bb('0x39')]('ListId\x20=\x20?',_0x403726['CmListId'][_0x49bb('0x76')]())[_0x49bb('0x39')](_0x49bb('0x7a')))[_0x49bb('0x76')]();}_0x3d1da9=squel[_0x49bb('0x6b')]()[_0x49bb('0x81')]('cm_hopper_additional_phones')[_0x49bb('0x6d')]([_0x49bb('0x82'),_0x49bb('0x6f'),_0x49bb('0x6e'),'OrderBy',_0x49bb('0x4e'),_0x49bb('0x50')],squel[_0x49bb('0x71')]()[_0x49bb('0x72')](_0x49bb('0x83'),'id')['field'](_0x49bb('0x73'),_0x49bb('0x6f'))['field']('ci.item',_0x49bb('0x6e'))[_0x49bb('0x72')]('ci.OrderBY','OrderBy')[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x4e'))[_0x49bb('0x72')]('\x27'+_0x3d761d+'\x27',_0x49bb('0x50'))[_0x49bb('0x7d')]('cm_contact_has_items','ci')[_0x49bb('0x84')](_0x49bb('0x6c'),'h',_0x49bb('0x85'))[_0x49bb('0x39')](_0x49bb('0x86'),_0x403726[_0x49bb('0x75')][_0x49bb('0x76')]())['where'](_0x49bb('0x87'),_0x333a64[_0x49bb('0x41')]['id'][_0x49bb('0x76')]())[_0x49bb('0x39')](_0x49bb('0x88'),_0x3d761d))[_0x49bb('0x76')]();_0x20a650['push'](db['sequelize'][_0x49bb('0x31')](_0x5b27b1));_0xd2cd1a[_0x49bb('0x89')](db[_0x49bb('0x8a')][_0x49bb('0x31')](_0x3d1da9));}return BPromise[_0x49bb('0x8b')](_0x20a650);}})[_0x49bb('0x23')](function(){return BPromise[_0x49bb('0x8b')](_0xd2cd1a);})[_0x49bb('0x23')](function(){return _0x29e5f9;})[_0x49bb('0x23')](respondWithResult(_0x4742be,null))[_0x49bb('0x40')](handleError(_0x4742be,null));};exports[_0x49bb('0x8c')]=function(_0x463ed6,_0x4f887c,_0x6cfddb){return db['Campaign'][_0x49bb('0x43')]({'where':{'id':_0x463ed6[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x4f887c,null))['then'](function(_0x2e2e87){if(_0x2e2e87){return _0x2e2e87[_0x49bb('0x8c')](_0x463ed6[_0x49bb('0x31')]['ids']);}})['then'](function(_0x45957b){if(_0x45957b){return db[_0x49bb('0x55')][_0x49bb('0x26')]({'where':{'ListId':_0x463ed6[_0x49bb('0x31')][_0x49bb('0x67')],'CampaignId':_0x463ed6[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](function(){return _0x45957b;});}})[_0x49bb('0x23')](respondWithStatusCode(_0x4f887c,null))[_0x49bb('0x40')](handleError(_0x4f887c,null));};exports[_0x49bb('0x8d')]=function(_0x5418e4,_0x4e133b,_0x460091){var _0x1346fa={};var _0x52a9d4={};var _0x7f3477;var _0x3b0592;return db[_0x49bb('0x2a')][_0x49bb('0x54')]({'where':{'id':_0x5418e4[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x4e133b,null))[_0x49bb('0x23')](function(_0x1036f0){if(_0x1036f0){_0x7f3477=_0x1036f0;_0x52a9d4[_0x49bb('0x2f')]=_[_0x49bb('0x32')](db['CmList'][_0x49bb('0x2b')]);_0x52a9d4['query']=_[_0x49bb('0x32')](_0x5418e4[_0x49bb('0x31')]);_0x52a9d4[_0x49bb('0x33')]=_[_0x49bb('0x34')](_0x52a9d4[_0x49bb('0x2f')],_0x52a9d4[_0x49bb('0x31')]);_0x1346fa[_0x49bb('0x36')]=_['intersection'](_0x52a9d4[_0x49bb('0x2f')],qs[_0x49bb('0x35')](_0x5418e4['query'][_0x49bb('0x35')]));_0x1346fa[_0x49bb('0x36')]=_0x1346fa[_0x49bb('0x36')][_0x49bb('0x37')]?_0x1346fa[_0x49bb('0x36')]:_0x52a9d4['model'];_0x1346fa[_0x49bb('0x57')]=qs[_0x49bb('0x38')](_0x5418e4['query'][_0x49bb('0x38')]);_0x1346fa[_0x49bb('0x39')]=qs[_0x49bb('0x33')](_[_0x49bb('0x58')](_0x5418e4[_0x49bb('0x31')],_0x52a9d4['filters']));if(_0x5418e4[_0x49bb('0x31')]['filter']){_0x1346fa['where']=_[_0x49bb('0x3b')](_0x1346fa[_0x49bb('0x39')],{'$or':_['map'](_0x1346fa[_0x49bb('0x36')],function(_0x38bac0){var _0x1021ea={};_0x1021ea[_0x38bac0]={'$like':'%'+_0x5418e4[_0x49bb('0x31')][_0x49bb('0x3a')]+'%'};return _0x1021ea;})});}_0x1346fa=_['merge']({},_0x1346fa,_0x5418e4[_0x49bb('0x3d')]);return _0x7f3477[_0x49bb('0x8d')](_0x1346fa);}})['then'](function(_0x162884){if(_0x162884){_0x3b0592=_0x162884[_0x49bb('0x37')];if(!_0x5418e4[_0x49bb('0x31')][_0x49bb('0x56')]('nolimit')){_0x1346fa[_0x49bb('0x1e')]=qs[_0x49bb('0x1e')](_0x5418e4[_0x49bb('0x31')][_0x49bb('0x1e')]);_0x1346fa[_0x49bb('0x1c')]=qs[_0x49bb('0x1c')](_0x5418e4[_0x49bb('0x31')][_0x49bb('0x1c')]);}return _0x7f3477[_0x49bb('0x8d')](_0x1346fa);}})['then'](function(_0x5bd052){if(_0x5bd052){return _0x5bd052?{'count':_0x3b0592,'rows':_0x5bd052}:null;}})[_0x49bb('0x23')](respondWithResult(_0x4e133b,null))[_0x49bb('0x40')](handleError(_0x4e133b,null));};exports[_0x49bb('0x8e')]=function(_0x5cc812,_0x308a85,_0x526469){var _0x2e4be8,_0x139929;var _0x17f942=[];var _0x4456b3=moment()[_0x49bb('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x49bb('0x2a')][_0x49bb('0x43')]({'where':{'id':_0x5cc812[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0x308a85,null))[_0x49bb('0x23')](function(_0xac35e6){if(_0xac35e6){_0x139929=_0xac35e6;return _0xac35e6[_0x49bb('0x8e')](_0x5cc812[_0x49bb('0x45')][_0x49bb('0x67')],_['omit'](_0x5cc812[_0x49bb('0x45')],[_0x49bb('0x67'),'id'])||{});}return null;})['spread'](function(_0x2caab6){var _0x5cc412;var _0x34e4bb;_0x2e4be8=_0x2caab6||[];var _0x1c7a91=[];if(_0x2caab6){for(var _0x44ef98=0x0;_0x44ef98<_0x2caab6[_0x49bb('0x37')];_0x44ef98+=0x1){var _0x526e52=_0x2caab6[_0x44ef98][_0x49bb('0x46')]({'plain':!![]});_0x5cc412=squel['insert']()[_0x49bb('0x81')](_0x49bb('0x8f'))[_0x49bb('0x6d')]([_0x49bb('0x6e'),_0x49bb('0x74'),_0x49bb('0x70'),_0x49bb('0x59'),'createdAt',_0x49bb('0x50')],squel['select']()[_0x49bb('0x72')]('phone',_0x49bb('0x6e'))[_0x49bb('0x72')]('id',_0x49bb('0x74'))[_0x49bb('0x72')](_0x526e52[_0x49bb('0x75')][_0x49bb('0x76')](),_0x49bb('0x70'))[_0x49bb('0x72')](_0x5cc812[_0x49bb('0x41')]['id'][_0x49bb('0x76')](),'CampaignId')['field']('NOW()',_0x49bb('0x4e'))[_0x49bb('0x72')](_0x49bb('0x73'),_0x49bb('0x50'))[_0x49bb('0x7d')]('cm_contacts')[_0x49bb('0x39')]('deletedAt\x20IS\x20NULL')[_0x49bb('0x39')]('ListId\x20=\x20?',_0x526e52[_0x49bb('0x75')]['toString']())[_0x49bb('0x39')](_0x49bb('0x7a')))[_0x49bb('0x76')]();_0x1c7a91[_0x49bb('0x89')](db['sequelize']['query'](_0x5cc412));}return BPromise[_0x49bb('0x8b')](_0x1c7a91);}})[_0x49bb('0x23')](function(){return _0x2e4be8;})[_0x49bb('0x23')](respondWithResult(_0x308a85,null))['catch'](handleError(_0x308a85,null));};exports[_0x49bb('0x90')]=function(_0x423817,_0xbf83a4,_0x2084e3){return db[_0x49bb('0x2a')]['find']({'where':{'id':_0x423817[_0x49bb('0x41')]['id']}})[_0x49bb('0x23')](handleEntityNotFound(_0xbf83a4,null))[_0x49bb('0x23')](function(_0x32ebdd){if(_0x32ebdd){return _0x32ebdd[_0x49bb('0x90')](_0x423817['query']['ids']);}})[_0x49bb('0x23')](function(_0x8a44b6){if(_0x8a44b6){return db[_0x49bb('0x61')][_0x49bb('0x26')]({'where':{'ListId':_0x423817[_0x49bb('0x31')]['ids'],'CampaignId':_0x423817[_0x49bb('0x41')]['id']}})['then'](function(){return _0x8a44b6;});}})[_0x49bb('0x23')](respondWithStatusCode(_0xbf83a4,null))[_0x49bb('0x40')](handleError(_0xbf83a4,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 011347a..93091ca 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index fc995f3..5079682 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 _0xd6ce=['raw','attributes','limit','map','include','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','GetCampaign','Campaign','options'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xd6ce,0x127));var _0xed6c=function(_0x1a3663,_0x48e1ec){_0x1a3663=_0x1a3663-0x0;var _0x57a0ce=_0xd6ce[_0x1a3663];return _0x57a0ce;};'use strict';var _=require(_0xed6c('0x0'));var util=require(_0xed6c('0x1'));var moment=require(_0xed6c('0x2'));var BPromise=require(_0xed6c('0x3'));var rs=require(_0xed6c('0x4'));var fs=require('fs');var Redis=require(_0xed6c('0x5'));var db=require(_0xed6c('0x6'))['db'];var utils=require(_0xed6c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xed6c('0x8'));var jayson=require(_0xed6c('0x9'));var client=jayson[_0xed6c('0xa')][_0xed6c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4a6546,_0x5e0e3a,_0x7668a7){return new BPromise(function(_0x46e2c4,_0x4fd673){return client['request'](_0x4a6546,_0x7668a7)[_0xed6c('0xc')](function(_0xc996c4){logger[_0xed6c('0xd')](_0xed6c('0xe'),_0x5e0e3a,'request\x20sent');logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x5e0e3a,'request\x20sent',JSON[_0xed6c('0xf')](_0xc996c4));if(_0xc996c4['error']){if(_0xc996c4['error'][_0xed6c('0x10')]===0x1f4){logger[_0xed6c('0x11')]('Campaign,\x20%s,\x20%s',_0x5e0e3a,_0xc996c4[_0xed6c('0x11')]['message']);return _0x4fd673(_0xc996c4[_0xed6c('0x11')][_0xed6c('0x12')]);}logger['error'](_0xed6c('0xe'),_0x5e0e3a,_0xc996c4[_0xed6c('0x11')][_0xed6c('0x12')]);return _0x46e2c4(_0xc996c4[_0xed6c('0x11')]['message']);}else{logger['info'](_0xed6c('0xe'),_0x5e0e3a,_0xed6c('0x13'));_0x46e2c4(_0xc996c4[_0xed6c('0x14')]['message']);}})[_0xed6c('0x15')](function(_0x526c54){logger[_0xed6c('0x11')](_0xed6c('0xe'),_0x5e0e3a,_0x526c54);_0x4fd673(_0x526c54);});});}exports[_0xed6c('0x16')]=function(_0x1fe8c0){var _0x4a920e=this;return new Promise(function(_0x387ba1,_0x1856f7){return db[_0xed6c('0x17')]['findAll']({'raw':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')][_0xed6c('0x19')]===undefined?!![]:![]:!![],'where':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')]['where']||null:null,'attributes':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0['options'][_0xed6c('0x1a')]||null:null,'limit':_0x1fe8c0[_0xed6c('0x18')]?_0x1fe8c0[_0xed6c('0x18')][_0xed6c('0x1b')]||null:null,'include':_0x1fe8c0['options']?_0x1fe8c0[_0xed6c('0x18')]['include']?_[_0xed6c('0x1c')](_0x1fe8c0['options'][_0xed6c('0x1d')],function(_0x21e0ba){return{'model':db[_0x21e0ba[_0xed6c('0x1e')]],'as':_0x21e0ba['as'],'attributes':_0x21e0ba[_0xed6c('0x1a')],'include':_0x21e0ba[_0xed6c('0x1d')]?_[_0xed6c('0x1c')](_0x21e0ba[_0xed6c('0x1d')],function(_0x27fb6c){return{'model':db[_0x27fb6c[_0xed6c('0x1e')]],'as':_0x27fb6c['as'],'attributes':_0x27fb6c[_0xed6c('0x1a')],'include':_0x27fb6c[_0xed6c('0x1d')]?_['map'](_0x27fb6c[_0xed6c('0x1d')],function(_0x27484c){return{'model':db[_0x27484c[_0xed6c('0x1e')]],'as':_0x27484c['as'],'attributes':_0x27484c[_0xed6c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xed6c('0xc')](function(_0x3574a3){logger['info'](_0xed6c('0x16'),_0x1fe8c0);logger[_0xed6c('0x1f')](_0xed6c('0x16'),_0x1fe8c0,JSON['stringify'](_0x3574a3));_0x387ba1(_0x3574a3);})['catch'](function(_0x531cd0){logger['error'](_0xed6c('0x16'),_0x531cd0['message'],_0x1fe8c0);_0x1856f7(_0x4a920e[_0xed6c('0x11')](0x1f4,_0x531cd0['message']));});});}; \ No newline at end of file +var _0x37b4=['stringify','error','Campaign,\x20%s,\x20%s','message','result','catch','GetCampaign','Campaign','options','attributes','include','map','model','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','info','request\x20sent'];(function(_0x231a02,_0x2a9e36){var _0x3ae533=function(_0xba726e){while(--_0xba726e){_0x231a02['push'](_0x231a02['shift']());}};_0x3ae533(++_0x2a9e36);}(_0x37b4,0xef));var _0x437b=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x37b4[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x437b('0x0'));var util=require('util');var moment=require(_0x437b('0x1'));var BPromise=require(_0x437b('0x2'));var rs=require(_0x437b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x437b('0x4'))['db'];var utils=require(_0x437b('0x5'));var logger=require(_0x437b('0x6'))(_0x437b('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x437b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c7dea,_0x4aada7,_0x226e3c){return new BPromise(function(_0x5df980,_0x432b63){return client['request'](_0x3c7dea,_0x226e3c)['then'](function(_0x44bf1d){logger[_0x437b('0x9')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));logger['debug']('Campaign,\x20%s,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'),JSON[_0x437b('0xb')](_0x44bf1d));if(_0x44bf1d[_0x437b('0xc')]){if(_0x44bf1d[_0x437b('0xc')]['code']===0x1f4){logger[_0x437b('0xc')](_0x437b('0xd'),_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x432b63(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}logger[_0x437b('0xc')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x44bf1d[_0x437b('0xc')]['message']);return _0x5df980(_0x44bf1d[_0x437b('0xc')][_0x437b('0xe')]);}else{logger[_0x437b('0x9')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x437b('0xa'));_0x5df980(_0x44bf1d[_0x437b('0xf')][_0x437b('0xe')]);}})[_0x437b('0x10')](function(_0x1d31af){logger[_0x437b('0xc')]('Campaign,\x20%s,\x20%s',_0x4aada7,_0x1d31af);_0x432b63(_0x1d31af);});});}exports[_0x437b('0x11')]=function(_0x501d8c){var _0x2b3994=this;return new Promise(function(_0x107024,_0x1c91bc){return db[_0x437b('0x12')]['findAll']({'raw':_0x501d8c['options']?_0x501d8c['options']['raw']===undefined?!![]:![]:!![],'where':_0x501d8c[_0x437b('0x13')]?_0x501d8c[_0x437b('0x13')]['where']||null:null,'attributes':_0x501d8c[_0x437b('0x13')]?_0x501d8c['options'][_0x437b('0x14')]||null:null,'limit':_0x501d8c[_0x437b('0x13')]?_0x501d8c[_0x437b('0x13')]['limit']||null:null,'include':_0x501d8c['options']?_0x501d8c['options'][_0x437b('0x15')]?_[_0x437b('0x16')](_0x501d8c[_0x437b('0x13')][_0x437b('0x15')],function(_0x8c5852){return{'model':db[_0x8c5852[_0x437b('0x17')]],'as':_0x8c5852['as'],'attributes':_0x8c5852[_0x437b('0x14')],'include':_0x8c5852[_0x437b('0x15')]?_[_0x437b('0x16')](_0x8c5852[_0x437b('0x15')],function(_0x258198){return{'model':db[_0x258198['model']],'as':_0x258198['as'],'attributes':_0x258198[_0x437b('0x14')],'include':_0x258198[_0x437b('0x15')]?_[_0x437b('0x16')](_0x258198[_0x437b('0x15')],function(_0x17092c){return{'model':db[_0x17092c['model']],'as':_0x17092c['as'],'attributes':_0x17092c[_0x437b('0x14')]};}):[]};}):[]};}):[]:[]})[_0x437b('0x18')](function(_0x4a7d0b){logger[_0x437b('0x9')]('GetCampaign',_0x501d8c);logger['debug']('GetCampaign',_0x501d8c,JSON[_0x437b('0xb')](_0x4a7d0b));_0x107024(_0x4a7d0b);})['catch'](function(_0x37a3d7){logger[_0x437b('0xc')](_0x437b('0x11'),_0x37a3d7['message'],_0x501d8c);_0x1c91bc(_0x2b3994['error'](0x1f4,_0x37a3d7[_0x437b('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 62924a2..42fb499 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 _0x2932=['post','/:id/clone','clone','/:id/lists','addLists','put','/:id','update','delete','destroy','removeLists','removeBlackLists','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getLists','/:id/blacklists'];(function(_0x12e930,_0x3b89df){var _0x82603c=function(_0x39ec44){while(--_0x39ec44){_0x12e930['push'](_0x12e930['shift']());}};_0x82603c(++_0x3b89df);}(_0x2932,0x198));var _0x2293=function(_0x310990,_0x245984){_0x310990=_0x310990-0x0;var _0x648534=_0x2932[_0x310990];return _0x648534;};'use strict';var multer=require(_0x2293('0x0'));var util=require(_0x2293('0x1'));var path=require(_0x2293('0x2'));var timeout=require('connect-timeout');var express=require(_0x2293('0x3'));var router=express[_0x2293('0x4')]();var fs_extra=require(_0x2293('0x5'));var auth=require(_0x2293('0x6'));var interaction=require(_0x2293('0x7'));var config=require(_0x2293('0x8'));var controller=require('./campaign.controller');router[_0x2293('0x9')]('/',auth['isAuthenticated'](),controller[_0x2293('0xa')]);router['get']('/:id',auth[_0x2293('0xb')](),controller['show']);router['get'](_0x2293('0xc'),auth['isAuthenticated'](),controller[_0x2293('0xd')]);router[_0x2293('0x9')](_0x2293('0xe'),auth[_0x2293('0xb')](),controller[_0x2293('0xf')]);router[_0x2293('0x9')](_0x2293('0x10'),auth[_0x2293('0xb')](),controller[_0x2293('0x11')]);router[_0x2293('0x9')](_0x2293('0x12'),auth[_0x2293('0xb')](),controller['getHopperBlacks']);router[_0x2293('0x9')]('/:id/lists',auth[_0x2293('0xb')](),controller[_0x2293('0x13')]);router[_0x2293('0x9')](_0x2293('0x14'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x2293('0x15')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2293('0x16'),auth[_0x2293('0xb')](),controller[_0x2293('0x17')]);router[_0x2293('0x15')](_0x2293('0x18'),auth[_0x2293('0xb')](),controller[_0x2293('0x19')]);router[_0x2293('0x15')](_0x2293('0x14'),auth[_0x2293('0xb')](),controller['addBlackLists']);router[_0x2293('0x1a')](_0x2293('0x1b'),auth[_0x2293('0xb')](),controller[_0x2293('0x1c')]);router[_0x2293('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0x2293('0x1e')]);router[_0x2293('0x1d')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2293('0x1f')]);router[_0x2293('0x1d')]('/:id/blacklists',auth[_0x2293('0xb')](),controller[_0x2293('0x20')]);module['exports']=router; \ No newline at end of file +var _0xf185=['/:id/lists','getLists','/:id/blacklists','getBlackLists','/:id/clone','clone','post','addLists','addBlackLists','update','removeLists','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./campaign.controller','get','isAuthenticated','/:id','show','/:id/hoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks'];(function(_0x32ce61,_0x2ba733){var _0x28eded=function(_0x34db11){while(--_0x34db11){_0x32ce61['push'](_0x32ce61['shift']());}};_0x28eded(++_0x2ba733);}(_0xf185,0x1be));var _0x5f18=function(_0x3cd774,_0x1c01b1){_0x3cd774=_0x3cd774-0x0;var _0x1f4922=_0xf185[_0x3cd774];return _0x1f4922;};'use strict';var multer=require(_0x5f18('0x0'));var util=require('util');var path=require(_0x5f18('0x1'));var timeout=require(_0x5f18('0x2'));var express=require(_0x5f18('0x3'));var router=express[_0x5f18('0x4')]();var fs_extra=require(_0x5f18('0x5'));var auth=require(_0x5f18('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5f18('0x7'));var controller=require(_0x5f18('0x8'));router[_0x5f18('0x9')]('/',auth[_0x5f18('0xa')](),controller['index']);router[_0x5f18('0x9')](_0x5f18('0xb'),auth['isAuthenticated'](),controller[_0x5f18('0xc')]);router['get'](_0x5f18('0xd'),auth[_0x5f18('0xa')](),controller['getHoppers']);router[_0x5f18('0x9')](_0x5f18('0xe'),auth['isAuthenticated'](),controller[_0x5f18('0xf')]);router[_0x5f18('0x9')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x5f18('0x10')]);router[_0x5f18('0x9')](_0x5f18('0x11'),auth['isAuthenticated'](),controller[_0x5f18('0x12')]);router[_0x5f18('0x9')](_0x5f18('0x13'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x14')]);router[_0x5f18('0x9')](_0x5f18('0x15'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x16')]);router['post']('/',auth[_0x5f18('0xa')](),controller['create']);router['post'](_0x5f18('0x17'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x18')]);router[_0x5f18('0x19')](_0x5f18('0x13'),auth['isAuthenticated'](),controller[_0x5f18('0x1a')]);router[_0x5f18('0x19')](_0x5f18('0x15'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x1b')]);router['put'](_0x5f18('0xb'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x1c')]);router['delete'](_0x5f18('0xb'),auth[_0x5f18('0xa')](),controller['destroy']);router['delete'](_0x5f18('0x13'),auth[_0x5f18('0xa')](),controller[_0x5f18('0x1d')]);router[_0x5f18('0x1e')](_0x5f18('0x15'),auth[_0x5f18('0xa')](),controller['removeBlackLists']);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 7f4d009..b784986 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 _0x3d36=['key','sequelize','exports','STRING','TEXT','medium','VIRTUAL','getDataValue'];(function(_0x392750,_0x5c5b7d){var _0x514afd=function(_0x1be1b4){while(--_0x1be1b4){_0x392750['push'](_0x392750['shift']());}};_0x514afd(++_0x5c5b7d);}(_0x3d36,0x171));var _0x63d3=function(_0x237546,_0xa81b26){_0x237546=_0x237546-0x0;var _0x233e29=_0x3d36[_0x237546];return _0x233e29;};'use strict';var Sequelize=require(_0x63d3('0x0'));module[_0x63d3('0x1')]={'key':{'type':Sequelize[_0x63d3('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x63d3('0x3')],'length':_0x63d3('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x63d3('0x2')]},'name':{'type':Sequelize[_0x63d3('0x5')],'get':function(){return this[_0x63d3('0x6')](_0x63d3('0x7'));}}}; \ No newline at end of file +var _0x98ee=['sequelize','exports','STRING','TEXT','VIRTUAL','key'];(function(_0x236fd6,_0x55fb7d){var _0x479e14=function(_0x7488ef){while(--_0x7488ef){_0x236fd6['push'](_0x236fd6['shift']());}};_0x479e14(++_0x55fb7d);}(_0x98ee,0x144));var _0xe98e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x98ee[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require(_0xe98e('0x0'));module[_0xe98e('0x1')]={'key':{'type':Sequelize[_0xe98e('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xe98e('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xe98e('0x4')],'get':function(){return this['getDataValue'](_0xe98e('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 08cde5e..cf0ff41 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 _0x09e2=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','UserProfileResource','stack','name','index','map','CannedAnswer','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','rows','catch','show','params','body','find','create','key','MailAccountId','SmsAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x09e2,0x1b6));var _0x209e=function(_0x25cfcd,_0x5a294d){_0x25cfcd=_0x25cfcd-0x0;var _0x421a40=_0x09e2[_0x25cfcd];return _0x421a40;};'use strict';var emlformat=require(_0x209e('0x0'));var rimraf=require(_0x209e('0x1'));var zipdir=require(_0x209e('0x2'));var jsonpatch=require(_0x209e('0x3'));var rp=require(_0x209e('0x4'));var moment=require(_0x209e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x209e('0x6'));var util=require(_0x209e('0x7'));var path=require(_0x209e('0x8'));var sox=require(_0x209e('0x9'));var csv=require(_0x209e('0xa'));var ejs=require(_0x209e('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x209e('0xc'));var squel=require(_0x209e('0xd'));var crypto=require(_0x209e('0xe'));var jsforce=require(_0x209e('0xf'));var deskjs=require(_0x209e('0x10'));var toCsv=require(_0x209e('0xa'));var querystring=require(_0x209e('0x11'));var Papa=require(_0x209e('0x12'));var Redis=require(_0x209e('0x13'));var authService=require(_0x209e('0x14'));var qs=require(_0x209e('0x15'));var as=require(_0x209e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x209e('0x17'))(_0x209e('0x18'));var utils=require('../../config/utils');var config=require(_0x209e('0x19'));var licenseUtil=require(_0x209e('0x1a'));var db=require(_0x209e('0x1b'))['db'];function respondWithStatusCode(_0x59c41c,_0x3a1040){_0x3a1040=_0x3a1040||0xcc;return function(_0x96c550){if(_0x96c550){return _0x59c41c[_0x209e('0x1c')](_0x3a1040);}return _0x59c41c['status'](_0x3a1040)[_0x209e('0x1d')]();};}function respondWithResult(_0x8627be,_0x55b607){_0x55b607=_0x55b607||0xc8;return function(_0x39c45d){if(_0x39c45d){return _0x8627be[_0x209e('0x1e')](_0x55b607)[_0x209e('0x1f')](_0x39c45d);}};}function respondWithFilteredResult(_0x548200,_0x4a40c1){return function(_0xb0151c){if(_0xb0151c){var _0x4c7eee=typeof _0x4a40c1['offset']==='undefined'&&typeof _0x4a40c1[_0x209e('0x20')]===_0x209e('0x21');var _0x3f5685=_0xb0151c[_0x209e('0x22')];var _0x19460b=_0x4c7eee?0x0:_0x4a40c1[_0x209e('0x23')];var _0x4a3a44=_0x4c7eee?_0xb0151c[_0x209e('0x22')]:_0x4a40c1['offset']+_0x4a40c1[_0x209e('0x20')];var _0x4b204d;if(_0x4a3a44>=_0x3f5685){_0x4a3a44=_0x3f5685;_0x4b204d=0xc8;}else{_0x4b204d=0xce;}_0x548200[_0x209e('0x1e')](_0x4b204d);return _0x548200[_0x209e('0x24')](_0x209e('0x25'),_0x19460b+'-'+_0x4a3a44+'/'+_0x3f5685)[_0x209e('0x1f')](_0xb0151c);}return null;};}function patchUpdates(_0x59cd19){return function(_0x5a1fdb){try{jsonpatch[_0x209e('0x26')](_0x5a1fdb,_0x59cd19,!![]);}catch(_0x4c41b0){return BPromise[_0x209e('0x27')](_0x4c41b0);}return _0x5a1fdb[_0x209e('0x28')]();};}function saveUpdates(_0x2ffcc6,_0x57dfe1){return function(_0x4d383c){if(_0x4d383c){return _0x4d383c[_0x209e('0x29')](_0x2ffcc6)[_0x209e('0x2a')](function(_0xba442e){return _0xba442e;});}return null;};}function removeEntity(_0x113d3d,_0x4ae2e1){return function(_0xbda9d6){if(_0xbda9d6){return _0xbda9d6[_0x209e('0x2b')]()[_0x209e('0x2a')](function(){var _0x29f378=_0xbda9d6['get']({'plain':!![]});var _0x530057=_0x209e('0x2c');return db[_0x209e('0x2d')]['destroy']({'where':{'type':_0x530057,'resourceId':_0x29f378['id']}})[_0x209e('0x2a')](function(){return _0xbda9d6;});})['then'](function(){_0x113d3d[_0x209e('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e2938,_0x4de8af){return function(_0x513e3b){if(!_0x513e3b){_0x4e2938[_0x209e('0x1c')](0x194);}return _0x513e3b;};}function handleError(_0x36ccfe,_0x2dad3b){_0x2dad3b=_0x2dad3b||0x1f4;return function(_0x4c6d4){logger['error'](_0x4c6d4[_0x209e('0x2e')]);if(_0x4c6d4[_0x209e('0x2f')]){delete _0x4c6d4[_0x209e('0x2f')];}_0x36ccfe[_0x209e('0x1e')](_0x2dad3b)['send'](_0x4c6d4);};}exports[_0x209e('0x30')]=function(_0x47456a,_0x2b9b8f){var _0x4e3499={},_0x430c9a={},_0x2bccf1={'count':0x0,'rows':[]};var _0x59072a=_[_0x209e('0x31')](db[_0x209e('0x32')][_0x209e('0x33')],function(_0x274992){return{'name':_0x274992[_0x209e('0x34')],'type':_0x274992[_0x209e('0x35')]['key']};});_0x430c9a[_0x209e('0x36')]=_['map'](_0x59072a,_0x209e('0x2f'));_0x430c9a[_0x209e('0x37')]=_[_0x209e('0x38')](_0x47456a[_0x209e('0x37')]);_0x430c9a[_0x209e('0x39')]=_[_0x209e('0x3a')](_0x430c9a['model'],_0x430c9a[_0x209e('0x37')]);_0x4e3499[_0x209e('0x3b')]=_[_0x209e('0x3a')](_0x430c9a[_0x209e('0x36')],qs[_0x209e('0x3c')](_0x47456a[_0x209e('0x37')][_0x209e('0x3c')]));_0x4e3499['attributes']=_0x4e3499[_0x209e('0x3b')][_0x209e('0x3d')]?_0x4e3499[_0x209e('0x3b')]:_0x430c9a[_0x209e('0x36')];if(!_0x47456a['query'][_0x209e('0x3e')]('nolimit')){_0x4e3499[_0x209e('0x20')]=qs[_0x209e('0x20')](_0x47456a['query']['limit']);_0x4e3499[_0x209e('0x23')]=qs[_0x209e('0x23')](_0x47456a['query'][_0x209e('0x23')]);}_0x4e3499[_0x209e('0x3f')]=qs[_0x209e('0x40')](_0x47456a[_0x209e('0x37')][_0x209e('0x40')]);_0x4e3499[_0x209e('0x41')]=qs['filters'](_[_0x209e('0x42')](_0x47456a[_0x209e('0x37')],_0x430c9a[_0x209e('0x39')]),_0x59072a);if(_0x47456a[_0x209e('0x37')][_0x209e('0x43')]){_0x4e3499['where']=_[_0x209e('0x44')](_0x4e3499[_0x209e('0x41')],{'$or':[{'key':{'$like':'%'+_0x47456a['query']['filter']+'%'}},{'value':{'$like':'%'+_0x47456a[_0x209e('0x37')][_0x209e('0x43')]+'%'}}]});}_0x4e3499=_[_0x209e('0x44')]({},_0x4e3499,_0x47456a[_0x209e('0x45')]);var _0x3f41ba={'where':_0x4e3499[_0x209e('0x41')]};return db['CannedAnswer'][_0x209e('0x22')](_0x3f41ba)[_0x209e('0x2a')](function(_0x4a412e){_0x2bccf1[_0x209e('0x22')]=_0x4a412e;if(_0x47456a[_0x209e('0x37')]['includeAll']){_0x4e3499['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4e3499);})[_0x209e('0x2a')](function(_0x114978){_0x2bccf1[_0x209e('0x46')]=_0x114978;return _0x2bccf1;})[_0x209e('0x2a')](respondWithFilteredResult(_0x2b9b8f,_0x4e3499))[_0x209e('0x47')](handleError(_0x2b9b8f,null));};exports[_0x209e('0x48')]=function(_0x418b59,_0xb3fc48){var _0x475208={'raw':!![],'where':{'id':_0x418b59[_0x209e('0x49')]['id']}},_0x193ca7={};_0x193ca7[_0x209e('0x36')]=_[_0x209e('0x38')](db[_0x209e('0x32')][_0x209e('0x33')]);_0x193ca7[_0x209e('0x37')]=_[_0x209e('0x38')](_0x418b59[_0x209e('0x37')]);_0x193ca7['filters']=_[_0x209e('0x3a')](_0x193ca7['model'],_0x193ca7[_0x209e('0x37')]);_0x475208[_0x209e('0x3b')]=_['intersection'](_0x193ca7['model'],qs[_0x209e('0x3c')](_0x418b59[_0x209e('0x37')][_0x209e('0x3c')]));_0x475208['attributes']=_0x475208[_0x209e('0x3b')]['length']?_0x475208[_0x209e('0x3b')]:_0x193ca7['model'];if(_0x418b59['query']['includeAll']){_0x475208['include']=[{'all':!![]}];}_0x475208=_[_0x209e('0x44')]({},_0x475208,_0x418b59[_0x209e('0x45')]);return db[_0x209e('0x32')]['find'](_0x475208)['then'](handleEntityNotFound(_0xb3fc48,null))['then'](respondWithResult(_0xb3fc48,null))[_0x209e('0x47')](handleError(_0xb3fc48,null));};exports[_0x209e('0x29')]=function(_0x4a06a9,_0x456c05){if(_0x4a06a9[_0x209e('0x4a')]['id']){delete _0x4a06a9[_0x209e('0x4a')]['id'];}return db['CannedAnswer'][_0x209e('0x4b')]({'where':{'id':_0x4a06a9[_0x209e('0x49')]['id']}})['then'](handleEntityNotFound(_0x456c05,null))['then'](saveUpdates(_0x4a06a9[_0x209e('0x4a')],null))[_0x209e('0x2a')](respondWithResult(_0x456c05,null))[_0x209e('0x47')](handleError(_0x456c05,null));};exports[_0x209e('0x2b')]=function(_0x28f2fb,_0x1b285f){return db[_0x209e('0x32')][_0x209e('0x4b')]({'where':{'id':_0x28f2fb[_0x209e('0x49')]['id']}})[_0x209e('0x2a')](handleEntityNotFound(_0x1b285f,null))[_0x209e('0x2a')](removeEntity(_0x1b285f,null))['catch'](handleError(_0x1b285f,null));};exports[_0x209e('0x4c')]=function(_0x298cad,_0x37f2ae){var _0x53a30e={'key':_0x298cad[_0x209e('0x4a')][_0x209e('0x4d')]};if(_0x298cad[_0x209e('0x4a')][_0x209e('0x4e')]){_0x53a30e[_0x209e('0x4e')]=_0x298cad['body'][_0x209e('0x4e')];}else if(_0x298cad[_0x209e('0x4a')]['SmsAccountId']){_0x53a30e[_0x209e('0x4f')]=_0x298cad[_0x209e('0x4a')][_0x209e('0x4f')];}else if(_0x298cad[_0x209e('0x4a')]['OpenchannelAccountId']){_0x53a30e['OpenchannelAccountId']=_0x298cad[_0x209e('0x4a')]['OpenchannelAccountId'];}else if(_0x298cad[_0x209e('0x4a')][_0x209e('0x50')]){_0x53a30e[_0x209e('0x50')]=_0x298cad['body'][_0x209e('0x50')];}return db[_0x209e('0x32')][_0x209e('0x4b')]({'where':_0x53a30e})[_0x209e('0x2a')](function(_0x3e9cd3){if(_0x3e9cd3){throw new db[(_0x209e('0x51'))][(_0x209e('0x52'))](_0x209e('0x53'));}return db[_0x209e('0x32')][_0x209e('0x4c')](_0x298cad['body']);})[_0x209e('0x2a')](function(_0x327ae5){var _0x1337d9=_0x298cad['user'][_0x209e('0x54')]({'plain':!![]});if(!_0x1337d9)throw new Error(_0x209e('0x55'));if(_0x1337d9['role']===_0x209e('0x56')){var _0x51883f=_0x327ae5[_0x209e('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x209e('0x4b')]({'where':{'name':_0x209e('0x2c'),'userProfileId':_0x1337d9[_0x209e('0x57')]},'raw':!![]})[_0x209e('0x2a')](function(_0x1a4d5c){if(_0x1a4d5c&&_0x1a4d5c[_0x209e('0x58')]===0x0){return db['UserProfileResource'][_0x209e('0x4c')]({'name':_0x51883f[_0x209e('0x2f')],'resourceId':_0x51883f['id'],'type':_0x1a4d5c[_0x209e('0x2f')],'sectionId':_0x1a4d5c['id']},{})[_0x209e('0x2a')](function(){return _0x327ae5;});}else{return _0x327ae5;}})[_0x209e('0x47')](function(_0x361aa6){logger[_0x209e('0x59')](_0x209e('0x5a'),_0x361aa6);throw _0x361aa6;});}return _0x327ae5;})[_0x209e('0x2a')](respondWithResult(_0x37f2ae,0xc9))[_0x209e('0x47')](handleError(_0x37f2ae,null));}; \ No newline at end of file +var _0xb65b=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','get','CannedAnswers','UserProfileResource','error','name','send','index','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','options','then','include','findAll','rows','catch','params','CannedAnswer','rawAttributes','includeAll','find','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb65b,0x1a1));var _0xbb65=function(_0x4acaee,_0x2a5f32){_0x4acaee=_0x4acaee-0x0;var _0x418cb3=_0xb65b[_0x4acaee];return _0x418cb3;};'use strict';var emlformat=require(_0xbb65('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb65('0x1'));var jsonpatch=require(_0xbb65('0x2'));var rp=require(_0xbb65('0x3'));var moment=require(_0xbb65('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb65('0x5'));var util=require(_0xbb65('0x6'));var path=require(_0xbb65('0x7'));var sox=require(_0xbb65('0x8'));var csv=require(_0xbb65('0x9'));var ejs=require(_0xbb65('0xa'));var fs=require('fs');var fs_extra=require(_0xbb65('0xb'));var _=require(_0xbb65('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbb65('0xd'));var deskjs=require(_0xbb65('0xe'));var toCsv=require(_0xbb65('0x9'));var querystring=require('querystring');var Papa=require(_0xbb65('0xf'));var Redis=require('ioredis');var authService=require(_0xbb65('0x10'));var qs=require(_0xbb65('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb65('0x12'));var logger=require(_0xbb65('0x13'))(_0xbb65('0x14'));var utils=require(_0xbb65('0x15'));var config=require(_0xbb65('0x16'));var licenseUtil=require(_0xbb65('0x17'));var db=require(_0xbb65('0x18'))['db'];function respondWithStatusCode(_0x4fe5b0,_0x19b33c){_0x19b33c=_0x19b33c||0xcc;return function(_0xbedf9c){if(_0xbedf9c){return _0x4fe5b0[_0xbb65('0x19')](_0x19b33c);}return _0x4fe5b0[_0xbb65('0x1a')](_0x19b33c)[_0xbb65('0x1b')]();};}function respondWithResult(_0x128d92,_0x36dae3){_0x36dae3=_0x36dae3||0xc8;return function(_0x2ede3f){if(_0x2ede3f){return _0x128d92[_0xbb65('0x1a')](_0x36dae3)[_0xbb65('0x1c')](_0x2ede3f);}};}function respondWithFilteredResult(_0x155859,_0x2b9e08){return function(_0xbd544a){if(_0xbd544a){var _0x4e0c59=typeof _0x2b9e08[_0xbb65('0x1d')]===_0xbb65('0x1e')&&typeof _0x2b9e08[_0xbb65('0x1f')]===_0xbb65('0x1e');var _0x55c18f=_0xbd544a[_0xbb65('0x20')];var _0x3a1994=_0x4e0c59?0x0:_0x2b9e08[_0xbb65('0x1d')];var _0x2fc420=_0x4e0c59?_0xbd544a[_0xbb65('0x20')]:_0x2b9e08[_0xbb65('0x1d')]+_0x2b9e08[_0xbb65('0x1f')];var _0x4c3439;if(_0x2fc420>=_0x55c18f){_0x2fc420=_0x55c18f;_0x4c3439=0xc8;}else{_0x4c3439=0xce;}_0x155859[_0xbb65('0x1a')](_0x4c3439);return _0x155859[_0xbb65('0x21')]('Content-Range',_0x3a1994+'-'+_0x2fc420+'/'+_0x55c18f)[_0xbb65('0x1c')](_0xbd544a);}return null;};}function patchUpdates(_0x486203){return function(_0x1e7708){try{jsonpatch['apply'](_0x1e7708,_0x486203,!![]);}catch(_0x5cf0c0){return BPromise[_0xbb65('0x22')](_0x5cf0c0);}return _0x1e7708[_0xbb65('0x23')]();};}function saveUpdates(_0x1d6653,_0x5580e5){return function(_0x1a93d3){if(_0x1a93d3){return _0x1a93d3[_0xbb65('0x24')](_0x1d6653)['then'](function(_0x5e274b){return _0x5e274b;});}return null;};}function removeEntity(_0x381390,_0x4032fb){return function(_0x427d14){if(_0x427d14){return _0x427d14[_0xbb65('0x25')]()['then'](function(){var _0xe37cee=_0x427d14[_0xbb65('0x26')]({'plain':!![]});var _0x4276ba=_0xbb65('0x27');return db[_0xbb65('0x28')][_0xbb65('0x25')]({'where':{'type':_0x4276ba,'resourceId':_0xe37cee['id']}})['then'](function(){return _0x427d14;});})['then'](function(){_0x381390['status'](0xcc)[_0xbb65('0x1b')]();});}};}function handleEntityNotFound(_0x53c926,_0x2359f2){return function(_0x55f2c5){if(!_0x55f2c5){_0x53c926[_0xbb65('0x19')](0x194);}return _0x55f2c5;};}function handleError(_0x42e90b,_0x4254ef){_0x4254ef=_0x4254ef||0x1f4;return function(_0x5867d3){logger[_0xbb65('0x29')](_0x5867d3['stack']);if(_0x5867d3['name']){delete _0x5867d3[_0xbb65('0x2a')];}_0x42e90b[_0xbb65('0x1a')](_0x4254ef)[_0xbb65('0x2b')](_0x5867d3);};}exports[_0xbb65('0x2c')]=function(_0x3d0944,_0x3e4bf9){var _0xdbd450={},_0x53ca66={},_0x3222cf={'count':0x0,'rows':[]};var _0x58825c=_[_0xbb65('0x2d')](db['CannedAnswer']['rawAttributes'],function(_0x44d4d3){return{'name':_0x44d4d3[_0xbb65('0x2e')],'type':_0x44d4d3[_0xbb65('0x2f')][_0xbb65('0x30')]};});_0x53ca66[_0xbb65('0x31')]=_[_0xbb65('0x2d')](_0x58825c,_0xbb65('0x2a'));_0x53ca66['query']=_[_0xbb65('0x32')](_0x3d0944[_0xbb65('0x33')]);_0x53ca66['filters']=_[_0xbb65('0x34')](_0x53ca66[_0xbb65('0x31')],_0x53ca66[_0xbb65('0x33')]);_0xdbd450['attributes']=_[_0xbb65('0x34')](_0x53ca66[_0xbb65('0x31')],qs[_0xbb65('0x35')](_0x3d0944[_0xbb65('0x33')]['fields']));_0xdbd450['attributes']=_0xdbd450[_0xbb65('0x36')][_0xbb65('0x37')]?_0xdbd450['attributes']:_0x53ca66['model'];if(!_0x3d0944[_0xbb65('0x33')][_0xbb65('0x38')](_0xbb65('0x39'))){_0xdbd450[_0xbb65('0x1f')]=qs[_0xbb65('0x1f')](_0x3d0944[_0xbb65('0x33')]['limit']);_0xdbd450[_0xbb65('0x1d')]=qs[_0xbb65('0x1d')](_0x3d0944[_0xbb65('0x33')][_0xbb65('0x1d')]);}_0xdbd450['order']=qs[_0xbb65('0x3a')](_0x3d0944[_0xbb65('0x33')][_0xbb65('0x3a')]);_0xdbd450[_0xbb65('0x3b')]=qs['filters'](_[_0xbb65('0x3c')](_0x3d0944[_0xbb65('0x33')],_0x53ca66[_0xbb65('0x3d')]),_0x58825c);if(_0x3d0944['query'][_0xbb65('0x3e')]){_0xdbd450[_0xbb65('0x3b')]=_[_0xbb65('0x3f')](_0xdbd450[_0xbb65('0x3b')],{'$or':[{'key':{'$like':'%'+_0x3d0944['query'][_0xbb65('0x3e')]+'%'}},{'value':{'$like':'%'+_0x3d0944['query'][_0xbb65('0x3e')]+'%'}}]});}_0xdbd450=_[_0xbb65('0x3f')]({},_0xdbd450,_0x3d0944[_0xbb65('0x40')]);var _0x18627a={'where':_0xdbd450['where']};return db['CannedAnswer']['count'](_0x18627a)[_0xbb65('0x41')](function(_0x350d7e){_0x3222cf[_0xbb65('0x20')]=_0x350d7e;if(_0x3d0944[_0xbb65('0x33')]['includeAll']){_0xdbd450[_0xbb65('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xbb65('0x43')](_0xdbd450);})['then'](function(_0x5aacd5){_0x3222cf[_0xbb65('0x44')]=_0x5aacd5;return _0x3222cf;})['then'](respondWithFilteredResult(_0x3e4bf9,_0xdbd450))[_0xbb65('0x45')](handleError(_0x3e4bf9,null));};exports['show']=function(_0x28bc05,_0x353d0e){var _0x3a72c8={'raw':!![],'where':{'id':_0x28bc05[_0xbb65('0x46')]['id']}},_0x2d4c1c={};_0x2d4c1c[_0xbb65('0x31')]=_['keys'](db[_0xbb65('0x47')][_0xbb65('0x48')]);_0x2d4c1c[_0xbb65('0x33')]=_[_0xbb65('0x32')](_0x28bc05[_0xbb65('0x33')]);_0x2d4c1c[_0xbb65('0x3d')]=_[_0xbb65('0x34')](_0x2d4c1c[_0xbb65('0x31')],_0x2d4c1c[_0xbb65('0x33')]);_0x3a72c8[_0xbb65('0x36')]=_['intersection'](_0x2d4c1c[_0xbb65('0x31')],qs[_0xbb65('0x35')](_0x28bc05[_0xbb65('0x33')][_0xbb65('0x35')]));_0x3a72c8['attributes']=_0x3a72c8['attributes'][_0xbb65('0x37')]?_0x3a72c8['attributes']:_0x2d4c1c['model'];if(_0x28bc05[_0xbb65('0x33')][_0xbb65('0x49')]){_0x3a72c8[_0xbb65('0x42')]=[{'all':!![]}];}_0x3a72c8=_[_0xbb65('0x3f')]({},_0x3a72c8,_0x28bc05[_0xbb65('0x40')]);return db[_0xbb65('0x47')][_0xbb65('0x4a')](_0x3a72c8)['then'](handleEntityNotFound(_0x353d0e,null))[_0xbb65('0x41')](respondWithResult(_0x353d0e,null))[_0xbb65('0x45')](handleError(_0x353d0e,null));};exports[_0xbb65('0x24')]=function(_0x371f08,_0x1b7f37){if(_0x371f08[_0xbb65('0x4b')]['id']){delete _0x371f08[_0xbb65('0x4b')]['id'];}return db[_0xbb65('0x47')]['find']({'where':{'id':_0x371f08['params']['id']}})[_0xbb65('0x41')](handleEntityNotFound(_0x1b7f37,null))[_0xbb65('0x41')](saveUpdates(_0x371f08[_0xbb65('0x4b')],null))[_0xbb65('0x41')](respondWithResult(_0x1b7f37,null))[_0xbb65('0x45')](handleError(_0x1b7f37,null));};exports[_0xbb65('0x25')]=function(_0x54f852,_0xd1b1bd){return db[_0xbb65('0x47')][_0xbb65('0x4a')]({'where':{'id':_0x54f852[_0xbb65('0x46')]['id']}})['then'](handleEntityNotFound(_0xd1b1bd,null))[_0xbb65('0x41')](removeEntity(_0xd1b1bd,null))[_0xbb65('0x45')](handleError(_0xd1b1bd,null));};exports[_0xbb65('0x4c')]=function(_0x1a0245,_0x4da031){var _0xa45a9f={'key':_0x1a0245[_0xbb65('0x4b')][_0xbb65('0x30')]};if(_0x1a0245['body']['MailAccountId']){_0xa45a9f[_0xbb65('0x4d')]=_0x1a0245['body'][_0xbb65('0x4d')];}else if(_0x1a0245['body'][_0xbb65('0x4e')]){_0xa45a9f[_0xbb65('0x4e')]=_0x1a0245['body']['SmsAccountId'];}else if(_0x1a0245['body'][_0xbb65('0x4f')]){_0xa45a9f[_0xbb65('0x4f')]=_0x1a0245['body'][_0xbb65('0x4f')];}else if(_0x1a0245[_0xbb65('0x4b')][_0xbb65('0x50')]){_0xa45a9f[_0xbb65('0x50')]=_0x1a0245[_0xbb65('0x4b')][_0xbb65('0x50')];}return db['CannedAnswer']['find']({'where':_0xa45a9f})[_0xbb65('0x41')](function(_0x41ca28){if(_0x41ca28){throw new db['Sequelize']['ValidationError'](_0xbb65('0x51'));}return db[_0xbb65('0x47')][_0xbb65('0x4c')](_0x1a0245[_0xbb65('0x4b')]);})[_0xbb65('0x41')](function(_0x11467c){var _0x1b619f=_0x1a0245[_0xbb65('0x52')][_0xbb65('0x26')]({'plain':!![]});if(!_0x1b619f)throw new Error(_0xbb65('0x53'));if(_0x1b619f[_0xbb65('0x54')]===_0xbb65('0x52')){var _0x7213ee=_0x11467c[_0xbb65('0x26')]({'plain':!![]});return db[_0xbb65('0x55')]['find']({'where':{'name':_0xbb65('0x27'),'userProfileId':_0x1b619f[_0xbb65('0x56')]},'raw':!![]})[_0xbb65('0x41')](function(_0x2b085e){if(_0x2b085e&&_0x2b085e['autoAssociation']===0x0){return db[_0xbb65('0x28')]['create']({'name':_0x7213ee[_0xbb65('0x2a')],'resourceId':_0x7213ee['id'],'type':_0x2b085e['name'],'sectionId':_0x2b085e['id']},{})[_0xbb65('0x41')](function(){return _0x11467c;});}else{return _0x11467c;}})[_0xbb65('0x45')](function(_0x3e2051){logger[_0xbb65('0x29')](_0xbb65('0x57'),_0x3e2051);throw _0x3e2051;});}return _0x11467c;})[_0xbb65('0x41')](respondWithResult(_0x4da031,0xc9))[_0xbb65('0x45')](handleError(_0x4da031,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0818f91..55f7776 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 _0x8f59=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x58d86a,_0x5b2505){var _0x3f5008=function(_0x53ad18){while(--_0x53ad18){_0x58d86a['push'](_0x58d86a['shift']());}};_0x3f5008(++_0x5b2505);}(_0x8f59,0x11d));var _0x98f5=function(_0x5ba736,_0x3470bb){_0x5ba736=_0x5ba736-0x0;var _0xa338e4=_0x8f59[_0x5ba736];return _0xa338e4;};'use strict';var _=require(_0x98f5('0x0'));var util=require(_0x98f5('0x1'));var logger=require(_0x98f5('0x2'))(_0x98f5('0x3'));var moment=require(_0x98f5('0x4'));var BPromise=require(_0x98f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x98f5('0x6'));var rimraf=require(_0x98f5('0x7'));var config=require(_0x98f5('0x8'));var attributes=require(_0x98f5('0x9'));module['exports']=function(_0xdcce7a,_0x358618){return _0xdcce7a[_0x98f5('0xa')]('CannedAnswer',attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x98f5('0xb'),'collate':_0x98f5('0xc')});}; \ No newline at end of file +var _0x8ca9=['rimraf','exports','tools_canned_answers','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x56756b,_0x3e8cc7){var _0xa3002=function(_0x5f1386){while(--_0x5f1386){_0x56756b['push'](_0x56756b['shift']());}};_0xa3002(++_0x3e8cc7);}(_0x8ca9,0x1a1));var _0x98ca=function(_0x2b9972,_0x3a8d75){_0x2b9972=_0x2b9972-0x0;var _0x299e8b=_0x8ca9[_0x2b9972];return _0x299e8b;};'use strict';var _=require(_0x98ca('0x0'));var util=require('util');var logger=require(_0x98ca('0x1'))(_0x98ca('0x2'));var moment=require('moment');var BPromise=require(_0x98ca('0x3'));var rp=require(_0x98ca('0x4'));var fs=require('fs');var path=require(_0x98ca('0x5'));var rimraf=require(_0x98ca('0x6'));var config=require('../../config/environment');var attributes=require('./cannedAnswer.attributes');module[_0x98ca('0x7')]=function(_0x51c890,_0x2e5f12){return _0x51c890['define']('CannedAnswer',attributes,{'tableName':_0x98ca('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index c65f87c..3d6febb 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(_0x3b5ffd,_0x2548d1){var _0x1fa6d5=function(_0x2237c){while(--_0x2237c){_0x3b5ffd['push'](_0x3b5ffd['shift']());}};_0x1fa6d5(++_0x2548d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x2e7efa,_0x27499d){var _0x47c46f=function(_0x1812ee){while(--_0x1812ee){_0x2e7efa['push'](_0x2e7efa['shift']());}};_0x47c46f(++_0x27499d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xa9e0[_0x12d033];return _0x3b4e80;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 e6e1d0a..c28235d 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 _0x6e54=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','index','get','/:id','post','isAuthenticated','create'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0x6e54,0x101));var _0x46e5=function(_0x324fe8,_0x1ccb46){_0x324fe8=_0x324fe8-0x0;var _0x4a1cd9=_0x6e54[_0x324fe8];return _0x4a1cd9;};'use strict';var multer=require(_0x46e5('0x0'));var util=require(_0x46e5('0x1'));var path=require(_0x46e5('0x2'));var timeout=require(_0x46e5('0x3'));var express=require(_0x46e5('0x4'));var router=express[_0x46e5('0x5')]();var fs_extra=require(_0x46e5('0x6'));var auth=require(_0x46e5('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x46e5('0x8'));var controller=require(_0x46e5('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x46e5('0xa')]);router[_0x46e5('0xb')](_0x46e5('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x46e5('0xd')]('/',auth[_0x46e5('0xe')](),controller[_0x46e5('0xf')]);router[_0x46e5('0x10')](_0x46e5('0xc'),auth['isAuthenticated'](),controller[_0x46e5('0x11')]);router[_0x46e5('0x12')](_0x46e5('0xc'),auth[_0x46e5('0xe')](),controller[_0x46e5('0x13')]);module[_0x46e5('0x14')]=router; \ No newline at end of file +var _0x1c9e=['create','put','delete','/:id','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','post'];(function(_0x3fba9f,_0x3b7b9b){var _0x192cf1=function(_0x557290){while(--_0x557290){_0x3fba9f['push'](_0x3fba9f['shift']());}};_0x192cf1(++_0x3b7b9b);}(_0x1c9e,0x72));var _0xe1c9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x1c9e[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xe1c9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xe1c9('0x1'));var express=require(_0xe1c9('0x2'));var router=express[_0xe1c9('0x3')]();var fs_extra=require(_0xe1c9('0x4'));var auth=require(_0xe1c9('0x5'));var interaction=require(_0xe1c9('0x6'));var config=require(_0xe1c9('0x7'));var controller=require('./cannedAnswer.controller');router[_0xe1c9('0x8')]('/',auth[_0xe1c9('0x9')](),controller[_0xe1c9('0xa')]);router[_0xe1c9('0x8')]('/:id',auth[_0xe1c9('0x9')](),controller['show']);router[_0xe1c9('0xb')]('/',auth[_0xe1c9('0x9')](),controller[_0xe1c9('0xc')]);router[_0xe1c9('0xd')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xe1c9('0xe')](_0xe1c9('0xf'),auth[_0xe1c9('0x9')](),controller[_0xe1c9('0x10')]);module[_0xe1c9('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 d3c72b4..d72bd4b 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 _0x3a41=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x1ba0f3,_0x4e7ab8){var _0x313c21=function(_0x423f79){while(--_0x423f79){_0x1ba0f3['push'](_0x1ba0f3['shift']());}};_0x313c21(++_0x4e7ab8);}(_0x3a41,0x86));var _0x13a4=function(_0x56de9d,_0x413b89){_0x56de9d=_0x56de9d-0x0;var _0x5b63fd=_0x3a41[_0x56de9d];return _0x5b63fd;};'use strict';var Sequelize=require(_0x13a4('0x0'));module[_0x13a4('0x1')]={'calldate':{'type':Sequelize[_0x13a4('0x2')],'allowNull':![],'defaultValue':_0x13a4('0x3')},'clid':{'type':Sequelize[_0x13a4('0x4')]},'src':{'type':Sequelize[_0x13a4('0x4')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x13a4('0x4')]},'channel':{'type':Sequelize[_0x13a4('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x13a4('0x4')]},'duration':{'type':Sequelize[_0x13a4('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x13a4('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x13a4('0x4')]},'amaflags':{'type':Sequelize[_0x13a4('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x13a4('0x4')]},'uniqueid':{'type':Sequelize[_0x13a4('0x4')]},'linkedid':{'type':Sequelize[_0x13a4('0x4')]},'sequence':{'type':Sequelize[_0x13a4('0x4')]},'peeraccount':{'type':Sequelize[_0x13a4('0x4')]},'type':{'type':Sequelize[_0x13a4('0x4')]},'tag':{'type':Sequelize[_0x13a4('0x4')]}}; \ No newline at end of file +var _0x3c8c=['STRING','INTEGER','sequelize','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x3832b8,_0x4491cf){var _0x4b383a=function(_0x27ac30){while(--_0x27ac30){_0x3832b8['push'](_0x3832b8['shift']());}};_0x4b383a(++_0x4491cf);}(_0x3c8c,0xb0));var _0xc3c8=function(_0x122a4a,_0x47d80f){_0x122a4a=_0x122a4a-0x0;var _0x38004a=_0x3c8c[_0x122a4a];return _0x38004a;};'use strict';var Sequelize=require(_0xc3c8('0x0'));module[_0xc3c8('0x1')]={'calldate':{'type':Sequelize[_0xc3c8('0x2')],'allowNull':![],'defaultValue':_0xc3c8('0x3')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0xc3c8('0x4')]},'dst':{'type':Sequelize[_0xc3c8('0x4')]},'dcontext':{'type':Sequelize[_0xc3c8('0x4')]},'channel':{'type':Sequelize[_0xc3c8('0x4')]},'dstchannel':{'type':Sequelize[_0xc3c8('0x4')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0xc3c8('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc3c8('0x4')]},'amaflags':{'type':Sequelize[_0xc3c8('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xc3c8('0x4')]},'uniqueid':{'type':Sequelize[_0xc3c8('0x4')]},'linkedid':{'type':Sequelize[_0xc3c8('0x4')]},'sequence':{'type':Sequelize[_0xc3c8('0x4')]},'peeraccount':{'type':Sequelize[_0xc3c8('0x4')]},'type':{'type':Sequelize[_0xc3c8('0x4')]},'tag':{'type':Sequelize[_0xc3c8('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index adf83cf..ec3f931 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 _0x5292=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','length','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','params','fields','options','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','lodash','squel','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','sendStatus','status','end','json','offset','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Cdr'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x5292,0xf7));var _0x2529=function(_0x5e3ac2,_0x225614){_0x5e3ac2=_0x5e3ac2-0x0;var _0x29a007=_0x5292[_0x5e3ac2];return _0x29a007;};'use strict';var emlformat=require(_0x2529('0x0'));var rimraf=require(_0x2529('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2529('0x2'));var rp=require('request-promise');var moment=require(_0x2529('0x3'));var BPromise=require(_0x2529('0x4'));var Mustache=require(_0x2529('0x5'));var util=require(_0x2529('0x6'));var path=require('path');var sox=require(_0x2529('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2529('0x8'));var squel=require(_0x2529('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2529('0xa'));var toCsv=require(_0x2529('0xb'));var querystring=require('querystring');var Papa=require(_0x2529('0xc'));var Redis=require(_0x2529('0xd'));var authService=require(_0x2529('0xe'));var qs=require(_0x2529('0xf'));var as=require(_0x2529('0x10'));var hardwareService=require(_0x2529('0x11'));var logger=require(_0x2529('0x12'))(_0x2529('0x13'));var utils=require('../../config/utils');var config=require(_0x2529('0x14'));var licenseUtil=require(_0x2529('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe333c9,_0x23bfaf){_0x23bfaf=_0x23bfaf||0xcc;return function(_0x149692){if(_0x149692){return _0xe333c9[_0x2529('0x16')](_0x23bfaf);}return _0xe333c9[_0x2529('0x17')](_0x23bfaf)[_0x2529('0x18')]();};}function respondWithResult(_0x3f3b40,_0x5245cf){_0x5245cf=_0x5245cf||0xc8;return function(_0x101668){if(_0x101668){return _0x3f3b40[_0x2529('0x17')](_0x5245cf)[_0x2529('0x19')](_0x101668);}};}function respondWithFilteredResult(_0x19e4bf,_0x1cc716){return function(_0x2598a1){if(_0x2598a1){var _0x1a1ccc=typeof _0x1cc716[_0x2529('0x1a')]==='undefined'&&typeof _0x1cc716[_0x2529('0x1b')]==='undefined';var _0x337720=_0x2598a1[_0x2529('0x1c')];var _0x89be58=_0x1a1ccc?0x0:_0x1cc716['offset'];var _0x5b4d0d=_0x1a1ccc?_0x2598a1[_0x2529('0x1c')]:_0x1cc716[_0x2529('0x1a')]+_0x1cc716[_0x2529('0x1b')];var _0x37204a;if(_0x5b4d0d>=_0x337720){_0x5b4d0d=_0x337720;_0x37204a=0xc8;}else{_0x37204a=0xce;}_0x19e4bf[_0x2529('0x17')](_0x37204a);return _0x19e4bf['set'](_0x2529('0x1d'),_0x89be58+'-'+_0x5b4d0d+'/'+_0x337720)[_0x2529('0x19')](_0x2598a1);}return null;};}function patchUpdates(_0x1ca15f){return function(_0xeff5a6){try{jsonpatch['apply'](_0xeff5a6,_0x1ca15f,!![]);}catch(_0x1fa873){return BPromise[_0x2529('0x1e')](_0x1fa873);}return _0xeff5a6[_0x2529('0x1f')]();};}function saveUpdates(_0x5b4760,_0x3d5d17){return function(_0x3f57da){if(_0x3f57da){return _0x3f57da[_0x2529('0x20')](_0x5b4760)[_0x2529('0x21')](function(_0x5540e4){return _0x5540e4;});}return null;};}function removeEntity(_0x2736f6,_0x2d0c6d){return function(_0x400a01){if(_0x400a01){return _0x400a01[_0x2529('0x22')]()[_0x2529('0x21')](function(){_0x2736f6[_0x2529('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5539ef,_0x856e50){return function(_0x40f42b){if(!_0x40f42b){_0x5539ef[_0x2529('0x16')](0x194);}return _0x40f42b;};}function handleError(_0x431c40,_0x24418a){_0x24418a=_0x24418a||0x1f4;return function(_0x2a8371){logger[_0x2529('0x23')](_0x2a8371[_0x2529('0x24')]);if(_0x2a8371[_0x2529('0x25')]){delete _0x2a8371[_0x2529('0x25')];}_0x431c40['status'](_0x24418a)[_0x2529('0x26')](_0x2a8371);};}exports[_0x2529('0x27')]=function(_0x4dd0fb,_0x1822ce){var _0x3c46c6={},_0x5bea2d={},_0x17bcbd={'count':0x0,'rows':[]};var _0x1d7e98=_['map'](db[_0x2529('0x28')][_0x2529('0x29')],function(_0x4a18f6){return{'name':_0x4a18f6[_0x2529('0x2a')],'type':_0x4a18f6[_0x2529('0x2b')][_0x2529('0x2c')]};});_0x5bea2d[_0x2529('0x2d')]=_[_0x2529('0x2e')](_0x1d7e98,'name');_0x5bea2d[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x4dd0fb[_0x2529('0x2f')]);_0x5bea2d[_0x2529('0x31')]=_[_0x2529('0x32')](_0x5bea2d[_0x2529('0x2d')],_0x5bea2d[_0x2529('0x2f')]);_0x3c46c6['attributes']=_['intersection'](_0x5bea2d[_0x2529('0x2d')],qs['fields'](_0x4dd0fb[_0x2529('0x2f')]['fields']));_0x3c46c6['attributes']=_0x3c46c6['attributes'][_0x2529('0x33')]?_0x3c46c6[_0x2529('0x34')]:_0x5bea2d[_0x2529('0x2d')];if(!_0x4dd0fb['query'][_0x2529('0x35')]('nolimit')){_0x3c46c6['limit']=qs['limit'](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1b')]);_0x3c46c6[_0x2529('0x1a')]=qs[_0x2529('0x1a')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x1a')]);}_0x3c46c6[_0x2529('0x36')]=qs[_0x2529('0x37')](_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x37')]);_0x3c46c6[_0x2529('0x38')]=qs[_0x2529('0x31')](_[_0x2529('0x39')](_0x4dd0fb['query'],_0x5bea2d['filters']),_0x1d7e98);if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]){_0x3c46c6['where']=_[_0x2529('0x3b')](_0x3c46c6[_0x2529('0x38')],{'$or':_[_0x2529('0x2e')](_0x1d7e98,function(_0x1b1f81){if(_0x1b1f81[_0x2529('0x2b')]!==_0x2529('0x3c')){var _0x1b8226={};_0x1b8226[_0x1b1f81['name']]={'$like':'%'+_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3a')]+'%'};return _0x1b8226;}})});}_0x3c46c6=_[_0x2529('0x3b')]({},_0x3c46c6,_0x4dd0fb['options']);var _0x1393b7={'where':_0x3c46c6[_0x2529('0x38')]};return db[_0x2529('0x28')][_0x2529('0x1c')](_0x1393b7)[_0x2529('0x21')](function(_0x33acbf){_0x17bcbd[_0x2529('0x1c')]=_0x33acbf;if(_0x4dd0fb[_0x2529('0x2f')][_0x2529('0x3d')]){_0x3c46c6['include']=[{'all':!![]}];}return db[_0x2529('0x28')][_0x2529('0x3e')](_0x3c46c6);})[_0x2529('0x21')](function(_0x3b4e47){_0x17bcbd[_0x2529('0x3f')]=_0x3b4e47;return _0x17bcbd;})[_0x2529('0x21')](respondWithFilteredResult(_0x1822ce,_0x3c46c6))[_0x2529('0x40')](handleError(_0x1822ce,null));};exports['show']=function(_0x8ced2e,_0x33a13e){var _0x3f76e8={'raw':!![],'where':{'id':_0x8ced2e[_0x2529('0x41')]['id']}},_0x2aaecb={};_0x2aaecb['model']=_[_0x2529('0x30')](db[_0x2529('0x28')][_0x2529('0x29')]);_0x2aaecb[_0x2529('0x2f')]=_[_0x2529('0x30')](_0x8ced2e[_0x2529('0x2f')]);_0x2aaecb['filters']=_['intersection'](_0x2aaecb['model'],_0x2aaecb['query']);_0x3f76e8[_0x2529('0x34')]=_['intersection'](_0x2aaecb[_0x2529('0x2d')],qs[_0x2529('0x42')](_0x8ced2e[_0x2529('0x2f')][_0x2529('0x42')]));_0x3f76e8[_0x2529('0x34')]=_0x3f76e8['attributes'][_0x2529('0x33')]?_0x3f76e8['attributes']:_0x2aaecb[_0x2529('0x2d')];if(_0x8ced2e['query'][_0x2529('0x3d')]){_0x3f76e8['include']=[{'all':!![]}];}_0x3f76e8=_[_0x2529('0x3b')]({},_0x3f76e8,_0x8ced2e[_0x2529('0x43')]);return db['Cdr'][_0x2529('0x44')](_0x3f76e8)['then'](handleEntityNotFound(_0x33a13e,null))[_0x2529('0x21')](respondWithResult(_0x33a13e,null))[_0x2529('0x40')](handleError(_0x33a13e,null));};exports[_0x2529('0x45')]=function(_0x3c6d79,_0xdc4bef){return db[_0x2529('0x28')][_0x2529('0x45')](_0x3c6d79[_0x2529('0x46')],{})[_0x2529('0x21')](respondWithResult(_0xdc4bef,0xc9))['catch'](handleError(_0xdc4bef,null));};exports['update']=function(_0x5e72d1,_0x37a23a){if(_0x5e72d1[_0x2529('0x46')]['id']){delete _0x5e72d1[_0x2529('0x46')]['id'];}return db['Cdr']['find']({'where':{'id':_0x5e72d1[_0x2529('0x41')]['id']}})['then'](handleEntityNotFound(_0x37a23a,null))[_0x2529('0x21')](saveUpdates(_0x5e72d1[_0x2529('0x46')],null))[_0x2529('0x21')](respondWithResult(_0x37a23a,null))[_0x2529('0x40')](handleError(_0x37a23a,null));};exports[_0x2529('0x22')]=function(_0x196ee8,_0x4583ba){return db[_0x2529('0x28')]['find']({'where':{'id':_0x196ee8['params']['id']}})[_0x2529('0x21')](handleEntityNotFound(_0x4583ba,null))[_0x2529('0x21')](removeEntity(_0x4583ba,null))[_0x2529('0x40')](handleError(_0x4583ba,null));};exports[_0x2529('0x47')]=function(_0x1f76d3,_0x3ac799){return db[_0x2529('0x28')][_0x2529('0x47')]()[_0x2529('0x21')](respondWithResult(_0x3ac799,null))[_0x2529('0x40')](handleError(_0x3ac799,null));}; \ No newline at end of file +var _0xb647=['bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','end','sendStatus','name','send','index','Cdr','rawAttributes','fieldName','type','key','query','filters','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','show','intersection','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0xab766d,_0x607780){var _0x1b57fd=function(_0x22cfeb){while(--_0x22cfeb){_0xab766d['push'](_0xab766d['shift']());}};_0x1b57fd(++_0x607780);}(_0xb647,0xdb));var _0x7b64=function(_0x52c309,_0x52db5e){_0x52c309=_0x52c309-0x0;var _0x1b67ec=_0xb647[_0x52c309];return _0x1b67ec;};'use strict';var emlformat=require(_0x7b64('0x0'));var rimraf=require(_0x7b64('0x1'));var zipdir=require(_0x7b64('0x2'));var jsonpatch=require(_0x7b64('0x3'));var rp=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var BPromise=require(_0x7b64('0x6'));var Mustache=require(_0x7b64('0x7'));var util=require('util');var path=require(_0x7b64('0x8'));var sox=require('sox');var csv=require(_0x7b64('0x9'));var ejs=require(_0x7b64('0xa'));var fs=require('fs');var fs_extra=require(_0x7b64('0xb'));var _=require(_0x7b64('0xc'));var squel=require(_0x7b64('0xd'));var crypto=require(_0x7b64('0xe'));var jsforce=require(_0x7b64('0xf'));var deskjs=require(_0x7b64('0x10'));var toCsv=require(_0x7b64('0x9'));var querystring=require('querystring');var Papa=require(_0x7b64('0x11'));var Redis=require('ioredis');var authService=require(_0x7b64('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7b64('0x13'));var logger=require(_0x7b64('0x14'))('api');var utils=require(_0x7b64('0x15'));var config=require(_0x7b64('0x16'));var licenseUtil=require(_0x7b64('0x17'));var db=require(_0x7b64('0x18'))['db'];function respondWithStatusCode(_0x25e135,_0x432626){_0x432626=_0x432626||0xcc;return function(_0x5ea1dd){if(_0x5ea1dd){return _0x25e135['sendStatus'](_0x432626);}return _0x25e135[_0x7b64('0x19')](_0x432626)['end']();};}function respondWithResult(_0x530938,_0x2f21d8){_0x2f21d8=_0x2f21d8||0xc8;return function(_0x29a596){if(_0x29a596){return _0x530938[_0x7b64('0x19')](_0x2f21d8)[_0x7b64('0x1a')](_0x29a596);}};}function respondWithFilteredResult(_0x33ebe7,_0x437ddc){return function(_0x306a4e){if(_0x306a4e){var _0x519316=typeof _0x437ddc[_0x7b64('0x1b')]===_0x7b64('0x1c')&&typeof _0x437ddc[_0x7b64('0x1d')]===_0x7b64('0x1c');var _0x157c03=_0x306a4e['count'];var _0x3935c3=_0x519316?0x0:_0x437ddc[_0x7b64('0x1b')];var _0x58517e=_0x519316?_0x306a4e[_0x7b64('0x1e')]:_0x437ddc[_0x7b64('0x1b')]+_0x437ddc['limit'];var _0x23845e;if(_0x58517e>=_0x157c03){_0x58517e=_0x157c03;_0x23845e=0xc8;}else{_0x23845e=0xce;}_0x33ebe7[_0x7b64('0x19')](_0x23845e);return _0x33ebe7[_0x7b64('0x1f')](_0x7b64('0x20'),_0x3935c3+'-'+_0x58517e+'/'+_0x157c03)['json'](_0x306a4e);}return null;};}function patchUpdates(_0x123a3b){return function(_0x5c4135){try{jsonpatch['apply'](_0x5c4135,_0x123a3b,!![]);}catch(_0x3f73cf){return BPromise['reject'](_0x3f73cf);}return _0x5c4135[_0x7b64('0x21')]();};}function saveUpdates(_0x587da6,_0x1bbd87){return function(_0x1ad95f){if(_0x1ad95f){return _0x1ad95f[_0x7b64('0x22')](_0x587da6)[_0x7b64('0x23')](function(_0x450b7e){return _0x450b7e;});}return null;};}function removeEntity(_0x3c0d97,_0x215ea9){return function(_0x3d4bef){if(_0x3d4bef){return _0x3d4bef[_0x7b64('0x24')]()[_0x7b64('0x23')](function(){_0x3c0d97[_0x7b64('0x19')](0xcc)[_0x7b64('0x25')]();});}};}function handleEntityNotFound(_0x24b68e,_0x42efa1){return function(_0x50d06c){if(!_0x50d06c){_0x24b68e[_0x7b64('0x26')](0x194);}return _0x50d06c;};}function handleError(_0x5d9586,_0x1580d0){_0x1580d0=_0x1580d0||0x1f4;return function(_0x21fbd3){logger['error'](_0x21fbd3['stack']);if(_0x21fbd3[_0x7b64('0x27')]){delete _0x21fbd3[_0x7b64('0x27')];}_0x5d9586[_0x7b64('0x19')](_0x1580d0)[_0x7b64('0x28')](_0x21fbd3);};}exports[_0x7b64('0x29')]=function(_0x3c9fad,_0x6740b2){var _0x2729f1={},_0x53e29b={},_0x1616c9={'count':0x0,'rows':[]};var _0x2c4619=_['map'](db[_0x7b64('0x2a')][_0x7b64('0x2b')],function(_0x369402){return{'name':_0x369402[_0x7b64('0x2c')],'type':_0x369402[_0x7b64('0x2d')][_0x7b64('0x2e')]};});_0x53e29b['model']=_['map'](_0x2c4619,_0x7b64('0x27'));_0x53e29b[_0x7b64('0x2f')]=_['keys'](_0x3c9fad['query']);_0x53e29b[_0x7b64('0x30')]=_['intersection'](_0x53e29b[_0x7b64('0x31')],_0x53e29b['query']);_0x2729f1['attributes']=_['intersection'](_0x53e29b[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x3c9fad[_0x7b64('0x2f')]['fields']));_0x2729f1[_0x7b64('0x33')]=_0x2729f1['attributes'][_0x7b64('0x34')]?_0x2729f1[_0x7b64('0x33')]:_0x53e29b[_0x7b64('0x31')];if(!_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x35')]('nolimit')){_0x2729f1[_0x7b64('0x1d')]=qs[_0x7b64('0x1d')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1d')]);_0x2729f1['offset']=qs[_0x7b64('0x1b')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x1b')]);}_0x2729f1[_0x7b64('0x36')]=qs[_0x7b64('0x37')](_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x37')]);_0x2729f1['where']=qs['filters'](_[_0x7b64('0x38')](_0x3c9fad[_0x7b64('0x2f')],_0x53e29b[_0x7b64('0x30')]),_0x2c4619);if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]){_0x2729f1[_0x7b64('0x3a')]=_[_0x7b64('0x3b')](_0x2729f1[_0x7b64('0x3a')],{'$or':_[_0x7b64('0x3c')](_0x2c4619,function(_0x5b1278){if(_0x5b1278[_0x7b64('0x2d')]!==_0x7b64('0x3d')){var _0x451f9b={};_0x451f9b[_0x5b1278[_0x7b64('0x27')]]={'$like':'%'+_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x39')]+'%'};return _0x451f9b;}})});}_0x2729f1=_[_0x7b64('0x3b')]({},_0x2729f1,_0x3c9fad[_0x7b64('0x3e')]);var _0x3c4467={'where':_0x2729f1[_0x7b64('0x3a')]};return db[_0x7b64('0x2a')][_0x7b64('0x1e')](_0x3c4467)[_0x7b64('0x23')](function(_0x36cfce){_0x1616c9[_0x7b64('0x1e')]=_0x36cfce;if(_0x3c9fad[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x2729f1[_0x7b64('0x40')]=[{'all':!![]}];}return db[_0x7b64('0x2a')][_0x7b64('0x41')](_0x2729f1);})['then'](function(_0x442d65){_0x1616c9[_0x7b64('0x42')]=_0x442d65;return _0x1616c9;})[_0x7b64('0x23')](respondWithFilteredResult(_0x6740b2,_0x2729f1))['catch'](handleError(_0x6740b2,null));};exports[_0x7b64('0x43')]=function(_0x2e4d0f,_0x55c889){var _0x216c58={'raw':!![],'where':{'id':_0x2e4d0f['params']['id']}},_0xf0d4a1={};_0xf0d4a1[_0x7b64('0x31')]=_['keys'](db[_0x7b64('0x2a')][_0x7b64('0x2b')]);_0xf0d4a1[_0x7b64('0x2f')]=_['keys'](_0x2e4d0f[_0x7b64('0x2f')]);_0xf0d4a1[_0x7b64('0x30')]=_[_0x7b64('0x44')](_0xf0d4a1[_0x7b64('0x31')],_0xf0d4a1[_0x7b64('0x2f')]);_0x216c58[_0x7b64('0x33')]=_['intersection'](_0xf0d4a1[_0x7b64('0x31')],qs[_0x7b64('0x32')](_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x32')]));_0x216c58[_0x7b64('0x33')]=_0x216c58['attributes']['length']?_0x216c58['attributes']:_0xf0d4a1['model'];if(_0x2e4d0f[_0x7b64('0x2f')][_0x7b64('0x3f')]){_0x216c58[_0x7b64('0x40')]=[{'all':!![]}];}_0x216c58=_[_0x7b64('0x3b')]({},_0x216c58,_0x2e4d0f[_0x7b64('0x3e')]);return db[_0x7b64('0x2a')][_0x7b64('0x45')](_0x216c58)[_0x7b64('0x23')](handleEntityNotFound(_0x55c889,null))[_0x7b64('0x23')](respondWithResult(_0x55c889,null))[_0x7b64('0x46')](handleError(_0x55c889,null));};exports[_0x7b64('0x47')]=function(_0x38983a,_0x4add4d){return db['Cdr'][_0x7b64('0x47')](_0x38983a[_0x7b64('0x48')],{})[_0x7b64('0x23')](respondWithResult(_0x4add4d,0xc9))[_0x7b64('0x46')](handleError(_0x4add4d,null));};exports[_0x7b64('0x22')]=function(_0x5a8639,_0x3e5321){if(_0x5a8639[_0x7b64('0x48')]['id']){delete _0x5a8639[_0x7b64('0x48')]['id'];}return db['Cdr'][_0x7b64('0x45')]({'where':{'id':_0x5a8639[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3e5321,null))[_0x7b64('0x23')](saveUpdates(_0x5a8639[_0x7b64('0x48')],null))['then'](respondWithResult(_0x3e5321,null))[_0x7b64('0x46')](handleError(_0x3e5321,null));};exports[_0x7b64('0x24')]=function(_0x52b04a,_0x3656b8){return db[_0x7b64('0x2a')]['find']({'where':{'id':_0x52b04a[_0x7b64('0x49')]['id']}})[_0x7b64('0x23')](handleEntityNotFound(_0x3656b8,null))[_0x7b64('0x23')](removeEntity(_0x3656b8,null))[_0x7b64('0x46')](handleError(_0x3656b8,null));};exports[_0x7b64('0x4a')]=function(_0x79cbc9,_0x253b33){return db[_0x7b64('0x2a')][_0x7b64('0x4a')]()[_0x7b64('0x23')](respondWithResult(_0x253b33,null))[_0x7b64('0x46')](handleError(_0x253b33,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 988c4d7..3cba8e9 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x178961,_0x55fce6){var _0x18a2c8=function(_0x3412d4){while(--_0x3412d4){_0x178961['push'](_0x178961['shift']());}};_0x18a2c8(++_0x55fce6);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x1d7bfc,_0x9dc01){var _0x34d68d=function(_0x3a7380){while(--_0x3a7380){_0x1d7bfc['push'](_0x1d7bfc['shift']());}};_0x34d68d(++_0x9dc01);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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 f7c008d..11aba53 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 _0x642e=['error','code','Cdr,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x113e32,_0x5339f0){var _0x4ff939=function(_0x2be9ca){while(--_0x2be9ca){_0x113e32['push'](_0x113e32['shift']());}};_0x4ff939(++_0x5339f0);}(_0x642e,0x1be));var _0xe642=function(_0x41376e,_0x1eb56f){_0x41376e=_0x41376e-0x0;var _0x38a918=_0x642e[_0x41376e];return _0x38a918;};'use strict';var _=require(_0xe642('0x0'));var util=require(_0xe642('0x1'));var moment=require(_0xe642('0x2'));var BPromise=require(_0xe642('0x3'));var rs=require(_0xe642('0x4'));var fs=require('fs');var Redis=require(_0xe642('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe642('0x6'))(_0xe642('0x7'));var config=require(_0xe642('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe642('0x9')][_0xe642('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1cab94,_0x56c389,_0x1191c3){return new BPromise(function(_0x3a4297,_0x8e3c35){return client['request'](_0x1cab94,_0x1191c3)[_0xe642('0xb')](function(_0x26c22f){logger['info']('Cdr,\x20%s,\x20%s',_0x56c389,'request\x20sent');logger[_0xe642('0xc')](_0xe642('0xd'),_0x56c389,_0xe642('0xe'),JSON[_0xe642('0xf')](_0x26c22f));if(_0x26c22f['error']){if(_0x26c22f[_0xe642('0x10')][_0xe642('0x11')]===0x1f4){logger[_0xe642('0x10')](_0xe642('0x12'),_0x56c389,_0x26c22f[_0xe642('0x10')][_0xe642('0x13')]);return _0x8e3c35(_0x26c22f[_0xe642('0x10')][_0xe642('0x13')]);}logger[_0xe642('0x10')](_0xe642('0x12'),_0x56c389,_0x26c22f[_0xe642('0x10')]['message']);return _0x3a4297(_0x26c22f['error'][_0xe642('0x13')]);}else{logger['info']('Cdr,\x20%s,\x20%s',_0x56c389,_0xe642('0xe'));_0x3a4297(_0x26c22f[_0xe642('0x14')]['message']);}})[_0xe642('0x15')](function(_0x5edf4a){logger[_0xe642('0x10')]('Cdr,\x20%s,\x20%s',_0x56c389,_0x5edf4a);_0x8e3c35(_0x5edf4a);});});} \ No newline at end of file +var _0xe24a=['../../config/logger','rpc','../../config/environment','jayson/promise','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','Cdr,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3c2a87,_0x301e33){var _0x3a4efd=function(_0x2c5e19){while(--_0x2c5e19){_0x3c2a87['push'](_0x3c2a87['shift']());}};_0x3a4efd(++_0x301e33);}(_0xe24a,0x1dc));var _0xae24=function(_0x502a31,_0x1aeeca){_0x502a31=_0x502a31-0x0;var _0x1b003b=_0xe24a[_0x502a31];return _0x1b003b;};'use strict';var _=require(_0xae24('0x0'));var util=require(_0xae24('0x1'));var moment=require(_0xae24('0x2'));var BPromise=require(_0xae24('0x3'));var rs=require(_0xae24('0x4'));var fs=require('fs');var Redis=require(_0xae24('0x5'));var db=require(_0xae24('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xae24('0x7'))(_0xae24('0x8'));var config=require(_0xae24('0x9'));var jayson=require(_0xae24('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2da4b4,_0x5d5370,_0x4d4745){return new BPromise(function(_0xebdbb4,_0x64b120){return client['request'](_0x2da4b4,_0x4d4745)['then'](function(_0x2abe37){logger[_0xae24('0xb')]('Cdr,\x20%s,\x20%s',_0x5d5370,_0xae24('0xc'));logger[_0xae24('0xd')](_0xae24('0xe'),_0x5d5370,_0xae24('0xc'),JSON[_0xae24('0xf')](_0x2abe37));if(_0x2abe37['error']){if(_0x2abe37[_0xae24('0x10')]['code']===0x1f4){logger[_0xae24('0x10')]('Cdr,\x20%s,\x20%s',_0x5d5370,_0x2abe37[_0xae24('0x10')][_0xae24('0x11')]);return _0x64b120(_0x2abe37[_0xae24('0x10')]['message']);}logger[_0xae24('0x10')](_0xae24('0x12'),_0x5d5370,_0x2abe37[_0xae24('0x10')][_0xae24('0x11')]);return _0xebdbb4(_0x2abe37[_0xae24('0x10')][_0xae24('0x11')]);}else{logger[_0xae24('0xb')]('Cdr,\x20%s,\x20%s',_0x5d5370,'request\x20sent');_0xebdbb4(_0x2abe37[_0xae24('0x13')][_0xae24('0x11')]);}})[_0xae24('0x14')](function(_0x26b773){logger[_0xae24('0x10')]('Cdr,\x20%s,\x20%s',_0x5d5370,_0x26b773);_0x64b120(_0x26b773);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 4749265..0f99064 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(_0x10548e,_0x80eaff){var _0x540aa4=function(_0x277e0e){while(--_0x277e0e){_0x10548e['push'](_0x10548e['shift']());}};_0x540aa4(++_0x80eaff);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x474030,_0x38397a){var _0x584ab0=function(_0xfd7646){while(--_0xfd7646){_0x474030['push'](_0x474030['shift']());}};_0x584ab0(++_0x38397a);}(_0xb10b,0x12a));var _0xbb10=function(_0x3e9903,_0x3ec512){_0x3e9903=_0x3e9903-0x0;var _0xcab758=_0xb10b[_0x3e9903];return _0xcab758;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index ac42c10..a854680 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 _0x9e1b=['*,*,*,*','exports','INTEGER','STRING','TEXT'];(function(_0x46d772,_0x485fbc){var _0x1fd083=function(_0x4ff622){while(--_0x4ff622){_0x46d772['push'](_0x46d772['shift']());}};_0x1fd083(++_0x485fbc);}(_0x9e1b,0x196));var _0xb9e1=function(_0x23e567,_0x21e539){_0x23e567=_0x23e567-0x0;var _0x5db05c=_0x9e1b[_0x23e567];return _0x5db05c;};'use strict';var Sequelize=require('sequelize');module[_0xb9e1('0x0')]={'priority':{'type':Sequelize[_0xb9e1('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb9e1('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xb9e1('0x3')]()},'description':{'type':Sequelize[_0xb9e1('0x2')]},'interval':{'type':Sequelize[_0xb9e1('0x2')],'defaultValue':_0xb9e1('0x4')}}; \ No newline at end of file +var _0x42ab=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x50b342,_0x3fdd5a){var _0x3426d5=function(_0x597d34){while(--_0x597d34){_0x50b342['push'](_0x50b342['shift']());}};_0x3426d5(++_0x3fdd5a);}(_0x42ab,0x194));var _0xb42a=function(_0x262f44,_0x3847ba){_0x262f44=_0x262f44-0x0;var _0x33b27c=_0x42ab[_0x262f44];return _0x33b27c;};'use strict';var Sequelize=require(_0xb42a('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb42a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb42a('0x2')],'allowNull':![],'defaultValue':_0xb42a('0x3')},'appdata':{'type':Sequelize[_0xb42a('0x4')]()},'description':{'type':Sequelize[_0xb42a('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ef53151..6282a3d 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 _0x2083=['destroy','stack','name','send','show','params','model','keys','ChatApplication','rawAttributes','query','attributes','fields','length','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','reject','update','then'];(function(_0x322590,_0x324ba9){var _0x3b12b3=function(_0x588c92){while(--_0x588c92){_0x322590['push'](_0x322590['shift']());}};_0x3b12b3(++_0x324ba9);}(_0x2083,0x137));var _0x3208=function(_0x5d2a59,_0x1d517b){_0x5d2a59=_0x5d2a59-0x0;var _0x361157=_0x2083[_0x5d2a59];return _0x361157;};'use strict';var emlformat=require(_0x3208('0x0'));var rimraf=require(_0x3208('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3208('0x2'));var rp=require(_0x3208('0x3'));var moment=require(_0x3208('0x4'));var BPromise=require(_0x3208('0x5'));var Mustache=require(_0x3208('0x6'));var util=require(_0x3208('0x7'));var path=require(_0x3208('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3208('0x9'));var _=require(_0x3208('0xa'));var squel=require(_0x3208('0xb'));var crypto=require(_0x3208('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x3208('0xd'));var toCsv=require(_0x3208('0xe'));var querystring=require(_0x3208('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3208('0x10'));var qs=require(_0x3208('0x11'));var as=require(_0x3208('0x12'));var hardwareService=require(_0x3208('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x3208('0x14'));var config=require(_0x3208('0x15'));var licenseUtil=require(_0x3208('0x16'));var db=require(_0x3208('0x17'))['db'];function respondWithStatusCode(_0x174620,_0x394883){_0x394883=_0x394883||0xcc;return function(_0xf232e5){if(_0xf232e5){return _0x174620[_0x3208('0x18')](_0x394883);}return _0x174620[_0x3208('0x19')](_0x394883)[_0x3208('0x1a')]();};}function respondWithResult(_0x3deca8,_0x14c24f){_0x14c24f=_0x14c24f||0xc8;return function(_0xa5067){if(_0xa5067){return _0x3deca8[_0x3208('0x19')](_0x14c24f)['json'](_0xa5067);}};}function respondWithFilteredResult(_0x2f1eaf,_0x153cf8){return function(_0x41cdcf){if(_0x41cdcf){var _0x1ef359=typeof _0x153cf8[_0x3208('0x1b')]==='undefined'&&typeof _0x153cf8[_0x3208('0x1c')]===_0x3208('0x1d');var _0x4c1e4d=_0x41cdcf[_0x3208('0x1e')];var _0x3590c5=_0x1ef359?0x0:_0x153cf8[_0x3208('0x1b')];var _0x28e291=_0x1ef359?_0x41cdcf[_0x3208('0x1e')]:_0x153cf8[_0x3208('0x1b')]+_0x153cf8['limit'];var _0x3d44bd;if(_0x28e291>=_0x4c1e4d){_0x28e291=_0x4c1e4d;_0x3d44bd=0xc8;}else{_0x3d44bd=0xce;}_0x2f1eaf[_0x3208('0x19')](_0x3d44bd);return _0x2f1eaf[_0x3208('0x1f')](_0x3208('0x20'),_0x3590c5+'-'+_0x28e291+'/'+_0x4c1e4d)[_0x3208('0x21')](_0x41cdcf);}return null;};}function patchUpdates(_0x46b227){return function(_0x468cca){try{jsonpatch['apply'](_0x468cca,_0x46b227,!![]);}catch(_0x42d97a){return BPromise[_0x3208('0x22')](_0x42d97a);}return _0x468cca['save']();};}function saveUpdates(_0x28d665,_0x361d1c){return function(_0x3c6e34){if(_0x3c6e34){return _0x3c6e34[_0x3208('0x23')](_0x28d665)[_0x3208('0x24')](function(_0x2ce30e){return _0x2ce30e;});}return null;};}function removeEntity(_0x4673c2,_0x523d75){return function(_0x54aa98){if(_0x54aa98){return _0x54aa98[_0x3208('0x25')]()[_0x3208('0x24')](function(){_0x4673c2[_0x3208('0x19')](0xcc)[_0x3208('0x1a')]();});}};}function handleEntityNotFound(_0x14e491,_0x21dc00){return function(_0x47a021){if(!_0x47a021){_0x14e491[_0x3208('0x18')](0x194);}return _0x47a021;};}function handleError(_0x125ae3,_0x270c69){_0x270c69=_0x270c69||0x1f4;return function(_0x10e471){logger['error'](_0x10e471[_0x3208('0x26')]);if(_0x10e471[_0x3208('0x27')]){delete _0x10e471[_0x3208('0x27')];}_0x125ae3['status'](_0x270c69)[_0x3208('0x28')](_0x10e471);};}exports[_0x3208('0x29')]=function(_0xf9e10c,_0x22b561){var _0x283193={'raw':!![],'where':{'id':_0xf9e10c[_0x3208('0x2a')]['id']}},_0x2b153f={};_0x2b153f[_0x3208('0x2b')]=_[_0x3208('0x2c')](db[_0x3208('0x2d')][_0x3208('0x2e')]);_0x2b153f[_0x3208('0x2f')]=_[_0x3208('0x2c')](_0xf9e10c[_0x3208('0x2f')]);_0x2b153f['filters']=_['intersection'](_0x2b153f[_0x3208('0x2b')],_0x2b153f[_0x3208('0x2f')]);_0x283193[_0x3208('0x30')]=_['intersection'](_0x2b153f[_0x3208('0x2b')],qs[_0x3208('0x31')](_0xf9e10c['query'][_0x3208('0x31')]));_0x283193[_0x3208('0x30')]=_0x283193[_0x3208('0x30')][_0x3208('0x32')]?_0x283193[_0x3208('0x30')]:_0x2b153f[_0x3208('0x2b')];if(_0xf9e10c[_0x3208('0x2f')][_0x3208('0x33')]){_0x283193[_0x3208('0x34')]=[{'all':!![]}];}_0x283193=_[_0x3208('0x35')]({},_0x283193,_0xf9e10c[_0x3208('0x36')]);return db[_0x3208('0x2d')][_0x3208('0x37')](_0x283193)['then'](handleEntityNotFound(_0x22b561,null))[_0x3208('0x24')](respondWithResult(_0x22b561,null))[_0x3208('0x38')](handleError(_0x22b561,null));};exports['update']=function(_0x93b8cd,_0x17f0f6){if(_0x93b8cd[_0x3208('0x39')]['id']){delete _0x93b8cd[_0x3208('0x39')]['id'];}return db['ChatApplication']['find']({'where':{'id':_0x93b8cd[_0x3208('0x2a')]['id']}})['then'](handleEntityNotFound(_0x17f0f6,null))[_0x3208('0x24')](saveUpdates(_0x93b8cd[_0x3208('0x39')],null))[_0x3208('0x24')](respondWithResult(_0x17f0f6,null))[_0x3208('0x38')](handleError(_0x17f0f6,null));};exports[_0x3208('0x25')]=function(_0x1588f4,_0x7544fc){return db[_0x3208('0x2d')][_0x3208('0x37')]({'where':{'id':_0x1588f4['params']['id']}})[_0x3208('0x24')](handleEntityNotFound(_0x7544fc,null))['then'](removeEntity(_0x7544fc,null))[_0x3208('0x38')](handleError(_0x7544fc,null));}; \ No newline at end of file +var _0x2746=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','send','show','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','catch','find','params','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x3da001,_0x256e26){var _0x2947e9=function(_0x4afdc0){while(--_0x4afdc0){_0x3da001['push'](_0x3da001['shift']());}};_0x2947e9(++_0x256e26);}(_0x2746,0x19c));var _0x6274=function(_0x85465a,_0x4dfeb2){_0x85465a=_0x85465a-0x0;var _0x57ffb9=_0x2746[_0x85465a];return _0x57ffb9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6274('0x0'));var jsonpatch=require(_0x6274('0x1'));var rp=require(_0x6274('0x2'));var moment=require(_0x6274('0x3'));var BPromise=require(_0x6274('0x4'));var Mustache=require(_0x6274('0x5'));var util=require('util');var path=require('path');var sox=require(_0x6274('0x6'));var csv=require(_0x6274('0x7'));var ejs=require(_0x6274('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6274('0x9'));var squel=require(_0x6274('0xa'));var crypto=require(_0x6274('0xb'));var jsforce=require(_0x6274('0xc'));var deskjs=require(_0x6274('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6274('0xe'));var Papa=require('papaparse');var Redis=require(_0x6274('0xf'));var authService=require(_0x6274('0x10'));var qs=require(_0x6274('0x11'));var as=require(_0x6274('0x12'));var hardwareService=require(_0x6274('0x13'));var logger=require(_0x6274('0x14'))(_0x6274('0x15'));var utils=require(_0x6274('0x16'));var config=require(_0x6274('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59a0a1,_0xd3a0a2){_0xd3a0a2=_0xd3a0a2||0xcc;return function(_0x479fdc){if(_0x479fdc){return _0x59a0a1[_0x6274('0x18')](_0xd3a0a2);}return _0x59a0a1[_0x6274('0x19')](_0xd3a0a2)[_0x6274('0x1a')]();};}function respondWithResult(_0x4f4f9e,_0x58a4e3){_0x58a4e3=_0x58a4e3||0xc8;return function(_0x488b60){if(_0x488b60){return _0x4f4f9e[_0x6274('0x19')](_0x58a4e3)[_0x6274('0x1b')](_0x488b60);}};}function respondWithFilteredResult(_0x4b581a,_0x5e6ff8){return function(_0x425c8b){if(_0x425c8b){var _0x1d0dc4=typeof _0x5e6ff8[_0x6274('0x1c')]===_0x6274('0x1d')&&typeof _0x5e6ff8[_0x6274('0x1e')]==='undefined';var _0x3219d1=_0x425c8b[_0x6274('0x1f')];var _0x40cc32=_0x1d0dc4?0x0:_0x5e6ff8['offset'];var _0x5cdf5e=_0x1d0dc4?_0x425c8b[_0x6274('0x1f')]:_0x5e6ff8['offset']+_0x5e6ff8['limit'];var _0x402b97;if(_0x5cdf5e>=_0x3219d1){_0x5cdf5e=_0x3219d1;_0x402b97=0xc8;}else{_0x402b97=0xce;}_0x4b581a['status'](_0x402b97);return _0x4b581a[_0x6274('0x20')](_0x6274('0x21'),_0x40cc32+'-'+_0x5cdf5e+'/'+_0x3219d1)['json'](_0x425c8b);}return null;};}function patchUpdates(_0x55dab9){return function(_0x3e0248){try{jsonpatch[_0x6274('0x22')](_0x3e0248,_0x55dab9,!![]);}catch(_0xe2b388){return BPromise[_0x6274('0x23')](_0xe2b388);}return _0x3e0248[_0x6274('0x24')]();};}function saveUpdates(_0x221c7a,_0x3b8fb6){return function(_0x12df93){if(_0x12df93){return _0x12df93[_0x6274('0x25')](_0x221c7a)[_0x6274('0x26')](function(_0x1d1a09){return _0x1d1a09;});}return null;};}function removeEntity(_0xc49220,_0x125f14){return function(_0xa0c8bd){if(_0xa0c8bd){return _0xa0c8bd[_0x6274('0x27')]()[_0x6274('0x26')](function(){_0xc49220[_0x6274('0x19')](0xcc)[_0x6274('0x1a')]();});}};}function handleEntityNotFound(_0x5228a1,_0x425241){return function(_0x486d1f){if(!_0x486d1f){_0x5228a1[_0x6274('0x18')](0x194);}return _0x486d1f;};}function handleError(_0x543ac7,_0x234149){_0x234149=_0x234149||0x1f4;return function(_0x1513e8){logger['error'](_0x1513e8[_0x6274('0x28')]);if(_0x1513e8['name']){delete _0x1513e8['name'];}_0x543ac7[_0x6274('0x19')](_0x234149)[_0x6274('0x29')](_0x1513e8);};}exports[_0x6274('0x2a')]=function(_0x490541,_0x3feefd){var _0x49df2e={'raw':!![],'where':{'id':_0x490541['params']['id']}},_0x4818e2={};_0x4818e2[_0x6274('0x2b')]=_[_0x6274('0x2c')](db[_0x6274('0x2d')][_0x6274('0x2e')]);_0x4818e2[_0x6274('0x2f')]=_[_0x6274('0x2c')](_0x490541['query']);_0x4818e2[_0x6274('0x30')]=_[_0x6274('0x31')](_0x4818e2[_0x6274('0x2b')],_0x4818e2[_0x6274('0x2f')]);_0x49df2e[_0x6274('0x32')]=_[_0x6274('0x31')](_0x4818e2[_0x6274('0x2b')],qs['fields'](_0x490541['query'][_0x6274('0x33')]));_0x49df2e[_0x6274('0x32')]=_0x49df2e[_0x6274('0x32')][_0x6274('0x34')]?_0x49df2e[_0x6274('0x32')]:_0x4818e2[_0x6274('0x2b')];if(_0x490541[_0x6274('0x2f')][_0x6274('0x35')]){_0x49df2e[_0x6274('0x36')]=[{'all':!![]}];}_0x49df2e=_[_0x6274('0x37')]({},_0x49df2e,_0x490541[_0x6274('0x38')]);return db[_0x6274('0x2d')]['find'](_0x49df2e)[_0x6274('0x26')](handleEntityNotFound(_0x3feefd,null))[_0x6274('0x26')](respondWithResult(_0x3feefd,null))[_0x6274('0x39')](handleError(_0x3feefd,null));};exports[_0x6274('0x25')]=function(_0x167cba,_0x8b1bd4){if(_0x167cba['body']['id']){delete _0x167cba['body']['id'];}return db['ChatApplication'][_0x6274('0x3a')]({'where':{'id':_0x167cba[_0x6274('0x3b')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x8b1bd4,null))[_0x6274('0x26')](saveUpdates(_0x167cba[_0x6274('0x3c')],null))[_0x6274('0x26')](respondWithResult(_0x8b1bd4,null))[_0x6274('0x39')](handleError(_0x8b1bd4,null));};exports[_0x6274('0x27')]=function(_0x3a63ca,_0x115077){return db[_0x6274('0x2d')][_0x6274('0x3a')]({'where':{'id':_0x3a63ca[_0x6274('0x3b')]['id']}})[_0x6274('0x26')](handleEntityNotFound(_0x115077,null))[_0x6274('0x26')](removeEntity(_0x115077,null))[_0x6274('0x39')](handleError(_0x115077,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4e370c2..7400fed 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 _0xa678=['exports','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x5c9162,_0x3a87bc){var _0x4d427d=function(_0x4c616a){while(--_0x4c616a){_0x5c9162['push'](_0x5c9162['shift']());}};_0x4d427d(++_0x3a87bc);}(_0xa678,0xe1));var _0x8a67=function(_0x41035d,_0x468124){_0x41035d=_0x41035d-0x0;var _0x53d186=_0xa678[_0x41035d];return _0x53d186;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var logger=require(_0x8a67('0x2'))(_0x8a67('0x3'));var moment=require(_0x8a67('0x4'));var BPromise=require(_0x8a67('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8a67('0x6'));var rimraf=require(_0x8a67('0x7'));var config=require(_0x8a67('0x8'));var attributes=require('./chatApplication.attributes');module[_0x8a67('0x9')]=function(_0x5ba4dd,_0x16c745){return _0x5ba4dd['define']('ChatApplication',attributes,{'tableName':_0x8a67('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8a67('0xb'),'collate':_0x8a67('0xc')});}; \ No newline at end of file +var _0xfdd7=['path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfdd7,0xa3));var _0x7fdd=function(_0x33aa5f,_0x28b469){_0x33aa5f=_0x33aa5f-0x0;var _0x4774a1=_0xfdd7[_0x33aa5f];return _0x4774a1;};'use strict';var _=require(_0x7fdd('0x0'));var util=require(_0x7fdd('0x1'));var logger=require(_0x7fdd('0x2'))('api');var moment=require(_0x7fdd('0x3'));var BPromise=require(_0x7fdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7fdd('0x5'));var rimraf=require(_0x7fdd('0x6'));var config=require(_0x7fdd('0x7'));var attributes=require(_0x7fdd('0x8'));module[_0x7fdd('0x9')]=function(_0x54deda,_0x40dbe3){return _0x54deda[_0x7fdd('0xa')](_0x7fdd('0xb'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7fdd('0xc'),'collate':_0x7fdd('0xd')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0e03ef6..586d00f 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 _0x82b9=['info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0xd05d0e,_0x222ec6){var _0xa812c=function(_0x207028){while(--_0x207028){_0xd05d0e['push'](_0xd05d0e['shift']());}};_0xa812c(++_0x222ec6);}(_0x82b9,0x149));var _0x982b=function(_0x21745c,_0x186f06){_0x21745c=_0x21745c-0x0;var _0x12e0b8=_0x82b9[_0x21745c];return _0x12e0b8;};'use strict';var _=require(_0x982b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x982b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x982b('0x2'));var db=require(_0x982b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x982b('0x4'))(_0x982b('0x5'));var config=require('../../config/environment');var jayson=require(_0x982b('0x6'));var client=jayson[_0x982b('0x7')][_0x982b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x529a26,_0x4006c4,_0x1479d8){return new BPromise(function(_0x3cdf7b,_0x2df147){return client[_0x982b('0x9')](_0x529a26,_0x1479d8)[_0x982b('0xa')](function(_0x5aa8ec){logger[_0x982b('0xb')](_0x982b('0xc'),_0x4006c4,_0x982b('0xd'));logger[_0x982b('0xe')](_0x982b('0xf'),_0x4006c4,_0x982b('0xd'),JSON[_0x982b('0x10')](_0x5aa8ec));if(_0x5aa8ec[_0x982b('0x11')]){if(_0x5aa8ec[_0x982b('0x11')]['code']===0x1f4){logger[_0x982b('0x11')](_0x982b('0xc'),_0x4006c4,_0x5aa8ec['error'][_0x982b('0x12')]);return _0x2df147(_0x5aa8ec[_0x982b('0x11')][_0x982b('0x12')]);}logger[_0x982b('0x11')](_0x982b('0xc'),_0x4006c4,_0x5aa8ec[_0x982b('0x11')][_0x982b('0x12')]);return _0x3cdf7b(_0x5aa8ec[_0x982b('0x11')][_0x982b('0x12')]);}else{logger[_0x982b('0xb')](_0x982b('0xc'),_0x4006c4,'request\x20sent');_0x3cdf7b(_0x5aa8ec['result']['message']);}})[_0x982b('0x13')](function(_0x38b70a){logger[_0x982b('0x11')](_0x982b('0xc'),_0x4006c4,_0x38b70a);_0x2df147(_0x38b70a);});});} \ No newline at end of file +var _0x6c36=['code','message','info','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','http','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x19a8b5,_0x3d98c2){var _0xb4e415=function(_0x4c02b7){while(--_0x4c02b7){_0x19a8b5['push'](_0x19a8b5['shift']());}};_0xb4e415(++_0x3d98c2);}(_0x6c36,0x112));var _0x66c3=function(_0x2b7337,_0x324cc6){_0x2b7337=_0x2b7337-0x0;var _0x3d894d=_0x6c36[_0x2b7337];return _0x3d894d;};'use strict';var _=require(_0x66c3('0x0'));var util=require(_0x66c3('0x1'));var moment=require('moment');var BPromise=require(_0x66c3('0x2'));var rs=require(_0x66c3('0x3'));var fs=require('fs');var Redis=require(_0x66c3('0x4'));var db=require(_0x66c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x66c3('0x6'));var config=require(_0x66c3('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x66c3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x41a106,_0x3e017a,_0x47552b){return new BPromise(function(_0x34cb24,_0x3c7ca8){return client['request'](_0x41a106,_0x47552b)[_0x66c3('0x9')](function(_0x5550b9){logger['info'](_0x66c3('0xa'),_0x3e017a,_0x66c3('0xb'));logger[_0x66c3('0xc')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0x3e017a,_0x66c3('0xb'),JSON['stringify'](_0x5550b9));if(_0x5550b9[_0x66c3('0xd')]){if(_0x5550b9['error'][_0x66c3('0xe')]===0x1f4){logger[_0x66c3('0xd')](_0x66c3('0xa'),_0x3e017a,_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);return _0x3c7ca8(_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);}logger['error'](_0x66c3('0xa'),_0x3e017a,_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);return _0x34cb24(_0x5550b9[_0x66c3('0xd')][_0x66c3('0xf')]);}else{logger[_0x66c3('0x10')]('ChatApplication,\x20%s,\x20%s',_0x3e017a,_0x66c3('0xb'));_0x34cb24(_0x5550b9[_0x66c3('0x11')]['message']);}})['catch'](function(_0x5a6bba){logger['error'](_0x66c3('0xa'),_0x3e017a,_0x5a6bba);_0x3c7ca8(_0x5a6bba);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 9ff5bd7..c4a455b 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 _0xa051=['Router','fs-extra','../../components/auth/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','put','/:id','update','destroy','exports','path','connect-timeout','express'];(function(_0xeb6583,_0x7360e0){var _0x326af8=function(_0x3113fd){while(--_0x3113fd){_0xeb6583['push'](_0xeb6583['shift']());}};_0x326af8(++_0x7360e0);}(_0xa051,0xfd));var _0x1a05=function(_0x6c7a8e,_0x1a3ed6){_0x6c7a8e=_0x6c7a8e-0x0;var _0xafab52=_0xa051[_0x6c7a8e];return _0xafab52;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1a05('0x0'));var timeout=require(_0x1a05('0x1'));var express=require(_0x1a05('0x2'));var router=express[_0x1a05('0x3')]();var fs_extra=require(_0x1a05('0x4'));var auth=require(_0x1a05('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1a05('0x6'));var controller=require(_0x1a05('0x7'));router[_0x1a05('0x8')]('/:id',auth[_0x1a05('0x9')](),controller[_0x1a05('0xa')]);router[_0x1a05('0xb')](_0x1a05('0xc'),auth['isAuthenticated'](),controller[_0x1a05('0xd')]);router['delete'](_0x1a05('0xc'),auth['isAuthenticated'](),controller[_0x1a05('0xe')]);module[_0x1a05('0xf')]=router; \ No newline at end of file +var _0x759d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','/:id','isAuthenticated','show','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x4017fc,_0x4734de){var _0x49b7e4=function(_0x414b2f){while(--_0x414b2f){_0x4017fc['push'](_0x4017fc['shift']());}};_0x49b7e4(++_0x4734de);}(_0x759d,0x10a));var _0xd759=function(_0x226e5d,_0x3d7316){_0x226e5d=_0x226e5d-0x0;var _0x8d9bdc=_0x759d[_0x226e5d];return _0x8d9bdc;};'use strict';var multer=require(_0xd759('0x0'));var util=require('util');var path=require(_0xd759('0x1'));var timeout=require(_0xd759('0x2'));var express=require(_0xd759('0x3'));var router=express[_0xd759('0x4')]();var fs_extra=require(_0xd759('0x5'));var auth=require(_0xd759('0x6'));var interaction=require(_0xd759('0x7'));var config=require(_0xd759('0x8'));var controller=require(_0xd759('0x9'));router['get'](_0xd759('0xa'),auth[_0xd759('0xb')](),controller[_0xd759('0xc')]);router[_0xd759('0xd')](_0xd759('0xa'),auth[_0xd759('0xb')](),controller[_0xd759('0xe')]);router['delete'](_0xd759('0xa'),auth[_0xd759('0xb')](),controller['destroy']);module[_0xd759('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 9191503..9136603 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 _0x2087=['sequelize','exports','STRING'];(function(_0x491e30,_0x1579c2){var _0x53f649=function(_0x42cfbc){while(--_0x42cfbc){_0x491e30['push'](_0x491e30['shift']());}};_0x53f649(++_0x1579c2);}(_0x2087,0xf3));var _0x7208=function(_0x2f70d2,_0x49da1c){_0x2f70d2=_0x2f70d2-0x0;var _0x3581d0=_0x2087[_0x2f70d2];return _0x3581d0;};'use strict';var Sequelize=require(_0x7208('0x0'));module[_0x7208('0x1')]={'name':{'type':Sequelize[_0x7208('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x7208('0x2')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xd668=['STRING','BOOLEAN','sequelize'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xd668,0x18e));var _0x8d66=function(_0x204ef6,_0x14dc9b){_0x204ef6=_0x204ef6-0x0;var _0x5e3a4b=_0xd668[_0x204ef6];return _0x5e3a4b;};'use strict';var Sequelize=require(_0x8d66('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d66('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x8d66('0x1')]},'write':{'type':Sequelize[_0x8d66('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 54f4a1c..8ca3743 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 _0xa7ee=['mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','map','ChatGroup','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','show','params','filters','find','create','body','ChatInternalMessage','toInteger','addMembers','ids','getMembers','findOne','rawAttributes','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','hasOwnProperty','eml-format','zip-dir','request-promise','moment','bluebird'];(function(_0x3fbe46,_0x12a0d1){var _0x27c406=function(_0x4a1020){while(--_0x4a1020){_0x3fbe46['push'](_0x3fbe46['shift']());}};_0x27c406(++_0x12a0d1);}(_0xa7ee,0xb7));var _0xea7e=function(_0x1546c2,_0x22e822){_0x1546c2=_0x1546c2-0x0;var _0x24583c=_0xa7ee[_0x1546c2];return _0x24583c;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea7e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea7e('0x2'));var moment=require(_0xea7e('0x3'));var BPromise=require(_0xea7e('0x4'));var Mustache=require(_0xea7e('0x5'));var util=require('util');var path=require(_0xea7e('0x6'));var sox=require('sox');var csv=require(_0xea7e('0x7'));var ejs=require(_0xea7e('0x8'));var fs=require('fs');var fs_extra=require(_0xea7e('0x9'));var _=require(_0xea7e('0xa'));var squel=require(_0xea7e('0xb'));var crypto=require(_0xea7e('0xc'));var jsforce=require(_0xea7e('0xd'));var deskjs=require(_0xea7e('0xe'));var toCsv=require(_0xea7e('0x7'));var querystring=require('querystring');var Papa=require(_0xea7e('0xf'));var Redis=require(_0xea7e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xea7e('0x11'));var as=require(_0xea7e('0x12'));var hardwareService=require(_0xea7e('0x13'));var logger=require('../../config/logger')(_0xea7e('0x14'));var utils=require(_0xea7e('0x15'));var config=require(_0xea7e('0x16'));var licenseUtil=require(_0xea7e('0x17'));var db=require('../../mysqldb')['db'];config[_0xea7e('0x18')]=_[_0xea7e('0x19')](config[_0xea7e('0x18')],{'host':_0xea7e('0x1a'),'port':0x18eb});var socket=require(_0xea7e('0x1b'))(new Redis(config[_0xea7e('0x18')]));require(_0xea7e('0x1c'))['register'](socket);function respondWithStatusCode(_0x269418,_0xbfebb0){_0xbfebb0=_0xbfebb0||0xcc;return function(_0x4881e0){if(_0x4881e0){return _0x269418['sendStatus'](_0xbfebb0);}return _0x269418[_0xea7e('0x1d')](_0xbfebb0)[_0xea7e('0x1e')]();};}function respondWithResult(_0x14fea9,_0x5b2661){_0x5b2661=_0x5b2661||0xc8;return function(_0x27fc7a){if(_0x27fc7a){return _0x14fea9[_0xea7e('0x1d')](_0x5b2661)['json'](_0x27fc7a);}};}function respondWithFilteredResult(_0xe9e38b,_0xb2da33){return function(_0x4ea52b){if(_0x4ea52b){var _0x2f3207=typeof _0xb2da33[_0xea7e('0x1f')]===_0xea7e('0x20')&&typeof _0xb2da33['limit']==='undefined';var _0x257c35=_0x4ea52b[_0xea7e('0x21')];var _0x21334d=_0x2f3207?0x0:_0xb2da33[_0xea7e('0x1f')];var _0xa0e5b0=_0x2f3207?_0x4ea52b[_0xea7e('0x21')]:_0xb2da33[_0xea7e('0x1f')]+_0xb2da33[_0xea7e('0x22')];var _0x5ddf7e;if(_0xa0e5b0>=_0x257c35){_0xa0e5b0=_0x257c35;_0x5ddf7e=0xc8;}else{_0x5ddf7e=0xce;}_0xe9e38b[_0xea7e('0x1d')](_0x5ddf7e);return _0xe9e38b[_0xea7e('0x23')](_0xea7e('0x24'),_0x21334d+'-'+_0xa0e5b0+'/'+_0x257c35)[_0xea7e('0x25')](_0x4ea52b);}return null;};}function patchUpdates(_0x44bf8b){return function(_0x105edb){try{jsonpatch[_0xea7e('0x26')](_0x105edb,_0x44bf8b,!![]);}catch(_0x43b2b9){return BPromise[_0xea7e('0x27')](_0x43b2b9);}return _0x105edb[_0xea7e('0x28')]();};}function saveUpdates(_0x330754,_0x39bba8){return function(_0x2e4ac9){if(_0x2e4ac9){return _0x2e4ac9[_0xea7e('0x29')](_0x330754)[_0xea7e('0x2a')](function(_0x284d6b){return _0x284d6b;});}return null;};}function removeEntity(_0x371a68,_0x409c34){return function(_0x2ec42f){if(_0x2ec42f){return _0x2ec42f[_0xea7e('0x2b')]()[_0xea7e('0x2a')](function(){_0x371a68[_0xea7e('0x1d')](0xcc)[_0xea7e('0x1e')]();});}};}function handleEntityNotFound(_0x8bf0d6,_0x5104d1){return function(_0x3405a7){if(!_0x3405a7){_0x8bf0d6[_0xea7e('0x2c')](0x194);}return _0x3405a7;};}function handleError(_0xf5d8,_0x420b7e){_0x420b7e=_0x420b7e||0x1f4;return function(_0x17c212){logger[_0xea7e('0x2d')](_0x17c212[_0xea7e('0x2e')]);if(_0x17c212[_0xea7e('0x2f')]){delete _0x17c212[_0xea7e('0x2f')];}_0xf5d8[_0xea7e('0x1d')](_0x420b7e)[_0xea7e('0x30')](_0x17c212);};}exports['index']=function(_0x25974b,_0x2ad0b3){var _0x12f4e0={},_0x3214ec={},_0x123e23={'count':0x0,'rows':[]};var _0x1a54ac=_[_0xea7e('0x31')](db[_0xea7e('0x32')]['rawAttributes'],function(_0x30ec98){return{'name':_0x30ec98[_0xea7e('0x33')],'type':_0x30ec98[_0xea7e('0x34')][_0xea7e('0x35')]};});_0x3214ec[_0xea7e('0x36')]=_['map'](_0x1a54ac,_0xea7e('0x2f'));_0x3214ec['query']=_[_0xea7e('0x37')](_0x25974b['query']);_0x3214ec['filters']=_[_0xea7e('0x38')](_0x3214ec[_0xea7e('0x36')],_0x3214ec[_0xea7e('0x39')]);_0x12f4e0[_0xea7e('0x3a')]=_['intersection'](_0x3214ec[_0xea7e('0x36')],qs[_0xea7e('0x3b')](_0x25974b[_0xea7e('0x39')][_0xea7e('0x3b')]));_0x12f4e0[_0xea7e('0x3a')]=_0x12f4e0['attributes'][_0xea7e('0x3c')]?_0x12f4e0[_0xea7e('0x3a')]:_0x3214ec[_0xea7e('0x36')];if(!_0x25974b['query']['hasOwnProperty'](_0xea7e('0x3d'))){_0x12f4e0[_0xea7e('0x22')]=qs[_0xea7e('0x22')](_0x25974b['query'][_0xea7e('0x22')]);_0x12f4e0['offset']=qs[_0xea7e('0x1f')](_0x25974b['query'][_0xea7e('0x1f')]);}_0x12f4e0[_0xea7e('0x3e')]=qs[_0xea7e('0x3f')](_0x25974b['query'][_0xea7e('0x3f')]);_0x12f4e0[_0xea7e('0x40')]=qs['filters'](_[_0xea7e('0x41')](_0x25974b[_0xea7e('0x39')],_0x3214ec['filters']),_0x1a54ac);if(_0x25974b['query']['filter']){_0x12f4e0[_0xea7e('0x40')]=_[_0xea7e('0x42')](_0x12f4e0[_0xea7e('0x40')],{'$or':_[_0xea7e('0x31')](_0x1a54ac,function(_0x432fe2){if(_0x432fe2['type']!=='VIRTUAL'){var _0x52ffff={};_0x52ffff[_0x432fe2['name']]={'$like':'%'+_0x25974b[_0xea7e('0x39')][_0xea7e('0x43')]+'%'};return _0x52ffff;}})});}_0x12f4e0=_['merge']({},_0x12f4e0,_0x25974b[_0xea7e('0x44')]);var _0x31ca22={'where':_0x12f4e0[_0xea7e('0x40')]};return db[_0xea7e('0x32')][_0xea7e('0x21')](_0x31ca22)[_0xea7e('0x2a')](function(_0x306803){_0x123e23[_0xea7e('0x21')]=_0x306803;if(_0x25974b[_0xea7e('0x39')][_0xea7e('0x45')]){_0x12f4e0[_0xea7e('0x46')]=[{'all':!![]}];}return db[_0xea7e('0x32')]['findAll'](_0x12f4e0);})[_0xea7e('0x2a')](function(_0x203b13){_0x123e23[_0xea7e('0x47')]=_0x203b13;return _0x123e23;})['then'](respondWithFilteredResult(_0x2ad0b3,_0x12f4e0))[_0xea7e('0x48')](handleError(_0x2ad0b3,null));};exports[_0xea7e('0x49')]=function(_0x5120d3,_0x3e10d9){var _0x193e9a={'raw':!![],'where':{'id':_0x5120d3[_0xea7e('0x4a')]['id']}},_0x4990dc={};_0x4990dc[_0xea7e('0x36')]=_[_0xea7e('0x37')](db[_0xea7e('0x32')]['rawAttributes']);_0x4990dc[_0xea7e('0x39')]=_['keys'](_0x5120d3[_0xea7e('0x39')]);_0x4990dc[_0xea7e('0x4b')]=_[_0xea7e('0x38')](_0x4990dc[_0xea7e('0x36')],_0x4990dc[_0xea7e('0x39')]);_0x193e9a[_0xea7e('0x3a')]=_[_0xea7e('0x38')](_0x4990dc['model'],qs[_0xea7e('0x3b')](_0x5120d3[_0xea7e('0x39')]['fields']));_0x193e9a[_0xea7e('0x3a')]=_0x193e9a[_0xea7e('0x3a')][_0xea7e('0x3c')]?_0x193e9a[_0xea7e('0x3a')]:_0x4990dc['model'];if(_0x5120d3[_0xea7e('0x39')][_0xea7e('0x45')]){_0x193e9a[_0xea7e('0x46')]=[{'all':!![]}];}_0x193e9a=_['merge']({},_0x193e9a,_0x5120d3[_0xea7e('0x44')]);return db[_0xea7e('0x32')][_0xea7e('0x4c')](_0x193e9a)[_0xea7e('0x2a')](handleEntityNotFound(_0x3e10d9,null))['then'](respondWithResult(_0x3e10d9,null))[_0xea7e('0x48')](handleError(_0x3e10d9,null));};exports['create']=function(_0x74ff2d,_0x4cdbb8){return db[_0xea7e('0x32')][_0xea7e('0x4d')](_0x74ff2d[_0xea7e('0x4e')],{})[_0xea7e('0x2a')](respondWithResult(_0x4cdbb8,0xc9))[_0xea7e('0x48')](handleError(_0x4cdbb8,null));};exports[_0xea7e('0x29')]=function(_0x1c786c,_0x4f1693){if(_0x1c786c[_0xea7e('0x4e')]['id']){delete _0x1c786c[_0xea7e('0x4e')]['id'];}return db[_0xea7e('0x32')][_0xea7e('0x4c')]({'where':{'id':_0x1c786c[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x4f1693,null))[_0xea7e('0x2a')](saveUpdates(_0x1c786c[_0xea7e('0x4e')],null))[_0xea7e('0x2a')](respondWithResult(_0x4f1693,null))[_0xea7e('0x48')](handleError(_0x4f1693,null));};exports[_0xea7e('0x2b')]=function(_0x9465bf,_0x1f6fe1){return db['ChatGroup'][_0xea7e('0x4c')]({'where':{'id':_0x9465bf[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x1f6fe1,null))[_0xea7e('0x2a')](removeEntity(_0x1f6fe1,null))[_0xea7e('0x48')](handleError(_0x1f6fe1,null));};exports['describe']=function(_0x266f4e,_0x551976){return db[_0xea7e('0x32')]['describe']()[_0xea7e('0x2a')](respondWithResult(_0x551976,null))[_0xea7e('0x48')](handleError(_0x551976,null));};exports['getUnread']=function(_0x3ed578,_0x5a0f35,_0x161b55){return db[_0xea7e('0x4f')][_0xea7e('0x21')]({'where':{'ChatGroupId':_0x3ed578[_0xea7e('0x4a')]['id'],'ToId':_0x3ed578['user']['id'],'read':![]}})[_0xea7e('0x2a')](function(_0x44c68b){return{'id':_[_0xea7e('0x50')](_0x3ed578['params']['id']),'count':_0x44c68b};})[_0xea7e('0x2a')](respondWithResult(_0x5a0f35,null))[_0xea7e('0x48')](handleError(_0x5a0f35,null));};exports['addMembers']=function(_0x4e1ebd,_0x15eca1,_0x12e767){return db[_0xea7e('0x32')][_0xea7e('0x4c')]({'where':{'id':_0x4e1ebd[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15eca1,null))['then'](function(_0x1ded86){if(_0x1ded86){return _0x1ded86[_0xea7e('0x51')](_0x4e1ebd[_0xea7e('0x4e')]['ids'],_['omit'](_0x4e1ebd[_0xea7e('0x4e')],[_0xea7e('0x52'),'id'])||{});}})['then'](respondWithResult(_0x15eca1,null))['catch'](handleError(_0x15eca1,null));};exports[_0xea7e('0x53')]=function(_0x58303e,_0x3614bb,_0x104fb6){var _0x3cd0a9={};var _0x1a228a={};var _0x5ed490;var _0x4863b3;return db[_0xea7e('0x32')][_0xea7e('0x54')]({'where':{'id':_0x58303e['params']['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x3614bb,null))['then'](function(_0x136313){if(_0x136313){_0x5ed490=_0x136313;_0x1a228a[_0xea7e('0x36')]=_['keys'](db['User'][_0xea7e('0x55')]);_0x1a228a['query']=_[_0xea7e('0x37')](_0x58303e['query']);_0x1a228a[_0xea7e('0x4b')]=_['intersection'](_0x1a228a['model'],_0x1a228a[_0xea7e('0x39')]);_0x3cd0a9[_0xea7e('0x3a')]=_['intersection'](_0x1a228a[_0xea7e('0x36')],qs[_0xea7e('0x3b')](_0x58303e[_0xea7e('0x39')]['fields']));_0x3cd0a9[_0xea7e('0x3a')]=_0x3cd0a9[_0xea7e('0x3a')]['length']?_0x3cd0a9['attributes']:_0x1a228a['model'];_0x3cd0a9[_0xea7e('0x3e')]=qs[_0xea7e('0x3f')](_0x58303e[_0xea7e('0x39')][_0xea7e('0x3f')]);_0x3cd0a9[_0xea7e('0x40')]=qs[_0xea7e('0x4b')](_['pick'](_0x58303e[_0xea7e('0x39')],_0x1a228a[_0xea7e('0x4b')]));if(_0x58303e['query'][_0xea7e('0x43')]){_0x3cd0a9['where']=_[_0xea7e('0x42')](_0x3cd0a9[_0xea7e('0x40')],{'$or':_[_0xea7e('0x31')](_0x3cd0a9[_0xea7e('0x3a')],function(_0x584e9f){var _0x155024={};_0x155024[_0x584e9f]={'$like':'%'+_0x58303e[_0xea7e('0x39')]['filter']+'%'};return _0x155024;})});}_0x3cd0a9=_['merge']({},_0x3cd0a9,_0x58303e['options']);return _0x5ed490[_0xea7e('0x53')](_0x3cd0a9);}})[_0xea7e('0x2a')](function(_0x35d29b){if(_0x35d29b){_0x4863b3=_0x35d29b[_0xea7e('0x3c')];if(!_0x58303e[_0xea7e('0x39')]['hasOwnProperty'](_0xea7e('0x3d'))){_0x3cd0a9['limit']=qs[_0xea7e('0x22')](_0x58303e[_0xea7e('0x39')][_0xea7e('0x22')]);_0x3cd0a9[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x58303e[_0xea7e('0x39')][_0xea7e('0x1f')]);}return _0x5ed490[_0xea7e('0x53')](_0x3cd0a9);}})[_0xea7e('0x2a')](function(_0x590eaa){if(_0x590eaa){return _0x590eaa?{'count':_0x4863b3,'rows':_0x590eaa}:null;}})[_0xea7e('0x2a')](respondWithResult(_0x3614bb,null))[_0xea7e('0x48')](handleError(_0x3614bb,null));};exports[_0xea7e('0x56')]=function(_0xa825de,_0x4136d4,_0x29d878){return db[_0xea7e('0x32')][_0xea7e('0x4c')]({'where':{'id':_0xa825de[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x4136d4,null))[_0xea7e('0x2a')](function(_0x2f9d8d){if(_0x2f9d8d){return _0x2f9d8d[_0xea7e('0x56')](_0xa825de[_0xea7e('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x4136d4,null))[_0xea7e('0x48')](handleError(_0x4136d4,null));};exports[_0xea7e('0x57')]=function(_0x120700,_0x547c0f,_0x219fb9){if(_0x120700[_0xea7e('0x4e')]['id']){delete _0x120700['body']['id'];}return db['ChatGroup'][_0xea7e('0x4c')]({'where':{'id':_0x120700['params']['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x547c0f,null))[_0xea7e('0x2a')](function(_0x52f355){if(_0x52f355){_0x120700[_0xea7e('0x4e')][_0xea7e('0x58')]=_0x52f355['id'];return db[_0xea7e('0x4f')][_0xea7e('0x4d')](_0x120700[_0xea7e('0x4e')]);}})[_0xea7e('0x2a')](respondWithResult(_0x547c0f,null))[_0xea7e('0x48')](handleError(_0x547c0f,null));};exports[_0xea7e('0x59')]=function(_0x2025ae,_0x305a23,_0x566a2f){var _0x1ae8f2={};var _0x631eff={};var _0x1632f1;var _0x15ea33;return db['ChatGroup'][_0xea7e('0x54')]({'where':{'id':_0x2025ae[_0xea7e('0x4a')]['id']}})[_0xea7e('0x2a')](handleEntityNotFound(_0x305a23,null))[_0xea7e('0x2a')](function(_0x47c84d){if(_0x47c84d){_0x1632f1=_0x47c84d;_0x631eff[_0xea7e('0x36')]=_[_0xea7e('0x37')](db['ChatInternalMessage'][_0xea7e('0x55')]);_0x631eff[_0xea7e('0x39')]=_[_0xea7e('0x37')](_0x2025ae[_0xea7e('0x39')]);_0x631eff[_0xea7e('0x4b')]=_[_0xea7e('0x38')](_0x631eff[_0xea7e('0x36')],_0x631eff['query']);_0x1ae8f2['attributes']=_[_0xea7e('0x38')](_0x631eff[_0xea7e('0x36')],qs[_0xea7e('0x3b')](_0x2025ae[_0xea7e('0x39')][_0xea7e('0x3b')]));_0x1ae8f2[_0xea7e('0x3a')]=_0x1ae8f2[_0xea7e('0x3a')][_0xea7e('0x3c')]?_0x1ae8f2[_0xea7e('0x3a')]:_0x631eff['model'];_0x1ae8f2[_0xea7e('0x3e')]=qs[_0xea7e('0x3f')](_0x2025ae[_0xea7e('0x39')]['sort']);_0x1ae8f2[_0xea7e('0x40')]=qs[_0xea7e('0x4b')](_[_0xea7e('0x41')](_0x2025ae['query'],_0x631eff[_0xea7e('0x4b')]));if(_0x2025ae['query'][_0xea7e('0x43')]){_0x1ae8f2[_0xea7e('0x40')]=_['merge'](_0x1ae8f2[_0xea7e('0x40')],{'$or':_['map'](_0x1ae8f2[_0xea7e('0x3a')],function(_0x480b27){var _0x20ea44={};_0x20ea44[_0x480b27]={'$like':'%'+_0x2025ae[_0xea7e('0x39')]['filter']+'%'};return _0x20ea44;})});}if(_0x2025ae['query'][_0xea7e('0x5a')]){var _0x41295b=_0x2025ae[_0xea7e('0x39')][_0xea7e('0x5a')][_0xea7e('0x5b')](',');var _0x2ddb34={};_0x2ddb34[_0x41295b[0x0]]={'$gte':moment(_0x41295b[0x1])[_0xea7e('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1ae8f2[_0xea7e('0x40')]=_[_0xea7e('0x42')](_0x1ae8f2['where'],_0x2ddb34);}_0x1ae8f2=_[_0xea7e('0x42')]({},_0x1ae8f2,_0x2025ae['options']);return _0x1632f1['getMessages'](_0x1ae8f2);}})['then'](function(_0x31c80f){if(_0x31c80f){_0x15ea33=_0x31c80f['length'];if(!_0x2025ae[_0xea7e('0x39')][_0xea7e('0x5d')]('nolimit')){_0x1ae8f2['limit']=qs['limit'](_0x2025ae['query'][_0xea7e('0x22')]);_0x1ae8f2['offset']=qs[_0xea7e('0x1f')](_0x2025ae['query'][_0xea7e('0x1f')]);}return _0x1632f1[_0xea7e('0x59')](_0x1ae8f2);}})[_0xea7e('0x2a')](function(_0x3cbd41){if(_0x3cbd41){return _0x3cbd41?{'count':_0x15ea33,'rows':_0x3cbd41}:null;}})[_0xea7e('0x2a')](respondWithResult(_0x305a23,null))[_0xea7e('0x48')](handleError(_0x305a23,null));}; \ No newline at end of file +var _0x28c7=['include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','getUnread','user','toInteger','addMembers','ids','getMembers','findOne','User','pick','removeMembers','addMessage','ChatInternalMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','getMessages','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ChatGroup','includeAll'];(function(_0x27c0f8,_0xd1bd2f){var _0x426b4e=function(_0x1d3f4b){while(--_0x1d3f4b){_0x27c0f8['push'](_0x27c0f8['shift']());}};_0x426b4e(++_0xd1bd2f);}(_0x28c7,0x7d));var _0x728c=function(_0x476350,_0x481037){_0x476350=_0x476350-0x0;var _0x452d18=_0x28c7[_0x476350];return _0x452d18;};'use strict';var emlformat=require(_0x728c('0x0'));var rimraf=require(_0x728c('0x1'));var zipdir=require(_0x728c('0x2'));var jsonpatch=require(_0x728c('0x3'));var rp=require(_0x728c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x728c('0x5'));var util=require(_0x728c('0x6'));var path=require(_0x728c('0x7'));var sox=require(_0x728c('0x8'));var csv=require(_0x728c('0x9'));var ejs=require(_0x728c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x728c('0xb'));var crypto=require(_0x728c('0xc'));var jsforce=require(_0x728c('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x728c('0x9'));var querystring=require('querystring');var Papa=require(_0x728c('0xe'));var Redis=require(_0x728c('0xf'));var authService=require(_0x728c('0x10'));var qs=require(_0x728c('0x11'));var as=require(_0x728c('0x12'));var hardwareService=require(_0x728c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x728c('0x14'));var config=require(_0x728c('0x15'));var licenseUtil=require(_0x728c('0x16'));var db=require(_0x728c('0x17'))['db'];config[_0x728c('0x18')]=_[_0x728c('0x19')](config[_0x728c('0x18')],{'host':_0x728c('0x1a'),'port':0x18eb});var socket=require(_0x728c('0x1b'))(new Redis(config['redis']));require(_0x728c('0x1c'))[_0x728c('0x1d')](socket);function respondWithStatusCode(_0x5ec169,_0x8afd0b){_0x8afd0b=_0x8afd0b||0xcc;return function(_0x4b5046){if(_0x4b5046){return _0x5ec169[_0x728c('0x1e')](_0x8afd0b);}return _0x5ec169[_0x728c('0x1f')](_0x8afd0b)[_0x728c('0x20')]();};}function respondWithResult(_0x11e97f,_0x8ab394){_0x8ab394=_0x8ab394||0xc8;return function(_0x2b621b){if(_0x2b621b){return _0x11e97f[_0x728c('0x1f')](_0x8ab394)['json'](_0x2b621b);}};}function respondWithFilteredResult(_0x594e64,_0x320b3d){return function(_0x2b18dc){if(_0x2b18dc){var _0x3cdf6b=typeof _0x320b3d[_0x728c('0x21')]===_0x728c('0x22')&&typeof _0x320b3d[_0x728c('0x23')]===_0x728c('0x22');var _0x38fb5c=_0x2b18dc[_0x728c('0x24')];var _0x1440f8=_0x3cdf6b?0x0:_0x320b3d[_0x728c('0x21')];var _0xc1a8e3=_0x3cdf6b?_0x2b18dc[_0x728c('0x24')]:_0x320b3d[_0x728c('0x21')]+_0x320b3d[_0x728c('0x23')];var _0x3178e6;if(_0xc1a8e3>=_0x38fb5c){_0xc1a8e3=_0x38fb5c;_0x3178e6=0xc8;}else{_0x3178e6=0xce;}_0x594e64['status'](_0x3178e6);return _0x594e64[_0x728c('0x25')]('Content-Range',_0x1440f8+'-'+_0xc1a8e3+'/'+_0x38fb5c)[_0x728c('0x26')](_0x2b18dc);}return null;};}function patchUpdates(_0x1a3b51){return function(_0x3a24c8){try{jsonpatch[_0x728c('0x27')](_0x3a24c8,_0x1a3b51,!![]);}catch(_0x48ec9b){return BPromise[_0x728c('0x28')](_0x48ec9b);}return _0x3a24c8[_0x728c('0x29')]();};}function saveUpdates(_0x504b2d,_0x35edd6){return function(_0x505c10){if(_0x505c10){return _0x505c10[_0x728c('0x2a')](_0x504b2d)[_0x728c('0x2b')](function(_0x42cf4f){return _0x42cf4f;});}return null;};}function removeEntity(_0x189ddc,_0x40bb3e){return function(_0x3a4645){if(_0x3a4645){return _0x3a4645[_0x728c('0x2c')]()[_0x728c('0x2b')](function(){_0x189ddc['status'](0xcc)[_0x728c('0x20')]();});}};}function handleEntityNotFound(_0x57a8d1,_0x38ea70){return function(_0x510e56){if(!_0x510e56){_0x57a8d1[_0x728c('0x1e')](0x194);}return _0x510e56;};}function handleError(_0x652ad1,_0x1347f4){_0x1347f4=_0x1347f4||0x1f4;return function(_0x4a8da7){logger[_0x728c('0x2d')](_0x4a8da7[_0x728c('0x2e')]);if(_0x4a8da7[_0x728c('0x2f')]){delete _0x4a8da7[_0x728c('0x2f')];}_0x652ad1['status'](_0x1347f4)[_0x728c('0x30')](_0x4a8da7);};}exports['index']=function(_0x21c7ef,_0x9dc0dd){var _0x49c6eb={},_0x11dc0d={},_0x2e9e9f={'count':0x0,'rows':[]};var _0x12c727=_['map'](db['ChatGroup']['rawAttributes'],function(_0xe340fc){return{'name':_0xe340fc[_0x728c('0x31')],'type':_0xe340fc[_0x728c('0x32')][_0x728c('0x33')]};});_0x11dc0d['model']=_[_0x728c('0x34')](_0x12c727,'name');_0x11dc0d['query']=_[_0x728c('0x35')](_0x21c7ef[_0x728c('0x36')]);_0x11dc0d[_0x728c('0x37')]=_[_0x728c('0x38')](_0x11dc0d[_0x728c('0x39')],_0x11dc0d[_0x728c('0x36')]);_0x49c6eb['attributes']=_[_0x728c('0x38')](_0x11dc0d[_0x728c('0x39')],qs[_0x728c('0x3a')](_0x21c7ef[_0x728c('0x36')][_0x728c('0x3a')]));_0x49c6eb[_0x728c('0x3b')]=_0x49c6eb['attributes'][_0x728c('0x3c')]?_0x49c6eb[_0x728c('0x3b')]:_0x11dc0d[_0x728c('0x39')];if(!_0x21c7ef[_0x728c('0x36')][_0x728c('0x3d')](_0x728c('0x3e'))){_0x49c6eb['limit']=qs[_0x728c('0x23')](_0x21c7ef[_0x728c('0x36')][_0x728c('0x23')]);_0x49c6eb[_0x728c('0x21')]=qs[_0x728c('0x21')](_0x21c7ef[_0x728c('0x36')][_0x728c('0x21')]);}_0x49c6eb[_0x728c('0x3f')]=qs[_0x728c('0x40')](_0x21c7ef[_0x728c('0x36')]['sort']);_0x49c6eb[_0x728c('0x41')]=qs['filters'](_['pick'](_0x21c7ef['query'],_0x11dc0d['filters']),_0x12c727);if(_0x21c7ef[_0x728c('0x36')][_0x728c('0x42')]){_0x49c6eb[_0x728c('0x41')]=_[_0x728c('0x43')](_0x49c6eb[_0x728c('0x41')],{'$or':_[_0x728c('0x34')](_0x12c727,function(_0x12e445){if(_0x12e445[_0x728c('0x32')]!=='VIRTUAL'){var _0x38c7d9={};_0x38c7d9[_0x12e445[_0x728c('0x2f')]]={'$like':'%'+_0x21c7ef[_0x728c('0x36')][_0x728c('0x42')]+'%'};return _0x38c7d9;}})});}_0x49c6eb=_[_0x728c('0x43')]({},_0x49c6eb,_0x21c7ef[_0x728c('0x44')]);var _0x42c751={'where':_0x49c6eb[_0x728c('0x41')]};return db[_0x728c('0x45')][_0x728c('0x24')](_0x42c751)[_0x728c('0x2b')](function(_0x128b78){_0x2e9e9f[_0x728c('0x24')]=_0x128b78;if(_0x21c7ef[_0x728c('0x36')][_0x728c('0x46')]){_0x49c6eb[_0x728c('0x47')]=[{'all':!![]}];}return db[_0x728c('0x45')][_0x728c('0x48')](_0x49c6eb);})[_0x728c('0x2b')](function(_0x44259d){_0x2e9e9f[_0x728c('0x49')]=_0x44259d;return _0x2e9e9f;})[_0x728c('0x2b')](respondWithFilteredResult(_0x9dc0dd,_0x49c6eb))[_0x728c('0x4a')](handleError(_0x9dc0dd,null));};exports['show']=function(_0x1fd311,_0x6e83c0){var _0x1ba3c4={'raw':!![],'where':{'id':_0x1fd311[_0x728c('0x4b')]['id']}},_0x3a9a9a={};_0x3a9a9a['model']=_[_0x728c('0x35')](db[_0x728c('0x45')][_0x728c('0x4c')]);_0x3a9a9a[_0x728c('0x36')]=_[_0x728c('0x35')](_0x1fd311[_0x728c('0x36')]);_0x3a9a9a[_0x728c('0x37')]=_[_0x728c('0x38')](_0x3a9a9a[_0x728c('0x39')],_0x3a9a9a['query']);_0x1ba3c4[_0x728c('0x3b')]=_[_0x728c('0x38')](_0x3a9a9a[_0x728c('0x39')],qs[_0x728c('0x3a')](_0x1fd311[_0x728c('0x36')]['fields']));_0x1ba3c4[_0x728c('0x3b')]=_0x1ba3c4[_0x728c('0x3b')]['length']?_0x1ba3c4['attributes']:_0x3a9a9a[_0x728c('0x39')];if(_0x1fd311[_0x728c('0x36')]['includeAll']){_0x1ba3c4[_0x728c('0x47')]=[{'all':!![]}];}_0x1ba3c4=_[_0x728c('0x43')]({},_0x1ba3c4,_0x1fd311[_0x728c('0x44')]);return db[_0x728c('0x45')][_0x728c('0x4d')](_0x1ba3c4)['then'](handleEntityNotFound(_0x6e83c0,null))['then'](respondWithResult(_0x6e83c0,null))[_0x728c('0x4a')](handleError(_0x6e83c0,null));};exports[_0x728c('0x4e')]=function(_0x6a39a5,_0x3dec30){return db[_0x728c('0x45')]['create'](_0x6a39a5[_0x728c('0x4f')],{})[_0x728c('0x2b')](respondWithResult(_0x3dec30,0xc9))[_0x728c('0x4a')](handleError(_0x3dec30,null));};exports[_0x728c('0x2a')]=function(_0x2c2709,_0x2431e0){if(_0x2c2709[_0x728c('0x4f')]['id']){delete _0x2c2709[_0x728c('0x4f')]['id'];}return db[_0x728c('0x45')][_0x728c('0x4d')]({'where':{'id':_0x2c2709[_0x728c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2431e0,null))[_0x728c('0x2b')](saveUpdates(_0x2c2709['body'],null))[_0x728c('0x2b')](respondWithResult(_0x2431e0,null))[_0x728c('0x4a')](handleError(_0x2431e0,null));};exports[_0x728c('0x2c')]=function(_0x9e7300,_0x509cf1){return db['ChatGroup'][_0x728c('0x4d')]({'where':{'id':_0x9e7300[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x509cf1,null))[_0x728c('0x2b')](removeEntity(_0x509cf1,null))[_0x728c('0x4a')](handleError(_0x509cf1,null));};exports['describe']=function(_0x277764,_0x2a1e04){return db[_0x728c('0x45')][_0x728c('0x50')]()[_0x728c('0x2b')](respondWithResult(_0x2a1e04,null))[_0x728c('0x4a')](handleError(_0x2a1e04,null));};exports[_0x728c('0x51')]=function(_0x48630d,_0x4621c9,_0x2fda2e){return db['ChatInternalMessage']['count']({'where':{'ChatGroupId':_0x48630d['params']['id'],'ToId':_0x48630d[_0x728c('0x52')]['id'],'read':![]}})[_0x728c('0x2b')](function(_0x20bc46){return{'id':_[_0x728c('0x53')](_0x48630d['params']['id']),'count':_0x20bc46};})['then'](respondWithResult(_0x4621c9,null))['catch'](handleError(_0x4621c9,null));};exports[_0x728c('0x54')]=function(_0x591d64,_0x38e45a,_0x12e3a3){return db['ChatGroup'][_0x728c('0x4d')]({'where':{'id':_0x591d64[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x38e45a,null))[_0x728c('0x2b')](function(_0x8ef293){if(_0x8ef293){return _0x8ef293[_0x728c('0x54')](_0x591d64[_0x728c('0x4f')]['ids'],_['omit'](_0x591d64[_0x728c('0x4f')],[_0x728c('0x55'),'id'])||{});}})[_0x728c('0x2b')](respondWithResult(_0x38e45a,null))[_0x728c('0x4a')](handleError(_0x38e45a,null));};exports[_0x728c('0x56')]=function(_0x3caec6,_0x2acc95,_0x2dbd2b){var _0x197beb={};var _0x45ee62={};var _0x5e772b;var _0x5f29da;return db[_0x728c('0x45')][_0x728c('0x57')]({'where':{'id':_0x3caec6[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x2acc95,null))[_0x728c('0x2b')](function(_0x2fe8cd){if(_0x2fe8cd){_0x5e772b=_0x2fe8cd;_0x45ee62[_0x728c('0x39')]=_[_0x728c('0x35')](db[_0x728c('0x58')][_0x728c('0x4c')]);_0x45ee62['query']=_[_0x728c('0x35')](_0x3caec6[_0x728c('0x36')]);_0x45ee62[_0x728c('0x37')]=_[_0x728c('0x38')](_0x45ee62['model'],_0x45ee62[_0x728c('0x36')]);_0x197beb[_0x728c('0x3b')]=_[_0x728c('0x38')](_0x45ee62[_0x728c('0x39')],qs[_0x728c('0x3a')](_0x3caec6[_0x728c('0x36')][_0x728c('0x3a')]));_0x197beb[_0x728c('0x3b')]=_0x197beb['attributes'][_0x728c('0x3c')]?_0x197beb[_0x728c('0x3b')]:_0x45ee62[_0x728c('0x39')];_0x197beb[_0x728c('0x3f')]=qs['sort'](_0x3caec6[_0x728c('0x36')][_0x728c('0x40')]);_0x197beb[_0x728c('0x41')]=qs[_0x728c('0x37')](_[_0x728c('0x59')](_0x3caec6['query'],_0x45ee62[_0x728c('0x37')]));if(_0x3caec6[_0x728c('0x36')][_0x728c('0x42')]){_0x197beb[_0x728c('0x41')]=_[_0x728c('0x43')](_0x197beb[_0x728c('0x41')],{'$or':_[_0x728c('0x34')](_0x197beb[_0x728c('0x3b')],function(_0x4d047e){var _0x4b899b={};_0x4b899b[_0x4d047e]={'$like':'%'+_0x3caec6[_0x728c('0x36')][_0x728c('0x42')]+'%'};return _0x4b899b;})});}_0x197beb=_[_0x728c('0x43')]({},_0x197beb,_0x3caec6[_0x728c('0x44')]);return _0x5e772b[_0x728c('0x56')](_0x197beb);}})[_0x728c('0x2b')](function(_0x108adf){if(_0x108adf){_0x5f29da=_0x108adf['length'];if(!_0x3caec6[_0x728c('0x36')]['hasOwnProperty'](_0x728c('0x3e'))){_0x197beb[_0x728c('0x23')]=qs['limit'](_0x3caec6[_0x728c('0x36')][_0x728c('0x23')]);_0x197beb[_0x728c('0x21')]=qs['offset'](_0x3caec6[_0x728c('0x36')][_0x728c('0x21')]);}return _0x5e772b[_0x728c('0x56')](_0x197beb);}})[_0x728c('0x2b')](function(_0x5ce0ca){if(_0x5ce0ca){return _0x5ce0ca?{'count':_0x5f29da,'rows':_0x5ce0ca}:null;}})['then'](respondWithResult(_0x2acc95,null))[_0x728c('0x4a')](handleError(_0x2acc95,null));};exports[_0x728c('0x5a')]=function(_0x3f6cf,_0x4dbd70,_0x447601){return db['ChatGroup'][_0x728c('0x4d')]({'where':{'id':_0x3f6cf[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x4dbd70,null))[_0x728c('0x2b')](function(_0x14889b){if(_0x14889b){return _0x14889b['removeMembers'](_0x3f6cf[_0x728c('0x36')][_0x728c('0x55')]);}})[_0x728c('0x2b')](respondWithStatusCode(_0x4dbd70,null))[_0x728c('0x4a')](handleError(_0x4dbd70,null));};exports[_0x728c('0x5b')]=function(_0x4f6be0,_0x511cae,_0x275e67){if(_0x4f6be0[_0x728c('0x4f')]['id']){delete _0x4f6be0['body']['id'];}return db[_0x728c('0x45')][_0x728c('0x4d')]({'where':{'id':_0x4f6be0[_0x728c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x511cae,null))[_0x728c('0x2b')](function(_0x21dd0b){if(_0x21dd0b){_0x4f6be0[_0x728c('0x4f')]['ChatGroupId']=_0x21dd0b['id'];return db[_0x728c('0x5c')][_0x728c('0x4e')](_0x4f6be0[_0x728c('0x4f')]);}})[_0x728c('0x2b')](respondWithResult(_0x511cae,null))['catch'](handleError(_0x511cae,null));};exports['getMessages']=function(_0x59f627,_0x25a662,_0x16e3c1){var _0x4d1a48={};var _0x33dd0c={};var _0x4d2ac5;var _0x4484b3;return db['ChatGroup'][_0x728c('0x57')]({'where':{'id':_0x59f627[_0x728c('0x4b')]['id']}})[_0x728c('0x2b')](handleEntityNotFound(_0x25a662,null))[_0x728c('0x2b')](function(_0x1a78bf){if(_0x1a78bf){_0x4d2ac5=_0x1a78bf;_0x33dd0c[_0x728c('0x39')]=_['keys'](db['ChatInternalMessage'][_0x728c('0x4c')]);_0x33dd0c[_0x728c('0x36')]=_[_0x728c('0x35')](_0x59f627[_0x728c('0x36')]);_0x33dd0c[_0x728c('0x37')]=_[_0x728c('0x38')](_0x33dd0c[_0x728c('0x39')],_0x33dd0c[_0x728c('0x36')]);_0x4d1a48[_0x728c('0x3b')]=_['intersection'](_0x33dd0c[_0x728c('0x39')],qs['fields'](_0x59f627[_0x728c('0x36')][_0x728c('0x3a')]));_0x4d1a48[_0x728c('0x3b')]=_0x4d1a48['attributes'][_0x728c('0x3c')]?_0x4d1a48[_0x728c('0x3b')]:_0x33dd0c[_0x728c('0x39')];_0x4d1a48[_0x728c('0x3f')]=qs['sort'](_0x59f627['query'][_0x728c('0x40')]);_0x4d1a48[_0x728c('0x41')]=qs['filters'](_['pick'](_0x59f627['query'],_0x33dd0c[_0x728c('0x37')]));if(_0x59f627[_0x728c('0x36')][_0x728c('0x42')]){_0x4d1a48[_0x728c('0x41')]=_[_0x728c('0x43')](_0x4d1a48['where'],{'$or':_[_0x728c('0x34')](_0x4d1a48[_0x728c('0x3b')],function(_0x418d2d){var _0x496fda={};_0x496fda[_0x418d2d]={'$like':'%'+_0x59f627[_0x728c('0x36')][_0x728c('0x42')]+'%'};return _0x496fda;})});}if(_0x59f627[_0x728c('0x36')][_0x728c('0x5d')]){var _0x5e3af5=_0x59f627[_0x728c('0x36')][_0x728c('0x5d')][_0x728c('0x5e')](',');var _0x15aafa={};_0x15aafa[_0x5e3af5[0x0]]={'$gte':moment(_0x5e3af5[0x1])[_0x728c('0x5f')](_0x728c('0x60'))};_0x4d1a48[_0x728c('0x41')]=_[_0x728c('0x43')](_0x4d1a48[_0x728c('0x41')],_0x15aafa);}_0x4d1a48=_[_0x728c('0x43')]({},_0x4d1a48,_0x59f627[_0x728c('0x44')]);return _0x4d2ac5[_0x728c('0x61')](_0x4d1a48);}})[_0x728c('0x2b')](function(_0xc795b2){if(_0xc795b2){_0x4484b3=_0xc795b2[_0x728c('0x3c')];if(!_0x59f627[_0x728c('0x36')][_0x728c('0x3d')](_0x728c('0x3e'))){_0x4d1a48[_0x728c('0x23')]=qs[_0x728c('0x23')](_0x59f627[_0x728c('0x36')][_0x728c('0x23')]);_0x4d1a48[_0x728c('0x21')]=qs[_0x728c('0x21')](_0x59f627[_0x728c('0x36')][_0x728c('0x21')]);}return _0x4d2ac5['getMessages'](_0x4d1a48);}})['then'](function(_0x19a3d2){if(_0x19a3d2){return _0x19a3d2?{'count':_0x4484b3,'rows':_0x19a3d2}:null;}})[_0x728c('0x2b')](respondWithResult(_0x25a662,null))[_0x728c('0x4a')](handleError(_0x25a662,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 484ed01..e855f55 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 _0x0b79=['hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x15eb1a,_0x16dc02){var _0x1e7205=function(_0x32fad8){while(--_0x32fad8){_0x15eb1a['push'](_0x15eb1a['shift']());}};_0x1e7205(++_0x16dc02);}(_0x0b79,0xad));var _0x90b7=function(_0xc85b17,_0x2b981f){_0xc85b17=_0xc85b17-0x0;var _0x490ef8=_0x0b79[_0xc85b17];return _0x490ef8;};'use strict';var EventEmitter=require(_0x90b7('0x0'));var ChatGroup=require(_0x90b7('0x1'))['db'][_0x90b7('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x90b7('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x90b7('0x4'),'afterDestroy':_0x90b7('0x5')};function emitEvent(_0x497698){return function(_0xd3671f,_0x4cd6c5,_0xd50b1b){ChatGroupEvents[_0x90b7('0x6')](_0x497698+':'+_0xd3671f['id'],_0xd3671f);ChatGroupEvents[_0x90b7('0x6')](_0x497698,_0xd3671f);_0xd50b1b(null);};}for(var e in events){if(events[_0x90b7('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x90b7('0x8')]=ChatGroupEvents; \ No newline at end of file +var _0xfba2=['exports','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x1c5896,_0x34e0b1){var _0x91aaff=function(_0x2f05bf){while(--_0x2f05bf){_0x1c5896['push'](_0x1c5896['shift']());}};_0x91aaff(++_0x34e0b1);}(_0xfba2,0xf9));var _0x2fba=function(_0x1d751f,_0xcac928){_0x1d751f=_0x1d751f-0x0;var _0x162d5f=_0xfba2[_0x1d751f];return _0x162d5f;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x2fba('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x2fba('0x1')](0x0);var events={'afterCreate':_0x2fba('0x2'),'afterUpdate':_0x2fba('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2db851){return function(_0x3eef22,_0x233e9c,_0x16c6ed){ChatGroupEvents[_0x2fba('0x4')](_0x2db851+':'+_0x3eef22['id'],_0x3eef22);ChatGroupEvents['emit'](_0x2db851,_0x3eef22);_0x16c6ed(null);};}for(var e in events){if(events[_0x2fba('0x5')](e)){var event=events[e];ChatGroup[_0x2fba('0x6')](e,emitEvent(event));}}module[_0x2fba('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 d03dd2c..1fae7cb 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 _0x7855=['request-promise','path','./chatGroup.attributes','define','ChatGroup','util','../../config/logger','api','moment','bluebird'];(function(_0xc7f728,_0x4d812f){var _0x3a6dc5=function(_0x8615cd){while(--_0x8615cd){_0xc7f728['push'](_0xc7f728['shift']());}};_0x3a6dc5(++_0x4d812f);}(_0x7855,0x1c7));var _0x5785=function(_0x453c99,_0x4a0d59){_0x453c99=_0x453c99-0x0;var _0x3dc60b=_0x7855[_0x453c99];return _0x3dc60b;};'use strict';var _=require('lodash');var util=require(_0x5785('0x0'));var logger=require(_0x5785('0x1'))(_0x5785('0x2'));var moment=require(_0x5785('0x3'));var BPromise=require(_0x5785('0x4'));var rp=require(_0x5785('0x5'));var fs=require('fs');var path=require(_0x5785('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5785('0x7'));module['exports']=function(_0x483743,_0x2df770){return _0x483743[_0x5785('0x8')](_0x5785('0x9'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfa2b=['moment','bluebird','request-promise','path','rimraf','exports','ChatGroup','lodash','util','../../config/logger','api'];(function(_0x165ec6,_0x2d6664){var _0x3c475a=function(_0x4ebfdd){while(--_0x4ebfdd){_0x165ec6['push'](_0x165ec6['shift']());}};_0x3c475a(++_0x2d6664);}(_0xfa2b,0x1ca));var _0xbfa2=function(_0x3b0bb4,_0x32a3ac){_0x3b0bb4=_0x3b0bb4-0x0;var _0x57e927=_0xfa2b[_0x3b0bb4];return _0x57e927;};'use strict';var _=require(_0xbfa2('0x0'));var util=require(_0xbfa2('0x1'));var logger=require(_0xbfa2('0x2'))(_0xbfa2('0x3'));var moment=require(_0xbfa2('0x4'));var BPromise=require(_0xbfa2('0x5'));var rp=require(_0xbfa2('0x6'));var fs=require('fs');var path=require(_0xbfa2('0x7'));var rimraf=require(_0xbfa2('0x8'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0xbfa2('0x9')]=function(_0x2fdd37,_0x39f154){return _0x2fdd37['define'](_0xbfa2('0xa'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 2da4c14..3447f31 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 _0x20ce=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','request','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x409353,_0xe9f04d){var _0x4f4b59=function(_0x64b587){while(--_0x64b587){_0x409353['push'](_0x409353['shift']());}};_0x4f4b59(++_0xe9f04d);}(_0x20ce,0x10d));var _0xe20c=function(_0x45fa95,_0x308dd6){_0x45fa95=_0x45fa95-0x0;var _0x414317=_0x20ce[_0x45fa95];return _0x414317;};'use strict';var _=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var moment=require(_0xe20c('0x2'));var BPromise=require('bluebird');var rs=require(_0xe20c('0x3'));var fs=require('fs');var Redis=require(_0xe20c('0x4'));var db=require(_0xe20c('0x5'))['db'];var utils=require(_0xe20c('0x6'));var logger=require(_0xe20c('0x7'))(_0xe20c('0x8'));var config=require(_0xe20c('0x9'));var jayson=require(_0xe20c('0xa'));var client=jayson[_0xe20c('0xb')][_0xe20c('0xc')]({'port':0x232a});config[_0xe20c('0xd')]=_[_0xe20c('0xe')](config[_0xe20c('0xd')],{'host':_0xe20c('0xf'),'port':0x18eb});var socket=require(_0xe20c('0x10'))(new Redis(config[_0xe20c('0xd')]));require(_0xe20c('0x11'))[_0xe20c('0x12')](socket);function respondWithRpcPromise(_0x41379b,_0x16aaaa,_0xb46255){return new BPromise(function(_0x17ecc8,_0x4517d7){return client[_0xe20c('0x13')](_0x41379b,_0xb46255)['then'](function(_0x201b08){logger[_0xe20c('0x14')](_0xe20c('0x15'),_0x16aaaa,_0xe20c('0x16'));logger[_0xe20c('0x17')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x16aaaa,_0xe20c('0x16'),JSON[_0xe20c('0x18')](_0x201b08));if(_0x201b08['error']){if(_0x201b08[_0xe20c('0x19')][_0xe20c('0x1a')]===0x1f4){logger[_0xe20c('0x19')]('ChatGroup,\x20%s,\x20%s',_0x16aaaa,_0x201b08[_0xe20c('0x19')][_0xe20c('0x1b')]);return _0x4517d7(_0x201b08[_0xe20c('0x19')][_0xe20c('0x1b')]);}logger['error'](_0xe20c('0x15'),_0x16aaaa,_0x201b08['error'][_0xe20c('0x1b')]);return _0x17ecc8(_0x201b08[_0xe20c('0x19')][_0xe20c('0x1b')]);}else{logger[_0xe20c('0x14')](_0xe20c('0x15'),_0x16aaaa,_0xe20c('0x16'));_0x17ecc8(_0x201b08[_0xe20c('0x1c')][_0xe20c('0x1b')]);}})[_0xe20c('0x1d')](function(_0x3768b0){logger['error'](_0xe20c('0x15'),_0x16aaaa,_0x3768b0);_0x4517d7(_0x3768b0);});});} \ No newline at end of file +var _0x3204=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','ChatGroup,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0xc844cd,_0x1d55f8){var _0xb85fc7=function(_0xb0b367){while(--_0xb0b367){_0xc844cd['push'](_0xc844cd['shift']());}};_0xb85fc7(++_0x1d55f8);}(_0x3204,0x12e));var _0x4320=function(_0x43a8ff,_0x28ee24){_0x43a8ff=_0x43a8ff-0x0;var _0x44558b=_0x3204[_0x43a8ff];return _0x44558b;};'use strict';var _=require(_0x4320('0x0'));var util=require(_0x4320('0x1'));var moment=require(_0x4320('0x2'));var BPromise=require(_0x4320('0x3'));var rs=require(_0x4320('0x4'));var fs=require('fs');var Redis=require(_0x4320('0x5'));var db=require(_0x4320('0x6'))['db'];var utils=require(_0x4320('0x7'));var logger=require(_0x4320('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4320('0x9'));var client=jayson[_0x4320('0xa')][_0x4320('0xb')]({'port':0x232a});config[_0x4320('0xc')]=_[_0x4320('0xd')](config[_0x4320('0xc')],{'host':_0x4320('0xe'),'port':0x18eb});var socket=require(_0x4320('0xf'))(new Redis(config[_0x4320('0xc')]));require('./chatGroup.socket')[_0x4320('0x10')](socket);function respondWithRpcPromise(_0x2b8f99,_0x33a378,_0x245419){return new BPromise(function(_0x5142c8,_0x3cc8cd){return client[_0x4320('0x11')](_0x2b8f99,_0x245419)['then'](function(_0x505b60){logger['info'](_0x4320('0x12'),_0x33a378,_0x4320('0x13'));logger['debug']('ChatGroup,\x20%s,\x20%s,\x20%s',_0x33a378,_0x4320('0x13'),JSON[_0x4320('0x14')](_0x505b60));if(_0x505b60[_0x4320('0x15')]){if(_0x505b60[_0x4320('0x15')][_0x4320('0x16')]===0x1f4){logger[_0x4320('0x15')]('ChatGroup,\x20%s,\x20%s',_0x33a378,_0x505b60['error'][_0x4320('0x17')]);return _0x3cc8cd(_0x505b60[_0x4320('0x15')][_0x4320('0x17')]);}logger['error']('ChatGroup,\x20%s,\x20%s',_0x33a378,_0x505b60['error'][_0x4320('0x17')]);return _0x5142c8(_0x505b60[_0x4320('0x15')][_0x4320('0x17')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x33a378,_0x4320('0x13'));_0x5142c8(_0x505b60[_0x4320('0x18')][_0x4320('0x17')]);}})['catch'](function(_0x436e6d){logger['error'](_0x4320('0x12'),_0x33a378,_0x436e6d);_0x3cc8cd(_0x436e6d);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index ac5f9c4..b9fdd2d 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 _0x37c6=['chatGroup:','./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x1c47e4,_0x86ec7a){var _0x16e15a=function(_0x4663cb){while(--_0x4663cb){_0x1c47e4['push'](_0x1c47e4['shift']());}};_0x16e15a(++_0x86ec7a);}(_0x37c6,0x109));var _0x637c=function(_0x139994,_0x57f3bb){_0x139994=_0x139994-0x0;var _0x40898b=_0x37c6[_0x139994];return _0x40898b;};'use strict';var ChatGroupEvents=require(_0x637c('0x0'));var events=[_0x637c('0x1'),_0x637c('0x2'),_0x637c('0x3')];function createListener(_0x3500ef,_0x52dfde){return function(_0x227182){_0x52dfde[_0x637c('0x4')](_0x3500ef,_0x227182);};}function removeListener(_0x3fd066,_0x319e60){return function(){ChatGroupEvents[_0x637c('0x5')](_0x3fd066,_0x319e60);};}exports[_0x637c('0x6')]=function(_0x3486a5){for(var _0x5f546a=0x0,_0xf638c9=events['length'];_0x5f546a<_0xf638c9;_0x5f546a++){var _0x5d718c=events[_0x5f546a];var _0x4dde1f=createListener(_0x637c('0x7')+_0x5d718c,_0x3486a5);ChatGroupEvents['on'](_0x5d718c,_0x4dde1f);}}; \ No newline at end of file +var _0x156d=['./chatGroup.events','save','remove','update','register','length','chatGroup:'];(function(_0xd3b64b,_0x189e4a){var _0x4d24ab=function(_0x9efedf){while(--_0x9efedf){_0xd3b64b['push'](_0xd3b64b['shift']());}};_0x4d24ab(++_0x189e4a);}(_0x156d,0x1c0));var _0xd156=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x156d[_0x4b369d];return _0x571a98;};'use strict';var ChatGroupEvents=require(_0xd156('0x0'));var events=[_0xd156('0x1'),_0xd156('0x2'),_0xd156('0x3')];function createListener(_0xec20ea,_0x256dd3){return function(_0x4b7a40){_0x256dd3['emit'](_0xec20ea,_0x4b7a40);};}function removeListener(_0xeed629,_0x3280a8){return function(){ChatGroupEvents['removeListener'](_0xeed629,_0x3280a8);};}exports[_0xd156('0x4')]=function(_0x5ce1d6){for(var _0x157a77=0x0,_0x258561=events[_0xd156('0x5')];_0x157a77<_0x258561;_0x157a77++){var _0x23ed99=events[_0x157a77];var _0x44cc2b=createListener(_0xd156('0x6')+_0x23ed99,_0x5ce1d6);ChatGroupEvents['on'](_0x23ed99,_0x44cc2b);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 55d50d7..1072bb8 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 _0xac4d=['get','/:id','show','/:id/unread','/:id/members','getMembers','/:id/messages','getMessages','create','post','addMembers','put','update','delete','destroy','removeMembers','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','index','/describe','isAuthenticated'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xac4d,0x104));var _0xdac4=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xac4d[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0xdac4('0x0'));var util=require('util');var path=require(_0xdac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xdac4('0x2'));var router=express['Router']();var fs_extra=require(_0xdac4('0x3'));var auth=require(_0xdac4('0x4'));var interaction=require(_0xdac4('0x5'));var config=require('../../config/environment');var controller=require(_0xdac4('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xdac4('0x7')]);router['get'](_0xdac4('0x8'),auth[_0xdac4('0x9')](),controller['describe']);router[_0xdac4('0xa')](_0xdac4('0xb'),auth[_0xdac4('0x9')](),controller[_0xdac4('0xc')]);router['get'](_0xdac4('0xd'),auth['isAuthenticated'](),controller['getUnread']);router[_0xdac4('0xa')](_0xdac4('0xe'),auth[_0xdac4('0x9')](),controller[_0xdac4('0xf')]);router['get'](_0xdac4('0x10'),auth['isAuthenticated'](),controller[_0xdac4('0x11')]);router['post']('/',auth[_0xdac4('0x9')](),controller[_0xdac4('0x12')]);router[_0xdac4('0x13')]('/:id/members',auth[_0xdac4('0x9')](),controller[_0xdac4('0x14')]);router[_0xdac4('0x13')](_0xdac4('0x10'),auth[_0xdac4('0x9')](),controller['addMessage']);router[_0xdac4('0x15')](_0xdac4('0xb'),auth[_0xdac4('0x9')](),controller[_0xdac4('0x16')]);router[_0xdac4('0x17')]('/:id',auth[_0xdac4('0x9')](),controller[_0xdac4('0x18')]);router[_0xdac4('0x17')]('/:id/members',auth[_0xdac4('0x9')](),controller[_0xdac4('0x19')]);module[_0xdac4('0x1a')]=router; \ No newline at end of file +var _0x47f7=['./chatGroup.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/unread','getUnread','/:id/members','/:id/messages','post','create','addMembers','put','update','delete','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2efd54,_0x241172){var _0x3f923e=function(_0x3cfd1d){while(--_0x3cfd1d){_0x2efd54['push'](_0x2efd54['shift']());}};_0x3f923e(++_0x241172);}(_0x47f7,0x17f));var _0x747f=function(_0x36ac6b,_0x5eba33){_0x36ac6b=_0x36ac6b-0x0;var _0x3068db=_0x47f7[_0x36ac6b];return _0x3068db;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x747f('0x0'));var timeout=require(_0x747f('0x1'));var express=require(_0x747f('0x2'));var router=express[_0x747f('0x3')]();var fs_extra=require(_0x747f('0x4'));var auth=require(_0x747f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x747f('0x6'));var controller=require(_0x747f('0x7'));router[_0x747f('0x8')]('/',auth[_0x747f('0x9')](),controller['index']);router[_0x747f('0x8')](_0x747f('0xa'),auth[_0x747f('0x9')](),controller[_0x747f('0xb')]);router[_0x747f('0x8')](_0x747f('0xc'),auth[_0x747f('0x9')](),controller[_0x747f('0xd')]);router[_0x747f('0x8')](_0x747f('0xe'),auth[_0x747f('0x9')](),controller[_0x747f('0xf')]);router[_0x747f('0x8')](_0x747f('0x10'),auth[_0x747f('0x9')](),controller['getMembers']);router[_0x747f('0x8')](_0x747f('0x11'),auth[_0x747f('0x9')](),controller['getMessages']);router[_0x747f('0x12')]('/',auth[_0x747f('0x9')](),controller[_0x747f('0x13')]);router[_0x747f('0x12')](_0x747f('0x10'),auth[_0x747f('0x9')](),controller[_0x747f('0x14')]);router[_0x747f('0x12')](_0x747f('0x11'),auth[_0x747f('0x9')](),controller['addMessage']);router[_0x747f('0x15')](_0x747f('0xc'),auth['isAuthenticated'](),controller[_0x747f('0x16')]);router[_0x747f('0x17')](_0x747f('0xc'),auth['isAuthenticated'](),controller['destroy']);router['delete']('/:id/members',auth[_0x747f('0x9')](),controller[_0x747f('0x18')]);module[_0x747f('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index b36a988..2001151 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 _0x421c=['TEXT','STRING','DATE','long','out','BOOLEAN','INTEGER','ENUM','star','thumb'];(function(_0x1f62c2,_0x3977a6){var _0x302a55=function(_0x53ab47){while(--_0x53ab47){_0x1f62c2['push'](_0x1f62c2['shift']());}};_0x302a55(++_0x3977a6);}(_0x421c,0x1bd));var _0xc421=function(_0x2e6428,_0x37e95e){_0x2e6428=_0x2e6428-0x0;var _0x1e0ee7=_0x421c[_0x2e6428];return _0x1e0ee7;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xc421('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xc421('0x1')]},'ratingType':{'type':Sequelize[_0xc421('0x2')](_0xc421('0x3'),_0xc421('0x4')),'defaultValue':_0xc421('0x3')},'ratingMessage':{'type':Sequelize[_0xc421('0x5')]},'pathTranscript':{'type':Sequelize[_0xc421('0x5')]},'mailTranscript':{'type':Sequelize[_0xc421('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xc421('0x7')]},'disposition':{'type':Sequelize[_0xc421('0x6')]},'secondDisposition':{'type':Sequelize[_0xc421('0x6')]},'thirdDisposition':{'type':Sequelize[_0xc421('0x6')]},'note':{'type':Sequelize[_0xc421('0x6')]},'browserName':{'type':Sequelize[_0xc421('0x6')]},'browserVersion':{'type':Sequelize[_0xc421('0x6')]},'osName':{'type':Sequelize[_0xc421('0x6')]},'osVersion':{'type':Sequelize[_0xc421('0x6')]},'deviceModel':{'type':Sequelize[_0xc421('0x6')]},'deviceVendor':{'type':Sequelize[_0xc421('0x6')]},'deviceType':{'type':Sequelize[_0xc421('0x6')]},'referer':{'type':Sequelize[_0xc421('0x5')]},'customerIp':{'type':Sequelize[_0xc421('0x6')]},'formData':{'type':Sequelize['TEXT'](_0xc421('0x8'))},'read1stAt':{'type':Sequelize[_0xc421('0x7')]},'lastMsgAt':{'type':Sequelize[_0xc421('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xc421('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xc421('0x6')]},'customerPort':{'type':Sequelize[_0xc421('0x6')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc421('0x1')]}}; \ No newline at end of file +var _0x0ed1=['out','BOOLEAN','INTEGER','exports','ENUM','star','TEXT','STRING','DATE','long'];(function(_0x257b0e,_0x563d7e){var _0x27ac2a=function(_0x3a4bbc){while(--_0x3a4bbc){_0x257b0e['push'](_0x257b0e['shift']());}};_0x27ac2a(++_0x563d7e);}(_0x0ed1,0x99));var _0x10ed=function(_0x29854a,_0x4d43bb){_0x29854a=_0x29854a-0x0;var _0x357e4b=_0x0ed1[_0x29854a];return _0x357e4b;};'use strict';var Sequelize=require('sequelize');module[_0x10ed('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x10ed('0x1')](_0x10ed('0x2'),'thumb'),'defaultValue':_0x10ed('0x2')},'ratingMessage':{'type':Sequelize[_0x10ed('0x3')]},'pathTranscript':{'type':Sequelize[_0x10ed('0x3')]},'mailTranscript':{'type':Sequelize[_0x10ed('0x4')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x10ed('0x5')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x10ed('0x4')]},'thirdDisposition':{'type':Sequelize[_0x10ed('0x4')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x10ed('0x4')]},'browserVersion':{'type':Sequelize[_0x10ed('0x4')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x10ed('0x4')]},'deviceModel':{'type':Sequelize[_0x10ed('0x4')]},'deviceVendor':{'type':Sequelize[_0x10ed('0x4')]},'deviceType':{'type':Sequelize[_0x10ed('0x4')]},'referer':{'type':Sequelize[_0x10ed('0x3')]},'customerIp':{'type':Sequelize[_0x10ed('0x4')]},'formData':{'type':Sequelize[_0x10ed('0x3')](_0x10ed('0x6'))},'read1stAt':{'type':Sequelize[_0x10ed('0x5')]},'lastMsgAt':{'type':Sequelize[_0x10ed('0x5')]},'lastMsgDirection':{'type':Sequelize[_0x10ed('0x1')]('in',_0x10ed('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x10ed('0x4')]},'customerPort':{'type':Sequelize[_0x10ed('0x4')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x10ed('0x8')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x10ed('0x9')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 4c8dc71..72f6346 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 _0x3d7e=['entity\x20not\x20found','UserId','Interaction\x20already\x20assigned','closed','attachmentUpload','originalname','basename','filename','file','mimetype','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','mailTranscript','server/files/chat/upload/','format','now','Messages','User','%s%d','agentAlias','System','Visitor','ContactId','website_alias','agent_alias','agent_fullname','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','intersection','hasOwnProperty','sort','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','nolimit','order','includeAgent','alias','addTags','setTags','Tag','emit','chatInteractionTags:save','removeTags','server','files','tmp','attachments','push','firstName','lastName','Attachment','Account','Owner','get','mkdirSync','Chat','closedAt','toString','disposition','browserName','referer','customerPort','N.A.','tail','createReadStream','pipe','createWriteStream','value','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','zip-dir','moment','bluebird','mustache','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./chatInteraction.socket','register','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','sendStatus','name','merge','body','contact','agent','interaction','account','index','ChatInteraction','rawAttributes','type','getOptions','findAll','chat','user','show','params','keys','query','filters','model','attributes','fields','length','includeAll','include','options','find','create','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','vidaooApiKey','fullname','email','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','parse','metadata','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','ValidationError','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x4b4b4e,_0x341f0c){var _0xf1a943=function(_0x36fb59){while(--_0x36fb59){_0x4b4b4e['push'](_0x4b4b4e['shift']());}};_0xf1a943(++_0x341f0c);}(_0x3d7e,0x133));var _0xe3d7=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x3d7e[_0x3df223];return _0x562d11;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xe3d7('0x0'));var rp=require('request-promise');var moment=require(_0xe3d7('0x1'));var BPromise=require(_0xe3d7('0x2'));var Mustache=require(_0xe3d7('0x3'));var util=require('util');var path=require(_0xe3d7('0x4'));var ejs=require(_0xe3d7('0x5'));var fs=require('fs');var _=require(_0xe3d7('0x6'));var Redis=require(_0xe3d7('0x7'));var interaction=require(_0xe3d7('0x8'));var qs=require(_0xe3d7('0x9'));var pdf=require(_0xe3d7('0xa'));var logger=require(_0xe3d7('0xb'))(_0xe3d7('0xc'));var config=require(_0xe3d7('0xd'));var db=require(_0xe3d7('0xe'))['db'];config['redis']=_[_0xe3d7('0xf')](config['redis'],{'host':_0xe3d7('0x10'),'port':0x18eb});var socket=require(_0xe3d7('0x11'))(new Redis(config[_0xe3d7('0x12')]));require(_0xe3d7('0x13'))[_0xe3d7('0x14')](socket);var jayson=require(_0xe3d7('0x15'));var client=jayson[_0xe3d7('0x16')][_0xe3d7('0x17')]({'port':0x232b});var client9004=jayson[_0xe3d7('0x16')][_0xe3d7('0x17')]({'port':0x232c});function respondWithRpcPromise(_0x8217e0,_0x2e5042,_0x5efa13,_0x4941fc){return new BPromise(function(_0x518fe3,_0x2a18ef){var _0x367588=_0x4941fc||client;return _0x367588[_0xe3d7('0x18')](_0x8217e0,_0x5efa13)[_0xe3d7('0x19')](function(_0x5c5db4){logger[_0xe3d7('0x1a')](_0xe3d7('0x1b'),_0x2e5042,'request\x20sent');logger['debug'](_0xe3d7('0x1c'),_0x2e5042,_0xe3d7('0x1d'),JSON[_0xe3d7('0x1e')](_0x5c5db4));if(_0x5c5db4['error']){if(_0x5c5db4[_0xe3d7('0x1f')][_0xe3d7('0x20')]===0x1f4){logger[_0xe3d7('0x1f')](_0xe3d7('0x1b'),_0x2e5042,_0x5c5db4['error'][_0xe3d7('0x21')]);return _0x2a18ef(_0x5c5db4[_0xe3d7('0x1f')][_0xe3d7('0x21')]);}logger[_0xe3d7('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x2e5042,_0x5c5db4['error'][_0xe3d7('0x21')]);return _0x518fe3(_0x5c5db4[_0xe3d7('0x1f')][_0xe3d7('0x21')]);}else{logger[_0xe3d7('0x1a')](_0xe3d7('0x1b'),_0x2e5042,_0xe3d7('0x1d'));_0x518fe3(_0x5c5db4[_0xe3d7('0x22')][_0xe3d7('0x21')]);}})[_0xe3d7('0x23')](function(_0x43ae31){logger[_0xe3d7('0x1f')](_0xe3d7('0x1b'),_0x2e5042,_0x43ae31);_0x2a18ef(_0x43ae31);});});}function respondWithStatusCode(_0x55d2ec,_0x1a0adb){_0x1a0adb=_0x1a0adb||0xcc;return function(_0x2589ec){if(_0x2589ec){return _0x55d2ec['sendStatus'](_0x1a0adb);}return _0x55d2ec[_0xe3d7('0x24')](_0x1a0adb)[_0xe3d7('0x25')]();};}function respondWithResult(_0x3d8755,_0x1a5513){_0x1a5513=_0x1a5513||0xc8;return function(_0x1a7a29){if(_0x1a7a29){return _0x3d8755[_0xe3d7('0x24')](_0x1a5513)[_0xe3d7('0x26')](_0x1a7a29);}};}function respondWithFilteredResult(_0x2aa9d8,_0x183e90){return function(_0x21bfcb){if(_0x21bfcb){var _0x20328a=typeof _0x183e90[_0xe3d7('0x27')]===_0xe3d7('0x28')&&typeof _0x183e90[_0xe3d7('0x29')]===_0xe3d7('0x28');var _0x159d05=_0x21bfcb[_0xe3d7('0x2a')];var _0x2df044=_0x20328a?0x0:_0x183e90[_0xe3d7('0x27')];var _0x2c0e5d=_0x20328a?_0x21bfcb['count']:_0x183e90[_0xe3d7('0x27')]+_0x183e90[_0xe3d7('0x29')];var _0x316ee3;if(_0x2c0e5d>=_0x159d05){_0x2c0e5d=_0x159d05;_0x316ee3=0xc8;}else{_0x316ee3=0xce;}_0x2aa9d8['status'](_0x316ee3);return _0x2aa9d8[_0xe3d7('0x2b')](_0xe3d7('0x2c'),_0x2df044+'-'+_0x2c0e5d+'/'+_0x159d05)[_0xe3d7('0x26')](_0x21bfcb);}return null;};}function saveUpdates(_0x5f30c2){return function(_0x165a29){if(_0x165a29){return _0x165a29[_0xe3d7('0x2d')](_0x5f30c2)[_0xe3d7('0x19')](function(_0x246421){return _0x246421;});}return null;};}function removeEntity(_0x545862){return function(_0x444236){if(_0x444236){return _0x444236[_0xe3d7('0x2e')]()[_0xe3d7('0x19')](function(){_0x545862[_0xe3d7('0x24')](0xcc)[_0xe3d7('0x25')]();});}};}function handleEntityNotFound(_0x4fa5f2){return function(_0x2bf64e){if(!_0x2bf64e){_0x4fa5f2[_0xe3d7('0x2f')](0x194);}return _0x2bf64e;};}function handleError(_0xcc39e9,_0x46fcf9){_0x46fcf9=_0x46fcf9||0x1f4;return function(_0x42fd61){logger['error'](_0x42fd61['stack']);if(_0x42fd61[_0xe3d7('0x30')]){delete _0x42fd61[_0xe3d7('0x30')];}_0xcc39e9[_0xe3d7('0x24')](_0x46fcf9)['send'](_0x42fd61);};}function getMustacheRender(_0xa93ba3,_0x2644f8){return Mustache['render'](_0xa93ba3,_[_0xe3d7('0x31')](_0x2644f8[_0xe3d7('0x32')],{'contact':_0x2644f8[_0xe3d7('0x33')],'message':_0x2644f8[_0xe3d7('0x21')],'agent':_0x2644f8[_0xe3d7('0x34')],'interaction':_0x2644f8[_0xe3d7('0x35')],'account':_0x2644f8[_0xe3d7('0x36')]}))||'';}exports[_0xe3d7('0x37')]=function(_0x464c01,_0x1ad0f3){var _0x3f8c46={};var _0x142be5=_['map'](db[_0xe3d7('0x38')][_0xe3d7('0x39')],function(_0x48862e){return{'name':_0x48862e['fieldName'],'type':_0x48862e[_0xe3d7('0x3a')]['key']};});_0x3f8c46=qs[_0xe3d7('0x3b')](_0x142be5,_0x464c01);return interaction[_0xe3d7('0x3c')](_0xe3d7('0x3d'),_0x464c01['query'],_0x464c01[_0xe3d7('0x3e')],_0x3f8c46,_0x142be5)[_0xe3d7('0x19')](respondWithFilteredResult(_0x1ad0f3,_0x3f8c46))[_0xe3d7('0x23')](handleError(_0x1ad0f3,null));};exports[_0xe3d7('0x3f')]=function(_0x55a53c,_0x2d3468){var _0x39b9f4={'raw':![],'where':{'id':_0x55a53c[_0xe3d7('0x40')]['id']}},_0x57a2ea={};_0x57a2ea['model']=_[_0xe3d7('0x41')](db[_0xe3d7('0x38')][_0xe3d7('0x39')]);_0x57a2ea[_0xe3d7('0x42')]=_[_0xe3d7('0x41')](_0x55a53c[_0xe3d7('0x42')]);_0x57a2ea[_0xe3d7('0x43')]=_['intersection'](_0x57a2ea[_0xe3d7('0x44')],_0x57a2ea['query']);_0x39b9f4[_0xe3d7('0x45')]=_['intersection'](_0x57a2ea[_0xe3d7('0x44')],qs['fields'](_0x55a53c[_0xe3d7('0x42')][_0xe3d7('0x46')]));_0x39b9f4[_0xe3d7('0x45')]=_0x39b9f4[_0xe3d7('0x45')][_0xe3d7('0x47')]?_0x39b9f4[_0xe3d7('0x45')]:_0x57a2ea[_0xe3d7('0x44')];if(_0x55a53c['query'][_0xe3d7('0x48')]){_0x39b9f4[_0xe3d7('0x49')]=[{'all':!![]}];}_0x39b9f4=_['merge']({},_0x39b9f4,_0x55a53c[_0xe3d7('0x4a')]);return db[_0xe3d7('0x38')][_0xe3d7('0x4b')](_0x39b9f4)[_0xe3d7('0x19')](handleEntityNotFound(_0x2d3468,null))['then'](respondWithResult(_0x2d3468,null))[_0xe3d7('0x23')](handleError(_0x2d3468,null));};exports[_0xe3d7('0x4c')]=function(_0x21e94f,_0x10b7fa){return db[_0xe3d7('0x38')]['create'](_0x21e94f[_0xe3d7('0x32')],{})[_0xe3d7('0x19')](respondWithResult(_0x10b7fa,0xc9))['catch'](handleError(_0x10b7fa,null));};exports[_0xe3d7('0x2d')]=function(_0x21e00c,_0x32deff){if(_0x21e00c[_0xe3d7('0x32')]['id']){delete _0x21e00c[_0xe3d7('0x32')]['id'];}return db[_0xe3d7('0x38')]['find']({'where':{'id':_0x21e00c[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x32deff,null))[_0xe3d7('0x19')](saveUpdates(_0x21e00c[_0xe3d7('0x32')],null))['then'](respondWithResult(_0x32deff,null))[_0xe3d7('0x23')](handleError(_0x32deff,null));};exports[_0xe3d7('0x2e')]=function(_0x49b2be,_0x32f7db){return db['ChatInteraction'][_0xe3d7('0x4b')]({'where':{'id':_0x49b2be[_0xe3d7('0x40')]['id']}})['then'](handleEntityNotFound(_0x32f7db,null))[_0xe3d7('0x19')](removeEntity(_0x32f7db,null))[_0xe3d7('0x23')](handleError(_0x32f7db,null));};exports[_0xe3d7('0x4d')]=function(_0x3036ff,_0x5befd9){return db[_0xe3d7('0x38')]['describe']()['then'](respondWithResult(_0x5befd9,null))[_0xe3d7('0x23')](handleError(_0x5befd9,null));};exports[_0xe3d7('0x4e')]=function(_0x5d4644,_0x397d13){var _0x3ef358=_0x5d4644[_0xe3d7('0x40')]['id'];var _0x17fe58;var _0x3ed197;var _0x2055c2;return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x3ef358}})[_0xe3d7('0x19')](function(_0x687293){_0x17fe58=_0x687293;return db['ChatWebsite'][_0xe3d7('0x4f')]({'where':{'id':_0x687293[_0xe3d7('0x50')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xe3d7('0x51'),_0xe3d7('0x52'),_0xe3d7('0x53')],'raw':!![]});})['then'](function(_0x2c354b){if(_0x2c354b&&_0x2c354b[_0xe3d7('0x54')]&&_0x2c354b['vidaooEscalation']){_0x3ed197=_0x2c354b;var _0x1ad71f={'interaction':{'id':_0x3ef358},'agent':{'id':_0x5d4644[_0xe3d7('0x3e')]['id'],'name':_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x30')],'fullname':_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x55')],'email':_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x56')]},'contact':_0x5d4644['body'][_0xe3d7('0x33')],'account':_0x5d4644[_0xe3d7('0x32')][_0xe3d7('0x36')]};var _0x57d18f={'rejectUnauthorized':![],'method':'POST','url':_0xe3d7('0x57'),'headers':{'X-APIKEY':_0x2c354b['vidaooApiKey']},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5d4644[_0xe3d7('0x3e')][_0xe3d7('0x56')]],'buttons':null,'topic':_0x3ed197['vidaooTopic'],'note':_['isNull'](_0x3ed197[_0xe3d7('0x52')])?null:getMustacheRender(_0x3ed197[_0xe3d7('0x52')],_0x1ad71f),'metadata':null},'redirect':'follow','json':!![]};try{if(!_[_0xe3d7('0x58')](_0x3ed197['vidaooMetadata'])){var _0x4b9300=getMustacheRender(_0x3ed197[_0xe3d7('0x53')],_0x1ad71f);var _0x113998=JSON[_0xe3d7('0x59')](_0x4b9300);_0x57d18f[_0xe3d7('0x32')][_0xe3d7('0x5a')]=_0x113998;}}catch(_0x214f82){throw new db['Sequelize']['ValidationError'](_0xe3d7('0x5b'));}return rp(_0x57d18f);}else{throw new db[(_0xe3d7('0x5c'))][(_0xe3d7('0x5d'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0xe3d7('0x19')](function(_0x297581){_0x2055c2=_0x297581;if(_0x2055c2['id']){var _0x25d5fb={'body':_0x2055c2['join_url'],'ChatWebsiteId':_0x3ed197['id'],'ChatInteractionId':_0x17fe58['id'],'direction':_0xe3d7('0x5e'),'UserId':_0x5d4644['user']['id']};return db[_0xe3d7('0x5f')]['create'](_0x25d5fb,{});}else{throw new db[(_0xe3d7('0x5c'))]['ValidationError'](_0xe3d7('0x60'));}})[_0xe3d7('0x19')](function(){return _0x17fe58[_0xe3d7('0x61')]({'vidaooSessionId':_0x2055c2['id']});})[_0xe3d7('0x19')](respondWithResult(_0x397d13,null))[_0xe3d7('0x23')](handleError(_0x397d13,null));};exports[_0xe3d7('0x62')]=function(_0xa76c6e,_0x3f5749){if(_0xa76c6e[_0xe3d7('0x32')]['id']){delete _0xa76c6e[_0xe3d7('0x32')]['id'];}return db[_0xe3d7('0x38')][_0xe3d7('0x4b')]({'where':{'id':_0xa76c6e[_0xe3d7('0x40')]['id']},'include':[{'model':db[_0xe3d7('0x63')],'as':_0xe3d7('0x64')}]})[_0xe3d7('0x19')](handleEntityNotFound(_0x3f5749,null))['then'](saveUpdates(_0xa76c6e[_0xe3d7('0x32')],null))['then'](respondWithResult(_0x3f5749,null))[_0xe3d7('0x23')](handleError(_0x3f5749,null));};exports[_0xe3d7('0x65')]=function(_0xa59867,_0x1ddac0){if(_0xa59867[_0xe3d7('0x32')]['id']){delete _0xa59867[_0xe3d7('0x32')]['id'];}return db[_0xe3d7('0x38')]['find']({'where':{'id':_0xa59867[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](function(_0x4c291e){if(!_0x4c291e){logger['error'](_0xe3d7('0x66'),_0xe3d7('0x65'),0x194,_0xe3d7('0x67'));_0x1ddac0[_0xe3d7('0x2f')](0x194);}else{if(_0x4c291e[_0xe3d7('0x68')]){throw new db[(_0xe3d7('0x5c'))][(_0xe3d7('0x5d'))](_0xe3d7('0x69'));}}return _0x4c291e;})[_0xe3d7('0x19')](function(_0x3022ed){if(_0x3022ed){return _0x3022ed['update']({'closed':_0xa59867['body'][_0xe3d7('0x6a')],'disposition':_0xa59867[_0xe3d7('0x32')]['disposition']})['then'](function(_0x37b4c0){return _0x37b4c0;});}})[_0xe3d7('0x19')](function(){return respondWithRpcPromise('AbandonInteraction',_0xe3d7('0x65'),_0xa59867[_0xe3d7('0x32')],client9004);})[_0xe3d7('0x19')](respondWithResult(_0x1ddac0,null))[_0xe3d7('0x23')](handleError(_0x1ddac0,null));};exports[_0xe3d7('0x6b')]=function(_0x1cfc67,_0x46d178){_0x1cfc67[_0xe3d7('0x32')]['name']=_0x1cfc67['file'][_0xe3d7('0x6c')];_0x1cfc67[_0xe3d7('0x32')][_0xe3d7('0x6d')]=_0x1cfc67['file'][_0xe3d7('0x6e')];_0x1cfc67[_0xe3d7('0x32')]['type']=_0x1cfc67[_0xe3d7('0x6f')][_0xe3d7('0x70')];return db['Attachment'][_0xe3d7('0x4c')](_0x1cfc67[_0xe3d7('0x32')])['then'](respondWithResult(_0x46d178,0xc9))[_0xe3d7('0x23')](handleError(_0x46d178,null));};exports[_0xe3d7('0x71')]=function(_0x54826d,_0x31578f){return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x54826d[_0xe3d7('0x40')]['id']},'raw':!![]})[_0xe3d7('0x19')](handleEntityNotFound(_0x31578f,null))['then'](function(_0x58faa5){if(_0x58faa5){if(_0x58faa5[_0xe3d7('0x6a')]){return _0x31578f['status'](0x193)[_0xe3d7('0x26')]({'status':0x193,'message':_0xe3d7('0x72')});}return db['Attachment'][_0xe3d7('0x4f')]({'where':{'id':_0x54826d[_0xe3d7('0x42')][_0xe3d7('0x73')]},'raw':!![]})[_0xe3d7('0x19')](handleEntityNotFound(_0x31578f,null));}})[_0xe3d7('0x19')](function(_0x23e9a3){if(_0x23e9a3){var _0x4220ba=_0x23e9a3[_0xe3d7('0x74')]!==null;var _0x1d1ab9=path['join'](config[_0xe3d7('0x75')],_0xe3d7('0x76'));if(_0x4220ba){_0x1d1ab9=path[_0xe3d7('0x77')](_0x1d1ab9,_0xe3d7('0x78'));}var _0x1b6c53=path[_0xe3d7('0x77')](_0x1d1ab9,_0x23e9a3[_0xe3d7('0x6d')]);return _0x31578f[_0xe3d7('0x79')](_0x1b6c53);}})[_0xe3d7('0x23')](handleError(_0x31578f,null));};exports[_0xe3d7('0x7a')]=function(_0x12582e,_0x28b098){var _0x2ada23=null;var _0x292d2f=null;var _0x19af44=null;if(_0x12582e['body']['id']){delete _0x12582e[_0xe3d7('0x32')]['id'];}if(_0x12582e[_0xe3d7('0x32')][_0xe3d7('0x7b')]){_0x19af44=path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0x7c'),util[_0xe3d7('0x7d')]('transcript-%s.txt',Date[_0xe3d7('0x7e')]()));_0x12582e[_0xe3d7('0x32')]['pathTranscript']=_0x19af44;}return db[_0xe3d7('0x38')]['find']({'where':{'id':_0x12582e[_0xe3d7('0x40')]['id']},'include':[{'model':db[_0xe3d7('0x5f')],'as':_0xe3d7('0x7f'),'include':[{'model':db[_0xe3d7('0x80')],'as':'User'}]}]})[_0xe3d7('0x19')](handleEntityNotFound(_0x28b098,null))[_0xe3d7('0x19')](saveUpdates(_0x12582e[_0xe3d7('0x32')],null))[_0xe3d7('0x19')](function(_0x188067){if(_0x188067){_0x2ada23=_0x188067;return db['ChatWebsite'][_0xe3d7('0x4b')]({'where':{'id':_0x2ada23['ChatWebsiteId']}});}})[_0xe3d7('0x19')](function(_0x8e9812){if(_0x8e9812){_0x292d2f=_0x8e9812;return db[_0xe3d7('0x63')][_0xe3d7('0x4b')]({'where':{'id':_0x2ada23['ContactId']}});}})[_0xe3d7('0x19')](function(_0x2ee191){if(_0x2ee191){if(_0x19af44){var _0x236da5=null;for(var _0x3cd5b0=0x1;_0x3cd5b0<_0x2ada23[_0xe3d7('0x7f')][_0xe3d7('0x47')];++_0x3cd5b0){_0x236da5=_0x2ada23[_0xe3d7('0x7f')][_0x3cd5b0];var _0x4db57e=_0x236da5['UserId']?util[_0xe3d7('0x7d')](_0xe3d7('0x81'),_0x292d2f[_0xe3d7('0x82')],_0x236da5['UserId']):_0xe3d7('0x83');var _0x5bb26c=_0x12582e[_0xe3d7('0x32')]['customer']||util[_0xe3d7('0x7d')](_0xe3d7('0x81'),_0xe3d7('0x84'),_0x236da5[_0xe3d7('0x85')]);switch(_0x292d2f['agentIdentifier']){case _0xe3d7('0x86'):_0x4db57e=_0x236da5[_0xe3d7('0x68')]?util[_0xe3d7('0x7d')]('%s%d',_0x292d2f[_0xe3d7('0x82')],_0x236da5[_0xe3d7('0x68')]):_0xe3d7('0x83');break;case _0xe3d7('0x87'):_0x4db57e=_0x236da5[_0xe3d7('0x68')]?_0x236da5[_0xe3d7('0x80')]['alias']||_0x236da5[_0xe3d7('0x80')]['fullname']:_0xe3d7('0x83');break;case _0xe3d7('0x88'):_0x4db57e=_0x236da5[_0xe3d7('0x68')]?_0x236da5[_0xe3d7('0x80')][_0xe3d7('0x55')]:_0xe3d7('0x83');break;default:_0x4db57e=_0x236da5[_0xe3d7('0x68')]?util['format']('%s%d',_0x292d2f['agentAlias'],_0x236da5['UserId']):_0xe3d7('0x83');}var _0x57e033=util[_0xe3d7('0x7d')]('[%s]\x20%s:\x20%s\x0a',moment(_0x236da5[_0xe3d7('0x89')])[_0xe3d7('0x7d')](_0xe3d7('0x8a')),_0x236da5[_0xe3d7('0x8b')]==='in'?_0x5bb26c:_0x4db57e,_0x236da5[_0xe3d7('0x32')]);if(!_0x236da5[_0xe3d7('0x8c')]){fs['appendFileSync'](_0x19af44,_0x57e033);}}return db[_0xe3d7('0x8d')][_0xe3d7('0x4f')]({'where':{'service':!![]},'include':[{'model':db[_0xe3d7('0x8e')],'as':_0xe3d7('0x8f'),'raw':!![],'include':[{'model':db[_0xe3d7('0x90')],'as':_0xe3d7('0x90'),'raw':!![]}]}]});}}})[_0xe3d7('0x19')](function(_0x1975ff){if(!_0x1975ff||!_0x1975ff[_0xe3d7('0x8f')]||!_0x12582e['body'])return _0x2ada23;var _0x32b15c=_0x1975ff[_0xe3d7('0x91')]();return respondWithRpcPromise(_0xe3d7('0x92'),_0xe3d7('0x93'),{'account':_0x32b15c,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x1975ff[_0xe3d7('0x30')],_0x1975ff['email']||_0x1975ff['Smtp'][_0xe3d7('0x3e')]),'to':_0x12582e[_0xe3d7('0x32')][_0xe3d7('0x7b')],'subject':_0xe3d7('0x94'),'text':util[_0xe3d7('0x7d')](_0xe3d7('0x95'),_0x12582e['body'][_0xe3d7('0x7b')]),'attachments':[{'path':_0x19af44}]}})[_0xe3d7('0x19')](function(){return _0x2ada23;})[_0xe3d7('0x23')](function(_0x12e2f5){logger[_0xe3d7('0x1f')](_0x12e2f5);});})[_0xe3d7('0x19')](respondWithStatusCode(_0x28b098,0xc8))[_0xe3d7('0x23')](handleError(_0x28b098,null));};exports['addMessage']=function(_0x2f6a65,_0x1d3a0c){return db[_0xe3d7('0x5f')][_0xe3d7('0x4b')]({'where':{'id':_0x2f6a65[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x1d3a0c,null))['then'](function(_0xfbe9e5){if(_0xfbe9e5){return _0xfbe9e5[_0xe3d7('0x96')](_0x2f6a65['body'][_0xe3d7('0x97')],_[_0xe3d7('0x98')](_0x2f6a65['body'],['ids','id'])||{});}})[_0xe3d7('0x19')](respondWithResult(_0x1d3a0c,null))[_0xe3d7('0x23')](handleError(_0x1d3a0c,null));};exports[_0xe3d7('0x99')]=function(_0x1a1711,_0x434abd){var _0x23bead={'raw':![],'where':{}};var _0x4881c8={};var _0x3ed29b={'count':0x0,'rows':[]};return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x1a1711['params']['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x434abd,null))[_0xe3d7('0x19')](function(_0x284d27){if(_0x284d27){_0x4881c8['model']=_['keys'](db[_0xe3d7('0x5f')]['rawAttributes']);_0x4881c8[_0xe3d7('0x42')]=_[_0xe3d7('0x41')](_0x1a1711['query']);_0x4881c8[_0xe3d7('0x43')]=_[_0xe3d7('0x9a')](_0x4881c8[_0xe3d7('0x44')],_0x4881c8[_0xe3d7('0x42')]);_0x23bead[_0xe3d7('0x45')]=_[_0xe3d7('0x9a')](_0x4881c8['model'],qs['fields'](_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x46')]));_0x23bead[_0xe3d7('0x45')]=_0x23bead[_0xe3d7('0x45')][_0xe3d7('0x47')]?_0x23bead['attributes']:_0x4881c8[_0xe3d7('0x44')];if(!_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x9b')]('nolimit')){_0x23bead[_0xe3d7('0x29')]=qs[_0xe3d7('0x29')](_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x29')]);_0x23bead['offset']=qs[_0xe3d7('0x27')](_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x27')]);}_0x23bead['order']=qs[_0xe3d7('0x9c')](_0x1a1711['query'][_0xe3d7('0x9c')]);_0x23bead[_0xe3d7('0x9d')]=qs[_0xe3d7('0x43')](_['pick'](_0x1a1711[_0xe3d7('0x42')],_0x4881c8[_0xe3d7('0x43')]));_0x23bead[_0xe3d7('0x9d')][_0xe3d7('0x9e')]=_0x284d27['id'];if(_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x9f')]){_0x23bead[_0xe3d7('0x9d')]=_[_0xe3d7('0x31')](_0x23bead['where'],{'$or':_['map'](_0x23bead[_0xe3d7('0x45')],function(_0x1eab8d){var _0x192a4b={};_0x192a4b[_0x1eab8d]={'$like':'%'+_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x9f')]+'%'};return _0x192a4b;})});}if(_0x1a1711['query'][_0xe3d7('0xa0')]){var _0x26484b=_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0xa0')]['split'](',');var _0x2a0eed={};_0x2a0eed[_0x26484b[0x0]]={'$gte':moment(_0x26484b[0x1])[_0xe3d7('0x7d')](_0xe3d7('0xa1'))};_0x23bead['where']=_['merge'](_0x23bead['where'],_0x2a0eed);}_0x23bead=_[_0xe3d7('0x31')]({},_0x23bead,_0x1a1711['options']);return db['ChatMessage'][_0xe3d7('0x2a')]({'where':_0x23bead[_0xe3d7('0x9d')]})[_0xe3d7('0x19')](function(_0x3f402c){_0x3ed29b[_0xe3d7('0x2a')]=_0x3f402c;if(_0x1a1711[_0xe3d7('0x42')][_0xe3d7('0x48')]){_0x23bead[_0xe3d7('0x49')]=[{'all':!![]}];}return db[_0xe3d7('0x5f')][_0xe3d7('0x3c')](_0x23bead);})['then'](function(_0x21e252){_0x3ed29b[_0xe3d7('0xa2')]=_0x21e252;return _0x3ed29b;});}})['then'](respondWithFilteredResult(_0x434abd,_0x23bead))[_0xe3d7('0x23')](handleError(_0x434abd,null));};exports[_0xe3d7('0xa3')]=function(_0x404053,_0x242949){var _0x5ae2db={'where':{}},_0x30c228={},_0xe35f4={'count':0x0,'rows':[]};return db[_0xe3d7('0x38')][_0xe3d7('0x4f')]({'where':{'id':_0x404053[_0xe3d7('0x40')]['id']}})[_0xe3d7('0x19')](handleEntityNotFound(_0x242949,null))['then'](function(_0x39ac3d){if(_0x39ac3d){_0x30c228['model']=_['keys'](db[_0xe3d7('0x5f')][_0xe3d7('0x39')]);_0x30c228[_0xe3d7('0x42')]=_[_0xe3d7('0x41')](_0x404053[_0xe3d7('0x42')]);_0x30c228['filters']=_['intersection'](_0x30c228[_0xe3d7('0x44')],_0x30c228[_0xe3d7('0x42')]);_0x5ae2db[_0xe3d7('0x45')]=_[_0xe3d7('0x9a')](_0x30c228[_0xe3d7('0x44')],qs[_0xe3d7('0x46')](_0x404053[_0xe3d7('0x42')][_0xe3d7('0x46')]));_0x5ae2db[_0xe3d7('0x45')]=_0x5ae2db[_0xe3d7('0x45')][_0xe3d7('0x47')]?_0x5ae2db[_0xe3d7('0x45')]:_0x30c228[_0xe3d7('0x44')];if(!_0x404053[_0xe3d7('0x42')][_0xe3d7('0x9b')](_0xe3d7('0xa4'))){_0x5ae2db[_0xe3d7('0x29')]=qs[_0xe3d7('0x29')](_0x404053[_0xe3d7('0x42')][_0xe3d7('0x29')]);_0x5ae2db[_0xe3d7('0x27')]=qs[_0xe3d7('0x27')](_0x404053[_0xe3d7('0x42')]['offset']);}_0x5ae2db[_0xe3d7('0xa5')]=qs[_0xe3d7('0x9c')](_0x404053[_0xe3d7('0x42')]['sort']);_0x5ae2db['where']=qs[_0xe3d7('0x43')](_['pick'](_0x404053[_0xe3d7('0x42')],_0x30c228[_0xe3d7('0x43')]));_0x5ae2db[_0xe3d7('0x9d')][_0xe3d7('0x9e')]=_0x39ac3d['id'];if(_0x404053[_0xe3d7('0x42')]['filter']){_0x5ae2db[_0xe3d7('0x9d')]=_['merge'](_0x5ae2db[_0xe3d7('0x9d')],{'$or':_['map'](_0x5ae2db[_0xe3d7('0x45')],function(_0x2e1d5c){var _0x4e3acd={};_0x4e3acd[_0x2e1d5c]={'$like':'%'+_0x404053[_0xe3d7('0x42')][_0xe3d7('0x9f')]+'%'};return _0x4e3acd;})});}_0x5ae2db['where'][_0xe3d7('0x8c')]=![];if(_0x404053['query']['id']){_0x5ae2db['where']['id']={'$gt':_0x404053[_0xe3d7('0x42')]['id']};}_0x5ae2db=_[_0xe3d7('0x31')]({},_0x5ae2db,_0x404053[_0xe3d7('0x4a')]);return db[_0xe3d7('0x5f')][_0xe3d7('0x2a')]({'where':_0x5ae2db[_0xe3d7('0x9d')]})[_0xe3d7('0x19')](function(_0x22a518){_0xe35f4[_0xe3d7('0x2a')]=_0x22a518;_0x5ae2db['include']=[];if(_0x404053[_0xe3d7('0x42')][_0xe3d7('0xa6')]){_0x5ae2db[_0xe3d7('0x49')]['push']({'model':db['User'],'as':'User','attributes':['id',_0xe3d7('0x55'),_0xe3d7('0xa7')]});}if(_0x404053[_0xe3d7('0x42')][_0xe3d7('0x48')]){_0x5ae2db[_0xe3d7('0x49')]=[{'all':!![]}];}return db[_0xe3d7('0x5f')][_0xe3d7('0x3c')](_0x5ae2db);})[_0xe3d7('0x19')](function(_0x22a42d){_0xe35f4[_0xe3d7('0xa2')]=_0x22a42d;return _0xe35f4;});}})['then'](respondWithFilteredResult(_0x242949,_0x5ae2db))[_0xe3d7('0x23')](handleError(_0x242949,null));};exports[_0xe3d7('0xa8')]=function(_0x3022c4,_0x5cd74b){return db[_0xe3d7('0x38')]['find']({'where':{'id':_0x3022c4[_0xe3d7('0x40')]['id']}})['then'](handleEntityNotFound(_0x5cd74b,null))[_0xe3d7('0x19')](function(_0x1cb3c5){if(_0x1cb3c5){return _0x1cb3c5[_0xe3d7('0xa9')](_0x3022c4[_0xe3d7('0x32')][_0xe3d7('0x97')],_[_0xe3d7('0x98')](_0x3022c4[_0xe3d7('0x32')],['ids','id'])||{})['spread'](function(){return db[_0xe3d7('0xaa')][_0xe3d7('0x3c')]({'attributes':['id',_0xe3d7('0x30'),'color'],'where':{'id':_0x3022c4['body'][_0xe3d7('0x97')]}});})['then'](function(_0x49de37){socket[_0xe3d7('0xab')](_0xe3d7('0xac'),{'id':Number(_0x3022c4['params']['id']),'tags':_0x49de37||[]});return{'id':Number(_0x3022c4[_0xe3d7('0x40')]['id']),'tags':_0x49de37||[]};});}})['then'](respondWithResult(_0x5cd74b,null))[_0xe3d7('0x23')](handleError(_0x5cd74b,null));};exports[_0xe3d7('0xad')]=function(_0x258982,_0x3f500c){return db[_0xe3d7('0x38')][_0xe3d7('0x4b')]({'where':{'id':_0x258982[_0xe3d7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3f500c,null))[_0xe3d7('0x19')](function(_0x3faa22){if(_0x3faa22){return _0x3faa22[_0xe3d7('0xad')](_0x258982[_0xe3d7('0x42')][_0xe3d7('0x97')]);}})[_0xe3d7('0x19')](respondWithStatusCode(_0x3f500c,null))[_0xe3d7('0x23')](handleError(_0x3f500c,null));};exports[_0xe3d7('0x79')]=function(_0x1acf73,_0x304340){var _0xdef376=moment()['unix']()['toString']();var _0x50be80=path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0xae'),_0xe3d7('0xaf'),_0xe3d7('0xb0'));var _0x274b8c=path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0xae'),_0xe3d7('0xaf'),_0xe3d7('0xb1'));var _0x3cc87e=path[_0xe3d7('0x77')](_0x50be80,_0xdef376);var _0x28d423=util[_0xe3d7('0x7d')]('transcript-%d-%s.zip',_0x1acf73['params']['id'],_0xdef376);var _0xe78852=path['join'](_0x50be80,_0x28d423);var _0x31ae0e=[];_0x31ae0e[_0xe3d7('0xb2')]({'model':db[_0xe3d7('0x80')],'as':_0xe3d7('0x80'),'attributes':['id',_0xe3d7('0x55')],'raw':!![]});_0x31ae0e[_0xe3d7('0xb2')]({'model':db['CmContact'],'as':_0xe3d7('0x64'),'attributes':['id',_0xe3d7('0xb3'),_0xe3d7('0xb4')],'raw':!![]});if(_0x1acf73[_0xe3d7('0x42')][_0xe3d7('0xb1')]){_0x31ae0e[_0xe3d7('0xb2')]({'model':db[_0xe3d7('0xb5')],'as':'Attachment','raw':!![]});}var _0x1ab073=[{'model':db[_0xe3d7('0x5f')],'as':_0xe3d7('0x7f'),'attributes':['id','body',_0xe3d7('0x89'),_0xe3d7('0x8b'),_0xe3d7('0x8c'),'read'],'include':_0x31ae0e}];_0x1ab073[_0xe3d7('0xb2')]({'model':db['ChatWebsite'],'as':_0xe3d7('0xb6'),'attributes':['id',_0xe3d7('0x30')]});_0x1ab073[_0xe3d7('0xb2')]({'model':db['User'],'as':_0xe3d7('0xb7'),'attributes':['id',_0xe3d7('0x55')]});return db[_0xe3d7('0x38')][_0xe3d7('0x4b')]({'where':{'id':_0x1acf73[_0xe3d7('0x40')]['id']},'include':_0x1ab073})['then'](handleEntityNotFound(_0x304340,null))[_0xe3d7('0x19')](function(_0x4f0d21){if(_0x4f0d21){var _0x1a25d9=_0x4f0d21[_0xe3d7('0xb8')]({'plain':!![]});fs[_0xe3d7('0xb9')](_0x3cc87e);var _0x3a35ab={'channel':_0xe3d7('0xba'),'account':_0x1a25d9[_0xe3d7('0xb6')][_0xe3d7('0x30')],'agent':_0x1a25d9[_0xe3d7('0xb7')]?_0x1a25d9[_0xe3d7('0xb7')][_0xe3d7('0x55')]:'N.A.','createdAt':moment(_0x1a25d9[_0xe3d7('0x89')])[_0xe3d7('0x7d')](_0xe3d7('0xa1'))['toString'](),'closedAt':_0x1a25d9['closed']?moment(_0x1a25d9[_0xe3d7('0xbb')])['format'](_0xe3d7('0xa1'))[_0xe3d7('0xbc')]():'','disposition':_0x1a25d9[_0xe3d7('0xbd')],'chatInfo':{'browser':_0x1a25d9[_0xe3d7('0xbe')],'os':_0x1a25d9['osName'],'referer':_0x1a25d9[_0xe3d7('0xbf')],'customerIp':_0x1a25d9['customerIp'],'customerPort':_0x1a25d9[_0xe3d7('0xc0')]?_0x1a25d9[_0xe3d7('0xc0')]:_0xe3d7('0xc1')},'messages':_(_0x1a25d9[_0xe3d7('0x7f')])[_0xe3d7('0xc2')]()[_0xe3d7('0x9f')]({'secret':![]})['map'](function(_0x416a57){if(_0x416a57[_0xe3d7('0xb5')]){var _0x5aa021=path['join'](_0x274b8c,_0x416a57['Attachment'][_0xe3d7('0x6d')]);if(fs['existsSync'](_0x5aa021)){fs[_0xe3d7('0xc3')](_0x5aa021)[_0xe3d7('0xc4')](fs[_0xe3d7('0xc5')](path[_0xe3d7('0x77')](_0x3cc87e,_0x416a57[_0xe3d7('0xb5')]['basename'])));}}return{'date':moment(_0x416a57[_0xe3d7('0x89')])['format'](_0xe3d7('0xa1'))[_0xe3d7('0xbc')](),'sender':_0x416a57[_0xe3d7('0x8b')]===_0xe3d7('0x5e')?_0x416a57[_0xe3d7('0x80')]?_0x416a57[_0xe3d7('0x80')][_0xe3d7('0x55')]:_0xe3d7('0x83'):_0x416a57[_0xe3d7('0x64')][_0xe3d7('0xb3')]+(_0x416a57['Contact']['lastName']?'\x20'+_0x416a57['Contact'][_0xe3d7('0xb4')]:''),'body':_0x416a57[_0xe3d7('0xb5')]?_0x416a57['Attachment'][_0xe3d7('0x6d')]:_0x416a57['body'],'direction':_0x416a57[_0xe3d7('0x8b')]===_0xe3d7('0x5e')?'A':'C','secret':_0x416a57[_0xe3d7('0x8c')],'read':_0x416a57['read'],'attachment':_0x416a57[_0xe3d7('0xb5')]};})[_0xe3d7('0xc6')]()};return ejs['renderFile'](path[_0xe3d7('0x77')](config[_0xe3d7('0x75')],_0xe3d7('0xae'),_0xe3d7('0xc7'),_0xe3d7('0xc8')),{'interaction':_0x3a35ab})[_0xe3d7('0x19')](function(_0x798f9e){var _0x30be1b=path[_0xe3d7('0x77')](_0x3cc87e,_0xe3d7('0xc9')+_0x1a25d9['id']+'-'+_0xdef376+_0xe3d7('0xca'));var _0x1e39f4={'path':_0x30be1b,'channel':_0xe3d7('0xba'),'interactionId':_0x1a25d9['id']};return pdf[_0xe3d7('0xcb')](_0x798f9e,_0x1e39f4);})[_0xe3d7('0x19')](function(){return new Promise(function(_0x460708,_0x209a70){zipdir(_0x3cc87e,{'saveTo':_0xe78852},function(_0x34eef1,_0x1c766f){if(_0x34eef1)return _0x209a70(_0x34eef1);return _0x460708(_0x1c766f);});})['then'](function(){return new BPromise(function(_0x1dd09d,_0x5ceac5){rimraf(_0x3cc87e,function(_0x46a526){if(_0x46a526)_0x5ceac5(_0x46a526);return _0x1dd09d();});});})[_0xe3d7('0x19')](function(){return _0x304340[_0xe3d7('0x79')](_0xe78852,_0x28d423,function(_0x38bd23){if(_0x38bd23){logger[_0xe3d7('0x1f')]('err',_0x38bd23);}else{fs[_0xe3d7('0xcc')](_0xe78852);}});});});}else{return _0x304340['sendStatus'](0xc8);}})[_0xe3d7('0x23')](handleError(_0x304340,null));}; \ No newline at end of file +var _0xe6aa=['removeTags','unix','toString','server','files','attachments','transcript-%d-%s.zip','push','firstName','lastName','read','ChatWebsite','Account','Owner','mkdirSync','Chat','createdAt','closedAt','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','pipe','out','Contact','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','bluebird','mustache','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','update','name','render','body','contact','agent','account','rawAttributes','fieldName','type','key','findAll','chat','query','user','show','model','ChatInteraction','keys','attributes','intersection','fields','options','find','create','params','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooTopic','vidaooNote','vidaooMetadata','fullname','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooApiKey','email','isNull','follow','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','disposition','AbandonInteraction','attachmentUpload','file','basename','filename','mimetype','Attachment','closed','Unauthorized','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','download','close','server/files/chat/upload/','transcript-%s.txt','pathTranscript','Messages','User','ContactId','format','%s%d','agentAlias','customer','Visitor','agentIdentifier','System','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','omit','ids','getMessages','filters','length','hasOwnProperty','nolimit','sort','where','merge','map','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','order','pick','ChatInteractionId','secret','includeAgent','includeAll','addTags','spread','Tag','color','emit','chatInteractionTags:save'];(function(_0x58bbeb,_0x19caf1){var _0x5d9f3e=function(_0x27e100){while(--_0x27e100){_0x58bbeb['push'](_0x58bbeb['shift']());}};_0x5d9f3e(++_0x19caf1);}(_0xe6aa,0x1ca));var _0xae6a=function(_0x123dba,_0x58ff2d){_0x123dba=_0x123dba-0x0;var _0x41b42d=_0xe6aa[_0x123dba];return _0x41b42d;};'use strict';var rimraf=require(_0xae6a('0x0'));var zipdir=require('zip-dir');var rp=require(_0xae6a('0x1'));var moment=require('moment');var BPromise=require(_0xae6a('0x2'));var Mustache=require(_0xae6a('0x3'));var util=require('util');var path=require(_0xae6a('0x4'));var ejs=require(_0xae6a('0x5'));var fs=require('fs');var _=require(_0xae6a('0x6'));var Redis=require('ioredis');var interaction=require(_0xae6a('0x7'));var qs=require(_0xae6a('0x8'));var pdf=require(_0xae6a('0x9'));var logger=require(_0xae6a('0xa'))('api');var config=require(_0xae6a('0xb'));var db=require(_0xae6a('0xc'))['db'];config['redis']=_[_0xae6a('0xd')](config[_0xae6a('0xe')],{'host':_0xae6a('0xf'),'port':0x18eb});var socket=require(_0xae6a('0x10'))(new Redis(config[_0xae6a('0xe')]));require(_0xae6a('0x11'))[_0xae6a('0x12')](socket);var jayson=require(_0xae6a('0x13'));var client=jayson['client'][_0xae6a('0x14')]({'port':0x232b});var client9004=jayson[_0xae6a('0x15')][_0xae6a('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x4998fd,_0x26572c,_0x148261,_0xb30f94){return new BPromise(function(_0x50d0d5,_0x31527a){var _0x3990cf=_0xb30f94||client;return _0x3990cf[_0xae6a('0x16')](_0x4998fd,_0x148261)[_0xae6a('0x17')](function(_0x1c0015){logger[_0xae6a('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x26572c,_0xae6a('0x19'));logger[_0xae6a('0x1a')](_0xae6a('0x1b'),_0x26572c,_0xae6a('0x19'),JSON[_0xae6a('0x1c')](_0x1c0015));if(_0x1c0015[_0xae6a('0x1d')]){if(_0x1c0015[_0xae6a('0x1d')]['code']===0x1f4){logger['error'](_0xae6a('0x1e'),_0x26572c,_0x1c0015['error'][_0xae6a('0x1f')]);return _0x31527a(_0x1c0015[_0xae6a('0x1d')][_0xae6a('0x1f')]);}logger[_0xae6a('0x1d')](_0xae6a('0x1e'),_0x26572c,_0x1c0015['error']['message']);return _0x50d0d5(_0x1c0015[_0xae6a('0x1d')][_0xae6a('0x1f')]);}else{logger[_0xae6a('0x18')](_0xae6a('0x1e'),_0x26572c,_0xae6a('0x19'));_0x50d0d5(_0x1c0015[_0xae6a('0x20')][_0xae6a('0x1f')]);}})[_0xae6a('0x21')](function(_0x26e83f){logger[_0xae6a('0x1d')](_0xae6a('0x1e'),_0x26572c,_0x26e83f);_0x31527a(_0x26e83f);});});}function respondWithStatusCode(_0x5b71f1,_0x554db7){_0x554db7=_0x554db7||0xcc;return function(_0x4aab98){if(_0x4aab98){return _0x5b71f1[_0xae6a('0x22')](_0x554db7);}return _0x5b71f1[_0xae6a('0x23')](_0x554db7)[_0xae6a('0x24')]();};}function respondWithResult(_0x423a54,_0x28ceff){_0x28ceff=_0x28ceff||0xc8;return function(_0x32724b){if(_0x32724b){return _0x423a54['status'](_0x28ceff)[_0xae6a('0x25')](_0x32724b);}};}function respondWithFilteredResult(_0x5df151,_0x2bb3f4){return function(_0x30968b){if(_0x30968b){var _0x266eab=typeof _0x2bb3f4[_0xae6a('0x26')]==='undefined'&&typeof _0x2bb3f4['limit']===_0xae6a('0x27');var _0x4d2725=_0x30968b[_0xae6a('0x28')];var _0x29ae99=_0x266eab?0x0:_0x2bb3f4[_0xae6a('0x26')];var _0x14213e=_0x266eab?_0x30968b[_0xae6a('0x28')]:_0x2bb3f4['offset']+_0x2bb3f4[_0xae6a('0x29')];var _0x2d70ca;if(_0x14213e>=_0x4d2725){_0x14213e=_0x4d2725;_0x2d70ca=0xc8;}else{_0x2d70ca=0xce;}_0x5df151[_0xae6a('0x23')](_0x2d70ca);return _0x5df151['set']('Content-Range',_0x29ae99+'-'+_0x14213e+'/'+_0x4d2725)[_0xae6a('0x25')](_0x30968b);}return null;};}function saveUpdates(_0x36b8af){return function(_0x23980d){if(_0x23980d){return _0x23980d[_0xae6a('0x2a')](_0x36b8af)[_0xae6a('0x17')](function(_0x2cee1e){return _0x2cee1e;});}return null;};}function removeEntity(_0x1a1f2b){return function(_0x4ae06f){if(_0x4ae06f){return _0x4ae06f['destroy']()[_0xae6a('0x17')](function(){_0x1a1f2b[_0xae6a('0x23')](0xcc)[_0xae6a('0x24')]();});}};}function handleEntityNotFound(_0x1cc51f){return function(_0x3a74e1){if(!_0x3a74e1){_0x1cc51f[_0xae6a('0x22')](0x194);}return _0x3a74e1;};}function handleError(_0x3793e0,_0x208af8){_0x208af8=_0x208af8||0x1f4;return function(_0x3dfbfa){logger[_0xae6a('0x1d')](_0x3dfbfa['stack']);if(_0x3dfbfa[_0xae6a('0x2b')]){delete _0x3dfbfa[_0xae6a('0x2b')];}_0x3793e0[_0xae6a('0x23')](_0x208af8)['send'](_0x3dfbfa);};}function getMustacheRender(_0x56c778,_0xd75e0){return Mustache[_0xae6a('0x2c')](_0x56c778,_['merge'](_0xd75e0[_0xae6a('0x2d')],{'contact':_0xd75e0[_0xae6a('0x2e')],'message':_0xd75e0[_0xae6a('0x1f')],'agent':_0xd75e0[_0xae6a('0x2f')],'interaction':_0xd75e0['interaction'],'account':_0xd75e0[_0xae6a('0x30')]}))||'';}exports['index']=function(_0x592cc4,_0x264e3a){var _0x210645={};var _0x14582f=_['map'](db['ChatInteraction'][_0xae6a('0x31')],function(_0x29bff6){return{'name':_0x29bff6[_0xae6a('0x32')],'type':_0x29bff6[_0xae6a('0x33')][_0xae6a('0x34')]};});_0x210645=qs['getOptions'](_0x14582f,_0x592cc4);return interaction[_0xae6a('0x35')](_0xae6a('0x36'),_0x592cc4[_0xae6a('0x37')],_0x592cc4[_0xae6a('0x38')],_0x210645,_0x14582f)[_0xae6a('0x17')](respondWithFilteredResult(_0x264e3a,_0x210645))[_0xae6a('0x21')](handleError(_0x264e3a,null));};exports[_0xae6a('0x39')]=function(_0x418f48,_0x1c5d79){var _0x92015a={'raw':![],'where':{'id':_0x418f48['params']['id']}},_0x4059b9={};_0x4059b9[_0xae6a('0x3a')]=_['keys'](db[_0xae6a('0x3b')]['rawAttributes']);_0x4059b9[_0xae6a('0x37')]=_[_0xae6a('0x3c')](_0x418f48['query']);_0x4059b9['filters']=_['intersection'](_0x4059b9[_0xae6a('0x3a')],_0x4059b9[_0xae6a('0x37')]);_0x92015a[_0xae6a('0x3d')]=_[_0xae6a('0x3e')](_0x4059b9[_0xae6a('0x3a')],qs[_0xae6a('0x3f')](_0x418f48[_0xae6a('0x37')][_0xae6a('0x3f')]));_0x92015a['attributes']=_0x92015a[_0xae6a('0x3d')]['length']?_0x92015a[_0xae6a('0x3d')]:_0x4059b9[_0xae6a('0x3a')];if(_0x418f48[_0xae6a('0x37')]['includeAll']){_0x92015a['include']=[{'all':!![]}];}_0x92015a=_['merge']({},_0x92015a,_0x418f48[_0xae6a('0x40')]);return db[_0xae6a('0x3b')][_0xae6a('0x41')](_0x92015a)['then'](handleEntityNotFound(_0x1c5d79,null))['then'](respondWithResult(_0x1c5d79,null))['catch'](handleError(_0x1c5d79,null));};exports[_0xae6a('0x42')]=function(_0x4c25ab,_0x3b0b9a){return db[_0xae6a('0x3b')][_0xae6a('0x42')](_0x4c25ab[_0xae6a('0x2d')],{})[_0xae6a('0x17')](respondWithResult(_0x3b0b9a,0xc9))['catch'](handleError(_0x3b0b9a,null));};exports[_0xae6a('0x2a')]=function(_0x10af07,_0x22941f){if(_0x10af07[_0xae6a('0x2d')]['id']){delete _0x10af07[_0xae6a('0x2d')]['id'];}return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0x10af07[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x22941f,null))['then'](saveUpdates(_0x10af07[_0xae6a('0x2d')],null))[_0xae6a('0x17')](respondWithResult(_0x22941f,null))['catch'](handleError(_0x22941f,null));};exports[_0xae6a('0x44')]=function(_0xce0a7e,_0x383d28){return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0xce0a7e[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x383d28,null))[_0xae6a('0x17')](removeEntity(_0x383d28,null))[_0xae6a('0x21')](handleError(_0x383d28,null));};exports[_0xae6a('0x45')]=function(_0x2b2ab7,_0xdb6106){return db['ChatInteraction'][_0xae6a('0x45')]()[_0xae6a('0x17')](respondWithResult(_0xdb6106,null))['catch'](handleError(_0xdb6106,null));};exports[_0xae6a('0x46')]=function(_0x3bc6e7,_0x381ed0){var _0x471c10=_0x3bc6e7[_0xae6a('0x43')]['id'];var _0x1c1bb2;var _0xbfef90;var _0x290da0;return db[_0xae6a('0x3b')][_0xae6a('0x47')]({'where':{'id':_0x471c10}})[_0xae6a('0x17')](function(_0x450b2e){_0x1c1bb2=_0x450b2e;return db['ChatWebsite'][_0xae6a('0x47')]({'where':{'id':_0x450b2e[_0xae6a('0x48')]},'attributes':['id','vidaooApiKey','vidaooEscalation',_0xae6a('0x49'),_0xae6a('0x4a'),_0xae6a('0x4b')],'raw':!![]});})[_0xae6a('0x17')](function(_0x73bb7a){if(_0x73bb7a&&_0x73bb7a['vidaooApiKey']&&_0x73bb7a['vidaooEscalation']){_0xbfef90=_0x73bb7a;var _0x4aceb7={'interaction':{'id':_0x471c10},'agent':{'id':_0x3bc6e7['user']['id'],'name':_0x3bc6e7[_0xae6a('0x38')]['name'],'fullname':_0x3bc6e7[_0xae6a('0x38')][_0xae6a('0x4c')],'email':_0x3bc6e7['user']['email']},'contact':_0x3bc6e7[_0xae6a('0x2d')][_0xae6a('0x2e')],'account':_0x3bc6e7[_0xae6a('0x2d')][_0xae6a('0x30')]};var _0x43df6e={'rejectUnauthorized':![],'method':_0xae6a('0x4d'),'url':_0xae6a('0x4e'),'headers':{'X-APIKEY':_0x73bb7a[_0xae6a('0x4f')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3bc6e7[_0xae6a('0x38')][_0xae6a('0x50')]],'buttons':null,'topic':_0xbfef90[_0xae6a('0x49')],'note':_[_0xae6a('0x51')](_0xbfef90[_0xae6a('0x4a')])?null:getMustacheRender(_0xbfef90[_0xae6a('0x4a')],_0x4aceb7),'metadata':null},'redirect':_0xae6a('0x52'),'json':!![]};try{if(!_['isNull'](_0xbfef90[_0xae6a('0x4b')])){var _0x3606fc=getMustacheRender(_0xbfef90[_0xae6a('0x4b')],_0x4aceb7);var _0x2034d5=JSON[_0xae6a('0x53')](_0x3606fc);_0x43df6e[_0xae6a('0x2d')][_0xae6a('0x54')]=_0x2034d5;}}catch(_0x50eb28){throw new db['Sequelize'][(_0xae6a('0x55'))](_0xae6a('0x56'));}return rp(_0x43df6e);}else{throw new db['Sequelize']['ValidationError'](_0xae6a('0x57'));}})[_0xae6a('0x17')](function(_0x2b878b){_0x290da0=_0x2b878b;if(_0x290da0['id']){var _0x52f504={'body':_0x290da0[_0xae6a('0x58')],'ChatWebsiteId':_0xbfef90['id'],'ChatInteractionId':_0x1c1bb2['id'],'direction':'out','UserId':_0x3bc6e7['user']['id']};return db[_0xae6a('0x59')][_0xae6a('0x42')](_0x52f504,{});}else{throw new db[(_0xae6a('0x5a'))]['ValidationError'](_0xae6a('0x5b'));}})[_0xae6a('0x17')](function(){return _0x1c1bb2[_0xae6a('0x5c')]({'vidaooSessionId':_0x290da0['id']});})['then'](respondWithResult(_0x381ed0,null))[_0xae6a('0x21')](handleError(_0x381ed0,null));};exports[_0xae6a('0x5d')]=function(_0x49345a,_0x4f8230){if(_0x49345a[_0xae6a('0x2d')]['id']){delete _0x49345a[_0xae6a('0x2d')]['id'];}return db[_0xae6a('0x3b')]['find']({'where':{'id':_0x49345a[_0xae6a('0x43')]['id']},'include':[{'model':db[_0xae6a('0x5e')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x4f8230,null))[_0xae6a('0x17')](saveUpdates(_0x49345a['body'],null))['then'](respondWithResult(_0x4f8230,null))[_0xae6a('0x21')](handleError(_0x4f8230,null));};exports[_0xae6a('0x5f')]=function(_0x5e5803,_0x2734ce){if(_0x5e5803[_0xae6a('0x2d')]['id']){delete _0x5e5803[_0xae6a('0x2d')]['id'];}return db['ChatInteraction'][_0xae6a('0x41')]({'where':{'id':_0x5e5803['params']['id']}})[_0xae6a('0x17')](function(_0x379253){if(!_0x379253){logger[_0xae6a('0x1d')](_0xae6a('0x60'),_0xae6a('0x5f'),0x194,_0xae6a('0x61'));_0x2734ce[_0xae6a('0x22')](0x194);}else{if(_0x379253[_0xae6a('0x62')]){throw new db['Sequelize'][(_0xae6a('0x55'))]('Interaction\x20already\x20assigned');}}return _0x379253;})['then'](function(_0x2a3639){if(_0x2a3639){return _0x2a3639[_0xae6a('0x2a')]({'closed':_0x5e5803['body']['closed'],'disposition':_0x5e5803[_0xae6a('0x2d')][_0xae6a('0x63')]})[_0xae6a('0x17')](function(_0x316f71){return _0x316f71;});}})['then'](function(){return respondWithRpcPromise(_0xae6a('0x64'),_0xae6a('0x5f'),_0x5e5803[_0xae6a('0x2d')],client9004);})[_0xae6a('0x17')](respondWithResult(_0x2734ce,null))[_0xae6a('0x21')](handleError(_0x2734ce,null));};exports[_0xae6a('0x65')]=function(_0x35322d,_0x2f7403){_0x35322d['body'][_0xae6a('0x2b')]=_0x35322d[_0xae6a('0x66')]['originalname'];_0x35322d[_0xae6a('0x2d')][_0xae6a('0x67')]=_0x35322d[_0xae6a('0x66')][_0xae6a('0x68')];_0x35322d[_0xae6a('0x2d')][_0xae6a('0x33')]=_0x35322d[_0xae6a('0x66')][_0xae6a('0x69')];return db[_0xae6a('0x6a')][_0xae6a('0x42')](_0x35322d['body'])[_0xae6a('0x17')](respondWithResult(_0x2f7403,0xc9))['catch'](handleError(_0x2f7403,null));};exports['attachmentDownload']=function(_0x1165d5,_0x31c015){return db['ChatInteraction'][_0xae6a('0x47')]({'where':{'id':_0x1165d5[_0xae6a('0x43')]['id']},'raw':!![]})[_0xae6a('0x17')](handleEntityNotFound(_0x31c015,null))[_0xae6a('0x17')](function(_0x777720){if(_0x777720){if(_0x777720[_0xae6a('0x6b')]){return _0x31c015['status'](0x193)[_0xae6a('0x25')]({'status':0x193,'message':_0xae6a('0x6c')});}return db[_0xae6a('0x6a')]['findOne']({'where':{'id':_0x1165d5[_0xae6a('0x37')]['attachId']},'raw':!![]})[_0xae6a('0x17')](handleEntityNotFound(_0x31c015,null));}})[_0xae6a('0x17')](function(_0x5022fc){if(_0x5022fc){var _0x44cc44=_0x5022fc[_0xae6a('0x6d')]!==null;var _0x4f3f9d=path['join'](config[_0xae6a('0x6e')],_0xae6a('0x6f'));if(_0x44cc44){_0x4f3f9d=path[_0xae6a('0x70')](_0x4f3f9d,_0xae6a('0x71'));}var _0x3c38b6=path['join'](_0x4f3f9d,_0x5022fc[_0xae6a('0x67')]);return _0x31c015[_0xae6a('0x72')](_0x3c38b6);}})['catch'](handleError(_0x31c015,null));};exports[_0xae6a('0x73')]=function(_0x33ecc9,_0x23ffdd){var _0x42a833=null;var _0x2cf004=null;var _0x1f02b5=null;if(_0x33ecc9[_0xae6a('0x2d')]['id']){delete _0x33ecc9[_0xae6a('0x2d')]['id'];}if(_0x33ecc9['body']['mailTranscript']){_0x1f02b5=path[_0xae6a('0x70')](config['root'],_0xae6a('0x74'),util['format'](_0xae6a('0x75'),Date['now']()));_0x33ecc9[_0xae6a('0x2d')][_0xae6a('0x76')]=_0x1f02b5;}return db['ChatInteraction'][_0xae6a('0x41')]({'where':{'id':_0x33ecc9[_0xae6a('0x43')]['id']},'include':[{'model':db[_0xae6a('0x59')],'as':_0xae6a('0x77'),'include':[{'model':db[_0xae6a('0x78')],'as':'User'}]}]})[_0xae6a('0x17')](handleEntityNotFound(_0x23ffdd,null))[_0xae6a('0x17')](saveUpdates(_0x33ecc9['body'],null))[_0xae6a('0x17')](function(_0x262af3){if(_0x262af3){_0x42a833=_0x262af3;return db['ChatWebsite'][_0xae6a('0x41')]({'where':{'id':_0x42a833[_0xae6a('0x48')]}});}})[_0xae6a('0x17')](function(_0x5f425e){if(_0x5f425e){_0x2cf004=_0x5f425e;return db[_0xae6a('0x5e')][_0xae6a('0x41')]({'where':{'id':_0x42a833[_0xae6a('0x79')]}});}})[_0xae6a('0x17')](function(_0x214b6d){if(_0x214b6d){if(_0x1f02b5){var _0x4eb0cb=null;for(var _0x4af66a=0x1;_0x4af66a<_0x42a833[_0xae6a('0x77')]['length'];++_0x4af66a){_0x4eb0cb=_0x42a833['Messages'][_0x4af66a];var _0x2eacd8=_0x4eb0cb['UserId']?util[_0xae6a('0x7a')](_0xae6a('0x7b'),_0x2cf004[_0xae6a('0x7c')],_0x4eb0cb[_0xae6a('0x62')]):'System';var _0x2db7b4=_0x33ecc9[_0xae6a('0x2d')][_0xae6a('0x7d')]||util['format'](_0xae6a('0x7b'),_0xae6a('0x7e'),_0x4eb0cb[_0xae6a('0x79')]);switch(_0x2cf004[_0xae6a('0x7f')]){case'website_alias':_0x2eacd8=_0x4eb0cb[_0xae6a('0x62')]?util['format']('%s%d',_0x2cf004[_0xae6a('0x7c')],_0x4eb0cb[_0xae6a('0x62')]):_0xae6a('0x80');break;case'agent_alias':_0x2eacd8=_0x4eb0cb[_0xae6a('0x62')]?_0x4eb0cb[_0xae6a('0x78')][_0xae6a('0x81')]||_0x4eb0cb[_0xae6a('0x78')]['fullname']:_0xae6a('0x80');break;case _0xae6a('0x82'):_0x2eacd8=_0x4eb0cb['UserId']?_0x4eb0cb[_0xae6a('0x78')][_0xae6a('0x4c')]:_0xae6a('0x80');break;default:_0x2eacd8=_0x4eb0cb['UserId']?util[_0xae6a('0x7a')](_0xae6a('0x7b'),_0x2cf004[_0xae6a('0x7c')],_0x4eb0cb['UserId']):'System';}var _0x3a34c6=util['format'](_0xae6a('0x83'),moment(_0x4eb0cb['createdAt'])[_0xae6a('0x7a')](_0xae6a('0x84')),_0x4eb0cb[_0xae6a('0x85')]==='in'?_0x2db7b4:_0x2eacd8,_0x4eb0cb[_0xae6a('0x2d')]);if(!_0x4eb0cb['secret']){fs[_0xae6a('0x86')](_0x1f02b5,_0x3a34c6);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xae6a('0x87')],'as':_0xae6a('0x88'),'raw':!![],'include':[{'model':db[_0xae6a('0x89')],'as':_0xae6a('0x89'),'raw':!![]}]}]});}}})[_0xae6a('0x17')](function(_0x48e3e4){if(!_0x48e3e4||!_0x48e3e4[_0xae6a('0x88')]||!_0x33ecc9[_0xae6a('0x2d')])return _0x42a833;var _0x4737d2=_0x48e3e4[_0xae6a('0x8a')]();return respondWithRpcPromise(_0xae6a('0x8b'),_0xae6a('0x8c'),{'account':_0x4737d2,'message':{'from':util[_0xae6a('0x7a')](_0xae6a('0x8d'),_0x48e3e4['name'],_0x48e3e4[_0xae6a('0x50')]||_0x48e3e4[_0xae6a('0x88')][_0xae6a('0x38')]),'to':_0x33ecc9[_0xae6a('0x2d')][_0xae6a('0x8e')],'subject':_0xae6a('0x8f'),'text':util[_0xae6a('0x7a')](_0xae6a('0x90'),_0x33ecc9[_0xae6a('0x2d')]['mailTranscript']),'attachments':[{'path':_0x1f02b5}]}})['then'](function(){return _0x42a833;})[_0xae6a('0x21')](function(_0x17c3ed){logger['error'](_0x17c3ed);});})['then'](respondWithStatusCode(_0x23ffdd,0xc8))[_0xae6a('0x21')](handleError(_0x23ffdd,null));};exports['addMessage']=function(_0x11f794,_0x126fe1){return db[_0xae6a('0x59')][_0xae6a('0x41')]({'where':{'id':_0x11f794[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x126fe1,null))[_0xae6a('0x17')](function(_0x337d64){if(_0x337d64){return _0x337d64['addMessage'](_0x11f794['body']['ids'],_[_0xae6a('0x91')](_0x11f794[_0xae6a('0x2d')],[_0xae6a('0x92'),'id'])||{});}})['then'](respondWithResult(_0x126fe1,null))[_0xae6a('0x21')](handleError(_0x126fe1,null));};exports[_0xae6a('0x93')]=function(_0xc15337,_0x4e2e2d){var _0x1df31a={'raw':![],'where':{}};var _0x4102f4={};var _0x502b73={'count':0x0,'rows':[]};return db[_0xae6a('0x3b')][_0xae6a('0x47')]({'where':{'id':_0xc15337[_0xae6a('0x43')]['id']}})['then'](handleEntityNotFound(_0x4e2e2d,null))[_0xae6a('0x17')](function(_0x2aa14e){if(_0x2aa14e){_0x4102f4[_0xae6a('0x3a')]=_['keys'](db[_0xae6a('0x59')][_0xae6a('0x31')]);_0x4102f4['query']=_[_0xae6a('0x3c')](_0xc15337[_0xae6a('0x37')]);_0x4102f4[_0xae6a('0x94')]=_[_0xae6a('0x3e')](_0x4102f4[_0xae6a('0x3a')],_0x4102f4['query']);_0x1df31a['attributes']=_[_0xae6a('0x3e')](_0x4102f4[_0xae6a('0x3a')],qs[_0xae6a('0x3f')](_0xc15337['query']['fields']));_0x1df31a['attributes']=_0x1df31a[_0xae6a('0x3d')][_0xae6a('0x95')]?_0x1df31a[_0xae6a('0x3d')]:_0x4102f4[_0xae6a('0x3a')];if(!_0xc15337['query'][_0xae6a('0x96')](_0xae6a('0x97'))){_0x1df31a['limit']=qs[_0xae6a('0x29')](_0xc15337['query'][_0xae6a('0x29')]);_0x1df31a[_0xae6a('0x26')]=qs[_0xae6a('0x26')](_0xc15337['query'][_0xae6a('0x26')]);}_0x1df31a['order']=qs[_0xae6a('0x98')](_0xc15337[_0xae6a('0x37')][_0xae6a('0x98')]);_0x1df31a['where']=qs[_0xae6a('0x94')](_['pick'](_0xc15337[_0xae6a('0x37')],_0x4102f4[_0xae6a('0x94')]));_0x1df31a['where']['ChatInteractionId']=_0x2aa14e['id'];if(_0xc15337['query']['filter']){_0x1df31a[_0xae6a('0x99')]=_[_0xae6a('0x9a')](_0x1df31a[_0xae6a('0x99')],{'$or':_[_0xae6a('0x9b')](_0x1df31a[_0xae6a('0x3d')],function(_0x27d60e){var _0x5f3baf={};_0x5f3baf[_0x27d60e]={'$like':'%'+_0xc15337['query'][_0xae6a('0x9c')]+'%'};return _0x5f3baf;})});}if(_0xc15337[_0xae6a('0x37')][_0xae6a('0x9d')]){var _0x3c1174=_0xc15337['query'][_0xae6a('0x9d')][_0xae6a('0x9e')](',');var _0x37c322={};_0x37c322[_0x3c1174[0x0]]={'$gte':moment(_0x3c1174[0x1])[_0xae6a('0x7a')](_0xae6a('0x9f'))};_0x1df31a[_0xae6a('0x99')]=_[_0xae6a('0x9a')](_0x1df31a[_0xae6a('0x99')],_0x37c322);}_0x1df31a=_[_0xae6a('0x9a')]({},_0x1df31a,_0xc15337[_0xae6a('0x40')]);return db[_0xae6a('0x59')][_0xae6a('0x28')]({'where':_0x1df31a[_0xae6a('0x99')]})[_0xae6a('0x17')](function(_0x3ccf5d){_0x502b73['count']=_0x3ccf5d;if(_0xc15337[_0xae6a('0x37')]['includeAll']){_0x1df31a[_0xae6a('0xa0')]=[{'all':!![]}];}return db[_0xae6a('0x59')][_0xae6a('0x35')](_0x1df31a);})[_0xae6a('0x17')](function(_0x2a51f3){_0x502b73[_0xae6a('0xa1')]=_0x2a51f3;return _0x502b73;});}})['then'](respondWithFilteredResult(_0x4e2e2d,_0x1df31a))[_0xae6a('0x21')](handleError(_0x4e2e2d,null));};exports[_0xae6a('0xa2')]=function(_0x467efb,_0x46b413){var _0x2ee7b2={'where':{}},_0x1e618a={},_0x1a0101={'count':0x0,'rows':[]};return db[_0xae6a('0x3b')][_0xae6a('0x47')]({'where':{'id':_0x467efb['params']['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x46b413,null))[_0xae6a('0x17')](function(_0x58b88e){if(_0x58b88e){_0x1e618a[_0xae6a('0x3a')]=_['keys'](db[_0xae6a('0x59')][_0xae6a('0x31')]);_0x1e618a['query']=_['keys'](_0x467efb[_0xae6a('0x37')]);_0x1e618a[_0xae6a('0x94')]=_[_0xae6a('0x3e')](_0x1e618a[_0xae6a('0x3a')],_0x1e618a['query']);_0x2ee7b2['attributes']=_[_0xae6a('0x3e')](_0x1e618a[_0xae6a('0x3a')],qs['fields'](_0x467efb[_0xae6a('0x37')][_0xae6a('0x3f')]));_0x2ee7b2[_0xae6a('0x3d')]=_0x2ee7b2[_0xae6a('0x3d')][_0xae6a('0x95')]?_0x2ee7b2['attributes']:_0x1e618a[_0xae6a('0x3a')];if(!_0x467efb[_0xae6a('0x37')][_0xae6a('0x96')]('nolimit')){_0x2ee7b2[_0xae6a('0x29')]=qs[_0xae6a('0x29')](_0x467efb[_0xae6a('0x37')][_0xae6a('0x29')]);_0x2ee7b2[_0xae6a('0x26')]=qs['offset'](_0x467efb[_0xae6a('0x37')]['offset']);}_0x2ee7b2[_0xae6a('0xa3')]=qs['sort'](_0x467efb['query'][_0xae6a('0x98')]);_0x2ee7b2['where']=qs[_0xae6a('0x94')](_[_0xae6a('0xa4')](_0x467efb[_0xae6a('0x37')],_0x1e618a[_0xae6a('0x94')]));_0x2ee7b2[_0xae6a('0x99')][_0xae6a('0xa5')]=_0x58b88e['id'];if(_0x467efb['query'][_0xae6a('0x9c')]){_0x2ee7b2[_0xae6a('0x99')]=_[_0xae6a('0x9a')](_0x2ee7b2[_0xae6a('0x99')],{'$or':_['map'](_0x2ee7b2['attributes'],function(_0x2f8472){var _0xf46d66={};_0xf46d66[_0x2f8472]={'$like':'%'+_0x467efb[_0xae6a('0x37')]['filter']+'%'};return _0xf46d66;})});}_0x2ee7b2[_0xae6a('0x99')][_0xae6a('0xa6')]=![];if(_0x467efb[_0xae6a('0x37')]['id']){_0x2ee7b2['where']['id']={'$gt':_0x467efb[_0xae6a('0x37')]['id']};}_0x2ee7b2=_[_0xae6a('0x9a')]({},_0x2ee7b2,_0x467efb[_0xae6a('0x40')]);return db['ChatMessage'][_0xae6a('0x28')]({'where':_0x2ee7b2[_0xae6a('0x99')]})[_0xae6a('0x17')](function(_0x42dd4e){_0x1a0101['count']=_0x42dd4e;_0x2ee7b2[_0xae6a('0xa0')]=[];if(_0x467efb[_0xae6a('0x37')][_0xae6a('0xa7')]){_0x2ee7b2[_0xae6a('0xa0')]['push']({'model':db[_0xae6a('0x78')],'as':_0xae6a('0x78'),'attributes':['id',_0xae6a('0x4c'),_0xae6a('0x81')]});}if(_0x467efb['query'][_0xae6a('0xa8')]){_0x2ee7b2[_0xae6a('0xa0')]=[{'all':!![]}];}return db[_0xae6a('0x59')][_0xae6a('0x35')](_0x2ee7b2);})[_0xae6a('0x17')](function(_0x30737d){_0x1a0101['rows']=_0x30737d;return _0x1a0101;});}})['then'](respondWithFilteredResult(_0x46b413,_0x2ee7b2))[_0xae6a('0x21')](handleError(_0x46b413,null));};exports[_0xae6a('0xa9')]=function(_0x2bfc9a,_0x2bafb3){return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0x2bfc9a[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x2bafb3,null))[_0xae6a('0x17')](function(_0x85d6c5){if(_0x85d6c5){return _0x85d6c5['setTags'](_0x2bfc9a[_0xae6a('0x2d')][_0xae6a('0x92')],_['omit'](_0x2bfc9a[_0xae6a('0x2d')],['ids','id'])||{})[_0xae6a('0xaa')](function(){return db[_0xae6a('0xab')][_0xae6a('0x35')]({'attributes':['id',_0xae6a('0x2b'),_0xae6a('0xac')],'where':{'id':_0x2bfc9a[_0xae6a('0x2d')][_0xae6a('0x92')]}});})[_0xae6a('0x17')](function(_0x324adb){socket[_0xae6a('0xad')](_0xae6a('0xae'),{'id':Number(_0x2bfc9a['params']['id']),'tags':_0x324adb||[]});return{'id':Number(_0x2bfc9a['params']['id']),'tags':_0x324adb||[]};});}})[_0xae6a('0x17')](respondWithResult(_0x2bafb3,null))['catch'](handleError(_0x2bafb3,null));};exports[_0xae6a('0xaf')]=function(_0x354a3b,_0x246434){return db['ChatInteraction'][_0xae6a('0x41')]({'where':{'id':_0x354a3b[_0xae6a('0x43')]['id']}})[_0xae6a('0x17')](handleEntityNotFound(_0x246434,null))[_0xae6a('0x17')](function(_0x250ddb){if(_0x250ddb){return _0x250ddb[_0xae6a('0xaf')](_0x354a3b[_0xae6a('0x37')][_0xae6a('0x92')]);}})['then'](respondWithStatusCode(_0x246434,null))['catch'](handleError(_0x246434,null));};exports['download']=function(_0x585885,_0x16e591){var _0xcede78=moment()[_0xae6a('0xb0')]()[_0xae6a('0xb1')]();var _0x4b6e9d=path['join'](config[_0xae6a('0x6e')],'server','files','tmp');var _0x52be63=path[_0xae6a('0x70')](config[_0xae6a('0x6e')],_0xae6a('0xb2'),_0xae6a('0xb3'),_0xae6a('0xb4'));var _0x317b65=path['join'](_0x4b6e9d,_0xcede78);var _0x12c801=util[_0xae6a('0x7a')](_0xae6a('0xb5'),_0x585885[_0xae6a('0x43')]['id'],_0xcede78);var _0x105860=path[_0xae6a('0x70')](_0x4b6e9d,_0x12c801);var _0x3bcf83=[];_0x3bcf83[_0xae6a('0xb6')]({'model':db[_0xae6a('0x78')],'as':'User','attributes':['id',_0xae6a('0x4c')],'raw':!![]});_0x3bcf83[_0xae6a('0xb6')]({'model':db['CmContact'],'as':'Contact','attributes':['id',_0xae6a('0xb7'),_0xae6a('0xb8')],'raw':!![]});if(_0x585885[_0xae6a('0x37')][_0xae6a('0xb4')]){_0x3bcf83['push']({'model':db[_0xae6a('0x6a')],'as':'Attachment','raw':!![]});}var _0x5eba4b=[{'model':db[_0xae6a('0x59')],'as':_0xae6a('0x77'),'attributes':['id','body','createdAt',_0xae6a('0x85'),_0xae6a('0xa6'),_0xae6a('0xb9')],'include':_0x3bcf83}];_0x5eba4b['push']({'model':db[_0xae6a('0xba')],'as':_0xae6a('0xbb'),'attributes':['id',_0xae6a('0x2b')]});_0x5eba4b[_0xae6a('0xb6')]({'model':db['User'],'as':_0xae6a('0xbc'),'attributes':['id',_0xae6a('0x4c')]});return db[_0xae6a('0x3b')][_0xae6a('0x41')]({'where':{'id':_0x585885[_0xae6a('0x43')]['id']},'include':_0x5eba4b})[_0xae6a('0x17')](handleEntityNotFound(_0x16e591,null))[_0xae6a('0x17')](function(_0x5d0f25){if(_0x5d0f25){var _0x308352=_0x5d0f25['get']({'plain':!![]});fs[_0xae6a('0xbd')](_0x317b65);var _0x2a6113={'channel':_0xae6a('0xbe'),'account':_0x308352['Account']['name'],'agent':_0x308352[_0xae6a('0xbc')]?_0x308352[_0xae6a('0xbc')]['fullname']:'N.A.','createdAt':moment(_0x308352[_0xae6a('0xbf')])[_0xae6a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae6a('0xb1')](),'closedAt':_0x308352[_0xae6a('0x6b')]?moment(_0x308352[_0xae6a('0xc0')])[_0xae6a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae6a('0xb1')]():'','disposition':_0x308352['disposition'],'chatInfo':{'browser':_0x308352['browserName'],'os':_0x308352[_0xae6a('0xc1')],'referer':_0x308352[_0xae6a('0xc2')],'customerIp':_0x308352[_0xae6a('0xc3')],'customerPort':_0x308352[_0xae6a('0xc4')]?_0x308352[_0xae6a('0xc4')]:_0xae6a('0xc5')},'messages':_(_0x308352['Messages'])[_0xae6a('0xc6')]()['filter']({'secret':![]})['map'](function(_0x48d949){if(_0x48d949[_0xae6a('0x6a')]){var _0x28af58=path[_0xae6a('0x70')](_0x52be63,_0x48d949[_0xae6a('0x6a')][_0xae6a('0x67')]);if(fs[_0xae6a('0xc7')](_0x28af58)){fs['createReadStream'](_0x28af58)[_0xae6a('0xc8')](fs['createWriteStream'](path['join'](_0x317b65,_0x48d949[_0xae6a('0x6a')][_0xae6a('0x67')])));}}return{'date':moment(_0x48d949['createdAt'])[_0xae6a('0x7a')]('YYYY-MM-DD\x20HH:mm:ss')[_0xae6a('0xb1')](),'sender':_0x48d949[_0xae6a('0x85')]===_0xae6a('0xc9')?_0x48d949['User']?_0x48d949[_0xae6a('0x78')][_0xae6a('0x4c')]:_0xae6a('0x80'):_0x48d949[_0xae6a('0xca')][_0xae6a('0xb7')]+(_0x48d949[_0xae6a('0xca')][_0xae6a('0xb8')]?'\x20'+_0x48d949[_0xae6a('0xca')][_0xae6a('0xb8')]:''),'body':_0x48d949[_0xae6a('0x6a')]?_0x48d949[_0xae6a('0x6a')][_0xae6a('0x67')]:_0x48d949[_0xae6a('0x2d')],'direction':_0x48d949['direction']===_0xae6a('0xc9')?'A':'C','secret':_0x48d949[_0xae6a('0xa6')],'read':_0x48d949[_0xae6a('0xb9')],'attachment':_0x48d949['Attachment']};})[_0xae6a('0xcb')]()};return ejs[_0xae6a('0xcc')](path[_0xae6a('0x70')](config[_0xae6a('0x6e')],_0xae6a('0xb2'),_0xae6a('0xcd'),_0xae6a('0xce')),{'interaction':_0x2a6113})['then'](function(_0x324b90){var _0x575dfe=path[_0xae6a('0x70')](_0x317b65,_0xae6a('0xcf')+_0x308352['id']+'-'+_0xcede78+'.pdf');var _0x3024df={'path':_0x575dfe,'channel':_0xae6a('0xbe'),'interactionId':_0x308352['id']};return pdf[_0xae6a('0xd0')](_0x324b90,_0x3024df);})[_0xae6a('0x17')](function(){return new Promise(function(_0x4af8bd,_0x2721d3){zipdir(_0x317b65,{'saveTo':_0x105860},function(_0x4fea87,_0x2a9af6){if(_0x4fea87)return _0x2721d3(_0x4fea87);return _0x4af8bd(_0x2a9af6);});})['then'](function(){return new BPromise(function(_0x282223,_0x2ccf18){rimraf(_0x317b65,function(_0x41dfee){if(_0x41dfee)_0x2ccf18(_0x41dfee);return _0x282223();});});})[_0xae6a('0x17')](function(){return _0x16e591[_0xae6a('0x72')](_0x105860,_0x12c801,function(_0x2ff712){if(_0x2ff712){logger[_0xae6a('0x1d')](_0xae6a('0xd1'),_0x2ff712);}else{fs[_0xae6a('0xd2')](_0x105860);}});});});}else{return _0x16e591[_0xae6a('0x22')](0xc8);}})[_0xae6a('0x21')](handleError(_0x16e591,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8a29c1d..a5c3a6d 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 _0xd563=['update','remove','getUsers','then','setDataValue','Users','unreadMessages','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save'];(function(_0x74e673,_0x15b0c7){var _0x479ed8=function(_0x2f5e98){while(--_0x2f5e98){_0x74e673['push'](_0x74e673['shift']());}};_0x479ed8(++_0x15b0c7);}(_0xd563,0x182));var _0x3d56=function(_0x5670f2,_0x1ce340){_0x5670f2=_0x5670f2-0x0;var _0x1f8715=_0xd563[_0x5670f2];return _0x1f8715;};'use strict';var EventEmitter=require(_0x3d56('0x0'));var ChatInteraction=require(_0x3d56('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0x3d56('0x1'))['db'][_0x3d56('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x3d56('0x3')](0x0);var events={'afterCreate':_0x3d56('0x4'),'afterUpdate':_0x3d56('0x5'),'afterDestroy':_0x3d56('0x6')};function emitEvent(_0x13642a){return function(_0x57fad5,_0x5f2f77,_0x58bc46){_0x57fad5[_0x3d56('0x7')]({'attributes':['id'],'raw':!![]})[_0x3d56('0x8')](function(_0x17572f){_0x57fad5[_0x3d56('0x9')](_0x3d56('0xa'),_0x17572f['map'](function(_0x1179db){return{'id':_0x1179db['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x57fad5['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3d56('0x8')](function(_0x215aed){_0x57fad5['setDataValue'](_0x3d56('0xb'),_0x215aed[_0x3d56('0xc')]);ChatInteractionEvents[_0x3d56('0xd')](_0x13642a+':'+_0x57fad5['id'],_0x57fad5);ChatInteractionEvents[_0x3d56('0xd')](_0x13642a,_0x57fad5);_0x58bc46(null);})[_0x3d56('0xe')](_0x58bc46(null));};}for(var e in events){if(events[_0x3d56('0xf')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x3d56('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xca2b=['getUsers','map','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','save','update','remove'];(function(_0x575006,_0x26719a){var _0x183b83=function(_0x488b77){while(--_0x488b77){_0x575006['push'](_0x575006['shift']());}};_0x183b83(++_0x26719a);}(_0xca2b,0x8a));var _0xbca2=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xca2b[_0x21a9d9];return _0x46adce;};'use strict';var EventEmitter=require(_0xbca2('0x0'));var ChatInteraction=require(_0xbca2('0x1'))['db'][_0xbca2('0x2')];var ChatMessage=require(_0xbca2('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbca2('0x3'),'afterUpdate':_0xbca2('0x4'),'afterDestroy':_0xbca2('0x5')};function emitEvent(_0x4fe21b){return function(_0xd54425,_0x43cacf,_0x567b50){_0xd54425[_0xbca2('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x9011ef){_0xd54425['setDataValue']('Users',_0x9011ef[_0xbca2('0x7')](function(_0x543c0f){return{'id':_0x543c0f['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0xd54425['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x6643df){_0xd54425[_0xbca2('0x8')](_0xbca2('0x9'),_0x6643df[_0xbca2('0xa')]);ChatInteractionEvents[_0xbca2('0xb')](_0x4fe21b+':'+_0xd54425['id'],_0xd54425);ChatInteractionEvents[_0xbca2('0xb')](_0x4fe21b,_0xd54425);_0x567b50(null);})[_0xbca2('0xc')](_0x567b50(null));};}for(var e in events){if(events[_0xbca2('0xd')](e)){var event=events[e];ChatInteraction[_0xbca2('0xe')](e,emitEvent(event));}}module[_0xbca2('0xf')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index d2d8050..825e8e7 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 _0xb5d3=['path','rimraf','./chatInteraction.attributes','define','ChatInteraction','chat_interactions','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment'];(function(_0x366783,_0x339fd8){var _0x3562b7=function(_0x29b013){while(--_0x29b013){_0x366783['push'](_0x366783['shift']());}};_0x3562b7(++_0x339fd8);}(_0xb5d3,0xa2));var _0x3b5d=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0xb5d3[_0x2e913b];return _0x173899;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3b5d('0x0'))(_0x3b5d('0x1'));var moment=require(_0x3b5d('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3b5d('0x3'));var rimraf=require(_0x3b5d('0x4'));var config=require('../../config/environment');var attributes=require(_0x3b5d('0x5'));module['exports']=function(_0x510b41,_0x15a7ad){return _0x510b41[_0x3b5d('0x6')](_0x3b5d('0x7'),attributes,{'tableName':_0x3b5d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x51d9d4,_0x2966ef,_0x3d2cf0){if(_0x51d9d4['changed'](_0x3b5d('0x9'))){_0x51d9d4[_0x3b5d('0xa')]=moment()[_0x3b5d('0xb')](_0x3b5d('0xc'));}_0x3d2cf0(null,_0x51d9d4);}},'charset':_0x3b5d('0xd'),'collate':_0x3b5d('0xe')});}; \ No newline at end of file +var _0x3f8c=['api','moment','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','lodash','util','../../config/logger'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x3f8c,0x1a6));var _0xc3f8=function(_0x5796a6,_0x20267a){_0x5796a6=_0x5796a6-0x0;var _0x1370da=_0x3f8c[_0x5796a6];return _0x1370da;};'use strict';var _=require(_0xc3f8('0x0'));var util=require(_0xc3f8('0x1'));var logger=require(_0xc3f8('0x2'))(_0xc3f8('0x3'));var moment=require(_0xc3f8('0x4'));var BPromise=require('bluebird');var rp=require(_0xc3f8('0x5'));var fs=require('fs');var path=require(_0xc3f8('0x6'));var rimraf=require('rimraf');var config=require(_0xc3f8('0x7'));var attributes=require(_0xc3f8('0x8'));module[_0xc3f8('0x9')]=function(_0x53ca64,_0x555dcb){return _0x53ca64[_0xc3f8('0xa')](_0xc3f8('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x228893,_0x110afe,_0x3ce100){if(_0x228893['changed'](_0xc3f8('0xc'))){_0x228893[_0xc3f8('0xd')]=moment()[_0xc3f8('0xe')](_0xc3f8('0xf'));}_0x3ce100(null,_0x228893);}},'charset':_0xc3f8('0x10'),'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 cbfff7f..fc78229 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 _0x1117=['ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateChatInteraction','ChatInteraction','update','body','options','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x46ef1d,_0x24926){var _0x49ce69=function(_0x5db4fc){while(--_0x5db4fc){_0x46ef1d['push'](_0x46ef1d['shift']());}};_0x49ce69(++_0x24926);}(_0x1117,0x117));var _0x7111=function(_0x458eef,_0x551783){_0x458eef=_0x458eef-0x0;var _0x2fb384=_0x1117[_0x458eef];return _0x2fb384;};'use strict';var _=require('lodash');var util=require(_0x7111('0x0'));var moment=require(_0x7111('0x1'));var BPromise=require(_0x7111('0x2'));var rs=require(_0x7111('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7111('0x4'))['db'];var utils=require(_0x7111('0x5'));var logger=require('../../config/logger')(_0x7111('0x6'));var config=require(_0x7111('0x7'));var jayson=require(_0x7111('0x8'));var client=jayson[_0x7111('0x9')][_0x7111('0xa')]({'port':0x232a});config[_0x7111('0xb')]=_[_0x7111('0xc')](config[_0x7111('0xb')],{'host':_0x7111('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7111('0xb')]));require(_0x7111('0xe'))[_0x7111('0xf')](socket);function respondWithRpcPromise(_0x22794c,_0xfb969c,_0x1f3988){return new BPromise(function(_0x39e9d7,_0x16549e){return client[_0x7111('0x10')](_0x22794c,_0x1f3988)[_0x7111('0x11')](function(_0x157181){logger[_0x7111('0x12')](_0x7111('0x13'),_0xfb969c,_0x7111('0x14'));logger[_0x7111('0x15')](_0x7111('0x16'),_0xfb969c,_0x7111('0x14'),JSON[_0x7111('0x17')](_0x157181));if(_0x157181[_0x7111('0x18')]){if(_0x157181[_0x7111('0x18')][_0x7111('0x19')]===0x1f4){logger[_0x7111('0x18')](_0x7111('0x13'),_0xfb969c,_0x157181[_0x7111('0x18')]['message']);return _0x16549e(_0x157181[_0x7111('0x18')][_0x7111('0x1a')]);}logger['error'](_0x7111('0x13'),_0xfb969c,_0x157181[_0x7111('0x18')][_0x7111('0x1a')]);return _0x39e9d7(_0x157181[_0x7111('0x18')][_0x7111('0x1a')]);}else{logger[_0x7111('0x12')](_0x7111('0x13'),_0xfb969c,_0x7111('0x14'));_0x39e9d7(_0x157181[_0x7111('0x1b')][_0x7111('0x1a')]);}})['catch'](function(_0x45cde5){logger[_0x7111('0x18')](_0x7111('0x13'),_0xfb969c,_0x45cde5);_0x16549e(_0x45cde5);});});}exports[_0x7111('0x1c')]=function(_0x3f620e){var _0x29e27b=this;return new Promise(function(_0x346579,_0x250bd0){return db[_0x7111('0x1d')][_0x7111('0x1e')](_0x3f620e[_0x7111('0x1f')],{'raw':_0x3f620e[_0x7111('0x20')]?_0x3f620e[_0x7111('0x20')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f620e[_0x7111('0x20')]?_0x3f620e['options'][_0x7111('0x21')]||null:null,'attributes':_0x3f620e[_0x7111('0x20')]?_0x3f620e[_0x7111('0x20')][_0x7111('0x22')]||null:null,'limit':_0x3f620e['options']?_0x3f620e[_0x7111('0x20')][_0x7111('0x23')]||null:null})[_0x7111('0x11')](function(_0x1bca1f){logger[_0x7111('0x12')](_0x7111('0x1c'),_0x3f620e);logger['debug'](_0x7111('0x1c'),_0x3f620e,JSON['stringify'](_0x1bca1f));_0x346579(_0x1bca1f);})[_0x7111('0x24')](function(_0x251f22){logger['error'](_0x7111('0x1c'),_0x251f22[_0x7111('0x1a')],_0x3f620e);_0x250bd0(_0x29e27b[_0x7111('0x18')](0x1f4,_0x251f22['message']));});});};exports[_0x7111('0x25')]=function(_0x1f3f30){return new Promise(function(_0x278afa,_0x9ad464){return db['ChatInteraction'][_0x7111('0x26')]({'where':_0x1f3f30[_0x7111('0x20')]?_0x1f3f30[_0x7111('0x20')][_0x7111('0x21')]||null:null})[_0x7111('0x11')](function(_0x24277d){if(_0x24277d){return _0x24277d[_0x7111('0x27')](_0x1f3f30[_0x7111('0x1f')][_0x7111('0x28')],_[_0x7111('0x29')](_0x1f3f30[_0x7111('0x1f')],[_0x7111('0x28'),'id'])||{});}})['spread'](function(_0xfcfd8d){logger[_0x7111('0x12')](_0x7111('0x2a'),_0x1f3f30);logger[_0x7111('0x15')](_0x7111('0x2a'),_0x1f3f30,JSON[_0x7111('0x17')](_0xfcfd8d));_0x278afa(_0xfcfd8d);})[_0x7111('0x24')](function(_0x39df17){logger[_0x7111('0x18')](_0x7111('0x2a'),_0x39df17[_0x7111('0x1a')],_0x1f3f30);_0x9ad464(_this[_0x7111('0x18')](0x1f4,_0x39df17[_0x7111('0x1a')]));});});}; \ No newline at end of file +var _0xfa89=['message','result','catch','UpdateChatInteraction','ChatInteraction','body','options','where','attributes','stringify','AddTagsToChatInteraction','find','ids','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','./chatInteraction.socket','register','request','then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','ChatInteraction,\x20%s,\x20%s'];(function(_0x1833e7,_0x37bda7){var _0x37ee75=function(_0x5b8a59){while(--_0x5b8a59){_0x1833e7['push'](_0x1833e7['shift']());}};_0x37ee75(++_0x37bda7);}(_0xfa89,0xa7));var _0x9fa8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfa89[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x9fa8('0x0'));var moment=require(_0x9fa8('0x1'));var BPromise=require(_0x9fa8('0x2'));var rs=require(_0x9fa8('0x3'));var fs=require('fs');var Redis=require(_0x9fa8('0x4'));var db=require(_0x9fa8('0x5'))['db'];var utils=require(_0x9fa8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x9fa8('0x7'));var jayson=require(_0x9fa8('0x8'));var client=jayson['client'][_0x9fa8('0x9')]({'port':0x232a});config[_0x9fa8('0xa')]=_[_0x9fa8('0xb')](config[_0x9fa8('0xa')],{'host':_0x9fa8('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9fa8('0xa')]));require(_0x9fa8('0xd'))[_0x9fa8('0xe')](socket);function respondWithRpcPromise(_0x951e87,_0x2b68c1,_0x334fdd){return new BPromise(function(_0xee411b,_0x9cd50f){return client[_0x9fa8('0xf')](_0x951e87,_0x334fdd)[_0x9fa8('0x10')](function(_0x551ff9){logger[_0x9fa8('0x11')]('ChatInteraction,\x20%s,\x20%s',_0x2b68c1,_0x9fa8('0x12'));logger[_0x9fa8('0x13')](_0x9fa8('0x14'),_0x2b68c1,_0x9fa8('0x12'),JSON['stringify'](_0x551ff9));if(_0x551ff9['error']){if(_0x551ff9['error']['code']===0x1f4){logger[_0x9fa8('0x15')](_0x9fa8('0x16'),_0x2b68c1,_0x551ff9[_0x9fa8('0x15')][_0x9fa8('0x17')]);return _0x9cd50f(_0x551ff9[_0x9fa8('0x15')][_0x9fa8('0x17')]);}logger[_0x9fa8('0x15')](_0x9fa8('0x16'),_0x2b68c1,_0x551ff9['error'][_0x9fa8('0x17')]);return _0xee411b(_0x551ff9['error']['message']);}else{logger[_0x9fa8('0x11')](_0x9fa8('0x16'),_0x2b68c1,'request\x20sent');_0xee411b(_0x551ff9[_0x9fa8('0x18')][_0x9fa8('0x17')]);}})[_0x9fa8('0x19')](function(_0x11ca25){logger['error'](_0x9fa8('0x16'),_0x2b68c1,_0x11ca25);_0x9cd50f(_0x11ca25);});});}exports[_0x9fa8('0x1a')]=function(_0x52f2cd){var _0x396147=this;return new Promise(function(_0x3a726a,_0x491767){return db[_0x9fa8('0x1b')]['update'](_0x52f2cd[_0x9fa8('0x1c')],{'raw':_0x52f2cd[_0x9fa8('0x1d')]?_0x52f2cd[_0x9fa8('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x52f2cd[_0x9fa8('0x1d')]?_0x52f2cd[_0x9fa8('0x1d')][_0x9fa8('0x1e')]||null:null,'attributes':_0x52f2cd[_0x9fa8('0x1d')]?_0x52f2cd[_0x9fa8('0x1d')][_0x9fa8('0x1f')]||null:null,'limit':_0x52f2cd['options']?_0x52f2cd[_0x9fa8('0x1d')]['limit']||null:null})[_0x9fa8('0x10')](function(_0x4e3c95){logger[_0x9fa8('0x11')]('UpdateChatInteraction',_0x52f2cd);logger[_0x9fa8('0x13')](_0x9fa8('0x1a'),_0x52f2cd,JSON[_0x9fa8('0x20')](_0x4e3c95));_0x3a726a(_0x4e3c95);})[_0x9fa8('0x19')](function(_0x470b6e){logger[_0x9fa8('0x15')](_0x9fa8('0x1a'),_0x470b6e[_0x9fa8('0x17')],_0x52f2cd);_0x491767(_0x396147[_0x9fa8('0x15')](0x1f4,_0x470b6e[_0x9fa8('0x17')]));});});};exports[_0x9fa8('0x21')]=function(_0x4f84d7){return new Promise(function(_0xa7e9e9,_0x78b12d){return db[_0x9fa8('0x1b')][_0x9fa8('0x22')]({'where':_0x4f84d7[_0x9fa8('0x1d')]?_0x4f84d7['options'][_0x9fa8('0x1e')]||null:null})[_0x9fa8('0x10')](function(_0x4d6711){if(_0x4d6711){return _0x4d6711['addTags'](_0x4f84d7[_0x9fa8('0x1c')]['ids'],_['omit'](_0x4f84d7[_0x9fa8('0x1c')],[_0x9fa8('0x23'),'id'])||{});}})[_0x9fa8('0x24')](function(_0x215867){logger['info'](_0x9fa8('0x25'),_0x4f84d7);logger['debug']('AddTags',_0x4f84d7,JSON[_0x9fa8('0x20')](_0x215867));_0xa7e9e9(_0x215867);})[_0x9fa8('0x19')](function(_0x5d825a){logger['error'](_0x9fa8('0x25'),_0x5d825a[_0x9fa8('0x17')],_0x4f84d7);_0x78b12d(_this['error'](0x1f4,_0x5d825a['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 0db110e..c88067b 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 _0x5d9d=['length','./chatInteraction.events','save','remove','update','emit','removeListener','register'];(function(_0x3c7db0,_0x5a8f48){var _0x4e1435=function(_0x5367fe){while(--_0x5367fe){_0x3c7db0['push'](_0x3c7db0['shift']());}};_0x4e1435(++_0x5a8f48);}(_0x5d9d,0x101));var _0xd5d9=function(_0x4c3f98,_0x30a8a6){_0x4c3f98=_0x4c3f98-0x0;var _0x54612c=_0x5d9d[_0x4c3f98];return _0x54612c;};'use strict';var ChatInteractionEvents=require(_0xd5d9('0x0'));var events=[_0xd5d9('0x1'),_0xd5d9('0x2'),_0xd5d9('0x3')];function createListener(_0x1c1b10,_0x21a891){return function(_0x5ea221){_0x21a891[_0xd5d9('0x4')](_0x1c1b10,_0x5ea221);};}function removeListener(_0x2bc6a1,_0x44f8e2){return function(){ChatInteractionEvents[_0xd5d9('0x5')](_0x2bc6a1,_0x44f8e2);};}exports[_0xd5d9('0x6')]=function(_0x1233dc){for(var _0x2c489e=0x0,_0x3833fe=events[_0xd5d9('0x7')];_0x2c489e<_0x3833fe;_0x2c489e++){var _0x211416=events[_0x2c489e];var _0x2a673a=createListener('chatInteraction:'+_0x211416,_0x1233dc);ChatInteractionEvents['on'](_0x211416,_0x2a673a);}}; \ No newline at end of file +var _0x7eea=['./chatInteraction.events','save','remove','update','emit','removeListener','chatInteraction:'];(function(_0x2849f5,_0x5d2c3f){var _0x2aa0e4=function(_0xb415a7){while(--_0xb415a7){_0x2849f5['push'](_0x2849f5['shift']());}};_0x2aa0e4(++_0x5d2c3f);}(_0x7eea,0x7e));var _0xa7ee=function(_0x395152,_0x1507a8){_0x395152=_0x395152-0x0;var _0x373b2f=_0x7eea[_0x395152];return _0x373b2f;};'use strict';var ChatInteractionEvents=require(_0xa7ee('0x0'));var events=[_0xa7ee('0x1'),_0xa7ee('0x2'),_0xa7ee('0x3')];function createListener(_0x2a6a72,_0xda5fc6){return function(_0xe2ecac){_0xda5fc6[_0xa7ee('0x4')](_0x2a6a72,_0xe2ecac);};}function removeListener(_0x2779aa,_0xf00933){return function(){ChatInteractionEvents[_0xa7ee('0x5')](_0x2779aa,_0xf00933);};}exports['register']=function(_0x2c726c){for(var _0x3f3417=0x0,_0x35d130=events['length'];_0x3f3417<_0x35d130;_0x3f3417++){var _0x55adc4=events[_0x3f3417];var _0x3c18e5=createListener(_0xa7ee('0x6')+_0x55adc4,_0x2c726c);ChatInteractionEvents['on'](_0x55adc4,_0x3c18e5);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 765c7b9..758d389 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 _0xb983=['tracked','chat','chatinteraction:addtags','addTags','put','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','/:id/my_messages','getMyMessages','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','single','file','attachmentUpload','/:id/tags'];(function(_0x44d9f8,_0xd9f940){var _0x310b84=function(_0x5f3990){while(--_0x5f3990){_0x44d9f8['push'](_0x44d9f8['shift']());}};_0x310b84(++_0xd9f940);}(_0xb983,0xdb));var _0x3b98=function(_0x5447aa,_0x3afc00){_0x5447aa=_0x5447aa-0x0;var _0xb21e53=_0xb983[_0x5447aa];return _0xb21e53;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3b98('0x0'));var timeout=require(_0x3b98('0x1'));var express=require(_0x3b98('0x2'));var router=express[_0x3b98('0x3')]();var fs_extra=require(_0x3b98('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3b98('0x5'));var config=require(_0x3b98('0x6'));var controller=require(_0x3b98('0x7'));router[_0x3b98('0x8')]('/',auth[_0x3b98('0x9')](),controller[_0x3b98('0xa')]);router['get'](_0x3b98('0xb'),auth[_0x3b98('0x9')](),controller['describe']);router['get'](_0x3b98('0xc'),auth['isChatInteractionAuthorized'](),controller[_0x3b98('0xd')]);router[_0x3b98('0x8')](_0x3b98('0xe'),auth[_0x3b98('0xf')](),controller[_0x3b98('0x10')]);router['get'](_0x3b98('0x11'),auth['isAuthenticated'](),controller['getMessages']);router[_0x3b98('0x8')](_0x3b98('0x12'),auth[_0x3b98('0xf')](),controller[_0x3b98('0x13')]);router[_0x3b98('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x3b98('0x14')]);router[_0x3b98('0x15')]('/',auth[_0x3b98('0x9')](),controller[_0x3b98('0x16')]);router[_0x3b98('0x15')](_0x3b98('0x17'),auth['isAuthenticated'](),controller[_0x3b98('0x18')]);var upload=multer({'storage':multer[_0x3b98('0x19')]({'destination':function(_0x543741,_0x2b89ec,_0x1d0969){_0x1d0969(null,path['join'](config[_0x3b98('0x1a')],_0x3b98('0x1b')));},'filename':function(_0x30c44d,_0x304bbf,_0xb06b40){_0xb06b40(null,util[_0x3b98('0x1c')]('%s-%s',Date[_0x3b98('0x1d')](),_0x304bbf[_0x3b98('0x1e')][_0x3b98('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3b98('0x15')]('/:id/attachment_upload',upload[_0x3b98('0x20')](_0x3b98('0x21')),controller[_0x3b98('0x22')]);router['post']('/:id/messages',auth[_0x3b98('0xf')](),controller['addMessage']);router['post'](_0x3b98('0x23'),auth[_0x3b98('0x9')](),interaction[_0x3b98('0x24')](_0x3b98('0x25'),_0x3b98('0x26')),controller[_0x3b98('0x27')]);router['put']('/:id',auth[_0x3b98('0x9')](),interaction[_0x3b98('0x24')](_0x3b98('0x25'),'chatinteraction:update'),controller['update']);router[_0x3b98('0x28')](_0x3b98('0x29'),controller[_0x3b98('0x2a')]);router[_0x3b98('0x28')](_0x3b98('0x2b'),auth['isChatInteractionAuthorized'](),controller[_0x3b98('0x2c')]);router[_0x3b98('0x28')](_0x3b98('0x2d'),controller[_0x3b98('0x2e')]);router[_0x3b98('0x2f')]('/:id',auth[_0x3b98('0x9')](),interaction[_0x3b98('0x24')]('chat',_0x3b98('0x30')),controller[_0x3b98('0x31')]);router['delete'](_0x3b98('0x23'),auth['isAuthenticated'](),controller['removeTags']);module[_0x3b98('0x32')]=router; \ No newline at end of file +var _0x46b0=['%s-%s','now','replace','single','file','addMessage','/:id/tags','tracked','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close','delete','chat','chatinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/'];(function(_0x4a0a02,_0x4c8dc5){var _0x2beac7=function(_0x32b784){while(--_0x32b784){_0x4a0a02['push'](_0x4a0a02['shift']());}};_0x2beac7(++_0x4c8dc5);}(_0x46b0,0x1bf));var _0x046b=function(_0x4cf252,_0x6c073e){_0x4cf252=_0x4cf252-0x0;var _0x16b1e5=_0x46b0[_0x4cf252];return _0x16b1e5;};'use strict';var multer=require(_0x046b('0x0'));var util=require(_0x046b('0x1'));var path=require('path');var timeout=require(_0x046b('0x2'));var express=require(_0x046b('0x3'));var router=express[_0x046b('0x4')]();var fs_extra=require(_0x046b('0x5'));var auth=require(_0x046b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x046b('0x7'));var controller=require(_0x046b('0x8'));router[_0x046b('0x9')]('/',auth[_0x046b('0xa')](),controller[_0x046b('0xb')]);router['get'](_0x046b('0xc'),auth[_0x046b('0xa')](),controller[_0x046b('0xd')]);router[_0x046b('0x9')](_0x046b('0xe'),auth[_0x046b('0xf')](),controller[_0x046b('0x10')]);router[_0x046b('0x9')]('/:id/attachment_download',auth[_0x046b('0xf')](),controller['attachmentDownload']);router[_0x046b('0x9')](_0x046b('0x11'),auth['isAuthenticated'](),controller[_0x046b('0x12')]);router[_0x046b('0x9')](_0x046b('0x13'),auth[_0x046b('0xf')](),controller[_0x046b('0x14')]);router[_0x046b('0x9')](_0x046b('0x15'),auth['isAuthenticated'](),controller[_0x046b('0x16')]);router[_0x046b('0x17')]('/',auth[_0x046b('0xa')](),controller[_0x046b('0x18')]);router['post'](_0x046b('0x19'),auth[_0x046b('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x046b('0x1a')]({'destination':function(_0x1bb762,_0x2f34af,_0x92d44a){_0x92d44a(null,path[_0x046b('0x1b')](config[_0x046b('0x1c')],_0x046b('0x1d')));},'filename':function(_0xa87a95,_0x3dffe5,_0x7267a2){_0x7267a2(null,util['format'](_0x046b('0x1e'),Date[_0x046b('0x1f')](),_0x3dffe5['originalname'][_0x046b('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload[_0x046b('0x21')](_0x046b('0x22')),controller['attachmentUpload']);router['post'](_0x046b('0x11'),auth[_0x046b('0xf')](),controller[_0x046b('0x23')]);router[_0x046b('0x17')](_0x046b('0x24'),auth[_0x046b('0xa')](),interaction[_0x046b('0x25')]('chat','chatinteraction:addtags'),controller[_0x046b('0x26')]);router[_0x046b('0x27')](_0x046b('0xe'),auth['isAuthenticated'](),interaction['tracked']('chat',_0x046b('0x28')),controller[_0x046b('0x29')]);router[_0x046b('0x27')](_0x046b('0x2a'),controller[_0x046b('0x2b')]);router['put'](_0x046b('0x2c'),auth[_0x046b('0xf')](),controller['abandon']);router[_0x046b('0x27')](_0x046b('0x2d'),controller[_0x046b('0x2e')]);router[_0x046b('0x2f')]('/:id',auth[_0x046b('0xa')](),interaction[_0x046b('0x25')](_0x046b('0x30'),_0x046b('0x31')),controller[_0x046b('0x32')]);router[_0x046b('0x2f')](_0x046b('0x24'),auth[_0x046b('0xa')](),controller[_0x046b('0x33')]);module[_0x046b('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index e078b77..227d7a2 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 _0x5a80=['TEXT','BOOLEAN','sequelize'];(function(_0x331f32,_0x194684){var _0x462529=function(_0x301e9c){while(--_0x301e9c){_0x331f32['push'](_0x331f32['shift']());}};_0x462529(++_0x194684);}(_0x5a80,0xf5));var _0x05a8=function(_0x2571f6,_0x555e23){_0x2571f6=_0x2571f6-0x0;var _0x24e6d7=_0x5a80[_0x2571f6];return _0x24e6d7;};'use strict';var Sequelize=require(_0x05a8('0x0'));module['exports']={'body':{'type':Sequelize[_0x05a8('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x05a8('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8abb=['TEXT','medium','INTEGER','sequelize'];(function(_0x53433f,_0x3b7cf7){var _0x526c67=function(_0x274519){while(--_0x274519){_0x53433f['push'](_0x53433f['shift']());}};_0x526c67(++_0x3b7cf7);}(_0x8abb,0x9f));var _0xb8ab=function(_0x48ec35,_0x22bbf5){_0x48ec35=_0x48ec35-0x0;var _0x25f526=_0x8abb[_0x48ec35];return _0x25f526;};'use strict';var Sequelize=require(_0xb8ab('0x0'));module['exports']={'body':{'type':Sequelize[_0xb8ab('0x1')](_0xb8ab('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xb8ab('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 428c680..4e737c2 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 _0x9d32=['admin','fullname','role','userpic','internal','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','findAll','isEmpty','resourceId','push','ToId','read','-createdAt','all','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','ChatInternalMessage','includeAll','include','rows','catch','params','options','create','body','update','find','describe','get','messages','lastMessageAt','createdAt','format','YYYY-MM-DD\x20HH:mm:ss','lastMessage','getUsers','User','agent'];(function(_0xff1f6a,_0x4f6b5c){var _0x13673a=function(_0x3fd516){while(--_0x3fd516){_0xff1f6a['push'](_0xff1f6a['shift']());}};_0x13673a(++_0x4f6b5c);}(_0x9d32,0xff));var _0x29d3=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x9d32[_0x30abff];return _0x4c571e;};'use strict';var emlformat=require(_0x29d3('0x0'));var rimraf=require(_0x29d3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x29d3('0x2'));var rp=require(_0x29d3('0x3'));var moment=require('moment');var BPromise=require(_0x29d3('0x4'));var Mustache=require('mustache');var util=require(_0x29d3('0x5'));var path=require(_0x29d3('0x6'));var sox=require(_0x29d3('0x7'));var csv=require(_0x29d3('0x8'));var ejs=require(_0x29d3('0x9'));var fs=require('fs');var fs_extra=require(_0x29d3('0xa'));var _=require('lodash');var squel=require(_0x29d3('0xb'));var crypto=require(_0x29d3('0xc'));var jsforce=require(_0x29d3('0xd'));var deskjs=require(_0x29d3('0xe'));var toCsv=require(_0x29d3('0x8'));var querystring=require(_0x29d3('0xf'));var Papa=require('papaparse');var Redis=require(_0x29d3('0x10'));var authService=require(_0x29d3('0x11'));var qs=require(_0x29d3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x29d3('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x29d3('0x14'));var config=require(_0x29d3('0x15'));var licenseUtil=require(_0x29d3('0x16'));var db=require(_0x29d3('0x17'))['db'];config[_0x29d3('0x18')]=_[_0x29d3('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x29d3('0x1a'))(new Redis(config[_0x29d3('0x18')]));require(_0x29d3('0x1b'))[_0x29d3('0x1c')](socket);function respondWithStatusCode(_0x1a97ec,_0x3a8681){_0x3a8681=_0x3a8681||0xcc;return function(_0x260d83){if(_0x260d83){return _0x1a97ec[_0x29d3('0x1d')](_0x3a8681);}return _0x1a97ec[_0x29d3('0x1e')](_0x3a8681)[_0x29d3('0x1f')]();};}function respondWithResult(_0x246138,_0x2705bc){_0x2705bc=_0x2705bc||0xc8;return function(_0x47074c){if(_0x47074c){return _0x246138[_0x29d3('0x1e')](_0x2705bc)[_0x29d3('0x20')](_0x47074c);}};}function respondWithFilteredResult(_0x32aa16,_0x8e2d4b){return function(_0x448912){if(_0x448912){var _0x3564a7=typeof _0x8e2d4b[_0x29d3('0x21')]===_0x29d3('0x22')&&typeof _0x8e2d4b['limit']==='undefined';var _0x19cf2c=_0x448912[_0x29d3('0x23')];var _0x345296=_0x3564a7?0x0:_0x8e2d4b[_0x29d3('0x21')];var _0x3c4090=_0x3564a7?_0x448912[_0x29d3('0x23')]:_0x8e2d4b[_0x29d3('0x21')]+_0x8e2d4b[_0x29d3('0x24')];var _0x325287;if(_0x3c4090>=_0x19cf2c){_0x3c4090=_0x19cf2c;_0x325287=0xc8;}else{_0x325287=0xce;}_0x32aa16['status'](_0x325287);return _0x32aa16[_0x29d3('0x25')](_0x29d3('0x26'),_0x345296+'-'+_0x3c4090+'/'+_0x19cf2c)[_0x29d3('0x20')](_0x448912);}return null;};}function patchUpdates(_0x2b4c60){return function(_0x8c56aa){try{jsonpatch[_0x29d3('0x27')](_0x8c56aa,_0x2b4c60,!![]);}catch(_0x31d4c4){return BPromise[_0x29d3('0x28')](_0x31d4c4);}return _0x8c56aa[_0x29d3('0x29')]();};}function saveUpdates(_0x3a60c0,_0xd1e9dd){return function(_0xaf86bc){if(_0xaf86bc){return _0xaf86bc['update'](_0x3a60c0)[_0x29d3('0x2a')](function(_0x190214){return _0x190214;});}return null;};}function removeEntity(_0x1b0541,_0x5eb7c6){return function(_0x4ae44d){if(_0x4ae44d){return _0x4ae44d[_0x29d3('0x2b')]()[_0x29d3('0x2a')](function(){_0x1b0541[_0x29d3('0x1e')](0xcc)[_0x29d3('0x1f')]();});}};}function handleEntityNotFound(_0x507cdf,_0x463a76){return function(_0x5ee4e8){if(!_0x5ee4e8){_0x507cdf[_0x29d3('0x1d')](0x194);}return _0x5ee4e8;};}function handleError(_0x58df45,_0x1b5833){_0x1b5833=_0x1b5833||0x1f4;return function(_0x43c658){logger[_0x29d3('0x2c')](_0x43c658['stack']);if(_0x43c658[_0x29d3('0x2d')]){delete _0x43c658[_0x29d3('0x2d')];}_0x58df45[_0x29d3('0x1e')](_0x1b5833)['send'](_0x43c658);};}exports[_0x29d3('0x2e')]=function(_0x3b61c9,_0x55fbf0){var _0x1bb61a={},_0x321928={},_0x35970c={'count':0x0,'rows':[]};var _0x4f0b4f=_[_0x29d3('0x2f')](db['ChatInternalMessage'][_0x29d3('0x30')],function(_0x1c0430){return{'name':_0x1c0430[_0x29d3('0x31')],'type':_0x1c0430[_0x29d3('0x32')][_0x29d3('0x33')]};});_0x321928[_0x29d3('0x34')]=_['map'](_0x4f0b4f,'name');_0x321928[_0x29d3('0x35')]=_[_0x29d3('0x36')](_0x3b61c9[_0x29d3('0x35')]);_0x321928[_0x29d3('0x37')]=_[_0x29d3('0x38')](_0x321928[_0x29d3('0x34')],_0x321928[_0x29d3('0x35')]);_0x1bb61a['attributes']=_[_0x29d3('0x38')](_0x321928[_0x29d3('0x34')],qs[_0x29d3('0x39')](_0x3b61c9['query'][_0x29d3('0x39')]));_0x1bb61a[_0x29d3('0x3a')]=_0x1bb61a['attributes'][_0x29d3('0x3b')]?_0x1bb61a[_0x29d3('0x3a')]:_0x321928[_0x29d3('0x34')];if(!_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x3c')](_0x29d3('0x3d'))){_0x1bb61a[_0x29d3('0x24')]=qs[_0x29d3('0x24')](_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x24')]);_0x1bb61a['offset']=qs[_0x29d3('0x21')](_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x21')]);}_0x1bb61a['order']=qs[_0x29d3('0x3e')](_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x3e')]);_0x1bb61a[_0x29d3('0x3f')]=qs[_0x29d3('0x37')](_[_0x29d3('0x40')](_0x3b61c9[_0x29d3('0x35')],_0x321928[_0x29d3('0x37')]),_0x4f0b4f);if(_0x3b61c9[_0x29d3('0x35')]['filter']){_0x1bb61a['where']=_[_0x29d3('0x41')](_0x1bb61a[_0x29d3('0x3f')],{'$or':_['map'](_0x4f0b4f,function(_0x438afb){if(_0x438afb[_0x29d3('0x32')]!==_0x29d3('0x42')){var _0x295708={};_0x295708[_0x438afb[_0x29d3('0x2d')]]={'$like':'%'+_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x43')]+'%'};return _0x295708;}})});}_0x1bb61a=_[_0x29d3('0x41')]({},_0x1bb61a,_0x3b61c9['options']);var _0x4bb49a={'where':_0x1bb61a[_0x29d3('0x3f')]};return db[_0x29d3('0x44')]['count'](_0x4bb49a)[_0x29d3('0x2a')](function(_0x30a637){_0x35970c[_0x29d3('0x23')]=_0x30a637;if(_0x3b61c9[_0x29d3('0x35')][_0x29d3('0x45')]){_0x1bb61a[_0x29d3('0x46')]=[{'all':!![]}];}return db[_0x29d3('0x44')]['findAll'](_0x1bb61a);})[_0x29d3('0x2a')](function(_0x5c9025){_0x35970c[_0x29d3('0x47')]=_0x5c9025;return _0x35970c;})[_0x29d3('0x2a')](respondWithFilteredResult(_0x55fbf0,_0x1bb61a))[_0x29d3('0x48')](handleError(_0x55fbf0,null));};exports['show']=function(_0x491a3d,_0x2a1cdc){var _0x112f9e={'raw':!![],'where':{'id':_0x491a3d[_0x29d3('0x49')]['id']}},_0x5d9b0c={};_0x5d9b0c[_0x29d3('0x34')]=_[_0x29d3('0x36')](db[_0x29d3('0x44')][_0x29d3('0x30')]);_0x5d9b0c['query']=_['keys'](_0x491a3d['query']);_0x5d9b0c[_0x29d3('0x37')]=_[_0x29d3('0x38')](_0x5d9b0c[_0x29d3('0x34')],_0x5d9b0c[_0x29d3('0x35')]);_0x112f9e[_0x29d3('0x3a')]=_[_0x29d3('0x38')](_0x5d9b0c[_0x29d3('0x34')],qs[_0x29d3('0x39')](_0x491a3d['query']['fields']));_0x112f9e[_0x29d3('0x3a')]=_0x112f9e[_0x29d3('0x3a')][_0x29d3('0x3b')]?_0x112f9e[_0x29d3('0x3a')]:_0x5d9b0c[_0x29d3('0x34')];if(_0x491a3d['query'][_0x29d3('0x45')]){_0x112f9e['include']=[{'all':!![]}];}_0x112f9e=_[_0x29d3('0x41')]({},_0x112f9e,_0x491a3d[_0x29d3('0x4a')]);return db[_0x29d3('0x44')]['find'](_0x112f9e)[_0x29d3('0x2a')](handleEntityNotFound(_0x2a1cdc,null))[_0x29d3('0x2a')](respondWithResult(_0x2a1cdc,null))['catch'](handleError(_0x2a1cdc,null));};exports['create']=function(_0x18331e,_0x2bcb31){return db[_0x29d3('0x44')][_0x29d3('0x4b')](_0x18331e[_0x29d3('0x4c')],{})[_0x29d3('0x2a')](respondWithResult(_0x2bcb31,0xc9))[_0x29d3('0x48')](handleError(_0x2bcb31,null));};exports[_0x29d3('0x4d')]=function(_0x4b2423,_0x1abb7a){if(_0x4b2423[_0x29d3('0x4c')]['id']){delete _0x4b2423[_0x29d3('0x4c')]['id'];}return db[_0x29d3('0x44')][_0x29d3('0x4e')]({'where':{'id':_0x4b2423[_0x29d3('0x49')]['id']}})[_0x29d3('0x2a')](handleEntityNotFound(_0x1abb7a,null))[_0x29d3('0x2a')](saveUpdates(_0x4b2423[_0x29d3('0x4c')],null))[_0x29d3('0x2a')](respondWithResult(_0x1abb7a,null))[_0x29d3('0x48')](handleError(_0x1abb7a,null));};exports['destroy']=function(_0x3ecd70,_0x249ade){return db[_0x29d3('0x44')][_0x29d3('0x4e')]({'where':{'id':_0x3ecd70[_0x29d3('0x49')]['id']}})['then'](handleEntityNotFound(_0x249ade,null))[_0x29d3('0x2a')](removeEntity(_0x249ade,null))[_0x29d3('0x48')](handleError(_0x249ade,null));};exports[_0x29d3('0x4f')]=function(_0xdc8d4,_0x4fea19){return db[_0x29d3('0x44')][_0x29d3('0x4f')]()[_0x29d3('0x2a')](respondWithResult(_0x4fea19,null))[_0x29d3('0x48')](handleError(_0x4fea19,null));};function wrapUser(_0x38e909){return function(_0x1c297d){var _0x3048c7=_0x38e909[_0x29d3('0x50')]({'plain':!![]});_0x3048c7[_0x29d3('0x51')]=[];if(_0x1c297d){_0x3048c7[_0x29d3('0x52')]=_0x1c297d[_0x29d3('0x53')];_0x3048c7['lastMessage']=_0x1c297d;}else{_0x3048c7[_0x29d3('0x52')]=moment(0x0)[_0x29d3('0x54')](_0x29d3('0x55'));_0x3048c7[_0x29d3('0x56')]={};}return _0x3048c7;};}exports[_0x29d3('0x57')]=function(_0x83be9e,_0x5ba7e9,_0x288757){var _0x316a33=[];return db[_0x29d3('0x58')]['findAll']({'where':{'role':[_0x29d3('0x59'),_0x29d3('0x5a'),'user']},'attributes':['id',_0x29d3('0x5b'),'name',_0x29d3('0x5c'),_0x29d3('0x5d'),_0x29d3('0x5e'),_0x29d3('0x5f'),_0x29d3('0x60'),_0x29d3('0x61'),_0x29d3('0x62')],'order':qs[_0x29d3('0x3e')](_0x29d3('0x63')),'include':[{'model':db[_0x29d3('0x64')],'as':'VoiceQueues','attributes':['id',_0x29d3('0x2d'),_0x29d3('0x32')],'through':{'attributes':[]}}]})['then'](function(_0x2ee61c){if(_0x2ee61c){var _0x12e6ba=_0x83be9e[_0x29d3('0x65')][_0x29d3('0x50')]({'plain':!![]});if(!_0x12e6ba)throw new Error(_0x29d3('0x66'));if(_0x12e6ba[_0x29d3('0x5c')]==='user'){return db[_0x29d3('0x67')]['find']({'where':{'name':_0x29d3('0x68'),'userProfileId':_0x12e6ba[_0x29d3('0x69')]},'raw':!![]})[_0x29d3('0x2a')](function(_0x154ce9){if(_0x154ce9){if(_0x154ce9[_0x29d3('0x6a')]===0x0){return db['UserProfileResource'][_0x29d3('0x6b')]({'where':{'sectionId':_0x154ce9['id']},'raw':!![]})[_0x29d3('0x2a')](function(_0x438e4b){var _0x2afdb4=[];if(_[_0x29d3('0x6c')](_0x438e4b)){_0x2afdb4=_[_0x29d3('0x43')](_0x2ee61c,function(_0x27b87e){if(_0x27b87e[_0x29d3('0x5c')]!==_0x29d3('0x59')){return _0x27b87e;}});return _0x2afdb4;}else{for(var _0x257ddb=0x0;_0x257ddb<_0x2ee61c[_0x29d3('0x3b')];_0x257ddb++){var _0x3a8a70=_0x2ee61c[_0x257ddb];if(_0x3a8a70[_0x29d3('0x5c')]===_0x29d3('0x59')){var _0x5074c7=_[_0x29d3('0x4e')](_0x438e4b,function(_0x1c27de){return _0x1c27de[_0x29d3('0x6d')]===_0x3a8a70['id'];});if(_0x5074c7)_0x2afdb4[_0x29d3('0x6e')](_0x3a8a70);}else{_0x2afdb4[_0x29d3('0x6e')](_0x3a8a70);}}return _0x2afdb4;}});}else{return _0x2ee61c;}}else{var _0x513600=_['filter'](_0x2ee61c,function(_0x3d03e8){if(_0x3d03e8[_0x29d3('0x5c')]!=='agent'){return _0x3d03e8;}});return _0x513600;}});}else{return _0x2ee61c;}}})[_0x29d3('0x2a')](function(_0x5a0984){var _0x548d01=[];if(_0x5a0984){_0x316a33=_0x5a0984;for(var _0x37801e=0x0;_0x37801e<_0x5a0984[_0x29d3('0x3b')];_0x37801e+=0x1){_0x316a33[_0x37801e]['messages']=[];_0x548d01['push'](db[_0x29d3('0x44')]['find']({'where':{'FromId':[_0x83be9e[_0x29d3('0x65')]['id'],_0x5a0984[_0x37801e]['id']],'ToId':[_0x83be9e[_0x29d3('0x65')]['id'],_0x5a0984[_0x37801e]['id']],'ChatGroupId':null},'attributes':['id',_0x29d3('0x53'),'FromId',_0x29d3('0x6f'),_0x29d3('0x70'),_0x29d3('0x4c')],'order':qs[_0x29d3('0x3e')](_0x29d3('0x71')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x5a0984[_0x37801e])));}return BPromise[_0x29d3('0x72')](_0x548d01);}return[];})[_0x29d3('0x2a')](function(_0x38f6e3){return{'rows':_0x38f6e3,'count':_0x38f6e3['length']};})[_0x29d3('0x2a')](respondWithResult(_0x5ba7e9,null))[_0x29d3('0x48')](handleError(_0x5ba7e9,null));}; \ No newline at end of file +var _0x571c=['include','ChatInternalMessage','catch','params','intersection','create','body','describe','get','lastMessageAt','createdAt','lastMessage','format','getUsers','User','findAll','agent','admin','user','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','find','Agents','userProfileId','UserProfileResource','length','push','messages','ToId','read','-createdAt','all','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','send','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll'];(function(_0x3bc15e,_0x872aff){var _0x49087c=function(_0x3dbf7a){while(--_0x3dbf7a){_0x3bc15e['push'](_0x3bc15e['shift']());}};_0x49087c(++_0x872aff);}(_0x571c,0x106));var _0xc571=function(_0x3088ac,_0x1647f2){_0x3088ac=_0x3088ac-0x0;var _0x19d89d=_0x571c[_0x3088ac];return _0x19d89d;};'use strict';var emlformat=require(_0xc571('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc571('0x1'));var jsonpatch=require(_0xc571('0x2'));var rp=require('request-promise');var moment=require(_0xc571('0x3'));var BPromise=require(_0xc571('0x4'));var Mustache=require(_0xc571('0x5'));var util=require(_0xc571('0x6'));var path=require(_0xc571('0x7'));var sox=require(_0xc571('0x8'));var csv=require('to-csv');var ejs=require(_0xc571('0x9'));var fs=require('fs');var fs_extra=require(_0xc571('0xa'));var _=require(_0xc571('0xb'));var squel=require(_0xc571('0xc'));var crypto=require('crypto');var jsforce=require(_0xc571('0xd'));var deskjs=require(_0xc571('0xe'));var toCsv=require(_0xc571('0xf'));var querystring=require(_0xc571('0x10'));var Papa=require(_0xc571('0x11'));var Redis=require(_0xc571('0x12'));var authService=require(_0xc571('0x13'));var qs=require(_0xc571('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc571('0x15'))(_0xc571('0x16'));var utils=require('../../config/utils');var config=require(_0xc571('0x17'));var licenseUtil=require(_0xc571('0x18'));var db=require(_0xc571('0x19'))['db'];config[_0xc571('0x1a')]=_[_0xc571('0x1b')](config['redis'],{'host':_0xc571('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc571('0x1a')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithStatusCode(_0x3b219b,_0x11ec97){_0x11ec97=_0x11ec97||0xcc;return function(_0x1198b2){if(_0x1198b2){return _0x3b219b[_0xc571('0x1d')](_0x11ec97);}return _0x3b219b[_0xc571('0x1e')](_0x11ec97)[_0xc571('0x1f')]();};}function respondWithResult(_0x1e559d,_0x4a8c92){_0x4a8c92=_0x4a8c92||0xc8;return function(_0x264967){if(_0x264967){return _0x1e559d['status'](_0x4a8c92)['json'](_0x264967);}};}function respondWithFilteredResult(_0x233ceb,_0x200cdd){return function(_0xc9c95e){if(_0xc9c95e){var _0x405c28=typeof _0x200cdd[_0xc571('0x20')]===_0xc571('0x21')&&typeof _0x200cdd[_0xc571('0x22')]===_0xc571('0x21');var _0x43987f=_0xc9c95e[_0xc571('0x23')];var _0x4f42d2=_0x405c28?0x0:_0x200cdd[_0xc571('0x20')];var _0x1ca9de=_0x405c28?_0xc9c95e[_0xc571('0x23')]:_0x200cdd[_0xc571('0x20')]+_0x200cdd[_0xc571('0x22')];var _0x14c735;if(_0x1ca9de>=_0x43987f){_0x1ca9de=_0x43987f;_0x14c735=0xc8;}else{_0x14c735=0xce;}_0x233ceb['status'](_0x14c735);return _0x233ceb[_0xc571('0x24')](_0xc571('0x25'),_0x4f42d2+'-'+_0x1ca9de+'/'+_0x43987f)[_0xc571('0x26')](_0xc9c95e);}return null;};}function patchUpdates(_0x107448){return function(_0x1d864e){try{jsonpatch[_0xc571('0x27')](_0x1d864e,_0x107448,!![]);}catch(_0x5a0142){return BPromise[_0xc571('0x28')](_0x5a0142);}return _0x1d864e[_0xc571('0x29')]();};}function saveUpdates(_0x2bffde,_0x465f64){return function(_0x29591f){if(_0x29591f){return _0x29591f[_0xc571('0x2a')](_0x2bffde)[_0xc571('0x2b')](function(_0xb70b03){return _0xb70b03;});}return null;};}function removeEntity(_0x46eab2,_0x2ebb7f){return function(_0x109921){if(_0x109921){return _0x109921[_0xc571('0x2c')]()[_0xc571('0x2b')](function(){_0x46eab2[_0xc571('0x1e')](0xcc)[_0xc571('0x1f')]();});}};}function handleEntityNotFound(_0xf122f2,_0x1c4662){return function(_0x2afc79){if(!_0x2afc79){_0xf122f2[_0xc571('0x1d')](0x194);}return _0x2afc79;};}function handleError(_0xd5718b,_0x43a93e){_0x43a93e=_0x43a93e||0x1f4;return function(_0xbca8e3){logger[_0xc571('0x2d')](_0xbca8e3[_0xc571('0x2e')]);if(_0xbca8e3['name']){delete _0xbca8e3['name'];}_0xd5718b[_0xc571('0x1e')](_0x43a93e)[_0xc571('0x2f')](_0xbca8e3);};}exports['index']=function(_0x59bda7,_0x103d94){var _0x45b862={},_0x3f5b2f={},_0x4bcdf7={'count':0x0,'rows':[]};var _0x5ea250=_[_0xc571('0x30')](db['ChatInternalMessage'][_0xc571('0x31')],function(_0x194a27){return{'name':_0x194a27[_0xc571('0x32')],'type':_0x194a27[_0xc571('0x33')][_0xc571('0x34')]};});_0x3f5b2f[_0xc571('0x35')]=_[_0xc571('0x30')](_0x5ea250,_0xc571('0x36'));_0x3f5b2f[_0xc571('0x37')]=_[_0xc571('0x38')](_0x59bda7[_0xc571('0x37')]);_0x3f5b2f[_0xc571('0x39')]=_['intersection'](_0x3f5b2f['model'],_0x3f5b2f[_0xc571('0x37')]);_0x45b862[_0xc571('0x3a')]=_['intersection'](_0x3f5b2f[_0xc571('0x35')],qs[_0xc571('0x3b')](_0x59bda7[_0xc571('0x37')]['fields']));_0x45b862['attributes']=_0x45b862[_0xc571('0x3a')]['length']?_0x45b862[_0xc571('0x3a')]:_0x3f5b2f['model'];if(!_0x59bda7[_0xc571('0x37')][_0xc571('0x3c')](_0xc571('0x3d'))){_0x45b862[_0xc571('0x22')]=qs[_0xc571('0x22')](_0x59bda7[_0xc571('0x37')][_0xc571('0x22')]);_0x45b862['offset']=qs[_0xc571('0x20')](_0x59bda7[_0xc571('0x37')]['offset']);}_0x45b862[_0xc571('0x3e')]=qs[_0xc571('0x3f')](_0x59bda7['query'][_0xc571('0x3f')]);_0x45b862['where']=qs['filters'](_[_0xc571('0x40')](_0x59bda7[_0xc571('0x37')],_0x3f5b2f[_0xc571('0x39')]),_0x5ea250);if(_0x59bda7[_0xc571('0x37')][_0xc571('0x41')]){_0x45b862[_0xc571('0x42')]=_[_0xc571('0x43')](_0x45b862[_0xc571('0x42')],{'$or':_[_0xc571('0x30')](_0x5ea250,function(_0x42a3ea){if(_0x42a3ea[_0xc571('0x33')]!==_0xc571('0x44')){var _0x59a621={};_0x59a621[_0x42a3ea['name']]={'$like':'%'+_0x59bda7[_0xc571('0x37')][_0xc571('0x41')]+'%'};return _0x59a621;}})});}_0x45b862=_[_0xc571('0x43')]({},_0x45b862,_0x59bda7[_0xc571('0x45')]);var _0x123fa9={'where':_0x45b862[_0xc571('0x42')]};return db['ChatInternalMessage'][_0xc571('0x23')](_0x123fa9)[_0xc571('0x2b')](function(_0x2788ba){_0x4bcdf7['count']=_0x2788ba;if(_0x59bda7['query'][_0xc571('0x46')]){_0x45b862[_0xc571('0x47')]=[{'all':!![]}];}return db[_0xc571('0x48')]['findAll'](_0x45b862);})['then'](function(_0x11f5ea){_0x4bcdf7['rows']=_0x11f5ea;return _0x4bcdf7;})[_0xc571('0x2b')](respondWithFilteredResult(_0x103d94,_0x45b862))[_0xc571('0x49')](handleError(_0x103d94,null));};exports['show']=function(_0x4d7af9,_0x272485){var _0x2decd7={'raw':!![],'where':{'id':_0x4d7af9[_0xc571('0x4a')]['id']}},_0x4ae188={};_0x4ae188[_0xc571('0x35')]=_[_0xc571('0x38')](db['ChatInternalMessage'][_0xc571('0x31')]);_0x4ae188['query']=_[_0xc571('0x38')](_0x4d7af9['query']);_0x4ae188[_0xc571('0x39')]=_[_0xc571('0x4b')](_0x4ae188[_0xc571('0x35')],_0x4ae188[_0xc571('0x37')]);_0x2decd7[_0xc571('0x3a')]=_['intersection'](_0x4ae188[_0xc571('0x35')],qs[_0xc571('0x3b')](_0x4d7af9['query'][_0xc571('0x3b')]));_0x2decd7['attributes']=_0x2decd7[_0xc571('0x3a')]['length']?_0x2decd7[_0xc571('0x3a')]:_0x4ae188[_0xc571('0x35')];if(_0x4d7af9['query']['includeAll']){_0x2decd7[_0xc571('0x47')]=[{'all':!![]}];}_0x2decd7=_['merge']({},_0x2decd7,_0x4d7af9[_0xc571('0x45')]);return db[_0xc571('0x48')]['find'](_0x2decd7)[_0xc571('0x2b')](handleEntityNotFound(_0x272485,null))['then'](respondWithResult(_0x272485,null))[_0xc571('0x49')](handleError(_0x272485,null));};exports[_0xc571('0x4c')]=function(_0x6298f1,_0x10b33b){return db['ChatInternalMessage']['create'](_0x6298f1[_0xc571('0x4d')],{})[_0xc571('0x2b')](respondWithResult(_0x10b33b,0xc9))[_0xc571('0x49')](handleError(_0x10b33b,null));};exports[_0xc571('0x2a')]=function(_0xfeb373,_0xad4b35){if(_0xfeb373[_0xc571('0x4d')]['id']){delete _0xfeb373[_0xc571('0x4d')]['id'];}return db[_0xc571('0x48')]['find']({'where':{'id':_0xfeb373[_0xc571('0x4a')]['id']}})[_0xc571('0x2b')](handleEntityNotFound(_0xad4b35,null))['then'](saveUpdates(_0xfeb373[_0xc571('0x4d')],null))[_0xc571('0x2b')](respondWithResult(_0xad4b35,null))['catch'](handleError(_0xad4b35,null));};exports[_0xc571('0x2c')]=function(_0x10b861,_0x43c2fa){return db[_0xc571('0x48')]['find']({'where':{'id':_0x10b861[_0xc571('0x4a')]['id']}})[_0xc571('0x2b')](handleEntityNotFound(_0x43c2fa,null))[_0xc571('0x2b')](removeEntity(_0x43c2fa,null))['catch'](handleError(_0x43c2fa,null));};exports[_0xc571('0x4e')]=function(_0x43e72a,_0x244801){return db['ChatInternalMessage']['describe']()['then'](respondWithResult(_0x244801,null))[_0xc571('0x49')](handleError(_0x244801,null));};function wrapUser(_0x428661){return function(_0x12b6cf){var _0x2cf7b9=_0x428661[_0xc571('0x4f')]({'plain':!![]});_0x2cf7b9['messages']=[];if(_0x12b6cf){_0x2cf7b9[_0xc571('0x50')]=_0x12b6cf[_0xc571('0x51')];_0x2cf7b9[_0xc571('0x52')]=_0x12b6cf;}else{_0x2cf7b9['lastMessageAt']=moment(0x0)[_0xc571('0x53')]('YYYY-MM-DD\x20HH:mm:ss');_0x2cf7b9[_0xc571('0x52')]={};}return _0x2cf7b9;};}exports[_0xc571('0x54')]=function(_0xff5a14,_0x2d18b3,_0x689bdb){var _0xeb1d91=[];return db[_0xc571('0x55')][_0xc571('0x56')]({'where':{'role':[_0xc571('0x57'),_0xc571('0x58'),_0xc571('0x59')]},'attributes':['id',_0xc571('0x5a'),'name',_0xc571('0x5b'),_0xc571('0x5c'),_0xc571('0x5d'),'online',_0xc571('0x5e'),_0xc571('0x5f'),_0xc571('0x60')],'order':qs[_0xc571('0x3f')]('-online'),'include':[{'model':db[_0xc571('0x61')],'as':_0xc571('0x62'),'attributes':['id',_0xc571('0x36'),_0xc571('0x33')],'through':{'attributes':[]}}]})[_0xc571('0x2b')](function(_0x5ac25e){if(_0x5ac25e){var _0x3ee3ae=_0xff5a14['user'][_0xc571('0x4f')]({'plain':!![]});if(!_0x3ee3ae)throw new Error(_0xc571('0x63'));if(_0x3ee3ae[_0xc571('0x5b')]==='user'){return db['UserProfileSection'][_0xc571('0x64')]({'where':{'name':_0xc571('0x65'),'userProfileId':_0x3ee3ae[_0xc571('0x66')]},'raw':!![]})[_0xc571('0x2b')](function(_0x559c61){if(_0x559c61){if(_0x559c61['autoAssociation']===0x0){return db[_0xc571('0x67')]['findAll']({'where':{'sectionId':_0x559c61['id']},'raw':!![]})['then'](function(_0x5097e1){var _0x4de96f=[];if(_['isEmpty'](_0x5097e1)){_0x4de96f=_[_0xc571('0x41')](_0x5ac25e,function(_0x487e08){if(_0x487e08[_0xc571('0x5b')]!=='agent'){return _0x487e08;}});return _0x4de96f;}else{for(var _0x64d9c8=0x0;_0x64d9c8<_0x5ac25e[_0xc571('0x68')];_0x64d9c8++){var _0x3fac51=_0x5ac25e[_0x64d9c8];if(_0x3fac51[_0xc571('0x5b')]===_0xc571('0x57')){var _0x218df0=_[_0xc571('0x64')](_0x5097e1,function(_0x4eb52b){return _0x4eb52b['resourceId']===_0x3fac51['id'];});if(_0x218df0)_0x4de96f[_0xc571('0x69')](_0x3fac51);}else{_0x4de96f[_0xc571('0x69')](_0x3fac51);}}return _0x4de96f;}});}else{return _0x5ac25e;}}else{var _0x1c0861=_[_0xc571('0x41')](_0x5ac25e,function(_0x231080){if(_0x231080['role']!==_0xc571('0x57')){return _0x231080;}});return _0x1c0861;}});}else{return _0x5ac25e;}}})[_0xc571('0x2b')](function(_0x5675bd){var _0x599e0a=[];if(_0x5675bd){_0xeb1d91=_0x5675bd;for(var _0x44ed5a=0x0;_0x44ed5a<_0x5675bd[_0xc571('0x68')];_0x44ed5a+=0x1){_0xeb1d91[_0x44ed5a][_0xc571('0x6a')]=[];_0x599e0a[_0xc571('0x69')](db[_0xc571('0x48')][_0xc571('0x64')]({'where':{'FromId':[_0xff5a14[_0xc571('0x59')]['id'],_0x5675bd[_0x44ed5a]['id']],'ToId':[_0xff5a14[_0xc571('0x59')]['id'],_0x5675bd[_0x44ed5a]['id']],'ChatGroupId':null},'attributes':['id',_0xc571('0x51'),'FromId',_0xc571('0x6b'),_0xc571('0x6c'),_0xc571('0x4d')],'order':qs[_0xc571('0x3f')](_0xc571('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0xc571('0x2b')](wrapUser(_0x5675bd[_0x44ed5a])));}return BPromise[_0xc571('0x6e')](_0x599e0a);}return[];})[_0xc571('0x2b')](function(_0x511dd8){return{'rows':_0x511dd8,'count':_0x511dd8[_0xc571('0x68')]};})[_0xc571('0x2b')](respondWithResult(_0x2d18b3,null))['catch'](handleError(_0x2d18b3,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 1d6f46a..0ba9996 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 _0xef2b=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatInternalMessage','setMaxListeners'];(function(_0x166b39,_0x2c7292){var _0x196a87=function(_0x99af69){while(--_0x99af69){_0x166b39['push'](_0x166b39['shift']());}};_0x196a87(++_0x2c7292);}(_0xef2b,0x164));var _0xbef2=function(_0x5e3f0f,_0x16c6c7){_0x5e3f0f=_0x5e3f0f-0x0;var _0xbd8d66=_0xef2b[_0x5e3f0f];return _0xbd8d66;};'use strict';var EventEmitter=require(_0xbef2('0x0'));var ChatInternalMessage=require(_0xbef2('0x1'))['db'][_0xbef2('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbef2('0x3')](0x0);var events={'afterCreate':_0xbef2('0x4'),'afterUpdate':'update','afterDestroy':_0xbef2('0x5')};function emitEvent(_0x56e61a){return function(_0x29619f,_0x114f0e,_0x159f26){ChatInternalMessageEvents[_0xbef2('0x6')](_0x56e61a+':'+_0x29619f['id'],_0x29619f);ChatInternalMessageEvents['emit'](_0x56e61a,_0x29619f);_0x159f26(null);};}for(var e in events){if(events[_0xbef2('0x7')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xbef2('0x8')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xd98c=['hook','exports','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x49aed9,_0x4a7b44){var _0x5c913e=function(_0x454bf7){while(--_0x454bf7){_0x49aed9['push'](_0x49aed9['shift']());}};_0x5c913e(++_0x4a7b44);}(_0xd98c,0xe3));var _0xcd98=function(_0x1f68e1,_0x206dc8){_0x1f68e1=_0x1f68e1-0x0;var _0x35d201=_0xd98c[_0x1f68e1];return _0x35d201;};'use strict';var EventEmitter=require(_0xcd98('0x0'));var ChatInternalMessage=require(_0xcd98('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xcd98('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcd98('0x3'),'afterDestroy':_0xcd98('0x4')};function emitEvent(_0x2c4b4b){return function(_0x526bc9,_0x5c245c,_0x2c69b5){ChatInternalMessageEvents[_0xcd98('0x5')](_0x2c4b4b+':'+_0x526bc9['id'],_0x526bc9);ChatInternalMessageEvents['emit'](_0x2c4b4b,_0x526bc9);_0x2c69b5(null);};}for(var e in events){if(events[_0xcd98('0x6')](e)){var event=events[e];ChatInternalMessage[_0xcd98('0x7')](e,emitEvent(event));}}module[_0xcd98('0x8')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 3bc9e41..3e8408e 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 _0xa5d6=['../../config/logger','api','bluebird','request-promise','path','rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4792c8,_0x5158a1){var _0x35edb1=function(_0x2472d3){while(--_0x2472d3){_0x4792c8['push'](_0x4792c8['shift']());}};_0x35edb1(++_0x5158a1);}(_0xa5d6,0x7c));var _0x6a5d=function(_0x3f71a4,_0x30c6fe){_0x3f71a4=_0x3f71a4-0x0;var _0x11f064=_0xa5d6[_0x3f71a4];return _0x11f064;};'use strict';var _=require(_0x6a5d('0x0'));var util=require(_0x6a5d('0x1'));var logger=require(_0x6a5d('0x2'))(_0x6a5d('0x3'));var moment=require('moment');var BPromise=require(_0x6a5d('0x4'));var rp=require(_0x6a5d('0x5'));var fs=require('fs');var path=require(_0x6a5d('0x6'));var rimraf=require(_0x6a5d('0x7'));var config=require('../../config/environment');var attributes=require(_0x6a5d('0x8'));module[_0x6a5d('0x9')]=function(_0x481847,_0x30d703){return _0x481847[_0x6a5d('0xa')](_0x6a5d('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6a5d('0xc'),'collate':_0x6a5d('0xd')});}; \ No newline at end of file +var _0x3ccf=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./chatInternalMessage.attributes','exports','define'];(function(_0x68b457,_0x525e03){var _0x994162=function(_0x5224f7){while(--_0x5224f7){_0x68b457['push'](_0x68b457['shift']());}};_0x994162(++_0x525e03);}(_0x3ccf,0xd6));var _0xf3cc=function(_0x3fe929,_0x1f90e5){_0x3fe929=_0x3fe929-0x0;var _0x1f46a3=_0x3ccf[_0x3fe929];return _0x1f46a3;};'use strict';var _=require(_0xf3cc('0x0'));var util=require(_0xf3cc('0x1'));var logger=require(_0xf3cc('0x2'))(_0xf3cc('0x3'));var moment=require(_0xf3cc('0x4'));var BPromise=require(_0xf3cc('0x5'));var rp=require(_0xf3cc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf3cc('0x7'));var config=require('../../config/environment');var attributes=require(_0xf3cc('0x8'));module[_0xf3cc('0x9')]=function(_0x50f8e6,_0x5a6dda){return _0x50f8e6[_0xf3cc('0xa')](_0xf3cc('0xb'),attributes,{'tableName':_0xf3cc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf3cc('0xd'),'collate':_0xf3cc('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 826b603..1d8ee5e 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 _0x0e7a=['ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then'];(function(_0x4b1ea1,_0xff5112){var _0x1cf493=function(_0x4ceec6){while(--_0x4ceec6){_0x4b1ea1['push'](_0x4b1ea1['shift']());}};_0x1cf493(++_0xff5112);}(_0x0e7a,0x71));var _0xa0e7=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0x0e7a[_0x214266];return _0x568f75;};'use strict';var _=require(_0xa0e7('0x0'));var util=require(_0xa0e7('0x1'));var moment=require(_0xa0e7('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0e7('0x3'));var fs=require('fs');var Redis=require(_0xa0e7('0x4'));var db=require(_0xa0e7('0x5'))['db'];var utils=require(_0xa0e7('0x6'));var logger=require('../../config/logger')(_0xa0e7('0x7'));var config=require(_0xa0e7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa0e7('0x9')][_0xa0e7('0xa')]({'port':0x232a});config[_0xa0e7('0xb')]=_[_0xa0e7('0xc')](config['redis'],{'host':_0xa0e7('0xd'),'port':0x18eb});var socket=require(_0xa0e7('0xe'))(new Redis(config[_0xa0e7('0xb')]));require('./chatInternalMessage.socket')[_0xa0e7('0xf')](socket);function respondWithRpcPromise(_0x992df1,_0xc4dc84,_0x24cc32){return new BPromise(function(_0x44f3ec,_0x4cd892){return client['request'](_0x992df1,_0x24cc32)[_0xa0e7('0x10')](function(_0x293867){logger['info'](_0xa0e7('0x11'),_0xc4dc84,_0xa0e7('0x12'));logger['debug'](_0xa0e7('0x13'),_0xc4dc84,'request\x20sent',JSON[_0xa0e7('0x14')](_0x293867));if(_0x293867[_0xa0e7('0x15')]){if(_0x293867[_0xa0e7('0x15')][_0xa0e7('0x16')]===0x1f4){logger[_0xa0e7('0x15')](_0xa0e7('0x11'),_0xc4dc84,_0x293867['error'][_0xa0e7('0x17')]);return _0x4cd892(_0x293867[_0xa0e7('0x15')][_0xa0e7('0x17')]);}logger[_0xa0e7('0x15')](_0xa0e7('0x11'),_0xc4dc84,_0x293867[_0xa0e7('0x15')]['message']);return _0x44f3ec(_0x293867[_0xa0e7('0x15')][_0xa0e7('0x17')]);}else{logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0xc4dc84,_0xa0e7('0x12'));_0x44f3ec(_0x293867[_0xa0e7('0x18')][_0xa0e7('0x17')]);}})[_0xa0e7('0x19')](function(_0x49d432){logger[_0xa0e7('0x15')](_0xa0e7('0x11'),_0xc4dc84,_0x49d432);_0x4cd892(_0x49d432);});});} \ No newline at end of file +var _0x636d=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','defaults','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','lodash','util','moment'];(function(_0x38d3bd,_0x49f837){var _0x19022c=function(_0x30341f){while(--_0x30341f){_0x38d3bd['push'](_0x38d3bd['shift']());}};_0x19022c(++_0x49f837);}(_0x636d,0xf0));var _0xd636=function(_0x3de8a4,_0x289a5c){_0x3de8a4=_0x3de8a4-0x0;var _0x4635cf=_0x636d[_0x3de8a4];return _0x4635cf;};'use strict';var _=require(_0xd636('0x0'));var util=require(_0xd636('0x1'));var moment=require(_0xd636('0x2'));var BPromise=require(_0xd636('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd636('0x4'))['db'];var utils=require(_0xd636('0x5'));var logger=require(_0xd636('0x6'))(_0xd636('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd636('0x8')][_0xd636('0x9')]({'port':0x232a});config['redis']=_[_0xd636('0xa')](config['redis'],{'host':_0xd636('0xb'),'port':0x18eb});var socket=require(_0xd636('0xc'))(new Redis(config[_0xd636('0xd')]));require(_0xd636('0xe'))[_0xd636('0xf')](socket);function respondWithRpcPromise(_0x4b02db,_0x587d55,_0x526e0f){return new BPromise(function(_0x3863db,_0x36099d){return client[_0xd636('0x10')](_0x4b02db,_0x526e0f)[_0xd636('0x11')](function(_0x41784c){logger['info'](_0xd636('0x12'),_0x587d55,_0xd636('0x13'));logger['debug'](_0xd636('0x14'),_0x587d55,_0xd636('0x13'),JSON[_0xd636('0x15')](_0x41784c));if(_0x41784c['error']){if(_0x41784c['error'][_0xd636('0x16')]===0x1f4){logger[_0xd636('0x17')](_0xd636('0x12'),_0x587d55,_0x41784c[_0xd636('0x17')][_0xd636('0x18')]);return _0x36099d(_0x41784c['error']['message']);}logger[_0xd636('0x17')]('ChatInternalMessage,\x20%s,\x20%s',_0x587d55,_0x41784c['error'][_0xd636('0x18')]);return _0x3863db(_0x41784c[_0xd636('0x17')][_0xd636('0x18')]);}else{logger[_0xd636('0x19')](_0xd636('0x12'),_0x587d55,_0xd636('0x13'));_0x3863db(_0x41784c[_0xd636('0x1a')]['message']);}})['catch'](function(_0x56a6a5){logger[_0xd636('0x17')](_0xd636('0x12'),_0x587d55,_0x56a6a5);_0x36099d(_0x56a6a5);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 4764813..2ce5abe 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 _0x3d45=['save','remove','update','removeListener','register','chatInternalMessage:'];(function(_0x48b55f,_0x2a17e7){var _0x524a3c=function(_0x4d834a){while(--_0x4d834a){_0x48b55f['push'](_0x48b55f['shift']());}};_0x524a3c(++_0x2a17e7);}(_0x3d45,0x66));var _0x53d4=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x3d45[_0x3b380d];return _0x54502b;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x53d4('0x0'),_0x53d4('0x1'),_0x53d4('0x2')];function createListener(_0x2ef7cf,_0x3c660f){return function(_0x203329){_0x3c660f['emit'](_0x2ef7cf,_0x203329);};}function removeListener(_0x3ff2fe,_0x1a31fa){return function(){ChatInternalMessageEvents[_0x53d4('0x3')](_0x3ff2fe,_0x1a31fa);};}exports[_0x53d4('0x4')]=function(_0x571070){for(var _0x2f8160=0x0,_0xce6568=events['length'];_0x2f8160<_0xce6568;_0x2f8160++){var _0x57bd0d=events[_0x2f8160];var _0x59e469=createListener(_0x53d4('0x5')+_0x57bd0d,_0x571070);ChatInternalMessageEvents['on'](_0x57bd0d,_0x59e469);}}; \ No newline at end of file +var _0x674f=['emit','removeListener','register','length','./chatInternalMessage.events','save','remove','update'];(function(_0x75c2cc,_0x3ada99){var _0x340fe4=function(_0x3b2401){while(--_0x3b2401){_0x75c2cc['push'](_0x75c2cc['shift']());}};_0x340fe4(++_0x3ada99);}(_0x674f,0x1c4));var _0xf674=function(_0x34af24,_0x14918f){_0x34af24=_0x34af24-0x0;var _0x33fd87=_0x674f[_0x34af24];return _0x33fd87;};'use strict';var ChatInternalMessageEvents=require(_0xf674('0x0'));var events=[_0xf674('0x1'),_0xf674('0x2'),_0xf674('0x3')];function createListener(_0x44b6fa,_0x5b0df8){return function(_0x3daefd){_0x5b0df8[_0xf674('0x4')](_0x44b6fa,_0x3daefd);};}function removeListener(_0x3fe02a,_0x19f66f){return function(){ChatInternalMessageEvents[_0xf674('0x5')](_0x3fe02a,_0x19f66f);};}exports[_0xf674('0x6')]=function(_0xba55e4){for(var _0x271696=0x0,_0x525450=events[_0xf674('0x7')];_0x271696<_0x525450;_0x271696++){var _0x747ed6=events[_0x271696];var _0x4c2d54=createListener('chatInternalMessage:'+_0x747ed6,_0xba55e4);ChatInternalMessageEvents['on'](_0x747ed6,_0x4c2d54);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7ee3758..479ff91 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 _0x9ad3=['fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','put','update','destroy','util','path','connect-timeout','express'];(function(_0x2b0686,_0xff7aca){var _0xe364a0=function(_0x317360){while(--_0x317360){_0x2b0686['push'](_0x2b0686['shift']());}};_0xe364a0(++_0xff7aca);}(_0x9ad3,0x161));var _0x39ad=function(_0x348088,_0xfdc11d){_0x348088=_0x348088-0x0;var _0x4d43a7=_0x9ad3[_0x348088];return _0x4d43a7;};'use strict';var multer=require('multer');var util=require(_0x39ad('0x0'));var path=require(_0x39ad('0x1'));var timeout=require(_0x39ad('0x2'));var express=require(_0x39ad('0x3'));var router=express['Router']();var fs_extra=require(_0x39ad('0x4'));var auth=require(_0x39ad('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x39ad('0x6'));var controller=require(_0x39ad('0x7'));router[_0x39ad('0x8')]('/',auth['isAuthenticated'](),controller[_0x39ad('0x9')]);router['get'](_0x39ad('0xa'),auth[_0x39ad('0xb')](),controller[_0x39ad('0xc')]);router['get'](_0x39ad('0xd'),auth[_0x39ad('0xb')](),controller[_0x39ad('0xe')]);router['get'](_0x39ad('0xf'),auth[_0x39ad('0xb')](),controller[_0x39ad('0x10')]);router[_0x39ad('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x39ad('0x12')]('/:id',controller[_0x39ad('0x13')]);router['delete'](_0x39ad('0xf'),auth[_0x39ad('0xb')](),controller[_0x39ad('0x14')]);module['exports']=router; \ No newline at end of file +var _0x1402=['/:id','show','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','/describe','describe','/users','getUsers'];(function(_0x5ca644,_0x3d2165){var _0x5c87a2=function(_0x3dc7d9){while(--_0x3dc7d9){_0x5ca644['push'](_0x5ca644['shift']());}};_0x5c87a2(++_0x3d2165);}(_0x1402,0x1eb));var _0x2140=function(_0x1170e5,_0xc0e250){_0x1170e5=_0x1170e5-0x0;var _0x3ec902=_0x1402[_0x1170e5];return _0x3ec902;};'use strict';var multer=require(_0x2140('0x0'));var util=require(_0x2140('0x1'));var path=require('path');var timeout=require(_0x2140('0x2'));var express=require(_0x2140('0x3'));var router=express['Router']();var fs_extra=require(_0x2140('0x4'));var auth=require(_0x2140('0x5'));var interaction=require(_0x2140('0x6'));var config=require(_0x2140('0x7'));var controller=require(_0x2140('0x8'));router[_0x2140('0x9')]('/',auth[_0x2140('0xa')](),controller['index']);router['get'](_0x2140('0xb'),auth[_0x2140('0xa')](),controller[_0x2140('0xc')]);router[_0x2140('0x9')](_0x2140('0xd'),auth[_0x2140('0xa')](),controller[_0x2140('0xe')]);router[_0x2140('0x9')](_0x2140('0xf'),auth[_0x2140('0xa')](),controller[_0x2140('0x10')]);router['post']('/',auth[_0x2140('0xa')](),controller[_0x2140('0x11')]);router[_0x2140('0x12')]('/:id',controller[_0x2140('0x13')]);router[_0x2140('0x14')](_0x2140('0xf'),auth[_0x2140('0xa')](),controller[_0x2140('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 8225655..96d3e2e 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 _0x1bc6=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x1bc6,0x94));var _0x61bc=function(_0x1a841e,_0x5d813e){_0x1a841e=_0x1a841e-0x0;var _0x32d59e=_0x1bc6[_0x1a841e];return _0x32d59e;};'use strict';var Sequelize=require(_0x61bc('0x0'));module[_0x61bc('0x1')]={'body':{'type':Sequelize[_0x61bc('0x2')](_0x61bc('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x61bc('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x61bc('0x5')]('in','out'),'defaultValue':_0x61bc('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x61bc('0x7')]},'providerName':{'type':Sequelize[_0x61bc('0x8')]},'providerResponse':{'type':Sequelize[_0x61bc('0x2')]}}; \ No newline at end of file +var _0x1219=['DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x45bf86,_0x75586e){var _0x1f02b7=function(_0x1ea8a3){while(--_0x1ea8a3){_0x45bf86['push'](_0x45bf86['shift']());}};_0x1f02b7(++_0x75586e);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9121('0x0'));module[_0x9121('0x1')]={'body':{'type':Sequelize[_0x9121('0x2')](_0x9121('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9121('0x4')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x9121('0x5')]('in','out'),'defaultValue':_0x9121('0x6'),'allowNull':![]},'readAt':{'type':Sequelize[_0x9121('0x7')]},'providerName':{'type':Sequelize[_0x9121('0x8')]},'providerResponse':{'type':Sequelize[_0x9121('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index bb62a65..2429d84 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 _0xe8f3=['role','null','RejectMessage','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','format','channel','motionChannel','event','EventManager','rejectmessage','parse','interaction','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','client','http','chat-interactions','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','undefined','limit','count','offset','set','Content-Range','json','update','then','end','sendStatus','stack','name','index','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','ChatMessage','findAll','rows','length','find','create','body','params','describe','accept','chat','reject','UserId','user','agent','get','ChatInteractionId','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s'];(function(_0x218d84,_0x2f43d2){var _0xdbeedf=function(_0x16db2a){while(--_0x16db2a){_0x218d84['push'](_0x218d84['shift']());}};_0xdbeedf(++_0x2f43d2);}(_0xe8f3,0x77));var _0x3e8f=function(_0x3018eb,_0x570c63){_0x3018eb=_0x3018eb-0x0;var _0x23131f=_0xe8f3[_0x3018eb];return _0x23131f;};'use strict';var util=require(_0x3e8f('0x0'));var _=require(_0x3e8f('0x1'));var Redis=require(_0x3e8f('0x2'));var interactionService=require(_0x3e8f('0x3'));var qs=require(_0x3e8f('0x4'));var logger=require(_0x3e8f('0x5'))('api');var config=require(_0x3e8f('0x6'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e8f('0x7')](config[_0x3e8f('0x8')],{'host':_0x3e8f('0x9'),'port':0x18eb});var socket=require(_0x3e8f('0xa'))(new Redis(config[_0x3e8f('0x8')]));require(_0x3e8f('0xb'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x3e8f('0xc')][_0x3e8f('0xd')]({'port':0x232c});var client9002=jayson[_0x3e8f('0xc')][_0x3e8f('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0x3e8f('0xe'));function respondWithRpcPromise(_0x1c7949,_0x244066,_0x4931f6,_0x4ab24f){return new Promise(function(_0x2054e6,_0x1b5f57){var _0x5bf946=_0x4ab24f||client;return _0x5bf946[_0x3e8f('0xf')](_0x1c7949,_0x4931f6)['then'](function(_0x255f60){logger[_0x3e8f('0x10')](_0x3e8f('0x11'),_0x244066,_0x3e8f('0x12'));logger[_0x3e8f('0x13')](_0x3e8f('0x14'),_0x244066,'request\x20sent',JSON[_0x3e8f('0x15')](_0x255f60));if(_0x255f60[_0x3e8f('0x16')]){if(_0x255f60[_0x3e8f('0x16')]['code']===0x1f4){logger['error'](_0x3e8f('0x11'),_0x244066,_0x255f60[_0x3e8f('0x16')]['message']);return _0x1b5f57(_0x255f60[_0x3e8f('0x16')][_0x3e8f('0x17')]);}logger[_0x3e8f('0x16')](_0x3e8f('0x11'),_0x244066,_0x255f60[_0x3e8f('0x16')][_0x3e8f('0x17')]);return _0x2054e6(_0x255f60[_0x3e8f('0x16')]['message']);}else{logger[_0x3e8f('0x10')](_0x3e8f('0x11'),_0x244066,_0x3e8f('0x12'));_0x2054e6(_0x255f60[_0x3e8f('0x18')][_0x3e8f('0x17')]);}})[_0x3e8f('0x19')](function(_0x348a3c){logger['error']('ChatMessage,\x20%s,\x20%s',_0x244066,_0x348a3c);_0x1b5f57(_0x348a3c);});});}function respondWithResult(_0x5acff4,_0x1cc394){_0x1cc394=_0x1cc394||0xc8;return function(_0x18c487){if(_0x18c487){return _0x5acff4[_0x3e8f('0x1a')](_0x1cc394)['json'](_0x18c487);}};}function respondWithFilteredResult(_0x523a77,_0x585ea9){return function(_0x1c995d){if(_0x1c995d){var _0x55071b=typeof _0x585ea9['offset']===_0x3e8f('0x1b')&&typeof _0x585ea9[_0x3e8f('0x1c')]===_0x3e8f('0x1b');var _0x555b60=_0x1c995d[_0x3e8f('0x1d')];var _0x530c34=_0x55071b?0x0:_0x585ea9[_0x3e8f('0x1e')];var _0x3a8511=_0x55071b?_0x1c995d[_0x3e8f('0x1d')]:_0x585ea9['offset']+_0x585ea9[_0x3e8f('0x1c')];var _0x5f5412;if(_0x3a8511>=_0x555b60){_0x3a8511=_0x555b60;_0x5f5412=0xc8;}else{_0x5f5412=0xce;}_0x523a77[_0x3e8f('0x1a')](_0x5f5412);return _0x523a77[_0x3e8f('0x1f')](_0x3e8f('0x20'),_0x530c34+'-'+_0x3a8511+'/'+_0x555b60)[_0x3e8f('0x21')](_0x1c995d);}return null;};}function saveUpdates(_0x2f884c){return function(_0x2aed88){if(_0x2aed88){return _0x2aed88[_0x3e8f('0x22')](_0x2f884c)[_0x3e8f('0x23')](function(_0x4e1694){return _0x4e1694;});}return null;};}function removeEntity(_0x2b17cc){return function(_0x3cba8f){if(_0x3cba8f){return _0x3cba8f['destroy']()[_0x3e8f('0x23')](function(){_0x2b17cc[_0x3e8f('0x1a')](0xcc)[_0x3e8f('0x24')]();});}};}function handleEntityNotFound(_0x36b126){return function(_0x4dd400){if(!_0x4dd400){_0x36b126[_0x3e8f('0x25')](0x194);}return _0x4dd400;};}function handleError(_0x280d9b,_0x50fa7f){_0x50fa7f=_0x50fa7f||0x1f4;return function(_0x182390){logger['error'](_0x182390[_0x3e8f('0x26')]);if(_0x182390[_0x3e8f('0x27')]){delete _0x182390[_0x3e8f('0x27')];}_0x280d9b[_0x3e8f('0x1a')](_0x50fa7f)['send'](_0x182390);};}exports[_0x3e8f('0x28')]=function(_0x4e0c77,_0x353180){var _0x556eab={},_0x58220e={},_0x316923={'count':0x0,'rows':[]};var _0x4c37d8=_['map'](db['ChatMessage'][_0x3e8f('0x29')],function(_0x59e5c3){return{'name':_0x59e5c3[_0x3e8f('0x2a')],'type':_0x59e5c3['type'][_0x3e8f('0x2b')]};});_0x58220e[_0x3e8f('0x2c')]=_[_0x3e8f('0x2d')](_0x4c37d8,'name');_0x58220e[_0x3e8f('0x2e')]=_[_0x3e8f('0x2f')](_0x4e0c77[_0x3e8f('0x2e')]);_0x58220e[_0x3e8f('0x30')]=_[_0x3e8f('0x31')](_0x58220e[_0x3e8f('0x2c')],_0x58220e[_0x3e8f('0x2e')]);_0x556eab[_0x3e8f('0x32')]=_[_0x3e8f('0x31')](_0x58220e[_0x3e8f('0x2c')],qs[_0x3e8f('0x33')](_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x33')]));_0x556eab[_0x3e8f('0x32')]=_0x556eab[_0x3e8f('0x32')]['length']?_0x556eab['attributes']:_0x58220e[_0x3e8f('0x2c')];if(!_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x34')](_0x3e8f('0x35'))){_0x556eab[_0x3e8f('0x1c')]=qs[_0x3e8f('0x1c')](_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x1c')]);_0x556eab['offset']=qs[_0x3e8f('0x1e')](_0x4e0c77['query'][_0x3e8f('0x1e')]);}_0x556eab[_0x3e8f('0x36')]=qs[_0x3e8f('0x37')](_0x4e0c77[_0x3e8f('0x2e')]['sort']);_0x556eab[_0x3e8f('0x38')]=qs['filters'](_[_0x3e8f('0x39')](_0x4e0c77[_0x3e8f('0x2e')],_0x58220e[_0x3e8f('0x30')]),_0x4c37d8);if(_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x3a')]){_0x556eab[_0x3e8f('0x38')]=_['merge'](_0x556eab[_0x3e8f('0x38')],{'$or':_['map'](_0x4c37d8,function(_0x55b628){if(_0x55b628['type']!=='VIRTUAL'){var _0x10755e={};_0x10755e[_0x55b628[_0x3e8f('0x27')]]={'$like':'%'+_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x3a')]+'%'};return _0x10755e;}})});}_0x556eab=_[_0x3e8f('0x3b')]({},_0x556eab,_0x4e0c77[_0x3e8f('0x3c')]);var _0x1b11a3={'where':_0x556eab[_0x3e8f('0x38')]};return db['ChatMessage']['count'](_0x1b11a3)[_0x3e8f('0x23')](function(_0x2422ed){_0x316923[_0x3e8f('0x1d')]=_0x2422ed;if(_0x4e0c77[_0x3e8f('0x2e')][_0x3e8f('0x3d')]){_0x556eab[_0x3e8f('0x3e')]=[{'all':!![]}];}return db[_0x3e8f('0x3f')][_0x3e8f('0x40')](_0x556eab);})['then'](function(_0x29bd09){_0x316923[_0x3e8f('0x41')]=_0x29bd09;return _0x316923;})[_0x3e8f('0x23')](respondWithFilteredResult(_0x353180,_0x556eab))[_0x3e8f('0x19')](handleError(_0x353180,null));};exports['show']=function(_0x4d2f36,_0x5dfa49){var _0x35c2e5={'raw':!![],'where':{'id':_0x4d2f36['params']['id']}},_0x10dd46={};_0x10dd46[_0x3e8f('0x2c')]=_[_0x3e8f('0x2f')](db['ChatMessage'][_0x3e8f('0x29')]);_0x10dd46[_0x3e8f('0x2e')]=_['keys'](_0x4d2f36['query']);_0x10dd46[_0x3e8f('0x30')]=_[_0x3e8f('0x31')](_0x10dd46[_0x3e8f('0x2c')],_0x10dd46[_0x3e8f('0x2e')]);_0x35c2e5[_0x3e8f('0x32')]=_['intersection'](_0x10dd46[_0x3e8f('0x2c')],qs[_0x3e8f('0x33')](_0x4d2f36['query'][_0x3e8f('0x33')]));_0x35c2e5[_0x3e8f('0x32')]=_0x35c2e5[_0x3e8f('0x32')][_0x3e8f('0x42')]?_0x35c2e5[_0x3e8f('0x32')]:_0x10dd46[_0x3e8f('0x2c')];if(_0x4d2f36['query'][_0x3e8f('0x3d')]){_0x35c2e5['include']=[{'all':!![]}];}_0x35c2e5=_[_0x3e8f('0x3b')]({},_0x35c2e5,_0x4d2f36[_0x3e8f('0x3c')]);return db[_0x3e8f('0x3f')][_0x3e8f('0x43')](_0x35c2e5)['then'](handleEntityNotFound(_0x5dfa49,null))['then'](respondWithResult(_0x5dfa49,null))[_0x3e8f('0x19')](handleError(_0x5dfa49,null));};exports['create']=function(_0x19a6cc,_0x4a8f2a){return db[_0x3e8f('0x3f')][_0x3e8f('0x44')](_0x19a6cc['body'],{})[_0x3e8f('0x23')](respondWithResult(_0x4a8f2a,0xc9))[_0x3e8f('0x19')](handleError(_0x4a8f2a,null));};exports[_0x3e8f('0x22')]=function(_0x350ef6,_0x5348ff){if(_0x350ef6[_0x3e8f('0x45')]['id']){delete _0x350ef6['body']['id'];}return db['ChatMessage'][_0x3e8f('0x43')]({'where':{'id':_0x350ef6[_0x3e8f('0x46')]['id']}})[_0x3e8f('0x23')](handleEntityNotFound(_0x5348ff,null))['then'](saveUpdates(_0x350ef6[_0x3e8f('0x45')],null))[_0x3e8f('0x23')](respondWithResult(_0x5348ff,null))[_0x3e8f('0x19')](handleError(_0x5348ff,null));};exports['destroy']=function(_0x541d99,_0x4ce51b){return db[_0x3e8f('0x3f')][_0x3e8f('0x43')]({'where':{'id':_0x541d99[_0x3e8f('0x46')]['id']}})[_0x3e8f('0x23')](handleEntityNotFound(_0x4ce51b,null))['then'](removeEntity(_0x4ce51b,null))[_0x3e8f('0x19')](handleError(_0x4ce51b,null));};exports['describe']=function(_0x46f1a,_0xe52e19){return db[_0x3e8f('0x3f')][_0x3e8f('0x47')]()[_0x3e8f('0x23')](respondWithResult(_0xe52e19,null))[_0x3e8f('0x19')](handleError(_0xe52e19,null));};exports[_0x3e8f('0x48')]=function(_0x59692c,_0x466c94){var _0x5d1a8f=_0x3e8f('0x49');return interactionService['acceptMessage'](_0x59692c,_0x5d1a8f)['then'](respondWithResult(_0x466c94,null))[_0x3e8f('0x19')](handleError(_0x466c94,null));};exports[_0x3e8f('0x4a')]=function(_0x56a342,_0x5caa7a){var _0x1748fa={'agent':{},'channel':_0x3e8f('0x49')};if(_0x56a342['body']['id']){delete _0x56a342[_0x3e8f('0x45')]['id'];}_0x56a342[_0x3e8f('0x45')][_0x3e8f('0x4b')]=_0x56a342[_0x3e8f('0x45')][_0x3e8f('0x4b')]||_0x56a342[_0x3e8f('0x4c')]['id'];_0x1748fa[_0x3e8f('0x4d')]['id']=_0x56a342['body']['UserId'];return db[_0x3e8f('0x3f')]['find']({'where':{'id':_0x56a342[_0x3e8f('0x46')]['id'],'UserId':null}})[_0x3e8f('0x23')](handleEntityNotFound(_0x5caa7a,null))[_0x3e8f('0x23')](function(_0x3845db){if(_0x3845db){_0x1748fa[_0x3e8f('0x17')]=_0x3845db[_0x3e8f('0x4e')]({'plain':!![]});return db['ChatInteraction'][_0x3e8f('0x43')]({'where':{'id':_0x3845db[_0x3e8f('0x4f')]}});}return null;})[_0x3e8f('0x23')](handleEntityNotFound(_0x5caa7a,null))[_0x3e8f('0x23')](function(_0x5cbad9){if(_0x5cbad9){_0x1748fa['interaction']=_0x5cbad9[_0x3e8f('0x4e')]({'plain':!![]});interaction_log[_0x3e8f('0x10')](_0x3e8f('0x50'),_0x56a342['user']['id'],_0x56a342[_0x3e8f('0x4c')]['name'],_0x56a342[_0x3e8f('0x4c')][_0x3e8f('0x51')],_0x1748fa['interaction']['id'],_0x56a342[_0x3e8f('0x45')]?JSON['stringify'](_0x56a342[_0x3e8f('0x45')]):_0x3e8f('0x52'));return respondWithRpcPromise(_0x3e8f('0x53'),'rejectMessage',_0x1748fa);}return null;})[_0x3e8f('0x23')](function(_0x54156e){var _0x6c3b6='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x54156e['message'][_0x3e8f('0x54')];return db['sequelize'][_0x3e8f('0x2e')](_0x6c3b6,{'type':db[_0x3e8f('0x55')][_0x3e8f('0x56')]['SELECT'],'raw':!![]})['then'](function(_0x3bc1d4){return _0x3bc1d4;});})[_0x3e8f('0x23')](function(_0x565fef){if(_0x565fef){_0x1748fa[_0x3e8f('0x17')][_0x3e8f('0x57')]=_0x565fef[0x0];if(!_0x56a342[_0x3e8f('0x45')][_0x3e8f('0x4b')])return;return db[_0x3e8f('0x58')]['find']({'where':{'id':_0x56a342[_0x3e8f('0x45')]['UserId'],'role':_0x3e8f('0x4d')},'attributes':['id',_0x3e8f('0x27'),_0x3e8f('0x59'),_0x3e8f('0x5a'),_0x3e8f('0x5b')],'raw':!![]});}return null;})['then'](function(_0x458fe9){if(!_0x458fe9)return null;_0x1748fa['message'][_0x3e8f('0x4d')]=_0x458fe9;return _0x1748fa;})[_0x3e8f('0x23')](function(_0x2949df){if(_0x2949df){_0x2949df[_0x3e8f('0x17')]['interface']=util[_0x3e8f('0x5c')]('SIP/%s',_0x56a342[_0x3e8f('0x4c')]['name']);_0x2949df[_0x3e8f('0x17')][_0x3e8f('0x5d')]=_0x1748fa[_0x3e8f('0x5d')];_0x2949df[_0x3e8f('0x17')][_0x3e8f('0x5e')]=_0x1748fa[_0x3e8f('0x5d')];_0x2949df[_0x3e8f('0x17')][_0x3e8f('0x5f')]=_0x3e8f('0x4a');respondWithRpcPromise(_0x3e8f('0x60'),_0x3e8f('0x60'),{'event':_0x3e8f('0x61'),'message':_[_0x3e8f('0x3b')](_0x1748fa[_0x3e8f('0x17')],JSON[_0x3e8f('0x62')](_0x1748fa[_0x3e8f('0x63')]['formData']))},client9002);return _0x1748fa;}return null;})[_0x3e8f('0x23')](respondWithResult(_0x5caa7a,null))['catch'](handleError(_0x5caa7a,null));}; \ No newline at end of file +var _0x51b8=['../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','http','client','../../config/logger','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','name','options','includeAll','findAll','rows','show','params','include','catch','create','body','find','describe','accept','chat','UserId','user','agent','get','ChatInteraction','interaction','role','null','rejectMessage','ContactId','Sequelize','QueryTypes','contact','User','email','SIP/%s','channel','motionChannel','event','reject','EventManager','rejectmessage','parse','formData','util','ioredis','../../components/interaction/service','api'];(function(_0x1ea7d4,_0x2257bd){var _0x55e995=function(_0x34937a){while(--_0x34937a){_0x1ea7d4['push'](_0x1ea7d4['shift']());}};_0x55e995(++_0x2257bd);}(_0x51b8,0x190));var _0x851b=function(_0x43d4f7,_0x2aba64){_0x43d4f7=_0x43d4f7-0x0;var _0x2ad52e=_0x51b8[_0x43d4f7];return _0x2ad52e;};'use strict';var util=require(_0x851b('0x0'));var _=require('lodash');var Redis=require(_0x851b('0x1'));var interactionService=require(_0x851b('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x851b('0x3'));var config=require(_0x851b('0x4'));var db=require(_0x851b('0x5'))['db'];config[_0x851b('0x6')]=_[_0x851b('0x7')](config['redis'],{'host':_0x851b('0x8'),'port':0x18eb});var socket=require(_0x851b('0x9'))(new Redis(config[_0x851b('0x6')]));require(_0x851b('0xa'))[_0x851b('0xb')](socket);var jayson=require(_0x851b('0xc'));var client=jayson['client'][_0x851b('0xd')]({'port':0x232c});var client9002=jayson[_0x851b('0xe')]['http']({'port':0x232a});var interaction_log=require(_0x851b('0xf'))('chat-interactions');function respondWithRpcPromise(_0x1f7cb3,_0x12ff9a,_0x1076eb,_0x32a3fe){return new Promise(function(_0x294e73,_0x12c168){var _0x40ec72=_0x32a3fe||client;return _0x40ec72[_0x851b('0x10')](_0x1f7cb3,_0x1076eb)[_0x851b('0x11')](function(_0xf4b5d){logger[_0x851b('0x12')](_0x851b('0x13'),_0x12ff9a,_0x851b('0x14'));logger[_0x851b('0x15')](_0x851b('0x16'),_0x12ff9a,'request\x20sent',JSON['stringify'](_0xf4b5d));if(_0xf4b5d[_0x851b('0x17')]){if(_0xf4b5d[_0x851b('0x17')][_0x851b('0x18')]===0x1f4){logger['error'](_0x851b('0x13'),_0x12ff9a,_0xf4b5d[_0x851b('0x17')]['message']);return _0x12c168(_0xf4b5d[_0x851b('0x17')][_0x851b('0x19')]);}logger[_0x851b('0x17')]('ChatMessage,\x20%s,\x20%s',_0x12ff9a,_0xf4b5d[_0x851b('0x17')][_0x851b('0x19')]);return _0x294e73(_0xf4b5d[_0x851b('0x17')][_0x851b('0x19')]);}else{logger['info'](_0x851b('0x13'),_0x12ff9a,'request\x20sent');_0x294e73(_0xf4b5d[_0x851b('0x1a')][_0x851b('0x19')]);}})['catch'](function(_0x179687){logger[_0x851b('0x17')]('ChatMessage,\x20%s,\x20%s',_0x12ff9a,_0x179687);_0x12c168(_0x179687);});});}function respondWithResult(_0x4e1361,_0x701f07){_0x701f07=_0x701f07||0xc8;return function(_0x19bd98){if(_0x19bd98){return _0x4e1361[_0x851b('0x1b')](_0x701f07)[_0x851b('0x1c')](_0x19bd98);}};}function respondWithFilteredResult(_0x32f804,_0x33f352){return function(_0x27d4df){if(_0x27d4df){var _0x2ce246=typeof _0x33f352[_0x851b('0x1d')]===_0x851b('0x1e')&&typeof _0x33f352[_0x851b('0x1f')]===_0x851b('0x1e');var _0x326753=_0x27d4df[_0x851b('0x20')];var _0x249a78=_0x2ce246?0x0:_0x33f352[_0x851b('0x1d')];var _0x3528f5=_0x2ce246?_0x27d4df[_0x851b('0x20')]:_0x33f352[_0x851b('0x1d')]+_0x33f352[_0x851b('0x1f')];var _0x4a9ad1;if(_0x3528f5>=_0x326753){_0x3528f5=_0x326753;_0x4a9ad1=0xc8;}else{_0x4a9ad1=0xce;}_0x32f804['status'](_0x4a9ad1);return _0x32f804[_0x851b('0x21')]('Content-Range',_0x249a78+'-'+_0x3528f5+'/'+_0x326753)[_0x851b('0x1c')](_0x27d4df);}return null;};}function saveUpdates(_0x417e01){return function(_0x38b2d9){if(_0x38b2d9){return _0x38b2d9[_0x851b('0x22')](_0x417e01)[_0x851b('0x11')](function(_0x2c3f4d){return _0x2c3f4d;});}return null;};}function removeEntity(_0x27851a){return function(_0xff943b){if(_0xff943b){return _0xff943b[_0x851b('0x23')]()['then'](function(){_0x27851a[_0x851b('0x1b')](0xcc)[_0x851b('0x24')]();});}};}function handleEntityNotFound(_0x53a6ee){return function(_0x24b79d){if(!_0x24b79d){_0x53a6ee[_0x851b('0x25')](0x194);}return _0x24b79d;};}function handleError(_0x3e9ad2,_0x175491){_0x175491=_0x175491||0x1f4;return function(_0x2d902b){logger['error'](_0x2d902b[_0x851b('0x26')]);if(_0x2d902b['name']){delete _0x2d902b['name'];}_0x3e9ad2[_0x851b('0x1b')](_0x175491)[_0x851b('0x27')](_0x2d902b);};}exports[_0x851b('0x28')]=function(_0x416c6c,_0x5563d4){var _0x2f297d={},_0x1c1fe6={},_0x404a11={'count':0x0,'rows':[]};var _0x1c7d4d=_[_0x851b('0x29')](db[_0x851b('0x2a')][_0x851b('0x2b')],function(_0x51d358){return{'name':_0x51d358[_0x851b('0x2c')],'type':_0x51d358[_0x851b('0x2d')][_0x851b('0x2e')]};});_0x1c1fe6[_0x851b('0x2f')]=_[_0x851b('0x29')](_0x1c7d4d,'name');_0x1c1fe6[_0x851b('0x30')]=_[_0x851b('0x31')](_0x416c6c['query']);_0x1c1fe6['filters']=_[_0x851b('0x32')](_0x1c1fe6['model'],_0x1c1fe6[_0x851b('0x30')]);_0x2f297d[_0x851b('0x33')]=_[_0x851b('0x32')](_0x1c1fe6['model'],qs[_0x851b('0x34')](_0x416c6c['query'][_0x851b('0x34')]));_0x2f297d[_0x851b('0x33')]=_0x2f297d[_0x851b('0x33')][_0x851b('0x35')]?_0x2f297d['attributes']:_0x1c1fe6['model'];if(!_0x416c6c['query'][_0x851b('0x36')]('nolimit')){_0x2f297d[_0x851b('0x1f')]=qs[_0x851b('0x1f')](_0x416c6c[_0x851b('0x30')][_0x851b('0x1f')]);_0x2f297d[_0x851b('0x1d')]=qs[_0x851b('0x1d')](_0x416c6c['query']['offset']);}_0x2f297d[_0x851b('0x37')]=qs[_0x851b('0x38')](_0x416c6c[_0x851b('0x30')][_0x851b('0x38')]);_0x2f297d[_0x851b('0x39')]=qs[_0x851b('0x3a')](_[_0x851b('0x3b')](_0x416c6c[_0x851b('0x30')],_0x1c1fe6[_0x851b('0x3a')]),_0x1c7d4d);if(_0x416c6c[_0x851b('0x30')][_0x851b('0x3c')]){_0x2f297d[_0x851b('0x39')]=_[_0x851b('0x3d')](_0x2f297d['where'],{'$or':_[_0x851b('0x29')](_0x1c7d4d,function(_0x345f97){if(_0x345f97['type']!=='VIRTUAL'){var _0x2b3237={};_0x2b3237[_0x345f97[_0x851b('0x3e')]]={'$like':'%'+_0x416c6c[_0x851b('0x30')][_0x851b('0x3c')]+'%'};return _0x2b3237;}})});}_0x2f297d=_[_0x851b('0x3d')]({},_0x2f297d,_0x416c6c[_0x851b('0x3f')]);var _0x577dcc={'where':_0x2f297d[_0x851b('0x39')]};return db[_0x851b('0x2a')][_0x851b('0x20')](_0x577dcc)[_0x851b('0x11')](function(_0x54b668){_0x404a11['count']=_0x54b668;if(_0x416c6c['query'][_0x851b('0x40')]){_0x2f297d['include']=[{'all':!![]}];}return db[_0x851b('0x2a')][_0x851b('0x41')](_0x2f297d);})[_0x851b('0x11')](function(_0x454939){_0x404a11[_0x851b('0x42')]=_0x454939;return _0x404a11;})[_0x851b('0x11')](respondWithFilteredResult(_0x5563d4,_0x2f297d))['catch'](handleError(_0x5563d4,null));};exports[_0x851b('0x43')]=function(_0x40ee53,_0x2a821d){var _0x1c7b45={'raw':!![],'where':{'id':_0x40ee53[_0x851b('0x44')]['id']}},_0x13fa3a={};_0x13fa3a['model']=_[_0x851b('0x31')](db[_0x851b('0x2a')][_0x851b('0x2b')]);_0x13fa3a[_0x851b('0x30')]=_[_0x851b('0x31')](_0x40ee53['query']);_0x13fa3a['filters']=_[_0x851b('0x32')](_0x13fa3a[_0x851b('0x2f')],_0x13fa3a[_0x851b('0x30')]);_0x1c7b45[_0x851b('0x33')]=_['intersection'](_0x13fa3a[_0x851b('0x2f')],qs['fields'](_0x40ee53[_0x851b('0x30')]['fields']));_0x1c7b45[_0x851b('0x33')]=_0x1c7b45[_0x851b('0x33')]['length']?_0x1c7b45[_0x851b('0x33')]:_0x13fa3a[_0x851b('0x2f')];if(_0x40ee53[_0x851b('0x30')][_0x851b('0x40')]){_0x1c7b45[_0x851b('0x45')]=[{'all':!![]}];}_0x1c7b45=_[_0x851b('0x3d')]({},_0x1c7b45,_0x40ee53[_0x851b('0x3f')]);return db[_0x851b('0x2a')]['find'](_0x1c7b45)[_0x851b('0x11')](handleEntityNotFound(_0x2a821d,null))[_0x851b('0x11')](respondWithResult(_0x2a821d,null))[_0x851b('0x46')](handleError(_0x2a821d,null));};exports[_0x851b('0x47')]=function(_0x42a48b,_0x379b1){return db[_0x851b('0x2a')][_0x851b('0x47')](_0x42a48b['body'],{})[_0x851b('0x11')](respondWithResult(_0x379b1,0xc9))[_0x851b('0x46')](handleError(_0x379b1,null));};exports[_0x851b('0x22')]=function(_0x189529,_0x3cc46c){if(_0x189529[_0x851b('0x48')]['id']){delete _0x189529[_0x851b('0x48')]['id'];}return db[_0x851b('0x2a')][_0x851b('0x49')]({'where':{'id':_0x189529[_0x851b('0x44')]['id']}})[_0x851b('0x11')](handleEntityNotFound(_0x3cc46c,null))[_0x851b('0x11')](saveUpdates(_0x189529[_0x851b('0x48')],null))[_0x851b('0x11')](respondWithResult(_0x3cc46c,null))['catch'](handleError(_0x3cc46c,null));};exports[_0x851b('0x23')]=function(_0x107c0a,_0x3cb7e5){return db['ChatMessage']['find']({'where':{'id':_0x107c0a[_0x851b('0x44')]['id']}})['then'](handleEntityNotFound(_0x3cb7e5,null))[_0x851b('0x11')](removeEntity(_0x3cb7e5,null))[_0x851b('0x46')](handleError(_0x3cb7e5,null));};exports[_0x851b('0x4a')]=function(_0xe1413c,_0x5297f7){return db[_0x851b('0x2a')][_0x851b('0x4a')]()['then'](respondWithResult(_0x5297f7,null))['catch'](handleError(_0x5297f7,null));};exports[_0x851b('0x4b')]=function(_0x1d9de4,_0x33b1ae){var _0x4a7c36=_0x851b('0x4c');return interactionService['acceptMessage'](_0x1d9de4,_0x4a7c36)[_0x851b('0x11')](respondWithResult(_0x33b1ae,null))[_0x851b('0x46')](handleError(_0x33b1ae,null));};exports['reject']=function(_0x1fb3a2,_0x9702e1){var _0x1b6386={'agent':{},'channel':_0x851b('0x4c')};if(_0x1fb3a2['body']['id']){delete _0x1fb3a2['body']['id'];}_0x1fb3a2[_0x851b('0x48')][_0x851b('0x4d')]=_0x1fb3a2['body'][_0x851b('0x4d')]||_0x1fb3a2[_0x851b('0x4e')]['id'];_0x1b6386[_0x851b('0x4f')]['id']=_0x1fb3a2[_0x851b('0x48')][_0x851b('0x4d')];return db[_0x851b('0x2a')][_0x851b('0x49')]({'where':{'id':_0x1fb3a2[_0x851b('0x44')]['id'],'UserId':null}})[_0x851b('0x11')](handleEntityNotFound(_0x9702e1,null))['then'](function(_0x4ad686){if(_0x4ad686){_0x1b6386[_0x851b('0x19')]=_0x4ad686[_0x851b('0x50')]({'plain':!![]});return db[_0x851b('0x51')][_0x851b('0x49')]({'where':{'id':_0x4ad686['ChatInteractionId']}});}return null;})[_0x851b('0x11')](handleEntityNotFound(_0x9702e1,null))[_0x851b('0x11')](function(_0x3b62f2){if(_0x3b62f2){_0x1b6386[_0x851b('0x52')]=_0x3b62f2[_0x851b('0x50')]({'plain':!![]});interaction_log[_0x851b('0x12')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1fb3a2[_0x851b('0x4e')]['id'],_0x1fb3a2[_0x851b('0x4e')]['name'],_0x1fb3a2[_0x851b('0x4e')][_0x851b('0x53')],_0x1b6386[_0x851b('0x52')]['id'],_0x1fb3a2[_0x851b('0x48')]?JSON['stringify'](_0x1fb3a2['body']):_0x851b('0x54'));return respondWithRpcPromise('RejectMessage',_0x851b('0x55'),_0x1b6386);}return null;})[_0x851b('0x11')](function(_0x5a9ff0){var _0x3852d2='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5a9ff0[_0x851b('0x19')][_0x851b('0x56')];return db['sequelize']['query'](_0x3852d2,{'type':db[_0x851b('0x57')][_0x851b('0x58')]['SELECT'],'raw':!![]})['then'](function(_0x51e0da){return _0x51e0da;});})[_0x851b('0x11')](function(_0x2f1e7a){if(_0x2f1e7a){_0x1b6386[_0x851b('0x19')][_0x851b('0x59')]=_0x2f1e7a[0x0];if(!_0x1fb3a2[_0x851b('0x48')]['UserId'])return;return db[_0x851b('0x5a')][_0x851b('0x49')]({'where':{'id':_0x1fb3a2[_0x851b('0x48')][_0x851b('0x4d')],'role':'agent'},'attributes':['id',_0x851b('0x3e'),'fullname',_0x851b('0x5b'),'internal'],'raw':!![]});}return null;})[_0x851b('0x11')](function(_0x27ea2f){if(!_0x27ea2f)return null;_0x1b6386[_0x851b('0x19')][_0x851b('0x4f')]=_0x27ea2f;return _0x1b6386;})[_0x851b('0x11')](function(_0x2f084c){if(_0x2f084c){_0x2f084c['message']['interface']=util['format'](_0x851b('0x5c'),_0x1fb3a2[_0x851b('0x4e')][_0x851b('0x3e')]);_0x2f084c[_0x851b('0x19')]['channel']=_0x1b6386[_0x851b('0x5d')];_0x2f084c[_0x851b('0x19')][_0x851b('0x5e')]=_0x1b6386[_0x851b('0x5d')];_0x2f084c[_0x851b('0x19')][_0x851b('0x5f')]=_0x851b('0x60');respondWithRpcPromise(_0x851b('0x61'),'EventManager',{'event':_0x851b('0x62'),'message':_[_0x851b('0x3d')](_0x1b6386[_0x851b('0x19')],JSON[_0x851b('0x63')](_0x1b6386['interaction'][_0x851b('0x64')]))},client9002);return _0x1b6386;}return null;})[_0x851b('0x11')](respondWithResult(_0x9702e1,null))[_0x851b('0x46')](handleError(_0x9702e1,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index a07716d..7fbf39d 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 _0x56e3=['update','emit','hook','events','../../mysqldb','ChatMessage','save'];(function(_0x318f2,_0x3bc7b3){var _0x3bcab8=function(_0x19bc02){while(--_0x19bc02){_0x318f2['push'](_0x318f2['shift']());}};_0x3bcab8(++_0x3bc7b3);}(_0x56e3,0x17d));var _0x356e=function(_0x536da7,_0x5686ee){_0x536da7=_0x536da7-0x0;var _0x744edf=_0x56e3[_0x536da7];return _0x744edf;};'use strict';var EventEmitter=require(_0x356e('0x0'));var ChatMessage=require(_0x356e('0x1'))['db'][_0x356e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x356e('0x3'),'afterUpdate':_0x356e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x561596){return function(_0x5c66c9,_0x253610,_0x40a2ba){ChatMessageEvents[_0x356e('0x5')](_0x561596+':'+_0x5c66c9['id'],_0x5c66c9);ChatMessageEvents[_0x356e('0x5')](_0x561596,_0x5c66c9);_0x40a2ba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatMessage[_0x356e('0x6')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0x13b9=['remove','hasOwnProperty','exports','ChatMessage'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x13b9,0x117));var _0x913b=function(_0x66b39c,_0xad7354){_0x66b39c=_0x66b39c-0x0;var _0x451fe4=_0x13b9[_0x66b39c];return _0x451fe4;};'use strict';var EventEmitter=require('events');var ChatMessage=require('../../mysqldb')['db'][_0x913b('0x0')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x913b('0x1')};function emitEvent(_0x160366){return function(_0x3a1ae1,_0x422c3e,_0xe52964){ChatMessageEvents['emit'](_0x160366+':'+_0x3a1ae1['id'],_0x3a1ae1);ChatMessageEvents['emit'](_0x160366,_0x3a1ae1);_0xe52964(null);};}for(var e in events){if(events[_0x913b('0x2')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0x913b('0x3')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index 8fe9294..166e9ef 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 _0x2395=['request-promise','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird'];(function(_0x49ad45,_0x175d1d){var _0xf043c=function(_0x5b93a2){while(--_0x5b93a2){_0x49ad45['push'](_0x49ad45['shift']());}};_0xf043c(++_0x175d1d);}(_0x2395,0x114));var _0x5239=function(_0x886007,_0x55cca6){_0x886007=_0x886007-0x0;var _0x866e9f=_0x2395[_0x886007];return _0x866e9f;};'use strict';var _=require('lodash');var util=require(_0x5239('0x0'));var logger=require(_0x5239('0x1'))(_0x5239('0x2'));var moment=require('moment');var BPromise=require(_0x5239('0x3'));var rp=require(_0x5239('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5239('0x5'));var config=require(_0x5239('0x6'));var attributes=require(_0x5239('0x7'));module['exports']=function(_0x5c4428,_0x30e7b5){return _0x5c4428[_0x5239('0x8')]('ChatMessage',attributes,{'tableName':_0x5239('0x9'),'paranoid':![],'indexes':[{'name':_0x5239('0xa'),'fields':[_0x5239('0xb')],'type':_0x5239('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x12e8ef,_0x3674a9,_0x5c5e6e){var _0xd2988c=_0x5c4428['models'];var _0x373c90=_0x12e8ef[_0x5239('0xd')]({'plain':!![]});if(_0x373c90[_0x5239('0xe')][_0x5239('0xf')]()==='in'||_0x373c90[_0x5239('0xe')][_0x5239('0xf')]()===_0x5239('0x10')&&!_0x373c90[_0x5239('0x11')]&&!_[_0x5239('0x12')](_0x373c90[_0x5239('0x13')])){_0xd2988c[_0x5239('0x14')]['findOne']({'where':{'id':_0x373c90[_0x5239('0x15')]}})[_0x5239('0x16')](function(_0x25c541){if(_0x25c541){_0x25c541[_0x5239('0x17')]({'lastMsgAt':_0x373c90[_0x5239('0x18')],'lastMsgDirection':_0x373c90[_0x5239('0xe')][_0x5239('0xf')]()});}})[_0x5239('0x19')](function(_0x40d9fb){console[_0x5239('0x1a')](_0x40d9fb);});}_0x5c5e6e();}},'charset':'utf8mb4','collate':_0x5239('0x1b')});}; \ No newline at end of file +var _0xe797=['moment','bluebird','rimraf','../../config/environment','./chatMessage.attributes','define','ChatMessage','chat_messages','body','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x15664f,_0x3c74c5){var _0x1747f1=function(_0x3ca956){while(--_0x3ca956){_0x15664f['push'](_0x15664f['shift']());}};_0x1747f1(++_0x3c74c5);}(_0xe797,0x1da));var _0x7e79=function(_0x409c62,_0x52c0f5){_0x409c62=_0x409c62-0x0;var _0x15c3b6=_0xe797[_0x409c62];return _0x15c3b6;};'use strict';var _=require('lodash');var util=require(_0x7e79('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x7e79('0x1'));var BPromise=require(_0x7e79('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7e79('0x3'));var config=require(_0x7e79('0x4'));var attributes=require(_0x7e79('0x5'));module['exports']=function(_0x3ee086,_0x531453){return _0x3ee086[_0x7e79('0x6')](_0x7e79('0x7'),attributes,{'tableName':_0x7e79('0x8'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0x7e79('0x9')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1cdaba,_0xc4d48,_0x4b202f){var _0x388dca=_0x3ee086[_0x7e79('0xa')];var _0x52a7d3=_0x1cdaba[_0x7e79('0xb')]({'plain':!![]});if(_0x52a7d3[_0x7e79('0xc')][_0x7e79('0xd')]()==='in'||_0x52a7d3[_0x7e79('0xc')][_0x7e79('0xd')]()==='out'&&!_0x52a7d3[_0x7e79('0xe')]&&!_[_0x7e79('0xf')](_0x52a7d3[_0x7e79('0x10')])){_0x388dca[_0x7e79('0x11')][_0x7e79('0x12')]({'where':{'id':_0x52a7d3[_0x7e79('0x13')]}})[_0x7e79('0x14')](function(_0x118236){if(_0x118236){_0x118236['update']({'lastMsgAt':_0x52a7d3[_0x7e79('0x15')],'lastMsgDirection':_0x52a7d3[_0x7e79('0xc')]['toLowerCase']()});}})[_0x7e79('0x16')](function(_0x3fc7e4){console['error'](_0x3fc7e4);});}_0x4b202f();}},'charset':_0x7e79('0x17'),'collate':_0x7e79('0x18')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 2a72f16..1742f73 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 _0x1a9a=['client','defaults','redis','localhost','socket.io-emitter','then','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatMessage','ChatMessage','create','options','raw','debug','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52ce8e,_0x4dacf5){var _0x489cf9=function(_0x374ab2){while(--_0x374ab2){_0x52ce8e['push'](_0x52ce8e['shift']());}};_0x489cf9(++_0x4dacf5);}(_0x1a9a,0x19b));var _0xa1a9=function(_0x3d0a2c,_0x18e9b8){_0x3d0a2c=_0x3d0a2c-0x0;var _0x2265ab=_0x1a9a[_0x3d0a2c];return _0x2265ab;};'use strict';var _=require(_0xa1a9('0x0'));var util=require(_0xa1a9('0x1'));var moment=require(_0xa1a9('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa1a9('0x3'))['db'];var utils=require(_0xa1a9('0x4'));var logger=require(_0xa1a9('0x5'))(_0xa1a9('0x6'));var config=require(_0xa1a9('0x7'));var jayson=require(_0xa1a9('0x8'));var client=jayson[_0xa1a9('0x9')]['http']({'port':0x232a});config['redis']=_[_0xa1a9('0xa')](config[_0xa1a9('0xb')],{'host':_0xa1a9('0xc'),'port':0x18eb});var socket=require(_0xa1a9('0xd'))(new Redis(config['redis']));require('./chatMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a61bb,_0x56ac7f,_0x2550a7){return new BPromise(function(_0x3744cf,_0x4001e0){return client['request'](_0x2a61bb,_0x2550a7)[_0xa1a9('0xe')](function(_0x510b9e){logger['info'](_0xa1a9('0xf'),_0x56ac7f,_0xa1a9('0x10'));logger['debug'](_0xa1a9('0x11'),_0x56ac7f,'request\x20sent',JSON['stringify'](_0x510b9e));if(_0x510b9e[_0xa1a9('0x12')]){if(_0x510b9e['error'][_0xa1a9('0x13')]===0x1f4){logger['error'](_0xa1a9('0xf'),_0x56ac7f,_0x510b9e[_0xa1a9('0x12')][_0xa1a9('0x14')]);return _0x4001e0(_0x510b9e[_0xa1a9('0x12')][_0xa1a9('0x14')]);}logger[_0xa1a9('0x12')](_0xa1a9('0xf'),_0x56ac7f,_0x510b9e[_0xa1a9('0x12')][_0xa1a9('0x14')]);return _0x3744cf(_0x510b9e[_0xa1a9('0x12')]['message']);}else{logger[_0xa1a9('0x15')](_0xa1a9('0xf'),_0x56ac7f,_0xa1a9('0x10'));_0x3744cf(_0x510b9e[_0xa1a9('0x16')]['message']);}})[_0xa1a9('0x17')](function(_0x422d5b){logger['error'](_0xa1a9('0xf'),_0x56ac7f,_0x422d5b);_0x4001e0(_0x422d5b);});});}exports[_0xa1a9('0x18')]=function(_0x537d74){var _0x86d348=this;return new Promise(function(_0x278136,_0x3f8e5f){return db[_0xa1a9('0x19')][_0xa1a9('0x1a')](_0x537d74['body'],{'raw':_0x537d74[_0xa1a9('0x1b')]?_0x537d74[_0xa1a9('0x1b')][_0xa1a9('0x1c')]===undefined?!![]:![]:!![]})[_0xa1a9('0xe')](function(_0x4b8f7e){logger[_0xa1a9('0x15')](_0xa1a9('0x18'),_0x537d74);logger[_0xa1a9('0x1d')](_0xa1a9('0x18'),_0x537d74,JSON['stringify'](_0x4b8f7e));_0x278136(_0x4b8f7e);})[_0xa1a9('0x17')](function(_0x5aa0e0){logger[_0xa1a9('0x12')](_0xa1a9('0x18'),_0x5aa0e0['message'],_0x537d74);_0x3f8e5f(_0x86d348['error'](0x1f4,_0x5aa0e0[_0xa1a9('0x14')]));});});}; \ No newline at end of file +var _0x7c24=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./chatMessage.socket','register','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','create','options','raw','then','debug','CreateChatMessage','lodash','util','moment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x7c24,0xf9));var _0x47c2=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x7c24[_0x2c7618];return _0x5ce3f0;};'use strict';var _=require(_0x47c2('0x0'));var util=require(_0x47c2('0x1'));var moment=require(_0x47c2('0x2'));var BPromise=require(_0x47c2('0x3'));var rs=require(_0x47c2('0x4'));var fs=require('fs');var Redis=require(_0x47c2('0x5'));var db=require(_0x47c2('0x6'))['db'];var utils=require(_0x47c2('0x7'));var logger=require(_0x47c2('0x8'))(_0x47c2('0x9'));var config=require(_0x47c2('0xa'));var jayson=require(_0x47c2('0xb'));var client=jayson[_0x47c2('0xc')][_0x47c2('0xd')]({'port':0x232a});config['redis']=_[_0x47c2('0xe')](config['redis'],{'host':_0x47c2('0xf'),'port':0x18eb});var socket=require(_0x47c2('0x10'))(new Redis(config[_0x47c2('0x11')]));require(_0x47c2('0x12'))[_0x47c2('0x13')](socket);function respondWithRpcPromise(_0x40c88a,_0x398bc8,_0xd84fcc){return new BPromise(function(_0x1dd2d9,_0x5554f2){return client['request'](_0x40c88a,_0xd84fcc)['then'](function(_0x27749e){logger['info'](_0x47c2('0x14'),_0x398bc8,_0x47c2('0x15'));logger['debug'](_0x47c2('0x16'),_0x398bc8,_0x47c2('0x15'),JSON[_0x47c2('0x17')](_0x27749e));if(_0x27749e[_0x47c2('0x18')]){if(_0x27749e[_0x47c2('0x18')][_0x47c2('0x19')]===0x1f4){logger[_0x47c2('0x18')]('ChatMessage,\x20%s,\x20%s',_0x398bc8,_0x27749e[_0x47c2('0x18')][_0x47c2('0x1a')]);return _0x5554f2(_0x27749e['error'][_0x47c2('0x1a')]);}logger[_0x47c2('0x18')](_0x47c2('0x14'),_0x398bc8,_0x27749e[_0x47c2('0x18')][_0x47c2('0x1a')]);return _0x1dd2d9(_0x27749e[_0x47c2('0x18')][_0x47c2('0x1a')]);}else{logger[_0x47c2('0x1b')](_0x47c2('0x14'),_0x398bc8,_0x47c2('0x15'));_0x1dd2d9(_0x27749e[_0x47c2('0x1c')][_0x47c2('0x1a')]);}})[_0x47c2('0x1d')](function(_0x4799b5){logger[_0x47c2('0x18')](_0x47c2('0x14'),_0x398bc8,_0x4799b5);_0x5554f2(_0x4799b5);});});}exports['CreateChatMessage']=function(_0x4fb528){var _0x2c2bf2=this;return new Promise(function(_0x2a8fed,_0x2eaf3e){return db['ChatMessage'][_0x47c2('0x1e')](_0x4fb528['body'],{'raw':_0x4fb528['options']?_0x4fb528[_0x47c2('0x1f')][_0x47c2('0x20')]===undefined?!![]:![]:!![]})[_0x47c2('0x21')](function(_0x242890){logger[_0x47c2('0x1b')]('CreateChatMessage',_0x4fb528);logger[_0x47c2('0x22')](_0x47c2('0x23'),_0x4fb528,JSON[_0x47c2('0x17')](_0x242890));_0x2a8fed(_0x242890);})['catch'](function(_0x5870ff){logger[_0x47c2('0x18')](_0x47c2('0x23'),_0x5870ff[_0x47c2('0x1a')],_0x4fb528);_0x2eaf3e(_0x2c2bf2[_0x47c2('0x18')](0x1f4,_0x5870ff[_0x47c2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 37ff7ce..cba1248 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 _0x0e85=['update','removeListener','register','length','chatMessage:','./chatMessage.events','save'];(function(_0x4fe1e3,_0x587148){var _0x474845=function(_0x2c8876){while(--_0x2c8876){_0x4fe1e3['push'](_0x4fe1e3['shift']());}};_0x474845(++_0x587148);}(_0x0e85,0x7c));var _0x50e8=function(_0x369151,_0x179f72){_0x369151=_0x369151-0x0;var _0x4292d5=_0x0e85[_0x369151];return _0x4292d5;};'use strict';var ChatMessageEvents=require(_0x50e8('0x0'));var events=[_0x50e8('0x1'),'remove',_0x50e8('0x2')];function createListener(_0x682d10,_0x55e515){return function(_0x55cba3){_0x55e515['emit'](_0x682d10,_0x55cba3);};}function removeListener(_0x236cf3,_0x4e90e7){return function(){ChatMessageEvents[_0x50e8('0x3')](_0x236cf3,_0x4e90e7);};}exports[_0x50e8('0x4')]=function(_0xe3151e){for(var _0xfde42=0x0,_0x5e8b01=events[_0x50e8('0x5')];_0xfde42<_0x5e8b01;_0xfde42++){var _0x108edc=events[_0xfde42];var _0x42665e=createListener(_0x50e8('0x6')+_0x108edc,_0xe3151e);ChatMessageEvents['on'](_0x108edc,_0x42665e);}}; \ No newline at end of file +var _0x3eea=['removeListener','register','length','./chatMessage.events','remove','update','emit'];(function(_0x266945,_0x5c5e8c){var _0x4477d5=function(_0x18c0b2){while(--_0x18c0b2){_0x266945['push'](_0x266945['shift']());}};_0x4477d5(++_0x5c5e8c);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x5a15a2,_0x5873d3){_0x5a15a2=_0x5a15a2-0x0;var _0x2ab56c=_0x3eea[_0x5a15a2];return _0x2ab56c;};'use strict';var ChatMessageEvents=require(_0xa3ee('0x0'));var events=['save',_0xa3ee('0x1'),_0xa3ee('0x2')];function createListener(_0x16512c,_0x1c6a49){return function(_0x46acfa){_0x1c6a49[_0xa3ee('0x3')](_0x16512c,_0x46acfa);};}function removeListener(_0x104913,_0x35ed7d){return function(){ChatMessageEvents[_0xa3ee('0x4')](_0x104913,_0x35ed7d);};}exports[_0xa3ee('0x5')]=function(_0xb93cdb){for(var _0x5776bb=0x0,_0x538bf9=events[_0xa3ee('0x6')];_0x5776bb<_0x538bf9;_0x5776bb++){var _0x4e4588=events[_0x5776bb];var _0x37a3f0=createListener('chatMessage:'+_0x4e4588,_0xb93cdb);ChatMessageEvents['on'](_0x4e4588,_0x37a3f0);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index cbf0549..f3d37ab 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 _0x4596=['../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','describe','/:id','post','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2f5dad,_0x4313ad){var _0x38e02d=function(_0x44833a){while(--_0x44833a){_0x2f5dad['push'](_0x2f5dad['shift']());}};_0x38e02d(++_0x4313ad);}(_0x4596,0xe3));var _0x6459=function(_0x498b2e,_0x34a4ed){_0x498b2e=_0x498b2e-0x0;var _0x10ff45=_0x4596[_0x498b2e];return _0x10ff45;};'use strict';var multer=require(_0x6459('0x0'));var util=require(_0x6459('0x1'));var path=require('path');var timeout=require(_0x6459('0x2'));var express=require(_0x6459('0x3'));var router=express[_0x6459('0x4')]();var fs_extra=require(_0x6459('0x5'));var auth=require(_0x6459('0x6'));var interaction=require(_0x6459('0x7'));var config=require(_0x6459('0x8'));var controller=require(_0x6459('0x9'));router[_0x6459('0xa')]('/',auth[_0x6459('0xb')](),controller[_0x6459('0xc')]);router[_0x6459('0xa')]('/describe',auth[_0x6459('0xb')](),controller[_0x6459('0xd')]);router['get'](_0x6459('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x6459('0xf')]('/',auth[_0x6459('0xb')](),interaction['tracked'](_0x6459('0x10'),_0x6459('0x11')),controller[_0x6459('0x12')]);router[_0x6459('0x13')]('/:id',controller[_0x6459('0x14')]);router['put'](_0x6459('0x15'),auth[_0x6459('0xb')](),controller[_0x6459('0x16')]);router[_0x6459('0x13')]('/:id/reject',auth[_0x6459('0xb')](),controller[_0x6459('0x17')]);router['delete'](_0x6459('0xe'),auth[_0x6459('0xb')](),controller[_0x6459('0x18')]);module[_0x6459('0x19')]=router; \ No newline at end of file +var _0x4a86=['delete','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','/describe','isAuthenticated','describe','/:id','show','post','tracked','chat','chatmessage:create','update','/:id/accept','/:id/reject','reject'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4a86,0x1a5));var _0x64a8=function(_0x1da2b3,_0xc2e7cf){_0x1da2b3=_0x1da2b3-0x0;var _0x2c1ac6=_0x4a86[_0x1da2b3];return _0x2c1ac6;};'use strict';var multer=require('multer');var util=require(_0x64a8('0x0'));var path=require(_0x64a8('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x64a8('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x64a8('0x3'));var interaction=require(_0x64a8('0x4'));var config=require('../../config/environment');var controller=require(_0x64a8('0x5'));router[_0x64a8('0x6')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x64a8('0x7'),auth[_0x64a8('0x8')](),controller[_0x64a8('0x9')]);router[_0x64a8('0x6')](_0x64a8('0xa'),auth[_0x64a8('0x8')](),controller[_0x64a8('0xb')]);router[_0x64a8('0xc')]('/',auth[_0x64a8('0x8')](),interaction[_0x64a8('0xd')](_0x64a8('0xe'),_0x64a8('0xf')),controller['create']);router['put'](_0x64a8('0xa'),controller[_0x64a8('0x10')]);router['put'](_0x64a8('0x11'),auth['isAuthenticated'](),controller['accept']);router['put'](_0x64a8('0x12'),auth[_0x64a8('0x8')](),controller[_0x64a8('0x13')]);router[_0x64a8('0x14')](_0x64a8('0xa'),auth[_0x64a8('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 8b588dc..334c383 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['medium','exports','TEXT'];(function(_0x3411f8,_0x1681d1){var _0x2a7fd2=function(_0x2cda1a){while(--_0x2cda1a){_0x3411f8['push'](_0x3411f8['shift']());}};_0x2a7fd2(++_0x1681d1);}(_0x2032,0xd9));var _0x2203=function(_0x429633,_0x44ea98){_0x429633=_0x429633-0x0;var _0x60087b=_0x2032[_0x429633];return _0x60087b;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'body':{'type':Sequelize[_0x2203('0x1')](_0x2203('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x2203('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x464e93,_0x39e4b9){var _0x591865=function(_0x3c60e1){while(--_0x3c60e1){_0x464e93['push'](_0x464e93['shift']());}};_0x591865(++_0x39e4b9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3fe042,_0x1106f7){_0x3fe042=_0x3fe042-0x0;var _0x7d4a1f=_0xb10b[_0x3fe042];return _0x7d4a1f;};'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 9c03507..e499903 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x1cf6df,_0x1ce352){var _0x1fd96a=function(_0x3400d2){while(--_0x3400d2){_0x1cf6df['push'](_0x1cf6df['shift']());}};_0x1fd96a(++_0x1ce352);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x30a1d6,_0x57eedc){var _0x5afa8e=function(_0x445377){while(--_0x445377){_0x30a1d6['push'](_0x30a1d6['shift']());}};_0x5afa8e(++_0x57eedc);}(_0x9957,0x93));var _0x7995=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9957[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 0021db4..0269ef9 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 _0xd7ea=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save'];(function(_0xeb5f8d,_0x2549bf){var _0x4b3727=function(_0x337bbd){while(--_0x337bbd){_0xeb5f8d['push'](_0xeb5f8d['shift']());}};_0x4b3727(++_0x2549bf);}(_0xd7ea,0xeb));var _0xad7e=function(_0x180f0f,_0x1d2dc2){_0x180f0f=_0x180f0f-0x0;var _0xfd4e6c=_0xd7ea[_0x180f0f];return _0xfd4e6c;};'use strict';var EventEmitter=require(_0xad7e('0x0'));var ChatOfflineMessage=require(_0xad7e('0x1'))['db'][_0xad7e('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0xad7e('0x3')](0x0);var events={'afterCreate':_0xad7e('0x4'),'afterUpdate':'update','afterDestroy':_0xad7e('0x5')};function emitEvent(_0x2c987b){return function(_0x532f0d,_0x33aeb1,_0x4972a9){ChatOfflineMessageEvents['emit'](_0x2c987b+':'+_0x532f0d['id'],_0x532f0d);ChatOfflineMessageEvents[_0xad7e('0x6')](_0x2c987b,_0x532f0d);_0x4972a9(null);};}for(var e in events){if(events[_0xad7e('0x7')](e)){var event=events[e];ChatOfflineMessage[_0xad7e('0x8')](e,emitEvent(event));}}module[_0xad7e('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0x4607=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','setMaxListeners','save','update','remove','emit'];(function(_0x24dac7,_0x2ffbaa){var _0x32c81f=function(_0x5e6475){while(--_0x5e6475){_0x24dac7['push'](_0x24dac7['shift']());}};_0x32c81f(++_0x2ffbaa);}(_0x4607,0x121));var _0x7460=function(_0x1a7987,_0x2b7aa2){_0x1a7987=_0x1a7987-0x0;var _0x4c89c4=_0x4607[_0x1a7987];return _0x4c89c4;};'use strict';var EventEmitter=require(_0x7460('0x0'));var ChatOfflineMessage=require(_0x7460('0x1'))['db'][_0x7460('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x7460('0x3')](0x0);var events={'afterCreate':_0x7460('0x4'),'afterUpdate':_0x7460('0x5'),'afterDestroy':_0x7460('0x6')};function emitEvent(_0x2de7f8){return function(_0x353411,_0x53ebd1,_0x117045){ChatOfflineMessageEvents[_0x7460('0x7')](_0x2de7f8+':'+_0x353411['id'],_0x353411);ChatOfflineMessageEvents[_0x7460('0x7')](_0x2de7f8,_0x353411);_0x117045(null);};}for(var e in events){if(events[_0x7460('0x8')](e)){var event=events[e];ChatOfflineMessage[_0x7460('0x9')](e,emitEvent(event));}}module[_0x7460('0xa')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index e86be47..2fb7fa1 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 _0x6b78=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x4c3344,_0x4c9e10){var _0x358bde=function(_0x1a1acc){while(--_0x1a1acc){_0x4c3344['push'](_0x4c3344['shift']());}};_0x358bde(++_0x4c9e10);}(_0x6b78,0x1b7));var _0x86b7=function(_0x5b3a85,_0x41f90c){_0x5b3a85=_0x5b3a85-0x0;var _0x1a580b=_0x6b78[_0x5b3a85];return _0x1a580b;};'use strict';var attributes=require(_0x86b7('0x0'));module[_0x86b7('0x1')]=function(_0x3d62f6){return _0x3d62f6[_0x86b7('0x2')](_0x86b7('0x3'),attributes,{'tableName':_0x86b7('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x86b7('0x5'),'collate':_0x86b7('0x6')});}; \ No newline at end of file +var _0xc216=['define','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes'];(function(_0x148bad,_0x1ac85a){var _0x52aec4=function(_0x4a9faf){while(--_0x4a9faf){_0x148bad['push'](_0x148bad['shift']());}};_0x52aec4(++_0x1ac85a);}(_0xc216,0x9b));var _0x6c21=function(_0x26f1b2,_0x33d843){_0x26f1b2=_0x26f1b2-0x0;var _0x1624a4=_0xc216[_0x26f1b2];return _0x1624a4;};'use strict';var attributes=require(_0x6c21('0x0'));module['exports']=function(_0x4000ff){return _0x4000ff[_0x6c21('0x1')](_0x6c21('0x2'),attributes,{'tableName':_0x6c21('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6c21('0x4'),'collate':_0x6c21('0x5')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e333c13..0c713d0 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 _0x68c6=['then','info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x34e48b,_0x43ee22){var _0x26ff12=function(_0x1890b4){while(--_0x1890b4){_0x34e48b['push'](_0x34e48b['shift']());}};_0x26ff12(++_0x43ee22);}(_0x68c6,0x137));var _0x668c=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x68c6[_0x545bed];return _0x16c79c;};'use strict';var _=require('lodash');var util=require(_0x668c('0x0'));var moment=require(_0x668c('0x1'));var BPromise=require(_0x668c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x668c('0x3'));var logger=require(_0x668c('0x4'))(_0x668c('0x5'));var config=require(_0x668c('0x6'));var jayson=require(_0x668c('0x7'));var client=jayson['client'][_0x668c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3420d5,_0x3c4f87,_0x44b279){return new BPromise(function(_0x483ef6,_0x29758b){return client['request'](_0x3420d5,_0x44b279)[_0x668c('0x9')](function(_0x5ba1b8){logger[_0x668c('0xa')]('ChatOfflineMessage,\x20%s,\x20%s',_0x3c4f87,_0x668c('0xb'));logger[_0x668c('0xc')](_0x668c('0xd'),_0x3c4f87,_0x668c('0xb'),JSON[_0x668c('0xe')](_0x5ba1b8));if(_0x5ba1b8[_0x668c('0xf')]){if(_0x5ba1b8[_0x668c('0xf')][_0x668c('0x10')]===0x1f4){logger['error'](_0x668c('0x11'),_0x3c4f87,_0x5ba1b8[_0x668c('0xf')][_0x668c('0x12')]);return _0x29758b(_0x5ba1b8['error'][_0x668c('0x12')]);}logger[_0x668c('0xf')](_0x668c('0x11'),_0x3c4f87,_0x5ba1b8['error']['message']);return _0x483ef6(_0x5ba1b8[_0x668c('0xf')][_0x668c('0x12')]);}else{logger[_0x668c('0xa')](_0x668c('0x11'),_0x3c4f87,_0x668c('0xb'));_0x483ef6(_0x5ba1b8['result'][_0x668c('0x12')]);}})[_0x668c('0x13')](function(_0x1cdb1d){logger[_0x668c('0xf')](_0x668c('0x11'),_0x3c4f87,_0x1cdb1d);_0x29758b(_0x1cdb1d);});});} \ No newline at end of file +var _0x8966=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','randomstring'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8966,0x184));var _0x6896=function(_0x3edccf,_0xe16b3){_0x3edccf=_0x3edccf-0x0;var _0x2295b5=_0x8966[_0x3edccf];return _0x2295b5;};'use strict';var _=require('lodash');var util=require(_0x6896('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6896('0x1'));var fs=require('fs');var Redis=require(_0x6896('0x2'));var db=require(_0x6896('0x3'))['db'];var utils=require(_0x6896('0x4'));var logger=require('../../config/logger')(_0x6896('0x5'));var config=require('../../config/environment');var jayson=require(_0x6896('0x6'));var client=jayson['client'][_0x6896('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5655f0,_0x53dddc,_0x232300){return new BPromise(function(_0x595a00,_0xa35530){return client['request'](_0x5655f0,_0x232300)['then'](function(_0x54ac4a){logger[_0x6896('0x8')](_0x6896('0x9'),_0x53dddc,_0x6896('0xa'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x53dddc,_0x6896('0xa'),JSON['stringify'](_0x54ac4a));if(_0x54ac4a[_0x6896('0xb')]){if(_0x54ac4a[_0x6896('0xb')][_0x6896('0xc')]===0x1f4){logger[_0x6896('0xb')](_0x6896('0x9'),_0x53dddc,_0x54ac4a[_0x6896('0xb')][_0x6896('0xd')]);return _0xa35530(_0x54ac4a[_0x6896('0xb')][_0x6896('0xd')]);}logger[_0x6896('0xb')](_0x6896('0x9'),_0x53dddc,_0x54ac4a[_0x6896('0xb')][_0x6896('0xd')]);return _0x595a00(_0x54ac4a[_0x6896('0xb')]['message']);}else{logger[_0x6896('0x8')]('ChatOfflineMessage,\x20%s,\x20%s',_0x53dddc,_0x6896('0xa'));_0x595a00(_0x54ac4a[_0x6896('0xe')][_0x6896('0xd')]);}})['catch'](function(_0xe6da5e){logger[_0x6896('0xb')](_0x6896('0x9'),_0x53dddc,_0xe6da5e);_0xa35530(_0xe6da5e);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 6e9b502..beda700 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 _0x915c=['update','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put'];(function(_0x1d4297,_0x3cf1f9){var _0x3ba0c9=function(_0x23685d){while(--_0x23685d){_0x1d4297['push'](_0x1d4297['shift']());}};_0x3ba0c9(++_0x3cf1f9);}(_0x915c,0xea));var _0xc915=function(_0x1a98af,_0x377906){_0x1a98af=_0x1a98af-0x0;var _0x23023c=_0x915c[_0x1a98af];return _0x23023c;};'use strict';var multer=require(_0xc915('0x0'));var util=require('util');var path=require(_0xc915('0x1'));var timeout=require(_0xc915('0x2'));var express=require(_0xc915('0x3'));var router=express[_0xc915('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc915('0x5'));var interaction=require(_0xc915('0x6'));var config=require(_0xc915('0x7'));var controller=require(_0xc915('0x8'));router[_0xc915('0x9')]('/',auth[_0xc915('0xa')](),controller[_0xc915('0xb')]);router[_0xc915('0x9')]('/describe',auth[_0xc915('0xa')](),controller[_0xc915('0xc')]);router[_0xc915('0x9')](_0xc915('0xd'),auth[_0xc915('0xa')](),controller[_0xc915('0xe')]);router[_0xc915('0xf')]('/',auth[_0xc915('0xa')](),controller[_0xc915('0x10')]);router[_0xc915('0x11')](_0xc915('0xd'),auth[_0xc915('0xa')](),controller[_0xc915('0x12')]);router['delete'](_0xc915('0xd'),auth[_0xc915('0xa')](),controller[_0xc915('0x13')]);module[_0xc915('0x14')]=router; \ No newline at end of file +var _0xde5b=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','put','update','delete','exports','multer','path','express','Router'];(function(_0x2440fe,_0x281a11){var _0x5cf734=function(_0x38e12b){while(--_0x38e12b){_0x2440fe['push'](_0x2440fe['shift']());}};_0x5cf734(++_0x281a11);}(_0xde5b,0x13f));var _0xbde5=function(_0x27cbb6,_0x3e5142){_0x27cbb6=_0x27cbb6-0x0;var _0x219d8e=_0xde5b[_0x27cbb6];return _0x219d8e;};'use strict';var multer=require(_0xbde5('0x0'));var util=require('util');var path=require(_0xbde5('0x1'));var timeout=require('connect-timeout');var express=require(_0xbde5('0x2'));var router=express[_0xbde5('0x3')]();var fs_extra=require(_0xbde5('0x4'));var auth=require(_0xbde5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbde5('0x6'));var controller=require('./chatOfflineMessage.controller');router[_0xbde5('0x7')]('/',auth[_0xbde5('0x8')](),controller[_0xbde5('0x9')]);router['get']('/describe',auth[_0xbde5('0x8')](),controller[_0xbde5('0xa')]);router[_0xbde5('0x7')](_0xbde5('0xb'),auth[_0xbde5('0x8')](),controller[_0xbde5('0xc')]);router['post']('/',auth[_0xbde5('0x8')](),controller['create']);router[_0xbde5('0xd')]('/:id',auth[_0xbde5('0x8')](),controller[_0xbde5('0xe')]);router[_0xbde5('0xf')](_0xbde5('0xb'),auth[_0xbde5('0x8')](),controller['destroy']);module[_0xbde5('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index cb1e12f..3acdd6c 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 _0xdadb=['mouseOver','sequelize','exports','STRING','ENUM'];(function(_0x585133,_0x2412a1){var _0x18254a=function(_0x4c8aaf){while(--_0x4c8aaf){_0x585133['push'](_0x585133['shift']());}};_0x18254a(++_0x2412a1);}(_0xdadb,0x15a));var _0xbdad=function(_0x34584e,_0x6616f4){_0x34584e=_0x34584e-0x0;var _0x570a60=_0xdadb[_0x34584e];return _0x570a60;};'use strict';var Sequelize=require(_0xbdad('0x0'));module[_0xbdad('0x1')]={'name':{'type':Sequelize[_0xbdad('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbdad('0x3')](_0xbdad('0x4'),'timeout'),'defaultValue':_0xbdad('0x4')},'selector':{'type':Sequelize[_0xbdad('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xc20c=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver','timeout'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0xc20c,0x19e));var _0xcc20=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0xc20c[_0x1ccbcc];return _0x1e873f;};'use strict';var Sequelize=require(_0xcc20('0x0'));module[_0xcc20('0x1')]={'name':{'type':Sequelize[_0xcc20('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xcc20('0x3')](_0xcc20('0x4'),_0xcc20('0x5')),'defaultValue':_0xcc20('0x4')},'selector':{'type':Sequelize[_0xcc20('0x2')]},'timeout':{'type':Sequelize[_0xcc20('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 76fdba7..645e5bf 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 _0x74f3=['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/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','stack','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','length','includeAll','include','options','create','body','catch','find','eml-format','rimraf','zip-dir','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x74f3,0x164));var _0x374f=function(_0x4f61a1,_0x35820b){_0x4f61a1=_0x4f61a1-0x0;var _0xae8b64=_0x74f3[_0x4f61a1];return _0xae8b64;};'use strict';var emlformat=require(_0x374f('0x0'));var rimraf=require(_0x374f('0x1'));var zipdir=require(_0x374f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x374f('0x3'));var moment=require(_0x374f('0x4'));var BPromise=require(_0x374f('0x5'));var Mustache=require(_0x374f('0x6'));var util=require('util');var path=require(_0x374f('0x7'));var sox=require(_0x374f('0x8'));var csv=require('to-csv');var ejs=require(_0x374f('0x9'));var fs=require('fs');var fs_extra=require(_0x374f('0xa'));var _=require(_0x374f('0xb'));var squel=require(_0x374f('0xc'));var crypto=require(_0x374f('0xd'));var jsforce=require(_0x374f('0xe'));var deskjs=require(_0x374f('0xf'));var toCsv=require(_0x374f('0x10'));var querystring=require('querystring');var Papa=require(_0x374f('0x11'));var Redis=require(_0x374f('0x12'));var authService=require(_0x374f('0x13'));var qs=require(_0x374f('0x14'));var as=require(_0x374f('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x374f('0x16'))(_0x374f('0x17'));var utils=require('../../config/utils');var config=require(_0x374f('0x18'));var licenseUtil=require(_0x374f('0x19'));var db=require(_0x374f('0x1a'))['db'];function respondWithStatusCode(_0x5ac724,_0x46c396){_0x46c396=_0x46c396||0xcc;return function(_0x3abcdb){if(_0x3abcdb){return _0x5ac724['sendStatus'](_0x46c396);}return _0x5ac724[_0x374f('0x1b')](_0x46c396)[_0x374f('0x1c')]();};}function respondWithResult(_0x5eca08,_0xcfcc04){_0xcfcc04=_0xcfcc04||0xc8;return function(_0x504dc8){if(_0x504dc8){return _0x5eca08[_0x374f('0x1b')](_0xcfcc04)[_0x374f('0x1d')](_0x504dc8);}};}function respondWithFilteredResult(_0x1060c4,_0x3ae58d){return function(_0x1215d5){if(_0x1215d5){var _0x21db8c=typeof _0x3ae58d[_0x374f('0x1e')]===_0x374f('0x1f')&&typeof _0x3ae58d[_0x374f('0x20')]===_0x374f('0x1f');var _0x729572=_0x1215d5[_0x374f('0x21')];var _0x13c210=_0x21db8c?0x0:_0x3ae58d['offset'];var _0x55eb4f=_0x21db8c?_0x1215d5[_0x374f('0x21')]:_0x3ae58d['offset']+_0x3ae58d[_0x374f('0x20')];var _0x39532b;if(_0x55eb4f>=_0x729572){_0x55eb4f=_0x729572;_0x39532b=0xc8;}else{_0x39532b=0xce;}_0x1060c4[_0x374f('0x1b')](_0x39532b);return _0x1060c4['set'](_0x374f('0x22'),_0x13c210+'-'+_0x55eb4f+'/'+_0x729572)['json'](_0x1215d5);}return null;};}function patchUpdates(_0xbcc48f){return function(_0x3bcd1e){try{jsonpatch[_0x374f('0x23')](_0x3bcd1e,_0xbcc48f,!![]);}catch(_0x4df021){return BPromise[_0x374f('0x24')](_0x4df021);}return _0x3bcd1e['save']();};}function saveUpdates(_0x42dff9,_0x27b9ae){return function(_0x2de93d){if(_0x2de93d){return _0x2de93d[_0x374f('0x25')](_0x42dff9)[_0x374f('0x26')](function(_0x188db8){return _0x188db8;});}return null;};}function removeEntity(_0x56f727,_0x4d7ccf){return function(_0x1146a3){if(_0x1146a3){return _0x1146a3[_0x374f('0x27')]()[_0x374f('0x26')](function(){_0x56f727['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d13e4,_0x5a6ddd){return function(_0x5418cd){if(!_0x5418cd){_0x2d13e4['sendStatus'](0x194);}return _0x5418cd;};}function handleError(_0x5ada90,_0x29d2b2){_0x29d2b2=_0x29d2b2||0x1f4;return function(_0x253239){logger['error'](_0x253239[_0x374f('0x28')]);if(_0x253239[_0x374f('0x29')]){delete _0x253239[_0x374f('0x29')];}_0x5ada90[_0x374f('0x1b')](_0x29d2b2)['send'](_0x253239);};}exports[_0x374f('0x2a')]=function(_0x4900b9,_0x2b6664){var _0x3d42f0={'raw':!![],'where':{'id':_0x4900b9[_0x374f('0x2b')]['id']}},_0x2a21d6={};_0x2a21d6[_0x374f('0x2c')]=_[_0x374f('0x2d')](db[_0x374f('0x2e')][_0x374f('0x2f')]);_0x2a21d6[_0x374f('0x30')]=_[_0x374f('0x2d')](_0x4900b9['query']);_0x2a21d6[_0x374f('0x31')]=_[_0x374f('0x32')](_0x2a21d6['model'],_0x2a21d6[_0x374f('0x30')]);_0x3d42f0['attributes']=_[_0x374f('0x32')](_0x2a21d6[_0x374f('0x2c')],qs['fields'](_0x4900b9[_0x374f('0x30')]['fields']));_0x3d42f0[_0x374f('0x33')]=_0x3d42f0[_0x374f('0x33')][_0x374f('0x34')]?_0x3d42f0['attributes']:_0x2a21d6[_0x374f('0x2c')];if(_0x4900b9[_0x374f('0x30')][_0x374f('0x35')]){_0x3d42f0[_0x374f('0x36')]=[{'all':!![]}];}_0x3d42f0=_['merge']({},_0x3d42f0,_0x4900b9[_0x374f('0x37')]);return db[_0x374f('0x2e')]['find'](_0x3d42f0)[_0x374f('0x26')](handleEntityNotFound(_0x2b6664,null))['then'](respondWithResult(_0x2b6664,null))['catch'](handleError(_0x2b6664,null));};exports['create']=function(_0x1b84ac,_0x34bdec){return db[_0x374f('0x2e')][_0x374f('0x38')](_0x1b84ac[_0x374f('0x39')],{})[_0x374f('0x26')](respondWithResult(_0x34bdec,0xc9))['catch'](handleError(_0x34bdec,null));};exports[_0x374f('0x25')]=function(_0x50c898,_0x59ff69){if(_0x50c898[_0x374f('0x39')]['id']){delete _0x50c898['body']['id'];}return db[_0x374f('0x2e')]['find']({'where':{'id':_0x50c898['params']['id']}})[_0x374f('0x26')](handleEntityNotFound(_0x59ff69,null))[_0x374f('0x26')](saveUpdates(_0x50c898[_0x374f('0x39')],null))[_0x374f('0x26')](respondWithResult(_0x59ff69,null))[_0x374f('0x3a')](handleError(_0x59ff69,null));};exports[_0x374f('0x27')]=function(_0x134fb1,_0x4138b9){return db['ChatProactiveAction'][_0x374f('0x3b')]({'where':{'id':_0x134fb1['params']['id']}})[_0x374f('0x26')](handleEntityNotFound(_0x4138b9,null))[_0x374f('0x26')](removeEntity(_0x4138b9,null))['catch'](handleError(_0x4138b9,null));}; \ No newline at end of file +var _0x78b7=['rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','catch','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','then','destroy','error','stack','name','send','params','keys','ChatProactiveAction'];(function(_0x3bd78d,_0x381dbf){var _0x1c5bad=function(_0x1dc0b7){while(--_0x1dc0b7){_0x3bd78d['push'](_0x3bd78d['shift']());}};_0x1c5bad(++_0x381dbf);}(_0x78b7,0x194));var _0x778b=function(_0x4c117d,_0xf11d85){_0x4c117d=_0x4c117d-0x0;var _0x1d1319=_0x78b7[_0x4c117d];return _0x1d1319;};'use strict';var emlformat=require(_0x778b('0x0'));var rimraf=require(_0x778b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x778b('0x2'));var rp=require(_0x778b('0x3'));var moment=require(_0x778b('0x4'));var BPromise=require(_0x778b('0x5'));var Mustache=require(_0x778b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x778b('0x7'));var csv=require(_0x778b('0x8'));var ejs=require(_0x778b('0x9'));var fs=require('fs');var fs_extra=require(_0x778b('0xa'));var _=require(_0x778b('0xb'));var squel=require(_0x778b('0xc'));var crypto=require('crypto');var jsforce=require(_0x778b('0xd'));var deskjs=require(_0x778b('0xe'));var toCsv=require(_0x778b('0x8'));var querystring=require(_0x778b('0xf'));var Papa=require(_0x778b('0x10'));var Redis=require('ioredis');var authService=require(_0x778b('0x11'));var qs=require(_0x778b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x778b('0x13'));var logger=require(_0x778b('0x14'))(_0x778b('0x15'));var utils=require(_0x778b('0x16'));var config=require(_0x778b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2f7ca7,_0x8ae3a9){_0x8ae3a9=_0x8ae3a9||0xcc;return function(_0x39584a){if(_0x39584a){return _0x2f7ca7[_0x778b('0x18')](_0x8ae3a9);}return _0x2f7ca7[_0x778b('0x19')](_0x8ae3a9)[_0x778b('0x1a')]();};}function respondWithResult(_0x47026b,_0x5c09c9){_0x5c09c9=_0x5c09c9||0xc8;return function(_0x1a7672){if(_0x1a7672){return _0x47026b[_0x778b('0x19')](_0x5c09c9)[_0x778b('0x1b')](_0x1a7672);}};}function respondWithFilteredResult(_0x389d63,_0x7aa12){return function(_0x52be17){if(_0x52be17){var _0x1bf480=typeof _0x7aa12['offset']===_0x778b('0x1c')&&typeof _0x7aa12[_0x778b('0x1d')]==='undefined';var _0x23069d=_0x52be17['count'];var _0x2d2732=_0x1bf480?0x0:_0x7aa12[_0x778b('0x1e')];var _0x5d9376=_0x1bf480?_0x52be17[_0x778b('0x1f')]:_0x7aa12[_0x778b('0x1e')]+_0x7aa12[_0x778b('0x1d')];var _0x5d4c05;if(_0x5d9376>=_0x23069d){_0x5d9376=_0x23069d;_0x5d4c05=0xc8;}else{_0x5d4c05=0xce;}_0x389d63[_0x778b('0x19')](_0x5d4c05);return _0x389d63[_0x778b('0x20')](_0x778b('0x21'),_0x2d2732+'-'+_0x5d9376+'/'+_0x23069d)[_0x778b('0x1b')](_0x52be17);}return null;};}function patchUpdates(_0x128388){return function(_0xa9c869){try{jsonpatch['apply'](_0xa9c869,_0x128388,!![]);}catch(_0x3f7282){return BPromise[_0x778b('0x22')](_0x3f7282);}return _0xa9c869['save']();};}function saveUpdates(_0x4083c2,_0x4a9564){return function(_0x3736f1){if(_0x3736f1){return _0x3736f1['update'](_0x4083c2)[_0x778b('0x23')](function(_0x4efc37){return _0x4efc37;});}return null;};}function removeEntity(_0x5bf9bb,_0xcef5c){return function(_0x578252){if(_0x578252){return _0x578252[_0x778b('0x24')]()[_0x778b('0x23')](function(){_0x5bf9bb[_0x778b('0x19')](0xcc)[_0x778b('0x1a')]();});}};}function handleEntityNotFound(_0x2095af,_0x4f1b03){return function(_0xa9083a){if(!_0xa9083a){_0x2095af[_0x778b('0x18')](0x194);}return _0xa9083a;};}function handleError(_0x1bc22f,_0x4ce74d){_0x4ce74d=_0x4ce74d||0x1f4;return function(_0x554c67){logger[_0x778b('0x25')](_0x554c67[_0x778b('0x26')]);if(_0x554c67[_0x778b('0x27')]){delete _0x554c67[_0x778b('0x27')];}_0x1bc22f[_0x778b('0x19')](_0x4ce74d)[_0x778b('0x28')](_0x554c67);};}exports['show']=function(_0x527051,_0x480714){var _0x17721e={'raw':!![],'where':{'id':_0x527051[_0x778b('0x29')]['id']}},_0xccca67={};_0xccca67['model']=_[_0x778b('0x2a')](db[_0x778b('0x2b')][_0x778b('0x2c')]);_0xccca67[_0x778b('0x2d')]=_[_0x778b('0x2a')](_0x527051['query']);_0xccca67[_0x778b('0x2e')]=_[_0x778b('0x2f')](_0xccca67['model'],_0xccca67['query']);_0x17721e[_0x778b('0x30')]=_[_0x778b('0x2f')](_0xccca67['model'],qs[_0x778b('0x31')](_0x527051[_0x778b('0x2d')][_0x778b('0x31')]));_0x17721e[_0x778b('0x30')]=_0x17721e[_0x778b('0x30')][_0x778b('0x32')]?_0x17721e['attributes']:_0xccca67['model'];if(_0x527051[_0x778b('0x2d')][_0x778b('0x33')]){_0x17721e['include']=[{'all':!![]}];}_0x17721e=_['merge']({},_0x17721e,_0x527051['options']);return db[_0x778b('0x2b')]['find'](_0x17721e)[_0x778b('0x23')](handleEntityNotFound(_0x480714,null))['then'](respondWithResult(_0x480714,null))[_0x778b('0x34')](handleError(_0x480714,null));};exports[_0x778b('0x35')]=function(_0x51b580,_0x179e51){return db['ChatProactiveAction'][_0x778b('0x35')](_0x51b580[_0x778b('0x36')],{})[_0x778b('0x23')](respondWithResult(_0x179e51,0xc9))[_0x778b('0x34')](handleError(_0x179e51,null));};exports['update']=function(_0x4d49e9,_0x2feb02){if(_0x4d49e9['body']['id']){delete _0x4d49e9[_0x778b('0x36')]['id'];}return db[_0x778b('0x2b')][_0x778b('0x37')]({'where':{'id':_0x4d49e9[_0x778b('0x29')]['id']}})[_0x778b('0x23')](handleEntityNotFound(_0x2feb02,null))[_0x778b('0x23')](saveUpdates(_0x4d49e9['body'],null))['then'](respondWithResult(_0x2feb02,null))[_0x778b('0x34')](handleError(_0x2feb02,null));};exports[_0x778b('0x24')]=function(_0x57aaac,_0x1b3da5){return db[_0x778b('0x2b')][_0x778b('0x37')]({'where':{'id':_0x57aaac[_0x778b('0x29')]['id']}})[_0x778b('0x23')](handleEntityNotFound(_0x1b3da5,null))[_0x778b('0x23')](removeEntity(_0x1b3da5,null))[_0x778b('0x34')](handleError(_0x1b3da5,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 5e64145..9510a9f 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 _0xdbaf=['rimraf','./chatProactiveAction.attributes','exports','ChatProactiveAction','chat_proactive_actions','lodash','../../config/logger','api','bluebird'];(function(_0x284000,_0x3d5360){var _0x45d224=function(_0x4c4385){while(--_0x4c4385){_0x284000['push'](_0x284000['shift']());}};_0x45d224(++_0x3d5360);}(_0xdbaf,0x125));var _0xfdba=function(_0x13eda3,_0x3c908b){_0x13eda3=_0x13eda3-0x0;var _0x419f73=_0xdbaf[_0x13eda3];return _0x419f73;};'use strict';var _=require(_0xfdba('0x0'));var util=require('util');var logger=require(_0xfdba('0x1'))(_0xfdba('0x2'));var moment=require('moment');var BPromise=require(_0xfdba('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfdba('0x4'));var config=require('../../config/environment');var attributes=require(_0xfdba('0x5'));module[_0xfdba('0x6')]=function(_0x264ff1,_0x5dead8){return _0x264ff1['define'](_0xfdba('0x7'),attributes,{'tableName':_0xfdba('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x64ac=['moment','bluebird','request-promise','path','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','util','../../config/logger'];(function(_0x47985e,_0x350685){var _0x23e631=function(_0x10838e){while(--_0x10838e){_0x47985e['push'](_0x47985e['shift']());}};_0x23e631(++_0x350685);}(_0x64ac,0x6c));var _0xc64a=function(_0x5c44c9,_0x3350d4){_0x5c44c9=_0x5c44c9-0x0;var _0x31a957=_0x64ac[_0x5c44c9];return _0x31a957;};'use strict';var _=require('lodash');var util=require(_0xc64a('0x0'));var logger=require(_0xc64a('0x1'))('api');var moment=require(_0xc64a('0x2'));var BPromise=require(_0xc64a('0x3'));var rp=require(_0xc64a('0x4'));var fs=require('fs');var path=require(_0xc64a('0x5'));var rimraf=require('rimraf');var config=require(_0xc64a('0x6'));var attributes=require(_0xc64a('0x7'));module[_0xc64a('0x8')]=function(_0x2215fa,_0x224e72){return _0x2215fa[_0xc64a('0x9')](_0xc64a('0xa'),attributes,{'tableName':'chat_proactive_actions','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 790a492..768e8c1 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 _0x469c=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x3f0bfc,_0x104792){var _0x52b0c3=function(_0x573330){while(--_0x573330){_0x3f0bfc['push'](_0x3f0bfc['shift']());}};_0x52b0c3(++_0x104792);}(_0x469c,0xff));var _0xc469=function(_0x19a90e,_0xe14b0b){_0x19a90e=_0x19a90e-0x0;var _0xa49b11=_0x469c[_0x19a90e];return _0xa49b11;};'use strict';var _=require(_0xc469('0x0'));var util=require(_0xc469('0x1'));var moment=require(_0xc469('0x2'));var BPromise=require(_0xc469('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc469('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc469('0x5'));var logger=require(_0xc469('0x6'))(_0xc469('0x7'));var config=require('../../config/environment');var jayson=require(_0xc469('0x8'));var client=jayson[_0xc469('0x9')][_0xc469('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476bec,_0x3b7480,_0x22e0c6){return new BPromise(function(_0x427227,_0x44daac){return client['request'](_0x476bec,_0x22e0c6)[_0xc469('0xb')](function(_0x3b27e8){logger[_0xc469('0xc')](_0xc469('0xd'),_0x3b7480,_0xc469('0xe'));logger[_0xc469('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x3b7480,_0xc469('0xe'),JSON[_0xc469('0x10')](_0x3b27e8));if(_0x3b27e8['error']){if(_0x3b27e8['error']['code']===0x1f4){logger[_0xc469('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b7480,_0x3b27e8['error'][_0xc469('0x12')]);return _0x44daac(_0x3b27e8[_0xc469('0x11')]['message']);}logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3b7480,_0x3b27e8[_0xc469('0x11')][_0xc469('0x12')]);return _0x427227(_0x3b27e8[_0xc469('0x11')][_0xc469('0x12')]);}else{logger['info'](_0xc469('0xd'),_0x3b7480,_0xc469('0xe'));_0x427227(_0x3b27e8[_0xc469('0x13')]['message']);}})[_0xc469('0x14')](function(_0x12aaf3){logger['error']('ChatProactiveAction,\x20%s,\x20%s',_0x3b7480,_0x12aaf3);_0x44daac(_0x12aaf3);});});} \ No newline at end of file +var _0x75d5=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x15e8fe,_0x14d43e){var _0x28bd91=function(_0x5bfc87){while(--_0x5bfc87){_0x15e8fe['push'](_0x15e8fe['shift']());}};_0x28bd91(++_0x14d43e);}(_0x75d5,0x1c7));var _0x575d=function(_0x1ad47e,_0x5bc8eb){_0x1ad47e=_0x1ad47e-0x0;var _0x175aa2=_0x75d5[_0x1ad47e];return _0x175aa2;};'use strict';var _=require(_0x575d('0x0'));var util=require(_0x575d('0x1'));var moment=require(_0x575d('0x2'));var BPromise=require(_0x575d('0x3'));var rs=require(_0x575d('0x4'));var fs=require('fs');var Redis=require(_0x575d('0x5'));var db=require(_0x575d('0x6'))['db'];var utils=require(_0x575d('0x7'));var logger=require(_0x575d('0x8'))(_0x575d('0x9'));var config=require('../../config/environment');var jayson=require(_0x575d('0xa'));var client=jayson[_0x575d('0xb')][_0x575d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5366ea,_0x2ff9fe,_0x3bc7d5){return new BPromise(function(_0x4b3cb0,_0x478d97){return client[_0x575d('0xd')](_0x5366ea,_0x3bc7d5)[_0x575d('0xe')](function(_0x51c8ed){logger[_0x575d('0xf')](_0x575d('0x10'),_0x2ff9fe,'request\x20sent');logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x2ff9fe,_0x575d('0x11'),JSON[_0x575d('0x12')](_0x51c8ed));if(_0x51c8ed['error']){if(_0x51c8ed['error'][_0x575d('0x13')]===0x1f4){logger[_0x575d('0x14')](_0x575d('0x10'),_0x2ff9fe,_0x51c8ed[_0x575d('0x14')]['message']);return _0x478d97(_0x51c8ed[_0x575d('0x14')]['message']);}logger[_0x575d('0x14')](_0x575d('0x10'),_0x2ff9fe,_0x51c8ed['error'][_0x575d('0x15')]);return _0x4b3cb0(_0x51c8ed[_0x575d('0x14')][_0x575d('0x15')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x2ff9fe,'request\x20sent');_0x4b3cb0(_0x51c8ed['result'][_0x575d('0x15')]);}})[_0x575d('0x16')](function(_0x4c7307){logger[_0x575d('0x14')]('ChatProactiveAction,\x20%s,\x20%s',_0x2ff9fe,_0x4c7307);_0x478d97(_0x4c7307);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index ee6740c..8d80512 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 _0x3eea=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','post','create','update','isAuthenticated','destroy','multer'];(function(_0x12546e,_0x49a072){var _0x5173d9=function(_0x4b860a){while(--_0x4b860a){_0x12546e['push'](_0x12546e['shift']());}};_0x5173d9(++_0x49a072);}(_0x3eea,0x1ca));var _0xa3ee=function(_0x39ab21,_0x265ac4){_0x39ab21=_0x39ab21-0x0;var _0x403d45=_0x3eea[_0x39ab21];return _0x403d45;};'use strict';var multer=require(_0xa3ee('0x0'));var util=require('util');var path=require(_0xa3ee('0x1'));var timeout=require(_0xa3ee('0x2'));var express=require(_0xa3ee('0x3'));var router=express[_0xa3ee('0x4')]();var fs_extra=require(_0xa3ee('0x5'));var auth=require(_0xa3ee('0x6'));var interaction=require(_0xa3ee('0x7'));var config=require(_0xa3ee('0x8'));var controller=require(_0xa3ee('0x9'));router[_0xa3ee('0xa')](_0xa3ee('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xa3ee('0xc')]('/',auth['isAuthenticated'](),controller[_0xa3ee('0xd')]);router['put'](_0xa3ee('0xb'),auth['isAuthenticated'](),controller[_0xa3ee('0xe')]);router['delete'](_0xa3ee('0xb'),auth[_0xa3ee('0xf')](),controller[_0xa3ee('0x10')]);module['exports']=router; \ No newline at end of file +var _0x2eb2=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','get','/:id','isAuthenticated','show','post','create','put','update','delete','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x2eb2,0x19f));var _0x22eb=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x2eb2[_0x550d12];return _0x12103d;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var fs_extra=require(_0x22eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x22eb('0x6'));var config=require('../../config/environment');var controller=require('./chatProactiveAction.controller');router[_0x22eb('0x7')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xa')]);router[_0x22eb('0xb')]('/',auth[_0x22eb('0x9')](),controller[_0x22eb('0xc')]);router[_0x22eb('0xd')](_0x22eb('0x8'),auth[_0x22eb('0x9')](),controller[_0x22eb('0xe')]);router[_0x22eb('0xf')]('/:id',auth[_0x22eb('0x9')](),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 6742a2f..54d2c8b 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 _0x0982=['beepall','roundrobin','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x585e84,_0x1d8489){var _0x39f3c4=function(_0x1855a3){while(--_0x1855a3){_0x585e84['push'](_0x585e84['shift']());}};_0x39f3c4(++_0x1d8489);}(_0x0982,0x14b));var _0x2098=function(_0x3c1e73,_0x4b5325){_0x3c1e73=_0x3c1e73-0x0;var _0x4229a3=_0x0982[_0x3c1e73];return _0x4229a3;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x2098('0x0')],'unique':_0x2098('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2098('0x0')]},'timeout':{'type':Sequelize[_0x2098('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2098('0x3')](_0x2098('0x4'),_0x2098('0x5'),_0x2098('0x6'))}}; \ No newline at end of file +var _0x6579=['beepall','sequelize','STRING','name','ENUM','rrmemory'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6579,0x10f));var _0x9657=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6579[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9657('0x0'));module['exports']={'name':{'type':Sequelize[_0x9657('0x1')],'unique':_0x9657('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9657('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9657('0x3')](_0x9657('0x4'),_0x9657('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 02caf9e..043c1be 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 _0xe49d=['each','UserChatQueue','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','User','select','tq.TeamId','from','join','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','addAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','undefined','limit','count','set','update','then','destroy','ChatQueues','UserProfileResource','sendStatus','error','stack','name','send','index','map','ChatQueue','rawAttributes','type','getOptions','where','include','query','rows','show','params','model','keys','filters','attributes','intersection','fields','options','find','catch','create','body','get','role','user','UserProfileSection','userProfileId','autoAssociation','findOne','length','hasOwnProperty','order','sort','pick','ChatQueueId','filter','merge','findAndCountAll','agent','chatPause','createdAt','updatedAt','getTeams','nolimit','addTeams','ids','Team','findAll','online','interface','Agents','sequelize','transaction'];(function(_0x4b775b,_0x2aadc6){var _0xf84d39=function(_0x55ac96){while(--_0x55ac96){_0x4b775b['push'](_0x4b775b['shift']());}};_0xf84d39(++_0x2aadc6);}(_0xe49d,0x1ee));var _0xde49=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe49d[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0xde49('0x0'));var util=require(_0xde49('0x1'));var _=require('lodash');var squel=require(_0xde49('0x2'));var Redis=require(_0xde49('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xde49('0x4'))(_0xde49('0x5'));var config=require(_0xde49('0x6'));var db=require(_0xde49('0x7'))['db'];config[_0xde49('0x8')]=_[_0xde49('0x9')](config['redis'],{'host':_0xde49('0xa'),'port':0x18eb});var socket=require(_0xde49('0xb'))(new Redis(config[_0xde49('0x8')]));require(_0xde49('0xc'))[_0xde49('0xd')](socket);function respondWithStatusCode(_0x406d47,_0x2e4cd3){_0x2e4cd3=_0x2e4cd3||0xcc;return function(_0x1efdb7){if(_0x1efdb7){return _0x406d47['sendStatus'](_0x2e4cd3);}return _0x406d47[_0xde49('0xe')](_0x2e4cd3)[_0xde49('0xf')]();};}function respondWithResult(_0x5715a0,_0x4fcd11){_0x4fcd11=_0x4fcd11||0xc8;return function(_0x36baae){if(_0x36baae){return _0x5715a0[_0xde49('0xe')](_0x4fcd11)[_0xde49('0x10')](_0x36baae);}};}function respondWithFilteredResult(_0x364b6d,_0x8dfb87){return function(_0x589485){if(_0x589485){var _0x11187b=typeof _0x8dfb87[_0xde49('0x11')]===_0xde49('0x12')&&typeof _0x8dfb87[_0xde49('0x13')]===_0xde49('0x12');var _0x28d452=_0x589485[_0xde49('0x14')];var _0x30c3de=_0x11187b?0x0:_0x8dfb87[_0xde49('0x11')];var _0x1bef97=_0x11187b?_0x589485[_0xde49('0x14')]:_0x8dfb87['offset']+_0x8dfb87[_0xde49('0x13')];var _0x100dbd;if(_0x1bef97>=_0x28d452){_0x1bef97=_0x28d452;_0x100dbd=0xc8;}else{_0x100dbd=0xce;}_0x364b6d[_0xde49('0xe')](_0x100dbd);return _0x364b6d[_0xde49('0x15')]('Content-Range',_0x30c3de+'-'+_0x1bef97+'/'+_0x28d452)['json'](_0x589485);}return null;};}function saveUpdates(_0x3b4b7b){return function(_0x200f30){if(_0x200f30){return _0x200f30[_0xde49('0x16')](_0x3b4b7b)[_0xde49('0x17')](function(_0x6e5376){return _0x6e5376;});}return null;};}function removeEntity(_0x34bd53){return function(_0x388093){if(_0x388093){return _0x388093[_0xde49('0x18')]()[_0xde49('0x17')](function(){var _0x14515d=_0x388093['get']({'plain':!![]});var _0x21a2f7=_0xde49('0x19');return db[_0xde49('0x1a')][_0xde49('0x18')]({'where':{'type':_0x21a2f7,'resourceId':_0x14515d['id']}})[_0xde49('0x17')](function(){return _0x388093;});})[_0xde49('0x17')](function(){_0x34bd53[_0xde49('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x113b40){return function(_0x6c6a8){if(!_0x6c6a8){_0x113b40[_0xde49('0x1b')](0x194);}return _0x6c6a8;};}function handleError(_0x25725a,_0x2c593d){_0x2c593d=_0x2c593d||0x1f4;return function(_0x870ff3){logger[_0xde49('0x1c')](_0x870ff3[_0xde49('0x1d')]);if(_0x870ff3[_0xde49('0x1e')]){delete _0x870ff3['name'];}_0x25725a[_0xde49('0xe')](_0x2c593d)[_0xde49('0x1f')](_0x870ff3);};}exports[_0xde49('0x20')]=function(_0x107af0,_0xfd9682){var _0x1547e9={};var _0x3bd9b4={'count':0x0,'rows':[]};var _0x72cdad=_[_0xde49('0x21')](db[_0xde49('0x22')][_0xde49('0x23')],function(_0x1f9422){return{'name':_0x1f9422['fieldName'],'type':_0x1f9422[_0xde49('0x24')]['key']};});_0x1547e9=qs[_0xde49('0x25')](_0x72cdad,_0x107af0);var _0x4fd45a={'where':_0x1547e9[_0xde49('0x26')]};return db[_0xde49('0x22')][_0xde49('0x14')](_0x4fd45a)[_0xde49('0x17')](function(_0x281830){_0x3bd9b4[_0xde49('0x14')]=_0x281830;_0x1547e9[_0xde49('0x27')]=qs[_0xde49('0x27')](_0x107af0[_0xde49('0x28')]);return db[_0xde49('0x22')]['findAll'](_0x1547e9);})[_0xde49('0x17')](function(_0x2a0542){_0x3bd9b4[_0xde49('0x29')]=_0x2a0542;return _0x3bd9b4;})[_0xde49('0x17')](respondWithFilteredResult(_0xfd9682,_0x1547e9))['catch'](handleError(_0xfd9682,null));};exports[_0xde49('0x2a')]=function(_0x427262,_0x366f3b){var _0x5cf36d={'raw':!![],'where':{'id':_0x427262[_0xde49('0x2b')]['id']}},_0x5c3c82={};_0x5c3c82[_0xde49('0x2c')]=_['keys'](db[_0xde49('0x22')]['rawAttributes']);_0x5c3c82['query']=_[_0xde49('0x2d')](_0x427262['query']);_0x5c3c82[_0xde49('0x2e')]=_['intersection'](_0x5c3c82[_0xde49('0x2c')],_0x5c3c82[_0xde49('0x28')]);_0x5cf36d[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x5c3c82[_0xde49('0x2c')],qs[_0xde49('0x31')](_0x427262[_0xde49('0x28')][_0xde49('0x31')]));_0x5cf36d[_0xde49('0x2f')]=_0x5cf36d[_0xde49('0x2f')]['length']?_0x5cf36d[_0xde49('0x2f')]:_0x5c3c82['model'];if(_0x427262[_0xde49('0x28')]['includeAll']){_0x5cf36d[_0xde49('0x27')]=[{'all':!![]}];}_0x5cf36d=_['merge']({},_0x5cf36d,_0x427262[_0xde49('0x32')]);return db[_0xde49('0x22')][_0xde49('0x33')](_0x5cf36d)['then'](handleEntityNotFound(_0x366f3b,null))['then'](respondWithResult(_0x366f3b,null))[_0xde49('0x34')](handleError(_0x366f3b,null));};exports[_0xde49('0x35')]=function(_0x1aa804,_0x5d85fe){return db['ChatQueue'][_0xde49('0x35')](_0x1aa804[_0xde49('0x36')],{})[_0xde49('0x17')](function(_0x30e8d1){var _0x41281f=_0x1aa804['user'][_0xde49('0x37')]({'plain':!![]});if(!_0x41281f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41281f[_0xde49('0x38')]===_0xde49('0x39')){var _0x136998=_0x30e8d1[_0xde49('0x37')]({'plain':!![]});var _0x15928c=_0xde49('0x19');return db[_0xde49('0x3a')][_0xde49('0x33')]({'where':{'name':_0x15928c,'userProfileId':_0x41281f[_0xde49('0x3b')]},'raw':!![]})[_0xde49('0x17')](function(_0x2d669f){if(_0x2d669f&&_0x2d669f[_0xde49('0x3c')]===0x0){return db[_0xde49('0x1a')]['create']({'name':_0x136998[_0xde49('0x1e')],'resourceId':_0x136998['id'],'type':_0x2d669f[_0xde49('0x1e')],'sectionId':_0x2d669f['id']},{})[_0xde49('0x17')](function(){return _0x30e8d1;});}else{return _0x30e8d1;}})[_0xde49('0x34')](function(_0x1006ec){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1006ec);throw _0x1006ec;});}return _0x30e8d1;})['then'](respondWithResult(_0x5d85fe,0xc9))[_0xde49('0x34')](handleError(_0x5d85fe,null));};exports['update']=function(_0x56503b,_0x10502c){if(_0x56503b[_0xde49('0x36')]['id']){delete _0x56503b[_0xde49('0x36')]['id'];}return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0x56503b[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x10502c,null))[_0xde49('0x17')](saveUpdates(_0x56503b['body'],null))[_0xde49('0x17')](respondWithResult(_0x10502c,null))[_0xde49('0x34')](handleError(_0x10502c,null));};exports[_0xde49('0x18')]=function(_0x53e772,_0x44a246){return db['ChatQueue'][_0xde49('0x33')]({'where':{'id':_0x53e772[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x44a246,null))[_0xde49('0x17')](removeEntity(_0x44a246,null))[_0xde49('0x34')](handleError(_0x44a246,null));};exports['describe']=function(_0x1e56a2,_0x91fc48){return db[_0xde49('0x22')]['describe']()[_0xde49('0x17')](respondWithResult(_0x91fc48,null))[_0xde49('0x34')](handleError(_0x91fc48,null));};exports['getMembers']=function(_0xa11662,_0x12ecd5){var _0x25b15d={'raw':!![],'where':{}},_0x535d76={},_0x1317f4;return db[_0xde49('0x22')][_0xde49('0x3d')]({'where':{'id':_0xa11662[_0xde49('0x2b')]['id']}})['then'](handleEntityNotFound(_0x12ecd5,null))[_0xde49('0x17')](function(_0x5f016f){if(_0x5f016f){_0x1317f4=_0x5f016f[_0xde49('0x37')]({'plain':!![]});_0x535d76[_0xde49('0x2c')]=_[_0xde49('0x2d')](db['UserChatQueue']['rawAttributes']);_0x535d76[_0xde49('0x28')]=_[_0xde49('0x2d')](_0xa11662[_0xde49('0x28')]);_0x535d76[_0xde49('0x2e')]=_[_0xde49('0x30')](_0x535d76[_0xde49('0x2c')],_0x535d76[_0xde49('0x28')]);_0x25b15d[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x535d76['model'],qs[_0xde49('0x31')](_0xa11662['query']['fields']));_0x25b15d['attributes']=_0x25b15d['attributes'][_0xde49('0x3e')]?_0x25b15d['attributes']:_0x535d76[_0xde49('0x2c')];if(!_0xa11662[_0xde49('0x28')][_0xde49('0x3f')]('nolimit')){_0x25b15d[_0xde49('0x13')]=qs['limit'](_0xa11662[_0xde49('0x28')]['limit']);_0x25b15d[_0xde49('0x11')]=qs['offset'](_0xa11662[_0xde49('0x28')][_0xde49('0x11')]);}_0x25b15d[_0xde49('0x40')]=qs[_0xde49('0x41')](_0xa11662[_0xde49('0x28')][_0xde49('0x41')]);_0x25b15d[_0xde49('0x26')]=qs['filters'](_[_0xde49('0x42')](_0xa11662[_0xde49('0x28')],_0x535d76[_0xde49('0x2e')]));_0x25b15d['where'][_0xde49('0x43')]=_0x5f016f['id'];if(_0xa11662[_0xde49('0x28')][_0xde49('0x44')]){_0x25b15d[_0xde49('0x26')]=_[_0xde49('0x45')](_0x25b15d[_0xde49('0x26')],{'$or':_[_0xde49('0x21')](_0x25b15d[_0xde49('0x2f')],function(_0x5da66a){var _0x1a8436={};_0x1a8436[_0x5da66a]={'$like':'%'+_0xa11662[_0xde49('0x28')][_0xde49('0x44')]+'%'};return _0x1a8436;})});}_0x25b15d=_['merge']({},_0x25b15d,_0xa11662[_0xde49('0x32')]);return db['UserChatQueue']['findAll'](_0x25b15d);}})[_0xde49('0x17')](function(_0x3f8472){if(_0x3f8472){return db['User'][_0xde49('0x46')]({'where':{'id':_[_0xde49('0x21')](_0x3f8472,'UserId'),'role':_0xde49('0x47')},'attributes':['id','name',_0xde49('0x48'),'updatedAt',_0xde49('0x49')]});}})[_0xde49('0x17')](function(_0x11004c){if(_0x11004c){return{'count':_0x11004c[_0xde49('0x14')],'rows':_[_0xde49('0x21')](_0x11004c[_0xde49('0x29')],function(_0x3d2f36){return{'membername':_0x3d2f36[_0xde49('0x1e')],'UserId':_0x3d2f36['id'],'queue_name':_0x1317f4[_0xde49('0x1e')],'ChatQueueId':_0x1317f4['id'],'interface':util['format']('%s/%s','SIP',_0x3d2f36[_0xde49('0x1e')]),'penalty':0x0,'paused':_0x3d2f36[_0xde49('0x48')],'createdAt':_0x3d2f36[_0xde49('0x49')],'updatedAt':_0x3d2f36[_0xde49('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xde49('0x17')](respondWithFilteredResult(_0x12ecd5,_0x25b15d))[_0xde49('0x34')](handleError(_0x12ecd5,null));};exports[_0xde49('0x4b')]=function(_0x4f35f2,_0x1bde6f){var _0x292455={};var _0x383c2f={};var _0xe576f5;var _0x17282f;return db['ChatQueue'][_0xde49('0x3d')]({'where':{'id':_0x4f35f2[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x1bde6f,null))['then'](function(_0x3004de){if(_0x3004de){_0xe576f5=_0x3004de;_0x383c2f['model']=_[_0xde49('0x2d')](db['Team'][_0xde49('0x23')]);_0x383c2f[_0xde49('0x28')]=_['keys'](_0x4f35f2['query']);_0x383c2f[_0xde49('0x2e')]=_[_0xde49('0x30')](_0x383c2f[_0xde49('0x2c')],_0x383c2f[_0xde49('0x28')]);_0x292455[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x383c2f[_0xde49('0x2c')],qs['fields'](_0x4f35f2['query'][_0xde49('0x31')]));_0x292455[_0xde49('0x2f')]=_0x292455[_0xde49('0x2f')][_0xde49('0x3e')]?_0x292455[_0xde49('0x2f')]:_0x383c2f['model'];_0x292455['order']=qs[_0xde49('0x41')](_0x4f35f2[_0xde49('0x28')][_0xde49('0x41')]);_0x292455['where']=qs['filters'](_[_0xde49('0x42')](_0x4f35f2[_0xde49('0x28')],_0x383c2f[_0xde49('0x2e')]));if(_0x4f35f2[_0xde49('0x28')][_0xde49('0x44')]){_0x292455[_0xde49('0x26')]=_[_0xde49('0x45')](_0x292455[_0xde49('0x26')],{'$or':_['map'](_0x292455[_0xde49('0x2f')],function(_0x1131da){var _0x451f0b={};_0x451f0b[_0x1131da]={'$like':'%'+_0x4f35f2['query']['filter']+'%'};return _0x451f0b;})});}_0x292455=_['merge']({},_0x292455,_0x4f35f2[_0xde49('0x32')]);return _0xe576f5['getTeams'](_0x292455);}})[_0xde49('0x17')](function(_0x41cddc){if(_0x41cddc){_0x17282f=_0x41cddc[_0xde49('0x3e')];if(!_0x4f35f2[_0xde49('0x28')][_0xde49('0x3f')](_0xde49('0x4c'))){_0x292455['limit']=qs['limit'](_0x4f35f2[_0xde49('0x28')][_0xde49('0x13')]);_0x292455['offset']=qs['offset'](_0x4f35f2[_0xde49('0x28')][_0xde49('0x11')]);}return _0xe576f5[_0xde49('0x4b')](_0x292455);}})[_0xde49('0x17')](function(_0x4290f1){if(_0x4290f1){return _0x4290f1?{'count':_0x17282f,'rows':_0x4290f1}:null;}})[_0xde49('0x17')](respondWithResult(_0x1bde6f,null))['catch'](handleError(_0x1bde6f,null));};exports[_0xde49('0x4d')]=function(_0x358e75,_0x4d25ff){var _0x2f2f41=_0x358e75[_0xde49('0x36')][_0xde49('0x4e')];return db[_0xde49('0x4f')][_0xde49('0x50')]({'where':{'id':_0x2f2f41},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id','name',_0xde49('0x51'),'voicePause',_0xde49('0x52')],'raw':!![]}]})[_0xde49('0x17')](function(_0x5d5ac2){if(_0x5d5ac2){var _0x3506aa=_['flatMap'](_0x5d5ac2,function(_0x11bfe4){var _0x53750e=_0x11bfe4['get']({'plain':!![]});return _0x53750e[_0xde49('0x53')];});return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0x358e75[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](function(_0x3b41ee){return db[_0xde49('0x54')][_0xde49('0x55')](function(_0x3bf59a){return _0x3b41ee[_0xde49('0x4d')](_0x2f2f41,{'transaction':_0x3bf59a})[_0xde49('0x17')](function(){return BPromise[_0xde49('0x56')](_0x3506aa,function(_0x27fff2){return db[_0xde49('0x57')][_0xde49('0x58')]({'where':{'UserId':_0x27fff2['id'],'ChatQueueId':_0x358e75[_0xde49('0x2b')]['id']},'transaction':_0x3bf59a});});})[_0xde49('0x17')](function(){_0x3506aa[_0xde49('0x59')](function(_0x246957){socket[_0xde49('0x5a')](_0xde49('0x5b'),{'UserId':_0x246957['id'],'ChatQueueId':_0x3b41ee['id']});});});});});}})[_0xde49('0x17')](respondWithStatusCode(_0x4d25ff,null))[_0xde49('0x34')](handleError(_0x4d25ff,null));};exports[_0xde49('0x5c')]=function(_0x92c259,_0x4ee992){return db['Team'][_0xde49('0x50')]({'where':{'id':_0x92c259['query'][_0xde49('0x4e')]},'attributes':['id'],'include':[{'model':db[_0xde49('0x5d')],'as':_0xde49('0x53'),'attributes':['id'],'raw':!![]}]})[_0xde49('0x17')](handleEntityNotFound(_0x4ee992,null))[_0xde49('0x17')](function(_0x189805){var _0x8af480=_['map'](_0x189805,'id');var _0x1314b5=[];var _0x49d4f2=[];var _0x1128e3=squel[_0xde49('0x5e')]();_0x1128e3['field'](_0xde49('0x5f'))[_0xde49('0x60')]('team_has_chat_queues','tq')[_0xde49('0x61')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xde49('0x26')](_0xde49('0x62'),_0x92c259['params']['id']);for(var _0x4c27cf=0x0;_0x4c27cf<_0x189805['length'];_0x4c27cf+=0x1){let _0x38d1ce=_0x189805[_0x4c27cf];for(var _0x302f64=0x0;_0x302f64<_0x38d1ce[_0xde49('0x53')][_0xde49('0x3e')];_0x302f64+=0x1){let _0x488ae1=_0x38d1ce[_0xde49('0x53')][_0x302f64];var _0x3cb7be=_0x1128e3[_0xde49('0x63')]();_0x3cb7be[_0xde49('0x26')](_0xde49('0x64'),_0x488ae1['id']);_0x49d4f2[_0xde49('0x65')](db[_0xde49('0x54')][_0xde49('0x28')](_0x3cb7be[_0xde49('0x66')](),{'type':db['sequelize']['QueryTypes'][_0xde49('0x67')]})[_0xde49('0x17')](function(_0x56ae21){if(_0x56ae21['length']===0x1){return _0x488ae1['id'];}else{var _0x2edb49=_[_0xde49('0x68')](_[_0xde49('0x21')](_0x56ae21,_0xde49('0x69')),function(_0xb7d482){return _[_0xde49('0x6a')](_0x8af480,_0xb7d482);});if(_0x2edb49){return _0x488ae1['id'];}}}));}}return BPromise[_0xde49('0x6b')](_0x49d4f2)[_0xde49('0x17')](function(_0x7c7c0d){_0x1314b5=_(_0x1314b5)['union'](_0x7c7c0d)[_0xde49('0x6c')]()[_0xde49('0x6d')]();return db['ChatQueue']['find']({'where':{'id':_0x92c259[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](function(_0x320255){return db[_0xde49('0x54')][_0xde49('0x55')](function(_0x1b2418){return _0x320255[_0xde49('0x5c')](_0x92c259['query'][_0xde49('0x4e')],{'transaction':_0x1b2418})[_0xde49('0x17')](function(){if(!_[_0xde49('0x6e')](_0x1314b5)){return _0x320255[_0xde49('0x6f')](_0x1314b5,{'transaction':_0x1b2418});}})[_0xde49('0x17')](function(){_0x1314b5[_0xde49('0x59')](function(_0x1c3b45){socket[_0xde49('0x5a')]('userChatQueue:remove',{'UserId':_0x1c3b45,'ChatQueueId':_0x320255['id']});});});});});});})[_0xde49('0x17')](respondWithStatusCode(_0x4ee992,null))[_0xde49('0x34')](handleError(_0x4ee992,null));};exports[_0xde49('0x70')]=function(_0xdc582d,_0x1058a7){return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0xdc582d[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x1058a7,null))[_0xde49('0x17')](function(_0x22e078){if(_0x22e078){return _0x22e078[_0xde49('0x70')](_0xdc582d[_0xde49('0x36')][_0xde49('0x4e')],_['omit'](_0xdc582d[_0xde49('0x36')],[_0xde49('0x4e'),'id'])||{})['spread'](function(_0x4d73f4){for(var _0x8b06b5=0x0;_0x8b06b5<_0xdc582d[_0xde49('0x36')][_0xde49('0x4e')][_0xde49('0x3e')];_0x8b06b5+=0x1){socket[_0xde49('0x5a')](_0xde49('0x5b'),{'UserId':Number(_0xdc582d[_0xde49('0x36')][_0xde49('0x4e')][_0x8b06b5]),'ChatQueueId':Number(_0xdc582d['params']['id'])});}return _0x4d73f4;});}})[_0xde49('0x17')](respondWithResult(_0x1058a7,null))['catch'](handleError(_0x1058a7,null));};exports['removeAgents']=function(_0x186805,_0x55e91a){return db[_0xde49('0x22')][_0xde49('0x33')]({'where':{'id':_0x186805[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x55e91a,null))[_0xde49('0x17')](function(_0x584ed7){if(_0x584ed7){return _0x584ed7[_0xde49('0x6f')](_0x186805['query'][_0xde49('0x4e')])[_0xde49('0x17')](function(){if(_[_0xde49('0x71')](_0x186805[_0xde49('0x28')][_0xde49('0x4e')])){for(var _0x3c3a36=0x0;_0x3c3a36<_0x186805[_0xde49('0x28')][_0xde49('0x4e')][_0xde49('0x3e')];_0x3c3a36+=0x1){socket[_0xde49('0x5a')](_0xde49('0x72'),{'UserId':Number(_0x186805['query'][_0xde49('0x4e')][_0x3c3a36]),'ChatQueueId':Number(_0x186805[_0xde49('0x2b')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x186805['query'][_0xde49('0x4e')]),'ChatQueueId':Number(_0x186805['params']['id'])});}});}})[_0xde49('0x17')](respondWithStatusCode(_0x55e91a,null))[_0xde49('0x34')](handleError(_0x55e91a,null));};exports['getAgents']=function(_0x2d66e4,_0x351ed8){var _0x395c67={};var _0x505a93={};var _0x38d1a4;var _0x198ec8;return db[_0xde49('0x22')]['findOne']({'where':{'id':_0x2d66e4[_0xde49('0x2b')]['id']}})[_0xde49('0x17')](handleEntityNotFound(_0x351ed8,null))[_0xde49('0x17')](function(_0x4eedbc){if(_0x4eedbc){_0x38d1a4=_0x4eedbc;_0x505a93[_0xde49('0x2c')]=_['keys'](db[_0xde49('0x5d')][_0xde49('0x23')]);_0x505a93['query']=_[_0xde49('0x2d')](_0x2d66e4['query']);_0x505a93[_0xde49('0x2e')]=_[_0xde49('0x30')](_0x505a93['model'],_0x505a93[_0xde49('0x28')]);_0x395c67[_0xde49('0x2f')]=_[_0xde49('0x30')](_0x505a93[_0xde49('0x2c')],qs[_0xde49('0x31')](_0x2d66e4[_0xde49('0x28')][_0xde49('0x31')]));_0x395c67[_0xde49('0x2f')]=_0x395c67[_0xde49('0x2f')][_0xde49('0x3e')]?_0x395c67['attributes']:_0x505a93['model'];_0x395c67['order']=qs[_0xde49('0x41')](_0x2d66e4[_0xde49('0x28')][_0xde49('0x41')]);_0x395c67[_0xde49('0x26')]=qs[_0xde49('0x2e')](_[_0xde49('0x42')](_0x2d66e4['query'],_0x505a93[_0xde49('0x2e')]));if(_0x2d66e4['query']['filter']){_0x395c67[_0xde49('0x26')]=_[_0xde49('0x45')](_0x395c67['where'],{'$or':_[_0xde49('0x21')](_0x395c67[_0xde49('0x2f')],function(_0x30b1c7){var _0x1a1964={};_0x1a1964[_0x30b1c7]={'$like':'%'+_0x2d66e4['query'][_0xde49('0x44')]+'%'};return _0x1a1964;})});}_0x395c67=_[_0xde49('0x45')]({},_0x395c67,_0x2d66e4['options']);return _0x38d1a4[_0xde49('0x73')](_0x395c67);}})[_0xde49('0x17')](function(_0x30fc76){if(_0x30fc76){_0x198ec8=_0x30fc76[_0xde49('0x3e')];if(!_0x2d66e4[_0xde49('0x28')][_0xde49('0x3f')]('nolimit')){_0x395c67[_0xde49('0x13')]=qs[_0xde49('0x13')](_0x2d66e4['query'][_0xde49('0x13')]);_0x395c67[_0xde49('0x11')]=qs['offset'](_0x2d66e4[_0xde49('0x28')][_0xde49('0x11')]);}return _0x38d1a4['getAgents'](_0x395c67);}})[_0xde49('0x17')](function(_0x255f2c){if(_0x255f2c){return _0x255f2c?{'count':_0x198ec8,'rows':_0x255f2c}:null;}})[_0xde49('0x17')](respondWithResult(_0x351ed8,null))[_0xde49('0x34')](handleError(_0x351ed8,null));}; \ No newline at end of file +var _0xceea=['count','set','then','destroy','UserProfileResource','error','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChatQueues','UserProfileSection','autoAssociation','update','describe','getMembers','findOne','get','UserChatQueue','hasOwnProperty','sort','pick','ChatQueueId','filter','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','nolimit','addTeams','Agents','online','flatMap','transaction','each','findOrCreate','forEach','emit','ids','select','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','getAgents','bluebird','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','status','end','json','offset','limit','undefined'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xceea,0xe7));var _0xacee=function(_0x49b1ca,_0x32f161){_0x49b1ca=_0x49b1ca-0x0;var _0x5650bb=_0xceea[_0x49b1ca];return _0x5650bb;};'use strict';var BPromise=require(_0xacee('0x0'));var util=require('util');var _=require(_0xacee('0x1'));var squel=require(_0xacee('0x2'));var Redis=require('ioredis');var qs=require(_0xacee('0x3'));var logger=require(_0xacee('0x4'))(_0xacee('0x5'));var config=require('../../config/environment');var db=require(_0xacee('0x6'))['db'];config['redis']=_[_0xacee('0x7')](config[_0xacee('0x8')],{'host':_0xacee('0x9'),'port':0x18eb});var socket=require(_0xacee('0xa'))(new Redis(config[_0xacee('0x8')]));require(_0xacee('0xb'))[_0xacee('0xc')](socket);function respondWithStatusCode(_0x9575f3,_0x133999){_0x133999=_0x133999||0xcc;return function(_0x179935){if(_0x179935){return _0x9575f3['sendStatus'](_0x133999);}return _0x9575f3[_0xacee('0xd')](_0x133999)[_0xacee('0xe')]();};}function respondWithResult(_0x55ea18,_0x593b1f){_0x593b1f=_0x593b1f||0xc8;return function(_0x4ec6d9){if(_0x4ec6d9){return _0x55ea18[_0xacee('0xd')](_0x593b1f)[_0xacee('0xf')](_0x4ec6d9);}};}function respondWithFilteredResult(_0x46ce65,_0x2cb230){return function(_0x557c68){if(_0x557c68){var _0x4d0489=typeof _0x2cb230[_0xacee('0x10')]==='undefined'&&typeof _0x2cb230[_0xacee('0x11')]===_0xacee('0x12');var _0x181d9e=_0x557c68[_0xacee('0x13')];var _0x38073a=_0x4d0489?0x0:_0x2cb230['offset'];var _0x328784=_0x4d0489?_0x557c68['count']:_0x2cb230[_0xacee('0x10')]+_0x2cb230[_0xacee('0x11')];var _0x57f589;if(_0x328784>=_0x181d9e){_0x328784=_0x181d9e;_0x57f589=0xc8;}else{_0x57f589=0xce;}_0x46ce65['status'](_0x57f589);return _0x46ce65[_0xacee('0x14')]('Content-Range',_0x38073a+'-'+_0x328784+'/'+_0x181d9e)[_0xacee('0xf')](_0x557c68);}return null;};}function saveUpdates(_0x22bd6e){return function(_0x749fa4){if(_0x749fa4){return _0x749fa4['update'](_0x22bd6e)[_0xacee('0x15')](function(_0x1885ce){return _0x1885ce;});}return null;};}function removeEntity(_0x49fed2){return function(_0x2b4457){if(_0x2b4457){return _0x2b4457[_0xacee('0x16')]()['then'](function(){var _0x2d1101=_0x2b4457['get']({'plain':!![]});var _0x23d3ed='ChatQueues';return db[_0xacee('0x17')]['destroy']({'where':{'type':_0x23d3ed,'resourceId':_0x2d1101['id']}})[_0xacee('0x15')](function(){return _0x2b4457;});})[_0xacee('0x15')](function(){_0x49fed2[_0xacee('0xd')](0xcc)[_0xacee('0xe')]();});}};}function handleEntityNotFound(_0x315908){return function(_0x2d3742){if(!_0x2d3742){_0x315908['sendStatus'](0x194);}return _0x2d3742;};}function handleError(_0x4509c6,_0x5021ea){_0x5021ea=_0x5021ea||0x1f4;return function(_0x436f30){logger[_0xacee('0x18')](_0x436f30['stack']);if(_0x436f30[_0xacee('0x19')]){delete _0x436f30[_0xacee('0x19')];}_0x4509c6[_0xacee('0xd')](_0x5021ea)[_0xacee('0x1a')](_0x436f30);};}exports[_0xacee('0x1b')]=function(_0xfb9adb,_0x2c07a8){var _0x4e69a2={};var _0x57e87e={'count':0x0,'rows':[]};var _0x3036f2=_[_0xacee('0x1c')](db[_0xacee('0x1d')][_0xacee('0x1e')],function(_0x44514c){return{'name':_0x44514c[_0xacee('0x1f')],'type':_0x44514c[_0xacee('0x20')][_0xacee('0x21')]};});_0x4e69a2=qs[_0xacee('0x22')](_0x3036f2,_0xfb9adb);var _0x37e3a7={'where':_0x4e69a2[_0xacee('0x23')]};return db[_0xacee('0x1d')][_0xacee('0x13')](_0x37e3a7)['then'](function(_0x403315){_0x57e87e['count']=_0x403315;_0x4e69a2[_0xacee('0x24')]=qs[_0xacee('0x24')](_0xfb9adb[_0xacee('0x25')]);return db[_0xacee('0x1d')][_0xacee('0x26')](_0x4e69a2);})[_0xacee('0x15')](function(_0x26da1c){_0x57e87e[_0xacee('0x27')]=_0x26da1c;return _0x57e87e;})[_0xacee('0x15')](respondWithFilteredResult(_0x2c07a8,_0x4e69a2))[_0xacee('0x28')](handleError(_0x2c07a8,null));};exports[_0xacee('0x29')]=function(_0x308df7,_0x443634){var _0x21d9d6={'raw':!![],'where':{'id':_0x308df7[_0xacee('0x2a')]['id']}},_0x12fdd4={};_0x12fdd4[_0xacee('0x2b')]=_[_0xacee('0x2c')](db['ChatQueue'][_0xacee('0x1e')]);_0x12fdd4['query']=_[_0xacee('0x2c')](_0x308df7[_0xacee('0x25')]);_0x12fdd4[_0xacee('0x2d')]=_[_0xacee('0x2e')](_0x12fdd4['model'],_0x12fdd4[_0xacee('0x25')]);_0x21d9d6[_0xacee('0x2f')]=_[_0xacee('0x2e')](_0x12fdd4[_0xacee('0x2b')],qs[_0xacee('0x30')](_0x308df7[_0xacee('0x25')][_0xacee('0x30')]));_0x21d9d6[_0xacee('0x2f')]=_0x21d9d6['attributes'][_0xacee('0x31')]?_0x21d9d6[_0xacee('0x2f')]:_0x12fdd4[_0xacee('0x2b')];if(_0x308df7['query'][_0xacee('0x32')]){_0x21d9d6[_0xacee('0x24')]=[{'all':!![]}];}_0x21d9d6=_[_0xacee('0x33')]({},_0x21d9d6,_0x308df7[_0xacee('0x34')]);return db[_0xacee('0x1d')][_0xacee('0x35')](_0x21d9d6)[_0xacee('0x15')](handleEntityNotFound(_0x443634,null))[_0xacee('0x15')](respondWithResult(_0x443634,null))[_0xacee('0x28')](handleError(_0x443634,null));};exports[_0xacee('0x36')]=function(_0x4bd734,_0x56dba5){return db[_0xacee('0x1d')]['create'](_0x4bd734[_0xacee('0x37')],{})['then'](function(_0x30b0ca){var _0x435ea1=_0x4bd734['user']['get']({'plain':!![]});if(!_0x435ea1)throw new Error(_0xacee('0x38'));if(_0x435ea1['role']==='user'){var _0x444f1f=_0x30b0ca['get']({'plain':!![]});var _0x117b31=_0xacee('0x39');return db[_0xacee('0x3a')]['find']({'where':{'name':_0x117b31,'userProfileId':_0x435ea1['userProfileId']},'raw':!![]})['then'](function(_0x28f677){if(_0x28f677&&_0x28f677[_0xacee('0x3b')]===0x0){return db[_0xacee('0x17')][_0xacee('0x36')]({'name':_0x444f1f[_0xacee('0x19')],'resourceId':_0x444f1f['id'],'type':_0x28f677['name'],'sectionId':_0x28f677['id']},{})[_0xacee('0x15')](function(){return _0x30b0ca;});}else{return _0x30b0ca;}})[_0xacee('0x28')](function(_0x1f6d54){logger[_0xacee('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1f6d54);throw _0x1f6d54;});}return _0x30b0ca;})[_0xacee('0x15')](respondWithResult(_0x56dba5,0xc9))[_0xacee('0x28')](handleError(_0x56dba5,null));};exports[_0xacee('0x3c')]=function(_0x5306b3,_0x17602f){if(_0x5306b3[_0xacee('0x37')]['id']){delete _0x5306b3[_0xacee('0x37')]['id'];}return db[_0xacee('0x1d')]['find']({'where':{'id':_0x5306b3[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x17602f,null))[_0xacee('0x15')](saveUpdates(_0x5306b3[_0xacee('0x37')],null))['then'](respondWithResult(_0x17602f,null))['catch'](handleError(_0x17602f,null));};exports[_0xacee('0x16')]=function(_0x1e3a60,_0x46f2bb){return db[_0xacee('0x1d')]['find']({'where':{'id':_0x1e3a60[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x46f2bb,null))[_0xacee('0x15')](removeEntity(_0x46f2bb,null))[_0xacee('0x28')](handleError(_0x46f2bb,null));};exports[_0xacee('0x3d')]=function(_0x2e8520,_0x5e77ab){return db[_0xacee('0x1d')][_0xacee('0x3d')]()[_0xacee('0x15')](respondWithResult(_0x5e77ab,null))[_0xacee('0x28')](handleError(_0x5e77ab,null));};exports[_0xacee('0x3e')]=function(_0xf5785f,_0x326871){var _0x4e0e4a={'raw':!![],'where':{}},_0xd93c1a={},_0x3237de;return db['ChatQueue'][_0xacee('0x3f')]({'where':{'id':_0xf5785f[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x326871,null))[_0xacee('0x15')](function(_0xad2411){if(_0xad2411){_0x3237de=_0xad2411[_0xacee('0x40')]({'plain':!![]});_0xd93c1a[_0xacee('0x2b')]=_['keys'](db[_0xacee('0x41')][_0xacee('0x1e')]);_0xd93c1a[_0xacee('0x25')]=_[_0xacee('0x2c')](_0xf5785f[_0xacee('0x25')]);_0xd93c1a[_0xacee('0x2d')]=_[_0xacee('0x2e')](_0xd93c1a[_0xacee('0x2b')],_0xd93c1a[_0xacee('0x25')]);_0x4e0e4a['attributes']=_[_0xacee('0x2e')](_0xd93c1a[_0xacee('0x2b')],qs[_0xacee('0x30')](_0xf5785f[_0xacee('0x25')][_0xacee('0x30')]));_0x4e0e4a[_0xacee('0x2f')]=_0x4e0e4a['attributes']['length']?_0x4e0e4a['attributes']:_0xd93c1a['model'];if(!_0xf5785f[_0xacee('0x25')][_0xacee('0x42')]('nolimit')){_0x4e0e4a[_0xacee('0x11')]=qs[_0xacee('0x11')](_0xf5785f[_0xacee('0x25')]['limit']);_0x4e0e4a[_0xacee('0x10')]=qs[_0xacee('0x10')](_0xf5785f[_0xacee('0x25')]['offset']);}_0x4e0e4a['order']=qs[_0xacee('0x43')](_0xf5785f[_0xacee('0x25')]['sort']);_0x4e0e4a['where']=qs['filters'](_[_0xacee('0x44')](_0xf5785f[_0xacee('0x25')],_0xd93c1a['filters']));_0x4e0e4a[_0xacee('0x23')][_0xacee('0x45')]=_0xad2411['id'];if(_0xf5785f[_0xacee('0x25')][_0xacee('0x46')]){_0x4e0e4a[_0xacee('0x23')]=_['merge'](_0x4e0e4a[_0xacee('0x23')],{'$or':_[_0xacee('0x1c')](_0x4e0e4a['attributes'],function(_0x518ae6){var _0x3b6e52={};_0x3b6e52[_0x518ae6]={'$like':'%'+_0xf5785f['query'][_0xacee('0x46')]+'%'};return _0x3b6e52;})});}_0x4e0e4a=_[_0xacee('0x33')]({},_0x4e0e4a,_0xf5785f['options']);return db[_0xacee('0x41')][_0xacee('0x26')](_0x4e0e4a);}})['then'](function(_0x34e863){if(_0x34e863){return db[_0xacee('0x47')][_0xacee('0x48')]({'where':{'id':_['map'](_0x34e863,_0xacee('0x49')),'role':_0xacee('0x4a')},'attributes':['id',_0xacee('0x19'),_0xacee('0x4b'),_0xacee('0x4c'),_0xacee('0x4d')]});}})[_0xacee('0x15')](function(_0xe2d289){if(_0xe2d289){return{'count':_0xe2d289[_0xacee('0x13')],'rows':_['map'](_0xe2d289[_0xacee('0x27')],function(_0x5851d5){return{'membername':_0x5851d5[_0xacee('0x19')],'UserId':_0x5851d5['id'],'queue_name':_0x3237de[_0xacee('0x19')],'ChatQueueId':_0x3237de['id'],'interface':util[_0xacee('0x4e')](_0xacee('0x4f'),_0xacee('0x50'),_0x5851d5[_0xacee('0x19')]),'penalty':0x0,'paused':_0x5851d5[_0xacee('0x4b')],'createdAt':_0x5851d5[_0xacee('0x4d')],'updatedAt':_0x5851d5[_0xacee('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x326871,_0x4e0e4a))['catch'](handleError(_0x326871,null));};exports[_0xacee('0x51')]=function(_0x38067a,_0x291278){var _0x3ab7dc={};var _0xa7363f={};var _0x59adb0;var _0x5f491d;return db[_0xacee('0x1d')]['findOne']({'where':{'id':_0x38067a[_0xacee('0x2a')]['id']}})['then'](handleEntityNotFound(_0x291278,null))[_0xacee('0x15')](function(_0x1d5c76){if(_0x1d5c76){_0x59adb0=_0x1d5c76;_0xa7363f['model']=_[_0xacee('0x2c')](db[_0xacee('0x52')][_0xacee('0x1e')]);_0xa7363f[_0xacee('0x25')]=_[_0xacee('0x2c')](_0x38067a[_0xacee('0x25')]);_0xa7363f['filters']=_[_0xacee('0x2e')](_0xa7363f[_0xacee('0x2b')],_0xa7363f['query']);_0x3ab7dc['attributes']=_[_0xacee('0x2e')](_0xa7363f[_0xacee('0x2b')],qs['fields'](_0x38067a[_0xacee('0x25')]['fields']));_0x3ab7dc[_0xacee('0x2f')]=_0x3ab7dc[_0xacee('0x2f')][_0xacee('0x31')]?_0x3ab7dc[_0xacee('0x2f')]:_0xa7363f[_0xacee('0x2b')];_0x3ab7dc[_0xacee('0x53')]=qs[_0xacee('0x43')](_0x38067a[_0xacee('0x25')][_0xacee('0x43')]);_0x3ab7dc[_0xacee('0x23')]=qs[_0xacee('0x2d')](_[_0xacee('0x44')](_0x38067a[_0xacee('0x25')],_0xa7363f[_0xacee('0x2d')]));if(_0x38067a[_0xacee('0x25')][_0xacee('0x46')]){_0x3ab7dc[_0xacee('0x23')]=_[_0xacee('0x33')](_0x3ab7dc[_0xacee('0x23')],{'$or':_[_0xacee('0x1c')](_0x3ab7dc[_0xacee('0x2f')],function(_0x580ea1){var _0x161dca={};_0x161dca[_0x580ea1]={'$like':'%'+_0x38067a[_0xacee('0x25')][_0xacee('0x46')]+'%'};return _0x161dca;})});}_0x3ab7dc=_[_0xacee('0x33')]({},_0x3ab7dc,_0x38067a[_0xacee('0x34')]);return _0x59adb0[_0xacee('0x51')](_0x3ab7dc);}})[_0xacee('0x15')](function(_0x2e5c38){if(_0x2e5c38){_0x5f491d=_0x2e5c38['length'];if(!_0x38067a['query'][_0xacee('0x42')](_0xacee('0x54'))){_0x3ab7dc['limit']=qs['limit'](_0x38067a['query'][_0xacee('0x11')]);_0x3ab7dc[_0xacee('0x10')]=qs[_0xacee('0x10')](_0x38067a[_0xacee('0x25')][_0xacee('0x10')]);}return _0x59adb0['getTeams'](_0x3ab7dc);}})[_0xacee('0x15')](function(_0x1c9507){if(_0x1c9507){return _0x1c9507?{'count':_0x5f491d,'rows':_0x1c9507}:null;}})[_0xacee('0x15')](respondWithResult(_0x291278,null))['catch'](handleError(_0x291278,null));};exports[_0xacee('0x55')]=function(_0x1935b9,_0x512f9d){var _0x5df4dd=_0x1935b9[_0xacee('0x37')]['ids'];return db['Team'][_0xacee('0x26')]({'where':{'id':_0x5df4dd},'attributes':['id'],'include':[{'model':db['User'],'as':_0xacee('0x56'),'attributes':['id',_0xacee('0x19'),_0xacee('0x57'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1bef58){if(_0x1bef58){var _0x28cb9a=_[_0xacee('0x58')](_0x1bef58,function(_0x48393d){var _0x26aa49=_0x48393d[_0xacee('0x40')]({'plain':!![]});return _0x26aa49['Agents'];});return db[_0xacee('0x1d')]['find']({'where':{'id':_0x1935b9['params']['id']}})[_0xacee('0x15')](function(_0x40e632){return db['sequelize'][_0xacee('0x59')](function(_0x41a6b9){return _0x40e632['addTeams'](_0x5df4dd,{'transaction':_0x41a6b9})[_0xacee('0x15')](function(){return BPromise[_0xacee('0x5a')](_0x28cb9a,function(_0x1c97dc){return db[_0xacee('0x41')][_0xacee('0x5b')]({'where':{'UserId':_0x1c97dc['id'],'ChatQueueId':_0x1935b9[_0xacee('0x2a')]['id']},'transaction':_0x41a6b9});});})[_0xacee('0x15')](function(){_0x28cb9a[_0xacee('0x5c')](function(_0x238c52){socket[_0xacee('0x5d')]('userChatQueue:save',{'UserId':_0x238c52['id'],'ChatQueueId':_0x40e632['id']});});});});});}})[_0xacee('0x15')](respondWithStatusCode(_0x512f9d,null))[_0xacee('0x28')](handleError(_0x512f9d,null));};exports['removeTeams']=function(_0x339285,_0x1f15bd){return db[_0xacee('0x52')][_0xacee('0x26')]({'where':{'id':_0x339285['query'][_0xacee('0x5e')]},'attributes':['id'],'include':[{'model':db[_0xacee('0x47')],'as':_0xacee('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x1f15bd,null))[_0xacee('0x15')](function(_0x4a8998){var _0x2b9973=_[_0xacee('0x1c')](_0x4a8998,'id');var _0x34dfa2=[];var _0x2f39b3=[];var _0x7189cc=squel[_0xacee('0x5f')]();_0x7189cc['field'](_0xacee('0x60'))[_0xacee('0x61')](_0xacee('0x62'),'tq')[_0xacee('0x63')](_0xacee('0x64'),'ut',_0xacee('0x65'))[_0xacee('0x23')](_0xacee('0x66'),_0x339285[_0xacee('0x2a')]['id']);for(var _0x1fafcc=0x0;_0x1fafcc<_0x4a8998['length'];_0x1fafcc+=0x1){let _0x1f880c=_0x4a8998[_0x1fafcc];for(var _0x12872a=0x0;_0x12872a<_0x1f880c['Agents'][_0xacee('0x31')];_0x12872a+=0x1){let _0x221682=_0x1f880c['Agents'][_0x12872a];var _0x1c5f85=_0x7189cc[_0xacee('0x67')]();_0x1c5f85['where'](_0xacee('0x68'),_0x221682['id']);_0x2f39b3[_0xacee('0x69')](db[_0xacee('0x6a')]['query'](_0x1c5f85[_0xacee('0x6b')](),{'type':db[_0xacee('0x6a')][_0xacee('0x6c')]['SELECT']})[_0xacee('0x15')](function(_0x2fe41d){if(_0x2fe41d[_0xacee('0x31')]===0x1){return _0x221682['id'];}else{var _0x969d70=_[_0xacee('0x6d')](_['map'](_0x2fe41d,_0xacee('0x6e')),function(_0x242598){return _[_0xacee('0x6f')](_0x2b9973,_0x242598);});if(_0x969d70){return _0x221682['id'];}}}));}}return BPromise[_0xacee('0x70')](_0x2f39b3)[_0xacee('0x15')](function(_0x2a9d6d){_0x34dfa2=_(_0x34dfa2)[_0xacee('0x71')](_0x2a9d6d)[_0xacee('0x72')]()[_0xacee('0x73')]();return db[_0xacee('0x1d')][_0xacee('0x35')]({'where':{'id':_0x339285['params']['id']}})[_0xacee('0x15')](function(_0x1c15eb){return db[_0xacee('0x6a')][_0xacee('0x59')](function(_0x5ab2ce){return _0x1c15eb[_0xacee('0x74')](_0x339285[_0xacee('0x25')][_0xacee('0x5e')],{'transaction':_0x5ab2ce})['then'](function(){if(!_['isEmpty'](_0x34dfa2)){return _0x1c15eb[_0xacee('0x75')](_0x34dfa2,{'transaction':_0x5ab2ce});}})['then'](function(){_0x34dfa2[_0xacee('0x5c')](function(_0x124a55){socket[_0xacee('0x5d')](_0xacee('0x76'),{'UserId':_0x124a55,'ChatQueueId':_0x1c15eb['id']});});});});});});})['then'](respondWithStatusCode(_0x1f15bd,null))[_0xacee('0x28')](handleError(_0x1f15bd,null));};exports[_0xacee('0x77')]=function(_0x289596,_0x42bd5a){return db[_0xacee('0x1d')][_0xacee('0x35')]({'where':{'id':_0x289596['params']['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x42bd5a,null))['then'](function(_0x30a68c){if(_0x30a68c){return _0x30a68c[_0xacee('0x77')](_0x289596['body']['ids'],_[_0xacee('0x78')](_0x289596[_0xacee('0x37')],[_0xacee('0x5e'),'id'])||{})[_0xacee('0x79')](function(_0x44913e){for(var _0x1e62b6=0x0;_0x1e62b6<_0x289596[_0xacee('0x37')][_0xacee('0x5e')]['length'];_0x1e62b6+=0x1){socket[_0xacee('0x5d')](_0xacee('0x7a'),{'UserId':Number(_0x289596[_0xacee('0x37')][_0xacee('0x5e')][_0x1e62b6]),'ChatQueueId':Number(_0x289596[_0xacee('0x2a')]['id'])});}return _0x44913e;});}})[_0xacee('0x15')](respondWithResult(_0x42bd5a,null))[_0xacee('0x28')](handleError(_0x42bd5a,null));};exports[_0xacee('0x75')]=function(_0x56aac0,_0xd90440){return db['ChatQueue']['find']({'where':{'id':_0x56aac0['params']['id']}})['then'](handleEntityNotFound(_0xd90440,null))[_0xacee('0x15')](function(_0x1c9194){if(_0x1c9194){return _0x1c9194['removeAgents'](_0x56aac0['query'][_0xacee('0x5e')])[_0xacee('0x15')](function(){if(_[_0xacee('0x7b')](_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')])){for(var _0x1b59b8=0x0;_0x1b59b8<_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')][_0xacee('0x31')];_0x1b59b8+=0x1){socket[_0xacee('0x5d')](_0xacee('0x76'),{'UserId':Number(_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')][_0x1b59b8]),'ChatQueueId':Number(_0x56aac0[_0xacee('0x2a')]['id'])});}}else{socket['emit']('userChatQueue:remove',{'UserId':Number(_0x56aac0[_0xacee('0x25')][_0xacee('0x5e')]),'ChatQueueId':Number(_0x56aac0[_0xacee('0x2a')]['id'])});}});}})[_0xacee('0x15')](respondWithStatusCode(_0xd90440,null))['catch'](handleError(_0xd90440,null));};exports[_0xacee('0x7c')]=function(_0x36e4c7,_0x5bc0b6){var _0x2f2997={};var _0x5c25f9={};var _0x172538;var _0x3ff528;return db[_0xacee('0x1d')][_0xacee('0x3f')]({'where':{'id':_0x36e4c7[_0xacee('0x2a')]['id']}})[_0xacee('0x15')](handleEntityNotFound(_0x5bc0b6,null))[_0xacee('0x15')](function(_0x26b5c4){if(_0x26b5c4){_0x172538=_0x26b5c4;_0x5c25f9[_0xacee('0x2b')]=_[_0xacee('0x2c')](db[_0xacee('0x47')][_0xacee('0x1e')]);_0x5c25f9[_0xacee('0x25')]=_['keys'](_0x36e4c7[_0xacee('0x25')]);_0x5c25f9['filters']=_[_0xacee('0x2e')](_0x5c25f9[_0xacee('0x2b')],_0x5c25f9[_0xacee('0x25')]);_0x2f2997[_0xacee('0x2f')]=_[_0xacee('0x2e')](_0x5c25f9[_0xacee('0x2b')],qs['fields'](_0x36e4c7['query'][_0xacee('0x30')]));_0x2f2997['attributes']=_0x2f2997[_0xacee('0x2f')][_0xacee('0x31')]?_0x2f2997[_0xacee('0x2f')]:_0x5c25f9[_0xacee('0x2b')];_0x2f2997[_0xacee('0x53')]=qs[_0xacee('0x43')](_0x36e4c7[_0xacee('0x25')][_0xacee('0x43')]);_0x2f2997[_0xacee('0x23')]=qs[_0xacee('0x2d')](_[_0xacee('0x44')](_0x36e4c7['query'],_0x5c25f9[_0xacee('0x2d')]));if(_0x36e4c7['query']['filter']){_0x2f2997[_0xacee('0x23')]=_[_0xacee('0x33')](_0x2f2997[_0xacee('0x23')],{'$or':_[_0xacee('0x1c')](_0x2f2997[_0xacee('0x2f')],function(_0x4619dd){var _0x3f545f={};_0x3f545f[_0x4619dd]={'$like':'%'+_0x36e4c7[_0xacee('0x25')]['filter']+'%'};return _0x3f545f;})});}_0x2f2997=_[_0xacee('0x33')]({},_0x2f2997,_0x36e4c7['options']);return _0x172538[_0xacee('0x7c')](_0x2f2997);}})[_0xacee('0x15')](function(_0x1bf0cc){if(_0x1bf0cc){_0x3ff528=_0x1bf0cc[_0xacee('0x31')];if(!_0x36e4c7[_0xacee('0x25')][_0xacee('0x42')](_0xacee('0x54'))){_0x2f2997[_0xacee('0x11')]=qs[_0xacee('0x11')](_0x36e4c7[_0xacee('0x25')][_0xacee('0x11')]);_0x2f2997['offset']=qs[_0xacee('0x10')](_0x36e4c7[_0xacee('0x25')]['offset']);}return _0x172538[_0xacee('0x7c')](_0x2f2997);}})[_0xacee('0x15')](function(_0x14b81e){if(_0x14b81e){return _0x14b81e?{'count':_0x3ff528,'rows':_0x14b81e}:null;}})['then'](respondWithResult(_0x5bc0b6,null))['catch'](handleError(_0x5bc0b6,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index eb229d4..d9fad18 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 _0x3f5c=['events','ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x159924,_0x39a170){var _0x7aa9b0=function(_0x4cd6ae){while(--_0x4cd6ae){_0x159924['push'](_0x159924['shift']());}};_0x7aa9b0(++_0x39a170);}(_0x3f5c,0x129));var _0xc3f5=function(_0x3a88c4,_0x11773b){_0x3a88c4=_0x3a88c4-0x0;var _0x411580=_0x3f5c[_0x3a88c4];return _0x411580;};'use strict';var EventEmitter=require(_0xc3f5('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0xc3f5('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xc3f5('0x2')](0x0);var events={'afterCreate':_0xc3f5('0x3'),'afterUpdate':'update','afterDestroy':_0xc3f5('0x4')};function emitEvent(_0x49be7c){return function(_0x5ccfe2,_0x238645,_0x57a172){ChatQueueEvents[_0xc3f5('0x5')](_0x49be7c+':'+_0x5ccfe2['id'],_0x5ccfe2);ChatQueueEvents[_0xc3f5('0x5')](_0x49be7c,_0x5ccfe2);_0x57a172(null);};}for(var e in events){if(events[_0xc3f5('0x6')](e)){var event=events[e];ChatQueue[_0xc3f5('0x7')](e,emitEvent(event));}}module[_0xc3f5('0x8')]=ChatQueueEvents; \ No newline at end of file +var _0x79e3=['events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x5afbd5,_0x48a693){var _0x298511=function(_0x2f4262){while(--_0x2f4262){_0x5afbd5['push'](_0x5afbd5['shift']());}};_0x298511(++_0x48a693);}(_0x79e3,0x77));var _0x379e=function(_0x1fa3d4,_0x39e1a5){_0x1fa3d4=_0x1fa3d4-0x0;var _0x1bf27c=_0x79e3[_0x1fa3d4];return _0x1bf27c;};'use strict';var EventEmitter=require(_0x379e('0x0'));var ChatQueue=require(_0x379e('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x379e('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x379e('0x3'),'afterDestroy':_0x379e('0x4')};function emitEvent(_0x2e6d6b){return function(_0x234aa2,_0x2d61cd,_0x5bd2c6){ChatQueueEvents[_0x379e('0x5')](_0x2e6d6b+':'+_0x234aa2['id'],_0x234aa2);ChatQueueEvents[_0x379e('0x5')](_0x2e6d6b,_0x234aa2);_0x5bd2c6(null);};}for(var e in events){if(events[_0x379e('0x6')](e)){var event=events[e];ChatQueue['hook'](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index aa7983a..e1a89a3 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 _0x50e5=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','chat_queues','lodash'];(function(_0x5267cd,_0x30cf7b){var _0x3419ce=function(_0x3a1dfb){while(--_0x3a1dfb){_0x5267cd['push'](_0x5267cd['shift']());}};_0x3419ce(++_0x30cf7b);}(_0x50e5,0xef));var _0x550e=function(_0x1cc666,_0x272d12){_0x1cc666=_0x1cc666-0x0;var _0x3c3764=_0x50e5[_0x1cc666];return _0x3c3764;};'use strict';var _=require(_0x550e('0x0'));var util=require('util');var logger=require(_0x550e('0x1'))('api');var moment=require('moment');var BPromise=require(_0x550e('0x2'));var rp=require(_0x550e('0x3'));var fs=require('fs');var path=require(_0x550e('0x4'));var rimraf=require(_0x550e('0x5'));var config=require(_0x550e('0x6'));var attributes=require(_0x550e('0x7'));module[_0x550e('0x8')]=function(_0x202fca,_0x1303d5){return _0x202fca[_0x550e('0x9')](_0x550e('0xa'),attributes,{'tableName':_0x550e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5457=['request-promise','path','rimraf','../../config/environment','exports','define','ChatQueue','api','bluebird'];(function(_0x408110,_0x29c63a){var _0x272714=function(_0x2637ae){while(--_0x2637ae){_0x408110['push'](_0x408110['shift']());}};_0x272714(++_0x29c63a);}(_0x5457,0xb2));var _0x7545=function(_0x5c01d3,_0x1cc626){_0x5c01d3=_0x5c01d3-0x0;var _0x546b80=_0x5457[_0x5c01d3];return _0x546b80;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x7545('0x0'));var moment=require('moment');var BPromise=require(_0x7545('0x1'));var rp=require(_0x7545('0x2'));var fs=require('fs');var path=require(_0x7545('0x3'));var rimraf=require(_0x7545('0x4'));var config=require(_0x7545('0x5'));var attributes=require('./chatQueue.attributes');module[_0x7545('0x6')]=function(_0x57f623,_0x5e3e8c){return _0x57f623[_0x7545('0x7')](_0x7545('0x8'),attributes,{'tableName':'chat_queues','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 882a507..e29176f 100644 --- a/server/api/chatQueue/chatQueue.rpc.js +++ b/server/api/chatQueue/chatQueue.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cf5=['model','stringify','catch','find','ShowChatQueue','lodash','util','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetChatQueue','ChatQueue','findAll','raw','options','where','attributes','limit','include','map'];(function(_0x7ec7b4,_0x1c8b0e){var _0x307680=function(_0x100a2c){while(--_0x100a2c){_0x7ec7b4['push'](_0x7ec7b4['shift']());}};_0x307680(++_0x1c8b0e);}(_0x2cf5,0x19f));var _0x52cf=function(_0x170b9c,_0x532a97){_0x170b9c=_0x170b9c-0x0;var _0x4d111d=_0x2cf5[_0x170b9c];return _0x4d111d;};'use strict';var _=require(_0x52cf('0x0'));var util=require(_0x52cf('0x1'));var moment=require('moment');var BPromise=require(_0x52cf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x52cf('0x3'));var db=require(_0x52cf('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x52cf('0x5'));var config=require(_0x52cf('0x6'));var jayson=require(_0x52cf('0x7'));var client=jayson[_0x52cf('0x8')][_0x52cf('0x9')]({'port':0x232a});config[_0x52cf('0xa')]=_[_0x52cf('0xb')](config[_0x52cf('0xa')],{'host':_0x52cf('0xc'),'port':0x18eb});var socket=require(_0x52cf('0xd'))(new Redis(config[_0x52cf('0xa')]));require('./chatQueue.socket')[_0x52cf('0xe')](socket);function respondWithRpcPromise(_0x201710,_0x2b9974,_0x120dab){return new BPromise(function(_0x4e5b19,_0xadb2a6){return client[_0x52cf('0xf')](_0x201710,_0x120dab)[_0x52cf('0x10')](function(_0x54806d){logger[_0x52cf('0x11')](_0x52cf('0x12'),_0x2b9974,_0x52cf('0x13'));logger[_0x52cf('0x14')](_0x52cf('0x15'),_0x2b9974,_0x52cf('0x13'),JSON['stringify'](_0x54806d));if(_0x54806d['error']){if(_0x54806d[_0x52cf('0x16')][_0x52cf('0x17')]===0x1f4){logger[_0x52cf('0x16')](_0x52cf('0x12'),_0x2b9974,_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);return _0xadb2a6(_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);}logger['error'](_0x52cf('0x12'),_0x2b9974,_0x54806d[_0x52cf('0x16')][_0x52cf('0x18')]);return _0x4e5b19(_0x54806d['error'][_0x52cf('0x18')]);}else{logger['info'](_0x52cf('0x12'),_0x2b9974,_0x52cf('0x13'));_0x4e5b19(_0x54806d[_0x52cf('0x19')][_0x52cf('0x18')]);}})['catch'](function(_0x229595){logger[_0x52cf('0x16')](_0x52cf('0x12'),_0x2b9974,_0x229595);_0xadb2a6(_0x229595);});});}exports[_0x52cf('0x1a')]=function(_0x4ab08f){var _0x326311=this;return new Promise(function(_0x5f5200,_0x1d9fdd){return db[_0x52cf('0x1b')][_0x52cf('0x1c')]({'raw':_0x4ab08f['options']?_0x4ab08f['options'][_0x52cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x1f')]||null:null,'attributes':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x20')]||null:null,'limit':_0x4ab08f[_0x52cf('0x1e')]?_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x21')]||null:null,'include':_0x4ab08f['options']?_0x4ab08f['options'][_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x4ab08f[_0x52cf('0x1e')][_0x52cf('0x22')],function(_0x499ac7){return{'model':db[_0x499ac7['model']],'as':_0x499ac7['as'],'attributes':_0x499ac7[_0x52cf('0x20')],'include':_0x499ac7[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x499ac7[_0x52cf('0x22')],function(_0x42132c){return{'model':db[_0x42132c[_0x52cf('0x24')]],'as':_0x42132c['as'],'attributes':_0x42132c[_0x52cf('0x20')],'include':_0x42132c[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x42132c['include'],function(_0x4796b5){return{'model':db[_0x4796b5[_0x52cf('0x24')]],'as':_0x4796b5['as'],'attributes':_0x4796b5[_0x52cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52cf('0x10')](function(_0x1e1318){logger['info'](_0x52cf('0x1a'),_0x4ab08f);logger[_0x52cf('0x14')](_0x52cf('0x1a'),_0x4ab08f,JSON[_0x52cf('0x25')](_0x1e1318));_0x5f5200(_0x1e1318);})[_0x52cf('0x26')](function(_0x1ed92a){logger['error'](_0x52cf('0x1a'),_0x1ed92a[_0x52cf('0x18')],_0x4ab08f);_0x1d9fdd(_0x326311[_0x52cf('0x16')](0x1f4,_0x1ed92a[_0x52cf('0x18')]));});});};exports['ShowChatQueue']=function(_0x1c6bc2){var _0xcffed3=this;return new Promise(function(_0x46eca4,_0x141871){return db[_0x52cf('0x1b')][_0x52cf('0x27')]({'raw':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x1d')]===undefined?!![]:![]:!![],'where':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2['options']['where']||null:null,'attributes':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x20')]||null:null,'include':_0x1c6bc2[_0x52cf('0x1e')]?_0x1c6bc2['options']['include']?_[_0x52cf('0x23')](_0x1c6bc2[_0x52cf('0x1e')][_0x52cf('0x22')],function(_0xafd307){return{'model':db[_0xafd307[_0x52cf('0x24')]],'as':_0xafd307['as'],'attributes':_0xafd307[_0x52cf('0x20')],'include':_0xafd307[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0xafd307[_0x52cf('0x22')],function(_0x163181){return{'model':db[_0x163181[_0x52cf('0x24')]],'as':_0x163181['as'],'attributes':_0x163181[_0x52cf('0x20')],'include':_0x163181[_0x52cf('0x22')]?_[_0x52cf('0x23')](_0x163181[_0x52cf('0x22')],function(_0x50d881){return{'model':db[_0x50d881[_0x52cf('0x24')]],'as':_0x50d881['as'],'attributes':_0x50d881[_0x52cf('0x20')]};}):[]};}):[]};}):[]:[]})[_0x52cf('0x10')](function(_0x2f9a0a){logger[_0x52cf('0x11')](_0x52cf('0x28'),_0x1c6bc2);logger[_0x52cf('0x14')]('ShowChatQueue',_0x1c6bc2,JSON[_0x52cf('0x25')](_0x2f9a0a));_0x46eca4(_0x2f9a0a);})[_0x52cf('0x26')](function(_0x5e56cc){logger['error'](_0x52cf('0x28'),_0x5e56cc['message'],_0x1c6bc2);_0x141871(_0xcffed3['error'](0x1f4,_0x5e56cc[_0x52cf('0x18')]));});});}; \ No newline at end of file +var _0x3c8b=['socket.io-emitter','request','then','info','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','ChatQueue,\x20%s,\x20%s','message','result','catch','GetChatQueue','ChatQueue','options','where','limit','include','map','model','attributes','debug','ShowChatQueue','find','raw','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x3c8b,0x18b));var _0xb3c8=function(_0x5a408b,_0x242bea){_0x5a408b=_0x5a408b-0x0;var _0x2d9caf=_0x3c8b[_0x5a408b];return _0x2d9caf;};'use strict';var _=require('lodash');var util=require(_0xb3c8('0x0'));var moment=require('moment');var BPromise=require(_0xb3c8('0x1'));var rs=require(_0xb3c8('0x2'));var fs=require('fs');var Redis=require(_0xb3c8('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb3c8('0x4'));var logger=require(_0xb3c8('0x5'))(_0xb3c8('0x6'));var config=require(_0xb3c8('0x7'));var jayson=require(_0xb3c8('0x8'));var client=jayson[_0xb3c8('0x9')][_0xb3c8('0xa')]({'port':0x232a});config[_0xb3c8('0xb')]=_['defaults'](config[_0xb3c8('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb3c8('0xc'))(new Redis(config[_0xb3c8('0xb')]));require('./chatQueue.socket')['register'](socket);function respondWithRpcPromise(_0x4790d0,_0x3cea69,_0x363230){return new BPromise(function(_0xdf4041,_0x508b1f){return client[_0xb3c8('0xd')](_0x4790d0,_0x363230)[_0xb3c8('0xe')](function(_0x21eac8){logger[_0xb3c8('0xf')]('ChatQueue,\x20%s,\x20%s',_0x3cea69,_0xb3c8('0x10'));logger['debug'](_0xb3c8('0x11'),_0x3cea69,'request\x20sent',JSON[_0xb3c8('0x12')](_0x21eac8));if(_0x21eac8[_0xb3c8('0x13')]){if(_0x21eac8[_0xb3c8('0x13')]['code']===0x1f4){logger['error'](_0xb3c8('0x14'),_0x3cea69,_0x21eac8[_0xb3c8('0x13')][_0xb3c8('0x15')]);return _0x508b1f(_0x21eac8['error']['message']);}logger[_0xb3c8('0x13')](_0xb3c8('0x14'),_0x3cea69,_0x21eac8[_0xb3c8('0x13')]['message']);return _0xdf4041(_0x21eac8[_0xb3c8('0x13')][_0xb3c8('0x15')]);}else{logger[_0xb3c8('0xf')](_0xb3c8('0x14'),_0x3cea69,_0xb3c8('0x10'));_0xdf4041(_0x21eac8[_0xb3c8('0x16')][_0xb3c8('0x15')]);}})[_0xb3c8('0x17')](function(_0x168555){logger['error']('ChatQueue,\x20%s,\x20%s',_0x3cea69,_0x168555);_0x508b1f(_0x168555);});});}exports[_0xb3c8('0x18')]=function(_0x5390cc){var _0x4d4bda=this;return new Promise(function(_0x433549,_0x4df53e){return db[_0xb3c8('0x19')]['findAll']({'raw':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5390cc[_0xb3c8('0x1a')]?_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1b')]||null:null,'attributes':_0x5390cc['options']?_0x5390cc[_0xb3c8('0x1a')]['attributes']||null:null,'limit':_0x5390cc[_0xb3c8('0x1a')]?_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1c')]||null:null,'include':_0x5390cc[_0xb3c8('0x1a')]?_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x5390cc[_0xb3c8('0x1a')][_0xb3c8('0x1d')],function(_0x557be7){return{'model':db[_0x557be7[_0xb3c8('0x1f')]],'as':_0x557be7['as'],'attributes':_0x557be7['attributes'],'include':_0x557be7[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x557be7[_0xb3c8('0x1d')],function(_0x1d0b73){return{'model':db[_0x1d0b73['model']],'as':_0x1d0b73['as'],'attributes':_0x1d0b73[_0xb3c8('0x20')],'include':_0x1d0b73[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x1d0b73[_0xb3c8('0x1d')],function(_0x275312){return{'model':db[_0x275312[_0xb3c8('0x1f')]],'as':_0x275312['as'],'attributes':_0x275312[_0xb3c8('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x35bd6d){logger[_0xb3c8('0xf')]('GetChatQueue',_0x5390cc);logger[_0xb3c8('0x21')](_0xb3c8('0x18'),_0x5390cc,JSON[_0xb3c8('0x12')](_0x35bd6d));_0x433549(_0x35bd6d);})[_0xb3c8('0x17')](function(_0x27e928){logger[_0xb3c8('0x13')](_0xb3c8('0x18'),_0x27e928['message'],_0x5390cc);_0x4df53e(_0x4d4bda[_0xb3c8('0x13')](0x1f4,_0x27e928[_0xb3c8('0x15')]));});});};exports[_0xb3c8('0x22')]=function(_0x320e3f){var _0x4511cf=this;return new Promise(function(_0x557745,_0x2369e5){return db[_0xb3c8('0x19')][_0xb3c8('0x23')]({'raw':_0x320e3f[_0xb3c8('0x1a')]?_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x24')]===undefined?!![]:![]:!![],'where':_0x320e3f[_0xb3c8('0x1a')]?_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x1b')]||null:null,'attributes':_0x320e3f['options']?_0x320e3f[_0xb3c8('0x1a')]['attributes']||null:null,'include':_0x320e3f[_0xb3c8('0x1a')]?_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x320e3f[_0xb3c8('0x1a')][_0xb3c8('0x1d')],function(_0x550ab8){return{'model':db[_0x550ab8[_0xb3c8('0x1f')]],'as':_0x550ab8['as'],'attributes':_0x550ab8['attributes'],'include':_0x550ab8[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0x550ab8[_0xb3c8('0x1d')],function(_0xc6554d){return{'model':db[_0xc6554d['model']],'as':_0xc6554d['as'],'attributes':_0xc6554d[_0xb3c8('0x20')],'include':_0xc6554d[_0xb3c8('0x1d')]?_[_0xb3c8('0x1e')](_0xc6554d[_0xb3c8('0x1d')],function(_0x3ee715){return{'model':db[_0x3ee715[_0xb3c8('0x1f')]],'as':_0x3ee715['as'],'attributes':_0x3ee715['attributes']};}):[]};}):[]};}):[]:[]})[_0xb3c8('0xe')](function(_0x287521){logger[_0xb3c8('0xf')](_0xb3c8('0x22'),_0x320e3f);logger[_0xb3c8('0x21')]('ShowChatQueue',_0x320e3f,JSON['stringify'](_0x287521));_0x557745(_0x287521);})[_0xb3c8('0x17')](function(_0x1ecefb){logger[_0xb3c8('0x13')]('ShowChatQueue',_0x1ecefb[_0xb3c8('0x15')],_0x320e3f);_0x2369e5(_0x4511cf['error'](0x1f4,_0x1ecefb[_0xb3c8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index f89fc33..8c2c9bd 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 _0xfd28=['emit','removeListener','register','chatQueue:','save','remove'];(function(_0x7f3a0f,_0x163bbf){var _0x4ff4e9=function(_0x27c49f){while(--_0x27c49f){_0x7f3a0f['push'](_0x7f3a0f['shift']());}};_0x4ff4e9(++_0x163bbf);}(_0xfd28,0x148));var _0x8fd2=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0xfd28[_0x9c2427];return _0x51984f;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x8fd2('0x0'),_0x8fd2('0x1'),'update'];function createListener(_0x56f4d0,_0x4e5c5e){return function(_0x37baf5){_0x4e5c5e[_0x8fd2('0x2')](_0x56f4d0,_0x37baf5);};}function removeListener(_0x4e2108,_0x4b22ae){return function(){ChatQueueEvents[_0x8fd2('0x3')](_0x4e2108,_0x4b22ae);};}exports[_0x8fd2('0x4')]=function(_0x2ee87e){for(var _0x36178a=0x0,_0x2f0afc=events['length'];_0x36178a<_0x2f0afc;_0x36178a++){var _0x53d938=events[_0x36178a];var _0x10fccf=createListener(_0x8fd2('0x5')+_0x53d938,_0x2ee87e);ChatQueueEvents['on'](_0x53d938,_0x10fccf);}}; \ No newline at end of file +var _0x9f62=['save','update','removeListener','register','length'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x9f62,0x154));var _0x29f6=function(_0x2c49cf,_0x55329f){_0x2c49cf=_0x2c49cf-0x0;var _0x1928f4=_0x9f62[_0x2c49cf];return _0x1928f4;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x29f6('0x0'),'remove',_0x29f6('0x1')];function createListener(_0x254ab3,_0x548050){return function(_0x5618b7){_0x548050['emit'](_0x254ab3,_0x5618b7);};}function removeListener(_0x258ddd,_0x2f0420){return function(){ChatQueueEvents[_0x29f6('0x2')](_0x258ddd,_0x2f0420);};}exports[_0x29f6('0x3')]=function(_0x595034){for(var _0xf66137=0x0,_0x272876=events[_0x29f6('0x4')];_0xf66137<_0x272876;_0xf66137++){var _0x2ba602=events[_0xf66137];var _0x416c6c=createListener('chatQueue:'+_0x2ba602,_0x595034);ChatQueueEvents['on'](_0x2ba602,_0x416c6c);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index c2f9c2d..e589084 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x5c3505,_0x3770ce){var _0x5eec90=function(_0x34157c){while(--_0x34157c){_0x5c3505['push'](_0x5c3505['shift']());}};_0x5eec90(++_0x3770ce);}(_0xe14b,0x93));var _0xbe14=function(_0x2c588c,_0x1f0d55){_0x2c588c=_0x2c588c-0x0;var _0x25f6a6=_0xe14b[_0x2c588c];return _0x25f6a6;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3e74,0x175));var _0x43e7=function(_0x3c4515,_0x52f867){_0x3c4515=_0x3c4515-0x0;var _0x3ef194=_0x3e74[_0x3c4515];return _0x3ef194;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 549b180..e91c4a5 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 _0xf2f5=['DATE','sequelize','STRING'];(function(_0x146b09,_0x345cd3){var _0x4e9e36=function(_0x1d9749){while(--_0x1d9749){_0x146b09['push'](_0x146b09['shift']());}};_0x4e9e36(++_0x345cd3);}(_0xf2f5,0x8e));var _0x5f2f=function(_0x3112ac,_0x4d5efd){_0x3112ac=_0x3112ac-0x0;var _0x343812=_0xf2f5[_0x3112ac];return _0x343812;};'use strict';var moment=require('moment');var Sequelize=require(_0x5f2f('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x5f2f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x5f2f('0x1')]},'joinAt':{'type':Sequelize[_0x5f2f('0x2')]},'leaveAt':{'type':Sequelize[_0x5f2f('0x2')]},'acceptAt':{'type':Sequelize[_0x5f2f('0x2')]},'exitAt':{'type':Sequelize[_0x5f2f('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x71f8=['moment','sequelize','exports','STRING','DATE'];(function(_0xe8e040,_0x278f92){var _0x6be7b8=function(_0x3dabd0){while(--_0x3dabd0){_0xe8e040['push'](_0xe8e040['shift']());}};_0x6be7b8(++_0x278f92);}(_0x71f8,0x1ae));var _0x871f=function(_0x4ea2f7,_0x11c547){_0x4ea2f7=_0x4ea2f7-0x0;var _0x532c3c=_0x71f8[_0x4ea2f7];return _0x532c3c;};'use strict';var moment=require(_0x871f('0x0'));var Sequelize=require(_0x871f('0x1'));module[_0x871f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x871f('0x3')]},'joinAt':{'type':Sequelize[_0x871f('0x4')]},'leaveAt':{'type':Sequelize[_0x871f('0x4')]},'acceptAt':{'type':Sequelize[_0x871f('0x4')]},'exitAt':{'type':Sequelize[_0x871f('0x4')]},'reason':{'type':Sequelize[_0x871f('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index a30ef59..ae037ca 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 _0xb3d8=['lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','ChatQueueReport','fieldName','type','key','name','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','options','includeAll','include','findAll','rows','catch','show','keys','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x2402ce,_0xa8ef8f){var _0x3434ef=function(_0x1028f2){while(--_0x1028f2){_0x2402ce['push'](_0x2402ce['shift']());}};_0x3434ef(++_0xa8ef8f);}(_0xb3d8,0xdc));var _0x8b3d=function(_0xb75c06,_0x344d72){_0xb75c06=_0xb75c06-0x0;var _0x5a84ba=_0xb3d8[_0xb75c06];return _0x5a84ba;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8b3d('0x0'));var zipdir=require(_0x8b3d('0x1'));var jsonpatch=require(_0x8b3d('0x2'));var rp=require(_0x8b3d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8b3d('0x4'));var util=require(_0x8b3d('0x5'));var path=require(_0x8b3d('0x6'));var sox=require(_0x8b3d('0x7'));var csv=require(_0x8b3d('0x8'));var ejs=require(_0x8b3d('0x9'));var fs=require('fs');var fs_extra=require(_0x8b3d('0xa'));var _=require(_0x8b3d('0xb'));var squel=require(_0x8b3d('0xc'));var crypto=require('crypto');var jsforce=require(_0x8b3d('0xd'));var deskjs=require(_0x8b3d('0xe'));var toCsv=require(_0x8b3d('0x8'));var querystring=require(_0x8b3d('0xf'));var Papa=require(_0x8b3d('0x10'));var Redis=require(_0x8b3d('0x11'));var authService=require(_0x8b3d('0x12'));var qs=require(_0x8b3d('0x13'));var as=require(_0x8b3d('0x14'));var hardwareService=require(_0x8b3d('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x8b3d('0x16'));var config=require(_0x8b3d('0x17'));var licenseUtil=require(_0x8b3d('0x18'));var db=require(_0x8b3d('0x19'))['db'];function respondWithStatusCode(_0x16e1fb,_0x1fa985){_0x1fa985=_0x1fa985||0xcc;return function(_0x63293){if(_0x63293){return _0x16e1fb[_0x8b3d('0x1a')](_0x1fa985);}return _0x16e1fb[_0x8b3d('0x1b')](_0x1fa985)[_0x8b3d('0x1c')]();};}function respondWithResult(_0x984b9a,_0x3f03ee){_0x3f03ee=_0x3f03ee||0xc8;return function(_0xb0a303){if(_0xb0a303){return _0x984b9a[_0x8b3d('0x1b')](_0x3f03ee)[_0x8b3d('0x1d')](_0xb0a303);}};}function respondWithFilteredResult(_0x14611e,_0x4fc552){return function(_0x2c624d){if(_0x2c624d){var _0x381c0d=typeof _0x4fc552['offset']===_0x8b3d('0x1e')&&typeof _0x4fc552[_0x8b3d('0x1f')]==='undefined';var _0xb493ac=_0x2c624d[_0x8b3d('0x20')];var _0xcc9b46=_0x381c0d?0x0:_0x4fc552[_0x8b3d('0x21')];var _0x1d96ae=_0x381c0d?_0x2c624d['count']:_0x4fc552['offset']+_0x4fc552[_0x8b3d('0x1f')];var _0x4f1b21;if(_0x1d96ae>=_0xb493ac){_0x1d96ae=_0xb493ac;_0x4f1b21=0xc8;}else{_0x4f1b21=0xce;}_0x14611e['status'](_0x4f1b21);return _0x14611e['set'](_0x8b3d('0x22'),_0xcc9b46+'-'+_0x1d96ae+'/'+_0xb493ac)[_0x8b3d('0x1d')](_0x2c624d);}return null;};}function patchUpdates(_0x4867e4){return function(_0x45c245){try{jsonpatch[_0x8b3d('0x23')](_0x45c245,_0x4867e4,!![]);}catch(_0xff346c){return BPromise[_0x8b3d('0x24')](_0xff346c);}return _0x45c245[_0x8b3d('0x25')]();};}function saveUpdates(_0x43a68,_0x3510f4){return function(_0x116ea4){if(_0x116ea4){return _0x116ea4[_0x8b3d('0x26')](_0x43a68)[_0x8b3d('0x27')](function(_0x338f6b){return _0x338f6b;});}return null;};}function removeEntity(_0x5462c6,_0x37c98e){return function(_0x584a71){if(_0x584a71){return _0x584a71[_0x8b3d('0x28')]()[_0x8b3d('0x27')](function(){_0x5462c6[_0x8b3d('0x1b')](0xcc)[_0x8b3d('0x1c')]();});}};}function handleEntityNotFound(_0x57fe10,_0x219ecb){return function(_0x4fc627){if(!_0x4fc627){_0x57fe10['sendStatus'](0x194);}return _0x4fc627;};}function handleError(_0x39a4bf,_0x513bb1){_0x513bb1=_0x513bb1||0x1f4;return function(_0x4eefbf){logger[_0x8b3d('0x29')](_0x4eefbf[_0x8b3d('0x2a')]);if(_0x4eefbf['name']){delete _0x4eefbf['name'];}_0x39a4bf[_0x8b3d('0x1b')](_0x513bb1)[_0x8b3d('0x2b')](_0x4eefbf);};}exports[_0x8b3d('0x2c')]=function(_0x1cab3a,_0x36f329){var _0x591a4c={},_0x261070={},_0x747446={'count':0x0,'rows':[]};var _0x1125dc=_[_0x8b3d('0x2d')](db[_0x8b3d('0x2e')]['rawAttributes'],function(_0x520a69){return{'name':_0x520a69[_0x8b3d('0x2f')],'type':_0x520a69[_0x8b3d('0x30')][_0x8b3d('0x31')]};});_0x261070['model']=_[_0x8b3d('0x2d')](_0x1125dc,_0x8b3d('0x32'));_0x261070[_0x8b3d('0x33')]=_['keys'](_0x1cab3a[_0x8b3d('0x33')]);_0x261070[_0x8b3d('0x34')]=_[_0x8b3d('0x35')](_0x261070['model'],_0x261070['query']);_0x591a4c[_0x8b3d('0x36')]=_[_0x8b3d('0x35')](_0x261070[_0x8b3d('0x37')],qs[_0x8b3d('0x38')](_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x38')]));_0x591a4c[_0x8b3d('0x36')]=_0x591a4c['attributes'][_0x8b3d('0x39')]?_0x591a4c[_0x8b3d('0x36')]:_0x261070[_0x8b3d('0x37')];if(!_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x3a')](_0x8b3d('0x3b'))){_0x591a4c[_0x8b3d('0x1f')]=qs[_0x8b3d('0x1f')](_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x1f')]);_0x591a4c[_0x8b3d('0x21')]=qs[_0x8b3d('0x21')](_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x21')]);}_0x591a4c[_0x8b3d('0x3c')]=qs[_0x8b3d('0x3d')](_0x1cab3a[_0x8b3d('0x33')]['sort']);_0x591a4c['where']=qs[_0x8b3d('0x34')](_['pick'](_0x1cab3a[_0x8b3d('0x33')],_0x261070[_0x8b3d('0x34')]),_0x1125dc);if(_0x1cab3a[_0x8b3d('0x33')]['filter']){_0x591a4c['where']=_[_0x8b3d('0x3e')](_0x591a4c[_0x8b3d('0x3f')],{'$or':_[_0x8b3d('0x2d')](_0x1125dc,function(_0x4b8fef){if(_0x4b8fef['type']!=='VIRTUAL'){var _0xbb0ca9={};_0xbb0ca9[_0x4b8fef[_0x8b3d('0x32')]]={'$like':'%'+_0x1cab3a['query']['filter']+'%'};return _0xbb0ca9;}})});}_0x591a4c=_['merge']({},_0x591a4c,_0x1cab3a[_0x8b3d('0x40')]);var _0x56a690={'where':_0x591a4c[_0x8b3d('0x3f')]};return db[_0x8b3d('0x2e')][_0x8b3d('0x20')](_0x56a690)[_0x8b3d('0x27')](function(_0x328b0c){_0x747446[_0x8b3d('0x20')]=_0x328b0c;if(_0x1cab3a[_0x8b3d('0x33')][_0x8b3d('0x41')]){_0x591a4c[_0x8b3d('0x42')]=[{'all':!![]}];}return db[_0x8b3d('0x2e')][_0x8b3d('0x43')](_0x591a4c);})[_0x8b3d('0x27')](function(_0x42790b){_0x747446[_0x8b3d('0x44')]=_0x42790b;return _0x747446;})[_0x8b3d('0x27')](respondWithFilteredResult(_0x36f329,_0x591a4c))[_0x8b3d('0x45')](handleError(_0x36f329,null));};exports[_0x8b3d('0x46')]=function(_0x26d01a,_0x45c73e){var _0x4b5ac6={'raw':!![],'where':{'id':_0x26d01a['params']['id']}},_0x2d2c5e={};_0x2d2c5e[_0x8b3d('0x37')]=_['keys'](db[_0x8b3d('0x2e')]['rawAttributes']);_0x2d2c5e[_0x8b3d('0x33')]=_[_0x8b3d('0x47')](_0x26d01a[_0x8b3d('0x33')]);_0x2d2c5e[_0x8b3d('0x34')]=_[_0x8b3d('0x35')](_0x2d2c5e[_0x8b3d('0x37')],_0x2d2c5e[_0x8b3d('0x33')]);_0x4b5ac6[_0x8b3d('0x36')]=_['intersection'](_0x2d2c5e[_0x8b3d('0x37')],qs[_0x8b3d('0x38')](_0x26d01a['query'][_0x8b3d('0x38')]));_0x4b5ac6[_0x8b3d('0x36')]=_0x4b5ac6[_0x8b3d('0x36')][_0x8b3d('0x39')]?_0x4b5ac6[_0x8b3d('0x36')]:_0x2d2c5e[_0x8b3d('0x37')];if(_0x26d01a[_0x8b3d('0x33')][_0x8b3d('0x41')]){_0x4b5ac6[_0x8b3d('0x42')]=[{'all':!![]}];}_0x4b5ac6=_[_0x8b3d('0x3e')]({},_0x4b5ac6,_0x26d01a['options']);return db[_0x8b3d('0x2e')]['find'](_0x4b5ac6)[_0x8b3d('0x27')](handleEntityNotFound(_0x45c73e,null))[_0x8b3d('0x27')](respondWithResult(_0x45c73e,null))[_0x8b3d('0x45')](handleError(_0x45c73e,null));};exports[_0x8b3d('0x48')]=function(_0x33507f,_0x52ecc6){return db[_0x8b3d('0x2e')][_0x8b3d('0x48')](_0x33507f[_0x8b3d('0x49')],{})[_0x8b3d('0x27')](respondWithResult(_0x52ecc6,0xc9))['catch'](handleError(_0x52ecc6,null));};exports[_0x8b3d('0x26')]=function(_0x4a49d6,_0x5d94e7){if(_0x4a49d6[_0x8b3d('0x49')]['id']){delete _0x4a49d6[_0x8b3d('0x49')]['id'];}return db[_0x8b3d('0x2e')][_0x8b3d('0x4a')]({'where':{'id':_0x4a49d6['params']['id']}})[_0x8b3d('0x27')](handleEntityNotFound(_0x5d94e7,null))[_0x8b3d('0x27')](saveUpdates(_0x4a49d6['body'],null))[_0x8b3d('0x27')](respondWithResult(_0x5d94e7,null))[_0x8b3d('0x45')](handleError(_0x5d94e7,null));};exports[_0x8b3d('0x28')]=function(_0x455623,_0x2bb19a){return db[_0x8b3d('0x2e')][_0x8b3d('0x4a')]({'where':{'id':_0x455623[_0x8b3d('0x4b')]['id']}})[_0x8b3d('0x27')](handleEntityNotFound(_0x2bb19a,null))[_0x8b3d('0x27')](removeEntity(_0x2bb19a,null))['catch'](handleError(_0x2bb19a,null));};exports[_0x8b3d('0x4c')]=function(_0x5e1353,_0x262e5d){return db['ChatQueueReport'][_0x8b3d('0x4c')]()[_0x8b3d('0x27')](respondWithResult(_0x262e5d,null))[_0x8b3d('0x45')](handleError(_0x262e5d,null));}; \ No newline at end of file +var _0x9120=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','ChatQueueReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','limit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','length','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0x9120,0x1b3));var _0x0912=function(_0x23d2c0,_0x271f90){_0x23d2c0=_0x23d2c0-0x0;var _0x34b324=_0x9120[_0x23d2c0];return _0x34b324;};'use strict';var emlformat=require(_0x0912('0x0'));var rimraf=require(_0x0912('0x1'));var zipdir=require(_0x0912('0x2'));var jsonpatch=require(_0x0912('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0912('0x4'));var Mustache=require(_0x0912('0x5'));var util=require(_0x0912('0x6'));var path=require(_0x0912('0x7'));var sox=require(_0x0912('0x8'));var csv=require(_0x0912('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0912('0xa'));var _=require(_0x0912('0xb'));var squel=require(_0x0912('0xc'));var crypto=require('crypto');var jsforce=require(_0x0912('0xd'));var deskjs=require(_0x0912('0xe'));var toCsv=require(_0x0912('0x9'));var querystring=require(_0x0912('0xf'));var Papa=require(_0x0912('0x10'));var Redis=require('ioredis');var authService=require(_0x0912('0x11'));var qs=require(_0x0912('0x12'));var as=require(_0x0912('0x13'));var hardwareService=require(_0x0912('0x14'));var logger=require('../../config/logger')(_0x0912('0x15'));var utils=require('../../config/utils');var config=require(_0x0912('0x16'));var licenseUtil=require(_0x0912('0x17'));var db=require(_0x0912('0x18'))['db'];function respondWithStatusCode(_0xc7af62,_0x22752b){_0x22752b=_0x22752b||0xcc;return function(_0x10faac){if(_0x10faac){return _0xc7af62[_0x0912('0x19')](_0x22752b);}return _0xc7af62[_0x0912('0x1a')](_0x22752b)[_0x0912('0x1b')]();};}function respondWithResult(_0x102468,_0x17f22d){_0x17f22d=_0x17f22d||0xc8;return function(_0x350d6b){if(_0x350d6b){return _0x102468[_0x0912('0x1a')](_0x17f22d)[_0x0912('0x1c')](_0x350d6b);}};}function respondWithFilteredResult(_0x247612,_0x5eb1c9){return function(_0x4d00fd){if(_0x4d00fd){var _0x1ed3e8=typeof _0x5eb1c9['offset']===_0x0912('0x1d')&&typeof _0x5eb1c9['limit']===_0x0912('0x1d');var _0x49b581=_0x4d00fd[_0x0912('0x1e')];var _0x5eace1=_0x1ed3e8?0x0:_0x5eb1c9[_0x0912('0x1f')];var _0x5357db=_0x1ed3e8?_0x4d00fd[_0x0912('0x1e')]:_0x5eb1c9['offset']+_0x5eb1c9['limit'];var _0x3377af;if(_0x5357db>=_0x49b581){_0x5357db=_0x49b581;_0x3377af=0xc8;}else{_0x3377af=0xce;}_0x247612['status'](_0x3377af);return _0x247612[_0x0912('0x20')](_0x0912('0x21'),_0x5eace1+'-'+_0x5357db+'/'+_0x49b581)['json'](_0x4d00fd);}return null;};}function patchUpdates(_0x106008){return function(_0xb1af32){try{jsonpatch[_0x0912('0x22')](_0xb1af32,_0x106008,!![]);}catch(_0x5927d2){return BPromise['reject'](_0x5927d2);}return _0xb1af32[_0x0912('0x23')]();};}function saveUpdates(_0x626428,_0x1f04a1){return function(_0x30b7cc){if(_0x30b7cc){return _0x30b7cc[_0x0912('0x24')](_0x626428)[_0x0912('0x25')](function(_0x6c4902){return _0x6c4902;});}return null;};}function removeEntity(_0x2a3e70,_0xca7f8b){return function(_0x572d12){if(_0x572d12){return _0x572d12[_0x0912('0x26')]()[_0x0912('0x25')](function(){_0x2a3e70[_0x0912('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a938e,_0x21d65b){return function(_0x53d673){if(!_0x53d673){_0x4a938e['sendStatus'](0x194);}return _0x53d673;};}function handleError(_0x39462e,_0x39e96b){_0x39e96b=_0x39e96b||0x1f4;return function(_0x4d45d2){logger[_0x0912('0x27')](_0x4d45d2[_0x0912('0x28')]);if(_0x4d45d2[_0x0912('0x29')]){delete _0x4d45d2[_0x0912('0x29')];}_0x39462e[_0x0912('0x1a')](_0x39e96b)['send'](_0x4d45d2);};}exports[_0x0912('0x2a')]=function(_0x1d6c87,_0x4ac024){var _0x2b1653={},_0x3428a9={},_0x2ce714={'count':0x0,'rows':[]};var _0x5b3956=_[_0x0912('0x2b')](db[_0x0912('0x2c')][_0x0912('0x2d')],function(_0x176529){return{'name':_0x176529['fieldName'],'type':_0x176529[_0x0912('0x2e')][_0x0912('0x2f')]};});_0x3428a9[_0x0912('0x30')]=_[_0x0912('0x2b')](_0x5b3956,_0x0912('0x29'));_0x3428a9[_0x0912('0x31')]=_['keys'](_0x1d6c87['query']);_0x3428a9[_0x0912('0x32')]=_[_0x0912('0x33')](_0x3428a9['model'],_0x3428a9['query']);_0x2b1653[_0x0912('0x34')]=_[_0x0912('0x33')](_0x3428a9[_0x0912('0x30')],qs[_0x0912('0x35')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x35')]));_0x2b1653[_0x0912('0x34')]=_0x2b1653[_0x0912('0x34')]['length']?_0x2b1653['attributes']:_0x3428a9[_0x0912('0x30')];if(!_0x1d6c87[_0x0912('0x31')]['hasOwnProperty'](_0x0912('0x36'))){_0x2b1653[_0x0912('0x37')]=qs[_0x0912('0x37')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x37')]);_0x2b1653[_0x0912('0x1f')]=qs[_0x0912('0x1f')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x1f')]);}_0x2b1653['order']=qs[_0x0912('0x38')](_0x1d6c87[_0x0912('0x31')][_0x0912('0x38')]);_0x2b1653[_0x0912('0x39')]=qs[_0x0912('0x32')](_[_0x0912('0x3a')](_0x1d6c87[_0x0912('0x31')],_0x3428a9['filters']),_0x5b3956);if(_0x1d6c87[_0x0912('0x31')]['filter']){_0x2b1653['where']=_['merge'](_0x2b1653[_0x0912('0x39')],{'$or':_[_0x0912('0x2b')](_0x5b3956,function(_0x5db5f9){if(_0x5db5f9[_0x0912('0x2e')]!==_0x0912('0x3b')){var _0xfdf81c={};_0xfdf81c[_0x5db5f9['name']]={'$like':'%'+_0x1d6c87[_0x0912('0x31')][_0x0912('0x3c')]+'%'};return _0xfdf81c;}})});}_0x2b1653=_['merge']({},_0x2b1653,_0x1d6c87[_0x0912('0x3d')]);var _0x40de57={'where':_0x2b1653[_0x0912('0x39')]};return db[_0x0912('0x2c')][_0x0912('0x1e')](_0x40de57)[_0x0912('0x25')](function(_0x4eb359){_0x2ce714[_0x0912('0x1e')]=_0x4eb359;if(_0x1d6c87[_0x0912('0x31')][_0x0912('0x3e')]){_0x2b1653[_0x0912('0x3f')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x0912('0x40')](_0x2b1653);})[_0x0912('0x25')](function(_0x10040b){_0x2ce714['rows']=_0x10040b;return _0x2ce714;})[_0x0912('0x25')](respondWithFilteredResult(_0x4ac024,_0x2b1653))[_0x0912('0x41')](handleError(_0x4ac024,null));};exports[_0x0912('0x42')]=function(_0x19839e,_0x1c5158){var _0x320f98={'raw':!![],'where':{'id':_0x19839e[_0x0912('0x43')]['id']}},_0x15e23b={};_0x15e23b['model']=_[_0x0912('0x44')](db['ChatQueueReport'][_0x0912('0x2d')]);_0x15e23b[_0x0912('0x31')]=_[_0x0912('0x44')](_0x19839e[_0x0912('0x31')]);_0x15e23b[_0x0912('0x32')]=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],_0x15e23b[_0x0912('0x31')]);_0x320f98['attributes']=_[_0x0912('0x33')](_0x15e23b[_0x0912('0x30')],qs[_0x0912('0x35')](_0x19839e['query'][_0x0912('0x35')]));_0x320f98[_0x0912('0x34')]=_0x320f98[_0x0912('0x34')][_0x0912('0x45')]?_0x320f98[_0x0912('0x34')]:_0x15e23b[_0x0912('0x30')];if(_0x19839e[_0x0912('0x31')][_0x0912('0x3e')]){_0x320f98[_0x0912('0x3f')]=[{'all':!![]}];}_0x320f98=_[_0x0912('0x46')]({},_0x320f98,_0x19839e[_0x0912('0x3d')]);return db[_0x0912('0x2c')][_0x0912('0x47')](_0x320f98)[_0x0912('0x25')](handleEntityNotFound(_0x1c5158,null))[_0x0912('0x25')](respondWithResult(_0x1c5158,null))[_0x0912('0x41')](handleError(_0x1c5158,null));};exports[_0x0912('0x48')]=function(_0x255ee5,_0x3b0548){return db[_0x0912('0x2c')][_0x0912('0x48')](_0x255ee5[_0x0912('0x49')],{})[_0x0912('0x25')](respondWithResult(_0x3b0548,0xc9))['catch'](handleError(_0x3b0548,null));};exports[_0x0912('0x24')]=function(_0x3b94cc,_0x591c83){if(_0x3b94cc[_0x0912('0x49')]['id']){delete _0x3b94cc[_0x0912('0x49')]['id'];}return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x3b94cc[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x591c83,null))['then'](saveUpdates(_0x3b94cc[_0x0912('0x49')],null))[_0x0912('0x25')](respondWithResult(_0x591c83,null))[_0x0912('0x41')](handleError(_0x591c83,null));};exports['destroy']=function(_0x11364e,_0x3ce4bf){return db[_0x0912('0x2c')][_0x0912('0x47')]({'where':{'id':_0x11364e[_0x0912('0x43')]['id']}})[_0x0912('0x25')](handleEntityNotFound(_0x3ce4bf,null))[_0x0912('0x25')](removeEntity(_0x3ce4bf,null))[_0x0912('0x41')](handleError(_0x3ce4bf,null));};exports['describe']=function(_0x91bb1a,_0x360313){return db[_0x0912('0x2c')][_0x0912('0x4a')]()[_0x0912('0x25')](respondWithResult(_0x360313,null))['catch'](handleError(_0x360313,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 0057bbc..10657e3 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 _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x3e775f,_0x3b55d1){var _0x5f3b28=function(_0x51a351){while(--_0x51a351){_0x3e775f['push'](_0x3e775f['shift']());}};_0x5f3b28(++_0x3b55d1);}(_0x757a,0xde));var _0xa757=function(_0x42e243,_0x132f93){_0x42e243=_0x42e243-0x0;var _0x18261b=_0x757a[_0x42e243];return _0x18261b;};'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 +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x229742,_0x5c682d){var _0x536bbf=function(_0x142918){while(--_0x142918){_0x229742['push'](_0x229742['shift']());}};_0x536bbf(++_0x5c682d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0xb7e7[_0x3ea913];return _0x2b4f28;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 7426160..9a7233b 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 _0x0ae2=['http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateChatQueueReport','create','body','raw','debug','stringify','ChatQueueReport','update','options','where','attributes','limit','UpdateChatQueueReport','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x0ae2,0xa5));var _0x20ae=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0x0ae2[_0x13cab0];return _0x38804f;};'use strict';var _=require(_0x20ae('0x0'));var util=require('util');var moment=require(_0x20ae('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x20ae('0x2'));var db=require(_0x20ae('0x3'))['db'];var utils=require(_0x20ae('0x4'));var logger=require(_0x20ae('0x5'))(_0x20ae('0x6'));var config=require(_0x20ae('0x7'));var jayson=require(_0x20ae('0x8'));var client=jayson[_0x20ae('0x9')][_0x20ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x56c9e7,_0x2ea7c4,_0x38696e){return new BPromise(function(_0x361b55,_0x13dd09){return client[_0x20ae('0xb')](_0x56c9e7,_0x38696e)[_0x20ae('0xc')](function(_0x463563){logger['info'](_0x20ae('0xd'),_0x2ea7c4,_0x20ae('0xe'));logger['debug'](_0x20ae('0xf'),_0x2ea7c4,'request\x20sent',JSON['stringify'](_0x463563));if(_0x463563[_0x20ae('0x10')]){if(_0x463563[_0x20ae('0x10')][_0x20ae('0x11')]===0x1f4){logger[_0x20ae('0x10')](_0x20ae('0xd'),_0x2ea7c4,_0x463563[_0x20ae('0x10')][_0x20ae('0x12')]);return _0x13dd09(_0x463563[_0x20ae('0x10')][_0x20ae('0x12')]);}logger[_0x20ae('0x10')](_0x20ae('0xd'),_0x2ea7c4,_0x463563[_0x20ae('0x10')]['message']);return _0x361b55(_0x463563['error'][_0x20ae('0x12')]);}else{logger[_0x20ae('0x13')](_0x20ae('0xd'),_0x2ea7c4,'request\x20sent');_0x361b55(_0x463563[_0x20ae('0x14')]['message']);}})[_0x20ae('0x15')](function(_0x156488){logger[_0x20ae('0x10')](_0x20ae('0xd'),_0x2ea7c4,_0x156488);_0x13dd09(_0x156488);});});}exports[_0x20ae('0x16')]=function(_0x2e9b47){var _0x2682ca=this;return new Promise(function(_0x4adcb9,_0x2acfb6){return db['ChatQueueReport'][_0x20ae('0x17')](_0x2e9b47[_0x20ae('0x18')],{'raw':_0x2e9b47['options']?_0x2e9b47['options'][_0x20ae('0x19')]===undefined?!![]:![]:!![]})[_0x20ae('0xc')](function(_0x1ef2d0){logger[_0x20ae('0x13')](_0x20ae('0x16'),_0x2e9b47);logger[_0x20ae('0x1a')]('CreateChatQueueReport',_0x2e9b47,JSON[_0x20ae('0x1b')](_0x1ef2d0));_0x4adcb9(_0x1ef2d0);})[_0x20ae('0x15')](function(_0x38df75){logger['error']('CreateChatQueueReport',_0x38df75[_0x20ae('0x12')],_0x2e9b47);_0x2acfb6(_0x2682ca['error'](0x1f4,_0x38df75[_0x20ae('0x12')]));});});};exports['UpdateChatQueueReport']=function(_0x5f19bc){var _0x4e4bbe=this;return new Promise(function(_0x525972,_0x14458b){return db[_0x20ae('0x1c')][_0x20ae('0x1d')](_0x5f19bc[_0x20ae('0x18')],{'raw':_0x5f19bc['options']?_0x5f19bc[_0x20ae('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f19bc[_0x20ae('0x1e')]?_0x5f19bc['options'][_0x20ae('0x1f')]||null:null,'attributes':_0x5f19bc[_0x20ae('0x1e')]?_0x5f19bc[_0x20ae('0x1e')][_0x20ae('0x20')]||null:null,'limit':_0x5f19bc[_0x20ae('0x1e')]?_0x5f19bc[_0x20ae('0x1e')][_0x20ae('0x21')]||null:null})[_0x20ae('0xc')](function(_0x87af23){logger[_0x20ae('0x13')](_0x20ae('0x22'),_0x5f19bc);logger[_0x20ae('0x1a')]('UpdateChatQueueReport',_0x5f19bc,JSON[_0x20ae('0x1b')](_0x87af23));_0x525972(_0x87af23);})['catch'](function(_0x2bdf2b){logger[_0x20ae('0x10')]('UpdateChatQueueReport',_0x2bdf2b[_0x20ae('0x12')],_0x5f19bc);_0x14458b(_0x4e4bbe[_0x20ae('0x10')](0x1f4,_0x2bdf2b[_0x20ae('0x12')]));});});}; \ No newline at end of file +var _0x3fc4=['debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','UpdateChatQueueReport','update','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x518ee7,_0x18f4a4){var _0x59b1d7=function(_0x238778){while(--_0x238778){_0x518ee7['push'](_0x518ee7['shift']());}};_0x59b1d7(++_0x18f4a4);}(_0x3fc4,0x179));var _0x43fc=function(_0x22ec7e,_0x24fde9){_0x22ec7e=_0x22ec7e-0x0;var _0x2bd9d2=_0x3fc4[_0x22ec7e];return _0x2bd9d2;};'use strict';var _=require('lodash');var util=require(_0x43fc('0x0'));var moment=require(_0x43fc('0x1'));var BPromise=require(_0x43fc('0x2'));var rs=require(_0x43fc('0x3'));var fs=require('fs');var Redis=require(_0x43fc('0x4'));var db=require(_0x43fc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x43fc('0x6'))('rpc');var config=require(_0x43fc('0x7'));var jayson=require(_0x43fc('0x8'));var client=jayson[_0x43fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a8d6c,_0x509e56,_0x2b17a5){return new BPromise(function(_0x38e8ba,_0x56116a){return client['request'](_0x2a8d6c,_0x2b17a5)[_0x43fc('0xa')](function(_0x2cc50c){logger['info'](_0x43fc('0xb'),_0x509e56,_0x43fc('0xc'));logger[_0x43fc('0xd')](_0x43fc('0xe'),_0x509e56,_0x43fc('0xc'),JSON[_0x43fc('0xf')](_0x2cc50c));if(_0x2cc50c[_0x43fc('0x10')]){if(_0x2cc50c[_0x43fc('0x10')]['code']===0x1f4){logger['error'](_0x43fc('0xb'),_0x509e56,_0x2cc50c[_0x43fc('0x10')][_0x43fc('0x11')]);return _0x56116a(_0x2cc50c[_0x43fc('0x10')][_0x43fc('0x11')]);}logger[_0x43fc('0x10')](_0x43fc('0xb'),_0x509e56,_0x2cc50c[_0x43fc('0x10')][_0x43fc('0x11')]);return _0x38e8ba(_0x2cc50c[_0x43fc('0x10')]['message']);}else{logger[_0x43fc('0x12')](_0x43fc('0xb'),_0x509e56,_0x43fc('0xc'));_0x38e8ba(_0x2cc50c[_0x43fc('0x13')][_0x43fc('0x11')]);}})[_0x43fc('0x14')](function(_0x54f01b){logger[_0x43fc('0x10')](_0x43fc('0xb'),_0x509e56,_0x54f01b);_0x56116a(_0x54f01b);});});}exports[_0x43fc('0x15')]=function(_0x10fbcf){var _0x4763ea=this;return new Promise(function(_0x2a68e6,_0x45ac0a){return db[_0x43fc('0x16')]['create'](_0x10fbcf[_0x43fc('0x17')],{'raw':_0x10fbcf[_0x43fc('0x18')]?_0x10fbcf[_0x43fc('0x18')][_0x43fc('0x19')]===undefined?!![]:![]:!![]})[_0x43fc('0xa')](function(_0x5c133a){logger[_0x43fc('0x12')](_0x43fc('0x15'),_0x10fbcf);logger['debug'](_0x43fc('0x15'),_0x10fbcf,JSON[_0x43fc('0xf')](_0x5c133a));_0x2a68e6(_0x5c133a);})[_0x43fc('0x14')](function(_0x2bda3b){logger['error'](_0x43fc('0x15'),_0x2bda3b[_0x43fc('0x11')],_0x10fbcf);_0x45ac0a(_0x4763ea[_0x43fc('0x10')](0x1f4,_0x2bda3b[_0x43fc('0x11')]));});});};exports[_0x43fc('0x1a')]=function(_0x3cbc4e){var _0x113069=this;return new Promise(function(_0x5c7cc2,_0x25f9a9){return db[_0x43fc('0x16')][_0x43fc('0x1b')](_0x3cbc4e['body'],{'raw':_0x3cbc4e['options']?_0x3cbc4e['options'][_0x43fc('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cbc4e[_0x43fc('0x18')]?_0x3cbc4e[_0x43fc('0x18')]['where']||null:null,'attributes':_0x3cbc4e[_0x43fc('0x18')]?_0x3cbc4e[_0x43fc('0x18')][_0x43fc('0x1c')]||null:null,'limit':_0x3cbc4e['options']?_0x3cbc4e[_0x43fc('0x18')][_0x43fc('0x1d')]||null:null})['then'](function(_0x1836e1){logger[_0x43fc('0x12')]('UpdateChatQueueReport',_0x3cbc4e);logger[_0x43fc('0xd')]('UpdateChatQueueReport',_0x3cbc4e,JSON[_0x43fc('0xf')](_0x1836e1));_0x5c7cc2(_0x1836e1);})[_0x43fc('0x14')](function(_0x3ff3d2){logger[_0x43fc('0x10')](_0x43fc('0x1a'),_0x3ff3d2['message'],_0x3cbc4e);_0x25f9a9(_0x113069[_0x43fc('0x10')](0x1f4,_0x3ff3d2[_0x43fc('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index a417248..e86ca0a 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 _0x3005=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','post','create','put','delete','exports','path','express','Router','fs-extra'];(function(_0x42c6f1,_0x338d7b){var _0x3c7398=function(_0x151494){while(--_0x151494){_0x42c6f1['push'](_0x42c6f1['shift']());}};_0x3c7398(++_0x338d7b);}(_0x3005,0x183));var _0x5300=function(_0x21d951,_0x511bd9){_0x21d951=_0x21d951-0x0;var _0x149d77=_0x3005[_0x21d951];return _0x149d77;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5300('0x0'));var timeout=require('connect-timeout');var express=require(_0x5300('0x1'));var router=express[_0x5300('0x2')]();var fs_extra=require(_0x5300('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x5300('0x4'));var config=require(_0x5300('0x5'));var controller=require('./chatQueueReport.controller');router[_0x5300('0x6')]('/',auth['isAuthenticated'](),controller[_0x5300('0x7')]);router[_0x5300('0x6')](_0x5300('0x8'),auth[_0x5300('0x9')](),controller['describe']);router[_0x5300('0x6')](_0x5300('0xa'),auth[_0x5300('0x9')](),controller[_0x5300('0xb')]);router[_0x5300('0xc')]('/',auth[_0x5300('0x9')](),controller[_0x5300('0xd')]);router[_0x5300('0xe')](_0x5300('0xa'),auth[_0x5300('0x9')](),controller['update']);router[_0x5300('0xf')](_0x5300('0xa'),auth[_0x5300('0x9')](),controller['destroy']);module[_0x5300('0x10')]=router; \ No newline at end of file +var _0x11de=['connect-timeout','express','Router','../../components/auth/service','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','path'];(function(_0xc3a71f,_0x54fe71){var _0x46a474=function(_0x47e601){while(--_0x47e601){_0xc3a71f['push'](_0xc3a71f['shift']());}};_0x46a474(++_0x54fe71);}(_0x11de,0x8a));var _0xe11d=function(_0x468431,_0x4a46d0){_0x468431=_0x468431-0x0;var _0x2a9dd4=_0x11de[_0x468431];return _0x2a9dd4;};'use strict';var multer=require(_0xe11d('0x0'));var util=require('util');var path=require(_0xe11d('0x1'));var timeout=require(_0xe11d('0x2'));var express=require(_0xe11d('0x3'));var router=express[_0xe11d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe11d('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe11d('0x6'));router[_0xe11d('0x7')]('/',auth[_0xe11d('0x8')](),controller[_0xe11d('0x9')]);router[_0xe11d('0x7')](_0xe11d('0xa'),auth[_0xe11d('0x8')](),controller[_0xe11d('0xb')]);router['get'](_0xe11d('0xc'),auth[_0xe11d('0x8')](),controller[_0xe11d('0xd')]);router['post']('/',auth[_0xe11d('0x8')](),controller[_0xe11d('0xe')]);router[_0xe11d('0xf')]('/:id',auth[_0xe11d('0x8')](),controller[_0xe11d('0x10')]);router[_0xe11d('0x11')](_0xe11d('0xc'),auth[_0xe11d('0x8')](),controller[_0xe11d('0x12')]);module[_0xe11d('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 f785f3f..b536586 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(_0x5f5cce,_0x138cc5){var _0x705ecf=function(_0x28bc5d){while(--_0x28bc5d){_0x5f5cce['push'](_0x5f5cce['shift']());}};_0x705ecf(++_0x138cc5);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4d8cf0,_0x1a581f){_0x4d8cf0=_0x4d8cf0-0x0;var _0x251e52=_0xb43b[_0x4d8cf0];return _0x251e52;};'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(_0x25be3b,_0x55e82b){var _0x3dbf80=function(_0x4928a2){while(--_0x4928a2){_0x25be3b['push'](_0x25be3b['shift']());}};_0x3dbf80(++_0x55e82b);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'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 3cbb711..4dad233 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 _0xcc09=['query','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','send','map','type','keys'];(function(_0x57c1f7,_0x257f29){var _0xc7013c=function(_0x24031e){while(--_0x24031e){_0x57c1f7['push'](_0x57c1f7['shift']());}};_0xc7013c(++_0x257f29);}(_0xcc09,0x1e1));var _0x9cc0=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xcc09[_0x5d2803];return _0xdcad2c;};'use strict';var emlformat=require(_0x9cc0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x9cc0('0x1'));var rp=require(_0x9cc0('0x2'));var moment=require(_0x9cc0('0x3'));var BPromise=require(_0x9cc0('0x4'));var Mustache=require('mustache');var util=require(_0x9cc0('0x5'));var path=require(_0x9cc0('0x6'));var sox=require(_0x9cc0('0x7'));var csv=require(_0x9cc0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9cc0('0x9'));var _=require(_0x9cc0('0xa'));var squel=require('squel');var crypto=require(_0x9cc0('0xb'));var jsforce=require(_0x9cc0('0xc'));var deskjs=require(_0x9cc0('0xd'));var toCsv=require(_0x9cc0('0x8'));var querystring=require(_0x9cc0('0xe'));var Papa=require(_0x9cc0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9cc0('0x10'));var utils=require(_0x9cc0('0x11'));var config=require(_0x9cc0('0x12'));var licenseUtil=require(_0x9cc0('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d3f5b,_0x35aef7){_0x35aef7=_0x35aef7||0xcc;return function(_0x561314){if(_0x561314){return _0x1d3f5b[_0x9cc0('0x14')](_0x35aef7);}return _0x1d3f5b[_0x9cc0('0x15')](_0x35aef7)[_0x9cc0('0x16')]();};}function respondWithResult(_0x1f30fa,_0x3057b8){_0x3057b8=_0x3057b8||0xc8;return function(_0x1c42f9){if(_0x1c42f9){return _0x1f30fa[_0x9cc0('0x15')](_0x3057b8)['json'](_0x1c42f9);}};}function respondWithFilteredResult(_0x1a523f,_0x2f7df9){return function(_0xdd1763){if(_0xdd1763){var _0x54d0aa=typeof _0x2f7df9[_0x9cc0('0x17')]===_0x9cc0('0x18')&&typeof _0x2f7df9[_0x9cc0('0x19')]===_0x9cc0('0x18');var _0x38291d=_0xdd1763[_0x9cc0('0x1a')];var _0x39bbc2=_0x54d0aa?0x0:_0x2f7df9[_0x9cc0('0x17')];var _0x52b020=_0x54d0aa?_0xdd1763['count']:_0x2f7df9[_0x9cc0('0x17')]+_0x2f7df9[_0x9cc0('0x19')];var _0xfd0fd0;if(_0x52b020>=_0x38291d){_0x52b020=_0x38291d;_0xfd0fd0=0xc8;}else{_0xfd0fd0=0xce;}_0x1a523f[_0x9cc0('0x15')](_0xfd0fd0);return _0x1a523f['set']('Content-Range',_0x39bbc2+'-'+_0x52b020+'/'+_0x38291d)['json'](_0xdd1763);}return null;};}function patchUpdates(_0x2ce382){return function(_0x1afa11){try{jsonpatch[_0x9cc0('0x1b')](_0x1afa11,_0x2ce382,!![]);}catch(_0x4e5b03){return BPromise[_0x9cc0('0x1c')](_0x4e5b03);}return _0x1afa11[_0x9cc0('0x1d')]();};}function saveUpdates(_0x21aae9,_0x3f8ff2){return function(_0x48e610){if(_0x48e610){return _0x48e610[_0x9cc0('0x1e')](_0x21aae9)[_0x9cc0('0x1f')](function(_0x41bc21){return _0x41bc21;});}return null;};}function removeEntity(_0x3da676,_0x5cd7a1){return function(_0x2ddc11){if(_0x2ddc11){return _0x2ddc11[_0x9cc0('0x20')]()[_0x9cc0('0x1f')](function(){_0x3da676['status'](0xcc)[_0x9cc0('0x16')]();});}};}function handleEntityNotFound(_0x5bf0c3,_0xb6b7b3){return function(_0x4a5fc4){if(!_0x4a5fc4){_0x5bf0c3[_0x9cc0('0x14')](0x194);}return _0x4a5fc4;};}function handleError(_0x54a581,_0x332ef5){_0x332ef5=_0x332ef5||0x1f4;return function(_0x4cff79){logger['error'](_0x4cff79[_0x9cc0('0x21')]);if(_0x4cff79[_0x9cc0('0x22')]){delete _0x4cff79[_0x9cc0('0x22')];}_0x54a581[_0x9cc0('0x15')](_0x332ef5)[_0x9cc0('0x23')](_0x4cff79);};}exports['index']=function(_0x11ecad,_0x216ea5){var _0x2e947d={},_0x225a64={},_0x4c0471={'count':0x0,'rows':[]};var _0x2ea35b=_[_0x9cc0('0x24')](db['ChatTransferReport']['rawAttributes'],function(_0x30ee8){return{'name':_0x30ee8['fieldName'],'type':_0x30ee8[_0x9cc0('0x25')]['key']};});_0x225a64['model']=_[_0x9cc0('0x24')](_0x2ea35b,_0x9cc0('0x22'));_0x225a64['query']=_[_0x9cc0('0x26')](_0x11ecad[_0x9cc0('0x27')]);_0x225a64['filters']=_['intersection'](_0x225a64[_0x9cc0('0x28')],_0x225a64[_0x9cc0('0x27')]);_0x2e947d[_0x9cc0('0x29')]=_['intersection'](_0x225a64['model'],qs[_0x9cc0('0x2a')](_0x11ecad[_0x9cc0('0x27')]['fields']));_0x2e947d[_0x9cc0('0x29')]=_0x2e947d[_0x9cc0('0x29')][_0x9cc0('0x2b')]?_0x2e947d[_0x9cc0('0x29')]:_0x225a64[_0x9cc0('0x28')];if(!_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x2c')]('nolimit')){_0x2e947d[_0x9cc0('0x19')]=qs[_0x9cc0('0x19')](_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x19')]);_0x2e947d[_0x9cc0('0x17')]=qs[_0x9cc0('0x17')](_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x17')]);}_0x2e947d['order']=qs[_0x9cc0('0x2d')](_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x2d')]);_0x2e947d[_0x9cc0('0x2e')]=qs['filters'](_[_0x9cc0('0x2f')](_0x11ecad[_0x9cc0('0x27')],_0x225a64['filters']),_0x2ea35b);if(_0x11ecad['query'][_0x9cc0('0x30')]){_0x2e947d['where']=_[_0x9cc0('0x31')](_0x2e947d[_0x9cc0('0x2e')],{'$or':_[_0x9cc0('0x24')](_0x2ea35b,function(_0x302049){if(_0x302049[_0x9cc0('0x25')]!=='VIRTUAL'){var _0x5868ad={};_0x5868ad[_0x302049[_0x9cc0('0x22')]]={'$like':'%'+_0x11ecad['query'][_0x9cc0('0x30')]+'%'};return _0x5868ad;}})});}_0x2e947d=_[_0x9cc0('0x31')]({},_0x2e947d,_0x11ecad['options']);var _0x4e39bc={'where':_0x2e947d[_0x9cc0('0x2e')]};return db[_0x9cc0('0x32')][_0x9cc0('0x1a')](_0x4e39bc)[_0x9cc0('0x1f')](function(_0x1a8938){_0x4c0471[_0x9cc0('0x1a')]=_0x1a8938;if(_0x11ecad[_0x9cc0('0x27')][_0x9cc0('0x33')]){_0x2e947d[_0x9cc0('0x34')]=[{'all':!![]}];}return db[_0x9cc0('0x32')][_0x9cc0('0x35')](_0x2e947d);})[_0x9cc0('0x1f')](function(_0x4599d1){_0x4c0471[_0x9cc0('0x36')]=_0x4599d1;return _0x4c0471;})[_0x9cc0('0x1f')](respondWithFilteredResult(_0x216ea5,_0x2e947d))[_0x9cc0('0x37')](handleError(_0x216ea5,null));};exports[_0x9cc0('0x38')]=function(_0x554adb,_0x356b74){var _0x1285c7={'raw':!![],'where':{'id':_0x554adb[_0x9cc0('0x39')]['id']}},_0x41fadd={};_0x41fadd[_0x9cc0('0x28')]=_[_0x9cc0('0x26')](db[_0x9cc0('0x32')][_0x9cc0('0x3a')]);_0x41fadd[_0x9cc0('0x27')]=_[_0x9cc0('0x26')](_0x554adb[_0x9cc0('0x27')]);_0x41fadd['filters']=_[_0x9cc0('0x3b')](_0x41fadd['model'],_0x41fadd['query']);_0x1285c7['attributes']=_[_0x9cc0('0x3b')](_0x41fadd[_0x9cc0('0x28')],qs[_0x9cc0('0x2a')](_0x554adb[_0x9cc0('0x27')][_0x9cc0('0x2a')]));_0x1285c7[_0x9cc0('0x29')]=_0x1285c7[_0x9cc0('0x29')][_0x9cc0('0x2b')]?_0x1285c7[_0x9cc0('0x29')]:_0x41fadd['model'];if(_0x554adb[_0x9cc0('0x27')]['includeAll']){_0x1285c7[_0x9cc0('0x34')]=[{'all':!![]}];}_0x1285c7=_['merge']({},_0x1285c7,_0x554adb[_0x9cc0('0x3c')]);return db[_0x9cc0('0x32')][_0x9cc0('0x3d')](_0x1285c7)['then'](handleEntityNotFound(_0x356b74,null))['then'](respondWithResult(_0x356b74,null))['catch'](handleError(_0x356b74,null));};exports[_0x9cc0('0x3e')]=function(_0x3dfe3b,_0x56749b){return db[_0x9cc0('0x32')][_0x9cc0('0x3e')](_0x3dfe3b[_0x9cc0('0x3f')],{})[_0x9cc0('0x1f')](respondWithResult(_0x56749b,0xc9))[_0x9cc0('0x37')](handleError(_0x56749b,null));};exports[_0x9cc0('0x1e')]=function(_0x51bfab,_0x28a578){if(_0x51bfab[_0x9cc0('0x3f')]['id']){delete _0x51bfab[_0x9cc0('0x3f')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x51bfab[_0x9cc0('0x39')]['id']}})[_0x9cc0('0x1f')](handleEntityNotFound(_0x28a578,null))[_0x9cc0('0x1f')](saveUpdates(_0x51bfab[_0x9cc0('0x3f')],null))[_0x9cc0('0x1f')](respondWithResult(_0x28a578,null))[_0x9cc0('0x37')](handleError(_0x28a578,null));};exports[_0x9cc0('0x20')]=function(_0x3c86cf,_0x1b146c){return db[_0x9cc0('0x32')][_0x9cc0('0x3d')]({'where':{'id':_0x3c86cf[_0x9cc0('0x39')]['id']}})['then'](handleEntityNotFound(_0x1b146c,null))['then'](removeEntity(_0x1b146c,null))[_0x9cc0('0x37')](handleError(_0x1b146c,null));};exports[_0x9cc0('0x40')]=function(_0x2ae93a,_0x1d5401){return db[_0x9cc0('0x32')]['describe']()[_0x9cc0('0x1f')](respondWithResult(_0x1d5401,null))[_0x9cc0('0x37')](handleError(_0x1d5401,null));}; \ No newline at end of file +var _0x025b=['rows','catch','show','params','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll'];(function(_0x1840c7,_0xb8b170){var _0x225acb=function(_0x425118){while(--_0x425118){_0x1840c7['push'](_0x1840c7['shift']());}};_0x225acb(++_0xb8b170);}(_0x025b,0x1c5));var _0xb025=function(_0x320e21,_0x1f9905){_0x320e21=_0x320e21-0x0;var _0x3d174a=_0x025b[_0x320e21];return _0x3d174a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb025('0x0'));var zipdir=require(_0xb025('0x1'));var jsonpatch=require(_0xb025('0x2'));var rp=require(_0xb025('0x3'));var moment=require(_0xb025('0x4'));var BPromise=require(_0xb025('0x5'));var Mustache=require(_0xb025('0x6'));var util=require(_0xb025('0x7'));var path=require(_0xb025('0x8'));var sox=require('sox');var csv=require(_0xb025('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb025('0xa'));var _=require(_0xb025('0xb'));var squel=require('squel');var crypto=require(_0xb025('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb025('0xd'));var toCsv=require(_0xb025('0x9'));var querystring=require(_0xb025('0xe'));var Papa=require('papaparse');var Redis=require(_0xb025('0xf'));var authService=require(_0xb025('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb025('0x11'));var hardwareService=require(_0xb025('0x12'));var logger=require(_0xb025('0x13'))(_0xb025('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb025('0x15'))['db'];function respondWithStatusCode(_0x69ccf5,_0x3ef3be){_0x3ef3be=_0x3ef3be||0xcc;return function(_0x23a764){if(_0x23a764){return _0x69ccf5[_0xb025('0x16')](_0x3ef3be);}return _0x69ccf5[_0xb025('0x17')](_0x3ef3be)[_0xb025('0x18')]();};}function respondWithResult(_0x74d0d,_0x36f978){_0x36f978=_0x36f978||0xc8;return function(_0x475f1f){if(_0x475f1f){return _0x74d0d[_0xb025('0x17')](_0x36f978)['json'](_0x475f1f);}};}function respondWithFilteredResult(_0x593f44,_0x8c1b51){return function(_0x90cf0b){if(_0x90cf0b){var _0x22a3eb=typeof _0x8c1b51[_0xb025('0x19')]===_0xb025('0x1a')&&typeof _0x8c1b51[_0xb025('0x1b')]===_0xb025('0x1a');var _0xa826e0=_0x90cf0b[_0xb025('0x1c')];var _0x3251a8=_0x22a3eb?0x0:_0x8c1b51[_0xb025('0x19')];var _0x1a4b94=_0x22a3eb?_0x90cf0b[_0xb025('0x1c')]:_0x8c1b51[_0xb025('0x19')]+_0x8c1b51[_0xb025('0x1b')];var _0x4dbc87;if(_0x1a4b94>=_0xa826e0){_0x1a4b94=_0xa826e0;_0x4dbc87=0xc8;}else{_0x4dbc87=0xce;}_0x593f44[_0xb025('0x17')](_0x4dbc87);return _0x593f44['set'](_0xb025('0x1d'),_0x3251a8+'-'+_0x1a4b94+'/'+_0xa826e0)['json'](_0x90cf0b);}return null;};}function patchUpdates(_0x407fa0){return function(_0x2f124d){try{jsonpatch[_0xb025('0x1e')](_0x2f124d,_0x407fa0,!![]);}catch(_0x5bfd89){return BPromise[_0xb025('0x1f')](_0x5bfd89);}return _0x2f124d[_0xb025('0x20')]();};}function saveUpdates(_0x1f3b18,_0x4743d){return function(_0x567358){if(_0x567358){return _0x567358[_0xb025('0x21')](_0x1f3b18)['then'](function(_0x335e49){return _0x335e49;});}return null;};}function removeEntity(_0x569e35,_0x14b21e){return function(_0x3076cd){if(_0x3076cd){return _0x3076cd['destroy']()[_0xb025('0x22')](function(){_0x569e35['status'](0xcc)[_0xb025('0x18')]();});}};}function handleEntityNotFound(_0x136233,_0x5b1547){return function(_0x20913f){if(!_0x20913f){_0x136233[_0xb025('0x16')](0x194);}return _0x20913f;};}function handleError(_0x59195d,_0x255ca7){_0x255ca7=_0x255ca7||0x1f4;return function(_0x423b5a){logger[_0xb025('0x23')](_0x423b5a[_0xb025('0x24')]);if(_0x423b5a[_0xb025('0x25')]){delete _0x423b5a[_0xb025('0x25')];}_0x59195d[_0xb025('0x17')](_0x255ca7)[_0xb025('0x26')](_0x423b5a);};}exports[_0xb025('0x27')]=function(_0x2201cb,_0x40e280){var _0x555aa3={},_0x4e2930={},_0x2593e1={'count':0x0,'rows':[]};var _0x8dc14a=_[_0xb025('0x28')](db[_0xb025('0x29')][_0xb025('0x2a')],function(_0x58677c){return{'name':_0x58677c[_0xb025('0x2b')],'type':_0x58677c['type'][_0xb025('0x2c')]};});_0x4e2930[_0xb025('0x2d')]=_[_0xb025('0x28')](_0x8dc14a,_0xb025('0x25'));_0x4e2930[_0xb025('0x2e')]=_[_0xb025('0x2f')](_0x2201cb[_0xb025('0x2e')]);_0x4e2930[_0xb025('0x30')]=_[_0xb025('0x31')](_0x4e2930['model'],_0x4e2930[_0xb025('0x2e')]);_0x555aa3[_0xb025('0x32')]=_[_0xb025('0x31')](_0x4e2930[_0xb025('0x2d')],qs[_0xb025('0x33')](_0x2201cb['query'][_0xb025('0x33')]));_0x555aa3['attributes']=_0x555aa3[_0xb025('0x32')][_0xb025('0x34')]?_0x555aa3['attributes']:_0x4e2930['model'];if(!_0x2201cb[_0xb025('0x2e')][_0xb025('0x35')](_0xb025('0x36'))){_0x555aa3[_0xb025('0x1b')]=qs['limit'](_0x2201cb[_0xb025('0x2e')]['limit']);_0x555aa3[_0xb025('0x19')]=qs[_0xb025('0x19')](_0x2201cb[_0xb025('0x2e')][_0xb025('0x19')]);}_0x555aa3['order']=qs[_0xb025('0x37')](_0x2201cb['query']['sort']);_0x555aa3[_0xb025('0x38')]=qs[_0xb025('0x30')](_[_0xb025('0x39')](_0x2201cb[_0xb025('0x2e')],_0x4e2930[_0xb025('0x30')]),_0x8dc14a);if(_0x2201cb[_0xb025('0x2e')][_0xb025('0x3a')]){_0x555aa3[_0xb025('0x38')]=_[_0xb025('0x3b')](_0x555aa3['where'],{'$or':_['map'](_0x8dc14a,function(_0x951edb){if(_0x951edb[_0xb025('0x3c')]!=='VIRTUAL'){var _0x32fc22={};_0x32fc22[_0x951edb[_0xb025('0x25')]]={'$like':'%'+_0x2201cb[_0xb025('0x2e')][_0xb025('0x3a')]+'%'};return _0x32fc22;}})});}_0x555aa3=_[_0xb025('0x3b')]({},_0x555aa3,_0x2201cb[_0xb025('0x3d')]);var _0xec3e46={'where':_0x555aa3['where']};return db[_0xb025('0x29')][_0xb025('0x1c')](_0xec3e46)['then'](function(_0x4a5d9a){_0x2593e1[_0xb025('0x1c')]=_0x4a5d9a;if(_0x2201cb[_0xb025('0x2e')][_0xb025('0x3e')]){_0x555aa3[_0xb025('0x3f')]=[{'all':!![]}];}return db[_0xb025('0x29')][_0xb025('0x40')](_0x555aa3);})['then'](function(_0x27f695){_0x2593e1[_0xb025('0x41')]=_0x27f695;return _0x2593e1;})['then'](respondWithFilteredResult(_0x40e280,_0x555aa3))[_0xb025('0x42')](handleError(_0x40e280,null));};exports[_0xb025('0x43')]=function(_0x2ae6e3,_0x2d02a0){var _0x3280db={'raw':!![],'where':{'id':_0x2ae6e3[_0xb025('0x44')]['id']}},_0x549884={};_0x549884[_0xb025('0x2d')]=_[_0xb025('0x2f')](db[_0xb025('0x29')][_0xb025('0x2a')]);_0x549884[_0xb025('0x2e')]=_['keys'](_0x2ae6e3[_0xb025('0x2e')]);_0x549884[_0xb025('0x30')]=_[_0xb025('0x31')](_0x549884['model'],_0x549884[_0xb025('0x2e')]);_0x3280db['attributes']=_['intersection'](_0x549884[_0xb025('0x2d')],qs['fields'](_0x2ae6e3[_0xb025('0x2e')][_0xb025('0x33')]));_0x3280db['attributes']=_0x3280db[_0xb025('0x32')][_0xb025('0x34')]?_0x3280db[_0xb025('0x32')]:_0x549884[_0xb025('0x2d')];if(_0x2ae6e3[_0xb025('0x2e')][_0xb025('0x3e')]){_0x3280db[_0xb025('0x3f')]=[{'all':!![]}];}_0x3280db=_[_0xb025('0x3b')]({},_0x3280db,_0x2ae6e3['options']);return db[_0xb025('0x29')][_0xb025('0x45')](_0x3280db)[_0xb025('0x22')](handleEntityNotFound(_0x2d02a0,null))[_0xb025('0x22')](respondWithResult(_0x2d02a0,null))[_0xb025('0x42')](handleError(_0x2d02a0,null));};exports[_0xb025('0x46')]=function(_0xddad1e,_0x2a17a3){return db[_0xb025('0x29')]['create'](_0xddad1e[_0xb025('0x47')],{})[_0xb025('0x22')](respondWithResult(_0x2a17a3,0xc9))['catch'](handleError(_0x2a17a3,null));};exports[_0xb025('0x21')]=function(_0x5c3846,_0x4fa1d4){if(_0x5c3846[_0xb025('0x47')]['id']){delete _0x5c3846['body']['id'];}return db[_0xb025('0x29')][_0xb025('0x45')]({'where':{'id':_0x5c3846[_0xb025('0x44')]['id']}})[_0xb025('0x22')](handleEntityNotFound(_0x4fa1d4,null))['then'](saveUpdates(_0x5c3846[_0xb025('0x47')],null))[_0xb025('0x22')](respondWithResult(_0x4fa1d4,null))[_0xb025('0x42')](handleError(_0x4fa1d4,null));};exports[_0xb025('0x48')]=function(_0x596e57,_0xd846aa){return db['ChatTransferReport'][_0xb025('0x45')]({'where':{'id':_0x596e57[_0xb025('0x44')]['id']}})[_0xb025('0x22')](handleEntityNotFound(_0xd846aa,null))[_0xb025('0x22')](removeEntity(_0xd846aa,null))[_0xb025('0x42')](handleError(_0xd846aa,null));};exports[_0xb025('0x49')]=function(_0x3267b8,_0x37c7a7){return db[_0xb025('0x29')][_0xb025('0x49')]()[_0xb025('0x22')](respondWithResult(_0x37c7a7,null))[_0xb025('0x42')](handleError(_0x37c7a7,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 54b26d0..7d8223c 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 _0x5a82=['util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','exports','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x56d5f8,_0x26b8f7){var _0x1afb43=function(_0x217553){while(--_0x217553){_0x56d5f8['push'](_0x56d5f8['shift']());}};_0x1afb43(++_0x26b8f7);}(_0x5a82,0x197));var _0x25a8=function(_0x434660,_0x33aa96){_0x434660=_0x434660-0x0;var _0x26f786=_0x5a82[_0x434660];return _0x26f786;};'use strict';var _=require('lodash');var util=require(_0x25a8('0x0'));var logger=require(_0x25a8('0x1'))(_0x25a8('0x2'));var moment=require(_0x25a8('0x3'));var BPromise=require(_0x25a8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x25a8('0x5'));var config=require(_0x25a8('0x6'));var attributes=require('./chatTransferReport.attributes');module[_0x25a8('0x7')]=function(_0x3cec3e,_0x25c5d4){return _0x3cec3e['define'](_0x25a8('0x8'),attributes,{'tableName':_0x25a8('0x9'),'paranoid':![],'indexes':[{'name':_0x25a8('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2180=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer'];(function(_0x109294,_0x62001){var _0x80a6fa=function(_0x2b3726){while(--_0x2b3726){_0x109294['push'](_0x109294['shift']());}};_0x80a6fa(++_0x62001);}(_0x2180,0xa9));var _0x0218=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x2180[_0x954b3a];return _0x3a313e;};'use strict';var _=require(_0x0218('0x0'));var util=require(_0x0218('0x1'));var logger=require(_0x0218('0x2'))(_0x0218('0x3'));var moment=require(_0x0218('0x4'));var BPromise=require(_0x0218('0x5'));var rp=require(_0x0218('0x6'));var fs=require('fs');var path=require(_0x0218('0x7'));var rimraf=require('rimraf');var config=require(_0x0218('0x8'));var attributes=require(_0x0218('0x9'));module[_0x0218('0xa')]=function(_0x1a51e9,_0x5604f2){return _0x1a51e9[_0x0218('0xb')]('ChatTransferReport',attributes,{'tableName':_0x0218('0xc'),'paranoid':![],'indexes':[{'name':_0x0218('0xd'),'fields':[_0x0218('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 9be0dfe..cef520b 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 _0x3622=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x41640b,_0x112967){var _0x59a6c2=function(_0xdfe556){while(--_0xdfe556){_0x41640b['push'](_0x41640b['shift']());}};_0x59a6c2(++_0x112967);}(_0x3622,0x1a5));var _0x2362=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x3622[_0xc4001c];return _0x49f7bc;};'use strict';var _=require('lodash');var util=require(_0x2362('0x0'));var moment=require(_0x2362('0x1'));var BPromise=require(_0x2362('0x2'));var rs=require(_0x2362('0x3'));var fs=require('fs');var Redis=require(_0x2362('0x4'));var db=require(_0x2362('0x5'))['db'];var utils=require(_0x2362('0x6'));var logger=require(_0x2362('0x7'))('rpc');var config=require(_0x2362('0x8'));var jayson=require(_0x2362('0x9'));var client=jayson[_0x2362('0xa')][_0x2362('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2c8aef,_0x59acc4,_0x1381bc){return new BPromise(function(_0x3b11e2,_0x4ada03){return client[_0x2362('0xc')](_0x2c8aef,_0x1381bc)[_0x2362('0xd')](function(_0x4c35d4){logger['info'](_0x2362('0xe'),_0x59acc4,_0x2362('0xf'));logger[_0x2362('0x10')](_0x2362('0x11'),_0x59acc4,'request\x20sent',JSON[_0x2362('0x12')](_0x4c35d4));if(_0x4c35d4[_0x2362('0x13')]){if(_0x4c35d4[_0x2362('0x13')]['code']===0x1f4){logger[_0x2362('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x59acc4,_0x4c35d4['error'][_0x2362('0x14')]);return _0x4ada03(_0x4c35d4['error'][_0x2362('0x14')]);}logger[_0x2362('0x13')](_0x2362('0xe'),_0x59acc4,_0x4c35d4[_0x2362('0x13')]['message']);return _0x3b11e2(_0x4c35d4[_0x2362('0x13')][_0x2362('0x14')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x59acc4,_0x2362('0xf'));_0x3b11e2(_0x4c35d4[_0x2362('0x15')][_0x2362('0x14')]);}})[_0x2362('0x16')](function(_0x3a092e){logger['error'](_0x2362('0xe'),_0x59acc4,_0x3a092e);_0x4ada03(_0x3a092e);});});} \ No newline at end of file +var _0x1bc3=['code','message','info','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x452ab2,_0x6da72b){var _0x5e9940=function(_0x45c3d4){while(--_0x45c3d4){_0x452ab2['push'](_0x452ab2['shift']());}};_0x5e9940(++_0x6da72b);}(_0x1bc3,0x144));var _0x31bc=function(_0x521f4e,_0x1114c2){_0x521f4e=_0x521f4e-0x0;var _0x407fda=_0x1bc3[_0x521f4e];return _0x407fda;};'use strict';var _=require(_0x31bc('0x0'));var util=require('util');var moment=require(_0x31bc('0x1'));var BPromise=require(_0x31bc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31bc('0x3'));var db=require(_0x31bc('0x4'))['db'];var utils=require(_0x31bc('0x5'));var logger=require(_0x31bc('0x6'))(_0x31bc('0x7'));var config=require(_0x31bc('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x31bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d0112,_0x5b54a3,_0x16db44){return new BPromise(function(_0x1a6040,_0x1c4dde){return client['request'](_0x5d0112,_0x16db44)[_0x31bc('0xa')](function(_0x282049){logger['info'](_0x31bc('0xb'),_0x5b54a3,'request\x20sent');logger[_0x31bc('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x5b54a3,_0x31bc('0xd'),JSON[_0x31bc('0xe')](_0x282049));if(_0x282049[_0x31bc('0xf')]){if(_0x282049[_0x31bc('0xf')][_0x31bc('0x10')]===0x1f4){logger[_0x31bc('0xf')](_0x31bc('0xb'),_0x5b54a3,_0x282049[_0x31bc('0xf')][_0x31bc('0x11')]);return _0x1c4dde(_0x282049['error'][_0x31bc('0x11')]);}logger[_0x31bc('0xf')](_0x31bc('0xb'),_0x5b54a3,_0x282049['error'][_0x31bc('0x11')]);return _0x1a6040(_0x282049[_0x31bc('0xf')][_0x31bc('0x11')]);}else{logger[_0x31bc('0x12')]('ChatTransferReport,\x20%s,\x20%s',_0x5b54a3,_0x31bc('0xd'));_0x1a6040(_0x282049[_0x31bc('0x13')]['message']);}})['catch'](function(_0x2d4d1d){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x5b54a3,_0x2d4d1d);_0x1c4dde(_0x2d4d1d);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 250fc82..c08bf26 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 _0x7c1f=['express','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','isAuthenticated','index','/describe','get','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x541d74,_0x4d8ac1){var _0x1bd9c4=function(_0x34ecf6){while(--_0x34ecf6){_0x541d74['push'](_0x541d74['shift']());}};_0x1bd9c4(++_0x4d8ac1);}(_0x7c1f,0x1b6));var _0xf7c1=function(_0xbdeccb,_0x1716aa){_0xbdeccb=_0xbdeccb-0x0;var _0x1e8ddf=_0x7c1f[_0xbdeccb];return _0x1e8ddf;};'use strict';var multer=require(_0xf7c1('0x0'));var util=require(_0xf7c1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf7c1('0x2'));var router=express['Router']();var fs_extra=require(_0xf7c1('0x3'));var auth=require(_0xf7c1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf7c1('0x5'));var controller=require(_0xf7c1('0x6'));router['get']('/',auth[_0xf7c1('0x7')](),controller[_0xf7c1('0x8')]);router['get'](_0xf7c1('0x9'),auth[_0xf7c1('0x7')](),controller['describe']);router[_0xf7c1('0xa')](_0xf7c1('0xb'),auth[_0xf7c1('0x7')](),controller[_0xf7c1('0xc')]);router[_0xf7c1('0xd')]('/',auth[_0xf7c1('0x7')](),controller[_0xf7c1('0xe')]);router[_0xf7c1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf7c1('0x10')]);router[_0xf7c1('0x11')](_0xf7c1('0xb'),auth[_0xf7c1('0x7')](),controller[_0xf7c1('0x12')]);module[_0xf7c1('0x13')]=router; \ No newline at end of file +var _0x9748=['express','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','/describe','describe','/:id','show','isAuthenticated','put','update','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9748,0x1d1));var _0x8974=function(_0x5d2c0e,_0x864cca){_0x5d2c0e=_0x5d2c0e-0x0;var _0x3ac730=_0x9748[_0x5d2c0e];return _0x3ac730;};'use strict';var multer=require(_0x8974('0x0'));var util=require('util');var path=require(_0x8974('0x1'));var timeout=require(_0x8974('0x2'));var express=require(_0x8974('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x8974('0x4'));var interaction=require(_0x8974('0x5'));var config=require('../../config/environment');var controller=require(_0x8974('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x8974('0x7')](_0x8974('0x8'),auth['isAuthenticated'](),controller[_0x8974('0x9')]);router[_0x8974('0x7')](_0x8974('0xa'),auth['isAuthenticated'](),controller[_0x8974('0xb')]);router['post']('/',auth[_0x8974('0xc')](),controller['create']);router[_0x8974('0xd')](_0x8974('0xa'),auth[_0x8974('0xc')](),controller[_0x8974('0xe')]);router[_0x8974('0xf')](_0x8974('0xa'),auth[_0x8974('0xc')](),controller[_0x8974('0x10')]);module[_0x8974('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 6a03917..4b518dd 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 _0xe76d=['textarea','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','CHAT','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','input','name','parse','getDataValue','setDataValue','onlineForm','stringify'];(function(_0x5b959e,_0x2f221a){var _0x4c3e9c=function(_0xb799f1){while(--_0xb799f1){_0x5b959e['push'](_0x5b959e['shift']());}};_0x4c3e9c(++_0x2f221a);}(_0xe76d,0x13a));var _0xde76=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xe76d[_0x122096];return _0x3d1966;};'use strict';var Sequelize=require(_0xde76('0x0'));var rs=require(_0xde76('0x1'));module[_0xde76('0x2')]={'name':{'type':Sequelize[_0xde76('0x3')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xde76('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x5')},'mapKeyOffline':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x5')},'key':{'type':Sequelize[_0xde76('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x6')},'customerAlias':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':_0xde76('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':_0xde76('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xde76('0x3')]},'animation':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xde76('0xa')](_0xde76('0xb'),_0xde76('0xc')),'defaultValue':'rounded'},'header_online':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xd')},'start_chat_button':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xe')},'offline_chat_button':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xf')},'header_offline':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x10')},'download_transcript':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xde76('0x11')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x12')},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xde76('0x13')]},'closingQuestion':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x14')},'formSubmitSuccessMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x15')},'formSubmitFailureMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x16')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x17')},'placeholderMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0x18')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xde76('0xf')},'skipMessageButton':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x19')},'conditionAgreement':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x1a')},'ratingType':{'type':Sequelize[_0xde76('0xa')](_0xde76('0x1b'),_0xde76('0x1c')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xde76('0x11')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xde76('0x13')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xde76('0x1d'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xde76('0x1e'),'helpText':''}},{'type':_0xde76('0x1d'),'props':{'title':_0xde76('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xde76('0x5'),'type':_0xde76('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xde76('0x1f')](this[_0xde76('0x20')]('onlineForm')):{};},'set':function(_0x58540b){return this[_0xde76('0x21')](_0xde76('0x22'),JSON[_0xde76('0x23')](_0x58540b));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xde76('0x23')]({'items':[{'type':_0xde76('0x1d'),'props':{'title':_0xde76('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0xde76('0x5'),'type':_0xde76('0x5')},'variable':null},{'type':_0xde76('0x24'),'config':{'placeholder':_0xde76('0x25')},'props':{'title':_0xde76('0x25'),'helpText':_0xde76('0x26')}}],'fromKey':0x0});},'get':function(){return this[_0xde76('0x20')](_0xde76('0x27'))?JSON[_0xde76('0x1f')](this[_0xde76('0x20')](_0xde76('0x27'))):{};},'set':function(_0x544029){return this[_0xde76('0x21')](_0xde76('0x27'),JSON['stringify'](_0x544029));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xde76('0x28')]();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xde76('0x3')]},'forwardOffline':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xde76('0x3')]},'waitingTitle':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x29')},'waitingMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2a')},'offlineMessageSubject':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2b')},'offlineMessageBody':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2c')},'enableUnmanagedNote':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x19')},'sendUnmanaged':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xde76('0x3')]},'notificationTemplate':{'type':Sequelize[_0xde76('0x13')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xde76('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2d')},'messagesAlignment':{'type':Sequelize[_0xde76('0x3')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':'#fafafa','validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xde76('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xde76('0x3')],'defaultValue':_0xde76('0x2e')},'systemAvatar':{'type':Sequelize[_0xde76('0x13')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xde76('0x11')],'comment':_0xde76('0x2f')},'mandatoryDisposition':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x105651){if(!_0x105651)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xde76('0x21')](_0xde76('0x30'),_0x105651);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xde76('0x3')]},'vidaooTopic':{'type':Sequelize[_0xde76('0x3')],'allowNull':![],'defaultValue':_0xde76('0x31')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xde76('0x13')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xde76('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x447f=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','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','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','text','name','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.'];(function(_0x754f0,_0x4b0d70){var _0x486710=function(_0x24105c){while(--_0x24105c){_0x754f0['push'](_0x754f0['shift']());}};_0x486710(++_0x4b0d70);}(_0x447f,0x156));var _0xf447=function(_0x546c3b,_0x248e63){_0x546c3b=_0x546c3b-0x0;var _0x7b2f47=_0x447f[_0x546c3b];return _0x7b2f47;};'use strict';var Sequelize=require(_0xf447('0x0'));var rs=require(_0xf447('0x1'));module[_0xf447('0x2')]={'name':{'type':Sequelize[_0xf447('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'unique':_0xf447('0x4')},'description':{'type':Sequelize[_0xf447('0x3')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x5')},'mapKeyOffline':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x5')},'key':{'type':Sequelize[_0xf447('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x6')},'customerAlias':{'type':Sequelize[_0xf447('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':_0xf447('0x7'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':_0xf447('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf447('0x3')]},'animation':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf447('0xb')](_0xf447('0xc'),_0xf447('0xd')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0xe')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0xf')},'header_offline':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x10')},'download_transcript':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xf447('0x11')]},'closingQuestion':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x12')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x13')},'formSubmitFailureMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x14')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x15')},'placeholderMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x16')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0xf')},'skipMessageButton':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x17')},'conditionAgreement':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x18')},'ratingType':{'type':Sequelize[_0xf447('0xb')](_0xf447('0x19'),_0xf447('0x1a')),'defaultValue':_0xf447('0x19')},'ratingStarsNumber':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf447('0x1b')]({'items':[{'type':_0xf447('0x1c'),'variable':null,'config':{'placeholder':'name','type':_0xf447('0x1d'),'required':!![]},'props':{'title':_0xf447('0x1e'),'helpText':''}},{'type':_0xf447('0x1c'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf447('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf447('0x1f')](_0xf447('0x20'))?JSON[_0xf447('0x21')](this[_0xf447('0x1f')](_0xf447('0x20'))):{};},'set':function(_0x3edcde){return this['setDataValue'](_0xf447('0x20'),JSON[_0xf447('0x1b')](_0x3edcde));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf447('0x1c'),'props':{'title':_0xf447('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf447('0x5')},'variable':null},{'type':'textarea','config':{'placeholder':'Comments'},'props':{'title':_0xf447('0x22'),'helpText':_0xf447('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xf447('0x24'))?JSON[_0xf447('0x21')](this[_0xf447('0x1f')](_0xf447('0x24'))):{};},'set':function(_0x58af63){return this['setDataValue'](_0xf447('0x24'),JSON[_0xf447('0x1b')](_0x58af63));}},'token':{'type':Sequelize[_0xf447('0x3')],'defaultValue':function(){return rs[_0xf447('0x25')]();}},'autoclose':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf447('0x3')]},'forwardOffline':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf447('0x3')]},'waitingTitle':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x26')},'waitingMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x27')},'offlineMessageSubject':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x28')},'offlineMessageBody':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x29')},'enableUnmanagedNote':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x2a')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0xf')},'enableCustomerAttachment':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf447('0x11')],'defaultValue':function(){return _0xf447('0x2b');}},'notificationSound':{'type':Sequelize[_0xf447('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf447('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf447('0x3')],'defaultValue':'bottom_right'},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x2d')},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0xf447('0x2e')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0xf447('0x11')]},'showCustomerAvatar':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf447('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':_0xf447('0x2f'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf447('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf447('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf447('0x3')],'defaultValue':_0xf447('0x30')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf447('0x9')],'comment':_0xf447('0x31')},'mandatoryDisposition':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![],'comment':_0xf447('0x32'),'set':function(_0xa0a312){if(!_0xa0a312)this['setDataValue'](_0xf447('0x33'),null);this[_0xf447('0x34')](_0xf447('0x35'),_0xa0a312);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf447('0x3')]},'vidaooTopic':{'type':Sequelize[_0xf447('0x3')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0xf447('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf447('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf447('0x11')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 3652936..20ab415 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 _0x44e8=['includeAll','include','rows','rawAttributes','length','find','body','trim','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','testWildcardValidity','params','describe','ChatWebsiteId','getDispositions','findOne','Disposition','order','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','customerAvatar','addSystemAvatar','join','root','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','Interval','timezone','ifTime','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','ChatApplication','Applications','Intervals','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','orderBy','priority','asc','list','List','Contacts','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','interaction','firstName','messageId','autoclose','push','close','ChatMessage','UserId','User','*,*,*,*','forcedOwnership','queueId','ChatQueue','unshift','queue','Start','startRouting','EventManager','notify','Sequelize','difference','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','openNewInteraction','sequelize','Attachment','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','offlineMessageSubject','MailAccountId','subjectOffline','Chat','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','tag','getSnippet','interval','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','origin','testWebsiteWithWildcard','address','remote','x-forwarded-for','x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','color','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','ejs','fs-extra','lodash','querystring','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APIOutOfIntervalError','handleError','APIConflictError','url','URL','../../mysqldb','redis','defaults','localhost','./chatWebsite.socket','client','http','then','info','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','update','ChatWebsites','destroy','end','stack','name','send','user-agent-parser','setUA','user-agent','getResult','customerIp','cf-connecting-ip','first','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','model','device','vendor','%s\x20%s\x20%s','type','index','Pause','mandatoryDispositionPause','map','ChatWebsite','fieldName','key','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options'];(function(_0x8cc7c,_0x591379){var _0x404b40=function(_0x3d1de1){while(--_0x3d1de1){_0x8cc7c['push'](_0x8cc7c['shift']());}};_0x404b40(++_0x591379);}(_0x44e8,0xd7));var _0x844e=function(_0x57ebbb,_0x4e6823){_0x57ebbb=_0x57ebbb-0x0;var _0x4f9f78=_0x44e8[_0x57ebbb];return _0x4f9f78;};'use strict';var Mustache=require(_0x844e('0x0'));var util=require('util');var path=require('path');var ejs=require(_0x844e('0x1'));var fs=require('fs');var fs_extra=require(_0x844e('0x2'));var _=require(_0x844e('0x3'));var querystring=require(_0x844e('0x4'));var htmlToText=require('html-to-text');var Redis=require(_0x844e('0x5'));var jayson=require(_0x844e('0x6'));var qs=require(_0x844e('0x7'));var logger=require(_0x844e('0x8'))('api');var config=require(_0x844e('0x9'));var APIBadRequestError=require(_0x844e('0xa'))[_0x844e('0xb')];var APINotFoundError=require(_0x844e('0xa'))['APINotFoundError'];var APIOutOfIntervalError=require(_0x844e('0xa'))[_0x844e('0xc')];var APIHandleError=require(_0x844e('0xa'))[_0x844e('0xd')];var APIConflictError=require(_0x844e('0xa'))[_0x844e('0xe')];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require(_0x844e('0xf'))[_0x844e('0x10')];var db=require(_0x844e('0x11'))['db'];config[_0x844e('0x12')]=_[_0x844e('0x13')](config[_0x844e('0x12')],{'host':_0x844e('0x14'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x844e('0x12')]));require(_0x844e('0x15'))['register'](socket);var client=jayson[_0x844e('0x16')][_0x844e('0x17')]({'port':0x232c});var client9002=jayson['client'][_0x844e('0x17')]({'port':0x232a});var client9003=jayson[_0x844e('0x16')][_0x844e('0x17')]({'port':0x232b});var client9001=jayson['client'][_0x844e('0x17')]({'port':0x2329});function respondWithRpcPromise(_0x465e49,_0x380eb4,_0x935134,_0x2588a3){return new Promise(function(_0x353be9,_0x2227c6){var _0x5506ef=_0x2588a3||client;return _0x5506ef['request'](_0x465e49,_0x935134)[_0x844e('0x18')](function(_0x56791b){logger[_0x844e('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x380eb4,_0x844e('0x1a'));logger['debug'](_0x844e('0x1b'),_0x380eb4,_0x844e('0x1a'),JSON[_0x844e('0x1c')](_0x56791b));if(_0x56791b[_0x844e('0x1d')]){if(_0x56791b[_0x844e('0x1d')][_0x844e('0x1e')]===0x1f4){logger[_0x844e('0x1d')](_0x844e('0x1f'),_0x380eb4,_0x56791b['error'][_0x844e('0x20')]);return _0x2227c6(_0x56791b['error']['message']);}logger[_0x844e('0x1d')](_0x844e('0x1f'),_0x380eb4,_0x56791b[_0x844e('0x1d')][_0x844e('0x20')]);return _0x353be9(_0x56791b['error'][_0x844e('0x20')]);}else{logger[_0x844e('0x19')]('ChatWebsite,\x20%s,\x20%s',_0x380eb4,_0x844e('0x1a'));_0x353be9(_0x56791b[_0x844e('0x21')][_0x844e('0x20')]);}})[_0x844e('0x22')](function(_0x35236b){logger[_0x844e('0x1d')]('ChatWebsite,\x20%s,\x20%s',_0x380eb4,_0x35236b);_0x2227c6(_0x35236b);});});}function respondWithStatusCode(_0x399a81,_0xadf0d8){_0xadf0d8=_0xadf0d8||0xcc;return function(_0x11859a){if(_0x11859a){return _0x399a81[_0x844e('0x23')](_0xadf0d8);}return _0x399a81[_0x844e('0x24')](_0xadf0d8)['end']();};}function respondWithResult(_0x3725b2,_0x5080c1){_0x5080c1=_0x5080c1||0xc8;return function(_0x57b2ef){if(_0x57b2ef){return _0x3725b2[_0x844e('0x24')](_0x5080c1)[_0x844e('0x25')](_0x57b2ef);}};}function respondWithFilteredResult(_0x355456,_0x587613){return function(_0x489349){if(_0x489349){var _0x2d4acd=typeof _0x587613[_0x844e('0x26')]==='undefined'&&typeof _0x587613[_0x844e('0x27')]===_0x844e('0x28');var _0x2f1697=_0x489349[_0x844e('0x29')];var _0x454b68=_0x2d4acd?0x0:_0x587613[_0x844e('0x26')];var _0x30d0a2=_0x2d4acd?_0x489349[_0x844e('0x29')]:_0x587613[_0x844e('0x26')]+_0x587613[_0x844e('0x27')];var _0x550240;if(_0x30d0a2>=_0x2f1697){_0x30d0a2=_0x2f1697;_0x550240=0xc8;}else{_0x550240=0xce;}_0x355456[_0x844e('0x24')](_0x550240);return _0x355456[_0x844e('0x2a')](_0x844e('0x2b'),_0x454b68+'-'+_0x30d0a2+'/'+_0x2f1697)[_0x844e('0x25')](_0x489349);}return null;};}function saveUpdates(_0x43ae36){return function(_0x31754e){if(_0x31754e){return _0x31754e[_0x844e('0x2c')](_0x43ae36)['then'](function(_0x26d6f2){return _0x26d6f2;});}return null;};}function removeEntity(_0x34ea8b){return function(_0x294dea){if(_0x294dea){return _0x294dea['destroy']()[_0x844e('0x18')](function(){var _0x1592fb=_0x294dea['get']({'plain':!![]});var _0x1fdba9=_0x844e('0x2d');return db['UserProfileResource'][_0x844e('0x2e')]({'where':{'type':_0x1fdba9,'resourceId':_0x1592fb['id']}})[_0x844e('0x18')](function(){return _0x294dea;});})[_0x844e('0x18')](function(){_0x34ea8b[_0x844e('0x24')](0xcc)[_0x844e('0x2f')]();});}};}function handleEntityNotFound(_0x3aa8ba){return function(_0xd61d0c){if(!_0xd61d0c){_0x3aa8ba['sendStatus'](0x194);}return _0xd61d0c;};}function handleError(_0x31d896,_0x387723){_0x387723=_0x387723||0x1f4;return function(_0x29637e){logger[_0x844e('0x1d')](_0x29637e[_0x844e('0x30')]);if(_0x29637e[_0x844e('0x31')]){delete _0x29637e[_0x844e('0x31')];}_0x31d896[_0x844e('0x24')](_0x387723)[_0x844e('0x32')](_0x29637e);};}function createInteractionObject(_0x4155ad,_0x13614e,_0x5d9544,_0x5701d5){var _0x3ad6d5=require(_0x844e('0x33'));var _0xe3d034=new _0x3ad6d5();var _0xc1c669=_0xe3d034[_0x844e('0x34')](_0x5d9544[_0x844e('0x35')])[_0x844e('0x36')]();var _0x23032f=_0x13614e[_0x844e('0x37')];if(_0x5d9544['cf-connecting-ip']){_0x23032f=_0x5d9544[_0x844e('0x38')];}else if(_0x5d9544['x-forwarded-for']){_0x23032f=_[_0x844e('0x39')](_0x5d9544['x-forwarded-for'][_0x844e('0x3a')](','));}return{'ContactId':_0x5701d5['id'],'ChatWebsiteId':_0x4155ad,'from':(_0x5701d5['firstName']||'')+'\x20'+(_0x5701d5[_0x844e('0x3b')]||''),'customerIp':_0x23032f,'customerPort':_0x5d9544[_0x844e('0x3c')]?_0x5d9544[_0x844e('0x3c')]:null,'referer':_0x13614e[_0x844e('0x3d')],'browserName':_0xc1c669[_0x844e('0x3e')][_0x844e('0x31')]&&_0xc1c669[_0x844e('0x3e')][_0x844e('0x3f')]?util[_0x844e('0x40')](_0x844e('0x41'),_0xc1c669[_0x844e('0x3e')]['name'],_0xc1c669[_0x844e('0x3e')][_0x844e('0x3f')]):_0x844e('0x42'),'browserVersion':_0xc1c669['browser']['version']||_0x844e('0x42'),'osName':util[_0x844e('0x40')](_0x844e('0x41'),_0xc1c669['os']['name'],_0xc1c669['os']['version']),'osVersion':_0xc1c669['os']['version'],'deviceModel':_0xc1c669['device'][_0x844e('0x43')]&&_0xc1c669[_0x844e('0x44')][_0x844e('0x45')]?util[_0x844e('0x40')](_0x844e('0x46'),_0xc1c669['device'][_0x844e('0x43')],_0xc1c669['device']['vendor'],_0xc1c669[_0x844e('0x44')][_0x844e('0x47')]):null,'deviceVendor':_0xc1c669[_0x844e('0x44')][_0x844e('0x45')],'deviceType':_0xc1c669['device'][_0x844e('0x47')],'formData':JSON[_0x844e('0x1c')](_0x13614e)};}exports[_0x844e('0x48')]=function(_0x5ee193,_0x36ef59){var _0x1bcbda={'include':[{'model':db[_0x844e('0x49')],'as':_0x844e('0x4a')}]},_0x558f21={},_0x3c6502={'count':0x0,'rows':[]};var _0x443c7a=_[_0x844e('0x4b')](db[_0x844e('0x4c')]['rawAttributes'],function(_0x200932){return{'name':_0x200932[_0x844e('0x4d')],'type':_0x200932[_0x844e('0x47')][_0x844e('0x4e')]};});_0x558f21[_0x844e('0x43')]=_[_0x844e('0x4b')](_0x443c7a,_0x844e('0x31'));_0x558f21[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x5ee193[_0x844e('0x4f')]);_0x558f21['filters']=_[_0x844e('0x51')](_0x558f21[_0x844e('0x43')],_0x558f21[_0x844e('0x4f')]);_0x1bcbda['attributes']=_[_0x844e('0x51')](_0x558f21[_0x844e('0x43')],qs[_0x844e('0x52')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x52')]));_0x1bcbda[_0x844e('0x53')]=_0x1bcbda[_0x844e('0x53')]['length']?_0x1bcbda[_0x844e('0x53')]:_0x558f21[_0x844e('0x43')];if(!_0x5ee193[_0x844e('0x4f')][_0x844e('0x54')](_0x844e('0x55'))){_0x1bcbda[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x27')]);_0x1bcbda[_0x844e('0x26')]=qs[_0x844e('0x26')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x26')]);}_0x1bcbda['order']=qs[_0x844e('0x56')](_0x5ee193[_0x844e('0x4f')][_0x844e('0x56')]);_0x1bcbda[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x5ee193['query'],_0x558f21[_0x844e('0x58')]),_0x443c7a);if(_0x5ee193[_0x844e('0x4f')]['filter']){_0x1bcbda[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x1bcbda[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x443c7a,function(_0x26eec5){if(_0x26eec5[_0x844e('0x47')]!==_0x844e('0x5b')){var _0x10e5ac={};_0x10e5ac[_0x26eec5[_0x844e('0x31')]]={'$like':'%'+_0x5ee193[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x10e5ac;}})});}_0x1bcbda=_[_0x844e('0x5a')]({},_0x1bcbda,_0x5ee193[_0x844e('0x5d')]);var _0x3de2c0={'where':_0x1bcbda['where']};return db[_0x844e('0x4c')][_0x844e('0x29')](_0x3de2c0)['then'](function(_0x1aa783){_0x3c6502['count']=_0x1aa783;if(_0x5ee193[_0x844e('0x4f')][_0x844e('0x5e')]){_0x1bcbda[_0x844e('0x5f')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x1bcbda);})[_0x844e('0x18')](function(_0x4f7e9b){_0x3c6502[_0x844e('0x60')]=_0x4f7e9b;return _0x3c6502;})[_0x844e('0x18')](respondWithFilteredResult(_0x36ef59,_0x1bcbda))[_0x844e('0x22')](handleError(_0x36ef59,null));};exports['show']=function(_0x13ebe8,_0x3d66e4){var _0x4656ab={'raw':![],'where':{'id':_0x13ebe8['params']['id']},'include':[{'model':db[_0x844e('0x49')],'as':_0x844e('0x4a')}]},_0x192457={};_0x192457[_0x844e('0x43')]=_['keys'](db['ChatWebsite'][_0x844e('0x61')]);_0x192457[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x13ebe8['query']);_0x192457['filters']=_[_0x844e('0x51')](_0x192457[_0x844e('0x43')],_0x192457[_0x844e('0x4f')]);_0x4656ab['attributes']=_[_0x844e('0x51')](_0x192457[_0x844e('0x43')],qs[_0x844e('0x52')](_0x13ebe8['query'][_0x844e('0x52')]));_0x4656ab[_0x844e('0x53')]=_0x4656ab[_0x844e('0x53')][_0x844e('0x62')]?_0x4656ab['attributes']:_0x192457[_0x844e('0x43')];if(_0x13ebe8[_0x844e('0x4f')][_0x844e('0x5e')]){_0x4656ab[_0x844e('0x5f')]=[{'all':!![]}];}_0x4656ab=_[_0x844e('0x5a')]({},_0x4656ab,_0x13ebe8[_0x844e('0x5d')]);return db[_0x844e('0x4c')][_0x844e('0x63')](_0x4656ab)['then'](handleEntityNotFound(_0x3d66e4,null))['then'](respondWithResult(_0x3d66e4,null))[_0x844e('0x22')](handleError(_0x3d66e4,null));};exports['create']=function(_0x252ff9,_0x3bde32){var _0x3753cd=null;_0x252ff9[_0x844e('0x64')]['address']['split'](',')['forEach'](_0x4e4ece=>{if(_0x4e4ece['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x4e4ece[_0x844e('0x65')]())){_0x3753cd=new APIBadRequestError('\x22'+_0x4e4ece[_0x844e('0x65')]()+_0x844e('0x66'));}});if(_0x3753cd){return handleError(_0x3bde32,null)(_0x3753cd);}return db['ChatWebsite'][_0x844e('0x67')](_0x252ff9[_0x844e('0x64')],{})['then'](function(_0x19af4e){var _0x5ec1e9=_0x252ff9[_0x844e('0x68')][_0x844e('0x69')]({'plain':!![]});if(!_0x5ec1e9)throw new Error(_0x844e('0x6a'));if(_0x5ec1e9[_0x844e('0x6b')]==='user'){var _0x5554e2=_0x19af4e['get']({'plain':!![]});var _0x314586=_0x844e('0x2d');return db[_0x844e('0x6c')][_0x844e('0x63')]({'where':{'name':_0x314586,'userProfileId':_0x5ec1e9[_0x844e('0x6d')]},'raw':!![]})['then'](function(_0x566718){if(_0x566718&&_0x566718[_0x844e('0x6e')]===0x0){return db[_0x844e('0x6f')][_0x844e('0x67')]({'name':_0x5554e2[_0x844e('0x31')],'resourceId':_0x5554e2['id'],'type':_0x566718[_0x844e('0x31')],'sectionId':_0x566718['id']},{})[_0x844e('0x18')](function(){return _0x19af4e;});}else{return _0x19af4e;}})['catch'](function(_0x97d37c){logger[_0x844e('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x97d37c);throw _0x97d37c;});}return _0x19af4e;})[_0x844e('0x18')](respondWithResult(_0x3bde32,0xc9))[_0x844e('0x22')](handleError(_0x3bde32,null));};exports['update']=function(_0x5839e3,_0x240572){var _0x20cac2=null;_0x5839e3[_0x844e('0x64')]['address']['split'](',')['forEach'](_0x452073=>{if(_0x452073['trim']()!==''&&!wildcardUtils[_0x844e('0x70')](_0x452073[_0x844e('0x65')]())){_0x20cac2=new APIBadRequestError('\x22'+_0x452073[_0x844e('0x65')]()+_0x844e('0x66'));}});if(_0x20cac2){return handleError(_0x240572,null)(_0x20cac2);}if(_0x5839e3[_0x844e('0x64')]['id']){delete _0x5839e3[_0x844e('0x64')]['id'];}return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x5839e3[_0x844e('0x71')]['id']},'include':[{'model':db['Pause'],'as':_0x844e('0x4a')}]})[_0x844e('0x18')](handleEntityNotFound(_0x240572,null))[_0x844e('0x18')](saveUpdates(_0x5839e3[_0x844e('0x64')],null))[_0x844e('0x18')](respondWithResult(_0x240572,null))['catch'](handleError(_0x240572,null));};exports['destroy']=function(_0x304e7b,_0x14b226){return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x304e7b[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x14b226,null))[_0x844e('0x18')](removeEntity(_0x14b226,null))['catch'](handleError(_0x14b226,null));};exports[_0x844e('0x72')]=function(_0x7c1b20,_0x484833){return db[_0x844e('0x4c')][_0x844e('0x72')]()[_0x844e('0x18')](respondWithResult(_0x484833,null))['catch'](handleError(_0x484833,null));};exports['addDisposition']=function(_0x2123e4,_0x277087){if(_0x2123e4['body']['id']){delete _0x2123e4[_0x844e('0x64')]['id'];}return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x2123e4[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x277087,null))[_0x844e('0x18')](function(_0x35d7f3){if(_0x35d7f3){_0x2123e4['body'][_0x844e('0x73')]=_0x35d7f3['id'];return db['Disposition'][_0x844e('0x67')](_0x2123e4['body']);}})[_0x844e('0x18')](respondWithResult(_0x277087,null))['catch'](handleError(_0x277087,null));};exports[_0x844e('0x74')]=function(_0x23c91b,_0x52b49a){var _0x37748e={'raw':![],'where':{}};var _0x3faf7d={};var _0xaae76d={'count':0x0,'rows':[]};return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x23c91b['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x52b49a,null))[_0x844e('0x18')](function(_0x2a87e6){if(_0x2a87e6){_0x3faf7d[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0x76')][_0x844e('0x61')]);_0x3faf7d[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x23c91b[_0x844e('0x4f')]);_0x3faf7d['filters']=_[_0x844e('0x51')](_0x3faf7d[_0x844e('0x43')],_0x3faf7d[_0x844e('0x4f')]);_0x37748e[_0x844e('0x53')]=_[_0x844e('0x51')](_0x3faf7d[_0x844e('0x43')],qs[_0x844e('0x52')](_0x23c91b[_0x844e('0x4f')][_0x844e('0x52')]));_0x37748e[_0x844e('0x53')]=_0x37748e[_0x844e('0x53')][_0x844e('0x62')]?_0x37748e[_0x844e('0x53')]:_0x3faf7d[_0x844e('0x43')];if(!_0x23c91b[_0x844e('0x4f')]['hasOwnProperty'](_0x844e('0x55'))){_0x37748e['limit']=qs[_0x844e('0x27')](_0x23c91b[_0x844e('0x4f')][_0x844e('0x27')]);_0x37748e[_0x844e('0x26')]=qs[_0x844e('0x26')](_0x23c91b['query'][_0x844e('0x26')]);}_0x37748e[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x23c91b['query']['sort']);_0x37748e[_0x844e('0x57')]=qs[_0x844e('0x58')](_['pick'](_0x23c91b[_0x844e('0x4f')],_0x3faf7d[_0x844e('0x58')]));_0x37748e[_0x844e('0x57')][_0x844e('0x73')]=_0x2a87e6['id'];if(_0x23c91b[_0x844e('0x4f')][_0x844e('0x5c')]){_0x37748e[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x37748e[_0x844e('0x57')],{'$or':_['map'](_0x37748e[_0x844e('0x53')],function(_0x47d5e9){var _0x3c8f7b={};_0x3c8f7b[_0x47d5e9]={'$like':'%'+_0x23c91b[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x3c8f7b;})});}_0x37748e=_[_0x844e('0x5a')]({},_0x37748e,_0x23c91b[_0x844e('0x5d')]);return db['Disposition'][_0x844e('0x29')]({'where':_0x37748e[_0x844e('0x57')]})['then'](function(_0x1c1f04){_0xaae76d[_0x844e('0x29')]=_0x1c1f04;if(_0x23c91b[_0x844e('0x4f')][_0x844e('0x5e')]){_0x37748e[_0x844e('0x5f')]=[{'all':!![]}];}return db['Disposition'][_0x844e('0x78')](_0x37748e);})[_0x844e('0x18')](function(_0x510811){_0xaae76d['rows']=_0x510811;return _0xaae76d;});}})['then'](respondWithFilteredResult(_0x52b49a,_0x37748e))[_0x844e('0x22')](handleError(_0x52b49a,null));};exports[_0x844e('0x79')]=function(_0x569d9b,_0x24733b){return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x569d9b[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x24733b,null))['then'](function(_0x537ace){if(_0x537ace){return _0x537ace['removeDispositions'](_0x569d9b[_0x844e('0x4f')][_0x844e('0x7a')]);}})[_0x844e('0x18')](respondWithStatusCode(_0x24733b,null))[_0x844e('0x22')](handleError(_0x24733b,null));};exports['addAnswer']=function(_0x5d01e2,_0x475295){if(_0x5d01e2[_0x844e('0x64')]['id']){delete _0x5d01e2[_0x844e('0x64')]['id'];}return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x5d01e2['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x475295,null))[_0x844e('0x18')](function(_0x5c807b){if(_0x5c807b){_0x5d01e2[_0x844e('0x64')]['ChatWebsiteId']=_0x5c807b['id'];return db[_0x844e('0x7b')][_0x844e('0x67')](_0x5d01e2[_0x844e('0x64')]);}})[_0x844e('0x18')](respondWithResult(_0x475295,null))[_0x844e('0x22')](handleError(_0x475295,null));};exports[_0x844e('0x7c')]=function(_0x2029fc,_0x7ca8d1){var _0x5abd61={'raw':![],'where':{}};var _0xad6ae6={};var _0x406886={'count':0x0,'rows':[]};return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x2029fc[_0x844e('0x71')]['id']}})['then'](handleEntityNotFound(_0x7ca8d1,null))[_0x844e('0x18')](function(_0x44d08f){if(_0x44d08f){_0xad6ae6[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0x7b')][_0x844e('0x61')]);_0xad6ae6[_0x844e('0x4f')]=_['keys'](_0x2029fc['query']);_0xad6ae6[_0x844e('0x58')]=_[_0x844e('0x51')](_0xad6ae6[_0x844e('0x43')],_0xad6ae6['query']);_0x5abd61[_0x844e('0x53')]=_[_0x844e('0x51')](_0xad6ae6[_0x844e('0x43')],qs[_0x844e('0x52')](_0x2029fc['query'][_0x844e('0x52')]));_0x5abd61[_0x844e('0x53')]=_0x5abd61[_0x844e('0x53')]['length']?_0x5abd61[_0x844e('0x53')]:_0xad6ae6[_0x844e('0x43')];if(!_0x2029fc['query'][_0x844e('0x54')](_0x844e('0x55'))){_0x5abd61[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x2029fc[_0x844e('0x4f')][_0x844e('0x27')]);_0x5abd61['offset']=qs[_0x844e('0x26')](_0x2029fc[_0x844e('0x4f')][_0x844e('0x26')]);}_0x5abd61[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x2029fc[_0x844e('0x4f')]['sort']);_0x5abd61[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x2029fc[_0x844e('0x4f')],_0xad6ae6[_0x844e('0x58')]));_0x5abd61[_0x844e('0x57')][_0x844e('0x73')]=_0x44d08f['id'];if(_0x2029fc['query']['filter']){_0x5abd61['where']=_[_0x844e('0x5a')](_0x5abd61[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x5abd61[_0x844e('0x53')],function(_0x3205d8){var _0x1072f5={};_0x1072f5[_0x3205d8]={'$like':'%'+_0x2029fc[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x1072f5;})});}_0x5abd61=_[_0x844e('0x5a')]({},_0x5abd61,_0x2029fc['options']);return db['CannedAnswer'][_0x844e('0x29')]({'where':_0x5abd61['where']})[_0x844e('0x18')](function(_0x4a8ce1){_0x406886[_0x844e('0x29')]=_0x4a8ce1;if(_0x2029fc[_0x844e('0x4f')][_0x844e('0x5e')]){_0x5abd61[_0x844e('0x5f')]=[{'all':!![]}];}return db[_0x844e('0x7b')][_0x844e('0x78')](_0x5abd61);})['then'](function(_0x4ae58a){_0x406886['rows']=_0x4ae58a;return _0x406886;});}})[_0x844e('0x18')](respondWithFilteredResult(_0x7ca8d1,_0x5abd61))[_0x844e('0x22')](handleError(_0x7ca8d1,null));};exports[_0x844e('0x7d')]=function(_0x3bd5a8,_0x50890f){return db['ChatWebsite']['find']({'where':{'id':_0x3bd5a8[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x50890f,null))[_0x844e('0x18')](function(_0x34776d){if(_0x34776d){return _0x34776d[_0x844e('0x7d')](_0x3bd5a8[_0x844e('0x4f')][_0x844e('0x7a')]);}})['then'](respondWithStatusCode(_0x50890f,null))[_0x844e('0x22')](handleError(_0x50890f,null));};exports[_0x844e('0x7e')]=function(_0x85d5d6,_0x4dacb6){_0x85d5d6[_0x844e('0x64')][_0x844e('0x7f')]=_0x85d5d6[_0x844e('0x80')]['filename'];return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x85d5d6['params']['id']}})['then'](handleEntityNotFound(_0x4dacb6,null))[_0x844e('0x18')](saveUpdates(_0x85d5d6[_0x844e('0x64')],null))['then'](respondWithResult(_0x4dacb6,null))[_0x844e('0x22')](handleError(_0x4dacb6,null));};exports[_0x844e('0x81')]=function(_0x25f26e,_0x5055c5){_0x25f26e[_0x844e('0x64')][_0x844e('0x82')]=_0x25f26e[_0x844e('0x80')][_0x844e('0x83')];return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x25f26e[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x5055c5,null))[_0x844e('0x18')](saveUpdates(_0x25f26e['body'],null))[_0x844e('0x18')](respondWithResult(_0x5055c5,null))[_0x844e('0x22')](handleError(_0x5055c5,null));};exports['addCustomerAvatar']=function(_0x53d2fd,_0x35f43b){_0x53d2fd[_0x844e('0x64')][_0x844e('0x84')]=_0x53d2fd['file'][_0x844e('0x83')];return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x53d2fd['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x35f43b,null))[_0x844e('0x18')](saveUpdates(_0x53d2fd['body'],null))[_0x844e('0x18')](respondWithResult(_0x35f43b,null))[_0x844e('0x22')](handleError(_0x35f43b,null));};exports[_0x844e('0x85')]=function(_0x52af21,_0x3bb589){_0x52af21[_0x844e('0x64')]['systemAvatar']=_0x52af21[_0x844e('0x80')][_0x844e('0x83')];return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x52af21['params']['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x3bb589,null))['then'](saveUpdates(_0x52af21[_0x844e('0x64')],null))[_0x844e('0x18')](respondWithResult(_0x3bb589,null))[_0x844e('0x22')](handleError(_0x3bb589,null));};exports['getLogo']=function(_0x43a9a7,_0x4c0140){var _0x22cc4b=path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/images/logos/default_logo.svg');var _0x1f5b23={'where':{'id':_0x43a9a7[_0x844e('0x71')]['id']},'attributes':['id',_0x844e('0x7f')],'raw':!![]};var _0x17a815=![];return require(_0x844e('0x88'))[_0x844e('0x89')]()[_0x844e('0x18')](function(_0x8fc499){if(_0x8fc499){_0x17a815=_0x8fc499[_0x844e('0x8a')];}})[_0x844e('0x18')](function(){return db[_0x844e('0x4c')][_0x844e('0x63')](_0x1f5b23);})[_0x844e('0x18')](handleEntityNotFound(_0x4c0140,null))[_0x844e('0x18')](function(_0x1e89e4){if(_0x1e89e4){if(!_[_0x844e('0x8b')](_0x1e89e4['sitepic'])){if(fs[_0x844e('0x8c')](path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/images/logos/',_0x1e89e4['sitepic']))&&_0x17a815){_0x22cc4b=path[_0x844e('0x86')](config[_0x844e('0x87')],_0x844e('0x8d'),_0x1e89e4[_0x844e('0x7f')]);}}return _0x4c0140[_0x844e('0x8e')](_0x22cc4b);}})['catch'](handleError(_0x4c0140,null));};exports[_0x844e('0x8f')]=function(_0xcfe967,_0x3fa9f7){var _0x5a77ac=path['join'](config[_0x844e('0x87')],_0x844e('0x90'));var _0x4939a9={'where':{'id':_0xcfe967['params']['id']},'attributes':['id',_0x844e('0x82')],'raw':!![]};return db[_0x844e('0x4c')][_0x844e('0x63')](_0x4939a9)['then'](handleEntityNotFound(_0x3fa9f7,null))[_0x844e('0x18')](function(_0x2259fa){if(_0x2259fa){if(!_['isNil'](_0x2259fa['agentAvatar'])){if(fs['existsSync'](path['join'](config['root'],_0x844e('0x91'),_0x2259fa[_0x844e('0x82')]))){_0x5a77ac=path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/images/avatars/',_0x2259fa['agentAvatar']);}}return _0x3fa9f7[_0x844e('0x8e')](_0x5a77ac);}})['catch'](handleError(_0x3fa9f7,null));};exports[_0x844e('0x92')]=function(_0x324938,_0xa0fdd1){var _0x2f31c1=path['join'](config['root'],_0x844e('0x93'));var _0x4a1ffc={'where':{'id':_0x324938[_0x844e('0x71')]['id']},'attributes':['id','customerAvatar','showCustomerAvatar'],'raw':!![]};return db[_0x844e('0x4c')][_0x844e('0x63')](_0x4a1ffc)['then'](handleEntityNotFound(_0xa0fdd1,null))[_0x844e('0x18')](function(_0x548b0b){if(_0x548b0b){if(!_[_0x844e('0x8b')](_0x548b0b[_0x844e('0x84')])){if(fs[_0x844e('0x8c')](path[_0x844e('0x86')](config['root'],_0x844e('0x91'),_0x548b0b[_0x844e('0x84')]))&&_0x548b0b[_0x844e('0x94')]){_0x2f31c1=path['join'](config['root'],_0x844e('0x91'),_0x548b0b[_0x844e('0x84')]);}}return _0xa0fdd1[_0x844e('0x8e')](_0x2f31c1);}})[_0x844e('0x22')](handleError(_0xa0fdd1,null));};exports[_0x844e('0x95')]=function(_0x2bf367,_0xf4a1e1){var _0x2af775=path[_0x844e('0x86')](config['root'],_0x844e('0x96'));var _0x5715ed={'where':{'id':_0x2bf367[_0x844e('0x71')]['id']},'attributes':['id',_0x844e('0x97')],'raw':!![]};return db['ChatWebsite'][_0x844e('0x63')](_0x5715ed)[_0x844e('0x18')](handleEntityNotFound(_0xf4a1e1,null))[_0x844e('0x18')](function(_0x2dc1db){if(_0x2dc1db){if(!_['isNil'](_0x2dc1db['systemAvatar'])){if(fs[_0x844e('0x8c')](path[_0x844e('0x86')](config['root'],_0x844e('0x91'),_0x2dc1db[_0x844e('0x97')]))){_0x2af775=path['join'](config[_0x844e('0x87')],_0x844e('0x91'),_0x2dc1db['systemAvatar']);}}return _0xf4a1e1['download'](_0x2af775);}})[_0x844e('0x22')](handleError(_0xf4a1e1,null));};function checkWebsiteInterval(_0x1ccd80){var _0x109d7b=_0x1ccd80[_0x844e('0x98')];if(!_0x109d7b){return Promise['resolve'](_0x1ccd80);}var _0x402e17=_0x1ccd80[_0x844e('0x99')]||undefined;return _0x109d7b[_0x844e('0x9a')](_0x402e17)[_0x844e('0x18')](function(_0xe930df){if(!_0xe930df){throw new APIOutOfIntervalError();}return _0x1ccd80;});}exports['notify']=function(_0x5a3db3,_0x4f00cb){var _0x2354a4={'body':_0x5a3db3[_0x844e('0x64')],'channel':'chat'};var _0x3ce7eb=[];var _0x149434=[];var _0x4f6862={};var _0x5117fd=![];if(_0x5a3db3[_0x844e('0x64')]['id']){delete _0x5a3db3[_0x844e('0x64')]['id'];}if(_[_0x844e('0x8b')](_0x5a3db3[_0x844e('0x64')][_0x844e('0x9b')])){throw new APIBadRequestError(_0x844e('0x9c'));}if(_['isNil'](_0x5a3db3[_0x844e('0x64')][_0x844e('0x9d')])){throw new APIBadRequestError(_0x844e('0x9e'));}if(_[_0x844e('0x9f')](_0x5a3db3[_0x844e('0x64')][_0x844e('0x64')])){throw new APIBadRequestError(_0x844e('0xa0'));}var _0x18ddb5=_0x5a3db3[_0x844e('0x64')][_0x844e('0x37')]&&_0x5a3db3[_0x844e('0x64')][_0x844e('0x3d')];return db[_0x844e('0xa1')][_0x844e('0x72')]()['then'](function(_0x1203c6){if(!_0x1203c6){throw new Error(_0x844e('0xa2'));}_0x3ce7eb=Object[_0x844e('0x50')](_0x1203c6)[_0x844e('0x5c')](function(_0x5692ff){return![_0x844e('0xa3'),_0x844e('0xa4')][_0x844e('0xa5')](_0x5692ff);});_0x149434=Object[_0x844e('0x50')](_0x1203c6)[_0x844e('0x5c')](function(_0x5d9730){return![_0x844e('0xa3'),'updatedAt',_0x844e('0xa6'),_0x844e('0xa7')][_0x844e('0xa5')](_0x5d9730);});if(!_[_0x844e('0xa5')](_0x149434,_0x5a3db3[_0x844e('0x64')][_0x844e('0x9d')])){throw new APIBadRequestError(_0x844e('0xa8')+_0x149434[_0x844e('0x86')](',\x20'));}_0x4f6862[_0x5a3db3[_0x844e('0x64')][_0x844e('0x9d')]]=_0x5a3db3['body'][_0x844e('0x9b')];})['then'](function(){return db['ChatWebsite'][_0x844e('0x63')]({'where':{'id':_0x5a3db3['params']['id']},'include':[{'model':db[_0x844e('0xa9')],'as':'List','include':[{'model':db[_0x844e('0xa1')],'as':'Contacts','where':_0x4f6862,'limit':0x1,'order':[[_0x844e('0xa4'),'DESC']]}]},{'model':db[_0x844e('0xaa')],'as':_0x844e('0xab')},{'model':db['Interval'],'as':_0x844e('0x98'),'include':[{'model':db[_0x844e('0x98')],'as':_0x844e('0xac'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x844e('0x18')](function(_0x30caf3){if(!_0x30caf3){throw new APINotFoundError(util[_0x844e('0x40')](_0x844e('0xad'),_0x5a3db3[_0x844e('0x71')]['id']));}if(_0x18ddb5){return checkWebsiteInterval(_0x30caf3);}return _0x30caf3;})['then'](function(_0x5b4355){_0x2354a4[_0x844e('0xae')]=_0x5b4355;_0x2354a4[_0x844e('0xaf')]=_[_0x844e('0xb0')](_0x5b4355[_0x844e('0xab')],[_0x844e('0xb1')],[_0x844e('0xb2')]);if(_0x2354a4[_0x844e('0xae')][_0x844e('0xab')]){delete _0x2354a4[_0x844e('0xae')][_0x844e('0xab')];}_0x2354a4[_0x844e('0xb3')]=_0x5b4355[_0x844e('0xb4')]||{'id':_0x5b4355[_0x844e('0xa7')]};if(_0x2354a4['list']&&_0x2354a4['list'][_0x844e('0xb5')]['length']){return _0x2354a4[_0x844e('0xb3')]['Contacts'][0x0];}var _0x1d29a2=_['defaults'](_0x5a3db3[_0x844e('0x64')],{'firstName':_0x5a3db3[_0x844e('0x64')][_0x844e('0x9b')],'ListId':_0x5b4355[_0x844e('0xa7')]});_0x1d29a2[_0x5a3db3['body'][_0x844e('0x9d')]]=_0x5a3db3[_0x844e('0x64')][_0x844e('0x9b')];return db[_0x844e('0xa1')][_0x844e('0x67')](_0x1d29a2,{'fields':_0x3ce7eb,'raw':!![]});})[_0x844e('0x18')](function(_0x19a451){_0x2354a4[_0x844e('0xb6')]=_0x19a451;var _0x35bf98=createInteractionObject(_0x5a3db3[_0x844e('0x71')]['id'],_0x5a3db3[_0x844e('0x64')],_0x5a3db3[_0x844e('0xb7')],_0x19a451);var _0x184654={'ChatWebsiteId':_0x5a3db3[_0x844e('0x71')]['id']};if(_0x5a3db3[_0x844e('0x64')]['threadId']){_0x184654[_0x844e('0xb8')]=_0x5a3db3[_0x844e('0x64')][_0x844e('0xb8')];_0x184654[_0x844e('0xb9')]=![];return db[_0x844e('0xba')][_0x844e('0x63')]({'where':_0x184654})[_0x844e('0x18')](function(_0x51fd3a){var _0x11933d=_0x5a3db3[_0x844e('0x64')][_0x844e('0x37')]&&_0x5a3db3['body'][_0x844e('0x3d')];if(_0x51fd3a){_0x5117fd=!![];return _0x51fd3a;}else if(!_0x11933d&&_0x51fd3a&&_0x51fd3a[_0x844e('0xb9')]){throw new APIConflictError(_0x844e('0xbb'));}_0x35bf98[_0x844e('0xb8')]=_0x5a3db3['body'][_0x844e('0xb8')];_0x35bf98[_0x844e('0xbc')]=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbc')];return db['ChatInteraction'][_0x844e('0x67')](_0x35bf98);});}_0x184654['ContactId']=_0x19a451['id'];if(_0x5a3db3[_0x844e('0x64')][_0x844e('0xbd')]&&_0x5a3db3['body'][_0x844e('0xbd')]['id']){_0x184654['id']=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbd')]['id'];return db['ChatInteraction'][_0x844e('0x63')]({'where':_0x184654})[_0x844e('0x18')](function(_0x51b0a8){var _0x11e415=_0x5a3db3[_0x844e('0x64')][_0x844e('0x37')]&&_0x5a3db3[_0x844e('0x64')][_0x844e('0x3d')];if(!_0x11e415&&_0x51b0a8&&_0x51b0a8[_0x844e('0xb9')]){throw new APIConflictError(_0x844e('0xbb'));}else if(_0x51b0a8){_0x5117fd=!![];return _0x51b0a8;}else{return db['ChatInteraction'][_0x844e('0x67')](_0x35bf98);}});}return db[_0x844e('0xba')][_0x844e('0x67')](_0x35bf98);})[_0x844e('0x18')](function(_0x3a04b6){if(!_0x5117fd){return _0x3a04b6;}var _0x18c156={'from':(_0x2354a4['contact'][_0x844e('0xbe')]||'')+'\x20'+(_0x2354a4[_0x844e('0xb6')][_0x844e('0x3b')]||'')};if(_0x5a3db3[_0x844e('0x64')][_0x844e('0xb8')]&&_0x5a3db3[_0x844e('0x64')]['messageId']&&_0x5a3db3['body']['threadId']!=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbf')]){_0x18c156[_0x844e('0xb8')]=_0x5a3db3[_0x844e('0x64')][_0x844e('0xbf')];}return _0x3a04b6[_0x844e('0x2c')](_0x18c156);})[_0x844e('0x18')](function(_0x346f18){_0x2354a4[_0x844e('0xbd')]=_0x346f18[_0x844e('0x69')]({'plain':!![]});_0x2354a4[_0x844e('0xbd')]['created']=!_0x5117fd;if(_0x2354a4['interaction']['created']){if(_0x2354a4[_0x844e('0xae')][_0x844e('0xc0')]){_0x2354a4['applications'][_0x844e('0xc1')]({'id':0x0,'priority':_0x2354a4['applications'][_0x844e('0x62')]+0x1,'app':_0x844e('0xc2'),'appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0x844e('0xc3')][_0x844e('0x67')]({'body':_0x5a3db3[_0x844e('0x64')]['body'],'ChatWebsiteId':_0x5a3db3[_0x844e('0x71')]['id'],'ChatInteractionId':_0x346f18['id'],'direction':'in','ContactId':_0x2354a4[_0x844e('0xb6')]['id'],'AttachmentId':_0x5a3db3[_0x844e('0x64')]['AttachmentId']});})[_0x844e('0x18')](function(_0x38eeb7){_0x2354a4['message']=_0x38eeb7;if(!_0x2354a4['interaction'][_0x844e('0xc4')]){return;}return db[_0x844e('0xc5')]['find']({'attributes':['id',_0x844e('0x31')],'where':{'id':_0x2354a4[_0x844e('0xbd')]['UserId']}});})[_0x844e('0x18')](function(_0x4a66f9){if(_0x4a66f9){_0x2354a4['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4a66f9['name']+','+(_0x2354a4['account']['waitForTheAssignedAgent']||0xa),'interval':_0x844e('0xc6')});_0x2354a4[_0x844e('0xc7')]=!![];}if(!_0x2354a4[_0x844e('0xbd')][_0x844e('0xc8')]){return;}return db[_0x844e('0xc9')][_0x844e('0x63')]({'attributes':['id',_0x844e('0x31')],'where':{'id':_0x2354a4[_0x844e('0xbd')][_0x844e('0xc8')]}});})[_0x844e('0x18')](function(_0x1d7463){if(_0x1d7463){_0x2354a4['applications'][_0x844e('0xca')]({'id':0x0,'priority':0x1,'app':_0x844e('0xcb'),'appdata':_0x1d7463[_0x844e('0x31')]+','+(_0x2354a4['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x844e('0xc6')});}return respondWithRpcPromise(_0x844e('0xcc'),_0x844e('0xcd'),_0x2354a4);})['then'](function(_0x539f14){respondWithRpcPromise(_0x844e('0xce'),_0x844e('0xce'),{'event':_0x844e('0xcf'),'message':_0x539f14},client9002);return _0x539f14;})[_0x844e('0x18')](respondWithResult(_0x4f00cb,null))[_0x844e('0x22')](APIHandleError(_0x4f00cb));};exports['offline']=function(_0x1775e8,_0x419a89){var _0x9bfa01,_0x134a28,_0x8a753b;var _0x40f5e4=[];var _0x39edd0={};var _0xee01a6=_0x1775e8['files']||[];var _0x374113=[];var _0x1dc407;return db[_0x844e('0xa1')][_0x844e('0x72')]()['then'](function(_0x680da6){if(!_0x680da6){throw new db[(_0x844e('0xd0'))]['ValidationError']('no\x20available\x20attributes');}_0x40f5e4=_[_0x844e('0xd1')](_[_0x844e('0x50')](_0x680da6),[_0x844e('0xa3'),_0x844e('0xa4'),_0x844e('0xa6'),_0x844e('0xa7')]);if(_0x1775e8[_0x844e('0x64')]['id']){delete _0x1775e8['body']['id'];}if(_[_0x844e('0x8b')](_0x1775e8[_0x844e('0x64')][_0x844e('0x9b')])){throw _0x419a89[_0x844e('0x24')](0x1f4)[_0x844e('0x32')](new db[(_0x844e('0xd0'))][(_0x844e('0xd2'))](_0x844e('0xd3')));}if(_[_0x844e('0x8b')](_0x1775e8['body'][_0x844e('0x64')])||_0x1775e8[_0x844e('0x64')][_0x844e('0x64')]===''){throw _0x419a89[_0x844e('0x24')](0x1f4)[_0x844e('0x32')](new db[(_0x844e('0xd0'))][(_0x844e('0xd2'))](_0x844e('0xd4')));}if(_[_0x844e('0x8b')](_0x1775e8['body']['mapKeyOffline'])){throw _0x419a89['status'](0x1f4)[_0x844e('0x32')](new db[(_0x844e('0xd0'))][(_0x844e('0xd2'))](_0x844e('0xd5')+_0x40f5e4));}if(!_['includes'](_0x40f5e4,_0x1775e8[_0x844e('0x64')][_0x844e('0xd6')])){throw _0x419a89[_0x844e('0x24')](0x1f4)[_0x844e('0x32')](new db['Sequelize'][(_0x844e('0xd2'))](_0x844e('0xd7')+_0x40f5e4));}_0x39edd0[_0x1775e8[_0x844e('0x64')][_0x844e('0xd6')]]=_0x1775e8[_0x844e('0x64')][_0x844e('0x9b')];})[_0x844e('0x18')](function(){return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x1775e8['params']['id']},'include':[{'model':db[_0x844e('0xa9')],'as':_0x844e('0xb4')},{'model':db[_0x844e('0xd8')],'as':_0x844e('0xd8')}]});})[_0x844e('0x18')](handleEntityNotFound(_0x419a89,null))[_0x844e('0x18')](function(_0x5a65b2){if(_0x5a65b2&&_0x5a65b2[_0x844e('0xb4')]){_0x134a28=_0x5a65b2;var _0x19c6fd=_[_0x844e('0x13')](_0x1775e8[_0x844e('0x64')],{'firstName':_0x1775e8[_0x844e('0x64')]['from'],'phone':_0x1775e8[_0x844e('0x64')][_0x844e('0x9b')],'ListId':_0x5a65b2[_0x844e('0xa7')]});_0x19c6fd[_0x1775e8[_0x844e('0x64')][_0x844e('0xd6')]]=_0x1775e8[_0x844e('0x64')]['from'];return db['CmContact']['findOrCreate']({'where':_0x39edd0,'defaults':_0x19c6fd});}})[_0x844e('0xd9')](function(_0x2e7e15){if(_0x2e7e15){_0x8a753b=_0x2e7e15;var _0x54fc71=fs[_0x844e('0xda')](path[_0x844e('0x86')](config[_0x844e('0x87')],'server/files/templates/chatOfflineMessage.ejs'),_0x844e('0xdb'));var _0x5f2970=ejs[_0x844e('0xdc')](_0x54fc71,{'body':_[_0x844e('0xdd')](_0x1775e8[_0x844e('0x64')]['body']),'bodyTitle':_0x134a28[_0x844e('0xde')]});return db[_0x844e('0xdf')]['create']({'body':_0x5f2970,'plainBody':htmlToText[_0x844e('0xe0')](_0x5f2970),'ContactId':_0x2e7e15['id'],'ChatWebsiteId':_0x134a28['id']});}})[_0x844e('0x18')](function(_0x582cf0){_0x1dc407=_0x582cf0;if(_0xee01a6[_0x844e('0x62')]){var _0x24c326=_0xee01a6['map'](function(_0x23b6ef){return{'name':_0x23b6ef[_0x844e('0xe1')],'basename':_0x23b6ef[_0x844e('0x83')],'type':_0x23b6ef[_0x844e('0xe2')],'ChatOfflineMessageId':_0x582cf0['id']};});_0x374113=_0x24c326[_0x844e('0x4b')](_0x1b9da7=>{var _0x283ec2={'filename':_0x1b9da7[_0x844e('0x31')],'path':path[_0x844e('0x86')](config[_0x844e('0x87')],_0x844e('0xe3'),_0x844e('0xe4'),_0x844e('0xe5'),_0x844e('0xe6'),_0x1b9da7['basename'])};return _0x283ec2;});if(!_0x134a28[_0x844e('0xe7')]){return db[_0x844e('0xe8')]['transaction'](function(_0x21b2e0){return db[_0x844e('0xe9')][_0x844e('0xea')](_0x24c326,{'transaction':_0x21b2e0});});}}})[_0x844e('0x18')](function(){if(_0x1dc407){_0x9bfa01=_0x1dc407;return db[_0x844e('0xd8')][_0x844e('0x75')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0x844e('0xeb'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x844e('0xec'),'raw':!![]}]}]});}})[_0x844e('0x18')](function(_0x252760){if(_0x252760&&_0x252760[_0x844e('0xeb')]&&_0x134a28[_0x844e('0xed')]&&_0x134a28[_0x844e('0xee')]){var _0x28cdae=_0x252760['getSmtpOptions']();return respondWithRpcPromise(_0x844e('0xef'),'sendMail',{'account':_0x28cdae,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x252760[_0x844e('0x31')],_0x252760[_0x844e('0xf0')]||_0x252760[_0x844e('0xeb')]['user']),'to':_0x134a28[_0x844e('0xee')],'subject':_0x134a28[_0x844e('0xf1')],'html':_0x9bfa01[_0x844e('0x64')],'attachments':_0x374113}},client9003)[_0x844e('0x18')](function(){return _0x9bfa01;})[_0x844e('0x22')](function(_0x641902){logger[_0x844e('0x1d')](_0x641902);});}})['then'](function(){if(_0x134a28&&_0x134a28['openNewInteraction']&&_0x134a28[_0x844e('0xf2')]){var _0x5262d4=[];if(_0xee01a6[_0x844e('0x62')]){_0x5262d4=_0xee01a6[_0x844e('0x4b')](function(_0x4245e2){return{'name':_0x4245e2[_0x844e('0xe1')],'basename':_0x4245e2['filename'],'type':_0x4245e2[_0x844e('0xe2')],'ChatOfflineMessageId':_0x1dc407['id']};});}var _0x2204a1;if(!_[_0x844e('0x8b')](_0x134a28[_0x844e('0xf3')])){var _0x2b9a03=_[_0x844e('0x4b')](_0x1775e8['body'],function(_0x58d81c){return _0x58d81c;});var _0x21870b=_['toPairsIn'](_0x2b9a03)[0x0];var _0x112955=_['mapValues'](_0x21870b,function(_0x34873b){return _0x34873b;});_0x2204a1=_0x112955[0x1][_0x134a28[_0x844e('0xf3')]];}var _0x51cd1a={'from':_0x8a753b[_0x844e('0xf0')],'firstName':_0x8a753b[_0x844e('0xbe')],'lastName':_0x8a753b[_0x844e('0x3b')],'mapKey':_0x844e('0xf0'),'message':{'from':_0x8a753b[_0x844e('0xf0')],'to':_0x134a28[_0x844e('0xd8')]['email'],'cc':'','subject':_['isNil'](_0x2204a1)?_0x134a28['offlineMessageSubject']:_0x2204a1,'messageId':'','sentAt':new Date(),'attach':_0x5262d4['length'],'attachments':_0x5262d4,'originChannel':_0x844e('0xf4'),'ChatWebsiteId':_0x134a28['id'],'ChatOfflineMessageId':_0x9bfa01['id'],'originTo':_0x134a28[_0x844e('0xd8')][_0x844e('0xf0')]},'body':_0x9bfa01['body']};var _0x3606d4={'account':{'id':_0x134a28[_0x844e('0xf2')]},'body':_0x51cd1a,'log':_0x844e('0xf5')};return respondWithRpcPromise(_0x844e('0xf5'),'notifyMail',_0x3606d4,client9001)[_0x844e('0x18')](function(){return _0x9bfa01;})[_0x844e('0x22')](function(_0x5383ac){logger[_0x844e('0x1d')](_0x5383ac);});}return;})[_0x844e('0x18')](function(){if(_0x9bfa01){return _0x9bfa01;}})[_0x844e('0x18')](respondWithResult(_0x419a89,null))['catch'](function(){for(var _0x476be2 of _0xee01a6){var _0x14f9f5=path[_0x844e('0x86')](config['root'],_0x844e('0xe3'),'files',_0x844e('0xe5'),_0x844e('0xe6'),_0x476be2[_0x844e('0x83')]);fs_extra[_0x844e('0xf6')](_0x14f9f5)[_0x844e('0x22')](function(_0x31e571){logger[_0x844e('0x1d')](_0x844e('0xf7'),_0x14f9f5,_0x31e571);});}});};exports[_0x844e('0xf8')]=function(_0xf21b7c,_0x22c85e){return db[_0x844e('0xba')]['find']({'where':{'id':_0xf21b7c[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x22c85e,null))['then'](function(_0x1ff9b5){if(_0x1ff9b5){return _0x1ff9b5[_0x844e('0xf8')](_0xf21b7c[_0x844e('0x64')][_0x844e('0x7a')],_[_0x844e('0xf9')](_0xf21b7c[_0x844e('0x64')],[_0x844e('0x7a'),'id'])||{});}})[_0x844e('0x18')](respondWithResult(_0x22c85e,null))['catch'](handleError(_0x22c85e,null));};exports[_0x844e('0xfa')]=function(_0x55b540,_0x44157e){var _0x11cb2f={'raw':![],'where':{}};var _0x17518a={};var _0xe328bd={'count':0x0,'rows':[]};return db[_0x844e('0x4c')]['findOne']({'where':{'id':_0x55b540[_0x844e('0x71')]['id']}})['then'](handleEntityNotFound(_0x44157e,null))[_0x844e('0x18')](function(_0x1d51e1){if(_0x1d51e1){_0x17518a[_0x844e('0x43')]=_['keys'](db[_0x844e('0xba')][_0x844e('0x61')]);_0x17518a[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x55b540[_0x844e('0x4f')]);_0x17518a['filters']=_['intersection'](_0x17518a[_0x844e('0x43')],_0x17518a[_0x844e('0x4f')]);_0x11cb2f[_0x844e('0x53')]=_[_0x844e('0x51')](_0x17518a[_0x844e('0x43')],qs[_0x844e('0x52')](_0x55b540[_0x844e('0x4f')][_0x844e('0x52')]));_0x11cb2f[_0x844e('0x53')]=_0x11cb2f['attributes'][_0x844e('0x62')]?_0x11cb2f['attributes']:_0x17518a[_0x844e('0x43')];if(!_0x55b540[_0x844e('0x4f')]['hasOwnProperty'](_0x844e('0x55'))){_0x11cb2f[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x55b540[_0x844e('0x4f')][_0x844e('0x27')]);_0x11cb2f['offset']=qs[_0x844e('0x26')](_0x55b540['query'][_0x844e('0x26')]);}_0x11cb2f[_0x844e('0x77')]=qs['sort'](_0x55b540['query'][_0x844e('0x56')]);_0x11cb2f[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x55b540['query'],_0x17518a[_0x844e('0x58')]));_0x11cb2f[_0x844e('0x57')][_0x844e('0x73')]=_0x1d51e1['id'];if(_0x55b540[_0x844e('0x4f')][_0x844e('0x5c')]){_0x11cb2f['where']=_[_0x844e('0x5a')](_0x11cb2f[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x11cb2f['attributes'],function(_0x2ea280){var _0x5f225d={};_0x5f225d[_0x2ea280]={'$like':'%'+_0x55b540[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x5f225d;})});}_0x11cb2f=_[_0x844e('0x5a')]({},_0x11cb2f,_0x55b540[_0x844e('0x5d')]);return db['ChatInteraction'][_0x844e('0x29')]({'where':_0x11cb2f[_0x844e('0x57')]})[_0x844e('0x18')](function(_0x19edb8){_0xe328bd[_0x844e('0x29')]=_0x19edb8;if(_0x55b540[_0x844e('0x4f')]['includeAll']){_0x11cb2f[_0x844e('0x5f')]=[{'model':db['CmContact'],'as':_0x844e('0xfb'),'required':![]},{'model':db['User'],'as':_0x844e('0xfc'),'attributes':[_0x844e('0x31'),_0x844e('0xfd'),_0x844e('0xfe')],'required':![]},{'model':db[_0x844e('0xff')],'as':_0x844e('0x100'),'attributes':['id',_0x844e('0x31'),'color'],'where':_0x55b540[_0x844e('0x4f')]['tag']?{'id':_0x55b540[_0x844e('0x4f')]['tag']}:undefined,'required':_0x55b540[_0x844e('0x4f')][_0x844e('0x101')]?!![]:![]}];}return db[_0x844e('0xba')][_0x844e('0x78')](_0x11cb2f);})[_0x844e('0x18')](function(_0x4ccac6){_0xe328bd['rows']=_0x4ccac6;return _0xe328bd;});}})[_0x844e('0x18')](respondWithFilteredResult(_0x44157e,_0x11cb2f))['catch'](handleError(_0x44157e,null));};exports[_0x844e('0x102')]=function(_0x48d973,_0x1d6abb){var _0x454b5d=0x0;var _0x358b3e=0x0;var _0x53be53=![];var _0x2e48e3;var _0x4ec13f;return db[_0x844e('0x4c')][_0x844e('0x63')]({'where':{'id':_0x48d973[_0x844e('0x71')]['id']},'include':[{'model':db[_0x844e('0x98')],'as':_0x844e('0x98'),'include':[{'model':db[_0x844e('0x98')],'as':_0x844e('0xac'),'attributes':['id',_0x844e('0x103')]}]}]})[_0x844e('0x18')](handleEntityNotFound(_0x1d6abb,null))[_0x844e('0x18')](function(_0x418bd1){if(_0x418bd1){_0x2e48e3=_0x418bd1;return _0x418bd1['getProactiveActions']({'raw':!![]});}})[_0x844e('0x18')](function(_0x5132d8){if(_0x2e48e3){if(_0x5132d8){_0x4ec13f=_0x5132d8;}}return require(_0x844e('0x88'))['getLicense']();})[_0x844e('0x18')](function(_0x6fb171){if(_0x6fb171){_0x358b3e=_0x6fb171[_0x844e('0x104')];_0x53be53=_0x6fb171[_0x844e('0x8a')];}})[_0x844e('0x18')](function(){return db[_0x844e('0xba')][_0x844e('0x29')]({'where':{'closed':![]}});})['then'](function(_0x1f545e){_0x454b5d=_0x1f545e;if(_0x358b3e&&_0x1f545e>_0x358b3e){return db[_0x844e('0x105')][_0x844e('0x75')]({'where':{'id':0x1}})[_0x844e('0x18')](function(_0x1b75b8){if(_0x1b75b8){_0x1b75b8[_0x844e('0x106')](_0x844e('0x107'));}});}})[_0x844e('0x18')](function(){var _0x5222da=_0x2e48e3[_0x844e('0x98')];var _0x64f058=_0x2e48e3['timezone']||undefined;return _0x5222da?_0x5222da[_0x844e('0x9a')](_0x64f058):!![];})[_0x844e('0x18')](function(_0x3c8f88){var _0x103475=fs[_0x844e('0xda')](path['join'](config[_0x844e('0x87')],_0x844e('0x108')),_0x844e('0xdb'));var _0x1597ba=_0x844e('0x109');var _0x3a8782=![];var _0xb0d533,_0x5cb72d;if(_0x48d973[_0x844e('0xb7')][_0x844e('0x3d')]){_0xb0d533=new URL(_0x48d973['headers']['referer'])[_0x844e('0x10a')];}else if(_0x48d973['headers'][_0x844e('0x10a')]){_0xb0d533=new URL(_0x48d973['headers'][_0x844e('0x10a')])[_0x844e('0x10a')];}else{_0xb0d533='http://localhost:9000';}_0x5cb72d=typeof _0x2e48e3['address']['split'](',')[_0x844e('0x63')](function(_0x1df711){return wildcardUtils[_0x844e('0x10b')](_0x1df711,_0xb0d533);})!==_0x844e('0x28');var _0x1ea83d={'chatVersion':_0x1597ba,'chatWebsiteAddressOrigin':_0x5cb72d?_0xb0d533:_0x2e48e3[_0x844e('0x10c')],'remote':_0x2e48e3[_0x844e('0x10d')],'query':querystring[_0x844e('0x1c')](_[_0x844e('0x5a')](_0x2e48e3[_0x844e('0x69')]({'plain':!![]}),{'customerIp':_0x48d973['headers'][_0x844e('0x10e')]||_0x48d973[_0x844e('0xb7')][_0x844e('0x10f')]||_0x48d973[_0x844e('0x110')][_0x844e('0x111')]||_0x48d973['ip'],'referer':_0x48d973['headers'][_0x844e('0x3d')],'openedInteractions':_0x454b5d,'maxInteractions':_0x358b3e,'virtual':_0x53be53[_0x844e('0x104')],'online':_0x3c8f88,'custom':_0x53be53,'address':_0x5cb72d?_0xb0d533:null}))[_0x844e('0x112')](/'/g,'\x5c\x27')};_0x1d6abb[_0x844e('0x32')](ejs[_0x844e('0xdc')](Mustache[_0x844e('0xdc')](_0x103475,_0x1ea83d),{'proactiveActions':_0x4ec13f,'alignment':_0x2e48e3[_0x844e('0x113')],'verticalAlignment':_0x2e48e3[_0x844e('0x114')],'div_color':_0x2e48e3[_0x844e('0x115')],'labelText':_0x2e48e3['labelText'],'text_color':_0x2e48e3[_0x844e('0x116')],'text_button_color':_0x2e48e3[_0x844e('0x117')],'button_color':_0x2e48e3[_0x844e('0x118')],'background_color':_0x2e48e3[_0x844e('0x119')],'hideWhenOffline':_0x2e48e3[_0x844e('0x11a')],'intervalId':_0x2e48e3['IntervalId'],'isDevelopment':_0x3a8782,'chatVersion':_0x1597ba}));})['catch'](handleError(_0x1d6abb,null));};exports[_0x844e('0x11b')]=function(_0x430aa0,_0x322107){var _0x4c81e3=_0x430aa0[_0x844e('0x71')]['id'];var _0x3764ff=_0x430aa0['body'];var _0x1aeb99=0xc8;var _0x125934=null;return db[_0x844e('0xe8')][_0x844e('0x11c')]({'isolationLevel':db[_0x844e('0xe8')][_0x844e('0x11d')][_0x844e('0x11e')][_0x844e('0x11f')]},function(_0x399cbe){return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x4c81e3},'transaction':_0x399cbe})[_0x844e('0x18')](function(_0x379e7f){if(_0x379e7f){return db[_0x844e('0xaa')][_0x844e('0x2e')]({'where':{'ChatWebsiteId':_0x4c81e3},'transaction':_0x399cbe})['then'](function(){var _0x2bd40c=_[_0x844e('0x4b')](_0x3764ff,function(_0x3bb23a){_0x3bb23a[_0x844e('0x73')]=_0x4c81e3;return _0x3bb23a;});return db[_0x844e('0xaa')][_0x844e('0xea')](_0x2bd40c,{'transaction':_0x399cbe});});}else{_0x1aeb99=0x194;_0x125934=[];}});})[_0x844e('0x18')](function(){if(_0x1aeb99!==0x194){return db[_0x844e('0xaa')][_0x844e('0x120')]({'where':{'ChatWebsiteId':_0x4c81e3},'order':_0x844e('0xb1')})['then'](function(_0x43d971){_0x125934=_0x43d971;});}})[_0x844e('0x22')](function(_0x49f92a){_0x1aeb99=0x1f4;logger['error'](_0x49f92a[_0x844e('0x30')]);if(_0x49f92a[_0x844e('0x31')]){delete _0x49f92a['name'];}_0x125934=_0x49f92a;})[_0x844e('0x121')](function(){if(_0x125934===null){_0x322107[_0x844e('0x23')](_0x1aeb99);}else{if(_0x1aeb99===0x1f4){_0x322107[_0x844e('0x24')](_0x1aeb99)[_0x844e('0x32')](_0x125934);}else{_0x322107['status'](_0x1aeb99)[_0x844e('0x25')](_0x125934);}}});};exports[_0x844e('0x122')]=function(_0x365207,_0x5e5288){var _0xeae328={};var _0x1cda40={};var _0x3f5d8a;var _0x3d674e;return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x365207[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x5e5288,null))['then'](function(_0x5744ae){if(_0x5744ae){_0x3f5d8a=_0x5744ae;_0x1cda40[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0xaa')][_0x844e('0x61')]);_0x1cda40['query']=_[_0x844e('0x50')](_0x365207[_0x844e('0x4f')]);_0x1cda40[_0x844e('0x58')]=_[_0x844e('0x51')](_0x1cda40['model'],_0x1cda40[_0x844e('0x4f')]);_0xeae328[_0x844e('0x53')]=_['intersection'](_0x1cda40[_0x844e('0x43')],qs['fields'](_0x365207['query']['fields']));_0xeae328[_0x844e('0x53')]=_0xeae328['attributes'][_0x844e('0x62')]?_0xeae328[_0x844e('0x53')]:_0x1cda40[_0x844e('0x43')];_0xeae328[_0x844e('0x77')]=qs['sort'](_0x365207['query'][_0x844e('0x56')]);_0xeae328[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x365207[_0x844e('0x4f')],_0x1cda40['filters']));if(_0x365207[_0x844e('0x4f')][_0x844e('0x5c')]){_0xeae328[_0x844e('0x57')]=_[_0x844e('0x5a')](_0xeae328[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0xeae328[_0x844e('0x53')],function(_0x5d9434){var _0x424401={};_0x424401[_0x5d9434]={'$like':'%'+_0x365207[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x424401;})});}_0xeae328=_[_0x844e('0x5a')]({},_0xeae328,_0x365207[_0x844e('0x5d')]);return _0x3f5d8a[_0x844e('0x122')](_0xeae328);}})[_0x844e('0x18')](function(_0x3e4e2d){if(_0x3e4e2d){_0x3d674e=_0x3e4e2d[_0x844e('0x62')];if(!_0x365207['query'][_0x844e('0x54')]('nolimit')){_0xeae328['limit']=qs[_0x844e('0x27')](_0x365207[_0x844e('0x4f')][_0x844e('0x27')]);_0xeae328[_0x844e('0x26')]=qs['offset'](_0x365207[_0x844e('0x4f')][_0x844e('0x26')]);}return _0x3f5d8a[_0x844e('0x122')](_0xeae328);}})['then'](function(_0x4f8c2f){if(_0x4f8c2f){return _0x4f8c2f?{'count':_0x3d674e,'rows':_0x4f8c2f}:null;}})['then'](respondWithResult(_0x5e5288,null))[_0x844e('0x22')](handleError(_0x5e5288,null));};exports[_0x844e('0x123')]=function(_0x276b5f,_0x150283){return db[_0x844e('0x124')]['find']({'where':{'id':_0x276b5f[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x150283,null))[_0x844e('0x18')](function(_0x215591){if(_0x215591){return _0x215591[_0x844e('0x123')](_0x276b5f[_0x844e('0x64')][_0x844e('0x7a')],_[_0x844e('0xf9')](_0x276b5f['body'],[_0x844e('0x7a'),'id'])||{});}})[_0x844e('0x18')](respondWithResult(_0x150283,null))[_0x844e('0x22')](handleError(_0x150283,null));};exports[_0x844e('0x125')]=function(_0x170007,_0x37ab57){var _0x4ab1c2={};var _0x395f9a={};var _0x1a8bc8;var _0x44a70d;return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x170007[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x37ab57,null))['then'](function(_0x34f187){if(_0x34f187){_0x1a8bc8=_0x34f187;_0x395f9a[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0x126')][_0x844e('0x61')]);_0x395f9a[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x170007[_0x844e('0x4f')]);_0x395f9a[_0x844e('0x58')]=_[_0x844e('0x51')](_0x395f9a[_0x844e('0x43')],_0x395f9a[_0x844e('0x4f')]);_0x4ab1c2[_0x844e('0x53')]=_[_0x844e('0x51')](_0x395f9a[_0x844e('0x43')],qs['fields'](_0x170007[_0x844e('0x4f')][_0x844e('0x52')]));_0x4ab1c2[_0x844e('0x53')]=_0x4ab1c2[_0x844e('0x53')][_0x844e('0x62')]?_0x4ab1c2['attributes']:_0x395f9a['model'];_0x4ab1c2[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x170007[_0x844e('0x4f')]['sort']);_0x4ab1c2[_0x844e('0x57')]=qs[_0x844e('0x58')](_['pick'](_0x170007[_0x844e('0x4f')],_0x395f9a[_0x844e('0x58')]));if(_0x170007[_0x844e('0x4f')][_0x844e('0x5c')]){_0x4ab1c2[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x4ab1c2[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x4ab1c2[_0x844e('0x53')],function(_0x404095){var _0x145b21={};_0x145b21[_0x404095]={'$like':'%'+_0x170007['query']['filter']+'%'};return _0x145b21;})});}_0x4ab1c2=_[_0x844e('0x5a')]({},_0x4ab1c2,_0x170007[_0x844e('0x5d')]);return _0x1a8bc8['getProactiveActions'](_0x4ab1c2);}})[_0x844e('0x18')](function(_0x417f5f){if(_0x417f5f){_0x44a70d=_0x417f5f[_0x844e('0x62')];if(!_0x170007['query'][_0x844e('0x54')]('nolimit')){_0x4ab1c2[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x170007[_0x844e('0x4f')][_0x844e('0x27')]);_0x4ab1c2['offset']=qs[_0x844e('0x26')](_0x170007['query']['offset']);}return _0x1a8bc8[_0x844e('0x125')](_0x4ab1c2);}})[_0x844e('0x18')](function(_0x1d02fb){if(_0x1d02fb){return _0x1d02fb?{'count':_0x44a70d,'rows':_0x1d02fb}:null;}})[_0x844e('0x18')](respondWithResult(_0x37ab57,null))['catch'](handleError(_0x37ab57,null));};exports[_0x844e('0x127')]=function(_0x1bf2bb,_0x508207){var _0x426bb8=_0x1bf2bb[_0x844e('0x4f')]['online']==='false'?_0x844e('0x128'):_0x844e('0x129');return db[_0x844e('0x4c')][_0x844e('0x63')]({'attributes':['id',_0x426bb8],'where':{'id':_0x1bf2bb[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x508207,null))[_0x844e('0x18')](function(_0x582c0d){if(_0x582c0d){var _0x44a22b=_0x582c0d[_0x426bb8];var _0x55eec1=_0x44a22b&&_0x44a22b[_0x844e('0x12a')]?_0x44a22b['items']:[];_0x508207[_0x844e('0x32')]({'fromKey':_['isNil'](_0x44a22b[_0x844e('0x12b')])?undefined:_0x44a22b[_0x844e('0x12b')],'count':_0x55eec1['length'],'rows':_0x55eec1});}})[_0x844e('0x22')](handleError(_0x508207,null));};exports[_0x844e('0x12c')]=function(_0x737f9f,_0x2a5a1b){var _0x3d0557={'raw':![],'where':{}};var _0x2d4040={};var _0x165544={'count':0x0,'rows':[]};return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x737f9f[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x2a5a1b,null))[_0x844e('0x18')](function(_0xe324e0){if(_0xe324e0){_0x2d4040[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0xdf')][_0x844e('0x61')]);_0x2d4040['query']=_[_0x844e('0x50')](_0x737f9f[_0x844e('0x4f')]);_0x2d4040['filters']=_[_0x844e('0x51')](_0x2d4040[_0x844e('0x43')],_0x2d4040['query']);_0x3d0557['attributes']=_[_0x844e('0x51')](_0x2d4040[_0x844e('0x43')],qs[_0x844e('0x52')](_0x737f9f[_0x844e('0x4f')][_0x844e('0x52')]));_0x3d0557['attributes']=_0x3d0557[_0x844e('0x53')][_0x844e('0x62')]?_0x3d0557['attributes']:_0x2d4040[_0x844e('0x43')];if(!_0x737f9f[_0x844e('0x4f')][_0x844e('0x54')]('nolimit')){_0x3d0557[_0x844e('0x27')]=qs[_0x844e('0x27')](_0x737f9f[_0x844e('0x4f')][_0x844e('0x27')]);_0x3d0557[_0x844e('0x26')]=qs['offset'](_0x737f9f[_0x844e('0x4f')]['offset']);}_0x3d0557[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x737f9f[_0x844e('0x4f')][_0x844e('0x56')]);_0x3d0557['where']=qs['filters'](_[_0x844e('0x59')](_0x737f9f['query'],_0x2d4040[_0x844e('0x58')]));_0x3d0557[_0x844e('0x57')][_0x844e('0x73')]=_0xe324e0['id'];if(_0x737f9f[_0x844e('0x4f')][_0x844e('0x5c')]){_0x3d0557[_0x844e('0x57')]=_['merge'](_0x3d0557[_0x844e('0x57')],{'$or':_[_0x844e('0x4b')](_0x3d0557[_0x844e('0x53')],function(_0x1d6167){var _0x376b4c={};_0x376b4c[_0x1d6167]={'$like':'%'+_0x737f9f['query'][_0x844e('0x5c')]+'%'};return _0x376b4c;})});}_0x3d0557=_[_0x844e('0x5a')]({},_0x3d0557,_0x737f9f[_0x844e('0x5d')]);return db[_0x844e('0xdf')]['count']({'where':_0x3d0557['where']})[_0x844e('0x18')](function(_0x3a47af){_0x165544[_0x844e('0x29')]=_0x3a47af;if(_0x737f9f['query']['includeAll']){_0x3d0557[_0x844e('0x5f')]=[{'all':!![]}];}else{_0x3d0557[_0x844e('0x5f')]=[{'model':db[_0x844e('0xa1')],'as':_0x844e('0xfb'),'required':![]},{'model':db[_0x844e('0xe9')],'as':_0x844e('0x12d'),'required':![]}];}return db[_0x844e('0xdf')]['findAll'](_0x3d0557);})[_0x844e('0x18')](function(_0x5cc157){_0x165544[_0x844e('0x60')]=_0x5cc157;return _0x165544;});}})[_0x844e('0x18')](respondWithFilteredResult(_0x2a5a1b,_0x3d0557))[_0x844e('0x22')](handleError(_0x2a5a1b,null));};exports[_0x844e('0x12e')]=function(_0x44ac12,_0x13b300){return db[_0x844e('0x4c')]['find']({'where':{'id':_0x44ac12[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x13b300,null))['then'](function(_0x2aed50){if(_0x2aed50){return _0x2aed50[_0x844e('0x12e')](_0x44ac12[_0x844e('0x64')][_0x844e('0x7a')],_[_0x844e('0xf9')](_0x44ac12[_0x844e('0x64')],[_0x844e('0x7a'),'id'])||{})[_0x844e('0xd9')](function(_0x381fb2){for(var _0x4ef040=0x0;_0x4ef040<_0x44ac12[_0x844e('0x64')][_0x844e('0x7a')]['length'];_0x4ef040+=0x1){socket['emit'](_0x844e('0x12f'),{'UserId':Number(_0x44ac12[_0x844e('0x64')]['ids'][_0x4ef040]),'ChatWebsiteId':Number(_0x44ac12['params']['id'])});}return _0x381fb2;});}})[_0x844e('0x18')](respondWithResult(_0x13b300,null))[_0x844e('0x22')](handleError(_0x13b300,null));};exports['removeAgents']=function(_0x1c01c9,_0xe72f44){return db['ChatWebsite']['find']({'where':{'id':_0x1c01c9['params']['id']}})['then'](handleEntityNotFound(_0xe72f44,null))['then'](function(_0x1f6512){if(_0x1f6512){return _0x1f6512[_0x844e('0x130')](_0x1c01c9[_0x844e('0x4f')]['ids'])[_0x844e('0x18')](function(){if(_[_0x844e('0x131')](_0x1c01c9[_0x844e('0x4f')]['ids'])){for(var _0x479b82=0x0;_0x479b82<_0x1c01c9[_0x844e('0x4f')][_0x844e('0x7a')][_0x844e('0x62')];_0x479b82+=0x1){socket[_0x844e('0x132')](_0x844e('0x133'),{'UserId':Number(_0x1c01c9[_0x844e('0x4f')][_0x844e('0x7a')][_0x479b82]),'ChatWebsiteId':Number(_0x1c01c9['params']['id'])});}}else{socket[_0x844e('0x132')](_0x844e('0x133'),{'UserId':Number(_0x1c01c9[_0x844e('0x4f')][_0x844e('0x7a')]),'ChatWebsiteId':Number(_0x1c01c9['params']['id'])});}});}})[_0x844e('0x18')](respondWithStatusCode(_0xe72f44,null))[_0x844e('0x22')](handleError(_0xe72f44,null));};exports[_0x844e('0x134')]=function(_0x1a60b0,_0x155a7a){var _0x3e2b88={};var _0x1415e6={};var _0x92f231;var _0x3601c0;return db[_0x844e('0x4c')][_0x844e('0x75')]({'where':{'id':_0x1a60b0[_0x844e('0x71')]['id']}})[_0x844e('0x18')](handleEntityNotFound(_0x155a7a,null))['then'](function(_0x486ed0){if(_0x486ed0){_0x92f231=_0x486ed0;_0x1415e6[_0x844e('0x43')]=_[_0x844e('0x50')](db[_0x844e('0xc5')][_0x844e('0x61')]);_0x1415e6[_0x844e('0x4f')]=_[_0x844e('0x50')](_0x1a60b0[_0x844e('0x4f')]);_0x1415e6['filters']=_[_0x844e('0x51')](_0x1415e6['model'],_0x1415e6[_0x844e('0x4f')]);_0x3e2b88['attributes']=_[_0x844e('0x51')](_0x1415e6[_0x844e('0x43')],qs[_0x844e('0x52')](_0x1a60b0['query'][_0x844e('0x52')]));_0x3e2b88['attributes']=_0x3e2b88['attributes'][_0x844e('0x62')]?_0x3e2b88['attributes']:_0x1415e6[_0x844e('0x43')];_0x3e2b88[_0x844e('0x77')]=qs[_0x844e('0x56')](_0x1a60b0[_0x844e('0x4f')][_0x844e('0x56')]);_0x3e2b88[_0x844e('0x57')]=qs[_0x844e('0x58')](_[_0x844e('0x59')](_0x1a60b0[_0x844e('0x4f')],_0x1415e6[_0x844e('0x58')]));if(_0x1a60b0['query'][_0x844e('0x5c')]){_0x3e2b88[_0x844e('0x57')]=_[_0x844e('0x5a')](_0x3e2b88[_0x844e('0x57')],{'$or':_['map'](_0x3e2b88['attributes'],function(_0x4b406a){var _0x5c2675={};_0x5c2675[_0x4b406a]={'$like':'%'+_0x1a60b0[_0x844e('0x4f')][_0x844e('0x5c')]+'%'};return _0x5c2675;})});}_0x3e2b88=_[_0x844e('0x5a')]({},_0x3e2b88,_0x1a60b0[_0x844e('0x5d')]);return _0x92f231[_0x844e('0x134')](_0x3e2b88);}})['then'](function(_0x133d31){if(_0x133d31){_0x3601c0=_0x133d31[_0x844e('0x62')];if(!_0x1a60b0['query'][_0x844e('0x54')](_0x844e('0x55'))){_0x3e2b88['limit']=qs[_0x844e('0x27')](_0x1a60b0[_0x844e('0x4f')][_0x844e('0x27')]);_0x3e2b88['offset']=qs[_0x844e('0x26')](_0x1a60b0[_0x844e('0x4f')][_0x844e('0x26')]);}return _0x92f231[_0x844e('0x134')](_0x3e2b88);}})[_0x844e('0x18')](function(_0x23fec3){if(_0x23fec3){return _0x23fec3?{'count':_0x3601c0,'rows':_0x23fec3}:null;}})[_0x844e('0x18')](respondWithResult(_0x155a7a,null))[_0x844e('0x22')](handleError(_0x155a7a,null));}; \ No newline at end of file +var _0xa8a8=['device','model','vendor','%s\x20%s\x20%s','type','stringify','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','params','length','find','create','body','address','forEach','trim','testWildcardValidity','user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','describe','addDisposition','ChatWebsiteId','Disposition','order','sort','include','removeDispositions','ids','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','addLogo','sitepic','file','addAvatar','agentAvatar','filename','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','download','root','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','ifTime','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','Body\x20is\x20mandatory','CmContact','createdAt','updatedAt','includes','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','DESC','Applications','Intervals','format','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','priority','asc','list','List','Contacts','contact','headers','threadId','ChatInteraction','customerIp','closed','externalUrl','interaction','lastName','messageId','created','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','queue','waitForTheAssignedQueue','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','send','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','ChatOfflineMessage','fromString','originalname','server','attachments','offline-chat','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','forwardOffline','forwardOfflineAddress','getSmtpOptions','\x22%s\x22\x20<%s>','email','offlineMessageSubject','mimetype','subjectOffline','toPairsIn','Chat','MailAccountId','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','internal','Tags','color','tag','getSnippet','getProactiveActions','virtual','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','3.13.0','origin','http://localhost:9000','x-real-ip','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','addApplications','ISOLATION_LEVELS','READ_COMMITTED','ChatApplication','findAndCountAll','finally','getApplications','chatProactiveAction','addProactiveActions','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Contact','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','./helpers/wildcard-expressions','url','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','update','ChatWebsites','UserProfileResource','destroy','sendStatus','stack','name','user-agent-parser','setUA','getResult','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','%s\x20%s','unknown'];(function(_0x4baebc,_0x41de8c){var _0x31b89c=function(_0x368217){while(--_0x368217){_0x4baebc['push'](_0x4baebc['shift']());}};_0x31b89c(++_0x41de8c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x4888a4,_0x46a30){_0x4888a4=_0x4888a4-0x0;var _0x1f2445=_0xa8a8[_0x4888a4];return _0x1f2445;};'use strict';var Mustache=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var ejs=require(_0x8a8a('0x3'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a8a('0x4'));var querystring=require(_0x8a8a('0x5'));var htmlToText=require(_0x8a8a('0x6'));var Redis=require(_0x8a8a('0x7'));var jayson=require(_0x8a8a('0x8'));var qs=require(_0x8a8a('0x9'));var logger=require(_0x8a8a('0xa'))(_0x8a8a('0xb'));var config=require(_0x8a8a('0xc'));var APIBadRequestError=require(_0x8a8a('0xd'))[_0x8a8a('0xe')];var APINotFoundError=require(_0x8a8a('0xd'))[_0x8a8a('0xf')];var APIOutOfIntervalError=require(_0x8a8a('0xd'))[_0x8a8a('0x10')];var APIHandleError=require('../../errors/api')['handleError'];var APIConflictError=require(_0x8a8a('0xd'))['APIConflictError'];var wildcardUtils=require(_0x8a8a('0x11'));var URL=require(_0x8a8a('0x12'))['URL'];var db=require(_0x8a8a('0x13'))['db'];config[_0x8a8a('0x14')]=_[_0x8a8a('0x15')](config['redis'],{'host':_0x8a8a('0x16'),'port':0x18eb});var socket=require(_0x8a8a('0x17'))(new Redis(config[_0x8a8a('0x14')]));require(_0x8a8a('0x18'))['register'](socket);var client=jayson[_0x8a8a('0x19')]['http']({'port':0x232c});var client9002=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x232a});var client9003=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x232b});var client9001=jayson[_0x8a8a('0x19')][_0x8a8a('0x1a')]({'port':0x2329});function respondWithRpcPromise(_0x16d38d,_0x51ce75,_0x1ed3be,_0x568b83){return new Promise(function(_0x1f36b6,_0x3046ae){var _0x46a4f4=_0x568b83||client;return _0x46a4f4[_0x8a8a('0x1b')](_0x16d38d,_0x1ed3be)[_0x8a8a('0x1c')](function(_0x5dd616){logger[_0x8a8a('0x1d')](_0x8a8a('0x1e'),_0x51ce75,_0x8a8a('0x1f'));logger[_0x8a8a('0x20')](_0x8a8a('0x21'),_0x51ce75,_0x8a8a('0x1f'),JSON['stringify'](_0x5dd616));if(_0x5dd616['error']){if(_0x5dd616['error']['code']===0x1f4){logger['error'](_0x8a8a('0x1e'),_0x51ce75,_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);return _0x3046ae(_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);}logger[_0x8a8a('0x22')](_0x8a8a('0x1e'),_0x51ce75,_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);return _0x1f36b6(_0x5dd616[_0x8a8a('0x22')][_0x8a8a('0x23')]);}else{logger[_0x8a8a('0x1d')](_0x8a8a('0x1e'),_0x51ce75,_0x8a8a('0x1f'));_0x1f36b6(_0x5dd616[_0x8a8a('0x24')]['message']);}})[_0x8a8a('0x25')](function(_0x16c55b){logger[_0x8a8a('0x22')](_0x8a8a('0x1e'),_0x51ce75,_0x16c55b);_0x3046ae(_0x16c55b);});});}function respondWithStatusCode(_0x36e6d4,_0x251315){_0x251315=_0x251315||0xcc;return function(_0x3aa46d){if(_0x3aa46d){return _0x36e6d4['sendStatus'](_0x251315);}return _0x36e6d4[_0x8a8a('0x26')](_0x251315)[_0x8a8a('0x27')]();};}function respondWithResult(_0x2e217a,_0x54ff7e){_0x54ff7e=_0x54ff7e||0xc8;return function(_0x58f42b){if(_0x58f42b){return _0x2e217a[_0x8a8a('0x26')](_0x54ff7e)[_0x8a8a('0x28')](_0x58f42b);}};}function respondWithFilteredResult(_0x5c70bd,_0x4d8760){return function(_0x4b3bc5){if(_0x4b3bc5){var _0x78fd48=typeof _0x4d8760['offset']===_0x8a8a('0x29')&&typeof _0x4d8760[_0x8a8a('0x2a')]==='undefined';var _0x36c7f8=_0x4b3bc5[_0x8a8a('0x2b')];var _0x250852=_0x78fd48?0x0:_0x4d8760[_0x8a8a('0x2c')];var _0x41802e=_0x78fd48?_0x4b3bc5[_0x8a8a('0x2b')]:_0x4d8760[_0x8a8a('0x2c')]+_0x4d8760[_0x8a8a('0x2a')];var _0x5768a6;if(_0x41802e>=_0x36c7f8){_0x41802e=_0x36c7f8;_0x5768a6=0xc8;}else{_0x5768a6=0xce;}_0x5c70bd['status'](_0x5768a6);return _0x5c70bd['set'](_0x8a8a('0x2d'),_0x250852+'-'+_0x41802e+'/'+_0x36c7f8)[_0x8a8a('0x28')](_0x4b3bc5);}return null;};}function saveUpdates(_0x5f301e){return function(_0x2b5dc9){if(_0x2b5dc9){return _0x2b5dc9[_0x8a8a('0x2e')](_0x5f301e)['then'](function(_0x3abab2){return _0x3abab2;});}return null;};}function removeEntity(_0x431b3a){return function(_0x63b9be){if(_0x63b9be){return _0x63b9be['destroy']()['then'](function(){var _0x8457a0=_0x63b9be['get']({'plain':!![]});var _0x2a3198=_0x8a8a('0x2f');return db[_0x8a8a('0x30')][_0x8a8a('0x31')]({'where':{'type':_0x2a3198,'resourceId':_0x8457a0['id']}})[_0x8a8a('0x1c')](function(){return _0x63b9be;});})[_0x8a8a('0x1c')](function(){_0x431b3a[_0x8a8a('0x26')](0xcc)[_0x8a8a('0x27')]();});}};}function handleEntityNotFound(_0x320398){return function(_0xf7d4d7){if(!_0xf7d4d7){_0x320398[_0x8a8a('0x32')](0x194);}return _0xf7d4d7;};}function handleError(_0x45ddb4,_0x17a36c){_0x17a36c=_0x17a36c||0x1f4;return function(_0x37e644){logger[_0x8a8a('0x22')](_0x37e644[_0x8a8a('0x33')]);if(_0x37e644[_0x8a8a('0x34')]){delete _0x37e644[_0x8a8a('0x34')];}_0x45ddb4['status'](_0x17a36c)['send'](_0x37e644);};}function createInteractionObject(_0x53da01,_0x34db33,_0x9e0128,_0x376de3){var _0x117a5c=require(_0x8a8a('0x35'));var _0x508e67=new _0x117a5c();var _0x4ee92e=_0x508e67[_0x8a8a('0x36')](_0x9e0128['user-agent'])[_0x8a8a('0x37')]();var _0x5c210e=_0x34db33['customerIp'];if(_0x9e0128[_0x8a8a('0x38')]){_0x5c210e=_0x9e0128[_0x8a8a('0x38')];}else if(_0x9e0128[_0x8a8a('0x39')]){_0x5c210e=_[_0x8a8a('0x3a')](_0x9e0128[_0x8a8a('0x39')][_0x8a8a('0x3b')](','));}return{'ContactId':_0x376de3['id'],'ChatWebsiteId':_0x53da01,'from':(_0x376de3[_0x8a8a('0x3c')]||'')+'\x20'+(_0x376de3['lastName']||''),'customerIp':_0x5c210e,'customerPort':_0x9e0128[_0x8a8a('0x3d')]?_0x9e0128[_0x8a8a('0x3d')]:null,'referer':_0x34db33[_0x8a8a('0x3e')],'browserName':_0x4ee92e['browser'][_0x8a8a('0x34')]&&_0x4ee92e[_0x8a8a('0x3f')][_0x8a8a('0x40')]?util['format'](_0x8a8a('0x41'),_0x4ee92e[_0x8a8a('0x3f')][_0x8a8a('0x34')],_0x4ee92e[_0x8a8a('0x3f')][_0x8a8a('0x40')]):_0x8a8a('0x42'),'browserVersion':_0x4ee92e['browser']['version']||_0x8a8a('0x42'),'osName':util['format'](_0x8a8a('0x41'),_0x4ee92e['os'][_0x8a8a('0x34')],_0x4ee92e['os']['version']),'osVersion':_0x4ee92e['os']['version'],'deviceModel':_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x44')]&&_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x45')]?util['format'](_0x8a8a('0x46'),_0x4ee92e['device'][_0x8a8a('0x44')],_0x4ee92e[_0x8a8a('0x43')]['vendor'],_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x47')]):null,'deviceVendor':_0x4ee92e[_0x8a8a('0x43')]['vendor'],'deviceType':_0x4ee92e[_0x8a8a('0x43')][_0x8a8a('0x47')],'formData':JSON[_0x8a8a('0x48')](_0x34db33)};}exports['index']=function(_0x5466d4,_0x44aed3){var _0x1eb8bf={'include':[{'model':db[_0x8a8a('0x49')],'as':_0x8a8a('0x4a')}]},_0x1b842a={},_0x5c6c98={'count':0x0,'rows':[]};var _0x86588c=_[_0x8a8a('0x4b')](db[_0x8a8a('0x4c')][_0x8a8a('0x4d')],function(_0x13c233){return{'name':_0x13c233[_0x8a8a('0x4e')],'type':_0x13c233[_0x8a8a('0x47')][_0x8a8a('0x4f')]};});_0x1b842a[_0x8a8a('0x44')]=_['map'](_0x86588c,_0x8a8a('0x34'));_0x1b842a[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x5466d4[_0x8a8a('0x50')]);_0x1b842a[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x1b842a['model'],_0x1b842a[_0x8a8a('0x50')]);_0x1eb8bf[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x1b842a[_0x8a8a('0x44')],qs['fields'](_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x1eb8bf[_0x8a8a('0x54')]=_0x1eb8bf['attributes']['length']?_0x1eb8bf[_0x8a8a('0x54')]:_0x1b842a[_0x8a8a('0x44')];if(!_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x56')](_0x8a8a('0x57'))){_0x1eb8bf[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x1eb8bf['offset']=qs['offset'](_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}_0x1eb8bf['order']=qs['sort'](_0x5466d4[_0x8a8a('0x50')]['sort']);_0x1eb8bf[_0x8a8a('0x58')]=qs['filters'](_[_0x8a8a('0x59')](_0x5466d4[_0x8a8a('0x50')],_0x1b842a[_0x8a8a('0x52')]),_0x86588c);if(_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x5a')]){_0x1eb8bf[_0x8a8a('0x58')]=_[_0x8a8a('0x5b')](_0x1eb8bf[_0x8a8a('0x58')],{'$or':_[_0x8a8a('0x4b')](_0x86588c,function(_0x2c771e){if(_0x2c771e['type']!==_0x8a8a('0x5c')){var _0x133bae={};_0x133bae[_0x2c771e[_0x8a8a('0x34')]]={'$like':'%'+_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x5a')]+'%'};return _0x133bae;}})});}_0x1eb8bf=_['merge']({},_0x1eb8bf,_0x5466d4[_0x8a8a('0x5d')]);var _0x140673={'where':_0x1eb8bf['where']};return db['ChatWebsite'][_0x8a8a('0x2b')](_0x140673)[_0x8a8a('0x1c')](function(_0x322b4c){_0x5c6c98[_0x8a8a('0x2b')]=_0x322b4c;if(_0x5466d4[_0x8a8a('0x50')][_0x8a8a('0x5e')]){_0x1eb8bf['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x1eb8bf);})[_0x8a8a('0x1c')](function(_0x54d848){_0x5c6c98[_0x8a8a('0x5f')]=_0x54d848;return _0x5c6c98;})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x44aed3,_0x1eb8bf))['catch'](handleError(_0x44aed3,null));};exports[_0x8a8a('0x60')]=function(_0x38ba9f,_0x183f88){var _0x119fb5={'raw':![],'where':{'id':_0x38ba9f[_0x8a8a('0x61')]['id']},'include':[{'model':db['Pause'],'as':_0x8a8a('0x4a')}]},_0x4cf6ae={};_0x4cf6ae[_0x8a8a('0x44')]=_['keys'](db[_0x8a8a('0x4c')][_0x8a8a('0x4d')]);_0x4cf6ae[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x38ba9f['query']);_0x4cf6ae[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x4cf6ae[_0x8a8a('0x44')],_0x4cf6ae['query']);_0x119fb5['attributes']=_[_0x8a8a('0x53')](_0x4cf6ae['model'],qs['fields'](_0x38ba9f['query'][_0x8a8a('0x55')]));_0x119fb5[_0x8a8a('0x54')]=_0x119fb5['attributes'][_0x8a8a('0x62')]?_0x119fb5['attributes']:_0x4cf6ae['model'];if(_0x38ba9f[_0x8a8a('0x50')][_0x8a8a('0x5e')]){_0x119fb5['include']=[{'all':!![]}];}_0x119fb5=_[_0x8a8a('0x5b')]({},_0x119fb5,_0x38ba9f[_0x8a8a('0x5d')]);return db[_0x8a8a('0x4c')][_0x8a8a('0x63')](_0x119fb5)[_0x8a8a('0x1c')](handleEntityNotFound(_0x183f88,null))[_0x8a8a('0x1c')](respondWithResult(_0x183f88,null))['catch'](handleError(_0x183f88,null));};exports[_0x8a8a('0x64')]=function(_0x402b5f,_0x587ea8){var _0x2ce579=null;_0x402b5f[_0x8a8a('0x65')][_0x8a8a('0x66')][_0x8a8a('0x3b')](',')[_0x8a8a('0x67')](_0x450afc=>{if(_0x450afc[_0x8a8a('0x68')]()!==''&&!wildcardUtils[_0x8a8a('0x69')](_0x450afc[_0x8a8a('0x68')]())){_0x2ce579=new APIBadRequestError('\x22'+_0x450afc[_0x8a8a('0x68')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x2ce579){return handleError(_0x587ea8,null)(_0x2ce579);}return db[_0x8a8a('0x4c')][_0x8a8a('0x64')](_0x402b5f['body'],{})[_0x8a8a('0x1c')](function(_0x1f90af){var _0x2640e3=_0x402b5f[_0x8a8a('0x6a')][_0x8a8a('0x6b')]({'plain':!![]});if(!_0x2640e3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2640e3[_0x8a8a('0x6c')]===_0x8a8a('0x6a')){var _0x3edc54=_0x1f90af[_0x8a8a('0x6b')]({'plain':!![]});var _0x3fc483=_0x8a8a('0x2f');return db[_0x8a8a('0x6d')]['find']({'where':{'name':_0x3fc483,'userProfileId':_0x2640e3[_0x8a8a('0x6e')]},'raw':!![]})[_0x8a8a('0x1c')](function(_0x35ed30){if(_0x35ed30&&_0x35ed30['autoAssociation']===0x0){return db[_0x8a8a('0x30')]['create']({'name':_0x3edc54[_0x8a8a('0x34')],'resourceId':_0x3edc54['id'],'type':_0x35ed30[_0x8a8a('0x34')],'sectionId':_0x35ed30['id']},{})['then'](function(){return _0x1f90af;});}else{return _0x1f90af;}})[_0x8a8a('0x25')](function(_0x42891b){logger[_0x8a8a('0x22')](_0x8a8a('0x6f'),_0x42891b);throw _0x42891b;});}return _0x1f90af;})[_0x8a8a('0x1c')](respondWithResult(_0x587ea8,0xc9))[_0x8a8a('0x25')](handleError(_0x587ea8,null));};exports[_0x8a8a('0x2e')]=function(_0x25b684,_0x31c0dc){var _0x218e5b=null;_0x25b684[_0x8a8a('0x65')][_0x8a8a('0x66')][_0x8a8a('0x3b')](',')[_0x8a8a('0x67')](_0x8a0a49=>{if(_0x8a0a49[_0x8a8a('0x68')]()!==''&&!wildcardUtils[_0x8a8a('0x69')](_0x8a0a49[_0x8a8a('0x68')]())){_0x218e5b=new APIBadRequestError('\x22'+_0x8a0a49['trim']()+_0x8a8a('0x70'));}});if(_0x218e5b){return handleError(_0x31c0dc,null)(_0x218e5b);}if(_0x25b684['body']['id']){delete _0x25b684[_0x8a8a('0x65')]['id'];}return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x25b684['params']['id']},'include':[{'model':db['Pause'],'as':_0x8a8a('0x4a')}]})[_0x8a8a('0x1c')](handleEntityNotFound(_0x31c0dc,null))[_0x8a8a('0x1c')](saveUpdates(_0x25b684['body'],null))['then'](respondWithResult(_0x31c0dc,null))[_0x8a8a('0x25')](handleError(_0x31c0dc,null));};exports[_0x8a8a('0x31')]=function(_0x46a556,_0x155cc4){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x46a556[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x155cc4,null))['then'](removeEntity(_0x155cc4,null))[_0x8a8a('0x25')](handleError(_0x155cc4,null));};exports[_0x8a8a('0x71')]=function(_0x4a906c,_0x3158f2){return db[_0x8a8a('0x4c')][_0x8a8a('0x71')]()[_0x8a8a('0x1c')](respondWithResult(_0x3158f2,null))[_0x8a8a('0x25')](handleError(_0x3158f2,null));};exports[_0x8a8a('0x72')]=function(_0x4a886f,_0x2924a4){if(_0x4a886f[_0x8a8a('0x65')]['id']){delete _0x4a886f[_0x8a8a('0x65')]['id'];}return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x4a886f['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2924a4,null))[_0x8a8a('0x1c')](function(_0x34d140){if(_0x34d140){_0x4a886f[_0x8a8a('0x65')][_0x8a8a('0x73')]=_0x34d140['id'];return db[_0x8a8a('0x74')][_0x8a8a('0x64')](_0x4a886f[_0x8a8a('0x65')]);}})[_0x8a8a('0x1c')](respondWithResult(_0x2924a4,null))[_0x8a8a('0x25')](handleError(_0x2924a4,null));};exports['getDispositions']=function(_0x306a50,_0x20b40e){var _0x3bb8d7={'raw':![],'where':{}};var _0x3391b5={};var _0xb74976={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x306a50[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x20b40e,null))[_0x8a8a('0x1c')](function(_0x50b105){if(_0x50b105){_0x3391b5[_0x8a8a('0x44')]=_[_0x8a8a('0x51')](db[_0x8a8a('0x74')][_0x8a8a('0x4d')]);_0x3391b5['query']=_[_0x8a8a('0x51')](_0x306a50[_0x8a8a('0x50')]);_0x3391b5[_0x8a8a('0x52')]=_['intersection'](_0x3391b5['model'],_0x3391b5['query']);_0x3bb8d7[_0x8a8a('0x54')]=_['intersection'](_0x3391b5[_0x8a8a('0x44')],qs['fields'](_0x306a50['query'][_0x8a8a('0x55')]));_0x3bb8d7['attributes']=_0x3bb8d7['attributes']['length']?_0x3bb8d7[_0x8a8a('0x54')]:_0x3391b5['model'];if(!_0x306a50['query'][_0x8a8a('0x56')]('nolimit')){_0x3bb8d7[_0x8a8a('0x2a')]=qs['limit'](_0x306a50[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x3bb8d7[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x306a50['query'][_0x8a8a('0x2c')]);}_0x3bb8d7[_0x8a8a('0x75')]=qs['sort'](_0x306a50[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x3bb8d7[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_['pick'](_0x306a50['query'],_0x3391b5[_0x8a8a('0x52')]));_0x3bb8d7[_0x8a8a('0x58')][_0x8a8a('0x73')]=_0x50b105['id'];if(_0x306a50['query'][_0x8a8a('0x5a')]){_0x3bb8d7[_0x8a8a('0x58')]=_[_0x8a8a('0x5b')](_0x3bb8d7['where'],{'$or':_[_0x8a8a('0x4b')](_0x3bb8d7[_0x8a8a('0x54')],function(_0x1e60a6){var _0x3a7e46={};_0x3a7e46[_0x1e60a6]={'$like':'%'+_0x306a50[_0x8a8a('0x50')]['filter']+'%'};return _0x3a7e46;})});}_0x3bb8d7=_[_0x8a8a('0x5b')]({},_0x3bb8d7,_0x306a50[_0x8a8a('0x5d')]);return db[_0x8a8a('0x74')][_0x8a8a('0x2b')]({'where':_0x3bb8d7[_0x8a8a('0x58')]})[_0x8a8a('0x1c')](function(_0x276126){_0xb74976['count']=_0x276126;if(_0x306a50['query'][_0x8a8a('0x5e')]){_0x3bb8d7[_0x8a8a('0x77')]=[{'all':!![]}];}return db[_0x8a8a('0x74')]['findAll'](_0x3bb8d7);})[_0x8a8a('0x1c')](function(_0xd53cec){_0xb74976[_0x8a8a('0x5f')]=_0xd53cec;return _0xb74976;});}})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x20b40e,_0x3bb8d7))[_0x8a8a('0x25')](handleError(_0x20b40e,null));};exports[_0x8a8a('0x78')]=function(_0x3a0e27,_0x26d57f){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x3a0e27['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x26d57f,null))[_0x8a8a('0x1c')](function(_0x311c6c){if(_0x311c6c){return _0x311c6c['removeDispositions'](_0x3a0e27[_0x8a8a('0x50')][_0x8a8a('0x79')]);}})[_0x8a8a('0x1c')](respondWithStatusCode(_0x26d57f,null))['catch'](handleError(_0x26d57f,null));};exports['addAnswer']=function(_0x1f409b,_0x450b1a){if(_0x1f409b[_0x8a8a('0x65')]['id']){delete _0x1f409b[_0x8a8a('0x65')]['id'];}return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x1f409b[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x450b1a,null))[_0x8a8a('0x1c')](function(_0x5df060){if(_0x5df060){_0x1f409b['body'][_0x8a8a('0x73')]=_0x5df060['id'];return db[_0x8a8a('0x7a')][_0x8a8a('0x64')](_0x1f409b['body']);}})[_0x8a8a('0x1c')](respondWithResult(_0x450b1a,null))[_0x8a8a('0x25')](handleError(_0x450b1a,null));};exports[_0x8a8a('0x7b')]=function(_0x198083,_0x31f2e6){var _0x5ac7b7={'raw':![],'where':{}};var _0x5ac592={};var _0x5d727e={'count':0x0,'rows':[]};return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x198083[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x31f2e6,null))[_0x8a8a('0x1c')](function(_0x34502e){if(_0x34502e){_0x5ac592['model']=_[_0x8a8a('0x51')](db[_0x8a8a('0x7a')]['rawAttributes']);_0x5ac592['query']=_[_0x8a8a('0x51')](_0x198083[_0x8a8a('0x50')]);_0x5ac592['filters']=_[_0x8a8a('0x53')](_0x5ac592['model'],_0x5ac592['query']);_0x5ac7b7[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x5ac592[_0x8a8a('0x44')],qs['fields'](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x5ac7b7[_0x8a8a('0x54')]=_0x5ac7b7[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x5ac7b7[_0x8a8a('0x54')]:_0x5ac592['model'];if(!_0x198083['query']['hasOwnProperty'](_0x8a8a('0x57'))){_0x5ac7b7[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x5ac7b7[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}_0x5ac7b7['order']=qs[_0x8a8a('0x76')](_0x198083[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x5ac7b7[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_[_0x8a8a('0x59')](_0x198083['query'],_0x5ac592['filters']));_0x5ac7b7['where'][_0x8a8a('0x73')]=_0x34502e['id'];if(_0x198083['query'][_0x8a8a('0x5a')]){_0x5ac7b7['where']=_[_0x8a8a('0x5b')](_0x5ac7b7['where'],{'$or':_[_0x8a8a('0x4b')](_0x5ac7b7[_0x8a8a('0x54')],function(_0x5e8094){var _0x12110e={};_0x12110e[_0x5e8094]={'$like':'%'+_0x198083['query']['filter']+'%'};return _0x12110e;})});}_0x5ac7b7=_[_0x8a8a('0x5b')]({},_0x5ac7b7,_0x198083['options']);return db[_0x8a8a('0x7a')]['count']({'where':_0x5ac7b7[_0x8a8a('0x58')]})['then'](function(_0x34aa82){_0x5d727e[_0x8a8a('0x2b')]=_0x34aa82;if(_0x198083[_0x8a8a('0x50')][_0x8a8a('0x5e')]){_0x5ac7b7['include']=[{'all':!![]}];}return db[_0x8a8a('0x7a')][_0x8a8a('0x7d')](_0x5ac7b7);})[_0x8a8a('0x1c')](function(_0x33ac80){_0x5d727e['rows']=_0x33ac80;return _0x5d727e;});}})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x31f2e6,_0x5ac7b7))[_0x8a8a('0x25')](handleError(_0x31f2e6,null));};exports[_0x8a8a('0x7e')]=function(_0x4e4983,_0xd5f3cf){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x4e4983[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0xd5f3cf,null))['then'](function(_0x5b5087){if(_0x5b5087){return _0x5b5087[_0x8a8a('0x7e')](_0x4e4983[_0x8a8a('0x50')][_0x8a8a('0x79')]);}})['then'](respondWithStatusCode(_0xd5f3cf,null))[_0x8a8a('0x25')](handleError(_0xd5f3cf,null));};exports[_0x8a8a('0x7f')]=function(_0x559f13,_0x568cb2){_0x559f13[_0x8a8a('0x65')][_0x8a8a('0x80')]=_0x559f13[_0x8a8a('0x81')]['filename'];return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x559f13['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x568cb2,null))[_0x8a8a('0x1c')](saveUpdates(_0x559f13['body'],null))[_0x8a8a('0x1c')](respondWithResult(_0x568cb2,null))['catch'](handleError(_0x568cb2,null));};exports[_0x8a8a('0x82')]=function(_0x16a4a8,_0x575f64){_0x16a4a8[_0x8a8a('0x65')][_0x8a8a('0x83')]=_0x16a4a8['file'][_0x8a8a('0x84')];return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x16a4a8[_0x8a8a('0x61')]['id']}})['then'](handleEntityNotFound(_0x575f64,null))[_0x8a8a('0x1c')](saveUpdates(_0x16a4a8[_0x8a8a('0x65')],null))[_0x8a8a('0x1c')](respondWithResult(_0x575f64,null))['catch'](handleError(_0x575f64,null));};exports[_0x8a8a('0x85')]=function(_0x4d1fc0,_0x269d17){_0x4d1fc0[_0x8a8a('0x65')][_0x8a8a('0x86')]=_0x4d1fc0[_0x8a8a('0x81')][_0x8a8a('0x84')];return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x4d1fc0[_0x8a8a('0x61')]['id']}})['then'](handleEntityNotFound(_0x269d17,null))[_0x8a8a('0x1c')](saveUpdates(_0x4d1fc0[_0x8a8a('0x65')],null))[_0x8a8a('0x1c')](respondWithResult(_0x269d17,null))['catch'](handleError(_0x269d17,null));};exports['addSystemAvatar']=function(_0x35d9e2,_0x1cb3aa){_0x35d9e2[_0x8a8a('0x65')][_0x8a8a('0x87')]=_0x35d9e2[_0x8a8a('0x81')][_0x8a8a('0x84')];return db[_0x8a8a('0x4c')]['find']({'where':{'id':_0x35d9e2['params']['id']}})['then'](handleEntityNotFound(_0x1cb3aa,null))[_0x8a8a('0x1c')](saveUpdates(_0x35d9e2[_0x8a8a('0x65')],null))[_0x8a8a('0x1c')](respondWithResult(_0x1cb3aa,null))['catch'](handleError(_0x1cb3aa,null));};exports[_0x8a8a('0x88')]=function(_0xe6030b,_0x39d705){var _0x19c264=path[_0x8a8a('0x89')](config['root'],_0x8a8a('0x8a'));var _0xde7f73={'where':{'id':_0xe6030b[_0x8a8a('0x61')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x913a2f=![];return require(_0x8a8a('0x8b'))[_0x8a8a('0x8c')]()['then'](function(_0x4a2af9){if(_0x4a2af9){_0x913a2f=_0x4a2af9[_0x8a8a('0x8d')];}})[_0x8a8a('0x1c')](function(){return db[_0x8a8a('0x4c')]['find'](_0xde7f73);})[_0x8a8a('0x1c')](handleEntityNotFound(_0x39d705,null))[_0x8a8a('0x1c')](function(_0x5b555e){if(_0x5b555e){if(!_[_0x8a8a('0x8e')](_0x5b555e[_0x8a8a('0x80')])){if(fs['existsSync'](path[_0x8a8a('0x89')](config['root'],'server/files/images/logos/',_0x5b555e[_0x8a8a('0x80')]))&&_0x913a2f){_0x19c264=path[_0x8a8a('0x89')](config['root'],'server/files/images/logos/',_0x5b555e['sitepic']);}}return _0x39d705[_0x8a8a('0x8f')](_0x19c264);}})['catch'](handleError(_0x39d705,null));};exports['getAvatar']=function(_0xc0fb22,_0x69e16){var _0x58ac24=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x91'));var _0x43ab4d={'where':{'id':_0xc0fb22[_0x8a8a('0x61')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x8a8a('0x4c')]['find'](_0x43ab4d)[_0x8a8a('0x1c')](handleEntityNotFound(_0x69e16,null))[_0x8a8a('0x1c')](function(_0x9bd75e){if(_0x9bd75e){if(!_[_0x8a8a('0x8e')](_0x9bd75e['agentAvatar'])){if(fs['existsSync'](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],'server/files/images/avatars/',_0x9bd75e[_0x8a8a('0x83')]))){_0x58ac24=path[_0x8a8a('0x89')](config['root'],_0x8a8a('0x92'),_0x9bd75e[_0x8a8a('0x83')]);}}return _0x69e16[_0x8a8a('0x8f')](_0x58ac24);}})['catch'](handleError(_0x69e16,null));};exports['getCustomerAvatar']=function(_0x83f17d,_0x4d9d70){var _0x46aff7=path['join'](config[_0x8a8a('0x90')],'server/files/images/avatars/customer_avatar.png');var _0x4caec3={'where':{'id':_0x83f17d['params']['id']},'attributes':['id','customerAvatar',_0x8a8a('0x93')],'raw':!![]};return db[_0x8a8a('0x4c')][_0x8a8a('0x63')](_0x4caec3)['then'](handleEntityNotFound(_0x4d9d70,null))[_0x8a8a('0x1c')](function(_0x16b941){if(_0x16b941){if(!_[_0x8a8a('0x8e')](_0x16b941[_0x8a8a('0x86')])){if(fs[_0x8a8a('0x94')](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],'server/files/images/avatars/',_0x16b941['customerAvatar']))&&_0x16b941[_0x8a8a('0x93')]){_0x46aff7=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],'server/files/images/avatars/',_0x16b941[_0x8a8a('0x86')]);}}return _0x4d9d70[_0x8a8a('0x8f')](_0x46aff7);}})[_0x8a8a('0x25')](handleError(_0x4d9d70,null));};exports[_0x8a8a('0x95')]=function(_0x5130d3,_0x5023d7){var _0x45647=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x96'));var _0x3a30c6={'where':{'id':_0x5130d3[_0x8a8a('0x61')]['id']},'attributes':['id',_0x8a8a('0x87')],'raw':!![]};return db[_0x8a8a('0x4c')][_0x8a8a('0x63')](_0x3a30c6)[_0x8a8a('0x1c')](handleEntityNotFound(_0x5023d7,null))[_0x8a8a('0x1c')](function(_0x5376b6){if(_0x5376b6){if(!_[_0x8a8a('0x8e')](_0x5376b6[_0x8a8a('0x87')])){if(fs[_0x8a8a('0x94')](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x92'),_0x5376b6[_0x8a8a('0x87')]))){_0x45647=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x92'),_0x5376b6[_0x8a8a('0x87')]);}}return _0x5023d7['download'](_0x45647);}})[_0x8a8a('0x25')](handleError(_0x5023d7,null));};function checkWebsiteInterval(_0x211dfc){var _0x2d7ed6=_0x211dfc[_0x8a8a('0x97')];if(!_0x2d7ed6){return Promise['resolve'](_0x211dfc);}var _0x44561a=_0x211dfc[_0x8a8a('0x98')]||undefined;return _0x2d7ed6[_0x8a8a('0x99')](_0x44561a)[_0x8a8a('0x1c')](function(_0x474e27){if(!_0x474e27){throw new APIOutOfIntervalError();}return _0x211dfc;});}exports[_0x8a8a('0x9a')]=function(_0x59ed64,_0x33667d){var _0x3c2e96={'body':_0x59ed64[_0x8a8a('0x65')],'channel':_0x8a8a('0x9b')};var _0x35bb17=[];var _0x17e607=[];var _0x184310={};var _0xfa3640=![];if(_0x59ed64['body']['id']){delete _0x59ed64[_0x8a8a('0x65')]['id'];}if(_[_0x8a8a('0x8e')](_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9c')])){throw new APIBadRequestError(_0x8a8a('0x9d'));}if(_[_0x8a8a('0x8e')](_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9e')])){throw new APIBadRequestError(_0x8a8a('0x9f'));}if(_['isEmpty'](_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x65')])){throw new APIBadRequestError(_0x8a8a('0xa0'));}var _0x1f54d4=_0x59ed64[_0x8a8a('0x65')]['customerIp']&&_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x3e')];return db[_0x8a8a('0xa1')][_0x8a8a('0x71')]()[_0x8a8a('0x1c')](function(_0x55e474){if(!_0x55e474){throw new Error('No\x20available\x20attributes');}_0x35bb17=Object['keys'](_0x55e474)[_0x8a8a('0x5a')](function(_0x3074a2){return![_0x8a8a('0xa2'),_0x8a8a('0xa3')][_0x8a8a('0xa4')](_0x3074a2);});_0x17e607=Object[_0x8a8a('0x51')](_0x55e474)['filter'](function(_0x1c7c8a){return![_0x8a8a('0xa2'),_0x8a8a('0xa3'),'CompanyId',_0x8a8a('0xa5')][_0x8a8a('0xa4')](_0x1c7c8a);});if(!_[_0x8a8a('0xa4')](_0x17e607,_0x59ed64['body'][_0x8a8a('0x9e')])){throw new APIBadRequestError(_0x8a8a('0xa6')+_0x17e607['join'](',\x20'));}_0x184310[_0x59ed64['body'][_0x8a8a('0x9e')]]=_0x59ed64['body']['from'];})['then'](function(){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x59ed64[_0x8a8a('0x61')]['id']},'include':[{'model':db[_0x8a8a('0xa7')],'as':'List','include':[{'model':db[_0x8a8a('0xa1')],'as':'Contacts','where':_0x184310,'limit':0x1,'order':[[_0x8a8a('0xa3'),_0x8a8a('0xa8')]]}]},{'model':db['ChatApplication'],'as':_0x8a8a('0xa9')},{'model':db[_0x8a8a('0x97')],'as':'Interval','include':[{'model':db[_0x8a8a('0x97')],'as':_0x8a8a('0xaa'),'attributes':['id','interval'],'raw':!![]}]}]});})[_0x8a8a('0x1c')](function(_0x1dc93c){if(!_0x1dc93c){throw new APINotFoundError(util[_0x8a8a('0xab')](_0x8a8a('0xac'),_0x59ed64[_0x8a8a('0x61')]['id']));}if(_0x1f54d4){return checkWebsiteInterval(_0x1dc93c);}return _0x1dc93c;})['then'](function(_0x5ab5e1){_0x3c2e96[_0x8a8a('0xad')]=_0x5ab5e1;_0x3c2e96[_0x8a8a('0xae')]=_['orderBy'](_0x5ab5e1[_0x8a8a('0xa9')],[_0x8a8a('0xaf')],[_0x8a8a('0xb0')]);if(_0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xa9')]){delete _0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xa9')];}_0x3c2e96[_0x8a8a('0xb1')]=_0x5ab5e1[_0x8a8a('0xb2')]||{'id':_0x5ab5e1[_0x8a8a('0xa5')]};if(_0x3c2e96[_0x8a8a('0xb1')]&&_0x3c2e96[_0x8a8a('0xb1')][_0x8a8a('0xb3')]['length']){return _0x3c2e96[_0x8a8a('0xb1')][_0x8a8a('0xb3')][0x0];}var _0x3d4dee=_['defaults'](_0x59ed64[_0x8a8a('0x65')],{'firstName':_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9c')],'ListId':_0x5ab5e1[_0x8a8a('0xa5')]});_0x3d4dee[_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9e')]]=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x9c')];return db[_0x8a8a('0xa1')][_0x8a8a('0x64')](_0x3d4dee,{'fields':_0x35bb17,'raw':!![]});})[_0x8a8a('0x1c')](function(_0x5c9358){_0x3c2e96[_0x8a8a('0xb4')]=_0x5c9358;var _0x35d518=createInteractionObject(_0x59ed64[_0x8a8a('0x61')]['id'],_0x59ed64[_0x8a8a('0x65')],_0x59ed64[_0x8a8a('0xb5')],_0x5c9358);var _0x3f0724={'ChatWebsiteId':_0x59ed64[_0x8a8a('0x61')]['id']};if(_0x59ed64['body'][_0x8a8a('0xb6')]){_0x3f0724[_0x8a8a('0xb6')]=_0x59ed64['body'][_0x8a8a('0xb6')];_0x3f0724['closed']=![];return db[_0x8a8a('0xb7')][_0x8a8a('0x63')]({'where':_0x3f0724})['then'](function(_0x2d8647){var _0x32ba47=_0x59ed64['body'][_0x8a8a('0xb8')]&&_0x59ed64[_0x8a8a('0x65')]['referer'];if(_0x2d8647){_0xfa3640=!![];return _0x2d8647;}else if(!_0x32ba47&&_0x2d8647&&_0x2d8647[_0x8a8a('0xb9')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}_0x35d518[_0x8a8a('0xb6')]=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xb6')];_0x35d518['externalUrl']=_0x59ed64['body'][_0x8a8a('0xba')];return db['ChatInteraction'][_0x8a8a('0x64')](_0x35d518);});}_0x3f0724['ContactId']=_0x5c9358['id'];if(_0x59ed64['body'][_0x8a8a('0xbb')]&&_0x59ed64['body']['interaction']['id']){_0x3f0724['id']=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xbb')]['id'];return db[_0x8a8a('0xb7')][_0x8a8a('0x63')]({'where':_0x3f0724})[_0x8a8a('0x1c')](function(_0x4cb1da){var _0x3d757a=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xb8')]&&_0x59ed64['body'][_0x8a8a('0x3e')];if(!_0x3d757a&&_0x4cb1da&&_0x4cb1da['closed']){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x4cb1da){_0xfa3640=!![];return _0x4cb1da;}else{return db['ChatInteraction'][_0x8a8a('0x64')](_0x35d518);}});}return db['ChatInteraction']['create'](_0x35d518);})['then'](function(_0x203b2d){if(!_0xfa3640){return _0x203b2d;}var _0x159c37={'from':(_0x3c2e96[_0x8a8a('0xb4')][_0x8a8a('0x3c')]||'')+'\x20'+(_0x3c2e96['contact'][_0x8a8a('0xbc')]||'')};if(_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xb6')]&&_0x59ed64['body'][_0x8a8a('0xbd')]&&_0x59ed64['body']['threadId']!=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xbd')]){_0x159c37[_0x8a8a('0xb6')]=_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xbd')];}return _0x203b2d['update'](_0x159c37);})[_0x8a8a('0x1c')](function(_0x33e008){_0x3c2e96[_0x8a8a('0xbb')]=_0x33e008[_0x8a8a('0x6b')]({'plain':!![]});_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xbe')]=!_0xfa3640;if(_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xbe')]){if(_0x3c2e96[_0x8a8a('0xad')]['autoclose']){_0x3c2e96[_0x8a8a('0xae')]['push']({'id':0x0,'priority':_0x3c2e96[_0x8a8a('0xae')][_0x8a8a('0x62')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x8a8a('0xbf')});}}return db[_0x8a8a('0xc0')][_0x8a8a('0x64')]({'body':_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0x65')],'ChatWebsiteId':_0x59ed64[_0x8a8a('0x61')]['id'],'ChatInteractionId':_0x33e008['id'],'direction':'in','ContactId':_0x3c2e96[_0x8a8a('0xb4')]['id'],'AttachmentId':_0x59ed64[_0x8a8a('0x65')][_0x8a8a('0xc1')]});})[_0x8a8a('0x1c')](function(_0x3e4b43){_0x3c2e96[_0x8a8a('0x23')]=_0x3e4b43;if(!_0x3c2e96[_0x8a8a('0xbb')]['UserId']){return;}return db[_0x8a8a('0xc2')][_0x8a8a('0x63')]({'attributes':['id',_0x8a8a('0x34')],'where':{'id':_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xc3')]}});})[_0x8a8a('0x1c')](function(_0x5a7fcd){if(_0x5a7fcd){_0x3c2e96[_0x8a8a('0xae')][_0x8a8a('0xc4')]({'id':0x0,'priority':0x0,'app':_0x8a8a('0xc5'),'appdata':_0x5a7fcd[_0x8a8a('0x34')]+','+(_0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xc6')]||0xa),'interval':_0x8a8a('0xbf')});_0x3c2e96[_0x8a8a('0xc7')]=!![];}if(!_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xc8')]){return;}return db[_0x8a8a('0xc9')][_0x8a8a('0x63')]({'attributes':['id',_0x8a8a('0x34')],'where':{'id':_0x3c2e96[_0x8a8a('0xbb')][_0x8a8a('0xc8')]}});})[_0x8a8a('0x1c')](function(_0x433051){if(_0x433051){_0x3c2e96[_0x8a8a('0xae')][_0x8a8a('0xc4')]({'id':0x0,'priority':0x1,'app':_0x8a8a('0xca'),'appdata':_0x433051[_0x8a8a('0x34')]+','+(_0x3c2e96[_0x8a8a('0xad')][_0x8a8a('0xcb')]||0x12c),'interval':_0x8a8a('0xbf')});}return respondWithRpcPromise('Start','startRouting',_0x3c2e96);})[_0x8a8a('0x1c')](function(_0x55d97e){respondWithRpcPromise(_0x8a8a('0xcc'),_0x8a8a('0xcc'),{'event':_0x8a8a('0x9a'),'message':_0x55d97e},client9002);return _0x55d97e;})[_0x8a8a('0x1c')](respondWithResult(_0x33667d,null))['catch'](APIHandleError(_0x33667d));};exports[_0x8a8a('0xcd')]=function(_0x1cad71,_0x2ae822){var _0xb988c3,_0x36e8c6,_0x204dde;var _0x155a64=[];var _0x21504d={};var _0x123c98=_0x1cad71[_0x8a8a('0xce')]||[];var _0x2c82d4=[];var _0x4bf38e;return db[_0x8a8a('0xa1')][_0x8a8a('0x71')]()[_0x8a8a('0x1c')](function(_0xb2fc5b){if(!_0xb2fc5b){throw new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd1'));}_0x155a64=_[_0x8a8a('0xd2')](_[_0x8a8a('0x51')](_0xb2fc5b),[_0x8a8a('0xa2'),_0x8a8a('0xa3'),'CompanyId',_0x8a8a('0xa5')]);if(_0x1cad71[_0x8a8a('0x65')]['id']){delete _0x1cad71[_0x8a8a('0x65')]['id'];}if(_[_0x8a8a('0x8e')](_0x1cad71[_0x8a8a('0x65')]['from'])){throw _0x2ae822['status'](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd4')));}if(_[_0x8a8a('0x8e')](_0x1cad71['body'][_0x8a8a('0x65')])||_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x65')]===''){throw _0x2ae822[_0x8a8a('0x26')](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x8a8a('0x8e')](_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0xd5')])){throw _0x2ae822[_0x8a8a('0x26')](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd6')+_0x155a64));}if(!_[_0x8a8a('0xa4')](_0x155a64,_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0xd5')])){throw _0x2ae822['status'](0x1f4)[_0x8a8a('0xd3')](new db[(_0x8a8a('0xcf'))][(_0x8a8a('0xd0'))](_0x8a8a('0xd7')+_0x155a64));}_0x21504d[_0x1cad71[_0x8a8a('0x65')]['mapKeyOffline']]=_0x1cad71['body'][_0x8a8a('0x9c')];})[_0x8a8a('0x1c')](function(){return db['ChatWebsite'][_0x8a8a('0x63')]({'where':{'id':_0x1cad71[_0x8a8a('0x61')]['id']},'include':[{'model':db['CmList'],'as':_0x8a8a('0xb2')},{'model':db[_0x8a8a('0xd8')],'as':_0x8a8a('0xd8')}]});})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2ae822,null))['then'](function(_0x2f68b3){if(_0x2f68b3&&_0x2f68b3[_0x8a8a('0xb2')]){_0x36e8c6=_0x2f68b3;var _0x2e583f=_[_0x8a8a('0x15')](_0x1cad71['body'],{'firstName':_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x9c')],'phone':_0x1cad71['body'][_0x8a8a('0x9c')],'ListId':_0x2f68b3[_0x8a8a('0xa5')]});_0x2e583f[_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0xd5')]]=_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x9c')];return db[_0x8a8a('0xa1')][_0x8a8a('0xd9')]({'where':_0x21504d,'defaults':_0x2e583f});}})[_0x8a8a('0xda')](function(_0x30ee47){if(_0x30ee47){_0x204dde=_0x30ee47;var _0xd1803f=fs[_0x8a8a('0xdb')](path['join'](config[_0x8a8a('0x90')],'server/files/templates/chatOfflineMessage.ejs'),_0x8a8a('0xdc'));var _0x4b334b=ejs[_0x8a8a('0xdd')](_0xd1803f,{'body':_[_0x8a8a('0xde')](_0x1cad71[_0x8a8a('0x65')][_0x8a8a('0x65')]),'bodyTitle':_0x36e8c6['offlineMessageBody']});return db[_0x8a8a('0xdf')]['create']({'body':_0x4b334b,'plainBody':htmlToText[_0x8a8a('0xe0')](_0x4b334b),'ContactId':_0x30ee47['id'],'ChatWebsiteId':_0x36e8c6['id']});}})[_0x8a8a('0x1c')](function(_0x3c292a){_0x4bf38e=_0x3c292a;if(_0x123c98[_0x8a8a('0x62')]){var _0x327020=_0x123c98[_0x8a8a('0x4b')](function(_0x1edb12){return{'name':_0x1edb12[_0x8a8a('0xe1')],'basename':_0x1edb12['filename'],'type':_0x1edb12['mimetype'],'ChatOfflineMessageId':_0x3c292a['id']};});_0x2c82d4=_0x327020[_0x8a8a('0x4b')](_0x268a78=>{var _0xb02292={'filename':_0x268a78[_0x8a8a('0x34')],'path':path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0xe2'),_0x8a8a('0xce'),_0x8a8a('0xe3'),_0x8a8a('0xe4'),_0x268a78['basename'])};return _0xb02292;});if(!_0x36e8c6['openNewInteraction']){return db[_0x8a8a('0xe5')][_0x8a8a('0xe6')](function(_0x4bffba){return db[_0x8a8a('0xe7')][_0x8a8a('0xe8')](_0x327020,{'transaction':_0x4bffba});});}}})[_0x8a8a('0x1c')](function(){if(_0x4bf38e){_0xb988c3=_0x4bf38e;return db['MailAccount'][_0x8a8a('0x7c')]({'where':{'service':!![]},'include':[{'model':db[_0x8a8a('0xe9')],'as':_0x8a8a('0xea'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':'CloudProvider','raw':!![]}]}]});}})[_0x8a8a('0x1c')](function(_0x25d338){if(_0x25d338&&_0x25d338[_0x8a8a('0xea')]&&_0x36e8c6[_0x8a8a('0xeb')]&&_0x36e8c6[_0x8a8a('0xec')]){var _0x327f00=_0x25d338[_0x8a8a('0xed')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x327f00,'message':{'from':util[_0x8a8a('0xab')](_0x8a8a('0xee'),_0x25d338['name'],_0x25d338[_0x8a8a('0xef')]||_0x25d338['Smtp']['user']),'to':_0x36e8c6['forwardOfflineAddress'],'subject':_0x36e8c6[_0x8a8a('0xf0')],'html':_0xb988c3[_0x8a8a('0x65')],'attachments':_0x2c82d4}},client9003)[_0x8a8a('0x1c')](function(){return _0xb988c3;})[_0x8a8a('0x25')](function(_0xcfd82f){logger[_0x8a8a('0x22')](_0xcfd82f);});}})['then'](function(){if(_0x36e8c6&&_0x36e8c6['openNewInteraction']&&_0x36e8c6['MailAccountId']){var _0x192040=[];if(_0x123c98[_0x8a8a('0x62')]){_0x192040=_0x123c98[_0x8a8a('0x4b')](function(_0x5843c8){return{'name':_0x5843c8['originalname'],'basename':_0x5843c8['filename'],'type':_0x5843c8[_0x8a8a('0xf1')],'ChatOfflineMessageId':_0x4bf38e['id']};});}var _0x5168b5;if(!_[_0x8a8a('0x8e')](_0x36e8c6[_0x8a8a('0xf2')])){var _0x51c6f8=_[_0x8a8a('0x4b')](_0x1cad71['body'],function(_0x51744a){return _0x51744a;});var _0x19c612=_[_0x8a8a('0xf3')](_0x51c6f8)[0x0];var _0x220434=_['mapValues'](_0x19c612,function(_0x29e6d0){return _0x29e6d0;});_0x5168b5=_0x220434[0x1][_0x36e8c6[_0x8a8a('0xf2')]];}var _0x517c95={'from':_0x204dde[_0x8a8a('0xef')],'firstName':_0x204dde[_0x8a8a('0x3c')],'lastName':_0x204dde[_0x8a8a('0xbc')],'mapKey':_0x8a8a('0xef'),'message':{'from':_0x204dde[_0x8a8a('0xef')],'to':_0x36e8c6[_0x8a8a('0xd8')]['email'],'cc':'','subject':_[_0x8a8a('0x8e')](_0x5168b5)?_0x36e8c6[_0x8a8a('0xf0')]:_0x5168b5,'messageId':'','sentAt':new Date(),'attach':_0x192040[_0x8a8a('0x62')],'attachments':_0x192040,'originChannel':_0x8a8a('0xf4'),'ChatWebsiteId':_0x36e8c6['id'],'ChatOfflineMessageId':_0xb988c3['id'],'originTo':_0x36e8c6[_0x8a8a('0xd8')]['email']},'body':_0xb988c3[_0x8a8a('0x65')]};var _0x55737e={'account':{'id':_0x36e8c6[_0x8a8a('0xf5')]},'body':_0x517c95,'log':_0x8a8a('0xf6')};return respondWithRpcPromise(_0x8a8a('0xf6'),_0x8a8a('0xf7'),_0x55737e,client9001)[_0x8a8a('0x1c')](function(){return _0xb988c3;})[_0x8a8a('0x25')](function(_0x540e6e){logger['error'](_0x540e6e);});}return;})[_0x8a8a('0x1c')](function(){if(_0xb988c3){return _0xb988c3;}})[_0x8a8a('0x1c')](respondWithResult(_0x2ae822,null))[_0x8a8a('0x25')](function(){for(var _0x20f945 of _0x123c98){var _0x1baed2=path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0xe2'),_0x8a8a('0xce'),_0x8a8a('0xe3'),_0x8a8a('0xe4'),_0x20f945[_0x8a8a('0x84')]);fs_extra['remove'](_0x1baed2)[_0x8a8a('0x25')](function(_0x4f31a2){logger[_0x8a8a('0x22')](_0x8a8a('0xf8'),_0x1baed2,_0x4f31a2);});}});};exports[_0x8a8a('0xf9')]=function(_0x203707,_0x3cdc0a){return db[_0x8a8a('0xb7')][_0x8a8a('0x63')]({'where':{'id':_0x203707['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3cdc0a,null))['then'](function(_0x1e3017){if(_0x1e3017){return _0x1e3017['addInteraction'](_0x203707[_0x8a8a('0x65')][_0x8a8a('0x79')],_[_0x8a8a('0xfa')](_0x203707[_0x8a8a('0x65')],['ids','id'])||{});}})['then'](respondWithResult(_0x3cdc0a,null))[_0x8a8a('0x25')](handleError(_0x3cdc0a,null));};exports[_0x8a8a('0xfb')]=function(_0x4dd128,_0x15b30c){var _0x59022b={'raw':![],'where':{}};var _0x577662={};var _0x24f65a={'count':0x0,'rows':[]};return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x4dd128['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x15b30c,null))[_0x8a8a('0x1c')](function(_0x2e34e6){if(_0x2e34e6){_0x577662['model']=_[_0x8a8a('0x51')](db[_0x8a8a('0xb7')]['rawAttributes']);_0x577662['query']=_[_0x8a8a('0x51')](_0x4dd128[_0x8a8a('0x50')]);_0x577662[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x577662[_0x8a8a('0x44')],_0x577662['query']);_0x59022b[_0x8a8a('0x54')]=_['intersection'](_0x577662['model'],qs[_0x8a8a('0x55')](_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x59022b[_0x8a8a('0x54')]=_0x59022b[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x59022b['attributes']:_0x577662[_0x8a8a('0x44')];if(!_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0x56')](_0x8a8a('0x57'))){_0x59022b[_0x8a8a('0x2a')]=qs['limit'](_0x4dd128[_0x8a8a('0x50')]['limit']);_0x59022b[_0x8a8a('0x2c')]=qs['offset'](_0x4dd128['query'][_0x8a8a('0x2c')]);}_0x59022b[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x4dd128['query'][_0x8a8a('0x76')]);_0x59022b['where']=qs[_0x8a8a('0x52')](_[_0x8a8a('0x59')](_0x4dd128[_0x8a8a('0x50')],_0x577662[_0x8a8a('0x52')]));_0x59022b[_0x8a8a('0x58')][_0x8a8a('0x73')]=_0x2e34e6['id'];if(_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0x5a')]){_0x59022b[_0x8a8a('0x58')]=_[_0x8a8a('0x5b')](_0x59022b[_0x8a8a('0x58')],{'$or':_['map'](_0x59022b['attributes'],function(_0x2d23ae){var _0x1d3559={};_0x1d3559[_0x2d23ae]={'$like':'%'+_0x4dd128[_0x8a8a('0x50')]['filter']+'%'};return _0x1d3559;})});}_0x59022b=_['merge']({},_0x59022b,_0x4dd128[_0x8a8a('0x5d')]);return db[_0x8a8a('0xb7')]['count']({'where':_0x59022b['where']})[_0x8a8a('0x1c')](function(_0xb08e40){_0x24f65a['count']=_0xb08e40;if(_0x4dd128['query'][_0x8a8a('0x5e')]){_0x59022b['include']=[{'model':db[_0x8a8a('0xa1')],'as':'Contact','required':![]},{'model':db[_0x8a8a('0xc2')],'as':'Owner','attributes':['name','fullname',_0x8a8a('0xfc')],'required':![]},{'model':db['Tag'],'as':_0x8a8a('0xfd'),'attributes':['id',_0x8a8a('0x34'),_0x8a8a('0xfe')],'where':_0x4dd128['query']['tag']?{'id':_0x4dd128[_0x8a8a('0x50')][_0x8a8a('0xff')]}:undefined,'required':_0x4dd128[_0x8a8a('0x50')]['tag']?!![]:![]}];}return db[_0x8a8a('0xb7')][_0x8a8a('0x7d')](_0x59022b);})[_0x8a8a('0x1c')](function(_0x5e4abc){_0x24f65a['rows']=_0x5e4abc;return _0x24f65a;});}})['then'](respondWithFilteredResult(_0x15b30c,_0x59022b))['catch'](handleError(_0x15b30c,null));};exports[_0x8a8a('0x100')]=function(_0x3488b4,_0x3fd5b2){var _0x6120b4=0x0;var _0x255a29=0x0;var _0x3723d9=![];var _0x82197;var _0x5e11da;return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x3488b4[_0x8a8a('0x61')]['id']},'include':[{'model':db['Interval'],'as':_0x8a8a('0x97'),'include':[{'model':db[_0x8a8a('0x97')],'as':_0x8a8a('0xaa'),'attributes':['id','interval']}]}]})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3fd5b2,null))[_0x8a8a('0x1c')](function(_0x10e059){if(_0x10e059){_0x82197=_0x10e059;return _0x10e059[_0x8a8a('0x101')]({'raw':!![]});}})[_0x8a8a('0x1c')](function(_0x142a8c){if(_0x82197){if(_0x142a8c){_0x5e11da=_0x142a8c;}}return require('../../config/license/util')[_0x8a8a('0x8c')]();})[_0x8a8a('0x1c')](function(_0x3a0fd0){if(_0x3a0fd0){_0x255a29=_0x3a0fd0[_0x8a8a('0x102')];_0x3723d9=_0x3a0fd0[_0x8a8a('0x8d')];}})[_0x8a8a('0x1c')](function(){return db[_0x8a8a('0xb7')][_0x8a8a('0x2b')]({'where':{'closed':![]}});})[_0x8a8a('0x1c')](function(_0x234485){_0x6120b4=_0x234485;if(_0x255a29&&_0x234485>_0x255a29){return db[_0x8a8a('0x103')][_0x8a8a('0x7c')]({'where':{'id':0x1}})[_0x8a8a('0x1c')](function(_0x874574){if(_0x874574){_0x874574[_0x8a8a('0x104')](_0x8a8a('0x105'));}});}})[_0x8a8a('0x1c')](function(){var _0x1f882e=_0x82197[_0x8a8a('0x97')];var _0x270117=_0x82197[_0x8a8a('0x98')]||undefined;return _0x1f882e?_0x1f882e[_0x8a8a('0x99')](_0x270117):!![];})[_0x8a8a('0x1c')](function(_0x25d8ea){var _0x5ce17f=fs['readFileSync'](path[_0x8a8a('0x89')](config[_0x8a8a('0x90')],_0x8a8a('0x106')),_0x8a8a('0xdc'));var _0x4da155=_0x8a8a('0x107');var _0x3265d7=![];var _0x546652,_0x332c4c;if(_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x3e')]){_0x546652=new URL(_0x3488b4[_0x8a8a('0xb5')]['referer'])[_0x8a8a('0x108')];}else if(_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x108')]){_0x546652=new URL(_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x108')])[_0x8a8a('0x108')];}else{_0x546652=_0x8a8a('0x109');}_0x332c4c=typeof _0x82197[_0x8a8a('0x66')][_0x8a8a('0x3b')](',')[_0x8a8a('0x63')](function(_0x268030){return wildcardUtils['testWebsiteWithWildcard'](_0x268030,_0x546652);})!==_0x8a8a('0x29');var _0x3c07fa={'chatVersion':_0x4da155,'chatWebsiteAddressOrigin':_0x332c4c?_0x546652:_0x82197[_0x8a8a('0x66')],'remote':_0x82197['remote'],'query':querystring[_0x8a8a('0x48')](_[_0x8a8a('0x5b')](_0x82197[_0x8a8a('0x6b')]({'plain':!![]}),{'customerIp':_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x39')]||_0x3488b4['headers'][_0x8a8a('0x10a')]||_0x3488b4['connection'][_0x8a8a('0x10b')]||_0x3488b4['ip'],'referer':_0x3488b4[_0x8a8a('0xb5')][_0x8a8a('0x3e')],'openedInteractions':_0x6120b4,'maxInteractions':_0x255a29,'virtual':_0x3723d9[_0x8a8a('0x102')],'online':_0x25d8ea,'custom':_0x3723d9,'address':_0x332c4c?_0x546652:null}))[_0x8a8a('0x10c')](/'/g,'\x5c\x27')};_0x3fd5b2[_0x8a8a('0xd3')](ejs[_0x8a8a('0xdd')](Mustache[_0x8a8a('0xdd')](_0x5ce17f,_0x3c07fa),{'proactiveActions':_0x5e11da,'alignment':_0x82197[_0x8a8a('0x10d')],'verticalAlignment':_0x82197[_0x8a8a('0x10e')],'div_color':_0x82197[_0x8a8a('0xfe')],'labelText':_0x82197[_0x8a8a('0x10f')],'text_color':_0x82197[_0x8a8a('0x110')],'text_button_color':_0x82197['textButtonColor'],'button_color':_0x82197[_0x8a8a('0x111')],'background_color':_0x82197[_0x8a8a('0x112')],'hideWhenOffline':_0x82197[_0x8a8a('0x113')],'intervalId':_0x82197['IntervalId'],'isDevelopment':_0x3265d7,'chatVersion':_0x4da155}));})[_0x8a8a('0x25')](handleError(_0x3fd5b2,null));};exports[_0x8a8a('0x114')]=function(_0x3c3829,_0x38f151){var _0x500151=_0x3c3829['params']['id'];var _0x13e934=_0x3c3829[_0x8a8a('0x65')];var _0x578863=0xc8;var _0x321588=null;return db[_0x8a8a('0xe5')][_0x8a8a('0xe6')]({'isolationLevel':db[_0x8a8a('0xe5')]['Transaction'][_0x8a8a('0x115')][_0x8a8a('0x116')]},function(_0x377fb){return db['ChatWebsite'][_0x8a8a('0x7c')]({'where':{'id':_0x500151},'transaction':_0x377fb})['then'](function(_0x3415f2){if(_0x3415f2){return db['ChatApplication']['destroy']({'where':{'ChatWebsiteId':_0x500151},'transaction':_0x377fb})[_0x8a8a('0x1c')](function(){var _0x487ac2=_[_0x8a8a('0x4b')](_0x13e934,function(_0x300627){_0x300627[_0x8a8a('0x73')]=_0x500151;return _0x300627;});return db[_0x8a8a('0x117')][_0x8a8a('0xe8')](_0x487ac2,{'transaction':_0x377fb});});}else{_0x578863=0x194;_0x321588=[];}});})['then'](function(){if(_0x578863!==0x194){return db[_0x8a8a('0x117')][_0x8a8a('0x118')]({'where':{'ChatWebsiteId':_0x500151},'order':_0x8a8a('0xaf')})[_0x8a8a('0x1c')](function(_0x2b3f58){_0x321588=_0x2b3f58;});}})[_0x8a8a('0x25')](function(_0x5bcf5e){_0x578863=0x1f4;logger[_0x8a8a('0x22')](_0x5bcf5e[_0x8a8a('0x33')]);if(_0x5bcf5e[_0x8a8a('0x34')]){delete _0x5bcf5e[_0x8a8a('0x34')];}_0x321588=_0x5bcf5e;})[_0x8a8a('0x119')](function(){if(_0x321588===null){_0x38f151[_0x8a8a('0x32')](_0x578863);}else{if(_0x578863===0x1f4){_0x38f151[_0x8a8a('0x26')](_0x578863)[_0x8a8a('0xd3')](_0x321588);}else{_0x38f151[_0x8a8a('0x26')](_0x578863)[_0x8a8a('0x28')](_0x321588);}}});};exports[_0x8a8a('0x11a')]=function(_0x515e99,_0x49f317){var _0x4e4a02={};var _0x2cb19e={};var _0x2e97f5;var _0x1c0953;return db['ChatWebsite']['findOne']({'where':{'id':_0x515e99[_0x8a8a('0x61')]['id']}})['then'](handleEntityNotFound(_0x49f317,null))['then'](function(_0x4f6f49){if(_0x4f6f49){_0x2e97f5=_0x4f6f49;_0x2cb19e[_0x8a8a('0x44')]=_['keys'](db[_0x8a8a('0x117')][_0x8a8a('0x4d')]);_0x2cb19e[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x515e99['query']);_0x2cb19e[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x2cb19e['model'],_0x2cb19e['query']);_0x4e4a02[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x2cb19e[_0x8a8a('0x44')],qs['fields'](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x4e4a02[_0x8a8a('0x54')]=_0x4e4a02[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x4e4a02[_0x8a8a('0x54')]:_0x2cb19e[_0x8a8a('0x44')];_0x4e4a02[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x4e4a02['where']=qs[_0x8a8a('0x52')](_['pick'](_0x515e99[_0x8a8a('0x50')],_0x2cb19e['filters']));if(_0x515e99['query'][_0x8a8a('0x5a')]){_0x4e4a02['where']=_['merge'](_0x4e4a02['where'],{'$or':_['map'](_0x4e4a02[_0x8a8a('0x54')],function(_0x3a1604){var _0x3e87d3={};_0x3e87d3[_0x3a1604]={'$like':'%'+_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x5a')]+'%'};return _0x3e87d3;})});}_0x4e4a02=_[_0x8a8a('0x5b')]({},_0x4e4a02,_0x515e99[_0x8a8a('0x5d')]);return _0x2e97f5[_0x8a8a('0x11a')](_0x4e4a02);}})[_0x8a8a('0x1c')](function(_0x9f342e){if(_0x9f342e){_0x1c0953=_0x9f342e[_0x8a8a('0x62')];if(!_0x515e99['query'][_0x8a8a('0x56')]('nolimit')){_0x4e4a02[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x2a')]);_0x4e4a02[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x515e99[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}return _0x2e97f5[_0x8a8a('0x11a')](_0x4e4a02);}})[_0x8a8a('0x1c')](function(_0x13fb20){if(_0x13fb20){return _0x13fb20?{'count':_0x1c0953,'rows':_0x13fb20}:null;}})['then'](respondWithResult(_0x49f317,null))['catch'](handleError(_0x49f317,null));};exports['addProactiveActions']=function(_0xda869f,_0x55931b){return db[_0x8a8a('0x11b')][_0x8a8a('0x63')]({'where':{'id':_0xda869f[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x55931b,null))[_0x8a8a('0x1c')](function(_0x591976){if(_0x591976){return _0x591976[_0x8a8a('0x11c')](_0xda869f['body'][_0x8a8a('0x79')],_['omit'](_0xda869f[_0x8a8a('0x65')],[_0x8a8a('0x79'),'id'])||{});}})[_0x8a8a('0x1c')](respondWithResult(_0x55931b,null))[_0x8a8a('0x25')](handleError(_0x55931b,null));};exports[_0x8a8a('0x101')]=function(_0x43bfeb,_0x2406f1){var _0x511fac={};var _0x3bef44={};var _0x5b4ca0;var _0x4cff06;return db['ChatWebsite']['findOne']({'where':{'id':_0x43bfeb['params']['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x2406f1,null))[_0x8a8a('0x1c')](function(_0x374b3f){if(_0x374b3f){_0x5b4ca0=_0x374b3f;_0x3bef44[_0x8a8a('0x44')]=_[_0x8a8a('0x51')](db[_0x8a8a('0x11d')][_0x8a8a('0x4d')]);_0x3bef44['query']=_['keys'](_0x43bfeb['query']);_0x3bef44[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x3bef44[_0x8a8a('0x44')],_0x3bef44[_0x8a8a('0x50')]);_0x511fac[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x3bef44['model'],qs[_0x8a8a('0x55')](_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x55')]));_0x511fac['attributes']=_0x511fac[_0x8a8a('0x54')][_0x8a8a('0x62')]?_0x511fac[_0x8a8a('0x54')]:_0x3bef44['model'];_0x511fac[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x511fac[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_[_0x8a8a('0x59')](_0x43bfeb[_0x8a8a('0x50')],_0x3bef44['filters']));if(_0x43bfeb['query'][_0x8a8a('0x5a')]){_0x511fac['where']=_['merge'](_0x511fac['where'],{'$or':_['map'](_0x511fac['attributes'],function(_0x5d28bb){var _0x55b0c2={};_0x55b0c2[_0x5d28bb]={'$like':'%'+_0x43bfeb[_0x8a8a('0x50')]['filter']+'%'};return _0x55b0c2;})});}_0x511fac=_[_0x8a8a('0x5b')]({},_0x511fac,_0x43bfeb[_0x8a8a('0x5d')]);return _0x5b4ca0[_0x8a8a('0x101')](_0x511fac);}})['then'](function(_0x433bd5){if(_0x433bd5){_0x4cff06=_0x433bd5[_0x8a8a('0x62')];if(!_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x56')]('nolimit')){_0x511fac['limit']=qs[_0x8a8a('0x2a')](_0x43bfeb[_0x8a8a('0x50')]['limit']);_0x511fac[_0x8a8a('0x2c')]=qs['offset'](_0x43bfeb[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}return _0x5b4ca0['getProactiveActions'](_0x511fac);}})[_0x8a8a('0x1c')](function(_0x51c902){if(_0x51c902){return _0x51c902?{'count':_0x4cff06,'rows':_0x51c902}:null;}})[_0x8a8a('0x1c')](respondWithResult(_0x2406f1,null))[_0x8a8a('0x25')](handleError(_0x2406f1,null));};exports[_0x8a8a('0x11e')]=function(_0x269483,_0x3f9d81){var _0x565d4f=_0x269483[_0x8a8a('0x50')][_0x8a8a('0x11f')]===_0x8a8a('0x120')?_0x8a8a('0x121'):_0x8a8a('0x122');return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'attributes':['id',_0x565d4f],'where':{'id':_0x269483[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3f9d81,null))['then'](function(_0x2810fc){if(_0x2810fc){var _0x3e8ddf=_0x2810fc[_0x565d4f];var _0x2eddb9=_0x3e8ddf&&_0x3e8ddf[_0x8a8a('0x123')]?_0x3e8ddf[_0x8a8a('0x123')]:[];_0x3f9d81[_0x8a8a('0xd3')]({'fromKey':_['isNil'](_0x3e8ddf[_0x8a8a('0x124')])?undefined:_0x3e8ddf[_0x8a8a('0x124')],'count':_0x2eddb9['length'],'rows':_0x2eddb9});}})[_0x8a8a('0x25')](handleError(_0x3f9d81,null));};exports[_0x8a8a('0x125')]=function(_0x2f5102,_0x51dc09){var _0x48676a={'raw':![],'where':{}};var _0x586205={};var _0x462121={'count':0x0,'rows':[]};return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x2f5102['params']['id']}})['then'](handleEntityNotFound(_0x51dc09,null))[_0x8a8a('0x1c')](function(_0x1b021a){if(_0x1b021a){_0x586205['model']=_[_0x8a8a('0x51')](db[_0x8a8a('0xdf')][_0x8a8a('0x4d')]);_0x586205[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x2f5102['query']);_0x586205['filters']=_['intersection'](_0x586205[_0x8a8a('0x44')],_0x586205['query']);_0x48676a[_0x8a8a('0x54')]=_[_0x8a8a('0x53')](_0x586205[_0x8a8a('0x44')],qs[_0x8a8a('0x55')](_0x2f5102[_0x8a8a('0x50')]['fields']));_0x48676a[_0x8a8a('0x54')]=_0x48676a[_0x8a8a('0x54')]['length']?_0x48676a[_0x8a8a('0x54')]:_0x586205[_0x8a8a('0x44')];if(!_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x56')](_0x8a8a('0x57'))){_0x48676a[_0x8a8a('0x2a')]=qs['limit'](_0x2f5102['query'][_0x8a8a('0x2a')]);_0x48676a[_0x8a8a('0x2c')]=qs['offset'](_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x2c')]);}_0x48676a[_0x8a8a('0x75')]=qs[_0x8a8a('0x76')](_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x76')]);_0x48676a[_0x8a8a('0x58')]=qs[_0x8a8a('0x52')](_['pick'](_0x2f5102['query'],_0x586205['filters']));_0x48676a[_0x8a8a('0x58')][_0x8a8a('0x73')]=_0x1b021a['id'];if(_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x5a')]){_0x48676a[_0x8a8a('0x58')]=_['merge'](_0x48676a[_0x8a8a('0x58')],{'$or':_[_0x8a8a('0x4b')](_0x48676a['attributes'],function(_0x43af89){var _0xc8998e={};_0xc8998e[_0x43af89]={'$like':'%'+_0x2f5102[_0x8a8a('0x50')][_0x8a8a('0x5a')]+'%'};return _0xc8998e;})});}_0x48676a=_[_0x8a8a('0x5b')]({},_0x48676a,_0x2f5102['options']);return db[_0x8a8a('0xdf')][_0x8a8a('0x2b')]({'where':_0x48676a[_0x8a8a('0x58')]})[_0x8a8a('0x1c')](function(_0x48901b){_0x462121[_0x8a8a('0x2b')]=_0x48901b;if(_0x2f5102['query'][_0x8a8a('0x5e')]){_0x48676a[_0x8a8a('0x77')]=[{'all':!![]}];}else{_0x48676a[_0x8a8a('0x77')]=[{'model':db[_0x8a8a('0xa1')],'as':_0x8a8a('0x126'),'required':![]},{'model':db['Attachment'],'as':_0x8a8a('0x127'),'required':![]}];}return db['ChatOfflineMessage'][_0x8a8a('0x7d')](_0x48676a);})['then'](function(_0x4b44b9){_0x462121[_0x8a8a('0x5f')]=_0x4b44b9;return _0x462121;});}})[_0x8a8a('0x1c')](respondWithFilteredResult(_0x51dc09,_0x48676a))[_0x8a8a('0x25')](handleError(_0x51dc09,null));};exports[_0x8a8a('0x128')]=function(_0x2d99d3,_0x1dff03){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x2d99d3[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x1dff03,null))[_0x8a8a('0x1c')](function(_0x4125a3){if(_0x4125a3){return _0x4125a3[_0x8a8a('0x128')](_0x2d99d3[_0x8a8a('0x65')][_0x8a8a('0x79')],_[_0x8a8a('0xfa')](_0x2d99d3[_0x8a8a('0x65')],[_0x8a8a('0x79'),'id'])||{})[_0x8a8a('0xda')](function(_0x4447dc){for(var _0x2d3f1c=0x0;_0x2d3f1c<_0x2d99d3[_0x8a8a('0x65')]['ids']['length'];_0x2d3f1c+=0x1){socket[_0x8a8a('0x129')](_0x8a8a('0x12a'),{'UserId':Number(_0x2d99d3[_0x8a8a('0x65')][_0x8a8a('0x79')][_0x2d3f1c]),'ChatWebsiteId':Number(_0x2d99d3['params']['id'])});}return _0x4447dc;});}})[_0x8a8a('0x1c')](respondWithResult(_0x1dff03,null))['catch'](handleError(_0x1dff03,null));};exports[_0x8a8a('0x12b')]=function(_0x3991e8,_0x1d221f){return db[_0x8a8a('0x4c')][_0x8a8a('0x63')]({'where':{'id':_0x3991e8[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x1d221f,null))[_0x8a8a('0x1c')](function(_0x11ae8d){if(_0x11ae8d){return _0x11ae8d[_0x8a8a('0x12b')](_0x3991e8[_0x8a8a('0x50')]['ids'])[_0x8a8a('0x1c')](function(){if(_[_0x8a8a('0x12c')](_0x3991e8['query'][_0x8a8a('0x79')])){for(var _0x4676bb=0x0;_0x4676bb<_0x3991e8['query'][_0x8a8a('0x79')][_0x8a8a('0x62')];_0x4676bb+=0x1){socket['emit'](_0x8a8a('0x12d'),{'UserId':Number(_0x3991e8[_0x8a8a('0x50')][_0x8a8a('0x79')][_0x4676bb]),'ChatWebsiteId':Number(_0x3991e8['params']['id'])});}}else{socket['emit']('userChatWebsite:remove',{'UserId':Number(_0x3991e8['query'][_0x8a8a('0x79')]),'ChatWebsiteId':Number(_0x3991e8[_0x8a8a('0x61')]['id'])});}});}})[_0x8a8a('0x1c')](respondWithStatusCode(_0x1d221f,null))[_0x8a8a('0x25')](handleError(_0x1d221f,null));};exports['getAgents']=function(_0x3fb3c0,_0x3b0476){var _0x37a540={};var _0x2cee68={};var _0x206127;var _0x21cd36;return db[_0x8a8a('0x4c')][_0x8a8a('0x7c')]({'where':{'id':_0x3fb3c0[_0x8a8a('0x61')]['id']}})[_0x8a8a('0x1c')](handleEntityNotFound(_0x3b0476,null))[_0x8a8a('0x1c')](function(_0xac535c){if(_0xac535c){_0x206127=_0xac535c;_0x2cee68[_0x8a8a('0x44')]=_[_0x8a8a('0x51')](db['User'][_0x8a8a('0x4d')]);_0x2cee68[_0x8a8a('0x50')]=_[_0x8a8a('0x51')](_0x3fb3c0[_0x8a8a('0x50')]);_0x2cee68[_0x8a8a('0x52')]=_[_0x8a8a('0x53')](_0x2cee68[_0x8a8a('0x44')],_0x2cee68[_0x8a8a('0x50')]);_0x37a540['attributes']=_[_0x8a8a('0x53')](_0x2cee68[_0x8a8a('0x44')],qs['fields'](_0x3fb3c0['query']['fields']));_0x37a540['attributes']=_0x37a540[_0x8a8a('0x54')]['length']?_0x37a540[_0x8a8a('0x54')]:_0x2cee68[_0x8a8a('0x44')];_0x37a540[_0x8a8a('0x75')]=qs['sort'](_0x3fb3c0[_0x8a8a('0x50')]['sort']);_0x37a540['where']=qs[_0x8a8a('0x52')](_['pick'](_0x3fb3c0[_0x8a8a('0x50')],_0x2cee68[_0x8a8a('0x52')]));if(_0x3fb3c0[_0x8a8a('0x50')]['filter']){_0x37a540['where']=_[_0x8a8a('0x5b')](_0x37a540[_0x8a8a('0x58')],{'$or':_['map'](_0x37a540[_0x8a8a('0x54')],function(_0x5c0bd5){var _0x33ca5d={};_0x33ca5d[_0x5c0bd5]={'$like':'%'+_0x3fb3c0[_0x8a8a('0x50')]['filter']+'%'};return _0x33ca5d;})});}_0x37a540=_['merge']({},_0x37a540,_0x3fb3c0[_0x8a8a('0x5d')]);return _0x206127[_0x8a8a('0x12e')](_0x37a540);}})[_0x8a8a('0x1c')](function(_0x2ee77d){if(_0x2ee77d){_0x21cd36=_0x2ee77d[_0x8a8a('0x62')];if(!_0x3fb3c0[_0x8a8a('0x50')][_0x8a8a('0x56')]('nolimit')){_0x37a540[_0x8a8a('0x2a')]=qs[_0x8a8a('0x2a')](_0x3fb3c0['query']['limit']);_0x37a540[_0x8a8a('0x2c')]=qs[_0x8a8a('0x2c')](_0x3fb3c0['query'][_0x8a8a('0x2c')]);}return _0x206127[_0x8a8a('0x12e')](_0x37a540);}})['then'](function(_0x1bd6a8){if(_0x1bd6a8){return _0x1bd6a8?{'count':_0x21cd36,'rows':_0x1bd6a8}:null;}})['then'](respondWithResult(_0x3b0476,null))[_0x8a8a('0x25')](handleError(_0x3b0476,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c3ba9c5..b3305c7 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 _0xc252=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0x4eacbb,_0x1bc3d1){var _0x549393=function(_0x1ebfc0){while(--_0x1ebfc0){_0x4eacbb['push'](_0x4eacbb['shift']());}};_0x549393(++_0x1bc3d1);}(_0xc252,0x118));var _0x2c25=function(_0x42ef26,_0x21a04b){_0x42ef26=_0x42ef26-0x0;var _0x4f61c2=_0xc252[_0x42ef26];return _0x4f61c2;};'use strict';var EventEmitter=require(_0x2c25('0x0'));var ChatWebsite=require(_0x2c25('0x1'))['db'][_0x2c25('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x2c25('0x3')](0x0);var events={'afterCreate':_0x2c25('0x4'),'afterUpdate':_0x2c25('0x5'),'afterDestroy':_0x2c25('0x6')};function emitEvent(_0xd6718e){return function(_0x5815ad,_0x5e2a2a,_0x244f8c){ChatWebsiteEvents['emit'](_0xd6718e+':'+_0x5815ad['id'],_0x5815ad);ChatWebsiteEvents[_0x2c25('0x7')](_0xd6718e,_0x5815ad);_0x244f8c(null);};}for(var e in events){if(events[_0x2c25('0x8')](e)){var event=events[e];ChatWebsite[_0x2c25('0x9')](e,emitEvent(event));}}module[_0x2c25('0xa')]=ChatWebsiteEvents; \ No newline at end of file +var _0xc43c=['ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x3b545c,_0x491912){var _0xc9eb90=function(_0x35aeec){while(--_0x35aeec){_0x3b545c['push'](_0x3b545c['shift']());}};_0xc9eb90(++_0x491912);}(_0xc43c,0x152));var _0xcc43=function(_0x44d357,_0x5d25fa){_0x44d357=_0x44d357-0x0;var _0x564514=_0xc43c[_0x44d357];return _0x564514;};'use strict';var EventEmitter=require(_0xcc43('0x0'));var ChatWebsite=require(_0xcc43('0x1'))['db'][_0xcc43('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcc43('0x3')](0x0);var events={'afterCreate':_0xcc43('0x4'),'afterUpdate':_0xcc43('0x5'),'afterDestroy':'remove'};function emitEvent(_0x162a11){return function(_0x258c7e,_0x5c21a3,_0x1b589f){ChatWebsiteEvents[_0xcc43('0x6')](_0x162a11+':'+_0x258c7e['id'],_0x258c7e);ChatWebsiteEvents[_0xcc43('0x6')](_0x162a11,_0x258c7e);_0x1b589f(null);};}for(var e in events){if(events[_0xcc43('0x7')](e)){var event=events[e];ChatWebsite[_0xcc43('0x8')](e,emitEvent(event));}}module[_0xcc43('0x9')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index bb4cd64..3961379 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 _0x459e=['lodash','util','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x459e,0x18c));var _0xe459=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x459e[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xe459('0x0'));var util=require(_0xe459('0x1'));var logger=require('../../config/logger')(_0xe459('0x2'));var moment=require(_0xe459('0x3'));var BPromise=require('bluebird');var rp=require(_0xe459('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe459('0x5'));var config=require(_0xe459('0x6'));var attributes=require(_0xe459('0x7'));module[_0xe459('0x8')]=function(_0x21bc20,_0x9a1631){return _0x21bc20[_0xe459('0x9')](_0xe459('0xa'),attributes,{'tableName':_0xe459('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x85fb=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatWebsite.attributes','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0x85fb,0x6a));var _0xb85f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x85fb[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0xb85f('0x0'));var util=require(_0xb85f('0x1'));var logger=require(_0xb85f('0x2'))(_0xb85f('0x3'));var moment=require(_0xb85f('0x4'));var BPromise=require('bluebird');var rp=require(_0xb85f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb85f('0x6'));var config=require(_0xb85f('0x7'));var attributes=require(_0xb85f('0x8'));module['exports']=function(_0x447109,_0x2f2e6f){return _0x447109[_0xb85f('0x9')](_0xb85f('0xa'),attributes,{'tableName':_0xb85f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 5480788..c40f1d1 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 _0xe6a1=['result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x144b2b,_0x2a0b0f){var _0x599c5a=function(_0x1da07a){while(--_0x1da07a){_0x144b2b['push'](_0x144b2b['shift']());}};_0x599c5a(++_0x2a0b0f);}(_0xe6a1,0x153));var _0x1e6a=function(_0x16171c,_0x223d97){_0x16171c=_0x16171c-0x0;var _0x3d37c0=_0xe6a1[_0x16171c];return _0x3d37c0;};'use strict';var _=require(_0x1e6a('0x0'));var util=require(_0x1e6a('0x1'));var moment=require('moment');var BPromise=require(_0x1e6a('0x2'));var rs=require(_0x1e6a('0x3'));var fs=require('fs');var Redis=require(_0x1e6a('0x4'));var db=require(_0x1e6a('0x5'))['db'];var utils=require(_0x1e6a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1e6a('0x7'));var jayson=require(_0x1e6a('0x8'));var client=jayson[_0x1e6a('0x9')][_0x1e6a('0xa')]({'port':0x232a});config[_0x1e6a('0xb')]=_[_0x1e6a('0xc')](config[_0x1e6a('0xb')],{'host':_0x1e6a('0xd'),'port':0x18eb});var socket=require(_0x1e6a('0xe'))(new Redis(config[_0x1e6a('0xb')]));require(_0x1e6a('0xf'))['register'](socket);function respondWithRpcPromise(_0x3780d2,_0x486d3f,_0x31bb19){return new BPromise(function(_0x1084ec,_0x2bc7c7){return client['request'](_0x3780d2,_0x31bb19)[_0x1e6a('0x10')](function(_0x976310){logger[_0x1e6a('0x11')](_0x1e6a('0x12'),_0x486d3f,_0x1e6a('0x13'));logger[_0x1e6a('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x486d3f,_0x1e6a('0x13'),JSON[_0x1e6a('0x15')](_0x976310));if(_0x976310[_0x1e6a('0x16')]){if(_0x976310[_0x1e6a('0x16')][_0x1e6a('0x17')]===0x1f4){logger[_0x1e6a('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x486d3f,_0x976310[_0x1e6a('0x16')][_0x1e6a('0x18')]);return _0x2bc7c7(_0x976310[_0x1e6a('0x16')][_0x1e6a('0x18')]);}logger[_0x1e6a('0x16')](_0x1e6a('0x12'),_0x486d3f,_0x976310[_0x1e6a('0x16')][_0x1e6a('0x18')]);return _0x1084ec(_0x976310['error'][_0x1e6a('0x18')]);}else{logger['info'](_0x1e6a('0x12'),_0x486d3f,'request\x20sent');_0x1084ec(_0x976310[_0x1e6a('0x19')][_0x1e6a('0x18')]);}})['catch'](function(_0x42b96a){logger[_0x1e6a('0x16')](_0x1e6a('0x12'),_0x486d3f,_0x42b96a);_0x2bc7c7(_0x42b96a);});});} \ No newline at end of file +var _0x9791=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','defaults','localhost','redis','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9791,0x1ac));var _0x1979=function(_0x3c687b,_0x83ea4){_0x3c687b=_0x3c687b-0x0;var _0x20dfa5=_0x9791[_0x3c687b];return _0x20dfa5;};'use strict';var _=require(_0x1979('0x0'));var util=require(_0x1979('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1979('0x2'));var fs=require('fs');var Redis=require(_0x1979('0x3'));var db=require(_0x1979('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1979('0x5'))(_0x1979('0x6'));var config=require('../../config/environment');var jayson=require(_0x1979('0x7'));var client=jayson[_0x1979('0x8')]['http']({'port':0x232a});config['redis']=_[_0x1979('0x9')](config['redis'],{'host':_0x1979('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1979('0xb')]));require(_0x1979('0xc'))[_0x1979('0xd')](socket);function respondWithRpcPromise(_0x5885f8,_0x37d8c9,_0x16789d){return new BPromise(function(_0xc944c2,_0x495a39){return client[_0x1979('0xe')](_0x5885f8,_0x16789d)[_0x1979('0xf')](function(_0x4af758){logger[_0x1979('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x37d8c9,_0x1979('0x11'));logger[_0x1979('0x12')](_0x1979('0x13'),_0x37d8c9,_0x1979('0x11'),JSON[_0x1979('0x14')](_0x4af758));if(_0x4af758[_0x1979('0x15')]){if(_0x4af758[_0x1979('0x15')][_0x1979('0x16')]===0x1f4){logger['error'](_0x1979('0x17'),_0x37d8c9,_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);return _0x495a39(_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);}logger[_0x1979('0x15')](_0x1979('0x17'),_0x37d8c9,_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);return _0xc944c2(_0x4af758[_0x1979('0x15')][_0x1979('0x18')]);}else{logger[_0x1979('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x37d8c9,'request\x20sent');_0xc944c2(_0x4af758[_0x1979('0x19')]['message']);}})[_0x1979('0x1a')](function(_0x20eac8){logger[_0x1979('0x15')](_0x1979('0x17'),_0x37d8c9,_0x20eac8);_0x495a39(_0x20eac8);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index eccf3ad..5021535 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 _0x1c8c=['./chatWebsite.events','save','update','emit','removeListener','chatWebsite:'];(function(_0x46a509,_0x44fa7d){var _0x23832f=function(_0x45d7b3){while(--_0x45d7b3){_0x46a509['push'](_0x46a509['shift']());}};_0x23832f(++_0x44fa7d);}(_0x1c8c,0x180));var _0xc1c8=function(_0x2f1ab5,_0x2966be){_0x2f1ab5=_0x2f1ab5-0x0;var _0x5c7e72=_0x1c8c[_0x2f1ab5];return _0x5c7e72;};'use strict';var ChatWebsiteEvents=require(_0xc1c8('0x0'));var events=[_0xc1c8('0x1'),'remove',_0xc1c8('0x2')];function createListener(_0xcdd249,_0x2f84ce){return function(_0x4eb446){_0x2f84ce[_0xc1c8('0x3')](_0xcdd249,_0x4eb446);};}function removeListener(_0x2820b1,_0x3bdb13){return function(){ChatWebsiteEvents[_0xc1c8('0x4')](_0x2820b1,_0x3bdb13);};}exports['register']=function(_0xb8c6d3){for(var _0x7d174d=0x0,_0xb13b89=events['length'];_0x7d174d<_0xb13b89;_0x7d174d++){var _0x2ec599=events[_0x7d174d];var _0x4d21a9=createListener(_0xc1c8('0x5')+_0x2ec599,_0xb8c6d3);ChatWebsiteEvents['on'](_0x2ec599,_0x4d21a9);}}; \ No newline at end of file +var _0x3ea2=['length','./chatWebsite.events','update','emit','removeListener','register'];(function(_0x5c5953,_0x44bf4a){var _0x13a1a4=function(_0x593948){while(--_0x593948){_0x5c5953['push'](_0x5c5953['shift']());}};_0x13a1a4(++_0x44bf4a);}(_0x3ea2,0x121));var _0x23ea=function(_0x2035ef,_0x3f7d39){_0x2035ef=_0x2035ef-0x0;var _0x86c909=_0x3ea2[_0x2035ef];return _0x86c909;};'use strict';var ChatWebsiteEvents=require(_0x23ea('0x0'));var events=['save','remove',_0x23ea('0x1')];function createListener(_0x4f5c40,_0x4a7a67){return function(_0x53082c){_0x4a7a67[_0x23ea('0x2')](_0x4f5c40,_0x53082c);};}function removeListener(_0x2dee7d,_0x378570){return function(){ChatWebsiteEvents[_0x23ea('0x3')](_0x2dee7d,_0x378570);};}exports[_0x23ea('0x4')]=function(_0x24d6f4){for(var _0x298590=0x0,_0xab2159=events[_0x23ea('0x5')];_0x298590<_0xab2159;_0x298590++){var _0x5babfb=events[_0x298590];var _0x4a2a80=createListener('chatWebsite:'+_0x5babfb,_0x24d6f4);ChatWebsiteEvents['on'](_0x5babfb,_0x4a2a80);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index f8eb6c8..51b6742 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x110f=['../../../utils/misc','escapeRegExp','localhost','test','replace','([\x5cw]+)'];(function(_0x293978,_0x5868cb){var _0x45b1e5=function(_0x5b6cdf){while(--_0x5b6cdf){_0x293978['push'](_0x293978['shift']());}};_0x45b1e5(++_0x5868cb);}(_0x110f,0x1e6));var _0xf110=function(_0x129bd0,_0x1f026d){_0x129bd0=_0x129bd0-0x0;var _0x5d6fcb=_0x110f[_0x129bd0];return _0x5d6fcb;};var escapeRegExp=require(_0xf110('0x0'))[_0xf110('0x1')];var URL=require('url')['URL'];function testWildcardValidity(_0x51c98c){var _0x41dd25=!![];try{new URL(_0x51c98c['replace']('*',_0xf110('0x2')));}catch(_0x3f60d0){_0x41dd25=![];}return _0x41dd25&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xf110('0x3')](_0x51c98c);}function testWebsiteWithWildcard(_0x593f50,_0x2f4a0f){var _0x3147fd;var _0xc27675=escapeRegExp(_0x593f50['trim']()[_0xf110('0x4')](/\/$/,''))[_0xf110('0x4')]('\x5c*',_0xf110('0x5'));try{new URL(_0x593f50['replace']('\x5c*',_0xf110('0x2')));_0x3147fd=new RegExp(_0xc27675)[_0xf110('0x3')](_0x2f4a0f);}catch(_0x11c28f){_0x3147fd=![];}return _0x3147fd;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0x0650=['localhost','test','replace','([\x5cw]+)','exports','../../../utils/misc','url','URL'];(function(_0x2442b9,_0x3d87e9){var _0x31b571=function(_0x1e10ee){while(--_0x1e10ee){_0x2442b9['push'](_0x2442b9['shift']());}};_0x31b571(++_0x3d87e9);}(_0x0650,0xed));var _0x0065=function(_0x4f3e5a,_0x1ee150){_0x4f3e5a=_0x4f3e5a-0x0;var _0x452880=_0x0650[_0x4f3e5a];return _0x452880;};var escapeRegExp=require(_0x0065('0x0'))['escapeRegExp'];var URL=require(_0x0065('0x1'))[_0x0065('0x2')];function testWildcardValidity(_0x5e6e6c){var _0x16f9eb=!![];try{new URL(_0x5e6e6c['replace']('*',_0x0065('0x3')));}catch(_0x8260ba){_0x16f9eb=![];}return _0x16f9eb&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x0065('0x4')](_0x5e6e6c);}function testWebsiteWithWildcard(_0x4b15b1,_0xdf9084){var _0x507ed3;var _0x5cf16e=escapeRegExp(_0x4b15b1['trim']()[_0x0065('0x5')](/\/$/,''))[_0x0065('0x5')]('\x5c*',_0x0065('0x6'));try{new URL(_0x4b15b1[_0x0065('0x5')]('\x5c*',_0x0065('0x3')));_0x507ed3=new RegExp(_0x5cf16e)[_0x0065('0x4')](_0xdf9084);}catch(_0x8974f){_0x507ed3=![];}return _0x507ed3;}module[_0x0065('0x7')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 5d1a50e..690c999 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 _0x0e2b=['create','/:id/dispositions','addDisposition','post','addAnswer','diskStorage','join','root','format','originalname','single','file','addLogo','server/files/images/avatars/','%s-%s','addAvatar','now','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','replace','extname','/:id/offline','any','offline','addInteraction','/:id/applications','addApplications','addProactiveActions','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getDispositions','/:id/canned_answers','/:id/logo','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents'];(function(_0x665846,_0x5503d8){var _0x16c349=function(_0x2b34a9){while(--_0x2b34a9){_0x665846['push'](_0x665846['shift']());}};_0x16c349(++_0x5503d8);}(_0x0e2b,0xc4));var _0xb0e2=function(_0x201b69,_0x4a9b92){_0x201b69=_0x201b69-0x0;var _0x5a0c53=_0x0e2b[_0x201b69];return _0x5a0c53;};'use strict';var multer=require(_0xb0e2('0x0'));var util=require('util');var path=require(_0xb0e2('0x1'));var timeout=require(_0xb0e2('0x2'));var express=require(_0xb0e2('0x3'));var router=express[_0xb0e2('0x4')]();var fs_extra=require(_0xb0e2('0x5'));var auth=require(_0xb0e2('0x6'));var interaction=require(_0xb0e2('0x7'));var config=require('../../config/environment');var controller=require(_0xb0e2('0x8'));router[_0xb0e2('0x9')]('/',auth[_0xb0e2('0xa')](),controller[_0xb0e2('0xb')]);router['get'](_0xb0e2('0xc'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0xd')]);router[_0xb0e2('0x9')](_0xb0e2('0xe'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0xf')]);router[_0xb0e2('0x9')]('/:id/dispositions',auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x10')]);router[_0xb0e2('0x9')](_0xb0e2('0x11'),auth[_0xb0e2('0xa')](),controller['getAnswers']);router[_0xb0e2('0x9')](_0xb0e2('0x12'),controller[_0xb0e2('0x13')]);router[_0xb0e2('0x9')](_0xb0e2('0x14'),controller[_0xb0e2('0x15')]);router[_0xb0e2('0x9')](_0xb0e2('0x16'),controller[_0xb0e2('0x17')]);router[_0xb0e2('0x9')](_0xb0e2('0x18'),controller[_0xb0e2('0x19')]);router[_0xb0e2('0x9')](_0xb0e2('0x1a'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xb0e2('0x9')](_0xb0e2('0x1b'),controller[_0xb0e2('0x1c')]);router[_0xb0e2('0x9')]('/:id/applications',auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x1d')]);router[_0xb0e2('0x9')](_0xb0e2('0x1e'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x1f')]);router[_0xb0e2('0x9')](_0xb0e2('0x20'),controller[_0xb0e2('0x21')]);router['get'](_0xb0e2('0x22'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x23')]);router[_0xb0e2('0x9')](_0xb0e2('0x24'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x25')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb0e2('0x26')]);router['post'](_0xb0e2('0x27'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x28')]);router[_0xb0e2('0x29')](_0xb0e2('0x11'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x2a')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0x38e4c5,_0x5a68c1,_0x1dc759){_0x1dc759(null,path[_0xb0e2('0x2c')](config[_0xb0e2('0x2d')],'server/files/images/logos/'));},'filename':function(_0x4b565c,_0x23b24f,_0x30c307){_0x30c307(null,util[_0xb0e2('0x2e')]('%s-%s',Date['now'](),_0x23b24f[_0xb0e2('0x2f')]));}})});router[_0xb0e2('0x29')](_0xb0e2('0x12'),upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x32')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0x4db140,_0x5a941a,_0x2bc536){_0x2bc536(null,path[_0xb0e2('0x2c')](config[_0xb0e2('0x2d')],_0xb0e2('0x33')));},'filename':function(_0x43ee2e,_0x3f415a,_0x93df85){_0x93df85(null,util[_0xb0e2('0x2e')](_0xb0e2('0x34'),Date['now'](),_0x3f415a['originalname']));}})});router[_0xb0e2('0x29')](_0xb0e2('0x14'),upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x35')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0x4d0ac1,_0x4a9699,_0x4b7b2c){_0x4b7b2c(null,path[_0xb0e2('0x2c')](config['root'],_0xb0e2('0x33')));},'filename':function(_0x8c1b31,_0x4469e4,_0x1db9d8){_0x1db9d8(null,util[_0xb0e2('0x2e')](_0xb0e2('0x34'),Date[_0xb0e2('0x36')](),_0x4469e4[_0xb0e2('0x2f')]));}})});router['post']('/:id/customer_avatar',upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x37')]);var upload=multer({'storage':multer[_0xb0e2('0x2b')]({'destination':function(_0xe485e0,_0x175618,_0x4b1634){_0x4b1634(null,path[_0xb0e2('0x2c')](config[_0xb0e2('0x2d')],_0xb0e2('0x33')));},'filename':function(_0xf113d9,_0x3c1c66,_0x754298){_0x754298(null,util[_0xb0e2('0x2e')](_0xb0e2('0x34'),Date[_0xb0e2('0x36')](),_0x3c1c66[_0xb0e2('0x2f')]));}})});router['post'](_0xb0e2('0x18'),upload[_0xb0e2('0x30')](_0xb0e2('0x31')),controller[_0xb0e2('0x38')]);router['post'](_0xb0e2('0x39'),controller[_0xb0e2('0x3a')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x572e7e,_0x47a873,_0x2987d1){const _0x59f58c=path['join'](config['root'],_0xb0e2('0x3b'),_0xb0e2('0x3c'),_0xb0e2('0x3d'));fs_extra['ensureDir'](_0x59f58c,function(){_0x2987d1(null,_0x59f58c);});},'filename':function(_0x3ccd07,_0xd8b1d7,_0x269e47){const _0x1d4511=_0xd8b1d7['originalname'][_0xb0e2('0x3e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xdcb853=path[_0xb0e2('0x3f')](_0x1d4511);const _0x264111=Date['now']()+'-'+_0x1d4511[_0xb0e2('0x3e')](_0xdcb853,'')+_0xdcb853;_0x269e47(null,_0x264111);}})});router[_0xb0e2('0x29')](_0xb0e2('0x40'),offlineUploadMulter[_0xb0e2('0x41')](),controller[_0xb0e2('0x42')]);router['post']('/:id/interactions',auth['isAuthenticated'](),controller[_0xb0e2('0x43')]);router[_0xb0e2('0x29')](_0xb0e2('0x44'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x45')]);router[_0xb0e2('0x29')](_0xb0e2('0x1e'),auth['isAuthenticated'](),controller[_0xb0e2('0x46')]);router[_0xb0e2('0x29')](_0xb0e2('0x24'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x47')]);router[_0xb0e2('0x48')](_0xb0e2('0xe'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x49')]);router[_0xb0e2('0x4a')](_0xb0e2('0xe'),auth['isAuthenticated'](),controller[_0xb0e2('0x4b')]);router[_0xb0e2('0x4a')](_0xb0e2('0x27'),auth['isAuthenticated'](),controller[_0xb0e2('0x4c')]);router[_0xb0e2('0x4a')](_0xb0e2('0x11'),auth[_0xb0e2('0xa')](),controller[_0xb0e2('0x4d')]);router['delete'](_0xb0e2('0x24'),auth[_0xb0e2('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x19db=['/:id/users','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','getFields','/:id/offline_messages','getOfflineMessages','getAgents','create','post','addDisposition','addAnswer','root','server/files/images/logos/','format','%s-%s','now','originalname','file','diskStorage','join','server/files/images/avatars/','single','/:id/customer_avatar','/:id/notify','attachments','ensureDir','extname','replace','/:id/offline','addInteraction','addProactiveActions'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x19db,0x196));var _0xb19d=function(_0x2fb87c,_0x2dee49){_0x2fb87c=_0x2fb87c-0x0;var _0x43038b=_0x19db[_0x2fb87c];return _0x43038b;};'use strict';var multer=require(_0xb19d('0x0'));var util=require(_0xb19d('0x1'));var path=require(_0xb19d('0x2'));var timeout=require(_0xb19d('0x3'));var express=require(_0xb19d('0x4'));var router=express['Router']();var fs_extra=require(_0xb19d('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb19d('0x6'));var controller=require(_0xb19d('0x7'));router[_0xb19d('0x8')]('/',auth[_0xb19d('0x9')](),controller[_0xb19d('0xa')]);router[_0xb19d('0x8')]('/describe',auth[_0xb19d('0x9')](),controller[_0xb19d('0xb')]);router[_0xb19d('0x8')](_0xb19d('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0xb19d('0xd'),auth[_0xb19d('0x9')](),controller[_0xb19d('0xe')]);router[_0xb19d('0x8')](_0xb19d('0xf'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x10')]);router[_0xb19d('0x8')](_0xb19d('0x11'),controller[_0xb19d('0x12')]);router[_0xb19d('0x8')](_0xb19d('0x13'),controller['getAvatar']);router[_0xb19d('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router[_0xb19d('0x8')](_0xb19d('0x14'),controller[_0xb19d('0x15')]);router[_0xb19d('0x8')](_0xb19d('0x16'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x17')]);router[_0xb19d('0x8')]('/:id/snippet',controller['getSnippet']);router['get'](_0xb19d('0x18'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x19')]);router[_0xb19d('0x8')](_0xb19d('0x1a'),auth['isAuthenticated'](),controller[_0xb19d('0x1b')]);router[_0xb19d('0x8')]('/:id/fields',controller[_0xb19d('0x1c')]);router[_0xb19d('0x8')](_0xb19d('0x1d'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x1e')]);router[_0xb19d('0x8')]('/:id/users',auth[_0xb19d('0x9')](),controller[_0xb19d('0x1f')]);router['post']('/',auth[_0xb19d('0x9')](),controller[_0xb19d('0x20')]);router[_0xb19d('0x21')]('/:id/dispositions',auth[_0xb19d('0x9')](),controller[_0xb19d('0x22')]);router[_0xb19d('0x21')]('/:id/canned_answers',auth[_0xb19d('0x9')](),controller[_0xb19d('0x23')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x37415e,_0x5a7765,_0x3aa77d){_0x3aa77d(null,path['join'](config[_0xb19d('0x24')],_0xb19d('0x25')));},'filename':function(_0x48e33f,_0x254671,_0x4a25e4){_0x4a25e4(null,util[_0xb19d('0x26')](_0xb19d('0x27'),Date[_0xb19d('0x28')](),_0x254671[_0xb19d('0x29')]));}})});router['post'](_0xb19d('0x11'),upload['single'](_0xb19d('0x2a')),controller['addLogo']);var upload=multer({'storage':multer[_0xb19d('0x2b')]({'destination':function(_0x39b118,_0x2a79f6,_0x59010a){_0x59010a(null,path[_0xb19d('0x2c')](config['root'],_0xb19d('0x2d')));},'filename':function(_0x312e9a,_0x4a1ad4,_0x82bfa7){_0x82bfa7(null,util[_0xb19d('0x26')]('%s-%s',Date[_0xb19d('0x28')](),_0x4a1ad4[_0xb19d('0x29')]));}})});router[_0xb19d('0x21')]('/:id/avatar',upload[_0xb19d('0x2e')](_0xb19d('0x2a')),controller['addAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x28d32a,_0x298238,_0x21fe16){_0x21fe16(null,path[_0xb19d('0x2c')](config[_0xb19d('0x24')],_0xb19d('0x2d')));},'filename':function(_0x51c400,_0x4b3ee6,_0x204ba9){_0x204ba9(null,util[_0xb19d('0x26')](_0xb19d('0x27'),Date['now'](),_0x4b3ee6[_0xb19d('0x29')]));}})});router[_0xb19d('0x21')](_0xb19d('0x2f'),upload[_0xb19d('0x2e')](_0xb19d('0x2a')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xb19d('0x2b')]({'destination':function(_0x458279,_0xb611b7,_0x357c5c){_0x357c5c(null,path['join'](config[_0xb19d('0x24')],_0xb19d('0x2d')));},'filename':function(_0x1eb73e,_0x36e221,_0x4dbbde){_0x4dbbde(null,util[_0xb19d('0x26')](_0xb19d('0x27'),Date[_0xb19d('0x28')](),_0x36e221[_0xb19d('0x29')]));}})});router[_0xb19d('0x21')](_0xb19d('0x14'),upload[_0xb19d('0x2e')]('file'),controller['addSystemAvatar']);router['post'](_0xb19d('0x30'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x13f727,_0x38eb02,_0xb95950){const _0x1fe7c2=path[_0xb19d('0x2c')](config[_0xb19d('0x24')],'server/files',_0xb19d('0x31'),'offline-chat');fs_extra[_0xb19d('0x32')](_0x1fe7c2,function(){_0xb95950(null,_0x1fe7c2);});},'filename':function(_0x3b26ba,_0x25d374,_0x54de63){const _0xb647e1=_0x25d374['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x15ca2c=path[_0xb19d('0x33')](_0xb647e1);const _0x153bc4=Date['now']()+'-'+_0xb647e1[_0xb19d('0x34')](_0x15ca2c,'')+_0x15ca2c;_0x54de63(null,_0x153bc4);}})});router['post'](_0xb19d('0x35'),offlineUploadMulter['any'](),controller['offline']);router[_0xb19d('0x21')](_0xb19d('0x16'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x36')]);router['post']('/:id/applications',auth[_0xb19d('0x9')](),controller['addApplications']);router[_0xb19d('0x21')](_0xb19d('0x1a'),auth['isAuthenticated'](),controller[_0xb19d('0x37')]);router[_0xb19d('0x21')](_0xb19d('0x38'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x39')]);router[_0xb19d('0x3a')]('/:id',auth[_0xb19d('0x9')](),controller[_0xb19d('0x3b')]);router[_0xb19d('0x3c')](_0xb19d('0xc'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x3d')]);router['delete'](_0xb19d('0xd'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x3e')]);router[_0xb19d('0x3c')](_0xb19d('0xf'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x3f')]);router[_0xb19d('0x3c')](_0xb19d('0x38'),auth[_0xb19d('0x9')](),controller[_0xb19d('0x40')]);module[_0xb19d('0x41')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index a51f0c2..7429f13 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 _0x8a0a=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','beaver-logger/server','express','../components/auth/service','../config/environment','env','production','app','get'];(function(_0xee99a8,_0x1312c0){var _0x374681=function(_0x35a7c9){while(--_0x35a7c9){_0xee99a8['push'](_0xee99a8['shift']());}};_0x374681(++_0x1312c0);}(_0x8a0a,0xb3));var _0xa8a0=function(_0x27fca1,_0x40af1d){_0x27fca1=_0x27fca1-0x0;var _0x2f6dfa=_0x8a0a[_0x27fca1];return _0x2f6dfa;};var beaverLogger=require(_0xa8a0('0x0'));var express=require(_0xa8a0('0x1'));var auth=require(_0xa8a0('0x2'));var config=require(_0xa8a0('0x3'));var router=express['Router']();var isProduction=config[_0xa8a0('0x4')]===_0xa8a0('0x5')||![];function clientSideLogs(_0x12045b,_0x56a71f,_0x4e9f0e){var _0x4d3f67=_0x12045b[_0xa8a0('0x6')][_0xa8a0('0x7')]('client-side-logger');if(!_0x4d3f67){throw new Error(_0xa8a0('0x8'));}return beaverLogger[_0xa8a0('0x9')]({'uri':_0xa8a0('0xa'),'logger':_0x4d3f67,'enableCors':!isProduction})(_0x12045b,_0x56a71f,_0x4e9f0e);}router['use'](auth['isAuthenticated'](),clientSideLogs);module['exports']=router; \ No newline at end of file +var _0x203d=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','exports','express','../components/auth/service','Router','env','app','get'];(function(_0x23e314,_0x2ba525){var _0x3c1bf4=function(_0x7ec1b4){while(--_0x7ec1b4){_0x23e314['push'](_0x23e314['shift']());}};_0x3c1bf4(++_0x2ba525);}(_0x203d,0x66));var _0xd203=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x203d[_0xdea41a];return _0x15d0d8;};var beaverLogger=require('beaver-logger/server');var express=require(_0xd203('0x0'));var auth=require(_0xd203('0x1'));var config=require('../config/environment');var router=express[_0xd203('0x2')]();var isProduction=config[_0xd203('0x3')]==='production'||![];function clientSideLogs(_0x1b0785,_0x3766ac,_0x264de3){var _0x532383=_0x1b0785[_0xd203('0x4')][_0xd203('0x5')]('client-side-logger');if(!_0x532383){throw new Error(_0xd203('0x6'));}return beaverLogger[_0xd203('0x7')]({'uri':_0xd203('0x8'),'logger':_0x532383,'enableCors':!isProduction})(_0x1b0785,_0x3766ac,_0x264de3);}router[_0xd203('0x9')](auth[_0xd203('0xa')](),clientSideLogs);module[_0xd203('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 9e7ef79..1eaf327 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 _0xd1ba=['ENUM','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','Google','MicrosoftAzure'];(function(_0x4e204d,_0x7d3f57){var _0x206e69=function(_0x10056c){while(--_0x10056c){_0x4e204d['push'](_0x4e204d['shift']());}};_0x206e69(++_0x7d3f57);}(_0xd1ba,0x12f));var _0xad1b=function(_0x482c10,_0x16ea3c){_0x482c10=_0x482c10-0x0;var _0x313969=_0xd1ba[_0x482c10];return _0x313969;};'use strict';var Sequelize=require(_0xad1b('0x0'));module[_0xad1b('0x1')]={'name':{'type':Sequelize[_0xad1b('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM']('AmazonAWS',_0xad1b('0x3'),_0xad1b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xad1b('0x5')](_0xad1b('0x6'),_0xad1b('0x7'))},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize['STRING'],'comment':_0xad1b('0x8')},'data3':{'type':Sequelize[_0xad1b('0x2')],'comment':'MicrosoftAzure\x20=>\x20client_secret'},'data4':{'type':Sequelize[_0xad1b('0x2')],'comment':_0xad1b('0x9')},'data5':{'type':Sequelize[_0xad1b('0xa')],'comment':_0xad1b('0xb')},'data6':{'type':Sequelize[_0xad1b('0xa')],'comment':_0xad1b('0xc')},'data7':{'type':Sequelize[_0xad1b('0xa')],'comment':_0xad1b('0xd')}}; \ No newline at end of file +var _0x7554=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x34d8a1,_0x4e9d8f){var _0x11b1ce=function(_0x4ac29e){while(--_0x4ac29e){_0x34d8a1['push'](_0x34d8a1['shift']());}};_0x11b1ce(++_0x4e9d8f);}(_0x7554,0x1a5));var _0x4755=function(_0x1cd762,_0x223478){_0x1cd762=_0x1cd762-0x0;var _0x45128a=_0x7554[_0x1cd762];return _0x45128a;};'use strict';var Sequelize=require(_0x4755('0x0'));module[_0x4755('0x1')]={'name':{'type':Sequelize[_0x4755('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x4755('0x3')]('AmazonAWS','Google',_0x4755('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x4755('0x3')](_0x4755('0x5'),_0x4755('0x6'))},'data1':{'type':Sequelize[_0x4755('0x2')],'comment':_0x4755('0x7')},'data2':{'type':Sequelize[_0x4755('0x2')],'comment':_0x4755('0x8')},'data3':{'type':Sequelize[_0x4755('0x2')],'comment':_0x4755('0x9')},'data4':{'type':Sequelize['STRING'],'comment':_0x4755('0xa')},'data5':{'type':Sequelize[_0x4755('0xb')],'comment':_0x4755('0xc')},'data6':{'type':Sequelize[_0x4755('0xb')],'comment':_0x4755('0xd')},'data7':{'type':Sequelize[_0x4755('0xb')],'comment':_0x4755('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index e9cb126..660f1c9 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 _0x4d59=['offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','padEnd','slice','index','CloudProvider','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','findAll','rows','service','MicrosoftAzure','decryptString','data3','catch','show','intersection','includeAll','include','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','find','oauth2MicrosoftAuthorize','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','data6','refresh_token','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send','message','stringify','lodash','ioredis','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','socket.io-emitter','redis','sendStatus','status','end','json'];(function(_0x244138,_0x54d0c6){var _0x58b2a4=function(_0x3ca521){while(--_0x3ca521){_0x244138['push'](_0x244138['shift']());}};_0x58b2a4(++_0x54d0c6);}(_0x4d59,0x115));var _0x94d5=function(_0x2f991f,_0x10ec62){_0x2f991f=_0x2f991f-0x0;var _0xa0a9cc=_0x4d59[_0x2f991f];return _0xa0a9cc;};'use strict';var _=require(_0x94d5('0x0'));var Redis=require(_0x94d5('0x1'));var qs=require('../../components/parsers/qs');var encryptor=require(_0x94d5('0x2'));var config=require(_0x94d5('0x3'));var logger=require(_0x94d5('0x4'))(_0x94d5('0x5'));var db=require('../../mysqldb')['db'];var oauth=require(_0x94d5('0x6'));config['redis']=_[_0x94d5('0x7')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x94d5('0x8'))(new Redis(config[_0x94d5('0x9')]));var redis=new Redis(config['redis']);function respondWithStatusCode(_0x4b2520,_0x3f7f84){_0x3f7f84=_0x3f7f84||0xcc;return function(_0x32a544){if(_0x32a544){return _0x4b2520[_0x94d5('0xa')](_0x3f7f84);}return _0x4b2520[_0x94d5('0xb')](_0x3f7f84)[_0x94d5('0xc')]();};}function respondWithResult(_0x2675c3,_0x3c1799){_0x3c1799=_0x3c1799||0xc8;return function(_0x467a54){if(_0x467a54){return _0x2675c3[_0x94d5('0xb')](_0x3c1799)[_0x94d5('0xd')](_0x467a54);}};}function respondWithFilteredResult(_0x585aae,_0x4eca64){return function(_0x3d974a){if(_0x3d974a){var _0x31a42d=typeof _0x4eca64[_0x94d5('0xe')]===_0x94d5('0xf')&&typeof _0x4eca64[_0x94d5('0x10')]===_0x94d5('0xf');var _0x445750=_0x3d974a[_0x94d5('0x11')];var _0x2f5389=_0x31a42d?0x0:_0x4eca64[_0x94d5('0xe')];var _0x277b9b=_0x31a42d?_0x3d974a[_0x94d5('0x11')]:_0x4eca64['offset']+_0x4eca64[_0x94d5('0x10')];var _0xf1a9bd;if(_0x277b9b>=_0x445750){_0x277b9b=_0x445750;_0xf1a9bd=0xc8;}else{_0xf1a9bd=0xce;}_0x585aae[_0x94d5('0xb')](_0xf1a9bd);return _0x585aae[_0x94d5('0x12')](_0x94d5('0x13'),_0x2f5389+'-'+_0x277b9b+'/'+_0x445750)[_0x94d5('0xd')](_0x3d974a);}return null;};}function saveUpdates(_0x538868){return function(_0x1313b0){if(_0x1313b0){return _0x1313b0[_0x94d5('0x14')](_0x538868)[_0x94d5('0x15')](function(_0x3e6b91){return _0x3e6b91;});}return null;};}function removeEntity(_0x402865){return function(_0x59f1a2){if(_0x59f1a2){return _0x59f1a2[_0x94d5('0x16')]()[_0x94d5('0x15')](function(){_0x402865['status'](0xcc)[_0x94d5('0xc')]();});}};}function handleEntityNotFound(_0x349c4d){return function(_0x16fe7b){if(!_0x16fe7b){_0x349c4d[_0x94d5('0xa')](0x194);}return _0x16fe7b;};}function handleError(_0x3be241,_0x422a06){_0x422a06=_0x422a06||0x1f4;return function(_0xec2397){logger[_0x94d5('0x17')](_0xec2397[_0x94d5('0x18')]);if(_0xec2397['name']){delete _0xec2397[_0x94d5('0x19')];}_0x3be241['status'](_0x422a06)['send'](_0xec2397);};}function maskClientSecret(_0x1cc869){return _[_0x94d5('0x1a')](_0x1cc869[_0x94d5('0x1b')](0x0,0x3),0x14,'*');}exports[_0x94d5('0x1c')]=function(_0x44f730,_0x1b6302){var _0x3443d5={},_0x15dc15={},_0x4586b9={'count':0x0,'rows':[]};var _0x19a1fd=_['map'](db[_0x94d5('0x1d')][_0x94d5('0x1e')],function(_0x5ee426){return{'name':_0x5ee426[_0x94d5('0x1f')],'type':_0x5ee426['type'][_0x94d5('0x20')]};});_0x15dc15[_0x94d5('0x21')]=_[_0x94d5('0x22')](_0x19a1fd,_0x94d5('0x19'));_0x15dc15['query']=_[_0x94d5('0x23')](_0x44f730[_0x94d5('0x24')]);_0x15dc15[_0x94d5('0x25')]=_['intersection'](_0x15dc15[_0x94d5('0x21')],_0x15dc15[_0x94d5('0x24')]);_0x3443d5[_0x94d5('0x26')]=_['intersection'](_0x15dc15[_0x94d5('0x21')],qs['fields'](_0x44f730[_0x94d5('0x24')][_0x94d5('0x27')]));_0x3443d5[_0x94d5('0x26')]=_0x3443d5['attributes'][_0x94d5('0x28')]?_0x3443d5[_0x94d5('0x26')]:_0x15dc15[_0x94d5('0x21')];if(!_0x44f730['query'][_0x94d5('0x29')](_0x94d5('0x2a'))){_0x3443d5[_0x94d5('0x10')]=qs[_0x94d5('0x10')](_0x44f730[_0x94d5('0x24')]['limit']);_0x3443d5['offset']=qs[_0x94d5('0xe')](_0x44f730['query'][_0x94d5('0xe')]);}_0x3443d5[_0x94d5('0x2b')]=qs[_0x94d5('0x2c')](_0x44f730[_0x94d5('0x24')][_0x94d5('0x2c')]);_0x3443d5[_0x94d5('0x2d')]=qs[_0x94d5('0x25')](_['pick'](_0x44f730['query'],_0x15dc15[_0x94d5('0x25')]),_0x19a1fd);if(_0x44f730[_0x94d5('0x24')][_0x94d5('0x2e')]){_0x3443d5[_0x94d5('0x2d')]=_[_0x94d5('0x2f')](_0x3443d5[_0x94d5('0x2d')],{'$or':_['map'](_0x19a1fd,function(_0x4098ee){if(_0x4098ee[_0x94d5('0x30')]!==_0x94d5('0x31')){var _0x22bbdd={};_0x22bbdd[_0x4098ee[_0x94d5('0x19')]]={'$like':'%'+_0x44f730[_0x94d5('0x24')]['filter']+'%'};return _0x22bbdd;}})});}_0x3443d5=_[_0x94d5('0x2f')]({},_0x3443d5,_0x44f730[_0x94d5('0x32')]);var _0x1f064d={'where':_0x3443d5[_0x94d5('0x2d')]};return db['CloudProvider'][_0x94d5('0x11')](_0x1f064d)[_0x94d5('0x15')](function(_0x24e029){_0x4586b9[_0x94d5('0x11')]=_0x24e029;if(_0x44f730[_0x94d5('0x24')]['includeAll']){_0x3443d5['include']=[{'all':!![]}];}return db[_0x94d5('0x1d')][_0x94d5('0x33')](_0x3443d5);})['then'](function(_0x5d8853){_0x4586b9[_0x94d5('0x34')]=_[_0x94d5('0x22')](_0x5d8853,function(_0x135ef4){if(_0x135ef4[_0x94d5('0x35')]===_0x94d5('0x36')){var _0x3f58f8=encryptor[_0x94d5('0x37')](_0x135ef4[_0x94d5('0x38')]);_0x135ef4[_0x94d5('0x38')]=maskClientSecret(_0x3f58f8);}return _0x135ef4;});return _0x4586b9;})[_0x94d5('0x15')](respondWithFilteredResult(_0x1b6302,_0x3443d5))[_0x94d5('0x39')](handleError(_0x1b6302,null));};exports[_0x94d5('0x3a')]=function(_0x3718e7,_0x38afe3){var _0x465f1d={'raw':!![],'where':{'id':_0x3718e7['params']['id']}},_0x2a7882={};_0x2a7882['model']=_[_0x94d5('0x23')](db[_0x94d5('0x1d')][_0x94d5('0x1e')]);_0x2a7882[_0x94d5('0x24')]=_['keys'](_0x3718e7[_0x94d5('0x24')]);_0x2a7882[_0x94d5('0x25')]=_[_0x94d5('0x3b')](_0x2a7882[_0x94d5('0x21')],_0x2a7882[_0x94d5('0x24')]);_0x465f1d[_0x94d5('0x26')]=_[_0x94d5('0x3b')](_0x2a7882[_0x94d5('0x21')],qs['fields'](_0x3718e7[_0x94d5('0x24')][_0x94d5('0x27')]));_0x465f1d[_0x94d5('0x26')]=_0x465f1d['attributes'][_0x94d5('0x28')]?_0x465f1d['attributes']:_0x2a7882[_0x94d5('0x21')];if(_0x3718e7[_0x94d5('0x24')][_0x94d5('0x3c')]){_0x465f1d[_0x94d5('0x3d')]=[{'all':!![]}];}_0x465f1d=_[_0x94d5('0x2f')]({},_0x465f1d,_0x3718e7[_0x94d5('0x32')]);return db[_0x94d5('0x1d')]['find'](_0x465f1d)['then'](handleEntityNotFound(_0x38afe3,null))['then'](function(_0x353d9f){if(_0x353d9f[_0x94d5('0x35')]===_0x94d5('0x36')){var _0x23f73e=encryptor[_0x94d5('0x37')](_0x353d9f[_0x94d5('0x38')]);_0x353d9f['data3']=maskClientSecret(_0x23f73e);}return _0x353d9f;})['then'](respondWithResult(_0x38afe3,null))['catch'](handleError(_0x38afe3,null));};exports[_0x94d5('0x3e')]=function(_0x594c1d,_0x53f1c8){if(!_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x19')])throw new Error(_0x94d5('0x40'));if(!_0x594c1d['body'][_0x94d5('0x35')])throw new Error(_0x94d5('0x41'));var _0x2347fe=db[_0x94d5('0x1d')][_0x94d5('0x1e')][_0x94d5('0x35')]['values'];if(!_0x2347fe['includes'](_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x35')]))throw new Error(_0x94d5('0x42')+_0x2347fe[_0x94d5('0x43')](',\x20'));if(_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x35')]==='MicrosoftAzure'&&_0x594c1d['body'][_0x94d5('0x38')]){_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x38')]=encryptor[_0x94d5('0x44')](_0x594c1d[_0x94d5('0x3f')][_0x94d5('0x38')]);}return db[_0x94d5('0x1d')][_0x94d5('0x3e')](_0x594c1d['body'],{})[_0x94d5('0x15')](respondWithResult(_0x53f1c8,0xc9))[_0x94d5('0x39')](handleError(_0x53f1c8,null));};exports[_0x94d5('0x14')]=function(_0x196461,_0x3b45fb){if(_0x196461[_0x94d5('0x3f')]['id']){delete _0x196461[_0x94d5('0x3f')]['id'];}return db['CloudProvider']['find']({'where':{'id':_0x196461[_0x94d5('0x45')]['id']}})[_0x94d5('0x15')](handleEntityNotFound(_0x3b45fb,null))[_0x94d5('0x15')](function(_0x2f0ab1){if(_0x2f0ab1[_0x94d5('0x35')]===_0x94d5('0x36')&&_0x196461[_0x94d5('0x3f')]['data3']){_0x196461[_0x94d5('0x3f')][_0x94d5('0x38')]=encryptor['encryptString'](_0x196461[_0x94d5('0x3f')][_0x94d5('0x38')]);}return _0x2f0ab1;})[_0x94d5('0x15')](saveUpdates(_0x196461[_0x94d5('0x3f')],null))[_0x94d5('0x15')](respondWithResult(_0x3b45fb,null))[_0x94d5('0x39')](handleError(_0x3b45fb,null));};exports[_0x94d5('0x16')]=function(_0x42d33d,_0x775711){return db[_0x94d5('0x1d')][_0x94d5('0x46')]({'where':{'id':_0x42d33d[_0x94d5('0x45')]['id']}})[_0x94d5('0x15')](handleEntityNotFound(_0x775711,null))[_0x94d5('0x15')](removeEntity(_0x775711,null))['catch'](handleError(_0x775711,null));};exports[_0x94d5('0x47')]=function(_0x3b2af3,_0xe2160e){return db[_0x94d5('0x1d')]['findOne']({'where':{'id':_0x3b2af3[_0x94d5('0x45')]['id']},'raw':!![]})[_0x94d5('0x15')](function(_0x11c13f){if(!_0x11c13f)return _0xe2160e['sendStatus'](0x194);return{'url':oauth[_0x94d5('0x48')](_0x11c13f,_0x3b2af3[_0x94d5('0x49')]['id'])};})[_0x94d5('0x15')](respondWithResult(_0xe2160e,null))[_0x94d5('0x39')](handleError(_0xe2160e,null));};exports['oauth2MicrosoftCallback']=function(_0x6f7d60,_0x17f8d0){var _0x5b76c2=_0x6f7d60[_0x94d5('0x3f')];var _0x42317f;var _0x5280b3;if(_0x5b76c2[_0x94d5('0x17')])throw _0x5b76c2;redis[_0x94d5('0x4a')](_0x5b76c2[_0x94d5('0x4b')])['then'](function(_0x120d37){if(!_0x120d37)throw new Error(_0x94d5('0x4c'));_0x42317f=JSON[_0x94d5('0x4d')](_0x120d37);var _0x5645d3=Buffer[_0x94d5('0x4e')](_0x5b76c2[_0x94d5('0x4b')],'base64')[_0x94d5('0x4f')](_0x94d5('0x50'));_0x5280b3=JSON[_0x94d5('0x4d')](_0x5645d3);if(!oauth[_0x94d5('0x51')](_0x5b76c2[_0x94d5('0x52')],_0x42317f[_0x94d5('0x53')]))throw new Error(_0x94d5('0x54'));redis['del'](_0x5b76c2[_0x94d5('0x4b')]);return oauth[_0x94d5('0x55')](_0x5b76c2[_0x94d5('0x56')],_0x42317f);})[_0x94d5('0x15')](function(_0x573ac7){_0x42317f[_0x94d5('0x57')]=_0x573ac7['access_token'];_0x42317f[_0x94d5('0x58')]=_0x573ac7[_0x94d5('0x59')];return db[_0x94d5('0x1d')][_0x94d5('0x14')]({'data5':_0x42317f[_0x94d5('0x57')],'data6':_0x42317f[_0x94d5('0x58')]},{'where':{'id':_0x42317f['id']}});})['then'](function(){oauth['startRefreshInterval'](_0x42317f);socket[_0x94d5('0x5a')](_0x94d5('0x5b'),{'id':_0x5280b3['id']});return;})[_0x94d5('0x15')](respondWithStatusCode(_0x17f8d0,null))[_0x94d5('0x39')](function(_0x4478ea){if(_0x5280b3){socket['emit'](_0x94d5('0x5c'),{'id':_0x5280b3['id']});}if(!_0x42317f){logger[_0x94d5('0x17')](_0x94d5('0x5d'),_0x4478ea);return _0x17f8d0[_0x94d5('0xb')](0x1f4)[_0x94d5('0x5e')](_0x4478ea[_0x94d5('0x5f')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x42317f['id'],JSON[_0x94d5('0x60')](_0x4478ea));});}; \ No newline at end of file +var _0x9c59=['../../components/encryptor','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','set','update','then','end','error','stack','name','send','padEnd','index','CloudProvider','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','show','params','rawAttributes','find','decryptString','create','body','Name\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','toString','isValidIdToken','id_token','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','message','stringify','lodash','../../components/parsers/qs'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x9c59,0x115));var _0x99c5=function(_0xe3e56a,_0xd3462d){_0xe3e56a=_0xe3e56a-0x0;var _0x5617f2=_0x9c59[_0xe3e56a];return _0x5617f2;};'use strict';var _=require(_0x99c5('0x0'));var Redis=require('ioredis');var qs=require(_0x99c5('0x1'));var encryptor=require(_0x99c5('0x2'));var config=require('../../config/environment');var logger=require(_0x99c5('0x3'))(_0x99c5('0x4'));var db=require(_0x99c5('0x5'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x99c5('0x6')]=_['defaults'](config[_0x99c5('0x6')],{'host':_0x99c5('0x7'),'port':0x18eb});var socket=require(_0x99c5('0x8'))(new Redis(config['redis']));var redis=new Redis(config[_0x99c5('0x6')]);function respondWithStatusCode(_0x14358e,_0xd44207){_0xd44207=_0xd44207||0xcc;return function(_0x42c247){if(_0x42c247){return _0x14358e[_0x99c5('0x9')](_0xd44207);}return _0x14358e[_0x99c5('0xa')](_0xd44207)['end']();};}function respondWithResult(_0x28b684,_0x562839){_0x562839=_0x562839||0xc8;return function(_0x240210){if(_0x240210){return _0x28b684['status'](_0x562839)[_0x99c5('0xb')](_0x240210);}};}function respondWithFilteredResult(_0x54ae0a,_0x5f1861){return function(_0xa2ddb){if(_0xa2ddb){var _0x17eae1=typeof _0x5f1861[_0x99c5('0xc')]===_0x99c5('0xd')&&typeof _0x5f1861[_0x99c5('0xe')]==='undefined';var _0x48bad0=_0xa2ddb[_0x99c5('0xf')];var _0x52510b=_0x17eae1?0x0:_0x5f1861[_0x99c5('0xc')];var _0x41b68c=_0x17eae1?_0xa2ddb[_0x99c5('0xf')]:_0x5f1861['offset']+_0x5f1861[_0x99c5('0xe')];var _0x308d0a;if(_0x41b68c>=_0x48bad0){_0x41b68c=_0x48bad0;_0x308d0a=0xc8;}else{_0x308d0a=0xce;}_0x54ae0a[_0x99c5('0xa')](_0x308d0a);return _0x54ae0a[_0x99c5('0x10')]('Content-Range',_0x52510b+'-'+_0x41b68c+'/'+_0x48bad0)['json'](_0xa2ddb);}return null;};}function saveUpdates(_0x39bac1){return function(_0x51726f){if(_0x51726f){return _0x51726f[_0x99c5('0x11')](_0x39bac1)[_0x99c5('0x12')](function(_0x5e4f4f){return _0x5e4f4f;});}return null;};}function removeEntity(_0x4ea965){return function(_0x891141){if(_0x891141){return _0x891141['destroy']()[_0x99c5('0x12')](function(){_0x4ea965[_0x99c5('0xa')](0xcc)[_0x99c5('0x13')]();});}};}function handleEntityNotFound(_0x178bee){return function(_0x49ad00){if(!_0x49ad00){_0x178bee['sendStatus'](0x194);}return _0x49ad00;};}function handleError(_0x42098a,_0x39326b){_0x39326b=_0x39326b||0x1f4;return function(_0x24156a){logger[_0x99c5('0x14')](_0x24156a[_0x99c5('0x15')]);if(_0x24156a[_0x99c5('0x16')]){delete _0x24156a[_0x99c5('0x16')];}_0x42098a[_0x99c5('0xa')](_0x39326b)[_0x99c5('0x17')](_0x24156a);};}function maskClientSecret(_0x4794f9){return _[_0x99c5('0x18')](_0x4794f9['slice'](0x0,0x3),0x14,'*');}exports[_0x99c5('0x19')]=function(_0x206032,_0x1396e2){var _0x597b4a={},_0x4346c4={},_0x1ee82d={'count':0x0,'rows':[]};var _0x15d7a0=_['map'](db[_0x99c5('0x1a')]['rawAttributes'],function(_0x235483){return{'name':_0x235483[_0x99c5('0x1b')],'type':_0x235483[_0x99c5('0x1c')]['key']};});_0x4346c4[_0x99c5('0x1d')]=_[_0x99c5('0x1e')](_0x15d7a0,_0x99c5('0x16'));_0x4346c4['query']=_[_0x99c5('0x1f')](_0x206032[_0x99c5('0x20')]);_0x4346c4[_0x99c5('0x21')]=_[_0x99c5('0x22')](_0x4346c4[_0x99c5('0x1d')],_0x4346c4[_0x99c5('0x20')]);_0x597b4a[_0x99c5('0x23')]=_[_0x99c5('0x22')](_0x4346c4[_0x99c5('0x1d')],qs['fields'](_0x206032[_0x99c5('0x20')][_0x99c5('0x24')]));_0x597b4a[_0x99c5('0x23')]=_0x597b4a[_0x99c5('0x23')][_0x99c5('0x25')]?_0x597b4a[_0x99c5('0x23')]:_0x4346c4['model'];if(!_0x206032[_0x99c5('0x20')][_0x99c5('0x26')](_0x99c5('0x27'))){_0x597b4a['limit']=qs[_0x99c5('0xe')](_0x206032['query']['limit']);_0x597b4a['offset']=qs['offset'](_0x206032[_0x99c5('0x20')][_0x99c5('0xc')]);}_0x597b4a[_0x99c5('0x28')]=qs[_0x99c5('0x29')](_0x206032[_0x99c5('0x20')][_0x99c5('0x29')]);_0x597b4a[_0x99c5('0x2a')]=qs['filters'](_[_0x99c5('0x2b')](_0x206032[_0x99c5('0x20')],_0x4346c4['filters']),_0x15d7a0);if(_0x206032[_0x99c5('0x20')][_0x99c5('0x2c')]){_0x597b4a[_0x99c5('0x2a')]=_[_0x99c5('0x2d')](_0x597b4a['where'],{'$or':_[_0x99c5('0x1e')](_0x15d7a0,function(_0x3d1251){if(_0x3d1251['type']!==_0x99c5('0x2e')){var _0x490089={};_0x490089[_0x3d1251[_0x99c5('0x16')]]={'$like':'%'+_0x206032[_0x99c5('0x20')][_0x99c5('0x2c')]+'%'};return _0x490089;}})});}_0x597b4a=_[_0x99c5('0x2d')]({},_0x597b4a,_0x206032[_0x99c5('0x2f')]);var _0x3405a7={'where':_0x597b4a[_0x99c5('0x2a')]};return db[_0x99c5('0x1a')][_0x99c5('0xf')](_0x3405a7)['then'](function(_0x5e11fb){_0x1ee82d['count']=_0x5e11fb;if(_0x206032['query'][_0x99c5('0x30')]){_0x597b4a[_0x99c5('0x31')]=[{'all':!![]}];}return db[_0x99c5('0x1a')][_0x99c5('0x32')](_0x597b4a);})[_0x99c5('0x12')](function(_0x2fb05f){_0x1ee82d['rows']=_[_0x99c5('0x1e')](_0x2fb05f,function(_0x13f50e){if(_0x13f50e[_0x99c5('0x33')]===_0x99c5('0x34')){var _0x2be319=encryptor['decryptString'](_0x13f50e[_0x99c5('0x35')]);_0x13f50e['data3']=maskClientSecret(_0x2be319);}return _0x13f50e;});return _0x1ee82d;})[_0x99c5('0x12')](respondWithFilteredResult(_0x1396e2,_0x597b4a))[_0x99c5('0x36')](handleError(_0x1396e2,null));};exports[_0x99c5('0x37')]=function(_0x371e21,_0x16c02b){var _0x348f9a={'raw':!![],'where':{'id':_0x371e21[_0x99c5('0x38')]['id']}},_0x549ac7={};_0x549ac7['model']=_[_0x99c5('0x1f')](db['CloudProvider'][_0x99c5('0x39')]);_0x549ac7[_0x99c5('0x20')]=_[_0x99c5('0x1f')](_0x371e21[_0x99c5('0x20')]);_0x549ac7[_0x99c5('0x21')]=_[_0x99c5('0x22')](_0x549ac7[_0x99c5('0x1d')],_0x549ac7[_0x99c5('0x20')]);_0x348f9a[_0x99c5('0x23')]=_['intersection'](_0x549ac7[_0x99c5('0x1d')],qs[_0x99c5('0x24')](_0x371e21[_0x99c5('0x20')][_0x99c5('0x24')]));_0x348f9a['attributes']=_0x348f9a['attributes'][_0x99c5('0x25')]?_0x348f9a[_0x99c5('0x23')]:_0x549ac7[_0x99c5('0x1d')];if(_0x371e21[_0x99c5('0x20')][_0x99c5('0x30')]){_0x348f9a['include']=[{'all':!![]}];}_0x348f9a=_['merge']({},_0x348f9a,_0x371e21[_0x99c5('0x2f')]);return db[_0x99c5('0x1a')][_0x99c5('0x3a')](_0x348f9a)[_0x99c5('0x12')](handleEntityNotFound(_0x16c02b,null))['then'](function(_0x13b83c){if(_0x13b83c[_0x99c5('0x33')]===_0x99c5('0x34')){var _0xd9978a=encryptor[_0x99c5('0x3b')](_0x13b83c[_0x99c5('0x35')]);_0x13b83c[_0x99c5('0x35')]=maskClientSecret(_0xd9978a);}return _0x13b83c;})[_0x99c5('0x12')](respondWithResult(_0x16c02b,null))[_0x99c5('0x36')](handleError(_0x16c02b,null));};exports[_0x99c5('0x3c')]=function(_0x28d21a,_0x18edaf){if(!_0x28d21a[_0x99c5('0x3d')]['name'])throw new Error(_0x99c5('0x3e'));if(!_0x28d21a['body'][_0x99c5('0x33')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x5761de=db['CloudProvider'][_0x99c5('0x39')][_0x99c5('0x33')][_0x99c5('0x3f')];if(!_0x5761de[_0x99c5('0x40')](_0x28d21a[_0x99c5('0x3d')]['service']))throw new Error(_0x99c5('0x41')+_0x5761de[_0x99c5('0x42')](',\x20'));if(_0x28d21a[_0x99c5('0x3d')]['service']===_0x99c5('0x34')&&_0x28d21a[_0x99c5('0x3d')][_0x99c5('0x35')]){_0x28d21a['body']['data3']=encryptor[_0x99c5('0x43')](_0x28d21a['body'][_0x99c5('0x35')]);}return db[_0x99c5('0x1a')][_0x99c5('0x3c')](_0x28d21a[_0x99c5('0x3d')],{})[_0x99c5('0x12')](respondWithResult(_0x18edaf,0xc9))[_0x99c5('0x36')](handleError(_0x18edaf,null));};exports[_0x99c5('0x11')]=function(_0x2d2e3b,_0x5367e5){if(_0x2d2e3b[_0x99c5('0x3d')]['id']){delete _0x2d2e3b[_0x99c5('0x3d')]['id'];}return db[_0x99c5('0x1a')]['find']({'where':{'id':_0x2d2e3b[_0x99c5('0x38')]['id']}})[_0x99c5('0x12')](handleEntityNotFound(_0x5367e5,null))['then'](function(_0x35aece){if(_0x35aece[_0x99c5('0x33')]==='MicrosoftAzure'&&_0x2d2e3b['body']['data3']){_0x2d2e3b[_0x99c5('0x3d')][_0x99c5('0x35')]=encryptor['encryptString'](_0x2d2e3b[_0x99c5('0x3d')][_0x99c5('0x35')]);}return _0x35aece;})[_0x99c5('0x12')](saveUpdates(_0x2d2e3b[_0x99c5('0x3d')],null))[_0x99c5('0x12')](respondWithResult(_0x5367e5,null))['catch'](handleError(_0x5367e5,null));};exports['destroy']=function(_0x3877ba,_0xb657d4){return db[_0x99c5('0x1a')][_0x99c5('0x3a')]({'where':{'id':_0x3877ba[_0x99c5('0x38')]['id']}})[_0x99c5('0x12')](handleEntityNotFound(_0xb657d4,null))[_0x99c5('0x12')](removeEntity(_0xb657d4,null))[_0x99c5('0x36')](handleError(_0xb657d4,null));};exports[_0x99c5('0x44')]=function(_0x2d3621,_0xc73eff){return db[_0x99c5('0x1a')][_0x99c5('0x45')]({'where':{'id':_0x2d3621[_0x99c5('0x38')]['id']},'raw':!![]})[_0x99c5('0x12')](function(_0x3310c0){if(!_0x3310c0)return _0xc73eff['sendStatus'](0x194);return{'url':oauth[_0x99c5('0x46')](_0x3310c0,_0x2d3621[_0x99c5('0x47')]['id'])};})[_0x99c5('0x12')](respondWithResult(_0xc73eff,null))[_0x99c5('0x36')](handleError(_0xc73eff,null));};exports[_0x99c5('0x48')]=function(_0x2e4c0e,_0xe4c8f9){var _0x5dd88a=_0x2e4c0e[_0x99c5('0x3d')];var _0x9069b3;var _0x3f5e14;if(_0x5dd88a[_0x99c5('0x14')])throw _0x5dd88a;redis[_0x99c5('0x49')](_0x5dd88a[_0x99c5('0x4a')])['then'](function(_0x190561){if(!_0x190561)throw new Error(_0x99c5('0x4b'));_0x9069b3=JSON[_0x99c5('0x4c')](_0x190561);var _0x281e14=Buffer['from'](_0x5dd88a[_0x99c5('0x4a')],'base64')[_0x99c5('0x4d')]('ascii');_0x3f5e14=JSON[_0x99c5('0x4c')](_0x281e14);if(!oauth[_0x99c5('0x4e')](_0x5dd88a[_0x99c5('0x4f')],_0x9069b3['oauth2Claims']))throw new Error(_0x99c5('0x50'));redis[_0x99c5('0x51')](_0x5dd88a[_0x99c5('0x4a')]);return oauth['getOauth2MicrosoftAccessToken'](_0x5dd88a[_0x99c5('0x52')],_0x9069b3);})[_0x99c5('0x12')](function(_0x5d2df4){_0x9069b3[_0x99c5('0x53')]=_0x5d2df4[_0x99c5('0x54')];_0x9069b3[_0x99c5('0x55')]=_0x5d2df4[_0x99c5('0x56')];return db[_0x99c5('0x1a')][_0x99c5('0x11')]({'data5':_0x9069b3[_0x99c5('0x53')],'data6':_0x9069b3[_0x99c5('0x55')]},{'where':{'id':_0x9069b3['id']}});})['then'](function(){oauth[_0x99c5('0x57')](_0x9069b3);socket[_0x99c5('0x58')](_0x99c5('0x59'),{'id':_0x3f5e14['id']});return;})[_0x99c5('0x12')](respondWithStatusCode(_0xe4c8f9,null))[_0x99c5('0x36')](function(_0xfaa083){if(_0x3f5e14){socket[_0x99c5('0x58')](_0x99c5('0x5a'),{'id':_0x3f5e14['id']});}if(!_0x9069b3){logger[_0x99c5('0x14')]('Invalid\x20authentication\x20state\x20parameter',_0xfaa083);return _0xe4c8f9[_0x99c5('0xa')](0x1f4)[_0x99c5('0x17')](_0xfaa083[_0x99c5('0x5b')]);}logger[_0x99c5('0x14')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x9069b3['id'],JSON[_0x99c5('0x5c')](_0xfaa083));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 6ab89df..0f29706 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 _0x7903=['request-promise','path','rimraf','../../config/environment','./cloudProvider.attributes','exports','cloud_providers','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7903,0x13b));var _0x3790=function(_0x445002,_0x25bce8){_0x445002=_0x445002-0x0;var _0x4a256f=_0x7903[_0x445002];return _0x4a256f;};'use strict';var _=require(_0x3790('0x0'));var util=require(_0x3790('0x1'));var logger=require(_0x3790('0x2'))(_0x3790('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3790('0x4'));var fs=require('fs');var path=require(_0x3790('0x5'));var rimraf=require(_0x3790('0x6'));var config=require(_0x3790('0x7'));var attributes=require(_0x3790('0x8'));module[_0x3790('0x9')]=function(_0x45c5c4,_0x906b2a){return _0x45c5c4['define']('CloudProvider',attributes,{'tableName':_0x3790('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0ac2=['../../config/logger','api','moment','request-promise','path','../../config/environment','CloudProvider'];(function(_0x3f7598,_0x212e37){var _0x51fb16=function(_0x4a5c0b){while(--_0x4a5c0b){_0x3f7598['push'](_0x3f7598['shift']());}};_0x51fb16(++_0x212e37);}(_0x0ac2,0x15e));var _0x20ac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0ac2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x20ac('0x0'))(_0x20ac('0x1'));var moment=require(_0x20ac('0x2'));var BPromise=require('bluebird');var rp=require(_0x20ac('0x3'));var fs=require('fs');var path=require(_0x20ac('0x4'));var rimraf=require('rimraf');var config=require(_0x20ac('0x5'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x75ed64,_0x294ca6){return _0x75ed64['define'](_0x20ac('0x6'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index d6df790..7d778c6 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 _0xf6f8=['https://outlook.office.com/SMTP.Send','openid','/authorize','/token','map','type','Dynamics365','push','data7','join','/.default','replace','{TENANT_ID}','data2','code','id_token','from','toString','base64','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','value','oauth2Claims','set','stringify','decode','payload','iss','aud','audience','isAfter','unix','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../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(_0xa7242e,_0x22572b){var _0x55dbc4=function(_0x54d6f6){while(--_0x54d6f6){_0xa7242e['push'](_0xa7242e['shift']());}};_0x55dbc4(++_0x22572b);}(_0xf6f8,0xe6));var _0x8f6f=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0xf6f8[_0x49d41c];return _0xb64c5f;};'use strict';var _=require('lodash');var crypto=require(_0x8f6f('0x0'));var jwt=require(_0x8f6f('0x1'));var moment=require(_0x8f6f('0x2'));var Redis=require(_0x8f6f('0x3'));var rp=require(_0x8f6f('0x4'));var util=require(_0x8f6f('0x5'));var encryptor=require(_0x8f6f('0x6'));var config=require(_0x8f6f('0x7'));var logger=require('../../config/logger')(_0x8f6f('0x8'));var schedule=require(_0x8f6f('0x9'));var db=require(_0x8f6f('0xa'))['db'];config[_0x8f6f('0xb')]=_[_0x8f6f('0xc')](config[_0x8f6f('0xb')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x8f6f('0xb')]);var MICROSOFT_AUTH_URL=_0x8f6f('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0x8f6f('0xe'),_0x8f6f('0xf'),_0x8f6f('0x10'),_0x8f6f('0x11'),_0x8f6f('0x12'),_0x8f6f('0x13')],'Dynamics365':[_0x8f6f('0x14'),_0x8f6f('0x10')]};var MICROSOFT_AUTH_ENDPOINT=_0x8f6f('0x15');var MICROSOFT_TOKEN_ENDPOINT=_0x8f6f('0x16');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x41e4e5){var _0xf0b71d=_[_0x8f6f('0x17')](AZURE_AUTH_SCOPES[_0x41e4e5[_0x8f6f('0x18')]]);if(_0x41e4e5['type']===_0x8f6f('0x19'))_0xf0b71d[_0x8f6f('0x1a')](_0x41e4e5[_0x8f6f('0x1b')]+'/.default');return _0xf0b71d[_0x8f6f('0x1c')]('\x20');}function getAccessTokenScope(_0x475f08){if(_0x475f08['type']==='Outlook365')return'https://outlook.office365.com/IMAP.AccessAsUser.All';if(_0x475f08[_0x8f6f('0x18')]===_0x8f6f('0x19'))return _0x475f08[_0x8f6f('0x1b')]+_0x8f6f('0x1d');}function generateMicrosoftAuthorizationUrl(_0x119f3e,_0x4ef92c){var _0x191af7=MICROSOFT_AUTH_URL[_0x8f6f('0x1e')](_0x8f6f('0x1f'),_0x119f3e[_0x8f6f('0x20')]);var _0xb1f8aa=[_0x8f6f('0x21'),_0x8f6f('0x22')];var _0x32ec7c=Buffer[_0x8f6f('0x23')](JSON['stringify']({'id':_0x4ef92c}))[_0x8f6f('0x24')](_0x8f6f('0x25'));var _0x5bd2e1=crypto['randomBytes'](0x10)['toString'](_0x8f6f('0x26'));var _0x7713c1=getAuthorizationScopes(_0x119f3e);var _0x3ab13f=[{'key':_0x8f6f('0x27'),'value':_0x119f3e[_0x8f6f('0x28')]},{'key':_0x8f6f('0x29'),'value':encodeURIComponent(_0xb1f8aa[_0x8f6f('0x1c')]('\x20'))},{'key':_0x8f6f('0x2a'),'value':_0x119f3e[_0x8f6f('0x2b')]},{'key':_0x8f6f('0x2c'),'value':_0x8f6f('0x2d')},{'key':_0x8f6f('0x2e'),'value':encodeURIComponent(_0x7713c1)},{'key':_0x8f6f('0x2f'),'value':_0x32ec7c},{'key':_0x8f6f('0x30'),'value':_0x5bd2e1},{'key':_0x8f6f('0x31'),'value':'login'}];var _0x2d3f17=_0x191af7+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x8f6f('0x17')](_0x3ab13f,function(_0x144072){return _0x144072['key']+'='+_0x144072[_0x8f6f('0x32')];})[_0x8f6f('0x1c')]('&');_0x119f3e[_0x8f6f('0x33')]={'issuer':_0x191af7[_0x8f6f('0x1e')]('oauth2/',''),'audience':_0x119f3e[_0x8f6f('0x28')],'state':_0x32ec7c,'nonce':_0x5bd2e1};redis[_0x8f6f('0x34')](_0x32ec7c,JSON[_0x8f6f('0x35')](_0x119f3e));return _0x2d3f17;}function isValidIdToken(_0x12468c,_0x3449cd){try{var _0x150803=jwt[_0x8f6f('0x36')](_0x12468c,{'complete':!![]});var _0x4de9b1=_0x150803[_0x8f6f('0x37')];if(_0x4de9b1[_0x8f6f('0x38')]!==_0x3449cd['issuer'])return![];if(_0x4de9b1[_0x8f6f('0x39')]!==_0x3449cd[_0x8f6f('0x3a')])return![];if(_0x4de9b1[_0x8f6f('0x30')]!==_0x3449cd[_0x8f6f('0x30')])return![];if(moment()[_0x8f6f('0x3b')](moment[_0x8f6f('0x3c')](_0x4de9b1['exp'])))return![];return!![];}catch(_0x50d835){throw _0x50d835;}}function refreshOauth2MicrosoftAccessToken(_0x5b3e51){return Promise[_0x8f6f('0x3d')]()[_0x8f6f('0x3e')](function(){if(_0x5b3e51[_0x8f6f('0x3f')])return _0x5b3e51;return db[_0x8f6f('0x40')][_0x8f6f('0x41')]({'where':{'id':_0x5b3e51['id']},'raw':!![]});})[_0x8f6f('0x3e')](function(_0x5f489a){var _0x1ef78c={'grant_type':_0x8f6f('0x42'),'refresh_token':_0x5f489a[_0x8f6f('0x43')],'scope':getAccessTokenScope(_0x5f489a),'redirect_uri':_0x5f489a[_0x8f6f('0x2b')],'client_id':_0x5f489a['data1'],'client_secret':encryptor[_0x8f6f('0x44')](_0x5f489a[_0x8f6f('0x3f')])};var _0x36ba6e={'method':_0x8f6f('0x45'),'uri':MICROSOFT_AUTH_URL[_0x8f6f('0x1e')](_0x8f6f('0x1f'),_0x5f489a[_0x8f6f('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x1ef78c,'json':!![]};return rp(_0x36ba6e);})[_0x8f6f('0x3e')](function(_0x531eea){_0x5b3e51[_0x8f6f('0x46')]=_0x531eea[_0x8f6f('0x47')];_0x5b3e51[_0x8f6f('0x43')]=_0x531eea[_0x8f6f('0x42')];return db['CloudProvider'][_0x8f6f('0x48')]({'data5':_0x5b3e51[_0x8f6f('0x46')],'data6':_0x5b3e51[_0x8f6f('0x43')]},{'where':{'id':_0x5b3e51['id']}});})[_0x8f6f('0x3e')](function(){return _0x5b3e51;})['catch'](function(_0xfa09f1){logger['error'](_0x8f6f('0x49'),_0x5b3e51['id'],_0xfa09f1);});}function getOauth2MicrosoftAccessToken(_0x3d01f4,_0x4b2aaa){var _0x2a7a79={'grant_type':_0x8f6f('0x4a'),'code':_0x3d01f4,'scope':getAccessTokenScope(_0x4b2aaa),'redirect_uri':_0x4b2aaa[_0x8f6f('0x2b')],'client_id':_0x4b2aaa[_0x8f6f('0x28')],'client_secret':encryptor[_0x8f6f('0x44')](_0x4b2aaa[_0x8f6f('0x3f')])};var _0x49c3ef={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x8f6f('0x1e')](_0x8f6f('0x1f'),_0x4b2aaa[_0x8f6f('0x20')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2a7a79,'json':!![]};return rp(_0x49c3ef);}function startRefreshInterval(_0x6db01d){var _0x4b6de1=schedule[_0x8f6f('0x4b')];if(_0x4b6de1[_0x6db01d['id']])clearInterval(_0x4b6de1[_0x6db01d['id']]);_0x4b6de1[_0x6db01d['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x8f6f('0x4c')](this,{'id':_0x6db01d['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x4b6de1;}function startAllRefreshIntervals(){return db[_0x8f6f('0x40')][_0x8f6f('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x8f6f('0x3e')](function(_0x18e788){var _0x598053=_0x18e788['map'](function(_0x4bf3c4){return refreshOauth2MicrosoftAccessToken(_0x4bf3c4)[_0x8f6f('0x3e')](function(_0x3e5981){startRefreshInterval(_0x3e5981);});});return Promise[_0x8f6f('0x4e')](_0x598053);})['catch'](function(_0x1de5a2){var _0x36e40d=_0x1de5a2?util[_0x8f6f('0x4f')](_0x1de5a2,{'showHidden':![],'depth':null}):'';logger[_0x8f6f('0x50')](_0x8f6f('0x51'),_0x36e40d);});}module[_0x8f6f('0x52')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xa26d=['findOne','refresh_token','data6','data4','decryptString','POST','data5','access_token','update','catch','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','intervals','bind','findAll','all','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','../../mysqldb','redis','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','offline_access','/authorize','/token','type','push','/.default','join','Outlook365','Dynamics365','data7','replace','{TENANT_ID}','data2','code','from','base64','randomBytes','toString','hex','client_id','data1','redirect_uri','form_post','state','nonce','prompt','map','key','value','oauth2Claims','oauth2/','set','stringify','payload','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider'];(function(_0x9cdbe2,_0x5d2fa2){var _0x4e0f87=function(_0x224cc4){while(--_0x224cc4){_0x9cdbe2['push'](_0x9cdbe2['shift']());}};_0x4e0f87(++_0x5d2fa2);}(_0xa26d,0x108));var _0xda26=function(_0x5ef2b7,_0xfec6f9){_0x5ef2b7=_0x5ef2b7-0x0;var _0x1c5ef4=_0xa26d[_0x5ef2b7];return _0x1c5ef4;};'use strict';var _=require('lodash');var crypto=require(_0xda26('0x0'));var jwt=require(_0xda26('0x1'));var moment=require(_0xda26('0x2'));var Redis=require(_0xda26('0x3'));var rp=require(_0xda26('0x4'));var util=require(_0xda26('0x5'));var encryptor=require(_0xda26('0x6'));var config=require(_0xda26('0x7'));var logger=require(_0xda26('0x8'))(_0xda26('0x9'));var schedule=require(_0xda26('0xa'));var db=require(_0xda26('0xb'))['db'];config[_0xda26('0xc')]=_['defaults'](config[_0xda26('0xc')],{'host':_0xda26('0xd'),'port':0x18eb});var redis=new Redis(config[_0xda26('0xc')]);var MICROSOFT_AUTH_URL=_0xda26('0xe');var AZURE_AUTH_SCOPES={'Outlook365':[_0xda26('0xf'),_0xda26('0x10'),_0xda26('0x11'),'offline_access',_0xda26('0x12'),_0xda26('0x13'),_0xda26('0x14')],'Dynamics365':[_0xda26('0xf'),_0xda26('0x15')]};var MICROSOFT_AUTH_ENDPOINT=_0xda26('0x16');var MICROSOFT_TOKEN_ENDPOINT=_0xda26('0x17');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0xf832b2){var _0x3fb91f=_['map'](AZURE_AUTH_SCOPES[_0xf832b2[_0xda26('0x18')]]);if(_0xf832b2[_0xda26('0x18')]==='Dynamics365')_0x3fb91f[_0xda26('0x19')](_0xf832b2['data7']+_0xda26('0x1a'));return _0x3fb91f[_0xda26('0x1b')]('\x20');}function getAccessTokenScope(_0xe60e1){if(_0xe60e1['type']===_0xda26('0x1c'))return _0xda26('0x12');if(_0xe60e1[_0xda26('0x18')]===_0xda26('0x1d'))return _0xe60e1[_0xda26('0x1e')]+_0xda26('0x1a');}function generateMicrosoftAuthorizationUrl(_0x3d6434,_0x94274d){var _0x439410=MICROSOFT_AUTH_URL[_0xda26('0x1f')](_0xda26('0x20'),_0x3d6434[_0xda26('0x21')]);var _0x2ca64c=[_0xda26('0x22'),'id_token'];var _0xc6f7d8=Buffer[_0xda26('0x23')](JSON['stringify']({'id':_0x94274d}))['toString'](_0xda26('0x24'));var _0x282383=crypto[_0xda26('0x25')](0x10)[_0xda26('0x26')](_0xda26('0x27'));var _0x41bb92=getAuthorizationScopes(_0x3d6434);var _0x1f4a00=[{'key':_0xda26('0x28'),'value':_0x3d6434[_0xda26('0x29')]},{'key':'response_type','value':encodeURIComponent(_0x2ca64c[_0xda26('0x1b')]('\x20'))},{'key':_0xda26('0x2a'),'value':_0x3d6434['data4']},{'key':'response_mode','value':_0xda26('0x2b')},{'key':'scope','value':encodeURIComponent(_0x41bb92)},{'key':_0xda26('0x2c'),'value':_0xc6f7d8},{'key':_0xda26('0x2d'),'value':_0x282383},{'key':_0xda26('0x2e'),'value':'login'}];var _0x88e17d=_0x439410+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xda26('0x2f')](_0x1f4a00,function(_0x2e2add){return _0x2e2add[_0xda26('0x30')]+'='+_0x2e2add[_0xda26('0x31')];})[_0xda26('0x1b')]('&');_0x3d6434[_0xda26('0x32')]={'issuer':_0x439410[_0xda26('0x1f')](_0xda26('0x33'),''),'audience':_0x3d6434[_0xda26('0x29')],'state':_0xc6f7d8,'nonce':_0x282383};redis[_0xda26('0x34')](_0xc6f7d8,JSON[_0xda26('0x35')](_0x3d6434));return _0x88e17d;}function isValidIdToken(_0x4c6972,_0x46ef95){try{var _0x422a7b=jwt['decode'](_0x4c6972,{'complete':!![]});var _0x2949d3=_0x422a7b[_0xda26('0x36')];if(_0x2949d3['iss']!==_0x46ef95['issuer'])return![];if(_0x2949d3[_0xda26('0x37')]!==_0x46ef95[_0xda26('0x38')])return![];if(_0x2949d3[_0xda26('0x2d')]!==_0x46ef95[_0xda26('0x2d')])return![];if(moment()[_0xda26('0x39')](moment[_0xda26('0x3a')](_0x2949d3[_0xda26('0x3b')])))return![];return!![];}catch(_0x404abe){throw _0x404abe;}}function refreshOauth2MicrosoftAccessToken(_0x4b1d89){return Promise[_0xda26('0x3c')]()[_0xda26('0x3d')](function(){if(_0x4b1d89[_0xda26('0x3e')])return _0x4b1d89;return db[_0xda26('0x3f')][_0xda26('0x40')]({'where':{'id':_0x4b1d89['id']},'raw':!![]});})[_0xda26('0x3d')](function(_0x4969b0){var _0x23cc98={'grant_type':_0xda26('0x41'),'refresh_token':_0x4969b0[_0xda26('0x42')],'scope':getAccessTokenScope(_0x4969b0),'redirect_uri':_0x4969b0[_0xda26('0x43')],'client_id':_0x4969b0[_0xda26('0x29')],'client_secret':encryptor[_0xda26('0x44')](_0x4969b0[_0xda26('0x3e')])};var _0x51ed92={'method':_0xda26('0x45'),'uri':MICROSOFT_AUTH_URL[_0xda26('0x1f')]('{TENANT_ID}',_0x4969b0[_0xda26('0x21')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x23cc98,'json':!![]};return rp(_0x51ed92);})['then'](function(_0x2f7eca){_0x4b1d89[_0xda26('0x46')]=_0x2f7eca[_0xda26('0x47')];_0x4b1d89[_0xda26('0x42')]=_0x2f7eca['refresh_token'];return db['CloudProvider'][_0xda26('0x48')]({'data5':_0x4b1d89[_0xda26('0x46')],'data6':_0x4b1d89[_0xda26('0x42')]},{'where':{'id':_0x4b1d89['id']}});})['then'](function(){return _0x4b1d89;})[_0xda26('0x49')](function(_0x15d0fb){logger['error'](_0xda26('0x4a'),_0x4b1d89['id'],_0x15d0fb);});}function getOauth2MicrosoftAccessToken(_0x50bb53,_0x2cc2c1){var _0x28273a={'grant_type':'authorization_code','code':_0x50bb53,'scope':getAccessTokenScope(_0x2cc2c1),'redirect_uri':_0x2cc2c1[_0xda26('0x43')],'client_id':_0x2cc2c1[_0xda26('0x29')],'client_secret':encryptor[_0xda26('0x44')](_0x2cc2c1['data3'])};var _0x557048={'method':_0xda26('0x45'),'uri':MICROSOFT_AUTH_URL[_0xda26('0x1f')]('{TENANT_ID}',_0x2cc2c1['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x28273a,'json':!![]};return rp(_0x557048);}function startRefreshInterval(_0x5726de){var _0x2f49dd=schedule[_0xda26('0x4b')];if(_0x2f49dd[_0x5726de['id']])clearInterval(_0x2f49dd[_0x5726de['id']]);_0x2f49dd[_0x5726de['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xda26('0x4c')](this,{'id':_0x5726de['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xda26('0x4b')]=_0x2f49dd;}function startAllRefreshIntervals(){return db[_0xda26('0x3f')][_0xda26('0x4d')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x45090f){var _0x52094f=_0x45090f[_0xda26('0x2f')](function(_0x24e86a){return refreshOauth2MicrosoftAccessToken(_0x24e86a)[_0xda26('0x3d')](function(_0x2797d5){startRefreshInterval(_0x2797d5);});});return Promise[_0xda26('0x4e')](_0x52094f);})[_0xda26('0x49')](function(_0x23d2a9){var _0x1b21b9=_0x23d2a9?util['inspect'](_0x23d2a9,{'showHidden':![],'depth':null}):'';logger[_0xda26('0x4f')](_0xda26('0x50'),_0x1b21b9);});}module[_0xda26('0x51')]={'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 187348c..a7fdb94 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 _0x01a6=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','CloudProvider,\x20%s,\x20%s','message'];(function(_0xa1a10,_0x336001){var _0x3274c1=function(_0x4beb40){while(--_0x4beb40){_0xa1a10['push'](_0xa1a10['shift']());}};_0x3274c1(++_0x336001);}(_0x01a6,0x162));var _0x601a=function(_0x1d5c3f,_0x2b5faa){_0x1d5c3f=_0x1d5c3f-0x0;var _0x2ebc3e=_0x01a6[_0x1d5c3f];return _0x2ebc3e;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var moment=require(_0x601a('0x1'));var BPromise=require(_0x601a('0x2'));var rs=require(_0x601a('0x3'));var fs=require('fs');var Redis=require(_0x601a('0x4'));var db=require(_0x601a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x601a('0x6'))('rpc');var config=require(_0x601a('0x7'));var jayson=require(_0x601a('0x8'));var client=jayson[_0x601a('0x9')][_0x601a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x272297,_0x5d94b5,_0x4ec3fe){return new BPromise(function(_0x208472,_0x1b6bf7){return client[_0x601a('0xb')](_0x272297,_0x4ec3fe)['then'](function(_0x6c5aab){logger[_0x601a('0xc')]('CloudProvider,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'));logger[_0x601a('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'),JSON[_0x601a('0xf')](_0x6c5aab));if(_0x6c5aab[_0x601a('0x10')]){if(_0x6c5aab[_0x601a('0x10')][_0x601a('0x11')]===0x1f4){logger[_0x601a('0x10')](_0x601a('0x12'),_0x5d94b5,_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);return _0x1b6bf7(_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);}logger['error'](_0x601a('0x12'),_0x5d94b5,_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);return _0x208472(_0x6c5aab[_0x601a('0x10')][_0x601a('0x13')]);}else{logger[_0x601a('0xc')]('CloudProvider,\x20%s,\x20%s',_0x5d94b5,_0x601a('0xd'));_0x208472(_0x6c5aab[_0x601a('0x14')][_0x601a('0x13')]);}})[_0x601a('0x15')](function(_0x4e1ebf){logger[_0x601a('0x10')]('CloudProvider,\x20%s,\x20%s',_0x5d94b5,_0x4e1ebf);_0x1b6bf7(_0x4e1ebf);});});} \ No newline at end of file +var _0xba5a=['error','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x4c0de6,_0x4f95d0){var _0x47795b=function(_0x27a7fb){while(--_0x27a7fb){_0x4c0de6['push'](_0x4c0de6['shift']());}};_0x47795b(++_0x4f95d0);}(_0xba5a,0x1d0));var _0xaba5=function(_0x4a9beb,_0x159482){_0x4a9beb=_0x4a9beb-0x0;var _0x2d4c58=_0xba5a[_0x4a9beb];return _0x2d4c58;};'use strict';var _=require('lodash');var util=require(_0xaba5('0x0'));var moment=require(_0xaba5('0x1'));var BPromise=require(_0xaba5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaba5('0x3'))['db'];var utils=require(_0xaba5('0x4'));var logger=require(_0xaba5('0x5'))(_0xaba5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xaba5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5e6b46,_0x2ef868,_0x1dba58){return new BPromise(function(_0x3772a2,_0x45f5ea){return client[_0xaba5('0x8')](_0x5e6b46,_0x1dba58)['then'](function(_0x3be776){logger[_0xaba5('0x9')](_0xaba5('0xa'),_0x2ef868,_0xaba5('0xb'));logger[_0xaba5('0xc')](_0xaba5('0xd'),_0x2ef868,_0xaba5('0xb'),JSON[_0xaba5('0xe')](_0x3be776));if(_0x3be776['error']){if(_0x3be776['error'][_0xaba5('0xf')]===0x1f4){logger['error'](_0xaba5('0xa'),_0x2ef868,_0x3be776['error']['message']);return _0x45f5ea(_0x3be776[_0xaba5('0x10')][_0xaba5('0x11')]);}logger[_0xaba5('0x10')](_0xaba5('0xa'),_0x2ef868,_0x3be776[_0xaba5('0x10')][_0xaba5('0x11')]);return _0x3772a2(_0x3be776[_0xaba5('0x10')]['message']);}else{logger['info'](_0xaba5('0xa'),_0x2ef868,_0xaba5('0xb'));_0x3772a2(_0x3be776[_0xaba5('0x12')][_0xaba5('0x11')]);}})[_0xaba5('0x13')](function(_0x53ec3c){logger[_0xaba5('0x10')]('CloudProvider,\x20%s,\x20%s',_0x2ef868,_0x53ec3c);_0x45f5ea(_0x53ec3c);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 114803d..f07556e 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0x1261,0x144));var _0x1126=function(_0x3d8240,_0x2663d4){_0x3d8240=_0x3d8240-0x0;var _0x3d0372=_0x1261[_0x3d8240];return _0x3d0372;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x3c9ca5,_0x25cbbf){var _0x515ebe=function(_0x2e3b18){while(--_0x2e3b18){_0x3c9ca5['push'](_0x3c9ca5['shift']());}};_0x515ebe(++_0x25cbbf);}(_0xadb5,0xad));var _0x5adb=function(_0x493c72,_0x2018d6){_0x493c72=_0x493c72-0x0;var _0x1924aa=_0xadb5[_0x493c72];return _0x1924aa;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 78fe6c1..7240263 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 _0x3151=['sequelize','exports','STRING','name'];(function(_0x1c1683,_0x1e0d74){var _0xc2c5d2=function(_0x8443c7){while(--_0x8443c7){_0x1c1683['push'](_0x1c1683['shift']());}};_0xc2c5d2(++_0x1e0d74);}(_0x3151,0x1c0));var _0x1315=function(_0x22890a,_0x5d3a7a){_0x22890a=_0x22890a-0x0;var _0x3290ae=_0x3151[_0x22890a];return _0x3290ae;};'use strict';var Sequelize=require(_0x1315('0x0'));module[_0x1315('0x1')]={'name':{'type':Sequelize[_0x1315('0x2')],'unique':_0x1315('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x1315('0x2')]},'companyId':{'type':Sequelize[_0x1315('0x2')]},'website':{'type':Sequelize[_0x1315('0x2')]},'phone':{'type':Sequelize[_0x1315('0x2')]},'fax':{'type':Sequelize[_0x1315('0x2')]},'type':{'type':Sequelize[_0x1315('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1315('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x1315('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x1315('0x2')]},'sStreet':{'type':Sequelize[_0x1315('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0x1315('0x2')]},'sCountry':{'type':Sequelize[_0x1315('0x2')]},'description':{'type':Sequelize[_0x1315('0x2')]}}; \ No newline at end of file +var _0xba4d=['STRING','name','sequelize'];(function(_0x1012a0,_0x52bc09){var _0xf439d1=function(_0x33c572){while(--_0x33c572){_0x1012a0['push'](_0x1012a0['shift']());}};_0xf439d1(++_0x52bc09);}(_0xba4d,0x15b));var _0xdba4=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xba4d[_0x555b2f];return _0x81c0a6;};'use strict';var Sequelize=require(_0xdba4('0x0'));module['exports']={'name':{'type':Sequelize[_0xdba4('0x1')],'unique':_0xdba4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xdba4('0x1')]},'website':{'type':Sequelize[_0xdba4('0x1')]},'phone':{'type':Sequelize[_0xdba4('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xdba4('0x1')]},'postalCode':{'type':Sequelize[_0xdba4('0x1')]},'city':{'type':Sequelize[_0xdba4('0x1')]},'country':{'type':Sequelize[_0xdba4('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xdba4('0x1')]},'sCity':{'type':Sequelize[_0xdba4('0x1')]},'sCountry':{'type':Sequelize[_0xdba4('0x1')]},'description':{'type':Sequelize[_0xdba4('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index c1a5a03..1925dd6 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 _0xc67d=['offset','set','Content-Range','apply','reject','update','destroy','then','get','Companies','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','addContacts','CmContact','ids','omit','findOne','getContacts','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','limit','undefined','count'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0xc67d,0x8a));var _0xdc67=function(_0x166fa7,_0x2dcd6d){_0x166fa7=_0x166fa7-0x0;var _0x4e7936=_0xc67d[_0x166fa7];return _0x4e7936;};'use strict';var emlformat=require(_0xdc67('0x0'));var rimraf=require(_0xdc67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdc67('0x2'));var moment=require(_0xdc67('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xdc67('0x4'));var util=require(_0xdc67('0x5'));var path=require(_0xdc67('0x6'));var sox=require(_0xdc67('0x7'));var csv=require('to-csv');var ejs=require(_0xdc67('0x8'));var fs=require('fs');var fs_extra=require(_0xdc67('0x9'));var _=require(_0xdc67('0xa'));var squel=require(_0xdc67('0xb'));var crypto=require(_0xdc67('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdc67('0xd'));var Papa=require(_0xdc67('0xe'));var Redis=require('ioredis');var authService=require(_0xdc67('0xf'));var qs=require(_0xdc67('0x10'));var as=require(_0xdc67('0x11'));var hardwareService=require(_0xdc67('0x12'));var logger=require(_0xdc67('0x13'))(_0xdc67('0x14'));var utils=require(_0xdc67('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdc67('0x16'));var db=require(_0xdc67('0x17'))['db'];function respondWithStatusCode(_0x2ed298,_0x5758b9){_0x5758b9=_0x5758b9||0xcc;return function(_0x18909b){if(_0x18909b){return _0x2ed298['sendStatus'](_0x5758b9);}return _0x2ed298['status'](_0x5758b9)[_0xdc67('0x18')]();};}function respondWithResult(_0x4d3a40,_0x529b09){_0x529b09=_0x529b09||0xc8;return function(_0x215412){if(_0x215412){return _0x4d3a40[_0xdc67('0x19')](_0x529b09)[_0xdc67('0x1a')](_0x215412);}};}function respondWithFilteredResult(_0x587581,_0x50e070){return function(_0x4a42fe){if(_0x4a42fe){var _0x17007f=typeof _0x50e070['offset']==='undefined'&&typeof _0x50e070[_0xdc67('0x1b')]===_0xdc67('0x1c');var _0x45896d=_0x4a42fe[_0xdc67('0x1d')];var _0x2e49cf=_0x17007f?0x0:_0x50e070[_0xdc67('0x1e')];var _0x5829fe=_0x17007f?_0x4a42fe[_0xdc67('0x1d')]:_0x50e070[_0xdc67('0x1e')]+_0x50e070['limit'];var _0x126905;if(_0x5829fe>=_0x45896d){_0x5829fe=_0x45896d;_0x126905=0xc8;}else{_0x126905=0xce;}_0x587581[_0xdc67('0x19')](_0x126905);return _0x587581[_0xdc67('0x1f')](_0xdc67('0x20'),_0x2e49cf+'-'+_0x5829fe+'/'+_0x45896d)['json'](_0x4a42fe);}return null;};}function patchUpdates(_0x278f40){return function(_0x1301a4){try{jsonpatch[_0xdc67('0x21')](_0x1301a4,_0x278f40,!![]);}catch(_0x10d632){return BPromise[_0xdc67('0x22')](_0x10d632);}return _0x1301a4['save']();};}function saveUpdates(_0x1f4265,_0xef164d){return function(_0x604358){if(_0x604358){return _0x604358[_0xdc67('0x23')](_0x1f4265)['then'](function(_0x1d60c4){return _0x1d60c4;});}return null;};}function removeEntity(_0x2e9841,_0x46cf15){return function(_0x1037e6){if(_0x1037e6){return _0x1037e6[_0xdc67('0x24')]()[_0xdc67('0x25')](function(){var _0x26432a=_0x1037e6[_0xdc67('0x26')]({'plain':!![]});var _0x3012cf=_0xdc67('0x27');return db['UserProfileResource'][_0xdc67('0x24')]({'where':{'type':_0x3012cf,'resourceId':_0x26432a['id']}})['then'](function(){return _0x1037e6;});})[_0xdc67('0x25')](function(){_0x2e9841[_0xdc67('0x19')](0xcc)[_0xdc67('0x18')]();});}};}function handleEntityNotFound(_0x15caab,_0x3b66d8){return function(_0x254509){if(!_0x254509){_0x15caab['sendStatus'](0x194);}return _0x254509;};}function handleError(_0x345635,_0x1441a4){_0x1441a4=_0x1441a4||0x1f4;return function(_0x2b306c){logger['error'](_0x2b306c[_0xdc67('0x28')]);if(_0x2b306c[_0xdc67('0x29')]){delete _0x2b306c['name'];}_0x345635[_0xdc67('0x19')](_0x1441a4)[_0xdc67('0x2a')](_0x2b306c);};}exports[_0xdc67('0x2b')]=function(_0x177d64,_0x4254c7){var _0x549631={},_0x4173d7={},_0x45ad92={'count':0x0,'rows':[]};return db[_0xdc67('0x2c')][_0xdc67('0x2d')]()[_0xdc67('0x25')](function(_0x5946a9){_0x4173d7[_0xdc67('0x2e')]=_[_0xdc67('0x2f')](_0x5946a9);_0x4173d7['query']=_[_0xdc67('0x2f')](_0x177d64[_0xdc67('0x30')]);_0x4173d7[_0xdc67('0x31')]=_[_0xdc67('0x32')](_0x4173d7[_0xdc67('0x2e')],_0x4173d7[_0xdc67('0x30')]);_0x549631[_0xdc67('0x33')]=_[_0xdc67('0x32')](_0x4173d7[_0xdc67('0x2e')],qs['fields'](_0x177d64[_0xdc67('0x30')][_0xdc67('0x34')]));_0x549631[_0xdc67('0x33')]=_0x549631[_0xdc67('0x33')]['length']?_0x549631[_0xdc67('0x33')]:_0x4173d7[_0xdc67('0x2e')];if(!_0x177d64[_0xdc67('0x30')][_0xdc67('0x35')](_0xdc67('0x36'))){_0x549631['limit']=qs[_0xdc67('0x1b')](_0x177d64['query'][_0xdc67('0x1b')]);_0x549631[_0xdc67('0x1e')]=qs['offset'](_0x177d64[_0xdc67('0x30')][_0xdc67('0x1e')]);}_0x549631[_0xdc67('0x37')]=qs['sort'](_0x177d64[_0xdc67('0x30')][_0xdc67('0x38')]);_0x549631['where']=qs[_0xdc67('0x31')](_[_0xdc67('0x39')](_0x177d64[_0xdc67('0x30')],_0x4173d7['filters']),_0x5946a9);if(_0x177d64[_0xdc67('0x30')][_0xdc67('0x3a')]){_0x549631[_0xdc67('0x3b')]=_[_0xdc67('0x3c')](_0x549631[_0xdc67('0x3b')],{'$or':_['map'](_0x549631['attributes'],function(_0x3f1b8d){var _0x1daf00={};_0x1daf00[_0x3f1b8d]={'$like':'%'+_0x177d64[_0xdc67('0x30')]['filter']+'%'};return _0x1daf00;})});}_0x549631=_[_0xdc67('0x3c')]({},_0x549631,_0x177d64['options']);var _0x3b00dd={'where':_0x549631[_0xdc67('0x3b')]};return db[_0xdc67('0x2c')][_0xdc67('0x1d')](_0x3b00dd)[_0xdc67('0x25')](function(_0x5829b7){_0x45ad92['count']=_0x5829b7;if(_0x177d64[_0xdc67('0x30')][_0xdc67('0x3d')]){_0x549631[_0xdc67('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0xdc67('0x3f')](_0x549631);})[_0xdc67('0x25')](function(_0x505f1d){_0x45ad92[_0xdc67('0x40')]=_0x505f1d;return _0x45ad92;})[_0xdc67('0x25')](respondWithFilteredResult(_0x4254c7,_0x549631))[_0xdc67('0x41')](handleError(_0x4254c7,null));})[_0xdc67('0x41')](handleError(_0x4254c7,null));};exports[_0xdc67('0x42')]=function(_0x5968d3,_0x4617ea){var _0x19aa8b={'raw':![],'where':{'id':_0x5968d3[_0xdc67('0x43')]['id']}},_0x455615={};_0x455615[_0xdc67('0x2e')]=_[_0xdc67('0x2f')](db[_0xdc67('0x2c')]['rawAttributes']);_0x455615[_0xdc67('0x30')]=_[_0xdc67('0x2f')](_0x5968d3['query']);_0x455615['filters']=_[_0xdc67('0x32')](_0x455615[_0xdc67('0x2e')],_0x455615[_0xdc67('0x30')]);_0x19aa8b[_0xdc67('0x33')]=_[_0xdc67('0x32')](_0x455615[_0xdc67('0x2e')],qs['fields'](_0x5968d3[_0xdc67('0x30')][_0xdc67('0x34')]));_0x19aa8b[_0xdc67('0x33')]=_0x19aa8b['attributes'][_0xdc67('0x44')]?_0x19aa8b[_0xdc67('0x33')]:_0x455615[_0xdc67('0x2e')];if(_0x5968d3[_0xdc67('0x30')]['includeAll']){_0x19aa8b['include']=[{'all':!![]}];}_0x19aa8b=_[_0xdc67('0x3c')]({},_0x19aa8b,_0x5968d3[_0xdc67('0x45')]);return db[_0xdc67('0x2c')][_0xdc67('0x46')](_0x19aa8b)[_0xdc67('0x25')](handleEntityNotFound(_0x4617ea,null))[_0xdc67('0x25')](respondWithResult(_0x4617ea,null))['catch'](handleError(_0x4617ea,null));};exports[_0xdc67('0x47')]=function(_0x44d104,_0x4f9a41){return db[_0xdc67('0x2c')]['create'](_0x44d104[_0xdc67('0x48')],{})[_0xdc67('0x25')](function(_0x37cf12){var _0x48e9bd=_0x44d104['user'][_0xdc67('0x26')]({'plain':!![]});if(!_0x48e9bd)throw new Error(_0xdc67('0x49'));if(_0x48e9bd[_0xdc67('0x4a')]==='user'){var _0x29cdd3=_0x37cf12[_0xdc67('0x26')]({'plain':!![]});var _0x30131c=_0xdc67('0x27');return db['UserProfileSection'][_0xdc67('0x46')]({'where':{'name':_0x30131c,'userProfileId':_0x48e9bd[_0xdc67('0x4b')]},'raw':!![]})[_0xdc67('0x25')](function(_0x2362b0){if(_0x2362b0&&_0x2362b0[_0xdc67('0x4c')]===0x0){return db[_0xdc67('0x4d')][_0xdc67('0x47')]({'name':_0x29cdd3[_0xdc67('0x29')],'resourceId':_0x29cdd3['id'],'type':_0x2362b0[_0xdc67('0x29')],'sectionId':_0x2362b0['id']},{})[_0xdc67('0x25')](function(){return _0x37cf12;});}else{return _0x37cf12;}})[_0xdc67('0x41')](function(_0x3b37cf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b37cf);throw _0x3b37cf;});}return _0x37cf12;})[_0xdc67('0x25')](respondWithResult(_0x4f9a41,0xc9))[_0xdc67('0x41')](handleError(_0x4f9a41,null));};exports[_0xdc67('0x23')]=function(_0x1a5b56,_0x1eeac4){if(_0x1a5b56['body']['id']){delete _0x1a5b56['body']['id'];}return db['CmCompany'][_0xdc67('0x46')]({'where':{'id':_0x1a5b56[_0xdc67('0x43')]['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x1eeac4,null))['then'](saveUpdates(_0x1a5b56['body'],null))[_0xdc67('0x25')](respondWithResult(_0x1eeac4,null))[_0xdc67('0x41')](handleError(_0x1eeac4,null));};exports[_0xdc67('0x24')]=function(_0x368a13,_0x4fed80){return db[_0xdc67('0x2c')][_0xdc67('0x46')]({'where':{'id':_0x368a13['params']['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x4fed80,null))[_0xdc67('0x25')](removeEntity(_0x4fed80,null))[_0xdc67('0x41')](handleError(_0x4fed80,null));};exports['describe']=function(_0x1b1ca2,_0x3e41a6){return db[_0xdc67('0x2c')]['describe']()[_0xdc67('0x25')](respondWithResult(_0x3e41a6,null))[_0xdc67('0x41')](handleError(_0x3e41a6,null));};exports[_0xdc67('0x4e')]=function(_0x100fc9,_0x41eff4,_0x384863){return db[_0xdc67('0x4f')][_0xdc67('0x46')]({'where':{'id':_0x100fc9[_0xdc67('0x43')]['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x41eff4,null))['then'](function(_0x1007e3){if(_0x1007e3){return _0x1007e3[_0xdc67('0x4e')](_0x100fc9[_0xdc67('0x48')][_0xdc67('0x50')],_[_0xdc67('0x51')](_0x100fc9['body'],[_0xdc67('0x50'),'id'])||{});}})[_0xdc67('0x25')](respondWithResult(_0x41eff4,null))[_0xdc67('0x41')](handleError(_0x41eff4,null));};exports['getContacts']=function(_0x3dd744,_0x1f7cca,_0x23c046){var _0x551722={};var _0x56d078={};var _0x54f949;var _0x437066;return db[_0xdc67('0x2c')][_0xdc67('0x52')]({'where':{'id':_0x3dd744[_0xdc67('0x43')]['id']}})[_0xdc67('0x25')](handleEntityNotFound(_0x1f7cca,null))[_0xdc67('0x25')](function(_0x269866){if(_0x269866){_0x54f949=_0x269866;_0x56d078[_0xdc67('0x2e')]=_['keys'](db[_0xdc67('0x4f')]['rawAttributes']);_0x56d078[_0xdc67('0x30')]=_[_0xdc67('0x2f')](_0x3dd744['query']);_0x56d078[_0xdc67('0x31')]=_[_0xdc67('0x32')](_0x56d078[_0xdc67('0x2e')],_0x56d078[_0xdc67('0x30')]);_0x551722[_0xdc67('0x33')]=_['intersection'](_0x56d078[_0xdc67('0x2e')],qs[_0xdc67('0x34')](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x34')]));_0x551722[_0xdc67('0x33')]=_0x551722['attributes'][_0xdc67('0x44')]?_0x551722[_0xdc67('0x33')]:_0x56d078[_0xdc67('0x2e')];_0x551722[_0xdc67('0x37')]=qs[_0xdc67('0x38')](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x38')]);_0x551722[_0xdc67('0x3b')]=qs[_0xdc67('0x31')](_[_0xdc67('0x39')](_0x3dd744['query'],_0x56d078[_0xdc67('0x31')]));if(_0x3dd744[_0xdc67('0x30')][_0xdc67('0x3a')]){_0x551722[_0xdc67('0x3b')]=_[_0xdc67('0x3c')](_0x551722[_0xdc67('0x3b')],{'$or':_['map'](_0x551722[_0xdc67('0x33')],function(_0x4d0cfa){var _0xf29d79={};_0xf29d79[_0x4d0cfa]={'$like':'%'+_0x3dd744[_0xdc67('0x30')][_0xdc67('0x3a')]+'%'};return _0xf29d79;})});}_0x551722=_[_0xdc67('0x3c')]({},_0x551722,_0x3dd744['options']);return _0x54f949[_0xdc67('0x53')](_0x551722);}})[_0xdc67('0x25')](function(_0x1ff1ee){if(_0x1ff1ee){_0x437066=_0x1ff1ee[_0xdc67('0x44')];if(!_0x3dd744[_0xdc67('0x30')]['hasOwnProperty'](_0xdc67('0x36'))){_0x551722[_0xdc67('0x1b')]=qs['limit'](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x1b')]);_0x551722['offset']=qs[_0xdc67('0x1e')](_0x3dd744[_0xdc67('0x30')][_0xdc67('0x1e')]);}return _0x54f949[_0xdc67('0x53')](_0x551722);}})[_0xdc67('0x25')](function(_0x569b12){if(_0x569b12){return _0x569b12?{'count':_0x437066,'rows':_0x569b12}:null;}})[_0xdc67('0x25')](respondWithResult(_0x1f7cca,null))['catch'](handleError(_0x1f7cca,null));}; \ No newline at end of file +var _0x1ccb=['stack','name','index','CmCompany','describe','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','merge','where','map','filter','options','count','rows','catch','params','rawAttributes','length','includeAll','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addContacts','CmContact','omit','ids','getContacts','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','apply','reject','then','destroy','Companies','UserProfileResource','error'];(function(_0x4548ca,_0x4b9074){var _0x45f913=function(_0x16dd4d){while(--_0x16dd4d){_0x4548ca['push'](_0x4548ca['shift']());}};_0x45f913(++_0x4b9074);}(_0x1ccb,0x178));var _0xb1cc=function(_0xf8408d,_0x2c374c){_0xf8408d=_0xf8408d-0x0;var _0x4d0fa2=_0x1ccb[_0xf8408d];return _0x4d0fa2;};'use strict';var emlformat=require(_0xb1cc('0x0'));var rimraf=require(_0xb1cc('0x1'));var zipdir=require(_0xb1cc('0x2'));var jsonpatch=require(_0xb1cc('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb1cc('0x4'));var util=require(_0xb1cc('0x5'));var path=require('path');var sox=require(_0xb1cc('0x6'));var csv=require(_0xb1cc('0x7'));var ejs=require(_0xb1cc('0x8'));var fs=require('fs');var fs_extra=require(_0xb1cc('0x9'));var _=require(_0xb1cc('0xa'));var squel=require(_0xb1cc('0xb'));var crypto=require('crypto');var jsforce=require(_0xb1cc('0xc'));var deskjs=require(_0xb1cc('0xd'));var toCsv=require(_0xb1cc('0x7'));var querystring=require(_0xb1cc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb1cc('0xf'));var as=require(_0xb1cc('0x10'));var hardwareService=require(_0xb1cc('0x11'));var logger=require(_0xb1cc('0x12'))(_0xb1cc('0x13'));var utils=require(_0xb1cc('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb1cc('0x15'));var db=require(_0xb1cc('0x16'))['db'];function respondWithStatusCode(_0x4e3dde,_0x304b65){_0x304b65=_0x304b65||0xcc;return function(_0x946516){if(_0x946516){return _0x4e3dde[_0xb1cc('0x17')](_0x304b65);}return _0x4e3dde[_0xb1cc('0x18')](_0x304b65)[_0xb1cc('0x19')]();};}function respondWithResult(_0x16eaf9,_0x206e98){_0x206e98=_0x206e98||0xc8;return function(_0x3b4aa9){if(_0x3b4aa9){return _0x16eaf9[_0xb1cc('0x18')](_0x206e98)['json'](_0x3b4aa9);}};}function respondWithFilteredResult(_0x4aab54,_0x15e5d8){return function(_0x25e89e){if(_0x25e89e){var _0x30bac9=typeof _0x15e5d8['offset']===_0xb1cc('0x1a')&&typeof _0x15e5d8[_0xb1cc('0x1b')]==='undefined';var _0x11011d=_0x25e89e['count'];var _0x5e39a4=_0x30bac9?0x0:_0x15e5d8[_0xb1cc('0x1c')];var _0xfd21fc=_0x30bac9?_0x25e89e['count']:_0x15e5d8[_0xb1cc('0x1c')]+_0x15e5d8[_0xb1cc('0x1b')];var _0x1a3f12;if(_0xfd21fc>=_0x11011d){_0xfd21fc=_0x11011d;_0x1a3f12=0xc8;}else{_0x1a3f12=0xce;}_0x4aab54[_0xb1cc('0x18')](_0x1a3f12);return _0x4aab54[_0xb1cc('0x1d')](_0xb1cc('0x1e'),_0x5e39a4+'-'+_0xfd21fc+'/'+_0x11011d)[_0xb1cc('0x1f')](_0x25e89e);}return null;};}function patchUpdates(_0x215f0b){return function(_0x3aa055){try{jsonpatch[_0xb1cc('0x20')](_0x3aa055,_0x215f0b,!![]);}catch(_0x421bdd){return BPromise[_0xb1cc('0x21')](_0x421bdd);}return _0x3aa055['save']();};}function saveUpdates(_0x30a2b7,_0x50d1f2){return function(_0x472bda){if(_0x472bda){return _0x472bda['update'](_0x30a2b7)[_0xb1cc('0x22')](function(_0x2f43e0){return _0x2f43e0;});}return null;};}function removeEntity(_0x4a3e38,_0x57e970){return function(_0x1c25f1){if(_0x1c25f1){return _0x1c25f1[_0xb1cc('0x23')]()[_0xb1cc('0x22')](function(){var _0xae0760=_0x1c25f1['get']({'plain':!![]});var _0x3ea486=_0xb1cc('0x24');return db[_0xb1cc('0x25')][_0xb1cc('0x23')]({'where':{'type':_0x3ea486,'resourceId':_0xae0760['id']}})[_0xb1cc('0x22')](function(){return _0x1c25f1;});})[_0xb1cc('0x22')](function(){_0x4a3e38[_0xb1cc('0x18')](0xcc)[_0xb1cc('0x19')]();});}};}function handleEntityNotFound(_0x4c78a4,_0x396fc2){return function(_0x248411){if(!_0x248411){_0x4c78a4[_0xb1cc('0x17')](0x194);}return _0x248411;};}function handleError(_0x54caf2,_0x1d54ed){_0x1d54ed=_0x1d54ed||0x1f4;return function(_0x811083){logger[_0xb1cc('0x26')](_0x811083[_0xb1cc('0x27')]);if(_0x811083['name']){delete _0x811083[_0xb1cc('0x28')];}_0x54caf2[_0xb1cc('0x18')](_0x1d54ed)['send'](_0x811083);};}exports[_0xb1cc('0x29')]=function(_0x3feb1c,_0x5c9b06){var _0x176655={},_0x3f095f={},_0x1c4bb7={'count':0x0,'rows':[]};return db[_0xb1cc('0x2a')][_0xb1cc('0x2b')]()[_0xb1cc('0x22')](function(_0x5079d8){_0x3f095f[_0xb1cc('0x2c')]=_[_0xb1cc('0x2d')](_0x5079d8);_0x3f095f[_0xb1cc('0x2e')]=_[_0xb1cc('0x2d')](_0x3feb1c['query']);_0x3f095f[_0xb1cc('0x2f')]=_['intersection'](_0x3f095f[_0xb1cc('0x2c')],_0x3f095f[_0xb1cc('0x2e')]);_0x176655[_0xb1cc('0x30')]=_[_0xb1cc('0x31')](_0x3f095f[_0xb1cc('0x2c')],qs[_0xb1cc('0x32')](_0x3feb1c[_0xb1cc('0x2e')][_0xb1cc('0x32')]));_0x176655[_0xb1cc('0x30')]=_0x176655['attributes']['length']?_0x176655[_0xb1cc('0x30')]:_0x3f095f[_0xb1cc('0x2c')];if(!_0x3feb1c[_0xb1cc('0x2e')][_0xb1cc('0x33')](_0xb1cc('0x34'))){_0x176655[_0xb1cc('0x1b')]=qs['limit'](_0x3feb1c['query'][_0xb1cc('0x1b')]);_0x176655[_0xb1cc('0x1c')]=qs[_0xb1cc('0x1c')](_0x3feb1c[_0xb1cc('0x2e')]['offset']);}_0x176655[_0xb1cc('0x35')]=qs[_0xb1cc('0x36')](_0x3feb1c['query'][_0xb1cc('0x36')]);_0x176655['where']=qs[_0xb1cc('0x2f')](_['pick'](_0x3feb1c[_0xb1cc('0x2e')],_0x3f095f[_0xb1cc('0x2f')]),_0x5079d8);if(_0x3feb1c[_0xb1cc('0x2e')]['filter']){_0x176655['where']=_[_0xb1cc('0x37')](_0x176655[_0xb1cc('0x38')],{'$or':_[_0xb1cc('0x39')](_0x176655[_0xb1cc('0x30')],function(_0x420a6b){var _0x377def={};_0x377def[_0x420a6b]={'$like':'%'+_0x3feb1c[_0xb1cc('0x2e')][_0xb1cc('0x3a')]+'%'};return _0x377def;})});}_0x176655=_['merge']({},_0x176655,_0x3feb1c[_0xb1cc('0x3b')]);var _0x4f8157={'where':_0x176655['where']};return db[_0xb1cc('0x2a')]['count'](_0x4f8157)['then'](function(_0x157f14){_0x1c4bb7[_0xb1cc('0x3c')]=_0x157f14;if(_0x3feb1c[_0xb1cc('0x2e')]['includeAll']){_0x176655['include']=[{'all':!![]}];}return db[_0xb1cc('0x2a')]['findAll'](_0x176655);})[_0xb1cc('0x22')](function(_0x1807eb){_0x1c4bb7[_0xb1cc('0x3d')]=_0x1807eb;return _0x1c4bb7;})['then'](respondWithFilteredResult(_0x5c9b06,_0x176655))[_0xb1cc('0x3e')](handleError(_0x5c9b06,null));})[_0xb1cc('0x3e')](handleError(_0x5c9b06,null));};exports['show']=function(_0x14f938,_0x254f3c){var _0x1b87f6={'raw':![],'where':{'id':_0x14f938[_0xb1cc('0x3f')]['id']}},_0x29783e={};_0x29783e[_0xb1cc('0x2c')]=_['keys'](db[_0xb1cc('0x2a')][_0xb1cc('0x40')]);_0x29783e[_0xb1cc('0x2e')]=_['keys'](_0x14f938[_0xb1cc('0x2e')]);_0x29783e[_0xb1cc('0x2f')]=_[_0xb1cc('0x31')](_0x29783e[_0xb1cc('0x2c')],_0x29783e['query']);_0x1b87f6[_0xb1cc('0x30')]=_['intersection'](_0x29783e['model'],qs[_0xb1cc('0x32')](_0x14f938['query'][_0xb1cc('0x32')]));_0x1b87f6[_0xb1cc('0x30')]=_0x1b87f6[_0xb1cc('0x30')][_0xb1cc('0x41')]?_0x1b87f6['attributes']:_0x29783e[_0xb1cc('0x2c')];if(_0x14f938[_0xb1cc('0x2e')][_0xb1cc('0x42')]){_0x1b87f6[_0xb1cc('0x43')]=[{'all':!![]}];}_0x1b87f6=_[_0xb1cc('0x37')]({},_0x1b87f6,_0x14f938[_0xb1cc('0x3b')]);return db[_0xb1cc('0x2a')][_0xb1cc('0x44')](_0x1b87f6)[_0xb1cc('0x22')](handleEntityNotFound(_0x254f3c,null))['then'](respondWithResult(_0x254f3c,null))[_0xb1cc('0x3e')](handleError(_0x254f3c,null));};exports[_0xb1cc('0x45')]=function(_0x2ace43,_0x5d8a66){return db['CmCompany'][_0xb1cc('0x45')](_0x2ace43[_0xb1cc('0x46')],{})[_0xb1cc('0x22')](function(_0x2faa1e){var _0x2d4c84=_0x2ace43[_0xb1cc('0x47')][_0xb1cc('0x48')]({'plain':!![]});if(!_0x2d4c84)throw new Error(_0xb1cc('0x49'));if(_0x2d4c84['role']===_0xb1cc('0x47')){var _0x223243=_0x2faa1e[_0xb1cc('0x48')]({'plain':!![]});var _0x4b65b8='Companies';return db['UserProfileSection']['find']({'where':{'name':_0x4b65b8,'userProfileId':_0x2d4c84[_0xb1cc('0x4a')]},'raw':!![]})[_0xb1cc('0x22')](function(_0x52482c){if(_0x52482c&&_0x52482c[_0xb1cc('0x4b')]===0x0){return db[_0xb1cc('0x25')][_0xb1cc('0x45')]({'name':_0x223243[_0xb1cc('0x28')],'resourceId':_0x223243['id'],'type':_0x52482c[_0xb1cc('0x28')],'sectionId':_0x52482c['id']},{})[_0xb1cc('0x22')](function(){return _0x2faa1e;});}else{return _0x2faa1e;}})[_0xb1cc('0x3e')](function(_0x367564){logger[_0xb1cc('0x26')](_0xb1cc('0x4c'),_0x367564);throw _0x367564;});}return _0x2faa1e;})[_0xb1cc('0x22')](respondWithResult(_0x5d8a66,0xc9))[_0xb1cc('0x3e')](handleError(_0x5d8a66,null));};exports[_0xb1cc('0x4d')]=function(_0x278f3e,_0x1631a3){if(_0x278f3e[_0xb1cc('0x46')]['id']){delete _0x278f3e[_0xb1cc('0x46')]['id'];}return db[_0xb1cc('0x2a')][_0xb1cc('0x44')]({'where':{'id':_0x278f3e['params']['id']}})[_0xb1cc('0x22')](handleEntityNotFound(_0x1631a3,null))[_0xb1cc('0x22')](saveUpdates(_0x278f3e[_0xb1cc('0x46')],null))[_0xb1cc('0x22')](respondWithResult(_0x1631a3,null))[_0xb1cc('0x3e')](handleError(_0x1631a3,null));};exports['destroy']=function(_0x1bce8d,_0x1e90a3){return db[_0xb1cc('0x2a')][_0xb1cc('0x44')]({'where':{'id':_0x1bce8d['params']['id']}})[_0xb1cc('0x22')](handleEntityNotFound(_0x1e90a3,null))[_0xb1cc('0x22')](removeEntity(_0x1e90a3,null))[_0xb1cc('0x3e')](handleError(_0x1e90a3,null));};exports[_0xb1cc('0x2b')]=function(_0x3f10e0,_0x23b31a){return db[_0xb1cc('0x2a')][_0xb1cc('0x2b')]()[_0xb1cc('0x22')](respondWithResult(_0x23b31a,null))[_0xb1cc('0x3e')](handleError(_0x23b31a,null));};exports[_0xb1cc('0x4e')]=function(_0x16f994,_0x5d59b,_0x5ba40){return db[_0xb1cc('0x4f')]['find']({'where':{'id':_0x16f994['params']['id']}})['then'](handleEntityNotFound(_0x5d59b,null))[_0xb1cc('0x22')](function(_0x379eb1){if(_0x379eb1){return _0x379eb1[_0xb1cc('0x4e')](_0x16f994[_0xb1cc('0x46')]['ids'],_[_0xb1cc('0x50')](_0x16f994[_0xb1cc('0x46')],[_0xb1cc('0x51'),'id'])||{});}})['then'](respondWithResult(_0x5d59b,null))[_0xb1cc('0x3e')](handleError(_0x5d59b,null));};exports[_0xb1cc('0x52')]=function(_0x13ea9d,_0x5a648f,_0x4f7d4b){var _0x2b986a={};var _0x377104={};var _0x5c5271;var _0x3305c1;return db[_0xb1cc('0x2a')]['findOne']({'where':{'id':_0x13ea9d['params']['id']}})[_0xb1cc('0x22')](handleEntityNotFound(_0x5a648f,null))[_0xb1cc('0x22')](function(_0x325ca2){if(_0x325ca2){_0x5c5271=_0x325ca2;_0x377104['model']=_[_0xb1cc('0x2d')](db[_0xb1cc('0x4f')][_0xb1cc('0x40')]);_0x377104[_0xb1cc('0x2e')]=_[_0xb1cc('0x2d')](_0x13ea9d[_0xb1cc('0x2e')]);_0x377104['filters']=_[_0xb1cc('0x31')](_0x377104[_0xb1cc('0x2c')],_0x377104['query']);_0x2b986a[_0xb1cc('0x30')]=_[_0xb1cc('0x31')](_0x377104[_0xb1cc('0x2c')],qs[_0xb1cc('0x32')](_0x13ea9d[_0xb1cc('0x2e')][_0xb1cc('0x32')]));_0x2b986a[_0xb1cc('0x30')]=_0x2b986a['attributes'][_0xb1cc('0x41')]?_0x2b986a[_0xb1cc('0x30')]:_0x377104[_0xb1cc('0x2c')];_0x2b986a[_0xb1cc('0x35')]=qs[_0xb1cc('0x36')](_0x13ea9d['query'][_0xb1cc('0x36')]);_0x2b986a['where']=qs[_0xb1cc('0x2f')](_['pick'](_0x13ea9d[_0xb1cc('0x2e')],_0x377104[_0xb1cc('0x2f')]));if(_0x13ea9d['query'][_0xb1cc('0x3a')]){_0x2b986a['where']=_[_0xb1cc('0x37')](_0x2b986a['where'],{'$or':_[_0xb1cc('0x39')](_0x2b986a[_0xb1cc('0x30')],function(_0x34f797){var _0xab4d88={};_0xab4d88[_0x34f797]={'$like':'%'+_0x13ea9d['query'][_0xb1cc('0x3a')]+'%'};return _0xab4d88;})});}_0x2b986a=_[_0xb1cc('0x37')]({},_0x2b986a,_0x13ea9d['options']);return _0x5c5271[_0xb1cc('0x52')](_0x2b986a);}})['then'](function(_0x5bd85d){if(_0x5bd85d){_0x3305c1=_0x5bd85d[_0xb1cc('0x41')];if(!_0x13ea9d[_0xb1cc('0x2e')][_0xb1cc('0x33')](_0xb1cc('0x34'))){_0x2b986a[_0xb1cc('0x1b')]=qs[_0xb1cc('0x1b')](_0x13ea9d[_0xb1cc('0x2e')][_0xb1cc('0x1b')]);_0x2b986a[_0xb1cc('0x1c')]=qs['offset'](_0x13ea9d['query'][_0xb1cc('0x1c')]);}return _0x5c5271['getContacts'](_0x2b986a);}})['then'](function(_0x42cef8){if(_0x42cef8){return _0x42cef8?{'count':_0x3305c1,'rows':_0x42cef8}:null;}})[_0xb1cc('0x22')](respondWithResult(_0x5a648f,null))[_0xb1cc('0x3e')](handleError(_0x5a648f,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 8ed9081..85d968c 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 _0xcd8b=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./cmCompany.attributes','exports','define','cm_companies'];(function(_0x56ceab,_0x3943c0){var _0x2d54af=function(_0x2b6bdb){while(--_0x2b6bdb){_0x56ceab['push'](_0x56ceab['shift']());}};_0x2d54af(++_0x3943c0);}(_0xcd8b,0x1c8));var _0xbcd8=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xcd8b[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xbcd8('0x0'));var util=require(_0xbcd8('0x1'));var logger=require(_0xbcd8('0x2'))(_0xbcd8('0x3'));var moment=require(_0xbcd8('0x4'));var BPromise=require('bluebird');var rp=require(_0xbcd8('0x5'));var fs=require('fs');var path=require(_0xbcd8('0x6'));var rimraf=require(_0xbcd8('0x7'));var config=require('../../config/environment');var attributes=require(_0xbcd8('0x8'));module[_0xbcd8('0x9')]=function(_0x5523e2,_0x57628f){return _0x5523e2[_0xbcd8('0xa')]('CmCompany',attributes,{'tableName':_0xbcd8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ae0=['CmCompany','cm_companies','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define'];(function(_0x365be9,_0x3c88b9){var _0x185c12=function(_0xbadbbf){while(--_0xbadbbf){_0x365be9['push'](_0x365be9['shift']());}};_0x185c12(++_0x3c88b9);}(_0x1ae0,0x147));var _0x01ae=function(_0x49c5af,_0x29c031){_0x49c5af=_0x49c5af-0x0;var _0x2111e6=_0x1ae0[_0x49c5af];return _0x2111e6;};'use strict';var _=require(_0x01ae('0x0'));var util=require(_0x01ae('0x1'));var logger=require('../../config/logger')(_0x01ae('0x2'));var moment=require('moment');var BPromise=require(_0x01ae('0x3'));var rp=require(_0x01ae('0x4'));var fs=require('fs');var path=require(_0x01ae('0x5'));var rimraf=require(_0x01ae('0x6'));var config=require(_0x01ae('0x7'));var attributes=require(_0x01ae('0x8'));module[_0x01ae('0x9')]=function(_0x221cbe,_0xfce1ea){return _0x221cbe[_0x01ae('0xa')](_0x01ae('0xb'),attributes,{'tableName':_0x01ae('0xc'),'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 6bc5db1..1608be1 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 _0xa678=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x222909,_0xff8168){var _0x39496c=function(_0x5cc3ee){while(--_0x5cc3ee){_0x222909['push'](_0x222909['shift']());}};_0x39496c(++_0xff8168);}(_0xa678,0x70));var _0x8a67=function(_0x5ccdd5,_0x29f34c){_0x5ccdd5=_0x5ccdd5-0x0;var _0x4eaeaf=_0xa678[_0x5ccdd5];return _0x4eaeaf;};'use strict';var _=require(_0x8a67('0x0'));var util=require(_0x8a67('0x1'));var moment=require(_0x8a67('0x2'));var BPromise=require(_0x8a67('0x3'));var rs=require(_0x8a67('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8a67('0x5'))['db'];var utils=require(_0x8a67('0x6'));var logger=require(_0x8a67('0x7'))('rpc');var config=require(_0x8a67('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8a67('0x9')][_0x8a67('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a8f6e,_0x529509,_0x1d8c7b){return new BPromise(function(_0x48ac49,_0x2c2f7d){return client[_0x8a67('0xb')](_0x5a8f6e,_0x1d8c7b)['then'](function(_0x289fa1){logger[_0x8a67('0xc')](_0x8a67('0xd'),_0x529509,'request\x20sent');logger[_0x8a67('0xe')](_0x8a67('0xf'),_0x529509,_0x8a67('0x10'),JSON[_0x8a67('0x11')](_0x289fa1));if(_0x289fa1[_0x8a67('0x12')]){if(_0x289fa1[_0x8a67('0x12')][_0x8a67('0x13')]===0x1f4){logger['error'](_0x8a67('0xd'),_0x529509,_0x289fa1[_0x8a67('0x12')][_0x8a67('0x14')]);return _0x2c2f7d(_0x289fa1['error'][_0x8a67('0x14')]);}logger[_0x8a67('0x12')]('CmCompany,\x20%s,\x20%s',_0x529509,_0x289fa1[_0x8a67('0x12')]['message']);return _0x48ac49(_0x289fa1[_0x8a67('0x12')][_0x8a67('0x14')]);}else{logger[_0x8a67('0xc')](_0x8a67('0xd'),_0x529509,_0x8a67('0x10'));_0x48ac49(_0x289fa1['result']['message']);}})[_0x8a67('0x15')](function(_0x40fc2b){logger[_0x8a67('0x12')](_0x8a67('0xd'),_0x529509,_0x40fc2b);_0x2c2f7d(_0x40fc2b);});});} \ No newline at end of file +var _0xce3e=['request','then','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xce3e,0x129));var _0xece3=function(_0x3e29e5,_0x1cd087){_0x3e29e5=_0x3e29e5-0x0;var _0x37f88a=_0xce3e[_0x3e29e5];return _0x37f88a;};'use strict';var _=require('lodash');var util=require(_0xece3('0x0'));var moment=require(_0xece3('0x1'));var BPromise=require(_0xece3('0x2'));var rs=require(_0xece3('0x3'));var fs=require('fs');var Redis=require(_0xece3('0x4'));var db=require(_0xece3('0x5'))['db'];var utils=require(_0xece3('0x6'));var logger=require(_0xece3('0x7'))(_0xece3('0x8'));var config=require(_0xece3('0x9'));var jayson=require(_0xece3('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x20cb3a,_0x4668bc,_0x185d2c){return new BPromise(function(_0x51bcf7,_0x2d2111){return client[_0xece3('0xb')](_0x20cb3a,_0x185d2c)[_0xece3('0xc')](function(_0x792283){logger[_0xece3('0xd')](_0xece3('0xe'),_0x4668bc,'request\x20sent');logger['debug'](_0xece3('0xf'),_0x4668bc,'request\x20sent',JSON[_0xece3('0x10')](_0x792283));if(_0x792283['error']){if(_0x792283[_0xece3('0x11')][_0xece3('0x12')]===0x1f4){logger[_0xece3('0x11')](_0xece3('0xe'),_0x4668bc,_0x792283['error'][_0xece3('0x13')]);return _0x2d2111(_0x792283[_0xece3('0x11')][_0xece3('0x13')]);}logger[_0xece3('0x11')](_0xece3('0xe'),_0x4668bc,_0x792283[_0xece3('0x11')][_0xece3('0x13')]);return _0x51bcf7(_0x792283[_0xece3('0x11')][_0xece3('0x13')]);}else{logger[_0xece3('0xd')](_0xece3('0xe'),_0x4668bc,_0xece3('0x14'));_0x51bcf7(_0x792283['result'][_0xece3('0x13')]);}})[_0xece3('0x15')](function(_0x238aa0){logger[_0xece3('0x11')](_0xece3('0xe'),_0x4668bc,_0x238aa0);_0x2d2111(_0x238aa0);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 1ba243e..664a813 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 _0x5f32=['describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5f32,0x12d));var _0x25f3=function(_0x401701,_0x149dce){_0x401701=_0x401701-0x0;var _0x3da178=_0x5f32[_0x401701];return _0x3da178;};'use strict';var multer=require('multer');var util=require(_0x25f3('0x0'));var path=require(_0x25f3('0x1'));var timeout=require(_0x25f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x25f3('0x3'));var auth=require(_0x25f3('0x4'));var interaction=require(_0x25f3('0x5'));var config=require(_0x25f3('0x6'));var controller=require(_0x25f3('0x7'));router[_0x25f3('0x8')]('/',auth[_0x25f3('0x9')](),controller[_0x25f3('0xa')]);router[_0x25f3('0x8')]('/describe',auth[_0x25f3('0x9')](),controller[_0x25f3('0xb')]);router[_0x25f3('0x8')](_0x25f3('0xc'),auth[_0x25f3('0x9')](),controller[_0x25f3('0xd')]);router[_0x25f3('0x8')](_0x25f3('0xe'),auth['isAuthenticated'](),controller[_0x25f3('0xf')]);router[_0x25f3('0x10')]('/',auth[_0x25f3('0x9')](),controller[_0x25f3('0x11')]);router[_0x25f3('0x10')]('/:id/contacts',auth[_0x25f3('0x9')](),controller[_0x25f3('0x12')]);router[_0x25f3('0x13')](_0x25f3('0xc'),auth[_0x25f3('0x9')](),controller[_0x25f3('0x14')]);router[_0x25f3('0x15')](_0x25f3('0xc'),auth[_0x25f3('0x9')](),controller[_0x25f3('0x16')]);module[_0x25f3('0x17')]=router; \ No newline at end of file +var _0xbf13=['addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','describe','/:id','show','/:id/contacts','create'];(function(_0x2d652f,_0x58c104){var _0x670d67=function(_0x455be5){while(--_0x455be5){_0x2d652f['push'](_0x2d652f['shift']());}};_0x670d67(++_0x58c104);}(_0xbf13,0xe2));var _0x3bf1=function(_0x144a67,_0x52c58b){_0x144a67=_0x144a67-0x0;var _0x67d893=_0xbf13[_0x144a67];return _0x67d893;};'use strict';var multer=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var path=require(_0x3bf1('0x2'));var timeout=require(_0x3bf1('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3bf1('0x4'));var auth=require(_0x3bf1('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3bf1('0x6'));var controller=require(_0x3bf1('0x7'));router[_0x3bf1('0x8')]('/',auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xa')]);router['get']('/describe',auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xb')]);router['get'](_0x3bf1('0xc'),auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xd')]);router[_0x3bf1('0x8')](_0x3bf1('0xe'),auth[_0x3bf1('0x9')](),controller['getContacts']);router['post']('/',auth[_0x3bf1('0x9')](),controller[_0x3bf1('0xf')]);router['post'](_0x3bf1('0xe'),auth['isAuthenticated'](),controller[_0x3bf1('0x10')]);router[_0x3bf1('0x11')](_0x3bf1('0xc'),auth[_0x3bf1('0x9')](),controller[_0x3bf1('0x12')]);router[_0x3bf1('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x3bf1('0x14')]);module[_0x3bf1('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 7cf2fa4..6cedac0 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 _0x8de0=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0x8de0,0xcd));var _0x08de=function(_0x5603ac,_0x30ad93){_0x5603ac=_0x5603ac-0x0;var _0xe30eb8=_0x8de0[_0x5603ac];return _0xe30eb8;};'use strict';var _=require(_0x08de('0x0'));var Sequelize=require(_0x08de('0x1'));module[_0x08de('0x2')]={'firstName':{'type':Sequelize[_0x08de('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0x08de('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x08de('0x3')]},'city':{'type':Sequelize[_0x08de('0x3')]},'country':{'type':Sequelize[_0x08de('0x3')]},'dateOfBirth':{'type':Sequelize[_0x08de('0x3')]},'description':{'type':Sequelize[_0x08de('0x4')]},'phone':{'type':Sequelize[_0x08de('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x08de('0x3')]},'email':{'type':Sequelize[_0x08de('0x3')]},'url':{'type':Sequelize[_0x08de('0x3')]},'facebook':{'type':Sequelize[_0x08de('0x3')]},'fb_data':{'type':Sequelize[_0x08de('0x3')]},'twitter':{'type':Sequelize[_0x08de('0x3')]},'skype':{'type':Sequelize[_0x08de('0x3')]},'teams':{'type':Sequelize[_0x08de('0x3')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x08de('0x3')]},'wechat':{'type':Sequelize[_0x08de('0x3')]},'telegram':{'type':Sequelize[_0x08de('0x3')]},'UserId':{'type':Sequelize[_0x08de('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x08de('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x08de('0x7')],'defaultValue':Sequelize[_0x08de('0x8')]},'dialTimezone':{'type':Sequelize[_0x08de('0x3')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6bf1=['INTEGER','DATE','NOW','exports','STRING','TEXT'];(function(_0x2a0c6c,_0x42f63d){var _0x2300a4=function(_0x47a1b7){while(--_0x47a1b7){_0x2a0c6c['push'](_0x2a0c6c['shift']());}};_0x2300a4(++_0x42f63d);}(_0x6bf1,0x9f));var _0x16bf=function(_0x2bc081,_0x15f9de){_0x2bc081=_0x2bc081-0x0;var _0x8b3bdf=_0x6bf1[_0x2bc081];return _0x8b3bdf;};'use strict';var _=require('lodash');var Sequelize=require('sequelize');module[_0x16bf('0x0')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x16bf('0x1')]},'street':{'type':Sequelize[_0x16bf('0x1')]},'postalCode':{'type':Sequelize[_0x16bf('0x1')]},'city':{'type':Sequelize[_0x16bf('0x1')]},'country':{'type':Sequelize[_0x16bf('0x1')]},'dateOfBirth':{'type':Sequelize[_0x16bf('0x1')]},'description':{'type':Sequelize[_0x16bf('0x2')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0x16bf('0x1')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x16bf('0x1')]},'url':{'type':Sequelize[_0x16bf('0x1')]},'facebook':{'type':Sequelize[_0x16bf('0x1')]},'fb_data':{'type':Sequelize[_0x16bf('0x1')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x16bf('0x1')]},'teams':{'type':Sequelize[_0x16bf('0x1')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x16bf('0x1')]},'wechat':{'type':Sequelize[_0x16bf('0x1')]},'telegram':{'type':Sequelize[_0x16bf('0x1')]},'UserId':{'type':Sequelize[_0x16bf('0x3')]},'AdditionalPhones':{'type':Sequelize[_0x16bf('0x1')]},'priority':{'type':Sequelize[_0x16bf('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x16bf('0x4')],'defaultValue':Sequelize[_0x16bf('0x5')]},'dialTimezone':{'type':Sequelize[_0x16bf('0x1')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 64a70ed..0f68e16 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 _0x3a87=['filters','intersection','fields','attributes','order','sort','filter','options','nolimit','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','`ItemType`.OrderBy','CmHopperId','item','ItemType.OrderBy','getAdditionalPhones','toContactId','rescheduleAdditionalPhones','hopperId','getHoppers','count','include','rows','CmHopperHistory','pick','ContactId','includeAll','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','root','server/files/tmp','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','pid','createReadStream','parse','meta','import','User','agent','binding','firstName','No\x20firstName\x20column\x20specified','socket_timestamp','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','exit','getJourney','mail','chat','sms','fax','resolve','channel','includes','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','destination','starttime','endtime','duration','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','createdAt','DESC','startCase','Website','Account','closedAt','secondDisposition','thirdDisposition','key','Owner','Tags','browserName','deviceModel','ratingMessage','ratingType','ratingValue','referer','subject','substatus','openchannel','externalUrl','threadId','Interaction','findAndCountAll','flatten','reverse','value','slice','moment','util','path','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','../../mysqldb','defaults','redis','socket.io-emitter','./cmContact.socket','status','json','offset','undefined','limit','set','Content-Range','update','then','end','sendStatus','error','stack','name','send','describe','findAll','query','user','catch','destroy','find','params','tags','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','alias','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from','CmHopper','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','ReportAgentPreview','VoiceCallReport','MailQueueReport','OpenchannelQueueReport','JscriptySessionReport','WhatsappInteraction','CmContact','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','push','all','Tag','color','tag','Phones','ContactItemType','ItemType','sequelize','literal','Phones.OrderBy','$and','format','map','isEmpty','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','model','rawAttributes'];(function(_0x4be687,_0xe630cc){var _0x42156f=function(_0x5ae44b){while(--_0x5ae44b){_0x4be687['push'](_0x4be687['shift']());}};_0x42156f(++_0xe630cc);}(_0x3a87,0x16c));var _0x73a8=function(_0x34b5ca,_0x594010){_0x34b5ca=_0x34b5ca-0x0;var _0x2d72c0=_0x3a87[_0x34b5ca];return _0x2d72c0;};'use strict';var moment=require(_0x73a8('0x0'));var BPromise=require('bluebird');var util=require(_0x73a8('0x1'));var path=require(_0x73a8('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x73a8('0x3'));var Papa=require('papaparse');var Redis=require(_0x73a8('0x4'));var contacts=require(_0x73a8('0x5'));var qs=require(_0x73a8('0x6'));var logger=require(_0x73a8('0x7'))(_0x73a8('0x8'));var config=require(_0x73a8('0x9'));var shared=require(_0x73a8('0xa'));var db=require(_0x73a8('0xb'))['db'];config['redis']=_[_0x73a8('0xc')](config[_0x73a8('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x73a8('0xe'))(new Redis(config[_0x73a8('0xd')]));require(_0x73a8('0xf'))['register'](socket);function respondWithResult(_0x87cf7a,_0x2a3daf){_0x2a3daf=_0x2a3daf||0xc8;return function(_0x4c66bd){if(_0x4c66bd){return _0x87cf7a[_0x73a8('0x10')](_0x2a3daf)[_0x73a8('0x11')](_0x4c66bd);}};}function respondWithFilteredResult(_0x22fde5,_0xff4dc7){return function(_0x166d29){if(_0x166d29){var _0x173241=typeof _0xff4dc7[_0x73a8('0x12')]===_0x73a8('0x13')&&typeof _0xff4dc7[_0x73a8('0x14')]===_0x73a8('0x13');var _0x4e43a7=_0x166d29['count'];var _0xd7852a=_0x173241?0x0:_0xff4dc7['offset'];var _0x7e7258=_0x173241?_0x166d29['count']:_0xff4dc7[_0x73a8('0x12')]+_0xff4dc7['limit'];var _0x41674b;if(_0x7e7258>=_0x4e43a7){_0x7e7258=_0x4e43a7;_0x41674b=0xc8;}else{_0x41674b=0xce;}_0x22fde5['status'](_0x41674b);return _0x22fde5[_0x73a8('0x15')](_0x73a8('0x16'),_0xd7852a+'-'+_0x7e7258+'/'+_0x4e43a7)[_0x73a8('0x11')](_0x166d29);}return null;};}function saveUpdates(_0x3a9608){return function(_0x3b59d0){if(_0x3b59d0){return _0x3b59d0[_0x73a8('0x17')](_0x3a9608)[_0x73a8('0x18')](function(_0x5e4715){return _0x5e4715;});}return null;};}function removeEntity(_0x1685c7){return function(_0x4ef770){if(_0x4ef770){return _0x4ef770['destroy']()[_0x73a8('0x18')](function(){_0x1685c7[_0x73a8('0x10')](0xcc)[_0x73a8('0x19')]();});}};}function handleEntityNotFound(_0x1e491e){return function(_0x2f0e83){if(!_0x2f0e83){_0x1e491e[_0x73a8('0x1a')](0x194);}return _0x2f0e83;};}function handleError(_0x30ba87,_0xb17f8b){_0xb17f8b=_0xb17f8b||0x1f4;return function(_0x5289d7){logger[_0x73a8('0x1b')](_0x5289d7[_0x73a8('0x1c')]);if(_0x5289d7[_0x73a8('0x1d')]){delete _0x5289d7[_0x73a8('0x1d')];}_0x30ba87['status'](_0xb17f8b)[_0x73a8('0x1e')](_0x5289d7);};}exports['index']=function(_0x43abc5,_0x27322d){var _0x57988f={};return contacts[_0x73a8('0x1f')]()[_0x73a8('0x18')](function(_0xee4442){_0x57988f=qs['getOptions'](_0xee4442,_0x43abc5);return contacts[_0x73a8('0x20')](_0x43abc5[_0x73a8('0x21')],_0x43abc5[_0x73a8('0x22')],_0x57988f,_0xee4442);})[_0x73a8('0x18')](respondWithFilteredResult(_0x27322d,_0x57988f))[_0x73a8('0x23')](handleError(_0x27322d,null));};exports[_0x73a8('0x24')]=function(_0x2b6dc5,_0x458162){return db['CmContact'][_0x73a8('0x25')]({'where':{'id':_0x2b6dc5[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x458162,null))[_0x73a8('0x18')](removeEntity(_0x458162,null))['catch'](handleError(_0x458162,null));};exports['describe']=function(_0x32139e,_0x25c674){return db['CmContact'][_0x73a8('0x1f')]()[_0x73a8('0x18')](function(_0x4f0654){delete _0x4f0654[_0x73a8('0x27')];for(var _0x54192e=0x0;_0x54192e0x0){return new Promise(function(_0x534bc1){var _0x1733cd=[];for(var _0x4dfbfc=0x0;_0x4dfbfc<_0x14366c[_0x73a8('0x29')];_0x4dfbfc++){_0x1733cd['push'](insertAdditionalPhones(_0x14366c[_0x4dfbfc]['contact'],_0x14366c[_0x4dfbfc][_0x73a8('0x58')]));}Promise[_0x73a8('0x60')](_0x1733cd)[_0x73a8('0x18')](function(){_0x534bc1(0x1);});})[_0x73a8('0x18')](function(){return{'success':_0x3f99a0,'failure':_0x31470d,'duplicates':_0x267fd6};});}else{return{'success':_0x3f99a0,'failure':_0x31470d,'duplicates':_0x267fd6};}}})[_0x73a8('0x18')](respondWithResult(_0x58bfb9,0xc9))[_0x73a8('0x23')](handleError(_0x58bfb9,null));};exports['show']=function(_0x20b02a,_0x3746f8){var _0x204dd3;return db[_0x73a8('0x53')]['describe']()[_0x73a8('0x18')](function(_0x475ef4){return db['CmContact'][_0x73a8('0x25')]({'where':{'id':_0x20b02a[_0x73a8('0x26')]['id']},'include':[{'model':db[_0x73a8('0x61')],'as':'Tags','attributes':['id',_0x73a8('0x1d'),_0x73a8('0x62')],'required':_0x20b02a['query'][_0x73a8('0x63')]?!![]:![]},{'model':db[_0x73a8('0x4c')],'as':_0x73a8('0x64'),'where':{'CmContactId':_0x20b02a[_0x73a8('0x26')]['id']},'required':![],'include':[{'model':db[_0x73a8('0x65')],'as':_0x73a8('0x66')}]}],'order':[db[_0x73a8('0x67')][_0x73a8('0x68')](_0x73a8('0x69'))],'attributes':_[_0x73a8('0x28')](_0x475ef4)});})['then'](function(_0x529973){if(!_['isNil'](_0x529973)){_0x204dd3=_0x529973[_0x73a8('0x38')]({'plain':!![]});var _0x23d033={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x529973&&_0x529973[_0x73a8('0x5e')]){if(_0x529973['ListId']){_0x23d033['where'][_0x73a8('0x6a')][_0x73a8('0x5f')]({'ListId':{'$ne':_0x529973[_0x73a8('0x5e')]}});}}return db['CmCustomField'][_0x73a8('0x20')](_0x23d033);}})[_0x73a8('0x18')](function(_0x5c75a5){if(!_[_0x73a8('0x54')](_0x5c75a5)){return _['omit'](_0x204dd3,_['map'](_0x5c75a5,function(_0x16c561){return util[_0x73a8('0x6b')]('cf_%d',_0x16c561['id']);}));}})[_0x73a8('0x18')](handleEntityNotFound(_0x3746f8,null))[_0x73a8('0x18')](respondWithResult(_0x3746f8,null))[_0x73a8('0x23')](handleError(_0x3746f8,null));};exports[_0x73a8('0x17')]=function(_0x2b20f2,_0x54ca72){var _0x29633a;if(_0x2b20f2[_0x73a8('0x37')]['id']){delete _0x2b20f2['body']['id'];}if(!_[_0x73a8('0x54')](_0x2b20f2['body']['dialTimezone'])){var _0x168947=_0x2b20f2[_0x73a8('0x37')][_0x73a8('0x55')];if(!_[_0x73a8('0x54')](shared[_0x73a8('0x56')][_0x168947]))_0x2b20f2[_0x73a8('0x37')][_0x73a8('0x57')]=shared['timezones'][_0x168947][_0x73a8('0x57')];}return db['CmContact'][_0x73a8('0x25')]({'where':{'id':_0x2b20f2['params']['id']}})[_0x73a8('0x18')](handleEntityNotFound(_0x54ca72,null))[_0x73a8('0x18')](saveUpdates(_0x2b20f2['body'],null))[_0x73a8('0x18')](function(_0x6e9715){_0x29633a=_0x6e9715;var _0x4ab330={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x6e9715&&_0x6e9715['ListId']){if(_0x6e9715[_0x73a8('0x5e')]){_0x4ab330[_0x73a8('0x5c')][_0x73a8('0x6a')][_0x73a8('0x5f')]({'ListId':{'$ne':_0x6e9715['ListId']}});}}return db[_0x73a8('0x2f')]['findAll'](_0x4ab330);})[_0x73a8('0x18')](function(_0x5a1ff7){if(_0x5a1ff7){return _['omit'](_['pickBy'](_0x2b20f2[_0x73a8('0x37')],function(_0x29a71e,_0x3d64a2){return _[_0x73a8('0x2a')](_0x3d64a2,'cf_');}),_[_0x73a8('0x6c')](_0x5a1ff7,function(_0x3afccc){return util[_0x73a8('0x6b')]('cf_%d',_0x3afccc['id']);}));}})[_0x73a8('0x18')](function(_0x187c77){if(_0x187c77&&!_[_0x73a8('0x6d')](_0x187c77)){var _0xb72df1=squel[_0x73a8('0x17')]()['table'](_0x73a8('0x6e'))[_0x73a8('0x6f')](_0x187c77)['where'](_0x73a8('0x70'),_0x2b20f2[_0x73a8('0x26')]['id'])[_0x73a8('0x71')]();return db[_0x73a8('0x67')][_0x73a8('0x21')](_0xb72df1[_0x73a8('0x72')],{'replacements':_0xb72df1['values']});}})[_0x73a8('0x18')](function(){if(_0x2b20f2[_0x73a8('0x37')][_0x73a8('0x73')]&&_0x29633a){return db[_0x73a8('0x3f')]['update']({'phone':_0x2b20f2[_0x73a8('0x37')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x29633a['id']}});}})[_0x73a8('0x18')](function(){return _0x29633a;})[_0x73a8('0x18')](respondWithResult(_0x54ca72,null))[_0x73a8('0x23')](handleError(_0x54ca72,null));};exports[_0x73a8('0x74')]=function(_0x2da00d,_0x202b27){var _0x24e2ce={};var _0xe71ba0={};var _0x268aeb;var _0x4f7665;return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x2da00d[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x202b27,null))[_0x73a8('0x18')](function(_0x36201c){if(_0x36201c){_0x268aeb=_0x36201c;_0xe71ba0[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x61')][_0x73a8('0x77')]);_0xe71ba0[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x2da00d[_0x73a8('0x21')]);_0xe71ba0[_0x73a8('0x78')]=_[_0x73a8('0x79')](_0xe71ba0[_0x73a8('0x76')],_0xe71ba0[_0x73a8('0x21')]);_0x24e2ce['attributes']=_['intersection'](_0xe71ba0[_0x73a8('0x76')],qs[_0x73a8('0x7a')](_0x2da00d['query'][_0x73a8('0x7a')]));_0x24e2ce[_0x73a8('0x7b')]=_0x24e2ce[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x24e2ce[_0x73a8('0x7b')]:_0xe71ba0[_0x73a8('0x76')];_0x24e2ce[_0x73a8('0x7c')]=qs[_0x73a8('0x7d')](_0x2da00d[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x24e2ce['where']=qs['filters'](_['pick'](_0x2da00d[_0x73a8('0x21')],_0xe71ba0['filters']));if(_0x2da00d[_0x73a8('0x21')][_0x73a8('0x7e')]){_0x24e2ce[_0x73a8('0x5c')]=_['merge'](_0x24e2ce[_0x73a8('0x5c')],{'$or':_[_0x73a8('0x6c')](_0x24e2ce[_0x73a8('0x7b')],function(_0x416637){var _0x92248d={};_0x92248d[_0x416637]={'$like':'%'+_0x2da00d['query']['filter']+'%'};return _0x92248d;})});}_0x24e2ce=_[_0x73a8('0x36')]({},_0x24e2ce,_0x2da00d[_0x73a8('0x7f')]);return _0x268aeb[_0x73a8('0x74')](_0x24e2ce);}})[_0x73a8('0x18')](function(_0x98f803){if(_0x98f803){_0x4f7665=_0x98f803['length'];if(!_0x2da00d[_0x73a8('0x21')]['hasOwnProperty'](_0x73a8('0x80'))){_0x24e2ce['limit']=qs['limit'](_0x2da00d[_0x73a8('0x21')][_0x73a8('0x14')]);_0x24e2ce[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x2da00d['query'][_0x73a8('0x12')]);}return _0x268aeb[_0x73a8('0x74')](_0x24e2ce);}})[_0x73a8('0x18')](function(_0x43b72b){if(_0x43b72b){return _0x43b72b?{'count':_0x4f7665,'rows':_0x43b72b}:null;}})['then'](respondWithResult(_0x202b27,null))[_0x73a8('0x23')](handleError(_0x202b27,null));};exports[_0x73a8('0x81')]=function(_0x20d4b5,_0x165b43){if(_0x20d4b5[_0x73a8('0x37')]['id']){delete _0x20d4b5[_0x73a8('0x37')]['id'];}return db['CmContact']['findOne']({'where':{'id':_0x20d4b5[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x165b43,null))[_0x73a8('0x18')](function(_0xd0219f){if(_0xd0219f){return _0xd0219f[_0x73a8('0x81')](_0x20d4b5[_0x73a8('0x37')][_0x73a8('0x82')]||[]);}return null;})[_0x73a8('0x18')](respondWithResult(_0x165b43,null))[_0x73a8('0x23')](handleError(_0x165b43,null));};exports[_0x73a8('0x83')]=function(_0x437c68,_0x227fec){var _0x597c5f=[];_0x597c5f[_0x73a8('0x5f')](addAdditionalPhones(_0x437c68[_0x73a8('0x37')]));Promise[_0x73a8('0x60')](_0x597c5f)[_0x73a8('0x18')](function(){_0x597c5f=[];_0x597c5f[_0x73a8('0x5f')](deleteCmHopperPhones(_0x437c68[_0x73a8('0x37')]['id']));_0x597c5f[_0x73a8('0x5f')](addCmHopperPhones(_0x437c68['body']['id']));Promise[_0x73a8('0x60')](_0x597c5f)[_0x73a8('0x18')](function(){return[0x1];})['then'](respondWithResult(_0x227fec,null));});};function addAdditionalPhones(_0x1c8c03){var _0x34766d;return new Promise(function(_0x5b496e){return db[_0x73a8('0x4c')][_0x73a8('0x24')]({'where':{'CmContactId':_0x1c8c03['id']}})[_0x73a8('0x18')](function(){db['ContactItemType']['findAll']({'raw':!![],'attributes':['id',_0x73a8('0x84')]})[_0x73a8('0x18')](function(_0x2dad2a){var _0x367d30=[];for(var _0x13450c=0x0;_0x13450c<_0x1c8c03[_0x73a8('0x85')][_0x73a8('0x29')];_0x13450c++){var _0x4efb5f=_0x1c8c03[_0x73a8('0x86')]?_['isNil'](_0x1c8c03[_0x73a8('0x86')][_0x13450c])?'':_0x1c8c03[_0x73a8('0x86')][_0x13450c]:_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')]?_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')]:'';var _0x4d3e9d=_['isNil'](_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x88')])?'':_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x88')];var _0x1f89a9=_0x4efb5f+':'+_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x73')]+'§'+_0x4d3e9d;if(_[_0x73a8('0x54')](_0x34766d))_0x34766d=_0x1f89a9;else _0x34766d+=';'+_0x1f89a9;var _0x22c1b8=null;var _0x3b4f58=null;if(_0x1c8c03['item_types']){if(!_[_0x73a8('0x54')](_0x1c8c03[_0x73a8('0x86')][_0x13450c])){_0x3b4f58=_[_0x73a8('0x25')](_0x2dad2a,function(_0x2b6ed8){return _0x2b6ed8['id']===_0x1c8c03[_0x73a8('0x86')][_0x13450c];});if(!_['isNil'](_0x3b4f58)){_0x22c1b8=_0x3b4f58[_0x73a8('0x84')];}}}else{if(!_[_0x73a8('0x54')](_0x1c8c03[_0x73a8('0x85')][_0x13450c])){_0x3b4f58=_[_0x73a8('0x25')](_0x2dad2a,function(_0x321f88){return _0x321f88['id']===_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')];});if(!_[_0x73a8('0x54')](_0x3b4f58)){_0x22c1b8=_0x13450c;}}}if(_[_0x73a8('0x54')](_0x22c1b8)){_0x22c1b8=0x64;}_0x367d30[_0x73a8('0x5f')](addAdditionalPhone(_0x1c8c03['id'],_0x1c8c03[_0x73a8('0x85')][_0x13450c]['phone'],_0x1c8c03[_0x73a8('0x86')]?_['isNil'](_0x1c8c03['item_types'][_0x13450c])?null:_0x1c8c03['item_types'][_0x13450c]:_0x1c8c03['items'][_0x13450c][_0x73a8('0x87')]?_0x1c8c03[_0x73a8('0x85')][_0x13450c][_0x73a8('0x87')]:null,_0x22c1b8,_0x4d3e9d));}Promise['all'](_0x367d30)['then'](function(){db[_0x73a8('0x53')][_0x73a8('0x17')]({'AdditionalPhones':_0x34766d},{'where':{'id':_0x1c8c03['id']}})[_0x73a8('0x18')](function(){_0x5b496e(0x1);});});});});});}function addAdditionalPhone(_0x55c627,_0x82acbd,_0x13feee,_0x38fec3,_0x57aac0){return db[_0x73a8('0x4c')][_0x73a8('0x25')]({'where':{'CmContactId':_0x55c627,'item':_0x82acbd}})[_0x73a8('0x18')](function(_0x3c3c14){if(_0x3c3c14)logger['info'](_0x73a8('0x89'),_0x3c3c14);else{db[_0x73a8('0x4c')]['create']({'CmContactId':_0x55c627,'item':_0x82acbd,'ItemTypeId':_0x13feee,'OrderBy':_0x38fec3,'ItemClass':_0x73a8('0x8a'),'description':_0x57aac0});}});}function deleteCmHopperPhones(_0x261a06){return new Promise(function(_0x3836ee){return db[_0x73a8('0x3f')][_0x73a8('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x261a06}})[_0x73a8('0x18')](function(_0x358119){db[_0x73a8('0x8b')][_0x73a8('0x24')]({'where':{'CmHopperId':{'$in':_[_0x73a8('0x6c')](_0x358119,'id')}}});})[_0x73a8('0x18')](function(){_0x3836ee(0x1);});});}function addCmHopperPhones(_0x27ee98){return new Promise(function(_0x13fc00){return db[_0x73a8('0x3f')][_0x73a8('0x20')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x27ee98}})[_0x73a8('0x18')](function(_0x55294e){var _0x32be57=[];_[_0x73a8('0x6c')](_0x55294e,function(_0x2031ee){_0x32be57['push'](createCmHopperPhone(_0x27ee98,_0x2031ee['id']));});Promise['all'](_0x32be57)['then'](function(){_0x13fc00(0x1);});});});}function createCmHopperPhone(_0x4d6e59,_0x4fb8c3){return new Promise(function(_0x18e737){db[_0x73a8('0x4c')]['findAll']({'raw':!![],'attributes':['item',_0x73a8('0x84')],'where':{'CmContactId':_0x4d6e59,'ItemClass':_0x73a8('0x8a')},'include':[{'model':db[_0x73a8('0x65')],'attributes':[_0x73a8('0x84')],'as':_0x73a8('0x66')}],'order':[_0x73a8('0x84'),db[_0x73a8('0x67')][_0x73a8('0x68')](_0x73a8('0x8c'))]})[_0x73a8('0x18')](function(_0x37dd92){var _0x2d4122=0x1;var _0x4f3781=_[_0x73a8('0x6c')](_0x37dd92,function(_0x3e660b){_0x3e660b[_0x73a8('0x8d')]=_0x4fb8c3;_0x3e660b[_0x73a8('0x73')]=_0x3e660b[_0x73a8('0x8e')];_0x3e660b[_0x73a8('0x84')]=_0x2d4122;delete _0x3e660b[_0x73a8('0x8f')];_0x2d4122=_0x2d4122+0x1;return _0x3e660b;});return db[_0x73a8('0x8b')][_0x73a8('0x59')](_0x4f3781,{});})[_0x73a8('0x18')](function(){_0x18e737(0x1);});});}function insertAdditionalPhones(_0x4af98a,_0x5690c3){return new Promise(function(_0x43d1e0){var _0x3584ed=[];for(var _0x271a57=0x0;_0x271a57<_0x5690c3[_0x73a8('0x29')];_0x271a57++){var _0x1a7d92=_0x5690c3[_0x271a57];_0x3584ed['push'](parseContactItemType(_0x1a7d92));}Promise[_0x73a8('0x60')](_0x3584ed)['then'](function(){var _0x53865f={'id':_0x4af98a['id'],'items':_0x5690c3};return addAdditionalPhones(_0x53865f)[_0x73a8('0x18')](function(){return addCmHopperPhones(_0x4af98a['id']);});})[_0x73a8('0x18')](function(){_0x43d1e0(_0x4af98a);});});}function parseContactItemType(_0x24eb89){return new Promise(function(_0x170e4f){if(_0x24eb89[_0x73a8('0x35')]('ItemTypeId')){_0x170e4f(_0x24eb89);}else{return db[_0x73a8('0x65')][_0x73a8('0x25')]({'where':{'name':_0x24eb89['ItemType']}})['then'](function(_0x4645d3){if(_[_0x73a8('0x54')](_0x4645d3))_0x24eb89['ItemTypeId']=null;else _0x24eb89[_0x73a8('0x87')]=_0x4645d3['id'];_0x170e4f(_0x24eb89);});}});}exports[_0x73a8('0x90')]=function(_0xecb5ae,_0x1e7343){return db[_0x73a8('0x4c')]['findAll']({'raw':!![],'where':{'CmContactId':_0xecb5ae[_0x73a8('0x26')]['id'],'ItemClass':_0x73a8('0x8a')},'include':[{'model':db[_0x73a8('0x65')],'as':_0x73a8('0x66')}],'order':[['OrderBy'],[db['sequelize'][_0x73a8('0x68')](_0x73a8('0x8c'))]]})[_0x73a8('0x18')](function(_0x2aea98){return _0x2aea98;})[_0x73a8('0x18')](respondWithResult(_0x1e7343,null))[_0x73a8('0x23')](handleError(_0x1e7343,null));};exports['duplicateAdditionalPhones']=function(_0x53a0ea,_0x586ea9){return db[_0x73a8('0x4c')][_0x73a8('0x20')]({'raw':!![],'where':{'CmContactId':_0x53a0ea['body']['fromContactId']}})[_0x73a8('0x18')](function(_0x52032d){var _0x20e71a=_['map'](_0x52032d,function(_0x295169){_0x295169['CmContactId']=_0x53a0ea[_0x73a8('0x37')]['toContactId'];return _0x295169;});return db[_0x73a8('0x4c')]['bulkCreate'](_0x20e71a,{});})[_0x73a8('0x18')](function(){return addCmHopperPhones(_0x53a0ea[_0x73a8('0x37')][_0x73a8('0x91')]);})[_0x73a8('0x18')](function(){return['ok'];})[_0x73a8('0x18')](respondWithResult(_0x586ea9,null))[_0x73a8('0x23')](handleError(_0x586ea9,null));};exports[_0x73a8('0x92')]=function(_0x13da3c,_0x25e776){var _0x52a730=[];_0x52a730[_0x73a8('0x5f')](createCmHopperPhone(_0x13da3c[_0x73a8('0x37')]['id'],_0x13da3c[_0x73a8('0x37')][_0x73a8('0x93')]));Promise[_0x73a8('0x60')](_0x52a730)[_0x73a8('0x18')](function(){return[0x1];})[_0x73a8('0x18')](respondWithResult(_0x25e776,null));};exports[_0x73a8('0x94')]=function(_0x5622fd,_0x1e4123){var _0x41696e={'raw':![],'where':{}};var _0x486a1a={};var _0x3fdca2={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x5622fd[_0x73a8('0x26')]['id']}})['then'](handleEntityNotFound(_0x1e4123,null))[_0x73a8('0x18')](function(_0x43d331){if(_0x43d331){_0x486a1a['model']=_[_0x73a8('0x28')](db[_0x73a8('0x3f')][_0x73a8('0x77')]);_0x486a1a['query']=_[_0x73a8('0x28')](_0x5622fd[_0x73a8('0x21')]);_0x486a1a['filters']=_[_0x73a8('0x79')](_0x486a1a[_0x73a8('0x76')],_0x486a1a[_0x73a8('0x21')]);_0x41696e['attributes']=_[_0x73a8('0x79')](_0x486a1a[_0x73a8('0x76')],qs['fields'](_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7a')]));_0x41696e[_0x73a8('0x7b')]=_0x41696e[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x41696e[_0x73a8('0x7b')]:_0x486a1a[_0x73a8('0x76')];if(!_0x5622fd['query']['hasOwnProperty'](_0x73a8('0x80'))){_0x41696e[_0x73a8('0x14')]=qs['limit'](_0x5622fd[_0x73a8('0x21')][_0x73a8('0x14')]);_0x41696e[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x5622fd[_0x73a8('0x21')]['offset']);}_0x41696e[_0x73a8('0x7c')]=qs['sort'](_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x41696e[_0x73a8('0x5c')]=qs[_0x73a8('0x78')](_['pick'](_0x5622fd[_0x73a8('0x21')],_0x486a1a[_0x73a8('0x78')]));_0x41696e[_0x73a8('0x5c')]['ContactId']=_0x43d331['id'];if(_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7e')]){_0x41696e[_0x73a8('0x5c')]=_['merge'](_0x41696e[_0x73a8('0x5c')],{'$or':_[_0x73a8('0x6c')](_0x41696e[_0x73a8('0x7b')],function(_0x10d029){var _0x510830={};_0x510830[_0x10d029]={'$like':'%'+_0x5622fd[_0x73a8('0x21')][_0x73a8('0x7e')]+'%'};return _0x510830;})});}_0x41696e=_[_0x73a8('0x36')]({},_0x41696e,_0x5622fd[_0x73a8('0x7f')]);return db[_0x73a8('0x3f')]['count']({'where':_0x41696e[_0x73a8('0x5c')]})[_0x73a8('0x18')](function(_0x247364){_0x3fdca2[_0x73a8('0x95')]=_0x247364;if(_0x5622fd[_0x73a8('0x21')]['includeAll']){_0x41696e[_0x73a8('0x96')]=[{'all':!![]}];}return db[_0x73a8('0x3f')]['findAll'](_0x41696e);})[_0x73a8('0x18')](function(_0x3adf15){_0x3fdca2[_0x73a8('0x97')]=_0x3adf15;return _0x3fdca2;});}})[_0x73a8('0x18')](respondWithFilteredResult(_0x1e4123,_0x41696e))[_0x73a8('0x23')](handleError(_0x1e4123,null));};exports['getHopperHistories']=function(_0x4e4573,_0x52071a){var _0x5c36df={'raw':!![],'where':{}};var _0x32bbe1={};var _0x28f826={'count':0x0,'rows':[]};return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x4e4573['params']['id']}})['then'](handleEntityNotFound(_0x52071a,null))['then'](function(_0x15ecb6){if(_0x15ecb6){_0x32bbe1[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x98')]['rawAttributes']);_0x32bbe1[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x4e4573[_0x73a8('0x21')]);_0x32bbe1[_0x73a8('0x78')]=_['intersection'](_0x32bbe1[_0x73a8('0x76')],_0x32bbe1[_0x73a8('0x21')]);_0x5c36df['attributes']=_['intersection'](_0x32bbe1[_0x73a8('0x76')],qs[_0x73a8('0x7a')](_0x4e4573['query'][_0x73a8('0x7a')]));_0x5c36df[_0x73a8('0x7b')]=_0x5c36df[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x5c36df['attributes']:_0x32bbe1[_0x73a8('0x76')];if(!_0x4e4573[_0x73a8('0x21')][_0x73a8('0x35')](_0x73a8('0x80'))){_0x5c36df[_0x73a8('0x14')]=qs[_0x73a8('0x14')](_0x4e4573[_0x73a8('0x21')]['limit']);_0x5c36df[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x4e4573[_0x73a8('0x21')][_0x73a8('0x12')]);}_0x5c36df['order']=qs[_0x73a8('0x7d')](_0x4e4573[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x5c36df[_0x73a8('0x5c')]=qs['filters'](_[_0x73a8('0x99')](_0x4e4573[_0x73a8('0x21')],_0x32bbe1['filters']));_0x5c36df[_0x73a8('0x5c')][_0x73a8('0x9a')]=_0x15ecb6['id'];if(_0x4e4573['query'][_0x73a8('0x7e')]){_0x5c36df[_0x73a8('0x5c')]=_[_0x73a8('0x36')](_0x5c36df[_0x73a8('0x5c')],{'$or':_['map'](_0x5c36df[_0x73a8('0x7b')],function(_0x23cfa2){var _0x3ac8e8={};_0x3ac8e8[_0x23cfa2]={'$like':'%'+_0x4e4573[_0x73a8('0x21')][_0x73a8('0x7e')]+'%'};return _0x3ac8e8;})});}_0x5c36df=_['merge']({},_0x5c36df,_0x4e4573[_0x73a8('0x7f')]);return db[_0x73a8('0x98')]['count']({'where':_0x5c36df[_0x73a8('0x5c')]})[_0x73a8('0x18')](function(_0xa4e2fa){_0x28f826[_0x73a8('0x95')]=_0xa4e2fa;if(_0x4e4573[_0x73a8('0x21')][_0x73a8('0x9b')]){_0x5c36df[_0x73a8('0x96')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x73a8('0x20')](_0x5c36df);})[_0x73a8('0x18')](function(_0x41c2de){_0x28f826[_0x73a8('0x97')]=_0x41c2de;return _0x28f826;});}})['then'](respondWithFilteredResult(_0x52071a,_0x5c36df))[_0x73a8('0x23')](handleError(_0x52071a,null));};exports['getHopperFinals']=function(_0x420daf,_0x5c1b90){var _0x3a6f29={'raw':!![],'where':{}};var _0x448ad3={};var _0x124c24={'count':0x0,'rows':[]};return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x420daf[_0x73a8('0x26')]['id']}})[_0x73a8('0x18')](handleEntityNotFound(_0x5c1b90,null))[_0x73a8('0x18')](function(_0x1206e8){if(_0x1206e8){_0x448ad3[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x9c')][_0x73a8('0x77')]);_0x448ad3[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x420daf[_0x73a8('0x21')]);_0x448ad3['filters']=_[_0x73a8('0x79')](_0x448ad3[_0x73a8('0x76')],_0x448ad3['query']);_0x3a6f29[_0x73a8('0x7b')]=_[_0x73a8('0x79')](_0x448ad3[_0x73a8('0x76')],qs[_0x73a8('0x7a')](_0x420daf[_0x73a8('0x21')][_0x73a8('0x7a')]));_0x3a6f29[_0x73a8('0x7b')]=_0x3a6f29[_0x73a8('0x7b')]['length']?_0x3a6f29[_0x73a8('0x7b')]:_0x448ad3[_0x73a8('0x76')];if(!_0x420daf[_0x73a8('0x21')][_0x73a8('0x35')](_0x73a8('0x80'))){_0x3a6f29[_0x73a8('0x14')]=qs[_0x73a8('0x14')](_0x420daf['query']['limit']);_0x3a6f29['offset']=qs[_0x73a8('0x12')](_0x420daf[_0x73a8('0x21')][_0x73a8('0x12')]);}_0x3a6f29[_0x73a8('0x7c')]=qs[_0x73a8('0x7d')](_0x420daf[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x3a6f29['where']=qs['filters'](_['pick'](_0x420daf['query'],_0x448ad3[_0x73a8('0x78')]));_0x3a6f29['where']['ContactId']=_0x1206e8['id'];if(_0x420daf['query'][_0x73a8('0x7e')]){_0x3a6f29[_0x73a8('0x5c')]=_[_0x73a8('0x36')](_0x3a6f29['where'],{'$or':_[_0x73a8('0x6c')](_0x3a6f29[_0x73a8('0x7b')],function(_0x5846c6){var _0x4a8025={};_0x4a8025[_0x5846c6]={'$like':'%'+_0x420daf[_0x73a8('0x21')]['filter']+'%'};return _0x4a8025;})});}_0x3a6f29=_[_0x73a8('0x36')]({},_0x3a6f29,_0x420daf[_0x73a8('0x7f')]);return db[_0x73a8('0x9c')][_0x73a8('0x95')]({'where':_0x3a6f29[_0x73a8('0x5c')]})['then'](function(_0x35caf4){_0x124c24[_0x73a8('0x95')]=_0x35caf4;if(_0x420daf[_0x73a8('0x21')][_0x73a8('0x9b')]){_0x3a6f29[_0x73a8('0x96')]=[{'all':!![]}];}return db[_0x73a8('0x9c')][_0x73a8('0x20')](_0x3a6f29);})['then'](function(_0x272836){_0x124c24[_0x73a8('0x97')]=_0x272836;return _0x124c24;});}})[_0x73a8('0x18')](respondWithFilteredResult(_0x5c1b90,_0x3a6f29))[_0x73a8('0x23')](handleError(_0x5c1b90,null));};exports['getJscriptySessions']=function(_0x4cc153,_0x32bce9){var _0x45ab45={'raw':!![],'where':{}};var _0x4879d3={};var _0x4a43a0={'count':0x0,'rows':[]};return db[_0x73a8('0x53')][_0x73a8('0x75')]({'where':{'id':_0x4cc153['params']['id']}})['then'](handleEntityNotFound(_0x32bce9,null))['then'](function(_0x42fefd){if(_0x42fefd){_0x4879d3[_0x73a8('0x76')]=_[_0x73a8('0x28')](db[_0x73a8('0x51')][_0x73a8('0x77')]);_0x4879d3[_0x73a8('0x21')]=_[_0x73a8('0x28')](_0x4cc153['query']);_0x4879d3[_0x73a8('0x78')]=_[_0x73a8('0x79')](_0x4879d3[_0x73a8('0x76')],_0x4879d3[_0x73a8('0x21')]);_0x45ab45[_0x73a8('0x7b')]=_[_0x73a8('0x79')](_0x4879d3['model'],qs[_0x73a8('0x7a')](_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7a')]));_0x45ab45['attributes']=_0x45ab45[_0x73a8('0x7b')][_0x73a8('0x29')]?_0x45ab45['attributes']:_0x4879d3[_0x73a8('0x76')];if(!_0x4cc153[_0x73a8('0x21')][_0x73a8('0x35')](_0x73a8('0x80'))){_0x45ab45['limit']=qs[_0x73a8('0x14')](_0x4cc153[_0x73a8('0x21')]['limit']);_0x45ab45[_0x73a8('0x12')]=qs[_0x73a8('0x12')](_0x4cc153[_0x73a8('0x21')][_0x73a8('0x12')]);}_0x45ab45[_0x73a8('0x7c')]=qs['sort'](_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7d')]);_0x45ab45[_0x73a8('0x5c')]=qs[_0x73a8('0x78')](_[_0x73a8('0x99')](_0x4cc153[_0x73a8('0x21')],_0x4879d3[_0x73a8('0x78')]));_0x45ab45[_0x73a8('0x5c')][_0x73a8('0x9a')]=_0x42fefd['id'];if(_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7e')]){_0x45ab45[_0x73a8('0x5c')]=_['merge'](_0x45ab45[_0x73a8('0x5c')],{'$or':_[_0x73a8('0x6c')](_0x45ab45[_0x73a8('0x7b')],function(_0x19210c){var _0x100499={};_0x100499[_0x19210c]={'$like':'%'+_0x4cc153[_0x73a8('0x21')][_0x73a8('0x7e')]+'%'};return _0x100499;})});}_0x45ab45=_[_0x73a8('0x36')]({},_0x45ab45,_0x4cc153[_0x73a8('0x7f')]);return db['JscriptySessionReport'][_0x73a8('0x95')]({'where':_0x45ab45['where']})[_0x73a8('0x18')](function(_0x1cbc45){_0x4a43a0[_0x73a8('0x95')]=_0x1cbc45;if(_0x4cc153[_0x73a8('0x21')][_0x73a8('0x9b')]){_0x45ab45[_0x73a8('0x96')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0x73a8('0x20')](_0x45ab45);})[_0x73a8('0x18')](function(_0x3d0682){_0x4a43a0['rows']=_0x3d0682;return _0x4a43a0;});}})['then'](respondWithFilteredResult(_0x32bce9,_0x45ab45))[_0x73a8('0x23')](handleError(_0x32bce9,null));};exports[_0x73a8('0x9d')]=function(_0x3dd96d,_0x195253){try{if(!_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x5e')]){throw new Error(_0x73a8('0x9e'));}if(!_0x3dd96d['body'][_0x73a8('0x9f')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x3dd96d[_0x73a8('0x37')]['binding_values']){throw new Error(_0x73a8('0xa0'));}if(!_0x3dd96d['body']['socket_timestamp']){throw new Error(_0x73a8('0xa1'));}var _0x361eb7=_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x9f')][_0x73a8('0xa2')](',');var _0x3ed157=_0x3dd96d['body'][_0x73a8('0xa3')][_0x73a8('0xa2')](',');if(!_0x361eb7[_0x73a8('0x29')]||!_0x3ed157[_0x73a8('0x29')]||_0x361eb7[_0x73a8('0x29')]!==_0x3ed157[_0x73a8('0x29')]){throw new Error(_0x73a8('0xa4'));}_0x3dd96d['body'][_0x73a8('0x7a')]=_[_0x73a8('0xa5')](_0x361eb7,_0x3ed157);if(!_0x3dd96d[_0x73a8('0x37')]['fields']['phone']){throw new Error(_0x73a8('0xa6'));}if(!_0x3dd96d['body'][_0x73a8('0x7a')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}var _0x2d3e6c=path[_0x73a8('0x3b')](config[_0x73a8('0xa7')],_0x73a8('0xa8'),_0x3dd96d[_0x73a8('0xa9')]['filename']);fs[_0x73a8('0xaa')](_0x2d3e6c,parseInt(_0x73a8('0xab'),0x8));var _0x2b0e92=require(_0x73a8('0xac'))[_0x73a8('0xad')](path[_0x73a8('0x3b')](__dirname,_0x73a8('0xae')),[_0x2d3e6c,_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x9f')],_0x3dd96d['body'][_0x73a8('0xa3')],_0x3dd96d[_0x73a8('0x37')][_0x73a8('0x5e')],_0x3dd96d[_0x73a8('0x37')][_0x73a8('0xaf')],_0x3dd96d['body']['duplicates'],_0x3dd96d['body']['socket_timestamp']]);return _0x195253[_0x73a8('0x10')](0xc8)[_0x73a8('0x11')]({'message':'File\x20uploaded\x20correctly!','pid':_0x2b0e92[_0x73a8('0xb0')]});}catch(_0x1bae01){return _0x195253[_0x73a8('0x10')](0x1f4)[_0x73a8('0x1e')](_0x1bae01);}};exports['upload']=function(_0x333058,_0x27bb57){var _0x51eeee=fs[_0x73a8('0xb1')](_0x333058[_0x73a8('0xa9')]['path']);Papa[_0x73a8('0xb2')](_0x51eeee,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x244c4f){return _0x27bb57[_0x73a8('0x10')](0xc8)[_0x73a8('0x11')]({'file':_0x333058[_0x73a8('0xa9')],'fields':_0x244c4f[_0x73a8('0xb3')][_0x73a8('0x7a')]});}});};exports[_0x73a8('0xb4')]=function(_0xdfae1f,_0x50a603){return db[_0x73a8('0xb5')][_0x73a8('0x20')]({'raw':!![],'attributes':['id'],'where':{'role':_0x73a8('0xb6')}})[_0x73a8('0x18')](function(_0x1ce5a6){var _0x8bfcf0=![];if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0x5e')]){throw new Error(_0x73a8('0x9e'));}if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0xb7')][_0x73a8('0x73')]){throw new Error(_0x73a8('0xa6'));}if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0xb7')][_0x73a8('0xb8')]){throw new Error(_0x73a8('0xb9'));}if(!_0xdfae1f[_0x73a8('0x37')][_0x73a8('0xba')]){throw new Error(_0x73a8('0xa1'));}var _0x1c1312=require(_0x73a8('0xac'))[_0x73a8('0xad')](path[_0x73a8('0x3b')](__dirname,_0x73a8('0xbb')),[_0xdfae1f[_0x73a8('0x26')]['id'],JSON['stringify'](_0xdfae1f[_0x73a8('0x37')]),JSON[_0x73a8('0xbc')](_0x1ce5a6)]);_0x1c1312['on'](_0x73a8('0xbd'),function(){_0x8bfcf0=!![];return _0x50a603[_0x73a8('0x10')](0xc8)[_0x73a8('0x11')]({'message':_0x73a8('0xbe'),'pid':_0x1c1312[_0x73a8('0xb0')]});});_0x1c1312['on']('exit',function(_0x4b6dcf){if(_0x4b6dcf&&!_0x8bfcf0){return _0x50a603['status'](0x1f4)[_0x73a8('0x11')]({'message':_0x73a8('0xbf'),'pid':_0x1c1312[_0x73a8('0xb0')]});}});})[_0x73a8('0x23')](handleError(_0x50a603,null));};exports['importUpdates']=function(_0x2fcab3,_0x2e8bd2){return db[_0x73a8('0xb5')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x73a8('0xb6')}})[_0x73a8('0x18')](function(_0x42eeb4){var _0x350702=![];if(!_0x2fcab3['body']['ListId']){throw new Error('No\x20ListId\x20specified');}if(!_0x2fcab3[_0x73a8('0x37')][_0x73a8('0xb7')][_0x73a8('0x73')]){throw new Error(_0x73a8('0xa6'));}if(!_0x2fcab3['body'][_0x73a8('0xb7')][_0x73a8('0xb8')]){throw new Error(_0x73a8('0xb9'));}if(!_0x2fcab3[_0x73a8('0x37')][_0x73a8('0xba')]){throw new Error(_0x73a8('0xa1'));}var _0xa7b3dd=require(_0x73a8('0xac'))[_0x73a8('0xad')](path[_0x73a8('0x3b')](__dirname,'../../components/import/cm/csvUpdates'),[_0x2fcab3[_0x73a8('0x26')]['id'],JSON['stringify'](_0x2fcab3[_0x73a8('0x37')]),JSON[_0x73a8('0xbc')](_0x42eeb4)]);_0xa7b3dd['on'](_0x73a8('0xbd'),function(){_0x350702=!![];return _0x2e8bd2['status'](0xc8)[_0x73a8('0x11')]({'message':'start\x20child\x20process\x20correctly!','pid':_0xa7b3dd[_0x73a8('0xb0')]});});_0xa7b3dd['on'](_0x73a8('0xc0'),function(_0x5e2352){if(_0x5e2352&&!_0x350702){return _0x2e8bd2['status'](0x1f4)[_0x73a8('0x11')]({'message':_0x73a8('0xbf'),'pid':_0xa7b3dd[_0x73a8('0xb0')]});}});})[_0x73a8('0x23')](handleError(_0x2e8bd2,null));};exports[_0x73a8('0xc1')]=function(_0x31c3f2,_0x1e321b){var _0x3135b2=[_0x73a8('0xc2'),_0x73a8('0xc3'),_0x73a8('0xc4'),'openchannel',_0x73a8('0xc5'),'whatsapp','voice'];var _0x2c181d={'offset':0x0,'order':qs['sort']('-createdAt')},_0x2e54f7={'count':0x0,'rows':[]};Promise[_0x73a8('0xc6')]()[_0x73a8('0x18')](function(){if(_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xc7')]){if(!_[_0x73a8('0xc8')](_0x3135b2,_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xc7')][_0x73a8('0xc9')]())){throw new Error('Invalid\x20channel');}_0x3135b2=[_0x31c3f2[_0x73a8('0x21')]['channel'][_0x73a8('0xc9')]()];}if(_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xca')]){try{var _0x4f0c25=JSON[_0x73a8('0xb2')](_0x31c3f2[_0x73a8('0x21')][_0x73a8('0xca')]);if(!moment(_0x4f0c25[_0x73a8('0x3e')])[_0x73a8('0xcb')]()){throw new Error(_0x73a8('0xcc'));}if(!moment(_0x4f0c25['to'])[_0x73a8('0xcb')]()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x36cec6){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0x31c3f2[_0x73a8('0x21')]['hasOwnProperty']('nolimit')){_0x2c181d['limit']=qs[_0x73a8('0x14')](_0x31c3f2[_0x73a8('0x21')]['limit']||0xa);_0x2c181d[_0x73a8('0x12')]=qs['offset'](_0x31c3f2[_0x73a8('0x21')]['offset']);}var _0x139647=_0x3135b2[_0x73a8('0x6c')](function(_0x55502d){if(_0x55502d==='voice'){var _0x182daa={'attributes':['id','uniqueid','type','source',_0x73a8('0xcd'),'callerid',_0x73a8('0xce'),_0x73a8('0xcf'),_0x73a8('0xd0'),'note','createdAt',_0x73a8('0xd1'),_0x73a8('0xd2'),_0x73a8('0xd3'),_0x73a8('0xd4')],'where':{'ContactId':_0x31c3f2[_0x73a8('0x26')]['id']},'include':[{'model':db['User'],'as':_0x73a8('0xb5'),'attributes':['id',_0x73a8('0x1d'),_0x73a8('0xd5'),_0x73a8('0x30')]}],'order':[[_0x73a8('0xd6'),_0x73a8('0xd7')]]};if(_0x31c3f2['query'][_0x73a8('0xca')]){_0x182daa['where'][_0x73a8('0xd6')]={'$gte':_0x4f0c25[_0x73a8('0x3e')],'$lte':_0x4f0c25['to']};}return db[_0x73a8('0x4e')]['findAndCountAll'](_0x182daa)['then'](function(_0x2da42a){_0x2e54f7[_0x73a8('0x95')]+=_0x2da42a['count'];return _[_0x73a8('0x6c')](_0x2da42a[_0x73a8('0x97')],function(_0x5c09a9){var _0x2781f6=_0x5c09a9[_0x73a8('0x38')]({'plain':!![]});_0x2781f6[_0x73a8('0xc7')]=_0x55502d;if(_0x2781f6[_0x73a8('0xb5')]){_0x2781f6[_0x73a8('0xb5')]={'id':_0x2781f6[_0x73a8('0xb5')]['id'],'name':_0x2781f6[_0x73a8('0xb5')]['name'],'fullname':_0x2781f6[_0x73a8('0xb5')][_0x73a8('0xd5')],'alias':_0x2781f6[_0x73a8('0xb5')][_0x73a8('0x30')]};}return _0x2781f6;});});}else{var _0x527e79=_[_0x73a8('0xd8')](_0x55502d)+(_0x55502d==='chat'?_0x73a8('0xd9'):_0x73a8('0xda'));var _0x2659b8={'attributes':['id','closed',_0x73a8('0xdb'),_0x73a8('0xd6'),'note','disposition',_0x73a8('0xdc'),_0x73a8('0xdd'),_0x73a8('0xd4'),_0x527e79+'Id'],'where':{'ContactId':_0x31c3f2[_0x73a8('0x26')]['id']},'include':[{'model':db[_0x527e79],'as':'Account','attributes':['id',_0x73a8('0x1d'),_0x73a8('0xde')]},{'model':db[_0x73a8('0xb5')],'as':_0x73a8('0xdf'),'attributes':['id',_0x73a8('0x1d'),_0x73a8('0xd5')]},{'model':db['Tag'],'as':_0x73a8('0xe0'),'attributes':['id',_0x73a8('0x1d'),_0x73a8('0x62')],'through':{'attributes':[]}}],'order':[[_0x73a8('0xd6'),'DESC']]};if(_0x31c3f2[_0x73a8('0x21')]['range']){_0x2659b8[_0x73a8('0x5c')][_0x73a8('0xd6')]={'$gte':_0x4f0c25[_0x73a8('0x3e')],'$lte':_0x4f0c25['to']};}switch(_0x55502d){case _0x73a8('0xc3'):_0x2659b8['attributes'][_0x73a8('0x5f')](_0x73a8('0xe1'),'customerIp','customerPort',_0x73a8('0xe2'),'osName',_0x73a8('0xe3'),_0x73a8('0xe4'),_0x73a8('0xe5'),_0x73a8('0xe6'));break;case _0x73a8('0xc2'):_0x2659b8[_0x73a8('0x7b')][_0x73a8('0x5f')](_0x73a8('0xe7'),_0x73a8('0xe8'));break;case _0x73a8('0xe9'):_0x2659b8[_0x73a8('0x7b')][_0x73a8('0x5f')](_0x73a8('0xea'),_0x73a8('0xeb'));break;}return db[_[_0x73a8('0xd8')](_0x55502d)+_0x73a8('0xec')][_0x73a8('0xed')](_0x2659b8)['then'](function(_0x19bf0b){_0x2e54f7[_0x73a8('0x95')]+=_0x19bf0b[_0x73a8('0x95')];return _[_0x73a8('0x6c')](_0x19bf0b[_0x73a8('0x97')],function(_0x14c982){var _0x84623c=_0x14c982[_0x73a8('0x38')]({'plain':!![]});_0x84623c[_0x73a8('0xc7')]=_0x55502d;if(_0x84623c[_0x73a8('0xdf')]){_0x84623c[_0x73a8('0xdf')]={'id':_0x84623c['Owner']['id'],'name':_0x84623c[_0x73a8('0xdf')][_0x73a8('0x1d')],'fullname':_0x84623c['Owner'][_0x73a8('0xd5')]};}return _0x84623c;});});}});return Promise[_0x73a8('0x60')](_0x139647);})[_0x73a8('0x18')](function(_0x3ed1f8){return _(_0x3ed1f8)[_0x73a8('0xee')]()['sortBy'](_0x73a8('0xd6'))[_0x73a8('0xef')]()[_0x73a8('0xf0')]();})[_0x73a8('0x18')](function(_0x337691){_0x2e54f7[_0x73a8('0x97')]=_0x2c181d[_0x73a8('0x14')]?_0x337691[_0x73a8('0xf1')](_0x2c181d[_0x73a8('0x12')],_0x2c181d[_0x73a8('0x12')]+_0x2c181d[_0x73a8('0x14')]):_0x337691;return _0x2e54f7;})['then'](respondWithFilteredResult(_0x1e321b,_0x2c181d))[_0x73a8('0x23')](handleError(_0x1e321b,null));}; \ No newline at end of file +var _0x5dbe=['findAll','query','user','CmContact','find','catch','keys','length','startsWith','cf_','columnName','displayName','alias','type','values','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','body','from','get','mergeWith','isArray','tags','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','info','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','ChatOfflineMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','duplicates','where','$or','ListId','findOrCreate','push','contact','all','show','params','Tag','Tags','color','Phones','ItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','CmCustomField','pickBy','isEmpty','table','setFields','id\x20=\x20?','toParam','text','findOne','model','filters','intersection','fields','attributes','order','sort','pick','merge','filter','options','getTags','hasOwnProperty','setTags','ContactItemType','items','item_types','ItemTypeId','description','phone','OrderBy','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','bulkCreate','rescheduleAdditionalPhones','rawAttributes','nolimit','includeAll','include','rows','getHopperHistories','ContactId','getHopperFinals','CmHopperFinal','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','No\x20association\x20values\x20specified!','split','binding_values','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','join','root','server/files/tmp','file','filename','chmodSync','0777','child_process','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','createReadStream','meta','import','agent','binding','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','exit','error\x20child\x20process','importUpdates','User','fork','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','DESC','findAndCountAll','startCase','Website','Account','closed','disposition','secondDisposition','UserId','key','Owner','browserName','customerIp','deviceModel','osName','ratingType','ratingValue','subject','substatus','threadId','Interaction','flatten','sortBy','value','slice','moment','bluebird','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','../../config/environment','redis','localhost','socket.io-emitter','register','json','offset','undefined','count','limit','status','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','describe'];(function(_0xb24a3e,_0x4a3594){var _0x4038d7=function(_0x1ea3c3){while(--_0x1ea3c3){_0xb24a3e['push'](_0xb24a3e['shift']());}};_0x4038d7(++_0x4a3594);}(_0x5dbe,0xe1));var _0xe5db=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0x5dbe[_0x337651];return _0x20893c;};'use strict';var moment=require(_0xe5db('0x0'));var BPromise=require(_0xe5db('0x1'));var util=require('util');var path=require(_0xe5db('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe5db('0x3'));var Papa=require(_0xe5db('0x4'));var Redis=require(_0xe5db('0x5'));var contacts=require(_0xe5db('0x6'));var qs=require(_0xe5db('0x7'));var logger=require(_0xe5db('0x8'))('api');var config=require(_0xe5db('0x9'));var shared=require('../../config/environment/shared');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xe5db('0xa')],{'host':_0xe5db('0xb'),'port':0x18eb});var socket=require(_0xe5db('0xc'))(new Redis(config[_0xe5db('0xa')]));require('./cmContact.socket')[_0xe5db('0xd')](socket);function respondWithResult(_0xe4d3cc,_0x3ef830){_0x3ef830=_0x3ef830||0xc8;return function(_0x43a032){if(_0x43a032){return _0xe4d3cc['status'](_0x3ef830)[_0xe5db('0xe')](_0x43a032);}};}function respondWithFilteredResult(_0x1c962a,_0x638866){return function(_0x1b68b6){if(_0x1b68b6){var _0x6fa943=typeof _0x638866[_0xe5db('0xf')]==='undefined'&&typeof _0x638866['limit']===_0xe5db('0x10');var _0x49dea2=_0x1b68b6[_0xe5db('0x11')];var _0x2fe0d5=_0x6fa943?0x0:_0x638866[_0xe5db('0xf')];var _0x1dec25=_0x6fa943?_0x1b68b6['count']:_0x638866['offset']+_0x638866[_0xe5db('0x12')];var _0x3a605b;if(_0x1dec25>=_0x49dea2){_0x1dec25=_0x49dea2;_0x3a605b=0xc8;}else{_0x3a605b=0xce;}_0x1c962a[_0xe5db('0x13')](_0x3a605b);return _0x1c962a[_0xe5db('0x14')](_0xe5db('0x15'),_0x2fe0d5+'-'+_0x1dec25+'/'+_0x49dea2)['json'](_0x1b68b6);}return null;};}function saveUpdates(_0x46d2d5){return function(_0x14adff){if(_0x14adff){return _0x14adff[_0xe5db('0x16')](_0x46d2d5)['then'](function(_0x29b029){return _0x29b029;});}return null;};}function removeEntity(_0x3777a4){return function(_0x1b5e06){if(_0x1b5e06){return _0x1b5e06[_0xe5db('0x17')]()[_0xe5db('0x18')](function(){_0x3777a4['status'](0xcc)[_0xe5db('0x19')]();});}};}function handleEntityNotFound(_0x4b455a){return function(_0x113d25){if(!_0x113d25){_0x4b455a[_0xe5db('0x1a')](0x194);}return _0x113d25;};}function handleError(_0x4d4907,_0xd0cf0a){_0xd0cf0a=_0xd0cf0a||0x1f4;return function(_0x58a33d){logger[_0xe5db('0x1b')](_0x58a33d[_0xe5db('0x1c')]);if(_0x58a33d[_0xe5db('0x1d')]){delete _0x58a33d[_0xe5db('0x1d')];}_0x4d4907[_0xe5db('0x13')](_0xd0cf0a)[_0xe5db('0x1e')](_0x58a33d);};}exports[_0xe5db('0x1f')]=function(_0x2c16f8,_0x46252c){var _0x245860={};return contacts[_0xe5db('0x20')]()[_0xe5db('0x18')](function(_0x55a486){_0x245860=qs['getOptions'](_0x55a486,_0x2c16f8);return contacts[_0xe5db('0x21')](_0x2c16f8[_0xe5db('0x22')],_0x2c16f8[_0xe5db('0x23')],_0x245860,_0x55a486);})[_0xe5db('0x18')](respondWithFilteredResult(_0x46252c,_0x245860))['catch'](handleError(_0x46252c,null));};exports[_0xe5db('0x17')]=function(_0x3d0422,_0x51804f){return db[_0xe5db('0x24')][_0xe5db('0x25')]({'where':{'id':_0x3d0422['params']['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x51804f,null))['then'](removeEntity(_0x51804f,null))[_0xe5db('0x26')](handleError(_0x51804f,null));};exports['describe']=function(_0x348980,_0x510b48){return db['CmContact'][_0xe5db('0x20')]()[_0xe5db('0x18')](function(_0x25013c){delete _0x25013c['tags'];for(var _0x4efbe0=0x0;_0x4efbe00x0){return new Promise(function(_0x5b8cba){var _0x4f7df9=[];for(var _0xe8b1db=0x0;_0xe8b1db<_0x2b2c94['length'];_0xe8b1db++){_0x4f7df9[_0xe5db('0x5d')](insertAdditionalPhones(_0x2b2c94[_0xe8b1db][_0xe5db('0x5e')],_0x2b2c94[_0xe8b1db][_0xe5db('0x57')]));}Promise[_0xe5db('0x5f')](_0x4f7df9)[_0xe5db('0x18')](function(){_0x5b8cba(0x1);});})['then'](function(){return{'success':_0x57d4fb,'failure':_0x5aeb68,'duplicates':_0x3a9953};});}else{return{'success':_0x57d4fb,'failure':_0x5aeb68,'duplicates':_0x3a9953};}}})['then'](respondWithResult(_0x141220,0xc9))[_0xe5db('0x26')](handleError(_0x141220,null));};exports[_0xe5db('0x60')]=function(_0x480c3a,_0xc6964a){var _0x3fdf0f;return db[_0xe5db('0x24')][_0xe5db('0x20')]()[_0xe5db('0x18')](function(_0x101efc){return db[_0xe5db('0x24')][_0xe5db('0x25')]({'where':{'id':_0x480c3a[_0xe5db('0x61')]['id']},'include':[{'model':db[_0xe5db('0x62')],'as':_0xe5db('0x63'),'attributes':['id','name',_0xe5db('0x64')],'required':_0x480c3a[_0xe5db('0x22')]['tag']?!![]:![]},{'model':db[_0xe5db('0x46')],'as':_0xe5db('0x65'),'where':{'CmContactId':_0x480c3a['params']['id']},'required':![],'include':[{'model':db['ContactItemType'],'as':_0xe5db('0x66')}]}],'order':[db[_0xe5db('0x67')][_0xe5db('0x68')](_0xe5db('0x69'))],'attributes':_[_0xe5db('0x27')](_0x101efc)});})[_0xe5db('0x18')](function(_0x14842f){if(!_[_0xe5db('0x53')](_0x14842f)){_0x3fdf0f=_0x14842f[_0xe5db('0x34')]({'plain':!![]});var _0x28924a={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x14842f&&_0x14842f[_0xe5db('0x5b')]){if(_0x14842f[_0xe5db('0x5b')]){_0x28924a[_0xe5db('0x59')][_0xe5db('0x6a')][_0xe5db('0x5d')]({'ListId':{'$ne':_0x14842f[_0xe5db('0x5b')]}});}}return db['CmCustomField']['findAll'](_0x28924a);}})['then'](function(_0x1c6fcd){if(!_[_0xe5db('0x53')](_0x1c6fcd)){return _[_0xe5db('0x6b')](_0x3fdf0f,_[_0xe5db('0x6c')](_0x1c6fcd,function(_0x529473){return util[_0xe5db('0x6d')](_0xe5db('0x6e'),_0x529473['id']);}));}})[_0xe5db('0x18')](handleEntityNotFound(_0xc6964a,null))['then'](respondWithResult(_0xc6964a,null))[_0xe5db('0x26')](handleError(_0xc6964a,null));};exports[_0xe5db('0x16')]=function(_0x1a7e56,_0x23b68c){var _0x551af5;if(_0x1a7e56['body']['id']){delete _0x1a7e56['body']['id'];}if(!_['isNil'](_0x1a7e56[_0xe5db('0x32')][_0xe5db('0x54')])){var _0x4bfece=_0x1a7e56[_0xe5db('0x32')][_0xe5db('0x54')];if(!_[_0xe5db('0x53')](shared[_0xe5db('0x55')][_0x4bfece]))_0x1a7e56['body']['utcOffset']=shared[_0xe5db('0x55')][_0x4bfece][_0xe5db('0x56')];}return db[_0xe5db('0x24')][_0xe5db('0x25')]({'where':{'id':_0x1a7e56['params']['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x23b68c,null))[_0xe5db('0x18')](saveUpdates(_0x1a7e56[_0xe5db('0x32')],null))[_0xe5db('0x18')](function(_0x49c45f){_0x551af5=_0x49c45f;var _0x551b13={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x49c45f&&_0x49c45f['ListId']){if(_0x49c45f[_0xe5db('0x5b')]){_0x551b13[_0xe5db('0x59')][_0xe5db('0x6a')][_0xe5db('0x5d')]({'ListId':{'$ne':_0x49c45f[_0xe5db('0x5b')]}});}}return db[_0xe5db('0x6f')][_0xe5db('0x21')](_0x551b13);})[_0xe5db('0x18')](function(_0xd6128){if(_0xd6128){return _[_0xe5db('0x6b')](_[_0xe5db('0x70')](_0x1a7e56['body'],function(_0x58aba4,_0x3d1820){return _[_0xe5db('0x29')](_0x3d1820,_0xe5db('0x2a'));}),_[_0xe5db('0x6c')](_0xd6128,function(_0x83a341){return util[_0xe5db('0x6d')](_0xe5db('0x6e'),_0x83a341['id']);}));}})['then'](function(_0x5336b9){if(_0x5336b9&&!_[_0xe5db('0x71')](_0x5336b9)){var _0x3d007e=squel[_0xe5db('0x16')]()[_0xe5db('0x72')]('cm_contacts')[_0xe5db('0x73')](_0x5336b9)[_0xe5db('0x59')](_0xe5db('0x74'),_0x1a7e56['params']['id'])[_0xe5db('0x75')]();return db[_0xe5db('0x67')]['query'](_0x3d007e[_0xe5db('0x76')],{'replacements':_0x3d007e[_0xe5db('0x2f')]});}})[_0xe5db('0x18')](function(){if(_0x1a7e56[_0xe5db('0x32')]['phone']&&_0x551af5){return db[_0xe5db('0x39')][_0xe5db('0x16')]({'phone':_0x1a7e56[_0xe5db('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x551af5['id']}});}})['then'](function(){return _0x551af5;})[_0xe5db('0x18')](respondWithResult(_0x23b68c,null))['catch'](handleError(_0x23b68c,null));};exports['getTags']=function(_0x36a47a,_0x1c6058){var _0x5754e8={};var _0x42eaaa={};var _0xc1a49b;var _0x5a4606;return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x36a47a[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x1c6058,null))[_0xe5db('0x18')](function(_0x215932){if(_0x215932){_0xc1a49b=_0x215932;_0x42eaaa[_0xe5db('0x78')]=_[_0xe5db('0x27')](db[_0xe5db('0x62')]['rawAttributes']);_0x42eaaa[_0xe5db('0x22')]=_[_0xe5db('0x27')](_0x36a47a['query']);_0x42eaaa[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x42eaaa[_0xe5db('0x78')],_0x42eaaa[_0xe5db('0x22')]);_0x5754e8['attributes']=_[_0xe5db('0x7a')](_0x42eaaa[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x5754e8['attributes']=_0x5754e8[_0xe5db('0x7c')][_0xe5db('0x28')]?_0x5754e8[_0xe5db('0x7c')]:_0x42eaaa[_0xe5db('0x78')];_0x5754e8[_0xe5db('0x7d')]=qs[_0xe5db('0x7e')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0x7e')]);_0x5754e8[_0xe5db('0x59')]=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x36a47a[_0xe5db('0x22')],_0x42eaaa[_0xe5db('0x79')]));if(_0x36a47a[_0xe5db('0x22')]['filter']){_0x5754e8[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x5754e8[_0xe5db('0x59')],{'$or':_['map'](_0x5754e8['attributes'],function(_0x4db90b){var _0x2dfada={};_0x2dfada[_0x4db90b]={'$like':'%'+_0x36a47a['query'][_0xe5db('0x81')]+'%'};return _0x2dfada;})});}_0x5754e8=_['merge']({},_0x5754e8,_0x36a47a[_0xe5db('0x82')]);return _0xc1a49b[_0xe5db('0x83')](_0x5754e8);}})[_0xe5db('0x18')](function(_0x3f054b){if(_0x3f054b){_0x5a4606=_0x3f054b[_0xe5db('0x28')];if(!_0x36a47a[_0xe5db('0x22')][_0xe5db('0x84')]('nolimit')){_0x5754e8[_0xe5db('0x12')]=qs[_0xe5db('0x12')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0x12')]);_0x5754e8[_0xe5db('0xf')]=qs[_0xe5db('0xf')](_0x36a47a[_0xe5db('0x22')][_0xe5db('0xf')]);}return _0xc1a49b[_0xe5db('0x83')](_0x5754e8);}})[_0xe5db('0x18')](function(_0x5c030d){if(_0x5c030d){return _0x5c030d?{'count':_0x5a4606,'rows':_0x5c030d}:null;}})[_0xe5db('0x18')](respondWithResult(_0x1c6058,null))[_0xe5db('0x26')](handleError(_0x1c6058,null));};exports[_0xe5db('0x85')]=function(_0x213625,_0x3891de){if(_0x213625[_0xe5db('0x32')]['id']){delete _0x213625[_0xe5db('0x32')]['id'];}return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x213625['params']['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x3891de,null))[_0xe5db('0x18')](function(_0x8c1985){if(_0x8c1985){return _0x8c1985[_0xe5db('0x85')](_0x213625[_0xe5db('0x32')]['ids']||[]);}return null;})['then'](respondWithResult(_0x3891de,null))[_0xe5db('0x26')](handleError(_0x3891de,null));};exports['setAdditionalPhones']=function(_0x4fc67,_0x18398c){var _0x26d260=[];_0x26d260['push'](addAdditionalPhones(_0x4fc67[_0xe5db('0x32')]));Promise[_0xe5db('0x5f')](_0x26d260)[_0xe5db('0x18')](function(){_0x26d260=[];_0x26d260[_0xe5db('0x5d')](deleteCmHopperPhones(_0x4fc67['body']['id']));_0x26d260[_0xe5db('0x5d')](addCmHopperPhones(_0x4fc67[_0xe5db('0x32')]['id']));Promise['all'](_0x26d260)[_0xe5db('0x18')](function(){return[0x1];})[_0xe5db('0x18')](respondWithResult(_0x18398c,null));});};function addAdditionalPhones(_0x54b5ff){var _0x2b75db;return new Promise(function(_0x457715){return db[_0xe5db('0x46')][_0xe5db('0x17')]({'where':{'CmContactId':_0x54b5ff['id']}})['then'](function(){db[_0xe5db('0x86')]['findAll']({'raw':!![],'attributes':['id','OrderBy']})['then'](function(_0x155756){var _0xfeeeb2=[];for(var _0x3cfe20=0x0;_0x3cfe20<_0x54b5ff[_0xe5db('0x87')][_0xe5db('0x28')];_0x3cfe20++){var _0x2a82a5=_0x54b5ff[_0xe5db('0x88')]?_[_0xe5db('0x53')](_0x54b5ff['item_types'][_0x3cfe20])?'':_0x54b5ff[_0xe5db('0x88')][_0x3cfe20]:_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x89')]?_0x54b5ff[_0xe5db('0x87')][_0x3cfe20]['ItemTypeId']:'';var _0x942ff6=_[_0xe5db('0x53')](_0x54b5ff[_0xe5db('0x87')][_0x3cfe20]['description'])?'':_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x8a')];var _0x62c7e3=_0x2a82a5+':'+_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x8b')]+'§'+_0x942ff6;if(_[_0xe5db('0x53')](_0x2b75db))_0x2b75db=_0x62c7e3;else _0x2b75db+=';'+_0x62c7e3;var _0x327f2f=null;var _0x7f7fd6=null;if(_0x54b5ff[_0xe5db('0x88')]){if(!_[_0xe5db('0x53')](_0x54b5ff[_0xe5db('0x88')][_0x3cfe20])){_0x7f7fd6=_[_0xe5db('0x25')](_0x155756,function(_0x2a2d20){return _0x2a2d20['id']===_0x54b5ff[_0xe5db('0x88')][_0x3cfe20];});if(!_['isNil'](_0x7f7fd6)){_0x327f2f=_0x7f7fd6[_0xe5db('0x8c')];}}}else{if(!_[_0xe5db('0x53')](_0x54b5ff[_0xe5db('0x87')][_0x3cfe20])){_0x7f7fd6=_[_0xe5db('0x25')](_0x155756,function(_0x3af72f){return _0x3af72f['id']===_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x89')];});if(!_[_0xe5db('0x53')](_0x7f7fd6)){_0x327f2f=_0x3cfe20;}}}if(_['isNil'](_0x327f2f)){_0x327f2f=0x64;}_0xfeeeb2[_0xe5db('0x5d')](addAdditionalPhone(_0x54b5ff['id'],_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x8b')],_0x54b5ff[_0xe5db('0x88')]?_[_0xe5db('0x53')](_0x54b5ff['item_types'][_0x3cfe20])?null:_0x54b5ff[_0xe5db('0x88')][_0x3cfe20]:_0x54b5ff[_0xe5db('0x87')][_0x3cfe20][_0xe5db('0x89')]?_0x54b5ff[_0xe5db('0x87')][_0x3cfe20]['ItemTypeId']:null,_0x327f2f,_0x942ff6));}Promise['all'](_0xfeeeb2)[_0xe5db('0x18')](function(){db['CmContact'][_0xe5db('0x16')]({'AdditionalPhones':_0x2b75db},{'where':{'id':_0x54b5ff['id']}})[_0xe5db('0x18')](function(){_0x457715(0x1);});});});});});}function addAdditionalPhone(_0x2f404e,_0x115a0f,_0x2ca7e9,_0x151a41,_0x374337){return db[_0xe5db('0x46')][_0xe5db('0x25')]({'where':{'CmContactId':_0x2f404e,'item':_0x115a0f}})[_0xe5db('0x18')](function(_0x395ca2){if(_0x395ca2)logger[_0xe5db('0x3c')](_0xe5db('0x8d'),_0x395ca2);else{db[_0xe5db('0x46')][_0xe5db('0x3e')]({'CmContactId':_0x2f404e,'item':_0x115a0f,'ItemTypeId':_0x2ca7e9,'OrderBy':_0x151a41,'ItemClass':_0xe5db('0x8e'),'description':_0x374337});}});}function deleteCmHopperPhones(_0x5bb7cd){return new Promise(function(_0xaf9693){return db['CmHopper'][_0xe5db('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x5bb7cd}})[_0xe5db('0x18')](function(_0x39645a){db[_0xe5db('0x8f')][_0xe5db('0x17')]({'where':{'CmHopperId':{'$in':_[_0xe5db('0x6c')](_0x39645a,'id')}}});})[_0xe5db('0x18')](function(){_0xaf9693(0x1);});});}function addCmHopperPhones(_0x45edb8){return new Promise(function(_0xb0cb20){return db[_0xe5db('0x39')][_0xe5db('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x45edb8}})[_0xe5db('0x18')](function(_0x50f10b){var _0x1650de=[];_['map'](_0x50f10b,function(_0x76cefb){_0x1650de[_0xe5db('0x5d')](createCmHopperPhone(_0x45edb8,_0x76cefb['id']));});Promise[_0xe5db('0x5f')](_0x1650de)[_0xe5db('0x18')](function(){_0xb0cb20(0x1);});});});}function createCmHopperPhone(_0x568351,_0x4e0c0c){return new Promise(function(_0x5b8698){db[_0xe5db('0x46')]['findAll']({'raw':!![],'attributes':['item',_0xe5db('0x8c')],'where':{'CmContactId':_0x568351,'ItemClass':_0xe5db('0x8e')},'include':[{'model':db[_0xe5db('0x86')],'attributes':['OrderBy'],'as':_0xe5db('0x66')}],'order':[_0xe5db('0x8c'),db[_0xe5db('0x67')]['literal']('`ItemType`.OrderBy')]})['then'](function(_0x3d838b){var _0x2ee31b=0x1;var _0x25dc51=_[_0xe5db('0x6c')](_0x3d838b,function(_0x3d7156){_0x3d7156['CmHopperId']=_0x4e0c0c;_0x3d7156[_0xe5db('0x8b')]=_0x3d7156[_0xe5db('0x90')];_0x3d7156[_0xe5db('0x8c')]=_0x2ee31b;delete _0x3d7156['ItemType.OrderBy'];_0x2ee31b=_0x2ee31b+0x1;return _0x3d7156;});return db[_0xe5db('0x8f')]['bulkCreate'](_0x25dc51,{});})[_0xe5db('0x18')](function(){_0x5b8698(0x1);});});}function insertAdditionalPhones(_0x18135d,_0x4b0970){return new Promise(function(_0x3fda2e){var _0x3cf948=[];for(var _0x18abdf=0x0;_0x18abdf<_0x4b0970[_0xe5db('0x28')];_0x18abdf++){var _0x4d2c96=_0x4b0970[_0x18abdf];_0x3cf948[_0xe5db('0x5d')](parseContactItemType(_0x4d2c96));}Promise[_0xe5db('0x5f')](_0x3cf948)['then'](function(){var _0x50e049={'id':_0x18135d['id'],'items':_0x4b0970};return addAdditionalPhones(_0x50e049)['then'](function(){return addCmHopperPhones(_0x18135d['id']);});})[_0xe5db('0x18')](function(){_0x3fda2e(_0x18135d);});});}function parseContactItemType(_0x58d224){return new Promise(function(_0x2030c0){if(_0x58d224[_0xe5db('0x84')]('ItemTypeId')){_0x2030c0(_0x58d224);}else{return db[_0xe5db('0x86')][_0xe5db('0x25')]({'where':{'name':_0x58d224['ItemType']}})[_0xe5db('0x18')](function(_0x446bbd){if(_[_0xe5db('0x53')](_0x446bbd))_0x58d224[_0xe5db('0x89')]=null;else _0x58d224[_0xe5db('0x89')]=_0x446bbd['id'];_0x2030c0(_0x58d224);});}});}exports[_0xe5db('0x91')]=function(_0x3d4b62,_0x1420a7){return db[_0xe5db('0x46')][_0xe5db('0x21')]({'raw':!![],'where':{'CmContactId':_0x3d4b62[_0xe5db('0x61')]['id'],'ItemClass':_0xe5db('0x8e')},'include':[{'model':db[_0xe5db('0x86')],'as':_0xe5db('0x66')}],'order':[[_0xe5db('0x8c')],[db['sequelize']['literal'](_0xe5db('0x92'))]]})[_0xe5db('0x18')](function(_0x465596){return _0x465596;})[_0xe5db('0x18')](respondWithResult(_0x1420a7,null))[_0xe5db('0x26')](handleError(_0x1420a7,null));};exports[_0xe5db('0x93')]=function(_0x23ce32,_0xd194fe){return db[_0xe5db('0x46')][_0xe5db('0x21')]({'raw':!![],'where':{'CmContactId':_0x23ce32['body'][_0xe5db('0x94')]}})['then'](function(_0x19138f){var _0x569ac5=_[_0xe5db('0x6c')](_0x19138f,function(_0x27bdbc){_0x27bdbc[_0xe5db('0x95')]=_0x23ce32['body'][_0xe5db('0x96')];return _0x27bdbc;});return db[_0xe5db('0x46')][_0xe5db('0x97')](_0x569ac5,{});})[_0xe5db('0x18')](function(){return addCmHopperPhones(_0x23ce32[_0xe5db('0x32')][_0xe5db('0x96')]);})['then'](function(){return['ok'];})[_0xe5db('0x18')](respondWithResult(_0xd194fe,null))[_0xe5db('0x26')](handleError(_0xd194fe,null));};exports[_0xe5db('0x98')]=function(_0x5c6ca4,_0x595484){var _0x2085fe=[];_0x2085fe[_0xe5db('0x5d')](createCmHopperPhone(_0x5c6ca4[_0xe5db('0x32')]['id'],_0x5c6ca4['body']['hopperId']));Promise['all'](_0x2085fe)['then'](function(){return[0x1];})['then'](respondWithResult(_0x595484,null));};exports['getHoppers']=function(_0x1549ef,_0x2a3094){var _0x1c2e2c={'raw':![],'where':{}};var _0x4bfa0c={};var _0x3b3332={'count':0x0,'rows':[]};return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x1549ef[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x2a3094,null))[_0xe5db('0x18')](function(_0x2804d8){if(_0x2804d8){_0x4bfa0c['model']=_['keys'](db['CmHopper'][_0xe5db('0x99')]);_0x4bfa0c['query']=_['keys'](_0x1549ef[_0xe5db('0x22')]);_0x4bfa0c[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x4bfa0c[_0xe5db('0x78')],_0x4bfa0c[_0xe5db('0x22')]);_0x1c2e2c['attributes']=_[_0xe5db('0x7a')](_0x4bfa0c[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x1549ef[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x1c2e2c[_0xe5db('0x7c')]=_0x1c2e2c[_0xe5db('0x7c')][_0xe5db('0x28')]?_0x1c2e2c['attributes']:_0x4bfa0c[_0xe5db('0x78')];if(!_0x1549ef['query'][_0xe5db('0x84')](_0xe5db('0x9a'))){_0x1c2e2c[_0xe5db('0x12')]=qs[_0xe5db('0x12')](_0x1549ef[_0xe5db('0x22')]['limit']);_0x1c2e2c[_0xe5db('0xf')]=qs['offset'](_0x1549ef['query'][_0xe5db('0xf')]);}_0x1c2e2c[_0xe5db('0x7d')]=qs['sort'](_0x1549ef[_0xe5db('0x22')][_0xe5db('0x7e')]);_0x1c2e2c[_0xe5db('0x59')]=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x1549ef[_0xe5db('0x22')],_0x4bfa0c['filters']));_0x1c2e2c[_0xe5db('0x59')]['ContactId']=_0x2804d8['id'];if(_0x1549ef[_0xe5db('0x22')][_0xe5db('0x81')]){_0x1c2e2c[_0xe5db('0x59')]=_['merge'](_0x1c2e2c['where'],{'$or':_[_0xe5db('0x6c')](_0x1c2e2c[_0xe5db('0x7c')],function(_0x26357b){var _0x2a8bde={};_0x2a8bde[_0x26357b]={'$like':'%'+_0x1549ef[_0xe5db('0x22')][_0xe5db('0x81')]+'%'};return _0x2a8bde;})});}_0x1c2e2c=_[_0xe5db('0x80')]({},_0x1c2e2c,_0x1549ef['options']);return db[_0xe5db('0x39')][_0xe5db('0x11')]({'where':_0x1c2e2c['where']})[_0xe5db('0x18')](function(_0x137204){_0x3b3332[_0xe5db('0x11')]=_0x137204;if(_0x1549ef[_0xe5db('0x22')][_0xe5db('0x9b')]){_0x1c2e2c[_0xe5db('0x9c')]=[{'all':!![]}];}return db[_0xe5db('0x39')][_0xe5db('0x21')](_0x1c2e2c);})['then'](function(_0x181a0b){_0x3b3332[_0xe5db('0x9d')]=_0x181a0b;return _0x3b3332;});}})[_0xe5db('0x18')](respondWithFilteredResult(_0x2a3094,_0x1c2e2c))[_0xe5db('0x26')](handleError(_0x2a3094,null));};exports[_0xe5db('0x9e')]=function(_0x4d39e6,_0x5ae83e){var _0x49c1db={'raw':!![],'where':{}};var _0x549890={};var _0x54a850={'count':0x0,'rows':[]};return db['CmContact'][_0xe5db('0x77')]({'where':{'id':_0x4d39e6['params']['id']}})['then'](handleEntityNotFound(_0x5ae83e,null))[_0xe5db('0x18')](function(_0x23ef7f){if(_0x23ef7f){_0x549890[_0xe5db('0x78')]=_[_0xe5db('0x27')](db['CmHopperHistory'][_0xe5db('0x99')]);_0x549890[_0xe5db('0x22')]=_[_0xe5db('0x27')](_0x4d39e6[_0xe5db('0x22')]);_0x549890[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x549890[_0xe5db('0x78')],_0x549890[_0xe5db('0x22')]);_0x49c1db['attributes']=_['intersection'](_0x549890[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x49c1db[_0xe5db('0x7c')]=_0x49c1db['attributes']['length']?_0x49c1db[_0xe5db('0x7c')]:_0x549890['model'];if(!_0x4d39e6[_0xe5db('0x22')]['hasOwnProperty'](_0xe5db('0x9a'))){_0x49c1db['limit']=qs['limit'](_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x12')]);_0x49c1db[_0xe5db('0xf')]=qs[_0xe5db('0xf')](_0x4d39e6[_0xe5db('0x22')][_0xe5db('0xf')]);}_0x49c1db[_0xe5db('0x7d')]=qs[_0xe5db('0x7e')](_0x4d39e6['query'][_0xe5db('0x7e')]);_0x49c1db['where']=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x4d39e6[_0xe5db('0x22')],_0x549890[_0xe5db('0x79')]));_0x49c1db[_0xe5db('0x59')][_0xe5db('0x9f')]=_0x23ef7f['id'];if(_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x81')]){_0x49c1db[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x49c1db[_0xe5db('0x59')],{'$or':_[_0xe5db('0x6c')](_0x49c1db[_0xe5db('0x7c')],function(_0x1580a9){var _0x430243={};_0x430243[_0x1580a9]={'$like':'%'+_0x4d39e6[_0xe5db('0x22')][_0xe5db('0x81')]+'%'};return _0x430243;})});}_0x49c1db=_[_0xe5db('0x80')]({},_0x49c1db,_0x4d39e6['options']);return db[_0xe5db('0x47')][_0xe5db('0x11')]({'where':_0x49c1db['where']})[_0xe5db('0x18')](function(_0x39468f){_0x54a850[_0xe5db('0x11')]=_0x39468f;if(_0x4d39e6[_0xe5db('0x22')]['includeAll']){_0x49c1db[_0xe5db('0x9c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xe5db('0x21')](_0x49c1db);})[_0xe5db('0x18')](function(_0x1db7ca){_0x54a850['rows']=_0x1db7ca;return _0x54a850;});}})['then'](respondWithFilteredResult(_0x5ae83e,_0x49c1db))['catch'](handleError(_0x5ae83e,null));};exports[_0xe5db('0xa0')]=function(_0x584a9e,_0x3bb675){var _0x4dd699={'raw':!![],'where':{}};var _0x35a14a={};var _0x379e84={'count':0x0,'rows':[]};return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x584a9e[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x3bb675,null))[_0xe5db('0x18')](function(_0x574c8a){if(_0x574c8a){_0x35a14a[_0xe5db('0x78')]=_[_0xe5db('0x27')](db[_0xe5db('0xa1')][_0xe5db('0x99')]);_0x35a14a[_0xe5db('0x22')]=_['keys'](_0x584a9e['query']);_0x35a14a['filters']=_[_0xe5db('0x7a')](_0x35a14a[_0xe5db('0x78')],_0x35a14a[_0xe5db('0x22')]);_0x4dd699[_0xe5db('0x7c')]=_['intersection'](_0x35a14a[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x584a9e['query'][_0xe5db('0x7b')]));_0x4dd699[_0xe5db('0x7c')]=_0x4dd699[_0xe5db('0x7c')][_0xe5db('0x28')]?_0x4dd699[_0xe5db('0x7c')]:_0x35a14a[_0xe5db('0x78')];if(!_0x584a9e['query'][_0xe5db('0x84')](_0xe5db('0x9a'))){_0x4dd699['limit']=qs[_0xe5db('0x12')](_0x584a9e[_0xe5db('0x22')][_0xe5db('0x12')]);_0x4dd699[_0xe5db('0xf')]=qs['offset'](_0x584a9e[_0xe5db('0x22')][_0xe5db('0xf')]);}_0x4dd699[_0xe5db('0x7d')]=qs['sort'](_0x584a9e[_0xe5db('0x22')][_0xe5db('0x7e')]);_0x4dd699[_0xe5db('0x59')]=qs[_0xe5db('0x79')](_[_0xe5db('0x7f')](_0x584a9e['query'],_0x35a14a['filters']));_0x4dd699[_0xe5db('0x59')]['ContactId']=_0x574c8a['id'];if(_0x584a9e['query']['filter']){_0x4dd699[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x4dd699['where'],{'$or':_[_0xe5db('0x6c')](_0x4dd699[_0xe5db('0x7c')],function(_0x533144){var _0x1449b8={};_0x1449b8[_0x533144]={'$like':'%'+_0x584a9e['query'][_0xe5db('0x81')]+'%'};return _0x1449b8;})});}_0x4dd699=_[_0xe5db('0x80')]({},_0x4dd699,_0x584a9e[_0xe5db('0x82')]);return db['CmHopperFinal'][_0xe5db('0x11')]({'where':_0x4dd699[_0xe5db('0x59')]})[_0xe5db('0x18')](function(_0x367708){_0x379e84[_0xe5db('0x11')]=_0x367708;if(_0x584a9e[_0xe5db('0x22')]['includeAll']){_0x4dd699[_0xe5db('0x9c')]=[{'all':!![]}];}return db[_0xe5db('0xa1')]['findAll'](_0x4dd699);})['then'](function(_0xc9d963){_0x379e84[_0xe5db('0x9d')]=_0xc9d963;return _0x379e84;});}})['then'](respondWithFilteredResult(_0x3bb675,_0x4dd699))[_0xe5db('0x26')](handleError(_0x3bb675,null));};exports[_0xe5db('0xa2')]=function(_0x340fef,_0x4a81e8){var _0x4a3b1f={'raw':!![],'where':{}};var _0x8df847={};var _0x19d457={'count':0x0,'rows':[]};return db[_0xe5db('0x24')][_0xe5db('0x77')]({'where':{'id':_0x340fef[_0xe5db('0x61')]['id']}})[_0xe5db('0x18')](handleEntityNotFound(_0x4a81e8,null))[_0xe5db('0x18')](function(_0x1a0773){if(_0x1a0773){_0x8df847[_0xe5db('0x78')]=_['keys'](db[_0xe5db('0x4f')][_0xe5db('0x99')]);_0x8df847[_0xe5db('0x22')]=_[_0xe5db('0x27')](_0x340fef[_0xe5db('0x22')]);_0x8df847[_0xe5db('0x79')]=_[_0xe5db('0x7a')](_0x8df847[_0xe5db('0x78')],_0x8df847[_0xe5db('0x22')]);_0x4a3b1f[_0xe5db('0x7c')]=_[_0xe5db('0x7a')](_0x8df847[_0xe5db('0x78')],qs[_0xe5db('0x7b')](_0x340fef[_0xe5db('0x22')][_0xe5db('0x7b')]));_0x4a3b1f[_0xe5db('0x7c')]=_0x4a3b1f[_0xe5db('0x7c')]['length']?_0x4a3b1f[_0xe5db('0x7c')]:_0x8df847[_0xe5db('0x78')];if(!_0x340fef[_0xe5db('0x22')][_0xe5db('0x84')]('nolimit')){_0x4a3b1f['limit']=qs['limit'](_0x340fef[_0xe5db('0x22')]['limit']);_0x4a3b1f['offset']=qs[_0xe5db('0xf')](_0x340fef[_0xe5db('0x22')][_0xe5db('0xf')]);}_0x4a3b1f[_0xe5db('0x7d')]=qs['sort'](_0x340fef['query'][_0xe5db('0x7e')]);_0x4a3b1f['where']=qs[_0xe5db('0x79')](_['pick'](_0x340fef[_0xe5db('0x22')],_0x8df847['filters']));_0x4a3b1f[_0xe5db('0x59')][_0xe5db('0x9f')]=_0x1a0773['id'];if(_0x340fef['query'][_0xe5db('0x81')]){_0x4a3b1f[_0xe5db('0x59')]=_[_0xe5db('0x80')](_0x4a3b1f[_0xe5db('0x59')],{'$or':_[_0xe5db('0x6c')](_0x4a3b1f['attributes'],function(_0x4de43a){var _0x44c5fe={};_0x44c5fe[_0x4de43a]={'$like':'%'+_0x340fef[_0xe5db('0x22')][_0xe5db('0x81')]+'%'};return _0x44c5fe;})});}_0x4a3b1f=_[_0xe5db('0x80')]({},_0x4a3b1f,_0x340fef[_0xe5db('0x82')]);return db['JscriptySessionReport'][_0xe5db('0x11')]({'where':_0x4a3b1f[_0xe5db('0x59')]})[_0xe5db('0x18')](function(_0x3dc0a2){_0x19d457[_0xe5db('0x11')]=_0x3dc0a2;if(_0x340fef[_0xe5db('0x22')][_0xe5db('0x9b')]){_0x4a3b1f[_0xe5db('0x9c')]=[{'all':!![]}];}return db[_0xe5db('0x4f')][_0xe5db('0x21')](_0x4a3b1f);})[_0xe5db('0x18')](function(_0x562635){_0x19d457[_0xe5db('0x9d')]=_0x562635;return _0x19d457;});}})[_0xe5db('0x18')](respondWithFilteredResult(_0x4a81e8,_0x4a3b1f))[_0xe5db('0x26')](handleError(_0x4a81e8,null));};exports[_0xe5db('0xa3')]=function(_0x2673ca,_0x1e4f6a){try{if(!_0x2673ca[_0xe5db('0x32')][_0xe5db('0x5b')]){throw new Error(_0xe5db('0xa4'));}if(!_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa5')]){throw new Error(_0xe5db('0xa6'));}if(!_0x2673ca['body']['binding_values']){throw new Error(_0xe5db('0xa7'));}if(!_0x2673ca['body']['socket_timestamp']){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x28292c=_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa5')][_0xe5db('0xa8')](',');var _0x2a0aa1=_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa9')][_0xe5db('0xa8')](',');if(!_0x28292c['length']||!_0x2a0aa1['length']||_0x28292c[_0xe5db('0x28')]!==_0x2a0aa1[_0xe5db('0x28')]){throw new Error(_0xe5db('0xaa'));}_0x2673ca[_0xe5db('0x32')]['fields']=_[_0xe5db('0xab')](_0x28292c,_0x2a0aa1);if(!_0x2673ca['body'][_0xe5db('0x7b')]['phone']){throw new Error(_0xe5db('0xac'));}if(!_0x2673ca['body']['fields'][_0xe5db('0xad')]){throw new Error(_0xe5db('0xae'));}var _0x209757=path[_0xe5db('0xaf')](config[_0xe5db('0xb0')],_0xe5db('0xb1'),_0x2673ca[_0xe5db('0xb2')][_0xe5db('0xb3')]);fs[_0xe5db('0xb4')](_0x209757,parseInt(_0xe5db('0xb5'),0x8));var _0x187871=require(_0xe5db('0xb6'))['fork'](path['join'](__dirname,_0xe5db('0xb7')),[_0x209757,_0x2673ca[_0xe5db('0x32')][_0xe5db('0xa5')],_0x2673ca['body'][_0xe5db('0xa9')],_0x2673ca[_0xe5db('0x32')]['ListId'],_0x2673ca[_0xe5db('0x32')][_0xe5db('0xb8')],_0x2673ca['body'][_0xe5db('0x58')],_0x2673ca[_0xe5db('0x32')]['socket_timestamp']]);return _0x1e4f6a[_0xe5db('0x13')](0xc8)[_0xe5db('0xe')]({'message':_0xe5db('0xb9'),'pid':_0x187871['pid']});}catch(_0x5977c5){return _0x1e4f6a[_0xe5db('0x13')](0x1f4)[_0xe5db('0x1e')](_0x5977c5);}};exports['upload']=function(_0x4781da,_0x214b96){var _0x488a23=fs[_0xe5db('0xba')](_0x4781da[_0xe5db('0xb2')][_0xe5db('0x2')]);Papa['parse'](_0x488a23,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1a8500){return _0x214b96[_0xe5db('0x13')](0xc8)[_0xe5db('0xe')]({'file':_0x4781da[_0xe5db('0xb2')],'fields':_0x1a8500[_0xe5db('0xbb')][_0xe5db('0x7b')]});}});};exports[_0xe5db('0xbc')]=function(_0x1b8631,_0x35520a){return db['User']['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0xe5db('0xbd')}})[_0xe5db('0x18')](function(_0x5b5f1c){var _0x7de2da=![];if(!_0x1b8631[_0xe5db('0x32')][_0xe5db('0x5b')]){throw new Error(_0xe5db('0xa4'));}if(!_0x1b8631[_0xe5db('0x32')][_0xe5db('0xbe')]['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x1b8631['body']['binding'][_0xe5db('0xad')]){throw new Error(_0xe5db('0xae'));}if(!_0x1b8631[_0xe5db('0x32')][_0xe5db('0xbf')]){throw new Error(_0xe5db('0xc0'));}var _0x257340=require(_0xe5db('0xb6'))['fork'](path[_0xe5db('0xaf')](__dirname,_0xe5db('0xc1')),[_0x1b8631[_0xe5db('0x61')]['id'],JSON[_0xe5db('0xc2')](_0x1b8631[_0xe5db('0x32')]),JSON['stringify'](_0x5b5f1c)]);_0x257340['on'](_0xe5db('0xc3'),function(){_0x7de2da=!![];return _0x35520a[_0xe5db('0x13')](0xc8)['json']({'message':_0xe5db('0xc4'),'pid':_0x257340[_0xe5db('0xc5')]});});_0x257340['on'](_0xe5db('0xc6'),function(_0x13b3bf){if(_0x13b3bf&&!_0x7de2da){return _0x35520a[_0xe5db('0x13')](0x1f4)[_0xe5db('0xe')]({'message':_0xe5db('0xc7'),'pid':_0x257340['pid']});}});})[_0xe5db('0x26')](handleError(_0x35520a,null));};exports[_0xe5db('0xc8')]=function(_0x17c119,_0x42f151){return db[_0xe5db('0xc9')][_0xe5db('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xe5db('0xbd')}})[_0xe5db('0x18')](function(_0x45187f){var _0x2af463=![];if(!_0x17c119[_0xe5db('0x32')][_0xe5db('0x5b')]){throw new Error(_0xe5db('0xa4'));}if(!_0x17c119[_0xe5db('0x32')][_0xe5db('0xbe')][_0xe5db('0x8b')]){throw new Error(_0xe5db('0xac'));}if(!_0x17c119[_0xe5db('0x32')]['binding']['firstName']){throw new Error(_0xe5db('0xae'));}if(!_0x17c119['body'][_0xe5db('0xbf')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x1754a7=require('child_process')[_0xe5db('0xca')](path[_0xe5db('0xaf')](__dirname,'../../components/import/cm/csvUpdates'),[_0x17c119[_0xe5db('0x61')]['id'],JSON[_0xe5db('0xc2')](_0x17c119[_0xe5db('0x32')]),JSON[_0xe5db('0xc2')](_0x45187f)]);_0x1754a7['on']('message',function(){_0x2af463=!![];return _0x42f151['status'](0xc8)[_0xe5db('0xe')]({'message':'start\x20child\x20process\x20correctly!','pid':_0x1754a7[_0xe5db('0xc5')]});});_0x1754a7['on'](_0xe5db('0xc6'),function(_0x437242){if(_0x437242&&!_0x2af463){return _0x42f151[_0xe5db('0x13')](0x1f4)[_0xe5db('0xe')]({'message':_0xe5db('0xc7'),'pid':_0x1754a7[_0xe5db('0xc5')]});}});})['catch'](handleError(_0x42f151,null));};exports[_0xe5db('0xcb')]=function(_0x4b1bae,_0x43d927){var _0x2eba6d=[_0xe5db('0xcc'),_0xe5db('0xcd'),_0xe5db('0xce'),_0xe5db('0xcf'),_0xe5db('0xd0'),_0xe5db('0xd1'),_0xe5db('0xd2')];var _0x13eb64={'offset':0x0,'order':qs[_0xe5db('0x7e')](_0xe5db('0xd3'))},_0x1d3150={'count':0x0,'rows':[]};Promise[_0xe5db('0xd4')]()['then'](function(){if(_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd5')]){if(!_['includes'](_0x2eba6d,_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd5')][_0xe5db('0xd6')]())){throw new Error('Invalid\x20channel');}_0x2eba6d=[_0x4b1bae[_0xe5db('0x22')]['channel']['toLowerCase']()];}if(_0x4b1bae['query'][_0xe5db('0xd7')]){try{var _0x17f00d=JSON[_0xe5db('0xd8')](_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd7')]);if(!moment(_0x17f00d['from'])[_0xe5db('0xd9')]()){throw new Error(_0xe5db('0xda'));}if(!moment(_0x17f00d['to'])['isValid']()){throw new Error(_0xe5db('0xdb'));}}catch(_0x15c41c){throw new Error(_0xe5db('0xdc'));}}if(!_0x4b1bae['query']['hasOwnProperty'](_0xe5db('0x9a'))){_0x13eb64['limit']=qs[_0xe5db('0x12')](_0x4b1bae[_0xe5db('0x22')][_0xe5db('0x12')]||0xa);_0x13eb64[_0xe5db('0xf')]=qs[_0xe5db('0xf')](_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xf')]);}var _0x459cbe=_0x2eba6d[_0xe5db('0x6c')](function(_0x178d10){if(_0x178d10===_0xe5db('0xd2')){var _0x3d56a8={'attributes':['id',_0xe5db('0xdd'),'type','source',_0xe5db('0xde'),_0xe5db('0xdf'),_0xe5db('0xe0'),_0xe5db('0xe1'),_0xe5db('0xe2'),_0xe5db('0xe3'),_0xe5db('0xe4'),_0xe5db('0xe5'),_0xe5db('0xe6'),_0xe5db('0xe7'),'UserId'],'where':{'ContactId':_0x4b1bae[_0xe5db('0x61')]['id']},'include':[{'model':db[_0xe5db('0xc9')],'as':_0xe5db('0xc9'),'attributes':['id','name',_0xe5db('0xe8'),_0xe5db('0x2d')]}],'order':[[_0xe5db('0xe4'),_0xe5db('0xe9')]]};if(_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd7')]){_0x3d56a8['where'][_0xe5db('0xe4')]={'$gte':_0x17f00d[_0xe5db('0x33')],'$lte':_0x17f00d['to']};}return db[_0xe5db('0x49')][_0xe5db('0xea')](_0x3d56a8)[_0xe5db('0x18')](function(_0x5f0010){_0x1d3150[_0xe5db('0x11')]+=_0x5f0010[_0xe5db('0x11')];return _[_0xe5db('0x6c')](_0x5f0010['rows'],function(_0x5f293b){var _0x2c0739=_0x5f293b[_0xe5db('0x34')]({'plain':!![]});_0x2c0739[_0xe5db('0xd5')]=_0x178d10;if(_0x2c0739['User']){_0x2c0739['User']={'id':_0x2c0739['User']['id'],'name':_0x2c0739[_0xe5db('0xc9')]['name'],'fullname':_0x2c0739[_0xe5db('0xc9')]['fullname'],'alias':_0x2c0739[_0xe5db('0xc9')][_0xe5db('0x2d')]};}return _0x2c0739;});});}else{var _0x9e7b1e=_[_0xe5db('0xeb')](_0x178d10)+(_0x178d10===_0xe5db('0xcd')?_0xe5db('0xec'):_0xe5db('0xed'));var _0x2856d4={'attributes':['id',_0xe5db('0xee'),'closedAt',_0xe5db('0xe4'),_0xe5db('0xe3'),_0xe5db('0xef'),_0xe5db('0xf0'),'thirdDisposition',_0xe5db('0xf1'),_0x9e7b1e+'Id'],'where':{'ContactId':_0x4b1bae['params']['id']},'include':[{'model':db[_0x9e7b1e],'as':_0xe5db('0xed'),'attributes':['id',_0xe5db('0x1d'),_0xe5db('0xf2')]},{'model':db[_0xe5db('0xc9')],'as':_0xe5db('0xf3'),'attributes':['id',_0xe5db('0x1d'),'fullname']},{'model':db[_0xe5db('0x62')],'as':_0xe5db('0x63'),'attributes':['id',_0xe5db('0x1d'),_0xe5db('0x64')],'through':{'attributes':[]}}],'order':[['createdAt',_0xe5db('0xe9')]]};if(_0x4b1bae[_0xe5db('0x22')][_0xe5db('0xd7')]){_0x2856d4['where'][_0xe5db('0xe4')]={'$gte':_0x17f00d['from'],'$lte':_0x17f00d['to']};}switch(_0x178d10){case _0xe5db('0xcd'):_0x2856d4['attributes'][_0xe5db('0x5d')](_0xe5db('0xf4'),_0xe5db('0xf5'),'customerPort',_0xe5db('0xf6'),_0xe5db('0xf7'),'ratingMessage',_0xe5db('0xf8'),_0xe5db('0xf9'),'referer');break;case _0xe5db('0xcc'):_0x2856d4['attributes'][_0xe5db('0x5d')](_0xe5db('0xfa'),_0xe5db('0xfb'));break;case'openchannel':_0x2856d4[_0xe5db('0x7c')][_0xe5db('0x5d')]('externalUrl',_0xe5db('0xfc'));break;}return db[_[_0xe5db('0xeb')](_0x178d10)+_0xe5db('0xfd')][_0xe5db('0xea')](_0x2856d4)[_0xe5db('0x18')](function(_0x4a6bba){_0x1d3150[_0xe5db('0x11')]+=_0x4a6bba[_0xe5db('0x11')];return _[_0xe5db('0x6c')](_0x4a6bba[_0xe5db('0x9d')],function(_0x4ce3ea){var _0x5ebcc5=_0x4ce3ea[_0xe5db('0x34')]({'plain':!![]});_0x5ebcc5[_0xe5db('0xd5')]=_0x178d10;if(_0x5ebcc5[_0xe5db('0xf3')]){_0x5ebcc5[_0xe5db('0xf3')]={'id':_0x5ebcc5['Owner']['id'],'name':_0x5ebcc5[_0xe5db('0xf3')][_0xe5db('0x1d')],'fullname':_0x5ebcc5[_0xe5db('0xf3')][_0xe5db('0xe8')]};}return _0x5ebcc5;});});}});return Promise[_0xe5db('0x5f')](_0x459cbe);})['then'](function(_0x396470){return _(_0x396470)[_0xe5db('0xfe')]()[_0xe5db('0xff')]('createdAt')['reverse']()[_0xe5db('0x100')]();})[_0xe5db('0x18')](function(_0x40e435){_0x1d3150[_0xe5db('0x9d')]=_0x13eb64[_0xe5db('0x12')]?_0x40e435[_0xe5db('0x101')](_0x13eb64[_0xe5db('0xf')],_0x13eb64['offset']+_0x13eb64[_0xe5db('0x12')]):_0x40e435;return _0x1d3150;})['then'](respondWithFilteredResult(_0x43d927,_0x13eb64))[_0xe5db('0x26')](handleError(_0x43d927,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 556b75b..dc7e806 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 _0x3d03=['../../mysqldb','CmContact','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x59e7a0,_0x1e34b0){var _0xaa159d=function(_0x940a54){while(--_0x940a54){_0x59e7a0['push'](_0x59e7a0['shift']());}};_0xaa159d(++_0x1e34b0);}(_0x3d03,0x178));var _0x33d0=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x3d03[_0x20589d];return _0x422de9;};'use strict';var EventEmitter=require('events');var CmContact=require(_0x33d0('0x0'))['db'][_0x33d0('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0x33d0('0x2')](0x0);var events={'afterCreate':_0x33d0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2d8e13){return function(_0x55f5c6,_0x2c814b,_0x6eca40){CmContactEvents[_0x33d0('0x4')](_0x2d8e13+':'+_0x55f5c6['id'],_0x55f5c6);CmContactEvents[_0x33d0('0x4')](_0x2d8e13,_0x55f5c6);_0x6eca40(null);};}for(var e in events){if(events[_0x33d0('0x5')](e)){var event=events[e];CmContact[_0x33d0('0x6')](e,emitEvent(event));}}module[_0x33d0('0x7')]=CmContactEvents; \ No newline at end of file +var _0xa813=['hasOwnProperty','exports','events','../../mysqldb','save','remove','emit'];(function(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0xa813,0x144));var _0x3a81=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xa813[_0x39096d];return _0x13da4f;};'use strict';var EventEmitter=require(_0x3a81('0x0'));var CmContact=require(_0x3a81('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3a81('0x2'),'afterUpdate':'update','afterDestroy':_0x3a81('0x3')};function emitEvent(_0x46d31e){return function(_0x4d6e31,_0xe018bd,_0x14ce59){CmContactEvents[_0x3a81('0x4')](_0x46d31e+':'+_0x4d6e31['id'],_0x4d6e31);CmContactEvents['emit'](_0x46d31e,_0x4d6e31);_0x14ce59(null);};}for(var e in events){if(events[_0x3a81('0x5')](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0x3a81('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d47b57c..4280529 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 _0x7877=['utf8mb4','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','isEmpty','length','destroy','ContactId','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','api','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','isNil','dialTimezone','resolve','findOne','timezones','utcOffset','add','minutes','ListId','priority','callbackUniqueid','phone','assign','CmHopper','CmHopperFinal','then','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','create','always','onlyIfOpen','outbound','dialCheckDuplicateType','CmList','Lists','map','findAll','all','CmHopperBlack','BlackLists','exports','CmContact','cm_contacts','fti_cm_contacts','firstName','mobile','fax','FULLTEXT'];(function(_0x2776ad,_0x5e26ed){var _0x378760=function(_0x10bb9f){while(--_0x10bb9f){_0x2776ad['push'](_0x2776ad['shift']());}};_0x378760(++_0x5e26ed);}(_0x7877,0x196));var _0x7787=function(_0x17598a,_0x522cc6){_0x17598a=_0x17598a-0x0;var _0x4cd046=_0x7877[_0x17598a];return _0x4cd046;};'use strict';var _=require(_0x7787('0x0'));var util=require(_0x7787('0x1'));var logger=require('../../config/logger')(_0x7787('0x2'));var moment=require('moment');var shared=require(_0x7787('0x3'));var attributes=require(_0x7787('0x4'));function getTimezoneCallbackAt(_0x362567,_0x267703,_0x220341,_0x40a2f8){var _0x184e78=_0x40a2f8?_0x7787('0x5'):_0x7787('0x6');var _0x4e35cc=_0x220341[_0x7787('0x7')]?_0x220341[_0x7787('0x7')]:moment()[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x7787('0x9')](_0x220341[_0x7787('0xa')])){return Promise[_0x7787('0xb')](_0x4e35cc);}return _0x362567[_0x184e78][_0x7787('0xc')]({'where':{'id':_0x267703}})['then'](function(_0x989f76){if(_[_0x7787('0x9')](_0x989f76)||_[_0x7787('0x9')](_0x989f76[_0x7787('0xa')])){return Promise[_0x7787('0xb')](_0x4e35cc);}var _0x43dd9a=shared[_0x7787('0xd')];var _0x4ee56f=_0x43dd9a[_0x989f76['dialTimezone']];var _0x50e0ea=_0x43dd9a[_0x220341['dialTimezone']];if(_[_0x7787('0x9')](_0x4ee56f)&&_['isNil'](_0x50e0ea)){return Promise[_0x7787('0xb')](_0x4e35cc);}var _0x2a2ed5=_0x4ee56f[_0x7787('0xe')]-_0x50e0ea[_0x7787('0xe')];var _0x3f774e=_0x220341[_0x7787('0x7')]?_0x220341['scheduledat']:moment();_0x4e35cc=moment(_0x3f774e)[_0x7787('0xf')](_0x2a2ed5,_0x7787('0x10'))[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss');return Promise[_0x7787('0xb')](_0x4e35cc);});}function getNewHopperPayload(_0x270ffc){return{'phone':_0x270ffc['phone'],'ContactId':_0x270ffc['id'],'ListId':_0x270ffc[_0x7787('0x11')],'scheduledat':_0x270ffc[_0x7787('0x7')]?_0x270ffc[_0x7787('0x7')]:moment()[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0x270ffc[_0x7787('0x12')]?_0x270ffc[_0x7787('0x12')]:0x2,'callback':_0x270ffc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x270ffc[_0x7787('0x13')]?_0x270ffc[_0x7787('0x13')]:undefined,'callbackat':_0x270ffc[_0x7787('0x13')]?moment()[_0x7787('0x8')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0xe6fa6f,_0x2e2df6,_0x1d5664,_0x167f59){var _0x2a613d={'phone':_0x1d5664[_0x7787('0x14')]};var _0x46d864={'calleridnum':_0x1d5664[_0x7787('0x14')]};if(_0x167f59){Object[_0x7787('0x15')](_0x2a613d,{'CampaignId':_0x2e2df6['id']});Object[_0x7787('0x15')](_0x46d864,{'CampaignId':_0x2e2df6['id']});}else{Object[_0x7787('0x15')](_0x2a613d,{'VoiceQueueId':_0x2e2df6['id']});Object[_0x7787('0x15')](_0x46d864,{'VoiceQueueId':_0x2e2df6['id']});}return _0xe6fa6f[_0x7787('0x16')][_0x7787('0xc')]({'where':_0x2a613d})['then'](function(_0x266564){if(_0x266564){throw new Error('[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x1d5664[_0x7787('0x14')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x2e2df6['id']);}return _0xe6fa6f[_0x7787('0x17')][_0x7787('0xc')]({'where':_0x46d864});})[_0x7787('0x18')](function(_0x7c578e){if(_0x7c578e){throw new Error(_0x7787('0x19')+_0x1d5664[_0x7787('0x14')]+_0x7787('0x1a')+_0x2e2df6['id']);}var _0x12b531=getNewHopperPayload(_0x1d5664);if(_0x167f59){_0x12b531[_0x7787('0x1b')]=_0x2e2df6['id'];}else{_0x12b531[_0x7787('0x1c')]=_0x2e2df6['id'];}return _0xe6fa6f['CmHopper'][_0x7787('0x1d')](_0x12b531);});}function handleOnlyIfOpenCheckDuplicate(_0xa77fa,_0x5e6ef0,_0x52482d,_0x2607fd){var _0xe38b8b={'phone':_0x52482d[_0x7787('0x14')]};if(_0x2607fd){Object['assign'](_0xe38b8b,{'CampaignId':_0x5e6ef0['id']});}else{Object[_0x7787('0x15')](_0xe38b8b,{'VoiceQueueId':_0x5e6ef0['id']});}return _0xa77fa['CmHopper']['findOne']({'where':_0xe38b8b})[_0x7787('0x18')](function(_0xebab32){if(_0xebab32){throw new Error('[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20'+_0x52482d['phone']+'\x20in\x20Campaign\x20with\x20id\x20'+_0x5e6ef0['id']);}var _0x401dce=getNewHopperPayload(_0x52482d);if(_0x2607fd){_0x401dce[_0x7787('0x1b')]=_0x5e6ef0['id'];}else{_0x401dce[_0x7787('0x1c')]=_0x5e6ef0['id'];}return _0xa77fa[_0x7787('0x16')]['create'](_0x401dce);});}function handleNeverCheckDuplicate(_0x5d631f,_0x29e896,_0x574015){var _0x27b4f8=getNewHopperPayload(_0x574015);_0x27b4f8['VoiceQueueId']=_0x29e896['id'];return _0x5d631f['CmHopper'][_0x7787('0x1d')](_0x27b4f8);}function handleCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f){return getTimezoneCallbackAt(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f)[_0x7787('0x18')](function(_0x52db19){_0x2ce8c6[_0x7787('0x7')]=_0x52db19;switch(_0xf151ce['dialCheckDuplicateType']){case _0x7787('0x1e'):return handleAlwaysCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f);case _0x7787('0x1f'):return handleOnlyIfOpenCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6,_0x4dc74f);default:return handleNeverCheckDuplicate(_0x115775,_0xf151ce,_0x2ce8c6);}});}function createHopperForVoiceQueues(_0x488df6,_0x156028){return _0x488df6[_0x7787('0x6')]['findAll']({'where':{'type':_0x7787('0x20')},'attributes':['id',_0x7787('0x21'),_0x7787('0xa')],'include':[{'model':_0x488df6[_0x7787('0x22')],'as':_0x7787('0x23'),'where':{'id':_0x156028[_0x7787('0x11')]}}],'raw':!![]})['then'](function(_0x4b661d){var _0x2c0d24=_0x4b661d[_0x7787('0x24')](function(_0x241dd5){return handleCheckDuplicate(_0x488df6,_0x241dd5,_0x156028,![]);});return Promise['all'](_0x2c0d24);});}function createHopperForCampaigns(_0x4c564a,_0x1ceef9){return _0x4c564a[_0x7787('0x5')][_0x7787('0x25')]({'attributes':['id',_0x7787('0x21'),_0x7787('0xa')],'include':[{'model':_0x4c564a[_0x7787('0x22')],'as':_0x7787('0x23'),'where':{'id':_0x1ceef9[_0x7787('0x11')]}}],'raw':!![]})[_0x7787('0x18')](function(_0x3c541a){var _0x11935e=_0x3c541a[_0x7787('0x24')](function(_0x3bb10b){return handleCheckDuplicate(_0x4c564a,_0x3bb10b,_0x1ceef9,!![]);});return Promise[_0x7787('0x26')](_0x11935e);});}function createHopperBlackForVoiceQueues(_0x183fb4,_0x1f5100){return _0x183fb4[_0x7787('0x6')]['findAll']({'where':{'type':_0x7787('0x20')},'attributes':['id'],'include':[{'model':_0x183fb4['CmList'],'as':'BlackLists','where':{'id':_0x1f5100[_0x7787('0x11')]}}],'raw':!![]})[_0x7787('0x18')](function(_0x253428){var _0x540236=_0x253428[_0x7787('0x24')](function(_0xb89be8){return _0x183fb4[_0x7787('0x27')][_0x7787('0x1d')]({'phone':_0x1f5100['phone'],'ContactId':_0x1f5100['id'],'ListId':_0x1f5100[_0x7787('0x11')],'VoiceQueueId':_0xb89be8['id']});});return Promise['all'](_0x540236);});}function createHopperBlackForCampaigns(_0x148385,_0x37fe22){return _0x148385[_0x7787('0x5')][_0x7787('0x25')]({'attributes':['id'],'include':[{'model':_0x148385['CmList'],'as':_0x7787('0x28'),'where':{'id':_0x37fe22['ListId']}}],'raw':!![]})[_0x7787('0x18')](function(_0x15e4d5){var _0x1984e4=_0x15e4d5[_0x7787('0x24')](function(_0x2650c3){return _0x148385['CmHopperBlack'][_0x7787('0x1d')]({'phone':_0x37fe22[_0x7787('0x14')],'ContactId':_0x37fe22['id'],'ListId':_0x37fe22['ListId'],'CampaignId':_0x2650c3['id']});});return Promise['all'](_0x1984e4);});}module[_0x7787('0x29')]=function(_0x4a1f47){return _0x4a1f47['define'](_0x7787('0x2a'),attributes,{'tableName':_0x7787('0x2b'),'paranoid':!![],'indexes':[{'name':_0x7787('0x14'),'fields':[_0x7787('0x14')]},{'name':_0x7787('0x2c'),'fields':[_0x7787('0x2d'),'lastName',_0x7787('0x14'),_0x7787('0x2e'),_0x7787('0x2f'),'email'],'type':_0x7787('0x30')}],'timestamps':!![],'charset':_0x7787('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x2a3dca,_0x130592,_0xb74671){var _0x452cb8=_0x4a1f47[_0x7787('0x32')];var _0x4f1a7c=_0x2a3dca[_0x7787('0x33')]({'plain':!![]});if(!_0x4f1a7c['ListId']){logger[_0x7787('0x34')](_0x7787('0x35')+_0x4f1a7c['id']);return _0xb74671();}if(!_0x4f1a7c[_0x7787('0x14')]){return _0xb74671();}return createHopperForVoiceQueues(_0x452cb8,_0x4f1a7c)[_0x7787('0x18')](function(){return createHopperBlackForVoiceQueues(_0x452cb8,_0x4f1a7c);})['then'](function(){return createHopperForCampaigns(_0x452cb8,_0x4f1a7c);})['then'](function(){return createHopperBlackForCampaigns(_0x452cb8,_0x4f1a7c);})['then'](function(){return _0xb74671();})[_0x7787('0x36')](function(_0x48c0ee){logger['error'](_0x7787('0x37'),_0x48c0ee[_0x7787('0x38')]);_0xb74671();});},'afterDestroy':function(_0x10796c,_0x3f2589,_0x3f32e1){var _0x59729f=_0x4a1f47['models'];var _0x59c859=_0x10796c[_0x7787('0x33')]({'plain':!![]});return _0x59729f[_0x7787('0x16')][_0x7787('0x25')]({'raw':!![],'where':{'ListId':_0x59c859[_0x7787('0x11')],'ContactId':_0x59c859['id']}})['then'](function(_0x1e60af){if(!_[_0x7787('0x39')](_0x1e60af)){var _0x261653=[];for(var _0x5baf3d=0x0;_0x5baf3d<_0x1e60af[_0x7787('0x3a')];_0x5baf3d+=0x1){var _0x2efc20=_0x59729f[_0x7787('0x16')][_0x7787('0x3b')]({'where':{'ListId':_0x1e60af[_0x5baf3d][_0x7787('0x11')],'ContactId':_0x1e60af[_0x5baf3d][_0x7787('0x3c')],'VoiceQueueId':_0x1e60af[_0x5baf3d][_0x7787('0x1c')],'CampaignId':_0x1e60af[_0x5baf3d][_0x7787('0x1b')]}});_0x261653['push'](_0x2efc20);}return Promise[_0x7787('0x26')](_0x261653);}})[_0x7787('0x18')](function(_0x1df2d8){logger[_0x7787('0x3d')](_0x7787('0x3e'),util[_0x7787('0x3f')](_0x1df2d8,{'showHidden':![],'depth':null}));_0x3f32e1();})[_0x7787('0x36')](function(_0x1f7a10){logger[_0x7787('0x34')](_0x7787('0x40'),util['inspect'](_0x1f7a10,{'showHidden':![],'depth':null}));_0x3f32e1(_0x1f7a10);});}}});}; \ No newline at end of file +var _0xbf44=['CmContact','fti_cm_contacts','firstName','lastName','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','message','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','timezones','utcOffset','add','minutes','phone','ListId','priority','callbackUniqueid','assign','findOne','then','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','CmHopper','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','create','always','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','map','all','Campaign','outbound','BlackLists','CmHopperBlack','exports','define'];(function(_0x1332d8,_0x5e34a5){var _0x109ea9=function(_0xbec8c){while(--_0xbec8c){_0x1332d8['push'](_0x1332d8['shift']());}};_0x109ea9(++_0x5e34a5);}(_0xbf44,0x9e));var _0x4bf4=function(_0x10548e,_0x80eaff){_0x10548e=_0x10548e-0x0;var _0x540aa4=_0xbf44[_0x10548e];return _0x540aa4;};'use strict';var _=require(_0x4bf4('0x0'));var util=require(_0x4bf4('0x1'));var logger=require(_0x4bf4('0x2'))(_0x4bf4('0x3'));var moment=require('moment');var shared=require(_0x4bf4('0x4'));var attributes=require(_0x4bf4('0x5'));function getTimezoneCallbackAt(_0xefcfda,_0x37d5f9,_0x1c12b0,_0x35e5fb){var _0x5728d6=_0x35e5fb?'Campaign':'VoiceQueue';var _0x4aeafe=_0x1c12b0[_0x4bf4('0x6')]?_0x1c12b0[_0x4bf4('0x6')]:moment()[_0x4bf4('0x7')](_0x4bf4('0x8'));if(_[_0x4bf4('0x9')](_0x1c12b0['dialTimezone'])){return Promise['resolve'](_0x4aeafe);}return _0xefcfda[_0x5728d6]['findOne']({'where':{'id':_0x37d5f9}})['then'](function(_0x4f409b){if(_[_0x4bf4('0x9')](_0x4f409b)||_[_0x4bf4('0x9')](_0x4f409b[_0x4bf4('0xa')])){return Promise[_0x4bf4('0xb')](_0x4aeafe);}var _0x19f6d5=shared[_0x4bf4('0xc')];var _0x19e8aa=_0x19f6d5[_0x4f409b[_0x4bf4('0xa')]];var _0x73bdaa=_0x19f6d5[_0x1c12b0[_0x4bf4('0xa')]];if(_[_0x4bf4('0x9')](_0x19e8aa)&&_[_0x4bf4('0x9')](_0x73bdaa)){return Promise[_0x4bf4('0xb')](_0x4aeafe);}var _0x8f5ffe=_0x19e8aa['utcOffset']-_0x73bdaa[_0x4bf4('0xd')];var _0x4dfe0a=_0x1c12b0[_0x4bf4('0x6')]?_0x1c12b0[_0x4bf4('0x6')]:moment();_0x4aeafe=moment(_0x4dfe0a)[_0x4bf4('0xe')](_0x8f5ffe,_0x4bf4('0xf'))[_0x4bf4('0x7')](_0x4bf4('0x8'));return Promise[_0x4bf4('0xb')](_0x4aeafe);});}function getNewHopperPayload(_0x2d0155){return{'phone':_0x2d0155[_0x4bf4('0x10')],'ContactId':_0x2d0155['id'],'ListId':_0x2d0155[_0x4bf4('0x11')],'scheduledat':_0x2d0155[_0x4bf4('0x6')]?_0x2d0155['scheduledat']:moment()[_0x4bf4('0x7')](_0x4bf4('0x8')),'priority':_0x2d0155['priority']?_0x2d0155[_0x4bf4('0x12')]:0x2,'callback':_0x2d0155[_0x4bf4('0x13')]?!![]:![],'callbackuniqueid':_0x2d0155[_0x4bf4('0x13')]?_0x2d0155[_0x4bf4('0x13')]:undefined,'callbackat':_0x2d0155[_0x4bf4('0x13')]?moment()[_0x4bf4('0x7')]('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x54e666,_0xeb9be,_0x502e85,_0x44551f){var _0x2f5cea={'phone':_0x502e85['phone']};var _0xef067c={'calleridnum':_0x502e85['phone']};if(_0x44551f){Object[_0x4bf4('0x14')](_0x2f5cea,{'CampaignId':_0xeb9be['id']});Object[_0x4bf4('0x14')](_0xef067c,{'CampaignId':_0xeb9be['id']});}else{Object['assign'](_0x2f5cea,{'VoiceQueueId':_0xeb9be['id']});Object[_0x4bf4('0x14')](_0xef067c,{'VoiceQueueId':_0xeb9be['id']});}return _0x54e666['CmHopper'][_0x4bf4('0x15')]({'where':_0x2f5cea})[_0x4bf4('0x16')](function(_0x392702){if(_0x392702){throw new Error(_0x4bf4('0x17')+_0x502e85[_0x4bf4('0x10')]+_0x4bf4('0x18')+_0xeb9be['id']);}return _0x54e666[_0x4bf4('0x19')][_0x4bf4('0x15')]({'where':_0xef067c});})['then'](function(_0x458181){if(_0x458181){throw new Error(_0x4bf4('0x1a')+_0x502e85[_0x4bf4('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0xeb9be['id']);}var _0x408f67=getNewHopperPayload(_0x502e85);if(_0x44551f){_0x408f67['CampaignId']=_0xeb9be['id'];}else{_0x408f67[_0x4bf4('0x1b')]=_0xeb9be['id'];}return _0x54e666[_0x4bf4('0x1c')]['create'](_0x408f67);});}function handleOnlyIfOpenCheckDuplicate(_0x40c428,_0x338c14,_0x3c80f7,_0x1aed6c){var _0x44b15b={'phone':_0x3c80f7[_0x4bf4('0x10')]};if(_0x1aed6c){Object[_0x4bf4('0x14')](_0x44b15b,{'CampaignId':_0x338c14['id']});}else{Object[_0x4bf4('0x14')](_0x44b15b,{'VoiceQueueId':_0x338c14['id']});}return _0x40c428[_0x4bf4('0x1c')][_0x4bf4('0x15')]({'where':_0x44b15b})['then'](function(_0x410926){if(_0x410926){throw new Error(_0x4bf4('0x1d')+_0x3c80f7[_0x4bf4('0x10')]+_0x4bf4('0x18')+_0x338c14['id']);}var _0x1a39e5=getNewHopperPayload(_0x3c80f7);if(_0x1aed6c){_0x1a39e5[_0x4bf4('0x1e')]=_0x338c14['id'];}else{_0x1a39e5[_0x4bf4('0x1b')]=_0x338c14['id'];}return _0x40c428[_0x4bf4('0x1c')][_0x4bf4('0x1f')](_0x1a39e5);});}function handleNeverCheckDuplicate(_0x42156a,_0x58bccc,_0x1f43a6){var _0x30e7a5=getNewHopperPayload(_0x1f43a6);_0x30e7a5['VoiceQueueId']=_0x58bccc['id'];return _0x42156a[_0x4bf4('0x1c')]['create'](_0x30e7a5);}function handleCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343){return getTimezoneCallbackAt(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343)[_0x4bf4('0x16')](function(_0x8167ad){_0x3daa2f[_0x4bf4('0x6')]=_0x8167ad;switch(_0x532d2e['dialCheckDuplicateType']){case _0x4bf4('0x20'):return handleAlwaysCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f,_0x279343);default:return handleNeverCheckDuplicate(_0x4c4e95,_0x532d2e,_0x3daa2f);}});}function createHopperForVoiceQueues(_0x4aa429,_0x412261){return _0x4aa429[_0x4bf4('0x21')][_0x4bf4('0x22')]({'where':{'type':'outbound'},'attributes':['id',_0x4bf4('0x23'),'dialTimezone'],'include':[{'model':_0x4aa429[_0x4bf4('0x24')],'as':_0x4bf4('0x25'),'where':{'id':_0x412261['ListId']}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x508cef){var _0x16778f=_0x508cef[_0x4bf4('0x26')](function(_0xadd2bd){return handleCheckDuplicate(_0x4aa429,_0xadd2bd,_0x412261,![]);});return Promise[_0x4bf4('0x27')](_0x16778f);});}function createHopperForCampaigns(_0x5e4288,_0x47c52e){return _0x5e4288[_0x4bf4('0x28')][_0x4bf4('0x22')]({'attributes':['id',_0x4bf4('0x23'),_0x4bf4('0xa')],'include':[{'model':_0x5e4288[_0x4bf4('0x24')],'as':_0x4bf4('0x25'),'where':{'id':_0x47c52e[_0x4bf4('0x11')]}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x40e0af){var _0x4b9ab1=_0x40e0af[_0x4bf4('0x26')](function(_0x4e16e1){return handleCheckDuplicate(_0x5e4288,_0x4e16e1,_0x47c52e,!![]);});return Promise[_0x4bf4('0x27')](_0x4b9ab1);});}function createHopperBlackForVoiceQueues(_0x77bdef,_0x203534){return _0x77bdef['VoiceQueue'][_0x4bf4('0x22')]({'where':{'type':_0x4bf4('0x29')},'attributes':['id'],'include':[{'model':_0x77bdef[_0x4bf4('0x24')],'as':_0x4bf4('0x2a'),'where':{'id':_0x203534[_0x4bf4('0x11')]}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x56969b){var _0x1b27dd=_0x56969b['map'](function(_0x4dbd7d){return _0x77bdef[_0x4bf4('0x2b')][_0x4bf4('0x1f')]({'phone':_0x203534[_0x4bf4('0x10')],'ContactId':_0x203534['id'],'ListId':_0x203534['ListId'],'VoiceQueueId':_0x4dbd7d['id']});});return Promise[_0x4bf4('0x27')](_0x1b27dd);});}function createHopperBlackForCampaigns(_0x35f486,_0x3bff63){return _0x35f486[_0x4bf4('0x28')][_0x4bf4('0x22')]({'attributes':['id'],'include':[{'model':_0x35f486[_0x4bf4('0x24')],'as':_0x4bf4('0x2a'),'where':{'id':_0x3bff63[_0x4bf4('0x11')]}}],'raw':!![]})[_0x4bf4('0x16')](function(_0x5a0837){var _0x793972=_0x5a0837['map'](function(_0x3267e8){return _0x35f486['CmHopperBlack']['create']({'phone':_0x3bff63[_0x4bf4('0x10')],'ContactId':_0x3bff63['id'],'ListId':_0x3bff63[_0x4bf4('0x11')],'CampaignId':_0x3267e8['id']});});return Promise['all'](_0x793972);});}module[_0x4bf4('0x2c')]=function(_0x3e1d80){return _0x3e1d80[_0x4bf4('0x2d')](_0x4bf4('0x2e'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0x4bf4('0x10'),'fields':['phone']},{'name':_0x4bf4('0x2f'),'fields':[_0x4bf4('0x30'),_0x4bf4('0x31'),_0x4bf4('0x10'),'mobile','fax',_0x4bf4('0x32')],'type':_0x4bf4('0x33')}],'timestamps':!![],'charset':_0x4bf4('0x34'),'collate':_0x4bf4('0x35'),'hooks':{'afterCreate':function(_0x57b335,_0x3ca242,_0xfbf603){var _0x416c84=_0x3e1d80[_0x4bf4('0x36')];var _0x4654c1=_0x57b335[_0x4bf4('0x37')]({'plain':!![]});if(!_0x4654c1['ListId']){logger[_0x4bf4('0x38')](_0x4bf4('0x39')+_0x4654c1['id']);return _0xfbf603();}if(!_0x4654c1[_0x4bf4('0x10')]){return _0xfbf603();}return createHopperForVoiceQueues(_0x416c84,_0x4654c1)[_0x4bf4('0x16')](function(){return createHopperBlackForVoiceQueues(_0x416c84,_0x4654c1);})[_0x4bf4('0x16')](function(){return createHopperForCampaigns(_0x416c84,_0x4654c1);})[_0x4bf4('0x16')](function(){return createHopperBlackForCampaigns(_0x416c84,_0x4654c1);})['then'](function(){return _0xfbf603();})[_0x4bf4('0x3a')](function(_0x44517f){logger[_0x4bf4('0x38')](_0x4bf4('0x3b'),_0x44517f[_0x4bf4('0x3c')]);_0xfbf603();});},'afterDestroy':function(_0x2f5657,_0x243d3a,_0x5b2c3b){var _0x3f1940=_0x3e1d80['models'];var _0x2f7fb0=_0x2f5657[_0x4bf4('0x37')]({'plain':!![]});return _0x3f1940[_0x4bf4('0x1c')][_0x4bf4('0x22')]({'raw':!![],'where':{'ListId':_0x2f7fb0['ListId'],'ContactId':_0x2f7fb0['id']}})[_0x4bf4('0x16')](function(_0x3f8c1a){if(!_['isEmpty'](_0x3f8c1a)){var _0x3db1b4=[];for(var _0x16185a=0x0;_0x16185a<_0x3f8c1a[_0x4bf4('0x3d')];_0x16185a+=0x1){var _0x973b00=_0x3f1940[_0x4bf4('0x1c')][_0x4bf4('0x3e')]({'where':{'ListId':_0x3f8c1a[_0x16185a][_0x4bf4('0x11')],'ContactId':_0x3f8c1a[_0x16185a][_0x4bf4('0x3f')],'VoiceQueueId':_0x3f8c1a[_0x16185a]['VoiceQueueId'],'CampaignId':_0x3f8c1a[_0x16185a]['CampaignId']}});_0x3db1b4[_0x4bf4('0x40')](_0x973b00);}return Promise[_0x4bf4('0x27')](_0x3db1b4);}})[_0x4bf4('0x16')](function(_0x5c4595){logger['info'](_0x4bf4('0x41'),util[_0x4bf4('0x42')](_0x5c4595,{'showHidden':![],'depth':null}));_0x5b2c3b();})['catch'](function(_0x869ba5){logger[_0x4bf4('0x38')](_0x4bf4('0x43'),util[_0x4bf4('0x42')](_0x869ba5,{'showHidden':![],'depth':null}));_0x5b2c3b(_0x869ba5);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index e049b0f..c646500 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(_0x534aee,_0x4c5f77){var _0x253da4=function(_0x48babb){while(--_0x48babb){_0x534aee['push'](_0x534aee['shift']());}};_0x253da4(++_0x4c5f77);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x387dad,_0x3b1bc3){var _0x7dd647=function(_0x1c23fa){while(--_0x1c23fa){_0x387dad['push'](_0x387dad['shift']());}};_0x7dd647(++_0x3b1bc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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 0bb81e3..f2a013a 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 _0x4fdc=['exports','STRING','INTEGER'];(function(_0x1c72ac,_0x380a0e){var _0x274e46=function(_0x1bbadf){while(--_0x1bbadf){_0x1c72ac['push'](_0x1c72ac['shift']());}};_0x274e46(++_0x380a0e);}(_0x4fdc,0x84));var _0xc4fd=function(_0x4c8f60,_0xe1f0a4){_0x4c8f60=_0x4c8f60-0x0;var _0x3783b2=_0x4fdc[_0x4c8f60];return _0x3783b2;};'use strict';var Sequelize=require('sequelize');module[_0xc4fd('0x0')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xc4fd('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc4fd('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc4fd('0x1')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc4fd('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0xc4fd('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xc577=['INTEGER','PHONE','sequelize','STRING'];(function(_0x49c057,_0xc808ed){var _0xd8f0e6=function(_0x5b9042){while(--_0x5b9042){_0x49c057['push'](_0x49c057['shift']());}};_0xd8f0e6(++_0xc808ed);}(_0xc577,0x172));var _0x7c57=function(_0x6376b0,_0x52d8c1){_0x6376b0=_0x6376b0-0x0;var _0x47ac71=_0xc577[_0x6376b0];return _0x47ac71;};'use strict';var Sequelize=require(_0x7c57('0x0'));module['exports']={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0x7c57('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x7c57('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x7c57('0x1')],'defaultValue':_0x7c57('0x3')},'OrderBy':{'type':Sequelize[_0x7c57('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x7c57('0x1')],'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 fea9f72..8a78112 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 _0x3f71=['catch','show','params','keys','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','request-promise','moment','bluebird','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/utils','sendStatus','json','undefined','limit','count','offset','status','set','Content-Range','update','then','CmContactHasItems','UserProfileResource','destroy','end','error','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','rows'];(function(_0x7b02fd,_0x37b321){var _0x2e1188=function(_0x3830d3){while(--_0x3830d3){_0x7b02fd['push'](_0x7b02fd['shift']());}};_0x2e1188(++_0x37b321);}(_0x3f71,0x17c));var _0x13f7=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x3f71[_0x163040];return _0x364667;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x13f7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x13f7('0x1'));var moment=require(_0x13f7('0x2'));var BPromise=require(_0x13f7('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x13f7('0x4'));var csv=require('to-csv');var ejs=require(_0x13f7('0x5'));var fs=require('fs');var fs_extra=require(_0x13f7('0x6'));var _=require(_0x13f7('0x7'));var squel=require('squel');var crypto=require(_0x13f7('0x8'));var jsforce=require(_0x13f7('0x9'));var deskjs=require(_0x13f7('0xa'));var toCsv=require(_0x13f7('0xb'));var querystring=require(_0x13f7('0xc'));var Papa=require(_0x13f7('0xd'));var Redis=require('ioredis');var authService=require(_0x13f7('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x13f7('0xf'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x437c63,_0x398a9b){_0x398a9b=_0x398a9b||0xcc;return function(_0x3be002){if(_0x3be002){return _0x437c63[_0x13f7('0x10')](_0x398a9b);}return _0x437c63['status'](_0x398a9b)['end']();};}function respondWithResult(_0x17f162,_0x5ac4ad){_0x5ac4ad=_0x5ac4ad||0xc8;return function(_0x3178d6){if(_0x3178d6){return _0x17f162['status'](_0x5ac4ad)[_0x13f7('0x11')](_0x3178d6);}};}function respondWithFilteredResult(_0x1b975f,_0x5d4309){return function(_0x5337a3){if(_0x5337a3){var _0x289406=typeof _0x5d4309['offset']===_0x13f7('0x12')&&typeof _0x5d4309[_0x13f7('0x13')]===_0x13f7('0x12');var _0x4e301c=_0x5337a3[_0x13f7('0x14')];var _0x26cbf1=_0x289406?0x0:_0x5d4309[_0x13f7('0x15')];var _0x3ddeda=_0x289406?_0x5337a3['count']:_0x5d4309[_0x13f7('0x15')]+_0x5d4309[_0x13f7('0x13')];var _0x417104;if(_0x3ddeda>=_0x4e301c){_0x3ddeda=_0x4e301c;_0x417104=0xc8;}else{_0x417104=0xce;}_0x1b975f[_0x13f7('0x16')](_0x417104);return _0x1b975f[_0x13f7('0x17')](_0x13f7('0x18'),_0x26cbf1+'-'+_0x3ddeda+'/'+_0x4e301c)['json'](_0x5337a3);}return null;};}function patchUpdates(_0x59e70e){return function(_0x244bc8){try{jsonpatch['apply'](_0x244bc8,_0x59e70e,!![]);}catch(_0x39a413){return BPromise['reject'](_0x39a413);}return _0x244bc8['save']();};}function saveUpdates(_0x32a305,_0xa6d664){return function(_0x48eeee){if(_0x48eeee){return _0x48eeee[_0x13f7('0x19')](_0x32a305)[_0x13f7('0x1a')](function(_0x478d30){return _0x478d30;});}return null;};}function removeEntity(_0x7246fc,_0x275001){return function(_0x2e8c99){if(_0x2e8c99){return _0x2e8c99['destroy']()[_0x13f7('0x1a')](function(){var _0x11a9f7=_0x2e8c99['get']({'plain':!![]});var _0x5c4154=_0x13f7('0x1b');return db[_0x13f7('0x1c')][_0x13f7('0x1d')]({'where':{'type':_0x5c4154,'resourceId':_0x11a9f7['id']}})[_0x13f7('0x1a')](function(){return _0x2e8c99;});})[_0x13f7('0x1a')](function(){_0x7246fc['status'](0xcc)[_0x13f7('0x1e')]();});}};}function handleEntityNotFound(_0x30e6e4,_0x1e5400){return function(_0x24a490){if(!_0x24a490){_0x30e6e4['sendStatus'](0x194);}return _0x24a490;};}function handleError(_0x2ad863,_0x5bf2a1){_0x5bf2a1=_0x5bf2a1||0x1f4;return function(_0x272bf3){logger[_0x13f7('0x1f')](_0x272bf3['stack']);if(_0x272bf3[_0x13f7('0x20')]){delete _0x272bf3[_0x13f7('0x20')];}_0x2ad863[_0x13f7('0x16')](_0x5bf2a1)[_0x13f7('0x21')](_0x272bf3);};}exports[_0x13f7('0x22')]=function(_0x49377c,_0x5a5ee2){var _0x4e16e9={},_0xc8f27d={},_0x3d23d3={'count':0x0,'rows':[]};var _0x1a8aef=_[_0x13f7('0x23')](db[_0x13f7('0x24')][_0x13f7('0x25')],function(_0x4c9a8d){return{'name':_0x4c9a8d[_0x13f7('0x26')],'type':_0x4c9a8d[_0x13f7('0x27')][_0x13f7('0x28')]};});_0xc8f27d[_0x13f7('0x29')]=_[_0x13f7('0x23')](_0x1a8aef,_0x13f7('0x20'));_0xc8f27d[_0x13f7('0x2a')]=_['keys'](_0x49377c[_0x13f7('0x2a')]);_0xc8f27d[_0x13f7('0x2b')]=_[_0x13f7('0x2c')](_0xc8f27d['model'],_0xc8f27d['query']);_0x4e16e9[_0x13f7('0x2d')]=_['intersection'](_0xc8f27d[_0x13f7('0x29')],qs[_0x13f7('0x2e')](_0x49377c[_0x13f7('0x2a')][_0x13f7('0x2e')]));_0x4e16e9[_0x13f7('0x2d')]=_0x4e16e9[_0x13f7('0x2d')][_0x13f7('0x2f')]?_0x4e16e9[_0x13f7('0x2d')]:_0xc8f27d[_0x13f7('0x29')];if(!_0x49377c[_0x13f7('0x2a')][_0x13f7('0x30')]('nolimit')){_0x4e16e9['limit']=qs['limit'](_0x49377c[_0x13f7('0x2a')]['limit']);_0x4e16e9['offset']=qs['offset'](_0x49377c['query'][_0x13f7('0x15')]);}_0x4e16e9[_0x13f7('0x31')]=qs[_0x13f7('0x32')](_0x49377c[_0x13f7('0x2a')]['sort']);_0x4e16e9[_0x13f7('0x33')]=qs[_0x13f7('0x2b')](_[_0x13f7('0x34')](_0x49377c[_0x13f7('0x2a')],_0xc8f27d[_0x13f7('0x2b')]),_0x1a8aef);if(_0x49377c[_0x13f7('0x2a')]['filter']){_0x4e16e9['where']=_['merge'](_0x4e16e9[_0x13f7('0x33')],{'$or':_[_0x13f7('0x23')](_0x1a8aef,function(_0x2ffa5a){if(_0x2ffa5a[_0x13f7('0x27')]!==_0x13f7('0x35')){var _0x2e7e46={};_0x2e7e46[_0x2ffa5a[_0x13f7('0x20')]]={'$like':'%'+_0x49377c[_0x13f7('0x2a')][_0x13f7('0x36')]+'%'};return _0x2e7e46;}})});}_0x4e16e9=_[_0x13f7('0x37')]({},_0x4e16e9,_0x49377c['options']);var _0x2b8b2d={'where':_0x4e16e9[_0x13f7('0x33')]};return db[_0x13f7('0x24')]['count'](_0x2b8b2d)[_0x13f7('0x1a')](function(_0x265c0b){_0x3d23d3[_0x13f7('0x14')]=_0x265c0b;if(_0x49377c['query'][_0x13f7('0x38')]){_0x4e16e9['include']=[{'all':!![]}];}return db[_0x13f7('0x24')]['findAll'](_0x4e16e9);})[_0x13f7('0x1a')](function(_0x208ad1){_0x3d23d3[_0x13f7('0x39')]=_0x208ad1;return _0x3d23d3;})[_0x13f7('0x1a')](respondWithFilteredResult(_0x5a5ee2,_0x4e16e9))[_0x13f7('0x3a')](handleError(_0x5a5ee2,null));};exports[_0x13f7('0x3b')]=function(_0x22f2bb,_0x6025a){var _0x83af86={'raw':!![],'where':{'id':_0x22f2bb[_0x13f7('0x3c')]['id']}},_0x194e0b={};_0x194e0b['model']=_['keys'](db[_0x13f7('0x24')][_0x13f7('0x25')]);_0x194e0b[_0x13f7('0x2a')]=_[_0x13f7('0x3d')](_0x22f2bb[_0x13f7('0x2a')]);_0x194e0b[_0x13f7('0x2b')]=_[_0x13f7('0x2c')](_0x194e0b[_0x13f7('0x29')],_0x194e0b[_0x13f7('0x2a')]);_0x83af86[_0x13f7('0x2d')]=_[_0x13f7('0x2c')](_0x194e0b[_0x13f7('0x29')],qs[_0x13f7('0x2e')](_0x22f2bb['query'][_0x13f7('0x2e')]));_0x83af86['attributes']=_0x83af86[_0x13f7('0x2d')][_0x13f7('0x2f')]?_0x83af86['attributes']:_0x194e0b[_0x13f7('0x29')];if(_0x22f2bb[_0x13f7('0x2a')][_0x13f7('0x38')]){_0x83af86['include']=[{'all':!![]}];}_0x83af86=_[_0x13f7('0x37')]({},_0x83af86,_0x22f2bb[_0x13f7('0x3e')]);return db['CmContactHasItem'][_0x13f7('0x3f')](_0x83af86)[_0x13f7('0x1a')](handleEntityNotFound(_0x6025a,null))[_0x13f7('0x1a')](respondWithResult(_0x6025a,null))[_0x13f7('0x3a')](handleError(_0x6025a,null));};exports[_0x13f7('0x40')]=function(_0x8c19c7,_0x5f0155){return db[_0x13f7('0x24')][_0x13f7('0x40')](_0x8c19c7[_0x13f7('0x41')],{})[_0x13f7('0x1a')](function(_0x47b494){var _0x5248fa=_0x8c19c7[_0x13f7('0x42')][_0x13f7('0x43')]({'plain':!![]});if(!_0x5248fa)throw new Error(_0x13f7('0x44'));if(_0x5248fa['role']===_0x13f7('0x42')){var _0x260817=_0x47b494[_0x13f7('0x43')]({'plain':!![]});var _0x18462e=_0x13f7('0x1b');return db[_0x13f7('0x45')][_0x13f7('0x3f')]({'where':{'name':_0x18462e,'userProfileId':_0x5248fa[_0x13f7('0x46')]},'raw':!![]})[_0x13f7('0x1a')](function(_0x5c8f0b){if(_0x5c8f0b&&_0x5c8f0b[_0x13f7('0x47')]===0x0){return db[_0x13f7('0x1c')]['create']({'name':_0x260817[_0x13f7('0x20')],'resourceId':_0x260817['id'],'type':_0x5c8f0b[_0x13f7('0x20')],'sectionId':_0x5c8f0b['id']},{})[_0x13f7('0x1a')](function(){return _0x47b494;});}else{return _0x47b494;}})[_0x13f7('0x3a')](function(_0x22f077){logger['error'](_0x13f7('0x48'),_0x22f077);throw _0x22f077;});}return _0x47b494;})[_0x13f7('0x1a')](respondWithResult(_0x5f0155,0xc9))[_0x13f7('0x3a')](handleError(_0x5f0155,null));};exports[_0x13f7('0x19')]=function(_0x26c2f6,_0xad879d){if(_0x26c2f6[_0x13f7('0x41')]['id']){delete _0x26c2f6['body']['id'];}return db[_0x13f7('0x24')][_0x13f7('0x3f')]({'where':{'id':_0x26c2f6['params']['id']}})[_0x13f7('0x1a')](handleEntityNotFound(_0xad879d,null))[_0x13f7('0x1a')](saveUpdates(_0x26c2f6[_0x13f7('0x41')],null))['then'](respondWithResult(_0xad879d,null))[_0x13f7('0x3a')](handleError(_0xad879d,null));};exports[_0x13f7('0x1d')]=function(_0x7d55d4,_0x3373ea){return db[_0x13f7('0x24')][_0x13f7('0x3f')]({'where':{'id':_0x7d55d4['params']['id']}})[_0x13f7('0x1a')](handleEntityNotFound(_0x3373ea,null))[_0x13f7('0x1a')](removeEntity(_0x3373ea,null))[_0x13f7('0x3a')](handleError(_0x3373ea,null));}; \ No newline at end of file +var _0x58a3=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir'];(function(_0x5df5df,_0x7c3836){var _0x728577=function(_0x357425){while(--_0x357425){_0x5df5df['push'](_0x5df5df['shift']());}};_0x728577(++_0x7c3836);}(_0x58a3,0xa5));var _0x358a=function(_0x4350c2,_0x112f3c){_0x4350c2=_0x4350c2-0x0;var _0x8b6406=_0x58a3[_0x4350c2];return _0x8b6406;};'use strict';var emlformat=require(_0x358a('0x0'));var rimraf=require(_0x358a('0x1'));var zipdir=require(_0x358a('0x2'));var jsonpatch=require(_0x358a('0x3'));var rp=require(_0x358a('0x4'));var moment=require(_0x358a('0x5'));var BPromise=require(_0x358a('0x6'));var Mustache=require(_0x358a('0x7'));var util=require(_0x358a('0x8'));var path=require('path');var sox=require(_0x358a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x358a('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x358a('0xb'));var jsforce=require(_0x358a('0xc'));var deskjs=require(_0x358a('0xd'));var toCsv=require('to-csv');var querystring=require(_0x358a('0xe'));var Papa=require(_0x358a('0xf'));var Redis=require(_0x358a('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x358a('0x11'));var as=require(_0x358a('0x12'));var hardwareService=require(_0x358a('0x13'));var logger=require(_0x358a('0x14'))('api');var utils=require(_0x358a('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x358a('0x16'));var db=require(_0x358a('0x17'))['db'];function respondWithStatusCode(_0x4dc44e,_0x43ecac){_0x43ecac=_0x43ecac||0xcc;return function(_0x5d4a65){if(_0x5d4a65){return _0x4dc44e[_0x358a('0x18')](_0x43ecac);}return _0x4dc44e[_0x358a('0x19')](_0x43ecac)[_0x358a('0x1a')]();};}function respondWithResult(_0x4b4225,_0x2a65c7){_0x2a65c7=_0x2a65c7||0xc8;return function(_0x3d3c23){if(_0x3d3c23){return _0x4b4225[_0x358a('0x19')](_0x2a65c7)[_0x358a('0x1b')](_0x3d3c23);}};}function respondWithFilteredResult(_0x2a844d,_0x5ed07c){return function(_0x5476fa){if(_0x5476fa){var _0x44e9ab=typeof _0x5ed07c[_0x358a('0x1c')]===_0x358a('0x1d')&&typeof _0x5ed07c[_0x358a('0x1e')]===_0x358a('0x1d');var _0x5a89b3=_0x5476fa[_0x358a('0x1f')];var _0xc7f96f=_0x44e9ab?0x0:_0x5ed07c['offset'];var _0x2a2e7a=_0x44e9ab?_0x5476fa[_0x358a('0x1f')]:_0x5ed07c['offset']+_0x5ed07c[_0x358a('0x1e')];var _0x5dff66;if(_0x2a2e7a>=_0x5a89b3){_0x2a2e7a=_0x5a89b3;_0x5dff66=0xc8;}else{_0x5dff66=0xce;}_0x2a844d[_0x358a('0x19')](_0x5dff66);return _0x2a844d[_0x358a('0x20')](_0x358a('0x21'),_0xc7f96f+'-'+_0x2a2e7a+'/'+_0x5a89b3)[_0x358a('0x1b')](_0x5476fa);}return null;};}function patchUpdates(_0x328163){return function(_0x870515){try{jsonpatch[_0x358a('0x22')](_0x870515,_0x328163,!![]);}catch(_0x4aaef5){return BPromise[_0x358a('0x23')](_0x4aaef5);}return _0x870515[_0x358a('0x24')]();};}function saveUpdates(_0x3da300,_0x5ecd92){return function(_0x430651){if(_0x430651){return _0x430651[_0x358a('0x25')](_0x3da300)[_0x358a('0x26')](function(_0x4c31a2){return _0x4c31a2;});}return null;};}function removeEntity(_0x5f026b,_0xb9723c){return function(_0xd1fa1a){if(_0xd1fa1a){return _0xd1fa1a[_0x358a('0x27')]()['then'](function(){var _0x228817=_0xd1fa1a['get']({'plain':!![]});var _0x21df2c=_0x358a('0x28');return db[_0x358a('0x29')][_0x358a('0x27')]({'where':{'type':_0x21df2c,'resourceId':_0x228817['id']}})[_0x358a('0x26')](function(){return _0xd1fa1a;});})[_0x358a('0x26')](function(){_0x5f026b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x487d0f,_0x20e17c){return function(_0x5df57b){if(!_0x5df57b){_0x487d0f['sendStatus'](0x194);}return _0x5df57b;};}function handleError(_0x405641,_0x54eb1c){_0x54eb1c=_0x54eb1c||0x1f4;return function(_0xfd2bc9){logger[_0x358a('0x2a')](_0xfd2bc9[_0x358a('0x2b')]);if(_0xfd2bc9[_0x358a('0x2c')]){delete _0xfd2bc9[_0x358a('0x2c')];}_0x405641['status'](_0x54eb1c)[_0x358a('0x2d')](_0xfd2bc9);};}exports[_0x358a('0x2e')]=function(_0x243aee,_0x13977f){var _0x4805c5={},_0x206fc1={},_0x2752bd={'count':0x0,'rows':[]};var _0x3ba3be=_[_0x358a('0x2f')](db[_0x358a('0x30')][_0x358a('0x31')],function(_0x39725a){return{'name':_0x39725a['fieldName'],'type':_0x39725a[_0x358a('0x32')][_0x358a('0x33')]};});_0x206fc1[_0x358a('0x34')]=_['map'](_0x3ba3be,_0x358a('0x2c'));_0x206fc1['query']=_[_0x358a('0x35')](_0x243aee[_0x358a('0x36')]);_0x206fc1[_0x358a('0x37')]=_[_0x358a('0x38')](_0x206fc1[_0x358a('0x34')],_0x206fc1[_0x358a('0x36')]);_0x4805c5[_0x358a('0x39')]=_[_0x358a('0x38')](_0x206fc1[_0x358a('0x34')],qs['fields'](_0x243aee['query'][_0x358a('0x3a')]));_0x4805c5[_0x358a('0x39')]=_0x4805c5[_0x358a('0x39')]['length']?_0x4805c5[_0x358a('0x39')]:_0x206fc1[_0x358a('0x34')];if(!_0x243aee[_0x358a('0x36')][_0x358a('0x3b')]('nolimit')){_0x4805c5[_0x358a('0x1e')]=qs[_0x358a('0x1e')](_0x243aee['query'][_0x358a('0x1e')]);_0x4805c5[_0x358a('0x1c')]=qs[_0x358a('0x1c')](_0x243aee[_0x358a('0x36')]['offset']);}_0x4805c5[_0x358a('0x3c')]=qs['sort'](_0x243aee[_0x358a('0x36')]['sort']);_0x4805c5[_0x358a('0x3d')]=qs[_0x358a('0x37')](_[_0x358a('0x3e')](_0x243aee[_0x358a('0x36')],_0x206fc1['filters']),_0x3ba3be);if(_0x243aee[_0x358a('0x36')][_0x358a('0x3f')]){_0x4805c5[_0x358a('0x3d')]=_[_0x358a('0x40')](_0x4805c5[_0x358a('0x3d')],{'$or':_[_0x358a('0x2f')](_0x3ba3be,function(_0x595848){if(_0x595848[_0x358a('0x32')]!==_0x358a('0x41')){var _0x38af3f={};_0x38af3f[_0x595848['name']]={'$like':'%'+_0x243aee[_0x358a('0x36')][_0x358a('0x3f')]+'%'};return _0x38af3f;}})});}_0x4805c5=_[_0x358a('0x40')]({},_0x4805c5,_0x243aee[_0x358a('0x42')]);var _0x169fe5={'where':_0x4805c5[_0x358a('0x3d')]};return db[_0x358a('0x30')]['count'](_0x169fe5)['then'](function(_0xa6f729){_0x2752bd[_0x358a('0x1f')]=_0xa6f729;if(_0x243aee[_0x358a('0x36')][_0x358a('0x43')]){_0x4805c5[_0x358a('0x44')]=[{'all':!![]}];}return db[_0x358a('0x30')][_0x358a('0x45')](_0x4805c5);})[_0x358a('0x26')](function(_0x1bef94){_0x2752bd[_0x358a('0x46')]=_0x1bef94;return _0x2752bd;})[_0x358a('0x26')](respondWithFilteredResult(_0x13977f,_0x4805c5))['catch'](handleError(_0x13977f,null));};exports['show']=function(_0x108b5b,_0x1fd953){var _0x49e3a9={'raw':!![],'where':{'id':_0x108b5b[_0x358a('0x47')]['id']}},_0x3fd8c8={};_0x3fd8c8[_0x358a('0x34')]=_[_0x358a('0x35')](db[_0x358a('0x30')][_0x358a('0x31')]);_0x3fd8c8[_0x358a('0x36')]=_[_0x358a('0x35')](_0x108b5b[_0x358a('0x36')]);_0x3fd8c8[_0x358a('0x37')]=_[_0x358a('0x38')](_0x3fd8c8[_0x358a('0x34')],_0x3fd8c8[_0x358a('0x36')]);_0x49e3a9[_0x358a('0x39')]=_[_0x358a('0x38')](_0x3fd8c8[_0x358a('0x34')],qs[_0x358a('0x3a')](_0x108b5b[_0x358a('0x36')]['fields']));_0x49e3a9['attributes']=_0x49e3a9['attributes']['length']?_0x49e3a9[_0x358a('0x39')]:_0x3fd8c8[_0x358a('0x34')];if(_0x108b5b[_0x358a('0x36')]['includeAll']){_0x49e3a9[_0x358a('0x44')]=[{'all':!![]}];}_0x49e3a9=_[_0x358a('0x40')]({},_0x49e3a9,_0x108b5b[_0x358a('0x42')]);return db[_0x358a('0x30')][_0x358a('0x48')](_0x49e3a9)[_0x358a('0x26')](handleEntityNotFound(_0x1fd953,null))['then'](respondWithResult(_0x1fd953,null))[_0x358a('0x49')](handleError(_0x1fd953,null));};exports['create']=function(_0x59190b,_0x1a7719){return db[_0x358a('0x30')]['create'](_0x59190b[_0x358a('0x4a')],{})[_0x358a('0x26')](function(_0x2a893d){var _0x528798=_0x59190b[_0x358a('0x4b')][_0x358a('0x4c')]({'plain':!![]});if(!_0x528798)throw new Error(_0x358a('0x4d'));if(_0x528798[_0x358a('0x4e')]==='user'){var _0x2f0a61=_0x2a893d[_0x358a('0x4c')]({'plain':!![]});var _0x488470='CmContactHasItems';return db[_0x358a('0x4f')]['find']({'where':{'name':_0x488470,'userProfileId':_0x528798[_0x358a('0x50')]},'raw':!![]})[_0x358a('0x26')](function(_0x225289){if(_0x225289&&_0x225289[_0x358a('0x51')]===0x0){return db[_0x358a('0x29')][_0x358a('0x52')]({'name':_0x2f0a61['name'],'resourceId':_0x2f0a61['id'],'type':_0x225289[_0x358a('0x2c')],'sectionId':_0x225289['id']},{})[_0x358a('0x26')](function(){return _0x2a893d;});}else{return _0x2a893d;}})[_0x358a('0x49')](function(_0x102cb6){logger[_0x358a('0x2a')](_0x358a('0x53'),_0x102cb6);throw _0x102cb6;});}return _0x2a893d;})[_0x358a('0x26')](respondWithResult(_0x1a7719,0xc9))[_0x358a('0x49')](handleError(_0x1a7719,null));};exports[_0x358a('0x25')]=function(_0x385491,_0x25e8f8){if(_0x385491['body']['id']){delete _0x385491[_0x358a('0x4a')]['id'];}return db[_0x358a('0x30')][_0x358a('0x48')]({'where':{'id':_0x385491[_0x358a('0x47')]['id']}})[_0x358a('0x26')](handleEntityNotFound(_0x25e8f8,null))[_0x358a('0x26')](saveUpdates(_0x385491[_0x358a('0x4a')],null))[_0x358a('0x26')](respondWithResult(_0x25e8f8,null))[_0x358a('0x49')](handleError(_0x25e8f8,null));};exports[_0x358a('0x27')]=function(_0x298ba6,_0x37f992){return db[_0x358a('0x30')][_0x358a('0x48')]({'where':{'id':_0x298ba6[_0x358a('0x47')]['id']}})[_0x358a('0x26')](handleEntityNotFound(_0x37f992,null))[_0x358a('0x26')](removeEntity(_0x37f992,null))[_0x358a('0x49')](handleError(_0x37f992,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index ac26d60..2762e1a 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 _0xf350=['./cmContactHasItem.attributes','define','CmContactHasItem','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xf350,0x1f1));var _0x0f35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xf350[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x0f35('0x0'));var util=require(_0x0f35('0x1'));var logger=require(_0x0f35('0x2'))(_0x0f35('0x3'));var moment=require(_0x0f35('0x4'));var BPromise=require(_0x0f35('0x5'));var rp=require(_0x0f35('0x6'));var fs=require('fs');var path=require(_0x0f35('0x7'));var rimraf=require(_0x0f35('0x8'));var config=require(_0x0f35('0x9'));var attributes=require(_0x0f35('0xa'));module['exports']=function(_0x5b4fa6,_0x1e2cec){return _0x5b4fa6[_0x0f35('0xb')](_0x0f35('0xc'),attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a24=['path','rimraf','../../config/environment','define','cm_contact_has_items','util','../../config/logger','moment','bluebird','request-promise'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x7a24,0xa5));var _0x47a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7a24[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x47a2('0x0'));var logger=require(_0x47a2('0x1'))('api');var moment=require(_0x47a2('0x2'));var BPromise=require(_0x47a2('0x3'));var rp=require(_0x47a2('0x4'));var fs=require('fs');var path=require(_0x47a2('0x5'));var rimraf=require(_0x47a2('0x6'));var config=require(_0x47a2('0x7'));var attributes=require('./cmContactHasItem.attributes');module['exports']=function(_0xd9c192,_0x30d134){return _0xd9c192[_0x47a2('0x8')]('CmContactHasItem',attributes,{'tableName':_0x47a2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 4bca172..982f17c 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 _0x0284=['catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','info','message'];(function(_0x2ca9d4,_0x51d5c6){var _0x258956=function(_0x47a0e5){while(--_0x47a0e5){_0x2ca9d4['push'](_0x2ca9d4['shift']());}};_0x258956(++_0x51d5c6);}(_0x0284,0x65));var _0x4028=function(_0x28f32c,_0x4cc342){_0x28f32c=_0x28f32c-0x0;var _0x355402=_0x0284[_0x28f32c];return _0x355402;};'use strict';var _=require(_0x4028('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4028('0x1'));var rs=require(_0x4028('0x2'));var fs=require('fs');var Redis=require(_0x4028('0x3'));var db=require(_0x4028('0x4'))['db'];var utils=require(_0x4028('0x5'));var logger=require(_0x4028('0x6'))(_0x4028('0x7'));var config=require('../../config/environment');var jayson=require(_0x4028('0x8'));var client=jayson[_0x4028('0x9')][_0x4028('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b7c11,_0x5eea6f,_0x3b2a61){return new BPromise(function(_0x5afaf8,_0x156bdc){return client['request'](_0x2b7c11,_0x3b2a61)['then'](function(_0x5818a9){logger['info'](_0x4028('0xb'),_0x5eea6f,_0x4028('0xc'));logger[_0x4028('0xd')]('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x5eea6f,_0x4028('0xc'),JSON[_0x4028('0xe')](_0x5818a9));if(_0x5818a9['error']){if(_0x5818a9[_0x4028('0xf')][_0x4028('0x10')]===0x1f4){logger[_0x4028('0xf')](_0x4028('0xb'),_0x5eea6f,_0x5818a9[_0x4028('0xf')]['message']);return _0x156bdc(_0x5818a9['error']['message']);}logger[_0x4028('0xf')](_0x4028('0xb'),_0x5eea6f,_0x5818a9[_0x4028('0xf')]['message']);return _0x5afaf8(_0x5818a9[_0x4028('0xf')]['message']);}else{logger[_0x4028('0x11')](_0x4028('0xb'),_0x5eea6f,_0x4028('0xc'));_0x5afaf8(_0x5818a9['result'][_0x4028('0x12')]);}})[_0x4028('0x13')](function(_0x16f629){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x5eea6f,_0x16f629);_0x156bdc(_0x16f629);});});} \ No newline at end of file +var _0x9720=['request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http'];(function(_0x22e34b,_0x564b45){var _0x374b0e=function(_0x3fa8d5){while(--_0x3fa8d5){_0x22e34b['push'](_0x22e34b['shift']());}};_0x374b0e(++_0x564b45);}(_0x9720,0xd2));var _0x0972=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9720[_0x4a9fb1];return _0x348672;};'use strict';var _=require('lodash');var util=require(_0x0972('0x0'));var moment=require(_0x0972('0x1'));var BPromise=require(_0x0972('0x2'));var rs=require(_0x0972('0x3'));var fs=require('fs');var Redis=require(_0x0972('0x4'));var db=require(_0x0972('0x5'))['db'];var utils=require(_0x0972('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0972('0x7'));var client=jayson[_0x0972('0x8')][_0x0972('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5155a0,_0xea7ecc,_0x2d9e38){return new BPromise(function(_0x5daa1d,_0x193c68){return client[_0x0972('0xa')](_0x5155a0,_0x2d9e38)[_0x0972('0xb')](function(_0x2cc547){logger[_0x0972('0xc')](_0x0972('0xd'),_0xea7ecc,'request\x20sent');logger[_0x0972('0xe')](_0x0972('0xf'),_0xea7ecc,_0x0972('0x10'),JSON['stringify'](_0x2cc547));if(_0x2cc547['error']){if(_0x2cc547[_0x0972('0x11')][_0x0972('0x12')]===0x1f4){logger[_0x0972('0x11')](_0x0972('0xd'),_0xea7ecc,_0x2cc547[_0x0972('0x11')][_0x0972('0x13')]);return _0x193c68(_0x2cc547['error'][_0x0972('0x13')]);}logger[_0x0972('0x11')](_0x0972('0xd'),_0xea7ecc,_0x2cc547[_0x0972('0x11')][_0x0972('0x13')]);return _0x5daa1d(_0x2cc547[_0x0972('0x11')][_0x0972('0x13')]);}else{logger[_0x0972('0xc')](_0x0972('0xd'),_0xea7ecc,_0x0972('0x10'));_0x5daa1d(_0x2cc547[_0x0972('0x14')]['message']);}})[_0x0972('0x15')](function(_0x5697b9){logger['error'](_0x0972('0xd'),_0xea7ecc,_0x5697b9);_0x193c68(_0x5697b9);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 99df555..a3a9ef8 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 _0xab97=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','create','put','delete','exports','multer','path'];(function(_0x182073,_0x5f40d5){var _0x4df826=function(_0xcf01b0){while(--_0xcf01b0){_0x182073['push'](_0x182073['shift']());}};_0x4df826(++_0x5f40d5);}(_0xab97,0x1b1));var _0x7ab9=function(_0x12d47f,_0x267023){_0x12d47f=_0x12d47f-0x0;var _0x41f81b=_0xab97[_0x12d47f];return _0x41f81b;};'use strict';var multer=require(_0x7ab9('0x0'));var util=require('util');var path=require(_0x7ab9('0x1'));var timeout=require(_0x7ab9('0x2'));var express=require('express');var router=express[_0x7ab9('0x3')]();var fs_extra=require(_0x7ab9('0x4'));var auth=require(_0x7ab9('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7ab9('0x6'));var controller=require('./cmContactHasItem.controller');router[_0x7ab9('0x7')]('/',auth[_0x7ab9('0x8')](),controller[_0x7ab9('0x9')]);router['get'](_0x7ab9('0xa'),auth[_0x7ab9('0x8')](),controller['show']);router['post']('/',auth[_0x7ab9('0x8')](),controller[_0x7ab9('0xb')]);router[_0x7ab9('0xc')]('/:id',auth[_0x7ab9('0x8')](),controller['update']);router[_0x7ab9('0xd')](_0x7ab9('0xa'),auth[_0x7ab9('0x8')](),controller['destroy']);module[_0x7ab9('0xe')]=router; \ No newline at end of file +var _0x40e8=['../../config/environment','get','index','/:id','isAuthenticated','post','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x40e8,0x1d5));var _0x840e=function(_0x403c8d,_0x5e3825){_0x403c8d=_0x403c8d-0x0;var _0x4ca60d=_0x40e8[_0x403c8d];return _0x4ca60d;};'use strict';var multer=require('multer');var util=require(_0x840e('0x0'));var path=require(_0x840e('0x1'));var timeout=require(_0x840e('0x2'));var express=require('express');var router=express[_0x840e('0x3')]();var fs_extra=require(_0x840e('0x4'));var auth=require(_0x840e('0x5'));var interaction=require(_0x840e('0x6'));var config=require(_0x840e('0x7'));var controller=require('./cmContactHasItem.controller');router[_0x840e('0x8')]('/',auth['isAuthenticated'](),controller[_0x840e('0x9')]);router[_0x840e('0x8')](_0x840e('0xa'),auth[_0x840e('0xb')](),controller['show']);router[_0x840e('0xc')]('/',auth[_0x840e('0xb')](),controller['create']);router[_0x840e('0xd')](_0x840e('0xa'),auth[_0x840e('0xb')](),controller[_0x840e('0xe')]);router['delete'](_0x840e('0xa'),auth[_0x840e('0xb')](),controller[_0x840e('0xf')]);module[_0x840e('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index bf86128..d940d80 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 _0xffc7=['sequelize','lodash','exports','VIRTUAL','STRING','alias','name','TEXT','long','getDataValue','select','parse','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','voice'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xffc7,0xe4));var _0x7ffc=function(_0x2f7f59,_0x43d247){_0x2f7f59=_0x2f7f59-0x0;var _0x712d81=_0xffc7[_0x2f7f59];return _0x712d81;};'use strict';var Sequelize=require(_0x7ffc('0x0'));var _=require(_0x7ffc('0x1'));module[_0x7ffc('0x2')]={'name':{'type':Sequelize[_0x7ffc('0x3')],'get':function(_0xe2f71a){return this['getDataValue']('alias');}},'alias':{'type':Sequelize[_0x7ffc('0x4')],'allowNull':![],'set':function(_0x256a02){this['setDataValue'](_0x7ffc('0x5'),_0x256a02?_0x256a02:this['getDataValue'](_0x7ffc('0x6')));}},'type':{'type':Sequelize[_0x7ffc('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x7ffc('0x7')](_0x7ffc('0x8')),'get':function(){if(this[_0x7ffc('0x9')]('type')===_0x7ffc('0xa')){return JSON[_0x7ffc('0xb')](this['getDataValue']('values'));}else{return this[_0x7ffc('0x9')](_0x7ffc('0xc'));}},'set':function(_0xdbaf86){if(Array[_0x7ffc('0xd')](_0xdbaf86)){this[_0x7ffc('0xe')](_0x7ffc('0xc'),JSON[_0x7ffc('0xf')](_0xdbaf86));}else{this[_0x7ffc('0xe')](_0x7ffc('0xc'),_0xdbaf86);}}},'required':{'type':Sequelize[_0x7ffc('0x10')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7ffc('0x11')](_0x7ffc('0x12'))}}; \ No newline at end of file +var _0x82d3=['BOOLEAN','voice','exports','VIRTUAL','getDataValue','STRING','setDataValue','alias','name','TEXT','long','type','parse','values'];(function(_0xe3a3fa,_0x4a6be2){var _0x5f2c72=function(_0x3212dd){while(--_0x3212dd){_0xe3a3fa['push'](_0xe3a3fa['shift']());}};_0x5f2c72(++_0x4a6be2);}(_0x82d3,0xe2));var _0x382d=function(_0x3f6133,_0x2b2928){_0x3f6133=_0x3f6133-0x0;var _0x4602a0=_0x82d3[_0x3f6133];return _0x4602a0;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');module[_0x382d('0x0')]={'name':{'type':Sequelize[_0x382d('0x1')],'get':function(_0x2b24fb){return this[_0x382d('0x2')]('alias');}},'alias':{'type':Sequelize[_0x382d('0x3')],'allowNull':![],'set':function(_0x9dd209){this[_0x382d('0x4')](_0x382d('0x5'),_0x9dd209?_0x9dd209:this[_0x382d('0x2')](_0x382d('0x6')));}},'type':{'type':Sequelize[_0x382d('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x382d('0x7')](_0x382d('0x8')),'get':function(){if(this[_0x382d('0x2')](_0x382d('0x9'))==='select'){return JSON[_0x382d('0xa')](this[_0x382d('0x2')](_0x382d('0xb')));}else{return this[_0x382d('0x2')](_0x382d('0xb'));}},'set':function(_0x3b93f2){if(Array['isArray'](_0x3b93f2)){this['setDataValue'](_0x382d('0xb'),JSON['stringify'](_0x3b93f2));}else{this[_0x382d('0x4')](_0x382d('0xb'),_0x3b93f2);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x382d('0xc')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x382d('0xd'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index af61f2a..6a7353e 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 _0x4715=['merge','VIRTUAL','options','CmCustomField','include','rows','show','params','keys','includeAll','find','catch','body','create','transaction','text','Sequelize','INTEGER','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','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','undefined','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack','name','send','map','rawAttributes','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4715,0x121));var _0x5471=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4715[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x5471('0x0'));var rimraf=require(_0x5471('0x1'));var zipdir=require(_0x5471('0x2'));var jsonpatch=require(_0x5471('0x3'));var rp=require(_0x5471('0x4'));var moment=require(_0x5471('0x5'));var BPromise=require(_0x5471('0x6'));var Mustache=require(_0x5471('0x7'));var util=require(_0x5471('0x8'));var path=require(_0x5471('0x9'));var sox=require(_0x5471('0xa'));var csv=require(_0x5471('0xb'));var ejs=require(_0x5471('0xc'));var fs=require('fs');var fs_extra=require(_0x5471('0xd'));var _=require('lodash');var squel=require(_0x5471('0xe'));var crypto=require(_0x5471('0xf'));var jsforce=require(_0x5471('0x10'));var deskjs=require(_0x5471('0x11'));var toCsv=require(_0x5471('0xb'));var querystring=require('querystring');var Papa=require(_0x5471('0x12'));var Redis=require('ioredis');var authService=require(_0x5471('0x13'));var qs=require(_0x5471('0x14'));var as=require(_0x5471('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5471('0x16'))(_0x5471('0x17'));var utils=require(_0x5471('0x18'));var config=require(_0x5471('0x19'));var licenseUtil=require(_0x5471('0x1a'));var db=require(_0x5471('0x1b'))['db'];function respondWithStatusCode(_0x15144e,_0x3ac6a9){_0x3ac6a9=_0x3ac6a9||0xcc;return function(_0x50ca7d){if(_0x50ca7d){return _0x15144e[_0x5471('0x1c')](_0x3ac6a9);}return _0x15144e[_0x5471('0x1d')](_0x3ac6a9)[_0x5471('0x1e')]();};}function respondWithResult(_0x5b37ca,_0x2f53fe){_0x2f53fe=_0x2f53fe||0xc8;return function(_0x48b947){if(_0x48b947){return _0x5b37ca['status'](_0x2f53fe)[_0x5471('0x1f')](_0x48b947);}};}function respondWithFilteredResult(_0x35e942,_0x52b976){return function(_0x525de5){if(_0x525de5){var _0x65c07b=typeof _0x52b976['offset']===_0x5471('0x20')&&typeof _0x52b976['limit']===_0x5471('0x20');var _0x5dcf6c=_0x525de5[_0x5471('0x21')];var _0x18c9ae=_0x65c07b?0x0:_0x52b976[_0x5471('0x22')];var _0x5f01a4=_0x65c07b?_0x525de5['count']:_0x52b976[_0x5471('0x22')]+_0x52b976[_0x5471('0x23')];var _0x4d3eb6;if(_0x5f01a4>=_0x5dcf6c){_0x5f01a4=_0x5dcf6c;_0x4d3eb6=0xc8;}else{_0x4d3eb6=0xce;}_0x35e942['status'](_0x4d3eb6);return _0x35e942['set'](_0x5471('0x24'),_0x18c9ae+'-'+_0x5f01a4+'/'+_0x5dcf6c)[_0x5471('0x1f')](_0x525de5);}return null;};}function patchUpdates(_0x8690cc){return function(_0x1d6918){try{jsonpatch[_0x5471('0x25')](_0x1d6918,_0x8690cc,!![]);}catch(_0xd543){return BPromise[_0x5471('0x26')](_0xd543);}return _0x1d6918[_0x5471('0x27')]();};}function saveUpdates(_0x38479b,_0x5be490){return function(_0x186e03){if(_0x186e03){return _0x186e03['update'](_0x38479b)[_0x5471('0x28')](function(_0x173ea0){return _0x173ea0;});}return null;};}function removeEntity(_0x3dfc5c,_0x1d07fd){return function(_0x3c247c){if(_0x3c247c){return _0x3c247c[_0x5471('0x29')]()[_0x5471('0x28')](function(){_0x3dfc5c[_0x5471('0x1d')](0xcc)[_0x5471('0x1e')]();});}};}function handleEntityNotFound(_0x16c00d,_0x2beb42){return function(_0x44bcb5){if(!_0x44bcb5){_0x16c00d[_0x5471('0x1c')](0x194);}return _0x44bcb5;};}function handleError(_0x3f0f04,_0x203e3d){_0x203e3d=_0x203e3d||0x1f4;return function(_0x3d7f2b){logger['error'](_0x3d7f2b[_0x5471('0x2a')]);if(_0x3d7f2b[_0x5471('0x2b')]){delete _0x3d7f2b[_0x5471('0x2b')];}_0x3f0f04['status'](_0x203e3d)[_0x5471('0x2c')](_0x3d7f2b);};}exports['index']=function(_0x47e232,_0xd01e09){var _0x1153bd={},_0x1746e1={},_0x3aae15={'count':0x0,'rows':[]};var _0x3001fd=_[_0x5471('0x2d')](db['CmCustomField'][_0x5471('0x2e')],function(_0x3b360e){return{'name':_0x3b360e['fieldName'],'type':_0x3b360e[_0x5471('0x2f')][_0x5471('0x30')]};});_0x1746e1[_0x5471('0x31')]=_['differenceBy'](_['map'](_0x3001fd,_0x5471('0x2b')),[_0x5471('0x2b')]);_0x1746e1[_0x5471('0x32')]=_['keys'](_0x47e232['query']);_0x1746e1['filters']=_[_0x5471('0x33')](_0x1746e1['model'],_0x1746e1['query']);_0x1153bd['attributes']=_[_0x5471('0x33')](_0x1746e1['model'],qs['fields'](_0x47e232[_0x5471('0x32')][_0x5471('0x34')]));_0x1153bd[_0x5471('0x35')]=_0x1153bd[_0x5471('0x35')][_0x5471('0x36')]?_0x1153bd[_0x5471('0x35')]:_0x1746e1[_0x5471('0x31')];if(!_0x47e232[_0x5471('0x32')][_0x5471('0x37')](_0x5471('0x38'))){_0x1153bd['limit']=qs['limit'](_0x47e232[_0x5471('0x32')][_0x5471('0x23')]);_0x1153bd['offset']=qs[_0x5471('0x22')](_0x47e232[_0x5471('0x32')]['offset']);}_0x1153bd[_0x5471('0x39')]=qs[_0x5471('0x3a')](_0x47e232[_0x5471('0x32')]['sort']);_0x1153bd[_0x5471('0x3b')]=qs[_0x5471('0x3c')](_[_0x5471('0x3d')](_0x47e232[_0x5471('0x32')],_0x1746e1['filters']),_0x3001fd);if(_0x47e232[_0x5471('0x32')][_0x5471('0x3e')]){_0x1153bd[_0x5471('0x3b')]=_[_0x5471('0x3f')](_0x1153bd[_0x5471('0x3b')],{'$or':_[_0x5471('0x2d')](_0x3001fd,function(_0xa910e1){if(_0xa910e1[_0x5471('0x2f')]!==_0x5471('0x40')){var _0x25611d={};_0x25611d[_0xa910e1[_0x5471('0x2b')]]={'$like':'%'+_0x47e232[_0x5471('0x32')][_0x5471('0x3e')]+'%'};return _0x25611d;}})});}_0x1153bd=_['merge']({},_0x1153bd,_0x47e232[_0x5471('0x41')]);var _0x4459a0={'where':_0x1153bd[_0x5471('0x3b')]};return db[_0x5471('0x42')][_0x5471('0x21')](_0x4459a0)['then'](function(_0x98d483){_0x3aae15['count']=_0x98d483;if(_0x47e232[_0x5471('0x32')]['includeAll']){_0x1153bd[_0x5471('0x43')]=[{'all':!![]}];}return db[_0x5471('0x42')]['findAll'](_0x1153bd);})[_0x5471('0x28')](function(_0x599a51){_0x3aae15[_0x5471('0x44')]=_0x599a51;return _0x3aae15;})[_0x5471('0x28')](respondWithFilteredResult(_0xd01e09,_0x1153bd))['catch'](handleError(_0xd01e09,null));};exports[_0x5471('0x45')]=function(_0x4a30d0,_0x35ada4){var _0x4a79d8={'raw':!![],'where':{'id':_0x4a30d0[_0x5471('0x46')]['id']}},_0xd159eb={};_0xd159eb[_0x5471('0x31')]=_['keys'](db['CmCustomField'][_0x5471('0x2e')]);_0xd159eb[_0x5471('0x32')]=_[_0x5471('0x47')](_0x4a30d0[_0x5471('0x32')]);_0xd159eb[_0x5471('0x3c')]=_[_0x5471('0x33')](_0xd159eb[_0x5471('0x31')],_0xd159eb[_0x5471('0x32')]);_0x4a79d8[_0x5471('0x35')]=_[_0x5471('0x33')](_0xd159eb[_0x5471('0x31')],qs[_0x5471('0x34')](_0x4a30d0[_0x5471('0x32')][_0x5471('0x34')]));_0x4a79d8[_0x5471('0x35')]=_0x4a79d8[_0x5471('0x35')]['length']?_0x4a79d8[_0x5471('0x35')]:_0xd159eb[_0x5471('0x31')];if(_0x4a30d0[_0x5471('0x32')][_0x5471('0x48')]){_0x4a79d8[_0x5471('0x43')]=[{'all':!![]}];}_0x4a79d8=_[_0x5471('0x3f')]({},_0x4a79d8,_0x4a30d0[_0x5471('0x41')]);return db[_0x5471('0x42')][_0x5471('0x49')](_0x4a79d8)[_0x5471('0x28')](handleEntityNotFound(_0x35ada4,null))[_0x5471('0x28')](respondWithResult(_0x35ada4,null))[_0x5471('0x4a')](handleError(_0x35ada4,null));};exports['update']=function(_0x119436,_0x5aeaff){if(_0x119436[_0x5471('0x4b')]['id']){delete _0x119436[_0x5471('0x4b')]['id'];}return db[_0x5471('0x42')][_0x5471('0x49')]({'where':{'id':_0x119436[_0x5471('0x46')]['id']}})['then'](handleEntityNotFound(_0x5aeaff,null))[_0x5471('0x28')](saveUpdates(_0x119436[_0x5471('0x4b')],null))[_0x5471('0x28')](respondWithResult(_0x5aeaff,null))['catch'](handleError(_0x5aeaff,null));};exports[_0x5471('0x29')]=function(_0x520627,_0x14c064){return db[_0x5471('0x42')][_0x5471('0x49')]({'where':{'id':_0x520627[_0x5471('0x46')]['id']}})[_0x5471('0x28')](handleEntityNotFound(_0x14c064,null))[_0x5471('0x28')](removeEntity(_0x14c064,null))[_0x5471('0x4a')](handleError(_0x14c064,null));};exports[_0x5471('0x4c')]=function(_0x24848b,_0x4f2583){var _0x11d4d5;return db['sequelize'][_0x5471('0x4d')](function(_0x4ae9ae){return db[_0x5471('0x42')][_0x5471('0x4c')](_0x24848b['body'],{'transaction':_0x4ae9ae})[_0x5471('0x28')](function(_0x2cdeee){_0x11d4d5=_0x2cdeee;var _0x5b8e4c={'type':db['Sequelize']['TEXT'],'transaction':_0x4ae9ae};switch(_0x24848b[_0x5471('0x4b')][_0x5471('0x2f')]){case _0x5471('0x4e'):_0x5b8e4c[_0x5471('0x2f')]=db[_0x5471('0x4f')]['TEXT'];break;case'number':_0x5b8e4c['type']=db[_0x5471('0x4f')][_0x5471('0x50')];break;case'switch':_0x5b8e4c[_0x5471('0x2f')]=db['Sequelize'][_0x5471('0x51')];_0x5b8e4c['defaultValue']=![];break;default:}return db[_0x5471('0x52')][_0x5471('0x53')][_0x5471('0x54')](_0x5471('0x55'),util[_0x5471('0x56')](_0x5471('0x57'),_0x11d4d5['id']),_0x5b8e4c);})[_0x5471('0x28')](function(){return _0x11d4d5;});})[_0x5471('0x28')](respondWithResult(_0x4f2583,0xc9))[_0x5471('0x4a')](handleError(_0x4f2583,null));}; \ No newline at end of file +var _0x3d6e=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','then','destroy','error','index','map','rawAttributes','fieldName','key','differenceBy','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','count','includeAll','include','CmCustomField','findAll','rows','catch','show','find','body','params','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','format','eml-format','rimraf','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x4c36bd,_0x1ea67b){var _0x12c4b2=function(_0x33e6ce){while(--_0x33e6ce){_0x4c36bd['push'](_0x4c36bd['shift']());}};_0x12c4b2(++_0x1ea67b);}(_0x3d6e,0x9a));var _0xe3d6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x3d6e[_0xefd519];return _0x4bb882;};'use strict';var emlformat=require(_0xe3d6('0x0'));var rimraf=require(_0xe3d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3d6('0x2'));var BPromise=require(_0xe3d6('0x3'));var Mustache=require(_0xe3d6('0x4'));var util=require('util');var path=require(_0xe3d6('0x5'));var sox=require('sox');var csv=require(_0xe3d6('0x6'));var ejs=require(_0xe3d6('0x7'));var fs=require('fs');var fs_extra=require(_0xe3d6('0x8'));var _=require(_0xe3d6('0x9'));var squel=require(_0xe3d6('0xa'));var crypto=require(_0xe3d6('0xb'));var jsforce=require(_0xe3d6('0xc'));var deskjs=require(_0xe3d6('0xd'));var toCsv=require(_0xe3d6('0x6'));var querystring=require('querystring');var Papa=require(_0xe3d6('0xe'));var Redis=require(_0xe3d6('0xf'));var authService=require(_0xe3d6('0x10'));var qs=require(_0xe3d6('0x11'));var as=require(_0xe3d6('0x12'));var hardwareService=require(_0xe3d6('0x13'));var logger=require(_0xe3d6('0x14'))(_0xe3d6('0x15'));var utils=require('../../config/utils');var config=require(_0xe3d6('0x16'));var licenseUtil=require(_0xe3d6('0x17'));var db=require(_0xe3d6('0x18'))['db'];function respondWithStatusCode(_0x109c7b,_0x10b0f3){_0x10b0f3=_0x10b0f3||0xcc;return function(_0x24112f){if(_0x24112f){return _0x109c7b[_0xe3d6('0x19')](_0x10b0f3);}return _0x109c7b[_0xe3d6('0x1a')](_0x10b0f3)[_0xe3d6('0x1b')]();};}function respondWithResult(_0x56ea52,_0x525cd4){_0x525cd4=_0x525cd4||0xc8;return function(_0x564b52){if(_0x564b52){return _0x56ea52[_0xe3d6('0x1a')](_0x525cd4)[_0xe3d6('0x1c')](_0x564b52);}};}function respondWithFilteredResult(_0x4f4f7f,_0x2397ae){return function(_0x48648b){if(_0x48648b){var _0x1a8109=typeof _0x2397ae[_0xe3d6('0x1d')]===_0xe3d6('0x1e')&&typeof _0x2397ae['limit']===_0xe3d6('0x1e');var _0x246a28=_0x48648b['count'];var _0x58b0fc=_0x1a8109?0x0:_0x2397ae[_0xe3d6('0x1d')];var _0x5e043f=_0x1a8109?_0x48648b['count']:_0x2397ae[_0xe3d6('0x1d')]+_0x2397ae[_0xe3d6('0x1f')];var _0x2ae645;if(_0x5e043f>=_0x246a28){_0x5e043f=_0x246a28;_0x2ae645=0xc8;}else{_0x2ae645=0xce;}_0x4f4f7f[_0xe3d6('0x1a')](_0x2ae645);return _0x4f4f7f[_0xe3d6('0x20')]('Content-Range',_0x58b0fc+'-'+_0x5e043f+'/'+_0x246a28)[_0xe3d6('0x1c')](_0x48648b);}return null;};}function patchUpdates(_0x5cc6cd){return function(_0x397301){try{jsonpatch[_0xe3d6('0x21')](_0x397301,_0x5cc6cd,!![]);}catch(_0x555b8d){return BPromise['reject'](_0x555b8d);}return _0x397301['save']();};}function saveUpdates(_0x697340,_0x42e52a){return function(_0x197af9){if(_0x197af9){return _0x197af9['update'](_0x697340)[_0xe3d6('0x22')](function(_0xa2de85){return _0xa2de85;});}return null;};}function removeEntity(_0x41b84e,_0x2576d0){return function(_0x288077){if(_0x288077){return _0x288077[_0xe3d6('0x23')]()['then'](function(){_0x41b84e[_0xe3d6('0x1a')](0xcc)[_0xe3d6('0x1b')]();});}};}function handleEntityNotFound(_0x12fba3,_0x4ccfdb){return function(_0x3dfc77){if(!_0x3dfc77){_0x12fba3[_0xe3d6('0x19')](0x194);}return _0x3dfc77;};}function handleError(_0x3a1b93,_0x148cd1){_0x148cd1=_0x148cd1||0x1f4;return function(_0x21afdf){logger[_0xe3d6('0x24')](_0x21afdf['stack']);if(_0x21afdf['name']){delete _0x21afdf['name'];}_0x3a1b93[_0xe3d6('0x1a')](_0x148cd1)['send'](_0x21afdf);};}exports[_0xe3d6('0x25')]=function(_0x58a4a7,_0x3b598b){var _0x27800c={},_0x4b238f={},_0x2bf98f={'count':0x0,'rows':[]};var _0x5abde1=_[_0xe3d6('0x26')](db['CmCustomField'][_0xe3d6('0x27')],function(_0x1dd679){return{'name':_0x1dd679[_0xe3d6('0x28')],'type':_0x1dd679['type'][_0xe3d6('0x29')]};});_0x4b238f['model']=_[_0xe3d6('0x2a')](_['map'](_0x5abde1,_0xe3d6('0x2b')),[_0xe3d6('0x2b')]);_0x4b238f[_0xe3d6('0x2c')]=_[_0xe3d6('0x2d')](_0x58a4a7[_0xe3d6('0x2c')]);_0x4b238f[_0xe3d6('0x2e')]=_[_0xe3d6('0x2f')](_0x4b238f[_0xe3d6('0x30')],_0x4b238f[_0xe3d6('0x2c')]);_0x27800c[_0xe3d6('0x31')]=_[_0xe3d6('0x2f')](_0x4b238f[_0xe3d6('0x30')],qs['fields'](_0x58a4a7['query'][_0xe3d6('0x32')]));_0x27800c['attributes']=_0x27800c[_0xe3d6('0x31')][_0xe3d6('0x33')]?_0x27800c[_0xe3d6('0x31')]:_0x4b238f['model'];if(!_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x34')]('nolimit')){_0x27800c['limit']=qs[_0xe3d6('0x1f')](_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x1f')]);_0x27800c[_0xe3d6('0x1d')]=qs[_0xe3d6('0x1d')](_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x1d')]);}_0x27800c[_0xe3d6('0x35')]=qs['sort'](_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x36')]);_0x27800c[_0xe3d6('0x37')]=qs[_0xe3d6('0x2e')](_['pick'](_0x58a4a7['query'],_0x4b238f[_0xe3d6('0x2e')]),_0x5abde1);if(_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x38')]){_0x27800c[_0xe3d6('0x37')]=_[_0xe3d6('0x39')](_0x27800c[_0xe3d6('0x37')],{'$or':_[_0xe3d6('0x26')](_0x5abde1,function(_0x599460){if(_0x599460[_0xe3d6('0x3a')]!==_0xe3d6('0x3b')){var _0x288826={};_0x288826[_0x599460[_0xe3d6('0x2b')]]={'$like':'%'+_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x38')]+'%'};return _0x288826;}})});}_0x27800c=_['merge']({},_0x27800c,_0x58a4a7[_0xe3d6('0x3c')]);var _0x442fdb={'where':_0x27800c[_0xe3d6('0x37')]};return db['CmCustomField'][_0xe3d6('0x3d')](_0x442fdb)['then'](function(_0x412d6f){_0x2bf98f[_0xe3d6('0x3d')]=_0x412d6f;if(_0x58a4a7[_0xe3d6('0x2c')][_0xe3d6('0x3e')]){_0x27800c[_0xe3d6('0x3f')]=[{'all':!![]}];}return db[_0xe3d6('0x40')][_0xe3d6('0x41')](_0x27800c);})['then'](function(_0x34eace){_0x2bf98f[_0xe3d6('0x42')]=_0x34eace;return _0x2bf98f;})[_0xe3d6('0x22')](respondWithFilteredResult(_0x3b598b,_0x27800c))[_0xe3d6('0x43')](handleError(_0x3b598b,null));};exports[_0xe3d6('0x44')]=function(_0x41da8e,_0x4a3739){var _0x23d2bc={'raw':!![],'where':{'id':_0x41da8e['params']['id']}},_0xcf8397={};_0xcf8397[_0xe3d6('0x30')]=_['keys'](db[_0xe3d6('0x40')]['rawAttributes']);_0xcf8397['query']=_[_0xe3d6('0x2d')](_0x41da8e[_0xe3d6('0x2c')]);_0xcf8397[_0xe3d6('0x2e')]=_[_0xe3d6('0x2f')](_0xcf8397['model'],_0xcf8397[_0xe3d6('0x2c')]);_0x23d2bc['attributes']=_[_0xe3d6('0x2f')](_0xcf8397[_0xe3d6('0x30')],qs[_0xe3d6('0x32')](_0x41da8e[_0xe3d6('0x2c')][_0xe3d6('0x32')]));_0x23d2bc[_0xe3d6('0x31')]=_0x23d2bc[_0xe3d6('0x31')][_0xe3d6('0x33')]?_0x23d2bc[_0xe3d6('0x31')]:_0xcf8397[_0xe3d6('0x30')];if(_0x41da8e[_0xe3d6('0x2c')][_0xe3d6('0x3e')]){_0x23d2bc[_0xe3d6('0x3f')]=[{'all':!![]}];}_0x23d2bc=_[_0xe3d6('0x39')]({},_0x23d2bc,_0x41da8e[_0xe3d6('0x3c')]);return db[_0xe3d6('0x40')][_0xe3d6('0x45')](_0x23d2bc)['then'](handleEntityNotFound(_0x4a3739,null))[_0xe3d6('0x22')](respondWithResult(_0x4a3739,null))['catch'](handleError(_0x4a3739,null));};exports['update']=function(_0x2cf8c7,_0x5891b5){if(_0x2cf8c7[_0xe3d6('0x46')]['id']){delete _0x2cf8c7[_0xe3d6('0x46')]['id'];}return db[_0xe3d6('0x40')][_0xe3d6('0x45')]({'where':{'id':_0x2cf8c7[_0xe3d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x5891b5,null))[_0xe3d6('0x22')](saveUpdates(_0x2cf8c7[_0xe3d6('0x46')],null))[_0xe3d6('0x22')](respondWithResult(_0x5891b5,null))[_0xe3d6('0x43')](handleError(_0x5891b5,null));};exports['destroy']=function(_0x5a5428,_0x142928){return db[_0xe3d6('0x40')][_0xe3d6('0x45')]({'where':{'id':_0x5a5428[_0xe3d6('0x47')]['id']}})[_0xe3d6('0x22')](handleEntityNotFound(_0x142928,null))['then'](removeEntity(_0x142928,null))[_0xe3d6('0x43')](handleError(_0x142928,null));};exports[_0xe3d6('0x48')]=function(_0x1c6545,_0x39302f){var _0xb09749;return db[_0xe3d6('0x49')][_0xe3d6('0x4a')](function(_0x43f82d){return db[_0xe3d6('0x40')][_0xe3d6('0x48')](_0x1c6545['body'],{'transaction':_0x43f82d})['then'](function(_0x10b7ae){_0xb09749=_0x10b7ae;var _0x5c9d18={'type':db[_0xe3d6('0x4b')][_0xe3d6('0x4c')],'transaction':_0x43f82d};switch(_0x1c6545[_0xe3d6('0x46')][_0xe3d6('0x3a')]){case _0xe3d6('0x4d'):_0x5c9d18[_0xe3d6('0x3a')]=db['Sequelize'][_0xe3d6('0x4c')];break;case _0xe3d6('0x4e'):_0x5c9d18[_0xe3d6('0x3a')]=db['Sequelize'][_0xe3d6('0x4f')];break;case _0xe3d6('0x50'):_0x5c9d18[_0xe3d6('0x3a')]=db[_0xe3d6('0x4b')][_0xe3d6('0x51')];_0x5c9d18[_0xe3d6('0x52')]=![];break;default:}return db[_0xe3d6('0x49')][_0xe3d6('0x53')]['addColumn']('cm_contacts',util[_0xe3d6('0x54')]('cf_%d',_0xb09749['id']),_0x5c9d18);})[_0xe3d6('0x22')](function(){return _0xb09749;});})['then'](respondWithResult(_0x39302f,0xc9))[_0xe3d6('0x43')](handleError(_0x39302f,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 1f50219..6163c13 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 _0xa203=['path','rimraf','../../config/environment','./cmCustomField.attributes','exports','define','CmCustomField','cm_custom_fields','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5b176a,_0xa76b85){var _0x35e08c=function(_0x48d140){while(--_0x48d140){_0x5b176a['push'](_0x5b176a['shift']());}};_0x35e08c(++_0xa76b85);}(_0xa203,0xda));var _0x3a20=function(_0x6b91fa,_0x444ed7){_0x6b91fa=_0x6b91fa-0x0;var _0x870a9a=_0xa203[_0x6b91fa];return _0x870a9a;};'use strict';var _=require('lodash');var util=require(_0x3a20('0x0'));var logger=require(_0x3a20('0x1'))(_0x3a20('0x2'));var moment=require(_0x3a20('0x3'));var BPromise=require(_0x3a20('0x4'));var rp=require(_0x3a20('0x5'));var fs=require('fs');var path=require(_0x3a20('0x6'));var rimraf=require(_0x3a20('0x7'));var config=require(_0x3a20('0x8'));var attributes=require(_0x3a20('0x9'));module[_0x3a20('0xa')]=function(_0x5166e2,_0x18f642){return _0x5166e2[_0x3a20('0xb')](_0x3a20('0xc'),attributes,{'tableName':_0x3a20('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb10c=['../../config/logger','bluebird','request-promise','path','../../config/environment','define','cm_custom_fields','lodash','util'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xb10c,0x6a));var _0xcb10=function(_0x4a72a0,_0x2b8292){_0x4a72a0=_0x4a72a0-0x0;var _0x143dd3=_0xb10c[_0x4a72a0];return _0x143dd3;};'use strict';var _=require(_0xcb10('0x0'));var util=require(_0xcb10('0x1'));var logger=require(_0xcb10('0x2'))('api');var moment=require('moment');var BPromise=require(_0xcb10('0x3'));var rp=require(_0xcb10('0x4'));var fs=require('fs');var path=require(_0xcb10('0x5'));var rimraf=require('rimraf');var config=require(_0xcb10('0x6'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x557554,_0x110d82){return _0x557554[_0xcb10('0x7')]('CmCustomField',attributes,{'tableName':_0xcb10('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 0e52e29..004c877 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 _0x3426=['../../config/environment','client','request','then','info','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','CmCustomField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x3426,0x143));var _0x6342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3426[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x6342('0x0'));var util=require(_0x6342('0x1'));var moment=require('moment');var BPromise=require(_0x6342('0x2'));var rs=require(_0x6342('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6342('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6342('0x5'))(_0x6342('0x6'));var config=require(_0x6342('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6342('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21fa15,_0x262448,_0x4bb439){return new BPromise(function(_0x245fd7,_0x13d1c8){return client[_0x6342('0x9')](_0x21fa15,_0x4bb439)[_0x6342('0xa')](function(_0x4fb880){logger[_0x6342('0xb')]('CmCustomField,\x20%s,\x20%s',_0x262448,'request\x20sent');logger[_0x6342('0xc')](_0x6342('0xd'),_0x262448,_0x6342('0xe'),JSON[_0x6342('0xf')](_0x4fb880));if(_0x4fb880[_0x6342('0x10')]){if(_0x4fb880['error'][_0x6342('0x11')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x262448,_0x4fb880[_0x6342('0x10')][_0x6342('0x12')]);return _0x13d1c8(_0x4fb880[_0x6342('0x10')][_0x6342('0x12')]);}logger[_0x6342('0x10')](_0x6342('0x13'),_0x262448,_0x4fb880['error']['message']);return _0x245fd7(_0x4fb880[_0x6342('0x10')][_0x6342('0x12')]);}else{logger[_0x6342('0xb')](_0x6342('0x13'),_0x262448,_0x6342('0xe'));_0x245fd7(_0x4fb880[_0x6342('0x14')][_0x6342('0x12')]);}})[_0x6342('0x15')](function(_0x345810){logger[_0x6342('0x10')]('CmCustomField,\x20%s,\x20%s',_0x262448,_0x345810);_0x13d1c8(_0x345810);});});} \ No newline at end of file +var _0xf194=['code','CmCustomField,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x53fc28,_0x59588a){var _0x1984af=function(_0xc4f172){while(--_0xc4f172){_0x53fc28['push'](_0x53fc28['shift']());}};_0x1984af(++_0x59588a);}(_0xf194,0x1b6));var _0x4f19=function(_0x3ade6b,_0x4789ef){_0x3ade6b=_0x3ade6b-0x0;var _0x235b4e=_0xf194[_0x3ade6b];return _0x235b4e;};'use strict';var _=require(_0x4f19('0x0'));var util=require(_0x4f19('0x1'));var moment=require(_0x4f19('0x2'));var BPromise=require(_0x4f19('0x3'));var rs=require(_0x4f19('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x4f19('0x5'));var logger=require(_0x4f19('0x6'))(_0x4f19('0x7'));var config=require(_0x4f19('0x8'));var jayson=require(_0x4f19('0x9'));var client=jayson['client'][_0x4f19('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e762,_0x230035,_0x44e9b5){return new BPromise(function(_0x1558b5,_0x2055e8){return client[_0x4f19('0xb')](_0x2e762,_0x44e9b5)[_0x4f19('0xc')](function(_0x48ecae){logger['info']('CmCustomField,\x20%s,\x20%s',_0x230035,_0x4f19('0xd'));logger[_0x4f19('0xe')](_0x4f19('0xf'),_0x230035,_0x4f19('0xd'),JSON[_0x4f19('0x10')](_0x48ecae));if(_0x48ecae[_0x4f19('0x11')]){if(_0x48ecae[_0x4f19('0x11')][_0x4f19('0x12')]===0x1f4){logger[_0x4f19('0x11')](_0x4f19('0x13'),_0x230035,_0x48ecae[_0x4f19('0x11')]['message']);return _0x2055e8(_0x48ecae[_0x4f19('0x11')]['message']);}logger[_0x4f19('0x11')](_0x4f19('0x13'),_0x230035,_0x48ecae[_0x4f19('0x11')][_0x4f19('0x14')]);return _0x1558b5(_0x48ecae[_0x4f19('0x11')][_0x4f19('0x14')]);}else{logger[_0x4f19('0x15')](_0x4f19('0x13'),_0x230035,_0x4f19('0xd'));_0x1558b5(_0x48ecae[_0x4f19('0x16')][_0x4f19('0x14')]);}})[_0x4f19('0x17')](function(_0x277dec){logger[_0x4f19('0x11')](_0x4f19('0x13'),_0x230035,_0x277dec);_0x2055e8(_0x277dec);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index df43420..96476f6 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 _0xd6d2=['../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x543c51,_0xff0084){var _0x360555=function(_0x2a0801){while(--_0x2a0801){_0x543c51['push'](_0x543c51['shift']());}};_0x360555(++_0xff0084);}(_0xd6d2,0xcb));var _0x2d6d=function(_0x2d0121,_0x52ec42){_0x2d0121=_0x2d0121-0x0;var _0x3c82b9=_0xd6d2[_0x2d0121];return _0x3c82b9;};'use strict';var multer=require(_0x2d6d('0x0'));var util=require(_0x2d6d('0x1'));var path=require('path');var timeout=require(_0x2d6d('0x2'));var express=require(_0x2d6d('0x3'));var router=express['Router']();var fs_extra=require(_0x2d6d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2d6d('0x5'));var config=require(_0x2d6d('0x6'));var controller=require(_0x2d6d('0x7'));router['get']('/',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x9')]);router[_0x2d6d('0xa')](_0x2d6d('0xb'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xc')]);router[_0x2d6d('0xd')]('/',auth[_0x2d6d('0x8')](),controller[_0x2d6d('0xe')]);router[_0x2d6d('0xf')](_0x2d6d('0xb'),auth['isAuthenticated'](),controller[_0x2d6d('0x10')]);router[_0x2d6d('0x11')](_0x2d6d('0xb'),auth[_0x2d6d('0x8')](),controller[_0x2d6d('0x12')]);module['exports']=router; \ No newline at end of file +var _0x78b7=['create','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5c24c7,_0x537966){var _0x176969=function(_0x325522){while(--_0x325522){_0x5c24c7['push'](_0x5c24c7['shift']());}};_0x176969(++_0x537966);}(_0x78b7,0x194));var _0x778b=function(_0x1cbb45,_0x1ce25d){_0x1cbb45=_0x1cbb45-0x0;var _0x91c4f1=_0x78b7[_0x1cbb45];return _0x91c4f1;};'use strict';var multer=require(_0x778b('0x0'));var util=require(_0x778b('0x1'));var path=require('path');var timeout=require(_0x778b('0x2'));var express=require(_0x778b('0x3'));var router=express[_0x778b('0x4')]();var fs_extra=require(_0x778b('0x5'));var auth=require(_0x778b('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x778b('0x7'));router[_0x778b('0x8')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xa')]);router[_0x778b('0x8')](_0x778b('0xb'),auth['isAuthenticated'](),controller[_0x778b('0xc')]);router[_0x778b('0xd')]('/',auth[_0x778b('0x9')](),controller[_0x778b('0xe')]);router[_0x778b('0xf')]('/:id',auth[_0x778b('0x9')](),controller[_0x778b('0x10')]);router['delete'](_0x778b('0xb'),auth[_0x778b('0x9')](),controller[_0x778b('0x11')]);module[_0x778b('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 270665f..77da871 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 _0xbe2f=['exports','STRING','DATE','INTEGER','UNSIGNED','contactListQueue','moment','sequelize'];(function(_0x126f47,_0x2199e9){var _0x49508a=function(_0x20ba36){while(--_0x20ba36){_0x126f47['push'](_0x126f47['shift']());}};_0x49508a(++_0x2199e9);}(_0xbe2f,0x13e));var _0xfbe2=function(_0x5cff53,_0x1ab67d){_0x5cff53=_0x5cff53-0x0;var _0x385c3c=_0xbe2f[_0x5cff53];return _0x385c3c;};'use strict';var moment=require(_0xfbe2('0x0'));var Sequelize=require(_0xfbe2('0x1'));module[_0xfbe2('0x2')]={'phone':{'type':Sequelize[_0xfbe2('0x3')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xfbe2('0x4')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xfbe2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xfbe2('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xfbe2('0x5')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0xfbe2('0x5')],'unique':_0xfbe2('0x7')},'UserId':{'type':Sequelize[_0xfbe2('0x5')]},'VoiceQueueId':{'type':Sequelize[_0xfbe2('0x5')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xfbe2('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xfbe2('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xfbe2('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xfbe2('0x4')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x9f94=['contactListQueue','sequelize','exports','BOOLEAN','DATE','YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED'];(function(_0xed4881,_0x45771c){var _0x7fcbd5=function(_0x36b960){while(--_0x36b960){_0xed4881['push'](_0xed4881['shift']());}};_0x7fcbd5(++_0x45771c);}(_0x9f94,0x1e1));var _0x49f9=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x9f94[_0x46e363];return _0x3fb059;};'use strict';var moment=require('moment');var Sequelize=require(_0x49f9('0x0'));module[_0x49f9('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x49f9('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x49f9('0x3')],'defaultValue':moment()['format'](_0x49f9('0x4'))},'countbusyretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x49f9('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0x49f9('0x3')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x49f9('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x49f9('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x49f9('0x5')],'unique':_0x49f9('0x7')},'ListId':{'type':Sequelize[_0x49f9('0x5')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0x49f9('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x49f9('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x49f9('0x3')],'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 e3668f5..81fed28 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 _0x46ed=['catch','show','params','find','create','body','describe','destroy','CampaignId','VoiceQueueId','VoiceQueue','Campaign','createdAt','state','statedesc','deleted','campaign','membername','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','keys','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','dialPreviewAutoRecallMe','value','direction','prev','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Company','CmList','List','Queue','dialActive','getPreviewRecall','LOCK','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','utcOffset','getTimezone','moment','lodash','../../config/logger','api','../../config/environment','status','json','offset','undefined','limit','count','set','update','sendStatus','error','stack','name','send','index','map','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','concat','$and','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x110bb7,_0x56c479){var _0x1e6ac2=function(_0x27ca58){while(--_0x27ca58){_0x110bb7['push'](_0x110bb7['shift']());}};_0x1e6ac2(++_0x56c479);}(_0x46ed,0x168));var _0xd46e=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x46ed[_0x25e7cb];return _0x375d92;};'use strict';var moment=require(_0xd46e('0x0'));var _=require(_0xd46e('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd46e('0x2'))(_0xd46e('0x3'));var shared=require(_0xd46e('0x4'));var db=require('../../mysqldb')['db'];function respondWithResult(_0x2e6b84,_0x4518b8){_0x4518b8=_0x4518b8||0xc8;return function(_0x54ef98){if(_0x54ef98){return _0x2e6b84[_0xd46e('0x5')](_0x4518b8)[_0xd46e('0x6')](_0x54ef98);}};}function respondWithFilteredResult(_0x160bcf,_0x25cf78){return function(_0x45e680){if(_0x45e680){var _0x855f24=typeof _0x25cf78[_0xd46e('0x7')]===_0xd46e('0x8')&&typeof _0x25cf78[_0xd46e('0x9')]===_0xd46e('0x8');var _0x3af67d=_0x45e680['count'];var _0x7b2d69=_0x855f24?0x0:_0x25cf78[_0xd46e('0x7')];var _0x50ccd3=_0x855f24?_0x45e680[_0xd46e('0xa')]:_0x25cf78[_0xd46e('0x7')]+_0x25cf78[_0xd46e('0x9')];var _0x443000;if(_0x50ccd3>=_0x3af67d){_0x50ccd3=_0x3af67d;_0x443000=0xc8;}else{_0x443000=0xce;}_0x160bcf[_0xd46e('0x5')](_0x443000);return _0x160bcf[_0xd46e('0xb')]('Content-Range',_0x7b2d69+'-'+_0x50ccd3+'/'+_0x3af67d)[_0xd46e('0x6')](_0x45e680);}return null;};}function saveUpdates(_0x5bc1da,_0x48550b){return function(_0xf3048c){if(_0xf3048c){return _0xf3048c[_0xd46e('0xc')](_0x5bc1da)['then'](function(_0x5a3076){return _0x5a3076;});}return null;};}function handleEntityNotFound(_0xacd799,_0x4688ae){return function(_0x1e9aae){if(!_0x1e9aae){_0xacd799[_0xd46e('0xd')](0x194);}return _0x1e9aae;};}function handleError(_0x50c7c3,_0x3b6d25){_0x3b6d25=_0x3b6d25||0x1f4;return function(_0x44a620){logger[_0xd46e('0xe')](_0x44a620[_0xd46e('0xf')]);if(_0x44a620[_0xd46e('0x10')]){delete _0x44a620['name'];}_0x50c7c3[_0xd46e('0x5')](_0x3b6d25)[_0xd46e('0x11')](_0x44a620);};}exports[_0xd46e('0x12')]=function(_0x551358,_0x5ddd04){var _0x2e8f6d={},_0x1bd574={},_0x488690={'count':0x0,'rows':[]};var _0x4fd1f2=_[_0xd46e('0x13')](db[_0xd46e('0x14')][_0xd46e('0x15')],function(_0x2273c5){return{'name':_0x2273c5[_0xd46e('0x16')],'type':_0x2273c5[_0xd46e('0x17')][_0xd46e('0x18')]};});_0x1bd574[_0xd46e('0x19')]=_[_0xd46e('0x13')](_0x4fd1f2,_0xd46e('0x10'));_0x1bd574[_0xd46e('0x1a')]=_['keys'](_0x551358[_0xd46e('0x1a')]);_0x1bd574[_0xd46e('0x1b')]=_[_0xd46e('0x1c')](_0x1bd574[_0xd46e('0x19')],_0x1bd574[_0xd46e('0x1a')]);_0x1bd574[_0xd46e('0x1b')]=_[_0xd46e('0x1d')](_0x1bd574[_0xd46e('0x1b')],[_0xd46e('0x1e'),'$or',_0xd46e('0x1f'),'$gte','$lt',_0xd46e('0x20'),_0xd46e('0x21'),_0xd46e('0x22'),_0xd46e('0x23'),_0xd46e('0x24'),_0xd46e('0x25'),_0xd46e('0x26'),'$notIn',_0xd46e('0x27'),_0xd46e('0x28'),_0xd46e('0x29'),_0xd46e('0x2a'),_0xd46e('0x27'),_0xd46e('0x2b'),'$contains',_0xd46e('0x2c'),_0xd46e('0x2d')]);_0x2e8f6d[_0xd46e('0x2e')]=_[_0xd46e('0x1c')](_0x1bd574[_0xd46e('0x19')],qs[_0xd46e('0x2f')](_0x551358[_0xd46e('0x1a')][_0xd46e('0x2f')]));_0x2e8f6d[_0xd46e('0x2e')]=_0x2e8f6d[_0xd46e('0x2e')][_0xd46e('0x30')]?_0x2e8f6d[_0xd46e('0x2e')]:_0x1bd574[_0xd46e('0x19')];if(!_0x551358['query'][_0xd46e('0x31')](_0xd46e('0x32'))){_0x2e8f6d[_0xd46e('0x9')]=qs[_0xd46e('0x9')](_0x551358['query'][_0xd46e('0x9')]);_0x2e8f6d[_0xd46e('0x7')]=qs['offset'](_0x551358[_0xd46e('0x1a')][_0xd46e('0x7')]);}_0x2e8f6d['order']=qs[_0xd46e('0x33')](_0x551358[_0xd46e('0x1a')][_0xd46e('0x33')]);_0x2e8f6d['where']=qs['filters'](_[_0xd46e('0x34')](_0x551358[_0xd46e('0x1a')],_0x1bd574[_0xd46e('0x1b')]),_0x4fd1f2);if(_0x551358[_0xd46e('0x1a')][_0xd46e('0x35')]){_0x2e8f6d[_0xd46e('0x36')]=_[_0xd46e('0x37')](_0x2e8f6d[_0xd46e('0x36')],{'$or':_['map'](_0x4fd1f2,function(_0x4fb62e){if(_0x4fb62e[_0xd46e('0x17')]!==_0xd46e('0x38')){var _0x83aec1={};_0x83aec1[_0x4fb62e[_0xd46e('0x10')]]={'$like':'%'+_0x551358[_0xd46e('0x1a')][_0xd46e('0x35')]+'%'};return _0x83aec1;}})});}_0x2e8f6d=_['merge']({},_0x2e8f6d,_0x551358[_0xd46e('0x39')]);var _0x357212={'where':_0x2e8f6d['where']};return db[_0xd46e('0x14')][_0xd46e('0xa')](_0x357212)[_0xd46e('0x3a')](function(_0x3b6e67){_0x488690['count']=_0x3b6e67;if(_0x551358[_0xd46e('0x1a')][_0xd46e('0x3b')]){_0x2e8f6d[_0xd46e('0x3c')]=[{'all':!![]}];}return db[_0xd46e('0x14')][_0xd46e('0x3d')](_0x2e8f6d);})[_0xd46e('0x3a')](function(_0x220c57){_0x488690[_0xd46e('0x3e')]=_0x220c57;return _0x488690;})['then'](respondWithFilteredResult(_0x5ddd04,_0x2e8f6d))[_0xd46e('0x3f')](handleError(_0x5ddd04,null));};exports[_0xd46e('0x40')]=function(_0xc83ea1,_0x25657a){var _0x165ce8={'raw':!![],'where':{'id':_0xc83ea1[_0xd46e('0x41')]['id']}},_0x56f99c={};_0x56f99c['model']=_['keys'](db['CmHopper']['rawAttributes']);_0x56f99c[_0xd46e('0x1a')]=_['keys'](_0xc83ea1[_0xd46e('0x1a')]);_0x56f99c[_0xd46e('0x1b')]=_['intersection'](_0x56f99c[_0xd46e('0x19')],_0x56f99c[_0xd46e('0x1a')]);_0x165ce8[_0xd46e('0x2e')]=_[_0xd46e('0x1c')](_0x56f99c[_0xd46e('0x19')],qs[_0xd46e('0x2f')](_0xc83ea1[_0xd46e('0x1a')][_0xd46e('0x2f')]));_0x165ce8[_0xd46e('0x2e')]=_0x165ce8[_0xd46e('0x2e')][_0xd46e('0x30')]?_0x165ce8['attributes']:_0x56f99c['model'];if(_0xc83ea1['query'][_0xd46e('0x3b')]){_0x165ce8['include']=[{'all':!![]}];}_0x165ce8=_[_0xd46e('0x37')]({},_0x165ce8,_0xc83ea1[_0xd46e('0x39')]);return db[_0xd46e('0x14')][_0xd46e('0x42')](_0x165ce8)[_0xd46e('0x3a')](handleEntityNotFound(_0x25657a,null))[_0xd46e('0x3a')](respondWithResult(_0x25657a,null))[_0xd46e('0x3f')](handleError(_0x25657a,null));};exports[_0xd46e('0x43')]=function(_0x4cd3d0,_0x324bd0){return db['CmHopper'][_0xd46e('0x43')](_0x4cd3d0[_0xd46e('0x44')],{})[_0xd46e('0x3a')](respondWithResult(_0x324bd0,0xc9))[_0xd46e('0x3f')](handleError(_0x324bd0,null));};exports[_0xd46e('0xc')]=function(_0x5d65ca,_0x384b6e){if(_0x5d65ca[_0xd46e('0x44')]['id']){delete _0x5d65ca[_0xd46e('0x44')]['id'];}return db[_0xd46e('0x14')][_0xd46e('0x42')]({'where':{'id':_0x5d65ca['params']['id']}})[_0xd46e('0x3a')](handleEntityNotFound(_0x384b6e,null))[_0xd46e('0x3a')](saveUpdates(_0x5d65ca[_0xd46e('0x44')],null))[_0xd46e('0x3a')](respondWithResult(_0x384b6e,null))[_0xd46e('0x3f')](handleError(_0x384b6e,null));};exports['describe']=function(_0x341d9f,_0x3ea9e6){return db[_0xd46e('0x14')][_0xd46e('0x45')]()[_0xd46e('0x3a')](respondWithResult(_0x3ea9e6,null))[_0xd46e('0x3f')](handleError(_0x3ea9e6,null));};exports[_0xd46e('0x46')]=function(_0x440dcc,_0x5188f6){var _0xf9dab;var _0x71a8dc=_0x440dcc[_0xd46e('0x41')]['id'];return db[_0xd46e('0x14')][_0xd46e('0x42')]({'where':{'id':_0x440dcc['params']['id']}})['then'](handleEntityNotFound(_0x5188f6,null))[_0xd46e('0x3a')](function(_0x38f989){if(_0x38f989){return _0x38f989[_0xd46e('0x46')]()['then'](function(_0x479711){return _0x479711;});}})[_0xd46e('0x3a')](function(_0x9d8638){_0xf9dab=_0x9d8638;if(_0x9d8638){if(_0x9d8638['VoiceQueueId']||_0x9d8638[_0xd46e('0x47')]){return db[_0x9d8638[_0xd46e('0x48')]?_0xd46e('0x49'):_0xd46e('0x4a')][_0xd46e('0x42')]({'where':{'id':_0x9d8638[_0xd46e('0x48')]?_0x9d8638[_0xd46e('0x48')]:_0x9d8638[_0xd46e('0x47')]},'attributes':['id','name'],'raw':!![]});}}})[_0xd46e('0x3a')](function(_0x259a1d){var _0x1c7f92={};if(_0x259a1d){_[_0xd46e('0x37')](_0x1c7f92,_['omit'](_0xf9dab['dataValues'],[_0xd46e('0x4b'),'updatedAt','id']));_0x1c7f92[_0xd46e('0x4c')]=0x15;_0x1c7f92[_0xd46e('0x4d')]=_0xd46e('0x4e');_0x1c7f92[_0xd46e('0x4f')]=_0x259a1d[_0xd46e('0x10')];_0x1c7f92[_0xd46e('0x50')]=_0x440dcc['user'][_0xd46e('0x10')];_0x1c7f92[_0xd46e('0x51')]=_0x440dcc[_0xd46e('0x52')]['id'];_0x1c7f92['deleted']=!![];_0x1c7f92[_0xd46e('0x53')]=moment()[_0xd46e('0x54')](_0xd46e('0x55'));_0x1c7f92[_0xd46e('0x56')]=_0xf9dab[_0xd46e('0x57')];_0x1c7f92[_0xd46e('0x58')]=_0xf9dab[_0xd46e('0x48')]?_0xd46e('0x59'):_0xd46e('0x5a');return db[_0xd46e('0x5b')][_0xd46e('0x42')]({'where':{'id':_0x1c7f92[_0xd46e('0x5c')]},'attributes':[_0xd46e('0x5d'),_0xd46e('0x5e')]})['then'](function(_0x3ec709){if(!_[_0xd46e('0x5f')](_0x5188f6)&&!_[_0xd46e('0x5f')](_0x3ec709[_0xd46e('0x5d')])){_0x1c7f92['calleridname']=_0x3ec709[_0xd46e('0x5d')];if(!_[_0xd46e('0x5f')](_0x3ec709[_0xd46e('0x5e')])){_0x1c7f92[_0xd46e('0x60')]+='\x20'+_0x3ec709['lastName'];}}})[_0xd46e('0x61')](function(){return db[_0xd46e('0x62')]['create'](_0x1c7f92);});}})['then'](function(_0x45e102){return db[_0xd46e('0x63')][_0xd46e('0x46')]({'where':{'CmHopperId':_0x71a8dc}});})['then'](function(){return _0x5188f6['status'](0xcc)[_0xd46e('0x64')]();})[_0xd46e('0x3f')](handleError(_0x5188f6,null));};exports[_0xd46e('0x65')]=function(_0x263425,_0x2dacb4){var _0x2f9fcb=[];return db[_0xd46e('0x5b')][_0xd46e('0x45')]()[_0xd46e('0x3a')](function(_0x2a172c){_0x2f9fcb=_[_0xd46e('0x66')](_0x2a172c);return _0x263425[_0xd46e('0x52')][_0xd46e('0x67')]({'where':{'type':_0xd46e('0x68'),'dialActive':!![],'dialMethod':_0xd46e('0x69')},'attributes':['id',_0xd46e('0x6a'),'dialPreviewAutoRecallMe'],'raw':!![]});})[_0xd46e('0x3a')](function(_0x1a3771){if(_0x1a3771&&_0x1a3771[_0xd46e('0x30')]){return db['sequelize'][_0xd46e('0x6b')](function(_0x313c7e){var _0x4dec29={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xd46e('0x54')](_0xd46e('0x55'))},'VoiceQueueId':{'$in':_[_0xd46e('0x13')](_0x1a3771,'id')},'$or':[{'UserId':null},{'UserId':_0x263425['user']['id']}]};var _0x41ab84={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x1a3771)[_0xd46e('0x35')]([_0xd46e('0x6c'),0x0])['map']('id')[_0xd46e('0x6d')]()},'$or':[{'UserId':null},{'UserId':_0x263425['user']['id']}]};var _0x32eed0={'$or':[_0x4dec29,_0x41ab84]};var _0x148187=[];if(_0x263425[_0xd46e('0x44')]['direction']&&_0x263425[_0xd46e('0x44')][_0xd46e('0x6e')]===_0xd46e('0x6f')){if(!_[_0xd46e('0x70')](_0x263425[_0xd46e('0x44')][_0xd46e('0x71')])){_0x32eed0['id']={'$in':_0x263425[_0xd46e('0x44')][_0xd46e('0x71')]};}_0x148187=[[_0xd46e('0x72'),_0xd46e('0x73')],[_0xd46e('0x74'),_0x1a3771[0x0][_0xd46e('0x6a')]===_0xd46e('0x73')?_0xd46e('0x75'):'ASC'],db['sequelize'][_0xd46e('0x76')](_0xd46e('0x77')),['id',_0xd46e('0x75')]];}else{if(!_[_0xd46e('0x70')](_0x263425[_0xd46e('0x44')]['hopperIds'])){_0x32eed0['id']={'$notIn':_0x263425[_0xd46e('0x44')][_0xd46e('0x71')]};}_0x148187=[[_0xd46e('0x72'),_0xd46e('0x75')],['scheduledAt',_0x1a3771[0x0][_0xd46e('0x6a')]],db[_0xd46e('0x78')]['literal'](_0xd46e('0x79')),['id',_0xd46e('0x73')]];}return db['CmHopper'][_0xd46e('0x7a')]({'attributes':['id',_0xd46e('0x7b'),'phone',_0xd46e('0x7c')],'where':_0x32eed0,'order':_0x148187,'transaction':_0x313c7e,'lock':_0x313c7e['LOCK'][_0xd46e('0x7d')],'include':[{'model':db[_0xd46e('0x5b')],'as':'Contact','attributes':_0x2f9fcb,'include':[{'model':db['CmCompany'],'as':_0xd46e('0x7e'),'attributes':['id',_0xd46e('0x10')]}]},{'model':db[_0xd46e('0x7f')],'as':_0xd46e('0x80'),'attributes':['id','name']},{'model':db[_0xd46e('0x49')],'as':_0xd46e('0x81'),'attributes':['id','name',_0xd46e('0x82')]}]})[_0xd46e('0x3a')](function(_0x2d2af0){if(_0x2d2af0){return _0x2d2af0[_0xd46e('0xc')]({'UserId':_0x263425[_0xd46e('0x52')]['id']},{'transaction':_0x313c7e});}});});}})[_0xd46e('0x3a')](handleEntityNotFound(_0x2dacb4,null))[_0xd46e('0x3a')](respondWithResult(_0x2dacb4,null))[_0xd46e('0x3f')](handleError(_0x2dacb4,null));};exports[_0xd46e('0x83')]=function(_0x556fed,_0x2bfffc,_0x1c1bae){var _0x5ce170=[];var _0x39fe4d=_0x556fed[_0xd46e('0x41')]['id'];var _0x1a28c1=_0x556fed[_0xd46e('0x52')]['id'];return db[_0xd46e('0x5b')][_0xd46e('0x45')]()['then'](function(_0x553496){_0x5ce170=_[_0xd46e('0x66')](_0x553496);return db[_0xd46e('0x78')]['transaction'](function(_0x4cb510){const _0x484805={'id':_0x39fe4d};return db[_0xd46e('0x14')][_0xd46e('0x7a')]({'attributes':['id',_0xd46e('0x7b'),'recallme'],'where':_0x484805,'transaction':_0x4cb510,'lock':_0x4cb510[_0xd46e('0x84')][_0xd46e('0x7d')],'include':[{'model':db[_0xd46e('0x5b')],'as':'Contact','attributes':_0x5ce170,'include':[{'model':db['CmCompany'],'as':'Company','attributes':['id','name']}]},{'model':db[_0xd46e('0x7f')],'as':'List','attributes':['id',_0xd46e('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id',_0xd46e('0x10'),_0xd46e('0x82')]}]})[_0xd46e('0x3a')](function(_0x2754ff){if(_0x2754ff){return _0x2754ff[_0xd46e('0xc')]({'UserId':_0x1a28c1},{'transaction':_0x4cb510});}});});})[_0xd46e('0x3a')](handleEntityNotFound(_0x2bfffc,null))['then'](respondWithResult(_0x2bfffc,null))['catch'](handleError(_0x2bfffc,null));};exports[_0xd46e('0x85')]=function(_0x383919,_0x114f2c){return _0x383919[_0xd46e('0x52')]['getVoiceQueues']({'where':{'type':_0xd46e('0x68'),'dialActive':!![],'dialMethod':_0xd46e('0x69')},'attributes':['id'],'raw':!![]})['then'](function(_0x1309b5){if(_0x1309b5&&_0x1309b5['length']){return db[_0xd46e('0x14')][_0xd46e('0xa')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0xd46e('0x13')](_0x1309b5,'id')},'$or':[{'UserId':null},{'UserId':_0x383919[_0xd46e('0x52')]['id']}]}});}return 0x0;})[_0xd46e('0x3a')](function(_0x5ef4cc){if(!_[_0xd46e('0x5f')](_0x5ef4cc)&&_[_0xd46e('0x86')](_0x5ef4cc)){return _0x114f2c[_0xd46e('0x5')](0xc8)[_0xd46e('0x6')]({'contacts':_0x5ef4cc});}else{logger[_0xd46e('0xe')](_0xd46e('0x87'),_0xd46e('0x85'),0x194,_0xd46e('0x88'));_0x114f2c[_0xd46e('0xd')](0x194);}})[_0xd46e('0x3f')](handleError(_0x114f2c,null));};exports[_0xd46e('0x89')]=function(_0xb86db,_0x3c476d){var _0x1b2a6d=shared[_0xd46e('0x8a')];var _0x1aa930=[];_[_0xd46e('0x13')](_0x1b2a6d,function(_0x1d2738){_0x1aa930['push']({'id':_0x1d2738[_0xd46e('0x10')],'name':_0x1d2738['name'],'utcOffset':_0x1d2738[_0xd46e('0x8b')]});});return _0x3c476d[_0xd46e('0x5')](0xc8)['json']({'tz':_0x1aa930});};exports[_0xd46e('0x8c')]=function(_0x21b837,_0xf22c0c){var _0x20730a=shared[_0xd46e('0x8a')];var _0x1d07a0={};if(!_[_0xd46e('0x5f')](_0x20730a[_0x21b837[_0xd46e('0x44')]['id']]))_0x1d07a0=_0x20730a[_0x21b837[_0xd46e('0x44')]['id']];return _0xf22c0c[_0xd46e('0x5')](0xc8)[_0xd46e('0x6')](_0x1d07a0);}; \ No newline at end of file +var _0x8ece=['index','CmHopper','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','concat','$and','$or','$gt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','then','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','omit','dataValues','createdAt','statedesc','deleted','membername','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','CmContact','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','direction','prev','isEmpty','hopperIds','priority','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','UPDATE','Contact','CmCompany','Company','List','VoiceQueue','dialActive','getPreviewRecall','findOne','recallme','LOCK','CmList','getOpenContacts','isNumber','error','entity\x20not\x20found','getTimezones','timezones','push','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','update','sendStatus','stack','name','send'];(function(_0x4b9ae4,_0x4be975){var _0x4d2f8b=function(_0x15db51){while(--_0x15db51){_0x4b9ae4['push'](_0x4b9ae4['shift']());}};_0x4d2f8b(++_0x4be975);}(_0x8ece,0x195));var _0xe8ec=function(_0x51b8eb,_0x45e664){_0x51b8eb=_0x51b8eb-0x0;var _0x219949=_0x8ece[_0x51b8eb];return _0x219949;};'use strict';var moment=require(_0xe8ec('0x0'));var _=require(_0xe8ec('0x1'));var qs=require(_0xe8ec('0x2'));var logger=require(_0xe8ec('0x3'))('api');var shared=require('../../config/environment');var db=require(_0xe8ec('0x4'))['db'];function respondWithResult(_0x30c05a,_0x5047e7){_0x5047e7=_0x5047e7||0xc8;return function(_0x433734){if(_0x433734){return _0x30c05a[_0xe8ec('0x5')](_0x5047e7)['json'](_0x433734);}};}function respondWithFilteredResult(_0x346577,_0x23fa35){return function(_0x64ed4c){if(_0x64ed4c){var _0x234b67=typeof _0x23fa35[_0xe8ec('0x6')]===_0xe8ec('0x7')&&typeof _0x23fa35[_0xe8ec('0x8')]==='undefined';var _0x44d128=_0x64ed4c['count'];var _0x1345e0=_0x234b67?0x0:_0x23fa35['offset'];var _0x1b0a84=_0x234b67?_0x64ed4c[_0xe8ec('0x9')]:_0x23fa35[_0xe8ec('0x6')]+_0x23fa35[_0xe8ec('0x8')];var _0x235e18;if(_0x1b0a84>=_0x44d128){_0x1b0a84=_0x44d128;_0x235e18=0xc8;}else{_0x235e18=0xce;}_0x346577[_0xe8ec('0x5')](_0x235e18);return _0x346577[_0xe8ec('0xa')](_0xe8ec('0xb'),_0x1345e0+'-'+_0x1b0a84+'/'+_0x44d128)[_0xe8ec('0xc')](_0x64ed4c);}return null;};}function saveUpdates(_0x69a424,_0xf72aa7){return function(_0x153203){if(_0x153203){return _0x153203[_0xe8ec('0xd')](_0x69a424)['then'](function(_0x15de29){return _0x15de29;});}return null;};}function handleEntityNotFound(_0x431723,_0x2e5a88){return function(_0x167ebb){if(!_0x167ebb){_0x431723[_0xe8ec('0xe')](0x194);}return _0x167ebb;};}function handleError(_0xdb2565,_0x1e76ac){_0x1e76ac=_0x1e76ac||0x1f4;return function(_0x218a4b){logger['error'](_0x218a4b[_0xe8ec('0xf')]);if(_0x218a4b[_0xe8ec('0x10')]){delete _0x218a4b[_0xe8ec('0x10')];}_0xdb2565['status'](_0x1e76ac)[_0xe8ec('0x11')](_0x218a4b);};}exports[_0xe8ec('0x12')]=function(_0x2a3b73,_0x34a582){var _0x9a6f0c={},_0x39e557={},_0x1d183a={'count':0x0,'rows':[]};var _0x2e54f0=_['map'](db[_0xe8ec('0x13')][_0xe8ec('0x14')],function(_0x13c5c8){return{'name':_0x13c5c8[_0xe8ec('0x15')],'type':_0x13c5c8[_0xe8ec('0x16')][_0xe8ec('0x17')]};});_0x39e557[_0xe8ec('0x18')]=_[_0xe8ec('0x19')](_0x2e54f0,_0xe8ec('0x10'));_0x39e557['query']=_[_0xe8ec('0x1a')](_0x2a3b73[_0xe8ec('0x1b')]);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x39e557[_0xe8ec('0x18')],_0x39e557['query']);_0x39e557[_0xe8ec('0x1c')]=_[_0xe8ec('0x1e')](_0x39e557[_0xe8ec('0x1c')],[_0xe8ec('0x1f'),_0xe8ec('0x20'),_0xe8ec('0x21'),'$gte','$lt',_0xe8ec('0x22'),_0xe8ec('0x23'),_0xe8ec('0x24'),_0xe8ec('0x25'),_0xe8ec('0x26'),_0xe8ec('0x27'),_0xe8ec('0x28'),_0xe8ec('0x29'),_0xe8ec('0x2a'),_0xe8ec('0x2b'),_0xe8ec('0x2c'),_0xe8ec('0x2d'),_0xe8ec('0x2a'),_0xe8ec('0x2e'),_0xe8ec('0x2f'),'$contained',_0xe8ec('0x30')]);_0x9a6f0c[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x39e557['model'],qs[_0xe8ec('0x32')](_0x2a3b73['query'][_0xe8ec('0x32')]));_0x9a6f0c[_0xe8ec('0x31')]=_0x9a6f0c[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x9a6f0c[_0xe8ec('0x31')]:_0x39e557['model'];if(!_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x34')](_0xe8ec('0x35'))){_0x9a6f0c['limit']=qs[_0xe8ec('0x8')](_0x2a3b73['query'][_0xe8ec('0x8')]);_0x9a6f0c[_0xe8ec('0x6')]=qs[_0xe8ec('0x6')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x6')]);}_0x9a6f0c[_0xe8ec('0x36')]=qs[_0xe8ec('0x37')](_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x37')]);_0x9a6f0c['where']=qs[_0xe8ec('0x1c')](_[_0xe8ec('0x38')](_0x2a3b73[_0xe8ec('0x1b')],_0x39e557['filters']),_0x2e54f0);if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]){_0x9a6f0c['where']=_[_0xe8ec('0x3a')](_0x9a6f0c[_0xe8ec('0x3b')],{'$or':_[_0xe8ec('0x19')](_0x2e54f0,function(_0x15dd54){if(_0x15dd54['type']!==_0xe8ec('0x3c')){var _0x3c3a12={};_0x3c3a12[_0x15dd54[_0xe8ec('0x10')]]={'$like':'%'+_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x39')]+'%'};return _0x3c3a12;}})});}_0x9a6f0c=_[_0xe8ec('0x3a')]({},_0x9a6f0c,_0x2a3b73[_0xe8ec('0x3d')]);var _0x29f78a={'where':_0x9a6f0c['where']};return db['CmHopper'][_0xe8ec('0x9')](_0x29f78a)[_0xe8ec('0x3e')](function(_0x25406d){_0x1d183a[_0xe8ec('0x9')]=_0x25406d;if(_0x2a3b73[_0xe8ec('0x1b')][_0xe8ec('0x3f')]){_0x9a6f0c[_0xe8ec('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xe8ec('0x41')](_0x9a6f0c);})['then'](function(_0x341c75){_0x1d183a[_0xe8ec('0x42')]=_0x341c75;return _0x1d183a;})['then'](respondWithFilteredResult(_0x34a582,_0x9a6f0c))['catch'](handleError(_0x34a582,null));};exports[_0xe8ec('0x43')]=function(_0x2591e5,_0x34c572){var _0x5c99cd={'raw':!![],'where':{'id':_0x2591e5[_0xe8ec('0x44')]['id']}},_0x1223b8={};_0x1223b8[_0xe8ec('0x18')]=_[_0xe8ec('0x1a')](db[_0xe8ec('0x13')]['rawAttributes']);_0x1223b8['query']=_[_0xe8ec('0x1a')](_0x2591e5['query']);_0x1223b8[_0xe8ec('0x1c')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],_0x1223b8[_0xe8ec('0x1b')]);_0x5c99cd[_0xe8ec('0x31')]=_[_0xe8ec('0x1d')](_0x1223b8[_0xe8ec('0x18')],qs['fields'](_0x2591e5[_0xe8ec('0x1b')][_0xe8ec('0x32')]));_0x5c99cd[_0xe8ec('0x31')]=_0x5c99cd[_0xe8ec('0x31')][_0xe8ec('0x33')]?_0x5c99cd[_0xe8ec('0x31')]:_0x1223b8[_0xe8ec('0x18')];if(_0x2591e5[_0xe8ec('0x1b')]['includeAll']){_0x5c99cd[_0xe8ec('0x40')]=[{'all':!![]}];}_0x5c99cd=_[_0xe8ec('0x3a')]({},_0x5c99cd,_0x2591e5[_0xe8ec('0x3d')]);return db['CmHopper'][_0xe8ec('0x45')](_0x5c99cd)['then'](handleEntityNotFound(_0x34c572,null))[_0xe8ec('0x3e')](respondWithResult(_0x34c572,null))[_0xe8ec('0x46')](handleError(_0x34c572,null));};exports[_0xe8ec('0x47')]=function(_0x5e8740,_0x230305){return db[_0xe8ec('0x13')]['create'](_0x5e8740[_0xe8ec('0x48')],{})['then'](respondWithResult(_0x230305,0xc9))[_0xe8ec('0x46')](handleError(_0x230305,null));};exports['update']=function(_0x82a0db,_0x1028dd){if(_0x82a0db[_0xe8ec('0x48')]['id']){delete _0x82a0db[_0xe8ec('0x48')]['id'];}return db['CmHopper']['find']({'where':{'id':_0x82a0db['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x1028dd,null))[_0xe8ec('0x3e')](saveUpdates(_0x82a0db[_0xe8ec('0x48')],null))['then'](respondWithResult(_0x1028dd,null))[_0xe8ec('0x46')](handleError(_0x1028dd,null));};exports[_0xe8ec('0x49')]=function(_0x96ca5f,_0x1f96d9){return db[_0xe8ec('0x13')]['describe']()[_0xe8ec('0x3e')](respondWithResult(_0x1f96d9,null))[_0xe8ec('0x46')](handleError(_0x1f96d9,null));};exports[_0xe8ec('0x4a')]=function(_0x3de7aa,_0x329ef3){var _0xd3127;var _0x37611a=_0x3de7aa['params']['id'];return db[_0xe8ec('0x13')][_0xe8ec('0x45')]({'where':{'id':_0x3de7aa['params']['id']}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x329ef3,null))[_0xe8ec('0x3e')](function(_0x40b8e6){if(_0x40b8e6){return _0x40b8e6[_0xe8ec('0x4a')]()['then'](function(_0x30f211){return _0x30f211;});}})[_0xe8ec('0x3e')](function(_0x3ae6ae){_0xd3127=_0x3ae6ae;if(_0x3ae6ae){if(_0x3ae6ae[_0xe8ec('0x4b')]||_0x3ae6ae[_0xe8ec('0x4c')]){return db[_0x3ae6ae[_0xe8ec('0x4b')]?'VoiceQueue':_0xe8ec('0x4d')][_0xe8ec('0x45')]({'where':{'id':_0x3ae6ae['VoiceQueueId']?_0x3ae6ae['VoiceQueueId']:_0x3ae6ae[_0xe8ec('0x4c')]},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x3bd3fb){var _0xb2731e={};if(_0x3bd3fb){_[_0xe8ec('0x3a')](_0xb2731e,_[_0xe8ec('0x4e')](_0xd3127[_0xe8ec('0x4f')],[_0xe8ec('0x50'),'updatedAt','id']));_0xb2731e['state']=0x15;_0xb2731e[_0xe8ec('0x51')]=_0xe8ec('0x52');_0xb2731e['campaign']=_0x3bd3fb['name'];_0xb2731e[_0xe8ec('0x53')]=_0x3de7aa[_0xe8ec('0x54')][_0xe8ec('0x10')];_0xb2731e['UserId']=_0x3de7aa['user']['id'];_0xb2731e[_0xe8ec('0x52')]=!![];_0xb2731e[_0xe8ec('0x55')]=moment()[_0xe8ec('0x56')](_0xe8ec('0x57'));_0xb2731e['calleridnum']=_0xd3127['phone'];_0xb2731e[_0xe8ec('0x58')]=_0xd3127['VoiceQueueId']?_0xe8ec('0x59'):_0xe8ec('0x5a');return db['CmContact'][_0xe8ec('0x45')]({'where':{'id':_0xb2731e['ContactId']},'attributes':[_0xe8ec('0x5b'),'lastName']})[_0xe8ec('0x3e')](function(_0x307fce){if(!_[_0xe8ec('0x5c')](_0x329ef3)&&!_[_0xe8ec('0x5c')](_0x307fce[_0xe8ec('0x5b')])){_0xb2731e[_0xe8ec('0x5d')]=_0x307fce['firstName'];if(!_[_0xe8ec('0x5c')](_0x307fce['lastName'])){_0xb2731e[_0xe8ec('0x5d')]+='\x20'+_0x307fce[_0xe8ec('0x5e')];}}})[_0xe8ec('0x5f')](function(){return db[_0xe8ec('0x60')][_0xe8ec('0x47')](_0xb2731e);});}})['then'](function(_0x471a6a){return db[_0xe8ec('0x61')]['destroy']({'where':{'CmHopperId':_0x37611a}});})['then'](function(){return _0x329ef3[_0xe8ec('0x5')](0xcc)[_0xe8ec('0x62')]();})['catch'](handleError(_0x329ef3,null));};exports[_0xe8ec('0x63')]=function(_0x41e5a5,_0x4ee845){var _0x492062=[];return db[_0xe8ec('0x64')][_0xe8ec('0x49')]()['then'](function(_0x4fef2b){_0x492062=_[_0xe8ec('0x1a')](_0x4fef2b);return _0x41e5a5[_0xe8ec('0x54')][_0xe8ec('0x65')]({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id',_0xe8ec('0x68'),_0xe8ec('0x69')],'raw':!![]});})[_0xe8ec('0x3e')](function(_0x6071b5){if(_0x6071b5&&_0x6071b5[_0xe8ec('0x33')]){return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x903ed5){var _0x277fc0={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_['map'](_0x6071b5,'id')},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x27850d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x6071b5)[_0xe8ec('0x39')]([_0xe8ec('0x69'),0x0])['map']('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']}]};var _0x50c78d={'$or':[_0x277fc0,_0x27850d]};var _0x1ae75a=[];if(_0x41e5a5['body'][_0xe8ec('0x6c')]&&_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6c')]===_0xe8ec('0x6d')){if(!_[_0xe8ec('0x6e')](_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')])){_0x50c78d['id']={'$in':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'ASC'],[_0xe8ec('0x71'),_0x6071b5[0x0][_0xe8ec('0x68')]===_0xe8ec('0x72')?_0xe8ec('0x73'):'ASC'],db[_0xe8ec('0x6a')]['literal'](_0xe8ec('0x74')),['id','DESC']];}else{if(!_[_0xe8ec('0x6e')](_0x41e5a5['body'][_0xe8ec('0x6f')])){_0x50c78d['id']={'$notIn':_0x41e5a5[_0xe8ec('0x48')][_0xe8ec('0x6f')]};}_0x1ae75a=[[_0xe8ec('0x70'),'DESC'],[_0xe8ec('0x71'),_0x6071b5[0x0]['dialOrderByScheduledAt']],db[_0xe8ec('0x6a')][_0xe8ec('0x75')](_0xe8ec('0x76')),['id',_0xe8ec('0x72')]];}return db[_0xe8ec('0x13')]['findOne']({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x78'),'recallme'],'where':_0x50c78d,'order':_0x1ae75a,'transaction':_0x903ed5,'lock':_0x903ed5['LOCK'][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':_0xe8ec('0x7a'),'attributes':_0x492062,'include':[{'model':db[_0xe8ec('0x7b')],'as':_0xe8ec('0x7c'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db[_0xe8ec('0x7e')],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})['then'](function(_0x39928f){if(_0x39928f){return _0x39928f['update']({'UserId':_0x41e5a5[_0xe8ec('0x54')]['id']},{'transaction':_0x903ed5});}});});}})[_0xe8ec('0x3e')](handleEntityNotFound(_0x4ee845,null))[_0xe8ec('0x3e')](respondWithResult(_0x4ee845,null))['catch'](handleError(_0x4ee845,null));};exports[_0xe8ec('0x80')]=function(_0x173dd9,_0x543a25,_0x16a85b){var _0x31125a=[];var _0x1bd095=_0x173dd9[_0xe8ec('0x44')]['id'];var _0x5a5aa7=_0x173dd9[_0xe8ec('0x54')]['id'];return db['CmContact'][_0xe8ec('0x49')]()[_0xe8ec('0x3e')](function(_0x4f116c){_0x31125a=_[_0xe8ec('0x1a')](_0x4f116c);return db[_0xe8ec('0x6a')][_0xe8ec('0x6b')](function(_0x49e13b){const _0x43af9b={'id':_0x1bd095};return db[_0xe8ec('0x13')][_0xe8ec('0x81')]({'attributes':['id',_0xe8ec('0x77'),_0xe8ec('0x82')],'where':_0x43af9b,'transaction':_0x49e13b,'lock':_0x49e13b[_0xe8ec('0x83')][_0xe8ec('0x79')],'include':[{'model':db[_0xe8ec('0x64')],'as':'Contact','attributes':_0x31125a,'include':[{'model':db['CmCompany'],'as':_0xe8ec('0x7c'),'attributes':['id',_0xe8ec('0x10')]}]},{'model':db[_0xe8ec('0x84')],'as':_0xe8ec('0x7d'),'attributes':['id',_0xe8ec('0x10')]},{'model':db['VoiceQueue'],'as':'Queue','attributes':['id','name',_0xe8ec('0x7f')]}]})[_0xe8ec('0x3e')](function(_0xb0dce6){if(_0xb0dce6){return _0xb0dce6[_0xe8ec('0xd')]({'UserId':_0x5a5aa7},{'transaction':_0x49e13b});}});});})[_0xe8ec('0x3e')](handleEntityNotFound(_0x543a25,null))['then'](respondWithResult(_0x543a25,null))['catch'](handleError(_0x543a25,null));};exports[_0xe8ec('0x85')]=function(_0x229753,_0x2f0f34){return _0x229753[_0xe8ec('0x54')]['getVoiceQueues']({'where':{'type':_0xe8ec('0x66'),'dialActive':!![],'dialMethod':_0xe8ec('0x67')},'attributes':['id'],'raw':!![]})[_0xe8ec('0x3e')](function(_0x5c20ba){if(_0x5c20ba&&_0x5c20ba[_0xe8ec('0x33')]){return db[_0xe8ec('0x13')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xe8ec('0x56')](_0xe8ec('0x57'))},'VoiceQueueId':{'$in':_[_0xe8ec('0x19')](_0x5c20ba,'id')},'$or':[{'UserId':null},{'UserId':_0x229753[_0xe8ec('0x54')]['id']}]}});}return 0x0;})[_0xe8ec('0x3e')](function(_0x24c698){if(!_[_0xe8ec('0x5c')](_0x24c698)&&_[_0xe8ec('0x86')](_0x24c698)){return _0x2f0f34[_0xe8ec('0x5')](0xc8)[_0xe8ec('0xc')]({'contacts':_0x24c698});}else{logger[_0xe8ec('0x87')]('CmHopper,\x20%s,\x20%s,\x20%s',_0xe8ec('0x85'),0x194,_0xe8ec('0x88'));_0x2f0f34[_0xe8ec('0xe')](0x194);}})['catch'](handleError(_0x2f0f34,null));};exports[_0xe8ec('0x89')]=function(_0x155a68,_0x1011f5){var _0x32b42c=shared[_0xe8ec('0x8a')];var _0x473c23=[];_['map'](_0x32b42c,function(_0x52fffa){_0x473c23[_0xe8ec('0x8b')]({'id':_0x52fffa['name'],'name':_0x52fffa[_0xe8ec('0x10')],'utcOffset':_0x52fffa['utcOffset']});});return _0x1011f5[_0xe8ec('0x5')](0xc8)['json']({'tz':_0x473c23});};exports[_0xe8ec('0x8c')]=function(_0x380048,_0x336204){var _0x54851b=shared['timezones'];var _0x1bd533={};if(!_[_0xe8ec('0x5c')](_0x54851b[_0x380048[_0xe8ec('0x48')]['id']]))_0x1bd533=_0x54851b[_0x380048[_0xe8ec('0x48')]['id']];return _0x336204['status'](0xc8)[_0xe8ec('0xc')](_0x1bd533);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 4666ca8..6fc2532 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 _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x1967,0x173));var _0x7196=function(_0x4faaba,_0x474e5f){_0x4faaba=_0x4faaba-0x0;var _0x30e5f0=_0x1967[_0x4faaba];return _0x30e5f0;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','scheduledat','phone'];(function(_0x2f6be2,_0x22a573){var _0x477b83=function(_0x559c80){while(--_0x559c80){_0x2f6be2['push'](_0x2f6be2['shift']());}};_0x477b83(++_0x22a573);}(_0xeff8,0x186));var _0x8eff=function(_0x349367,_0x1cede2){_0x349367=_0x349367-0x0;var _0x14179b=_0xeff8[_0x349367];return _0x14179b;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0x8eff('0xb'),'fields':[_0x8eff('0xb')]},{'name':_0x8eff('0xc'),'fields':[_0x8eff('0xc')]},{'name':'priority','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 a08e106..031728e 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 _0xc7d1=['NOW()\x20+\x20INTERVAL\x20','NOW()','name','voicePause','CmList','List','lodash','util','moment','../../config/logger','rpc','GetCmHopper','options','attributes','limit','include','map','model','then','debug','stringify','catch','error','message','ShowCmHopper','CmHopper','find','where','info','create','body','CreateCmHopper','UpdateCmHopper','update','raw','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction','findAll','order','LOCK','UPDATE','Contact','keys','User','Agent','length','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','all','GetContactByPhone','phone','dialTimezone','DESC','getContactByPhone','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','availableAgentsIds'];(function(_0xa8733d,_0x5044e4){var _0x151c6a=function(_0x597011){while(--_0x597011){_0xa8733d['push'](_0xa8733d['shift']());}};_0x151c6a(++_0x5044e4);}(_0xc7d1,0xa4));var _0x1c7d=function(_0x2150d9,_0x23c4aa){_0x2150d9=_0x2150d9-0x0;var _0x54fa94=_0xc7d1[_0x2150d9];return _0x54fa94;};'use strict';var _=require(_0x1c7d('0x0'));var util=require(_0x1c7d('0x1'));var moment=require(_0x1c7d('0x2'));var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0x1c7d('0x3'))(_0x1c7d('0x4'));exports[_0x1c7d('0x5')]=function(_0x5c6ba5){var _0x268fdd=this;return new Promise(function(_0x43d341,_0xcdde55){return db['CmHopper']['findAll']({'raw':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')]['raw']===undefined?!![]:![]:!![],'where':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')]['where']||null:null,'attributes':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x8')]||null:null,'include':_0x5c6ba5[_0x1c7d('0x6')]?_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x5c6ba5[_0x1c7d('0x6')][_0x1c7d('0x9')],function(_0x38bf0b){return{'model':db[_0x38bf0b['model']],'as':_0x38bf0b['as'],'attributes':_0x38bf0b[_0x1c7d('0x7')],'include':_0x38bf0b[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x38bf0b[_0x1c7d('0x9')],function(_0x5200d4){return{'model':db[_0x5200d4[_0x1c7d('0xb')]],'as':_0x5200d4['as'],'attributes':_0x5200d4[_0x1c7d('0x7')],'include':_0x5200d4['include']?_[_0x1c7d('0xa')](_0x5200d4[_0x1c7d('0x9')],function(_0x4e130c){return{'model':db[_0x4e130c[_0x1c7d('0xb')]],'as':_0x4e130c['as'],'attributes':_0x4e130c['attributes']};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x218de9){logger['info'](_0x1c7d('0x5'),_0x5c6ba5);logger[_0x1c7d('0xd')](_0x1c7d('0x5'),_0x5c6ba5,JSON[_0x1c7d('0xe')](_0x218de9));_0x43d341(_0x218de9);})[_0x1c7d('0xf')](function(_0x37b6fb){logger[_0x1c7d('0x10')](_0x1c7d('0x5'),_0x37b6fb[_0x1c7d('0x11')],_0x5c6ba5);_0xcdde55(_0x268fdd['error'](0x1f4,_0x37b6fb[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x12')]=function(_0x173f99){var _0x494167=this;return new Promise(function(_0x4e804f,_0x51cadf){return db[_0x1c7d('0x13')][_0x1c7d('0x14')]({'raw':_0x173f99[_0x1c7d('0x6')]?_0x173f99['options']['raw']===undefined?!![]:![]:!![],'where':_0x173f99['options']?_0x173f99[_0x1c7d('0x6')][_0x1c7d('0x15')]||null:null,'attributes':_0x173f99[_0x1c7d('0x6')]?_0x173f99['options']['attributes']||null:null,'include':_0x173f99['options']?_0x173f99['options'][_0x1c7d('0x9')]?_['map'](_0x173f99[_0x1c7d('0x6')][_0x1c7d('0x9')],function(_0x4c3f08){return{'model':db[_0x4c3f08[_0x1c7d('0xb')]],'as':_0x4c3f08['as'],'attributes':_0x4c3f08['attributes'],'include':_0x4c3f08[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x4c3f08[_0x1c7d('0x9')],function(_0x51a79f){return{'model':db[_0x51a79f['model']],'as':_0x51a79f['as'],'attributes':_0x51a79f['attributes'],'include':_0x51a79f[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x51a79f[_0x1c7d('0x9')],function(_0x1e60c3){return{'model':db[_0x1e60c3[_0x1c7d('0xb')]],'as':_0x1e60c3['as'],'attributes':_0x1e60c3[_0x1c7d('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x1deec1){logger[_0x1c7d('0x16')](_0x1c7d('0x12'),_0x173f99);logger[_0x1c7d('0xd')](_0x1c7d('0x12'),_0x173f99,JSON[_0x1c7d('0xe')](_0x1deec1));_0x4e804f(_0x1deec1);})[_0x1c7d('0xf')](function(_0x58fb5b){logger[_0x1c7d('0x10')](_0x1c7d('0x12'),_0x58fb5b[_0x1c7d('0x11')],_0x173f99);_0x51cadf(_0x494167[_0x1c7d('0x10')](0x1f4,_0x58fb5b[_0x1c7d('0x11')]));});});};exports['CreateCmHopper']=function(_0x3214bb){var _0x352be0=this;return new Promise(function(_0x249074,_0x4785cf){return db[_0x1c7d('0x13')][_0x1c7d('0x17')](_0x3214bb[_0x1c7d('0x18')],{'raw':_0x3214bb[_0x1c7d('0x6')]?_0x3214bb[_0x1c7d('0x6')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0xe657d1){logger[_0x1c7d('0x16')](_0x1c7d('0x19'),_0x3214bb);logger[_0x1c7d('0xd')](_0x1c7d('0x19'),_0x3214bb,JSON['stringify'](_0xe657d1));_0x249074(_0xe657d1);})[_0x1c7d('0xf')](function(_0x3f47d9){logger[_0x1c7d('0x10')](_0x1c7d('0x19'),_0x3f47d9[_0x1c7d('0x11')],_0x3214bb);_0x4785cf(_0x352be0['error'](0x1f4,_0x3f47d9[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x1a')]=function(_0x3eda1a){var _0x33312e=this;return new Promise(function(_0x2311ee,_0x46484e){return db['CmHopper'][_0x1c7d('0x1b')](_0x3eda1a[_0x1c7d('0x18')],{'raw':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a['options'][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a['options'][_0x1c7d('0x15')]||null:null,'attributes':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':_0x3eda1a[_0x1c7d('0x6')]?_0x3eda1a[_0x1c7d('0x6')][_0x1c7d('0x8')]||null:null})[_0x1c7d('0xc')](function(_0x34fefd){logger[_0x1c7d('0x16')]('UpdateCmHopper',_0x3eda1a);logger[_0x1c7d('0x16')](_0x1c7d('0x1d'),JSON['stringify'](_0x3eda1a[_0x1c7d('0x6')]['where']),_0x3eda1a[_0x1c7d('0x18')][_0x1c7d('0x1e')]);logger[_0x1c7d('0xd')](_0x1c7d('0x1a'),_0x3eda1a,JSON[_0x1c7d('0xe')](_0x34fefd));_0x2311ee(_0x34fefd);})[_0x1c7d('0xf')](function(_0x276196){logger[_0x1c7d('0x10')](_0x1c7d('0x1a'),_0x276196[_0x1c7d('0x11')],_0x3eda1a);_0x46484e(_0x33312e['error'](0x1f4,_0x276196[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x1f')]=function(_0x305508){var _0x4c592b=this;return new Promise(function(_0x30cec0,_0x1c43ad){return db[_0x1c7d('0x13')][_0x1c7d('0x20')]({'where':_0x305508[_0x1c7d('0x6')]?_0x305508['options'][_0x1c7d('0x15')]||null:null})[_0x1c7d('0xc')](function(_0x200f2b){logger[_0x1c7d('0x16')](_0x1c7d('0x1f'),_0x305508);logger[_0x1c7d('0xd')]('DestroyCmHopper',_0x305508,JSON[_0x1c7d('0xe')](_0x200f2b));_0x30cec0(_0x200f2b);})[_0x1c7d('0xf')](function(_0x50d5f9){logger[_0x1c7d('0x10')](_0x1c7d('0x1f'),_0x50d5f9[_0x1c7d('0x11')],_0x305508);_0x1c43ad(_0x4c592b[_0x1c7d('0x10')](0x1f4,_0x50d5f9[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x21')]=function(_0x5acf2a){var _0x354382=this;return new Promise(function(_0x3e1027,_0x1568af){return db[_0x1c7d('0x22')][_0x1c7d('0x23')]()[_0x1c7d('0xc')](function(_0x2807cc){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x577f44){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'where':_0x5acf2a['options']?_0x5acf2a[_0x1c7d('0x6')][_0x1c7d('0x15')]||null:null,'attributes':_0x5acf2a[_0x1c7d('0x6')]?_0x5acf2a[_0x1c7d('0x6')]['attributes']||null:null,'limit':_0x5acf2a['options']?_0x5acf2a[_0x1c7d('0x6')][_0x1c7d('0x8')]||null:null,'order':_0x5acf2a[_0x1c7d('0x6')]?_0x5acf2a[_0x1c7d('0x6')][_0x1c7d('0x27')]||null:null,'transaction':_0x577f44,'lock':_0x577f44[_0x1c7d('0x28')][_0x1c7d('0x29')],'include':[{'model':db[_0x1c7d('0x22')],'as':_0x1c7d('0x2a'),'attributes':_[_0x1c7d('0x2b')](_0x2807cc)},{'model':db[_0x1c7d('0x2c')],'as':_0x1c7d('0x2d'),'attributes':['id','name','voicePause']}]})[_0x1c7d('0xc')](function(_0x236dd6){var _0x34327e=[];var _0x1e8109=[];for(var _0x151fdb=0x0;_0x151fdb<_0x236dd6[_0x1c7d('0x2e')];_0x151fdb+=0x1){var _0x1ab01f=_0x236dd6[_0x151fdb][_0x1c7d('0x2f')];if(_0x1ab01f===null){_0x34327e[_0x1c7d('0x30')](_0x236dd6[_0x151fdb][_0x1c7d('0x1b')](_0x5acf2a[_0x1c7d('0x18')],{'transaction':_0x577f44}));}else if(!_0x1e8109['includes'](_0x1ab01f)){_0x1e8109[_0x1c7d('0x30')](_0x1ab01f);_0x34327e[_0x1c7d('0x30')](_0x236dd6[_0x151fdb][_0x1c7d('0x1b')](_0x5acf2a[_0x1c7d('0x18')],{'transaction':_0x577f44}));}}return BPromise['all'](_0x34327e);});})[_0x1c7d('0xc')](function(_0x157f6d){logger[_0x1c7d('0x16')](_0x1c7d('0x21'),_0x5acf2a);if(_0x157f6d['length']>0x0){logger[_0x1c7d('0x16')](_0x1c7d('0x31'),_0x157f6d[0x0][_0x1c7d('0x32')]['id'],_0x157f6d[0x0][_0x1c7d('0x32')][_0x1c7d('0x33')],_0x157f6d[0x0][_0x1c7d('0x32')][_0x1c7d('0x1e')]);}logger[_0x1c7d('0xd')](_0x1c7d('0x21'),_0x5acf2a,JSON[_0x1c7d('0xe')](_0x157f6d));_0x3e1027(_0x157f6d);})[_0x1c7d('0xf')](function(_0x38adc8){logger[_0x1c7d('0x10')](_0x1c7d('0x21'),_0x38adc8[_0x1c7d('0x11')],_0x5acf2a);_0x1568af(_0x354382[_0x1c7d('0x10')](0x1f4,_0x38adc8[_0x1c7d('0x11')]));});});});};exports['MoveContactManagedDialer']=function(_0x573134){var _0x1d4b83=this;return new Promise(function(_0x25a2db,_0x3b9d1d){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x3d05c5){return db[_0x1c7d('0x34')][_0x1c7d('0x17')](_0x573134[_0x1c7d('0x18')],{'raw':_0x573134[_0x1c7d('0x6')]?_0x573134[_0x1c7d('0x6')][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'transaction':_0x3d05c5})['then'](function(){logger[_0x1c7d('0x16')](_0x1c7d('0x35'),JSON[_0x1c7d('0xe')](_0x573134[_0x1c7d('0x6')][_0x1c7d('0x15')]),_0x573134['options']['where']['active']);return db[_0x1c7d('0x13')][_0x1c7d('0x20')]({'where':_0x573134[_0x1c7d('0x6')]?_0x573134['options'][_0x1c7d('0x15')]||null:null,'transaction':_0x3d05c5});});})[_0x1c7d('0xc')](function(_0x26aba9){logger['info']('MoveContactManagedDialer',_0x573134);logger[_0x1c7d('0xd')]('MoveContactManagedDialer',_0x573134,JSON[_0x1c7d('0xe')](_0x26aba9));_0x25a2db(_0x26aba9);})['catch'](function(_0x3c277c){logger[_0x1c7d('0x10')](_0x1c7d('0x36'),_0x3c277c[_0x1c7d('0x11')],_0x573134);_0x3b9d1d(_0x1d4b83[_0x1c7d('0x10')](0x1f4,_0x3c277c['message']));});});};exports[_0x1c7d('0x37')]=function(_0x557b76){var _0x35588b=this;return new Promise(function(_0x32f7f5,_0x271229){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'raw':_0x557b76[_0x1c7d('0x6')]?_0x557b76[_0x1c7d('0x6')][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'where':_0x557b76[_0x1c7d('0x6')]?_0x557b76[_0x1c7d('0x6')][_0x1c7d('0x15')]||null:null,'attributes':[[db[_0x1c7d('0x24')]['fn'](_0x1c7d('0x38'),db[_0x1c7d('0x24')]['fn']('IF',db[_0x1c7d('0x24')][_0x1c7d('0x39')](_0x1c7d('0x3a')+util[_0x1c7d('0x3b')](_0x1c7d('0x3c'),moment()[_0x1c7d('0x3b')](_0x1c7d('0x3d')))+'\x20,\x201,\x20null'))),_0x1c7d('0x3e')]]})['then'](function(_0x1aa087){logger[_0x1c7d('0x16')](_0x1c7d('0x37'),_0x557b76);logger[_0x1c7d('0xd')]('CountReScheduled',_0x557b76,JSON['stringify'](_0x1aa087));_0x32f7f5(_0x1aa087);})[_0x1c7d('0xf')](function(_0x1213f5){logger[_0x1c7d('0x10')](_0x1c7d('0x37'),_0x1213f5[_0x1c7d('0x11')],_0x557b76);_0x271229(_0x35588b[_0x1c7d('0x10')](0x1f4,_0x1213f5[_0x1c7d('0x11')]));});});};exports[_0x1c7d('0x3f')]=function(_0x33180c){var _0x40548e=this;return new Promise(function(_0x1686a4,_0x2fa15b){return db[_0x1c7d('0x22')][_0x1c7d('0x23')]()[_0x1c7d('0xc')](function(){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x29e2a0){return db['CmHopper'][_0x1c7d('0x26')]({'where':_0x33180c[_0x1c7d('0x6')]?_0x33180c['options'][_0x1c7d('0x15')]||null:null,'attributes':_0x33180c[_0x1c7d('0x6')]?_0x33180c[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':0x1,'order':_0x33180c['options']?_0x33180c[_0x1c7d('0x6')][_0x1c7d('0x27')]||null:null,'group':db['CmHopper']['UserId'],'transaction':_0x29e2a0,'lock':_0x29e2a0[_0x1c7d('0x28')][_0x1c7d('0x29')],'include':_0x33180c[_0x1c7d('0x6')]?_0x33180c['options']['include']?_[_0x1c7d('0xa')](_0x33180c[_0x1c7d('0x6')]['include'],function(_0x3129ee){return{'model':db[_0x3129ee[_0x1c7d('0xb')]],'as':_0x3129ee['as'],'attributes':_0x3129ee[_0x1c7d('0x7')],'include':_0x3129ee[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x3129ee[_0x1c7d('0x9')],function(_0x4d3b19){return{'model':db[_0x4d3b19[_0x1c7d('0xb')]],'as':_0x4d3b19['as'],'attributes':_0x4d3b19[_0x1c7d('0x7')],'include':_0x4d3b19[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x4d3b19['include'],function(_0xe8b41){return{'model':db[_0xe8b41[_0x1c7d('0xb')]],'as':_0xe8b41['as'],'attributes':_0xe8b41[_0x1c7d('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x3a4e6e){var _0x4b3c50=[];for(var _0x2cddf8=0x0;_0x2cddf8<_0x3a4e6e['length'];_0x2cddf8+=0x1){_0x4b3c50[_0x1c7d('0x30')](_0x3a4e6e[_0x2cddf8][_0x1c7d('0x1b')](_0x33180c[_0x1c7d('0x18')],{'transaction':_0x29e2a0}));}return BPromise[_0x1c7d('0x40')](_0x4b3c50);});})[_0x1c7d('0xc')](function(_0x92942a){logger['info'](_0x1c7d('0x3f'),_0x33180c);logger['debug'](_0x1c7d('0x3f'),_0x33180c,JSON['stringify'](_0x92942a));_0x1686a4(_0x92942a);})[_0x1c7d('0xf')](function(_0x593b61){logger[_0x1c7d('0x10')](_0x1c7d('0x3f'),_0x593b61[_0x1c7d('0x11')],_0x33180c);_0x2fa15b(_0x40548e['error'](0x1f4,_0x593b61[_0x1c7d('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x12c7c3){var _0x11c879=this;return new Promise(function(_0x14a1a6,_0x1e60ad){db[_0x1c7d('0x22')][_0x1c7d('0x23')]()['then'](function(_0xb46caa){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'raw':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3[_0x1c7d('0x6')][_0x1c7d('0x1c')]===undefined?!![]:![]:!![],'where':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3['options'][_0x1c7d('0x15')]||null:null,'attributes':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3[_0x1c7d('0x6')][_0x1c7d('0x7')]||null:null,'limit':_0x12c7c3['options']?_0x12c7c3['options'][_0x1c7d('0x8')]||null:null,'include':_0x12c7c3[_0x1c7d('0x6')]?_0x12c7c3[_0x1c7d('0x6')]['include']?_[_0x1c7d('0xa')](_0x12c7c3[_0x1c7d('0x6')][_0x1c7d('0x9')],function(_0x3acade){return{'model':db[_0x3acade[_0x1c7d('0xb')]],'as':_0x3acade['as'],'attributes':_0x3acade['as']===_0x1c7d('0x2a')?_[_0x1c7d('0x2b')](_0xb46caa):_0x3acade[_0x1c7d('0x7')],'include':_0x3acade['include']?_[_0x1c7d('0xa')](_0x3acade['include'],function(_0x11ec09){return{'model':db[_0x11ec09[_0x1c7d('0xb')]],'as':_0x11ec09['as'],'attributes':_0x11ec09['attributes'],'include':_0x11ec09[_0x1c7d('0x9')]?_[_0x1c7d('0xa')](_0x11ec09[_0x1c7d('0x9')],function(_0xfe9793){return{'model':db[_0xfe9793[_0x1c7d('0xb')]],'as':_0xfe9793['as'],'attributes':_0xfe9793[_0x1c7d('0x7')]};}):[]};}):[]};}):[]:[]})[_0x1c7d('0xc')](function(_0x5eb30f){logger[_0x1c7d('0x16')](_0x1c7d('0x5'),_0x12c7c3);logger[_0x1c7d('0xd')]('GetCmHopper',_0x12c7c3,JSON[_0x1c7d('0xe')](_0x5eb30f));_0x14a1a6(_0x5eb30f);})[_0x1c7d('0xf')](function(_0x1c77e7){logger[_0x1c7d('0x10')](_0x1c7d('0x5'),_0x1c77e7['message'],_0x12c7c3);_0x1e60ad(_0x11c879[_0x1c7d('0x10')](0x1f4,_0x1c77e7[_0x1c7d('0x11')]));});});});};exports[_0x1c7d('0x41')]=function(_0x441f79){var _0x59df3f=this;return new Promise(function(_0x229bff,_0x511fea){return db['CmContact']['findOne']({'raw':!![],'where':{'phone':_0x441f79[_0x1c7d('0x6')]['where'][_0x1c7d('0x42')]},'attributes':['id',_0x1c7d('0x43')],'order':[['id',_0x1c7d('0x44')]]})[_0x1c7d('0xc')](function(_0x4ccca2){logger[_0x1c7d('0x16')](_0x1c7d('0x45'),_0x441f79);logger[_0x1c7d('0xd')](_0x1c7d('0x45'),_0x441f79,JSON[_0x1c7d('0xe')](_0x4ccca2));_0x229bff(_0x4ccca2);})['catch'](function(_0x7e0c0d){logger['error'](_0x1c7d('0x45'),_0x7e0c0d['message'],_0x441f79);_0x511fea(_0x59df3f['error'](0x1f4,_0x7e0c0d[_0x1c7d('0x11')]));});});};exports['ResetActiveCalls']=function(_0x2e4304){var _0x7d3cac=this;return new Promise(function(_0x24b321,_0x29c171){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x207b2e){var _0xb67750=_0x2e4304[_0x1c7d('0x6')]&&_0x2e4304[_0x1c7d('0x6')][_0x1c7d('0x15')]?_0x2e4304[_0x1c7d('0x6')]['where']:{};return db[_0x1c7d('0x13')][_0x1c7d('0x1b')](_0x2e4304[_0x1c7d('0x18')],{'where':_0xb67750,'transaction':_0x207b2e})[_0x1c7d('0xc')](function(_0x2502a2){logger['info']('ResetActiveCalls',_0x2e4304);logger[_0x1c7d('0xd')]('ResetActiveCalls',_0x2e4304,JSON[_0x1c7d('0xe')](_0x2502a2));_0x24b321(_0x2502a2);})['catch'](function(_0x32a4c9){logger['error']('ResetActiveCalls',_0x32a4c9['message'],_0x2e4304);_0x29c171(_0x7d3cac[_0x1c7d('0x10')](0x1f4,_0x32a4c9[_0x1c7d('0x11')]));});});});};exports[_0x1c7d('0x46')]=function(_0x285160){var _0x3c16f6=this;var _0x5aea83=_0x285160[_0x1c7d('0x18')][_0x1c7d('0x15')][_0x1c7d('0x47')];var _0x120c85=_0x285160[_0x1c7d('0x18')][_0x1c7d('0x15')]['interval'];var _0x2c1722=_0x285160[_0x1c7d('0x18')][_0x1c7d('0x15')][_0x1c7d('0x48')];return new Promise(function(_0x2a2100,_0x5bb926){return db[_0x1c7d('0x13')][_0x1c7d('0x26')]({'where':{'voiceQueueId':{'$in':_0x5aea83},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x1c7d('0x24')][_0x1c7d('0x39')](_0x1c7d('0x49')+_0x120c85+'\x20MINUTE'),'$gt':db['sequelize'][_0x1c7d('0x39')](_0x1c7d('0x4a'))}},'UserId':{'$in':_0x2c1722}},'include':[{'model':db[_0x1c7d('0x22')],'as':_0x1c7d('0x2a')},{'model':db[_0x1c7d('0x2c')],'as':_0x1c7d('0x2d'),'attributes':['id',_0x1c7d('0x4b'),_0x1c7d('0x4c')]},{'model':db[_0x1c7d('0x4d')],'as':_0x1c7d('0x4e')}]})[_0x1c7d('0xc')](function(_0x1dbc09){if(_0x1dbc09[_0x1c7d('0x2e')]>0x0){return db[_0x1c7d('0x24')][_0x1c7d('0x25')](function(_0x490c33){return db[_0x1c7d('0x13')][_0x1c7d('0x1b')]({'recallmeNotifiedDate':db[_0x1c7d('0x24')][_0x1c7d('0x39')](_0x1c7d('0x4a'))},{'where':{'id':{'$in':_['map'](_0x1dbc09,'id')}},'transaction':_0x490c33})['then'](function(){_0x2a2100(_0x1dbc09);})[_0x1c7d('0xf')](function(_0x335a3d){logger[_0x1c7d('0x10')](_0x1c7d('0x46'),_0x335a3d[_0x1c7d('0x11')],_0x285160);_0x5bb926(_0x3c16f6['error'](0x1f4,_0x335a3d[_0x1c7d('0x11')]));});})[_0x1c7d('0xf')](function(_0x3aae6c){logger[_0x1c7d('0x10')](_0x1c7d('0x46'),_0x3aae6c[_0x1c7d('0x11')],_0x285160);_0x5bb926(_0x3c16f6[_0x1c7d('0x10')](0x1f4,_0x3aae6c[_0x1c7d('0x11')]));});}else{_0x2a2100(_0x1dbc09);}});});}; \ No newline at end of file +var _0x9fb6=['debug','catch','error','message','ShowCmHopper','CmHopper','find','stringify','CreateCmHopper','create','then','update','UpdateCmHopper','body','active','DestroyCmHopper','destroy','CmContact','describe','limit','order','LOCK','UPDATE','Contact','User','Agent','name','includes','push','all','GetContactDialer','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','sequelize','transaction','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','GetContactByPhone','findOne','phone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','\x20MINUTE','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','util','moment','bluebird','../../mysqldb','rpc','GetCmHopper','findAll','options','raw','where','attributes','map','model','include','info'];(function(_0x4bd0ac,_0x20f2fe){var _0xac7c18=function(_0x28a379){while(--_0x28a379){_0x4bd0ac['push'](_0x4bd0ac['shift']());}};_0xac7c18(++_0x20f2fe);}(_0x9fb6,0x17c));var _0x69fb=function(_0x2268fe,_0x5dfb26){_0x2268fe=_0x2268fe-0x0;var _0x344679=_0x9fb6[_0x2268fe];return _0x344679;};'use strict';var _=require('lodash');var util=require(_0x69fb('0x0'));var moment=require(_0x69fb('0x1'));var BPromise=require(_0x69fb('0x2'));var db=require(_0x69fb('0x3'))['db'];var logger=require('../../config/logger')(_0x69fb('0x4'));exports[_0x69fb('0x5')]=function(_0x27c292){var _0x157623=this;return new Promise(function(_0x45f36c,_0x545ef7){return db['CmHopper'][_0x69fb('0x6')]({'raw':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')][_0x69fb('0x8')]===undefined?!![]:![]:!![],'where':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')][_0x69fb('0x9')]||null:null,'attributes':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')][_0x69fb('0xa')]||null:null,'limit':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')]['limit']||null:null,'include':_0x27c292[_0x69fb('0x7')]?_0x27c292[_0x69fb('0x7')]['include']?_[_0x69fb('0xb')](_0x27c292[_0x69fb('0x7')]['include'],function(_0x1d511b){return{'model':db[_0x1d511b[_0x69fb('0xc')]],'as':_0x1d511b['as'],'attributes':_0x1d511b[_0x69fb('0xa')],'include':_0x1d511b[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x1d511b['include'],function(_0x4e9c4b){return{'model':db[_0x4e9c4b['model']],'as':_0x4e9c4b['as'],'attributes':_0x4e9c4b[_0x69fb('0xa')],'include':_0x4e9c4b['include']?_[_0x69fb('0xb')](_0x4e9c4b['include'],function(_0x29d3ab){return{'model':db[_0x29d3ab[_0x69fb('0xc')]],'as':_0x29d3ab['as'],'attributes':_0x29d3ab['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4be296){logger[_0x69fb('0xe')](_0x69fb('0x5'),_0x27c292);logger[_0x69fb('0xf')]('GetCmHopper',_0x27c292,JSON['stringify'](_0x4be296));_0x45f36c(_0x4be296);})[_0x69fb('0x10')](function(_0x5d5c52){logger[_0x69fb('0x11')]('GetCmHopper',_0x5d5c52[_0x69fb('0x12')],_0x27c292);_0x545ef7(_0x157623[_0x69fb('0x11')](0x1f4,_0x5d5c52['message']));});});};exports[_0x69fb('0x13')]=function(_0x165fb2){var _0x23eb07=this;return new Promise(function(_0x28964f,_0x267784){return db[_0x69fb('0x14')][_0x69fb('0x15')]({'raw':_0x165fb2[_0x69fb('0x7')]?_0x165fb2[_0x69fb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x165fb2[_0x69fb('0x7')]?_0x165fb2[_0x69fb('0x7')]['where']||null:null,'attributes':_0x165fb2['options']?_0x165fb2[_0x69fb('0x7')]['attributes']||null:null,'include':_0x165fb2[_0x69fb('0x7')]?_0x165fb2[_0x69fb('0x7')][_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x165fb2[_0x69fb('0x7')][_0x69fb('0xd')],function(_0x372cbf){return{'model':db[_0x372cbf[_0x69fb('0xc')]],'as':_0x372cbf['as'],'attributes':_0x372cbf['attributes'],'include':_0x372cbf[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x372cbf[_0x69fb('0xd')],function(_0x1a5495){return{'model':db[_0x1a5495['model']],'as':_0x1a5495['as'],'attributes':_0x1a5495['attributes'],'include':_0x1a5495[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x1a5495[_0x69fb('0xd')],function(_0x27f2da){return{'model':db[_0x27f2da[_0x69fb('0xc')]],'as':_0x27f2da['as'],'attributes':_0x27f2da[_0x69fb('0xa')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb98a73){logger['info'](_0x69fb('0x13'),_0x165fb2);logger['debug'](_0x69fb('0x13'),_0x165fb2,JSON[_0x69fb('0x16')](_0xb98a73));_0x28964f(_0xb98a73);})[_0x69fb('0x10')](function(_0x6c7de5){logger[_0x69fb('0x11')]('ShowCmHopper',_0x6c7de5[_0x69fb('0x12')],_0x165fb2);_0x267784(_0x23eb07[_0x69fb('0x11')](0x1f4,_0x6c7de5['message']));});});};exports[_0x69fb('0x17')]=function(_0x15c9e5){var _0x407a76=this;return new Promise(function(_0x27a741,_0x3305e3){return db[_0x69fb('0x14')][_0x69fb('0x18')](_0x15c9e5['body'],{'raw':_0x15c9e5['options']?_0x15c9e5['options'][_0x69fb('0x8')]===undefined?!![]:![]:!![]})[_0x69fb('0x19')](function(_0x3eb966){logger['info']('CreateCmHopper',_0x15c9e5);logger[_0x69fb('0xf')]('CreateCmHopper',_0x15c9e5,JSON[_0x69fb('0x16')](_0x3eb966));_0x27a741(_0x3eb966);})[_0x69fb('0x10')](function(_0x3fb66d){logger[_0x69fb('0x11')]('CreateCmHopper',_0x3fb66d[_0x69fb('0x12')],_0x15c9e5);_0x3305e3(_0x407a76[_0x69fb('0x11')](0x1f4,_0x3fb66d[_0x69fb('0x12')]));});});};exports['UpdateCmHopper']=function(_0x2c48b8){var _0x510256=this;return new Promise(function(_0x8e256a,_0x160c12){return db['CmHopper'][_0x69fb('0x1a')](_0x2c48b8['body'],{'raw':_0x2c48b8[_0x69fb('0x7')]?_0x2c48b8[_0x69fb('0x7')][_0x69fb('0x8')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c48b8[_0x69fb('0x7')]?_0x2c48b8[_0x69fb('0x7')][_0x69fb('0x9')]||null:null,'attributes':_0x2c48b8[_0x69fb('0x7')]?_0x2c48b8[_0x69fb('0x7')][_0x69fb('0xa')]||null:null,'limit':_0x2c48b8['options']?_0x2c48b8[_0x69fb('0x7')]['limit']||null:null})[_0x69fb('0x19')](function(_0x50d751){logger[_0x69fb('0xe')](_0x69fb('0x1b'),_0x2c48b8);logger[_0x69fb('0xe')]('UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON[_0x69fb('0x16')](_0x2c48b8[_0x69fb('0x7')][_0x69fb('0x9')]),_0x2c48b8[_0x69fb('0x1c')][_0x69fb('0x1d')]);logger[_0x69fb('0xf')](_0x69fb('0x1b'),_0x2c48b8,JSON[_0x69fb('0x16')](_0x50d751));_0x8e256a(_0x50d751);})[_0x69fb('0x10')](function(_0x302281){logger[_0x69fb('0x11')](_0x69fb('0x1b'),_0x302281[_0x69fb('0x12')],_0x2c48b8);_0x160c12(_0x510256[_0x69fb('0x11')](0x1f4,_0x302281[_0x69fb('0x12')]));});});};exports[_0x69fb('0x1e')]=function(_0x327bee){var _0x313cc2=this;return new Promise(function(_0x3a2217,_0x279709){return db[_0x69fb('0x14')][_0x69fb('0x1f')]({'where':_0x327bee[_0x69fb('0x7')]?_0x327bee['options'][_0x69fb('0x9')]||null:null})['then'](function(_0x1c4d45){logger[_0x69fb('0xe')](_0x69fb('0x1e'),_0x327bee);logger[_0x69fb('0xf')](_0x69fb('0x1e'),_0x327bee,JSON[_0x69fb('0x16')](_0x1c4d45));_0x3a2217(_0x1c4d45);})[_0x69fb('0x10')](function(_0x19ccab){logger[_0x69fb('0x11')]('DestroyCmHopper',_0x19ccab['message'],_0x327bee);_0x279709(_0x313cc2[_0x69fb('0x11')](0x1f4,_0x19ccab[_0x69fb('0x12')]));});});};exports['GetContactDialer']=function(_0x8939b6){var _0x409a66=this;return new Promise(function(_0x54676f,_0x23f209){return db[_0x69fb('0x20')][_0x69fb('0x21')]()[_0x69fb('0x19')](function(_0x4f1538){return db['sequelize']['transaction'](function(_0x257b9e){return db[_0x69fb('0x14')]['findAll']({'where':_0x8939b6[_0x69fb('0x7')]?_0x8939b6[_0x69fb('0x7')]['where']||null:null,'attributes':_0x8939b6[_0x69fb('0x7')]?_0x8939b6['options'][_0x69fb('0xa')]||null:null,'limit':_0x8939b6['options']?_0x8939b6[_0x69fb('0x7')][_0x69fb('0x22')]||null:null,'order':_0x8939b6['options']?_0x8939b6['options'][_0x69fb('0x23')]||null:null,'transaction':_0x257b9e,'lock':_0x257b9e[_0x69fb('0x24')][_0x69fb('0x25')],'include':[{'model':db['CmContact'],'as':_0x69fb('0x26'),'attributes':_['keys'](_0x4f1538)},{'model':db[_0x69fb('0x27')],'as':_0x69fb('0x28'),'attributes':['id',_0x69fb('0x29'),'voicePause']}]})['then'](function(_0x283ccb){var _0x1312f4=[];var _0x169efc=[];for(var _0x317d73=0x0;_0x317d73<_0x283ccb['length'];_0x317d73+=0x1){var _0x296564=_0x283ccb[_0x317d73]['UserId'];if(_0x296564===null){_0x1312f4['push'](_0x283ccb[_0x317d73][_0x69fb('0x1a')](_0x8939b6[_0x69fb('0x1c')],{'transaction':_0x257b9e}));}else if(!_0x169efc[_0x69fb('0x2a')](_0x296564)){_0x169efc[_0x69fb('0x2b')](_0x296564);_0x1312f4[_0x69fb('0x2b')](_0x283ccb[_0x317d73][_0x69fb('0x1a')](_0x8939b6[_0x69fb('0x1c')],{'transaction':_0x257b9e}));}}return BPromise[_0x69fb('0x2c')](_0x1312f4);});})[_0x69fb('0x19')](function(_0x512e7f){logger['info'](_0x69fb('0x2d'),_0x8939b6);if(_0x512e7f[_0x69fb('0x2e')]>0x0){logger[_0x69fb('0xe')](_0x69fb('0x2f'),_0x512e7f[0x0][_0x69fb('0x30')]['id'],_0x512e7f[0x0][_0x69fb('0x30')][_0x69fb('0x31')],_0x512e7f[0x0][_0x69fb('0x30')][_0x69fb('0x1d')]);}logger[_0x69fb('0xf')]('GetContactDialer',_0x8939b6,JSON[_0x69fb('0x16')](_0x512e7f));_0x54676f(_0x512e7f);})[_0x69fb('0x10')](function(_0x53c556){logger[_0x69fb('0x11')]('GetContactDialer',_0x53c556[_0x69fb('0x12')],_0x8939b6);_0x23f209(_0x409a66[_0x69fb('0x11')](0x1f4,_0x53c556[_0x69fb('0x12')]));});});});};exports['MoveContactManagedDialer']=function(_0x249c57){var _0x234a58=this;return new Promise(function(_0x172276,_0xcd6281){return db[_0x69fb('0x32')][_0x69fb('0x33')](function(_0xb18e82){return db[_0x69fb('0x34')][_0x69fb('0x18')](_0x249c57[_0x69fb('0x1c')],{'raw':_0x249c57[_0x69fb('0x7')]?_0x249c57[_0x69fb('0x7')]['raw']===undefined?!![]:![]:!![],'transaction':_0xb18e82})[_0x69fb('0x19')](function(){logger[_0x69fb('0xe')](_0x69fb('0x35'),JSON['stringify'](_0x249c57[_0x69fb('0x7')][_0x69fb('0x9')]),_0x249c57[_0x69fb('0x7')][_0x69fb('0x9')][_0x69fb('0x1d')]);return db['CmHopper'][_0x69fb('0x1f')]({'where':_0x249c57[_0x69fb('0x7')]?_0x249c57[_0x69fb('0x7')]['where']||null:null,'transaction':_0xb18e82});});})[_0x69fb('0x19')](function(_0x128e0b){logger[_0x69fb('0xe')](_0x69fb('0x36'),_0x249c57);logger['debug'](_0x69fb('0x36'),_0x249c57,JSON[_0x69fb('0x16')](_0x128e0b));_0x172276(_0x128e0b);})[_0x69fb('0x10')](function(_0xcc52d6){logger[_0x69fb('0x11')](_0x69fb('0x36'),_0xcc52d6['message'],_0x249c57);_0xcd6281(_0x234a58[_0x69fb('0x11')](0x1f4,_0xcc52d6[_0x69fb('0x12')]));});});};exports[_0x69fb('0x37')]=function(_0x27ea3d){var _0x586306=this;return new Promise(function(_0x365dca,_0x2d0102){return db[_0x69fb('0x14')][_0x69fb('0x6')]({'raw':_0x27ea3d[_0x69fb('0x7')]?_0x27ea3d[_0x69fb('0x7')][_0x69fb('0x8')]===undefined?!![]:![]:!![],'where':_0x27ea3d['options']?_0x27ea3d[_0x69fb('0x7')][_0x69fb('0x9')]||null:null,'attributes':[[db[_0x69fb('0x32')]['fn'](_0x69fb('0x38'),db[_0x69fb('0x32')]['fn']('IF',db[_0x69fb('0x32')][_0x69fb('0x39')](_0x69fb('0x3a')+util[_0x69fb('0x3b')](_0x69fb('0x3c'),moment()[_0x69fb('0x3b')](_0x69fb('0x3d')))+_0x69fb('0x3e')))),_0x69fb('0x3f')]]})[_0x69fb('0x19')](function(_0x478837){logger[_0x69fb('0xe')](_0x69fb('0x37'),_0x27ea3d);logger[_0x69fb('0xf')](_0x69fb('0x37'),_0x27ea3d,JSON[_0x69fb('0x16')](_0x478837));_0x365dca(_0x478837);})[_0x69fb('0x10')](function(_0x43ce9f){logger['error'](_0x69fb('0x37'),_0x43ce9f['message'],_0x27ea3d);_0x2d0102(_0x586306[_0x69fb('0x11')](0x1f4,_0x43ce9f[_0x69fb('0x12')]));});});};exports[_0x69fb('0x40')]=function(_0x503b12){var _0x2d2fff=this;return new Promise(function(_0x58ba70,_0x4d0dfd){return db['CmContact'][_0x69fb('0x21')]()['then'](function(){return db['sequelize'][_0x69fb('0x33')](function(_0x546751){return db[_0x69fb('0x14')][_0x69fb('0x6')]({'where':_0x503b12[_0x69fb('0x7')]?_0x503b12[_0x69fb('0x7')]['where']||null:null,'attributes':_0x503b12[_0x69fb('0x7')]?_0x503b12[_0x69fb('0x7')][_0x69fb('0xa')]||null:null,'limit':0x1,'order':_0x503b12[_0x69fb('0x7')]?_0x503b12[_0x69fb('0x7')][_0x69fb('0x23')]||null:null,'group':db[_0x69fb('0x14')][_0x69fb('0x41')],'transaction':_0x546751,'lock':_0x546751[_0x69fb('0x24')][_0x69fb('0x25')],'include':_0x503b12['options']?_0x503b12['options'][_0x69fb('0xd')]?_['map'](_0x503b12[_0x69fb('0x7')][_0x69fb('0xd')],function(_0x2ac43f){return{'model':db[_0x2ac43f[_0x69fb('0xc')]],'as':_0x2ac43f['as'],'attributes':_0x2ac43f[_0x69fb('0xa')],'include':_0x2ac43f['include']?_[_0x69fb('0xb')](_0x2ac43f['include'],function(_0x158ee3){return{'model':db[_0x158ee3[_0x69fb('0xc')]],'as':_0x158ee3['as'],'attributes':_0x158ee3[_0x69fb('0xa')],'include':_0x158ee3[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x158ee3[_0x69fb('0xd')],function(_0x3db80f){return{'model':db[_0x3db80f[_0x69fb('0xc')]],'as':_0x3db80f['as'],'attributes':_0x3db80f['attributes']};}):[]};}):[]};}):[]:[]})[_0x69fb('0x19')](function(_0x113d9b){var _0x41dd25=[];for(var _0x8b8631=0x0;_0x8b8631<_0x113d9b[_0x69fb('0x2e')];_0x8b8631+=0x1){_0x41dd25['push'](_0x113d9b[_0x8b8631][_0x69fb('0x1a')](_0x503b12['body'],{'transaction':_0x546751}));}return BPromise['all'](_0x41dd25);});})[_0x69fb('0x19')](function(_0x3b8077){logger[_0x69fb('0xe')](_0x69fb('0x40'),_0x503b12);logger[_0x69fb('0xf')]('GetContactRecallMe',_0x503b12,JSON[_0x69fb('0x16')](_0x3b8077));_0x58ba70(_0x3b8077);})[_0x69fb('0x10')](function(_0x3ecc8e){logger[_0x69fb('0x11')](_0x69fb('0x40'),_0x3ecc8e[_0x69fb('0x12')],_0x503b12);_0x4d0dfd(_0x2d2fff[_0x69fb('0x11')](0x1f4,_0x3ecc8e[_0x69fb('0x12')]));});});});};exports[_0x69fb('0x42')]=function(_0x50ab91){var _0x392484=this;return new Promise(function(_0x5f0f50,_0x53ee83){db['CmContact'][_0x69fb('0x21')]()[_0x69fb('0x19')](function(_0x384440){return db[_0x69fb('0x14')]['findAll']({'raw':_0x50ab91[_0x69fb('0x7')]?_0x50ab91[_0x69fb('0x7')]['raw']===undefined?!![]:![]:!![],'where':_0x50ab91[_0x69fb('0x7')]?_0x50ab91[_0x69fb('0x7')]['where']||null:null,'attributes':_0x50ab91[_0x69fb('0x7')]?_0x50ab91[_0x69fb('0x7')]['attributes']||null:null,'limit':_0x50ab91[_0x69fb('0x7')]?_0x50ab91['options'][_0x69fb('0x22')]||null:null,'include':_0x50ab91['options']?_0x50ab91[_0x69fb('0x7')][_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x50ab91['options'][_0x69fb('0xd')],function(_0x2f4172){return{'model':db[_0x2f4172[_0x69fb('0xc')]],'as':_0x2f4172['as'],'attributes':_0x2f4172['as']==='Contact'?_['keys'](_0x384440):_0x2f4172[_0x69fb('0xa')],'include':_0x2f4172[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x2f4172[_0x69fb('0xd')],function(_0x251573){return{'model':db[_0x251573[_0x69fb('0xc')]],'as':_0x251573['as'],'attributes':_0x251573[_0x69fb('0xa')],'include':_0x251573[_0x69fb('0xd')]?_[_0x69fb('0xb')](_0x251573[_0x69fb('0xd')],function(_0x426c4c){return{'model':db[_0x426c4c[_0x69fb('0xc')]],'as':_0x426c4c['as'],'attributes':_0x426c4c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x51cb63){logger[_0x69fb('0xe')](_0x69fb('0x5'),_0x50ab91);logger['debug']('GetCmHopper',_0x50ab91,JSON[_0x69fb('0x16')](_0x51cb63));_0x5f0f50(_0x51cb63);})['catch'](function(_0x34df5c){logger[_0x69fb('0x11')]('GetCmHopper',_0x34df5c['message'],_0x50ab91);_0x53ee83(_0x392484['error'](0x1f4,_0x34df5c[_0x69fb('0x12')]));});});});};exports[_0x69fb('0x43')]=function(_0x17ff83){var _0x517a73=this;return new Promise(function(_0x2297ee,_0x259c14){return db[_0x69fb('0x20')][_0x69fb('0x44')]({'raw':!![],'where':{'phone':_0x17ff83[_0x69fb('0x7')][_0x69fb('0x9')][_0x69fb('0x45')]},'attributes':['id','dialTimezone'],'order':[['id',_0x69fb('0x46')]]})[_0x69fb('0x19')](function(_0x468b9e){logger[_0x69fb('0xe')](_0x69fb('0x47'),_0x17ff83);logger[_0x69fb('0xf')]('getContactByPhone',_0x17ff83,JSON[_0x69fb('0x16')](_0x468b9e));_0x2297ee(_0x468b9e);})['catch'](function(_0x22dc84){logger['error']('getContactByPhone',_0x22dc84['message'],_0x17ff83);_0x259c14(_0x517a73[_0x69fb('0x11')](0x1f4,_0x22dc84[_0x69fb('0x12')]));});});};exports[_0x69fb('0x48')]=function(_0x4c8ca6){var _0x558778=this;return new Promise(function(_0x2c0a90,_0x4622b2){return db[_0x69fb('0x32')]['transaction'](function(_0xb9c4f9){var _0xe78ee3=_0x4c8ca6[_0x69fb('0x7')]&&_0x4c8ca6[_0x69fb('0x7')][_0x69fb('0x9')]?_0x4c8ca6[_0x69fb('0x7')]['where']:{};return db[_0x69fb('0x14')][_0x69fb('0x1a')](_0x4c8ca6[_0x69fb('0x1c')],{'where':_0xe78ee3,'transaction':_0xb9c4f9})[_0x69fb('0x19')](function(_0x3b2390){logger[_0x69fb('0xe')](_0x69fb('0x48'),_0x4c8ca6);logger['debug']('ResetActiveCalls',_0x4c8ca6,JSON['stringify'](_0x3b2390));_0x2c0a90(_0x3b2390);})[_0x69fb('0x10')](function(_0x5b130b){logger[_0x69fb('0x11')](_0x69fb('0x48'),_0x5b130b['message'],_0x4c8ca6);_0x4622b2(_0x558778[_0x69fb('0x11')](0x1f4,_0x5b130b[_0x69fb('0x12')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x21084c){var _0x4692c6=this;var _0x26831e=_0x21084c[_0x69fb('0x1c')][_0x69fb('0x9')]['voiceQueueIds'];var _0x475e3f=_0x21084c[_0x69fb('0x1c')]['where'][_0x69fb('0x49')];var _0x517f40=_0x21084c[_0x69fb('0x1c')][_0x69fb('0x9')][_0x69fb('0x4a')];return new Promise(function(_0xbba0af,_0x2c3185){return db[_0x69fb('0x14')][_0x69fb('0x6')]({'where':{'voiceQueueId':{'$in':_0x26831e},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x69fb('0x32')][_0x69fb('0x39')]('NOW()\x20+\x20INTERVAL\x20'+_0x475e3f+_0x69fb('0x4b')),'$gt':db[_0x69fb('0x32')][_0x69fb('0x39')](_0x69fb('0x4c'))}},'UserId':{'$in':_0x517f40}},'include':[{'model':db['CmContact'],'as':_0x69fb('0x26')},{'model':db['User'],'as':_0x69fb('0x28'),'attributes':['id',_0x69fb('0x29'),'voicePause']},{'model':db[_0x69fb('0x4d')],'as':'List'}]})[_0x69fb('0x19')](function(_0x4fcfd9){if(_0x4fcfd9[_0x69fb('0x2e')]>0x0){return db[_0x69fb('0x32')]['transaction'](function(_0x2ea6ad){return db['CmHopper']['update']({'recallmeNotifiedDate':db[_0x69fb('0x32')]['literal'](_0x69fb('0x4c'))},{'where':{'id':{'$in':_[_0x69fb('0xb')](_0x4fcfd9,'id')}},'transaction':_0x2ea6ad})[_0x69fb('0x19')](function(){_0xbba0af(_0x4fcfd9);})[_0x69fb('0x10')](function(_0x125c03){logger['error'](_0x69fb('0x4e'),_0x125c03[_0x69fb('0x12')],_0x21084c);_0x2c3185(_0x4692c6['error'](0x1f4,_0x125c03[_0x69fb('0x12')]));});})[_0x69fb('0x10')](function(_0x5cda3a){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x5cda3a[_0x69fb('0x12')],_0x21084c);_0x2c3185(_0x4692c6[_0x69fb('0x11')](0x1f4,_0x5cda3a['message']));});}else{_0xbba0af(_0x4fcfd9);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 9bd87cf..030a73f 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 _0xf944=['Router','../../components/auth/service','get','isAuthenticated','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','put','update','delete','destroy','exports'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xf944,0xb0));var _0x4f94=function(_0x668d13,_0x5e6f3b){_0x668d13=_0x668d13-0x0;var _0x25350b=_0xf944[_0x668d13];return _0x25350b;};'use strict';var express=require('express');var router=express[_0x4f94('0x0')]();var auth=require(_0x4f94('0x1'));var controller=require('./cmHopper.controller');router[_0x4f94('0x2')]('/',auth[_0x4f94('0x3')](),controller['index']);router[_0x4f94('0x2')](_0x4f94('0x4'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x5')]);router[_0x4f94('0x2')](_0x4f94('0x6'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x7')]);router[_0x4f94('0x2')](_0x4f94('0x8'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x9')]);router[_0x4f94('0x2')](_0x4f94('0xa'),auth[_0x4f94('0x3')](),controller[_0x4f94('0xb')]);router[_0x4f94('0x2')](_0x4f94('0xc'),auth['isAuthenticated'](),controller['getPreviewRecall']);router[_0x4f94('0xd')]('/',auth[_0x4f94('0x3')](),controller[_0x4f94('0xe')]);router['post'](_0x4f94('0xf'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x10')]);router[_0x4f94('0xd')]('/timezone',auth['isAuthenticated'](),controller['getTimezone']);router[_0x4f94('0x11')](_0x4f94('0xa'),auth['isAuthenticated'](),controller[_0x4f94('0x12')]);router[_0x4f94('0x13')](_0x4f94('0xa'),auth[_0x4f94('0x3')](),controller[_0x4f94('0x14')]);module[_0x4f94('0x15')]=router; \ No newline at end of file +var _0xa883=['exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','isAuthenticated','describe','/opencontacts','/:id','show','/:id/previewrecall','post','create','/preview','getPreview','getTimezone','update','delete','destroy'];(function(_0x25e2bc,_0x27d1ef){var _0x5152d3=function(_0x354708){while(--_0x354708){_0x25e2bc['push'](_0x25e2bc['shift']());}};_0x5152d3(++_0x27d1ef);}(_0xa883,0x13c));var _0x3a88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa883[_0x3dd15e];return _0x231fd0;};'use strict';var express=require(_0x3a88('0x0'));var router=express[_0x3a88('0x1')]();var auth=require(_0x3a88('0x2'));var controller=require(_0x3a88('0x3'));router[_0x3a88('0x4')]('/',auth['isAuthenticated'](),controller[_0x3a88('0x5')]);router[_0x3a88('0x4')]('/describe',auth[_0x3a88('0x6')](),controller[_0x3a88('0x7')]);router[_0x3a88('0x4')](_0x3a88('0x8'),auth[_0x3a88('0x6')](),controller['getOpenContacts']);router['get']('/timezones',auth[_0x3a88('0x6')](),controller['getTimezones']);router['get'](_0x3a88('0x9'),auth[_0x3a88('0x6')](),controller[_0x3a88('0xa')]);router['get'](_0x3a88('0xb'),auth[_0x3a88('0x6')](),controller['getPreviewRecall']);router[_0x3a88('0xc')]('/',auth['isAuthenticated'](),controller[_0x3a88('0xd')]);router['post'](_0x3a88('0xe'),auth['isAuthenticated'](),controller[_0x3a88('0xf')]);router[_0x3a88('0xc')]('/timezone',auth[_0x3a88('0x6')](),controller[_0x3a88('0x10')]);router['put'](_0x3a88('0x9'),auth[_0x3a88('0x6')](),controller[_0x3a88('0x11')]);router[_0x3a88('0x12')](_0x3a88('0x9'),auth[_0x3a88('0x6')](),controller[_0x3a88('0x13')]);module[_0x3a88('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c7c677a..5c58154 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 _0xaf78=['INTEGER','STRING','YYYY-MM-DD\x20HH:mm:ss','sequelize','exports'];(function(_0x3bdb17,_0x48e72b){var _0x554d01=function(_0x81753e){while(--_0x81753e){_0x3bdb17['push'](_0x3bdb17['shift']());}};_0x554d01(++_0x48e72b);}(_0xaf78,0xb2));var _0x8af7=function(_0x5d0cd6,_0x14207a){_0x5d0cd6=_0x5d0cd6-0x0;var _0x2ac518=_0xaf78[_0x5d0cd6];return _0x2ac518;};'use strict';var moment=require('moment');var Sequelize=require(_0x8af7('0x0'));module[_0x8af7('0x1')]={'CmHopperId':{'type':Sequelize[_0x8af7('0x2')]},'phone':{'type':Sequelize[_0x8af7('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()['format'](_0x8af7('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8af7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb394=['INTEGER','DATE','format','YYYY-MM-DD\x20HH:mm:ss','moment','exports'];(function(_0x599c94,_0x464f0e){var _0x34e215=function(_0x36295a){while(--_0x36295a){_0x599c94['push'](_0x599c94['shift']());}};_0x34e215(++_0x464f0e);}(_0xb394,0x9a));var _0x4b39=function(_0x2e180b,_0x7d7e32){_0x2e180b=_0x2e180b-0x0;var _0x20b1e4=_0xb394[_0x2e180b];return _0x20b1e4;};'use strict';var moment=require(_0x4b39('0x0'));var Sequelize=require('sequelize');module[_0x4b39('0x1')]={'CmHopperId':{'type':Sequelize[_0x4b39('0x2')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x4b39('0x3')],'defaultValue':moment()[_0x4b39('0x4')](_0x4b39('0x5'))},'countbusyretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x4b39('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x4b39('0x2')],'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 33be0a4..f7ecfc9 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 _0xbe60=['user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','nolimit','order','sort','where','merge','VIRTUAL','includeAll','include','findAll','catch','show','params','options','find','create'];(function(_0x21fc96,_0x2df0fe){var _0x2e00b0=function(_0x439cde){while(--_0x439cde){_0x21fc96['push'](_0x21fc96['shift']());}};_0x2e00b0(++_0x2df0fe);}(_0xbe60,0x13e));var _0x0be6=function(_0x3ba319,_0x386603){_0x3ba319=_0x3ba319-0x0;var _0x3c0478=_0xbe60[_0x3ba319];return _0x3c0478;};'use strict';var emlformat=require(_0x0be6('0x0'));var rimraf=require(_0x0be6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0be6('0x2'));var rp=require(_0x0be6('0x3'));var moment=require(_0x0be6('0x4'));var BPromise=require(_0x0be6('0x5'));var Mustache=require(_0x0be6('0x6'));var util=require(_0x0be6('0x7'));var path=require(_0x0be6('0x8'));var sox=require(_0x0be6('0x9'));var csv=require(_0x0be6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0be6('0xb'));var _=require(_0x0be6('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0be6('0xd'));var deskjs=require(_0x0be6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0be6('0xf'));var Papa=require(_0x0be6('0x10'));var Redis=require(_0x0be6('0x11'));var authService=require(_0x0be6('0x12'));var qs=require(_0x0be6('0x13'));var as=require(_0x0be6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x0be6('0x15'));var config=require(_0x0be6('0x16'));var licenseUtil=require(_0x0be6('0x17'));var db=require(_0x0be6('0x18'))['db'];function respondWithStatusCode(_0x272166,_0x362f27){_0x362f27=_0x362f27||0xcc;return function(_0x1718e9){if(_0x1718e9){return _0x272166[_0x0be6('0x19')](_0x362f27);}return _0x272166[_0x0be6('0x1a')](_0x362f27)[_0x0be6('0x1b')]();};}function respondWithResult(_0x5ca7eb,_0x27637e){_0x27637e=_0x27637e||0xc8;return function(_0xafafb4){if(_0xafafb4){return _0x5ca7eb['status'](_0x27637e)[_0x0be6('0x1c')](_0xafafb4);}};}function respondWithFilteredResult(_0x255817,_0x23d709){return function(_0x5c086f){if(_0x5c086f){var _0x29945d=typeof _0x23d709['offset']===_0x0be6('0x1d')&&typeof _0x23d709[_0x0be6('0x1e')]===_0x0be6('0x1d');var _0x2ee176=_0x5c086f[_0x0be6('0x1f')];var _0x1486a6=_0x29945d?0x0:_0x23d709[_0x0be6('0x20')];var _0xb0e7c9=_0x29945d?_0x5c086f[_0x0be6('0x1f')]:_0x23d709[_0x0be6('0x20')]+_0x23d709[_0x0be6('0x1e')];var _0x47502d;if(_0xb0e7c9>=_0x2ee176){_0xb0e7c9=_0x2ee176;_0x47502d=0xc8;}else{_0x47502d=0xce;}_0x255817[_0x0be6('0x1a')](_0x47502d);return _0x255817['set'](_0x0be6('0x21'),_0x1486a6+'-'+_0xb0e7c9+'/'+_0x2ee176)[_0x0be6('0x1c')](_0x5c086f);}return null;};}function patchUpdates(_0xbfe25b){return function(_0xc63992){try{jsonpatch['apply'](_0xc63992,_0xbfe25b,!![]);}catch(_0x46916a){return BPromise[_0x0be6('0x22')](_0x46916a);}return _0xc63992['save']();};}function saveUpdates(_0x5231f2,_0xfd3fd6){return function(_0x20203c){if(_0x20203c){return _0x20203c[_0x0be6('0x23')](_0x5231f2)[_0x0be6('0x24')](function(_0x130745){return _0x130745;});}return null;};}function removeEntity(_0x4cfeaa,_0x221004){return function(_0xde20d7){if(_0xde20d7){return _0xde20d7['destroy']()[_0x0be6('0x24')](function(){var _0x5ec1bf=_0xde20d7[_0x0be6('0x25')]({'plain':!![]});var _0x18a276=_0x0be6('0x26');return db[_0x0be6('0x27')][_0x0be6('0x28')]({'where':{'type':_0x18a276,'resourceId':_0x5ec1bf['id']}})[_0x0be6('0x24')](function(){return _0xde20d7;});})['then'](function(){_0x4cfeaa['status'](0xcc)[_0x0be6('0x1b')]();});}};}function handleEntityNotFound(_0x165937,_0x489f1a){return function(_0x373c3f){if(!_0x373c3f){_0x165937['sendStatus'](0x194);}return _0x373c3f;};}function handleError(_0x63906c,_0x2dda55){_0x2dda55=_0x2dda55||0x1f4;return function(_0x332678){logger[_0x0be6('0x29')](_0x332678[_0x0be6('0x2a')]);if(_0x332678['name']){delete _0x332678[_0x0be6('0x2b')];}_0x63906c['status'](_0x2dda55)[_0x0be6('0x2c')](_0x332678);};}exports['index']=function(_0x829414,_0x5a5d61){var _0x298ba5={},_0x107858={},_0x366b76={'count':0x0,'rows':[]};var _0x315402=_[_0x0be6('0x2d')](db[_0x0be6('0x2e')][_0x0be6('0x2f')],function(_0x4e3289){return{'name':_0x4e3289[_0x0be6('0x30')],'type':_0x4e3289[_0x0be6('0x31')]['key']};});_0x107858[_0x0be6('0x32')]=_['map'](_0x315402,_0x0be6('0x2b'));_0x107858['query']=_[_0x0be6('0x33')](_0x829414[_0x0be6('0x34')]);_0x107858[_0x0be6('0x35')]=_['intersection'](_0x107858['model'],_0x107858['query']);_0x298ba5[_0x0be6('0x36')]=_[_0x0be6('0x37')](_0x107858[_0x0be6('0x32')],qs['fields'](_0x829414[_0x0be6('0x34')][_0x0be6('0x38')]));_0x298ba5[_0x0be6('0x36')]=_0x298ba5[_0x0be6('0x36')]['length']?_0x298ba5[_0x0be6('0x36')]:_0x107858[_0x0be6('0x32')];if(!_0x829414[_0x0be6('0x34')]['hasOwnProperty'](_0x0be6('0x39'))){_0x298ba5[_0x0be6('0x1e')]=qs['limit'](_0x829414['query']['limit']);_0x298ba5[_0x0be6('0x20')]=qs[_0x0be6('0x20')](_0x829414[_0x0be6('0x34')][_0x0be6('0x20')]);}_0x298ba5[_0x0be6('0x3a')]=qs['sort'](_0x829414[_0x0be6('0x34')][_0x0be6('0x3b')]);_0x298ba5['where']=qs['filters'](_['pick'](_0x829414['query'],_0x107858['filters']),_0x315402);if(_0x829414[_0x0be6('0x34')]['filter']){_0x298ba5[_0x0be6('0x3c')]=_[_0x0be6('0x3d')](_0x298ba5['where'],{'$or':_[_0x0be6('0x2d')](_0x315402,function(_0x4ca411){if(_0x4ca411[_0x0be6('0x31')]!==_0x0be6('0x3e')){var _0x3bb4c3={};_0x3bb4c3[_0x4ca411[_0x0be6('0x2b')]]={'$like':'%'+_0x829414[_0x0be6('0x34')]['filter']+'%'};return _0x3bb4c3;}})});}_0x298ba5=_[_0x0be6('0x3d')]({},_0x298ba5,_0x829414['options']);var _0x282bd6={'where':_0x298ba5[_0x0be6('0x3c')]};return db[_0x0be6('0x2e')][_0x0be6('0x1f')](_0x282bd6)[_0x0be6('0x24')](function(_0x473cf9){_0x366b76[_0x0be6('0x1f')]=_0x473cf9;if(_0x829414['query'][_0x0be6('0x3f')]){_0x298ba5[_0x0be6('0x40')]=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x0be6('0x41')](_0x298ba5);})[_0x0be6('0x24')](function(_0x157d0e){_0x366b76['rows']=_0x157d0e;return _0x366b76;})[_0x0be6('0x24')](respondWithFilteredResult(_0x5a5d61,_0x298ba5))[_0x0be6('0x42')](handleError(_0x5a5d61,null));};exports[_0x0be6('0x43')]=function(_0x304f72,_0x344a81){var _0x566e35={'raw':!![],'where':{'id':_0x304f72[_0x0be6('0x44')]['id']}},_0x45e3fb={};_0x45e3fb[_0x0be6('0x32')]=_['keys'](db['CmHopperAdditionalPhone'][_0x0be6('0x2f')]);_0x45e3fb[_0x0be6('0x34')]=_[_0x0be6('0x33')](_0x304f72[_0x0be6('0x34')]);_0x45e3fb[_0x0be6('0x35')]=_[_0x0be6('0x37')](_0x45e3fb[_0x0be6('0x32')],_0x45e3fb['query']);_0x566e35['attributes']=_[_0x0be6('0x37')](_0x45e3fb[_0x0be6('0x32')],qs[_0x0be6('0x38')](_0x304f72[_0x0be6('0x34')][_0x0be6('0x38')]));_0x566e35[_0x0be6('0x36')]=_0x566e35[_0x0be6('0x36')]['length']?_0x566e35[_0x0be6('0x36')]:_0x45e3fb[_0x0be6('0x32')];if(_0x304f72[_0x0be6('0x34')][_0x0be6('0x3f')]){_0x566e35[_0x0be6('0x40')]=[{'all':!![]}];}_0x566e35=_['merge']({},_0x566e35,_0x304f72[_0x0be6('0x45')]);return db[_0x0be6('0x2e')][_0x0be6('0x46')](_0x566e35)[_0x0be6('0x24')](handleEntityNotFound(_0x344a81,null))[_0x0be6('0x24')](respondWithResult(_0x344a81,null))[_0x0be6('0x42')](handleError(_0x344a81,null));};exports[_0x0be6('0x47')]=function(_0x2dd615,_0x86d2ea){return db[_0x0be6('0x2e')][_0x0be6('0x47')](_0x2dd615['body'],{})['then'](function(_0x1390fb){var _0x342837=_0x2dd615[_0x0be6('0x48')]['get']({'plain':!![]});if(!_0x342837)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x342837[_0x0be6('0x49')]==='user'){var _0x535b8e=_0x1390fb['get']({'plain':!![]});var _0x4a2703=_0x0be6('0x26');return db['UserProfileSection'][_0x0be6('0x46')]({'where':{'name':_0x4a2703,'userProfileId':_0x342837[_0x0be6('0x4a')]},'raw':!![]})[_0x0be6('0x24')](function(_0xc09ed7){if(_0xc09ed7&&_0xc09ed7[_0x0be6('0x4b')]===0x0){return db[_0x0be6('0x27')]['create']({'name':_0x535b8e[_0x0be6('0x2b')],'resourceId':_0x535b8e['id'],'type':_0xc09ed7[_0x0be6('0x2b')],'sectionId':_0xc09ed7['id']},{})['then'](function(){return _0x1390fb;});}else{return _0x1390fb;}})[_0x0be6('0x42')](function(_0x401ded){logger[_0x0be6('0x29')](_0x0be6('0x4c'),_0x401ded);throw _0x401ded;});}return _0x1390fb;})[_0x0be6('0x24')](respondWithResult(_0x86d2ea,0xc9))['catch'](handleError(_0x86d2ea,null));};exports[_0x0be6('0x23')]=function(_0x10ddf8,_0x4e9a75){if(_0x10ddf8[_0x0be6('0x4d')]['id']){delete _0x10ddf8[_0x0be6('0x4d')]['id'];}return db[_0x0be6('0x2e')]['find']({'where':{'id':_0x10ddf8['params']['id']}})[_0x0be6('0x24')](handleEntityNotFound(_0x4e9a75,null))['then'](saveUpdates(_0x10ddf8['body'],null))[_0x0be6('0x24')](respondWithResult(_0x4e9a75,null))['catch'](handleError(_0x4e9a75,null));};exports['destroy']=function(_0x41ff17,_0x53efa7){return db[_0x0be6('0x2e')]['find']({'where':{'id':_0x41ff17[_0x0be6('0x44')]['id']}})['then'](handleEntityNotFound(_0x53efa7,null))['then'](removeEntity(_0x53efa7,null))[_0x0be6('0x42')](handleError(_0x53efa7,null));}; \ No newline at end of file +var _0xf51e=['where','pick','filter','map','merge','options','include','findAll','rows','show','params','includeAll','find','catch','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','body','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','update','destroy','then','UserProfileResource','error','stack','name','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort'];(function(_0x1006d5,_0x31bf70){var _0x4513da=function(_0x345cb6){while(--_0x345cb6){_0x1006d5['push'](_0x1006d5['shift']());}};_0x4513da(++_0x31bf70);}(_0xf51e,0x1ad));var _0xef51=function(_0x15a807,_0x102fdb){_0x15a807=_0x15a807-0x0;var _0x4008a8=_0xf51e[_0x15a807];return _0x4008a8;};'use strict';var emlformat=require(_0xef51('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef51('0x1'));var jsonpatch=require(_0xef51('0x2'));var rp=require('request-promise');var moment=require(_0xef51('0x3'));var BPromise=require(_0xef51('0x4'));var Mustache=require(_0xef51('0x5'));var util=require(_0xef51('0x6'));var path=require(_0xef51('0x7'));var sox=require(_0xef51('0x8'));var csv=require(_0xef51('0x9'));var ejs=require(_0xef51('0xa'));var fs=require('fs');var fs_extra=require(_0xef51('0xb'));var _=require(_0xef51('0xc'));var squel=require(_0xef51('0xd'));var crypto=require(_0xef51('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xef51('0xf'));var toCsv=require(_0xef51('0x9'));var querystring=require(_0xef51('0x10'));var Papa=require(_0xef51('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef51('0x12'));var as=require(_0xef51('0x13'));var hardwareService=require(_0xef51('0x14'));var logger=require(_0xef51('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xef51('0x16'));var licenseUtil=require(_0xef51('0x17'));var db=require(_0xef51('0x18'))['db'];function respondWithStatusCode(_0x1bdb7e,_0xc8914f){_0xc8914f=_0xc8914f||0xcc;return function(_0x2d9f97){if(_0x2d9f97){return _0x1bdb7e[_0xef51('0x19')](_0xc8914f);}return _0x1bdb7e[_0xef51('0x1a')](_0xc8914f)['end']();};}function respondWithResult(_0x47d40c,_0x466597){_0x466597=_0x466597||0xc8;return function(_0x14ba0e){if(_0x14ba0e){return _0x47d40c['status'](_0x466597)[_0xef51('0x1b')](_0x14ba0e);}};}function respondWithFilteredResult(_0x4d2913,_0x7bb19a){return function(_0x59453f){if(_0x59453f){var _0x42277c=typeof _0x7bb19a[_0xef51('0x1c')]===_0xef51('0x1d')&&typeof _0x7bb19a['limit']===_0xef51('0x1d');var _0x4ccb78=_0x59453f[_0xef51('0x1e')];var _0x1e0c6f=_0x42277c?0x0:_0x7bb19a[_0xef51('0x1c')];var _0x437aed=_0x42277c?_0x59453f['count']:_0x7bb19a[_0xef51('0x1c')]+_0x7bb19a[_0xef51('0x1f')];var _0x494a25;if(_0x437aed>=_0x4ccb78){_0x437aed=_0x4ccb78;_0x494a25=0xc8;}else{_0x494a25=0xce;}_0x4d2913[_0xef51('0x1a')](_0x494a25);return _0x4d2913['set'](_0xef51('0x20'),_0x1e0c6f+'-'+_0x437aed+'/'+_0x4ccb78)[_0xef51('0x1b')](_0x59453f);}return null;};}function patchUpdates(_0xd79381){return function(_0x4a8a82){try{jsonpatch[_0xef51('0x21')](_0x4a8a82,_0xd79381,!![]);}catch(_0x128784){return BPromise['reject'](_0x128784);}return _0x4a8a82['save']();};}function saveUpdates(_0x3f9a02,_0xe22a16){return function(_0x2d25b1){if(_0x2d25b1){return _0x2d25b1[_0xef51('0x22')](_0x3f9a02)['then'](function(_0x3a2616){return _0x3a2616;});}return null;};}function removeEntity(_0xe0e466,_0x1a02d4){return function(_0x1653dc){if(_0x1653dc){return _0x1653dc[_0xef51('0x23')]()[_0xef51('0x24')](function(){var _0x187cc9=_0x1653dc['get']({'plain':!![]});var _0x256237='CmHopperAdditionalPhones';return db[_0xef51('0x25')][_0xef51('0x23')]({'where':{'type':_0x256237,'resourceId':_0x187cc9['id']}})[_0xef51('0x24')](function(){return _0x1653dc;});})['then'](function(){_0xe0e466[_0xef51('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x394cdc,_0x5d31b8){return function(_0x589743){if(!_0x589743){_0x394cdc[_0xef51('0x19')](0x194);}return _0x589743;};}function handleError(_0x570274,_0x1f6a68){_0x1f6a68=_0x1f6a68||0x1f4;return function(_0x58d2e0){logger[_0xef51('0x26')](_0x58d2e0[_0xef51('0x27')]);if(_0x58d2e0['name']){delete _0x58d2e0[_0xef51('0x28')];}_0x570274[_0xef51('0x1a')](_0x1f6a68)['send'](_0x58d2e0);};}exports['index']=function(_0x37e14c,_0x4a7b8e){var _0x2b6e82={},_0x1ff41f={},_0x1b3a29={'count':0x0,'rows':[]};var _0x1eda4e=_['map'](db[_0xef51('0x29')][_0xef51('0x2a')],function(_0x95cb3c){return{'name':_0x95cb3c[_0xef51('0x2b')],'type':_0x95cb3c[_0xef51('0x2c')][_0xef51('0x2d')]};});_0x1ff41f[_0xef51('0x2e')]=_['map'](_0x1eda4e,_0xef51('0x28'));_0x1ff41f[_0xef51('0x2f')]=_[_0xef51('0x30')](_0x37e14c[_0xef51('0x2f')]);_0x1ff41f[_0xef51('0x31')]=_[_0xef51('0x32')](_0x1ff41f[_0xef51('0x2e')],_0x1ff41f['query']);_0x2b6e82['attributes']=_[_0xef51('0x32')](_0x1ff41f[_0xef51('0x2e')],qs[_0xef51('0x33')](_0x37e14c[_0xef51('0x2f')][_0xef51('0x33')]));_0x2b6e82[_0xef51('0x34')]=_0x2b6e82[_0xef51('0x34')][_0xef51('0x35')]?_0x2b6e82['attributes']:_0x1ff41f[_0xef51('0x2e')];if(!_0x37e14c['query']['hasOwnProperty'](_0xef51('0x36'))){_0x2b6e82['limit']=qs[_0xef51('0x1f')](_0x37e14c['query'][_0xef51('0x1f')]);_0x2b6e82[_0xef51('0x1c')]=qs['offset'](_0x37e14c[_0xef51('0x2f')][_0xef51('0x1c')]);}_0x2b6e82[_0xef51('0x37')]=qs[_0xef51('0x38')](_0x37e14c[_0xef51('0x2f')][_0xef51('0x38')]);_0x2b6e82[_0xef51('0x39')]=qs[_0xef51('0x31')](_[_0xef51('0x3a')](_0x37e14c['query'],_0x1ff41f[_0xef51('0x31')]),_0x1eda4e);if(_0x37e14c['query'][_0xef51('0x3b')]){_0x2b6e82[_0xef51('0x39')]=_['merge'](_0x2b6e82['where'],{'$or':_[_0xef51('0x3c')](_0x1eda4e,function(_0xe90898){if(_0xe90898[_0xef51('0x2c')]!=='VIRTUAL'){var _0x1272e5={};_0x1272e5[_0xe90898[_0xef51('0x28')]]={'$like':'%'+_0x37e14c['query'][_0xef51('0x3b')]+'%'};return _0x1272e5;}})});}_0x2b6e82=_[_0xef51('0x3d')]({},_0x2b6e82,_0x37e14c[_0xef51('0x3e')]);var _0x4e9b24={'where':_0x2b6e82[_0xef51('0x39')]};return db[_0xef51('0x29')][_0xef51('0x1e')](_0x4e9b24)[_0xef51('0x24')](function(_0x95228b){_0x1b3a29[_0xef51('0x1e')]=_0x95228b;if(_0x37e14c['query']['includeAll']){_0x2b6e82[_0xef51('0x3f')]=[{'all':!![]}];}return db[_0xef51('0x29')][_0xef51('0x40')](_0x2b6e82);})[_0xef51('0x24')](function(_0x1bc4d2){_0x1b3a29[_0xef51('0x41')]=_0x1bc4d2;return _0x1b3a29;})['then'](respondWithFilteredResult(_0x4a7b8e,_0x2b6e82))['catch'](handleError(_0x4a7b8e,null));};exports[_0xef51('0x42')]=function(_0x4f21ed,_0x3d6e01){var _0x5b8ead={'raw':!![],'where':{'id':_0x4f21ed[_0xef51('0x43')]['id']}},_0x4f4695={};_0x4f4695[_0xef51('0x2e')]=_[_0xef51('0x30')](db['CmHopperAdditionalPhone'][_0xef51('0x2a')]);_0x4f4695['query']=_['keys'](_0x4f21ed[_0xef51('0x2f')]);_0x4f4695[_0xef51('0x31')]=_['intersection'](_0x4f4695[_0xef51('0x2e')],_0x4f4695[_0xef51('0x2f')]);_0x5b8ead['attributes']=_[_0xef51('0x32')](_0x4f4695[_0xef51('0x2e')],qs[_0xef51('0x33')](_0x4f21ed[_0xef51('0x2f')][_0xef51('0x33')]));_0x5b8ead[_0xef51('0x34')]=_0x5b8ead[_0xef51('0x34')][_0xef51('0x35')]?_0x5b8ead[_0xef51('0x34')]:_0x4f4695['model'];if(_0x4f21ed[_0xef51('0x2f')][_0xef51('0x44')]){_0x5b8ead[_0xef51('0x3f')]=[{'all':!![]}];}_0x5b8ead=_['merge']({},_0x5b8ead,_0x4f21ed['options']);return db[_0xef51('0x29')][_0xef51('0x45')](_0x5b8ead)[_0xef51('0x24')](handleEntityNotFound(_0x3d6e01,null))[_0xef51('0x24')](respondWithResult(_0x3d6e01,null))[_0xef51('0x46')](handleError(_0x3d6e01,null));};exports[_0xef51('0x47')]=function(_0xe32a87,_0x53faca){return db[_0xef51('0x29')][_0xef51('0x47')](_0xe32a87['body'],{})['then'](function(_0x522bc5){var _0x7f937a=_0xe32a87['user'][_0xef51('0x48')]({'plain':!![]});if(!_0x7f937a)throw new Error(_0xef51('0x49'));if(_0x7f937a[_0xef51('0x4a')]===_0xef51('0x4b')){var _0x59c9dd=_0x522bc5[_0xef51('0x48')]({'plain':!![]});var _0x3b6cdb=_0xef51('0x4c');return db[_0xef51('0x4d')][_0xef51('0x45')]({'where':{'name':_0x3b6cdb,'userProfileId':_0x7f937a[_0xef51('0x4e')]},'raw':!![]})[_0xef51('0x24')](function(_0x5161b5){if(_0x5161b5&&_0x5161b5[_0xef51('0x4f')]===0x0){return db[_0xef51('0x25')][_0xef51('0x47')]({'name':_0x59c9dd[_0xef51('0x28')],'resourceId':_0x59c9dd['id'],'type':_0x5161b5[_0xef51('0x28')],'sectionId':_0x5161b5['id']},{})[_0xef51('0x24')](function(){return _0x522bc5;});}else{return _0x522bc5;}})[_0xef51('0x46')](function(_0x3d4c3d){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3d4c3d);throw _0x3d4c3d;});}return _0x522bc5;})[_0xef51('0x24')](respondWithResult(_0x53faca,0xc9))[_0xef51('0x46')](handleError(_0x53faca,null));};exports[_0xef51('0x22')]=function(_0x2bc7de,_0x43d2fb){if(_0x2bc7de[_0xef51('0x50')]['id']){delete _0x2bc7de[_0xef51('0x50')]['id'];}return db['CmHopperAdditionalPhone'][_0xef51('0x45')]({'where':{'id':_0x2bc7de[_0xef51('0x43')]['id']}})['then'](handleEntityNotFound(_0x43d2fb,null))['then'](saveUpdates(_0x2bc7de[_0xef51('0x50')],null))[_0xef51('0x24')](respondWithResult(_0x43d2fb,null))[_0xef51('0x46')](handleError(_0x43d2fb,null));};exports[_0xef51('0x23')]=function(_0x28bee1,_0x4ec616){return db[_0xef51('0x29')][_0xef51('0x45')]({'where':{'id':_0x28bee1['params']['id']}})[_0xef51('0x24')](handleEntityNotFound(_0x4ec616,null))[_0xef51('0x24')](removeEntity(_0x4ec616,null))['catch'](handleError(_0x4ec616,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index f9f7b1b..addfced 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 _0x5f4e=['path','rimraf','../../config/environment','CmHopperAdditionalPhone','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x3886c5,_0x11e091){var _0x3c7f41=function(_0x1eb28e){while(--_0x1eb28e){_0x3886c5['push'](_0x3886c5['shift']());}};_0x3c7f41(++_0x11e091);}(_0x5f4e,0x1d8));var _0xe5f4=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0x5f4e[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xe5f4('0x0'));var util=require('util');var logger=require(_0xe5f4('0x1'))(_0xe5f4('0x2'));var moment=require('moment');var BPromise=require(_0xe5f4('0x3'));var rp=require(_0xe5f4('0x4'));var fs=require('fs');var path=require(_0xe5f4('0x5'));var rimraf=require(_0xe5f4('0x6'));var config=require(_0xe5f4('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x1c9027,_0x302931){return _0x1c9027['define'](_0xe5f4('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7710=['moment','bluebird','request-promise','path','exports','define','CmHopperAdditionalPhone','util','api'];(function(_0x261b3a,_0x57eab1){var _0x44c2c5=function(_0x27b222){while(--_0x27b222){_0x261b3a['push'](_0x261b3a['shift']());}};_0x44c2c5(++_0x57eab1);}(_0x7710,0x130));var _0x0771=function(_0x5c56c1,_0x3c1325){_0x5c56c1=_0x5c56c1-0x0;var _0x49a58e=_0x7710[_0x5c56c1];return _0x49a58e;};'use strict';var _=require('lodash');var util=require(_0x0771('0x0'));var logger=require('../../config/logger')(_0x0771('0x1'));var moment=require(_0x0771('0x2'));var BPromise=require(_0x0771('0x3'));var rp=require(_0x0771('0x4'));var fs=require('fs');var path=require(_0x0771('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x0771('0x6')]=function(_0x31f6e6,_0x3724da){return _0x31f6e6[_0x0771('0x7')](_0x0771('0x8'),attributes,{'tableName':'cm_hopper_additional_phones','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 3aba5ac..fbabfe8 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 _0xd6b6=['countmachineretry','entity','dialGlobalMaxRetry','OrderBy','catch','SwapAdditionalPhones','duration','waitTime','scheduledat','add','minutes','isNil','phone','countbusyretry','countagentrejectretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','ASC','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry'];(function(_0x201c68,_0x298a28){var _0x3c9de6=function(_0x1525a7){while(--_0x1525a7){_0x201c68['push'](_0x201c68['shift']());}};_0x3c9de6(++_0x298a28);}(_0xd6b6,0x106));var _0x6d6b=function(_0x17723b,_0x59304a){_0x17723b=_0x17723b-0x0;var _0x482881=_0xd6b6[_0x17723b];return _0x482881;};'use strict';var _=require(_0x6d6b('0x0'));var util=require(_0x6d6b('0x1'));var moment=require(_0x6d6b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d6b('0x3'));var db=require(_0x6d6b('0x4'))['db'];var utils=require(_0x6d6b('0x5'));var logger=require(_0x6d6b('0x6'))(_0x6d6b('0x7'));var config=require(_0x6d6b('0x8'));var jayson=require(_0x6d6b('0x9'));var client=jayson[_0x6d6b('0xa')][_0x6d6b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e9f91,_0x1bdc8e,_0x1888cc){return new BPromise(function(_0x2d000e,_0x7c843d){return client[_0x6d6b('0xc')](_0x2e9f91,_0x1888cc)[_0x6d6b('0xd')](function(_0x459d7e){logger[_0x6d6b('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bdc8e,_0x6d6b('0xf'));logger[_0x6d6b('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x1bdc8e,_0x6d6b('0xf'),JSON[_0x6d6b('0x11')](_0x459d7e));if(_0x459d7e[_0x6d6b('0x12')]){if(_0x459d7e[_0x6d6b('0x12')][_0x6d6b('0x13')]===0x1f4){logger[_0x6d6b('0x12')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1bdc8e,_0x459d7e['error']['message']);return _0x7c843d(_0x459d7e['error']['message']);}logger[_0x6d6b('0x12')](_0x6d6b('0x14'),_0x1bdc8e,_0x459d7e[_0x6d6b('0x12')][_0x6d6b('0x15')]);return _0x2d000e(_0x459d7e[_0x6d6b('0x12')][_0x6d6b('0x15')]);}else{logger['info'](_0x6d6b('0x14'),_0x1bdc8e,'request\x20sent');_0x2d000e(_0x459d7e[_0x6d6b('0x16')][_0x6d6b('0x15')]);}})['catch'](function(_0x47c5c7){logger[_0x6d6b('0x12')](_0x6d6b('0x14'),_0x1bdc8e,_0x47c5c7);_0x7c843d(_0x47c5c7);});});}exports[_0x6d6b('0x17')]=function(_0x10ea0b){var _0x4bb5e1=this;return new Promise(function(_0x380347,_0x42c17d){return db[_0x6d6b('0x18')][_0x6d6b('0x19')]({'raw':!![],'where':{'ContactId':_0x10ea0b[_0x6d6b('0x1a')][_0x6d6b('0x1b')],'ListId':_0x10ea0b['body'][_0x6d6b('0x1c')],'VoiceQueueId':_0x10ea0b['body'][_0x6d6b('0x1d')]===undefined?null:_0x10ea0b[_0x6d6b('0x1a')][_0x6d6b('0x1d')],'CampaignId':_0x10ea0b[_0x6d6b('0x1a')][_0x6d6b('0x1e')]===undefined?null:_0x10ea0b[_0x6d6b('0x1a')]['CampaignId']}})['then'](function(_0x591aba){if(_0x591aba!=null){return db[_0x6d6b('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x591aba['id'],'OrderBy':{'$gt':_0x591aba['OrderBy']}},'order':[['OrderBy',_0x6d6b('0x20')]]})[_0x6d6b('0xd')](function(_0x460e6b){var _0x5d887b=0x0;if(_0x460e6b){if(_0x460e6b['countbusyretry']+_0x460e6b[_0x6d6b('0x21')]+_0x460e6b[_0x6d6b('0x22')]+_0x460e6b[_0x6d6b('0x23')]+_0x460e6b[_0x6d6b('0x24')]+_0x460e6b[_0x6d6b('0x25')]+_0x460e6b[_0x6d6b('0x26')]+_0x460e6b['countagentrejectretry']<_0x10ea0b[_0x6d6b('0x27')][_0x6d6b('0x28')])_0x5d887b=0x1;_0x380347({'additional':_0x5d887b});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x591aba['id']},'order':[[_0x6d6b('0x29'),'ASC']]})[_0x6d6b('0xd')](function(_0xdc8e1f){var _0x4e62b0=0x0;if(_0xdc8e1f){if(_0xdc8e1f['countbusyretry']+_0xdc8e1f[_0x6d6b('0x21')]+_0xdc8e1f[_0x6d6b('0x22')]+_0xdc8e1f['countnosuchnumberretry']+_0xdc8e1f['countdropretry']+_0xdc8e1f[_0x6d6b('0x25')]+_0xdc8e1f[_0x6d6b('0x26')]+_0xdc8e1f['countagentrejectretry']<_0x10ea0b[_0x6d6b('0x27')][_0x6d6b('0x28')])_0x4e62b0=0x1;_0x380347({'additional':_0x4e62b0});}else{_0x380347({'additional':0x0});}})['catch'](function(_0x29e4ab){logger[_0x6d6b('0x12')](_0x6d6b('0x17'),_0x29e4ab[_0x6d6b('0x15')]);_0x42c17d(_0x4bb5e1[_0x6d6b('0x12')](0x1f4,_0x29e4ab[_0x6d6b('0x15')]));});}})[_0x6d6b('0x2a')](function(_0x1ca60b){logger['error'](_0x6d6b('0x17'),_0x1ca60b[_0x6d6b('0x15')]);_0x42c17d(_0x4bb5e1[_0x6d6b('0x12')](0x1f4,_0x1ca60b[_0x6d6b('0x15')]));});}else _0x380347({'additional':0x0});});});};exports[_0x6d6b('0x2b')]=function(_0x17e2c7){var _0x195f3a=this;return new Promise(function(_0x289f65,_0x240108){return db[_0x6d6b('0x18')][_0x6d6b('0x19')]({'raw':!![],'where':{'ContactId':_0x17e2c7['body'][_0x6d6b('0x1b')],'ListId':_0x17e2c7[_0x6d6b('0x1a')]['ListId'],'VoiceQueueId':_0x17e2c7[_0x6d6b('0x1a')]['VoiceQueueId']===undefined?null:_0x17e2c7['body'][_0x6d6b('0x1d')],'CampaignId':_0x17e2c7[_0x6d6b('0x1a')][_0x6d6b('0x1e')]===undefined?null:_0x17e2c7['body']['CampaignId']}})['then'](function(_0x514826){if(_0x514826!=null){return db[_0x6d6b('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x514826['id'],'OrderBy':{'$gte':_0x514826[_0x6d6b('0x29')]}},'order':[[_0x6d6b('0x29'),_0x6d6b('0x20')]]})['then'](function(_0x36d5c3){if(_0x36d5c3)return activateAdditionalPhone(_0x514826,_0x17e2c7['body'],_0x36d5c3,_0x17e2c7[_0x6d6b('0x2c')],_0x17e2c7[_0x6d6b('0x2d')])[_0x6d6b('0xd')](function(_0x311101){_0x289f65(_0x311101);});else{return db[_0x6d6b('0x1f')][_0x6d6b('0x19')]({'raw':!![],'where':{'CmHopperId':_0x514826['id']},'order':[[_0x6d6b('0x29'),'ASC']]})['then'](function(_0x40b7b1){if(_0x40b7b1)return activateAdditionalPhone(_0x514826,_0x17e2c7[_0x6d6b('0x1a')],_0x40b7b1,_0x17e2c7[_0x6d6b('0x2c')],_0x17e2c7[_0x6d6b('0x2d')])['then'](function(_0x4b3084){_0x289f65(_0x4b3084);});else{_0x289f65({'id':_0x514826['id'],'phone':''});}})[_0x6d6b('0x2a')](function(_0x44a1a2){logger[_0x6d6b('0x12')]('VerifyAdditionalPhones',_0x44a1a2['message']);_0x240108(_0x195f3a[_0x6d6b('0x12')](0x1f4,_0x44a1a2[_0x6d6b('0x15')]));});}})['catch'](function(_0x1baed3){logger[_0x6d6b('0x12')](_0x6d6b('0x17'),_0x1baed3[_0x6d6b('0x15')]);_0x240108(_0x195f3a['error'](0x1f4,_0x1baed3['message']));});}else _0x289f65(0x1);});});};function activateAdditionalPhone(_0x3f6f5f,_0x2cc70a,_0x23cfef,_0x494343,_0x859916){return new Promise(function(_0xb0f53c,_0x22bca6){var _0x3b5132;if(_['isNil'](_0x23cfef[_0x6d6b('0x2e')])){_0x23cfef[_0x6d6b('0x2e')]=moment();}if(moment()>moment(_0x23cfef['scheduledat'])){_0x3b5132=moment()[_0x6d6b('0x2f')](_0x859916||0x3,_0x6d6b('0x30'));}else{if(_0x23cfef['OrderBy']==0x0){_0x3b5132=moment(_0x23cfef[_0x6d6b('0x2e')]);}else{_0x3b5132=moment()['add'](_0x859916||0x3,_0x6d6b('0x30'));}}if(_[_0x6d6b('0x31')](_0x3b5132)){_0x3b5132=moment()['add'](_0x859916||0x3,_0x6d6b('0x30'));}var _0x42dda5={'phone':_0x3f6f5f[_0x6d6b('0x32')],'active':0x0,'OrderBy':_[_0x6d6b('0x31')](_0x3f6f5f['OrderBy'])?0x0:_0x3f6f5f[_0x6d6b('0x29')],'scheduledat':moment()['add'](_0x494343||0x1,_0x6d6b('0x30')),'countbusyretry':_0x2cc70a[_0x6d6b('0x33')],'countcongestionretry':_0x2cc70a[_0x6d6b('0x21')],'countnoanswerretry':_0x2cc70a[_0x6d6b('0x22')],'countnosuchnumberretry':_0x2cc70a[_0x6d6b('0x23')],'countdropretry':_0x2cc70a[_0x6d6b('0x24')],'countabandonedretry':_0x2cc70a[_0x6d6b('0x25')],'countmachineretry':_0x2cc70a[_0x6d6b('0x26')],'countagentrejectretry':_0x2cc70a[_0x6d6b('0x34')],'createdAt':_0x2cc70a[_0x6d6b('0x35')],'updatedAt':_0x2cc70a[_0x6d6b('0x36')]};var _0x325c15={'CmHopperId':_0x3f6f5f['id'],'phone':_0x23cfef[_0x6d6b('0x32')],'active':0x0,'OrderBy':_[_0x6d6b('0x31')](_0x23cfef[_0x6d6b('0x29')])?0x0:_0x23cfef[_0x6d6b('0x29')],'scheduledat':_0x3b5132,'countbusyretry':_0x23cfef['countbusyretry'],'countcongestionretry':_0x23cfef['countcongestionretry'],'countnoanswerretry':_0x23cfef['countnoanswerretry'],'countnosuchnumberretry':_0x23cfef[_0x6d6b('0x23')],'countdropretry':_0x23cfef[_0x6d6b('0x24')],'countabandonedretry':_0x23cfef[_0x6d6b('0x25')],'countmachineretry':_0x23cfef[_0x6d6b('0x26')],'countagentrejectretry':_0x23cfef['countagentrejectretry'],'createdAt':_0x23cfef[_0x6d6b('0x35')],'updatedAt':_0x23cfef[_0x6d6b('0x36')]};return db[_0x6d6b('0x37')][_0x6d6b('0x38')](function(_0x50d378){return db[_0x6d6b('0x1f')][_0x6d6b('0x39')](_0x42dda5,{'where':{'id':_0x23cfef['id']}},{'transaction':_0x50d378})['then'](function(){return db[_0x6d6b('0x18')][_0x6d6b('0x39')](_0x325c15,{'where':{'id':_0x3f6f5f['id']}},{'transaction':_0x50d378});});})[_0x6d6b('0xd')](function(_0x5ae574){_0xb0f53c({'id':_0x3f6f5f['id'],'phone':_0x23cfef[_0x6d6b('0x32')]});})['catch'](function(_0x274a45){logger[_0x6d6b('0x12')](_0x6d6b('0x3a'),_0x274a45[_0x6d6b('0x15')]);_0x22bca6({'error':_0x274a45[_0x6d6b('0x15')]});});});}exports[_0x6d6b('0x3b')]=function(_0xc9def0){var _0x4da368=this;return new Promise(function(_0x3d0cd3,_0x4c8700){return db['CmHopper'][_0x6d6b('0x39')](_0xc9def0['body']['field'],{'where':{'id':_0xc9def0[_0x6d6b('0x1a')]['id']}})[_0x6d6b('0xd')](function(_0xb84803){_0x3d0cd3(_0xb84803);})['catch'](function(_0x452131){logger[_0x6d6b('0x12')](_0x6d6b('0x3b'),_0x452131[_0x6d6b('0x15')]);_0x4c8700(_0x4da368['error'](0x1f4,_0x452131['message']));});});}; \ No newline at end of file +var _0x6903=['CampaignId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countcongestionretry','countmachineretry','countagentrejectretry','ASC','countnosuchnumberretry','countdropretry','countabandonedretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','createdAt','phone','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','code','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId'];(function(_0x403c09,_0xef2dd5){var _0x1d517f=function(_0x1c7c6f){while(--_0x1c7c6f){_0x403c09['push'](_0x403c09['shift']());}};_0x1d517f(++_0xef2dd5);}(_0x6903,0x104));var _0x3690=function(_0x46665e,_0x37dbe9){_0x46665e=_0x46665e-0x0;var _0x4e30eb=_0x6903[_0x46665e];return _0x4e30eb;};'use strict';var _=require(_0x3690('0x0'));var util=require(_0x3690('0x1'));var moment=require(_0x3690('0x2'));var BPromise=require(_0x3690('0x3'));var rs=require(_0x3690('0x4'));var fs=require('fs');var Redis=require(_0x3690('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3690('0x6'));var logger=require(_0x3690('0x7'))(_0x3690('0x8'));var config=require('../../config/environment');var jayson=require(_0x3690('0x9'));var client=jayson[_0x3690('0xa')][_0x3690('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x74bfe4,_0xe1dda,_0x4e231c){return new BPromise(function(_0x53263f,_0x3b11f7){return client[_0x3690('0xc')](_0x74bfe4,_0x4e231c)[_0x3690('0xd')](function(_0x5f52e5){logger[_0x3690('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xe1dda,_0x3690('0xf'));logger[_0x3690('0x10')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0xe1dda,_0x3690('0xf'),JSON['stringify'](_0x5f52e5));if(_0x5f52e5[_0x3690('0x11')]){if(_0x5f52e5[_0x3690('0x11')][_0x3690('0x12')]===0x1f4){logger[_0x3690('0x11')](_0x3690('0x13'),_0xe1dda,_0x5f52e5['error']['message']);return _0x3b11f7(_0x5f52e5['error']['message']);}logger[_0x3690('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0xe1dda,_0x5f52e5[_0x3690('0x11')][_0x3690('0x14')]);return _0x53263f(_0x5f52e5[_0x3690('0x11')][_0x3690('0x14')]);}else{logger[_0x3690('0xe')](_0x3690('0x13'),_0xe1dda,'request\x20sent');_0x53263f(_0x5f52e5[_0x3690('0x15')]['message']);}})[_0x3690('0x16')](function(_0x367730){logger[_0x3690('0x11')](_0x3690('0x13'),_0xe1dda,_0x367730);_0x3b11f7(_0x367730);});});}exports[_0x3690('0x17')]=function(_0x1049b6){var _0x1b5320=this;return new Promise(function(_0x2ad04e,_0x4e4cf0){return db[_0x3690('0x18')][_0x3690('0x19')]({'raw':!![],'where':{'ContactId':_0x1049b6['body'][_0x3690('0x1a')],'ListId':_0x1049b6[_0x3690('0x1b')][_0x3690('0x1c')],'VoiceQueueId':_0x1049b6[_0x3690('0x1b')][_0x3690('0x1d')]===undefined?null:_0x1049b6[_0x3690('0x1b')][_0x3690('0x1d')],'CampaignId':_0x1049b6['body'][_0x3690('0x1e')]===undefined?null:_0x1049b6[_0x3690('0x1b')][_0x3690('0x1e')]}})[_0x3690('0xd')](function(_0x399333){if(_0x399333!=null){return db[_0x3690('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x399333['id'],'OrderBy':{'$gt':_0x399333[_0x3690('0x20')]}},'order':[['OrderBy','ASC']]})['then'](function(_0x5b1779){var _0xf82f75=0x0;if(_0x5b1779){if(_0x5b1779[_0x3690('0x21')]+_0x5b1779[_0x3690('0x22')]+_0x5b1779['countnoanswerretry']+_0x5b1779['countnosuchnumberretry']+_0x5b1779['countdropretry']+_0x5b1779['countabandonedretry']+_0x5b1779[_0x3690('0x23')]+_0x5b1779[_0x3690('0x24')]<_0x1049b6['entity']['dialGlobalMaxRetry'])_0xf82f75=0x1;_0x2ad04e({'additional':_0xf82f75});}else{return db[_0x3690('0x1f')][_0x3690('0x19')]({'raw':!![],'where':{'CmHopperId':_0x399333['id']},'order':[[_0x3690('0x20'),_0x3690('0x25')]]})[_0x3690('0xd')](function(_0x1dfb73){var _0x537a4b=0x0;if(_0x1dfb73){if(_0x1dfb73[_0x3690('0x21')]+_0x1dfb73[_0x3690('0x22')]+_0x1dfb73['countnoanswerretry']+_0x1dfb73[_0x3690('0x26')]+_0x1dfb73[_0x3690('0x27')]+_0x1dfb73[_0x3690('0x28')]+_0x1dfb73[_0x3690('0x23')]+_0x1dfb73[_0x3690('0x24')]<_0x1049b6['entity'][_0x3690('0x29')])_0x537a4b=0x1;_0x2ad04e({'additional':_0x537a4b});}else{_0x2ad04e({'additional':0x0});}})[_0x3690('0x16')](function(_0xa877a1){logger['error'](_0x3690('0x17'),_0xa877a1[_0x3690('0x14')]);_0x4e4cf0(_0x1b5320[_0x3690('0x11')](0x1f4,_0xa877a1['message']));});}})[_0x3690('0x16')](function(_0x43c4e0){logger[_0x3690('0x11')](_0x3690('0x17'),_0x43c4e0[_0x3690('0x14')]);_0x4e4cf0(_0x1b5320[_0x3690('0x11')](0x1f4,_0x43c4e0['message']));});}else _0x2ad04e({'additional':0x0});});});};exports[_0x3690('0x2a')]=function(_0x4bcc06){var _0x482f57=this;return new Promise(function(_0x4a231a,_0x5d8ae4){return db['CmHopper'][_0x3690('0x19')]({'raw':!![],'where':{'ContactId':_0x4bcc06[_0x3690('0x1b')]['ContactId'],'ListId':_0x4bcc06[_0x3690('0x1b')]['ListId'],'VoiceQueueId':_0x4bcc06[_0x3690('0x1b')][_0x3690('0x1d')]===undefined?null:_0x4bcc06[_0x3690('0x1b')][_0x3690('0x1d')],'CampaignId':_0x4bcc06['body'][_0x3690('0x1e')]===undefined?null:_0x4bcc06[_0x3690('0x1b')]['CampaignId']}})[_0x3690('0xd')](function(_0x38ddbe){if(_0x38ddbe!=null){return db[_0x3690('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x38ddbe['id'],'OrderBy':{'$gte':_0x38ddbe[_0x3690('0x20')]}},'order':[[_0x3690('0x20'),_0x3690('0x25')]]})['then'](function(_0x2b4c00){if(_0x2b4c00)return activateAdditionalPhone(_0x38ddbe,_0x4bcc06['body'],_0x2b4c00,_0x4bcc06[_0x3690('0x2b')],_0x4bcc06['waitTime'])[_0x3690('0xd')](function(_0x59af76){_0x4a231a(_0x59af76);});else{return db[_0x3690('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x38ddbe['id']},'order':[[_0x3690('0x20'),_0x3690('0x25')]]})[_0x3690('0xd')](function(_0x1fb619){if(_0x1fb619)return activateAdditionalPhone(_0x38ddbe,_0x4bcc06['body'],_0x1fb619,_0x4bcc06[_0x3690('0x2b')],_0x4bcc06[_0x3690('0x2c')])[_0x3690('0xd')](function(_0xc9cc34){_0x4a231a(_0xc9cc34);});else{_0x4a231a({'id':_0x38ddbe['id'],'phone':''});}})['catch'](function(_0x2dd682){logger['error']('VerifyAdditionalPhones',_0x2dd682[_0x3690('0x14')]);_0x5d8ae4(_0x482f57[_0x3690('0x11')](0x1f4,_0x2dd682['message']));});}})[_0x3690('0x16')](function(_0x2aeb0b){logger[_0x3690('0x11')](_0x3690('0x17'),_0x2aeb0b['message']);_0x5d8ae4(_0x482f57[_0x3690('0x11')](0x1f4,_0x2aeb0b[_0x3690('0x14')]));});}else _0x4a231a(0x1);});});};function activateAdditionalPhone(_0x16d5f5,_0x4d5d01,_0x3bd33e,_0x53f084,_0x5aed0c){return new Promise(function(_0x767e89,_0x68b36b){var _0x160dd3;if(_[_0x3690('0x2d')](_0x3bd33e[_0x3690('0x2e')])){_0x3bd33e['scheduledat']=moment();}if(moment()>moment(_0x3bd33e[_0x3690('0x2e')])){_0x160dd3=moment()[_0x3690('0x2f')](_0x5aed0c||0x3,'minutes');}else{if(_0x3bd33e['OrderBy']==0x0){_0x160dd3=moment(_0x3bd33e[_0x3690('0x2e')]);}else{_0x160dd3=moment()[_0x3690('0x2f')](_0x5aed0c||0x3,'minutes');}}if(_['isNil'](_0x160dd3)){_0x160dd3=moment()[_0x3690('0x2f')](_0x5aed0c||0x3,_0x3690('0x30'));}var _0x56b493={'phone':_0x16d5f5['phone'],'active':0x0,'OrderBy':_[_0x3690('0x2d')](_0x16d5f5['OrderBy'])?0x0:_0x16d5f5['OrderBy'],'scheduledat':moment()[_0x3690('0x2f')](_0x53f084||0x1,_0x3690('0x30')),'countbusyretry':_0x4d5d01[_0x3690('0x21')],'countcongestionretry':_0x4d5d01['countcongestionretry'],'countnoanswerretry':_0x4d5d01['countnoanswerretry'],'countnosuchnumberretry':_0x4d5d01[_0x3690('0x26')],'countdropretry':_0x4d5d01[_0x3690('0x27')],'countabandonedretry':_0x4d5d01[_0x3690('0x28')],'countmachineretry':_0x4d5d01['countmachineretry'],'countagentrejectretry':_0x4d5d01[_0x3690('0x24')],'createdAt':_0x4d5d01[_0x3690('0x31')],'updatedAt':_0x4d5d01['updatedAt']};var _0x3d96de={'CmHopperId':_0x16d5f5['id'],'phone':_0x3bd33e[_0x3690('0x32')],'active':0x0,'OrderBy':_[_0x3690('0x2d')](_0x3bd33e['OrderBy'])?0x0:_0x3bd33e[_0x3690('0x20')],'scheduledat':_0x160dd3,'countbusyretry':_0x3bd33e[_0x3690('0x21')],'countcongestionretry':_0x3bd33e['countcongestionretry'],'countnoanswerretry':_0x3bd33e['countnoanswerretry'],'countnosuchnumberretry':_0x3bd33e[_0x3690('0x26')],'countdropretry':_0x3bd33e[_0x3690('0x27')],'countabandonedretry':_0x3bd33e['countabandonedretry'],'countmachineretry':_0x3bd33e[_0x3690('0x23')],'countagentrejectretry':_0x3bd33e[_0x3690('0x24')],'createdAt':_0x3bd33e[_0x3690('0x31')],'updatedAt':_0x3bd33e[_0x3690('0x33')]};return db[_0x3690('0x34')][_0x3690('0x35')](function(_0xb7fa9d){return db[_0x3690('0x1f')][_0x3690('0x36')](_0x56b493,{'where':{'id':_0x3bd33e['id']}},{'transaction':_0xb7fa9d})[_0x3690('0xd')](function(){return db[_0x3690('0x18')][_0x3690('0x36')](_0x3d96de,{'where':{'id':_0x16d5f5['id']}},{'transaction':_0xb7fa9d});});})[_0x3690('0xd')](function(_0x45d8f6){_0x767e89({'id':_0x16d5f5['id'],'phone':_0x3bd33e[_0x3690('0x32')]});})[_0x3690('0x16')](function(_0x624a0d){logger[_0x3690('0x11')](_0x3690('0x37'),_0x624a0d[_0x3690('0x14')]);_0x68b36b({'error':_0x624a0d[_0x3690('0x14')]});});});}exports[_0x3690('0x38')]=function(_0x308190){var _0x551504=this;return new Promise(function(_0x3f2d9d,_0x976d90){return db[_0x3690('0x18')][_0x3690('0x36')](_0x308190[_0x3690('0x1b')][_0x3690('0x39')],{'where':{'id':_0x308190[_0x3690('0x1b')]['id']}})[_0x3690('0xd')](function(_0x85c26b){_0x3f2d9d(_0x85c26b);})['catch'](function(_0x174282){logger[_0x3690('0x11')]('IncrementPreviewCounters',_0x174282[_0x3690('0x14')]);_0x976d90(_0x551504[_0x3690('0x11')](0x1f4,_0x174282[_0x3690('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 96484a2..5fb7e65 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 _0x9091=['express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','put','update','delete','destroy','multer','path'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0x9091,0x1ed));var _0x1909=function(_0x3a514c,_0x57f149){_0x3a514c=_0x3a514c-0x0;var _0xa28d34=_0x9091[_0x3a514c];return _0xa28d34;};'use strict';var multer=require(_0x1909('0x0'));var util=require('util');var path=require(_0x1909('0x1'));var timeout=require('connect-timeout');var express=require(_0x1909('0x2'));var router=express['Router']();var fs_extra=require(_0x1909('0x3'));var auth=require(_0x1909('0x4'));var interaction=require(_0x1909('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperAdditionalPhone.controller');router['get']('/',auth[_0x1909('0x6')](),controller['index']);router[_0x1909('0x7')](_0x1909('0x8'),auth[_0x1909('0x6')](),controller[_0x1909('0x9')]);router[_0x1909('0xa')]('/',auth[_0x1909('0x6')](),controller['create']);router[_0x1909('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1909('0xc')]);router[_0x1909('0xd')]('/:id',auth[_0x1909('0x6')](),controller[_0x1909('0xe')]);module['exports']=router; \ No newline at end of file +var _0xe126=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x2076ff,_0x2e8ae3){var _0x322c9b=function(_0x2b2d97){while(--_0x2b2d97){_0x2076ff['push'](_0x2076ff['shift']());}};_0x322c9b(++_0x2e8ae3);}(_0xe126,0xeb));var _0x6e12=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xe126[_0x1da527];return _0x40fc7c;};'use strict';var multer=require(_0x6e12('0x0'));var util=require(_0x6e12('0x1'));var path=require('path');var timeout=require(_0x6e12('0x2'));var express=require(_0x6e12('0x3'));var router=express[_0x6e12('0x4')]();var fs_extra=require(_0x6e12('0x5'));var auth=require(_0x6e12('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6e12('0x7'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x6e12('0x8')]('/',auth[_0x6e12('0x9')](),controller['index']);router[_0x6e12('0x8')](_0x6e12('0xa'),auth[_0x6e12('0x9')](),controller[_0x6e12('0xb')]);router[_0x6e12('0xc')]('/',auth[_0x6e12('0x9')](),controller[_0x6e12('0xd')]);router['put']('/:id',auth[_0x6e12('0x9')](),controller[_0x6e12('0xe')]);router['delete'](_0x6e12('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e12('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index d604adc..22cdfc0 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 _0x56e7=['exports','INTEGER','contactListQueue','sequelize'];(function(_0x837dad,_0x1d9098){var _0x1d62d3=function(_0x40b7c1){while(--_0x40b7c1){_0x837dad['push'](_0x837dad['shift']());}};_0x1d62d3(++_0x1d9098);}(_0x56e7,0x7b));var _0x756e=function(_0x382787,_0x4175d3){_0x382787=_0x382787-0x0;var _0x58f86d=_0x56e7[_0x382787];return _0x58f86d;};'use strict';var moment=require('moment');var Sequelize=require(_0x756e('0x0'));module[_0x756e('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize[_0x756e('0x2')],'unique':_0x756e('0x3')},'ListId':{'type':Sequelize[_0x756e('0x2')],'unique':_0x756e('0x3')},'VoiceQueueId':{'type':Sequelize[_0x756e('0x2')],'unique':_0x756e('0x3')}}; \ No newline at end of file +var _0x1d3c=['STRING','INTEGER','contactListQueue','moment','sequelize','exports'];(function(_0x274262,_0x5da9fb){var _0x283be5=function(_0xc3ae9){while(--_0xc3ae9){_0x274262['push'](_0x274262['shift']());}};_0x283be5(++_0x5da9fb);}(_0x1d3c,0x6f));var _0xc1d3=function(_0x5db313,_0x3c8f0c){_0x5db313=_0x5db313-0x0;var _0x36d503=_0x1d3c[_0x5db313];return _0x36d503;};'use strict';var moment=require(_0xc1d3('0x0'));var Sequelize=require(_0xc1d3('0x1'));module[_0xc1d3('0x2')]={'phone':{'type':Sequelize[_0xc1d3('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xc1d3('0x4')],'unique':_0xc1d3('0x5')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xc1d3('0x4')],'unique':_0xc1d3('0x5')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 94f1ecc..6099089 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 _0xd6ff=['set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','find','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x244e85,_0x9a8dd7){var _0x55b122=function(_0x26543c){while(--_0x26543c){_0x244e85['push'](_0x244e85['shift']());}};_0x55b122(++_0x9a8dd7);}(_0xd6ff,0x76));var _0xfd6f=function(_0x4ea430,_0xc3e929){_0x4ea430=_0x4ea430-0x0;var _0x4ce88e=_0xd6ff[_0x4ea430];return _0x4ce88e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd6f('0x0'));var zipdir=require(_0xfd6f('0x1'));var jsonpatch=require(_0xfd6f('0x2'));var rp=require(_0xfd6f('0x3'));var moment=require('moment');var BPromise=require(_0xfd6f('0x4'));var Mustache=require(_0xfd6f('0x5'));var util=require(_0xfd6f('0x6'));var path=require(_0xfd6f('0x7'));var sox=require(_0xfd6f('0x8'));var csv=require(_0xfd6f('0x9'));var ejs=require(_0xfd6f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfd6f('0xb'));var squel=require(_0xfd6f('0xc'));var crypto=require(_0xfd6f('0xd'));var jsforce=require(_0xfd6f('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfd6f('0xf'));var Papa=require(_0xfd6f('0x10'));var Redis=require('ioredis');var authService=require(_0xfd6f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xfd6f('0x12'));var hardwareService=require(_0xfd6f('0x13'));var logger=require(_0xfd6f('0x14'))('api');var utils=require(_0xfd6f('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xfd6f('0x16'));var db=require(_0xfd6f('0x17'))['db'];function respondWithStatusCode(_0x23ba75,_0x56a14b){_0x56a14b=_0x56a14b||0xcc;return function(_0x233b85){if(_0x233b85){return _0x23ba75[_0xfd6f('0x18')](_0x56a14b);}return _0x23ba75[_0xfd6f('0x19')](_0x56a14b)[_0xfd6f('0x1a')]();};}function respondWithResult(_0x26b44c,_0x177323){_0x177323=_0x177323||0xc8;return function(_0x291f5a){if(_0x291f5a){return _0x26b44c['status'](_0x177323)[_0xfd6f('0x1b')](_0x291f5a);}};}function respondWithFilteredResult(_0x481d9c,_0x5b6f08){return function(_0x38305d){if(_0x38305d){var _0x3200c4=typeof _0x5b6f08[_0xfd6f('0x1c')]===_0xfd6f('0x1d')&&typeof _0x5b6f08[_0xfd6f('0x1e')]===_0xfd6f('0x1d');var _0x5a54ae=_0x38305d['count'];var _0x19c787=_0x3200c4?0x0:_0x5b6f08['offset'];var _0x3f896a=_0x3200c4?_0x38305d[_0xfd6f('0x1f')]:_0x5b6f08[_0xfd6f('0x1c')]+_0x5b6f08['limit'];var _0x8b0ab1;if(_0x3f896a>=_0x5a54ae){_0x3f896a=_0x5a54ae;_0x8b0ab1=0xc8;}else{_0x8b0ab1=0xce;}_0x481d9c[_0xfd6f('0x19')](_0x8b0ab1);return _0x481d9c[_0xfd6f('0x20')](_0xfd6f('0x21'),_0x19c787+'-'+_0x3f896a+'/'+_0x5a54ae)[_0xfd6f('0x1b')](_0x38305d);}return null;};}function patchUpdates(_0x5ea6c8){return function(_0x2668e8){try{jsonpatch[_0xfd6f('0x22')](_0x2668e8,_0x5ea6c8,!![]);}catch(_0xa02839){return BPromise['reject'](_0xa02839);}return _0x2668e8[_0xfd6f('0x23')]();};}function saveUpdates(_0x5c1f7a,_0xc87262){return function(_0x3849f9){if(_0x3849f9){return _0x3849f9[_0xfd6f('0x24')](_0x5c1f7a)[_0xfd6f('0x25')](function(_0x40419a){return _0x40419a;});}return null;};}function removeEntity(_0x20497b,_0x18a380){return function(_0x11984d){if(_0x11984d){return _0x11984d[_0xfd6f('0x26')]()[_0xfd6f('0x25')](function(){_0x20497b[_0xfd6f('0x19')](0xcc)[_0xfd6f('0x1a')]();});}};}function handleEntityNotFound(_0x41c385,_0x139838){return function(_0x37e6b7){if(!_0x37e6b7){_0x41c385['sendStatus'](0x194);}return _0x37e6b7;};}function handleError(_0x7d5101,_0x4c3909){_0x4c3909=_0x4c3909||0x1f4;return function(_0x1669d0){logger[_0xfd6f('0x27')](_0x1669d0[_0xfd6f('0x28')]);if(_0x1669d0[_0xfd6f('0x29')]){delete _0x1669d0[_0xfd6f('0x29')];}_0x7d5101[_0xfd6f('0x19')](_0x4c3909)[_0xfd6f('0x2a')](_0x1669d0);};}exports[_0xfd6f('0x2b')]=function(_0x530e18,_0x4d6804){var _0x486e25={},_0x3a1197={},_0x17bc8c={'count':0x0,'rows':[]};var _0x1fb28d=_[_0xfd6f('0x2c')](db[_0xfd6f('0x2d')]['rawAttributes'],function(_0x53318b){return{'name':_0x53318b[_0xfd6f('0x2e')],'type':_0x53318b[_0xfd6f('0x2f')][_0xfd6f('0x30')]};});_0x3a1197[_0xfd6f('0x31')]=_[_0xfd6f('0x2c')](_0x1fb28d,_0xfd6f('0x29'));_0x3a1197[_0xfd6f('0x32')]=_[_0xfd6f('0x33')](_0x530e18[_0xfd6f('0x32')]);_0x3a1197[_0xfd6f('0x34')]=_[_0xfd6f('0x35')](_0x3a1197[_0xfd6f('0x31')],_0x3a1197[_0xfd6f('0x32')]);_0x486e25[_0xfd6f('0x36')]=_[_0xfd6f('0x35')](_0x3a1197[_0xfd6f('0x31')],qs[_0xfd6f('0x37')](_0x530e18['query'][_0xfd6f('0x37')]));_0x486e25['attributes']=_0x486e25['attributes']['length']?_0x486e25[_0xfd6f('0x36')]:_0x3a1197['model'];if(!_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x38')]('nolimit')){_0x486e25['limit']=qs[_0xfd6f('0x1e')](_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x1e')]);_0x486e25[_0xfd6f('0x1c')]=qs[_0xfd6f('0x1c')](_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x1c')]);}_0x486e25[_0xfd6f('0x39')]=qs[_0xfd6f('0x3a')](_0x530e18['query'][_0xfd6f('0x3a')]);_0x486e25[_0xfd6f('0x3b')]=qs[_0xfd6f('0x34')](_[_0xfd6f('0x3c')](_0x530e18[_0xfd6f('0x32')],_0x3a1197['filters']),_0x1fb28d);if(_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x3d')]){_0x486e25[_0xfd6f('0x3b')]=_[_0xfd6f('0x3e')](_0x486e25[_0xfd6f('0x3b')],{'$or':_['map'](_0x1fb28d,function(_0x1f4f63){if(_0x1f4f63[_0xfd6f('0x2f')]!==_0xfd6f('0x3f')){var _0x3c7068={};_0x3c7068[_0x1f4f63[_0xfd6f('0x29')]]={'$like':'%'+_0x530e18[_0xfd6f('0x32')][_0xfd6f('0x3d')]+'%'};return _0x3c7068;}})});}_0x486e25=_[_0xfd6f('0x3e')]({},_0x486e25,_0x530e18[_0xfd6f('0x40')]);var _0x2370a4={'where':_0x486e25[_0xfd6f('0x3b')]};return db[_0xfd6f('0x2d')]['count'](_0x2370a4)['then'](function(_0x16b753){_0x17bc8c[_0xfd6f('0x1f')]=_0x16b753;if(_0x530e18['query'][_0xfd6f('0x41')]){_0x486e25[_0xfd6f('0x42')]=[{'all':!![]}];}return db[_0xfd6f('0x2d')][_0xfd6f('0x43')](_0x486e25);})['then'](function(_0x2b2f28){_0x17bc8c['rows']=_0x2b2f28;return _0x17bc8c;})[_0xfd6f('0x25')](respondWithFilteredResult(_0x4d6804,_0x486e25))[_0xfd6f('0x44')](handleError(_0x4d6804,null));};exports[_0xfd6f('0x45')]=function(_0x26dd26,_0x158ccd){var _0x22627a={'raw':!![],'where':{'id':_0x26dd26['params']['id']}},_0x542a55={};_0x542a55['model']=_[_0xfd6f('0x33')](db['CmHopperBlack'][_0xfd6f('0x46')]);_0x542a55[_0xfd6f('0x32')]=_['keys'](_0x26dd26[_0xfd6f('0x32')]);_0x542a55[_0xfd6f('0x34')]=_[_0xfd6f('0x35')](_0x542a55[_0xfd6f('0x31')],_0x542a55[_0xfd6f('0x32')]);_0x22627a[_0xfd6f('0x36')]=_[_0xfd6f('0x35')](_0x542a55[_0xfd6f('0x31')],qs['fields'](_0x26dd26['query'][_0xfd6f('0x37')]));_0x22627a[_0xfd6f('0x36')]=_0x22627a[_0xfd6f('0x36')]['length']?_0x22627a[_0xfd6f('0x36')]:_0x542a55[_0xfd6f('0x31')];if(_0x26dd26['query'][_0xfd6f('0x41')]){_0x22627a[_0xfd6f('0x42')]=[{'all':!![]}];}_0x22627a=_['merge']({},_0x22627a,_0x26dd26['options']);return db[_0xfd6f('0x2d')][_0xfd6f('0x47')](_0x22627a)['then'](handleEntityNotFound(_0x158ccd,null))[_0xfd6f('0x25')](respondWithResult(_0x158ccd,null))['catch'](handleError(_0x158ccd,null));};exports[_0xfd6f('0x24')]=function(_0x4e1d03,_0x4f96a4){if(_0x4e1d03[_0xfd6f('0x48')]['id']){delete _0x4e1d03[_0xfd6f('0x48')]['id'];}return db[_0xfd6f('0x2d')][_0xfd6f('0x47')]({'where':{'id':_0x4e1d03[_0xfd6f('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f96a4,null))[_0xfd6f('0x25')](saveUpdates(_0x4e1d03['body'],null))[_0xfd6f('0x25')](respondWithResult(_0x4f96a4,null))[_0xfd6f('0x44')](handleError(_0x4f96a4,null));};exports[_0xfd6f('0x26')]=function(_0x2caed1,_0x208848){return db[_0xfd6f('0x2d')]['find']({'where':{'id':_0x2caed1[_0xfd6f('0x49')]['id']}})[_0xfd6f('0x25')](handleEntityNotFound(_0x208848,null))['then'](removeEntity(_0x208848,null))[_0xfd6f('0x44')](handleError(_0x208848,null));};exports[_0xfd6f('0x4a')]=function(_0x542ee4,_0x3e2c84){return db[_0xfd6f('0x2d')][_0xfd6f('0x4a')]()[_0xfd6f('0x25')](respondWithResult(_0x3e2c84,null))[_0xfd6f('0x44')](handleError(_0x3e2c84,null));}; \ No newline at end of file +var _0xd58b=['zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','send','index','type','key','model','map','name','query','attributes','intersection','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','options','CmHopperBlack','include','findAll','rows','show','params','keys','rawAttributes','fields','find','body','catch','describe','rimraf'];(function(_0x2eaee7,_0x157285){var _0x127264=function(_0x257b43){while(--_0x257b43){_0x2eaee7['push'](_0x2eaee7['shift']());}};_0x127264(++_0x157285);}(_0xd58b,0x8b));var _0xbd58=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0xd58b[_0x4792c8];return _0x35edb1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbd58('0x0'));var zipdir=require(_0xbd58('0x1'));var jsonpatch=require(_0xbd58('0x2'));var rp=require('request-promise');var moment=require(_0xbd58('0x3'));var BPromise=require(_0xbd58('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbd58('0x5'));var sox=require(_0xbd58('0x6'));var csv=require(_0xbd58('0x7'));var ejs=require(_0xbd58('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbd58('0x9'));var squel=require(_0xbd58('0xa'));var crypto=require(_0xbd58('0xb'));var jsforce=require(_0xbd58('0xc'));var deskjs=require(_0xbd58('0xd'));var toCsv=require(_0xbd58('0x7'));var querystring=require(_0xbd58('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xbd58('0xf'));var as=require(_0xbd58('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbd58('0x11'))(_0xbd58('0x12'));var utils=require('../../config/utils');var config=require(_0xbd58('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xbd58('0x14'))['db'];function respondWithStatusCode(_0x123733,_0x320217){_0x320217=_0x320217||0xcc;return function(_0x31ee4c){if(_0x31ee4c){return _0x123733[_0xbd58('0x15')](_0x320217);}return _0x123733[_0xbd58('0x16')](_0x320217)[_0xbd58('0x17')]();};}function respondWithResult(_0x416323,_0x39069c){_0x39069c=_0x39069c||0xc8;return function(_0x4b9ab1){if(_0x4b9ab1){return _0x416323[_0xbd58('0x16')](_0x39069c)['json'](_0x4b9ab1);}};}function respondWithFilteredResult(_0x454e22,_0x64a85a){return function(_0x57c6f3){if(_0x57c6f3){var _0x2f1f17=typeof _0x64a85a[_0xbd58('0x18')]===_0xbd58('0x19')&&typeof _0x64a85a[_0xbd58('0x1a')]==='undefined';var _0x27c2f7=_0x57c6f3['count'];var _0xe736c5=_0x2f1f17?0x0:_0x64a85a[_0xbd58('0x18')];var _0x4e5b26=_0x2f1f17?_0x57c6f3[_0xbd58('0x1b')]:_0x64a85a['offset']+_0x64a85a[_0xbd58('0x1a')];var _0x5c720f;if(_0x4e5b26>=_0x27c2f7){_0x4e5b26=_0x27c2f7;_0x5c720f=0xc8;}else{_0x5c720f=0xce;}_0x454e22[_0xbd58('0x16')](_0x5c720f);return _0x454e22[_0xbd58('0x1c')](_0xbd58('0x1d'),_0xe736c5+'-'+_0x4e5b26+'/'+_0x27c2f7)[_0xbd58('0x1e')](_0x57c6f3);}return null;};}function patchUpdates(_0x30dc30){return function(_0x68a5df){try{jsonpatch['apply'](_0x68a5df,_0x30dc30,!![]);}catch(_0x3edc82){return BPromise[_0xbd58('0x1f')](_0x3edc82);}return _0x68a5df[_0xbd58('0x20')]();};}function saveUpdates(_0x430a52,_0x51617c){return function(_0x1262e1){if(_0x1262e1){return _0x1262e1[_0xbd58('0x21')](_0x430a52)[_0xbd58('0x22')](function(_0x3c5078){return _0x3c5078;});}return null;};}function removeEntity(_0xc8d82e,_0x2ca3fe){return function(_0x463038){if(_0x463038){return _0x463038[_0xbd58('0x23')]()[_0xbd58('0x22')](function(){_0xc8d82e[_0xbd58('0x16')](0xcc)[_0xbd58('0x17')]();});}};}function handleEntityNotFound(_0x29c8f7,_0x42d41b){return function(_0x5912ab){if(!_0x5912ab){_0x29c8f7[_0xbd58('0x15')](0x194);}return _0x5912ab;};}function handleError(_0x337e6,_0x31cef7){_0x31cef7=_0x31cef7||0x1f4;return function(_0x23315e){logger[_0xbd58('0x24')](_0x23315e['stack']);if(_0x23315e['name']){delete _0x23315e['name'];}_0x337e6['status'](_0x31cef7)[_0xbd58('0x25')](_0x23315e);};}exports[_0xbd58('0x26')]=function(_0x139ac5,_0xd6298){var _0x5b080e={},_0x1d380a={},_0x108e09={'count':0x0,'rows':[]};var _0x1c9d9a=_['map'](db['CmHopperBlack']['rawAttributes'],function(_0x31874b){return{'name':_0x31874b['fieldName'],'type':_0x31874b[_0xbd58('0x27')][_0xbd58('0x28')]};});_0x1d380a[_0xbd58('0x29')]=_[_0xbd58('0x2a')](_0x1c9d9a,_0xbd58('0x2b'));_0x1d380a['query']=_['keys'](_0x139ac5[_0xbd58('0x2c')]);_0x1d380a['filters']=_['intersection'](_0x1d380a[_0xbd58('0x29')],_0x1d380a[_0xbd58('0x2c')]);_0x5b080e[_0xbd58('0x2d')]=_[_0xbd58('0x2e')](_0x1d380a[_0xbd58('0x29')],qs['fields'](_0x139ac5[_0xbd58('0x2c')]['fields']));_0x5b080e[_0xbd58('0x2d')]=_0x5b080e[_0xbd58('0x2d')][_0xbd58('0x2f')]?_0x5b080e[_0xbd58('0x2d')]:_0x1d380a[_0xbd58('0x29')];if(!_0x139ac5[_0xbd58('0x2c')][_0xbd58('0x30')]('nolimit')){_0x5b080e[_0xbd58('0x1a')]=qs['limit'](_0x139ac5[_0xbd58('0x2c')]['limit']);_0x5b080e[_0xbd58('0x18')]=qs[_0xbd58('0x18')](_0x139ac5['query']['offset']);}_0x5b080e[_0xbd58('0x31')]=qs[_0xbd58('0x32')](_0x139ac5[_0xbd58('0x2c')]['sort']);_0x5b080e['where']=qs[_0xbd58('0x33')](_[_0xbd58('0x34')](_0x139ac5['query'],_0x1d380a['filters']),_0x1c9d9a);if(_0x139ac5[_0xbd58('0x2c')][_0xbd58('0x35')]){_0x5b080e[_0xbd58('0x36')]=_[_0xbd58('0x37')](_0x5b080e[_0xbd58('0x36')],{'$or':_[_0xbd58('0x2a')](_0x1c9d9a,function(_0x540478){if(_0x540478[_0xbd58('0x27')]!=='VIRTUAL'){var _0x1cacbb={};_0x1cacbb[_0x540478[_0xbd58('0x2b')]]={'$like':'%'+_0x139ac5[_0xbd58('0x2c')][_0xbd58('0x35')]+'%'};return _0x1cacbb;}})});}_0x5b080e=_[_0xbd58('0x37')]({},_0x5b080e,_0x139ac5[_0xbd58('0x38')]);var _0x4d6d00={'where':_0x5b080e[_0xbd58('0x36')]};return db[_0xbd58('0x39')][_0xbd58('0x1b')](_0x4d6d00)[_0xbd58('0x22')](function(_0x302124){_0x108e09['count']=_0x302124;if(_0x139ac5['query']['includeAll']){_0x5b080e[_0xbd58('0x3a')]=[{'all':!![]}];}return db[_0xbd58('0x39')][_0xbd58('0x3b')](_0x5b080e);})[_0xbd58('0x22')](function(_0x543c88){_0x108e09[_0xbd58('0x3c')]=_0x543c88;return _0x108e09;})[_0xbd58('0x22')](respondWithFilteredResult(_0xd6298,_0x5b080e))['catch'](handleError(_0xd6298,null));};exports[_0xbd58('0x3d')]=function(_0x481d40,_0x4ab46c){var _0x5238e8={'raw':!![],'where':{'id':_0x481d40[_0xbd58('0x3e')]['id']}},_0x67cf42={};_0x67cf42[_0xbd58('0x29')]=_[_0xbd58('0x3f')](db[_0xbd58('0x39')][_0xbd58('0x40')]);_0x67cf42[_0xbd58('0x2c')]=_[_0xbd58('0x3f')](_0x481d40['query']);_0x67cf42[_0xbd58('0x33')]=_[_0xbd58('0x2e')](_0x67cf42[_0xbd58('0x29')],_0x67cf42[_0xbd58('0x2c')]);_0x5238e8[_0xbd58('0x2d')]=_['intersection'](_0x67cf42[_0xbd58('0x29')],qs[_0xbd58('0x41')](_0x481d40[_0xbd58('0x2c')]['fields']));_0x5238e8[_0xbd58('0x2d')]=_0x5238e8[_0xbd58('0x2d')][_0xbd58('0x2f')]?_0x5238e8[_0xbd58('0x2d')]:_0x67cf42['model'];if(_0x481d40['query']['includeAll']){_0x5238e8[_0xbd58('0x3a')]=[{'all':!![]}];}_0x5238e8=_[_0xbd58('0x37')]({},_0x5238e8,_0x481d40[_0xbd58('0x38')]);return db[_0xbd58('0x39')][_0xbd58('0x42')](_0x5238e8)[_0xbd58('0x22')](handleEntityNotFound(_0x4ab46c,null))['then'](respondWithResult(_0x4ab46c,null))['catch'](handleError(_0x4ab46c,null));};exports['update']=function(_0x28b68b,_0x3ff5ad){if(_0x28b68b[_0xbd58('0x43')]['id']){delete _0x28b68b[_0xbd58('0x43')]['id'];}return db[_0xbd58('0x39')][_0xbd58('0x42')]({'where':{'id':_0x28b68b[_0xbd58('0x3e')]['id']}})[_0xbd58('0x22')](handleEntityNotFound(_0x3ff5ad,null))[_0xbd58('0x22')](saveUpdates(_0x28b68b[_0xbd58('0x43')],null))[_0xbd58('0x22')](respondWithResult(_0x3ff5ad,null))['catch'](handleError(_0x3ff5ad,null));};exports[_0xbd58('0x23')]=function(_0x1e63d7,_0x158c7c){return db[_0xbd58('0x39')][_0xbd58('0x42')]({'where':{'id':_0x1e63d7['params']['id']}})[_0xbd58('0x22')](handleEntityNotFound(_0x158c7c,null))[_0xbd58('0x22')](removeEntity(_0x158c7c,null))[_0xbd58('0x44')](handleError(_0x158c7c,null));};exports[_0xbd58('0x45')]=function(_0xfc9883,_0x5c7ac6){return db[_0xbd58('0x39')][_0xbd58('0x45')]()[_0xbd58('0x22')](respondWithResult(_0x5c7ac6,null))['catch'](handleError(_0x5c7ac6,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index ca9f80c..b2a8e86 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 _0x4c60=['../../config/logger','bluebird','path','rimraf','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black','util'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x4c60,0x6d));var _0x04c6=function(_0x30c828,_0x3124a0){_0x30c828=_0x30c828-0x0;var _0x104c2b=_0x4c60[_0x30c828];return _0x104c2b;};'use strict';var _=require('lodash');var util=require(_0x04c6('0x0'));var logger=require(_0x04c6('0x1'))('api');var moment=require('moment');var BPromise=require(_0x04c6('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x04c6('0x3'));var rimraf=require(_0x04c6('0x4'));var config=require('../../config/environment');var attributes=require(_0x04c6('0x5'));module[_0x04c6('0x6')]=function(_0x1c0458,_0xc252ae){return _0x1c0458[_0x04c6('0x7')](_0x04c6('0x8'),attributes,{'tableName':_0x04c6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x490f=['CmHopperBlack','cm_hopper_black','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x5f3902,_0x462d8e){var _0x3b3dd2=function(_0x4818a5){while(--_0x4818a5){_0x5f3902['push'](_0x5f3902['shift']());}};_0x3b3dd2(++_0x462d8e);}(_0x490f,0x154));var _0xf490=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x490f[_0x2d486b];return _0x4291d1;};'use strict';var _=require('lodash');var util=require(_0xf490('0x0'));var logger=require(_0xf490('0x1'))(_0xf490('0x2'));var moment=require(_0xf490('0x3'));var BPromise=require('bluebird');var rp=require(_0xf490('0x4'));var fs=require('fs');var path=require(_0xf490('0x5'));var rimraf=require(_0xf490('0x6'));var config=require(_0xf490('0x7'));var attributes=require(_0xf490('0x8'));module[_0xf490('0x9')]=function(_0x532e71,_0x4f8fd6){return _0x532e71[_0xf490('0xa')](_0xf490('0xb'),attributes,{'tableName':_0xf490('0xc'),'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 813c564..adc24c4 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 _0xf8a2=['attributes','limit','include','map','model','UpdateCmHopperBlack','update','raw','DestroyCmHopperBlack','destroy','lodash','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','CmHopperBlack,\x20%s,\x20%s','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','where'];(function(_0x3dd807,_0x308f62){var _0x404b84=function(_0xc7d6b0){while(--_0xc7d6b0){_0x3dd807['push'](_0x3dd807['shift']());}};_0x404b84(++_0x308f62);}(_0xf8a2,0xff));var _0x2f8a=function(_0x18b191,_0x4e0684){_0x18b191=_0x18b191-0x0;var _0x43e146=_0xf8a2[_0x18b191];return _0x43e146;};'use strict';var _=require(_0x2f8a('0x0'));var util=require(_0x2f8a('0x1'));var moment=require(_0x2f8a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2f8a('0x3'))['db'];var utils=require(_0x2f8a('0x4'));var logger=require(_0x2f8a('0x5'))(_0x2f8a('0x6'));var config=require(_0x2f8a('0x7'));var jayson=require(_0x2f8a('0x8'));var client=jayson['client'][_0x2f8a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a57bd,_0x1bf126,_0x1190aa){return new BPromise(function(_0x859ed5,_0x4a9275){return client[_0x2f8a('0xa')](_0x5a57bd,_0x1190aa)[_0x2f8a('0xb')](function(_0xd86b80){logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x1bf126,_0x2f8a('0xc'));logger[_0x2f8a('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x1bf126,_0x2f8a('0xc'),JSON[_0x2f8a('0xe')](_0xd86b80));if(_0xd86b80[_0x2f8a('0xf')]){if(_0xd86b80[_0x2f8a('0xf')]['code']===0x1f4){logger[_0x2f8a('0xf')](_0x2f8a('0x10'),_0x1bf126,_0xd86b80[_0x2f8a('0xf')][_0x2f8a('0x11')]);return _0x4a9275(_0xd86b80[_0x2f8a('0xf')][_0x2f8a('0x11')]);}logger[_0x2f8a('0xf')](_0x2f8a('0x10'),_0x1bf126,_0xd86b80[_0x2f8a('0xf')][_0x2f8a('0x11')]);return _0x859ed5(_0xd86b80[_0x2f8a('0xf')]['message']);}else{logger[_0x2f8a('0x12')](_0x2f8a('0x10'),_0x1bf126,'request\x20sent');_0x859ed5(_0xd86b80[_0x2f8a('0x13')][_0x2f8a('0x11')]);}})[_0x2f8a('0x14')](function(_0xd91e1f){logger[_0x2f8a('0xf')](_0x2f8a('0x10'),_0x1bf126,_0xd91e1f);_0x4a9275(_0xd91e1f);});});}exports[_0x2f8a('0x15')]=function(_0x3bd01d){var _0x17be4f=this;return new Promise(function(_0x3bed47,_0x4e2566){return db[_0x2f8a('0x16')]['findAll']({'raw':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x18')]||null:null,'attributes':_0x3bd01d['options']?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x19')]||null:null,'limit':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x1a')]||null:null,'include':_0x3bd01d[_0x2f8a('0x17')]?_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x1b')]?_[_0x2f8a('0x1c')](_0x3bd01d[_0x2f8a('0x17')][_0x2f8a('0x1b')],function(_0x17d26e){return{'model':db[_0x17d26e['model']],'as':_0x17d26e['as'],'attributes':_0x17d26e['attributes'],'include':_0x17d26e[_0x2f8a('0x1b')]?_['map'](_0x17d26e[_0x2f8a('0x1b')],function(_0x5e747f){return{'model':db[_0x5e747f['model']],'as':_0x5e747f['as'],'attributes':_0x5e747f['attributes'],'include':_0x5e747f[_0x2f8a('0x1b')]?_['map'](_0x5e747f[_0x2f8a('0x1b')],function(_0x28a87a){return{'model':db[_0x28a87a[_0x2f8a('0x1d')]],'as':_0x28a87a['as'],'attributes':_0x28a87a[_0x2f8a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2f8a('0xb')](function(_0x1cb6da){logger[_0x2f8a('0x12')]('GetCmHopperBlack',_0x3bd01d);logger[_0x2f8a('0xd')](_0x2f8a('0x15'),_0x3bd01d,JSON[_0x2f8a('0xe')](_0x1cb6da));_0x3bed47(_0x1cb6da);})[_0x2f8a('0x14')](function(_0x269008){logger[_0x2f8a('0xf')](_0x2f8a('0x15'),_0x269008[_0x2f8a('0x11')],_0x3bd01d);_0x4e2566(_0x17be4f[_0x2f8a('0xf')](0x1f4,_0x269008[_0x2f8a('0x11')]));});});};exports[_0x2f8a('0x1e')]=function(_0x1e9670){var _0x1e2fe6=this;return new Promise(function(_0x39cb46,_0xa25c77){return db[_0x2f8a('0x16')][_0x2f8a('0x1f')](_0x1e9670['body'],{'raw':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670['options'][_0x2f8a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670['options']['where']||null:null,'attributes':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670['options'][_0x2f8a('0x19')]||null:null,'limit':_0x1e9670[_0x2f8a('0x17')]?_0x1e9670[_0x2f8a('0x17')][_0x2f8a('0x1a')]||null:null})[_0x2f8a('0xb')](function(_0x3a2e48){logger[_0x2f8a('0x12')]('UpdateCmHopperBlack',_0x1e9670);logger[_0x2f8a('0xd')](_0x2f8a('0x1e'),_0x1e9670,JSON['stringify'](_0x3a2e48));_0x39cb46(_0x3a2e48);})[_0x2f8a('0x14')](function(_0x2ecf33){logger[_0x2f8a('0xf')]('UpdateCmHopperBlack',_0x2ecf33['message'],_0x1e9670);_0xa25c77(_0x1e2fe6[_0x2f8a('0xf')](0x1f4,_0x2ecf33['message']));});});};exports[_0x2f8a('0x21')]=function(_0x9b1ec0){var _0x35dbe7=this;return new Promise(function(_0x3c7c96,_0x501221){return db[_0x2f8a('0x16')][_0x2f8a('0x22')]({'where':_0x9b1ec0[_0x2f8a('0x17')]?_0x9b1ec0[_0x2f8a('0x17')][_0x2f8a('0x18')]||null:null})[_0x2f8a('0xb')](function(_0x281104){logger[_0x2f8a('0x12')](_0x2f8a('0x21'),_0x9b1ec0);logger[_0x2f8a('0xd')](_0x2f8a('0x21'),_0x9b1ec0,JSON['stringify'](_0x281104));_0x3c7c96(_0x281104);})[_0x2f8a('0x14')](function(_0xf10717){logger[_0x2f8a('0xf')](_0x2f8a('0x21'),_0xf10717[_0x2f8a('0x11')],_0x9b1ec0);_0x501221(_0x35dbe7[_0x2f8a('0xf')](0x1f4,_0xf10717['message']));});});}; \ No newline at end of file +var _0x4717=['GetCmHopperBlack','update','body','UpdateCmHopperBlack','DestroyCmHopperBlack','destroy','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CmHopperBlack','options','raw','where','attributes','limit','include','map','model'];(function(_0x421613,_0x4cd335){var _0x3a24a8=function(_0x44e411){while(--_0x44e411){_0x421613['push'](_0x421613['shift']());}};_0x3a24a8(++_0x4cd335);}(_0x4717,0x182));var _0x7471=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x4717[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x7471('0x0'));var moment=require(_0x7471('0x1'));var BPromise=require(_0x7471('0x2'));var rs=require(_0x7471('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7471('0x4'))['db'];var utils=require(_0x7471('0x5'));var logger=require(_0x7471('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7471('0x7'));var client=jayson[_0x7471('0x8')][_0x7471('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf27439,_0x57b81c,_0x470185){return new BPromise(function(_0x169b00,_0x1857db){return client[_0x7471('0xa')](_0xf27439,_0x470185)[_0x7471('0xb')](function(_0x4701c7){logger[_0x7471('0xc')](_0x7471('0xd'),_0x57b81c,_0x7471('0xe'));logger[_0x7471('0xf')](_0x7471('0x10'),_0x57b81c,_0x7471('0xe'),JSON[_0x7471('0x11')](_0x4701c7));if(_0x4701c7[_0x7471('0x12')]){if(_0x4701c7[_0x7471('0x12')][_0x7471('0x13')]===0x1f4){logger[_0x7471('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x57b81c,_0x4701c7[_0x7471('0x12')][_0x7471('0x14')]);return _0x1857db(_0x4701c7['error'][_0x7471('0x14')]);}logger[_0x7471('0x12')](_0x7471('0xd'),_0x57b81c,_0x4701c7[_0x7471('0x12')][_0x7471('0x14')]);return _0x169b00(_0x4701c7[_0x7471('0x12')][_0x7471('0x14')]);}else{logger[_0x7471('0xc')](_0x7471('0xd'),_0x57b81c,_0x7471('0xe'));_0x169b00(_0x4701c7[_0x7471('0x15')][_0x7471('0x14')]);}})[_0x7471('0x16')](function(_0x14fb5e){logger[_0x7471('0x12')](_0x7471('0xd'),_0x57b81c,_0x14fb5e);_0x1857db(_0x14fb5e);});});}exports['GetCmHopperBlack']=function(_0x3669be){var _0x1b921e=this;return new Promise(function(_0x3c1b9b,_0x43a6ec){return db[_0x7471('0x17')]['findAll']({'raw':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x19')]===undefined?!![]:![]:!![],'where':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x1a')]||null:null,'attributes':_0x3669be['options']?_0x3669be[_0x7471('0x18')][_0x7471('0x1b')]||null:null,'limit':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x1c')]||null:null,'include':_0x3669be[_0x7471('0x18')]?_0x3669be[_0x7471('0x18')][_0x7471('0x1d')]?_[_0x7471('0x1e')](_0x3669be['options']['include'],function(_0x3e76c6){return{'model':db[_0x3e76c6[_0x7471('0x1f')]],'as':_0x3e76c6['as'],'attributes':_0x3e76c6[_0x7471('0x1b')],'include':_0x3e76c6[_0x7471('0x1d')]?_['map'](_0x3e76c6[_0x7471('0x1d')],function(_0x35d2ea){return{'model':db[_0x35d2ea[_0x7471('0x1f')]],'as':_0x35d2ea['as'],'attributes':_0x35d2ea[_0x7471('0x1b')],'include':_0x35d2ea['include']?_['map'](_0x35d2ea[_0x7471('0x1d')],function(_0x288f71){return{'model':db[_0x288f71[_0x7471('0x1f')]],'as':_0x288f71['as'],'attributes':_0x288f71[_0x7471('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x7471('0xb')](function(_0xc2ff10){logger['info']('GetCmHopperBlack',_0x3669be);logger['debug'](_0x7471('0x20'),_0x3669be,JSON['stringify'](_0xc2ff10));_0x3c1b9b(_0xc2ff10);})[_0x7471('0x16')](function(_0x443ce7){logger['error'](_0x7471('0x20'),_0x443ce7[_0x7471('0x14')],_0x3669be);_0x43a6ec(_0x1b921e[_0x7471('0x12')](0x1f4,_0x443ce7[_0x7471('0x14')]));});});};exports['UpdateCmHopperBlack']=function(_0x83ccc5){var _0x525e20=this;return new Promise(function(_0x56cc3c,_0x18c72f){return db[_0x7471('0x17')][_0x7471('0x21')](_0x83ccc5[_0x7471('0x22')],{'raw':_0x83ccc5['options']?_0x83ccc5[_0x7471('0x18')][_0x7471('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x83ccc5[_0x7471('0x18')]?_0x83ccc5[_0x7471('0x18')][_0x7471('0x1a')]||null:null,'attributes':_0x83ccc5[_0x7471('0x18')]?_0x83ccc5[_0x7471('0x18')][_0x7471('0x1b')]||null:null,'limit':_0x83ccc5[_0x7471('0x18')]?_0x83ccc5['options'][_0x7471('0x1c')]||null:null})[_0x7471('0xb')](function(_0x3fea42){logger[_0x7471('0xc')](_0x7471('0x23'),_0x83ccc5);logger['debug'](_0x7471('0x23'),_0x83ccc5,JSON[_0x7471('0x11')](_0x3fea42));_0x56cc3c(_0x3fea42);})[_0x7471('0x16')](function(_0xce9e1d){logger[_0x7471('0x12')](_0x7471('0x23'),_0xce9e1d[_0x7471('0x14')],_0x83ccc5);_0x18c72f(_0x525e20[_0x7471('0x12')](0x1f4,_0xce9e1d['message']));});});};exports[_0x7471('0x24')]=function(_0x172eca){var _0x25bca9=this;return new Promise(function(_0xc5c4d9,_0xc2a410){return db[_0x7471('0x17')][_0x7471('0x25')]({'where':_0x172eca[_0x7471('0x18')]?_0x172eca[_0x7471('0x18')]['where']||null:null})[_0x7471('0xb')](function(_0x1b460f){logger[_0x7471('0xc')]('DestroyCmHopperBlack',_0x172eca);logger[_0x7471('0xf')](_0x7471('0x24'),_0x172eca,JSON['stringify'](_0x1b460f));_0xc5c4d9(_0x1b460f);})['catch'](function(_0x1153d0){logger[_0x7471('0x12')](_0x7471('0x24'),_0x1153d0[_0x7471('0x14')],_0x172eca);_0xc2a410(_0x25bca9['error'](0x1f4,_0x1153d0[_0x7471('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 4f120d9..bc5e208 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 _0x8ace=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','put'];(function(_0x2e95ec,_0x195a89){var _0x11eccc=function(_0x2d1de4){while(--_0x2d1de4){_0x2e95ec['push'](_0x2e95ec['shift']());}};_0x11eccc(++_0x195a89);}(_0x8ace,0x1bc));var _0xe8ac=function(_0x3cbb14,_0x3c95a7){_0x3cbb14=_0x3cbb14-0x0;var _0x2bfb35=_0x8ace[_0x3cbb14];return _0x2bfb35;};'use strict';var multer=require(_0xe8ac('0x0'));var util=require(_0xe8ac('0x1'));var path=require(_0xe8ac('0x2'));var timeout=require(_0xe8ac('0x3'));var express=require(_0xe8ac('0x4'));var router=express[_0xe8ac('0x5')]();var fs_extra=require(_0xe8ac('0x6'));var auth=require(_0xe8ac('0x7'));var interaction=require(_0xe8ac('0x8'));var config=require(_0xe8ac('0x9'));var controller=require(_0xe8ac('0xa'));router[_0xe8ac('0xb')]('/',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0xd')]);router['get'](_0xe8ac('0xe'),auth[_0xe8ac('0xc')](),controller['describe']);router['get'](_0xe8ac('0xf'),auth['isAuthenticated'](),controller[_0xe8ac('0x10')]);router[_0xe8ac('0x11')](_0xe8ac('0xf'),auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x12')]);router[_0xe8ac('0x13')]('/:id',auth[_0xe8ac('0xc')](),controller[_0xe8ac('0x14')]);module[_0xe8ac('0x15')]=router; \ No newline at end of file +var _0x1967=['../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x438434,_0x39d178){var _0x40a547=function(_0x5593c0){while(--_0x5593c0){_0x438434['push'](_0x438434['shift']());}};_0x40a547(++_0x39d178);}(_0x1967,0x173));var _0x7196=function(_0x440604,_0x1177b4){_0x440604=_0x440604-0x0;var _0x35266e=_0x1967[_0x440604];return _0x35266e;};'use strict';var multer=require('multer');var util=require(_0x7196('0x0'));var path=require(_0x7196('0x1'));var timeout=require(_0x7196('0x2'));var express=require(_0x7196('0x3'));var router=express[_0x7196('0x4')]();var fs_extra=require(_0x7196('0x5'));var auth=require(_0x7196('0x6'));var interaction=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var controller=require(_0x7196('0x9'));router['get']('/',auth[_0x7196('0xa')](),controller[_0x7196('0xb')]);router[_0x7196('0xc')](_0x7196('0xd'),auth[_0x7196('0xa')](),controller[_0x7196('0xe')]);router['get'](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x10')]);router[_0x7196('0x11')](_0x7196('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x7196('0x12')](_0x7196('0xf'),auth[_0x7196('0xa')](),controller[_0x7196('0x13')]);module[_0x7196('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 25ded47..bf02099 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 _0xb49c=['setDataValue','followuptime','diff','BOOLEAN','sequelize','moment','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0xc63e57,_0x5f4a47){var _0xf49907=function(_0x3b9df6){while(--_0x3b9df6){_0xc63e57['push'](_0xc63e57['shift']());}};_0xf49907(++_0x5f4a47);}(_0xb49c,0x67));var _0xcb49=function(_0x233f5a,_0x6dc40c){_0x233f5a=_0x233f5a-0x0;var _0x23531e=_0xb49c[_0x233f5a];return _0x23531e;};'use strict';var Sequelize=require(_0xcb49('0x0'));var moment=require(_0xcb49('0x1'));module['exports']={'state':{'type':Sequelize[_0xcb49('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xcb49('0x3')]},'scheduledat':{'type':Sequelize[_0xcb49('0x4')]},'countbusyretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xcb49('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xcb49('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xcb49('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xcb49('0x4')]},'answertime':{'type':Sequelize[_0xcb49('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xcb49('0x3')]},'campaign':{'type':Sequelize[_0xcb49('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xcb49('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xcb49('0x3')]},'thirdDisposition':{'type':Sequelize[_0xcb49('0x3')]},'dispositionat':{'type':Sequelize[_0xcb49('0x4')],'set':function(_0x4bcadb){var _0x2c7351=this[_0xcb49('0x5')](_0xcb49('0x6'));if(_0x2c7351&&_0x4bcadb){this[_0xcb49('0x7')](_0xcb49('0x8'),moment(_0x4bcadb)[_0xcb49('0x9')](moment(_0x2c7351),'seconds'));}}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize[_0xcb49('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xcb49('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xcb49('0x4')]},'callback':{'type':Sequelize[_0xcb49('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xcb49('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xcb49('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0xcb49('0x4')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xcb49('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x58a1=['diff','BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue'];(function(_0x2fd131,_0x342b53){var _0x35931f=function(_0x5aacc9){while(--_0x5aacc9){_0x2fd131['push'](_0x2fd131['shift']());}};_0x35931f(++_0x342b53);}(_0x58a1,0xde));var _0x158a=function(_0x2a0bf0,_0x247ffd){_0x2a0bf0=_0x2a0bf0-0x0;var _0x104fd6=_0x58a1[_0x2a0bf0];return _0x104fd6;};'use strict';var Sequelize=require(_0x158a('0x0'));var moment=require(_0x158a('0x1'));module[_0x158a('0x2')]={'state':{'type':Sequelize[_0x158a('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x158a('0x4')]},'scheduledat':{'type':Sequelize[_0x158a('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x158a('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x158a('0x4')]},'originatecalleridname':{'type':Sequelize[_0x158a('0x4')]},'calleridnum':{'type':Sequelize[_0x158a('0x4')]},'calleridname':{'type':Sequelize[_0x158a('0x4')]},'starttime':{'type':Sequelize[_0x158a('0x5')]},'responsetime':{'type':Sequelize[_0x158a('0x5')]},'answertime':{'type':Sequelize[_0x158a('0x5')]},'droptime':{'type':Sequelize[_0x158a('0x5')]},'endtime':{'type':Sequelize[_0x158a('0x5')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x158a('0x4')]},'campaign':{'type':Sequelize[_0x158a('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x158a('0x4')]},'reason':{'type':Sequelize[_0x158a('0x4')]},'disposition':{'type':Sequelize[_0x158a('0x4')]},'secondDisposition':{'type':Sequelize[_0x158a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x158a('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x4906a8){var _0x525c02=this[_0x158a('0x6')](_0x158a('0x7'));if(_0x525c02&&_0x4906a8){this[_0x158a('0x8')]('followuptime',moment(_0x4906a8)[_0x158a('0x9')](moment(_0x525c02),'seconds'));}}},'amd':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'fax':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x158a('0x5')]},'callback':{'type':Sequelize[_0x158a('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x158a('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x158a('0x5')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x158a('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x158a('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x158a('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 eee035c..4af7ce4 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.controller.js +++ b/server/api/cmHopperFinal/cmHopperFinal.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x33155c,_0x3fdde1){var _0x5becf7=function(_0x2f7a2f){while(--_0x2f7a2f){_0x33155c['push'](_0x33155c['shift']());}};_0x5becf7(++_0x3fdde1);}(_0x5d17,0x114));var _0x75d1=function(_0x3c6b20,_0x315702){_0x3c6b20=_0x3c6b20-0x0;var _0x5d6849=_0x5d17[_0x3c6b20];return _0x5d6849;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file +var _0xadb5=['`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','noSuchContacts','VoiceQueue','find','insert','cm_hopper','fromQuery','phone','ContactId','ListId','createdAt','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(VoiceQueueId)','updatedAt','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','Campaign','into','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','findOne','VoiceQueueId','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','CmHopperFinal','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','COUNT','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts'];(function(_0x78699f,_0x9b5e13){var _0x26bfc7=function(_0x2fbc27){while(--_0x2fbc27){_0x78699f['push'](_0x78699f['shift']());}};_0x26bfc7(++_0x9b5e13);}(_0xadb5,0xad));var _0x5adb=function(_0x2e284d,_0x4813ef){_0x2e284d=_0x2e284d-0x0;var _0x240296=_0xadb5[_0x2e284d];return _0x240296;};'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['CmHopperFinal']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':!![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')]()['then'](respondWithResult(_0x3a5409,null))[_0x5adb('0x42')](handleError(_0x3a5409,null));};exports['update']=function(_0x51bc49,_0x5015ee){if(_0x51bc49[_0x5adb('0x47')][_0x5adb('0x48')]){delete _0x51bc49[_0x5adb('0x47')]['uniqueid'];}return db[_0x5adb('0x2a')]['find']({'where':{'uniqueid':_0x51bc49[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x5015ee,null))[_0x5adb('0x22')](saveUpdates(_0x51bc49['body'],null))[_0x5adb('0x22')](respondWithResult(_0x5015ee,null))['catch'](handleError(_0x5015ee,null));};exports[_0x5adb('0x49')]=function(_0x6dc067,_0x55c535,_0x2402a3){return db[_0x5adb('0x2a')][_0x5adb('0x40')]({'raw':![],'where':{'VoiceQueueId':_0x6dc067[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x4c')))),'noSuchContacts'],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize'][_0x5adb('0x4b')](_0x5adb('0x4e')))),_0x5adb('0x4f')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x52')))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),_0x5adb('0x58')],[db[_0x5adb('0x4a')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})['then'](handleEntityNotFound(_0x55c535,null))[_0x5adb('0x22')](respondWithResult(_0x55c535,null))[_0x5adb('0x42')](handleError(_0x55c535,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x5cb50e,_0x476e62,_0x1505f7){return db['CmHopperFinal'][_0x5adb('0x40')]({'raw':![],'where':{'CampaignId':_0x5cb50e[_0x5adb('0x44')]['id']},'attributes':[[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x4c')))),_0x5adb('0x5b')],[db[_0x5adb('0x4a')]['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x203,\x201,\x20null'))),_0x5adb('0x4f')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x50')))),_0x5adb('0x51')],[db['sequelize']['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')]('`state`\x20=\x208,\x201,\x20null'))),_0x5adb('0x53')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db['sequelize']['literal'](_0x5adb('0x54')))),'dropContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')]['literal'](_0x5adb('0x55')))),_0x5adb('0x56')],[db[_0x5adb('0x4a')]['fn'](_0x5adb('0x4d'),db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x57')))),'reCallContacts'],[db['sequelize']['fn']('COUNT',db[_0x5adb('0x4a')]['fn']('IF',db[_0x5adb('0x4a')][_0x5adb('0x4b')](_0x5adb('0x59')))),_0x5adb('0x5a')]]})[_0x5adb('0x22')](handleEntityNotFound(_0x476e62,null))[_0x5adb('0x22')](respondWithResult(_0x476e62,null))[_0x5adb('0x42')](handleError(_0x476e62,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x5e55c2,_0x1fc73b,_0x56df90){return db[_0x5adb('0x5c')][_0x5adb('0x5d')]({'where':{'id':_0x5e55c2[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x1fc73b,null))[_0x5adb('0x22')](function(_0x236f59){var _0x338aee;if(_0x236f59){_0x338aee=squel[_0x5adb('0x5e')]()['into'](_0x5adb('0x5f'))[_0x5adb('0x60')]([_0x5adb('0x61'),'scheduledAt',_0x5adb('0x62'),_0x5adb('0x63'),'VoiceQueueId',_0x5adb('0x64'),'updatedAt'],squel[_0x5adb('0x65')]()[_0x5adb('0x66')]('ANY_VALUE(calleridnum)',_0x5adb('0x61'))[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')]('ANY_VALUE(ListId)',_0x5adb('0x63'))[_0x5adb('0x66')](_0x5adb('0x6a'),'VoiceQueueId')['field'](_0x5adb('0x67'),'createdAt')[_0x5adb('0x66')](_0x5adb('0x67'),_0x5adb('0x6b'))['from'](_0x5adb('0x6c'))[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())['where'](_0x5adb('0x6f'),_0x5e55c2[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())['where'](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x61'))[_0x5adb('0x73')]('cm_hopper')[_0x5adb('0x37')](_0x5adb('0x6d'),_0x5e55c2['params']['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x5adb('0x65')]()['field'](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')]('VoiceQueueId\x20=\x20?',_0x5e55c2[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')]('ContactId'))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')][_0x5adb('0x2f')](_0x338aee);}return[];})[_0x5adb('0x22')](respondWithResult(_0x1fc73b,null))['catch'](handleError(_0x1fc73b,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x3f3db9,_0x461a07,_0x2e5c96){return db[_0x5adb('0x77')][_0x5adb('0x5d')]({'where':{'id':_0x3f3db9[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x461a07,null))['then'](function(_0xda26cc){var _0x14bada;if(_0xda26cc){_0x14bada=squel[_0x5adb('0x5e')]()[_0x5adb('0x78')]('cm_hopper')[_0x5adb('0x60')]([_0x5adb('0x61'),_0x5adb('0x68'),_0x5adb('0x62'),_0x5adb('0x63'),_0x5adb('0x79'),_0x5adb('0x64'),_0x5adb('0x6b')],squel[_0x5adb('0x65')]()['field'](_0x5adb('0x7a'),_0x5adb('0x61'))['field'](_0x5adb('0x67'),_0x5adb('0x68'))[_0x5adb('0x66')](_0x5adb('0x69'),_0x5adb('0x62'))[_0x5adb('0x66')](_0x5adb('0x7b'),_0x5adb('0x63'))['field'](_0x5adb('0x7c'),_0x5adb('0x79'))['field'](_0x5adb('0x67'),_0x5adb('0x64'))[_0x5adb('0x66')]('NOW()','updatedAt')[_0x5adb('0x73')](_0x5adb('0x6c'))[_0x5adb('0x37')]('CampaignId\x20=\x20?',_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x6f'),_0x3f3db9[_0x5adb('0x47')][_0x5adb('0x70')][_0x5adb('0x6e')]())[_0x5adb('0x37')](_0x5adb('0x71'))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()['field']('phone')[_0x5adb('0x73')](_0x5adb('0x5f'))['where'](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id'][_0x5adb('0x6e')]()))[_0x5adb('0x37')](_0x5adb('0x72'),squel[_0x5adb('0x65')]()[_0x5adb('0x66')](_0x5adb('0x74'))[_0x5adb('0x73')]('cm_hopper_final')[_0x5adb('0x37')](_0x5adb('0x7d'),_0x3f3db9[_0x5adb('0x44')]['id']['toString']())[_0x5adb('0x37')](_0x5adb('0x75')))[_0x5adb('0x76')](_0x5adb('0x62')))[_0x5adb('0x6e')]();return db[_0x5adb('0x4a')]['query'](_0x14bada);}return[];})[_0x5adb('0x22')](respondWithResult(_0x461a07,null))[_0x5adb('0x42')](handleError(_0x461a07,null));};exports[_0x5adb('0x7e')]=function(_0x1e5532,_0x2c3af8,_0x3a201a){return db[_0x5adb('0x7f')][_0x5adb('0x80')]({'where':{'VoiceQueueId':_0x1e5532[_0x5adb('0x47')][_0x5adb('0x81')],'CampaignId':_0x1e5532['body'][_0x5adb('0x79')],'ContactId':_0x1e5532['body'][_0x5adb('0x62')]}})[_0x5adb('0x22')](handleEntityNotFound(_0x2c3af8,null))[_0x5adb('0x22')](function(_0x193a29){if(_0x193a29){return _0x193a29;}return null;})[_0x5adb('0x22')](respondWithResult(_0x2c3af8,null))['catch'](handleError(_0x2c3af8,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 7a4085e..d0701dc 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 _0x8614=['CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','define'];(function(_0x178312,_0x145a1a){var _0x585238=function(_0x330c2b){while(--_0x330c2b){_0x178312['push'](_0x178312['shift']());}};_0x585238(++_0x145a1a);}(_0x8614,0x1a8));var _0x4861=function(_0x2d5302,_0x77ce73){_0x2d5302=_0x2d5302-0x0;var _0x3fff6c=_0x8614[_0x2d5302];return _0x3fff6c;};'use strict';var _=require(_0x4861('0x0'));var util=require(_0x4861('0x1'));var logger=require(_0x4861('0x2'))(_0x4861('0x3'));var moment=require(_0x4861('0x4'));var BPromise=require(_0x4861('0x5'));var rp=require(_0x4861('0x6'));var fs=require('fs');var path=require(_0x4861('0x7'));var rimraf=require('rimraf');var config=require(_0x4861('0x8'));var attributes=require(_0x4861('0x9'));module['exports']=function(_0x12f287,_0xfd2cec){return _0x12f287[_0x4861('0xa')](_0x4861('0xb'),attributes,{'tableName':_0x4861('0xc'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0x4861('0xd')]},{'name':_0x4861('0xe'),'fields':[_0x4861('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf700=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','CmHopperFinal','calleridnum','uniqueid','lodash','../../config/logger','api'];(function(_0x198e29,_0x642e00){var _0x28c55b=function(_0x1831d7){while(--_0x1831d7){_0x198e29['push'](_0x198e29['shift']());}};_0x28c55b(++_0x642e00);}(_0xf700,0x15c));var _0x0f70=function(_0x11e333,_0xf8593e){_0x11e333=_0x11e333-0x0;var _0x4d726e=_0xf700[_0x11e333];return _0x4d726e;};'use strict';var _=require(_0x0f70('0x0'));var util=require('util');var logger=require(_0x0f70('0x1'))(_0x0f70('0x2'));var moment=require(_0x0f70('0x3'));var BPromise=require(_0x0f70('0x4'));var rp=require(_0x0f70('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f70('0x6'));var config=require(_0x0f70('0x7'));var attributes=require('./cmHopperFinal.attributes');module[_0x0f70('0x8')]=function(_0x2bae59,_0x5c27b3){return _0x2bae59[_0x0f70('0x9')](_0x0f70('0xa'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x0f70('0xb'),'fields':[_0x0f70('0xb')]},{'name':'uniqueid','fields':[_0x0f70('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 6db0cf9..12ae1a4 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x4a2bc6,_0x1dc74d){var _0x429a25=function(_0x2ea06e){while(--_0x2ea06e){_0x4a2bc6['push'](_0x4a2bc6['shift']());}};_0x429a25(++_0x1dc74d);}(_0x7a54,0x106));var _0x47a5=function(_0x11a87d,_0x983754){_0x11a87d=_0x11a87d-0x0;var _0x2e009e=_0x7a54[_0x11a87d];return _0x2e009e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x501119,_0x168137){var _0x393fca=function(_0x1baf32){while(--_0x1baf32){_0x501119['push'](_0x501119['shift']());}};_0x393fca(++_0x168137);}(_0xb10b,0x12a));var _0xbb10=function(_0x295849,_0x42b3eb){_0x295849=_0x295849-0x0;var _0x27d8d4=_0xb10b[_0x295849];return _0x27d8d4;};'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 c59bdf0..577914b 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 _0xedd7=['get','index','isAuthenticated','describe','/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller'];(function(_0x41b45f,_0x3d3cc2){var _0x4423c2=function(_0x21dd9c){while(--_0x21dd9c){_0x41b45f['push'](_0x41b45f['shift']());}};_0x4423c2(++_0x3d3cc2);}(_0xedd7,0x6f));var _0x7edd=function(_0x996bc8,_0x291e01){_0x996bc8=_0x996bc8-0x0;var _0x20b0ea=_0xedd7[_0x996bc8];return _0x20b0ea;};'use strict';var multer=require('multer');var util=require(_0x7edd('0x0'));var path=require(_0x7edd('0x1'));var timeout=require(_0x7edd('0x2'));var express=require(_0x7edd('0x3'));var router=express[_0x7edd('0x4')]();var fs_extra=require(_0x7edd('0x5'));var auth=require(_0x7edd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7edd('0x7'));var controller=require(_0x7edd('0x8'));router[_0x7edd('0x9')]('/',auth['isAuthenticated'](),controller[_0x7edd('0xa')]);router[_0x7edd('0x9')]('/describe',auth[_0x7edd('0xb')](),controller[_0x7edd('0xc')]);router[_0x7edd('0x9')](_0x7edd('0xd'),auth[_0x7edd('0xb')](),controller['show']);router['get']('/voice/queue/countAttributes/:id',auth[_0x7edd('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x7edd('0x9')](_0x7edd('0xe'),auth[_0x7edd('0xb')](),controller[_0x7edd('0xf')]);router[_0x7edd('0x10')](_0x7edd('0x11'),auth[_0x7edd('0xb')](),controller[_0x7edd('0x12')]);router[_0x7edd('0x10')]('/voice/campaign/moveContacts/:id',auth[_0x7edd('0xb')](),controller[_0x7edd('0x13')]);router[_0x7edd('0x10')](_0x7edd('0x14'),auth[_0x7edd('0xb')](),controller[_0x7edd('0x15')]);router[_0x7edd('0x16')]('/:id',auth[_0x7edd('0xb')](),controller['update']);module[_0x7edd('0x17')]=router; \ No newline at end of file +var _0x381e=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','/:id','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x2afe3c,_0x559154){var _0x466eb2=function(_0x35ad2c){while(--_0x35ad2c){_0x2afe3c['push'](_0x2afe3c['shift']());}};_0x466eb2(++_0x559154);}(_0x381e,0x18f));var _0xe381=function(_0x4f106c,_0x271839){_0x4f106c=_0x4f106c-0x0;var _0xb66b4b=_0x381e[_0x4f106c];return _0xb66b4b;};'use strict';var multer=require(_0xe381('0x0'));var util=require(_0xe381('0x1'));var path=require(_0xe381('0x2'));var timeout=require(_0xe381('0x3'));var express=require(_0xe381('0x4'));var router=express[_0xe381('0x5')]();var fs_extra=require(_0xe381('0x6'));var auth=require(_0xe381('0x7'));var interaction=require(_0xe381('0x8'));var config=require(_0xe381('0x9'));var controller=require(_0xe381('0xa'));router['get']('/',auth[_0xe381('0xb')](),controller[_0xe381('0xc')]);router[_0xe381('0xd')](_0xe381('0xe'),auth[_0xe381('0xb')](),controller['describe']);router['get'](_0xe381('0xf'),auth[_0xe381('0xb')](),controller['show']);router[_0xe381('0xd')](_0xe381('0x10'),auth[_0xe381('0xb')](),controller['countContactsQueueCampaignHopperFinal']);router[_0xe381('0xd')](_0xe381('0x11'),auth['isAuthenticated'](),controller[_0xe381('0x12')]);router[_0xe381('0x13')](_0xe381('0x14'),auth[_0xe381('0xb')](),controller[_0xe381('0x15')]);router[_0xe381('0x13')]('/voice/campaign/moveContacts/:id',auth[_0xe381('0xb')](),controller[_0xe381('0x16')]);router['post'](_0xe381('0x17'),auth['isAuthenticated'](),controller[_0xe381('0x18')]);router['put'](_0xe381('0xf'),auth[_0xe381('0xb')](),controller[_0xe381('0x19')]);module[_0xe381('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index fd25a31..7897693 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 _0x613e=['BOOLEAN','sequelize','exports','DATE','INTEGER','STRING'];(function(_0xd09873,_0x919e8b){var _0x243c9f=function(_0x3d6225){while(--_0x3d6225){_0xd09873['push'](_0xd09873['shift']());}};_0x243c9f(++_0x919e8b);}(_0x613e,0x1e1));var _0xe613=function(_0x150bd3,_0x200ef5){_0x150bd3=_0x150bd3-0x0;var _0x338063=_0x613e[_0x150bd3];return _0x338063;};'use strict';var Sequelize=require(_0xe613('0x0'));module[_0xe613('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xe613('0x2')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe613('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe613('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe613('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xe613('0x4')]},'starttime':{'type':Sequelize[_0xe613('0x2')]},'responsetime':{'type':Sequelize[_0xe613('0x2')]},'answertime':{'type':Sequelize[_0xe613('0x2')]},'droptime':{'type':Sequelize[_0xe613('0x2')]},'endtime':{'type':Sequelize[_0xe613('0x2')]},'ringtime':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe613('0x4')]},'campaign':{'type':Sequelize[_0xe613('0x4')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe613('0x4')]},'amd':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe613('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe613('0x2')]},'recallme':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xe613('0x2')]},'edited':{'type':Sequelize[_0xe613('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe613('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xe613('0x4')]}}; \ No newline at end of file +var _0x6b23=['DATE','INTEGER','BOOLEAN','sequelize','STRING'];(function(_0x53e3c9,_0x323b2b){var _0x5e3a3b=function(_0x11e30d){while(--_0x11e30d){_0x53e3c9['push'](_0x53e3c9['shift']());}};_0x5e3a3b(++_0x323b2b);}(_0x6b23,0x102));var _0x36b2=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0x6b23[_0x245afe];return _0x4eefde;};'use strict';var Sequelize=require(_0x36b2('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x36b2('0x1')]},'scheduledat':{'type':Sequelize[_0x36b2('0x2')]},'countbusyretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x36b2('0x1')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x36b2('0x1')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x36b2('0x1')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0x36b2('0x2')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x36b2('0x2')]},'endtime':{'type':Sequelize[_0x36b2('0x2')]},'ringtime':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x36b2('0x1')]},'campaign':{'type':Sequelize[_0x36b2('0x1')]},'campaigntype':{'type':Sequelize[_0x36b2('0x1')]},'membername':{'type':Sequelize[_0x36b2('0x1')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x36b2('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x36b2('0x2')]},'recallme':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x36b2('0x2')]},'edited':{'type':Sequelize[_0x36b2('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x36b2('0x3')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x36b2('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index b25b630..4d7df91 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 _0xb4c9=['stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','update','uniqueid','params','eml-format','rimraf','fast-json-patch','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error'];(function(_0x242f0a,_0x30ea24){var _0x361e57=function(_0x3c8d05){while(--_0x3c8d05){_0x242f0a['push'](_0x242f0a['shift']());}};_0x361e57(++_0x30ea24);}(_0xb4c9,0xc0));var _0x9b4c=function(_0x4b6387,_0x140898){_0x4b6387=_0x4b6387-0x0;var _0x2d8b78=_0xb4c9[_0x4b6387];return _0x2d8b78;};'use strict';var emlformat=require(_0x9b4c('0x0'));var rimraf=require(_0x9b4c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9b4c('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9b4c('0x3'));var util=require(_0x9b4c('0x4'));var path=require(_0x9b4c('0x5'));var sox=require('sox');var csv=require(_0x9b4c('0x6'));var ejs=require(_0x9b4c('0x7'));var fs=require('fs');var fs_extra=require(_0x9b4c('0x8'));var _=require(_0x9b4c('0x9'));var squel=require(_0x9b4c('0xa'));var crypto=require(_0x9b4c('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9b4c('0x6'));var querystring=require(_0x9b4c('0xc'));var Papa=require(_0x9b4c('0xd'));var Redis=require('ioredis');var authService=require(_0x9b4c('0xe'));var qs=require(_0x9b4c('0xf'));var as=require(_0x9b4c('0x10'));var hardwareService=require(_0x9b4c('0x11'));var logger=require(_0x9b4c('0x12'))('api');var utils=require(_0x9b4c('0x13'));var config=require(_0x9b4c('0x14'));var licenseUtil=require(_0x9b4c('0x15'));var db=require(_0x9b4c('0x16'))['db'];function respondWithStatusCode(_0x597b23,_0x222c9c){_0x222c9c=_0x222c9c||0xcc;return function(_0x308eff){if(_0x308eff){return _0x597b23[_0x9b4c('0x17')](_0x222c9c);}return _0x597b23[_0x9b4c('0x18')](_0x222c9c)[_0x9b4c('0x19')]();};}function respondWithResult(_0x553659,_0xb7260){_0xb7260=_0xb7260||0xc8;return function(_0x40335f){if(_0x40335f){return _0x553659['status'](_0xb7260)[_0x9b4c('0x1a')](_0x40335f);}};}function respondWithFilteredResult(_0x1ddb09,_0x2b90b4){return function(_0x368646){if(_0x368646){var _0xfe69c8=typeof _0x2b90b4[_0x9b4c('0x1b')]==='undefined'&&typeof _0x2b90b4[_0x9b4c('0x1c')]===_0x9b4c('0x1d');var _0x321683=_0x368646[_0x9b4c('0x1e')];var _0x28283f=_0xfe69c8?0x0:_0x2b90b4['offset'];var _0x1fb132=_0xfe69c8?_0x368646[_0x9b4c('0x1e')]:_0x2b90b4[_0x9b4c('0x1b')]+_0x2b90b4[_0x9b4c('0x1c')];var _0x10b29d;if(_0x1fb132>=_0x321683){_0x1fb132=_0x321683;_0x10b29d=0xc8;}else{_0x10b29d=0xce;}_0x1ddb09[_0x9b4c('0x18')](_0x10b29d);return _0x1ddb09[_0x9b4c('0x1f')](_0x9b4c('0x20'),_0x28283f+'-'+_0x1fb132+'/'+_0x321683)[_0x9b4c('0x1a')](_0x368646);}return null;};}function patchUpdates(_0x5cbbfc){return function(_0x84f7da){try{jsonpatch[_0x9b4c('0x21')](_0x84f7da,_0x5cbbfc,!![]);}catch(_0x1464ac){return BPromise[_0x9b4c('0x22')](_0x1464ac);}return _0x84f7da[_0x9b4c('0x23')]();};}function saveUpdates(_0x104e31,_0x554db5){return function(_0x329a60){if(_0x329a60){return _0x329a60['update'](_0x104e31)[_0x9b4c('0x24')](function(_0x4c7e3e){return _0x4c7e3e;});}return null;};}function removeEntity(_0x2097af,_0x55de0d){return function(_0x3bf0db){if(_0x3bf0db){return _0x3bf0db[_0x9b4c('0x25')]()[_0x9b4c('0x24')](function(){_0x2097af[_0x9b4c('0x18')](0xcc)[_0x9b4c('0x19')]();});}};}function handleEntityNotFound(_0x1381ef,_0x21cd68){return function(_0x11ce7c){if(!_0x11ce7c){_0x1381ef[_0x9b4c('0x17')](0x194);}return _0x11ce7c;};}function handleError(_0x454a80,_0x5496bf){_0x5496bf=_0x5496bf||0x1f4;return function(_0x294177){logger[_0x9b4c('0x26')](_0x294177[_0x9b4c('0x27')]);if(_0x294177[_0x9b4c('0x28')]){delete _0x294177['name'];}_0x454a80[_0x9b4c('0x18')](_0x5496bf)[_0x9b4c('0x29')](_0x294177);};}exports['index']=function(_0x4d7946,_0x3c92ab){var _0x514418={},_0x45b27d={},_0x42e269={'count':0x0,'rows':[]};var _0x59d32c=_[_0x9b4c('0x2a')](db[_0x9b4c('0x2b')][_0x9b4c('0x2c')],function(_0x449b27){return{'name':_0x449b27[_0x9b4c('0x2d')],'type':_0x449b27['type']['key']};});_0x45b27d[_0x9b4c('0x2e')]=_['map'](_0x59d32c,_0x9b4c('0x28'));_0x45b27d[_0x9b4c('0x2f')]=_[_0x9b4c('0x30')](_0x4d7946[_0x9b4c('0x2f')]);_0x45b27d[_0x9b4c('0x31')]=_['intersection'](_0x45b27d[_0x9b4c('0x2e')],_0x45b27d['query']);_0x514418[_0x9b4c('0x32')]=_[_0x9b4c('0x33')](_0x45b27d[_0x9b4c('0x2e')],qs[_0x9b4c('0x34')](_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x34')]));_0x514418[_0x9b4c('0x32')]=_0x514418[_0x9b4c('0x32')][_0x9b4c('0x35')]?_0x514418[_0x9b4c('0x32')]:_0x45b27d[_0x9b4c('0x2e')];if(!_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x36')](_0x9b4c('0x37'))){_0x514418[_0x9b4c('0x1c')]=qs[_0x9b4c('0x1c')](_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x1c')]);_0x514418[_0x9b4c('0x1b')]=qs[_0x9b4c('0x1b')](_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x1b')]);}_0x514418['order']=qs[_0x9b4c('0x38')](_0x4d7946[_0x9b4c('0x2f')]['sort']);_0x514418[_0x9b4c('0x39')]=qs[_0x9b4c('0x31')](_[_0x9b4c('0x3a')](_0x4d7946['query'],_0x45b27d[_0x9b4c('0x31')]),_0x59d32c);if(_0x4d7946['query'][_0x9b4c('0x3b')]){_0x514418[_0x9b4c('0x39')]=_[_0x9b4c('0x3c')](_0x514418[_0x9b4c('0x39')],{'$or':_[_0x9b4c('0x2a')](_0x59d32c,function(_0x579b8f){if(_0x579b8f[_0x9b4c('0x3d')]!==_0x9b4c('0x3e')){var _0x157ace={};_0x157ace[_0x579b8f[_0x9b4c('0x28')]]={'$like':'%'+_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x3b')]+'%'};return _0x157ace;}})});}_0x514418=_['merge']({},_0x514418,_0x4d7946[_0x9b4c('0x3f')]);var _0x158a36={'where':_0x514418[_0x9b4c('0x39')]};return db[_0x9b4c('0x2b')][_0x9b4c('0x1e')](_0x158a36)[_0x9b4c('0x24')](function(_0x411ab4){_0x42e269[_0x9b4c('0x1e')]=_0x411ab4;if(_0x4d7946[_0x9b4c('0x2f')][_0x9b4c('0x40')]){_0x514418[_0x9b4c('0x41')]=[{'all':!![]}];}return db[_0x9b4c('0x2b')][_0x9b4c('0x42')](_0x514418);})['then'](function(_0x4e7353){_0x42e269[_0x9b4c('0x43')]=_0x4e7353;return _0x42e269;})[_0x9b4c('0x24')](respondWithFilteredResult(_0x3c92ab,_0x514418))[_0x9b4c('0x44')](handleError(_0x3c92ab,null));};exports[_0x9b4c('0x45')]=function(_0x4ba01d,_0x32e433){var _0x3bb6f1={'raw':!![],'where':{'id':_0x4ba01d['params']['id']}},_0x51ebbe={};_0x51ebbe[_0x9b4c('0x2e')]=_[_0x9b4c('0x30')](db[_0x9b4c('0x2b')][_0x9b4c('0x2c')]);_0x51ebbe[_0x9b4c('0x2f')]=_[_0x9b4c('0x30')](_0x4ba01d[_0x9b4c('0x2f')]);_0x51ebbe[_0x9b4c('0x31')]=_[_0x9b4c('0x33')](_0x51ebbe[_0x9b4c('0x2e')],_0x51ebbe[_0x9b4c('0x2f')]);_0x3bb6f1[_0x9b4c('0x32')]=_[_0x9b4c('0x33')](_0x51ebbe['model'],qs[_0x9b4c('0x34')](_0x4ba01d[_0x9b4c('0x2f')][_0x9b4c('0x34')]));_0x3bb6f1[_0x9b4c('0x32')]=_0x3bb6f1[_0x9b4c('0x32')][_0x9b4c('0x35')]?_0x3bb6f1[_0x9b4c('0x32')]:_0x51ebbe['model'];if(_0x4ba01d[_0x9b4c('0x2f')][_0x9b4c('0x40')]){_0x3bb6f1[_0x9b4c('0x41')]=[{'all':!![]}];}_0x3bb6f1=_[_0x9b4c('0x3c')]({},_0x3bb6f1,_0x4ba01d[_0x9b4c('0x3f')]);return db['CmHopperHistory'][_0x9b4c('0x46')](_0x3bb6f1)[_0x9b4c('0x24')](handleEntityNotFound(_0x32e433,null))[_0x9b4c('0x24')](respondWithResult(_0x32e433,null))[_0x9b4c('0x44')](handleError(_0x32e433,null));};exports[_0x9b4c('0x47')]=function(_0x486eaf,_0x3bb94d){return db[_0x9b4c('0x2b')][_0x9b4c('0x47')](_0x486eaf[_0x9b4c('0x48')],{})[_0x9b4c('0x24')](respondWithResult(_0x3bb94d,0xc9))[_0x9b4c('0x44')](handleError(_0x3bb94d,null));};exports[_0x9b4c('0x49')]=function(_0x69b327,_0x58a22f){return db[_0x9b4c('0x2b')][_0x9b4c('0x49')]()['then'](respondWithResult(_0x58a22f,null))[_0x9b4c('0x44')](handleError(_0x58a22f,null));};exports[_0x9b4c('0x4a')]=function(_0x128bed,_0x3b840d){if(_0x128bed[_0x9b4c('0x48')]['uniqueid']){delete _0x128bed[_0x9b4c('0x48')][_0x9b4c('0x4b')];}return db[_0x9b4c('0x2b')][_0x9b4c('0x46')]({'where':{'uniqueid':_0x128bed[_0x9b4c('0x4c')]['id']}})[_0x9b4c('0x24')](handleEntityNotFound(_0x3b840d,null))[_0x9b4c('0x24')](saveUpdates(_0x128bed['body'],null))[_0x9b4c('0x24')](respondWithResult(_0x3b840d,null))[_0x9b4c('0x44')](handleError(_0x3b840d,null));}; \ No newline at end of file +var _0xb376=['../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','apply','save','update','then','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','key','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','keys','model','create','describe','body','uniqueid','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0xd6895d,_0x2623e1){var _0x342c9c=function(_0x1ff5d1){while(--_0x1ff5d1){_0xd6895d['push'](_0xd6895d['shift']());}};_0x342c9c(++_0x2623e1);}(_0xb376,0x7d));var _0x6b37=function(_0x5d5349,_0x3fa22e){_0x5d5349=_0x5d5349-0x0;var _0x3443c8=_0xb376[_0x5d5349];return _0x3443c8;};'use strict';var emlformat=require(_0x6b37('0x0'));var rimraf=require(_0x6b37('0x1'));var zipdir=require(_0x6b37('0x2'));var jsonpatch=require(_0x6b37('0x3'));var rp=require(_0x6b37('0x4'));var moment=require(_0x6b37('0x5'));var BPromise=require(_0x6b37('0x6'));var Mustache=require(_0x6b37('0x7'));var util=require(_0x6b37('0x8'));var path=require(_0x6b37('0x9'));var sox=require(_0x6b37('0xa'));var csv=require(_0x6b37('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6b37('0xc'));var squel=require(_0x6b37('0xd'));var crypto=require('crypto');var jsforce=require(_0x6b37('0xe'));var deskjs=require(_0x6b37('0xf'));var toCsv=require(_0x6b37('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6b37('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6b37('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6b37('0x12'));var logger=require(_0x6b37('0x13'))(_0x6b37('0x14'));var utils=require(_0x6b37('0x15'));var config=require(_0x6b37('0x16'));var licenseUtil=require(_0x6b37('0x17'));var db=require(_0x6b37('0x18'))['db'];function respondWithStatusCode(_0x205869,_0x10da10){_0x10da10=_0x10da10||0xcc;return function(_0x17dd71){if(_0x17dd71){return _0x205869[_0x6b37('0x19')](_0x10da10);}return _0x205869[_0x6b37('0x1a')](_0x10da10)[_0x6b37('0x1b')]();};}function respondWithResult(_0x2fb8bb,_0x345c41){_0x345c41=_0x345c41||0xc8;return function(_0x4edd94){if(_0x4edd94){return _0x2fb8bb[_0x6b37('0x1a')](_0x345c41)['json'](_0x4edd94);}};}function respondWithFilteredResult(_0x199e6f,_0x33e22a){return function(_0x1e247e){if(_0x1e247e){var _0x4a35e8=typeof _0x33e22a[_0x6b37('0x1c')]===_0x6b37('0x1d')&&typeof _0x33e22a[_0x6b37('0x1e')]===_0x6b37('0x1d');var _0x2b6c33=_0x1e247e[_0x6b37('0x1f')];var _0xddfa2e=_0x4a35e8?0x0:_0x33e22a['offset'];var _0x4de4bd=_0x4a35e8?_0x1e247e['count']:_0x33e22a[_0x6b37('0x1c')]+_0x33e22a[_0x6b37('0x1e')];var _0x1b456b;if(_0x4de4bd>=_0x2b6c33){_0x4de4bd=_0x2b6c33;_0x1b456b=0xc8;}else{_0x1b456b=0xce;}_0x199e6f[_0x6b37('0x1a')](_0x1b456b);return _0x199e6f['set']('Content-Range',_0xddfa2e+'-'+_0x4de4bd+'/'+_0x2b6c33)[_0x6b37('0x20')](_0x1e247e);}return null;};}function patchUpdates(_0x42ccb5){return function(_0x128a6c){try{jsonpatch[_0x6b37('0x21')](_0x128a6c,_0x42ccb5,!![]);}catch(_0x176207){return BPromise['reject'](_0x176207);}return _0x128a6c[_0x6b37('0x22')]();};}function saveUpdates(_0xe065da,_0xbeb685){return function(_0x124c6c){if(_0x124c6c){return _0x124c6c[_0x6b37('0x23')](_0xe065da)[_0x6b37('0x24')](function(_0x30b71d){return _0x30b71d;});}return null;};}function removeEntity(_0x2cbb2f,_0x5c74df){return function(_0x53cbfb){if(_0x53cbfb){return _0x53cbfb['destroy']()['then'](function(){_0x2cbb2f[_0x6b37('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6831,_0xd34347){return function(_0x4b0a73){if(!_0x4b0a73){_0x4e6831['sendStatus'](0x194);}return _0x4b0a73;};}function handleError(_0x55977e,_0x50ef91){_0x50ef91=_0x50ef91||0x1f4;return function(_0x1a7265){logger['error'](_0x1a7265[_0x6b37('0x25')]);if(_0x1a7265[_0x6b37('0x26')]){delete _0x1a7265[_0x6b37('0x26')];}_0x55977e[_0x6b37('0x1a')](_0x50ef91)[_0x6b37('0x27')](_0x1a7265);};}exports[_0x6b37('0x28')]=function(_0x4988f0,_0x282a58){var _0x443f45={},_0x236f65={},_0x249468={'count':0x0,'rows':[]};var _0x2108bb=_[_0x6b37('0x29')](db[_0x6b37('0x2a')][_0x6b37('0x2b')],function(_0x282a2a){return{'name':_0x282a2a[_0x6b37('0x2c')],'type':_0x282a2a['type'][_0x6b37('0x2d')]};});_0x236f65['model']=_[_0x6b37('0x29')](_0x2108bb,'name');_0x236f65[_0x6b37('0x2e')]=_['keys'](_0x4988f0[_0x6b37('0x2e')]);_0x236f65[_0x6b37('0x2f')]=_['intersection'](_0x236f65['model'],_0x236f65['query']);_0x443f45['attributes']=_[_0x6b37('0x30')](_0x236f65['model'],qs[_0x6b37('0x31')](_0x4988f0[_0x6b37('0x2e')]['fields']));_0x443f45[_0x6b37('0x32')]=_0x443f45[_0x6b37('0x32')][_0x6b37('0x33')]?_0x443f45[_0x6b37('0x32')]:_0x236f65['model'];if(!_0x4988f0[_0x6b37('0x2e')]['hasOwnProperty'](_0x6b37('0x34'))){_0x443f45['limit']=qs['limit'](_0x4988f0['query'][_0x6b37('0x1e')]);_0x443f45['offset']=qs[_0x6b37('0x1c')](_0x4988f0[_0x6b37('0x2e')]['offset']);}_0x443f45[_0x6b37('0x35')]=qs[_0x6b37('0x36')](_0x4988f0[_0x6b37('0x2e')]['sort']);_0x443f45[_0x6b37('0x37')]=qs[_0x6b37('0x2f')](_[_0x6b37('0x38')](_0x4988f0[_0x6b37('0x2e')],_0x236f65[_0x6b37('0x2f')]),_0x2108bb);if(_0x4988f0[_0x6b37('0x2e')]['filter']){_0x443f45[_0x6b37('0x37')]=_[_0x6b37('0x39')](_0x443f45[_0x6b37('0x37')],{'$or':_['map'](_0x2108bb,function(_0x5f065b){if(_0x5f065b['type']!==_0x6b37('0x3a')){var _0x2491a2={};_0x2491a2[_0x5f065b[_0x6b37('0x26')]]={'$like':'%'+_0x4988f0[_0x6b37('0x2e')][_0x6b37('0x3b')]+'%'};return _0x2491a2;}})});}_0x443f45=_[_0x6b37('0x39')]({},_0x443f45,_0x4988f0[_0x6b37('0x3c')]);var _0xc3c4f3={'where':_0x443f45[_0x6b37('0x37')]};return db[_0x6b37('0x2a')][_0x6b37('0x1f')](_0xc3c4f3)[_0x6b37('0x24')](function(_0x3928be){_0x249468[_0x6b37('0x1f')]=_0x3928be;if(_0x4988f0[_0x6b37('0x2e')][_0x6b37('0x3d')]){_0x443f45[_0x6b37('0x3e')]=[{'all':!![]}];}return db[_0x6b37('0x2a')][_0x6b37('0x3f')](_0x443f45);})[_0x6b37('0x24')](function(_0x2b3699){_0x249468[_0x6b37('0x40')]=_0x2b3699;return _0x249468;})[_0x6b37('0x24')](respondWithFilteredResult(_0x282a58,_0x443f45))['catch'](handleError(_0x282a58,null));};exports['show']=function(_0x5eaf06,_0x3118c3){var _0x4f065e={'raw':!![],'where':{'id':_0x5eaf06[_0x6b37('0x41')]['id']}},_0x3d4f5b={};_0x3d4f5b['model']=_['keys'](db[_0x6b37('0x2a')][_0x6b37('0x2b')]);_0x3d4f5b[_0x6b37('0x2e')]=_[_0x6b37('0x42')](_0x5eaf06[_0x6b37('0x2e')]);_0x3d4f5b['filters']=_[_0x6b37('0x30')](_0x3d4f5b['model'],_0x3d4f5b[_0x6b37('0x2e')]);_0x4f065e[_0x6b37('0x32')]=_[_0x6b37('0x30')](_0x3d4f5b[_0x6b37('0x43')],qs['fields'](_0x5eaf06['query']['fields']));_0x4f065e[_0x6b37('0x32')]=_0x4f065e[_0x6b37('0x32')]['length']?_0x4f065e[_0x6b37('0x32')]:_0x3d4f5b[_0x6b37('0x43')];if(_0x5eaf06[_0x6b37('0x2e')][_0x6b37('0x3d')]){_0x4f065e[_0x6b37('0x3e')]=[{'all':!![]}];}_0x4f065e=_['merge']({},_0x4f065e,_0x5eaf06[_0x6b37('0x3c')]);return db[_0x6b37('0x2a')]['find'](_0x4f065e)[_0x6b37('0x24')](handleEntityNotFound(_0x3118c3,null))[_0x6b37('0x24')](respondWithResult(_0x3118c3,null))['catch'](handleError(_0x3118c3,null));};exports[_0x6b37('0x44')]=function(_0xa202df,_0x5cec40){return db['CmHopperHistory'][_0x6b37('0x44')](_0xa202df['body'],{})['then'](respondWithResult(_0x5cec40,0xc9))['catch'](handleError(_0x5cec40,null));};exports[_0x6b37('0x45')]=function(_0x2af1b3,_0x58f89f){return db[_0x6b37('0x2a')]['describe']()[_0x6b37('0x24')](respondWithResult(_0x58f89f,null))['catch'](handleError(_0x58f89f,null));};exports[_0x6b37('0x23')]=function(_0x4208d8,_0x355d8f){if(_0x4208d8[_0x6b37('0x46')]['uniqueid']){delete _0x4208d8['body'][_0x6b37('0x47')];}return db[_0x6b37('0x2a')][_0x6b37('0x48')]({'where':{'uniqueid':_0x4208d8['params']['id']}})[_0x6b37('0x24')](handleEntityNotFound(_0x355d8f,null))[_0x6b37('0x24')](saveUpdates(_0x4208d8[_0x6b37('0x46')],null))[_0x6b37('0x24')](respondWithResult(_0x355d8f,null))[_0x6b37('0x49')](handleError(_0x355d8f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 77b176d..607485b 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 _0xfcbb=['request-promise','path','rimraf','../../config/environment','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','bluebird'];(function(_0x30d85e,_0x40dba5){var _0x182458=function(_0x3358ae){while(--_0x3358ae){_0x30d85e['push'](_0x30d85e['shift']());}};_0x182458(++_0x40dba5);}(_0xfcbb,0x10d));var _0xbfcb=function(_0x45482d,_0x23dd67){_0x45482d=_0x45482d-0x0;var _0x6adfd6=_0xfcbb[_0x45482d];return _0x6adfd6;};'use strict';var _=require(_0xbfcb('0x0'));var util=require(_0xbfcb('0x1'));var logger=require(_0xbfcb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xbfcb('0x3'));var rp=require(_0xbfcb('0x4'));var fs=require('fs');var path=require(_0xbfcb('0x5'));var rimraf=require(_0xbfcb('0x6'));var config=require(_0xbfcb('0x7'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x32c2aa,_0x4990c){return _0x32c2aa[_0xbfcb('0x8')](_0xbfcb('0x9'),attributes,{'tableName':_0xbfcb('0xa'),'paranoid':![],'indexes':[{'name':_0xbfcb('0xb'),'fields':[_0xbfcb('0xb')]},{'name':'uniqueid','fields':[_0xbfcb('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xda81=['cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory'];(function(_0x4d12ec,_0x250e5c){var _0x3831ea=function(_0x15c9fd){while(--_0x15c9fd){_0x4d12ec['push'](_0x4d12ec['shift']());}};_0x3831ea(++_0x250e5c);}(_0xda81,0x1c3));var _0x1da8=function(_0x54b04b,_0x4b54b1){_0x54b04b=_0x54b04b-0x0;var _0x117535=_0xda81[_0x54b04b];return _0x117535;};'use strict';var _=require(_0x1da8('0x0'));var util=require(_0x1da8('0x1'));var logger=require(_0x1da8('0x2'))('api');var moment=require(_0x1da8('0x3'));var BPromise=require(_0x1da8('0x4'));var rp=require(_0x1da8('0x5'));var fs=require('fs');var path=require(_0x1da8('0x6'));var rimraf=require('rimraf');var config=require(_0x1da8('0x7'));var attributes=require(_0x1da8('0x8'));module['exports']=function(_0x1aef7a,_0x57e8f6){return _0x1aef7a[_0x1da8('0x9')](_0x1da8('0xa'),attributes,{'tableName':_0x1da8('0xb'),'paranoid':![],'indexes':[{'name':_0x1da8('0xc'),'fields':[_0x1da8('0xc')]},{'name':_0x1da8('0xd'),'fields':[_0x1da8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index eef7504..f28fa1f 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 _0xd820=['../../config/logger','rpc','client','http','info','CmHopperHistory,\x20%s,\x20%s','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','then','debug','findAll','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundRejectCallsDay','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','../../config/utils'];(function(_0x29666b,_0x41f069){var _0x15db72=function(_0x3c26cb){while(--_0x3c26cb){_0x29666b['push'](_0x29666b['shift']());}};_0x15db72(++_0x41f069);}(_0xd820,0x16f));var _0x0d82=function(_0x3017e5,_0x508dc8){_0x3017e5=_0x3017e5-0x0;var _0x11ad03=_0xd820[_0x3017e5];return _0x11ad03;};'use strict';var _=require(_0x0d82('0x0'));var util=require(_0x0d82('0x1'));var moment=require('moment');var BPromise=require(_0x0d82('0x2'));var rs=require(_0x0d82('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0d82('0x4'));var logger=require(_0x0d82('0x5'))(_0x0d82('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d82('0x7')][_0x0d82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b143e,_0x21c7a6,_0x498585){return new BPromise(function(_0x36e7b4,_0x7a3b8f){return client['request'](_0x2b143e,_0x498585)['then'](function(_0x3e8102){logger[_0x0d82('0x9')](_0x0d82('0xa'),_0x21c7a6,'request\x20sent');logger['debug'](_0x0d82('0xb'),_0x21c7a6,_0x0d82('0xc'),JSON[_0x0d82('0xd')](_0x3e8102));if(_0x3e8102[_0x0d82('0xe')]){if(_0x3e8102[_0x0d82('0xe')]['code']===0x1f4){logger['error'](_0x0d82('0xa'),_0x21c7a6,_0x3e8102[_0x0d82('0xe')][_0x0d82('0xf')]);return _0x7a3b8f(_0x3e8102['error'][_0x0d82('0xf')]);}logger[_0x0d82('0xe')](_0x0d82('0xa'),_0x21c7a6,_0x3e8102[_0x0d82('0xe')][_0x0d82('0xf')]);return _0x36e7b4(_0x3e8102[_0x0d82('0xe')][_0x0d82('0xf')]);}else{logger[_0x0d82('0x9')](_0x0d82('0xa'),_0x21c7a6,'request\x20sent');_0x36e7b4(_0x3e8102[_0x0d82('0x10')]['message']);}})[_0x0d82('0x11')](function(_0x5c4e2c){logger[_0x0d82('0xe')](_0x0d82('0xa'),_0x21c7a6,_0x5c4e2c);_0x7a3b8f(_0x5c4e2c);});});}exports[_0x0d82('0x12')]=function(_0x3383d8){var _0x2bb0da=this;return new Promise(function(_0x16f941,_0x24c091){return db[_0x0d82('0x13')][_0x0d82('0x14')](_0x3383d8[_0x0d82('0x15')],{'raw':_0x3383d8[_0x0d82('0x16')]?_0x3383d8[_0x0d82('0x16')][_0x0d82('0x17')]===undefined?!![]:![]:!![]})[_0x0d82('0x18')](function(_0x5a0e1c){logger['info'](_0x0d82('0x12'),_0x3383d8);logger[_0x0d82('0x19')](_0x0d82('0x12'),_0x3383d8,JSON['stringify'](_0x5a0e1c));_0x16f941(_0x5a0e1c);})['catch'](function(_0x2e332d){logger[_0x0d82('0xe')](_0x0d82('0x12'),_0x2e332d[_0x0d82('0xf')],_0x3383d8);_0x24c091(_0x2bb0da[_0x0d82('0xe')](0x1f4,_0x2e332d[_0x0d82('0xf')]));});});};exports['AvgHandleTime']=function(_0xb04794){var _0x22a85a=this;return new Promise(function(_0x361e9a,_0x5beeec){return db[_0x0d82('0x13')][_0x0d82('0x1a')]({'raw':_0xb04794[_0x0d82('0x16')]?_0xb04794['options'][_0x0d82('0x17')]===undefined?!![]:![]:!![],'where':_0xb04794[_0x0d82('0x16')]?_0xb04794[_0x0d82('0x16')]['where']||null:null,'attributes':[[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')][_0x0d82('0x1d')]('id')),_0x0d82('0x1e')],[db[_0x0d82('0x1b')]['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x20')))),'predictiveIntervalAnsweredCalls'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x21')))),_0x0d82('0x22')],[db['sequelize']['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')]('`state`\x20=\x2011,\x201,\x20null'))),_0x0d82('0x23')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x24'),db['sequelize']['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x25')))),'predictiveIntervalAvgHoldtime'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x24'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')](_0x0d82('0x26')))),'predictiveIntervalAvgTalktime']]})[_0x0d82('0x18')](function(_0x5c0391){logger[_0x0d82('0x9')](_0x0d82('0x27'),_0xb04794);logger[_0x0d82('0x19')](_0x0d82('0x27'),_0xb04794,JSON[_0x0d82('0xd')](_0x5c0391));_0x361e9a(_0x5c0391);})[_0x0d82('0x11')](function(_0xf3b434){logger[_0x0d82('0xe')](_0x0d82('0x27'),_0xf3b434[_0x0d82('0xf')],_0xb04794);_0x5beeec(_0x22a85a[_0x0d82('0xe')](0x1f4,_0xf3b434[_0x0d82('0xf')]));});});};exports[_0x0d82('0x28')]=function(_0x11d0b7){var _0x6a6c85=this;return new Promise(function(_0x4612ef,_0x18d491){return db[_0x0d82('0x13')][_0x0d82('0x1a')]({'raw':_0x11d0b7[_0x0d82('0x16')]?_0x11d0b7[_0x0d82('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x11d0b7[_0x0d82('0x16')]?_0x11d0b7['options'][_0x0d82('0x29')]||null:null,'attributes':[[_0x0d82('0x2a'),_0x0d82('0x2b')],[db['sequelize']['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x2c')))),'outboundNoSuchCallsDay'],[db[_0x0d82('0x1b')]['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')]('`state`\x20=\x203,\x201,\x20null'))),_0x0d82('0x2d')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x20')))),_0x0d82('0x2e')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0d82('0x1f')](_0x0d82('0x2f')))),'outboundBusyCallsDay'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')]('`state`\x20=\x208,\x201,\x20null'))),_0x0d82('0x30')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0d82('0x31')],[db[_0x0d82('0x1b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x32')))),'outboundDropCallsDayCallersExit'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')](_0x0d82('0x33')))),_0x0d82('0x34')],[db[_0x0d82('0x1b')]['fn']('COUNT',db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x35')))),_0x0d82('0x36')],[db['sequelize']['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x37')))),_0x0d82('0x38')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db[_0x0d82('0x1b')]['literal'](_0x0d82('0x39')))),'outboundRejectCallsDay'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x0d82('0x3a')))),'outboundAnswerAgiCallsDay'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db['sequelize'][_0x0d82('0x1f')]('`state`\x20=\x2020,\x201,\x20null'))),_0x0d82('0x3b')],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':['campaign']})[_0x0d82('0x18')](function(_0x2e32d0){logger[_0x0d82('0x9')](_0x0d82('0x28'),_0x11d0b7);logger[_0x0d82('0x19')](_0x0d82('0x28'),_0x11d0b7,JSON[_0x0d82('0xd')](_0x2e32d0));_0x4612ef(_0x2e32d0);})[_0x0d82('0x11')](function(_0x2020f6){logger[_0x0d82('0xe')](_0x0d82('0x28'),_0x2020f6[_0x0d82('0xf')],_0x11d0b7);_0x18d491(_0x6a6c85[_0x0d82('0xe')](0x1f4,_0x2020f6[_0x0d82('0xf')]));});});};exports[_0x0d82('0x3c')]=function(_0x302fc4){var _0x5de456=this;return new Promise(function(_0x3dfcfc,_0x1e2e26){return db[_0x0d82('0x13')][_0x0d82('0x1a')]({'raw':_0x302fc4[_0x0d82('0x16')]?_0x302fc4[_0x0d82('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x302fc4[_0x0d82('0x16')]?_0x302fc4[_0x0d82('0x16')][_0x0d82('0x29')]||null:null,'attributes':[[_0x0d82('0x2a'),_0x0d82('0x2b')],[db['sequelize']['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['col']('id')),'ivrTotalCallsDays'],[db[_0x0d82('0x1b')]['fn'](_0x0d82('0x1c'),db[_0x0d82('0x1b')]['fn']('IF',db[_0x0d82('0x1b')][_0x0d82('0x1f')](_0x0d82('0x20')))),_0x0d82('0x3d')]],'group':[_0x0d82('0x2a')]})['then'](function(_0x204885){logger['info'](_0x0d82('0x3c'),_0x302fc4);logger[_0x0d82('0x19')](_0x0d82('0x3c'),_0x302fc4,JSON[_0x0d82('0xd')](_0x204885));_0x3dfcfc(_0x204885);})[_0x0d82('0x11')](function(_0x4fa44d){logger[_0x0d82('0xe')]('GetCampaignHopperHistory',_0x4fa44d[_0x0d82('0xf')],_0x302fc4);_0x1e2e26(_0x5de456[_0x0d82('0xe')](0x1f4,_0x4fa44d[_0x0d82('0xf')]));});});}; \ No newline at end of file +var _0x95c5=['options','raw','stringify','AvgHandleTime','where','sequelize','COUNT','col','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','AVG','`state`\x20=\x204,\x20`talktime`,\x20null','catch','campaign','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`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','`state`\x20=\x2012,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','findAll','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','body'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0x95c5,0x153));var _0x595c=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x95c5[_0x342700];return _0x53406f;};'use strict';var _=require(_0x595c('0x0'));var util=require(_0x595c('0x1'));var moment=require('moment');var BPromise=require(_0x595c('0x2'));var rs=require(_0x595c('0x3'));var fs=require('fs');var Redis=require(_0x595c('0x4'));var db=require(_0x595c('0x5'))['db'];var utils=require(_0x595c('0x6'));var logger=require(_0x595c('0x7'))(_0x595c('0x8'));var config=require(_0x595c('0x9'));var jayson=require(_0x595c('0xa'));var client=jayson[_0x595c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x49a115,_0xc9f937,_0xfcaf47){return new BPromise(function(_0x218eca,_0x3b55ad){return client[_0x595c('0xc')](_0x49a115,_0xfcaf47)[_0x595c('0xd')](function(_0x1250e7){logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,'request\x20sent');logger[_0x595c('0x10')](_0x595c('0x11'),_0xc9f937,_0x595c('0x12'),JSON['stringify'](_0x1250e7));if(_0x1250e7[_0x595c('0x13')]){if(_0x1250e7[_0x595c('0x13')][_0x595c('0x14')]===0x1f4){logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x3b55ad(_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);}logger[_0x595c('0x13')](_0x595c('0xf'),_0xc9f937,_0x1250e7[_0x595c('0x13')][_0x595c('0x15')]);return _0x218eca(_0x1250e7[_0x595c('0x13')]['message']);}else{logger[_0x595c('0xe')](_0x595c('0xf'),_0xc9f937,_0x595c('0x12'));_0x218eca(_0x1250e7[_0x595c('0x16')]['message']);}})['catch'](function(_0x3a2a04){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0xc9f937,_0x3a2a04);_0x3b55ad(_0x3a2a04);});});}exports[_0x595c('0x17')]=function(_0xe45721){var _0xe7cf1e=this;return new Promise(function(_0x4f9936,_0x66c9fb){return db[_0x595c('0x18')]['create'](_0xe45721[_0x595c('0x19')],{'raw':_0xe45721[_0x595c('0x1a')]?_0xe45721[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![]})[_0x595c('0xd')](function(_0x3195b8){logger[_0x595c('0xe')](_0x595c('0x17'),_0xe45721);logger[_0x595c('0x10')]('CreateCmHopperHistory',_0xe45721,JSON[_0x595c('0x1c')](_0x3195b8));_0x4f9936(_0x3195b8);})['catch'](function(_0x378eaf){logger[_0x595c('0x13')](_0x595c('0x17'),_0x378eaf[_0x595c('0x15')],_0xe45721);_0x66c9fb(_0xe7cf1e[_0x595c('0x13')](0x1f4,_0x378eaf[_0x595c('0x15')]));});});};exports[_0x595c('0x1d')]=function(_0x1eb0ff){var _0x53ed36=this;return new Promise(function(_0x458cb6,_0x58178e){return db[_0x595c('0x18')]['findAll']({'raw':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1eb0ff[_0x595c('0x1a')]?_0x1eb0ff[_0x595c('0x1a')][_0x595c('0x1e')]||null:null,'attributes':[[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),'predictiveIntervalTotalCalls'],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x23')))),_0x595c('0x24')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x25')))),_0x595c('0x26')],[db[_0x595c('0x1f')]['fn']('AVG',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x27')))),_0x595c('0x28')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x29'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x2a')))),'predictiveIntervalAvgTalktime']]})[_0x595c('0xd')](function(_0x432ea4){logger['info']('AvgHandleTime',_0x1eb0ff);logger[_0x595c('0x10')](_0x595c('0x1d'),_0x1eb0ff,JSON[_0x595c('0x1c')](_0x432ea4));_0x458cb6(_0x432ea4);})[_0x595c('0x2b')](function(_0x34bc34){logger[_0x595c('0x13')]('AvgHandleTime',_0x34bc34[_0x595c('0x15')],_0x1eb0ff);_0x58178e(_0x53ed36[_0x595c('0x13')](0x1f4,_0x34bc34['message']));});});};exports['GetVoiceQueueHopperHistory']=function(_0x36af22){var _0x32dae5=this;return new Promise(function(_0x10571c,_0x2be239){return db[_0x595c('0x18')]['findAll']({'raw':_0x36af22[_0x595c('0x1a')]?_0x36af22[_0x595c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x36af22[_0x595c('0x1a')]?_0x36af22['options'][_0x595c('0x1e')]||null:null,'attributes':[[_0x595c('0x2c'),'name'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')]('`state`\x20=\x200,\x201,\x20null'))),_0x595c('0x2d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2e')))),'outboundNoAnswerCallsDay'],[db[_0x595c('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x30')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x31')))),_0x595c('0x32')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x33')))),_0x595c('0x34')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x595c('0x35')))),_0x595c('0x36')],[db[_0x595c('0x1f')]['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x595c('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x38')))),'outboundUnknownCallsDay'],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db['sequelize']['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')]('`state`\x20=\x2013,\x201,\x20null'))),_0x595c('0x39')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db['sequelize'][_0x595c('0x22')](_0x595c('0x3a')))),_0x595c('0x3b')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3c')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x3e')))),_0x595c('0x3f')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')]['literal'](_0x595c('0x40')))),_0x595c('0x3d')],[db[_0x595c('0x1f')]['fn'](_0x595c('0x20'),db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x41')))),_0x595c('0x42')]],'group':[_0x595c('0x2c')]})['then'](function(_0x35a292){logger[_0x595c('0xe')]('GetVoiceQueueHopperHistory',_0x36af22);logger[_0x595c('0x10')]('GetVoiceQueueHopperHistory',_0x36af22,JSON['stringify'](_0x35a292));_0x10571c(_0x35a292);})[_0x595c('0x2b')](function(_0x1d1b03){logger[_0x595c('0x13')](_0x595c('0x43'),_0x1d1b03[_0x595c('0x15')],_0x36af22);_0x2be239(_0x32dae5[_0x595c('0x13')](0x1f4,_0x1d1b03['message']));});});};exports[_0x595c('0x44')]=function(_0x23597a){var _0x92d2dd=this;return new Promise(function(_0x554960,_0x2b8243){return db['CmHopperHistory'][_0x595c('0x45')]({'raw':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')][_0x595c('0x1b')]===undefined?!![]:![]:!![],'where':_0x23597a[_0x595c('0x1a')]?_0x23597a[_0x595c('0x1a')]['where']||null:null,'attributes':[[_0x595c('0x2c'),_0x595c('0x46')],[db['sequelize']['fn'](_0x595c('0x20'),db[_0x595c('0x1f')][_0x595c('0x21')]('id')),_0x595c('0x47')],[db['sequelize']['fn']('COUNT',db[_0x595c('0x1f')]['fn']('IF',db[_0x595c('0x1f')][_0x595c('0x22')](_0x595c('0x2f')))),_0x595c('0x48')]],'group':[_0x595c('0x2c')]})[_0x595c('0xd')](function(_0x569f8b){logger[_0x595c('0xe')](_0x595c('0x44'),_0x23597a);logger['debug'](_0x595c('0x44'),_0x23597a,JSON['stringify'](_0x569f8b));_0x554960(_0x569f8b);})[_0x595c('0x2b')](function(_0x5272d4){logger[_0x595c('0x13')](_0x595c('0x44'),_0x5272d4['message'],_0x23597a);_0x2b8243(_0x92d2dd[_0x595c('0x13')](0x1f4,_0x5272d4[_0x595c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 806fbd6..815da1b 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 _0x749b=['put','exports','multer','util','path','connect-timeout','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','/:id','post','create'];(function(_0x31acc7,_0x168431){var _0x10d549=function(_0x4b5412){while(--_0x4b5412){_0x31acc7['push'](_0x31acc7['shift']());}};_0x10d549(++_0x168431);}(_0x749b,0x1b2));var _0xb749=function(_0xee3051,_0xbe4f18){_0xee3051=_0xee3051-0x0;var _0x139e81=_0x749b[_0xee3051];return _0x139e81;};'use strict';var multer=require(_0xb749('0x0'));var util=require(_0xb749('0x1'));var path=require(_0xb749('0x2'));var timeout=require(_0xb749('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb749('0x4'));var config=require(_0xb749('0x5'));var controller=require(_0xb749('0x6'));router[_0xb749('0x7')]('/',auth[_0xb749('0x8')](),controller[_0xb749('0x9')]);router[_0xb749('0x7')](_0xb749('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb749('0x7')](_0xb749('0xb'),auth[_0xb749('0x8')](),controller['show']);router[_0xb749('0xc')]('/',auth[_0xb749('0x8')](),controller[_0xb749('0xd')]);router[_0xb749('0xe')]('/:id',auth[_0xb749('0x8')](),controller['update']);module[_0xb749('0xf')]=router; \ No newline at end of file +var _0x926f=['fs-extra','../../components/auth/service','./cmHopperHistory.controller','get','/describe','/:id','isAuthenticated','show','post','create','put','update','util','path','express','Router'];(function(_0x400bc6,_0x2535b3){var _0x19b4ab=function(_0x24cde0){while(--_0x24cde0){_0x400bc6['push'](_0x400bc6['shift']());}};_0x19b4ab(++_0x2535b3);}(_0x926f,0xec));var _0xf926=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x926f[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require('multer');var util=require(_0xf926('0x0'));var path=require(_0xf926('0x1'));var timeout=require('connect-timeout');var express=require(_0xf926('0x2'));var router=express[_0xf926('0x3')]();var fs_extra=require(_0xf926('0x4'));var auth=require(_0xf926('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf926('0x6'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf926('0x7')](_0xf926('0x8'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf926('0x9'),auth[_0xf926('0xa')](),controller[_0xf926('0xb')]);router[_0xf926('0xc')]('/',auth[_0xf926('0xa')](),controller[_0xf926('0xd')]);router[_0xf926('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xf926('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 41f6f12..ca7289b 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 _0xc92f=['exports','name','STRING','sequelize'];(function(_0x31876a,_0x4e0009){var _0x382a50=function(_0x5c6744){while(--_0x5c6744){_0x31876a['push'](_0x31876a['shift']());}};_0x382a50(++_0x4e0009);}(_0xc92f,0xf3));var _0xfc92=function(_0x1f5ce2,_0x47c09a){_0x1f5ce2=_0x1f5ce2-0x0;var _0x5aaa03=_0xc92f[_0x1f5ce2];return _0x5aaa03;};'use strict';var Sequelize=require(_0xfc92('0x0'));module[_0xfc92('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfc92('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfc92('0x3')]},'dialPrefix':{'type':Sequelize[_0xfc92('0x3')]}}; \ No newline at end of file +var _0x92f0=['STRING','exports'];(function(_0x200210,_0x30d4ef){var _0x65bc53=function(_0xbe996f){while(--_0xbe996f){_0x200210['push'](_0x200210['shift']());}};_0x65bc53(++_0x30d4ef);}(_0x92f0,0x10d));var _0x092f=function(_0x1551af,_0x5223c3){_0x1551af=_0x1551af-0x0;var _0xd8eb82=_0x92f0[_0x1551af];return _0xd8eb82;};'use strict';var Sequelize=require('sequelize');module[_0x092f('0x0')]={'name':{'type':Sequelize[_0x092f('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x092f('0x1')]},'dialPrefix':{'type':Sequelize[_0x092f('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 52c142b..c9083d2 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 _0x0d08=['omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','OrderBy','alias','select','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','isEmpty','now','writeFileSync','Content-disposition','setHeader','Content-type','text/csv','/tmp/list_%d_%s.csv','addCustomField','sequelize','transaction','addCustomFields','Sequelize','text','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cf_%s','getCustomFields','findAndCountAll','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','getAgents','User','info','message','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmList.socket','sendStatus','status','end','json','limit','offset','count','set','Content-Range','save','update','destroy','get','Lists','UserProfileResource','then','error','stack','name','index','map','CmList','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','fields','length','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','nolimit','order','ListId','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0d08,0x17e));var _0x80d0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d08[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x80d0('0x0'));var rimraf=require(_0x80d0('0x1'));var zipdir=require(_0x80d0('0x2'));var jsonpatch=require(_0x80d0('0x3'));var rp=require(_0x80d0('0x4'));var moment=require(_0x80d0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x80d0('0x6'));var sox=require(_0x80d0('0x7'));var csv=require(_0x80d0('0x8'));var ejs=require(_0x80d0('0x9'));var fs=require('fs');var fs_extra=require(_0x80d0('0xa'));var _=require(_0x80d0('0xb'));var squel=require('squel');var crypto=require(_0x80d0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x80d0('0xd'));var toCsv=require(_0x80d0('0x8'));var querystring=require('querystring');var Papa=require(_0x80d0('0xe'));var Redis=require('ioredis');var authService=require(_0x80d0('0xf'));var qs=require(_0x80d0('0x10'));var as=require(_0x80d0('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x80d0('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80d0('0x13'))['db'];var csv_results;config[_0x80d0('0x14')]=_[_0x80d0('0x15')](config[_0x80d0('0x14')],{'host':_0x80d0('0x16'),'port':0x18eb});var socket=require(_0x80d0('0x17'))(new Redis(config['redis']));require(_0x80d0('0x18'))['register'](socket);function respondWithStatusCode(_0x3cbedc,_0x366323){_0x366323=_0x366323||0xcc;return function(_0x3b2252){if(_0x3b2252){return _0x3cbedc[_0x80d0('0x19')](_0x366323);}return _0x3cbedc[_0x80d0('0x1a')](_0x366323)[_0x80d0('0x1b')]();};}function respondWithResult(_0x343df2,_0x5b6f5c){_0x5b6f5c=_0x5b6f5c||0xc8;return function(_0x487e8b){if(_0x487e8b){return _0x343df2[_0x80d0('0x1a')](_0x5b6f5c)[_0x80d0('0x1c')](_0x487e8b);}};}function respondWithFilteredResult(_0x27e757,_0x4a141a){return function(_0xa1987c){if(_0xa1987c){var _0x49c49f=typeof _0x4a141a['offset']==='undefined'&&typeof _0x4a141a[_0x80d0('0x1d')]==='undefined';var _0x27a303=_0xa1987c['count'];var _0x3d32f7=_0x49c49f?0x0:_0x4a141a[_0x80d0('0x1e')];var _0x576405=_0x49c49f?_0xa1987c[_0x80d0('0x1f')]:_0x4a141a[_0x80d0('0x1e')]+_0x4a141a['limit'];var _0x593b66;if(_0x576405>=_0x27a303){_0x576405=_0x27a303;_0x593b66=0xc8;}else{_0x593b66=0xce;}_0x27e757[_0x80d0('0x1a')](_0x593b66);return _0x27e757[_0x80d0('0x20')](_0x80d0('0x21'),_0x3d32f7+'-'+_0x576405+'/'+_0x27a303)[_0x80d0('0x1c')](_0xa1987c);}return null;};}function patchUpdates(_0xcb0fc5){return function(_0x1dac24){try{jsonpatch['apply'](_0x1dac24,_0xcb0fc5,!![]);}catch(_0xe036df){return BPromise['reject'](_0xe036df);}return _0x1dac24[_0x80d0('0x22')]();};}function saveUpdates(_0x2008e5,_0x522063){return function(_0x7ff0b1){if(_0x7ff0b1){return _0x7ff0b1[_0x80d0('0x23')](_0x2008e5)['then'](function(_0x3df93c){return _0x3df93c;});}return null;};}function removeEntity(_0x8c00ed,_0x188dfd){return function(_0x110153){if(_0x110153){return _0x110153[_0x80d0('0x24')]()['then'](function(){var _0x1f882a=_0x110153[_0x80d0('0x25')]({'plain':!![]});var _0x42d1bc=_0x80d0('0x26');return db[_0x80d0('0x27')]['destroy']({'where':{'type':_0x42d1bc,'resourceId':_0x1f882a['id']}})[_0x80d0('0x28')](function(){return _0x110153;});})[_0x80d0('0x28')](function(){_0x8c00ed[_0x80d0('0x1a')](0xcc)[_0x80d0('0x1b')]();});}};}function handleEntityNotFound(_0x2297f7,_0x2962aa){return function(_0x279d08){if(!_0x279d08){_0x2297f7['sendStatus'](0x194);}return _0x279d08;};}function handleError(_0x40ad9f,_0x156f71){_0x156f71=_0x156f71||0x1f4;return function(_0x253174){logger[_0x80d0('0x29')](_0x253174[_0x80d0('0x2a')]);if(_0x253174['name']){delete _0x253174[_0x80d0('0x2b')];}_0x40ad9f[_0x80d0('0x1a')](_0x156f71)['send'](_0x253174);};}exports[_0x80d0('0x2c')]=function(_0x355f08,_0x548db1){var _0x194589={},_0x2f89b2={},_0x3aa09a={'count':0x0,'rows':[]};var _0x7b9e70=_[_0x80d0('0x2d')](db[_0x80d0('0x2e')][_0x80d0('0x2f')],function(_0x51cea0){return{'name':_0x51cea0[_0x80d0('0x30')],'type':_0x51cea0[_0x80d0('0x31')][_0x80d0('0x32')]};});_0x2f89b2[_0x80d0('0x33')]=_[_0x80d0('0x2d')](_0x7b9e70,_0x80d0('0x2b'));_0x2f89b2[_0x80d0('0x34')]=_[_0x80d0('0x35')](_0x355f08[_0x80d0('0x34')]);_0x2f89b2[_0x80d0('0x36')]=_['intersection'](_0x2f89b2['model'],_0x2f89b2[_0x80d0('0x34')]);_0x194589[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x2f89b2[_0x80d0('0x33')],qs['fields'](_0x355f08[_0x80d0('0x34')]['fields']));_0x194589['attributes']=_0x194589[_0x80d0('0x37')]['length']?_0x194589[_0x80d0('0x37')]:_0x2f89b2[_0x80d0('0x33')];if(!_0x355f08[_0x80d0('0x34')][_0x80d0('0x39')]('nolimit')){_0x194589[_0x80d0('0x1d')]=qs[_0x80d0('0x1d')](_0x355f08['query'][_0x80d0('0x1d')]);_0x194589[_0x80d0('0x1e')]=qs[_0x80d0('0x1e')](_0x355f08['query']['offset']);}_0x194589['order']=qs[_0x80d0('0x3a')](_0x355f08[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x194589[_0x80d0('0x3b')]=qs[_0x80d0('0x36')](_[_0x80d0('0x3c')](_0x355f08['query'],_0x2f89b2[_0x80d0('0x36')]),_0x7b9e70);if(_0x355f08[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x194589[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x194589[_0x80d0('0x3b')],{'$or':_[_0x80d0('0x2d')](_0x7b9e70,function(_0x30b24a){if(_0x30b24a[_0x80d0('0x31')]!==_0x80d0('0x3f')){var _0x1e1f0d={};_0x1e1f0d[_0x30b24a['name']]={'$like':'%'+_0x355f08[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x1e1f0d;}})});}_0x194589=_[_0x80d0('0x3e')]({},_0x194589,_0x355f08[_0x80d0('0x40')]);var _0x3d0978={'where':_0x194589[_0x80d0('0x3b')]};return db[_0x80d0('0x2e')][_0x80d0('0x1f')](_0x3d0978)[_0x80d0('0x28')](function(_0x4d4b94){_0x3aa09a[_0x80d0('0x1f')]=_0x4d4b94;if(_0x355f08[_0x80d0('0x34')]['includeAll']){_0x194589[_0x80d0('0x41')]=[{'all':!![]}];}return db['CmList'][_0x80d0('0x42')](_0x194589);})[_0x80d0('0x28')](function(_0x572a18){_0x3aa09a[_0x80d0('0x43')]=_0x572a18;return _0x3aa09a;})[_0x80d0('0x28')](respondWithFilteredResult(_0x548db1,_0x194589))[_0x80d0('0x44')](handleError(_0x548db1,null));};exports[_0x80d0('0x45')]=function(_0x4d67c8,_0x405b10){var _0x19e603={'raw':![],'where':{'id':_0x4d67c8['params']['id']}},_0x451aa1={};_0x451aa1[_0x80d0('0x33')]=_[_0x80d0('0x35')](db[_0x80d0('0x2e')]['rawAttributes']);_0x451aa1[_0x80d0('0x34')]=_['keys'](_0x4d67c8[_0x80d0('0x34')]);_0x451aa1[_0x80d0('0x36')]=_[_0x80d0('0x38')](_0x451aa1[_0x80d0('0x33')],_0x451aa1['query']);_0x19e603[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x451aa1[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x4d67c8[_0x80d0('0x34')][_0x80d0('0x46')]));_0x19e603[_0x80d0('0x37')]=_0x19e603[_0x80d0('0x37')][_0x80d0('0x47')]?_0x19e603[_0x80d0('0x37')]:_0x451aa1[_0x80d0('0x33')];if(_0x4d67c8['query']['includeAll']){_0x19e603[_0x80d0('0x41')]=[{'all':!![]}];}_0x19e603=_['merge']({},_0x19e603,_0x4d67c8[_0x80d0('0x40')]);return db[_0x80d0('0x2e')][_0x80d0('0x48')](_0x19e603)['then'](handleEntityNotFound(_0x405b10,null))[_0x80d0('0x28')](respondWithResult(_0x405b10,null))['catch'](handleError(_0x405b10,null));};exports[_0x80d0('0x49')]=function(_0x571501,_0x423dd8){return db['CmList'][_0x80d0('0x49')](_0x571501[_0x80d0('0x4a')],{})[_0x80d0('0x28')](function(_0x123bac){var _0x497b24=_0x571501[_0x80d0('0x4b')][_0x80d0('0x25')]({'plain':!![]});if(!_0x497b24)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b24[_0x80d0('0x4c')]===_0x80d0('0x4b')){var _0x2a7d85=_0x123bac[_0x80d0('0x25')]({'plain':!![]});var _0x2e5c5f='Lists';return db[_0x80d0('0x4d')][_0x80d0('0x48')]({'where':{'name':_0x2e5c5f,'userProfileId':_0x497b24[_0x80d0('0x4e')]},'raw':!![]})[_0x80d0('0x28')](function(_0x2f933a){if(_0x2f933a&&_0x2f933a[_0x80d0('0x4f')]===0x0){return db['UserProfileResource'][_0x80d0('0x49')]({'name':_0x2a7d85[_0x80d0('0x2b')],'resourceId':_0x2a7d85['id'],'type':_0x2f933a[_0x80d0('0x2b')],'sectionId':_0x2f933a['id']},{})[_0x80d0('0x28')](function(){return _0x123bac;});}else{return _0x123bac;}})[_0x80d0('0x44')](function(_0x236ba1){logger['error'](_0x80d0('0x50'),_0x236ba1);throw _0x236ba1;});}return _0x123bac;})[_0x80d0('0x28')](respondWithResult(_0x423dd8,0xc9))['catch'](handleError(_0x423dd8,null));};exports['update']=function(_0x5c9a80,_0x5ddd86){if(_0x5c9a80['body']['id']){delete _0x5c9a80['body']['id'];}return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x5c9a80[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x5ddd86,null))[_0x80d0('0x28')](saveUpdates(_0x5c9a80[_0x80d0('0x4a')],null))[_0x80d0('0x28')](respondWithResult(_0x5ddd86,null))[_0x80d0('0x44')](handleError(_0x5ddd86,null));};exports[_0x80d0('0x24')]=function(_0x1bb1a8,_0x311c2a){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x1bb1a8[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x311c2a,null))[_0x80d0('0x28')](removeEntity(_0x311c2a,null))[_0x80d0('0x44')](handleError(_0x311c2a,null));};exports[_0x80d0('0x52')]=function(_0x5a5fd8,_0x132461){return db[_0x80d0('0x2e')]['describe']()[_0x80d0('0x28')](respondWithResult(_0x132461,null))[_0x80d0('0x44')](handleError(_0x132461,null));};exports[_0x80d0('0x53')]=function(_0x2fab8b,_0x248fa8,_0x32cabb){if(_0x2fab8b[_0x80d0('0x4a')]['id']){delete _0x2fab8b[_0x80d0('0x4a')]['id'];}return db['CmList'][_0x80d0('0x48')]({'where':{'id':_0x2fab8b[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x248fa8,null))[_0x80d0('0x28')](function(_0x5986bc){if(_0x5986bc){_0x2fab8b[_0x80d0('0x4a')]['ListId']=_0x5986bc['id'];return db[_0x80d0('0x54')][_0x80d0('0x49')](_0x2fab8b[_0x80d0('0x4a')]);}})[_0x80d0('0x28')](respondWithResult(_0x248fa8,null))[_0x80d0('0x44')](handleError(_0x248fa8,null));};exports['getDispositions']=function(_0x3e3a8a,_0x5e0aee,_0x763229){var _0x2a25ab={'raw':![],'where':{}};var _0x2821be={};var _0xf971b4={'count':0x0,'rows':[]};return db[_0x80d0('0x2e')][_0x80d0('0x55')]({'where':{'id':_0x3e3a8a[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x5e0aee,null))['then'](function(_0x4e650a){if(_0x4e650a){_0x2821be[_0x80d0('0x33')]=_['keys'](db[_0x80d0('0x54')][_0x80d0('0x2f')]);_0x2821be[_0x80d0('0x34')]=_[_0x80d0('0x35')](_0x3e3a8a[_0x80d0('0x34')]);_0x2821be[_0x80d0('0x36')]=_[_0x80d0('0x38')](_0x2821be[_0x80d0('0x33')],_0x2821be[_0x80d0('0x34')]);_0x2a25ab['attributes']=_[_0x80d0('0x38')](_0x2821be[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x3e3a8a['query'][_0x80d0('0x46')]));_0x2a25ab[_0x80d0('0x37')]=_0x2a25ab[_0x80d0('0x37')][_0x80d0('0x47')]?_0x2a25ab[_0x80d0('0x37')]:_0x2821be[_0x80d0('0x33')];if(!_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x39')](_0x80d0('0x56'))){_0x2a25ab[_0x80d0('0x1d')]=qs['limit'](_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x1d')]);_0x2a25ab['offset']=qs[_0x80d0('0x1e')](_0x3e3a8a['query'][_0x80d0('0x1e')]);}_0x2a25ab[_0x80d0('0x57')]=qs[_0x80d0('0x3a')](_0x3e3a8a[_0x80d0('0x34')]['sort']);_0x2a25ab['where']=qs['filters'](_[_0x80d0('0x3c')](_0x3e3a8a[_0x80d0('0x34')],_0x2821be[_0x80d0('0x36')]));_0x2a25ab[_0x80d0('0x3b')][_0x80d0('0x58')]=_0x4e650a['id'];if(_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x2a25ab[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x2a25ab[_0x80d0('0x3b')],{'$or':_[_0x80d0('0x2d')](_0x2a25ab['attributes'],function(_0x1194eb){var _0x175a81={};_0x175a81[_0x1194eb]={'$like':'%'+_0x3e3a8a[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x175a81;})});}_0x2a25ab=_[_0x80d0('0x3e')]({},_0x2a25ab,_0x3e3a8a['options']);return db[_0x80d0('0x54')][_0x80d0('0x1f')]({'where':_0x2a25ab['where']})[_0x80d0('0x28')](function(_0x213e14){_0xf971b4[_0x80d0('0x1f')]=_0x213e14;if(_0x3e3a8a[_0x80d0('0x34')]['includeAll']){_0x2a25ab[_0x80d0('0x41')]=[{'all':!![]}];}return db[_0x80d0('0x54')][_0x80d0('0x42')](_0x2a25ab);})[_0x80d0('0x28')](function(_0x29becc){_0xf971b4['rows']=_0x29becc;return _0xf971b4;});}})[_0x80d0('0x28')](respondWithFilteredResult(_0x5e0aee,_0x2a25ab))[_0x80d0('0x44')](handleError(_0x5e0aee,null));};exports[_0x80d0('0x59')]=function(_0x560f4f,_0x3eb158,_0x14b025){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x560f4f[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x3eb158,null))[_0x80d0('0x28')](function(_0x175ca8){if(_0x175ca8){return _0x175ca8[_0x80d0('0x59')](_0x560f4f[_0x80d0('0x34')][_0x80d0('0x5a')]);}})[_0x80d0('0x28')](respondWithStatusCode(_0x3eb158,null))[_0x80d0('0x44')](handleError(_0x3eb158,null));};exports[_0x80d0('0x5b')]=function(_0x123dde,_0xf83199,_0xd87517){return db[_0x80d0('0x2e')]['find']({'where':{'id':_0x123dde[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0xf83199,null))[_0x80d0('0x28')](function(_0x33e083){if(_0x33e083){var _0x31c675=[];var _0x7ed08={'success':[],'errors':[]};return db[_0x80d0('0x5c')][_0x80d0('0x52')]()['then'](function(_0x5698df){if(_0x123dde[_0x80d0('0x4a')][_0x80d0('0x5d')]&&_[_0x80d0('0x5e')](_0x123dde['body']['tags'])){if(_0x123dde[_0x80d0('0x4a')]['tags']['length']){_0x123dde[_0x80d0('0x4a')][_0x80d0('0x5d')]=_0x123dde[_0x80d0('0x4a')][_0x80d0('0x5d')][_0x80d0('0x5f')](';')+';';}else{_0x123dde[_0x80d0('0x4a')]['tags']=null;}}else{_0x123dde[_0x80d0('0x4a')]['tags']=null;}if(_0x123dde['body']&&_[_0x80d0('0x5e')](_0x123dde['body'])){for(var _0x291782=0x0;_0x291782<_0x123dde[_0x80d0('0x4a')][_0x80d0('0x47')];_0x291782+=0x1){_0x123dde[_0x80d0('0x4a')][_0x291782][_0x80d0('0x58')]=_0x123dde[_0x80d0('0x51')]['id'];_0x31c675[_0x80d0('0x60')](_0x123dde[_0x80d0('0x4a')][_0x291782]);}return BPromise[_0x80d0('0x61')](_0x31c675,function(_0x5bf482){return db['CmContact'][_0x80d0('0x49')](_[_0x80d0('0x62')](_0x5bf482,[_0x80d0('0x5a'),'id'])||{},{'fields':_[_0x80d0('0x35')](_0x5698df),'raw':!![]})[_0x80d0('0x28')](function(_0x1c2b67){_0x7ed08[_0x80d0('0x63')][_0x80d0('0x60')](_0x1c2b67[_0x80d0('0x64')]);})[_0x80d0('0x44')](function(_0x24002d){_0x7ed08[_0x80d0('0x65')][_0x80d0('0x60')]({'data':_0x5bf482,'error':_0x24002d['message']});});})[_0x80d0('0x28')](function(_0x540746){return _0x7ed08;})[_0x80d0('0x44')](function(_0x49dc84){return _0x49dc84;});}else{_0xf83199['status'](0x190)[_0x80d0('0x1c')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x80d0('0x28')](respondWithResult(_0xf83199,null))[_0x80d0('0x44')](handleError(_0xf83199,null));};exports[_0x80d0('0x66')]=function(_0x19d4fe,_0x4476fa,_0x4ccc34){var _0x3326e6;return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x19d4fe['params']['id']},'include':[{'model':db[_0x80d0('0x67')],'as':_0x80d0('0x68')}]})[_0x80d0('0x28')](handleEntityNotFound(_0x4476fa,null))[_0x80d0('0x28')](function(_0x3e1202){if(_0x3e1202){_0x3326e6=_0x3e1202;return db[_0x80d0('0x5c')][_0x80d0('0x2f')];}})[_0x80d0('0x28')](function(_0x5934ba){if(_0x5934ba){var _0x2dea75={};var _0x40b36f={};_0x40b36f['model']=_[_0x80d0('0x69')](_[_0x80d0('0x35')](_0x5934ba),_[_0x80d0('0x2d')](_0x3326e6[_0x80d0('0x68')],function(_0x348c03){return util[_0x80d0('0x6a')](_0x80d0('0x6b'),_0x348c03['id']);}));_0x40b36f['query']=_['keys'](_0x19d4fe[_0x80d0('0x34')]);_0x40b36f[_0x80d0('0x36')]=_[_0x80d0('0x38')](_0x40b36f[_0x80d0('0x33')],_0x40b36f['query']);_0x2dea75[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x40b36f[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x19d4fe['query'][_0x80d0('0x46')]));_0x2dea75['attributes']=_0x2dea75[_0x80d0('0x37')][_0x80d0('0x47')]?_0x2dea75[_0x80d0('0x37')]:_0x40b36f[_0x80d0('0x33')];if(!_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x39')](_0x80d0('0x56'))){_0x2dea75[_0x80d0('0x1d')]=qs['limit'](_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x1d')]);_0x2dea75[_0x80d0('0x1e')]=qs[_0x80d0('0x1e')](_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x1e')]);}_0x2dea75[_0x80d0('0x57')]=qs[_0x80d0('0x3a')](_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x2dea75[_0x80d0('0x3b')]=qs[_0x80d0('0x36')](_[_0x80d0('0x3c')](_0x19d4fe[_0x80d0('0x34')],_0x40b36f[_0x80d0('0x36')]));_0x2dea75[_0x80d0('0x6c')]=!![];if(_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x2dea75[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x2dea75[_0x80d0('0x3b')],{'$or':_[_0x80d0('0x2d')](_0x2dea75[_0x80d0('0x37')],function(_0xa40079){var _0x3537c8={};_0x3537c8[_0xa40079]={'$like':'%'+_0x19d4fe[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x3537c8;})});}_0x2dea75=_[_0x80d0('0x3e')]({},_0x2dea75,_0x19d4fe[_0x80d0('0x40')]);return _0x3326e6[_0x80d0('0x66')](_0x2dea75);}})[_0x80d0('0x28')](respondWithResult(_0x4476fa,null))['catch'](handleError(_0x4476fa,null));};exports[_0x80d0('0x6d')]=function(_0xbdd49f,_0x52ef7a,_0x3e5417){var _0x1e3ec9;var _0x385d91;var _0x336354;var _0x1fe962=_0xbdd49f['params']['id'];csv_results=[];return db['ContactItemType'][_0x80d0('0x42')]({'attributes':['id',_0x80d0('0x2b')],'raw':!![],'order':[_0x80d0('0x6e')]})[_0x80d0('0x28')](function(_0x137697){_0x1e3ec9=_0x137697;var _0x3b34e7=_[_0x80d0('0x35')](db[_0x80d0('0x5c')]['rawAttributes']);return db['CmCustomField']['findAll']({'raw':!![],'attributes':['id',_0x80d0('0x6f')]})[_0x80d0('0x28')](function(_0x3164a7){_0x385d91=_0x3164a7;var _0x52d4e4=squel[_0x80d0('0x70')]()[_0x80d0('0x46')](_0x3b34e7)['from'](_0x80d0('0x71'),'c')[_0x80d0('0x3b')](_0x80d0('0x72'),_0x1fe962)[_0x80d0('0x3b')](_0x80d0('0x73'))[_0x80d0('0x74')]();for(var _0x359fe4=0x0;_0x359fe4<_0x385d91[_0x80d0('0x47')];_0x359fe4++){_0x52d4e4[_0x80d0('0x75')](_0x80d0('0x76')+_0x385d91[_0x359fe4]['id'],_0x80d0('0x77')+_0x385d91[_0x359fe4][_0x80d0('0x6f')]);}for(var _0x359fe4=0x0;_0x359fe4<_0x1e3ec9[_0x80d0('0x47')];_0x359fe4++){_0x52d4e4[_0x80d0('0x75')](squel[_0x80d0('0x70')]()[_0x80d0('0x75')](_0x80d0('0x78'))[_0x80d0('0x79')](_0x80d0('0x7a'))[_0x80d0('0x3b')](_0x80d0('0x7b'),_0x1e3ec9[_0x359fe4]['id'])['where'](_0x80d0('0x7c')),_0x80d0('0x7d')+_0x1e3ec9[_0x359fe4][_0x80d0('0x2b')]);_0x52d4e4[_0x80d0('0x75')](squel[_0x80d0('0x70')]()[_0x80d0('0x75')](_0x80d0('0x7e'))[_0x80d0('0x79')](_0x80d0('0x7a'))[_0x80d0('0x3b')]('ItemTypeId\x20=\x20?',_0x1e3ec9[_0x359fe4]['id'])[_0x80d0('0x3b')]('CmContactId\x20=\x20c.id'),_0x80d0('0x7f')+_0x1e3ec9[_0x359fe4][_0x80d0('0x2b')]);}var _0x17f437=[];_0x17f437[_0x80d0('0x60')](_0x52d4e4['toString']());BPromise[_0x80d0('0x61')](_0x17f437,handleQuery)[_0x80d0('0x28')](function(_0x27501a){handleQuery(_0x52d4e4['toString']());var _0x3b35ee=csv_results[0x0];if(!_[_0x80d0('0x80')](_0x3b35ee)){var _0xeff5be=toCsv(_0x3b35ee);var _0x419f3b=Date[_0x80d0('0x81')]();fs[_0x80d0('0x82')](util[_0x80d0('0x6a')]('/tmp/list_%d_%s.csv',_0x1fe962,_0x419f3b),_0xeff5be);_0x52ef7a['setHeader'](_0x80d0('0x83'),'attachment;\x20filename='+util[_0x80d0('0x6a')]('list_%d_%s.csv',_0x1fe962,_0x419f3b));_0x52ef7a[_0x80d0('0x84')](_0x80d0('0x85'),_0x80d0('0x86'));return _0x52ef7a['download'](util[_0x80d0('0x6a')](_0x80d0('0x87'),_0x1fe962,_0x419f3b));}else{return _0x52ef7a[_0x80d0('0x19')](0xcc);}});});});};exports[_0x80d0('0x88')]=function(_0x1585a6,_0x5f8588,_0x24908b){var _0x5cf863;delete _0x1585a6[_0x80d0('0x4a')]['id'];return db[_0x80d0('0x2e')]['findOne']({'where':{'id':_0x1585a6['params']['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x5f8588,null))['then'](function(_0x1e1d80){if(_0x1e1d80){return db[_0x80d0('0x89')][_0x80d0('0x8a')](function(_0xd61eaa){return db[_0x80d0('0x67')][_0x80d0('0x49')](_0x1585a6[_0x80d0('0x4a')],{'transaction':_0xd61eaa})[_0x80d0('0x28')](function(_0x414e4e){_0x5cf863=_0x414e4e;return _0x1e1d80[_0x80d0('0x8b')](_0x414e4e,{'transaction':_0xd61eaa});})['then'](function(){var _0x720a96={'type':db[_0x80d0('0x8c')]['TEXT'],'transaction':_0xd61eaa};switch(_0x1585a6['body']['type']){case _0x80d0('0x8d'):_0x720a96[_0x80d0('0x31')]=db[_0x80d0('0x8c')]['TEXT'];break;case _0x80d0('0x8e'):_0x720a96[_0x80d0('0x31')]=db[_0x80d0('0x8c')][_0x80d0('0x8f')];break;case'switch':_0x720a96[_0x80d0('0x31')]=db['Sequelize'][_0x80d0('0x90')];_0x720a96[_0x80d0('0x91')]=![];break;default:}return db['sequelize'][_0x80d0('0x92')]['addColumn']('cm_contacts',util['format'](_0x80d0('0x93'),_0x5cf863['id']),_0x720a96);})[_0x80d0('0x28')](function(){return _0x5cf863;});});}})[_0x80d0('0x28')](respondWithResult(_0x5f8588,null))['catch'](handleError(_0x5f8588,null));};exports[_0x80d0('0x94')]=function(_0x1b460d,_0x338682,_0x3cd9a6){var _0x17b531={};var _0x631ee={};var _0x49d785;var _0x2bf9cc;return db['CmList']['findOne']({'where':{'id':_0x1b460d[_0x80d0('0x51')]['id']}})['then'](handleEntityNotFound(_0x338682,null))['then'](function(_0x5d0920){if(_0x5d0920){_0x49d785=_0x5d0920;_0x631ee['model']=_[_0x80d0('0x35')](db[_0x80d0('0x67')]['rawAttributes']);_0x631ee['query']=_['keys'](_0x1b460d[_0x80d0('0x34')]);_0x631ee['filters']=_['intersection'](_0x631ee[_0x80d0('0x33')],_0x631ee[_0x80d0('0x34')]);_0x17b531[_0x80d0('0x37')]=_[_0x80d0('0x38')](_0x631ee[_0x80d0('0x33')],qs[_0x80d0('0x46')](_0x1b460d[_0x80d0('0x34')][_0x80d0('0x46')]));_0x17b531[_0x80d0('0x37')]=_0x17b531[_0x80d0('0x37')][_0x80d0('0x47')]?_0x17b531[_0x80d0('0x37')]:_0x631ee[_0x80d0('0x33')];_0x17b531['order']=qs[_0x80d0('0x3a')](_0x1b460d[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x17b531[_0x80d0('0x3b')]=qs['filters'](_[_0x80d0('0x3c')](_0x1b460d[_0x80d0('0x34')],_0x631ee[_0x80d0('0x36')]));_0x17b531[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x17b531[_0x80d0('0x3b')],{'$or':[{'ListId':_0x5d0920['id']},{'ListId':null}]});if(_0x1b460d[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x17b531[_0x80d0('0x3b')]=_[_0x80d0('0x3e')](_0x17b531['where'],{'$or':_[_0x80d0('0x2d')](_0x17b531[_0x80d0('0x37')],function(_0x1d4133){var _0x4bdd3e={};_0x4bdd3e[_0x1d4133]={'$like':'%'+_0x1b460d[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x4bdd3e;})});}_0x17b531=_['merge']({},_0x17b531,_0x1b460d[_0x80d0('0x40')]);return db[_0x80d0('0x67')][_0x80d0('0x95')](_0x17b531);}})['then'](respondWithResult(_0x338682,null))[_0x80d0('0x44')](handleError(_0x338682,null));};exports[_0x80d0('0x96')]=function(_0x481fd1,_0x41718b){return db[_0x80d0('0x67')][_0x80d0('0x95')]({'where':{'ListId':null}})[_0x80d0('0x28')](handleEntityNotFound(_0x41718b,null))[_0x80d0('0x28')](function(_0x40de6b){return _0x40de6b;})[_0x80d0('0x28')](respondWithResult(_0x41718b,null))[_0x80d0('0x44')](handleError(_0x41718b,null));};exports[_0x80d0('0x97')]=function(_0x48851a,_0x52fbf4,_0x1edaa0){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x48851a[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x52fbf4,null))[_0x80d0('0x28')](function(_0x5b7f15){if(_0x5b7f15){return _0x5b7f15[_0x80d0('0x97')](_0x48851a[_0x80d0('0x4a')][_0x80d0('0x5a')],_[_0x80d0('0x62')](_0x48851a[_0x80d0('0x4a')],[_0x80d0('0x5a'),'id'])||{})[_0x80d0('0x98')](function(_0x143284){for(var _0x207966=0x0;_0x207966<_0x48851a['body']['ids'][_0x80d0('0x47')];_0x207966+=0x1){socket[_0x80d0('0x99')](_0x80d0('0x9a'),{'UserId':Number(_0x48851a['body'][_0x80d0('0x5a')][_0x207966]),'CmListId':Number(_0x48851a['params']['id'])});}return _0x143284;});}})[_0x80d0('0x28')](respondWithResult(_0x52fbf4,null))[_0x80d0('0x44')](handleError(_0x52fbf4,null));};exports[_0x80d0('0x9b')]=function(_0x412c9e,_0x3ad17a,_0x561ffd){return db[_0x80d0('0x2e')][_0x80d0('0x48')]({'where':{'id':_0x412c9e[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x3ad17a,null))[_0x80d0('0x28')](function(_0x2b0fa1){if(_0x2b0fa1){return _0x2b0fa1[_0x80d0('0x9b')](_0x412c9e['query'][_0x80d0('0x5a')])[_0x80d0('0x28')](function(){if(_[_0x80d0('0x5e')](_0x412c9e[_0x80d0('0x34')][_0x80d0('0x5a')])){for(var _0x204544=0x0;_0x204544<_0x412c9e[_0x80d0('0x34')]['ids']['length'];_0x204544+=0x1){socket[_0x80d0('0x99')]('userCmList:remove',{'UserId':Number(_0x412c9e[_0x80d0('0x34')][_0x80d0('0x5a')][_0x204544]),'CmListId':Number(_0x412c9e[_0x80d0('0x51')]['id'])});}}else{socket[_0x80d0('0x99')]('userCmList:remove',{'UserId':Number(_0x412c9e[_0x80d0('0x34')][_0x80d0('0x5a')]),'CmListId':Number(_0x412c9e['params']['id'])});}});}})[_0x80d0('0x28')](respondWithStatusCode(_0x3ad17a,null))[_0x80d0('0x44')](handleError(_0x3ad17a,null));};exports[_0x80d0('0x9c')]=function(_0x4831be,_0x1bc310,_0x327cc0){var _0x23d897={};var _0x334996={};var _0x552045;var _0x1f5ac1;return db[_0x80d0('0x2e')][_0x80d0('0x55')]({'where':{'id':_0x4831be[_0x80d0('0x51')]['id']}})[_0x80d0('0x28')](handleEntityNotFound(_0x1bc310,null))[_0x80d0('0x28')](function(_0x20cd94){if(_0x20cd94){_0x552045=_0x20cd94;_0x334996[_0x80d0('0x33')]=_['keys'](db[_0x80d0('0x9d')][_0x80d0('0x2f')]);_0x334996[_0x80d0('0x34')]=_['keys'](_0x4831be[_0x80d0('0x34')]);_0x334996['filters']=_['intersection'](_0x334996[_0x80d0('0x33')],_0x334996[_0x80d0('0x34')]);_0x23d897['attributes']=_[_0x80d0('0x38')](_0x334996['model'],qs['fields'](_0x4831be[_0x80d0('0x34')]['fields']));_0x23d897['attributes']=_0x23d897['attributes']['length']?_0x23d897[_0x80d0('0x37')]:_0x334996['model'];_0x23d897[_0x80d0('0x57')]=qs[_0x80d0('0x3a')](_0x4831be[_0x80d0('0x34')][_0x80d0('0x3a')]);_0x23d897[_0x80d0('0x3b')]=qs[_0x80d0('0x36')](_[_0x80d0('0x3c')](_0x4831be[_0x80d0('0x34')],_0x334996[_0x80d0('0x36')]));if(_0x4831be[_0x80d0('0x34')][_0x80d0('0x3d')]){_0x23d897[_0x80d0('0x3b')]=_['merge'](_0x23d897[_0x80d0('0x3b')],{'$or':_['map'](_0x23d897[_0x80d0('0x37')],function(_0x6892f5){var _0x2b65ba={};_0x2b65ba[_0x6892f5]={'$like':'%'+_0x4831be[_0x80d0('0x34')][_0x80d0('0x3d')]+'%'};return _0x2b65ba;})});}_0x23d897=_[_0x80d0('0x3e')]({},_0x23d897,_0x4831be[_0x80d0('0x40')]);return _0x552045[_0x80d0('0x9c')](_0x23d897);}})[_0x80d0('0x28')](function(_0x4c98f3){if(_0x4c98f3){_0x1f5ac1=_0x4c98f3[_0x80d0('0x47')];if(!_0x4831be['query']['hasOwnProperty'](_0x80d0('0x56'))){_0x23d897[_0x80d0('0x1d')]=qs[_0x80d0('0x1d')](_0x4831be['query']['limit']);_0x23d897[_0x80d0('0x1e')]=qs['offset'](_0x4831be[_0x80d0('0x34')][_0x80d0('0x1e')]);}return _0x552045['getAgents'](_0x23d897);}})[_0x80d0('0x28')](function(_0xc90838){if(_0xc90838){return _0xc90838?{'count':_0x1f5ac1,'rows':_0xc90838}:null;}})[_0x80d0('0x28')](respondWithResult(_0x1bc310,null))['catch'](handleError(_0x1bc310,null));};function handleQuery(_0x1a1887){logger[_0x80d0('0x9e')](_0x1a1887);return db['sequelize'][_0x80d0('0x34')](_0x1a1887)[_0x80d0('0x98')](function(_0xa66cca){csv_results[_0x80d0('0x60')](_0xa66cca);})[_0x80d0('0x44')](function(_0x11ede4){logger[_0x80d0('0x29')](_0x11ede4[_0x80d0('0x9f')]);});} \ No newline at end of file +var _0xdd19=['fields','attributes','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','length','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','getDispositions','Disposition','ListId','rows','ids','CmContact','tags','isArray','push','each','omit','success','dataValues','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','OrderBy','alias','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','c.cf_','customField_','field','select','item','cm_contact_has_items','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','setHeader','Content-type','addCustomField','findOne','sequelize','addCustomFields','Sequelize','TEXT','text','INTEGER','switch','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','emit','removeAgents','userCmList:remove','getAgents','info','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./cmList.socket','register','sendStatus','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','UserProfileResource','status','end','error','name','send','index','map','CmList','fieldName','type','key','query','keys','filters','intersection','model'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xdd19,0x10a));var _0x9dd1=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xdd19[_0x13e741];return _0x3f8bb3;};'use strict';var emlformat=require(_0x9dd1('0x0'));var rimraf=require(_0x9dd1('0x1'));var zipdir=require(_0x9dd1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9dd1('0x3'));var moment=require(_0x9dd1('0x4'));var BPromise=require(_0x9dd1('0x5'));var Mustache=require(_0x9dd1('0x6'));var util=require(_0x9dd1('0x7'));var path=require(_0x9dd1('0x8'));var sox=require('sox');var csv=require(_0x9dd1('0x9'));var ejs=require(_0x9dd1('0xa'));var fs=require('fs');var fs_extra=require(_0x9dd1('0xb'));var _=require(_0x9dd1('0xc'));var squel=require(_0x9dd1('0xd'));var crypto=require('crypto');var jsforce=require(_0x9dd1('0xe'));var deskjs=require(_0x9dd1('0xf'));var toCsv=require(_0x9dd1('0x9'));var querystring=require(_0x9dd1('0x10'));var Papa=require(_0x9dd1('0x11'));var Redis=require(_0x9dd1('0x12'));var authService=require(_0x9dd1('0x13'));var qs=require(_0x9dd1('0x14'));var as=require(_0x9dd1('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9dd1('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x9dd1('0x17'));var licenseUtil=require(_0x9dd1('0x18'));var db=require(_0x9dd1('0x19'))['db'];var csv_results;config[_0x9dd1('0x1a')]=_[_0x9dd1('0x1b')](config['redis'],{'host':_0x9dd1('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9dd1('0x1a')]));require(_0x9dd1('0x1d'))[_0x9dd1('0x1e')](socket);function respondWithStatusCode(_0x228e34,_0x13d04e){_0x13d04e=_0x13d04e||0xcc;return function(_0x369582){if(_0x369582){return _0x228e34[_0x9dd1('0x1f')](_0x13d04e);}return _0x228e34['status'](_0x13d04e)['end']();};}function respondWithResult(_0x10f849,_0xd298b1){_0xd298b1=_0xd298b1||0xc8;return function(_0x3428a1){if(_0x3428a1){return _0x10f849['status'](_0xd298b1)[_0x9dd1('0x20')](_0x3428a1);}};}function respondWithFilteredResult(_0x44607c,_0x4e8cba){return function(_0x1f6f1a){if(_0x1f6f1a){var _0x5b5a43=typeof _0x4e8cba[_0x9dd1('0x21')]===_0x9dd1('0x22')&&typeof _0x4e8cba[_0x9dd1('0x23')]===_0x9dd1('0x22');var _0x1947fc=_0x1f6f1a[_0x9dd1('0x24')];var _0x5a70f9=_0x5b5a43?0x0:_0x4e8cba['offset'];var _0x2a3e2f=_0x5b5a43?_0x1f6f1a[_0x9dd1('0x24')]:_0x4e8cba[_0x9dd1('0x21')]+_0x4e8cba[_0x9dd1('0x23')];var _0x510f22;if(_0x2a3e2f>=_0x1947fc){_0x2a3e2f=_0x1947fc;_0x510f22=0xc8;}else{_0x510f22=0xce;}_0x44607c['status'](_0x510f22);return _0x44607c[_0x9dd1('0x25')](_0x9dd1('0x26'),_0x5a70f9+'-'+_0x2a3e2f+'/'+_0x1947fc)[_0x9dd1('0x20')](_0x1f6f1a);}return null;};}function patchUpdates(_0x136282){return function(_0x3e311c){try{jsonpatch[_0x9dd1('0x27')](_0x3e311c,_0x136282,!![]);}catch(_0x3c6b81){return BPromise[_0x9dd1('0x28')](_0x3c6b81);}return _0x3e311c['save']();};}function saveUpdates(_0x33455f,_0x302eef){return function(_0x43576e){if(_0x43576e){return _0x43576e['update'](_0x33455f)[_0x9dd1('0x29')](function(_0x19868c){return _0x19868c;});}return null;};}function removeEntity(_0x30a3a8,_0x72da7c){return function(_0x1a63b3){if(_0x1a63b3){return _0x1a63b3[_0x9dd1('0x2a')]()['then'](function(){var _0x55d386=_0x1a63b3['get']({'plain':!![]});var _0x3b6ad4='Lists';return db[_0x9dd1('0x2b')][_0x9dd1('0x2a')]({'where':{'type':_0x3b6ad4,'resourceId':_0x55d386['id']}})['then'](function(){return _0x1a63b3;});})[_0x9dd1('0x29')](function(){_0x30a3a8[_0x9dd1('0x2c')](0xcc)[_0x9dd1('0x2d')]();});}};}function handleEntityNotFound(_0xe2dde,_0x4ec2e5){return function(_0x4fca27){if(!_0x4fca27){_0xe2dde[_0x9dd1('0x1f')](0x194);}return _0x4fca27;};}function handleError(_0x55a349,_0x508f0b){_0x508f0b=_0x508f0b||0x1f4;return function(_0x4e689f){logger[_0x9dd1('0x2e')](_0x4e689f['stack']);if(_0x4e689f[_0x9dd1('0x2f')]){delete _0x4e689f[_0x9dd1('0x2f')];}_0x55a349[_0x9dd1('0x2c')](_0x508f0b)[_0x9dd1('0x30')](_0x4e689f);};}exports[_0x9dd1('0x31')]=function(_0x51e559,_0x185b0a){var _0x4cfd39={},_0x39791a={},_0x78fb12={'count':0x0,'rows':[]};var _0x304848=_[_0x9dd1('0x32')](db[_0x9dd1('0x33')]['rawAttributes'],function(_0x5a2446){return{'name':_0x5a2446[_0x9dd1('0x34')],'type':_0x5a2446[_0x9dd1('0x35')][_0x9dd1('0x36')]};});_0x39791a['model']=_['map'](_0x304848,_0x9dd1('0x2f'));_0x39791a[_0x9dd1('0x37')]=_[_0x9dd1('0x38')](_0x51e559[_0x9dd1('0x37')]);_0x39791a[_0x9dd1('0x39')]=_[_0x9dd1('0x3a')](_0x39791a[_0x9dd1('0x3b')],_0x39791a['query']);_0x4cfd39['attributes']=_['intersection'](_0x39791a[_0x9dd1('0x3b')],qs[_0x9dd1('0x3c')](_0x51e559['query'][_0x9dd1('0x3c')]));_0x4cfd39[_0x9dd1('0x3d')]=_0x4cfd39[_0x9dd1('0x3d')]['length']?_0x4cfd39[_0x9dd1('0x3d')]:_0x39791a[_0x9dd1('0x3b')];if(!_0x51e559[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x4cfd39['limit']=qs['limit'](_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x23')]);_0x4cfd39['offset']=qs['offset'](_0x51e559['query'][_0x9dd1('0x21')]);}_0x4cfd39[_0x9dd1('0x3f')]=qs['sort'](_0x51e559['query'][_0x9dd1('0x40')]);_0x4cfd39[_0x9dd1('0x41')]=qs['filters'](_[_0x9dd1('0x42')](_0x51e559[_0x9dd1('0x37')],_0x39791a[_0x9dd1('0x39')]),_0x304848);if(_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x4cfd39[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x4cfd39[_0x9dd1('0x41')],{'$or':_[_0x9dd1('0x32')](_0x304848,function(_0x4daedc){if(_0x4daedc[_0x9dd1('0x35')]!==_0x9dd1('0x45')){var _0x4d5175={};_0x4d5175[_0x4daedc[_0x9dd1('0x2f')]]={'$like':'%'+_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x43')]+'%'};return _0x4d5175;}})});}_0x4cfd39=_['merge']({},_0x4cfd39,_0x51e559['options']);var _0x8c214b={'where':_0x4cfd39[_0x9dd1('0x41')]};return db[_0x9dd1('0x33')][_0x9dd1('0x24')](_0x8c214b)[_0x9dd1('0x29')](function(_0x128603){_0x78fb12['count']=_0x128603;if(_0x51e559[_0x9dd1('0x37')][_0x9dd1('0x46')]){_0x4cfd39[_0x9dd1('0x47')]=[{'all':!![]}];}return db[_0x9dd1('0x33')][_0x9dd1('0x48')](_0x4cfd39);})[_0x9dd1('0x29')](function(_0xf39d89){_0x78fb12['rows']=_0xf39d89;return _0x78fb12;})['then'](respondWithFilteredResult(_0x185b0a,_0x4cfd39))['catch'](handleError(_0x185b0a,null));};exports[_0x9dd1('0x49')]=function(_0x338cb1,_0xc5864a){var _0x183203={'raw':![],'where':{'id':_0x338cb1[_0x9dd1('0x4a')]['id']}},_0x2da507={};_0x2da507[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db[_0x9dd1('0x33')][_0x9dd1('0x4b')]);_0x2da507[_0x9dd1('0x37')]=_['keys'](_0x338cb1[_0x9dd1('0x37')]);_0x2da507[_0x9dd1('0x39')]=_['intersection'](_0x2da507[_0x9dd1('0x3b')],_0x2da507[_0x9dd1('0x37')]);_0x183203[_0x9dd1('0x3d')]=_['intersection'](_0x2da507[_0x9dd1('0x3b')],qs['fields'](_0x338cb1['query'][_0x9dd1('0x3c')]));_0x183203[_0x9dd1('0x3d')]=_0x183203['attributes'][_0x9dd1('0x4c')]?_0x183203[_0x9dd1('0x3d')]:_0x2da507[_0x9dd1('0x3b')];if(_0x338cb1[_0x9dd1('0x37')][_0x9dd1('0x46')]){_0x183203[_0x9dd1('0x47')]=[{'all':!![]}];}_0x183203=_[_0x9dd1('0x44')]({},_0x183203,_0x338cb1[_0x9dd1('0x4d')]);return db['CmList'][_0x9dd1('0x4e')](_0x183203)[_0x9dd1('0x29')](handleEntityNotFound(_0xc5864a,null))[_0x9dd1('0x29')](respondWithResult(_0xc5864a,null))['catch'](handleError(_0xc5864a,null));};exports[_0x9dd1('0x4f')]=function(_0x3ec33a,_0x2fb43c){return db[_0x9dd1('0x33')][_0x9dd1('0x4f')](_0x3ec33a[_0x9dd1('0x50')],{})[_0x9dd1('0x29')](function(_0x5a27c1){var _0x5da32d=_0x3ec33a[_0x9dd1('0x51')][_0x9dd1('0x52')]({'plain':!![]});if(!_0x5da32d)throw new Error(_0x9dd1('0x53'));if(_0x5da32d[_0x9dd1('0x54')]===_0x9dd1('0x51')){var _0x3d9038=_0x5a27c1[_0x9dd1('0x52')]({'plain':!![]});var _0x3e7c63=_0x9dd1('0x55');return db[_0x9dd1('0x56')][_0x9dd1('0x4e')]({'where':{'name':_0x3e7c63,'userProfileId':_0x5da32d[_0x9dd1('0x57')]},'raw':!![]})[_0x9dd1('0x29')](function(_0x421355){if(_0x421355&&_0x421355[_0x9dd1('0x58')]===0x0){return db['UserProfileResource'][_0x9dd1('0x4f')]({'name':_0x3d9038[_0x9dd1('0x2f')],'resourceId':_0x3d9038['id'],'type':_0x421355[_0x9dd1('0x2f')],'sectionId':_0x421355['id']},{})['then'](function(){return _0x5a27c1;});}else{return _0x5a27c1;}})[_0x9dd1('0x59')](function(_0x3a04cb){logger[_0x9dd1('0x2e')](_0x9dd1('0x5a'),_0x3a04cb);throw _0x3a04cb;});}return _0x5a27c1;})['then'](respondWithResult(_0x2fb43c,0xc9))[_0x9dd1('0x59')](handleError(_0x2fb43c,null));};exports[_0x9dd1('0x5b')]=function(_0x2aee11,_0x4aee2b){if(_0x2aee11['body']['id']){delete _0x2aee11[_0x9dd1('0x50')]['id'];}return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x2aee11[_0x9dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4aee2b,null))[_0x9dd1('0x29')](saveUpdates(_0x2aee11['body'],null))[_0x9dd1('0x29')](respondWithResult(_0x4aee2b,null))[_0x9dd1('0x59')](handleError(_0x4aee2b,null));};exports[_0x9dd1('0x2a')]=function(_0x244f74,_0x3e3f55){return db[_0x9dd1('0x33')]['find']({'where':{'id':_0x244f74[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x3e3f55,null))[_0x9dd1('0x29')](removeEntity(_0x3e3f55,null))['catch'](handleError(_0x3e3f55,null));};exports[_0x9dd1('0x5c')]=function(_0x4613d1,_0x382758){return db[_0x9dd1('0x33')][_0x9dd1('0x5c')]()[_0x9dd1('0x29')](respondWithResult(_0x382758,null))['catch'](handleError(_0x382758,null));};exports[_0x9dd1('0x5d')]=function(_0x3e8267,_0x254c15,_0x4b8e18){if(_0x3e8267['body']['id']){delete _0x3e8267[_0x9dd1('0x50')]['id'];}return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x3e8267['params']['id']}})['then'](handleEntityNotFound(_0x254c15,null))[_0x9dd1('0x29')](function(_0x5ab1a2){if(_0x5ab1a2){_0x3e8267[_0x9dd1('0x50')]['ListId']=_0x5ab1a2['id'];return db['Disposition']['create'](_0x3e8267[_0x9dd1('0x50')]);}})[_0x9dd1('0x29')](respondWithResult(_0x254c15,null))[_0x9dd1('0x59')](handleError(_0x254c15,null));};exports[_0x9dd1('0x5e')]=function(_0x46977c,_0x213b84,_0x41f756){var _0x247f5a={'raw':![],'where':{}};var _0x1b9368={};var _0x503877={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x46977c[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x213b84,null))[_0x9dd1('0x29')](function(_0x5449d6){if(_0x5449d6){_0x1b9368[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db[_0x9dd1('0x5f')][_0x9dd1('0x4b')]);_0x1b9368['query']=_[_0x9dd1('0x38')](_0x46977c[_0x9dd1('0x37')]);_0x1b9368[_0x9dd1('0x39')]=_[_0x9dd1('0x3a')](_0x1b9368[_0x9dd1('0x3b')],_0x1b9368['query']);_0x247f5a[_0x9dd1('0x3d')]=_[_0x9dd1('0x3a')](_0x1b9368['model'],qs[_0x9dd1('0x3c')](_0x46977c[_0x9dd1('0x37')]['fields']));_0x247f5a[_0x9dd1('0x3d')]=_0x247f5a['attributes'][_0x9dd1('0x4c')]?_0x247f5a[_0x9dd1('0x3d')]:_0x1b9368[_0x9dd1('0x3b')];if(!_0x46977c[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x247f5a[_0x9dd1('0x23')]=qs[_0x9dd1('0x23')](_0x46977c[_0x9dd1('0x37')]['limit']);_0x247f5a[_0x9dd1('0x21')]=qs[_0x9dd1('0x21')](_0x46977c['query']['offset']);}_0x247f5a[_0x9dd1('0x3f')]=qs['sort'](_0x46977c[_0x9dd1('0x37')]['sort']);_0x247f5a[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_[_0x9dd1('0x42')](_0x46977c[_0x9dd1('0x37')],_0x1b9368[_0x9dd1('0x39')]));_0x247f5a[_0x9dd1('0x41')][_0x9dd1('0x60')]=_0x5449d6['id'];if(_0x46977c[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x247f5a['where']=_[_0x9dd1('0x44')](_0x247f5a[_0x9dd1('0x41')],{'$or':_[_0x9dd1('0x32')](_0x247f5a[_0x9dd1('0x3d')],function(_0x1d46a1){var _0x1ba3c4={};_0x1ba3c4[_0x1d46a1]={'$like':'%'+_0x46977c[_0x9dd1('0x37')][_0x9dd1('0x43')]+'%'};return _0x1ba3c4;})});}_0x247f5a=_['merge']({},_0x247f5a,_0x46977c[_0x9dd1('0x4d')]);return db[_0x9dd1('0x5f')]['count']({'where':_0x247f5a[_0x9dd1('0x41')]})[_0x9dd1('0x29')](function(_0x720e08){_0x503877[_0x9dd1('0x24')]=_0x720e08;if(_0x46977c[_0x9dd1('0x37')]['includeAll']){_0x247f5a[_0x9dd1('0x47')]=[{'all':!![]}];}return db[_0x9dd1('0x5f')][_0x9dd1('0x48')](_0x247f5a);})[_0x9dd1('0x29')](function(_0x205291){_0x503877[_0x9dd1('0x61')]=_0x205291;return _0x503877;});}})[_0x9dd1('0x29')](respondWithFilteredResult(_0x213b84,_0x247f5a))[_0x9dd1('0x59')](handleError(_0x213b84,null));};exports['removeDispositions']=function(_0x44a287,_0x1292f6,_0xcc21c){return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x44a287[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x1292f6,null))['then'](function(_0x5e9546){if(_0x5e9546){return _0x5e9546['removeDispositions'](_0x44a287[_0x9dd1('0x37')][_0x9dd1('0x62')]);}})[_0x9dd1('0x29')](respondWithStatusCode(_0x1292f6,null))['catch'](handleError(_0x1292f6,null));};exports['addContacts']=function(_0x9262e3,_0x35b8f9,_0x2f8104){return db['CmList'][_0x9dd1('0x4e')]({'where':{'id':_0x9262e3[_0x9dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x35b8f9,null))[_0x9dd1('0x29')](function(_0x43d634){if(_0x43d634){var _0x2a8d3b=[];var _0x477a9c={'success':[],'errors':[]};return db[_0x9dd1('0x63')]['describe']()[_0x9dd1('0x29')](function(_0x4dac6b){if(_0x9262e3['body'][_0x9dd1('0x64')]&&_['isArray'](_0x9262e3[_0x9dd1('0x50')][_0x9dd1('0x64')])){if(_0x9262e3[_0x9dd1('0x50')][_0x9dd1('0x64')][_0x9dd1('0x4c')]){_0x9262e3['body'][_0x9dd1('0x64')]=_0x9262e3[_0x9dd1('0x50')]['tags']['join'](';')+';';}else{_0x9262e3[_0x9dd1('0x50')][_0x9dd1('0x64')]=null;}}else{_0x9262e3[_0x9dd1('0x50')]['tags']=null;}if(_0x9262e3[_0x9dd1('0x50')]&&_[_0x9dd1('0x65')](_0x9262e3[_0x9dd1('0x50')])){for(var _0x515739=0x0;_0x515739<_0x9262e3[_0x9dd1('0x50')]['length'];_0x515739+=0x1){_0x9262e3[_0x9dd1('0x50')][_0x515739][_0x9dd1('0x60')]=_0x9262e3[_0x9dd1('0x4a')]['id'];_0x2a8d3b[_0x9dd1('0x66')](_0x9262e3[_0x9dd1('0x50')][_0x515739]);}return BPromise[_0x9dd1('0x67')](_0x2a8d3b,function(_0x576233){return db['CmContact'][_0x9dd1('0x4f')](_[_0x9dd1('0x68')](_0x576233,[_0x9dd1('0x62'),'id'])||{},{'fields':_['keys'](_0x4dac6b),'raw':!![]})[_0x9dd1('0x29')](function(_0x1b3714){_0x477a9c[_0x9dd1('0x69')][_0x9dd1('0x66')](_0x1b3714[_0x9dd1('0x6a')]);})['catch'](function(_0xdcbf64){_0x477a9c['errors']['push']({'data':_0x576233,'error':_0xdcbf64[_0x9dd1('0x6b')]});});})[_0x9dd1('0x29')](function(_0x12715f){return _0x477a9c;})['catch'](function(_0x38f0da){return _0x38f0da;});}else{_0x35b8f9[_0x9dd1('0x2c')](0x190)[_0x9dd1('0x20')]({'message':_0x9dd1('0x6c')});}});}})['then'](respondWithResult(_0x35b8f9,null))[_0x9dd1('0x59')](handleError(_0x35b8f9,null));};exports['getContacts']=function(_0x97c664,_0x503b2e,_0x5a3f01){var _0x277b66;return db[_0x9dd1('0x33')][_0x9dd1('0x4e')]({'where':{'id':_0x97c664[_0x9dd1('0x4a')]['id']},'include':[{'model':db[_0x9dd1('0x6d')],'as':_0x9dd1('0x6e')}]})['then'](handleEntityNotFound(_0x503b2e,null))[_0x9dd1('0x29')](function(_0x5bf124){if(_0x5bf124){_0x277b66=_0x5bf124;return db[_0x9dd1('0x63')][_0x9dd1('0x4b')];}})['then'](function(_0x2b163e){if(_0x2b163e){var _0x5d3ddf={};var _0x8f304d={};_0x8f304d[_0x9dd1('0x3b')]=_[_0x9dd1('0x6f')](_['keys'](_0x2b163e),_[_0x9dd1('0x32')](_0x277b66['CustomFields'],function(_0x4e4c09){return util[_0x9dd1('0x70')](_0x9dd1('0x71'),_0x4e4c09['id']);}));_0x8f304d[_0x9dd1('0x37')]=_[_0x9dd1('0x38')](_0x97c664['query']);_0x8f304d['filters']=_[_0x9dd1('0x3a')](_0x8f304d[_0x9dd1('0x3b')],_0x8f304d[_0x9dd1('0x37')]);_0x5d3ddf['attributes']=_['intersection'](_0x8f304d[_0x9dd1('0x3b')],qs[_0x9dd1('0x3c')](_0x97c664[_0x9dd1('0x37')][_0x9dd1('0x3c')]));_0x5d3ddf['attributes']=_0x5d3ddf[_0x9dd1('0x3d')][_0x9dd1('0x4c')]?_0x5d3ddf[_0x9dd1('0x3d')]:_0x8f304d['model'];if(!_0x97c664[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x5d3ddf['limit']=qs['limit'](_0x97c664['query'][_0x9dd1('0x23')]);_0x5d3ddf[_0x9dd1('0x21')]=qs[_0x9dd1('0x21')](_0x97c664[_0x9dd1('0x37')][_0x9dd1('0x21')]);}_0x5d3ddf[_0x9dd1('0x3f')]=qs[_0x9dd1('0x40')](_0x97c664[_0x9dd1('0x37')][_0x9dd1('0x40')]);_0x5d3ddf[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_[_0x9dd1('0x42')](_0x97c664['query'],_0x8f304d[_0x9dd1('0x39')]));_0x5d3ddf[_0x9dd1('0x72')]=!![];if(_0x97c664[_0x9dd1('0x37')]['filter']){_0x5d3ddf[_0x9dd1('0x41')]=_['merge'](_0x5d3ddf['where'],{'$or':_['map'](_0x5d3ddf[_0x9dd1('0x3d')],function(_0x27e491){var _0x3cfac9={};_0x3cfac9[_0x27e491]={'$like':'%'+_0x97c664['query']['filter']+'%'};return _0x3cfac9;})});}_0x5d3ddf=_['merge']({},_0x5d3ddf,_0x97c664[_0x9dd1('0x4d')]);return _0x277b66[_0x9dd1('0x73')](_0x5d3ddf);}})[_0x9dd1('0x29')](respondWithResult(_0x503b2e,null))[_0x9dd1('0x59')](handleError(_0x503b2e,null));};exports[_0x9dd1('0x74')]=function(_0x386c21,_0x16ffa6,_0x408b2f){var _0x47b923;var _0x4a4616;var _0x19f13d;var _0x2d04be=_0x386c21[_0x9dd1('0x4a')]['id'];csv_results=[];return db['ContactItemType'][_0x9dd1('0x48')]({'attributes':['id','name'],'raw':!![],'order':[_0x9dd1('0x75')]})[_0x9dd1('0x29')](function(_0x3130c3){_0x47b923=_0x3130c3;var _0xa42c80=_['keys'](db[_0x9dd1('0x63')][_0x9dd1('0x4b')]);return db[_0x9dd1('0x6d')][_0x9dd1('0x48')]({'raw':!![],'attributes':['id',_0x9dd1('0x76')]})[_0x9dd1('0x29')](function(_0x2c4fd8){_0x4a4616=_0x2c4fd8;var _0x38ddb1=squel['select']()['fields'](_0xa42c80)[_0x9dd1('0x77')](_0x9dd1('0x78'),'c')[_0x9dd1('0x41')]('c.ListId\x20=\x20?',_0x2d04be)[_0x9dd1('0x41')](_0x9dd1('0x79'))[_0x9dd1('0x7a')]();for(var _0x39b4ea=0x0;_0x39b4ea<_0x4a4616[_0x9dd1('0x4c')];_0x39b4ea++){_0x38ddb1['field'](_0x9dd1('0x7b')+_0x4a4616[_0x39b4ea]['id'],_0x9dd1('0x7c')+_0x4a4616[_0x39b4ea][_0x9dd1('0x76')]);}for(var _0x39b4ea=0x0;_0x39b4ea<_0x47b923[_0x9dd1('0x4c')];_0x39b4ea++){_0x38ddb1[_0x9dd1('0x7d')](squel[_0x9dd1('0x7e')]()['field'](_0x9dd1('0x7f'))[_0x9dd1('0x77')](_0x9dd1('0x80'))['where']('ItemTypeId\x20=\x20?',_0x47b923[_0x39b4ea]['id'])[_0x9dd1('0x41')](_0x9dd1('0x81')),_0x9dd1('0x82')+_0x47b923[_0x39b4ea][_0x9dd1('0x2f')]);_0x38ddb1['field'](squel['select']()['field'](_0x9dd1('0x83'))[_0x9dd1('0x77')]('cm_contact_has_items')[_0x9dd1('0x41')]('ItemTypeId\x20=\x20?',_0x47b923[_0x39b4ea]['id'])[_0x9dd1('0x41')]('CmContactId\x20=\x20c.id'),_0x9dd1('0x84')+_0x47b923[_0x39b4ea][_0x9dd1('0x2f')]);}var _0x1662f7=[];_0x1662f7['push'](_0x38ddb1[_0x9dd1('0x85')]());BPromise[_0x9dd1('0x67')](_0x1662f7,handleQuery)[_0x9dd1('0x29')](function(_0x5ae787){handleQuery(_0x38ddb1['toString']());var _0x558fa5=csv_results[0x0];if(!_[_0x9dd1('0x86')](_0x558fa5)){var _0x584da7=toCsv(_0x558fa5);var _0x3c1033=Date['now']();fs[_0x9dd1('0x87')](util['format'](_0x9dd1('0x88'),_0x2d04be,_0x3c1033),_0x584da7);_0x16ffa6['setHeader'](_0x9dd1('0x89'),_0x9dd1('0x8a')+util[_0x9dd1('0x70')](_0x9dd1('0x8b'),_0x2d04be,_0x3c1033));_0x16ffa6[_0x9dd1('0x8c')](_0x9dd1('0x8d'),'text/csv');return _0x16ffa6['download'](util[_0x9dd1('0x70')](_0x9dd1('0x88'),_0x2d04be,_0x3c1033));}else{return _0x16ffa6[_0x9dd1('0x1f')](0xcc);}});});});};exports[_0x9dd1('0x8e')]=function(_0xe67ebd,_0x48594a,_0x5c01cd){var _0x344641;delete _0xe67ebd['body']['id'];return db[_0x9dd1('0x33')][_0x9dd1('0x8f')]({'where':{'id':_0xe67ebd[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x48594a,null))[_0x9dd1('0x29')](function(_0x52a4a9){if(_0x52a4a9){return db[_0x9dd1('0x90')]['transaction'](function(_0x559aff){return db[_0x9dd1('0x6d')][_0x9dd1('0x4f')](_0xe67ebd[_0x9dd1('0x50')],{'transaction':_0x559aff})[_0x9dd1('0x29')](function(_0x21d1df){_0x344641=_0x21d1df;return _0x52a4a9[_0x9dd1('0x91')](_0x21d1df,{'transaction':_0x559aff});})[_0x9dd1('0x29')](function(){var _0x1e8389={'type':db[_0x9dd1('0x92')][_0x9dd1('0x93')],'transaction':_0x559aff};switch(_0xe67ebd['body'][_0x9dd1('0x35')]){case _0x9dd1('0x94'):_0x1e8389[_0x9dd1('0x35')]=db['Sequelize']['TEXT'];break;case'number':_0x1e8389['type']=db[_0x9dd1('0x92')][_0x9dd1('0x95')];break;case _0x9dd1('0x96'):_0x1e8389['type']=db[_0x9dd1('0x92')]['BOOLEAN'];_0x1e8389['defaultValue']=![];break;default:}return db[_0x9dd1('0x90')][_0x9dd1('0x97')][_0x9dd1('0x98')](_0x9dd1('0x78'),util['format'](_0x9dd1('0x99'),_0x344641['id']),_0x1e8389);})[_0x9dd1('0x29')](function(){return _0x344641;});});}})['then'](respondWithResult(_0x48594a,null))[_0x9dd1('0x59')](handleError(_0x48594a,null));};exports[_0x9dd1('0x9a')]=function(_0x416cd8,_0x533ad6,_0x490558){var _0x29a952={};var _0x1ba0b2={};var _0x4e51f7;var _0x24d72d;return db['CmList']['findOne']({'where':{'id':_0x416cd8[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x533ad6,null))['then'](function(_0xeae765){if(_0xeae765){_0x4e51f7=_0xeae765;_0x1ba0b2[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db['CmCustomField']['rawAttributes']);_0x1ba0b2[_0x9dd1('0x37')]=_[_0x9dd1('0x38')](_0x416cd8['query']);_0x1ba0b2[_0x9dd1('0x39')]=_[_0x9dd1('0x3a')](_0x1ba0b2['model'],_0x1ba0b2[_0x9dd1('0x37')]);_0x29a952['attributes']=_['intersection'](_0x1ba0b2[_0x9dd1('0x3b')],qs['fields'](_0x416cd8[_0x9dd1('0x37')][_0x9dd1('0x3c')]));_0x29a952[_0x9dd1('0x3d')]=_0x29a952[_0x9dd1('0x3d')][_0x9dd1('0x4c')]?_0x29a952['attributes']:_0x1ba0b2['model'];_0x29a952[_0x9dd1('0x3f')]=qs[_0x9dd1('0x40')](_0x416cd8[_0x9dd1('0x37')][_0x9dd1('0x40')]);_0x29a952[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_['pick'](_0x416cd8[_0x9dd1('0x37')],_0x1ba0b2[_0x9dd1('0x39')]));_0x29a952[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x29a952[_0x9dd1('0x41')],{'$or':[{'ListId':_0xeae765['id']},{'ListId':null}]});if(_0x416cd8[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x29a952[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x29a952[_0x9dd1('0x41')],{'$or':_['map'](_0x29a952[_0x9dd1('0x3d')],function(_0x345588){var _0x49d6a5={};_0x49d6a5[_0x345588]={'$like':'%'+_0x416cd8['query'][_0x9dd1('0x43')]+'%'};return _0x49d6a5;})});}_0x29a952=_[_0x9dd1('0x44')]({},_0x29a952,_0x416cd8['options']);return db[_0x9dd1('0x6d')]['findAndCountAll'](_0x29a952);}})[_0x9dd1('0x29')](respondWithResult(_0x533ad6,null))[_0x9dd1('0x59')](handleError(_0x533ad6,null));};exports[_0x9dd1('0x9b')]=function(_0x14f4bf,_0x39b790){return db[_0x9dd1('0x6d')][_0x9dd1('0x9c')]({'where':{'ListId':null}})[_0x9dd1('0x29')](handleEntityNotFound(_0x39b790,null))['then'](function(_0xcd2f6d){return _0xcd2f6d;})['then'](respondWithResult(_0x39b790,null))['catch'](handleError(_0x39b790,null));};exports[_0x9dd1('0x9d')]=function(_0x9bdfc9,_0x66b36,_0x40a832){return db[_0x9dd1('0x33')]['find']({'where':{'id':_0x9bdfc9[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x66b36,null))[_0x9dd1('0x29')](function(_0x4b9803){if(_0x4b9803){return _0x4b9803[_0x9dd1('0x9d')](_0x9bdfc9[_0x9dd1('0x50')][_0x9dd1('0x62')],_['omit'](_0x9bdfc9[_0x9dd1('0x50')],['ids','id'])||{})['spread'](function(_0x35e5c5){for(var _0x51409f=0x0;_0x51409f<_0x9bdfc9['body'][_0x9dd1('0x62')]['length'];_0x51409f+=0x1){socket[_0x9dd1('0x9e')]('userCmList:save',{'UserId':Number(_0x9bdfc9[_0x9dd1('0x50')][_0x9dd1('0x62')][_0x51409f]),'CmListId':Number(_0x9bdfc9[_0x9dd1('0x4a')]['id'])});}return _0x35e5c5;});}})[_0x9dd1('0x29')](respondWithResult(_0x66b36,null))[_0x9dd1('0x59')](handleError(_0x66b36,null));};exports[_0x9dd1('0x9f')]=function(_0x3f9a14,_0x3cc809,_0x5b0e55){return db['CmList'][_0x9dd1('0x4e')]({'where':{'id':_0x3f9a14[_0x9dd1('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3cc809,null))[_0x9dd1('0x29')](function(_0x3b6738){if(_0x3b6738){return _0x3b6738[_0x9dd1('0x9f')](_0x3f9a14[_0x9dd1('0x37')][_0x9dd1('0x62')])[_0x9dd1('0x29')](function(){if(_[_0x9dd1('0x65')](_0x3f9a14['query'][_0x9dd1('0x62')])){for(var _0x412aa7=0x0;_0x412aa7<_0x3f9a14[_0x9dd1('0x37')][_0x9dd1('0x62')][_0x9dd1('0x4c')];_0x412aa7+=0x1){socket[_0x9dd1('0x9e')](_0x9dd1('0xa0'),{'UserId':Number(_0x3f9a14['query'][_0x9dd1('0x62')][_0x412aa7]),'CmListId':Number(_0x3f9a14[_0x9dd1('0x4a')]['id'])});}}else{socket['emit'](_0x9dd1('0xa0'),{'UserId':Number(_0x3f9a14[_0x9dd1('0x37')][_0x9dd1('0x62')]),'CmListId':Number(_0x3f9a14[_0x9dd1('0x4a')]['id'])});}});}})['then'](respondWithStatusCode(_0x3cc809,null))['catch'](handleError(_0x3cc809,null));};exports[_0x9dd1('0xa1')]=function(_0x7a054b,_0x219536,_0x3e63aa){var _0x5832d3={};var _0x33f197={};var _0x5bf4af;var _0x54a17e;return db['CmList'][_0x9dd1('0x8f')]({'where':{'id':_0x7a054b[_0x9dd1('0x4a')]['id']}})[_0x9dd1('0x29')](handleEntityNotFound(_0x219536,null))[_0x9dd1('0x29')](function(_0x2cbea8){if(_0x2cbea8){_0x5bf4af=_0x2cbea8;_0x33f197[_0x9dd1('0x3b')]=_[_0x9dd1('0x38')](db['User'][_0x9dd1('0x4b')]);_0x33f197['query']=_[_0x9dd1('0x38')](_0x7a054b[_0x9dd1('0x37')]);_0x33f197[_0x9dd1('0x39')]=_['intersection'](_0x33f197[_0x9dd1('0x3b')],_0x33f197[_0x9dd1('0x37')]);_0x5832d3[_0x9dd1('0x3d')]=_[_0x9dd1('0x3a')](_0x33f197[_0x9dd1('0x3b')],qs['fields'](_0x7a054b['query'][_0x9dd1('0x3c')]));_0x5832d3['attributes']=_0x5832d3[_0x9dd1('0x3d')][_0x9dd1('0x4c')]?_0x5832d3[_0x9dd1('0x3d')]:_0x33f197[_0x9dd1('0x3b')];_0x5832d3[_0x9dd1('0x3f')]=qs['sort'](_0x7a054b['query'][_0x9dd1('0x40')]);_0x5832d3[_0x9dd1('0x41')]=qs[_0x9dd1('0x39')](_[_0x9dd1('0x42')](_0x7a054b[_0x9dd1('0x37')],_0x33f197[_0x9dd1('0x39')]));if(_0x7a054b[_0x9dd1('0x37')][_0x9dd1('0x43')]){_0x5832d3[_0x9dd1('0x41')]=_[_0x9dd1('0x44')](_0x5832d3[_0x9dd1('0x41')],{'$or':_[_0x9dd1('0x32')](_0x5832d3[_0x9dd1('0x3d')],function(_0x100c75){var _0x475d59={};_0x475d59[_0x100c75]={'$like':'%'+_0x7a054b['query'][_0x9dd1('0x43')]+'%'};return _0x475d59;})});}_0x5832d3=_[_0x9dd1('0x44')]({},_0x5832d3,_0x7a054b['options']);return _0x5bf4af[_0x9dd1('0xa1')](_0x5832d3);}})[_0x9dd1('0x29')](function(_0x25e005){if(_0x25e005){_0x54a17e=_0x25e005[_0x9dd1('0x4c')];if(!_0x7a054b[_0x9dd1('0x37')]['hasOwnProperty'](_0x9dd1('0x3e'))){_0x5832d3[_0x9dd1('0x23')]=qs[_0x9dd1('0x23')](_0x7a054b['query'][_0x9dd1('0x23')]);_0x5832d3[_0x9dd1('0x21')]=qs['offset'](_0x7a054b['query'][_0x9dd1('0x21')]);}return _0x5bf4af[_0x9dd1('0xa1')](_0x5832d3);}})[_0x9dd1('0x29')](function(_0x5465cc){if(_0x5465cc){return _0x5465cc?{'count':_0x54a17e,'rows':_0x5465cc}:null;}})[_0x9dd1('0x29')](respondWithResult(_0x219536,null))[_0x9dd1('0x59')](handleError(_0x219536,null));};function handleQuery(_0x384f72){logger[_0x9dd1('0xa2')](_0x384f72);return db[_0x9dd1('0x90')][_0x9dd1('0x37')](_0x384f72)['spread'](function(_0x216fe8){csv_results['push'](_0x216fe8);})[_0x9dd1('0x59')](function(_0x408e47){logger[_0x9dd1('0x2e')](_0x408e47['message']);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 6afb207..c8674ce 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(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'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 _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3e74,0x175));var _0x43e7=function(_0x312e4a,_0xff2cba){_0x312e4a=_0x312e4a-0x0;var _0xf9b60a=_0x3e74[_0x312e4a];return _0xf9b60a;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index f135ff9..0568b01 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','CmList','cm_lists','lodash'];(function(_0x30cb6c,_0x1814be){var _0x42a220=function(_0x56a9de){while(--_0x56a9de){_0x30cb6c['push'](_0x30cb6c['shift']());}};_0x42a220(++_0x1814be);}(_0xaa88,0x137));var _0x8aa8=function(_0x58fc2f,_0x111399){_0x58fc2f=_0x58fc2f-0x0;var _0x3a1312=_0xaa88[_0x58fc2f];return _0x3a1312;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2750=['rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x286bd8,_0x1f9988){var _0x8e2843=function(_0x2729b0){while(--_0x2729b0){_0x286bd8['push'](_0x286bd8['shift']());}};_0x8e2843(++_0x1f9988);}(_0x2750,0x13b));var _0x0275=function(_0x3b954b,_0x4dc85b){_0x3b954b=_0x3b954b-0x0;var _0x394a3c=_0x2750[_0x3b954b];return _0x394a3c;};'use strict';var _=require(_0x0275('0x0'));var util=require('util');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var BPromise=require(_0x0275('0x4'));var rp=require(_0x0275('0x5'));var fs=require('fs');var path=require(_0x0275('0x6'));var rimraf=require(_0x0275('0x7'));var config=require(_0x0275('0x8'));var attributes=require(_0x0275('0x9'));module[_0x0275('0xa')]=function(_0x5953f9,_0x3f645f){return _0x5953f9[_0x0275('0xb')](_0x0275('0xc'),attributes,{'tableName':_0x0275('0xd'),'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 e7a1159..1e200a3 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 _0x57f3=['../../config/environment','client','redis','defaults','localhost','./cmList.socket','register','request','CmList,\x20%s,\x20%s','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','randomstring','ioredis','../../mysqldb','rpc'];(function(_0xfff0ae,_0xdb7a93){var _0x977e5f=function(_0x1c02ef){while(--_0x1c02ef){_0xfff0ae['push'](_0xfff0ae['shift']());}};_0x977e5f(++_0xdb7a93);}(_0x57f3,0x9b));var _0x357f=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x57f3[_0x59ee6f];return _0x4c0979;};'use strict';var _=require('lodash');var util=require(_0x357f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x357f('0x1'));var fs=require('fs');var Redis=require(_0x357f('0x2'));var db=require(_0x357f('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x357f('0x4'));var config=require(_0x357f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x357f('0x6')]['http']({'port':0x232a});config[_0x357f('0x7')]=_[_0x357f('0x8')](config[_0x357f('0x7')],{'host':_0x357f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x357f('0xa'))[_0x357f('0xb')](socket);function respondWithRpcPromise(_0x47cdd0,_0x4b0073,_0x243146){return new BPromise(function(_0x3c5444,_0x31e355){return client[_0x357f('0xc')](_0x47cdd0,_0x243146)['then'](function(_0x35dd40){logger['info'](_0x357f('0xd'),_0x4b0073,_0x357f('0xe'));logger['debug'](_0x357f('0xf'),_0x4b0073,_0x357f('0xe'),JSON[_0x357f('0x10')](_0x35dd40));if(_0x35dd40[_0x357f('0x11')]){if(_0x35dd40[_0x357f('0x11')]['code']===0x1f4){logger[_0x357f('0x11')](_0x357f('0xd'),_0x4b0073,_0x35dd40[_0x357f('0x11')][_0x357f('0x12')]);return _0x31e355(_0x35dd40['error'][_0x357f('0x12')]);}logger['error'](_0x357f('0xd'),_0x4b0073,_0x35dd40[_0x357f('0x11')][_0x357f('0x12')]);return _0x3c5444(_0x35dd40[_0x357f('0x11')]['message']);}else{logger['info']('CmList,\x20%s,\x20%s',_0x4b0073,_0x357f('0xe'));_0x3c5444(_0x35dd40[_0x357f('0x13')][_0x357f('0x12')]);}})['catch'](function(_0x50dfa5){logger[_0x357f('0x11')](_0x357f('0xd'),_0x4b0073,_0x50dfa5);_0x31e355(_0x50dfa5);});});} \ No newline at end of file +var _0x1111=['./cmList.socket','register','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','CmList,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter'];(function(_0x1cb2c5,_0x2589dc){var _0x1e373c=function(_0x55121a){while(--_0x55121a){_0x1cb2c5['push'](_0x1cb2c5['shift']());}};_0x1e373c(++_0x2589dc);}(_0x1111,0x78));var _0x1111=function(_0x434496,_0x3dfe5b){_0x434496=_0x434496-0x0;var _0x34c2d9=_0x1111[_0x434496];return _0x34c2d9;};'use strict';var _=require(_0x1111('0x0'));var util=require(_0x1111('0x1'));var moment=require(_0x1111('0x2'));var BPromise=require(_0x1111('0x3'));var rs=require(_0x1111('0x4'));var fs=require('fs');var Redis=require(_0x1111('0x5'));var db=require(_0x1111('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1111('0x7'));var config=require(_0x1111('0x8'));var jayson=require(_0x1111('0x9'));var client=jayson[_0x1111('0xa')][_0x1111('0xb')]({'port':0x232a});config['redis']=_[_0x1111('0xc')](config[_0x1111('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x1111('0xe'))(new Redis(config[_0x1111('0xd')]));require(_0x1111('0xf'))[_0x1111('0x10')](socket);function respondWithRpcPromise(_0x444854,_0x4adb5e,_0x40828d){return new BPromise(function(_0x2e5830,_0x3a857a){return client['request'](_0x444854,_0x40828d)[_0x1111('0x11')](function(_0x1cc826){logger[_0x1111('0x12')]('CmList,\x20%s,\x20%s',_0x4adb5e,_0x1111('0x13'));logger[_0x1111('0x14')](_0x1111('0x15'),_0x4adb5e,_0x1111('0x13'),JSON[_0x1111('0x16')](_0x1cc826));if(_0x1cc826[_0x1111('0x17')]){if(_0x1cc826[_0x1111('0x17')]['code']===0x1f4){logger[_0x1111('0x17')](_0x1111('0x18'),_0x4adb5e,_0x1cc826[_0x1111('0x17')]['message']);return _0x3a857a(_0x1cc826['error'][_0x1111('0x19')]);}logger['error'](_0x1111('0x18'),_0x4adb5e,_0x1cc826[_0x1111('0x17')]['message']);return _0x2e5830(_0x1cc826[_0x1111('0x17')]['message']);}else{logger[_0x1111('0x12')](_0x1111('0x18'),_0x4adb5e,'request\x20sent');_0x2e5830(_0x1cc826['result'][_0x1111('0x19')]);}})[_0x1111('0x1a')](function(_0x5e9484){logger[_0x1111('0x17')]('CmList,\x20%s,\x20%s',_0x4adb5e,_0x5e9484);_0x3a857a(_0x5e9484);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 83dd263..db2d210 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 _0x9da2=['register','length','cmList:','./cmList.events','save','emit','removeListener'];(function(_0x38c0ff,_0x296d99){var _0x580963=function(_0x40a1fd){while(--_0x40a1fd){_0x38c0ff['push'](_0x38c0ff['shift']());}};_0x580963(++_0x296d99);}(_0x9da2,0x153));var _0x29da=function(_0x218360,_0x15db19){_0x218360=_0x218360-0x0;var _0x3bb157=_0x9da2[_0x218360];return _0x3bb157;};'use strict';var CmListEvents=require(_0x29da('0x0'));var events=[_0x29da('0x1'),'remove','update'];function createListener(_0x1b83d7,_0x6b3aa2){return function(_0x540f30){_0x6b3aa2[_0x29da('0x2')](_0x1b83d7,_0x540f30);};}function removeListener(_0x534417,_0x4dc607){return function(){CmListEvents[_0x29da('0x3')](_0x534417,_0x4dc607);};}exports[_0x29da('0x4')]=function(_0x51fe4b){for(var _0x18b8b0=0x0,_0x1c552a=events[_0x29da('0x5')];_0x18b8b0<_0x1c552a;_0x18b8b0++){var _0x1525b1=events[_0x18b8b0];var _0x5d52a3=createListener(_0x29da('0x6')+_0x1525b1,_0x51fe4b);CmListEvents['on'](_0x1525b1,_0x5d52a3);}}; \ No newline at end of file +var _0xc9b7=['remove','emit','removeListener','./cmList.events','save'];(function(_0x1212a6,_0x2f97e7){var _0x21fbdc=function(_0x92100d){while(--_0x92100d){_0x1212a6['push'](_0x1212a6['shift']());}};_0x21fbdc(++_0x2f97e7);}(_0xc9b7,0x1e8));var _0x7c9b=function(_0x4d05dd,_0x258cdd){_0x4d05dd=_0x4d05dd-0x0;var _0x1c5226=_0xc9b7[_0x4d05dd];return _0x1c5226;};'use strict';var CmListEvents=require(_0x7c9b('0x0'));var events=[_0x7c9b('0x1'),_0x7c9b('0x2'),'update'];function createListener(_0x381e2d,_0x28e569){return function(_0x4151a1){_0x28e569[_0x7c9b('0x3')](_0x381e2d,_0x4151a1);};}function removeListener(_0x4ee2e7,_0x68ea18){return function(){CmListEvents[_0x7c9b('0x4')](_0x4ee2e7,_0x68ea18);};}exports['register']=function(_0xac80a4){for(var _0x58372d=0x0,_0x5019ef=events['length'];_0x58372d<_0x5019ef;_0x58372d++){var _0x2a02e0=events[_0x58372d];var _0x48c46f=createListener('cmList:'+_0x2a02e0,_0xac80a4);CmListEvents['on'](_0x2a02e0,_0x48c46f);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 3537def..851454a 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 _0xfa8d=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','/describe','getGlobalCustomFields','/:id','/:id/dispositions','/:id/contacts/csv','getContactsCsv','/:id/users','getAgents','post','addDisposition','/:id/contacts','/:id/fields','addCustomField','addAgents','put','update','delete','removeAgents','exports','multer','util','path'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xfa8d,0x9d));var _0xdfa8=function(_0x20c14e,_0x293d7e){_0x20c14e=_0x20c14e-0x0;var _0x41feb1=_0xfa8d[_0x20c14e];return _0x41feb1;};'use strict';var multer=require(_0xdfa8('0x0'));var util=require(_0xdfa8('0x1'));var path=require(_0xdfa8('0x2'));var timeout=require(_0xdfa8('0x3'));var express=require(_0xdfa8('0x4'));var router=express[_0xdfa8('0x5')]();var fs_extra=require(_0xdfa8('0x6'));var auth=require(_0xdfa8('0x7'));var interaction=require(_0xdfa8('0x8'));var config=require(_0xdfa8('0x9'));var controller=require(_0xdfa8('0xa'));router[_0xdfa8('0xb')]('/',auth[_0xdfa8('0xc')](),controller['index']);router[_0xdfa8('0xb')](_0xdfa8('0xd'),auth[_0xdfa8('0xc')](),controller['describe']);router[_0xdfa8('0xb')]('/global_fields',auth['isAuthenticated'](),controller[_0xdfa8('0xe')]);router[_0xdfa8('0xb')](_0xdfa8('0xf'),auth[_0xdfa8('0xc')](),controller['show']);router[_0xdfa8('0xb')](_0xdfa8('0x10'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xdfa8('0xb')]('/:id/contacts',auth[_0xdfa8('0xc')](),controller['getContacts']);router[_0xdfa8('0xb')](_0xdfa8('0x11'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x12')]);router[_0xdfa8('0xb')]('/:id/fields',auth[_0xdfa8('0xc')](),controller['getCustomFields']);router[_0xdfa8('0xb')](_0xdfa8('0x13'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x14')]);router['post']('/',auth[_0xdfa8('0xc')](),controller['create']);router[_0xdfa8('0x15')](_0xdfa8('0x10'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x16')]);router['post'](_0xdfa8('0x17'),auth[_0xdfa8('0xc')](),controller['addContacts']);router[_0xdfa8('0x15')](_0xdfa8('0x18'),auth['isAuthenticated'](),controller[_0xdfa8('0x19')]);router[_0xdfa8('0x15')](_0xdfa8('0x13'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x1a')]);router[_0xdfa8('0x1b')]('/:id',auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x1c')]);router[_0xdfa8('0x1d')](_0xdfa8('0xf'),auth[_0xdfa8('0xc')](),controller['destroy']);router[_0xdfa8('0x1d')](_0xdfa8('0x10'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xdfa8('0x1d')](_0xdfa8('0x13'),auth[_0xdfa8('0xc')](),controller[_0xdfa8('0x1e')]);module[_0xdfa8('0x1f')]=router; \ No newline at end of file +var _0x9122=['/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','/:id','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/global_fields','show','getDispositions','/:id/contacts'];(function(_0x5ad262,_0x2c6555){var _0x5d72cf=function(_0x369fc8){while(--_0x369fc8){_0x5ad262['push'](_0x5ad262['shift']());}};_0x5d72cf(++_0x2c6555);}(_0x9122,0xa5));var _0x2912=function(_0x3252f7,_0x1678e5){_0x3252f7=_0x3252f7-0x0;var _0x591cf0=_0x9122[_0x3252f7];return _0x591cf0;};'use strict';var multer=require(_0x2912('0x0'));var util=require(_0x2912('0x1'));var path=require(_0x2912('0x2'));var timeout=require(_0x2912('0x3'));var express=require(_0x2912('0x4'));var router=express[_0x2912('0x5')]();var fs_extra=require(_0x2912('0x6'));var auth=require(_0x2912('0x7'));var interaction=require(_0x2912('0x8'));var config=require(_0x2912('0x9'));var controller=require(_0x2912('0xa'));router[_0x2912('0xb')]('/',auth[_0x2912('0xc')](),controller[_0x2912('0xd')]);router[_0x2912('0xb')](_0x2912('0xe'),auth[_0x2912('0xc')](),controller[_0x2912('0xf')]);router[_0x2912('0xb')](_0x2912('0x10'),auth[_0x2912('0xc')](),controller['getGlobalCustomFields']);router['get']('/:id',auth[_0x2912('0xc')](),controller[_0x2912('0x11')]);router[_0x2912('0xb')]('/:id/dispositions',auth[_0x2912('0xc')](),controller[_0x2912('0x12')]);router['get'](_0x2912('0x13'),auth[_0x2912('0xc')](),controller['getContacts']);router['get'](_0x2912('0x14'),auth[_0x2912('0xc')](),controller['getContactsCsv']);router[_0x2912('0xb')](_0x2912('0x15'),auth['isAuthenticated'](),controller[_0x2912('0x16')]);router['get'](_0x2912('0x17'),auth[_0x2912('0xc')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x2912('0x18')](_0x2912('0x19'),auth[_0x2912('0xc')](),controller[_0x2912('0x1a')]);router['post'](_0x2912('0x13'),auth[_0x2912('0xc')](),controller[_0x2912('0x1b')]);router[_0x2912('0x18')](_0x2912('0x15'),auth[_0x2912('0xc')](),controller[_0x2912('0x1c')]);router[_0x2912('0x18')](_0x2912('0x17'),auth[_0x2912('0xc')](),controller[_0x2912('0x1d')]);router[_0x2912('0x1e')]('/:id',auth[_0x2912('0xc')](),controller[_0x2912('0x1f')]);router[_0x2912('0x20')](_0x2912('0x21'),auth[_0x2912('0xc')](),controller[_0x2912('0x22')]);router['delete']('/:id/dispositions',auth[_0x2912('0xc')](),controller['removeDispositions']);router[_0x2912('0x20')](_0x2912('0x17'),auth[_0x2912('0xc')](),controller[_0x2912('0x23')]);module[_0x2912('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index e121b94..87f9b82 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 _0x9588=['exports','VIRTUAL','getDataValue','field','STRING','sequelize'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x9588,0x137));var _0x8958=function(_0x41df99,_0x39599f){_0x41df99=_0x41df99-0x0;var _0x5923e0=_0x9588[_0x41df99];return _0x5923e0;};'use strict';var Sequelize=require(_0x8958('0x0'));module[_0x8958('0x1')]={'name':{'type':Sequelize[_0x8958('0x2')],'get':function(_0x5b5b27){return this[_0x8958('0x3')](_0x8958('0x4'));}},'field':{'type':Sequelize[_0x8958('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x8958('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x8958('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xf013=['VIRTUAL','STRING','sequelize','exports'];(function(_0x433fbc,_0x318620){var _0x3e5b8f=function(_0x5845c4){while(--_0x5845c4){_0x433fbc['push'](_0x433fbc['shift']());}};_0x3e5b8f(++_0x318620);}(_0xf013,0xae));var _0x3f01=function(_0x356efe,_0x480f92){_0x356efe=_0x356efe-0x0;var _0x5dca67=_0xf013[_0x356efe];return _0x5dca67;};'use strict';var Sequelize=require(_0x3f01('0x0'));module[_0x3f01('0x1')]={'name':{'type':Sequelize[_0x3f01('0x2')],'get':function(_0x34cc26){return this['getDataValue']('field');}},'field':{'type':Sequelize[_0x3f01('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x3f01('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x3f01('0x3')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index 52f8fa7..ff187c6 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x4f5270,_0x15c5c8){var _0x5ec489=function(_0x355b91){while(--_0x355b91){_0x4f5270['push'](_0x4f5270['shift']());}};_0x5ec489(++_0x15c5c8);}(_0x7a54,0x106));var _0x47a5=function(_0x53c493,_0x4f8748){_0x53c493=_0x53c493-0x0;var _0x4383cb=_0x7a54[_0x53c493];return _0x4383cb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _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(_0xec901a,_0x11894b){var _0x3831b1=function(_0x27c5a9){while(--_0x27c5a9){_0xec901a['push'](_0xec901a['shift']());}};_0x3831b1(++_0x11894b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){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 251d0b7..f78fa5f 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 _0x967d=['rimraf','../../config/environment','./condition.attributes','exports','define','tools_conditions','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x967d,0xae));var _0xd967=function(_0x80e32c,_0x45b0bf){_0x80e32c=_0x80e32c-0x0;var _0x5a31af=_0x967d[_0x80e32c];return _0x5a31af;};'use strict';var _=require('lodash');var util=require(_0xd967('0x0'));var logger=require(_0xd967('0x1'))(_0xd967('0x2'));var moment=require('moment');var BPromise=require(_0xd967('0x3'));var rp=require(_0xd967('0x4'));var fs=require('fs');var path=require(_0xd967('0x5'));var rimraf=require(_0xd967('0x6'));var config=require(_0xd967('0x7'));var attributes=require(_0xd967('0x8'));module[_0xd967('0x9')]=function(_0x5b77f7,_0x4895d9){return _0x5b77f7[_0xd967('0xa')]('Condition',attributes,{'tableName':_0xd967('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1921=['request-promise','path','../../config/environment','./condition.attributes','exports','define','Condition','moment','bluebird'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x1921,0x178));var _0x1192=function(_0x406871,_0x5b554e){_0x406871=_0x406871-0x0;var _0x394d7a=_0x1921[_0x406871];return _0x394d7a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1192('0x0'));var BPromise=require(_0x1192('0x1'));var rp=require(_0x1192('0x2'));var fs=require('fs');var path=require(_0x1192('0x3'));var rimraf=require('rimraf');var config=require(_0x1192('0x4'));var attributes=require(_0x1192('0x5'));module[_0x1192('0x6')]=function(_0x4fe6ad,_0x420837){return _0x4fe6ad[_0x1192('0x7')](_0x1192('0x8'),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 5767246..7b26720 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 _0xc80c=['../../config/logger','rpc','jayson/promise','client','http','request','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e27a9,_0x26ecfa){var _0x117def=function(_0x3591bf){while(--_0x3591bf){_0x4e27a9['push'](_0x4e27a9['shift']());}};_0x117def(++_0x26ecfa);}(_0xc80c,0x12e));var _0xcc80=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0xc80c[_0x4c440b];return _0x2d48cf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcc80('0x0'));var BPromise=require(_0xcc80('0x1'));var rs=require(_0xcc80('0x2'));var fs=require('fs');var Redis=require(_0xcc80('0x3'));var db=require(_0xcc80('0x4'))['db'];var utils=require(_0xcc80('0x5'));var logger=require(_0xcc80('0x6'))(_0xcc80('0x7'));var config=require('../../config/environment');var jayson=require(_0xcc80('0x8'));var client=jayson[_0xcc80('0x9')][_0xcc80('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xdd792c,_0x3c8377,_0x21e163){return new BPromise(function(_0x3749ac,_0x15245b){return client[_0xcc80('0xb')](_0xdd792c,_0x21e163)['then'](function(_0x174248){logger[_0xcc80('0xc')](_0xcc80('0xd'),_0x3c8377,_0xcc80('0xe'));logger[_0xcc80('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x3c8377,_0xcc80('0xe'),JSON[_0xcc80('0x10')](_0x174248));if(_0x174248[_0xcc80('0x11')]){if(_0x174248[_0xcc80('0x11')][_0xcc80('0x12')]===0x1f4){logger[_0xcc80('0x11')](_0xcc80('0xd'),_0x3c8377,_0x174248[_0xcc80('0x11')][_0xcc80('0x13')]);return _0x15245b(_0x174248['error']['message']);}logger[_0xcc80('0x11')]('Condition,\x20%s,\x20%s',_0x3c8377,_0x174248[_0xcc80('0x11')][_0xcc80('0x13')]);return _0x3749ac(_0x174248[_0xcc80('0x11')][_0xcc80('0x13')]);}else{logger[_0xcc80('0xc')]('Condition,\x20%s,\x20%s',_0x3c8377,'request\x20sent');_0x3749ac(_0x174248[_0xcc80('0x14')][_0xcc80('0x13')]);}})[_0xcc80('0x15')](function(_0xd42a62){logger['error'](_0xcc80('0xd'),_0x3c8377,_0xd42a62);_0x15245b(_0xd42a62);});});} \ No newline at end of file +var _0xdb1d=['jayson/promise','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x2758f8,_0x49a1ee){var _0x1ef670=function(_0x9f86d0){while(--_0x9f86d0){_0x2758f8['push'](_0x2758f8['shift']());}};_0x1ef670(++_0x49a1ee);}(_0xdb1d,0xb3));var _0xddb1=function(_0x57555f,_0x3c6a1f){_0x57555f=_0x57555f-0x0;var _0xda0def=_0xdb1d[_0x57555f];return _0xda0def;};'use strict';var _=require(_0xddb1('0x0'));var util=require(_0xddb1('0x1'));var moment=require(_0xddb1('0x2'));var BPromise=require(_0xddb1('0x3'));var rs=require(_0xddb1('0x4'));var fs=require('fs');var Redis=require(_0xddb1('0x5'));var db=require(_0xddb1('0x6'))['db'];var utils=require(_0xddb1('0x7'));var logger=require(_0xddb1('0x8'))('rpc');var config=require(_0xddb1('0x9'));var jayson=require(_0xddb1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3532b4,_0x5c6379,_0x514336){return new BPromise(function(_0x122579,_0x3ea77c){return client['request'](_0x3532b4,_0x514336)[_0xddb1('0xb')](function(_0x227c15){logger[_0xddb1('0xc')](_0xddb1('0xd'),_0x5c6379,_0xddb1('0xe'));logger[_0xddb1('0xf')](_0xddb1('0x10'),_0x5c6379,'request\x20sent',JSON[_0xddb1('0x11')](_0x227c15));if(_0x227c15['error']){if(_0x227c15[_0xddb1('0x12')]['code']===0x1f4){logger['error'](_0xddb1('0xd'),_0x5c6379,_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);return _0x3ea77c(_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);}logger[_0xddb1('0x12')](_0xddb1('0xd'),_0x5c6379,_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);return _0x122579(_0x227c15[_0xddb1('0x12')][_0xddb1('0x13')]);}else{logger['info'](_0xddb1('0xd'),_0x5c6379,'request\x20sent');_0x122579(_0x227c15['result'][_0xddb1('0x13')]);}})[_0xddb1('0x14')](function(_0x1d8287){logger['error'](_0xddb1('0xd'),_0x5c6379,_0x1d8287);_0x3ea77c(_0x1d8287);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 20d2908..cfffb7d 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 _0xcecb=['connect-timeout','express','fs-extra','../../config/environment','put','/:id','isAuthenticated','exports','multer','util','path'];(function(_0x50cafa,_0xe33aeb){var _0x324ba5=function(_0x51d990){while(--_0x51d990){_0x50cafa['push'](_0x50cafa['shift']());}};_0x324ba5(++_0xe33aeb);}(_0xcecb,0x131));var _0xbcec=function(_0x14eba1,_0x1d1249){_0x14eba1=_0x14eba1-0x0;var _0x37de83=_0xcecb[_0x14eba1];return _0x37de83;};'use strict';var multer=require(_0xbcec('0x0'));var util=require(_0xbcec('0x1'));var path=require(_0xbcec('0x2'));var timeout=require(_0xbcec('0x3'));var express=require(_0xbcec('0x4'));var router=express['Router']();var fs_extra=require(_0xbcec('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbcec('0x6'));var controller=require('./condition.controller');router[_0xbcec('0x7')](_0xbcec('0x8'),auth[_0xbcec('0x9')](),controller['update']);router['delete'](_0xbcec('0x8'),auth[_0xbcec('0x9')](),controller['destroy']);module[_0xbcec('0xa')]=router; \ No newline at end of file +var _0x64e6=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./condition.controller','put','/:id','delete','isAuthenticated','destroy'];(function(_0x3bfc71,_0x3858e1){var _0x270d6f=function(_0x2c8ef7){while(--_0x2c8ef7){_0x3bfc71['push'](_0x3bfc71['shift']());}};_0x270d6f(++_0x3858e1);}(_0x64e6,0xb1));var _0x664e=function(_0x60932,_0x8122f4){_0x60932=_0x60932-0x0;var _0x4a201e=_0x64e6[_0x60932];return _0x4a201e;};'use strict';var multer=require(_0x664e('0x0'));var util=require(_0x664e('0x1'));var path=require(_0x664e('0x2'));var timeout=require(_0x664e('0x3'));var express=require(_0x664e('0x4'));var router=express[_0x664e('0x5')]();var fs_extra=require(_0x664e('0x6'));var auth=require(_0x664e('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x664e('0x8'));var controller=require(_0x664e('0x9'));router[_0x664e('0xa')](_0x664e('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x664e('0xc')](_0x664e('0xb'),auth[_0x664e('0xd')](),controller[_0x664e('0xe')]);module[_0x664e('0xf')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 8146698..400e46e 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 _0xef0d=['STRING','sequelize','exports','name','INTEGER'];(function(_0x4e7e47,_0x55801d){var _0x3b453c=function(_0x1c817d){while(--_0x1c817d){_0x4e7e47['push'](_0x4e7e47['shift']());}};_0x3b453c(++_0x55801d);}(_0xef0d,0x6a));var _0xdef0=function(_0x2113c2,_0x24ff71){_0x2113c2=_0x2113c2-0x0;var _0x4b7579=_0xef0d[_0x2113c2];return _0x4b7579;};'use strict';var Sequelize=require(_0xdef0('0x0'));module[_0xdef0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xdef0('0x2')},'OrderBy':{'type':Sequelize[_0xdef0('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xdef0('0x4')],'allowNull':!![]}}; \ No newline at end of file +var _0x7300=['exports','name','INTEGER','STRING','sequelize'];(function(_0x3ce82c,_0x519b0a){var _0xdfdc80=function(_0x4b5b8c){while(--_0x4b5b8c){_0x3ce82c['push'](_0x3ce82c['shift']());}};_0xdfdc80(++_0x519b0a);}(_0x7300,0x72));var _0x0730=function(_0x1912a0,_0x3a24a2){_0x1912a0=_0x1912a0-0x0;var _0x545a78=_0x7300[_0x1912a0];return _0x545a78;};'use strict';var Sequelize=require(_0x0730('0x0'));module[_0x0730('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0730('0x2')},'OrderBy':{'type':Sequelize[_0x0730('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x0730('0x4')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index ec34073..55163af 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 _0xaebd=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','destroy','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation'];(function(_0x4fc6d4,_0x15db90){var _0x3212cf=function(_0x3fd5ca){while(--_0x3fd5ca){_0x4fc6d4['push'](_0x4fc6d4['shift']());}};_0x3212cf(++_0x15db90);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x28192f,_0x4a619d){_0x28192f=_0x28192f-0x0;var _0x2ac42c=_0xaebd[_0x28192f];return _0x2ac42c;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['ContactItemType'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':!![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['update']=function(_0x2260c5,_0x10287e){if(_0x2260c5['body']['id']){delete _0x2260c5['body']['id'];}return db['ContactItemType'][_0xdaeb('0x46')]({'where':{'id':_0x2260c5[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](saveUpdates(_0x2260c5[_0xdaeb('0x49')],null))['then'](respondWithResult(_0x10287e,null))[_0xdaeb('0x47')](handleError(_0x10287e,null));};exports['destroy']=function(_0x25e58f,_0x1b87b2){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x25e58f[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x1b87b2,null))['then'](db['CmContactHasItem'][_0xdaeb('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x25e58f['params']['id']}}))[_0xdaeb('0x23')](removeEntity(_0x1b87b2,null))[_0xdaeb('0x47')](handleError(_0x1b87b2,null));}; \ No newline at end of file +var _0xd914=['count','set','Content-Range','apply','reject','update','then','destroy','ContactItemTypes','UserProfileResource','name','send','map','rawAttributes','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','options','ContactItemType','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','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'];(function(_0x416d75,_0x2c8e81){var _0x10af66=function(_0x48f136){while(--_0x48f136){_0x416d75['push'](_0x416d75['shift']());}};_0x10af66(++_0x2c8e81);}(_0xd914,0x17f));var _0x4d91=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0xd914[_0x912d27];return _0x31b918;};'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['ContactItemType'][_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('0x25')]=function(_0x4138c5,_0x645923){if(_0x4138c5[_0x4d91('0x4b')]['id']){delete _0x4138c5[_0x4d91('0x4b')]['id'];}return db[_0x4d91('0x41')][_0x4d91('0x49')]({'where':{'id':_0x4138c5[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x645923,null))[_0x4d91('0x26')](saveUpdates(_0x4138c5[_0x4d91('0x4b')],null))['then'](respondWithResult(_0x645923,null))['catch'](handleError(_0x645923,null));};exports['destroy']=function(_0x45cf4e,_0x10c1dd){return db[_0x4d91('0x41')]['find']({'where':{'id':_0x45cf4e[_0x4d91('0x47')]['id']}})[_0x4d91('0x26')](handleEntityNotFound(_0x10c1dd,null))[_0x4d91('0x26')](db['CmContactHasItem']['update']({'ItemTypeId':null},{'where':{'ItemTypeId':_0x45cf4e['params']['id']}}))[_0x4d91('0x26')](removeEntity(_0x10c1dd,null))[_0x4d91('0x45')](handleError(_0x10c1dd,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index e2f06bd..4198d96 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 _0x08d5=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./contactItemType.attributes','exports','define','ContactItemType','tools_contact_item_types','lodash','util'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x08d5,0x10c));var _0x508d=function(_0x1a868b,_0x2bdbc2){_0x1a868b=_0x1a868b-0x0;var _0x2fe828=_0x08d5[_0x1a868b];return _0x2fe828;};'use strict';var _=require(_0x508d('0x0'));var util=require(_0x508d('0x1'));var logger=require(_0x508d('0x2'))(_0x508d('0x3'));var moment=require(_0x508d('0x4'));var BPromise=require(_0x508d('0x5'));var rp=require(_0x508d('0x6'));var fs=require('fs');var path=require(_0x508d('0x7'));var rimraf=require(_0x508d('0x8'));var config=require(_0x508d('0x9'));var attributes=require(_0x508d('0xa'));module[_0x508d('0xb')]=function(_0x24bdb7,_0x4b0011){return _0x24bdb7[_0x508d('0xc')](_0x508d('0xd'),attributes,{'tableName':_0x508d('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0e74=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','define','ContactItemType','tools_contact_item_types'];(function(_0x284c11,_0x15eed3){var _0x43cc1d=function(_0x45e2c2){while(--_0x45e2c2){_0x284c11['push'](_0x284c11['shift']());}};_0x43cc1d(++_0x15eed3);}(_0x0e74,0x9a));var _0x40e7=function(_0x546e4a,_0x3a0819){_0x546e4a=_0x546e4a-0x0;var _0x398f06=_0x0e74[_0x546e4a];return _0x398f06;};'use strict';var _=require(_0x40e7('0x0'));var util=require(_0x40e7('0x1'));var logger=require('../../config/logger')(_0x40e7('0x2'));var moment=require(_0x40e7('0x3'));var BPromise=require(_0x40e7('0x4'));var rp=require(_0x40e7('0x5'));var fs=require('fs');var path=require(_0x40e7('0x6'));var rimraf=require(_0x40e7('0x7'));var config=require('../../config/environment');var attributes=require('./contactItemType.attributes');module['exports']=function(_0x5b311c,_0x5d0344){return _0x5b311c[_0x40e7('0x8')](_0x40e7('0x9'),attributes,{'tableName':_0x40e7('0xa'),'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 b23c803..a4a213b 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 _0x253c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','ContactItemType,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment'];(function(_0xb29dbd,_0x56f9f1){var _0x3a7edc=function(_0x2ba413){while(--_0x2ba413){_0xb29dbd['push'](_0xb29dbd['shift']());}};_0x3a7edc(++_0x56f9f1);}(_0x253c,0x13f));var _0xc253=function(_0x2acd64,_0x4e8ce8){_0x2acd64=_0x2acd64-0x0;var _0x3d3fce=_0x253c[_0x2acd64];return _0x3d3fce;};'use strict';var _=require(_0xc253('0x0'));var util=require(_0xc253('0x1'));var moment=require(_0xc253('0x2'));var BPromise=require(_0xc253('0x3'));var rs=require(_0xc253('0x4'));var fs=require('fs');var Redis=require(_0xc253('0x5'));var db=require(_0xc253('0x6'))['db'];var utils=require(_0xc253('0x7'));var logger=require(_0xc253('0x8'))(_0xc253('0x9'));var config=require(_0xc253('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xc253('0xb')][_0xc253('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52b88f,_0x1e84f4,_0x3c60c8){return new BPromise(function(_0x51ba94,_0x2aab04){return client[_0xc253('0xd')](_0x52b88f,_0x3c60c8)[_0xc253('0xe')](function(_0x1b207b){logger['info'](_0xc253('0xf'),_0x1e84f4,'request\x20sent');logger[_0xc253('0x10')]('ContactItemType,\x20%s,\x20%s,\x20%s',_0x1e84f4,_0xc253('0x11'),JSON[_0xc253('0x12')](_0x1b207b));if(_0x1b207b['error']){if(_0x1b207b[_0xc253('0x13')][_0xc253('0x14')]===0x1f4){logger[_0xc253('0x13')](_0xc253('0xf'),_0x1e84f4,_0x1b207b[_0xc253('0x13')][_0xc253('0x15')]);return _0x2aab04(_0x1b207b[_0xc253('0x13')][_0xc253('0x15')]);}logger[_0xc253('0x13')]('ContactItemType,\x20%s,\x20%s',_0x1e84f4,_0x1b207b[_0xc253('0x13')][_0xc253('0x15')]);return _0x51ba94(_0x1b207b[_0xc253('0x13')]['message']);}else{logger['info'](_0xc253('0xf'),_0x1e84f4,_0xc253('0x11'));_0x51ba94(_0x1b207b[_0xc253('0x16')][_0xc253('0x15')]);}})['catch'](function(_0x4ca357){logger[_0xc253('0x13')](_0xc253('0xf'),_0x1e84f4,_0x4ca357);_0x2aab04(_0x4ca357);});});} \ No newline at end of file +var _0xe74a=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x115f75,_0x3e6b57){var _0x4e509a=function(_0x3acd7a){while(--_0x3acd7a){_0x115f75['push'](_0x115f75['shift']());}};_0x4e509a(++_0x3e6b57);}(_0xe74a,0x127));var _0xae74=function(_0x39a2d6,_0x477459){_0x39a2d6=_0x39a2d6-0x0;var _0x23af66=_0xe74a[_0x39a2d6];return _0x23af66;};'use strict';var _=require(_0xae74('0x0'));var util=require(_0xae74('0x1'));var moment=require('moment');var BPromise=require(_0xae74('0x2'));var rs=require(_0xae74('0x3'));var fs=require('fs');var Redis=require(_0xae74('0x4'));var db=require(_0xae74('0x5'))['db'];var utils=require(_0xae74('0x6'));var logger=require('../../config/logger')(_0xae74('0x7'));var config=require('../../config/environment');var jayson=require(_0xae74('0x8'));var client=jayson[_0xae74('0x9')][_0xae74('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e19e6,_0x2dc15e,_0x122b87){return new BPromise(function(_0x13cc22,_0x458bf7){return client[_0xae74('0xb')](_0x1e19e6,_0x122b87)[_0xae74('0xc')](function(_0x6edd7b){logger[_0xae74('0xd')](_0xae74('0xe'),_0x2dc15e,_0xae74('0xf'));logger['debug'](_0xae74('0x10'),_0x2dc15e,_0xae74('0xf'),JSON[_0xae74('0x11')](_0x6edd7b));if(_0x6edd7b['error']){if(_0x6edd7b[_0xae74('0x12')][_0xae74('0x13')]===0x1f4){logger[_0xae74('0x12')](_0xae74('0xe'),_0x2dc15e,_0x6edd7b['error'][_0xae74('0x14')]);return _0x458bf7(_0x6edd7b[_0xae74('0x12')][_0xae74('0x14')]);}logger['error'](_0xae74('0xe'),_0x2dc15e,_0x6edd7b[_0xae74('0x12')][_0xae74('0x14')]);return _0x13cc22(_0x6edd7b[_0xae74('0x12')][_0xae74('0x14')]);}else{logger[_0xae74('0xd')](_0xae74('0xe'),_0x2dc15e,_0xae74('0xf'));_0x13cc22(_0x6edd7b[_0xae74('0x15')]['message']);}})[_0xae74('0x16')](function(_0x148a02){logger['error'](_0xae74('0xe'),_0x2dc15e,_0x148a02);_0x458bf7(_0x148a02);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 4df649f..fd3cfc2 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 _0xe86b=['isAuthenticated','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','get','index','/:id'];(function(_0x3391d1,_0x33e62a){var _0x33d764=function(_0x9f2e7d){while(--_0x9f2e7d){_0x3391d1['push'](_0x3391d1['shift']());}};_0x33d764(++_0x33e62a);}(_0xe86b,0x8e));var _0xbe86=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe86b[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0xbe86('0x0'));var util=require(_0xbe86('0x1'));var path=require(_0xbe86('0x2'));var timeout=require(_0xbe86('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbe86('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./contactItemType.controller');router[_0xbe86('0x5')]('/',auth['isAuthenticated'](),controller[_0xbe86('0x6')]);router[_0xbe86('0x5')](_0xbe86('0x7'),auth[_0xbe86('0x8')](),controller[_0xbe86('0x9')]);router[_0xbe86('0xa')]('/',auth[_0xbe86('0x8')](),controller['create']);router['put'](_0xbe86('0x7'),auth[_0xbe86('0x8')](),controller[_0xbe86('0xb')]);router[_0xbe86('0xc')](_0xbe86('0x7'),auth['isAuthenticated'](),controller[_0xbe86('0xd')]);module[_0xbe86('0xe')]=router; \ No newline at end of file +var _0x4262=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./contactItemType.controller','get','isAuthenticated','index','/:id','show','post','create','update','destroy','exports','multer'];(function(_0x136e98,_0x1825aa){var _0x15f529=function(_0x252cde){while(--_0x252cde){_0x136e98['push'](_0x136e98['shift']());}};_0x15f529(++_0x1825aa);}(_0x4262,0x10d));var _0x2426=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x4262[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x2426('0x0'));var util=require('util');var path=require(_0x2426('0x1'));var timeout=require(_0x2426('0x2'));var express=require(_0x2426('0x3'));var router=express[_0x2426('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2426('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2426('0x6'));var controller=require(_0x2426('0x7'));router[_0x2426('0x8')]('/',auth[_0x2426('0x9')](),controller[_0x2426('0xa')]);router[_0x2426('0x8')](_0x2426('0xb'),auth[_0x2426('0x9')](),controller[_0x2426('0xc')]);router[_0x2426('0xd')]('/',auth[_0x2426('0x9')](),controller[_0x2426('0xe')]);router['put'](_0x2426('0xb'),auth[_0x2426('0x9')](),controller[_0x2426('0xf')]);router['delete'](_0x2426('0xb'),auth[_0x2426('0x9')](),controller[_0x2426('0x10')]);module[_0x2426('0x11')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 8443a68..6736c1c 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(_0x24d91e,_0x5f0df4){var _0x34d6f6=function(_0x43c778){while(--_0x43c778){_0x24d91e['push'](_0x24d91e['shift']());}};_0x34d6f6(++_0x5f0df4);}(_0x757a,0xde));var _0xa757=function(_0x53d02c,_0xdc9ab6){_0x53d02c=_0x53d02c-0x0;var _0x36d9a2=_0x757a[_0x53d02c];return _0x36d9a2;};'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 _0xb10b=['name','sequelize','STRING'];(function(_0x57f23f,_0x5142dd){var _0x3040c8=function(_0x21416b){while(--_0x21416b){_0x57f23f['push'](_0x57f23f['shift']());}};_0x3040c8(++_0x5142dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x19416d,_0x54c85e){_0x19416d=_0x19416d-0x0;var _0x17528f=_0xb10b[_0x19416d];return _0x17528f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index d57f27e..d51cc8a 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 _0x2533=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CustomDashboards','find','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','role','destroy','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie3','attrOpenchannelAccounts','web-report','reportType','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','findOne','pick','getItems','eml-format','rimraf','zip-dir','request-promise','moment','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x2493a8,_0x5a240d){var _0x2b06c9=function(_0x198d3c){while(--_0x198d3c){_0x2493a8['push'](_0x2493a8['shift']());}};_0x2b06c9(++_0x5a240d);}(_0x2533,0xf9));var _0x3253=function(_0x54de5d,_0x1f8b26){_0x54de5d=_0x54de5d-0x0;var _0x1b349e=_0x2533[_0x54de5d];return _0x1b349e;};'use strict';var emlformat=require(_0x3253('0x0'));var rimraf=require(_0x3253('0x1'));var zipdir=require(_0x3253('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3253('0x3'));var moment=require(_0x3253('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3253('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x3253('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3253('0x7'));var _=require(_0x3253('0x8'));var squel=require(_0x3253('0x9'));var crypto=require(_0x3253('0xa'));var jsforce=require(_0x3253('0xb'));var deskjs=require(_0x3253('0xc'));var toCsv=require(_0x3253('0x6'));var querystring=require(_0x3253('0xd'));var Papa=require(_0x3253('0xe'));var Redis=require('ioredis');var authService=require(_0x3253('0xf'));var qs=require(_0x3253('0x10'));var as=require(_0x3253('0x11'));var hardwareService=require(_0x3253('0x12'));var logger=require(_0x3253('0x13'))(_0x3253('0x14'));var utils=require(_0x3253('0x15'));var config=require(_0x3253('0x16'));var licenseUtil=require(_0x3253('0x17'));var db=require('../../mysqldb')['db'];config[_0x3253('0x18')]=_[_0x3253('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3253('0x1a'))(new Redis(config['redis']));require(_0x3253('0x1b'))['register'](socket);function respondWithStatusCode(_0x4ef5ce,_0x450ae0){_0x450ae0=_0x450ae0||0xcc;return function(_0x2fcfb0){if(_0x2fcfb0){return _0x4ef5ce[_0x3253('0x1c')](_0x450ae0);}return _0x4ef5ce[_0x3253('0x1d')](_0x450ae0)[_0x3253('0x1e')]();};}function respondWithResult(_0x308337,_0x4d4826){_0x4d4826=_0x4d4826||0xc8;return function(_0xa1271e){if(_0xa1271e){return _0x308337[_0x3253('0x1d')](_0x4d4826)[_0x3253('0x1f')](_0xa1271e);}};}function respondWithFilteredResult(_0x5ecef0,_0x1b65ed){return function(_0x293d23){if(_0x293d23){var _0x3b2618=typeof _0x1b65ed[_0x3253('0x20')]===_0x3253('0x21')&&typeof _0x1b65ed[_0x3253('0x22')]===_0x3253('0x21');var _0x33f88b=_0x293d23[_0x3253('0x23')];var _0x68d6e1=_0x3b2618?0x0:_0x1b65ed[_0x3253('0x20')];var _0x21351f=_0x3b2618?_0x293d23['count']:_0x1b65ed[_0x3253('0x20')]+_0x1b65ed['limit'];var _0x1f27f6;if(_0x21351f>=_0x33f88b){_0x21351f=_0x33f88b;_0x1f27f6=0xc8;}else{_0x1f27f6=0xce;}_0x5ecef0[_0x3253('0x1d')](_0x1f27f6);return _0x5ecef0[_0x3253('0x24')](_0x3253('0x25'),_0x68d6e1+'-'+_0x21351f+'/'+_0x33f88b)[_0x3253('0x1f')](_0x293d23);}return null;};}function patchUpdates(_0x1a0fa8){return function(_0xd08f6d){try{jsonpatch[_0x3253('0x26')](_0xd08f6d,_0x1a0fa8,!![]);}catch(_0x52a157){return BPromise[_0x3253('0x27')](_0x52a157);}return _0xd08f6d[_0x3253('0x28')]();};}function saveUpdates(_0x13cb37,_0x409536){return function(_0x15a586){if(_0x15a586){return _0x15a586[_0x3253('0x29')](_0x13cb37)[_0x3253('0x2a')](function(_0x16cd11){return _0x16cd11;});}return null;};}function removeEntity(_0x3c568e,_0x499d75){return function(_0x5d73a1){if(_0x5d73a1){return _0x5d73a1['destroy']()[_0x3253('0x2a')](function(){var _0x36eb60=_0x5d73a1[_0x3253('0x2b')]({'plain':!![]});var _0x4c9571='CustomDashboards';return db['UserProfileResource']['destroy']({'where':{'type':_0x4c9571,'resourceId':_0x36eb60['id']}})[_0x3253('0x2a')](function(){return _0x5d73a1;});})['then'](function(){_0x3c568e[_0x3253('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f6c4,_0x31a1ef){return function(_0x1efd4b){if(!_0x1efd4b){_0x14f6c4[_0x3253('0x1c')](0x194);}return _0x1efd4b;};}function handleError(_0x16fb24,_0x502550){_0x502550=_0x502550||0x1f4;return function(_0x332269){logger['error'](_0x332269[_0x3253('0x2c')]);if(_0x332269[_0x3253('0x2d')]){delete _0x332269[_0x3253('0x2d')];}_0x16fb24[_0x3253('0x1d')](_0x502550)[_0x3253('0x2e')](_0x332269);};}exports[_0x3253('0x2f')]=function(_0x8d645b,_0x28efc8){var _0x230ffc={},_0x277ba3={},_0x8ac132={'count':0x0,'rows':[]};var _0x5f4a8f=_[_0x3253('0x30')](db[_0x3253('0x31')][_0x3253('0x32')],function(_0x365d58){return{'name':_0x365d58[_0x3253('0x33')],'type':_0x365d58[_0x3253('0x34')][_0x3253('0x35')]};});_0x277ba3[_0x3253('0x36')]=_[_0x3253('0x30')](_0x5f4a8f,_0x3253('0x2d'));_0x277ba3['query']=_[_0x3253('0x37')](_0x8d645b['query']);_0x277ba3[_0x3253('0x38')]=_[_0x3253('0x39')](_0x277ba3[_0x3253('0x36')],_0x277ba3[_0x3253('0x3a')]);_0x230ffc[_0x3253('0x3b')]=_['intersection'](_0x277ba3[_0x3253('0x36')],qs[_0x3253('0x3c')](_0x8d645b[_0x3253('0x3a')][_0x3253('0x3c')]));_0x230ffc[_0x3253('0x3b')]=_0x230ffc[_0x3253('0x3b')][_0x3253('0x3d')]?_0x230ffc[_0x3253('0x3b')]:_0x277ba3[_0x3253('0x36')];if(!_0x8d645b[_0x3253('0x3a')][_0x3253('0x3e')]('nolimit')){_0x230ffc[_0x3253('0x22')]=qs['limit'](_0x8d645b[_0x3253('0x3a')][_0x3253('0x22')]);_0x230ffc['offset']=qs[_0x3253('0x20')](_0x8d645b[_0x3253('0x3a')]['offset']);}_0x230ffc[_0x3253('0x3f')]=qs['sort'](_0x8d645b[_0x3253('0x3a')][_0x3253('0x40')]);_0x230ffc[_0x3253('0x41')]=qs[_0x3253('0x38')](_['pick'](_0x8d645b[_0x3253('0x3a')],_0x277ba3[_0x3253('0x38')]),_0x5f4a8f);if(_0x8d645b['query']['filter']){_0x230ffc[_0x3253('0x41')]=_[_0x3253('0x42')](_0x230ffc[_0x3253('0x41')],{'$or':_['map'](_0x5f4a8f,function(_0x478876){if(_0x478876['type']!==_0x3253('0x43')){var _0x4a3705={};_0x4a3705[_0x478876['name']]={'$like':'%'+_0x8d645b[_0x3253('0x3a')][_0x3253('0x44')]+'%'};return _0x4a3705;}})});}_0x230ffc=_['merge']({},_0x230ffc,_0x8d645b[_0x3253('0x45')]);var _0x3ad6e6={'where':_0x230ffc['where']};return db[_0x3253('0x31')][_0x3253('0x23')](_0x3ad6e6)[_0x3253('0x2a')](function(_0x31fed8){_0x8ac132[_0x3253('0x23')]=_0x31fed8;if(_0x8d645b[_0x3253('0x3a')]['includeAll']){_0x230ffc[_0x3253('0x46')]=[{'all':!![]}];}return db[_0x3253('0x31')][_0x3253('0x47')](_0x230ffc);})['then'](function(_0x2c563e){_0x8ac132[_0x3253('0x48')]=_0x2c563e;return _0x8ac132;})['then'](respondWithFilteredResult(_0x28efc8,_0x230ffc))[_0x3253('0x49')](handleError(_0x28efc8,null));};exports[_0x3253('0x4a')]=function(_0x18e14f,_0x3d6b0d){var _0xb4fdf6={'raw':![],'where':{'id':_0x18e14f[_0x3253('0x4b')]['id']}},_0x34da0b={};_0x34da0b['model']=_['keys'](db[_0x3253('0x31')][_0x3253('0x32')]);_0x34da0b[_0x3253('0x3a')]=_[_0x3253('0x37')](_0x18e14f[_0x3253('0x3a')]);_0x34da0b[_0x3253('0x38')]=_[_0x3253('0x39')](_0x34da0b[_0x3253('0x36')],_0x34da0b[_0x3253('0x3a')]);_0xb4fdf6[_0x3253('0x3b')]=_['intersection'](_0x34da0b[_0x3253('0x36')],qs[_0x3253('0x3c')](_0x18e14f[_0x3253('0x3a')][_0x3253('0x3c')]));_0xb4fdf6[_0x3253('0x3b')]=_0xb4fdf6[_0x3253('0x3b')]['length']?_0xb4fdf6['attributes']:_0x34da0b[_0x3253('0x36')];if(_0x18e14f[_0x3253('0x3a')][_0x3253('0x4c')]){_0xb4fdf6[_0x3253('0x46')]=[{'all':!![]}];}_0xb4fdf6=_[_0x3253('0x42')]({},_0xb4fdf6,_0x18e14f[_0x3253('0x45')]);return db['Dashboard']['find'](_0xb4fdf6)[_0x3253('0x2a')](handleEntityNotFound(_0x3d6b0d,null))[_0x3253('0x2a')](respondWithResult(_0x3d6b0d,null))[_0x3253('0x49')](handleError(_0x3d6b0d,null));};exports[_0x3253('0x4d')]=function(_0x1f369a,_0x523cb7){return db[_0x3253('0x31')][_0x3253('0x4d')](_0x1f369a[_0x3253('0x4e')],{})[_0x3253('0x2a')](function(_0x4aad8e){var _0x3b85fe=_0x1f369a[_0x3253('0x4f')][_0x3253('0x2b')]({'plain':!![]});if(!_0x3b85fe)throw new Error(_0x3253('0x50'));if(_0x3b85fe['role']==='user'){var _0x302b64=_0x4aad8e[_0x3253('0x2b')]({'plain':!![]});var _0x40ac3d=_0x3253('0x51');return db['UserProfileSection'][_0x3253('0x52')]({'where':{'name':_0x40ac3d,'userProfileId':_0x3b85fe[_0x3253('0x53')]},'raw':!![]})['then'](function(_0x40b40d){if(_0x40b40d&&_0x40b40d[_0x3253('0x54')]===0x0){return db[_0x3253('0x55')][_0x3253('0x4d')]({'name':_0x302b64[_0x3253('0x2d')],'resourceId':_0x302b64['id'],'type':_0x40b40d[_0x3253('0x2d')],'sectionId':_0x40b40d['id']},{})['then'](function(){return _0x4aad8e;});}else{return _0x4aad8e;}})[_0x3253('0x49')](function(_0x3b7f1d){logger[_0x3253('0x56')](_0x3253('0x57'),_0x3b7f1d);throw _0x3b7f1d;});}return _0x4aad8e;})['then'](respondWithResult(_0x523cb7,0xc9))[_0x3253('0x49')](handleError(_0x523cb7,null));};exports[_0x3253('0x58')]=function(_0x179953,_0x2eac95){var _0x9a09d7={'where':{'id':_0x179953['params']['id']}},_0x406f87={};_0x406f87[_0x3253('0x36')]=_[_0x3253('0x37')](db[_0x3253('0x31')][_0x3253('0x32')]);_0x9a09d7[_0x3253('0x3b')]=_['intersection'](_0x406f87[_0x3253('0x36')],qs[_0x3253('0x3c')](_0x179953[_0x3253('0x3a')][_0x3253('0x3c')]));_0x9a09d7[_0x3253('0x3b')]=_0x9a09d7[_0x3253('0x3b')][_0x3253('0x3d')]?_0x9a09d7[_0x3253('0x3b')]:_0x406f87[_0x3253('0x36')];if(_0x179953[_0x3253('0x3a')][_0x3253('0x4c')]){_0x9a09d7['include']=[{'all':!![]}];}_0x9a09d7=_[_0x3253('0x42')]({},_0x9a09d7,_0x179953[_0x3253('0x45')]);return db[_0x3253('0x31')]['find'](_0x9a09d7)[_0x3253('0x2a')](handleEntityNotFound(_0x2eac95,null))[_0x3253('0x2a')](function(_0x24600e){if(_0x24600e){var _0x1cf66b=_0x24600e[_0x3253('0x2b')]({'plain':!![]});_0x1cf66b=qs[_0x3253('0x59')](_0x1cf66b,['id','createdAt',_0x3253('0x5a')]);_0x179953['body']=_['omit'](_0x179953[_0x3253('0x4e')],['id',_0x3253('0x5b'),_0x3253('0x5a')]);return db[_0x3253('0x31')][_0x3253('0x4d')](_[_0x3253('0x42')](_0x1cf66b,_0x179953['body']),{'include':_0x179953[_0x3253('0x3a')][_0x3253('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x429803){var _0x32643c=_0x179953[_0x3253('0x4f')][_0x3253('0x2b')]({'plain':!![]});if(!_0x32643c)throw new Error(_0x3253('0x50'));if(_0x32643c[_0x3253('0x5c')]==='user'){var _0x4e23f0=_0x429803[_0x3253('0x2b')]({'plain':!![]});var _0x365c02=_0x3253('0x51');return db['UserProfileSection']['find']({'where':{'name':_0x365c02,'userProfileId':_0x32643c[_0x3253('0x53')]},'raw':!![]})['then'](function(_0x3b3698){if(_0x3b3698&&_0x3b3698[_0x3253('0x54')]===0x0){return db[_0x3253('0x55')][_0x3253('0x4d')]({'name':_0x4e23f0[_0x3253('0x2d')],'resourceId':_0x4e23f0['id'],'type':_0x3b3698[_0x3253('0x2d')],'sectionId':_0x3b3698['id']},{})[_0x3253('0x2a')](function(){return _0x429803;});}else{return _0x429803;}})[_0x3253('0x49')](function(_0x1697e8){logger[_0x3253('0x56')](_0x3253('0x57'),_0x1697e8);throw _0x1697e8;});}return _0x429803;});}})[_0x3253('0x2a')](respondWithResult(_0x2eac95,0xc9))['catch'](handleError(_0x2eac95,null));};exports[_0x3253('0x29')]=function(_0x4a41b3,_0x3b244d){if(_0x4a41b3['body']['id']){delete _0x4a41b3[_0x3253('0x4e')]['id'];}return db['Dashboard'][_0x3253('0x52')]({'where':{'id':_0x4a41b3[_0x3253('0x4b')]['id']}})[_0x3253('0x2a')](handleEntityNotFound(_0x3b244d,null))[_0x3253('0x2a')](saveUpdates(_0x4a41b3['body'],null))['then'](respondWithResult(_0x3b244d,null))[_0x3253('0x49')](handleError(_0x3b244d,null));};exports[_0x3253('0x5d')]=function(_0x370c1a,_0xcb3eab){return db[_0x3253('0x31')]['find']({'where':{'id':_0x370c1a[_0x3253('0x4b')]['id']}})[_0x3253('0x2a')](handleEntityNotFound(_0xcb3eab,null))[_0x3253('0x2a')](removeEntity(_0xcb3eab,null))[_0x3253('0x49')](handleError(_0xcb3eab,null));};function widgetAttributes(_0x3a5500){try{switch(_0x3a5500[_0x3253('0x34')]){case'iframe':return[{'name':'attrUrl','value':_0x3a5500[_0x3253('0x5e')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500['attrs'][0x0][_0x3253('0x60')]:undefined)||_0x3253('0x61')}];case _0x3253('0x62'):return[{'name':_0x3253('0x63'),'value':_0x3a5500[_0x3253('0x63')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x60')]:undefined)||''}];case _0x3253('0x64'):return[{'name':_0x3253('0x65'),'value':_0x3a5500[_0x3253('0x65')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500['attrs'][0x0]?_0x3a5500[_0x3253('0x5f')][0x0]['value']:undefined)||_0x3253('0x66')},{'name':_0x3253('0x67'),'value':_0x3a5500['attrTimezone']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500[_0x3253('0x5f')][0x1][_0x3253('0x60')]:undefined)||_0x3253('0x68')},{'name':_0x3253('0x69'),'value':_0x3a5500['attrFontSize']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x2]?_0x3a5500['attrs'][0x2][_0x3253('0x60')]:undefined)||0xc}];case _0x3253('0x6a'):return[{'name':_0x3253('0x6b'),'value':_0x3a5500[_0x3253('0x6b')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x60')]:undefined)||'total'},{'name':_0x3253('0x6c'),'value':_0x3a5500[_0x3253('0x6c')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500[_0x3253('0x5f')][0x1][_0x3253('0x60')]:undefined)||[]},{'name':_0x3253('0x69'),'value':_0x3a5500[_0x3253('0x69')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x2]?_0x3a5500['attrs'][0x2][_0x3253('0x60')]:undefined)||0x14},{'name':_0x3253('0x6d'),'value':_0x3a5500['attrChannel']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x3]?_0x3a5500[_0x3253('0x5f')][0x3][_0x3253('0x60')]:undefined)||_0x3253('0x6e')},{'name':_0x3253('0x6f'),'value':_0x3a5500['attrEmailAccounts']||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x4]?_0x3a5500[_0x3253('0x5f')][0x4][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x70'),'value':_0x3a5500['attrFaxAccounts']||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x5]?_0x3a5500['attrs'][0x5][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x71'),'value':_0x3a5500[_0x3253('0x71')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500['attrs'][0x6]?_0x3a5500[_0x3253('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x3a5500['attrOpenchannelAccounts']||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x7]?_0x3a5500[_0x3253('0x5f')][0x7][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x72'),'value':_0x3a5500[_0x3253('0x72')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500['attrs'][0x8]?_0x3a5500[_0x3253('0x5f')][0x8][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x73'),'value':_0x3a5500[_0x3253('0x73')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x9]?_0x3a5500['attrs'][0x9][_0x3253('0x60')]:undefined)||''}];case _0x3253('0x74'):case _0x3253('0x75'):return[{'name':'attrSerie1','value':_0x3a5500[_0x3253('0x76')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x60')]:undefined)||_0x3253('0x77')},{'name':'attrSerie2','value':_0x3a5500['attrSerie2']||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500[_0x3253('0x5f')][0x1]['value']:undefined)||null},{'name':_0x3253('0x78'),'value':_0x3a5500[_0x3253('0x78')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x2]?_0x3a5500[_0x3253('0x5f')][0x2]['value']:undefined)||null},{'name':_0x3253('0x6c'),'value':_0x3a5500[_0x3253('0x6c')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x3]?_0x3a5500[_0x3253('0x5f')][0x3][_0x3253('0x60')]:undefined)||[]},{'name':_0x3253('0x6d'),'value':_0x3a5500[_0x3253('0x6d')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x4]?_0x3a5500[_0x3253('0x5f')][0x4][_0x3253('0x60')]:undefined)||_0x3253('0x6e')},{'name':_0x3253('0x6f'),'value':_0x3a5500[_0x3253('0x6f')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x5]?_0x3a5500['attrs'][0x5][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x70'),'value':_0x3a5500[_0x3253('0x70')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x6]?_0x3a5500['attrs'][0x6][_0x3253('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x3a5500[_0x3253('0x71')]||(_0x3a5500['attrs']&&_0x3a5500['attrs'][0x7]?_0x3a5500['attrs'][0x7][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x79'),'value':_0x3a5500[_0x3253('0x79')]||(_0x3a5500['attrs']&&_0x3a5500[_0x3253('0x5f')][0x8]?_0x3a5500[_0x3253('0x5f')][0x8][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x72'),'value':_0x3a5500[_0x3253('0x72')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x9]?_0x3a5500['attrs'][0x9][_0x3253('0x60')]:undefined)||''},{'name':_0x3253('0x73'),'value':_0x3a5500[_0x3253('0x73')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0xa]?_0x3a5500[_0x3253('0x5f')][0xa]['value']:undefined)||''}];case _0x3253('0x7a'):return[{'name':'attrReport','type':_0x3a5500[_0x3253('0x7b')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500[_0x3253('0x5f')][0x0][_0x3253('0x34')]:undefined)||null,'value':_0x3a5500[_0x3253('0x7c')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x0]?_0x3a5500['attrs'][0x0][_0x3253('0x60')]:undefined)||null},{'name':_0x3253('0x7d'),'value':_0x3a5500[_0x3253('0x7d')]||(_0x3a5500[_0x3253('0x5f')]&&_0x3a5500[_0x3253('0x5f')][0x1]?_0x3a5500['attrs'][0x1][_0x3253('0x60')]:undefined)||0x0}];default:return[];}}catch(_0x1c2fb7){logger[_0x3253('0x56')](_0x3253('0x7e'),JSON['stringify'](_0x1c2fb7));return[];}}exports[_0x3253('0x7f')]=function(_0x2df873,_0x14888e,_0x2d9910){if(_0x2df873[_0x3253('0x4e')]['id']){delete _0x2df873[_0x3253('0x4e')]['id'];}return db[_0x3253('0x31')][_0x3253('0x52')]({'where':{'id':_0x2df873[_0x3253('0x4b')]['id']}})['then'](handleEntityNotFound(_0x14888e,null))[_0x3253('0x2a')](function(_0x4bd708){if(_0x4bd708){_0x2df873['body'][_0x3253('0x80')]=_0x4bd708['id'];_0x2df873[_0x3253('0x4e')]['attrs']=widgetAttributes(_0x2df873[_0x3253('0x4e')]);return db[_0x3253('0x81')]['create'](_0x2df873[_0x3253('0x4e')]);}})['then'](respondWithResult(_0x14888e,null))[_0x3253('0x49')](handleError(_0x14888e,null));};exports['getItems']=function(_0xb858e8,_0x439fab,_0x308a2f){var _0x1c0494={};var _0x4a9dd4={};var _0xfa6094;var _0x3e3fd6;return db[_0x3253('0x31')][_0x3253('0x82')]({'where':{'id':_0xb858e8['params']['id']}})['then'](handleEntityNotFound(_0x439fab,null))[_0x3253('0x2a')](function(_0x127ff3){if(_0x127ff3){_0xfa6094=_0x127ff3;_0x4a9dd4['model']=_[_0x3253('0x37')](db[_0x3253('0x81')][_0x3253('0x32')]);_0x4a9dd4[_0x3253('0x3a')]=_[_0x3253('0x37')](_0xb858e8[_0x3253('0x3a')]);_0x4a9dd4['filters']=_['intersection'](_0x4a9dd4[_0x3253('0x36')],_0x4a9dd4['query']);_0x1c0494[_0x3253('0x3b')]=_[_0x3253('0x39')](_0x4a9dd4[_0x3253('0x36')],qs[_0x3253('0x3c')](_0xb858e8[_0x3253('0x3a')][_0x3253('0x3c')]));_0x1c0494[_0x3253('0x3b')]=_0x1c0494[_0x3253('0x3b')][_0x3253('0x3d')]?_0x1c0494[_0x3253('0x3b')]:_0x4a9dd4['model'];_0x1c0494[_0x3253('0x3f')]=qs[_0x3253('0x40')](_0xb858e8[_0x3253('0x3a')]['sort']);_0x1c0494[_0x3253('0x41')]=qs[_0x3253('0x38')](_[_0x3253('0x83')](_0xb858e8[_0x3253('0x3a')],_0x4a9dd4['filters']));if(_0xb858e8[_0x3253('0x3a')][_0x3253('0x44')]){_0x1c0494[_0x3253('0x41')]=_['merge'](_0x1c0494[_0x3253('0x41')],{'$or':_['map'](_0x1c0494[_0x3253('0x3b')],function(_0x45e1a3){var _0x5ef3ab={};_0x5ef3ab[_0x45e1a3]={'$like':'%'+_0xb858e8[_0x3253('0x3a')][_0x3253('0x44')]+'%'};return _0x5ef3ab;})});}_0x1c0494=_[_0x3253('0x42')]({},_0x1c0494,_0xb858e8[_0x3253('0x45')]);return _0xfa6094['getItems'](_0x1c0494);}})[_0x3253('0x2a')](function(_0xcc9f94){if(_0xcc9f94){_0x3e3fd6=_0xcc9f94[_0x3253('0x3d')];if(!_0xb858e8[_0x3253('0x3a')][_0x3253('0x3e')]('nolimit')){_0x1c0494[_0x3253('0x22')]=qs[_0x3253('0x22')](_0xb858e8[_0x3253('0x3a')]['limit']);_0x1c0494[_0x3253('0x20')]=qs[_0x3253('0x20')](_0xb858e8['query'][_0x3253('0x20')]);}return _0xfa6094[_0x3253('0x84')](_0x1c0494);}})[_0x3253('0x2a')](function(_0x29b192){if(_0x29b192){return _0x29b192?{'count':_0x3e3fd6,'rows':_0x29b192}:null;}})[_0x3253('0x2a')](respondWithResult(_0x439fab,null))[_0x3253('0x49')](handleError(_0x439fab,null));}; \ No newline at end of file +var _0xe152=['https://','custom','attrPath','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','get','sendStatus','error','stack','name','index','map','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','Dashboard','includeAll','include','findAll','rows','show','params','rawAttributes','create','body','user','role','CustomDashboards','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','clone','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value'];(function(_0x404cbf,_0x2daecc){var _0x2602ee=function(_0x409c4c){while(--_0x409c4c){_0x404cbf['push'](_0x404cbf['shift']());}};_0x2602ee(++_0x2daecc);}(_0xe152,0xa6));var _0x2e15=function(_0x36c59a,_0x132d1d){_0x36c59a=_0x36c59a-0x0;var _0x2f1375=_0xe152[_0x36c59a];return _0x2f1375;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2e15('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e15('0x1'));var rp=require(_0x2e15('0x2'));var moment=require(_0x2e15('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2e15('0x4'));var util=require(_0x2e15('0x5'));var path=require('path');var sox=require(_0x2e15('0x6'));var csv=require(_0x2e15('0x7'));var ejs=require(_0x2e15('0x8'));var fs=require('fs');var fs_extra=require(_0x2e15('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e15('0xa'));var jsforce=require(_0x2e15('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x2e15('0x7'));var querystring=require(_0x2e15('0xc'));var Papa=require(_0x2e15('0xd'));var Redis=require(_0x2e15('0xe'));var authService=require(_0x2e15('0xf'));var qs=require(_0x2e15('0x10'));var as=require(_0x2e15('0x11'));var hardwareService=require(_0x2e15('0x12'));var logger=require(_0x2e15('0x13'))(_0x2e15('0x14'));var utils=require(_0x2e15('0x15'));var config=require(_0x2e15('0x16'));var licenseUtil=require(_0x2e15('0x17'));var db=require(_0x2e15('0x18'))['db'];config[_0x2e15('0x19')]=_[_0x2e15('0x1a')](config[_0x2e15('0x19')],{'host':_0x2e15('0x1b'),'port':0x18eb});var socket=require(_0x2e15('0x1c'))(new Redis(config[_0x2e15('0x19')]));require('./dashboard.socket')[_0x2e15('0x1d')](socket);function respondWithStatusCode(_0xd507d6,_0xf76c3d){_0xf76c3d=_0xf76c3d||0xcc;return function(_0x1f438c){if(_0x1f438c){return _0xd507d6['sendStatus'](_0xf76c3d);}return _0xd507d6[_0x2e15('0x1e')](_0xf76c3d)[_0x2e15('0x1f')]();};}function respondWithResult(_0x131383,_0x2a192d){_0x2a192d=_0x2a192d||0xc8;return function(_0x4cdf1e){if(_0x4cdf1e){return _0x131383[_0x2e15('0x1e')](_0x2a192d)[_0x2e15('0x20')](_0x4cdf1e);}};}function respondWithFilteredResult(_0x9e1988,_0x38f24d){return function(_0x26c1b1){if(_0x26c1b1){var _0x4ae228=typeof _0x38f24d[_0x2e15('0x21')]===_0x2e15('0x22')&&typeof _0x38f24d[_0x2e15('0x23')]==='undefined';var _0xdcdda9=_0x26c1b1[_0x2e15('0x24')];var _0x2a20a5=_0x4ae228?0x0:_0x38f24d[_0x2e15('0x21')];var _0xdbb683=_0x4ae228?_0x26c1b1[_0x2e15('0x24')]:_0x38f24d[_0x2e15('0x21')]+_0x38f24d[_0x2e15('0x23')];var _0x3eacdf;if(_0xdbb683>=_0xdcdda9){_0xdbb683=_0xdcdda9;_0x3eacdf=0xc8;}else{_0x3eacdf=0xce;}_0x9e1988[_0x2e15('0x1e')](_0x3eacdf);return _0x9e1988['set'](_0x2e15('0x25'),_0x2a20a5+'-'+_0xdbb683+'/'+_0xdcdda9)[_0x2e15('0x20')](_0x26c1b1);}return null;};}function patchUpdates(_0x7f0435){return function(_0x13cbbb){try{jsonpatch['apply'](_0x13cbbb,_0x7f0435,!![]);}catch(_0x2ba420){return BPromise[_0x2e15('0x26')](_0x2ba420);}return _0x13cbbb[_0x2e15('0x27')]();};}function saveUpdates(_0x304a37,_0x1e59aa){return function(_0x10e04a){if(_0x10e04a){return _0x10e04a[_0x2e15('0x28')](_0x304a37)[_0x2e15('0x29')](function(_0x508bbf){return _0x508bbf;});}return null;};}function removeEntity(_0x42c271,_0x2e383a){return function(_0x4a4432){if(_0x4a4432){return _0x4a4432[_0x2e15('0x2a')]()['then'](function(){var _0x3601bb=_0x4a4432[_0x2e15('0x2b')]({'plain':!![]});var _0x505117='CustomDashboards';return db['UserProfileResource'][_0x2e15('0x2a')]({'where':{'type':_0x505117,'resourceId':_0x3601bb['id']}})[_0x2e15('0x29')](function(){return _0x4a4432;});})[_0x2e15('0x29')](function(){_0x42c271[_0x2e15('0x1e')](0xcc)[_0x2e15('0x1f')]();});}};}function handleEntityNotFound(_0xa0b401,_0x30a429){return function(_0x76e095){if(!_0x76e095){_0xa0b401[_0x2e15('0x2c')](0x194);}return _0x76e095;};}function handleError(_0x10e884,_0x5c390d){_0x5c390d=_0x5c390d||0x1f4;return function(_0x4d9cdf){logger[_0x2e15('0x2d')](_0x4d9cdf[_0x2e15('0x2e')]);if(_0x4d9cdf[_0x2e15('0x2f')]){delete _0x4d9cdf[_0x2e15('0x2f')];}_0x10e884['status'](_0x5c390d)['send'](_0x4d9cdf);};}exports[_0x2e15('0x30')]=function(_0x18a25a,_0x73fbd4){var _0x333641={},_0x5e04bd={},_0x14899b={'count':0x0,'rows':[]};var _0x4355ac=_[_0x2e15('0x31')](db['Dashboard']['rawAttributes'],function(_0x27893a){return{'name':_0x27893a[_0x2e15('0x32')],'type':_0x27893a[_0x2e15('0x33')][_0x2e15('0x34')]};});_0x5e04bd['model']=_[_0x2e15('0x31')](_0x4355ac,_0x2e15('0x2f'));_0x5e04bd[_0x2e15('0x35')]=_[_0x2e15('0x36')](_0x18a25a['query']);_0x5e04bd[_0x2e15('0x37')]=_[_0x2e15('0x38')](_0x5e04bd[_0x2e15('0x39')],_0x5e04bd[_0x2e15('0x35')]);_0x333641[_0x2e15('0x3a')]=_['intersection'](_0x5e04bd[_0x2e15('0x39')],qs[_0x2e15('0x3b')](_0x18a25a['query'][_0x2e15('0x3b')]));_0x333641['attributes']=_0x333641['attributes'][_0x2e15('0x3c')]?_0x333641[_0x2e15('0x3a')]:_0x5e04bd[_0x2e15('0x39')];if(!_0x18a25a[_0x2e15('0x35')][_0x2e15('0x3d')](_0x2e15('0x3e'))){_0x333641[_0x2e15('0x23')]=qs['limit'](_0x18a25a['query']['limit']);_0x333641[_0x2e15('0x21')]=qs['offset'](_0x18a25a[_0x2e15('0x35')]['offset']);}_0x333641[_0x2e15('0x3f')]=qs[_0x2e15('0x40')](_0x18a25a['query'][_0x2e15('0x40')]);_0x333641[_0x2e15('0x41')]=qs[_0x2e15('0x37')](_[_0x2e15('0x42')](_0x18a25a[_0x2e15('0x35')],_0x5e04bd[_0x2e15('0x37')]),_0x4355ac);if(_0x18a25a[_0x2e15('0x35')][_0x2e15('0x43')]){_0x333641[_0x2e15('0x41')]=_['merge'](_0x333641[_0x2e15('0x41')],{'$or':_[_0x2e15('0x31')](_0x4355ac,function(_0x3fa37a){if(_0x3fa37a[_0x2e15('0x33')]!==_0x2e15('0x44')){var _0x518d45={};_0x518d45[_0x3fa37a[_0x2e15('0x2f')]]={'$like':'%'+_0x18a25a[_0x2e15('0x35')][_0x2e15('0x43')]+'%'};return _0x518d45;}})});}_0x333641=_[_0x2e15('0x45')]({},_0x333641,_0x18a25a[_0x2e15('0x46')]);var _0x3329af={'where':_0x333641[_0x2e15('0x41')]};return db[_0x2e15('0x47')]['count'](_0x3329af)[_0x2e15('0x29')](function(_0x2b5743){_0x14899b[_0x2e15('0x24')]=_0x2b5743;if(_0x18a25a[_0x2e15('0x35')][_0x2e15('0x48')]){_0x333641[_0x2e15('0x49')]=[{'all':!![]}];}return db['Dashboard'][_0x2e15('0x4a')](_0x333641);})[_0x2e15('0x29')](function(_0x18574f){_0x14899b[_0x2e15('0x4b')]=_0x18574f;return _0x14899b;})['then'](respondWithFilteredResult(_0x73fbd4,_0x333641))['catch'](handleError(_0x73fbd4,null));};exports[_0x2e15('0x4c')]=function(_0x485976,_0x30c8d3){var _0x350111={'raw':![],'where':{'id':_0x485976[_0x2e15('0x4d')]['id']}},_0x1c34dc={};_0x1c34dc[_0x2e15('0x39')]=_[_0x2e15('0x36')](db[_0x2e15('0x47')][_0x2e15('0x4e')]);_0x1c34dc['query']=_['keys'](_0x485976[_0x2e15('0x35')]);_0x1c34dc[_0x2e15('0x37')]=_['intersection'](_0x1c34dc[_0x2e15('0x39')],_0x1c34dc[_0x2e15('0x35')]);_0x350111[_0x2e15('0x3a')]=_[_0x2e15('0x38')](_0x1c34dc['model'],qs['fields'](_0x485976[_0x2e15('0x35')][_0x2e15('0x3b')]));_0x350111[_0x2e15('0x3a')]=_0x350111[_0x2e15('0x3a')][_0x2e15('0x3c')]?_0x350111['attributes']:_0x1c34dc[_0x2e15('0x39')];if(_0x485976['query'][_0x2e15('0x48')]){_0x350111[_0x2e15('0x49')]=[{'all':!![]}];}_0x350111=_['merge']({},_0x350111,_0x485976['options']);return db[_0x2e15('0x47')]['find'](_0x350111)[_0x2e15('0x29')](handleEntityNotFound(_0x30c8d3,null))[_0x2e15('0x29')](respondWithResult(_0x30c8d3,null))['catch'](handleError(_0x30c8d3,null));};exports[_0x2e15('0x4f')]=function(_0x139049,_0x3694e1){return db[_0x2e15('0x47')][_0x2e15('0x4f')](_0x139049[_0x2e15('0x50')],{})[_0x2e15('0x29')](function(_0x17f7c6){var _0x275ae7=_0x139049[_0x2e15('0x51')]['get']({'plain':!![]});if(!_0x275ae7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x275ae7[_0x2e15('0x52')]===_0x2e15('0x51')){var _0x104576=_0x17f7c6['get']({'plain':!![]});var _0x12cd86=_0x2e15('0x53');return db[_0x2e15('0x54')][_0x2e15('0x55')]({'where':{'name':_0x12cd86,'userProfileId':_0x275ae7[_0x2e15('0x56')]},'raw':!![]})[_0x2e15('0x29')](function(_0x5cf254){if(_0x5cf254&&_0x5cf254[_0x2e15('0x57')]===0x0){return db[_0x2e15('0x58')][_0x2e15('0x4f')]({'name':_0x104576['name'],'resourceId':_0x104576['id'],'type':_0x5cf254[_0x2e15('0x2f')],'sectionId':_0x5cf254['id']},{})[_0x2e15('0x29')](function(){return _0x17f7c6;});}else{return _0x17f7c6;}})['catch'](function(_0x2660d0){logger[_0x2e15('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2660d0);throw _0x2660d0;});}return _0x17f7c6;})[_0x2e15('0x29')](respondWithResult(_0x3694e1,0xc9))[_0x2e15('0x59')](handleError(_0x3694e1,null));};exports[_0x2e15('0x5a')]=function(_0x37137d,_0x287161){var _0x302be6={'where':{'id':_0x37137d[_0x2e15('0x4d')]['id']}},_0x493c6a={};_0x493c6a[_0x2e15('0x39')]=_[_0x2e15('0x36')](db[_0x2e15('0x47')][_0x2e15('0x4e')]);_0x302be6[_0x2e15('0x3a')]=_[_0x2e15('0x38')](_0x493c6a[_0x2e15('0x39')],qs['fields'](_0x37137d[_0x2e15('0x35')][_0x2e15('0x3b')]));_0x302be6[_0x2e15('0x3a')]=_0x302be6['attributes']['length']?_0x302be6[_0x2e15('0x3a')]:_0x493c6a[_0x2e15('0x39')];if(_0x37137d[_0x2e15('0x35')][_0x2e15('0x48')]){_0x302be6[_0x2e15('0x49')]=[{'all':!![]}];}_0x302be6=_[_0x2e15('0x45')]({},_0x302be6,_0x37137d[_0x2e15('0x46')]);return db[_0x2e15('0x47')]['find'](_0x302be6)['then'](handleEntityNotFound(_0x287161,null))[_0x2e15('0x29')](function(_0x78cb62){if(_0x78cb62){var _0x5a9028=_0x78cb62[_0x2e15('0x2b')]({'plain':!![]});_0x5a9028=qs['omit'](_0x5a9028,['id',_0x2e15('0x5b'),_0x2e15('0x5c')]);_0x37137d['body']=_[_0x2e15('0x5d')](_0x37137d['body'],['id',_0x2e15('0x5b'),_0x2e15('0x5c')]);return db[_0x2e15('0x47')]['create'](_['merge'](_0x5a9028,_0x37137d[_0x2e15('0x50')]),{'include':_0x37137d[_0x2e15('0x35')]['includeAll']?[{'all':!![]}]:undefined})[_0x2e15('0x29')](function(_0x227cae){var _0x379ff4=_0x37137d['user'][_0x2e15('0x2b')]({'plain':!![]});if(!_0x379ff4)throw new Error(_0x2e15('0x5e'));if(_0x379ff4[_0x2e15('0x52')]==='user'){var _0x199373=_0x227cae[_0x2e15('0x2b')]({'plain':!![]});var _0x13e588=_0x2e15('0x53');return db[_0x2e15('0x54')][_0x2e15('0x55')]({'where':{'name':_0x13e588,'userProfileId':_0x379ff4[_0x2e15('0x56')]},'raw':!![]})[_0x2e15('0x29')](function(_0x2ad965){if(_0x2ad965&&_0x2ad965[_0x2e15('0x57')]===0x0){return db['UserProfileResource'][_0x2e15('0x4f')]({'name':_0x199373[_0x2e15('0x2f')],'resourceId':_0x199373['id'],'type':_0x2ad965[_0x2e15('0x2f')],'sectionId':_0x2ad965['id']},{})[_0x2e15('0x29')](function(){return _0x227cae;});}else{return _0x227cae;}})['catch'](function(_0x418a92){logger['error'](_0x2e15('0x5f'),_0x418a92);throw _0x418a92;});}return _0x227cae;});}})[_0x2e15('0x29')](respondWithResult(_0x287161,0xc9))['catch'](handleError(_0x287161,null));};exports[_0x2e15('0x28')]=function(_0xa6dcc8,_0x458147){if(_0xa6dcc8[_0x2e15('0x50')]['id']){delete _0xa6dcc8[_0x2e15('0x50')]['id'];}return db[_0x2e15('0x47')][_0x2e15('0x55')]({'where':{'id':_0xa6dcc8[_0x2e15('0x4d')]['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x458147,null))['then'](saveUpdates(_0xa6dcc8[_0x2e15('0x50')],null))[_0x2e15('0x29')](respondWithResult(_0x458147,null))[_0x2e15('0x59')](handleError(_0x458147,null));};exports[_0x2e15('0x2a')]=function(_0x384fcb,_0x414b7a){return db['Dashboard'][_0x2e15('0x55')]({'where':{'id':_0x384fcb[_0x2e15('0x4d')]['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x414b7a,null))['then'](removeEntity(_0x414b7a,null))[_0x2e15('0x59')](handleError(_0x414b7a,null));};function widgetAttributes(_0x1faa95){try{switch(_0x1faa95[_0x2e15('0x33')]){case _0x2e15('0x60'):return[{'name':_0x2e15('0x61'),'value':_0x1faa95['attrUrl']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x64')}];case _0x2e15('0x65'):return[{'name':_0x2e15('0x66'),'value':_0x1faa95[_0x2e15('0x66')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95[_0x2e15('0x62')][0x0][_0x2e15('0x63')]:undefined)||''}];case'clock':return[{'name':'attrHourFormat','value':_0x1faa95['attrHourFormat']||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95[_0x2e15('0x62')][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x67')},{'name':'attrTimezone','value':_0x1faa95[_0x2e15('0x68')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x1]?_0x1faa95[_0x2e15('0x62')][0x1][_0x2e15('0x63')]:undefined)||_0x2e15('0x69')},{'name':_0x2e15('0x6a'),'value':_0x1faa95[_0x2e15('0x6a')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x2]?_0x1faa95['attrs'][0x2][_0x2e15('0x63')]:undefined)||0xc}];case _0x2e15('0x6b'):return[{'name':_0x2e15('0x6c'),'value':_0x1faa95['attrMetric']||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x6d')},{'name':_0x2e15('0x6e'),'value':_0x1faa95[_0x2e15('0x6e')]||(_0x1faa95['attrs']&&_0x1faa95['attrs'][0x1]?_0x1faa95['attrs'][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0x1faa95[_0x2e15('0x6a')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x2]?_0x1faa95[_0x2e15('0x62')][0x2][_0x2e15('0x63')]:undefined)||0x14},{'name':'attrChannel','value':_0x1faa95[_0x2e15('0x6f')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x3]?_0x1faa95[_0x2e15('0x62')][0x3][_0x2e15('0x63')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x1faa95[_0x2e15('0x70')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x4]?_0x1faa95['attrs'][0x4][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x71'),'value':_0x1faa95['attrFaxAccounts']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x5]?_0x1faa95[_0x2e15('0x62')][0x5][_0x2e15('0x63')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x1faa95[_0x2e15('0x72')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x6]?_0x1faa95[_0x2e15('0x62')][0x6][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x73'),'value':_0x1faa95['attrOpenchannelAccounts']||(_0x1faa95['attrs']&&_0x1faa95['attrs'][0x7]?_0x1faa95[_0x2e15('0x62')][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1faa95[_0x2e15('0x74')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x8]?_0x1faa95[_0x2e15('0x62')][0x8]['value']:undefined)||''},{'name':_0x2e15('0x75'),'value':_0x1faa95[_0x2e15('0x75')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x9]?_0x1faa95[_0x2e15('0x62')][0x9]['value']:undefined)||''}];case _0x2e15('0x76'):case'pie-chart':return[{'name':_0x2e15('0x77'),'value':_0x1faa95['attrSerie1']||(_0x1faa95['attrs']&&_0x1faa95['attrs'][0x0]?_0x1faa95[_0x2e15('0x62')][0x0][_0x2e15('0x63')]:undefined)||_0x2e15('0x6d')},{'name':_0x2e15('0x78'),'value':_0x1faa95[_0x2e15('0x78')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x1]?_0x1faa95[_0x2e15('0x62')][0x1][_0x2e15('0x63')]:undefined)||null},{'name':_0x2e15('0x79'),'value':_0x1faa95['attrSerie3']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x2]?_0x1faa95[_0x2e15('0x62')][0x2][_0x2e15('0x63')]:undefined)||null},{'name':_0x2e15('0x6e'),'value':_0x1faa95[_0x2e15('0x6e')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x3]?_0x1faa95[_0x2e15('0x62')][0x3][_0x2e15('0x63')]:undefined)||[]},{'name':_0x2e15('0x6f'),'value':_0x1faa95[_0x2e15('0x6f')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x4]?_0x1faa95[_0x2e15('0x62')][0x4][_0x2e15('0x63')]:undefined)||_0x2e15('0x7a')},{'name':_0x2e15('0x70'),'value':_0x1faa95['attrEmailAccounts']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x5]?_0x1faa95[_0x2e15('0x62')][0x5][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x71'),'value':_0x1faa95[_0x2e15('0x71')]||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x6]?_0x1faa95[_0x2e15('0x62')][0x6][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x72'),'value':_0x1faa95['attrSmsAccounts']||(_0x1faa95['attrs']&&_0x1faa95[_0x2e15('0x62')][0x7]?_0x1faa95[_0x2e15('0x62')][0x7][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x73'),'value':_0x1faa95[_0x2e15('0x73')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x8]?_0x1faa95['attrs'][0x8][_0x2e15('0x63')]:undefined)||''},{'name':_0x2e15('0x74'),'value':_0x1faa95['attrWhatsappAccounts']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x9]?_0x1faa95[_0x2e15('0x62')][0x9][_0x2e15('0x63')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1faa95[_0x2e15('0x75')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0xa]?_0x1faa95[_0x2e15('0x62')][0xa][_0x2e15('0x63')]:undefined)||''}];case _0x2e15('0x7b'):return[{'name':_0x2e15('0x7c'),'type':_0x1faa95[_0x2e15('0x7d')]||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x33')]:undefined)||null,'value':_0x1faa95['attrReport']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95['attrs'][0x0]?_0x1faa95['attrs'][0x0][_0x2e15('0x63')]:undefined)||null},{'name':_0x2e15('0x7e'),'value':_0x1faa95['attrRefresh']||(_0x1faa95[_0x2e15('0x62')]&&_0x1faa95[_0x2e15('0x62')][0x1]?_0x1faa95[_0x2e15('0x62')][0x1][_0x2e15('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x60cc87){logger['error'](_0x2e15('0x7f'),JSON[_0x2e15('0x80')](_0x60cc87));return[];}}exports[_0x2e15('0x81')]=function(_0x232a7e,_0x2a28da,_0x3fc30b){if(_0x232a7e['body']['id']){delete _0x232a7e[_0x2e15('0x50')]['id'];}return db['Dashboard'][_0x2e15('0x55')]({'where':{'id':_0x232a7e[_0x2e15('0x4d')]['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x2a28da,null))[_0x2e15('0x29')](function(_0x3c312c){if(_0x3c312c){_0x232a7e[_0x2e15('0x50')]['DashboardId']=_0x3c312c['id'];_0x232a7e[_0x2e15('0x50')][_0x2e15('0x62')]=widgetAttributes(_0x232a7e[_0x2e15('0x50')]);return db[_0x2e15('0x82')][_0x2e15('0x4f')](_0x232a7e[_0x2e15('0x50')]);}})[_0x2e15('0x29')](respondWithResult(_0x2a28da,null))[_0x2e15('0x59')](handleError(_0x2a28da,null));};exports[_0x2e15('0x83')]=function(_0x20e614,_0x4c26b1,_0x3439e5){var _0x9cdde0={};var _0x402e9b={};var _0x21f5fe;var _0x38458d;return db[_0x2e15('0x47')][_0x2e15('0x84')]({'where':{'id':_0x20e614['params']['id']}})[_0x2e15('0x29')](handleEntityNotFound(_0x4c26b1,null))['then'](function(_0x25474a){if(_0x25474a){_0x21f5fe=_0x25474a;_0x402e9b[_0x2e15('0x39')]=_[_0x2e15('0x36')](db[_0x2e15('0x82')][_0x2e15('0x4e')]);_0x402e9b['query']=_[_0x2e15('0x36')](_0x20e614[_0x2e15('0x35')]);_0x402e9b[_0x2e15('0x37')]=_[_0x2e15('0x38')](_0x402e9b[_0x2e15('0x39')],_0x402e9b[_0x2e15('0x35')]);_0x9cdde0[_0x2e15('0x3a')]=_[_0x2e15('0x38')](_0x402e9b[_0x2e15('0x39')],qs[_0x2e15('0x3b')](_0x20e614[_0x2e15('0x35')]['fields']));_0x9cdde0['attributes']=_0x9cdde0[_0x2e15('0x3a')][_0x2e15('0x3c')]?_0x9cdde0[_0x2e15('0x3a')]:_0x402e9b[_0x2e15('0x39')];_0x9cdde0[_0x2e15('0x3f')]=qs[_0x2e15('0x40')](_0x20e614[_0x2e15('0x35')][_0x2e15('0x40')]);_0x9cdde0[_0x2e15('0x41')]=qs[_0x2e15('0x37')](_[_0x2e15('0x42')](_0x20e614[_0x2e15('0x35')],_0x402e9b[_0x2e15('0x37')]));if(_0x20e614[_0x2e15('0x35')][_0x2e15('0x43')]){_0x9cdde0['where']=_[_0x2e15('0x45')](_0x9cdde0[_0x2e15('0x41')],{'$or':_[_0x2e15('0x31')](_0x9cdde0['attributes'],function(_0x126873){var _0x5edf6e={};_0x5edf6e[_0x126873]={'$like':'%'+_0x20e614[_0x2e15('0x35')][_0x2e15('0x43')]+'%'};return _0x5edf6e;})});}_0x9cdde0=_['merge']({},_0x9cdde0,_0x20e614[_0x2e15('0x46')]);return _0x21f5fe[_0x2e15('0x83')](_0x9cdde0);}})[_0x2e15('0x29')](function(_0x37b1dd){if(_0x37b1dd){_0x38458d=_0x37b1dd['length'];if(!_0x20e614[_0x2e15('0x35')]['hasOwnProperty'](_0x2e15('0x3e'))){_0x9cdde0[_0x2e15('0x23')]=qs['limit'](_0x20e614[_0x2e15('0x35')][_0x2e15('0x23')]);_0x9cdde0['offset']=qs['offset'](_0x20e614[_0x2e15('0x35')][_0x2e15('0x21')]);}return _0x21f5fe[_0x2e15('0x83')](_0x9cdde0);}})[_0x2e15('0x29')](function(_0x4da48b){if(_0x4da48b){return _0x4da48b?{'count':_0x38458d,'rows':_0x4da48b}:null;}})[_0x2e15('0x29')](respondWithResult(_0x4c26b1,null))[_0x2e15('0x59')](handleError(_0x4c26b1,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 329324e..47d36fe 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 _0xe108=['hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x3b9004,_0x562c29){var _0x2f7489=function(_0x329d77){while(--_0x329d77){_0x3b9004['push'](_0x3b9004['shift']());}};_0x2f7489(++_0x562c29);}(_0xe108,0x6b));var _0x8e10=function(_0x2929ba,_0x506aa6){_0x2929ba=_0x2929ba-0x0;var _0x365e6e=_0xe108[_0x2929ba];return _0x365e6e;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x8e10('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x8e10('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e10('0x2'),'afterDestroy':_0x8e10('0x3')};function emitEvent(_0x3ba22c){return function(_0x5bba28,_0x18df45,_0x287494){DashboardEvents['emit'](_0x3ba22c+':'+_0x5bba28['id'],_0x5bba28);DashboardEvents[_0x8e10('0x4')](_0x3ba22c,_0x5bba28);_0x287494(null);};}for(var e in events){if(events[_0x8e10('0x5')](e)){var event=events[e];Dashboard[_0x8e10('0x6')](e,emitEvent(event));}}module[_0x8e10('0x7')]=DashboardEvents; \ No newline at end of file +var _0xa25a=['hook','events','../../mysqldb','Dashboard','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xa25a,0x133));var _0xaa25=function(_0xfa4e62,_0x41ef79){_0xfa4e62=_0xfa4e62-0x0;var _0x499daa=_0xa25a[_0xfa4e62];return _0x499daa;};'use strict';var EventEmitter=require(_0xaa25('0x0'));var Dashboard=require(_0xaa25('0x1'))['db'][_0xaa25('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xaa25('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xaa25('0x4'),'afterDestroy':_0xaa25('0x5')};function emitEvent(_0x20e320){return function(_0x37ad68,_0x25711c,_0x432cba){DashboardEvents[_0xaa25('0x6')](_0x20e320+':'+_0x37ad68['id'],_0x37ad68);DashboardEvents[_0xaa25('0x6')](_0x20e320,_0x37ad68);_0x432cba(null);};}for(var e in events){if(events[_0xaa25('0x7')](e)){var event=events[e];Dashboard[_0xaa25('0x8')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 30ce298..06a6f65 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 _0x9507=['rimraf','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash','util','../../config/logger','moment','bluebird','path'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x9507,0x1a7));var _0x7950=function(_0xd506e4,_0x5c6a14){_0xd506e4=_0xd506e4-0x0;var _0xe3bad3=_0x9507[_0xd506e4];return _0xe3bad3;};'use strict';var _=require(_0x7950('0x0'));var util=require(_0x7950('0x1'));var logger=require(_0x7950('0x2'))('api');var moment=require(_0x7950('0x3'));var BPromise=require(_0x7950('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7950('0x5'));var rimraf=require(_0x7950('0x6'));var config=require(_0x7950('0x7'));var attributes=require(_0x7950('0x8'));module[_0x7950('0x9')]=function(_0x5ceb3d,_0x388acd){return _0x5ceb3d[_0x7950('0xa')](_0x7950('0xb'),attributes,{'tableName':_0x7950('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7990=['moment','bluebird','path','../../config/environment','./dashboard.attributes','Dashboard','dashboards','lodash','util','../../config/logger','api'];(function(_0x31b350,_0x5be290){var _0x1870dc=function(_0xbae48d){while(--_0xbae48d){_0x31b350['push'](_0x31b350['shift']());}};_0x1870dc(++_0x5be290);}(_0x7990,0xe3));var _0x0799=function(_0xde521,_0x4c385c){_0xde521=_0xde521-0x0;var _0x206d7f=_0x7990[_0xde521];return _0x206d7f;};'use strict';var _=require(_0x0799('0x0'));var util=require(_0x0799('0x1'));var logger=require(_0x0799('0x2'))(_0x0799('0x3'));var moment=require(_0x0799('0x4'));var BPromise=require(_0x0799('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0799('0x6'));var rimraf=require('rimraf');var config=require(_0x0799('0x7'));var attributes=require(_0x0799('0x8'));module['exports']=function(_0x25f287,_0x14bdfc){return _0x25f287['define'](_0x0799('0x9'),attributes,{'tableName':_0x0799('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 f0a69cf..b0c8467 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 _0x77a7=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket','register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x77a7,0x193));var _0x777a=function(_0x128b7e,_0x47b29e){_0x128b7e=_0x128b7e-0x0;var _0x47c36d=_0x77a7[_0x128b7e];return _0x47c36d;};'use strict';var _=require(_0x777a('0x0'));var util=require(_0x777a('0x1'));var moment=require(_0x777a('0x2'));var BPromise=require(_0x777a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x777a('0x4'));var db=require(_0x777a('0x5'))['db'];var utils=require(_0x777a('0x6'));var logger=require(_0x777a('0x7'))('rpc');var config=require(_0x777a('0x8'));var jayson=require(_0x777a('0x9'));var client=jayson[_0x777a('0xa')][_0x777a('0xb')]({'port':0x232a});config[_0x777a('0xc')]=_[_0x777a('0xd')](config['redis'],{'host':_0x777a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x777a('0xc')]));require(_0x777a('0xf'))[_0x777a('0x10')](socket);function respondWithRpcPromise(_0x3f8b9d,_0x520729,_0x3e09d8){return new BPromise(function(_0xe1e5b,_0x553857){return client[_0x777a('0x11')](_0x3f8b9d,_0x3e09d8)[_0x777a('0x12')](function(_0x2a4547){logger[_0x777a('0x13')](_0x777a('0x14'),_0x520729,_0x777a('0x15'));logger[_0x777a('0x16')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x520729,_0x777a('0x15'),JSON['stringify'](_0x2a4547));if(_0x2a4547[_0x777a('0x17')]){if(_0x2a4547[_0x777a('0x17')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x520729,_0x2a4547[_0x777a('0x17')][_0x777a('0x18')]);return _0x553857(_0x2a4547['error'][_0x777a('0x18')]);}logger[_0x777a('0x17')](_0x777a('0x14'),_0x520729,_0x2a4547[_0x777a('0x17')][_0x777a('0x18')]);return _0xe1e5b(_0x2a4547[_0x777a('0x17')][_0x777a('0x18')]);}else{logger[_0x777a('0x13')]('Dashboard,\x20%s,\x20%s',_0x520729,_0x777a('0x15'));_0xe1e5b(_0x2a4547[_0x777a('0x19')][_0x777a('0x18')]);}})[_0x777a('0x1a')](function(_0x5dc7db){logger['error'](_0x777a('0x14'),_0x520729,_0x5dc7db);_0x553857(_0x5dc7db);});});} \ No newline at end of file +var _0xa9b8=['localhost','./dashboard.socket','request','then','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x1ef399,_0x54bfff){var _0x666102=function(_0x7039b3){while(--_0x7039b3){_0x1ef399['push'](_0x1ef399['shift']());}};_0x666102(++_0x54bfff);}(_0xa9b8,0x11c));var _0x8a9b=function(_0x160e0c,_0xa8b37f){_0x160e0c=_0x160e0c-0x0;var _0x741663=_0xa9b8[_0x160e0c];return _0x741663;};'use strict';var _=require(_0x8a9b('0x0'));var util=require('util');var moment=require(_0x8a9b('0x1'));var BPromise=require(_0x8a9b('0x2'));var rs=require(_0x8a9b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8a9b('0x4'));var logger=require(_0x8a9b('0x5'))(_0x8a9b('0x6'));var config=require(_0x8a9b('0x7'));var jayson=require(_0x8a9b('0x8'));var client=jayson[_0x8a9b('0x9')][_0x8a9b('0xa')]({'port':0x232a});config['redis']=_[_0x8a9b('0xb')](config[_0x8a9b('0xc')],{'host':_0x8a9b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8a9b('0xc')]));require(_0x8a9b('0xe'))['register'](socket);function respondWithRpcPromise(_0x4230e0,_0x502ee4,_0x39b5e9){return new BPromise(function(_0x22ea3e,_0x10d912){return client[_0x8a9b('0xf')](_0x4230e0,_0x39b5e9)[_0x8a9b('0x10')](function(_0x592581){logger['info'](_0x8a9b('0x11'),_0x502ee4,_0x8a9b('0x12'));logger[_0x8a9b('0x13')](_0x8a9b('0x14'),_0x502ee4,'request\x20sent',JSON[_0x8a9b('0x15')](_0x592581));if(_0x592581[_0x8a9b('0x16')]){if(_0x592581[_0x8a9b('0x16')][_0x8a9b('0x17')]===0x1f4){logger[_0x8a9b('0x16')](_0x8a9b('0x11'),_0x502ee4,_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);return _0x10d912(_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);}logger['error']('Dashboard,\x20%s,\x20%s',_0x502ee4,_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);return _0x22ea3e(_0x592581[_0x8a9b('0x16')][_0x8a9b('0x18')]);}else{logger[_0x8a9b('0x19')](_0x8a9b('0x11'),_0x502ee4,_0x8a9b('0x12'));_0x22ea3e(_0x592581['result']['message']);}})[_0x8a9b('0x1a')](function(_0x470410){logger[_0x8a9b('0x16')](_0x8a9b('0x11'),_0x502ee4,_0x470410);_0x10d912(_0x470410);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 9e94481..1157305 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 _0x3b5a=['removeListener','register','length','update'];(function(_0x2c2aae,_0x5444a5){var _0x3a7a47=function(_0x584152){while(--_0x584152){_0x2c2aae['push'](_0x2c2aae['shift']());}};_0x3a7a47(++_0x5444a5);}(_0x3b5a,0x77));var _0xa3b5=function(_0xf23ae0,_0x13041f){_0xf23ae0=_0xf23ae0-0x0;var _0x441c81=_0x3b5a[_0xf23ae0];return _0x441c81;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save','remove',_0xa3b5('0x0')];function createListener(_0x39fb30,_0x1dc868){return function(_0x54ce1a){_0x1dc868['emit'](_0x39fb30,_0x54ce1a);};}function removeListener(_0x398e87,_0x923156){return function(){DashboardEvents[_0xa3b5('0x1')](_0x398e87,_0x923156);};}exports[_0xa3b5('0x2')]=function(_0x2f16f1){for(var _0x59bc26=0x0,_0x29584d=events[_0xa3b5('0x3')];_0x59bc26<_0x29584d;_0x59bc26++){var _0x1978d2=events[_0x59bc26];var _0x2b028d=createListener('dashboard:'+_0x1978d2,_0x2f16f1);DashboardEvents['on'](_0x1978d2,_0x2b028d);}}; \ No newline at end of file +var _0x9b8a=['remove','update','emit','removeListener','register','length','./dashboard.events'];(function(_0x221172,_0x35c9f1){var _0xe3084f=function(_0x452bdc){while(--_0x452bdc){_0x221172['push'](_0x221172['shift']());}};_0xe3084f(++_0x35c9f1);}(_0x9b8a,0xd8));var _0xa9b8=function(_0xdb01a,_0x54a83a){_0xdb01a=_0xdb01a-0x0;var _0x107ede=_0x9b8a[_0xdb01a];return _0x107ede;};'use strict';var DashboardEvents=require(_0xa9b8('0x0'));var events=['save',_0xa9b8('0x1'),_0xa9b8('0x2')];function createListener(_0x4196f8,_0x228322){return function(_0x202a2f){_0x228322[_0xa9b8('0x3')](_0x4196f8,_0x202a2f);};}function removeListener(_0x4fb0a0,_0x160c5d){return function(){DashboardEvents[_0xa9b8('0x4')](_0x4fb0a0,_0x160c5d);};}exports[_0xa9b8('0x5')]=function(_0x2be09){for(var _0x3798dc=0x0,_0x3abdbd=events[_0xa9b8('0x6')];_0x3798dc<_0x3abdbd;_0x3798dc++){var _0x79cabc=events[_0x3798dc];var _0x35efd1=createListener('dashboard:'+_0x79cabc,_0x2be09);DashboardEvents['on'](_0x79cabc,_0x35efd1);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index afe3217..d4dea8e 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 _0xee00=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x198f7b,_0x2acdb8){var _0x48b989=function(_0x2a2fc8){while(--_0x2a2fc8){_0x198f7b['push'](_0x198f7b['shift']());}};_0x48b989(++_0x2acdb8);}(_0xee00,0xeb));var _0x0ee0=function(_0x2f6882,_0x44ad78){_0x2f6882=_0x2f6882-0x0;var _0x5ac7ef=_0xee00[_0x2f6882];return _0x5ac7ef;};'use strict';var multer=require(_0x0ee0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0ee0('0x1'));var express=require('express');var router=express[_0x0ee0('0x2')]();var fs_extra=require(_0x0ee0('0x3'));var auth=require(_0x0ee0('0x4'));var interaction=require(_0x0ee0('0x5'));var config=require(_0x0ee0('0x6'));var controller=require(_0x0ee0('0x7'));router[_0x0ee0('0x8')]('/',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xa')]);router['get'](_0x0ee0('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x0ee0('0xc'),auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xd')]);router[_0x0ee0('0xe')]('/',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0xf')]);router[_0x0ee0('0xe')](_0x0ee0('0x10'),auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x11')]);router[_0x0ee0('0xe')]('/:id/items',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x12')]);router[_0x0ee0('0x13')]('/:id',auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x14')]);router[_0x0ee0('0x15')](_0x0ee0('0xb'),auth[_0x0ee0('0x9')](),controller[_0x0ee0('0x16')]);module[_0x0ee0('0x17')]=router; \ No newline at end of file +var _0x3ac0=['put','/:id','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','show','/:id/items','getItems','post','create'];(function(_0x387092,_0x4b6d5f){var _0x5e6261=function(_0x517835){while(--_0x517835){_0x387092['push'](_0x387092['shift']());}};_0x5e6261(++_0x4b6d5f);}(_0x3ac0,0x9f));var _0x03ac=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x3ac0[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0x03ac('0x0'));var util=require(_0x03ac('0x1'));var path=require(_0x03ac('0x2'));var timeout=require(_0x03ac('0x3'));var express=require('express');var router=express[_0x03ac('0x4')]();var fs_extra=require(_0x03ac('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x03ac('0x6'));var config=require(_0x03ac('0x7'));var controller=require(_0x03ac('0x8'));router[_0x03ac('0x9')]('/',auth[_0x03ac('0xa')](),controller[_0x03ac('0xb')]);router[_0x03ac('0x9')]('/:id',auth[_0x03ac('0xa')](),controller[_0x03ac('0xc')]);router[_0x03ac('0x9')](_0x03ac('0xd'),auth[_0x03ac('0xa')](),controller[_0x03ac('0xe')]);router[_0x03ac('0xf')]('/',auth['isAuthenticated'](),controller[_0x03ac('0x10')]);router[_0x03ac('0xf')]('/:id/clone',auth[_0x03ac('0xa')](),controller['clone']);router[_0x03ac('0xf')](_0x03ac('0xd'),auth['isAuthenticated'](),controller['addItem']);router[_0x03ac('0x11')](_0x03ac('0x12'),auth['isAuthenticated'](),controller[_0x03ac('0x13')]);router[_0x03ac('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x03ac('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 5ed346d..d7bb506 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 _0x5fab=['STRING','TEXT','long','parse','getDataValue','attrs','stringify','setDataValue','INTEGER','#ffffff','#2196f3','sequelize','squel','exports'];(function(_0x599fd1,_0x4386ad){var _0x457944=function(_0x2c14e5){while(--_0x2c14e5){_0x599fd1['push'](_0x599fd1['shift']());}};_0x457944(++_0x4386ad);}(_0x5fab,0x177));var _0xb5fa=function(_0x142db6,_0x5a1395){_0x142db6=_0x142db6-0x0;var _0x256363=_0x5fab[_0x142db6];return _0x256363;};'use strict';var Sequelize=require(_0xb5fa('0x0'));var squel=require(_0xb5fa('0x1'));var _=require('lodash');module[_0xb5fa('0x2')]={'title':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xb5fa('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xb5fa('0x4')](_0xb5fa('0x5')),'get':function(){try{return JSON[_0xb5fa('0x6')](this[_0xb5fa('0x7')](_0xb5fa('0x8')));}catch(_0x10361d){return[];}},'set':function(_0x44df89){try{this['setDataValue']('attrs',JSON[_0xb5fa('0x9')](_0x44df89));}catch(_0x1aec3e){this[_0xb5fa('0xa')]('attrs',JSON[_0xb5fa('0x9')]([]));}}},'sizeX':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xb5fa('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xb5fa('0x3')],'allowNull':![],'defaultValue':_0xb5fa('0xd'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xb5fa('0x3')]},'titleFontSize':{'type':Sequelize[_0xb5fa('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2675=['parse','attrs','setDataValue','stringify','INTEGER','sequelize','STRING','long'];(function(_0x360f5b,_0x58cecb){var _0x251f17=function(_0x5552ea){while(--_0x5552ea){_0x360f5b['push'](_0x360f5b['shift']());}};_0x251f17(++_0x58cecb);}(_0x2675,0x75));var _0x5267=function(_0x42c509,_0x729f8a){_0x42c509=_0x42c509-0x0;var _0xba78bb=_0x2675[_0x42c509];return _0xba78bb;};'use strict';var Sequelize=require(_0x5267('0x0'));var squel=require('squel');var _=require('lodash');module['exports']={'title':{'type':Sequelize[_0x5267('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x5267('0x1')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0x5267('0x2')),'get':function(){try{return JSON[_0x5267('0x3')](this['getDataValue'](_0x5267('0x4')));}catch(_0xf2b350){return[];}},'set':function(_0x4bd042){try{this[_0x5267('0x5')](_0x5267('0x4'),JSON[_0x5267('0x6')](_0x4bd042));}catch(_0x527c16){this[_0x5267('0x5')](_0x5267('0x4'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x5267('0x7')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x5267('0x7')]},'col':{'type':Sequelize[_0x5267('0x7')]},'background':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x5267('0x1')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x5267('0x1')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index cc7e093..2a53645 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 _0x1a28=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','params','DashboardItem','query','filters','intersection','model','attributes','fields','includeAll','include','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','clock','HH:mm:ss','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','reportType','attrReport','attrRefresh','error','widgetAttributes:\x20%s','stringify','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse'];(function(_0x257841,_0x389b4d){var _0x1b87ed=function(_0xceb19e){while(--_0xceb19e){_0x257841['push'](_0x257841['shift']());}};_0x1b87ed(++_0x389b4d);}(_0x1a28,0x10e));var _0x81a2=function(_0x2b9e8a,_0x7b21d4){_0x2b9e8a=_0x2b9e8a-0x0;var _0x520e67=_0x1a28[_0x2b9e8a];return _0x520e67;};'use strict';var emlformat=require(_0x81a2('0x0'));var rimraf=require(_0x81a2('0x1'));var zipdir=require(_0x81a2('0x2'));var jsonpatch=require(_0x81a2('0x3'));var rp=require(_0x81a2('0x4'));var moment=require(_0x81a2('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x81a2('0x6'));var path=require(_0x81a2('0x7'));var sox=require(_0x81a2('0x8'));var csv=require('to-csv');var ejs=require(_0x81a2('0x9'));var fs=require('fs');var fs_extra=require(_0x81a2('0xa'));var _=require('lodash');var squel=require(_0x81a2('0xb'));var crypto=require(_0x81a2('0xc'));var jsforce=require(_0x81a2('0xd'));var deskjs=require(_0x81a2('0xe'));var toCsv=require(_0x81a2('0xf'));var querystring=require(_0x81a2('0x10'));var Papa=require(_0x81a2('0x11'));var Redis=require(_0x81a2('0x12'));var authService=require(_0x81a2('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x81a2('0x14'));var hardwareService=require(_0x81a2('0x15'));var logger=require(_0x81a2('0x16'))(_0x81a2('0x17'));var utils=require(_0x81a2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x81a2('0x19'));var db=require(_0x81a2('0x1a'))['db'];config[_0x81a2('0x1b')]=_[_0x81a2('0x1c')](config[_0x81a2('0x1b')],{'host':_0x81a2('0x1d'),'port':0x18eb});var socket=require(_0x81a2('0x1e'))(new Redis(config[_0x81a2('0x1b')]));require('./dashboardItem.socket')[_0x81a2('0x1f')](socket);function respondWithStatusCode(_0x58ce36,_0x22290b){_0x22290b=_0x22290b||0xcc;return function(_0x39de7b){if(_0x39de7b){return _0x58ce36['sendStatus'](_0x22290b);}return _0x58ce36[_0x81a2('0x20')](_0x22290b)['end']();};}function respondWithResult(_0x233c0b,_0xe7bdc){_0xe7bdc=_0xe7bdc||0xc8;return function(_0xbc1d26){if(_0xbc1d26){return _0x233c0b[_0x81a2('0x20')](_0xe7bdc)[_0x81a2('0x21')](_0xbc1d26);}};}function respondWithFilteredResult(_0x3b39b2,_0x39d90e){return function(_0xcad181){if(_0xcad181){var _0x56d270=typeof _0x39d90e[_0x81a2('0x22')]===_0x81a2('0x23')&&typeof _0x39d90e[_0x81a2('0x24')]===_0x81a2('0x23');var _0x1ac02e=_0xcad181[_0x81a2('0x25')];var _0x2dde5f=_0x56d270?0x0:_0x39d90e[_0x81a2('0x22')];var _0x58ee6d=_0x56d270?_0xcad181[_0x81a2('0x25')]:_0x39d90e['offset']+_0x39d90e[_0x81a2('0x24')];var _0x547f96;if(_0x58ee6d>=_0x1ac02e){_0x58ee6d=_0x1ac02e;_0x547f96=0xc8;}else{_0x547f96=0xce;}_0x3b39b2['status'](_0x547f96);return _0x3b39b2[_0x81a2('0x26')](_0x81a2('0x27'),_0x2dde5f+'-'+_0x58ee6d+'/'+_0x1ac02e)['json'](_0xcad181);}return null;};}function patchUpdates(_0x251605){return function(_0x9a51d1){try{jsonpatch[_0x81a2('0x28')](_0x9a51d1,_0x251605,!![]);}catch(_0x1b08d8){return BPromise[_0x81a2('0x29')](_0x1b08d8);}return _0x9a51d1[_0x81a2('0x2a')]();};}function saveUpdates(_0x1e64e1,_0x268e6c){return function(_0x3abceb){if(_0x3abceb){return _0x3abceb[_0x81a2('0x2b')](_0x1e64e1)[_0x81a2('0x2c')](function(_0x51e8be){return _0x51e8be;});}return null;};}function removeEntity(_0x3378e4,_0x5ea3fe){return function(_0x223aee){if(_0x223aee){return _0x223aee[_0x81a2('0x2d')]()[_0x81a2('0x2c')](function(){_0x3378e4[_0x81a2('0x20')](0xcc)[_0x81a2('0x2e')]();});}};}function handleEntityNotFound(_0x3dc58c,_0x5b0c5b){return function(_0x6d576a){if(!_0x6d576a){_0x3dc58c['sendStatus'](0x194);}return _0x6d576a;};}function handleError(_0x4d836d,_0x43c304){_0x43c304=_0x43c304||0x1f4;return function(_0x333bb6){logger['error'](_0x333bb6[_0x81a2('0x2f')]);if(_0x333bb6['name']){delete _0x333bb6[_0x81a2('0x30')];}_0x4d836d['status'](_0x43c304)[_0x81a2('0x31')](_0x333bb6);};}exports['show']=function(_0x5b445f,_0x474312){var _0x5b9cdf={'raw':![],'where':{'id':_0x5b445f[_0x81a2('0x32')]['id']}},_0xc7212d={};_0xc7212d['model']=_['keys'](db[_0x81a2('0x33')]['rawAttributes']);_0xc7212d['query']=_['keys'](_0x5b445f[_0x81a2('0x34')]);_0xc7212d[_0x81a2('0x35')]=_[_0x81a2('0x36')](_0xc7212d[_0x81a2('0x37')],_0xc7212d[_0x81a2('0x34')]);_0x5b9cdf[_0x81a2('0x38')]=_[_0x81a2('0x36')](_0xc7212d[_0x81a2('0x37')],qs[_0x81a2('0x39')](_0x5b445f[_0x81a2('0x34')][_0x81a2('0x39')]));_0x5b9cdf[_0x81a2('0x38')]=_0x5b9cdf[_0x81a2('0x38')]['length']?_0x5b9cdf[_0x81a2('0x38')]:_0xc7212d[_0x81a2('0x37')];if(_0x5b445f[_0x81a2('0x34')][_0x81a2('0x3a')]){_0x5b9cdf[_0x81a2('0x3b')]=[{'all':!![]}];}_0x5b9cdf=_['merge']({},_0x5b9cdf,_0x5b445f[_0x81a2('0x3c')]);return db[_0x81a2('0x33')][_0x81a2('0x3d')](_0x5b9cdf)[_0x81a2('0x2c')](handleEntityNotFound(_0x474312,null))[_0x81a2('0x2c')](respondWithResult(_0x474312,null))[_0x81a2('0x3e')](handleError(_0x474312,null));};exports[_0x81a2('0x2d')]=function(_0x3ebe85,_0x485ae5){return db[_0x81a2('0x33')][_0x81a2('0x3d')]({'where':{'id':_0x3ebe85['params']['id']}})[_0x81a2('0x2c')](handleEntityNotFound(_0x485ae5,null))[_0x81a2('0x2c')](removeEntity(_0x485ae5,null))['catch'](handleError(_0x485ae5,null));};function widgetAttributes(_0x149a4e){try{switch(_0x149a4e[_0x81a2('0x3f')]){case _0x81a2('0x40'):return[{'name':'attrUrl','value':_0x149a4e[_0x81a2('0x41')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e[_0x81a2('0x42')][0x0][_0x81a2('0x43')]:undefined)||_0x81a2('0x44')}];case _0x81a2('0x45'):return[{'name':'attrPath','value':_0x149a4e['attrPath']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x0]?_0x149a4e[_0x81a2('0x42')][0x0]['value']:undefined)||''}];case _0x81a2('0x46'):return[{'name':'attrHourFormat','value':_0x149a4e['attrHourFormat']||(_0x149a4e['attrs']&&_0x149a4e['attrs'][0x0]?_0x149a4e[_0x81a2('0x42')][0x0]['value']:undefined)||_0x81a2('0x47')},{'name':'attrTimezone','value':_0x149a4e['attrTimezone']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x1]?_0x149a4e[_0x81a2('0x42')][0x1][_0x81a2('0x43')]:undefined)||_0x81a2('0x48')},{'name':_0x81a2('0x49'),'value':_0x149a4e[_0x81a2('0x49')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x2]?_0x149a4e[_0x81a2('0x42')][0x2][_0x81a2('0x43')]:undefined)||0xc}];case'counter':return[{'name':_0x81a2('0x4a'),'value':_0x149a4e[_0x81a2('0x4a')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e[_0x81a2('0x42')][0x0][_0x81a2('0x43')]:undefined)||_0x81a2('0x4b')},{'name':_0x81a2('0x4c'),'value':_0x149a4e['attrVoiceQueues']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x1]?_0x149a4e[_0x81a2('0x42')][0x1][_0x81a2('0x43')]:undefined)||[]},{'name':_0x81a2('0x49'),'value':_0x149a4e[_0x81a2('0x49')]||(_0x149a4e['attrs']&&_0x149a4e['attrs'][0x2]?_0x149a4e[_0x81a2('0x42')][0x2][_0x81a2('0x43')]:undefined)||0x14},{'name':_0x81a2('0x4d'),'value':_0x149a4e['attrChannel']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x3]?_0x149a4e[_0x81a2('0x42')][0x3][_0x81a2('0x43')]:undefined)||'voice'},{'name':_0x81a2('0x4e'),'value':_0x149a4e[_0x81a2('0x4e')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x4]?_0x149a4e[_0x81a2('0x42')][0x4][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x4f'),'value':_0x149a4e[_0x81a2('0x4f')]||(_0x149a4e['attrs']&&_0x149a4e[_0x81a2('0x42')][0x5]?_0x149a4e['attrs'][0x5][_0x81a2('0x43')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x149a4e[_0x81a2('0x50')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x6]?_0x149a4e[_0x81a2('0x42')][0x6][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x51'),'value':_0x149a4e[_0x81a2('0x51')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x7]?_0x149a4e[_0x81a2('0x42')][0x7][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x52'),'value':_0x149a4e[_0x81a2('0x52')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x8]?_0x149a4e[_0x81a2('0x42')][0x8][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x53'),'value':_0x149a4e[_0x81a2('0x53')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x9]?_0x149a4e[_0x81a2('0x42')][0x9][_0x81a2('0x43')]:undefined)||''}];case _0x81a2('0x54'):case _0x81a2('0x55'):return[{'name':_0x81a2('0x56'),'value':_0x149a4e[_0x81a2('0x56')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e[_0x81a2('0x42')][0x0][_0x81a2('0x43')]:undefined)||_0x81a2('0x4b')},{'name':_0x81a2('0x57'),'value':_0x149a4e['attrSerie2']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x1]?_0x149a4e[_0x81a2('0x42')][0x1][_0x81a2('0x43')]:undefined)||null},{'name':'attrSerie3','value':_0x149a4e[_0x81a2('0x58')]||(_0x149a4e['attrs']&&_0x149a4e[_0x81a2('0x42')][0x2]?_0x149a4e[_0x81a2('0x42')][0x2]['value']:undefined)||null},{'name':_0x81a2('0x4c'),'value':_0x149a4e[_0x81a2('0x4c')]||(_0x149a4e['attrs']&&_0x149a4e['attrs'][0x3]?_0x149a4e['attrs'][0x3][_0x81a2('0x43')]:undefined)||[]},{'name':'attrChannel','value':_0x149a4e[_0x81a2('0x4d')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x4]?_0x149a4e['attrs'][0x4][_0x81a2('0x43')]:undefined)||'voice'},{'name':_0x81a2('0x4e'),'value':_0x149a4e[_0x81a2('0x4e')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x5]?_0x149a4e[_0x81a2('0x42')][0x5][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x4f'),'value':_0x149a4e[_0x81a2('0x4f')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x6]?_0x149a4e[_0x81a2('0x42')][0x6][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x50'),'value':_0x149a4e[_0x81a2('0x50')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x7]?_0x149a4e[_0x81a2('0x42')][0x7]['value']:undefined)||''},{'name':_0x81a2('0x51'),'value':_0x149a4e['attrOpenchannelAccounts']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x8]?_0x149a4e['attrs'][0x8]['value']:undefined)||''},{'name':_0x81a2('0x52'),'value':_0x149a4e[_0x81a2('0x52')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x9]?_0x149a4e['attrs'][0x9][_0x81a2('0x43')]:undefined)||''},{'name':_0x81a2('0x53'),'value':_0x149a4e[_0x81a2('0x53')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0xa]?_0x149a4e[_0x81a2('0x42')][0xa]['value']:undefined)||''}];case'web-report':return[{'name':'attrReport','type':_0x149a4e[_0x81a2('0x59')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x0]?_0x149a4e['attrs'][0x0][_0x81a2('0x3f')]:undefined)||null,'value':_0x149a4e[_0x81a2('0x5a')]||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e['attrs'][0x0]?_0x149a4e['attrs'][0x0][_0x81a2('0x43')]:undefined)||null},{'name':_0x81a2('0x5b'),'value':_0x149a4e['attrRefresh']||(_0x149a4e[_0x81a2('0x42')]&&_0x149a4e[_0x81a2('0x42')][0x1]?_0x149a4e[_0x81a2('0x42')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x42a9a2){logger[_0x81a2('0x5c')](_0x81a2('0x5d'),JSON[_0x81a2('0x5e')](_0x42a9a2));return[];}}exports['create']=function(_0x11be31,_0x5377f4){if(_0x11be31['body']){_0x11be31['body']['attrs']=widgetAttributes(_0x11be31['body']);}return db[_0x81a2('0x33')]['create'](_0x11be31[_0x81a2('0x5f')],{})['then'](respondWithResult(_0x5377f4,0xc9))[_0x81a2('0x3e')](handleError(_0x5377f4,null));};exports[_0x81a2('0x2b')]=function(_0x374d7c,_0x221381){if(_0x374d7c[_0x81a2('0x5f')]['id']){delete _0x374d7c[_0x81a2('0x5f')]['id'];}_0x374d7c['body'][_0x81a2('0x42')]=widgetAttributes(_0x374d7c[_0x81a2('0x5f')]);return db[_0x81a2('0x33')]['find']({'where':{'id':_0x374d7c[_0x81a2('0x32')]['id']}})['then'](handleEntityNotFound(_0x221381,null))[_0x81a2('0x2c')](saveUpdates(_0x374d7c[_0x81a2('0x5f')],null))[_0x81a2('0x2c')](respondWithResult(_0x221381,null))[_0x81a2('0x3e')](handleError(_0x221381,null));}; \ No newline at end of file +var _0x66da=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','redis','localhost','./dashboardItem.socket','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','send','show','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','include','merge','find','catch','destroy','attrs','value','https://','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','attrRefresh','error','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv'];(function(_0x58ccf4,_0x4130e8){var _0x40d04e=function(_0x2a0281){while(--_0x2a0281){_0x58ccf4['push'](_0x58ccf4['shift']());}};_0x40d04e(++_0x4130e8);}(_0x66da,0x16f));var _0xa66d=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x66da[_0x4dc7b9];return _0x3ab114;};'use strict';var emlformat=require(_0xa66d('0x0'));var rimraf=require(_0xa66d('0x1'));var zipdir=require(_0xa66d('0x2'));var jsonpatch=require(_0xa66d('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa66d('0x4'));var util=require(_0xa66d('0x5'));var path=require(_0xa66d('0x6'));var sox=require(_0xa66d('0x7'));var csv=require(_0xa66d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa66d('0x9'));var _=require(_0xa66d('0xa'));var squel=require(_0xa66d('0xb'));var crypto=require(_0xa66d('0xc'));var jsforce=require(_0xa66d('0xd'));var deskjs=require(_0xa66d('0xe'));var toCsv=require(_0xa66d('0x8'));var querystring=require(_0xa66d('0xf'));var Papa=require(_0xa66d('0x10'));var Redis=require(_0xa66d('0x11'));var authService=require(_0xa66d('0x12'));var qs=require(_0xa66d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66d('0x14'));var logger=require(_0xa66d('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa66d('0x16'));var db=require('../../mysqldb')['db'];config[_0xa66d('0x17')]=_['defaults'](config[_0xa66d('0x17')],{'host':_0xa66d('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa66d('0x17')]));require(_0xa66d('0x19'))['register'](socket);function respondWithStatusCode(_0x2a44ad,_0x56d322){_0x56d322=_0x56d322||0xcc;return function(_0x4c1746){if(_0x4c1746){return _0x2a44ad['sendStatus'](_0x56d322);}return _0x2a44ad[_0xa66d('0x1a')](_0x56d322)[_0xa66d('0x1b')]();};}function respondWithResult(_0x53ad6b,_0x331df5){_0x331df5=_0x331df5||0xc8;return function(_0x3bfcec){if(_0x3bfcec){return _0x53ad6b[_0xa66d('0x1a')](_0x331df5)[_0xa66d('0x1c')](_0x3bfcec);}};}function respondWithFilteredResult(_0x1120cb,_0x47d573){return function(_0x109eb4){if(_0x109eb4){var _0x5e1a70=typeof _0x47d573[_0xa66d('0x1d')]===_0xa66d('0x1e')&&typeof _0x47d573['limit']===_0xa66d('0x1e');var _0x15e064=_0x109eb4[_0xa66d('0x1f')];var _0x3d0219=_0x5e1a70?0x0:_0x47d573['offset'];var _0xee7546=_0x5e1a70?_0x109eb4[_0xa66d('0x1f')]:_0x47d573[_0xa66d('0x1d')]+_0x47d573[_0xa66d('0x20')];var _0x18b0c5;if(_0xee7546>=_0x15e064){_0xee7546=_0x15e064;_0x18b0c5=0xc8;}else{_0x18b0c5=0xce;}_0x1120cb[_0xa66d('0x1a')](_0x18b0c5);return _0x1120cb['set'](_0xa66d('0x21'),_0x3d0219+'-'+_0xee7546+'/'+_0x15e064)['json'](_0x109eb4);}return null;};}function patchUpdates(_0xfde811){return function(_0x2e8155){try{jsonpatch[_0xa66d('0x22')](_0x2e8155,_0xfde811,!![]);}catch(_0x1193e1){return BPromise[_0xa66d('0x23')](_0x1193e1);}return _0x2e8155[_0xa66d('0x24')]();};}function saveUpdates(_0x47fd61,_0x42527c){return function(_0x49f869){if(_0x49f869){return _0x49f869[_0xa66d('0x25')](_0x47fd61)[_0xa66d('0x26')](function(_0x78c0dc){return _0x78c0dc;});}return null;};}function removeEntity(_0x1a01fb,_0x353888){return function(_0x5704c6){if(_0x5704c6){return _0x5704c6['destroy']()[_0xa66d('0x26')](function(){_0x1a01fb[_0xa66d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41b563,_0x4dd6fa){return function(_0x46e108){if(!_0x46e108){_0x41b563[_0xa66d('0x27')](0x194);}return _0x46e108;};}function handleError(_0x86e964,_0x3ff4a2){_0x3ff4a2=_0x3ff4a2||0x1f4;return function(_0x2d87f1){logger['error'](_0x2d87f1[_0xa66d('0x28')]);if(_0x2d87f1[_0xa66d('0x29')]){delete _0x2d87f1[_0xa66d('0x29')];}_0x86e964[_0xa66d('0x1a')](_0x3ff4a2)[_0xa66d('0x2a')](_0x2d87f1);};}exports[_0xa66d('0x2b')]=function(_0x4037ba,_0x2e13b3){var _0x5c0e0b={'raw':![],'where':{'id':_0x4037ba[_0xa66d('0x2c')]['id']}},_0x1a545e={};_0x1a545e[_0xa66d('0x2d')]=_['keys'](db[_0xa66d('0x2e')]['rawAttributes']);_0x1a545e[_0xa66d('0x2f')]=_['keys'](_0x4037ba[_0xa66d('0x2f')]);_0x1a545e[_0xa66d('0x30')]=_[_0xa66d('0x31')](_0x1a545e[_0xa66d('0x2d')],_0x1a545e[_0xa66d('0x2f')]);_0x5c0e0b[_0xa66d('0x32')]=_[_0xa66d('0x31')](_0x1a545e[_0xa66d('0x2d')],qs['fields'](_0x4037ba[_0xa66d('0x2f')][_0xa66d('0x33')]));_0x5c0e0b[_0xa66d('0x32')]=_0x5c0e0b[_0xa66d('0x32')][_0xa66d('0x34')]?_0x5c0e0b[_0xa66d('0x32')]:_0x1a545e[_0xa66d('0x2d')];if(_0x4037ba[_0xa66d('0x2f')]['includeAll']){_0x5c0e0b[_0xa66d('0x35')]=[{'all':!![]}];}_0x5c0e0b=_[_0xa66d('0x36')]({},_0x5c0e0b,_0x4037ba['options']);return db[_0xa66d('0x2e')][_0xa66d('0x37')](_0x5c0e0b)[_0xa66d('0x26')](handleEntityNotFound(_0x2e13b3,null))[_0xa66d('0x26')](respondWithResult(_0x2e13b3,null))[_0xa66d('0x38')](handleError(_0x2e13b3,null));};exports[_0xa66d('0x39')]=function(_0x5d587f,_0x49a4be){return db['DashboardItem']['find']({'where':{'id':_0x5d587f[_0xa66d('0x2c')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x49a4be,null))[_0xa66d('0x26')](removeEntity(_0x49a4be,null))[_0xa66d('0x38')](handleError(_0x49a4be,null));};function widgetAttributes(_0x128f8d){try{switch(_0x128f8d['type']){case'iframe':return[{'name':'attrUrl','value':_0x128f8d['attrUrl']||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||_0xa66d('0x3c')}];case _0xa66d('0x3d'):return[{'name':_0xa66d('0x3e'),'value':_0x128f8d[_0xa66d('0x3e')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d['attrs'][0x0][_0xa66d('0x3b')]:undefined)||''}];case _0xa66d('0x3f'):return[{'name':_0xa66d('0x40'),'value':_0x128f8d[_0xa66d('0x40')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0]['value']:undefined)||'HH:mm:ss'},{'name':_0xa66d('0x41'),'value':_0x128f8d[_0xa66d('0x41')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x1]?_0x128f8d[_0xa66d('0x3a')][0x1]['value']:undefined)||_0xa66d('0x42')},{'name':'attrFontSize','value':_0x128f8d[_0xa66d('0x43')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x2]?_0x128f8d[_0xa66d('0x3a')][0x2]['value']:undefined)||0xc}];case _0xa66d('0x44'):return[{'name':_0xa66d('0x45'),'value':_0x128f8d[_0xa66d('0x45')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||'total'},{'name':_0xa66d('0x46'),'value':_0x128f8d[_0xa66d('0x46')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x1]?_0x128f8d['attrs'][0x1][_0xa66d('0x3b')]:undefined)||[]},{'name':_0xa66d('0x43'),'value':_0x128f8d[_0xa66d('0x43')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x2]?_0x128f8d[_0xa66d('0x3a')][0x2][_0xa66d('0x3b')]:undefined)||0x14},{'name':_0xa66d('0x47'),'value':_0x128f8d[_0xa66d('0x47')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x3]?_0x128f8d[_0xa66d('0x3a')][0x3][_0xa66d('0x3b')]:undefined)||'voice'},{'name':_0xa66d('0x48'),'value':_0x128f8d[_0xa66d('0x48')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x4]?_0x128f8d[_0xa66d('0x3a')][0x4][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x49'),'value':_0x128f8d[_0xa66d('0x49')]||(_0x128f8d['attrs']&&_0x128f8d['attrs'][0x5]?_0x128f8d['attrs'][0x5][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4a'),'value':_0x128f8d[_0xa66d('0x4a')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x6]?_0x128f8d[_0xa66d('0x3a')][0x6][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4b'),'value':_0x128f8d[_0xa66d('0x4b')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x7]?_0x128f8d[_0xa66d('0x3a')][0x7]['value']:undefined)||''},{'name':_0xa66d('0x4c'),'value':_0x128f8d[_0xa66d('0x4c')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x8]?_0x128f8d[_0xa66d('0x3a')][0x8][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4d'),'value':_0x128f8d[_0xa66d('0x4d')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x9]?_0x128f8d[_0xa66d('0x3a')][0x9][_0xa66d('0x3b')]:undefined)||''}];case _0xa66d('0x4e'):case _0xa66d('0x4f'):return[{'name':_0xa66d('0x50'),'value':_0x128f8d['attrSerie1']||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||_0xa66d('0x51')},{'name':_0xa66d('0x52'),'value':_0x128f8d[_0xa66d('0x52')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x1]?_0x128f8d['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x128f8d[_0xa66d('0x53')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x2]?_0x128f8d['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x128f8d[_0xa66d('0x46')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x3]?_0x128f8d[_0xa66d('0x3a')][0x3]['value']:undefined)||[]},{'name':'attrChannel','value':_0x128f8d[_0xa66d('0x47')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x4]?_0x128f8d[_0xa66d('0x3a')][0x4][_0xa66d('0x3b')]:undefined)||_0xa66d('0x54')},{'name':_0xa66d('0x48'),'value':_0x128f8d[_0xa66d('0x48')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x5]?_0x128f8d[_0xa66d('0x3a')][0x5]['value']:undefined)||''},{'name':_0xa66d('0x49'),'value':_0x128f8d[_0xa66d('0x49')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d['attrs'][0x6]?_0x128f8d[_0xa66d('0x3a')][0x6][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4a'),'value':_0x128f8d[_0xa66d('0x4a')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x7]?_0x128f8d[_0xa66d('0x3a')][0x7][_0xa66d('0x3b')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x128f8d['attrOpenchannelAccounts']||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x8]?_0x128f8d[_0xa66d('0x3a')][0x8][_0xa66d('0x3b')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x128f8d[_0xa66d('0x4c')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x9]?_0x128f8d[_0xa66d('0x3a')][0x9][_0xa66d('0x3b')]:undefined)||''},{'name':_0xa66d('0x4d'),'value':_0x128f8d[_0xa66d('0x4d')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0xa]?_0x128f8d[_0xa66d('0x3a')][0xa][_0xa66d('0x3b')]:undefined)||''}];case _0xa66d('0x55'):return[{'name':_0xa66d('0x56'),'type':_0x128f8d[_0xa66d('0x57')]||(_0x128f8d[_0xa66d('0x3a')]&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0]['type']:undefined)||null,'value':_0x128f8d[_0xa66d('0x56')]||(_0x128f8d['attrs']&&_0x128f8d[_0xa66d('0x3a')][0x0]?_0x128f8d[_0xa66d('0x3a')][0x0][_0xa66d('0x3b')]:undefined)||null},{'name':_0xa66d('0x58'),'value':_0x128f8d['attrRefresh']||(_0x128f8d['attrs']&&_0x128f8d['attrs'][0x1]?_0x128f8d[_0xa66d('0x3a')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x19bdfe){logger[_0xa66d('0x59')](_0xa66d('0x5a'),JSON[_0xa66d('0x5b')](_0x19bdfe));return[];}}exports[_0xa66d('0x5c')]=function(_0x5cb526,_0x147618){if(_0x5cb526[_0xa66d('0x5d')]){_0x5cb526['body']['attrs']=widgetAttributes(_0x5cb526['body']);}return db[_0xa66d('0x2e')][_0xa66d('0x5c')](_0x5cb526[_0xa66d('0x5d')],{})['then'](respondWithResult(_0x147618,0xc9))[_0xa66d('0x38')](handleError(_0x147618,null));};exports['update']=function(_0x199510,_0x319b96){if(_0x199510['body']['id']){delete _0x199510[_0xa66d('0x5d')]['id'];}_0x199510[_0xa66d('0x5d')][_0xa66d('0x3a')]=widgetAttributes(_0x199510[_0xa66d('0x5d')]);return db['DashboardItem'][_0xa66d('0x37')]({'where':{'id':_0x199510[_0xa66d('0x2c')]['id']}})[_0xa66d('0x26')](handleEntityNotFound(_0x319b96,null))[_0xa66d('0x26')](saveUpdates(_0x199510[_0xa66d('0x5d')],null))[_0xa66d('0x26')](respondWithResult(_0x319b96,null))[_0xa66d('0x38')](handleError(_0x319b96,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index eaf51cf..4eaa1ce 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 _0x0af9=['exports','DashboardItem','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2317bf,_0x2f3750){var _0x3d1cfe=function(_0x43efcb){while(--_0x43efcb){_0x2317bf['push'](_0x2317bf['shift']());}};_0x3d1cfe(++_0x2f3750);}(_0x0af9,0x161));var _0x90af=function(_0x5af812,_0x43d252){_0x5af812=_0x5af812-0x0;var _0x1489f2=_0x0af9[_0x5af812];return _0x1489f2;};'use strict';var EventEmitter=require('events');var DashboardItem=require('../../mysqldb')['db'][_0x90af('0x0')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x90af('0x1'),'afterUpdate':_0x90af('0x2'),'afterDestroy':_0x90af('0x3')};function emitEvent(_0x336199){return function(_0x408e74,_0x4ab311,_0x5a69d8){DashboardItemEvents[_0x90af('0x4')](_0x336199+':'+_0x408e74['id'],_0x408e74);DashboardItemEvents[_0x90af('0x4')](_0x336199,_0x408e74);_0x5a69d8(null);};}for(var e in events){if(events[_0x90af('0x5')](e)){var event=events[e];DashboardItem[_0x90af('0x6')](e,emitEvent(event));}}module[_0x90af('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x3dd7=['../../mysqldb','DashboardItem','setMaxListeners','remove','emit','hook'];(function(_0x2576d7,_0x167624){var _0x16a08c=function(_0x19de1e){while(--_0x19de1e){_0x2576d7['push'](_0x2576d7['shift']());}};_0x16a08c(++_0x167624);}(_0x3dd7,0x1f2));var _0x73dd=function(_0x339a1f,_0x2b5fd2){_0x339a1f=_0x339a1f-0x0;var _0xea6184=_0x3dd7[_0x339a1f];return _0xea6184;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x73dd('0x0'))['db'][_0x73dd('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x73dd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x73dd('0x3')};function emitEvent(_0x22494f){return function(_0x3106c0,_0x1b07b6,_0x403f66){DashboardItemEvents[_0x73dd('0x4')](_0x22494f+':'+_0x3106c0['id'],_0x3106c0);DashboardItemEvents[_0x73dd('0x4')](_0x22494f,_0x3106c0);_0x403f66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x73dd('0x5')](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 cfd8049..13f3510 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 _0x20a9=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','../../config/logger'];(function(_0x1cc597,_0x52b070){var _0x507937=function(_0x3a62b7){while(--_0x3a62b7){_0x1cc597['push'](_0x1cc597['shift']());}};_0x507937(++_0x52b070);}(_0x20a9,0x113));var _0x920a=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x20a9[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x920a('0x0'))(_0x920a('0x1'));var moment=require(_0x920a('0x2'));var BPromise=require(_0x920a('0x3'));var rp=require(_0x920a('0x4'));var fs=require('fs');var path=require(_0x920a('0x5'));var rimraf=require(_0x920a('0x6'));var config=require(_0x920a('0x7'));var attributes=require(_0x920a('0x8'));module[_0x920a('0x9')]=function(_0x21ae55,_0x58bdd5){return _0x21ae55[_0x920a('0xa')](_0x920a('0xb'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7bae=['./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','util','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x2ae071,_0x346bee){var _0x1db8f8=function(_0x3134bf){while(--_0x3134bf){_0x2ae071['push'](_0x2ae071['shift']());}};_0x1db8f8(++_0x346bee);}(_0x7bae,0xaa));var _0xe7ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7bae[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xe7ba('0x0'));var logger=require(_0xe7ba('0x1'))(_0xe7ba('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe7ba('0x3'));var fs=require('fs');var path=require(_0xe7ba('0x4'));var rimraf=require('rimraf');var config=require(_0xe7ba('0x5'));var attributes=require(_0xe7ba('0x6'));module[_0xe7ba('0x7')]=function(_0x3f15c7,_0x3d4d89){return _0x3f15c7[_0xe7ba('0x8')](_0xe7ba('0x9'),attributes,{'tableName':_0xe7ba('0xa'),'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 c294dd5..7afc4b1 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 _0xfc2c=['localhost','socket.io-emitter','register','info','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','DashboardItem,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis'];(function(_0x51d1b0,_0x4ff6fd){var _0x2453bb=function(_0xed7aa8){while(--_0xed7aa8){_0x51d1b0['push'](_0x51d1b0['shift']());}};_0x2453bb(++_0x4ff6fd);}(_0xfc2c,0xf8));var _0xcfc2=function(_0x85f562,_0x9fd15b){_0x85f562=_0x85f562-0x0;var _0x2c802c=_0xfc2c[_0x85f562];return _0x2c802c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcfc2('0x0'));var BPromise=require(_0xcfc2('0x1'));var rs=require(_0xcfc2('0x2'));var fs=require('fs');var Redis=require(_0xcfc2('0x3'));var db=require(_0xcfc2('0x4'))['db'];var utils=require(_0xcfc2('0x5'));var logger=require(_0xcfc2('0x6'))(_0xcfc2('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfc2('0x8'));var client=jayson[_0xcfc2('0x9')][_0xcfc2('0xa')]({'port':0x232a});config[_0xcfc2('0xb')]=_['defaults'](config[_0xcfc2('0xb')],{'host':_0xcfc2('0xc'),'port':0x18eb});var socket=require(_0xcfc2('0xd'))(new Redis(config[_0xcfc2('0xb')]));require('./dashboardItem.socket')[_0xcfc2('0xe')](socket);function respondWithRpcPromise(_0x41b562,_0xf242c5,_0x2dfec6){return new BPromise(function(_0x274e79,_0x1cfe0a){return client['request'](_0x41b562,_0x2dfec6)['then'](function(_0x1edada){logger[_0xcfc2('0xf')]('DashboardItem,\x20%s,\x20%s',_0xf242c5,_0xcfc2('0x10'));logger[_0xcfc2('0x11')](_0xcfc2('0x12'),_0xf242c5,_0xcfc2('0x10'),JSON[_0xcfc2('0x13')](_0x1edada));if(_0x1edada[_0xcfc2('0x14')]){if(_0x1edada['error'][_0xcfc2('0x15')]===0x1f4){logger[_0xcfc2('0x14')]('DashboardItem,\x20%s,\x20%s',_0xf242c5,_0x1edada[_0xcfc2('0x14')]['message']);return _0x1cfe0a(_0x1edada[_0xcfc2('0x14')][_0xcfc2('0x16')]);}logger[_0xcfc2('0x14')](_0xcfc2('0x17'),_0xf242c5,_0x1edada[_0xcfc2('0x14')]['message']);return _0x274e79(_0x1edada['error']['message']);}else{logger[_0xcfc2('0xf')](_0xcfc2('0x17'),_0xf242c5,_0xcfc2('0x10'));_0x274e79(_0x1edada[_0xcfc2('0x18')]['message']);}})[_0xcfc2('0x19')](function(_0x1c0b5d){logger['error'](_0xcfc2('0x17'),_0xf242c5,_0x1c0b5d);_0x1cfe0a(_0x1c0b5d);});});} \ No newline at end of file +var _0x62ca=['../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','request','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x1daf38,_0x59a0e9){var _0x2531e1=function(_0x1364ea){while(--_0x1364ea){_0x1daf38['push'](_0x1daf38['shift']());}};_0x2531e1(++_0x59a0e9);}(_0x62ca,0x10f));var _0xa62c=function(_0xfe8044,_0xbc1ba9){_0xfe8044=_0xfe8044-0x0;var _0x4ed72e=_0x62ca[_0xfe8044];return _0x4ed72e;};'use strict';var _=require(_0xa62c('0x0'));var util=require('util');var moment=require(_0xa62c('0x1'));var BPromise=require(_0xa62c('0x2'));var rs=require(_0xa62c('0x3'));var fs=require('fs');var Redis=require(_0xa62c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa62c('0x5'))(_0xa62c('0x6'));var config=require(_0xa62c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa62c('0x8')][_0xa62c('0x9')]({'port':0x232a});config[_0xa62c('0xa')]=_[_0xa62c('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xa62c('0xc'))(new Redis(config[_0xa62c('0xa')]));require('./dashboardItem.socket')['register'](socket);function respondWithRpcPromise(_0x1b644a,_0x300d74,_0x220ac5){return new BPromise(function(_0x258d87,_0x38fe0f){return client[_0xa62c('0xd')](_0x1b644a,_0x220ac5)['then'](function(_0x475d52){logger[_0xa62c('0xe')](_0xa62c('0xf'),_0x300d74,_0xa62c('0x10'));logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x300d74,_0xa62c('0x10'),JSON[_0xa62c('0x11')](_0x475d52));if(_0x475d52['error']){if(_0x475d52[_0xa62c('0x12')][_0xa62c('0x13')]===0x1f4){logger[_0xa62c('0x12')](_0xa62c('0xf'),_0x300d74,_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);return _0x38fe0f(_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x300d74,_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);return _0x258d87(_0x475d52[_0xa62c('0x12')][_0xa62c('0x14')]);}else{logger[_0xa62c('0xe')](_0xa62c('0xf'),_0x300d74,_0xa62c('0x10'));_0x258d87(_0x475d52[_0xa62c('0x15')][_0xa62c('0x14')]);}})[_0xa62c('0x16')](function(_0x2d10ef){logger[_0xa62c('0x12')](_0xa62c('0xf'),_0x300d74,_0x2d10ef);_0x38fe0f(_0x2d10ef);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index b2bfa3c..f56b533 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 _0xfcfc=['remove','emit','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x5f46e7,_0x62f9f8){var _0x567e95=function(_0x5cb693){while(--_0x5cb693){_0x5f46e7['push'](_0x5f46e7['shift']());}};_0x567e95(++_0x62f9f8);}(_0xfcfc,0xa6));var _0xcfcf=function(_0x9fdca,_0x364493){_0x9fdca=_0x9fdca-0x0;var _0x4037a3=_0xfcfc[_0x9fdca];return _0x4037a3;};'use strict';var DashboardItemEvents=require(_0xcfcf('0x0'));var events=[_0xcfcf('0x1'),_0xcfcf('0x2'),'update'];function createListener(_0x590371,_0x2c88b3){return function(_0x1d01e7){_0x2c88b3[_0xcfcf('0x3')](_0x590371,_0x1d01e7);};}function removeListener(_0x3f9965,_0x2bbc47){return function(){DashboardItemEvents[_0xcfcf('0x4')](_0x3f9965,_0x2bbc47);};}exports[_0xcfcf('0x5')]=function(_0x50d018){for(var _0x1daafe=0x0,_0x113442=events[_0xcfcf('0x6')];_0x1daafe<_0x113442;_0x1daafe++){var _0x318651=events[_0x1daafe];var _0x35864e=createListener(_0xcfcf('0x7')+_0x318651,_0x50d018);DashboardItemEvents['on'](_0x318651,_0x35864e);}}; \ No newline at end of file +var _0x084a=['update','register','save'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x084a,0xb0));var _0xa084=function(_0x1d36da,_0x49cb9b){_0x1d36da=_0x1d36da-0x0;var _0x26dd56=_0x084a[_0x1d36da];return _0x26dd56;};'use strict';var DashboardItemEvents=require('./dashboardItem.events');var events=[_0xa084('0x0'),'remove',_0xa084('0x1')];function createListener(_0x42b00e,_0x3a2769){return function(_0x3e47f2){_0x3a2769['emit'](_0x42b00e,_0x3e47f2);};}function removeListener(_0x5831d2,_0x2d67ed){return function(){DashboardItemEvents['removeListener'](_0x5831d2,_0x2d67ed);};}exports[_0xa084('0x2')]=function(_0x1e5d72){for(var _0x532426=0x0,_0xb349a0=events['length'];_0x532426<_0xb349a0;_0x532426++){var _0x14a4ef=events[_0x532426];var _0x52fc19=createListener('dashboardItem:'+_0x14a4ef,_0x1e5d72);DashboardItemEvents['on'](_0x14a4ef,_0x52fc19);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 3a7459c..57dbccd 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 _0xb7da=['fs-extra','../../components/auth/service','../../components/interaction/service','./dashboardItem.controller','show','post','isAuthenticated','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x246226,_0x36d0c6){var _0x29b6a1=function(_0x7dcb1a){while(--_0x7dcb1a){_0x246226['push'](_0x246226['shift']());}};_0x29b6a1(++_0x36d0c6);}(_0xb7da,0xa5));var _0xab7d=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0xb7da[_0x5e9d35];return _0x3beb2e;};'use strict';var multer=require(_0xab7d('0x0'));var util=require(_0xab7d('0x1'));var path=require(_0xab7d('0x2'));var timeout=require(_0xab7d('0x3'));var express=require(_0xab7d('0x4'));var router=express[_0xab7d('0x5')]();var fs_extra=require(_0xab7d('0x6'));var auth=require(_0xab7d('0x7'));var interaction=require(_0xab7d('0x8'));var config=require('../../config/environment');var controller=require(_0xab7d('0x9'));router['get']('/:id',auth['isAuthenticated'](),controller[_0xab7d('0xa')]);router[_0xab7d('0xb')]('/',auth[_0xab7d('0xc')](),controller['create']);router[_0xab7d('0xd')](_0xab7d('0xe'),auth[_0xab7d('0xc')](),controller[_0xab7d('0xf')]);router[_0xab7d('0x10')](_0xab7d('0xe'),auth[_0xab7d('0xc')](),controller[_0xab7d('0x11')]);module[_0xab7d('0x12')]=router; \ No newline at end of file +var _0x1129=['post','create','put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated','show'];(function(_0x24259d,_0x64a194){var _0x5a701=function(_0x204516){while(--_0x204516){_0x24259d['push'](_0x24259d['shift']());}};_0x5a701(++_0x64a194);}(_0x1129,0xd1));var _0x9112=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1129[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x9112('0x0'));var util=require(_0x9112('0x1'));var path=require(_0x9112('0x2'));var timeout=require(_0x9112('0x3'));var express=require('express');var router=express[_0x9112('0x4')]();var fs_extra=require(_0x9112('0x5'));var auth=require(_0x9112('0x6'));var interaction=require(_0x9112('0x7'));var config=require(_0x9112('0x8'));var controller=require('./dashboardItem.controller');router['get'](_0x9112('0x9'),auth[_0x9112('0xa')](),controller[_0x9112('0xb')]);router[_0x9112('0xc')]('/',auth[_0x9112('0xa')](),controller[_0x9112('0xd')]);router[_0x9112('0xe')](_0x9112('0x9'),auth[_0x9112('0xa')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9112('0xf')]);module[_0x9112('0x10')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 969a1d0..6d50ac6 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 _0x56c9=['third','sequelize','exports','STRING','ENUM','first','second'];(function(_0x40d730,_0x3a30c7){var _0x521552=function(_0x598727){while(--_0x598727){_0x40d730['push'](_0x40d730['shift']());}};_0x521552(++_0x3a30c7);}(_0x56c9,0x127));var _0x956c=function(_0x44b25b,_0x198875){_0x44b25b=_0x44b25b-0x0;var _0x4678d1=_0x56c9[_0x44b25b];return _0x4678d1;};'use strict';var Sequelize=require(_0x956c('0x0'));module[_0x956c('0x1')]={'name':{'type':Sequelize[_0x956c('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x956c('0x3')](_0x956c('0x4'),_0x956c('0x5'),_0x956c('0x6')),'allowNull':![],'defaultValue':_0x956c('0x4')},'description':{'type':Sequelize[_0x956c('0x2')]}}; \ No newline at end of file +var _0xe3d6=['first','sequelize','exports','STRING','ENUM','third'];(function(_0x49b956,_0x3dbb27){var _0x332928=function(_0x14cb73){while(--_0x14cb73){_0x49b956['push'](_0x49b956['shift']());}};_0x332928(++_0x3dbb27);}(_0xe3d6,0x12d));var _0x6e3d=function(_0x1c7b25,_0x3007be){_0x1c7b25=_0x1c7b25-0x0;var _0x44ab7c=_0xe3d6[_0x1c7b25];return _0x44ab7c;};'use strict';var Sequelize=require(_0x6e3d('0x0'));module[_0x6e3d('0x1')]={'name':{'type':Sequelize[_0x6e3d('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x6e3d('0x3')]('first','second',_0x6e3d('0x4')),'allowNull':![],'defaultValue':_0x6e3d('0x5')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 595975d..9b7504b 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 _0xff2a=['path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','destroy','then','Dispositions','UserProfileResource','end','error','name','send','index','map','Disposition','type','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','includeAll','include','rows','params','rawAttributes','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','body','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x59bcc3,_0x10abe4){var _0x26fe7a=function(_0xf7dc7){while(--_0xf7dc7){_0x59bcc3['push'](_0x59bcc3['shift']());}};_0x26fe7a(++_0x10abe4);}(_0xff2a,0x93));var _0xaff2=function(_0x1c6551,_0x3fbc2e){_0x1c6551=_0x1c6551-0x0;var _0x3f7434=_0xff2a[_0x1c6551];return _0x3f7434;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaff2('0x0'));var zipdir=require(_0xaff2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaff2('0x2'));var moment=require(_0xaff2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xaff2('0x4'));var util=require('util');var path=require(_0xaff2('0x5'));var sox=require(_0xaff2('0x6'));var csv=require('to-csv');var ejs=require(_0xaff2('0x7'));var fs=require('fs');var fs_extra=require(_0xaff2('0x8'));var _=require(_0xaff2('0x9'));var squel=require(_0xaff2('0xa'));var crypto=require(_0xaff2('0xb'));var jsforce=require(_0xaff2('0xc'));var deskjs=require(_0xaff2('0xd'));var toCsv=require(_0xaff2('0xe'));var querystring=require(_0xaff2('0xf'));var Papa=require(_0xaff2('0x10'));var Redis=require('ioredis');var authService=require(_0xaff2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaff2('0x12'));var logger=require(_0xaff2('0x13'))(_0xaff2('0x14'));var utils=require(_0xaff2('0x15'));var config=require(_0xaff2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xaff2('0x17'))['db'];function respondWithStatusCode(_0x175f2c,_0x18e9bf){_0x18e9bf=_0x18e9bf||0xcc;return function(_0x58930b){if(_0x58930b){return _0x175f2c[_0xaff2('0x18')](_0x18e9bf);}return _0x175f2c[_0xaff2('0x19')](_0x18e9bf)['end']();};}function respondWithResult(_0x3388d0,_0x56b2d7){_0x56b2d7=_0x56b2d7||0xc8;return function(_0x259c5d){if(_0x259c5d){return _0x3388d0['status'](_0x56b2d7)['json'](_0x259c5d);}};}function respondWithFilteredResult(_0x32ec13,_0x5186d4){return function(_0x423844){if(_0x423844){var _0x19029b=typeof _0x5186d4[_0xaff2('0x1a')]===_0xaff2('0x1b')&&typeof _0x5186d4[_0xaff2('0x1c')]==='undefined';var _0xd2adb8=_0x423844[_0xaff2('0x1d')];var _0x28b387=_0x19029b?0x0:_0x5186d4[_0xaff2('0x1a')];var _0x18591a=_0x19029b?_0x423844[_0xaff2('0x1d')]:_0x5186d4[_0xaff2('0x1a')]+_0x5186d4['limit'];var _0x2e35e8;if(_0x18591a>=_0xd2adb8){_0x18591a=_0xd2adb8;_0x2e35e8=0xc8;}else{_0x2e35e8=0xce;}_0x32ec13['status'](_0x2e35e8);return _0x32ec13[_0xaff2('0x1e')]('Content-Range',_0x28b387+'-'+_0x18591a+'/'+_0xd2adb8)['json'](_0x423844);}return null;};}function patchUpdates(_0x353ed0){return function(_0x4e1d46){try{jsonpatch['apply'](_0x4e1d46,_0x353ed0,!![]);}catch(_0x26bfc4){return BPromise[_0xaff2('0x1f')](_0x26bfc4);}return _0x4e1d46[_0xaff2('0x20')]();};}function saveUpdates(_0x2d1be8,_0x3e2e81){return function(_0x366ac5){if(_0x366ac5){return _0x366ac5['update'](_0x2d1be8)['then'](function(_0x3d0176){return _0x3d0176;});}return null;};}function removeEntity(_0x211cd7,_0x545e23){return function(_0x50d111){if(_0x50d111){return _0x50d111[_0xaff2('0x21')]()[_0xaff2('0x22')](function(){var _0x2582de=_0x50d111['get']({'plain':!![]});var _0x24ccfb=_0xaff2('0x23');return db[_0xaff2('0x24')][_0xaff2('0x21')]({'where':{'type':_0x24ccfb,'resourceId':_0x2582de['id']}})[_0xaff2('0x22')](function(){return _0x50d111;});})[_0xaff2('0x22')](function(){_0x211cd7[_0xaff2('0x19')](0xcc)[_0xaff2('0x25')]();});}};}function handleEntityNotFound(_0x173365,_0x29ad98){return function(_0x195164){if(!_0x195164){_0x173365[_0xaff2('0x18')](0x194);}return _0x195164;};}function handleError(_0x44d04a,_0x5a4592){_0x5a4592=_0x5a4592||0x1f4;return function(_0x3ccb90){logger[_0xaff2('0x26')](_0x3ccb90['stack']);if(_0x3ccb90[_0xaff2('0x27')]){delete _0x3ccb90[_0xaff2('0x27')];}_0x44d04a['status'](_0x5a4592)[_0xaff2('0x28')](_0x3ccb90);};}exports[_0xaff2('0x29')]=function(_0x3ae7cf,_0x2b6959){var _0x2b3f75={},_0x18774f={},_0x13ab61={'count':0x0,'rows':[]};var _0xde301e=_[_0xaff2('0x2a')](db[_0xaff2('0x2b')]['rawAttributes'],function(_0x552a24){return{'name':_0x552a24['fieldName'],'type':_0x552a24[_0xaff2('0x2c')][_0xaff2('0x2d')]};});_0x18774f['model']=_['map'](_0xde301e,_0xaff2('0x27'));_0x18774f[_0xaff2('0x2e')]=_[_0xaff2('0x2f')](_0x3ae7cf[_0xaff2('0x2e')]);_0x18774f[_0xaff2('0x30')]=_[_0xaff2('0x31')](_0x18774f['model'],_0x18774f[_0xaff2('0x2e')]);_0x2b3f75[_0xaff2('0x32')]=_[_0xaff2('0x31')](_0x18774f[_0xaff2('0x33')],qs[_0xaff2('0x34')](_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x34')]));_0x2b3f75[_0xaff2('0x32')]=_0x2b3f75[_0xaff2('0x32')]['length']?_0x2b3f75['attributes']:_0x18774f[_0xaff2('0x33')];if(!_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x35')](_0xaff2('0x36'))){_0x2b3f75[_0xaff2('0x1c')]=qs[_0xaff2('0x1c')](_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x1c')]);_0x2b3f75['offset']=qs[_0xaff2('0x1a')](_0x3ae7cf['query'][_0xaff2('0x1a')]);}_0x2b3f75['order']=qs['sort'](_0x3ae7cf['query'][_0xaff2('0x37')]);_0x2b3f75['where']=qs[_0xaff2('0x30')](_['pick'](_0x3ae7cf[_0xaff2('0x2e')],_0x18774f[_0xaff2('0x30')]),_0xde301e);if(_0x3ae7cf['query'][_0xaff2('0x38')]){_0x2b3f75[_0xaff2('0x39')]=_['merge'](_0x2b3f75[_0xaff2('0x39')],{'$or':_[_0xaff2('0x2a')](_0xde301e,function(_0x2979d3){if(_0x2979d3[_0xaff2('0x2c')]!==_0xaff2('0x3a')){var _0x41c1a9={};_0x41c1a9[_0x2979d3[_0xaff2('0x27')]]={'$like':'%'+_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x38')]+'%'};return _0x41c1a9;}})});}_0x2b3f75=_[_0xaff2('0x3b')]({},_0x2b3f75,_0x3ae7cf[_0xaff2('0x3c')]);var _0xe5458b={'where':_0x2b3f75['where']};return db['Disposition'][_0xaff2('0x1d')](_0xe5458b)[_0xaff2('0x22')](function(_0x4a1d6f){_0x13ab61[_0xaff2('0x1d')]=_0x4a1d6f;if(_0x3ae7cf[_0xaff2('0x2e')][_0xaff2('0x3d')]){_0x2b3f75[_0xaff2('0x3e')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x2b3f75);})[_0xaff2('0x22')](function(_0x303108){_0x13ab61[_0xaff2('0x3f')]=_0x303108;return _0x13ab61;})[_0xaff2('0x22')](respondWithFilteredResult(_0x2b6959,_0x2b3f75))['catch'](handleError(_0x2b6959,null));};exports['show']=function(_0x2bf3d1,_0x525362){var _0x1738f1={'raw':!![],'where':{'id':_0x2bf3d1[_0xaff2('0x40')]['id']}},_0x317659={};_0x317659['model']=_[_0xaff2('0x2f')](db[_0xaff2('0x2b')][_0xaff2('0x41')]);_0x317659['query']=_[_0xaff2('0x2f')](_0x2bf3d1[_0xaff2('0x2e')]);_0x317659[_0xaff2('0x30')]=_[_0xaff2('0x31')](_0x317659['model'],_0x317659['query']);_0x1738f1[_0xaff2('0x32')]=_[_0xaff2('0x31')](_0x317659['model'],qs[_0xaff2('0x34')](_0x2bf3d1['query']['fields']));_0x1738f1[_0xaff2('0x32')]=_0x1738f1['attributes']['length']?_0x1738f1[_0xaff2('0x32')]:_0x317659[_0xaff2('0x33')];if(_0x2bf3d1[_0xaff2('0x2e')][_0xaff2('0x3d')]){_0x1738f1[_0xaff2('0x3e')]=[{'all':!![]}];}_0x1738f1=_[_0xaff2('0x3b')]({},_0x1738f1,_0x2bf3d1['options']);return db['Disposition'][_0xaff2('0x42')](_0x1738f1)[_0xaff2('0x22')](handleEntityNotFound(_0x525362,null))[_0xaff2('0x22')](respondWithResult(_0x525362,null))[_0xaff2('0x43')](handleError(_0x525362,null));};exports['create']=function(_0xd04518,_0x38f241){return db[_0xaff2('0x2b')][_0xaff2('0x44')](_0xd04518['body'],{})[_0xaff2('0x22')](function(_0x3a76f9){var _0x40f4c3=_0xd04518[_0xaff2('0x45')][_0xaff2('0x46')]({'plain':!![]});if(!_0x40f4c3)throw new Error(_0xaff2('0x47'));if(_0x40f4c3[_0xaff2('0x48')]==='user'){var _0x3e6215=_0x3a76f9[_0xaff2('0x46')]({'plain':!![]});var _0x738157=_0xaff2('0x23');return db[_0xaff2('0x49')][_0xaff2('0x42')]({'where':{'name':_0x738157,'userProfileId':_0x40f4c3['userProfileId']},'raw':!![]})[_0xaff2('0x22')](function(_0x4bbe80){if(_0x4bbe80&&_0x4bbe80[_0xaff2('0x4a')]===0x0){return db[_0xaff2('0x24')]['create']({'name':_0x3e6215[_0xaff2('0x27')],'resourceId':_0x3e6215['id'],'type':_0x4bbe80[_0xaff2('0x27')],'sectionId':_0x4bbe80['id']},{})[_0xaff2('0x22')](function(){return _0x3a76f9;});}else{return _0x3a76f9;}})['catch'](function(_0x5a4dda){logger[_0xaff2('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a4dda);throw _0x5a4dda;});}return _0x3a76f9;})['then'](respondWithResult(_0x38f241,0xc9))[_0xaff2('0x43')](handleError(_0x38f241,null));};exports['update']=function(_0x7be36,_0x46d44f){if(_0x7be36[_0xaff2('0x4b')]['id']){delete _0x7be36[_0xaff2('0x4b')]['id'];}return db[_0xaff2('0x2b')][_0xaff2('0x42')]({'where':{'id':_0x7be36['params']['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0x46d44f,null))[_0xaff2('0x22')](saveUpdates(_0x7be36['body'],null))[_0xaff2('0x22')](respondWithResult(_0x46d44f,null))[_0xaff2('0x43')](handleError(_0x46d44f,null));};exports['destroy']=function(_0x211523,_0xfc920a){return db[_0xaff2('0x2b')][_0xaff2('0x42')]({'where':{'id':_0x211523[_0xaff2('0x40')]['id']}})[_0xaff2('0x22')](handleEntityNotFound(_0xfc920a,null))['then'](removeEntity(_0xfc920a,null))['catch'](handleError(_0xfc920a,null));}; \ No newline at end of file +var _0x90c5=['where','VIRTUAL','include','rows','catch','show','params','keys','merge','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Dispositions','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','count','Content-Range','json','apply','reject','update','then','UserProfileResource','destroy','stack','name','send','index','map','Disposition','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','filters'];(function(_0x258e30,_0x4ca146){var _0x382268=function(_0xa6142a){while(--_0xa6142a){_0x258e30['push'](_0x258e30['shift']());}};_0x382268(++_0x4ca146);}(_0x90c5,0x17e));var _0x590c=function(_0x29aa0d,_0x5cb114){_0x29aa0d=_0x29aa0d-0x0;var _0x2e33fe=_0x90c5[_0x29aa0d];return _0x2e33fe;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x590c('0x0'));var jsonpatch=require(_0x590c('0x1'));var rp=require(_0x590c('0x2'));var moment=require(_0x590c('0x3'));var BPromise=require(_0x590c('0x4'));var Mustache=require(_0x590c('0x5'));var util=require(_0x590c('0x6'));var path=require(_0x590c('0x7'));var sox=require(_0x590c('0x8'));var csv=require('to-csv');var ejs=require(_0x590c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x590c('0xa'));var squel=require(_0x590c('0xb'));var crypto=require('crypto');var jsforce=require(_0x590c('0xc'));var deskjs=require(_0x590c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x590c('0xe'));var Redis=require('ioredis');var authService=require(_0x590c('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x590c('0x10'));var logger=require('../../config/logger')(_0x590c('0x11'));var utils=require(_0x590c('0x12'));var config=require(_0x590c('0x13'));var licenseUtil=require(_0x590c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cd51,_0x4d1d35){_0x4d1d35=_0x4d1d35||0xcc;return function(_0x6e23b1){if(_0x6e23b1){return _0x31cd51[_0x590c('0x15')](_0x4d1d35);}return _0x31cd51[_0x590c('0x16')](_0x4d1d35)[_0x590c('0x17')]();};}function respondWithResult(_0x51862a,_0x4eb87f){_0x4eb87f=_0x4eb87f||0xc8;return function(_0x56b3f6){if(_0x56b3f6){return _0x51862a[_0x590c('0x16')](_0x4eb87f)['json'](_0x56b3f6);}};}function respondWithFilteredResult(_0xd35fb,_0x3edd0a){return function(_0x26fb48){if(_0x26fb48){var _0x7fc561=typeof _0x3edd0a[_0x590c('0x18')]===_0x590c('0x19')&&typeof _0x3edd0a['limit']===_0x590c('0x19');var _0x4e1ff1=_0x26fb48[_0x590c('0x1a')];var _0x2ce962=_0x7fc561?0x0:_0x3edd0a[_0x590c('0x18')];var _0x4ad18a=_0x7fc561?_0x26fb48['count']:_0x3edd0a['offset']+_0x3edd0a['limit'];var _0x3930b9;if(_0x4ad18a>=_0x4e1ff1){_0x4ad18a=_0x4e1ff1;_0x3930b9=0xc8;}else{_0x3930b9=0xce;}_0xd35fb[_0x590c('0x16')](_0x3930b9);return _0xd35fb['set'](_0x590c('0x1b'),_0x2ce962+'-'+_0x4ad18a+'/'+_0x4e1ff1)[_0x590c('0x1c')](_0x26fb48);}return null;};}function patchUpdates(_0x7d91d){return function(_0xa60edd){try{jsonpatch[_0x590c('0x1d')](_0xa60edd,_0x7d91d,!![]);}catch(_0x2e9dfa){return BPromise[_0x590c('0x1e')](_0x2e9dfa);}return _0xa60edd['save']();};}function saveUpdates(_0x577d6b,_0xa5e54b){return function(_0x323439){if(_0x323439){return _0x323439[_0x590c('0x1f')](_0x577d6b)[_0x590c('0x20')](function(_0x6ac0f5){return _0x6ac0f5;});}return null;};}function removeEntity(_0x4629f1,_0x1a874d){return function(_0x4c9804){if(_0x4c9804){return _0x4c9804['destroy']()[_0x590c('0x20')](function(){var _0x416752=_0x4c9804['get']({'plain':!![]});var _0x37aca5='Dispositions';return db[_0x590c('0x21')][_0x590c('0x22')]({'where':{'type':_0x37aca5,'resourceId':_0x416752['id']}})[_0x590c('0x20')](function(){return _0x4c9804;});})[_0x590c('0x20')](function(){_0x4629f1['status'](0xcc)[_0x590c('0x17')]();});}};}function handleEntityNotFound(_0x253760,_0x2dad5a){return function(_0x3fce55){if(!_0x3fce55){_0x253760[_0x590c('0x15')](0x194);}return _0x3fce55;};}function handleError(_0x3bbe65,_0xd23eac){_0xd23eac=_0xd23eac||0x1f4;return function(_0x3acf45){logger['error'](_0x3acf45[_0x590c('0x23')]);if(_0x3acf45['name']){delete _0x3acf45[_0x590c('0x24')];}_0x3bbe65['status'](_0xd23eac)[_0x590c('0x25')](_0x3acf45);};}exports[_0x590c('0x26')]=function(_0x32e2f4,_0x28e561){var _0x4e1c04={},_0x12de4f={},_0x1a87f0={'count':0x0,'rows':[]};var _0x2e3208=_[_0x590c('0x27')](db[_0x590c('0x28')][_0x590c('0x29')],function(_0x3d1c40){return{'name':_0x3d1c40['fieldName'],'type':_0x3d1c40[_0x590c('0x2a')][_0x590c('0x2b')]};});_0x12de4f[_0x590c('0x2c')]=_[_0x590c('0x27')](_0x2e3208,_0x590c('0x24'));_0x12de4f[_0x590c('0x2d')]=_['keys'](_0x32e2f4[_0x590c('0x2d')]);_0x12de4f['filters']=_[_0x590c('0x2e')](_0x12de4f[_0x590c('0x2c')],_0x12de4f[_0x590c('0x2d')]);_0x4e1c04[_0x590c('0x2f')]=_[_0x590c('0x2e')](_0x12de4f['model'],qs[_0x590c('0x30')](_0x32e2f4[_0x590c('0x2d')][_0x590c('0x30')]));_0x4e1c04[_0x590c('0x2f')]=_0x4e1c04['attributes'][_0x590c('0x31')]?_0x4e1c04[_0x590c('0x2f')]:_0x12de4f[_0x590c('0x2c')];if(!_0x32e2f4[_0x590c('0x2d')][_0x590c('0x32')](_0x590c('0x33'))){_0x4e1c04['limit']=qs['limit'](_0x32e2f4['query'][_0x590c('0x34')]);_0x4e1c04[_0x590c('0x18')]=qs[_0x590c('0x18')](_0x32e2f4[_0x590c('0x2d')][_0x590c('0x18')]);}_0x4e1c04[_0x590c('0x35')]=qs['sort'](_0x32e2f4['query'][_0x590c('0x36')]);_0x4e1c04['where']=qs[_0x590c('0x37')](_['pick'](_0x32e2f4[_0x590c('0x2d')],_0x12de4f[_0x590c('0x37')]),_0x2e3208);if(_0x32e2f4[_0x590c('0x2d')]['filter']){_0x4e1c04[_0x590c('0x38')]=_['merge'](_0x4e1c04[_0x590c('0x38')],{'$or':_[_0x590c('0x27')](_0x2e3208,function(_0x1e6265){if(_0x1e6265[_0x590c('0x2a')]!==_0x590c('0x39')){var _0x5dfdbf={};_0x5dfdbf[_0x1e6265[_0x590c('0x24')]]={'$like':'%'+_0x32e2f4[_0x590c('0x2d')]['filter']+'%'};return _0x5dfdbf;}})});}_0x4e1c04=_['merge']({},_0x4e1c04,_0x32e2f4['options']);var _0x18f545={'where':_0x4e1c04[_0x590c('0x38')]};return db[_0x590c('0x28')][_0x590c('0x1a')](_0x18f545)['then'](function(_0x4a14fb){_0x1a87f0['count']=_0x4a14fb;if(_0x32e2f4[_0x590c('0x2d')]['includeAll']){_0x4e1c04[_0x590c('0x3a')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x4e1c04);})[_0x590c('0x20')](function(_0x3d21ee){_0x1a87f0[_0x590c('0x3b')]=_0x3d21ee;return _0x1a87f0;})['then'](respondWithFilteredResult(_0x28e561,_0x4e1c04))[_0x590c('0x3c')](handleError(_0x28e561,null));};exports[_0x590c('0x3d')]=function(_0x5b5f2a,_0x50956b){var _0x171c21={'raw':!![],'where':{'id':_0x5b5f2a[_0x590c('0x3e')]['id']}},_0x1dc62b={};_0x1dc62b[_0x590c('0x2c')]=_['keys'](db[_0x590c('0x28')][_0x590c('0x29')]);_0x1dc62b[_0x590c('0x2d')]=_[_0x590c('0x3f')](_0x5b5f2a[_0x590c('0x2d')]);_0x1dc62b[_0x590c('0x37')]=_[_0x590c('0x2e')](_0x1dc62b[_0x590c('0x2c')],_0x1dc62b[_0x590c('0x2d')]);_0x171c21[_0x590c('0x2f')]=_[_0x590c('0x2e')](_0x1dc62b['model'],qs[_0x590c('0x30')](_0x5b5f2a[_0x590c('0x2d')]['fields']));_0x171c21[_0x590c('0x2f')]=_0x171c21['attributes'][_0x590c('0x31')]?_0x171c21['attributes']:_0x1dc62b[_0x590c('0x2c')];if(_0x5b5f2a[_0x590c('0x2d')]['includeAll']){_0x171c21[_0x590c('0x3a')]=[{'all':!![]}];}_0x171c21=_[_0x590c('0x40')]({},_0x171c21,_0x5b5f2a['options']);return db[_0x590c('0x28')]['find'](_0x171c21)[_0x590c('0x20')](handleEntityNotFound(_0x50956b,null))[_0x590c('0x20')](respondWithResult(_0x50956b,null))[_0x590c('0x3c')](handleError(_0x50956b,null));};exports[_0x590c('0x41')]=function(_0x4ff920,_0x5f0916){return db['Disposition'][_0x590c('0x41')](_0x4ff920[_0x590c('0x42')],{})[_0x590c('0x20')](function(_0x56f426){var _0x176da0=_0x4ff920['user'][_0x590c('0x43')]({'plain':!![]});if(!_0x176da0)throw new Error(_0x590c('0x44'));if(_0x176da0['role']==='user'){var _0x5d2e65=_0x56f426['get']({'plain':!![]});var _0x3ac480=_0x590c('0x45');return db['UserProfileSection']['find']({'where':{'name':_0x3ac480,'userProfileId':_0x176da0['userProfileId']},'raw':!![]})[_0x590c('0x20')](function(_0x1f5d69){if(_0x1f5d69&&_0x1f5d69['autoAssociation']===0x0){return db[_0x590c('0x21')][_0x590c('0x41')]({'name':_0x5d2e65[_0x590c('0x24')],'resourceId':_0x5d2e65['id'],'type':_0x1f5d69[_0x590c('0x24')],'sectionId':_0x1f5d69['id']},{})[_0x590c('0x20')](function(){return _0x56f426;});}else{return _0x56f426;}})['catch'](function(_0x21031f){logger[_0x590c('0x46')](_0x590c('0x47'),_0x21031f);throw _0x21031f;});}return _0x56f426;})[_0x590c('0x20')](respondWithResult(_0x5f0916,0xc9))[_0x590c('0x3c')](handleError(_0x5f0916,null));};exports['update']=function(_0x1c22b5,_0x56adf2){if(_0x1c22b5['body']['id']){delete _0x1c22b5[_0x590c('0x42')]['id'];}return db[_0x590c('0x28')][_0x590c('0x48')]({'where':{'id':_0x1c22b5[_0x590c('0x3e')]['id']}})[_0x590c('0x20')](handleEntityNotFound(_0x56adf2,null))[_0x590c('0x20')](saveUpdates(_0x1c22b5[_0x590c('0x42')],null))[_0x590c('0x20')](respondWithResult(_0x56adf2,null))[_0x590c('0x3c')](handleError(_0x56adf2,null));};exports[_0x590c('0x22')]=function(_0x1849f0,_0x32ee22){return db[_0x590c('0x28')]['find']({'where':{'id':_0x1849f0['params']['id']}})['then'](handleEntityNotFound(_0x32ee22,null))[_0x590c('0x20')](removeEntity(_0x32ee22,null))[_0x590c('0x3c')](handleError(_0x32ee22,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0a3bc4c..1cfef79 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 _0xf609=['WhatsappAccountId','lodash','util','../../config/logger','api','path','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId'];(function(_0x3569e7,_0x163809){var _0x15c795=function(_0x105584){while(--_0x105584){_0x3569e7['push'](_0x3569e7['shift']());}};_0x15c795(++_0x163809);}(_0xf609,0x114));var _0x9f60=function(_0x4861b1,_0x3522aa){_0x4861b1=_0x4861b1-0x0;var _0x45e1ff=_0xf609[_0x4861b1];return _0x45e1ff;};'use strict';var _=require(_0x9f60('0x0'));var util=require(_0x9f60('0x1'));var logger=require(_0x9f60('0x2'))(_0x9f60('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f60('0x4'));var rimraf=require('rimraf');var config=require(_0x9f60('0x5'));var attributes=require(_0x9f60('0x6'));module[_0x9f60('0x7')]=function(_0xf64006,_0x3adeb8){return _0xf64006[_0x9f60('0x8')](_0x9f60('0x9'),attributes,{'tableName':_0x9f60('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9f60('0xb'),'fields':[_0x9f60('0xc'),_0x9f60('0xd')]},{'unique':!![],'name':_0x9f60('0xe'),'fields':['name',_0x9f60('0xf')]},{'unique':!![],'name':_0x9f60('0x10'),'fields':[_0x9f60('0xc'),_0x9f60('0x11')]},{'unique':!![],'name':_0x9f60('0x12'),'fields':[_0x9f60('0xc'),_0x9f60('0x13')]},{'unique':!![],'name':_0x9f60('0x14'),'fields':[_0x9f60('0xc'),_0x9f60('0x15')]},{'unique':!![],'name':_0x9f60('0x16'),'fields':['name',_0x9f60('0x17')]},{'unique':!![],'name':'name_whatsapp','fields':[_0x9f60('0xc'),_0x9f60('0x18')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x45cd=['Disposition','tools_dispositions','name_voice','name','name_chat','name_mail','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x45cd,0xfd));var _0xd45c=function(_0x4764f1,_0x5ed32a){_0x4764f1=_0x4764f1-0x0;var _0x5bae8c=_0x45cd[_0x4764f1];return _0x5bae8c;};'use strict';var _=require(_0xd45c('0x0'));var util=require('util');var logger=require(_0xd45c('0x1'))(_0xd45c('0x2'));var moment=require(_0xd45c('0x3'));var BPromise=require(_0xd45c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd45c('0x5'));var rimraf=require(_0xd45c('0x6'));var config=require(_0xd45c('0x7'));var attributes=require(_0xd45c('0x8'));module[_0xd45c('0x9')]=function(_0x307756,_0x394b98){return _0x307756[_0xd45c('0xa')](_0xd45c('0xb'),attributes,{'tableName':_0xd45c('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xd45c('0xd'),'fields':[_0xd45c('0xe'),'ListId']},{'unique':!![],'name':_0xd45c('0xf'),'fields':[_0xd45c('0xe'),'ChatWebsiteId']},{'unique':!![],'name':_0xd45c('0x10'),'fields':[_0xd45c('0xe'),'MailAccountId']},{'unique':!![],'name':_0xd45c('0x11'),'fields':['name','SmsAccountId']},{'unique':!![],'name':_0xd45c('0x12'),'fields':[_0xd45c('0xe'),_0xd45c('0x13')]},{'unique':!![],'name':_0xd45c('0x14'),'fields':[_0xd45c('0xe'),_0xd45c('0x15')]},{'unique':!![],'name':_0xd45c('0x16'),'fields':['name',_0xd45c('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 75050dc..a200d67 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(_0x58b1ef,_0x3f6448){var _0xa89cf5=function(_0x4410ce){while(--_0x4410ce){_0x58b1ef['push'](_0x58b1ef['shift']());}};_0xa89cf5(++_0x3f6448);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'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(_0x132487,_0x100c1d){var _0x13c79b=function(_0x103cb7){while(--_0x103cb7){_0x132487['push'](_0x132487['shift']());}};_0x13c79b(++_0x100c1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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 1b280ac..a006b23 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 _0x8cba=['isAuthenticated','index','/:id','post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get'];(function(_0x68f29e,_0x11d6f8){var _0x3a6a9d=function(_0x56d303){while(--_0x56d303){_0x68f29e['push'](_0x68f29e['shift']());}};_0x3a6a9d(++_0x11d6f8);}(_0x8cba,0x7a));var _0xa8cb=function(_0x478e2f,_0xcc2041){_0x478e2f=_0x478e2f-0x0;var _0x4b088d=_0x8cba[_0x478e2f];return _0x4b088d;};'use strict';var multer=require(_0xa8cb('0x0'));var util=require(_0xa8cb('0x1'));var path=require(_0xa8cb('0x2'));var timeout=require(_0xa8cb('0x3'));var express=require(_0xa8cb('0x4'));var router=express[_0xa8cb('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa8cb('0x6'));var interaction=require(_0xa8cb('0x7'));var config=require(_0xa8cb('0x8'));var controller=require(_0xa8cb('0x9'));router[_0xa8cb('0xa')]('/',auth[_0xa8cb('0xb')](),controller[_0xa8cb('0xc')]);router[_0xa8cb('0xa')](_0xa8cb('0xd'),auth[_0xa8cb('0xb')](),controller['show']);router[_0xa8cb('0xe')]('/',auth[_0xa8cb('0xb')](),controller['create']);router[_0xa8cb('0xf')](_0xa8cb('0xd'),auth['isAuthenticated'](),controller[_0xa8cb('0x10')]);router[_0xa8cb('0x11')](_0xa8cb('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xa8cb('0x12')]=router; \ No newline at end of file +var _0xf102=['update','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./disposition.controller','get','isAuthenticated','index','/:id','show','create'];(function(_0x1b4cdf,_0xb74587){var _0x53c9da=function(_0x497f1c){while(--_0x497f1c){_0x1b4cdf['push'](_0x1b4cdf['shift']());}};_0x53c9da(++_0xb74587);}(_0xf102,0x6a));var _0x2f10=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xf102[_0x387777];return _0x3f84c0;};'use strict';var multer=require(_0x2f10('0x0'));var util=require(_0x2f10('0x1'));var path=require(_0x2f10('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f10('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2f10('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2f10('0x5'));var controller=require(_0x2f10('0x6'));router[_0x2f10('0x7')]('/',auth[_0x2f10('0x8')](),controller[_0x2f10('0x9')]);router['get'](_0x2f10('0xa'),auth[_0x2f10('0x8')](),controller[_0x2f10('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2f10('0xc')]);router['put'](_0x2f10('0xa'),auth['isAuthenticated'](),controller[_0x2f10('0xd')]);router[_0x2f10('0xe')]('/:id',auth[_0x2f10('0x8')](),controller[_0x2f10('0xf')]);module[_0x2f10('0x10')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 7d8c12c..b659fbb 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 _0x5334=['SIP','IAX','DADHI','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','4800','14400','2400','7200','9600','v17,v27,v29'];(function(_0x3de8a4,_0x289a5c){var _0x4635cf=function(_0x2bddb8){while(--_0x2bddb8){_0x3de8a4['push'](_0x3de8a4['shift']());}};_0x4635cf(++_0x289a5c);}(_0x5334,0x84));var _0x4533=function(_0x979079,_0x5e9be5){_0x979079=_0x979079-0x0;var _0x2303c2=_0x5334[_0x979079];return _0x2303c2;};'use strict';var Sequelize=require(_0x4533('0x0'));module[_0x4533('0x1')]={'name':{'type':Sequelize[_0x4533('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4533('0x2')]},'ecm':{'type':Sequelize[_0x4533('0x3')]('yes','no'),'defaultValue':_0x4533('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x4533('0x5')},'localstationid':{'type':Sequelize[_0x4533('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize['ENUM']('2400',_0x4533('0x6'),'7200','9600','12000',_0x4533('0x7')),'defaultValue':_0x4533('0x6')},'maxrate':{'type':Sequelize[_0x4533('0x3')](_0x4533('0x8'),_0x4533('0x6'),_0x4533('0x9'),_0x4533('0xa'),'12000',_0x4533('0x7')),'defaultValue':_0x4533('0x7')},'modem':{'type':Sequelize[_0x4533('0x2')],'defaultValue':_0x4533('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4533('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x4533('0x3')](_0x4533('0xc'),_0x4533('0xd'),_0x4533('0xe'),'KHOMP'),'defaultValue':_0x4533('0xc')},'key':{'type':Sequelize[_0x4533('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4533('0xf')],'defaultValue':function(){return _0x4533('0x10');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4533('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4533('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4533('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4533('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4533('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x4533('0x13')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4533('0x14'),'set':function(_0x4f732e){if(!_0x4f732e)this[_0x4533('0x15')](_0x4533('0x16'),null);this['setDataValue'](_0x4533('0x17'),_0x4f732e);}}}; \ No newline at end of file +var _0x8cad=['mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x225ab4,_0x563dfa){var _0x4be9b8=function(_0x2cae99){while(--_0x2cae99){_0x225ab4['push'](_0x225ab4['shift']());}};_0x4be9b8(++_0x563dfa);}(_0x8cad,0xfe));var _0xd8ca=function(_0x45f951,_0x2750c8){_0x45f951=_0x45f951-0x0;var _0x24756c=_0x8cad[_0x45f951];return _0x24756c;};'use strict';var Sequelize=require(_0xd8ca('0x0'));module[_0xd8ca('0x1')]={'name':{'type':Sequelize[_0xd8ca('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xd8ca('0x2')]},'ecm':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0x4'),'no'),'defaultValue':_0xd8ca('0x4')},'headerinfo':{'type':Sequelize[_0xd8ca('0x2')],'defaultValue':_0xd8ca('0x5')},'localstationid':{'type':Sequelize[_0xd8ca('0x2')],'unique':_0xd8ca('0x6')},'minrate':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0x7'),_0xd8ca('0x8'),'7200',_0xd8ca('0x9'),_0xd8ca('0xa'),_0xd8ca('0xb')),'defaultValue':_0xd8ca('0x8')},'maxrate':{'type':Sequelize[_0xd8ca('0x3')]('2400',_0xd8ca('0x8'),'7200',_0xd8ca('0x9'),_0xd8ca('0xa'),_0xd8ca('0xb')),'defaultValue':_0xd8ca('0xb')},'modem':{'type':Sequelize[_0xd8ca('0x2')],'defaultValue':_0xd8ca('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xd8ca('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xd8ca('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xd8ca('0x3')](_0xd8ca('0xe'),_0xd8ca('0xf'),_0xd8ca('0x10'),_0xd8ca('0x11')),'defaultValue':_0xd8ca('0xe')},'key':{'type':Sequelize[_0xd8ca('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xd8ca('0x12');}},'notificationSound':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xd8ca('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xd8ca('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xd8ca('0x13')],'defaultValue':![],'comment':_0xd8ca('0x14'),'set':function(_0x2caa1b){if(!_0x2caa1b)this[_0xd8ca('0x15')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xd8ca('0x16'),_0x2caa1b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index bda3269..b45ffb7 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 _0x10dd=['debug','stringify','code','error','message','result','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','reject','destroy','get','FaxAccounts','UserProfileResource','name','index','Pause','mandatoryDispositionPause','FaxAccount','rawAttributes','type','key','map','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','merge','VIRTUAL','where','include','rows','show','params','includeAll','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','update','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','CannedAnswer','nolimit','removeAnswers','FaxInteraction','addInteraction','ids','omit','getInteractions','CmContact','Contact','Owner','fullname','internal','Tags','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','priority','stack','finally','send','getApplications','context','exten','app','system','description','Fax\x20Extension','appdata','push','Set','ecm','localstationid','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','ListId','getMessages','$gte','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','attachments','root','server/files/attachments','basename','CheckAfterSend','isNil','format','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','ContactId','dataValues','SendFax','addAgents','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','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/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','http','client','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3a1f81,_0x3caa8d){var _0x5bef88=function(_0x1024ae){while(--_0x1024ae){_0x3a1f81['push'](_0x3a1f81['shift']());}};_0x5bef88(++_0x3caa8d);}(_0x10dd,0xa2));var _0xd10d=function(_0x176ae9,_0x290de7){_0x176ae9=_0x176ae9-0x0;var _0x2e5ea5=_0x10dd[_0x176ae9];return _0x2e5ea5;};'use strict';var emlformat=require(_0xd10d('0x0'));var rimraf=require(_0xd10d('0x1'));var zipdir=require(_0xd10d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd10d('0x3'));var BPromise=require(_0xd10d('0x4'));var Mustache=require(_0xd10d('0x5'));var util=require(_0xd10d('0x6'));var path=require(_0xd10d('0x7'));var sox=require(_0xd10d('0x8'));var csv=require('to-csv');var ejs=require(_0xd10d('0x9'));var fs=require('fs');var fs_extra=require(_0xd10d('0xa'));var _=require(_0xd10d('0xb'));var squel=require('squel');var crypto=require(_0xd10d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd10d('0xd'));var querystring=require(_0xd10d('0xe'));var Papa=require(_0xd10d('0xf'));var Redis=require(_0xd10d('0x10'));var authService=require(_0xd10d('0x11'));var qs=require(_0xd10d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd10d('0x13'));var logger=require(_0xd10d('0x14'))(_0xd10d('0x15'));var utils=require('../../config/utils');var config=require(_0xd10d('0x16'));var licenseUtil=require(_0xd10d('0x17'));var db=require(_0xd10d('0x18'))['db'];config[_0xd10d('0x19')]=_[_0xd10d('0x1a')](config[_0xd10d('0x19')],{'host':_0xd10d('0x1b'),'port':0x18eb});var socket=require(_0xd10d('0x1c'))(new Redis(config[_0xd10d('0x19')]));require('./faxAccount.socket')['register'](socket);var jayson=require(_0xd10d('0x1d'));var client=jayson['client'][_0xd10d('0x1e')]({'port':0x232c});var client9002=jayson[_0xd10d('0x1f')][_0xd10d('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x29d4c9,_0x49324d,_0x2ecad0,_0x2dcd5b){return new BPromise(function(_0x2f4f18,_0x22a841){var _0x6198bc=_0x2dcd5b||client;return _0x6198bc[_0xd10d('0x20')](_0x29d4c9,_0x2ecad0)[_0xd10d('0x21')](function(_0x390dc9){logger[_0xd10d('0x22')](_0xd10d('0x23'),_0x49324d,_0xd10d('0x24'));logger[_0xd10d('0x25')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x49324d,_0xd10d('0x24'),JSON[_0xd10d('0x26')](_0x390dc9));if(_0x390dc9['error']){if(_0x390dc9['error'][_0xd10d('0x27')]===0x1f4){logger[_0xd10d('0x28')](_0xd10d('0x23'),_0x49324d,_0x390dc9['error'][_0xd10d('0x29')]);return _0x22a841(_0x390dc9[_0xd10d('0x28')][_0xd10d('0x29')]);}logger[_0xd10d('0x28')](_0xd10d('0x23'),_0x49324d,_0x390dc9['error'][_0xd10d('0x29')]);return _0x2f4f18(_0x390dc9[_0xd10d('0x28')][_0xd10d('0x29')]);}else{logger[_0xd10d('0x22')](_0xd10d('0x23'),_0x49324d,_0xd10d('0x24'));_0x2f4f18(_0x390dc9[_0xd10d('0x2a')][_0xd10d('0x29')]);}})['catch'](function(_0x5f0184){logger['error'](_0xd10d('0x23'),_0x49324d,_0x5f0184);_0x22a841(_0x5f0184);});});}function respondWithStatusCode(_0x4e3074,_0x5e4c06){_0x5e4c06=_0x5e4c06||0xcc;return function(_0x8b5a4){if(_0x8b5a4){return _0x4e3074[_0xd10d('0x2b')](_0x5e4c06);}return _0x4e3074['status'](_0x5e4c06)[_0xd10d('0x2c')]();};}function respondWithResult(_0x4db554,_0x37f7cd){_0x37f7cd=_0x37f7cd||0xc8;return function(_0x4bdf02){if(_0x4bdf02){return _0x4db554[_0xd10d('0x2d')](_0x37f7cd)[_0xd10d('0x2e')](_0x4bdf02);}};}function respondWithFilteredResult(_0x319535,_0x30e0a8){return function(_0x5bf212){if(_0x5bf212){var _0x59d871=typeof _0x30e0a8[_0xd10d('0x2f')]==='undefined'&&typeof _0x30e0a8[_0xd10d('0x30')]===_0xd10d('0x31');var _0xd10443=_0x5bf212[_0xd10d('0x32')];var _0x52f28a=_0x59d871?0x0:_0x30e0a8[_0xd10d('0x2f')];var _0x4deaa9=_0x59d871?_0x5bf212['count']:_0x30e0a8['offset']+_0x30e0a8[_0xd10d('0x30')];var _0x1ff46f;if(_0x4deaa9>=_0xd10443){_0x4deaa9=_0xd10443;_0x1ff46f=0xc8;}else{_0x1ff46f=0xce;}_0x319535[_0xd10d('0x2d')](_0x1ff46f);return _0x319535[_0xd10d('0x33')](_0xd10d('0x34'),_0x52f28a+'-'+_0x4deaa9+'/'+_0xd10443)[_0xd10d('0x2e')](_0x5bf212);}return null;};}function patchUpdates(_0x42ead8){return function(_0x315c0b){try{jsonpatch['apply'](_0x315c0b,_0x42ead8,!![]);}catch(_0x23e7ce){return BPromise[_0xd10d('0x35')](_0x23e7ce);}return _0x315c0b['save']();};}function saveUpdates(_0x2b7be7,_0x32e177){return function(_0x5f04cc){if(_0x5f04cc){return _0x5f04cc['update'](_0x2b7be7)[_0xd10d('0x21')](function(_0x59269e){return _0x59269e;});}return null;};}function removeEntity(_0x32ebe4,_0x15da04){return function(_0x1ee6c2){if(_0x1ee6c2){return _0x1ee6c2[_0xd10d('0x36')]()[_0xd10d('0x21')](function(){var _0x4c37ea=_0x1ee6c2[_0xd10d('0x37')]({'plain':!![]});var _0x3ddf60=_0xd10d('0x38');return db[_0xd10d('0x39')]['destroy']({'where':{'type':_0x3ddf60,'resourceId':_0x4c37ea['id']}})['then'](function(){return _0x1ee6c2;});})['then'](function(){_0x32ebe4[_0xd10d('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x598881,_0x40deb3){return function(_0x410f02){if(!_0x410f02){_0x598881[_0xd10d('0x2b')](0x194);}return _0x410f02;};}function handleError(_0x130efb,_0x59c614){_0x59c614=_0x59c614||0x1f4;return function(_0x2f694a){logger['error'](_0x2f694a['stack']);if(_0x2f694a[_0xd10d('0x3a')]){delete _0x2f694a['name'];}_0x130efb[_0xd10d('0x2d')](_0x59c614)['send'](_0x2f694a);};}exports[_0xd10d('0x3b')]=function(_0x3b3ace,_0x2f9a06){var _0xd4b6bd={'include':[{'model':db[_0xd10d('0x3c')],'as':_0xd10d('0x3d')}]},_0x3782e4={},_0x37b926={'count':0x0,'rows':[]};var _0x30a293=_['map'](db[_0xd10d('0x3e')][_0xd10d('0x3f')],function(_0x11f18c){return{'name':_0x11f18c['fieldName'],'type':_0x11f18c[_0xd10d('0x40')][_0xd10d('0x41')]};});_0x3782e4['model']=_[_0xd10d('0x42')](_0x30a293,_0xd10d('0x3a'));_0x3782e4[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x3b3ace[_0xd10d('0x43')]);_0x3782e4[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x3782e4['model'],_0x3782e4[_0xd10d('0x43')]);_0xd4b6bd['attributes']=_[_0xd10d('0x46')](_0x3782e4[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x48')]));_0xd4b6bd[_0xd10d('0x49')]=_0xd4b6bd['attributes'][_0xd10d('0x4a')]?_0xd4b6bd[_0xd10d('0x49')]:_0x3782e4[_0xd10d('0x47')];if(!_0x3b3ace['query'][_0xd10d('0x4b')]('nolimit')){_0xd4b6bd[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x3b3ace['query'][_0xd10d('0x30')]);_0xd4b6bd[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x2f')]);}_0xd4b6bd[_0xd10d('0x4c')]=qs[_0xd10d('0x4d')](_0x3b3ace['query'][_0xd10d('0x4d')]);_0xd4b6bd['where']=qs['filters'](_[_0xd10d('0x4e')](_0x3b3ace[_0xd10d('0x43')],_0x3782e4[_0xd10d('0x45')]),_0x30a293);if(_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x4f')]){_0xd4b6bd['where']=_[_0xd10d('0x50')](_0xd4b6bd['where'],{'$or':_[_0xd10d('0x42')](_0x30a293,function(_0x77c43c){if(_0x77c43c[_0xd10d('0x40')]!==_0xd10d('0x51')){var _0x401d2a={};_0x401d2a[_0x77c43c[_0xd10d('0x3a')]]={'$like':'%'+_0x3b3ace[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x401d2a;}})});}_0xd4b6bd=_[_0xd10d('0x50')]({},_0xd4b6bd,_0x3b3ace['options']);var _0x5aa1c0={'where':_0xd4b6bd[_0xd10d('0x52')]};return db['FaxAccount'][_0xd10d('0x32')](_0x5aa1c0)[_0xd10d('0x21')](function(_0x1ffba7){_0x37b926[_0xd10d('0x32')]=_0x1ffba7;if(_0x3b3ace[_0xd10d('0x43')]['includeAll']){_0xd4b6bd[_0xd10d('0x53')]=[{'all':!![]}];}return db[_0xd10d('0x3e')]['findAll'](_0xd4b6bd);})[_0xd10d('0x21')](function(_0x1a6340){_0x37b926[_0xd10d('0x54')]=_0x1a6340;return _0x37b926;})[_0xd10d('0x21')](respondWithFilteredResult(_0x2f9a06,_0xd4b6bd))['catch'](handleError(_0x2f9a06,null));};exports[_0xd10d('0x55')]=function(_0x330b54,_0x2de81c){var _0xf8d379={'raw':![],'where':{'id':_0x330b54[_0xd10d('0x56')]['id']},'include':[{'model':db[_0xd10d('0x3c')],'as':_0xd10d('0x3d')}]},_0x4435d4={};_0x4435d4[_0xd10d('0x47')]=_[_0xd10d('0x44')](db[_0xd10d('0x3e')][_0xd10d('0x3f')]);_0x4435d4[_0xd10d('0x43')]=_['keys'](_0x330b54[_0xd10d('0x43')]);_0x4435d4['filters']=_['intersection'](_0x4435d4[_0xd10d('0x47')],_0x4435d4[_0xd10d('0x43')]);_0xf8d379['attributes']=_[_0xd10d('0x46')](_0x4435d4[_0xd10d('0x47')],qs['fields'](_0x330b54[_0xd10d('0x43')][_0xd10d('0x48')]));_0xf8d379[_0xd10d('0x49')]=_0xf8d379[_0xd10d('0x49')][_0xd10d('0x4a')]?_0xf8d379['attributes']:_0x4435d4[_0xd10d('0x47')];if(_0x330b54[_0xd10d('0x43')][_0xd10d('0x57')]){_0xf8d379['include']=[{'all':!![]}];}_0xf8d379=_[_0xd10d('0x50')]({},_0xf8d379,_0x330b54[_0xd10d('0x58')]);return db[_0xd10d('0x3e')][_0xd10d('0x59')](_0xf8d379)[_0xd10d('0x21')](handleEntityNotFound(_0x2de81c,null))['then'](respondWithResult(_0x2de81c,null))['catch'](handleError(_0x2de81c,null));};exports['create']=function(_0x245c70,_0x252b30){return db[_0xd10d('0x3e')]['create'](_0x245c70[_0xd10d('0x5a')],{})[_0xd10d('0x21')](function(_0x5e7652){var _0x1e6901=_0x245c70[_0xd10d('0x5b')][_0xd10d('0x37')]({'plain':!![]});if(!_0x1e6901)throw new Error(_0xd10d('0x5c'));if(_0x1e6901[_0xd10d('0x5d')]===_0xd10d('0x5b')){var _0x1fd176=_0x5e7652['get']({'plain':!![]});var _0x453e4c=_0xd10d('0x38');return db[_0xd10d('0x5e')][_0xd10d('0x59')]({'where':{'name':_0x453e4c,'userProfileId':_0x1e6901[_0xd10d('0x5f')]},'raw':!![]})[_0xd10d('0x21')](function(_0x51472e){if(_0x51472e&&_0x51472e[_0xd10d('0x60')]===0x0){return db[_0xd10d('0x39')][_0xd10d('0x61')]({'name':_0x1fd176['name'],'resourceId':_0x1fd176['id'],'type':_0x51472e[_0xd10d('0x3a')],'sectionId':_0x51472e['id']},{})[_0xd10d('0x21')](function(){return _0x5e7652;});}else{return _0x5e7652;}})['catch'](function(_0x26647b){logger[_0xd10d('0x28')](_0xd10d('0x62'),_0x26647b);throw _0x26647b;});}return _0x5e7652;})[_0xd10d('0x21')](respondWithResult(_0x252b30,0xc9))[_0xd10d('0x63')](handleError(_0x252b30,null));};exports[_0xd10d('0x64')]=function(_0x2049f9,_0x3dc07e){if(_0x2049f9[_0xd10d('0x5a')]['id']){delete _0x2049f9[_0xd10d('0x5a')]['id'];}return db['FaxAccount']['find']({'where':{'id':_0x2049f9[_0xd10d('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0xd10d('0x3d')}]})[_0xd10d('0x21')](handleEntityNotFound(_0x3dc07e,null))['then'](saveUpdates(_0x2049f9['body'],null))[_0xd10d('0x21')](respondWithResult(_0x3dc07e,null))[_0xd10d('0x63')](handleError(_0x3dc07e,null));};exports['destroy']=function(_0x35c58d,_0x2c5e25){return db['FaxAccount'][_0xd10d('0x59')]({'where':{'id':_0x35c58d[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c5e25,null))[_0xd10d('0x21')](removeEntity(_0x2c5e25,null))['catch'](handleError(_0x2c5e25,null));};exports['describe']=function(_0x51a84e,_0x54a68c){return db[_0xd10d('0x3e')][_0xd10d('0x65')]()[_0xd10d('0x21')](respondWithResult(_0x54a68c,null))[_0xd10d('0x63')](handleError(_0x54a68c,null));};exports[_0xd10d('0x66')]=function(_0x3a3537,_0x38567c,_0x3613b6){if(_0x3a3537['body']['id']){delete _0x3a3537['body']['id'];}return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x3a3537[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x38567c,null))[_0xd10d('0x21')](function(_0x115965){if(_0x115965){_0x3a3537[_0xd10d('0x5a')][_0xd10d('0x67')]=_0x115965['id'];return db[_0xd10d('0x68')][_0xd10d('0x61')](_0x3a3537[_0xd10d('0x5a')]);}})['then'](respondWithResult(_0x38567c,null))[_0xd10d('0x63')](handleError(_0x38567c,null));};exports[_0xd10d('0x69')]=function(_0xf0d641,_0x21df5b,_0x348bb0){var _0x5c9575={'raw':![],'where':{}};var _0x4816e9={};var _0x238979={'count':0x0,'rows':[]};return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0xf0d641[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x21df5b,null))[_0xd10d('0x21')](function(_0x56584a){if(_0x56584a){_0x4816e9['model']=_[_0xd10d('0x44')](db['Disposition'][_0xd10d('0x3f')]);_0x4816e9[_0xd10d('0x43')]=_['keys'](_0xf0d641[_0xd10d('0x43')]);_0x4816e9['filters']=_[_0xd10d('0x46')](_0x4816e9[_0xd10d('0x47')],_0x4816e9[_0xd10d('0x43')]);_0x5c9575[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x4816e9[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0xf0d641[_0xd10d('0x43')][_0xd10d('0x48')]));_0x5c9575['attributes']=_0x5c9575[_0xd10d('0x49')]['length']?_0x5c9575[_0xd10d('0x49')]:_0x4816e9[_0xd10d('0x47')];if(!_0xf0d641['query'][_0xd10d('0x4b')]('nolimit')){_0x5c9575[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0xf0d641['query'][_0xd10d('0x30')]);_0x5c9575['offset']=qs[_0xd10d('0x2f')](_0xf0d641[_0xd10d('0x43')][_0xd10d('0x2f')]);}_0x5c9575['order']=qs[_0xd10d('0x4d')](_0xf0d641[_0xd10d('0x43')][_0xd10d('0x4d')]);_0x5c9575['where']=qs[_0xd10d('0x45')](_[_0xd10d('0x4e')](_0xf0d641[_0xd10d('0x43')],_0x4816e9[_0xd10d('0x45')]));_0x5c9575['where'][_0xd10d('0x67')]=_0x56584a['id'];if(_0xf0d641[_0xd10d('0x43')]['filter']){_0x5c9575[_0xd10d('0x52')]=_['merge'](_0x5c9575['where'],{'$or':_[_0xd10d('0x42')](_0x5c9575[_0xd10d('0x49')],function(_0x3ebd68){var _0x365863={};_0x365863[_0x3ebd68]={'$like':'%'+_0xf0d641[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x365863;})});}_0x5c9575=_['merge']({},_0x5c9575,_0xf0d641[_0xd10d('0x58')]);return db[_0xd10d('0x68')][_0xd10d('0x32')]({'where':_0x5c9575[_0xd10d('0x52')]})[_0xd10d('0x21')](function(_0x4a594c){_0x238979[_0xd10d('0x32')]=_0x4a594c;if(_0xf0d641[_0xd10d('0x43')]['includeAll']){_0x5c9575[_0xd10d('0x53')]=[{'all':!![]}];}return db['Disposition'][_0xd10d('0x6b')](_0x5c9575);})[_0xd10d('0x21')](function(_0x44fdf8){_0x238979[_0xd10d('0x54')]=_0x44fdf8;return _0x238979;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x21df5b,_0x5c9575))['catch'](handleError(_0x21df5b,null));};exports['removeDispositions']=function(_0x25e5cf,_0x3474c6,_0x4d9c86){return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x25e5cf['params']['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x3474c6,null))[_0xd10d('0x21')](function(_0x253789){if(_0x253789){return _0x253789[_0xd10d('0x6c')](_0x25e5cf[_0xd10d('0x43')]['ids']);}})['then'](respondWithStatusCode(_0x3474c6,null))[_0xd10d('0x63')](handleError(_0x3474c6,null));};exports['addAnswer']=function(_0x114f1d,_0x505d13,_0x790750){if(_0x114f1d[_0xd10d('0x5a')]['id']){delete _0x114f1d['body']['id'];}return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x114f1d[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x505d13,null))[_0xd10d('0x21')](function(_0x597e53){if(_0x597e53){_0x114f1d['body'][_0xd10d('0x67')]=_0x597e53['id'];return db[_0xd10d('0x6d')][_0xd10d('0x61')](_0x114f1d[_0xd10d('0x5a')]);}})['then'](respondWithResult(_0x505d13,null))[_0xd10d('0x63')](handleError(_0x505d13,null));};exports['getAnswers']=function(_0x38366f,_0x40bea8,_0x1ae8c0){var _0x17704a={'raw':![],'where':{}};var _0x2fe5de={};var _0x5d5355={'count':0x0,'rows':[]};return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x38366f[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x40bea8,null))[_0xd10d('0x21')](function(_0x537a98){if(_0x537a98){_0x2fe5de[_0xd10d('0x47')]=_['keys'](db[_0xd10d('0x6d')][_0xd10d('0x3f')]);_0x2fe5de[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x38366f['query']);_0x2fe5de[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x2fe5de[_0xd10d('0x47')],_0x2fe5de[_0xd10d('0x43')]);_0x17704a['attributes']=_[_0xd10d('0x46')](_0x2fe5de[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x38366f[_0xd10d('0x43')]['fields']));_0x17704a[_0xd10d('0x49')]=_0x17704a[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x17704a['attributes']:_0x2fe5de[_0xd10d('0x47')];if(!_0x38366f[_0xd10d('0x43')][_0xd10d('0x4b')](_0xd10d('0x6e'))){_0x17704a[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x38366f[_0xd10d('0x43')][_0xd10d('0x30')]);_0x17704a[_0xd10d('0x2f')]=qs['offset'](_0x38366f['query']['offset']);}_0x17704a[_0xd10d('0x4c')]=qs['sort'](_0x38366f[_0xd10d('0x43')][_0xd10d('0x4d')]);_0x17704a[_0xd10d('0x52')]=qs[_0xd10d('0x45')](_[_0xd10d('0x4e')](_0x38366f['query'],_0x2fe5de[_0xd10d('0x45')]));_0x17704a[_0xd10d('0x52')][_0xd10d('0x67')]=_0x537a98['id'];if(_0x38366f[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x17704a['where']=_[_0xd10d('0x50')](_0x17704a['where'],{'$or':_[_0xd10d('0x42')](_0x17704a[_0xd10d('0x49')],function(_0x5c16d8){var _0x36093f={};_0x36093f[_0x5c16d8]={'$like':'%'+_0x38366f[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x36093f;})});}_0x17704a=_['merge']({},_0x17704a,_0x38366f[_0xd10d('0x58')]);return db[_0xd10d('0x6d')][_0xd10d('0x32')]({'where':_0x17704a['where']})[_0xd10d('0x21')](function(_0x158b0e){_0x5d5355['count']=_0x158b0e;if(_0x38366f['query'][_0xd10d('0x57')]){_0x17704a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xd10d('0x6b')](_0x17704a);})[_0xd10d('0x21')](function(_0x376cdd){_0x5d5355[_0xd10d('0x54')]=_0x376cdd;return _0x5d5355;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x40bea8,_0x17704a))[_0xd10d('0x63')](handleError(_0x40bea8,null));};exports[_0xd10d('0x6f')]=function(_0x3561d8,_0x8f355,_0x5bb56c){return db[_0xd10d('0x3e')][_0xd10d('0x59')]({'where':{'id':_0x3561d8['params']['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x8f355,null))[_0xd10d('0x21')](function(_0x45a2ec){if(_0x45a2ec){return _0x45a2ec[_0xd10d('0x6f')](_0x3561d8['query']['ids']);}})['then'](respondWithStatusCode(_0x8f355,null))[_0xd10d('0x63')](handleError(_0x8f355,null));};exports['addInteraction']=function(_0xfca1b7,_0x506099,_0xa218b9){return db[_0xd10d('0x70')][_0xd10d('0x59')]({'where':{'id':_0xfca1b7[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x506099,null))[_0xd10d('0x21')](function(_0x21e79b){if(_0x21e79b){return _0x21e79b[_0xd10d('0x71')](_0xfca1b7['body'][_0xd10d('0x72')],_[_0xd10d('0x73')](_0xfca1b7['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x506099,null))[_0xd10d('0x63')](handleError(_0x506099,null));};exports[_0xd10d('0x74')]=function(_0x2704c5,_0x15073b,_0x202d89){var _0x371e2f={'raw':![],'where':{}};var _0x4d5f8f={};var _0x3b04b7={'count':0x0,'rows':[]};return db[_0xd10d('0x3e')]['findOne']({'where':{'id':_0x2704c5[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x15073b,null))['then'](function(_0x1b8ca3){if(_0x1b8ca3){_0x4d5f8f['model']=_[_0xd10d('0x44')](db[_0xd10d('0x70')]['rawAttributes']);_0x4d5f8f[_0xd10d('0x43')]=_['keys'](_0x2704c5['query']);_0x4d5f8f[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x4d5f8f[_0xd10d('0x47')],_0x4d5f8f[_0xd10d('0x43')]);_0x371e2f[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x4d5f8f[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x2704c5[_0xd10d('0x43')][_0xd10d('0x48')]));_0x371e2f['attributes']=_0x371e2f[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x371e2f[_0xd10d('0x49')]:_0x4d5f8f[_0xd10d('0x47')];if(!_0x2704c5['query'][_0xd10d('0x4b')](_0xd10d('0x6e'))){_0x371e2f[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x2704c5[_0xd10d('0x43')][_0xd10d('0x30')]);_0x371e2f[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x2704c5['query'][_0xd10d('0x2f')]);}_0x371e2f['order']=qs[_0xd10d('0x4d')](_0x2704c5['query'][_0xd10d('0x4d')]);_0x371e2f['where']=qs['filters'](_[_0xd10d('0x4e')](_0x2704c5['query'],_0x4d5f8f[_0xd10d('0x45')]));_0x371e2f[_0xd10d('0x52')][_0xd10d('0x67')]=_0x1b8ca3['id'];if(_0x2704c5[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x371e2f['where']=_[_0xd10d('0x50')](_0x371e2f['where'],{'$or':_['map'](_0x371e2f[_0xd10d('0x49')],function(_0x275006){var _0x3acfb9={};_0x3acfb9[_0x275006]={'$like':'%'+_0x2704c5['query'][_0xd10d('0x4f')]+'%'};return _0x3acfb9;})});}_0x371e2f=_[_0xd10d('0x50')]({},_0x371e2f,_0x2704c5[_0xd10d('0x58')]);return db['FaxInteraction']['count']({'where':_0x371e2f[_0xd10d('0x52')]})[_0xd10d('0x21')](function(_0x45c3ce){_0x3b04b7[_0xd10d('0x32')]=_0x45c3ce;if(_0x2704c5[_0xd10d('0x43')]['includeAll']){_0x371e2f['include']=[{'model':db[_0xd10d('0x75')],'as':_0xd10d('0x76'),'required':![]},{'model':db['User'],'as':_0xd10d('0x77'),'attributes':['name',_0xd10d('0x78'),_0xd10d('0x79')],'required':![]},{'model':db['Tag'],'as':_0xd10d('0x7a'),'attributes':['id',_0xd10d('0x3a'),'color'],'where':_0x2704c5[_0xd10d('0x43')][_0xd10d('0x7b')]?{'id':_0x2704c5[_0xd10d('0x43')][_0xd10d('0x7b')]}:undefined,'required':_0x2704c5['query'][_0xd10d('0x7b')]?!![]:![]}];}return db['FaxInteraction'][_0xd10d('0x6b')](_0x371e2f);})['then'](function(_0x1605e6){_0x3b04b7[_0xd10d('0x54')]=_0x1605e6;return _0x3b04b7;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x15073b,_0x371e2f))[_0xd10d('0x63')](handleError(_0x15073b,null));};exports[_0xd10d('0x7c')]=function(_0x5a12d1,_0x167760){var _0x3cc0f8=_0x5a12d1[_0xd10d('0x56')]['id'];var _0x189029=_0x5a12d1[_0xd10d('0x5a')];var _0x3fd66b=0xc8;var _0x1d9bd7=null;return db[_0xd10d('0x7d')][_0xd10d('0x7e')]({'isolationLevel':db[_0xd10d('0x7d')][_0xd10d('0x7f')][_0xd10d('0x80')][_0xd10d('0x81')]},function(_0x6c64a1){return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x3cc0f8},'transaction':_0x6c64a1})[_0xd10d('0x21')](function(_0x4d4828){if(_0x4d4828){return db[_0xd10d('0x82')]['destroy']({'where':{'FaxAccountId':_0x3cc0f8},'transaction':_0x6c64a1})[_0xd10d('0x21')](function(){var _0xac156d=_[_0xd10d('0x42')](_0x189029,function(_0x5baa57){_0x5baa57[_0xd10d('0x67')]=_0x3cc0f8;return _0x5baa57;});return db['FaxApplication'][_0xd10d('0x83')](_0xac156d,{'transaction':_0x6c64a1});});}else{_0x3fd66b=0x194;_0x1d9bd7=[];}});})[_0xd10d('0x21')](function(){if(_0x3fd66b!==0x194){return db[_0xd10d('0x82')][_0xd10d('0x84')]({'where':{'FaxAccountId':_0x3cc0f8},'order':_0xd10d('0x85')})[_0xd10d('0x21')](function(_0x382d44){_0x1d9bd7=_0x382d44;});}})['catch'](function(_0xff4ede){_0x3fd66b=0x1f4;logger[_0xd10d('0x28')](_0xff4ede[_0xd10d('0x86')]);if(_0xff4ede[_0xd10d('0x3a')]){delete _0xff4ede['name'];}_0x1d9bd7=_0xff4ede;})[_0xd10d('0x87')](function(){if(_0x1d9bd7===null){_0x167760[_0xd10d('0x2b')](_0x3fd66b);}else{if(_0x3fd66b===0x1f4){_0x167760[_0xd10d('0x2d')](_0x3fd66b)[_0xd10d('0x88')](_0x1d9bd7);}else{_0x167760['status'](_0x3fd66b)[_0xd10d('0x2e')](_0x1d9bd7);}}});};exports[_0xd10d('0x89')]=function(_0x5401c3,_0x3710e7,_0x5f8b69){var _0x5eadc2={};var _0x1581e4={};var _0x1578c5;var _0x2ebb94;return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x5401c3[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x3710e7,null))['then'](function(_0x29e671){if(_0x29e671){_0x1578c5=_0x29e671;_0x1581e4['model']=_[_0xd10d('0x44')](db['FaxApplication'][_0xd10d('0x3f')]);_0x1581e4[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x5401c3['query']);_0x1581e4[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x1581e4[_0xd10d('0x47')],_0x1581e4[_0xd10d('0x43')]);_0x5eadc2[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x1581e4[_0xd10d('0x47')],qs['fields'](_0x5401c3[_0xd10d('0x43')][_0xd10d('0x48')]));_0x5eadc2[_0xd10d('0x49')]=_0x5eadc2[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x5eadc2[_0xd10d('0x49')]:_0x1581e4[_0xd10d('0x47')];_0x5eadc2[_0xd10d('0x4c')]=qs[_0xd10d('0x4d')](_0x5401c3['query']['sort']);_0x5eadc2[_0xd10d('0x52')]=qs['filters'](_[_0xd10d('0x4e')](_0x5401c3[_0xd10d('0x43')],_0x1581e4[_0xd10d('0x45')]));if(_0x5401c3[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x5eadc2[_0xd10d('0x52')]=_[_0xd10d('0x50')](_0x5eadc2['where'],{'$or':_[_0xd10d('0x42')](_0x5eadc2[_0xd10d('0x49')],function(_0x4ed9f6){var _0x440830={};_0x440830[_0x4ed9f6]={'$like':'%'+_0x5401c3[_0xd10d('0x43')][_0xd10d('0x4f')]+'%'};return _0x440830;})});}_0x5eadc2=_[_0xd10d('0x50')]({},_0x5eadc2,_0x5401c3[_0xd10d('0x58')]);return _0x1578c5[_0xd10d('0x89')](_0x5eadc2);}})[_0xd10d('0x21')](function(_0x380d9d){if(_0x380d9d){_0x2ebb94=_0x380d9d[_0xd10d('0x4a')];if(!_0x5401c3['query']['hasOwnProperty'](_0xd10d('0x6e'))){_0x5eadc2[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x5401c3[_0xd10d('0x43')]['limit']);_0x5eadc2[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x5401c3[_0xd10d('0x43')][_0xd10d('0x2f')]);}return _0x1578c5[_0xd10d('0x89')](_0x5eadc2);}})[_0xd10d('0x21')](function(_0x2258bd){if(_0x2258bd){return _0x2258bd?{'count':_0x2ebb94,'rows':_0x2258bd}:null;}})['then'](respondWithResult(_0x3710e7,null))['catch'](handleError(_0x3710e7,null));};function Extension(_0x17f82e,_0x3c1cb2,_0x46294f,_0x1db1a2){this[_0xd10d('0x8a')]='from-voip-provider';this[_0xd10d('0x8b')]=_0x17f82e['localstationid'];this[_0xd10d('0x8c')]=_0x1db1a2;this[_0xd10d('0x40')]=_0xd10d('0x8d');this[_0xd10d('0x8e')]=_0xd10d('0x8f');this[_0xd10d('0x67')]=_0x17f82e['id'];this[_0xd10d('0x85')]=_0x3c1cb2;this[_0xd10d('0x90')]=_0x46294f;}function createExtensionsReciveFax(_0x242449){var _0x281894=0x1;var _0x3705fd=[];_0x3705fd['push'](new Extension(_0x242449,_0x281894,'','Answer'));_0x281894+=0x1;_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,'CDR(type)=inbound-fax',_0xd10d('0x92')));_0x281894+=0x1;for(var _0x14b6df in _0x242449){if(_0x242449[_0xd10d('0x4b')](_0x14b6df)&&(_0x14b6df===_0xd10d('0x93')||_0x14b6df===_0xd10d('0x94')||_0x14b6df===_0xd10d('0x95')||_0x14b6df===_0xd10d('0x96')||_0x14b6df===_0xd10d('0x97')||_0x14b6df===_0xd10d('0x98')||_0x14b6df===_0xd10d('0x99')||_0x14b6df===_0xd10d('0x9a')||_0x14b6df===_0xd10d('0x9b'))){_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,'FAXOPT('+_0x14b6df+')='+_0x242449[_0x14b6df],_0xd10d('0x92')));_0x281894+=0x1;}}_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,'6',_0xd10d('0x9c')));_0x281894+=0x1;_0x3705fd[_0xd10d('0x91')](new Extension(_0x242449,_0x281894,_0xd10d('0x9d'),_0xd10d('0x9e')));_0x281894=0x0;return _0x3705fd;}exports[_0xd10d('0x9f')]=function(_0x4645d2,_0x5ca85e,_0x4e145c){var _0x202e80;return db[_0xd10d('0x7d')][_0xd10d('0x7e')](function(_0x3ccef9){return db[_0xd10d('0x3e')]['create'](_0x4645d2[_0xd10d('0x5a')],{'transaction':_0x3ccef9})[_0xd10d('0x21')](function(_0x5a3528){_0x202e80=_0x5a3528[_0xd10d('0x37')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x202e80),{'transaction':_0x3ccef9});});})[_0xd10d('0x21')](function(){return _0x202e80;})[_0xd10d('0x21')](respondWithResult(_0x5ca85e,null))[_0xd10d('0x63')](handleError(_0x5ca85e,null));};exports['updateAccountApplications']=function(_0x4eaa05,_0x11579f,_0x238247){var _0x1bc3d4;return db['sequelize']['transaction'](function(_0x5de16f){return db[_0xd10d('0x3e')][_0xd10d('0x64')](_0x4eaa05[_0xd10d('0x5a')],{'where':{'id':_0x4eaa05[_0xd10d('0x5a')]['id']},'transaction':_0x5de16f})[_0xd10d('0x21')](function(_0x159b5a){return db[_0xd10d('0xa0')][_0xd10d('0x36')]({'where':{'FaxAccountId':_0x4eaa05[_0xd10d('0x5a')]['id']},'transaction':_0x5de16f})[_0xd10d('0x21')](function(_0x2af6ec){return db[_0xd10d('0xa0')]['bulkCreate'](createExtensionsReciveFax(_[_0xd10d('0x73')](_0x4eaa05[_0xd10d('0x5a')],[_0xd10d('0xa1'),_0xd10d('0x41'),_0xd10d('0xa2'),_0xd10d('0xa3'),_0xd10d('0xa4'),_0xd10d('0xa5')])),{'transaction':_0x5de16f});});});})[_0xd10d('0x21')](function(){return db[_0xd10d('0x3e')]['findById'](_0x4eaa05[_0xd10d('0x5a')]['id']);})[_0xd10d('0x21')](respondWithResult(_0x11579f,null))[_0xd10d('0x63')](handleError(_0x11579f,null));};exports[_0xd10d('0xa6')]=function(_0x56a27e,_0x25f757,_0xfd38ca){var _0x293eb1={'raw':!![],'where':{}};var _0x57e217={};var _0x5078a0={'count':0x0,'rows':[]};return db['FaxAccount'][_0xd10d('0x6a')]({'where':{'id':_0x56a27e[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x25f757,null))[_0xd10d('0x21')](function(_0x252c72){if(_0x252c72){_0x57e217[_0xd10d('0x47')]=_['keys'](db['FaxMessage']['rawAttributes']);_0x57e217['query']=_['keys'](_0x56a27e[_0xd10d('0x43')]);_0x57e217['filters']=_[_0xd10d('0x46')](_0x57e217[_0xd10d('0x47')],_0x57e217[_0xd10d('0x43')]);_0x293eb1[_0xd10d('0x49')]=_[_0xd10d('0x46')](_0x57e217[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x56a27e[_0xd10d('0x43')][_0xd10d('0x48')]));_0x293eb1['attributes']=_0x293eb1[_0xd10d('0x49')]['length']?_0x293eb1['attributes']:_0x57e217[_0xd10d('0x47')];if(!_0x56a27e[_0xd10d('0x43')][_0xd10d('0x4b')](_0xd10d('0x6e'))){_0x293eb1[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x56a27e['query'][_0xd10d('0x30')]);_0x293eb1[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x56a27e[_0xd10d('0x43')][_0xd10d('0x2f')]);}_0x293eb1[_0xd10d('0x4c')]=qs['sort'](_0x56a27e[_0xd10d('0x43')]['sort']);_0x293eb1[_0xd10d('0x52')]=qs[_0xd10d('0x45')](_['pick'](_0x56a27e[_0xd10d('0x43')],_0x57e217['filters']));_0x293eb1[_0xd10d('0x52')][_0xd10d('0x67')]=_0x252c72['id'];if(_0x56a27e[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x293eb1[_0xd10d('0x52')]=_['merge'](_0x293eb1['where'],{'$or':_[_0xd10d('0x42')](_0x293eb1['attributes'],function(_0x5b2dfc){var _0x3948b1={};_0x3948b1[_0x5b2dfc]={'$like':'%'+_0x56a27e['query'][_0xd10d('0x4f')]+'%'};return _0x3948b1;})});}if(_0x56a27e['query'][_0xd10d('0xa7')]){var _0x282bd9=_0x56a27e[_0xd10d('0x43')][_0xd10d('0xa7')]['split'](',');var _0x1f65f1={};_0x1f65f1[_0x282bd9[0x0]]={'$gte':moment(_0x282bd9[0x1])['format'](_0xd10d('0xa8'))};_0x293eb1[_0xd10d('0x52')]=_['merge'](_0x293eb1[_0xd10d('0x52')],_0x1f65f1);}_0x293eb1=_[_0xd10d('0x50')]({},_0x293eb1,_0x56a27e['options']);return db[_0xd10d('0xa9')][_0xd10d('0x32')]({'where':_0x293eb1[_0xd10d('0x52')]})[_0xd10d('0x21')](function(_0x1375ce){_0x5078a0[_0xd10d('0x32')]=_0x1375ce;if(_0x56a27e[_0xd10d('0x43')][_0xd10d('0x57')]){_0x293eb1[_0xd10d('0x53')]=[{'all':!![]}];}return db[_0xd10d('0xa9')][_0xd10d('0x6b')](_0x293eb1);})['then'](function(_0x403209){_0x5078a0[_0xd10d('0x54')]=_0x403209;return _0x5078a0;});}})[_0xd10d('0x21')](respondWithFilteredResult(_0x25f757,_0x293eb1))['catch'](handleError(_0x25f757,null));};exports[_0xd10d('0x88')]=function(_0x344535,_0xb153ec,_0x5c2313){var _0x181e21,_0xc50728={},_0xff8fb8;if(_0x344535['body']['to']){_0xff8fb8=_0x344535[_0xd10d('0x5a')]['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x344535[_0xd10d('0x56')]['id']},'include':[{'model':db[_0xd10d('0xaa')],'as':_0xd10d('0xab'),'include':[{'model':db['CmContact'],'as':_0xd10d('0xac'),'where':{'fax':_0xff8fb8},'limit':0x1,'order':[[_0xd10d('0xa3'),'DESC']]}]}]})['then'](handleEntityNotFound(_0xb153ec,null))[_0xd10d('0x21')](function(_0x3c1e0c){_0x181e21=_0x3c1e0c;if(_0x344535['body']['attachments']&&_0x344535[_0xd10d('0x5a')]['attachments'][_0xd10d('0x4a')]){for(var _0x5cf610=0x0;_0x5cf610<_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][_0xd10d('0x4a')];_0x5cf610+=0x1){_0x344535[_0xd10d('0x5a')]['attachments'][_0x5cf610]={'filename':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][_0x5cf610]['name'],'id':_0x344535['body'][_0xd10d('0xad')][_0x5cf610]['id'],'path':path['join'](config[_0xd10d('0xae')],_0xd10d('0xaf'),_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][_0x5cf610][_0xd10d('0xb0')])};}}return respondWithRpcPromise(_0xd10d('0xb1'),_0xd10d('0xb1'),{'FaxAccountId':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x56')]['id'])?undefined:_0x344535[_0xd10d('0x56')]['id'],'path':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x5a')]['attachments'][0x0][_0xd10d('0x7')])?undefined:_0x344535['body'][_0xd10d('0xad')][0x0]['path'],'fax':_[_0xd10d('0xb2')](_0x344535['body']['to'][0x0])?undefined:_0x344535[_0xd10d('0x5a')]['to'][0x0]},client9002);})[_0xd10d('0x21')](function(){if(_0x181e21){if(_['isNil'](_0x344535[_0xd10d('0x5a')]['from'])){_0x344535[_0xd10d('0x5a')]['from']=util[_0xd10d('0xb3')](_0xd10d('0xb4'),_0x181e21[_0xd10d('0x3a')],_0x181e21[_0xd10d('0xb5')]);}if(_0x181e21['List']){if(_0x181e21[_0xd10d('0xab')]['Contacts'][_0xd10d('0x4a')]){return _0x181e21[_0xd10d('0xab')]['Contacts'][0x0];}else{return db['CmContact']['create'](_[_0xd10d('0x1a')](_0x344535[_0xd10d('0x5a')],{'firstName':_0x344535['body']['to'][0x0],'phone':_0x344535['body']['to'][0x0],'fax':_0x344535[_0xd10d('0x5a')]['to'][0x0],'ListId':_0x181e21[_0xd10d('0xa5')]}));}}else{throw new Error(_0xd10d('0xb6'));}}else{throw new Error(_0xd10d('0xb7'));}})['then'](function(_0xfdc49a){if(_0xfdc49a){return db[_0xd10d('0x70')][_0xd10d('0x59')]({'where':{'ContactId':_0xfdc49a['id'],'closed':![],'FaxAccountId':_0x181e21['id']}})[_0xd10d('0x21')](function(_0x327605){if(_0x327605){return[_0x327605,![]];}return db[_0xd10d('0x70')][_0xd10d('0x61')]({'UserId':_0x344535['user']['id'],'ContactId':_0xfdc49a['id'],'FaxAccountId':_0x181e21['id'],'fax':_0x344535['body']['to'][0x0],'firstMsgDirection':_0xd10d('0xb8'),'Messages':[_[_0xd10d('0x50')](_0x344535[_0xd10d('0x5a')],{'read':![],'body':_0x344535[_0xd10d('0x5a')]['attachments'][0x0][_0xd10d('0xb9')],'FaxAccountId':_0x181e21['id'],'UserId':_0x344535[_0xd10d('0x5b')]['id'],'ContactId':_0xfdc49a['id'],'AttachmentId':_0x344535[_0xd10d('0x5a')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xd10d('0xba')}]})[_0xd10d('0x21')](function(_0x2a0672){return[_0x2a0672,!![]];});});}else{throw new Error(_0xd10d('0xbb'));}})[_0xd10d('0xbc')](function(_0x5006be,_0x8dd4a0){if(_0x8dd4a0){return _0x5006be;}return db[_0xd10d('0xa9')]['create']({'direction':_0xd10d('0xb8'),'read':![],'body':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0][_0xd10d('0xb9')],'FaxAccountId':_0x181e21['id'],'FaxInteractionId':_0x5006be['id'],'UserId':_0x344535[_0xd10d('0x5b')]['id'],'ContactId':_0x5006be[_0xd10d('0xbd')],'AttachmentId':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0]['id']})[_0xd10d('0x21')](function(_0x9c3d0f){_0x5006be[_0xd10d('0xbe')][_0xd10d('0xba')]=[];_0x5006be[_0xd10d('0xbe')][_0xd10d('0xba')][_0xd10d('0x91')](_0x9c3d0f[_0xd10d('0xbe')]);return _0x5006be;});})['then'](function(_0x26efcf){respondWithRpcPromise(_0xd10d('0xbf'),_0xd10d('0xbf'),{'FaxAccountId':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x56')]['id'])?undefined:_0x344535[_0xd10d('0x56')]['id'],'path':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0][_0xd10d('0x7')])?undefined:_0x344535['body'][_0xd10d('0xad')][0x0]['path'],'fax':_[_0xd10d('0xb2')](_0x344535[_0xd10d('0x5a')]['to'][0x0])?undefined:_0x344535['body']['to'][0x0],'AttachmentId':_0x344535[_0xd10d('0x5a')][_0xd10d('0xad')][0x0]['id']},client9002)[_0xd10d('0x21')](function(_0xb3871e){logger[_0xd10d('0x22')]('SendFaxRpc,\x20%s',_0xb3871e);})[_0xd10d('0x63')](function(_0x21f8f1){logger[_0xd10d('0x22')]('SendFaxRpc,\x20%s',_0x21f8f1);});return _0x26efcf;})[_0xd10d('0x21')](respondWithResult(_0xb153ec,null))[_0xd10d('0x63')](handleError(_0xb153ec,null));};exports[_0xd10d('0xc0')]=function(_0x141cfd,_0x11c442,_0x5e3e82){return db['FaxAccount'][_0xd10d('0x59')]({'where':{'id':_0x141cfd[_0xd10d('0x56')]['id']}})['then'](handleEntityNotFound(_0x11c442,null))[_0xd10d('0x21')](function(_0x10dd8d){if(_0x10dd8d){return _0x10dd8d[_0xd10d('0xc0')](_0x141cfd['body']['ids'],_[_0xd10d('0x73')](_0x141cfd[_0xd10d('0x5a')],[_0xd10d('0x72'),'id'])||{})[_0xd10d('0xbc')](function(_0x40f917){for(var _0x225585=0x0;_0x225585<_0x141cfd[_0xd10d('0x5a')][_0xd10d('0x72')][_0xd10d('0x4a')];_0x225585+=0x1){socket['emit'](_0xd10d('0xc1'),{'UserId':Number(_0x141cfd[_0xd10d('0x5a')][_0xd10d('0x72')][_0x225585]),'FaxAccountId':Number(_0x141cfd['params']['id'])});}return _0x40f917;});}})[_0xd10d('0x21')](respondWithResult(_0x11c442,null))['catch'](handleError(_0x11c442,null));};exports[_0xd10d('0xc2')]=function(_0x152a34,_0x13cd41,_0x106c17){return db['FaxAccount']['find']({'where':{'id':_0x152a34[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x13cd41,null))[_0xd10d('0x21')](function(_0x13c50e){if(_0x13c50e){return _0x13c50e[_0xd10d('0xc2')](_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')])['then'](function(){if(_[_0xd10d('0xc3')](_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')])){for(var _0x3c0cca=0x0;_0x3c0cca<_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')][_0xd10d('0x4a')];_0x3c0cca+=0x1){socket[_0xd10d('0xc4')]('userFaxAccount:remove',{'UserId':Number(_0x152a34[_0xd10d('0x43')]['ids'][_0x3c0cca]),'FaxAccountId':Number(_0x152a34[_0xd10d('0x56')]['id'])});}}else{socket[_0xd10d('0xc4')](_0xd10d('0xc5'),{'UserId':Number(_0x152a34[_0xd10d('0x43')][_0xd10d('0x72')]),'FaxAccountId':Number(_0x152a34[_0xd10d('0x56')]['id'])});}});}})[_0xd10d('0x21')](respondWithStatusCode(_0x13cd41,null))[_0xd10d('0x63')](handleError(_0x13cd41,null));};exports[_0xd10d('0xc6')]=function(_0x113fac,_0x41664e,_0x3e1800){var _0x103d36={};var _0x28030a={};var _0x2fa098;var _0x2ca114;return db[_0xd10d('0x3e')][_0xd10d('0x6a')]({'where':{'id':_0x113fac[_0xd10d('0x56')]['id']}})[_0xd10d('0x21')](handleEntityNotFound(_0x41664e,null))[_0xd10d('0x21')](function(_0x42146d){if(_0x42146d){_0x2fa098=_0x42146d;_0x28030a['model']=_[_0xd10d('0x44')](db['User'][_0xd10d('0x3f')]);_0x28030a[_0xd10d('0x43')]=_[_0xd10d('0x44')](_0x113fac[_0xd10d('0x43')]);_0x28030a[_0xd10d('0x45')]=_[_0xd10d('0x46')](_0x28030a[_0xd10d('0x47')],_0x28030a['query']);_0x103d36['attributes']=_[_0xd10d('0x46')](_0x28030a[_0xd10d('0x47')],qs[_0xd10d('0x48')](_0x113fac[_0xd10d('0x43')]['fields']));_0x103d36['attributes']=_0x103d36[_0xd10d('0x49')][_0xd10d('0x4a')]?_0x103d36[_0xd10d('0x49')]:_0x28030a[_0xd10d('0x47')];_0x103d36[_0xd10d('0x4c')]=qs['sort'](_0x113fac[_0xd10d('0x43')][_0xd10d('0x4d')]);_0x103d36[_0xd10d('0x52')]=qs['filters'](_['pick'](_0x113fac['query'],_0x28030a['filters']));if(_0x113fac[_0xd10d('0x43')][_0xd10d('0x4f')]){_0x103d36[_0xd10d('0x52')]=_[_0xd10d('0x50')](_0x103d36['where'],{'$or':_[_0xd10d('0x42')](_0x103d36[_0xd10d('0x49')],function(_0xe892e0){var _0x247a1c={};_0x247a1c[_0xe892e0]={'$like':'%'+_0x113fac['query']['filter']+'%'};return _0x247a1c;})});}_0x103d36=_[_0xd10d('0x50')]({},_0x103d36,_0x113fac[_0xd10d('0x58')]);return _0x2fa098['getAgents'](_0x103d36);}})[_0xd10d('0x21')](function(_0xd4de97){if(_0xd4de97){_0x2ca114=_0xd4de97[_0xd10d('0x4a')];if(!_0x113fac[_0xd10d('0x43')]['hasOwnProperty'](_0xd10d('0x6e'))){_0x103d36[_0xd10d('0x30')]=qs[_0xd10d('0x30')](_0x113fac[_0xd10d('0x43')][_0xd10d('0x30')]);_0x103d36[_0xd10d('0x2f')]=qs[_0xd10d('0x2f')](_0x113fac[_0xd10d('0x43')]['offset']);}return _0x2fa098[_0xd10d('0xc6')](_0x103d36);}})[_0xd10d('0x21')](function(_0x1430d2){if(_0x1430d2){return _0x1430d2?{'count':_0x2ca114,'rows':_0x1430d2}:null;}})[_0xd10d('0x21')](respondWithResult(_0x41664e,null))[_0xd10d('0x63')](handleError(_0x41664e,null));}; \ No newline at end of file +var _0x3b91=['count','offset','Content-Range','apply','reject','update','then','get','FaxAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','addDisposition','params','Disposition','getDispositions','findOne','limit','order','pick','filter','removeDispositions','ids','addAnswer','FaxAccountId','CannedAnswer','getAnswers','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','FaxApplication','bulkCreate','finally','getApplications','context','from-voip-provider','exten','localstationid','app','Fax\x20Extension','priority','appdata','Answer','push','CDR(type)=inbound-fax','ecm','gateway','faxdetect','headerinfo','minrate','modem','FAXOPT(','Set','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','VoiceExtension','updateAccountApplications','tech','key','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','server/files/attachments','basename','CheckAfterSend','isNil','fax','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined'];(function(_0xb5604f,_0x7f1691){var _0x2486c6=function(_0x1d578d){while(--_0x1d578d){_0xb5604f['push'](_0xb5604f['shift']());}};_0x2486c6(++_0x7f1691);}(_0x3b91,0x15c));var _0x13b9=function(_0x37365a,_0x526806){_0x37365a=_0x37365a-0x0;var _0x19591a=_0x3b91[_0x37365a];return _0x19591a;};'use strict';var emlformat=require(_0x13b9('0x0'));var rimraf=require(_0x13b9('0x1'));var zipdir=require(_0x13b9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x13b9('0x3'));var moment=require(_0x13b9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x13b9('0x5'));var util=require('util');var path=require(_0x13b9('0x6'));var sox=require(_0x13b9('0x7'));var csv=require(_0x13b9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x13b9('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x13b9('0xa'));var jsforce=require(_0x13b9('0xb'));var deskjs=require(_0x13b9('0xc'));var toCsv=require(_0x13b9('0x8'));var querystring=require(_0x13b9('0xd'));var Papa=require('papaparse');var Redis=require(_0x13b9('0xe'));var authService=require(_0x13b9('0xf'));var qs=require(_0x13b9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x13b9('0x11'))(_0x13b9('0x12'));var utils=require(_0x13b9('0x13'));var config=require(_0x13b9('0x14'));var licenseUtil=require(_0x13b9('0x15'));var db=require('../../mysqldb')['db'];config[_0x13b9('0x16')]=_[_0x13b9('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x13b9('0x18'))(new Redis(config[_0x13b9('0x16')]));require(_0x13b9('0x19'))[_0x13b9('0x1a')](socket);var jayson=require(_0x13b9('0x1b'));var client=jayson[_0x13b9('0x1c')][_0x13b9('0x1d')]({'port':0x232c});var client9002=jayson['client'][_0x13b9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x2072f9,_0x448ee5,_0x144bc4,_0x2d7f5e){return new BPromise(function(_0x4dd630,_0x5832f0){var _0xad8ace=_0x2d7f5e||client;return _0xad8ace[_0x13b9('0x1e')](_0x2072f9,_0x144bc4)['then'](function(_0x4cd991){logger[_0x13b9('0x1f')](_0x13b9('0x20'),_0x448ee5,_0x13b9('0x21'));logger['debug'](_0x13b9('0x22'),_0x448ee5,_0x13b9('0x21'),JSON[_0x13b9('0x23')](_0x4cd991));if(_0x4cd991['error']){if(_0x4cd991[_0x13b9('0x24')][_0x13b9('0x25')]===0x1f4){logger['error'](_0x13b9('0x20'),_0x448ee5,_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);return _0x5832f0(_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);}logger[_0x13b9('0x24')](_0x13b9('0x20'),_0x448ee5,_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);return _0x4dd630(_0x4cd991[_0x13b9('0x24')][_0x13b9('0x26')]);}else{logger[_0x13b9('0x1f')](_0x13b9('0x20'),_0x448ee5,_0x13b9('0x21'));_0x4dd630(_0x4cd991[_0x13b9('0x27')]['message']);}})[_0x13b9('0x28')](function(_0x251a39){logger[_0x13b9('0x24')](_0x13b9('0x20'),_0x448ee5,_0x251a39);_0x5832f0(_0x251a39);});});}function respondWithStatusCode(_0x2fba13,_0x148210){_0x148210=_0x148210||0xcc;return function(_0x33bbc9){if(_0x33bbc9){return _0x2fba13[_0x13b9('0x29')](_0x148210);}return _0x2fba13[_0x13b9('0x2a')](_0x148210)[_0x13b9('0x2b')]();};}function respondWithResult(_0x5b78f3,_0xeb5d28){_0xeb5d28=_0xeb5d28||0xc8;return function(_0x31dd41){if(_0x31dd41){return _0x5b78f3['status'](_0xeb5d28)[_0x13b9('0x2c')](_0x31dd41);}};}function respondWithFilteredResult(_0x58aa9e,_0x17eccd){return function(_0x19c5fc){if(_0x19c5fc){var _0x2915b6=typeof _0x17eccd['offset']==='undefined'&&typeof _0x17eccd['limit']===_0x13b9('0x2d');var _0x248e5e=_0x19c5fc[_0x13b9('0x2e')];var _0x32641c=_0x2915b6?0x0:_0x17eccd['offset'];var _0x62ac57=_0x2915b6?_0x19c5fc[_0x13b9('0x2e')]:_0x17eccd[_0x13b9('0x2f')]+_0x17eccd['limit'];var _0xd55dbc;if(_0x62ac57>=_0x248e5e){_0x62ac57=_0x248e5e;_0xd55dbc=0xc8;}else{_0xd55dbc=0xce;}_0x58aa9e['status'](_0xd55dbc);return _0x58aa9e['set'](_0x13b9('0x30'),_0x32641c+'-'+_0x62ac57+'/'+_0x248e5e)[_0x13b9('0x2c')](_0x19c5fc);}return null;};}function patchUpdates(_0x4fcea2){return function(_0x42e844){try{jsonpatch[_0x13b9('0x31')](_0x42e844,_0x4fcea2,!![]);}catch(_0x2a26c6){return BPromise[_0x13b9('0x32')](_0x2a26c6);}return _0x42e844['save']();};}function saveUpdates(_0x54009f,_0x3d3b5e){return function(_0x270cff){if(_0x270cff){return _0x270cff[_0x13b9('0x33')](_0x54009f)[_0x13b9('0x34')](function(_0x1e8923){return _0x1e8923;});}return null;};}function removeEntity(_0x12fa0b,_0x391867){return function(_0x503fbf){if(_0x503fbf){return _0x503fbf['destroy']()[_0x13b9('0x34')](function(){var _0xe2218=_0x503fbf[_0x13b9('0x35')]({'plain':!![]});var _0x3dc194=_0x13b9('0x36');return db[_0x13b9('0x37')]['destroy']({'where':{'type':_0x3dc194,'resourceId':_0xe2218['id']}})['then'](function(){return _0x503fbf;});})['then'](function(){_0x12fa0b[_0x13b9('0x2a')](0xcc)[_0x13b9('0x2b')]();});}};}function handleEntityNotFound(_0x3e4800,_0x5ae985){return function(_0xfb7b25){if(!_0xfb7b25){_0x3e4800[_0x13b9('0x29')](0x194);}return _0xfb7b25;};}function handleError(_0x14baae,_0x294aed){_0x294aed=_0x294aed||0x1f4;return function(_0x1251b0){logger['error'](_0x1251b0[_0x13b9('0x38')]);if(_0x1251b0[_0x13b9('0x39')]){delete _0x1251b0[_0x13b9('0x39')];}_0x14baae[_0x13b9('0x2a')](_0x294aed)[_0x13b9('0x3a')](_0x1251b0);};}exports['index']=function(_0x28e5d2,_0x372c3f){var _0x18a625={'include':[{'model':db[_0x13b9('0x3b')],'as':_0x13b9('0x3c')}]},_0x36801f={},_0xf9ccb3={'count':0x0,'rows':[]};var _0x8c4243=_[_0x13b9('0x3d')](db[_0x13b9('0x3e')][_0x13b9('0x3f')],function(_0xf2597f){return{'name':_0xf2597f[_0x13b9('0x40')],'type':_0xf2597f[_0x13b9('0x41')]['key']};});_0x36801f[_0x13b9('0x42')]=_[_0x13b9('0x3d')](_0x8c4243,_0x13b9('0x39'));_0x36801f[_0x13b9('0x43')]=_[_0x13b9('0x44')](_0x28e5d2[_0x13b9('0x43')]);_0x36801f['filters']=_[_0x13b9('0x45')](_0x36801f[_0x13b9('0x42')],_0x36801f['query']);_0x18a625[_0x13b9('0x46')]=_['intersection'](_0x36801f[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x28e5d2['query'][_0x13b9('0x47')]));_0x18a625[_0x13b9('0x46')]=_0x18a625[_0x13b9('0x46')][_0x13b9('0x48')]?_0x18a625[_0x13b9('0x46')]:_0x36801f[_0x13b9('0x42')];if(!_0x28e5d2[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x18a625['limit']=qs['limit'](_0x28e5d2[_0x13b9('0x43')]['limit']);_0x18a625[_0x13b9('0x2f')]=qs[_0x13b9('0x2f')](_0x28e5d2[_0x13b9('0x43')]['offset']);}_0x18a625['order']=qs[_0x13b9('0x4b')](_0x28e5d2[_0x13b9('0x43')]['sort']);_0x18a625[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_['pick'](_0x28e5d2[_0x13b9('0x43')],_0x36801f[_0x13b9('0x4d')]),_0x8c4243);if(_0x28e5d2[_0x13b9('0x43')]['filter']){_0x18a625[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x18a625[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x8c4243,function(_0x1637a0){if(_0x1637a0[_0x13b9('0x41')]!==_0x13b9('0x4f')){var _0x5a1648={};_0x5a1648[_0x1637a0[_0x13b9('0x39')]]={'$like':'%'+_0x28e5d2[_0x13b9('0x43')]['filter']+'%'};return _0x5a1648;}})});}_0x18a625=_['merge']({},_0x18a625,_0x28e5d2[_0x13b9('0x50')]);var _0x1057a2={'where':_0x18a625[_0x13b9('0x4c')]};return db[_0x13b9('0x3e')]['count'](_0x1057a2)[_0x13b9('0x34')](function(_0x1464dd){_0xf9ccb3[_0x13b9('0x2e')]=_0x1464dd;if(_0x28e5d2[_0x13b9('0x43')][_0x13b9('0x51')]){_0x18a625[_0x13b9('0x52')]=[{'all':!![]}];}return db['FaxAccount'][_0x13b9('0x53')](_0x18a625);})[_0x13b9('0x34')](function(_0xca3f86){_0xf9ccb3[_0x13b9('0x54')]=_0xca3f86;return _0xf9ccb3;})[_0x13b9('0x34')](respondWithFilteredResult(_0x372c3f,_0x18a625))[_0x13b9('0x28')](handleError(_0x372c3f,null));};exports[_0x13b9('0x55')]=function(_0x33c194,_0x4587fb){var _0x7af939={'raw':![],'where':{'id':_0x33c194['params']['id']},'include':[{'model':db[_0x13b9('0x3b')],'as':_0x13b9('0x3c')}]},_0x3b46d3={};_0x3b46d3[_0x13b9('0x42')]=_[_0x13b9('0x44')](db[_0x13b9('0x3e')]['rawAttributes']);_0x3b46d3['query']=_[_0x13b9('0x44')](_0x33c194[_0x13b9('0x43')]);_0x3b46d3[_0x13b9('0x4d')]=_[_0x13b9('0x45')](_0x3b46d3[_0x13b9('0x42')],_0x3b46d3[_0x13b9('0x43')]);_0x7af939[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0x3b46d3[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x33c194[_0x13b9('0x43')]['fields']));_0x7af939[_0x13b9('0x46')]=_0x7af939['attributes'][_0x13b9('0x48')]?_0x7af939[_0x13b9('0x46')]:_0x3b46d3[_0x13b9('0x42')];if(_0x33c194[_0x13b9('0x43')][_0x13b9('0x51')]){_0x7af939[_0x13b9('0x52')]=[{'all':!![]}];}_0x7af939=_[_0x13b9('0x4e')]({},_0x7af939,_0x33c194[_0x13b9('0x50')]);return db['FaxAccount'][_0x13b9('0x56')](_0x7af939)['then'](handleEntityNotFound(_0x4587fb,null))[_0x13b9('0x34')](respondWithResult(_0x4587fb,null))[_0x13b9('0x28')](handleError(_0x4587fb,null));};exports[_0x13b9('0x57')]=function(_0x4c2187,_0x22abd2){return db['FaxAccount'][_0x13b9('0x57')](_0x4c2187[_0x13b9('0x58')],{})[_0x13b9('0x34')](function(_0x1bb951){var _0x3207eb=_0x4c2187['user'][_0x13b9('0x35')]({'plain':!![]});if(!_0x3207eb)throw new Error(_0x13b9('0x59'));if(_0x3207eb[_0x13b9('0x5a')]===_0x13b9('0x5b')){var _0x153bae=_0x1bb951['get']({'plain':!![]});var _0x299d24='FaxAccounts';return db['UserProfileSection'][_0x13b9('0x56')]({'where':{'name':_0x299d24,'userProfileId':_0x3207eb['userProfileId']},'raw':!![]})[_0x13b9('0x34')](function(_0x1e4059){if(_0x1e4059&&_0x1e4059[_0x13b9('0x5c')]===0x0){return db['UserProfileResource'][_0x13b9('0x57')]({'name':_0x153bae[_0x13b9('0x39')],'resourceId':_0x153bae['id'],'type':_0x1e4059[_0x13b9('0x39')],'sectionId':_0x1e4059['id']},{})[_0x13b9('0x34')](function(){return _0x1bb951;});}else{return _0x1bb951;}})[_0x13b9('0x28')](function(_0xa2b14c){logger['error'](_0x13b9('0x5d'),_0xa2b14c);throw _0xa2b14c;});}return _0x1bb951;})[_0x13b9('0x34')](respondWithResult(_0x22abd2,0xc9))['catch'](handleError(_0x22abd2,null));};exports[_0x13b9('0x33')]=function(_0x40b5dd,_0x40a948){if(_0x40b5dd['body']['id']){delete _0x40b5dd[_0x13b9('0x58')]['id'];}return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x40b5dd['params']['id']},'include':[{'model':db[_0x13b9('0x3b')],'as':'mandatoryDispositionPause'}]})[_0x13b9('0x34')](handleEntityNotFound(_0x40a948,null))['then'](saveUpdates(_0x40b5dd[_0x13b9('0x58')],null))[_0x13b9('0x34')](respondWithResult(_0x40a948,null))[_0x13b9('0x28')](handleError(_0x40a948,null));};exports[_0x13b9('0x5e')]=function(_0x154ec7,_0x4edf84){return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x154ec7['params']['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x4edf84,null))[_0x13b9('0x34')](removeEntity(_0x4edf84,null))[_0x13b9('0x28')](handleError(_0x4edf84,null));};exports[_0x13b9('0x5f')]=function(_0x3de753,_0x524c52){return db[_0x13b9('0x3e')][_0x13b9('0x5f')]()[_0x13b9('0x34')](respondWithResult(_0x524c52,null))[_0x13b9('0x28')](handleError(_0x524c52,null));};exports[_0x13b9('0x60')]=function(_0x44af05,_0xa73efd,_0x5d9025){if(_0x44af05[_0x13b9('0x58')]['id']){delete _0x44af05['body']['id'];}return db['FaxAccount'][_0x13b9('0x56')]({'where':{'id':_0x44af05[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0xa73efd,null))[_0x13b9('0x34')](function(_0x54796d){if(_0x54796d){_0x44af05[_0x13b9('0x58')]['FaxAccountId']=_0x54796d['id'];return db[_0x13b9('0x62')][_0x13b9('0x57')](_0x44af05[_0x13b9('0x58')]);}})['then'](respondWithResult(_0xa73efd,null))[_0x13b9('0x28')](handleError(_0xa73efd,null));};exports[_0x13b9('0x63')]=function(_0x288cd9,_0x5246cc,_0xb39a60){var _0x230d97={'raw':![],'where':{}};var _0x2bc099={};var _0x30c5aa={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x288cd9[_0x13b9('0x61')]['id']}})['then'](handleEntityNotFound(_0x5246cc,null))[_0x13b9('0x34')](function(_0x4051d1){if(_0x4051d1){_0x2bc099[_0x13b9('0x42')]=_[_0x13b9('0x44')](db['Disposition']['rawAttributes']);_0x2bc099['query']=_[_0x13b9('0x44')](_0x288cd9[_0x13b9('0x43')]);_0x2bc099[_0x13b9('0x4d')]=_['intersection'](_0x2bc099['model'],_0x2bc099[_0x13b9('0x43')]);_0x230d97['attributes']=_[_0x13b9('0x45')](_0x2bc099[_0x13b9('0x42')],qs['fields'](_0x288cd9['query'][_0x13b9('0x47')]));_0x230d97['attributes']=_0x230d97[_0x13b9('0x46')][_0x13b9('0x48')]?_0x230d97['attributes']:_0x2bc099[_0x13b9('0x42')];if(!_0x288cd9['query'][_0x13b9('0x49')]('nolimit')){_0x230d97[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x288cd9[_0x13b9('0x43')][_0x13b9('0x65')]);_0x230d97[_0x13b9('0x2f')]=qs[_0x13b9('0x2f')](_0x288cd9['query'][_0x13b9('0x2f')]);}_0x230d97[_0x13b9('0x66')]=qs['sort'](_0x288cd9['query']['sort']);_0x230d97[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_[_0x13b9('0x67')](_0x288cd9[_0x13b9('0x43')],_0x2bc099[_0x13b9('0x4d')]));_0x230d97[_0x13b9('0x4c')]['FaxAccountId']=_0x4051d1['id'];if(_0x288cd9[_0x13b9('0x43')][_0x13b9('0x68')]){_0x230d97[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x230d97[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x230d97['attributes'],function(_0x572d89){var _0x27da23={};_0x27da23[_0x572d89]={'$like':'%'+_0x288cd9[_0x13b9('0x43')][_0x13b9('0x68')]+'%'};return _0x27da23;})});}_0x230d97=_[_0x13b9('0x4e')]({},_0x230d97,_0x288cd9['options']);return db[_0x13b9('0x62')][_0x13b9('0x2e')]({'where':_0x230d97['where']})['then'](function(_0x149d89){_0x30c5aa[_0x13b9('0x2e')]=_0x149d89;if(_0x288cd9['query'][_0x13b9('0x51')]){_0x230d97[_0x13b9('0x52')]=[{'all':!![]}];}return db[_0x13b9('0x62')][_0x13b9('0x53')](_0x230d97);})[_0x13b9('0x34')](function(_0x5b8878){_0x30c5aa['rows']=_0x5b8878;return _0x30c5aa;});}})[_0x13b9('0x34')](respondWithFilteredResult(_0x5246cc,_0x230d97))[_0x13b9('0x28')](handleError(_0x5246cc,null));};exports[_0x13b9('0x69')]=function(_0x4832e8,_0x3f7e9b,_0x42174e){return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x4832e8[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x3f7e9b,null))['then'](function(_0x5d12eb){if(_0x5d12eb){return _0x5d12eb[_0x13b9('0x69')](_0x4832e8[_0x13b9('0x43')][_0x13b9('0x6a')]);}})['then'](respondWithStatusCode(_0x3f7e9b,null))[_0x13b9('0x28')](handleError(_0x3f7e9b,null));};exports[_0x13b9('0x6b')]=function(_0x5379e0,_0x1815c8,_0xe22d5f){if(_0x5379e0[_0x13b9('0x58')]['id']){delete _0x5379e0[_0x13b9('0x58')]['id'];}return db[_0x13b9('0x3e')]['find']({'where':{'id':_0x5379e0[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x1815c8,null))[_0x13b9('0x34')](function(_0x2146c7){if(_0x2146c7){_0x5379e0[_0x13b9('0x58')][_0x13b9('0x6c')]=_0x2146c7['id'];return db[_0x13b9('0x6d')][_0x13b9('0x57')](_0x5379e0[_0x13b9('0x58')]);}})[_0x13b9('0x34')](respondWithResult(_0x1815c8,null))['catch'](handleError(_0x1815c8,null));};exports[_0x13b9('0x6e')]=function(_0x1ce1a8,_0x14904f,_0x38f4d4){var _0xffdf9b={'raw':![],'where':{}};var _0x3af299={};var _0x322f2d={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')]['findOne']({'where':{'id':_0x1ce1a8[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x14904f,null))['then'](function(_0x1a1c86){if(_0x1a1c86){_0x3af299[_0x13b9('0x42')]=_[_0x13b9('0x44')](db['CannedAnswer'][_0x13b9('0x3f')]);_0x3af299['query']=_[_0x13b9('0x44')](_0x1ce1a8['query']);_0x3af299['filters']=_['intersection'](_0x3af299['model'],_0x3af299[_0x13b9('0x43')]);_0xffdf9b['attributes']=_[_0x13b9('0x45')](_0x3af299[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x47')]));_0xffdf9b['attributes']=_0xffdf9b[_0x13b9('0x46')]['length']?_0xffdf9b[_0x13b9('0x46')]:_0x3af299[_0x13b9('0x42')];if(!_0x1ce1a8[_0x13b9('0x43')]['hasOwnProperty'](_0x13b9('0x4a'))){_0xffdf9b[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x1ce1a8[_0x13b9('0x43')]['limit']);_0xffdf9b['offset']=qs[_0x13b9('0x2f')](_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x2f')]);}_0xffdf9b[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x4b')]);_0xffdf9b[_0x13b9('0x4c')]=qs['filters'](_[_0x13b9('0x67')](_0x1ce1a8['query'],_0x3af299[_0x13b9('0x4d')]));_0xffdf9b['where'][_0x13b9('0x6c')]=_0x1a1c86['id'];if(_0x1ce1a8[_0x13b9('0x43')]['filter']){_0xffdf9b[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0xffdf9b[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0xffdf9b[_0x13b9('0x46')],function(_0x33426b){var _0x112113={};_0x112113[_0x33426b]={'$like':'%'+_0x1ce1a8['query'][_0x13b9('0x68')]+'%'};return _0x112113;})});}_0xffdf9b=_[_0x13b9('0x4e')]({},_0xffdf9b,_0x1ce1a8[_0x13b9('0x50')]);return db[_0x13b9('0x6d')][_0x13b9('0x2e')]({'where':_0xffdf9b[_0x13b9('0x4c')]})[_0x13b9('0x34')](function(_0x5748f4){_0x322f2d[_0x13b9('0x2e')]=_0x5748f4;if(_0x1ce1a8[_0x13b9('0x43')][_0x13b9('0x51')]){_0xffdf9b['include']=[{'all':!![]}];}return db[_0x13b9('0x6d')][_0x13b9('0x53')](_0xffdf9b);})[_0x13b9('0x34')](function(_0x535fd7){_0x322f2d[_0x13b9('0x54')]=_0x535fd7;return _0x322f2d;});}})[_0x13b9('0x34')](respondWithFilteredResult(_0x14904f,_0xffdf9b))[_0x13b9('0x28')](handleError(_0x14904f,null));};exports[_0x13b9('0x6f')]=function(_0x56219e,_0xd5dca8,_0x229829){return db['FaxAccount'][_0x13b9('0x56')]({'where':{'id':_0x56219e[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0xd5dca8,null))[_0x13b9('0x34')](function(_0x4da9ad){if(_0x4da9ad){return _0x4da9ad[_0x13b9('0x6f')](_0x56219e[_0x13b9('0x43')]['ids']);}})['then'](respondWithStatusCode(_0xd5dca8,null))['catch'](handleError(_0xd5dca8,null));};exports[_0x13b9('0x70')]=function(_0x1a6bff,_0x49e3fe,_0x101954){return db[_0x13b9('0x71')][_0x13b9('0x56')]({'where':{'id':_0x1a6bff['params']['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x49e3fe,null))[_0x13b9('0x34')](function(_0x55e3e7){if(_0x55e3e7){return _0x55e3e7['addInteraction'](_0x1a6bff[_0x13b9('0x58')][_0x13b9('0x6a')],_[_0x13b9('0x72')](_0x1a6bff[_0x13b9('0x58')],[_0x13b9('0x6a'),'id'])||{});}})[_0x13b9('0x34')](respondWithResult(_0x49e3fe,null))[_0x13b9('0x28')](handleError(_0x49e3fe,null));};exports[_0x13b9('0x73')]=function(_0x1c63e9,_0x5d1c5c,_0x4173db){var _0x588c8d={'raw':![],'where':{}};var _0x29aeff={};var _0x3d6bb1={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x1c63e9[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x5d1c5c,null))[_0x13b9('0x34')](function(_0x49765f){if(_0x49765f){_0x29aeff[_0x13b9('0x42')]=_[_0x13b9('0x44')](db[_0x13b9('0x71')]['rawAttributes']);_0x29aeff[_0x13b9('0x43')]=_['keys'](_0x1c63e9[_0x13b9('0x43')]);_0x29aeff[_0x13b9('0x4d')]=_[_0x13b9('0x45')](_0x29aeff[_0x13b9('0x42')],_0x29aeff[_0x13b9('0x43')]);_0x588c8d[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0x29aeff[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x47')]));_0x588c8d[_0x13b9('0x46')]=_0x588c8d[_0x13b9('0x46')][_0x13b9('0x48')]?_0x588c8d[_0x13b9('0x46')]:_0x29aeff['model'];if(!_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x588c8d['limit']=qs['limit'](_0x1c63e9['query'][_0x13b9('0x65')]);_0x588c8d['offset']=qs[_0x13b9('0x2f')](_0x1c63e9['query'][_0x13b9('0x2f')]);}_0x588c8d[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x588c8d[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_['pick'](_0x1c63e9[_0x13b9('0x43')],_0x29aeff[_0x13b9('0x4d')]));_0x588c8d[_0x13b9('0x4c')][_0x13b9('0x6c')]=_0x49765f['id'];if(_0x1c63e9[_0x13b9('0x43')]['filter']){_0x588c8d[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x588c8d[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x588c8d[_0x13b9('0x46')],function(_0x1df2c1){var _0x5dd55a={};_0x5dd55a[_0x1df2c1]={'$like':'%'+_0x1c63e9[_0x13b9('0x43')]['filter']+'%'};return _0x5dd55a;})});}_0x588c8d=_[_0x13b9('0x4e')]({},_0x588c8d,_0x1c63e9[_0x13b9('0x50')]);return db[_0x13b9('0x71')][_0x13b9('0x2e')]({'where':_0x588c8d[_0x13b9('0x4c')]})[_0x13b9('0x34')](function(_0x37eb27){_0x3d6bb1[_0x13b9('0x2e')]=_0x37eb27;if(_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x51')]){_0x588c8d[_0x13b9('0x52')]=[{'model':db[_0x13b9('0x74')],'as':_0x13b9('0x75'),'required':![]},{'model':db[_0x13b9('0x76')],'as':_0x13b9('0x77'),'attributes':[_0x13b9('0x39'),_0x13b9('0x78'),'internal'],'required':![]},{'model':db[_0x13b9('0x79')],'as':_0x13b9('0x7a'),'attributes':['id',_0x13b9('0x39'),_0x13b9('0x7b')],'where':_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x7c')]?{'id':_0x1c63e9['query'][_0x13b9('0x7c')]}:undefined,'required':_0x1c63e9[_0x13b9('0x43')][_0x13b9('0x7c')]?!![]:![]}];}return db[_0x13b9('0x71')]['findAll'](_0x588c8d);})['then'](function(_0x5bd179){_0x3d6bb1[_0x13b9('0x54')]=_0x5bd179;return _0x3d6bb1;});}})[_0x13b9('0x34')](respondWithFilteredResult(_0x5d1c5c,_0x588c8d))['catch'](handleError(_0x5d1c5c,null));};exports[_0x13b9('0x7d')]=function(_0x38d0f5,_0x50883e){var _0x2b6973=_0x38d0f5['params']['id'];var _0xdc7ee8=_0x38d0f5[_0x13b9('0x58')];var _0x5d6a19=0xc8;var _0x529e66=null;return db[_0x13b9('0x7e')][_0x13b9('0x7f')]({'isolationLevel':db[_0x13b9('0x7e')][_0x13b9('0x80')][_0x13b9('0x81')]['READ_COMMITTED']},function(_0x1baf41){return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x2b6973},'transaction':_0x1baf41})[_0x13b9('0x34')](function(_0x1ac3f1){if(_0x1ac3f1){return db[_0x13b9('0x82')][_0x13b9('0x5e')]({'where':{'FaxAccountId':_0x2b6973},'transaction':_0x1baf41})[_0x13b9('0x34')](function(){var _0x5a5b48=_[_0x13b9('0x3d')](_0xdc7ee8,function(_0x19a41a){_0x19a41a['FaxAccountId']=_0x2b6973;return _0x19a41a;});return db[_0x13b9('0x82')][_0x13b9('0x83')](_0x5a5b48,{'transaction':_0x1baf41});});}else{_0x5d6a19=0x194;_0x529e66=[];}});})['then'](function(){if(_0x5d6a19!==0x194){return db[_0x13b9('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x2b6973},'order':'priority'})['then'](function(_0x1e5ae2){_0x529e66=_0x1e5ae2;});}})[_0x13b9('0x28')](function(_0x4c6a53){_0x5d6a19=0x1f4;logger[_0x13b9('0x24')](_0x4c6a53['stack']);if(_0x4c6a53[_0x13b9('0x39')]){delete _0x4c6a53[_0x13b9('0x39')];}_0x529e66=_0x4c6a53;})[_0x13b9('0x84')](function(){if(_0x529e66===null){_0x50883e['sendStatus'](_0x5d6a19);}else{if(_0x5d6a19===0x1f4){_0x50883e[_0x13b9('0x2a')](_0x5d6a19)[_0x13b9('0x3a')](_0x529e66);}else{_0x50883e['status'](_0x5d6a19)['json'](_0x529e66);}}});};exports[_0x13b9('0x85')]=function(_0x940a7d,_0x3a8c0c,_0xd66049){var _0x20e4e8={};var _0x1bc436={};var _0x35124d;var _0x2ece4a;return db['FaxAccount'][_0x13b9('0x64')]({'where':{'id':_0x940a7d['params']['id']}})['then'](handleEntityNotFound(_0x3a8c0c,null))['then'](function(_0x3df145){if(_0x3df145){_0x35124d=_0x3df145;_0x1bc436[_0x13b9('0x42')]=_[_0x13b9('0x44')](db[_0x13b9('0x82')][_0x13b9('0x3f')]);_0x1bc436['query']=_[_0x13b9('0x44')](_0x940a7d['query']);_0x1bc436['filters']=_[_0x13b9('0x45')](_0x1bc436[_0x13b9('0x42')],_0x1bc436['query']);_0x20e4e8[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0x1bc436['model'],qs['fields'](_0x940a7d['query'][_0x13b9('0x47')]));_0x20e4e8['attributes']=_0x20e4e8['attributes'][_0x13b9('0x48')]?_0x20e4e8[_0x13b9('0x46')]:_0x1bc436['model'];_0x20e4e8['order']=qs[_0x13b9('0x4b')](_0x940a7d[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x20e4e8[_0x13b9('0x4c')]=qs[_0x13b9('0x4d')](_[_0x13b9('0x67')](_0x940a7d[_0x13b9('0x43')],_0x1bc436[_0x13b9('0x4d')]));if(_0x940a7d[_0x13b9('0x43')][_0x13b9('0x68')]){_0x20e4e8[_0x13b9('0x4c')]=_['merge'](_0x20e4e8[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x20e4e8['attributes'],function(_0x3ac2b8){var _0x3d2fe2={};_0x3d2fe2[_0x3ac2b8]={'$like':'%'+_0x940a7d[_0x13b9('0x43')]['filter']+'%'};return _0x3d2fe2;})});}_0x20e4e8=_['merge']({},_0x20e4e8,_0x940a7d['options']);return _0x35124d['getApplications'](_0x20e4e8);}})[_0x13b9('0x34')](function(_0x502fbd){if(_0x502fbd){_0x2ece4a=_0x502fbd['length'];if(!_0x940a7d['query'][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x20e4e8[_0x13b9('0x65')]=qs['limit'](_0x940a7d[_0x13b9('0x43')][_0x13b9('0x65')]);_0x20e4e8['offset']=qs[_0x13b9('0x2f')](_0x940a7d[_0x13b9('0x43')][_0x13b9('0x2f')]);}return _0x35124d[_0x13b9('0x85')](_0x20e4e8);}})[_0x13b9('0x34')](function(_0x204984){if(_0x204984){return _0x204984?{'count':_0x2ece4a,'rows':_0x204984}:null;}})[_0x13b9('0x34')](respondWithResult(_0x3a8c0c,null))['catch'](handleError(_0x3a8c0c,null));};function Extension(_0x2636eb,_0x342d41,_0x36b3f2,_0x5cbe08){this[_0x13b9('0x86')]=_0x13b9('0x87');this[_0x13b9('0x88')]=_0x2636eb[_0x13b9('0x89')];this[_0x13b9('0x8a')]=_0x5cbe08;this['type']='system';this['description']=_0x13b9('0x8b');this['FaxAccountId']=_0x2636eb['id'];this[_0x13b9('0x8c')]=_0x342d41;this[_0x13b9('0x8d')]=_0x36b3f2;}function createExtensionsReciveFax(_0x333c76){var _0x438f28=0x1;var _0x4648be=[];_0x4648be['push'](new Extension(_0x333c76,_0x438f28,'',_0x13b9('0x8e')));_0x438f28+=0x1;_0x4648be[_0x13b9('0x8f')](new Extension(_0x333c76,_0x438f28,_0x13b9('0x90'),'Set'));_0x438f28+=0x1;for(var _0x353ad8 in _0x333c76){if(_0x333c76['hasOwnProperty'](_0x353ad8)&&(_0x353ad8===_0x13b9('0x91')||_0x353ad8===_0x13b9('0x89')||_0x353ad8===_0x13b9('0x92')||_0x353ad8===_0x13b9('0x93')||_0x353ad8===_0x13b9('0x94')||_0x353ad8==='maxrate'||_0x353ad8===_0x13b9('0x95')||_0x353ad8===_0x13b9('0x96')||_0x353ad8==='t38timeout')){_0x4648be[_0x13b9('0x8f')](new Extension(_0x333c76,_0x438f28,_0x13b9('0x97')+_0x353ad8+')='+_0x333c76[_0x353ad8],_0x13b9('0x98')));_0x438f28+=0x1;}}_0x4648be['push'](new Extension(_0x333c76,_0x438f28,'6',_0x13b9('0x99')));_0x438f28+=0x1;_0x4648be[_0x13b9('0x8f')](new Extension(_0x333c76,_0x438f28,_0x13b9('0x9a'),'ReceiveFax'));_0x438f28=0x0;return _0x4648be;}exports[_0x13b9('0x9b')]=function(_0x14eb0d,_0x2ca7ce,_0x3964aa){var _0x3df681;return db[_0x13b9('0x7e')][_0x13b9('0x7f')](function(_0x4b43a){return db[_0x13b9('0x3e')][_0x13b9('0x57')](_0x14eb0d[_0x13b9('0x58')],{'transaction':_0x4b43a})[_0x13b9('0x34')](function(_0xbb6603){_0x3df681=_0xbb6603[_0x13b9('0x35')]({'plain':!![]});return db[_0x13b9('0x9c')][_0x13b9('0x83')](createExtensionsReciveFax(_0x3df681),{'transaction':_0x4b43a});});})[_0x13b9('0x34')](function(){return _0x3df681;})['then'](respondWithResult(_0x2ca7ce,null))['catch'](handleError(_0x2ca7ce,null));};exports[_0x13b9('0x9d')]=function(_0x460d0b,_0x1665c0,_0x3b8b76){var _0x2c9b86;return db[_0x13b9('0x7e')][_0x13b9('0x7f')](function(_0x2f79b2){return db['FaxAccount']['update'](_0x460d0b['body'],{'where':{'id':_0x460d0b[_0x13b9('0x58')]['id']},'transaction':_0x2f79b2})[_0x13b9('0x34')](function(_0x121c00){return db[_0x13b9('0x9c')][_0x13b9('0x5e')]({'where':{'FaxAccountId':_0x460d0b[_0x13b9('0x58')]['id']},'transaction':_0x2f79b2})[_0x13b9('0x34')](function(_0x272304){return db['VoiceExtension'][_0x13b9('0x83')](createExtensionsReciveFax(_['omit'](_0x460d0b[_0x13b9('0x58')],[_0x13b9('0x9e'),_0x13b9('0x9f'),_0x13b9('0xa0'),_0x13b9('0xa1'),_0x13b9('0xa2'),_0x13b9('0xa3')])),{'transaction':_0x2f79b2});});});})[_0x13b9('0x34')](function(){return db['FaxAccount'][_0x13b9('0xa4')](_0x460d0b['body']['id']);})[_0x13b9('0x34')](respondWithResult(_0x1665c0,null))[_0x13b9('0x28')](handleError(_0x1665c0,null));};exports[_0x13b9('0xa5')]=function(_0x504a25,_0x211dbd,_0x7c78c7){var _0x16e983={'raw':!![],'where':{}};var _0x72d7ce={};var _0x2fb9f6={'count':0x0,'rows':[]};return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x504a25[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x211dbd,null))['then'](function(_0x3af69b){if(_0x3af69b){_0x72d7ce[_0x13b9('0x42')]=_[_0x13b9('0x44')](db['FaxMessage']['rawAttributes']);_0x72d7ce[_0x13b9('0x43')]=_['keys'](_0x504a25['query']);_0x72d7ce[_0x13b9('0x4d')]=_['intersection'](_0x72d7ce[_0x13b9('0x42')],_0x72d7ce['query']);_0x16e983[_0x13b9('0x46')]=_['intersection'](_0x72d7ce[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x47')]));_0x16e983['attributes']=_0x16e983['attributes']['length']?_0x16e983[_0x13b9('0x46')]:_0x72d7ce[_0x13b9('0x42')];if(!_0x504a25[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x16e983[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x65')]);_0x16e983[_0x13b9('0x2f')]=qs[_0x13b9('0x2f')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x2f')]);}_0x16e983[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x504a25[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x16e983[_0x13b9('0x4c')]=qs['filters'](_[_0x13b9('0x67')](_0x504a25[_0x13b9('0x43')],_0x72d7ce['filters']));_0x16e983[_0x13b9('0x4c')][_0x13b9('0x6c')]=_0x3af69b['id'];if(_0x504a25['query'][_0x13b9('0x68')]){_0x16e983[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x16e983[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x16e983['attributes'],function(_0x3e435a){var _0x487361={};_0x487361[_0x3e435a]={'$like':'%'+_0x504a25['query']['filter']+'%'};return _0x487361;})});}if(_0x504a25[_0x13b9('0x43')]['$gte']){var _0x4a87fb=_0x504a25[_0x13b9('0x43')][_0x13b9('0xa6')][_0x13b9('0xa7')](',');var _0x57cae0={};_0x57cae0[_0x4a87fb[0x0]]={'$gte':moment(_0x4a87fb[0x1])[_0x13b9('0xa8')](_0x13b9('0xa9'))};_0x16e983[_0x13b9('0x4c')]=_['merge'](_0x16e983[_0x13b9('0x4c')],_0x57cae0);}_0x16e983=_[_0x13b9('0x4e')]({},_0x16e983,_0x504a25['options']);return db[_0x13b9('0xaa')][_0x13b9('0x2e')]({'where':_0x16e983[_0x13b9('0x4c')]})[_0x13b9('0x34')](function(_0x144196){_0x2fb9f6[_0x13b9('0x2e')]=_0x144196;if(_0x504a25[_0x13b9('0x43')][_0x13b9('0x51')]){_0x16e983[_0x13b9('0x52')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x16e983);})[_0x13b9('0x34')](function(_0x41d9a3){_0x2fb9f6[_0x13b9('0x54')]=_0x41d9a3;return _0x2fb9f6;});}})['then'](respondWithFilteredResult(_0x211dbd,_0x16e983))[_0x13b9('0x28')](handleError(_0x211dbd,null));};exports[_0x13b9('0x3a')]=function(_0x256f8b,_0x4de275,_0x2db827){var _0x1cc1d2,_0x34fc1f={},_0x22fcd7;if(_0x256f8b[_0x13b9('0x58')]['to']){_0x22fcd7=_0x256f8b[_0x13b9('0x58')]['to'][0x0];}return db[_0x13b9('0x3e')]['find']({'where':{'id':_0x256f8b[_0x13b9('0x61')]['id']},'include':[{'model':db[_0x13b9('0xab')],'as':_0x13b9('0xac'),'include':[{'model':db[_0x13b9('0x74')],'as':_0x13b9('0xad'),'where':{'fax':_0x22fcd7},'limit':0x1,'order':[['updatedAt',_0x13b9('0xae')]]}]}]})['then'](handleEntityNotFound(_0x4de275,null))[_0x13b9('0x34')](function(_0x1e9887){_0x1cc1d2=_0x1e9887;if(_0x256f8b[_0x13b9('0x58')]['attachments']&&_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')]['length']){for(var _0x3d0b4c=0x0;_0x3d0b4c<_0x256f8b[_0x13b9('0x58')]['attachments'][_0x13b9('0x48')];_0x3d0b4c+=0x1){_0x256f8b['body'][_0x13b9('0xaf')][_0x3d0b4c]={'filename':_0x256f8b['body']['attachments'][_0x3d0b4c]['name'],'id':_0x256f8b[_0x13b9('0x58')]['attachments'][_0x3d0b4c]['id'],'path':path['join'](config['root'],_0x13b9('0xb0'),_0x256f8b['body'][_0x13b9('0xaf')][_0x3d0b4c][_0x13b9('0xb1')])};}}return respondWithRpcPromise(_0x13b9('0xb2'),_0x13b9('0xb2'),{'FaxAccountId':_[_0x13b9('0xb3')](_0x256f8b[_0x13b9('0x61')]['id'])?undefined:_0x256f8b[_0x13b9('0x61')]['id'],'path':_[_0x13b9('0xb3')](_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0x6')])?undefined:_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0x6')],'fax':_['isNil'](_0x256f8b[_0x13b9('0x58')]['to'][0x0])?undefined:_0x256f8b[_0x13b9('0x58')]['to'][0x0]},client9002);})[_0x13b9('0x34')](function(){if(_0x1cc1d2){if(_['isNil'](_0x256f8b[_0x13b9('0x58')]['from'])){_0x256f8b['body']['from']=util[_0x13b9('0xa8')]('\x22%s\x22\x20<%s>',_0x1cc1d2[_0x13b9('0x39')],_0x1cc1d2[_0x13b9('0xb4')]);}if(_0x1cc1d2[_0x13b9('0xac')]){if(_0x1cc1d2[_0x13b9('0xac')][_0x13b9('0xad')]['length']){return _0x1cc1d2[_0x13b9('0xac')]['Contacts'][0x0];}else{return db[_0x13b9('0x74')][_0x13b9('0x57')](_[_0x13b9('0x17')](_0x256f8b[_0x13b9('0x58')],{'firstName':_0x256f8b[_0x13b9('0x58')]['to'][0x0],'phone':_0x256f8b[_0x13b9('0x58')]['to'][0x0],'fax':_0x256f8b[_0x13b9('0x58')]['to'][0x0],'ListId':_0x1cc1d2[_0x13b9('0xa3')]}));}}else{throw new Error(_0x13b9('0xb5'));}}else{throw new Error(_0x13b9('0xb6'));}})['then'](function(_0x2c646a){if(_0x2c646a){return db[_0x13b9('0x71')][_0x13b9('0x56')]({'where':{'ContactId':_0x2c646a['id'],'closed':![],'FaxAccountId':_0x1cc1d2['id']}})[_0x13b9('0x34')](function(_0x82656d){if(_0x82656d){return[_0x82656d,![]];}return db['FaxInteraction'][_0x13b9('0x57')]({'UserId':_0x256f8b[_0x13b9('0x5b')]['id'],'ContactId':_0x2c646a['id'],'FaxAccountId':_0x1cc1d2['id'],'fax':_0x256f8b['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0x13b9('0x4e')](_0x256f8b[_0x13b9('0x58')],{'read':![],'body':_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0xb7')],'FaxAccountId':_0x1cc1d2['id'],'UserId':_0x256f8b[_0x13b9('0x5b')]['id'],'ContactId':_0x2c646a['id'],'AttachmentId':_0x256f8b['body'][_0x13b9('0xaf')][0x0]['id']})]},{'include':[{'model':db[_0x13b9('0xaa')],'as':_0x13b9('0xb8')}]})[_0x13b9('0x34')](function(_0xb45139){return[_0xb45139,!![]];});});}else{throw new Error(_0x13b9('0xb9'));}})[_0x13b9('0xba')](function(_0x33e3fe,_0x26a5bb){if(_0x26a5bb){return _0x33e3fe;}return db[_0x13b9('0xaa')][_0x13b9('0x57')]({'direction':'out','read':![],'body':_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0xb7')],'FaxAccountId':_0x1cc1d2['id'],'FaxInteractionId':_0x33e3fe['id'],'UserId':_0x256f8b[_0x13b9('0x5b')]['id'],'ContactId':_0x33e3fe['ContactId'],'AttachmentId':_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0]['id']})[_0x13b9('0x34')](function(_0x557d5a){_0x33e3fe[_0x13b9('0xbb')][_0x13b9('0xb8')]=[];_0x33e3fe[_0x13b9('0xbb')][_0x13b9('0xb8')][_0x13b9('0x8f')](_0x557d5a[_0x13b9('0xbb')]);return _0x33e3fe;});})[_0x13b9('0x34')](function(_0x4c180f){respondWithRpcPromise(_0x13b9('0xbc'),_0x13b9('0xbc'),{'FaxAccountId':_['isNil'](_0x256f8b['params']['id'])?undefined:_0x256f8b[_0x13b9('0x61')]['id'],'path':_[_0x13b9('0xb3')](_0x256f8b[_0x13b9('0x58')][_0x13b9('0xaf')][0x0][_0x13b9('0x6')])?undefined:_0x256f8b[_0x13b9('0x58')]['attachments'][0x0][_0x13b9('0x6')],'fax':_[_0x13b9('0xb3')](_0x256f8b['body']['to'][0x0])?undefined:_0x256f8b[_0x13b9('0x58')]['to'][0x0],'AttachmentId':_0x256f8b[_0x13b9('0x58')]['attachments'][0x0]['id']},client9002)[_0x13b9('0x34')](function(_0x5bc637){logger[_0x13b9('0x1f')](_0x13b9('0xbd'),_0x5bc637);})['catch'](function(_0xeb9f2e){logger['info'](_0x13b9('0xbd'),_0xeb9f2e);});return _0x4c180f;})[_0x13b9('0x34')](respondWithResult(_0x4de275,null))[_0x13b9('0x28')](handleError(_0x4de275,null));};exports[_0x13b9('0xbe')]=function(_0x26a427,_0x153ad6,_0x368d91){return db[_0x13b9('0x3e')][_0x13b9('0x56')]({'where':{'id':_0x26a427[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x153ad6,null))[_0x13b9('0x34')](function(_0x365d2a){if(_0x365d2a){return _0x365d2a[_0x13b9('0xbe')](_0x26a427[_0x13b9('0x58')][_0x13b9('0x6a')],_['omit'](_0x26a427['body'],[_0x13b9('0x6a'),'id'])||{})[_0x13b9('0xba')](function(_0x54fed0){for(var _0x10407b=0x0;_0x10407b<_0x26a427[_0x13b9('0x58')][_0x13b9('0x6a')][_0x13b9('0x48')];_0x10407b+=0x1){socket[_0x13b9('0xbf')](_0x13b9('0xc0'),{'UserId':Number(_0x26a427[_0x13b9('0x58')][_0x13b9('0x6a')][_0x10407b]),'FaxAccountId':Number(_0x26a427[_0x13b9('0x61')]['id'])});}return _0x54fed0;});}})[_0x13b9('0x34')](respondWithResult(_0x153ad6,null))[_0x13b9('0x28')](handleError(_0x153ad6,null));};exports[_0x13b9('0xc1')]=function(_0x41cffb,_0x23f05b,_0x9fbd1d){return db['FaxAccount'][_0x13b9('0x56')]({'where':{'id':_0x41cffb[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x23f05b,null))[_0x13b9('0x34')](function(_0x328b89){if(_0x328b89){return _0x328b89[_0x13b9('0xc1')](_0x41cffb[_0x13b9('0x43')][_0x13b9('0x6a')])[_0x13b9('0x34')](function(){if(_[_0x13b9('0xc2')](_0x41cffb[_0x13b9('0x43')][_0x13b9('0x6a')])){for(var _0x214b8e=0x0;_0x214b8e<_0x41cffb['query']['ids'][_0x13b9('0x48')];_0x214b8e+=0x1){socket['emit'](_0x13b9('0xc3'),{'UserId':Number(_0x41cffb[_0x13b9('0x43')][_0x13b9('0x6a')][_0x214b8e]),'FaxAccountId':Number(_0x41cffb[_0x13b9('0x61')]['id'])});}}else{socket[_0x13b9('0xbf')]('userFaxAccount:remove',{'UserId':Number(_0x41cffb['query'][_0x13b9('0x6a')]),'FaxAccountId':Number(_0x41cffb['params']['id'])});}});}})[_0x13b9('0x34')](respondWithStatusCode(_0x23f05b,null))[_0x13b9('0x28')](handleError(_0x23f05b,null));};exports[_0x13b9('0xc4')]=function(_0x3aeded,_0x2b81c7,_0xd40338){var _0x324568={};var _0xe1039f={};var _0x299865;var _0x88d266;return db[_0x13b9('0x3e')][_0x13b9('0x64')]({'where':{'id':_0x3aeded[_0x13b9('0x61')]['id']}})[_0x13b9('0x34')](handleEntityNotFound(_0x2b81c7,null))[_0x13b9('0x34')](function(_0x450bfe){if(_0x450bfe){_0x299865=_0x450bfe;_0xe1039f[_0x13b9('0x42')]=_['keys'](db['User']['rawAttributes']);_0xe1039f['query']=_[_0x13b9('0x44')](_0x3aeded[_0x13b9('0x43')]);_0xe1039f[_0x13b9('0x4d')]=_[_0x13b9('0x45')](_0xe1039f[_0x13b9('0x42')],_0xe1039f[_0x13b9('0x43')]);_0x324568[_0x13b9('0x46')]=_[_0x13b9('0x45')](_0xe1039f[_0x13b9('0x42')],qs[_0x13b9('0x47')](_0x3aeded[_0x13b9('0x43')][_0x13b9('0x47')]));_0x324568[_0x13b9('0x46')]=_0x324568[_0x13b9('0x46')][_0x13b9('0x48')]?_0x324568[_0x13b9('0x46')]:_0xe1039f[_0x13b9('0x42')];_0x324568[_0x13b9('0x66')]=qs[_0x13b9('0x4b')](_0x3aeded[_0x13b9('0x43')][_0x13b9('0x4b')]);_0x324568['where']=qs[_0x13b9('0x4d')](_[_0x13b9('0x67')](_0x3aeded[_0x13b9('0x43')],_0xe1039f['filters']));if(_0x3aeded[_0x13b9('0x43')]['filter']){_0x324568[_0x13b9('0x4c')]=_[_0x13b9('0x4e')](_0x324568[_0x13b9('0x4c')],{'$or':_[_0x13b9('0x3d')](_0x324568['attributes'],function(_0x480d72){var _0x34aa40={};_0x34aa40[_0x480d72]={'$like':'%'+_0x3aeded[_0x13b9('0x43')][_0x13b9('0x68')]+'%'};return _0x34aa40;})});}_0x324568=_[_0x13b9('0x4e')]({},_0x324568,_0x3aeded[_0x13b9('0x50')]);return _0x299865[_0x13b9('0xc4')](_0x324568);}})[_0x13b9('0x34')](function(_0x620615){if(_0x620615){_0x88d266=_0x620615[_0x13b9('0x48')];if(!_0x3aeded[_0x13b9('0x43')][_0x13b9('0x49')](_0x13b9('0x4a'))){_0x324568[_0x13b9('0x65')]=qs[_0x13b9('0x65')](_0x3aeded[_0x13b9('0x43')][_0x13b9('0x65')]);_0x324568['offset']=qs[_0x13b9('0x2f')](_0x3aeded['query'][_0x13b9('0x2f')]);}return _0x299865[_0x13b9('0xc4')](_0x324568);}})[_0x13b9('0x34')](function(_0x5a616b){if(_0x5a616b){return _0x5a616b?{'count':_0x88d266,'rows':_0x5a616b}:null;}})[_0x13b9('0x34')](respondWithResult(_0x2b81c7,null))[_0x13b9('0x28')](handleError(_0x2b81c7,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index e158513..9165e0d 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 _0x357a=['exports','../../mysqldb','FaxAccount','update','remove','emit','hook'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x357a,0x1ac));var _0xa357=function(_0x49a301,_0x284d5e){_0x49a301=_0x49a301-0x0;var _0x5625d0=_0x357a[_0x49a301];return _0x5625d0;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0xa357('0x0'))['db'][_0xa357('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa357('0x2'),'afterDestroy':_0xa357('0x3')};function emitEvent(_0x5615ac){return function(_0x432cf9,_0x2c38d3,_0xa8ae69){FaxAccountEvents[_0xa357('0x4')](_0x5615ac+':'+_0x432cf9['id'],_0x432cf9);FaxAccountEvents[_0xa357('0x4')](_0x5615ac,_0x432cf9);_0xa8ae69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0xa357('0x5')](e,emitEvent(event));}}module[_0xa357('0x6')]=FaxAccountEvents; \ No newline at end of file +var _0x6201=['FaxAccount','setMaxListeners','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3454f0,_0x31c6c6){var _0x528fdc=function(_0x1a36b6){while(--_0x1a36b6){_0x3454f0['push'](_0x3454f0['shift']());}};_0x528fdc(++_0x31c6c6);}(_0x6201,0xbf));var _0x1620=function(_0x2a5db8,_0x1f3188){_0x2a5db8=_0x2a5db8-0x0;var _0x5ce985=_0x6201[_0x2a5db8];return _0x5ce985;};'use strict';var EventEmitter=require('events');var FaxAccount=require(_0x1620('0x0'))['db'][_0x1620('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x1620('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1620('0x3'),'afterDestroy':'remove'};function emitEvent(_0x4460c6){return function(_0x376842,_0x1fb81d,_0x1d2840){FaxAccountEvents[_0x1620('0x4')](_0x4460c6+':'+_0x376842['id'],_0x376842);FaxAccountEvents[_0x1620('0x4')](_0x4460c6,_0x376842);_0x1d2840(null);};}for(var e in events){if(events[_0x1620('0x5')](e)){var event=events[e];FaxAccount[_0x1620('0x6')](e,emitEvent(event));}}module[_0x1620('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 920c506..f654526 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 _0x55ea=['bluebird','path','rimraf','./faxAccount.attributes','exports','FaxAccount','lodash','../../config/logger','api','moment'];(function(_0x48a921,_0x2edffb){var _0x5870ca=function(_0x3d958f){while(--_0x3d958f){_0x48a921['push'](_0x48a921['shift']());}};_0x5870ca(++_0x2edffb);}(_0x55ea,0xba));var _0xa55e=function(_0x4a771a,_0x241c0b){_0x4a771a=_0x4a771a-0x0;var _0x5ba097=_0x55ea[_0x4a771a];return _0x5ba097;};'use strict';var _=require(_0xa55e('0x0'));var util=require('util');var logger=require(_0xa55e('0x1'))(_0xa55e('0x2'));var moment=require(_0xa55e('0x3'));var BPromise=require(_0xa55e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa55e('0x5'));var rimraf=require(_0xa55e('0x6'));var config=require('../../config/environment');var attributes=require(_0xa55e('0x7'));module[_0xa55e('0x8')]=function(_0x4e49c4,_0x4e2572){return _0x4e49c4['define'](_0xa55e('0x9'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cd1=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x409582,_0x1f0415){var _0xc9369d=function(_0x18dddf){while(--_0x18dddf){_0x409582['push'](_0x409582['shift']());}};_0xc9369d(++_0x1f0415);}(_0x0cd1,0xa3));var _0x10cd=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x0cd1[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require(_0x10cd('0x0'));var util=require(_0x10cd('0x1'));var logger=require(_0x10cd('0x2'))(_0x10cd('0x3'));var moment=require(_0x10cd('0x4'));var BPromise=require(_0x10cd('0x5'));var rp=require(_0x10cd('0x6'));var fs=require('fs');var path=require(_0x10cd('0x7'));var rimraf=require(_0x10cd('0x8'));var config=require(_0x10cd('0x9'));var attributes=require('./faxAccount.attributes');module[_0x10cd('0xa')]=function(_0x23a315,_0x26ae95){return _0x23a315[_0x10cd('0xb')](_0x10cd('0xc'),attributes,{'tableName':_0x10cd('0xd'),'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 41f4946..9ced740 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 _0xbde2=['UserId','User','name','agent','waitForTheAssignedAgent','*,*,*,*','queueId','queue','waitForTheAssignedQueue','Start','startRouting','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','http','redis','socket.io-emitter','./faxAccount.socket','register','info','request\x20sent','debug','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','GetFaxAccount','options','raw','attributes','limit','include','map','model','NotifyFaxAccount','body','fax','then','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','defaults','CmContact','contact','create','Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','created','interaction','FaxMessage','ContactId','AttachmentId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbde2,0x1c8));var _0x2bde=function(_0x4c6ea9,_0x2ae016){_0x4c6ea9=_0x4c6ea9-0x0;var _0x4e10c2=_0xbde2[_0x4c6ea9];return _0x4e10c2;};'use strict';var _=require('lodash');var util=require(_0x2bde('0x0'));var moment=require(_0x2bde('0x1'));var BPromise=require(_0x2bde('0x2'));var rs=require(_0x2bde('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2bde('0x4'));var logger=require(_0x2bde('0x5'))(_0x2bde('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x2bde('0x7')][_0x2bde('0x8')]({'port':0x232c});config[_0x2bde('0x9')]=_['defaults'](config[_0x2bde('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2bde('0xa'))(new Redis(config['redis']));require(_0x2bde('0xb'))[_0x2bde('0xc')](socket);function respondWithRpcPromise(_0x4aeea8,_0xabbcea,_0x35a557){return new BPromise(function(_0x3ddd2f,_0x4156a2){return client['request'](_0x4aeea8,_0x35a557)['then'](function(_0x259d3d){logger[_0x2bde('0xd')]('FaxAccount,\x20%s,\x20%s',_0xabbcea,_0x2bde('0xe'));logger[_0x2bde('0xf')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0xabbcea,_0x2bde('0xe'),JSON[_0x2bde('0x10')](_0x259d3d));if(_0x259d3d['error']){if(_0x259d3d[_0x2bde('0x11')][_0x2bde('0x12')]===0x1f4){logger[_0x2bde('0x11')](_0x2bde('0x13'),_0xabbcea,_0x259d3d[_0x2bde('0x11')][_0x2bde('0x14')]);return _0x4156a2(_0x259d3d['error'][_0x2bde('0x14')]);}logger[_0x2bde('0x11')](_0x2bde('0x13'),_0xabbcea,_0x259d3d[_0x2bde('0x11')][_0x2bde('0x14')]);return _0x3ddd2f(_0x259d3d[_0x2bde('0x11')]['message']);}else{logger['info'](_0x2bde('0x13'),_0xabbcea,_0x2bde('0xe'));_0x3ddd2f(_0x259d3d[_0x2bde('0x15')]['message']);}})[_0x2bde('0x16')](function(_0x3c1245){logger[_0x2bde('0x11')](_0x2bde('0x13'),_0xabbcea,_0x3c1245);_0x4156a2(_0x3c1245);});});}exports[_0x2bde('0x17')]=function(_0x2c9d60){var _0x451eeb=this;return new Promise(function(_0x5eebd8,_0x38151f){return db['FaxAccount']['findAll']({'raw':_0x2c9d60[_0x2bde('0x18')]?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x19')]===undefined?!![]:![]:!![],'where':_0x2c9d60['options']?_0x2c9d60['options']['where']||null:null,'attributes':_0x2c9d60['options']?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1a')]||null:null,'limit':_0x2c9d60['options']?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1b')]||null:null,'include':_0x2c9d60['options']?_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1c')]?_[_0x2bde('0x1d')](_0x2c9d60[_0x2bde('0x18')][_0x2bde('0x1c')],function(_0x323343){return{'model':db[_0x323343['model']],'as':_0x323343['as'],'attributes':_0x323343[_0x2bde('0x1a')],'include':_0x323343[_0x2bde('0x1c')]?_[_0x2bde('0x1d')](_0x323343[_0x2bde('0x1c')],function(_0x522932){return{'model':db[_0x522932[_0x2bde('0x1e')]],'as':_0x522932['as'],'attributes':_0x522932[_0x2bde('0x1a')],'include':_0x522932[_0x2bde('0x1c')]?_[_0x2bde('0x1d')](_0x522932['include'],function(_0x30fcfa){return{'model':db[_0x30fcfa[_0x2bde('0x1e')]],'as':_0x30fcfa['as'],'attributes':_0x30fcfa[_0x2bde('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x904cc2){logger[_0x2bde('0xd')]('GetFaxAccount',_0x2c9d60);logger[_0x2bde('0xf')](_0x2bde('0x17'),_0x2c9d60,JSON[_0x2bde('0x10')](_0x904cc2));_0x5eebd8(_0x904cc2);})[_0x2bde('0x16')](function(_0x1e74f8){logger[_0x2bde('0x11')](_0x2bde('0x17'),_0x1e74f8[_0x2bde('0x14')],_0x2c9d60);_0x38151f(_0x451eeb[_0x2bde('0x11')](0x1f4,_0x1e74f8['message']));});});};exports[_0x2bde('0x1f')]=function(_0x1d1bef,_0x2b2180,_0x42a8dd){var _0x408ebb=this;return new Promise(function(_0x221930,_0x376169){var _0x506027={'body':_0x1d1bef[_0x2bde('0x20')],'channel':_0x2bde('0x21')};var _0x30f564=[];var _0x300399=[];var _0x4284b0={};return db['CmContact']['describe']()[_0x2bde('0x22')](function(_0x1c3e66){if(!_0x1c3e66){throw new db[(_0x2bde('0x23'))][(_0x2bde('0x24'))](_0x2bde('0x25'));}_0x30f564=_[_0x2bde('0x26')](_['keys'](_0x1c3e66),[_0x2bde('0x27'),_0x2bde('0x28')]);_0x300399=_[_0x2bde('0x26')](_[_0x2bde('0x29')](_0x1c3e66),[_0x2bde('0x27'),_0x2bde('0x28'),_0x2bde('0x2a'),_0x2bde('0x2b')]);if(_0x1d1bef[_0x2bde('0x20')]['id']){delete _0x1d1bef['body']['id'];}if(_[_0x2bde('0x2c')](_0x1d1bef['body'][_0x2bde('0x2d')])){throw new db[(_0x2bde('0x23'))]['ValidationError'](_0x2bde('0x2e'));}if(_[_0x2bde('0x2c')](_0x1d1bef['body'][_0x2bde('0x20')])||_0x1d1bef['body'][_0x2bde('0x20')]===''){throw new db[(_0x2bde('0x23'))][(_0x2bde('0x24'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x2bde('0x2c')](_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2f')])){throw new db[(_0x2bde('0x23'))]['ValidationError'](_0x2bde('0x30')+_0x300399);}if(!_['includes'](_0x300399,_0x1d1bef[_0x2bde('0x20')]['mapKey'])){throw new db[(_0x2bde('0x23'))][(_0x2bde('0x24'))](_0x2bde('0x31')+_0x300399);}_0x4284b0[_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2f')]]=_0x1d1bef[_0x2bde('0x20')]['from'];})[_0x2bde('0x22')](function(){return db['FaxAccount'][_0x2bde('0x32')]({'where':{'id':_0x1d1bef[_0x2bde('0x33')]['id']},'include':[{'model':db['CmList'],'as':_0x2bde('0x34'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x4284b0,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x2bde('0x35')],'as':_0x2bde('0x36')}]});})[_0x2bde('0x22')](function(_0x3e228f){if(_0x3e228f&&_0x3e228f[_0x2bde('0x34')]){var _0x38c4df=_0x3e228f[_0x2bde('0x37')]({'plain':!![]});_0x506027['account']=_0x38c4df;_0x506027[_0x2bde('0x38')]=_0x38c4df[_0x2bde('0x36')];_0x506027[_0x2bde('0x39')]=_0x38c4df[_0x2bde('0x34')];_0x506027['applications']=_[_0x2bde('0x3a')](_0x506027['applications'],[_0x2bde('0x3b')],[_0x2bde('0x3c')]);if(_0x506027['account'][_0x2bde('0x36')]){delete _0x506027['account']['Applications'];}if(_0x506027[_0x2bde('0x33')]['List']&&_0x506027[_0x2bde('0x33')][_0x2bde('0x34')][_0x2bde('0x3d')][_0x2bde('0x3e')]){return _0x506027[_0x2bde('0x33')][_0x2bde('0x34')][_0x2bde('0x3d')][0x0];}var _0x146cbe=_[_0x2bde('0x3f')](_0x1d1bef[_0x2bde('0x20')],{'firstName':_0x1d1bef[_0x2bde('0x20')]['from'],'ListId':_0x38c4df[_0x2bde('0x2b')]});_0x146cbe[_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2f')]]=_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x2d')];return db[_0x2bde('0x40')]['create'](_0x146cbe,{'fields':_0x30f564,'raw':!![]});}})[_0x2bde('0x22')](function(_0x3d4dfb){_0x506027[_0x2bde('0x41')]=_0x3d4dfb;if(_0x3d4dfb){var _0x1f5302={'ContactId':_0x3d4dfb['id'],'FaxAccountId':_0x1d1bef[_0x2bde('0x33')]['id'],'fax':_0x3d4dfb['fax']};return db['FaxInteraction'][_0x2bde('0x32')]({'where':{'ContactId':_0x3d4dfb['id'],'closed':![],'FaxAccountId':_0x1d1bef[_0x2bde('0x33')]['id']}})[_0x2bde('0x22')](function(_0x4f761a){if(_0x4f761a){return[_0x4f761a,![]];}return db['FaxInteraction'][_0x2bde('0x42')](_0x1f5302)[_0x2bde('0x22')](function(_0x3a7ecb){return[_0x3a7ecb,!![]];});});}else{throw new Error(_0x2bde('0x43'));}})[_0x2bde('0x44')](function(_0x4562b4,_0x523dcf){var _0x4a1f95=_0x4562b4[_0x2bde('0x37')]({'plain':!![]});if(_0x523dcf){if(_0x506027[_0x2bde('0x33')][_0x2bde('0x45')]){_0x506027[_0x2bde('0x38')][_0x2bde('0x46')]({'id':0x0,'priority':_0x506027['applications']['length']+0x1,'app':_0x2bde('0x47'),'appdata':_0x2bde('0x48'),'interval':'*,*,*,*'});}_0x4a1f95['created']=!![];}else{_0x4a1f95[_0x2bde('0x49')]=![];}_0x506027[_0x2bde('0x4a')]=_0x4a1f95;return db[_0x2bde('0x4b')]['create']({'body':_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x20')],'FaxAccountId':_0x1d1bef[_0x2bde('0x33')]['id'],'FaxInteractionId':_0x4562b4['id'],'direction':'in','ContactId':_0x4562b4[_0x2bde('0x4c')],'AttachmentId':_0x1d1bef[_0x2bde('0x20')][_0x2bde('0x4d')]});})[_0x2bde('0x22')](function(_0x222108){_0x506027[_0x2bde('0x14')]=_0x222108;if(!_0x506027[_0x2bde('0x4a')][_0x2bde('0x4e')])return;return db[_0x2bde('0x4f')]['find']({'attributes':['id',_0x2bde('0x50')],'where':{'id':_0x506027[_0x2bde('0x4a')]['UserId']}});})[_0x2bde('0x22')](function(_0xb59c4e){if(_0xb59c4e){_0x506027['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x2bde('0x51'),'appdata':_0xb59c4e[_0x2bde('0x50')]+','+(_0x506027['account'][_0x2bde('0x52')]||0xa),'interval':_0x2bde('0x53')});}if(!_0x506027[_0x2bde('0x4a')][_0x2bde('0x54')])return;return db['FaxQueue'][_0x2bde('0x32')]({'attributes':['id','name'],'where':{'id':_0x506027[_0x2bde('0x4a')][_0x2bde('0x54')]}});})[_0x2bde('0x22')](function(_0x5d57d5){if(_0x5d57d5){_0x506027['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0x2bde('0x55'),'appdata':_0x5d57d5[_0x2bde('0x50')]+','+(_0x506027[_0x2bde('0x33')][_0x2bde('0x56')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x2bde('0x57'),_0x2bde('0x58'),_0x506027);})[_0x2bde('0x22')](function(_0x488472){_0x221930(_0x488472);})[_0x2bde('0x16')](function(_0x2b827e){_0x376169(_0x408ebb[_0x2bde('0x11')](0x1f4,_0x2b827e[_0x2bde('0x14')]));});});}; \ No newline at end of file +var _0xfd86=['Contact\x20not\x20found','spread','autoclose','push','close','unmanaged','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','unshift','agent','queueId','name','waitForTheAssignedQueue','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','raw','options','where','attributes','limit','include','map','model','NotifyFaxAccount','body','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','keys','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','DESC','FaxApplication','Applications','get','applications','list','orderBy','priority','asc','Contacts','length','contact','fax','FaxInteraction','find','create'];(function(_0x498334,_0x27b6fe){var _0x13bb70=function(_0x4087b1){while(--_0x4087b1){_0x498334['push'](_0x498334['shift']());}};_0x13bb70(++_0x27b6fe);}(_0xfd86,0x194));var _0x6fd8=function(_0xccf869,_0x2556a5){_0xccf869=_0xccf869-0x0;var _0x21a9db=_0xfd86[_0xccf869];return _0x21a9db;};'use strict';var _=require(_0x6fd8('0x0'));var util=require(_0x6fd8('0x1'));var moment=require(_0x6fd8('0x2'));var BPromise=require(_0x6fd8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6fd8('0x4'));var db=require(_0x6fd8('0x5'))['db'];var utils=require(_0x6fd8('0x6'));var logger=require('../../config/logger')(_0x6fd8('0x7'));var config=require('../../config/environment');var jayson=require(_0x6fd8('0x8'));var client=jayson['client']['http']({'port':0x232c});config[_0x6fd8('0x9')]=_[_0x6fd8('0xa')](config['redis'],{'host':_0x6fd8('0xb'),'port':0x18eb});var socket=require(_0x6fd8('0xc'))(new Redis(config['redis']));require(_0x6fd8('0xd'))[_0x6fd8('0xe')](socket);function respondWithRpcPromise(_0x5f58a8,_0x53abc2,_0x40be00){return new BPromise(function(_0x135944,_0x5176a8){return client[_0x6fd8('0xf')](_0x5f58a8,_0x40be00)[_0x6fd8('0x10')](function(_0x154ec4){logger[_0x6fd8('0x11')](_0x6fd8('0x12'),_0x53abc2,'request\x20sent');logger[_0x6fd8('0x13')](_0x6fd8('0x14'),_0x53abc2,'request\x20sent',JSON[_0x6fd8('0x15')](_0x154ec4));if(_0x154ec4[_0x6fd8('0x16')]){if(_0x154ec4[_0x6fd8('0x16')][_0x6fd8('0x17')]===0x1f4){logger[_0x6fd8('0x16')](_0x6fd8('0x12'),_0x53abc2,_0x154ec4['error'][_0x6fd8('0x18')]);return _0x5176a8(_0x154ec4[_0x6fd8('0x16')][_0x6fd8('0x18')]);}logger[_0x6fd8('0x16')]('FaxAccount,\x20%s,\x20%s',_0x53abc2,_0x154ec4[_0x6fd8('0x16')][_0x6fd8('0x18')]);return _0x135944(_0x154ec4['error'][_0x6fd8('0x18')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x53abc2,_0x6fd8('0x19'));_0x135944(_0x154ec4[_0x6fd8('0x1a')]['message']);}})[_0x6fd8('0x1b')](function(_0xce1da4){logger[_0x6fd8('0x16')]('FaxAccount,\x20%s,\x20%s',_0x53abc2,_0xce1da4);_0x5176a8(_0xce1da4);});});}exports[_0x6fd8('0x1c')]=function(_0x7a9e72){var _0x503781=this;return new Promise(function(_0x328ca9,_0x3f5166){return db[_0x6fd8('0x1d')]['findAll']({'raw':_0x7a9e72['options']?_0x7a9e72['options'][_0x6fd8('0x1e')]===undefined?!![]:![]:!![],'where':_0x7a9e72['options']?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x20')]||null:null,'attributes':_0x7a9e72[_0x6fd8('0x1f')]?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x21')]||null:null,'limit':_0x7a9e72['options']?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x22')]||null:null,'include':_0x7a9e72[_0x6fd8('0x1f')]?_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x23')]?_[_0x6fd8('0x24')](_0x7a9e72[_0x6fd8('0x1f')][_0x6fd8('0x23')],function(_0x9b758e){return{'model':db[_0x9b758e[_0x6fd8('0x25')]],'as':_0x9b758e['as'],'attributes':_0x9b758e[_0x6fd8('0x21')],'include':_0x9b758e[_0x6fd8('0x23')]?_[_0x6fd8('0x24')](_0x9b758e[_0x6fd8('0x23')],function(_0x5cf478){return{'model':db[_0x5cf478[_0x6fd8('0x25')]],'as':_0x5cf478['as'],'attributes':_0x5cf478[_0x6fd8('0x21')],'include':_0x5cf478[_0x6fd8('0x23')]?_[_0x6fd8('0x24')](_0x5cf478[_0x6fd8('0x23')],function(_0x1cad0a){return{'model':db[_0x1cad0a[_0x6fd8('0x25')]],'as':_0x1cad0a['as'],'attributes':_0x1cad0a[_0x6fd8('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5bc437){logger['info'](_0x6fd8('0x1c'),_0x7a9e72);logger[_0x6fd8('0x13')](_0x6fd8('0x1c'),_0x7a9e72,JSON['stringify'](_0x5bc437));_0x328ca9(_0x5bc437);})['catch'](function(_0x187086){logger[_0x6fd8('0x16')]('GetFaxAccount',_0x187086[_0x6fd8('0x18')],_0x7a9e72);_0x3f5166(_0x503781[_0x6fd8('0x16')](0x1f4,_0x187086['message']));});});};exports[_0x6fd8('0x26')]=function(_0x130bed,_0x12e361,_0x3b1900){var _0x323beb=this;return new Promise(function(_0x28d49f,_0x5dfb){var _0x1537df={'body':_0x130bed[_0x6fd8('0x27')],'channel':'fax'};var _0x178350=[];var _0x429b25=[];var _0x59225b={};return db[_0x6fd8('0x28')][_0x6fd8('0x29')]()[_0x6fd8('0x10')](function(_0x26c97d){if(!_0x26c97d){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))](_0x6fd8('0x2c'));}_0x178350=_[_0x6fd8('0x2d')](_['keys'](_0x26c97d),[_0x6fd8('0x2e'),_0x6fd8('0x2f')]);_0x429b25=_[_0x6fd8('0x2d')](_[_0x6fd8('0x30')](_0x26c97d),[_0x6fd8('0x2e'),'updatedAt',_0x6fd8('0x31'),_0x6fd8('0x32')]);if(_0x130bed[_0x6fd8('0x27')]['id']){delete _0x130bed[_0x6fd8('0x27')]['id'];}if(_[_0x6fd8('0x33')](_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x34')])){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))](_0x6fd8('0x35'));}if(_['isNil'](_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x27')])||_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x27')]===''){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x6fd8('0x33')](_0x130bed['body'][_0x6fd8('0x36')])){throw new db['Sequelize'][(_0x6fd8('0x2b'))](_0x6fd8('0x37')+_0x429b25);}if(!_['includes'](_0x429b25,_0x130bed[_0x6fd8('0x27')]['mapKey'])){throw new db[(_0x6fd8('0x2a'))][(_0x6fd8('0x2b'))](_0x6fd8('0x38')+_0x429b25);}_0x59225b[_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x36')]]=_0x130bed['body'][_0x6fd8('0x34')];})['then'](function(){return db[_0x6fd8('0x1d')]['find']({'where':{'id':_0x130bed[_0x6fd8('0x39')]['id']},'include':[{'model':db[_0x6fd8('0x3a')],'as':_0x6fd8('0x3b'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x59225b,'limit':0x1,'order':[[_0x6fd8('0x2f'),_0x6fd8('0x3c')]]}]},{'model':db[_0x6fd8('0x3d')],'as':_0x6fd8('0x3e')}]});})['then'](function(_0x3f7d99){if(_0x3f7d99&&_0x3f7d99[_0x6fd8('0x3b')]){var _0x5e0d2b=_0x3f7d99[_0x6fd8('0x3f')]({'plain':!![]});_0x1537df['account']=_0x5e0d2b;_0x1537df[_0x6fd8('0x40')]=_0x5e0d2b[_0x6fd8('0x3e')];_0x1537df[_0x6fd8('0x41')]=_0x5e0d2b['List'];_0x1537df[_0x6fd8('0x40')]=_[_0x6fd8('0x42')](_0x1537df[_0x6fd8('0x40')],[_0x6fd8('0x43')],[_0x6fd8('0x44')]);if(_0x1537df[_0x6fd8('0x39')]['Applications']){delete _0x1537df[_0x6fd8('0x39')][_0x6fd8('0x3e')];}if(_0x1537df['account'][_0x6fd8('0x3b')]&&_0x1537df['account']['List'][_0x6fd8('0x45')][_0x6fd8('0x46')]){return _0x1537df[_0x6fd8('0x39')][_0x6fd8('0x3b')][_0x6fd8('0x45')][0x0];}var _0x494d54=_[_0x6fd8('0xa')](_0x130bed['body'],{'firstName':_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x34')],'ListId':_0x5e0d2b[_0x6fd8('0x32')]});_0x494d54[_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x36')]]=_0x130bed[_0x6fd8('0x27')]['from'];return db[_0x6fd8('0x28')]['create'](_0x494d54,{'fields':_0x178350,'raw':!![]});}})[_0x6fd8('0x10')](function(_0x3f0ca8){_0x1537df[_0x6fd8('0x47')]=_0x3f0ca8;if(_0x3f0ca8){var _0x3ffaab={'ContactId':_0x3f0ca8['id'],'FaxAccountId':_0x130bed[_0x6fd8('0x39')]['id'],'fax':_0x3f0ca8[_0x6fd8('0x48')]};return db[_0x6fd8('0x49')][_0x6fd8('0x4a')]({'where':{'ContactId':_0x3f0ca8['id'],'closed':![],'FaxAccountId':_0x130bed['account']['id']}})[_0x6fd8('0x10')](function(_0x55aed0){if(_0x55aed0){return[_0x55aed0,![]];}return db['FaxInteraction'][_0x6fd8('0x4b')](_0x3ffaab)[_0x6fd8('0x10')](function(_0x3c16f7){return[_0x3c16f7,!![]];});});}else{throw new Error(_0x6fd8('0x4c'));}})[_0x6fd8('0x4d')](function(_0x3b0949,_0x4a0071){var _0x38660a=_0x3b0949['get']({'plain':!![]});if(_0x4a0071){if(_0x1537df[_0x6fd8('0x39')][_0x6fd8('0x4e')]){_0x1537df[_0x6fd8('0x40')][_0x6fd8('0x4f')]({'id':0x0,'priority':_0x1537df[_0x6fd8('0x40')]['length']+0x1,'app':_0x6fd8('0x50'),'appdata':_0x6fd8('0x51'),'interval':_0x6fd8('0x52')});}_0x38660a[_0x6fd8('0x53')]=!![];}else{_0x38660a[_0x6fd8('0x53')]=![];}_0x1537df[_0x6fd8('0x54')]=_0x38660a;return db['FaxMessage'][_0x6fd8('0x4b')]({'body':_0x130bed[_0x6fd8('0x27')]['body'],'FaxAccountId':_0x130bed[_0x6fd8('0x39')]['id'],'FaxInteractionId':_0x3b0949['id'],'direction':'in','ContactId':_0x3b0949[_0x6fd8('0x55')],'AttachmentId':_0x130bed[_0x6fd8('0x27')][_0x6fd8('0x56')]});})[_0x6fd8('0x10')](function(_0x31e037){_0x1537df['message']=_0x31e037;if(!_0x1537df[_0x6fd8('0x54')][_0x6fd8('0x57')])return;return db[_0x6fd8('0x58')][_0x6fd8('0x4a')]({'attributes':['id','name'],'where':{'id':_0x1537df[_0x6fd8('0x54')][_0x6fd8('0x57')]}});})[_0x6fd8('0x10')](function(_0x458385){if(_0x458385){_0x1537df['applications'][_0x6fd8('0x59')]({'id':0x0,'priority':0x0,'app':_0x6fd8('0x5a'),'appdata':_0x458385['name']+','+(_0x1537df[_0x6fd8('0x39')]['waitForTheAssignedAgent']||0xa),'interval':_0x6fd8('0x52')});}if(!_0x1537df['interaction'][_0x6fd8('0x5b')])return;return db['FaxQueue'][_0x6fd8('0x4a')]({'attributes':['id',_0x6fd8('0x5c')],'where':{'id':_0x1537df[_0x6fd8('0x54')][_0x6fd8('0x5b')]}});})[_0x6fd8('0x10')](function(_0x1250cf){if(_0x1250cf){_0x1537df[_0x6fd8('0x40')][_0x6fd8('0x59')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x1250cf['name']+','+(_0x1537df[_0x6fd8('0x39')][_0x6fd8('0x5d')]||0x12c),'interval':_0x6fd8('0x52')});}return respondWithRpcPromise(_0x6fd8('0x5e'),_0x6fd8('0x5f'),_0x1537df);})[_0x6fd8('0x10')](function(_0x436cbe){_0x28d49f(_0x436cbe);})[_0x6fd8('0x1b')](function(_0x344c8f){_0x5dfb(_0x323beb[_0x6fd8('0x16')](0x1f4,_0x344c8f[_0x6fd8('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 9d6d60c..12f80ad 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 _0x4817=['faxAccount:','./faxAccount.events','remove','update','removeListener','register'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0x4817,0xaf));var _0x7481=function(_0x18b255,_0x24442d){_0x18b255=_0x18b255-0x0;var _0x363ca9=_0x4817[_0x18b255];return _0x363ca9;};'use strict';var FaxAccountEvents=require(_0x7481('0x0'));var events=['save',_0x7481('0x1'),_0x7481('0x2')];function createListener(_0x36504f,_0x4bfbeb){return function(_0x16472c){_0x4bfbeb['emit'](_0x36504f,_0x16472c);};}function removeListener(_0x4905f9,_0x4c94fe){return function(){FaxAccountEvents[_0x7481('0x3')](_0x4905f9,_0x4c94fe);};}exports[_0x7481('0x4')]=function(_0x433d3a){for(var _0x401df6=0x0,_0x2e8d36=events['length'];_0x401df6<_0x2e8d36;_0x401df6++){var _0x250990=events[_0x401df6];var _0x5c0167=createListener(_0x7481('0x5')+_0x250990,_0x433d3a);FaxAccountEvents['on'](_0x250990,_0x5c0167);}}; \ No newline at end of file +var _0xe0b2=['emit','removeListener','length','./faxAccount.events','save','remove','update'];(function(_0x29a134,_0x194c27){var _0x136398=function(_0x1def82){while(--_0x1def82){_0x29a134['push'](_0x29a134['shift']());}};_0x136398(++_0x194c27);}(_0xe0b2,0xff));var _0x2e0b=function(_0x5166cb,_0x32da82){_0x5166cb=_0x5166cb-0x0;var _0x5dd083=_0xe0b2[_0x5166cb];return _0x5dd083;};'use strict';var FaxAccountEvents=require(_0x2e0b('0x0'));var events=[_0x2e0b('0x1'),_0x2e0b('0x2'),_0x2e0b('0x3')];function createListener(_0x669bf0,_0x51bae1){return function(_0x4c7248){_0x51bae1[_0x2e0b('0x4')](_0x669bf0,_0x4c7248);};}function removeListener(_0x59819e,_0x5467f0){return function(){FaxAccountEvents[_0x2e0b('0x5')](_0x59819e,_0x5467f0);};}exports['register']=function(_0x5aac39){for(var _0x59b271=0x0,_0x21e9c4=events[_0x2e0b('0x6')];_0x59b271<_0x21e9c4;_0x59b271++){var _0x48bb7=events[_0x59b271];var _0x5bd8f9=createListener('faxAccount:'+_0x48bb7,_0x5aac39);FaxAccountEvents['on'](_0x48bb7,_0x5bd8f9);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 2d335a7..fc8438c 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 _0xbed5=['../../components/auth/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getMessages','getAgents','post','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express'];(function(_0x1a1269,_0x4d8e3c){var _0xe0e23f=function(_0x24cf66){while(--_0x24cf66){_0x1a1269['push'](_0x1a1269['shift']());}};_0xe0e23f(++_0x4d8e3c);}(_0xbed5,0x16e));var _0x5bed=function(_0x1b6b20,_0x3bc526){_0x1b6b20=_0x1b6b20-0x0;var _0x132558=_0xbed5[_0x1b6b20];return _0x132558;};'use strict';var multer=require('multer');var util=require(_0x5bed('0x0'));var path=require(_0x5bed('0x1'));var timeout=require(_0x5bed('0x2'));var express=require(_0x5bed('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5bed('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5bed('0x5'));var controller=require(_0x5bed('0x6'));router[_0x5bed('0x7')]('/',auth[_0x5bed('0x8')](),controller[_0x5bed('0x9')]);router['get']('/describe',auth[_0x5bed('0x8')](),controller[_0x5bed('0xa')]);router[_0x5bed('0x7')](_0x5bed('0xb'),auth[_0x5bed('0x8')](),controller[_0x5bed('0xc')]);router[_0x5bed('0x7')](_0x5bed('0xd'),auth['isAuthenticated'](),controller[_0x5bed('0xe')]);router[_0x5bed('0x7')](_0x5bed('0xf'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x10')]);router[_0x5bed('0x7')](_0x5bed('0x11'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x12')]);router[_0x5bed('0x7')](_0x5bed('0x13'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x14')]);router[_0x5bed('0x7')](_0x5bed('0x15'),auth['isAuthenticated'](),controller[_0x5bed('0x16')]);router['get']('/:id/users',auth[_0x5bed('0x8')](),controller[_0x5bed('0x17')]);router[_0x5bed('0x18')]('/',auth[_0x5bed('0x8')](),controller['create']);router[_0x5bed('0x18')](_0x5bed('0xd'),auth[_0x5bed('0x8')](),controller['addDisposition']);router[_0x5bed('0x18')](_0x5bed('0xf'),auth[_0x5bed('0x8')](),controller['addAnswer']);router[_0x5bed('0x18')]('/:id/interactions',auth[_0x5bed('0x8')](),controller['addInteraction']);router[_0x5bed('0x18')](_0x5bed('0x13'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x19')]);router[_0x5bed('0x18')]('/addaccountapplications',auth[_0x5bed('0x8')](),controller[_0x5bed('0x1a')]);router[_0x5bed('0x18')](_0x5bed('0x1b'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x1c')]);router[_0x5bed('0x18')](_0x5bed('0x1d'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x1e')]);router[_0x5bed('0x18')](_0x5bed('0x1f'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x20')]);router['put'](_0x5bed('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x5bed('0x21')]('/:id',auth[_0x5bed('0x8')](),controller['destroy']);router[_0x5bed('0x21')](_0x5bed('0xd'),auth[_0x5bed('0x8')](),controller[_0x5bed('0x22')]);router[_0x5bed('0x21')]('/:id/canned_answers',auth[_0x5bed('0x8')](),controller[_0x5bed('0x23')]);router[_0x5bed('0x21')](_0x5bed('0x1f'),auth[_0x5bed('0x8')](),controller['removeAgents']);module[_0x5bed('0x24')]=router; \ No newline at end of file +var _0x2856=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','getMessages','/:id/users','getAgents','post','create','addDisposition','addInteraction','/:id/applications','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','put','update','delete','destroy','removeAnswers','removeAgents'];(function(_0x2d1d2c,_0x23f59a){var _0x3ca6f6=function(_0x2ed0ef){while(--_0x2ed0ef){_0x2d1d2c['push'](_0x2d1d2c['shift']());}};_0x3ca6f6(++_0x23f59a);}(_0x2856,0x1b9));var _0x6285=function(_0x4ad720,_0x5e8523){_0x4ad720=_0x4ad720-0x0;var _0x30f9de=_0x2856[_0x4ad720];return _0x30f9de;};'use strict';var multer=require(_0x6285('0x0'));var util=require(_0x6285('0x1'));var path=require(_0x6285('0x2'));var timeout=require(_0x6285('0x3'));var express=require(_0x6285('0x4'));var router=express[_0x6285('0x5')]();var fs_extra=require(_0x6285('0x6'));var auth=require(_0x6285('0x7'));var interaction=require(_0x6285('0x8'));var config=require('../../config/environment');var controller=require(_0x6285('0x9'));router[_0x6285('0xa')]('/',auth[_0x6285('0xb')](),controller['index']);router[_0x6285('0xa')](_0x6285('0xc'),auth[_0x6285('0xb')](),controller[_0x6285('0xd')]);router[_0x6285('0xa')](_0x6285('0xe'),auth[_0x6285('0xb')](),controller[_0x6285('0xf')]);router[_0x6285('0xa')](_0x6285('0x10'),auth['isAuthenticated'](),controller[_0x6285('0x11')]);router[_0x6285('0xa')](_0x6285('0x12'),auth['isAuthenticated'](),controller[_0x6285('0x13')]);router[_0x6285('0xa')](_0x6285('0x14'),auth[_0x6285('0xb')](),controller[_0x6285('0x15')]);router[_0x6285('0xa')]('/:id/applications',auth['isAuthenticated'](),controller[_0x6285('0x16')]);router['get']('/:id/messages',auth[_0x6285('0xb')](),controller[_0x6285('0x17')]);router[_0x6285('0xa')](_0x6285('0x18'),auth[_0x6285('0xb')](),controller[_0x6285('0x19')]);router[_0x6285('0x1a')]('/',auth[_0x6285('0xb')](),controller[_0x6285('0x1b')]);router[_0x6285('0x1a')](_0x6285('0x10'),auth['isAuthenticated'](),controller[_0x6285('0x1c')]);router[_0x6285('0x1a')](_0x6285('0x12'),auth[_0x6285('0xb')](),controller['addAnswer']);router[_0x6285('0x1a')]('/:id/interactions',auth[_0x6285('0xb')](),controller[_0x6285('0x1d')]);router[_0x6285('0x1a')](_0x6285('0x1e'),auth[_0x6285('0xb')](),controller[_0x6285('0x1f')]);router[_0x6285('0x1a')]('/addaccountapplications',auth[_0x6285('0xb')](),controller[_0x6285('0x20')]);router[_0x6285('0x1a')](_0x6285('0x21'),auth[_0x6285('0xb')](),controller[_0x6285('0x22')]);router[_0x6285('0x1a')](_0x6285('0x23'),auth[_0x6285('0xb')](),controller[_0x6285('0x24')]);router['post'](_0x6285('0x18'),auth['isAuthenticated'](),controller['addAgents']);router[_0x6285('0x25')](_0x6285('0xe'),auth[_0x6285('0xb')](),controller[_0x6285('0x26')]);router[_0x6285('0x27')](_0x6285('0xe'),auth[_0x6285('0xb')](),controller[_0x6285('0x28')]);router[_0x6285('0x27')](_0x6285('0x10'),auth[_0x6285('0xb')](),controller['removeDispositions']);router['delete'](_0x6285('0x12'),auth[_0x6285('0xb')](),controller[_0x6285('0x29')]);router[_0x6285('0x27')](_0x6285('0x18'),auth['isAuthenticated'](),controller[_0x6285('0x2a')]);module[_0x6285('0x2b')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 8802ae2..4bda443 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 _0xde82=['noop','TEXT','*,*,*,*','exports','STRING'];(function(_0x2c4ab5,_0x41a982){var _0x5b8a25=function(_0x15741a){while(--_0x15741a){_0x2c4ab5['push'](_0x2c4ab5['shift']());}};_0x5b8a25(++_0x41a982);}(_0xde82,0xad));var _0x2de8=function(_0x158ea9,_0x56b2ec){_0x158ea9=_0x158ea9-0x0;var _0x52eff7=_0xde82[_0x158ea9];return _0x52eff7;};'use strict';var Sequelize=require('sequelize');module[_0x2de8('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2de8('0x1')],'allowNull':![],'defaultValue':_0x2de8('0x2')},'appdata':{'type':Sequelize[_0x2de8('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2de8('0x1')],'defaultValue':_0x2de8('0x4')}}; \ No newline at end of file +var _0xba88=['STRING','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xba88,0xed));var _0x8ba8=function(_0x2518b8,_0x1f7c6b){_0x2518b8=_0x2518b8-0x0;var _0x287276=_0xba88[_0x2518b8];return _0x287276;};'use strict';var Sequelize=require(_0x8ba8('0x0'));module[_0x8ba8('0x1')]={'priority':{'type':Sequelize[_0x8ba8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x8ba8('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x8ba8('0x4')]()},'description':{'type':Sequelize[_0x8ba8('0x3')]},'interval':{'type':Sequelize[_0x8ba8('0x3')],'defaultValue':_0x8ba8('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index f8184c1..fdd4880 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 _0x7663=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','end','sendStatus','stack','name','index','map','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','options','FaxApplication','include','findAll','then','show','params','rawAttributes','keys','length','merge','catch','create','body','find','eml-format','rimraf','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x57895d,_0x147d6c){var _0x41849e=function(_0x1e9bd8){while(--_0x1e9bd8){_0x57895d['push'](_0x57895d['shift']());}};_0x41849e(++_0x147d6c);}(_0x7663,0x1ef));var _0x3766=function(_0x363700,_0x1a61bd){_0x363700=_0x363700-0x0;var _0x451130=_0x7663[_0x363700];return _0x451130;};'use strict';var emlformat=require(_0x3766('0x0'));var rimraf=require(_0x3766('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3766('0x2'));var moment=require('moment');var BPromise=require(_0x3766('0x3'));var Mustache=require('mustache');var util=require(_0x3766('0x4'));var path=require('path');var sox=require(_0x3766('0x5'));var csv=require('to-csv');var ejs=require(_0x3766('0x6'));var fs=require('fs');var fs_extra=require(_0x3766('0x7'));var _=require(_0x3766('0x8'));var squel=require(_0x3766('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3766('0xa'));var toCsv=require(_0x3766('0xb'));var querystring=require(_0x3766('0xc'));var Papa=require(_0x3766('0xd'));var Redis=require(_0x3766('0xe'));var authService=require(_0x3766('0xf'));var qs=require(_0x3766('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3766('0x11'));var logger=require(_0x3766('0x12'))(_0x3766('0x13'));var utils=require(_0x3766('0x14'));var config=require(_0x3766('0x15'));var licenseUtil=require(_0x3766('0x16'));var db=require(_0x3766('0x17'))['db'];function respondWithStatusCode(_0x57bf02,_0x270633){_0x270633=_0x270633||0xcc;return function(_0x2b8a42){if(_0x2b8a42){return _0x57bf02['sendStatus'](_0x270633);}return _0x57bf02[_0x3766('0x18')](_0x270633)['end']();};}function respondWithResult(_0x51445e,_0x3d02ba){_0x3d02ba=_0x3d02ba||0xc8;return function(_0x2f56fe){if(_0x2f56fe){return _0x51445e[_0x3766('0x18')](_0x3d02ba)[_0x3766('0x19')](_0x2f56fe);}};}function respondWithFilteredResult(_0x110f4b,_0x28c07a){return function(_0x517aa9){if(_0x517aa9){var _0x3746e6=typeof _0x28c07a[_0x3766('0x1a')]==='undefined'&&typeof _0x28c07a[_0x3766('0x1b')]===_0x3766('0x1c');var _0x3aa152=_0x517aa9[_0x3766('0x1d')];var _0x1dbf20=_0x3746e6?0x0:_0x28c07a['offset'];var _0x45738f=_0x3746e6?_0x517aa9['count']:_0x28c07a[_0x3766('0x1a')]+_0x28c07a[_0x3766('0x1b')];var _0x3f9ef7;if(_0x45738f>=_0x3aa152){_0x45738f=_0x3aa152;_0x3f9ef7=0xc8;}else{_0x3f9ef7=0xce;}_0x110f4b[_0x3766('0x18')](_0x3f9ef7);return _0x110f4b[_0x3766('0x1e')](_0x3766('0x1f'),_0x1dbf20+'-'+_0x45738f+'/'+_0x3aa152)['json'](_0x517aa9);}return null;};}function patchUpdates(_0x295342){return function(_0x4c7c17){try{jsonpatch[_0x3766('0x20')](_0x4c7c17,_0x295342,!![]);}catch(_0x39be84){return BPromise[_0x3766('0x21')](_0x39be84);}return _0x4c7c17[_0x3766('0x22')]();};}function saveUpdates(_0x434b33,_0x298f88){return function(_0x5d0856){if(_0x5d0856){return _0x5d0856[_0x3766('0x23')](_0x434b33)['then'](function(_0x5d0e19){return _0x5d0e19;});}return null;};}function removeEntity(_0xddc753,_0x7b751f){return function(_0x2a90c4){if(_0x2a90c4){return _0x2a90c4[_0x3766('0x24')]()['then'](function(){_0xddc753[_0x3766('0x18')](0xcc)[_0x3766('0x25')]();});}};}function handleEntityNotFound(_0x3c868a,_0x3b36bf){return function(_0x2ee431){if(!_0x2ee431){_0x3c868a[_0x3766('0x26')](0x194);}return _0x2ee431;};}function handleError(_0x3fd61b,_0x401f81){_0x401f81=_0x401f81||0x1f4;return function(_0x74b1c0){logger['error'](_0x74b1c0[_0x3766('0x27')]);if(_0x74b1c0[_0x3766('0x28')]){delete _0x74b1c0[_0x3766('0x28')];}_0x3fd61b[_0x3766('0x18')](_0x401f81)['send'](_0x74b1c0);};}exports[_0x3766('0x29')]=function(_0x32d5b3,_0x2e61c2){var _0x4a1e68={},_0x56e37f={},_0x96c23e={'count':0x0,'rows':[]};var _0x236e97=_[_0x3766('0x2a')](db['FaxApplication']['rawAttributes'],function(_0x51fb65){return{'name':_0x51fb65['fieldName'],'type':_0x51fb65[_0x3766('0x2b')][_0x3766('0x2c')]};});_0x56e37f[_0x3766('0x2d')]=_[_0x3766('0x2a')](_0x236e97,_0x3766('0x28'));_0x56e37f[_0x3766('0x2e')]=_['keys'](_0x32d5b3['query']);_0x56e37f[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x56e37f[_0x3766('0x2d')],_0x56e37f[_0x3766('0x2e')]);_0x4a1e68[_0x3766('0x31')]=_[_0x3766('0x30')](_0x56e37f[_0x3766('0x2d')],qs[_0x3766('0x32')](_0x32d5b3[_0x3766('0x2e')][_0x3766('0x32')]));_0x4a1e68[_0x3766('0x31')]=_0x4a1e68[_0x3766('0x31')]['length']?_0x4a1e68[_0x3766('0x31')]:_0x56e37f['model'];if(!_0x32d5b3['query']['hasOwnProperty'](_0x3766('0x33'))){_0x4a1e68[_0x3766('0x1b')]=qs[_0x3766('0x1b')](_0x32d5b3[_0x3766('0x2e')][_0x3766('0x1b')]);_0x4a1e68['offset']=qs[_0x3766('0x1a')](_0x32d5b3[_0x3766('0x2e')][_0x3766('0x1a')]);}_0x4a1e68[_0x3766('0x34')]=qs[_0x3766('0x35')](_0x32d5b3[_0x3766('0x2e')]['sort']);_0x4a1e68[_0x3766('0x36')]=qs[_0x3766('0x2f')](_[_0x3766('0x37')](_0x32d5b3[_0x3766('0x2e')],_0x56e37f['filters']),_0x236e97);if(_0x32d5b3['query'][_0x3766('0x38')]){_0x4a1e68[_0x3766('0x36')]=_['merge'](_0x4a1e68[_0x3766('0x36')],{'$or':_['map'](_0x236e97,function(_0x1d96d3){if(_0x1d96d3['type']!==_0x3766('0x39')){var _0x11c13b={};_0x11c13b[_0x1d96d3[_0x3766('0x28')]]={'$like':'%'+_0x32d5b3[_0x3766('0x2e')][_0x3766('0x38')]+'%'};return _0x11c13b;}})});}_0x4a1e68=_['merge']({},_0x4a1e68,_0x32d5b3[_0x3766('0x3a')]);var _0x11ac5e={'where':_0x4a1e68['where']};return db[_0x3766('0x3b')][_0x3766('0x1d')](_0x11ac5e)['then'](function(_0x4bf685){_0x96c23e['count']=_0x4bf685;if(_0x32d5b3['query']['includeAll']){_0x4a1e68[_0x3766('0x3c')]=[{'all':!![]}];}return db[_0x3766('0x3b')][_0x3766('0x3d')](_0x4a1e68);})[_0x3766('0x3e')](function(_0xa26eb6){_0x96c23e['rows']=_0xa26eb6;return _0x96c23e;})[_0x3766('0x3e')](respondWithFilteredResult(_0x2e61c2,_0x4a1e68))['catch'](handleError(_0x2e61c2,null));};exports[_0x3766('0x3f')]=function(_0x4c7570,_0x54a8eb){var _0x6179e6={'raw':!![],'where':{'id':_0x4c7570[_0x3766('0x40')]['id']}},_0x2b9f48={};_0x2b9f48['model']=_['keys'](db[_0x3766('0x3b')][_0x3766('0x41')]);_0x2b9f48['query']=_[_0x3766('0x42')](_0x4c7570['query']);_0x2b9f48[_0x3766('0x2f')]=_[_0x3766('0x30')](_0x2b9f48[_0x3766('0x2d')],_0x2b9f48['query']);_0x6179e6['attributes']=_[_0x3766('0x30')](_0x2b9f48[_0x3766('0x2d')],qs[_0x3766('0x32')](_0x4c7570[_0x3766('0x2e')][_0x3766('0x32')]));_0x6179e6[_0x3766('0x31')]=_0x6179e6[_0x3766('0x31')][_0x3766('0x43')]?_0x6179e6['attributes']:_0x2b9f48[_0x3766('0x2d')];if(_0x4c7570[_0x3766('0x2e')]['includeAll']){_0x6179e6[_0x3766('0x3c')]=[{'all':!![]}];}_0x6179e6=_[_0x3766('0x44')]({},_0x6179e6,_0x4c7570['options']);return db[_0x3766('0x3b')]['find'](_0x6179e6)['then'](handleEntityNotFound(_0x54a8eb,null))['then'](respondWithResult(_0x54a8eb,null))[_0x3766('0x45')](handleError(_0x54a8eb,null));};exports[_0x3766('0x46')]=function(_0x435230,_0x37e8d9){return db[_0x3766('0x3b')][_0x3766('0x46')](_0x435230['body'],{})['then'](respondWithResult(_0x37e8d9,0xc9))[_0x3766('0x45')](handleError(_0x37e8d9,null));};exports[_0x3766('0x23')]=function(_0x5661cf,_0x3d3a50){if(_0x5661cf[_0x3766('0x47')]['id']){delete _0x5661cf[_0x3766('0x47')]['id'];}return db[_0x3766('0x3b')][_0x3766('0x48')]({'where':{'id':_0x5661cf[_0x3766('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d3a50,null))[_0x3766('0x3e')](saveUpdates(_0x5661cf[_0x3766('0x47')],null))[_0x3766('0x3e')](respondWithResult(_0x3d3a50,null))[_0x3766('0x45')](handleError(_0x3d3a50,null));};exports[_0x3766('0x24')]=function(_0x248180,_0x120088){return db[_0x3766('0x3b')][_0x3766('0x48')]({'where':{'id':_0x248180[_0x3766('0x40')]['id']}})[_0x3766('0x3e')](handleEntityNotFound(_0x120088,null))[_0x3766('0x3e')](removeEntity(_0x120088,null))[_0x3766('0x45')](handleError(_0x120088,null));}; \ No newline at end of file +var _0xb695=['catch','show','keys','rawAttributes','options','create','body','find','params','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','index','map','FaxApplication','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','include','rows'];(function(_0x1cbfc8,_0x533fe9){var _0x18a825=function(_0x2868d6){while(--_0x2868d6){_0x1cbfc8['push'](_0x1cbfc8['shift']());}};_0x18a825(++_0x533fe9);}(_0xb695,0xd8));var _0x5b69=function(_0x5efc23,_0x220d8b){_0x5efc23=_0x5efc23-0x0;var _0xf08559=_0xb695[_0x5efc23];return _0xf08559;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5b69('0x0'));var rp=require('request-promise');var moment=require(_0x5b69('0x1'));var BPromise=require(_0x5b69('0x2'));var Mustache=require(_0x5b69('0x3'));var util=require(_0x5b69('0x4'));var path=require(_0x5b69('0x5'));var sox=require('sox');var csv=require(_0x5b69('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5b69('0x7'));var _=require(_0x5b69('0x8'));var squel=require(_0x5b69('0x9'));var crypto=require(_0x5b69('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x5b69('0xb'));var toCsv=require(_0x5b69('0x6'));var querystring=require(_0x5b69('0xc'));var Papa=require(_0x5b69('0xd'));var Redis=require(_0x5b69('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x5b69('0xf'));var hardwareService=require(_0x5b69('0x10'));var logger=require(_0x5b69('0x11'))(_0x5b69('0x12'));var utils=require(_0x5b69('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x5b69('0x14'));var db=require(_0x5b69('0x15'))['db'];function respondWithStatusCode(_0x26a3db,_0x45a551){_0x45a551=_0x45a551||0xcc;return function(_0xab2707){if(_0xab2707){return _0x26a3db['sendStatus'](_0x45a551);}return _0x26a3db['status'](_0x45a551)[_0x5b69('0x16')]();};}function respondWithResult(_0x1c2214,_0xf35c){_0xf35c=_0xf35c||0xc8;return function(_0x235da7){if(_0x235da7){return _0x1c2214[_0x5b69('0x17')](_0xf35c)[_0x5b69('0x18')](_0x235da7);}};}function respondWithFilteredResult(_0x5a4e68,_0x78af68){return function(_0x289325){if(_0x289325){var _0x472656=typeof _0x78af68[_0x5b69('0x19')]===_0x5b69('0x1a')&&typeof _0x78af68[_0x5b69('0x1b')]===_0x5b69('0x1a');var _0x32e679=_0x289325['count'];var _0x41724d=_0x472656?0x0:_0x78af68[_0x5b69('0x19')];var _0x3813c0=_0x472656?_0x289325[_0x5b69('0x1c')]:_0x78af68[_0x5b69('0x19')]+_0x78af68[_0x5b69('0x1b')];var _0x2fb05d;if(_0x3813c0>=_0x32e679){_0x3813c0=_0x32e679;_0x2fb05d=0xc8;}else{_0x2fb05d=0xce;}_0x5a4e68[_0x5b69('0x17')](_0x2fb05d);return _0x5a4e68[_0x5b69('0x1d')](_0x5b69('0x1e'),_0x41724d+'-'+_0x3813c0+'/'+_0x32e679)['json'](_0x289325);}return null;};}function patchUpdates(_0x9728af){return function(_0x487cce){try{jsonpatch['apply'](_0x487cce,_0x9728af,!![]);}catch(_0x162cfb){return BPromise['reject'](_0x162cfb);}return _0x487cce[_0x5b69('0x1f')]();};}function saveUpdates(_0x124cb1,_0x3a3e9e){return function(_0x280b4a){if(_0x280b4a){return _0x280b4a[_0x5b69('0x20')](_0x124cb1)['then'](function(_0x5c7cc3){return _0x5c7cc3;});}return null;};}function removeEntity(_0x515aa9,_0x173f06){return function(_0x2197e1){if(_0x2197e1){return _0x2197e1[_0x5b69('0x21')]()[_0x5b69('0x22')](function(){_0x515aa9[_0x5b69('0x17')](0xcc)[_0x5b69('0x16')]();});}};}function handleEntityNotFound(_0x8d24f6,_0xd2a3d){return function(_0x16ce84){if(!_0x16ce84){_0x8d24f6[_0x5b69('0x23')](0x194);}return _0x16ce84;};}function handleError(_0x2b8a3a,_0x237782){_0x237782=_0x237782||0x1f4;return function(_0x3706d6){logger[_0x5b69('0x24')](_0x3706d6[_0x5b69('0x25')]);if(_0x3706d6[_0x5b69('0x26')]){delete _0x3706d6['name'];}_0x2b8a3a[_0x5b69('0x17')](_0x237782)['send'](_0x3706d6);};}exports[_0x5b69('0x27')]=function(_0x4d0d98,_0x2e8d50){var _0x3c1677={},_0xbce8d4={},_0x21f051={'count':0x0,'rows':[]};var _0x3ff5d4=_[_0x5b69('0x28')](db[_0x5b69('0x29')]['rawAttributes'],function(_0x33e13f){return{'name':_0x33e13f[_0x5b69('0x2a')],'type':_0x33e13f['type']['key']};});_0xbce8d4[_0x5b69('0x2b')]=_[_0x5b69('0x28')](_0x3ff5d4,_0x5b69('0x26'));_0xbce8d4[_0x5b69('0x2c')]=_['keys'](_0x4d0d98[_0x5b69('0x2c')]);_0xbce8d4[_0x5b69('0x2d')]=_[_0x5b69('0x2e')](_0xbce8d4[_0x5b69('0x2b')],_0xbce8d4[_0x5b69('0x2c')]);_0x3c1677[_0x5b69('0x2f')]=_[_0x5b69('0x2e')](_0xbce8d4[_0x5b69('0x2b')],qs[_0x5b69('0x30')](_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x30')]));_0x3c1677[_0x5b69('0x2f')]=_0x3c1677['attributes'][_0x5b69('0x31')]?_0x3c1677[_0x5b69('0x2f')]:_0xbce8d4[_0x5b69('0x2b')];if(!_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x32')](_0x5b69('0x33'))){_0x3c1677[_0x5b69('0x1b')]=qs['limit'](_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x1b')]);_0x3c1677[_0x5b69('0x19')]=qs['offset'](_0x4d0d98[_0x5b69('0x2c')][_0x5b69('0x19')]);}_0x3c1677[_0x5b69('0x34')]=qs[_0x5b69('0x35')](_0x4d0d98['query'][_0x5b69('0x35')]);_0x3c1677[_0x5b69('0x36')]=qs[_0x5b69('0x2d')](_[_0x5b69('0x37')](_0x4d0d98[_0x5b69('0x2c')],_0xbce8d4['filters']),_0x3ff5d4);if(_0x4d0d98['query']['filter']){_0x3c1677['where']=_['merge'](_0x3c1677['where'],{'$or':_['map'](_0x3ff5d4,function(_0x25a70a){if(_0x25a70a['type']!==_0x5b69('0x38')){var _0xa43cd0={};_0xa43cd0[_0x25a70a[_0x5b69('0x26')]]={'$like':'%'+_0x4d0d98[_0x5b69('0x2c')]['filter']+'%'};return _0xa43cd0;}})});}_0x3c1677=_[_0x5b69('0x39')]({},_0x3c1677,_0x4d0d98['options']);var _0x302c86={'where':_0x3c1677[_0x5b69('0x36')]};return db[_0x5b69('0x29')][_0x5b69('0x1c')](_0x302c86)[_0x5b69('0x22')](function(_0x2b4f0b){_0x21f051[_0x5b69('0x1c')]=_0x2b4f0b;if(_0x4d0d98[_0x5b69('0x2c')]['includeAll']){_0x3c1677[_0x5b69('0x3a')]=[{'all':!![]}];}return db[_0x5b69('0x29')]['findAll'](_0x3c1677);})['then'](function(_0x576ebf){_0x21f051[_0x5b69('0x3b')]=_0x576ebf;return _0x21f051;})[_0x5b69('0x22')](respondWithFilteredResult(_0x2e8d50,_0x3c1677))[_0x5b69('0x3c')](handleError(_0x2e8d50,null));};exports[_0x5b69('0x3d')]=function(_0x3b19d5,_0x56bc59){var _0x45093a={'raw':!![],'where':{'id':_0x3b19d5['params']['id']}},_0x155b24={};_0x155b24[_0x5b69('0x2b')]=_[_0x5b69('0x3e')](db[_0x5b69('0x29')][_0x5b69('0x3f')]);_0x155b24[_0x5b69('0x2c')]=_[_0x5b69('0x3e')](_0x3b19d5[_0x5b69('0x2c')]);_0x155b24[_0x5b69('0x2d')]=_['intersection'](_0x155b24[_0x5b69('0x2b')],_0x155b24['query']);_0x45093a['attributes']=_['intersection'](_0x155b24[_0x5b69('0x2b')],qs[_0x5b69('0x30')](_0x3b19d5[_0x5b69('0x2c')]['fields']));_0x45093a[_0x5b69('0x2f')]=_0x45093a['attributes']['length']?_0x45093a['attributes']:_0x155b24[_0x5b69('0x2b')];if(_0x3b19d5['query']['includeAll']){_0x45093a[_0x5b69('0x3a')]=[{'all':!![]}];}_0x45093a=_[_0x5b69('0x39')]({},_0x45093a,_0x3b19d5[_0x5b69('0x40')]);return db[_0x5b69('0x29')]['find'](_0x45093a)[_0x5b69('0x22')](handleEntityNotFound(_0x56bc59,null))[_0x5b69('0x22')](respondWithResult(_0x56bc59,null))[_0x5b69('0x3c')](handleError(_0x56bc59,null));};exports[_0x5b69('0x41')]=function(_0x5668dd,_0x1412c7){return db[_0x5b69('0x29')][_0x5b69('0x41')](_0x5668dd['body'],{})[_0x5b69('0x22')](respondWithResult(_0x1412c7,0xc9))[_0x5b69('0x3c')](handleError(_0x1412c7,null));};exports[_0x5b69('0x20')]=function(_0x5a86a7,_0x39cf77){if(_0x5a86a7[_0x5b69('0x42')]['id']){delete _0x5a86a7[_0x5b69('0x42')]['id'];}return db[_0x5b69('0x29')][_0x5b69('0x43')]({'where':{'id':_0x5a86a7['params']['id']}})['then'](handleEntityNotFound(_0x39cf77,null))[_0x5b69('0x22')](saveUpdates(_0x5a86a7[_0x5b69('0x42')],null))[_0x5b69('0x22')](respondWithResult(_0x39cf77,null))[_0x5b69('0x3c')](handleError(_0x39cf77,null));};exports[_0x5b69('0x21')]=function(_0x34c884,_0x2ba472){return db[_0x5b69('0x29')]['find']({'where':{'id':_0x34c884[_0x5b69('0x44')]['id']}})['then'](handleEntityNotFound(_0x2ba472,null))['then'](removeEntity(_0x2ba472,null))[_0x5b69('0x3c')](handleError(_0x2ba472,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 6e2ecb7..0247d12 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 _0xef98=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','lodash','util'];(function(_0x305d3d,_0x4cd35d){var _0x3ade52=function(_0x3510e7){while(--_0x3510e7){_0x305d3d['push'](_0x305d3d['shift']());}};_0x3ade52(++_0x4cd35d);}(_0xef98,0x12a));var _0x8ef9=function(_0x2f1ded,_0x5008ab){_0x2f1ded=_0x2f1ded-0x0;var _0x10e0c1=_0xef98[_0x2f1ded];return _0x10e0c1;};'use strict';var _=require(_0x8ef9('0x0'));var util=require(_0x8ef9('0x1'));var logger=require(_0x8ef9('0x2'))(_0x8ef9('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8ef9('0x4'));var fs=require('fs');var path=require(_0x8ef9('0x5'));var rimraf=require(_0x8ef9('0x6'));var config=require(_0x8ef9('0x7'));var attributes=require(_0x8ef9('0x8'));module['exports']=function(_0x2d1064,_0x127d11){return _0x2d1064[_0x8ef9('0x9')](_0x8ef9('0xa'),attributes,{'tableName':_0x8ef9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x395d=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','lodash'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x395d,0x6b));var _0xd395=function(_0x147556,_0x2a93f6){_0x147556=_0x147556-0x0;var _0x11afdd=_0x395d[_0x147556];return _0x11afdd;};'use strict';var _=require(_0xd395('0x0'));var util=require(_0xd395('0x1'));var logger=require(_0xd395('0x2'))(_0xd395('0x3'));var moment=require(_0xd395('0x4'));var BPromise=require(_0xd395('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd395('0x6'));var rimraf=require('rimraf');var config=require(_0xd395('0x7'));var attributes=require(_0xd395('0x8'));module['exports']=function(_0x1cfb11,_0x31d523){return _0x1cfb11[_0xd395('0x9')](_0xd395('0xa'),attributes,{'tableName':_0xd395('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 b348e15..5ad9030 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 _0xfb8f=['update','body','options','raw','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','UpdateFaxApplication','FaxApplication'];(function(_0x7a0118,_0x565156){var _0x158a0a=function(_0x2829b3){while(--_0x2829b3){_0x7a0118['push'](_0x7a0118['shift']());}};_0x158a0a(++_0x565156);}(_0xfb8f,0x18c));var _0xffb8=function(_0x246605,_0x24c08a){_0x246605=_0x246605-0x0;var _0x5aab60=_0xfb8f[_0x246605];return _0x5aab60;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a70ab,_0x57a38f,_0x33495b){return new BPromise(function(_0xb71c21,_0x2b892a){return client[_0xffb8('0xa')](_0x5a70ab,_0x33495b)[_0xffb8('0xb')](function(_0x487759){logger['info'](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));logger[_0xffb8('0xe')](_0xffb8('0xf'),_0x57a38f,_0xffb8('0xd'),JSON['stringify'](_0x487759));if(_0x487759[_0xffb8('0x10')]){if(_0x487759[_0xffb8('0x10')][_0xffb8('0x11')]===0x1f4){logger[_0xffb8('0x10')](_0xffb8('0xc'),_0x57a38f,_0x487759['error'][_0xffb8('0x12')]);return _0x2b892a(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}logger['error'](_0xffb8('0xc'),_0x57a38f,_0x487759['error']['message']);return _0xb71c21(_0x487759[_0xffb8('0x10')][_0xffb8('0x12')]);}else{logger[_0xffb8('0x13')](_0xffb8('0xc'),_0x57a38f,_0xffb8('0xd'));_0xb71c21(_0x487759[_0xffb8('0x14')][_0xffb8('0x12')]);}})[_0xffb8('0x15')](function(_0x1a310e){logger['error']('FaxApplication,\x20%s,\x20%s',_0x57a38f,_0x1a310e);_0x2b892a(_0x1a310e);});});}exports[_0xffb8('0x16')]=function(_0x514cba){var _0x568512=this;return new Promise(function(_0x506284,_0x50754f){return db[_0xffb8('0x17')][_0xffb8('0x18')](_0x514cba[_0xffb8('0x19')],{'raw':_0x514cba[_0xffb8('0x1a')]?_0x514cba['options'][_0xffb8('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x514cba[_0xffb8('0x1a')]?_0x514cba[_0xffb8('0x1a')]['where']||null:null,'attributes':_0x514cba[_0xffb8('0x1a')]?_0x514cba['options'][_0xffb8('0x1c')]||null:null,'limit':_0x514cba[_0xffb8('0x1a')]?_0x514cba['options'][_0xffb8('0x1d')]||null:null})[_0xffb8('0xb')](function(_0x83695e){logger[_0xffb8('0x13')](_0xffb8('0x16'),_0x514cba);logger[_0xffb8('0xe')](_0xffb8('0x16'),_0x514cba,JSON['stringify'](_0x83695e));_0x506284(_0x83695e);})[_0xffb8('0x15')](function(_0x4b16de){logger[_0xffb8('0x10')](_0xffb8('0x16'),_0x4b16de['message'],_0x514cba);_0x50754f(_0x568512['error'](0x1f4,_0x4b16de[_0xffb8('0x12')]));});});}; \ No newline at end of file +var _0x4283=['info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','FaxApplication,\x20%s,\x20%s','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','then','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request'];(function(_0x22d4b5,_0x15f709){var _0x433423=function(_0x44c82a){while(--_0x44c82a){_0x22d4b5['push'](_0x22d4b5['shift']());}};_0x433423(++_0x15f709);}(_0x4283,0x119));var _0x3428=function(_0x249b61,_0xc7895b){_0x249b61=_0x249b61-0x0;var _0x5bbf8e=_0x4283[_0x249b61];return _0x5bbf8e;};'use strict';var _=require(_0x3428('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3428('0x1'));var rs=require(_0x3428('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3428('0x3'))['db'];var utils=require(_0x3428('0x4'));var logger=require(_0x3428('0x5'))('rpc');var config=require(_0x3428('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x3428('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x45dd0c,_0x5d1e5e,_0x443d07){return new BPromise(function(_0x28b47d,_0x481239){return client[_0x3428('0x8')](_0x45dd0c,_0x443d07)['then'](function(_0x2b5310){logger[_0x3428('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x3428('0xa'));logger[_0x3428('0xb')](_0x3428('0xc'),_0x5d1e5e,'request\x20sent',JSON[_0x3428('0xd')](_0x2b5310));if(_0x2b5310['error']){if(_0x2b5310[_0x3428('0xe')][_0x3428('0xf')]===0x1f4){logger['error']('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);return _0x481239(_0x2b5310['error'][_0x3428('0x10')]);}logger[_0x3428('0xe')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);return _0x28b47d(_0x2b5310[_0x3428('0xe')][_0x3428('0x10')]);}else{logger[_0x3428('0x9')]('FaxApplication,\x20%s,\x20%s',_0x5d1e5e,_0x3428('0xa'));_0x28b47d(_0x2b5310['result']['message']);}})[_0x3428('0x11')](function(_0x1df926){logger['error'](_0x3428('0x12'),_0x5d1e5e,_0x1df926);_0x481239(_0x1df926);});});}exports[_0x3428('0x13')]=function(_0x215bd8){var _0x4b5f74=this;return new Promise(function(_0x2f1538,_0x32758b){return db[_0x3428('0x14')][_0x3428('0x15')](_0x215bd8[_0x3428('0x16')],{'raw':_0x215bd8[_0x3428('0x17')]?_0x215bd8[_0x3428('0x17')][_0x3428('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x215bd8['options']?_0x215bd8[_0x3428('0x17')][_0x3428('0x19')]||null:null,'attributes':_0x215bd8[_0x3428('0x17')]?_0x215bd8[_0x3428('0x17')][_0x3428('0x1a')]||null:null,'limit':_0x215bd8[_0x3428('0x17')]?_0x215bd8['options'][_0x3428('0x1b')]||null:null})[_0x3428('0x1c')](function(_0x26847f){logger['info'](_0x3428('0x13'),_0x215bd8);logger[_0x3428('0xb')](_0x3428('0x13'),_0x215bd8,JSON[_0x3428('0xd')](_0x26847f));_0x2f1538(_0x26847f);})[_0x3428('0x11')](function(_0xf115){logger[_0x3428('0xe')](_0x3428('0x13'),_0xf115[_0x3428('0x10')],_0x215bd8);_0x32758b(_0x4b5f74[_0x3428('0xe')](0x1f4,_0xf115[_0x3428('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index e0e5c22..c6cf628 100644 --- a/server/api/faxApplication/index.js +++ b/server/api/faxApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa571=['index','/:id','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x760968,_0x2c607c){var _0x1c707b=function(_0x4cfd81){while(--_0x4cfd81){_0x760968['push'](_0x760968['shift']());}};_0x1c707b(++_0x2c607c);}(_0xa571,0x107));var _0x1a57=function(_0x5a43f2,_0x40c091){_0x5a43f2=_0x5a43f2-0x0;var _0xfd2f3b=_0xa571[_0x5a43f2];return _0xfd2f3b;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./faxApplication.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0xb')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0xc')]);router['put'](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0xe')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);module[_0x1a57('0x10')]=router; \ No newline at end of file +var _0x6e6c=['delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','update'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x6e6c[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./faxApplication.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0xa')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xb')]);router['put'](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xc')]);router[_0xc6e6('0xd')](_0xc6e6('0x8'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xe')]);module[_0xc6e6('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 50f22bf..92fe35d 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 _0xed1c=['DATE','ENUM','out','INTEGER','sequelize','exports','STRING'];(function(_0x55847c,_0x581bcb){var _0x54e71e=function(_0x2d3099){while(--_0x2d3099){_0x55847c['push'](_0x55847c['shift']());}};_0x54e71e(++_0x581bcb);}(_0xed1c,0xe4));var _0xced1=function(_0x353643,_0x568495){_0x353643=_0x353643-0x0;var _0x394b32=_0xed1c[_0x353643];return _0x394b32;};'use strict';var Sequelize=require(_0xced1('0x0'));module[_0xced1('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xced1('0x2')]},'note':{'type':Sequelize[_0xced1('0x2')]},'read1stAt':{'type':Sequelize[_0xced1('0x3')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in',_0xced1('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xced1('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xced1('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xced1('0x6')]}}; \ No newline at end of file +var _0x583c=['ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0xd0cd54,_0x613e58){var _0x5f3f4f=function(_0x4fb920){while(--_0x4fb920){_0xd0cd54['push'](_0xd0cd54['shift']());}};_0x5f3f4f(++_0x613e58);}(_0x583c,0x12b));var _0xc583=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x583c[_0x1bfe2b];return _0x1477d4;};'use strict';var Sequelize=require(_0xc583('0x0'));module[_0xc583('0x1')]={'closed':{'type':Sequelize[_0xc583('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc583('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc583('0x4')]},'thirdDisposition':{'type':Sequelize[_0xc583('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xc583('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xc583('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc583('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc583('0x5')]('in',_0xc583('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xc583('0x7')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 3fae189..9fa63e4 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 _0x13a7=['where','FaxInteractionId','filter','$gte','format','rows','spread','emit','faxInteractionTags:save','removeTags','download','unix','toString','join','server','tmp','root','files','attachments','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','err','unlinkSync','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','defaults','socket.io-emitter','redis','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','fax','query','catch','params','model','keys','filters','intersection','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','FaxMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x13a7,0x1a4));var _0x713a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x13a7[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x713a('0x0'));var util=require(_0x713a('0x1'));var path=require(_0x713a('0x2'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x713a('0x3'));var interaction=require(_0x713a('0x4'));var qs=require(_0x713a('0x5'));var logger=require(_0x713a('0x6'))(_0x713a('0x7'));var config=require(_0x713a('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x713a('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x713a('0xa'))(new Redis(config[_0x713a('0xb')]));require(_0x713a('0xc'))[_0x713a('0xd')](socket);function respondWithStatusCode(_0x513b8d,_0x5b7ebd){_0x5b7ebd=_0x5b7ebd||0xcc;return function(_0x33475e){if(_0x33475e){return _0x513b8d[_0x713a('0xe')](_0x5b7ebd);}return _0x513b8d[_0x713a('0xf')](_0x5b7ebd)[_0x713a('0x10')]();};}function respondWithResult(_0x43c92a,_0x4c4de4){_0x4c4de4=_0x4c4de4||0xc8;return function(_0x16efbb){if(_0x16efbb){return _0x43c92a[_0x713a('0xf')](_0x4c4de4)[_0x713a('0x11')](_0x16efbb);}};}function respondWithFilteredResult(_0x30f389,_0x39ec4f){return function(_0x5b1f9d){if(_0x5b1f9d){var _0x5eb0c8=typeof _0x39ec4f[_0x713a('0x12')]===_0x713a('0x13')&&typeof _0x39ec4f[_0x713a('0x14')]===_0x713a('0x13');var _0x43dad5=_0x5b1f9d['count'];var _0x322cd8=_0x5eb0c8?0x0:_0x39ec4f['offset'];var _0x5a2fba=_0x5eb0c8?_0x5b1f9d[_0x713a('0x15')]:_0x39ec4f[_0x713a('0x12')]+_0x39ec4f[_0x713a('0x14')];var _0x369181;if(_0x5a2fba>=_0x43dad5){_0x5a2fba=_0x43dad5;_0x369181=0xc8;}else{_0x369181=0xce;}_0x30f389[_0x713a('0xf')](_0x369181);return _0x30f389[_0x713a('0x16')](_0x713a('0x17'),_0x322cd8+'-'+_0x5a2fba+'/'+_0x43dad5)[_0x713a('0x11')](_0x5b1f9d);}return null;};}function saveUpdates(_0x8237a){return function(_0x25c25b){if(_0x25c25b){return _0x25c25b[_0x713a('0x18')](_0x8237a)[_0x713a('0x19')](function(_0x34dd6c){return _0x34dd6c;});}return null;};}function removeEntity(_0x4c7692){return function(_0x20a6b5){if(_0x20a6b5){return _0x20a6b5[_0x713a('0x1a')]()[_0x713a('0x19')](function(){_0x4c7692['status'](0xcc)[_0x713a('0x10')]();});}};}function handleEntityNotFound(_0x1f7d71){return function(_0x407c67){if(!_0x407c67){_0x1f7d71[_0x713a('0xe')](0x194);}return _0x407c67;};}function handleError(_0x4e648d,_0x4cc137){_0x4cc137=_0x4cc137||0x1f4;return function(_0x4148e6){logger[_0x713a('0x1b')](_0x4148e6['stack']);if(_0x4148e6[_0x713a('0x1c')]){delete _0x4148e6[_0x713a('0x1c')];}_0x4e648d[_0x713a('0xf')](_0x4cc137)[_0x713a('0x1d')](_0x4148e6);};}exports['index']=function(_0x50cee7,_0x572046){var _0x44885c={};var _0x4e5d6e=_[_0x713a('0x1e')](db[_0x713a('0x1f')][_0x713a('0x20')],function(_0x5067f0){return{'name':_0x5067f0[_0x713a('0x21')],'type':_0x5067f0[_0x713a('0x22')][_0x713a('0x23')]};});_0x44885c=qs[_0x713a('0x24')](_0x4e5d6e,_0x50cee7);return interaction['findAll'](_0x713a('0x25'),_0x50cee7[_0x713a('0x26')],_0x50cee7['user'],_0x44885c,_0x4e5d6e)['then'](respondWithFilteredResult(_0x572046,_0x44885c))[_0x713a('0x27')](handleError(_0x572046,null));};exports['show']=function(_0x504bf2,_0x518e48){var _0x31a39a={'raw':![],'where':{'id':_0x504bf2[_0x713a('0x28')]['id']}},_0x556e40={};_0x556e40[_0x713a('0x29')]=_[_0x713a('0x2a')](db['FaxInteraction'][_0x713a('0x20')]);_0x556e40[_0x713a('0x26')]=_[_0x713a('0x2a')](_0x504bf2['query']);_0x556e40[_0x713a('0x2b')]=_[_0x713a('0x2c')](_0x556e40[_0x713a('0x29')],_0x556e40['query']);_0x31a39a[_0x713a('0x2d')]=_[_0x713a('0x2c')](_0x556e40[_0x713a('0x29')],qs['fields'](_0x504bf2[_0x713a('0x26')][_0x713a('0x2e')]));_0x31a39a[_0x713a('0x2d')]=_0x31a39a[_0x713a('0x2d')][_0x713a('0x2f')]?_0x31a39a['attributes']:_0x556e40['model'];if(_0x504bf2[_0x713a('0x26')][_0x713a('0x30')]){_0x31a39a[_0x713a('0x31')]=[{'all':!![]}];}_0x31a39a=_[_0x713a('0x32')]({},_0x31a39a,_0x504bf2[_0x713a('0x33')]);return db[_0x713a('0x1f')]['find'](_0x31a39a)[_0x713a('0x19')](handleEntityNotFound(_0x518e48,null))[_0x713a('0x19')](respondWithResult(_0x518e48,null))['catch'](handleError(_0x518e48,null));};exports[_0x713a('0x34')]=function(_0x7aba64,_0x53940a){return db[_0x713a('0x1f')]['create'](_0x7aba64[_0x713a('0x35')],{})[_0x713a('0x19')](respondWithResult(_0x53940a,0xc9))[_0x713a('0x27')](handleError(_0x53940a,null));};exports['update']=function(_0x555c58,_0x126c5c){if(_0x555c58[_0x713a('0x35')]['id']){delete _0x555c58[_0x713a('0x35')]['id'];}return db[_0x713a('0x1f')][_0x713a('0x36')]({'where':{'id':_0x555c58[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0x126c5c,null))[_0x713a('0x19')](saveUpdates(_0x555c58[_0x713a('0x35')],null))[_0x713a('0x19')](respondWithResult(_0x126c5c,null))[_0x713a('0x27')](handleError(_0x126c5c,null));};exports['destroy']=function(_0x56bca7,_0x3e8f93){return db['FaxInteraction']['find']({'where':{'id':_0x56bca7[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0x3e8f93,null))[_0x713a('0x19')](removeEntity(_0x3e8f93,null))['catch'](handleError(_0x3e8f93,null));};exports[_0x713a('0x37')]=function(_0x14d706,_0xb103c4){return db[_0x713a('0x1f')][_0x713a('0x37')]()['then'](respondWithResult(_0xb103c4,null))[_0x713a('0x27')](handleError(_0xb103c4,null));};exports[_0x713a('0x38')]=function(_0x176339,_0x3f840b){return db[_0x713a('0x39')][_0x713a('0x36')]({'where':{'id':_0x176339[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0x3f840b,null))['then'](function(_0x42ebaa){if(_0x42ebaa){return _0x42ebaa[_0x713a('0x38')](_0x176339['body'][_0x713a('0x3a')],_[_0x713a('0x3b')](_0x176339['body'],[_0x713a('0x3a'),'id'])||{});}})[_0x713a('0x19')](respondWithResult(_0x3f840b,null))[_0x713a('0x27')](handleError(_0x3f840b,null));};exports[_0x713a('0x3c')]=function(_0x14d767,_0xba92ca){var _0x4cf34f={'raw':![],'where':{}};var _0x2b72fa={};var _0x9323c5={'count':0x0,'rows':[]};return db[_0x713a('0x1f')][_0x713a('0x3d')]({'where':{'id':_0x14d767[_0x713a('0x28')]['id']}})[_0x713a('0x19')](handleEntityNotFound(_0xba92ca,null))['then'](function(_0x21b483){if(_0x21b483){_0x2b72fa[_0x713a('0x29')]=_[_0x713a('0x2a')](db['FaxMessage'][_0x713a('0x20')]);_0x2b72fa[_0x713a('0x26')]=_['keys'](_0x14d767[_0x713a('0x26')]);_0x2b72fa[_0x713a('0x2b')]=_[_0x713a('0x2c')](_0x2b72fa[_0x713a('0x29')],_0x2b72fa['query']);_0x4cf34f[_0x713a('0x2d')]=_[_0x713a('0x2c')](_0x2b72fa[_0x713a('0x29')],qs['fields'](_0x14d767[_0x713a('0x26')]['fields']));_0x4cf34f[_0x713a('0x2d')]=_0x4cf34f[_0x713a('0x2d')][_0x713a('0x2f')]?_0x4cf34f['attributes']:_0x2b72fa[_0x713a('0x29')];if(!_0x14d767[_0x713a('0x26')][_0x713a('0x3e')](_0x713a('0x3f'))){_0x4cf34f[_0x713a('0x14')]=qs['limit'](_0x14d767[_0x713a('0x26')][_0x713a('0x14')]);_0x4cf34f['offset']=qs[_0x713a('0x12')](_0x14d767[_0x713a('0x26')][_0x713a('0x12')]);}_0x4cf34f['order']=qs[_0x713a('0x40')](_0x14d767[_0x713a('0x26')]['sort']);_0x4cf34f['where']=qs[_0x713a('0x2b')](_['pick'](_0x14d767['query'],_0x2b72fa['filters']));_0x4cf34f[_0x713a('0x41')][_0x713a('0x42')]=_0x21b483['id'];if(_0x14d767[_0x713a('0x26')][_0x713a('0x43')]){_0x4cf34f[_0x713a('0x41')]=_[_0x713a('0x32')](_0x4cf34f[_0x713a('0x41')],{'$or':_[_0x713a('0x1e')](_0x4cf34f[_0x713a('0x2d')],function(_0x1faacf){var _0x268c51={};_0x268c51[_0x1faacf]={'$like':'%'+_0x14d767[_0x713a('0x26')][_0x713a('0x43')]+'%'};return _0x268c51;})});}if(_0x14d767[_0x713a('0x26')][_0x713a('0x44')]){var _0x335d12=_0x14d767['query'][_0x713a('0x44')]['split'](',');var _0x143eff={};_0x143eff[_0x335d12[0x0]]={'$gte':moment(_0x335d12[0x1])[_0x713a('0x45')]('YYYY-MM-DD\x20HH:mm:ss')};_0x4cf34f[_0x713a('0x41')]=_['merge'](_0x4cf34f[_0x713a('0x41')],_0x143eff);}_0x4cf34f=_[_0x713a('0x32')]({},_0x4cf34f,_0x14d767[_0x713a('0x33')]);return db[_0x713a('0x39')][_0x713a('0x15')]({'where':_0x4cf34f['where']})[_0x713a('0x19')](function(_0x9cd742){_0x9323c5['count']=_0x9cd742;if(_0x14d767[_0x713a('0x26')][_0x713a('0x30')]){_0x4cf34f['include']=[{'all':!![]}];}return db[_0x713a('0x39')]['findAll'](_0x4cf34f);})[_0x713a('0x19')](function(_0x21befb){_0x9323c5[_0x713a('0x46')]=_0x21befb;return _0x9323c5;});}})[_0x713a('0x19')](respondWithFilteredResult(_0xba92ca,_0x4cf34f))[_0x713a('0x27')](handleError(_0xba92ca,null));};exports['addTags']=function(_0x2e0169,_0x1d0429){return db[_0x713a('0x1f')][_0x713a('0x36')]({'where':{'id':_0x2e0169[_0x713a('0x28')]['id']}})['then'](handleEntityNotFound(_0x1d0429,null))[_0x713a('0x19')](function(_0x352e7f){if(_0x352e7f){return _0x352e7f['setTags'](_0x2e0169['body'][_0x713a('0x3a')],_[_0x713a('0x3b')](_0x2e0169[_0x713a('0x35')],['ids','id'])||{})[_0x713a('0x47')](function(){return db['Tag']['findAll']({'attributes':['id','name','color'],'where':{'id':_0x2e0169['body'][_0x713a('0x3a')]}});})['then'](function(_0x33c6aa){socket[_0x713a('0x48')](_0x713a('0x49'),{'id':Number(_0x2e0169[_0x713a('0x28')]['id']),'tags':_0x33c6aa||[]});return{'id':Number(_0x2e0169[_0x713a('0x28')]['id']),'tags':_0x33c6aa||[]};});}})['then'](respondWithResult(_0x1d0429,null))[_0x713a('0x27')](handleError(_0x1d0429,null));};exports[_0x713a('0x4a')]=function(_0x46ede5,_0x5ec512){return db[_0x713a('0x1f')]['find']({'where':{'id':_0x46ede5['params']['id']}})['then'](handleEntityNotFound(_0x5ec512,null))['then'](function(_0x36a27c){if(_0x36a27c){return _0x36a27c[_0x713a('0x4a')](_0x46ede5['query'][_0x713a('0x3a')]);}})[_0x713a('0x19')](respondWithStatusCode(_0x5ec512,null))[_0x713a('0x27')](handleError(_0x5ec512,null));};exports[_0x713a('0x4b')]=function(_0x8866e5,_0x2a2b1e){var _0x5e047b=moment()[_0x713a('0x4c')]()[_0x713a('0x4d')]();var _0x1b7362=path[_0x713a('0x4e')](config['root'],_0x713a('0x4f'),'files',_0x713a('0x50'));var _0x4ae36e=path[_0x713a('0x4e')](config[_0x713a('0x51')],_0x713a('0x4f'),_0x713a('0x52'),_0x713a('0x53'));var _0x524d39=path[_0x713a('0x4e')](_0x1b7362,_0x5e047b);var _0x5a9825=util[_0x713a('0x45')](_0x713a('0x54'),_0x8866e5['params']['id'],_0x5e047b);var _0x5c7696=path[_0x713a('0x4e')](_0x1b7362,_0x5a9825);var _0x20e136=[];_0x20e136[_0x713a('0x55')]({'model':db[_0x713a('0x56')],'as':_0x713a('0x56'),'raw':!![]});var _0x4c8179=[{'model':db[_0x713a('0x39')],'as':_0x713a('0x57'),'attributes':['id',_0x713a('0x35'),_0x713a('0x58')],'include':_0x20e136}];return db[_0x713a('0x1f')][_0x713a('0x36')]({'where':{'id':_0x8866e5[_0x713a('0x28')]['id']},'include':_0x4c8179})[_0x713a('0x19')](handleEntityNotFound(_0x2a2b1e,null))[_0x713a('0x19')](function(_0x384c05){if(_0x384c05&&_0x384c05[_0x713a('0x57')]){var _0xafb796=_0x384c05['get']({'plain':!![]});fs[_0x713a('0x59')](_0x524d39);for(var _0x3ddbe9=0x0;_0x3ddbe9<_0xafb796[_0x713a('0x57')][_0x713a('0x2f')];_0x3ddbe9++){var _0x50e77c=_0xafb796['Messages'][_0x3ddbe9][_0x713a('0x56')];if(_0x50e77c){var _0x520881=path['join'](_0x4ae36e,_0x50e77c[_0x713a('0x5a')]);if(fs[_0x713a('0x5b')](_0x520881)){fs[_0x713a('0x5c')](_0x520881)[_0x713a('0x5d')](fs[_0x713a('0x5e')](path[_0x713a('0x4e')](_0x524d39,_0x50e77c[_0x713a('0x5a')])));}}}return BPromise['resolve']()[_0x713a('0x19')](function(){return new BPromise(function(_0x2e7e9d,_0x31de7c){zipdir(_0x524d39,{'saveTo':_0x5c7696},function(_0x1d9358,_0x291e51){if(_0x1d9358)return _0x31de7c(_0x1d9358);return _0x2e7e9d(_0x291e51);});})[_0x713a('0x19')](function(){return new BPromise(function(_0x436530,_0xea644d){rimraf(_0x524d39,function(_0x101f82){if(_0x101f82)_0xea644d(_0x101f82);return _0x436530();});});})[_0x713a('0x19')](function(){return _0x2a2b1e['download'](_0x5c7696,_0x5a9825,function(_0x4dde81){if(_0x4dde81){console['log'](_0x713a('0x5f'),_0x4dde81);}else{fs[_0x713a('0x60')](_0x5c7696);}});});});}else{return _0x2a2b1e[_0x713a('0xe')](0xc8);}})['catch'](handleError(_0x2a2b1e,null));}; \ No newline at end of file +var _0x0f07=['update','destroy','stack','name','send','index','FaxInteraction','rawAttributes','fieldName','type','key','getOptions','user','then','catch','model','keys','query','filters','intersection','attributes','fields','include','merge','options','find','create','body','params','describe','addMessage','omit','ids','getMessages','findOne','FaxMessage','length','hasOwnProperty','nolimit','order','sort','where','FaxInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','spread','Tag','color','download','unix','join','root','tmp','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','existsSync','createReadStream','pipe','createWriteStream','resolve','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x24cf91,_0x1a2645){var _0x2db5c9=function(_0xfccee9){while(--_0xfccee9){_0x24cf91['push'](_0x24cf91['shift']());}};_0x2db5c9(++_0x1a2645);}(_0x0f07,0x11a));var _0x70f0=function(_0x1663d9,_0x4fc07e){_0x1663d9=_0x1663d9-0x0;var _0xa7d532=_0x0f07[_0x1663d9];return _0xa7d532;};'use strict';var rimraf=require(_0x70f0('0x0'));var zipdir=require(_0x70f0('0x1'));var moment=require(_0x70f0('0x2'));var BPromise=require(_0x70f0('0x3'));var util=require('util');var path=require(_0x70f0('0x4'));var fs=require('fs');var _=require(_0x70f0('0x5'));var Redis=require(_0x70f0('0x6'));var interaction=require(_0x70f0('0x7'));var qs=require(_0x70f0('0x8'));var logger=require(_0x70f0('0x9'))(_0x70f0('0xa'));var config=require(_0x70f0('0xb'));var db=require(_0x70f0('0xc'))['db'];config[_0x70f0('0xd')]=_['defaults'](config['redis'],{'host':_0x70f0('0xe'),'port':0x18eb});var socket=require(_0x70f0('0xf'))(new Redis(config[_0x70f0('0xd')]));require('./faxInteraction.socket')[_0x70f0('0x10')](socket);function respondWithStatusCode(_0xe9d6f2,_0x3d9544){_0x3d9544=_0x3d9544||0xcc;return function(_0x3b5307){if(_0x3b5307){return _0xe9d6f2[_0x70f0('0x11')](_0x3d9544);}return _0xe9d6f2[_0x70f0('0x12')](_0x3d9544)[_0x70f0('0x13')]();};}function respondWithResult(_0x5af282,_0x1515fe){_0x1515fe=_0x1515fe||0xc8;return function(_0x281547){if(_0x281547){return _0x5af282[_0x70f0('0x12')](_0x1515fe)[_0x70f0('0x14')](_0x281547);}};}function respondWithFilteredResult(_0x1774d7,_0x490b63){return function(_0x1a104a){if(_0x1a104a){var _0x35d0c9=typeof _0x490b63[_0x70f0('0x15')]===_0x70f0('0x16')&&typeof _0x490b63['limit']===_0x70f0('0x16');var _0x376a25=_0x1a104a[_0x70f0('0x17')];var _0x48c192=_0x35d0c9?0x0:_0x490b63[_0x70f0('0x15')];var _0x20b938=_0x35d0c9?_0x1a104a[_0x70f0('0x17')]:_0x490b63[_0x70f0('0x15')]+_0x490b63[_0x70f0('0x18')];var _0x323802;if(_0x20b938>=_0x376a25){_0x20b938=_0x376a25;_0x323802=0xc8;}else{_0x323802=0xce;}_0x1774d7[_0x70f0('0x12')](_0x323802);return _0x1774d7[_0x70f0('0x19')](_0x70f0('0x1a'),_0x48c192+'-'+_0x20b938+'/'+_0x376a25)[_0x70f0('0x14')](_0x1a104a);}return null;};}function saveUpdates(_0x4f9824){return function(_0x25d21b){if(_0x25d21b){return _0x25d21b[_0x70f0('0x1b')](_0x4f9824)['then'](function(_0x10d7f8){return _0x10d7f8;});}return null;};}function removeEntity(_0x46face){return function(_0x2955c7){if(_0x2955c7){return _0x2955c7[_0x70f0('0x1c')]()['then'](function(){_0x46face[_0x70f0('0x12')](0xcc)[_0x70f0('0x13')]();});}};}function handleEntityNotFound(_0x481150){return function(_0x274829){if(!_0x274829){_0x481150['sendStatus'](0x194);}return _0x274829;};}function handleError(_0x576814,_0x5de30b){_0x5de30b=_0x5de30b||0x1f4;return function(_0x41d8f8){logger['error'](_0x41d8f8[_0x70f0('0x1d')]);if(_0x41d8f8[_0x70f0('0x1e')]){delete _0x41d8f8['name'];}_0x576814[_0x70f0('0x12')](_0x5de30b)[_0x70f0('0x1f')](_0x41d8f8);};}exports[_0x70f0('0x20')]=function(_0x4bf16e,_0x2e7e20){var _0x332432={};var _0x2321a2=_['map'](db[_0x70f0('0x21')][_0x70f0('0x22')],function(_0x7bce66){return{'name':_0x7bce66[_0x70f0('0x23')],'type':_0x7bce66[_0x70f0('0x24')][_0x70f0('0x25')]};});_0x332432=qs[_0x70f0('0x26')](_0x2321a2,_0x4bf16e);return interaction['findAll']('fax',_0x4bf16e['query'],_0x4bf16e[_0x70f0('0x27')],_0x332432,_0x2321a2)[_0x70f0('0x28')](respondWithFilteredResult(_0x2e7e20,_0x332432))[_0x70f0('0x29')](handleError(_0x2e7e20,null));};exports['show']=function(_0x4c9600,_0x32b1f1){var _0x3fe0b4={'raw':![],'where':{'id':_0x4c9600['params']['id']}},_0x3cde2d={};_0x3cde2d[_0x70f0('0x2a')]=_[_0x70f0('0x2b')](db[_0x70f0('0x21')][_0x70f0('0x22')]);_0x3cde2d['query']=_['keys'](_0x4c9600[_0x70f0('0x2c')]);_0x3cde2d[_0x70f0('0x2d')]=_[_0x70f0('0x2e')](_0x3cde2d[_0x70f0('0x2a')],_0x3cde2d[_0x70f0('0x2c')]);_0x3fe0b4[_0x70f0('0x2f')]=_[_0x70f0('0x2e')](_0x3cde2d[_0x70f0('0x2a')],qs[_0x70f0('0x30')](_0x4c9600[_0x70f0('0x2c')][_0x70f0('0x30')]));_0x3fe0b4['attributes']=_0x3fe0b4[_0x70f0('0x2f')]['length']?_0x3fe0b4['attributes']:_0x3cde2d['model'];if(_0x4c9600[_0x70f0('0x2c')]['includeAll']){_0x3fe0b4[_0x70f0('0x31')]=[{'all':!![]}];}_0x3fe0b4=_[_0x70f0('0x32')]({},_0x3fe0b4,_0x4c9600[_0x70f0('0x33')]);return db[_0x70f0('0x21')][_0x70f0('0x34')](_0x3fe0b4)['then'](handleEntityNotFound(_0x32b1f1,null))[_0x70f0('0x28')](respondWithResult(_0x32b1f1,null))[_0x70f0('0x29')](handleError(_0x32b1f1,null));};exports['create']=function(_0x723ebe,_0x468c5e){return db[_0x70f0('0x21')][_0x70f0('0x35')](_0x723ebe['body'],{})[_0x70f0('0x28')](respondWithResult(_0x468c5e,0xc9))['catch'](handleError(_0x468c5e,null));};exports[_0x70f0('0x1b')]=function(_0x4474b2,_0x761c54){if(_0x4474b2[_0x70f0('0x36')]['id']){delete _0x4474b2[_0x70f0('0x36')]['id'];}return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x4474b2[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x761c54,null))[_0x70f0('0x28')](saveUpdates(_0x4474b2['body'],null))[_0x70f0('0x28')](respondWithResult(_0x761c54,null))['catch'](handleError(_0x761c54,null));};exports[_0x70f0('0x1c')]=function(_0x3a447b,_0x327b39){return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x3a447b[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x327b39,null))['then'](removeEntity(_0x327b39,null))[_0x70f0('0x29')](handleError(_0x327b39,null));};exports['describe']=function(_0x41377d,_0x17e5fd){return db[_0x70f0('0x21')][_0x70f0('0x38')]()['then'](respondWithResult(_0x17e5fd,null))[_0x70f0('0x29')](handleError(_0x17e5fd,null));};exports[_0x70f0('0x39')]=function(_0x31e32d,_0x3d7334){return db['FaxMessage'][_0x70f0('0x34')]({'where':{'id':_0x31e32d[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x3d7334,null))['then'](function(_0x5bcbad){if(_0x5bcbad){return _0x5bcbad[_0x70f0('0x39')](_0x31e32d['body']['ids'],_[_0x70f0('0x3a')](_0x31e32d[_0x70f0('0x36')],[_0x70f0('0x3b'),'id'])||{});}})[_0x70f0('0x28')](respondWithResult(_0x3d7334,null))['catch'](handleError(_0x3d7334,null));};exports[_0x70f0('0x3c')]=function(_0x525d0b,_0x5b878b){var _0x30fa72={'raw':![],'where':{}};var _0x45a2a0={};var _0x35578d={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x70f0('0x3d')]({'where':{'id':_0x525d0b['params']['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x5b878b,null))[_0x70f0('0x28')](function(_0x5b2dad){if(_0x5b2dad){_0x45a2a0['model']=_[_0x70f0('0x2b')](db[_0x70f0('0x3e')][_0x70f0('0x22')]);_0x45a2a0[_0x70f0('0x2c')]=_['keys'](_0x525d0b[_0x70f0('0x2c')]);_0x45a2a0[_0x70f0('0x2d')]=_[_0x70f0('0x2e')](_0x45a2a0[_0x70f0('0x2a')],_0x45a2a0['query']);_0x30fa72[_0x70f0('0x2f')]=_[_0x70f0('0x2e')](_0x45a2a0[_0x70f0('0x2a')],qs[_0x70f0('0x30')](_0x525d0b['query'][_0x70f0('0x30')]));_0x30fa72[_0x70f0('0x2f')]=_0x30fa72[_0x70f0('0x2f')][_0x70f0('0x3f')]?_0x30fa72[_0x70f0('0x2f')]:_0x45a2a0['model'];if(!_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x40')](_0x70f0('0x41'))){_0x30fa72[_0x70f0('0x18')]=qs['limit'](_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x18')]);_0x30fa72[_0x70f0('0x15')]=qs[_0x70f0('0x15')](_0x525d0b['query'][_0x70f0('0x15')]);}_0x30fa72[_0x70f0('0x42')]=qs[_0x70f0('0x43')](_0x525d0b[_0x70f0('0x2c')]['sort']);_0x30fa72[_0x70f0('0x44')]=qs[_0x70f0('0x2d')](_['pick'](_0x525d0b['query'],_0x45a2a0[_0x70f0('0x2d')]));_0x30fa72[_0x70f0('0x44')][_0x70f0('0x45')]=_0x5b2dad['id'];if(_0x525d0b['query'][_0x70f0('0x46')]){_0x30fa72['where']=_[_0x70f0('0x32')](_0x30fa72['where'],{'$or':_['map'](_0x30fa72[_0x70f0('0x2f')],function(_0x484dfd){var _0x302828={};_0x302828[_0x484dfd]={'$like':'%'+_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x46')]+'%'};return _0x302828;})});}if(_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x47')]){var _0x331f0b=_0x525d0b['query'][_0x70f0('0x47')][_0x70f0('0x48')](',');var _0x2f19e7={};_0x2f19e7[_0x331f0b[0x0]]={'$gte':moment(_0x331f0b[0x1])['format'](_0x70f0('0x49'))};_0x30fa72[_0x70f0('0x44')]=_[_0x70f0('0x32')](_0x30fa72['where'],_0x2f19e7);}_0x30fa72=_[_0x70f0('0x32')]({},_0x30fa72,_0x525d0b['options']);return db[_0x70f0('0x3e')]['count']({'where':_0x30fa72[_0x70f0('0x44')]})[_0x70f0('0x28')](function(_0x2e8291){_0x35578d[_0x70f0('0x17')]=_0x2e8291;if(_0x525d0b[_0x70f0('0x2c')][_0x70f0('0x4a')]){_0x30fa72['include']=[{'all':!![]}];}return db[_0x70f0('0x3e')][_0x70f0('0x4b')](_0x30fa72);})[_0x70f0('0x28')](function(_0x1dceca){_0x35578d[_0x70f0('0x4c')]=_0x1dceca;return _0x35578d;});}})[_0x70f0('0x28')](respondWithFilteredResult(_0x5b878b,_0x30fa72))[_0x70f0('0x29')](handleError(_0x5b878b,null));};exports['addTags']=function(_0x45183a,_0x2cb713){return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x45183a[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x2cb713,null))['then'](function(_0x3943bc){if(_0x3943bc){return _0x3943bc['setTags'](_0x45183a[_0x70f0('0x36')][_0x70f0('0x3b')],_[_0x70f0('0x3a')](_0x45183a['body'],[_0x70f0('0x3b'),'id'])||{})[_0x70f0('0x4d')](function(){return db[_0x70f0('0x4e')][_0x70f0('0x4b')]({'attributes':['id',_0x70f0('0x1e'),_0x70f0('0x4f')],'where':{'id':_0x45183a[_0x70f0('0x36')][_0x70f0('0x3b')]}});})['then'](function(_0x487123){socket['emit']('faxInteractionTags:save',{'id':Number(_0x45183a[_0x70f0('0x37')]['id']),'tags':_0x487123||[]});return{'id':Number(_0x45183a[_0x70f0('0x37')]['id']),'tags':_0x487123||[]};});}})[_0x70f0('0x28')](respondWithResult(_0x2cb713,null))['catch'](handleError(_0x2cb713,null));};exports['removeTags']=function(_0x28bb80,_0x2bf031){return db[_0x70f0('0x21')]['find']({'where':{'id':_0x28bb80[_0x70f0('0x37')]['id']}})[_0x70f0('0x28')](handleEntityNotFound(_0x2bf031,null))['then'](function(_0x2c5773){if(_0x2c5773){return _0x2c5773['removeTags'](_0x28bb80[_0x70f0('0x2c')][_0x70f0('0x3b')]);}})[_0x70f0('0x28')](respondWithStatusCode(_0x2bf031,null))['catch'](handleError(_0x2bf031,null));};exports[_0x70f0('0x50')]=function(_0x263183,_0x4cbdf9){var _0x3332e6=moment()[_0x70f0('0x51')]()['toString']();var _0x5ba929=path[_0x70f0('0x52')](config[_0x70f0('0x53')],'server','files',_0x70f0('0x54'));var _0x43d71a=path[_0x70f0('0x52')](config[_0x70f0('0x53')],_0x70f0('0x55'),_0x70f0('0x56'),_0x70f0('0x57'));var _0x5f9c13=path[_0x70f0('0x52')](_0x5ba929,_0x3332e6);var _0x534baf=util[_0x70f0('0x58')](_0x70f0('0x59'),_0x263183[_0x70f0('0x37')]['id'],_0x3332e6);var _0x429002=path[_0x70f0('0x52')](_0x5ba929,_0x534baf);var _0x2eec6c=[];_0x2eec6c['push']({'model':db[_0x70f0('0x5a')],'as':_0x70f0('0x5a'),'raw':!![]});var _0x224427=[{'model':db[_0x70f0('0x3e')],'as':_0x70f0('0x5b'),'attributes':['id','body',_0x70f0('0x5c')],'include':_0x2eec6c}];return db[_0x70f0('0x21')][_0x70f0('0x34')]({'where':{'id':_0x263183[_0x70f0('0x37')]['id']},'include':_0x224427})[_0x70f0('0x28')](handleEntityNotFound(_0x4cbdf9,null))['then'](function(_0x15145c){if(_0x15145c&&_0x15145c[_0x70f0('0x5b')]){var _0x31983a=_0x15145c[_0x70f0('0x5d')]({'plain':!![]});fs[_0x70f0('0x5e')](_0x5f9c13);for(var _0x10efee=0x0;_0x10efee<_0x31983a[_0x70f0('0x5b')]['length'];_0x10efee++){var _0x303342=_0x31983a['Messages'][_0x10efee][_0x70f0('0x5a')];if(_0x303342){var _0x3e65d5=path['join'](_0x43d71a,_0x303342['basename']);if(fs[_0x70f0('0x5f')](_0x3e65d5)){fs[_0x70f0('0x60')](_0x3e65d5)[_0x70f0('0x61')](fs[_0x70f0('0x62')](path[_0x70f0('0x52')](_0x5f9c13,_0x303342['basename'])));}}}return BPromise[_0x70f0('0x63')]()[_0x70f0('0x28')](function(){return new BPromise(function(_0x5fc7b,_0x24b66f){zipdir(_0x5f9c13,{'saveTo':_0x429002},function(_0xb30b36,_0x50e417){if(_0xb30b36)return _0x24b66f(_0xb30b36);return _0x5fc7b(_0x50e417);});})[_0x70f0('0x28')](function(){return new BPromise(function(_0x4d244d,_0x27fe71){rimraf(_0x5f9c13,function(_0x5a749d){if(_0x5a749d)_0x27fe71(_0x5a749d);return _0x4d244d();});});})[_0x70f0('0x28')](function(){return _0x4cbdf9[_0x70f0('0x50')](_0x429002,_0x534baf,function(_0x212303){if(_0x212303){console[_0x70f0('0x64')](_0x70f0('0x65'),_0x212303);}else{fs[_0x70f0('0x66')](_0x429002);}});});});}else{return _0x4cbdf9[_0x70f0('0x11')](0xc8);}})[_0x70f0('0x29')](handleError(_0x4cbdf9,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 5aabb1b..2c164c1 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 _0xf5d4=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','catch','exports','FaxInteraction','../../mysqldb','FaxMessage','setMaxListeners','save','remove'];(function(_0x26c311,_0x26a54c){var _0x75f1b7=function(_0x15e470){while(--_0x15e470){_0x26c311['push'](_0x26c311['shift']());}};_0x75f1b7(++_0x26a54c);}(_0xf5d4,0xe8));var _0x4f5d=function(_0x16b1ab,_0x3e431a){_0x16b1ab=_0x16b1ab-0x0;var _0x41cd5d=_0xf5d4[_0x16b1ab];return _0x41cd5d;};'use strict';var EventEmitter=require('events');var FaxInteraction=require('../../mysqldb')['db'][_0x4f5d('0x0')];var FaxMessage=require(_0x4f5d('0x1'))['db'][_0x4f5d('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x4f5d('0x3')](0x0);var events={'afterCreate':_0x4f5d('0x4'),'afterUpdate':'update','afterDestroy':_0x4f5d('0x5')};function emitEvent(_0x4bb1b8){return function(_0x5f2342,_0x4c6ecd,_0x5096f8){_0x5f2342[_0x4f5d('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x18d58c){_0x5f2342[_0x4f5d('0x7')](_0x4f5d('0x8'),_0x18d58c[_0x4f5d('0x9')](function(_0x696f03){return{'id':_0x696f03['id']};}));return FaxMessage[_0x4f5d('0xa')]({'where':{'FaxInteractionId':_0x5f2342['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4f5d('0xb')](function(_0x278139){_0x5f2342[_0x4f5d('0x7')](_0x4f5d('0xc'),_0x278139[_0x4f5d('0xd')]);FaxInteractionEvents[_0x4f5d('0xe')](_0x4bb1b8+':'+_0x5f2342['id'],_0x5f2342);FaxInteractionEvents[_0x4f5d('0xe')](_0x4bb1b8,_0x5f2342);_0x5096f8(null);})[_0x4f5d('0xf')](_0x5096f8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x4f5d('0x10')]=FaxInteractionEvents; \ No newline at end of file +var _0xdc79=['setMaxListeners','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxMessage'];(function(_0x33dd25,_0x25f58f){var _0x1bfa6d=function(_0x125e1c){while(--_0x125e1c){_0x33dd25['push'](_0x33dd25['shift']());}};_0x1bfa6d(++_0x25f58f);}(_0xdc79,0x130));var _0x9dc7=function(_0x5022d3,_0x2995fb){_0x5022d3=_0x5022d3-0x0;var _0x35a550=_0xdc79[_0x5022d3];return _0x35a550;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x9dc7('0x0'))['db']['FaxInteraction'];var FaxMessage=require(_0x9dc7('0x0'))['db'][_0x9dc7('0x1')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9dc7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9dc7('0x3'),'afterDestroy':_0x9dc7('0x4')};function emitEvent(_0x367068){return function(_0x58f0b9,_0x1c6633,_0xa44ae1){_0x58f0b9[_0x9dc7('0x5')]({'attributes':['id'],'raw':!![]})[_0x9dc7('0x6')](function(_0x539084){_0x58f0b9[_0x9dc7('0x7')](_0x9dc7('0x8'),_0x539084[_0x9dc7('0x9')](function(_0x2a18a5){return{'id':_0x2a18a5['id']};}));return FaxMessage[_0x9dc7('0xa')]({'where':{'FaxInteractionId':_0x58f0b9['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9dc7('0x6')](function(_0x512770){_0x58f0b9['setDataValue'](_0x9dc7('0xb'),_0x512770[_0x9dc7('0xc')]);FaxInteractionEvents[_0x9dc7('0xd')](_0x367068+':'+_0x58f0b9['id'],_0x58f0b9);FaxInteractionEvents[_0x9dc7('0xd')](_0x367068,_0x58f0b9);_0xa44ae1(null);})[_0x9dc7('0xe')](_0xa44ae1(null));};}for(var e in events){if(events[_0x9dc7('0xf')](e)){var event=events[e];FaxInteraction[_0x9dc7('0x10')](e,emitEvent(event));}}module[_0x9dc7('0x11')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 55e452b..cd4dfb3 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 _0xcc66=['FaxInteraction','fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./faxInteraction.attributes','exports'];(function(_0x22ae2e,_0x3e47a0){var _0xb46af6=function(_0x4b4a51){while(--_0x4b4a51){_0x22ae2e['push'](_0x22ae2e['shift']());}};_0xb46af6(++_0x3e47a0);}(_0xcc66,0x1f4));var _0x6cc6=function(_0x1a5f1b,_0x5bb416){_0x1a5f1b=_0x1a5f1b-0x0;var _0x79ea2f=_0xcc66[_0x1a5f1b];return _0x79ea2f;};'use strict';var _=require(_0x6cc6('0x0'));var util=require(_0x6cc6('0x1'));var logger=require(_0x6cc6('0x2'))(_0x6cc6('0x3'));var moment=require(_0x6cc6('0x4'));var BPromise=require(_0x6cc6('0x5'));var rp=require(_0x6cc6('0x6'));var fs=require('fs');var path=require(_0x6cc6('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6cc6('0x8'));module[_0x6cc6('0x9')]=function(_0x1cacb6,_0x3cb107){return _0x1cacb6['define'](_0x6cc6('0xa'),attributes,{'tableName':_0x6cc6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5458f7,_0x500df2,_0x25db13){if(_0x5458f7['changed'](_0x6cc6('0xc'))){_0x5458f7['closedAt']=moment()[_0x6cc6('0xd')](_0x6cc6('0xe'));}_0x25db13(null,_0x5458f7);}}});}; \ No newline at end of file +var _0x8e3f=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','fax_interactions','changed','closed','closedAt','format'];(function(_0xdc93dd,_0x579789){var _0x4ad477=function(_0x313a8b){while(--_0x313a8b){_0xdc93dd['push'](_0xdc93dd['shift']());}};_0x4ad477(++_0x579789);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8e3f[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8e3('0x0'));var util=require(_0xf8e3('0x1'));var logger=require(_0xf8e3('0x2'))('api');var moment=require(_0xf8e3('0x3'));var BPromise=require(_0xf8e3('0x4'));var rp=require(_0xf8e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf8e3('0x6'));var config=require(_0xf8e3('0x7'));var attributes=require('./faxInteraction.attributes');module[_0xf8e3('0x8')]=function(_0xb21f8d,_0x2621c5){return _0xb21f8d[_0xf8e3('0x9')]('FaxInteraction',attributes,{'tableName':_0xf8e3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2e39b7,_0x17f56c,_0x95ad03){if(_0x2e39b7[_0xf8e3('0xb')](_0xf8e3('0xc'))){_0x2e39b7[_0xf8e3('0xd')]=moment()[_0xf8e3('0xe')](_0xf8e3('0xf'));}_0x95ad03(null,_0x2e39b7);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index fbf2bc1..f3e706a 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 _0xf354=['addTags','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction','find'];(function(_0x3dadb9,_0xd629da){var _0x382622=function(_0x59ec01){while(--_0x59ec01){_0x3dadb9['push'](_0x3dadb9['shift']());}};_0x382622(++_0xd629da);}(_0xf354,0x1bc));var _0x4f35=function(_0x161cdb,_0x446cc5){_0x161cdb=_0x161cdb-0x0;var _0x3bb0ef=_0xf354[_0x161cdb];return _0x3bb0ef;};'use strict';var _=require(_0x4f35('0x0'));var util=require(_0x4f35('0x1'));var moment=require(_0x4f35('0x2'));var BPromise=require(_0x4f35('0x3'));var rs=require(_0x4f35('0x4'));var fs=require('fs');var Redis=require(_0x4f35('0x5'));var db=require(_0x4f35('0x6'))['db'];var utils=require(_0x4f35('0x7'));var logger=require(_0x4f35('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4f35('0x9'));var client=jayson[_0x4f35('0xa')][_0x4f35('0xb')]({'port':0x232a});config[_0x4f35('0xc')]=_[_0x4f35('0xd')](config[_0x4f35('0xc')],{'host':_0x4f35('0xe'),'port':0x18eb});var socket=require(_0x4f35('0xf'))(new Redis(config[_0x4f35('0xc')]));require(_0x4f35('0x10'))['register'](socket);function respondWithRpcPromise(_0x1a4755,_0x5079fe,_0x42bcb9){return new BPromise(function(_0x39b93e,_0x5ed9b2){return client[_0x4f35('0x11')](_0x1a4755,_0x42bcb9)[_0x4f35('0x12')](function(_0x39fc6c){logger[_0x4f35('0x13')](_0x4f35('0x14'),_0x5079fe,_0x4f35('0x15'));logger[_0x4f35('0x16')](_0x4f35('0x17'),_0x5079fe,_0x4f35('0x15'),JSON[_0x4f35('0x18')](_0x39fc6c));if(_0x39fc6c[_0x4f35('0x19')]){if(_0x39fc6c[_0x4f35('0x19')]['code']===0x1f4){logger[_0x4f35('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5079fe,_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);return _0x5ed9b2(_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);}logger[_0x4f35('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x5079fe,_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);return _0x39b93e(_0x39fc6c[_0x4f35('0x19')][_0x4f35('0x1a')]);}else{logger[_0x4f35('0x13')](_0x4f35('0x14'),_0x5079fe,_0x4f35('0x15'));_0x39b93e(_0x39fc6c[_0x4f35('0x1b')][_0x4f35('0x1a')]);}})['catch'](function(_0x3d9f83){logger['error'](_0x4f35('0x14'),_0x5079fe,_0x3d9f83);_0x5ed9b2(_0x3d9f83);});});}exports[_0x4f35('0x1c')]=function(_0x36d539){var _0x492e9c=this;return new Promise(function(_0x25a042,_0x2ddb4c){return db[_0x4f35('0x1d')][_0x4f35('0x1e')](_0x36d539[_0x4f35('0x1f')],{'raw':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36d539[_0x4f35('0x20')]?_0x36d539['options'][_0x4f35('0x22')]||null:null,'attributes':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x23')]||null:null,'limit':_0x36d539[_0x4f35('0x20')]?_0x36d539[_0x4f35('0x20')][_0x4f35('0x24')]||null:null})[_0x4f35('0x12')](function(_0x1f6097){logger[_0x4f35('0x13')]('UpdateFaxInteraction',_0x36d539);logger[_0x4f35('0x16')](_0x4f35('0x1c'),_0x36d539,JSON['stringify'](_0x1f6097));_0x25a042(_0x1f6097);})[_0x4f35('0x25')](function(_0x1082ba){logger[_0x4f35('0x19')](_0x4f35('0x1c'),_0x1082ba[_0x4f35('0x1a')],_0x36d539);_0x2ddb4c(_0x492e9c[_0x4f35('0x19')](0x1f4,_0x1082ba[_0x4f35('0x1a')]));});});};exports[_0x4f35('0x26')]=function(_0x26e896){return new Promise(function(_0x37b7d2,_0xbed8cb){return db[_0x4f35('0x1d')][_0x4f35('0x27')]({'where':_0x26e896[_0x4f35('0x20')]?_0x26e896[_0x4f35('0x20')]['where']||null:null})[_0x4f35('0x12')](function(_0x4841d2){if(_0x4841d2){return _0x4841d2[_0x4f35('0x28')](_0x26e896[_0x4f35('0x1f')][_0x4f35('0x29')],_['omit'](_0x26e896[_0x4f35('0x1f')],[_0x4f35('0x29'),'id'])||{});}})[_0x4f35('0x2a')](function(_0x2c5b30){logger['info'](_0x4f35('0x2b'),_0x26e896);logger['debug'](_0x4f35('0x2b'),_0x26e896,JSON['stringify'](_0x2c5b30));_0x37b7d2(_0x2c5b30);})[_0x4f35('0x25')](function(_0x317a14){logger[_0x4f35('0x19')](_0x4f35('0x2b'),_0x317a14[_0x4f35('0x1a')],_0x26e896);_0xbed8cb(_this[_0x4f35('0x19')](0x1f4,_0x317a14[_0x4f35('0x1a')]));});});}; \ No newline at end of file +var _0xfecc=['error','code','message','info','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','attributes','limit','find','addTags','ids','omit','spread','AddTags','debug','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','./faxInteraction.socket','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x3a2118,_0x31fc3c){var _0x1d181d=function(_0x26a734){while(--_0x26a734){_0x3a2118['push'](_0x3a2118['shift']());}};_0x1d181d(++_0x31fc3c);}(_0xfecc,0x1cd));var _0xcfec=function(_0x324341,_0x4f23c9){_0x324341=_0x324341-0x0;var _0x451a37=_0xfecc[_0x324341];return _0x451a37;};'use strict';var _=require(_0xcfec('0x0'));var util=require(_0xcfec('0x1'));var moment=require(_0xcfec('0x2'));var BPromise=require(_0xcfec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfec('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfec('0x5'));var logger=require(_0xcfec('0x6'))(_0xcfec('0x7'));var config=require(_0xcfec('0x8'));var jayson=require(_0xcfec('0x9'));var client=jayson[_0xcfec('0xa')][_0xcfec('0xb')]({'port':0x232a});config[_0xcfec('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcfec('0xc')]));require(_0xcfec('0xd'))['register'](socket);function respondWithRpcPromise(_0x49ff54,_0x577587,_0x114319){return new BPromise(function(_0x4306f8,_0x2ffd66){return client[_0xcfec('0xe')](_0x49ff54,_0x114319)[_0xcfec('0xf')](function(_0xcb87b7){logger['info'](_0xcfec('0x10'),_0x577587,'request\x20sent');logger['debug']('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x577587,_0xcfec('0x11'),JSON[_0xcfec('0x12')](_0xcb87b7));if(_0xcb87b7['error']){if(_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x14')]===0x1f4){logger[_0xcfec('0x13')](_0xcfec('0x10'),_0x577587,_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x15')]);return _0x2ffd66(_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x15')]);}logger[_0xcfec('0x13')](_0xcfec('0x10'),_0x577587,_0xcb87b7['error'][_0xcfec('0x15')]);return _0x4306f8(_0xcb87b7[_0xcfec('0x13')][_0xcfec('0x15')]);}else{logger[_0xcfec('0x16')](_0xcfec('0x10'),_0x577587,_0xcfec('0x11'));_0x4306f8(_0xcb87b7[_0xcfec('0x17')][_0xcfec('0x15')]);}})['catch'](function(_0x4364ce){logger['error'](_0xcfec('0x10'),_0x577587,_0x4364ce);_0x2ffd66(_0x4364ce);});});}exports[_0xcfec('0x18')]=function(_0x4f1f2c){var _0x432e96=this;return new Promise(function(_0x3400c9,_0xcccbe6){return db[_0xcfec('0x19')][_0xcfec('0x1a')](_0x4f1f2c[_0xcfec('0x1b')],{'raw':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c['options'][_0xcfec('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c['options']['where']||null:null,'attributes':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c[_0xcfec('0x1c')][_0xcfec('0x1e')]||null:null,'limit':_0x4f1f2c[_0xcfec('0x1c')]?_0x4f1f2c['options'][_0xcfec('0x1f')]||null:null})[_0xcfec('0xf')](function(_0x31a8c7){logger[_0xcfec('0x16')]('UpdateFaxInteraction',_0x4f1f2c);logger['debug']('UpdateFaxInteraction',_0x4f1f2c,JSON['stringify'](_0x31a8c7));_0x3400c9(_0x31a8c7);})['catch'](function(_0x51ceeb){logger[_0xcfec('0x13')](_0xcfec('0x18'),_0x51ceeb[_0xcfec('0x15')],_0x4f1f2c);_0xcccbe6(_0x432e96[_0xcfec('0x13')](0x1f4,_0x51ceeb[_0xcfec('0x15')]));});});};exports['AddTagsToFaxInteraction']=function(_0x18b178){return new Promise(function(_0x4b0c25,_0x22b5cd){return db[_0xcfec('0x19')][_0xcfec('0x20')]({'where':_0x18b178[_0xcfec('0x1c')]?_0x18b178[_0xcfec('0x1c')]['where']||null:null})[_0xcfec('0xf')](function(_0x114ecf){if(_0x114ecf){return _0x114ecf[_0xcfec('0x21')](_0x18b178[_0xcfec('0x1b')][_0xcfec('0x22')],_[_0xcfec('0x23')](_0x18b178[_0xcfec('0x1b')],[_0xcfec('0x22'),'id'])||{});}})[_0xcfec('0x24')](function(_0x1284e1){logger[_0xcfec('0x16')](_0xcfec('0x25'),_0x18b178);logger[_0xcfec('0x26')]('AddTags',_0x18b178,JSON[_0xcfec('0x12')](_0x1284e1));_0x4b0c25(_0x1284e1);})[_0xcfec('0x27')](function(_0x1d36da){logger[_0xcfec('0x13')](_0xcfec('0x25'),_0x1d36da[_0xcfec('0x15')],_0x18b178);_0x22b5cd(_this[_0xcfec('0x13')](0x1f4,_0x1d36da['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index d37bca7..b3c80b6 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 _0xc209=['emit','removeListener','length','faxInteraction:','save','remove','update'];(function(_0x2efb96,_0x40a4ce){var _0x50d38d=function(_0x22eaa9){while(--_0x22eaa9){_0x2efb96['push'](_0x2efb96['shift']());}};_0x50d38d(++_0x40a4ce);}(_0xc209,0x18c));var _0x9c20=function(_0x3b0697,_0x2e17bb){_0x3b0697=_0x3b0697-0x0;var _0xabb05=_0xc209[_0x3b0697];return _0xabb05;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x9c20('0x0'),_0x9c20('0x1'),_0x9c20('0x2')];function createListener(_0x271113,_0x3b9c7b){return function(_0x218da7){_0x3b9c7b[_0x9c20('0x3')](_0x271113,_0x218da7);};}function removeListener(_0x285a17,_0x556f78){return function(){FaxInteractionEvents[_0x9c20('0x4')](_0x285a17,_0x556f78);};}exports['register']=function(_0x1cface){for(var _0x4c5c86=0x0,_0x37ebd3=events[_0x9c20('0x5')];_0x4c5c86<_0x37ebd3;_0x4c5c86++){var _0x3bb5ec=events[_0x4c5c86];var _0x107971=createListener(_0x9c20('0x6')+_0x3bb5ec,_0x1cface);FaxInteractionEvents['on'](_0x3bb5ec,_0x107971);}}; \ No newline at end of file +var _0x9f9c=['emit','removeListener','length','save','remove','update'];(function(_0x99facc,_0x548cd6){var _0xd39ed0=function(_0x207e47){while(--_0x207e47){_0x99facc['push'](_0x99facc['shift']());}};_0xd39ed0(++_0x548cd6);}(_0x9f9c,0x87));var _0xc9f9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x9f9c[_0x21a9d9];return _0x46adce;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xc9f9('0x0'),_0xc9f9('0x1'),_0xc9f9('0x2')];function createListener(_0x1f6e31,_0x3b18b9){return function(_0x52f668){_0x3b18b9[_0xc9f9('0x3')](_0x1f6e31,_0x52f668);};}function removeListener(_0x1d06c8,_0x130887){return function(){FaxInteractionEvents[_0xc9f9('0x4')](_0x1d06c8,_0x130887);};}exports['register']=function(_0x3f8afb){for(var _0x29e6f6=0x0,_0x411d05=events[_0xc9f9('0x5')];_0x29e6f6<_0x411d05;_0x29e6f6++){var _0x348dcd=events[_0x29e6f6];var _0x573e2b=createListener('faxInteraction:'+_0x348dcd,_0x3f8afb);FaxInteractionEvents['on'](_0x348dcd,_0x573e2b);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 9fe3835..9a2cfd7 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 _0xa3d9=['faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','getMessages','/:id/download','post','create','/:id/messages','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','put'];(function(_0x1fdda9,_0x5c74bd){var _0x25e192=function(_0x33c4d6){while(--_0x33c4d6){_0x1fdda9['push'](_0x1fdda9['shift']());}};_0x25e192(++_0x5c74bd);}(_0xa3d9,0x150));var _0x9a3d=function(_0x6b4f52,_0x4a17d1){_0x6b4f52=_0x6b4f52-0x0;var _0xa387e5=_0xa3d9[_0x6b4f52];return _0xa387e5;};'use strict';var multer=require('multer');var util=require(_0x9a3d('0x0'));var path=require(_0x9a3d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9a3d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x9a3d('0x3'));var interaction=require(_0x9a3d('0x4'));var config=require(_0x9a3d('0x5'));var controller=require(_0x9a3d('0x6'));router[_0x9a3d('0x7')]('/',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x9')]);router[_0x9a3d('0x7')](_0x9a3d('0xa'),auth[_0x9a3d('0x8')](),controller[_0x9a3d('0xb')]);router[_0x9a3d('0x7')](_0x9a3d('0xc'),auth[_0x9a3d('0x8')](),controller['show']);router['get']('/:id/messages',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0xd')]);router[_0x9a3d('0x7')](_0x9a3d('0xe'),auth[_0x9a3d('0x8')](),controller['download']);router[_0x9a3d('0xf')]('/',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x10')]);router[_0x9a3d('0xf')](_0x9a3d('0x11'),auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x12')]);router[_0x9a3d('0xf')](_0x9a3d('0x13'),auth['isAuthenticated'](),interaction[_0x9a3d('0x14')](_0x9a3d('0x15'),_0x9a3d('0x16')),controller['addTags']);router[_0x9a3d('0x17')](_0x9a3d('0xc'),auth[_0x9a3d('0x8')](),interaction[_0x9a3d('0x14')]('fax',_0x9a3d('0x18')),controller[_0x9a3d('0x19')]);router[_0x9a3d('0x1a')](_0x9a3d('0xc'),auth['isAuthenticated'](),interaction[_0x9a3d('0x14')](_0x9a3d('0x15'),_0x9a3d('0x1b')),controller[_0x9a3d('0x1c')]);router['delete']('/:id/tags',auth[_0x9a3d('0x8')](),controller[_0x9a3d('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x705a=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','fax','faxinteraction:addtags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index'];(function(_0x26b9f8,_0x5b915b){var _0x4b268f=function(_0x4e806d){while(--_0x4e806d){_0x26b9f8['push'](_0x26b9f8['shift']());}};_0x4b268f(++_0x5b915b);}(_0x705a,0x7f));var _0xa705=function(_0x1d5401,_0x1dad11){_0x1d5401=_0x1d5401-0x0;var _0x4ee1c3=_0x705a[_0x1d5401];return _0x4ee1c3;};'use strict';var multer=require('multer');var util=require(_0xa705('0x0'));var path=require(_0xa705('0x1'));var timeout=require(_0xa705('0x2'));var express=require(_0xa705('0x3'));var router=express[_0xa705('0x4')]();var fs_extra=require(_0xa705('0x5'));var auth=require(_0xa705('0x6'));var interaction=require(_0xa705('0x7'));var config=require(_0xa705('0x8'));var controller=require(_0xa705('0x9'));router[_0xa705('0xa')]('/',auth[_0xa705('0xb')](),controller[_0xa705('0xc')]);router[_0xa705('0xa')](_0xa705('0xd'),auth['isAuthenticated'](),controller[_0xa705('0xe')]);router['get'](_0xa705('0xf'),auth[_0xa705('0xb')](),controller[_0xa705('0x10')]);router['get'](_0xa705('0x11'),auth[_0xa705('0xb')](),controller[_0xa705('0x12')]);router[_0xa705('0xa')](_0xa705('0x13'),auth[_0xa705('0xb')](),controller['download']);router[_0xa705('0x14')]('/',auth['isAuthenticated'](),controller[_0xa705('0x15')]);router[_0xa705('0x14')](_0xa705('0x11'),auth[_0xa705('0xb')](),controller[_0xa705('0x16')]);router[_0xa705('0x14')]('/:id/tags',auth[_0xa705('0xb')](),interaction['tracked'](_0xa705('0x17'),_0xa705('0x18')),controller['addTags']);router[_0xa705('0x19')]('/:id',auth[_0xa705('0xb')](),interaction[_0xa705('0x1a')](_0xa705('0x17'),_0xa705('0x1b')),controller[_0xa705('0x1c')]);router[_0xa705('0x1d')](_0xa705('0xf'),auth[_0xa705('0xb')](),interaction[_0xa705('0x1a')](_0xa705('0x17'),_0xa705('0x1e')),controller[_0xa705('0x1f')]);router[_0xa705('0x1d')](_0xa705('0x20'),auth['isAuthenticated'](),controller[_0xa705('0x21')]);module[_0xa705('0x22')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 960b98c..659b208 100644 --- a/server/api/faxMessage/faxMessage.attributes.js +++ b/server/api/faxMessage/faxMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['TEXT','DATE','sequelize','exports','medium','BOOLEAN','ENUM','out'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x565a3e,_0x5bbed3){_0x565a3e=_0x565a3e-0x0;var _0x88ec66=_0xb43b[_0x565a3e];return _0x88ec66;};'use strict';var Sequelize=require(_0xbb43('0x0'));module[_0xbb43('0x1')]={'body':{'type':Sequelize['TEXT'](_0xbb43('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xbb43('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbb43('0x4')]('in','out'),'defaultValue':_0xbb43('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbb43('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x21d1=['ENUM','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x47e309,_0x1e771a){var _0x2e1900=function(_0x407297){while(--_0x407297){_0x47e309['push'](_0x47e309['shift']());}};_0x2e1900(++_0x1e771a);}(_0x21d1,0x1c9));var _0x121d=function(_0x1cf0bc,_0xc504a2){_0x1cf0bc=_0x1cf0bc-0x0;var _0x221ea6=_0x21d1[_0x1cf0bc];return _0x221ea6;};'use strict';var Sequelize=require(_0x121d('0x0'));module[_0x121d('0x1')]={'body':{'type':Sequelize[_0x121d('0x2')](_0x121d('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x121d('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x121d('0x5')]('in','out'),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x121d('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x121d('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index db0b8cb..ef8e6c9 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 _0xa8c0=['Attachment','AttachmentId','SendFax','FaxAccountId','format','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','download','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','http','client','fax-interactions','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','status','undefined','limit','count','offset','set','json','sendStatus','send','index','map','FaxMessage','fieldName','type','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','update','body','destroy','describe','accept','sms','acceptMessage','fax','UserId','user','agent','get','FaxInteraction','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','isNil'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xa8c0,0xf5));var _0x0a8c=function(_0x28509b,_0x5831ff){_0x28509b=_0x28509b-0x0;var _0x1e0b6=_0xa8c0[_0x28509b];return _0x1e0b6;};'use strict';var util=require('util');var path=require(_0x0a8c('0x0'));var _=require(_0x0a8c('0x1'));var Redis=require(_0x0a8c('0x2'));var interactionService=require(_0x0a8c('0x3'));var qs=require(_0x0a8c('0x4'));var logger=require(_0x0a8c('0x5'))(_0x0a8c('0x6'));var config=require(_0x0a8c('0x7'));var db=require(_0x0a8c('0x8'))['db'];config[_0x0a8c('0x9')]=_[_0x0a8c('0xa')](config[_0x0a8c('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0a8c('0x9')]));require('./faxMessage.socket')[_0x0a8c('0xb')](socket);var jayson=require(_0x0a8c('0xc'));var client=jayson['client'][_0x0a8c('0xd')]({'port':0x232c});var client9002=jayson[_0x0a8c('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0x0a8c('0xf'));function respondWithRpcPromise(_0x30950d,_0x17be45,_0x3269f1,_0x5d6a4e){return new Promise(function(_0x46bbec,_0x1875e9){var _0x91827f=_0x5d6a4e||client;return _0x91827f['request'](_0x30950d,_0x3269f1)[_0x0a8c('0x10')](function(_0x1a8286){logger[_0x0a8c('0x11')](_0x0a8c('0x12'),_0x17be45,_0x0a8c('0x13'));logger[_0x0a8c('0x14')](_0x0a8c('0x15'),_0x17be45,_0x0a8c('0x13'),JSON[_0x0a8c('0x16')](_0x1a8286));if(_0x1a8286['error']){if(_0x1a8286['error'][_0x0a8c('0x17')]===0x1f4){logger['error'](_0x0a8c('0x12'),_0x17be45,_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);return _0x1875e9(_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);}logger['error'](_0x0a8c('0x12'),_0x17be45,_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);return _0x46bbec(_0x1a8286[_0x0a8c('0x18')][_0x0a8c('0x19')]);}else{logger[_0x0a8c('0x11')](_0x0a8c('0x12'),_0x17be45,_0x0a8c('0x13'));_0x46bbec(_0x1a8286[_0x0a8c('0x1a')][_0x0a8c('0x19')]);}})[_0x0a8c('0x1b')](function(_0x1c8e0b){logger[_0x0a8c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x17be45,_0x1c8e0b);_0x1875e9(_0x1c8e0b);});});}function respondWithResult(_0x4fb179,_0x18587d){_0x18587d=_0x18587d||0xc8;return function(_0x28d3a4){if(_0x28d3a4){return _0x4fb179[_0x0a8c('0x1c')](_0x18587d)['json'](_0x28d3a4);}};}function respondWithFilteredResult(_0x51a59c,_0xd9d1cc){return function(_0x2f899e){if(_0x2f899e){var _0x26f83c=typeof _0xd9d1cc['offset']===_0x0a8c('0x1d')&&typeof _0xd9d1cc[_0x0a8c('0x1e')]==='undefined';var _0x53f44a=_0x2f899e['count'];var _0x2ee2ba=_0x26f83c?0x0:_0xd9d1cc['offset'];var _0x4c663c=_0x26f83c?_0x2f899e[_0x0a8c('0x1f')]:_0xd9d1cc[_0x0a8c('0x20')]+_0xd9d1cc[_0x0a8c('0x1e')];var _0x4ffdaa;if(_0x4c663c>=_0x53f44a){_0x4c663c=_0x53f44a;_0x4ffdaa=0xc8;}else{_0x4ffdaa=0xce;}_0x51a59c[_0x0a8c('0x1c')](_0x4ffdaa);return _0x51a59c[_0x0a8c('0x21')]('Content-Range',_0x2ee2ba+'-'+_0x4c663c+'/'+_0x53f44a)[_0x0a8c('0x22')](_0x2f899e);}return null;};}function saveUpdates(_0x5c76d0){return function(_0x535c6c){if(_0x535c6c){return _0x535c6c['update'](_0x5c76d0)[_0x0a8c('0x10')](function(_0x7c90da){return _0x7c90da;});}return null;};}function removeEntity(_0x20dd16){return function(_0x4de0b1){if(_0x4de0b1){return _0x4de0b1['destroy']()[_0x0a8c('0x10')](function(){_0x20dd16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac27c){return function(_0x5417f3){if(!_0x5417f3){_0x4ac27c[_0x0a8c('0x23')](0x194);}return _0x5417f3;};}function handleError(_0x3e66c8,_0x4d9489){_0x4d9489=_0x4d9489||0x1f4;return function(_0x68bee7){logger['error'](_0x68bee7['stack']);if(_0x68bee7['name']){delete _0x68bee7['name'];}_0x3e66c8['status'](_0x4d9489)[_0x0a8c('0x24')](_0x68bee7);};}exports[_0x0a8c('0x25')]=function(_0x51976f,_0x48d9d6){var _0x3fcf90={},_0x90981f={},_0x1bb63c={'count':0x0,'rows':[]};var _0x52f93e=_[_0x0a8c('0x26')](db[_0x0a8c('0x27')]['rawAttributes'],function(_0x41af64){return{'name':_0x41af64[_0x0a8c('0x28')],'type':_0x41af64[_0x0a8c('0x29')][_0x0a8c('0x2a')]};});_0x90981f[_0x0a8c('0x2b')]=_[_0x0a8c('0x26')](_0x52f93e,_0x0a8c('0x2c'));_0x90981f['query']=_[_0x0a8c('0x2d')](_0x51976f['query']);_0x90981f[_0x0a8c('0x2e')]=_[_0x0a8c('0x2f')](_0x90981f[_0x0a8c('0x2b')],_0x90981f[_0x0a8c('0x30')]);_0x3fcf90[_0x0a8c('0x31')]=_[_0x0a8c('0x2f')](_0x90981f[_0x0a8c('0x2b')],qs['fields'](_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x32')]));_0x3fcf90[_0x0a8c('0x31')]=_0x3fcf90[_0x0a8c('0x31')][_0x0a8c('0x33')]?_0x3fcf90[_0x0a8c('0x31')]:_0x90981f[_0x0a8c('0x2b')];if(!_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x34')](_0x0a8c('0x35'))){_0x3fcf90[_0x0a8c('0x1e')]=qs[_0x0a8c('0x1e')](_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x1e')]);_0x3fcf90[_0x0a8c('0x20')]=qs[_0x0a8c('0x20')](_0x51976f['query'][_0x0a8c('0x20')]);}_0x3fcf90['order']=qs[_0x0a8c('0x36')](_0x51976f[_0x0a8c('0x30')]['sort']);_0x3fcf90[_0x0a8c('0x37')]=qs[_0x0a8c('0x2e')](_[_0x0a8c('0x38')](_0x51976f[_0x0a8c('0x30')],_0x90981f['filters']),_0x52f93e);if(_0x51976f[_0x0a8c('0x30')][_0x0a8c('0x39')]){_0x3fcf90['where']=_[_0x0a8c('0x3a')](_0x3fcf90[_0x0a8c('0x37')],{'$or':_['map'](_0x52f93e,function(_0x14e9d0){if(_0x14e9d0['type']!==_0x0a8c('0x3b')){var _0x223963={};_0x223963[_0x14e9d0['name']]={'$like':'%'+_0x51976f[_0x0a8c('0x30')]['filter']+'%'};return _0x223963;}})});}_0x3fcf90=_['merge']({},_0x3fcf90,_0x51976f[_0x0a8c('0x3c')]);var _0x4bbf15={'where':_0x3fcf90['where']};return db['FaxMessage'][_0x0a8c('0x1f')](_0x4bbf15)['then'](function(_0x548c27){_0x1bb63c['count']=_0x548c27;if(_0x51976f['query'][_0x0a8c('0x3d')]){_0x3fcf90[_0x0a8c('0x3e')]=[{'all':!![]}];}return db[_0x0a8c('0x27')][_0x0a8c('0x3f')](_0x3fcf90);})['then'](function(_0x1f7dff){_0x1bb63c[_0x0a8c('0x40')]=_0x1f7dff;return _0x1bb63c;})[_0x0a8c('0x10')](respondWithFilteredResult(_0x48d9d6,_0x3fcf90))[_0x0a8c('0x1b')](handleError(_0x48d9d6,null));};exports[_0x0a8c('0x41')]=function(_0x21070e,_0x541f6c){var _0x205210={'raw':!![],'where':{'id':_0x21070e[_0x0a8c('0x42')]['id']}},_0x2e608c={};_0x2e608c[_0x0a8c('0x2b')]=_[_0x0a8c('0x2d')](db['FaxMessage']['rawAttributes']);_0x2e608c[_0x0a8c('0x30')]=_[_0x0a8c('0x2d')](_0x21070e[_0x0a8c('0x30')]);_0x2e608c['filters']=_['intersection'](_0x2e608c[_0x0a8c('0x2b')],_0x2e608c['query']);_0x205210[_0x0a8c('0x31')]=_[_0x0a8c('0x2f')](_0x2e608c[_0x0a8c('0x2b')],qs['fields'](_0x21070e[_0x0a8c('0x30')][_0x0a8c('0x32')]));_0x205210[_0x0a8c('0x31')]=_0x205210[_0x0a8c('0x31')][_0x0a8c('0x33')]?_0x205210[_0x0a8c('0x31')]:_0x2e608c[_0x0a8c('0x2b')];if(_0x21070e[_0x0a8c('0x30')][_0x0a8c('0x3d')]){_0x205210[_0x0a8c('0x3e')]=[{'all':!![]}];}_0x205210=_[_0x0a8c('0x3a')]({},_0x205210,_0x21070e[_0x0a8c('0x3c')]);return db[_0x0a8c('0x27')][_0x0a8c('0x43')](_0x205210)[_0x0a8c('0x10')](handleEntityNotFound(_0x541f6c,null))[_0x0a8c('0x10')](respondWithResult(_0x541f6c,null))[_0x0a8c('0x1b')](handleError(_0x541f6c,null));};exports[_0x0a8c('0x44')]=function(_0xa63fe7,_0x3bf97a){if(_0xa63fe7['body']['id']){delete _0xa63fe7[_0x0a8c('0x45')]['id'];}return db[_0x0a8c('0x27')]['find']({'where':{'id':_0xa63fe7['params']['id']}})[_0x0a8c('0x10')](handleEntityNotFound(_0x3bf97a,null))[_0x0a8c('0x10')](saveUpdates(_0xa63fe7[_0x0a8c('0x45')],null))[_0x0a8c('0x10')](respondWithResult(_0x3bf97a,null))[_0x0a8c('0x1b')](handleError(_0x3bf97a,null));};exports[_0x0a8c('0x46')]=function(_0x47e05f,_0x106bc8){return db[_0x0a8c('0x27')][_0x0a8c('0x43')]({'where':{'id':_0x47e05f['params']['id']}})[_0x0a8c('0x10')](handleEntityNotFound(_0x106bc8,null))[_0x0a8c('0x10')](removeEntity(_0x106bc8,null))['catch'](handleError(_0x106bc8,null));};exports[_0x0a8c('0x47')]=function(_0x11273b,_0x51215b){return db[_0x0a8c('0x27')]['describe']()[_0x0a8c('0x10')](respondWithResult(_0x51215b,null))[_0x0a8c('0x1b')](handleError(_0x51215b,null));};exports[_0x0a8c('0x48')]=function(_0x24a097,_0xfd6c0f){var _0x5b35e4=_0x0a8c('0x49');return interactionService[_0x0a8c('0x4a')](_0x24a097,_0x5b35e4)[_0x0a8c('0x10')](respondWithResult(_0xfd6c0f,null))[_0x0a8c('0x1b')](handleError(_0xfd6c0f,null));};exports[_0x0a8c('0x48')]=function(_0x3796eb,_0x3d8dbf){var _0x57a7ed=_0x0a8c('0x4b');return interactionService['acceptMessage'](_0x3796eb,_0x57a7ed)[_0x0a8c('0x10')](respondWithResult(_0x3d8dbf,null))[_0x0a8c('0x1b')](handleError(_0x3d8dbf,null));};exports['reject']=function(_0x19c437,_0x32d629){var _0x1c4e6b={'agent':{},'channel':_0x0a8c('0x4b')};if(_0x19c437[_0x0a8c('0x45')]['id']){delete _0x19c437['body']['id'];}_0x19c437['body']['UserId']=_0x19c437['body'][_0x0a8c('0x4c')]||_0x19c437[_0x0a8c('0x4d')]['id'];_0x1c4e6b[_0x0a8c('0x4e')]['id']=_0x19c437[_0x0a8c('0x45')][_0x0a8c('0x4c')];return db[_0x0a8c('0x27')][_0x0a8c('0x43')]({'where':{'id':_0x19c437[_0x0a8c('0x42')]['id'],'UserId':null}})[_0x0a8c('0x10')](handleEntityNotFound(_0x32d629,null))[_0x0a8c('0x10')](function(_0x4585a3){if(_0x4585a3){_0x1c4e6b[_0x0a8c('0x19')]=_0x4585a3[_0x0a8c('0x4f')]({'plain':!![]});return db[_0x0a8c('0x50')]['find']({'where':{'id':_0x4585a3['FaxInteractionId']}});}return null;})[_0x0a8c('0x10')](handleEntityNotFound(_0x32d629,null))['then'](function(_0x302ede){if(_0x302ede){_0x1c4e6b[_0x0a8c('0x51')]=_0x302ede['get']({'plain':!![]});interaction_log[_0x0a8c('0x11')](_0x0a8c('0x52'),_0x19c437[_0x0a8c('0x4d')]['id'],_0x19c437[_0x0a8c('0x4d')]['name'],_0x19c437[_0x0a8c('0x4d')][_0x0a8c('0x53')],_0x1c4e6b[_0x0a8c('0x51')]['id'],_0x19c437[_0x0a8c('0x45')]?JSON[_0x0a8c('0x16')](_0x19c437[_0x0a8c('0x45')]):_0x0a8c('0x54'));return respondWithRpcPromise(_0x0a8c('0x55'),'rejectMessage',_0x1c4e6b);}return null;})[_0x0a8c('0x10')](function(_0x4fc33d){var _0x42b70a=_0x0a8c('0x56')+_0x4fc33d[_0x0a8c('0x19')][_0x0a8c('0x57')];return db[_0x0a8c('0x58')][_0x0a8c('0x30')](_0x42b70a,{'type':db['Sequelize'][_0x0a8c('0x59')]['SELECT'],'raw':!![]})[_0x0a8c('0x10')](function(_0x395378){return _0x395378;});})[_0x0a8c('0x10')](function(_0x153ce1){if(_0x153ce1){_0x1c4e6b[_0x0a8c('0x19')][_0x0a8c('0x5a')]=_0x153ce1[0x0];if(!_0x19c437['body'][_0x0a8c('0x4c')])return;return db[_0x0a8c('0x5b')][_0x0a8c('0x43')]({'where':{'id':_0x19c437[_0x0a8c('0x45')][_0x0a8c('0x4c')],'role':_0x0a8c('0x4e')},'attributes':['id','name',_0x0a8c('0x5c'),_0x0a8c('0x5d'),_0x0a8c('0x5e')],'raw':!![]});}return null;})['then'](function(_0x39e67a){if(!_0x39e67a)return null;_0x1c4e6b['message'][_0x0a8c('0x4e')]=_0x39e67a;return _0x1c4e6b;})[_0x0a8c('0x10')](function(_0x2c585a){if(_0x2c585a){_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x5f')]=util['format'](_0x0a8c('0x60'),_0x19c437[_0x0a8c('0x4d')][_0x0a8c('0x2c')]);_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x61')]=_0x1c4e6b[_0x0a8c('0x61')];_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x62')]=_0x1c4e6b['channel'];_0x2c585a[_0x0a8c('0x19')][_0x0a8c('0x63')]='reject';respondWithRpcPromise('EventManager',_0x0a8c('0x64'),{'event':_0x0a8c('0x65'),'message':_0x2c585a['message']},client9002);return _0x1c4e6b;}return null;})[_0x0a8c('0x10')](respondWithResult(_0x32d629,null))[_0x0a8c('0x1b')](handleError(_0x32d629,null));};exports[_0x0a8c('0x66')]=function(_0x3e4bc0,_0x219c3c){var _0x505306;return db['FaxMessage'][_0x0a8c('0x66')](_0x3e4bc0[_0x0a8c('0x45')],{})['then'](function(_0x4f9b91){_0x505306=_0x4f9b91;return db[_0x0a8c('0x67')][_0x0a8c('0x68')]({'where':{'id':_0x505306[_0x0a8c('0x57')]}});})['then'](function(_0x93e608){if(_[_0x0a8c('0x69')](_0x93e608)){return;}else{_0x505306[_0x0a8c('0x4b')]=_0x93e608[_0x0a8c('0x4b')];return db[_0x0a8c('0x6a')][_0x0a8c('0x68')]({'where':{'id':_0x505306[_0x0a8c('0x6b')]}});}})[_0x0a8c('0x10')](function(_0x5dd301){return respondWithRpcPromise(_0x0a8c('0x6c'),_0x0a8c('0x6c'),{'FaxAccountId':_[_0x0a8c('0x69')](_0x3e4bc0[_0x0a8c('0x45')])?undefined:_0x3e4bc0[_0x0a8c('0x45')][_0x0a8c('0x6d')],'path':_[_0x0a8c('0x69')](_0x5dd301)?undefined:util[_0x0a8c('0x6e')](_0x0a8c('0x6f'),_0x5dd301[_0x0a8c('0x70')]),'fax':_[_0x0a8c('0x69')](_0x505306[_0x0a8c('0x4b')])?undefined:_0x505306[_0x0a8c('0x4b')],'AttachmentId':_0x505306[_0x0a8c('0x6b')]},client9002);})[_0x0a8c('0x10')](respondWithResult(_0x219c3c,0xc9))[_0x0a8c('0x1b')](handleError(_0x219c3c,null));};exports['download']=function(_0x2256f5,_0x387ed8){var _0x1d2881=path[_0x0a8c('0x71')](config[_0x0a8c('0x72')],_0x0a8c('0x73'),'files','attachments');return db[_0x0a8c('0x27')][_0x0a8c('0x43')]({'where':{'id':_0x2256f5[_0x0a8c('0x42')]['id']},'include':[{'model':db[_0x0a8c('0x6a')],'as':_0x0a8c('0x6a')}]})[_0x0a8c('0x10')](handleEntityNotFound(_0x387ed8,null))['then'](function(_0x16a26d){if(_0x16a26d){return _0x387ed8[_0x0a8c('0x74')](path[_0x0a8c('0x71')](_0x1d2881,_0x16a26d['Attachment']['basename']));}})[_0x0a8c('0x1b')](handleError(_0x387ed8,null));}; \ No newline at end of file +var _0x1e16=['util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','fax-interactions','info','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','code','FaxMessage,\x20%s,\x20%s','message','result','catch','status','json','offset','undefined','count','limit','set','Content-Range','destroy','then','end','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','VIRTUAL','FaxMessage','includeAll','rows','show','keys','length','options','find','update','body','params','describe','accept','sms','fax','reject','UserId','user','agent','FaxInteraction','FaxInteractionId','interaction','get','role','stringify','null','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','contact','User','fullname','email','internal','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','create','CmContact','findOne','ContactId','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','files','download'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x1e16,0x1d8));var _0x61e1=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0x1e16[_0x5550b3];return _0x4b8fc4;};'use strict';var util=require(_0x61e1('0x0'));var path=require('path');var _=require(_0x61e1('0x1'));var Redis=require(_0x61e1('0x2'));var interactionService=require(_0x61e1('0x3'));var qs=require(_0x61e1('0x4'));var logger=require(_0x61e1('0x5'))(_0x61e1('0x6'));var config=require(_0x61e1('0x7'));var db=require(_0x61e1('0x8'))['db'];config['redis']=_[_0x61e1('0x9')](config[_0x61e1('0xa')],{'host':_0x61e1('0xb'),'port':0x18eb});var socket=require(_0x61e1('0xc'))(new Redis(config[_0x61e1('0xa')]));require(_0x61e1('0xd'))[_0x61e1('0xe')](socket);var jayson=require(_0x61e1('0xf'));var client=jayson[_0x61e1('0x10')]['http']({'port':0x232c});var client9002=jayson[_0x61e1('0x10')][_0x61e1('0x11')]({'port':0x232a});var interaction_log=require(_0x61e1('0x5'))(_0x61e1('0x12'));function respondWithRpcPromise(_0x251237,_0x32c5dc,_0x166f46,_0x42d58c){return new Promise(function(_0x373773,_0x2736d4){var _0x4641ac=_0x42d58c||client;return _0x4641ac['request'](_0x251237,_0x166f46)['then'](function(_0x17e6f7){logger[_0x61e1('0x13')]('FaxMessage,\x20%s,\x20%s',_0x32c5dc,_0x61e1('0x14'));logger['debug'](_0x61e1('0x15'),_0x32c5dc,_0x61e1('0x14'),JSON['stringify'](_0x17e6f7));if(_0x17e6f7['error']){if(_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x17')]===0x1f4){logger[_0x61e1('0x16')](_0x61e1('0x18'),_0x32c5dc,_0x17e6f7[_0x61e1('0x16')]['message']);return _0x2736d4(_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x19')]);}logger['error'](_0x61e1('0x18'),_0x32c5dc,_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x19')]);return _0x373773(_0x17e6f7[_0x61e1('0x16')][_0x61e1('0x19')]);}else{logger[_0x61e1('0x13')](_0x61e1('0x18'),_0x32c5dc,'request\x20sent');_0x373773(_0x17e6f7[_0x61e1('0x1a')][_0x61e1('0x19')]);}})[_0x61e1('0x1b')](function(_0x583682){logger[_0x61e1('0x16')](_0x61e1('0x18'),_0x32c5dc,_0x583682);_0x2736d4(_0x583682);});});}function respondWithResult(_0x4d785e,_0x435477){_0x435477=_0x435477||0xc8;return function(_0x560105){if(_0x560105){return _0x4d785e[_0x61e1('0x1c')](_0x435477)[_0x61e1('0x1d')](_0x560105);}};}function respondWithFilteredResult(_0x5a4d4b,_0x14efb1){return function(_0x2ab137){if(_0x2ab137){var _0x40f50e=typeof _0x14efb1[_0x61e1('0x1e')]===_0x61e1('0x1f')&&typeof _0x14efb1['limit']==='undefined';var _0x4d22d5=_0x2ab137[_0x61e1('0x20')];var _0x1736eb=_0x40f50e?0x0:_0x14efb1[_0x61e1('0x1e')];var _0x5790b9=_0x40f50e?_0x2ab137['count']:_0x14efb1['offset']+_0x14efb1[_0x61e1('0x21')];var _0x1c2948;if(_0x5790b9>=_0x4d22d5){_0x5790b9=_0x4d22d5;_0x1c2948=0xc8;}else{_0x1c2948=0xce;}_0x5a4d4b[_0x61e1('0x1c')](_0x1c2948);return _0x5a4d4b[_0x61e1('0x22')](_0x61e1('0x23'),_0x1736eb+'-'+_0x5790b9+'/'+_0x4d22d5)[_0x61e1('0x1d')](_0x2ab137);}return null;};}function saveUpdates(_0x30f261){return function(_0x477107){if(_0x477107){return _0x477107['update'](_0x30f261)['then'](function(_0x358c6c){return _0x358c6c;});}return null;};}function removeEntity(_0x16c030){return function(_0x3854e2){if(_0x3854e2){return _0x3854e2[_0x61e1('0x24')]()[_0x61e1('0x25')](function(){_0x16c030[_0x61e1('0x1c')](0xcc)[_0x61e1('0x26')]();});}};}function handleEntityNotFound(_0x1a7275){return function(_0x5d6b00){if(!_0x5d6b00){_0x1a7275[_0x61e1('0x27')](0x194);}return _0x5d6b00;};}function handleError(_0x292928,_0x36270f){_0x36270f=_0x36270f||0x1f4;return function(_0x1df8d2){logger['error'](_0x1df8d2['stack']);if(_0x1df8d2[_0x61e1('0x28')]){delete _0x1df8d2[_0x61e1('0x28')];}_0x292928['status'](_0x36270f)[_0x61e1('0x29')](_0x1df8d2);};}exports[_0x61e1('0x2a')]=function(_0x1b9394,_0x52effe){var _0x35bee8={},_0x15deb6={},_0x588bcf={'count':0x0,'rows':[]};var _0x10ab0c=_[_0x61e1('0x2b')](db['FaxMessage'][_0x61e1('0x2c')],function(_0xac7d79){return{'name':_0xac7d79['fieldName'],'type':_0xac7d79[_0x61e1('0x2d')][_0x61e1('0x2e')]};});_0x15deb6[_0x61e1('0x2f')]=_[_0x61e1('0x2b')](_0x10ab0c,'name');_0x15deb6[_0x61e1('0x30')]=_['keys'](_0x1b9394['query']);_0x15deb6['filters']=_[_0x61e1('0x31')](_0x15deb6[_0x61e1('0x2f')],_0x15deb6[_0x61e1('0x30')]);_0x35bee8['attributes']=_[_0x61e1('0x31')](_0x15deb6['model'],qs[_0x61e1('0x32')](_0x1b9394[_0x61e1('0x30')][_0x61e1('0x32')]));_0x35bee8[_0x61e1('0x33')]=_0x35bee8[_0x61e1('0x33')]['length']?_0x35bee8[_0x61e1('0x33')]:_0x15deb6[_0x61e1('0x2f')];if(!_0x1b9394[_0x61e1('0x30')][_0x61e1('0x34')](_0x61e1('0x35'))){_0x35bee8['limit']=qs[_0x61e1('0x21')](_0x1b9394[_0x61e1('0x30')][_0x61e1('0x21')]);_0x35bee8['offset']=qs[_0x61e1('0x1e')](_0x1b9394[_0x61e1('0x30')][_0x61e1('0x1e')]);}_0x35bee8[_0x61e1('0x36')]=qs['sort'](_0x1b9394[_0x61e1('0x30')]['sort']);_0x35bee8[_0x61e1('0x37')]=qs['filters'](_[_0x61e1('0x38')](_0x1b9394[_0x61e1('0x30')],_0x15deb6[_0x61e1('0x39')]),_0x10ab0c);if(_0x1b9394[_0x61e1('0x30')][_0x61e1('0x3a')]){_0x35bee8[_0x61e1('0x37')]=_[_0x61e1('0x3b')](_0x35bee8[_0x61e1('0x37')],{'$or':_[_0x61e1('0x2b')](_0x10ab0c,function(_0x8555a0){if(_0x8555a0[_0x61e1('0x2d')]!==_0x61e1('0x3c')){var _0x471b86={};_0x471b86[_0x8555a0[_0x61e1('0x28')]]={'$like':'%'+_0x1b9394['query'][_0x61e1('0x3a')]+'%'};return _0x471b86;}})});}_0x35bee8=_[_0x61e1('0x3b')]({},_0x35bee8,_0x1b9394['options']);var _0xe85e9a={'where':_0x35bee8[_0x61e1('0x37')]};return db[_0x61e1('0x3d')][_0x61e1('0x20')](_0xe85e9a)[_0x61e1('0x25')](function(_0x29dbaa){_0x588bcf[_0x61e1('0x20')]=_0x29dbaa;if(_0x1b9394['query'][_0x61e1('0x3e')]){_0x35bee8['include']=[{'all':!![]}];}return db[_0x61e1('0x3d')]['findAll'](_0x35bee8);})[_0x61e1('0x25')](function(_0x55c71f){_0x588bcf[_0x61e1('0x3f')]=_0x55c71f;return _0x588bcf;})['then'](respondWithFilteredResult(_0x52effe,_0x35bee8))[_0x61e1('0x1b')](handleError(_0x52effe,null));};exports[_0x61e1('0x40')]=function(_0x35037f,_0x2f0f41){var _0xf5d2fe={'raw':!![],'where':{'id':_0x35037f['params']['id']}},_0x491805={};_0x491805[_0x61e1('0x2f')]=_[_0x61e1('0x41')](db[_0x61e1('0x3d')][_0x61e1('0x2c')]);_0x491805[_0x61e1('0x30')]=_[_0x61e1('0x41')](_0x35037f[_0x61e1('0x30')]);_0x491805[_0x61e1('0x39')]=_[_0x61e1('0x31')](_0x491805[_0x61e1('0x2f')],_0x491805[_0x61e1('0x30')]);_0xf5d2fe[_0x61e1('0x33')]=_[_0x61e1('0x31')](_0x491805[_0x61e1('0x2f')],qs[_0x61e1('0x32')](_0x35037f[_0x61e1('0x30')][_0x61e1('0x32')]));_0xf5d2fe[_0x61e1('0x33')]=_0xf5d2fe['attributes'][_0x61e1('0x42')]?_0xf5d2fe[_0x61e1('0x33')]:_0x491805['model'];if(_0x35037f[_0x61e1('0x30')][_0x61e1('0x3e')]){_0xf5d2fe['include']=[{'all':!![]}];}_0xf5d2fe=_['merge']({},_0xf5d2fe,_0x35037f[_0x61e1('0x43')]);return db['FaxMessage'][_0x61e1('0x44')](_0xf5d2fe)[_0x61e1('0x25')](handleEntityNotFound(_0x2f0f41,null))[_0x61e1('0x25')](respondWithResult(_0x2f0f41,null))['catch'](handleError(_0x2f0f41,null));};exports[_0x61e1('0x45')]=function(_0x5babaf,_0x1516d9){if(_0x5babaf[_0x61e1('0x46')]['id']){delete _0x5babaf['body']['id'];}return db[_0x61e1('0x3d')]['find']({'where':{'id':_0x5babaf['params']['id']}})[_0x61e1('0x25')](handleEntityNotFound(_0x1516d9,null))[_0x61e1('0x25')](saveUpdates(_0x5babaf[_0x61e1('0x46')],null))[_0x61e1('0x25')](respondWithResult(_0x1516d9,null))[_0x61e1('0x1b')](handleError(_0x1516d9,null));};exports[_0x61e1('0x24')]=function(_0x7b4c5b,_0x498437){return db[_0x61e1('0x3d')]['find']({'where':{'id':_0x7b4c5b[_0x61e1('0x47')]['id']}})[_0x61e1('0x25')](handleEntityNotFound(_0x498437,null))[_0x61e1('0x25')](removeEntity(_0x498437,null))[_0x61e1('0x1b')](handleError(_0x498437,null));};exports[_0x61e1('0x48')]=function(_0x389c7f,_0x126c27){return db[_0x61e1('0x3d')][_0x61e1('0x48')]()[_0x61e1('0x25')](respondWithResult(_0x126c27,null))[_0x61e1('0x1b')](handleError(_0x126c27,null));};exports[_0x61e1('0x49')]=function(_0x1a3152,_0x329e1b){var _0x336b71=_0x61e1('0x4a');return interactionService['acceptMessage'](_0x1a3152,_0x336b71)[_0x61e1('0x25')](respondWithResult(_0x329e1b,null))[_0x61e1('0x1b')](handleError(_0x329e1b,null));};exports['accept']=function(_0x5e4706,_0x519b9a){var _0x2636e9=_0x61e1('0x4b');return interactionService['acceptMessage'](_0x5e4706,_0x2636e9)['then'](respondWithResult(_0x519b9a,null))[_0x61e1('0x1b')](handleError(_0x519b9a,null));};exports[_0x61e1('0x4c')]=function(_0x12b8e2,_0x429302){var _0x21649e={'agent':{},'channel':'fax'};if(_0x12b8e2[_0x61e1('0x46')]['id']){delete _0x12b8e2[_0x61e1('0x46')]['id'];}_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')]=_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')]||_0x12b8e2[_0x61e1('0x4e')]['id'];_0x21649e[_0x61e1('0x4f')]['id']=_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')];return db['FaxMessage'][_0x61e1('0x44')]({'where':{'id':_0x12b8e2[_0x61e1('0x47')]['id'],'UserId':null}})[_0x61e1('0x25')](handleEntityNotFound(_0x429302,null))[_0x61e1('0x25')](function(_0x9e6204){if(_0x9e6204){_0x21649e[_0x61e1('0x19')]=_0x9e6204['get']({'plain':!![]});return db[_0x61e1('0x50')][_0x61e1('0x44')]({'where':{'id':_0x9e6204[_0x61e1('0x51')]}});}return null;})[_0x61e1('0x25')](handleEntityNotFound(_0x429302,null))[_0x61e1('0x25')](function(_0x39f32e){if(_0x39f32e){_0x21649e[_0x61e1('0x52')]=_0x39f32e[_0x61e1('0x53')]({'plain':!![]});interaction_log['info']('[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x12b8e2[_0x61e1('0x4e')]['id'],_0x12b8e2['user'][_0x61e1('0x28')],_0x12b8e2['user'][_0x61e1('0x54')],_0x21649e[_0x61e1('0x52')]['id'],_0x12b8e2[_0x61e1('0x46')]?JSON[_0x61e1('0x55')](_0x12b8e2[_0x61e1('0x46')]):_0x61e1('0x56'));return respondWithRpcPromise('RejectMessage',_0x61e1('0x57'),_0x21649e);}return null;})[_0x61e1('0x25')](function(_0x21da3d){var _0x1a2ed2=_0x61e1('0x58')+_0x21da3d[_0x61e1('0x19')]['ContactId'];return db[_0x61e1('0x59')]['query'](_0x1a2ed2,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x61e1('0x25')](function(_0x2e0d8a){return _0x2e0d8a;});})[_0x61e1('0x25')](function(_0x52716e){if(_0x52716e){_0x21649e['message'][_0x61e1('0x5a')]=_0x52716e[0x0];if(!_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')])return;return db[_0x61e1('0x5b')][_0x61e1('0x44')]({'where':{'id':_0x12b8e2[_0x61e1('0x46')][_0x61e1('0x4d')],'role':_0x61e1('0x4f')},'attributes':['id','name',_0x61e1('0x5c'),_0x61e1('0x5d'),_0x61e1('0x5e')],'raw':!![]});}return null;})['then'](function(_0x429820){if(!_0x429820)return null;_0x21649e[_0x61e1('0x19')]['agent']=_0x429820;return _0x21649e;})[_0x61e1('0x25')](function(_0x2238b9){if(_0x2238b9){_0x2238b9['message'][_0x61e1('0x5f')]=util[_0x61e1('0x60')](_0x61e1('0x61'),_0x12b8e2[_0x61e1('0x4e')][_0x61e1('0x28')]);_0x2238b9['message']['channel']=_0x21649e[_0x61e1('0x62')];_0x2238b9[_0x61e1('0x19')][_0x61e1('0x63')]=_0x21649e[_0x61e1('0x62')];_0x2238b9['message'][_0x61e1('0x64')]=_0x61e1('0x4c');respondWithRpcPromise('EventManager',_0x61e1('0x65'),{'event':_0x61e1('0x66'),'message':_0x2238b9['message']},client9002);return _0x21649e;}return null;})['then'](respondWithResult(_0x429302,null))[_0x61e1('0x1b')](handleError(_0x429302,null));};exports[_0x61e1('0x67')]=function(_0x58a4bc,_0x397fab){var _0x5684ae;return db[_0x61e1('0x3d')][_0x61e1('0x67')](_0x58a4bc['body'],{})[_0x61e1('0x25')](function(_0x20fe53){_0x5684ae=_0x20fe53;return db[_0x61e1('0x68')][_0x61e1('0x69')]({'where':{'id':_0x5684ae[_0x61e1('0x6a')]}});})['then'](function(_0x18534c){if(_[_0x61e1('0x6b')](_0x18534c)){return;}else{_0x5684ae[_0x61e1('0x4b')]=_0x18534c['fax'];return db[_0x61e1('0x6c')]['findOne']({'where':{'id':_0x5684ae[_0x61e1('0x6d')]}});}})[_0x61e1('0x25')](function(_0x48d081){return respondWithRpcPromise('SendFax',_0x61e1('0x6e'),{'FaxAccountId':_['isNil'](_0x58a4bc['body'])?undefined:_0x58a4bc[_0x61e1('0x46')][_0x61e1('0x6f')],'path':_[_0x61e1('0x6b')](_0x48d081)?undefined:util['format'](_0x61e1('0x70'),_0x48d081[_0x61e1('0x71')]),'fax':_['isNil'](_0x5684ae[_0x61e1('0x4b')])?undefined:_0x5684ae['fax'],'AttachmentId':_0x5684ae[_0x61e1('0x6d')]},client9002);})['then'](respondWithResult(_0x397fab,0xc9))['catch'](handleError(_0x397fab,null));};exports['download']=function(_0x23c552,_0x1ae3f6){var _0x49b298=path[_0x61e1('0x72')](config[_0x61e1('0x73')],'server',_0x61e1('0x74'),'attachments');return db[_0x61e1('0x3d')][_0x61e1('0x44')]({'where':{'id':_0x23c552[_0x61e1('0x47')]['id']},'include':[{'model':db[_0x61e1('0x6c')],'as':_0x61e1('0x6c')}]})[_0x61e1('0x25')](handleEntityNotFound(_0x1ae3f6,null))[_0x61e1('0x25')](function(_0x5c5abf){if(_0x5c5abf){return _0x1ae3f6[_0x61e1('0x75')](path[_0x61e1('0x72')](_0x49b298,_0x5c5abf['Attachment']['basename']));}})[_0x61e1('0x1b')](handleError(_0x1ae3f6,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 24bf7a7..1fa57e6 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 _0xdb7e=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x47d6dc,_0xc036cc){var _0x1a1c93=function(_0x18ec96){while(--_0x18ec96){_0x47d6dc['push'](_0x47d6dc['shift']());}};_0x1a1c93(++_0xc036cc);}(_0xdb7e,0x11a));var _0xedb7=function(_0x2b6e5d,_0x417c59){_0x2b6e5d=_0x2b6e5d-0x0;var _0x77d8c8=_0xdb7e[_0x2b6e5d];return _0x77d8c8;};'use strict';var EventEmitter=require(_0xedb7('0x0'));var FaxMessage=require(_0xedb7('0x1'))['db'][_0xedb7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xedb7('0x3'),'afterUpdate':_0xedb7('0x4'),'afterDestroy':_0xedb7('0x5')};function emitEvent(_0x58fc55){return function(_0x16179a,_0x4130d2,_0x40f048){FaxMessageEvents[_0xedb7('0x6')](_0x58fc55+':'+_0x16179a['id'],_0x16179a);FaxMessageEvents[_0xedb7('0x6')](_0x58fc55,_0x16179a);_0x40f048(null);};}for(var e in events){if(events[_0xedb7('0x7')](e)){var event=events[e];FaxMessage[_0xedb7('0x8')](e,emitEvent(event));}}module[_0xedb7('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0x2b47=['FaxMessage','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events'];(function(_0x35e6df,_0x4d7818){var _0x22133e=function(_0x5438ef){while(--_0x5438ef){_0x35e6df['push'](_0x35e6df['shift']());}};_0x22133e(++_0x4d7818);}(_0x2b47,0x177));var _0x72b4=function(_0x54384a,_0x1c26bc){_0x54384a=_0x54384a-0x0;var _0x495f12=_0x2b47[_0x54384a];return _0x495f12;};'use strict';var EventEmitter=require(_0x72b4('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x72b4('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x72b4('0x2')](0x0);var events={'afterCreate':_0x72b4('0x3'),'afterUpdate':'update','afterDestroy':_0x72b4('0x4')};function emitEvent(_0x299680){return function(_0x2a3f83,_0x302681,_0x160600){FaxMessageEvents[_0x72b4('0x5')](_0x299680+':'+_0x2a3f83['id'],_0x2a3f83);FaxMessageEvents['emit'](_0x299680,_0x2a3f83);_0x160600(null);};}for(var e in events){if(events[_0x72b4('0x6')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x72b4('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index d314c0e..478764a 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 _0x3464=['out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','./faxMessage.attributes','exports','define','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3464,0xed));var _0x4346=function(_0x453550,_0x398ebd){_0x453550=_0x453550-0x0;var _0x16cea6=_0x3464[_0x453550];return _0x16cea6;};'use strict';var _=require(_0x4346('0x0'));var util=require(_0x4346('0x1'));var logger=require('../../config/logger')(_0x4346('0x2'));var moment=require(_0x4346('0x3'));var BPromise=require('bluebird');var rp=require(_0x4346('0x4'));var fs=require('fs');var path=require(_0x4346('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4346('0x6'));module[_0x4346('0x7')]=function(_0x178d93,_0x44aee2){return _0x178d93[_0x4346('0x8')]('FaxMessage',attributes,{'tableName':_0x4346('0x9'),'paranoid':![],'indexes':[{'name':_0x4346('0xa'),'fields':['body'],'type':_0x4346('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57fbb0,_0x1f6b23,_0x3ec35c){var _0x2cc3bc=_0x178d93['models'];var _0x80878=_0x57fbb0[_0x4346('0xc')]({'plain':!![]});if(_0x80878[_0x4346('0xd')][_0x4346('0xe')]()==='in'||_0x80878[_0x4346('0xd')][_0x4346('0xe')]()===_0x4346('0xf')&&!_0x80878[_0x4346('0x10')]&&!_[_0x4346('0x11')](_0x80878[_0x4346('0x12')])){_0x2cc3bc[_0x4346('0x13')][_0x4346('0x14')]({'where':{'id':_0x80878[_0x4346('0x15')]}})[_0x4346('0x16')](function(_0x46e5d3){if(_0x46e5d3){_0x46e5d3[_0x4346('0x17')]({'lastMsgAt':_0x80878['createdAt'],'lastMsgDirection':_0x80878['direction'][_0x4346('0xe')]()});}})[_0x4346('0x18')](function(_0x5de67d){console[_0x4346('0x19')](_0x5de67d);});}_0x3ec35c();}},'charset':_0x4346('0x1a'),'collate':_0x4346('0x1b')});}; \ No newline at end of file +var _0xb14c=['models','direction','toLowerCase','out','secret','isNil','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','FULLTEXT'];(function(_0x4cc588,_0x4a9bc4){var _0x36619d=function(_0x12ee64){while(--_0x12ee64){_0x4cc588['push'](_0x4cc588['shift']());}};_0x36619d(++_0x4a9bc4);}(_0xb14c,0x109));var _0xcb14=function(_0xccd329,_0xc7b4d6){_0xccd329=_0xccd329-0x0;var _0x1f815b=_0xb14c[_0xccd329];return _0x1f815b;};'use strict';var _=require('lodash');var util=require(_0xcb14('0x0'));var logger=require(_0xcb14('0x1'))(_0xcb14('0x2'));var moment=require(_0xcb14('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcb14('0x4'));var config=require(_0xcb14('0x5'));var attributes=require(_0xcb14('0x6'));module[_0xcb14('0x7')]=function(_0x2cdf68,_0x5c3ffc){return _0x2cdf68['define'](_0xcb14('0x8'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0xcb14('0x9')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x22d675,_0x5d5fb3,_0x1db505){var _0x344dd9=_0x2cdf68[_0xcb14('0xa')];var _0x7d39b0=_0x22d675['get']({'plain':!![]});if(_0x7d39b0[_0xcb14('0xb')][_0xcb14('0xc')]()==='in'||_0x7d39b0[_0xcb14('0xb')][_0xcb14('0xc')]()===_0xcb14('0xd')&&!_0x7d39b0[_0xcb14('0xe')]&&!_[_0xcb14('0xf')](_0x7d39b0['UserId'])){_0x344dd9['FaxInteraction'][_0xcb14('0x10')]({'where':{'id':_0x7d39b0[_0xcb14('0x11')]}})[_0xcb14('0x12')](function(_0x13f30a){if(_0x13f30a){_0x13f30a[_0xcb14('0x13')]({'lastMsgAt':_0x7d39b0[_0xcb14('0x14')],'lastMsgDirection':_0x7d39b0['direction']['toLowerCase']()});}})[_0xcb14('0x15')](function(_0x4d3135){console[_0xcb14('0x16')](_0x4d3135);});}_0x1db505();}},'charset':_0xcb14('0x17'),'collate':_0xcb14('0x18')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index eb14432..9371c2a 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 _0xda55=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateFaxMessage','FaxMessage','body','options','raw','catch','update','where','limit','debug','UpdateFaxMessage','lodash','util'];(function(_0x117671,_0x55b297){var _0x5dc12d=function(_0x3ba977){while(--_0x3ba977){_0x117671['push'](_0x117671['shift']());}};_0x5dc12d(++_0x55b297);}(_0xda55,0x6d));var _0x5da5=function(_0x56c4b8,_0x17f78d){_0x56c4b8=_0x56c4b8-0x0;var _0x222836=_0xda55[_0x56c4b8];return _0x222836;};'use strict';var _=require(_0x5da5('0x0'));var util=require(_0x5da5('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5da5('0x2'));var fs=require('fs');var Redis=require(_0x5da5('0x3'));var db=require(_0x5da5('0x4'))['db'];var utils=require(_0x5da5('0x5'));var logger=require(_0x5da5('0x6'))('rpc');var config=require(_0x5da5('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5da5('0x8')]['http']({'port':0x232a});config[_0x5da5('0x9')]=_[_0x5da5('0xa')](config[_0x5da5('0x9')],{'host':_0x5da5('0xb'),'port':0x18eb});var socket=require(_0x5da5('0xc'))(new Redis(config[_0x5da5('0x9')]));require(_0x5da5('0xd'))[_0x5da5('0xe')](socket);function respondWithRpcPromise(_0x5c056f,_0x3ed24c,_0x1f98a7){return new BPromise(function(_0x2731a3,_0x26fbe3){return client[_0x5da5('0xf')](_0x5c056f,_0x1f98a7)[_0x5da5('0x10')](function(_0x33313e){logger['info'](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));logger['debug'](_0x5da5('0x13'),_0x3ed24c,_0x5da5('0x12'),JSON[_0x5da5('0x14')](_0x33313e));if(_0x33313e[_0x5da5('0x15')]){if(_0x33313e[_0x5da5('0x15')][_0x5da5('0x16')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x3ed24c,_0x33313e['error'][_0x5da5('0x17')]);return _0x26fbe3(_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);}logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x33313e[_0x5da5('0x15')][_0x5da5('0x17')]);return _0x2731a3(_0x33313e['error'][_0x5da5('0x17')]);}else{logger[_0x5da5('0x18')](_0x5da5('0x11'),_0x3ed24c,_0x5da5('0x12'));_0x2731a3(_0x33313e[_0x5da5('0x19')][_0x5da5('0x17')]);}})['catch'](function(_0x1920e2){logger[_0x5da5('0x15')](_0x5da5('0x11'),_0x3ed24c,_0x1920e2);_0x26fbe3(_0x1920e2);});});}exports[_0x5da5('0x1a')]=function(_0xf023af){var _0x513a34=this;return new Promise(function(_0x4393d7,_0x3372fc){return db[_0x5da5('0x1b')]['create'](_0xf023af[_0x5da5('0x1c')],{'raw':_0xf023af[_0x5da5('0x1d')]?_0xf023af[_0x5da5('0x1d')][_0x5da5('0x1e')]===undefined?!![]:![]:!![]})[_0x5da5('0x10')](function(_0x436960){logger['info'](_0x5da5('0x1a'),_0xf023af);logger['debug'](_0x5da5('0x1a'),_0xf023af,JSON[_0x5da5('0x14')](_0x436960));_0x4393d7(_0x436960);})[_0x5da5('0x1f')](function(_0x5d983c){logger[_0x5da5('0x15')](_0x5da5('0x1a'),_0x5d983c[_0x5da5('0x17')],_0xf023af);_0x3372fc(_0x513a34[_0x5da5('0x15')](0x1f4,_0x5d983c['message']));});});};exports['UpdateFaxMessage']=function(_0x50aadc){var _0x3526cf=this;return new Promise(function(_0x56d509,_0x4e8890){return db[_0x5da5('0x1b')][_0x5da5('0x20')](_0x50aadc['body'],{'raw':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x21')]||null:null,'attributes':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')]['attributes']||null:null,'limit':_0x50aadc[_0x5da5('0x1d')]?_0x50aadc[_0x5da5('0x1d')][_0x5da5('0x22')]||null:null})[_0x5da5('0x10')](function(_0x55e2bf){logger['info']('UpdateFaxMessage',_0x50aadc);logger[_0x5da5('0x23')](_0x5da5('0x24'),_0x50aadc,JSON[_0x5da5('0x14')](_0x55e2bf));_0x56d509(_0x55e2bf);})[_0x5da5('0x1f')](function(_0x51b712){logger['error'](_0x5da5('0x24'),_0x51b712['message'],_0x50aadc);_0x4e8890(_0x3526cf['error'](0x1f4,_0x51b712[_0x5da5('0x17')]));});});}; \ No newline at end of file +var _0x2d17=['create','catch','UpdateFaxMessage','FaxMessage','body','options','where','attributes','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateFaxMessage'];(function(_0x40e8b3,_0x14d009){var _0x1f6e27=function(_0x4779d0){while(--_0x4779d0){_0x40e8b3['push'](_0x40e8b3['shift']());}};_0x1f6e27(++_0x14d009);}(_0x2d17,0x17e));var _0x72d1=function(_0x5c6d2a,_0x15c969){_0x5c6d2a=_0x5c6d2a-0x0;var _0x3dd62b=_0x2d17[_0x5c6d2a];return _0x3dd62b;};'use strict';var _=require(_0x72d1('0x0'));var util=require(_0x72d1('0x1'));var moment=require('moment');var BPromise=require(_0x72d1('0x2'));var rs=require(_0x72d1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72d1('0x4'))['db'];var utils=require(_0x72d1('0x5'));var logger=require('../../config/logger')(_0x72d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x72d1('0x7'));var client=jayson['client'][_0x72d1('0x8')]({'port':0x232a});config[_0x72d1('0x9')]=_['defaults'](config[_0x72d1('0x9')],{'host':_0x72d1('0xa'),'port':0x18eb});var socket=require(_0x72d1('0xb'))(new Redis(config['redis']));require(_0x72d1('0xc'))[_0x72d1('0xd')](socket);function respondWithRpcPromise(_0x283775,_0x593c91,_0x1d7520){return new BPromise(function(_0x3a35c6,_0x45eb4a){return client[_0x72d1('0xe')](_0x283775,_0x1d7520)[_0x72d1('0xf')](function(_0x3916f2){logger[_0x72d1('0x10')](_0x72d1('0x11'),_0x593c91,_0x72d1('0x12'));logger[_0x72d1('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'),JSON[_0x72d1('0x14')](_0x3916f2));if(_0x3916f2[_0x72d1('0x15')]){if(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x16')]===0x1f4){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);return _0x45eb4a(_0x3916f2[_0x72d1('0x15')][_0x72d1('0x17')]);}logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x3916f2['error'][_0x72d1('0x17')]);return _0x3a35c6(_0x3916f2['error'][_0x72d1('0x17')]);}else{logger[_0x72d1('0x10')]('FaxMessage,\x20%s,\x20%s',_0x593c91,_0x72d1('0x12'));_0x3a35c6(_0x3916f2[_0x72d1('0x18')][_0x72d1('0x17')]);}})['catch'](function(_0x4925f6){logger[_0x72d1('0x15')](_0x72d1('0x11'),_0x593c91,_0x4925f6);_0x45eb4a(_0x4925f6);});});}exports[_0x72d1('0x19')]=function(_0x1865c1){var _0x8d6890=this;return new Promise(function(_0x2253fd,_0x1e2411){return db['FaxMessage'][_0x72d1('0x1a')](_0x1865c1['body'],{'raw':_0x1865c1['options']?_0x1865c1['options']['raw']===undefined?!![]:![]:!![]})[_0x72d1('0xf')](function(_0x374602){logger['info'](_0x72d1('0x19'),_0x1865c1);logger[_0x72d1('0x13')](_0x72d1('0x19'),_0x1865c1,JSON[_0x72d1('0x14')](_0x374602));_0x2253fd(_0x374602);})[_0x72d1('0x1b')](function(_0x4e6acd){logger['error'](_0x72d1('0x19'),_0x4e6acd[_0x72d1('0x17')],_0x1865c1);_0x1e2411(_0x8d6890[_0x72d1('0x15')](0x1f4,_0x4e6acd[_0x72d1('0x17')]));});});};exports[_0x72d1('0x1c')]=function(_0x33d530){var _0x163bec=this;return new Promise(function(_0x589f7c,_0x57ec9e){return db[_0x72d1('0x1d')]['update'](_0x33d530[_0x72d1('0x1e')],{'raw':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33d530[_0x72d1('0x1f')]?_0x33d530['options'][_0x72d1('0x20')]||null:null,'attributes':_0x33d530[_0x72d1('0x1f')]?_0x33d530[_0x72d1('0x1f')][_0x72d1('0x21')]||null:null,'limit':_0x33d530['options']?_0x33d530[_0x72d1('0x1f')]['limit']||null:null})[_0x72d1('0xf')](function(_0x32dc5e){logger['info'](_0x72d1('0x1c'),_0x33d530);logger[_0x72d1('0x13')](_0x72d1('0x1c'),_0x33d530,JSON[_0x72d1('0x14')](_0x32dc5e));_0x589f7c(_0x32dc5e);})[_0x72d1('0x1b')](function(_0x52511f){logger[_0x72d1('0x15')](_0x72d1('0x1c'),_0x52511f[_0x72d1('0x17')],_0x33d530);_0x57ec9e(_0x163bec['error'](0x1f4,_0x52511f[_0x72d1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index c93507a..5b05a06 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 _0x5ccb=['save','remove','update','emit','removeListener','register','length','faxMessage:','./faxMessage.events'];(function(_0x1621dd,_0x172229){var _0x3b0046=function(_0x53ab32){while(--_0x53ab32){_0x1621dd['push'](_0x1621dd['shift']());}};_0x3b0046(++_0x172229);}(_0x5ccb,0x1a6));var _0xb5cc=function(_0x1e5068,_0x31e9c4){_0x1e5068=_0x1e5068-0x0;var _0x2230b6=_0x5ccb[_0x1e5068];return _0x2230b6;};'use strict';var FaxMessageEvents=require(_0xb5cc('0x0'));var events=[_0xb5cc('0x1'),_0xb5cc('0x2'),_0xb5cc('0x3')];function createListener(_0x1f5a1f,_0x2c9a03){return function(_0x21796e){_0x2c9a03[_0xb5cc('0x4')](_0x1f5a1f,_0x21796e);};}function removeListener(_0x3c02af,_0x45d7e2){return function(){FaxMessageEvents[_0xb5cc('0x5')](_0x3c02af,_0x45d7e2);};}exports[_0xb5cc('0x6')]=function(_0x2a017f){for(var _0x5102a3=0x0,_0x384d63=events[_0xb5cc('0x7')];_0x5102a3<_0x384d63;_0x5102a3++){var _0x5170dd=events[_0x5102a3];var _0x19e066=createListener(_0xb5cc('0x8')+_0x5170dd,_0x2a017f);FaxMessageEvents['on'](_0x5170dd,_0x19e066);}}; \ No newline at end of file +var _0x38f5=['length','./faxMessage.events','remove','emit','register'];(function(_0x3c19ee,_0x18472e){var _0x5daa83=function(_0x138404){while(--_0x138404){_0x3c19ee['push'](_0x3c19ee['shift']());}};_0x5daa83(++_0x18472e);}(_0x38f5,0x1b4));var _0x538f=function(_0x1f327e,_0x3f458b){_0x1f327e=_0x1f327e-0x0;var _0x124b2d=_0x38f5[_0x1f327e];return _0x124b2d;};'use strict';var FaxMessageEvents=require(_0x538f('0x0'));var events=['save',_0x538f('0x1'),'update'];function createListener(_0x3e4823,_0xf03ca5){return function(_0x2bda5a){_0xf03ca5[_0x538f('0x2')](_0x3e4823,_0x2bda5a);};}function removeListener(_0x52e5f8,_0x53d0c8){return function(){FaxMessageEvents['removeListener'](_0x52e5f8,_0x53d0c8);};}exports[_0x538f('0x3')]=function(_0x1688a6){for(var _0x2bfdf2=0x0,_0x2a224e=events[_0x538f('0x4')];_0x2bfdf2<_0x2a224e;_0x2bfdf2++){var _0x4b6b5d=events[_0x2bfdf2];var _0x3bc068=createListener('faxMessage:'+_0x4b6b5d,_0x1688a6);FaxMessageEvents['on'](_0x4b6b5d,_0x3bc068);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 507afc9..2ae067a 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 _0x6c76=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe','/:id','show','/:id/download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','util'];(function(_0x9e0cb3,_0x9cd497){var _0x5926b7=function(_0x30e82d){while(--_0x30e82d){_0x9e0cb3['push'](_0x9e0cb3['shift']());}};_0x5926b7(++_0x9cd497);}(_0x6c76,0x184));var _0x66c7=function(_0x19acdb,_0x545136){_0x19acdb=_0x19acdb-0x0;var _0x1b4b4d=_0x6c76[_0x19acdb];return _0x1b4b4d;};'use strict';var multer=require(_0x66c7('0x0'));var util=require(_0x66c7('0x1'));var path=require(_0x66c7('0x2'));var timeout=require('connect-timeout');var express=require(_0x66c7('0x3'));var router=express[_0x66c7('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x66c7('0x5'));var config=require(_0x66c7('0x6'));var controller=require('./faxMessage.controller');router[_0x66c7('0x7')]('/',auth[_0x66c7('0x8')](),controller['index']);router[_0x66c7('0x7')]('/describe',auth['isAuthenticated'](),controller[_0x66c7('0x9')]);router[_0x66c7('0x7')](_0x66c7('0xa'),auth['isAuthenticated'](),controller[_0x66c7('0xb')]);router[_0x66c7('0x7')](_0x66c7('0xc'),auth[_0x66c7('0x8')](),controller['download']);router[_0x66c7('0xd')]('/',auth[_0x66c7('0x8')](),interaction[_0x66c7('0xe')](_0x66c7('0xf'),_0x66c7('0x10')),controller[_0x66c7('0x11')]);router[_0x66c7('0x12')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x13')]);router[_0x66c7('0x12')](_0x66c7('0x14'),auth[_0x66c7('0x8')](),controller[_0x66c7('0x15')]);router[_0x66c7('0x12')](_0x66c7('0x16'),auth[_0x66c7('0x8')](),controller['reject']);router[_0x66c7('0x17')]('/:id',auth[_0x66c7('0x8')](),controller[_0x66c7('0x18')]);module[_0x66c7('0x19')]=router; \ No newline at end of file +var _0xe205=['../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x913b85,_0x213182){var _0x1ce434=function(_0x4c9c8b){while(--_0x4c9c8b){_0x913b85['push'](_0x913b85['shift']());}};_0x1ce434(++_0x213182);}(_0xe205,0xa7));var _0x5e20=function(_0x46ca33,_0x1074ec){_0x46ca33=_0x46ca33-0x0;var _0x524108=_0xe205[_0x46ca33];return _0x524108;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 7ec67c6..b07b0b1 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 _0x72e3=['roundrobin','sequelize','STRING','name','INTEGER','ENUM','beepall'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x72e3,0x6a));var _0x372e=function(_0x53ecf2,_0x417dd2){_0x53ecf2=_0x53ecf2-0x0;var _0x1e087b=_0x72e3[_0x53ecf2];return _0x1e087b;};'use strict';var Sequelize=require(_0x372e('0x0'));module['exports']={'name':{'type':Sequelize[_0x372e('0x1')],'unique':_0x372e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x372e('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x372e('0x4')]('rrmemory',_0x372e('0x5'),_0x372e('0x6')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x372e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbff5=['STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x246573,_0x856eb9){var _0x441c04=function(_0x2a28bb){while(--_0x2a28bb){_0x246573['push'](_0x246573['shift']());}};_0x441c04(++_0x856eb9);}(_0xbff5,0x180));var _0x5bff=function(_0x1ffd9a,_0x1ecad0){_0x1ffd9a=_0x1ffd9a-0x0;var _0x53d2db=_0xbff5[_0x1ffd9a];return _0x53d2db;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5bff('0x0')],'unique':_0x5bff('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5bff('0x0')]},'timeout':{'type':Sequelize[_0x5bff('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5bff('0x3')](_0x5bff('0x4'),'beepall',_0x5bff('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.controller.js b/server/api/faxQueue/faxQueue.controller.js index 26b95c6..a2c6f21 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 _0xed1c=['userFaxQueue:remove','getAgents','bluebird','util','../../config/logger','api','../../config/environment','redis','defaults','localhost','./faxQueue.socket','register','sendStatus','status','json','undefined','limit','offset','count','Content-Range','update','then','destroy','get','FaxQueues','end','error','stack','name','send','map','FaxQueue','fieldName','type','key','getOptions','where','include','findAll','show','params','model','keys','rawAttributes','query','intersection','attributes','length','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','catch','describe','findOne','UserFaxQueue','filters','fields','hasOwnProperty','nolimit','order','sort','filter','User','findAndCountAll','UserId','agent','createdAt','rows','%s/%s','SIP','faxPause','updatedAt','Team','pick','getTeams','online','flatMap','Agents','sequelize','transaction','addTeams','forEach','emit','userFaxQueue:save','ids','select','field','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','SELECT','includes','all','union','value','removeTeams','removeAgents','addAgents','omit','spread','isArray'];(function(_0x55c2a5,_0x3ab35b){var _0x177d1d=function(_0x130a2b){while(--_0x130a2b){_0x55c2a5['push'](_0x55c2a5['shift']());}};_0x177d1d(++_0x3ab35b);}(_0xed1c,0xe4));var _0xced1=function(_0x3afbca,_0x4a8622){_0x3afbca=_0x3afbca-0x0;var _0x48ffe2=_0xed1c[_0x3afbca];return _0x48ffe2;};'use strict';var BPromise=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xced1('0x2'))(_0xced1('0x3'));var config=require(_0xced1('0x4'));var db=require('../../mysqldb')['db'];config[_0xced1('0x5')]=_[_0xced1('0x6')](config[_0xced1('0x5')],{'host':_0xced1('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xced1('0x5')]));require(_0xced1('0x8'))[_0xced1('0x9')](socket);function respondWithStatusCode(_0x1fb40b,_0x354203){_0x354203=_0x354203||0xcc;return function(_0x3221b6){if(_0x3221b6){return _0x1fb40b[_0xced1('0xa')](_0x354203);}return _0x1fb40b[_0xced1('0xb')](_0x354203)['end']();};}function respondWithResult(_0x82c84e,_0x59c820){_0x59c820=_0x59c820||0xc8;return function(_0x3464f3){if(_0x3464f3){return _0x82c84e[_0xced1('0xb')](_0x59c820)[_0xced1('0xc')](_0x3464f3);}};}function respondWithFilteredResult(_0x18c028,_0x15f678){return function(_0x44b05c){if(_0x44b05c){var _0x3779d3=typeof _0x15f678['offset']===_0xced1('0xd')&&typeof _0x15f678[_0xced1('0xe')]===_0xced1('0xd');var _0x52d96a=_0x44b05c['count'];var _0xdaaea7=_0x3779d3?0x0:_0x15f678[_0xced1('0xf')];var _0x54cba9=_0x3779d3?_0x44b05c[_0xced1('0x10')]:_0x15f678[_0xced1('0xf')]+_0x15f678[_0xced1('0xe')];var _0x32100b;if(_0x54cba9>=_0x52d96a){_0x54cba9=_0x52d96a;_0x32100b=0xc8;}else{_0x32100b=0xce;}_0x18c028['status'](_0x32100b);return _0x18c028['set'](_0xced1('0x11'),_0xdaaea7+'-'+_0x54cba9+'/'+_0x52d96a)[_0xced1('0xc')](_0x44b05c);}return null;};}function saveUpdates(_0x236473){return function(_0x17e8ab){if(_0x17e8ab){return _0x17e8ab[_0xced1('0x12')](_0x236473)[_0xced1('0x13')](function(_0x5a563a){return _0x5a563a;});}return null;};}function removeEntity(_0x56fc50){return function(_0x2a92c8){if(_0x2a92c8){return _0x2a92c8[_0xced1('0x14')]()[_0xced1('0x13')](function(){var _0x5257e7=_0x2a92c8[_0xced1('0x15')]({'plain':!![]});var _0x25f0df=_0xced1('0x16');return db['UserProfileResource'][_0xced1('0x14')]({'where':{'type':_0x25f0df,'resourceId':_0x5257e7['id']}})[_0xced1('0x13')](function(){return _0x2a92c8;});})[_0xced1('0x13')](function(){_0x56fc50['status'](0xcc)[_0xced1('0x17')]();});}};}function handleEntityNotFound(_0x624349){return function(_0xc1bd39){if(!_0xc1bd39){_0x624349['sendStatus'](0x194);}return _0xc1bd39;};}function handleError(_0x4dab56,_0x1d3884){_0x1d3884=_0x1d3884||0x1f4;return function(_0x41ee91){logger[_0xced1('0x18')](_0x41ee91[_0xced1('0x19')]);if(_0x41ee91[_0xced1('0x1a')]){delete _0x41ee91['name'];}_0x4dab56[_0xced1('0xb')](_0x1d3884)[_0xced1('0x1b')](_0x41ee91);};}exports['index']=function(_0x5f2018,_0x38f738){var _0x258c9a={};var _0x3af9c0={'count':0x0,'rows':[]};var _0x3912fe=_[_0xced1('0x1c')](db[_0xced1('0x1d')]['rawAttributes'],function(_0x181f6e){return{'name':_0x181f6e[_0xced1('0x1e')],'type':_0x181f6e[_0xced1('0x1f')][_0xced1('0x20')]};});_0x258c9a=qs[_0xced1('0x21')](_0x3912fe,_0x5f2018);var _0x8b3ffb={'where':_0x258c9a[_0xced1('0x22')]};return db['FaxQueue'][_0xced1('0x10')](_0x8b3ffb)['then'](function(_0x45cb03){_0x3af9c0[_0xced1('0x10')]=_0x45cb03;_0x258c9a[_0xced1('0x23')]=qs[_0xced1('0x23')](_0x5f2018['query']);return db['FaxQueue'][_0xced1('0x24')](_0x258c9a);})[_0xced1('0x13')](function(_0x2bc785){_0x3af9c0['rows']=_0x2bc785;return _0x3af9c0;})['then'](respondWithFilteredResult(_0x38f738,_0x258c9a))['catch'](handleError(_0x38f738,null));};exports[_0xced1('0x25')]=function(_0x138079,_0x2a6197){var _0x3d4a17={'raw':!![],'where':{'id':_0x138079[_0xced1('0x26')]['id']}},_0x5bb1a8={};_0x5bb1a8[_0xced1('0x27')]=_[_0xced1('0x28')](db[_0xced1('0x1d')][_0xced1('0x29')]);_0x5bb1a8[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x138079['query']);_0x5bb1a8['filters']=_[_0xced1('0x2b')](_0x5bb1a8[_0xced1('0x27')],_0x5bb1a8[_0xced1('0x2a')]);_0x3d4a17[_0xced1('0x2c')]=_[_0xced1('0x2b')](_0x5bb1a8[_0xced1('0x27')],qs['fields'](_0x138079['query']['fields']));_0x3d4a17['attributes']=_0x3d4a17[_0xced1('0x2c')][_0xced1('0x2d')]?_0x3d4a17[_0xced1('0x2c')]:_0x5bb1a8[_0xced1('0x27')];if(_0x138079[_0xced1('0x2a')][_0xced1('0x2e')]){_0x3d4a17[_0xced1('0x23')]=[{'all':!![]}];}_0x3d4a17=_[_0xced1('0x2f')]({},_0x3d4a17,_0x138079[_0xced1('0x30')]);return db[_0xced1('0x1d')][_0xced1('0x31')](_0x3d4a17)[_0xced1('0x13')](handleEntityNotFound(_0x2a6197,null))[_0xced1('0x13')](respondWithResult(_0x2a6197,null))['catch'](handleError(_0x2a6197,null));};exports[_0xced1('0x32')]=function(_0x23db06,_0x1116de){return db[_0xced1('0x1d')][_0xced1('0x32')](_0x23db06[_0xced1('0x33')],{})['then'](function(_0xc7afa1){var _0x3f3632=_0x23db06[_0xced1('0x34')][_0xced1('0x15')]({'plain':!![]});if(!_0x3f3632)throw new Error(_0xced1('0x35'));if(_0x3f3632[_0xced1('0x36')]===_0xced1('0x34')){var _0x31f639=_0xc7afa1[_0xced1('0x15')]({'plain':!![]});var _0x359a10=_0xced1('0x16');return db['UserProfileSection']['find']({'where':{'name':_0x359a10,'userProfileId':_0x3f3632[_0xced1('0x37')]},'raw':!![]})[_0xced1('0x13')](function(_0x1887a3){if(_0x1887a3&&_0x1887a3['autoAssociation']===0x0){return db[_0xced1('0x38')][_0xced1('0x32')]({'name':_0x31f639[_0xced1('0x1a')],'resourceId':_0x31f639['id'],'type':_0x1887a3['name'],'sectionId':_0x1887a3['id']},{})[_0xced1('0x13')](function(){return _0xc7afa1;});}else{return _0xc7afa1;}})[_0xced1('0x39')](function(_0x5a01f6){logger[_0xced1('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a01f6);throw _0x5a01f6;});}return _0xc7afa1;})[_0xced1('0x13')](respondWithResult(_0x1116de,0xc9))[_0xced1('0x39')](handleError(_0x1116de,null));};exports['update']=function(_0x1ddaea,_0x172a7e){if(_0x1ddaea[_0xced1('0x33')]['id']){delete _0x1ddaea['body']['id'];}return db[_0xced1('0x1d')][_0xced1('0x31')]({'where':{'id':_0x1ddaea['params']['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x172a7e,null))['then'](saveUpdates(_0x1ddaea['body'],null))[_0xced1('0x13')](respondWithResult(_0x172a7e,null))['catch'](handleError(_0x172a7e,null));};exports[_0xced1('0x14')]=function(_0x217399,_0xb344a2){return db['FaxQueue'][_0xced1('0x31')]({'where':{'id':_0x217399['params']['id']}})[_0xced1('0x13')](handleEntityNotFound(_0xb344a2,null))[_0xced1('0x13')](removeEntity(_0xb344a2,null))[_0xced1('0x39')](handleError(_0xb344a2,null));};exports[_0xced1('0x3a')]=function(_0x5e20a5,_0x19906c){return db[_0xced1('0x1d')]['describe']()[_0xced1('0x13')](respondWithResult(_0x19906c,null))[_0xced1('0x39')](handleError(_0x19906c,null));};exports['getMembers']=function(_0x1800c8,_0x310122){var _0x1646df={'raw':!![],'where':{}},_0x59f1ba={},_0xc04f2;return db[_0xced1('0x1d')][_0xced1('0x3b')]({'where':{'id':_0x1800c8[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x310122,null))['then'](function(_0x1482cc){if(_0x1482cc){_0xc04f2=_0x1482cc['get']({'plain':!![]});_0x59f1ba[_0xced1('0x27')]=_[_0xced1('0x28')](db[_0xced1('0x3c')][_0xced1('0x29')]);_0x59f1ba[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x1800c8['query']);_0x59f1ba[_0xced1('0x3d')]=_[_0xced1('0x2b')](_0x59f1ba['model'],_0x59f1ba[_0xced1('0x2a')]);_0x1646df['attributes']=_['intersection'](_0x59f1ba[_0xced1('0x27')],qs[_0xced1('0x3e')](_0x1800c8[_0xced1('0x2a')][_0xced1('0x3e')]));_0x1646df['attributes']=_0x1646df[_0xced1('0x2c')][_0xced1('0x2d')]?_0x1646df[_0xced1('0x2c')]:_0x59f1ba['model'];if(!_0x1800c8['query'][_0xced1('0x3f')](_0xced1('0x40'))){_0x1646df[_0xced1('0xe')]=qs[_0xced1('0xe')](_0x1800c8['query']['limit']);_0x1646df['offset']=qs[_0xced1('0xf')](_0x1800c8[_0xced1('0x2a')][_0xced1('0xf')]);}_0x1646df[_0xced1('0x41')]=qs[_0xced1('0x42')](_0x1800c8[_0xced1('0x2a')][_0xced1('0x42')]);_0x1646df[_0xced1('0x22')]=qs[_0xced1('0x3d')](_['pick'](_0x1800c8[_0xced1('0x2a')],_0x59f1ba[_0xced1('0x3d')]));_0x1646df[_0xced1('0x22')]['FaxQueueId']=_0x1482cc['id'];if(_0x1800c8[_0xced1('0x2a')][_0xced1('0x43')]){_0x1646df[_0xced1('0x22')]=_[_0xced1('0x2f')](_0x1646df['where'],{'$or':_[_0xced1('0x1c')](_0x1646df['attributes'],function(_0x539ee2){var _0x1a2b65={};_0x1a2b65[_0x539ee2]={'$like':'%'+_0x1800c8[_0xced1('0x2a')]['filter']+'%'};return _0x1a2b65;})});}_0x1646df=_['merge']({},_0x1646df,_0x1800c8['options']);return db[_0xced1('0x3c')]['findAll'](_0x1646df);}})[_0xced1('0x13')](function(_0x33df96){if(_0x33df96){return db[_0xced1('0x44')][_0xced1('0x45')]({'where':{'id':_[_0xced1('0x1c')](_0x33df96,_0xced1('0x46')),'role':_0xced1('0x47')},'attributes':['id',_0xced1('0x1a'),'faxPause','updatedAt',_0xced1('0x48')]});}})[_0xced1('0x13')](function(_0x235651){if(_0x235651){return{'count':_0x235651[_0xced1('0x10')],'rows':_['map'](_0x235651[_0xced1('0x49')],function(_0x31df4e){return{'membername':_0x31df4e[_0xced1('0x1a')],'UserId':_0x31df4e['id'],'queue_name':_0xc04f2[_0xced1('0x1a')],'FaxQueueId':_0xc04f2['id'],'interface':util['format'](_0xced1('0x4a'),_0xced1('0x4b'),_0x31df4e[_0xced1('0x1a')]),'penalty':0x0,'paused':_0x31df4e[_0xced1('0x4c')],'createdAt':_0x31df4e[_0xced1('0x48')],'updatedAt':_0x31df4e[_0xced1('0x4d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xced1('0x13')](respondWithFilteredResult(_0x310122,_0x1646df))[_0xced1('0x39')](handleError(_0x310122,null));};exports['getTeams']=function(_0x4bebc8,_0x4cc559){var _0x440b22={};var _0x52e873={};var _0x398264;var _0x5d28cc;return db['FaxQueue'][_0xced1('0x3b')]({'where':{'id':_0x4bebc8[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x4cc559,null))[_0xced1('0x13')](function(_0x58d773){if(_0x58d773){_0x398264=_0x58d773;_0x52e873[_0xced1('0x27')]=_[_0xced1('0x28')](db[_0xced1('0x4e')][_0xced1('0x29')]);_0x52e873[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x4bebc8['query']);_0x52e873[_0xced1('0x3d')]=_[_0xced1('0x2b')](_0x52e873['model'],_0x52e873[_0xced1('0x2a')]);_0x440b22[_0xced1('0x2c')]=_['intersection'](_0x52e873[_0xced1('0x27')],qs[_0xced1('0x3e')](_0x4bebc8[_0xced1('0x2a')][_0xced1('0x3e')]));_0x440b22[_0xced1('0x2c')]=_0x440b22['attributes']['length']?_0x440b22['attributes']:_0x52e873[_0xced1('0x27')];_0x440b22[_0xced1('0x41')]=qs['sort'](_0x4bebc8[_0xced1('0x2a')][_0xced1('0x42')]);_0x440b22[_0xced1('0x22')]=qs['filters'](_[_0xced1('0x4f')](_0x4bebc8[_0xced1('0x2a')],_0x52e873['filters']));if(_0x4bebc8[_0xced1('0x2a')]['filter']){_0x440b22[_0xced1('0x22')]=_[_0xced1('0x2f')](_0x440b22[_0xced1('0x22')],{'$or':_[_0xced1('0x1c')](_0x440b22[_0xced1('0x2c')],function(_0x30ffcc){var _0x2459cd={};_0x2459cd[_0x30ffcc]={'$like':'%'+_0x4bebc8['query'][_0xced1('0x43')]+'%'};return _0x2459cd;})});}_0x440b22=_[_0xced1('0x2f')]({},_0x440b22,_0x4bebc8[_0xced1('0x30')]);return _0x398264['getTeams'](_0x440b22);}})['then'](function(_0x27f1f1){if(_0x27f1f1){_0x5d28cc=_0x27f1f1[_0xced1('0x2d')];if(!_0x4bebc8['query'][_0xced1('0x3f')](_0xced1('0x40'))){_0x440b22[_0xced1('0xe')]=qs['limit'](_0x4bebc8['query'][_0xced1('0xe')]);_0x440b22[_0xced1('0xf')]=qs[_0xced1('0xf')](_0x4bebc8[_0xced1('0x2a')][_0xced1('0xf')]);}return _0x398264[_0xced1('0x50')](_0x440b22);}})['then'](function(_0x3333fb){if(_0x3333fb){return _0x3333fb?{'count':_0x5d28cc,'rows':_0x3333fb}:null;}})['then'](respondWithResult(_0x4cc559,null))['catch'](handleError(_0x4cc559,null));};exports['addTeams']=function(_0x4ae2af,_0x1390a6){var _0x27d495=_0x4ae2af['body']['ids'];return db[_0xced1('0x4e')][_0xced1('0x24')]({'where':{'id':_0x27d495},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xced1('0x1a'),_0xced1('0x51'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x5ca2e7){if(_0x5ca2e7){var _0x45bc94=_[_0xced1('0x52')](_0x5ca2e7,function(_0x201974){var _0x18db35=_0x201974[_0xced1('0x15')]({'plain':!![]});return _0x18db35[_0xced1('0x53')];});return db['FaxQueue'][_0xced1('0x31')]({'where':{'id':_0x4ae2af[_0xced1('0x26')]['id']}})[_0xced1('0x13')](function(_0xe1c82c){return db[_0xced1('0x54')][_0xced1('0x55')](function(_0x4401a0){return _0xe1c82c[_0xced1('0x56')](_0x27d495,{'transaction':_0x4401a0})[_0xced1('0x13')](function(){return BPromise['each'](_0x45bc94,function(_0x4d0e16){return db[_0xced1('0x3c')]['findOrCreate']({'where':{'UserId':_0x4d0e16['id'],'FaxQueueId':_0x4ae2af[_0xced1('0x26')]['id']},'transaction':_0x4401a0});});})['then'](function(){_0x45bc94[_0xced1('0x57')](function(_0x23c2be){socket[_0xced1('0x58')](_0xced1('0x59'),{'UserId':_0x23c2be['id'],'FaxQueueId':_0xe1c82c['id']});});});});});}})[_0xced1('0x13')](respondWithStatusCode(_0x1390a6,null))[_0xced1('0x39')](handleError(_0x1390a6,null));};exports['removeTeams']=function(_0x34ed5d,_0x1a0462){return db[_0xced1('0x4e')][_0xced1('0x24')]({'where':{'id':_0x34ed5d[_0xced1('0x2a')][_0xced1('0x5a')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xced1('0x13')](handleEntityNotFound(_0x1a0462,null))[_0xced1('0x13')](function(_0x40eed6){var _0x173e9a=_[_0xced1('0x1c')](_0x40eed6,'id');var _0x4f5067=[];var _0x73ba9a=[];var _0x4708e4=squel[_0xced1('0x5b')]();_0x4708e4[_0xced1('0x5c')]('tq.TeamId')[_0xced1('0x5d')](_0xced1('0x5e'),'tq')['join'](_0xced1('0x5f'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xced1('0x22')](_0xced1('0x60'),_0x34ed5d[_0xced1('0x26')]['id']);for(var _0x19f15d=0x0;_0x19f15d<_0x40eed6[_0xced1('0x2d')];_0x19f15d+=0x1){let _0x841e76=_0x40eed6[_0x19f15d];for(var _0x3d42cc=0x0;_0x3d42cc<_0x841e76[_0xced1('0x53')][_0xced1('0x2d')];_0x3d42cc+=0x1){let _0x2eea98=_0x841e76['Agents'][_0x3d42cc];var _0x476bdf=_0x4708e4[_0xced1('0x61')]();_0x476bdf[_0xced1('0x22')](_0xced1('0x62'),_0x2eea98['id']);_0x73ba9a['push'](db[_0xced1('0x54')][_0xced1('0x2a')](_0x476bdf[_0xced1('0x63')](),{'type':db[_0xced1('0x54')]['QueryTypes'][_0xced1('0x64')]})[_0xced1('0x13')](function(_0x37deef){if(_0x37deef[_0xced1('0x2d')]===0x1){return _0x2eea98['id'];}else{var _0x3beefd=_['every'](_[_0xced1('0x1c')](_0x37deef,'TeamId'),function(_0x2b868d){return _[_0xced1('0x65')](_0x173e9a,_0x2b868d);});if(_0x3beefd){return _0x2eea98['id'];}}}));}}return BPromise[_0xced1('0x66')](_0x73ba9a)['then'](function(_0x41d724){_0x4f5067=_(_0x4f5067)[_0xced1('0x67')](_0x41d724)['compact']()[_0xced1('0x68')]();return db['FaxQueue'][_0xced1('0x31')]({'where':{'id':_0x34ed5d[_0xced1('0x26')]['id']}})[_0xced1('0x13')](function(_0x5aeea4){return db['sequelize'][_0xced1('0x55')](function(_0xe05467){return _0x5aeea4[_0xced1('0x69')](_0x34ed5d[_0xced1('0x2a')][_0xced1('0x5a')],{'transaction':_0xe05467})['then'](function(){if(!_['isEmpty'](_0x4f5067)){return _0x5aeea4[_0xced1('0x6a')](_0x4f5067,{'transaction':_0xe05467});}})[_0xced1('0x13')](function(){_0x4f5067[_0xced1('0x57')](function(_0x4cf606){socket[_0xced1('0x58')]('userFaxQueue:remove',{'UserId':_0x4cf606,'FaxQueueId':_0x5aeea4['id']});});});});});});})['then'](respondWithStatusCode(_0x1a0462,null))[_0xced1('0x39')](handleError(_0x1a0462,null));};exports['addAgents']=function(_0x18a6a9,_0x58345d){return db[_0xced1('0x1d')][_0xced1('0x31')]({'where':{'id':_0x18a6a9[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x58345d,null))[_0xced1('0x13')](function(_0x4536df){if(_0x4536df){return _0x4536df[_0xced1('0x6b')](_0x18a6a9['body']['ids'],_[_0xced1('0x6c')](_0x18a6a9[_0xced1('0x33')],[_0xced1('0x5a'),'id'])||{})[_0xced1('0x6d')](function(_0x5dc796){for(var _0x51107f=0x0;_0x51107f<_0x18a6a9[_0xced1('0x33')]['ids'][_0xced1('0x2d')];_0x51107f+=0x1){socket[_0xced1('0x58')](_0xced1('0x59'),{'UserId':Number(_0x18a6a9['body'][_0xced1('0x5a')][_0x51107f]),'FaxQueueId':Number(_0x18a6a9[_0xced1('0x26')]['id'])});}return _0x5dc796;});}})['then'](respondWithResult(_0x58345d,null))[_0xced1('0x39')](handleError(_0x58345d,null));};exports[_0xced1('0x6a')]=function(_0x3173cc,_0x5e3a52){return db[_0xced1('0x1d')][_0xced1('0x31')]({'where':{'id':_0x3173cc[_0xced1('0x26')]['id']}})[_0xced1('0x13')](handleEntityNotFound(_0x5e3a52,null))[_0xced1('0x13')](function(_0x4725eb){if(_0x4725eb){return _0x4725eb['removeAgents'](_0x3173cc['query'][_0xced1('0x5a')])[_0xced1('0x13')](function(){if(_[_0xced1('0x6e')](_0x3173cc[_0xced1('0x2a')][_0xced1('0x5a')])){for(var _0xd997a5=0x0;_0xd997a5<_0x3173cc[_0xced1('0x2a')][_0xced1('0x5a')][_0xced1('0x2d')];_0xd997a5+=0x1){socket[_0xced1('0x58')](_0xced1('0x6f'),{'UserId':Number(_0x3173cc['query']['ids'][_0xd997a5]),'FaxQueueId':Number(_0x3173cc[_0xced1('0x26')]['id'])});}}else{socket[_0xced1('0x58')](_0xced1('0x6f'),{'UserId':Number(_0x3173cc[_0xced1('0x2a')][_0xced1('0x5a')]),'FaxQueueId':Number(_0x3173cc[_0xced1('0x26')]['id'])});}});}})[_0xced1('0x13')](respondWithStatusCode(_0x5e3a52,null))[_0xced1('0x39')](handleError(_0x5e3a52,null));};exports[_0xced1('0x70')]=function(_0x1b5aab,_0x21d10a){var _0xd39989={};var _0x615948={};var _0xe0c1bf;var _0x19069f;return db[_0xced1('0x1d')][_0xced1('0x3b')]({'where':{'id':_0x1b5aab[_0xced1('0x26')]['id']}})['then'](handleEntityNotFound(_0x21d10a,null))[_0xced1('0x13')](function(_0x4d7aab){if(_0x4d7aab){_0xe0c1bf=_0x4d7aab;_0x615948[_0xced1('0x27')]=_['keys'](db[_0xced1('0x44')][_0xced1('0x29')]);_0x615948[_0xced1('0x2a')]=_[_0xced1('0x28')](_0x1b5aab[_0xced1('0x2a')]);_0x615948[_0xced1('0x3d')]=_[_0xced1('0x2b')](_0x615948[_0xced1('0x27')],_0x615948[_0xced1('0x2a')]);_0xd39989[_0xced1('0x2c')]=_[_0xced1('0x2b')](_0x615948[_0xced1('0x27')],qs[_0xced1('0x3e')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0x3e')]));_0xd39989[_0xced1('0x2c')]=_0xd39989[_0xced1('0x2c')][_0xced1('0x2d')]?_0xd39989[_0xced1('0x2c')]:_0x615948[_0xced1('0x27')];_0xd39989['order']=qs[_0xced1('0x42')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0x42')]);_0xd39989[_0xced1('0x22')]=qs['filters'](_[_0xced1('0x4f')](_0x1b5aab[_0xced1('0x2a')],_0x615948[_0xced1('0x3d')]));if(_0x1b5aab[_0xced1('0x2a')][_0xced1('0x43')]){_0xd39989['where']=_[_0xced1('0x2f')](_0xd39989['where'],{'$or':_['map'](_0xd39989[_0xced1('0x2c')],function(_0x2892e0){var _0x583651={};_0x583651[_0x2892e0]={'$like':'%'+_0x1b5aab['query'][_0xced1('0x43')]+'%'};return _0x583651;})});}_0xd39989=_[_0xced1('0x2f')]({},_0xd39989,_0x1b5aab[_0xced1('0x30')]);return _0xe0c1bf[_0xced1('0x70')](_0xd39989);}})[_0xced1('0x13')](function(_0xabd57e){if(_0xabd57e){_0x19069f=_0xabd57e[_0xced1('0x2d')];if(!_0x1b5aab['query'][_0xced1('0x3f')](_0xced1('0x40'))){_0xd39989[_0xced1('0xe')]=qs[_0xced1('0xe')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0xe')]);_0xd39989['offset']=qs[_0xced1('0xf')](_0x1b5aab[_0xced1('0x2a')][_0xced1('0xf')]);}return _0xe0c1bf[_0xced1('0x70')](_0xd39989);}})[_0xced1('0x13')](function(_0x202c20){if(_0x202c20){return _0x202c20?{'count':_0x19069f,'rows':_0x202c20}:null;}})['then'](respondWithResult(_0x21d10a,null))[_0xced1('0x39')](handleError(_0x21d10a,null));}; \ No newline at end of file +var _0xbff5=['catch','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','UserProfileSection','find','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','hasOwnProperty','nolimit','order','sort','FaxQueueId','filter','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','options','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','union','compact','value','removeAgents','userFaxQueue:remove','omit','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','update','destroy','UserProfileResource','then','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','type','where','include','query','findAll','show','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge'];(function(_0x7cfeb4,_0x468021){var _0x604ada=function(_0x79afa4){while(--_0x79afa4){_0x7cfeb4['push'](_0x7cfeb4['shift']());}};_0x604ada(++_0x468021);}(_0xbff5,0x1bc));var _0x5bff=function(_0x28ca90,_0x25b97e){_0x28ca90=_0x28ca90-0x0;var _0x594278=_0xbff5[_0x28ca90];return _0x594278;};'use strict';var BPromise=require(_0x5bff('0x0'));var util=require(_0x5bff('0x1'));var _=require(_0x5bff('0x2'));var squel=require(_0x5bff('0x3'));var Redis=require(_0x5bff('0x4'));var qs=require(_0x5bff('0x5'));var logger=require(_0x5bff('0x6'))('api');var config=require(_0x5bff('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x5bff('0x8')](config[_0x5bff('0x9')],{'host':_0x5bff('0xa'),'port':0x18eb});var socket=require(_0x5bff('0xb'))(new Redis(config[_0x5bff('0x9')]));require(_0x5bff('0xc'))[_0x5bff('0xd')](socket);function respondWithStatusCode(_0x139c99,_0x3eb6f9){_0x3eb6f9=_0x3eb6f9||0xcc;return function(_0x4a1be2){if(_0x4a1be2){return _0x139c99[_0x5bff('0xe')](_0x3eb6f9);}return _0x139c99['status'](_0x3eb6f9)[_0x5bff('0xf')]();};}function respondWithResult(_0x40b806,_0x4fc146){_0x4fc146=_0x4fc146||0xc8;return function(_0x3e72e9){if(_0x3e72e9){return _0x40b806['status'](_0x4fc146)[_0x5bff('0x10')](_0x3e72e9);}};}function respondWithFilteredResult(_0x4ff164,_0x207835){return function(_0x135003){if(_0x135003){var _0x4a6903=typeof _0x207835[_0x5bff('0x11')]==='undefined'&&typeof _0x207835[_0x5bff('0x12')]===_0x5bff('0x13');var _0x548128=_0x135003[_0x5bff('0x14')];var _0xa16a3f=_0x4a6903?0x0:_0x207835['offset'];var _0x5f2a55=_0x4a6903?_0x135003[_0x5bff('0x14')]:_0x207835[_0x5bff('0x11')]+_0x207835[_0x5bff('0x12')];var _0x4d883e;if(_0x5f2a55>=_0x548128){_0x5f2a55=_0x548128;_0x4d883e=0xc8;}else{_0x4d883e=0xce;}_0x4ff164[_0x5bff('0x15')](_0x4d883e);return _0x4ff164[_0x5bff('0x16')](_0x5bff('0x17'),_0xa16a3f+'-'+_0x5f2a55+'/'+_0x548128)['json'](_0x135003);}return null;};}function saveUpdates(_0x3ffbbc){return function(_0x40c7f6){if(_0x40c7f6){return _0x40c7f6[_0x5bff('0x18')](_0x3ffbbc)['then'](function(_0xc9fbc3){return _0xc9fbc3;});}return null;};}function removeEntity(_0x279c22){return function(_0x36653b){if(_0x36653b){return _0x36653b[_0x5bff('0x19')]()['then'](function(){var _0x3065c1=_0x36653b['get']({'plain':!![]});var _0x878040='FaxQueues';return db[_0x5bff('0x1a')][_0x5bff('0x19')]({'where':{'type':_0x878040,'resourceId':_0x3065c1['id']}})[_0x5bff('0x1b')](function(){return _0x36653b;});})[_0x5bff('0x1b')](function(){_0x279c22[_0x5bff('0x15')](0xcc)[_0x5bff('0xf')]();});}};}function handleEntityNotFound(_0x3d72ee){return function(_0x13ee8f){if(!_0x13ee8f){_0x3d72ee[_0x5bff('0xe')](0x194);}return _0x13ee8f;};}function handleError(_0x490bc1,_0x5f2593){_0x5f2593=_0x5f2593||0x1f4;return function(_0x263cf5){logger[_0x5bff('0x1c')](_0x263cf5[_0x5bff('0x1d')]);if(_0x263cf5[_0x5bff('0x1e')]){delete _0x263cf5[_0x5bff('0x1e')];}_0x490bc1[_0x5bff('0x15')](_0x5f2593)[_0x5bff('0x1f')](_0x263cf5);};}exports['index']=function(_0x5741d9,_0x9a69de){var _0x53bd97={};var _0x220c8f={'count':0x0,'rows':[]};var _0xcc091d=_[_0x5bff('0x20')](db[_0x5bff('0x21')][_0x5bff('0x22')],function(_0x1140eb){return{'name':_0x1140eb[_0x5bff('0x23')],'type':_0x1140eb[_0x5bff('0x24')]['key']};});_0x53bd97=qs['getOptions'](_0xcc091d,_0x5741d9);var _0x20d750={'where':_0x53bd97[_0x5bff('0x25')]};return db['FaxQueue'][_0x5bff('0x14')](_0x20d750)['then'](function(_0x5470cb){_0x220c8f[_0x5bff('0x14')]=_0x5470cb;_0x53bd97['include']=qs[_0x5bff('0x26')](_0x5741d9[_0x5bff('0x27')]);return db[_0x5bff('0x21')][_0x5bff('0x28')](_0x53bd97);})['then'](function(_0x71783){_0x220c8f['rows']=_0x71783;return _0x220c8f;})[_0x5bff('0x1b')](respondWithFilteredResult(_0x9a69de,_0x53bd97))['catch'](handleError(_0x9a69de,null));};exports[_0x5bff('0x29')]=function(_0x100d0c,_0x293513){var _0x3491e0={'raw':!![],'where':{'id':_0x100d0c[_0x5bff('0x2a')]['id']}},_0x44a970={};_0x44a970['model']=_[_0x5bff('0x2b')](db[_0x5bff('0x21')][_0x5bff('0x22')]);_0x44a970[_0x5bff('0x27')]=_[_0x5bff('0x2b')](_0x100d0c[_0x5bff('0x27')]);_0x44a970[_0x5bff('0x2c')]=_[_0x5bff('0x2d')](_0x44a970['model'],_0x44a970[_0x5bff('0x27')]);_0x3491e0[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x44a970[_0x5bff('0x2f')],qs['fields'](_0x100d0c[_0x5bff('0x27')][_0x5bff('0x30')]));_0x3491e0['attributes']=_0x3491e0[_0x5bff('0x2e')][_0x5bff('0x31')]?_0x3491e0[_0x5bff('0x2e')]:_0x44a970[_0x5bff('0x2f')];if(_0x100d0c['query'][_0x5bff('0x32')]){_0x3491e0[_0x5bff('0x26')]=[{'all':!![]}];}_0x3491e0=_[_0x5bff('0x33')]({},_0x3491e0,_0x100d0c['options']);return db[_0x5bff('0x21')]['find'](_0x3491e0)[_0x5bff('0x1b')](handleEntityNotFound(_0x293513,null))[_0x5bff('0x1b')](respondWithResult(_0x293513,null))[_0x5bff('0x34')](handleError(_0x293513,null));};exports['create']=function(_0x368110,_0x1ec079){return db[_0x5bff('0x21')]['create'](_0x368110[_0x5bff('0x35')],{})[_0x5bff('0x1b')](function(_0x569503){var _0x265cdb=_0x368110[_0x5bff('0x36')][_0x5bff('0x37')]({'plain':!![]});if(!_0x265cdb)throw new Error(_0x5bff('0x38'));if(_0x265cdb[_0x5bff('0x39')]==='user'){var _0x35796f=_0x569503['get']({'plain':!![]});var _0x449c6a=_0x5bff('0x3a');return db[_0x5bff('0x3b')][_0x5bff('0x3c')]({'where':{'name':_0x449c6a,'userProfileId':_0x265cdb[_0x5bff('0x3d')]},'raw':!![]})[_0x5bff('0x1b')](function(_0x1d0346){if(_0x1d0346&&_0x1d0346['autoAssociation']===0x0){return db['UserProfileResource'][_0x5bff('0x3e')]({'name':_0x35796f[_0x5bff('0x1e')],'resourceId':_0x35796f['id'],'type':_0x1d0346[_0x5bff('0x1e')],'sectionId':_0x1d0346['id']},{})[_0x5bff('0x1b')](function(){return _0x569503;});}else{return _0x569503;}})[_0x5bff('0x34')](function(_0xb7b82a){logger[_0x5bff('0x1c')](_0x5bff('0x3f'),_0xb7b82a);throw _0xb7b82a;});}return _0x569503;})['then'](respondWithResult(_0x1ec079,0xc9))[_0x5bff('0x34')](handleError(_0x1ec079,null));};exports['update']=function(_0x3dc13f,_0x1b8c7f){if(_0x3dc13f['body']['id']){delete _0x3dc13f[_0x5bff('0x35')]['id'];}return db[_0x5bff('0x21')]['find']({'where':{'id':_0x3dc13f[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x1b8c7f,null))[_0x5bff('0x1b')](saveUpdates(_0x3dc13f['body'],null))[_0x5bff('0x1b')](respondWithResult(_0x1b8c7f,null))[_0x5bff('0x34')](handleError(_0x1b8c7f,null));};exports[_0x5bff('0x19')]=function(_0x5c0451,_0x24c92e){return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x5c0451[_0x5bff('0x2a')]['id']}})['then'](handleEntityNotFound(_0x24c92e,null))[_0x5bff('0x1b')](removeEntity(_0x24c92e,null))['catch'](handleError(_0x24c92e,null));};exports['describe']=function(_0x40abd9,_0x95cf00){return db['FaxQueue'][_0x5bff('0x40')]()[_0x5bff('0x1b')](respondWithResult(_0x95cf00,null))['catch'](handleError(_0x95cf00,null));};exports[_0x5bff('0x41')]=function(_0x3e56c3,_0x18f8a5){var _0x39c90f={'raw':!![],'where':{}},_0x4ccf4d={},_0x579a8d;return db[_0x5bff('0x21')][_0x5bff('0x42')]({'where':{'id':_0x3e56c3[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x18f8a5,null))[_0x5bff('0x1b')](function(_0x599163){if(_0x599163){_0x579a8d=_0x599163[_0x5bff('0x37')]({'plain':!![]});_0x4ccf4d[_0x5bff('0x2f')]=_['keys'](db[_0x5bff('0x43')]['rawAttributes']);_0x4ccf4d['query']=_['keys'](_0x3e56c3[_0x5bff('0x27')]);_0x4ccf4d[_0x5bff('0x2c')]=_['intersection'](_0x4ccf4d[_0x5bff('0x2f')],_0x4ccf4d[_0x5bff('0x27')]);_0x39c90f[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x4ccf4d[_0x5bff('0x2f')],qs['fields'](_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x30')]));_0x39c90f['attributes']=_0x39c90f[_0x5bff('0x2e')]['length']?_0x39c90f[_0x5bff('0x2e')]:_0x4ccf4d[_0x5bff('0x2f')];if(!_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x44')](_0x5bff('0x45'))){_0x39c90f['limit']=qs[_0x5bff('0x12')](_0x3e56c3[_0x5bff('0x27')]['limit']);_0x39c90f[_0x5bff('0x11')]=qs[_0x5bff('0x11')](_0x3e56c3['query'][_0x5bff('0x11')]);}_0x39c90f[_0x5bff('0x46')]=qs[_0x5bff('0x47')](_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x47')]);_0x39c90f[_0x5bff('0x25')]=qs['filters'](_['pick'](_0x3e56c3[_0x5bff('0x27')],_0x4ccf4d['filters']));_0x39c90f[_0x5bff('0x25')][_0x5bff('0x48')]=_0x599163['id'];if(_0x3e56c3[_0x5bff('0x27')][_0x5bff('0x49')]){_0x39c90f[_0x5bff('0x25')]=_[_0x5bff('0x33')](_0x39c90f[_0x5bff('0x25')],{'$or':_[_0x5bff('0x20')](_0x39c90f[_0x5bff('0x2e')],function(_0x7cc921){var _0x4364c7={};_0x4364c7[_0x7cc921]={'$like':'%'+_0x3e56c3['query']['filter']+'%'};return _0x4364c7;})});}_0x39c90f=_[_0x5bff('0x33')]({},_0x39c90f,_0x3e56c3['options']);return db[_0x5bff('0x43')]['findAll'](_0x39c90f);}})[_0x5bff('0x1b')](function(_0xbb7de2){if(_0xbb7de2){return db[_0x5bff('0x4a')][_0x5bff('0x4b')]({'where':{'id':_[_0x5bff('0x20')](_0xbb7de2,_0x5bff('0x4c')),'role':_0x5bff('0x4d')},'attributes':['id',_0x5bff('0x1e'),_0x5bff('0x4e'),_0x5bff('0x4f'),_0x5bff('0x50')]});}})['then'](function(_0x142854){if(_0x142854){return{'count':_0x142854['count'],'rows':_['map'](_0x142854['rows'],function(_0x1720ac){return{'membername':_0x1720ac['name'],'UserId':_0x1720ac['id'],'queue_name':_0x579a8d[_0x5bff('0x1e')],'FaxQueueId':_0x579a8d['id'],'interface':util[_0x5bff('0x51')](_0x5bff('0x52'),_0x5bff('0x53'),_0x1720ac['name']),'penalty':0x0,'paused':_0x1720ac['faxPause'],'createdAt':_0x1720ac['createdAt'],'updatedAt':_0x1720ac[_0x5bff('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5bff('0x1b')](respondWithFilteredResult(_0x18f8a5,_0x39c90f))['catch'](handleError(_0x18f8a5,null));};exports[_0x5bff('0x54')]=function(_0x3bb787,_0x460272){var _0x168935={};var _0x1fec98={};var _0x20ff8a;var _0x134268;return db[_0x5bff('0x21')][_0x5bff('0x42')]({'where':{'id':_0x3bb787[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x460272,null))[_0x5bff('0x1b')](function(_0x3bbbe1){if(_0x3bbbe1){_0x20ff8a=_0x3bbbe1;_0x1fec98[_0x5bff('0x2f')]=_['keys'](db[_0x5bff('0x55')][_0x5bff('0x22')]);_0x1fec98[_0x5bff('0x27')]=_[_0x5bff('0x2b')](_0x3bb787[_0x5bff('0x27')]);_0x1fec98[_0x5bff('0x2c')]=_[_0x5bff('0x2d')](_0x1fec98[_0x5bff('0x2f')],_0x1fec98[_0x5bff('0x27')]);_0x168935[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x1fec98[_0x5bff('0x2f')],qs[_0x5bff('0x30')](_0x3bb787['query'][_0x5bff('0x30')]));_0x168935[_0x5bff('0x2e')]=_0x168935[_0x5bff('0x2e')][_0x5bff('0x31')]?_0x168935[_0x5bff('0x2e')]:_0x1fec98['model'];_0x168935[_0x5bff('0x46')]=qs[_0x5bff('0x47')](_0x3bb787['query'][_0x5bff('0x47')]);_0x168935[_0x5bff('0x25')]=qs[_0x5bff('0x2c')](_['pick'](_0x3bb787[_0x5bff('0x27')],_0x1fec98[_0x5bff('0x2c')]));if(_0x3bb787[_0x5bff('0x27')][_0x5bff('0x49')]){_0x168935[_0x5bff('0x25')]=_[_0x5bff('0x33')](_0x168935[_0x5bff('0x25')],{'$or':_[_0x5bff('0x20')](_0x168935[_0x5bff('0x2e')],function(_0x834ccd){var _0x10d6a2={};_0x10d6a2[_0x834ccd]={'$like':'%'+_0x3bb787[_0x5bff('0x27')]['filter']+'%'};return _0x10d6a2;})});}_0x168935=_['merge']({},_0x168935,_0x3bb787[_0x5bff('0x56')]);return _0x20ff8a[_0x5bff('0x54')](_0x168935);}})[_0x5bff('0x1b')](function(_0x597eea){if(_0x597eea){_0x134268=_0x597eea[_0x5bff('0x31')];if(!_0x3bb787['query']['hasOwnProperty'](_0x5bff('0x45'))){_0x168935['limit']=qs['limit'](_0x3bb787[_0x5bff('0x27')][_0x5bff('0x12')]);_0x168935['offset']=qs[_0x5bff('0x11')](_0x3bb787[_0x5bff('0x27')][_0x5bff('0x11')]);}return _0x20ff8a[_0x5bff('0x54')](_0x168935);}})[_0x5bff('0x1b')](function(_0x3dcc24){if(_0x3dcc24){return _0x3dcc24?{'count':_0x134268,'rows':_0x3dcc24}:null;}})[_0x5bff('0x1b')](respondWithResult(_0x460272,null))[_0x5bff('0x34')](handleError(_0x460272,null));};exports[_0x5bff('0x57')]=function(_0x29bea4,_0x3d5ef9){var _0x376207=_0x29bea4[_0x5bff('0x35')][_0x5bff('0x58')];return db[_0x5bff('0x55')][_0x5bff('0x28')]({'where':{'id':_0x376207},'attributes':['id'],'include':[{'model':db[_0x5bff('0x4a')],'as':_0x5bff('0x59'),'attributes':['id',_0x5bff('0x1e'),_0x5bff('0x5a'),_0x5bff('0x5b'),'interface'],'raw':!![]}]})[_0x5bff('0x1b')](function(_0x36c26c){if(_0x36c26c){var _0x5c673e=_[_0x5bff('0x5c')](_0x36c26c,function(_0x5143cf){var _0x25b2bc=_0x5143cf[_0x5bff('0x37')]({'plain':!![]});return _0x25b2bc['Agents'];});return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x29bea4[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](function(_0x726832){return db[_0x5bff('0x5d')][_0x5bff('0x5e')](function(_0xc17adc){return _0x726832[_0x5bff('0x57')](_0x376207,{'transaction':_0xc17adc})[_0x5bff('0x1b')](function(){return BPromise[_0x5bff('0x5f')](_0x5c673e,function(_0x498849){return db[_0x5bff('0x43')][_0x5bff('0x60')]({'where':{'UserId':_0x498849['id'],'FaxQueueId':_0x29bea4['params']['id']},'transaction':_0xc17adc});});})[_0x5bff('0x1b')](function(){_0x5c673e[_0x5bff('0x61')](function(_0x3f84e2){socket[_0x5bff('0x62')](_0x5bff('0x63'),{'UserId':_0x3f84e2['id'],'FaxQueueId':_0x726832['id']});});});});});}})[_0x5bff('0x1b')](respondWithStatusCode(_0x3d5ef9,null))[_0x5bff('0x34')](handleError(_0x3d5ef9,null));};exports[_0x5bff('0x64')]=function(_0x57ae4d,_0x4d42bc){return db[_0x5bff('0x55')]['findAll']({'where':{'id':_0x57ae4d[_0x5bff('0x27')][_0x5bff('0x58')]},'attributes':['id'],'include':[{'model':db[_0x5bff('0x4a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x5bff('0x1b')](handleEntityNotFound(_0x4d42bc,null))[_0x5bff('0x1b')](function(_0x434837){var _0x44456c=_[_0x5bff('0x20')](_0x434837,'id');var _0x4774c2=[];var _0x4b40c5=[];var _0x341e79=squel[_0x5bff('0x65')]();_0x341e79[_0x5bff('0x66')](_0x5bff('0x67'))['from'](_0x5bff('0x68'),'tq')['join'](_0x5bff('0x69'),'ut',_0x5bff('0x6a'))[_0x5bff('0x25')](_0x5bff('0x6b'),_0x57ae4d[_0x5bff('0x2a')]['id']);for(var _0x135200=0x0;_0x135200<_0x434837[_0x5bff('0x31')];_0x135200+=0x1){let _0x52623e=_0x434837[_0x135200];for(var _0x286c4a=0x0;_0x286c4a<_0x52623e['Agents']['length'];_0x286c4a+=0x1){let _0x26290a=_0x52623e[_0x5bff('0x59')][_0x286c4a];var _0x527a96=_0x341e79['clone']();_0x527a96[_0x5bff('0x25')](_0x5bff('0x6c'),_0x26290a['id']);_0x4b40c5[_0x5bff('0x6d')](db[_0x5bff('0x5d')]['query'](_0x527a96[_0x5bff('0x6e')](),{'type':db['sequelize'][_0x5bff('0x6f')][_0x5bff('0x70')]})[_0x5bff('0x1b')](function(_0x4b8771){if(_0x4b8771[_0x5bff('0x31')]===0x1){return _0x26290a['id'];}else{var _0x5a5e97=_[_0x5bff('0x71')](_[_0x5bff('0x20')](_0x4b8771,_0x5bff('0x72')),function(_0x5b2058){return _['includes'](_0x44456c,_0x5b2058);});if(_0x5a5e97){return _0x26290a['id'];}}}));}}return BPromise[_0x5bff('0x73')](_0x4b40c5)[_0x5bff('0x1b')](function(_0x2b8ec5){_0x4774c2=_(_0x4774c2)[_0x5bff('0x74')](_0x2b8ec5)[_0x5bff('0x75')]()[_0x5bff('0x76')]();return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x57ae4d[_0x5bff('0x2a')]['id']}})['then'](function(_0x435076){return db[_0x5bff('0x5d')][_0x5bff('0x5e')](function(_0x4cb550){return _0x435076['removeTeams'](_0x57ae4d[_0x5bff('0x27')][_0x5bff('0x58')],{'transaction':_0x4cb550})['then'](function(){if(!_['isEmpty'](_0x4774c2)){return _0x435076[_0x5bff('0x77')](_0x4774c2,{'transaction':_0x4cb550});}})['then'](function(){_0x4774c2[_0x5bff('0x61')](function(_0xc0fcc2){socket[_0x5bff('0x62')](_0x5bff('0x78'),{'UserId':_0xc0fcc2,'FaxQueueId':_0x435076['id']});});});});});});})['then'](respondWithStatusCode(_0x4d42bc,null))[_0x5bff('0x34')](handleError(_0x4d42bc,null));};exports['addAgents']=function(_0x155bf3,_0x20a5af){return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x155bf3[_0x5bff('0x2a')]['id']}})['then'](handleEntityNotFound(_0x20a5af,null))[_0x5bff('0x1b')](function(_0x320109){if(_0x320109){return _0x320109['addAgents'](_0x155bf3[_0x5bff('0x35')][_0x5bff('0x58')],_[_0x5bff('0x79')](_0x155bf3[_0x5bff('0x35')],[_0x5bff('0x58'),'id'])||{})['spread'](function(_0xe8a343){for(var _0x3033de=0x0;_0x3033de<_0x155bf3[_0x5bff('0x35')][_0x5bff('0x58')][_0x5bff('0x31')];_0x3033de+=0x1){socket[_0x5bff('0x62')]('userFaxQueue:save',{'UserId':Number(_0x155bf3[_0x5bff('0x35')]['ids'][_0x3033de]),'FaxQueueId':Number(_0x155bf3[_0x5bff('0x2a')]['id'])});}return _0xe8a343;});}})[_0x5bff('0x1b')](respondWithResult(_0x20a5af,null))[_0x5bff('0x34')](handleError(_0x20a5af,null));};exports[_0x5bff('0x77')]=function(_0x2efeb0,_0x70fdf2){return db[_0x5bff('0x21')][_0x5bff('0x3c')]({'where':{'id':_0x2efeb0[_0x5bff('0x2a')]['id']}})[_0x5bff('0x1b')](handleEntityNotFound(_0x70fdf2,null))[_0x5bff('0x1b')](function(_0x995f09){if(_0x995f09){return _0x995f09[_0x5bff('0x77')](_0x2efeb0['query']['ids'])[_0x5bff('0x1b')](function(){if(_[_0x5bff('0x7a')](_0x2efeb0[_0x5bff('0x27')][_0x5bff('0x58')])){for(var _0x406b88=0x0;_0x406b88<_0x2efeb0['query'][_0x5bff('0x58')][_0x5bff('0x31')];_0x406b88+=0x1){socket[_0x5bff('0x62')]('userFaxQueue:remove',{'UserId':Number(_0x2efeb0[_0x5bff('0x27')]['ids'][_0x406b88]),'FaxQueueId':Number(_0x2efeb0[_0x5bff('0x2a')]['id'])});}}else{socket['emit'](_0x5bff('0x78'),{'UserId':Number(_0x2efeb0['query'][_0x5bff('0x58')]),'FaxQueueId':Number(_0x2efeb0[_0x5bff('0x2a')]['id'])});}});}})[_0x5bff('0x1b')](respondWithStatusCode(_0x70fdf2,null))['catch'](handleError(_0x70fdf2,null));};exports[_0x5bff('0x7b')]=function(_0x2e5ac0,_0x1b895d){var _0x3dbb53={};var _0x1db44c={};var _0x1bd28a;var _0x2ca82e;return db[_0x5bff('0x21')][_0x5bff('0x42')]({'where':{'id':_0x2e5ac0[_0x5bff('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1b895d,null))[_0x5bff('0x1b')](function(_0xddc173){if(_0xddc173){_0x1bd28a=_0xddc173;_0x1db44c['model']=_[_0x5bff('0x2b')](db['User']['rawAttributes']);_0x1db44c[_0x5bff('0x27')]=_[_0x5bff('0x2b')](_0x2e5ac0[_0x5bff('0x27')]);_0x1db44c[_0x5bff('0x2c')]=_['intersection'](_0x1db44c['model'],_0x1db44c[_0x5bff('0x27')]);_0x3dbb53[_0x5bff('0x2e')]=_[_0x5bff('0x2d')](_0x1db44c['model'],qs[_0x5bff('0x30')](_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x30')]));_0x3dbb53[_0x5bff('0x2e')]=_0x3dbb53[_0x5bff('0x2e')]['length']?_0x3dbb53[_0x5bff('0x2e')]:_0x1db44c[_0x5bff('0x2f')];_0x3dbb53['order']=qs[_0x5bff('0x47')](_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x47')]);_0x3dbb53[_0x5bff('0x25')]=qs['filters'](_['pick'](_0x2e5ac0[_0x5bff('0x27')],_0x1db44c[_0x5bff('0x2c')]));if(_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x49')]){_0x3dbb53[_0x5bff('0x25')]=_[_0x5bff('0x33')](_0x3dbb53[_0x5bff('0x25')],{'$or':_[_0x5bff('0x20')](_0x3dbb53[_0x5bff('0x2e')],function(_0x3b07c6){var _0x4c6a55={};_0x4c6a55[_0x3b07c6]={'$like':'%'+_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x49')]+'%'};return _0x4c6a55;})});}_0x3dbb53=_[_0x5bff('0x33')]({},_0x3dbb53,_0x2e5ac0[_0x5bff('0x56')]);return _0x1bd28a['getAgents'](_0x3dbb53);}})['then'](function(_0x96bbeb){if(_0x96bbeb){_0x2ca82e=_0x96bbeb[_0x5bff('0x31')];if(!_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x44')](_0x5bff('0x45'))){_0x3dbb53[_0x5bff('0x12')]=qs[_0x5bff('0x12')](_0x2e5ac0['query']['limit']);_0x3dbb53['offset']=qs['offset'](_0x2e5ac0[_0x5bff('0x27')][_0x5bff('0x11')]);}return _0x1bd28a[_0x5bff('0x7b')](_0x3dbb53);}})[_0x5bff('0x1b')](function(_0x5e9119){if(_0x5e9119){return _0x5e9119?{'count':_0x2ca82e,'rows':_0x5e9119}:null;}})['then'](respondWithResult(_0x1b895d,null))[_0x5bff('0x34')](handleError(_0x1b895d,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index e45b883..7274dae 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 _0x68d6=['events','../../mysqldb','FaxQueue','save','emit','hook','exports'];(function(_0xa3fa3,_0x328285){var _0x488dd4=function(_0x1c4f57){while(--_0x1c4f57){_0xa3fa3['push'](_0xa3fa3['shift']());}};_0x488dd4(++_0x328285);}(_0x68d6,0x10a));var _0x668d=function(_0x2080a3,_0x48acfa){_0x2080a3=_0x2080a3-0x0;var _0x8d7d17=_0x68d6[_0x2080a3];return _0x8d7d17;};'use strict';var EventEmitter=require(_0x668d('0x0'));var FaxQueue=require(_0x668d('0x1'))['db'][_0x668d('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x668d('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d373d){return function(_0x2f530a,_0x43f11f,_0x118f62){FaxQueueEvents[_0x668d('0x4')](_0x1d373d+':'+_0x2f530a['id'],_0x2f530a);FaxQueueEvents[_0x668d('0x4')](_0x1d373d,_0x2f530a);_0x118f62(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxQueue[_0x668d('0x5')](e,emitEvent(event));}}module[_0x668d('0x6')]=FaxQueueEvents; \ No newline at end of file +var _0x5788=['FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','events','../../mysqldb'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0x5788,0x1ae));var _0x8578=function(_0x5931d5,_0x185e3f){_0x5931d5=_0x5931d5-0x0;var _0x3dcaeb=_0x5788[_0x5931d5];return _0x3dcaeb;};'use strict';var EventEmitter=require(_0x8578('0x0'));var FaxQueue=require(_0x8578('0x1'))['db'][_0x8578('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x8578('0x3')](0x0);var events={'afterCreate':_0x8578('0x4'),'afterUpdate':_0x8578('0x5'),'afterDestroy':_0x8578('0x6')};function emitEvent(_0x1dd3f1){return function(_0x1dad6d,_0x27de4f,_0x59f315){FaxQueueEvents[_0x8578('0x7')](_0x1dd3f1+':'+_0x1dad6d['id'],_0x1dad6d);FaxQueueEvents[_0x8578('0x7')](_0x1dd3f1,_0x1dad6d);_0x59f315(null);};}for(var e in events){if(events[_0x8578('0x8')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module['exports']=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 89d3607..bcce8ce 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 _0x60dd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util'];(function(_0x206b21,_0xe40b2e){var _0x322754=function(_0x4ccf73){while(--_0x4ccf73){_0x206b21['push'](_0x206b21['shift']());}};_0x322754(++_0xe40b2e);}(_0x60dd,0x116));var _0xd60d=function(_0xfc4cf8,_0x257666){_0xfc4cf8=_0xfc4cf8-0x0;var _0x40ca89=_0x60dd[_0xfc4cf8];return _0x40ca89;};'use strict';var _=require(_0xd60d('0x0'));var util=require(_0xd60d('0x1'));var logger=require('../../config/logger')(_0xd60d('0x2'));var moment=require(_0xd60d('0x3'));var BPromise=require(_0xd60d('0x4'));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(_0xd60d('0x9'));module[_0xd60d('0xa')]=function(_0x32975a,_0x2921a7){return _0x32975a[_0xd60d('0xb')](_0xd60d('0xc'),attributes,{'tableName':_0xd60d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd59b=['path','rimraf','../../config/environment','./faxQueue.attributes','exports','define','lodash','util','request-promise'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd59b,0x7b));var _0xbd59=function(_0x5a40b0,_0x4d3d22){_0x5a40b0=_0x5a40b0-0x0;var _0x4d689d=_0xd59b[_0x5a40b0];return _0x4d689d;};'use strict';var _=require(_0xbd59('0x0'));var util=require(_0xbd59('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xbd59('0x2'));var fs=require('fs');var path=require(_0xbd59('0x3'));var rimraf=require(_0xbd59('0x4'));var config=require(_0xbd59('0x5'));var attributes=require(_0xbd59('0x6'));module[_0xbd59('0x7')]=function(_0x8c81e7,_0x550bb3){return _0x8c81e7[_0xbd59('0x8')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index b6b3bab..bc61543 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 _0xd65b=['../../config/environment','http','redis','localhost','socket.io-emitter','register','request','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','findAll','options','raw','where','limit','include','model','attributes','map','GetFaxQueue','ShowFaxQueue','FaxQueue','find','then','stringify','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4d3d50,_0x50f156){var _0x175e6d=function(_0x41fc26){while(--_0x41fc26){_0x4d3d50['push'](_0x4d3d50['shift']());}};_0x175e6d(++_0x50f156);}(_0xd65b,0x168));var _0xbd65=function(_0xd52600,_0xcac05e){_0xd52600=_0xd52600-0x0;var _0x186a1f=_0xd65b[_0xd52600];return _0x186a1f;};'use strict';var _=require(_0xbd65('0x0'));var util=require(_0xbd65('0x1'));var moment=require(_0xbd65('0x2'));var BPromise=require(_0xbd65('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbd65('0x4'));var db=require(_0xbd65('0x5'))['db'];var utils=require(_0xbd65('0x6'));var logger=require(_0xbd65('0x7'))(_0xbd65('0x8'));var config=require(_0xbd65('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbd65('0xa')]({'port':0x232a});config[_0xbd65('0xb')]=_['defaults'](config[_0xbd65('0xb')],{'host':_0xbd65('0xc'),'port':0x18eb});var socket=require(_0xbd65('0xd'))(new Redis(config['redis']));require('./faxQueue.socket')[_0xbd65('0xe')](socket);function respondWithRpcPromise(_0x14b09b,_0x4ff5b7,_0x27686d){return new BPromise(function(_0x47fae4,_0x42aa5d){return client[_0xbd65('0xf')](_0x14b09b,_0x27686d)['then'](function(_0x4a9f83){logger[_0xbd65('0x10')](_0xbd65('0x11'),_0x4ff5b7,_0xbd65('0x12'));logger[_0xbd65('0x13')](_0xbd65('0x14'),_0x4ff5b7,_0xbd65('0x12'),JSON['stringify'](_0x4a9f83));if(_0x4a9f83[_0xbd65('0x15')]){if(_0x4a9f83['error'][_0xbd65('0x16')]===0x1f4){logger[_0xbd65('0x15')](_0xbd65('0x11'),_0x4ff5b7,_0x4a9f83['error'][_0xbd65('0x17')]);return _0x42aa5d(_0x4a9f83[_0xbd65('0x15')]['message']);}logger[_0xbd65('0x15')](_0xbd65('0x11'),_0x4ff5b7,_0x4a9f83[_0xbd65('0x15')][_0xbd65('0x17')]);return _0x47fae4(_0x4a9f83[_0xbd65('0x15')][_0xbd65('0x17')]);}else{logger['info'](_0xbd65('0x11'),_0x4ff5b7,_0xbd65('0x12'));_0x47fae4(_0x4a9f83[_0xbd65('0x18')][_0xbd65('0x17')]);}})[_0xbd65('0x19')](function(_0x34a79f){logger[_0xbd65('0x15')]('FaxQueue,\x20%s,\x20%s',_0x4ff5b7,_0x34a79f);_0x42aa5d(_0x34a79f);});});}exports['GetFaxQueue']=function(_0x4580ab){var _0x29904e=this;return new Promise(function(_0x345221,_0xa23f05){return db['FaxQueue'][_0xbd65('0x1a')]({'raw':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab[_0xbd65('0x1b')][_0xbd65('0x1c')]===undefined?!![]:![]:!![],'where':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab[_0xbd65('0x1b')][_0xbd65('0x1d')]||null:null,'attributes':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab[_0xbd65('0x1b')]['attributes']||null:null,'limit':_0x4580ab[_0xbd65('0x1b')]?_0x4580ab['options'][_0xbd65('0x1e')]||null:null,'include':_0x4580ab['options']?_0x4580ab['options'][_0xbd65('0x1f')]?_['map'](_0x4580ab[_0xbd65('0x1b')][_0xbd65('0x1f')],function(_0x548202){return{'model':db[_0x548202[_0xbd65('0x20')]],'as':_0x548202['as'],'attributes':_0x548202['attributes'],'include':_0x548202[_0xbd65('0x1f')]?_['map'](_0x548202[_0xbd65('0x1f')],function(_0x58ae99){return{'model':db[_0x58ae99['model']],'as':_0x58ae99['as'],'attributes':_0x58ae99[_0xbd65('0x21')],'include':_0x58ae99[_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x58ae99['include'],function(_0x2a1fdb){return{'model':db[_0x2a1fdb['model']],'as':_0x2a1fdb['as'],'attributes':_0x2a1fdb[_0xbd65('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449f88){logger['info'](_0xbd65('0x23'),_0x4580ab);logger[_0xbd65('0x13')](_0xbd65('0x23'),_0x4580ab,JSON['stringify'](_0x449f88));_0x345221(_0x449f88);})[_0xbd65('0x19')](function(_0x190ecc){logger[_0xbd65('0x15')](_0xbd65('0x23'),_0x190ecc[_0xbd65('0x17')],_0x4580ab);_0xa23f05(_0x29904e[_0xbd65('0x15')](0x1f4,_0x190ecc[_0xbd65('0x17')]));});});};exports[_0xbd65('0x24')]=function(_0x4bf668){var _0x6a1aea=this;return new Promise(function(_0x51ff9b,_0x34d71c){return db[_0xbd65('0x25')][_0xbd65('0x26')]({'raw':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668[_0xbd65('0x1b')][_0xbd65('0x1c')]===undefined?!![]:![]:!![],'where':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668['options'][_0xbd65('0x1d')]||null:null,'attributes':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668['options'][_0xbd65('0x21')]||null:null,'include':_0x4bf668[_0xbd65('0x1b')]?_0x4bf668[_0xbd65('0x1b')][_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x4bf668['options'][_0xbd65('0x1f')],function(_0x2f928a){return{'model':db[_0x2f928a[_0xbd65('0x20')]],'as':_0x2f928a['as'],'attributes':_0x2f928a['attributes'],'include':_0x2f928a[_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x2f928a[_0xbd65('0x1f')],function(_0x4fd10b){return{'model':db[_0x4fd10b[_0xbd65('0x20')]],'as':_0x4fd10b['as'],'attributes':_0x4fd10b[_0xbd65('0x21')],'include':_0x4fd10b[_0xbd65('0x1f')]?_[_0xbd65('0x22')](_0x4fd10b[_0xbd65('0x1f')],function(_0x46a9c2){return{'model':db[_0x46a9c2['model']],'as':_0x46a9c2['as'],'attributes':_0x46a9c2[_0xbd65('0x21')]};}):[]};}):[]};}):[]:[]})[_0xbd65('0x27')](function(_0x19b090){logger['info'](_0xbd65('0x24'),_0x4bf668);logger[_0xbd65('0x13')](_0xbd65('0x24'),_0x4bf668,JSON[_0xbd65('0x28')](_0x19b090));_0x51ff9b(_0x19b090);})[_0xbd65('0x19')](function(_0x3c2eb2){logger['error']('ShowFaxQueue',_0x3c2eb2[_0xbd65('0x17')],_0x4bf668);_0x34d71c(_0x6a1aea[_0xbd65('0x15')](0x1f4,_0x3c2eb2['message']));});});}; \ No newline at end of file +var _0x9d10=['code','message','result','GetFaxQueue','options','raw','where','attributes','limit','include','map','model','debug','catch','FaxQueue','find','ShowFaxQueue','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0x9d10,0xde));var _0x09d1=function(_0x5b3878,_0x511513){_0x5b3878=_0x5b3878-0x0;var _0x2cf370=_0x9d10[_0x5b3878];return _0x2cf370;};'use strict';var _=require('lodash');var util=require(_0x09d1('0x0'));var moment=require(_0x09d1('0x1'));var BPromise=require(_0x09d1('0x2'));var rs=require(_0x09d1('0x3'));var fs=require('fs');var Redis=require(_0x09d1('0x4'));var db=require(_0x09d1('0x5'))['db'];var utils=require(_0x09d1('0x6'));var logger=require('../../config/logger')(_0x09d1('0x7'));var config=require(_0x09d1('0x8'));var jayson=require(_0x09d1('0x9'));var client=jayson[_0x09d1('0xa')][_0x09d1('0xb')]({'port':0x232a});config[_0x09d1('0xc')]=_['defaults'](config[_0x09d1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x09d1('0xd'))(new Redis(config[_0x09d1('0xc')]));require(_0x09d1('0xe'))[_0x09d1('0xf')](socket);function respondWithRpcPromise(_0x154761,_0x551d8d,_0x4be232){return new BPromise(function(_0x1e3176,_0x4a5a9d){return client[_0x09d1('0x10')](_0x154761,_0x4be232)[_0x09d1('0x11')](function(_0x4c88be){logger[_0x09d1('0x12')](_0x09d1('0x13'),_0x551d8d,_0x09d1('0x14'));logger['debug'](_0x09d1('0x15'),_0x551d8d,_0x09d1('0x14'),JSON[_0x09d1('0x16')](_0x4c88be));if(_0x4c88be[_0x09d1('0x17')]){if(_0x4c88be['error'][_0x09d1('0x18')]===0x1f4){logger[_0x09d1('0x17')](_0x09d1('0x13'),_0x551d8d,_0x4c88be['error'][_0x09d1('0x19')]);return _0x4a5a9d(_0x4c88be[_0x09d1('0x17')][_0x09d1('0x19')]);}logger[_0x09d1('0x17')](_0x09d1('0x13'),_0x551d8d,_0x4c88be[_0x09d1('0x17')][_0x09d1('0x19')]);return _0x1e3176(_0x4c88be['error'][_0x09d1('0x19')]);}else{logger[_0x09d1('0x12')]('FaxQueue,\x20%s,\x20%s',_0x551d8d,_0x09d1('0x14'));_0x1e3176(_0x4c88be[_0x09d1('0x1a')][_0x09d1('0x19')]);}})['catch'](function(_0xd4d0d){logger[_0x09d1('0x17')](_0x09d1('0x13'),_0x551d8d,_0xd4d0d);_0x4a5a9d(_0xd4d0d);});});}exports[_0x09d1('0x1b')]=function(_0xc4c738){var _0xc75b59=this;return new Promise(function(_0x3692c8,_0x1cdcba){return db['FaxQueue']['findAll']({'raw':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x1d')]===undefined?!![]:![]:!![],'where':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x1e')]||null:null,'attributes':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x1f')]||null:null,'limit':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x20')]||null:null,'include':_0xc4c738[_0x09d1('0x1c')]?_0xc4c738[_0x09d1('0x1c')][_0x09d1('0x21')]?_[_0x09d1('0x22')](_0xc4c738['options'][_0x09d1('0x21')],function(_0xde0836){return{'model':db[_0xde0836['model']],'as':_0xde0836['as'],'attributes':_0xde0836[_0x09d1('0x1f')],'include':_0xde0836[_0x09d1('0x21')]?_['map'](_0xde0836['include'],function(_0x3b286d){return{'model':db[_0x3b286d['model']],'as':_0x3b286d['as'],'attributes':_0x3b286d[_0x09d1('0x1f')],'include':_0x3b286d[_0x09d1('0x21')]?_[_0x09d1('0x22')](_0x3b286d[_0x09d1('0x21')],function(_0x371ca0){return{'model':db[_0x371ca0[_0x09d1('0x23')]],'as':_0x371ca0['as'],'attributes':_0x371ca0[_0x09d1('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3bc6bc){logger[_0x09d1('0x12')](_0x09d1('0x1b'),_0xc4c738);logger[_0x09d1('0x24')]('GetFaxQueue',_0xc4c738,JSON[_0x09d1('0x16')](_0x3bc6bc));_0x3692c8(_0x3bc6bc);})[_0x09d1('0x25')](function(_0x5820df){logger[_0x09d1('0x17')](_0x09d1('0x1b'),_0x5820df[_0x09d1('0x19')],_0xc4c738);_0x1cdcba(_0xc75b59[_0x09d1('0x17')](0x1f4,_0x5820df[_0x09d1('0x19')]));});});};exports['ShowFaxQueue']=function(_0x22fd7c){var _0x293f6b=this;return new Promise(function(_0x2562c1,_0x245cb5){return db[_0x09d1('0x26')][_0x09d1('0x27')]({'raw':_0x22fd7c[_0x09d1('0x1c')]?_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x1d')]===undefined?!![]:![]:!![],'where':_0x22fd7c['options']?_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x1e')]||null:null,'attributes':_0x22fd7c[_0x09d1('0x1c')]?_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x1f')]||null:null,'include':_0x22fd7c[_0x09d1('0x1c')]?_0x22fd7c[_0x09d1('0x1c')]['include']?_['map'](_0x22fd7c[_0x09d1('0x1c')][_0x09d1('0x21')],function(_0x46ede5){return{'model':db[_0x46ede5[_0x09d1('0x23')]],'as':_0x46ede5['as'],'attributes':_0x46ede5['attributes'],'include':_0x46ede5['include']?_[_0x09d1('0x22')](_0x46ede5['include'],function(_0x12c1ef){return{'model':db[_0x12c1ef[_0x09d1('0x23')]],'as':_0x12c1ef['as'],'attributes':_0x12c1ef['attributes'],'include':_0x12c1ef[_0x09d1('0x21')]?_[_0x09d1('0x22')](_0x12c1ef[_0x09d1('0x21')],function(_0x227d90){return{'model':db[_0x227d90[_0x09d1('0x23')]],'as':_0x227d90['as'],'attributes':_0x227d90[_0x09d1('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x09d1('0x11')](function(_0x2d3d4d){logger[_0x09d1('0x12')](_0x09d1('0x28'),_0x22fd7c);logger[_0x09d1('0x24')](_0x09d1('0x28'),_0x22fd7c,JSON[_0x09d1('0x16')](_0x2d3d4d));_0x2562c1(_0x2d3d4d);})[_0x09d1('0x25')](function(_0x2da30a){logger[_0x09d1('0x17')](_0x09d1('0x28'),_0x2da30a['message'],_0x22fd7c);_0x245cb5(_0x293f6b[_0x09d1('0x17')](0x1f4,_0x2da30a['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index dbc56ef..17fe09a 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 _0xece5=['length','faxQueue:','update','emit','removeListener'];(function(_0x30c133,_0x20e3bd){var _0x38a446=function(_0x279454){while(--_0x279454){_0x30c133['push'](_0x30c133['shift']());}};_0x38a446(++_0x20e3bd);}(_0xece5,0xbb));var _0x5ece=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xece5[_0x273c39];return _0x46d6b5;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save','remove',_0x5ece('0x0')];function createListener(_0x4db1a7,_0x32c777){return function(_0x54254a){_0x32c777[_0x5ece('0x1')](_0x4db1a7,_0x54254a);};}function removeListener(_0x18e9a4,_0x528146){return function(){FaxQueueEvents[_0x5ece('0x2')](_0x18e9a4,_0x528146);};}exports['register']=function(_0x166c5d){for(var _0x33dfa6=0x0,_0x5bb478=events[_0x5ece('0x3')];_0x33dfa6<_0x5bb478;_0x33dfa6++){var _0x413731=events[_0x33dfa6];var _0x59cc69=createListener(_0x5ece('0x4')+_0x413731,_0x166c5d);FaxQueueEvents['on'](_0x413731,_0x59cc69);}}; \ No newline at end of file +var _0x1eb1=['./faxQueue.events','save','emit','register','length','faxQueue:'];(function(_0x4151be,_0x576cdb){var _0x3e09b2=function(_0x49ec36){while(--_0x49ec36){_0x4151be['push'](_0x4151be['shift']());}};_0x3e09b2(++_0x576cdb);}(_0x1eb1,0xa2));var _0x11eb=function(_0x427733,_0x499453){_0x427733=_0x427733-0x0;var _0x301c2e=_0x1eb1[_0x427733];return _0x301c2e;};'use strict';var FaxQueueEvents=require(_0x11eb('0x0'));var events=[_0x11eb('0x1'),'remove','update'];function createListener(_0x58708b,_0x24b7fb){return function(_0x5edc55){_0x24b7fb[_0x11eb('0x2')](_0x58708b,_0x5edc55);};}function removeListener(_0x224dce,_0x4b6c18){return function(){FaxQueueEvents['removeListener'](_0x224dce,_0x4b6c18);};}exports[_0x11eb('0x3')]=function(_0x5e7d3b){for(var _0x5c7c62=0x0,_0x3c07ec=events[_0x11eb('0x4')];_0x5c7c62<_0x3c07ec;_0x5c7c62++){var _0x4a0676=events[_0x5c7c62];var _0x1b15b7=createListener(_0x11eb('0x5')+_0x4a0676,_0x5e7d3b);FaxQueueEvents['on'](_0x4a0676,_0x1b15b7);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index d11ad62..fe4e744 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 _0x9bd9=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x3145e0,_0x3263d8){var _0x40692f=function(_0x8d437){while(--_0x8d437){_0x3145e0['push'](_0x3145e0['shift']());}};_0x40692f(++_0x3263d8);}(_0x9bd9,0x1a4));var _0x99bd=function(_0x1a2ac5,_0x431ac7){_0x1a2ac5=_0x1a2ac5-0x0;var _0x2cedd0=_0x9bd9[_0x1a2ac5];return _0x2cedd0;};'use strict';var multer=require(_0x99bd('0x0'));var util=require(_0x99bd('0x1'));var path=require(_0x99bd('0x2'));var timeout=require(_0x99bd('0x3'));var express=require(_0x99bd('0x4'));var router=express[_0x99bd('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x99bd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x99bd('0x7'));var controller=require(_0x99bd('0x8'));router['get']('/',auth[_0x99bd('0x9')](),controller[_0x99bd('0xa')]);router[_0x99bd('0xb')](_0x99bd('0xc'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xd')]);router[_0x99bd('0xb')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0xf')]);router[_0x99bd('0xb')](_0x99bd('0x10'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x11')]);router['get'](_0x99bd('0x12'),auth['isAuthenticated'](),controller[_0x99bd('0x13')]);router['get'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller['getAgents']);router[_0x99bd('0x15')]('/',auth['isAuthenticated'](),controller[_0x99bd('0x16')]);router['post'](_0x99bd('0x12'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x17')]);router['post'](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x18')]);router[_0x99bd('0x19')](_0x99bd('0xe'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1a')]);router[_0x99bd('0x1b')](_0x99bd('0xe'),auth['isAuthenticated'](),controller[_0x99bd('0x1c')]);router[_0x99bd('0x1b')](_0x99bd('0x12'),auth['isAuthenticated'](),controller['removeTeams']);router[_0x99bd('0x1b')](_0x99bd('0x14'),auth[_0x99bd('0x9')](),controller[_0x99bd('0x1d')]);module[_0x99bd('0x1e')]=router; \ No newline at end of file +var _0xc6a2=['show','/:id/members','getMembers','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x3f4a71,_0x367d39){var _0xee8f88=function(_0x4b43eb){while(--_0x4b43eb){_0x3f4a71['push'](_0x3f4a71['shift']());}};_0xee8f88(++_0x367d39);}(_0xc6a2,0x69));var _0x2c6a=function(_0xa0f2ac,_0x4e5de6){_0xa0f2ac=_0xa0f2ac-0x0;var _0x1d579=_0xc6a2[_0xa0f2ac];return _0x1d579;};'use strict';var multer=require(_0x2c6a('0x0'));var util=require(_0x2c6a('0x1'));var path=require('path');var timeout=require(_0x2c6a('0x2'));var express=require(_0x2c6a('0x3'));var router=express[_0x2c6a('0x4')]();var fs_extra=require(_0x2c6a('0x5'));var auth=require(_0x2c6a('0x6'));var interaction=require(_0x2c6a('0x7'));var config=require(_0x2c6a('0x8'));var controller=require(_0x2c6a('0x9'));router[_0x2c6a('0xa')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xc')]);router[_0x2c6a('0xa')](_0x2c6a('0xd'),auth[_0x2c6a('0xb')](),controller['describe']);router[_0x2c6a('0xa')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0xf')]);router[_0x2c6a('0xa')](_0x2c6a('0x10'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x11')]);router['get']('/:id/teams',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x12')]);router[_0x2c6a('0xa')](_0x2c6a('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x2c6a('0x14')]('/',auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x15')]);router['post']('/:id/teams',auth['isAuthenticated'](),controller[_0x2c6a('0x16')]);router[_0x2c6a('0x14')](_0x2c6a('0x13'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x17')]);router[_0x2c6a('0x18')](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x19')]);router['delete'](_0x2c6a('0xe'),auth[_0x2c6a('0xb')](),controller['destroy']);router[_0x2c6a('0x1a')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2c6a('0x1b')]);router[_0x2c6a('0x1a')](_0x2c6a('0x13'),auth[_0x2c6a('0xb')](),controller[_0x2c6a('0x1c')]);module[_0x2c6a('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 7b9d986..f90fcf8 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 _0x07ba=['STRING','DATE','sequelize','exports'];(function(_0x5ae037,_0x4c6ebb){var _0x1b1281=function(_0xe0e4a9){while(--_0xe0e4a9){_0x5ae037['push'](_0x5ae037['shift']());}};_0x1b1281(++_0x4c6ebb);}(_0x07ba,0x156));var _0xa07b=function(_0x5533bc,_0x259123){_0x5533bc=_0x5533bc-0x0;var _0x5c0c0e=_0x07ba[_0x5533bc];return _0x5c0c0e;};'use strict';var moment=require('moment');var Sequelize=require(_0xa07b('0x0'));module[_0xa07b('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xa07b('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xa07b('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xa07b('0x2')]}}; \ No newline at end of file +var _0x82fb=['DATE','moment','exports','STRING'];(function(_0x48d218,_0x38ae7b){var _0x5d86c7=function(_0x362ae9){while(--_0x362ae9){_0x48d218['push'](_0x48d218['shift']());}};_0x5d86c7(++_0x38ae7b);}(_0x82fb,0x11d));var _0xb82f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x82fb[_0x4565bf];return _0x5610ba;};'use strict';var moment=require(_0xb82f('0x0'));var Sequelize=require('sequelize');module[_0xb82f('0x1')]={'uniqueid':{'type':Sequelize[_0xb82f('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xb82f('0x3')]},'leaveAt':{'type':Sequelize[_0xb82f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0xb82f('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 06d13af..55a3f45 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 _0xa1fd=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','map','FaxQueueReport','rawAttributes','fieldName','type','model','keys','query','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce'];(function(_0x10b4aa,_0x41ffc3){var _0x4c0d22=function(_0xa53c16){while(--_0xa53c16){_0x10b4aa['push'](_0x10b4aa['shift']());}};_0x4c0d22(++_0x41ffc3);}(_0xa1fd,0x1b9));var _0xda1f=function(_0x152aa1,_0x307718){_0x152aa1=_0x152aa1-0x0;var _0x1bc01a=_0xa1fd[_0x152aa1];return _0x1bc01a;};'use strict';var emlformat=require(_0xda1f('0x0'));var rimraf=require(_0xda1f('0x1'));var zipdir=require(_0xda1f('0x2'));var jsonpatch=require(_0xda1f('0x3'));var rp=require('request-promise');var moment=require(_0xda1f('0x4'));var BPromise=require(_0xda1f('0x5'));var Mustache=require(_0xda1f('0x6'));var util=require(_0xda1f('0x7'));var path=require(_0xda1f('0x8'));var sox=require('sox');var csv=require(_0xda1f('0x9'));var ejs=require(_0xda1f('0xa'));var fs=require('fs');var fs_extra=require(_0xda1f('0xb'));var _=require('lodash');var squel=require(_0xda1f('0xc'));var crypto=require(_0xda1f('0xd'));var jsforce=require(_0xda1f('0xe'));var deskjs=require(_0xda1f('0xf'));var toCsv=require(_0xda1f('0x9'));var querystring=require(_0xda1f('0x10'));var Papa=require(_0xda1f('0x11'));var Redis=require(_0xda1f('0x12'));var authService=require(_0xda1f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xda1f('0x14'));var hardwareService=require(_0xda1f('0x15'));var logger=require(_0xda1f('0x16'))(_0xda1f('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xda1f('0x18'));var db=require(_0xda1f('0x19'))['db'];function respondWithStatusCode(_0x3842d7,_0x347fa0){_0x347fa0=_0x347fa0||0xcc;return function(_0x1f7dc4){if(_0x1f7dc4){return _0x3842d7['sendStatus'](_0x347fa0);}return _0x3842d7[_0xda1f('0x1a')](_0x347fa0)[_0xda1f('0x1b')]();};}function respondWithResult(_0x151673,_0x306184){_0x306184=_0x306184||0xc8;return function(_0x2138d0){if(_0x2138d0){return _0x151673[_0xda1f('0x1a')](_0x306184)['json'](_0x2138d0);}};}function respondWithFilteredResult(_0x77da5b,_0x124930){return function(_0xc0346c){if(_0xc0346c){var _0x4081d0=typeof _0x124930['offset']==='undefined'&&typeof _0x124930[_0xda1f('0x1c')]==='undefined';var _0x3424a1=_0xc0346c[_0xda1f('0x1d')];var _0x1e10af=_0x4081d0?0x0:_0x124930['offset'];var _0xe81fc2=_0x4081d0?_0xc0346c[_0xda1f('0x1d')]:_0x124930['offset']+_0x124930[_0xda1f('0x1c')];var _0x31cbba;if(_0xe81fc2>=_0x3424a1){_0xe81fc2=_0x3424a1;_0x31cbba=0xc8;}else{_0x31cbba=0xce;}_0x77da5b['status'](_0x31cbba);return _0x77da5b[_0xda1f('0x1e')](_0xda1f('0x1f'),_0x1e10af+'-'+_0xe81fc2+'/'+_0x3424a1)[_0xda1f('0x20')](_0xc0346c);}return null;};}function patchUpdates(_0xe85e94){return function(_0x3955b8){try{jsonpatch[_0xda1f('0x21')](_0x3955b8,_0xe85e94,!![]);}catch(_0x1f6958){return BPromise[_0xda1f('0x22')](_0x1f6958);}return _0x3955b8[_0xda1f('0x23')]();};}function saveUpdates(_0x21e6b4,_0x1d510b){return function(_0xc76888){if(_0xc76888){return _0xc76888['update'](_0x21e6b4)[_0xda1f('0x24')](function(_0x4bcfda){return _0x4bcfda;});}return null;};}function removeEntity(_0x443fa1,_0x51e172){return function(_0x2a1b64){if(_0x2a1b64){return _0x2a1b64[_0xda1f('0x25')]()['then'](function(){_0x443fa1[_0xda1f('0x1a')](0xcc)[_0xda1f('0x1b')]();});}};}function handleEntityNotFound(_0x3231c8,_0x1cf1bc){return function(_0x1d5485){if(!_0x1d5485){_0x3231c8['sendStatus'](0x194);}return _0x1d5485;};}function handleError(_0x310d37,_0xeab7be){_0xeab7be=_0xeab7be||0x1f4;return function(_0x6619b3){logger[_0xda1f('0x26')](_0x6619b3['stack']);if(_0x6619b3[_0xda1f('0x27')]){delete _0x6619b3[_0xda1f('0x27')];}_0x310d37['status'](_0xeab7be)[_0xda1f('0x28')](_0x6619b3);};}exports['index']=function(_0x34459d,_0x4bf7cf){var _0x5ba749={},_0x2dd737={},_0x592181={'count':0x0,'rows':[]};var _0x4d5bb0=_[_0xda1f('0x29')](db[_0xda1f('0x2a')][_0xda1f('0x2b')],function(_0x55d28c){return{'name':_0x55d28c[_0xda1f('0x2c')],'type':_0x55d28c[_0xda1f('0x2d')]['key']};});_0x2dd737[_0xda1f('0x2e')]=_['map'](_0x4d5bb0,'name');_0x2dd737['query']=_[_0xda1f('0x2f')](_0x34459d[_0xda1f('0x30')]);_0x2dd737[_0xda1f('0x31')]=_['intersection'](_0x2dd737[_0xda1f('0x2e')],_0x2dd737[_0xda1f('0x30')]);_0x5ba749[_0xda1f('0x32')]=_['intersection'](_0x2dd737[_0xda1f('0x2e')],qs['fields'](_0x34459d[_0xda1f('0x30')][_0xda1f('0x33')]));_0x5ba749[_0xda1f('0x32')]=_0x5ba749[_0xda1f('0x32')][_0xda1f('0x34')]?_0x5ba749['attributes']:_0x2dd737[_0xda1f('0x2e')];if(!_0x34459d[_0xda1f('0x30')][_0xda1f('0x35')](_0xda1f('0x36'))){_0x5ba749['limit']=qs[_0xda1f('0x1c')](_0x34459d[_0xda1f('0x30')][_0xda1f('0x1c')]);_0x5ba749[_0xda1f('0x37')]=qs[_0xda1f('0x37')](_0x34459d['query'][_0xda1f('0x37')]);}_0x5ba749[_0xda1f('0x38')]=qs[_0xda1f('0x39')](_0x34459d[_0xda1f('0x30')][_0xda1f('0x39')]);_0x5ba749['where']=qs[_0xda1f('0x31')](_[_0xda1f('0x3a')](_0x34459d[_0xda1f('0x30')],_0x2dd737[_0xda1f('0x31')]),_0x4d5bb0);if(_0x34459d[_0xda1f('0x30')]['filter']){_0x5ba749[_0xda1f('0x3b')]=_[_0xda1f('0x3c')](_0x5ba749[_0xda1f('0x3b')],{'$or':_[_0xda1f('0x29')](_0x4d5bb0,function(_0x474019){if(_0x474019[_0xda1f('0x2d')]!==_0xda1f('0x3d')){var _0x396b5e={};_0x396b5e[_0x474019['name']]={'$like':'%'+_0x34459d[_0xda1f('0x30')][_0xda1f('0x3e')]+'%'};return _0x396b5e;}})});}_0x5ba749=_[_0xda1f('0x3c')]({},_0x5ba749,_0x34459d[_0xda1f('0x3f')]);var _0x3716bd={'where':_0x5ba749[_0xda1f('0x3b')]};return db[_0xda1f('0x2a')]['count'](_0x3716bd)[_0xda1f('0x24')](function(_0xd51a87){_0x592181[_0xda1f('0x1d')]=_0xd51a87;if(_0x34459d[_0xda1f('0x30')][_0xda1f('0x40')]){_0x5ba749[_0xda1f('0x41')]=[{'all':!![]}];}return db[_0xda1f('0x2a')][_0xda1f('0x42')](_0x5ba749);})[_0xda1f('0x24')](function(_0x568747){_0x592181['rows']=_0x568747;return _0x592181;})[_0xda1f('0x24')](respondWithFilteredResult(_0x4bf7cf,_0x5ba749))[_0xda1f('0x43')](handleError(_0x4bf7cf,null));};exports[_0xda1f('0x44')]=function(_0x2427ca,_0x536917){var _0x4677dc={'raw':!![],'where':{'id':_0x2427ca[_0xda1f('0x45')]['id']}},_0x3097ef={};_0x3097ef[_0xda1f('0x2e')]=_[_0xda1f('0x2f')](db[_0xda1f('0x2a')]['rawAttributes']);_0x3097ef[_0xda1f('0x30')]=_[_0xda1f('0x2f')](_0x2427ca[_0xda1f('0x30')]);_0x3097ef[_0xda1f('0x31')]=_[_0xda1f('0x46')](_0x3097ef[_0xda1f('0x2e')],_0x3097ef[_0xda1f('0x30')]);_0x4677dc[_0xda1f('0x32')]=_['intersection'](_0x3097ef[_0xda1f('0x2e')],qs['fields'](_0x2427ca[_0xda1f('0x30')][_0xda1f('0x33')]));_0x4677dc[_0xda1f('0x32')]=_0x4677dc['attributes'][_0xda1f('0x34')]?_0x4677dc[_0xda1f('0x32')]:_0x3097ef[_0xda1f('0x2e')];if(_0x2427ca[_0xda1f('0x30')]['includeAll']){_0x4677dc[_0xda1f('0x41')]=[{'all':!![]}];}_0x4677dc=_['merge']({},_0x4677dc,_0x2427ca[_0xda1f('0x3f')]);return db[_0xda1f('0x2a')][_0xda1f('0x47')](_0x4677dc)[_0xda1f('0x24')](handleEntityNotFound(_0x536917,null))[_0xda1f('0x24')](respondWithResult(_0x536917,null))[_0xda1f('0x43')](handleError(_0x536917,null));};exports[_0xda1f('0x48')]=function(_0x1a4904,_0x31175d){return db[_0xda1f('0x2a')][_0xda1f('0x48')](_0x1a4904[_0xda1f('0x49')],{})[_0xda1f('0x24')](respondWithResult(_0x31175d,0xc9))[_0xda1f('0x43')](handleError(_0x31175d,null));};exports[_0xda1f('0x4a')]=function(_0x4eccfa,_0x2267de){if(_0x4eccfa[_0xda1f('0x49')]['id']){delete _0x4eccfa[_0xda1f('0x49')]['id'];}return db[_0xda1f('0x2a')][_0xda1f('0x47')]({'where':{'id':_0x4eccfa[_0xda1f('0x45')]['id']}})['then'](handleEntityNotFound(_0x2267de,null))['then'](saveUpdates(_0x4eccfa[_0xda1f('0x49')],null))[_0xda1f('0x24')](respondWithResult(_0x2267de,null))[_0xda1f('0x43')](handleError(_0x2267de,null));};exports[_0xda1f('0x25')]=function(_0x3ce251,_0x4b71da){return db[_0xda1f('0x2a')][_0xda1f('0x47')]({'where':{'id':_0x3ce251['params']['id']}})[_0xda1f('0x24')](handleEntityNotFound(_0x4b71da,null))[_0xda1f('0x24')](removeEntity(_0x4b71da,null))['catch'](handleError(_0x4b71da,null));};exports['describe']=function(_0xee525d,_0x2a2ca3){return db[_0xda1f('0x2a')][_0xda1f('0x4b')]()[_0xda1f('0x24')](respondWithResult(_0x2a2ca3,null))['catch'](handleError(_0x2a2ca3,null));}; \ No newline at end of file +var _0x9bde=['catch','show','params','includeAll','include','create','body','update','find','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','save','then','destroy','error','name','send','index','map','FaxQueueReport','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','merge','VIRTUAL','options','rows'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9bde,0xe1));var _0xe9bd=function(_0x14e777,_0x4784b8){_0x14e777=_0x14e777-0x0;var _0x7c855f=_0x9bde[_0x14e777];return _0x7c855f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9bd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe9bd('0x1'));var rp=require('request-promise');var moment=require(_0xe9bd('0x2'));var BPromise=require(_0xe9bd('0x3'));var Mustache=require(_0xe9bd('0x4'));var util=require(_0xe9bd('0x5'));var path=require(_0xe9bd('0x6'));var sox=require(_0xe9bd('0x7'));var csv=require(_0xe9bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe9bd('0x9'));var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0x8'));var querystring=require(_0xe9bd('0xf'));var Papa=require(_0xe9bd('0x10'));var Redis=require(_0xe9bd('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x12'));var hardwareService=require(_0xe9bd('0x13'));var logger=require(_0xe9bd('0x14'))('api');var utils=require(_0xe9bd('0x15'));var config=require(_0xe9bd('0x16'));var licenseUtil=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x5e022a,_0x2c1d98){_0x2c1d98=_0x2c1d98||0xcc;return function(_0x4ac319){if(_0x4ac319){return _0x5e022a[_0xe9bd('0x19')](_0x2c1d98);}return _0x5e022a[_0xe9bd('0x1a')](_0x2c1d98)[_0xe9bd('0x1b')]();};}function respondWithResult(_0x51109f,_0x47ba5e){_0x47ba5e=_0x47ba5e||0xc8;return function(_0x46a95e){if(_0x46a95e){return _0x51109f[_0xe9bd('0x1a')](_0x47ba5e)[_0xe9bd('0x1c')](_0x46a95e);}};}function respondWithFilteredResult(_0x46a59b,_0x3360bd){return function(_0x389e7b){if(_0x389e7b){var _0x45a9f2=typeof _0x3360bd['offset']===_0xe9bd('0x1d')&&typeof _0x3360bd[_0xe9bd('0x1e')]===_0xe9bd('0x1d');var _0x494b27=_0x389e7b[_0xe9bd('0x1f')];var _0x3bae08=_0x45a9f2?0x0:_0x3360bd[_0xe9bd('0x20')];var _0x330733=_0x45a9f2?_0x389e7b['count']:_0x3360bd[_0xe9bd('0x20')]+_0x3360bd['limit'];var _0xc6b661;if(_0x330733>=_0x494b27){_0x330733=_0x494b27;_0xc6b661=0xc8;}else{_0xc6b661=0xce;}_0x46a59b['status'](_0xc6b661);return _0x46a59b[_0xe9bd('0x21')](_0xe9bd('0x22'),_0x3bae08+'-'+_0x330733+'/'+_0x494b27)[_0xe9bd('0x1c')](_0x389e7b);}return null;};}function patchUpdates(_0x3dda13){return function(_0x1acb82){try{jsonpatch[_0xe9bd('0x23')](_0x1acb82,_0x3dda13,!![]);}catch(_0x6593ce){return BPromise['reject'](_0x6593ce);}return _0x1acb82[_0xe9bd('0x24')]();};}function saveUpdates(_0x28cd17,_0x4ecaf5){return function(_0x37aec1){if(_0x37aec1){return _0x37aec1['update'](_0x28cd17)[_0xe9bd('0x25')](function(_0x1b9cc9){return _0x1b9cc9;});}return null;};}function removeEntity(_0x36f8c0,_0xf02209){return function(_0x5bc4bf){if(_0x5bc4bf){return _0x5bc4bf[_0xe9bd('0x26')]()[_0xe9bd('0x25')](function(){_0x36f8c0[_0xe9bd('0x1a')](0xcc)[_0xe9bd('0x1b')]();});}};}function handleEntityNotFound(_0x2641be,_0xb52d45){return function(_0x399f3c){if(!_0x399f3c){_0x2641be[_0xe9bd('0x19')](0x194);}return _0x399f3c;};}function handleError(_0x1ae889,_0x5987af){_0x5987af=_0x5987af||0x1f4;return function(_0x3c211a){logger[_0xe9bd('0x27')](_0x3c211a['stack']);if(_0x3c211a[_0xe9bd('0x28')]){delete _0x3c211a[_0xe9bd('0x28')];}_0x1ae889[_0xe9bd('0x1a')](_0x5987af)[_0xe9bd('0x29')](_0x3c211a);};}exports[_0xe9bd('0x2a')]=function(_0x183601,_0x519f48){var _0x5b7f1d={},_0x1de54c={},_0x56e409={'count':0x0,'rows':[]};var _0xa45eb0=_[_0xe9bd('0x2b')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')],function(_0x4057df){return{'name':_0x4057df['fieldName'],'type':_0x4057df['type'][_0xe9bd('0x2e')]};});_0x1de54c[_0xe9bd('0x2f')]=_[_0xe9bd('0x2b')](_0xa45eb0,_0xe9bd('0x28'));_0x1de54c[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x183601[_0xe9bd('0x30')]);_0x1de54c[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x1de54c['model'],_0x1de54c[_0xe9bd('0x30')]);_0x5b7f1d[_0xe9bd('0x34')]=_[_0xe9bd('0x33')](_0x1de54c['model'],qs['fields'](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x5b7f1d[_0xe9bd('0x34')]=_0x5b7f1d[_0xe9bd('0x34')][_0xe9bd('0x36')]?_0x5b7f1d[_0xe9bd('0x34')]:_0x1de54c[_0xe9bd('0x2f')];if(!_0x183601[_0xe9bd('0x30')][_0xe9bd('0x37')](_0xe9bd('0x38'))){_0x5b7f1d[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x1e')]);_0x5b7f1d[_0xe9bd('0x20')]=qs[_0xe9bd('0x20')](_0x183601[_0xe9bd('0x30')][_0xe9bd('0x20')]);}_0x5b7f1d['order']=qs[_0xe9bd('0x39')](_0x183601[_0xe9bd('0x30')]['sort']);_0x5b7f1d[_0xe9bd('0x3a')]=qs[_0xe9bd('0x32')](_['pick'](_0x183601['query'],_0x1de54c[_0xe9bd('0x32')]),_0xa45eb0);if(_0x183601[_0xe9bd('0x30')]['filter']){_0x5b7f1d[_0xe9bd('0x3a')]=_[_0xe9bd('0x3b')](_0x5b7f1d[_0xe9bd('0x3a')],{'$or':_['map'](_0xa45eb0,function(_0x19740b){if(_0x19740b['type']!==_0xe9bd('0x3c')){var _0x42238a={};_0x42238a[_0x19740b[_0xe9bd('0x28')]]={'$like':'%'+_0x183601[_0xe9bd('0x30')]['filter']+'%'};return _0x42238a;}})});}_0x5b7f1d=_[_0xe9bd('0x3b')]({},_0x5b7f1d,_0x183601[_0xe9bd('0x3d')]);var _0x327e1a={'where':_0x5b7f1d[_0xe9bd('0x3a')]};return db[_0xe9bd('0x2c')][_0xe9bd('0x1f')](_0x327e1a)[_0xe9bd('0x25')](function(_0xacfd19){_0x56e409[_0xe9bd('0x1f')]=_0xacfd19;if(_0x183601[_0xe9bd('0x30')]['includeAll']){_0x5b7f1d['include']=[{'all':!![]}];}return db[_0xe9bd('0x2c')]['findAll'](_0x5b7f1d);})[_0xe9bd('0x25')](function(_0x340819){_0x56e409[_0xe9bd('0x3e')]=_0x340819;return _0x56e409;})['then'](respondWithFilteredResult(_0x519f48,_0x5b7f1d))[_0xe9bd('0x3f')](handleError(_0x519f48,null));};exports[_0xe9bd('0x40')]=function(_0x1a2d94,_0x5a4460){var _0x2ef01b={'raw':!![],'where':{'id':_0x1a2d94[_0xe9bd('0x41')]['id']}},_0x3a5703={};_0x3a5703[_0xe9bd('0x2f')]=_[_0xe9bd('0x31')](db[_0xe9bd('0x2c')][_0xe9bd('0x2d')]);_0x3a5703[_0xe9bd('0x30')]=_[_0xe9bd('0x31')](_0x1a2d94[_0xe9bd('0x30')]);_0x3a5703[_0xe9bd('0x32')]=_[_0xe9bd('0x33')](_0x3a5703[_0xe9bd('0x2f')],_0x3a5703[_0xe9bd('0x30')]);_0x2ef01b[_0xe9bd('0x34')]=_['intersection'](_0x3a5703['model'],qs[_0xe9bd('0x35')](_0x1a2d94[_0xe9bd('0x30')][_0xe9bd('0x35')]));_0x2ef01b['attributes']=_0x2ef01b['attributes'][_0xe9bd('0x36')]?_0x2ef01b[_0xe9bd('0x34')]:_0x3a5703[_0xe9bd('0x2f')];if(_0x1a2d94[_0xe9bd('0x30')][_0xe9bd('0x42')]){_0x2ef01b[_0xe9bd('0x43')]=[{'all':!![]}];}_0x2ef01b=_[_0xe9bd('0x3b')]({},_0x2ef01b,_0x1a2d94['options']);return db[_0xe9bd('0x2c')]['find'](_0x2ef01b)[_0xe9bd('0x25')](handleEntityNotFound(_0x5a4460,null))[_0xe9bd('0x25')](respondWithResult(_0x5a4460,null))[_0xe9bd('0x3f')](handleError(_0x5a4460,null));};exports[_0xe9bd('0x44')]=function(_0x74ea23,_0x4b7b67){return db[_0xe9bd('0x2c')][_0xe9bd('0x44')](_0x74ea23[_0xe9bd('0x45')],{})['then'](respondWithResult(_0x4b7b67,0xc9))[_0xe9bd('0x3f')](handleError(_0x4b7b67,null));};exports[_0xe9bd('0x46')]=function(_0x34f787,_0x5a466b){if(_0x34f787[_0xe9bd('0x45')]['id']){delete _0x34f787[_0xe9bd('0x45')]['id'];}return db[_0xe9bd('0x2c')][_0xe9bd('0x47')]({'where':{'id':_0x34f787[_0xe9bd('0x41')]['id']}})['then'](handleEntityNotFound(_0x5a466b,null))[_0xe9bd('0x25')](saveUpdates(_0x34f787['body'],null))[_0xe9bd('0x25')](respondWithResult(_0x5a466b,null))[_0xe9bd('0x3f')](handleError(_0x5a466b,null));};exports[_0xe9bd('0x26')]=function(_0x14b06b,_0x194b7d){return db['FaxQueueReport'][_0xe9bd('0x47')]({'where':{'id':_0x14b06b['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x194b7d,null))[_0xe9bd('0x25')](removeEntity(_0x194b7d,null))['catch'](handleError(_0x194b7d,null));};exports['describe']=function(_0x1ce539,_0x524da7){return db[_0xe9bd('0x2c')]['describe']()[_0xe9bd('0x25')](respondWithResult(_0x524da7,null))[_0xe9bd('0x3f')](handleError(_0x524da7,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index a8dad75..3b08f37 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 _0x7a54=['report_fax_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport'];(function(_0x59fc55,_0x317de3){var _0x434986=function(_0x4ef68c){while(--_0x4ef68c){_0x59fc55['push'](_0x59fc55['shift']());}};_0x434986(++_0x317de3);}(_0x7a54,0x106));var _0x47a5=function(_0x1d1612,_0x373ad6){_0x1d1612=_0x1d1612-0x0;var _0x287311=_0x7a54[_0x1d1612];return _0x287311;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x47a5('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5a1943,_0x3cdeb4){var _0x151b67=function(_0x29ea6a){while(--_0x29ea6a){_0x5a1943['push'](_0x5a1943['shift']());}};_0x151b67(++_0x3cdeb4);}(_0x4975,0x86));var _0x5497=function(_0x2a5524,_0x15926a){_0x2a5524=_0x2a5524-0x0;var _0xd4f2b3=_0x4975[_0x2a5524];return _0xd4f2b3;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 0c8eb86..bd91ba5 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 _0x5ed5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','update','where','attributes','limit','catch','UpdateFaxQueueReport','util'];(function(_0x1d38ee,_0x30fdfc){var _0x18f3bc=function(_0x40d3c7){while(--_0x40d3c7){_0x1d38ee['push'](_0x1d38ee['shift']());}};_0x18f3bc(++_0x30fdfc);}(_0x5ed5,0x83));var _0x55ed=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x5ed5[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require(_0x55ed('0x0'));var moment=require('moment');var BPromise=require(_0x55ed('0x1'));var rs=require(_0x55ed('0x2'));var fs=require('fs');var Redis=require(_0x55ed('0x3'));var db=require(_0x55ed('0x4'))['db'];var utils=require(_0x55ed('0x5'));var logger=require(_0x55ed('0x6'))(_0x55ed('0x7'));var config=require('../../config/environment');var jayson=require(_0x55ed('0x8'));var client=jayson[_0x55ed('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ad339,_0x236503,_0x44f997){return new BPromise(function(_0x3d47c6,_0x50a277){return client[_0x55ed('0xa')](_0x3ad339,_0x44f997)[_0x55ed('0xb')](function(_0x3cad20){logger[_0x55ed('0xc')](_0x55ed('0xd'),_0x236503,_0x55ed('0xe'));logger[_0x55ed('0xf')](_0x55ed('0x10'),_0x236503,_0x55ed('0xe'),JSON[_0x55ed('0x11')](_0x3cad20));if(_0x3cad20[_0x55ed('0x12')]){if(_0x3cad20[_0x55ed('0x12')]['code']===0x1f4){logger[_0x55ed('0x12')](_0x55ed('0xd'),_0x236503,_0x3cad20['error'][_0x55ed('0x13')]);return _0x50a277(_0x3cad20['error']['message']);}logger[_0x55ed('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x236503,_0x3cad20['error'][_0x55ed('0x13')]);return _0x3d47c6(_0x3cad20[_0x55ed('0x12')]['message']);}else{logger[_0x55ed('0xc')](_0x55ed('0xd'),_0x236503,_0x55ed('0xe'));_0x3d47c6(_0x3cad20[_0x55ed('0x14')]['message']);}})['catch'](function(_0x5e4708){logger[_0x55ed('0x12')](_0x55ed('0xd'),_0x236503,_0x5e4708);_0x50a277(_0x5e4708);});});}exports[_0x55ed('0x15')]=function(_0x3a5fa2){var _0x84c6b8=this;return new Promise(function(_0x3d7fae,_0x402633){return db[_0x55ed('0x16')][_0x55ed('0x17')](_0x3a5fa2[_0x55ed('0x18')],{'raw':_0x3a5fa2['options']?_0x3a5fa2[_0x55ed('0x19')][_0x55ed('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x4fceb6){logger[_0x55ed('0xc')](_0x55ed('0x15'),_0x3a5fa2);logger[_0x55ed('0xf')](_0x55ed('0x15'),_0x3a5fa2,JSON[_0x55ed('0x11')](_0x4fceb6));_0x3d7fae(_0x4fceb6);})['catch'](function(_0x1897af){logger[_0x55ed('0x12')](_0x55ed('0x15'),_0x1897af['message'],_0x3a5fa2);_0x402633(_0x84c6b8[_0x55ed('0x12')](0x1f4,_0x1897af['message']));});});};exports['UpdateFaxQueueReport']=function(_0x2ccacc){var _0x55015a=this;return new Promise(function(_0x4bce69,_0x2d9e8a){return db[_0x55ed('0x16')][_0x55ed('0x1b')](_0x2ccacc[_0x55ed('0x18')],{'raw':_0x2ccacc['options']?_0x2ccacc['options'][_0x55ed('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ccacc[_0x55ed('0x19')]?_0x2ccacc['options'][_0x55ed('0x1c')]||null:null,'attributes':_0x2ccacc['options']?_0x2ccacc[_0x55ed('0x19')][_0x55ed('0x1d')]||null:null,'limit':_0x2ccacc['options']?_0x2ccacc['options'][_0x55ed('0x1e')]||null:null})['then'](function(_0x43a361){logger[_0x55ed('0xc')]('UpdateFaxQueueReport',_0x2ccacc);logger[_0x55ed('0xf')]('UpdateFaxQueueReport',_0x2ccacc,JSON[_0x55ed('0x11')](_0x43a361));_0x4bce69(_0x43a361);})[_0x55ed('0x1f')](function(_0x2b5302){logger[_0x55ed('0x12')](_0x55ed('0x20'),_0x2b5302[_0x55ed('0x13')],_0x2ccacc);_0x2d9e8a(_0x55015a[_0x55ed('0x12')](0x1f4,_0x2b5302[_0x55ed('0x13')]));});});}; \ No newline at end of file +var _0xeeae=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','message','info','CreateFaxQueueReport','FaxQueueReport','options','raw','stringify','catch','UpdateFaxQueueReport','body','where','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','client','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x53cf8e,_0x3d290f){var _0x459197=function(_0x67073c){while(--_0x67073c){_0x53cf8e['push'](_0x53cf8e['shift']());}};_0x459197(++_0x3d290f);}(_0xeeae,0x122));var _0xeeea=function(_0x42340f,_0x51b13e){_0x42340f=_0x42340f-0x0;var _0x5ee9e6=_0xeeae[_0x42340f];return _0x5ee9e6;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xeeea('0x0'));var rs=require(_0xeeea('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeeea('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xeeea('0x3'));var config=require(_0xeeea('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xeeea('0x5')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f53e9,_0x54fdab,_0x3e9dc1){return new BPromise(function(_0x3ab74f,_0x54fae2){return client['request'](_0x2f53e9,_0x3e9dc1)[_0xeeea('0x6')](function(_0x4e5784){logger['info'](_0xeeea('0x7'),_0x54fdab,_0xeeea('0x8'));logger[_0xeeea('0x9')](_0xeeea('0xa'),_0x54fdab,_0xeeea('0x8'),JSON['stringify'](_0x4e5784));if(_0x4e5784[_0xeeea('0xb')]){if(_0x4e5784[_0xeeea('0xb')]['code']===0x1f4){logger['error'](_0xeeea('0x7'),_0x54fdab,_0x4e5784[_0xeeea('0xb')][_0xeeea('0xc')]);return _0x54fae2(_0x4e5784[_0xeeea('0xb')][_0xeeea('0xc')]);}logger[_0xeeea('0xb')](_0xeeea('0x7'),_0x54fdab,_0x4e5784['error']['message']);return _0x3ab74f(_0x4e5784[_0xeeea('0xb')]['message']);}else{logger[_0xeeea('0xd')](_0xeeea('0x7'),_0x54fdab,_0xeeea('0x8'));_0x3ab74f(_0x4e5784['result'][_0xeeea('0xc')]);}})['catch'](function(_0xf04d65){logger[_0xeeea('0xb')](_0xeeea('0x7'),_0x54fdab,_0xf04d65);_0x54fae2(_0xf04d65);});});}exports[_0xeeea('0xe')]=function(_0x3835b0){var _0x1c1171=this;return new Promise(function(_0x509f4e,_0x4e38bb){return db[_0xeeea('0xf')]['create'](_0x3835b0['body'],{'raw':_0x3835b0[_0xeeea('0x10')]?_0x3835b0[_0xeeea('0x10')][_0xeeea('0x11')]===undefined?!![]:![]:!![]})[_0xeeea('0x6')](function(_0x53c0a4){logger[_0xeeea('0xd')](_0xeeea('0xe'),_0x3835b0);logger[_0xeeea('0x9')](_0xeeea('0xe'),_0x3835b0,JSON[_0xeeea('0x12')](_0x53c0a4));_0x509f4e(_0x53c0a4);})[_0xeeea('0x13')](function(_0x8a91dc){logger[_0xeeea('0xb')](_0xeeea('0xe'),_0x8a91dc['message'],_0x3835b0);_0x4e38bb(_0x1c1171[_0xeeea('0xb')](0x1f4,_0x8a91dc[_0xeeea('0xc')]));});});};exports[_0xeeea('0x14')]=function(_0x4739fb){var _0x4b5fe1=this;return new Promise(function(_0x36603b,_0xd0094f){return db['FaxQueueReport']['update'](_0x4739fb[_0xeeea('0x15')],{'raw':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')][_0xeeea('0x11')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')][_0xeeea('0x16')]||null:null,'attributes':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')]['attributes']||null:null,'limit':_0x4739fb[_0xeeea('0x10')]?_0x4739fb[_0xeeea('0x10')]['limit']||null:null})[_0xeeea('0x6')](function(_0x39aee8){logger[_0xeeea('0xd')](_0xeeea('0x14'),_0x4739fb);logger[_0xeeea('0x9')](_0xeeea('0x14'),_0x4739fb,JSON[_0xeeea('0x12')](_0x39aee8));_0x36603b(_0x39aee8);})[_0xeeea('0x13')](function(_0x5385d0){logger['error'](_0xeeea('0x14'),_0x5385d0[_0xeeea('0xc')],_0x4739fb);_0xd0094f(_0x4b5fe1[_0xeeea('0xb')](0x1f4,_0x5385d0['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 01364d6..4464342 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 _0xee59=['./faxQueueReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xee59,0x14d));var _0x9ee5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xee59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x9ee5('0x0'));var path=require(_0x9ee5('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ee5('0x2'));var router=express[_0x9ee5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9ee5('0x4'));var interaction=require(_0x9ee5('0x5'));var config=require(_0x9ee5('0x6'));var controller=require(_0x9ee5('0x7'));router['get']('/',auth[_0x9ee5('0x8')](),controller['index']);router[_0x9ee5('0x9')](_0x9ee5('0xa'),auth['isAuthenticated'](),controller[_0x9ee5('0xb')]);router[_0x9ee5('0x9')](_0x9ee5('0xc'),auth['isAuthenticated'](),controller[_0x9ee5('0xd')]);router[_0x9ee5('0xe')]('/',auth[_0x9ee5('0x8')](),controller[_0x9ee5('0xf')]);router[_0x9ee5('0x10')](_0x9ee5('0xc'),auth[_0x9ee5('0x8')](),controller[_0x9ee5('0x11')]);router[_0x9ee5('0x12')](_0x9ee5('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x9ee5('0x13')]=router; \ No newline at end of file +var _0x0c29=['describe','show','create','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','index','/describe'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0c29,0xa2));var _0x90c2=function(_0x3b3a82,_0x53b5e0){_0x3b3a82=_0x3b3a82-0x0;var _0x267063=_0x0c29[_0x3b3a82];return _0x267063;};'use strict';var multer=require(_0x90c2('0x0'));var util=require(_0x90c2('0x1'));var path=require(_0x90c2('0x2'));var timeout=require(_0x90c2('0x3'));var express=require(_0x90c2('0x4'));var router=express[_0x90c2('0x5')]();var fs_extra=require(_0x90c2('0x6'));var auth=require(_0x90c2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x90c2('0x8'));var controller=require(_0x90c2('0x9'));router[_0x90c2('0xa')]('/',auth[_0x90c2('0xb')](),controller[_0x90c2('0xc')]);router[_0x90c2('0xa')](_0x90c2('0xd'),auth[_0x90c2('0xb')](),controller[_0x90c2('0xe')]);router[_0x90c2('0xa')]('/:id',auth[_0x90c2('0xb')](),controller[_0x90c2('0xf')]);router['post']('/',auth[_0x90c2('0xb')](),controller[_0x90c2('0x10')]);router[_0x90c2('0x11')](_0x90c2('0x12'),auth[_0x90c2('0xb')](),controller[_0x90c2('0x13')]);router[_0x90c2('0x14')](_0x90c2('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x90c2('0x15')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 2c43c80..39452e9 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 _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x409f7e,_0x124a5d){var _0x4b31bd=function(_0xe5cadd){while(--_0xe5cadd){_0x409f7e['push'](_0x409f7e['shift']());}};_0x4b31bd(++_0x124a5d);}(_0xe706,0xa3));var _0x6e70=function(_0x4c7935,_0x4a53fb){_0x4c7935=_0x4c7935-0x0;var _0x30651d=_0xe706[_0x4c7935];return _0x30651d;};'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 +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x1da911,_0x4555ef){var _0x266e9e=function(_0xab518c){while(--_0xab518c){_0x1da911['push'](_0x1da911['shift']());}};_0x266e9e(++_0x4555ef);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x39db05,_0x3868d0){_0x39db05=_0x39db05-0x0;var _0x3f0e22=_0xf3cd[_0x39db05];return _0x3f0e22;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index fdbf090..f35c395 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 _0x613f=['jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','FaxTransferReport','show','params','fields','includeAll','options','create','catch','update','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x522ff3,_0x314430){var _0x1d744e=function(_0x406c57){while(--_0x406c57){_0x522ff3['push'](_0x522ff3['shift']());}};_0x1d744e(++_0x314430);}(_0x613f,0xd2));var _0xf613=function(_0x2ed359,_0x31617b){_0x2ed359=_0x2ed359-0x0;var _0x153ae6=_0x613f[_0x2ed359];return _0x153ae6;};'use strict';var emlformat=require(_0xf613('0x0'));var rimraf=require(_0xf613('0x1'));var zipdir=require(_0xf613('0x2'));var jsonpatch=require(_0xf613('0x3'));var rp=require(_0xf613('0x4'));var moment=require(_0xf613('0x5'));var BPromise=require(_0xf613('0x6'));var Mustache=require(_0xf613('0x7'));var util=require(_0xf613('0x8'));var path=require(_0xf613('0x9'));var sox=require('sox');var csv=require(_0xf613('0xa'));var ejs=require(_0xf613('0xb'));var fs=require('fs');var fs_extra=require(_0xf613('0xc'));var _=require(_0xf613('0xd'));var squel=require(_0xf613('0xe'));var crypto=require('crypto');var jsforce=require(_0xf613('0xf'));var deskjs=require(_0xf613('0x10'));var toCsv=require(_0xf613('0xa'));var querystring=require('querystring');var Papa=require(_0xf613('0x11'));var Redis=require(_0xf613('0x12'));var authService=require(_0xf613('0x13'));var qs=require(_0xf613('0x14'));var as=require(_0xf613('0x15'));var hardwareService=require(_0xf613('0x16'));var logger=require(_0xf613('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf613('0x18'));var licenseUtil=require(_0xf613('0x19'));var db=require(_0xf613('0x1a'))['db'];function respondWithStatusCode(_0x2607a6,_0x503240){_0x503240=_0x503240||0xcc;return function(_0x5cb335){if(_0x5cb335){return _0x2607a6[_0xf613('0x1b')](_0x503240);}return _0x2607a6[_0xf613('0x1c')](_0x503240)[_0xf613('0x1d')]();};}function respondWithResult(_0xac11a6,_0xa35ba9){_0xa35ba9=_0xa35ba9||0xc8;return function(_0x5ca4db){if(_0x5ca4db){return _0xac11a6[_0xf613('0x1c')](_0xa35ba9)[_0xf613('0x1e')](_0x5ca4db);}};}function respondWithFilteredResult(_0x48c253,_0x5cdca2){return function(_0x7204fe){if(_0x7204fe){var _0x591c11=typeof _0x5cdca2[_0xf613('0x1f')]===_0xf613('0x20')&&typeof _0x5cdca2['limit']===_0xf613('0x20');var _0x45f208=_0x7204fe['count'];var _0x4b2b64=_0x591c11?0x0:_0x5cdca2[_0xf613('0x1f')];var _0xa7d9e8=_0x591c11?_0x7204fe[_0xf613('0x21')]:_0x5cdca2[_0xf613('0x1f')]+_0x5cdca2[_0xf613('0x22')];var _0x5dd27e;if(_0xa7d9e8>=_0x45f208){_0xa7d9e8=_0x45f208;_0x5dd27e=0xc8;}else{_0x5dd27e=0xce;}_0x48c253['status'](_0x5dd27e);return _0x48c253['set'](_0xf613('0x23'),_0x4b2b64+'-'+_0xa7d9e8+'/'+_0x45f208)['json'](_0x7204fe);}return null;};}function patchUpdates(_0x344cd1){return function(_0x207070){try{jsonpatch[_0xf613('0x24')](_0x207070,_0x344cd1,!![]);}catch(_0x31e49f){return BPromise[_0xf613('0x25')](_0x31e49f);}return _0x207070['save']();};}function saveUpdates(_0x3bb15f,_0x207281){return function(_0x5e2c28){if(_0x5e2c28){return _0x5e2c28['update'](_0x3bb15f)[_0xf613('0x26')](function(_0x35f434){return _0x35f434;});}return null;};}function removeEntity(_0x5203c0,_0x564c40){return function(_0x4a83d6){if(_0x4a83d6){return _0x4a83d6[_0xf613('0x27')]()[_0xf613('0x26')](function(){_0x5203c0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f5056,_0x58d8bc){return function(_0x20f1fa){if(!_0x20f1fa){_0x5f5056[_0xf613('0x1b')](0x194);}return _0x20f1fa;};}function handleError(_0x311e1d,_0x76f12){_0x76f12=_0x76f12||0x1f4;return function(_0x42c28d){logger[_0xf613('0x28')](_0x42c28d[_0xf613('0x29')]);if(_0x42c28d[_0xf613('0x2a')]){delete _0x42c28d[_0xf613('0x2a')];}_0x311e1d[_0xf613('0x1c')](_0x76f12)[_0xf613('0x2b')](_0x42c28d);};}exports[_0xf613('0x2c')]=function(_0x276609,_0x1dcba4){var _0x3e7db2={},_0x185eca={},_0x1d7eda={'count':0x0,'rows':[]};var _0x8ad756=_[_0xf613('0x2d')](db['FaxTransferReport'][_0xf613('0x2e')],function(_0xc5e826){return{'name':_0xc5e826[_0xf613('0x2f')],'type':_0xc5e826[_0xf613('0x30')][_0xf613('0x31')]};});_0x185eca[_0xf613('0x32')]=_[_0xf613('0x2d')](_0x8ad756,_0xf613('0x2a'));_0x185eca[_0xf613('0x33')]=_[_0xf613('0x34')](_0x276609['query']);_0x185eca['filters']=_[_0xf613('0x35')](_0x185eca[_0xf613('0x32')],_0x185eca[_0xf613('0x33')]);_0x3e7db2[_0xf613('0x36')]=_['intersection'](_0x185eca[_0xf613('0x32')],qs['fields'](_0x276609['query']['fields']));_0x3e7db2['attributes']=_0x3e7db2[_0xf613('0x36')][_0xf613('0x37')]?_0x3e7db2[_0xf613('0x36')]:_0x185eca['model'];if(!_0x276609[_0xf613('0x33')][_0xf613('0x38')]('nolimit')){_0x3e7db2[_0xf613('0x22')]=qs[_0xf613('0x22')](_0x276609[_0xf613('0x33')]['limit']);_0x3e7db2[_0xf613('0x1f')]=qs[_0xf613('0x1f')](_0x276609['query'][_0xf613('0x1f')]);}_0x3e7db2['order']=qs[_0xf613('0x39')](_0x276609[_0xf613('0x33')]['sort']);_0x3e7db2[_0xf613('0x3a')]=qs[_0xf613('0x3b')](_['pick'](_0x276609[_0xf613('0x33')],_0x185eca[_0xf613('0x3b')]),_0x8ad756);if(_0x276609['query'][_0xf613('0x3c')]){_0x3e7db2[_0xf613('0x3a')]=_['merge'](_0x3e7db2[_0xf613('0x3a')],{'$or':_[_0xf613('0x2d')](_0x8ad756,function(_0x4d971f){if(_0x4d971f[_0xf613('0x30')]!==_0xf613('0x3d')){var _0x5763fa={};_0x5763fa[_0x4d971f['name']]={'$like':'%'+_0x276609['query'][_0xf613('0x3c')]+'%'};return _0x5763fa;}})});}_0x3e7db2=_[_0xf613('0x3e')]({},_0x3e7db2,_0x276609['options']);var _0x39ccf0={'where':_0x3e7db2[_0xf613('0x3a')]};return db['FaxTransferReport']['count'](_0x39ccf0)[_0xf613('0x26')](function(_0x1a805d){_0x1d7eda[_0xf613('0x21')]=_0x1a805d;if(_0x276609[_0xf613('0x33')]['includeAll']){_0x3e7db2['include']=[{'all':!![]}];}return db[_0xf613('0x3f')]['findAll'](_0x3e7db2);})['then'](function(_0x2580ee){_0x1d7eda['rows']=_0x2580ee;return _0x1d7eda;})[_0xf613('0x26')](respondWithFilteredResult(_0x1dcba4,_0x3e7db2))['catch'](handleError(_0x1dcba4,null));};exports[_0xf613('0x40')]=function(_0xf750de,_0xedf3a7){var _0x23f138={'raw':!![],'where':{'id':_0xf750de[_0xf613('0x41')]['id']}},_0x2c3592={};_0x2c3592['model']=_[_0xf613('0x34')](db[_0xf613('0x3f')]['rawAttributes']);_0x2c3592['query']=_[_0xf613('0x34')](_0xf750de['query']);_0x2c3592[_0xf613('0x3b')]=_[_0xf613('0x35')](_0x2c3592[_0xf613('0x32')],_0x2c3592['query']);_0x23f138[_0xf613('0x36')]=_[_0xf613('0x35')](_0x2c3592['model'],qs[_0xf613('0x42')](_0xf750de[_0xf613('0x33')][_0xf613('0x42')]));_0x23f138[_0xf613('0x36')]=_0x23f138[_0xf613('0x36')][_0xf613('0x37')]?_0x23f138['attributes']:_0x2c3592[_0xf613('0x32')];if(_0xf750de['query'][_0xf613('0x43')]){_0x23f138['include']=[{'all':!![]}];}_0x23f138=_[_0xf613('0x3e')]({},_0x23f138,_0xf750de[_0xf613('0x44')]);return db[_0xf613('0x3f')]['find'](_0x23f138)['then'](handleEntityNotFound(_0xedf3a7,null))['then'](respondWithResult(_0xedf3a7,null))['catch'](handleError(_0xedf3a7,null));};exports['create']=function(_0x27e141,_0x1719dd){return db['FaxTransferReport'][_0xf613('0x45')](_0x27e141['body'],{})[_0xf613('0x26')](respondWithResult(_0x1719dd,0xc9))[_0xf613('0x46')](handleError(_0x1719dd,null));};exports[_0xf613('0x47')]=function(_0x4838e9,_0x24a5fa){if(_0x4838e9[_0xf613('0x48')]['id']){delete _0x4838e9[_0xf613('0x48')]['id'];}return db['FaxTransferReport']['find']({'where':{'id':_0x4838e9[_0xf613('0x41')]['id']}})[_0xf613('0x26')](handleEntityNotFound(_0x24a5fa,null))[_0xf613('0x26')](saveUpdates(_0x4838e9['body'],null))['then'](respondWithResult(_0x24a5fa,null))[_0xf613('0x46')](handleError(_0x24a5fa,null));};exports[_0xf613('0x27')]=function(_0x38d95f,_0x562839){return db[_0xf613('0x3f')][_0xf613('0x49')]({'where':{'id':_0x38d95f[_0xf613('0x41')]['id']}})[_0xf613('0x26')](handleEntityNotFound(_0x562839,null))[_0xf613('0x26')](removeEntity(_0x562839,null))[_0xf613('0x46')](handleError(_0x562839,null));};exports['describe']=function(_0x1b37e4,_0x4c0c8d){return db[_0xf613('0x3f')][_0xf613('0x4a')]()[_0xf613('0x26')](respondWithResult(_0x4c0c8d,null))[_0xf613('0x46')](handleError(_0x4c0c8d,null));}; \ No newline at end of file +var _0xc291=['desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','find','create','catch','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto'];(function(_0x5d14dc,_0x52fff4){var _0x8dce9c=function(_0x1aa012){while(--_0x1aa012){_0x5d14dc['push'](_0x5d14dc['shift']());}};_0x8dce9c(++_0x52fff4);}(_0xc291,0x88));var _0x1c29=function(_0x490cd3,_0x97d5ee){_0x490cd3=_0x490cd3-0x0;var _0x3320d7=_0xc291[_0x490cd3];return _0x3320d7;};'use strict';var emlformat=require(_0x1c29('0x0'));var rimraf=require(_0x1c29('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c29('0x2'));var rp=require(_0x1c29('0x3'));var moment=require('moment');var BPromise=require(_0x1c29('0x4'));var Mustache=require(_0x1c29('0x5'));var util=require(_0x1c29('0x6'));var path=require(_0x1c29('0x7'));var sox=require(_0x1c29('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c29('0x9'));var _=require(_0x1c29('0xa'));var squel=require('squel');var crypto=require(_0x1c29('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x1c29('0xc'));var toCsv=require(_0x1c29('0xd'));var querystring=require('querystring');var Papa=require(_0x1c29('0xe'));var Redis=require(_0x1c29('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1c29('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c29('0x11'));var logger=require('../../config/logger')(_0x1c29('0x12'));var utils=require(_0x1c29('0x13'));var config=require(_0x1c29('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11d45b,_0x53e3da){_0x53e3da=_0x53e3da||0xcc;return function(_0x43f37e){if(_0x43f37e){return _0x11d45b[_0x1c29('0x15')](_0x53e3da);}return _0x11d45b[_0x1c29('0x16')](_0x53e3da)['end']();};}function respondWithResult(_0x5485c2,_0x3482d1){_0x3482d1=_0x3482d1||0xc8;return function(_0x1e7f49){if(_0x1e7f49){return _0x5485c2[_0x1c29('0x16')](_0x3482d1)[_0x1c29('0x17')](_0x1e7f49);}};}function respondWithFilteredResult(_0x24d9d6,_0xa21099){return function(_0x2095dc){if(_0x2095dc){var _0x262b33=typeof _0xa21099['offset']===_0x1c29('0x18')&&typeof _0xa21099[_0x1c29('0x19')]===_0x1c29('0x18');var _0x3f0283=_0x2095dc['count'];var _0x4e5c8e=_0x262b33?0x0:_0xa21099[_0x1c29('0x1a')];var _0x1e706c=_0x262b33?_0x2095dc['count']:_0xa21099[_0x1c29('0x1a')]+_0xa21099[_0x1c29('0x19')];var _0x59da69;if(_0x1e706c>=_0x3f0283){_0x1e706c=_0x3f0283;_0x59da69=0xc8;}else{_0x59da69=0xce;}_0x24d9d6[_0x1c29('0x16')](_0x59da69);return _0x24d9d6[_0x1c29('0x1b')](_0x1c29('0x1c'),_0x4e5c8e+'-'+_0x1e706c+'/'+_0x3f0283)['json'](_0x2095dc);}return null;};}function patchUpdates(_0x49eab8){return function(_0x388439){try{jsonpatch['apply'](_0x388439,_0x49eab8,!![]);}catch(_0x7bd7ea){return BPromise[_0x1c29('0x1d')](_0x7bd7ea);}return _0x388439[_0x1c29('0x1e')]();};}function saveUpdates(_0x3a0dc1,_0x1977e8){return function(_0x4fc4d2){if(_0x4fc4d2){return _0x4fc4d2[_0x1c29('0x1f')](_0x3a0dc1)[_0x1c29('0x20')](function(_0x3fa477){return _0x3fa477;});}return null;};}function removeEntity(_0x35473f,_0x379473){return function(_0x56db4b){if(_0x56db4b){return _0x56db4b[_0x1c29('0x21')]()[_0x1c29('0x20')](function(){_0x35473f[_0x1c29('0x16')](0xcc)[_0x1c29('0x22')]();});}};}function handleEntityNotFound(_0x2ef358,_0x28a456){return function(_0x1b9045){if(!_0x1b9045){_0x2ef358[_0x1c29('0x15')](0x194);}return _0x1b9045;};}function handleError(_0x3493d9,_0x52206e){_0x52206e=_0x52206e||0x1f4;return function(_0x6fb216){logger[_0x1c29('0x23')](_0x6fb216[_0x1c29('0x24')]);if(_0x6fb216[_0x1c29('0x25')]){delete _0x6fb216[_0x1c29('0x25')];}_0x3493d9[_0x1c29('0x16')](_0x52206e)[_0x1c29('0x26')](_0x6fb216);};}exports[_0x1c29('0x27')]=function(_0x4cdef7,_0x2efe54){var _0x3d3deb={},_0x19584d={},_0x294a20={'count':0x0,'rows':[]};var _0x8783ef=_['map'](db[_0x1c29('0x28')][_0x1c29('0x29')],function(_0x33bbfb){return{'name':_0x33bbfb[_0x1c29('0x2a')],'type':_0x33bbfb[_0x1c29('0x2b')][_0x1c29('0x2c')]};});_0x19584d['model']=_[_0x1c29('0x2d')](_0x8783ef,_0x1c29('0x25'));_0x19584d[_0x1c29('0x2e')]=_[_0x1c29('0x2f')](_0x4cdef7[_0x1c29('0x2e')]);_0x19584d['filters']=_[_0x1c29('0x30')](_0x19584d[_0x1c29('0x31')],_0x19584d[_0x1c29('0x2e')]);_0x3d3deb[_0x1c29('0x32')]=_[_0x1c29('0x30')](_0x19584d[_0x1c29('0x31')],qs[_0x1c29('0x33')](_0x4cdef7['query']['fields']));_0x3d3deb[_0x1c29('0x32')]=_0x3d3deb[_0x1c29('0x32')][_0x1c29('0x34')]?_0x3d3deb[_0x1c29('0x32')]:_0x19584d['model'];if(!_0x4cdef7['query']['hasOwnProperty']('nolimit')){_0x3d3deb[_0x1c29('0x19')]=qs['limit'](_0x4cdef7[_0x1c29('0x2e')][_0x1c29('0x19')]);_0x3d3deb[_0x1c29('0x1a')]=qs[_0x1c29('0x1a')](_0x4cdef7[_0x1c29('0x2e')][_0x1c29('0x1a')]);}_0x3d3deb[_0x1c29('0x35')]=qs[_0x1c29('0x36')](_0x4cdef7[_0x1c29('0x2e')]['sort']);_0x3d3deb[_0x1c29('0x37')]=qs[_0x1c29('0x38')](_[_0x1c29('0x39')](_0x4cdef7[_0x1c29('0x2e')],_0x19584d['filters']),_0x8783ef);if(_0x4cdef7[_0x1c29('0x2e')][_0x1c29('0x3a')]){_0x3d3deb[_0x1c29('0x37')]=_[_0x1c29('0x3b')](_0x3d3deb[_0x1c29('0x37')],{'$or':_[_0x1c29('0x2d')](_0x8783ef,function(_0xaf39aa){if(_0xaf39aa[_0x1c29('0x2b')]!==_0x1c29('0x3c')){var _0x146589={};_0x146589[_0xaf39aa[_0x1c29('0x25')]]={'$like':'%'+_0x4cdef7['query']['filter']+'%'};return _0x146589;}})});}_0x3d3deb=_[_0x1c29('0x3b')]({},_0x3d3deb,_0x4cdef7[_0x1c29('0x3d')]);var _0x533b3f={'where':_0x3d3deb[_0x1c29('0x37')]};return db[_0x1c29('0x28')][_0x1c29('0x3e')](_0x533b3f)[_0x1c29('0x20')](function(_0x27e9d6){_0x294a20[_0x1c29('0x3e')]=_0x27e9d6;if(_0x4cdef7['query'][_0x1c29('0x3f')]){_0x3d3deb[_0x1c29('0x40')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x1c29('0x41')](_0x3d3deb);})[_0x1c29('0x20')](function(_0xccbd45){_0x294a20[_0x1c29('0x42')]=_0xccbd45;return _0x294a20;})[_0x1c29('0x20')](respondWithFilteredResult(_0x2efe54,_0x3d3deb))['catch'](handleError(_0x2efe54,null));};exports[_0x1c29('0x43')]=function(_0x3e707a,_0x414f2b){var _0x59b7d0={'raw':!![],'where':{'id':_0x3e707a[_0x1c29('0x44')]['id']}},_0x2a4285={};_0x2a4285[_0x1c29('0x31')]=_[_0x1c29('0x2f')](db[_0x1c29('0x28')][_0x1c29('0x29')]);_0x2a4285[_0x1c29('0x2e')]=_[_0x1c29('0x2f')](_0x3e707a['query']);_0x2a4285[_0x1c29('0x38')]=_[_0x1c29('0x30')](_0x2a4285[_0x1c29('0x31')],_0x2a4285['query']);_0x59b7d0[_0x1c29('0x32')]=_[_0x1c29('0x30')](_0x2a4285['model'],qs[_0x1c29('0x33')](_0x3e707a[_0x1c29('0x2e')][_0x1c29('0x33')]));_0x59b7d0[_0x1c29('0x32')]=_0x59b7d0['attributes'][_0x1c29('0x34')]?_0x59b7d0[_0x1c29('0x32')]:_0x2a4285[_0x1c29('0x31')];if(_0x3e707a[_0x1c29('0x2e')][_0x1c29('0x3f')]){_0x59b7d0[_0x1c29('0x40')]=[{'all':!![]}];}_0x59b7d0=_[_0x1c29('0x3b')]({},_0x59b7d0,_0x3e707a[_0x1c29('0x3d')]);return db[_0x1c29('0x28')][_0x1c29('0x45')](_0x59b7d0)[_0x1c29('0x20')](handleEntityNotFound(_0x414f2b,null))[_0x1c29('0x20')](respondWithResult(_0x414f2b,null))['catch'](handleError(_0x414f2b,null));};exports[_0x1c29('0x46')]=function(_0x5e0dae,_0x50346e){return db[_0x1c29('0x28')][_0x1c29('0x46')](_0x5e0dae['body'],{})[_0x1c29('0x20')](respondWithResult(_0x50346e,0xc9))[_0x1c29('0x47')](handleError(_0x50346e,null));};exports[_0x1c29('0x1f')]=function(_0x4508aa,_0x9b1b90){if(_0x4508aa[_0x1c29('0x48')]['id']){delete _0x4508aa['body']['id'];}return db[_0x1c29('0x28')]['find']({'where':{'id':_0x4508aa[_0x1c29('0x44')]['id']}})[_0x1c29('0x20')](handleEntityNotFound(_0x9b1b90,null))[_0x1c29('0x20')](saveUpdates(_0x4508aa[_0x1c29('0x48')],null))['then'](respondWithResult(_0x9b1b90,null))['catch'](handleError(_0x9b1b90,null));};exports[_0x1c29('0x21')]=function(_0x4fcfa9,_0x4aa22d){return db[_0x1c29('0x28')][_0x1c29('0x45')]({'where':{'id':_0x4fcfa9['params']['id']}})['then'](handleEntityNotFound(_0x4aa22d,null))[_0x1c29('0x20')](removeEntity(_0x4aa22d,null))[_0x1c29('0x47')](handleError(_0x4aa22d,null));};exports[_0x1c29('0x49')]=function(_0x58a091,_0x3286fa){return db['FaxTransferReport'][_0x1c29('0x49')]()[_0x1c29('0x20')](respondWithResult(_0x3286fa,null))[_0x1c29('0x47')](handleError(_0x3286fa,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 2428447..5788255 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 _0xbba6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xbba6,0x1a4));var _0x6bba=function(_0x5a57d4,_0x315760){_0x5a57d4=_0x5a57d4-0x0;var _0x11f5a3=_0xbba6[_0x5a57d4];return _0x11f5a3;};'use strict';var _=require(_0x6bba('0x0'));var util=require(_0x6bba('0x1'));var logger=require(_0x6bba('0x2'))('api');var moment=require(_0x6bba('0x3'));var BPromise=require(_0x6bba('0x4'));var rp=require(_0x6bba('0x5'));var fs=require('fs');var path=require(_0x6bba('0x6'));var rimraf=require(_0x6bba('0x7'));var config=require(_0x6bba('0x8'));var attributes=require(_0x6bba('0x9'));module[_0x6bba('0xa')]=function(_0xa9f41f,_0x5d04a3){return _0xa9f41f[_0x6bba('0xb')]('FaxTransferReport',attributes,{'tableName':_0x6bba('0xc'),'paranoid':![],'indexes':[{'name':_0x6bba('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfdc6=['uniqueid','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','FaxTransferReport','report_fax_transfer'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xfdc6,0xf3));var _0x6fdc=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0xfdc6[_0x186376];return _0x2dbdd9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6fdc('0x0'))(_0x6fdc('0x1'));var moment=require('moment');var BPromise=require(_0x6fdc('0x2'));var rp=require(_0x6fdc('0x3'));var fs=require('fs');var path=require(_0x6fdc('0x4'));var rimraf=require(_0x6fdc('0x5'));var config=require(_0x6fdc('0x6'));var attributes=require('./faxTransferReport.attributes');module[_0x6fdc('0x7')]=function(_0x5a651b,_0x5e9de5){return _0x5a651b['define'](_0x6fdc('0x8'),attributes,{'tableName':_0x6fdc('0x9'),'paranoid':![],'indexes':[{'name':_0x6fdc('0xa'),'fields':[_0x6fdc('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 0a85599..2161f81 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 _0x1557=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','code'];(function(_0x8b012e,_0x3d33bf){var _0x3b8b13=function(_0x1e2b74){while(--_0x1e2b74){_0x8b012e['push'](_0x8b012e['shift']());}};_0x3b8b13(++_0x3d33bf);}(_0x1557,0xc4));var _0x7155=function(_0x4209b4,_0x12b0ba){_0x4209b4=_0x4209b4-0x0;var _0x4eeb1a=_0x1557[_0x4209b4];return _0x4eeb1a;};'use strict';var _=require(_0x7155('0x0'));var util=require(_0x7155('0x1'));var moment=require(_0x7155('0x2'));var BPromise=require(_0x7155('0x3'));var rs=require(_0x7155('0x4'));var fs=require('fs');var Redis=require(_0x7155('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7155('0x6'));var logger=require(_0x7155('0x7'))(_0x7155('0x8'));var config=require(_0x7155('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7155('0xa')][_0x7155('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5244c4,_0xa3ea9d,_0xd80fbf){return new BPromise(function(_0x132083,_0x21c36d){return client['request'](_0x5244c4,_0xd80fbf)[_0x7155('0xc')](function(_0x5e873c){logger[_0x7155('0xd')](_0x7155('0xe'),_0xa3ea9d,_0x7155('0xf'));logger[_0x7155('0x10')](_0x7155('0x11'),_0xa3ea9d,'request\x20sent',JSON[_0x7155('0x12')](_0x5e873c));if(_0x5e873c['error']){if(_0x5e873c['error'][_0x7155('0x13')]===0x1f4){logger[_0x7155('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0xa3ea9d,_0x5e873c['error'][_0x7155('0x15')]);return _0x21c36d(_0x5e873c[_0x7155('0x14')][_0x7155('0x15')]);}logger[_0x7155('0x14')](_0x7155('0xe'),_0xa3ea9d,_0x5e873c[_0x7155('0x14')][_0x7155('0x15')]);return _0x132083(_0x5e873c[_0x7155('0x14')][_0x7155('0x15')]);}else{logger[_0x7155('0xd')](_0x7155('0xe'),_0xa3ea9d,_0x7155('0xf'));_0x132083(_0x5e873c[_0x7155('0x16')][_0x7155('0x15')]);}})[_0x7155('0x17')](function(_0x3287fb){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0xa3ea9d,_0x3287fb);_0x21c36d(_0x3287fb);});});} \ No newline at end of file +var _0xf6b8=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error','FaxTransferReport,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xf6b8,0x121));var _0x8f6b=function(_0x445cb6,_0x57cc15){_0x445cb6=_0x445cb6-0x0;var _0x38c54f=_0xf6b8[_0x445cb6];return _0x38c54f;};'use strict';var _=require(_0x8f6b('0x0'));var util=require(_0x8f6b('0x1'));var moment=require(_0x8f6b('0x2'));var BPromise=require(_0x8f6b('0x3'));var rs=require(_0x8f6b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8f6b('0x5'));var logger=require('../../config/logger')(_0x8f6b('0x6'));var config=require(_0x8f6b('0x7'));var jayson=require(_0x8f6b('0x8'));var client=jayson[_0x8f6b('0x9')][_0x8f6b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x452e49,_0x5b0ee9,_0x3a8722){return new BPromise(function(_0x4aa394,_0x30519e){return client['request'](_0x452e49,_0x3a8722)[_0x8f6b('0xb')](function(_0x537dac){logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x8f6b('0xc'));logger[_0x8f6b('0xd')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x5b0ee9,_0x8f6b('0xc'),JSON[_0x8f6b('0xe')](_0x537dac));if(_0x537dac[_0x8f6b('0xf')]){if(_0x537dac[_0x8f6b('0xf')]['code']===0x1f4){logger[_0x8f6b('0xf')](_0x8f6b('0x10'),_0x5b0ee9,_0x537dac[_0x8f6b('0xf')][_0x8f6b('0x11')]);return _0x30519e(_0x537dac[_0x8f6b('0xf')][_0x8f6b('0x11')]);}logger[_0x8f6b('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x537dac[_0x8f6b('0xf')]['message']);return _0x4aa394(_0x537dac[_0x8f6b('0xf')][_0x8f6b('0x11')]);}else{logger[_0x8f6b('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x8f6b('0xc'));_0x4aa394(_0x537dac[_0x8f6b('0x13')][_0x8f6b('0x11')]);}})[_0x8f6b('0x14')](function(_0x58ac27){logger[_0x8f6b('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x5b0ee9,_0x58ac27);_0x30519e(_0x58ac27);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index ba485dc..ce66dc6 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 _0x522d=['express','Router','fs-extra','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','delete','destroy','multer','util','connect-timeout'];(function(_0x12a5ac,_0x4cb0d2){var _0x282958=function(_0x3ae041){while(--_0x3ae041){_0x12a5ac['push'](_0x12a5ac['shift']());}};_0x282958(++_0x4cb0d2);}(_0x522d,0x18d));var _0xd522=function(_0x2112bf,_0x5c3711){_0x2112bf=_0x2112bf-0x0;var _0x3580c3=_0x522d[_0x2112bf];return _0x3580c3;};'use strict';var multer=require(_0xd522('0x0'));var util=require(_0xd522('0x1'));var path=require('path');var timeout=require(_0xd522('0x2'));var express=require(_0xd522('0x3'));var router=express[_0xd522('0x4')]();var fs_extra=require(_0xd522('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd522('0x6'));var controller=require(_0xd522('0x7'));router[_0xd522('0x8')]('/',auth[_0xd522('0x9')](),controller[_0xd522('0xa')]);router[_0xd522('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xd522('0xb')]);router[_0xd522('0x8')]('/:id',auth[_0xd522('0x9')](),controller[_0xd522('0xc')]);router[_0xd522('0xd')]('/',auth[_0xd522('0x9')](),controller[_0xd522('0xe')]);router[_0xd522('0xf')](_0xd522('0x10'),auth[_0xd522('0x9')](),controller[_0xd522('0x11')]);router[_0xd522('0x12')](_0xd522('0x10'),auth[_0xd522('0x9')](),controller[_0xd522('0x13')]);module['exports']=router; \ No newline at end of file +var _0x0277=['fs-extra','../../components/auth/service','../../components/interaction/service','./faxTransferReport.controller','isAuthenticated','index','get','/describe','/:id','show','create','put','exports','multer','connect-timeout','express','Router'];(function(_0x6dc660,_0x5e63fb){var _0x4fa02a=function(_0x3351f3){while(--_0x3351f3){_0x6dc660['push'](_0x6dc660['shift']());}};_0x4fa02a(++_0x5e63fb);}(_0x0277,0x1c7));var _0x7027=function(_0x256b96,_0x160abc){_0x256b96=_0x256b96-0x0;var _0x3b5bb0=_0x0277[_0x256b96];return _0x3b5bb0;};'use strict';var multer=require(_0x7027('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7027('0x1'));var express=require(_0x7027('0x2'));var router=express[_0x7027('0x3')]();var fs_extra=require(_0x7027('0x4'));var auth=require(_0x7027('0x5'));var interaction=require(_0x7027('0x6'));var config=require('../../config/environment');var controller=require(_0x7027('0x7'));router['get']('/',auth[_0x7027('0x8')](),controller[_0x7027('0x9')]);router[_0x7027('0xa')](_0x7027('0xb'),auth[_0x7027('0x8')](),controller['describe']);router[_0x7027('0xa')](_0x7027('0xc'),auth[_0x7027('0x8')](),controller[_0x7027('0xd')]);router['post']('/',auth[_0x7027('0x8')](),controller[_0x7027('0xe')]);router[_0x7027('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete'](_0x7027('0xc'),auth[_0x7027('0x8')](),controller['destroy']);module[_0x7027('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 3b84bb5..c3e41a4 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 _0x31b4=['multer','util','path','connect-timeout','Router','../../components/auth/service','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports'];(function(_0x1ca726,_0x30fd0a){var _0x9d1354=function(_0x1990fb){while(--_0x1990fb){_0x1ca726['push'](_0x1ca726['shift']());}};_0x9d1354(++_0x30fd0a);}(_0x31b4,0x8a));var _0x431b=function(_0x25a420,_0x152667){_0x25a420=_0x25a420-0x0;var _0x42b1f4=_0x31b4[_0x25a420];return _0x42b1f4;};'use strict';var multer=require(_0x431b('0x0'));var util=require(_0x431b('0x1'));var path=require(_0x431b('0x2'));var timeout=require(_0x431b('0x3'));var express=require('express');var router=express[_0x431b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x431b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x431b('0x6'));router[_0x431b('0x7')]('/',auth[_0x431b('0x8')](),controller[_0x431b('0x9')]);router[_0x431b('0x7')](_0x431b('0xa'),auth[_0x431b('0x8')](),controller[_0x431b('0xb')]);router[_0x431b('0x7')](_0x431b('0xc'),auth[_0x431b('0x8')](),controller[_0x431b('0xd')]);router[_0x431b('0x7')]('/:id/fields',auth['isAuthenticated'](),controller[_0x431b('0xe')]);router[_0x431b('0xf')]('/',auth[_0x431b('0x8')](),controller[_0x431b('0x10')]);router[_0x431b('0xf')](_0x431b('0xc'),auth[_0x431b('0x8')](),controller[_0x431b('0x11')]);router[_0x431b('0x12')](_0x431b('0xa'),auth['isAuthenticated'](),controller[_0x431b('0x13')]);router[_0x431b('0x14')]('/:id',auth[_0x431b('0x8')](),controller[_0x431b('0x15')]);module[_0x431b('0x16')]=router; \ No newline at end of file +var _0x1509=['isAuthenticated','get','/:id','/:id/configurations','getConfigurations','getFields','create','post','put','update','delete','exports','multer','path','express','fs-extra','./intDeskAccount.controller'];(function(_0xf47556,_0x2dbeb6){var _0x555b95=function(_0x42419a){while(--_0x42419a){_0xf47556['push'](_0xf47556['shift']());}};_0x555b95(++_0x2dbeb6);}(_0x1509,0x1c6));var _0x9150=function(_0x2f700f,_0xd740b3){_0x2f700f=_0x2f700f-0x0;var _0x216e4a=_0x1509[_0x2f700f];return _0x216e4a;};'use strict';var multer=require(_0x9150('0x0'));var util=require('util');var path=require(_0x9150('0x1'));var timeout=require('connect-timeout');var express=require(_0x9150('0x2'));var router=express['Router']();var fs_extra=require(_0x9150('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9150('0x4'));router['get']('/',auth[_0x9150('0x5')](),controller['index']);router[_0x9150('0x6')](_0x9150('0x7'),auth[_0x9150('0x5')](),controller['show']);router[_0x9150('0x6')](_0x9150('0x8'),auth[_0x9150('0x5')](),controller[_0x9150('0x9')]);router[_0x9150('0x6')]('/:id/fields',auth[_0x9150('0x5')](),controller[_0x9150('0xa')]);router['post']('/',auth[_0x9150('0x5')](),controller[_0x9150('0xb')]);router[_0x9150('0xc')](_0x9150('0x8'),auth[_0x9150('0x5')](),controller['addConfiguration']);router[_0x9150('0xd')](_0x9150('0x7'),auth[_0x9150('0x5')](),controller[_0x9150('0xe')]);router[_0x9150('0xf')](_0x9150('0x7'),auth[_0x9150('0x5')](),controller['destroy']);module[_0x9150('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7892826..d833792 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 _0x87dd=['basic','integrationTab','newTab','sequelize','exports','STRING','ENUM'];(function(_0x3e7f09,_0x1f9966){var _0x5cba40=function(_0x9c85ae){while(--_0x9c85ae){_0x3e7f09['push'](_0x3e7f09['shift']());}};_0x5cba40(++_0x1f9966);}(_0x87dd,0x6c));var _0xd87d=function(_0x2300f2,_0x315c5f){_0x2300f2=_0x2300f2-0x0;var _0x6bd508=_0x87dd[_0x2300f2];return _0x6bd508;};'use strict';var Sequelize=require(_0xd87d('0x0'));module[_0xd87d('0x1')]={'name':{'type':Sequelize[_0xd87d('0x2')]},'description':{'type':Sequelize[_0xd87d('0x2')]},'username':{'type':Sequelize[_0xd87d('0x2')]},'remoteUri':{'type':Sequelize[_0xd87d('0x2')]},'authType':{'type':Sequelize[_0xd87d('0x3')](_0xd87d('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0xd87d('0x2')]},'consumerKey':{'type':Sequelize[_0xd87d('0x2')]},'consumerSecret':{'type':Sequelize[_0xd87d('0x2')]},'token':{'type':Sequelize[_0xd87d('0x2')]},'tokenSecret':{'type':Sequelize[_0xd87d('0x2')]},'serverUrl':{'type':Sequelize[_0xd87d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xd87d('0x3')](_0xd87d('0x5'),_0xd87d('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x4ede=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x1990e5,_0x2e9bd1){var _0x2c97a6=function(_0x1c5d00){while(--_0x1c5d00){_0x1990e5['push'](_0x1990e5['shift']());}};_0x2c97a6(++_0x2e9bd1);}(_0x4ede,0x1c8));var _0xe4ed=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4ede[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require('sequelize');module[_0xe4ed('0x0')]={'name':{'type':Sequelize[_0xe4ed('0x1')]},'description':{'type':Sequelize[_0xe4ed('0x1')]},'username':{'type':Sequelize[_0xe4ed('0x1')]},'remoteUri':{'type':Sequelize[_0xe4ed('0x1')]},'authType':{'type':Sequelize[_0xe4ed('0x2')]('basic'),'defaultValue':_0xe4ed('0x3')},'password':{'type':Sequelize[_0xe4ed('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0xe4ed('0x1')]},'token':{'type':Sequelize[_0xe4ed('0x1')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe4ed('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe4ed('0x2')](_0xe4ed('0x4'),_0xe4ed('0x5')),'defaultValue':_0xe4ed('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index fe2e52c..9ce4119 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 _0x272f=['where','VIRTUAL','DeskAccount','count','includeAll','include','rows','show','params','rawAttributes','find','catch','create','body','getConfigurations','findOne','DeskConfiguration','order','options','hasOwnProperty','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','basic','headers','Authorization','toString','base64','_embedded','entries','active','test','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','update','then','destroy','stack','name','send','index','fieldName','type','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','merge'];(function(_0x52bc6a,_0x185105){var _0x1c2562=function(_0x1c6a0a){while(--_0x1c6a0a){_0x52bc6a['push'](_0x52bc6a['shift']());}};_0x1c2562(++_0x185105);}(_0x272f,0x119));var _0xf272=function(_0x4b31e3,_0x17fd2e){_0x4b31e3=_0x4b31e3-0x0;var _0x3672e8=_0x272f[_0x4b31e3];return _0x3672e8;};'use strict';var emlformat=require(_0xf272('0x0'));var rimraf=require(_0xf272('0x1'));var zipdir=require(_0xf272('0x2'));var jsonpatch=require(_0xf272('0x3'));var rp=require(_0xf272('0x4'));var moment=require(_0xf272('0x5'));var BPromise=require(_0xf272('0x6'));var Mustache=require(_0xf272('0x7'));var util=require(_0xf272('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xf272('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf272('0xa'));var crypto=require(_0xf272('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf272('0xc'));var Papa=require(_0xf272('0xd'));var Redis=require(_0xf272('0xe'));var authService=require(_0xf272('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf272('0x10'));var hardwareService=require(_0xf272('0x11'));var logger=require(_0xf272('0x12'))('api');var utils=require(_0xf272('0x13'));var config=require(_0xf272('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf272('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1a3fe0,_0x4fdfb1){_0x4fdfb1=_0x4fdfb1||0xcc;return function(_0x568b71){if(_0x568b71){return _0x1a3fe0[_0xf272('0x16')](_0x4fdfb1);}return _0x1a3fe0[_0xf272('0x17')](_0x4fdfb1)[_0xf272('0x18')]();};}function respondWithResult(_0x2a4d74,_0x5582a6){_0x5582a6=_0x5582a6||0xc8;return function(_0x207401){if(_0x207401){return _0x2a4d74['status'](_0x5582a6)[_0xf272('0x19')](_0x207401);}};}function respondWithFilteredResult(_0x3a27a0,_0x1cf4d4){return function(_0x783ebb){if(_0x783ebb){var _0x1fc7f3=typeof _0x1cf4d4[_0xf272('0x1a')]===_0xf272('0x1b')&&typeof _0x1cf4d4[_0xf272('0x1c')]===_0xf272('0x1b');var _0x509685=_0x783ebb['count'];var _0x7662fc=_0x1fc7f3?0x0:_0x1cf4d4[_0xf272('0x1a')];var _0x4a2547=_0x1fc7f3?_0x783ebb['count']:_0x1cf4d4['offset']+_0x1cf4d4[_0xf272('0x1c')];var _0x410e25;if(_0x4a2547>=_0x509685){_0x4a2547=_0x509685;_0x410e25=0xc8;}else{_0x410e25=0xce;}_0x3a27a0['status'](_0x410e25);return _0x3a27a0[_0xf272('0x1d')]('Content-Range',_0x7662fc+'-'+_0x4a2547+'/'+_0x509685)['json'](_0x783ebb);}return null;};}function patchUpdates(_0x4bda34){return function(_0x206455){try{jsonpatch[_0xf272('0x1e')](_0x206455,_0x4bda34,!![]);}catch(_0x448afd){return BPromise['reject'](_0x448afd);}return _0x206455[_0xf272('0x1f')]();};}function saveUpdates(_0x31cc88,_0x4aa384){return function(_0x5a5309){if(_0x5a5309){return _0x5a5309[_0xf272('0x20')](_0x31cc88)[_0xf272('0x21')](function(_0x2a7546){return _0x2a7546;});}return null;};}function removeEntity(_0x2100fe,_0x549a90){return function(_0x343ed0){if(_0x343ed0){return _0x343ed0[_0xf272('0x22')]()[_0xf272('0x21')](function(){_0x2100fe[_0xf272('0x17')](0xcc)[_0xf272('0x18')]();});}};}function handleEntityNotFound(_0x1a5c7a,_0x5da0a7){return function(_0x2c8864){if(!_0x2c8864){_0x1a5c7a[_0xf272('0x16')](0x194);}return _0x2c8864;};}function handleError(_0xc8baee,_0x285858){_0x285858=_0x285858||0x1f4;return function(_0xf74be4){logger['error'](_0xf74be4[_0xf272('0x23')]);if(_0xf74be4[_0xf272('0x24')]){delete _0xf74be4[_0xf272('0x24')];}_0xc8baee[_0xf272('0x17')](_0x285858)[_0xf272('0x25')](_0xf74be4);};}exports[_0xf272('0x26')]=function(_0x4a046c,_0x223455){var _0x3a4fab={},_0x57903c={},_0x12cb69={'count':0x0,'rows':[]};var _0x30851e=_['map'](db['DeskAccount']['rawAttributes'],function(_0x5dd878){return{'name':_0x5dd878[_0xf272('0x27')],'type':_0x5dd878[_0xf272('0x28')]['key']};});_0x57903c[_0xf272('0x29')]=_[_0xf272('0x2a')](_0x30851e,_0xf272('0x24'));_0x57903c['query']=_[_0xf272('0x2b')](_0x4a046c[_0xf272('0x2c')]);_0x57903c[_0xf272('0x2d')]=_[_0xf272('0x2e')](_0x57903c['model'],_0x57903c[_0xf272('0x2c')]);_0x3a4fab[_0xf272('0x2f')]=_['intersection'](_0x57903c[_0xf272('0x29')],qs[_0xf272('0x30')](_0x4a046c[_0xf272('0x2c')][_0xf272('0x30')]));_0x3a4fab[_0xf272('0x2f')]=_0x3a4fab[_0xf272('0x2f')][_0xf272('0x31')]?_0x3a4fab[_0xf272('0x2f')]:_0x57903c['model'];if(!_0x4a046c['query']['hasOwnProperty'](_0xf272('0x32'))){_0x3a4fab['limit']=qs[_0xf272('0x1c')](_0x4a046c[_0xf272('0x2c')]['limit']);_0x3a4fab[_0xf272('0x1a')]=qs[_0xf272('0x1a')](_0x4a046c['query'][_0xf272('0x1a')]);}_0x3a4fab['order']=qs[_0xf272('0x33')](_0x4a046c[_0xf272('0x2c')][_0xf272('0x33')]);_0x3a4fab['where']=qs[_0xf272('0x2d')](_[_0xf272('0x34')](_0x4a046c['query'],_0x57903c[_0xf272('0x2d')]),_0x30851e);if(_0x4a046c[_0xf272('0x2c')][_0xf272('0x35')]){_0x3a4fab['where']=_[_0xf272('0x36')](_0x3a4fab[_0xf272('0x37')],{'$or':_[_0xf272('0x2a')](_0x30851e,function(_0x3f8861){if(_0x3f8861[_0xf272('0x28')]!==_0xf272('0x38')){var _0x18e36b={};_0x18e36b[_0x3f8861[_0xf272('0x24')]]={'$like':'%'+_0x4a046c[_0xf272('0x2c')][_0xf272('0x35')]+'%'};return _0x18e36b;}})});}_0x3a4fab=_[_0xf272('0x36')]({},_0x3a4fab,_0x4a046c['options']);var _0x4d887b={'where':_0x3a4fab[_0xf272('0x37')]};return db[_0xf272('0x39')]['count'](_0x4d887b)[_0xf272('0x21')](function(_0x37d6a5){_0x12cb69[_0xf272('0x3a')]=_0x37d6a5;if(_0x4a046c[_0xf272('0x2c')][_0xf272('0x3b')]){_0x3a4fab[_0xf272('0x3c')]=[{'all':!![]}];}return db['DeskAccount']['findAll'](_0x3a4fab);})[_0xf272('0x21')](function(_0x8e011e){_0x12cb69[_0xf272('0x3d')]=_0x8e011e;return _0x12cb69;})[_0xf272('0x21')](respondWithFilteredResult(_0x223455,_0x3a4fab))['catch'](handleError(_0x223455,null));};exports[_0xf272('0x3e')]=function(_0x44a24e,_0x47d190){var _0x51e67d={'raw':![],'where':{'id':_0x44a24e[_0xf272('0x3f')]['id']}},_0x21f4ff={};_0x21f4ff[_0xf272('0x29')]=_[_0xf272('0x2b')](db[_0xf272('0x39')][_0xf272('0x40')]);_0x21f4ff[_0xf272('0x2c')]=_[_0xf272('0x2b')](_0x44a24e['query']);_0x21f4ff[_0xf272('0x2d')]=_['intersection'](_0x21f4ff[_0xf272('0x29')],_0x21f4ff[_0xf272('0x2c')]);_0x51e67d[_0xf272('0x2f')]=_['intersection'](_0x21f4ff[_0xf272('0x29')],qs[_0xf272('0x30')](_0x44a24e['query'][_0xf272('0x30')]));_0x51e67d[_0xf272('0x2f')]=_0x51e67d[_0xf272('0x2f')][_0xf272('0x31')]?_0x51e67d[_0xf272('0x2f')]:_0x21f4ff[_0xf272('0x29')];if(_0x44a24e['query']['includeAll']){_0x51e67d[_0xf272('0x3c')]=[{'all':!![]}];}_0x51e67d=_[_0xf272('0x36')]({},_0x51e67d,_0x44a24e['options']);return db[_0xf272('0x39')][_0xf272('0x41')](_0x51e67d)[_0xf272('0x21')](handleEntityNotFound(_0x47d190,null))[_0xf272('0x21')](respondWithResult(_0x47d190,null))[_0xf272('0x42')](handleError(_0x47d190,null));};exports[_0xf272('0x43')]=function(_0x21f3c4,_0x1ff3e7){return db[_0xf272('0x39')]['create'](_0x21f3c4[_0xf272('0x44')],{})[_0xf272('0x21')](respondWithResult(_0x1ff3e7,0xc9))[_0xf272('0x42')](handleError(_0x1ff3e7,null));};exports[_0xf272('0x20')]=function(_0x479c7b,_0xdc2f4a){if(_0x479c7b[_0xf272('0x44')]['id']){delete _0x479c7b[_0xf272('0x44')]['id'];}return db[_0xf272('0x39')][_0xf272('0x41')]({'where':{'id':_0x479c7b[_0xf272('0x3f')]['id']}})[_0xf272('0x21')](handleEntityNotFound(_0xdc2f4a,null))[_0xf272('0x21')](saveUpdates(_0x479c7b[_0xf272('0x44')],null))[_0xf272('0x21')](respondWithResult(_0xdc2f4a,null))[_0xf272('0x42')](handleError(_0xdc2f4a,null));};exports[_0xf272('0x22')]=function(_0x1497f4,_0x5bb5e2){return db[_0xf272('0x39')][_0xf272('0x41')]({'where':{'id':_0x1497f4[_0xf272('0x3f')]['id']}})[_0xf272('0x21')](handleEntityNotFound(_0x5bb5e2,null))[_0xf272('0x21')](removeEntity(_0x5bb5e2,null))[_0xf272('0x42')](handleError(_0x5bb5e2,null));};exports[_0xf272('0x45')]=function(_0x3fc3e9,_0x1b42b6,_0x42bdb0){var _0x544a5e={};var _0x5ef7d8={};var _0x21c4dd;var _0xf78fcc;return db['DeskAccount'][_0xf272('0x46')]({'where':{'id':_0x3fc3e9['params']['id']}})[_0xf272('0x21')](handleEntityNotFound(_0x1b42b6,null))[_0xf272('0x21')](function(_0x344b21){if(_0x344b21){_0x21c4dd=_0x344b21;_0x5ef7d8[_0xf272('0x29')]=_['keys'](db[_0xf272('0x47')][_0xf272('0x40')]);_0x5ef7d8['query']=_['keys'](_0x3fc3e9['query']);_0x5ef7d8['filters']=_[_0xf272('0x2e')](_0x5ef7d8[_0xf272('0x29')],_0x5ef7d8[_0xf272('0x2c')]);_0x544a5e[_0xf272('0x2f')]=_[_0xf272('0x2e')](_0x5ef7d8[_0xf272('0x29')],qs[_0xf272('0x30')](_0x3fc3e9['query'][_0xf272('0x30')]));_0x544a5e[_0xf272('0x2f')]=_0x544a5e[_0xf272('0x2f')]['length']?_0x544a5e['attributes']:_0x5ef7d8['model'];_0x544a5e[_0xf272('0x48')]=qs[_0xf272('0x33')](_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x33')]);_0x544a5e[_0xf272('0x37')]=qs['filters'](_[_0xf272('0x34')](_0x3fc3e9[_0xf272('0x2c')],_0x5ef7d8['filters']));if(_0x3fc3e9[_0xf272('0x2c')]['filter']){_0x544a5e['where']=_[_0xf272('0x36')](_0x544a5e[_0xf272('0x37')],{'$or':_[_0xf272('0x2a')](_0x544a5e[_0xf272('0x2f')],function(_0x186cc0){var _0xb03080={};_0xb03080[_0x186cc0]={'$like':'%'+_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x35')]+'%'};return _0xb03080;})});}_0x544a5e=_['merge']({},_0x544a5e,_0x3fc3e9[_0xf272('0x49')]);return _0x21c4dd['getConfigurations'](_0x544a5e);}})[_0xf272('0x21')](function(_0x4221f2){if(_0x4221f2){_0xf78fcc=_0x4221f2['length'];if(!_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x4a')]('nolimit')){_0x544a5e[_0xf272('0x1c')]=qs['limit'](_0x3fc3e9[_0xf272('0x2c')][_0xf272('0x1c')]);_0x544a5e['offset']=qs[_0xf272('0x1a')](_0x3fc3e9['query'][_0xf272('0x1a')]);}return _0x21c4dd[_0xf272('0x45')](_0x544a5e);}})[_0xf272('0x21')](function(_0x27ab5c){if(_0x27ab5c){return _0x27ab5c?{'count':_0xf78fcc,'rows':_0x27ab5c}:null;}})[_0xf272('0x21')](respondWithResult(_0x1b42b6,null))[_0xf272('0x42')](handleError(_0x1b42b6,null));};exports[_0xf272('0x4b')]=function(_0x50c1d9,_0x1d4680,_0x19b282){if(_0x50c1d9[_0xf272('0x44')]['id']){delete _0x50c1d9[_0xf272('0x44')]['id'];}return db['DeskAccount'][_0xf272('0x46')]({'where':{'id':_0x50c1d9[_0xf272('0x3f')]['id']}})[_0xf272('0x21')](handleEntityNotFound(_0x1d4680,null))[_0xf272('0x21')](function(_0x2560ad){if(_0x2560ad){_0x50c1d9['body'][_0xf272('0x4c')]=_0x2560ad['id'];_0x50c1d9[_0xf272('0x44')]['Subjects']=integrations[_0xf272('0x4d')](_0x50c1d9[_0xf272('0x44')][_0xf272('0x4e')],_0x50c1d9[_0xf272('0x44')][_0xf272('0x28')]);_0x50c1d9[_0xf272('0x44')][_0xf272('0x4f')]=integrations[_0xf272('0x50')](_0x50c1d9[_0xf272('0x44')][_0xf272('0x4e')],_0x50c1d9[_0xf272('0x44')][_0xf272('0x28')]);return db[_0xf272('0x47')][_0xf272('0x43')](_0x50c1d9[_0xf272('0x44')],{'include':[{'model':db['DeskField'],'as':_0xf272('0x51')},{'model':db['DeskField'],'as':_0xf272('0x4f')}]});}return null;})[_0xf272('0x21')](respondWithResult(_0x1d4680,null))[_0xf272('0x42')](handleError(_0x1d4680,null));};exports[_0xf272('0x52')]=function(_0x23c38f,_0x4c503e,_0x4e189a){var _0x4e3446=[{'name':'priority','label':_0xf272('0x53'),'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 _0x70fcf4='';return db['DeskAccount'][_0xf272('0x46')]({'where':{'id':_0x23c38f[_0xf272('0x3f')]['id']},'attributes':['id',_0xf272('0x54'),_0xf272('0x55'),_0xf272('0x56'),_0xf272('0x57'),_0xf272('0x58'),_0xf272('0x59'),_0xf272('0x5a'),_0xf272('0x5b')]})[_0xf272('0x21')](handleEntityNotFound(_0x4c503e,null))['then'](function(_0x286d92){if(_0x286d92){_0x70fcf4=_0x286d92[_0xf272('0x54')];var _0x69aa4a=_0x70fcf4[_0xf272('0x5c')](-0x1);if(_0x69aa4a==='/'){_0x70fcf4=_0x70fcf4[_0xf272('0x5d')](0x0,_0x70fcf4[_0xf272('0x5e')](_0x69aa4a));}var _0x4eec6d={'method':_0xf272('0x5f'),'uri':util[_0xf272('0x60')](_0xf272('0x61'),_0x70fcf4),'headers':{'Content-Type':'application/json','Accept':'application/json'},'json':!![]};if(_0x286d92['authType']===_0xf272('0x62')){_0x4eec6d[_0xf272('0x63')][_0xf272('0x64')]=util[_0xf272('0x60')]('Basic\x20%s',new Buffer(util['format']('%s:%s',_0x286d92[_0xf272('0x56')],_0x286d92[_0xf272('0x57')]))[_0xf272('0x65')](_0xf272('0x66')));}return rp(_0x4eec6d)[_0xf272('0x21')](function(_0x15e8ab){return _0x4e3446['concat'](_[_0xf272('0x2a')](_0x15e8ab[_0xf272('0x67')][_0xf272('0x68')],function(_0x5b9c27){return{'id':_0x5b9c27[_0xf272('0x24')],'name':_0x5b9c27[_0xf272('0x24')],'type':_0x5b9c27[_0xf272('0x28')],'active':_0x5b9c27[_0xf272('0x69')],'label':_0x5b9c27['label'],'custom':!![]};}));});}})[_0xf272('0x21')](function(_0x31cdda){return{'count':_0x31cdda[_0xf272('0x31')],'rows':_0x31cdda};})[_0xf272('0x21')](respondWithResult(_0x4c503e,null))[_0xf272('0x42')](function(_0x12ce39){var _0x166b34=_0x23c38f[_0xf272('0x2c')][_0xf272('0x6a')]?0x1f4:_0x12ce39['statusCode']||0x1f4;logger[_0xf272('0x6b')](_0xf272('0x6c'),_0xf272('0x52'),_0x166b34,JSON[_0xf272('0x6d')](_0x12ce39));delete _0x12ce39['name'];if(_0x166b34===0x191){_0x166b34=0x190;}_0x4c503e[_0xf272('0x17')](_0x166b34)[_0xf272('0x25')](_0x23c38f[_0xf272('0x2c')][_0xf272('0x6a')]?{'message':_0xf272('0x6e'),'statusCode':_0x12ce39[_0xf272('0x6f')]}:_0x12ce39);});}; \ No newline at end of file +var _0x035d=['Authorization','Basic\x20%s','%s:%s','username','toString','base64','concat','_embedded','active','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','stack','name','send','index','DeskAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','getConfigurations','findOne','DeskConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','create','DeskField','Subjects','getFields','priority','authType','password','consumerKey','consumerSecret','token','tokenSecret','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers'];(function(_0x50697b,_0x56f879){var _0x47703e=function(_0x54689d){while(--_0x54689d){_0x50697b['push'](_0x50697b['shift']());}};_0x47703e(++_0x56f879);}(_0x035d,0x1eb));var _0xd035=function(_0x52b403,_0x2255a9){_0x52b403=_0x52b403-0x0;var _0x11320e=_0x035d[_0x52b403];return _0x11320e;};'use strict';var emlformat=require(_0xd035('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd035('0x1'));var rp=require(_0xd035('0x2'));var moment=require(_0xd035('0x3'));var BPromise=require(_0xd035('0x4'));var Mustache=require(_0xd035('0x5'));var util=require(_0xd035('0x6'));var path=require(_0xd035('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd035('0x8'));var fs=require('fs');var fs_extra=require(_0xd035('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd035('0xa'));var deskjs=require(_0xd035('0xb'));var toCsv=require(_0xd035('0xc'));var querystring=require(_0xd035('0xd'));var Papa=require(_0xd035('0xe'));var Redis=require(_0xd035('0xf'));var authService=require(_0xd035('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xd035('0x11'));var hardwareService=require(_0xd035('0x12'));var logger=require('../../config/logger')(_0xd035('0x13'));var utils=require('../../config/utils');var config=require(_0xd035('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xd035('0x15'))['db'];var integrations=require(_0xd035('0x16'));function respondWithStatusCode(_0x2944c0,_0x817272){_0x817272=_0x817272||0xcc;return function(_0x3d206d){if(_0x3d206d){return _0x2944c0[_0xd035('0x17')](_0x817272);}return _0x2944c0[_0xd035('0x18')](_0x817272)[_0xd035('0x19')]();};}function respondWithResult(_0x20253d,_0x49aa39){_0x49aa39=_0x49aa39||0xc8;return function(_0x51132d){if(_0x51132d){return _0x20253d[_0xd035('0x18')](_0x49aa39)['json'](_0x51132d);}};}function respondWithFilteredResult(_0x8cc050,_0xeed8ff){return function(_0xe85d9){if(_0xe85d9){var _0x51c357=typeof _0xeed8ff[_0xd035('0x1a')]===_0xd035('0x1b')&&typeof _0xeed8ff[_0xd035('0x1c')]===_0xd035('0x1b');var _0x44d62e=_0xe85d9[_0xd035('0x1d')];var _0x5e6165=_0x51c357?0x0:_0xeed8ff[_0xd035('0x1a')];var _0x10f78c=_0x51c357?_0xe85d9[_0xd035('0x1d')]:_0xeed8ff[_0xd035('0x1a')]+_0xeed8ff['limit'];var _0x12115f;if(_0x10f78c>=_0x44d62e){_0x10f78c=_0x44d62e;_0x12115f=0xc8;}else{_0x12115f=0xce;}_0x8cc050[_0xd035('0x18')](_0x12115f);return _0x8cc050[_0xd035('0x1e')](_0xd035('0x1f'),_0x5e6165+'-'+_0x10f78c+'/'+_0x44d62e)[_0xd035('0x20')](_0xe85d9);}return null;};}function patchUpdates(_0x2c0ca0){return function(_0x1f8b55){try{jsonpatch[_0xd035('0x21')](_0x1f8b55,_0x2c0ca0,!![]);}catch(_0x8666e6){return BPromise[_0xd035('0x22')](_0x8666e6);}return _0x1f8b55[_0xd035('0x23')]();};}function saveUpdates(_0x164347,_0x31ed3a){return function(_0x5dc8c9){if(_0x5dc8c9){return _0x5dc8c9[_0xd035('0x24')](_0x164347)['then'](function(_0x494bb5){return _0x494bb5;});}return null;};}function removeEntity(_0x2a543c,_0x4b365f){return function(_0x2f2049){if(_0x2f2049){return _0x2f2049[_0xd035('0x25')]()[_0xd035('0x26')](function(){_0x2a543c[_0xd035('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3aa577,_0x1bce60){return function(_0x3f53dd){if(!_0x3f53dd){_0x3aa577[_0xd035('0x17')](0x194);}return _0x3f53dd;};}function handleError(_0x3b3a22,_0x1730c7){_0x1730c7=_0x1730c7||0x1f4;return function(_0x3c13a1){logger['error'](_0x3c13a1[_0xd035('0x27')]);if(_0x3c13a1[_0xd035('0x28')]){delete _0x3c13a1[_0xd035('0x28')];}_0x3b3a22[_0xd035('0x18')](_0x1730c7)[_0xd035('0x29')](_0x3c13a1);};}exports[_0xd035('0x2a')]=function(_0x4d4a5f,_0x334eeb){var _0x24422b={},_0x29b0d4={},_0x5c06df={'count':0x0,'rows':[]};var _0x1e41e7=_['map'](db[_0xd035('0x2b')][_0xd035('0x2c')],function(_0x5b34d3){return{'name':_0x5b34d3[_0xd035('0x2d')],'type':_0x5b34d3[_0xd035('0x2e')]['key']};});_0x29b0d4[_0xd035('0x2f')]=_[_0xd035('0x30')](_0x1e41e7,_0xd035('0x28'));_0x29b0d4[_0xd035('0x31')]=_[_0xd035('0x32')](_0x4d4a5f[_0xd035('0x31')]);_0x29b0d4[_0xd035('0x33')]=_['intersection'](_0x29b0d4[_0xd035('0x2f')],_0x29b0d4[_0xd035('0x31')]);_0x24422b[_0xd035('0x34')]=_[_0xd035('0x35')](_0x29b0d4['model'],qs[_0xd035('0x36')](_0x4d4a5f[_0xd035('0x31')][_0xd035('0x36')]));_0x24422b[_0xd035('0x34')]=_0x24422b[_0xd035('0x34')][_0xd035('0x37')]?_0x24422b[_0xd035('0x34')]:_0x29b0d4[_0xd035('0x2f')];if(!_0x4d4a5f[_0xd035('0x31')][_0xd035('0x38')](_0xd035('0x39'))){_0x24422b[_0xd035('0x1c')]=qs[_0xd035('0x1c')](_0x4d4a5f[_0xd035('0x31')]['limit']);_0x24422b[_0xd035('0x1a')]=qs['offset'](_0x4d4a5f[_0xd035('0x31')][_0xd035('0x1a')]);}_0x24422b[_0xd035('0x3a')]=qs[_0xd035('0x3b')](_0x4d4a5f['query'][_0xd035('0x3b')]);_0x24422b[_0xd035('0x3c')]=qs[_0xd035('0x33')](_[_0xd035('0x3d')](_0x4d4a5f['query'],_0x29b0d4[_0xd035('0x33')]),_0x1e41e7);if(_0x4d4a5f[_0xd035('0x31')][_0xd035('0x3e')]){_0x24422b[_0xd035('0x3c')]=_[_0xd035('0x3f')](_0x24422b[_0xd035('0x3c')],{'$or':_['map'](_0x1e41e7,function(_0x2d81f1){if(_0x2d81f1[_0xd035('0x2e')]!==_0xd035('0x40')){var _0x945e2f={};_0x945e2f[_0x2d81f1[_0xd035('0x28')]]={'$like':'%'+_0x4d4a5f[_0xd035('0x31')][_0xd035('0x3e')]+'%'};return _0x945e2f;}})});}_0x24422b=_[_0xd035('0x3f')]({},_0x24422b,_0x4d4a5f[_0xd035('0x41')]);var _0x2049ee={'where':_0x24422b[_0xd035('0x3c')]};return db['DeskAccount'][_0xd035('0x1d')](_0x2049ee)[_0xd035('0x26')](function(_0x2b5764){_0x5c06df[_0xd035('0x1d')]=_0x2b5764;if(_0x4d4a5f['query'][_0xd035('0x42')]){_0x24422b[_0xd035('0x43')]=[{'all':!![]}];}return db[_0xd035('0x2b')][_0xd035('0x44')](_0x24422b);})[_0xd035('0x26')](function(_0x1c560a){_0x5c06df[_0xd035('0x45')]=_0x1c560a;return _0x5c06df;})[_0xd035('0x26')](respondWithFilteredResult(_0x334eeb,_0x24422b))[_0xd035('0x46')](handleError(_0x334eeb,null));};exports['show']=function(_0x387772,_0x3ed6e1){var _0x27fcc5={'raw':![],'where':{'id':_0x387772[_0xd035('0x47')]['id']}},_0x1b0ad7={};_0x1b0ad7[_0xd035('0x2f')]=_[_0xd035('0x32')](db[_0xd035('0x2b')][_0xd035('0x2c')]);_0x1b0ad7[_0xd035('0x31')]=_[_0xd035('0x32')](_0x387772[_0xd035('0x31')]);_0x1b0ad7[_0xd035('0x33')]=_['intersection'](_0x1b0ad7[_0xd035('0x2f')],_0x1b0ad7[_0xd035('0x31')]);_0x27fcc5[_0xd035('0x34')]=_[_0xd035('0x35')](_0x1b0ad7[_0xd035('0x2f')],qs['fields'](_0x387772[_0xd035('0x31')][_0xd035('0x36')]));_0x27fcc5[_0xd035('0x34')]=_0x27fcc5[_0xd035('0x34')][_0xd035('0x37')]?_0x27fcc5[_0xd035('0x34')]:_0x1b0ad7[_0xd035('0x2f')];if(_0x387772['query'][_0xd035('0x42')]){_0x27fcc5[_0xd035('0x43')]=[{'all':!![]}];}_0x27fcc5=_[_0xd035('0x3f')]({},_0x27fcc5,_0x387772[_0xd035('0x41')]);return db[_0xd035('0x2b')][_0xd035('0x48')](_0x27fcc5)['then'](handleEntityNotFound(_0x3ed6e1,null))[_0xd035('0x26')](respondWithResult(_0x3ed6e1,null))[_0xd035('0x46')](handleError(_0x3ed6e1,null));};exports['create']=function(_0x373532,_0x459c1f){return db['DeskAccount']['create'](_0x373532[_0xd035('0x49')],{})['then'](respondWithResult(_0x459c1f,0xc9))['catch'](handleError(_0x459c1f,null));};exports[_0xd035('0x24')]=function(_0x2a8fb6,_0x3ee74a){if(_0x2a8fb6[_0xd035('0x49')]['id']){delete _0x2a8fb6[_0xd035('0x49')]['id'];}return db[_0xd035('0x2b')][_0xd035('0x48')]({'where':{'id':_0x2a8fb6['params']['id']}})[_0xd035('0x26')](handleEntityNotFound(_0x3ee74a,null))[_0xd035('0x26')](saveUpdates(_0x2a8fb6[_0xd035('0x49')],null))['then'](respondWithResult(_0x3ee74a,null))['catch'](handleError(_0x3ee74a,null));};exports['destroy']=function(_0x186cdc,_0xc3686b){return db[_0xd035('0x2b')][_0xd035('0x48')]({'where':{'id':_0x186cdc[_0xd035('0x47')]['id']}})[_0xd035('0x26')](handleEntityNotFound(_0xc3686b,null))[_0xd035('0x26')](removeEntity(_0xc3686b,null))[_0xd035('0x46')](handleError(_0xc3686b,null));};exports[_0xd035('0x4a')]=function(_0x55007e,_0x5d03cd,_0x40a975){var _0x33b1f0={};var _0x25f075={};var _0x3baabf;var _0x1f1178;return db[_0xd035('0x2b')][_0xd035('0x4b')]({'where':{'id':_0x55007e[_0xd035('0x47')]['id']}})[_0xd035('0x26')](handleEntityNotFound(_0x5d03cd,null))[_0xd035('0x26')](function(_0x2d397a){if(_0x2d397a){_0x3baabf=_0x2d397a;_0x25f075['model']=_[_0xd035('0x32')](db[_0xd035('0x4c')][_0xd035('0x2c')]);_0x25f075[_0xd035('0x31')]=_[_0xd035('0x32')](_0x55007e[_0xd035('0x31')]);_0x25f075[_0xd035('0x33')]=_[_0xd035('0x35')](_0x25f075[_0xd035('0x2f')],_0x25f075[_0xd035('0x31')]);_0x33b1f0[_0xd035('0x34')]=_[_0xd035('0x35')](_0x25f075[_0xd035('0x2f')],qs[_0xd035('0x36')](_0x55007e[_0xd035('0x31')][_0xd035('0x36')]));_0x33b1f0[_0xd035('0x34')]=_0x33b1f0[_0xd035('0x34')][_0xd035('0x37')]?_0x33b1f0[_0xd035('0x34')]:_0x25f075[_0xd035('0x2f')];_0x33b1f0['order']=qs[_0xd035('0x3b')](_0x55007e[_0xd035('0x31')]['sort']);_0x33b1f0[_0xd035('0x3c')]=qs[_0xd035('0x33')](_[_0xd035('0x3d')](_0x55007e[_0xd035('0x31')],_0x25f075[_0xd035('0x33')]));if(_0x55007e[_0xd035('0x31')]['filter']){_0x33b1f0[_0xd035('0x3c')]=_[_0xd035('0x3f')](_0x33b1f0[_0xd035('0x3c')],{'$or':_[_0xd035('0x30')](_0x33b1f0[_0xd035('0x34')],function(_0x27f8cf){var _0x1a42c8={};_0x1a42c8[_0x27f8cf]={'$like':'%'+_0x55007e[_0xd035('0x31')][_0xd035('0x3e')]+'%'};return _0x1a42c8;})});}_0x33b1f0=_['merge']({},_0x33b1f0,_0x55007e[_0xd035('0x41')]);return _0x3baabf[_0xd035('0x4a')](_0x33b1f0);}})[_0xd035('0x26')](function(_0x260827){if(_0x260827){_0x1f1178=_0x260827[_0xd035('0x37')];if(!_0x55007e['query']['hasOwnProperty']('nolimit')){_0x33b1f0[_0xd035('0x1c')]=qs[_0xd035('0x1c')](_0x55007e[_0xd035('0x31')][_0xd035('0x1c')]);_0x33b1f0[_0xd035('0x1a')]=qs[_0xd035('0x1a')](_0x55007e['query'][_0xd035('0x1a')]);}return _0x3baabf[_0xd035('0x4a')](_0x33b1f0);}})[_0xd035('0x26')](function(_0x2c6e0c){if(_0x2c6e0c){return _0x2c6e0c?{'count':_0x1f1178,'rows':_0x2c6e0c}:null;}})['then'](respondWithResult(_0x5d03cd,null))[_0xd035('0x46')](handleError(_0x5d03cd,null));};exports[_0xd035('0x4d')]=function(_0x6bd4c,_0x1636ba,_0x4c2e94){if(_0x6bd4c[_0xd035('0x49')]['id']){delete _0x6bd4c[_0xd035('0x49')]['id'];}return db[_0xd035('0x2b')][_0xd035('0x4b')]({'where':{'id':_0x6bd4c[_0xd035('0x47')]['id']}})[_0xd035('0x26')](handleEntityNotFound(_0x1636ba,null))[_0xd035('0x26')](function(_0x163c54){if(_0x163c54){_0x6bd4c['body'][_0xd035('0x4e')]=_0x163c54['id'];_0x6bd4c['body']['Subjects']=integrations[_0xd035('0x4f')](_0x6bd4c[_0xd035('0x49')][_0xd035('0x50')],_0x6bd4c[_0xd035('0x49')][_0xd035('0x2e')]);_0x6bd4c[_0xd035('0x49')][_0xd035('0x51')]=integrations[_0xd035('0x52')](_0x6bd4c['body'][_0xd035('0x50')],_0x6bd4c[_0xd035('0x49')][_0xd035('0x2e')]);return db[_0xd035('0x4c')][_0xd035('0x53')](_0x6bd4c[_0xd035('0x49')],{'include':[{'model':db[_0xd035('0x54')],'as':_0xd035('0x55')},{'model':db[_0xd035('0x54')],'as':_0xd035('0x51')}]});}return null;})[_0xd035('0x26')](respondWithResult(_0x1636ba,null))['catch'](handleError(_0x1636ba,null));};exports[_0xd035('0x56')]=function(_0x22fd84,_0x2b0160,_0x4e726f){var _0x16363c=[{'name':_0xd035('0x57'),'label':_0xd035('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x5e8346='';return db['DeskAccount']['findOne']({'where':{'id':_0x22fd84[_0xd035('0x47')]['id']},'attributes':['id','remoteUri',_0xd035('0x58'),'username',_0xd035('0x59'),_0xd035('0x5a'),_0xd035('0x5b'),_0xd035('0x5c'),_0xd035('0x5d')]})['then'](handleEntityNotFound(_0x2b0160,null))[_0xd035('0x26')](function(_0xe0aa5b){if(_0xe0aa5b){_0x5e8346=_0xe0aa5b[_0xd035('0x5e')];var _0x8eb4d=_0x5e8346[_0xd035('0x5f')](-0x1);if(_0x8eb4d==='/'){_0x5e8346=_0x5e8346[_0xd035('0x60')](0x0,_0x5e8346[_0xd035('0x61')](_0x8eb4d));}var _0x1f7969={'method':_0xd035('0x62'),'uri':util[_0xd035('0x63')](_0xd035('0x64'),_0x5e8346),'headers':{'Content-Type':_0xd035('0x65'),'Accept':_0xd035('0x65')},'json':!![]};if(_0xe0aa5b['authType']===_0xd035('0x66')){_0x1f7969[_0xd035('0x67')][_0xd035('0x68')]=util[_0xd035('0x63')](_0xd035('0x69'),new Buffer(util[_0xd035('0x63')](_0xd035('0x6a'),_0xe0aa5b[_0xd035('0x6b')],_0xe0aa5b[_0xd035('0x59')]))[_0xd035('0x6c')](_0xd035('0x6d')));}return rp(_0x1f7969)['then'](function(_0x3ff065){return _0x16363c[_0xd035('0x6e')](_[_0xd035('0x30')](_0x3ff065[_0xd035('0x6f')]['entries'],function(_0x4acd8f){return{'id':_0x4acd8f[_0xd035('0x28')],'name':_0x4acd8f[_0xd035('0x28')],'type':_0x4acd8f['type'],'active':_0x4acd8f[_0xd035('0x70')],'label':_0x4acd8f[_0xd035('0x71')],'custom':!![]};}));});}})['then'](function(_0x1e7ee5){return{'count':_0x1e7ee5[_0xd035('0x37')],'rows':_0x1e7ee5};})[_0xd035('0x26')](respondWithResult(_0x2b0160,null))['catch'](function(_0x2ee334){var _0x17763c=_0x22fd84['query'][_0xd035('0x72')]?0x1f4:_0x2ee334[_0xd035('0x73')]||0x1f4;logger['error'](_0xd035('0x74'),_0xd035('0x56'),_0x17763c,JSON[_0xd035('0x75')](_0x2ee334));delete _0x2ee334[_0xd035('0x28')];if(_0x17763c===0x191){_0x17763c=0x190;}_0x2b0160[_0xd035('0x18')](_0x17763c)[_0xd035('0x29')](_0x22fd84[_0xd035('0x31')][_0xd035('0x72')]?{'message':_0xd035('0x76'),'statusCode':_0x2ee334['statusCode']}:_0x2ee334);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index f21128f..64c310f 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 _0x4083=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','int_desk_accounts'];(function(_0xc263fd,_0x3e0ad1){var _0x2d09f7=function(_0x333bc4){while(--_0x333bc4){_0xc263fd['push'](_0xc263fd['shift']());}};_0x2d09f7(++_0x3e0ad1);}(_0x4083,0x1ad));var _0x3408=function(_0x4aca2e,_0x416ca1){_0x4aca2e=_0x4aca2e-0x0;var _0x199541=_0x4083[_0x4aca2e];return _0x199541;};'use strict';var _=require(_0x3408('0x0'));var util=require(_0x3408('0x1'));var logger=require('../../config/logger')(_0x3408('0x2'));var moment=require(_0x3408('0x3'));var BPromise=require(_0x3408('0x4'));var rp=require(_0x3408('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3408('0x6'));var config=require(_0x3408('0x7'));var attributes=require(_0x3408('0x8'));var integrations=require(_0x3408('0x9'));module['exports']=function(_0x629b24,_0x5e0556){return _0x629b24[_0x3408('0xa')](_0x3408('0xb'),attributes,{'tableName':_0x3408('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc9c=['../../config/logger','api','moment','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','define','DeskAccount','lodash','util'];(function(_0x2d513f,_0x126f93){var _0x2488c3=function(_0x59599c){while(--_0x59599c){_0x2d513f['push'](_0x2d513f['shift']());}};_0x2488c3(++_0x126f93);}(_0xcc9c,0x148));var _0xccc9=function(_0x3fdef9,_0x260599){_0x3fdef9=_0x3fdef9-0x0;var _0x4b3bfb=_0xcc9c[_0x3fdef9];return _0x4b3bfb;};'use strict';var _=require(_0xccc9('0x0'));var util=require(_0xccc9('0x1'));var logger=require(_0xccc9('0x2'))(_0xccc9('0x3'));var moment=require(_0xccc9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xccc9('0x5'));var config=require(_0xccc9('0x6'));var attributes=require(_0xccc9('0x7'));var integrations=require(_0xccc9('0x8'));module['exports']=function(_0x1f3b3c,_0x41370f){return _0x1f3b3c[_0xccc9('0x9')](_0xccc9('0xa'),attributes,{'tableName':'int_desk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index ac2e073..1bafcb0 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 _0x6930=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','DeskAccount,\x20%s,\x20%s','message','result','DeskAccount','findAll','options','raw','where','attributes','limit','include','model','GetDeskAccount','catch','ShowDeskAccount','find','map','stringify','lodash'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x6930,0x65));var _0x0693=function(_0x36748e,_0x5259a5){_0x36748e=_0x36748e-0x0;var _0x1b027e=_0x6930[_0x36748e];return _0x1b027e;};'use strict';var _=require(_0x0693('0x0'));var util=require(_0x0693('0x1'));var moment=require(_0x0693('0x2'));var BPromise=require(_0x0693('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0693('0x4'))['db'];var utils=require(_0x0693('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x0693('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0693('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x97d78,_0x16509c,_0x85da2b){return new BPromise(function(_0x5bc464,_0x251a71){return client[_0x0693('0x8')](_0x97d78,_0x85da2b)[_0x0693('0x9')](function(_0x17e66d){logger[_0x0693('0xa')]('DeskAccount,\x20%s,\x20%s',_0x16509c,'request\x20sent');logger[_0x0693('0xb')](_0x0693('0xc'),_0x16509c,_0x0693('0xd'),JSON['stringify'](_0x17e66d));if(_0x17e66d[_0x0693('0xe')]){if(_0x17e66d['error'][_0x0693('0xf')]===0x1f4){logger['error'](_0x0693('0x10'),_0x16509c,_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);return _0x251a71(_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);}logger[_0x0693('0xe')](_0x0693('0x10'),_0x16509c,_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);return _0x5bc464(_0x17e66d[_0x0693('0xe')][_0x0693('0x11')]);}else{logger[_0x0693('0xa')](_0x0693('0x10'),_0x16509c,_0x0693('0xd'));_0x5bc464(_0x17e66d[_0x0693('0x12')]['message']);}})['catch'](function(_0x22ab23){logger['error'](_0x0693('0x10'),_0x16509c,_0x22ab23);_0x251a71(_0x22ab23);});});}exports['GetDeskAccount']=function(_0x21a1d9){var _0xd6802c=this;return new Promise(function(_0x2f90be,_0xf86695){return db[_0x0693('0x13')][_0x0693('0x14')]({'raw':_0x21a1d9['options']?_0x21a1d9[_0x0693('0x15')][_0x0693('0x16')]===undefined?!![]:![]:!![],'where':_0x21a1d9[_0x0693('0x15')]?_0x21a1d9['options'][_0x0693('0x17')]||null:null,'attributes':_0x21a1d9['options']?_0x21a1d9['options'][_0x0693('0x18')]||null:null,'limit':_0x21a1d9[_0x0693('0x15')]?_0x21a1d9[_0x0693('0x15')][_0x0693('0x19')]||null:null,'include':_0x21a1d9[_0x0693('0x15')]?_0x21a1d9[_0x0693('0x15')][_0x0693('0x1a')]?_['map'](_0x21a1d9['options'][_0x0693('0x1a')],function(_0x272a23){return{'model':db[_0x272a23[_0x0693('0x1b')]],'as':_0x272a23['as'],'attributes':_0x272a23['attributes'],'include':_0x272a23[_0x0693('0x1a')]?_['map'](_0x272a23['include'],function(_0xc979e7){return{'model':db[_0xc979e7[_0x0693('0x1b')]],'as':_0xc979e7['as'],'attributes':_0xc979e7[_0x0693('0x18')],'include':_0xc979e7[_0x0693('0x1a')]?_['map'](_0xc979e7[_0x0693('0x1a')],function(_0x20312c){return{'model':db[_0x20312c[_0x0693('0x1b')]],'as':_0x20312c['as'],'attributes':_0x20312c[_0x0693('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0693('0x9')](function(_0x5480a4){logger[_0x0693('0xa')](_0x0693('0x1c'),_0x21a1d9);logger[_0x0693('0xb')](_0x0693('0x1c'),_0x21a1d9,JSON['stringify'](_0x5480a4));_0x2f90be(_0x5480a4);})[_0x0693('0x1d')](function(_0x456f03){logger['error'](_0x0693('0x1c'),_0x456f03[_0x0693('0x11')],_0x21a1d9);_0xf86695(_0xd6802c['error'](0x1f4,_0x456f03[_0x0693('0x11')]));});});};exports[_0x0693('0x1e')]=function(_0x5a75a5){var _0x4d50df=this;return new Promise(function(_0x2e099f,_0x65b5c5){return db['DeskAccount'][_0x0693('0x1f')]({'raw':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')][_0x0693('0x17')]||null:null,'attributes':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')][_0x0693('0x18')]||null:null,'include':_0x5a75a5[_0x0693('0x15')]?_0x5a75a5[_0x0693('0x15')][_0x0693('0x1a')]?_[_0x0693('0x20')](_0x5a75a5[_0x0693('0x15')][_0x0693('0x1a')],function(_0x87f4b6){return{'model':db[_0x87f4b6['model']],'as':_0x87f4b6['as'],'attributes':_0x87f4b6[_0x0693('0x18')],'include':_0x87f4b6[_0x0693('0x1a')]?_[_0x0693('0x20')](_0x87f4b6['include'],function(_0x285737){return{'model':db[_0x285737['model']],'as':_0x285737['as'],'attributes':_0x285737[_0x0693('0x18')],'include':_0x285737[_0x0693('0x1a')]?_[_0x0693('0x20')](_0x285737[_0x0693('0x1a')],function(_0x2e1a64){return{'model':db[_0x2e1a64['model']],'as':_0x2e1a64['as'],'attributes':_0x2e1a64[_0x0693('0x18')]};}):[]};}):[]};}):[]:[]})[_0x0693('0x9')](function(_0x578667){logger[_0x0693('0xa')](_0x0693('0x1e'),_0x5a75a5);logger[_0x0693('0xb')](_0x0693('0x1e'),_0x5a75a5,JSON[_0x0693('0x21')](_0x578667));_0x2e099f(_0x578667);})['catch'](function(_0x5d3235){logger['error']('ShowDeskAccount',_0x5d3235['message'],_0x5a75a5);_0x65b5c5(_0x4d50df[_0x0693('0xe')](0x1f4,_0x5d3235['message']));});});}; \ No newline at end of file +var _0x52c1=['request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetDeskAccount','DeskAccount','options','raw','attributes','limit','include','model','map','ShowDeskAccount','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','DeskAccount,\x20%s,\x20%s'];(function(_0x27139b,_0x947d93){var _0x369dc3=function(_0x4bcf8a){while(--_0x4bcf8a){_0x27139b['push'](_0x27139b['shift']());}};_0x369dc3(++_0x947d93);}(_0x52c1,0x15e));var _0x152c=function(_0x4cf628,_0x1486bf){_0x4cf628=_0x4cf628-0x0;var _0x29f696=_0x52c1[_0x4cf628];return _0x29f696;};'use strict';var _=require('lodash');var util=require(_0x152c('0x0'));var moment=require(_0x152c('0x1'));var BPromise=require('bluebird');var rs=require(_0x152c('0x2'));var fs=require('fs');var Redis=require(_0x152c('0x3'));var db=require(_0x152c('0x4'))['db'];var utils=require(_0x152c('0x5'));var logger=require(_0x152c('0x6'))(_0x152c('0x7'));var config=require(_0x152c('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5629d6,_0x4ff100,_0x5b3b27){return new BPromise(function(_0x6061fa,_0xcfe5aa){return client[_0x152c('0x9')](_0x5629d6,_0x5b3b27)[_0x152c('0xa')](function(_0x117ea2){logger[_0x152c('0xb')](_0x152c('0xc'),_0x4ff100,_0x152c('0xd'));logger[_0x152c('0xe')](_0x152c('0xf'),_0x4ff100,_0x152c('0xd'),JSON[_0x152c('0x10')](_0x117ea2));if(_0x117ea2[_0x152c('0x11')]){if(_0x117ea2[_0x152c('0x11')][_0x152c('0x12')]===0x1f4){logger[_0x152c('0x11')](_0x152c('0xc'),_0x4ff100,_0x117ea2[_0x152c('0x11')][_0x152c('0x13')]);return _0xcfe5aa(_0x117ea2[_0x152c('0x11')]['message']);}logger[_0x152c('0x11')](_0x152c('0xc'),_0x4ff100,_0x117ea2[_0x152c('0x11')][_0x152c('0x13')]);return _0x6061fa(_0x117ea2[_0x152c('0x11')][_0x152c('0x13')]);}else{logger[_0x152c('0xb')](_0x152c('0xc'),_0x4ff100,_0x152c('0xd'));_0x6061fa(_0x117ea2['result'][_0x152c('0x13')]);}})[_0x152c('0x14')](function(_0x1df540){logger[_0x152c('0x11')](_0x152c('0xc'),_0x4ff100,_0x1df540);_0xcfe5aa(_0x1df540);});});}exports[_0x152c('0x15')]=function(_0x4ac03b){var _0x2ae8ee=this;return new Promise(function(_0x4b05ad,_0x69d369){return db[_0x152c('0x16')]['findAll']({'raw':_0x4ac03b[_0x152c('0x17')]?_0x4ac03b['options'][_0x152c('0x18')]===undefined?!![]:![]:!![],'where':_0x4ac03b[_0x152c('0x17')]?_0x4ac03b['options']['where']||null:null,'attributes':_0x4ac03b['options']?_0x4ac03b[_0x152c('0x17')][_0x152c('0x19')]||null:null,'limit':_0x4ac03b[_0x152c('0x17')]?_0x4ac03b['options'][_0x152c('0x1a')]||null:null,'include':_0x4ac03b['options']?_0x4ac03b[_0x152c('0x17')][_0x152c('0x1b')]?_['map'](_0x4ac03b['options']['include'],function(_0x5e1a2a){return{'model':db[_0x5e1a2a[_0x152c('0x1c')]],'as':_0x5e1a2a['as'],'attributes':_0x5e1a2a[_0x152c('0x19')],'include':_0x5e1a2a[_0x152c('0x1b')]?_['map'](_0x5e1a2a[_0x152c('0x1b')],function(_0x48ef83){return{'model':db[_0x48ef83['model']],'as':_0x48ef83['as'],'attributes':_0x48ef83[_0x152c('0x19')],'include':_0x48ef83[_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x48ef83['include'],function(_0x426c27){return{'model':db[_0x426c27['model']],'as':_0x426c27['as'],'attributes':_0x426c27['attributes']};}):[]};}):[]};}):[]:[]})[_0x152c('0xa')](function(_0xade855){logger['info']('GetDeskAccount',_0x4ac03b);logger['debug']('GetDeskAccount',_0x4ac03b,JSON['stringify'](_0xade855));_0x4b05ad(_0xade855);})[_0x152c('0x14')](function(_0x3c6653){logger['error']('GetDeskAccount',_0x3c6653['message'],_0x4ac03b);_0x69d369(_0x2ae8ee[_0x152c('0x11')](0x1f4,_0x3c6653[_0x152c('0x13')]));});});};exports[_0x152c('0x1e')]=function(_0x377908){var _0x17e87d=this;return new Promise(function(_0x15fc8d,_0x57d999){return db[_0x152c('0x16')][_0x152c('0x1f')]({'raw':_0x377908[_0x152c('0x17')]?_0x377908['options']['raw']===undefined?!![]:![]:!![],'where':_0x377908[_0x152c('0x17')]?_0x377908['options'][_0x152c('0x20')]||null:null,'attributes':_0x377908[_0x152c('0x17')]?_0x377908[_0x152c('0x17')]['attributes']||null:null,'include':_0x377908[_0x152c('0x17')]?_0x377908[_0x152c('0x17')][_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x377908['options'][_0x152c('0x1b')],function(_0x2fe6ab){return{'model':db[_0x2fe6ab['model']],'as':_0x2fe6ab['as'],'attributes':_0x2fe6ab[_0x152c('0x19')],'include':_0x2fe6ab[_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x2fe6ab[_0x152c('0x1b')],function(_0x2b2c46){return{'model':db[_0x2b2c46[_0x152c('0x1c')]],'as':_0x2b2c46['as'],'attributes':_0x2b2c46[_0x152c('0x19')],'include':_0x2b2c46[_0x152c('0x1b')]?_[_0x152c('0x1d')](_0x2b2c46['include'],function(_0x4cb110){return{'model':db[_0x4cb110[_0x152c('0x1c')]],'as':_0x4cb110['as'],'attributes':_0x4cb110['attributes']};}):[]};}):[]};}):[]:[]})[_0x152c('0xa')](function(_0x17cec6){logger[_0x152c('0xb')]('ShowDeskAccount',_0x377908);logger['debug'](_0x152c('0x1e'),_0x377908,JSON[_0x152c('0x10')](_0x17cec6));_0x15fc8d(_0x17cec6);})['catch'](function(_0x2151f7){logger[_0x152c('0x11')](_0x152c('0x1e'),_0x2151f7['message'],_0x377908);_0x57d999(_0x17e87d['error'](0x1f4,_0x2151f7['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1fa0458..c687c4c 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 _0x3e74=['show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','setTags','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0xd9e171,_0x1bae23){var _0x304c10=function(_0x3f300f){while(--_0x3f300f){_0xd9e171['push'](_0xd9e171['shift']());}};_0x304c10(++_0x1bae23);}(_0x3e74,0x175));var _0x43e7=function(_0x25d163,_0x32cb7f){_0x25d163=_0x25d163-0x0;var _0x251c8d=_0x3e74[_0x25d163];return _0x251c8d;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/subjects',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/tags',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0x13'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router['put']('/:id',auth[_0x43e7('0x8')](),controller[_0x43e7('0x15')]);router[_0x43e7('0x16')](_0x43e7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x43e7('0x17')]=router; \ No newline at end of file +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(_0x48024c,_0x2562ba){var _0x303841=function(_0x52f8f9){while(--_0x52f8f9){_0x48024c['push'](_0x48024c['shift']());}};_0x303841(++_0x2562ba);}(_0x008c,0x188));var _0xc008=function(_0x1c6d44,_0x1b7780){_0x1c6d44=_0x1c6d44-0x0;var _0x49d1a7=_0x008c[_0x1c6d44];return _0x49d1a7;};'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 e3ae2dd..25111da 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 _0xaa42=['STRING','exports'];(function(_0x14ee65,_0x31e180){var _0x28e513=function(_0x51cbd5){while(--_0x51cbd5){_0x14ee65['push'](_0x14ee65['shift']());}};_0x28e513(++_0x31e180);}(_0xaa42,0x105));var _0x2aa4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xaa42[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0x2aa4('0x0')]={'name':{'type':Sequelize[_0x2aa4('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xce1c=['STRING','sequelize'];(function(_0x11585b,_0x21c906){var _0x2f9a80=function(_0xd2f4e1){while(--_0xd2f4e1){_0x11585b['push'](_0x11585b['shift']());}};_0x2f9a80(++_0x21c906);}(_0xce1c,0x111));var _0xcce1=function(_0x145db1,_0x1724d5){_0x145db1=_0x145db1-0x0;var _0x5eff0a=_0xce1c[_0x145db1];return _0x5eff0a;};'use strict';var Sequelize=require(_0xcce1('0x0'));module['exports']={'name':{'type':Sequelize[_0xcce1('0x1')]},'description':{'type':Sequelize[_0xcce1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 168b2e1..9ebd6da 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 _0xa05b=['index','map','DeskConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','error','stack','name'];(function(_0x25b92e,_0x59e7d2){var _0x493b10=function(_0xca2749){while(--_0xca2749){_0x25b92e['push'](_0x25b92e['shift']());}};_0x493b10(++_0x59e7d2);}(_0xa05b,0x120));var _0xba05=function(_0x1aa3fe,_0x27c5fa){_0x1aa3fe=_0x1aa3fe-0x0;var _0x163cee=_0xa05b[_0x1aa3fe];return _0x163cee;};'use strict';var emlformat=require(_0xba05('0x0'));var rimraf=require(_0xba05('0x1'));var zipdir=require(_0xba05('0x2'));var jsonpatch=require(_0xba05('0x3'));var rp=require(_0xba05('0x4'));var moment=require('moment');var BPromise=require(_0xba05('0x5'));var Mustache=require(_0xba05('0x6'));var util=require(_0xba05('0x7'));var path=require(_0xba05('0x8'));var sox=require(_0xba05('0x9'));var csv=require(_0xba05('0xa'));var ejs=require(_0xba05('0xb'));var fs=require('fs');var fs_extra=require(_0xba05('0xc'));var _=require(_0xba05('0xd'));var squel=require(_0xba05('0xe'));var crypto=require(_0xba05('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xba05('0x10'));var toCsv=require(_0xba05('0xa'));var querystring=require(_0xba05('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba05('0x12'));var as=require(_0xba05('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba05('0x14'))(_0xba05('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2adb34,_0x566d36){_0x566d36=_0x566d36||0xcc;return function(_0x4ba793){if(_0x4ba793){return _0x2adb34[_0xba05('0x16')](_0x566d36);}return _0x2adb34[_0xba05('0x17')](_0x566d36)[_0xba05('0x18')]();};}function respondWithResult(_0x4e8ea8,_0x327ebd){_0x327ebd=_0x327ebd||0xc8;return function(_0x485d7f){if(_0x485d7f){return _0x4e8ea8[_0xba05('0x17')](_0x327ebd)['json'](_0x485d7f);}};}function respondWithFilteredResult(_0x1c3e60,_0x85344){return function(_0x9ad30b){if(_0x9ad30b){var _0x4a160e=typeof _0x85344[_0xba05('0x19')]===_0xba05('0x1a')&&typeof _0x85344[_0xba05('0x1b')]===_0xba05('0x1a');var _0x5e4ecf=_0x9ad30b[_0xba05('0x1c')];var _0x282c8b=_0x4a160e?0x0:_0x85344['offset'];var _0x33191=_0x4a160e?_0x9ad30b[_0xba05('0x1c')]:_0x85344[_0xba05('0x19')]+_0x85344[_0xba05('0x1b')];var _0x54eeb4;if(_0x33191>=_0x5e4ecf){_0x33191=_0x5e4ecf;_0x54eeb4=0xc8;}else{_0x54eeb4=0xce;}_0x1c3e60['status'](_0x54eeb4);return _0x1c3e60[_0xba05('0x1d')](_0xba05('0x1e'),_0x282c8b+'-'+_0x33191+'/'+_0x5e4ecf)[_0xba05('0x1f')](_0x9ad30b);}return null;};}function patchUpdates(_0x330a23){return function(_0x3f0973){try{jsonpatch[_0xba05('0x20')](_0x3f0973,_0x330a23,!![]);}catch(_0x59ed3f){return BPromise[_0xba05('0x21')](_0x59ed3f);}return _0x3f0973['save']();};}function saveUpdates(_0x2d8fe7,_0xa8948c){return function(_0x637c60){if(_0x637c60){return _0x637c60[_0xba05('0x22')](_0x2d8fe7)['then'](function(_0x3dc237){return _0x3dc237;});}return null;};}function removeEntity(_0xa5d848,_0x2ed71a){return function(_0x1ec29a){if(_0x1ec29a){return _0x1ec29a[_0xba05('0x23')]()[_0xba05('0x24')](function(){_0xa5d848['status'](0xcc)[_0xba05('0x18')]();});}};}function handleEntityNotFound(_0x52bd7b,_0x4772d6){return function(_0x11bc1b){if(!_0x11bc1b){_0x52bd7b[_0xba05('0x16')](0x194);}return _0x11bc1b;};}function handleError(_0x16ae14,_0x1f8056){_0x1f8056=_0x1f8056||0x1f4;return function(_0x8b4ad4){logger[_0xba05('0x25')](_0x8b4ad4[_0xba05('0x26')]);if(_0x8b4ad4['name']){delete _0x8b4ad4[_0xba05('0x27')];}_0x16ae14[_0xba05('0x17')](_0x1f8056)['send'](_0x8b4ad4);};}exports[_0xba05('0x28')]=function(_0x478e17,_0x4a93cd){var _0x3ccc02={},_0x2c3cc2={},_0x3a7c42={'count':0x0,'rows':[]};var _0x578b11=_[_0xba05('0x29')](db[_0xba05('0x2a')][_0xba05('0x2b')],function(_0x56ab95){return{'name':_0x56ab95[_0xba05('0x2c')],'type':_0x56ab95['type'][_0xba05('0x2d')]};});_0x2c3cc2[_0xba05('0x2e')]=_['map'](_0x578b11,_0xba05('0x27'));_0x2c3cc2[_0xba05('0x2f')]=_[_0xba05('0x30')](_0x478e17['query']);_0x2c3cc2[_0xba05('0x31')]=_[_0xba05('0x32')](_0x2c3cc2[_0xba05('0x2e')],_0x2c3cc2[_0xba05('0x2f')]);_0x3ccc02['attributes']=_['intersection'](_0x2c3cc2[_0xba05('0x2e')],qs['fields'](_0x478e17[_0xba05('0x2f')][_0xba05('0x33')]));_0x3ccc02[_0xba05('0x34')]=_0x3ccc02[_0xba05('0x34')]['length']?_0x3ccc02['attributes']:_0x2c3cc2['model'];if(!_0x478e17[_0xba05('0x2f')][_0xba05('0x35')]('nolimit')){_0x3ccc02['limit']=qs[_0xba05('0x1b')](_0x478e17[_0xba05('0x2f')][_0xba05('0x1b')]);_0x3ccc02[_0xba05('0x19')]=qs[_0xba05('0x19')](_0x478e17[_0xba05('0x2f')][_0xba05('0x19')]);}_0x3ccc02[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x478e17[_0xba05('0x2f')][_0xba05('0x37')]);_0x3ccc02['where']=qs['filters'](_[_0xba05('0x38')](_0x478e17[_0xba05('0x2f')],_0x2c3cc2[_0xba05('0x31')]),_0x578b11);if(_0x478e17[_0xba05('0x2f')][_0xba05('0x39')]){_0x3ccc02[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x3ccc02[_0xba05('0x3a')],{'$or':_[_0xba05('0x29')](_0x578b11,function(_0x1d421b){if(_0x1d421b[_0xba05('0x3c')]!=='VIRTUAL'){var _0x1819e9={};_0x1819e9[_0x1d421b[_0xba05('0x27')]]={'$like':'%'+_0x478e17[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x1819e9;}})});}_0x3ccc02=_[_0xba05('0x3b')]({},_0x3ccc02,_0x478e17[_0xba05('0x3d')]);var _0x171f8e={'where':_0x3ccc02[_0xba05('0x3a')]};return db[_0xba05('0x2a')]['count'](_0x171f8e)[_0xba05('0x24')](function(_0x1e1979){_0x3a7c42[_0xba05('0x1c')]=_0x1e1979;if(_0x478e17[_0xba05('0x2f')][_0xba05('0x3e')]){_0x3ccc02[_0xba05('0x3f')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xba05('0x40')](_0x3ccc02);})[_0xba05('0x24')](function(_0xa8d28e){_0x3a7c42[_0xba05('0x41')]=_0xa8d28e;return _0x3a7c42;})[_0xba05('0x24')](respondWithFilteredResult(_0x4a93cd,_0x3ccc02))[_0xba05('0x42')](handleError(_0x4a93cd,null));};exports[_0xba05('0x43')]=function(_0x505b1e,_0x90e023){var _0x1247c8={'raw':![],'where':{'id':_0x505b1e[_0xba05('0x44')]['id']}},_0x3b3111={};_0x3b3111[_0xba05('0x2e')]=_[_0xba05('0x30')](db['DeskConfiguration'][_0xba05('0x2b')]);_0x3b3111['query']=_[_0xba05('0x30')](_0x505b1e[_0xba05('0x2f')]);_0x3b3111[_0xba05('0x31')]=_[_0xba05('0x32')](_0x3b3111[_0xba05('0x2e')],_0x3b3111[_0xba05('0x2f')]);_0x1247c8[_0xba05('0x34')]=_[_0xba05('0x32')](_0x3b3111[_0xba05('0x2e')],qs[_0xba05('0x33')](_0x505b1e[_0xba05('0x2f')][_0xba05('0x33')]));_0x1247c8[_0xba05('0x34')]=_0x1247c8[_0xba05('0x34')][_0xba05('0x45')]?_0x1247c8['attributes']:_0x3b3111[_0xba05('0x2e')];if(_0x505b1e['query'][_0xba05('0x3e')]){_0x1247c8[_0xba05('0x3f')]=[{'all':!![]}];}_0x1247c8=_[_0xba05('0x3b')]({},_0x1247c8,_0x505b1e[_0xba05('0x3d')]);return db[_0xba05('0x2a')][_0xba05('0x46')](_0x1247c8)[_0xba05('0x24')](handleEntityNotFound(_0x90e023,null))[_0xba05('0x24')](respondWithResult(_0x90e023,null))['catch'](handleError(_0x90e023,null));};exports[_0xba05('0x47')]=function(_0x10e48d,_0x3286a8){return db[_0xba05('0x2a')][_0xba05('0x47')](_0x10e48d[_0xba05('0x48')],{})[_0xba05('0x24')](respondWithResult(_0x3286a8,0xc9))[_0xba05('0x42')](handleError(_0x3286a8,null));};exports[_0xba05('0x22')]=function(_0x20d364,_0xf234a){if(_0x20d364[_0xba05('0x48')]['id']){delete _0x20d364['body']['id'];}return db[_0xba05('0x2a')][_0xba05('0x46')]({'where':{'id':_0x20d364[_0xba05('0x44')]['id']}})[_0xba05('0x24')](handleEntityNotFound(_0xf234a,null))['then'](saveUpdates(_0x20d364[_0xba05('0x48')],null))[_0xba05('0x24')](respondWithResult(_0xf234a,null))[_0xba05('0x42')](handleError(_0xf234a,null));};exports['destroy']=function(_0x5dfe48,_0x144bf1){return db[_0xba05('0x2a')][_0xba05('0x46')]({'where':{'id':_0x5dfe48['params']['id']}})['then'](handleEntityNotFound(_0x144bf1,null))[_0xba05('0x24')](removeEntity(_0x144bf1,null))['catch'](handleError(_0x144bf1,null));};exports[_0xba05('0x49')]=function(_0x8564b,_0x51b473,_0x48063a){var _0x4715e9={};var _0x108d53={};var _0x11322b;var _0x326990;return db[_0xba05('0x2a')][_0xba05('0x4a')]({'where':{'id':_0x8564b[_0xba05('0x44')]['id']}})['then'](handleEntityNotFound(_0x51b473,null))[_0xba05('0x24')](function(_0x11e415){if(_0x11e415){_0x11322b=_0x11e415;_0x108d53[_0xba05('0x2e')]=_[_0xba05('0x30')](db[_0xba05('0x4b')]['rawAttributes']);_0x108d53[_0xba05('0x2f')]=_['keys'](_0x8564b[_0xba05('0x2f')]);_0x108d53[_0xba05('0x31')]=_[_0xba05('0x32')](_0x108d53[_0xba05('0x2e')],_0x108d53[_0xba05('0x2f')]);_0x4715e9[_0xba05('0x34')]=_[_0xba05('0x32')](_0x108d53[_0xba05('0x2e')],qs[_0xba05('0x33')](_0x8564b[_0xba05('0x2f')][_0xba05('0x33')]));_0x4715e9['attributes']=_0x4715e9[_0xba05('0x34')][_0xba05('0x45')]?_0x4715e9['attributes']:_0x108d53[_0xba05('0x2e')];_0x4715e9[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x8564b['query']['sort']);_0x4715e9[_0xba05('0x3a')]=qs[_0xba05('0x31')](_[_0xba05('0x38')](_0x8564b[_0xba05('0x2f')],_0x108d53[_0xba05('0x31')]));if(_0x8564b['query'][_0xba05('0x39')]){_0x4715e9[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x4715e9['where'],{'$or':_[_0xba05('0x29')](_0x4715e9['attributes'],function(_0x5afeb){var _0x4e52f6={};_0x4e52f6[_0x5afeb]={'$like':'%'+_0x8564b[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x4e52f6;})});}_0x4715e9=_[_0xba05('0x3b')]({},_0x4715e9,_0x8564b['options']);return _0x11322b[_0xba05('0x49')](_0x4715e9);}})[_0xba05('0x24')](function(_0x13902a){if(_0x13902a){_0x326990=_0x13902a['length'];if(!_0x8564b[_0xba05('0x2f')][_0xba05('0x35')](_0xba05('0x4c'))){_0x4715e9[_0xba05('0x1b')]=qs['limit'](_0x8564b[_0xba05('0x2f')][_0xba05('0x1b')]);_0x4715e9[_0xba05('0x19')]=qs[_0xba05('0x19')](_0x8564b['query'][_0xba05('0x19')]);}return _0x11322b[_0xba05('0x49')](_0x4715e9);}})[_0xba05('0x24')](function(_0x4aab3c){if(_0x4aab3c){return _0x4aab3c?{'count':_0x326990,'rows':_0x4aab3c}:null;}})[_0xba05('0x24')](respondWithResult(_0x51b473,null))[_0xba05('0x42')](handleError(_0x51b473,null));};exports[_0xba05('0x4d')]=function(_0x30cc09,_0x4cbca3,_0x51076c){var _0x41826f={};var _0x1078b8={};var _0x5cb842;var _0x11ef4e;return db[_0xba05('0x2a')][_0xba05('0x4a')]({'where':{'id':_0x30cc09[_0xba05('0x44')]['id']}})[_0xba05('0x24')](handleEntityNotFound(_0x4cbca3,null))[_0xba05('0x24')](function(_0x3dc9b9){if(_0x3dc9b9){_0x5cb842=_0x3dc9b9;_0x1078b8[_0xba05('0x2e')]=_[_0xba05('0x30')](db[_0xba05('0x4b')][_0xba05('0x2b')]);_0x1078b8[_0xba05('0x2f')]=_[_0xba05('0x30')](_0x30cc09[_0xba05('0x2f')]);_0x1078b8[_0xba05('0x31')]=_[_0xba05('0x32')](_0x1078b8[_0xba05('0x2e')],_0x1078b8[_0xba05('0x2f')]);_0x41826f[_0xba05('0x34')]=_[_0xba05('0x32')](_0x1078b8[_0xba05('0x2e')],qs['fields'](_0x30cc09[_0xba05('0x2f')][_0xba05('0x33')]));_0x41826f[_0xba05('0x34')]=_0x41826f['attributes'][_0xba05('0x45')]?_0x41826f['attributes']:_0x1078b8[_0xba05('0x2e')];_0x41826f[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x30cc09[_0xba05('0x2f')][_0xba05('0x37')]);_0x41826f[_0xba05('0x3a')]=qs['filters'](_[_0xba05('0x38')](_0x30cc09['query'],_0x1078b8[_0xba05('0x31')]));if(_0x30cc09[_0xba05('0x2f')][_0xba05('0x39')]){_0x41826f[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x41826f['where'],{'$or':_[_0xba05('0x29')](_0x41826f[_0xba05('0x34')],function(_0x58f805){var _0x107f54={};_0x107f54[_0x58f805]={'$like':'%'+_0x30cc09[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x107f54;})});}_0x41826f=_['merge']({},_0x41826f,_0x30cc09[_0xba05('0x3d')]);return _0x5cb842['getSubjects'](_0x41826f);}})[_0xba05('0x24')](function(_0x19ae1f){if(_0x19ae1f){_0x11ef4e=_0x19ae1f['length'];if(!_0x30cc09[_0xba05('0x2f')][_0xba05('0x35')](_0xba05('0x4c'))){_0x41826f[_0xba05('0x1b')]=qs[_0xba05('0x1b')](_0x30cc09[_0xba05('0x2f')][_0xba05('0x1b')]);_0x41826f['offset']=qs[_0xba05('0x19')](_0x30cc09[_0xba05('0x2f')][_0xba05('0x19')]);}return _0x5cb842[_0xba05('0x4d')](_0x41826f);}})[_0xba05('0x24')](function(_0x150be3){if(_0x150be3){return _0x150be3?{'count':_0x11ef4e,'rows':_0x150be3}:null;}})[_0xba05('0x24')](respondWithResult(_0x4cbca3,null))['catch'](handleError(_0x4cbca3,null));};exports['getDescriptions']=function(_0x8c6462,_0x424394,_0x3f90b2){var _0x2ce5cd={};var _0x5d2254={};var _0x2ccaf7;var _0x2892f8;return db[_0xba05('0x2a')]['findOne']({'where':{'id':_0x8c6462['params']['id']}})['then'](handleEntityNotFound(_0x424394,null))[_0xba05('0x24')](function(_0x1703f5){if(_0x1703f5){_0x2ccaf7=_0x1703f5;_0x5d2254['model']=_[_0xba05('0x30')](db[_0xba05('0x4b')][_0xba05('0x2b')]);_0x5d2254[_0xba05('0x2f')]=_['keys'](_0x8c6462['query']);_0x5d2254['filters']=_[_0xba05('0x32')](_0x5d2254[_0xba05('0x2e')],_0x5d2254['query']);_0x2ce5cd[_0xba05('0x34')]=_[_0xba05('0x32')](_0x5d2254[_0xba05('0x2e')],qs[_0xba05('0x33')](_0x8c6462[_0xba05('0x2f')][_0xba05('0x33')]));_0x2ce5cd['attributes']=_0x2ce5cd[_0xba05('0x34')][_0xba05('0x45')]?_0x2ce5cd[_0xba05('0x34')]:_0x5d2254['model'];_0x2ce5cd[_0xba05('0x36')]=qs[_0xba05('0x37')](_0x8c6462['query'][_0xba05('0x37')]);_0x2ce5cd[_0xba05('0x3a')]=qs[_0xba05('0x31')](_[_0xba05('0x38')](_0x8c6462[_0xba05('0x2f')],_0x5d2254[_0xba05('0x31')]));if(_0x8c6462[_0xba05('0x2f')][_0xba05('0x39')]){_0x2ce5cd[_0xba05('0x3a')]=_[_0xba05('0x3b')](_0x2ce5cd[_0xba05('0x3a')],{'$or':_[_0xba05('0x29')](_0x2ce5cd[_0xba05('0x34')],function(_0x66343d){var _0x515386={};_0x515386[_0x66343d]={'$like':'%'+_0x8c6462['query']['filter']+'%'};return _0x515386;})});}_0x2ce5cd=_[_0xba05('0x3b')]({},_0x2ce5cd,_0x8c6462['options']);return _0x2ccaf7[_0xba05('0x4e')](_0x2ce5cd);}})[_0xba05('0x24')](function(_0x2d59b0){if(_0x2d59b0){_0x2892f8=_0x2d59b0['length'];if(!_0x8c6462['query']['hasOwnProperty'](_0xba05('0x4c'))){_0x2ce5cd[_0xba05('0x1b')]=qs[_0xba05('0x1b')](_0x8c6462[_0xba05('0x2f')][_0xba05('0x1b')]);_0x2ce5cd['offset']=qs['offset'](_0x8c6462[_0xba05('0x2f')][_0xba05('0x19')]);}return _0x2ccaf7['getDescriptions'](_0x2ce5cd);}})[_0xba05('0x24')](function(_0x2b963d){if(_0x2b963d){return _0x2b963d?{'count':_0x2892f8,'rows':_0x2b963d}:null;}})[_0xba05('0x24')](respondWithResult(_0x424394,null))[_0xba05('0x42')](handleError(_0x424394,null));};exports[_0xba05('0x4f')]=function(_0x3b5ae4,_0x11ef4d,_0x178ff3){var _0x394b1a={};var _0x96c076={};var _0xc1ce5d;var _0x5de210;return db[_0xba05('0x2a')]['findOne']({'where':{'id':_0x3b5ae4['params']['id']}})[_0xba05('0x24')](handleEntityNotFound(_0x11ef4d,null))[_0xba05('0x24')](function(_0x289fe9){if(_0x289fe9){_0xc1ce5d=_0x289fe9;_0x96c076[_0xba05('0x2e')]=_['keys'](db[_0xba05('0x50')]['rawAttributes']);_0x96c076[_0xba05('0x2f')]=_['keys'](_0x3b5ae4[_0xba05('0x2f')]);_0x96c076['filters']=_[_0xba05('0x32')](_0x96c076[_0xba05('0x2e')],_0x96c076['query']);_0x394b1a[_0xba05('0x34')]=_[_0xba05('0x32')](_0x96c076[_0xba05('0x2e')],qs['fields'](_0x3b5ae4['query'][_0xba05('0x33')]));_0x394b1a[_0xba05('0x34')]=_0x394b1a['attributes'][_0xba05('0x45')]?_0x394b1a[_0xba05('0x34')]:_0x96c076[_0xba05('0x2e')];_0x394b1a[_0xba05('0x36')]=qs['sort'](_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x37')]);_0x394b1a['where']=qs['filters'](_['pick'](_0x3b5ae4[_0xba05('0x2f')],_0x96c076[_0xba05('0x31')]));if(_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x39')]){_0x394b1a['where']=_[_0xba05('0x3b')](_0x394b1a[_0xba05('0x3a')],{'$or':_[_0xba05('0x29')](_0x394b1a['attributes'],function(_0x3eaea4){var _0x42ca98={};_0x42ca98[_0x3eaea4]={'$like':'%'+_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x39')]+'%'};return _0x42ca98;})});}_0x394b1a=_[_0xba05('0x3b')]({},_0x394b1a,_0x3b5ae4[_0xba05('0x3d')]);return _0xc1ce5d[_0xba05('0x4f')](_0x394b1a);}})[_0xba05('0x24')](function(_0x5a0249){if(_0x5a0249){_0x5de210=_0x5a0249[_0xba05('0x45')];if(!_0x3b5ae4[_0xba05('0x2f')][_0xba05('0x35')]('nolimit')){_0x394b1a[_0xba05('0x1b')]=qs[_0xba05('0x1b')](_0x3b5ae4['query']['limit']);_0x394b1a[_0xba05('0x19')]=qs[_0xba05('0x19')](_0x3b5ae4['query'][_0xba05('0x19')]);}return _0xc1ce5d[_0xba05('0x4f')](_0x394b1a);}})[_0xba05('0x24')](function(_0x118243){if(_0x118243){return _0x118243?{'count':_0x5de210,'rows':_0x118243}:null;}})[_0xba05('0x24')](respondWithResult(_0x11ef4d,null))[_0xba05('0x42')](handleError(_0x11ef4d,null));};exports[_0xba05('0x51')]=function(_0x32f175,_0x53b539,_0xe1d309){if(_0x32f175[_0xba05('0x48')]['id']){delete _0x32f175[_0xba05('0x48')]['id'];}return db[_0xba05('0x2a')]['findOne']({'where':{'id':_0x32f175['params']['id']}})[_0xba05('0x24')](handleEntityNotFound(_0x53b539,null))['then'](function(_0x353ab1){if(_0x353ab1){return _0x353ab1[_0xba05('0x51')](_0x32f175['body']['ids']||[]);}return null;})[_0xba05('0x24')](respondWithResult(_0x53b539,null))['catch'](handleError(_0x53b539,null));}; \ No newline at end of file +var _0xc98b=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','name','index','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','DeskConfiguration','includeAll','include','rows','catch','show','params','find','create','body','getFields','findOne','DeskField','map','getSubjects','getDescriptions','order','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x2c006b,_0x27334d){var _0xb3b154=function(_0x1956e5){while(--_0x1956e5){_0x2c006b['push'](_0x2c006b['shift']());}};_0xb3b154(++_0x27334d);}(_0xc98b,0x92));var _0xbc98=function(_0x495c87,_0x151384){_0x495c87=_0x495c87-0x0;var _0x31a257=_0xc98b[_0x495c87];return _0x31a257;};'use strict';var emlformat=require(_0xbc98('0x0'));var rimraf=require(_0xbc98('0x1'));var zipdir=require(_0xbc98('0x2'));var jsonpatch=require(_0xbc98('0x3'));var rp=require('request-promise');var moment=require(_0xbc98('0x4'));var BPromise=require(_0xbc98('0x5'));var Mustache=require(_0xbc98('0x6'));var util=require(_0xbc98('0x7'));var path=require(_0xbc98('0x8'));var sox=require('sox');var csv=require(_0xbc98('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc98('0xa'));var _=require(_0xbc98('0xb'));var squel=require(_0xbc98('0xc'));var crypto=require(_0xbc98('0xd'));var jsforce=require(_0xbc98('0xe'));var deskjs=require(_0xbc98('0xf'));var toCsv=require(_0xbc98('0x9'));var querystring=require('querystring');var Papa=require(_0xbc98('0x10'));var Redis=require(_0xbc98('0x11'));var authService=require(_0xbc98('0x12'));var qs=require(_0xbc98('0x13'));var as=require(_0xbc98('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbc98('0x15'))('api');var utils=require(_0xbc98('0x16'));var config=require(_0xbc98('0x17'));var licenseUtil=require(_0xbc98('0x18'));var db=require(_0xbc98('0x19'))['db'];function respondWithStatusCode(_0x383ff5,_0xe17de9){_0xe17de9=_0xe17de9||0xcc;return function(_0x912b32){if(_0x912b32){return _0x383ff5[_0xbc98('0x1a')](_0xe17de9);}return _0x383ff5[_0xbc98('0x1b')](_0xe17de9)[_0xbc98('0x1c')]();};}function respondWithResult(_0x5871bb,_0x5e7c42){_0x5e7c42=_0x5e7c42||0xc8;return function(_0x1d3e64){if(_0x1d3e64){return _0x5871bb[_0xbc98('0x1b')](_0x5e7c42)['json'](_0x1d3e64);}};}function respondWithFilteredResult(_0x122d6c,_0x1d0b6e){return function(_0x3ebe15){if(_0x3ebe15){var _0x1e6802=typeof _0x1d0b6e[_0xbc98('0x1d')]===_0xbc98('0x1e')&&typeof _0x1d0b6e[_0xbc98('0x1f')]===_0xbc98('0x1e');var _0xa2f506=_0x3ebe15[_0xbc98('0x20')];var _0x43de7a=_0x1e6802?0x0:_0x1d0b6e[_0xbc98('0x1d')];var _0x4abce4=_0x1e6802?_0x3ebe15[_0xbc98('0x20')]:_0x1d0b6e[_0xbc98('0x1d')]+_0x1d0b6e[_0xbc98('0x1f')];var _0x48aec1;if(_0x4abce4>=_0xa2f506){_0x4abce4=_0xa2f506;_0x48aec1=0xc8;}else{_0x48aec1=0xce;}_0x122d6c[_0xbc98('0x1b')](_0x48aec1);return _0x122d6c[_0xbc98('0x21')](_0xbc98('0x22'),_0x43de7a+'-'+_0x4abce4+'/'+_0xa2f506)[_0xbc98('0x23')](_0x3ebe15);}return null;};}function patchUpdates(_0x34e931){return function(_0xdb5a35){try{jsonpatch['apply'](_0xdb5a35,_0x34e931,!![]);}catch(_0x35bb6e){return BPromise[_0xbc98('0x24')](_0x35bb6e);}return _0xdb5a35[_0xbc98('0x25')]();};}function saveUpdates(_0xac985a,_0xe11a8){return function(_0x4db7ba){if(_0x4db7ba){return _0x4db7ba['update'](_0xac985a)[_0xbc98('0x26')](function(_0x497b8b){return _0x497b8b;});}return null;};}function removeEntity(_0x5e4073,_0x4609ef){return function(_0x5efc44){if(_0x5efc44){return _0x5efc44[_0xbc98('0x27')]()[_0xbc98('0x26')](function(){_0x5e4073['status'](0xcc)[_0xbc98('0x1c')]();});}};}function handleEntityNotFound(_0x499934,_0x52a990){return function(_0x40a0ca){if(!_0x40a0ca){_0x499934[_0xbc98('0x1a')](0x194);}return _0x40a0ca;};}function handleError(_0xd4c217,_0x480795){_0x480795=_0x480795||0x1f4;return function(_0x4c7eda){logger['error'](_0x4c7eda['stack']);if(_0x4c7eda[_0xbc98('0x28')]){delete _0x4c7eda[_0xbc98('0x28')];}_0xd4c217[_0xbc98('0x1b')](_0x480795)['send'](_0x4c7eda);};}exports[_0xbc98('0x29')]=function(_0x25dab7,_0x2c930c){var _0x170534={},_0x5277f4={},_0x170dc1={'count':0x0,'rows':[]};var _0x44ab7a=_['map'](db['DeskConfiguration'][_0xbc98('0x2a')],function(_0x2d0900){return{'name':_0x2d0900[_0xbc98('0x2b')],'type':_0x2d0900['type'][_0xbc98('0x2c')]};});_0x5277f4[_0xbc98('0x2d')]=_['map'](_0x44ab7a,_0xbc98('0x28'));_0x5277f4['query']=_[_0xbc98('0x2e')](_0x25dab7[_0xbc98('0x2f')]);_0x5277f4[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x5277f4[_0xbc98('0x2d')],_0x5277f4[_0xbc98('0x2f')]);_0x170534[_0xbc98('0x32')]=_['intersection'](_0x5277f4['model'],qs[_0xbc98('0x33')](_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x33')]));_0x170534['attributes']=_0x170534[_0xbc98('0x32')][_0xbc98('0x34')]?_0x170534[_0xbc98('0x32')]:_0x5277f4['model'];if(!_0x25dab7['query'][_0xbc98('0x35')](_0xbc98('0x36'))){_0x170534[_0xbc98('0x1f')]=qs[_0xbc98('0x1f')](_0x25dab7[_0xbc98('0x2f')]['limit']);_0x170534[_0xbc98('0x1d')]=qs['offset'](_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x1d')]);}_0x170534['order']=qs['sort'](_0x25dab7['query'][_0xbc98('0x37')]);_0x170534[_0xbc98('0x38')]=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x25dab7[_0xbc98('0x2f')],_0x5277f4['filters']),_0x44ab7a);if(_0x25dab7['query'][_0xbc98('0x3a')]){_0x170534[_0xbc98('0x38')]=_['merge'](_0x170534['where'],{'$or':_['map'](_0x44ab7a,function(_0x1f1df6){if(_0x1f1df6['type']!==_0xbc98('0x3b')){var _0x3b8003={};_0x3b8003[_0x1f1df6[_0xbc98('0x28')]]={'$like':'%'+_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x3a')]+'%'};return _0x3b8003;}})});}_0x170534=_[_0xbc98('0x3c')]({},_0x170534,_0x25dab7[_0xbc98('0x3d')]);var _0x207677={'where':_0x170534[_0xbc98('0x38')]};return db[_0xbc98('0x3e')][_0xbc98('0x20')](_0x207677)[_0xbc98('0x26')](function(_0x21ac2f){_0x170dc1[_0xbc98('0x20')]=_0x21ac2f;if(_0x25dab7[_0xbc98('0x2f')][_0xbc98('0x3f')]){_0x170534[_0xbc98('0x40')]=[{'all':!![]}];}return db[_0xbc98('0x3e')]['findAll'](_0x170534);})['then'](function(_0x506c90){_0x170dc1[_0xbc98('0x41')]=_0x506c90;return _0x170dc1;})['then'](respondWithFilteredResult(_0x2c930c,_0x170534))[_0xbc98('0x42')](handleError(_0x2c930c,null));};exports[_0xbc98('0x43')]=function(_0x2f4800,_0x2ea1d2){var _0x5b2605={'raw':![],'where':{'id':_0x2f4800[_0xbc98('0x44')]['id']}},_0x12906f={};_0x12906f[_0xbc98('0x2d')]=_['keys'](db['DeskConfiguration'][_0xbc98('0x2a')]);_0x12906f[_0xbc98('0x2f')]=_[_0xbc98('0x2e')](_0x2f4800['query']);_0x12906f[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x12906f['model'],_0x12906f['query']);_0x5b2605[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x12906f[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x2f4800[_0xbc98('0x2f')]['fields']));_0x5b2605[_0xbc98('0x32')]=_0x5b2605[_0xbc98('0x32')][_0xbc98('0x34')]?_0x5b2605[_0xbc98('0x32')]:_0x12906f['model'];if(_0x2f4800[_0xbc98('0x2f')][_0xbc98('0x3f')]){_0x5b2605[_0xbc98('0x40')]=[{'all':!![]}];}_0x5b2605=_[_0xbc98('0x3c')]({},_0x5b2605,_0x2f4800[_0xbc98('0x3d')]);return db[_0xbc98('0x3e')][_0xbc98('0x45')](_0x5b2605)[_0xbc98('0x26')](handleEntityNotFound(_0x2ea1d2,null))[_0xbc98('0x26')](respondWithResult(_0x2ea1d2,null))['catch'](handleError(_0x2ea1d2,null));};exports['create']=function(_0x248099,_0xe1e88e){return db[_0xbc98('0x3e')][_0xbc98('0x46')](_0x248099[_0xbc98('0x47')],{})[_0xbc98('0x26')](respondWithResult(_0xe1e88e,0xc9))['catch'](handleError(_0xe1e88e,null));};exports['update']=function(_0x52c384,_0x1d5acb){if(_0x52c384[_0xbc98('0x47')]['id']){delete _0x52c384['body']['id'];}return db[_0xbc98('0x3e')][_0xbc98('0x45')]({'where':{'id':_0x52c384[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x1d5acb,null))[_0xbc98('0x26')](saveUpdates(_0x52c384[_0xbc98('0x47')],null))[_0xbc98('0x26')](respondWithResult(_0x1d5acb,null))[_0xbc98('0x42')](handleError(_0x1d5acb,null));};exports[_0xbc98('0x27')]=function(_0x532954,_0x4757d8){return db[_0xbc98('0x3e')][_0xbc98('0x45')]({'where':{'id':_0x532954[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x4757d8,null))['then'](removeEntity(_0x4757d8,null))[_0xbc98('0x42')](handleError(_0x4757d8,null));};exports[_0xbc98('0x48')]=function(_0x5522c9,_0x5e81a1,_0x4ea8c8){var _0x3cb1c8={};var _0x1b918d={};var _0x1f71cf;var _0x39b411;return db[_0xbc98('0x3e')][_0xbc98('0x49')]({'where':{'id':_0x5522c9['params']['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x5e81a1,null))[_0xbc98('0x26')](function(_0x40f17a){if(_0x40f17a){_0x1f71cf=_0x40f17a;_0x1b918d['model']=_['keys'](db[_0xbc98('0x4a')]['rawAttributes']);_0x1b918d[_0xbc98('0x2f')]=_[_0xbc98('0x2e')](_0x5522c9[_0xbc98('0x2f')]);_0x1b918d[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x1b918d[_0xbc98('0x2d')],_0x1b918d['query']);_0x3cb1c8[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x1b918d[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x33')]));_0x3cb1c8['attributes']=_0x3cb1c8[_0xbc98('0x32')][_0xbc98('0x34')]?_0x3cb1c8[_0xbc98('0x32')]:_0x1b918d[_0xbc98('0x2d')];_0x3cb1c8['order']=qs[_0xbc98('0x37')](_0x5522c9[_0xbc98('0x2f')]['sort']);_0x3cb1c8['where']=qs[_0xbc98('0x30')](_['pick'](_0x5522c9[_0xbc98('0x2f')],_0x1b918d[_0xbc98('0x30')]));if(_0x5522c9['query'][_0xbc98('0x3a')]){_0x3cb1c8['where']=_[_0xbc98('0x3c')](_0x3cb1c8[_0xbc98('0x38')],{'$or':_['map'](_0x3cb1c8[_0xbc98('0x32')],function(_0x61b552){var _0x8b00ce={};_0x8b00ce[_0x61b552]={'$like':'%'+_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x3a')]+'%'};return _0x8b00ce;})});}_0x3cb1c8=_[_0xbc98('0x3c')]({},_0x3cb1c8,_0x5522c9[_0xbc98('0x3d')]);return _0x1f71cf['getFields'](_0x3cb1c8);}})['then'](function(_0x6fe6f5){if(_0x6fe6f5){_0x39b411=_0x6fe6f5[_0xbc98('0x34')];if(!_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x35')](_0xbc98('0x36'))){_0x3cb1c8['limit']=qs[_0xbc98('0x1f')](_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x3cb1c8['offset']=qs[_0xbc98('0x1d')](_0x5522c9[_0xbc98('0x2f')][_0xbc98('0x1d')]);}return _0x1f71cf['getFields'](_0x3cb1c8);}})[_0xbc98('0x26')](function(_0x575ae7){if(_0x575ae7){return _0x575ae7?{'count':_0x39b411,'rows':_0x575ae7}:null;}})[_0xbc98('0x26')](respondWithResult(_0x5e81a1,null))['catch'](handleError(_0x5e81a1,null));};exports['getSubjects']=function(_0x367036,_0x5ee254,_0x588572){var _0x5179d2={};var _0x2c0373={};var _0x5d58cd;var _0x216b9c;return db[_0xbc98('0x3e')][_0xbc98('0x49')]({'where':{'id':_0x367036[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x5ee254,null))['then'](function(_0x42b71a){if(_0x42b71a){_0x5d58cd=_0x42b71a;_0x2c0373[_0xbc98('0x2d')]=_[_0xbc98('0x2e')](db['DeskField'][_0xbc98('0x2a')]);_0x2c0373[_0xbc98('0x2f')]=_['keys'](_0x367036[_0xbc98('0x2f')]);_0x2c0373[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x2c0373[_0xbc98('0x2d')],_0x2c0373['query']);_0x5179d2[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x2c0373[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x367036[_0xbc98('0x2f')]['fields']));_0x5179d2['attributes']=_0x5179d2['attributes'][_0xbc98('0x34')]?_0x5179d2[_0xbc98('0x32')]:_0x2c0373[_0xbc98('0x2d')];_0x5179d2['order']=qs[_0xbc98('0x37')](_0x367036[_0xbc98('0x2f')]['sort']);_0x5179d2['where']=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x367036[_0xbc98('0x2f')],_0x2c0373[_0xbc98('0x30')]));if(_0x367036['query'][_0xbc98('0x3a')]){_0x5179d2[_0xbc98('0x38')]=_['merge'](_0x5179d2[_0xbc98('0x38')],{'$or':_[_0xbc98('0x4b')](_0x5179d2[_0xbc98('0x32')],function(_0x2f69b7){var _0x16795d={};_0x16795d[_0x2f69b7]={'$like':'%'+_0x367036[_0xbc98('0x2f')][_0xbc98('0x3a')]+'%'};return _0x16795d;})});}_0x5179d2=_[_0xbc98('0x3c')]({},_0x5179d2,_0x367036[_0xbc98('0x3d')]);return _0x5d58cd[_0xbc98('0x4c')](_0x5179d2);}})['then'](function(_0x334755){if(_0x334755){_0x216b9c=_0x334755[_0xbc98('0x34')];if(!_0x367036[_0xbc98('0x2f')][_0xbc98('0x35')](_0xbc98('0x36'))){_0x5179d2['limit']=qs[_0xbc98('0x1f')](_0x367036[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x5179d2[_0xbc98('0x1d')]=qs['offset'](_0x367036['query'][_0xbc98('0x1d')]);}return _0x5d58cd[_0xbc98('0x4c')](_0x5179d2);}})[_0xbc98('0x26')](function(_0x377519){if(_0x377519){return _0x377519?{'count':_0x216b9c,'rows':_0x377519}:null;}})[_0xbc98('0x26')](respondWithResult(_0x5ee254,null))[_0xbc98('0x42')](handleError(_0x5ee254,null));};exports[_0xbc98('0x4d')]=function(_0x551af2,_0x49fbbe,_0x5049ed){var _0x51b425={};var _0x5652c0={};var _0x467940;var _0x569e49;return db[_0xbc98('0x3e')]['findOne']({'where':{'id':_0x551af2[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x49fbbe,null))[_0xbc98('0x26')](function(_0x581462){if(_0x581462){_0x467940=_0x581462;_0x5652c0[_0xbc98('0x2d')]=_[_0xbc98('0x2e')](db['DeskField']['rawAttributes']);_0x5652c0[_0xbc98('0x2f')]=_['keys'](_0x551af2[_0xbc98('0x2f')]);_0x5652c0[_0xbc98('0x30')]=_[_0xbc98('0x31')](_0x5652c0['model'],_0x5652c0[_0xbc98('0x2f')]);_0x51b425[_0xbc98('0x32')]=_[_0xbc98('0x31')](_0x5652c0[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x551af2['query'][_0xbc98('0x33')]));_0x51b425[_0xbc98('0x32')]=_0x51b425[_0xbc98('0x32')][_0xbc98('0x34')]?_0x51b425[_0xbc98('0x32')]:_0x5652c0['model'];_0x51b425[_0xbc98('0x4e')]=qs['sort'](_0x551af2[_0xbc98('0x2f')][_0xbc98('0x37')]);_0x51b425['where']=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x551af2['query'],_0x5652c0[_0xbc98('0x30')]));if(_0x551af2['query'][_0xbc98('0x3a')]){_0x51b425[_0xbc98('0x38')]=_[_0xbc98('0x3c')](_0x51b425[_0xbc98('0x38')],{'$or':_['map'](_0x51b425[_0xbc98('0x32')],function(_0x2cc59f){var _0x16e509={};_0x16e509[_0x2cc59f]={'$like':'%'+_0x551af2['query']['filter']+'%'};return _0x16e509;})});}_0x51b425=_[_0xbc98('0x3c')]({},_0x51b425,_0x551af2[_0xbc98('0x3d')]);return _0x467940[_0xbc98('0x4d')](_0x51b425);}})[_0xbc98('0x26')](function(_0x8a5e74){if(_0x8a5e74){_0x569e49=_0x8a5e74[_0xbc98('0x34')];if(!_0x551af2[_0xbc98('0x2f')][_0xbc98('0x35')](_0xbc98('0x36'))){_0x51b425[_0xbc98('0x1f')]=qs[_0xbc98('0x1f')](_0x551af2[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x51b425['offset']=qs[_0xbc98('0x1d')](_0x551af2[_0xbc98('0x2f')][_0xbc98('0x1d')]);}return _0x467940[_0xbc98('0x4d')](_0x51b425);}})[_0xbc98('0x26')](function(_0x2e5f64){if(_0x2e5f64){return _0x2e5f64?{'count':_0x569e49,'rows':_0x2e5f64}:null;}})['then'](respondWithResult(_0x49fbbe,null))['catch'](handleError(_0x49fbbe,null));};exports[_0xbc98('0x4f')]=function(_0x16bc24,_0x3d7c35,_0x13fecc){var _0x51e249={};var _0xe7a98={};var _0x177b43;var _0x41a0ef;return db['DeskConfiguration']['findOne']({'where':{'id':_0x16bc24[_0xbc98('0x44')]['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x3d7c35,null))[_0xbc98('0x26')](function(_0x2d8a2b){if(_0x2d8a2b){_0x177b43=_0x2d8a2b;_0xe7a98[_0xbc98('0x2d')]=_[_0xbc98('0x2e')](db['Tag']['rawAttributes']);_0xe7a98[_0xbc98('0x2f')]=_[_0xbc98('0x2e')](_0x16bc24['query']);_0xe7a98[_0xbc98('0x30')]=_['intersection'](_0xe7a98[_0xbc98('0x2d')],_0xe7a98[_0xbc98('0x2f')]);_0x51e249['attributes']=_[_0xbc98('0x31')](_0xe7a98[_0xbc98('0x2d')],qs[_0xbc98('0x33')](_0x16bc24['query'][_0xbc98('0x33')]));_0x51e249[_0xbc98('0x32')]=_0x51e249[_0xbc98('0x32')][_0xbc98('0x34')]?_0x51e249[_0xbc98('0x32')]:_0xe7a98[_0xbc98('0x2d')];_0x51e249['order']=qs['sort'](_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x37')]);_0x51e249[_0xbc98('0x38')]=qs[_0xbc98('0x30')](_[_0xbc98('0x39')](_0x16bc24[_0xbc98('0x2f')],_0xe7a98[_0xbc98('0x30')]));if(_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x3a')]){_0x51e249[_0xbc98('0x38')]=_[_0xbc98('0x3c')](_0x51e249[_0xbc98('0x38')],{'$or':_['map'](_0x51e249[_0xbc98('0x32')],function(_0x2ebc8e){var _0x177540={};_0x177540[_0x2ebc8e]={'$like':'%'+_0x16bc24['query']['filter']+'%'};return _0x177540;})});}_0x51e249=_[_0xbc98('0x3c')]({},_0x51e249,_0x16bc24[_0xbc98('0x3d')]);return _0x177b43[_0xbc98('0x4f')](_0x51e249);}})[_0xbc98('0x26')](function(_0x30c8b6){if(_0x30c8b6){_0x41a0ef=_0x30c8b6[_0xbc98('0x34')];if(!_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x35')]('nolimit')){_0x51e249[_0xbc98('0x1f')]=qs[_0xbc98('0x1f')](_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x1f')]);_0x51e249[_0xbc98('0x1d')]=qs['offset'](_0x16bc24[_0xbc98('0x2f')][_0xbc98('0x1d')]);}return _0x177b43[_0xbc98('0x4f')](_0x51e249);}})['then'](function(_0x1d24f8){if(_0x1d24f8){return _0x1d24f8?{'count':_0x41a0ef,'rows':_0x1d24f8}:null;}})['then'](respondWithResult(_0x3d7c35,null))['catch'](handleError(_0x3d7c35,null));};exports[_0xbc98('0x50')]=function(_0x5c9e30,_0x3528a6,_0x1996c){if(_0x5c9e30[_0xbc98('0x47')]['id']){delete _0x5c9e30[_0xbc98('0x47')]['id'];}return db['DeskConfiguration'][_0xbc98('0x49')]({'where':{'id':_0x5c9e30['params']['id']}})[_0xbc98('0x26')](handleEntityNotFound(_0x3528a6,null))[_0xbc98('0x26')](function(_0x2a64f2){if(_0x2a64f2){return _0x2a64f2[_0xbc98('0x50')](_0x5c9e30['body'][_0xbc98('0x51')]||[]);}return null;})['then'](respondWithResult(_0x3528a6,null))[_0xbc98('0x42')](handleError(_0x3528a6,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 9e99320..11a4510 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 _0x3da7=['request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','int_desk_configurations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x5c380e,_0xa74c25){var _0xb0f44=function(_0x5a1a76){while(--_0x5a1a76){_0x5c380e['push'](_0x5c380e['shift']());}};_0xb0f44(++_0xa74c25);}(_0x3da7,0xe2));var _0x73da=function(_0x2aea9e,_0x1f587f){_0x2aea9e=_0x2aea9e-0x0;var _0x430b92=_0x3da7[_0x2aea9e];return _0x430b92;};'use strict';var _=require(_0x73da('0x0'));var util=require('util');var logger=require(_0x73da('0x1'))(_0x73da('0x2'));var moment=require(_0x73da('0x3'));var BPromise=require(_0x73da('0x4'));var rp=require(_0x73da('0x5'));var fs=require('fs');var path=require(_0x73da('0x6'));var rimraf=require('rimraf');var config=require(_0x73da('0x7'));var attributes=require(_0x73da('0x8'));module[_0x73da('0x9')]=function(_0xbb84d6,_0x1f61af){return _0xbb84d6['define']('DeskConfiguration',attributes,{'tableName':_0x73da('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe815=['define','int_desk_configurations','lodash','util','api','moment','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x1db5f9,_0x33dde1){var _0x3efa84=function(_0x542042){while(--_0x542042){_0x1db5f9['push'](_0x1db5f9['shift']());}};_0x3efa84(++_0x33dde1);}(_0xe815,0x7a));var _0x5e81=function(_0x5690b6,_0x5273b3){_0x5690b6=_0x5690b6-0x0;var _0x2b39cb=_0xe815[_0x5690b6];return _0x2b39cb;};'use strict';var _=require(_0x5e81('0x0'));var util=require(_0x5e81('0x1'));var logger=require('../../config/logger')(_0x5e81('0x2'));var moment=require(_0x5e81('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5e81('0x4'));var rimraf=require(_0x5e81('0x5'));var config=require(_0x5e81('0x6'));var attributes=require(_0x5e81('0x7'));module['exports']=function(_0xae5ce,_0x590796){return _0xae5ce[_0x5e81('0x8')]('DeskConfiguration',attributes,{'tableName':_0x5e81('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js b/server/api/intDeskConfiguration/intDeskConfiguration.rpc.js index f475ac5..8e57284 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 _0x8b35=['code','DeskConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error'];(function(_0x28fd4c,_0x1a43f9){var _0xa30045=function(_0x211476){while(--_0x211476){_0x28fd4c['push'](_0x28fd4c['shift']());}};_0xa30045(++_0x1a43f9);}(_0x8b35,0x17a));var _0x58b3=function(_0x3f37f8,_0x3a78bc){_0x3f37f8=_0x3f37f8-0x0;var _0x160728=_0x8b35[_0x3f37f8];return _0x160728;};'use strict';var _=require(_0x58b3('0x0'));var util=require(_0x58b3('0x1'));var moment=require(_0x58b3('0x2'));var BPromise=require(_0x58b3('0x3'));var rs=require(_0x58b3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x58b3('0x5'))['db'];var utils=require(_0x58b3('0x6'));var logger=require(_0x58b3('0x7'))(_0x58b3('0x8'));var config=require(_0x58b3('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x58b3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35d044,_0x5ec362,_0x503b78){return new BPromise(function(_0x126232,_0x46fda3){return client[_0x58b3('0xb')](_0x35d044,_0x503b78)[_0x58b3('0xc')](function(_0x446e8d){logger[_0x58b3('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x5ec362,_0x58b3('0xe'));logger[_0x58b3('0xf')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5ec362,_0x58b3('0xe'),JSON[_0x58b3('0x10')](_0x446e8d));if(_0x446e8d[_0x58b3('0x11')]){if(_0x446e8d['error'][_0x58b3('0x12')]===0x1f4){logger['error'](_0x58b3('0x13'),_0x5ec362,_0x446e8d[_0x58b3('0x11')][_0x58b3('0x14')]);return _0x46fda3(_0x446e8d[_0x58b3('0x11')][_0x58b3('0x14')]);}logger[_0x58b3('0x11')](_0x58b3('0x13'),_0x5ec362,_0x446e8d['error'][_0x58b3('0x14')]);return _0x126232(_0x446e8d[_0x58b3('0x11')]['message']);}else{logger[_0x58b3('0xd')](_0x58b3('0x13'),_0x5ec362,'request\x20sent');_0x126232(_0x446e8d['result'][_0x58b3('0x14')]);}})[_0x58b3('0x15')](function(_0x38f6a7){logger[_0x58b3('0x11')]('DeskConfiguration,\x20%s,\x20%s',_0x5ec362,_0x38f6a7);_0x46fda3(_0x38f6a7);});});} \ No newline at end of file +var _0x6f3e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0xcc0b4a,_0x1be954){var _0x23e29d=function(_0x1d97ea){while(--_0x1d97ea){_0xcc0b4a['push'](_0xcc0b4a['shift']());}};_0x23e29d(++_0x1be954);}(_0x6f3e,0x9f));var _0xe6f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6f3e[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xe6f3('0x0'));var util=require(_0xe6f3('0x1'));var moment=require(_0xe6f3('0x2'));var BPromise=require(_0xe6f3('0x3'));var rs=require(_0xe6f3('0x4'));var fs=require('fs');var Redis=require(_0xe6f3('0x5'));var db=require(_0xe6f3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe6f3('0x7'))(_0xe6f3('0x8'));var config=require('../../config/environment');var jayson=require(_0xe6f3('0x9'));var client=jayson[_0xe6f3('0xa')][_0xe6f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b59eb,_0x44cedc,_0x17242d){return new BPromise(function(_0x53d62d,_0x4ba888){return client[_0xe6f3('0xc')](_0x5b59eb,_0x17242d)['then'](function(_0x331856){logger[_0xe6f3('0xd')](_0xe6f3('0xe'),_0x44cedc,_0xe6f3('0xf'));logger[_0xe6f3('0x10')](_0xe6f3('0x11'),_0x44cedc,'request\x20sent',JSON[_0xe6f3('0x12')](_0x331856));if(_0x331856['error']){if(_0x331856[_0xe6f3('0x13')][_0xe6f3('0x14')]===0x1f4){logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x331856['error'][_0xe6f3('0x15')]);return _0x4ba888(_0x331856[_0xe6f3('0x13')][_0xe6f3('0x15')]);}logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x331856[_0xe6f3('0x13')][_0xe6f3('0x15')]);return _0x53d62d(_0x331856['error'][_0xe6f3('0x15')]);}else{logger[_0xe6f3('0xd')](_0xe6f3('0xe'),_0x44cedc,_0xe6f3('0xf'));_0x53d62d(_0x331856[_0xe6f3('0x16')]['message']);}})['catch'](function(_0x410177){logger[_0xe6f3('0x13')](_0xe6f3('0xe'),_0x44cedc,_0x410177);_0x4ba888(_0x410177);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f113977..7da08fa 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 _0x3f94=['./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra'];(function(_0x2db932,_0x858cfd){var _0x3a1a6d=function(_0x14901d){while(--_0x14901d){_0x2db932['push'](_0x2db932['shift']());}};_0x3a1a6d(++_0x858cfd);}(_0x3f94,0x11b));var _0x43f9=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x3f94[_0x243b59];return _0x3e1676;};'use strict';var multer=require('multer');var util=require(_0x43f9('0x0'));var path=require('path');var timeout=require(_0x43f9('0x1'));var express=require(_0x43f9('0x2'));var router=express[_0x43f9('0x3')]();var fs_extra=require(_0x43f9('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x43f9('0x5'));router[_0x43f9('0x6')]('/',auth[_0x43f9('0x7')](),controller[_0x43f9('0x8')]);router[_0x43f9('0x6')](_0x43f9('0x9'),auth[_0x43f9('0x7')](),controller[_0x43f9('0xa')]);router[_0x43f9('0xb')]('/',auth[_0x43f9('0x7')](),controller[_0x43f9('0xc')]);router[_0x43f9('0xd')](_0x43f9('0x9'),auth[_0x43f9('0x7')](),controller[_0x43f9('0xe')]);router[_0x43f9('0xf')](_0x43f9('0x9'),auth[_0x43f9('0x7')](),controller[_0x43f9('0x10')]);module[_0x43f9('0x11')]=router; \ No newline at end of file +var _0xafff=['destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x166c71,_0x2e0dbe){var _0xadbf32=function(_0x251cc9){while(--_0x251cc9){_0x166c71['push'](_0x166c71['shift']());}};_0xadbf32(++_0x2e0dbe);}(_0xafff,0x16a));var _0xfaff=function(_0x5cabe8,_0x199b71){_0x5cabe8=_0x5cabe8-0x0;var _0x1ed475=_0xafff[_0x5cabe8];return _0x1ed475;};'use strict';var multer=require(_0xfaff('0x0'));var util=require(_0xfaff('0x1'));var path=require(_0xfaff('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaff('0x3'));var router=express['Router']();var fs_extra=require(_0xfaff('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfaff('0x5'));var config=require(_0xfaff('0x6'));var controller=require('./intDeskField.controller');router[_0xfaff('0x7')]('/',auth['isAuthenticated'](),controller[_0xfaff('0x8')]);router[_0xfaff('0x7')](_0xfaff('0x9'),auth[_0xfaff('0xa')](),controller[_0xfaff('0xb')]);router[_0xfaff('0xc')]('/',auth[_0xfaff('0xa')](),controller[_0xfaff('0xd')]);router['put']('/:id',auth[_0xfaff('0xa')](),controller[_0xfaff('0xe')]);router[_0xfaff('0xf')](_0xfaff('0x9'),auth[_0xfaff('0xa')](),controller[_0xfaff('0x10')]);module[_0xfaff('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 344342f..c0647cd 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 _0x0ac0=['customVariable','keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable'];(function(_0x53c3aa,_0x3cbbc1){var _0x58fca6=function(_0x21f049){while(--_0x21f049){_0x53c3aa['push'](_0x53c3aa['shift']());}};_0x58fca6(++_0x3cbbc1);}(_0x0ac0,0x15a));var _0x00ac=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0x0ac0[_0x210718];return _0x541bfc;};'use strict';var Sequelize=require(_0x00ac('0x0'));module[_0x00ac('0x1')]={'type':{'type':Sequelize[_0x00ac('0x2')](_0x00ac('0x3'),_0x00ac('0x4'),_0x00ac('0x5'),_0x00ac('0x6'),_0x00ac('0x7')),'defaultValue':_0x00ac('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x00ac('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x00ac('0x3'),_0x00ac('0x4'),_0x00ac('0x5'))},'keyContent':{'type':Sequelize[_0x00ac('0x8')]},'idField':{'type':Sequelize[_0x00ac('0x8')]},'nameField':{'type':Sequelize[_0x00ac('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x00ac('0x8')]}}; \ No newline at end of file +var _0xe9a6=['exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xe9a6,0xe9));var _0x6e9a=function(_0x4d14d3,_0x1c515c){_0x4d14d3=_0x4d14d3-0x0;var _0x2e41e8=_0xe9a6[_0x4d14d3];return _0x2e41e8;};'use strict';var Sequelize=require(_0x6e9a('0x0'));module[_0x6e9a('0x1')]={'type':{'type':Sequelize[_0x6e9a('0x2')](_0x6e9a('0x3'),_0x6e9a('0x4'),_0x6e9a('0x5'),_0x6e9a('0x6'),'picklist'),'defaultValue':_0x6e9a('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x6e9a('0x7')]},'keyType':{'type':Sequelize[_0x6e9a('0x2')](_0x6e9a('0x3'),_0x6e9a('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0x6e9a('0x7')]},'idField':{'type':Sequelize[_0x6e9a('0x7')]},'nameField':{'type':Sequelize[_0x6e9a('0x7')]},'customField':{'type':Sequelize[_0x6e9a('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index f4675ab..9ac1ef1 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 _0x27eb=['to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','keys','create','body','find','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox'];(function(_0xe2c7c4,_0x5ebb6f){var _0xdddd2c=function(_0x37a1d7){while(--_0x37a1d7){_0xe2c7c4['push'](_0xe2c7c4['shift']());}};_0xdddd2c(++_0x5ebb6f);}(_0x27eb,0xd0));var _0xb27e=function(_0x56d591,_0x3191a3){_0x56d591=_0x56d591-0x0;var _0x4bf0ff=_0x27eb[_0x56d591];return _0x4bf0ff;};'use strict';var emlformat=require(_0xb27e('0x0'));var rimraf=require(_0xb27e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb27e('0x2'));var moment=require(_0xb27e('0x3'));var BPromise=require(_0xb27e('0x4'));var Mustache=require('mustache');var util=require(_0xb27e('0x5'));var path=require(_0xb27e('0x6'));var sox=require(_0xb27e('0x7'));var csv=require(_0xb27e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb27e('0x9'));var _=require(_0xb27e('0xa'));var squel=require(_0xb27e('0xb'));var crypto=require(_0xb27e('0xc'));var jsforce=require(_0xb27e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb27e('0x8'));var querystring=require(_0xb27e('0xe'));var Papa=require(_0xb27e('0xf'));var Redis=require(_0xb27e('0x10'));var authService=require(_0xb27e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xb27e('0x12'));var hardwareService=require(_0xb27e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xb27e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xb27e('0x15'));var db=require(_0xb27e('0x16'))['db'];function respondWithStatusCode(_0x4d0b5d,_0x58b37f){_0x58b37f=_0x58b37f||0xcc;return function(_0x48c914){if(_0x48c914){return _0x4d0b5d[_0xb27e('0x17')](_0x58b37f);}return _0x4d0b5d['status'](_0x58b37f)[_0xb27e('0x18')]();};}function respondWithResult(_0x54657b,_0x1b55e2){_0x1b55e2=_0x1b55e2||0xc8;return function(_0x5aa86f){if(_0x5aa86f){return _0x54657b[_0xb27e('0x19')](_0x1b55e2)[_0xb27e('0x1a')](_0x5aa86f);}};}function respondWithFilteredResult(_0x28cc6d,_0x522bbf){return function(_0x26ec32){if(_0x26ec32){var _0x1d14bb=typeof _0x522bbf[_0xb27e('0x1b')]===_0xb27e('0x1c')&&typeof _0x522bbf[_0xb27e('0x1d')]===_0xb27e('0x1c');var _0x25ce70=_0x26ec32[_0xb27e('0x1e')];var _0x317f4e=_0x1d14bb?0x0:_0x522bbf['offset'];var _0x8be243=_0x1d14bb?_0x26ec32[_0xb27e('0x1e')]:_0x522bbf[_0xb27e('0x1b')]+_0x522bbf['limit'];var _0x352856;if(_0x8be243>=_0x25ce70){_0x8be243=_0x25ce70;_0x352856=0xc8;}else{_0x352856=0xce;}_0x28cc6d['status'](_0x352856);return _0x28cc6d['set'](_0xb27e('0x1f'),_0x317f4e+'-'+_0x8be243+'/'+_0x25ce70)[_0xb27e('0x1a')](_0x26ec32);}return null;};}function patchUpdates(_0x4ec66c){return function(_0x2a78c0){try{jsonpatch[_0xb27e('0x20')](_0x2a78c0,_0x4ec66c,!![]);}catch(_0x16c950){return BPromise[_0xb27e('0x21')](_0x16c950);}return _0x2a78c0['save']();};}function saveUpdates(_0x3c9e21,_0x5a3cdf){return function(_0x19c0f2){if(_0x19c0f2){return _0x19c0f2[_0xb27e('0x22')](_0x3c9e21)['then'](function(_0x58fc84){return _0x58fc84;});}return null;};}function removeEntity(_0x2146c0,_0xfbc258){return function(_0x3703ab){if(_0x3703ab){return _0x3703ab[_0xb27e('0x23')]()[_0xb27e('0x24')](function(){_0x2146c0['status'](0xcc)[_0xb27e('0x18')]();});}};}function handleEntityNotFound(_0x4cba0b,_0x3972bc){return function(_0x1ac460){if(!_0x1ac460){_0x4cba0b[_0xb27e('0x17')](0x194);}return _0x1ac460;};}function handleError(_0x3fbc78,_0x3254fb){_0x3254fb=_0x3254fb||0x1f4;return function(_0x4dab95){logger[_0xb27e('0x25')](_0x4dab95['stack']);if(_0x4dab95[_0xb27e('0x26')]){delete _0x4dab95[_0xb27e('0x26')];}_0x3fbc78[_0xb27e('0x19')](_0x3254fb)[_0xb27e('0x27')](_0x4dab95);};}exports[_0xb27e('0x28')]=function(_0x35169a,_0xd27061){var _0x125c0b={},_0x42c5de={},_0x4ef0e6={'count':0x0,'rows':[]};var _0x377d79=_[_0xb27e('0x29')](db[_0xb27e('0x2a')][_0xb27e('0x2b')],function(_0x58a1a9){return{'name':_0x58a1a9[_0xb27e('0x2c')],'type':_0x58a1a9[_0xb27e('0x2d')][_0xb27e('0x2e')]};});_0x42c5de[_0xb27e('0x2f')]=_[_0xb27e('0x29')](_0x377d79,_0xb27e('0x26'));_0x42c5de[_0xb27e('0x30')]=_['keys'](_0x35169a['query']);_0x42c5de[_0xb27e('0x31')]=_['intersection'](_0x42c5de[_0xb27e('0x2f')],_0x42c5de['query']);_0x125c0b[_0xb27e('0x32')]=_[_0xb27e('0x33')](_0x42c5de[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x35169a[_0xb27e('0x30')][_0xb27e('0x34')]));_0x125c0b['attributes']=_0x125c0b[_0xb27e('0x32')]['length']?_0x125c0b[_0xb27e('0x32')]:_0x42c5de['model'];if(!_0x35169a[_0xb27e('0x30')]['hasOwnProperty'](_0xb27e('0x35'))){_0x125c0b[_0xb27e('0x1d')]=qs['limit'](_0x35169a['query'][_0xb27e('0x1d')]);_0x125c0b['offset']=qs['offset'](_0x35169a['query'][_0xb27e('0x1b')]);}_0x125c0b[_0xb27e('0x36')]=qs['sort'](_0x35169a[_0xb27e('0x30')][_0xb27e('0x37')]);_0x125c0b['where']=qs['filters'](_[_0xb27e('0x38')](_0x35169a['query'],_0x42c5de[_0xb27e('0x31')]),_0x377d79);if(_0x35169a['query'][_0xb27e('0x39')]){_0x125c0b[_0xb27e('0x3a')]=_[_0xb27e('0x3b')](_0x125c0b[_0xb27e('0x3a')],{'$or':_[_0xb27e('0x29')](_0x377d79,function(_0x1239d4){if(_0x1239d4[_0xb27e('0x2d')]!==_0xb27e('0x3c')){var _0x533343={};_0x533343[_0x1239d4[_0xb27e('0x26')]]={'$like':'%'+_0x35169a[_0xb27e('0x30')][_0xb27e('0x39')]+'%'};return _0x533343;}})});}_0x125c0b=_[_0xb27e('0x3b')]({},_0x125c0b,_0x35169a[_0xb27e('0x3d')]);var _0x564699={'where':_0x125c0b['where']};return db[_0xb27e('0x2a')][_0xb27e('0x1e')](_0x564699)[_0xb27e('0x24')](function(_0x5c7742){_0x4ef0e6[_0xb27e('0x1e')]=_0x5c7742;if(_0x35169a[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x125c0b[_0xb27e('0x3f')]=[{'all':!![]}];}return db[_0xb27e('0x2a')][_0xb27e('0x40')](_0x125c0b);})[_0xb27e('0x24')](function(_0x4d90bf){_0x4ef0e6['rows']=_0x4d90bf;return _0x4ef0e6;})[_0xb27e('0x24')](respondWithFilteredResult(_0xd27061,_0x125c0b))[_0xb27e('0x41')](handleError(_0xd27061,null));};exports[_0xb27e('0x42')]=function(_0x3272ba,_0x11fafd){var _0x42f5e3={'raw':!![],'where':{'id':_0x3272ba[_0xb27e('0x43')]['id']}},_0x2959f5={};_0x2959f5['model']=_[_0xb27e('0x44')](db[_0xb27e('0x2a')][_0xb27e('0x2b')]);_0x2959f5[_0xb27e('0x30')]=_['keys'](_0x3272ba[_0xb27e('0x30')]);_0x2959f5['filters']=_['intersection'](_0x2959f5[_0xb27e('0x2f')],_0x2959f5[_0xb27e('0x30')]);_0x42f5e3['attributes']=_[_0xb27e('0x33')](_0x2959f5[_0xb27e('0x2f')],qs[_0xb27e('0x34')](_0x3272ba[_0xb27e('0x30')][_0xb27e('0x34')]));_0x42f5e3[_0xb27e('0x32')]=_0x42f5e3[_0xb27e('0x32')]['length']?_0x42f5e3[_0xb27e('0x32')]:_0x2959f5['model'];if(_0x3272ba[_0xb27e('0x30')][_0xb27e('0x3e')]){_0x42f5e3[_0xb27e('0x3f')]=[{'all':!![]}];}_0x42f5e3=_[_0xb27e('0x3b')]({},_0x42f5e3,_0x3272ba[_0xb27e('0x3d')]);return db[_0xb27e('0x2a')]['find'](_0x42f5e3)['then'](handleEntityNotFound(_0x11fafd,null))[_0xb27e('0x24')](respondWithResult(_0x11fafd,null))[_0xb27e('0x41')](handleError(_0x11fafd,null));};exports[_0xb27e('0x45')]=function(_0x15b5cb,_0x238bb9){return db['DeskField'][_0xb27e('0x45')](_0x15b5cb[_0xb27e('0x46')],{})[_0xb27e('0x24')](respondWithResult(_0x238bb9,0xc9))[_0xb27e('0x41')](handleError(_0x238bb9,null));};exports[_0xb27e('0x22')]=function(_0x16a71b,_0x320b9c){if(_0x16a71b[_0xb27e('0x46')]['id']){delete _0x16a71b[_0xb27e('0x46')]['id'];}return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x16a71b['params']['id']}})[_0xb27e('0x24')](handleEntityNotFound(_0x320b9c,null))['then'](saveUpdates(_0x16a71b[_0xb27e('0x46')],null))[_0xb27e('0x24')](respondWithResult(_0x320b9c,null))[_0xb27e('0x41')](handleError(_0x320b9c,null));};exports[_0xb27e('0x23')]=function(_0x91095,_0x1af27d){return db[_0xb27e('0x2a')][_0xb27e('0x47')]({'where':{'id':_0x91095['params']['id']}})['then'](handleEntityNotFound(_0x1af27d,null))[_0xb27e('0x24')](removeEntity(_0x1af27d,null))[_0xb27e('0x41')](handleError(_0x1af27d,null));}; \ No newline at end of file +var _0x867e=['show','params','rawAttributes','length','options','find','create','body','catch','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','map','DeskField','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows'];(function(_0x433e54,_0x2d6cb2){var _0x17d995=function(_0x105e8a){while(--_0x105e8a){_0x433e54['push'](_0x433e54['shift']());}};_0x17d995(++_0x2d6cb2);}(_0x867e,0x1c5));var _0xe867=function(_0x482b0e,_0x4ca281){_0x482b0e=_0x482b0e-0x0;var _0x4ec637=_0x867e[_0x482b0e];return _0x4ec637;};'use strict';var emlformat=require(_0xe867('0x0'));var rimraf=require(_0xe867('0x1'));var zipdir=require(_0xe867('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe867('0x3'));var moment=require('moment');var BPromise=require(_0xe867('0x4'));var Mustache=require('mustache');var util=require(_0xe867('0x5'));var path=require(_0xe867('0x6'));var sox=require(_0xe867('0x7'));var csv=require(_0xe867('0x8'));var ejs=require(_0xe867('0x9'));var fs=require('fs');var fs_extra=require(_0xe867('0xa'));var _=require(_0xe867('0xb'));var squel=require(_0xe867('0xc'));var crypto=require(_0xe867('0xd'));var jsforce=require(_0xe867('0xe'));var deskjs=require(_0xe867('0xf'));var toCsv=require(_0xe867('0x8'));var querystring=require(_0xe867('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe867('0x11'));var as=require(_0xe867('0x12'));var hardwareService=require(_0xe867('0x13'));var logger=require(_0xe867('0x14'))(_0xe867('0x15'));var utils=require(_0xe867('0x16'));var config=require(_0xe867('0x17'));var licenseUtil=require(_0xe867('0x18'));var db=require(_0xe867('0x19'))['db'];function respondWithStatusCode(_0x7d193,_0x2d0fcf){_0x2d0fcf=_0x2d0fcf||0xcc;return function(_0x3faaf8){if(_0x3faaf8){return _0x7d193[_0xe867('0x1a')](_0x2d0fcf);}return _0x7d193[_0xe867('0x1b')](_0x2d0fcf)['end']();};}function respondWithResult(_0x4faff7,_0x773113){_0x773113=_0x773113||0xc8;return function(_0x321848){if(_0x321848){return _0x4faff7['status'](_0x773113)[_0xe867('0x1c')](_0x321848);}};}function respondWithFilteredResult(_0x92abf0,_0x559881){return function(_0x477147){if(_0x477147){var _0x5a3325=typeof _0x559881[_0xe867('0x1d')]==='undefined'&&typeof _0x559881[_0xe867('0x1e')]===_0xe867('0x1f');var _0x3a45bb=_0x477147[_0xe867('0x20')];var _0x455aae=_0x5a3325?0x0:_0x559881['offset'];var _0x54c971=_0x5a3325?_0x477147['count']:_0x559881[_0xe867('0x1d')]+_0x559881['limit'];var _0x2128f9;if(_0x54c971>=_0x3a45bb){_0x54c971=_0x3a45bb;_0x2128f9=0xc8;}else{_0x2128f9=0xce;}_0x92abf0[_0xe867('0x1b')](_0x2128f9);return _0x92abf0[_0xe867('0x21')](_0xe867('0x22'),_0x455aae+'-'+_0x54c971+'/'+_0x3a45bb)[_0xe867('0x1c')](_0x477147);}return null;};}function patchUpdates(_0x2f9034){return function(_0x3c5d85){try{jsonpatch[_0xe867('0x23')](_0x3c5d85,_0x2f9034,!![]);}catch(_0x5aeda6){return BPromise[_0xe867('0x24')](_0x5aeda6);}return _0x3c5d85['save']();};}function saveUpdates(_0x573993,_0x138dec){return function(_0x120cb7){if(_0x120cb7){return _0x120cb7[_0xe867('0x25')](_0x573993)['then'](function(_0x491dd8){return _0x491dd8;});}return null;};}function removeEntity(_0x537c4d,_0x226e92){return function(_0x870c94){if(_0x870c94){return _0x870c94[_0xe867('0x26')]()[_0xe867('0x27')](function(){_0x537c4d[_0xe867('0x1b')](0xcc)[_0xe867('0x28')]();});}};}function handleEntityNotFound(_0x583c39,_0x21cd0a){return function(_0x110b2c){if(!_0x110b2c){_0x583c39[_0xe867('0x1a')](0x194);}return _0x110b2c;};}function handleError(_0x1674a3,_0x539b49){_0x539b49=_0x539b49||0x1f4;return function(_0x16d570){logger[_0xe867('0x29')](_0x16d570[_0xe867('0x2a')]);if(_0x16d570[_0xe867('0x2b')]){delete _0x16d570[_0xe867('0x2b')];}_0x1674a3[_0xe867('0x1b')](_0x539b49)[_0xe867('0x2c')](_0x16d570);};}exports['index']=function(_0x29c190,_0x41d7ae){var _0x214a80={},_0x3abcee={},_0xe210c={'count':0x0,'rows':[]};var _0xc269eb=_[_0xe867('0x2d')](db[_0xe867('0x2e')]['rawAttributes'],function(_0xe7d7c8){return{'name':_0xe7d7c8[_0xe867('0x2f')],'type':_0xe7d7c8[_0xe867('0x30')]['key']};});_0x3abcee[_0xe867('0x31')]=_[_0xe867('0x2d')](_0xc269eb,'name');_0x3abcee[_0xe867('0x32')]=_['keys'](_0x29c190['query']);_0x3abcee[_0xe867('0x33')]=_['intersection'](_0x3abcee[_0xe867('0x31')],_0x3abcee[_0xe867('0x32')]);_0x214a80['attributes']=_[_0xe867('0x34')](_0x3abcee[_0xe867('0x31')],qs['fields'](_0x29c190[_0xe867('0x32')][_0xe867('0x35')]));_0x214a80[_0xe867('0x36')]=_0x214a80[_0xe867('0x36')]['length']?_0x214a80[_0xe867('0x36')]:_0x3abcee['model'];if(!_0x29c190['query'][_0xe867('0x37')](_0xe867('0x38'))){_0x214a80['limit']=qs[_0xe867('0x1e')](_0x29c190[_0xe867('0x32')]['limit']);_0x214a80[_0xe867('0x1d')]=qs[_0xe867('0x1d')](_0x29c190[_0xe867('0x32')][_0xe867('0x1d')]);}_0x214a80['order']=qs[_0xe867('0x39')](_0x29c190[_0xe867('0x32')][_0xe867('0x39')]);_0x214a80[_0xe867('0x3a')]=qs[_0xe867('0x33')](_[_0xe867('0x3b')](_0x29c190[_0xe867('0x32')],_0x3abcee[_0xe867('0x33')]),_0xc269eb);if(_0x29c190['query']['filter']){_0x214a80[_0xe867('0x3a')]=_[_0xe867('0x3c')](_0x214a80[_0xe867('0x3a')],{'$or':_['map'](_0xc269eb,function(_0x25a06f){if(_0x25a06f[_0xe867('0x30')]!==_0xe867('0x3d')){var _0x71dc31={};_0x71dc31[_0x25a06f[_0xe867('0x2b')]]={'$like':'%'+_0x29c190[_0xe867('0x32')]['filter']+'%'};return _0x71dc31;}})});}_0x214a80=_[_0xe867('0x3c')]({},_0x214a80,_0x29c190['options']);var _0x5406be={'where':_0x214a80[_0xe867('0x3a')]};return db[_0xe867('0x2e')][_0xe867('0x20')](_0x5406be)[_0xe867('0x27')](function(_0x48a61a){_0xe210c['count']=_0x48a61a;if(_0x29c190[_0xe867('0x32')][_0xe867('0x3e')]){_0x214a80[_0xe867('0x3f')]=[{'all':!![]}];}return db[_0xe867('0x2e')]['findAll'](_0x214a80);})['then'](function(_0x15e056){_0xe210c[_0xe867('0x40')]=_0x15e056;return _0xe210c;})[_0xe867('0x27')](respondWithFilteredResult(_0x41d7ae,_0x214a80))['catch'](handleError(_0x41d7ae,null));};exports[_0xe867('0x41')]=function(_0x371f3e,_0x1e2df1){var _0x3a6c93={'raw':!![],'where':{'id':_0x371f3e[_0xe867('0x42')]['id']}},_0x2a4fca={};_0x2a4fca[_0xe867('0x31')]=_['keys'](db[_0xe867('0x2e')][_0xe867('0x43')]);_0x2a4fca[_0xe867('0x32')]=_['keys'](_0x371f3e[_0xe867('0x32')]);_0x2a4fca['filters']=_['intersection'](_0x2a4fca['model'],_0x2a4fca[_0xe867('0x32')]);_0x3a6c93[_0xe867('0x36')]=_[_0xe867('0x34')](_0x2a4fca[_0xe867('0x31')],qs[_0xe867('0x35')](_0x371f3e[_0xe867('0x32')]['fields']));_0x3a6c93[_0xe867('0x36')]=_0x3a6c93[_0xe867('0x36')][_0xe867('0x44')]?_0x3a6c93[_0xe867('0x36')]:_0x2a4fca['model'];if(_0x371f3e[_0xe867('0x32')][_0xe867('0x3e')]){_0x3a6c93[_0xe867('0x3f')]=[{'all':!![]}];}_0x3a6c93=_['merge']({},_0x3a6c93,_0x371f3e[_0xe867('0x45')]);return db['DeskField'][_0xe867('0x46')](_0x3a6c93)[_0xe867('0x27')](handleEntityNotFound(_0x1e2df1,null))['then'](respondWithResult(_0x1e2df1,null))['catch'](handleError(_0x1e2df1,null));};exports[_0xe867('0x47')]=function(_0x43e6fc,_0x3073e5){return db['DeskField']['create'](_0x43e6fc[_0xe867('0x48')],{})[_0xe867('0x27')](respondWithResult(_0x3073e5,0xc9))[_0xe867('0x49')](handleError(_0x3073e5,null));};exports[_0xe867('0x25')]=function(_0x132bb1,_0x50c442){if(_0x132bb1[_0xe867('0x48')]['id']){delete _0x132bb1[_0xe867('0x48')]['id'];}return db['DeskField'][_0xe867('0x46')]({'where':{'id':_0x132bb1[_0xe867('0x42')]['id']}})[_0xe867('0x27')](handleEntityNotFound(_0x50c442,null))[_0xe867('0x27')](saveUpdates(_0x132bb1[_0xe867('0x48')],null))[_0xe867('0x27')](respondWithResult(_0x50c442,null))[_0xe867('0x49')](handleError(_0x50c442,null));};exports['destroy']=function(_0x236fb4,_0x13be21){return db[_0xe867('0x2e')][_0xe867('0x46')]({'where':{'id':_0x236fb4[_0xe867('0x42')]['id']}})[_0xe867('0x27')](handleEntityNotFound(_0x13be21,null))[_0xe867('0x27')](removeEntity(_0x13be21,null))[_0xe867('0x49')](handleError(_0x13be21,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 769fb8d..cb30ded 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 _0xfce2=['rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','util','api','request-promise','path'];(function(_0xe9eaa1,_0x4ee443){var _0x1ad730=function(_0x3e0d5a){while(--_0x3e0d5a){_0xe9eaa1['push'](_0xe9eaa1['shift']());}};_0x1ad730(++_0x4ee443);}(_0xfce2,0x170));var _0x2fce=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfce2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2fce('0x0'));var logger=require('../../config/logger')(_0x2fce('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2fce('0x2'));var fs=require('fs');var path=require(_0x2fce('0x3'));var rimraf=require(_0x2fce('0x4'));var config=require(_0x2fce('0x5'));var attributes=require('./intDeskField.attributes');module[_0x2fce('0x6')]=function(_0x4e3808,_0x87cd59){return _0x4e3808[_0x2fce('0x7')](_0x2fce('0x8'),attributes,{'tableName':_0x2fce('0x9'),'paranoid':![],'indexes':[{'name':_0x2fce('0xa'),'fields':[_0x2fce('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x71d6=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId'];(function(_0x280ccf,_0x2697de){var _0x400051=function(_0xe68a04){while(--_0xe68a04){_0x280ccf['push'](_0x280ccf['shift']());}};_0x400051(++_0x2697de);}(_0x71d6,0x78));var _0x671d=function(_0x41ca2d,_0x409995){_0x41ca2d=_0x41ca2d-0x0;var _0x4b9a7f=_0x71d6[_0x41ca2d];return _0x4b9a7f;};'use strict';var _=require(_0x671d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x671d('0x1'));var BPromise=require(_0x671d('0x2'));var rp=require(_0x671d('0x3'));var fs=require('fs');var path=require(_0x671d('0x4'));var rimraf=require(_0x671d('0x5'));var config=require(_0x671d('0x6'));var attributes=require(_0x671d('0x7'));module[_0x671d('0x8')]=function(_0x538b16,_0x5834db){return _0x538b16[_0x671d('0x9')](_0x671d('0xa'),attributes,{'tableName':_0x671d('0xb'),'paranoid':![],'indexes':[{'name':_0x671d('0xc'),'fields':[_0x671d('0xd'),_0x671d('0xe')],'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 f7ab34b..479b68e 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 _0xc938=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x12e4fc,_0xf01a75){var _0x197c91=function(_0x3922bb){while(--_0x3922bb){_0x12e4fc['push'](_0x12e4fc['shift']());}};_0x197c91(++_0xf01a75);}(_0xc938,0x1e8));var _0x8c93=function(_0x2f778e,_0xa79f72){_0x2f778e=_0x2f778e-0x0;var _0x5d543b=_0xc938[_0x2f778e];return _0x5d543b;};'use strict';var _=require(_0x8c93('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c93('0x1'));var db=require(_0x8c93('0x2'))['db'];var utils=require(_0x8c93('0x3'));var logger=require(_0x8c93('0x4'))('rpc');var config=require(_0x8c93('0x5'));var jayson=require(_0x8c93('0x6'));var client=jayson[_0x8c93('0x7')][_0x8c93('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38a467,_0x2a4861,_0x4693d3){return new BPromise(function(_0x54b241,_0x40c1d1){return client[_0x8c93('0x9')](_0x38a467,_0x4693d3)[_0x8c93('0xa')](function(_0x4a9aa1){logger[_0x8c93('0xb')](_0x8c93('0xc'),_0x2a4861,_0x8c93('0xd'));logger['debug'](_0x8c93('0xe'),_0x2a4861,'request\x20sent',JSON['stringify'](_0x4a9aa1));if(_0x4a9aa1[_0x8c93('0xf')]){if(_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x10')]===0x1f4){logger[_0x8c93('0xf')]('DeskField,\x20%s,\x20%s',_0x2a4861,_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);return _0x40c1d1(_0x4a9aa1['error']['message']);}logger[_0x8c93('0xf')](_0x8c93('0xc'),_0x2a4861,_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);return _0x54b241(_0x4a9aa1[_0x8c93('0xf')][_0x8c93('0x11')]);}else{logger['info'](_0x8c93('0xc'),_0x2a4861,_0x8c93('0xd'));_0x54b241(_0x4a9aa1[_0x8c93('0x12')][_0x8c93('0x11')]);}})[_0x8c93('0x13')](function(_0x19e100){logger[_0x8c93('0xf')](_0x8c93('0xc'),_0x2a4861,_0x19e100);_0x40c1d1(_0x19e100);});});} \ No newline at end of file +var _0xf239=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskField,\x20%s,\x20%s','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x7d9557,_0x2d6000){var _0x207a60=function(_0x489d7c){while(--_0x489d7c){_0x7d9557['push'](_0x7d9557['shift']());}};_0x207a60(++_0x2d6000);}(_0xf239,0x176));var _0x9f23=function(_0x29d351,_0x3a8f7b){_0x29d351=_0x29d351-0x0;var _0x23eba0=_0xf239[_0x29d351];return _0x23eba0;};'use strict';var _=require(_0x9f23('0x0'));var util=require(_0x9f23('0x1'));var moment=require(_0x9f23('0x2'));var BPromise=require(_0x9f23('0x3'));var rs=require(_0x9f23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9f23('0x5'))['db'];var utils=require(_0x9f23('0x6'));var logger=require(_0x9f23('0x7'))(_0x9f23('0x8'));var config=require(_0x9f23('0x9'));var jayson=require(_0x9f23('0xa'));var client=jayson[_0x9f23('0xb')][_0x9f23('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x46ae17,_0x5151db,_0x5bc703){return new BPromise(function(_0x5c6f71,_0x5a2f4d){return client[_0x9f23('0xd')](_0x46ae17,_0x5bc703)[_0x9f23('0xe')](function(_0x3ef677){logger[_0x9f23('0xf')](_0x9f23('0x10'),_0x5151db,'request\x20sent');logger['debug'](_0x9f23('0x11'),_0x5151db,_0x9f23('0x12'),JSON[_0x9f23('0x13')](_0x3ef677));if(_0x3ef677[_0x9f23('0x14')]){if(_0x3ef677[_0x9f23('0x14')][_0x9f23('0x15')]===0x1f4){logger[_0x9f23('0x14')](_0x9f23('0x10'),_0x5151db,_0x3ef677[_0x9f23('0x14')]['message']);return _0x5a2f4d(_0x3ef677['error']['message']);}logger[_0x9f23('0x14')](_0x9f23('0x10'),_0x5151db,_0x3ef677['error'][_0x9f23('0x16')]);return _0x5c6f71(_0x3ef677['error']['message']);}else{logger[_0x9f23('0xf')](_0x9f23('0x10'),_0x5151db,_0x9f23('0x12'));_0x5c6f71(_0x3ef677[_0x9f23('0x17')][_0x9f23('0x16')]);}})[_0x9f23('0x18')](function(_0x49a439){logger[_0x9f23('0x14')](_0x9f23('0x10'),_0x5151db,_0x49a439);_0x5a2f4d(_0x49a439);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9cf26bc..599362e 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 _0xaaca=['getConfigurations','getFields','create','/:id/configurations','addConfiguration','put','/:id','delete','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','show'];(function(_0x40e6fd,_0x4fe514){var _0x5d02e3=function(_0x3e52bc){while(--_0x3e52bc){_0x40e6fd['push'](_0x40e6fd['shift']());}};_0x5d02e3(++_0x4fe514);}(_0xaaca,0x7a));var _0xaaac=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xaaca[_0x256b72];return _0x2183e3;};'use strict';var multer=require(_0xaaac('0x0'));var util=require(_0xaaac('0x1'));var path=require(_0xaaac('0x2'));var timeout=require(_0xaaac('0x3'));var express=require('express');var router=express[_0xaaac('0x4')]();var fs_extra=require(_0xaaac('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xaaac('0x6'));var controller=require(_0xaaac('0x7'));router[_0xaaac('0x8')]('/',auth[_0xaaac('0x9')](),controller['index']);router[_0xaaac('0x8')]('/:id',auth[_0xaaac('0x9')](),controller[_0xaaac('0xa')]);router[_0xaaac('0x8')]('/:id/configurations',auth[_0xaaac('0x9')](),controller[_0xaaac('0xb')]);router[_0xaaac('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xaaac('0xc')]);router['post']('/',auth[_0xaaac('0x9')](),controller[_0xaaac('0xd')]);router['post'](_0xaaac('0xe'),auth[_0xaaac('0x9')](),controller[_0xaaac('0xf')]);router[_0xaaac('0x10')](_0xaaac('0x11'),auth[_0xaaac('0x9')](),controller['update']);router[_0xaaac('0x12')]('/:id',auth[_0xaaac('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc956=['delete','destroy','exports','multer','util','path','Router','fs-extra','./intDynamics365Account.controller','get','/:id','isAuthenticated','show','post','create','/:id/configurations','addConfiguration'];(function(_0x5e8c0f,_0x1f20d9){var _0x568dbe=function(_0xdc6797){while(--_0xdc6797){_0x5e8c0f['push'](_0x5e8c0f['shift']());}};_0x568dbe(++_0x1f20d9);}(_0xc956,0xf1));var _0x6c95=function(_0x1f8145,_0x5df757){_0x1f8145=_0x1f8145-0x0;var _0x458be4=_0xc956[_0x1f8145];return _0x458be4;};'use strict';var multer=require(_0x6c95('0x0'));var util=require(_0x6c95('0x1'));var path=require(_0x6c95('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c95('0x3')]();var fs_extra=require(_0x6c95('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6c95('0x5'));router[_0x6c95('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6c95('0x6')](_0x6c95('0x7'),auth[_0x6c95('0x8')](),controller[_0x6c95('0x9')]);router[_0x6c95('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x6c95('0x6')]('/:id/fields',auth[_0x6c95('0x8')](),controller['getFields']);router[_0x6c95('0xa')]('/',auth['isAuthenticated'](),controller[_0x6c95('0xb')]);router['post'](_0x6c95('0xc'),auth[_0x6c95('0x8')](),controller[_0x6c95('0xd')]);router['put'](_0x6c95('0x7'),auth[_0x6c95('0x8')](),controller['update']);router[_0x6c95('0xe')](_0x6c95('0x7'),auth[_0x6c95('0x8')](),controller[_0x6c95('0xf')]);module[_0x6c95('0x10')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index d60326f..22ad936 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 _0x02a7=['exports','STRING'];(function(_0x3080a7,_0x2f289f){var _0x45a8cd=function(_0x31424c){while(--_0x31424c){_0x3080a7['push'](_0x3080a7['shift']());}};_0x45a8cd(++_0x2f289f);}(_0x02a7,0x7a));var _0x702a=function(_0x4a025c,_0x267821){_0x4a025c=_0x4a025c-0x0;var _0x5e22bc=_0x02a7[_0x4a025c];return _0x5e22bc;};'use strict';var Sequelize=require('sequelize');module[_0x702a('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x702a('0x1')]},'remoteUri':{'type':Sequelize[_0x702a('0x1')]},'tenantId':{'type':Sequelize[_0x702a('0x1')]},'clientId':{'type':Sequelize[_0x702a('0x1')]},'clientSecret':{'type':Sequelize[_0x702a('0x1')]},'serverUrl':{'type':Sequelize[_0x702a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x702a('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x38d3=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3f3449,_0x338e75){var _0x35de7d=function(_0x44bd3c){while(--_0x44bd3c){_0x3f3449['push'](_0x3f3449['shift']());}};_0x35de7d(++_0x338e75);}(_0x38d3,0x1a7));var _0x338d=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x38d3[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require(_0x338d('0x0'));module[_0x338d('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x338d('0x2')]},'password':{'type':Sequelize[_0x338d('0x2')]},'remoteUri':{'type':Sequelize[_0x338d('0x2')]},'tenantId':{'type':Sequelize[_0x338d('0x2')]},'clientId':{'type':Sequelize[_0x338d('0x2')]},'clientSecret':{'type':Sequelize[_0x338d('0x2')]},'serverUrl':{'type':Sequelize[_0x338d('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x338d('0x2')]},'modernAuthentication':{'type':Sequelize[_0x338d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 564ff7d..b9b8e4f 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 _0x9605=['LogicalName','@odata.type','push','forEach','isNil','lastIndexOf','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','all','stack','test','statusCode','EntityDefinitions(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','offset','undefined','limit','count','set','Content-Range','update','then','destroy','status','end','sendStatus','error','name','send','index','map','Dynamics365Account','rawAttributes','type','model','keys','query','filters','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','catch','show','params','attributes','length','include','find','create','body','getConfigurations','findOne','Dynamics365Configuration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','Dynamics365Field','Descriptions','slice','substring','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridname','owneridtype','owneridyominame','prioritycodename','productidname','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','POST','https://login.microsoftonline.com/','clientId','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','GET',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove'];(function(_0x2c204a,_0x119aa9){var _0xf68ab1=function(_0x1a577b){while(--_0x1a577b){_0x2c204a['push'](_0x2c204a['shift']());}};_0xf68ab1(++_0x119aa9);}(_0x9605,0xde));var _0x5960=function(_0x51cad1,_0xc442a9){_0x51cad1=_0x51cad1-0x0;var _0xc15112=_0x9605[_0x51cad1];return _0xc15112;};'use strict';var rp=require(_0x5960('0x0'));var util=require('util');var _=require(_0x5960('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0x5960('0x2'))(_0x5960('0x3'));var db=require(_0x5960('0x4'))['db'];var integrations=require(_0x5960('0x5'));function respondWithResult(_0x286106,_0x1c3190){_0x1c3190=_0x1c3190||0xc8;return function(_0x2fdc45){if(_0x2fdc45){return _0x286106['status'](_0x1c3190)['json'](_0x2fdc45);}};}function respondWithFilteredResult(_0x1e4248,_0x32486a){return function(_0x1bf847){if(_0x1bf847){var _0x490020=typeof _0x32486a[_0x5960('0x6')]===_0x5960('0x7')&&typeof _0x32486a[_0x5960('0x8')]===_0x5960('0x7');var _0x5eaba4=_0x1bf847['count'];var _0x31707d=_0x490020?0x0:_0x32486a[_0x5960('0x6')];var _0x3c7721=_0x490020?_0x1bf847[_0x5960('0x9')]:_0x32486a[_0x5960('0x6')]+_0x32486a[_0x5960('0x8')];var _0x1ce678;if(_0x3c7721>=_0x5eaba4){_0x3c7721=_0x5eaba4;_0x1ce678=0xc8;}else{_0x1ce678=0xce;}_0x1e4248['status'](_0x1ce678);return _0x1e4248[_0x5960('0xa')](_0x5960('0xb'),_0x31707d+'-'+_0x3c7721+'/'+_0x5eaba4)['json'](_0x1bf847);}return null;};}function saveUpdates(_0x38ea99){return function(_0x5dcd23){if(_0x5dcd23){return _0x5dcd23[_0x5960('0xc')](_0x38ea99)[_0x5960('0xd')](function(_0x1ae76a){return _0x1ae76a;});}return null;};}function removeEntity(_0x178e72){return function(_0x2c35e9){if(_0x2c35e9){return _0x2c35e9[_0x5960('0xe')]()['then'](function(){_0x178e72[_0x5960('0xf')](0xcc)[_0x5960('0x10')]();});}};}function handleEntityNotFound(_0x561a6a){return function(_0x1b2241){if(!_0x1b2241){_0x561a6a[_0x5960('0x11')](0x194);}return _0x1b2241;};}function handleError(_0x502d53,_0x39fa32){_0x39fa32=_0x39fa32||0x1f4;return function(_0x2e161d){logger[_0x5960('0x12')](_0x2e161d['stack']);if(_0x2e161d[_0x5960('0x13')]){delete _0x2e161d[_0x5960('0x13')];}_0x502d53[_0x5960('0xf')](_0x39fa32)[_0x5960('0x14')](_0x2e161d);};}exports[_0x5960('0x15')]=function(_0x281cf7,_0x21aca6){var _0x866af1={},_0x570114={},_0x4f3215={'count':0x0,'rows':[]};var _0xf76b0b=_[_0x5960('0x16')](db[_0x5960('0x17')][_0x5960('0x18')],function(_0x33a6df){return{'name':_0x33a6df['fieldName'],'type':_0x33a6df[_0x5960('0x19')]['key']};});_0x570114[_0x5960('0x1a')]=_['map'](_0xf76b0b,'name');_0x570114['query']=_[_0x5960('0x1b')](_0x281cf7[_0x5960('0x1c')]);_0x570114[_0x5960('0x1d')]=_[_0x5960('0x1e')](_0x570114['model'],_0x570114[_0x5960('0x1c')]);_0x866af1['attributes']=_[_0x5960('0x1e')](_0x570114['model'],qs[_0x5960('0x1f')](_0x281cf7[_0x5960('0x1c')][_0x5960('0x1f')]));_0x866af1['attributes']=_0x866af1['attributes']['length']?_0x866af1['attributes']:_0x570114[_0x5960('0x1a')];if(!_0x281cf7[_0x5960('0x1c')][_0x5960('0x20')](_0x5960('0x21'))){_0x866af1[_0x5960('0x8')]=qs[_0x5960('0x8')](_0x281cf7['query']['limit']);_0x866af1[_0x5960('0x6')]=qs['offset'](_0x281cf7[_0x5960('0x1c')][_0x5960('0x6')]);}_0x866af1[_0x5960('0x22')]=qs[_0x5960('0x23')](_0x281cf7[_0x5960('0x1c')][_0x5960('0x23')]);_0x866af1[_0x5960('0x24')]=qs['filters'](_[_0x5960('0x25')](_0x281cf7[_0x5960('0x1c')],_0x570114[_0x5960('0x1d')]),_0xf76b0b);if(_0x281cf7[_0x5960('0x1c')]['filter']){_0x866af1[_0x5960('0x24')]=_[_0x5960('0x26')](_0x866af1[_0x5960('0x24')],{'$or':_[_0x5960('0x16')](_0xf76b0b,function(_0x45bba0){if(_0x45bba0[_0x5960('0x19')]!=='VIRTUAL'){var _0x448b2a={};_0x448b2a[_0x45bba0['name']]={'$like':'%'+_0x281cf7[_0x5960('0x1c')][_0x5960('0x27')]+'%'};return _0x448b2a;}})});}_0x866af1=_[_0x5960('0x26')]({},_0x866af1,_0x281cf7[_0x5960('0x28')]);var _0x488880={'where':_0x866af1[_0x5960('0x24')]};return db['Dynamics365Account']['count'](_0x488880)[_0x5960('0xd')](function(_0x5ac8a){_0x4f3215['count']=_0x5ac8a;if(_0x281cf7['query'][_0x5960('0x29')]){_0x866af1['include']=[{'all':!![]}];}return db[_0x5960('0x17')]['findAll'](_0x866af1);})[_0x5960('0xd')](function(_0x44b32d){_0x4f3215['rows']=_0x44b32d;return _0x4f3215;})[_0x5960('0xd')](respondWithFilteredResult(_0x21aca6,_0x866af1))[_0x5960('0x2a')](handleError(_0x21aca6,null));};exports[_0x5960('0x2b')]=function(_0xf61eda,_0x51e00e){var _0x27f291={'raw':![],'where':{'id':_0xf61eda[_0x5960('0x2c')]['id']}},_0x3d257d={};_0x3d257d['model']=_[_0x5960('0x1b')](db[_0x5960('0x17')][_0x5960('0x18')]);_0x3d257d[_0x5960('0x1c')]=_[_0x5960('0x1b')](_0xf61eda[_0x5960('0x1c')]);_0x3d257d[_0x5960('0x1d')]=_[_0x5960('0x1e')](_0x3d257d['model'],_0x3d257d['query']);_0x27f291['attributes']=_[_0x5960('0x1e')](_0x3d257d[_0x5960('0x1a')],qs[_0x5960('0x1f')](_0xf61eda[_0x5960('0x1c')]['fields']));_0x27f291[_0x5960('0x2d')]=_0x27f291['attributes'][_0x5960('0x2e')]?_0x27f291[_0x5960('0x2d')]:_0x3d257d['model'];if(_0xf61eda['query'][_0x5960('0x29')]){_0x27f291[_0x5960('0x2f')]=[{'all':!![]}];}_0x27f291=_[_0x5960('0x26')]({},_0x27f291,_0xf61eda[_0x5960('0x28')]);return db[_0x5960('0x17')][_0x5960('0x30')](_0x27f291)['then'](handleEntityNotFound(_0x51e00e,null))[_0x5960('0xd')](respondWithResult(_0x51e00e,null))[_0x5960('0x2a')](handleError(_0x51e00e,null));};exports[_0x5960('0x31')]=function(_0x5e07e0,_0x19748a){return db[_0x5960('0x17')][_0x5960('0x31')](_0x5e07e0[_0x5960('0x32')],{})[_0x5960('0xd')](respondWithResult(_0x19748a,0xc9))[_0x5960('0x2a')](handleError(_0x19748a,null));};exports[_0x5960('0xc')]=function(_0x2523da,_0x47e650){if(_0x2523da[_0x5960('0x32')]['id']){delete _0x2523da['body']['id'];}return db[_0x5960('0x17')][_0x5960('0x30')]({'where':{'id':_0x2523da[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x47e650,null))['then'](saveUpdates(_0x2523da[_0x5960('0x32')],null))['then'](respondWithResult(_0x47e650,null))['catch'](handleError(_0x47e650,null));};exports['destroy']=function(_0x4cc277,_0x275532){return db[_0x5960('0x17')]['find']({'where':{'id':_0x4cc277[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x275532,null))[_0x5960('0xd')](removeEntity(_0x275532,null))['catch'](handleError(_0x275532,null));};exports[_0x5960('0x33')]=function(_0x3daeab,_0x296a04){var _0x265882={};var _0xf6015e={};var _0x2a76d3;var _0x46941b;return db[_0x5960('0x17')][_0x5960('0x34')]({'where':{'id':_0x3daeab[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x296a04,null))[_0x5960('0xd')](function(_0x174428){if(_0x174428){_0x2a76d3=_0x174428;_0xf6015e['model']=_[_0x5960('0x1b')](db[_0x5960('0x35')][_0x5960('0x18')]);_0xf6015e['query']=_['keys'](_0x3daeab[_0x5960('0x1c')]);_0xf6015e[_0x5960('0x1d')]=_['intersection'](_0xf6015e[_0x5960('0x1a')],_0xf6015e[_0x5960('0x1c')]);_0x265882['attributes']=_[_0x5960('0x1e')](_0xf6015e[_0x5960('0x1a')],qs['fields'](_0x3daeab[_0x5960('0x1c')][_0x5960('0x1f')]));_0x265882['attributes']=_0x265882[_0x5960('0x2d')][_0x5960('0x2e')]?_0x265882['attributes']:_0xf6015e['model'];_0x265882[_0x5960('0x22')]=qs[_0x5960('0x23')](_0x3daeab[_0x5960('0x1c')][_0x5960('0x23')]);_0x265882['where']=qs[_0x5960('0x1d')](_['pick'](_0x3daeab[_0x5960('0x1c')],_0xf6015e[_0x5960('0x1d')]));if(_0x3daeab['query'][_0x5960('0x27')]){_0x265882[_0x5960('0x24')]=_[_0x5960('0x26')](_0x265882[_0x5960('0x24')],{'$or':_[_0x5960('0x16')](_0x265882[_0x5960('0x2d')],function(_0x4afd2e){var _0x41b96a={};_0x41b96a[_0x4afd2e]={'$like':'%'+_0x3daeab[_0x5960('0x1c')]['filter']+'%'};return _0x41b96a;})});}_0x265882=_[_0x5960('0x26')]({},_0x265882,_0x3daeab[_0x5960('0x28')]);return _0x2a76d3[_0x5960('0x33')](_0x265882);}})[_0x5960('0xd')](function(_0x57473f){if(_0x57473f){_0x46941b=_0x57473f[_0x5960('0x2e')];if(!_0x3daeab[_0x5960('0x1c')]['hasOwnProperty'](_0x5960('0x21'))){_0x265882[_0x5960('0x8')]=qs[_0x5960('0x8')](_0x3daeab[_0x5960('0x1c')][_0x5960('0x8')]);_0x265882[_0x5960('0x6')]=qs['offset'](_0x3daeab[_0x5960('0x1c')][_0x5960('0x6')]);}return _0x2a76d3['getConfigurations'](_0x265882);}})[_0x5960('0xd')](function(_0x2ebbe2){if(_0x2ebbe2){return _0x2ebbe2?{'count':_0x46941b,'rows':_0x2ebbe2}:null;}})[_0x5960('0xd')](respondWithResult(_0x296a04,null))[_0x5960('0x2a')](handleError(_0x296a04,null));};exports[_0x5960('0x36')]=function(_0x2061e9,_0x3b69a9){if(_0x2061e9[_0x5960('0x32')]['id']){delete _0x2061e9[_0x5960('0x32')]['id'];}return db['Dynamics365Account'][_0x5960('0x34')]({'where':{'id':_0x2061e9[_0x5960('0x2c')]['id']}})[_0x5960('0xd')](handleEntityNotFound(_0x3b69a9,null))[_0x5960('0xd')](function(_0x3dc632){if(_0x3dc632){_0x2061e9[_0x5960('0x32')][_0x5960('0x37')]=_0x3dc632['id'];_0x2061e9[_0x5960('0x32')][_0x5960('0x38')]=integrations[_0x5960('0x39')](_0x2061e9[_0x5960('0x32')]['channel'],_0x2061e9[_0x5960('0x32')]['type']);_0x2061e9[_0x5960('0x32')]['Descriptions']=integrations[_0x5960('0x3a')](_0x2061e9[_0x5960('0x32')][_0x5960('0x3b')],_0x2061e9[_0x5960('0x32')][_0x5960('0x19')]);return db['Dynamics365Configuration'][_0x5960('0x31')](_0x2061e9['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x5960('0x38')},{'model':db[_0x5960('0x3c')],'as':_0x5960('0x3d')}]});}return null;})['then'](respondWithResult(_0x3b69a9,null))[_0x5960('0x2a')](handleError(_0x3b69a9,null));};function sanitizeRemoteUri(_0x43fb16){var _0xf4622c=_0x43fb16[_0x5960('0x3e')](-0x1);if(_0xf4622c==='/')return _0x43fb16[_0x5960('0x3f')](0x0,_0x43fb16['lastIndexOf'](_0xf4622c));return _0x43fb16;}function getWebApiUrl(_0x2816d1){return util['format'](_0x5960('0x40'),_0x2816d1);}exports[_0x5960('0x41')]=function(_0x4cd523,_0x39b9d9){var _0x5b158f=_0x4cd523['query']['ticketType'];var _0x4938c9=_0x5b158f==='incident'?_0x5960('0x42'):_0x5960('0x43');var _0x6940fa='';var _0x4c8268='';var _0x313cb9='';var _0x1bc10b='';var _0x492101='';var _0x25d7b9='';var _0x2613ba='';var _0x25d3e9='';var _0x15bd0b=[_0x5960('0x44'),_0x5960('0x45'),_0x5960('0x46'),_0x5960('0x47'),_0x5960('0x48'),'subject',_0x5960('0x49'),_0x5960('0x4a'),_0x5960('0x4b'),'phonecall_activity_parties'];var _0x2d8825=[_0x5960('0x4c'),_0x5960('0x4d'),_0x5960('0x4e'),'billedserviceunits',_0x5960('0x4f'),_0x5960('0x50'),_0x5960('0x51'),_0x5960('0x52'),'createdbyexternalpartyname',_0x5960('0x53'),'createdbyname',_0x5960('0x54'),'createdon',_0x5960('0x55'),_0x5960('0x56'),_0x5960('0x57'),_0x5960('0x58'),_0x5960('0x59'),_0x5960('0x5a'),_0x5960('0x5b'),_0x5960('0x5c'),'entityimage_url',_0x5960('0x5d'),_0x5960('0x5e'),_0x5960('0x5f'),_0x5960('0x60'),_0x5960('0x61'),_0x5960('0x62'),_0x5960('0x63'),'lastonholdtime',_0x5960('0x64'),_0x5960('0x65'),'modifiedbyexternalpartyyominame','modifiedbyname',_0x5960('0x66'),_0x5960('0x67'),_0x5960('0x68'),_0x5960('0x69'),_0x5960('0x6a'),_0x5960('0x6b'),_0x5960('0x6c'),'onholdtime',_0x5960('0x6d'),_0x5960('0x6e'),_0x5960('0x6f'),_0x5960('0x70'),'parentcaseidname','primarycontactidname','primarycontactidyominame',_0x5960('0x71'),_0x5960('0x72'),'productserialnumber','resolveby',_0x5960('0x73'),_0x5960('0x74'),_0x5960('0x75'),_0x5960('0x76'),'sentimentvalue',_0x5960('0x77'),_0x5960('0x78'),_0x5960('0x79'),'statecode',_0x5960('0x7a'),_0x5960('0x7b'),_0x5960('0x7c'),_0x5960('0x7d'),_0x5960('0x7e'),_0x5960('0x7f'),_0x5960('0x80'),_0x5960('0x81')];var _0x3da819=_0x15bd0b[_0x5960('0x82')](_0x2d8825);return db[_0x5960('0x17')][_0x5960('0x34')]({'where':{'id':_0x4cd523[_0x5960('0x2c')]['id']},'attributes':['id',_0x5960('0x83'),_0x5960('0x84'),_0x5960('0x85'),_0x5960('0x86'),'clientId',_0x5960('0x87'),_0x5960('0x88')],'include':[{'model':db[_0x5960('0x89')],'as':_0x5960('0x89'),'attributes':['id',_0x5960('0x8a'),_0x5960('0x8b')]}]})[_0x5960('0xd')](handleEntityNotFound(_0x39b9d9,null))[_0x5960('0xd')](function(_0x3202a7){if(_0x3202a7){if(_0x3202a7[_0x5960('0x88')]){_0x3202a7[_0x5960('0x8c')]=_0x3202a7['CloudProvider'][_0x5960('0x8a')];_0x25d3e9=sanitizeRemoteUri(_0x3202a7[_0x5960('0x89')][_0x5960('0x8b')]);_0x2613ba=getWebApiUrl(_0x25d3e9);return _0x3202a7;}_0x25d3e9=sanitizeRemoteUri(_0x3202a7[_0x5960('0x85')]);_0x2613ba=getWebApiUrl(_0x25d3e9);var _0x403048={'method':_0x5960('0x8d'),'uri':_0x5960('0x8e')+_0x3202a7[_0x5960('0x86')]+'/oauth2/token','form':{'client_id':_0x3202a7[_0x5960('0x8f')],'resource':_0x25d3e9,'username':_0x3202a7[_0x5960('0x83')],'password':_0x3202a7['password'],'grant_type':'password','client_secret':_0x3202a7[_0x5960('0x87')]},'json':!![]};return rp(_0x403048);}})[_0x5960('0xd')](function(_0x3ff2b6){_0x25d7b9=_0x3ff2b6['access_token'];var _0x29feea={'method':'GET','uri':encodeURI(_0x2613ba+_0x5960('0x90')+_0x4938c9+'\x27'),'headers':{'Authorization':_0x5960('0x91')+_0x25d7b9,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x29feea);})[_0x5960('0xd')](function(_0x4f241b){var _0x20f38a=_0x4f241b['value'][0x0];var _0x4e935f=_0x20f38a[_0x5960('0x93')];var _0x3a8641={'method':_0x5960('0x94'),'uri':_0x2613ba+'EntityDefinitions('+_0x4e935f+_0x5960('0x95'),'headers':{'Authorization':_0x5960('0x91')+_0x25d7b9,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x3a8641);})[_0x5960('0xd')](function(_0x46e201){_0x6940fa=_0x46e201;_0x4c8268=_0x6940fa[_0x5960('0x96')];_0x4c8268=_[_0x5960('0x97')](_0x4c8268,function(_0x19be07){return!_0x3da819['includes'](_0x19be07[_0x5960('0x98')]);});var _0x27b0ab=[];var _0x3b5748=[];_0x4c8268['forEach'](function(_0x2cbd02){if(_0x2cbd02['@odata.type']){var _0x2eee73=_0x2cbd02[_0x5960('0x99')]['substring'](_0x2cbd02['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2eee73==='PicklistAttributeMetadata'){_0x27b0ab[_0x5960('0x9a')](getSelectList(_0x2613ba,_0x5b158f,_0x3b5748,_0x6940fa[_0x5960('0x93')],_0x2cbd02['MetadataId'],_0x25d7b9));}}});return Promise['all'](_0x27b0ab);})[_0x5960('0xd')](function(_0x1c7108){_0x313cb9=_0x1c7108[0x0];var _0x1dacf2=[];var _0x21ed91=[];_0x4c8268[_0x5960('0x9b')](function(_0x4d6a27){if(!_[_0x5960('0x9c')](_0x4d6a27[_0x5960('0x99')])){var _0x4bd75c=_0x4d6a27['@odata.type'][_0x5960('0x3f')](_0x4d6a27[_0x5960('0x99')][_0x5960('0x9d')]('.')+0x1);if(_0x4bd75c===_0x5960('0x9e')){_0x1dacf2[_0x5960('0x9a')](getBooleanList(_0x2613ba,_0x5b158f,_0x21ed91,_0x6940fa['MetadataId'],_0x4d6a27[_0x5960('0x93')],_0x25d7b9));}}});return Promise['all'](_0x1dacf2);})['then'](function(_0x44cdf8){_0x1bc10b=_0x44cdf8[0x0];var _0x505ac2=[];var _0x537867=[];_0x4c8268[_0x5960('0x9b')](function(_0x3297fa){if(_0x3297fa[_0x5960('0x99')]){var _0x22536c=_0x3297fa[_0x5960('0x99')]['substring'](_0x3297fa[_0x5960('0x99')][_0x5960('0x9d')]('.')+0x1);if(_0x22536c===_0x5960('0x9f')||_0x22536c===_0x5960('0xa0')||_0x22536c===_0x5960('0xa1')||_0x22536c===_0x5960('0xa2')||_0x22536c===_0x5960('0xa3')||_0x22536c===_0x5960('0xa4')||_0x22536c===_0x5960('0xa5')||_0x22536c===_0x5960('0xa6')||_0x22536c==='StateAttributeMetadata'||_0x22536c===_0x5960('0xa7')){_0x505ac2[_0x5960('0x9a')](getInputList(_0x2613ba,_0x5b158f,_0x22536c,_0x537867,_0x6940fa['MetadataId'],_0x3297fa['MetadataId'],_0x25d7b9));}}});return Promise[_0x5960('0xa8')](_0x505ac2);})[_0x5960('0xd')](function(_0xa19a7){_0x492101=_0xa19a7[0x0];var _0x15f14c=_0x313cb9[_0x5960('0x82')](_0x1bc10b)[_0x5960('0x82')](_0x492101);var _0x52c10d={'count':_0x15f14c[_0x5960('0x2e')],'rows':_0x15f14c};return _0x52c10d;})[_0x5960('0xd')](respondWithResult(_0x39b9d9,null))[_0x5960('0x2a')](function(_0x42dde8){var _0x1e2f70=_0x4cd523[_0x5960('0x1c')]['test']?0x1f4:_0x42dde8['statusCode']||0x1f4;logger[_0x5960('0x12')](_0x42dde8[_0x5960('0xa9')]);delete _0x42dde8[_0x5960('0x13')];if(_0x1e2f70===0x191){_0x1e2f70=0x190;}_0x39b9d9[_0x5960('0xf')](_0x1e2f70)[_0x5960('0x14')](_0x4cd523[_0x5960('0x1c')][_0x5960('0xaa')]?{'message':'Wrong\x20credentials','statusCode':_0x42dde8[_0x5960('0xab')]}:_0x42dde8);});};function getSelectList(_0x5e109c,_0x539dec,_0x15d4be,_0x1c4dd4,_0x1d0b9d,_0x24ec45){var _0x36441c={'method':_0x5960('0x94'),'uri':_0x5e109c+_0x5960('0xac')+_0x1c4dd4+')/Attributes('+_0x1d0b9d+_0x5960('0xad')+_0x5960('0xae'),'headers':{'Authorization':_0x5960('0x91')+_0x24ec45,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x36441c)[_0x5960('0xd')](function(_0x489802){var _0x511b17=[];var _0x1ce1a7=_0x489802[_0x5960('0xaf')]['Options'];_0x1ce1a7[_0x5960('0x9b')](function(_0x49507b){_0x511b17[_0x5960('0x9a')]({'name':_0x49507b['Label']['UserLocalizedLabel'][_0x5960('0xb0')],'value':String(_0x49507b[_0x5960('0xb1')])});});var _0x12f907={'id':_0x539dec+'_'+_0x489802[_0x5960('0x98')],'name':_0x489802[_0x5960('0xb2')][_0x5960('0xb3')][_0x5960('0xb0')],'custom':![],'options':_0x511b17};_0x15d4be[_0x5960('0x9a')](_0x12f907);return _0x15d4be;});}function getBooleanList(_0x1f7005,_0x500fe3,_0x4edf14,_0x21346a,_0x13a3a6,_0x3b4ec6){var _0x4d4f25={'method':_0x5960('0x94'),'uri':_0x1f7005+_0x5960('0xac')+_0x21346a+_0x5960('0xb4')+_0x13a3a6+_0x5960('0xb5'),'headers':{'Authorization':_0x5960('0x91')+_0x3b4ec6,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x4d4f25)['then'](function(_0x2e7b4f){var _0x240158=[];_0x240158[_0x5960('0x9a')]({'name':_0x2e7b4f['OptionSet'][_0x5960('0xb6')][_0x5960('0xb0')][_0x5960('0xb3')]['Label'],'value':_0x5960('0xb7')},{'name':_0x2e7b4f[_0x5960('0xaf')][_0x5960('0xb8')]['Label'][_0x5960('0xb3')]['Label'],'value':'false'});var _0x722dcd={'id':_0x500fe3+'_'+_0x2e7b4f[_0x5960('0x98')],'name':_0x2e7b4f['DisplayName']['UserLocalizedLabel']['Label'],'custom':![],'options':_0x240158};_0x4edf14['push'](_0x722dcd);return _0x4edf14;});}function getInputList(_0xff5086,_0x4f8ec0,_0x33822d,_0x3738e8,_0x215624,_0xdc7e45,_0x3d43ec){var _0x179a62={'method':_0x5960('0x94'),'uri':_0xff5086+_0x5960('0xac')+_0x215624+_0x5960('0xb4')+_0xdc7e45+_0x5960('0xb9')+_0x33822d+_0x5960('0xba'),'headers':{'Authorization':_0x5960('0x91')+_0x3d43ec,'If-None-Match':null,'OData-Version':_0x5960('0x92')},'json':!![]};return rp(_0x179a62)[_0x5960('0xd')](function(_0x266b83){var _0x46af30={'id':_0x4f8ec0+'_'+_0x266b83['LogicalName'],'name':_0x266b83['DisplayName'][_0x5960('0xb3')]?_0x266b83[_0x5960('0xb2')]['UserLocalizedLabel'][_0x5960('0xb0')]:_0x266b83[_0x5960('0x98')],'custom':![],'options':[]};_0x3738e8[_0x5960('0x9a')](_0x46af30);return _0x3738e8;});} \ No newline at end of file +var _0xe7c3=['ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','versionnumber','concat','username','password','remoteUri','tenantId','clientSecret','modernAuthentication','CloudProvider','data5','access_token','data7','POST','https://login.microsoftonline.com/','clientId','GET','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','remove','includes','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','test','statusCode','send','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','api','status','json','offset','undefined','limit','set','Content-Range','then','destroy','sendStatus','error','stack','name','index','Dynamics365Account','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','where','filters','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','find','create','body','update','getConfigurations','findOne','Dynamics365Configuration','order','sort','options','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','incident','Incident','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','influencescore','kbarticleidname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','overriddencreatedon','owneridname','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productserialnumber','resolveby','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe7c3,0x1a8));var _0x3e7c=function(_0x1502ea,_0x42d4af){_0x1502ea=_0x1502ea-0x0;var _0x119e70=_0xe7c3[_0x1502ea];return _0x119e70;};'use strict';var rp=require(_0x3e7c('0x0'));var util=require(_0x3e7c('0x1'));var _=require(_0x3e7c('0x2'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x3e7c('0x3'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0x1d01c4,_0x420c60){_0x420c60=_0x420c60||0xc8;return function(_0x2d4f1d){if(_0x2d4f1d){return _0x1d01c4[_0x3e7c('0x4')](_0x420c60)[_0x3e7c('0x5')](_0x2d4f1d);}};}function respondWithFilteredResult(_0x5929bc,_0x4a466c){return function(_0x52f8d0){if(_0x52f8d0){var _0x68b23b=typeof _0x4a466c[_0x3e7c('0x6')]===_0x3e7c('0x7')&&typeof _0x4a466c['limit']===_0x3e7c('0x7');var _0x48c037=_0x52f8d0['count'];var _0x5ad9d5=_0x68b23b?0x0:_0x4a466c[_0x3e7c('0x6')];var _0x4d8769=_0x68b23b?_0x52f8d0['count']:_0x4a466c[_0x3e7c('0x6')]+_0x4a466c[_0x3e7c('0x8')];var _0x572255;if(_0x4d8769>=_0x48c037){_0x4d8769=_0x48c037;_0x572255=0xc8;}else{_0x572255=0xce;}_0x5929bc[_0x3e7c('0x4')](_0x572255);return _0x5929bc[_0x3e7c('0x9')](_0x3e7c('0xa'),_0x5ad9d5+'-'+_0x4d8769+'/'+_0x48c037)[_0x3e7c('0x5')](_0x52f8d0);}return null;};}function saveUpdates(_0x47428f){return function(_0x523da6){if(_0x523da6){return _0x523da6['update'](_0x47428f)[_0x3e7c('0xb')](function(_0x1047f0){return _0x1047f0;});}return null;};}function removeEntity(_0x499e04){return function(_0x5b9c0d){if(_0x5b9c0d){return _0x5b9c0d[_0x3e7c('0xc')]()['then'](function(){_0x499e04['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c802){return function(_0x338764){if(!_0x338764){_0x46c802[_0x3e7c('0xd')](0x194);}return _0x338764;};}function handleError(_0x54b476,_0x419325){_0x419325=_0x419325||0x1f4;return function(_0x24a0df){logger[_0x3e7c('0xe')](_0x24a0df[_0x3e7c('0xf')]);if(_0x24a0df[_0x3e7c('0x10')]){delete _0x24a0df[_0x3e7c('0x10')];}_0x54b476[_0x3e7c('0x4')](_0x419325)['send'](_0x24a0df);};}exports[_0x3e7c('0x11')]=function(_0x2823dd,_0x2f45c0){var _0x1bc057={},_0x12a12b={},_0x22962d={'count':0x0,'rows':[]};var _0x595351=_['map'](db[_0x3e7c('0x12')][_0x3e7c('0x13')],function(_0x1fb43a){return{'name':_0x1fb43a['fieldName'],'type':_0x1fb43a['type'][_0x3e7c('0x14')]};});_0x12a12b[_0x3e7c('0x15')]=_[_0x3e7c('0x16')](_0x595351,'name');_0x12a12b[_0x3e7c('0x17')]=_[_0x3e7c('0x18')](_0x2823dd['query']);_0x12a12b['filters']=_[_0x3e7c('0x19')](_0x12a12b[_0x3e7c('0x15')],_0x12a12b[_0x3e7c('0x17')]);_0x1bc057[_0x3e7c('0x1a')]=_[_0x3e7c('0x19')](_0x12a12b['model'],qs['fields'](_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x1b')]));_0x1bc057[_0x3e7c('0x1a')]=_0x1bc057[_0x3e7c('0x1a')][_0x3e7c('0x1c')]?_0x1bc057[_0x3e7c('0x1a')]:_0x12a12b['model'];if(!_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x1d')]('nolimit')){_0x1bc057['limit']=qs[_0x3e7c('0x8')](_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x8')]);_0x1bc057['offset']=qs['offset'](_0x2823dd['query']['offset']);}_0x1bc057['order']=qs['sort'](_0x2823dd[_0x3e7c('0x17')]['sort']);_0x1bc057[_0x3e7c('0x1e')]=qs[_0x3e7c('0x1f')](_[_0x3e7c('0x20')](_0x2823dd[_0x3e7c('0x17')],_0x12a12b[_0x3e7c('0x1f')]),_0x595351);if(_0x2823dd[_0x3e7c('0x17')][_0x3e7c('0x21')]){_0x1bc057[_0x3e7c('0x1e')]=_[_0x3e7c('0x22')](_0x1bc057[_0x3e7c('0x1e')],{'$or':_[_0x3e7c('0x16')](_0x595351,function(_0x4f87a4){if(_0x4f87a4[_0x3e7c('0x23')]!==_0x3e7c('0x24')){var _0x2be151={};_0x2be151[_0x4f87a4['name']]={'$like':'%'+_0x2823dd[_0x3e7c('0x17')]['filter']+'%'};return _0x2be151;}})});}_0x1bc057=_[_0x3e7c('0x22')]({},_0x1bc057,_0x2823dd['options']);var _0x302a5a={'where':_0x1bc057['where']};return db[_0x3e7c('0x12')][_0x3e7c('0x25')](_0x302a5a)[_0x3e7c('0xb')](function(_0x39ff5b){_0x22962d['count']=_0x39ff5b;if(_0x2823dd['query'][_0x3e7c('0x26')]){_0x1bc057[_0x3e7c('0x27')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x3e7c('0x28')](_0x1bc057);})[_0x3e7c('0xb')](function(_0x387dfa){_0x22962d[_0x3e7c('0x29')]=_0x387dfa;return _0x22962d;})['then'](respondWithFilteredResult(_0x2f45c0,_0x1bc057))[_0x3e7c('0x2a')](handleError(_0x2f45c0,null));};exports['show']=function(_0x566286,_0x26c1a4){var _0x5a052b={'raw':![],'where':{'id':_0x566286[_0x3e7c('0x2b')]['id']}},_0x3711be={};_0x3711be[_0x3e7c('0x15')]=_[_0x3e7c('0x18')](db['Dynamics365Account'][_0x3e7c('0x13')]);_0x3711be[_0x3e7c('0x17')]=_[_0x3e7c('0x18')](_0x566286[_0x3e7c('0x17')]);_0x3711be[_0x3e7c('0x1f')]=_[_0x3e7c('0x19')](_0x3711be[_0x3e7c('0x15')],_0x3711be[_0x3e7c('0x17')]);_0x5a052b[_0x3e7c('0x1a')]=_[_0x3e7c('0x19')](_0x3711be[_0x3e7c('0x15')],qs[_0x3e7c('0x1b')](_0x566286[_0x3e7c('0x17')][_0x3e7c('0x1b')]));_0x5a052b[_0x3e7c('0x1a')]=_0x5a052b[_0x3e7c('0x1a')][_0x3e7c('0x1c')]?_0x5a052b[_0x3e7c('0x1a')]:_0x3711be[_0x3e7c('0x15')];if(_0x566286[_0x3e7c('0x17')][_0x3e7c('0x26')]){_0x5a052b['include']=[{'all':!![]}];}_0x5a052b=_['merge']({},_0x5a052b,_0x566286['options']);return db['Dynamics365Account'][_0x3e7c('0x2c')](_0x5a052b)[_0x3e7c('0xb')](handleEntityNotFound(_0x26c1a4,null))[_0x3e7c('0xb')](respondWithResult(_0x26c1a4,null))[_0x3e7c('0x2a')](handleError(_0x26c1a4,null));};exports['create']=function(_0x381c39,_0x12e6ad){return db[_0x3e7c('0x12')][_0x3e7c('0x2d')](_0x381c39[_0x3e7c('0x2e')],{})[_0x3e7c('0xb')](respondWithResult(_0x12e6ad,0xc9))[_0x3e7c('0x2a')](handleError(_0x12e6ad,null));};exports[_0x3e7c('0x2f')]=function(_0x596155,_0x122fb4){if(_0x596155[_0x3e7c('0x2e')]['id']){delete _0x596155['body']['id'];}return db[_0x3e7c('0x12')][_0x3e7c('0x2c')]({'where':{'id':_0x596155['params']['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x122fb4,null))[_0x3e7c('0xb')](saveUpdates(_0x596155[_0x3e7c('0x2e')],null))[_0x3e7c('0xb')](respondWithResult(_0x122fb4,null))[_0x3e7c('0x2a')](handleError(_0x122fb4,null));};exports[_0x3e7c('0xc')]=function(_0xddd705,_0x1b9387){return db['Dynamics365Account'][_0x3e7c('0x2c')]({'where':{'id':_0xddd705['params']['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x1b9387,null))[_0x3e7c('0xb')](removeEntity(_0x1b9387,null))[_0x3e7c('0x2a')](handleError(_0x1b9387,null));};exports[_0x3e7c('0x30')]=function(_0x25b369,_0x4b8ce8){var _0x4baf84={};var _0xd3715e={};var _0x506cfd;var _0xfee3ff;return db['Dynamics365Account'][_0x3e7c('0x31')]({'where':{'id':_0x25b369[_0x3e7c('0x2b')]['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x4b8ce8,null))[_0x3e7c('0xb')](function(_0x2576a1){if(_0x2576a1){_0x506cfd=_0x2576a1;_0xd3715e[_0x3e7c('0x15')]=_['keys'](db[_0x3e7c('0x32')][_0x3e7c('0x13')]);_0xd3715e[_0x3e7c('0x17')]=_[_0x3e7c('0x18')](_0x25b369[_0x3e7c('0x17')]);_0xd3715e[_0x3e7c('0x1f')]=_['intersection'](_0xd3715e[_0x3e7c('0x15')],_0xd3715e[_0x3e7c('0x17')]);_0x4baf84['attributes']=_['intersection'](_0xd3715e[_0x3e7c('0x15')],qs[_0x3e7c('0x1b')](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x1b')]));_0x4baf84[_0x3e7c('0x1a')]=_0x4baf84[_0x3e7c('0x1a')][_0x3e7c('0x1c')]?_0x4baf84[_0x3e7c('0x1a')]:_0xd3715e[_0x3e7c('0x15')];_0x4baf84[_0x3e7c('0x33')]=qs[_0x3e7c('0x34')](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x34')]);_0x4baf84['where']=qs[_0x3e7c('0x1f')](_['pick'](_0x25b369['query'],_0xd3715e[_0x3e7c('0x1f')]));if(_0x25b369['query'][_0x3e7c('0x21')]){_0x4baf84[_0x3e7c('0x1e')]=_[_0x3e7c('0x22')](_0x4baf84[_0x3e7c('0x1e')],{'$or':_['map'](_0x4baf84[_0x3e7c('0x1a')],function(_0x4bd5f8){var _0xb9f491={};_0xb9f491[_0x4bd5f8]={'$like':'%'+_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x21')]+'%'};return _0xb9f491;})});}_0x4baf84=_['merge']({},_0x4baf84,_0x25b369[_0x3e7c('0x35')]);return _0x506cfd['getConfigurations'](_0x4baf84);}})[_0x3e7c('0xb')](function(_0x18cc0d){if(_0x18cc0d){_0xfee3ff=_0x18cc0d[_0x3e7c('0x1c')];if(!_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x1d')](_0x3e7c('0x36'))){_0x4baf84[_0x3e7c('0x8')]=qs['limit'](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x8')]);_0x4baf84[_0x3e7c('0x6')]=qs['offset'](_0x25b369[_0x3e7c('0x17')][_0x3e7c('0x6')]);}return _0x506cfd[_0x3e7c('0x30')](_0x4baf84);}})[_0x3e7c('0xb')](function(_0x33eab6){if(_0x33eab6){return _0x33eab6?{'count':_0xfee3ff,'rows':_0x33eab6}:null;}})[_0x3e7c('0xb')](respondWithResult(_0x4b8ce8,null))['catch'](handleError(_0x4b8ce8,null));};exports[_0x3e7c('0x37')]=function(_0x1afaa1,_0x46d7ac){if(_0x1afaa1['body']['id']){delete _0x1afaa1['body']['id'];}return db[_0x3e7c('0x12')][_0x3e7c('0x31')]({'where':{'id':_0x1afaa1[_0x3e7c('0x2b')]['id']}})[_0x3e7c('0xb')](handleEntityNotFound(_0x46d7ac,null))[_0x3e7c('0xb')](function(_0x36e92d){if(_0x36e92d){_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x38')]=_0x36e92d['id'];_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x39')]=integrations[_0x3e7c('0x3a')](_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x3b')],_0x1afaa1['body']['type']);_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x3c')]=integrations['getDescriptions'](_0x1afaa1[_0x3e7c('0x2e')][_0x3e7c('0x3b')],_0x1afaa1['body']['type']);return db[_0x3e7c('0x32')]['create'](_0x1afaa1['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x3e7c('0x39')},{'model':db[_0x3e7c('0x3d')],'as':_0x3e7c('0x3c')}]});}return null;})[_0x3e7c('0xb')](respondWithResult(_0x46d7ac,null))[_0x3e7c('0x2a')](handleError(_0x46d7ac,null));};function sanitizeRemoteUri(_0x3ecba9){var _0x5a4b94=_0x3ecba9[_0x3e7c('0x3e')](-0x1);if(_0x5a4b94==='/')return _0x3ecba9[_0x3e7c('0x3f')](0x0,_0x3ecba9[_0x3e7c('0x40')](_0x5a4b94));return _0x3ecba9;}function getWebApiUrl(_0x20cb07){return util['format'](_0x3e7c('0x41'),_0x20cb07);}exports['getFields']=function(_0x2457d9,_0xc439d0){var _0x4e6199=_0x2457d9[_0x3e7c('0x17')]['ticketType'];var _0x2a162c=_0x4e6199===_0x3e7c('0x42')?_0x3e7c('0x43'):'PhoneCall';var _0x4ce9fe='';var _0x24063e='';var _0x3545e3='';var _0x20e49a='';var _0x1063cc='';var _0x612b3b='';var _0x5405df='';var _0x3bc424='';var _0x222ca7=['title','description',_0x3e7c('0x44'),_0x3e7c('0x45'),_0x3e7c('0x46'),'subject',_0x3e7c('0x47'),_0x3e7c('0x48'),'directioncode',_0x3e7c('0x49')];var _0x5a01e7=[_0x3e7c('0x4a'),_0x3e7c('0x4b'),_0x3e7c('0x4c'),_0x3e7c('0x4d'),_0x3e7c('0x4e'),_0x3e7c('0x4f'),_0x3e7c('0x50'),'contractidname',_0x3e7c('0x51'),_0x3e7c('0x52'),'createdbyname',_0x3e7c('0x53'),_0x3e7c('0x54'),_0x3e7c('0x55'),_0x3e7c('0x56'),'customeridname',_0x3e7c('0x57'),_0x3e7c('0x58'),_0x3e7c('0x59'),'entitlementidname',_0x3e7c('0x5a'),_0x3e7c('0x5b'),_0x3e7c('0x5c'),_0x3e7c('0x5d'),'firstresponsebykpiidname','followupby',_0x3e7c('0x5e'),_0x3e7c('0x5f'),_0x3e7c('0x60'),'lastonholdtime','masteridname',_0x3e7c('0x61'),_0x3e7c('0x62'),'modifiedbyname',_0x3e7c('0x63'),_0x3e7c('0x64'),_0x3e7c('0x65'),_0x3e7c('0x66'),_0x3e7c('0x67'),'msdyn_iotalertname',_0x3e7c('0x68'),'onholdtime',_0x3e7c('0x69'),_0x3e7c('0x6a'),'owneridtype','owneridyominame',_0x3e7c('0x6b'),_0x3e7c('0x6c'),_0x3e7c('0x6d'),_0x3e7c('0x6e'),'productidname',_0x3e7c('0x6f'),_0x3e7c('0x70'),'resolvebykpiidname',_0x3e7c('0x71'),_0x3e7c('0x72'),_0x3e7c('0x73'),_0x3e7c('0x74'),_0x3e7c('0x75'),_0x3e7c('0x76'),_0x3e7c('0x77'),_0x3e7c('0x78'),'statuscode',_0x3e7c('0x79'),_0x3e7c('0x7a'),_0x3e7c('0x7b'),_0x3e7c('0x7c'),_0x3e7c('0x7d'),'utcconversiontimezonecode',_0x3e7c('0x7e')];var _0x1f1941=_0x222ca7[_0x3e7c('0x7f')](_0x5a01e7);return db[_0x3e7c('0x12')]['findOne']({'where':{'id':_0x2457d9[_0x3e7c('0x2b')]['id']},'attributes':['id',_0x3e7c('0x80'),_0x3e7c('0x81'),_0x3e7c('0x82'),_0x3e7c('0x83'),'clientId',_0x3e7c('0x84'),_0x3e7c('0x85')],'include':[{'model':db[_0x3e7c('0x86')],'as':_0x3e7c('0x86'),'attributes':['id',_0x3e7c('0x87'),'data7']}]})[_0x3e7c('0xb')](handleEntityNotFound(_0xc439d0,null))[_0x3e7c('0xb')](function(_0x2cf812){if(_0x2cf812){if(_0x2cf812[_0x3e7c('0x85')]){_0x2cf812[_0x3e7c('0x88')]=_0x2cf812[_0x3e7c('0x86')][_0x3e7c('0x87')];_0x3bc424=sanitizeRemoteUri(_0x2cf812[_0x3e7c('0x86')][_0x3e7c('0x89')]);_0x5405df=getWebApiUrl(_0x3bc424);return _0x2cf812;}_0x3bc424=sanitizeRemoteUri(_0x2cf812[_0x3e7c('0x82')]);_0x5405df=getWebApiUrl(_0x3bc424);var _0x436bf0={'method':_0x3e7c('0x8a'),'uri':_0x3e7c('0x8b')+_0x2cf812[_0x3e7c('0x83')]+'/oauth2/token','form':{'client_id':_0x2cf812[_0x3e7c('0x8c')],'resource':_0x3bc424,'username':_0x2cf812[_0x3e7c('0x80')],'password':_0x2cf812[_0x3e7c('0x81')],'grant_type':_0x3e7c('0x81'),'client_secret':_0x2cf812[_0x3e7c('0x84')]},'json':!![]};return rp(_0x436bf0);}})[_0x3e7c('0xb')](function(_0x1a10f5){_0x612b3b=_0x1a10f5['access_token'];var _0x12be31={'method':_0x3e7c('0x8d'),'uri':encodeURI(_0x5405df+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x2a162c+'\x27'),'headers':{'Authorization':_0x3e7c('0x8e')+_0x612b3b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12be31);})[_0x3e7c('0xb')](function(_0xb5e78d){var _0x578291=_0xb5e78d[_0x3e7c('0x8f')][0x0];var _0x53a667=_0x578291[_0x3e7c('0x90')];var _0x28d836={'method':_0x3e7c('0x8d'),'uri':_0x5405df+_0x3e7c('0x91')+_0x53a667+_0x3e7c('0x92'),'headers':{'Authorization':_0x3e7c('0x8e')+_0x612b3b,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x28d836);})[_0x3e7c('0xb')](function(_0x113e2b){_0x4ce9fe=_0x113e2b;_0x24063e=_0x4ce9fe['Attributes'];_0x24063e=_[_0x3e7c('0x94')](_0x24063e,function(_0x15aa3b){return!_0x1f1941[_0x3e7c('0x95')](_0x15aa3b['LogicalName']);});var _0x1543df=[];var _0xa40d01=[];_0x24063e[_0x3e7c('0x96')](function(_0x27389f){if(_0x27389f[_0x3e7c('0x97')]){var _0x2e5439=_0x27389f['@odata.type'][_0x3e7c('0x3f')](_0x27389f[_0x3e7c('0x97')]['lastIndexOf']('.')+0x1);if(_0x2e5439===_0x3e7c('0x98')){_0x1543df[_0x3e7c('0x99')](getSelectList(_0x5405df,_0x4e6199,_0xa40d01,_0x4ce9fe[_0x3e7c('0x90')],_0x27389f[_0x3e7c('0x90')],_0x612b3b));}}});return Promise['all'](_0x1543df);})['then'](function(_0x1f371a){_0x3545e3=_0x1f371a[0x0];var _0x2e0f7a=[];var _0x535239=[];_0x24063e[_0x3e7c('0x96')](function(_0x32c488){if(!_['isNil'](_0x32c488['@odata.type'])){var _0x39172b=_0x32c488[_0x3e7c('0x97')][_0x3e7c('0x3f')](_0x32c488[_0x3e7c('0x97')][_0x3e7c('0x40')]('.')+0x1);if(_0x39172b===_0x3e7c('0x9a')){_0x2e0f7a[_0x3e7c('0x99')](getBooleanList(_0x5405df,_0x4e6199,_0x535239,_0x4ce9fe[_0x3e7c('0x90')],_0x32c488[_0x3e7c('0x90')],_0x612b3b));}}});return Promise['all'](_0x2e0f7a);})['then'](function(_0xfd40d1){_0x20e49a=_0xfd40d1[0x0];var _0x1eb60b=[];var _0x5f011d=[];_0x24063e[_0x3e7c('0x96')](function(_0x444715){if(_0x444715[_0x3e7c('0x97')]){var _0x1dcd23=_0x444715[_0x3e7c('0x97')][_0x3e7c('0x3f')](_0x444715[_0x3e7c('0x97')][_0x3e7c('0x40')]('.')+0x1);if(_0x1dcd23===_0x3e7c('0x9b')||_0x1dcd23===_0x3e7c('0x9c')||_0x1dcd23===_0x3e7c('0x9d')||_0x1dcd23==='IntegerAttributeMetadata'||_0x1dcd23===_0x3e7c('0x9e')||_0x1dcd23===_0x3e7c('0x9f')||_0x1dcd23===_0x3e7c('0xa0')||_0x1dcd23===_0x3e7c('0xa1')||_0x1dcd23===_0x3e7c('0xa2')||_0x1dcd23==='DecimalAttributeMetadata'){_0x1eb60b[_0x3e7c('0x99')](getInputList(_0x5405df,_0x4e6199,_0x1dcd23,_0x5f011d,_0x4ce9fe['MetadataId'],_0x444715['MetadataId'],_0x612b3b));}}});return Promise[_0x3e7c('0xa3')](_0x1eb60b);})['then'](function(_0x527ca2){_0x1063cc=_0x527ca2[0x0];var _0x417318=_0x3545e3[_0x3e7c('0x7f')](_0x20e49a)[_0x3e7c('0x7f')](_0x1063cc);var _0x219303={'count':_0x417318[_0x3e7c('0x1c')],'rows':_0x417318};return _0x219303;})[_0x3e7c('0xb')](respondWithResult(_0xc439d0,null))[_0x3e7c('0x2a')](function(_0x2df395){var _0x3e879b=_0x2457d9['query'][_0x3e7c('0xa4')]?0x1f4:_0x2df395[_0x3e7c('0xa5')]||0x1f4;logger[_0x3e7c('0xe')](_0x2df395[_0x3e7c('0xf')]);delete _0x2df395[_0x3e7c('0x10')];if(_0x3e879b===0x191){_0x3e879b=0x190;}_0xc439d0['status'](_0x3e879b)[_0x3e7c('0xa6')](_0x2457d9[_0x3e7c('0x17')][_0x3e7c('0xa4')]?{'message':_0x3e7c('0xa7'),'statusCode':_0x2df395[_0x3e7c('0xa5')]}:_0x2df395);});};function getSelectList(_0x5d9d55,_0x26c6ee,_0x1e2991,_0x456d5d,_0x424df9,_0x3cd277){var _0x52b4cd={'method':_0x3e7c('0x8d'),'uri':_0x5d9d55+_0x3e7c('0x91')+_0x456d5d+_0x3e7c('0xa8')+_0x424df9+_0x3e7c('0xa9')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x3cd277,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x52b4cd)[_0x3e7c('0xb')](function(_0x5070a2){var _0x4e30ed=[];var _0xe62ba9=_0x5070a2[_0x3e7c('0xaa')][_0x3e7c('0xab')];_0xe62ba9['forEach'](function(_0x108aae){_0x4e30ed[_0x3e7c('0x99')]({'name':_0x108aae[_0x3e7c('0xac')]['UserLocalizedLabel'][_0x3e7c('0xac')],'value':String(_0x108aae[_0x3e7c('0xad')])});});var _0x248bef={'id':_0x26c6ee+'_'+_0x5070a2[_0x3e7c('0xae')],'name':_0x5070a2[_0x3e7c('0xaf')][_0x3e7c('0xb0')][_0x3e7c('0xac')],'custom':![],'options':_0x4e30ed};_0x1e2991[_0x3e7c('0x99')](_0x248bef);return _0x1e2991;});}function getBooleanList(_0x369db6,_0x52dac9,_0x1228bb,_0x50588e,_0x1c93bc,_0x1eca38){var _0x2f9c8d={'method':_0x3e7c('0x8d'),'uri':_0x369db6+'EntityDefinitions('+_0x50588e+_0x3e7c('0xa8')+_0x1c93bc+_0x3e7c('0xb1'),'headers':{'Authorization':'Bearer\x20'+_0x1eca38,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x2f9c8d)['then'](function(_0x4cbc92){var _0x1d01f9=[];_0x1d01f9[_0x3e7c('0x99')]({'name':_0x4cbc92[_0x3e7c('0xaa')][_0x3e7c('0xb2')][_0x3e7c('0xac')]['UserLocalizedLabel'][_0x3e7c('0xac')],'value':_0x3e7c('0xb3')},{'name':_0x4cbc92[_0x3e7c('0xaa')][_0x3e7c('0xb4')]['Label'][_0x3e7c('0xb0')][_0x3e7c('0xac')],'value':'false'});var _0x222055={'id':_0x52dac9+'_'+_0x4cbc92[_0x3e7c('0xae')],'name':_0x4cbc92[_0x3e7c('0xaf')]['UserLocalizedLabel'][_0x3e7c('0xac')],'custom':![],'options':_0x1d01f9};_0x1228bb[_0x3e7c('0x99')](_0x222055);return _0x1228bb;});}function getInputList(_0x1767b2,_0x377b93,_0x1d3560,_0x45d802,_0x32ac11,_0x5e8a8b,_0x411d74){var _0x1c4d9f={'method':_0x3e7c('0x8d'),'uri':_0x1767b2+'EntityDefinitions('+_0x32ac11+_0x3e7c('0xa8')+_0x5e8a8b+_0x3e7c('0xb5')+_0x1d3560+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0x3e7c('0x8e')+_0x411d74,'If-None-Match':null,'OData-Version':_0x3e7c('0x93')},'json':!![]};return rp(_0x1c4d9f)[_0x3e7c('0xb')](function(_0x185114){var _0x55768f={'id':_0x377b93+'_'+_0x185114['LogicalName'],'name':_0x185114['DisplayName'][_0x3e7c('0xb0')]?_0x185114[_0x3e7c('0xaf')][_0x3e7c('0xb0')]['Label']:_0x185114[_0x3e7c('0xae')],'custom':![],'options':[]};_0x45d802[_0x3e7c('0x99')](_0x55768f);return _0x45d802;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index 7501077..bbbd9d0 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x1bf76c,_0x4136e7){var _0x58ca52=function(_0x587bd7){while(--_0x587bd7){_0x1bf76c['push'](_0x1bf76c['shift']());}};_0x58ca52(++_0x4136e7);}(_0xe706,0xa3));var _0x6e70=function(_0x235884,_0x1c4355){_0x235884=_0x235884-0x0;var _0x211158=_0xe706[_0x235884];return _0x211158;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts','lodash','util'];(function(_0x4a06e5,_0x20b853){var _0x2d7641=function(_0x2fab4f){while(--_0x2fab4f){_0x4a06e5['push'](_0x4a06e5['shift']());}};_0x2d7641(++_0x20b853);}(_0xe706,0xa3));var _0x6e70=function(_0x2abd03,_0x15bd78){_0x2abd03=_0x2abd03-0x0;var _0x397306=_0xe706[_0x2abd03];return _0x397306;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));var integrations=require(_0x6e70('0xa'));module[_0x6e70('0xb')]=function(_0x4381d1,_0x36357b){return _0x4381d1[_0x6e70('0xc')](_0x6e70('0xd'),attributes,{'tableName':_0x6e70('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index 441bd4e..12af1b8 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 _0x3ae4=['../../config/utils','../../config/logger','jayson/promise','client','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDynamics365Account','options','attributes','limit','include','map','model','Dynamics365Account','find','raw','where','ShowDynamics365Account','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x37a8fc,_0x335ee8){var _0xa3f428=function(_0x260332){while(--_0x260332){_0x37a8fc['push'](_0x37a8fc['shift']());}};_0xa3f428(++_0x335ee8);}(_0x3ae4,0x12b));var _0x43ae=function(_0x5731c4,_0x168de0){_0x5731c4=_0x5731c4-0x0;var _0x1767bf=_0x3ae4[_0x5731c4];return _0x1767bf;};'use strict';var _=require(_0x43ae('0x0'));var util=require(_0x43ae('0x1'));var moment=require(_0x43ae('0x2'));var BPromise=require(_0x43ae('0x3'));var rs=require(_0x43ae('0x4'));var fs=require('fs');var Redis=require(_0x43ae('0x5'));var db=require(_0x43ae('0x6'))['db'];var utils=require(_0x43ae('0x7'));var logger=require(_0x43ae('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x43ae('0x9'));var client=jayson[_0x43ae('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa2de41,_0xccf989,_0x11df6e){return new BPromise(function(_0x34aa3c,_0x302633){return client['request'](_0xa2de41,_0x11df6e)[_0x43ae('0xb')](function(_0x4d0584){logger[_0x43ae('0xc')](_0x43ae('0xd'),_0xccf989,_0x43ae('0xe'));logger[_0x43ae('0xf')](_0x43ae('0x10'),_0xccf989,'request\x20sent',JSON[_0x43ae('0x11')](_0x4d0584));if(_0x4d0584[_0x43ae('0x12')]){if(_0x4d0584[_0x43ae('0x12')]['code']===0x1f4){logger['error'](_0x43ae('0xd'),_0xccf989,_0x4d0584[_0x43ae('0x12')][_0x43ae('0x13')]);return _0x302633(_0x4d0584['error'][_0x43ae('0x13')]);}logger[_0x43ae('0x12')](_0x43ae('0xd'),_0xccf989,_0x4d0584[_0x43ae('0x12')][_0x43ae('0x13')]);return _0x34aa3c(_0x4d0584['error'][_0x43ae('0x13')]);}else{logger[_0x43ae('0xc')](_0x43ae('0xd'),_0xccf989,_0x43ae('0xe'));_0x34aa3c(_0x4d0584[_0x43ae('0x14')][_0x43ae('0x13')]);}})[_0x43ae('0x15')](function(_0x4ddf1c){logger[_0x43ae('0x12')](_0x43ae('0xd'),_0xccf989,_0x4ddf1c);_0x302633(_0x4ddf1c);});});}exports[_0x43ae('0x16')]=function(_0x169ae1){var _0x4e6ea3=this;return new Promise(function(_0x2e4b01,_0x42ded0){return db['Dynamics365Account']['findAll']({'raw':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')]['where']||null:null,'attributes':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')][_0x43ae('0x18')]||null:null,'limit':_0x169ae1['options']?_0x169ae1[_0x43ae('0x17')][_0x43ae('0x19')]||null:null,'include':_0x169ae1[_0x43ae('0x17')]?_0x169ae1[_0x43ae('0x17')][_0x43ae('0x1a')]?_[_0x43ae('0x1b')](_0x169ae1[_0x43ae('0x17')][_0x43ae('0x1a')],function(_0x22d2b5){return{'model':db[_0x22d2b5['model']],'as':_0x22d2b5['as'],'attributes':_0x22d2b5[_0x43ae('0x18')],'include':_0x22d2b5['include']?_[_0x43ae('0x1b')](_0x22d2b5[_0x43ae('0x1a')],function(_0x49dc23){return{'model':db[_0x49dc23[_0x43ae('0x1c')]],'as':_0x49dc23['as'],'attributes':_0x49dc23[_0x43ae('0x18')],'include':_0x49dc23[_0x43ae('0x1a')]?_['map'](_0x49dc23[_0x43ae('0x1a')],function(_0x2aec7a){return{'model':db[_0x2aec7a[_0x43ae('0x1c')]],'as':_0x2aec7a['as'],'attributes':_0x2aec7a[_0x43ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43ae('0xb')](function(_0x24bd98){logger[_0x43ae('0xc')](_0x43ae('0x16'),_0x169ae1);logger[_0x43ae('0xf')](_0x43ae('0x16'),_0x169ae1,JSON[_0x43ae('0x11')](_0x24bd98));_0x2e4b01(_0x24bd98);})[_0x43ae('0x15')](function(_0x5599e3){logger[_0x43ae('0x12')](_0x43ae('0x16'),_0x5599e3[_0x43ae('0x13')],_0x169ae1);_0x42ded0(_0x4e6ea3[_0x43ae('0x12')](0x1f4,_0x5599e3[_0x43ae('0x13')]));});});};exports['ShowDynamics365Account']=function(_0x5806df){var _0x2e9538=this;return new Promise(function(_0x561743,_0x288e4e){return db[_0x43ae('0x1d')][_0x43ae('0x1e')]({'raw':_0x5806df[_0x43ae('0x17')]?_0x5806df['options'][_0x43ae('0x1f')]===undefined?!![]:![]:!![],'where':_0x5806df[_0x43ae('0x17')]?_0x5806df['options'][_0x43ae('0x20')]||null:null,'attributes':_0x5806df[_0x43ae('0x17')]?_0x5806df[_0x43ae('0x17')]['attributes']||null:null,'include':_0x5806df['options']?_0x5806df[_0x43ae('0x17')]['include']?_[_0x43ae('0x1b')](_0x5806df[_0x43ae('0x17')]['include'],function(_0x56cfe3){return{'model':db[_0x56cfe3['model']],'as':_0x56cfe3['as'],'attributes':_0x56cfe3[_0x43ae('0x18')],'include':_0x56cfe3['include']?_['map'](_0x56cfe3[_0x43ae('0x1a')],function(_0x6e2492){return{'model':db[_0x6e2492[_0x43ae('0x1c')]],'as':_0x6e2492['as'],'attributes':_0x6e2492['attributes'],'include':_0x6e2492[_0x43ae('0x1a')]?_['map'](_0x6e2492[_0x43ae('0x1a')],function(_0x43f70a){return{'model':db[_0x43f70a[_0x43ae('0x1c')]],'as':_0x43f70a['as'],'attributes':_0x43f70a[_0x43ae('0x18')]};}):[]};}):[]};}):[]:[]})[_0x43ae('0xb')](function(_0x5e64e2){logger[_0x43ae('0xc')](_0x43ae('0x21'),_0x5806df);logger[_0x43ae('0xf')]('ShowDynamics365Account',_0x5806df,JSON['stringify'](_0x5e64e2));_0x561743(_0x5e64e2);})[_0x43ae('0x15')](function(_0x2dbfdc){logger[_0x43ae('0x12')](_0x43ae('0x21'),_0x2dbfdc[_0x43ae('0x13')],_0x5806df);_0x288e4e(_0x2e9538[_0x43ae('0x12')](0x1f4,_0x2dbfdc[_0x43ae('0x13')]));});});}; \ No newline at end of file +var _0x8e12=['stringify','ShowDynamics365Account','Dynamics365Account','find','lodash','moment','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','findAll','options','raw','where','limit','include','map','model','attributes','GetDynamics365Account'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x8e12,0x178));var _0x28e1=function(_0x5e61b4,_0x57ef43){_0x5e61b4=_0x5e61b4-0x0;var _0x3bf94b=_0x8e12[_0x5e61b4];return _0x3bf94b;};'use strict';var _=require(_0x28e1('0x0'));var util=require('util');var moment=require(_0x28e1('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x28e1('0x2'));var logger=require(_0x28e1('0x3'))(_0x28e1('0x4'));var config=require('../../config/environment');var jayson=require(_0x28e1('0x5'));var client=jayson[_0x28e1('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2695e6,_0x5cdfd2,_0x57ecb2){return new BPromise(function(_0x79d624,_0xb02e2f){return client[_0x28e1('0x7')](_0x2695e6,_0x57ecb2)['then'](function(_0x4e7332){logger[_0x28e1('0x8')](_0x28e1('0x9'),_0x5cdfd2,'request\x20sent');logger[_0x28e1('0xa')](_0x28e1('0xb'),_0x5cdfd2,'request\x20sent',JSON['stringify'](_0x4e7332));if(_0x4e7332['error']){if(_0x4e7332[_0x28e1('0xc')][_0x28e1('0xd')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5cdfd2,_0x4e7332['error']['message']);return _0xb02e2f(_0x4e7332[_0x28e1('0xc')]['message']);}logger[_0x28e1('0xc')](_0x28e1('0x9'),_0x5cdfd2,_0x4e7332['error'][_0x28e1('0xe')]);return _0x79d624(_0x4e7332['error'][_0x28e1('0xe')]);}else{logger[_0x28e1('0x8')](_0x28e1('0x9'),_0x5cdfd2,_0x28e1('0xf'));_0x79d624(_0x4e7332[_0x28e1('0x10')][_0x28e1('0xe')]);}})['catch'](function(_0x1e6335){logger[_0x28e1('0xc')](_0x28e1('0x9'),_0x5cdfd2,_0x1e6335);_0xb02e2f(_0x1e6335);});});}exports['GetDynamics365Account']=function(_0x4c463c){var _0xdbe061=this;return new Promise(function(_0x32508b,_0x4d4afa){return db['Dynamics365Account'][_0x28e1('0x11')]({'raw':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')][_0x28e1('0x13')]===undefined?!![]:![]:!![],'where':_0x4c463c[_0x28e1('0x12')]?_0x4c463c['options'][_0x28e1('0x14')]||null:null,'attributes':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')]['attributes']||null:null,'limit':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')][_0x28e1('0x15')]||null:null,'include':_0x4c463c[_0x28e1('0x12')]?_0x4c463c[_0x28e1('0x12')][_0x28e1('0x16')]?_[_0x28e1('0x17')](_0x4c463c[_0x28e1('0x12')][_0x28e1('0x16')],function(_0x1ff550){return{'model':db[_0x1ff550[_0x28e1('0x18')]],'as':_0x1ff550['as'],'attributes':_0x1ff550[_0x28e1('0x19')],'include':_0x1ff550['include']?_[_0x28e1('0x17')](_0x1ff550[_0x28e1('0x16')],function(_0x5a2a66){return{'model':db[_0x5a2a66[_0x28e1('0x18')]],'as':_0x5a2a66['as'],'attributes':_0x5a2a66['attributes'],'include':_0x5a2a66['include']?_[_0x28e1('0x17')](_0x5a2a66['include'],function(_0x24c57f){return{'model':db[_0x24c57f['model']],'as':_0x24c57f['as'],'attributes':_0x24c57f[_0x28e1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46b213){logger['info'](_0x28e1('0x1a'),_0x4c463c);logger[_0x28e1('0xa')](_0x28e1('0x1a'),_0x4c463c,JSON[_0x28e1('0x1b')](_0x46b213));_0x32508b(_0x46b213);})['catch'](function(_0x545731){logger[_0x28e1('0xc')](_0x28e1('0x1a'),_0x545731[_0x28e1('0xe')],_0x4c463c);_0x4d4afa(_0xdbe061[_0x28e1('0xc')](0x1f4,_0x545731[_0x28e1('0xe')]));});});};exports[_0x28e1('0x1c')]=function(_0x3f7581){var _0x158818=this;return new Promise(function(_0xff664a,_0x250f92){return db[_0x28e1('0x1d')][_0x28e1('0x1e')]({'raw':_0x3f7581['options']?_0x3f7581['options'][_0x28e1('0x13')]===undefined?!![]:![]:!![],'where':_0x3f7581[_0x28e1('0x12')]?_0x3f7581[_0x28e1('0x12')]['where']||null:null,'attributes':_0x3f7581['options']?_0x3f7581[_0x28e1('0x12')][_0x28e1('0x19')]||null:null,'include':_0x3f7581['options']?_0x3f7581[_0x28e1('0x12')][_0x28e1('0x16')]?_['map'](_0x3f7581['options'][_0x28e1('0x16')],function(_0x2a6c1d){return{'model':db[_0x2a6c1d[_0x28e1('0x18')]],'as':_0x2a6c1d['as'],'attributes':_0x2a6c1d[_0x28e1('0x19')],'include':_0x2a6c1d[_0x28e1('0x16')]?_[_0x28e1('0x17')](_0x2a6c1d[_0x28e1('0x16')],function(_0x11e1e7){return{'model':db[_0x11e1e7['model']],'as':_0x11e1e7['as'],'attributes':_0x11e1e7[_0x28e1('0x19')],'include':_0x11e1e7[_0x28e1('0x16')]?_[_0x28e1('0x17')](_0x11e1e7['include'],function(_0x4a0429){return{'model':db[_0x4a0429[_0x28e1('0x18')]],'as':_0x4a0429['as'],'attributes':_0x4a0429[_0x28e1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26b578){logger[_0x28e1('0x8')](_0x28e1('0x1c'),_0x3f7581);logger[_0x28e1('0xa')](_0x28e1('0x1c'),_0x3f7581,JSON[_0x28e1('0x1b')](_0x26b578));_0xff664a(_0x26b578);})['catch'](function(_0x21859a){logger[_0x28e1('0xc')](_0x28e1('0x1c'),_0x21859a[_0x28e1('0xe')],_0x3f7581);_0x250f92(_0x158818[_0x28e1('0xc')](0x1f4,_0x21859a[_0x28e1('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 287fca3..b08903f 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 _0x17a5=['/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','express','fs-extra','../../components/interaction/service','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects'];(function(_0x7c333d,_0x1bc242){var _0x1861ca=function(_0x13ec69){while(--_0x13ec69){_0x7c333d['push'](_0x7c333d['shift']());}};_0x1861ca(++_0x1bc242);}(_0x17a5,0x1d5));var _0x517a=function(_0x4bf658,_0x4f9c09){_0x4bf658=_0x4bf658-0x0;var _0x3852ab=_0x17a5[_0x4bf658];return _0x3852ab;};'use strict';var multer=require('multer');var util=require(_0x517a('0x0'));var path=require(_0x517a('0x1'));var timeout=require('connect-timeout');var express=require(_0x517a('0x2'));var router=express['Router']();var fs_extra=require(_0x517a('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x517a('0x4'));var config=require('../../config/environment');var controller=require(_0x517a('0x5'));router[_0x517a('0x6')]('/',auth[_0x517a('0x7')](),controller['index']);router[_0x517a('0x6')](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x9')]);router[_0x517a('0x6')](_0x517a('0xa'),auth[_0x517a('0x7')](),controller[_0x517a('0xb')]);router[_0x517a('0x6')](_0x517a('0xc'),auth[_0x517a('0x7')](),controller[_0x517a('0xd')]);router[_0x517a('0x6')](_0x517a('0xe'),auth['isAuthenticated'](),controller[_0x517a('0xf')]);router[_0x517a('0x10')]('/',auth['isAuthenticated'](),controller[_0x517a('0x11')]);router[_0x517a('0x12')](_0x517a('0x8'),auth[_0x517a('0x7')](),controller[_0x517a('0x13')]);router[_0x517a('0x14')]('/:id',auth[_0x517a('0x7')](),controller[_0x517a('0x15')]);module[_0x517a('0x16')]=router; \ No newline at end of file +var _0x1dcd=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','index','/:id','isAuthenticated','show','get','getFields','/:id/subjects','getSubjects','/:id/descriptions','post'];(function(_0x463bc5,_0x47a997){var _0x1f20a0=function(_0x5b463d){while(--_0x5b463d){_0x463bc5['push'](_0x463bc5['shift']());}};_0x1f20a0(++_0x47a997);}(_0x1dcd,0x100));var _0xd1dc=function(_0x2b2193,_0x220cf2){_0x2b2193=_0x2b2193-0x0;var _0xd4faf8=_0x1dcd[_0x2b2193];return _0xd4faf8;};'use strict';var multer=require(_0xd1dc('0x0'));var util=require(_0xd1dc('0x1'));var path=require(_0xd1dc('0x2'));var timeout=require(_0xd1dc('0x3'));var express=require(_0xd1dc('0x4'));var router=express[_0xd1dc('0x5')]();var fs_extra=require(_0xd1dc('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd1dc('0x7'));var config=require(_0xd1dc('0x8'));var controller=require('./intDynamics365Configuration.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xd1dc('0x9')]);router['get'](_0xd1dc('0xa'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0xc')]);router[_0xd1dc('0xd')]('/:id/fields',auth[_0xd1dc('0xb')](),controller[_0xd1dc('0xe')]);router[_0xd1dc('0xd')](_0xd1dc('0xf'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0x10')]);router[_0xd1dc('0xd')](_0xd1dc('0x11'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xd1dc('0x12')]('/',auth['isAuthenticated'](),controller[_0xd1dc('0x13')]);router[_0xd1dc('0x14')](_0xd1dc('0xa'),auth[_0xd1dc('0xb')](),controller[_0xd1dc('0x15')]);router[_0xd1dc('0x16')](_0xd1dc('0xa'),auth['isAuthenticated'](),controller[_0xd1dc('0x17')]);module[_0xd1dc('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 35f58f2..3e680df 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 _0xf623=['exports','STRING','ENUM','incident','phonecall','nothing','BOOLEAN','sequelize'];(function(_0x481bf7,_0x437f69){var _0x461787=function(_0xb3bc9d){while(--_0xb3bc9d){_0x481bf7['push'](_0x481bf7['shift']());}};_0x461787(++_0x437f69);}(_0xf623,0x1bf));var _0x3f62=function(_0x5a50e1,_0x23facf){_0x5a50e1=_0x5a50e1-0x0;var _0x25ba7f=_0xf623[_0x5a50e1];return _0x25ba7f;};'use strict';var Sequelize=require(_0x3f62('0x0'));module[_0x3f62('0x1')]={'name':{'type':Sequelize[_0x3f62('0x2')]},'description':{'type':Sequelize[_0x3f62('0x2')]},'ticketType':{'type':Sequelize[_0x3f62('0x3')](_0x3f62('0x4'),_0x3f62('0x5')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x3f62('0x3')]('contact',_0x3f62('0x6')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize['STRING'],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x3f62('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x4da8=['contact','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x4da8,0x1b2));var _0x84da=function(_0x263ee9,_0xc5629){_0x263ee9=_0x263ee9-0x0;var _0x3d4faa=_0x4da8[_0x263ee9];return _0x3d4faa;};'use strict';var Sequelize=require(_0x84da('0x0'));module[_0x84da('0x1')]={'name':{'type':Sequelize[_0x84da('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x84da('0x3'),_0x84da('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0x84da('0x5')](_0x84da('0x6'),'nothing'),'defaultValue':_0x84da('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x84da('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x84da('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ea608c7..b6ad190 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 _0x7a53=['error','stack','name','send','index','Dynamics365Configuration','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getFields','Dynamics365Field','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x596053,_0x1a9efd){var _0x1fb180=function(_0x14ccdf){while(--_0x14ccdf){_0x596053['push'](_0x596053['shift']());}};_0x1fb180(++_0x1a9efd);}(_0x7a53,0x1c9));var _0x37a5=function(_0x9887fa,_0x44e0ca){_0x9887fa=_0x9887fa-0x0;var _0x2f8d7a=_0x7a53[_0x9887fa];return _0x2f8d7a;};'use strict';var emlformat=require(_0x37a5('0x0'));var rimraf=require(_0x37a5('0x1'));var zipdir=require(_0x37a5('0x2'));var jsonpatch=require(_0x37a5('0x3'));var rp=require(_0x37a5('0x4'));var moment=require(_0x37a5('0x5'));var BPromise=require(_0x37a5('0x6'));var Mustache=require(_0x37a5('0x7'));var util=require(_0x37a5('0x8'));var path=require(_0x37a5('0x9'));var sox=require('sox');var csv=require(_0x37a5('0xa'));var ejs=require(_0x37a5('0xb'));var fs=require('fs');var fs_extra=require(_0x37a5('0xc'));var _=require(_0x37a5('0xd'));var squel=require(_0x37a5('0xe'));var crypto=require(_0x37a5('0xf'));var jsforce=require(_0x37a5('0x10'));var deskjs=require(_0x37a5('0x11'));var toCsv=require(_0x37a5('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x37a5('0x12'));var qs=require(_0x37a5('0x13'));var as=require(_0x37a5('0x14'));var hardwareService=require(_0x37a5('0x15'));var logger=require(_0x37a5('0x16'))(_0x37a5('0x17'));var utils=require(_0x37a5('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x37a5('0x19'))['db'];function respondWithStatusCode(_0x49ef32,_0x4b4827){_0x4b4827=_0x4b4827||0xcc;return function(_0x2141a0){if(_0x2141a0){return _0x49ef32['sendStatus'](_0x4b4827);}return _0x49ef32[_0x37a5('0x1a')](_0x4b4827)[_0x37a5('0x1b')]();};}function respondWithResult(_0x548a71,_0x5bb322){_0x5bb322=_0x5bb322||0xc8;return function(_0x524704){if(_0x524704){return _0x548a71[_0x37a5('0x1a')](_0x5bb322)[_0x37a5('0x1c')](_0x524704);}};}function respondWithFilteredResult(_0x3ab4bc,_0x1e1d6a){return function(_0x271944){if(_0x271944){var _0x14ebc9=typeof _0x1e1d6a[_0x37a5('0x1d')]===_0x37a5('0x1e')&&typeof _0x1e1d6a['limit']===_0x37a5('0x1e');var _0x298771=_0x271944[_0x37a5('0x1f')];var _0x5445c1=_0x14ebc9?0x0:_0x1e1d6a[_0x37a5('0x1d')];var _0x2d70f9=_0x14ebc9?_0x271944[_0x37a5('0x1f')]:_0x1e1d6a[_0x37a5('0x1d')]+_0x1e1d6a[_0x37a5('0x20')];var _0x78e07a;if(_0x2d70f9>=_0x298771){_0x2d70f9=_0x298771;_0x78e07a=0xc8;}else{_0x78e07a=0xce;}_0x3ab4bc[_0x37a5('0x1a')](_0x78e07a);return _0x3ab4bc[_0x37a5('0x21')]('Content-Range',_0x5445c1+'-'+_0x2d70f9+'/'+_0x298771)[_0x37a5('0x1c')](_0x271944);}return null;};}function patchUpdates(_0x337092){return function(_0x23088c){try{jsonpatch[_0x37a5('0x22')](_0x23088c,_0x337092,!![]);}catch(_0x436cc6){return BPromise[_0x37a5('0x23')](_0x436cc6);}return _0x23088c[_0x37a5('0x24')]();};}function saveUpdates(_0x22fd19,_0x107c36){return function(_0xfe33ea){if(_0xfe33ea){return _0xfe33ea[_0x37a5('0x25')](_0x22fd19)[_0x37a5('0x26')](function(_0x51ec36){return _0x51ec36;});}return null;};}function removeEntity(_0x52c0de,_0x2c4f1c){return function(_0x4dd21e){if(_0x4dd21e){return _0x4dd21e[_0x37a5('0x27')]()['then'](function(){_0x52c0de[_0x37a5('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x196ab7,_0x208a0e){return function(_0x54daa5){if(!_0x54daa5){_0x196ab7[_0x37a5('0x28')](0x194);}return _0x54daa5;};}function handleError(_0xfd1f5,_0x10a4b6){_0x10a4b6=_0x10a4b6||0x1f4;return function(_0x4703f2){logger[_0x37a5('0x29')](_0x4703f2[_0x37a5('0x2a')]);if(_0x4703f2[_0x37a5('0x2b')]){delete _0x4703f2[_0x37a5('0x2b')];}_0xfd1f5['status'](_0x10a4b6)[_0x37a5('0x2c')](_0x4703f2);};}exports[_0x37a5('0x2d')]=function(_0x166c96,_0x4f520e){var _0x49efd8={},_0xcc7d92={},_0x57491c={'count':0x0,'rows':[]};var _0xb6f7a1=_['map'](db[_0x37a5('0x2e')][_0x37a5('0x2f')],function(_0x127287){return{'name':_0x127287[_0x37a5('0x30')],'type':_0x127287['type']['key']};});_0xcc7d92[_0x37a5('0x31')]=_[_0x37a5('0x32')](_0xb6f7a1,_0x37a5('0x2b'));_0xcc7d92[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x166c96[_0x37a5('0x33')]);_0xcc7d92[_0x37a5('0x35')]=_[_0x37a5('0x36')](_0xcc7d92[_0x37a5('0x31')],_0xcc7d92['query']);_0x49efd8[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0xcc7d92[_0x37a5('0x31')],qs[_0x37a5('0x38')](_0x166c96[_0x37a5('0x33')][_0x37a5('0x38')]));_0x49efd8[_0x37a5('0x37')]=_0x49efd8[_0x37a5('0x37')]['length']?_0x49efd8[_0x37a5('0x37')]:_0xcc7d92['model'];if(!_0x166c96[_0x37a5('0x33')][_0x37a5('0x39')]('nolimit')){_0x49efd8[_0x37a5('0x20')]=qs[_0x37a5('0x20')](_0x166c96[_0x37a5('0x33')]['limit']);_0x49efd8['offset']=qs[_0x37a5('0x1d')](_0x166c96['query'][_0x37a5('0x1d')]);}_0x49efd8[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x166c96[_0x37a5('0x33')][_0x37a5('0x3b')]);_0x49efd8[_0x37a5('0x3c')]=qs[_0x37a5('0x35')](_[_0x37a5('0x3d')](_0x166c96[_0x37a5('0x33')],_0xcc7d92[_0x37a5('0x35')]),_0xb6f7a1);if(_0x166c96['query'][_0x37a5('0x3e')]){_0x49efd8['where']=_[_0x37a5('0x3f')](_0x49efd8['where'],{'$or':_[_0x37a5('0x32')](_0xb6f7a1,function(_0x2a95b9){if(_0x2a95b9['type']!==_0x37a5('0x40')){var _0x11eba1={};_0x11eba1[_0x2a95b9[_0x37a5('0x2b')]]={'$like':'%'+_0x166c96[_0x37a5('0x33')][_0x37a5('0x3e')]+'%'};return _0x11eba1;}})});}_0x49efd8=_['merge']({},_0x49efd8,_0x166c96[_0x37a5('0x41')]);var _0xe46da9={'where':_0x49efd8[_0x37a5('0x3c')]};return db[_0x37a5('0x2e')]['count'](_0xe46da9)[_0x37a5('0x26')](function(_0x5dfaf2){_0x57491c['count']=_0x5dfaf2;if(_0x166c96[_0x37a5('0x33')][_0x37a5('0x42')]){_0x49efd8['include']=[{'all':!![]}];}return db[_0x37a5('0x2e')][_0x37a5('0x43')](_0x49efd8);})['then'](function(_0x228d5d){_0x57491c[_0x37a5('0x44')]=_0x228d5d;return _0x57491c;})[_0x37a5('0x26')](respondWithFilteredResult(_0x4f520e,_0x49efd8))[_0x37a5('0x45')](handleError(_0x4f520e,null));};exports[_0x37a5('0x46')]=function(_0x348c75,_0x1486ba){var _0xa20a72={'raw':![],'where':{'id':_0x348c75[_0x37a5('0x47')]['id']}},_0x197322={};_0x197322[_0x37a5('0x31')]=_[_0x37a5('0x34')](db[_0x37a5('0x2e')][_0x37a5('0x2f')]);_0x197322[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x348c75['query']);_0x197322[_0x37a5('0x35')]=_[_0x37a5('0x36')](_0x197322[_0x37a5('0x31')],_0x197322[_0x37a5('0x33')]);_0xa20a72[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0x197322['model'],qs[_0x37a5('0x38')](_0x348c75[_0x37a5('0x33')][_0x37a5('0x38')]));_0xa20a72[_0x37a5('0x37')]=_0xa20a72[_0x37a5('0x37')][_0x37a5('0x48')]?_0xa20a72[_0x37a5('0x37')]:_0x197322['model'];if(_0x348c75[_0x37a5('0x33')][_0x37a5('0x42')]){_0xa20a72[_0x37a5('0x49')]=[{'all':!![]}];}_0xa20a72=_[_0x37a5('0x3f')]({},_0xa20a72,_0x348c75[_0x37a5('0x41')]);return db[_0x37a5('0x2e')][_0x37a5('0x4a')](_0xa20a72)['then'](handleEntityNotFound(_0x1486ba,null))[_0x37a5('0x26')](respondWithResult(_0x1486ba,null))[_0x37a5('0x45')](handleError(_0x1486ba,null));};exports[_0x37a5('0x4b')]=function(_0x309a17,_0x1894ce){return db[_0x37a5('0x2e')][_0x37a5('0x4b')](_0x309a17[_0x37a5('0x4c')],{})['then'](respondWithResult(_0x1894ce,0xc9))['catch'](handleError(_0x1894ce,null));};exports[_0x37a5('0x25')]=function(_0x5eca5b,_0x4fd508){if(_0x5eca5b['body']['id']){delete _0x5eca5b[_0x37a5('0x4c')]['id'];}return db[_0x37a5('0x2e')]['find']({'where':{'id':_0x5eca5b[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x4fd508,null))[_0x37a5('0x26')](saveUpdates(_0x5eca5b[_0x37a5('0x4c')],null))[_0x37a5('0x26')](respondWithResult(_0x4fd508,null))[_0x37a5('0x45')](handleError(_0x4fd508,null));};exports['destroy']=function(_0xe79a07,_0x2f7c44){return db[_0x37a5('0x2e')][_0x37a5('0x4a')]({'where':{'id':_0xe79a07[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x2f7c44,null))[_0x37a5('0x26')](removeEntity(_0x2f7c44,null))[_0x37a5('0x45')](handleError(_0x2f7c44,null));};exports[_0x37a5('0x4d')]=function(_0x205568,_0x2ce5c5,_0x17e282){var _0x35e31b={};var _0x4d34be={};var _0x5f5639;var _0x518828;return db[_0x37a5('0x2e')]['findOne']({'where':{'id':_0x205568[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x2ce5c5,null))[_0x37a5('0x26')](function(_0x4668a0){if(_0x4668a0){_0x5f5639=_0x4668a0;_0x4d34be[_0x37a5('0x31')]=_[_0x37a5('0x34')](db[_0x37a5('0x4e')][_0x37a5('0x2f')]);_0x4d34be[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x205568['query']);_0x4d34be[_0x37a5('0x35')]=_[_0x37a5('0x36')](_0x4d34be['model'],_0x4d34be[_0x37a5('0x33')]);_0x35e31b[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0x4d34be[_0x37a5('0x31')],qs[_0x37a5('0x38')](_0x205568[_0x37a5('0x33')][_0x37a5('0x38')]));_0x35e31b[_0x37a5('0x37')]=_0x35e31b['attributes'][_0x37a5('0x48')]?_0x35e31b[_0x37a5('0x37')]:_0x4d34be[_0x37a5('0x31')];_0x35e31b[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x205568[_0x37a5('0x33')]['sort']);_0x35e31b[_0x37a5('0x3c')]=qs[_0x37a5('0x35')](_['pick'](_0x205568[_0x37a5('0x33')],_0x4d34be['filters']));if(_0x205568[_0x37a5('0x33')][_0x37a5('0x3e')]){_0x35e31b[_0x37a5('0x3c')]=_[_0x37a5('0x3f')](_0x35e31b[_0x37a5('0x3c')],{'$or':_['map'](_0x35e31b[_0x37a5('0x37')],function(_0xf0c65){var _0x8caa5b={};_0x8caa5b[_0xf0c65]={'$like':'%'+_0x205568[_0x37a5('0x33')]['filter']+'%'};return _0x8caa5b;})});}_0x35e31b=_['merge']({},_0x35e31b,_0x205568[_0x37a5('0x41')]);return _0x5f5639[_0x37a5('0x4d')](_0x35e31b);}})[_0x37a5('0x26')](function(_0x5e3a26){if(_0x5e3a26){_0x518828=_0x5e3a26[_0x37a5('0x48')];if(!_0x205568[_0x37a5('0x33')][_0x37a5('0x39')](_0x37a5('0x4f'))){_0x35e31b[_0x37a5('0x20')]=qs['limit'](_0x205568[_0x37a5('0x33')][_0x37a5('0x20')]);_0x35e31b[_0x37a5('0x1d')]=qs[_0x37a5('0x1d')](_0x205568[_0x37a5('0x33')]['offset']);}return _0x5f5639['getFields'](_0x35e31b);}})[_0x37a5('0x26')](function(_0x136f1d){if(_0x136f1d){return _0x136f1d?{'count':_0x518828,'rows':_0x136f1d}:null;}})[_0x37a5('0x26')](respondWithResult(_0x2ce5c5,null))[_0x37a5('0x45')](handleError(_0x2ce5c5,null));};exports[_0x37a5('0x50')]=function(_0x44bb78,_0x41d257,_0x4ad28d){var _0x2510ea={};var _0x1fe3e5={};var _0x5d2d61;var _0x1dbcf8;return db['Dynamics365Configuration'][_0x37a5('0x51')]({'where':{'id':_0x44bb78[_0x37a5('0x47')]['id']}})[_0x37a5('0x26')](handleEntityNotFound(_0x41d257,null))[_0x37a5('0x26')](function(_0x4d2345){if(_0x4d2345){_0x5d2d61=_0x4d2345;_0x1fe3e5['model']=_['keys'](db[_0x37a5('0x4e')][_0x37a5('0x2f')]);_0x1fe3e5[_0x37a5('0x33')]=_[_0x37a5('0x34')](_0x44bb78[_0x37a5('0x33')]);_0x1fe3e5['filters']=_[_0x37a5('0x36')](_0x1fe3e5[_0x37a5('0x31')],_0x1fe3e5[_0x37a5('0x33')]);_0x2510ea[_0x37a5('0x37')]=_['intersection'](_0x1fe3e5['model'],qs['fields'](_0x44bb78[_0x37a5('0x33')][_0x37a5('0x38')]));_0x2510ea[_0x37a5('0x37')]=_0x2510ea[_0x37a5('0x37')][_0x37a5('0x48')]?_0x2510ea[_0x37a5('0x37')]:_0x1fe3e5[_0x37a5('0x31')];_0x2510ea[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x44bb78[_0x37a5('0x33')][_0x37a5('0x3b')]);_0x2510ea[_0x37a5('0x3c')]=qs[_0x37a5('0x35')](_[_0x37a5('0x3d')](_0x44bb78[_0x37a5('0x33')],_0x1fe3e5[_0x37a5('0x35')]));if(_0x44bb78[_0x37a5('0x33')]['filter']){_0x2510ea[_0x37a5('0x3c')]=_[_0x37a5('0x3f')](_0x2510ea[_0x37a5('0x3c')],{'$or':_['map'](_0x2510ea['attributes'],function(_0x47f2d1){var _0x273112={};_0x273112[_0x47f2d1]={'$like':'%'+_0x44bb78['query'][_0x37a5('0x3e')]+'%'};return _0x273112;})});}_0x2510ea=_[_0x37a5('0x3f')]({},_0x2510ea,_0x44bb78[_0x37a5('0x41')]);return _0x5d2d61[_0x37a5('0x50')](_0x2510ea);}})['then'](function(_0x2e3eca){if(_0x2e3eca){_0x1dbcf8=_0x2e3eca[_0x37a5('0x48')];if(!_0x44bb78[_0x37a5('0x33')][_0x37a5('0x39')](_0x37a5('0x4f'))){_0x2510ea[_0x37a5('0x20')]=qs['limit'](_0x44bb78['query']['limit']);_0x2510ea[_0x37a5('0x1d')]=qs[_0x37a5('0x1d')](_0x44bb78[_0x37a5('0x33')][_0x37a5('0x1d')]);}return _0x5d2d61[_0x37a5('0x50')](_0x2510ea);}})[_0x37a5('0x26')](function(_0x4a6e25){if(_0x4a6e25){return _0x4a6e25?{'count':_0x1dbcf8,'rows':_0x4a6e25}:null;}})['then'](respondWithResult(_0x41d257,null))[_0x37a5('0x45')](handleError(_0x41d257,null));};exports[_0x37a5('0x52')]=function(_0x2f3242,_0x2d6e53,_0x34d398){var _0x4d8bfc={};var _0x987a15={};var _0xed8595;var _0x52a371;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x2f3242[_0x37a5('0x47')]['id']}})['then'](handleEntityNotFound(_0x2d6e53,null))[_0x37a5('0x26')](function(_0x183d76){if(_0x183d76){_0xed8595=_0x183d76;_0x987a15[_0x37a5('0x31')]=_['keys'](db['Dynamics365Field'][_0x37a5('0x2f')]);_0x987a15[_0x37a5('0x33')]=_['keys'](_0x2f3242[_0x37a5('0x33')]);_0x987a15['filters']=_[_0x37a5('0x36')](_0x987a15[_0x37a5('0x31')],_0x987a15['query']);_0x4d8bfc[_0x37a5('0x37')]=_[_0x37a5('0x36')](_0x987a15[_0x37a5('0x31')],qs[_0x37a5('0x38')](_0x2f3242[_0x37a5('0x33')][_0x37a5('0x38')]));_0x4d8bfc[_0x37a5('0x37')]=_0x4d8bfc['attributes']['length']?_0x4d8bfc[_0x37a5('0x37')]:_0x987a15[_0x37a5('0x31')];_0x4d8bfc[_0x37a5('0x3a')]=qs[_0x37a5('0x3b')](_0x2f3242[_0x37a5('0x33')]['sort']);_0x4d8bfc['where']=qs[_0x37a5('0x35')](_[_0x37a5('0x3d')](_0x2f3242[_0x37a5('0x33')],_0x987a15[_0x37a5('0x35')]));if(_0x2f3242[_0x37a5('0x33')]['filter']){_0x4d8bfc['where']=_[_0x37a5('0x3f')](_0x4d8bfc[_0x37a5('0x3c')],{'$or':_[_0x37a5('0x32')](_0x4d8bfc[_0x37a5('0x37')],function(_0x13ba14){var _0x4b4596={};_0x4b4596[_0x13ba14]={'$like':'%'+_0x2f3242['query'][_0x37a5('0x3e')]+'%'};return _0x4b4596;})});}_0x4d8bfc=_[_0x37a5('0x3f')]({},_0x4d8bfc,_0x2f3242[_0x37a5('0x41')]);return _0xed8595['getDescriptions'](_0x4d8bfc);}})[_0x37a5('0x26')](function(_0x27b621){if(_0x27b621){_0x52a371=_0x27b621[_0x37a5('0x48')];if(!_0x2f3242[_0x37a5('0x33')][_0x37a5('0x39')](_0x37a5('0x4f'))){_0x4d8bfc['limit']=qs[_0x37a5('0x20')](_0x2f3242['query'][_0x37a5('0x20')]);_0x4d8bfc[_0x37a5('0x1d')]=qs[_0x37a5('0x1d')](_0x2f3242['query'][_0x37a5('0x1d')]);}return _0xed8595[_0x37a5('0x52')](_0x4d8bfc);}})[_0x37a5('0x26')](function(_0x25f0da){if(_0x25f0da){return _0x25f0da?{'count':_0x52a371,'rows':_0x25f0da}:null;}})['then'](respondWithResult(_0x2d6e53,null))[_0x37a5('0x45')](handleError(_0x2d6e53,null));}; \ No newline at end of file +var _0x9865=['create','body','update','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','then','destroy','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Dynamics365Configuration','findAll','rows','catch','show','params','find'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9865,0xec));var _0x5986=function(_0x2f0fa5,_0x154beb){_0x2f0fa5=_0x2f0fa5-0x0;var _0x4ca937=_0x9865[_0x2f0fa5];return _0x4ca937;};'use strict';var emlformat=require(_0x5986('0x0'));var rimraf=require(_0x5986('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5986('0x2'));var rp=require('request-promise');var moment=require(_0x5986('0x3'));var BPromise=require(_0x5986('0x4'));var Mustache=require(_0x5986('0x5'));var util=require(_0x5986('0x6'));var path=require(_0x5986('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5986('0x8'));var _=require(_0x5986('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5986('0xa'));var toCsv=require('to-csv');var querystring=require(_0x5986('0xb'));var Papa=require(_0x5986('0xc'));var Redis=require(_0x5986('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5986('0xe'));var as=require(_0x5986('0xf'));var hardwareService=require(_0x5986('0x10'));var logger=require(_0x5986('0x11'))('api');var utils=require('../../config/utils');var config=require(_0x5986('0x12'));var licenseUtil=require(_0x5986('0x13'));var db=require(_0x5986('0x14'))['db'];function respondWithStatusCode(_0x1bdf6d,_0x3d0b6a){_0x3d0b6a=_0x3d0b6a||0xcc;return function(_0x1f78ee){if(_0x1f78ee){return _0x1bdf6d[_0x5986('0x15')](_0x3d0b6a);}return _0x1bdf6d[_0x5986('0x16')](_0x3d0b6a)[_0x5986('0x17')]();};}function respondWithResult(_0x2c1a94,_0x2c4b0f){_0x2c4b0f=_0x2c4b0f||0xc8;return function(_0x1ee660){if(_0x1ee660){return _0x2c1a94[_0x5986('0x16')](_0x2c4b0f)['json'](_0x1ee660);}};}function respondWithFilteredResult(_0x39296e,_0x13bda9){return function(_0x219520){if(_0x219520){var _0x15179b=typeof _0x13bda9['offset']===_0x5986('0x18')&&typeof _0x13bda9[_0x5986('0x19')]===_0x5986('0x18');var _0x329212=_0x219520[_0x5986('0x1a')];var _0x5c0278=_0x15179b?0x0:_0x13bda9[_0x5986('0x1b')];var _0x626184=_0x15179b?_0x219520[_0x5986('0x1a')]:_0x13bda9[_0x5986('0x1b')]+_0x13bda9[_0x5986('0x19')];var _0x439d1c;if(_0x626184>=_0x329212){_0x626184=_0x329212;_0x439d1c=0xc8;}else{_0x439d1c=0xce;}_0x39296e[_0x5986('0x16')](_0x439d1c);return _0x39296e['set'](_0x5986('0x1c'),_0x5c0278+'-'+_0x626184+'/'+_0x329212)[_0x5986('0x1d')](_0x219520);}return null;};}function patchUpdates(_0x12d31a){return function(_0x4721c6){try{jsonpatch[_0x5986('0x1e')](_0x4721c6,_0x12d31a,!![]);}catch(_0x300f65){return BPromise[_0x5986('0x1f')](_0x300f65);}return _0x4721c6['save']();};}function saveUpdates(_0x1b609c,_0x2d4c7e){return function(_0x5555c0){if(_0x5555c0){return _0x5555c0['update'](_0x1b609c)[_0x5986('0x20')](function(_0x466898){return _0x466898;});}return null;};}function removeEntity(_0x16447d,_0x581766){return function(_0xd56b46){if(_0xd56b46){return _0xd56b46[_0x5986('0x21')]()[_0x5986('0x20')](function(){_0x16447d[_0x5986('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d8016,_0x1382e8){return function(_0x462657){if(!_0x462657){_0x1d8016['sendStatus'](0x194);}return _0x462657;};}function handleError(_0x2cae14,_0xd21cf9){_0xd21cf9=_0xd21cf9||0x1f4;return function(_0x1cd239){logger['error'](_0x1cd239['stack']);if(_0x1cd239[_0x5986('0x22')]){delete _0x1cd239[_0x5986('0x22')];}_0x2cae14[_0x5986('0x16')](_0xd21cf9)[_0x5986('0x23')](_0x1cd239);};}exports[_0x5986('0x24')]=function(_0xfd91a9,_0x4c9647){var _0x3dd17e={},_0x2449b6={},_0xc3aad4={'count':0x0,'rows':[]};var _0x1e40be=_[_0x5986('0x25')](db['Dynamics365Configuration'][_0x5986('0x26')],function(_0x1ae1aa){return{'name':_0x1ae1aa['fieldName'],'type':_0x1ae1aa[_0x5986('0x27')][_0x5986('0x28')]};});_0x2449b6[_0x5986('0x29')]=_['map'](_0x1e40be,_0x5986('0x22'));_0x2449b6[_0x5986('0x2a')]=_[_0x5986('0x2b')](_0xfd91a9['query']);_0x2449b6[_0x5986('0x2c')]=_[_0x5986('0x2d')](_0x2449b6[_0x5986('0x29')],_0x2449b6['query']);_0x3dd17e[_0x5986('0x2e')]=_[_0x5986('0x2d')](_0x2449b6['model'],qs[_0x5986('0x2f')](_0xfd91a9['query'][_0x5986('0x2f')]));_0x3dd17e['attributes']=_0x3dd17e[_0x5986('0x2e')][_0x5986('0x30')]?_0x3dd17e[_0x5986('0x2e')]:_0x2449b6['model'];if(!_0xfd91a9['query'][_0x5986('0x31')](_0x5986('0x32'))){_0x3dd17e[_0x5986('0x19')]=qs[_0x5986('0x19')](_0xfd91a9['query'][_0x5986('0x19')]);_0x3dd17e[_0x5986('0x1b')]=qs[_0x5986('0x1b')](_0xfd91a9[_0x5986('0x2a')][_0x5986('0x1b')]);}_0x3dd17e[_0x5986('0x33')]=qs[_0x5986('0x34')](_0xfd91a9[_0x5986('0x2a')][_0x5986('0x34')]);_0x3dd17e[_0x5986('0x35')]=qs['filters'](_[_0x5986('0x36')](_0xfd91a9[_0x5986('0x2a')],_0x2449b6['filters']),_0x1e40be);if(_0xfd91a9[_0x5986('0x2a')][_0x5986('0x37')]){_0x3dd17e[_0x5986('0x35')]=_[_0x5986('0x38')](_0x3dd17e['where'],{'$or':_[_0x5986('0x25')](_0x1e40be,function(_0x5022e2){if(_0x5022e2[_0x5986('0x27')]!==_0x5986('0x39')){var _0x20d640={};_0x20d640[_0x5022e2['name']]={'$like':'%'+_0xfd91a9[_0x5986('0x2a')][_0x5986('0x37')]+'%'};return _0x20d640;}})});}_0x3dd17e=_[_0x5986('0x38')]({},_0x3dd17e,_0xfd91a9[_0x5986('0x3a')]);var _0x30a728={'where':_0x3dd17e[_0x5986('0x35')]};return db['Dynamics365Configuration'][_0x5986('0x1a')](_0x30a728)[_0x5986('0x20')](function(_0x5ddfd1){_0xc3aad4[_0x5986('0x1a')]=_0x5ddfd1;if(_0xfd91a9[_0x5986('0x2a')][_0x5986('0x3b')]){_0x3dd17e[_0x5986('0x3c')]=[{'all':!![]}];}return db[_0x5986('0x3d')][_0x5986('0x3e')](_0x3dd17e);})[_0x5986('0x20')](function(_0x249ba0){_0xc3aad4[_0x5986('0x3f')]=_0x249ba0;return _0xc3aad4;})[_0x5986('0x20')](respondWithFilteredResult(_0x4c9647,_0x3dd17e))[_0x5986('0x40')](handleError(_0x4c9647,null));};exports[_0x5986('0x41')]=function(_0x235b55,_0x3b1454){var _0x1e8a2b={'raw':![],'where':{'id':_0x235b55[_0x5986('0x42')]['id']}},_0x10239e={};_0x10239e['model']=_['keys'](db[_0x5986('0x3d')][_0x5986('0x26')]);_0x10239e[_0x5986('0x2a')]=_['keys'](_0x235b55[_0x5986('0x2a')]);_0x10239e[_0x5986('0x2c')]=_[_0x5986('0x2d')](_0x10239e['model'],_0x10239e[_0x5986('0x2a')]);_0x1e8a2b['attributes']=_[_0x5986('0x2d')](_0x10239e[_0x5986('0x29')],qs['fields'](_0x235b55[_0x5986('0x2a')][_0x5986('0x2f')]));_0x1e8a2b[_0x5986('0x2e')]=_0x1e8a2b[_0x5986('0x2e')][_0x5986('0x30')]?_0x1e8a2b[_0x5986('0x2e')]:_0x10239e[_0x5986('0x29')];if(_0x235b55['query'][_0x5986('0x3b')]){_0x1e8a2b[_0x5986('0x3c')]=[{'all':!![]}];}_0x1e8a2b=_[_0x5986('0x38')]({},_0x1e8a2b,_0x235b55[_0x5986('0x3a')]);return db[_0x5986('0x3d')][_0x5986('0x43')](_0x1e8a2b)[_0x5986('0x20')](handleEntityNotFound(_0x3b1454,null))[_0x5986('0x20')](respondWithResult(_0x3b1454,null))['catch'](handleError(_0x3b1454,null));};exports[_0x5986('0x44')]=function(_0x46ca57,_0x520f30){return db['Dynamics365Configuration'][_0x5986('0x44')](_0x46ca57[_0x5986('0x45')],{})[_0x5986('0x20')](respondWithResult(_0x520f30,0xc9))[_0x5986('0x40')](handleError(_0x520f30,null));};exports[_0x5986('0x46')]=function(_0x27cfd4,_0x81846){if(_0x27cfd4[_0x5986('0x45')]['id']){delete _0x27cfd4[_0x5986('0x45')]['id'];}return db[_0x5986('0x3d')][_0x5986('0x43')]({'where':{'id':_0x27cfd4[_0x5986('0x42')]['id']}})[_0x5986('0x20')](handleEntityNotFound(_0x81846,null))['then'](saveUpdates(_0x27cfd4[_0x5986('0x45')],null))['then'](respondWithResult(_0x81846,null))[_0x5986('0x40')](handleError(_0x81846,null));};exports[_0x5986('0x21')]=function(_0x262060,_0x35f16a){return db[_0x5986('0x3d')][_0x5986('0x43')]({'where':{'id':_0x262060[_0x5986('0x42')]['id']}})[_0x5986('0x20')](handleEntityNotFound(_0x35f16a,null))[_0x5986('0x20')](removeEntity(_0x35f16a,null))[_0x5986('0x40')](handleError(_0x35f16a,null));};exports[_0x5986('0x47')]=function(_0x5300f1,_0xb2a99,_0xf38e53){var _0x20ecd7={};var _0x54a57b={};var _0x318bbe;var _0x103122;return db[_0x5986('0x3d')]['findOne']({'where':{'id':_0x5300f1['params']['id']}})[_0x5986('0x20')](handleEntityNotFound(_0xb2a99,null))[_0x5986('0x20')](function(_0x2bd560){if(_0x2bd560){_0x318bbe=_0x2bd560;_0x54a57b['model']=_[_0x5986('0x2b')](db[_0x5986('0x48')][_0x5986('0x26')]);_0x54a57b[_0x5986('0x2a')]=_[_0x5986('0x2b')](_0x5300f1[_0x5986('0x2a')]);_0x54a57b[_0x5986('0x2c')]=_[_0x5986('0x2d')](_0x54a57b[_0x5986('0x29')],_0x54a57b[_0x5986('0x2a')]);_0x20ecd7['attributes']=_['intersection'](_0x54a57b[_0x5986('0x29')],qs[_0x5986('0x2f')](_0x5300f1[_0x5986('0x2a')]['fields']));_0x20ecd7['attributes']=_0x20ecd7[_0x5986('0x2e')][_0x5986('0x30')]?_0x20ecd7[_0x5986('0x2e')]:_0x54a57b[_0x5986('0x29')];_0x20ecd7[_0x5986('0x33')]=qs[_0x5986('0x34')](_0x5300f1['query'][_0x5986('0x34')]);_0x20ecd7[_0x5986('0x35')]=qs[_0x5986('0x2c')](_[_0x5986('0x36')](_0x5300f1[_0x5986('0x2a')],_0x54a57b[_0x5986('0x2c')]));if(_0x5300f1[_0x5986('0x2a')][_0x5986('0x37')]){_0x20ecd7[_0x5986('0x35')]=_[_0x5986('0x38')](_0x20ecd7[_0x5986('0x35')],{'$or':_[_0x5986('0x25')](_0x20ecd7[_0x5986('0x2e')],function(_0x506277){var _0x244faa={};_0x244faa[_0x506277]={'$like':'%'+_0x5300f1['query'][_0x5986('0x37')]+'%'};return _0x244faa;})});}_0x20ecd7=_['merge']({},_0x20ecd7,_0x5300f1[_0x5986('0x3a')]);return _0x318bbe[_0x5986('0x47')](_0x20ecd7);}})[_0x5986('0x20')](function(_0x34422e){if(_0x34422e){_0x103122=_0x34422e[_0x5986('0x30')];if(!_0x5300f1[_0x5986('0x2a')][_0x5986('0x31')]('nolimit')){_0x20ecd7[_0x5986('0x19')]=qs['limit'](_0x5300f1[_0x5986('0x2a')][_0x5986('0x19')]);_0x20ecd7['offset']=qs[_0x5986('0x1b')](_0x5300f1[_0x5986('0x2a')][_0x5986('0x1b')]);}return _0x318bbe[_0x5986('0x47')](_0x20ecd7);}})['then'](function(_0xec5660){if(_0xec5660){return _0xec5660?{'count':_0x103122,'rows':_0xec5660}:null;}})[_0x5986('0x20')](respondWithResult(_0xb2a99,null))[_0x5986('0x40')](handleError(_0xb2a99,null));};exports[_0x5986('0x49')]=function(_0x5c4448,_0x3cb50b,_0x1525d0){var _0x2fc314={};var _0x12a87a={};var _0x5f2924;var _0xc4d11a;return db[_0x5986('0x3d')][_0x5986('0x4a')]({'where':{'id':_0x5c4448[_0x5986('0x42')]['id']}})[_0x5986('0x20')](handleEntityNotFound(_0x3cb50b,null))[_0x5986('0x20')](function(_0x1bef4c){if(_0x1bef4c){_0x5f2924=_0x1bef4c;_0x12a87a[_0x5986('0x29')]=_[_0x5986('0x2b')](db['Dynamics365Field'][_0x5986('0x26')]);_0x12a87a[_0x5986('0x2a')]=_['keys'](_0x5c4448[_0x5986('0x2a')]);_0x12a87a['filters']=_['intersection'](_0x12a87a[_0x5986('0x29')],_0x12a87a['query']);_0x2fc314[_0x5986('0x2e')]=_['intersection'](_0x12a87a['model'],qs[_0x5986('0x2f')](_0x5c4448[_0x5986('0x2a')][_0x5986('0x2f')]));_0x2fc314[_0x5986('0x2e')]=_0x2fc314[_0x5986('0x2e')][_0x5986('0x30')]?_0x2fc314[_0x5986('0x2e')]:_0x12a87a[_0x5986('0x29')];_0x2fc314[_0x5986('0x33')]=qs['sort'](_0x5c4448[_0x5986('0x2a')]['sort']);_0x2fc314[_0x5986('0x35')]=qs[_0x5986('0x2c')](_[_0x5986('0x36')](_0x5c4448[_0x5986('0x2a')],_0x12a87a[_0x5986('0x2c')]));if(_0x5c4448[_0x5986('0x2a')][_0x5986('0x37')]){_0x2fc314[_0x5986('0x35')]=_[_0x5986('0x38')](_0x2fc314['where'],{'$or':_[_0x5986('0x25')](_0x2fc314[_0x5986('0x2e')],function(_0x31061c){var _0x253539={};_0x253539[_0x31061c]={'$like':'%'+_0x5c4448['query'][_0x5986('0x37')]+'%'};return _0x253539;})});}_0x2fc314=_[_0x5986('0x38')]({},_0x2fc314,_0x5c4448[_0x5986('0x3a')]);return _0x5f2924['getSubjects'](_0x2fc314);}})[_0x5986('0x20')](function(_0x415a6b){if(_0x415a6b){_0xc4d11a=_0x415a6b[_0x5986('0x30')];if(!_0x5c4448[_0x5986('0x2a')][_0x5986('0x31')](_0x5986('0x32'))){_0x2fc314[_0x5986('0x19')]=qs[_0x5986('0x19')](_0x5c4448['query'][_0x5986('0x19')]);_0x2fc314[_0x5986('0x1b')]=qs[_0x5986('0x1b')](_0x5c4448[_0x5986('0x2a')]['offset']);}return _0x5f2924[_0x5986('0x49')](_0x2fc314);}})[_0x5986('0x20')](function(_0x121c2c){if(_0x121c2c){return _0x121c2c?{'count':_0xc4d11a,'rows':_0x121c2c}:null;}})['then'](respondWithResult(_0x3cb50b,null))[_0x5986('0x40')](handleError(_0x3cb50b,null));};exports[_0x5986('0x4b')]=function(_0x37012d,_0x331f58,_0x4a522e){var _0x171088={};var _0x417bf9={};var _0x2a1d57;var _0x53068f;return db[_0x5986('0x3d')][_0x5986('0x4a')]({'where':{'id':_0x37012d['params']['id']}})['then'](handleEntityNotFound(_0x331f58,null))[_0x5986('0x20')](function(_0x249a41){if(_0x249a41){_0x2a1d57=_0x249a41;_0x417bf9['model']=_[_0x5986('0x2b')](db[_0x5986('0x48')]['rawAttributes']);_0x417bf9[_0x5986('0x2a')]=_['keys'](_0x37012d[_0x5986('0x2a')]);_0x417bf9[_0x5986('0x2c')]=_['intersection'](_0x417bf9[_0x5986('0x29')],_0x417bf9[_0x5986('0x2a')]);_0x171088[_0x5986('0x2e')]=_[_0x5986('0x2d')](_0x417bf9[_0x5986('0x29')],qs['fields'](_0x37012d[_0x5986('0x2a')]['fields']));_0x171088['attributes']=_0x171088[_0x5986('0x2e')][_0x5986('0x30')]?_0x171088[_0x5986('0x2e')]:_0x417bf9[_0x5986('0x29')];_0x171088['order']=qs[_0x5986('0x34')](_0x37012d[_0x5986('0x2a')][_0x5986('0x34')]);_0x171088[_0x5986('0x35')]=qs[_0x5986('0x2c')](_[_0x5986('0x36')](_0x37012d['query'],_0x417bf9[_0x5986('0x2c')]));if(_0x37012d[_0x5986('0x2a')][_0x5986('0x37')]){_0x171088[_0x5986('0x35')]=_[_0x5986('0x38')](_0x171088[_0x5986('0x35')],{'$or':_[_0x5986('0x25')](_0x171088[_0x5986('0x2e')],function(_0x179f2e){var _0x182c96={};_0x182c96[_0x179f2e]={'$like':'%'+_0x37012d[_0x5986('0x2a')][_0x5986('0x37')]+'%'};return _0x182c96;})});}_0x171088=_[_0x5986('0x38')]({},_0x171088,_0x37012d[_0x5986('0x3a')]);return _0x2a1d57[_0x5986('0x4b')](_0x171088);}})[_0x5986('0x20')](function(_0x1c6fb8){if(_0x1c6fb8){_0x53068f=_0x1c6fb8[_0x5986('0x30')];if(!_0x37012d[_0x5986('0x2a')]['hasOwnProperty'](_0x5986('0x32'))){_0x171088[_0x5986('0x19')]=qs[_0x5986('0x19')](_0x37012d['query']['limit']);_0x171088['offset']=qs[_0x5986('0x1b')](_0x37012d[_0x5986('0x2a')][_0x5986('0x1b')]);}return _0x2a1d57[_0x5986('0x4b')](_0x171088);}})[_0x5986('0x20')](function(_0x142907){if(_0x142907){return _0x142907?{'count':_0x53068f,'rows':_0x142907}:null;}})[_0x5986('0x20')](respondWithResult(_0x331f58,null))[_0x5986('0x40')](handleError(_0x331f58,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 4726133..3a1b966 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 _0xa9e0=['../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x12a9b3,_0x536e5a){var _0x5ad239=function(_0xb13216){while(--_0xb13216){_0x12a9b3['push'](_0x12a9b3['shift']());}};_0x5ad239(++_0x536e5a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x2d8808,_0x331af0){var _0xc506b8=function(_0x639c6){while(--_0x639c6){_0x2d8808['push'](_0x2d8808['shift']());}};_0xc506b8(++_0x331af0);}(_0x9f62,0x154));var _0x29f6=function(_0x1b64eb,_0x58b40e){_0x1b64eb=_0x1b64eb-0x0;var _0x468175=_0x9f62[_0x1b64eb];return _0x468175;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 29774f9..b95d075 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 _0x55e6=['stringify','code','error','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x55e6,0x13d));var _0x655e=function(_0x2f6165,_0x1cfce3){_0x2f6165=_0x2f6165-0x0;var _0x1ab548=_0x55e6[_0x2f6165];return _0x1ab548;};'use strict';var _=require(_0x655e('0x0'));var util=require(_0x655e('0x1'));var moment=require(_0x655e('0x2'));var BPromise=require('bluebird');var rs=require(_0x655e('0x3'));var fs=require('fs');var Redis=require(_0x655e('0x4'));var db=require(_0x655e('0x5'))['db'];var utils=require(_0x655e('0x6'));var logger=require(_0x655e('0x7'))(_0x655e('0x8'));var config=require(_0x655e('0x9'));var jayson=require(_0x655e('0xa'));var client=jayson[_0x655e('0xb')][_0x655e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7ee7fd,_0x45d2b1,_0xc574a4){return new BPromise(function(_0x39ba59,_0x52ed03){return client[_0x655e('0xd')](_0x7ee7fd,_0xc574a4)[_0x655e('0xe')](function(_0x3f3bc5){logger[_0x655e('0xf')](_0x655e('0x10'),_0x45d2b1,_0x655e('0x11'));logger['debug'](_0x655e('0x12'),_0x45d2b1,_0x655e('0x11'),JSON[_0x655e('0x13')](_0x3f3bc5));if(_0x3f3bc5['error']){if(_0x3f3bc5['error'][_0x655e('0x14')]===0x1f4){logger[_0x655e('0x15')](_0x655e('0x10'),_0x45d2b1,_0x3f3bc5[_0x655e('0x15')][_0x655e('0x16')]);return _0x52ed03(_0x3f3bc5[_0x655e('0x15')][_0x655e('0x16')]);}logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x45d2b1,_0x3f3bc5[_0x655e('0x15')]['message']);return _0x39ba59(_0x3f3bc5[_0x655e('0x15')]['message']);}else{logger[_0x655e('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x45d2b1,_0x655e('0x11'));_0x39ba59(_0x3f3bc5['result'][_0x655e('0x16')]);}})[_0x655e('0x17')](function(_0x2a9376){logger['error']('Dynamics365Configuration,\x20%s,\x20%s',_0x45d2b1,_0x2a9376);_0x52ed03(_0x2a9376);});});} \ No newline at end of file +var _0xd57d=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','message','catch','lodash','util','bluebird'];(function(_0x8c8577,_0x445e4b){var _0x23a126=function(_0x5df004){while(--_0x5df004){_0x8c8577['push'](_0x8c8577['shift']());}};_0x23a126(++_0x445e4b);}(_0xd57d,0x66));var _0xdd57=function(_0x2fd506,_0x3c8662){_0x2fd506=_0x2fd506-0x0;var _0x2a8b09=_0xd57d[_0x2fd506];return _0x2a8b09;};'use strict';var _=require(_0xdd57('0x0'));var util=require(_0xdd57('0x1'));var moment=require('moment');var BPromise=require(_0xdd57('0x2'));var rs=require(_0xdd57('0x3'));var fs=require('fs');var Redis=require(_0xdd57('0x4'));var db=require(_0xdd57('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdd57('0x6'))(_0xdd57('0x7'));var config=require(_0xdd57('0x8'));var jayson=require(_0xdd57('0x9'));var client=jayson[_0xdd57('0xa')][_0xdd57('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x304924,_0x400c17,_0x430c1c){return new BPromise(function(_0x57ccc0,_0x592724){return client[_0xdd57('0xc')](_0x304924,_0x430c1c)[_0xdd57('0xd')](function(_0x5a305b){logger[_0xdd57('0xe')](_0xdd57('0xf'),_0x400c17,_0xdd57('0x10'));logger['debug'](_0xdd57('0x11'),_0x400c17,_0xdd57('0x10'),JSON['stringify'](_0x5a305b));if(_0x5a305b[_0xdd57('0x12')]){if(_0x5a305b['error']['code']===0x1f4){logger[_0xdd57('0x12')](_0xdd57('0xf'),_0x400c17,_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);return _0x592724(_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);}logger[_0xdd57('0x12')](_0xdd57('0xf'),_0x400c17,_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);return _0x57ccc0(_0x5a305b[_0xdd57('0x12')][_0xdd57('0x13')]);}else{logger['info'](_0xdd57('0xf'),_0x400c17,_0xdd57('0x10'));_0x57ccc0(_0x5a305b['result'][_0xdd57('0x13')]);}})[_0xdd57('0x14')](function(_0x2ca61c){logger['error'](_0xdd57('0xf'),_0x400c17,_0x2ca61c);_0x592724(_0x2ca61c);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8fcbf20..034aa7c 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 _0xb897=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDynamics365Field.controller','index','/:id','isAuthenticated','show','post','create','put','delete','destroy','exports','multer'];(function(_0xf50ef1,_0x181c47){var _0x52a06b=function(_0x57df28){while(--_0x57df28){_0xf50ef1['push'](_0xf50ef1['shift']());}};_0x52a06b(++_0x181c47);}(_0xb897,0x98));var _0x7b89=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xb897[_0x376b45];return _0x2341b3;};'use strict';var multer=require(_0x7b89('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b89('0x1'));var express=require(_0x7b89('0x2'));var router=express[_0x7b89('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7b89('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7b89('0x5'));var controller=require(_0x7b89('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7b89('0x7')]);router['get'](_0x7b89('0x8'),auth[_0x7b89('0x9')](),controller[_0x7b89('0xa')]);router[_0x7b89('0xb')]('/',auth[_0x7b89('0x9')](),controller[_0x7b89('0xc')]);router[_0x7b89('0xd')](_0x7b89('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x7b89('0xe')](_0x7b89('0x8'),auth[_0x7b89('0x9')](),controller[_0x7b89('0xf')]);module[_0x7b89('0x10')]=router; \ No newline at end of file +var _0xe80d=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get'];(function(_0x37ded3,_0x371ebb){var _0x51e49e=function(_0x30cc78){while(--_0x30cc78){_0x37ded3['push'](_0x37ded3['shift']());}};_0x51e49e(++_0x371ebb);}(_0xe80d,0xe6));var _0xde80=function(_0x20f08b,_0x646ea0){_0x20f08b=_0x20f08b-0x0;var _0x675062=_0xe80d[_0x20f08b];return _0x675062;};'use strict';var multer=require(_0xde80('0x0'));var util=require(_0xde80('0x1'));var path=require(_0xde80('0x2'));var timeout=require(_0xde80('0x3'));var express=require(_0xde80('0x4'));var router=express[_0xde80('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xde80('0x6'));var interaction=require(_0xde80('0x7'));var config=require('../../config/environment');var controller=require(_0xde80('0x8'));router[_0xde80('0x9')]('/',auth[_0xde80('0xa')](),controller[_0xde80('0xb')]);router[_0xde80('0x9')](_0xde80('0xc'),auth[_0xde80('0xa')](),controller[_0xde80('0xd')]);router[_0xde80('0xe')]('/',auth['isAuthenticated'](),controller[_0xde80('0xf')]);router[_0xde80('0x10')](_0xde80('0xc'),auth[_0xde80('0xa')](),controller['update']);router[_0xde80('0x11')](_0xde80('0xc'),auth[_0xde80('0xa')](),controller[_0xde80('0x12')]);module[_0xde80('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 598927d..1161213 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 _0xe5c9=['picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue'];(function(_0x517ad3,_0x6181f5){var _0x4dbff4=function(_0x10f378){while(--_0x10f378){_0x517ad3['push'](_0x517ad3['shift']());}};_0x4dbff4(++_0x6181f5);}(_0xe5c9,0x9a));var _0x9e5c=function(_0x3cd21f,_0x201261){_0x3cd21f=_0x3cd21f-0x0;var _0x50d4fd=_0xe5c9[_0x3cd21f];return _0x50d4fd;};'use strict';var Sequelize=require(_0x9e5c('0x0'));module[_0x9e5c('0x1')]={'type':{'type':Sequelize[_0x9e5c('0x2')](_0x9e5c('0x3'),'variable',_0x9e5c('0x4'),_0x9e5c('0x5'),_0x9e5c('0x6')),'defaultValue':_0x9e5c('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9e5c('0x7')]},'keyType':{'type':Sequelize[_0x9e5c('0x2')](_0x9e5c('0x3'),_0x9e5c('0x8'),_0x9e5c('0x4'))},'keyContent':{'type':Sequelize[_0x9e5c('0x7')]},'idField':{'type':Sequelize[_0x9e5c('0x7')]},'nameField':{'type':Sequelize[_0x9e5c('0x7')]},'customField':{'type':Sequelize[_0x9e5c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9e5c('0x7')]}}; \ No newline at end of file +var _0xcead=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x2ade6c,_0x2d42f2){var _0x2cb372=function(_0x477d8a){while(--_0x477d8a){_0x2ade6c['push'](_0x2ade6c['shift']());}};_0x2cb372(++_0x2d42f2);}(_0xcead,0x15f));var _0xdcea=function(_0x2c796a,_0x1b7360){_0x2c796a=_0x2c796a-0x0;var _0x434192=_0xcead[_0x2c796a];return _0x434192;};'use strict';var Sequelize=require(_0xdcea('0x0'));module['exports']={'type':{'type':Sequelize[_0xdcea('0x1')](_0xdcea('0x2'),_0xdcea('0x3'),_0xdcea('0x4'),_0xdcea('0x5'),_0xdcea('0x6')),'defaultValue':_0xdcea('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xdcea('0x1')]('string',_0xdcea('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xdcea('0x7')]},'idField':{'type':Sequelize[_0xdcea('0x7')]},'nameField':{'type':Sequelize[_0xdcea('0x7')]},'customField':{'type':Sequelize[_0xdcea('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdcea('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 5feb430..02d6e96 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 _0x0285=['filters','pick','filter','merge','VIRTUAL','options','Dynamics365Field','includeAll','include','findAll','catch','show','find','create','body','destroy','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','error','stack','name','send','map','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x10773a,_0x12abf1){var _0x20731f=function(_0x561fdb){while(--_0x561fdb){_0x10773a['push'](_0x10773a['shift']());}};_0x20731f(++_0x12abf1);}(_0x0285,0x1e6));var _0x5028=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0x0285[_0x4c0d2b];return _0x58c4fe;};'use strict';var emlformat=require(_0x5028('0x0'));var rimraf=require(_0x5028('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5028('0x2'));var rp=require(_0x5028('0x3'));var moment=require(_0x5028('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5028('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5028('0x6'));var csv=require(_0x5028('0x7'));var ejs=require(_0x5028('0x8'));var fs=require('fs');var fs_extra=require(_0x5028('0x9'));var _=require(_0x5028('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5028('0xb'));var toCsv=require(_0x5028('0x7'));var querystring=require(_0x5028('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5028('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5028('0xe'));var logger=require(_0x5028('0xf'))('api');var utils=require(_0x5028('0x10'));var config=require(_0x5028('0x11'));var licenseUtil=require(_0x5028('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4af926,_0x483891){_0x483891=_0x483891||0xcc;return function(_0x2c94e8){if(_0x2c94e8){return _0x4af926[_0x5028('0x13')](_0x483891);}return _0x4af926[_0x5028('0x14')](_0x483891)[_0x5028('0x15')]();};}function respondWithResult(_0x4cb21f,_0x4437c6){_0x4437c6=_0x4437c6||0xc8;return function(_0x478969){if(_0x478969){return _0x4cb21f[_0x5028('0x14')](_0x4437c6)['json'](_0x478969);}};}function respondWithFilteredResult(_0x3d6772,_0x32ee70){return function(_0x3a19ff){if(_0x3a19ff){var _0xdae385=typeof _0x32ee70[_0x5028('0x16')]===_0x5028('0x17')&&typeof _0x32ee70[_0x5028('0x18')]===_0x5028('0x17');var _0x37e44b=_0x3a19ff[_0x5028('0x19')];var _0x159fed=_0xdae385?0x0:_0x32ee70[_0x5028('0x16')];var _0x4d0970=_0xdae385?_0x3a19ff['count']:_0x32ee70[_0x5028('0x16')]+_0x32ee70[_0x5028('0x18')];var _0x54de0a;if(_0x4d0970>=_0x37e44b){_0x4d0970=_0x37e44b;_0x54de0a=0xc8;}else{_0x54de0a=0xce;}_0x3d6772[_0x5028('0x14')](_0x54de0a);return _0x3d6772['set'](_0x5028('0x1a'),_0x159fed+'-'+_0x4d0970+'/'+_0x37e44b)[_0x5028('0x1b')](_0x3a19ff);}return null;};}function patchUpdates(_0x35fd1a){return function(_0x4175d6){try{jsonpatch['apply'](_0x4175d6,_0x35fd1a,!![]);}catch(_0x38cd70){return BPromise[_0x5028('0x1c')](_0x38cd70);}return _0x4175d6[_0x5028('0x1d')]();};}function saveUpdates(_0x7cc96f,_0x34cfea){return function(_0x55912e){if(_0x55912e){return _0x55912e[_0x5028('0x1e')](_0x7cc96f)[_0x5028('0x1f')](function(_0x3fcd1e){return _0x3fcd1e;});}return null;};}function removeEntity(_0x30c57f,_0x58a202){return function(_0x43e156){if(_0x43e156){return _0x43e156['destroy']()[_0x5028('0x1f')](function(){_0x30c57f['status'](0xcc)[_0x5028('0x15')]();});}};}function handleEntityNotFound(_0x5c4fd9,_0x4deb0d){return function(_0x9e8ff7){if(!_0x9e8ff7){_0x5c4fd9[_0x5028('0x13')](0x194);}return _0x9e8ff7;};}function handleError(_0x1ce540,_0x3e4d1c){_0x3e4d1c=_0x3e4d1c||0x1f4;return function(_0x4eb775){logger[_0x5028('0x20')](_0x4eb775[_0x5028('0x21')]);if(_0x4eb775[_0x5028('0x22')]){delete _0x4eb775['name'];}_0x1ce540[_0x5028('0x14')](_0x3e4d1c)[_0x5028('0x23')](_0x4eb775);};}exports['index']=function(_0x18eb2c,_0x85321c){var _0x106b88={},_0x3b63e3={},_0x5608c4={'count':0x0,'rows':[]};var _0x379010=_[_0x5028('0x24')](db['Dynamics365Field']['rawAttributes'],function(_0x4d12ef){return{'name':_0x4d12ef[_0x5028('0x25')],'type':_0x4d12ef['type'][_0x5028('0x26')]};});_0x3b63e3[_0x5028('0x27')]=_[_0x5028('0x24')](_0x379010,_0x5028('0x22'));_0x3b63e3[_0x5028('0x28')]=_[_0x5028('0x29')](_0x18eb2c['query']);_0x3b63e3['filters']=_[_0x5028('0x2a')](_0x3b63e3[_0x5028('0x27')],_0x3b63e3[_0x5028('0x28')]);_0x106b88['attributes']=_[_0x5028('0x2a')](_0x3b63e3[_0x5028('0x27')],qs[_0x5028('0x2b')](_0x18eb2c[_0x5028('0x28')]['fields']));_0x106b88[_0x5028('0x2c')]=_0x106b88[_0x5028('0x2c')][_0x5028('0x2d')]?_0x106b88[_0x5028('0x2c')]:_0x3b63e3[_0x5028('0x27')];if(!_0x18eb2c[_0x5028('0x28')][_0x5028('0x2e')]('nolimit')){_0x106b88['limit']=qs['limit'](_0x18eb2c[_0x5028('0x28')][_0x5028('0x18')]);_0x106b88['offset']=qs[_0x5028('0x16')](_0x18eb2c[_0x5028('0x28')][_0x5028('0x16')]);}_0x106b88[_0x5028('0x2f')]=qs['sort'](_0x18eb2c['query'][_0x5028('0x30')]);_0x106b88[_0x5028('0x31')]=qs[_0x5028('0x32')](_[_0x5028('0x33')](_0x18eb2c[_0x5028('0x28')],_0x3b63e3['filters']),_0x379010);if(_0x18eb2c[_0x5028('0x28')][_0x5028('0x34')]){_0x106b88[_0x5028('0x31')]=_[_0x5028('0x35')](_0x106b88['where'],{'$or':_[_0x5028('0x24')](_0x379010,function(_0x3e8d7e){if(_0x3e8d7e['type']!==_0x5028('0x36')){var _0x2c1233={};_0x2c1233[_0x3e8d7e[_0x5028('0x22')]]={'$like':'%'+_0x18eb2c[_0x5028('0x28')]['filter']+'%'};return _0x2c1233;}})});}_0x106b88=_[_0x5028('0x35')]({},_0x106b88,_0x18eb2c[_0x5028('0x37')]);var _0x3fef14={'where':_0x106b88[_0x5028('0x31')]};return db[_0x5028('0x38')]['count'](_0x3fef14)[_0x5028('0x1f')](function(_0xa59f97){_0x5608c4['count']=_0xa59f97;if(_0x18eb2c[_0x5028('0x28')][_0x5028('0x39')]){_0x106b88[_0x5028('0x3a')]=[{'all':!![]}];}return db[_0x5028('0x38')][_0x5028('0x3b')](_0x106b88);})[_0x5028('0x1f')](function(_0x369fbe){_0x5608c4['rows']=_0x369fbe;return _0x5608c4;})[_0x5028('0x1f')](respondWithFilteredResult(_0x85321c,_0x106b88))[_0x5028('0x3c')](handleError(_0x85321c,null));};exports[_0x5028('0x3d')]=function(_0x360a18,_0x58e801){var _0x50df6e={'raw':!![],'where':{'id':_0x360a18['params']['id']}},_0xf5c4de={};_0xf5c4de[_0x5028('0x27')]=_[_0x5028('0x29')](db[_0x5028('0x38')]['rawAttributes']);_0xf5c4de[_0x5028('0x28')]=_[_0x5028('0x29')](_0x360a18[_0x5028('0x28')]);_0xf5c4de[_0x5028('0x32')]=_[_0x5028('0x2a')](_0xf5c4de[_0x5028('0x27')],_0xf5c4de['query']);_0x50df6e[_0x5028('0x2c')]=_[_0x5028('0x2a')](_0xf5c4de[_0x5028('0x27')],qs['fields'](_0x360a18[_0x5028('0x28')][_0x5028('0x2b')]));_0x50df6e['attributes']=_0x50df6e[_0x5028('0x2c')][_0x5028('0x2d')]?_0x50df6e[_0x5028('0x2c')]:_0xf5c4de[_0x5028('0x27')];if(_0x360a18[_0x5028('0x28')][_0x5028('0x39')]){_0x50df6e[_0x5028('0x3a')]=[{'all':!![]}];}_0x50df6e=_[_0x5028('0x35')]({},_0x50df6e,_0x360a18[_0x5028('0x37')]);return db[_0x5028('0x38')][_0x5028('0x3e')](_0x50df6e)[_0x5028('0x1f')](handleEntityNotFound(_0x58e801,null))[_0x5028('0x1f')](respondWithResult(_0x58e801,null))['catch'](handleError(_0x58e801,null));};exports['create']=function(_0x5e09fc,_0x50a151){return db[_0x5028('0x38')][_0x5028('0x3f')](_0x5e09fc[_0x5028('0x40')],{})[_0x5028('0x1f')](respondWithResult(_0x50a151,0xc9))[_0x5028('0x3c')](handleError(_0x50a151,null));};exports[_0x5028('0x1e')]=function(_0x4b804c,_0x531522){if(_0x4b804c['body']['id']){delete _0x4b804c['body']['id'];}return db[_0x5028('0x38')][_0x5028('0x3e')]({'where':{'id':_0x4b804c['params']['id']}})[_0x5028('0x1f')](handleEntityNotFound(_0x531522,null))[_0x5028('0x1f')](saveUpdates(_0x4b804c[_0x5028('0x40')],null))[_0x5028('0x1f')](respondWithResult(_0x531522,null))[_0x5028('0x3c')](handleError(_0x531522,null));};exports[_0x5028('0x41')]=function(_0x412959,_0x484084){return db[_0x5028('0x38')][_0x5028('0x3e')]({'where':{'id':_0x412959[_0x5028('0x42')]['id']}})[_0x5028('0x1f')](handleEntityNotFound(_0x484084,null))['then'](removeEntity(_0x484084,null))[_0x5028('0x3c')](handleError(_0x484084,null));}; \ No newline at end of file +var _0xd8dc=['rawAttributes','fieldName','key','model','map','query','filters','attributes','fields','length','nolimit','order','sort','where','type','filter','merge','options','then','includeAll','findAll','show','params','keys','intersection','include','create','body','find','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','stack','name','send','Dynamics365Field'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd8dc,0x163));var _0xcd8d=function(_0x430a36,_0x3ede38){_0x430a36=_0x430a36-0x0;var _0x6e4889=_0xd8dc[_0x430a36];return _0x6e4889;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd8d('0x0'));var zipdir=require(_0xcd8d('0x1'));var jsonpatch=require(_0xcd8d('0x2'));var rp=require('request-promise');var moment=require(_0xcd8d('0x3'));var BPromise=require(_0xcd8d('0x4'));var Mustache=require('mustache');var util=require(_0xcd8d('0x5'));var path=require(_0xcd8d('0x6'));var sox=require(_0xcd8d('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd8d('0x8'));var _=require('lodash');var squel=require(_0xcd8d('0x9'));var crypto=require(_0xcd8d('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcd8d('0xb'));var toCsv=require(_0xcd8d('0xc'));var querystring=require('querystring');var Papa=require(_0xcd8d('0xd'));var Redis=require(_0xcd8d('0xe'));var authService=require(_0xcd8d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcd8d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd8d('0x11'))(_0xcd8d('0x12'));var utils=require('../../config/utils');var config=require(_0xcd8d('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xcbd1ae,_0x49874a){_0x49874a=_0x49874a||0xcc;return function(_0x3ddca3){if(_0x3ddca3){return _0xcbd1ae[_0xcd8d('0x14')](_0x49874a);}return _0xcbd1ae[_0xcd8d('0x15')](_0x49874a)['end']();};}function respondWithResult(_0x8477a7,_0xeb8b56){_0xeb8b56=_0xeb8b56||0xc8;return function(_0x435e0e){if(_0x435e0e){return _0x8477a7[_0xcd8d('0x15')](_0xeb8b56)[_0xcd8d('0x16')](_0x435e0e);}};}function respondWithFilteredResult(_0x4b95cf,_0x5e10ae){return function(_0x344824){if(_0x344824){var _0x4e3c2d=typeof _0x5e10ae[_0xcd8d('0x17')]===_0xcd8d('0x18')&&typeof _0x5e10ae[_0xcd8d('0x19')]===_0xcd8d('0x18');var _0xeed85d=_0x344824[_0xcd8d('0x1a')];var _0x1b8abf=_0x4e3c2d?0x0:_0x5e10ae[_0xcd8d('0x17')];var _0x107456=_0x4e3c2d?_0x344824[_0xcd8d('0x1a')]:_0x5e10ae[_0xcd8d('0x17')]+_0x5e10ae[_0xcd8d('0x19')];var _0x53f32a;if(_0x107456>=_0xeed85d){_0x107456=_0xeed85d;_0x53f32a=0xc8;}else{_0x53f32a=0xce;}_0x4b95cf[_0xcd8d('0x15')](_0x53f32a);return _0x4b95cf['set']('Content-Range',_0x1b8abf+'-'+_0x107456+'/'+_0xeed85d)[_0xcd8d('0x16')](_0x344824);}return null;};}function patchUpdates(_0x27bcd6){return function(_0x1461b2){try{jsonpatch['apply'](_0x1461b2,_0x27bcd6,!![]);}catch(_0x3859d8){return BPromise[_0xcd8d('0x1b')](_0x3859d8);}return _0x1461b2[_0xcd8d('0x1c')]();};}function saveUpdates(_0x40a673,_0x30bad2){return function(_0x66718a){if(_0x66718a){return _0x66718a[_0xcd8d('0x1d')](_0x40a673)['then'](function(_0x543531){return _0x543531;});}return null;};}function removeEntity(_0x54a235,_0xec79c2){return function(_0x248497){if(_0x248497){return _0x248497[_0xcd8d('0x1e')]()['then'](function(){_0x54a235[_0xcd8d('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x153467,_0x800ce0){return function(_0x5bfee0){if(!_0x5bfee0){_0x153467[_0xcd8d('0x14')](0x194);}return _0x5bfee0;};}function handleError(_0x541734,_0x5602e9){_0x5602e9=_0x5602e9||0x1f4;return function(_0x43cddc){logger['error'](_0x43cddc[_0xcd8d('0x1f')]);if(_0x43cddc[_0xcd8d('0x20')]){delete _0x43cddc['name'];}_0x541734[_0xcd8d('0x15')](_0x5602e9)[_0xcd8d('0x21')](_0x43cddc);};}exports['index']=function(_0x10870f,_0x505585){var _0x1b2221={},_0xc82418={},_0x3d2d56={'count':0x0,'rows':[]};var _0x4618c4=_['map'](db[_0xcd8d('0x22')][_0xcd8d('0x23')],function(_0x23ef1d){return{'name':_0x23ef1d[_0xcd8d('0x24')],'type':_0x23ef1d['type'][_0xcd8d('0x25')]};});_0xc82418[_0xcd8d('0x26')]=_[_0xcd8d('0x27')](_0x4618c4,_0xcd8d('0x20'));_0xc82418[_0xcd8d('0x28')]=_['keys'](_0x10870f[_0xcd8d('0x28')]);_0xc82418[_0xcd8d('0x29')]=_['intersection'](_0xc82418[_0xcd8d('0x26')],_0xc82418[_0xcd8d('0x28')]);_0x1b2221[_0xcd8d('0x2a')]=_['intersection'](_0xc82418[_0xcd8d('0x26')],qs[_0xcd8d('0x2b')](_0x10870f['query'][_0xcd8d('0x2b')]));_0x1b2221[_0xcd8d('0x2a')]=_0x1b2221[_0xcd8d('0x2a')][_0xcd8d('0x2c')]?_0x1b2221['attributes']:_0xc82418[_0xcd8d('0x26')];if(!_0x10870f['query']['hasOwnProperty'](_0xcd8d('0x2d'))){_0x1b2221[_0xcd8d('0x19')]=qs['limit'](_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x19')]);_0x1b2221[_0xcd8d('0x17')]=qs['offset'](_0x10870f['query'][_0xcd8d('0x17')]);}_0x1b2221[_0xcd8d('0x2e')]=qs[_0xcd8d('0x2f')](_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x2f')]);_0x1b2221['where']=qs[_0xcd8d('0x29')](_['pick'](_0x10870f['query'],_0xc82418[_0xcd8d('0x29')]),_0x4618c4);if(_0x10870f[_0xcd8d('0x28')]['filter']){_0x1b2221[_0xcd8d('0x30')]=_['merge'](_0x1b2221['where'],{'$or':_[_0xcd8d('0x27')](_0x4618c4,function(_0x4193af){if(_0x4193af[_0xcd8d('0x31')]!=='VIRTUAL'){var _0x38a167={};_0x38a167[_0x4193af[_0xcd8d('0x20')]]={'$like':'%'+_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x32')]+'%'};return _0x38a167;}})});}_0x1b2221=_[_0xcd8d('0x33')]({},_0x1b2221,_0x10870f[_0xcd8d('0x34')]);var _0x3f8154={'where':_0x1b2221['where']};return db[_0xcd8d('0x22')][_0xcd8d('0x1a')](_0x3f8154)[_0xcd8d('0x35')](function(_0x3e8621){_0x3d2d56['count']=_0x3e8621;if(_0x10870f[_0xcd8d('0x28')][_0xcd8d('0x36')]){_0x1b2221['include']=[{'all':!![]}];}return db[_0xcd8d('0x22')][_0xcd8d('0x37')](_0x1b2221);})[_0xcd8d('0x35')](function(_0x5792bf){_0x3d2d56['rows']=_0x5792bf;return _0x3d2d56;})['then'](respondWithFilteredResult(_0x505585,_0x1b2221))['catch'](handleError(_0x505585,null));};exports[_0xcd8d('0x38')]=function(_0xd6aea4,_0x4ede02){var _0xee9143={'raw':!![],'where':{'id':_0xd6aea4[_0xcd8d('0x39')]['id']}},_0x3babe1={};_0x3babe1[_0xcd8d('0x26')]=_[_0xcd8d('0x3a')](db[_0xcd8d('0x22')][_0xcd8d('0x23')]);_0x3babe1['query']=_[_0xcd8d('0x3a')](_0xd6aea4['query']);_0x3babe1[_0xcd8d('0x29')]=_[_0xcd8d('0x3b')](_0x3babe1[_0xcd8d('0x26')],_0x3babe1[_0xcd8d('0x28')]);_0xee9143[_0xcd8d('0x2a')]=_[_0xcd8d('0x3b')](_0x3babe1[_0xcd8d('0x26')],qs[_0xcd8d('0x2b')](_0xd6aea4[_0xcd8d('0x28')]['fields']));_0xee9143[_0xcd8d('0x2a')]=_0xee9143['attributes'][_0xcd8d('0x2c')]?_0xee9143[_0xcd8d('0x2a')]:_0x3babe1['model'];if(_0xd6aea4['query']['includeAll']){_0xee9143[_0xcd8d('0x3c')]=[{'all':!![]}];}_0xee9143=_[_0xcd8d('0x33')]({},_0xee9143,_0xd6aea4[_0xcd8d('0x34')]);return db['Dynamics365Field']['find'](_0xee9143)[_0xcd8d('0x35')](handleEntityNotFound(_0x4ede02,null))[_0xcd8d('0x35')](respondWithResult(_0x4ede02,null))['catch'](handleError(_0x4ede02,null));};exports['create']=function(_0x263c55,_0xfd15a8){return db[_0xcd8d('0x22')][_0xcd8d('0x3d')](_0x263c55[_0xcd8d('0x3e')],{})[_0xcd8d('0x35')](respondWithResult(_0xfd15a8,0xc9))['catch'](handleError(_0xfd15a8,null));};exports['update']=function(_0x3dc886,_0x9d066b){if(_0x3dc886[_0xcd8d('0x3e')]['id']){delete _0x3dc886['body']['id'];}return db[_0xcd8d('0x22')][_0xcd8d('0x3f')]({'where':{'id':_0x3dc886[_0xcd8d('0x39')]['id']}})[_0xcd8d('0x35')](handleEntityNotFound(_0x9d066b,null))[_0xcd8d('0x35')](saveUpdates(_0x3dc886[_0xcd8d('0x3e')],null))['then'](respondWithResult(_0x9d066b,null))[_0xcd8d('0x40')](handleError(_0x9d066b,null));};exports['destroy']=function(_0x370927,_0x93ec06){return db[_0xcd8d('0x22')][_0xcd8d('0x3f')]({'where':{'id':_0x370927[_0xcd8d('0x39')]['id']}})[_0xcd8d('0x35')](handleEntityNotFound(_0x93ec06,null))[_0xcd8d('0x35')](removeEntity(_0x93ec06,null))[_0xcd8d('0x40')](handleError(_0x93ec06,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 97f75e5..191aff8 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 _0x2274=['exports','define','Dynamics365Field','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x490441,_0x38a1c3){var _0x4e459d=function(_0x2b72a4){while(--_0x2b72a4){_0x490441['push'](_0x490441['shift']());}};_0x4e459d(++_0x38a1c3);}(_0x2274,0x164));var _0x4227=function(_0x1cb519,_0x40249b){_0x1cb519=_0x1cb519-0x0;var _0x3a453b=_0x2274[_0x1cb519];return _0x3a453b;};'use strict';var _=require(_0x4227('0x0'));var util=require(_0x4227('0x1'));var logger=require(_0x4227('0x2'))(_0x4227('0x3'));var moment=require(_0x4227('0x4'));var BPromise=require(_0x4227('0x5'));var rp=require(_0x4227('0x6'));var fs=require('fs');var path=require(_0x4227('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intDynamics365Field.attributes');module[_0x4227('0x8')]=function(_0x27fabf,_0x2f6e0f){return _0x27fabf[_0x4227('0x9')](_0x4227('0xa'),attributes,{'tableName':_0x4227('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x4227('0xc'),_0x4227('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1784=['bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Field.attributes','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4f02da,_0x2e24b7){var _0x235548=function(_0x32ded2){while(--_0x32ded2){_0x4f02da['push'](_0x4f02da['shift']());}};_0x235548(++_0x2e24b7);}(_0x1784,0x1bb));var _0x4178=function(_0x1501e2,_0x271210){_0x1501e2=_0x1501e2-0x0;var _0xfce8c5=_0x1784[_0x1501e2];return _0xfce8c5;};'use strict';var _=require(_0x4178('0x0'));var util=require(_0x4178('0x1'));var logger=require(_0x4178('0x2'))(_0x4178('0x3'));var moment=require(_0x4178('0x4'));var BPromise=require(_0x4178('0x5'));var rp=require(_0x4178('0x6'));var fs=require('fs');var path=require(_0x4178('0x7'));var rimraf=require(_0x4178('0x8'));var config=require(_0x4178('0x9'));var attributes=require(_0x4178('0xa'));module['exports']=function(_0x5821e2,_0x21041e){return _0x5821e2[_0x4178('0xb')](_0x4178('0xc'),attributes,{'tableName':_0x4178('0xd'),'paranoid':![],'indexes':[{'name':_0x4178('0xe'),'fields':['idField',_0x4178('0xf')],'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 0fc9096..b27fa90 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 _0x8f32=['message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s'];(function(_0x401676,_0x3f1436){var _0x4f13fe=function(_0xd2f197){while(--_0xd2f197){_0x401676['push'](_0x401676['shift']());}};_0x4f13fe(++_0x3f1436);}(_0x8f32,0x76));var _0x28f3=function(_0x3a1261,_0x12c1e3){_0x3a1261=_0x3a1261-0x0;var _0x562186=_0x8f32[_0x3a1261];return _0x562186;};'use strict';var _=require(_0x28f3('0x0'));var util=require(_0x28f3('0x1'));var moment=require('moment');var BPromise=require(_0x28f3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x28f3('0x3'));var db=require(_0x28f3('0x4'))['db'];var utils=require(_0x28f3('0x5'));var logger=require(_0x28f3('0x6'))(_0x28f3('0x7'));var config=require(_0x28f3('0x8'));var jayson=require(_0x28f3('0x9'));var client=jayson[_0x28f3('0xa')][_0x28f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d9d43,_0x45fb47,_0x3381ce){return new BPromise(function(_0x5ae7ca,_0xdbde7f){return client[_0x28f3('0xc')](_0x2d9d43,_0x3381ce)[_0x28f3('0xd')](function(_0x4ab156){logger[_0x28f3('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0x45fb47,_0x28f3('0xf'));logger['debug'](_0x28f3('0x10'),_0x45fb47,_0x28f3('0xf'),JSON[_0x28f3('0x11')](_0x4ab156));if(_0x4ab156['error']){if(_0x4ab156[_0x28f3('0x12')]['code']===0x1f4){logger['error'](_0x28f3('0x13'),_0x45fb47,_0x4ab156['error'][_0x28f3('0x14')]);return _0xdbde7f(_0x4ab156['error'][_0x28f3('0x14')]);}logger['error']('Dynamics365Field,\x20%s,\x20%s',_0x45fb47,_0x4ab156[_0x28f3('0x12')][_0x28f3('0x14')]);return _0x5ae7ca(_0x4ab156[_0x28f3('0x12')][_0x28f3('0x14')]);}else{logger[_0x28f3('0xe')](_0x28f3('0x13'),_0x45fb47,_0x28f3('0xf'));_0x5ae7ca(_0x4ab156[_0x28f3('0x15')]['message']);}})[_0x28f3('0x16')](function(_0x295bb6){logger[_0x28f3('0x12')](_0x28f3('0x13'),_0x45fb47,_0x295bb6);_0xdbde7f(_0x295bb6);});});} \ No newline at end of file +var _0x7253=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Dynamics365Field,\x20%s,\x20%s'];(function(_0x46ba50,_0x440caa){var _0xb13d2f=function(_0x42b18e){while(--_0x42b18e){_0x46ba50['push'](_0x46ba50['shift']());}};_0xb13d2f(++_0x440caa);}(_0x7253,0x12f));var _0x3725=function(_0x307037,_0x3ec264){_0x307037=_0x307037-0x0;var _0x1abcf0=_0x7253[_0x307037];return _0x1abcf0;};'use strict';var _=require(_0x3725('0x0'));var util=require(_0x3725('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3725('0x2'));var db=require(_0x3725('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3725('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3725('0x5'));var client=jayson[_0x3725('0x6')][_0x3725('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bc3b5,_0x130398,_0x4557c0){return new BPromise(function(_0x26587,_0x103ec5){return client[_0x3725('0x8')](_0x4bc3b5,_0x4557c0)[_0x3725('0x9')](function(_0x5302ae){logger[_0x3725('0xa')](_0x3725('0xb'),_0x130398,'request\x20sent');logger[_0x3725('0xc')](_0x3725('0xd'),_0x130398,_0x3725('0xe'),JSON[_0x3725('0xf')](_0x5302ae));if(_0x5302ae['error']){if(_0x5302ae[_0x3725('0x10')][_0x3725('0x11')]===0x1f4){logger[_0x3725('0x10')](_0x3725('0xb'),_0x130398,_0x5302ae[_0x3725('0x10')]['message']);return _0x103ec5(_0x5302ae[_0x3725('0x10')][_0x3725('0x12')]);}logger[_0x3725('0x10')](_0x3725('0xb'),_0x130398,_0x5302ae['error']['message']);return _0x26587(_0x5302ae[_0x3725('0x10')][_0x3725('0x12')]);}else{logger[_0x3725('0xa')]('Dynamics365Field,\x20%s,\x20%s',_0x130398,_0x3725('0xe'));_0x26587(_0x5302ae[_0x3725('0x13')]['message']);}})[_0x3725('0x14')](function(_0x68abb2){logger[_0x3725('0x10')](_0x3725('0xb'),_0x130398,_0x68abb2);_0x103ec5(_0x68abb2);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index a042049..307f1d6 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 _0x4317=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','isAuthenticated','index','get','/:id/configurations','getConfigurations','post','create','addConfiguration','put','/:id','update','delete','multer','util'];(function(_0x3c9b43,_0x716e3c){var _0x2776e7=function(_0x363edd){while(--_0x363edd){_0x3c9b43['push'](_0x3c9b43['shift']());}};_0x2776e7(++_0x716e3c);}(_0x4317,0x6c));var _0x7431=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4317[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x7431('0x0'));var util=require(_0x7431('0x1'));var path=require('path');var timeout=require(_0x7431('0x2'));var express=require(_0x7431('0x3'));var router=express[_0x7431('0x4')]();var fs_extra=require(_0x7431('0x5'));var auth=require(_0x7431('0x6'));var interaction=require(_0x7431('0x7'));var config=require(_0x7431('0x8'));var controller=require(_0x7431('0x9'));router['get']('/',auth[_0x7431('0xa')](),controller[_0x7431('0xb')]);router[_0x7431('0xc')]('/:id',auth[_0x7431('0xa')](),controller['show']);router['get'](_0x7431('0xd'),auth['isAuthenticated'](),controller[_0x7431('0xe')]);router['get']('/:id/fields',auth[_0x7431('0xa')](),controller['getFields']);router[_0x7431('0xf')]('/',auth[_0x7431('0xa')](),controller[_0x7431('0x10')]);router[_0x7431('0xf')](_0x7431('0xd'),auth[_0x7431('0xa')](),controller[_0x7431('0x11')]);router[_0x7431('0x12')](_0x7431('0x13'),auth[_0x7431('0xa')](),controller[_0x7431('0x14')]);router[_0x7431('0x15')](_0x7431('0x13'),auth[_0x7431('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xad6c=['../../components/interaction/service','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','../../components/auth/service'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xad6c,0x11a));var _0xcad6=function(_0x147b21,_0xa7bba5){_0x147b21=_0x147b21-0x0;var _0x1410ef=_0xad6c[_0x147b21];return _0x1410ef;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcad6('0x0'));var express=require(_0xcad6('0x1'));var router=express[_0xcad6('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xcad6('0x3'));var interaction=require(_0xcad6('0x4'));var config=require('../../config/environment');var controller=require(_0xcad6('0x5'));router[_0xcad6('0x6')]('/',auth[_0xcad6('0x7')](),controller[_0xcad6('0x8')]);router[_0xcad6('0x6')](_0xcad6('0x9'),auth[_0xcad6('0x7')](),controller[_0xcad6('0xa')]);router['get'](_0xcad6('0xb'),auth[_0xcad6('0x7')](),controller[_0xcad6('0xc')]);router[_0xcad6('0x6')]('/:id/fields',auth['isAuthenticated'](),controller[_0xcad6('0xd')]);router[_0xcad6('0xe')]('/',auth[_0xcad6('0x7')](),controller[_0xcad6('0xf')]);router[_0xcad6('0xe')](_0xcad6('0xb'),auth[_0xcad6('0x7')](),controller[_0xcad6('0x10')]);router[_0xcad6('0x11')]('/:id',auth[_0xcad6('0x7')](),controller[_0xcad6('0x12')]);router[_0xcad6('0x13')](_0xcad6('0x9'),auth[_0xcad6('0x7')](),controller[_0xcad6('0x14')]);module[_0xcad6('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 895942b..8f394fc 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 _0x4325=['exports','STRING','username','remoteUri','sequelize'];(function(_0x41f122,_0x552a41){var _0x34c036=function(_0x23b35d){while(--_0x23b35d){_0x41f122['push'](_0x41f122['shift']());}};_0x34c036(++_0x552a41);}(_0x4325,0x1da));var _0x5432=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x4325[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0x5432('0x0'));module[_0x5432('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5432('0x2')]},'username':{'type':Sequelize[_0x5432('0x2')],'unique':_0x5432('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x5432('0x4')},'serverUrl':{'type':Sequelize[_0x5432('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x33af=['exports','STRING','username','remoteUri'];(function(_0x2e4293,_0x21aeb0){var _0x11a5ff=function(_0x166719){while(--_0x166719){_0x2e4293['push'](_0x2e4293['shift']());}};_0x11a5ff(++_0x21aeb0);}(_0x33af,0xec));var _0xf33a=function(_0xff659d,_0x2283a1){_0xff659d=_0xff659d-0x0;var _0x19c170=_0x33af[_0xff659d];return _0x19c170;};'use strict';var Sequelize=require('sequelize');module[_0xf33a('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf33a('0x1')]},'username':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x2')},'apiKey':{'type':Sequelize[_0xf33a('0x1')]},'remoteUri':{'type':Sequelize[_0xf33a('0x1')],'unique':_0xf33a('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index b18fe03..d87ef7e 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 _0x1ca7=['includes','default','custom_dropdown','label','choices','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskAccount','includeAll','include','findAll','rows','catch','show','find','create','body','params','findOne','FreshdeskConfiguration','rawAttributes','AccountId','Subjects','getSubjects','channel','Descriptions','getFields','remoteUri','slice','lastIndexOf','format','api/v2/ticket_fields','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','source','remove'];(function(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0x1ca7,0x157));var _0x71ca=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x1ca7[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0x71ca('0x0'));var rimraf=require(_0x71ca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x71ca('0x2'));var BPromise=require(_0x71ca('0x3'));var Mustache=require(_0x71ca('0x4'));var util=require('util');var path=require(_0x71ca('0x5'));var sox=require(_0x71ca('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71ca('0x7'));var _=require(_0x71ca('0x8'));var squel=require(_0x71ca('0x9'));var crypto=require(_0x71ca('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x71ca('0xb'));var toCsv=require(_0x71ca('0xc'));var querystring=require('querystring');var Papa=require(_0x71ca('0xd'));var Redis=require(_0x71ca('0xe'));var authService=require(_0x71ca('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x71ca('0x10'));var hardwareService=require(_0x71ca('0x11'));var logger=require(_0x71ca('0x12'))(_0x71ca('0x13'));var utils=require(_0x71ca('0x14'));var config=require(_0x71ca('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x71ca('0x16'))['db'];var integrations=require(_0x71ca('0x17'));function respondWithStatusCode(_0x4da234,_0x230345){_0x230345=_0x230345||0xcc;return function(_0x42ad77){if(_0x42ad77){return _0x4da234[_0x71ca('0x18')](_0x230345);}return _0x4da234[_0x71ca('0x19')](_0x230345)[_0x71ca('0x1a')]();};}function respondWithResult(_0x393db8,_0x2a38af){_0x2a38af=_0x2a38af||0xc8;return function(_0x3cbe45){if(_0x3cbe45){return _0x393db8[_0x71ca('0x19')](_0x2a38af)[_0x71ca('0x1b')](_0x3cbe45);}};}function respondWithFilteredResult(_0x505f8e,_0x4b65de){return function(_0x3f206d){if(_0x3f206d){var _0x5c6b85=typeof _0x4b65de[_0x71ca('0x1c')]===_0x71ca('0x1d')&&typeof _0x4b65de['limit']==='undefined';var _0x470470=_0x3f206d['count'];var _0x2c4310=_0x5c6b85?0x0:_0x4b65de[_0x71ca('0x1c')];var _0x302d9b=_0x5c6b85?_0x3f206d[_0x71ca('0x1e')]:_0x4b65de['offset']+_0x4b65de['limit'];var _0x5a4076;if(_0x302d9b>=_0x470470){_0x302d9b=_0x470470;_0x5a4076=0xc8;}else{_0x5a4076=0xce;}_0x505f8e[_0x71ca('0x19')](_0x5a4076);return _0x505f8e[_0x71ca('0x1f')](_0x71ca('0x20'),_0x2c4310+'-'+_0x302d9b+'/'+_0x470470)[_0x71ca('0x1b')](_0x3f206d);}return null;};}function patchUpdates(_0x363fb5){return function(_0xc37e2c){try{jsonpatch[_0x71ca('0x21')](_0xc37e2c,_0x363fb5,!![]);}catch(_0x259bc5){return BPromise[_0x71ca('0x22')](_0x259bc5);}return _0xc37e2c[_0x71ca('0x23')]();};}function saveUpdates(_0x5a501f,_0x48692c){return function(_0x4a7820){if(_0x4a7820){return _0x4a7820[_0x71ca('0x24')](_0x5a501f)['then'](function(_0x4fa46e){return _0x4fa46e;});}return null;};}function removeEntity(_0x1015c0,_0x2e2e22){return function(_0x458d4a){if(_0x458d4a){return _0x458d4a[_0x71ca('0x25')]()[_0x71ca('0x26')](function(){_0x1015c0[_0x71ca('0x19')](0xcc)[_0x71ca('0x1a')]();});}};}function handleEntityNotFound(_0x106f65,_0x35f577){return function(_0x4bfe19){if(!_0x4bfe19){_0x106f65[_0x71ca('0x18')](0x194);}return _0x4bfe19;};}function handleError(_0xddd38a,_0x35c857){_0x35c857=_0x35c857||0x1f4;return function(_0xd6ac43){logger['error'](_0xd6ac43[_0x71ca('0x27')]);if(_0xd6ac43[_0x71ca('0x28')]){delete _0xd6ac43[_0x71ca('0x28')];}_0xddd38a[_0x71ca('0x19')](_0x35c857)[_0x71ca('0x29')](_0xd6ac43);};}exports[_0x71ca('0x2a')]=function(_0x991bc,_0x5f2367){var _0x53562d={},_0xabe6e7={},_0x220584={'count':0x0,'rows':[]};var _0x7feccd=_['map'](db['FreshdeskAccount']['rawAttributes'],function(_0x1bcccb){return{'name':_0x1bcccb['fieldName'],'type':_0x1bcccb['type'][_0x71ca('0x2b')]};});_0xabe6e7['model']=_[_0x71ca('0x2c')](_0x7feccd,_0x71ca('0x28'));_0xabe6e7[_0x71ca('0x2d')]=_['keys'](_0x991bc[_0x71ca('0x2d')]);_0xabe6e7[_0x71ca('0x2e')]=_[_0x71ca('0x2f')](_0xabe6e7[_0x71ca('0x30')],_0xabe6e7[_0x71ca('0x2d')]);_0x53562d['attributes']=_[_0x71ca('0x2f')](_0xabe6e7[_0x71ca('0x30')],qs[_0x71ca('0x31')](_0x991bc[_0x71ca('0x2d')][_0x71ca('0x31')]));_0x53562d[_0x71ca('0x32')]=_0x53562d[_0x71ca('0x32')][_0x71ca('0x33')]?_0x53562d['attributes']:_0xabe6e7['model'];if(!_0x991bc[_0x71ca('0x2d')][_0x71ca('0x34')](_0x71ca('0x35'))){_0x53562d[_0x71ca('0x36')]=qs[_0x71ca('0x36')](_0x991bc[_0x71ca('0x2d')][_0x71ca('0x36')]);_0x53562d[_0x71ca('0x1c')]=qs['offset'](_0x991bc[_0x71ca('0x2d')]['offset']);}_0x53562d[_0x71ca('0x37')]=qs[_0x71ca('0x38')](_0x991bc[_0x71ca('0x2d')][_0x71ca('0x38')]);_0x53562d[_0x71ca('0x39')]=qs[_0x71ca('0x2e')](_[_0x71ca('0x3a')](_0x991bc[_0x71ca('0x2d')],_0xabe6e7[_0x71ca('0x2e')]),_0x7feccd);if(_0x991bc[_0x71ca('0x2d')][_0x71ca('0x3b')]){_0x53562d['where']=_[_0x71ca('0x3c')](_0x53562d[_0x71ca('0x39')],{'$or':_[_0x71ca('0x2c')](_0x7feccd,function(_0x53bb16){if(_0x53bb16[_0x71ca('0x3d')]!==_0x71ca('0x3e')){var _0x1dfc57={};_0x1dfc57[_0x53bb16[_0x71ca('0x28')]]={'$like':'%'+_0x991bc[_0x71ca('0x2d')]['filter']+'%'};return _0x1dfc57;}})});}_0x53562d=_['merge']({},_0x53562d,_0x991bc[_0x71ca('0x3f')]);var _0x9a7046={'where':_0x53562d[_0x71ca('0x39')]};return db[_0x71ca('0x40')][_0x71ca('0x1e')](_0x9a7046)[_0x71ca('0x26')](function(_0x5b567b){_0x220584['count']=_0x5b567b;if(_0x991bc[_0x71ca('0x2d')][_0x71ca('0x41')]){_0x53562d[_0x71ca('0x42')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0x71ca('0x43')](_0x53562d);})[_0x71ca('0x26')](function(_0xd53d29){_0x220584[_0x71ca('0x44')]=_0xd53d29;return _0x220584;})[_0x71ca('0x26')](respondWithFilteredResult(_0x5f2367,_0x53562d))[_0x71ca('0x45')](handleError(_0x5f2367,null));};exports[_0x71ca('0x46')]=function(_0x3b6d51,_0x37e83a){var _0x223aa5={'raw':![],'where':{'id':_0x3b6d51['params']['id']}},_0x550d50={};_0x550d50[_0x71ca('0x30')]=_['keys'](db['FreshdeskAccount']['rawAttributes']);_0x550d50['query']=_['keys'](_0x3b6d51[_0x71ca('0x2d')]);_0x550d50[_0x71ca('0x2e')]=_[_0x71ca('0x2f')](_0x550d50[_0x71ca('0x30')],_0x550d50[_0x71ca('0x2d')]);_0x223aa5['attributes']=_['intersection'](_0x550d50[_0x71ca('0x30')],qs[_0x71ca('0x31')](_0x3b6d51[_0x71ca('0x2d')][_0x71ca('0x31')]));_0x223aa5[_0x71ca('0x32')]=_0x223aa5[_0x71ca('0x32')]['length']?_0x223aa5[_0x71ca('0x32')]:_0x550d50[_0x71ca('0x30')];if(_0x3b6d51[_0x71ca('0x2d')][_0x71ca('0x41')]){_0x223aa5['include']=[{'all':!![]}];}_0x223aa5=_[_0x71ca('0x3c')]({},_0x223aa5,_0x3b6d51['options']);return db[_0x71ca('0x40')][_0x71ca('0x47')](_0x223aa5)[_0x71ca('0x26')](handleEntityNotFound(_0x37e83a,null))[_0x71ca('0x26')](respondWithResult(_0x37e83a,null))[_0x71ca('0x45')](handleError(_0x37e83a,null));};exports[_0x71ca('0x48')]=function(_0x2441e4,_0x5a2ae2){return db[_0x71ca('0x40')][_0x71ca('0x48')](_0x2441e4[_0x71ca('0x49')],{})[_0x71ca('0x26')](respondWithResult(_0x5a2ae2,0xc9))[_0x71ca('0x45')](handleError(_0x5a2ae2,null));};exports[_0x71ca('0x24')]=function(_0x18bf0d,_0x546ff0){if(_0x18bf0d[_0x71ca('0x49')]['id']){delete _0x18bf0d['body']['id'];}return db[_0x71ca('0x40')][_0x71ca('0x47')]({'where':{'id':_0x18bf0d[_0x71ca('0x4a')]['id']}})['then'](handleEntityNotFound(_0x546ff0,null))[_0x71ca('0x26')](saveUpdates(_0x18bf0d['body'],null))[_0x71ca('0x26')](respondWithResult(_0x546ff0,null))['catch'](handleError(_0x546ff0,null));};exports[_0x71ca('0x25')]=function(_0x14f264,_0x14b83d){return db['FreshdeskAccount'][_0x71ca('0x47')]({'where':{'id':_0x14f264[_0x71ca('0x4a')]['id']}})[_0x71ca('0x26')](handleEntityNotFound(_0x14b83d,null))[_0x71ca('0x26')](removeEntity(_0x14b83d,null))['catch'](handleError(_0x14b83d,null));};exports['getConfigurations']=function(_0x1c9a4e,_0x2a2680,_0x4abd78){var _0x3364b4={};var _0x35471a={};var _0x4f133f;var _0xf11ba3;return db['FreshdeskAccount'][_0x71ca('0x4b')]({'where':{'id':_0x1c9a4e[_0x71ca('0x4a')]['id']}})[_0x71ca('0x26')](handleEntityNotFound(_0x2a2680,null))[_0x71ca('0x26')](function(_0x171be3){if(_0x171be3){_0x4f133f=_0x171be3;_0x35471a['model']=_['keys'](db[_0x71ca('0x4c')][_0x71ca('0x4d')]);_0x35471a[_0x71ca('0x2d')]=_['keys'](_0x1c9a4e[_0x71ca('0x2d')]);_0x35471a[_0x71ca('0x2e')]=_[_0x71ca('0x2f')](_0x35471a[_0x71ca('0x30')],_0x35471a[_0x71ca('0x2d')]);_0x3364b4[_0x71ca('0x32')]=_[_0x71ca('0x2f')](_0x35471a[_0x71ca('0x30')],qs[_0x71ca('0x31')](_0x1c9a4e[_0x71ca('0x2d')]['fields']));_0x3364b4['attributes']=_0x3364b4[_0x71ca('0x32')][_0x71ca('0x33')]?_0x3364b4['attributes']:_0x35471a[_0x71ca('0x30')];_0x3364b4[_0x71ca('0x37')]=qs['sort'](_0x1c9a4e[_0x71ca('0x2d')]['sort']);_0x3364b4[_0x71ca('0x39')]=qs[_0x71ca('0x2e')](_[_0x71ca('0x3a')](_0x1c9a4e[_0x71ca('0x2d')],_0x35471a[_0x71ca('0x2e')]));if(_0x1c9a4e['query'][_0x71ca('0x3b')]){_0x3364b4['where']=_['merge'](_0x3364b4[_0x71ca('0x39')],{'$or':_['map'](_0x3364b4[_0x71ca('0x32')],function(_0x1625ce){var _0x160c25={};_0x160c25[_0x1625ce]={'$like':'%'+_0x1c9a4e[_0x71ca('0x2d')][_0x71ca('0x3b')]+'%'};return _0x160c25;})});}_0x3364b4=_['merge']({},_0x3364b4,_0x1c9a4e[_0x71ca('0x3f')]);return _0x4f133f['getConfigurations'](_0x3364b4);}})['then'](function(_0x15fe12){if(_0x15fe12){_0xf11ba3=_0x15fe12[_0x71ca('0x33')];if(!_0x1c9a4e['query'][_0x71ca('0x34')]('nolimit')){_0x3364b4['limit']=qs[_0x71ca('0x36')](_0x1c9a4e[_0x71ca('0x2d')]['limit']);_0x3364b4[_0x71ca('0x1c')]=qs[_0x71ca('0x1c')](_0x1c9a4e[_0x71ca('0x2d')][_0x71ca('0x1c')]);}return _0x4f133f['getConfigurations'](_0x3364b4);}})[_0x71ca('0x26')](function(_0x5bd8fb){if(_0x5bd8fb){return _0x5bd8fb?{'count':_0xf11ba3,'rows':_0x5bd8fb}:null;}})[_0x71ca('0x26')](respondWithResult(_0x2a2680,null))[_0x71ca('0x45')](handleError(_0x2a2680,null));};exports['addConfiguration']=function(_0x398345,_0x5881b8,_0x53460f){if(_0x398345[_0x71ca('0x49')]['id']){delete _0x398345[_0x71ca('0x49')]['id'];}return db['FreshdeskAccount'][_0x71ca('0x4b')]({'where':{'id':_0x398345['params']['id']}})[_0x71ca('0x26')](handleEntityNotFound(_0x5881b8,null))[_0x71ca('0x26')](function(_0x1ebbe8){if(_0x1ebbe8){_0x398345[_0x71ca('0x49')][_0x71ca('0x4e')]=_0x1ebbe8['id'];_0x398345['body'][_0x71ca('0x4f')]=integrations[_0x71ca('0x50')](_0x398345['body'][_0x71ca('0x51')],_0x398345[_0x71ca('0x49')][_0x71ca('0x3d')]);_0x398345[_0x71ca('0x49')]['Descriptions']=integrations['getDescriptions'](_0x398345[_0x71ca('0x49')]['channel'],_0x398345[_0x71ca('0x49')][_0x71ca('0x3d')]);return db['FreshdeskConfiguration']['create'](_0x398345['body'],{'include':[{'model':db['FreshdeskField'],'as':'Subjects'},{'model':db['FreshdeskField'],'as':_0x71ca('0x52')}]});}return null;})[_0x71ca('0x26')](respondWithResult(_0x5881b8,null))[_0x71ca('0x45')](handleError(_0x5881b8,null));};exports[_0x71ca('0x53')]=function(_0x2b2c05,_0x3c1714,_0x133fd4){var _0x30d863='';return db[_0x71ca('0x40')][_0x71ca('0x4b')]({'where':{'id':_0x2b2c05[_0x71ca('0x4a')]['id']},'attributes':['id',_0x71ca('0x54'),'apiKey']})[_0x71ca('0x26')](handleEntityNotFound(_0x3c1714,null))[_0x71ca('0x26')](function(_0x2e80c3){if(_0x2e80c3){_0x30d863=_0x2e80c3[_0x71ca('0x54')];var _0x2a2ffc=_0x30d863[_0x71ca('0x55')](-0x1);if(_0x2a2ffc==='/'){_0x30d863=_0x30d863['substring'](0x0,_0x30d863[_0x71ca('0x56')](_0x2a2ffc));}return rp({'method':'GET','uri':util[_0x71ca('0x57')]('%s/%s',_0x30d863,_0x71ca('0x58')),'headers':{'Authorization':util[_0x71ca('0x57')]('Basic\x20%s',new Buffer(util[_0x71ca('0x57')](_0x71ca('0x59'),_0x2e80c3[_0x71ca('0x5a')]))[_0x71ca('0x5b')](_0x71ca('0x5c')))},'json':!![]});}})[_0x71ca('0x26')](function(_0x6e5094){if(_0x6e5094){var _0x56e953=[_0x71ca('0x5d'),_0x71ca('0x5e'),_0x71ca('0x5f'),_0x71ca('0x60'),_0x71ca('0x19'),_0x71ca('0x61'),_0x71ca('0x62'),_0x71ca('0x63'),'ticket_type',_0x71ca('0x62'),'company'];_[_0x71ca('0x64')](_0x6e5094,function(_0x1e37a8){return _0x56e953[_0x71ca('0x65')](_0x1e37a8[_0x71ca('0x28')])||!_0x1e37a8[_0x71ca('0x66')]&&_0x1e37a8[_0x71ca('0x3d')]!=='custom_text'&&_0x1e37a8[_0x71ca('0x3d')]!==_0x71ca('0x67');});return{'count':_0x6e5094[_0x71ca('0x33')],'rows':_[_0x71ca('0x2c')](_0x6e5094,function(_0x2d7c4c){return{'id':_0x2d7c4c[_0x71ca('0x28')],'name':_0x2d7c4c[_0x71ca('0x68')],'custom':!_0x2d7c4c['default'],'options':_0x2d7c4c[_0x71ca('0x69')]?_[_0x71ca('0x2c')](_0x2d7c4c[_0x71ca('0x69')],function(_0x370ba0){return{'name':_['capitalize'](_0x370ba0),'value':_0x370ba0};}):[]};})};}})[_0x71ca('0x26')](respondWithResult(_0x3c1714,null))[_0x71ca('0x45')](function(_0x1c6b5b){var _0x4a716a=_0x2b2c05[_0x71ca('0x2d')][_0x71ca('0x6a')]?0x1f4:_0x1c6b5b[_0x71ca('0x6b')]||0x1f4;logger[_0x71ca('0x6c')](_0x71ca('0x6d'),'getFields',_0x4a716a,JSON[_0x71ca('0x6e')](_0x1c6b5b));delete _0x1c6b5b[_0x71ca('0x28')];if(_0x4a716a===0x191){_0x4a716a=0x190;}_0x3c1714[_0x71ca('0x19')](_0x4a716a)[_0x71ca('0x29')](_0x2b2c05[_0x71ca('0x2d')][_0x71ca('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x1c6b5b[_0x71ca('0x6b')]}:_0x1c6b5b);});}; \ No newline at end of file +var _0xbc8b=['base64','requester','subject','agent','group','remove','includes','custom_text','custom_dropdown','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','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','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','error','name','index','map','FreshdeskAccount','rawAttributes','fieldName','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','includeAll','findAll','rows','catch','params','include','create','body','find','FreshdeskConfiguration','pick','getConfigurations','findOne','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString'];(function(_0x548b33,_0x532f9a){var _0x17a608=function(_0x40e511){while(--_0x40e511){_0x548b33['push'](_0x548b33['shift']());}};_0x17a608(++_0x532f9a);}(_0xbc8b,0x16b));var _0xbbc8=function(_0x14476b,_0xd1a7a4){_0x14476b=_0x14476b-0x0;var _0x24e2e8=_0xbc8b[_0x14476b];return _0x24e2e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbbc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbc8('0x1'));var rp=require(_0xbbc8('0x2'));var moment=require(_0xbbc8('0x3'));var BPromise=require(_0xbbc8('0x4'));var Mustache=require(_0xbbc8('0x5'));var util=require(_0xbbc8('0x6'));var path=require('path');var sox=require(_0xbbc8('0x7'));var csv=require(_0xbbc8('0x8'));var ejs=require(_0xbbc8('0x9'));var fs=require('fs');var fs_extra=require(_0xbbc8('0xa'));var _=require(_0xbbc8('0xb'));var squel=require('squel');var crypto=require(_0xbbc8('0xc'));var jsforce=require(_0xbbc8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xbbc8('0x8'));var querystring=require(_0xbbc8('0xe'));var Papa=require(_0xbbc8('0xf'));var Redis=require(_0xbbc8('0x10'));var authService=require(_0xbbc8('0x11'));var qs=require(_0xbbc8('0x12'));var as=require(_0xbbc8('0x13'));var hardwareService=require(_0xbbc8('0x14'));var logger=require(_0xbbc8('0x15'))(_0xbbc8('0x16'));var utils=require(_0xbbc8('0x17'));var config=require(_0xbbc8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xbbc8('0x19'))['db'];var integrations=require(_0xbbc8('0x1a'));function respondWithStatusCode(_0x1c4b00,_0x55b386){_0x55b386=_0x55b386||0xcc;return function(_0x5b4b1b){if(_0x5b4b1b){return _0x1c4b00[_0xbbc8('0x1b')](_0x55b386);}return _0x1c4b00['status'](_0x55b386)[_0xbbc8('0x1c')]();};}function respondWithResult(_0x2add43,_0x1c76df){_0x1c76df=_0x1c76df||0xc8;return function(_0x1126c7){if(_0x1126c7){return _0x2add43[_0xbbc8('0x1d')](_0x1c76df)[_0xbbc8('0x1e')](_0x1126c7);}};}function respondWithFilteredResult(_0x292cc2,_0x1cd58e){return function(_0x38bf2f){if(_0x38bf2f){var _0x20e656=typeof _0x1cd58e[_0xbbc8('0x1f')]===_0xbbc8('0x20')&&typeof _0x1cd58e[_0xbbc8('0x21')]===_0xbbc8('0x20');var _0x5b070e=_0x38bf2f[_0xbbc8('0x22')];var _0x218cae=_0x20e656?0x0:_0x1cd58e[_0xbbc8('0x1f')];var _0x291abf=_0x20e656?_0x38bf2f['count']:_0x1cd58e[_0xbbc8('0x1f')]+_0x1cd58e['limit'];var _0xc5ea1e;if(_0x291abf>=_0x5b070e){_0x291abf=_0x5b070e;_0xc5ea1e=0xc8;}else{_0xc5ea1e=0xce;}_0x292cc2[_0xbbc8('0x1d')](_0xc5ea1e);return _0x292cc2['set'](_0xbbc8('0x23'),_0x218cae+'-'+_0x291abf+'/'+_0x5b070e)[_0xbbc8('0x1e')](_0x38bf2f);}return null;};}function patchUpdates(_0x14b069){return function(_0x283526){try{jsonpatch[_0xbbc8('0x24')](_0x283526,_0x14b069,!![]);}catch(_0x35391d){return BPromise[_0xbbc8('0x25')](_0x35391d);}return _0x283526['save']();};}function saveUpdates(_0x14af5b,_0x5a1e00){return function(_0x80fb90){if(_0x80fb90){return _0x80fb90[_0xbbc8('0x26')](_0x14af5b)[_0xbbc8('0x27')](function(_0x37acb1){return _0x37acb1;});}return null;};}function removeEntity(_0x354312,_0x521c11){return function(_0xd3200c){if(_0xd3200c){return _0xd3200c[_0xbbc8('0x28')]()['then'](function(){_0x354312['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ee2dd,_0x31fc9b){return function(_0xe6be9d){if(!_0xe6be9d){_0x2ee2dd[_0xbbc8('0x1b')](0x194);}return _0xe6be9d;};}function handleError(_0x1a0129,_0x15fd05){_0x15fd05=_0x15fd05||0x1f4;return function(_0x407acd){logger[_0xbbc8('0x29')](_0x407acd['stack']);if(_0x407acd[_0xbbc8('0x2a')]){delete _0x407acd[_0xbbc8('0x2a')];}_0x1a0129[_0xbbc8('0x1d')](_0x15fd05)['send'](_0x407acd);};}exports[_0xbbc8('0x2b')]=function(_0x239e64,_0x4b0e0c){var _0x130758={},_0x56ce6b={},_0x57cc7e={'count':0x0,'rows':[]};var _0x2939f8=_[_0xbbc8('0x2c')](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')],function(_0x24ec93){return{'name':_0x24ec93[_0xbbc8('0x2f')],'type':_0x24ec93['type']['key']};});_0x56ce6b[_0xbbc8('0x30')]=_[_0xbbc8('0x2c')](_0x2939f8,_0xbbc8('0x2a'));_0x56ce6b['query']=_[_0xbbc8('0x31')](_0x239e64[_0xbbc8('0x32')]);_0x56ce6b[_0xbbc8('0x33')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],_0x56ce6b[_0xbbc8('0x32')]);_0x130758[_0xbbc8('0x35')]=_[_0xbbc8('0x34')](_0x56ce6b[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x239e64[_0xbbc8('0x32')]['fields']));_0x130758[_0xbbc8('0x35')]=_0x130758[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x130758[_0xbbc8('0x35')]:_0x56ce6b[_0xbbc8('0x30')];if(!_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x38')](_0xbbc8('0x39'))){_0x130758[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x239e64['query'][_0xbbc8('0x21')]);_0x130758[_0xbbc8('0x1f')]=qs[_0xbbc8('0x1f')](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x1f')]);}_0x130758[_0xbbc8('0x3a')]=qs['sort'](_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3b')]);_0x130758[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_['pick'](_0x239e64[_0xbbc8('0x32')],_0x56ce6b[_0xbbc8('0x33')]),_0x2939f8);if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x3d')]){_0x130758[_0xbbc8('0x3c')]=_['merge'](_0x130758[_0xbbc8('0x3c')],{'$or':_[_0xbbc8('0x2c')](_0x2939f8,function(_0x2a2d68){if(_0x2a2d68[_0xbbc8('0x3e')]!=='VIRTUAL'){var _0x545bc3={};_0x545bc3[_0x2a2d68[_0xbbc8('0x2a')]]={'$like':'%'+_0x239e64['query'][_0xbbc8('0x3d')]+'%'};return _0x545bc3;}})});}_0x130758=_[_0xbbc8('0x3f')]({},_0x130758,_0x239e64[_0xbbc8('0x40')]);var _0x5ed5d2={'where':_0x130758[_0xbbc8('0x3c')]};return db['FreshdeskAccount']['count'](_0x5ed5d2)[_0xbbc8('0x27')](function(_0x37e803){_0x57cc7e['count']=_0x37e803;if(_0x239e64[_0xbbc8('0x32')][_0xbbc8('0x41')]){_0x130758['include']=[{'all':!![]}];}return db[_0xbbc8('0x2d')][_0xbbc8('0x42')](_0x130758);})[_0xbbc8('0x27')](function(_0x52c836){_0x57cc7e[_0xbbc8('0x43')]=_0x52c836;return _0x57cc7e;})[_0xbbc8('0x27')](respondWithFilteredResult(_0x4b0e0c,_0x130758))[_0xbbc8('0x44')](handleError(_0x4b0e0c,null));};exports['show']=function(_0x3e7e54,_0x1dfbce){var _0x3dd5f6={'raw':![],'where':{'id':_0x3e7e54[_0xbbc8('0x45')]['id']}},_0x3d6405={};_0x3d6405[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x2d')][_0xbbc8('0x2e')]);_0x3d6405['query']=_[_0xbbc8('0x31')](_0x3e7e54[_0xbbc8('0x32')]);_0x3d6405[_0xbbc8('0x33')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],_0x3d6405[_0xbbc8('0x32')]);_0x3dd5f6[_0xbbc8('0x35')]=_['intersection'](_0x3d6405[_0xbbc8('0x30')],qs['fields'](_0x3e7e54[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x3dd5f6[_0xbbc8('0x35')]=_0x3dd5f6['attributes'][_0xbbc8('0x37')]?_0x3dd5f6[_0xbbc8('0x35')]:_0x3d6405[_0xbbc8('0x30')];if(_0x3e7e54['query'][_0xbbc8('0x41')]){_0x3dd5f6[_0xbbc8('0x46')]=[{'all':!![]}];}_0x3dd5f6=_[_0xbbc8('0x3f')]({},_0x3dd5f6,_0x3e7e54[_0xbbc8('0x40')]);return db[_0xbbc8('0x2d')]['find'](_0x3dd5f6)[_0xbbc8('0x27')](handleEntityNotFound(_0x1dfbce,null))['then'](respondWithResult(_0x1dfbce,null))[_0xbbc8('0x44')](handleError(_0x1dfbce,null));};exports[_0xbbc8('0x47')]=function(_0x528b53,_0x4f3133){return db[_0xbbc8('0x2d')]['create'](_0x528b53[_0xbbc8('0x48')],{})[_0xbbc8('0x27')](respondWithResult(_0x4f3133,0xc9))[_0xbbc8('0x44')](handleError(_0x4f3133,null));};exports[_0xbbc8('0x26')]=function(_0x387dbf,_0x3d3a3a){if(_0x387dbf[_0xbbc8('0x48')]['id']){delete _0x387dbf['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x387dbf['params']['id']}})['then'](handleEntityNotFound(_0x3d3a3a,null))[_0xbbc8('0x27')](saveUpdates(_0x387dbf['body'],null))[_0xbbc8('0x27')](respondWithResult(_0x3d3a3a,null))[_0xbbc8('0x44')](handleError(_0x3d3a3a,null));};exports[_0xbbc8('0x28')]=function(_0x45262e,_0x228502){return db[_0xbbc8('0x2d')][_0xbbc8('0x49')]({'where':{'id':_0x45262e[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x228502,null))[_0xbbc8('0x27')](removeEntity(_0x228502,null))[_0xbbc8('0x44')](handleError(_0x228502,null));};exports['getConfigurations']=function(_0x44510b,_0x46fa8d,_0x241b89){var _0x11414f={};var _0x40ac43={};var _0x219e4d;var _0x8fa10a;return db[_0xbbc8('0x2d')]['findOne']({'where':{'id':_0x44510b[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0x46fa8d,null))[_0xbbc8('0x27')](function(_0x2ebdf9){if(_0x2ebdf9){_0x219e4d=_0x2ebdf9;_0x40ac43[_0xbbc8('0x30')]=_['keys'](db[_0xbbc8('0x4a')]['rawAttributes']);_0x40ac43[_0xbbc8('0x32')]=_[_0xbbc8('0x31')](_0x44510b[_0xbbc8('0x32')]);_0x40ac43['filters']=_[_0xbbc8('0x34')](_0x40ac43['model'],_0x40ac43[_0xbbc8('0x32')]);_0x11414f['attributes']=_[_0xbbc8('0x34')](_0x40ac43[_0xbbc8('0x30')],qs[_0xbbc8('0x36')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x36')]));_0x11414f[_0xbbc8('0x35')]=_0x11414f[_0xbbc8('0x35')][_0xbbc8('0x37')]?_0x11414f[_0xbbc8('0x35')]:_0x40ac43[_0xbbc8('0x30')];_0x11414f['order']=qs[_0xbbc8('0x3b')](_0x44510b['query']['sort']);_0x11414f[_0xbbc8('0x3c')]=qs[_0xbbc8('0x33')](_[_0xbbc8('0x4b')](_0x44510b[_0xbbc8('0x32')],_0x40ac43[_0xbbc8('0x33')]));if(_0x44510b[_0xbbc8('0x32')]['filter']){_0x11414f[_0xbbc8('0x3c')]=_[_0xbbc8('0x3f')](_0x11414f['where'],{'$or':_[_0xbbc8('0x2c')](_0x11414f['attributes'],function(_0x45066b){var _0x20485c={};_0x20485c[_0x45066b]={'$like':'%'+_0x44510b[_0xbbc8('0x32')]['filter']+'%'};return _0x20485c;})});}_0x11414f=_['merge']({},_0x11414f,_0x44510b[_0xbbc8('0x40')]);return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x1419ba){if(_0x1419ba){_0x8fa10a=_0x1419ba[_0xbbc8('0x37')];if(!_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x38')]('nolimit')){_0x11414f[_0xbbc8('0x21')]=qs[_0xbbc8('0x21')](_0x44510b[_0xbbc8('0x32')][_0xbbc8('0x21')]);_0x11414f['offset']=qs[_0xbbc8('0x1f')](_0x44510b['query']['offset']);}return _0x219e4d[_0xbbc8('0x4c')](_0x11414f);}})[_0xbbc8('0x27')](function(_0x107727){if(_0x107727){return _0x107727?{'count':_0x8fa10a,'rows':_0x107727}:null;}})[_0xbbc8('0x27')](respondWithResult(_0x46fa8d,null))[_0xbbc8('0x44')](handleError(_0x46fa8d,null));};exports['addConfiguration']=function(_0x113a4a,_0xd1b4af,_0x392184){if(_0x113a4a[_0xbbc8('0x48')]['id']){delete _0x113a4a['body']['id'];}return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x113a4a[_0xbbc8('0x45')]['id']}})[_0xbbc8('0x27')](handleEntityNotFound(_0xd1b4af,null))[_0xbbc8('0x27')](function(_0xabda07){if(_0xabda07){_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4e')]=_0xabda07['id'];_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x4f')]=integrations[_0xbbc8('0x50')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);_0x113a4a['body']['Descriptions']=integrations[_0xbbc8('0x51')](_0x113a4a[_0xbbc8('0x48')]['channel'],_0x113a4a[_0xbbc8('0x48')][_0xbbc8('0x3e')]);return db[_0xbbc8('0x4a')][_0xbbc8('0x47')](_0x113a4a[_0xbbc8('0x48')],{'include':[{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x4f')},{'model':db[_0xbbc8('0x52')],'as':_0xbbc8('0x53')}]});}return null;})[_0xbbc8('0x27')](respondWithResult(_0xd1b4af,null))['catch'](handleError(_0xd1b4af,null));};exports[_0xbbc8('0x54')]=function(_0x2a7747,_0x295393,_0x393039){var _0x3a2c0e='';return db[_0xbbc8('0x2d')][_0xbbc8('0x4d')]({'where':{'id':_0x2a7747['params']['id']},'attributes':['id',_0xbbc8('0x55'),_0xbbc8('0x56')]})['then'](handleEntityNotFound(_0x295393,null))[_0xbbc8('0x27')](function(_0x350007){if(_0x350007){_0x3a2c0e=_0x350007[_0xbbc8('0x55')];var _0x4184a0=_0x3a2c0e[_0xbbc8('0x57')](-0x1);if(_0x4184a0==='/'){_0x3a2c0e=_0x3a2c0e[_0xbbc8('0x58')](0x0,_0x3a2c0e[_0xbbc8('0x59')](_0x4184a0));}return rp({'method':_0xbbc8('0x5a'),'uri':util[_0xbbc8('0x5b')](_0xbbc8('0x5c'),_0x3a2c0e,_0xbbc8('0x5d')),'headers':{'Authorization':util[_0xbbc8('0x5b')](_0xbbc8('0x5e'),new Buffer(util[_0xbbc8('0x5b')](_0xbbc8('0x5f'),_0x350007['apiKey']))[_0xbbc8('0x60')](_0xbbc8('0x61')))},'json':!![]});}})[_0xbbc8('0x27')](function(_0x7e96db){if(_0x7e96db){var _0x42b954=[_0xbbc8('0x62'),_0xbbc8('0x63'),_0xbbc8('0x64'),'description',_0xbbc8('0x1d'),'priority','group','source','ticket_type',_0xbbc8('0x65'),'company'];_[_0xbbc8('0x66')](_0x7e96db,function(_0x35d6a6){return _0x42b954[_0xbbc8('0x67')](_0x35d6a6[_0xbbc8('0x2a')])||!_0x35d6a6['default']&&_0x35d6a6['type']!==_0xbbc8('0x68')&&_0x35d6a6[_0xbbc8('0x3e')]!==_0xbbc8('0x69');});return{'count':_0x7e96db[_0xbbc8('0x37')],'rows':_['map'](_0x7e96db,function(_0x596c70){return{'id':_0x596c70[_0xbbc8('0x2a')],'name':_0x596c70['label'],'custom':!_0x596c70[_0xbbc8('0x6a')],'options':_0x596c70[_0xbbc8('0x6b')]?_['map'](_0x596c70['choices'],function(_0x33ad43){return{'name':_[_0xbbc8('0x6c')](_0x33ad43),'value':_0x33ad43};}):[]};})};}})[_0xbbc8('0x27')](respondWithResult(_0x295393,null))[_0xbbc8('0x44')](function(_0x284d81){var _0x1014cc=_0x2a7747['query']['test']?0x1f4:_0x284d81[_0xbbc8('0x6d')]||0x1f4;logger[_0xbbc8('0x29')](_0xbbc8('0x6e'),'getFields',_0x1014cc,JSON[_0xbbc8('0x6f')](_0x284d81));delete _0x284d81[_0xbbc8('0x2a')];if(_0x1014cc===0x191){_0x1014cc=0x190;}_0x295393['status'](_0x1014cc)[_0xbbc8('0x70')](_0x2a7747[_0xbbc8('0x32')][_0xbbc8('0x71')]?{'message':_0xbbc8('0x72'),'statusCode':_0x284d81['statusCode']}:_0x284d81);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 10b9b76..3ab8021 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 _0x96d4=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x96d4,0x16c));var _0x496d=function(_0x14e7f2,_0x4bdd32){_0x14e7f2=_0x14e7f2-0x0;var _0x4979a0=_0x96d4[_0x14e7f2];return _0x4979a0;};'use strict';var _=require(_0x496d('0x0'));var util=require(_0x496d('0x1'));var logger=require(_0x496d('0x2'))('api');var moment=require(_0x496d('0x3'));var BPromise=require(_0x496d('0x4'));var rp=require(_0x496d('0x5'));var fs=require('fs');var path=require(_0x496d('0x6'));var rimraf=require(_0x496d('0x7'));var config=require(_0x496d('0x8'));var attributes=require(_0x496d('0x9'));var integrations=require(_0x496d('0xa'));module['exports']=function(_0x41a001,_0x59fae1){return _0x41a001[_0x496d('0xb')](_0x496d('0xc'),attributes,{'tableName':_0x496d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x73ec=['path','../../config/environment','./intFreshdeskAccount.attributes','define','int_freshdesk_accounts','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x73ec,0xf5));var _0xc73e=function(_0x1b2c7a,_0x224027){_0x1b2c7a=_0x1b2c7a-0x0;var _0x2d4873=_0x73ec[_0x1b2c7a];return _0x2d4873;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc73e('0x0'))(_0xc73e('0x1'));var moment=require(_0xc73e('0x2'));var BPromise=require(_0xc73e('0x3'));var rp=require(_0xc73e('0x4'));var fs=require('fs');var path=require(_0xc73e('0x5'));var rimraf=require('rimraf');var config=require(_0xc73e('0x6'));var attributes=require(_0xc73e('0x7'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x5aecc7,_0x4f3b05){return _0x5aecc7[_0xc73e('0x8')]('FreshdeskAccount',attributes,{'tableName':_0xc73e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 767c714..61609d8 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 _0x1cc2=['jayson/promise','http','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','map','model','then','debug','stringify','ShowFreshdeskAccount','FreshdeskAccount','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3337b6,_0x42c7f9){var _0x568270=function(_0x56e5df){while(--_0x56e5df){_0x3337b6['push'](_0x3337b6['shift']());}};_0x568270(++_0x42c7f9);}(_0x1cc2,0x139));var _0x21cc=function(_0x1fc151,_0x881f9c){_0x1fc151=_0x1fc151-0x0;var _0x4ce42d=_0x1cc2[_0x1fc151];return _0x4ce42d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x21cc('0x0'));var BPromise=require(_0x21cc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x21cc('0x2'));var db=require(_0x21cc('0x3'))['db'];var utils=require(_0x21cc('0x4'));var logger=require(_0x21cc('0x5'))(_0x21cc('0x6'));var config=require('../../config/environment');var jayson=require(_0x21cc('0x7'));var client=jayson['client'][_0x21cc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5142fc,_0x57dea1,_0x1482d4){return new BPromise(function(_0x4bea2c,_0xd2e890){return client['request'](_0x5142fc,_0x1482d4)['then'](function(_0x4d7323){logger[_0x21cc('0x9')](_0x21cc('0xa'),_0x57dea1,_0x21cc('0xb'));logger['debug'](_0x21cc('0xc'),_0x57dea1,_0x21cc('0xb'),JSON['stringify'](_0x4d7323));if(_0x4d7323[_0x21cc('0xd')]){if(_0x4d7323[_0x21cc('0xd')][_0x21cc('0xe')]===0x1f4){logger[_0x21cc('0xd')]('FreshdeskAccount,\x20%s,\x20%s',_0x57dea1,_0x4d7323[_0x21cc('0xd')]['message']);return _0xd2e890(_0x4d7323['error']['message']);}logger['error'](_0x21cc('0xa'),_0x57dea1,_0x4d7323[_0x21cc('0xd')][_0x21cc('0xf')]);return _0x4bea2c(_0x4d7323[_0x21cc('0xd')]['message']);}else{logger[_0x21cc('0x9')](_0x21cc('0xa'),_0x57dea1,_0x21cc('0xb'));_0x4bea2c(_0x4d7323['result'][_0x21cc('0xf')]);}})[_0x21cc('0x10')](function(_0x221733){logger[_0x21cc('0xd')](_0x21cc('0xa'),_0x57dea1,_0x221733);_0xd2e890(_0x221733);});});}exports[_0x21cc('0x11')]=function(_0xa6a64d){var _0xbbd6b7=this;return new Promise(function(_0x149fee,_0x592919){return db['FreshdeskAccount'][_0x21cc('0x12')]({'raw':_0xa6a64d[_0x21cc('0x13')]?_0xa6a64d[_0x21cc('0x13')][_0x21cc('0x14')]===undefined?!![]:![]:!![],'where':_0xa6a64d[_0x21cc('0x13')]?_0xa6a64d['options']['where']||null:null,'attributes':_0xa6a64d[_0x21cc('0x13')]?_0xa6a64d[_0x21cc('0x13')][_0x21cc('0x15')]||null:null,'limit':_0xa6a64d['options']?_0xa6a64d['options'][_0x21cc('0x16')]||null:null,'include':_0xa6a64d['options']?_0xa6a64d['options'][_0x21cc('0x17')]?_[_0x21cc('0x18')](_0xa6a64d[_0x21cc('0x13')]['include'],function(_0x486d76){return{'model':db[_0x486d76[_0x21cc('0x19')]],'as':_0x486d76['as'],'attributes':_0x486d76[_0x21cc('0x15')],'include':_0x486d76[_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x486d76[_0x21cc('0x17')],function(_0x4b9d6a){return{'model':db[_0x4b9d6a[_0x21cc('0x19')]],'as':_0x4b9d6a['as'],'attributes':_0x4b9d6a[_0x21cc('0x15')],'include':_0x4b9d6a['include']?_[_0x21cc('0x18')](_0x4b9d6a[_0x21cc('0x17')],function(_0x3c87b7){return{'model':db[_0x3c87b7[_0x21cc('0x19')]],'as':_0x3c87b7['as'],'attributes':_0x3c87b7[_0x21cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x21cc('0x1a')](function(_0x1bb939){logger[_0x21cc('0x9')](_0x21cc('0x11'),_0xa6a64d);logger[_0x21cc('0x1b')](_0x21cc('0x11'),_0xa6a64d,JSON[_0x21cc('0x1c')](_0x1bb939));_0x149fee(_0x1bb939);})['catch'](function(_0xe95122){logger[_0x21cc('0xd')](_0x21cc('0x11'),_0xe95122[_0x21cc('0xf')],_0xa6a64d);_0x592919(_0xbbd6b7[_0x21cc('0xd')](0x1f4,_0xe95122[_0x21cc('0xf')]));});});};exports[_0x21cc('0x1d')]=function(_0x2f2b5a){var _0x11f1e4=this;return new Promise(function(_0x3286c7,_0x6c189b){return db[_0x21cc('0x1e')][_0x21cc('0x1f')]({'raw':_0x2f2b5a[_0x21cc('0x13')]?_0x2f2b5a[_0x21cc('0x13')][_0x21cc('0x14')]===undefined?!![]:![]:!![],'where':_0x2f2b5a['options']?_0x2f2b5a[_0x21cc('0x13')]['where']||null:null,'attributes':_0x2f2b5a[_0x21cc('0x13')]?_0x2f2b5a[_0x21cc('0x13')][_0x21cc('0x15')]||null:null,'include':_0x2f2b5a[_0x21cc('0x13')]?_0x2f2b5a[_0x21cc('0x13')][_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x2f2b5a['options'][_0x21cc('0x17')],function(_0x278c8e){return{'model':db[_0x278c8e[_0x21cc('0x19')]],'as':_0x278c8e['as'],'attributes':_0x278c8e[_0x21cc('0x15')],'include':_0x278c8e[_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x278c8e[_0x21cc('0x17')],function(_0x9449ee){return{'model':db[_0x9449ee[_0x21cc('0x19')]],'as':_0x9449ee['as'],'attributes':_0x9449ee[_0x21cc('0x15')],'include':_0x9449ee[_0x21cc('0x17')]?_[_0x21cc('0x18')](_0x9449ee[_0x21cc('0x17')],function(_0x395b0e){return{'model':db[_0x395b0e[_0x21cc('0x19')]],'as':_0x395b0e['as'],'attributes':_0x395b0e[_0x21cc('0x15')]};}):[]};}):[]};}):[]:[]})[_0x21cc('0x1a')](function(_0x51b802){logger['info'](_0x21cc('0x1d'),_0x2f2b5a);logger[_0x21cc('0x1b')](_0x21cc('0x1d'),_0x2f2b5a,JSON[_0x21cc('0x1c')](_0x51b802));_0x3286c7(_0x51b802);})['catch'](function(_0x4f6824){logger[_0x21cc('0xd')](_0x21cc('0x1d'),_0x4f6824[_0x21cc('0xf')],_0x2f2b5a);_0x6c189b(_0x11f1e4[_0x21cc('0xd')](0x1f4,_0x4f6824['message']));});});}; \ No newline at end of file +var _0xb05c=['stringify','error','code','message','catch','FreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshdeskAccount','ShowFreshdeskAccount','find','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x114886,_0x3b1b95){var _0x57bd9b=function(_0x27715f){while(--_0x27715f){_0x114886['push'](_0x114886['shift']());}};_0x57bd9b(++_0x3b1b95);}(_0xb05c,0x1cc));var _0xcb05=function(_0x2a9ec5,_0xed23b){_0x2a9ec5=_0x2a9ec5-0x0;var _0x52c7c0=_0xb05c[_0x2a9ec5];return _0x52c7c0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcb05('0x0'));var BPromise=require(_0xcb05('0x1'));var rs=require(_0xcb05('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb05('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb05('0x4'))(_0xcb05('0x5'));var config=require(_0xcb05('0x6'));var jayson=require(_0xcb05('0x7'));var client=jayson[_0xcb05('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x579ade,_0x4c5fbf,_0xb4e403){return new BPromise(function(_0x72103d,_0x3b3e8f){return client[_0xcb05('0x9')](_0x579ade,_0xb4e403)[_0xcb05('0xa')](function(_0x3d806f){logger[_0xcb05('0xb')](_0xcb05('0xc'),_0x4c5fbf,_0xcb05('0xd'));logger[_0xcb05('0xe')](_0xcb05('0xf'),_0x4c5fbf,_0xcb05('0xd'),JSON[_0xcb05('0x10')](_0x3d806f));if(_0x3d806f['error']){if(_0x3d806f[_0xcb05('0x11')][_0xcb05('0x12')]===0x1f4){logger['error'](_0xcb05('0xc'),_0x4c5fbf,_0x3d806f['error'][_0xcb05('0x13')]);return _0x3b3e8f(_0x3d806f[_0xcb05('0x11')][_0xcb05('0x13')]);}logger[_0xcb05('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c5fbf,_0x3d806f['error'][_0xcb05('0x13')]);return _0x72103d(_0x3d806f[_0xcb05('0x11')][_0xcb05('0x13')]);}else{logger[_0xcb05('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c5fbf,_0xcb05('0xd'));_0x72103d(_0x3d806f['result'][_0xcb05('0x13')]);}})[_0xcb05('0x14')](function(_0x1b7b8f){logger[_0xcb05('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x4c5fbf,_0x1b7b8f);_0x3b3e8f(_0x1b7b8f);});});}exports['GetFreshdeskAccount']=function(_0x5e1049){var _0x48731a=this;return new Promise(function(_0x5348f6,_0x2c2ac0){return db[_0xcb05('0x15')][_0xcb05('0x16')]({'raw':_0x5e1049['options']?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x18')]===undefined?!![]:![]:!![],'where':_0x5e1049[_0xcb05('0x17')]?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x19')]||null:null,'attributes':_0x5e1049['options']?_0x5e1049['options'][_0xcb05('0x1a')]||null:null,'limit':_0x5e1049[_0xcb05('0x17')]?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x1b')]||null:null,'include':_0x5e1049[_0xcb05('0x17')]?_0x5e1049[_0xcb05('0x17')][_0xcb05('0x1c')]?_[_0xcb05('0x1d')](_0x5e1049[_0xcb05('0x17')]['include'],function(_0x3d2313){return{'model':db[_0x3d2313[_0xcb05('0x1e')]],'as':_0x3d2313['as'],'attributes':_0x3d2313[_0xcb05('0x1a')],'include':_0x3d2313[_0xcb05('0x1c')]?_['map'](_0x3d2313['include'],function(_0x22eb3c){return{'model':db[_0x22eb3c['model']],'as':_0x22eb3c['as'],'attributes':_0x22eb3c['attributes'],'include':_0x22eb3c[_0xcb05('0x1c')]?_['map'](_0x22eb3c[_0xcb05('0x1c')],function(_0xcc6755){return{'model':db[_0xcc6755['model']],'as':_0xcc6755['as'],'attributes':_0xcc6755[_0xcb05('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcb05('0xa')](function(_0x536b3a){logger['info'](_0xcb05('0x1f'),_0x5e1049);logger[_0xcb05('0xe')]('GetFreshdeskAccount',_0x5e1049,JSON[_0xcb05('0x10')](_0x536b3a));_0x5348f6(_0x536b3a);})[_0xcb05('0x14')](function(_0x370495){logger['error'](_0xcb05('0x1f'),_0x370495[_0xcb05('0x13')],_0x5e1049);_0x2c2ac0(_0x48731a[_0xcb05('0x11')](0x1f4,_0x370495[_0xcb05('0x13')]));});});};exports[_0xcb05('0x20')]=function(_0x3fb1d7){var _0x3bea36=this;return new Promise(function(_0x2a31a0,_0xd42e48){return db['FreshdeskAccount'][_0xcb05('0x21')]({'raw':_0x3fb1d7['options']?_0x3fb1d7[_0xcb05('0x17')][_0xcb05('0x18')]===undefined?!![]:![]:!![],'where':_0x3fb1d7['options']?_0x3fb1d7[_0xcb05('0x17')][_0xcb05('0x19')]||null:null,'attributes':_0x3fb1d7[_0xcb05('0x17')]?_0x3fb1d7[_0xcb05('0x17')]['attributes']||null:null,'include':_0x3fb1d7[_0xcb05('0x17')]?_0x3fb1d7[_0xcb05('0x17')][_0xcb05('0x1c')]?_['map'](_0x3fb1d7[_0xcb05('0x17')]['include'],function(_0x4cfb06){return{'model':db[_0x4cfb06[_0xcb05('0x1e')]],'as':_0x4cfb06['as'],'attributes':_0x4cfb06['attributes'],'include':_0x4cfb06[_0xcb05('0x1c')]?_['map'](_0x4cfb06[_0xcb05('0x1c')],function(_0x2151c3){return{'model':db[_0x2151c3['model']],'as':_0x2151c3['as'],'attributes':_0x2151c3['attributes'],'include':_0x2151c3['include']?_[_0xcb05('0x1d')](_0x2151c3[_0xcb05('0x1c')],function(_0x37fcb9){return{'model':db[_0x37fcb9[_0xcb05('0x1e')]],'as':_0x37fcb9['as'],'attributes':_0x37fcb9['attributes']};}):[]};}):[]};}):[]:[]})[_0xcb05('0xa')](function(_0x275ac2){logger['info'](_0xcb05('0x20'),_0x3fb1d7);logger['debug'](_0xcb05('0x20'),_0x3fb1d7,JSON[_0xcb05('0x10')](_0x275ac2));_0x2a31a0(_0x275ac2);})[_0xcb05('0x14')](function(_0x411a3c){logger[_0xcb05('0x11')]('ShowFreshdeskAccount',_0x411a3c['message'],_0x3fb1d7);_0xd42e48(_0x3bea36['error'](0x1f4,_0x411a3c[_0xcb05('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0cf8e84..533d115 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 _0xaf08=['/:id/tags','create','post','setTags','put','update','delete','destroy','exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions'];(function(_0x5c7718,_0x1a3d7a){var _0x4fb733=function(_0x286736){while(--_0x286736){_0x5c7718['push'](_0x5c7718['shift']());}};_0x4fb733(++_0x1a3d7a);}(_0xaf08,0x1b2));var _0x8af0=function(_0x4f3242,_0x391954){_0x4f3242=_0x4f3242-0x0;var _0x49844f=_0xaf08[_0x4f3242];return _0x49844f;};'use strict';var multer=require('multer');var util=require(_0x8af0('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x8af0('0x1'));var auth=require(_0x8af0('0x2'));var interaction=require(_0x8af0('0x3'));var config=require(_0x8af0('0x4'));var controller=require(_0x8af0('0x5'));router[_0x8af0('0x6')]('/',auth[_0x8af0('0x7')](),controller[_0x8af0('0x8')]);router[_0x8af0('0x6')](_0x8af0('0x9'),auth[_0x8af0('0x7')](),controller[_0x8af0('0xa')]);router['get'](_0x8af0('0xb'),auth['isAuthenticated'](),controller[_0x8af0('0xc')]);router['get']('/:id/subjects',auth[_0x8af0('0x7')](),controller[_0x8af0('0xd')]);router[_0x8af0('0x6')](_0x8af0('0xe'),auth[_0x8af0('0x7')](),controller[_0x8af0('0xf')]);router['get'](_0x8af0('0x10'),auth[_0x8af0('0x7')](),controller['getTags']);router['post']('/',auth[_0x8af0('0x7')](),controller[_0x8af0('0x11')]);router[_0x8af0('0x12')](_0x8af0('0x10'),auth[_0x8af0('0x7')](),controller[_0x8af0('0x13')]);router[_0x8af0('0x14')](_0x8af0('0x9'),auth[_0x8af0('0x7')](),controller[_0x8af0('0x15')]);router[_0x8af0('0x16')](_0x8af0('0x9'),auth[_0x8af0('0x7')](),controller[_0x8af0('0x17')]);module[_0x8af0('0x18')]=router; \ No newline at end of file +var _0x1cd2=['util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intFreshdeskConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','/:id/tags','put','update','delete','destroy','exports','multer'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cd2,0x19f));var _0x21cd=function(_0x5210f9,_0x279eb8){_0x5210f9=_0x5210f9-0x0;var _0x5c9f67=_0x1cd2[_0x5210f9];return _0x5c9f67;};'use strict';var multer=require(_0x21cd('0x0'));var util=require(_0x21cd('0x1'));var path=require(_0x21cd('0x2'));var timeout=require(_0x21cd('0x3'));var express=require(_0x21cd('0x4'));var router=express[_0x21cd('0x5')]();var fs_extra=require(_0x21cd('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x21cd('0x7'));var controller=require(_0x21cd('0x8'));router[_0x21cd('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x21cd('0x9')](_0x21cd('0xa'),auth['isAuthenticated'](),controller[_0x21cd('0xb')]);router[_0x21cd('0x9')](_0x21cd('0xc'),auth[_0x21cd('0xd')](),controller['getFields']);router[_0x21cd('0x9')](_0x21cd('0xe'),auth['isAuthenticated'](),controller[_0x21cd('0xf')]);router[_0x21cd('0x9')](_0x21cd('0x10'),auth['isAuthenticated'](),controller[_0x21cd('0x11')]);router[_0x21cd('0x9')]('/:id/tags',auth[_0x21cd('0xd')](),controller[_0x21cd('0x12')]);router[_0x21cd('0x13')]('/',auth[_0x21cd('0xd')](),controller['create']);router[_0x21cd('0x13')](_0x21cd('0x14'),auth[_0x21cd('0xd')](),controller['setTags']);router[_0x21cd('0x15')](_0x21cd('0xa'),auth[_0x21cd('0xd')](),controller[_0x21cd('0x16')]);router[_0x21cd('0x17')](_0x21cd('0xa'),auth['isAuthenticated'](),controller[_0x21cd('0x18')]);module[_0x21cd('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index b7d6c97..b11a181 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 _0x2b02=['exports','STRING','sequelize'];(function(_0x1fb7d1,_0x108781){var _0x2480d8=function(_0x9bc3d9){while(--_0x9bc3d9){_0x1fb7d1['push'](_0x1fb7d1['shift']());}};_0x2480d8(++_0x108781);}(_0x2b02,0x17c));var _0x22b0=function(_0x538883,_0x20ca6b){_0x538883=_0x538883-0x0;var _0x2313f5=_0x2b02[_0x538883];return _0x2313f5;};'use strict';var Sequelize=require(_0x22b0('0x0'));module[_0x22b0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x22b0('0x2')]}}; \ No newline at end of file +var _0x559b=['sequelize','exports','STRING'];(function(_0x34c0bf,_0x3b8460){var _0x315559=function(_0x42f409){while(--_0x42f409){_0x34c0bf['push'](_0x34c0bf['shift']());}};_0x315559(++_0x3b8460);}(_0x559b,0x8a));var _0xb559=function(_0x3ff92a,_0x486eaf){_0x3ff92a=_0x3ff92a-0x0;var _0x2ad80f=_0x559b[_0x3ff92a];return _0x2ad80f;};'use strict';var Sequelize=require(_0xb559('0x0'));module[_0xb559('0x1')]={'name':{'type':Sequelize[_0xb559('0x2')]},'description':{'type':Sequelize[_0xb559('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 9b5521a..472a34b 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 _0xe0dc=['../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','error','stack','name','index','map','FreshdeskConfiguration','rawAttributes','fieldName','model','query','keys','intersection','attributes','nolimit','sort','where','filters','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','getFields','findOne','fields','order','hasOwnProperty','pick','getSubjects','getDescriptions','FreshdeskField','getTags','Tag','ids','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xe0dc,0x190));var _0xce0d=function(_0xf34b0a,_0x11e116){_0xf34b0a=_0xf34b0a-0x0;var _0x5021e1=_0xe0dc[_0xf34b0a];return _0x5021e1;};'use strict';var emlformat=require(_0xce0d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xce0d('0x1'));var jsonpatch=require(_0xce0d('0x2'));var rp=require('request-promise');var moment=require(_0xce0d('0x3'));var BPromise=require(_0xce0d('0x4'));var Mustache=require(_0xce0d('0x5'));var util=require(_0xce0d('0x6'));var path=require('path');var sox=require(_0xce0d('0x7'));var csv=require('to-csv');var ejs=require(_0xce0d('0x8'));var fs=require('fs');var fs_extra=require(_0xce0d('0x9'));var _=require(_0xce0d('0xa'));var squel=require(_0xce0d('0xb'));var crypto=require(_0xce0d('0xc'));var jsforce=require(_0xce0d('0xd'));var deskjs=require(_0xce0d('0xe'));var toCsv=require(_0xce0d('0xf'));var querystring=require(_0xce0d('0x10'));var Papa=require(_0xce0d('0x11'));var Redis=require(_0xce0d('0x12'));var authService=require(_0xce0d('0x13'));var qs=require(_0xce0d('0x14'));var as=require(_0xce0d('0x15'));var hardwareService=require(_0xce0d('0x16'));var logger=require(_0xce0d('0x17'))(_0xce0d('0x18'));var utils=require(_0xce0d('0x19'));var config=require(_0xce0d('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xce0d('0x1b'))['db'];function respondWithStatusCode(_0x419b8a,_0x2a802c){_0x2a802c=_0x2a802c||0xcc;return function(_0x29a87c){if(_0x29a87c){return _0x419b8a[_0xce0d('0x1c')](_0x2a802c);}return _0x419b8a[_0xce0d('0x1d')](_0x2a802c)[_0xce0d('0x1e')]();};}function respondWithResult(_0x178400,_0x18a96e){_0x18a96e=_0x18a96e||0xc8;return function(_0xfba354){if(_0xfba354){return _0x178400[_0xce0d('0x1d')](_0x18a96e)[_0xce0d('0x1f')](_0xfba354);}};}function respondWithFilteredResult(_0x2a2f69,_0x3bedc2){return function(_0xef9e5f){if(_0xef9e5f){var _0x176c81=typeof _0x3bedc2[_0xce0d('0x20')]===_0xce0d('0x21')&&typeof _0x3bedc2[_0xce0d('0x22')]===_0xce0d('0x21');var _0x2044df=_0xef9e5f[_0xce0d('0x23')];var _0x1dc8aa=_0x176c81?0x0:_0x3bedc2[_0xce0d('0x20')];var _0x3378f2=_0x176c81?_0xef9e5f[_0xce0d('0x23')]:_0x3bedc2[_0xce0d('0x20')]+_0x3bedc2[_0xce0d('0x22')];var _0x37aae8;if(_0x3378f2>=_0x2044df){_0x3378f2=_0x2044df;_0x37aae8=0xc8;}else{_0x37aae8=0xce;}_0x2a2f69[_0xce0d('0x1d')](_0x37aae8);return _0x2a2f69[_0xce0d('0x24')](_0xce0d('0x25'),_0x1dc8aa+'-'+_0x3378f2+'/'+_0x2044df)[_0xce0d('0x1f')](_0xef9e5f);}return null;};}function patchUpdates(_0x1fb46d){return function(_0x8388e3){try{jsonpatch[_0xce0d('0x26')](_0x8388e3,_0x1fb46d,!![]);}catch(_0x16788f){return BPromise['reject'](_0x16788f);}return _0x8388e3['save']();};}function saveUpdates(_0xa0277a,_0x4da3f6){return function(_0x2727c2){if(_0x2727c2){return _0x2727c2[_0xce0d('0x27')](_0xa0277a)[_0xce0d('0x28')](function(_0x58d7c5){return _0x58d7c5;});}return null;};}function removeEntity(_0x1ff817,_0x542d3d){return function(_0x298f3e){if(_0x298f3e){return _0x298f3e['destroy']()[_0xce0d('0x28')](function(){_0x1ff817[_0xce0d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x516609,_0x31300f){return function(_0x201167){if(!_0x201167){_0x516609[_0xce0d('0x1c')](0x194);}return _0x201167;};}function handleError(_0x41b228,_0xdab05c){_0xdab05c=_0xdab05c||0x1f4;return function(_0x4cbaf4){logger[_0xce0d('0x29')](_0x4cbaf4[_0xce0d('0x2a')]);if(_0x4cbaf4[_0xce0d('0x2b')]){delete _0x4cbaf4['name'];}_0x41b228[_0xce0d('0x1d')](_0xdab05c)['send'](_0x4cbaf4);};}exports[_0xce0d('0x2c')]=function(_0x1eb234,_0x328842){var _0x435fd2={},_0x1a7f8c={},_0x3c4ec8={'count':0x0,'rows':[]};var _0x2c9c1b=_[_0xce0d('0x2d')](db[_0xce0d('0x2e')][_0xce0d('0x2f')],function(_0x4171cb){return{'name':_0x4171cb[_0xce0d('0x30')],'type':_0x4171cb['type']['key']};});_0x1a7f8c[_0xce0d('0x31')]=_[_0xce0d('0x2d')](_0x2c9c1b,_0xce0d('0x2b'));_0x1a7f8c[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x1eb234['query']);_0x1a7f8c['filters']=_[_0xce0d('0x34')](_0x1a7f8c[_0xce0d('0x31')],_0x1a7f8c['query']);_0x435fd2['attributes']=_['intersection'](_0x1a7f8c[_0xce0d('0x31')],qs['fields'](_0x1eb234['query']['fields']));_0x435fd2[_0xce0d('0x35')]=_0x435fd2['attributes']['length']?_0x435fd2['attributes']:_0x1a7f8c['model'];if(!_0x1eb234['query']['hasOwnProperty'](_0xce0d('0x36'))){_0x435fd2[_0xce0d('0x22')]=qs[_0xce0d('0x22')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x22')]);_0x435fd2[_0xce0d('0x20')]=qs[_0xce0d('0x20')](_0x1eb234[_0xce0d('0x32')][_0xce0d('0x20')]);}_0x435fd2['order']=qs[_0xce0d('0x37')](_0x1eb234[_0xce0d('0x32')]['sort']);_0x435fd2[_0xce0d('0x38')]=qs[_0xce0d('0x39')](_['pick'](_0x1eb234['query'],_0x1a7f8c[_0xce0d('0x39')]),_0x2c9c1b);if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x435fd2[_0xce0d('0x38')]=_[_0xce0d('0x3b')](_0x435fd2['where'],{'$or':_['map'](_0x2c9c1b,function(_0x27d599){if(_0x27d599[_0xce0d('0x3c')]!=='VIRTUAL'){var _0x4d4297={};_0x4d4297[_0x27d599[_0xce0d('0x2b')]]={'$like':'%'+_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3a')]+'%'};return _0x4d4297;}})});}_0x435fd2=_[_0xce0d('0x3b')]({},_0x435fd2,_0x1eb234[_0xce0d('0x3d')]);var _0x1cfa6c={'where':_0x435fd2['where']};return db[_0xce0d('0x2e')][_0xce0d('0x23')](_0x1cfa6c)[_0xce0d('0x28')](function(_0x18a56f){_0x3c4ec8[_0xce0d('0x23')]=_0x18a56f;if(_0x1eb234[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x435fd2[_0xce0d('0x3f')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xce0d('0x40')](_0x435fd2);})['then'](function(_0x6352f9){_0x3c4ec8[_0xce0d('0x41')]=_0x6352f9;return _0x3c4ec8;})[_0xce0d('0x28')](respondWithFilteredResult(_0x328842,_0x435fd2))[_0xce0d('0x42')](handleError(_0x328842,null));};exports[_0xce0d('0x43')]=function(_0x4abd42,_0x118d68){var _0x1d19ed={'raw':![],'where':{'id':_0x4abd42[_0xce0d('0x44')]['id']}},_0x5457d8={};_0x5457d8['model']=_[_0xce0d('0x33')](db[_0xce0d('0x2e')][_0xce0d('0x2f')]);_0x5457d8['query']=_[_0xce0d('0x33')](_0x4abd42[_0xce0d('0x32')]);_0x5457d8['filters']=_['intersection'](_0x5457d8[_0xce0d('0x31')],_0x5457d8[_0xce0d('0x32')]);_0x1d19ed[_0xce0d('0x35')]=_[_0xce0d('0x34')](_0x5457d8[_0xce0d('0x31')],qs['fields'](_0x4abd42['query']['fields']));_0x1d19ed[_0xce0d('0x35')]=_0x1d19ed[_0xce0d('0x35')][_0xce0d('0x45')]?_0x1d19ed[_0xce0d('0x35')]:_0x5457d8[_0xce0d('0x31')];if(_0x4abd42[_0xce0d('0x32')][_0xce0d('0x3e')]){_0x1d19ed['include']=[{'all':!![]}];}_0x1d19ed=_['merge']({},_0x1d19ed,_0x4abd42[_0xce0d('0x3d')]);return db[_0xce0d('0x2e')][_0xce0d('0x46')](_0x1d19ed)[_0xce0d('0x28')](handleEntityNotFound(_0x118d68,null))[_0xce0d('0x28')](respondWithResult(_0x118d68,null))[_0xce0d('0x42')](handleError(_0x118d68,null));};exports[_0xce0d('0x47')]=function(_0x47daa0,_0x362827){return db['FreshdeskConfiguration']['create'](_0x47daa0[_0xce0d('0x48')],{})[_0xce0d('0x28')](respondWithResult(_0x362827,0xc9))[_0xce0d('0x42')](handleError(_0x362827,null));};exports['update']=function(_0x641547,_0x36f502){if(_0x641547['body']['id']){delete _0x641547[_0xce0d('0x48')]['id'];}return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x641547[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x36f502,null))[_0xce0d('0x28')](saveUpdates(_0x641547[_0xce0d('0x48')],null))[_0xce0d('0x28')](respondWithResult(_0x36f502,null))[_0xce0d('0x42')](handleError(_0x36f502,null));};exports['destroy']=function(_0x327487,_0x4438e3){return db[_0xce0d('0x2e')][_0xce0d('0x46')]({'where':{'id':_0x327487['params']['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x4438e3,null))[_0xce0d('0x28')](removeEntity(_0x4438e3,null))['catch'](handleError(_0x4438e3,null));};exports[_0xce0d('0x49')]=function(_0x546126,_0x15a49b,_0x5dbdd7){var _0x5a2653={};var _0x37c636={};var _0x4632a1;var _0x3d9c12;return db[_0xce0d('0x2e')][_0xce0d('0x4a')]({'where':{'id':_0x546126[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x15a49b,null))[_0xce0d('0x28')](function(_0x18fb01){if(_0x18fb01){_0x4632a1=_0x18fb01;_0x37c636[_0xce0d('0x31')]=_['keys'](db['FreshdeskField'][_0xce0d('0x2f')]);_0x37c636[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x546126[_0xce0d('0x32')]);_0x37c636[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x37c636[_0xce0d('0x31')],_0x37c636[_0xce0d('0x32')]);_0x5a2653['attributes']=_[_0xce0d('0x34')](_0x37c636[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x546126[_0xce0d('0x32')][_0xce0d('0x4b')]));_0x5a2653[_0xce0d('0x35')]=_0x5a2653['attributes']['length']?_0x5a2653['attributes']:_0x37c636['model'];_0x5a2653[_0xce0d('0x4c')]=qs['sort'](_0x546126[_0xce0d('0x32')][_0xce0d('0x37')]);_0x5a2653[_0xce0d('0x38')]=qs['filters'](_['pick'](_0x546126[_0xce0d('0x32')],_0x37c636[_0xce0d('0x39')]));if(_0x546126[_0xce0d('0x32')]['filter']){_0x5a2653[_0xce0d('0x38')]=_['merge'](_0x5a2653[_0xce0d('0x38')],{'$or':_['map'](_0x5a2653[_0xce0d('0x35')],function(_0x3430a9){var _0x298868={};_0x298868[_0x3430a9]={'$like':'%'+_0x546126[_0xce0d('0x32')]['filter']+'%'};return _0x298868;})});}_0x5a2653=_[_0xce0d('0x3b')]({},_0x5a2653,_0x546126[_0xce0d('0x3d')]);return _0x4632a1[_0xce0d('0x49')](_0x5a2653);}})['then'](function(_0x414d0b){if(_0x414d0b){_0x3d9c12=_0x414d0b[_0xce0d('0x45')];if(!_0x546126[_0xce0d('0x32')][_0xce0d('0x4d')]('nolimit')){_0x5a2653['limit']=qs['limit'](_0x546126[_0xce0d('0x32')][_0xce0d('0x22')]);_0x5a2653[_0xce0d('0x20')]=qs['offset'](_0x546126[_0xce0d('0x32')][_0xce0d('0x20')]);}return _0x4632a1['getFields'](_0x5a2653);}})[_0xce0d('0x28')](function(_0x18f240){if(_0x18f240){return _0x18f240?{'count':_0x3d9c12,'rows':_0x18f240}:null;}})[_0xce0d('0x28')](respondWithResult(_0x15a49b,null))[_0xce0d('0x42')](handleError(_0x15a49b,null));};exports['getSubjects']=function(_0x102da1,_0x52abba,_0x500b0b){var _0x15382d={};var _0x313d3a={};var _0x119204;var _0x3b6624;return db['FreshdeskConfiguration'][_0xce0d('0x4a')]({'where':{'id':_0x102da1[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x52abba,null))[_0xce0d('0x28')](function(_0x130ac4){if(_0x130ac4){_0x119204=_0x130ac4;_0x313d3a['model']=_[_0xce0d('0x33')](db['FreshdeskField'][_0xce0d('0x2f')]);_0x313d3a['query']=_[_0xce0d('0x33')](_0x102da1[_0xce0d('0x32')]);_0x313d3a[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x313d3a['model'],_0x313d3a[_0xce0d('0x32')]);_0x15382d[_0xce0d('0x35')]=_[_0xce0d('0x34')](_0x313d3a[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x102da1[_0xce0d('0x32')][_0xce0d('0x4b')]));_0x15382d['attributes']=_0x15382d['attributes']['length']?_0x15382d['attributes']:_0x313d3a[_0xce0d('0x31')];_0x15382d[_0xce0d('0x4c')]=qs[_0xce0d('0x37')](_0x102da1[_0xce0d('0x32')][_0xce0d('0x37')]);_0x15382d[_0xce0d('0x38')]=qs['filters'](_[_0xce0d('0x4e')](_0x102da1[_0xce0d('0x32')],_0x313d3a[_0xce0d('0x39')]));if(_0x102da1[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x15382d['where']=_[_0xce0d('0x3b')](_0x15382d[_0xce0d('0x38')],{'$or':_[_0xce0d('0x2d')](_0x15382d[_0xce0d('0x35')],function(_0x1f002a){var _0x11d6a1={};_0x11d6a1[_0x1f002a]={'$like':'%'+_0x102da1['query'][_0xce0d('0x3a')]+'%'};return _0x11d6a1;})});}_0x15382d=_[_0xce0d('0x3b')]({},_0x15382d,_0x102da1['options']);return _0x119204['getSubjects'](_0x15382d);}})[_0xce0d('0x28')](function(_0x507f74){if(_0x507f74){_0x3b6624=_0x507f74[_0xce0d('0x45')];if(!_0x102da1['query'][_0xce0d('0x4d')](_0xce0d('0x36'))){_0x15382d['limit']=qs[_0xce0d('0x22')](_0x102da1['query'][_0xce0d('0x22')]);_0x15382d['offset']=qs[_0xce0d('0x20')](_0x102da1[_0xce0d('0x32')]['offset']);}return _0x119204[_0xce0d('0x4f')](_0x15382d);}})[_0xce0d('0x28')](function(_0xa05091){if(_0xa05091){return _0xa05091?{'count':_0x3b6624,'rows':_0xa05091}:null;}})['then'](respondWithResult(_0x52abba,null))[_0xce0d('0x42')](handleError(_0x52abba,null));};exports[_0xce0d('0x50')]=function(_0x3e87af,_0x42fe3b,_0xc4278){var _0x836090={};var _0x34e54d={};var _0x250f55;var _0x5266e1;return db[_0xce0d('0x2e')][_0xce0d('0x4a')]({'where':{'id':_0x3e87af[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x42fe3b,null))[_0xce0d('0x28')](function(_0x444fd0){if(_0x444fd0){_0x250f55=_0x444fd0;_0x34e54d[_0xce0d('0x31')]=_[_0xce0d('0x33')](db[_0xce0d('0x51')]['rawAttributes']);_0x34e54d[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x3e87af[_0xce0d('0x32')]);_0x34e54d[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x34e54d[_0xce0d('0x31')],_0x34e54d[_0xce0d('0x32')]);_0x836090['attributes']=_[_0xce0d('0x34')](_0x34e54d[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x3e87af['query'][_0xce0d('0x4b')]));_0x836090[_0xce0d('0x35')]=_0x836090[_0xce0d('0x35')][_0xce0d('0x45')]?_0x836090[_0xce0d('0x35')]:_0x34e54d[_0xce0d('0x31')];_0x836090[_0xce0d('0x4c')]=qs[_0xce0d('0x37')](_0x3e87af[_0xce0d('0x32')][_0xce0d('0x37')]);_0x836090[_0xce0d('0x38')]=qs[_0xce0d('0x39')](_[_0xce0d('0x4e')](_0x3e87af[_0xce0d('0x32')],_0x34e54d[_0xce0d('0x39')]));if(_0x3e87af[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x836090[_0xce0d('0x38')]=_[_0xce0d('0x3b')](_0x836090[_0xce0d('0x38')],{'$or':_[_0xce0d('0x2d')](_0x836090[_0xce0d('0x35')],function(_0x8059af){var _0x3e4d91={};_0x3e4d91[_0x8059af]={'$like':'%'+_0x3e87af[_0xce0d('0x32')]['filter']+'%'};return _0x3e4d91;})});}_0x836090=_[_0xce0d('0x3b')]({},_0x836090,_0x3e87af[_0xce0d('0x3d')]);return _0x250f55['getDescriptions'](_0x836090);}})[_0xce0d('0x28')](function(_0x58fd87){if(_0x58fd87){_0x5266e1=_0x58fd87[_0xce0d('0x45')];if(!_0x3e87af['query'][_0xce0d('0x4d')](_0xce0d('0x36'))){_0x836090['limit']=qs['limit'](_0x3e87af[_0xce0d('0x32')]['limit']);_0x836090[_0xce0d('0x20')]=qs['offset'](_0x3e87af[_0xce0d('0x32')]['offset']);}return _0x250f55[_0xce0d('0x50')](_0x836090);}})['then'](function(_0x2a3800){if(_0x2a3800){return _0x2a3800?{'count':_0x5266e1,'rows':_0x2a3800}:null;}})[_0xce0d('0x28')](respondWithResult(_0x42fe3b,null))[_0xce0d('0x42')](handleError(_0x42fe3b,null));};exports[_0xce0d('0x52')]=function(_0x8f36bb,_0x208679,_0x53d32e){var _0x2573de={};var _0x55ea8d={};var _0xbd36af;var _0x5ad7b5;return db['FreshdeskConfiguration'][_0xce0d('0x4a')]({'where':{'id':_0x8f36bb[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x208679,null))[_0xce0d('0x28')](function(_0x41ba80){if(_0x41ba80){_0xbd36af=_0x41ba80;_0x55ea8d[_0xce0d('0x31')]=_['keys'](db[_0xce0d('0x53')][_0xce0d('0x2f')]);_0x55ea8d[_0xce0d('0x32')]=_[_0xce0d('0x33')](_0x8f36bb[_0xce0d('0x32')]);_0x55ea8d[_0xce0d('0x39')]=_[_0xce0d('0x34')](_0x55ea8d[_0xce0d('0x31')],_0x55ea8d[_0xce0d('0x32')]);_0x2573de[_0xce0d('0x35')]=_['intersection'](_0x55ea8d[_0xce0d('0x31')],qs[_0xce0d('0x4b')](_0x8f36bb['query'][_0xce0d('0x4b')]));_0x2573de[_0xce0d('0x35')]=_0x2573de[_0xce0d('0x35')][_0xce0d('0x45')]?_0x2573de[_0xce0d('0x35')]:_0x55ea8d[_0xce0d('0x31')];_0x2573de[_0xce0d('0x4c')]=qs[_0xce0d('0x37')](_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x37')]);_0x2573de[_0xce0d('0x38')]=qs['filters'](_[_0xce0d('0x4e')](_0x8f36bb['query'],_0x55ea8d[_0xce0d('0x39')]));if(_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x3a')]){_0x2573de[_0xce0d('0x38')]=_['merge'](_0x2573de[_0xce0d('0x38')],{'$or':_['map'](_0x2573de['attributes'],function(_0x426c0f){var _0x1ae7c4={};_0x1ae7c4[_0x426c0f]={'$like':'%'+_0x8f36bb[_0xce0d('0x32')]['filter']+'%'};return _0x1ae7c4;})});}_0x2573de=_[_0xce0d('0x3b')]({},_0x2573de,_0x8f36bb['options']);return _0xbd36af[_0xce0d('0x52')](_0x2573de);}})[_0xce0d('0x28')](function(_0x575d6a){if(_0x575d6a){_0x5ad7b5=_0x575d6a[_0xce0d('0x45')];if(!_0x8f36bb['query']['hasOwnProperty'](_0xce0d('0x36'))){_0x2573de[_0xce0d('0x22')]=qs[_0xce0d('0x22')](_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x22')]);_0x2573de[_0xce0d('0x20')]=qs[_0xce0d('0x20')](_0x8f36bb[_0xce0d('0x32')][_0xce0d('0x20')]);}return _0xbd36af[_0xce0d('0x52')](_0x2573de);}})[_0xce0d('0x28')](function(_0x1b8983){if(_0x1b8983){return _0x1b8983?{'count':_0x5ad7b5,'rows':_0x1b8983}:null;}})[_0xce0d('0x28')](respondWithResult(_0x208679,null))['catch'](handleError(_0x208679,null));};exports['setTags']=function(_0x24802a,_0x3e06a2,_0x2f2531){if(_0x24802a[_0xce0d('0x48')]['id']){delete _0x24802a[_0xce0d('0x48')]['id'];}return db[_0xce0d('0x2e')]['findOne']({'where':{'id':_0x24802a[_0xce0d('0x44')]['id']}})[_0xce0d('0x28')](handleEntityNotFound(_0x3e06a2,null))[_0xce0d('0x28')](function(_0x1fa275){if(_0x1fa275){return _0x1fa275['setTags'](_0x24802a[_0xce0d('0x48')][_0xce0d('0x54')]||[]);}return null;})[_0xce0d('0x28')](respondWithResult(_0x3e06a2,null))[_0xce0d('0x42')](handleError(_0x3e06a2,null));}; \ No newline at end of file +var _0x8050=['filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','create','body','update','findOne','getFields','hasOwnProperty','getSubjects','getDescriptions','FreshdeskField','getTags','ids','rimraf','zip-dir','request-promise','moment','mustache','util','path','to-csv','fs-extra','lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','destroy','then','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','name','query','keys'];(function(_0x1beab5,_0x575a40){var _0x4b1093=function(_0x1b7c87){while(--_0x1b7c87){_0x1beab5['push'](_0x1beab5['shift']());}};_0x4b1093(++_0x575a40);}(_0x8050,0xbd));var _0x0805=function(_0x10cee2,_0x34ae8a){_0x10cee2=_0x10cee2-0x0;var _0x54ace4=_0x8050[_0x10cee2];return _0x54ace4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0805('0x0'));var zipdir=require(_0x0805('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0805('0x2'));var moment=require(_0x0805('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0805('0x4'));var util=require(_0x0805('0x5'));var path=require(_0x0805('0x6'));var sox=require('sox');var csv=require(_0x0805('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0805('0x8'));var _=require(_0x0805('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0805('0xa'));var toCsv=require(_0x0805('0x7'));var querystring=require('querystring');var Papa=require(_0x0805('0xb'));var Redis=require(_0x0805('0xc'));var authService=require(_0x0805('0xd'));var qs=require(_0x0805('0xe'));var as=require(_0x0805('0xf'));var hardwareService=require(_0x0805('0x10'));var logger=require(_0x0805('0x11'))(_0x0805('0x12'));var utils=require('../../config/utils');var config=require(_0x0805('0x13'));var licenseUtil=require(_0x0805('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2ec15e,_0x4ab677){_0x4ab677=_0x4ab677||0xcc;return function(_0x5cf5d5){if(_0x5cf5d5){return _0x2ec15e[_0x0805('0x15')](_0x4ab677);}return _0x2ec15e[_0x0805('0x16')](_0x4ab677)[_0x0805('0x17')]();};}function respondWithResult(_0x5bbc3e,_0x5c1023){_0x5c1023=_0x5c1023||0xc8;return function(_0x56c80b){if(_0x56c80b){return _0x5bbc3e['status'](_0x5c1023)[_0x0805('0x18')](_0x56c80b);}};}function respondWithFilteredResult(_0x528e6a,_0x405bf6){return function(_0x425851){if(_0x425851){var _0x114d31=typeof _0x405bf6['offset']==='undefined'&&typeof _0x405bf6[_0x0805('0x19')]===_0x0805('0x1a');var _0x1d3549=_0x425851[_0x0805('0x1b')];var _0x4f6ab0=_0x114d31?0x0:_0x405bf6[_0x0805('0x1c')];var _0xfd3c03=_0x114d31?_0x425851[_0x0805('0x1b')]:_0x405bf6[_0x0805('0x1c')]+_0x405bf6[_0x0805('0x19')];var _0x111dc5;if(_0xfd3c03>=_0x1d3549){_0xfd3c03=_0x1d3549;_0x111dc5=0xc8;}else{_0x111dc5=0xce;}_0x528e6a['status'](_0x111dc5);return _0x528e6a[_0x0805('0x1d')](_0x0805('0x1e'),_0x4f6ab0+'-'+_0xfd3c03+'/'+_0x1d3549)['json'](_0x425851);}return null;};}function patchUpdates(_0x4698d0){return function(_0x409729){try{jsonpatch[_0x0805('0x1f')](_0x409729,_0x4698d0,!![]);}catch(_0x58f430){return BPromise[_0x0805('0x20')](_0x58f430);}return _0x409729[_0x0805('0x21')]();};}function saveUpdates(_0x3e8054,_0x5d0d90){return function(_0x485612){if(_0x485612){return _0x485612['update'](_0x3e8054)['then'](function(_0x5d4db5){return _0x5d4db5;});}return null;};}function removeEntity(_0x17e439,_0x59a9ec){return function(_0x42865c){if(_0x42865c){return _0x42865c[_0x0805('0x22')]()[_0x0805('0x23')](function(){_0x17e439[_0x0805('0x16')](0xcc)[_0x0805('0x17')]();});}};}function handleEntityNotFound(_0x5a6762,_0x21f6c3){return function(_0x278baf){if(!_0x278baf){_0x5a6762[_0x0805('0x15')](0x194);}return _0x278baf;};}function handleError(_0x42d872,_0x3768bd){_0x3768bd=_0x3768bd||0x1f4;return function(_0x2e4a5b){logger['error'](_0x2e4a5b['stack']);if(_0x2e4a5b['name']){delete _0x2e4a5b['name'];}_0x42d872['status'](_0x3768bd)[_0x0805('0x24')](_0x2e4a5b);};}exports[_0x0805('0x25')]=function(_0x40b3f5,_0x1354c6){var _0x35b61d={},_0x3e0da6={},_0x3a8a33={'count':0x0,'rows':[]};var _0x4cf02e=_[_0x0805('0x26')](db[_0x0805('0x27')][_0x0805('0x28')],function(_0x409de6){return{'name':_0x409de6[_0x0805('0x29')],'type':_0x409de6[_0x0805('0x2a')][_0x0805('0x2b')]};});_0x3e0da6[_0x0805('0x2c')]=_[_0x0805('0x26')](_0x4cf02e,_0x0805('0x2d'));_0x3e0da6[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x40b3f5['query']);_0x3e0da6[_0x0805('0x30')]=_[_0x0805('0x31')](_0x3e0da6[_0x0805('0x2c')],_0x3e0da6[_0x0805('0x2e')]);_0x35b61d[_0x0805('0x32')]=_[_0x0805('0x31')](_0x3e0da6['model'],qs[_0x0805('0x33')](_0x40b3f5['query']['fields']));_0x35b61d[_0x0805('0x32')]=_0x35b61d[_0x0805('0x32')][_0x0805('0x34')]?_0x35b61d[_0x0805('0x32')]:_0x3e0da6[_0x0805('0x2c')];if(!_0x40b3f5[_0x0805('0x2e')]['hasOwnProperty'](_0x0805('0x35'))){_0x35b61d[_0x0805('0x19')]=qs[_0x0805('0x19')](_0x40b3f5['query'][_0x0805('0x19')]);_0x35b61d[_0x0805('0x1c')]=qs['offset'](_0x40b3f5[_0x0805('0x2e')]['offset']);}_0x35b61d[_0x0805('0x36')]=qs['sort'](_0x40b3f5[_0x0805('0x2e')][_0x0805('0x37')]);_0x35b61d['where']=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x40b3f5['query'],_0x3e0da6[_0x0805('0x30')]),_0x4cf02e);if(_0x40b3f5[_0x0805('0x2e')][_0x0805('0x39')]){_0x35b61d[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x35b61d[_0x0805('0x3a')],{'$or':_[_0x0805('0x26')](_0x4cf02e,function(_0x297baf){if(_0x297baf[_0x0805('0x2a')]!==_0x0805('0x3c')){var _0x5767f4={};_0x5767f4[_0x297baf[_0x0805('0x2d')]]={'$like':'%'+_0x40b3f5['query'][_0x0805('0x39')]+'%'};return _0x5767f4;}})});}_0x35b61d=_[_0x0805('0x3b')]({},_0x35b61d,_0x40b3f5[_0x0805('0x3d')]);var _0x2cc2e4={'where':_0x35b61d[_0x0805('0x3a')]};return db[_0x0805('0x27')][_0x0805('0x1b')](_0x2cc2e4)[_0x0805('0x23')](function(_0xa603a4){_0x3a8a33[_0x0805('0x1b')]=_0xa603a4;if(_0x40b3f5[_0x0805('0x2e')][_0x0805('0x3e')]){_0x35b61d['include']=[{'all':!![]}];}return db[_0x0805('0x27')]['findAll'](_0x35b61d);})[_0x0805('0x23')](function(_0x4b49ea){_0x3a8a33[_0x0805('0x3f')]=_0x4b49ea;return _0x3a8a33;})['then'](respondWithFilteredResult(_0x1354c6,_0x35b61d))[_0x0805('0x40')](handleError(_0x1354c6,null));};exports['show']=function(_0x4d3988,_0x46abbb){var _0x555d92={'raw':![],'where':{'id':_0x4d3988[_0x0805('0x41')]['id']}},_0x20c852={};_0x20c852['model']=_[_0x0805('0x2f')](db[_0x0805('0x27')][_0x0805('0x28')]);_0x20c852[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x4d3988[_0x0805('0x2e')]);_0x20c852[_0x0805('0x30')]=_['intersection'](_0x20c852[_0x0805('0x2c')],_0x20c852[_0x0805('0x2e')]);_0x555d92[_0x0805('0x32')]=_[_0x0805('0x31')](_0x20c852[_0x0805('0x2c')],qs[_0x0805('0x33')](_0x4d3988[_0x0805('0x2e')][_0x0805('0x33')]));_0x555d92[_0x0805('0x32')]=_0x555d92[_0x0805('0x32')]['length']?_0x555d92[_0x0805('0x32')]:_0x20c852[_0x0805('0x2c')];if(_0x4d3988[_0x0805('0x2e')][_0x0805('0x3e')]){_0x555d92[_0x0805('0x42')]=[{'all':!![]}];}_0x555d92=_[_0x0805('0x3b')]({},_0x555d92,_0x4d3988['options']);return db[_0x0805('0x27')][_0x0805('0x43')](_0x555d92)['then'](handleEntityNotFound(_0x46abbb,null))[_0x0805('0x23')](respondWithResult(_0x46abbb,null))[_0x0805('0x40')](handleError(_0x46abbb,null));};exports[_0x0805('0x44')]=function(_0x96d3,_0x48ecfb){return db['FreshdeskConfiguration'][_0x0805('0x44')](_0x96d3[_0x0805('0x45')],{})[_0x0805('0x23')](respondWithResult(_0x48ecfb,0xc9))[_0x0805('0x40')](handleError(_0x48ecfb,null));};exports[_0x0805('0x46')]=function(_0xd2871b,_0x3df003){if(_0xd2871b[_0x0805('0x45')]['id']){delete _0xd2871b[_0x0805('0x45')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0xd2871b[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x3df003,null))[_0x0805('0x23')](saveUpdates(_0xd2871b[_0x0805('0x45')],null))[_0x0805('0x23')](respondWithResult(_0x3df003,null))[_0x0805('0x40')](handleError(_0x3df003,null));};exports[_0x0805('0x22')]=function(_0x1e8840,_0x2a6b09){return db['FreshdeskConfiguration'][_0x0805('0x43')]({'where':{'id':_0x1e8840['params']['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2a6b09,null))[_0x0805('0x23')](removeEntity(_0x2a6b09,null))[_0x0805('0x40')](handleError(_0x2a6b09,null));};exports['getFields']=function(_0x5c5441,_0x5b5859,_0x2fbceb){var _0x2fea2a={};var _0x470b76={};var _0x382a17;var _0x4472b7;return db['FreshdeskConfiguration'][_0x0805('0x47')]({'where':{'id':_0x5c5441['params']['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x5b5859,null))[_0x0805('0x23')](function(_0x454fc7){if(_0x454fc7){_0x382a17=_0x454fc7;_0x470b76[_0x0805('0x2c')]=_[_0x0805('0x2f')](db['FreshdeskField'][_0x0805('0x28')]);_0x470b76[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x5c5441[_0x0805('0x2e')]);_0x470b76[_0x0805('0x30')]=_[_0x0805('0x31')](_0x470b76[_0x0805('0x2c')],_0x470b76['query']);_0x2fea2a[_0x0805('0x32')]=_[_0x0805('0x31')](_0x470b76[_0x0805('0x2c')],qs[_0x0805('0x33')](_0x5c5441[_0x0805('0x2e')]['fields']));_0x2fea2a[_0x0805('0x32')]=_0x2fea2a['attributes'][_0x0805('0x34')]?_0x2fea2a[_0x0805('0x32')]:_0x470b76[_0x0805('0x2c')];_0x2fea2a[_0x0805('0x36')]=qs[_0x0805('0x37')](_0x5c5441[_0x0805('0x2e')][_0x0805('0x37')]);_0x2fea2a[_0x0805('0x3a')]=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x5c5441['query'],_0x470b76[_0x0805('0x30')]));if(_0x5c5441[_0x0805('0x2e')][_0x0805('0x39')]){_0x2fea2a[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x2fea2a[_0x0805('0x3a')],{'$or':_[_0x0805('0x26')](_0x2fea2a['attributes'],function(_0x35f324){var _0x4c40f2={};_0x4c40f2[_0x35f324]={'$like':'%'+_0x5c5441[_0x0805('0x2e')][_0x0805('0x39')]+'%'};return _0x4c40f2;})});}_0x2fea2a=_[_0x0805('0x3b')]({},_0x2fea2a,_0x5c5441[_0x0805('0x3d')]);return _0x382a17[_0x0805('0x48')](_0x2fea2a);}})[_0x0805('0x23')](function(_0x42017b){if(_0x42017b){_0x4472b7=_0x42017b[_0x0805('0x34')];if(!_0x5c5441[_0x0805('0x2e')][_0x0805('0x49')]('nolimit')){_0x2fea2a[_0x0805('0x19')]=qs['limit'](_0x5c5441['query']['limit']);_0x2fea2a[_0x0805('0x1c')]=qs[_0x0805('0x1c')](_0x5c5441[_0x0805('0x2e')]['offset']);}return _0x382a17[_0x0805('0x48')](_0x2fea2a);}})[_0x0805('0x23')](function(_0x3577cf){if(_0x3577cf){return _0x3577cf?{'count':_0x4472b7,'rows':_0x3577cf}:null;}})[_0x0805('0x23')](respondWithResult(_0x5b5859,null))[_0x0805('0x40')](handleError(_0x5b5859,null));};exports[_0x0805('0x4a')]=function(_0x343ecf,_0xd3c4a2,_0x54e9ba){var _0x12914f={};var _0x1a9fd7={};var _0x4237bc;var _0x1a69f3;return db[_0x0805('0x27')][_0x0805('0x47')]({'where':{'id':_0x343ecf[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0xd3c4a2,null))['then'](function(_0x278f4f){if(_0x278f4f){_0x4237bc=_0x278f4f;_0x1a9fd7[_0x0805('0x2c')]=_['keys'](db['FreshdeskField'][_0x0805('0x28')]);_0x1a9fd7[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x343ecf['query']);_0x1a9fd7[_0x0805('0x30')]=_[_0x0805('0x31')](_0x1a9fd7[_0x0805('0x2c')],_0x1a9fd7[_0x0805('0x2e')]);_0x12914f[_0x0805('0x32')]=_[_0x0805('0x31')](_0x1a9fd7[_0x0805('0x2c')],qs['fields'](_0x343ecf[_0x0805('0x2e')][_0x0805('0x33')]));_0x12914f[_0x0805('0x32')]=_0x12914f[_0x0805('0x32')][_0x0805('0x34')]?_0x12914f[_0x0805('0x32')]:_0x1a9fd7[_0x0805('0x2c')];_0x12914f[_0x0805('0x36')]=qs['sort'](_0x343ecf[_0x0805('0x2e')]['sort']);_0x12914f[_0x0805('0x3a')]=qs['filters'](_[_0x0805('0x38')](_0x343ecf['query'],_0x1a9fd7[_0x0805('0x30')]));if(_0x343ecf[_0x0805('0x2e')]['filter']){_0x12914f[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x12914f[_0x0805('0x3a')],{'$or':_[_0x0805('0x26')](_0x12914f['attributes'],function(_0x5c52d6){var _0x5b27e3={};_0x5b27e3[_0x5c52d6]={'$like':'%'+_0x343ecf[_0x0805('0x2e')][_0x0805('0x39')]+'%'};return _0x5b27e3;})});}_0x12914f=_['merge']({},_0x12914f,_0x343ecf[_0x0805('0x3d')]);return _0x4237bc[_0x0805('0x4a')](_0x12914f);}})['then'](function(_0x164995){if(_0x164995){_0x1a69f3=_0x164995[_0x0805('0x34')];if(!_0x343ecf[_0x0805('0x2e')][_0x0805('0x49')](_0x0805('0x35'))){_0x12914f[_0x0805('0x19')]=qs[_0x0805('0x19')](_0x343ecf[_0x0805('0x2e')]['limit']);_0x12914f[_0x0805('0x1c')]=qs['offset'](_0x343ecf[_0x0805('0x2e')][_0x0805('0x1c')]);}return _0x4237bc[_0x0805('0x4a')](_0x12914f);}})[_0x0805('0x23')](function(_0x2ee166){if(_0x2ee166){return _0x2ee166?{'count':_0x1a69f3,'rows':_0x2ee166}:null;}})[_0x0805('0x23')](respondWithResult(_0xd3c4a2,null))[_0x0805('0x40')](handleError(_0xd3c4a2,null));};exports[_0x0805('0x4b')]=function(_0x5b2e5f,_0x2bc903,_0x2e2f00){var _0x68da45={};var _0x1ebcf6={};var _0x3d89e5;var _0x3d1c43;return db[_0x0805('0x27')]['findOne']({'where':{'id':_0x5b2e5f[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2bc903,null))[_0x0805('0x23')](function(_0x43cdb1){if(_0x43cdb1){_0x3d89e5=_0x43cdb1;_0x1ebcf6[_0x0805('0x2c')]=_[_0x0805('0x2f')](db[_0x0805('0x4c')][_0x0805('0x28')]);_0x1ebcf6[_0x0805('0x2e')]=_[_0x0805('0x2f')](_0x5b2e5f[_0x0805('0x2e')]);_0x1ebcf6[_0x0805('0x30')]=_[_0x0805('0x31')](_0x1ebcf6['model'],_0x1ebcf6[_0x0805('0x2e')]);_0x68da45[_0x0805('0x32')]=_[_0x0805('0x31')](_0x1ebcf6[_0x0805('0x2c')],qs['fields'](_0x5b2e5f[_0x0805('0x2e')]['fields']));_0x68da45[_0x0805('0x32')]=_0x68da45[_0x0805('0x32')][_0x0805('0x34')]?_0x68da45[_0x0805('0x32')]:_0x1ebcf6[_0x0805('0x2c')];_0x68da45[_0x0805('0x36')]=qs['sort'](_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x37')]);_0x68da45[_0x0805('0x3a')]=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x5b2e5f['query'],_0x1ebcf6[_0x0805('0x30')]));if(_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x39')]){_0x68da45[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x68da45['where'],{'$or':_[_0x0805('0x26')](_0x68da45[_0x0805('0x32')],function(_0x199bcf){var _0x5356ce={};_0x5356ce[_0x199bcf]={'$like':'%'+_0x5b2e5f['query'][_0x0805('0x39')]+'%'};return _0x5356ce;})});}_0x68da45=_[_0x0805('0x3b')]({},_0x68da45,_0x5b2e5f['options']);return _0x3d89e5[_0x0805('0x4b')](_0x68da45);}})[_0x0805('0x23')](function(_0x1e3393){if(_0x1e3393){_0x3d1c43=_0x1e3393[_0x0805('0x34')];if(!_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x49')](_0x0805('0x35'))){_0x68da45[_0x0805('0x19')]=qs['limit'](_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x19')]);_0x68da45[_0x0805('0x1c')]=qs[_0x0805('0x1c')](_0x5b2e5f[_0x0805('0x2e')][_0x0805('0x1c')]);}return _0x3d89e5[_0x0805('0x4b')](_0x68da45);}})[_0x0805('0x23')](function(_0x3b44a4){if(_0x3b44a4){return _0x3b44a4?{'count':_0x3d1c43,'rows':_0x3b44a4}:null;}})[_0x0805('0x23')](respondWithResult(_0x2bc903,null))[_0x0805('0x40')](handleError(_0x2bc903,null));};exports[_0x0805('0x4d')]=function(_0x39fc55,_0x2c4ec0,_0x38c67a){var _0x172aaa={};var _0x5429ed={};var _0x1204b1;var _0x320182;return db['FreshdeskConfiguration'][_0x0805('0x47')]({'where':{'id':_0x39fc55['params']['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2c4ec0,null))[_0x0805('0x23')](function(_0x27e256){if(_0x27e256){_0x1204b1=_0x27e256;_0x5429ed[_0x0805('0x2c')]=_['keys'](db['Tag']['rawAttributes']);_0x5429ed[_0x0805('0x2e')]=_['keys'](_0x39fc55[_0x0805('0x2e')]);_0x5429ed[_0x0805('0x30')]=_[_0x0805('0x31')](_0x5429ed[_0x0805('0x2c')],_0x5429ed[_0x0805('0x2e')]);_0x172aaa[_0x0805('0x32')]=_[_0x0805('0x31')](_0x5429ed['model'],qs[_0x0805('0x33')](_0x39fc55[_0x0805('0x2e')][_0x0805('0x33')]));_0x172aaa[_0x0805('0x32')]=_0x172aaa[_0x0805('0x32')][_0x0805('0x34')]?_0x172aaa['attributes']:_0x5429ed[_0x0805('0x2c')];_0x172aaa['order']=qs['sort'](_0x39fc55[_0x0805('0x2e')][_0x0805('0x37')]);_0x172aaa['where']=qs[_0x0805('0x30')](_[_0x0805('0x38')](_0x39fc55[_0x0805('0x2e')],_0x5429ed['filters']));if(_0x39fc55[_0x0805('0x2e')]['filter']){_0x172aaa[_0x0805('0x3a')]=_[_0x0805('0x3b')](_0x172aaa['where'],{'$or':_[_0x0805('0x26')](_0x172aaa[_0x0805('0x32')],function(_0x1ede38){var _0x3d2723={};_0x3d2723[_0x1ede38]={'$like':'%'+_0x39fc55[_0x0805('0x2e')][_0x0805('0x39')]+'%'};return _0x3d2723;})});}_0x172aaa=_[_0x0805('0x3b')]({},_0x172aaa,_0x39fc55[_0x0805('0x3d')]);return _0x1204b1['getTags'](_0x172aaa);}})['then'](function(_0x4d5ccf){if(_0x4d5ccf){_0x320182=_0x4d5ccf[_0x0805('0x34')];if(!_0x39fc55['query'][_0x0805('0x49')](_0x0805('0x35'))){_0x172aaa[_0x0805('0x19')]=qs['limit'](_0x39fc55[_0x0805('0x2e')][_0x0805('0x19')]);_0x172aaa['offset']=qs[_0x0805('0x1c')](_0x39fc55[_0x0805('0x2e')][_0x0805('0x1c')]);}return _0x1204b1[_0x0805('0x4d')](_0x172aaa);}})[_0x0805('0x23')](function(_0x45ff8c){if(_0x45ff8c){return _0x45ff8c?{'count':_0x320182,'rows':_0x45ff8c}:null;}})[_0x0805('0x23')](respondWithResult(_0x2c4ec0,null))[_0x0805('0x40')](handleError(_0x2c4ec0,null));};exports['setTags']=function(_0x45acf3,_0x2acde1,_0x3e23e7){if(_0x45acf3['body']['id']){delete _0x45acf3[_0x0805('0x45')]['id'];}return db[_0x0805('0x27')]['findOne']({'where':{'id':_0x45acf3[_0x0805('0x41')]['id']}})[_0x0805('0x23')](handleEntityNotFound(_0x2acde1,null))['then'](function(_0x431261){if(_0x431261){return _0x431261['setTags'](_0x45acf3[_0x0805('0x45')][_0x0805('0x4e')]||[]);}return null;})['then'](respondWithResult(_0x2acde1,null))[_0x0805('0x40')](handleError(_0x2acde1,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index cf403af..5fa1b35 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 _0xd033=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util'];(function(_0x31c1b6,_0x18ccb5){var _0x549c7f=function(_0x217e56){while(--_0x217e56){_0x31c1b6['push'](_0x31c1b6['shift']());}};_0x549c7f(++_0x18ccb5);}(_0xd033,0xc2));var _0x3d03=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xd033[_0x533e4e];return _0x1f14bb;};'use strict';var _=require(_0x3d03('0x0'));var util=require(_0x3d03('0x1'));var logger=require('../../config/logger')(_0x3d03('0x2'));var moment=require(_0x3d03('0x3'));var BPromise=require(_0x3d03('0x4'));var rp=require(_0x3d03('0x5'));var fs=require('fs');var path=require(_0x3d03('0x6'));var rimraf=require(_0x3d03('0x7'));var config=require(_0x3d03('0x8'));var attributes=require(_0x3d03('0x9'));module[_0x3d03('0xa')]=function(_0x5db176,_0x5a83e7){return _0x5db176[_0x3d03('0xb')](_0x3d03('0xc'),attributes,{'tableName':_0x3d03('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0fc=['path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','util','../../config/logger','api','bluebird','request-promise'];(function(_0x258fb0,_0x5362dc){var _0x4d1afe=function(_0x1c8f24){while(--_0x1c8f24){_0x258fb0['push'](_0x258fb0['shift']());}};_0x4d1afe(++_0x5362dc);}(_0xc0fc,0x1c9));var _0xcc0f=function(_0x282331,_0x20ba03){_0x282331=_0x282331-0x0;var _0x505576=_0xc0fc[_0x282331];return _0x505576;};'use strict';var _=require('lodash');var util=require(_0xcc0f('0x0'));var logger=require(_0xcc0f('0x1'))(_0xcc0f('0x2'));var moment=require('moment');var BPromise=require(_0xcc0f('0x3'));var rp=require(_0xcc0f('0x4'));var fs=require('fs');var path=require(_0xcc0f('0x5'));var rimraf=require(_0xcc0f('0x6'));var config=require(_0xcc0f('0x7'));var attributes=require(_0xcc0f('0x8'));module[_0xcc0f('0x9')]=function(_0x452367,_0x3ad690){return _0x452367[_0xcc0f('0xa')]('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 2f58274..cd99b83 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 _0x3dda=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x3dda,0x180));var _0xa3dd=function(_0x279a91,_0x2c6dbf){_0x279a91=_0x279a91-0x0;var _0x5c7d99=_0x3dda[_0x279a91];return _0x5c7d99;};'use strict';var _=require(_0xa3dd('0x0'));var util=require(_0xa3dd('0x1'));var moment=require(_0xa3dd('0x2'));var BPromise=require(_0xa3dd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa3dd('0x4'));var db=require(_0xa3dd('0x5'))['db'];var utils=require(_0xa3dd('0x6'));var logger=require('../../config/logger')(_0xa3dd('0x7'));var config=require('../../config/environment');var jayson=require(_0xa3dd('0x8'));var client=jayson[_0xa3dd('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x181745,_0x48e702,_0x1ad110){return new BPromise(function(_0x5535be,_0x15889f){return client[_0xa3dd('0xa')](_0x181745,_0x1ad110)['then'](function(_0x1b7e2b){logger[_0xa3dd('0xb')](_0xa3dd('0xc'),_0x48e702,_0xa3dd('0xd'));logger[_0xa3dd('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x48e702,_0xa3dd('0xd'),JSON[_0xa3dd('0xf')](_0x1b7e2b));if(_0x1b7e2b['error']){if(_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x11')]===0x1f4){logger[_0xa3dd('0x10')](_0xa3dd('0xc'),_0x48e702,_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);return _0x15889f(_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);}logger['error'](_0xa3dd('0xc'),_0x48e702,_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);return _0x5535be(_0x1b7e2b[_0xa3dd('0x10')][_0xa3dd('0x12')]);}else{logger['info'](_0xa3dd('0xc'),_0x48e702,_0xa3dd('0xd'));_0x5535be(_0x1b7e2b[_0xa3dd('0x13')][_0xa3dd('0x12')]);}})[_0xa3dd('0x14')](function(_0x5021b0){logger[_0xa3dd('0x10')](_0xa3dd('0xc'),_0x48e702,_0x5021b0);_0x15889f(_0x5021b0);});});} \ No newline at end of file +var _0x9847=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshdeskConfiguration,\x20%s,\x20%s'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9847,0x10f));var _0x7984=function(_0x484209,_0x202d7d){_0x484209=_0x484209-0x0;var _0x5cc99f=_0x9847[_0x484209];return _0x5cc99f;};'use strict';var _=require(_0x7984('0x0'));var util=require(_0x7984('0x1'));var moment=require(_0x7984('0x2'));var BPromise=require(_0x7984('0x3'));var rs=require(_0x7984('0x4'));var fs=require('fs');var Redis=require(_0x7984('0x5'));var db=require(_0x7984('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7984('0x7'));var config=require(_0x7984('0x8'));var jayson=require(_0x7984('0x9'));var client=jayson[_0x7984('0xa')][_0x7984('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1cf3fd,_0x420b34,_0x3daa87){return new BPromise(function(_0x5970e1,_0x352cc2){return client[_0x7984('0xc')](_0x1cf3fd,_0x3daa87)['then'](function(_0x1ccbc7){logger[_0x7984('0xd')](_0x7984('0xe'),_0x420b34,'request\x20sent');logger['debug'](_0x7984('0xf'),_0x420b34,_0x7984('0x10'),JSON[_0x7984('0x11')](_0x1ccbc7));if(_0x1ccbc7[_0x7984('0x12')]){if(_0x1ccbc7[_0x7984('0x12')][_0x7984('0x13')]===0x1f4){logger['error'](_0x7984('0xe'),_0x420b34,_0x1ccbc7['error'][_0x7984('0x14')]);return _0x352cc2(_0x1ccbc7[_0x7984('0x12')][_0x7984('0x14')]);}logger[_0x7984('0x12')](_0x7984('0xe'),_0x420b34,_0x1ccbc7[_0x7984('0x12')][_0x7984('0x14')]);return _0x5970e1(_0x1ccbc7['error'][_0x7984('0x14')]);}else{logger['info'](_0x7984('0xe'),_0x420b34,_0x7984('0x10'));_0x5970e1(_0x1ccbc7[_0x7984('0x15')][_0x7984('0x14')]);}})['catch'](function(_0x25925f){logger['error'](_0x7984('0xe'),_0x420b34,_0x25925f);_0x352cc2(_0x25925f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index bff6451..07b0c74 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 _0x1eb9=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','multer'];(function(_0x23e05c,_0x102ee1){var _0x7a4446=function(_0x127c5d){while(--_0x127c5d){_0x23e05c['push'](_0x23e05c['shift']());}};_0x7a4446(++_0x102ee1);}(_0x1eb9,0x1db));var _0x91eb=function(_0x204243,_0x38b7b0){_0x204243=_0x204243-0x0;var _0x51c3a7=_0x1eb9[_0x204243];return _0x51c3a7;};'use strict';var multer=require(_0x91eb('0x0'));var util=require(_0x91eb('0x1'));var path=require('path');var timeout=require(_0x91eb('0x2'));var express=require(_0x91eb('0x3'));var router=express[_0x91eb('0x4')]();var fs_extra=require(_0x91eb('0x5'));var auth=require(_0x91eb('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x91eb('0x7')]('/',auth[_0x91eb('0x8')](),controller[_0x91eb('0x9')]);router[_0x91eb('0x7')](_0x91eb('0xa'),auth[_0x91eb('0x8')](),controller[_0x91eb('0xb')]);router[_0x91eb('0xc')]('/',auth[_0x91eb('0x8')](),controller[_0x91eb('0xd')]);router[_0x91eb('0xe')](_0x91eb('0xa'),auth[_0x91eb('0x8')](),controller[_0x91eb('0xf')]);router[_0x91eb('0x10')](_0x91eb('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb18c=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','show','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xb18c,0xfe));var _0xcb18=function(_0x197e82,_0x1514d2){_0x197e82=_0x197e82-0x0;var _0x12caa4=_0xb18c[_0x197e82];return _0x12caa4;};'use strict';var multer=require(_0xcb18('0x0'));var util=require(_0xcb18('0x1'));var path=require('path');var timeout=require(_0xcb18('0x2'));var express=require(_0xcb18('0x3'));var router=express[_0xcb18('0x4')]();var fs_extra=require(_0xcb18('0x5'));var auth=require(_0xcb18('0x6'));var interaction=require(_0xcb18('0x7'));var config=require(_0xcb18('0x8'));var controller=require(_0xcb18('0x9'));router[_0xcb18('0xa')]('/',auth[_0xcb18('0xb')](),controller[_0xcb18('0xc')]);router[_0xcb18('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xcb18('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xcb18('0xe')]);router[_0xcb18('0xf')](_0xcb18('0x10'),auth[_0xcb18('0xb')](),controller[_0xcb18('0x11')]);router[_0xcb18('0x12')]('/:id',auth[_0xcb18('0xb')](),controller['destroy']);module[_0xcb18('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 05d7923..83439e1 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 _0x7caf=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x7caf,0x153));var _0xf7ca=function(_0x45416a,_0x50d3ec){_0x45416a=_0x45416a-0x0;var _0x5c24f3=_0x7caf[_0x45416a];return _0x5c24f3;};'use strict';var Sequelize=require(_0xf7ca('0x0'));module[_0xf7ca('0x1')]={'type':{'type':Sequelize[_0xf7ca('0x2')]('string',_0xf7ca('0x3'),_0xf7ca('0x4'),_0xf7ca('0x5'),_0xf7ca('0x6')),'defaultValue':_0xf7ca('0x7')},'content':{'type':Sequelize[_0xf7ca('0x8')]},'key':{'type':Sequelize[_0xf7ca('0x8')]},'keyType':{'type':Sequelize[_0xf7ca('0x2')](_0xf7ca('0x7'),_0xf7ca('0x3'),_0xf7ca('0x4'))},'keyContent':{'type':Sequelize[_0xf7ca('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf7ca('0x8')]},'customField':{'type':Sequelize[_0xf7ca('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf7ca('0x8')]}}; \ No newline at end of file +var _0x2097=['exports','ENUM','variable','customVariable','picklist','string','STRING','sequelize'];(function(_0x169eea,_0x41657a){var _0x270094=function(_0x47dbda){while(--_0x47dbda){_0x169eea['push'](_0x169eea['shift']());}};_0x270094(++_0x41657a);}(_0x2097,0x1d7));var _0x7209=function(_0x3a3394,_0x18f17c){_0x3a3394=_0x3a3394-0x0;var _0x6a96d9=_0x2097[_0x3a3394];return _0x6a96d9;};'use strict';var Sequelize=require(_0x7209('0x0'));module[_0x7209('0x1')]={'type':{'type':Sequelize[_0x7209('0x2')]('string',_0x7209('0x3'),_0x7209('0x4'),'keyValue',_0x7209('0x5')),'defaultValue':_0x7209('0x6')},'content':{'type':Sequelize[_0x7209('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x7209('0x2')](_0x7209('0x6'),_0x7209('0x3'),_0x7209('0x4'))},'keyContent':{'type':Sequelize[_0x7209('0x7')]},'idField':{'type':Sequelize[_0x7209('0x7')]},'nameField':{'type':Sequelize[_0x7209('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7209('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 8a747e4..f2bb5de 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 _0x153f=['count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','FreshdeskField','rawAttributes','fieldName','key','model','query','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','keys','intersection','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x56eb56,_0x2652f1){var _0x153525=function(_0xa2afc5){while(--_0xa2afc5){_0x56eb56['push'](_0x56eb56['shift']());}};_0x153525(++_0x2652f1);}(_0x153f,0x15b));var _0xf153=function(_0x2a4c79,_0x396ba2){_0x2a4c79=_0x2a4c79-0x0;var _0x1a6b3a=_0x153f[_0x2a4c79];return _0x1a6b3a;};'use strict';var emlformat=require(_0xf153('0x0'));var rimraf=require(_0xf153('0x1'));var zipdir=require(_0xf153('0x2'));var jsonpatch=require(_0xf153('0x3'));var rp=require(_0xf153('0x4'));var moment=require(_0xf153('0x5'));var BPromise=require(_0xf153('0x6'));var Mustache=require('mustache');var util=require(_0xf153('0x7'));var path=require('path');var sox=require(_0xf153('0x8'));var csv=require(_0xf153('0x9'));var ejs=require(_0xf153('0xa'));var fs=require('fs');var fs_extra=require(_0xf153('0xb'));var _=require(_0xf153('0xc'));var squel=require('squel');var crypto=require(_0xf153('0xd'));var jsforce=require(_0xf153('0xe'));var deskjs=require(_0xf153('0xf'));var toCsv=require(_0xf153('0x9'));var querystring=require(_0xf153('0x10'));var Papa=require(_0xf153('0x11'));var Redis=require(_0xf153('0x12'));var authService=require(_0xf153('0x13'));var qs=require(_0xf153('0x14'));var as=require(_0xf153('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf153('0x16'))(_0xf153('0x17'));var utils=require(_0xf153('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xf153('0x19'));var db=require(_0xf153('0x1a'))['db'];function respondWithStatusCode(_0x65756d,_0x1cc666){_0x1cc666=_0x1cc666||0xcc;return function(_0x256b7d){if(_0x256b7d){return _0x65756d[_0xf153('0x1b')](_0x1cc666);}return _0x65756d[_0xf153('0x1c')](_0x1cc666)[_0xf153('0x1d')]();};}function respondWithResult(_0x3e34fb,_0x4c5283){_0x4c5283=_0x4c5283||0xc8;return function(_0x18be7e){if(_0x18be7e){return _0x3e34fb[_0xf153('0x1c')](_0x4c5283)[_0xf153('0x1e')](_0x18be7e);}};}function respondWithFilteredResult(_0x406e6f,_0x3afea2){return function(_0x68f436){if(_0x68f436){var _0x273a90=typeof _0x3afea2[_0xf153('0x1f')]==='undefined'&&typeof _0x3afea2[_0xf153('0x20')]==='undefined';var _0x37093a=_0x68f436[_0xf153('0x21')];var _0x138dbe=_0x273a90?0x0:_0x3afea2[_0xf153('0x1f')];var _0x4e790d=_0x273a90?_0x68f436[_0xf153('0x21')]:_0x3afea2[_0xf153('0x1f')]+_0x3afea2[_0xf153('0x20')];var _0x14b83f;if(_0x4e790d>=_0x37093a){_0x4e790d=_0x37093a;_0x14b83f=0xc8;}else{_0x14b83f=0xce;}_0x406e6f[_0xf153('0x1c')](_0x14b83f);return _0x406e6f[_0xf153('0x22')](_0xf153('0x23'),_0x138dbe+'-'+_0x4e790d+'/'+_0x37093a)[_0xf153('0x1e')](_0x68f436);}return null;};}function patchUpdates(_0x3735a7){return function(_0x1dd340){try{jsonpatch[_0xf153('0x24')](_0x1dd340,_0x3735a7,!![]);}catch(_0x3665a2){return BPromise['reject'](_0x3665a2);}return _0x1dd340[_0xf153('0x25')]();};}function saveUpdates(_0x395f28,_0x3d3e41){return function(_0x32e759){if(_0x32e759){return _0x32e759[_0xf153('0x26')](_0x395f28)[_0xf153('0x27')](function(_0x465d88){return _0x465d88;});}return null;};}function removeEntity(_0x4376f7,_0xf67cde){return function(_0x38190c){if(_0x38190c){return _0x38190c[_0xf153('0x28')]()[_0xf153('0x27')](function(){_0x4376f7[_0xf153('0x1c')](0xcc)[_0xf153('0x1d')]();});}};}function handleEntityNotFound(_0xe490f8,_0x35f9da){return function(_0x141ef4){if(!_0x141ef4){_0xe490f8[_0xf153('0x1b')](0x194);}return _0x141ef4;};}function handleError(_0x23acc3,_0x17f7a4){_0x17f7a4=_0x17f7a4||0x1f4;return function(_0x48ebdc){logger[_0xf153('0x29')](_0x48ebdc[_0xf153('0x2a')]);if(_0x48ebdc['name']){delete _0x48ebdc[_0xf153('0x2b')];}_0x23acc3[_0xf153('0x1c')](_0x17f7a4)['send'](_0x48ebdc);};}exports[_0xf153('0x2c')]=function(_0x10295e,_0x261ac0){var _0x2b9a9c={},_0x339e96={},_0x258976={'count':0x0,'rows':[]};var _0x441436=_[_0xf153('0x2d')](db[_0xf153('0x2e')][_0xf153('0x2f')],function(_0x13b541){return{'name':_0x13b541[_0xf153('0x30')],'type':_0x13b541['type'][_0xf153('0x31')]};});_0x339e96[_0xf153('0x32')]=_[_0xf153('0x2d')](_0x441436,_0xf153('0x2b'));_0x339e96['query']=_['keys'](_0x10295e[_0xf153('0x33')]);_0x339e96['filters']=_['intersection'](_0x339e96[_0xf153('0x32')],_0x339e96['query']);_0x2b9a9c[_0xf153('0x34')]=_['intersection'](_0x339e96[_0xf153('0x32')],qs[_0xf153('0x35')](_0x10295e['query'][_0xf153('0x35')]));_0x2b9a9c[_0xf153('0x34')]=_0x2b9a9c[_0xf153('0x34')][_0xf153('0x36')]?_0x2b9a9c[_0xf153('0x34')]:_0x339e96[_0xf153('0x32')];if(!_0x10295e['query'][_0xf153('0x37')]('nolimit')){_0x2b9a9c[_0xf153('0x20')]=qs[_0xf153('0x20')](_0x10295e[_0xf153('0x33')][_0xf153('0x20')]);_0x2b9a9c[_0xf153('0x1f')]=qs[_0xf153('0x1f')](_0x10295e['query'][_0xf153('0x1f')]);}_0x2b9a9c[_0xf153('0x38')]=qs[_0xf153('0x39')](_0x10295e['query'][_0xf153('0x39')]);_0x2b9a9c[_0xf153('0x3a')]=qs[_0xf153('0x3b')](_[_0xf153('0x3c')](_0x10295e[_0xf153('0x33')],_0x339e96[_0xf153('0x3b')]),_0x441436);if(_0x10295e['query'][_0xf153('0x3d')]){_0x2b9a9c[_0xf153('0x3a')]=_['merge'](_0x2b9a9c[_0xf153('0x3a')],{'$or':_[_0xf153('0x2d')](_0x441436,function(_0x357666){if(_0x357666[_0xf153('0x3e')]!==_0xf153('0x3f')){var _0x42360a={};_0x42360a[_0x357666[_0xf153('0x2b')]]={'$like':'%'+_0x10295e['query'][_0xf153('0x3d')]+'%'};return _0x42360a;}})});}_0x2b9a9c=_[_0xf153('0x40')]({},_0x2b9a9c,_0x10295e[_0xf153('0x41')]);var _0x352e7c={'where':_0x2b9a9c[_0xf153('0x3a')]};return db[_0xf153('0x2e')]['count'](_0x352e7c)['then'](function(_0xa3922b){_0x258976['count']=_0xa3922b;if(_0x10295e[_0xf153('0x33')][_0xf153('0x42')]){_0x2b9a9c[_0xf153('0x43')]=[{'all':!![]}];}return db[_0xf153('0x2e')][_0xf153('0x44')](_0x2b9a9c);})[_0xf153('0x27')](function(_0x5599e5){_0x258976['rows']=_0x5599e5;return _0x258976;})[_0xf153('0x27')](respondWithFilteredResult(_0x261ac0,_0x2b9a9c))[_0xf153('0x45')](handleError(_0x261ac0,null));};exports['show']=function(_0x21529a,_0x1c77a6){var _0x1edf65={'raw':!![],'where':{'id':_0x21529a[_0xf153('0x46')]['id']}},_0x3a9cb2={};_0x3a9cb2[_0xf153('0x32')]=_[_0xf153('0x47')](db[_0xf153('0x2e')][_0xf153('0x2f')]);_0x3a9cb2[_0xf153('0x33')]=_[_0xf153('0x47')](_0x21529a[_0xf153('0x33')]);_0x3a9cb2['filters']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],_0x3a9cb2[_0xf153('0x33')]);_0x1edf65['attributes']=_[_0xf153('0x48')](_0x3a9cb2[_0xf153('0x32')],qs['fields'](_0x21529a[_0xf153('0x33')]['fields']));_0x1edf65[_0xf153('0x34')]=_0x1edf65[_0xf153('0x34')][_0xf153('0x36')]?_0x1edf65['attributes']:_0x3a9cb2[_0xf153('0x32')];if(_0x21529a[_0xf153('0x33')][_0xf153('0x42')]){_0x1edf65[_0xf153('0x43')]=[{'all':!![]}];}_0x1edf65=_[_0xf153('0x40')]({},_0x1edf65,_0x21529a['options']);return db[_0xf153('0x2e')][_0xf153('0x49')](_0x1edf65)['then'](handleEntityNotFound(_0x1c77a6,null))[_0xf153('0x27')](respondWithResult(_0x1c77a6,null))[_0xf153('0x45')](handleError(_0x1c77a6,null));};exports[_0xf153('0x4a')]=function(_0x5599a6,_0x657403){return db[_0xf153('0x2e')][_0xf153('0x4a')](_0x5599a6[_0xf153('0x4b')],{})[_0xf153('0x27')](respondWithResult(_0x657403,0xc9))[_0xf153('0x45')](handleError(_0x657403,null));};exports[_0xf153('0x26')]=function(_0x33e48,_0x3b91ed){if(_0x33e48['body']['id']){delete _0x33e48[_0xf153('0x4b')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0x33e48['params']['id']}})[_0xf153('0x27')](handleEntityNotFound(_0x3b91ed,null))[_0xf153('0x27')](saveUpdates(_0x33e48['body'],null))[_0xf153('0x27')](respondWithResult(_0x3b91ed,null))[_0xf153('0x45')](handleError(_0x3b91ed,null));};exports['destroy']=function(_0x3f1ecb,_0xe6e023){return db[_0xf153('0x2e')][_0xf153('0x49')]({'where':{'id':_0x3f1ecb[_0xf153('0x46')]['id']}})[_0xf153('0x27')](handleEntityNotFound(_0xe6e023,null))['then'](removeEntity(_0xe6e023,null))[_0xf153('0x45')](handleError(_0xe6e023,null));}; \ No newline at end of file +var _0x9c5e=['body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','show','keys','find','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x3fa13c,_0x3f108f){_0x3fa13c=_0x3fa13c-0x0;var _0x18fae2=_0x9c5e[_0x3fa13c];return _0x18fae2;};'use strict';var emlformat=require(_0xe9c5('0x0'));var rimraf=require(_0xe9c5('0x1'));var zipdir=require(_0xe9c5('0x2'));var jsonpatch=require(_0xe9c5('0x3'));var rp=require(_0xe9c5('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe9c5('0x5'));var path=require(_0xe9c5('0x6'));var sox=require('sox');var csv=require(_0xe9c5('0x7'));var ejs=require(_0xe9c5('0x8'));var fs=require('fs');var fs_extra=require(_0xe9c5('0x9'));var _=require(_0xe9c5('0xa'));var squel=require('squel');var crypto=require(_0xe9c5('0xb'));var jsforce=require(_0xe9c5('0xc'));var deskjs=require(_0xe9c5('0xd'));var toCsv=require(_0xe9c5('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe9c5('0xe'));var authService=require(_0xe9c5('0xf'));var qs=require(_0xe9c5('0x10'));var as=require(_0xe9c5('0x11'));var hardwareService=require(_0xe9c5('0x12'));var logger=require(_0xe9c5('0x13'))(_0xe9c5('0x14'));var utils=require(_0xe9c5('0x15'));var config=require(_0xe9c5('0x16'));var licenseUtil=require(_0xe9c5('0x17'));var db=require(_0xe9c5('0x18'))['db'];function respondWithStatusCode(_0x27f3e1,_0x471401){_0x471401=_0x471401||0xcc;return function(_0x25ff11){if(_0x25ff11){return _0x27f3e1[_0xe9c5('0x19')](_0x471401);}return _0x27f3e1[_0xe9c5('0x1a')](_0x471401)['end']();};}function respondWithResult(_0x3cce36,_0xe98b11){_0xe98b11=_0xe98b11||0xc8;return function(_0x5eb474){if(_0x5eb474){return _0x3cce36[_0xe9c5('0x1a')](_0xe98b11)[_0xe9c5('0x1b')](_0x5eb474);}};}function respondWithFilteredResult(_0x232584,_0x5d8236){return function(_0x163253){if(_0x163253){var _0x14eb41=typeof _0x5d8236['offset']===_0xe9c5('0x1c')&&typeof _0x5d8236[_0xe9c5('0x1d')]===_0xe9c5('0x1c');var _0x154390=_0x163253[_0xe9c5('0x1e')];var _0x4d9c7d=_0x14eb41?0x0:_0x5d8236[_0xe9c5('0x1f')];var _0x1cecae=_0x14eb41?_0x163253[_0xe9c5('0x1e')]:_0x5d8236[_0xe9c5('0x1f')]+_0x5d8236['limit'];var _0x26492a;if(_0x1cecae>=_0x154390){_0x1cecae=_0x154390;_0x26492a=0xc8;}else{_0x26492a=0xce;}_0x232584[_0xe9c5('0x1a')](_0x26492a);return _0x232584[_0xe9c5('0x20')](_0xe9c5('0x21'),_0x4d9c7d+'-'+_0x1cecae+'/'+_0x154390)[_0xe9c5('0x1b')](_0x163253);}return null;};}function patchUpdates(_0x58fbad){return function(_0x51e860){try{jsonpatch[_0xe9c5('0x22')](_0x51e860,_0x58fbad,!![]);}catch(_0x57818d){return BPromise[_0xe9c5('0x23')](_0x57818d);}return _0x51e860[_0xe9c5('0x24')]();};}function saveUpdates(_0x21b02a,_0x4d16bc){return function(_0x5750ff){if(_0x5750ff){return _0x5750ff[_0xe9c5('0x25')](_0x21b02a)[_0xe9c5('0x26')](function(_0x37fb90){return _0x37fb90;});}return null;};}function removeEntity(_0x189a13,_0x34a7c8){return function(_0x245161){if(_0x245161){return _0x245161[_0xe9c5('0x27')]()[_0xe9c5('0x26')](function(){_0x189a13[_0xe9c5('0x1a')](0xcc)[_0xe9c5('0x28')]();});}};}function handleEntityNotFound(_0x5a3caa,_0x5c8bb7){return function(_0x250e1c){if(!_0x250e1c){_0x5a3caa[_0xe9c5('0x19')](0x194);}return _0x250e1c;};}function handleError(_0x298dca,_0x3bf679){_0x3bf679=_0x3bf679||0x1f4;return function(_0x33fe71){logger[_0xe9c5('0x29')](_0x33fe71['stack']);if(_0x33fe71[_0xe9c5('0x2a')]){delete _0x33fe71['name'];}_0x298dca[_0xe9c5('0x1a')](_0x3bf679)['send'](_0x33fe71);};}exports[_0xe9c5('0x2b')]=function(_0x2112a6,_0x52d008){var _0x36d145={},_0x46d253={},_0x334f5a={'count':0x0,'rows':[]};var _0x37cfa5=_[_0xe9c5('0x2c')](db['FreshdeskField'][_0xe9c5('0x2d')],function(_0x4fcabd){return{'name':_0x4fcabd[_0xe9c5('0x2e')],'type':_0x4fcabd['type'][_0xe9c5('0x2f')]};});_0x46d253[_0xe9c5('0x30')]=_[_0xe9c5('0x2c')](_0x37cfa5,_0xe9c5('0x2a'));_0x46d253[_0xe9c5('0x31')]=_['keys'](_0x2112a6[_0xe9c5('0x31')]);_0x46d253[_0xe9c5('0x32')]=_[_0xe9c5('0x33')](_0x46d253[_0xe9c5('0x30')],_0x46d253[_0xe9c5('0x31')]);_0x36d145['attributes']=_['intersection'](_0x46d253[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x36d145[_0xe9c5('0x35')]=_0x36d145[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x36d145[_0xe9c5('0x35')]:_0x46d253['model'];if(!_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x37')]('nolimit')){_0x36d145[_0xe9c5('0x1d')]=qs['limit'](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1d')]);_0x36d145[_0xe9c5('0x1f')]=qs[_0xe9c5('0x1f')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x1f')]);}_0x36d145[_0xe9c5('0x38')]=qs[_0xe9c5('0x39')](_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x39')]);_0x36d145[_0xe9c5('0x3a')]=qs[_0xe9c5('0x32')](_[_0xe9c5('0x3b')](_0x2112a6[_0xe9c5('0x31')],_0x46d253[_0xe9c5('0x32')]),_0x37cfa5);if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x3c')]){_0x36d145[_0xe9c5('0x3a')]=_[_0xe9c5('0x3d')](_0x36d145['where'],{'$or':_[_0xe9c5('0x2c')](_0x37cfa5,function(_0x2e3f15){if(_0x2e3f15[_0xe9c5('0x3e')]!==_0xe9c5('0x3f')){var _0x204b53={};_0x204b53[_0x2e3f15[_0xe9c5('0x2a')]]={'$like':'%'+_0x2112a6['query'][_0xe9c5('0x3c')]+'%'};return _0x204b53;}})});}_0x36d145=_[_0xe9c5('0x3d')]({},_0x36d145,_0x2112a6[_0xe9c5('0x40')]);var _0x480b83={'where':_0x36d145[_0xe9c5('0x3a')]};return db[_0xe9c5('0x41')][_0xe9c5('0x1e')](_0x480b83)[_0xe9c5('0x26')](function(_0x2c1615){_0x334f5a[_0xe9c5('0x1e')]=_0x2c1615;if(_0x2112a6[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x36d145[_0xe9c5('0x43')]=[{'all':!![]}];}return db[_0xe9c5('0x41')][_0xe9c5('0x44')](_0x36d145);})['then'](function(_0x51dd18){_0x334f5a[_0xe9c5('0x45')]=_0x51dd18;return _0x334f5a;})[_0xe9c5('0x26')](respondWithFilteredResult(_0x52d008,_0x36d145))[_0xe9c5('0x46')](handleError(_0x52d008,null));};exports[_0xe9c5('0x47')]=function(_0x4ca4b0,_0x4a3fc5){var _0x382405={'raw':!![],'where':{'id':_0x4ca4b0['params']['id']}},_0x144e85={};_0x144e85[_0xe9c5('0x30')]=_['keys'](db['FreshdeskField']['rawAttributes']);_0x144e85[_0xe9c5('0x31')]=_[_0xe9c5('0x48')](_0x4ca4b0[_0xe9c5('0x31')]);_0x144e85[_0xe9c5('0x32')]=_['intersection'](_0x144e85[_0xe9c5('0x30')],_0x144e85[_0xe9c5('0x31')]);_0x382405[_0xe9c5('0x35')]=_[_0xe9c5('0x33')](_0x144e85[_0xe9c5('0x30')],qs[_0xe9c5('0x34')](_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x34')]));_0x382405['attributes']=_0x382405[_0xe9c5('0x35')][_0xe9c5('0x36')]?_0x382405[_0xe9c5('0x35')]:_0x144e85[_0xe9c5('0x30')];if(_0x4ca4b0[_0xe9c5('0x31')][_0xe9c5('0x42')]){_0x382405['include']=[{'all':!![]}];}_0x382405=_['merge']({},_0x382405,_0x4ca4b0['options']);return db['FreshdeskField'][_0xe9c5('0x49')](_0x382405)[_0xe9c5('0x26')](handleEntityNotFound(_0x4a3fc5,null))[_0xe9c5('0x26')](respondWithResult(_0x4a3fc5,null))['catch'](handleError(_0x4a3fc5,null));};exports[_0xe9c5('0x4a')]=function(_0x520248,_0x1ed99e){return db[_0xe9c5('0x41')][_0xe9c5('0x4a')](_0x520248[_0xe9c5('0x4b')],{})['then'](respondWithResult(_0x1ed99e,0xc9))[_0xe9c5('0x46')](handleError(_0x1ed99e,null));};exports[_0xe9c5('0x25')]=function(_0x1da6a3,_0x249940){if(_0x1da6a3['body']['id']){delete _0x1da6a3[_0xe9c5('0x4b')]['id'];}return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x1da6a3[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x249940,null))[_0xe9c5('0x26')](saveUpdates(_0x1da6a3['body'],null))[_0xe9c5('0x26')](respondWithResult(_0x249940,null))[_0xe9c5('0x46')](handleError(_0x249940,null));};exports[_0xe9c5('0x27')]=function(_0x9d0154,_0x5e7c24){return db[_0xe9c5('0x41')][_0xe9c5('0x49')]({'where':{'id':_0x9d0154[_0xe9c5('0x4c')]['id']}})[_0xe9c5('0x26')](handleEntityNotFound(_0x5e7c24,null))[_0xe9c5('0x26')](removeEntity(_0x5e7c24,null))[_0xe9c5('0x46')](handleError(_0x5e7c24,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 490f064..26b1fea 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 _0x07bd=['rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x2e116c,_0x443ea8){var _0x9790b=function(_0x4a4cfc){while(--_0x4a4cfc){_0x2e116c['push'](_0x2e116c['shift']());}};_0x9790b(++_0x443ea8);}(_0x07bd,0xea));var _0xd07b=function(_0x139411,_0x3d0752){_0x139411=_0x139411-0x0;var _0x66dced=_0x07bd[_0x139411];return _0x66dced;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require(_0xd07b('0x2'))(_0xd07b('0x3'));var moment=require(_0xd07b('0x4'));var BPromise=require('bluebird');var rp=require(_0xd07b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd07b('0x6'));var config=require('../../config/environment');var attributes=require(_0xd07b('0x7'));module[_0xd07b('0x8')]=function(_0x242abf,_0x188caa){return _0x242abf[_0xd07b('0x9')](_0xd07b('0xa'),attributes,{'tableName':_0xd07b('0xb'),'paranoid':![],'indexes':[{'name':_0xd07b('0xc'),'fields':[_0xd07b('0xd'),_0xd07b('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa540=['freshdesk_unique_index','idField','lodash','../../config/logger','api','moment','rimraf','../../config/environment','exports','define','FreshdeskField'];(function(_0x1b8e60,_0x21b885){var _0x363363=function(_0x5987c7){while(--_0x5987c7){_0x1b8e60['push'](_0x1b8e60['shift']());}};_0x363363(++_0x21b885);}(_0xa540,0xd3));var _0x0a54=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0xa540[_0x99ff94];return _0x1b5bc0;};'use strict';var _=require(_0x0a54('0x0'));var util=require('util');var logger=require(_0x0a54('0x1'))(_0x0a54('0x2'));var moment=require(_0x0a54('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0a54('0x4'));var config=require(_0x0a54('0x5'));var attributes=require('./intFreshdeskField.attributes');module[_0x0a54('0x6')]=function(_0x372681,_0x185102){return _0x372681[_0x0a54('0x7')](_0x0a54('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x0a54('0x9'),'fields':[_0x0a54('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index e303dd1..0c3e68d 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 _0x74d1=['error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','info','FreshdeskField,\x20%s,\x20%s','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x74d1,0x123));var _0x174d=function(_0x55811e,_0x27744c){_0x55811e=_0x55811e-0x0;var _0x57bb7d=_0x74d1[_0x55811e];return _0x57bb7d;};'use strict';var _=require(_0x174d('0x0'));var util=require(_0x174d('0x1'));var moment=require(_0x174d('0x2'));var BPromise=require(_0x174d('0x3'));var rs=require(_0x174d('0x4'));var fs=require('fs');var Redis=require(_0x174d('0x5'));var db=require(_0x174d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x174d('0x7'))(_0x174d('0x8'));var config=require('../../config/environment');var jayson=require(_0x174d('0x9'));var client=jayson[_0x174d('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55800e,_0x16953f,_0x154d49){return new BPromise(function(_0x7da7c,_0x16241a){return client['request'](_0x55800e,_0x154d49)['then'](function(_0x24c673){logger[_0x174d('0xb')](_0x174d('0xc'),_0x16953f,'request\x20sent');logger[_0x174d('0xd')](_0x174d('0xe'),_0x16953f,'request\x20sent',JSON['stringify'](_0x24c673));if(_0x24c673['error']){if(_0x24c673['error']['code']===0x1f4){logger[_0x174d('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x16953f,_0x24c673[_0x174d('0xf')]['message']);return _0x16241a(_0x24c673[_0x174d('0xf')]['message']);}logger[_0x174d('0xf')]('FreshdeskField,\x20%s,\x20%s',_0x16953f,_0x24c673[_0x174d('0xf')][_0x174d('0x10')]);return _0x7da7c(_0x24c673[_0x174d('0xf')][_0x174d('0x10')]);}else{logger[_0x174d('0xb')](_0x174d('0xc'),_0x16953f,'request\x20sent');_0x7da7c(_0x24c673[_0x174d('0x11')][_0x174d('0x10')]);}})['catch'](function(_0x47a9a7){logger[_0x174d('0xf')](_0x174d('0xc'),_0x16953f,_0x47a9a7);_0x16241a(_0x47a9a7);});});} \ No newline at end of file +var _0xa7d7=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s'];(function(_0x165fc8,_0x5d713c){var _0x4e9388=function(_0x52c67c){while(--_0x52c67c){_0x165fc8['push'](_0x165fc8['shift']());}};_0x4e9388(++_0x5d713c);}(_0xa7d7,0xe2));var _0x7a7d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa7d7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7a7d('0x0'));var util=require(_0x7a7d('0x1'));var moment=require(_0x7a7d('0x2'));var BPromise=require(_0x7a7d('0x3'));var rs=require(_0x7a7d('0x4'));var fs=require('fs');var Redis=require(_0x7a7d('0x5'));var db=require(_0x7a7d('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7a7d('0x7'));var jayson=require(_0x7a7d('0x8'));var client=jayson[_0x7a7d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4275ff,_0x3ffab0,_0xf12644){return new BPromise(function(_0x32423a,_0x27a6bf){return client[_0x7a7d('0xa')](_0x4275ff,_0xf12644)[_0x7a7d('0xb')](function(_0x9a763e){logger['info'](_0x7a7d('0xc'),_0x3ffab0,_0x7a7d('0xd'));logger[_0x7a7d('0xe')](_0x7a7d('0xf'),_0x3ffab0,_0x7a7d('0xd'),JSON[_0x7a7d('0x10')](_0x9a763e));if(_0x9a763e[_0x7a7d('0x11')]){if(_0x9a763e[_0x7a7d('0x11')][_0x7a7d('0x12')]===0x1f4){logger[_0x7a7d('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x3ffab0,_0x9a763e['error']['message']);return _0x27a6bf(_0x9a763e['error'][_0x7a7d('0x13')]);}logger[_0x7a7d('0x11')](_0x7a7d('0xc'),_0x3ffab0,_0x9a763e[_0x7a7d('0x11')]['message']);return _0x32423a(_0x9a763e[_0x7a7d('0x11')]['message']);}else{logger['info'](_0x7a7d('0xc'),_0x3ffab0,'request\x20sent');_0x32423a(_0x9a763e[_0x7a7d('0x14')][_0x7a7d('0x13')]);}})[_0x7a7d('0x15')](function(_0x25ca7c){logger[_0x7a7d('0x11')](_0x7a7d('0xc'),_0x3ffab0,_0x25ca7c);_0x27a6bf(_0x25ca7c);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 31ef495..346e212 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 _0x373d=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','getFields','create','post','/:id/configurations','update','destroy','exports','multer'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x373d,0x1e2));var _0xd373=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x373d[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0xd373('0x0'));var util=require('util');var path=require(_0xd373('0x1'));var timeout=require(_0xd373('0x2'));var express=require(_0xd373('0x3'));var router=express[_0xd373('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd373('0x5'));var interaction=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0xd373('0x8')](),controller[_0xd373('0x9')]);router[_0xd373('0xa')](_0xd373('0xb'),auth['isAuthenticated'](),controller[_0xd373('0xc')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller[_0xd373('0xd')]);router[_0xd373('0xa')]('/:id/fields',auth[_0xd373('0x8')](),controller[_0xd373('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xd373('0xf')]);router[_0xd373('0x10')](_0xd373('0x11'),auth[_0xd373('0x8')](),controller['addConfiguration']);router['put']('/:id',auth[_0xd373('0x8')](),controller[_0xd373('0x12')]);router['delete'](_0xd373('0xb'),auth[_0xd373('0x8')](),controller[_0xd373('0x13')]);module[_0xd373('0x14')]=router; \ No newline at end of file +var _0xe511=['get','index','show','getConfigurations','/:id/fields','isAuthenticated','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller'];(function(_0x359d3e,_0x9d9e5b){var _0x533931=function(_0x553875){while(--_0x553875){_0x359d3e['push'](_0x359d3e['shift']());}};_0x533931(++_0x9d9e5b);}(_0xe511,0x16f));var _0x1e51=function(_0x206053,_0x422374){_0x206053=_0x206053-0x0;var _0x39e8db=_0xe511[_0x206053];return _0x39e8db;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0xf')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x10')]);router[_0x1e51('0xf')](_0x1e51('0x11'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x13')]('/:id',auth[_0x1e51('0xd')](),controller[_0x1e51('0x14')]);router[_0x1e51('0x15')](_0x1e51('0x16'),auth[_0x1e51('0xd')](),controller[_0x1e51('0x17')]);module[_0x1e51('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index c7b77b7..e9d7e76 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 _0x5204=['exports','STRING','username','sequelize'];(function(_0x246e9d,_0xd18ef6){var _0x9c3ab9=function(_0x5a440b){while(--_0x5a440b){_0x246e9d['push'](_0x246e9d['shift']());}};_0x9c3ab9(++_0xd18ef6);}(_0x5204,0xdf));var _0x4520=function(_0x671369,_0x433da5){_0x671369=_0x671369-0x0;var _0x33f2b4=_0x5204[_0x671369];return _0x33f2b4;};'use strict';var Sequelize=require(_0x4520('0x0'));module[_0x4520('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4520('0x2')]},'username':{'type':Sequelize[_0x4520('0x2')],'unique':_0x4520('0x3')},'apiKey':{'type':Sequelize[_0x4520('0x2')]},'remoteUri':{'type':Sequelize[_0x4520('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4520('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9f0e=['STRING','remoteUri','sequelize','exports'];(function(_0x3e9336,_0x5ed4a3){var _0x4e2442=function(_0x3458a3){while(--_0x3458a3){_0x3e9336['push'](_0x3e9336['shift']());}};_0x4e2442(++_0x5ed4a3);}(_0x9f0e,0x116));var _0xe9f0=function(_0x4da175,_0x4feaad){_0x4da175=_0x4da175-0x0;var _0x52db86=_0x9f0e[_0x4da175];return _0x52db86;};'use strict';var Sequelize=require(_0xe9f0('0x0'));module[_0xe9f0('0x1')]={'name':{'type':Sequelize[_0xe9f0('0x2')]},'description':{'type':Sequelize[_0xe9f0('0x2')]},'username':{'type':Sequelize[_0xe9f0('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xe9f0('0x2')],'unique':_0xe9f0('0x3')},'serverUrl':{'type':Sequelize[_0xe9f0('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 2b35bbd..b204520 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 _0xf015=['set','Content-Range','reject','save','destroy','then','error','stack','name','map','FreshsalesAccount','type','key','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','pick','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','merge','find','create','body','findOne','rawAttributes','filter','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','username','apiKey','remoteUri','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','test','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count'];(function(_0x3f582b,_0xebfae6){var _0x2290db=function(_0x289f7f){while(--_0x289f7f){_0x3f582b['push'](_0x3f582b['shift']());}};_0x2290db(++_0xebfae6);}(_0xf015,0xaa));var _0x5f01=function(_0x372cea,_0x5e5b27){_0x372cea=_0x372cea-0x0;var _0x5b870f=_0xf015[_0x372cea];return _0x5b870f;};'use strict';var emlformat=require(_0x5f01('0x0'));var rimraf=require(_0x5f01('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5f01('0x2'));var rp=require(_0x5f01('0x3'));var moment=require('moment');var BPromise=require(_0x5f01('0x4'));var Mustache=require(_0x5f01('0x5'));var util=require(_0x5f01('0x6'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5f01('0x7'));var fs=require('fs');var fs_extra=require(_0x5f01('0x8'));var _=require('lodash');var squel=require(_0x5f01('0x9'));var crypto=require(_0x5f01('0xa'));var jsforce=require(_0x5f01('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x5f01('0xc'));var querystring=require(_0x5f01('0xd'));var Papa=require('papaparse');var Redis=require(_0x5f01('0xe'));var authService=require(_0x5f01('0xf'));var qs=require(_0x5f01('0x10'));var as=require(_0x5f01('0x11'));var hardwareService=require(_0x5f01('0x12'));var logger=require('../../config/logger')(_0x5f01('0x13'));var utils=require(_0x5f01('0x14'));var config=require(_0x5f01('0x15'));var licenseUtil=require(_0x5f01('0x16'));var db=require(_0x5f01('0x17'))['db'];var integrations=require(_0x5f01('0x18'));function respondWithStatusCode(_0x5489c,_0x29e6cc){_0x29e6cc=_0x29e6cc||0xcc;return function(_0x2048ac){if(_0x2048ac){return _0x5489c[_0x5f01('0x19')](_0x29e6cc);}return _0x5489c[_0x5f01('0x1a')](_0x29e6cc)['end']();};}function respondWithResult(_0x221f08,_0xc3092){_0xc3092=_0xc3092||0xc8;return function(_0x3ba891){if(_0x3ba891){return _0x221f08[_0x5f01('0x1a')](_0xc3092)[_0x5f01('0x1b')](_0x3ba891);}};}function respondWithFilteredResult(_0xea183d,_0x265dcc){return function(_0xd7bbf7){if(_0xd7bbf7){var _0x2ebea7=typeof _0x265dcc[_0x5f01('0x1c')]===_0x5f01('0x1d')&&typeof _0x265dcc[_0x5f01('0x1e')]===_0x5f01('0x1d');var _0x7d4a3=_0xd7bbf7['count'];var _0x8e458b=_0x2ebea7?0x0:_0x265dcc['offset'];var _0x46b857=_0x2ebea7?_0xd7bbf7[_0x5f01('0x1f')]:_0x265dcc[_0x5f01('0x1c')]+_0x265dcc['limit'];var _0x5a65c9;if(_0x46b857>=_0x7d4a3){_0x46b857=_0x7d4a3;_0x5a65c9=0xc8;}else{_0x5a65c9=0xce;}_0xea183d[_0x5f01('0x1a')](_0x5a65c9);return _0xea183d[_0x5f01('0x20')](_0x5f01('0x21'),_0x8e458b+'-'+_0x46b857+'/'+_0x7d4a3)[_0x5f01('0x1b')](_0xd7bbf7);}return null;};}function patchUpdates(_0x25bdbb){return function(_0x34e490){try{jsonpatch['apply'](_0x34e490,_0x25bdbb,!![]);}catch(_0xce4283){return BPromise[_0x5f01('0x22')](_0xce4283);}return _0x34e490[_0x5f01('0x23')]();};}function saveUpdates(_0x94b3da,_0x210f4b){return function(_0x2ca3b4){if(_0x2ca3b4){return _0x2ca3b4['update'](_0x94b3da)['then'](function(_0x1f2dc2){return _0x1f2dc2;});}return null;};}function removeEntity(_0x514ecf,_0x539d69){return function(_0x17cb5c){if(_0x17cb5c){return _0x17cb5c[_0x5f01('0x24')]()[_0x5f01('0x25')](function(){_0x514ecf[_0x5f01('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x327297,_0x326f89){return function(_0x3e76e1){if(!_0x3e76e1){_0x327297[_0x5f01('0x19')](0x194);}return _0x3e76e1;};}function handleError(_0x2df2b4,_0x47a1d2){_0x47a1d2=_0x47a1d2||0x1f4;return function(_0x1faa74){logger[_0x5f01('0x26')](_0x1faa74[_0x5f01('0x27')]);if(_0x1faa74[_0x5f01('0x28')]){delete _0x1faa74[_0x5f01('0x28')];}_0x2df2b4[_0x5f01('0x1a')](_0x47a1d2)['send'](_0x1faa74);};}exports['index']=function(_0x32fab5,_0x38689f){var _0x50c0f8={},_0x3e69db={},_0x4095a9={'count':0x0,'rows':[]};var _0x1a76e5=_[_0x5f01('0x29')](db[_0x5f01('0x2a')]['rawAttributes'],function(_0x544f71){return{'name':_0x544f71['fieldName'],'type':_0x544f71[_0x5f01('0x2b')][_0x5f01('0x2c')]};});_0x3e69db[_0x5f01('0x2d')]=_[_0x5f01('0x29')](_0x1a76e5,_0x5f01('0x28'));_0x3e69db[_0x5f01('0x2e')]=_[_0x5f01('0x2f')](_0x32fab5[_0x5f01('0x2e')]);_0x3e69db[_0x5f01('0x30')]=_['intersection'](_0x3e69db[_0x5f01('0x2d')],_0x3e69db[_0x5f01('0x2e')]);_0x50c0f8[_0x5f01('0x31')]=_['intersection'](_0x3e69db[_0x5f01('0x2d')],qs[_0x5f01('0x32')](_0x32fab5['query'][_0x5f01('0x32')]));_0x50c0f8[_0x5f01('0x31')]=_0x50c0f8[_0x5f01('0x31')][_0x5f01('0x33')]?_0x50c0f8[_0x5f01('0x31')]:_0x3e69db[_0x5f01('0x2d')];if(!_0x32fab5[_0x5f01('0x2e')]['hasOwnProperty'](_0x5f01('0x34'))){_0x50c0f8[_0x5f01('0x1e')]=qs[_0x5f01('0x1e')](_0x32fab5[_0x5f01('0x2e')]['limit']);_0x50c0f8[_0x5f01('0x1c')]=qs[_0x5f01('0x1c')](_0x32fab5[_0x5f01('0x2e')]['offset']);}_0x50c0f8[_0x5f01('0x35')]=qs[_0x5f01('0x36')](_0x32fab5[_0x5f01('0x2e')][_0x5f01('0x36')]);_0x50c0f8[_0x5f01('0x37')]=qs['filters'](_[_0x5f01('0x38')](_0x32fab5[_0x5f01('0x2e')],_0x3e69db[_0x5f01('0x30')]),_0x1a76e5);if(_0x32fab5[_0x5f01('0x2e')]['filter']){_0x50c0f8[_0x5f01('0x37')]=_['merge'](_0x50c0f8[_0x5f01('0x37')],{'$or':_[_0x5f01('0x29')](_0x1a76e5,function(_0x2a1642){if(_0x2a1642[_0x5f01('0x2b')]!==_0x5f01('0x39')){var _0x147602={};_0x147602[_0x2a1642[_0x5f01('0x28')]]={'$like':'%'+_0x32fab5[_0x5f01('0x2e')]['filter']+'%'};return _0x147602;}})});}_0x50c0f8=_['merge']({},_0x50c0f8,_0x32fab5[_0x5f01('0x3a')]);var _0xb9d84b={'where':_0x50c0f8[_0x5f01('0x37')]};return db[_0x5f01('0x2a')]['count'](_0xb9d84b)[_0x5f01('0x25')](function(_0x3f4a51){_0x4095a9['count']=_0x3f4a51;if(_0x32fab5[_0x5f01('0x2e')]['includeAll']){_0x50c0f8[_0x5f01('0x3b')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x5f01('0x3c')](_0x50c0f8);})['then'](function(_0x28af0a){_0x4095a9['rows']=_0x28af0a;return _0x4095a9;})['then'](respondWithFilteredResult(_0x38689f,_0x50c0f8))[_0x5f01('0x3d')](handleError(_0x38689f,null));};exports[_0x5f01('0x3e')]=function(_0x1d95cb,_0x1c0d2c){var _0x31ca2b={'raw':![],'where':{'id':_0x1d95cb[_0x5f01('0x3f')]['id']}},_0x136a79={};_0x136a79[_0x5f01('0x2d')]=_[_0x5f01('0x2f')](db['FreshsalesAccount']['rawAttributes']);_0x136a79['query']=_[_0x5f01('0x2f')](_0x1d95cb[_0x5f01('0x2e')]);_0x136a79[_0x5f01('0x30')]=_[_0x5f01('0x40')](_0x136a79[_0x5f01('0x2d')],_0x136a79[_0x5f01('0x2e')]);_0x31ca2b[_0x5f01('0x31')]=_[_0x5f01('0x40')](_0x136a79[_0x5f01('0x2d')],qs[_0x5f01('0x32')](_0x1d95cb[_0x5f01('0x2e')][_0x5f01('0x32')]));_0x31ca2b[_0x5f01('0x31')]=_0x31ca2b['attributes']['length']?_0x31ca2b[_0x5f01('0x31')]:_0x136a79[_0x5f01('0x2d')];if(_0x1d95cb[_0x5f01('0x2e')][_0x5f01('0x41')]){_0x31ca2b[_0x5f01('0x3b')]=[{'all':!![]}];}_0x31ca2b=_[_0x5f01('0x42')]({},_0x31ca2b,_0x1d95cb[_0x5f01('0x3a')]);return db[_0x5f01('0x2a')][_0x5f01('0x43')](_0x31ca2b)[_0x5f01('0x25')](handleEntityNotFound(_0x1c0d2c,null))[_0x5f01('0x25')](respondWithResult(_0x1c0d2c,null))['catch'](handleError(_0x1c0d2c,null));};exports[_0x5f01('0x44')]=function(_0x449594,_0x5f29c7){return db[_0x5f01('0x2a')]['create'](_0x449594[_0x5f01('0x45')],{})[_0x5f01('0x25')](respondWithResult(_0x5f29c7,0xc9))['catch'](handleError(_0x5f29c7,null));};exports['update']=function(_0x111646,_0x3723db){if(_0x111646[_0x5f01('0x45')]['id']){delete _0x111646[_0x5f01('0x45')]['id'];}return db['FreshsalesAccount'][_0x5f01('0x43')]({'where':{'id':_0x111646['params']['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0x3723db,null))[_0x5f01('0x25')](saveUpdates(_0x111646[_0x5f01('0x45')],null))[_0x5f01('0x25')](respondWithResult(_0x3723db,null))[_0x5f01('0x3d')](handleError(_0x3723db,null));};exports[_0x5f01('0x24')]=function(_0x4cbdab,_0x24febc){return db[_0x5f01('0x2a')][_0x5f01('0x43')]({'where':{'id':_0x4cbdab[_0x5f01('0x3f')]['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0x24febc,null))[_0x5f01('0x25')](removeEntity(_0x24febc,null))[_0x5f01('0x3d')](handleError(_0x24febc,null));};exports['getConfigurations']=function(_0x46a1d7,_0xcd18be,_0x4adef4){var _0xc1fced={};var _0x3417b7={};var _0x20e62b;var _0x27be3b;return db[_0x5f01('0x2a')][_0x5f01('0x46')]({'where':{'id':_0x46a1d7[_0x5f01('0x3f')]['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0xcd18be,null))['then'](function(_0x1fd9d4){if(_0x1fd9d4){_0x20e62b=_0x1fd9d4;_0x3417b7[_0x5f01('0x2d')]=_[_0x5f01('0x2f')](db['FreshsalesConfiguration'][_0x5f01('0x47')]);_0x3417b7[_0x5f01('0x2e')]=_[_0x5f01('0x2f')](_0x46a1d7[_0x5f01('0x2e')]);_0x3417b7[_0x5f01('0x30')]=_['intersection'](_0x3417b7[_0x5f01('0x2d')],_0x3417b7[_0x5f01('0x2e')]);_0xc1fced[_0x5f01('0x31')]=_[_0x5f01('0x40')](_0x3417b7[_0x5f01('0x2d')],qs[_0x5f01('0x32')](_0x46a1d7[_0x5f01('0x2e')]['fields']));_0xc1fced['attributes']=_0xc1fced[_0x5f01('0x31')][_0x5f01('0x33')]?_0xc1fced['attributes']:_0x3417b7[_0x5f01('0x2d')];_0xc1fced[_0x5f01('0x35')]=qs[_0x5f01('0x36')](_0x46a1d7['query'][_0x5f01('0x36')]);_0xc1fced['where']=qs[_0x5f01('0x30')](_[_0x5f01('0x38')](_0x46a1d7['query'],_0x3417b7[_0x5f01('0x30')]));if(_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x48')]){_0xc1fced[_0x5f01('0x37')]=_['merge'](_0xc1fced[_0x5f01('0x37')],{'$or':_[_0x5f01('0x29')](_0xc1fced[_0x5f01('0x31')],function(_0x22afbd){var _0x475f12={};_0x475f12[_0x22afbd]={'$like':'%'+_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x48')]+'%'};return _0x475f12;})});}_0xc1fced=_[_0x5f01('0x42')]({},_0xc1fced,_0x46a1d7[_0x5f01('0x3a')]);return _0x20e62b[_0x5f01('0x49')](_0xc1fced);}})[_0x5f01('0x25')](function(_0x150452){if(_0x150452){_0x27be3b=_0x150452[_0x5f01('0x33')];if(!_0x46a1d7['query'][_0x5f01('0x4a')](_0x5f01('0x34'))){_0xc1fced[_0x5f01('0x1e')]=qs['limit'](_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x1e')]);_0xc1fced[_0x5f01('0x1c')]=qs[_0x5f01('0x1c')](_0x46a1d7[_0x5f01('0x2e')][_0x5f01('0x1c')]);}return _0x20e62b[_0x5f01('0x49')](_0xc1fced);}})['then'](function(_0x2ff2fc){if(_0x2ff2fc){return _0x2ff2fc?{'count':_0x27be3b,'rows':_0x2ff2fc}:null;}})[_0x5f01('0x25')](respondWithResult(_0xcd18be,null))['catch'](handleError(_0xcd18be,null));};exports['addConfiguration']=function(_0x152b05,_0x705942,_0x49960e){if(_0x152b05['body']['id']){delete _0x152b05[_0x5f01('0x45')]['id'];}return db[_0x5f01('0x2a')][_0x5f01('0x46')]({'where':{'id':_0x152b05[_0x5f01('0x3f')]['id']}})[_0x5f01('0x25')](handleEntityNotFound(_0x705942,null))[_0x5f01('0x25')](function(_0x136df5){if(_0x136df5){_0x152b05[_0x5f01('0x45')][_0x5f01('0x4b')]=_0x136df5['id'];_0x152b05['body'][_0x5f01('0x4c')]=integrations[_0x5f01('0x4d')](_0x152b05[_0x5f01('0x45')][_0x5f01('0x4e')],_0x152b05['body']['type']);_0x152b05[_0x5f01('0x45')][_0x5f01('0x4f')]=integrations[_0x5f01('0x50')](_0x152b05[_0x5f01('0x45')]['channel'],_0x152b05[_0x5f01('0x45')][_0x5f01('0x2b')]);return db['FreshsalesConfiguration'][_0x5f01('0x44')](_0x152b05[_0x5f01('0x45')],{'include':[{'model':db[_0x5f01('0x51')],'as':_0x5f01('0x4c')},{'model':db[_0x5f01('0x51')],'as':_0x5f01('0x4f')}]});}return null;})[_0x5f01('0x25')](respondWithResult(_0x705942,null))['catch'](handleError(_0x705942,null));};exports['getFields']=function(_0x5bf8d7,_0x7f9ab6,_0x433ab4){var _0x178a6f='';var _0x512325='';return db['FreshsalesAccount']['findOne']({'where':{'id':_0x5bf8d7['params']['id']},'attributes':['id',_0x5f01('0x52'),'remoteUri',_0x5f01('0x53')]})[_0x5f01('0x25')](handleEntityNotFound(_0x7f9ab6,null))[_0x5f01('0x25')](function(_0x57ebb9){if(_0x57ebb9){_0x512325=_0x57ebb9['username'];_0x178a6f=_0x57ebb9[_0x5f01('0x54')];var _0x1097e7=_0x57ebb9['remoteUri'][_0x5f01('0x55')](-0x1);if(_0x1097e7==='/'){_0x178a6f=_0x178a6f[_0x5f01('0x56')](0x0,_0x178a6f[_0x5f01('0x57')](_0x1097e7));}return rp({'method':_0x5f01('0x58'),'uri':util[_0x5f01('0x59')](_0x5f01('0x5a'),_0x178a6f,_0x5f01('0x5b')),'headers':{'Authorization':_0x5f01('0x5c')+_0x57ebb9[_0x5f01('0x53')]},'json':!![]});}})[_0x5f01('0x25')](function(_0x11aa49){if(_0x11aa49){var _0x5b0f9c=_0x11aa49[_0x5f01('0x5d')];var _0x2f9601=![];var _0x13e259=null;for(_0x13e259=0x0;_0x13e259<_0x5b0f9c['length'];_0x13e259++){if(_0x5b0f9c[_0x13e259][_0x5f01('0x5e')]===_0x512325){_0x2f9601=!![];}}if(_0x2f9601){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x5f01('0x5f')});}}})[_0x5f01('0x25')](respondWithResult(_0x7f9ab6,null))[_0x5f01('0x3d')](function(_0x4b2b69){var _0x3b1198=_0x5bf8d7[_0x5f01('0x2e')]['test']?0x1f4:_0x4b2b69[_0x5f01('0x60')]||0x1f4;logger[_0x5f01('0x26')](_0x5f01('0x61'),_0x5f01('0x62'),_0x3b1198,JSON['stringify'](_0x4b2b69));delete _0x4b2b69[_0x5f01('0x28')];if(_0x3b1198===0x191){_0x3b1198=0x190;}_0x7f9ab6[_0x5f01('0x1a')](_0x3b1198)[_0x5f01('0x63')](_0x5bf8d7[_0x5f01('0x2e')][_0x5f01('0x64')]?{'message':'Wrong\x20credentials','statusCode':_0x4b2b69[_0x5f01('0x60')]}:_0x4b2b69);});}; \ No newline at end of file +var _0xce33=['Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','remoteUri','username','slice','substring','lastIndexOf','%s%s','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','intersection','model','attributes','fields','order','sort','where','filters','pick','type','VIRTUAL','filter','merge','includeAll','include','findAll','rows','keys','length','options','find','catch','create','body','params','findOne','getConfigurations','hasOwnProperty','nolimit'];(function(_0x3b83fa,_0x361c65){var _0x1a3082=function(_0x5df36c){while(--_0x5df36c){_0x3b83fa['push'](_0x3b83fa['shift']());}};_0x1a3082(++_0x361c65);}(_0xce33,0x83));var _0x3ce3=function(_0x4cfc1d,_0x2c0927){_0x4cfc1d=_0x4cfc1d-0x0;var _0x1c01a0=_0xce33[_0x4cfc1d];return _0x1c01a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3ce3('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ce3('0x1'));var rp=require(_0x3ce3('0x2'));var moment=require('moment');var BPromise=require(_0x3ce3('0x3'));var Mustache=require(_0x3ce3('0x4'));var util=require(_0x3ce3('0x5'));var path=require('path');var sox=require(_0x3ce3('0x6'));var csv=require(_0x3ce3('0x7'));var ejs=require(_0x3ce3('0x8'));var fs=require('fs');var fs_extra=require(_0x3ce3('0x9'));var _=require('lodash');var squel=require(_0x3ce3('0xa'));var crypto=require('crypto');var jsforce=require(_0x3ce3('0xb'));var deskjs=require(_0x3ce3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3ce3('0xd'));var Papa=require(_0x3ce3('0xe'));var Redis=require(_0x3ce3('0xf'));var authService=require(_0x3ce3('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x3ce3('0x11'));var hardwareService=require(_0x3ce3('0x12'));var logger=require(_0x3ce3('0x13'))(_0x3ce3('0x14'));var utils=require(_0x3ce3('0x15'));var config=require(_0x3ce3('0x16'));var licenseUtil=require(_0x3ce3('0x17'));var db=require(_0x3ce3('0x18'))['db'];var integrations=require(_0x3ce3('0x19'));function respondWithStatusCode(_0x443b86,_0x593b1d){_0x593b1d=_0x593b1d||0xcc;return function(_0x136ad5){if(_0x136ad5){return _0x443b86[_0x3ce3('0x1a')](_0x593b1d);}return _0x443b86[_0x3ce3('0x1b')](_0x593b1d)[_0x3ce3('0x1c')]();};}function respondWithResult(_0xd2484,_0x180db5){_0x180db5=_0x180db5||0xc8;return function(_0x325420){if(_0x325420){return _0xd2484[_0x3ce3('0x1b')](_0x180db5)['json'](_0x325420);}};}function respondWithFilteredResult(_0x443a35,_0x3c2b19){return function(_0x3171be){if(_0x3171be){var _0x4393dd=typeof _0x3c2b19[_0x3ce3('0x1d')]===_0x3ce3('0x1e')&&typeof _0x3c2b19['limit']===_0x3ce3('0x1e');var _0x305525=_0x3171be[_0x3ce3('0x1f')];var _0x8b8f94=_0x4393dd?0x0:_0x3c2b19[_0x3ce3('0x1d')];var _0x21d848=_0x4393dd?_0x3171be[_0x3ce3('0x1f')]:_0x3c2b19[_0x3ce3('0x1d')]+_0x3c2b19[_0x3ce3('0x20')];var _0x540a8f;if(_0x21d848>=_0x305525){_0x21d848=_0x305525;_0x540a8f=0xc8;}else{_0x540a8f=0xce;}_0x443a35['status'](_0x540a8f);return _0x443a35[_0x3ce3('0x21')]('Content-Range',_0x8b8f94+'-'+_0x21d848+'/'+_0x305525)[_0x3ce3('0x22')](_0x3171be);}return null;};}function patchUpdates(_0x3af2fc){return function(_0x5d6fc3){try{jsonpatch[_0x3ce3('0x23')](_0x5d6fc3,_0x3af2fc,!![]);}catch(_0x1a4804){return BPromise[_0x3ce3('0x24')](_0x1a4804);}return _0x5d6fc3[_0x3ce3('0x25')]();};}function saveUpdates(_0x4c2aad,_0x8f6cb6){return function(_0x15d69f){if(_0x15d69f){return _0x15d69f[_0x3ce3('0x26')](_0x4c2aad)[_0x3ce3('0x27')](function(_0x43e615){return _0x43e615;});}return null;};}function removeEntity(_0x18a8dd,_0x30945e){return function(_0x27226d){if(_0x27226d){return _0x27226d[_0x3ce3('0x28')]()[_0x3ce3('0x27')](function(){_0x18a8dd['status'](0xcc)[_0x3ce3('0x1c')]();});}};}function handleEntityNotFound(_0x1f38c5,_0x48928a){return function(_0x4085ce){if(!_0x4085ce){_0x1f38c5[_0x3ce3('0x1a')](0x194);}return _0x4085ce;};}function handleError(_0x51a93e,_0x4d9cf1){_0x4d9cf1=_0x4d9cf1||0x1f4;return function(_0x2d1129){logger[_0x3ce3('0x29')](_0x2d1129[_0x3ce3('0x2a')]);if(_0x2d1129['name']){delete _0x2d1129[_0x3ce3('0x2b')];}_0x51a93e['status'](_0x4d9cf1)[_0x3ce3('0x2c')](_0x2d1129);};}exports[_0x3ce3('0x2d')]=function(_0x36d0da,_0x23f11a){var _0x3eb3e6={},_0x2b432d={},_0x144fd7={'count':0x0,'rows':[]};var _0x4741ca=_[_0x3ce3('0x2e')](db[_0x3ce3('0x2f')][_0x3ce3('0x30')],function(_0x5077c9){return{'name':_0x5077c9[_0x3ce3('0x31')],'type':_0x5077c9['type'][_0x3ce3('0x32')]};});_0x2b432d['model']=_[_0x3ce3('0x2e')](_0x4741ca,'name');_0x2b432d[_0x3ce3('0x33')]=_['keys'](_0x36d0da[_0x3ce3('0x33')]);_0x2b432d['filters']=_[_0x3ce3('0x34')](_0x2b432d[_0x3ce3('0x35')],_0x2b432d[_0x3ce3('0x33')]);_0x3eb3e6[_0x3ce3('0x36')]=_[_0x3ce3('0x34')](_0x2b432d['model'],qs['fields'](_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x37')]));_0x3eb3e6[_0x3ce3('0x36')]=_0x3eb3e6[_0x3ce3('0x36')]['length']?_0x3eb3e6['attributes']:_0x2b432d['model'];if(!_0x36d0da[_0x3ce3('0x33')]['hasOwnProperty']('nolimit')){_0x3eb3e6['limit']=qs[_0x3ce3('0x20')](_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x20')]);_0x3eb3e6[_0x3ce3('0x1d')]=qs[_0x3ce3('0x1d')](_0x36d0da[_0x3ce3('0x33')]['offset']);}_0x3eb3e6[_0x3ce3('0x38')]=qs[_0x3ce3('0x39')](_0x36d0da['query'][_0x3ce3('0x39')]);_0x3eb3e6[_0x3ce3('0x3a')]=qs[_0x3ce3('0x3b')](_[_0x3ce3('0x3c')](_0x36d0da[_0x3ce3('0x33')],_0x2b432d[_0x3ce3('0x3b')]),_0x4741ca);if(_0x36d0da[_0x3ce3('0x33')]['filter']){_0x3eb3e6[_0x3ce3('0x3a')]=_['merge'](_0x3eb3e6[_0x3ce3('0x3a')],{'$or':_[_0x3ce3('0x2e')](_0x4741ca,function(_0x39669d){if(_0x39669d[_0x3ce3('0x3d')]!==_0x3ce3('0x3e')){var _0x8d8eb={};_0x8d8eb[_0x39669d[_0x3ce3('0x2b')]]={'$like':'%'+_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x3f')]+'%'};return _0x8d8eb;}})});}_0x3eb3e6=_[_0x3ce3('0x40')]({},_0x3eb3e6,_0x36d0da['options']);var _0x1afb16={'where':_0x3eb3e6['where']};return db[_0x3ce3('0x2f')][_0x3ce3('0x1f')](_0x1afb16)[_0x3ce3('0x27')](function(_0xdf1f8e){_0x144fd7[_0x3ce3('0x1f')]=_0xdf1f8e;if(_0x36d0da[_0x3ce3('0x33')][_0x3ce3('0x41')]){_0x3eb3e6[_0x3ce3('0x42')]=[{'all':!![]}];}return db[_0x3ce3('0x2f')][_0x3ce3('0x43')](_0x3eb3e6);})[_0x3ce3('0x27')](function(_0x557777){_0x144fd7[_0x3ce3('0x44')]=_0x557777;return _0x144fd7;})[_0x3ce3('0x27')](respondWithFilteredResult(_0x23f11a,_0x3eb3e6))['catch'](handleError(_0x23f11a,null));};exports['show']=function(_0x3371b1,_0x3cde14){var _0x186e8d={'raw':![],'where':{'id':_0x3371b1['params']['id']}},_0x7da197={};_0x7da197['model']=_[_0x3ce3('0x45')](db[_0x3ce3('0x2f')][_0x3ce3('0x30')]);_0x7da197[_0x3ce3('0x33')]=_['keys'](_0x3371b1['query']);_0x7da197[_0x3ce3('0x3b')]=_[_0x3ce3('0x34')](_0x7da197['model'],_0x7da197[_0x3ce3('0x33')]);_0x186e8d[_0x3ce3('0x36')]=_['intersection'](_0x7da197[_0x3ce3('0x35')],qs[_0x3ce3('0x37')](_0x3371b1[_0x3ce3('0x33')][_0x3ce3('0x37')]));_0x186e8d['attributes']=_0x186e8d['attributes'][_0x3ce3('0x46')]?_0x186e8d[_0x3ce3('0x36')]:_0x7da197[_0x3ce3('0x35')];if(_0x3371b1[_0x3ce3('0x33')][_0x3ce3('0x41')]){_0x186e8d[_0x3ce3('0x42')]=[{'all':!![]}];}_0x186e8d=_['merge']({},_0x186e8d,_0x3371b1[_0x3ce3('0x47')]);return db[_0x3ce3('0x2f')][_0x3ce3('0x48')](_0x186e8d)[_0x3ce3('0x27')](handleEntityNotFound(_0x3cde14,null))['then'](respondWithResult(_0x3cde14,null))[_0x3ce3('0x49')](handleError(_0x3cde14,null));};exports[_0x3ce3('0x4a')]=function(_0x2df47c,_0x58a522){return db[_0x3ce3('0x2f')]['create'](_0x2df47c['body'],{})[_0x3ce3('0x27')](respondWithResult(_0x58a522,0xc9))[_0x3ce3('0x49')](handleError(_0x58a522,null));};exports[_0x3ce3('0x26')]=function(_0x21214e,_0x551a3e){if(_0x21214e[_0x3ce3('0x4b')]['id']){delete _0x21214e[_0x3ce3('0x4b')]['id'];}return db[_0x3ce3('0x2f')]['find']({'where':{'id':_0x21214e[_0x3ce3('0x4c')]['id']}})[_0x3ce3('0x27')](handleEntityNotFound(_0x551a3e,null))[_0x3ce3('0x27')](saveUpdates(_0x21214e[_0x3ce3('0x4b')],null))[_0x3ce3('0x27')](respondWithResult(_0x551a3e,null))['catch'](handleError(_0x551a3e,null));};exports[_0x3ce3('0x28')]=function(_0x15e859,_0x5453ce){return db[_0x3ce3('0x2f')][_0x3ce3('0x48')]({'where':{'id':_0x15e859[_0x3ce3('0x4c')]['id']}})[_0x3ce3('0x27')](handleEntityNotFound(_0x5453ce,null))['then'](removeEntity(_0x5453ce,null))[_0x3ce3('0x49')](handleError(_0x5453ce,null));};exports['getConfigurations']=function(_0x5193e0,_0x3143c8,_0x54133d){var _0x275d9e={};var _0x596451={};var _0x5ca9dd;var _0x3f2f53;return db[_0x3ce3('0x2f')][_0x3ce3('0x4d')]({'where':{'id':_0x5193e0[_0x3ce3('0x4c')]['id']}})[_0x3ce3('0x27')](handleEntityNotFound(_0x3143c8,null))[_0x3ce3('0x27')](function(_0x4f7254){if(_0x4f7254){_0x5ca9dd=_0x4f7254;_0x596451['model']=_[_0x3ce3('0x45')](db['FreshsalesConfiguration']['rawAttributes']);_0x596451[_0x3ce3('0x33')]=_['keys'](_0x5193e0['query']);_0x596451[_0x3ce3('0x3b')]=_['intersection'](_0x596451[_0x3ce3('0x35')],_0x596451[_0x3ce3('0x33')]);_0x275d9e[_0x3ce3('0x36')]=_[_0x3ce3('0x34')](_0x596451[_0x3ce3('0x35')],qs[_0x3ce3('0x37')](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x37')]));_0x275d9e[_0x3ce3('0x36')]=_0x275d9e['attributes'][_0x3ce3('0x46')]?_0x275d9e[_0x3ce3('0x36')]:_0x596451['model'];_0x275d9e['order']=qs[_0x3ce3('0x39')](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x39')]);_0x275d9e[_0x3ce3('0x3a')]=qs[_0x3ce3('0x3b')](_['pick'](_0x5193e0[_0x3ce3('0x33')],_0x596451[_0x3ce3('0x3b')]));if(_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x3f')]){_0x275d9e['where']=_[_0x3ce3('0x40')](_0x275d9e[_0x3ce3('0x3a')],{'$or':_[_0x3ce3('0x2e')](_0x275d9e[_0x3ce3('0x36')],function(_0x3194e5){var _0x597816={};_0x597816[_0x3194e5]={'$like':'%'+_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x3f')]+'%'};return _0x597816;})});}_0x275d9e=_['merge']({},_0x275d9e,_0x5193e0[_0x3ce3('0x47')]);return _0x5ca9dd[_0x3ce3('0x4e')](_0x275d9e);}})['then'](function(_0x10ea5b){if(_0x10ea5b){_0x3f2f53=_0x10ea5b[_0x3ce3('0x46')];if(!_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x4f')](_0x3ce3('0x50'))){_0x275d9e['limit']=qs['limit'](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x20')]);_0x275d9e[_0x3ce3('0x1d')]=qs[_0x3ce3('0x1d')](_0x5193e0[_0x3ce3('0x33')][_0x3ce3('0x1d')]);}return _0x5ca9dd[_0x3ce3('0x4e')](_0x275d9e);}})[_0x3ce3('0x27')](function(_0x4e31c7){if(_0x4e31c7){return _0x4e31c7?{'count':_0x3f2f53,'rows':_0x4e31c7}:null;}})[_0x3ce3('0x27')](respondWithResult(_0x3143c8,null))[_0x3ce3('0x49')](handleError(_0x3143c8,null));};exports['addConfiguration']=function(_0x1ea71d,_0x259571,_0x39cdfa){if(_0x1ea71d[_0x3ce3('0x4b')]['id']){delete _0x1ea71d[_0x3ce3('0x4b')]['id'];}return db['FreshsalesAccount'][_0x3ce3('0x4d')]({'where':{'id':_0x1ea71d[_0x3ce3('0x4c')]['id']}})['then'](handleEntityNotFound(_0x259571,null))[_0x3ce3('0x27')](function(_0x52c53b){if(_0x52c53b){_0x1ea71d['body']['AccountId']=_0x52c53b['id'];_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x51')]=integrations[_0x3ce3('0x52')](_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x53')],_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x3d')]);_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x54')]=integrations[_0x3ce3('0x55')](_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x53')],_0x1ea71d[_0x3ce3('0x4b')][_0x3ce3('0x3d')]);return db[_0x3ce3('0x56')][_0x3ce3('0x4a')](_0x1ea71d[_0x3ce3('0x4b')],{'include':[{'model':db[_0x3ce3('0x57')],'as':_0x3ce3('0x51')},{'model':db[_0x3ce3('0x57')],'as':_0x3ce3('0x54')}]});}return null;})[_0x3ce3('0x27')](respondWithResult(_0x259571,null))['catch'](handleError(_0x259571,null));};exports[_0x3ce3('0x58')]=function(_0xb6693f,_0x2f3625,_0x5db250){var _0x5a1b44='';var _0x463499='';return db['FreshsalesAccount'][_0x3ce3('0x4d')]({'where':{'id':_0xb6693f[_0x3ce3('0x4c')]['id']},'attributes':['id','username',_0x3ce3('0x59'),'apiKey']})['then'](handleEntityNotFound(_0x2f3625,null))[_0x3ce3('0x27')](function(_0x5b368e){if(_0x5b368e){_0x463499=_0x5b368e[_0x3ce3('0x5a')];_0x5a1b44=_0x5b368e['remoteUri'];var _0x3f9eac=_0x5b368e[_0x3ce3('0x59')][_0x3ce3('0x5b')](-0x1);if(_0x3f9eac==='/'){_0x5a1b44=_0x5a1b44[_0x3ce3('0x5c')](0x0,_0x5a1b44[_0x3ce3('0x5d')](_0x3f9eac));}return rp({'method':'GET','uri':util['format'](_0x3ce3('0x5e'),_0x5a1b44,_0x3ce3('0x5f')),'headers':{'Authorization':_0x3ce3('0x60')+_0x5b368e[_0x3ce3('0x61')]},'json':!![]});}})[_0x3ce3('0x27')](function(_0x4b1625){if(_0x4b1625){var _0x4abde4=_0x4b1625[_0x3ce3('0x62')];var _0x115c3b=![];var _0x1d537c=null;for(_0x1d537c=0x0;_0x1d537c<_0x4abde4[_0x3ce3('0x46')];_0x1d537c++){if(_0x4abde4[_0x1d537c][_0x3ce3('0x63')]===_0x463499){_0x115c3b=!![];}}if(_0x115c3b){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3ce3('0x64')});}}})['then'](respondWithResult(_0x2f3625,null))['catch'](function(_0x7f3171){var _0x71f550=_0xb6693f[_0x3ce3('0x33')][_0x3ce3('0x65')]?0x1f4:_0x7f3171[_0x3ce3('0x66')]||0x1f4;logger[_0x3ce3('0x29')](_0x3ce3('0x67'),'getFields',_0x71f550,JSON[_0x3ce3('0x68')](_0x7f3171));delete _0x7f3171[_0x3ce3('0x2b')];if(_0x71f550===0x191){_0x71f550=0x190;}_0x2f3625['status'](_0x71f550)[_0x3ce3('0x2c')](_0xb6693f[_0x3ce3('0x33')]['test']?{'message':_0x3ce3('0x69'),'statusCode':_0x7f3171[_0x3ce3('0x66')]}:_0x7f3171);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index fd1ab92..f004ae5 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 _0x627e=['path','rimraf','exports','define','FreshsalesAccount','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x57fa6a,_0x5ebc35){var _0x10777b=function(_0x3fb795){while(--_0x3fb795){_0x57fa6a['push'](_0x57fa6a['shift']());}};_0x10777b(++_0x5ebc35);}(_0x627e,0x14a));var _0xe627=function(_0x38cf13,_0x5f31af){_0x38cf13=_0x38cf13-0x0;var _0x3fbf11=_0x627e[_0x38cf13];return _0x3fbf11;};'use strict';var _=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var logger=require(_0xe627('0x2'))(_0xe627('0x3'));var moment=require(_0xe627('0x4'));var BPromise=require('bluebird');var rp=require(_0xe627('0x5'));var fs=require('fs');var path=require(_0xe627('0x6'));var rimraf=require(_0xe627('0x7'));var config=require('../../config/environment');var attributes=require('./intFreshsalesAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xe627('0x8')]=function(_0x3f2791,_0x45e49a){return _0x3f2791[_0xe627('0x9')](_0xe627('0xa'),attributes,{'tableName':_0xe627('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53ec=['path','../../config/environment','./intFreshsalesAccount.attributes','exports','define','int_freshsales_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x53ec,0x192));var _0xc53e=function(_0x1442bb,_0x1f994e){_0x1442bb=_0x1442bb-0x0;var _0x1d9b35=_0x53ec[_0x1442bb];return _0x1d9b35;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xc53e('0x9')]=function(_0x4f989b,_0x41a9e8){return _0x4f989b[_0xc53e('0xa')]('FreshsalesAccount',attributes,{'tableName':_0xc53e('0xb'),'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 180cf0a..315203e 100644 --- a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js +++ b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7ee1=['attributes','limit','include','map','model','info','ShowFreshsalesAccount','find','debug','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0x7ee1,0x8d));var _0x17ee=function(_0x5ce173,_0x522a95){_0x5ce173=_0x5ce173-0x0;var _0x13d857=_0x7ee1[_0x5ce173];return _0x13d857;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x17ee('0x1'));var fs=require('fs');var Redis=require(_0x17ee('0x2'));var db=require(_0x17ee('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x4'))(_0x17ee('0x5'));var config=require(_0x17ee('0x6'));var jayson=require(_0x17ee('0x7'));var client=jayson['client'][_0x17ee('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29b9eb,_0x54b4f6,_0x3f61af){return new BPromise(function(_0x57e1d1,_0x3d767b){return client[_0x17ee('0x9')](_0x29b9eb,_0x3f61af)[_0x17ee('0xa')](function(_0x4af369){logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,_0x17ee('0xb'));logger['debug'](_0x17ee('0xc'),_0x54b4f6,_0x17ee('0xb'),JSON[_0x17ee('0xd')](_0x4af369));if(_0x4af369[_0x17ee('0xe')]){if(_0x4af369['error'][_0x17ee('0xf')]===0x1f4){logger['error'](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x3d767b(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);return _0x57e1d1(_0x4af369[_0x17ee('0xe')][_0x17ee('0x11')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x54b4f6,'request\x20sent');_0x57e1d1(_0x4af369['result'][_0x17ee('0x11')]);}})[_0x17ee('0x12')](function(_0x1b87c3){logger[_0x17ee('0xe')](_0x17ee('0x10'),_0x54b4f6,_0x1b87c3);_0x3d767b(_0x1b87c3);});});}exports[_0x17ee('0x13')]=function(_0x63d27f){var _0x587ca7=this;return new Promise(function(_0x44fe58,_0x1118a3){return db[_0x17ee('0x14')][_0x17ee('0x15')]({'raw':_0x63d27f[_0x17ee('0x16')]?_0x63d27f['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x63d27f['options']?_0x63d27f[_0x17ee('0x16')]['where']||null:null,'attributes':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'limit':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x19')]||null:null,'include':_0x63d27f[_0x17ee('0x16')]?_0x63d27f[_0x17ee('0x16')][_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x63d27f[_0x17ee('0x16')]['include'],function(_0x4b7bfe){return{'model':db[_0x4b7bfe[_0x17ee('0x1c')]],'as':_0x4b7bfe['as'],'attributes':_0x4b7bfe[_0x17ee('0x18')],'include':_0x4b7bfe[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x4b7bfe[_0x17ee('0x1a')],function(_0xea358f){return{'model':db[_0xea358f[_0x17ee('0x1c')]],'as':_0xea358f['as'],'attributes':_0xea358f[_0x17ee('0x18')],'include':_0xea358f[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0xea358f[_0x17ee('0x1a')],function(_0x2a332f){return{'model':db[_0x2a332f['model']],'as':_0x2a332f['as'],'attributes':_0x2a332f[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x11ce7e){logger[_0x17ee('0x1d')](_0x17ee('0x13'),_0x63d27f);logger['debug'](_0x17ee('0x13'),_0x63d27f,JSON[_0x17ee('0xd')](_0x11ce7e));_0x44fe58(_0x11ce7e);})[_0x17ee('0x12')](function(_0x4c461b){logger[_0x17ee('0xe')](_0x17ee('0x13'),_0x4c461b['message'],_0x63d27f);_0x1118a3(_0x587ca7[_0x17ee('0xe')](0x1f4,_0x4c461b['message']));});});};exports[_0x17ee('0x1e')]=function(_0x5a44c4){var _0x141ac9=this;return new Promise(function(_0x23ca2e,_0x373c20){return db['FreshsalesAccount'][_0x17ee('0x1f')]({'raw':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4['options'][_0x17ee('0x17')]===undefined?!![]:![]:!![],'where':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['where']||null:null,'attributes':_0x5a44c4['options']?_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x18')]||null:null,'include':_0x5a44c4[_0x17ee('0x16')]?_0x5a44c4[_0x17ee('0x16')]['include']?_['map'](_0x5a44c4[_0x17ee('0x16')][_0x17ee('0x1a')],function(_0x23578a){return{'model':db[_0x23578a[_0x17ee('0x1c')]],'as':_0x23578a['as'],'attributes':_0x23578a[_0x17ee('0x18')],'include':_0x23578a[_0x17ee('0x1a')]?_[_0x17ee('0x1b')](_0x23578a['include'],function(_0x4a6bc9){return{'model':db[_0x4a6bc9['model']],'as':_0x4a6bc9['as'],'attributes':_0x4a6bc9[_0x17ee('0x18')],'include':_0x4a6bc9['include']?_[_0x17ee('0x1b')](_0x4a6bc9[_0x17ee('0x1a')],function(_0xed7e8a){return{'model':db[_0xed7e8a['model']],'as':_0xed7e8a['as'],'attributes':_0xed7e8a[_0x17ee('0x18')]};}):[]};}):[]};}):[]:[]})[_0x17ee('0xa')](function(_0x590d27){logger['info'](_0x17ee('0x1e'),_0x5a44c4);logger[_0x17ee('0x20')](_0x17ee('0x1e'),_0x5a44c4,JSON[_0x17ee('0xd')](_0x590d27));_0x23ca2e(_0x590d27);})[_0x17ee('0x12')](function(_0x5a2c08){logger['error'](_0x17ee('0x1e'),_0x5a2c08[_0x17ee('0x11')],_0x5a44c4);_0x373c20(_0x141ac9[_0x17ee('0xe')](0x1f4,_0x5a2c08[_0x17ee('0x11')]));});});}; \ No newline at end of file +var _0xacf4=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowFreshsalesAccount'];(function(_0x4aea1c,_0x3a6980){var _0x4b7ae5=function(_0xb7770f){while(--_0xb7770f){_0x4aea1c['push'](_0x4aea1c['shift']());}};_0x4b7ae5(++_0x3a6980);}(_0xacf4,0xe7));var _0x4acf=function(_0x2e9155,_0x32eb3f){_0x2e9155=_0x2e9155-0x0;var _0x45092a=_0xacf4[_0x2e9155];return _0x45092a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4acf('0x0'));var BPromise=require(_0x4acf('0x1'));var rs=require(_0x4acf('0x2'));var fs=require('fs');var Redis=require(_0x4acf('0x3'));var db=require(_0x4acf('0x4'))['db'];var utils=require(_0x4acf('0x5'));var logger=require(_0x4acf('0x6'))('rpc');var config=require(_0x4acf('0x7'));var jayson=require(_0x4acf('0x8'));var client=jayson['client'][_0x4acf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ba08a,_0x649ad2,_0x45a5a4){return new BPromise(function(_0x25d345,_0x50f5f4){return client['request'](_0x2ba08a,_0x45a5a4)[_0x4acf('0xa')](function(_0x59f559){logger[_0x4acf('0xb')](_0x4acf('0xc'),_0x649ad2,_0x4acf('0xd'));logger['debug'](_0x4acf('0xe'),_0x649ad2,_0x4acf('0xd'),JSON['stringify'](_0x59f559));if(_0x59f559['error']){if(_0x59f559[_0x4acf('0xf')]['code']===0x1f4){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x50f5f4(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}logger[_0x4acf('0xf')](_0x4acf('0xc'),_0x649ad2,_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);return _0x25d345(_0x59f559[_0x4acf('0xf')][_0x4acf('0x10')]);}else{logger['info'](_0x4acf('0xc'),_0x649ad2,'request\x20sent');_0x25d345(_0x59f559[_0x4acf('0x11')][_0x4acf('0x10')]);}})[_0x4acf('0x12')](function(_0x5d934a){logger['error'](_0x4acf('0xc'),_0x649ad2,_0x5d934a);_0x50f5f4(_0x5d934a);});});}exports[_0x4acf('0x13')]=function(_0x240c00){var _0x4b1d93=this;return new Promise(function(_0x2a678b,_0x137302){return db[_0x4acf('0x14')][_0x4acf('0x15')]({'raw':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x240c00[_0x4acf('0x16')]?_0x240c00[_0x4acf('0x16')][_0x4acf('0x18')]||null:null,'attributes':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x19')]||null:null,'limit':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1a')]||null:null,'include':_0x240c00[_0x4acf('0x16')]?_0x240c00['options'][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x240c00[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x53885f){return{'model':db[_0x53885f[_0x4acf('0x1d')]],'as':_0x53885f['as'],'attributes':_0x53885f[_0x4acf('0x19')],'include':_0x53885f['include']?_[_0x4acf('0x1c')](_0x53885f[_0x4acf('0x1b')],function(_0x52a84a){return{'model':db[_0x52a84a[_0x4acf('0x1d')]],'as':_0x52a84a['as'],'attributes':_0x52a84a[_0x4acf('0x19')],'include':_0x52a84a[_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x52a84a['include'],function(_0x50236d){return{'model':db[_0x50236d[_0x4acf('0x1d')]],'as':_0x50236d['as'],'attributes':_0x50236d[_0x4acf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0x42c90c){logger[_0x4acf('0xb')](_0x4acf('0x13'),_0x240c00);logger[_0x4acf('0x1e')](_0x4acf('0x13'),_0x240c00,JSON[_0x4acf('0x1f')](_0x42c90c));_0x2a678b(_0x42c90c);})[_0x4acf('0x12')](function(_0x57989e){logger[_0x4acf('0xf')](_0x4acf('0x13'),_0x57989e[_0x4acf('0x10')],_0x240c00);_0x137302(_0x4b1d93[_0x4acf('0xf')](0x1f4,_0x57989e[_0x4acf('0x10')]));});});};exports[_0x4acf('0x20')]=function(_0x27384c){var _0x5d862f=this;return new Promise(function(_0x337b3c,_0x1d221b){return db[_0x4acf('0x14')]['find']({'raw':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x17')]===undefined?!![]:![]:!![],'where':_0x27384c[_0x4acf('0x16')]?_0x27384c['options'][_0x4acf('0x18')]||null:null,'attributes':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')]['attributes']||null:null,'include':_0x27384c[_0x4acf('0x16')]?_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')]?_[_0x4acf('0x1c')](_0x27384c[_0x4acf('0x16')][_0x4acf('0x1b')],function(_0x490880){return{'model':db[_0x490880[_0x4acf('0x1d')]],'as':_0x490880['as'],'attributes':_0x490880[_0x4acf('0x19')],'include':_0x490880['include']?_[_0x4acf('0x1c')](_0x490880['include'],function(_0x4cd020){return{'model':db[_0x4cd020['model']],'as':_0x4cd020['as'],'attributes':_0x4cd020['attributes'],'include':_0x4cd020['include']?_['map'](_0x4cd020['include'],function(_0x3364dd){return{'model':db[_0x3364dd[_0x4acf('0x1d')]],'as':_0x3364dd['as'],'attributes':_0x3364dd['attributes']};}):[]};}):[]};}):[]:[]})[_0x4acf('0xa')](function(_0xbd0f92){logger[_0x4acf('0xb')](_0x4acf('0x20'),_0x27384c);logger[_0x4acf('0x1e')](_0x4acf('0x20'),_0x27384c,JSON[_0x4acf('0x1f')](_0xbd0f92));_0x337b3c(_0xbd0f92);})[_0x4acf('0x12')](function(_0x24465b){logger[_0x4acf('0xf')]('ShowFreshsalesAccount',_0x24465b['message'],_0x27384c);_0x1d221b(_0x5d862f[_0x4acf('0xf')](0x1f4,_0x24465b[_0x4acf('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 59f0796..d841fae 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 _0x4d67=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','put','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4d67,0x16f));var _0x74d6=function(_0x161084,_0x207564){_0x161084=_0x161084-0x0;var _0x395240=_0x4d67[_0x161084];return _0x395240;};'use strict';var multer=require(_0x74d6('0x0'));var util=require(_0x74d6('0x1'));var path=require('path');var timeout=require(_0x74d6('0x2'));var express=require(_0x74d6('0x3'));var router=express[_0x74d6('0x4')]();var fs_extra=require(_0x74d6('0x5'));var auth=require(_0x74d6('0x6'));var interaction=require(_0x74d6('0x7'));var config=require(_0x74d6('0x8'));var controller=require('./intFreshsalesConfiguration.controller');router['get']('/',auth[_0x74d6('0x9')](),controller[_0x74d6('0xa')]);router[_0x74d6('0xb')](_0x74d6('0xc'),auth[_0x74d6('0x9')](),controller[_0x74d6('0xd')]);router[_0x74d6('0xb')]('/:id/subjects',auth[_0x74d6('0x9')](),controller[_0x74d6('0xe')]);router[_0x74d6('0xb')](_0x74d6('0xf'),auth[_0x74d6('0x9')](),controller[_0x74d6('0x10')]);router[_0x74d6('0xb')](_0x74d6('0x11'),auth[_0x74d6('0x9')](),controller[_0x74d6('0x12')]);router[_0x74d6('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x74d6('0x14')](_0x74d6('0xc'),auth[_0x74d6('0x9')](),controller['update']);router[_0x74d6('0x15')](_0x74d6('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0a1d=['./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','getSubjects','getDescriptions','/:id/fields','getFields','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20c80f,_0x4b54c9){var _0x2b62e1=function(_0x3f4f42){while(--_0x3f4f42){_0x20c80f['push'](_0x20c80f['shift']());}};_0x2b62e1(++_0x4b54c9);}(_0x0a1d,0x1dc));var _0xd0a1=function(_0x2ce9b3,_0xcc5a79){_0x2ce9b3=_0x2ce9b3-0x0;var _0x796a07=_0x0a1d[_0x2ce9b3];return _0x796a07;};'use strict';var multer=require('multer');var util=require(_0xd0a1('0x0'));var path=require(_0xd0a1('0x1'));var timeout=require(_0xd0a1('0x2'));var express=require('express');var router=express[_0xd0a1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd0a1('0x4'));var interaction=require(_0xd0a1('0x5'));var config=require(_0xd0a1('0x6'));var controller=require(_0xd0a1('0x7'));router[_0xd0a1('0x8')]('/',auth['isAuthenticated'](),controller[_0xd0a1('0x9')]);router[_0xd0a1('0x8')](_0xd0a1('0xa'),auth[_0xd0a1('0xb')](),controller[_0xd0a1('0xc')]);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd0a1('0xd')]);router[_0xd0a1('0x8')]('/:id/descriptions',auth[_0xd0a1('0xb')](),controller[_0xd0a1('0xe')]);router[_0xd0a1('0x8')](_0xd0a1('0xf'),auth['isAuthenticated'](),controller[_0xd0a1('0x10')]);router[_0xd0a1('0x11')]('/',auth['isAuthenticated'](),controller[_0xd0a1('0x12')]);router[_0xd0a1('0x13')](_0xd0a1('0xa'),auth[_0xd0a1('0xb')](),controller['update']);router[_0xd0a1('0x14')](_0xd0a1('0xa'),auth[_0xd0a1('0xb')](),controller[_0xd0a1('0x15')]);module[_0xd0a1('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index e41d539..5104509 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 _0xea78=['sequelize','exports','STRING'];(function(_0x5a1314,_0x1df1f1){var _0xbbcabc=function(_0x2511f2){while(--_0x2511f2){_0x5a1314['push'](_0x5a1314['shift']());}};_0xbbcabc(++_0x1df1f1);}(_0xea78,0xc6));var _0x8ea7=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xea78[_0x18f64a];return _0x44687f;};'use strict';var Sequelize=require(_0x8ea7('0x0'));module[_0x8ea7('0x1')]={'name':{'type':Sequelize[_0x8ea7('0x2')]},'description':{'type':Sequelize[_0x8ea7('0x2')]}}; \ No newline at end of file +var _0x719b=['sequelize','exports','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x719b,0xde));var _0xb719=function(_0x1d590a,_0x41916a){_0x1d590a=_0x1d590a-0x0;var _0x4bd1dd=_0x719b[_0x1d590a];return _0x4bd1dd;};'use strict';var Sequelize=require(_0xb719('0x0'));module[_0xb719('0x1')]={'name':{'type':Sequelize[_0xb719('0x2')]},'description':{'type':Sequelize[_0xb719('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 9508fc1..a1cdbbf 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 _0xec90=['desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','body','find','getSubjects','FreshsalesField','getDescriptions','pick','getFields','findOne','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0xec90,0x1d4));var _0x0ec9=function(_0x38be46,_0x524fe1){_0x38be46=_0x38be46-0x0;var _0x192474=_0xec90[_0x38be46];return _0x192474;};'use strict';var emlformat=require(_0x0ec9('0x0'));var rimraf=require(_0x0ec9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0ec9('0x2'));var rp=require('request-promise');var moment=require(_0x0ec9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0ec9('0x4'));var path=require(_0x0ec9('0x5'));var sox=require(_0x0ec9('0x6'));var csv=require(_0x0ec9('0x7'));var ejs=require(_0x0ec9('0x8'));var fs=require('fs');var fs_extra=require(_0x0ec9('0x9'));var _=require(_0x0ec9('0xa'));var squel=require(_0x0ec9('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0ec9('0xc'));var toCsv=require(_0x0ec9('0x7'));var querystring=require('querystring');var Papa=require(_0x0ec9('0xd'));var Redis=require(_0x0ec9('0xe'));var authService=require(_0x0ec9('0xf'));var qs=require(_0x0ec9('0x10'));var as=require(_0x0ec9('0x11'));var hardwareService=require(_0x0ec9('0x12'));var logger=require(_0x0ec9('0x13'))(_0x0ec9('0x14'));var utils=require(_0x0ec9('0x15'));var config=require(_0x0ec9('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x0ec9('0x17'))['db'];function respondWithStatusCode(_0x3f4873,_0x5d921b){_0x5d921b=_0x5d921b||0xcc;return function(_0x11ae7d){if(_0x11ae7d){return _0x3f4873['sendStatus'](_0x5d921b);}return _0x3f4873[_0x0ec9('0x18')](_0x5d921b)[_0x0ec9('0x19')]();};}function respondWithResult(_0x114169,_0x46b248){_0x46b248=_0x46b248||0xc8;return function(_0xf9923c){if(_0xf9923c){return _0x114169['status'](_0x46b248)['json'](_0xf9923c);}};}function respondWithFilteredResult(_0x4ae2ac,_0x54246e){return function(_0x541dd8){if(_0x541dd8){var _0x4a0f7f=typeof _0x54246e[_0x0ec9('0x1a')]===_0x0ec9('0x1b')&&typeof _0x54246e[_0x0ec9('0x1c')]===_0x0ec9('0x1b');var _0x6aec6e=_0x541dd8[_0x0ec9('0x1d')];var _0x395621=_0x4a0f7f?0x0:_0x54246e['offset'];var _0xcd9613=_0x4a0f7f?_0x541dd8[_0x0ec9('0x1d')]:_0x54246e[_0x0ec9('0x1a')]+_0x54246e['limit'];var _0x5b404e;if(_0xcd9613>=_0x6aec6e){_0xcd9613=_0x6aec6e;_0x5b404e=0xc8;}else{_0x5b404e=0xce;}_0x4ae2ac[_0x0ec9('0x18')](_0x5b404e);return _0x4ae2ac[_0x0ec9('0x1e')](_0x0ec9('0x1f'),_0x395621+'-'+_0xcd9613+'/'+_0x6aec6e)[_0x0ec9('0x20')](_0x541dd8);}return null;};}function patchUpdates(_0x32d4a6){return function(_0x53e0ad){try{jsonpatch['apply'](_0x53e0ad,_0x32d4a6,!![]);}catch(_0x217eb2){return BPromise[_0x0ec9('0x21')](_0x217eb2);}return _0x53e0ad[_0x0ec9('0x22')]();};}function saveUpdates(_0x410104,_0x330b0b){return function(_0x494650){if(_0x494650){return _0x494650[_0x0ec9('0x23')](_0x410104)[_0x0ec9('0x24')](function(_0x465a0e){return _0x465a0e;});}return null;};}function removeEntity(_0x3102e2,_0x3cd40d){return function(_0x4536b3){if(_0x4536b3){return _0x4536b3[_0x0ec9('0x25')]()[_0x0ec9('0x24')](function(){_0x3102e2['status'](0xcc)[_0x0ec9('0x19')]();});}};}function handleEntityNotFound(_0x17a6b0,_0x19270a){return function(_0x54705b){if(!_0x54705b){_0x17a6b0['sendStatus'](0x194);}return _0x54705b;};}function handleError(_0x4239b3,_0x158012){_0x158012=_0x158012||0x1f4;return function(_0x2869f0){logger[_0x0ec9('0x26')](_0x2869f0[_0x0ec9('0x27')]);if(_0x2869f0[_0x0ec9('0x28')]){delete _0x2869f0[_0x0ec9('0x28')];}_0x4239b3[_0x0ec9('0x18')](_0x158012)[_0x0ec9('0x29')](_0x2869f0);};}exports[_0x0ec9('0x2a')]=function(_0x4b3795,_0x30b179){var _0x3001e9={},_0x25b90a={},_0x5aa29f={'count':0x0,'rows':[]};var _0x266641=_[_0x0ec9('0x2b')](db[_0x0ec9('0x2c')][_0x0ec9('0x2d')],function(_0x282ea4){return{'name':_0x282ea4['fieldName'],'type':_0x282ea4[_0x0ec9('0x2e')][_0x0ec9('0x2f')]};});_0x25b90a[_0x0ec9('0x30')]=_['map'](_0x266641,_0x0ec9('0x28'));_0x25b90a[_0x0ec9('0x31')]=_[_0x0ec9('0x32')](_0x4b3795[_0x0ec9('0x31')]);_0x25b90a[_0x0ec9('0x33')]=_['intersection'](_0x25b90a['model'],_0x25b90a[_0x0ec9('0x31')]);_0x3001e9['attributes']=_[_0x0ec9('0x34')](_0x25b90a[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0x4b3795['query'][_0x0ec9('0x35')]));_0x3001e9[_0x0ec9('0x36')]=_0x3001e9[_0x0ec9('0x36')][_0x0ec9('0x37')]?_0x3001e9['attributes']:_0x25b90a[_0x0ec9('0x30')];if(!_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0x3001e9[_0x0ec9('0x1c')]=qs['limit'](_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x1c')]);_0x3001e9[_0x0ec9('0x1a')]=qs['offset'](_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x1a')]);}_0x3001e9[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x3b')]);_0x3001e9[_0x0ec9('0x3c')]=qs[_0x0ec9('0x33')](_['pick'](_0x4b3795[_0x0ec9('0x31')],_0x25b90a[_0x0ec9('0x33')]),_0x266641);if(_0x4b3795['query'][_0x0ec9('0x3d')]){_0x3001e9['where']=_['merge'](_0x3001e9[_0x0ec9('0x3c')],{'$or':_['map'](_0x266641,function(_0x3330bd){if(_0x3330bd[_0x0ec9('0x2e')]!==_0x0ec9('0x3e')){var _0x31cfd4={};_0x31cfd4[_0x3330bd[_0x0ec9('0x28')]]={'$like':'%'+_0x4b3795['query'][_0x0ec9('0x3d')]+'%'};return _0x31cfd4;}})});}_0x3001e9=_[_0x0ec9('0x3f')]({},_0x3001e9,_0x4b3795[_0x0ec9('0x40')]);var _0x4d565c={'where':_0x3001e9[_0x0ec9('0x3c')]};return db[_0x0ec9('0x2c')][_0x0ec9('0x1d')](_0x4d565c)[_0x0ec9('0x24')](function(_0x5653ff){_0x5aa29f[_0x0ec9('0x1d')]=_0x5653ff;if(_0x4b3795[_0x0ec9('0x31')][_0x0ec9('0x41')]){_0x3001e9[_0x0ec9('0x42')]=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x3001e9);})[_0x0ec9('0x24')](function(_0x573a87){_0x5aa29f[_0x0ec9('0x43')]=_0x573a87;return _0x5aa29f;})['then'](respondWithFilteredResult(_0x30b179,_0x3001e9))['catch'](handleError(_0x30b179,null));};exports[_0x0ec9('0x44')]=function(_0x187730,_0x2a7121){var _0x45d725={'raw':![],'where':{'id':_0x187730[_0x0ec9('0x45')]['id']}},_0x518002={};_0x518002[_0x0ec9('0x30')]=_[_0x0ec9('0x32')](db[_0x0ec9('0x2c')][_0x0ec9('0x2d')]);_0x518002[_0x0ec9('0x31')]=_['keys'](_0x187730[_0x0ec9('0x31')]);_0x518002['filters']=_[_0x0ec9('0x34')](_0x518002['model'],_0x518002['query']);_0x45d725[_0x0ec9('0x36')]=_['intersection'](_0x518002[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0x187730[_0x0ec9('0x31')]['fields']));_0x45d725[_0x0ec9('0x36')]=_0x45d725[_0x0ec9('0x36')][_0x0ec9('0x37')]?_0x45d725['attributes']:_0x518002[_0x0ec9('0x30')];if(_0x187730[_0x0ec9('0x31')]['includeAll']){_0x45d725[_0x0ec9('0x42')]=[{'all':!![]}];}_0x45d725=_[_0x0ec9('0x3f')]({},_0x45d725,_0x187730[_0x0ec9('0x40')]);return db[_0x0ec9('0x2c')]['find'](_0x45d725)['then'](handleEntityNotFound(_0x2a7121,null))[_0x0ec9('0x24')](respondWithResult(_0x2a7121,null))[_0x0ec9('0x46')](handleError(_0x2a7121,null));};exports[_0x0ec9('0x47')]=function(_0x36f78e,_0x1ecce8){return db[_0x0ec9('0x2c')]['create'](_0x36f78e[_0x0ec9('0x48')],{})[_0x0ec9('0x24')](respondWithResult(_0x1ecce8,0xc9))[_0x0ec9('0x46')](handleError(_0x1ecce8,null));};exports[_0x0ec9('0x23')]=function(_0x37f171,_0x472efe){if(_0x37f171['body']['id']){delete _0x37f171['body']['id'];}return db['FreshsalesConfiguration'][_0x0ec9('0x49')]({'where':{'id':_0x37f171[_0x0ec9('0x45')]['id']}})['then'](handleEntityNotFound(_0x472efe,null))['then'](saveUpdates(_0x37f171['body'],null))[_0x0ec9('0x24')](respondWithResult(_0x472efe,null))[_0x0ec9('0x46')](handleError(_0x472efe,null));};exports[_0x0ec9('0x25')]=function(_0x4b8667,_0x20fe9a){return db[_0x0ec9('0x2c')][_0x0ec9('0x49')]({'where':{'id':_0x4b8667[_0x0ec9('0x45')]['id']}})['then'](handleEntityNotFound(_0x20fe9a,null))['then'](removeEntity(_0x20fe9a,null))[_0x0ec9('0x46')](handleError(_0x20fe9a,null));};exports[_0x0ec9('0x4a')]=function(_0x29166f,_0x4f2e20,_0xac8b8e){var _0xbad4fa={};var _0x182153={};var _0x50dbf3;var _0x318ce5;return db[_0x0ec9('0x2c')]['findOne']({'where':{'id':_0x29166f['params']['id']}})[_0x0ec9('0x24')](handleEntityNotFound(_0x4f2e20,null))['then'](function(_0x3c34bb){if(_0x3c34bb){_0x50dbf3=_0x3c34bb;_0x182153[_0x0ec9('0x30')]=_[_0x0ec9('0x32')](db[_0x0ec9('0x4b')][_0x0ec9('0x2d')]);_0x182153['query']=_[_0x0ec9('0x32')](_0x29166f[_0x0ec9('0x31')]);_0x182153[_0x0ec9('0x33')]=_[_0x0ec9('0x34')](_0x182153['model'],_0x182153[_0x0ec9('0x31')]);_0xbad4fa[_0x0ec9('0x36')]=_[_0x0ec9('0x34')](_0x182153[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0x29166f[_0x0ec9('0x31')][_0x0ec9('0x35')]));_0xbad4fa[_0x0ec9('0x36')]=_0xbad4fa[_0x0ec9('0x36')]['length']?_0xbad4fa[_0x0ec9('0x36')]:_0x182153['model'];_0xbad4fa[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0x29166f['query'][_0x0ec9('0x3b')]);_0xbad4fa[_0x0ec9('0x3c')]=qs[_0x0ec9('0x33')](_['pick'](_0x29166f[_0x0ec9('0x31')],_0x182153[_0x0ec9('0x33')]));if(_0x29166f[_0x0ec9('0x31')][_0x0ec9('0x3d')]){_0xbad4fa['where']=_[_0x0ec9('0x3f')](_0xbad4fa[_0x0ec9('0x3c')],{'$or':_[_0x0ec9('0x2b')](_0xbad4fa[_0x0ec9('0x36')],function(_0x59a667){var _0x2db33a={};_0x2db33a[_0x59a667]={'$like':'%'+_0x29166f[_0x0ec9('0x31')][_0x0ec9('0x3d')]+'%'};return _0x2db33a;})});}_0xbad4fa=_[_0x0ec9('0x3f')]({},_0xbad4fa,_0x29166f['options']);return _0x50dbf3[_0x0ec9('0x4a')](_0xbad4fa);}})[_0x0ec9('0x24')](function(_0x110643){if(_0x110643){_0x318ce5=_0x110643[_0x0ec9('0x37')];if(!_0x29166f['query'][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0xbad4fa[_0x0ec9('0x1c')]=qs['limit'](_0x29166f['query']['limit']);_0xbad4fa[_0x0ec9('0x1a')]=qs[_0x0ec9('0x1a')](_0x29166f['query'][_0x0ec9('0x1a')]);}return _0x50dbf3['getSubjects'](_0xbad4fa);}})['then'](function(_0x4e588e){if(_0x4e588e){return _0x4e588e?{'count':_0x318ce5,'rows':_0x4e588e}:null;}})[_0x0ec9('0x24')](respondWithResult(_0x4f2e20,null))['catch'](handleError(_0x4f2e20,null));};exports[_0x0ec9('0x4c')]=function(_0xf4486d,_0x512a06,_0x3310f7){var _0x508abd={};var _0x3349a9={};var _0x3538c3;var _0x3f0618;return db[_0x0ec9('0x2c')]['findOne']({'where':{'id':_0xf4486d['params']['id']}})[_0x0ec9('0x24')](handleEntityNotFound(_0x512a06,null))['then'](function(_0x1ba47a){if(_0x1ba47a){_0x3538c3=_0x1ba47a;_0x3349a9['model']=_[_0x0ec9('0x32')](db[_0x0ec9('0x4b')][_0x0ec9('0x2d')]);_0x3349a9[_0x0ec9('0x31')]=_['keys'](_0xf4486d[_0x0ec9('0x31')]);_0x3349a9[_0x0ec9('0x33')]=_[_0x0ec9('0x34')](_0x3349a9['model'],_0x3349a9[_0x0ec9('0x31')]);_0x508abd[_0x0ec9('0x36')]=_[_0x0ec9('0x34')](_0x3349a9[_0x0ec9('0x30')],qs[_0x0ec9('0x35')](_0xf4486d['query'][_0x0ec9('0x35')]));_0x508abd['attributes']=_0x508abd[_0x0ec9('0x36')]['length']?_0x508abd[_0x0ec9('0x36')]:_0x3349a9[_0x0ec9('0x30')];_0x508abd[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x3b')]);_0x508abd['where']=qs[_0x0ec9('0x33')](_[_0x0ec9('0x4d')](_0xf4486d[_0x0ec9('0x31')],_0x3349a9[_0x0ec9('0x33')]));if(_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x3d')]){_0x508abd[_0x0ec9('0x3c')]=_[_0x0ec9('0x3f')](_0x508abd['where'],{'$or':_['map'](_0x508abd[_0x0ec9('0x36')],function(_0x42f291){var _0xd3ead2={};_0xd3ead2[_0x42f291]={'$like':'%'+_0xf4486d[_0x0ec9('0x31')]['filter']+'%'};return _0xd3ead2;})});}_0x508abd=_[_0x0ec9('0x3f')]({},_0x508abd,_0xf4486d[_0x0ec9('0x40')]);return _0x3538c3[_0x0ec9('0x4c')](_0x508abd);}})[_0x0ec9('0x24')](function(_0x1e53fa){if(_0x1e53fa){_0x3f0618=_0x1e53fa[_0x0ec9('0x37')];if(!_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0x508abd[_0x0ec9('0x1c')]=qs[_0x0ec9('0x1c')](_0xf4486d[_0x0ec9('0x31')][_0x0ec9('0x1c')]);_0x508abd['offset']=qs[_0x0ec9('0x1a')](_0xf4486d[_0x0ec9('0x31')]['offset']);}return _0x3538c3[_0x0ec9('0x4c')](_0x508abd);}})[_0x0ec9('0x24')](function(_0xf2093c){if(_0xf2093c){return _0xf2093c?{'count':_0x3f0618,'rows':_0xf2093c}:null;}})[_0x0ec9('0x24')](respondWithResult(_0x512a06,null))[_0x0ec9('0x46')](handleError(_0x512a06,null));};exports[_0x0ec9('0x4e')]=function(_0x358433,_0x5efaea,_0x12fedf){var _0x1e67b9={};var _0x5de64e={};var _0x269e03;var _0x26c0b7;return db[_0x0ec9('0x2c')][_0x0ec9('0x4f')]({'where':{'id':_0x358433[_0x0ec9('0x45')]['id']}})[_0x0ec9('0x24')](handleEntityNotFound(_0x5efaea,null))[_0x0ec9('0x24')](function(_0xdafe8e){if(_0xdafe8e){_0x269e03=_0xdafe8e;_0x5de64e[_0x0ec9('0x30')]=_[_0x0ec9('0x32')](db[_0x0ec9('0x4b')][_0x0ec9('0x2d')]);_0x5de64e['query']=_[_0x0ec9('0x32')](_0x358433[_0x0ec9('0x31')]);_0x5de64e[_0x0ec9('0x33')]=_[_0x0ec9('0x34')](_0x5de64e['model'],_0x5de64e['query']);_0x1e67b9[_0x0ec9('0x36')]=_[_0x0ec9('0x34')](_0x5de64e['model'],qs['fields'](_0x358433[_0x0ec9('0x31')][_0x0ec9('0x35')]));_0x1e67b9[_0x0ec9('0x36')]=_0x1e67b9['attributes']['length']?_0x1e67b9[_0x0ec9('0x36')]:_0x5de64e[_0x0ec9('0x30')];_0x1e67b9[_0x0ec9('0x3a')]=qs[_0x0ec9('0x3b')](_0x358433[_0x0ec9('0x31')][_0x0ec9('0x3b')]);_0x1e67b9['where']=qs[_0x0ec9('0x33')](_['pick'](_0x358433['query'],_0x5de64e[_0x0ec9('0x33')]));if(_0x358433[_0x0ec9('0x31')]['filter']){_0x1e67b9[_0x0ec9('0x3c')]=_[_0x0ec9('0x3f')](_0x1e67b9['where'],{'$or':_[_0x0ec9('0x2b')](_0x1e67b9[_0x0ec9('0x36')],function(_0x4df257){var _0x27afa8={};_0x27afa8[_0x4df257]={'$like':'%'+_0x358433['query'][_0x0ec9('0x3d')]+'%'};return _0x27afa8;})});}_0x1e67b9=_[_0x0ec9('0x3f')]({},_0x1e67b9,_0x358433['options']);return _0x269e03[_0x0ec9('0x4e')](_0x1e67b9);}})[_0x0ec9('0x24')](function(_0x2b0c20){if(_0x2b0c20){_0x26c0b7=_0x2b0c20[_0x0ec9('0x37')];if(!_0x358433[_0x0ec9('0x31')][_0x0ec9('0x38')](_0x0ec9('0x39'))){_0x1e67b9[_0x0ec9('0x1c')]=qs[_0x0ec9('0x1c')](_0x358433['query']['limit']);_0x1e67b9['offset']=qs[_0x0ec9('0x1a')](_0x358433[_0x0ec9('0x31')][_0x0ec9('0x1a')]);}return _0x269e03[_0x0ec9('0x4e')](_0x1e67b9);}})['then'](function(_0xb4a7bb){if(_0xb4a7bb){return _0xb4a7bb?{'count':_0x26c0b7,'rows':_0xb4a7bb}:null;}})[_0x0ec9('0x24')](respondWithResult(_0x5efaea,null))['catch'](handleError(_0x5efaea,null));}; \ No newline at end of file +var _0xc1b6=['includeAll','find','create','body','params','getSubjects','FreshsalesField','getDescriptions','findOne','getFields','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/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','name','index','map','rawAttributes','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','FreshsalesConfiguration','include','findAll','rows','catch','show'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc1b6,0x1de));var _0x6c1b=function(_0x50478e,_0x404854){_0x50478e=_0x50478e-0x0;var _0x190c0e=_0xc1b6[_0x50478e];return _0x190c0e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6c1b('0x0'));var zipdir=require(_0x6c1b('0x1'));var jsonpatch=require(_0x6c1b('0x2'));var rp=require(_0x6c1b('0x3'));var moment=require(_0x6c1b('0x4'));var BPromise=require(_0x6c1b('0x5'));var Mustache=require(_0x6c1b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x6c1b('0x7'));var csv=require(_0x6c1b('0x8'));var ejs=require(_0x6c1b('0x9'));var fs=require('fs');var fs_extra=require(_0x6c1b('0xa'));var _=require(_0x6c1b('0xb'));var squel=require(_0x6c1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x6c1b('0xd'));var deskjs=require(_0x6c1b('0xe'));var toCsv=require(_0x6c1b('0x8'));var querystring=require('querystring');var Papa=require(_0x6c1b('0xf'));var Redis=require(_0x6c1b('0x10'));var authService=require(_0x6c1b('0x11'));var qs=require(_0x6c1b('0x12'));var as=require(_0x6c1b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c1b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x6c1b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1b('0x16'))['db'];function respondWithStatusCode(_0x44f2b3,_0x10edd4){_0x10edd4=_0x10edd4||0xcc;return function(_0x5c67db){if(_0x5c67db){return _0x44f2b3[_0x6c1b('0x17')](_0x10edd4);}return _0x44f2b3['status'](_0x10edd4)[_0x6c1b('0x18')]();};}function respondWithResult(_0xd7d7c6,_0x2555a3){_0x2555a3=_0x2555a3||0xc8;return function(_0x6d842e){if(_0x6d842e){return _0xd7d7c6[_0x6c1b('0x19')](_0x2555a3)[_0x6c1b('0x1a')](_0x6d842e);}};}function respondWithFilteredResult(_0x1a3727,_0x41176d){return function(_0x2adba4){if(_0x2adba4){var _0x208d6c=typeof _0x41176d[_0x6c1b('0x1b')]==='undefined'&&typeof _0x41176d['limit']===_0x6c1b('0x1c');var _0x5f0c87=_0x2adba4[_0x6c1b('0x1d')];var _0x5b8d4e=_0x208d6c?0x0:_0x41176d[_0x6c1b('0x1b')];var _0x3cd8f5=_0x208d6c?_0x2adba4[_0x6c1b('0x1d')]:_0x41176d['offset']+_0x41176d[_0x6c1b('0x1e')];var _0x18c3fc;if(_0x3cd8f5>=_0x5f0c87){_0x3cd8f5=_0x5f0c87;_0x18c3fc=0xc8;}else{_0x18c3fc=0xce;}_0x1a3727[_0x6c1b('0x19')](_0x18c3fc);return _0x1a3727[_0x6c1b('0x1f')](_0x6c1b('0x20'),_0x5b8d4e+'-'+_0x3cd8f5+'/'+_0x5f0c87)[_0x6c1b('0x1a')](_0x2adba4);}return null;};}function patchUpdates(_0x53a966){return function(_0x8fdd67){try{jsonpatch[_0x6c1b('0x21')](_0x8fdd67,_0x53a966,!![]);}catch(_0x282d4e){return BPromise[_0x6c1b('0x22')](_0x282d4e);}return _0x8fdd67[_0x6c1b('0x23')]();};}function saveUpdates(_0x430172,_0x43df6d){return function(_0x47100b){if(_0x47100b){return _0x47100b[_0x6c1b('0x24')](_0x430172)[_0x6c1b('0x25')](function(_0xa367a0){return _0xa367a0;});}return null;};}function removeEntity(_0x906d24,_0x286dc3){return function(_0x188dca){if(_0x188dca){return _0x188dca['destroy']()['then'](function(){_0x906d24[_0x6c1b('0x19')](0xcc)[_0x6c1b('0x18')]();});}};}function handleEntityNotFound(_0x3d3663,_0x4f230d){return function(_0x7152f){if(!_0x7152f){_0x3d3663[_0x6c1b('0x17')](0x194);}return _0x7152f;};}function handleError(_0x119c15,_0x719b37){_0x719b37=_0x719b37||0x1f4;return function(_0x2a4c2e){logger[_0x6c1b('0x26')](_0x2a4c2e['stack']);if(_0x2a4c2e[_0x6c1b('0x27')]){delete _0x2a4c2e[_0x6c1b('0x27')];}_0x119c15['status'](_0x719b37)['send'](_0x2a4c2e);};}exports[_0x6c1b('0x28')]=function(_0x5ed1ff,_0x2bca99){var _0x43d437={},_0xd45a72={},_0x186649={'count':0x0,'rows':[]};var _0x260e42=_[_0x6c1b('0x29')](db['FreshsalesConfiguration'][_0x6c1b('0x2a')],function(_0x55a02c){return{'name':_0x55a02c['fieldName'],'type':_0x55a02c[_0x6c1b('0x2b')][_0x6c1b('0x2c')]};});_0xd45a72[_0x6c1b('0x2d')]=_['map'](_0x260e42,'name');_0xd45a72['query']=_[_0x6c1b('0x2e')](_0x5ed1ff[_0x6c1b('0x2f')]);_0xd45a72[_0x6c1b('0x30')]=_['intersection'](_0xd45a72[_0x6c1b('0x2d')],_0xd45a72['query']);_0x43d437[_0x6c1b('0x31')]=_[_0x6c1b('0x32')](_0xd45a72[_0x6c1b('0x2d')],qs['fields'](_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x33')]));_0x43d437[_0x6c1b('0x31')]=_0x43d437[_0x6c1b('0x31')][_0x6c1b('0x34')]?_0x43d437['attributes']:_0xd45a72[_0x6c1b('0x2d')];if(!_0x5ed1ff['query'][_0x6c1b('0x35')](_0x6c1b('0x36'))){_0x43d437[_0x6c1b('0x1e')]=qs[_0x6c1b('0x1e')](_0x5ed1ff['query']['limit']);_0x43d437[_0x6c1b('0x1b')]=qs['offset'](_0x5ed1ff['query'][_0x6c1b('0x1b')]);}_0x43d437[_0x6c1b('0x37')]=qs[_0x6c1b('0x38')](_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x38')]);_0x43d437[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_[_0x6c1b('0x3a')](_0x5ed1ff['query'],_0xd45a72['filters']),_0x260e42);if(_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x3b')]){_0x43d437[_0x6c1b('0x39')]=_['merge'](_0x43d437['where'],{'$or':_['map'](_0x260e42,function(_0x13d325){if(_0x13d325['type']!=='VIRTUAL'){var _0x801b2b={};_0x801b2b[_0x13d325[_0x6c1b('0x27')]]={'$like':'%'+_0x5ed1ff[_0x6c1b('0x2f')][_0x6c1b('0x3b')]+'%'};return _0x801b2b;}})});}_0x43d437=_[_0x6c1b('0x3c')]({},_0x43d437,_0x5ed1ff[_0x6c1b('0x3d')]);var _0x4136ef={'where':_0x43d437[_0x6c1b('0x39')]};return db[_0x6c1b('0x3e')][_0x6c1b('0x1d')](_0x4136ef)['then'](function(_0x2bd5a1){_0x186649[_0x6c1b('0x1d')]=_0x2bd5a1;if(_0x5ed1ff[_0x6c1b('0x2f')]['includeAll']){_0x43d437[_0x6c1b('0x3f')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0x6c1b('0x40')](_0x43d437);})['then'](function(_0xed80de){_0x186649[_0x6c1b('0x41')]=_0xed80de;return _0x186649;})[_0x6c1b('0x25')](respondWithFilteredResult(_0x2bca99,_0x43d437))[_0x6c1b('0x42')](handleError(_0x2bca99,null));};exports[_0x6c1b('0x43')]=function(_0x476775,_0x5a1ac){var _0x462dcc={'raw':![],'where':{'id':_0x476775['params']['id']}},_0xc3aa04={};_0xc3aa04['model']=_[_0x6c1b('0x2e')](db[_0x6c1b('0x3e')][_0x6c1b('0x2a')]);_0xc3aa04[_0x6c1b('0x2f')]=_['keys'](_0x476775[_0x6c1b('0x2f')]);_0xc3aa04['filters']=_['intersection'](_0xc3aa04[_0x6c1b('0x2d')],_0xc3aa04['query']);_0x462dcc['attributes']=_[_0x6c1b('0x32')](_0xc3aa04[_0x6c1b('0x2d')],qs[_0x6c1b('0x33')](_0x476775[_0x6c1b('0x2f')]['fields']));_0x462dcc[_0x6c1b('0x31')]=_0x462dcc[_0x6c1b('0x31')]['length']?_0x462dcc[_0x6c1b('0x31')]:_0xc3aa04['model'];if(_0x476775[_0x6c1b('0x2f')][_0x6c1b('0x44')]){_0x462dcc['include']=[{'all':!![]}];}_0x462dcc=_['merge']({},_0x462dcc,_0x476775[_0x6c1b('0x3d')]);return db[_0x6c1b('0x3e')][_0x6c1b('0x45')](_0x462dcc)[_0x6c1b('0x25')](handleEntityNotFound(_0x5a1ac,null))[_0x6c1b('0x25')](respondWithResult(_0x5a1ac,null))[_0x6c1b('0x42')](handleError(_0x5a1ac,null));};exports[_0x6c1b('0x46')]=function(_0x1fcd8c,_0x5f2642){return db[_0x6c1b('0x3e')][_0x6c1b('0x46')](_0x1fcd8c[_0x6c1b('0x47')],{})[_0x6c1b('0x25')](respondWithResult(_0x5f2642,0xc9))['catch'](handleError(_0x5f2642,null));};exports[_0x6c1b('0x24')]=function(_0x4a66f5,_0x48e756){if(_0x4a66f5[_0x6c1b('0x47')]['id']){delete _0x4a66f5[_0x6c1b('0x47')]['id'];}return db[_0x6c1b('0x3e')][_0x6c1b('0x45')]({'where':{'id':_0x4a66f5['params']['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x48e756,null))[_0x6c1b('0x25')](saveUpdates(_0x4a66f5[_0x6c1b('0x47')],null))[_0x6c1b('0x25')](respondWithResult(_0x48e756,null))[_0x6c1b('0x42')](handleError(_0x48e756,null));};exports['destroy']=function(_0x1f5d6d,_0x1c1749){return db[_0x6c1b('0x3e')][_0x6c1b('0x45')]({'where':{'id':_0x1f5d6d[_0x6c1b('0x48')]['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x1c1749,null))[_0x6c1b('0x25')](removeEntity(_0x1c1749,null))[_0x6c1b('0x42')](handleError(_0x1c1749,null));};exports[_0x6c1b('0x49')]=function(_0x64dc52,_0x2331c6,_0x26aa76){var _0xc5662e={};var _0x27ff27={};var _0x19f0d4;var _0x5bb44b;return db[_0x6c1b('0x3e')]['findOne']({'where':{'id':_0x64dc52['params']['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x2331c6,null))[_0x6c1b('0x25')](function(_0x24a3bc){if(_0x24a3bc){_0x19f0d4=_0x24a3bc;_0x27ff27[_0x6c1b('0x2d')]=_[_0x6c1b('0x2e')](db[_0x6c1b('0x4a')][_0x6c1b('0x2a')]);_0x27ff27[_0x6c1b('0x2f')]=_['keys'](_0x64dc52['query']);_0x27ff27[_0x6c1b('0x30')]=_[_0x6c1b('0x32')](_0x27ff27[_0x6c1b('0x2d')],_0x27ff27[_0x6c1b('0x2f')]);_0xc5662e[_0x6c1b('0x31')]=_[_0x6c1b('0x32')](_0x27ff27[_0x6c1b('0x2d')],qs[_0x6c1b('0x33')](_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x33')]));_0xc5662e['attributes']=_0xc5662e[_0x6c1b('0x31')][_0x6c1b('0x34')]?_0xc5662e[_0x6c1b('0x31')]:_0x27ff27['model'];_0xc5662e[_0x6c1b('0x37')]=qs['sort'](_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x38')]);_0xc5662e[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_[_0x6c1b('0x3a')](_0x64dc52[_0x6c1b('0x2f')],_0x27ff27[_0x6c1b('0x30')]));if(_0x64dc52[_0x6c1b('0x2f')]['filter']){_0xc5662e[_0x6c1b('0x39')]=_[_0x6c1b('0x3c')](_0xc5662e[_0x6c1b('0x39')],{'$or':_[_0x6c1b('0x29')](_0xc5662e[_0x6c1b('0x31')],function(_0x27eb3c){var _0x2c608a={};_0x2c608a[_0x27eb3c]={'$like':'%'+_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x3b')]+'%'};return _0x2c608a;})});}_0xc5662e=_[_0x6c1b('0x3c')]({},_0xc5662e,_0x64dc52[_0x6c1b('0x3d')]);return _0x19f0d4[_0x6c1b('0x49')](_0xc5662e);}})[_0x6c1b('0x25')](function(_0x43ac12){if(_0x43ac12){_0x5bb44b=_0x43ac12['length'];if(!_0x64dc52['query']['hasOwnProperty'](_0x6c1b('0x36'))){_0xc5662e[_0x6c1b('0x1e')]=qs[_0x6c1b('0x1e')](_0x64dc52[_0x6c1b('0x2f')][_0x6c1b('0x1e')]);_0xc5662e[_0x6c1b('0x1b')]=qs['offset'](_0x64dc52[_0x6c1b('0x2f')]['offset']);}return _0x19f0d4[_0x6c1b('0x49')](_0xc5662e);}})['then'](function(_0x1b5b4b){if(_0x1b5b4b){return _0x1b5b4b?{'count':_0x5bb44b,'rows':_0x1b5b4b}:null;}})['then'](respondWithResult(_0x2331c6,null))[_0x6c1b('0x42')](handleError(_0x2331c6,null));};exports[_0x6c1b('0x4b')]=function(_0x38f013,_0x35e845,_0xe50445){var _0xa56488={};var _0x1e6737={};var _0x51f603;var _0x416924;return db[_0x6c1b('0x3e')][_0x6c1b('0x4c')]({'where':{'id':_0x38f013[_0x6c1b('0x48')]['id']}})[_0x6c1b('0x25')](handleEntityNotFound(_0x35e845,null))[_0x6c1b('0x25')](function(_0x1abee2){if(_0x1abee2){_0x51f603=_0x1abee2;_0x1e6737[_0x6c1b('0x2d')]=_[_0x6c1b('0x2e')](db['FreshsalesField'][_0x6c1b('0x2a')]);_0x1e6737[_0x6c1b('0x2f')]=_['keys'](_0x38f013[_0x6c1b('0x2f')]);_0x1e6737[_0x6c1b('0x30')]=_[_0x6c1b('0x32')](_0x1e6737[_0x6c1b('0x2d')],_0x1e6737[_0x6c1b('0x2f')]);_0xa56488[_0x6c1b('0x31')]=_['intersection'](_0x1e6737[_0x6c1b('0x2d')],qs[_0x6c1b('0x33')](_0x38f013[_0x6c1b('0x2f')][_0x6c1b('0x33')]));_0xa56488['attributes']=_0xa56488['attributes']['length']?_0xa56488[_0x6c1b('0x31')]:_0x1e6737[_0x6c1b('0x2d')];_0xa56488['order']=qs[_0x6c1b('0x38')](_0x38f013['query'][_0x6c1b('0x38')]);_0xa56488[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_[_0x6c1b('0x3a')](_0x38f013[_0x6c1b('0x2f')],_0x1e6737[_0x6c1b('0x30')]));if(_0x38f013[_0x6c1b('0x2f')][_0x6c1b('0x3b')]){_0xa56488[_0x6c1b('0x39')]=_[_0x6c1b('0x3c')](_0xa56488[_0x6c1b('0x39')],{'$or':_[_0x6c1b('0x29')](_0xa56488[_0x6c1b('0x31')],function(_0x1597d6){var _0x4401b7={};_0x4401b7[_0x1597d6]={'$like':'%'+_0x38f013[_0x6c1b('0x2f')][_0x6c1b('0x3b')]+'%'};return _0x4401b7;})});}_0xa56488=_[_0x6c1b('0x3c')]({},_0xa56488,_0x38f013[_0x6c1b('0x3d')]);return _0x51f603['getDescriptions'](_0xa56488);}})[_0x6c1b('0x25')](function(_0x450f1f){if(_0x450f1f){_0x416924=_0x450f1f['length'];if(!_0x38f013['query'][_0x6c1b('0x35')]('nolimit')){_0xa56488[_0x6c1b('0x1e')]=qs['limit'](_0x38f013[_0x6c1b('0x2f')]['limit']);_0xa56488[_0x6c1b('0x1b')]=qs[_0x6c1b('0x1b')](_0x38f013['query'][_0x6c1b('0x1b')]);}return _0x51f603[_0x6c1b('0x4b')](_0xa56488);}})['then'](function(_0x5aa980){if(_0x5aa980){return _0x5aa980?{'count':_0x416924,'rows':_0x5aa980}:null;}})[_0x6c1b('0x25')](respondWithResult(_0x35e845,null))[_0x6c1b('0x42')](handleError(_0x35e845,null));};exports['getFields']=function(_0x738299,_0x5cf436,_0x286093){var _0x59b777={};var _0x257704={};var _0x2ab410;var _0x59e34e;return db[_0x6c1b('0x3e')][_0x6c1b('0x4c')]({'where':{'id':_0x738299[_0x6c1b('0x48')]['id']}})['then'](handleEntityNotFound(_0x5cf436,null))[_0x6c1b('0x25')](function(_0x578740){if(_0x578740){_0x2ab410=_0x578740;_0x257704['model']=_[_0x6c1b('0x2e')](db[_0x6c1b('0x4a')][_0x6c1b('0x2a')]);_0x257704['query']=_[_0x6c1b('0x2e')](_0x738299[_0x6c1b('0x2f')]);_0x257704['filters']=_[_0x6c1b('0x32')](_0x257704[_0x6c1b('0x2d')],_0x257704['query']);_0x59b777[_0x6c1b('0x31')]=_[_0x6c1b('0x32')](_0x257704['model'],qs[_0x6c1b('0x33')](_0x738299['query'][_0x6c1b('0x33')]));_0x59b777[_0x6c1b('0x31')]=_0x59b777['attributes'][_0x6c1b('0x34')]?_0x59b777[_0x6c1b('0x31')]:_0x257704[_0x6c1b('0x2d')];_0x59b777[_0x6c1b('0x37')]=qs[_0x6c1b('0x38')](_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x38')]);_0x59b777[_0x6c1b('0x39')]=qs[_0x6c1b('0x30')](_['pick'](_0x738299[_0x6c1b('0x2f')],_0x257704[_0x6c1b('0x30')]));if(_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x3b')]){_0x59b777[_0x6c1b('0x39')]=_[_0x6c1b('0x3c')](_0x59b777[_0x6c1b('0x39')],{'$or':_[_0x6c1b('0x29')](_0x59b777[_0x6c1b('0x31')],function(_0x46f107){var _0x41918e={};_0x41918e[_0x46f107]={'$like':'%'+_0x738299['query']['filter']+'%'};return _0x41918e;})});}_0x59b777=_['merge']({},_0x59b777,_0x738299['options']);return _0x2ab410['getFields'](_0x59b777);}})[_0x6c1b('0x25')](function(_0x501246){if(_0x501246){_0x59e34e=_0x501246[_0x6c1b('0x34')];if(!_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x35')](_0x6c1b('0x36'))){_0x59b777['limit']=qs['limit'](_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x1e')]);_0x59b777[_0x6c1b('0x1b')]=qs[_0x6c1b('0x1b')](_0x738299[_0x6c1b('0x2f')][_0x6c1b('0x1b')]);}return _0x2ab410[_0x6c1b('0x4d')](_0x59b777);}})[_0x6c1b('0x25')](function(_0x4b7d56){if(_0x4b7d56){return _0x4b7d56?{'count':_0x59e34e,'rows':_0x4b7d56}:null;}})['then'](respondWithResult(_0x5cf436,null))[_0x6c1b('0x42')](handleError(_0x5cf436,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 2f0e8f4..7158d9e 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 _0x673d=['util','../../config/logger','api','moment','bluebird','request-promise','path','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x2df91c,_0xf6b383){var _0xef633f=function(_0x4149d0){while(--_0x4149d0){_0x2df91c['push'](_0x2df91c['shift']());}};_0xef633f(++_0xf6b383);}(_0x673d,0x12c));var _0xd673=function(_0x1bf89a,_0x2a2949){_0x1bf89a=_0x1bf89a-0x0;var _0x198910=_0x673d[_0x1bf89a];return _0x198910;};'use strict';var _=require('lodash');var util=require(_0xd673('0x0'));var logger=require(_0xd673('0x1'))(_0xd673('0x2'));var moment=require(_0xd673('0x3'));var BPromise=require(_0xd673('0x4'));var rp=require(_0xd673('0x5'));var fs=require('fs');var path=require(_0xd673('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd673('0x7'));module[_0xd673('0x8')]=function(_0x1e69dd,_0x3c9974){return _0x1e69dd[_0xd673('0x9')](_0xd673('0xa'),attributes,{'tableName':_0xd673('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe4e0=['api','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xe4e0,0xa5));var _0x0e4e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xe4e0[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0e4e('0x0'));var util=require(_0x0e4e('0x1'));var logger=require(_0x0e4e('0x2'))(_0x0e4e('0x3'));var moment=require(_0x0e4e('0x4'));var BPromise=require(_0x0e4e('0x5'));var rp=require(_0x0e4e('0x6'));var fs=require('fs');var path=require(_0x0e4e('0x7'));var rimraf=require('rimraf');var config=require(_0x0e4e('0x8'));var attributes=require(_0x0e4e('0x9'));module['exports']=function(_0x3cf573,_0x2685e6){return _0x3cf573[_0x0e4e('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0x0e4e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 6d521c9..4f64544 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 _0x5223=['FreshsalesConfiguration,\x20%s,\x20%s','message','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x448f82,_0x4fb566){var _0x51bd20=function(_0x19d3a6){while(--_0x19d3a6){_0x448f82['push'](_0x448f82['shift']());}};_0x51bd20(++_0x4fb566);}(_0x5223,0x11f));var _0x3522=function(_0x253f19,_0x23f267){_0x253f19=_0x253f19-0x0;var _0x486b95=_0x5223[_0x253f19];return _0x486b95;};'use strict';var _=require('lodash');var util=require(_0x3522('0x0'));var moment=require(_0x3522('0x1'));var BPromise=require(_0x3522('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3522('0x3'));var db=require(_0x3522('0x4'))['db'];var utils=require(_0x3522('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3522('0x6'));var jayson=require(_0x3522('0x7'));var client=jayson[_0x3522('0x8')][_0x3522('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52e55f,_0x5e5ec1,_0x385d37){return new BPromise(function(_0x45cce3,_0x410733){return client[_0x3522('0xa')](_0x52e55f,_0x385d37)['then'](function(_0x269c41){logger[_0x3522('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x5e5ec1,_0x3522('0xc'));logger['debug'](_0x3522('0xd'),_0x5e5ec1,_0x3522('0xc'),JSON[_0x3522('0xe')](_0x269c41));if(_0x269c41[_0x3522('0xf')]){if(_0x269c41['error'][_0x3522('0x10')]===0x1f4){logger[_0x3522('0xf')](_0x3522('0x11'),_0x5e5ec1,_0x269c41[_0x3522('0xf')][_0x3522('0x12')]);return _0x410733(_0x269c41[_0x3522('0xf')][_0x3522('0x12')]);}logger[_0x3522('0xf')](_0x3522('0x11'),_0x5e5ec1,_0x269c41[_0x3522('0xf')][_0x3522('0x12')]);return _0x45cce3(_0x269c41['error']['message']);}else{logger[_0x3522('0xb')](_0x3522('0x11'),_0x5e5ec1,_0x3522('0xc'));_0x45cce3(_0x269c41['result'][_0x3522('0x12')]);}})['catch'](function(_0x1d2bf1){logger[_0x3522('0xf')](_0x3522('0x11'),_0x5e5ec1,_0x1d2bf1);_0x410733(_0x1d2bf1);});});} \ No newline at end of file +var _0xae46=['request','info','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x34a281,_0xce2d5a){var _0x42a062=function(_0x6cb5bf){while(--_0x6cb5bf){_0x34a281['push'](_0x34a281['shift']());}};_0x42a062(++_0xce2d5a);}(_0xae46,0xbe));var _0x6ae4=function(_0x4fed8b,_0x490bd1){_0x4fed8b=_0x4fed8b-0x0;var _0x343d09=_0xae46[_0x4fed8b];return _0x343d09;};'use strict';var _=require('lodash');var util=require(_0x6ae4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6ae4('0x1'));var fs=require('fs');var Redis=require(_0x6ae4('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x6ae4('0x3'));var logger=require(_0x6ae4('0x4'))(_0x6ae4('0x5'));var config=require(_0x6ae4('0x6'));var jayson=require(_0x6ae4('0x7'));var client=jayson[_0x6ae4('0x8')][_0x6ae4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f135e,_0x26af5f,_0x6195ce){return new BPromise(function(_0x39c0b1,_0x4bd13a){return client[_0x6ae4('0xa')](_0x2f135e,_0x6195ce)['then'](function(_0x11431d){logger[_0x6ae4('0xb')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x26af5f,_0x6ae4('0xc'));logger[_0x6ae4('0xd')](_0x6ae4('0xe'),_0x26af5f,_0x6ae4('0xc'),JSON['stringify'](_0x11431d));if(_0x11431d['error']){if(_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x10')]===0x1f4){logger[_0x6ae4('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x26af5f,_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x11')]);return _0x4bd13a(_0x11431d['error'][_0x6ae4('0x11')]);}logger['error'](_0x6ae4('0x12'),_0x26af5f,_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x11')]);return _0x39c0b1(_0x11431d[_0x6ae4('0xf')][_0x6ae4('0x11')]);}else{logger[_0x6ae4('0xb')](_0x6ae4('0x12'),_0x26af5f,'request\x20sent');_0x39c0b1(_0x11431d[_0x6ae4('0x13')]['message']);}})['catch'](function(_0x1017ab){logger[_0x6ae4('0xf')](_0x6ae4('0x12'),_0x26af5f,_0x1017ab);_0x4bd13a(_0x1017ab);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 160d1f7..400a64c 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 _0xb31a=['update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post','create','put','/:id'];(function(_0x3d391b,_0x139db6){var _0x34adb6=function(_0x464b1e){while(--_0x464b1e){_0x3d391b['push'](_0x3d391b['shift']());}};_0x34adb6(++_0x139db6);}(_0xb31a,0xd4));var _0xab31=function(_0x4ad896,_0x5cd4b9){_0x4ad896=_0x4ad896-0x0;var _0x53e943=_0xb31a[_0x4ad896];return _0x53e943;};'use strict';var multer=require(_0xab31('0x0'));var util=require(_0xab31('0x1'));var path=require(_0xab31('0x2'));var timeout=require(_0xab31('0x3'));var express=require(_0xab31('0x4'));var router=express[_0xab31('0x5')]();var fs_extra=require(_0xab31('0x6'));var auth=require(_0xab31('0x7'));var interaction=require(_0xab31('0x8'));var config=require(_0xab31('0x9'));var controller=require(_0xab31('0xa'));router[_0xab31('0xb')]('/',auth[_0xab31('0xc')](),controller[_0xab31('0xd')]);router[_0xab31('0xb')]('/:id',auth[_0xab31('0xc')](),controller[_0xab31('0xe')]);router[_0xab31('0xf')]('/',auth[_0xab31('0xc')](),controller[_0xab31('0x10')]);router[_0xab31('0x11')](_0xab31('0x12'),auth[_0xab31('0xc')](),controller[_0xab31('0x13')]);router['delete']('/:id',auth[_0xab31('0xc')](),controller[_0xab31('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3a25=['get','isAuthenticated','index','post','create','put','/:id','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller'];(function(_0xd591a2,_0x595561){var _0x63ff46=function(_0xddcca0){while(--_0xddcca0){_0xd591a2['push'](_0xd591a2['shift']());}};_0x63ff46(++_0x595561);}(_0x3a25,0x15d));var _0x53a2=function(_0x4c74b3,_0x4def82){_0x4c74b3=_0x4c74b3-0x0;var _0x488539=_0x3a25[_0x4c74b3];return _0x488539;};'use strict';var multer=require(_0x53a2('0x0'));var util=require(_0x53a2('0x1'));var path=require(_0x53a2('0x2'));var timeout=require(_0x53a2('0x3'));var express=require(_0x53a2('0x4'));var router=express[_0x53a2('0x5')]();var fs_extra=require(_0x53a2('0x6'));var auth=require(_0x53a2('0x7'));var interaction=require(_0x53a2('0x8'));var config=require(_0x53a2('0x9'));var controller=require(_0x53a2('0xa'));router[_0x53a2('0xb')]('/',auth[_0x53a2('0xc')](),controller[_0x53a2('0xd')]);router[_0x53a2('0xb')]('/:id',auth[_0x53a2('0xc')](),controller['show']);router[_0x53a2('0xe')]('/',auth[_0x53a2('0xc')](),controller[_0x53a2('0xf')]);router[_0x53a2('0x10')](_0x53a2('0x11'),auth[_0x53a2('0xc')](),controller[_0x53a2('0x12')]);router[_0x53a2('0x13')](_0x53a2('0x11'),auth[_0x53a2('0xc')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index e7385b1..a618057 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 _0xb8b3=['BOOLEAN','sequelize','string','customVariable','keyValue','picklist','STRING','ENUM','variable'];(function(_0x3da312,_0x391ccd){var _0x28fb08=function(_0x1792bf){while(--_0x1792bf){_0x3da312['push'](_0x3da312['shift']());}};_0x28fb08(++_0x391ccd);}(_0xb8b3,0x1e7));var _0x3b8b=function(_0x3ab928,_0x2b990b){_0x3ab928=_0x3ab928-0x0;var _0xf47692=_0xb8b3[_0x3ab928];return _0xf47692;};'use strict';var Sequelize=require(_0x3b8b('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x3b8b('0x1'),'variable',_0x3b8b('0x2'),_0x3b8b('0x3'),_0x3b8b('0x4')),'defaultValue':_0x3b8b('0x1')},'content':{'type':Sequelize[_0x3b8b('0x5')]},'key':{'type':Sequelize[_0x3b8b('0x5')]},'keyType':{'type':Sequelize[_0x3b8b('0x6')](_0x3b8b('0x1'),_0x3b8b('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x3b8b('0x5')]},'idField':{'type':Sequelize[_0x3b8b('0x5')]},'nameField':{'type':Sequelize[_0x3b8b('0x5')]},'customField':{'type':Sequelize[_0x3b8b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3b8b('0x5')]}}; \ No newline at end of file +var _0x76e1=['exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN','sequelize'];(function(_0x373b6e,_0x8e7aa2){var _0x50f8cc=function(_0x2d8fb7){while(--_0x2d8fb7){_0x373b6e['push'](_0x373b6e['shift']());}};_0x50f8cc(++_0x8e7aa2);}(_0x76e1,0xc7));var _0x176e=function(_0x13e8e5,_0x1db23c){_0x13e8e5=_0x13e8e5-0x0;var _0x59acfb=_0x76e1[_0x13e8e5];return _0x59acfb;};'use strict';var Sequelize=require(_0x176e('0x0'));module[_0x176e('0x1')]={'type':{'type':Sequelize[_0x176e('0x2')](_0x176e('0x3'),'variable',_0x176e('0x4'),_0x176e('0x5'),_0x176e('0x6')),'defaultValue':_0x176e('0x3')},'content':{'type':Sequelize[_0x176e('0x7')]},'key':{'type':Sequelize[_0x176e('0x7')]},'keyType':{'type':Sequelize[_0x176e('0x2')](_0x176e('0x3'),_0x176e('0x8'),_0x176e('0x4'))},'keyContent':{'type':Sequelize[_0x176e('0x7')]},'idField':{'type':Sequelize[_0x176e('0x7')]},'nameField':{'type':Sequelize[_0x176e('0x7')]},'customField':{'type':Sequelize[_0x176e('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x176e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 0cfa18d..633f872 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 _0x72d2=['order','where','type','VIRTUAL','filter','merge','options','FreshsalesField','includeAll','include','findAll','catch','show','params','create','body','find','destroy','eml-format','moment','mustache','path','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','name','index','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x560fdb,_0xe678c1){var _0x18ef38=function(_0x1c7361){while(--_0x1c7361){_0x560fdb['push'](_0x560fdb['shift']());}};_0x18ef38(++_0xe678c1);}(_0x72d2,0xcf));var _0x272d=function(_0x126fb9,_0x122c59){_0x126fb9=_0x126fb9-0x0;var _0xc8a3b1=_0x72d2[_0x126fb9];return _0xc8a3b1;};'use strict';var emlformat=require(_0x272d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x272d('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x272d('0x2'));var util=require('util');var path=require(_0x272d('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x272d('0x4'));var _=require(_0x272d('0x5'));var squel=require(_0x272d('0x6'));var crypto=require(_0x272d('0x7'));var jsforce=require(_0x272d('0x8'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x272d('0x9'));var Redis=require('ioredis');var authService=require(_0x272d('0xa'));var qs=require(_0x272d('0xb'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x272d('0xc'))('api');var utils=require(_0x272d('0xd'));var config=require(_0x272d('0xe'));var licenseUtil=require(_0x272d('0xf'));var db=require(_0x272d('0x10'))['db'];function respondWithStatusCode(_0x18921b,_0x1f1a82){_0x1f1a82=_0x1f1a82||0xcc;return function(_0x1e7e1d){if(_0x1e7e1d){return _0x18921b[_0x272d('0x11')](_0x1f1a82);}return _0x18921b[_0x272d('0x12')](_0x1f1a82)[_0x272d('0x13')]();};}function respondWithResult(_0x2334ce,_0x57e6ef){_0x57e6ef=_0x57e6ef||0xc8;return function(_0x333b59){if(_0x333b59){return _0x2334ce[_0x272d('0x12')](_0x57e6ef)[_0x272d('0x14')](_0x333b59);}};}function respondWithFilteredResult(_0x3cc5e8,_0x223f46){return function(_0x35aa31){if(_0x35aa31){var _0x2be872=typeof _0x223f46[_0x272d('0x15')]===_0x272d('0x16')&&typeof _0x223f46[_0x272d('0x17')]===_0x272d('0x16');var _0x24a29c=_0x35aa31[_0x272d('0x18')];var _0x10660b=_0x2be872?0x0:_0x223f46[_0x272d('0x15')];var _0x23c15=_0x2be872?_0x35aa31[_0x272d('0x18')]:_0x223f46[_0x272d('0x15')]+_0x223f46[_0x272d('0x17')];var _0x3370eb;if(_0x23c15>=_0x24a29c){_0x23c15=_0x24a29c;_0x3370eb=0xc8;}else{_0x3370eb=0xce;}_0x3cc5e8[_0x272d('0x12')](_0x3370eb);return _0x3cc5e8[_0x272d('0x19')]('Content-Range',_0x10660b+'-'+_0x23c15+'/'+_0x24a29c)[_0x272d('0x14')](_0x35aa31);}return null;};}function patchUpdates(_0x2ff92d){return function(_0x2d3e78){try{jsonpatch[_0x272d('0x1a')](_0x2d3e78,_0x2ff92d,!![]);}catch(_0x4fe644){return BPromise[_0x272d('0x1b')](_0x4fe644);}return _0x2d3e78[_0x272d('0x1c')]();};}function saveUpdates(_0x23dc71,_0x7688e8){return function(_0x355cc0){if(_0x355cc0){return _0x355cc0[_0x272d('0x1d')](_0x23dc71)[_0x272d('0x1e')](function(_0x4dcec9){return _0x4dcec9;});}return null;};}function removeEntity(_0x23f039,_0x1bb43d){return function(_0x1ff675){if(_0x1ff675){return _0x1ff675['destroy']()[_0x272d('0x1e')](function(){_0x23f039[_0x272d('0x12')](0xcc)[_0x272d('0x13')]();});}};}function handleEntityNotFound(_0x3eca14,_0x313c42){return function(_0x2bca3c){if(!_0x2bca3c){_0x3eca14[_0x272d('0x11')](0x194);}return _0x2bca3c;};}function handleError(_0x432314,_0x4d8267){_0x4d8267=_0x4d8267||0x1f4;return function(_0x47d9c4){logger[_0x272d('0x1f')](_0x47d9c4['stack']);if(_0x47d9c4[_0x272d('0x20')]){delete _0x47d9c4[_0x272d('0x20')];}_0x432314['status'](_0x4d8267)['send'](_0x47d9c4);};}exports[_0x272d('0x21')]=function(_0x39636b,_0x9b494d){var _0x6ec6fe={},_0x166c7c={},_0x52eac9={'count':0x0,'rows':[]};var _0x5b1b3f=_['map'](db['FreshsalesField']['rawAttributes'],function(_0x5dc8bf){return{'name':_0x5dc8bf['fieldName'],'type':_0x5dc8bf['type']['key']};});_0x166c7c[_0x272d('0x22')]=_[_0x272d('0x23')](_0x5b1b3f,'name');_0x166c7c[_0x272d('0x24')]=_[_0x272d('0x25')](_0x39636b[_0x272d('0x24')]);_0x166c7c[_0x272d('0x26')]=_[_0x272d('0x27')](_0x166c7c[_0x272d('0x22')],_0x166c7c[_0x272d('0x24')]);_0x6ec6fe[_0x272d('0x28')]=_['intersection'](_0x166c7c['model'],qs[_0x272d('0x29')](_0x39636b[_0x272d('0x24')][_0x272d('0x29')]));_0x6ec6fe[_0x272d('0x28')]=_0x6ec6fe[_0x272d('0x28')][_0x272d('0x2a')]?_0x6ec6fe[_0x272d('0x28')]:_0x166c7c[_0x272d('0x22')];if(!_0x39636b[_0x272d('0x24')][_0x272d('0x2b')](_0x272d('0x2c'))){_0x6ec6fe[_0x272d('0x17')]=qs['limit'](_0x39636b['query'][_0x272d('0x17')]);_0x6ec6fe[_0x272d('0x15')]=qs[_0x272d('0x15')](_0x39636b[_0x272d('0x24')][_0x272d('0x15')]);}_0x6ec6fe[_0x272d('0x2d')]=qs['sort'](_0x39636b[_0x272d('0x24')]['sort']);_0x6ec6fe[_0x272d('0x2e')]=qs[_0x272d('0x26')](_['pick'](_0x39636b[_0x272d('0x24')],_0x166c7c[_0x272d('0x26')]),_0x5b1b3f);if(_0x39636b['query']['filter']){_0x6ec6fe[_0x272d('0x2e')]=_['merge'](_0x6ec6fe['where'],{'$or':_['map'](_0x5b1b3f,function(_0x3957f6){if(_0x3957f6[_0x272d('0x2f')]!==_0x272d('0x30')){var _0x3edb08={};_0x3edb08[_0x3957f6['name']]={'$like':'%'+_0x39636b['query'][_0x272d('0x31')]+'%'};return _0x3edb08;}})});}_0x6ec6fe=_[_0x272d('0x32')]({},_0x6ec6fe,_0x39636b[_0x272d('0x33')]);var _0x4e0a2c={'where':_0x6ec6fe[_0x272d('0x2e')]};return db[_0x272d('0x34')][_0x272d('0x18')](_0x4e0a2c)['then'](function(_0x1ef890){_0x52eac9['count']=_0x1ef890;if(_0x39636b[_0x272d('0x24')][_0x272d('0x35')]){_0x6ec6fe[_0x272d('0x36')]=[{'all':!![]}];}return db['FreshsalesField'][_0x272d('0x37')](_0x6ec6fe);})['then'](function(_0x525e76){_0x52eac9['rows']=_0x525e76;return _0x52eac9;})[_0x272d('0x1e')](respondWithFilteredResult(_0x9b494d,_0x6ec6fe))[_0x272d('0x38')](handleError(_0x9b494d,null));};exports[_0x272d('0x39')]=function(_0x39d7d5,_0x5ed508){var _0x5af5d8={'raw':!![],'where':{'id':_0x39d7d5[_0x272d('0x3a')]['id']}},_0x3dbaf7={};_0x3dbaf7['model']=_[_0x272d('0x25')](db[_0x272d('0x34')]['rawAttributes']);_0x3dbaf7['query']=_[_0x272d('0x25')](_0x39d7d5[_0x272d('0x24')]);_0x3dbaf7[_0x272d('0x26')]=_[_0x272d('0x27')](_0x3dbaf7[_0x272d('0x22')],_0x3dbaf7[_0x272d('0x24')]);_0x5af5d8[_0x272d('0x28')]=_['intersection'](_0x3dbaf7['model'],qs[_0x272d('0x29')](_0x39d7d5[_0x272d('0x24')][_0x272d('0x29')]));_0x5af5d8[_0x272d('0x28')]=_0x5af5d8[_0x272d('0x28')][_0x272d('0x2a')]?_0x5af5d8[_0x272d('0x28')]:_0x3dbaf7[_0x272d('0x22')];if(_0x39d7d5[_0x272d('0x24')]['includeAll']){_0x5af5d8[_0x272d('0x36')]=[{'all':!![]}];}_0x5af5d8=_['merge']({},_0x5af5d8,_0x39d7d5[_0x272d('0x33')]);return db[_0x272d('0x34')]['find'](_0x5af5d8)[_0x272d('0x1e')](handleEntityNotFound(_0x5ed508,null))['then'](respondWithResult(_0x5ed508,null))[_0x272d('0x38')](handleError(_0x5ed508,null));};exports[_0x272d('0x3b')]=function(_0x4ea7ea,_0x4b7314){return db['FreshsalesField'][_0x272d('0x3b')](_0x4ea7ea['body'],{})['then'](respondWithResult(_0x4b7314,0xc9))['catch'](handleError(_0x4b7314,null));};exports['update']=function(_0x26eb3d,_0x24d061){if(_0x26eb3d[_0x272d('0x3c')]['id']){delete _0x26eb3d[_0x272d('0x3c')]['id'];}return db[_0x272d('0x34')][_0x272d('0x3d')]({'where':{'id':_0x26eb3d[_0x272d('0x3a')]['id']}})[_0x272d('0x1e')](handleEntityNotFound(_0x24d061,null))['then'](saveUpdates(_0x26eb3d[_0x272d('0x3c')],null))[_0x272d('0x1e')](respondWithResult(_0x24d061,null))[_0x272d('0x38')](handleError(_0x24d061,null));};exports[_0x272d('0x3e')]=function(_0x53fe14,_0x26ee85){return db[_0x272d('0x34')][_0x272d('0x3d')]({'where':{'id':_0x53fe14[_0x272d('0x3a')]['id']}})['then'](handleEntityNotFound(_0x26ee85,null))[_0x272d('0x1e')](removeEntity(_0x26ee85,null))[_0x272d('0x38')](handleError(_0x26ee85,null));}; \ No newline at end of file +var _0x8e13=['../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshsalesField','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x299cd5,_0x2e2b04){var _0x334e0f=function(_0x1ba1fa){while(--_0x1ba1fa){_0x299cd5['push'](_0x299cd5['shift']());}};_0x334e0f(++_0x2e2b04);}(_0x8e13,0xd4));var _0x38e1=function(_0x37da5d,_0x2506d2){_0x37da5d=_0x37da5d-0x0;var _0x9b4dd3=_0x8e13[_0x37da5d];return _0x9b4dd3;};'use strict';var emlformat=require(_0x38e1('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x38e1('0x1'));var rp=require(_0x38e1('0x2'));var moment=require(_0x38e1('0x3'));var BPromise=require(_0x38e1('0x4'));var Mustache=require(_0x38e1('0x5'));var util=require(_0x38e1('0x6'));var path=require('path');var sox=require(_0x38e1('0x7'));var csv=require(_0x38e1('0x8'));var ejs=require(_0x38e1('0x9'));var fs=require('fs');var fs_extra=require(_0x38e1('0xa'));var _=require(_0x38e1('0xb'));var squel=require(_0x38e1('0xc'));var crypto=require(_0x38e1('0xd'));var jsforce=require(_0x38e1('0xe'));var deskjs=require(_0x38e1('0xf'));var toCsv=require(_0x38e1('0x8'));var querystring=require(_0x38e1('0x10'));var Papa=require(_0x38e1('0x11'));var Redis=require(_0x38e1('0x12'));var authService=require(_0x38e1('0x13'));var qs=require(_0x38e1('0x14'));var as=require(_0x38e1('0x15'));var hardwareService=require(_0x38e1('0x16'));var logger=require(_0x38e1('0x17'))(_0x38e1('0x18'));var utils=require(_0x38e1('0x19'));var config=require(_0x38e1('0x1a'));var licenseUtil=require(_0x38e1('0x1b'));var db=require(_0x38e1('0x1c'))['db'];function respondWithStatusCode(_0x4b9466,_0x33860){_0x33860=_0x33860||0xcc;return function(_0x179784){if(_0x179784){return _0x4b9466[_0x38e1('0x1d')](_0x33860);}return _0x4b9466[_0x38e1('0x1e')](_0x33860)[_0x38e1('0x1f')]();};}function respondWithResult(_0x207260,_0x4b9c20){_0x4b9c20=_0x4b9c20||0xc8;return function(_0x172425){if(_0x172425){return _0x207260[_0x38e1('0x1e')](_0x4b9c20)[_0x38e1('0x20')](_0x172425);}};}function respondWithFilteredResult(_0x479c71,_0x1278d5){return function(_0x196d6e){if(_0x196d6e){var _0x4651b1=typeof _0x1278d5['offset']==='undefined'&&typeof _0x1278d5[_0x38e1('0x21')]===_0x38e1('0x22');var _0x2a57c9=_0x196d6e[_0x38e1('0x23')];var _0x174cef=_0x4651b1?0x0:_0x1278d5['offset'];var _0x203f20=_0x4651b1?_0x196d6e['count']:_0x1278d5[_0x38e1('0x24')]+_0x1278d5[_0x38e1('0x21')];var _0x566e9f;if(_0x203f20>=_0x2a57c9){_0x203f20=_0x2a57c9;_0x566e9f=0xc8;}else{_0x566e9f=0xce;}_0x479c71[_0x38e1('0x1e')](_0x566e9f);return _0x479c71[_0x38e1('0x25')](_0x38e1('0x26'),_0x174cef+'-'+_0x203f20+'/'+_0x2a57c9)[_0x38e1('0x20')](_0x196d6e);}return null;};}function patchUpdates(_0x165494){return function(_0x1c928b){try{jsonpatch[_0x38e1('0x27')](_0x1c928b,_0x165494,!![]);}catch(_0x140f73){return BPromise['reject'](_0x140f73);}return _0x1c928b[_0x38e1('0x28')]();};}function saveUpdates(_0xb4d05e,_0x29f21e){return function(_0x2fc4b4){if(_0x2fc4b4){return _0x2fc4b4[_0x38e1('0x29')](_0xb4d05e)[_0x38e1('0x2a')](function(_0x4ba56b){return _0x4ba56b;});}return null;};}function removeEntity(_0x1562a8,_0x2ad5ed){return function(_0x45575d){if(_0x45575d){return _0x45575d['destroy']()[_0x38e1('0x2a')](function(){_0x1562a8['status'](0xcc)[_0x38e1('0x1f')]();});}};}function handleEntityNotFound(_0x3a6310,_0x2f6e19){return function(_0x4176b8){if(!_0x4176b8){_0x3a6310[_0x38e1('0x1d')](0x194);}return _0x4176b8;};}function handleError(_0x2d70c7,_0x4c3615){_0x4c3615=_0x4c3615||0x1f4;return function(_0x5397e3){logger[_0x38e1('0x2b')](_0x5397e3[_0x38e1('0x2c')]);if(_0x5397e3[_0x38e1('0x2d')]){delete _0x5397e3[_0x38e1('0x2d')];}_0x2d70c7['status'](_0x4c3615)['send'](_0x5397e3);};}exports[_0x38e1('0x2e')]=function(_0x565847,_0x32884e){var _0x1bd594={},_0x289b57={},_0x248cd4={'count':0x0,'rows':[]};var _0x129cf3=_[_0x38e1('0x2f')](db['FreshsalesField'][_0x38e1('0x30')],function(_0x560fdf){return{'name':_0x560fdf[_0x38e1('0x31')],'type':_0x560fdf[_0x38e1('0x32')]['key']};});_0x289b57[_0x38e1('0x33')]=_[_0x38e1('0x2f')](_0x129cf3,_0x38e1('0x2d'));_0x289b57[_0x38e1('0x34')]=_[_0x38e1('0x35')](_0x565847[_0x38e1('0x34')]);_0x289b57[_0x38e1('0x36')]=_[_0x38e1('0x37')](_0x289b57[_0x38e1('0x33')],_0x289b57[_0x38e1('0x34')]);_0x1bd594[_0x38e1('0x38')]=_[_0x38e1('0x37')](_0x289b57[_0x38e1('0x33')],qs[_0x38e1('0x39')](_0x565847[_0x38e1('0x34')][_0x38e1('0x39')]));_0x1bd594[_0x38e1('0x38')]=_0x1bd594[_0x38e1('0x38')][_0x38e1('0x3a')]?_0x1bd594[_0x38e1('0x38')]:_0x289b57[_0x38e1('0x33')];if(!_0x565847['query'][_0x38e1('0x3b')](_0x38e1('0x3c'))){_0x1bd594['limit']=qs['limit'](_0x565847[_0x38e1('0x34')][_0x38e1('0x21')]);_0x1bd594[_0x38e1('0x24')]=qs[_0x38e1('0x24')](_0x565847[_0x38e1('0x34')][_0x38e1('0x24')]);}_0x1bd594[_0x38e1('0x3d')]=qs[_0x38e1('0x3e')](_0x565847[_0x38e1('0x34')]['sort']);_0x1bd594[_0x38e1('0x3f')]=qs[_0x38e1('0x36')](_[_0x38e1('0x40')](_0x565847[_0x38e1('0x34')],_0x289b57[_0x38e1('0x36')]),_0x129cf3);if(_0x565847['query'][_0x38e1('0x41')]){_0x1bd594[_0x38e1('0x3f')]=_[_0x38e1('0x42')](_0x1bd594[_0x38e1('0x3f')],{'$or':_[_0x38e1('0x2f')](_0x129cf3,function(_0x363491){if(_0x363491[_0x38e1('0x32')]!==_0x38e1('0x43')){var _0x565e07={};_0x565e07[_0x363491[_0x38e1('0x2d')]]={'$like':'%'+_0x565847[_0x38e1('0x34')]['filter']+'%'};return _0x565e07;}})});}_0x1bd594=_[_0x38e1('0x42')]({},_0x1bd594,_0x565847[_0x38e1('0x44')]);var _0x126a84={'where':_0x1bd594[_0x38e1('0x3f')]};return db[_0x38e1('0x45')]['count'](_0x126a84)[_0x38e1('0x2a')](function(_0x4c2107){_0x248cd4['count']=_0x4c2107;if(_0x565847[_0x38e1('0x34')][_0x38e1('0x46')]){_0x1bd594[_0x38e1('0x47')]=[{'all':!![]}];}return db[_0x38e1('0x45')][_0x38e1('0x48')](_0x1bd594);})['then'](function(_0x42c526){_0x248cd4[_0x38e1('0x49')]=_0x42c526;return _0x248cd4;})[_0x38e1('0x2a')](respondWithFilteredResult(_0x32884e,_0x1bd594))[_0x38e1('0x4a')](handleError(_0x32884e,null));};exports['show']=function(_0x1058fe,_0x2d8f9a){var _0x4c438c={'raw':!![],'where':{'id':_0x1058fe['params']['id']}},_0x4b2b37={};_0x4b2b37[_0x38e1('0x33')]=_[_0x38e1('0x35')](db['FreshsalesField'][_0x38e1('0x30')]);_0x4b2b37[_0x38e1('0x34')]=_['keys'](_0x1058fe[_0x38e1('0x34')]);_0x4b2b37['filters']=_[_0x38e1('0x37')](_0x4b2b37['model'],_0x4b2b37[_0x38e1('0x34')]);_0x4c438c[_0x38e1('0x38')]=_[_0x38e1('0x37')](_0x4b2b37['model'],qs['fields'](_0x1058fe['query'][_0x38e1('0x39')]));_0x4c438c[_0x38e1('0x38')]=_0x4c438c[_0x38e1('0x38')]['length']?_0x4c438c[_0x38e1('0x38')]:_0x4b2b37['model'];if(_0x1058fe[_0x38e1('0x34')][_0x38e1('0x46')]){_0x4c438c[_0x38e1('0x47')]=[{'all':!![]}];}_0x4c438c=_[_0x38e1('0x42')]({},_0x4c438c,_0x1058fe[_0x38e1('0x44')]);return db[_0x38e1('0x45')][_0x38e1('0x4b')](_0x4c438c)[_0x38e1('0x2a')](handleEntityNotFound(_0x2d8f9a,null))[_0x38e1('0x2a')](respondWithResult(_0x2d8f9a,null))[_0x38e1('0x4a')](handleError(_0x2d8f9a,null));};exports[_0x38e1('0x4c')]=function(_0x3903c7,_0x4a59ed){return db[_0x38e1('0x45')][_0x38e1('0x4c')](_0x3903c7['body'],{})['then'](respondWithResult(_0x4a59ed,0xc9))[_0x38e1('0x4a')](handleError(_0x4a59ed,null));};exports[_0x38e1('0x29')]=function(_0x8e4a1,_0x5a31e2){if(_0x8e4a1['body']['id']){delete _0x8e4a1[_0x38e1('0x4d')]['id'];}return db[_0x38e1('0x45')][_0x38e1('0x4b')]({'where':{'id':_0x8e4a1[_0x38e1('0x4e')]['id']}})[_0x38e1('0x2a')](handleEntityNotFound(_0x5a31e2,null))[_0x38e1('0x2a')](saveUpdates(_0x8e4a1[_0x38e1('0x4d')],null))[_0x38e1('0x2a')](respondWithResult(_0x5a31e2,null))['catch'](handleError(_0x5a31e2,null));};exports[_0x38e1('0x4f')]=function(_0x3ebb52,_0x4e36ee){return db[_0x38e1('0x45')][_0x38e1('0x4b')]({'where':{'id':_0x3ebb52[_0x38e1('0x4e')]['id']}})[_0x38e1('0x2a')](handleEntityNotFound(_0x4e36ee,null))['then'](removeEntity(_0x4e36ee,null))[_0x38e1('0x4a')](handleError(_0x4e36ee,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 963c5aa..fd2a1d0 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 _0x5ba3=['path','../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','idField','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0xdcfa3,_0x426d85){var _0x64a7f1=function(_0x2dd0f6){while(--_0x2dd0f6){_0xdcfa3['push'](_0xdcfa3['shift']());}};_0x64a7f1(++_0x426d85);}(_0x5ba3,0x140));var _0x35ba=function(_0x5c943b,_0x8cdcd1){_0x5c943b=_0x5c943b-0x0;var _0x284cdc=_0x5ba3[_0x5c943b];return _0x284cdc;};'use strict';var _=require(_0x35ba('0x0'));var util=require('util');var logger=require(_0x35ba('0x1'))(_0x35ba('0x2'));var moment=require('moment');var BPromise=require(_0x35ba('0x3'));var rp=require(_0x35ba('0x4'));var fs=require('fs');var path=require(_0x35ba('0x5'));var rimraf=require('rimraf');var config=require(_0x35ba('0x6'));var attributes=require(_0x35ba('0x7'));module[_0x35ba('0x8')]=function(_0x596785,_0x54c722){return _0x596785[_0x35ba('0x9')](_0x35ba('0xa'),attributes,{'tableName':_0x35ba('0xb'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x35ba('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb8d=['rimraf','../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','freshsales_unique_index','FieldId','lodash','../../config/logger','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb8d,0x146));var _0xdbb8=function(_0x18eb3f,_0x3a1cd9){_0x18eb3f=_0x18eb3f-0x0;var _0x6abc41=_0xbb8d[_0x18eb3f];return _0x6abc41;};'use strict';var _=require(_0xdbb8('0x0'));var util=require('util');var logger=require(_0xdbb8('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xdbb8('0x2'));var fs=require('fs');var path=require(_0xdbb8('0x3'));var rimraf=require(_0xdbb8('0x4'));var config=require(_0xdbb8('0x5'));var attributes=require(_0xdbb8('0x6'));module['exports']=function(_0x6a6db3,_0x149c99){return _0x6a6db3[_0xdbb8('0x7')](_0xdbb8('0x8'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xdbb8('0x9'),'fields':['idField',_0xdbb8('0xa')],'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 d1766ac..40e2cfc 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 _0x90b1=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x50dd2b,_0x20a9ce){var _0x14ec89=function(_0x4abea0){while(--_0x4abea0){_0x50dd2b['push'](_0x50dd2b['shift']());}};_0x14ec89(++_0x20a9ce);}(_0x90b1,0x1bb));var _0x190b=function(_0x293e7a,_0x1792a2){_0x293e7a=_0x293e7a-0x0;var _0xb78342=_0x90b1[_0x293e7a];return _0xb78342;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var moment=require(_0x190b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x190b('0x3'));var db=require(_0x190b('0x4'))['db'];var utils=require(_0x190b('0x5'));var logger=require(_0x190b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x190b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x34a689,_0x3b57f7,_0x626aa1){return new BPromise(function(_0x311161,_0x802924){return client[_0x190b('0x8')](_0x34a689,_0x626aa1)['then'](function(_0x14b93d){logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));logger[_0x190b('0xc')](_0x190b('0xd'),_0x3b57f7,_0x190b('0xb'),JSON[_0x190b('0xe')](_0x14b93d));if(_0x14b93d['error']){if(_0x14b93d[_0x190b('0xf')][_0x190b('0x10')]===0x1f4){logger['error'](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x802924(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}logger[_0x190b('0xf')](_0x190b('0xa'),_0x3b57f7,_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);return _0x311161(_0x14b93d[_0x190b('0xf')][_0x190b('0x11')]);}else{logger[_0x190b('0x9')](_0x190b('0xa'),_0x3b57f7,_0x190b('0xb'));_0x311161(_0x14b93d[_0x190b('0x12')][_0x190b('0x11')]);}})[_0x190b('0x13')](function(_0x5c63d9){logger[_0x190b('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3b57f7,_0x5c63d9);_0x802924(_0x5c63d9);});});} \ No newline at end of file +var _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\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(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0x814b,0x1a2));var _0xb814=function(_0x5180c3,_0x4b35f7){_0x5180c3=_0x5180c3-0x0;var _0x55c975=_0x814b[_0x5180c3];return _0x55c975;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 48ac55c..25ef684 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 _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(_0x17b70f,_0x3aa576){var _0x2ac1bb=function(_0x99b256){while(--_0x99b256){_0x17b70f['push'](_0x17b70f['shift']());}};_0x2ac1bb(++_0x3aa576);}(_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 _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(_0x154728,_0x2b865a){var _0x4351e0=function(_0x323f29){while(--_0x323f29){_0x154728['push'](_0x154728['shift']());}};_0x4351e0(++_0x2b865a);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 55540ff..04f5271 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 _0x77a9=['STRING','username','ENUM','integrationTab','sequelize'];(function(_0x432e07,_0x21da57){var _0x719ed1=function(_0x2ede75){while(--_0x2ede75){_0x432e07['push'](_0x432e07['shift']());}};_0x719ed1(++_0x21da57);}(_0x77a9,0x19e));var _0x977a=function(_0x281180,_0x4a7cda){_0x281180=_0x281180-0x0;var _0x183311=_0x77a9[_0x281180];return _0x183311;};'use strict';var Sequelize=require(_0x977a('0x0'));module['exports']={'name':{'type':Sequelize[_0x977a('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x977a('0x1')],'unique':_0x977a('0x2')},'remoteUri':{'type':Sequelize[_0x977a('0x1')]},'password':{'type':Sequelize[_0x977a('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x977a('0x1')]},'securityToken':{'type':Sequelize[_0x977a('0x1')]},'serverUrl':{'type':Sequelize[_0x977a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x977a('0x3')](_0x977a('0x4'),'newTab'),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xa868=['exports','STRING','username','ENUM','integrationTab','newTab','sequelize'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa868,0x1b8));var _0x8a86=function(_0x208f80,_0x2522c6){_0x208f80=_0x208f80-0x0;var _0x71c40c=_0xa868[_0x208f80];return _0x71c40c;};'use strict';var Sequelize=require(_0x8a86('0x0'));module[_0x8a86('0x1')]={'name':{'type':Sequelize[_0x8a86('0x2')]},'description':{'type':Sequelize[_0x8a86('0x2')]},'username':{'type':Sequelize[_0x8a86('0x2')],'unique':_0x8a86('0x3')},'remoteUri':{'type':Sequelize[_0x8a86('0x2')]},'password':{'type':Sequelize[_0x8a86('0x2')]},'clientId':{'type':Sequelize[_0x8a86('0x2')]},'clientSecret':{'type':Sequelize[_0x8a86('0x2')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x8a86('0x4')](_0x8a86('0x5'),_0x8a86('0x6')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 3a7e3aa..d49b2d0 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 _0x180d=['bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','offset','count','set','apply','save','then','destroy','sendStatus','error','name','send','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','params','keys','includeAll','find','catch','create','body','update','getConfigurations','addConfiguration','findOne','AccountId','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','securityToken','slice','substring','lastIndexOf','login','username','password','isNil','ticketType','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','picklist','email','textarea','phone','remove','includes','label','value','boolean','True','true','False','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1efb4a,_0x46acc8){var _0x30c4b9=function(_0x28f547){while(--_0x28f547){_0x1efb4a['push'](_0x1efb4a['shift']());}};_0x30c4b9(++_0x46acc8);}(_0x180d,0x167));var _0xd180=function(_0x243b59,_0x3f9495){_0x243b59=_0x243b59-0x0;var _0x3e1676=_0x180d[_0x243b59];return _0x3e1676;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd180('0x0'));var zipdir=require(_0xd180('0x1'));var jsonpatch=require(_0xd180('0x2'));var rp=require(_0xd180('0x3'));var moment=require('moment');var BPromise=require(_0xd180('0x4'));var Mustache=require('mustache');var util=require(_0xd180('0x5'));var path=require(_0xd180('0x6'));var sox=require(_0xd180('0x7'));var csv=require(_0xd180('0x8'));var ejs=require(_0xd180('0x9'));var fs=require('fs');var fs_extra=require(_0xd180('0xa'));var _=require(_0xd180('0xb'));var squel=require(_0xd180('0xc'));var crypto=require('crypto');var jsforce=require(_0xd180('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd180('0xe'));var Papa=require(_0xd180('0xf'));var Redis=require(_0xd180('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd180('0x11'));var as=require(_0xd180('0x12'));var hardwareService=require(_0xd180('0x13'));var logger=require(_0xd180('0x14'))(_0xd180('0x15'));var utils=require(_0xd180('0x16'));var config=require(_0xd180('0x17'));var licenseUtil=require(_0xd180('0x18'));var db=require(_0xd180('0x19'))['db'];var integrations=require(_0xd180('0x1a'));function respondWithStatusCode(_0x346c59,_0xa93179){_0xa93179=_0xa93179||0xcc;return function(_0x35b7f3){if(_0x35b7f3){return _0x346c59['sendStatus'](_0xa93179);}return _0x346c59['status'](_0xa93179)['end']();};}function respondWithResult(_0x35227f,_0x1fc0ec){_0x1fc0ec=_0x1fc0ec||0xc8;return function(_0xcf7431){if(_0xcf7431){return _0x35227f[_0xd180('0x1b')](_0x1fc0ec)[_0xd180('0x1c')](_0xcf7431);}};}function respondWithFilteredResult(_0x5535dc,_0xaa8900){return function(_0x1e701a){if(_0x1e701a){var _0x45f8b9=typeof _0xaa8900['offset']===_0xd180('0x1d')&&typeof _0xaa8900[_0xd180('0x1e')]==='undefined';var _0x51e3ba=_0x1e701a['count'];var _0x457a26=_0x45f8b9?0x0:_0xaa8900[_0xd180('0x1f')];var _0x349c66=_0x45f8b9?_0x1e701a[_0xd180('0x20')]:_0xaa8900[_0xd180('0x1f')]+_0xaa8900['limit'];var _0xc30ae6;if(_0x349c66>=_0x51e3ba){_0x349c66=_0x51e3ba;_0xc30ae6=0xc8;}else{_0xc30ae6=0xce;}_0x5535dc[_0xd180('0x1b')](_0xc30ae6);return _0x5535dc[_0xd180('0x21')]('Content-Range',_0x457a26+'-'+_0x349c66+'/'+_0x51e3ba)['json'](_0x1e701a);}return null;};}function patchUpdates(_0x55fd3b){return function(_0x67e259){try{jsonpatch[_0xd180('0x22')](_0x67e259,_0x55fd3b,!![]);}catch(_0x4cab8c){return BPromise['reject'](_0x4cab8c);}return _0x67e259[_0xd180('0x23')]();};}function saveUpdates(_0x37831f,_0x1a2aa8){return function(_0x5628c2){if(_0x5628c2){return _0x5628c2['update'](_0x37831f)[_0xd180('0x24')](function(_0x1f4495){return _0x1f4495;});}return null;};}function removeEntity(_0x36dd13,_0x8faa70){return function(_0x48d142){if(_0x48d142){return _0x48d142[_0xd180('0x25')]()[_0xd180('0x24')](function(){_0x36dd13[_0xd180('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59efc1,_0xc99ffd){return function(_0xc2fee8){if(!_0xc2fee8){_0x59efc1[_0xd180('0x26')](0x194);}return _0xc2fee8;};}function handleError(_0x5a24ef,_0x3a2f52){_0x3a2f52=_0x3a2f52||0x1f4;return function(_0x47c538){logger[_0xd180('0x27')](_0x47c538['stack']);if(_0x47c538[_0xd180('0x28')]){delete _0x47c538[_0xd180('0x28')];}_0x5a24ef['status'](_0x3a2f52)[_0xd180('0x29')](_0x47c538);};}exports['index']=function(_0x28754a,_0x598904){var _0x1c5432={},_0x1dd46b={},_0xbc8dc1={'count':0x0,'rows':[]};var _0x1804aa=_['map'](db[_0xd180('0x2a')][_0xd180('0x2b')],function(_0x431721){return{'name':_0x431721[_0xd180('0x2c')],'type':_0x431721[_0xd180('0x2d')][_0xd180('0x2e')]};});_0x1dd46b[_0xd180('0x2f')]=_[_0xd180('0x30')](_0x1804aa,_0xd180('0x28'));_0x1dd46b[_0xd180('0x31')]=_['keys'](_0x28754a[_0xd180('0x31')]);_0x1dd46b[_0xd180('0x32')]=_[_0xd180('0x33')](_0x1dd46b[_0xd180('0x2f')],_0x1dd46b['query']);_0x1c5432[_0xd180('0x34')]=_['intersection'](_0x1dd46b[_0xd180('0x2f')],qs['fields'](_0x28754a[_0xd180('0x31')][_0xd180('0x35')]));_0x1c5432[_0xd180('0x34')]=_0x1c5432[_0xd180('0x34')][_0xd180('0x36')]?_0x1c5432[_0xd180('0x34')]:_0x1dd46b[_0xd180('0x2f')];if(!_0x28754a[_0xd180('0x31')][_0xd180('0x37')](_0xd180('0x38'))){_0x1c5432[_0xd180('0x1e')]=qs[_0xd180('0x1e')](_0x28754a[_0xd180('0x31')][_0xd180('0x1e')]);_0x1c5432[_0xd180('0x1f')]=qs[_0xd180('0x1f')](_0x28754a[_0xd180('0x31')][_0xd180('0x1f')]);}_0x1c5432[_0xd180('0x39')]=qs['sort'](_0x28754a[_0xd180('0x31')][_0xd180('0x3a')]);_0x1c5432[_0xd180('0x3b')]=qs[_0xd180('0x32')](_[_0xd180('0x3c')](_0x28754a['query'],_0x1dd46b[_0xd180('0x32')]),_0x1804aa);if(_0x28754a['query']['filter']){_0x1c5432[_0xd180('0x3b')]=_[_0xd180('0x3d')](_0x1c5432[_0xd180('0x3b')],{'$or':_[_0xd180('0x30')](_0x1804aa,function(_0x4d95a2){if(_0x4d95a2['type']!=='VIRTUAL'){var _0xa144d6={};_0xa144d6[_0x4d95a2['name']]={'$like':'%'+_0x28754a['query'][_0xd180('0x3e')]+'%'};return _0xa144d6;}})});}_0x1c5432=_[_0xd180('0x3d')]({},_0x1c5432,_0x28754a[_0xd180('0x3f')]);var _0x45b78b={'where':_0x1c5432[_0xd180('0x3b')]};return db[_0xd180('0x2a')][_0xd180('0x20')](_0x45b78b)[_0xd180('0x24')](function(_0x29e411){_0xbc8dc1['count']=_0x29e411;if(_0x28754a['query']['includeAll']){_0x1c5432[_0xd180('0x40')]=[{'all':!![]}];}return db[_0xd180('0x2a')]['findAll'](_0x1c5432);})[_0xd180('0x24')](function(_0x1b1078){_0xbc8dc1['rows']=_0x1b1078;return _0xbc8dc1;})['then'](respondWithFilteredResult(_0x598904,_0x1c5432))['catch'](handleError(_0x598904,null));};exports['show']=function(_0x513511,_0x2cb57b){var _0x2e9870={'raw':![],'where':{'id':_0x513511[_0xd180('0x41')]['id']}},_0x357d5b={};_0x357d5b[_0xd180('0x2f')]=_[_0xd180('0x42')](db[_0xd180('0x2a')][_0xd180('0x2b')]);_0x357d5b[_0xd180('0x31')]=_['keys'](_0x513511[_0xd180('0x31')]);_0x357d5b[_0xd180('0x32')]=_[_0xd180('0x33')](_0x357d5b[_0xd180('0x2f')],_0x357d5b[_0xd180('0x31')]);_0x2e9870[_0xd180('0x34')]=_['intersection'](_0x357d5b[_0xd180('0x2f')],qs[_0xd180('0x35')](_0x513511[_0xd180('0x31')][_0xd180('0x35')]));_0x2e9870['attributes']=_0x2e9870[_0xd180('0x34')]['length']?_0x2e9870[_0xd180('0x34')]:_0x357d5b[_0xd180('0x2f')];if(_0x513511['query'][_0xd180('0x43')]){_0x2e9870['include']=[{'all':!![]}];}_0x2e9870=_[_0xd180('0x3d')]({},_0x2e9870,_0x513511[_0xd180('0x3f')]);return db['SalesforceAccount'][_0xd180('0x44')](_0x2e9870)['then'](handleEntityNotFound(_0x2cb57b,null))['then'](respondWithResult(_0x2cb57b,null))[_0xd180('0x45')](handleError(_0x2cb57b,null));};exports['create']=function(_0x587c44,_0x117aba){return db[_0xd180('0x2a')][_0xd180('0x46')](_0x587c44[_0xd180('0x47')],{})['then'](respondWithResult(_0x117aba,0xc9))[_0xd180('0x45')](handleError(_0x117aba,null));};exports[_0xd180('0x48')]=function(_0x14885f,_0x262a6f){if(_0x14885f[_0xd180('0x47')]['id']){delete _0x14885f[_0xd180('0x47')]['id'];}return db[_0xd180('0x2a')][_0xd180('0x44')]({'where':{'id':_0x14885f[_0xd180('0x41')]['id']}})[_0xd180('0x24')](handleEntityNotFound(_0x262a6f,null))['then'](saveUpdates(_0x14885f[_0xd180('0x47')],null))[_0xd180('0x24')](respondWithResult(_0x262a6f,null))[_0xd180('0x45')](handleError(_0x262a6f,null));};exports[_0xd180('0x25')]=function(_0x557ee3,_0x544c55){return db[_0xd180('0x2a')][_0xd180('0x44')]({'where':{'id':_0x557ee3['params']['id']}})[_0xd180('0x24')](handleEntityNotFound(_0x544c55,null))[_0xd180('0x24')](removeEntity(_0x544c55,null))[_0xd180('0x45')](handleError(_0x544c55,null));};exports['getConfigurations']=function(_0x2ab172,_0x466e65,_0x191f00){var _0x2286e2={};var _0x1255c2={};var _0xc2e618;var _0x5556f3;return db[_0xd180('0x2a')]['findOne']({'where':{'id':_0x2ab172[_0xd180('0x41')]['id']}})[_0xd180('0x24')](handleEntityNotFound(_0x466e65,null))[_0xd180('0x24')](function(_0x5424de){if(_0x5424de){_0xc2e618=_0x5424de;_0x1255c2[_0xd180('0x2f')]=_[_0xd180('0x42')](db['SalesforceConfiguration'][_0xd180('0x2b')]);_0x1255c2[_0xd180('0x31')]=_['keys'](_0x2ab172[_0xd180('0x31')]);_0x1255c2[_0xd180('0x32')]=_[_0xd180('0x33')](_0x1255c2[_0xd180('0x2f')],_0x1255c2[_0xd180('0x31')]);_0x2286e2['attributes']=_['intersection'](_0x1255c2[_0xd180('0x2f')],qs[_0xd180('0x35')](_0x2ab172[_0xd180('0x31')]['fields']));_0x2286e2[_0xd180('0x34')]=_0x2286e2[_0xd180('0x34')]['length']?_0x2286e2[_0xd180('0x34')]:_0x1255c2[_0xd180('0x2f')];_0x2286e2[_0xd180('0x39')]=qs[_0xd180('0x3a')](_0x2ab172['query'][_0xd180('0x3a')]);_0x2286e2['where']=qs[_0xd180('0x32')](_['pick'](_0x2ab172[_0xd180('0x31')],_0x1255c2[_0xd180('0x32')]));if(_0x2ab172['query'][_0xd180('0x3e')]){_0x2286e2[_0xd180('0x3b')]=_[_0xd180('0x3d')](_0x2286e2['where'],{'$or':_[_0xd180('0x30')](_0x2286e2[_0xd180('0x34')],function(_0x4a9a5e){var _0x41178f={};_0x41178f[_0x4a9a5e]={'$like':'%'+_0x2ab172[_0xd180('0x31')]['filter']+'%'};return _0x41178f;})});}_0x2286e2=_[_0xd180('0x3d')]({},_0x2286e2,_0x2ab172['options']);return _0xc2e618[_0xd180('0x49')](_0x2286e2);}})[_0xd180('0x24')](function(_0x4573bc){if(_0x4573bc){_0x5556f3=_0x4573bc[_0xd180('0x36')];if(!_0x2ab172['query']['hasOwnProperty'](_0xd180('0x38'))){_0x2286e2[_0xd180('0x1e')]=qs[_0xd180('0x1e')](_0x2ab172[_0xd180('0x31')]['limit']);_0x2286e2['offset']=qs['offset'](_0x2ab172[_0xd180('0x31')][_0xd180('0x1f')]);}return _0xc2e618[_0xd180('0x49')](_0x2286e2);}})[_0xd180('0x24')](function(_0x2c540c){if(_0x2c540c){return _0x2c540c?{'count':_0x5556f3,'rows':_0x2c540c}:null;}})[_0xd180('0x24')](respondWithResult(_0x466e65,null))['catch'](handleError(_0x466e65,null));};exports[_0xd180('0x4a')]=function(_0xe51c4a,_0x1026bb,_0x26817d){if(_0xe51c4a['body']['id']){delete _0xe51c4a[_0xd180('0x47')]['id'];}return db[_0xd180('0x2a')][_0xd180('0x4b')]({'where':{'id':_0xe51c4a[_0xd180('0x41')]['id']}})['then'](handleEntityNotFound(_0x1026bb,null))['then'](function(_0x41038b){if(_0x41038b){_0xe51c4a[_0xd180('0x47')][_0xd180('0x4c')]=_0x41038b['id'];_0xe51c4a[_0xd180('0x47')]['Subjects']=integrations[_0xd180('0x4d')](_0xe51c4a['body'][_0xd180('0x4e')],_0xe51c4a[_0xd180('0x47')][_0xd180('0x2d')]);_0xe51c4a[_0xd180('0x47')][_0xd180('0x4f')]=integrations[_0xd180('0x50')](_0xe51c4a[_0xd180('0x47')][_0xd180('0x4e')],_0xe51c4a[_0xd180('0x47')][_0xd180('0x2d')]);return db[_0xd180('0x51')]['create'](_0xe51c4a[_0xd180('0x47')],{'include':[{'model':db[_0xd180('0x52')],'as':'Subjects'},{'model':db['SalesforceField'],'as':_0xd180('0x4f')}]});}return null;})[_0xd180('0x24')](respondWithResult(_0x1026bb,null))[_0xd180('0x45')](handleError(_0x1026bb,null));};exports[_0xd180('0x53')]=function(_0x39414e,_0x387107,_0x39fff3){var _0x1b1a71;var _0x44460f='';var _0x20150f=_0xd180('0x54');return db[_0xd180('0x2a')][_0xd180('0x4b')]({'where':{'id':_0x39414e[_0xd180('0x41')]['id']},'attributes':['id',_0xd180('0x55'),_0xd180('0x56'),_0xd180('0x57'),'username','password',_0xd180('0x58')]})['then'](handleEntityNotFound(_0x387107,null))['then'](function(_0x1c33a8){if(_0x1c33a8){_0x44460f=_0x1c33a8[_0xd180('0x55')];var _0x41d625=_0x44460f[_0xd180('0x59')](-0x1);if(_0x41d625==='/'){_0x44460f=_0x44460f[_0xd180('0x5a')](0x0,_0x44460f[_0xd180('0x5b')](_0x41d625));}_0x1b1a71=new jsforce['Connection']({'oauth2':{'loginUrl':_0x44460f,'clientId':_0x1c33a8[_0xd180('0x56')],'clientSecret':_0x1c33a8[_0xd180('0x57')]}});return _0x1b1a71[_0xd180('0x5c')](_0x1c33a8[_0xd180('0x5d')],_0x1c33a8[_0xd180('0x5e')]['concat'](_0x1c33a8['securityToken']));}})[_0xd180('0x24')](function(_0x390ced){if(_0x390ced){if(!_[_0xd180('0x5f')](_0x39414e['query'][_0xd180('0x60')])){_0x20150f=_0x39414e[_0xd180('0x31')][_0xd180('0x60')];}return _0x1b1a71['sobject'](_0x20150f)['describe']();}})[_0xd180('0x24')](function(_0x3978ac){var _0x2676ce=[_0xd180('0x61'),_0xd180('0x62'),_0xd180('0x63'),_0xd180('0x64'),_0xd180('0x65'),_0xd180('0x66')];var _0x23de5=['string',_0xd180('0x67'),_0xd180('0x68'),'boolean',_0xd180('0x69'),_0xd180('0x6a'),_0xd180('0x6b')];if(_0x3978ac){_[_0xd180('0x6c')](_0x3978ac[_0xd180('0x35')],function(_0x4696c9){return _0x2676ce['includes'](_0x4696c9[_0xd180('0x28')])||!_0x23de5[_0xd180('0x6d')](_0x4696c9[_0xd180('0x2d')]);});return{'count':_0x3978ac['fields'][_0xd180('0x36')],'rows':_[_0xd180('0x30')](_0x3978ac[_0xd180('0x35')],function(_0x53af40){return{'id':_0x53af40['name'],'name':_0x53af40['label'],'custom':_0x53af40['custom'],'options':_0x53af40['picklistValues'][_0xd180('0x36')]>0x0?_[_0xd180('0x30')](_0x53af40['picklistValues'],function(_0x14ddb6){return{'name':_0x14ddb6[_0xd180('0x6e')],'value':_0x14ddb6[_0xd180('0x6f')]};}):_0x53af40['type']==_0xd180('0x70')?[{'name':_0xd180('0x71'),'value':_0xd180('0x72')},{'name':_0xd180('0x73'),'value':'false'}]:[]};})};}})[_0xd180('0x24')](respondWithResult(_0x387107,null))[_0xd180('0x45')](function(_0x357e9a){var _0x4bf62f=_0x39414e[_0xd180('0x31')][_0xd180('0x74')]?0x1f4:_0x357e9a[_0xd180('0x75')]||0x1f4;logger[_0xd180('0x27')](_0xd180('0x76'),'getFields',_0x4bf62f,JSON[_0xd180('0x77')](_0x357e9a));delete _0x357e9a[_0xd180('0x28')];if(_0x4bf62f===0x191){_0x4bf62f=0x190;}_0x387107[_0xd180('0x1b')](_0x4bf62f)[_0xd180('0x29')](_0x39414e[_0xd180('0x31')]['test']?{'message':_0xd180('0x78'),'statusCode':_0x357e9a[_0xd180('0x75')]}:_0x357e9a);});}; \ No newline at end of file +var _0x64d0=['params','fields','find','create','body','getConfigurations','findOne','SalesforceConfiguration','pick','merge','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','substring','Connection','login','concat','ticketType','sobject','describe','ActivityDate','IsRecurrence','Subject','Description','int','picklist','boolean','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','query','keys','intersection','attributes','model','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','catch','show'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x64d0,0x1a8));var _0x064d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64d0[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x064d('0x0'));var zipdir=require(_0x064d('0x1'));var jsonpatch=require(_0x064d('0x2'));var rp=require(_0x064d('0x3'));var moment=require('moment');var BPromise=require(_0x064d('0x4'));var Mustache=require(_0x064d('0x5'));var util=require(_0x064d('0x6'));var path=require(_0x064d('0x7'));var sox=require('sox');var csv=require(_0x064d('0x8'));var ejs=require(_0x064d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x064d('0xa'));var squel=require(_0x064d('0xb'));var crypto=require(_0x064d('0xc'));var jsforce=require(_0x064d('0xd'));var deskjs=require(_0x064d('0xe'));var toCsv=require(_0x064d('0x8'));var querystring=require(_0x064d('0xf'));var Papa=require('papaparse');var Redis=require(_0x064d('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x064d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x064d('0x12'))(_0x064d('0x13'));var utils=require(_0x064d('0x14'));var config=require(_0x064d('0x15'));var licenseUtil=require(_0x064d('0x16'));var db=require(_0x064d('0x17'))['db'];var integrations=require(_0x064d('0x18'));function respondWithStatusCode(_0x27c97f,_0x104c50){_0x104c50=_0x104c50||0xcc;return function(_0x11d95b){if(_0x11d95b){return _0x27c97f[_0x064d('0x19')](_0x104c50);}return _0x27c97f[_0x064d('0x1a')](_0x104c50)[_0x064d('0x1b')]();};}function respondWithResult(_0x4c4233,_0x3d13a0){_0x3d13a0=_0x3d13a0||0xc8;return function(_0x14acc6){if(_0x14acc6){return _0x4c4233[_0x064d('0x1a')](_0x3d13a0)['json'](_0x14acc6);}};}function respondWithFilteredResult(_0x58e616,_0x19e796){return function(_0x5bcc96){if(_0x5bcc96){var _0x26ebf7=typeof _0x19e796['offset']===_0x064d('0x1c')&&typeof _0x19e796['limit']===_0x064d('0x1c');var _0x5ddcfb=_0x5bcc96[_0x064d('0x1d')];var _0x18c079=_0x26ebf7?0x0:_0x19e796['offset'];var _0x21f015=_0x26ebf7?_0x5bcc96[_0x064d('0x1d')]:_0x19e796[_0x064d('0x1e')]+_0x19e796[_0x064d('0x1f')];var _0x399405;if(_0x21f015>=_0x5ddcfb){_0x21f015=_0x5ddcfb;_0x399405=0xc8;}else{_0x399405=0xce;}_0x58e616[_0x064d('0x1a')](_0x399405);return _0x58e616[_0x064d('0x20')](_0x064d('0x21'),_0x18c079+'-'+_0x21f015+'/'+_0x5ddcfb)['json'](_0x5bcc96);}return null;};}function patchUpdates(_0x5cb9e9){return function(_0x5e30b1){try{jsonpatch[_0x064d('0x22')](_0x5e30b1,_0x5cb9e9,!![]);}catch(_0x4a8a6c){return BPromise[_0x064d('0x23')](_0x4a8a6c);}return _0x5e30b1[_0x064d('0x24')]();};}function saveUpdates(_0x156a30,_0x39760e){return function(_0x370b79){if(_0x370b79){return _0x370b79[_0x064d('0x25')](_0x156a30)[_0x064d('0x26')](function(_0x572d9d){return _0x572d9d;});}return null;};}function removeEntity(_0x1dd2dd,_0x4fba61){return function(_0x232478){if(_0x232478){return _0x232478[_0x064d('0x27')]()['then'](function(){_0x1dd2dd[_0x064d('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45c659,_0x236f7a){return function(_0x33483e){if(!_0x33483e){_0x45c659['sendStatus'](0x194);}return _0x33483e;};}function handleError(_0x1da064,_0x2a799c){_0x2a799c=_0x2a799c||0x1f4;return function(_0x27bc11){logger['error'](_0x27bc11['stack']);if(_0x27bc11[_0x064d('0x28')]){delete _0x27bc11['name'];}_0x1da064[_0x064d('0x1a')](_0x2a799c)[_0x064d('0x29')](_0x27bc11);};}exports[_0x064d('0x2a')]=function(_0x4fe7c8,_0x35c97a){var _0x3d0ad0={},_0x1a139b={},_0x43e8c5={'count':0x0,'rows':[]};var _0x1fa918=_[_0x064d('0x2b')](db[_0x064d('0x2c')][_0x064d('0x2d')],function(_0x15df75){return{'name':_0x15df75[_0x064d('0x2e')],'type':_0x15df75[_0x064d('0x2f')]['key']};});_0x1a139b['model']=_[_0x064d('0x2b')](_0x1fa918,'name');_0x1a139b[_0x064d('0x30')]=_[_0x064d('0x31')](_0x4fe7c8[_0x064d('0x30')]);_0x1a139b['filters']=_[_0x064d('0x32')](_0x1a139b['model'],_0x1a139b['query']);_0x3d0ad0[_0x064d('0x33')]=_['intersection'](_0x1a139b[_0x064d('0x34')],qs['fields'](_0x4fe7c8['query']['fields']));_0x3d0ad0[_0x064d('0x33')]=_0x3d0ad0['attributes'][_0x064d('0x35')]?_0x3d0ad0[_0x064d('0x33')]:_0x1a139b[_0x064d('0x34')];if(!_0x4fe7c8[_0x064d('0x30')][_0x064d('0x36')]('nolimit')){_0x3d0ad0[_0x064d('0x1f')]=qs[_0x064d('0x1f')](_0x4fe7c8[_0x064d('0x30')]['limit']);_0x3d0ad0[_0x064d('0x1e')]=qs[_0x064d('0x1e')](_0x4fe7c8[_0x064d('0x30')][_0x064d('0x1e')]);}_0x3d0ad0[_0x064d('0x37')]=qs[_0x064d('0x38')](_0x4fe7c8['query'][_0x064d('0x38')]);_0x3d0ad0[_0x064d('0x39')]=qs['filters'](_['pick'](_0x4fe7c8[_0x064d('0x30')],_0x1a139b[_0x064d('0x3a')]),_0x1fa918);if(_0x4fe7c8['query'][_0x064d('0x3b')]){_0x3d0ad0[_0x064d('0x39')]=_['merge'](_0x3d0ad0[_0x064d('0x39')],{'$or':_[_0x064d('0x2b')](_0x1fa918,function(_0xac7d41){if(_0xac7d41[_0x064d('0x2f')]!==_0x064d('0x3c')){var _0x58f9f8={};_0x58f9f8[_0xac7d41[_0x064d('0x28')]]={'$like':'%'+_0x4fe7c8[_0x064d('0x30')][_0x064d('0x3b')]+'%'};return _0x58f9f8;}})});}_0x3d0ad0=_['merge']({},_0x3d0ad0,_0x4fe7c8[_0x064d('0x3d')]);var _0x2a0378={'where':_0x3d0ad0[_0x064d('0x39')]};return db['SalesforceAccount'][_0x064d('0x1d')](_0x2a0378)[_0x064d('0x26')](function(_0x22dd9c){_0x43e8c5[_0x064d('0x1d')]=_0x22dd9c;if(_0x4fe7c8[_0x064d('0x30')][_0x064d('0x3e')]){_0x3d0ad0[_0x064d('0x3f')]=[{'all':!![]}];}return db[_0x064d('0x2c')][_0x064d('0x40')](_0x3d0ad0);})[_0x064d('0x26')](function(_0x20ab08){_0x43e8c5[_0x064d('0x41')]=_0x20ab08;return _0x43e8c5;})[_0x064d('0x26')](respondWithFilteredResult(_0x35c97a,_0x3d0ad0))[_0x064d('0x42')](handleError(_0x35c97a,null));};exports[_0x064d('0x43')]=function(_0x1af99e,_0x484836){var _0x3d4d2c={'raw':![],'where':{'id':_0x1af99e[_0x064d('0x44')]['id']}},_0x4bce3a={};_0x4bce3a[_0x064d('0x34')]=_['keys'](db[_0x064d('0x2c')][_0x064d('0x2d')]);_0x4bce3a[_0x064d('0x30')]=_[_0x064d('0x31')](_0x1af99e[_0x064d('0x30')]);_0x4bce3a[_0x064d('0x3a')]=_[_0x064d('0x32')](_0x4bce3a[_0x064d('0x34')],_0x4bce3a['query']);_0x3d4d2c[_0x064d('0x33')]=_[_0x064d('0x32')](_0x4bce3a[_0x064d('0x34')],qs['fields'](_0x1af99e['query'][_0x064d('0x45')]));_0x3d4d2c[_0x064d('0x33')]=_0x3d4d2c[_0x064d('0x33')]['length']?_0x3d4d2c[_0x064d('0x33')]:_0x4bce3a[_0x064d('0x34')];if(_0x1af99e['query']['includeAll']){_0x3d4d2c['include']=[{'all':!![]}];}_0x3d4d2c=_['merge']({},_0x3d4d2c,_0x1af99e[_0x064d('0x3d')]);return db[_0x064d('0x2c')][_0x064d('0x46')](_0x3d4d2c)[_0x064d('0x26')](handleEntityNotFound(_0x484836,null))[_0x064d('0x26')](respondWithResult(_0x484836,null))[_0x064d('0x42')](handleError(_0x484836,null));};exports['create']=function(_0x3b691a,_0x1e7abf){return db[_0x064d('0x2c')][_0x064d('0x47')](_0x3b691a[_0x064d('0x48')],{})[_0x064d('0x26')](respondWithResult(_0x1e7abf,0xc9))[_0x064d('0x42')](handleError(_0x1e7abf,null));};exports[_0x064d('0x25')]=function(_0x43470a,_0x5122d3){if(_0x43470a['body']['id']){delete _0x43470a['body']['id'];}return db['SalesforceAccount'][_0x064d('0x46')]({'where':{'id':_0x43470a[_0x064d('0x44')]['id']}})[_0x064d('0x26')](handleEntityNotFound(_0x5122d3,null))[_0x064d('0x26')](saveUpdates(_0x43470a['body'],null))['then'](respondWithResult(_0x5122d3,null))[_0x064d('0x42')](handleError(_0x5122d3,null));};exports[_0x064d('0x27')]=function(_0x1f0928,_0x16eb4d){return db[_0x064d('0x2c')][_0x064d('0x46')]({'where':{'id':_0x1f0928[_0x064d('0x44')]['id']}})[_0x064d('0x26')](handleEntityNotFound(_0x16eb4d,null))[_0x064d('0x26')](removeEntity(_0x16eb4d,null))[_0x064d('0x42')](handleError(_0x16eb4d,null));};exports[_0x064d('0x49')]=function(_0xa76d00,_0x1dddaa,_0x3a33b3){var _0x14b8b0={};var _0x5d6e16={};var _0x38b821;var _0x5d230f;return db['SalesforceAccount'][_0x064d('0x4a')]({'where':{'id':_0xa76d00[_0x064d('0x44')]['id']}})['then'](handleEntityNotFound(_0x1dddaa,null))[_0x064d('0x26')](function(_0x36cef5){if(_0x36cef5){_0x38b821=_0x36cef5;_0x5d6e16[_0x064d('0x34')]=_[_0x064d('0x31')](db[_0x064d('0x4b')]['rawAttributes']);_0x5d6e16[_0x064d('0x30')]=_[_0x064d('0x31')](_0xa76d00[_0x064d('0x30')]);_0x5d6e16[_0x064d('0x3a')]=_[_0x064d('0x32')](_0x5d6e16[_0x064d('0x34')],_0x5d6e16[_0x064d('0x30')]);_0x14b8b0['attributes']=_[_0x064d('0x32')](_0x5d6e16['model'],qs['fields'](_0xa76d00[_0x064d('0x30')][_0x064d('0x45')]));_0x14b8b0[_0x064d('0x33')]=_0x14b8b0[_0x064d('0x33')][_0x064d('0x35')]?_0x14b8b0[_0x064d('0x33')]:_0x5d6e16[_0x064d('0x34')];_0x14b8b0[_0x064d('0x37')]=qs['sort'](_0xa76d00[_0x064d('0x30')]['sort']);_0x14b8b0['where']=qs[_0x064d('0x3a')](_[_0x064d('0x4c')](_0xa76d00[_0x064d('0x30')],_0x5d6e16['filters']));if(_0xa76d00[_0x064d('0x30')][_0x064d('0x3b')]){_0x14b8b0[_0x064d('0x39')]=_['merge'](_0x14b8b0[_0x064d('0x39')],{'$or':_[_0x064d('0x2b')](_0x14b8b0[_0x064d('0x33')],function(_0x1f034e){var _0x3b985={};_0x3b985[_0x1f034e]={'$like':'%'+_0xa76d00[_0x064d('0x30')][_0x064d('0x3b')]+'%'};return _0x3b985;})});}_0x14b8b0=_[_0x064d('0x4d')]({},_0x14b8b0,_0xa76d00[_0x064d('0x3d')]);return _0x38b821['getConfigurations'](_0x14b8b0);}})[_0x064d('0x26')](function(_0x5def26){if(_0x5def26){_0x5d230f=_0x5def26['length'];if(!_0xa76d00[_0x064d('0x30')]['hasOwnProperty'](_0x064d('0x4e'))){_0x14b8b0[_0x064d('0x1f')]=qs[_0x064d('0x1f')](_0xa76d00[_0x064d('0x30')][_0x064d('0x1f')]);_0x14b8b0[_0x064d('0x1e')]=qs[_0x064d('0x1e')](_0xa76d00[_0x064d('0x30')][_0x064d('0x1e')]);}return _0x38b821[_0x064d('0x49')](_0x14b8b0);}})[_0x064d('0x26')](function(_0x19a296){if(_0x19a296){return _0x19a296?{'count':_0x5d230f,'rows':_0x19a296}:null;}})[_0x064d('0x26')](respondWithResult(_0x1dddaa,null))['catch'](handleError(_0x1dddaa,null));};exports[_0x064d('0x4f')]=function(_0x14b483,_0x451606,_0x21b740){if(_0x14b483[_0x064d('0x48')]['id']){delete _0x14b483['body']['id'];}return db[_0x064d('0x2c')][_0x064d('0x4a')]({'where':{'id':_0x14b483['params']['id']}})[_0x064d('0x26')](handleEntityNotFound(_0x451606,null))[_0x064d('0x26')](function(_0x35d397){if(_0x35d397){_0x14b483[_0x064d('0x48')][_0x064d('0x50')]=_0x35d397['id'];_0x14b483[_0x064d('0x48')][_0x064d('0x51')]=integrations[_0x064d('0x52')](_0x14b483[_0x064d('0x48')]['channel'],_0x14b483[_0x064d('0x48')][_0x064d('0x2f')]);_0x14b483[_0x064d('0x48')][_0x064d('0x53')]=integrations[_0x064d('0x54')](_0x14b483['body'][_0x064d('0x55')],_0x14b483[_0x064d('0x48')][_0x064d('0x2f')]);return db[_0x064d('0x4b')]['create'](_0x14b483[_0x064d('0x48')],{'include':[{'model':db[_0x064d('0x56')],'as':'Subjects'},{'model':db[_0x064d('0x56')],'as':_0x064d('0x53')}]});}return null;})['then'](respondWithResult(_0x451606,null))['catch'](handleError(_0x451606,null));};exports[_0x064d('0x57')]=function(_0x16d229,_0x58ca0b,_0x443dbd){var _0x1b25a1;var _0x456cf4='';var _0x1a993f='Task';return db['SalesforceAccount'][_0x064d('0x4a')]({'where':{'id':_0x16d229[_0x064d('0x44')]['id']},'attributes':['id',_0x064d('0x58'),_0x064d('0x59'),_0x064d('0x5a'),_0x064d('0x5b'),_0x064d('0x5c'),_0x064d('0x5d')]})[_0x064d('0x26')](handleEntityNotFound(_0x58ca0b,null))[_0x064d('0x26')](function(_0xd390cc){if(_0xd390cc){_0x456cf4=_0xd390cc[_0x064d('0x58')];var _0xaa11e5=_0x456cf4['slice'](-0x1);if(_0xaa11e5==='/'){_0x456cf4=_0x456cf4[_0x064d('0x5e')](0x0,_0x456cf4['lastIndexOf'](_0xaa11e5));}_0x1b25a1=new jsforce[(_0x064d('0x5f'))]({'oauth2':{'loginUrl':_0x456cf4,'clientId':_0xd390cc[_0x064d('0x59')],'clientSecret':_0xd390cc[_0x064d('0x5a')]}});return _0x1b25a1[_0x064d('0x60')](_0xd390cc['username'],_0xd390cc[_0x064d('0x5c')][_0x064d('0x61')](_0xd390cc[_0x064d('0x5d')]));}})[_0x064d('0x26')](function(_0x2af533){if(_0x2af533){if(!_['isNil'](_0x16d229[_0x064d('0x30')][_0x064d('0x62')])){_0x1a993f=_0x16d229[_0x064d('0x30')][_0x064d('0x62')];}return _0x1b25a1[_0x064d('0x63')](_0x1a993f)[_0x064d('0x64')]();}})[_0x064d('0x26')](function(_0x391b17){var _0x2667a0=['OwnerId',_0x064d('0x65'),'IsReminderSet',_0x064d('0x66'),_0x064d('0x67'),_0x064d('0x68')];var _0xc1b180=['string',_0x064d('0x69'),_0x064d('0x6a'),_0x064d('0x6b'),'email',_0x064d('0x6c'),_0x064d('0x6d')];if(_0x391b17){_[_0x064d('0x6e')](_0x391b17[_0x064d('0x45')],function(_0x21b4f4){return _0x2667a0[_0x064d('0x6f')](_0x21b4f4[_0x064d('0x28')])||!_0xc1b180[_0x064d('0x6f')](_0x21b4f4[_0x064d('0x2f')]);});return{'count':_0x391b17[_0x064d('0x45')][_0x064d('0x35')],'rows':_[_0x064d('0x2b')](_0x391b17[_0x064d('0x45')],function(_0xe77c71){return{'id':_0xe77c71['name'],'name':_0xe77c71[_0x064d('0x70')],'custom':_0xe77c71[_0x064d('0x71')],'options':_0xe77c71[_0x064d('0x72')][_0x064d('0x35')]>0x0?_[_0x064d('0x2b')](_0xe77c71[_0x064d('0x72')],function(_0x55608a){return{'name':_0x55608a[_0x064d('0x70')],'value':_0x55608a[_0x064d('0x73')]};}):_0xe77c71[_0x064d('0x2f')]==_0x064d('0x6b')?[{'name':_0x064d('0x74'),'value':_0x064d('0x75')},{'name':_0x064d('0x76'),'value':'false'}]:[]};})};}})[_0x064d('0x26')](respondWithResult(_0x58ca0b,null))[_0x064d('0x42')](function(_0x533c59){var _0x40fb62=_0x16d229[_0x064d('0x30')]['test']?0x1f4:_0x533c59[_0x064d('0x77')]||0x1f4;logger['error'](_0x064d('0x78'),'getFields',_0x40fb62,JSON[_0x064d('0x79')](_0x533c59));delete _0x533c59[_0x064d('0x28')];if(_0x40fb62===0x191){_0x40fb62=0x190;}_0x58ca0b['status'](_0x40fb62)[_0x064d('0x29')](_0x16d229[_0x064d('0x30')]['test']?{'message':_0x064d('0x7a'),'statusCode':_0x533c59[_0x064d('0x77')]}:_0x533c59);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f50988e..bc8b619 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 _0x9b78=['rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x546443,_0x1a7e36){var _0x166459=function(_0x5b8963){while(--_0x5b8963){_0x546443['push'](_0x546443['shift']());}};_0x166459(++_0x1a7e36);}(_0x9b78,0xe8));var _0x89b7=function(_0x31a576,_0x424419){_0x31a576=_0x31a576-0x0;var _0x30b1d3=_0x9b78[_0x31a576];return _0x30b1d3;};'use strict';var _=require(_0x89b7('0x0'));var util=require(_0x89b7('0x1'));var logger=require(_0x89b7('0x2'))(_0x89b7('0x3'));var moment=require(_0x89b7('0x4'));var BPromise=require(_0x89b7('0x5'));var rp=require(_0x89b7('0x6'));var fs=require('fs');var path=require(_0x89b7('0x7'));var rimraf=require(_0x89b7('0x8'));var config=require(_0x89b7('0x9'));var attributes=require(_0x89b7('0xa'));var integrations=require(_0x89b7('0xb'));module[_0x89b7('0xc')]=function(_0x350eae,_0x2b2b72){return _0x350eae[_0x89b7('0xd')](_0x89b7('0xe'),attributes,{'tableName':_0x89b7('0xf'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xef60=['../../components/integrations/configuration','define','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSalesforceAccount.attributes'];(function(_0x5d3a49,_0x192e91){var _0x440441=function(_0x4b43da){while(--_0x4b43da){_0x5d3a49['push'](_0x5d3a49['shift']());}};_0x440441(++_0x192e91);}(_0xef60,0xa0));var _0x0ef6=function(_0x5ec897,_0x55b065){_0x5ec897=_0x5ec897-0x0;var _0x1bb659=_0xef60[_0x5ec897];return _0x1bb659;};'use strict';var _=require(_0x0ef6('0x0'));var util=require(_0x0ef6('0x1'));var logger=require(_0x0ef6('0x2'))(_0x0ef6('0x3'));var moment=require(_0x0ef6('0x4'));var BPromise=require(_0x0ef6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0ef6('0x6'));var rimraf=require(_0x0ef6('0x7'));var config=require('../../config/environment');var attributes=require(_0x0ef6('0x8'));var integrations=require(_0x0ef6('0x9'));module['exports']=function(_0x1d664b,_0x45cf86){return _0x1d664b[_0x0ef6('0xa')](_0x0ef6('0xb'),attributes,{'tableName':_0x0ef6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js b/server/api/intSalesforceAccount/intSalesforceAccount.rpc.js index 97cc688..f7e0605 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 _0xbdc1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetSalesforceAccount','findAll','options','raw','where','limit','include','map','model','attributes','catch','ShowSalesforceAccount','SalesforceAccount','lodash','moment','bluebird'];(function(_0x3d23c5,_0x284b53){var _0x1ab027=function(_0x46796d){while(--_0x46796d){_0x3d23c5['push'](_0x3d23c5['shift']());}};_0x1ab027(++_0x284b53);}(_0xbdc1,0x147));var _0x1bdc=function(_0x194188,_0x3bb539){_0x194188=_0x194188-0x0;var _0xecb780=_0xbdc1[_0x194188];return _0xecb780;};'use strict';var _=require(_0x1bdc('0x0'));var util=require('util');var moment=require(_0x1bdc('0x1'));var BPromise=require(_0x1bdc('0x2'));var rs=require(_0x1bdc('0x3'));var fs=require('fs');var Redis=require(_0x1bdc('0x4'));var db=require(_0x1bdc('0x5'))['db'];var utils=require(_0x1bdc('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x1bdc('0x7'));var jayson=require(_0x1bdc('0x8'));var client=jayson['client'][_0x1bdc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x410396,_0x26fe74,_0x172324){return new BPromise(function(_0x15cd8e,_0x3f852d){return client[_0x1bdc('0xa')](_0x410396,_0x172324)[_0x1bdc('0xb')](function(_0x47675b){logger[_0x1bdc('0xc')](_0x1bdc('0xd'),_0x26fe74,_0x1bdc('0xe'));logger[_0x1bdc('0xf')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x26fe74,_0x1bdc('0xe'),JSON[_0x1bdc('0x10')](_0x47675b));if(_0x47675b[_0x1bdc('0x11')]){if(_0x47675b[_0x1bdc('0x11')][_0x1bdc('0x12')]===0x1f4){logger[_0x1bdc('0x11')](_0x1bdc('0xd'),_0x26fe74,_0x47675b['error'][_0x1bdc('0x13')]);return _0x3f852d(_0x47675b[_0x1bdc('0x11')][_0x1bdc('0x13')]);}logger['error'](_0x1bdc('0xd'),_0x26fe74,_0x47675b['error'][_0x1bdc('0x13')]);return _0x15cd8e(_0x47675b[_0x1bdc('0x11')][_0x1bdc('0x13')]);}else{logger[_0x1bdc('0xc')](_0x1bdc('0xd'),_0x26fe74,_0x1bdc('0xe'));_0x15cd8e(_0x47675b['result'][_0x1bdc('0x13')]);}})['catch'](function(_0x3dc6ec){logger[_0x1bdc('0x11')](_0x1bdc('0xd'),_0x26fe74,_0x3dc6ec);_0x3f852d(_0x3dc6ec);});});}exports[_0x1bdc('0x14')]=function(_0x160a90){var _0x27567f=this;return new Promise(function(_0x26fff5,_0x2f528b){return db['SalesforceAccount'][_0x1bdc('0x15')]({'raw':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')][_0x1bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')][_0x1bdc('0x18')]||null:null,'attributes':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')]['attributes']||null:null,'limit':_0x160a90['options']?_0x160a90['options'][_0x1bdc('0x19')]||null:null,'include':_0x160a90[_0x1bdc('0x16')]?_0x160a90[_0x1bdc('0x16')][_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x160a90[_0x1bdc('0x16')]['include'],function(_0x3b4ff4){return{'model':db[_0x3b4ff4[_0x1bdc('0x1c')]],'as':_0x3b4ff4['as'],'attributes':_0x3b4ff4['attributes'],'include':_0x3b4ff4['include']?_['map'](_0x3b4ff4[_0x1bdc('0x1a')],function(_0xd9004c){return{'model':db[_0xd9004c[_0x1bdc('0x1c')]],'as':_0xd9004c['as'],'attributes':_0xd9004c[_0x1bdc('0x1d')],'include':_0xd9004c[_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0xd9004c[_0x1bdc('0x1a')],function(_0x53300a){return{'model':db[_0x53300a[_0x1bdc('0x1c')]],'as':_0x53300a['as'],'attributes':_0x53300a[_0x1bdc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bdc('0xb')](function(_0x3a8860){logger['info'](_0x1bdc('0x14'),_0x160a90);logger[_0x1bdc('0xf')](_0x1bdc('0x14'),_0x160a90,JSON[_0x1bdc('0x10')](_0x3a8860));_0x26fff5(_0x3a8860);})[_0x1bdc('0x1e')](function(_0x49a2f4){logger[_0x1bdc('0x11')](_0x1bdc('0x14'),_0x49a2f4['message'],_0x160a90);_0x2f528b(_0x27567f['error'](0x1f4,_0x49a2f4[_0x1bdc('0x13')]));});});};exports[_0x1bdc('0x1f')]=function(_0x3346a5){var _0x19ea4e=this;return new Promise(function(_0x4b03c8,_0x4199f4){return db[_0x1bdc('0x20')]['find']({'raw':_0x3346a5[_0x1bdc('0x16')]?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x17')]===undefined?!![]:![]:!![],'where':_0x3346a5[_0x1bdc('0x16')]?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x18')]||null:null,'attributes':_0x3346a5[_0x1bdc('0x16')]?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x1d')]||null:null,'include':_0x3346a5['options']?_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x3346a5[_0x1bdc('0x16')][_0x1bdc('0x1a')],function(_0x9a471a){return{'model':db[_0x9a471a['model']],'as':_0x9a471a['as'],'attributes':_0x9a471a['attributes'],'include':_0x9a471a[_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x9a471a[_0x1bdc('0x1a')],function(_0x2999d9){return{'model':db[_0x2999d9[_0x1bdc('0x1c')]],'as':_0x2999d9['as'],'attributes':_0x2999d9[_0x1bdc('0x1d')],'include':_0x2999d9[_0x1bdc('0x1a')]?_[_0x1bdc('0x1b')](_0x2999d9[_0x1bdc('0x1a')],function(_0x37667a){return{'model':db[_0x37667a[_0x1bdc('0x1c')]],'as':_0x37667a['as'],'attributes':_0x37667a[_0x1bdc('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x1bdc('0xb')](function(_0x1746d4){logger[_0x1bdc('0xc')]('ShowSalesforceAccount',_0x3346a5);logger[_0x1bdc('0xf')]('ShowSalesforceAccount',_0x3346a5,JSON[_0x1bdc('0x10')](_0x1746d4));_0x4b03c8(_0x1746d4);})[_0x1bdc('0x1e')](function(_0x112c3a){logger[_0x1bdc('0x11')](_0x1bdc('0x1f'),_0x112c3a[_0x1bdc('0x13')],_0x3346a5);_0x4199f4(_0x19ea4e[_0x1bdc('0x11')](0x1f4,_0x112c3a[_0x1bdc('0x13')]));});});}; \ No newline at end of file +var _0x2d8c=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map','model','then','stringify','find','raw','ShowSalesforceAccount','lodash','util'];(function(_0x3cfc01,_0x4ea6b9){var _0x52d02c=function(_0x375398){while(--_0x375398){_0x3cfc01['push'](_0x3cfc01['shift']());}};_0x52d02c(++_0x4ea6b9);}(_0x2d8c,0x14b));var _0xc2d8=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x2d8c[_0x519c88];return _0x4668d7;};'use strict';var _=require(_0xc2d8('0x0'));var util=require(_0xc2d8('0x1'));var moment=require(_0xc2d8('0x2'));var BPromise=require(_0xc2d8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc2d8('0x4'));var db=require(_0xc2d8('0x5'))['db'];var utils=require(_0xc2d8('0x6'));var logger=require(_0xc2d8('0x7'))(_0xc2d8('0x8'));var config=require(_0xc2d8('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc2d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38275a,_0x5041af,_0xd4c6db){return new BPromise(function(_0x15deae,_0x35cca2){return client[_0xc2d8('0xb')](_0x38275a,_0xd4c6db)['then'](function(_0x414aad){logger['info'](_0xc2d8('0xc'),_0x5041af,_0xc2d8('0xd'));logger[_0xc2d8('0xe')](_0xc2d8('0xf'),_0x5041af,_0xc2d8('0xd'),JSON['stringify'](_0x414aad));if(_0x414aad[_0xc2d8('0x10')]){if(_0x414aad['error'][_0xc2d8('0x11')]===0x1f4){logger[_0xc2d8('0x10')](_0xc2d8('0xc'),_0x5041af,_0x414aad[_0xc2d8('0x10')][_0xc2d8('0x12')]);return _0x35cca2(_0x414aad[_0xc2d8('0x10')][_0xc2d8('0x12')]);}logger[_0xc2d8('0x10')](_0xc2d8('0xc'),_0x5041af,_0x414aad[_0xc2d8('0x10')][_0xc2d8('0x12')]);return _0x15deae(_0x414aad['error'][_0xc2d8('0x12')]);}else{logger[_0xc2d8('0x13')](_0xc2d8('0xc'),_0x5041af,_0xc2d8('0xd'));_0x15deae(_0x414aad[_0xc2d8('0x14')][_0xc2d8('0x12')]);}})[_0xc2d8('0x15')](function(_0x3504f2){logger[_0xc2d8('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x5041af,_0x3504f2);_0x35cca2(_0x3504f2);});});}exports[_0xc2d8('0x16')]=function(_0x334b7a){var _0x75b29a=this;return new Promise(function(_0x1ccfab,_0x360c8c){return db[_0xc2d8('0x17')][_0xc2d8('0x18')]({'raw':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1a')]||null:null,'attributes':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1b')]||null:null,'limit':_0x334b7a[_0xc2d8('0x19')]?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1c')]||null:null,'include':_0x334b7a['options']?_0x334b7a[_0xc2d8('0x19')][_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x334b7a['options']['include'],function(_0x30aabe){return{'model':db[_0x30aabe[_0xc2d8('0x1f')]],'as':_0x30aabe['as'],'attributes':_0x30aabe['attributes'],'include':_0x30aabe['include']?_['map'](_0x30aabe[_0xc2d8('0x1d')],function(_0x1ddd04){return{'model':db[_0x1ddd04[_0xc2d8('0x1f')]],'as':_0x1ddd04['as'],'attributes':_0x1ddd04[_0xc2d8('0x1b')],'include':_0x1ddd04[_0xc2d8('0x1d')]?_['map'](_0x1ddd04[_0xc2d8('0x1d')],function(_0x5e1da4){return{'model':db[_0x5e1da4[_0xc2d8('0x1f')]],'as':_0x5e1da4['as'],'attributes':_0x5e1da4[_0xc2d8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2d8('0x20')](function(_0x142db3){logger[_0xc2d8('0x13')](_0xc2d8('0x16'),_0x334b7a);logger[_0xc2d8('0xe')](_0xc2d8('0x16'),_0x334b7a,JSON[_0xc2d8('0x21')](_0x142db3));_0x1ccfab(_0x142db3);})[_0xc2d8('0x15')](function(_0x9a0705){logger[_0xc2d8('0x10')](_0xc2d8('0x16'),_0x9a0705[_0xc2d8('0x12')],_0x334b7a);_0x360c8c(_0x75b29a[_0xc2d8('0x10')](0x1f4,_0x9a0705['message']));});});};exports['ShowSalesforceAccount']=function(_0x40b0f9){var _0x530b02=this;return new Promise(function(_0x57e406,_0x4aa560){return db['SalesforceAccount'][_0xc2d8('0x22')]({'raw':_0x40b0f9['options']?_0x40b0f9[_0xc2d8('0x19')][_0xc2d8('0x23')]===undefined?!![]:![]:!![],'where':_0x40b0f9['options']?_0x40b0f9[_0xc2d8('0x19')][_0xc2d8('0x1a')]||null:null,'attributes':_0x40b0f9[_0xc2d8('0x19')]?_0x40b0f9[_0xc2d8('0x19')]['attributes']||null:null,'include':_0x40b0f9['options']?_0x40b0f9['options'][_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x40b0f9['options']['include'],function(_0x42c086){return{'model':db[_0x42c086['model']],'as':_0x42c086['as'],'attributes':_0x42c086[_0xc2d8('0x1b')],'include':_0x42c086[_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x42c086['include'],function(_0x4b46ae){return{'model':db[_0x4b46ae[_0xc2d8('0x1f')]],'as':_0x4b46ae['as'],'attributes':_0x4b46ae[_0xc2d8('0x1b')],'include':_0x4b46ae[_0xc2d8('0x1d')]?_[_0xc2d8('0x1e')](_0x4b46ae[_0xc2d8('0x1d')],function(_0x4d79d5){return{'model':db[_0x4d79d5[_0xc2d8('0x1f')]],'as':_0x4d79d5['as'],'attributes':_0x4d79d5[_0xc2d8('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc2d8('0x20')](function(_0x3b7109){logger[_0xc2d8('0x13')]('ShowSalesforceAccount',_0x40b0f9);logger[_0xc2d8('0xe')](_0xc2d8('0x24'),_0x40b0f9,JSON[_0xc2d8('0x21')](_0x3b7109));_0x57e406(_0x3b7109);})[_0xc2d8('0x15')](function(_0x218772){logger['error']('ShowSalesforceAccount',_0x218772['message'],_0x40b0f9);_0x4aa560(_0x530b02[_0xc2d8('0x10')](0x1f4,_0x218772['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 710b0e1..65f9918 100644 --- a/server/api/intSalesforceConfiguration/index.js +++ b/server/api/intSalesforceConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x5239b7,_0x46f4a7){var _0x2bd70d=function(_0x248b2d){while(--_0x248b2d){_0x5239b7['push'](_0x5239b7['shift']());}};_0x2bd70d(++_0x46f4a7);}(_0x2ef3,0xba));var _0x32ef=function(_0x38a2e6,_0x55a185){_0x38a2e6=_0x38a2e6-0x0;var _0x2ed339=_0x2ef3[_0x38a2e6];return _0x2ed339;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x53050d,_0x2078fc){var _0xc353b4=function(_0x4b1bdf){while(--_0x4b1bdf){_0x53050d['push'](_0x53050d['shift']());}};_0xc353b4(++_0x2078fc);}(_0xadb5,0xad));var _0x5adb=function(_0x20be63,_0x117003){_0x20be63=_0x20be63-0x0;var _0x28c14c=_0xadb5[_0x20be63];return _0x28c14c;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 454b9d9..c63e8f0 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 _0xaf1c=['contact','account_contact_lead','account','nothing','lead','exports','STRING','ENUM','Task','Case','contact_lead'];(function(_0x1a58d9,_0x1ac054){var _0xfba178=function(_0x1dd221){while(--_0x1dd221){_0x1a58d9['push'](_0x1a58d9['shift']());}};_0xfba178(++_0x1ac054);}(_0xaf1c,0x1de));var _0xcaf1=function(_0x3f21e0,_0x3e3f3d){_0x3f21e0=_0x3f21e0-0x0;var _0x19b54d=_0xaf1c[_0x3f21e0];return _0x19b54d;};'use strict';var Sequelize=require('sequelize');module[_0xcaf1('0x0')]={'name':{'type':Sequelize[_0xcaf1('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x3'),_0xcaf1('0x4')),'defaultValue':_0xcaf1('0x3')},'moduleSearch':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x5'),_0xcaf1('0x6'),'lead',_0xcaf1('0x7'),_0xcaf1('0x8')),'defaultValue':_0xcaf1('0x5')},'moduleCreate':{'type':Sequelize[_0xcaf1('0x2')](_0xcaf1('0x9'),_0xcaf1('0x6'),_0xcaf1('0xa'),_0xcaf1('0x8')),'defaultValue':_0xcaf1('0xa')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xcaf1('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0xcaf1('0x1')]}}; \ No newline at end of file +var _0x6bb0=['ENUM','Task','Case','contact_lead','account_contact_lead','account','nothing','lead','sequelize','STRING'];(function(_0x346c14,_0x1a8ce7){var _0x72bdbf=function(_0x3e6a67){while(--_0x3e6a67){_0x346c14['push'](_0x346c14['shift']());}};_0x72bdbf(++_0x1a8ce7);}(_0x6bb0,0x10c));var _0x06bb=function(_0x2d4c59,_0xc7dea0){_0x2d4c59=_0x2d4c59-0x0;var _0x134b9b=_0x6bb0[_0x2d4c59];return _0x134b9b;};'use strict';var Sequelize=require(_0x06bb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x06bb('0x1')]},'ticketType':{'type':Sequelize[_0x06bb('0x2')](_0x06bb('0x3'),_0x06bb('0x4')),'defaultValue':_0x06bb('0x3')},'moduleSearch':{'type':Sequelize[_0x06bb('0x2')](_0x06bb('0x5'),'contact','lead',_0x06bb('0x6'),_0x06bb('0x7')),'defaultValue':_0x06bb('0x5')},'moduleCreate':{'type':Sequelize[_0x06bb('0x2')](_0x06bb('0x8'),'contact',_0x06bb('0x9'),'account'),'defaultValue':_0x06bb('0x9')},'leadId':{'type':Sequelize[_0x06bb('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x06bb('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x06bb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index feb3cf6..26390b0 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 _0x2bd7=['querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','SalesforceConfiguration','includeAll','findAll','catch','show','params','keys','include','find','create','body','update','findOne','SalesforceField','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x475f77,_0x5bda26){var _0x202100=function(_0x2f6ea2){while(--_0x2f6ea2){_0x475f77['push'](_0x475f77['shift']());}};_0x202100(++_0x5bda26);}(_0x2bd7,0x1d0));var _0x72bd=function(_0x25247b,_0x360847){_0x25247b=_0x25247b-0x0;var _0x5bfbc9=_0x2bd7[_0x25247b];return _0x5bfbc9;};'use strict';var emlformat=require(_0x72bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x72bd('0x1'));var jsonpatch=require(_0x72bd('0x2'));var rp=require(_0x72bd('0x3'));var moment=require(_0x72bd('0x4'));var BPromise=require(_0x72bd('0x5'));var Mustache=require(_0x72bd('0x6'));var util=require(_0x72bd('0x7'));var path=require(_0x72bd('0x8'));var sox=require('sox');var csv=require(_0x72bd('0x9'));var ejs=require(_0x72bd('0xa'));var fs=require('fs');var fs_extra=require(_0x72bd('0xb'));var _=require(_0x72bd('0xc'));var squel=require(_0x72bd('0xd'));var crypto=require(_0x72bd('0xe'));var jsforce=require(_0x72bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x72bd('0x9'));var querystring=require(_0x72bd('0x10'));var Papa=require(_0x72bd('0x11'));var Redis=require(_0x72bd('0x12'));var authService=require(_0x72bd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x72bd('0x14'))(_0x72bd('0x15'));var utils=require(_0x72bd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x72bd('0x17'));var db=require(_0x72bd('0x18'))['db'];function respondWithStatusCode(_0x2e46da,_0x1c8770){_0x1c8770=_0x1c8770||0xcc;return function(_0x25971d){if(_0x25971d){return _0x2e46da[_0x72bd('0x19')](_0x1c8770);}return _0x2e46da[_0x72bd('0x1a')](_0x1c8770)[_0x72bd('0x1b')]();};}function respondWithResult(_0x5e5c04,_0x77b5e2){_0x77b5e2=_0x77b5e2||0xc8;return function(_0x2e41fb){if(_0x2e41fb){return _0x5e5c04[_0x72bd('0x1a')](_0x77b5e2)[_0x72bd('0x1c')](_0x2e41fb);}};}function respondWithFilteredResult(_0x12bf7e,_0x3c82bc){return function(_0x2cb387){if(_0x2cb387){var _0x4c4eb6=typeof _0x3c82bc[_0x72bd('0x1d')]===_0x72bd('0x1e')&&typeof _0x3c82bc[_0x72bd('0x1f')]===_0x72bd('0x1e');var _0x27a403=_0x2cb387[_0x72bd('0x20')];var _0x1bc0d7=_0x4c4eb6?0x0:_0x3c82bc['offset'];var _0x44b6b2=_0x4c4eb6?_0x2cb387[_0x72bd('0x20')]:_0x3c82bc[_0x72bd('0x1d')]+_0x3c82bc['limit'];var _0x3783a0;if(_0x44b6b2>=_0x27a403){_0x44b6b2=_0x27a403;_0x3783a0=0xc8;}else{_0x3783a0=0xce;}_0x12bf7e[_0x72bd('0x1a')](_0x3783a0);return _0x12bf7e[_0x72bd('0x21')](_0x72bd('0x22'),_0x1bc0d7+'-'+_0x44b6b2+'/'+_0x27a403)[_0x72bd('0x1c')](_0x2cb387);}return null;};}function patchUpdates(_0x5c61f6){return function(_0x2d426a){try{jsonpatch[_0x72bd('0x23')](_0x2d426a,_0x5c61f6,!![]);}catch(_0x29ce47){return BPromise['reject'](_0x29ce47);}return _0x2d426a[_0x72bd('0x24')]();};}function saveUpdates(_0x2c1514,_0x3cba90){return function(_0x1dfe30){if(_0x1dfe30){return _0x1dfe30['update'](_0x2c1514)[_0x72bd('0x25')](function(_0x1c673c){return _0x1c673c;});}return null;};}function removeEntity(_0x5c76d3,_0x6b205e){return function(_0x389e61){if(_0x389e61){return _0x389e61[_0x72bd('0x26')]()['then'](function(){_0x5c76d3['status'](0xcc)[_0x72bd('0x1b')]();});}};}function handleEntityNotFound(_0x34bb3a,_0x471e17){return function(_0x5f768){if(!_0x5f768){_0x34bb3a['sendStatus'](0x194);}return _0x5f768;};}function handleError(_0x1c775a,_0x3e9a3d){_0x3e9a3d=_0x3e9a3d||0x1f4;return function(_0x3e76e4){logger[_0x72bd('0x27')](_0x3e76e4[_0x72bd('0x28')]);if(_0x3e76e4['name']){delete _0x3e76e4[_0x72bd('0x29')];}_0x1c775a[_0x72bd('0x1a')](_0x3e9a3d)[_0x72bd('0x2a')](_0x3e76e4);};}exports[_0x72bd('0x2b')]=function(_0x2c733c,_0x7b278a){var _0x2bcf6b={},_0x582756={},_0x4008ef={'count':0x0,'rows':[]};var _0x35a0e2=_[_0x72bd('0x2c')](db['SalesforceConfiguration'][_0x72bd('0x2d')],function(_0x133606){return{'name':_0x133606[_0x72bd('0x2e')],'type':_0x133606[_0x72bd('0x2f')]['key']};});_0x582756[_0x72bd('0x30')]=_[_0x72bd('0x2c')](_0x35a0e2,_0x72bd('0x29'));_0x582756[_0x72bd('0x31')]=_['keys'](_0x2c733c[_0x72bd('0x31')]);_0x582756[_0x72bd('0x32')]=_['intersection'](_0x582756[_0x72bd('0x30')],_0x582756[_0x72bd('0x31')]);_0x2bcf6b[_0x72bd('0x33')]=_[_0x72bd('0x34')](_0x582756[_0x72bd('0x30')],qs['fields'](_0x2c733c[_0x72bd('0x31')][_0x72bd('0x35')]));_0x2bcf6b[_0x72bd('0x33')]=_0x2bcf6b[_0x72bd('0x33')][_0x72bd('0x36')]?_0x2bcf6b[_0x72bd('0x33')]:_0x582756[_0x72bd('0x30')];if(!_0x2c733c[_0x72bd('0x31')][_0x72bd('0x37')](_0x72bd('0x38'))){_0x2bcf6b[_0x72bd('0x1f')]=qs[_0x72bd('0x1f')](_0x2c733c[_0x72bd('0x31')][_0x72bd('0x1f')]);_0x2bcf6b['offset']=qs['offset'](_0x2c733c['query'][_0x72bd('0x1d')]);}_0x2bcf6b[_0x72bd('0x39')]=qs[_0x72bd('0x3a')](_0x2c733c[_0x72bd('0x31')]['sort']);_0x2bcf6b['where']=qs[_0x72bd('0x32')](_[_0x72bd('0x3b')](_0x2c733c[_0x72bd('0x31')],_0x582756[_0x72bd('0x32')]),_0x35a0e2);if(_0x2c733c[_0x72bd('0x31')][_0x72bd('0x3c')]){_0x2bcf6b[_0x72bd('0x3d')]=_[_0x72bd('0x3e')](_0x2bcf6b[_0x72bd('0x3d')],{'$or':_[_0x72bd('0x2c')](_0x35a0e2,function(_0x16aeb6){if(_0x16aeb6[_0x72bd('0x2f')]!=='VIRTUAL'){var _0x473e4e={};_0x473e4e[_0x16aeb6['name']]={'$like':'%'+_0x2c733c[_0x72bd('0x31')]['filter']+'%'};return _0x473e4e;}})});}_0x2bcf6b=_[_0x72bd('0x3e')]({},_0x2bcf6b,_0x2c733c[_0x72bd('0x3f')]);var _0x2ee7de={'where':_0x2bcf6b[_0x72bd('0x3d')]};return db[_0x72bd('0x40')][_0x72bd('0x20')](_0x2ee7de)['then'](function(_0x43faa7){_0x4008ef['count']=_0x43faa7;if(_0x2c733c['query'][_0x72bd('0x41')]){_0x2bcf6b['include']=[{'all':!![]}];}return db['SalesforceConfiguration'][_0x72bd('0x42')](_0x2bcf6b);})[_0x72bd('0x25')](function(_0x24a9a9){_0x4008ef['rows']=_0x24a9a9;return _0x4008ef;})[_0x72bd('0x25')](respondWithFilteredResult(_0x7b278a,_0x2bcf6b))[_0x72bd('0x43')](handleError(_0x7b278a,null));};exports[_0x72bd('0x44')]=function(_0x2827c1,_0x153538){var _0x5adcdf={'raw':![],'where':{'id':_0x2827c1[_0x72bd('0x45')]['id']}},_0x360650={};_0x360650[_0x72bd('0x30')]=_['keys'](db[_0x72bd('0x40')][_0x72bd('0x2d')]);_0x360650[_0x72bd('0x31')]=_[_0x72bd('0x46')](_0x2827c1[_0x72bd('0x31')]);_0x360650[_0x72bd('0x32')]=_[_0x72bd('0x34')](_0x360650[_0x72bd('0x30')],_0x360650[_0x72bd('0x31')]);_0x5adcdf[_0x72bd('0x33')]=_[_0x72bd('0x34')](_0x360650[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x2827c1[_0x72bd('0x31')]['fields']));_0x5adcdf[_0x72bd('0x33')]=_0x5adcdf[_0x72bd('0x33')][_0x72bd('0x36')]?_0x5adcdf[_0x72bd('0x33')]:_0x360650['model'];if(_0x2827c1[_0x72bd('0x31')][_0x72bd('0x41')]){_0x5adcdf[_0x72bd('0x47')]=[{'all':!![]}];}_0x5adcdf=_['merge']({},_0x5adcdf,_0x2827c1[_0x72bd('0x3f')]);return db[_0x72bd('0x40')][_0x72bd('0x48')](_0x5adcdf)[_0x72bd('0x25')](handleEntityNotFound(_0x153538,null))[_0x72bd('0x25')](respondWithResult(_0x153538,null))['catch'](handleError(_0x153538,null));};exports[_0x72bd('0x49')]=function(_0x11e7bc,_0x2d2c3e){return db[_0x72bd('0x40')][_0x72bd('0x49')](_0x11e7bc[_0x72bd('0x4a')],{})[_0x72bd('0x25')](respondWithResult(_0x2d2c3e,0xc9))[_0x72bd('0x43')](handleError(_0x2d2c3e,null));};exports[_0x72bd('0x4b')]=function(_0x404fc8,_0x447fe1){if(_0x404fc8[_0x72bd('0x4a')]['id']){delete _0x404fc8['body']['id'];}return db[_0x72bd('0x40')][_0x72bd('0x48')]({'where':{'id':_0x404fc8[_0x72bd('0x45')]['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x447fe1,null))['then'](saveUpdates(_0x404fc8[_0x72bd('0x4a')],null))['then'](respondWithResult(_0x447fe1,null))['catch'](handleError(_0x447fe1,null));};exports[_0x72bd('0x26')]=function(_0x4c9991,_0x49c652){return db[_0x72bd('0x40')][_0x72bd('0x48')]({'where':{'id':_0x4c9991['params']['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x49c652,null))['then'](removeEntity(_0x49c652,null))[_0x72bd('0x43')](handleError(_0x49c652,null));};exports['getFields']=function(_0x287494,_0x52c3b0,_0x13f4d5){var _0x113f4a={};var _0x2bd679={};var _0x4a48a4;var _0x42bbf2;return db[_0x72bd('0x40')][_0x72bd('0x4c')]({'where':{'id':_0x287494[_0x72bd('0x45')]['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x52c3b0,null))['then'](function(_0x39146a){if(_0x39146a){_0x4a48a4=_0x39146a;_0x2bd679[_0x72bd('0x30')]=_[_0x72bd('0x46')](db[_0x72bd('0x4d')][_0x72bd('0x2d')]);_0x2bd679[_0x72bd('0x31')]=_[_0x72bd('0x46')](_0x287494['query']);_0x2bd679['filters']=_['intersection'](_0x2bd679[_0x72bd('0x30')],_0x2bd679[_0x72bd('0x31')]);_0x113f4a[_0x72bd('0x33')]=_[_0x72bd('0x34')](_0x2bd679[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x287494[_0x72bd('0x31')][_0x72bd('0x35')]));_0x113f4a['attributes']=_0x113f4a[_0x72bd('0x33')][_0x72bd('0x36')]?_0x113f4a[_0x72bd('0x33')]:_0x2bd679['model'];_0x113f4a[_0x72bd('0x39')]=qs[_0x72bd('0x3a')](_0x287494['query']['sort']);_0x113f4a[_0x72bd('0x3d')]=qs['filters'](_[_0x72bd('0x3b')](_0x287494[_0x72bd('0x31')],_0x2bd679[_0x72bd('0x32')]));if(_0x287494[_0x72bd('0x31')][_0x72bd('0x3c')]){_0x113f4a[_0x72bd('0x3d')]=_[_0x72bd('0x3e')](_0x113f4a[_0x72bd('0x3d')],{'$or':_['map'](_0x113f4a[_0x72bd('0x33')],function(_0x22501c){var _0x551b14={};_0x551b14[_0x22501c]={'$like':'%'+_0x287494[_0x72bd('0x31')][_0x72bd('0x3c')]+'%'};return _0x551b14;})});}_0x113f4a=_[_0x72bd('0x3e')]({},_0x113f4a,_0x287494[_0x72bd('0x3f')]);return _0x4a48a4['getFields'](_0x113f4a);}})[_0x72bd('0x25')](function(_0xaa9aa4){if(_0xaa9aa4){_0x42bbf2=_0xaa9aa4['length'];if(!_0x287494[_0x72bd('0x31')]['hasOwnProperty'](_0x72bd('0x38'))){_0x113f4a[_0x72bd('0x1f')]=qs[_0x72bd('0x1f')](_0x287494[_0x72bd('0x31')][_0x72bd('0x1f')]);_0x113f4a[_0x72bd('0x1d')]=qs['offset'](_0x287494['query'][_0x72bd('0x1d')]);}return _0x4a48a4['getFields'](_0x113f4a);}})[_0x72bd('0x25')](function(_0x2deaf7){if(_0x2deaf7){return _0x2deaf7?{'count':_0x42bbf2,'rows':_0x2deaf7}:null;}})['then'](respondWithResult(_0x52c3b0,null))['catch'](handleError(_0x52c3b0,null));};exports[_0x72bd('0x4e')]=function(_0x107fc4,_0x35e94b,_0x58a8b5){var _0x33e0b7={};var _0x2fe626={};var _0x4a9a53;var _0x4356e9;return db[_0x72bd('0x40')][_0x72bd('0x4c')]({'where':{'id':_0x107fc4[_0x72bd('0x45')]['id']}})['then'](handleEntityNotFound(_0x35e94b,null))['then'](function(_0x5c42d0){if(_0x5c42d0){_0x4a9a53=_0x5c42d0;_0x2fe626[_0x72bd('0x30')]=_[_0x72bd('0x46')](db[_0x72bd('0x4d')][_0x72bd('0x2d')]);_0x2fe626[_0x72bd('0x31')]=_[_0x72bd('0x46')](_0x107fc4[_0x72bd('0x31')]);_0x2fe626['filters']=_[_0x72bd('0x34')](_0x2fe626[_0x72bd('0x30')],_0x2fe626[_0x72bd('0x31')]);_0x33e0b7['attributes']=_[_0x72bd('0x34')](_0x2fe626[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x107fc4[_0x72bd('0x31')][_0x72bd('0x35')]));_0x33e0b7[_0x72bd('0x33')]=_0x33e0b7[_0x72bd('0x33')][_0x72bd('0x36')]?_0x33e0b7[_0x72bd('0x33')]:_0x2fe626['model'];_0x33e0b7['order']=qs[_0x72bd('0x3a')](_0x107fc4['query'][_0x72bd('0x3a')]);_0x33e0b7[_0x72bd('0x3d')]=qs['filters'](_['pick'](_0x107fc4[_0x72bd('0x31')],_0x2fe626[_0x72bd('0x32')]));if(_0x107fc4['query'][_0x72bd('0x3c')]){_0x33e0b7['where']=_[_0x72bd('0x3e')](_0x33e0b7[_0x72bd('0x3d')],{'$or':_['map'](_0x33e0b7[_0x72bd('0x33')],function(_0x2e3ead){var _0xa87277={};_0xa87277[_0x2e3ead]={'$like':'%'+_0x107fc4['query'][_0x72bd('0x3c')]+'%'};return _0xa87277;})});}_0x33e0b7=_[_0x72bd('0x3e')]({},_0x33e0b7,_0x107fc4[_0x72bd('0x3f')]);return _0x4a9a53[_0x72bd('0x4e')](_0x33e0b7);}})[_0x72bd('0x25')](function(_0x53b27c){if(_0x53b27c){_0x4356e9=_0x53b27c['length'];if(!_0x107fc4[_0x72bd('0x31')][_0x72bd('0x37')](_0x72bd('0x38'))){_0x33e0b7[_0x72bd('0x1f')]=qs['limit'](_0x107fc4[_0x72bd('0x31')]['limit']);_0x33e0b7['offset']=qs[_0x72bd('0x1d')](_0x107fc4[_0x72bd('0x31')]['offset']);}return _0x4a9a53['getSubjects'](_0x33e0b7);}})[_0x72bd('0x25')](function(_0x55b1d5){if(_0x55b1d5){return _0x55b1d5?{'count':_0x4356e9,'rows':_0x55b1d5}:null;}})['then'](respondWithResult(_0x35e94b,null))[_0x72bd('0x43')](handleError(_0x35e94b,null));};exports[_0x72bd('0x4f')]=function(_0x4b5353,_0x3e04c6,_0x366367){var _0x150bfb={};var _0x2ec50c={};var _0x474847;var _0x2300f6;return db['SalesforceConfiguration'][_0x72bd('0x4c')]({'where':{'id':_0x4b5353[_0x72bd('0x45')]['id']}})[_0x72bd('0x25')](handleEntityNotFound(_0x3e04c6,null))[_0x72bd('0x25')](function(_0x290fa3){if(_0x290fa3){_0x474847=_0x290fa3;_0x2ec50c[_0x72bd('0x30')]=_[_0x72bd('0x46')](db[_0x72bd('0x4d')][_0x72bd('0x2d')]);_0x2ec50c[_0x72bd('0x31')]=_['keys'](_0x4b5353[_0x72bd('0x31')]);_0x2ec50c[_0x72bd('0x32')]=_['intersection'](_0x2ec50c[_0x72bd('0x30')],_0x2ec50c[_0x72bd('0x31')]);_0x150bfb[_0x72bd('0x33')]=_['intersection'](_0x2ec50c[_0x72bd('0x30')],qs[_0x72bd('0x35')](_0x4b5353[_0x72bd('0x31')][_0x72bd('0x35')]));_0x150bfb[_0x72bd('0x33')]=_0x150bfb[_0x72bd('0x33')]['length']?_0x150bfb[_0x72bd('0x33')]:_0x2ec50c[_0x72bd('0x30')];_0x150bfb[_0x72bd('0x39')]=qs[_0x72bd('0x3a')](_0x4b5353['query'][_0x72bd('0x3a')]);_0x150bfb[_0x72bd('0x3d')]=qs[_0x72bd('0x32')](_[_0x72bd('0x3b')](_0x4b5353[_0x72bd('0x31')],_0x2ec50c[_0x72bd('0x32')]));if(_0x4b5353['query'][_0x72bd('0x3c')]){_0x150bfb[_0x72bd('0x3d')]=_[_0x72bd('0x3e')](_0x150bfb['where'],{'$or':_['map'](_0x150bfb['attributes'],function(_0x313534){var _0x2b51d5={};_0x2b51d5[_0x313534]={'$like':'%'+_0x4b5353[_0x72bd('0x31')][_0x72bd('0x3c')]+'%'};return _0x2b51d5;})});}_0x150bfb=_[_0x72bd('0x3e')]({},_0x150bfb,_0x4b5353['options']);return _0x474847[_0x72bd('0x4f')](_0x150bfb);}})[_0x72bd('0x25')](function(_0x80fccf){if(_0x80fccf){_0x2300f6=_0x80fccf[_0x72bd('0x36')];if(!_0x4b5353[_0x72bd('0x31')][_0x72bd('0x37')](_0x72bd('0x38'))){_0x150bfb[_0x72bd('0x1f')]=qs[_0x72bd('0x1f')](_0x4b5353[_0x72bd('0x31')][_0x72bd('0x1f')]);_0x150bfb[_0x72bd('0x1d')]=qs[_0x72bd('0x1d')](_0x4b5353[_0x72bd('0x31')][_0x72bd('0x1d')]);}return _0x474847['getDescriptions'](_0x150bfb);}})[_0x72bd('0x25')](function(_0x331408){if(_0x331408){return _0x331408?{'count':_0x2300f6,'rows':_0x331408}:null;}})[_0x72bd('0x25')](respondWithResult(_0x3e04c6,null))[_0x72bd('0x43')](handleError(_0x3e04c6,null));}; \ No newline at end of file +var _0xb55e=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','SalesforceConfiguration','findAll','rows','catch','show','keys','create','body','find','params','getFields','SalesforceField','rawAttributes','order','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xb55e,0x106));var _0xeb55=function(_0x3b70e0,_0x163dc6){_0x3b70e0=_0x3b70e0-0x0;var _0x342050=_0xb55e[_0x3b70e0];return _0x342050;};'use strict';var emlformat=require(_0xeb55('0x0'));var rimraf=require(_0xeb55('0x1'));var zipdir=require(_0xeb55('0x2'));var jsonpatch=require(_0xeb55('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xeb55('0x4'));var Mustache=require(_0xeb55('0x5'));var util=require('util');var path=require(_0xeb55('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb55('0x7'));var _=require(_0xeb55('0x8'));var squel=require(_0xeb55('0x9'));var crypto=require(_0xeb55('0xa'));var jsforce=require(_0xeb55('0xb'));var deskjs=require(_0xeb55('0xc'));var toCsv=require(_0xeb55('0xd'));var querystring=require(_0xeb55('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xeb55('0xf'));var qs=require(_0xeb55('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb55('0x11'));var logger=require('../../config/logger')(_0xeb55('0x12'));var utils=require(_0xeb55('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xeb55('0x14'));var db=require(_0xeb55('0x15'))['db'];function respondWithStatusCode(_0x2ae056,_0x1f3430){_0x1f3430=_0x1f3430||0xcc;return function(_0x14ae46){if(_0x14ae46){return _0x2ae056[_0xeb55('0x16')](_0x1f3430);}return _0x2ae056[_0xeb55('0x17')](_0x1f3430)[_0xeb55('0x18')]();};}function respondWithResult(_0xd44b18,_0x3c4626){_0x3c4626=_0x3c4626||0xc8;return function(_0x264f36){if(_0x264f36){return _0xd44b18[_0xeb55('0x17')](_0x3c4626)[_0xeb55('0x19')](_0x264f36);}};}function respondWithFilteredResult(_0x4462d4,_0x2d555b){return function(_0x2bbf7b){if(_0x2bbf7b){var _0x901091=typeof _0x2d555b[_0xeb55('0x1a')]===_0xeb55('0x1b')&&typeof _0x2d555b['limit']===_0xeb55('0x1b');var _0x177baf=_0x2bbf7b[_0xeb55('0x1c')];var _0xb2b680=_0x901091?0x0:_0x2d555b[_0xeb55('0x1a')];var _0x4cfb7e=_0x901091?_0x2bbf7b[_0xeb55('0x1c')]:_0x2d555b[_0xeb55('0x1a')]+_0x2d555b[_0xeb55('0x1d')];var _0x513b81;if(_0x4cfb7e>=_0x177baf){_0x4cfb7e=_0x177baf;_0x513b81=0xc8;}else{_0x513b81=0xce;}_0x4462d4[_0xeb55('0x17')](_0x513b81);return _0x4462d4[_0xeb55('0x1e')]('Content-Range',_0xb2b680+'-'+_0x4cfb7e+'/'+_0x177baf)[_0xeb55('0x19')](_0x2bbf7b);}return null;};}function patchUpdates(_0x377fbb){return function(_0x33c5be){try{jsonpatch[_0xeb55('0x1f')](_0x33c5be,_0x377fbb,!![]);}catch(_0x424a83){return BPromise['reject'](_0x424a83);}return _0x33c5be[_0xeb55('0x20')]();};}function saveUpdates(_0x557a05,_0x44f9b7){return function(_0x44bddf){if(_0x44bddf){return _0x44bddf[_0xeb55('0x21')](_0x557a05)[_0xeb55('0x22')](function(_0x41cf84){return _0x41cf84;});}return null;};}function removeEntity(_0x4cae05,_0x487622){return function(_0x634301){if(_0x634301){return _0x634301['destroy']()[_0xeb55('0x22')](function(){_0x4cae05[_0xeb55('0x17')](0xcc)[_0xeb55('0x18')]();});}};}function handleEntityNotFound(_0x42ed19,_0x5e6bec){return function(_0x3283a4){if(!_0x3283a4){_0x42ed19[_0xeb55('0x16')](0x194);}return _0x3283a4;};}function handleError(_0x467433,_0x2457d9){_0x2457d9=_0x2457d9||0x1f4;return function(_0x50264f){logger[_0xeb55('0x23')](_0x50264f[_0xeb55('0x24')]);if(_0x50264f[_0xeb55('0x25')]){delete _0x50264f[_0xeb55('0x25')];}_0x467433[_0xeb55('0x17')](_0x2457d9)[_0xeb55('0x26')](_0x50264f);};}exports[_0xeb55('0x27')]=function(_0x16d323,_0x27f7c2){var _0x379fba={},_0x5a40d2={},_0x55c4d9={'count':0x0,'rows':[]};var _0x547e6e=_[_0xeb55('0x28')](db['SalesforceConfiguration']['rawAttributes'],function(_0x31ca6c){return{'name':_0x31ca6c[_0xeb55('0x29')],'type':_0x31ca6c[_0xeb55('0x2a')][_0xeb55('0x2b')]};});_0x5a40d2[_0xeb55('0x2c')]=_[_0xeb55('0x28')](_0x547e6e,_0xeb55('0x25'));_0x5a40d2['query']=_['keys'](_0x16d323[_0xeb55('0x2d')]);_0x5a40d2[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x5a40d2[_0xeb55('0x2c')],_0x5a40d2[_0xeb55('0x2d')]);_0x379fba[_0xeb55('0x30')]=_[_0xeb55('0x2f')](_0x5a40d2['model'],qs[_0xeb55('0x31')](_0x16d323['query'][_0xeb55('0x31')]));_0x379fba[_0xeb55('0x30')]=_0x379fba['attributes'][_0xeb55('0x32')]?_0x379fba[_0xeb55('0x30')]:_0x5a40d2[_0xeb55('0x2c')];if(!_0x16d323['query'][_0xeb55('0x33')](_0xeb55('0x34'))){_0x379fba[_0xeb55('0x1d')]=qs[_0xeb55('0x1d')](_0x16d323[_0xeb55('0x2d')]['limit']);_0x379fba['offset']=qs['offset'](_0x16d323[_0xeb55('0x2d')][_0xeb55('0x1a')]);}_0x379fba['order']=qs[_0xeb55('0x35')](_0x16d323[_0xeb55('0x2d')][_0xeb55('0x35')]);_0x379fba['where']=qs[_0xeb55('0x2e')](_[_0xeb55('0x36')](_0x16d323[_0xeb55('0x2d')],_0x5a40d2[_0xeb55('0x2e')]),_0x547e6e);if(_0x16d323['query'][_0xeb55('0x37')]){_0x379fba[_0xeb55('0x38')]=_[_0xeb55('0x39')](_0x379fba[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x547e6e,function(_0x38ab13){if(_0x38ab13[_0xeb55('0x2a')]!==_0xeb55('0x3a')){var _0x3697ff={};_0x3697ff[_0x38ab13[_0xeb55('0x25')]]={'$like':'%'+_0x16d323[_0xeb55('0x2d')][_0xeb55('0x37')]+'%'};return _0x3697ff;}})});}_0x379fba=_[_0xeb55('0x39')]({},_0x379fba,_0x16d323[_0xeb55('0x3b')]);var _0x2b9bd8={'where':_0x379fba['where']};return db['SalesforceConfiguration'][_0xeb55('0x1c')](_0x2b9bd8)[_0xeb55('0x22')](function(_0x1fdf5a){_0x55c4d9[_0xeb55('0x1c')]=_0x1fdf5a;if(_0x16d323[_0xeb55('0x2d')][_0xeb55('0x3c')]){_0x379fba[_0xeb55('0x3d')]=[{'all':!![]}];}return db[_0xeb55('0x3e')][_0xeb55('0x3f')](_0x379fba);})[_0xeb55('0x22')](function(_0x425b4d){_0x55c4d9[_0xeb55('0x40')]=_0x425b4d;return _0x55c4d9;})[_0xeb55('0x22')](respondWithFilteredResult(_0x27f7c2,_0x379fba))[_0xeb55('0x41')](handleError(_0x27f7c2,null));};exports[_0xeb55('0x42')]=function(_0x1362b6,_0x2d5222){var _0x5b4f10={'raw':![],'where':{'id':_0x1362b6['params']['id']}},_0x404272={};_0x404272['model']=_[_0xeb55('0x43')](db[_0xeb55('0x3e')]['rawAttributes']);_0x404272[_0xeb55('0x2d')]=_[_0xeb55('0x43')](_0x1362b6[_0xeb55('0x2d')]);_0x404272[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x404272['model'],_0x404272[_0xeb55('0x2d')]);_0x5b4f10[_0xeb55('0x30')]=_['intersection'](_0x404272[_0xeb55('0x2c')],qs[_0xeb55('0x31')](_0x1362b6[_0xeb55('0x2d')][_0xeb55('0x31')]));_0x5b4f10['attributes']=_0x5b4f10[_0xeb55('0x30')][_0xeb55('0x32')]?_0x5b4f10[_0xeb55('0x30')]:_0x404272[_0xeb55('0x2c')];if(_0x1362b6[_0xeb55('0x2d')]['includeAll']){_0x5b4f10[_0xeb55('0x3d')]=[{'all':!![]}];}_0x5b4f10=_[_0xeb55('0x39')]({},_0x5b4f10,_0x1362b6[_0xeb55('0x3b')]);return db['SalesforceConfiguration']['find'](_0x5b4f10)['then'](handleEntityNotFound(_0x2d5222,null))[_0xeb55('0x22')](respondWithResult(_0x2d5222,null))[_0xeb55('0x41')](handleError(_0x2d5222,null));};exports[_0xeb55('0x44')]=function(_0x5065c1,_0x483b24){return db[_0xeb55('0x3e')]['create'](_0x5065c1[_0xeb55('0x45')],{})[_0xeb55('0x22')](respondWithResult(_0x483b24,0xc9))['catch'](handleError(_0x483b24,null));};exports['update']=function(_0x33956e,_0x186280){if(_0x33956e[_0xeb55('0x45')]['id']){delete _0x33956e[_0xeb55('0x45')]['id'];}return db[_0xeb55('0x3e')][_0xeb55('0x46')]({'where':{'id':_0x33956e[_0xeb55('0x47')]['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x186280,null))['then'](saveUpdates(_0x33956e[_0xeb55('0x45')],null))[_0xeb55('0x22')](respondWithResult(_0x186280,null))[_0xeb55('0x41')](handleError(_0x186280,null));};exports['destroy']=function(_0x387573,_0x2d2c6b){return db['SalesforceConfiguration']['find']({'where':{'id':_0x387573['params']['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x2d2c6b,null))[_0xeb55('0x22')](removeEntity(_0x2d2c6b,null))['catch'](handleError(_0x2d2c6b,null));};exports[_0xeb55('0x48')]=function(_0x10f333,_0x5f03c5,_0x5be631){var _0x123043={};var _0x2d3973={};var _0x43975d;var _0x4fc68a;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x10f333['params']['id']}})['then'](handleEntityNotFound(_0x5f03c5,null))[_0xeb55('0x22')](function(_0x279ae9){if(_0x279ae9){_0x43975d=_0x279ae9;_0x2d3973['model']=_[_0xeb55('0x43')](db[_0xeb55('0x49')][_0xeb55('0x4a')]);_0x2d3973[_0xeb55('0x2d')]=_['keys'](_0x10f333[_0xeb55('0x2d')]);_0x2d3973[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x2d3973[_0xeb55('0x2c')],_0x2d3973['query']);_0x123043[_0xeb55('0x30')]=_[_0xeb55('0x2f')](_0x2d3973[_0xeb55('0x2c')],qs[_0xeb55('0x31')](_0x10f333[_0xeb55('0x2d')][_0xeb55('0x31')]));_0x123043[_0xeb55('0x30')]=_0x123043[_0xeb55('0x30')][_0xeb55('0x32')]?_0x123043[_0xeb55('0x30')]:_0x2d3973[_0xeb55('0x2c')];_0x123043[_0xeb55('0x4b')]=qs[_0xeb55('0x35')](_0x10f333[_0xeb55('0x2d')]['sort']);_0x123043[_0xeb55('0x38')]=qs[_0xeb55('0x2e')](_[_0xeb55('0x36')](_0x10f333[_0xeb55('0x2d')],_0x2d3973[_0xeb55('0x2e')]));if(_0x10f333['query']['filter']){_0x123043[_0xeb55('0x38')]=_['merge'](_0x123043[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x123043['attributes'],function(_0x321cd0){var _0x21a570={};_0x21a570[_0x321cd0]={'$like':'%'+_0x10f333[_0xeb55('0x2d')]['filter']+'%'};return _0x21a570;})});}_0x123043=_[_0xeb55('0x39')]({},_0x123043,_0x10f333[_0xeb55('0x3b')]);return _0x43975d[_0xeb55('0x48')](_0x123043);}})['then'](function(_0x24d950){if(_0x24d950){_0x4fc68a=_0x24d950[_0xeb55('0x32')];if(!_0x10f333[_0xeb55('0x2d')][_0xeb55('0x33')](_0xeb55('0x34'))){_0x123043['limit']=qs[_0xeb55('0x1d')](_0x10f333[_0xeb55('0x2d')][_0xeb55('0x1d')]);_0x123043[_0xeb55('0x1a')]=qs['offset'](_0x10f333[_0xeb55('0x2d')][_0xeb55('0x1a')]);}return _0x43975d[_0xeb55('0x48')](_0x123043);}})[_0xeb55('0x22')](function(_0x175844){if(_0x175844){return _0x175844?{'count':_0x4fc68a,'rows':_0x175844}:null;}})[_0xeb55('0x22')](respondWithResult(_0x5f03c5,null))[_0xeb55('0x41')](handleError(_0x5f03c5,null));};exports[_0xeb55('0x4c')]=function(_0x3b9839,_0x86ae00,_0x310332){var _0x459599={};var _0x36137b={};var _0x379fef;var _0x500907;return db[_0xeb55('0x3e')][_0xeb55('0x4d')]({'where':{'id':_0x3b9839['params']['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x86ae00,null))[_0xeb55('0x22')](function(_0x16787e){if(_0x16787e){_0x379fef=_0x16787e;_0x36137b['model']=_[_0xeb55('0x43')](db[_0xeb55('0x49')][_0xeb55('0x4a')]);_0x36137b[_0xeb55('0x2d')]=_[_0xeb55('0x43')](_0x3b9839['query']);_0x36137b[_0xeb55('0x2e')]=_['intersection'](_0x36137b[_0xeb55('0x2c')],_0x36137b['query']);_0x459599[_0xeb55('0x30')]=_[_0xeb55('0x2f')](_0x36137b[_0xeb55('0x2c')],qs['fields'](_0x3b9839['query']['fields']));_0x459599[_0xeb55('0x30')]=_0x459599['attributes']['length']?_0x459599[_0xeb55('0x30')]:_0x36137b[_0xeb55('0x2c')];_0x459599['order']=qs[_0xeb55('0x35')](_0x3b9839[_0xeb55('0x2d')]['sort']);_0x459599['where']=qs[_0xeb55('0x2e')](_['pick'](_0x3b9839[_0xeb55('0x2d')],_0x36137b[_0xeb55('0x2e')]));if(_0x3b9839[_0xeb55('0x2d')]['filter']){_0x459599['where']=_[_0xeb55('0x39')](_0x459599[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x459599['attributes'],function(_0x3d295e){var _0xbbfa35={};_0xbbfa35[_0x3d295e]={'$like':'%'+_0x3b9839[_0xeb55('0x2d')][_0xeb55('0x37')]+'%'};return _0xbbfa35;})});}_0x459599=_[_0xeb55('0x39')]({},_0x459599,_0x3b9839[_0xeb55('0x3b')]);return _0x379fef[_0xeb55('0x4c')](_0x459599);}})['then'](function(_0x6bce17){if(_0x6bce17){_0x500907=_0x6bce17[_0xeb55('0x32')];if(!_0x3b9839['query'][_0xeb55('0x33')](_0xeb55('0x34'))){_0x459599['limit']=qs['limit'](_0x3b9839[_0xeb55('0x2d')]['limit']);_0x459599[_0xeb55('0x1a')]=qs['offset'](_0x3b9839[_0xeb55('0x2d')]['offset']);}return _0x379fef[_0xeb55('0x4c')](_0x459599);}})['then'](function(_0x1f1c07){if(_0x1f1c07){return _0x1f1c07?{'count':_0x500907,'rows':_0x1f1c07}:null;}})[_0xeb55('0x22')](respondWithResult(_0x86ae00,null))[_0xeb55('0x41')](handleError(_0x86ae00,null));};exports[_0xeb55('0x4e')]=function(_0xe23b70,_0x21019d,_0x440d0c){var _0x1164b4={};var _0x1c3052={};var _0x102ed5;var _0x21cd76;return db[_0xeb55('0x3e')][_0xeb55('0x4d')]({'where':{'id':_0xe23b70[_0xeb55('0x47')]['id']}})[_0xeb55('0x22')](handleEntityNotFound(_0x21019d,null))[_0xeb55('0x22')](function(_0x296d31){if(_0x296d31){_0x102ed5=_0x296d31;_0x1c3052[_0xeb55('0x2c')]=_[_0xeb55('0x43')](db[_0xeb55('0x49')]['rawAttributes']);_0x1c3052['query']=_['keys'](_0xe23b70[_0xeb55('0x2d')]);_0x1c3052[_0xeb55('0x2e')]=_[_0xeb55('0x2f')](_0x1c3052[_0xeb55('0x2c')],_0x1c3052[_0xeb55('0x2d')]);_0x1164b4['attributes']=_['intersection'](_0x1c3052[_0xeb55('0x2c')],qs[_0xeb55('0x31')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x31')]));_0x1164b4[_0xeb55('0x30')]=_0x1164b4['attributes'][_0xeb55('0x32')]?_0x1164b4[_0xeb55('0x30')]:_0x1c3052[_0xeb55('0x2c')];_0x1164b4[_0xeb55('0x4b')]=qs[_0xeb55('0x35')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x35')]);_0x1164b4[_0xeb55('0x38')]=qs['filters'](_['pick'](_0xe23b70[_0xeb55('0x2d')],_0x1c3052[_0xeb55('0x2e')]));if(_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x37')]){_0x1164b4['where']=_[_0xeb55('0x39')](_0x1164b4[_0xeb55('0x38')],{'$or':_[_0xeb55('0x28')](_0x1164b4[_0xeb55('0x30')],function(_0xd06b2b){var _0x1772a1={};_0x1772a1[_0xd06b2b]={'$like':'%'+_0xe23b70['query'][_0xeb55('0x37')]+'%'};return _0x1772a1;})});}_0x1164b4=_[_0xeb55('0x39')]({},_0x1164b4,_0xe23b70['options']);return _0x102ed5[_0xeb55('0x4e')](_0x1164b4);}})['then'](function(_0x3739e4){if(_0x3739e4){_0x21cd76=_0x3739e4[_0xeb55('0x32')];if(!_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x33')](_0xeb55('0x34'))){_0x1164b4[_0xeb55('0x1d')]=qs[_0xeb55('0x1d')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x1d')]);_0x1164b4[_0xeb55('0x1a')]=qs[_0xeb55('0x1a')](_0xe23b70[_0xeb55('0x2d')][_0xeb55('0x1a')]);}return _0x102ed5[_0xeb55('0x4e')](_0x1164b4);}})[_0xeb55('0x22')](function(_0x1c228d){if(_0x1c228d){return _0x1c228d?{'count':_0x21cd76,'rows':_0x1c228d}:null;}})['then'](respondWithResult(_0x21019d,null))['catch'](handleError(_0x21019d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e55526e..f91c311 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 _0x4fe0=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','util','../../config/logger'];(function(_0x2537f0,_0x55477c){var _0x4eeee=function(_0x1e6a76){while(--_0x1e6a76){_0x2537f0['push'](_0x2537f0['shift']());}};_0x4eeee(++_0x55477c);}(_0x4fe0,0x7c));var _0x04fe=function(_0x4cc58f,_0x464afc){_0x4cc58f=_0x4cc58f-0x0;var _0x224a0c=_0x4fe0[_0x4cc58f];return _0x224a0c;};'use strict';var _=require('lodash');var util=require(_0x04fe('0x0'));var logger=require(_0x04fe('0x1'))(_0x04fe('0x2'));var moment=require(_0x04fe('0x3'));var BPromise=require(_0x04fe('0x4'));var rp=require(_0x04fe('0x5'));var fs=require('fs');var path=require(_0x04fe('0x6'));var rimraf=require(_0x04fe('0x7'));var config=require(_0x04fe('0x8'));var attributes=require(_0x04fe('0x9'));module[_0x04fe('0xa')]=function(_0x1824fa,_0x319d23){return _0x1824fa[_0x04fe('0xb')](_0x04fe('0xc'),attributes,{'tableName':_0x04fe('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc00=['moment','request-promise','./intSalesforceConfiguration.attributes','exports','define','lodash','../../config/logger','api'];(function(_0xbc835a,_0x4f2231){var _0xc708b6=function(_0x5ac732){while(--_0x5ac732){_0xbc835a['push'](_0xbc835a['shift']());}};_0xc708b6(++_0x4f2231);}(_0xcc00,0x12d));var _0x0cc0=function(_0xf79bae,_0x263b2a){_0xf79bae=_0xf79bae-0x0;var _0x5d2cb7=_0xcc00[_0xf79bae];return _0x5d2cb7;};'use strict';var _=require(_0x0cc0('0x0'));var util=require('util');var logger=require(_0x0cc0('0x1'))(_0x0cc0('0x2'));var moment=require(_0x0cc0('0x3'));var BPromise=require('bluebird');var rp=require(_0x0cc0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0cc0('0x5'));module[_0x0cc0('0x6')]=function(_0x3b5b16,_0x379cf4){return _0x3b5b16[_0x0cc0('0x7')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 0f4ad3a..145e15b 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 _0xdef3=['util','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceConfiguration,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0x539043,_0x28159a){var _0x561898=function(_0x406611){while(--_0x406611){_0x539043['push'](_0x539043['shift']());}};_0x561898(++_0x28159a);}(_0xdef3,0x164));var _0x3def=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xdef3[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x3def('0x0'));var util=require(_0x3def('0x1'));var moment=require('moment');var BPromise=require(_0x3def('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3def('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3def('0x4'))(_0x3def('0x5'));var config=require(_0x3def('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3def('0x7')][_0x3def('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x569339,_0x48c0a7,_0x91d543){return new BPromise(function(_0x1583e1,_0x423e3a){return client['request'](_0x569339,_0x91d543)[_0x3def('0x9')](function(_0x4ae236){logger[_0x3def('0xa')]('SalesforceConfiguration,\x20%s,\x20%s',_0x48c0a7,_0x3def('0xb'));logger[_0x3def('0xc')](_0x3def('0xd'),_0x48c0a7,_0x3def('0xb'),JSON[_0x3def('0xe')](_0x4ae236));if(_0x4ae236[_0x3def('0xf')]){if(_0x4ae236[_0x3def('0xf')][_0x3def('0x10')]===0x1f4){logger['error'](_0x3def('0x11'),_0x48c0a7,_0x4ae236[_0x3def('0xf')][_0x3def('0x12')]);return _0x423e3a(_0x4ae236[_0x3def('0xf')][_0x3def('0x12')]);}logger[_0x3def('0xf')](_0x3def('0x11'),_0x48c0a7,_0x4ae236['error'][_0x3def('0x12')]);return _0x1583e1(_0x4ae236[_0x3def('0xf')][_0x3def('0x12')]);}else{logger['info'](_0x3def('0x11'),_0x48c0a7,_0x3def('0xb'));_0x1583e1(_0x4ae236[_0x3def('0x13')][_0x3def('0x12')]);}})[_0x3def('0x14')](function(_0x5e9aff){logger[_0x3def('0xf')](_0x3def('0x11'),_0x48c0a7,_0x5e9aff);_0x423e3a(_0x5e9aff);});});} \ No newline at end of file +var _0xf99b=['debug','request\x20sent','error','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','info','SalesforceConfiguration,\x20%s,\x20%s'];(function(_0x5b3788,_0x189ea5){var _0x206cbc=function(_0x3659ee){while(--_0x3659ee){_0x5b3788['push'](_0x5b3788['shift']());}};_0x206cbc(++_0x189ea5);}(_0xf99b,0xd1));var _0xbf99=function(_0x3c1258,_0x12136d){_0x3c1258=_0x3c1258-0x0;var _0x36dc8e=_0xf99b[_0x3c1258];return _0x36dc8e;};'use strict';var _=require(_0xbf99('0x0'));var util=require('util');var moment=require(_0xbf99('0x1'));var BPromise=require(_0xbf99('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf99('0x3'));var db=require(_0xbf99('0x4'))['db'];var utils=require(_0xbf99('0x5'));var logger=require('../../config/logger')(_0xbf99('0x6'));var config=require('../../config/environment');var jayson=require(_0xbf99('0x7'));var client=jayson['client'][_0xbf99('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e04fa,_0x3ea804,_0x242ee8){return new BPromise(function(_0x2e770c,_0x3105ab){return client[_0xbf99('0x9')](_0x1e04fa,_0x242ee8)['then'](function(_0x535f00){logger[_0xbf99('0xa')](_0xbf99('0xb'),_0x3ea804,'request\x20sent');logger[_0xbf99('0xc')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x3ea804,_0xbf99('0xd'),JSON['stringify'](_0x535f00));if(_0x535f00[_0xbf99('0xe')]){if(_0x535f00[_0xbf99('0xe')]['code']===0x1f4){logger[_0xbf99('0xe')](_0xbf99('0xb'),_0x3ea804,_0x535f00[_0xbf99('0xe')][_0xbf99('0xf')]);return _0x3105ab(_0x535f00['error'][_0xbf99('0xf')]);}logger[_0xbf99('0xe')](_0xbf99('0xb'),_0x3ea804,_0x535f00[_0xbf99('0xe')][_0xbf99('0xf')]);return _0x2e770c(_0x535f00['error'][_0xbf99('0xf')]);}else{logger['info']('SalesforceConfiguration,\x20%s,\x20%s',_0x3ea804,_0xbf99('0xd'));_0x2e770c(_0x535f00[_0xbf99('0x10')][_0xbf99('0xf')]);}})['catch'](function(_0x17f3c7){logger[_0xbf99('0xe')](_0xbf99('0xb'),_0x3ea804,_0x17f3c7);_0x3105ab(_0x17f3c7);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index dd68fe3..cd28606 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 _0x578c=['/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','../../components/auth/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index'];(function(_0x516e60,_0x4e6f44){var _0x450e47=function(_0x4ab3c7){while(--_0x4ab3c7){_0x516e60['push'](_0x516e60['shift']());}};_0x450e47(++_0x4e6f44);}(_0x578c,0x183));var _0xc578=function(_0x69b5ba,_0x19712d){_0x69b5ba=_0x69b5ba-0x0;var _0x7a0e6f=_0x578c[_0x69b5ba];return _0x7a0e6f;};'use strict';var multer=require('multer');var util=require(_0xc578('0x0'));var path=require(_0xc578('0x1'));var timeout=require('connect-timeout');var express=require(_0xc578('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc578('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc578('0x4'));var controller=require(_0xc578('0x5'));router[_0xc578('0x6')]('/',auth[_0xc578('0x7')](),controller[_0xc578('0x8')]);router[_0xc578('0x6')](_0xc578('0x9'),auth[_0xc578('0x7')](),controller[_0xc578('0xa')]);router[_0xc578('0xb')]('/',auth[_0xc578('0x7')](),controller[_0xc578('0xc')]);router[_0xc578('0xd')](_0xc578('0x9'),auth['isAuthenticated'](),controller[_0xc578('0xe')]);router[_0xc578('0xf')](_0xc578('0x9'),auth[_0xc578('0x7')](),controller[_0xc578('0x10')]);module[_0xc578('0x11')]=router; \ No newline at end of file +var _0x6e59=['connect-timeout','express','Router','fs-extra','../../config/environment','./intSalesforceField.controller','get','index','/:id','isAuthenticated','post','create','put','delete','destroy','exports','multer'];(function(_0x1b3704,_0x404580){var _0x5ed872=function(_0x5d9779){while(--_0x5d9779){_0x1b3704['push'](_0x1b3704['shift']());}};_0x5ed872(++_0x404580);}(_0x6e59,0xed));var _0x96e5=function(_0x222583,_0x5dd35){_0x222583=_0x222583-0x0;var _0x46ca38=_0x6e59[_0x222583];return _0x46ca38;};'use strict';var multer=require(_0x96e5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x96e5('0x1'));var express=require(_0x96e5('0x2'));var router=express[_0x96e5('0x3')]();var fs_extra=require(_0x96e5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x96e5('0x5'));var controller=require(_0x96e5('0x6'));router[_0x96e5('0x7')]('/',auth['isAuthenticated'](),controller[_0x96e5('0x8')]);router[_0x96e5('0x7')](_0x96e5('0x9'),auth[_0x96e5('0xa')](),controller['show']);router[_0x96e5('0xb')]('/',auth['isAuthenticated'](),controller[_0x96e5('0xc')]);router[_0x96e5('0xd')]('/:id',auth[_0x96e5('0xa')](),controller['update']);router[_0x96e5('0xe')](_0x96e5('0x9'),auth[_0x96e5('0xa')](),controller[_0x96e5('0xf')]);module[_0x96e5('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 07ab8a2..357ca33 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 _0xdf25=['STRING','variable','sequelize','exports','ENUM','customVariable','keyValue','picklist','string'];(function(_0x181e0b,_0x275513){var _0x1e6477=function(_0x347a7f){while(--_0x347a7f){_0x181e0b['push'](_0x181e0b['shift']());}};_0x1e6477(++_0x275513);}(_0xdf25,0x89));var _0x5df2=function(_0x17841f,_0x4b0096){_0x17841f=_0x17841f-0x0;var _0xb4cb65=_0xdf25[_0x17841f];return _0xb4cb65;};'use strict';var Sequelize=require(_0x5df2('0x0'));module[_0x5df2('0x1')]={'type':{'type':Sequelize[_0x5df2('0x2')]('string','variable',_0x5df2('0x3'),_0x5df2('0x4'),_0x5df2('0x5')),'defaultValue':_0x5df2('0x6')},'content':{'type':Sequelize[_0x5df2('0x7')]},'key':{'type':Sequelize[_0x5df2('0x7')]},'keyType':{'type':Sequelize[_0x5df2('0x2')](_0x5df2('0x6'),_0x5df2('0x8'),_0x5df2('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5df2('0x7')]},'variableName':{'type':Sequelize[_0x5df2('0x7')]}}; \ No newline at end of file +var _0x8451=['STRING','sequelize','exports','string','variable','customVariable','picklist'];(function(_0x18b0a1,_0x535aac){var _0x55005a=function(_0xf42695){while(--_0xf42695){_0x18b0a1['push'](_0x18b0a1['shift']());}};_0x55005a(++_0x535aac);}(_0x8451,0xe8));var _0x1845=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x8451[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x1845('0x0'));module[_0x1845('0x1')]={'type':{'type':Sequelize['ENUM'](_0x1845('0x2'),_0x1845('0x3'),_0x1845('0x4'),'keyValue',_0x1845('0x5')),'defaultValue':_0x1845('0x2')},'content':{'type':Sequelize[_0x1845('0x6')]},'key':{'type':Sequelize[_0x1845('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x1845('0x2'),_0x1845('0x3'),_0x1845('0x4'))},'keyContent':{'type':Sequelize[_0x1845('0x6')]},'idField':{'type':Sequelize[_0x1845('0x6')]},'variableName':{'type':Sequelize[_0x1845('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 3e9549e..cca04dd 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 _0x1459=['to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','offset','undefined','count','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','name','send','map','SalesforceField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','filter','merge','options','includeAll','include','rows','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','squel','crypto','jsforce'];(function(_0x3179aa,_0x401bb9){var _0x1ec310=function(_0x5442f6){while(--_0x5442f6){_0x3179aa['push'](_0x3179aa['shift']());}};_0x1ec310(++_0x401bb9);}(_0x1459,0xfc));var _0x9145=function(_0x1a3009,_0x193595){_0x1a3009=_0x1a3009-0x0;var _0xe92722=_0x1459[_0x1a3009];return _0xe92722;};'use strict';var emlformat=require(_0x9145('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9145('0x1'));var jsonpatch=require(_0x9145('0x2'));var rp=require(_0x9145('0x3'));var moment=require(_0x9145('0x4'));var BPromise=require(_0x9145('0x5'));var Mustache=require(_0x9145('0x6'));var util=require('util');var path=require(_0x9145('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9145('0x8'));var _=require('lodash');var squel=require(_0x9145('0x9'));var crypto=require(_0x9145('0xa'));var jsforce=require(_0x9145('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x9145('0xc'));var querystring=require(_0x9145('0xd'));var Papa=require(_0x9145('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9145('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9145('0x10'));var logger=require(_0x9145('0x11'))(_0x9145('0x12'));var utils=require(_0x9145('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x9145('0x14'));var db=require(_0x9145('0x15'))['db'];function respondWithStatusCode(_0x3c5003,_0x2d9603){_0x2d9603=_0x2d9603||0xcc;return function(_0x29a845){if(_0x29a845){return _0x3c5003['sendStatus'](_0x2d9603);}return _0x3c5003['status'](_0x2d9603)['end']();};}function respondWithResult(_0x48b4dd,_0x884528){_0x884528=_0x884528||0xc8;return function(_0x19b473){if(_0x19b473){return _0x48b4dd['status'](_0x884528)['json'](_0x19b473);}};}function respondWithFilteredResult(_0x44e2e3,_0x113f07){return function(_0x1cdae5){if(_0x1cdae5){var _0x5a58f1=typeof _0x113f07[_0x9145('0x16')]===_0x9145('0x17')&&typeof _0x113f07['limit']===_0x9145('0x17');var _0x55e445=_0x1cdae5[_0x9145('0x18')];var _0x20eb1b=_0x5a58f1?0x0:_0x113f07[_0x9145('0x16')];var _0x5b2f79=_0x5a58f1?_0x1cdae5[_0x9145('0x18')]:_0x113f07[_0x9145('0x16')]+_0x113f07[_0x9145('0x19')];var _0x8968d3;if(_0x5b2f79>=_0x55e445){_0x5b2f79=_0x55e445;_0x8968d3=0xc8;}else{_0x8968d3=0xce;}_0x44e2e3[_0x9145('0x1a')](_0x8968d3);return _0x44e2e3[_0x9145('0x1b')](_0x9145('0x1c'),_0x20eb1b+'-'+_0x5b2f79+'/'+_0x55e445)['json'](_0x1cdae5);}return null;};}function patchUpdates(_0x21bddc){return function(_0x37f830){try{jsonpatch[_0x9145('0x1d')](_0x37f830,_0x21bddc,!![]);}catch(_0x2a9241){return BPromise[_0x9145('0x1e')](_0x2a9241);}return _0x37f830['save']();};}function saveUpdates(_0xfad1eb,_0x36cab8){return function(_0x251124){if(_0x251124){return _0x251124[_0x9145('0x1f')](_0xfad1eb)[_0x9145('0x20')](function(_0x1b4f33){return _0x1b4f33;});}return null;};}function removeEntity(_0x5cefc0,_0x306cf8){return function(_0x4275ae){if(_0x4275ae){return _0x4275ae[_0x9145('0x21')]()[_0x9145('0x20')](function(){_0x5cefc0[_0x9145('0x1a')](0xcc)[_0x9145('0x22')]();});}};}function handleEntityNotFound(_0x19ee08,_0x2b2950){return function(_0x374540){if(!_0x374540){_0x19ee08[_0x9145('0x23')](0x194);}return _0x374540;};}function handleError(_0x45e04f,_0xce8fb7){_0xce8fb7=_0xce8fb7||0x1f4;return function(_0x4a355d){logger[_0x9145('0x24')](_0x4a355d['stack']);if(_0x4a355d[_0x9145('0x25')]){delete _0x4a355d[_0x9145('0x25')];}_0x45e04f['status'](_0xce8fb7)[_0x9145('0x26')](_0x4a355d);};}exports['index']=function(_0x1c76c4,_0x2331c0){var _0x2cb8ae={},_0x3b49a9={},_0x14bc4c={'count':0x0,'rows':[]};var _0x1dcb89=_[_0x9145('0x27')](db[_0x9145('0x28')][_0x9145('0x29')],function(_0x3b537c){return{'name':_0x3b537c['fieldName'],'type':_0x3b537c[_0x9145('0x2a')][_0x9145('0x2b')]};});_0x3b49a9[_0x9145('0x2c')]=_['map'](_0x1dcb89,'name');_0x3b49a9[_0x9145('0x2d')]=_[_0x9145('0x2e')](_0x1c76c4['query']);_0x3b49a9[_0x9145('0x2f')]=_[_0x9145('0x30')](_0x3b49a9[_0x9145('0x2c')],_0x3b49a9[_0x9145('0x2d')]);_0x2cb8ae[_0x9145('0x31')]=_[_0x9145('0x30')](_0x3b49a9[_0x9145('0x2c')],qs['fields'](_0x1c76c4['query'][_0x9145('0x32')]));_0x2cb8ae[_0x9145('0x31')]=_0x2cb8ae[_0x9145('0x31')][_0x9145('0x33')]?_0x2cb8ae[_0x9145('0x31')]:_0x3b49a9[_0x9145('0x2c')];if(!_0x1c76c4[_0x9145('0x2d')]['hasOwnProperty']('nolimit')){_0x2cb8ae[_0x9145('0x19')]=qs[_0x9145('0x19')](_0x1c76c4[_0x9145('0x2d')]['limit']);_0x2cb8ae[_0x9145('0x16')]=qs['offset'](_0x1c76c4[_0x9145('0x2d')][_0x9145('0x16')]);}_0x2cb8ae[_0x9145('0x34')]=qs[_0x9145('0x35')](_0x1c76c4[_0x9145('0x2d')][_0x9145('0x35')]);_0x2cb8ae[_0x9145('0x36')]=qs[_0x9145('0x2f')](_['pick'](_0x1c76c4['query'],_0x3b49a9['filters']),_0x1dcb89);if(_0x1c76c4[_0x9145('0x2d')][_0x9145('0x37')]){_0x2cb8ae['where']=_['merge'](_0x2cb8ae['where'],{'$or':_['map'](_0x1dcb89,function(_0x29dc11){if(_0x29dc11['type']!=='VIRTUAL'){var _0x27009d={};_0x27009d[_0x29dc11['name']]={'$like':'%'+_0x1c76c4[_0x9145('0x2d')]['filter']+'%'};return _0x27009d;}})});}_0x2cb8ae=_[_0x9145('0x38')]({},_0x2cb8ae,_0x1c76c4[_0x9145('0x39')]);var _0x3dc577={'where':_0x2cb8ae[_0x9145('0x36')]};return db[_0x9145('0x28')][_0x9145('0x18')](_0x3dc577)[_0x9145('0x20')](function(_0x460812){_0x14bc4c['count']=_0x460812;if(_0x1c76c4[_0x9145('0x2d')][_0x9145('0x3a')]){_0x2cb8ae[_0x9145('0x3b')]=[{'all':!![]}];}return db[_0x9145('0x28')]['findAll'](_0x2cb8ae);})[_0x9145('0x20')](function(_0x476b9a){_0x14bc4c[_0x9145('0x3c')]=_0x476b9a;return _0x14bc4c;})['then'](respondWithFilteredResult(_0x2331c0,_0x2cb8ae))['catch'](handleError(_0x2331c0,null));};exports['show']=function(_0x500f98,_0x2e326e){var _0x534fd6={'raw':!![],'where':{'id':_0x500f98['params']['id']}},_0x39e853={};_0x39e853[_0x9145('0x2c')]=_[_0x9145('0x2e')](db['SalesforceField'][_0x9145('0x29')]);_0x39e853[_0x9145('0x2d')]=_['keys'](_0x500f98[_0x9145('0x2d')]);_0x39e853[_0x9145('0x2f')]=_[_0x9145('0x30')](_0x39e853[_0x9145('0x2c')],_0x39e853['query']);_0x534fd6['attributes']=_[_0x9145('0x30')](_0x39e853[_0x9145('0x2c')],qs['fields'](_0x500f98[_0x9145('0x2d')][_0x9145('0x32')]));_0x534fd6[_0x9145('0x31')]=_0x534fd6[_0x9145('0x31')][_0x9145('0x33')]?_0x534fd6[_0x9145('0x31')]:_0x39e853[_0x9145('0x2c')];if(_0x500f98[_0x9145('0x2d')][_0x9145('0x3a')]){_0x534fd6[_0x9145('0x3b')]=[{'all':!![]}];}_0x534fd6=_[_0x9145('0x38')]({},_0x534fd6,_0x500f98[_0x9145('0x39')]);return db['SalesforceField'][_0x9145('0x3d')](_0x534fd6)[_0x9145('0x20')](handleEntityNotFound(_0x2e326e,null))[_0x9145('0x20')](respondWithResult(_0x2e326e,null))[_0x9145('0x3e')](handleError(_0x2e326e,null));};exports[_0x9145('0x3f')]=function(_0x433caa,_0x2a9972){return db['SalesforceField'][_0x9145('0x3f')](_0x433caa['body'],{})[_0x9145('0x20')](respondWithResult(_0x2a9972,0xc9))[_0x9145('0x3e')](handleError(_0x2a9972,null));};exports['update']=function(_0x1f46db,_0x4b9846){if(_0x1f46db['body']['id']){delete _0x1f46db[_0x9145('0x40')]['id'];}return db[_0x9145('0x28')][_0x9145('0x3d')]({'where':{'id':_0x1f46db[_0x9145('0x41')]['id']}})[_0x9145('0x20')](handleEntityNotFound(_0x4b9846,null))[_0x9145('0x20')](saveUpdates(_0x1f46db[_0x9145('0x40')],null))['then'](respondWithResult(_0x4b9846,null))['catch'](handleError(_0x4b9846,null));};exports[_0x9145('0x21')]=function(_0x10c2d7,_0x23e4f2){return db[_0x9145('0x28')][_0x9145('0x3d')]({'where':{'id':_0x10c2d7[_0x9145('0x41')]['id']}})[_0x9145('0x20')](handleEntityNotFound(_0x23e4f2,null))[_0x9145('0x20')](removeEntity(_0x23e4f2,null))[_0x9145('0x3e')](handleError(_0x23e4f2,null));}; \ No newline at end of file +var _0xbde1=['sendStatus','status','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','stack','send','index','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','SalesforceField','include','findAll','rows','catch','show','params','includeAll','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2ca5a8,_0x4bf2d1){var _0x138e5f=function(_0x3d13ea){while(--_0x3d13ea){_0x2ca5a8['push'](_0x2ca5a8['shift']());}};_0x138e5f(++_0x4bf2d1);}(_0xbde1,0x7c));var _0x1bde=function(_0x1e2072,_0xe3cc90){_0x1e2072=_0x1e2072-0x0;var _0x22956b=_0xbde1[_0x1e2072];return _0x22956b;};'use strict';var emlformat=require(_0x1bde('0x0'));var rimraf=require(_0x1bde('0x1'));var zipdir=require(_0x1bde('0x2'));var jsonpatch=require(_0x1bde('0x3'));var rp=require(_0x1bde('0x4'));var moment=require('moment');var BPromise=require(_0x1bde('0x5'));var Mustache=require(_0x1bde('0x6'));var util=require(_0x1bde('0x7'));var path=require(_0x1bde('0x8'));var sox=require(_0x1bde('0x9'));var csv=require(_0x1bde('0xa'));var ejs=require(_0x1bde('0xb'));var fs=require('fs');var fs_extra=require(_0x1bde('0xc'));var _=require(_0x1bde('0xd'));var squel=require(_0x1bde('0xe'));var crypto=require(_0x1bde('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1bde('0x10'));var Papa=require('papaparse');var Redis=require(_0x1bde('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1bde('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1bde('0x13'))(_0x1bde('0x14'));var utils=require(_0x1bde('0x15'));var config=require(_0x1bde('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x1bde('0x17'))['db'];function respondWithStatusCode(_0x2d801b,_0x3140b8){_0x3140b8=_0x3140b8||0xcc;return function(_0x2e8c6f){if(_0x2e8c6f){return _0x2d801b[_0x1bde('0x18')](_0x3140b8);}return _0x2d801b[_0x1bde('0x19')](_0x3140b8)['end']();};}function respondWithResult(_0xb4e36d,_0x36057d){_0x36057d=_0x36057d||0xc8;return function(_0x377a11){if(_0x377a11){return _0xb4e36d['status'](_0x36057d)['json'](_0x377a11);}};}function respondWithFilteredResult(_0x59ad5b,_0x157f47){return function(_0x460909){if(_0x460909){var _0x54822d=typeof _0x157f47['offset']===_0x1bde('0x1a')&&typeof _0x157f47[_0x1bde('0x1b')]==='undefined';var _0x5085cc=_0x460909[_0x1bde('0x1c')];var _0x5287f7=_0x54822d?0x0:_0x157f47[_0x1bde('0x1d')];var _0x16175b=_0x54822d?_0x460909[_0x1bde('0x1c')]:_0x157f47[_0x1bde('0x1d')]+_0x157f47['limit'];var _0x4fd8f7;if(_0x16175b>=_0x5085cc){_0x16175b=_0x5085cc;_0x4fd8f7=0xc8;}else{_0x4fd8f7=0xce;}_0x59ad5b[_0x1bde('0x19')](_0x4fd8f7);return _0x59ad5b[_0x1bde('0x1e')](_0x1bde('0x1f'),_0x5287f7+'-'+_0x16175b+'/'+_0x5085cc)['json'](_0x460909);}return null;};}function patchUpdates(_0x7485a){return function(_0x5a1248){try{jsonpatch[_0x1bde('0x20')](_0x5a1248,_0x7485a,!![]);}catch(_0x1eec71){return BPromise[_0x1bde('0x21')](_0x1eec71);}return _0x5a1248[_0x1bde('0x22')]();};}function saveUpdates(_0x226aa3,_0x25e273){return function(_0x40ba03){if(_0x40ba03){return _0x40ba03[_0x1bde('0x23')](_0x226aa3)[_0x1bde('0x24')](function(_0x11a4a6){return _0x11a4a6;});}return null;};}function removeEntity(_0x452d9f,_0x51662c){return function(_0x4691f9){if(_0x4691f9){return _0x4691f9['destroy']()['then'](function(){_0x452d9f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59df1f,_0x4f9695){return function(_0x43895e){if(!_0x43895e){_0x59df1f[_0x1bde('0x18')](0x194);}return _0x43895e;};}function handleError(_0x3bfb39,_0xf5d69f){_0xf5d69f=_0xf5d69f||0x1f4;return function(_0x37e66f){logger['error'](_0x37e66f[_0x1bde('0x25')]);if(_0x37e66f['name']){delete _0x37e66f['name'];}_0x3bfb39[_0x1bde('0x19')](_0xf5d69f)[_0x1bde('0x26')](_0x37e66f);};}exports[_0x1bde('0x27')]=function(_0x1eada6,_0x29b81b){var _0x558871={},_0x529f9f={},_0x1284a9={'count':0x0,'rows':[]};var _0x17cdb8=_['map'](db['SalesforceField'][_0x1bde('0x28')],function(_0x3b0fbd){return{'name':_0x3b0fbd[_0x1bde('0x29')],'type':_0x3b0fbd[_0x1bde('0x2a')][_0x1bde('0x2b')]};});_0x529f9f['model']=_['map'](_0x17cdb8,_0x1bde('0x2c'));_0x529f9f[_0x1bde('0x2d')]=_[_0x1bde('0x2e')](_0x1eada6['query']);_0x529f9f[_0x1bde('0x2f')]=_[_0x1bde('0x30')](_0x529f9f[_0x1bde('0x31')],_0x529f9f[_0x1bde('0x2d')]);_0x558871[_0x1bde('0x32')]=_[_0x1bde('0x30')](_0x529f9f['model'],qs[_0x1bde('0x33')](_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x33')]));_0x558871[_0x1bde('0x32')]=_0x558871['attributes'][_0x1bde('0x34')]?_0x558871['attributes']:_0x529f9f[_0x1bde('0x31')];if(!_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x35')](_0x1bde('0x36'))){_0x558871['limit']=qs['limit'](_0x1eada6['query'][_0x1bde('0x1b')]);_0x558871['offset']=qs[_0x1bde('0x1d')](_0x1eada6[_0x1bde('0x2d')]['offset']);}_0x558871[_0x1bde('0x37')]=qs[_0x1bde('0x38')](_0x1eada6[_0x1bde('0x2d')]['sort']);_0x558871[_0x1bde('0x39')]=qs['filters'](_[_0x1bde('0x3a')](_0x1eada6['query'],_0x529f9f['filters']),_0x17cdb8);if(_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x3b')]){_0x558871[_0x1bde('0x39')]=_['merge'](_0x558871['where'],{'$or':_['map'](_0x17cdb8,function(_0x3599ce){if(_0x3599ce[_0x1bde('0x2a')]!=='VIRTUAL'){var _0x896757={};_0x896757[_0x3599ce['name']]={'$like':'%'+_0x1eada6[_0x1bde('0x2d')][_0x1bde('0x3b')]+'%'};return _0x896757;}})});}_0x558871=_[_0x1bde('0x3c')]({},_0x558871,_0x1eada6['options']);var _0x1ce347={'where':_0x558871[_0x1bde('0x39')]};return db[_0x1bde('0x3d')]['count'](_0x1ce347)[_0x1bde('0x24')](function(_0x44b81c){_0x1284a9[_0x1bde('0x1c')]=_0x44b81c;if(_0x1eada6[_0x1bde('0x2d')]['includeAll']){_0x558871[_0x1bde('0x3e')]=[{'all':!![]}];}return db[_0x1bde('0x3d')][_0x1bde('0x3f')](_0x558871);})[_0x1bde('0x24')](function(_0x34c7b2){_0x1284a9[_0x1bde('0x40')]=_0x34c7b2;return _0x1284a9;})[_0x1bde('0x24')](respondWithFilteredResult(_0x29b81b,_0x558871))[_0x1bde('0x41')](handleError(_0x29b81b,null));};exports[_0x1bde('0x42')]=function(_0x1c7782,_0x195f77){var _0x4ab729={'raw':!![],'where':{'id':_0x1c7782[_0x1bde('0x43')]['id']}},_0x235a81={};_0x235a81[_0x1bde('0x31')]=_['keys'](db[_0x1bde('0x3d')][_0x1bde('0x28')]);_0x235a81['query']=_[_0x1bde('0x2e')](_0x1c7782[_0x1bde('0x2d')]);_0x235a81[_0x1bde('0x2f')]=_[_0x1bde('0x30')](_0x235a81[_0x1bde('0x31')],_0x235a81[_0x1bde('0x2d')]);_0x4ab729[_0x1bde('0x32')]=_[_0x1bde('0x30')](_0x235a81['model'],qs[_0x1bde('0x33')](_0x1c7782[_0x1bde('0x2d')][_0x1bde('0x33')]));_0x4ab729['attributes']=_0x4ab729[_0x1bde('0x32')][_0x1bde('0x34')]?_0x4ab729[_0x1bde('0x32')]:_0x235a81[_0x1bde('0x31')];if(_0x1c7782[_0x1bde('0x2d')][_0x1bde('0x44')]){_0x4ab729[_0x1bde('0x3e')]=[{'all':!![]}];}_0x4ab729=_[_0x1bde('0x3c')]({},_0x4ab729,_0x1c7782[_0x1bde('0x45')]);return db['SalesforceField'][_0x1bde('0x46')](_0x4ab729)[_0x1bde('0x24')](handleEntityNotFound(_0x195f77,null))[_0x1bde('0x24')](respondWithResult(_0x195f77,null))['catch'](handleError(_0x195f77,null));};exports[_0x1bde('0x47')]=function(_0x358c3e,_0x46695){return db[_0x1bde('0x3d')]['create'](_0x358c3e['body'],{})[_0x1bde('0x24')](respondWithResult(_0x46695,0xc9))['catch'](handleError(_0x46695,null));};exports['update']=function(_0x4653ef,_0x5f034a){if(_0x4653ef[_0x1bde('0x48')]['id']){delete _0x4653ef['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x4653ef[_0x1bde('0x43')]['id']}})[_0x1bde('0x24')](handleEntityNotFound(_0x5f034a,null))[_0x1bde('0x24')](saveUpdates(_0x4653ef[_0x1bde('0x48')],null))[_0x1bde('0x24')](respondWithResult(_0x5f034a,null))['catch'](handleError(_0x5f034a,null));};exports[_0x1bde('0x49')]=function(_0x4cd459,_0x3653aa){return db['SalesforceField'][_0x1bde('0x46')]({'where':{'id':_0x4cd459[_0x1bde('0x43')]['id']}})[_0x1bde('0x24')](handleEntityNotFound(_0x3653aa,null))[_0x1bde('0x24')](removeEntity(_0x3653aa,null))[_0x1bde('0x41')](handleError(_0x3653aa,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 0da352a..b577758 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 _0x6d3f=['SalesforceField','salesforce_unique_index','idField','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x6d3f,0x92));var _0xf6d3=function(_0x1340ea,_0x46584b){_0x1340ea=_0x1340ea-0x0;var _0x5dfb88=_0x6d3f[_0x1340ea];return _0x5dfb88;};'use strict';var _=require(_0xf6d3('0x0'));var util=require('util');var logger=require(_0xf6d3('0x1'))(_0xf6d3('0x2'));var moment=require(_0xf6d3('0x3'));var BPromise=require(_0xf6d3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf6d3('0x5'));var rimraf=require(_0xf6d3('0x6'));var config=require(_0xf6d3('0x7'));var attributes=require(_0xf6d3('0x8'));module[_0xf6d3('0x9')]=function(_0x805d47,_0x2e3790){return _0x805d47['define'](_0xf6d3('0xa'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0xf6d3('0xb'),'fields':[_0xf6d3('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2108=['lodash','util','api','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId'];(function(_0x50ce71,_0x14d5e2){var _0x17d729=function(_0x39591f){while(--_0x39591f){_0x50ce71['push'](_0x50ce71['shift']());}};_0x17d729(++_0x14d5e2);}(_0x2108,0x1a4));var _0x8210=function(_0x281524,_0x5b457a){_0x281524=_0x281524-0x0;var _0x1116ec=_0x2108[_0x281524];return _0x1116ec;};'use strict';var _=require(_0x8210('0x0'));var util=require(_0x8210('0x1'));var logger=require('../../config/logger')(_0x8210('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8210('0x3'));var fs=require('fs');var path=require(_0x8210('0x4'));var rimraf=require(_0x8210('0x5'));var config=require(_0x8210('0x6'));var attributes=require('./intSalesforceField.attributes');module[_0x8210('0x7')]=function(_0x3a3328,_0x25574b){return _0x3a3328[_0x8210('0x8')](_0x8210('0x9'),attributes,{'tableName':_0x8210('0xa'),'paranoid':![],'indexes':[{'name':_0x8210('0xb'),'fields':[_0x8210('0xc'),_0x8210('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index cf135cc..788a9a3 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 _0x6df8=['../../config/logger','rpc','jayson/promise','client','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceField,\x20%s,\x20%s','message','info','result','lodash','../../mysqldb','../../config/utils'];(function(_0x1ff527,_0x54b6d2){var _0x51cc75=function(_0x4168e5){while(--_0x4168e5){_0x1ff527['push'](_0x1ff527['shift']());}};_0x51cc75(++_0x54b6d2);}(_0x6df8,0x1bf));var _0x86df=function(_0x5dea03,_0x5edc15){_0x5dea03=_0x5dea03-0x0;var _0x18a82d=_0x6df8[_0x5dea03];return _0x18a82d;};'use strict';var _=require(_0x86df('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86df('0x1'))['db'];var utils=require(_0x86df('0x2'));var logger=require(_0x86df('0x3'))(_0x86df('0x4'));var config=require('../../config/environment');var jayson=require(_0x86df('0x5'));var client=jayson[_0x86df('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1e56da,_0x157d10,_0x43b444){return new BPromise(function(_0x440d57,_0x5f308c){return client['request'](_0x1e56da,_0x43b444)[_0x86df('0x7')](function(_0x18b2cf){logger['info']('SalesforceField,\x20%s,\x20%s',_0x157d10,_0x86df('0x8'));logger[_0x86df('0x9')](_0x86df('0xa'),_0x157d10,_0x86df('0x8'),JSON[_0x86df('0xb')](_0x18b2cf));if(_0x18b2cf[_0x86df('0xc')]){if(_0x18b2cf[_0x86df('0xc')][_0x86df('0xd')]===0x1f4){logger[_0x86df('0xc')](_0x86df('0xe'),_0x157d10,_0x18b2cf['error']['message']);return _0x5f308c(_0x18b2cf[_0x86df('0xc')][_0x86df('0xf')]);}logger[_0x86df('0xc')](_0x86df('0xe'),_0x157d10,_0x18b2cf['error'][_0x86df('0xf')]);return _0x440d57(_0x18b2cf[_0x86df('0xc')][_0x86df('0xf')]);}else{logger[_0x86df('0x10')]('SalesforceField,\x20%s,\x20%s',_0x157d10,_0x86df('0x8'));_0x440d57(_0x18b2cf[_0x86df('0x11')][_0x86df('0xf')]);}})['catch'](function(_0x1f4eda){logger['error'](_0x86df('0xe'),_0x157d10,_0x1f4eda);_0x5f308c(_0x1f4eda);});});} \ No newline at end of file +var _0x1610=['error','code','SalesforceField,\x20%s,\x20%s','message','lodash','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x36d92b,_0x3236e7){var _0x330b9f=function(_0x43c168){while(--_0x43c168){_0x36d92b['push'](_0x36d92b['shift']());}};_0x330b9f(++_0x3236e7);}(_0x1610,0xe4));var _0x0161=function(_0x5cbdd6,_0x87e26c){_0x5cbdd6=_0x5cbdd6-0x0;var _0x7c28ae=_0x1610[_0x5cbdd6];return _0x7c28ae;};'use strict';var _=require(_0x0161('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0161('0x1'));var db=require(_0x0161('0x2'))['db'];var utils=require(_0x0161('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0161('0x4'));var client=jayson[_0x0161('0x5')][_0x0161('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x435ae4,_0x3df4c0,_0x51c9f0){return new BPromise(function(_0x447d62,_0x30d1e6){return client['request'](_0x435ae4,_0x51c9f0)[_0x0161('0x7')](function(_0x48b26b){logger[_0x0161('0x8')]('SalesforceField,\x20%s,\x20%s',_0x3df4c0,_0x0161('0x9'));logger['debug'](_0x0161('0xa'),_0x3df4c0,'request\x20sent',JSON[_0x0161('0xb')](_0x48b26b));if(_0x48b26b[_0x0161('0xc')]){if(_0x48b26b['error'][_0x0161('0xd')]===0x1f4){logger[_0x0161('0xc')](_0x0161('0xe'),_0x3df4c0,_0x48b26b['error'][_0x0161('0xf')]);return _0x30d1e6(_0x48b26b[_0x0161('0xc')][_0x0161('0xf')]);}logger[_0x0161('0xc')]('SalesforceField,\x20%s,\x20%s',_0x3df4c0,_0x48b26b['error'][_0x0161('0xf')]);return _0x447d62(_0x48b26b['error'][_0x0161('0xf')]);}else{logger[_0x0161('0x8')](_0x0161('0xe'),_0x3df4c0,_0x0161('0x9'));_0x447d62(_0x48b26b['result'][_0x0161('0xf')]);}})['catch'](function(_0x4b44b2){logger[_0x0161('0xc')](_0x0161('0xe'),_0x3df4c0,_0x4b44b2);_0x30d1e6(_0x4b44b2);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index bb9023d..c2516f0 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 _0xa79e=['post','create','/:id/configurations','put','update','delete','destroy','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields'];(function(_0x5ed0d9,_0x3f1752){var _0x523f89=function(_0x32a3c8){while(--_0x32a3c8){_0x5ed0d9['push'](_0x5ed0d9['shift']());}};_0x523f89(++_0x3f1752);}(_0xa79e,0xf7));var _0xea79=function(_0x26b8b5,_0xf5c2c1){_0x26b8b5=_0x26b8b5-0x0;var _0x2150a9=_0xa79e[_0x26b8b5];return _0x2150a9;};'use strict';var multer=require(_0xea79('0x0'));var util=require('util');var path=require(_0xea79('0x1'));var timeout=require(_0xea79('0x2'));var express=require(_0xea79('0x3'));var router=express[_0xea79('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xea79('0x5'));var config=require(_0xea79('0x6'));var controller=require('./intServicenowAccount.controller');router[_0xea79('0x7')]('/',auth[_0xea79('0x8')](),controller['index']);router[_0xea79('0x7')](_0xea79('0x9'),auth[_0xea79('0x8')](),controller['show']);router['get']('/:id/configurations',auth[_0xea79('0x8')](),controller[_0xea79('0xa')]);router['get'](_0xea79('0xb'),auth[_0xea79('0x8')](),controller[_0xea79('0xc')]);router[_0xea79('0xd')]('/',auth['isAuthenticated'](),controller[_0xea79('0xe')]);router[_0xea79('0xd')](_0xea79('0xf'),auth[_0xea79('0x8')](),controller['addConfiguration']);router[_0xea79('0x10')]('/:id',auth[_0xea79('0x8')](),controller[_0xea79('0x11')]);router[_0xea79('0x12')]('/:id',auth[_0xea79('0x8')](),controller[_0xea79('0x13')]);module['exports']=router; \ No newline at end of file +var _0xef38=['/:id','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index'];(function(_0x314166,_0x2dc838){var _0xdb4f1f=function(_0x38361d){while(--_0x38361d){_0x314166['push'](_0x314166['shift']());}};_0xdb4f1f(++_0x2dc838);}(_0xef38,0x122));var _0x8ef3=function(_0x1f7b24,_0x3466f7){_0x1f7b24=_0x1f7b24-0x0;var _0x522873=_0xef38[_0x1f7b24];return _0x522873;};'use strict';var multer=require('multer');var util=require(_0x8ef3('0x0'));var path=require(_0x8ef3('0x1'));var timeout=require(_0x8ef3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8ef3('0x3'));var auth=require(_0x8ef3('0x4'));var interaction=require(_0x8ef3('0x5'));var config=require(_0x8ef3('0x6'));var controller=require(_0x8ef3('0x7'));router['get']('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x9')]);router['get'](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xb')]);router[_0x8ef3('0xc')](_0x8ef3('0xd'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0xe')]);router['get'](_0x8ef3('0xf'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x10')]);router[_0x8ef3('0x11')]('/',auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x12')]);router[_0x8ef3('0x11')](_0x8ef3('0xd'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x13')]);router[_0x8ef3('0x14')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x15')]);router[_0x8ef3('0x16')](_0x8ef3('0xa'),auth[_0x8ef3('0x8')](),controller[_0x8ef3('0x17')]);module[_0x8ef3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 73b95af..179c936 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 _0xc007=['username','exports','STRING'];(function(_0xf2736d,_0x570d6f){var _0x469510=function(_0x39e99e){while(--_0x39e99e){_0xf2736d['push'](_0xf2736d['shift']());}};_0x469510(++_0x570d6f);}(_0xc007,0x148));var _0x7c00=function(_0x365560,_0x270c22){_0x365560=_0x365560-0x0;var _0x188071=_0xc007[_0x365560];return _0x188071;};'use strict';var Sequelize=require('sequelize');module[_0x7c00('0x0')]={'name':{'type':Sequelize[_0x7c00('0x1')]},'description':{'type':Sequelize[_0x7c00('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x7c00('0x2')},'password':{'type':Sequelize[_0x7c00('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x7c00('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1cd2=['username','remoteUri','sequelize','STRING'];(function(_0x46c1e2,_0x71356b){var _0x177701=function(_0x442604){while(--_0x442604){_0x46c1e2['push'](_0x46c1e2['shift']());}};_0x177701(++_0x71356b);}(_0x1cd2,0x176));var _0x21cd=function(_0x1e5431,_0x29ae00){_0x1e5431=_0x1e5431-0x0;var _0xce8f5c=_0x1cd2[_0x1e5431];return _0xce8f5c;};'use strict';var Sequelize=require(_0x21cd('0x0'));module['exports']={'name':{'type':Sequelize[_0x21cd('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x21cd('0x1')],'unique':_0x21cd('0x2')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x21cd('0x1')]},'remoteUri':{'type':Sequelize[_0x21cd('0x1')],'unique':_0x21cd('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 eea02ce..e082f1c 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 _0x0d98=['AccountId','Subjects','channel','Descriptions','ServicenowField','getFields','made_sla','knowledge','subcategory','close_code','notify','incident_state','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','active','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','correlation_display','delivery_task','work_start','business_stc','additional_assignee_list','description','sys_class_name','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','location','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/table/','username','password','result','log','incident\x20table\x20objects','remove','forEach','internalType','label','push','all','assign','TCL:\x20_object','includes','concat','ServiceNow\x20error:\x20','test','stack','Wrong\x20credentials','statusCode','boolean','true','sys_choice?sysparm_query=name=incident^element=','value','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','findOne','ServicenowConfiguration','pick','filter','getConfigurations','hasOwnProperty','addConfiguration'];(function(_0x347d91,_0x5c6a2d){var _0x2048d5=function(_0x2b8299){while(--_0x2b8299){_0x347d91['push'](_0x347d91['shift']());}};_0x2048d5(++_0x5c6a2d);}(_0x0d98,0x1e1));var _0x80d9=function(_0x46f599,_0x559556){_0x46f599=_0x46f599-0x0;var _0x1af1c0=_0x0d98[_0x46f599];return _0x1af1c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x80d9('0x0'));var zipdir=require(_0x80d9('0x1'));var jsonpatch=require(_0x80d9('0x2'));var rp=require('request-promise');var moment=require(_0x80d9('0x3'));var BPromise=require(_0x80d9('0x4'));var Mustache=require(_0x80d9('0x5'));var util=require(_0x80d9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x80d9('0x7'));var ejs=require(_0x80d9('0x8'));var fs=require('fs');var fs_extra=require(_0x80d9('0x9'));var _=require(_0x80d9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x80d9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x80d9('0x7'));var querystring=require(_0x80d9('0xc'));var Papa=require(_0x80d9('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x80d9('0xe'));var as=require(_0x80d9('0xf'));var hardwareService=require(_0x80d9('0x10'));var logger=require(_0x80d9('0x11'))(_0x80d9('0x12'));var utils=require(_0x80d9('0x13'));var config=require(_0x80d9('0x14'));var licenseUtil=require(_0x80d9('0x15'));var db=require(_0x80d9('0x16'))['db'];var integrations=require(_0x80d9('0x17'));function respondWithStatusCode(_0xf5fb77,_0x269f45){_0x269f45=_0x269f45||0xcc;return function(_0x2dc5cf){if(_0x2dc5cf){return _0xf5fb77[_0x80d9('0x18')](_0x269f45);}return _0xf5fb77[_0x80d9('0x19')](_0x269f45)[_0x80d9('0x1a')]();};}function respondWithResult(_0x542e45,_0x50c2fc){_0x50c2fc=_0x50c2fc||0xc8;return function(_0x6883a6){if(_0x6883a6){return _0x542e45['status'](_0x50c2fc)[_0x80d9('0x1b')](_0x6883a6);}};}function respondWithFilteredResult(_0x38c5bf,_0x17713b){return function(_0x5759a9){if(_0x5759a9){var _0x40708d=typeof _0x17713b['offset']===_0x80d9('0x1c')&&typeof _0x17713b['limit']==='undefined';var _0x49f9bb=_0x5759a9[_0x80d9('0x1d')];var _0x1d3fb9=_0x40708d?0x0:_0x17713b[_0x80d9('0x1e')];var _0x3d9677=_0x40708d?_0x5759a9[_0x80d9('0x1d')]:_0x17713b[_0x80d9('0x1e')]+_0x17713b[_0x80d9('0x1f')];var _0x1ebfc5;if(_0x3d9677>=_0x49f9bb){_0x3d9677=_0x49f9bb;_0x1ebfc5=0xc8;}else{_0x1ebfc5=0xce;}_0x38c5bf['status'](_0x1ebfc5);return _0x38c5bf[_0x80d9('0x20')](_0x80d9('0x21'),_0x1d3fb9+'-'+_0x3d9677+'/'+_0x49f9bb)[_0x80d9('0x1b')](_0x5759a9);}return null;};}function patchUpdates(_0x30ed82){return function(_0x56f149){try{jsonpatch['apply'](_0x56f149,_0x30ed82,!![]);}catch(_0x4620d9){return BPromise[_0x80d9('0x22')](_0x4620d9);}return _0x56f149[_0x80d9('0x23')]();};}function saveUpdates(_0x477e5e,_0x596390){return function(_0x5aabff){if(_0x5aabff){return _0x5aabff[_0x80d9('0x24')](_0x477e5e)[_0x80d9('0x25')](function(_0x510253){return _0x510253;});}return null;};}function removeEntity(_0x1c0316,_0x1cddc8){return function(_0x3e6595){if(_0x3e6595){return _0x3e6595[_0x80d9('0x26')]()[_0x80d9('0x25')](function(){_0x1c0316[_0x80d9('0x19')](0xcc)[_0x80d9('0x1a')]();});}};}function handleEntityNotFound(_0x1a4e9e,_0x232ec7){return function(_0x35f1eb){if(!_0x35f1eb){_0x1a4e9e['sendStatus'](0x194);}return _0x35f1eb;};}function handleError(_0x247188,_0x4e3518){_0x4e3518=_0x4e3518||0x1f4;return function(_0x5320a5){logger[_0x80d9('0x27')](_0x5320a5['stack']);if(_0x5320a5[_0x80d9('0x28')]){delete _0x5320a5['name'];}_0x247188['status'](_0x4e3518)[_0x80d9('0x29')](_0x5320a5);};}exports['index']=function(_0x213a76,_0x46ee3b){var _0x52db01={},_0x3e2321={},_0x62fc73={'count':0x0,'rows':[]};var _0x1dc72f=_[_0x80d9('0x2a')](db[_0x80d9('0x2b')][_0x80d9('0x2c')],function(_0x214e26){return{'name':_0x214e26[_0x80d9('0x2d')],'type':_0x214e26[_0x80d9('0x2e')][_0x80d9('0x2f')]};});_0x3e2321[_0x80d9('0x30')]=_[_0x80d9('0x2a')](_0x1dc72f,'name');_0x3e2321[_0x80d9('0x31')]=_[_0x80d9('0x32')](_0x213a76['query']);_0x3e2321[_0x80d9('0x33')]=_['intersection'](_0x3e2321[_0x80d9('0x30')],_0x3e2321[_0x80d9('0x31')]);_0x52db01[_0x80d9('0x34')]=_[_0x80d9('0x35')](_0x3e2321[_0x80d9('0x30')],qs[_0x80d9('0x36')](_0x213a76[_0x80d9('0x31')][_0x80d9('0x36')]));_0x52db01[_0x80d9('0x34')]=_0x52db01[_0x80d9('0x34')][_0x80d9('0x37')]?_0x52db01['attributes']:_0x3e2321['model'];if(!_0x213a76[_0x80d9('0x31')]['hasOwnProperty'](_0x80d9('0x38'))){_0x52db01[_0x80d9('0x1f')]=qs['limit'](_0x213a76[_0x80d9('0x31')][_0x80d9('0x1f')]);_0x52db01[_0x80d9('0x1e')]=qs[_0x80d9('0x1e')](_0x213a76[_0x80d9('0x31')][_0x80d9('0x1e')]);}_0x52db01[_0x80d9('0x39')]=qs[_0x80d9('0x3a')](_0x213a76['query'][_0x80d9('0x3a')]);_0x52db01['where']=qs['filters'](_['pick'](_0x213a76[_0x80d9('0x31')],_0x3e2321[_0x80d9('0x33')]),_0x1dc72f);if(_0x213a76[_0x80d9('0x31')]['filter']){_0x52db01[_0x80d9('0x3b')]=_[_0x80d9('0x3c')](_0x52db01['where'],{'$or':_[_0x80d9('0x2a')](_0x1dc72f,function(_0x397451){if(_0x397451['type']!==_0x80d9('0x3d')){var _0x3d3610={};_0x3d3610[_0x397451[_0x80d9('0x28')]]={'$like':'%'+_0x213a76[_0x80d9('0x31')]['filter']+'%'};return _0x3d3610;}})});}_0x52db01=_[_0x80d9('0x3c')]({},_0x52db01,_0x213a76[_0x80d9('0x3e')]);var _0x234cd1={'where':_0x52db01[_0x80d9('0x3b')]};return db['ServicenowAccount'][_0x80d9('0x1d')](_0x234cd1)['then'](function(_0x3c630d){_0x62fc73[_0x80d9('0x1d')]=_0x3c630d;if(_0x213a76[_0x80d9('0x31')][_0x80d9('0x3f')]){_0x52db01[_0x80d9('0x40')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x80d9('0x41')](_0x52db01);})[_0x80d9('0x25')](function(_0x277e89){_0x62fc73[_0x80d9('0x42')]=_0x277e89;return _0x62fc73;})[_0x80d9('0x25')](respondWithFilteredResult(_0x46ee3b,_0x52db01))['catch'](handleError(_0x46ee3b,null));};exports[_0x80d9('0x43')]=function(_0x45fc48,_0x2d18e5){var _0x13fb04={'raw':![],'where':{'id':_0x45fc48[_0x80d9('0x44')]['id']}},_0x2a8ba3={};_0x2a8ba3['model']=_['keys'](db['ServicenowAccount'][_0x80d9('0x2c')]);_0x2a8ba3[_0x80d9('0x31')]=_['keys'](_0x45fc48[_0x80d9('0x31')]);_0x2a8ba3[_0x80d9('0x33')]=_[_0x80d9('0x35')](_0x2a8ba3[_0x80d9('0x30')],_0x2a8ba3[_0x80d9('0x31')]);_0x13fb04[_0x80d9('0x34')]=_[_0x80d9('0x35')](_0x2a8ba3[_0x80d9('0x30')],qs[_0x80d9('0x36')](_0x45fc48[_0x80d9('0x31')]['fields']));_0x13fb04[_0x80d9('0x34')]=_0x13fb04[_0x80d9('0x34')][_0x80d9('0x37')]?_0x13fb04[_0x80d9('0x34')]:_0x2a8ba3[_0x80d9('0x30')];if(_0x45fc48[_0x80d9('0x31')][_0x80d9('0x3f')]){_0x13fb04[_0x80d9('0x40')]=[{'all':!![]}];}_0x13fb04=_[_0x80d9('0x3c')]({},_0x13fb04,_0x45fc48[_0x80d9('0x3e')]);return db[_0x80d9('0x2b')][_0x80d9('0x45')](_0x13fb04)[_0x80d9('0x25')](handleEntityNotFound(_0x2d18e5,null))[_0x80d9('0x25')](respondWithResult(_0x2d18e5,null))[_0x80d9('0x46')](handleError(_0x2d18e5,null));};exports[_0x80d9('0x47')]=function(_0x59cd1d,_0x3f4eea){return db[_0x80d9('0x2b')][_0x80d9('0x47')](_0x59cd1d[_0x80d9('0x48')],{})['then'](respondWithResult(_0x3f4eea,0xc9))[_0x80d9('0x46')](handleError(_0x3f4eea,null));};exports['update']=function(_0x505b57,_0x53595a){if(_0x505b57[_0x80d9('0x48')]['id']){delete _0x505b57['body']['id'];}return db[_0x80d9('0x2b')][_0x80d9('0x45')]({'where':{'id':_0x505b57['params']['id']}})['then'](handleEntityNotFound(_0x53595a,null))['then'](saveUpdates(_0x505b57[_0x80d9('0x48')],null))['then'](respondWithResult(_0x53595a,null))['catch'](handleError(_0x53595a,null));};exports[_0x80d9('0x26')]=function(_0x42bc59,_0xf72b9e){return db['ServicenowAccount'][_0x80d9('0x45')]({'where':{'id':_0x42bc59[_0x80d9('0x44')]['id']}})[_0x80d9('0x25')](handleEntityNotFound(_0xf72b9e,null))['then'](removeEntity(_0xf72b9e,null))['catch'](handleError(_0xf72b9e,null));};exports['getConfigurations']=function(_0x8344b1,_0x1e46e0,_0x4a5fbe){var _0x2e0fbb={};var _0x2d8a25={};var _0x24d7a5;var _0x1cdad9;return db[_0x80d9('0x2b')][_0x80d9('0x49')]({'where':{'id':_0x8344b1['params']['id']}})[_0x80d9('0x25')](handleEntityNotFound(_0x1e46e0,null))[_0x80d9('0x25')](function(_0x1e517a){if(_0x1e517a){_0x24d7a5=_0x1e517a;_0x2d8a25['model']=_[_0x80d9('0x32')](db[_0x80d9('0x4a')][_0x80d9('0x2c')]);_0x2d8a25[_0x80d9('0x31')]=_[_0x80d9('0x32')](_0x8344b1[_0x80d9('0x31')]);_0x2d8a25[_0x80d9('0x33')]=_[_0x80d9('0x35')](_0x2d8a25['model'],_0x2d8a25[_0x80d9('0x31')]);_0x2e0fbb[_0x80d9('0x34')]=_[_0x80d9('0x35')](_0x2d8a25['model'],qs[_0x80d9('0x36')](_0x8344b1['query']['fields']));_0x2e0fbb[_0x80d9('0x34')]=_0x2e0fbb[_0x80d9('0x34')][_0x80d9('0x37')]?_0x2e0fbb['attributes']:_0x2d8a25['model'];_0x2e0fbb['order']=qs[_0x80d9('0x3a')](_0x8344b1[_0x80d9('0x31')][_0x80d9('0x3a')]);_0x2e0fbb[_0x80d9('0x3b')]=qs[_0x80d9('0x33')](_[_0x80d9('0x4b')](_0x8344b1[_0x80d9('0x31')],_0x2d8a25[_0x80d9('0x33')]));if(_0x8344b1[_0x80d9('0x31')][_0x80d9('0x4c')]){_0x2e0fbb[_0x80d9('0x3b')]=_[_0x80d9('0x3c')](_0x2e0fbb[_0x80d9('0x3b')],{'$or':_[_0x80d9('0x2a')](_0x2e0fbb[_0x80d9('0x34')],function(_0x51814b){var _0x3ddb15={};_0x3ddb15[_0x51814b]={'$like':'%'+_0x8344b1['query'][_0x80d9('0x4c')]+'%'};return _0x3ddb15;})});}_0x2e0fbb=_['merge']({},_0x2e0fbb,_0x8344b1[_0x80d9('0x3e')]);return _0x24d7a5[_0x80d9('0x4d')](_0x2e0fbb);}})[_0x80d9('0x25')](function(_0x43629f){if(_0x43629f){_0x1cdad9=_0x43629f[_0x80d9('0x37')];if(!_0x8344b1[_0x80d9('0x31')][_0x80d9('0x4e')]('nolimit')){_0x2e0fbb[_0x80d9('0x1f')]=qs[_0x80d9('0x1f')](_0x8344b1['query'][_0x80d9('0x1f')]);_0x2e0fbb[_0x80d9('0x1e')]=qs[_0x80d9('0x1e')](_0x8344b1['query'][_0x80d9('0x1e')]);}return _0x24d7a5[_0x80d9('0x4d')](_0x2e0fbb);}})['then'](function(_0x44d7e6){if(_0x44d7e6){return _0x44d7e6?{'count':_0x1cdad9,'rows':_0x44d7e6}:null;}})[_0x80d9('0x25')](respondWithResult(_0x1e46e0,null))[_0x80d9('0x46')](handleError(_0x1e46e0,null));};exports[_0x80d9('0x4f')]=function(_0x2c6cbc,_0x3645cd,_0x40190c){if(_0x2c6cbc['body']['id']){delete _0x2c6cbc[_0x80d9('0x48')]['id'];}return db[_0x80d9('0x2b')][_0x80d9('0x49')]({'where':{'id':_0x2c6cbc[_0x80d9('0x44')]['id']}})[_0x80d9('0x25')](handleEntityNotFound(_0x3645cd,null))[_0x80d9('0x25')](function(_0x2963cb){if(_0x2963cb){_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x50')]=_0x2963cb['id'];_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x51')]=integrations['getSubjects'](_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x52')],_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x2e')]);_0x2c6cbc[_0x80d9('0x48')][_0x80d9('0x53')]=integrations['getDescriptions'](_0x2c6cbc[_0x80d9('0x48')]['channel'],_0x2c6cbc['body']['type']);return db[_0x80d9('0x4a')][_0x80d9('0x47')](_0x2c6cbc[_0x80d9('0x48')],{'include':[{'model':db[_0x80d9('0x54')],'as':_0x80d9('0x51')},{'model':db[_0x80d9('0x54')],'as':'Descriptions'}]});}return null;})[_0x80d9('0x25')](respondWithResult(_0x3645cd,null))[_0x80d9('0x46')](handleError(_0x3645cd,null));};exports[_0x80d9('0x55')]=function(_0xb07123,_0xe434e0,_0x3f5082){var _0x1e97af=[_0x80d9('0x56'),'hold_reason',_0x80d9('0x57'),_0x80d9('0x58'),_0x80d9('0x59'),_0x80d9('0x5a'),_0x80d9('0x5b'),'severity',_0x80d9('0x5c')];var _0x3647f7=[_0x80d9('0x5d'),_0x80d9('0x56'),_0x80d9('0x5e'),_0x80d9('0x5f'),_0x80d9('0x60'),_0x80d9('0x61'),'child_incidents','hold_reason',_0x80d9('0x62'),_0x80d9('0x63'),_0x80d9('0x64'),_0x80d9('0x65'),_0x80d9('0x66'),_0x80d9('0x67'),_0x80d9('0x68'),'sys_domain',_0x80d9('0x69'),_0x80d9('0x6a'),_0x80d9('0x57'),_0x80d9('0x39'),_0x80d9('0x6b'),_0x80d9('0x6c'),_0x80d9('0x6d'),_0x80d9('0x6e'),'impact',_0x80d9('0x6f'),_0x80d9('0x70'),_0x80d9('0x71'),_0x80d9('0x72'),_0x80d9('0x73'),_0x80d9('0x74'),_0x80d9('0x75'),_0x80d9('0x76'),_0x80d9('0x77'),_0x80d9('0x78'),_0x80d9('0x79'),_0x80d9('0x7a'),_0x80d9('0x7b'),_0x80d9('0x7c'),_0x80d9('0x7d'),_0x80d9('0x7e'),_0x80d9('0x58'),_0x80d9('0x7f'),'short_description',_0x80d9('0x59'),_0x80d9('0x80'),_0x80d9('0x81'),_0x80d9('0x82'),'assignment_group',_0x80d9('0x83'),_0x80d9('0x84'),_0x80d9('0x85'),'calendar_duration',_0x80d9('0x5a'),_0x80d9('0x86'),'close_notes','closed_by',_0x80d9('0x87'),_0x80d9('0x88'),'sys_id',_0x80d9('0x89'),_0x80d9('0x8a'),_0x80d9('0x5b'),_0x80d9('0x8b'),_0x80d9('0x8c'),_0x80d9('0x8d'),_0x80d9('0x8e'),_0x80d9('0x8f'),_0x80d9('0x90'),_0x80d9('0x91'),_0x80d9('0x92'),_0x80d9('0x93'),'approval',_0x80d9('0x94'),'due_date',_0x80d9('0x95'),_0x80d9('0x96'),_0x80d9('0x97'),_0x80d9('0x98'),'upon_approval',_0x80d9('0x99'),_0x80d9('0x9a'),_0x80d9('0x5c')];var _0x3472c2='';var _0x4718b8='';var _0x56ae7d=[];var _0x107373='';var _0x3e3f67='';var _0x2605bc=[];var _0x35e409='';var _0x31c924='';var _0x5cb87b={};var _0xcdf6e='';return db[_0x80d9('0x2b')][_0x80d9('0x49')]({'where':{'id':_0xb07123['params']['id']},'attributes':['id','username','password',_0x80d9('0x9b'),_0x80d9('0x9c'),_0x80d9('0x9d')]})[_0x80d9('0x25')](handleEntityNotFound(_0xe434e0,null))['then'](function(_0x5866e2){if(_0x5866e2){_0xcdf6e=_0x5866e2[_0x80d9('0x9c')];var _0x107d99=_0xcdf6e[_0x80d9('0x9e')](-0x1);if(_0x107d99==='/'){_0xcdf6e=_0xcdf6e[_0x80d9('0x9f')](0x0,_0xcdf6e[_0x80d9('0xa0')](_0x107d99));}_0x31c924=util[_0x80d9('0xa1')]('%s/api/now/doc/table/schema/',_0xcdf6e);_0x35e409=util[_0x80d9('0xa1')](_0x80d9('0xa2'),_0xcdf6e);_0x5cb87b={'user':_0x5866e2[_0x80d9('0xa3')],'pass':_0x5866e2[_0x80d9('0xa4')]};var _0x1809ea={'method':'GET','uri':_0x31c924+'incident?sysparm_display_value=all','auth':_0x5cb87b,'json':!![]};return rp(_0x1809ea);}})[_0x80d9('0x25')](function(_0x4f67f8){if(_0x4f67f8['result'][_0x80d9('0x37')]>0x0){_0x3472c2=_0x4f67f8[_0x80d9('0xa5')];}console[_0x80d9('0xa6')](_0x80d9('0xa7'),_0x3472c2);_0x2605bc=[];_0x4718b8=Object['assign']([],_0x3472c2);_[_0x80d9('0xa8')](_0x4718b8,function(_0x17c4e0){return!_0x1e97af['includes'](_0x17c4e0[_0x80d9('0x28')]);});_0x4718b8[_0x80d9('0xa9')](function(_0x422833){var _0x38dfed=createFieldObject(_0x35e409,_0x5cb87b,_0x422833[_0x80d9('0xaa')],_0x422833[_0x80d9('0x28')],_0x422833[_0x80d9('0xab')],![]);_0x2605bc[_0x80d9('0xac')](_0x38dfed);});return Promise[_0x80d9('0xad')](_0x2605bc);})[_0x80d9('0x25')](function(_0x313783){_0x56ae7d=_0x313783;_0x107373=Object[_0x80d9('0xae')]([],_0x3472c2);console[_0x80d9('0xa6')](_0x80d9('0xaf'),_0x3472c2);_[_0x80d9('0xa8')](_0x107373,function(_0x4d27af){return _0x3647f7[_0x80d9('0xb0')](_0x4d27af['name']);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x107373);_0x2605bc=[];_0x107373['forEach'](function(_0x75b4c1){var _0x505d7d=createFieldObject(_0x35e409,_0x5cb87b,_0x75b4c1[_0x80d9('0xaa')],_0x75b4c1[_0x80d9('0x28')],_0x75b4c1[_0x80d9('0xab')],!![]);_0x2605bc[_0x80d9('0xac')](_0x505d7d);});return Promise[_0x80d9('0xad')](_0x2605bc);})['then'](function(_0x4c3059){_0x3e3f67=_0x4c3059;var _0x5e3928=_0x56ae7d[_0x80d9('0xb1')](_0x3e3f67);return{'count':_0x5e3928[_0x80d9('0x37')],'rows':_0x5e3928};})[_0x80d9('0x25')](respondWithResult(_0xe434e0,null))[_0x80d9('0x46')](function(_0x3f00b9){console['log'](_0x80d9('0xb2')+_0x3f00b9);var _0x1e4e27=_0xb07123['query'][_0x80d9('0xb3')]?0x1f4:_0x3f00b9['statusCode']||0x1f4;logger[_0x80d9('0x27')](_0x3f00b9[_0x80d9('0xb4')]);delete _0x3f00b9[_0x80d9('0x28')];if(_0x1e4e27===0x191){_0x1e4e27=0x190;}_0xe434e0[_0x80d9('0x19')](_0x1e4e27)[_0x80d9('0x29')](_0xb07123[_0x80d9('0x31')]['test']?{'message':_0x80d9('0xb5'),'statusCode':_0x3f00b9[_0x80d9('0xb6')]}:_0x3f00b9);});};function createFieldObject(_0x4c91b0,_0x3ac0fd,_0x56366,_0x38701b,_0x13a48d,_0x52d494){return new Promise(function(_0xd2f452,_0x40e1f3){var _0x1e7884={'id':_0x38701b,'name':_0x13a48d,'custom':_0x52d494};if(_0x56366===_0x80d9('0xb7')){_0x1e7884[_0x80d9('0x3e')]=[{'name':'True','value':_0x80d9('0xb8')},{'name':'False','value':'false'}];_0xd2f452(_0x1e7884);}else{var _0x4a1168={'method':'GET','uri':_0x4c91b0+_0x80d9('0xb9')+_0x38701b,'auth':_0x3ac0fd,'json':!![]};return rp(_0x4a1168)[_0x80d9('0x25')](function(_0x224f03){var _0x742d95=[];if(_0x224f03['result'][_0x80d9('0x37')]>0x0){_0x224f03['result'][_0x80d9('0xa9')](function(_0x311558){if(_0x311558['inactive']==='false'){var _0x3205ff={'name':_0x311558[_0x80d9('0xab')],'value':_0x311558[_0x80d9('0xba')]};_0x742d95[_0x80d9('0xac')](_0x3205ff);}});}_0x1e7884[_0x80d9('0x3e')]=_0x742d95;if(_0x1e7884[_0x80d9('0x3e')][_0x80d9('0x37')]>0x0){_0xd2f452(_0x1e7884);}else{if(_0x52d494==![]){_0xd2f452();}else{_0xd2f452(_0x1e7884);}}});}});} \ No newline at end of file +var _0x28cf=['sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','then','error','stack','name','send','ServicenowAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','map','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','destroy','getConfigurations','findOne','pick','addConfiguration','getSubjects','channel','Descriptions','ServicenowConfiguration','ServicenowField','getFields','hold_reason','knowledge','close_code','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','calendar_stc','cmdb_ci','delivery_plan','business_service','sys_domain_path','rfc','time_worked','group_list','reopened_time','resolved_at','caller_id','approval_set','subcategory','work_notes','short_description','delivery_task','description','calendar_duration','notify','sys_class_name','close_notes','closed_by','follow_up','sys_id','reopened_by','urgency','problem_id','assigned_to','comments','approval','comments_and_work_notes','due_date','reopen_count','sys_tags','correlation_id','username','email','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','password','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','includes','forEach','label','all','TCL:\x20_object','remove','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','ServiceNow\x20error:\x20','test','statusCode','boolean','False','false'];(function(_0x1ae31c,_0x8dcd2d){var _0x19519d=function(_0x22b8cd){while(--_0x22b8cd){_0x1ae31c['push'](_0x1ae31c['shift']());}};_0x19519d(++_0x8dcd2d);}(_0x28cf,0x155));var _0xf28c=function(_0xb775ad,_0xbd08e5){_0xb775ad=_0xb775ad-0x0;var _0x177404=_0x28cf[_0xb775ad];return _0x177404;};'use strict';var emlformat=require(_0xf28c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf28c('0x1'));var jsonpatch=require(_0xf28c('0x2'));var rp=require(_0xf28c('0x3'));var moment=require(_0xf28c('0x4'));var BPromise=require(_0xf28c('0x5'));var Mustache=require(_0xf28c('0x6'));var util=require(_0xf28c('0x7'));var path=require(_0xf28c('0x8'));var sox=require(_0xf28c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf28c('0xa'));var squel=require(_0xf28c('0xb'));var crypto=require(_0xf28c('0xc'));var jsforce=require(_0xf28c('0xd'));var deskjs=require(_0xf28c('0xe'));var toCsv=require('to-csv');var querystring=require(_0xf28c('0xf'));var Papa=require(_0xf28c('0x10'));var Redis=require(_0xf28c('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf28c('0x12'));var as=require(_0xf28c('0x13'));var hardwareService=require(_0xf28c('0x14'));var logger=require(_0xf28c('0x15'))(_0xf28c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf28c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf28c('0x18'));function respondWithStatusCode(_0x4268fa,_0x581415){_0x581415=_0x581415||0xcc;return function(_0x19e4bd){if(_0x19e4bd){return _0x4268fa[_0xf28c('0x19')](_0x581415);}return _0x4268fa[_0xf28c('0x1a')](_0x581415)[_0xf28c('0x1b')]();};}function respondWithResult(_0x242213,_0x218455){_0x218455=_0x218455||0xc8;return function(_0x373b47){if(_0x373b47){return _0x242213[_0xf28c('0x1a')](_0x218455)['json'](_0x373b47);}};}function respondWithFilteredResult(_0x3bb3cd,_0x9a5d58){return function(_0x4e0b13){if(_0x4e0b13){var _0xa9cc3a=typeof _0x9a5d58[_0xf28c('0x1c')]===_0xf28c('0x1d')&&typeof _0x9a5d58[_0xf28c('0x1e')]===_0xf28c('0x1d');var _0x55fa55=_0x4e0b13[_0xf28c('0x1f')];var _0x61ed59=_0xa9cc3a?0x0:_0x9a5d58[_0xf28c('0x1c')];var _0x26e8a8=_0xa9cc3a?_0x4e0b13[_0xf28c('0x1f')]:_0x9a5d58['offset']+_0x9a5d58['limit'];var _0x447220;if(_0x26e8a8>=_0x55fa55){_0x26e8a8=_0x55fa55;_0x447220=0xc8;}else{_0x447220=0xce;}_0x3bb3cd['status'](_0x447220);return _0x3bb3cd['set'](_0xf28c('0x20'),_0x61ed59+'-'+_0x26e8a8+'/'+_0x55fa55)[_0xf28c('0x21')](_0x4e0b13);}return null;};}function patchUpdates(_0x589381){return function(_0x37e3a0){try{jsonpatch[_0xf28c('0x22')](_0x37e3a0,_0x589381,!![]);}catch(_0x31eed1){return BPromise[_0xf28c('0x23')](_0x31eed1);}return _0x37e3a0['save']();};}function saveUpdates(_0x24097a,_0x370618){return function(_0x5d7451){if(_0x5d7451){return _0x5d7451['update'](_0x24097a)[_0xf28c('0x24')](function(_0xbc9211){return _0xbc9211;});}return null;};}function removeEntity(_0x52a4fb,_0x150ef5){return function(_0x3b1541){if(_0x3b1541){return _0x3b1541['destroy']()[_0xf28c('0x24')](function(){_0x52a4fb[_0xf28c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x59bf42,_0x239478){return function(_0x273eec){if(!_0x273eec){_0x59bf42[_0xf28c('0x19')](0x194);}return _0x273eec;};}function handleError(_0x21c6b9,_0x3f943f){_0x3f943f=_0x3f943f||0x1f4;return function(_0x5de864){logger[_0xf28c('0x25')](_0x5de864[_0xf28c('0x26')]);if(_0x5de864[_0xf28c('0x27')]){delete _0x5de864['name'];}_0x21c6b9[_0xf28c('0x1a')](_0x3f943f)[_0xf28c('0x28')](_0x5de864);};}exports['index']=function(_0x5d47d5,_0x1712d8){var _0x53080b={},_0x36a152={},_0x1059a5={'count':0x0,'rows':[]};var _0x171fb6=_['map'](db[_0xf28c('0x29')]['rawAttributes'],function(_0x41eaa6){return{'name':_0x41eaa6[_0xf28c('0x2a')],'type':_0x41eaa6[_0xf28c('0x2b')]['key']};});_0x36a152[_0xf28c('0x2c')]=_['map'](_0x171fb6,_0xf28c('0x27'));_0x36a152[_0xf28c('0x2d')]=_[_0xf28c('0x2e')](_0x5d47d5[_0xf28c('0x2d')]);_0x36a152[_0xf28c('0x2f')]=_[_0xf28c('0x30')](_0x36a152[_0xf28c('0x2c')],_0x36a152[_0xf28c('0x2d')]);_0x53080b['attributes']=_[_0xf28c('0x30')](_0x36a152['model'],qs[_0xf28c('0x31')](_0x5d47d5['query']['fields']));_0x53080b[_0xf28c('0x32')]=_0x53080b[_0xf28c('0x32')][_0xf28c('0x33')]?_0x53080b['attributes']:_0x36a152[_0xf28c('0x2c')];if(!_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x34')](_0xf28c('0x35'))){_0x53080b[_0xf28c('0x1e')]=qs['limit'](_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x1e')]);_0x53080b[_0xf28c('0x1c')]=qs[_0xf28c('0x1c')](_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x1c')]);}_0x53080b[_0xf28c('0x36')]=qs[_0xf28c('0x37')](_0x5d47d5[_0xf28c('0x2d')]['sort']);_0x53080b['where']=qs['filters'](_['pick'](_0x5d47d5[_0xf28c('0x2d')],_0x36a152[_0xf28c('0x2f')]),_0x171fb6);if(_0x5d47d5['query'][_0xf28c('0x38')]){_0x53080b[_0xf28c('0x39')]=_['merge'](_0x53080b[_0xf28c('0x39')],{'$or':_[_0xf28c('0x3a')](_0x171fb6,function(_0x5da3f5){if(_0x5da3f5[_0xf28c('0x2b')]!=='VIRTUAL'){var _0xd08d71={};_0xd08d71[_0x5da3f5['name']]={'$like':'%'+_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x38')]+'%'};return _0xd08d71;}})});}_0x53080b=_[_0xf28c('0x3b')]({},_0x53080b,_0x5d47d5[_0xf28c('0x3c')]);var _0x2e78f2={'where':_0x53080b[_0xf28c('0x39')]};return db['ServicenowAccount'][_0xf28c('0x1f')](_0x2e78f2)[_0xf28c('0x24')](function(_0x454614){_0x1059a5[_0xf28c('0x1f')]=_0x454614;if(_0x5d47d5[_0xf28c('0x2d')][_0xf28c('0x3d')]){_0x53080b[_0xf28c('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xf28c('0x3f')](_0x53080b);})[_0xf28c('0x24')](function(_0x592bd6){_0x1059a5['rows']=_0x592bd6;return _0x1059a5;})[_0xf28c('0x24')](respondWithFilteredResult(_0x1712d8,_0x53080b))[_0xf28c('0x40')](handleError(_0x1712d8,null));};exports[_0xf28c('0x41')]=function(_0x2eb072,_0x5a3df6){var _0x1f1601={'raw':![],'where':{'id':_0x2eb072[_0xf28c('0x42')]['id']}},_0x32b838={};_0x32b838[_0xf28c('0x2c')]=_[_0xf28c('0x2e')](db[_0xf28c('0x29')][_0xf28c('0x43')]);_0x32b838['query']=_[_0xf28c('0x2e')](_0x2eb072[_0xf28c('0x2d')]);_0x32b838[_0xf28c('0x2f')]=_['intersection'](_0x32b838['model'],_0x32b838[_0xf28c('0x2d')]);_0x1f1601['attributes']=_[_0xf28c('0x30')](_0x32b838[_0xf28c('0x2c')],qs[_0xf28c('0x31')](_0x2eb072[_0xf28c('0x2d')][_0xf28c('0x31')]));_0x1f1601[_0xf28c('0x32')]=_0x1f1601[_0xf28c('0x32')][_0xf28c('0x33')]?_0x1f1601[_0xf28c('0x32')]:_0x32b838[_0xf28c('0x2c')];if(_0x2eb072[_0xf28c('0x2d')][_0xf28c('0x3d')]){_0x1f1601[_0xf28c('0x3e')]=[{'all':!![]}];}_0x1f1601=_['merge']({},_0x1f1601,_0x2eb072[_0xf28c('0x3c')]);return db['ServicenowAccount']['find'](_0x1f1601)[_0xf28c('0x24')](handleEntityNotFound(_0x5a3df6,null))[_0xf28c('0x24')](respondWithResult(_0x5a3df6,null))[_0xf28c('0x40')](handleError(_0x5a3df6,null));};exports[_0xf28c('0x44')]=function(_0x16e0af,_0x23dc4c){return db[_0xf28c('0x29')][_0xf28c('0x44')](_0x16e0af['body'],{})['then'](respondWithResult(_0x23dc4c,0xc9))[_0xf28c('0x40')](handleError(_0x23dc4c,null));};exports['update']=function(_0x209c58,_0xf23844){if(_0x209c58[_0xf28c('0x45')]['id']){delete _0x209c58[_0xf28c('0x45')]['id'];}return db[_0xf28c('0x29')][_0xf28c('0x46')]({'where':{'id':_0x209c58[_0xf28c('0x42')]['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0xf23844,null))['then'](saveUpdates(_0x209c58[_0xf28c('0x45')],null))[_0xf28c('0x24')](respondWithResult(_0xf23844,null))[_0xf28c('0x40')](handleError(_0xf23844,null));};exports[_0xf28c('0x47')]=function(_0x4eb70a,_0x21fdb6){return db[_0xf28c('0x29')]['find']({'where':{'id':_0x4eb70a[_0xf28c('0x42')]['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0x21fdb6,null))['then'](removeEntity(_0x21fdb6,null))['catch'](handleError(_0x21fdb6,null));};exports[_0xf28c('0x48')]=function(_0x4e1b8d,_0x2eba74,_0x1d3b7f){var _0x3edbe9={};var _0xb10282={};var _0x2c276e;var _0x58a055;return db[_0xf28c('0x29')][_0xf28c('0x49')]({'where':{'id':_0x4e1b8d['params']['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0x2eba74,null))[_0xf28c('0x24')](function(_0x6d170c){if(_0x6d170c){_0x2c276e=_0x6d170c;_0xb10282[_0xf28c('0x2c')]=_[_0xf28c('0x2e')](db['ServicenowConfiguration']['rawAttributes']);_0xb10282[_0xf28c('0x2d')]=_[_0xf28c('0x2e')](_0x4e1b8d[_0xf28c('0x2d')]);_0xb10282[_0xf28c('0x2f')]=_['intersection'](_0xb10282[_0xf28c('0x2c')],_0xb10282[_0xf28c('0x2d')]);_0x3edbe9['attributes']=_[_0xf28c('0x30')](_0xb10282[_0xf28c('0x2c')],qs[_0xf28c('0x31')](_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x31')]));_0x3edbe9[_0xf28c('0x32')]=_0x3edbe9[_0xf28c('0x32')][_0xf28c('0x33')]?_0x3edbe9[_0xf28c('0x32')]:_0xb10282[_0xf28c('0x2c')];_0x3edbe9[_0xf28c('0x36')]=qs[_0xf28c('0x37')](_0x4e1b8d[_0xf28c('0x2d')]['sort']);_0x3edbe9[_0xf28c('0x39')]=qs[_0xf28c('0x2f')](_[_0xf28c('0x4a')](_0x4e1b8d[_0xf28c('0x2d')],_0xb10282[_0xf28c('0x2f')]));if(_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x38')]){_0x3edbe9[_0xf28c('0x39')]=_['merge'](_0x3edbe9['where'],{'$or':_['map'](_0x3edbe9['attributes'],function(_0x2aa2e5){var _0x414c5d={};_0x414c5d[_0x2aa2e5]={'$like':'%'+_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x38')]+'%'};return _0x414c5d;})});}_0x3edbe9=_[_0xf28c('0x3b')]({},_0x3edbe9,_0x4e1b8d[_0xf28c('0x3c')]);return _0x2c276e['getConfigurations'](_0x3edbe9);}})[_0xf28c('0x24')](function(_0x372b1b){if(_0x372b1b){_0x58a055=_0x372b1b['length'];if(!_0x4e1b8d[_0xf28c('0x2d')]['hasOwnProperty'](_0xf28c('0x35'))){_0x3edbe9[_0xf28c('0x1e')]=qs['limit'](_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x1e')]);_0x3edbe9[_0xf28c('0x1c')]=qs['offset'](_0x4e1b8d[_0xf28c('0x2d')][_0xf28c('0x1c')]);}return _0x2c276e[_0xf28c('0x48')](_0x3edbe9);}})[_0xf28c('0x24')](function(_0x24c341){if(_0x24c341){return _0x24c341?{'count':_0x58a055,'rows':_0x24c341}:null;}})[_0xf28c('0x24')](respondWithResult(_0x2eba74,null))[_0xf28c('0x40')](handleError(_0x2eba74,null));};exports[_0xf28c('0x4b')]=function(_0x5a962c,_0x58de1a,_0x786a0e){if(_0x5a962c[_0xf28c('0x45')]['id']){delete _0x5a962c[_0xf28c('0x45')]['id'];}return db['ServicenowAccount'][_0xf28c('0x49')]({'where':{'id':_0x5a962c['params']['id']}})[_0xf28c('0x24')](handleEntityNotFound(_0x58de1a,null))[_0xf28c('0x24')](function(_0x38fbf1){if(_0x38fbf1){_0x5a962c[_0xf28c('0x45')]['AccountId']=_0x38fbf1['id'];_0x5a962c['body']['Subjects']=integrations[_0xf28c('0x4c')](_0x5a962c[_0xf28c('0x45')][_0xf28c('0x4d')],_0x5a962c[_0xf28c('0x45')][_0xf28c('0x2b')]);_0x5a962c[_0xf28c('0x45')][_0xf28c('0x4e')]=integrations['getDescriptions'](_0x5a962c[_0xf28c('0x45')]['channel'],_0x5a962c[_0xf28c('0x45')][_0xf28c('0x2b')]);return db[_0xf28c('0x4f')][_0xf28c('0x44')](_0x5a962c[_0xf28c('0x45')],{'include':[{'model':db[_0xf28c('0x50')],'as':'Subjects'},{'model':db[_0xf28c('0x50')],'as':_0xf28c('0x4e')}]});}return null;})[_0xf28c('0x24')](respondWithResult(_0x58de1a,null))[_0xf28c('0x40')](handleError(_0x58de1a,null));};exports[_0xf28c('0x51')]=function(_0x42af51,_0x10c810,_0x6cb8f5){var _0x1460b4=['made_sla',_0xf28c('0x52'),_0xf28c('0x53'),'subcategory',_0xf28c('0x54'),'notify','incident_state',_0xf28c('0x55'),_0xf28c('0x56')];var _0x48291d=[_0xf28c('0x57'),_0xf28c('0x58'),_0xf28c('0x59'),_0xf28c('0x5a'),'upon_reject',_0xf28c('0x5b'),_0xf28c('0x5c'),'hold_reason',_0xf28c('0x5d'),_0xf28c('0x5e'),_0xf28c('0x5f'),'sys_updated_by',_0xf28c('0x60'),_0xf28c('0x61'),_0xf28c('0x62'),_0xf28c('0x63'),'state','sys_created_by',_0xf28c('0x53'),_0xf28c('0x36'),_0xf28c('0x64'),'closed_at',_0xf28c('0x65'),_0xf28c('0x66'),'impact','active','work_notes_list',_0xf28c('0x67'),'priority',_0xf28c('0x68'),_0xf28c('0x69'),_0xf28c('0x6a'),'expected_start','opened_at','business_duration',_0xf28c('0x6b'),'work_end',_0xf28c('0x6c'),_0xf28c('0x6d'),_0xf28c('0x6e'),_0xf28c('0x6f'),_0xf28c('0x70'),_0xf28c('0x71'),_0xf28c('0x72'),_0xf28c('0x54'),'correlation_display',_0xf28c('0x73'),'work_start','assignment_group','business_stc','additional_assignee_list',_0xf28c('0x74'),_0xf28c('0x75'),_0xf28c('0x76'),_0xf28c('0x77'),_0xf28c('0x78'),_0xf28c('0x79'),_0xf28c('0x7a'),'parent_incident',_0xf28c('0x7b'),'contact_type',_0xf28c('0x7c'),'incident_state',_0xf28c('0x7d'),_0xf28c('0x7e'),'company','reassignment_count','activity_due',_0xf28c('0x7f'),_0xf28c('0x55'),_0xf28c('0x80'),'sla_due',_0xf28c('0x81'),_0xf28c('0x82'),_0xf28c('0x83'),'sys_mod_count',_0xf28c('0x84'),_0xf28c('0x85'),'escalation','upon_approval',_0xf28c('0x86'),'location',_0xf28c('0x56')];var _0x1f476a='';var _0x1a395b='';var _0x414d01=[];var _0x309c9d='';var _0x3a7b84='';var _0x5f3ad6=[];var _0xa1e4e9='';var _0x287fe9='';var _0x450d9f={};var _0x3056d8='';return db[_0xf28c('0x29')]['findOne']({'where':{'id':_0x42af51['params']['id']},'attributes':['id',_0xf28c('0x87'),'password',_0xf28c('0x88'),_0xf28c('0x89'),_0xf28c('0x8a')]})[_0xf28c('0x24')](handleEntityNotFound(_0x10c810,null))[_0xf28c('0x24')](function(_0x5d3f19){if(_0x5d3f19){_0x3056d8=_0x5d3f19[_0xf28c('0x89')];var _0xcd1269=_0x3056d8['slice'](-0x1);if(_0xcd1269==='/'){_0x3056d8=_0x3056d8[_0xf28c('0x8b')](0x0,_0x3056d8[_0xf28c('0x8c')](_0xcd1269));}_0x287fe9=util[_0xf28c('0x8d')](_0xf28c('0x8e'),_0x3056d8);_0xa1e4e9=util[_0xf28c('0x8d')](_0xf28c('0x8f'),_0x3056d8);_0x450d9f={'user':_0x5d3f19[_0xf28c('0x87')],'pass':_0x5d3f19[_0xf28c('0x90')]};var _0x5c654b={'method':_0xf28c('0x91'),'uri':_0x287fe9+_0xf28c('0x92'),'auth':_0x450d9f,'json':!![]};return rp(_0x5c654b);}})[_0xf28c('0x24')](function(_0x2b9bff){if(_0x2b9bff[_0xf28c('0x93')][_0xf28c('0x33')]>0x0){_0x1f476a=_0x2b9bff[_0xf28c('0x93')];}console[_0xf28c('0x94')](_0xf28c('0x95'),_0x1f476a);_0x5f3ad6=[];_0x1a395b=Object[_0xf28c('0x96')]([],_0x1f476a);_['remove'](_0x1a395b,function(_0x3179d7){return!_0x1460b4[_0xf28c('0x97')](_0x3179d7[_0xf28c('0x27')]);});_0x1a395b[_0xf28c('0x98')](function(_0x347b65){var _0x1db345=createFieldObject(_0xa1e4e9,_0x450d9f,_0x347b65['internalType'],_0x347b65[_0xf28c('0x27')],_0x347b65[_0xf28c('0x99')],![]);_0x5f3ad6['push'](_0x1db345);});return Promise[_0xf28c('0x9a')](_0x5f3ad6);})['then'](function(_0x379318){_0x414d01=_0x379318;_0x309c9d=Object['assign']([],_0x1f476a);console[_0xf28c('0x94')](_0xf28c('0x9b'),_0x1f476a);_[_0xf28c('0x9c')](_0x309c9d,function(_0xa9e77){return _0x48291d[_0xf28c('0x97')](_0xa9e77[_0xf28c('0x27')]);});console[_0xf28c('0x94')](_0xf28c('0x9d'),_0x309c9d);_0x5f3ad6=[];_0x309c9d['forEach'](function(_0x5423b9){var _0x29f1bb=createFieldObject(_0xa1e4e9,_0x450d9f,_0x5423b9['internalType'],_0x5423b9[_0xf28c('0x27')],_0x5423b9[_0xf28c('0x99')],!![]);_0x5f3ad6[_0xf28c('0x9e')](_0x29f1bb);});return Promise[_0xf28c('0x9a')](_0x5f3ad6);})[_0xf28c('0x24')](function(_0x5f3adb){_0x3a7b84=_0x5f3adb;var _0x30d4c3=_0x414d01[_0xf28c('0x9f')](_0x3a7b84);return{'count':_0x30d4c3[_0xf28c('0x33')],'rows':_0x30d4c3};})[_0xf28c('0x24')](respondWithResult(_0x10c810,null))[_0xf28c('0x40')](function(_0x330086){console['log'](_0xf28c('0xa0')+_0x330086);var _0x45c348=_0x42af51['query'][_0xf28c('0xa1')]?0x1f4:_0x330086[_0xf28c('0xa2')]||0x1f4;logger[_0xf28c('0x25')](_0x330086[_0xf28c('0x26')]);delete _0x330086[_0xf28c('0x27')];if(_0x45c348===0x191){_0x45c348=0x190;}_0x10c810[_0xf28c('0x1a')](_0x45c348)[_0xf28c('0x28')](_0x42af51[_0xf28c('0x2d')][_0xf28c('0xa1')]?{'message':'Wrong\x20credentials','statusCode':_0x330086[_0xf28c('0xa2')]}:_0x330086);});};function createFieldObject(_0x31f092,_0x5eed15,_0x349488,_0x32670b,_0x100712,_0x445359){return new Promise(function(_0x450b3f,_0x39eb63){var _0x4336b2={'id':_0x32670b,'name':_0x100712,'custom':_0x445359};if(_0x349488===_0xf28c('0xa3')){_0x4336b2[_0xf28c('0x3c')]=[{'name':'True','value':'true'},{'name':_0xf28c('0xa4'),'value':_0xf28c('0xa5')}];_0x450b3f(_0x4336b2);}else{var _0x252a71={'method':_0xf28c('0x91'),'uri':_0x31f092+_0xf28c('0xa6')+_0x32670b,'auth':_0x5eed15,'json':!![]};return rp(_0x252a71)[_0xf28c('0x24')](function(_0x43051c){var _0x1871eb=[];if(_0x43051c['result'][_0xf28c('0x33')]>0x0){_0x43051c[_0xf28c('0x93')]['forEach'](function(_0x33547b){if(_0x33547b[_0xf28c('0xa7')]===_0xf28c('0xa5')){var _0x1b807b={'name':_0x33547b[_0xf28c('0x99')],'value':_0x33547b[_0xf28c('0xa8')]};_0x1871eb[_0xf28c('0x9e')](_0x1b807b);}});}_0x4336b2[_0xf28c('0x3c')]=_0x1871eb;if(_0x4336b2['options'][_0xf28c('0x33')]>0x0){_0x450b3f(_0x4336b2);}else{if(_0x445359==![]){_0x450b3f();}else{_0x450b3f(_0x4336b2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index d737aac..e54976b 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(_0x34e840,_0x6a4626){var _0x40c465=function(_0x3eeb1c){while(--_0x3eeb1c){_0x34e840['push'](_0x34e840['shift']());}};_0x40c465(++_0x6a4626);}(_0x687b,0x14a));var _0xb687=function(_0x7ba1c3,_0x3dd545){_0x7ba1c3=_0x7ba1c3-0x0;var _0x82b393=_0x687b[_0x7ba1c3];return _0x82b393;};'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 _0x038b=['path','rimraf','./intServicenowAccount.attributes','../../components/integrations/configuration','define','ServicenowAccount','util','../../config/logger','api','bluebird'];(function(_0x3cf88d,_0x360188){var _0x1cb0b1=function(_0x1e01d5){while(--_0x1e01d5){_0x3cf88d['push'](_0x3cf88d['shift']());}};_0x1cb0b1(++_0x360188);}(_0x038b,0x114));var _0xb038=function(_0x44bd5,_0x46e7c1){_0x44bd5=_0x44bd5-0x0;var _0x4d244b=_0x038b[_0x44bd5];return _0x4d244b;};'use strict';var _=require('lodash');var util=require(_0xb038('0x0'));var logger=require(_0xb038('0x1'))(_0xb038('0x2'));var moment=require('moment');var BPromise=require(_0xb038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb038('0x4'));var rimraf=require(_0xb038('0x5'));var config=require('../../config/environment');var attributes=require(_0xb038('0x6'));var integrations=require(_0xb038('0x7'));module['exports']=function(_0x54e1e7,_0x2e3e64){return _0x54e1e7[_0xb038('0x8')](_0xb038('0x9'),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 053e758..806cb92 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 _0xc270=['catch','ShowServicenowAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','map','include','model'];(function(_0x17cded,_0xa51b6b){var _0x41b11f=function(_0xa647a){while(--_0xa647a){_0x17cded['push'](_0x17cded['shift']());}};_0x41b11f(++_0xa51b6b);}(_0xc270,0x1e4));var _0x0c27=function(_0x147796,_0x3df473){_0x147796=_0x147796-0x0;var _0x55b105=_0xc270[_0x147796];return _0x55b105;};'use strict';var _=require(_0x0c27('0x0'));var util=require('util');var moment=require(_0x0c27('0x1'));var BPromise=require(_0x0c27('0x2'));var rs=require(_0x0c27('0x3'));var fs=require('fs');var Redis=require(_0x0c27('0x4'));var db=require(_0x0c27('0x5'))['db'];var utils=require(_0x0c27('0x6'));var logger=require('../../config/logger')(_0x0c27('0x7'));var config=require(_0x0c27('0x8'));var jayson=require(_0x0c27('0x9'));var client=jayson[_0x0c27('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3796f3,_0x87b3c8,_0x5ecc0a){return new BPromise(function(_0x518399,_0xb0828){return client[_0x0c27('0xb')](_0x3796f3,_0x5ecc0a)[_0x0c27('0xc')](function(_0x79829c){logger[_0x0c27('0xd')](_0x0c27('0xe'),_0x87b3c8,_0x0c27('0xf'));logger[_0x0c27('0x10')](_0x0c27('0x11'),_0x87b3c8,_0x0c27('0xf'),JSON[_0x0c27('0x12')](_0x79829c));if(_0x79829c[_0x0c27('0x13')]){if(_0x79829c[_0x0c27('0x13')][_0x0c27('0x14')]===0x1f4){logger[_0x0c27('0x13')](_0x0c27('0xe'),_0x87b3c8,_0x79829c[_0x0c27('0x13')][_0x0c27('0x15')]);return _0xb0828(_0x79829c[_0x0c27('0x13')][_0x0c27('0x15')]);}logger[_0x0c27('0x13')](_0x0c27('0xe'),_0x87b3c8,_0x79829c[_0x0c27('0x13')]['message']);return _0x518399(_0x79829c[_0x0c27('0x13')]['message']);}else{logger['info'](_0x0c27('0xe'),_0x87b3c8,_0x0c27('0xf'));_0x518399(_0x79829c[_0x0c27('0x16')][_0x0c27('0x15')]);}})['catch'](function(_0x1307b2){logger[_0x0c27('0x13')]('ServicenowAccount,\x20%s,\x20%s',_0x87b3c8,_0x1307b2);_0xb0828(_0x1307b2);});});}exports[_0x0c27('0x17')]=function(_0xc14271){var _0x4b1d2a=this;return new Promise(function(_0x2b07de,_0x534357){return db[_0x0c27('0x18')][_0x0c27('0x19')]({'raw':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1b')]===undefined?!![]:![]:!![],'where':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1c')]||null:null,'attributes':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1d')]||null:null,'limit':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')][_0x0c27('0x1e')]||null:null,'include':_0xc14271[_0x0c27('0x1a')]?_0xc14271[_0x0c27('0x1a')]['include']?_[_0x0c27('0x1f')](_0xc14271[_0x0c27('0x1a')][_0x0c27('0x20')],function(_0x44b945){return{'model':db[_0x44b945[_0x0c27('0x21')]],'as':_0x44b945['as'],'attributes':_0x44b945['attributes'],'include':_0x44b945['include']?_[_0x0c27('0x1f')](_0x44b945[_0x0c27('0x20')],function(_0x34d85b){return{'model':db[_0x34d85b[_0x0c27('0x21')]],'as':_0x34d85b['as'],'attributes':_0x34d85b[_0x0c27('0x1d')],'include':_0x34d85b['include']?_[_0x0c27('0x1f')](_0x34d85b[_0x0c27('0x20')],function(_0x632fd1){return{'model':db[_0x632fd1['model']],'as':_0x632fd1['as'],'attributes':_0x632fd1[_0x0c27('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x0c27('0xc')](function(_0x509d8c){logger[_0x0c27('0xd')]('GetServicenowAccount',_0xc14271);logger['debug'](_0x0c27('0x17'),_0xc14271,JSON[_0x0c27('0x12')](_0x509d8c));_0x2b07de(_0x509d8c);})[_0x0c27('0x22')](function(_0x1b756e){logger[_0x0c27('0x13')](_0x0c27('0x17'),_0x1b756e[_0x0c27('0x15')],_0xc14271);_0x534357(_0x4b1d2a[_0x0c27('0x13')](0x1f4,_0x1b756e['message']));});});};exports[_0x0c27('0x23')]=function(_0x8ce58b){var _0x47450f=this;return new Promise(function(_0xf6e653,_0xdd4b17){return db[_0x0c27('0x18')][_0x0c27('0x24')]({'raw':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b['options'][_0x0c27('0x1b')]===undefined?!![]:![]:!![],'where':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b[_0x0c27('0x1a')]['where']||null:null,'attributes':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b[_0x0c27('0x1a')]['attributes']||null:null,'include':_0x8ce58b[_0x0c27('0x1a')]?_0x8ce58b['options'][_0x0c27('0x20')]?_[_0x0c27('0x1f')](_0x8ce58b['options']['include'],function(_0x5b5144){return{'model':db[_0x5b5144[_0x0c27('0x21')]],'as':_0x5b5144['as'],'attributes':_0x5b5144['attributes'],'include':_0x5b5144['include']?_[_0x0c27('0x1f')](_0x5b5144[_0x0c27('0x20')],function(_0x4550d5){return{'model':db[_0x4550d5[_0x0c27('0x21')]],'as':_0x4550d5['as'],'attributes':_0x4550d5[_0x0c27('0x1d')],'include':_0x4550d5[_0x0c27('0x20')]?_[_0x0c27('0x1f')](_0x4550d5[_0x0c27('0x20')],function(_0x3d96ce){return{'model':db[_0x3d96ce[_0x0c27('0x21')]],'as':_0x3d96ce['as'],'attributes':_0x3d96ce['attributes']};}):[]};}):[]};}):[]:[]})[_0x0c27('0xc')](function(_0x42c069){logger[_0x0c27('0xd')](_0x0c27('0x23'),_0x8ce58b);logger[_0x0c27('0x10')](_0x0c27('0x23'),_0x8ce58b,JSON[_0x0c27('0x12')](_0x42c069));_0xf6e653(_0x42c069);})[_0x0c27('0x22')](function(_0x27f844){logger[_0x0c27('0x13')]('ShowServicenowAccount',_0x27f844[_0x0c27('0x15')],_0x8ce58b);_0xdd4b17(_0x47450f[_0x0c27('0x13')](0x1f4,_0x27f844[_0x0c27('0x15')]));});});}; \ No newline at end of file +var _0xa0b3=['ServicenowAccount','findAll','options','raw','attributes','limit','map','include','model','GetServicenowAccount','ShowServicenowAccount','lodash','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x3fb41c,_0x5d8db7){var _0x4b0169=function(_0x3a829f){while(--_0x3a829f){_0x3fb41c['push'](_0x3fb41c['shift']());}};_0x4b0169(++_0x5d8db7);}(_0xa0b3,0x6b));var _0x3a0b=function(_0x47bd7c,_0x3358ee){_0x47bd7c=_0x47bd7c-0x0;var _0x4aa095=_0xa0b3[_0x47bd7c];return _0x4aa095;};'use strict';var _=require(_0x3a0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3a0b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a0b('0x2'));var db=require(_0x3a0b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3a0b('0x4'))(_0x3a0b('0x5'));var config=require(_0x3a0b('0x6'));var jayson=require(_0x3a0b('0x7'));var client=jayson['client'][_0x3a0b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2d3aa6,_0x2ce591,_0x21dbb6){return new BPromise(function(_0x4ee83c,_0x31b7d6){return client['request'](_0x2d3aa6,_0x21dbb6)[_0x3a0b('0x9')](function(_0x3bd837){logger[_0x3a0b('0xa')](_0x3a0b('0xb'),_0x2ce591,_0x3a0b('0xc'));logger[_0x3a0b('0xd')](_0x3a0b('0xe'),_0x2ce591,_0x3a0b('0xc'),JSON[_0x3a0b('0xf')](_0x3bd837));if(_0x3bd837[_0x3a0b('0x10')]){if(_0x3bd837[_0x3a0b('0x10')][_0x3a0b('0x11')]===0x1f4){logger[_0x3a0b('0x10')]('ServicenowAccount,\x20%s,\x20%s',_0x2ce591,_0x3bd837[_0x3a0b('0x10')]['message']);return _0x31b7d6(_0x3bd837[_0x3a0b('0x10')][_0x3a0b('0x12')]);}logger[_0x3a0b('0x10')](_0x3a0b('0xb'),_0x2ce591,_0x3bd837['error']['message']);return _0x4ee83c(_0x3bd837[_0x3a0b('0x10')]['message']);}else{logger[_0x3a0b('0xa')](_0x3a0b('0xb'),_0x2ce591,_0x3a0b('0xc'));_0x4ee83c(_0x3bd837[_0x3a0b('0x13')][_0x3a0b('0x12')]);}})[_0x3a0b('0x14')](function(_0x530dae){logger['error'](_0x3a0b('0xb'),_0x2ce591,_0x530dae);_0x31b7d6(_0x530dae);});});}exports['GetServicenowAccount']=function(_0x3487a5){var _0x55a68c=this;return new Promise(function(_0x421cef,_0x426406){return db[_0x3a0b('0x15')][_0x3a0b('0x16')]({'raw':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')][_0x3a0b('0x18')]===undefined?!![]:![]:!![],'where':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')]['where']||null:null,'attributes':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')][_0x3a0b('0x19')]||null:null,'limit':_0x3487a5[_0x3a0b('0x17')]?_0x3487a5[_0x3a0b('0x17')][_0x3a0b('0x1a')]||null:null,'include':_0x3487a5['options']?_0x3487a5['options']['include']?_[_0x3a0b('0x1b')](_0x3487a5['options'][_0x3a0b('0x1c')],function(_0x1ffa7f){return{'model':db[_0x1ffa7f[_0x3a0b('0x1d')]],'as':_0x1ffa7f['as'],'attributes':_0x1ffa7f[_0x3a0b('0x19')],'include':_0x1ffa7f['include']?_['map'](_0x1ffa7f[_0x3a0b('0x1c')],function(_0x356f79){return{'model':db[_0x356f79[_0x3a0b('0x1d')]],'as':_0x356f79['as'],'attributes':_0x356f79[_0x3a0b('0x19')],'include':_0x356f79[_0x3a0b('0x1c')]?_[_0x3a0b('0x1b')](_0x356f79['include'],function(_0x2bc867){return{'model':db[_0x2bc867[_0x3a0b('0x1d')]],'as':_0x2bc867['as'],'attributes':_0x2bc867[_0x3a0b('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x181f73){logger['info'](_0x3a0b('0x1e'),_0x3487a5);logger[_0x3a0b('0xd')](_0x3a0b('0x1e'),_0x3487a5,JSON['stringify'](_0x181f73));_0x421cef(_0x181f73);})[_0x3a0b('0x14')](function(_0x1c2bfc){logger[_0x3a0b('0x10')]('GetServicenowAccount',_0x1c2bfc[_0x3a0b('0x12')],_0x3487a5);_0x426406(_0x55a68c[_0x3a0b('0x10')](0x1f4,_0x1c2bfc[_0x3a0b('0x12')]));});});};exports['ShowServicenowAccount']=function(_0x317690){var _0x547e37=this;return new Promise(function(_0x852047,_0x4da52b){return db['ServicenowAccount']['find']({'raw':_0x317690['options']?_0x317690[_0x3a0b('0x17')][_0x3a0b('0x18')]===undefined?!![]:![]:!![],'where':_0x317690['options']?_0x317690['options']['where']||null:null,'attributes':_0x317690[_0x3a0b('0x17')]?_0x317690[_0x3a0b('0x17')][_0x3a0b('0x19')]||null:null,'include':_0x317690[_0x3a0b('0x17')]?_0x317690[_0x3a0b('0x17')][_0x3a0b('0x1c')]?_[_0x3a0b('0x1b')](_0x317690[_0x3a0b('0x17')]['include'],function(_0xde6ec8){return{'model':db[_0xde6ec8[_0x3a0b('0x1d')]],'as':_0xde6ec8['as'],'attributes':_0xde6ec8[_0x3a0b('0x19')],'include':_0xde6ec8[_0x3a0b('0x1c')]?_['map'](_0xde6ec8['include'],function(_0x512b75){return{'model':db[_0x512b75['model']],'as':_0x512b75['as'],'attributes':_0x512b75[_0x3a0b('0x19')],'include':_0x512b75['include']?_[_0x3a0b('0x1b')](_0x512b75[_0x3a0b('0x1c')],function(_0xfcdba1){return{'model':db[_0xfcdba1[_0x3a0b('0x1d')]],'as':_0xfcdba1['as'],'attributes':_0xfcdba1['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a0b('0x9')](function(_0x187517){logger['info']('ShowServicenowAccount',_0x317690);logger[_0x3a0b('0xd')](_0x3a0b('0x1f'),_0x317690,JSON[_0x3a0b('0xf')](_0x187517));_0x852047(_0x187517);})[_0x3a0b('0x14')](function(_0x43962e){logger['error'](_0x3a0b('0x1f'),_0x43962e['message'],_0x317690);_0x4da52b(_0x547e37[_0x3a0b('0x10')](0x1f4,_0x43962e[_0x3a0b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 54a88a1..f808898 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 _0xf726=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports'];(function(_0x5b0c7d,_0x4ad3e2){var _0x42aab8=function(_0x5dce29){while(--_0x5dce29){_0x5b0c7d['push'](_0x5b0c7d['shift']());}};_0x42aab8(++_0x4ad3e2);}(_0xf726,0x198));var _0x6f72=function(_0x36d54e,_0x1096fd){_0x36d54e=_0x36d54e-0x0;var _0x42bc4e=_0xf726[_0x36d54e];return _0x42bc4e;};'use strict';var multer=require(_0x6f72('0x0'));var util=require(_0x6f72('0x1'));var path=require(_0x6f72('0x2'));var timeout=require(_0x6f72('0x3'));var express=require(_0x6f72('0x4'));var router=express[_0x6f72('0x5')]();var fs_extra=require(_0x6f72('0x6'));var auth=require(_0x6f72('0x7'));var interaction=require(_0x6f72('0x8'));var config=require('../../config/environment');var controller=require(_0x6f72('0x9'));router[_0x6f72('0xa')]('/',auth[_0x6f72('0xb')](),controller[_0x6f72('0xc')]);router[_0x6f72('0xa')](_0x6f72('0xd'),auth[_0x6f72('0xb')](),controller[_0x6f72('0xe')]);router[_0x6f72('0xa')](_0x6f72('0xf'),auth[_0x6f72('0xb')](),controller['getFields']);router[_0x6f72('0xa')](_0x6f72('0x10'),auth['isAuthenticated'](),controller[_0x6f72('0x11')]);router[_0x6f72('0xa')](_0x6f72('0x12'),auth['isAuthenticated'](),controller[_0x6f72('0x13')]);router[_0x6f72('0x14')]('/',auth[_0x6f72('0xb')](),controller['create']);router[_0x6f72('0x15')](_0x6f72('0xd'),auth[_0x6f72('0xb')](),controller['update']);router[_0x6f72('0x16')](_0x6f72('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x6f72('0x17')]=router; \ No newline at end of file +var _0x9287=['getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intServicenowConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields'];(function(_0x1a699c,_0x36be4e){var _0x478204=function(_0x56c426){while(--_0x56c426){_0x1a699c['push'](_0x1a699c['shift']());}};_0x478204(++_0x36be4e);}(_0x9287,0x12a));var _0x7928=function(_0x21ba7d,_0x3721f1){_0x21ba7d=_0x21ba7d-0x0;var _0x1445b6=_0x9287[_0x21ba7d];return _0x1445b6;};'use strict';var multer=require(_0x7928('0x0'));var util=require(_0x7928('0x1'));var path=require(_0x7928('0x2'));var timeout=require('connect-timeout');var express=require(_0x7928('0x3'));var router=express[_0x7928('0x4')]();var fs_extra=require(_0x7928('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7928('0x6'));var config=require('../../config/environment');var controller=require(_0x7928('0x7'));router['get']('/',auth[_0x7928('0x8')](),controller[_0x7928('0x9')]);router[_0x7928('0xa')](_0x7928('0xb'),auth['isAuthenticated'](),controller[_0x7928('0xc')]);router['get'](_0x7928('0xd'),auth[_0x7928('0x8')](),controller[_0x7928('0xe')]);router[_0x7928('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x7928('0xf')]);router[_0x7928('0xa')](_0x7928('0x10'),auth[_0x7928('0x8')](),controller[_0x7928('0x11')]);router[_0x7928('0x12')]('/',auth[_0x7928('0x8')](),controller['create']);router[_0x7928('0x13')](_0x7928('0xb'),auth[_0x7928('0x8')](),controller[_0x7928('0x14')]);router[_0x7928('0x15')]('/:id',auth[_0x7928('0x8')](),controller[_0x7928('0x16')]);module[_0x7928('0x17')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 98d0919..3b45967 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 _0x4ccb=['STRING','sequelize'];(function(_0x318840,_0x561b1e){var _0x223da4=function(_0x510071){while(--_0x510071){_0x318840['push'](_0x318840['shift']());}};_0x223da4(++_0x561b1e);}(_0x4ccb,0x89));var _0xb4cc=function(_0x39a8b2,_0x2b6b3f){_0x39a8b2=_0x39a8b2-0x0;var _0x2b1277=_0x4ccb[_0x39a8b2];return _0x2b1277;};'use strict';var Sequelize=require(_0xb4cc('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb4cc('0x1')]}}; \ No newline at end of file +var _0x9cb2=['STRING','sequelize'];(function(_0x31e0d7,_0x2713e8){var _0x3750af=function(_0x46f2ff){while(--_0x46f2ff){_0x31e0d7['push'](_0x31e0d7['shift']());}};_0x3750af(++_0x2713e8);}(_0x9cb2,0x127));var _0x29cb=function(_0x59d546,_0x34bb80){_0x59d546=_0x59d546-0x0;var _0x563d77=_0x9cb2[_0x59d546];return _0x563d77;};'use strict';var Sequelize=require(_0x29cb('0x0'));module['exports']={'name':{'type':Sequelize[_0x29cb('0x1')]},'description':{'type':Sequelize[_0x29cb('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 8df12a2..e492cb2 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 _0xe130=['count','set','apply','save','update','destroy','then','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','find','create','body','getFields','options','nolimit','findOne','getSubjects','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit'];(function(_0x2d0c78,_0x1d75bc){var _0x5510d7=function(_0x2025a4){while(--_0x2025a4){_0x2d0c78['push'](_0x2d0c78['shift']());}};_0x5510d7(++_0x1d75bc);}(_0xe130,0x1ac));var _0x0e13=function(_0x4562e4,_0x6e7fbd){_0x4562e4=_0x4562e4-0x0;var _0x75e43e=_0xe130[_0x4562e4];return _0x75e43e;};'use strict';var emlformat=require(_0x0e13('0x0'));var rimraf=require(_0x0e13('0x1'));var zipdir=require(_0x0e13('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e13('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0e13('0x4'));var util=require(_0x0e13('0x5'));var path=require(_0x0e13('0x6'));var sox=require(_0x0e13('0x7'));var csv=require(_0x0e13('0x8'));var ejs=require(_0x0e13('0x9'));var fs=require('fs');var fs_extra=require(_0x0e13('0xa'));var _=require('lodash');var squel=require(_0x0e13('0xb'));var crypto=require(_0x0e13('0xc'));var jsforce=require(_0x0e13('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0e13('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0e13('0xf'));var qs=require(_0x0e13('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e13('0x11'));var utils=require(_0x0e13('0x12'));var config=require(_0x0e13('0x13'));var licenseUtil=require(_0x0e13('0x14'));var db=require(_0x0e13('0x15'))['db'];function respondWithStatusCode(_0x10a662,_0x387473){_0x387473=_0x387473||0xcc;return function(_0x42763a){if(_0x42763a){return _0x10a662[_0x0e13('0x16')](_0x387473);}return _0x10a662[_0x0e13('0x17')](_0x387473)[_0x0e13('0x18')]();};}function respondWithResult(_0x1f8c58,_0x26fc22){_0x26fc22=_0x26fc22||0xc8;return function(_0x324b81){if(_0x324b81){return _0x1f8c58[_0x0e13('0x17')](_0x26fc22)['json'](_0x324b81);}};}function respondWithFilteredResult(_0xba3df2,_0x127f66){return function(_0x518c10){if(_0x518c10){var _0x3b31f0=typeof _0x127f66[_0x0e13('0x19')]===_0x0e13('0x1a')&&typeof _0x127f66[_0x0e13('0x1b')]===_0x0e13('0x1a');var _0x5582ff=_0x518c10[_0x0e13('0x1c')];var _0x3efa0b=_0x3b31f0?0x0:_0x127f66[_0x0e13('0x19')];var _0x38cd85=_0x3b31f0?_0x518c10[_0x0e13('0x1c')]:_0x127f66[_0x0e13('0x19')]+_0x127f66[_0x0e13('0x1b')];var _0x552d49;if(_0x38cd85>=_0x5582ff){_0x38cd85=_0x5582ff;_0x552d49=0xc8;}else{_0x552d49=0xce;}_0xba3df2[_0x0e13('0x17')](_0x552d49);return _0xba3df2[_0x0e13('0x1d')]('Content-Range',_0x3efa0b+'-'+_0x38cd85+'/'+_0x5582ff)['json'](_0x518c10);}return null;};}function patchUpdates(_0x1146a8){return function(_0x24bba9){try{jsonpatch[_0x0e13('0x1e')](_0x24bba9,_0x1146a8,!![]);}catch(_0x3348a7){return BPromise['reject'](_0x3348a7);}return _0x24bba9[_0x0e13('0x1f')]();};}function saveUpdates(_0x20fac4,_0x1475f1){return function(_0x515a76){if(_0x515a76){return _0x515a76[_0x0e13('0x20')](_0x20fac4)['then'](function(_0x623025){return _0x623025;});}return null;};}function removeEntity(_0x49cb52,_0x497a24){return function(_0x36fb76){if(_0x36fb76){return _0x36fb76[_0x0e13('0x21')]()[_0x0e13('0x22')](function(){_0x49cb52[_0x0e13('0x17')](0xcc)[_0x0e13('0x18')]();});}};}function handleEntityNotFound(_0x47925b,_0x1530cf){return function(_0x5d3473){if(!_0x5d3473){_0x47925b[_0x0e13('0x16')](0x194);}return _0x5d3473;};}function handleError(_0x3169b5,_0x12a6fe){_0x12a6fe=_0x12a6fe||0x1f4;return function(_0x5c3da6){logger[_0x0e13('0x23')](_0x5c3da6[_0x0e13('0x24')]);if(_0x5c3da6[_0x0e13('0x25')]){delete _0x5c3da6[_0x0e13('0x25')];}_0x3169b5['status'](_0x12a6fe)[_0x0e13('0x26')](_0x5c3da6);};}exports[_0x0e13('0x27')]=function(_0x107fc7,_0x5e7b06){var _0x18f893={},_0x479ff1={},_0x56d6b0={'count':0x0,'rows':[]};var _0x8d4ece=_['map'](db[_0x0e13('0x28')][_0x0e13('0x29')],function(_0xdab273){return{'name':_0xdab273[_0x0e13('0x2a')],'type':_0xdab273[_0x0e13('0x2b')][_0x0e13('0x2c')]};});_0x479ff1[_0x0e13('0x2d')]=_[_0x0e13('0x2e')](_0x8d4ece,_0x0e13('0x25'));_0x479ff1[_0x0e13('0x2f')]=_[_0x0e13('0x30')](_0x107fc7['query']);_0x479ff1[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x479ff1['model'],_0x479ff1[_0x0e13('0x2f')]);_0x18f893[_0x0e13('0x33')]=_[_0x0e13('0x32')](_0x479ff1[_0x0e13('0x2d')],qs[_0x0e13('0x34')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x34')]));_0x18f893['attributes']=_0x18f893[_0x0e13('0x33')][_0x0e13('0x35')]?_0x18f893[_0x0e13('0x33')]:_0x479ff1['model'];if(!_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x36')]('nolimit')){_0x18f893[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x1b')]);_0x18f893[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x19')]);}_0x18f893[_0x0e13('0x37')]=qs[_0x0e13('0x38')](_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x18f893[_0x0e13('0x39')]=qs['filters'](_[_0x0e13('0x3a')](_0x107fc7[_0x0e13('0x2f')],_0x479ff1[_0x0e13('0x31')]),_0x8d4ece);if(_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x18f893[_0x0e13('0x39')]=_['merge'](_0x18f893[_0x0e13('0x39')],{'$or':_[_0x0e13('0x2e')](_0x8d4ece,function(_0x3c45a7){if(_0x3c45a7[_0x0e13('0x2b')]!==_0x0e13('0x3c')){var _0x411918={};_0x411918[_0x3c45a7[_0x0e13('0x25')]]={'$like':'%'+_0x107fc7[_0x0e13('0x2f')][_0x0e13('0x3b')]+'%'};return _0x411918;}})});}_0x18f893=_[_0x0e13('0x3d')]({},_0x18f893,_0x107fc7['options']);var _0x497bd1={'where':_0x18f893[_0x0e13('0x39')]};return db['ServicenowConfiguration'][_0x0e13('0x1c')](_0x497bd1)[_0x0e13('0x22')](function(_0xe65650){_0x56d6b0[_0x0e13('0x1c')]=_0xe65650;if(_0x107fc7['query'][_0x0e13('0x3e')]){_0x18f893[_0x0e13('0x3f')]=[{'all':!![]}];}return db[_0x0e13('0x28')][_0x0e13('0x40')](_0x18f893);})[_0x0e13('0x22')](function(_0x52606c){_0x56d6b0[_0x0e13('0x41')]=_0x52606c;return _0x56d6b0;})['then'](respondWithFilteredResult(_0x5e7b06,_0x18f893))[_0x0e13('0x42')](handleError(_0x5e7b06,null));};exports['show']=function(_0x5c374c,_0x3ee5cd){var _0x2ad7ff={'raw':![],'where':{'id':_0x5c374c[_0x0e13('0x43')]['id']}},_0x50c2e9={};_0x50c2e9[_0x0e13('0x2d')]=_[_0x0e13('0x30')](db[_0x0e13('0x28')]['rawAttributes']);_0x50c2e9[_0x0e13('0x2f')]=_[_0x0e13('0x30')](_0x5c374c[_0x0e13('0x2f')]);_0x50c2e9[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x50c2e9[_0x0e13('0x2d')],_0x50c2e9[_0x0e13('0x2f')]);_0x2ad7ff[_0x0e13('0x33')]=_['intersection'](_0x50c2e9['model'],qs[_0x0e13('0x34')](_0x5c374c[_0x0e13('0x2f')]['fields']));_0x2ad7ff['attributes']=_0x2ad7ff[_0x0e13('0x33')]['length']?_0x2ad7ff[_0x0e13('0x33')]:_0x50c2e9['model'];if(_0x5c374c[_0x0e13('0x2f')][_0x0e13('0x3e')]){_0x2ad7ff[_0x0e13('0x3f')]=[{'all':!![]}];}_0x2ad7ff=_['merge']({},_0x2ad7ff,_0x5c374c['options']);return db[_0x0e13('0x28')][_0x0e13('0x44')](_0x2ad7ff)[_0x0e13('0x22')](handleEntityNotFound(_0x3ee5cd,null))[_0x0e13('0x22')](respondWithResult(_0x3ee5cd,null))[_0x0e13('0x42')](handleError(_0x3ee5cd,null));};exports[_0x0e13('0x45')]=function(_0x349f02,_0x5ad450){return db[_0x0e13('0x28')]['create'](_0x349f02[_0x0e13('0x46')],{})[_0x0e13('0x22')](respondWithResult(_0x5ad450,0xc9))[_0x0e13('0x42')](handleError(_0x5ad450,null));};exports[_0x0e13('0x20')]=function(_0x3bd729,_0x365297){if(_0x3bd729['body']['id']){delete _0x3bd729[_0x0e13('0x46')]['id'];}return db[_0x0e13('0x28')][_0x0e13('0x44')]({'where':{'id':_0x3bd729[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x365297,null))['then'](saveUpdates(_0x3bd729[_0x0e13('0x46')],null))[_0x0e13('0x22')](respondWithResult(_0x365297,null))['catch'](handleError(_0x365297,null));};exports['destroy']=function(_0x5c90ed,_0x22b36d){return db[_0x0e13('0x28')][_0x0e13('0x44')]({'where':{'id':_0x5c90ed[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x22b36d,null))[_0x0e13('0x22')](removeEntity(_0x22b36d,null))['catch'](handleError(_0x22b36d,null));};exports[_0x0e13('0x47')]=function(_0x3f4fb8,_0x44a5ca,_0x498d06){var _0x223c01={};var _0x1b29ba={};var _0x2b71ab;var _0x3e7dad;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x3f4fb8[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x44a5ca,null))[_0x0e13('0x22')](function(_0x5e747f){if(_0x5e747f){_0x2b71ab=_0x5e747f;_0x1b29ba['model']=_[_0x0e13('0x30')](db['ServicenowField'][_0x0e13('0x29')]);_0x1b29ba['query']=_[_0x0e13('0x30')](_0x3f4fb8[_0x0e13('0x2f')]);_0x1b29ba[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x1b29ba[_0x0e13('0x2d')],_0x1b29ba[_0x0e13('0x2f')]);_0x223c01[_0x0e13('0x33')]=_[_0x0e13('0x32')](_0x1b29ba['model'],qs[_0x0e13('0x34')](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x34')]));_0x223c01[_0x0e13('0x33')]=_0x223c01[_0x0e13('0x33')][_0x0e13('0x35')]?_0x223c01['attributes']:_0x1b29ba['model'];_0x223c01[_0x0e13('0x37')]=qs['sort'](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x223c01[_0x0e13('0x39')]=qs['filters'](_['pick'](_0x3f4fb8[_0x0e13('0x2f')],_0x1b29ba['filters']));if(_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x223c01[_0x0e13('0x39')]=_[_0x0e13('0x3d')](_0x223c01[_0x0e13('0x39')],{'$or':_['map'](_0x223c01[_0x0e13('0x33')],function(_0x104932){var _0x1943dd={};_0x1943dd[_0x104932]={'$like':'%'+_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x3b')]+'%'};return _0x1943dd;})});}_0x223c01=_[_0x0e13('0x3d')]({},_0x223c01,_0x3f4fb8[_0x0e13('0x48')]);return _0x2b71ab[_0x0e13('0x47')](_0x223c01);}})[_0x0e13('0x22')](function(_0x1706e8){if(_0x1706e8){_0x3e7dad=_0x1706e8[_0x0e13('0x35')];if(!_0x3f4fb8['query'][_0x0e13('0x36')](_0x0e13('0x49'))){_0x223c01[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x1b')]);_0x223c01[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x3f4fb8[_0x0e13('0x2f')][_0x0e13('0x19')]);}return _0x2b71ab[_0x0e13('0x47')](_0x223c01);}})[_0x0e13('0x22')](function(_0x141435){if(_0x141435){return _0x141435?{'count':_0x3e7dad,'rows':_0x141435}:null;}})['then'](respondWithResult(_0x44a5ca,null))[_0x0e13('0x42')](handleError(_0x44a5ca,null));};exports['getSubjects']=function(_0x823e0b,_0x1f41f8,_0x25c256){var _0x345be2={};var _0x2642ab={};var _0x9a3563;var _0x5333dd;return db[_0x0e13('0x28')][_0x0e13('0x4a')]({'where':{'id':_0x823e0b[_0x0e13('0x43')]['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x1f41f8,null))[_0x0e13('0x22')](function(_0x372f0d){if(_0x372f0d){_0x9a3563=_0x372f0d;_0x2642ab[_0x0e13('0x2d')]=_[_0x0e13('0x30')](db['ServicenowField'][_0x0e13('0x29')]);_0x2642ab[_0x0e13('0x2f')]=_['keys'](_0x823e0b[_0x0e13('0x2f')]);_0x2642ab[_0x0e13('0x31')]=_['intersection'](_0x2642ab['model'],_0x2642ab[_0x0e13('0x2f')]);_0x345be2['attributes']=_[_0x0e13('0x32')](_0x2642ab[_0x0e13('0x2d')],qs[_0x0e13('0x34')](_0x823e0b['query'][_0x0e13('0x34')]));_0x345be2['attributes']=_0x345be2['attributes'][_0x0e13('0x35')]?_0x345be2[_0x0e13('0x33')]:_0x2642ab[_0x0e13('0x2d')];_0x345be2[_0x0e13('0x37')]=qs['sort'](_0x823e0b[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x345be2[_0x0e13('0x39')]=qs[_0x0e13('0x31')](_[_0x0e13('0x3a')](_0x823e0b['query'],_0x2642ab[_0x0e13('0x31')]));if(_0x823e0b[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x345be2['where']=_[_0x0e13('0x3d')](_0x345be2[_0x0e13('0x39')],{'$or':_[_0x0e13('0x2e')](_0x345be2[_0x0e13('0x33')],function(_0x4938ea){var _0x5a903e={};_0x5a903e[_0x4938ea]={'$like':'%'+_0x823e0b['query']['filter']+'%'};return _0x5a903e;})});}_0x345be2=_[_0x0e13('0x3d')]({},_0x345be2,_0x823e0b[_0x0e13('0x48')]);return _0x9a3563[_0x0e13('0x4b')](_0x345be2);}})[_0x0e13('0x22')](function(_0x1370a2){if(_0x1370a2){_0x5333dd=_0x1370a2[_0x0e13('0x35')];if(!_0x823e0b[_0x0e13('0x2f')][_0x0e13('0x36')](_0x0e13('0x49'))){_0x345be2[_0x0e13('0x1b')]=qs['limit'](_0x823e0b[_0x0e13('0x2f')]['limit']);_0x345be2[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x823e0b['query']['offset']);}return _0x9a3563[_0x0e13('0x4b')](_0x345be2);}})[_0x0e13('0x22')](function(_0x41d9ec){if(_0x41d9ec){return _0x41d9ec?{'count':_0x5333dd,'rows':_0x41d9ec}:null;}})[_0x0e13('0x22')](respondWithResult(_0x1f41f8,null))[_0x0e13('0x42')](handleError(_0x1f41f8,null));};exports['getDescriptions']=function(_0x35ba0f,_0x1055c8,_0x7aa688){var _0x3d672c={};var _0x5e768f={};var _0x2fbb52;var _0x2d13c7;return db[_0x0e13('0x28')][_0x0e13('0x4a')]({'where':{'id':_0x35ba0f[_0x0e13('0x43')]['id']}})['then'](handleEntityNotFound(_0x1055c8,null))[_0x0e13('0x22')](function(_0x5b4fab){if(_0x5b4fab){_0x2fbb52=_0x5b4fab;_0x5e768f[_0x0e13('0x2d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x5e768f[_0x0e13('0x2f')]=_[_0x0e13('0x30')](_0x35ba0f[_0x0e13('0x2f')]);_0x5e768f[_0x0e13('0x31')]=_[_0x0e13('0x32')](_0x5e768f['model'],_0x5e768f[_0x0e13('0x2f')]);_0x3d672c['attributes']=_[_0x0e13('0x32')](_0x5e768f[_0x0e13('0x2d')],qs[_0x0e13('0x34')](_0x35ba0f[_0x0e13('0x2f')]['fields']));_0x3d672c['attributes']=_0x3d672c[_0x0e13('0x33')][_0x0e13('0x35')]?_0x3d672c[_0x0e13('0x33')]:_0x5e768f[_0x0e13('0x2d')];_0x3d672c[_0x0e13('0x37')]=qs['sort'](_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x38')]);_0x3d672c[_0x0e13('0x39')]=qs['filters'](_[_0x0e13('0x3a')](_0x35ba0f[_0x0e13('0x2f')],_0x5e768f[_0x0e13('0x31')]));if(_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x3b')]){_0x3d672c[_0x0e13('0x39')]=_[_0x0e13('0x3d')](_0x3d672c[_0x0e13('0x39')],{'$or':_[_0x0e13('0x2e')](_0x3d672c[_0x0e13('0x33')],function(_0x3f3361){var _0x3e29ac={};_0x3e29ac[_0x3f3361]={'$like':'%'+_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x3b')]+'%'};return _0x3e29ac;})});}_0x3d672c=_[_0x0e13('0x3d')]({},_0x3d672c,_0x35ba0f['options']);return _0x2fbb52['getDescriptions'](_0x3d672c);}})[_0x0e13('0x22')](function(_0x3c99f8){if(_0x3c99f8){_0x2d13c7=_0x3c99f8['length'];if(!_0x35ba0f[_0x0e13('0x2f')]['hasOwnProperty'](_0x0e13('0x49'))){_0x3d672c[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x35ba0f['query'][_0x0e13('0x1b')]);_0x3d672c[_0x0e13('0x19')]=qs[_0x0e13('0x19')](_0x35ba0f[_0x0e13('0x2f')][_0x0e13('0x19')]);}return _0x2fbb52['getDescriptions'](_0x3d672c);}})[_0x0e13('0x22')](function(_0x5137e4){if(_0x5137e4){return _0x5137e4?{'count':_0x2d13c7,'rows':_0x5137e4}:null;}})[_0x0e13('0x22')](respondWithResult(_0x1055c8,null))[_0x0e13('0x42')](handleError(_0x1055c8,null));}; \ No newline at end of file +var _0x007d=['create','catch','body','find','params','getFields','ServicenowField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ServicenowConfiguration','rawAttributes','fieldName','key','model','map','query','filters','attributes','intersection','fields','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','length'];(function(_0x48fd8f,_0x24c54d){var _0x46f545=function(_0x48069a){while(--_0x48069a){_0x48fd8f['push'](_0x48fd8f['shift']());}};_0x46f545(++_0x24c54d);}(_0x007d,0x104));var _0xd007=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x007d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd007('0x0'));var zipdir=require(_0xd007('0x1'));var jsonpatch=require(_0xd007('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xd007('0x3'));var util=require(_0xd007('0x4'));var path=require(_0xd007('0x5'));var sox=require(_0xd007('0x6'));var csv=require(_0xd007('0x7'));var ejs=require(_0xd007('0x8'));var fs=require('fs');var fs_extra=require(_0xd007('0x9'));var _=require(_0xd007('0xa'));var squel=require(_0xd007('0xb'));var crypto=require(_0xd007('0xc'));var jsforce=require(_0xd007('0xd'));var deskjs=require(_0xd007('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd007('0xf'));var Papa=require('papaparse');var Redis=require(_0xd007('0x10'));var authService=require(_0xd007('0x11'));var qs=require(_0xd007('0x12'));var as=require(_0xd007('0x13'));var hardwareService=require(_0xd007('0x14'));var logger=require(_0xd007('0x15'))(_0xd007('0x16'));var utils=require(_0xd007('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xd007('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b6463,_0x298952){_0x298952=_0x298952||0xcc;return function(_0x5919fa){if(_0x5919fa){return _0x4b6463[_0xd007('0x19')](_0x298952);}return _0x4b6463[_0xd007('0x1a')](_0x298952)[_0xd007('0x1b')]();};}function respondWithResult(_0x5cd26e,_0x446e1f){_0x446e1f=_0x446e1f||0xc8;return function(_0x5d02a8){if(_0x5d02a8){return _0x5cd26e['status'](_0x446e1f)[_0xd007('0x1c')](_0x5d02a8);}};}function respondWithFilteredResult(_0x30aa37,_0x3173d1){return function(_0x4aab85){if(_0x4aab85){var _0x18c395=typeof _0x3173d1[_0xd007('0x1d')]===_0xd007('0x1e')&&typeof _0x3173d1[_0xd007('0x1f')]==='undefined';var _0x1b3d1c=_0x4aab85[_0xd007('0x20')];var _0x21528a=_0x18c395?0x0:_0x3173d1[_0xd007('0x1d')];var _0x3af196=_0x18c395?_0x4aab85[_0xd007('0x20')]:_0x3173d1[_0xd007('0x1d')]+_0x3173d1[_0xd007('0x1f')];var _0xd3b138;if(_0x3af196>=_0x1b3d1c){_0x3af196=_0x1b3d1c;_0xd3b138=0xc8;}else{_0xd3b138=0xce;}_0x30aa37[_0xd007('0x1a')](_0xd3b138);return _0x30aa37[_0xd007('0x21')](_0xd007('0x22'),_0x21528a+'-'+_0x3af196+'/'+_0x1b3d1c)['json'](_0x4aab85);}return null;};}function patchUpdates(_0x312f71){return function(_0x92e881){try{jsonpatch['apply'](_0x92e881,_0x312f71,!![]);}catch(_0x4760c7){return BPromise[_0xd007('0x23')](_0x4760c7);}return _0x92e881[_0xd007('0x24')]();};}function saveUpdates(_0x3ec08a,_0x4160df){return function(_0x4b3cc9){if(_0x4b3cc9){return _0x4b3cc9[_0xd007('0x25')](_0x3ec08a)[_0xd007('0x26')](function(_0xbfaf2a){return _0xbfaf2a;});}return null;};}function removeEntity(_0x318167,_0x2688c2){return function(_0x185f28){if(_0x185f28){return _0x185f28[_0xd007('0x27')]()[_0xd007('0x26')](function(){_0x318167['status'](0xcc)[_0xd007('0x1b')]();});}};}function handleEntityNotFound(_0x5acccf,_0x58b126){return function(_0x575e6d){if(!_0x575e6d){_0x5acccf[_0xd007('0x19')](0x194);}return _0x575e6d;};}function handleError(_0x534239,_0x42c62c){_0x42c62c=_0x42c62c||0x1f4;return function(_0x4d618b){logger[_0xd007('0x28')](_0x4d618b[_0xd007('0x29')]);if(_0x4d618b[_0xd007('0x2a')]){delete _0x4d618b[_0xd007('0x2a')];}_0x534239['status'](_0x42c62c)[_0xd007('0x2b')](_0x4d618b);};}exports['index']=function(_0x133dab,_0x5a78de){var _0x171bda={},_0x3f5a6f={},_0x51d9b8={'count':0x0,'rows':[]};var _0x926970=_['map'](db[_0xd007('0x2c')][_0xd007('0x2d')],function(_0x3d3b80){return{'name':_0x3d3b80[_0xd007('0x2e')],'type':_0x3d3b80['type'][_0xd007('0x2f')]};});_0x3f5a6f[_0xd007('0x30')]=_[_0xd007('0x31')](_0x926970,'name');_0x3f5a6f[_0xd007('0x32')]=_['keys'](_0x133dab[_0xd007('0x32')]);_0x3f5a6f[_0xd007('0x33')]=_['intersection'](_0x3f5a6f[_0xd007('0x30')],_0x3f5a6f[_0xd007('0x32')]);_0x171bda[_0xd007('0x34')]=_[_0xd007('0x35')](_0x3f5a6f[_0xd007('0x30')],qs['fields'](_0x133dab[_0xd007('0x32')][_0xd007('0x36')]));_0x171bda[_0xd007('0x34')]=_0x171bda[_0xd007('0x34')]['length']?_0x171bda['attributes']:_0x3f5a6f[_0xd007('0x30')];if(!_0x133dab['query'][_0xd007('0x37')]('nolimit')){_0x171bda[_0xd007('0x1f')]=qs[_0xd007('0x1f')](_0x133dab[_0xd007('0x32')][_0xd007('0x1f')]);_0x171bda[_0xd007('0x1d')]=qs[_0xd007('0x1d')](_0x133dab[_0xd007('0x32')][_0xd007('0x1d')]);}_0x171bda[_0xd007('0x38')]=qs[_0xd007('0x39')](_0x133dab['query'][_0xd007('0x39')]);_0x171bda[_0xd007('0x3a')]=qs[_0xd007('0x33')](_[_0xd007('0x3b')](_0x133dab[_0xd007('0x32')],_0x3f5a6f[_0xd007('0x33')]),_0x926970);if(_0x133dab[_0xd007('0x32')]['filter']){_0x171bda[_0xd007('0x3a')]=_[_0xd007('0x3c')](_0x171bda['where'],{'$or':_[_0xd007('0x31')](_0x926970,function(_0x41e7b1){if(_0x41e7b1[_0xd007('0x3d')]!==_0xd007('0x3e')){var _0x236247={};_0x236247[_0x41e7b1[_0xd007('0x2a')]]={'$like':'%'+_0x133dab['query'][_0xd007('0x3f')]+'%'};return _0x236247;}})});}_0x171bda=_[_0xd007('0x3c')]({},_0x171bda,_0x133dab[_0xd007('0x40')]);var _0x26c7e8={'where':_0x171bda[_0xd007('0x3a')]};return db['ServicenowConfiguration'][_0xd007('0x20')](_0x26c7e8)[_0xd007('0x26')](function(_0x589ec4){_0x51d9b8[_0xd007('0x20')]=_0x589ec4;if(_0x133dab['query'][_0xd007('0x41')]){_0x171bda[_0xd007('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration'][_0xd007('0x43')](_0x171bda);})['then'](function(_0x1d809e){_0x51d9b8[_0xd007('0x44')]=_0x1d809e;return _0x51d9b8;})[_0xd007('0x26')](respondWithFilteredResult(_0x5a78de,_0x171bda))['catch'](handleError(_0x5a78de,null));};exports[_0xd007('0x45')]=function(_0x200e68,_0x484a1d){var _0x1fc0a8={'raw':![],'where':{'id':_0x200e68['params']['id']}},_0x623c4b={};_0x623c4b[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x2c')][_0xd007('0x2d')]);_0x623c4b[_0xd007('0x32')]=_[_0xd007('0x46')](_0x200e68[_0xd007('0x32')]);_0x623c4b[_0xd007('0x33')]=_[_0xd007('0x35')](_0x623c4b[_0xd007('0x30')],_0x623c4b[_0xd007('0x32')]);_0x1fc0a8['attributes']=_[_0xd007('0x35')](_0x623c4b[_0xd007('0x30')],qs[_0xd007('0x36')](_0x200e68[_0xd007('0x32')]['fields']));_0x1fc0a8[_0xd007('0x34')]=_0x1fc0a8[_0xd007('0x34')][_0xd007('0x47')]?_0x1fc0a8['attributes']:_0x623c4b[_0xd007('0x30')];if(_0x200e68[_0xd007('0x32')][_0xd007('0x41')]){_0x1fc0a8['include']=[{'all':!![]}];}_0x1fc0a8=_[_0xd007('0x3c')]({},_0x1fc0a8,_0x200e68['options']);return db['ServicenowConfiguration']['find'](_0x1fc0a8)[_0xd007('0x26')](handleEntityNotFound(_0x484a1d,null))[_0xd007('0x26')](respondWithResult(_0x484a1d,null))['catch'](handleError(_0x484a1d,null));};exports[_0xd007('0x48')]=function(_0x28224e,_0x4a5616){return db[_0xd007('0x2c')]['create'](_0x28224e['body'],{})[_0xd007('0x26')](respondWithResult(_0x4a5616,0xc9))[_0xd007('0x49')](handleError(_0x4a5616,null));};exports['update']=function(_0x47f69b,_0x38abae){if(_0x47f69b[_0xd007('0x4a')]['id']){delete _0x47f69b[_0xd007('0x4a')]['id'];}return db['ServicenowConfiguration'][_0xd007('0x4b')]({'where':{'id':_0x47f69b[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x38abae,null))[_0xd007('0x26')](saveUpdates(_0x47f69b[_0xd007('0x4a')],null))['then'](respondWithResult(_0x38abae,null))[_0xd007('0x49')](handleError(_0x38abae,null));};exports['destroy']=function(_0x5015f0,_0x27d20d){return db['ServicenowConfiguration']['find']({'where':{'id':_0x5015f0[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x27d20d,null))[_0xd007('0x26')](removeEntity(_0x27d20d,null))[_0xd007('0x49')](handleError(_0x27d20d,null));};exports[_0xd007('0x4d')]=function(_0x12c66f,_0x427d2b,_0x45e4b5){var _0x3fd35d={};var _0x551fb1={};var _0xa834f4;var _0x4b5f9a;return db[_0xd007('0x2c')]['findOne']({'where':{'id':_0x12c66f[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x427d2b,null))[_0xd007('0x26')](function(_0x512ac9){if(_0x512ac9){_0xa834f4=_0x512ac9;_0x551fb1[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x4e')]['rawAttributes']);_0x551fb1[_0xd007('0x32')]=_['keys'](_0x12c66f[_0xd007('0x32')]);_0x551fb1['filters']=_['intersection'](_0x551fb1[_0xd007('0x30')],_0x551fb1[_0xd007('0x32')]);_0x3fd35d['attributes']=_['intersection'](_0x551fb1[_0xd007('0x30')],qs[_0xd007('0x36')](_0x12c66f[_0xd007('0x32')][_0xd007('0x36')]));_0x3fd35d[_0xd007('0x34')]=_0x3fd35d[_0xd007('0x34')][_0xd007('0x47')]?_0x3fd35d[_0xd007('0x34')]:_0x551fb1[_0xd007('0x30')];_0x3fd35d[_0xd007('0x38')]=qs[_0xd007('0x39')](_0x12c66f[_0xd007('0x32')][_0xd007('0x39')]);_0x3fd35d[_0xd007('0x3a')]=qs['filters'](_['pick'](_0x12c66f[_0xd007('0x32')],_0x551fb1['filters']));if(_0x12c66f[_0xd007('0x32')]['filter']){_0x3fd35d[_0xd007('0x3a')]=_[_0xd007('0x3c')](_0x3fd35d['where'],{'$or':_[_0xd007('0x31')](_0x3fd35d[_0xd007('0x34')],function(_0x4a6de8){var _0x2cbda7={};_0x2cbda7[_0x4a6de8]={'$like':'%'+_0x12c66f[_0xd007('0x32')][_0xd007('0x3f')]+'%'};return _0x2cbda7;})});}_0x3fd35d=_[_0xd007('0x3c')]({},_0x3fd35d,_0x12c66f[_0xd007('0x40')]);return _0xa834f4[_0xd007('0x4d')](_0x3fd35d);}})[_0xd007('0x26')](function(_0x30f49b){if(_0x30f49b){_0x4b5f9a=_0x30f49b[_0xd007('0x47')];if(!_0x12c66f[_0xd007('0x32')]['hasOwnProperty'](_0xd007('0x4f'))){_0x3fd35d['limit']=qs[_0xd007('0x1f')](_0x12c66f[_0xd007('0x32')][_0xd007('0x1f')]);_0x3fd35d[_0xd007('0x1d')]=qs[_0xd007('0x1d')](_0x12c66f[_0xd007('0x32')][_0xd007('0x1d')]);}return _0xa834f4[_0xd007('0x4d')](_0x3fd35d);}})[_0xd007('0x26')](function(_0x4bd1a6){if(_0x4bd1a6){return _0x4bd1a6?{'count':_0x4b5f9a,'rows':_0x4bd1a6}:null;}})[_0xd007('0x26')](respondWithResult(_0x427d2b,null))[_0xd007('0x49')](handleError(_0x427d2b,null));};exports[_0xd007('0x50')]=function(_0x144285,_0x1c388d,_0x4ce3ea){var _0x3ff914={};var _0x32223e={};var _0x5b221b;var _0xd69306;return db[_0xd007('0x2c')][_0xd007('0x51')]({'where':{'id':_0x144285[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x1c388d,null))['then'](function(_0x32bb00){if(_0x32bb00){_0x5b221b=_0x32bb00;_0x32223e[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x4e')][_0xd007('0x2d')]);_0x32223e['query']=_[_0xd007('0x46')](_0x144285['query']);_0x32223e['filters']=_[_0xd007('0x35')](_0x32223e['model'],_0x32223e[_0xd007('0x32')]);_0x3ff914['attributes']=_[_0xd007('0x35')](_0x32223e[_0xd007('0x30')],qs['fields'](_0x144285[_0xd007('0x32')]['fields']));_0x3ff914[_0xd007('0x34')]=_0x3ff914[_0xd007('0x34')][_0xd007('0x47')]?_0x3ff914['attributes']:_0x32223e[_0xd007('0x30')];_0x3ff914[_0xd007('0x38')]=qs[_0xd007('0x39')](_0x144285[_0xd007('0x32')][_0xd007('0x39')]);_0x3ff914[_0xd007('0x3a')]=qs[_0xd007('0x33')](_[_0xd007('0x3b')](_0x144285['query'],_0x32223e[_0xd007('0x33')]));if(_0x144285['query'][_0xd007('0x3f')]){_0x3ff914['where']=_[_0xd007('0x3c')](_0x3ff914[_0xd007('0x3a')],{'$or':_[_0xd007('0x31')](_0x3ff914['attributes'],function(_0x73f633){var _0x3e9271={};_0x3e9271[_0x73f633]={'$like':'%'+_0x144285[_0xd007('0x32')][_0xd007('0x3f')]+'%'};return _0x3e9271;})});}_0x3ff914=_['merge']({},_0x3ff914,_0x144285[_0xd007('0x40')]);return _0x5b221b[_0xd007('0x50')](_0x3ff914);}})[_0xd007('0x26')](function(_0x6b829b){if(_0x6b829b){_0xd69306=_0x6b829b[_0xd007('0x47')];if(!_0x144285[_0xd007('0x32')][_0xd007('0x37')]('nolimit')){_0x3ff914[_0xd007('0x1f')]=qs[_0xd007('0x1f')](_0x144285[_0xd007('0x32')][_0xd007('0x1f')]);_0x3ff914['offset']=qs[_0xd007('0x1d')](_0x144285['query'][_0xd007('0x1d')]);}return _0x5b221b[_0xd007('0x50')](_0x3ff914);}})[_0xd007('0x26')](function(_0x1fd9fd){if(_0x1fd9fd){return _0x1fd9fd?{'count':_0xd69306,'rows':_0x1fd9fd}:null;}})['then'](respondWithResult(_0x1c388d,null))['catch'](handleError(_0x1c388d,null));};exports[_0xd007('0x52')]=function(_0x50ee0c,_0x33278f,_0x4d811d){var _0x2bfab2={};var _0x5ad6de={};var _0x30b35e;var _0x51612f;return db['ServicenowConfiguration'][_0xd007('0x51')]({'where':{'id':_0x50ee0c[_0xd007('0x4c')]['id']}})[_0xd007('0x26')](handleEntityNotFound(_0x33278f,null))['then'](function(_0x4a0395){if(_0x4a0395){_0x30b35e=_0x4a0395;_0x5ad6de[_0xd007('0x30')]=_[_0xd007('0x46')](db[_0xd007('0x4e')][_0xd007('0x2d')]);_0x5ad6de[_0xd007('0x32')]=_[_0xd007('0x46')](_0x50ee0c['query']);_0x5ad6de['filters']=_[_0xd007('0x35')](_0x5ad6de[_0xd007('0x30')],_0x5ad6de[_0xd007('0x32')]);_0x2bfab2['attributes']=_[_0xd007('0x35')](_0x5ad6de['model'],qs[_0xd007('0x36')](_0x50ee0c[_0xd007('0x32')][_0xd007('0x36')]));_0x2bfab2[_0xd007('0x34')]=_0x2bfab2[_0xd007('0x34')][_0xd007('0x47')]?_0x2bfab2[_0xd007('0x34')]:_0x5ad6de[_0xd007('0x30')];_0x2bfab2['order']=qs['sort'](_0x50ee0c[_0xd007('0x32')][_0xd007('0x39')]);_0x2bfab2[_0xd007('0x3a')]=qs['filters'](_[_0xd007('0x3b')](_0x50ee0c[_0xd007('0x32')],_0x5ad6de[_0xd007('0x33')]));if(_0x50ee0c['query'][_0xd007('0x3f')]){_0x2bfab2[_0xd007('0x3a')]=_['merge'](_0x2bfab2[_0xd007('0x3a')],{'$or':_[_0xd007('0x31')](_0x2bfab2[_0xd007('0x34')],function(_0xff1984){var _0x338069={};_0x338069[_0xff1984]={'$like':'%'+_0x50ee0c[_0xd007('0x32')][_0xd007('0x3f')]+'%'};return _0x338069;})});}_0x2bfab2=_[_0xd007('0x3c')]({},_0x2bfab2,_0x50ee0c[_0xd007('0x40')]);return _0x30b35e['getDescriptions'](_0x2bfab2);}})[_0xd007('0x26')](function(_0x1f2aaf){if(_0x1f2aaf){_0x51612f=_0x1f2aaf[_0xd007('0x47')];if(!_0x50ee0c[_0xd007('0x32')]['hasOwnProperty'](_0xd007('0x4f'))){_0x2bfab2[_0xd007('0x1f')]=qs[_0xd007('0x1f')](_0x50ee0c['query']['limit']);_0x2bfab2[_0xd007('0x1d')]=qs[_0xd007('0x1d')](_0x50ee0c[_0xd007('0x32')]['offset']);}return _0x30b35e[_0xd007('0x52')](_0x2bfab2);}})[_0xd007('0x26')](function(_0x15912b){if(_0x15912b){return _0x15912b?{'count':_0x51612f,'rows':_0x15912b}:null;}})[_0xd007('0x26')](respondWithResult(_0x33278f,null))[_0xd007('0x49')](handleError(_0x33278f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index e0d6674..e630d74 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 _0x3f8c=['exports','define','ServicenowConfiguration','int_servicenow_configurations','../../config/logger','api','moment','bluebird'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x3f8c,0x104));var _0xc3f8=function(_0x1b992f,_0x31667d){_0x1b992f=_0x1b992f-0x0;var _0x8d8762=_0x3f8c[_0x1b992f];return _0x8d8762;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc3f8('0x0'))(_0xc3f8('0x1'));var moment=require(_0xc3f8('0x2'));var BPromise=require(_0xc3f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intServicenowConfiguration.attributes');module[_0xc3f8('0x4')]=function(_0x1a6976,_0x3a4e2f){return _0x1a6976[_0xc3f8('0x5')](_0xc3f8('0x6'),attributes,{'tableName':_0xc3f8('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6947=['./intServicenowConfiguration.attributes','exports','define','int_servicenow_configurations','util','api','moment','bluebird','request-promise','../../config/environment'];(function(_0xc0f436,_0x21631f){var _0x51bddf=function(_0xc28b7f){while(--_0xc28b7f){_0xc0f436['push'](_0xc0f436['shift']());}};_0x51bddf(++_0x21631f);}(_0x6947,0x72));var _0x7694=function(_0x118e3b,_0x30f6ba){_0x118e3b=_0x118e3b-0x0;var _0x23f353=_0x6947[_0x118e3b];return _0x23f353;};'use strict';var _=require('lodash');var util=require(_0x7694('0x0'));var logger=require('../../config/logger')(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rp=require(_0x7694('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7694('0x5'));var attributes=require(_0x7694('0x6'));module[_0x7694('0x7')]=function(_0x5730,_0x36776b){return _0x5730[_0x7694('0x8')]('ServicenowConfiguration',attributes,{'tableName':_0x7694('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 44324fa..1d273b8 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 _0x95bf=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowConfiguration,\x20%s,\x20%s','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x95bf,0x1b3));var _0xf95b=function(_0x468782,_0x417d8a){_0x468782=_0x468782-0x0;var _0x11cf0e=_0x95bf[_0x468782];return _0x11cf0e;};'use strict';var _=require(_0xf95b('0x0'));var util=require(_0xf95b('0x1'));var moment=require(_0xf95b('0x2'));var BPromise=require(_0xf95b('0x3'));var rs=require(_0xf95b('0x4'));var fs=require('fs');var Redis=require(_0xf95b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf95b('0x6'))(_0xf95b('0x7'));var config=require(_0xf95b('0x8'));var jayson=require(_0xf95b('0x9'));var client=jayson[_0xf95b('0xa')][_0xf95b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x269359,_0x39078a,_0x45a3a4){return new BPromise(function(_0x31081d,_0x2377da){return client['request'](_0x269359,_0x45a3a4)[_0xf95b('0xc')](function(_0x1a3fc6){logger[_0xf95b('0xd')](_0xf95b('0xe'),_0x39078a,'request\x20sent');logger[_0xf95b('0xf')](_0xf95b('0x10'),_0x39078a,_0xf95b('0x11'),JSON[_0xf95b('0x12')](_0x1a3fc6));if(_0x1a3fc6[_0xf95b('0x13')]){if(_0x1a3fc6['error'][_0xf95b('0x14')]===0x1f4){logger[_0xf95b('0x13')](_0xf95b('0xe'),_0x39078a,_0x1a3fc6[_0xf95b('0x13')]['message']);return _0x2377da(_0x1a3fc6[_0xf95b('0x13')][_0xf95b('0x15')]);}logger[_0xf95b('0x13')](_0xf95b('0xe'),_0x39078a,_0x1a3fc6[_0xf95b('0x13')][_0xf95b('0x15')]);return _0x31081d(_0x1a3fc6[_0xf95b('0x13')][_0xf95b('0x15')]);}else{logger[_0xf95b('0xd')](_0xf95b('0xe'),_0x39078a,_0xf95b('0x11'));_0x31081d(_0x1a3fc6[_0xf95b('0x16')]['message']);}})[_0xf95b('0x17')](function(_0x485deb){logger[_0xf95b('0x13')](_0xf95b('0xe'),_0x39078a,_0x485deb);_0x2377da(_0x485deb);});});} \ No newline at end of file +var _0x3e94=['rpc','jayson/promise','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x372469,_0x2c19d5){var _0x53c16f=function(_0x3f1417){while(--_0x3f1417){_0x372469['push'](_0x372469['shift']());}};_0x53c16f(++_0x2c19d5);}(_0x3e94,0x67));var _0x43e9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x3e94[_0x432682];return _0x463d05;};'use strict';var _=require(_0x43e9('0x0'));var util=require(_0x43e9('0x1'));var moment=require('moment');var BPromise=require(_0x43e9('0x2'));var rs=require(_0x43e9('0x3'));var fs=require('fs');var Redis=require(_0x43e9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x43e9('0x5'));var logger=require(_0x43e9('0x6'))(_0x43e9('0x7'));var config=require('../../config/environment');var jayson=require(_0x43e9('0x8'));var client=jayson['client'][_0x43e9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4b35f1,_0x1183a0,_0x2989fe){return new BPromise(function(_0x287aaf,_0x510ee7){return client[_0x43e9('0xa')](_0x4b35f1,_0x2989fe)[_0x43e9('0xb')](function(_0x43d6e8){logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));logger[_0x43e9('0xf')](_0x43e9('0x10'),_0x1183a0,_0x43e9('0xe'),JSON['stringify'](_0x43d6e8));if(_0x43d6e8[_0x43e9('0x11')]){if(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x12')]===0x1f4){logger['error'](_0x43e9('0xd'),_0x1183a0,_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);return _0x510ee7(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x1183a0,_0x43d6e8[_0x43e9('0x11')]['message']);return _0x287aaf(_0x43d6e8[_0x43e9('0x11')][_0x43e9('0x13')]);}else{logger[_0x43e9('0xc')](_0x43e9('0xd'),_0x1183a0,_0x43e9('0xe'));_0x287aaf(_0x43d6e8[_0x43e9('0x14')][_0x43e9('0x13')]);}})[_0x43e9('0x15')](function(_0x3f7164){logger[_0x43e9('0x11')](_0x43e9('0xd'),_0x1183a0,_0x3f7164);_0x510ee7(_0x3f7164);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 863b87f..ce21606 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 _0x374b=['isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id'];(function(_0x17298f,_0x1ec3fc){var _0x192ce1=function(_0x569014){while(--_0x569014){_0x17298f['push'](_0x17298f['shift']());}};_0x192ce1(++_0x1ec3fc);}(_0x374b,0x171));var _0xb374=function(_0x4fcd48,_0x3919d0){_0x4fcd48=_0x4fcd48-0x0;var _0x3aa601=_0x374b[_0x4fcd48];return _0x3aa601;};'use strict';var multer=require(_0xb374('0x0'));var util=require(_0xb374('0x1'));var path=require(_0xb374('0x2'));var timeout=require('connect-timeout');var express=require(_0xb374('0x3'));var router=express[_0xb374('0x4')]();var fs_extra=require(_0xb374('0x5'));var auth=require(_0xb374('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xb374('0x7'));var controller=require('./intServicenowField.controller');router[_0xb374('0x8')]('/',auth['isAuthenticated'](),controller[_0xb374('0x9')]);router['get'](_0xb374('0xa'),auth[_0xb374('0xb')](),controller['show']);router[_0xb374('0xc')]('/',auth[_0xb374('0xb')](),controller[_0xb374('0xd')]);router[_0xb374('0xe')]('/:id',auth[_0xb374('0xb')](),controller[_0xb374('0xf')]);router[_0xb374('0x10')](_0xb374('0xa'),auth[_0xb374('0xb')](),controller[_0xb374('0x11')]);module[_0xb374('0x12')]=router; \ No newline at end of file +var _0x1209=['/:id','show','post','put','update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x397004,_0x7949f){var _0xa7a10=function(_0x377854){while(--_0x377854){_0x397004['push'](_0x397004['shift']());}};_0xa7a10(++_0x7949f);}(_0x1209,0x1bf));var _0x9120=function(_0x41062b,_0x308726){_0x41062b=_0x41062b-0x0;var _0x148fb4=_0x1209[_0x41062b];return _0x148fb4;};'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[_0x9120('0x4')]();var fs_extra=require(_0x9120('0x5'));var auth=require(_0x9120('0x6'));var interaction=require(_0x9120('0x7'));var config=require(_0x9120('0x8'));var controller=require(_0x9120('0x9'));router[_0x9120('0xa')]('/',auth[_0x9120('0xb')](),controller[_0x9120('0xc')]);router['get'](_0x9120('0xd'),auth['isAuthenticated'](),controller[_0x9120('0xe')]);router[_0x9120('0xf')]('/',auth[_0x9120('0xb')](),controller['create']);router[_0x9120('0x10')](_0x9120('0xd'),auth[_0x9120('0xb')](),controller[_0x9120('0x11')]);router['delete'](_0x9120('0xd'),auth['isAuthenticated'](),controller[_0x9120('0x12')]);module[_0x9120('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index f282d76..fa5650d 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 _0x4782=['variable','picklist','STRING','customVariable','exports','ENUM','string'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4782,0x1e0));var _0x2478=function(_0x23dba1,_0x1da069){_0x23dba1=_0x23dba1-0x0;var _0x240079=_0x4782[_0x23dba1];return _0x240079;};'use strict';var Sequelize=require('sequelize');module[_0x2478('0x0')]={'type':{'type':Sequelize[_0x2478('0x1')](_0x2478('0x2'),_0x2478('0x3'),'customVariable','keyValue',_0x2478('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x2478('0x5')]},'key':{'type':Sequelize[_0x2478('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x2478('0x3'),_0x2478('0x6'))},'keyContent':{'type':Sequelize[_0x2478('0x5')]},'idField':{'type':Sequelize[_0x2478('0x5')]},'nameField':{'type':Sequelize[_0x2478('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2478('0x5')]}}; \ No newline at end of file +var _0x47ca=['STRING','variable','BOOLEAN','exports','ENUM','customVariable','string'];(function(_0x59842e,_0x2f6e2b){var _0x3e2605=function(_0x3c53d5){while(--_0x3c53d5){_0x59842e['push'](_0x59842e['shift']());}};_0x3e2605(++_0x2f6e2b);}(_0x47ca,0x16f));var _0xa47c=function(_0x441d1e,_0x53d0ed){_0x441d1e=_0x441d1e-0x0;var _0x27e8ea=_0x47ca[_0x441d1e];return _0x27e8ea;};'use strict';var Sequelize=require('sequelize');module[_0xa47c('0x0')]={'type':{'type':Sequelize[_0xa47c('0x1')]('string','variable',_0xa47c('0x2'),'keyValue','picklist'),'defaultValue':_0xa47c('0x3')},'content':{'type':Sequelize[_0xa47c('0x4')]},'key':{'type':Sequelize[_0xa47c('0x4')]},'keyType':{'type':Sequelize[_0xa47c('0x1')]('string',_0xa47c('0x5'),_0xa47c('0x2'))},'keyContent':{'type':Sequelize[_0xa47c('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xa47c('0x4')]},'customField':{'type':Sequelize[_0xa47c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa47c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index c917c59..196ff73 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 _0x4ba4=['hasOwnProperty','order','sort','where','pick','VIRTUAL','filter','merge','options','ServicenowField','includeAll','include','findAll','then','show','params','catch','create','body','find','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','destroy','status','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x4ba4,0xe6));var _0x44ba=function(_0x18acf6,_0x3f096b){_0x18acf6=_0x18acf6-0x0;var _0x293a2e=_0x4ba4[_0x18acf6];return _0x293a2e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x44ba('0x0'));var rp=require(_0x44ba('0x1'));var moment=require(_0x44ba('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x44ba('0x3'));var path=require('path');var sox=require(_0x44ba('0x4'));var csv=require('to-csv');var ejs=require(_0x44ba('0x5'));var fs=require('fs');var fs_extra=require(_0x44ba('0x6'));var _=require(_0x44ba('0x7'));var squel=require('squel');var crypto=require(_0x44ba('0x8'));var jsforce=require(_0x44ba('0x9'));var deskjs=require(_0x44ba('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x44ba('0xb'));var Redis=require(_0x44ba('0xc'));var authService=require(_0x44ba('0xd'));var qs=require(_0x44ba('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x44ba('0xf'))(_0x44ba('0x10'));var utils=require('../../config/utils');var config=require(_0x44ba('0x11'));var licenseUtil=require(_0x44ba('0x12'));var db=require(_0x44ba('0x13'))['db'];function respondWithStatusCode(_0x512222,_0x593149){_0x593149=_0x593149||0xcc;return function(_0x437bc0){if(_0x437bc0){return _0x512222[_0x44ba('0x14')](_0x593149);}return _0x512222['status'](_0x593149)['end']();};}function respondWithResult(_0x2a9851,_0x4ebb83){_0x4ebb83=_0x4ebb83||0xc8;return function(_0x2138e2){if(_0x2138e2){return _0x2a9851['status'](_0x4ebb83)[_0x44ba('0x15')](_0x2138e2);}};}function respondWithFilteredResult(_0x4bd65d,_0x5882d6){return function(_0x3e09b9){if(_0x3e09b9){var _0x2dfc03=typeof _0x5882d6['offset']===_0x44ba('0x16')&&typeof _0x5882d6[_0x44ba('0x17')]===_0x44ba('0x16');var _0x348bb1=_0x3e09b9[_0x44ba('0x18')];var _0x3e0acb=_0x2dfc03?0x0:_0x5882d6[_0x44ba('0x19')];var _0x4c3f6e=_0x2dfc03?_0x3e09b9[_0x44ba('0x18')]:_0x5882d6[_0x44ba('0x19')]+_0x5882d6[_0x44ba('0x17')];var _0x1503bc;if(_0x4c3f6e>=_0x348bb1){_0x4c3f6e=_0x348bb1;_0x1503bc=0xc8;}else{_0x1503bc=0xce;}_0x4bd65d['status'](_0x1503bc);return _0x4bd65d[_0x44ba('0x1a')](_0x44ba('0x1b'),_0x3e0acb+'-'+_0x4c3f6e+'/'+_0x348bb1)[_0x44ba('0x15')](_0x3e09b9);}return null;};}function patchUpdates(_0x33810c){return function(_0x272c12){try{jsonpatch[_0x44ba('0x1c')](_0x272c12,_0x33810c,!![]);}catch(_0x286cc3){return BPromise['reject'](_0x286cc3);}return _0x272c12[_0x44ba('0x1d')]();};}function saveUpdates(_0x8b82a9,_0x29b322){return function(_0x4f0a9f){if(_0x4f0a9f){return _0x4f0a9f[_0x44ba('0x1e')](_0x8b82a9)['then'](function(_0x1468d8){return _0x1468d8;});}return null;};}function removeEntity(_0x450a1e,_0xec60fb){return function(_0x52c2d1){if(_0x52c2d1){return _0x52c2d1[_0x44ba('0x1f')]()['then'](function(){_0x450a1e[_0x44ba('0x20')](0xcc)[_0x44ba('0x21')]();});}};}function handleEntityNotFound(_0x41f46d,_0x2d61fb){return function(_0xca1fc6){if(!_0xca1fc6){_0x41f46d['sendStatus'](0x194);}return _0xca1fc6;};}function handleError(_0x24f7f2,_0x49ac60){_0x49ac60=_0x49ac60||0x1f4;return function(_0x248f68){logger['error'](_0x248f68[_0x44ba('0x22')]);if(_0x248f68[_0x44ba('0x23')]){delete _0x248f68[_0x44ba('0x23')];}_0x24f7f2['status'](_0x49ac60)[_0x44ba('0x24')](_0x248f68);};}exports[_0x44ba('0x25')]=function(_0x25408b,_0x3fa24c){var _0x1e850d={},_0x1b9176={},_0x7da549={'count':0x0,'rows':[]};var _0x1f2825=_[_0x44ba('0x26')](db['ServicenowField'][_0x44ba('0x27')],function(_0x376bac){return{'name':_0x376bac[_0x44ba('0x28')],'type':_0x376bac[_0x44ba('0x29')]['key']};});_0x1b9176[_0x44ba('0x2a')]=_[_0x44ba('0x26')](_0x1f2825,_0x44ba('0x23'));_0x1b9176[_0x44ba('0x2b')]=_[_0x44ba('0x2c')](_0x25408b[_0x44ba('0x2b')]);_0x1b9176[_0x44ba('0x2d')]=_[_0x44ba('0x2e')](_0x1b9176[_0x44ba('0x2a')],_0x1b9176[_0x44ba('0x2b')]);_0x1e850d[_0x44ba('0x2f')]=_[_0x44ba('0x2e')](_0x1b9176[_0x44ba('0x2a')],qs[_0x44ba('0x30')](_0x25408b[_0x44ba('0x2b')][_0x44ba('0x30')]));_0x1e850d[_0x44ba('0x2f')]=_0x1e850d['attributes'][_0x44ba('0x31')]?_0x1e850d[_0x44ba('0x2f')]:_0x1b9176['model'];if(!_0x25408b[_0x44ba('0x2b')][_0x44ba('0x32')]('nolimit')){_0x1e850d['limit']=qs[_0x44ba('0x17')](_0x25408b[_0x44ba('0x2b')][_0x44ba('0x17')]);_0x1e850d[_0x44ba('0x19')]=qs[_0x44ba('0x19')](_0x25408b[_0x44ba('0x2b')]['offset']);}_0x1e850d[_0x44ba('0x33')]=qs[_0x44ba('0x34')](_0x25408b[_0x44ba('0x2b')][_0x44ba('0x34')]);_0x1e850d[_0x44ba('0x35')]=qs['filters'](_[_0x44ba('0x36')](_0x25408b['query'],_0x1b9176[_0x44ba('0x2d')]),_0x1f2825);if(_0x25408b[_0x44ba('0x2b')]['filter']){_0x1e850d['where']=_['merge'](_0x1e850d['where'],{'$or':_[_0x44ba('0x26')](_0x1f2825,function(_0x433049){if(_0x433049[_0x44ba('0x29')]!==_0x44ba('0x37')){var _0x1d8589={};_0x1d8589[_0x433049[_0x44ba('0x23')]]={'$like':'%'+_0x25408b[_0x44ba('0x2b')][_0x44ba('0x38')]+'%'};return _0x1d8589;}})});}_0x1e850d=_[_0x44ba('0x39')]({},_0x1e850d,_0x25408b[_0x44ba('0x3a')]);var _0x4a5a67={'where':_0x1e850d[_0x44ba('0x35')]};return db[_0x44ba('0x3b')][_0x44ba('0x18')](_0x4a5a67)['then'](function(_0x556491){_0x7da549[_0x44ba('0x18')]=_0x556491;if(_0x25408b[_0x44ba('0x2b')][_0x44ba('0x3c')]){_0x1e850d[_0x44ba('0x3d')]=[{'all':!![]}];}return db['ServicenowField'][_0x44ba('0x3e')](_0x1e850d);})[_0x44ba('0x3f')](function(_0x1dfb82){_0x7da549['rows']=_0x1dfb82;return _0x7da549;})['then'](respondWithFilteredResult(_0x3fa24c,_0x1e850d))['catch'](handleError(_0x3fa24c,null));};exports[_0x44ba('0x40')]=function(_0x281244,_0x91e52a){var _0x40ad81={'raw':!![],'where':{'id':_0x281244[_0x44ba('0x41')]['id']}},_0x3afe31={};_0x3afe31[_0x44ba('0x2a')]=_['keys'](db[_0x44ba('0x3b')][_0x44ba('0x27')]);_0x3afe31['query']=_[_0x44ba('0x2c')](_0x281244[_0x44ba('0x2b')]);_0x3afe31[_0x44ba('0x2d')]=_[_0x44ba('0x2e')](_0x3afe31[_0x44ba('0x2a')],_0x3afe31[_0x44ba('0x2b')]);_0x40ad81[_0x44ba('0x2f')]=_[_0x44ba('0x2e')](_0x3afe31['model'],qs[_0x44ba('0x30')](_0x281244[_0x44ba('0x2b')]['fields']));_0x40ad81[_0x44ba('0x2f')]=_0x40ad81[_0x44ba('0x2f')][_0x44ba('0x31')]?_0x40ad81[_0x44ba('0x2f')]:_0x3afe31[_0x44ba('0x2a')];if(_0x281244[_0x44ba('0x2b')][_0x44ba('0x3c')]){_0x40ad81[_0x44ba('0x3d')]=[{'all':!![]}];}_0x40ad81=_['merge']({},_0x40ad81,_0x281244[_0x44ba('0x3a')]);return db[_0x44ba('0x3b')]['find'](_0x40ad81)[_0x44ba('0x3f')](handleEntityNotFound(_0x91e52a,null))['then'](respondWithResult(_0x91e52a,null))[_0x44ba('0x42')](handleError(_0x91e52a,null));};exports[_0x44ba('0x43')]=function(_0x279536,_0x1f027e){return db[_0x44ba('0x3b')][_0x44ba('0x43')](_0x279536[_0x44ba('0x44')],{})[_0x44ba('0x3f')](respondWithResult(_0x1f027e,0xc9))[_0x44ba('0x42')](handleError(_0x1f027e,null));};exports['update']=function(_0x4766bc,_0x1fcd49){if(_0x4766bc[_0x44ba('0x44')]['id']){delete _0x4766bc[_0x44ba('0x44')]['id'];}return db['ServicenowField'][_0x44ba('0x45')]({'where':{'id':_0x4766bc[_0x44ba('0x41')]['id']}})[_0x44ba('0x3f')](handleEntityNotFound(_0x1fcd49,null))[_0x44ba('0x3f')](saveUpdates(_0x4766bc[_0x44ba('0x44')],null))[_0x44ba('0x3f')](respondWithResult(_0x1fcd49,null))[_0x44ba('0x42')](handleError(_0x1fcd49,null));};exports['destroy']=function(_0x4c43bb,_0x3d22dc){return db[_0x44ba('0x3b')]['find']({'where':{'id':_0x4c43bb[_0x44ba('0x41')]['id']}})['then'](handleEntityNotFound(_0x3d22dc,null))[_0x44ba('0x3f')](removeEntity(_0x3d22dc,null))['catch'](handleError(_0x3d22dc,null));}; \ No newline at end of file +var _0xe348=['show','length','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','Content-Range','save','update','then','destroy','error','stack','name','send','map','ServicenowField','key','model','keys','filters','intersection','attributes','query','fields','hasOwnProperty','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','include','findAll','rows','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe348,0xcd));var _0x8e34=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0xe348[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e34('0x0'));var zipdir=require(_0x8e34('0x1'));var jsonpatch=require(_0x8e34('0x2'));var rp=require(_0x8e34('0x3'));var moment=require('moment');var BPromise=require(_0x8e34('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8e34('0x5'));var sox=require(_0x8e34('0x6'));var csv=require(_0x8e34('0x7'));var ejs=require(_0x8e34('0x8'));var fs=require('fs');var fs_extra=require(_0x8e34('0x9'));var _=require(_0x8e34('0xa'));var squel=require(_0x8e34('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8e34('0x7'));var querystring=require(_0x8e34('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8e34('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e34('0xe'));var logger=require(_0x8e34('0xf'))(_0x8e34('0x10'));var utils=require('../../config/utils');var config=require(_0x8e34('0x11'));var licenseUtil=require(_0x8e34('0x12'));var db=require(_0x8e34('0x13'))['db'];function respondWithStatusCode(_0x3b6d12,_0x2870cc){_0x2870cc=_0x2870cc||0xcc;return function(_0x5bdb32){if(_0x5bdb32){return _0x3b6d12[_0x8e34('0x14')](_0x2870cc);}return _0x3b6d12['status'](_0x2870cc)[_0x8e34('0x15')]();};}function respondWithResult(_0x105da,_0x5922fc){_0x5922fc=_0x5922fc||0xc8;return function(_0x572df9){if(_0x572df9){return _0x105da[_0x8e34('0x16')](_0x5922fc)['json'](_0x572df9);}};}function respondWithFilteredResult(_0x1f593f,_0x393807){return function(_0x54c9a3){if(_0x54c9a3){var _0x49e865=typeof _0x393807[_0x8e34('0x17')]===_0x8e34('0x18')&&typeof _0x393807[_0x8e34('0x19')]===_0x8e34('0x18');var _0x149074=_0x54c9a3['count'];var _0x56a5f7=_0x49e865?0x0:_0x393807[_0x8e34('0x17')];var _0x3e553d=_0x49e865?_0x54c9a3[_0x8e34('0x1a')]:_0x393807[_0x8e34('0x17')]+_0x393807[_0x8e34('0x19')];var _0x43d7e1;if(_0x3e553d>=_0x149074){_0x3e553d=_0x149074;_0x43d7e1=0xc8;}else{_0x43d7e1=0xce;}_0x1f593f[_0x8e34('0x16')](_0x43d7e1);return _0x1f593f['set'](_0x8e34('0x1b'),_0x56a5f7+'-'+_0x3e553d+'/'+_0x149074)['json'](_0x54c9a3);}return null;};}function patchUpdates(_0x48e781){return function(_0x24cd1c){try{jsonpatch['apply'](_0x24cd1c,_0x48e781,!![]);}catch(_0x2883ba){return BPromise['reject'](_0x2883ba);}return _0x24cd1c[_0x8e34('0x1c')]();};}function saveUpdates(_0x19814a,_0x51cfb0){return function(_0x26ae79){if(_0x26ae79){return _0x26ae79[_0x8e34('0x1d')](_0x19814a)[_0x8e34('0x1e')](function(_0x180fdb){return _0x180fdb;});}return null;};}function removeEntity(_0x1ef2aa,_0xefa564){return function(_0x336470){if(_0x336470){return _0x336470[_0x8e34('0x1f')]()[_0x8e34('0x1e')](function(){_0x1ef2aa['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d25c7,_0x2f460a){return function(_0x11c50f){if(!_0x11c50f){_0x2d25c7[_0x8e34('0x14')](0x194);}return _0x11c50f;};}function handleError(_0x3009af,_0x85c907){_0x85c907=_0x85c907||0x1f4;return function(_0xe0613){logger[_0x8e34('0x20')](_0xe0613[_0x8e34('0x21')]);if(_0xe0613[_0x8e34('0x22')]){delete _0xe0613[_0x8e34('0x22')];}_0x3009af['status'](_0x85c907)[_0x8e34('0x23')](_0xe0613);};}exports['index']=function(_0x3c64dd,_0x1e035e){var _0x2568de={},_0x812d60={},_0x5d752c={'count':0x0,'rows':[]};var _0x404eca=_[_0x8e34('0x24')](db[_0x8e34('0x25')]['rawAttributes'],function(_0x2aa315){return{'name':_0x2aa315['fieldName'],'type':_0x2aa315['type'][_0x8e34('0x26')]};});_0x812d60[_0x8e34('0x27')]=_[_0x8e34('0x24')](_0x404eca,'name');_0x812d60['query']=_[_0x8e34('0x28')](_0x3c64dd['query']);_0x812d60[_0x8e34('0x29')]=_[_0x8e34('0x2a')](_0x812d60['model'],_0x812d60['query']);_0x2568de[_0x8e34('0x2b')]=_[_0x8e34('0x2a')](_0x812d60['model'],qs['fields'](_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x2d')]));_0x2568de[_0x8e34('0x2b')]=_0x2568de[_0x8e34('0x2b')]['length']?_0x2568de[_0x8e34('0x2b')]:_0x812d60[_0x8e34('0x27')];if(!_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x2e')](_0x8e34('0x2f'))){_0x2568de[_0x8e34('0x19')]=qs['limit'](_0x3c64dd[_0x8e34('0x2c')]['limit']);_0x2568de[_0x8e34('0x17')]=qs[_0x8e34('0x17')](_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x17')]);}_0x2568de['order']=qs[_0x8e34('0x30')](_0x3c64dd['query'][_0x8e34('0x30')]);_0x2568de['where']=qs[_0x8e34('0x29')](_[_0x8e34('0x31')](_0x3c64dd['query'],_0x812d60[_0x8e34('0x29')]),_0x404eca);if(_0x3c64dd[_0x8e34('0x2c')]['filter']){_0x2568de[_0x8e34('0x32')]=_[_0x8e34('0x33')](_0x2568de[_0x8e34('0x32')],{'$or':_['map'](_0x404eca,function(_0x58985e){if(_0x58985e['type']!==_0x8e34('0x34')){var _0x1e930f={};_0x1e930f[_0x58985e[_0x8e34('0x22')]]={'$like':'%'+_0x3c64dd[_0x8e34('0x2c')][_0x8e34('0x35')]+'%'};return _0x1e930f;}})});}_0x2568de=_['merge']({},_0x2568de,_0x3c64dd[_0x8e34('0x36')]);var _0x44c303={'where':_0x2568de[_0x8e34('0x32')]};return db[_0x8e34('0x25')][_0x8e34('0x1a')](_0x44c303)[_0x8e34('0x1e')](function(_0x37093e){_0x5d752c['count']=_0x37093e;if(_0x3c64dd[_0x8e34('0x2c')]['includeAll']){_0x2568de[_0x8e34('0x37')]=[{'all':!![]}];}return db['ServicenowField'][_0x8e34('0x38')](_0x2568de);})['then'](function(_0x2a2a47){_0x5d752c[_0x8e34('0x39')]=_0x2a2a47;return _0x5d752c;})['then'](respondWithFilteredResult(_0x1e035e,_0x2568de))[_0x8e34('0x3a')](handleError(_0x1e035e,null));};exports[_0x8e34('0x3b')]=function(_0x57f032,_0xed95a){var _0x3215e1={'raw':!![],'where':{'id':_0x57f032['params']['id']}},_0x3c4b17={};_0x3c4b17['model']=_[_0x8e34('0x28')](db['ServicenowField']['rawAttributes']);_0x3c4b17['query']=_[_0x8e34('0x28')](_0x57f032[_0x8e34('0x2c')]);_0x3c4b17['filters']=_[_0x8e34('0x2a')](_0x3c4b17[_0x8e34('0x27')],_0x3c4b17[_0x8e34('0x2c')]);_0x3215e1[_0x8e34('0x2b')]=_[_0x8e34('0x2a')](_0x3c4b17[_0x8e34('0x27')],qs[_0x8e34('0x2d')](_0x57f032[_0x8e34('0x2c')][_0x8e34('0x2d')]));_0x3215e1[_0x8e34('0x2b')]=_0x3215e1[_0x8e34('0x2b')][_0x8e34('0x3c')]?_0x3215e1['attributes']:_0x3c4b17[_0x8e34('0x27')];if(_0x57f032[_0x8e34('0x2c')][_0x8e34('0x3d')]){_0x3215e1[_0x8e34('0x37')]=[{'all':!![]}];}_0x3215e1=_[_0x8e34('0x33')]({},_0x3215e1,_0x57f032[_0x8e34('0x36')]);return db[_0x8e34('0x25')][_0x8e34('0x3e')](_0x3215e1)[_0x8e34('0x1e')](handleEntityNotFound(_0xed95a,null))[_0x8e34('0x1e')](respondWithResult(_0xed95a,null))[_0x8e34('0x3a')](handleError(_0xed95a,null));};exports[_0x8e34('0x3f')]=function(_0x4294de,_0x5a1fb4){return db[_0x8e34('0x25')][_0x8e34('0x3f')](_0x4294de[_0x8e34('0x40')],{})[_0x8e34('0x1e')](respondWithResult(_0x5a1fb4,0xc9))[_0x8e34('0x3a')](handleError(_0x5a1fb4,null));};exports[_0x8e34('0x1d')]=function(_0x413668,_0x491f4){if(_0x413668[_0x8e34('0x40')]['id']){delete _0x413668[_0x8e34('0x40')]['id'];}return db[_0x8e34('0x25')][_0x8e34('0x3e')]({'where':{'id':_0x413668[_0x8e34('0x41')]['id']}})[_0x8e34('0x1e')](handleEntityNotFound(_0x491f4,null))['then'](saveUpdates(_0x413668[_0x8e34('0x40')],null))[_0x8e34('0x1e')](respondWithResult(_0x491f4,null))['catch'](handleError(_0x491f4,null));};exports[_0x8e34('0x1f')]=function(_0x215b24,_0x598e83){return db[_0x8e34('0x25')][_0x8e34('0x3e')]({'where':{'id':_0x215b24[_0x8e34('0x41')]['id']}})[_0x8e34('0x1e')](handleEntityNotFound(_0x598e83,null))[_0x8e34('0x1e')](removeEntity(_0x598e83,null))[_0x8e34('0x3a')](handleError(_0x598e83,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c655c10..3317e05 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 _0x6ec5=['bluebird','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','moment'];(function(_0x132990,_0x1370c9){var _0x2aa89d=function(_0x31ae05){while(--_0x31ae05){_0x132990['push'](_0x132990['shift']());}};_0x2aa89d(++_0x1370c9);}(_0x6ec5,0x176));var _0x56ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6ec5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x56ec('0x0'));var util=require(_0x56ec('0x1'));var logger=require(_0x56ec('0x2'))('api');var moment=require(_0x56ec('0x3'));var BPromise=require(_0x56ec('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x56ec('0x5'));var rimraf=require(_0x56ec('0x6'));var config=require(_0x56ec('0x7'));var attributes=require(_0x56ec('0x8'));module[_0x56ec('0x9')]=function(_0x39d691,_0x2c02b2){return _0x39d691['define'](_0x56ec('0xa'),attributes,{'tableName':_0x56ec('0xb'),'paranoid':![],'indexes':[{'name':_0x56ec('0xc'),'fields':['idField',_0x56ec('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc004=['path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','int_servicenow_fields','idField','FieldId','util','api','moment','bluebird','request-promise'];(function(_0xf93e7a,_0x19aca8){var _0x13877f=function(_0x15de2e){while(--_0x15de2e){_0xf93e7a['push'](_0xf93e7a['shift']());}};_0x13877f(++_0x19aca8);}(_0xc004,0xe9));var _0x4c00=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0xc004[_0x4b4638];return _0x59e92b;};'use strict';var _=require('lodash');var util=require(_0x4c00('0x0'));var logger=require('../../config/logger')(_0x4c00('0x1'));var moment=require(_0x4c00('0x2'));var BPromise=require(_0x4c00('0x3'));var rp=require(_0x4c00('0x4'));var fs=require('fs');var path=require(_0x4c00('0x5'));var rimraf=require(_0x4c00('0x6'));var config=require(_0x4c00('0x7'));var attributes=require(_0x4c00('0x8'));module[_0x4c00('0x9')]=function(_0x140352,_0x161d44){return _0x140352[_0x4c00('0xa')]('ServicenowField',attributes,{'tableName':_0x4c00('0xb'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x4c00('0xc'),_0x4c00('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index e454744..6e0c74a 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x3eb630,_0x552586){var _0x1b840d=function(_0x2594a8){while(--_0x2594a8){_0x3eb630['push'](_0x3eb630['shift']());}};_0x1b840d(++_0x552586);}(_0xda3f,0xec));var _0xfda3=function(_0x262b63,_0x1c3e68){_0x262b63=_0x262b63-0x0;var _0x1b7344=_0xda3f[_0x262b63];return _0x1b7344;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file +var _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xda3f,0xec));var _0xfda3=function(_0x34a904,_0x49e7cd){_0x34a904=_0x34a904-0x0;var _0x3376a1=_0xda3f[_0x34a904];return _0x3376a1;};'use strict';var _=require('lodash');var util=require(_0xfda3('0x0'));var moment=require(_0xfda3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfda3('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xfda3('0x3'))(_0xfda3('0x4'));var config=require('../../config/environment');var jayson=require(_0xfda3('0x5'));var client=jayson[_0xfda3('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e72d1,_0x316792,_0x42476a){return new BPromise(function(_0x125e2a,_0x4018c0){return client[_0xfda3('0x7')](_0x4e72d1,_0x42476a)[_0xfda3('0x8')](function(_0x46655c){logger[_0xfda3('0x9')](_0xfda3('0xa'),_0x316792,_0xfda3('0xb'));logger[_0xfda3('0xc')](_0xfda3('0xd'),_0x316792,'request\x20sent',JSON[_0xfda3('0xe')](_0x46655c));if(_0x46655c[_0xfda3('0xf')]){if(_0x46655c[_0xfda3('0xf')][_0xfda3('0x10')]===0x1f4){logger[_0xfda3('0xf')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\x20%s,\x20%s',_0x316792,_0xfda3('0xb'));_0x125e2a(_0x46655c[_0xfda3('0x12')][_0xfda3('0x11')]);}})[_0xfda3('0x13')](function(_0x34900d){logger[_0xfda3('0xf')](_0xfda3('0xa'),_0x316792,_0x34900d);_0x4018c0(_0x34900d);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 50a4eb7..d35f6f7 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(_0xccf844,_0x5d777c){var _0x179059=function(_0x15741a){while(--_0x15741a){_0xccf844['push'](_0xccf844['shift']());}};_0x179059(++_0x5d777c);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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(_0x4e0706,_0x43ba34){var _0x4e1bd3=function(_0x6d561e){while(--_0x6d561e){_0x4e0706['push'](_0x4e0706['shift']());}};_0x4e1bd3(++_0x43ba34);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 8a3eafd..ff58a0d 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(_0x23c88c,_0x551202){var _0x4c9232=function(_0x2ed99e){while(--_0x2ed99e){_0x23c88c['push'](_0x23c88c['shift']());}};_0x4c9232(++_0x551202);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x4d10a6,_0x50dc1d){var _0x3b6a84=function(_0x19d31e){while(--_0x19d31e){_0x4d10a6['push'](_0x4d10a6['shift']());}};_0x3b6a84(++_0x50dc1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 5b7c684..149e7f4 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 _0xeda6=['sendStatus','end','status','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','SugarcrmAccount','keys','find','create','body','update','params','getConfigurations','findOne','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','getFields','assigned_user_id','created_by','description','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','module_fields','remove','label','values','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../components/integrations/configuration'];(function(_0x5d6b41,_0x3d1c8f){var _0x1c2dd6=function(_0x48d601){while(--_0x48d601){_0x5d6b41['push'](_0x5d6b41['shift']());}};_0x1c2dd6(++_0x3d1c8f);}(_0xeda6,0x157));var _0x6eda=function(_0xa3053b,_0x4fd758){_0xa3053b=_0xa3053b-0x0;var _0x1b71fe=_0xeda6[_0xa3053b];return _0x1b71fe;};'use strict';var emlformat=require(_0x6eda('0x0'));var rimraf=require(_0x6eda('0x1'));var zipdir=require(_0x6eda('0x2'));var jsonpatch=require(_0x6eda('0x3'));var rp=require(_0x6eda('0x4'));var moment=require(_0x6eda('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6eda('0x6'));var util=require(_0x6eda('0x7'));var path=require('path');var sox=require(_0x6eda('0x8'));var csv=require('to-csv');var ejs=require(_0x6eda('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6eda('0xa'));var squel=require(_0x6eda('0xb'));var crypto=require(_0x6eda('0xc'));var jsforce=require(_0x6eda('0xd'));var deskjs=require(_0x6eda('0xe'));var toCsv=require(_0x6eda('0xf'));var querystring=require(_0x6eda('0x10'));var Papa=require(_0x6eda('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6eda('0x12'));var as=require(_0x6eda('0x13'));var hardwareService=require(_0x6eda('0x14'));var logger=require(_0x6eda('0x15'))(_0x6eda('0x16'));var utils=require(_0x6eda('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6eda('0x18'));var db=require('../../mysqldb')['db'];var integrations=require(_0x6eda('0x19'));function respondWithStatusCode(_0x23e152,_0xace04d){_0xace04d=_0xace04d||0xcc;return function(_0x2d94b5){if(_0x2d94b5){return _0x23e152[_0x6eda('0x1a')](_0xace04d);}return _0x23e152['status'](_0xace04d)[_0x6eda('0x1b')]();};}function respondWithResult(_0x1bf24c,_0x4c1f0a){_0x4c1f0a=_0x4c1f0a||0xc8;return function(_0x367cfd){if(_0x367cfd){return _0x1bf24c[_0x6eda('0x1c')](_0x4c1f0a)['json'](_0x367cfd);}};}function respondWithFilteredResult(_0x50fc07,_0x54e3de){return function(_0x4d0d32){if(_0x4d0d32){var _0x309b79=typeof _0x54e3de['offset']==='undefined'&&typeof _0x54e3de[_0x6eda('0x1d')]===_0x6eda('0x1e');var _0x4d89a8=_0x4d0d32[_0x6eda('0x1f')];var _0x4b2dd0=_0x309b79?0x0:_0x54e3de[_0x6eda('0x20')];var _0x279016=_0x309b79?_0x4d0d32[_0x6eda('0x1f')]:_0x54e3de[_0x6eda('0x20')]+_0x54e3de[_0x6eda('0x1d')];var _0xa9860b;if(_0x279016>=_0x4d89a8){_0x279016=_0x4d89a8;_0xa9860b=0xc8;}else{_0xa9860b=0xce;}_0x50fc07[_0x6eda('0x1c')](_0xa9860b);return _0x50fc07[_0x6eda('0x21')](_0x6eda('0x22'),_0x4b2dd0+'-'+_0x279016+'/'+_0x4d89a8)[_0x6eda('0x23')](_0x4d0d32);}return null;};}function patchUpdates(_0x505a1b){return function(_0x1f3f1d){try{jsonpatch[_0x6eda('0x24')](_0x1f3f1d,_0x505a1b,!![]);}catch(_0x274fda){return BPromise[_0x6eda('0x25')](_0x274fda);}return _0x1f3f1d[_0x6eda('0x26')]();};}function saveUpdates(_0x51ea35,_0x1881e1){return function(_0x4a3f23){if(_0x4a3f23){return _0x4a3f23['update'](_0x51ea35)[_0x6eda('0x27')](function(_0x56f87f){return _0x56f87f;});}return null;};}function removeEntity(_0x1e6c65,_0x5b629b){return function(_0x52de87){if(_0x52de87){return _0x52de87[_0x6eda('0x28')]()['then'](function(){_0x1e6c65[_0x6eda('0x1c')](0xcc)[_0x6eda('0x1b')]();});}};}function handleEntityNotFound(_0x2134e0,_0x1b7c80){return function(_0x38de78){if(!_0x38de78){_0x2134e0[_0x6eda('0x1a')](0x194);}return _0x38de78;};}function handleError(_0x5a899e,_0x3d7e4d){_0x3d7e4d=_0x3d7e4d||0x1f4;return function(_0x4d1df9){logger[_0x6eda('0x29')](_0x4d1df9[_0x6eda('0x2a')]);if(_0x4d1df9[_0x6eda('0x2b')]){delete _0x4d1df9[_0x6eda('0x2b')];}_0x5a899e[_0x6eda('0x1c')](_0x3d7e4d)['send'](_0x4d1df9);};}exports[_0x6eda('0x2c')]=function(_0x2832c8,_0x56f32a){var _0x4985e9={},_0x4f5428={},_0x5ed781={'count':0x0,'rows':[]};var _0x1e2b04=_[_0x6eda('0x2d')](db['SugarcrmAccount'][_0x6eda('0x2e')],function(_0x383838){return{'name':_0x383838[_0x6eda('0x2f')],'type':_0x383838[_0x6eda('0x30')][_0x6eda('0x31')]};});_0x4f5428[_0x6eda('0x32')]=_[_0x6eda('0x2d')](_0x1e2b04,_0x6eda('0x2b'));_0x4f5428['query']=_['keys'](_0x2832c8[_0x6eda('0x33')]);_0x4f5428[_0x6eda('0x34')]=_[_0x6eda('0x35')](_0x4f5428['model'],_0x4f5428[_0x6eda('0x33')]);_0x4985e9['attributes']=_[_0x6eda('0x35')](_0x4f5428[_0x6eda('0x32')],qs[_0x6eda('0x36')](_0x2832c8[_0x6eda('0x33')]['fields']));_0x4985e9[_0x6eda('0x37')]=_0x4985e9[_0x6eda('0x37')][_0x6eda('0x38')]?_0x4985e9[_0x6eda('0x37')]:_0x4f5428[_0x6eda('0x32')];if(!_0x2832c8[_0x6eda('0x33')][_0x6eda('0x39')](_0x6eda('0x3a'))){_0x4985e9[_0x6eda('0x1d')]=qs[_0x6eda('0x1d')](_0x2832c8['query']['limit']);_0x4985e9['offset']=qs[_0x6eda('0x20')](_0x2832c8[_0x6eda('0x33')][_0x6eda('0x20')]);}_0x4985e9[_0x6eda('0x3b')]=qs['sort'](_0x2832c8[_0x6eda('0x33')][_0x6eda('0x3c')]);_0x4985e9[_0x6eda('0x3d')]=qs[_0x6eda('0x34')](_[_0x6eda('0x3e')](_0x2832c8[_0x6eda('0x33')],_0x4f5428['filters']),_0x1e2b04);if(_0x2832c8[_0x6eda('0x33')]['filter']){_0x4985e9[_0x6eda('0x3d')]=_['merge'](_0x4985e9[_0x6eda('0x3d')],{'$or':_['map'](_0x1e2b04,function(_0xc9cf43){if(_0xc9cf43[_0x6eda('0x30')]!=='VIRTUAL'){var _0x235b04={};_0x235b04[_0xc9cf43[_0x6eda('0x2b')]]={'$like':'%'+_0x2832c8[_0x6eda('0x33')][_0x6eda('0x3f')]+'%'};return _0x235b04;}})});}_0x4985e9=_[_0x6eda('0x40')]({},_0x4985e9,_0x2832c8[_0x6eda('0x41')]);var _0x3e4143={'where':_0x4985e9[_0x6eda('0x3d')]};return db['SugarcrmAccount']['count'](_0x3e4143)[_0x6eda('0x27')](function(_0x10a6f9){_0x5ed781[_0x6eda('0x1f')]=_0x10a6f9;if(_0x2832c8['query'][_0x6eda('0x42')]){_0x4985e9[_0x6eda('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0x6eda('0x44')](_0x4985e9);})['then'](function(_0x2f1b08){_0x5ed781[_0x6eda('0x45')]=_0x2f1b08;return _0x5ed781;})['then'](respondWithFilteredResult(_0x56f32a,_0x4985e9))[_0x6eda('0x46')](handleError(_0x56f32a,null));};exports[_0x6eda('0x47')]=function(_0x3dc4b5,_0x1d2767){var _0x4f3101={'raw':![],'where':{'id':_0x3dc4b5['params']['id']}},_0x3aa95f={};_0x3aa95f[_0x6eda('0x32')]=_['keys'](db[_0x6eda('0x48')][_0x6eda('0x2e')]);_0x3aa95f[_0x6eda('0x33')]=_[_0x6eda('0x49')](_0x3dc4b5[_0x6eda('0x33')]);_0x3aa95f['filters']=_[_0x6eda('0x35')](_0x3aa95f[_0x6eda('0x32')],_0x3aa95f[_0x6eda('0x33')]);_0x4f3101[_0x6eda('0x37')]=_['intersection'](_0x3aa95f[_0x6eda('0x32')],qs[_0x6eda('0x36')](_0x3dc4b5[_0x6eda('0x33')][_0x6eda('0x36')]));_0x4f3101[_0x6eda('0x37')]=_0x4f3101[_0x6eda('0x37')]['length']?_0x4f3101['attributes']:_0x3aa95f[_0x6eda('0x32')];if(_0x3dc4b5[_0x6eda('0x33')][_0x6eda('0x42')]){_0x4f3101[_0x6eda('0x43')]=[{'all':!![]}];}_0x4f3101=_[_0x6eda('0x40')]({},_0x4f3101,_0x3dc4b5[_0x6eda('0x41')]);return db[_0x6eda('0x48')][_0x6eda('0x4a')](_0x4f3101)[_0x6eda('0x27')](handleEntityNotFound(_0x1d2767,null))[_0x6eda('0x27')](respondWithResult(_0x1d2767,null))[_0x6eda('0x46')](handleError(_0x1d2767,null));};exports[_0x6eda('0x4b')]=function(_0x1a5450,_0x1cba99){return db['SugarcrmAccount'][_0x6eda('0x4b')](_0x1a5450[_0x6eda('0x4c')],{})[_0x6eda('0x27')](respondWithResult(_0x1cba99,0xc9))['catch'](handleError(_0x1cba99,null));};exports[_0x6eda('0x4d')]=function(_0x521e9d,_0x488038){if(_0x521e9d['body']['id']){delete _0x521e9d[_0x6eda('0x4c')]['id'];}return db[_0x6eda('0x48')][_0x6eda('0x4a')]({'where':{'id':_0x521e9d[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x488038,null))['then'](saveUpdates(_0x521e9d[_0x6eda('0x4c')],null))['then'](respondWithResult(_0x488038,null))[_0x6eda('0x46')](handleError(_0x488038,null));};exports[_0x6eda('0x28')]=function(_0x546e7f,_0x29c88d){return db[_0x6eda('0x48')][_0x6eda('0x4a')]({'where':{'id':_0x546e7f[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x29c88d,null))[_0x6eda('0x27')](removeEntity(_0x29c88d,null))[_0x6eda('0x46')](handleError(_0x29c88d,null));};exports[_0x6eda('0x4f')]=function(_0x2c9a26,_0x52bfdd,_0x1307c5){var _0x20a69f={};var _0x10acec={};var _0x34f82e;var _0x5d1dc2;return db[_0x6eda('0x48')][_0x6eda('0x50')]({'where':{'id':_0x2c9a26[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x52bfdd,null))[_0x6eda('0x27')](function(_0x5db554){if(_0x5db554){_0x34f82e=_0x5db554;_0x10acec['model']=_[_0x6eda('0x49')](db['SugarcrmConfiguration'][_0x6eda('0x2e')]);_0x10acec[_0x6eda('0x33')]=_['keys'](_0x2c9a26[_0x6eda('0x33')]);_0x10acec['filters']=_[_0x6eda('0x35')](_0x10acec[_0x6eda('0x32')],_0x10acec[_0x6eda('0x33')]);_0x20a69f[_0x6eda('0x37')]=_[_0x6eda('0x35')](_0x10acec[_0x6eda('0x32')],qs[_0x6eda('0x36')](_0x2c9a26[_0x6eda('0x33')]['fields']));_0x20a69f[_0x6eda('0x37')]=_0x20a69f[_0x6eda('0x37')][_0x6eda('0x38')]?_0x20a69f['attributes']:_0x10acec['model'];_0x20a69f[_0x6eda('0x3b')]=qs[_0x6eda('0x3c')](_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x3c')]);_0x20a69f[_0x6eda('0x3d')]=qs[_0x6eda('0x34')](_['pick'](_0x2c9a26[_0x6eda('0x33')],_0x10acec['filters']));if(_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x3f')]){_0x20a69f[_0x6eda('0x3d')]=_[_0x6eda('0x40')](_0x20a69f[_0x6eda('0x3d')],{'$or':_[_0x6eda('0x2d')](_0x20a69f[_0x6eda('0x37')],function(_0x221b3a){var _0x39feca={};_0x39feca[_0x221b3a]={'$like':'%'+_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x3f')]+'%'};return _0x39feca;})});}_0x20a69f=_[_0x6eda('0x40')]({},_0x20a69f,_0x2c9a26[_0x6eda('0x41')]);return _0x34f82e['getConfigurations'](_0x20a69f);}})[_0x6eda('0x27')](function(_0x20c756){if(_0x20c756){_0x5d1dc2=_0x20c756[_0x6eda('0x38')];if(!_0x2c9a26['query'][_0x6eda('0x39')](_0x6eda('0x3a'))){_0x20a69f[_0x6eda('0x1d')]=qs['limit'](_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x1d')]);_0x20a69f[_0x6eda('0x20')]=qs[_0x6eda('0x20')](_0x2c9a26[_0x6eda('0x33')][_0x6eda('0x20')]);}return _0x34f82e['getConfigurations'](_0x20a69f);}})[_0x6eda('0x27')](function(_0x4d14f5){if(_0x4d14f5){return _0x4d14f5?{'count':_0x5d1dc2,'rows':_0x4d14f5}:null;}})[_0x6eda('0x27')](respondWithResult(_0x52bfdd,null))[_0x6eda('0x46')](handleError(_0x52bfdd,null));};exports[_0x6eda('0x51')]=function(_0x22f5de,_0x1aaa85,_0x5e926d){if(_0x22f5de['body']['id']){delete _0x22f5de[_0x6eda('0x4c')]['id'];}return db[_0x6eda('0x48')]['findOne']({'where':{'id':_0x22f5de[_0x6eda('0x4e')]['id']}})[_0x6eda('0x27')](handleEntityNotFound(_0x1aaa85,null))[_0x6eda('0x27')](function(_0x4350ce){if(_0x4350ce){_0x22f5de[_0x6eda('0x4c')]['AccountId']=_0x4350ce['id'];_0x22f5de[_0x6eda('0x4c')]['Subjects']=integrations[_0x6eda('0x52')](_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x53')],_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x30')]);_0x22f5de['body'][_0x6eda('0x54')]=integrations[_0x6eda('0x55')](_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x53')],_0x22f5de[_0x6eda('0x4c')][_0x6eda('0x30')]);return db['SugarcrmConfiguration'][_0x6eda('0x4b')](_0x22f5de[_0x6eda('0x4c')],{'include':[{'model':db[_0x6eda('0x56')],'as':_0x6eda('0x57')},{'model':db['SugarcrmField'],'as':_0x6eda('0x54')}]});}return null;})[_0x6eda('0x27')](respondWithResult(_0x1aaa85,null))[_0x6eda('0x46')](handleError(_0x1aaa85,null));};exports[_0x6eda('0x58')]=function(_0xb01a11,_0xe5d30c,_0x2413e9){var _0x21417e='';var _0x4a06a6=['id',_0x6eda('0x2b'),_0x6eda('0x59'),_0x6eda('0x5a'),_0x6eda('0x5b'),_0x6eda('0x5c'),_0x6eda('0x5d'),'duration_minutes',_0x6eda('0x5e'),'parent_type',_0x6eda('0x5f'),_0x6eda('0x60')];return db['SugarcrmAccount'][_0x6eda('0x50')]({'where':{'id':_0xb01a11[_0x6eda('0x4e')]['id']},'attributes':['id',_0x6eda('0x61'),_0x6eda('0x62'),_0x6eda('0x63')]})[_0x6eda('0x27')](handleEntityNotFound(_0xe5d30c,null))['then'](function(_0x4052d8){if(_0x4052d8){_0x21417e=_0x4052d8[_0x6eda('0x63')];var _0x58dce3=_0x21417e[_0x6eda('0x64')](-0x1);if(_0x58dce3==='/'){_0x21417e=_0x21417e[_0x6eda('0x65')](0x0,_0x21417e[_0x6eda('0x66')](_0x58dce3));}return rp({'method':_0x6eda('0x67'),'uri':util[_0x6eda('0x68')]('%s%s',_0x21417e,_0x6eda('0x69')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x6eda('0x6a')]({'user_auth':{'user_name':_0x4052d8[_0x6eda('0x61')],'password':_0x4052d8['password'],'encryption':_0x6eda('0x6b')},'application':_0x6eda('0x6c')})}});}})[_0x6eda('0x27')](function(_0x1900a6){if(_0x1900a6&&_0x1900a6[_0x6eda('0x2b')]!==_0x6eda('0x6d')&&_0x1900a6[_0x6eda('0x2b')]!==_0x6eda('0x6e')){return rp({'method':_0x6eda('0x67'),'uri':util[_0x6eda('0x68')]('%s%s',_0x21417e,_0x6eda('0x69')),'json':!![],'form':{'method':_0x6eda('0x6f'),'input_type':_0x6eda('0x70'),'response_type':'JSON','rest_data':JSON[_0x6eda('0x6a')]({'session':_0x1900a6['id'],'module_name':'Calls'})}})[_0x6eda('0x27')](function(_0x4cb4a9){if(_0x4cb4a9){var _0x1dec2c=_['values'](_0x4cb4a9[_0x6eda('0x71')]);_[_0x6eda('0x72')](_0x1dec2c,function(_0x5670cb){return _0x4a06a6['includes'](_0x5670cb[_0x6eda('0x2b')]);});return{'count':_0x1dec2c['length'],'rows':_[_0x6eda('0x2d')](_0x1dec2c,function(_0xb16a69){return{'id':_0xb16a69[_0x6eda('0x2b')],'name':_0xb16a69[_0x6eda('0x73')],'custom':_['endsWith'](_0xb16a69[_0x6eda('0x2b')],'_c')?!![]:![],'options':_0xb16a69[_0x6eda('0x41')]?_[_0x6eda('0x2d')](_[_0x6eda('0x74')](_0xb16a69[_0x6eda('0x41')]),function(_0x2241e4){return{'name':_0x2241e4[_0x6eda('0x75')],'value':_0x2241e4[_0x6eda('0x2b')]};}):[]};})};}})[_0x6eda('0x27')](respondWithResult(_0xe5d30c,null))[_0x6eda('0x46')](function(_0x5517b4){var _0xc700f7=_0xb01a11[_0x6eda('0x33')]['test']?0x1f4:_0x5517b4[_0x6eda('0x76')]||0x1f4;logger['error'](_0x6eda('0x77'),_0x6eda('0x58'),_0xc700f7,JSON[_0x6eda('0x6a')](_0x5517b4));delete _0x5517b4[_0x6eda('0x2b')];if(_0xc700f7===0x191){_0xc700f7=0x190;}_0xe5d30c[_0x6eda('0x1c')](_0xc700f7)[_0x6eda('0x78')](_0xb01a11[_0x6eda('0x33')][_0x6eda('0x79')]?{'message':_0x6eda('0x7a'),'statusCode':_0x5517b4[_0x6eda('0x76')]}:_0x5517b4);});}else{var _0x4fa613=0x1f4;_0xe5d30c[_0x6eda('0x1c')](_0x4fa613)[_0x6eda('0x78')]({'message':_0x6eda('0x7a'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x6930=['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/license/util','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','then','destroy','sendStatus','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','keys','query','intersection','model','attributes','fields','length','nolimit','order','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','update','getConfigurations','findOne','SugarcrmConfiguration','sort','pick','hasOwnProperty','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','username','remoteUri','slice','substring','lastIndexOf','POST','format','/service/v4_1/rest.php','login','JSON','password','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','%s%s','stringify','values','remove','includes','label','endsWith','value','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','test','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','sox','to-csv'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x6930,0x1e9));var _0x0693=function(_0x2a3120,_0x40847c){_0x2a3120=_0x2a3120-0x0;var _0x26030e=_0x6930[_0x2a3120];return _0x26030e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0693('0x0'));var zipdir=require(_0x0693('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0693('0x2'));var moment=require(_0x0693('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0693('0x4'));var util=require('util');var path=require('path');var sox=require(_0x0693('0x5'));var csv=require(_0x0693('0x6'));var ejs=require(_0x0693('0x7'));var fs=require('fs');var fs_extra=require(_0x0693('0x8'));var _=require(_0x0693('0x9'));var squel=require(_0x0693('0xa'));var crypto=require('crypto');var jsforce=require(_0x0693('0xb'));var deskjs=require(_0x0693('0xc'));var toCsv=require(_0x0693('0x6'));var querystring=require(_0x0693('0xd'));var Papa=require(_0x0693('0xe'));var Redis=require(_0x0693('0xf'));var authService=require(_0x0693('0x10'));var qs=require(_0x0693('0x11'));var as=require(_0x0693('0x12'));var hardwareService=require(_0x0693('0x13'));var logger=require(_0x0693('0x14'))(_0x0693('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0693('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0x0693('0x17'));function respondWithStatusCode(_0x3b1da3,_0x563842){_0x563842=_0x563842||0xcc;return function(_0x5c6831){if(_0x5c6831){return _0x3b1da3['sendStatus'](_0x563842);}return _0x3b1da3['status'](_0x563842)[_0x0693('0x18')]();};}function respondWithResult(_0x3b57c5,_0x2890d5){_0x2890d5=_0x2890d5||0xc8;return function(_0xdb404f){if(_0xdb404f){return _0x3b57c5[_0x0693('0x19')](_0x2890d5)['json'](_0xdb404f);}};}function respondWithFilteredResult(_0x1c0ca1,_0x2bdf3c){return function(_0x4aef1f){if(_0x4aef1f){var _0x406126=typeof _0x2bdf3c[_0x0693('0x1a')]===_0x0693('0x1b')&&typeof _0x2bdf3c[_0x0693('0x1c')]==='undefined';var _0x419000=_0x4aef1f[_0x0693('0x1d')];var _0x4c2f79=_0x406126?0x0:_0x2bdf3c[_0x0693('0x1a')];var _0x1616f8=_0x406126?_0x4aef1f[_0x0693('0x1d')]:_0x2bdf3c[_0x0693('0x1a')]+_0x2bdf3c['limit'];var _0x833703;if(_0x1616f8>=_0x419000){_0x1616f8=_0x419000;_0x833703=0xc8;}else{_0x833703=0xce;}_0x1c0ca1['status'](_0x833703);return _0x1c0ca1[_0x0693('0x1e')](_0x0693('0x1f'),_0x4c2f79+'-'+_0x1616f8+'/'+_0x419000)[_0x0693('0x20')](_0x4aef1f);}return null;};}function patchUpdates(_0xaf0a69){return function(_0x2637bf){try{jsonpatch['apply'](_0x2637bf,_0xaf0a69,!![]);}catch(_0x215fed){return BPromise[_0x0693('0x21')](_0x215fed);}return _0x2637bf[_0x0693('0x22')]();};}function saveUpdates(_0xf77233,_0x2a748f){return function(_0x2ee7eb){if(_0x2ee7eb){return _0x2ee7eb['update'](_0xf77233)[_0x0693('0x23')](function(_0x3b2ce7){return _0x3b2ce7;});}return null;};}function removeEntity(_0x59628d,_0x4219f4){return function(_0x54404b){if(_0x54404b){return _0x54404b[_0x0693('0x24')]()['then'](function(){_0x59628d[_0x0693('0x19')](0xcc)[_0x0693('0x18')]();});}};}function handleEntityNotFound(_0x3d8dff,_0x134e2f){return function(_0x52938a){if(!_0x52938a){_0x3d8dff[_0x0693('0x25')](0x194);}return _0x52938a;};}function handleError(_0x3ec592,_0x5e511b){_0x5e511b=_0x5e511b||0x1f4;return function(_0x18f71c){logger['error'](_0x18f71c[_0x0693('0x26')]);if(_0x18f71c[_0x0693('0x27')]){delete _0x18f71c['name'];}_0x3ec592['status'](_0x5e511b)[_0x0693('0x28')](_0x18f71c);};}exports[_0x0693('0x29')]=function(_0x459e95,_0xfad12c){var _0x29fe38={},_0x1f5ac6={},_0x4369bc={'count':0x0,'rows':[]};var _0x3e2515=_[_0x0693('0x2a')](db[_0x0693('0x2b')][_0x0693('0x2c')],function(_0x204065){return{'name':_0x204065[_0x0693('0x2d')],'type':_0x204065[_0x0693('0x2e')]['key']};});_0x1f5ac6['model']=_[_0x0693('0x2a')](_0x3e2515,_0x0693('0x27'));_0x1f5ac6['query']=_[_0x0693('0x2f')](_0x459e95[_0x0693('0x30')]);_0x1f5ac6['filters']=_[_0x0693('0x31')](_0x1f5ac6[_0x0693('0x32')],_0x1f5ac6[_0x0693('0x30')]);_0x29fe38[_0x0693('0x33')]=_[_0x0693('0x31')](_0x1f5ac6['model'],qs[_0x0693('0x34')](_0x459e95[_0x0693('0x30')][_0x0693('0x34')]));_0x29fe38[_0x0693('0x33')]=_0x29fe38[_0x0693('0x33')][_0x0693('0x35')]?_0x29fe38[_0x0693('0x33')]:_0x1f5ac6[_0x0693('0x32')];if(!_0x459e95['query']['hasOwnProperty'](_0x0693('0x36'))){_0x29fe38['limit']=qs[_0x0693('0x1c')](_0x459e95[_0x0693('0x30')][_0x0693('0x1c')]);_0x29fe38[_0x0693('0x1a')]=qs[_0x0693('0x1a')](_0x459e95[_0x0693('0x30')][_0x0693('0x1a')]);}_0x29fe38[_0x0693('0x37')]=qs['sort'](_0x459e95[_0x0693('0x30')]['sort']);_0x29fe38[_0x0693('0x38')]=qs[_0x0693('0x39')](_['pick'](_0x459e95[_0x0693('0x30')],_0x1f5ac6['filters']),_0x3e2515);if(_0x459e95[_0x0693('0x30')][_0x0693('0x3a')]){_0x29fe38[_0x0693('0x38')]=_[_0x0693('0x3b')](_0x29fe38['where'],{'$or':_[_0x0693('0x2a')](_0x3e2515,function(_0x2d773e){if(_0x2d773e['type']!==_0x0693('0x3c')){var _0x4f90b4={};_0x4f90b4[_0x2d773e[_0x0693('0x27')]]={'$like':'%'+_0x459e95['query'][_0x0693('0x3a')]+'%'};return _0x4f90b4;}})});}_0x29fe38=_[_0x0693('0x3b')]({},_0x29fe38,_0x459e95[_0x0693('0x3d')]);var _0x1aee04={'where':_0x29fe38[_0x0693('0x38')]};return db[_0x0693('0x2b')][_0x0693('0x1d')](_0x1aee04)[_0x0693('0x23')](function(_0x21c2ea){_0x4369bc[_0x0693('0x1d')]=_0x21c2ea;if(_0x459e95['query'][_0x0693('0x3e')]){_0x29fe38[_0x0693('0x3f')]=[{'all':!![]}];}return db[_0x0693('0x2b')][_0x0693('0x40')](_0x29fe38);})[_0x0693('0x23')](function(_0x41ce24){_0x4369bc[_0x0693('0x41')]=_0x41ce24;return _0x4369bc;})[_0x0693('0x23')](respondWithFilteredResult(_0xfad12c,_0x29fe38))['catch'](handleError(_0xfad12c,null));};exports[_0x0693('0x42')]=function(_0xec1966,_0x2cb1ae){var _0xb7b998={'raw':![],'where':{'id':_0xec1966[_0x0693('0x43')]['id']}},_0x4332c9={};_0x4332c9['model']=_[_0x0693('0x2f')](db[_0x0693('0x2b')][_0x0693('0x2c')]);_0x4332c9[_0x0693('0x30')]=_[_0x0693('0x2f')](_0xec1966[_0x0693('0x30')]);_0x4332c9[_0x0693('0x39')]=_[_0x0693('0x31')](_0x4332c9['model'],_0x4332c9[_0x0693('0x30')]);_0xb7b998[_0x0693('0x33')]=_[_0x0693('0x31')](_0x4332c9[_0x0693('0x32')],qs[_0x0693('0x34')](_0xec1966[_0x0693('0x30')][_0x0693('0x34')]));_0xb7b998[_0x0693('0x33')]=_0xb7b998[_0x0693('0x33')][_0x0693('0x35')]?_0xb7b998[_0x0693('0x33')]:_0x4332c9[_0x0693('0x32')];if(_0xec1966[_0x0693('0x30')]['includeAll']){_0xb7b998[_0x0693('0x3f')]=[{'all':!![]}];}_0xb7b998=_['merge']({},_0xb7b998,_0xec1966[_0x0693('0x3d')]);return db[_0x0693('0x2b')][_0x0693('0x44')](_0xb7b998)['then'](handleEntityNotFound(_0x2cb1ae,null))[_0x0693('0x23')](respondWithResult(_0x2cb1ae,null))[_0x0693('0x45')](handleError(_0x2cb1ae,null));};exports[_0x0693('0x46')]=function(_0x1b13c5,_0x3fbb68){return db[_0x0693('0x2b')][_0x0693('0x46')](_0x1b13c5[_0x0693('0x47')],{})[_0x0693('0x23')](respondWithResult(_0x3fbb68,0xc9))['catch'](handleError(_0x3fbb68,null));};exports[_0x0693('0x48')]=function(_0x15aedc,_0x1863b2){if(_0x15aedc[_0x0693('0x47')]['id']){delete _0x15aedc[_0x0693('0x47')]['id'];}return db['SugarcrmAccount'][_0x0693('0x44')]({'where':{'id':_0x15aedc[_0x0693('0x43')]['id']}})['then'](handleEntityNotFound(_0x1863b2,null))[_0x0693('0x23')](saveUpdates(_0x15aedc[_0x0693('0x47')],null))['then'](respondWithResult(_0x1863b2,null))['catch'](handleError(_0x1863b2,null));};exports[_0x0693('0x24')]=function(_0x3b2108,_0x3ca0cb){return db[_0x0693('0x2b')]['find']({'where':{'id':_0x3b2108[_0x0693('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ca0cb,null))[_0x0693('0x23')](removeEntity(_0x3ca0cb,null))[_0x0693('0x45')](handleError(_0x3ca0cb,null));};exports[_0x0693('0x49')]=function(_0x1c3317,_0x35488e,_0x11db39){var _0x204230={};var _0x46b49f={};var _0x2c7f81;var _0x546ca4;return db['SugarcrmAccount'][_0x0693('0x4a')]({'where':{'id':_0x1c3317['params']['id']}})[_0x0693('0x23')](handleEntityNotFound(_0x35488e,null))[_0x0693('0x23')](function(_0x29a27d){if(_0x29a27d){_0x2c7f81=_0x29a27d;_0x46b49f['model']=_[_0x0693('0x2f')](db[_0x0693('0x4b')][_0x0693('0x2c')]);_0x46b49f['query']=_[_0x0693('0x2f')](_0x1c3317[_0x0693('0x30')]);_0x46b49f['filters']=_[_0x0693('0x31')](_0x46b49f[_0x0693('0x32')],_0x46b49f[_0x0693('0x30')]);_0x204230[_0x0693('0x33')]=_[_0x0693('0x31')](_0x46b49f['model'],qs[_0x0693('0x34')](_0x1c3317[_0x0693('0x30')]['fields']));_0x204230[_0x0693('0x33')]=_0x204230[_0x0693('0x33')][_0x0693('0x35')]?_0x204230[_0x0693('0x33')]:_0x46b49f['model'];_0x204230['order']=qs[_0x0693('0x4c')](_0x1c3317[_0x0693('0x30')][_0x0693('0x4c')]);_0x204230[_0x0693('0x38')]=qs[_0x0693('0x39')](_[_0x0693('0x4d')](_0x1c3317[_0x0693('0x30')],_0x46b49f[_0x0693('0x39')]));if(_0x1c3317[_0x0693('0x30')][_0x0693('0x3a')]){_0x204230[_0x0693('0x38')]=_[_0x0693('0x3b')](_0x204230[_0x0693('0x38')],{'$or':_[_0x0693('0x2a')](_0x204230[_0x0693('0x33')],function(_0x56e47f){var _0x4ff6a5={};_0x4ff6a5[_0x56e47f]={'$like':'%'+_0x1c3317['query'][_0x0693('0x3a')]+'%'};return _0x4ff6a5;})});}_0x204230=_['merge']({},_0x204230,_0x1c3317['options']);return _0x2c7f81['getConfigurations'](_0x204230);}})[_0x0693('0x23')](function(_0xf148c2){if(_0xf148c2){_0x546ca4=_0xf148c2[_0x0693('0x35')];if(!_0x1c3317[_0x0693('0x30')][_0x0693('0x4e')](_0x0693('0x36'))){_0x204230['limit']=qs[_0x0693('0x1c')](_0x1c3317[_0x0693('0x30')][_0x0693('0x1c')]);_0x204230[_0x0693('0x1a')]=qs[_0x0693('0x1a')](_0x1c3317['query'][_0x0693('0x1a')]);}return _0x2c7f81[_0x0693('0x49')](_0x204230);}})[_0x0693('0x23')](function(_0x597375){if(_0x597375){return _0x597375?{'count':_0x546ca4,'rows':_0x597375}:null;}})[_0x0693('0x23')](respondWithResult(_0x35488e,null))[_0x0693('0x45')](handleError(_0x35488e,null));};exports[_0x0693('0x4f')]=function(_0x3fa012,_0x50972c,_0x1504b5){if(_0x3fa012['body']['id']){delete _0x3fa012[_0x0693('0x47')]['id'];}return db[_0x0693('0x2b')][_0x0693('0x4a')]({'where':{'id':_0x3fa012[_0x0693('0x43')]['id']}})['then'](handleEntityNotFound(_0x50972c,null))['then'](function(_0x2dd612){if(_0x2dd612){_0x3fa012['body']['AccountId']=_0x2dd612['id'];_0x3fa012[_0x0693('0x47')]['Subjects']=integrations[_0x0693('0x50')](_0x3fa012[_0x0693('0x47')][_0x0693('0x51')],_0x3fa012['body'][_0x0693('0x2e')]);_0x3fa012[_0x0693('0x47')][_0x0693('0x52')]=integrations[_0x0693('0x53')](_0x3fa012[_0x0693('0x47')]['channel'],_0x3fa012[_0x0693('0x47')][_0x0693('0x2e')]);return db[_0x0693('0x4b')][_0x0693('0x46')](_0x3fa012[_0x0693('0x47')],{'include':[{'model':db[_0x0693('0x54')],'as':_0x0693('0x55')},{'model':db[_0x0693('0x54')],'as':_0x0693('0x52')}]});}return null;})[_0x0693('0x23')](respondWithResult(_0x50972c,null))[_0x0693('0x45')](handleError(_0x50972c,null));};exports['getFields']=function(_0x41f344,_0x43d193,_0x308f0f){var _0x298b26='';var _0x463ade=['id',_0x0693('0x27'),_0x0693('0x56'),_0x0693('0x57'),_0x0693('0x58'),_0x0693('0x59'),_0x0693('0x5a'),_0x0693('0x5b'),_0x0693('0x5c'),_0x0693('0x5d'),_0x0693('0x5e'),_0x0693('0x5f')];return db[_0x0693('0x2b')][_0x0693('0x4a')]({'where':{'id':_0x41f344[_0x0693('0x43')]['id']},'attributes':['id',_0x0693('0x60'),'password',_0x0693('0x61')]})['then'](handleEntityNotFound(_0x43d193,null))['then'](function(_0x899ed3){if(_0x899ed3){_0x298b26=_0x899ed3[_0x0693('0x61')];var _0x330990=_0x298b26[_0x0693('0x62')](-0x1);if(_0x330990==='/'){_0x298b26=_0x298b26[_0x0693('0x63')](0x0,_0x298b26[_0x0693('0x64')](_0x330990));}return rp({'method':_0x0693('0x65'),'uri':util[_0x0693('0x66')]('%s%s',_0x298b26,_0x0693('0x67')),'json':!![],'form':{'method':_0x0693('0x68'),'input_type':_0x0693('0x69'),'response_type':_0x0693('0x69'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x899ed3[_0x0693('0x60')],'password':_0x899ed3[_0x0693('0x6a')],'encryption':_0x0693('0x6b')},'application':_0x0693('0x6c')})}});}})[_0x0693('0x23')](function(_0x102e59){if(_0x102e59&&_0x102e59[_0x0693('0x27')]!==_0x0693('0x6d')&&_0x102e59[_0x0693('0x27')]!==_0x0693('0x6e')){return rp({'method':_0x0693('0x65'),'uri':util[_0x0693('0x66')](_0x0693('0x6f'),_0x298b26,_0x0693('0x67')),'json':!![],'form':{'method':'get_module_fields','input_type':_0x0693('0x69'),'response_type':'JSON','rest_data':JSON[_0x0693('0x70')]({'session':_0x102e59['id'],'module_name':'Calls'})}})[_0x0693('0x23')](function(_0x2e24dd){if(_0x2e24dd){var _0x24e3d4=_[_0x0693('0x71')](_0x2e24dd['module_fields']);_[_0x0693('0x72')](_0x24e3d4,function(_0x1dbee7){return _0x463ade[_0x0693('0x73')](_0x1dbee7[_0x0693('0x27')]);});return{'count':_0x24e3d4['length'],'rows':_[_0x0693('0x2a')](_0x24e3d4,function(_0x3b7548){return{'id':_0x3b7548[_0x0693('0x27')],'name':_0x3b7548[_0x0693('0x74')],'custom':_[_0x0693('0x75')](_0x3b7548[_0x0693('0x27')],'_c')?!![]:![],'options':_0x3b7548[_0x0693('0x3d')]?_[_0x0693('0x2a')](_[_0x0693('0x71')](_0x3b7548[_0x0693('0x3d')]),function(_0x12711d){return{'name':_0x12711d[_0x0693('0x76')],'value':_0x12711d[_0x0693('0x27')]};}):[]};})};}})[_0x0693('0x23')](respondWithResult(_0x43d193,null))[_0x0693('0x45')](function(_0x3b6748){var _0x3eec4b=_0x41f344[_0x0693('0x30')]['test']?0x1f4:_0x3b6748[_0x0693('0x77')]||0x1f4;logger[_0x0693('0x78')](_0x0693('0x79'),'getFields',_0x3eec4b,JSON[_0x0693('0x70')](_0x3b6748));delete _0x3b6748['name'];if(_0x3eec4b===0x191){_0x3eec4b=0x190;}_0x43d193['status'](_0x3eec4b)['send'](_0x41f344['query'][_0x0693('0x7a')]?{'message':_0x0693('0x7b'),'statusCode':_0x3b6748[_0x0693('0x77')]}:_0x3b6748);});}else{var _0xe834d6=0x1f4;_0x43d193[_0x0693('0x19')](_0xe834d6)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index a113c1e..863e32f 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 _0xb1ee=['rimraf','../../config/environment','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3be4b5,_0x50104f){var _0xd54c23=function(_0x24c7a8){while(--_0x24c7a8){_0x3be4b5['push'](_0x3be4b5['shift']());}};_0xd54c23(++_0x50104f);}(_0xb1ee,0x11e));var _0xeb1e=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xb1ee[_0x154192];return _0x3c2792;};'use strict';var _=require(_0xeb1e('0x0'));var util=require(_0xeb1e('0x1'));var logger=require(_0xeb1e('0x2'))(_0xeb1e('0x3'));var moment=require(_0xeb1e('0x4'));var BPromise=require(_0xeb1e('0x5'));var rp=require(_0xeb1e('0x6'));var fs=require('fs');var path=require(_0xeb1e('0x7'));var rimraf=require(_0xeb1e('0x8'));var config=require(_0xeb1e('0x9'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xeb1e('0xa'));module[_0xeb1e('0xb')]=function(_0x4ada2d,_0x1d5d7f){return _0x4ada2d[_0xeb1e('0xc')]('SugarcrmAccount',attributes,{'tableName':_0xeb1e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6606=['moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports','SugarcrmAccount','lodash','util','../../config/logger','api'];(function(_0x55cf05,_0x5c0dae){var _0x553ed1=function(_0xd75d12){while(--_0xd75d12){_0x55cf05['push'](_0x55cf05['shift']());}};_0x553ed1(++_0x5c0dae);}(_0x6606,0x6a));var _0x6660=function(_0x5611b6,_0x2fac5f){_0x5611b6=_0x5611b6-0x0;var _0x34754a=_0x6606[_0x5611b6];return _0x34754a;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var logger=require(_0x6660('0x2'))(_0x6660('0x3'));var moment=require(_0x6660('0x4'));var BPromise=require(_0x6660('0x5'));var rp=require(_0x6660('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6660('0x7'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x6660('0x8'));module[_0x6660('0x9')]=function(_0x416f45,_0x1f00b1){return _0x416f45['define'](_0x6660('0xa'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 7b3bc09..fb6f2a6 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 _0x5b18=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetSugarcrmAccount','options','raw','include','map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x41f023,_0x256f0c){var _0x3d8bd5=function(_0x5bb741){while(--_0x5bb741){_0x41f023['push'](_0x41f023['shift']());}};_0x3d8bd5(++_0x256f0c);}(_0x5b18,0xae));var _0x85b1=function(_0x2b8a92,_0x192f64){_0x2b8a92=_0x2b8a92-0x0;var _0x31f0da=_0x5b18[_0x2b8a92];return _0x31f0da;};'use strict';var _=require('lodash');var util=require(_0x85b1('0x0'));var moment=require('moment');var BPromise=require(_0x85b1('0x1'));var rs=require(_0x85b1('0x2'));var fs=require('fs');var Redis=require(_0x85b1('0x3'));var db=require(_0x85b1('0x4'))['db'];var utils=require(_0x85b1('0x5'));var logger=require(_0x85b1('0x6'))(_0x85b1('0x7'));var config=require(_0x85b1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x85b1('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3730a9,_0x34f571,_0x525ccf){return new BPromise(function(_0x1f22f4,_0x4d9d8e){return client[_0x85b1('0xa')](_0x3730a9,_0x525ccf)[_0x85b1('0xb')](function(_0x1498e8){logger['info'](_0x85b1('0xc'),_0x34f571,_0x85b1('0xd'));logger[_0x85b1('0xe')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x34f571,_0x85b1('0xd'),JSON[_0x85b1('0xf')](_0x1498e8));if(_0x1498e8['error']){if(_0x1498e8[_0x85b1('0x10')][_0x85b1('0x11')]===0x1f4){logger[_0x85b1('0x10')]('SugarcrmAccount,\x20%s,\x20%s',_0x34f571,_0x1498e8[_0x85b1('0x10')][_0x85b1('0x12')]);return _0x4d9d8e(_0x1498e8['error'][_0x85b1('0x12')]);}logger[_0x85b1('0x10')](_0x85b1('0xc'),_0x34f571,_0x1498e8[_0x85b1('0x10')]['message']);return _0x1f22f4(_0x1498e8[_0x85b1('0x10')][_0x85b1('0x12')]);}else{logger[_0x85b1('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x34f571,_0x85b1('0xd'));_0x1f22f4(_0x1498e8[_0x85b1('0x14')][_0x85b1('0x12')]);}})[_0x85b1('0x15')](function(_0x44c08d){logger[_0x85b1('0x10')](_0x85b1('0xc'),_0x34f571,_0x44c08d);_0x4d9d8e(_0x44c08d);});});}exports[_0x85b1('0x16')]=function(_0x297f00){var _0x4d0150=this;return new Promise(function(_0x3a8af3,_0x51ce82){return db['SugarcrmAccount']['findAll']({'raw':_0x297f00[_0x85b1('0x17')]?_0x297f00[_0x85b1('0x17')][_0x85b1('0x18')]===undefined?!![]:![]:!![],'where':_0x297f00[_0x85b1('0x17')]?_0x297f00[_0x85b1('0x17')]['where']||null:null,'attributes':_0x297f00[_0x85b1('0x17')]?_0x297f00['options']['attributes']||null:null,'limit':_0x297f00['options']?_0x297f00[_0x85b1('0x17')]['limit']||null:null,'include':_0x297f00[_0x85b1('0x17')]?_0x297f00[_0x85b1('0x17')][_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x297f00['options']['include'],function(_0x3504df){return{'model':db[_0x3504df[_0x85b1('0x1b')]],'as':_0x3504df['as'],'attributes':_0x3504df[_0x85b1('0x1c')],'include':_0x3504df[_0x85b1('0x19')]?_['map'](_0x3504df[_0x85b1('0x19')],function(_0x36ac55){return{'model':db[_0x36ac55[_0x85b1('0x1b')]],'as':_0x36ac55['as'],'attributes':_0x36ac55[_0x85b1('0x1c')],'include':_0x36ac55[_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x36ac55[_0x85b1('0x19')],function(_0x5840df){return{'model':db[_0x5840df[_0x85b1('0x1b')]],'as':_0x5840df['as'],'attributes':_0x5840df['attributes']};}):[]};}):[]};}):[]:[]})[_0x85b1('0xb')](function(_0x4b518c){logger['info'](_0x85b1('0x16'),_0x297f00);logger[_0x85b1('0xe')](_0x85b1('0x16'),_0x297f00,JSON[_0x85b1('0xf')](_0x4b518c));_0x3a8af3(_0x4b518c);})[_0x85b1('0x15')](function(_0x4bf7fa){logger[_0x85b1('0x10')](_0x85b1('0x16'),_0x4bf7fa[_0x85b1('0x12')],_0x297f00);_0x51ce82(_0x4d0150[_0x85b1('0x10')](0x1f4,_0x4bf7fa[_0x85b1('0x12')]));});});};exports[_0x85b1('0x1d')]=function(_0x3f7bf3){var _0xc159bc=this;return new Promise(function(_0x593353,_0xdc280e){return db[_0x85b1('0x1e')]['find']({'raw':_0x3f7bf3['options']?_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x18')]===undefined?!![]:![]:!![],'where':_0x3f7bf3[_0x85b1('0x17')]?_0x3f7bf3[_0x85b1('0x17')]['where']||null:null,'attributes':_0x3f7bf3[_0x85b1('0x17')]?_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x1c')]||null:null,'include':_0x3f7bf3[_0x85b1('0x17')]?_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x3f7bf3[_0x85b1('0x17')][_0x85b1('0x19')],function(_0x2c9722){return{'model':db[_0x2c9722['model']],'as':_0x2c9722['as'],'attributes':_0x2c9722['attributes'],'include':_0x2c9722[_0x85b1('0x19')]?_[_0x85b1('0x1a')](_0x2c9722[_0x85b1('0x19')],function(_0xe2ac){return{'model':db[_0xe2ac[_0x85b1('0x1b')]],'as':_0xe2ac['as'],'attributes':_0xe2ac[_0x85b1('0x1c')],'include':_0xe2ac['include']?_['map'](_0xe2ac[_0x85b1('0x19')],function(_0xc964b2){return{'model':db[_0xc964b2['model']],'as':_0xc964b2['as'],'attributes':_0xc964b2[_0x85b1('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x541e00){logger[_0x85b1('0x13')](_0x85b1('0x1d'),_0x3f7bf3);logger['debug'](_0x85b1('0x1d'),_0x3f7bf3,JSON['stringify'](_0x541e00));_0x593353(_0x541e00);})[_0x85b1('0x15')](function(_0x81425e){logger[_0x85b1('0x10')]('ShowSugarcrmAccount',_0x81425e[_0x85b1('0x12')],_0x3f7bf3);_0xdc280e(_0xc159bc[_0x85b1('0x10')](0x1f4,_0x81425e[_0x85b1('0x12')]));});});}; \ No newline at end of file +var _0x29d8=['where','attributes','include','map','model','then','raw','ShowSugarcrmAccount','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options'];(function(_0x4d9799,_0x136a37){var _0x5abd14=function(_0x65ae56){while(--_0x65ae56){_0x4d9799['push'](_0x4d9799['shift']());}};_0x5abd14(++_0x136a37);}(_0x29d8,0x1b9));var _0x829d=function(_0x234c59,_0x45874c){_0x234c59=_0x234c59-0x0;var _0x4fe3a2=_0x29d8[_0x234c59];return _0x4fe3a2;};'use strict';var _=require(_0x829d('0x0'));var util=require(_0x829d('0x1'));var moment=require(_0x829d('0x2'));var BPromise=require(_0x829d('0x3'));var rs=require(_0x829d('0x4'));var fs=require('fs');var Redis=require(_0x829d('0x5'));var db=require(_0x829d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x829d('0x7'))(_0x829d('0x8'));var config=require(_0x829d('0x9'));var jayson=require(_0x829d('0xa'));var client=jayson[_0x829d('0xb')][_0x829d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x436600,_0x4afc0a,_0x2e51a7){return new BPromise(function(_0x30bf3d,_0x37c419){return client['request'](_0x436600,_0x2e51a7)['then'](function(_0x218f0a){logger[_0x829d('0xd')](_0x829d('0xe'),_0x4afc0a,_0x829d('0xf'));logger[_0x829d('0x10')](_0x829d('0x11'),_0x4afc0a,_0x829d('0xf'),JSON[_0x829d('0x12')](_0x218f0a));if(_0x218f0a[_0x829d('0x13')]){if(_0x218f0a['error'][_0x829d('0x14')]===0x1f4){logger['error'](_0x829d('0xe'),_0x4afc0a,_0x218f0a[_0x829d('0x13')][_0x829d('0x15')]);return _0x37c419(_0x218f0a[_0x829d('0x13')][_0x829d('0x15')]);}logger[_0x829d('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x4afc0a,_0x218f0a[_0x829d('0x13')][_0x829d('0x15')]);return _0x30bf3d(_0x218f0a['error'][_0x829d('0x15')]);}else{logger['info'](_0x829d('0xe'),_0x4afc0a,'request\x20sent');_0x30bf3d(_0x218f0a[_0x829d('0x16')][_0x829d('0x15')]);}})['catch'](function(_0x2d248c){logger[_0x829d('0x13')]('SugarcrmAccount,\x20%s,\x20%s',_0x4afc0a,_0x2d248c);_0x37c419(_0x2d248c);});});}exports[_0x829d('0x17')]=function(_0x59cd33){var _0x3af7dc=this;return new Promise(function(_0x2c4937,_0x4954a0){return db[_0x829d('0x18')][_0x829d('0x19')]({'raw':_0x59cd33['options']?_0x59cd33[_0x829d('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x59cd33[_0x829d('0x1a')]?_0x59cd33[_0x829d('0x1a')][_0x829d('0x1b')]||null:null,'attributes':_0x59cd33['options']?_0x59cd33[_0x829d('0x1a')][_0x829d('0x1c')]||null:null,'limit':_0x59cd33[_0x829d('0x1a')]?_0x59cd33['options']['limit']||null:null,'include':_0x59cd33[_0x829d('0x1a')]?_0x59cd33[_0x829d('0x1a')][_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x59cd33['options'][_0x829d('0x1d')],function(_0x16e6d3){return{'model':db[_0x16e6d3[_0x829d('0x1f')]],'as':_0x16e6d3['as'],'attributes':_0x16e6d3[_0x829d('0x1c')],'include':_0x16e6d3[_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x16e6d3['include'],function(_0x569b9c){return{'model':db[_0x569b9c[_0x829d('0x1f')]],'as':_0x569b9c['as'],'attributes':_0x569b9c[_0x829d('0x1c')],'include':_0x569b9c['include']?_[_0x829d('0x1e')](_0x569b9c[_0x829d('0x1d')],function(_0x4aeec9){return{'model':db[_0x4aeec9[_0x829d('0x1f')]],'as':_0x4aeec9['as'],'attributes':_0x4aeec9[_0x829d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x829d('0x20')](function(_0x6bbd4c){logger[_0x829d('0xd')](_0x829d('0x17'),_0x59cd33);logger[_0x829d('0x10')](_0x829d('0x17'),_0x59cd33,JSON[_0x829d('0x12')](_0x6bbd4c));_0x2c4937(_0x6bbd4c);})['catch'](function(_0x4f4291){logger[_0x829d('0x13')]('GetSugarcrmAccount',_0x4f4291[_0x829d('0x15')],_0x59cd33);_0x4954a0(_0x3af7dc[_0x829d('0x13')](0x1f4,_0x4f4291[_0x829d('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x334690){var _0x3f07c6=this;return new Promise(function(_0x3ff7e3,_0x1f0b61){return db[_0x829d('0x18')]['find']({'raw':_0x334690[_0x829d('0x1a')]?_0x334690[_0x829d('0x1a')][_0x829d('0x21')]===undefined?!![]:![]:!![],'where':_0x334690[_0x829d('0x1a')]?_0x334690['options']['where']||null:null,'attributes':_0x334690['options']?_0x334690[_0x829d('0x1a')][_0x829d('0x1c')]||null:null,'include':_0x334690[_0x829d('0x1a')]?_0x334690[_0x829d('0x1a')][_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x334690[_0x829d('0x1a')][_0x829d('0x1d')],function(_0x25f625){return{'model':db[_0x25f625[_0x829d('0x1f')]],'as':_0x25f625['as'],'attributes':_0x25f625['attributes'],'include':_0x25f625[_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x25f625[_0x829d('0x1d')],function(_0x111e10){return{'model':db[_0x111e10[_0x829d('0x1f')]],'as':_0x111e10['as'],'attributes':_0x111e10[_0x829d('0x1c')],'include':_0x111e10[_0x829d('0x1d')]?_[_0x829d('0x1e')](_0x111e10['include'],function(_0x4c69b3){return{'model':db[_0x4c69b3[_0x829d('0x1f')]],'as':_0x4c69b3['as'],'attributes':_0x4c69b3[_0x829d('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x829d('0x20')](function(_0x28842a){logger['info'](_0x829d('0x22'),_0x334690);logger[_0x829d('0x10')](_0x829d('0x22'),_0x334690,JSON[_0x829d('0x12')](_0x28842a));_0x3ff7e3(_0x28842a);})[_0x829d('0x23')](function(_0x1f63e8){logger[_0x829d('0x13')](_0x829d('0x22'),_0x1f63e8['message'],_0x334690);_0x1f0b61(_0x3f07c6[_0x829d('0x13')](0x1f4,_0x1f63e8[_0x829d('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 93d1fa6..cda5de7 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 _0xcad5=['get','/:id','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated'];(function(_0xea0aa9,_0x9ab95d){var _0x521e76=function(_0x14e30a){while(--_0x14e30a){_0xea0aa9['push'](_0xea0aa9['shift']());}};_0x521e76(++_0x9ab95d);}(_0xcad5,0xd0));var _0x5cad=function(_0x47a3ef,_0x3e140d){_0x47a3ef=_0x47a3ef-0x0;var _0x18913c=_0xcad5[_0x47a3ef];return _0x18913c;};'use strict';var multer=require(_0x5cad('0x0'));var util=require('util');var path=require(_0x5cad('0x1'));var timeout=require(_0x5cad('0x2'));var express=require(_0x5cad('0x3'));var router=express['Router']();var fs_extra=require(_0x5cad('0x4'));var auth=require(_0x5cad('0x5'));var interaction=require(_0x5cad('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmConfiguration.controller');router['get']('/',auth[_0x5cad('0x7')](),controller['index']);router[_0x5cad('0x8')](_0x5cad('0x9'),auth[_0x5cad('0x7')](),controller['show']);router[_0x5cad('0x8')]('/:id/fields',auth[_0x5cad('0x7')](),controller['getFields']);router[_0x5cad('0x8')](_0x5cad('0xa'),auth[_0x5cad('0x7')](),controller[_0x5cad('0xb')]);router[_0x5cad('0x8')](_0x5cad('0xc'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0x5cad('0xd')]('/',auth[_0x5cad('0x7')](),controller['create']);router[_0x5cad('0xe')](_0x5cad('0x9'),auth['isAuthenticated'](),controller[_0x5cad('0xf')]);router[_0x5cad('0x10')](_0x5cad('0x9'),auth[_0x5cad('0x7')](),controller['destroy']);module[_0x5cad('0x11')]=router; \ No newline at end of file +var _0xa5fd=['/:id','isAuthenticated','show','getFields','getSubjects','getDescriptions','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intSugarcrmConfiguration.controller','get'];(function(_0x5525a7,_0x3437c2){var _0x3503dc=function(_0x1cebca){while(--_0x1cebca){_0x5525a7['push'](_0x5525a7['shift']());}};_0x3503dc(++_0x3437c2);}(_0xa5fd,0x186));var _0xda5f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa5fd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xda5f('0x0'));var util=require('util');var path=require(_0xda5f('0x1'));var timeout=require(_0xda5f('0x2'));var express=require(_0xda5f('0x3'));var router=express[_0xda5f('0x4')]();var fs_extra=require(_0xda5f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xda5f('0x6'));var config=require('../../config/environment');var controller=require(_0xda5f('0x7'));router[_0xda5f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xda5f('0x8')](_0xda5f('0x9'),auth[_0xda5f('0xa')](),controller[_0xda5f('0xb')]);router[_0xda5f('0x8')]('/:id/fields',auth[_0xda5f('0xa')](),controller[_0xda5f('0xc')]);router[_0xda5f('0x8')]('/:id/subjects',auth[_0xda5f('0xa')](),controller[_0xda5f('0xd')]);router[_0xda5f('0x8')]('/:id/descriptions',auth[_0xda5f('0xa')](),controller[_0xda5f('0xe')]);router[_0xda5f('0xf')]('/',auth[_0xda5f('0xa')](),controller[_0xda5f('0x10')]);router['put']('/:id',auth[_0xda5f('0xa')](),controller[_0xda5f('0x11')]);router[_0xda5f('0x12')](_0xda5f('0x9'),auth[_0xda5f('0xa')](),controller[_0xda5f('0x13')]);module[_0xda5f('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 e81a58a..fa3555a 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 _0x1849=['sequelize','STRING'];(function(_0x13a11a,_0x42e711){var _0x27eb84=function(_0x104f14){while(--_0x104f14){_0x13a11a['push'](_0x13a11a['shift']());}};_0x27eb84(++_0x42e711);}(_0x1849,0xb4));var _0x9184=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x1849[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x9184('0x0'));module['exports']={'name':{'type':Sequelize[_0x9184('0x1')]},'description':{'type':Sequelize[_0x9184('0x1')]}}; \ No newline at end of file +var _0x642d=['sequelize','exports','STRING'];(function(_0x489806,_0x3cee0f){var _0x126746=function(_0x2edc62){while(--_0x2edc62){_0x489806['push'](_0x489806['shift']());}};_0x126746(++_0x3cee0f);}(_0x642d,0x1b3));var _0xd642=function(_0x129621,_0x1e4291){_0x129621=_0x129621-0x0;var _0xa472d2=_0x642d[_0x129621];return _0xa472d2;};'use strict';var Sequelize=require(_0xd642('0x0'));module[_0xd642('0x1')]={'name':{'type':Sequelize[_0xd642('0x2')]},'description':{'type':Sequelize[_0xd642('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 83409cc..73005f0 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 _0x12b3=['undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','map','fieldName','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','SugarcrmConfiguration','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','rimraf','zip-dir','request-promise','moment','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset'];(function(_0x47e5d1,_0x162daa){var _0x879f78=function(_0xc15a64){while(--_0xc15a64){_0x47e5d1['push'](_0x47e5d1['shift']());}};_0x879f78(++_0x162daa);}(_0x12b3,0x87));var _0x312b=function(_0x1e82c7,_0x4468be){_0x1e82c7=_0x1e82c7-0x0;var _0x59eecf=_0x12b3[_0x1e82c7];return _0x59eecf;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x312b('0x0'));var zipdir=require(_0x312b('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x312b('0x2'));var moment=require(_0x312b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x312b('0x4'));var util=require(_0x312b('0x5'));var path=require(_0x312b('0x6'));var sox=require(_0x312b('0x7'));var csv=require('to-csv');var ejs=require(_0x312b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x312b('0x9'));var squel=require(_0x312b('0xa'));var crypto=require(_0x312b('0xb'));var jsforce=require(_0x312b('0xc'));var deskjs=require(_0x312b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x312b('0xe'));var Papa=require(_0x312b('0xf'));var Redis=require(_0x312b('0x10'));var authService=require(_0x312b('0x11'));var qs=require(_0x312b('0x12'));var as=require(_0x312b('0x13'));var hardwareService=require(_0x312b('0x14'));var logger=require(_0x312b('0x15'))(_0x312b('0x16'));var utils=require(_0x312b('0x17'));var config=require(_0x312b('0x18'));var licenseUtil=require(_0x312b('0x19'));var db=require(_0x312b('0x1a'))['db'];function respondWithStatusCode(_0x4bfcc1,_0x1af96d){_0x1af96d=_0x1af96d||0xcc;return function(_0x2e7341){if(_0x2e7341){return _0x4bfcc1[_0x312b('0x1b')](_0x1af96d);}return _0x4bfcc1[_0x312b('0x1c')](_0x1af96d)['end']();};}function respondWithResult(_0x55cb47,_0x255cb3){_0x255cb3=_0x255cb3||0xc8;return function(_0x5b0722){if(_0x5b0722){return _0x55cb47['status'](_0x255cb3)[_0x312b('0x1d')](_0x5b0722);}};}function respondWithFilteredResult(_0x46bd53,_0x2cd0c7){return function(_0x41080e){if(_0x41080e){var _0x1ddb82=typeof _0x2cd0c7[_0x312b('0x1e')]===_0x312b('0x1f')&&typeof _0x2cd0c7[_0x312b('0x20')]===_0x312b('0x1f');var _0x5eb11b=_0x41080e[_0x312b('0x21')];var _0x51df45=_0x1ddb82?0x0:_0x2cd0c7[_0x312b('0x1e')];var _0x2aee86=_0x1ddb82?_0x41080e['count']:_0x2cd0c7[_0x312b('0x1e')]+_0x2cd0c7[_0x312b('0x20')];var _0x253e6b;if(_0x2aee86>=_0x5eb11b){_0x2aee86=_0x5eb11b;_0x253e6b=0xc8;}else{_0x253e6b=0xce;}_0x46bd53[_0x312b('0x1c')](_0x253e6b);return _0x46bd53['set'](_0x312b('0x22'),_0x51df45+'-'+_0x2aee86+'/'+_0x5eb11b)[_0x312b('0x1d')](_0x41080e);}return null;};}function patchUpdates(_0xe8f837){return function(_0xd3db51){try{jsonpatch[_0x312b('0x23')](_0xd3db51,_0xe8f837,!![]);}catch(_0x536cfe){return BPromise[_0x312b('0x24')](_0x536cfe);}return _0xd3db51[_0x312b('0x25')]();};}function saveUpdates(_0x491531,_0x559b5d){return function(_0x2b6573){if(_0x2b6573){return _0x2b6573[_0x312b('0x26')](_0x491531)[_0x312b('0x27')](function(_0x4c7a17){return _0x4c7a17;});}return null;};}function removeEntity(_0x45f24d,_0x3167d8){return function(_0xd9ea96){if(_0xd9ea96){return _0xd9ea96[_0x312b('0x28')]()[_0x312b('0x27')](function(){_0x45f24d[_0x312b('0x1c')](0xcc)[_0x312b('0x29')]();});}};}function handleEntityNotFound(_0x2a61e4,_0x548c17){return function(_0x42f886){if(!_0x42f886){_0x2a61e4['sendStatus'](0x194);}return _0x42f886;};}function handleError(_0x275432,_0x5f1451){_0x5f1451=_0x5f1451||0x1f4;return function(_0xbe56a1){logger[_0x312b('0x2a')](_0xbe56a1[_0x312b('0x2b')]);if(_0xbe56a1[_0x312b('0x2c')]){delete _0xbe56a1[_0x312b('0x2c')];}_0x275432[_0x312b('0x1c')](_0x5f1451)[_0x312b('0x2d')](_0xbe56a1);};}exports['index']=function(_0x5148bd,_0x3eb363){var _0x56a5d0={},_0x2761c4={},_0x1f619e={'count':0x0,'rows':[]};var _0x17ea86=_[_0x312b('0x2e')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x250745){return{'name':_0x250745[_0x312b('0x2f')],'type':_0x250745['type']['key']};});_0x2761c4[_0x312b('0x30')]=_[_0x312b('0x2e')](_0x17ea86,_0x312b('0x2c'));_0x2761c4[_0x312b('0x31')]=_[_0x312b('0x32')](_0x5148bd[_0x312b('0x31')]);_0x2761c4['filters']=_[_0x312b('0x33')](_0x2761c4['model'],_0x2761c4[_0x312b('0x31')]);_0x56a5d0[_0x312b('0x34')]=_[_0x312b('0x33')](_0x2761c4[_0x312b('0x30')],qs[_0x312b('0x35')](_0x5148bd[_0x312b('0x31')][_0x312b('0x35')]));_0x56a5d0['attributes']=_0x56a5d0[_0x312b('0x34')][_0x312b('0x36')]?_0x56a5d0['attributes']:_0x2761c4[_0x312b('0x30')];if(!_0x5148bd[_0x312b('0x31')][_0x312b('0x37')](_0x312b('0x38'))){_0x56a5d0[_0x312b('0x20')]=qs['limit'](_0x5148bd['query'][_0x312b('0x20')]);_0x56a5d0[_0x312b('0x1e')]=qs['offset'](_0x5148bd[_0x312b('0x31')][_0x312b('0x1e')]);}_0x56a5d0[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x5148bd[_0x312b('0x31')][_0x312b('0x3a')]);_0x56a5d0[_0x312b('0x3b')]=qs['filters'](_[_0x312b('0x3c')](_0x5148bd[_0x312b('0x31')],_0x2761c4[_0x312b('0x3d')]),_0x17ea86);if(_0x5148bd['query'][_0x312b('0x3e')]){_0x56a5d0['where']=_[_0x312b('0x3f')](_0x56a5d0[_0x312b('0x3b')],{'$or':_[_0x312b('0x2e')](_0x17ea86,function(_0x5d23e6){if(_0x5d23e6[_0x312b('0x40')]!=='VIRTUAL'){var _0x289524={};_0x289524[_0x5d23e6[_0x312b('0x2c')]]={'$like':'%'+_0x5148bd[_0x312b('0x31')][_0x312b('0x3e')]+'%'};return _0x289524;}})});}_0x56a5d0=_[_0x312b('0x3f')]({},_0x56a5d0,_0x5148bd[_0x312b('0x41')]);var _0xe4dfc0={'where':_0x56a5d0[_0x312b('0x3b')]};return db[_0x312b('0x42')][_0x312b('0x21')](_0xe4dfc0)[_0x312b('0x27')](function(_0x506cb4){_0x1f619e['count']=_0x506cb4;if(_0x5148bd[_0x312b('0x31')][_0x312b('0x43')]){_0x56a5d0[_0x312b('0x44')]=[{'all':!![]}];}return db[_0x312b('0x42')][_0x312b('0x45')](_0x56a5d0);})['then'](function(_0x2f43e7){_0x1f619e[_0x312b('0x46')]=_0x2f43e7;return _0x1f619e;})[_0x312b('0x27')](respondWithFilteredResult(_0x3eb363,_0x56a5d0))[_0x312b('0x47')](handleError(_0x3eb363,null));};exports[_0x312b('0x48')]=function(_0x56b522,_0x102551){var _0xe077a0={'raw':![],'where':{'id':_0x56b522[_0x312b('0x49')]['id']}},_0x46fb28={};_0x46fb28['model']=_[_0x312b('0x32')](db[_0x312b('0x42')][_0x312b('0x4a')]);_0x46fb28['query']=_[_0x312b('0x32')](_0x56b522[_0x312b('0x31')]);_0x46fb28[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x46fb28[_0x312b('0x30')],_0x46fb28[_0x312b('0x31')]);_0xe077a0[_0x312b('0x34')]=_[_0x312b('0x33')](_0x46fb28[_0x312b('0x30')],qs[_0x312b('0x35')](_0x56b522[_0x312b('0x31')][_0x312b('0x35')]));_0xe077a0[_0x312b('0x34')]=_0xe077a0['attributes'][_0x312b('0x36')]?_0xe077a0['attributes']:_0x46fb28['model'];if(_0x56b522[_0x312b('0x31')][_0x312b('0x43')]){_0xe077a0[_0x312b('0x44')]=[{'all':!![]}];}_0xe077a0=_[_0x312b('0x3f')]({},_0xe077a0,_0x56b522['options']);return db[_0x312b('0x42')][_0x312b('0x4b')](_0xe077a0)[_0x312b('0x27')](handleEntityNotFound(_0x102551,null))['then'](respondWithResult(_0x102551,null))[_0x312b('0x47')](handleError(_0x102551,null));};exports['create']=function(_0x5c48e1,_0x579b75){return db[_0x312b('0x42')][_0x312b('0x4c')](_0x5c48e1[_0x312b('0x4d')],{})['then'](respondWithResult(_0x579b75,0xc9))[_0x312b('0x47')](handleError(_0x579b75,null));};exports[_0x312b('0x26')]=function(_0x5199b9,_0x12230d){if(_0x5199b9[_0x312b('0x4d')]['id']){delete _0x5199b9[_0x312b('0x4d')]['id'];}return db[_0x312b('0x42')]['find']({'where':{'id':_0x5199b9[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x12230d,null))[_0x312b('0x27')](saveUpdates(_0x5199b9[_0x312b('0x4d')],null))[_0x312b('0x27')](respondWithResult(_0x12230d,null))[_0x312b('0x47')](handleError(_0x12230d,null));};exports[_0x312b('0x28')]=function(_0x3fc0c7,_0x25f8ea){return db[_0x312b('0x42')][_0x312b('0x4b')]({'where':{'id':_0x3fc0c7[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x25f8ea,null))['then'](removeEntity(_0x25f8ea,null))['catch'](handleError(_0x25f8ea,null));};exports[_0x312b('0x4e')]=function(_0x40ac98,_0x3e20c7,_0x5dbc19){var _0x3d758b={};var _0x75b539={};var _0x378311;var _0x417533;return db[_0x312b('0x42')][_0x312b('0x4f')]({'where':{'id':_0x40ac98[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x3e20c7,null))[_0x312b('0x27')](function(_0x4f7f1a){if(_0x4f7f1a){_0x378311=_0x4f7f1a;_0x75b539[_0x312b('0x30')]=_[_0x312b('0x32')](db[_0x312b('0x50')][_0x312b('0x4a')]);_0x75b539[_0x312b('0x31')]=_[_0x312b('0x32')](_0x40ac98[_0x312b('0x31')]);_0x75b539[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x75b539[_0x312b('0x30')],_0x75b539[_0x312b('0x31')]);_0x3d758b[_0x312b('0x34')]=_[_0x312b('0x33')](_0x75b539['model'],qs[_0x312b('0x35')](_0x40ac98[_0x312b('0x31')]['fields']));_0x3d758b[_0x312b('0x34')]=_0x3d758b['attributes']['length']?_0x3d758b[_0x312b('0x34')]:_0x75b539[_0x312b('0x30')];_0x3d758b[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x40ac98[_0x312b('0x31')][_0x312b('0x3a')]);_0x3d758b[_0x312b('0x3b')]=qs['filters'](_[_0x312b('0x3c')](_0x40ac98[_0x312b('0x31')],_0x75b539['filters']));if(_0x40ac98[_0x312b('0x31')][_0x312b('0x3e')]){_0x3d758b[_0x312b('0x3b')]=_[_0x312b('0x3f')](_0x3d758b['where'],{'$or':_[_0x312b('0x2e')](_0x3d758b[_0x312b('0x34')],function(_0x4611c6){var _0x4d4fa9={};_0x4d4fa9[_0x4611c6]={'$like':'%'+_0x40ac98['query'][_0x312b('0x3e')]+'%'};return _0x4d4fa9;})});}_0x3d758b=_[_0x312b('0x3f')]({},_0x3d758b,_0x40ac98['options']);return _0x378311['getFields'](_0x3d758b);}})[_0x312b('0x27')](function(_0x5ba24d){if(_0x5ba24d){_0x417533=_0x5ba24d['length'];if(!_0x40ac98[_0x312b('0x31')][_0x312b('0x37')](_0x312b('0x38'))){_0x3d758b[_0x312b('0x20')]=qs[_0x312b('0x20')](_0x40ac98['query'][_0x312b('0x20')]);_0x3d758b[_0x312b('0x1e')]=qs[_0x312b('0x1e')](_0x40ac98[_0x312b('0x31')][_0x312b('0x1e')]);}return _0x378311['getFields'](_0x3d758b);}})[_0x312b('0x27')](function(_0x7bbbb){if(_0x7bbbb){return _0x7bbbb?{'count':_0x417533,'rows':_0x7bbbb}:null;}})[_0x312b('0x27')](respondWithResult(_0x3e20c7,null))['catch'](handleError(_0x3e20c7,null));};exports[_0x312b('0x51')]=function(_0x5dd1d6,_0x268016,_0x3ac9bc){var _0x10e5dc={};var _0x2e6e96={};var _0x4df80e;var _0x51d72e;return db['SugarcrmConfiguration'][_0x312b('0x4f')]({'where':{'id':_0x5dd1d6[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x268016,null))['then'](function(_0xe2137a){if(_0xe2137a){_0x4df80e=_0xe2137a;_0x2e6e96[_0x312b('0x30')]=_['keys'](db[_0x312b('0x50')][_0x312b('0x4a')]);_0x2e6e96[_0x312b('0x31')]=_[_0x312b('0x32')](_0x5dd1d6[_0x312b('0x31')]);_0x2e6e96[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x2e6e96['model'],_0x2e6e96[_0x312b('0x31')]);_0x10e5dc[_0x312b('0x34')]=_[_0x312b('0x33')](_0x2e6e96[_0x312b('0x30')],qs['fields'](_0x5dd1d6[_0x312b('0x31')][_0x312b('0x35')]));_0x10e5dc[_0x312b('0x34')]=_0x10e5dc[_0x312b('0x34')][_0x312b('0x36')]?_0x10e5dc['attributes']:_0x2e6e96[_0x312b('0x30')];_0x10e5dc[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x5dd1d6[_0x312b('0x31')]['sort']);_0x10e5dc['where']=qs[_0x312b('0x3d')](_[_0x312b('0x3c')](_0x5dd1d6[_0x312b('0x31')],_0x2e6e96[_0x312b('0x3d')]));if(_0x5dd1d6['query'][_0x312b('0x3e')]){_0x10e5dc[_0x312b('0x3b')]=_['merge'](_0x10e5dc[_0x312b('0x3b')],{'$or':_[_0x312b('0x2e')](_0x10e5dc[_0x312b('0x34')],function(_0x1ecad1){var _0x3360c1={};_0x3360c1[_0x1ecad1]={'$like':'%'+_0x5dd1d6['query'][_0x312b('0x3e')]+'%'};return _0x3360c1;})});}_0x10e5dc=_['merge']({},_0x10e5dc,_0x5dd1d6[_0x312b('0x41')]);return _0x4df80e[_0x312b('0x51')](_0x10e5dc);}})[_0x312b('0x27')](function(_0x3ef022){if(_0x3ef022){_0x51d72e=_0x3ef022[_0x312b('0x36')];if(!_0x5dd1d6[_0x312b('0x31')]['hasOwnProperty'](_0x312b('0x38'))){_0x10e5dc[_0x312b('0x20')]=qs[_0x312b('0x20')](_0x5dd1d6[_0x312b('0x31')][_0x312b('0x20')]);_0x10e5dc['offset']=qs[_0x312b('0x1e')](_0x5dd1d6[_0x312b('0x31')][_0x312b('0x1e')]);}return _0x4df80e[_0x312b('0x51')](_0x10e5dc);}})[_0x312b('0x27')](function(_0x56d51b){if(_0x56d51b){return _0x56d51b?{'count':_0x51d72e,'rows':_0x56d51b}:null;}})['then'](respondWithResult(_0x268016,null))[_0x312b('0x47')](handleError(_0x268016,null));};exports[_0x312b('0x52')]=function(_0x4e7325,_0x3e5ebc,_0x3fd794){var _0x1e8558={};var _0x26db4b={};var _0x1567d6;var _0x3ee588;return db[_0x312b('0x42')][_0x312b('0x4f')]({'where':{'id':_0x4e7325[_0x312b('0x49')]['id']}})[_0x312b('0x27')](handleEntityNotFound(_0x3e5ebc,null))['then'](function(_0x5f544d){if(_0x5f544d){_0x1567d6=_0x5f544d;_0x26db4b['model']=_[_0x312b('0x32')](db[_0x312b('0x50')]['rawAttributes']);_0x26db4b['query']=_[_0x312b('0x32')](_0x4e7325[_0x312b('0x31')]);_0x26db4b[_0x312b('0x3d')]=_[_0x312b('0x33')](_0x26db4b['model'],_0x26db4b['query']);_0x1e8558[_0x312b('0x34')]=_[_0x312b('0x33')](_0x26db4b[_0x312b('0x30')],qs[_0x312b('0x35')](_0x4e7325[_0x312b('0x31')]['fields']));_0x1e8558['attributes']=_0x1e8558[_0x312b('0x34')][_0x312b('0x36')]?_0x1e8558[_0x312b('0x34')]:_0x26db4b[_0x312b('0x30')];_0x1e8558[_0x312b('0x39')]=qs[_0x312b('0x3a')](_0x4e7325[_0x312b('0x31')]['sort']);_0x1e8558[_0x312b('0x3b')]=qs[_0x312b('0x3d')](_[_0x312b('0x3c')](_0x4e7325[_0x312b('0x31')],_0x26db4b['filters']));if(_0x4e7325[_0x312b('0x31')][_0x312b('0x3e')]){_0x1e8558[_0x312b('0x3b')]=_['merge'](_0x1e8558[_0x312b('0x3b')],{'$or':_[_0x312b('0x2e')](_0x1e8558[_0x312b('0x34')],function(_0x3886e4){var _0x36aaac={};_0x36aaac[_0x3886e4]={'$like':'%'+_0x4e7325['query'][_0x312b('0x3e')]+'%'};return _0x36aaac;})});}_0x1e8558=_[_0x312b('0x3f')]({},_0x1e8558,_0x4e7325[_0x312b('0x41')]);return _0x1567d6[_0x312b('0x52')](_0x1e8558);}})[_0x312b('0x27')](function(_0x298407){if(_0x298407){_0x3ee588=_0x298407['length'];if(!_0x4e7325['query'][_0x312b('0x37')](_0x312b('0x38'))){_0x1e8558[_0x312b('0x20')]=qs['limit'](_0x4e7325['query'][_0x312b('0x20')]);_0x1e8558[_0x312b('0x1e')]=qs[_0x312b('0x1e')](_0x4e7325[_0x312b('0x31')][_0x312b('0x1e')]);}return _0x1567d6[_0x312b('0x52')](_0x1e8558);}})[_0x312b('0x27')](function(_0x4fc363){if(_0x4fc363){return _0x4fc363?{'count':_0x3ee588,'rows':_0x4fc363}:null;}})[_0x312b('0x27')](respondWithResult(_0x3e5ebc,null))['catch'](handleError(_0x3e5ebc,null));}; \ No newline at end of file +var _0x759c=['where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','find','create','body','findOne','SugarcrmField','getFields','getSubjects','order','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','../../config/logger','api','../../config/utils','../../mysqldb','status','end','limit','count','offset','Content-Range','json','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0xbece55,_0x5761e4){var _0x376eae=function(_0x5986bf){while(--_0x5986bf){_0xbece55['push'](_0xbece55['shift']());}};_0x376eae(++_0x5761e4);}(_0x759c,0x1b8));var _0xc759=function(_0x33dfe3,_0x1d0201){_0x33dfe3=_0x33dfe3-0x0;var _0xbd12e8=_0x759c[_0x33dfe3];return _0xbd12e8;};'use strict';var emlformat=require(_0xc759('0x0'));var rimraf=require(_0xc759('0x1'));var zipdir=require(_0xc759('0x2'));var jsonpatch=require(_0xc759('0x3'));var rp=require(_0xc759('0x4'));var moment=require(_0xc759('0x5'));var BPromise=require(_0xc759('0x6'));var Mustache=require(_0xc759('0x7'));var util=require(_0xc759('0x8'));var path=require('path');var sox=require(_0xc759('0x9'));var csv=require(_0xc759('0xa'));var ejs=require(_0xc759('0xb'));var fs=require('fs');var fs_extra=require(_0xc759('0xc'));var _=require('lodash');var squel=require(_0xc759('0xd'));var crypto=require(_0xc759('0xe'));var jsforce=require(_0xc759('0xf'));var deskjs=require(_0xc759('0x10'));var toCsv=require(_0xc759('0xa'));var querystring=require(_0xc759('0x11'));var Papa=require(_0xc759('0x12'));var Redis=require(_0xc759('0x13'));var authService=require(_0xc759('0x14'));var qs=require(_0xc759('0x15'));var as=require(_0xc759('0x16'));var hardwareService=require(_0xc759('0x17'));var logger=require(_0xc759('0x18'))(_0xc759('0x19'));var utils=require(_0xc759('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc759('0x1b'))['db'];function respondWithStatusCode(_0xb6b3bd,_0x34fedc){_0x34fedc=_0x34fedc||0xcc;return function(_0x321967){if(_0x321967){return _0xb6b3bd['sendStatus'](_0x34fedc);}return _0xb6b3bd[_0xc759('0x1c')](_0x34fedc)[_0xc759('0x1d')]();};}function respondWithResult(_0x475635,_0x3b2bba){_0x3b2bba=_0x3b2bba||0xc8;return function(_0x514ec6){if(_0x514ec6){return _0x475635[_0xc759('0x1c')](_0x3b2bba)['json'](_0x514ec6);}};}function respondWithFilteredResult(_0x50855e,_0x3d4eaf){return function(_0x441c12){if(_0x441c12){var _0x4d7ac5=typeof _0x3d4eaf['offset']==='undefined'&&typeof _0x3d4eaf[_0xc759('0x1e')]==='undefined';var _0x59cc90=_0x441c12[_0xc759('0x1f')];var _0x457c68=_0x4d7ac5?0x0:_0x3d4eaf['offset'];var _0x55a8ae=_0x4d7ac5?_0x441c12['count']:_0x3d4eaf[_0xc759('0x20')]+_0x3d4eaf[_0xc759('0x1e')];var _0x24f903;if(_0x55a8ae>=_0x59cc90){_0x55a8ae=_0x59cc90;_0x24f903=0xc8;}else{_0x24f903=0xce;}_0x50855e[_0xc759('0x1c')](_0x24f903);return _0x50855e['set'](_0xc759('0x21'),_0x457c68+'-'+_0x55a8ae+'/'+_0x59cc90)[_0xc759('0x22')](_0x441c12);}return null;};}function patchUpdates(_0x180f02){return function(_0x5a057e){try{jsonpatch[_0xc759('0x23')](_0x5a057e,_0x180f02,!![]);}catch(_0x46de0e){return BPromise[_0xc759('0x24')](_0x46de0e);}return _0x5a057e[_0xc759('0x25')]();};}function saveUpdates(_0x6b7500,_0x5eb855){return function(_0x5f2706){if(_0x5f2706){return _0x5f2706[_0xc759('0x26')](_0x6b7500)[_0xc759('0x27')](function(_0x3eeb5a){return _0x3eeb5a;});}return null;};}function removeEntity(_0x572040,_0xee6d3e){return function(_0x127329){if(_0x127329){return _0x127329[_0xc759('0x28')]()[_0xc759('0x27')](function(){_0x572040[_0xc759('0x1c')](0xcc)[_0xc759('0x1d')]();});}};}function handleEntityNotFound(_0x13465e,_0x255437){return function(_0x2f2cff){if(!_0x2f2cff){_0x13465e[_0xc759('0x29')](0x194);}return _0x2f2cff;};}function handleError(_0xb70aa1,_0x1bcca8){_0x1bcca8=_0x1bcca8||0x1f4;return function(_0x4bd7a0){logger[_0xc759('0x2a')](_0x4bd7a0[_0xc759('0x2b')]);if(_0x4bd7a0[_0xc759('0x2c')]){delete _0x4bd7a0['name'];}_0xb70aa1[_0xc759('0x1c')](_0x1bcca8)[_0xc759('0x2d')](_0x4bd7a0);};}exports[_0xc759('0x2e')]=function(_0x304db1,_0x595058){var _0x219a15={},_0x19c9d1={},_0x2a4714={'count':0x0,'rows':[]};var _0x8cd3c0=_[_0xc759('0x2f')](db[_0xc759('0x30')][_0xc759('0x31')],function(_0x35c015){return{'name':_0x35c015[_0xc759('0x32')],'type':_0x35c015[_0xc759('0x33')][_0xc759('0x34')]};});_0x19c9d1[_0xc759('0x35')]=_['map'](_0x8cd3c0,_0xc759('0x2c'));_0x19c9d1[_0xc759('0x36')]=_[_0xc759('0x37')](_0x304db1[_0xc759('0x36')]);_0x19c9d1[_0xc759('0x38')]=_[_0xc759('0x39')](_0x19c9d1['model'],_0x19c9d1[_0xc759('0x36')]);_0x219a15[_0xc759('0x3a')]=_[_0xc759('0x39')](_0x19c9d1[_0xc759('0x35')],qs[_0xc759('0x3b')](_0x304db1[_0xc759('0x36')]['fields']));_0x219a15[_0xc759('0x3a')]=_0x219a15['attributes'][_0xc759('0x3c')]?_0x219a15['attributes']:_0x19c9d1[_0xc759('0x35')];if(!_0x304db1[_0xc759('0x36')][_0xc759('0x3d')](_0xc759('0x3e'))){_0x219a15[_0xc759('0x1e')]=qs['limit'](_0x304db1['query'][_0xc759('0x1e')]);_0x219a15['offset']=qs['offset'](_0x304db1[_0xc759('0x36')]['offset']);}_0x219a15['order']=qs[_0xc759('0x3f')](_0x304db1[_0xc759('0x36')][_0xc759('0x3f')]);_0x219a15[_0xc759('0x40')]=qs[_0xc759('0x38')](_[_0xc759('0x41')](_0x304db1[_0xc759('0x36')],_0x19c9d1[_0xc759('0x38')]),_0x8cd3c0);if(_0x304db1[_0xc759('0x36')][_0xc759('0x42')]){_0x219a15[_0xc759('0x40')]=_[_0xc759('0x43')](_0x219a15[_0xc759('0x40')],{'$or':_[_0xc759('0x2f')](_0x8cd3c0,function(_0x170944){if(_0x170944[_0xc759('0x33')]!==_0xc759('0x44')){var _0xe36c1e={};_0xe36c1e[_0x170944[_0xc759('0x2c')]]={'$like':'%'+_0x304db1[_0xc759('0x36')]['filter']+'%'};return _0xe36c1e;}})});}_0x219a15=_[_0xc759('0x43')]({},_0x219a15,_0x304db1[_0xc759('0x45')]);var _0x5a3368={'where':_0x219a15[_0xc759('0x40')]};return db[_0xc759('0x30')]['count'](_0x5a3368)[_0xc759('0x27')](function(_0x1e5e61){_0x2a4714[_0xc759('0x1f')]=_0x1e5e61;if(_0x304db1[_0xc759('0x36')][_0xc759('0x46')]){_0x219a15['include']=[{'all':!![]}];}return db[_0xc759('0x30')][_0xc759('0x47')](_0x219a15);})[_0xc759('0x27')](function(_0x4b6216){_0x2a4714[_0xc759('0x48')]=_0x4b6216;return _0x2a4714;})[_0xc759('0x27')](respondWithFilteredResult(_0x595058,_0x219a15))[_0xc759('0x49')](handleError(_0x595058,null));};exports['show']=function(_0x3c483b,_0x1e0e03){var _0x10f481={'raw':![],'where':{'id':_0x3c483b[_0xc759('0x4a')]['id']}},_0x5b6f94={};_0x5b6f94['model']=_['keys'](db[_0xc759('0x30')][_0xc759('0x31')]);_0x5b6f94[_0xc759('0x36')]=_[_0xc759('0x37')](_0x3c483b[_0xc759('0x36')]);_0x5b6f94[_0xc759('0x38')]=_['intersection'](_0x5b6f94['model'],_0x5b6f94[_0xc759('0x36')]);_0x10f481[_0xc759('0x3a')]=_[_0xc759('0x39')](_0x5b6f94[_0xc759('0x35')],qs['fields'](_0x3c483b[_0xc759('0x36')]['fields']));_0x10f481[_0xc759('0x3a')]=_0x10f481[_0xc759('0x3a')][_0xc759('0x3c')]?_0x10f481[_0xc759('0x3a')]:_0x5b6f94['model'];if(_0x3c483b['query'][_0xc759('0x46')]){_0x10f481['include']=[{'all':!![]}];}_0x10f481=_['merge']({},_0x10f481,_0x3c483b[_0xc759('0x45')]);return db['SugarcrmConfiguration'][_0xc759('0x4b')](_0x10f481)[_0xc759('0x27')](handleEntityNotFound(_0x1e0e03,null))[_0xc759('0x27')](respondWithResult(_0x1e0e03,null))['catch'](handleError(_0x1e0e03,null));};exports['create']=function(_0x271bef,_0x263482){return db[_0xc759('0x30')][_0xc759('0x4c')](_0x271bef['body'],{})[_0xc759('0x27')](respondWithResult(_0x263482,0xc9))[_0xc759('0x49')](handleError(_0x263482,null));};exports[_0xc759('0x26')]=function(_0x234084,_0x243ba8){if(_0x234084[_0xc759('0x4d')]['id']){delete _0x234084['body']['id'];}return db[_0xc759('0x30')]['find']({'where':{'id':_0x234084[_0xc759('0x4a')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x243ba8,null))[_0xc759('0x27')](saveUpdates(_0x234084[_0xc759('0x4d')],null))[_0xc759('0x27')](respondWithResult(_0x243ba8,null))['catch'](handleError(_0x243ba8,null));};exports[_0xc759('0x28')]=function(_0x56d10e,_0x5a3419){return db['SugarcrmConfiguration'][_0xc759('0x4b')]({'where':{'id':_0x56d10e[_0xc759('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5a3419,null))[_0xc759('0x27')](removeEntity(_0x5a3419,null))[_0xc759('0x49')](handleError(_0x5a3419,null));};exports['getFields']=function(_0x4ae829,_0x5d5f53,_0x35d723){var _0x3b6760={};var _0x46f3d7={};var _0x161cee;var _0x58bc4a;return db['SugarcrmConfiguration'][_0xc759('0x4e')]({'where':{'id':_0x4ae829[_0xc759('0x4a')]['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x5d5f53,null))[_0xc759('0x27')](function(_0x434429){if(_0x434429){_0x161cee=_0x434429;_0x46f3d7[_0xc759('0x35')]=_[_0xc759('0x37')](db[_0xc759('0x4f')][_0xc759('0x31')]);_0x46f3d7['query']=_['keys'](_0x4ae829[_0xc759('0x36')]);_0x46f3d7[_0xc759('0x38')]=_[_0xc759('0x39')](_0x46f3d7['model'],_0x46f3d7[_0xc759('0x36')]);_0x3b6760[_0xc759('0x3a')]=_[_0xc759('0x39')](_0x46f3d7['model'],qs[_0xc759('0x3b')](_0x4ae829['query']['fields']));_0x3b6760['attributes']=_0x3b6760[_0xc759('0x3a')][_0xc759('0x3c')]?_0x3b6760[_0xc759('0x3a')]:_0x46f3d7[_0xc759('0x35')];_0x3b6760['order']=qs['sort'](_0x4ae829[_0xc759('0x36')][_0xc759('0x3f')]);_0x3b6760['where']=qs[_0xc759('0x38')](_[_0xc759('0x41')](_0x4ae829[_0xc759('0x36')],_0x46f3d7[_0xc759('0x38')]));if(_0x4ae829[_0xc759('0x36')]['filter']){_0x3b6760[_0xc759('0x40')]=_[_0xc759('0x43')](_0x3b6760[_0xc759('0x40')],{'$or':_['map'](_0x3b6760[_0xc759('0x3a')],function(_0x2b9df3){var _0x8a1488={};_0x8a1488[_0x2b9df3]={'$like':'%'+_0x4ae829[_0xc759('0x36')][_0xc759('0x42')]+'%'};return _0x8a1488;})});}_0x3b6760=_[_0xc759('0x43')]({},_0x3b6760,_0x4ae829[_0xc759('0x45')]);return _0x161cee[_0xc759('0x50')](_0x3b6760);}})[_0xc759('0x27')](function(_0x33b8af){if(_0x33b8af){_0x58bc4a=_0x33b8af['length'];if(!_0x4ae829['query'][_0xc759('0x3d')](_0xc759('0x3e'))){_0x3b6760['limit']=qs[_0xc759('0x1e')](_0x4ae829[_0xc759('0x36')][_0xc759('0x1e')]);_0x3b6760[_0xc759('0x20')]=qs[_0xc759('0x20')](_0x4ae829[_0xc759('0x36')]['offset']);}return _0x161cee[_0xc759('0x50')](_0x3b6760);}})[_0xc759('0x27')](function(_0x3a0b02){if(_0x3a0b02){return _0x3a0b02?{'count':_0x58bc4a,'rows':_0x3a0b02}:null;}})[_0xc759('0x27')](respondWithResult(_0x5d5f53,null))[_0xc759('0x49')](handleError(_0x5d5f53,null));};exports[_0xc759('0x51')]=function(_0x1dd46f,_0x27dc56,_0x6f0410){var _0x4c4fea={};var _0xcf83de={};var _0x28d04f;var _0x4510c2;return db[_0xc759('0x30')][_0xc759('0x4e')]({'where':{'id':_0x1dd46f[_0xc759('0x4a')]['id']}})['then'](handleEntityNotFound(_0x27dc56,null))['then'](function(_0x5b5cee){if(_0x5b5cee){_0x28d04f=_0x5b5cee;_0xcf83de[_0xc759('0x35')]=_[_0xc759('0x37')](db[_0xc759('0x4f')][_0xc759('0x31')]);_0xcf83de[_0xc759('0x36')]=_['keys'](_0x1dd46f[_0xc759('0x36')]);_0xcf83de[_0xc759('0x38')]=_['intersection'](_0xcf83de['model'],_0xcf83de[_0xc759('0x36')]);_0x4c4fea['attributes']=_['intersection'](_0xcf83de[_0xc759('0x35')],qs[_0xc759('0x3b')](_0x1dd46f[_0xc759('0x36')][_0xc759('0x3b')]));_0x4c4fea[_0xc759('0x3a')]=_0x4c4fea[_0xc759('0x3a')][_0xc759('0x3c')]?_0x4c4fea[_0xc759('0x3a')]:_0xcf83de[_0xc759('0x35')];_0x4c4fea[_0xc759('0x52')]=qs['sort'](_0x1dd46f[_0xc759('0x36')][_0xc759('0x3f')]);_0x4c4fea[_0xc759('0x40')]=qs['filters'](_[_0xc759('0x41')](_0x1dd46f['query'],_0xcf83de[_0xc759('0x38')]));if(_0x1dd46f[_0xc759('0x36')][_0xc759('0x42')]){_0x4c4fea[_0xc759('0x40')]=_[_0xc759('0x43')](_0x4c4fea[_0xc759('0x40')],{'$or':_['map'](_0x4c4fea[_0xc759('0x3a')],function(_0x1e8eed){var _0x4d44fc={};_0x4d44fc[_0x1e8eed]={'$like':'%'+_0x1dd46f[_0xc759('0x36')]['filter']+'%'};return _0x4d44fc;})});}_0x4c4fea=_['merge']({},_0x4c4fea,_0x1dd46f['options']);return _0x28d04f[_0xc759('0x51')](_0x4c4fea);}})[_0xc759('0x27')](function(_0x1107a0){if(_0x1107a0){_0x4510c2=_0x1107a0['length'];if(!_0x1dd46f['query']['hasOwnProperty']('nolimit')){_0x4c4fea['limit']=qs['limit'](_0x1dd46f['query']['limit']);_0x4c4fea[_0xc759('0x20')]=qs[_0xc759('0x20')](_0x1dd46f[_0xc759('0x36')][_0xc759('0x20')]);}return _0x28d04f['getSubjects'](_0x4c4fea);}})[_0xc759('0x27')](function(_0x24a0a0){if(_0x24a0a0){return _0x24a0a0?{'count':_0x4510c2,'rows':_0x24a0a0}:null;}})[_0xc759('0x27')](respondWithResult(_0x27dc56,null))[_0xc759('0x49')](handleError(_0x27dc56,null));};exports['getDescriptions']=function(_0x264dc0,_0x4ff229,_0x6defc7){var _0x9ff316={};var _0xde1862={};var _0x442bb1;var _0x20d94b;return db['SugarcrmConfiguration'][_0xc759('0x4e')]({'where':{'id':_0x264dc0['params']['id']}})[_0xc759('0x27')](handleEntityNotFound(_0x4ff229,null))['then'](function(_0x4fc07e){if(_0x4fc07e){_0x442bb1=_0x4fc07e;_0xde1862[_0xc759('0x35')]=_[_0xc759('0x37')](db[_0xc759('0x4f')]['rawAttributes']);_0xde1862[_0xc759('0x36')]=_[_0xc759('0x37')](_0x264dc0[_0xc759('0x36')]);_0xde1862['filters']=_[_0xc759('0x39')](_0xde1862[_0xc759('0x35')],_0xde1862[_0xc759('0x36')]);_0x9ff316[_0xc759('0x3a')]=_[_0xc759('0x39')](_0xde1862['model'],qs['fields'](_0x264dc0[_0xc759('0x36')][_0xc759('0x3b')]));_0x9ff316[_0xc759('0x3a')]=_0x9ff316[_0xc759('0x3a')][_0xc759('0x3c')]?_0x9ff316[_0xc759('0x3a')]:_0xde1862[_0xc759('0x35')];_0x9ff316[_0xc759('0x52')]=qs[_0xc759('0x3f')](_0x264dc0[_0xc759('0x36')]['sort']);_0x9ff316[_0xc759('0x40')]=qs[_0xc759('0x38')](_[_0xc759('0x41')](_0x264dc0['query'],_0xde1862[_0xc759('0x38')]));if(_0x264dc0['query'][_0xc759('0x42')]){_0x9ff316['where']=_[_0xc759('0x43')](_0x9ff316[_0xc759('0x40')],{'$or':_[_0xc759('0x2f')](_0x9ff316[_0xc759('0x3a')],function(_0x5c4100){var _0x4159e3={};_0x4159e3[_0x5c4100]={'$like':'%'+_0x264dc0[_0xc759('0x36')][_0xc759('0x42')]+'%'};return _0x4159e3;})});}_0x9ff316=_[_0xc759('0x43')]({},_0x9ff316,_0x264dc0['options']);return _0x442bb1[_0xc759('0x53')](_0x9ff316);}})[_0xc759('0x27')](function(_0x3226f6){if(_0x3226f6){_0x20d94b=_0x3226f6['length'];if(!_0x264dc0[_0xc759('0x36')][_0xc759('0x3d')]('nolimit')){_0x9ff316[_0xc759('0x1e')]=qs['limit'](_0x264dc0[_0xc759('0x36')]['limit']);_0x9ff316['offset']=qs[_0xc759('0x20')](_0x264dc0[_0xc759('0x36')]['offset']);}return _0x442bb1[_0xc759('0x53')](_0x9ff316);}})[_0xc759('0x27')](function(_0x1d1920){if(_0x1d1920){return _0x1d1920?{'count':_0x20d94b,'rows':_0x1d1920}:null;}})['then'](respondWithResult(_0x4ff229,null))[_0xc759('0x49')](handleError(_0x4ff229,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 9bf07ec..220574c 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 _0xf928=['rimraf','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','../../config/logger','bluebird','request-promise'];(function(_0x412dd8,_0x355780){var _0x47b96=function(_0x58b680){while(--_0x58b680){_0x412dd8['push'](_0x412dd8['shift']());}};_0x47b96(++_0x355780);}(_0xf928,0x85));var _0x8f92=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf928[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8f92('0x0'))('api');var moment=require('moment');var BPromise=require(_0x8f92('0x1'));var rp=require(_0x8f92('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8f92('0x3'));var config=require('../../config/environment');var attributes=require(_0x8f92('0x4'));module['exports']=function(_0x1d61f1,_0x33a984){return _0x1d61f1[_0x8f92('0x5')](_0x8f92('0x6'),attributes,{'tableName':_0x8f92('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9237=['int_sugarcrm_configurations','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration'];(function(_0x46f980,_0x32898b){var _0x478956=function(_0x4c39ae){while(--_0x4c39ae){_0x46f980['push'](_0x46f980['shift']());}};_0x478956(++_0x32898b);}(_0x9237,0x9d));var _0x7923=function(_0xb83ec2,_0x18e73b){_0xb83ec2=_0xb83ec2-0x0;var _0x4d2fbf=_0x9237[_0xb83ec2];return _0x4d2fbf;};'use strict';var _=require(_0x7923('0x0'));var util=require(_0x7923('0x1'));var logger=require('../../config/logger')(_0x7923('0x2'));var moment=require(_0x7923('0x3'));var BPromise=require('bluebird');var rp=require(_0x7923('0x4'));var fs=require('fs');var path=require(_0x7923('0x5'));var rimraf=require(_0x7923('0x6'));var config=require(_0x7923('0x7'));var attributes=require(_0x7923('0x8'));module['exports']=function(_0x3b891b,_0x1d49c6){return _0x3b891b[_0x7923('0x9')](_0x7923('0xa'),attributes,{'tableName':_0x7923('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 985910f..48eb3d0 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 _0xad07=['../../config/utils','../../config/logger','jayson/promise','client','request','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x42b902,_0x3c49fd){var _0x2d9d68=function(_0x2175bf){while(--_0x2175bf){_0x42b902['push'](_0x42b902['shift']());}};_0x2d9d68(++_0x3c49fd);}(_0xad07,0xa2));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var moment=require(_0x7ad0('0x2'));var BPromise=require(_0x7ad0('0x3'));var rs=require(_0x7ad0('0x4'));var fs=require('fs');var Redis=require(_0x7ad0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7ad0('0x6'));var logger=require(_0x7ad0('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7ad0('0x8'));var client=jayson[_0x7ad0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8a913f,_0x1946e2,_0x56982d){return new BPromise(function(_0x364c5d,_0x4e5523){return client[_0x7ad0('0xa')](_0x8a913f,_0x56982d)['then'](function(_0x4daf93){logger[_0x7ad0('0xb')](_0x7ad0('0xc'),_0x1946e2,_0x7ad0('0xd'));logger[_0x7ad0('0xe')](_0x7ad0('0xf'),_0x1946e2,_0x7ad0('0xd'),JSON[_0x7ad0('0x10')](_0x4daf93));if(_0x4daf93['error']){if(_0x4daf93[_0x7ad0('0x11')]['code']===0x1f4){logger[_0x7ad0('0x11')](_0x7ad0('0xc'),_0x1946e2,_0x4daf93[_0x7ad0('0x11')][_0x7ad0('0x12')]);return _0x4e5523(_0x4daf93[_0x7ad0('0x11')][_0x7ad0('0x12')]);}logger[_0x7ad0('0x11')](_0x7ad0('0xc'),_0x1946e2,_0x4daf93['error'][_0x7ad0('0x12')]);return _0x364c5d(_0x4daf93[_0x7ad0('0x11')][_0x7ad0('0x12')]);}else{logger[_0x7ad0('0xb')](_0x7ad0('0xc'),_0x1946e2,_0x7ad0('0xd'));_0x364c5d(_0x4daf93[_0x7ad0('0x13')][_0x7ad0('0x12')]);}})[_0x7ad0('0x14')](function(_0x42f44c){logger[_0x7ad0('0x11')](_0x7ad0('0xc'),_0x1946e2,_0x42f44c);_0x4e5523(_0x42f44c);});});} \ No newline at end of file +var _0x5ad2=['moment','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util'];(function(_0x545841,_0x55b657){var _0x20dc7c=function(_0x3a361d){while(--_0x3a361d){_0x545841['push'](_0x545841['shift']());}};_0x20dc7c(++_0x55b657);}(_0x5ad2,0x139));var _0x25ad=function(_0x6bb1ac,_0x53d84d){_0x6bb1ac=_0x6bb1ac-0x0;var _0xc35c19=_0x5ad2[_0x6bb1ac];return _0xc35c19;};'use strict';var _=require(_0x25ad('0x0'));var util=require(_0x25ad('0x1'));var moment=require(_0x25ad('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x25ad('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x25ad('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x25ad('0x5'));var jayson=require(_0x25ad('0x6'));var client=jayson[_0x25ad('0x7')][_0x25ad('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c7170,_0x3ea1c4,_0x1e994e){return new BPromise(function(_0x1caf70,_0x31a4a0){return client[_0x25ad('0x9')](_0x2c7170,_0x1e994e)[_0x25ad('0xa')](function(_0x2e4d5d){logger[_0x25ad('0xb')](_0x25ad('0xc'),_0x3ea1c4,_0x25ad('0xd'));logger[_0x25ad('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x3ea1c4,'request\x20sent',JSON[_0x25ad('0xf')](_0x2e4d5d));if(_0x2e4d5d['error']){if(_0x2e4d5d[_0x25ad('0x10')][_0x25ad('0x11')]===0x1f4){logger[_0x25ad('0x10')](_0x25ad('0xc'),_0x3ea1c4,_0x2e4d5d[_0x25ad('0x10')]['message']);return _0x31a4a0(_0x2e4d5d['error'][_0x25ad('0x12')]);}logger[_0x25ad('0x10')](_0x25ad('0xc'),_0x3ea1c4,_0x2e4d5d['error'][_0x25ad('0x12')]);return _0x1caf70(_0x2e4d5d[_0x25ad('0x10')][_0x25ad('0x12')]);}else{logger[_0x25ad('0xb')](_0x25ad('0xc'),_0x3ea1c4,'request\x20sent');_0x1caf70(_0x2e4d5d[_0x25ad('0x13')][_0x25ad('0x12')]);}})[_0x25ad('0x14')](function(_0x55b25c){logger[_0x25ad('0x10')](_0x25ad('0xc'),_0x3ea1c4,_0x55b25c);_0x31a4a0(_0x55b25c);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 3dccfed..17d1f9b 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 _0x651b=['fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','index','get','/:id','post','isAuthenticated','create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x529f1c,_0x437ed1){var _0x4d57ab=function(_0x39d479){while(--_0x39d479){_0x529f1c['push'](_0x529f1c['shift']());}};_0x4d57ab(++_0x437ed1);}(_0x651b,0xc2));var _0xb651=function(_0x501b9d,_0x221cfc){_0x501b9d=_0x501b9d-0x0;var _0xa2f34e=_0x651b[_0x501b9d];return _0xa2f34e;};'use strict';var multer=require(_0xb651('0x0'));var util=require(_0xb651('0x1'));var path=require(_0xb651('0x2'));var timeout=require(_0xb651('0x3'));var express=require(_0xb651('0x4'));var router=express[_0xb651('0x5')]();var fs_extra=require(_0xb651('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb651('0x7'));var config=require(_0xb651('0x8'));var controller=require(_0xb651('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xb651('0xa')]);router[_0xb651('0xb')](_0xb651('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb651('0xd')]('/',auth[_0xb651('0xe')](),controller[_0xb651('0xf')]);router[_0xb651('0x10')](_0xb651('0xc'),auth[_0xb651('0xe')](),controller[_0xb651('0x11')]);router[_0xb651('0x12')](_0xb651('0xc'),auth[_0xb651('0xe')](),controller['destroy']);module[_0xb651('0x13')]=router; \ No newline at end of file +var _0xa1d9=['get','isAuthenticated','post','put','/:id','update','destroy','exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller'];(function(_0x34adf8,_0x4fe747){var _0x7490f8=function(_0x172635){while(--_0x172635){_0x34adf8['push'](_0x34adf8['shift']());}};_0x7490f8(++_0x4fe747);}(_0xa1d9,0x6a));var _0x9a1d=function(_0x1fa3a6,_0x11a327){_0x1fa3a6=_0x1fa3a6-0x0;var _0x33fb38=_0xa1d9[_0x1fa3a6];return _0x33fb38;};'use strict';var multer=require(_0x9a1d('0x0'));var util=require(_0x9a1d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x9a1d('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x9a1d('0x3'));var config=require(_0x9a1d('0x4'));var controller=require(_0x9a1d('0x5'));router[_0x9a1d('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9a1d('0x6')]('/:id',auth[_0x9a1d('0x7')](),controller['show']);router[_0x9a1d('0x8')]('/',auth[_0x9a1d('0x7')](),controller['create']);router[_0x9a1d('0x9')](_0x9a1d('0xa'),auth[_0x9a1d('0x7')](),controller[_0x9a1d('0xb')]);router['delete'](_0x9a1d('0xa'),auth['isAuthenticated'](),controller[_0x9a1d('0xc')]);module[_0x9a1d('0xd')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 88b62f5..2ed84b0 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 _0x324f=['keyValue','picklist','STRING','ENUM','sequelize','exports','string','variable'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x324f,0x184));var _0xf324=function(_0x2c1767,_0x540dd9){_0x2c1767=_0x2c1767-0x0;var _0x923631=_0x324f[_0x2c1767];return _0x923631;};'use strict';var Sequelize=require(_0xf324('0x0'));module[_0xf324('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf324('0x2'),_0xf324('0x3'),'customVariable',_0xf324('0x4'),_0xf324('0x5')),'defaultValue':_0xf324('0x2')},'content':{'type':Sequelize[_0xf324('0x6')]},'key':{'type':Sequelize[_0xf324('0x6')]},'keyType':{'type':Sequelize[_0xf324('0x7')](_0xf324('0x2'),_0xf324('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xf324('0x6')]},'nameField':{'type':Sequelize[_0xf324('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x636b=['customVariable','keyValue','picklist','STRING','variable','ENUM','string'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0x636b,0xd7));var _0xb636=function(_0x20326f,_0x168251){_0x20326f=_0x20326f-0x0;var _0x464dc8=_0x636b[_0x20326f];return _0x464dc8;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xb636('0x0')](_0xb636('0x1'),'variable',_0xb636('0x2'),_0xb636('0x3'),_0xb636('0x4')),'defaultValue':_0xb636('0x1')},'content':{'type':Sequelize[_0xb636('0x5')]},'key':{'type':Sequelize[_0xb636('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb636('0x6'),_0xb636('0x2'))},'keyContent':{'type':Sequelize[_0xb636('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 4f009bc..293bb4a 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 _0xcf60=['end','error','stack','name','map','SugarcrmField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','rows','show','params','create','body','catch','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','destroy'];(function(_0xcc9097,_0x5f58ae){var _0x28aa54=function(_0x33aa3c){while(--_0x33aa3c){_0xcc9097['push'](_0xcc9097['shift']());}};_0x28aa54(++_0x5f58ae);}(_0xcf60,0xb8));var _0x0cf6=function(_0x1be5c6,_0x3c61e6){_0x1be5c6=_0x1be5c6-0x0;var _0x397c0c=_0xcf60[_0x1be5c6];return _0x397c0c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cf6('0x0'));var zipdir=require(_0x0cf6('0x1'));var jsonpatch=require(_0x0cf6('0x2'));var rp=require('request-promise');var moment=require(_0x0cf6('0x3'));var BPromise=require(_0x0cf6('0x4'));var Mustache=require('mustache');var util=require(_0x0cf6('0x5'));var path=require(_0x0cf6('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0cf6('0x7'));var fs=require('fs');var fs_extra=require(_0x0cf6('0x8'));var _=require(_0x0cf6('0x9'));var squel=require(_0x0cf6('0xa'));var crypto=require(_0x0cf6('0xb'));var jsforce=require(_0x0cf6('0xc'));var deskjs=require(_0x0cf6('0xd'));var toCsv=require(_0x0cf6('0xe'));var querystring=require('querystring');var Papa=require(_0x0cf6('0xf'));var Redis=require(_0x0cf6('0x10'));var authService=require(_0x0cf6('0x11'));var qs=require(_0x0cf6('0x12'));var as=require(_0x0cf6('0x13'));var hardwareService=require(_0x0cf6('0x14'));var logger=require(_0x0cf6('0x15'))(_0x0cf6('0x16'));var utils=require(_0x0cf6('0x17'));var config=require(_0x0cf6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0cf6('0x19'))['db'];function respondWithStatusCode(_0x52e748,_0x5e4a82){_0x5e4a82=_0x5e4a82||0xcc;return function(_0x4aa5c5){if(_0x4aa5c5){return _0x52e748[_0x0cf6('0x1a')](_0x5e4a82);}return _0x52e748[_0x0cf6('0x1b')](_0x5e4a82)['end']();};}function respondWithResult(_0x4be34e,_0x10e48f){_0x10e48f=_0x10e48f||0xc8;return function(_0x28dc1a){if(_0x28dc1a){return _0x4be34e[_0x0cf6('0x1b')](_0x10e48f)[_0x0cf6('0x1c')](_0x28dc1a);}};}function respondWithFilteredResult(_0x318a1c,_0x387a52){return function(_0x64ea94){if(_0x64ea94){var _0x702e92=typeof _0x387a52[_0x0cf6('0x1d')]===_0x0cf6('0x1e')&&typeof _0x387a52[_0x0cf6('0x1f')]===_0x0cf6('0x1e');var _0x13f224=_0x64ea94[_0x0cf6('0x20')];var _0x431df9=_0x702e92?0x0:_0x387a52[_0x0cf6('0x1d')];var _0x272d1a=_0x702e92?_0x64ea94[_0x0cf6('0x20')]:_0x387a52[_0x0cf6('0x1d')]+_0x387a52[_0x0cf6('0x1f')];var _0x669565;if(_0x272d1a>=_0x13f224){_0x272d1a=_0x13f224;_0x669565=0xc8;}else{_0x669565=0xce;}_0x318a1c[_0x0cf6('0x1b')](_0x669565);return _0x318a1c['set']('Content-Range',_0x431df9+'-'+_0x272d1a+'/'+_0x13f224)['json'](_0x64ea94);}return null;};}function patchUpdates(_0x34bbd0){return function(_0x1f77b5){try{jsonpatch[_0x0cf6('0x21')](_0x1f77b5,_0x34bbd0,!![]);}catch(_0x32a502){return BPromise[_0x0cf6('0x22')](_0x32a502);}return _0x1f77b5[_0x0cf6('0x23')]();};}function saveUpdates(_0x4b1e38,_0x4abe06){return function(_0xb2bd0){if(_0xb2bd0){return _0xb2bd0[_0x0cf6('0x24')](_0x4b1e38)['then'](function(_0x5c72f5){return _0x5c72f5;});}return null;};}function removeEntity(_0x1dc71f,_0x48a1d3){return function(_0x2cb341){if(_0x2cb341){return _0x2cb341[_0x0cf6('0x25')]()['then'](function(){_0x1dc71f[_0x0cf6('0x1b')](0xcc)[_0x0cf6('0x26')]();});}};}function handleEntityNotFound(_0x457449,_0x275c81){return function(_0x38f8fd){if(!_0x38f8fd){_0x457449[_0x0cf6('0x1a')](0x194);}return _0x38f8fd;};}function handleError(_0x2c6538,_0xb3710){_0xb3710=_0xb3710||0x1f4;return function(_0xbba9ea){logger[_0x0cf6('0x27')](_0xbba9ea[_0x0cf6('0x28')]);if(_0xbba9ea['name']){delete _0xbba9ea[_0x0cf6('0x29')];}_0x2c6538[_0x0cf6('0x1b')](_0xb3710)['send'](_0xbba9ea);};}exports['index']=function(_0x21404c,_0x3d4790){var _0x4f4a27={},_0x1f7d78={},_0x392c3a={'count':0x0,'rows':[]};var _0x2265c7=_[_0x0cf6('0x2a')](db[_0x0cf6('0x2b')][_0x0cf6('0x2c')],function(_0x281838){return{'name':_0x281838[_0x0cf6('0x2d')],'type':_0x281838[_0x0cf6('0x2e')][_0x0cf6('0x2f')]};});_0x1f7d78[_0x0cf6('0x30')]=_[_0x0cf6('0x2a')](_0x2265c7,'name');_0x1f7d78[_0x0cf6('0x31')]=_[_0x0cf6('0x32')](_0x21404c[_0x0cf6('0x31')]);_0x1f7d78[_0x0cf6('0x33')]=_['intersection'](_0x1f7d78[_0x0cf6('0x30')],_0x1f7d78['query']);_0x4f4a27[_0x0cf6('0x34')]=_[_0x0cf6('0x35')](_0x1f7d78[_0x0cf6('0x30')],qs['fields'](_0x21404c['query'][_0x0cf6('0x36')]));_0x4f4a27[_0x0cf6('0x34')]=_0x4f4a27[_0x0cf6('0x34')][_0x0cf6('0x37')]?_0x4f4a27[_0x0cf6('0x34')]:_0x1f7d78[_0x0cf6('0x30')];if(!_0x21404c[_0x0cf6('0x31')][_0x0cf6('0x38')]('nolimit')){_0x4f4a27['limit']=qs['limit'](_0x21404c['query'][_0x0cf6('0x1f')]);_0x4f4a27[_0x0cf6('0x1d')]=qs['offset'](_0x21404c[_0x0cf6('0x31')]['offset']);}_0x4f4a27[_0x0cf6('0x39')]=qs[_0x0cf6('0x3a')](_0x21404c[_0x0cf6('0x31')]['sort']);_0x4f4a27[_0x0cf6('0x3b')]=qs['filters'](_[_0x0cf6('0x3c')](_0x21404c[_0x0cf6('0x31')],_0x1f7d78[_0x0cf6('0x33')]),_0x2265c7);if(_0x21404c['query'][_0x0cf6('0x3d')]){_0x4f4a27[_0x0cf6('0x3b')]=_[_0x0cf6('0x3e')](_0x4f4a27[_0x0cf6('0x3b')],{'$or':_[_0x0cf6('0x2a')](_0x2265c7,function(_0x45f02d){if(_0x45f02d[_0x0cf6('0x2e')]!==_0x0cf6('0x3f')){var _0x263c12={};_0x263c12[_0x45f02d[_0x0cf6('0x29')]]={'$like':'%'+_0x21404c[_0x0cf6('0x31')]['filter']+'%'};return _0x263c12;}})});}_0x4f4a27=_['merge']({},_0x4f4a27,_0x21404c[_0x0cf6('0x40')]);var _0x2673cc={'where':_0x4f4a27['where']};return db[_0x0cf6('0x2b')][_0x0cf6('0x20')](_0x2673cc)[_0x0cf6('0x41')](function(_0x4f98c1){_0x392c3a[_0x0cf6('0x20')]=_0x4f98c1;if(_0x21404c[_0x0cf6('0x31')][_0x0cf6('0x42')]){_0x4f4a27[_0x0cf6('0x43')]=[{'all':!![]}];}return db[_0x0cf6('0x2b')]['findAll'](_0x4f4a27);})['then'](function(_0x3cb6ba){_0x392c3a[_0x0cf6('0x44')]=_0x3cb6ba;return _0x392c3a;})['then'](respondWithFilteredResult(_0x3d4790,_0x4f4a27))['catch'](handleError(_0x3d4790,null));};exports[_0x0cf6('0x45')]=function(_0x3ceec5,_0x515815){var _0x233211={'raw':!![],'where':{'id':_0x3ceec5[_0x0cf6('0x46')]['id']}},_0x2a9bd4={};_0x2a9bd4[_0x0cf6('0x30')]=_['keys'](db[_0x0cf6('0x2b')][_0x0cf6('0x2c')]);_0x2a9bd4[_0x0cf6('0x31')]=_[_0x0cf6('0x32')](_0x3ceec5[_0x0cf6('0x31')]);_0x2a9bd4[_0x0cf6('0x33')]=_['intersection'](_0x2a9bd4[_0x0cf6('0x30')],_0x2a9bd4[_0x0cf6('0x31')]);_0x233211['attributes']=_['intersection'](_0x2a9bd4[_0x0cf6('0x30')],qs[_0x0cf6('0x36')](_0x3ceec5[_0x0cf6('0x31')][_0x0cf6('0x36')]));_0x233211[_0x0cf6('0x34')]=_0x233211['attributes'][_0x0cf6('0x37')]?_0x233211[_0x0cf6('0x34')]:_0x2a9bd4[_0x0cf6('0x30')];if(_0x3ceec5['query'][_0x0cf6('0x42')]){_0x233211['include']=[{'all':!![]}];}_0x233211=_[_0x0cf6('0x3e')]({},_0x233211,_0x3ceec5[_0x0cf6('0x40')]);return db[_0x0cf6('0x2b')]['find'](_0x233211)[_0x0cf6('0x41')](handleEntityNotFound(_0x515815,null))[_0x0cf6('0x41')](respondWithResult(_0x515815,null))['catch'](handleError(_0x515815,null));};exports[_0x0cf6('0x47')]=function(_0x40f799,_0x4cbc79){return db[_0x0cf6('0x2b')][_0x0cf6('0x47')](_0x40f799[_0x0cf6('0x48')],{})[_0x0cf6('0x41')](respondWithResult(_0x4cbc79,0xc9))['catch'](handleError(_0x4cbc79,null));};exports[_0x0cf6('0x24')]=function(_0x1f2f11,_0x1be6f8){if(_0x1f2f11[_0x0cf6('0x48')]['id']){delete _0x1f2f11[_0x0cf6('0x48')]['id'];}return db[_0x0cf6('0x2b')]['find']({'where':{'id':_0x1f2f11[_0x0cf6('0x46')]['id']}})[_0x0cf6('0x41')](handleEntityNotFound(_0x1be6f8,null))[_0x0cf6('0x41')](saveUpdates(_0x1f2f11[_0x0cf6('0x48')],null))['then'](respondWithResult(_0x1be6f8,null))[_0x0cf6('0x49')](handleError(_0x1be6f8,null));};exports['destroy']=function(_0x1a79ea,_0x561cc9){return db[_0x0cf6('0x2b')]['find']({'where':{'id':_0x1a79ea[_0x0cf6('0x46')]['id']}})[_0x0cf6('0x41')](handleEntityNotFound(_0x561cc9,null))[_0x0cf6('0x41')](removeEntity(_0x561cc9,null))[_0x0cf6('0x49')](handleError(_0x561cc9,null));}; \ No newline at end of file +var _0xfc1e=['include','find','create','body','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','destroy','sendStatus','stack','name','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','sort','where','pick','filter','merge','options','includeAll','rows','params'];(function(_0x454816,_0x5c014f){var _0x4996f2=function(_0x5887a7){while(--_0x5887a7){_0x454816['push'](_0x454816['shift']());}};_0x4996f2(++_0x5c014f);}(_0xfc1e,0x19d));var _0xefc1=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xfc1e[_0x1694f5];return _0x5b4321;};'use strict';var emlformat=require(_0xefc1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefc1('0x1'));var jsonpatch=require(_0xefc1('0x2'));var rp=require('request-promise');var moment=require(_0xefc1('0x3'));var BPromise=require(_0xefc1('0x4'));var Mustache=require('mustache');var util=require(_0xefc1('0x5'));var path=require(_0xefc1('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xefc1('0x7'));var fs=require('fs');var fs_extra=require(_0xefc1('0x8'));var _=require(_0xefc1('0x9'));var squel=require(_0xefc1('0xa'));var crypto=require(_0xefc1('0xb'));var jsforce=require(_0xefc1('0xc'));var deskjs=require(_0xefc1('0xd'));var toCsv=require(_0xefc1('0xe'));var querystring=require(_0xefc1('0xf'));var Papa=require('papaparse');var Redis=require(_0xefc1('0x10'));var authService=require(_0xefc1('0x11'));var qs=require(_0xefc1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xefc1('0x13'));var logger=require('../../config/logger')(_0xefc1('0x14'));var utils=require(_0xefc1('0x15'));var config=require(_0xefc1('0x16'));var licenseUtil=require(_0xefc1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e6495,_0x4e52ac){_0x4e52ac=_0x4e52ac||0xcc;return function(_0x257e27){if(_0x257e27){return _0x5e6495['sendStatus'](_0x4e52ac);}return _0x5e6495[_0xefc1('0x18')](_0x4e52ac)[_0xefc1('0x19')]();};}function respondWithResult(_0xc2096c,_0x10bf8e){_0x10bf8e=_0x10bf8e||0xc8;return function(_0x1bf654){if(_0x1bf654){return _0xc2096c[_0xefc1('0x18')](_0x10bf8e)[_0xefc1('0x1a')](_0x1bf654);}};}function respondWithFilteredResult(_0x52acc1,_0x3a9430){return function(_0x517dfe){if(_0x517dfe){var _0x32fc9f=typeof _0x3a9430[_0xefc1('0x1b')]==='undefined'&&typeof _0x3a9430[_0xefc1('0x1c')]===_0xefc1('0x1d');var _0x5d73a0=_0x517dfe[_0xefc1('0x1e')];var _0x2849e5=_0x32fc9f?0x0:_0x3a9430['offset'];var _0x17758f=_0x32fc9f?_0x517dfe['count']:_0x3a9430['offset']+_0x3a9430[_0xefc1('0x1c')];var _0x25fe6c;if(_0x17758f>=_0x5d73a0){_0x17758f=_0x5d73a0;_0x25fe6c=0xc8;}else{_0x25fe6c=0xce;}_0x52acc1[_0xefc1('0x18')](_0x25fe6c);return _0x52acc1[_0xefc1('0x1f')]('Content-Range',_0x2849e5+'-'+_0x17758f+'/'+_0x5d73a0)[_0xefc1('0x1a')](_0x517dfe);}return null;};}function patchUpdates(_0x8e053b){return function(_0x230e3f){try{jsonpatch[_0xefc1('0x20')](_0x230e3f,_0x8e053b,!![]);}catch(_0x3cb900){return BPromise['reject'](_0x3cb900);}return _0x230e3f[_0xefc1('0x21')]();};}function saveUpdates(_0x4cb842,_0x4a05b6){return function(_0x99c650){if(_0x99c650){return _0x99c650[_0xefc1('0x22')](_0x4cb842)[_0xefc1('0x23')](function(_0x27bd8c){return _0x27bd8c;});}return null;};}function removeEntity(_0x5edbf4,_0x32cfef){return function(_0x56d950){if(_0x56d950){return _0x56d950[_0xefc1('0x24')]()[_0xefc1('0x23')](function(){_0x5edbf4[_0xefc1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5e030a,_0x3e70ec){return function(_0x56f4da){if(!_0x56f4da){_0x5e030a[_0xefc1('0x25')](0x194);}return _0x56f4da;};}function handleError(_0xdd3d07,_0x12429e){_0x12429e=_0x12429e||0x1f4;return function(_0x54f9d8){logger['error'](_0x54f9d8[_0xefc1('0x26')]);if(_0x54f9d8[_0xefc1('0x27')]){delete _0x54f9d8[_0xefc1('0x27')];}_0xdd3d07[_0xefc1('0x18')](_0x12429e)['send'](_0x54f9d8);};}exports['index']=function(_0x1269a0,_0x2c0946){var _0xde9e04={},_0x2e7261={},_0x188aa1={'count':0x0,'rows':[]};var _0x5e6543=_['map'](db[_0xefc1('0x28')][_0xefc1('0x29')],function(_0x168d01){return{'name':_0x168d01[_0xefc1('0x2a')],'type':_0x168d01[_0xefc1('0x2b')][_0xefc1('0x2c')]};});_0x2e7261[_0xefc1('0x2d')]=_[_0xefc1('0x2e')](_0x5e6543,_0xefc1('0x27'));_0x2e7261[_0xefc1('0x2f')]=_[_0xefc1('0x30')](_0x1269a0[_0xefc1('0x2f')]);_0x2e7261[_0xefc1('0x31')]=_[_0xefc1('0x32')](_0x2e7261['model'],_0x2e7261[_0xefc1('0x2f')]);_0xde9e04[_0xefc1('0x33')]=_['intersection'](_0x2e7261[_0xefc1('0x2d')],qs[_0xefc1('0x34')](_0x1269a0[_0xefc1('0x2f')]['fields']));_0xde9e04[_0xefc1('0x33')]=_0xde9e04[_0xefc1('0x33')][_0xefc1('0x35')]?_0xde9e04[_0xefc1('0x33')]:_0x2e7261['model'];if(!_0x1269a0[_0xefc1('0x2f')]['hasOwnProperty']('nolimit')){_0xde9e04['limit']=qs[_0xefc1('0x1c')](_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x1c')]);_0xde9e04[_0xefc1('0x1b')]=qs[_0xefc1('0x1b')](_0x1269a0['query'][_0xefc1('0x1b')]);}_0xde9e04['order']=qs['sort'](_0x1269a0['query'][_0xefc1('0x36')]);_0xde9e04[_0xefc1('0x37')]=qs[_0xefc1('0x31')](_[_0xefc1('0x38')](_0x1269a0[_0xefc1('0x2f')],_0x2e7261[_0xefc1('0x31')]),_0x5e6543);if(_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x39')]){_0xde9e04['where']=_['merge'](_0xde9e04['where'],{'$or':_[_0xefc1('0x2e')](_0x5e6543,function(_0x58a344){if(_0x58a344[_0xefc1('0x2b')]!=='VIRTUAL'){var _0x50fb0f={};_0x50fb0f[_0x58a344['name']]={'$like':'%'+_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x39')]+'%'};return _0x50fb0f;}})});}_0xde9e04=_[_0xefc1('0x3a')]({},_0xde9e04,_0x1269a0[_0xefc1('0x3b')]);var _0x514d57={'where':_0xde9e04[_0xefc1('0x37')]};return db[_0xefc1('0x28')][_0xefc1('0x1e')](_0x514d57)[_0xefc1('0x23')](function(_0x3bd61d){_0x188aa1['count']=_0x3bd61d;if(_0x1269a0[_0xefc1('0x2f')][_0xefc1('0x3c')]){_0xde9e04['include']=[{'all':!![]}];}return db[_0xefc1('0x28')]['findAll'](_0xde9e04);})[_0xefc1('0x23')](function(_0x17fa09){_0x188aa1[_0xefc1('0x3d')]=_0x17fa09;return _0x188aa1;})['then'](respondWithFilteredResult(_0x2c0946,_0xde9e04))['catch'](handleError(_0x2c0946,null));};exports['show']=function(_0x341d75,_0xe2caae){var _0x56650b={'raw':!![],'where':{'id':_0x341d75[_0xefc1('0x3e')]['id']}},_0x3b43ae={};_0x3b43ae[_0xefc1('0x2d')]=_['keys'](db[_0xefc1('0x28')]['rawAttributes']);_0x3b43ae[_0xefc1('0x2f')]=_['keys'](_0x341d75[_0xefc1('0x2f')]);_0x3b43ae['filters']=_[_0xefc1('0x32')](_0x3b43ae['model'],_0x3b43ae[_0xefc1('0x2f')]);_0x56650b[_0xefc1('0x33')]=_[_0xefc1('0x32')](_0x3b43ae[_0xefc1('0x2d')],qs[_0xefc1('0x34')](_0x341d75[_0xefc1('0x2f')][_0xefc1('0x34')]));_0x56650b[_0xefc1('0x33')]=_0x56650b['attributes'][_0xefc1('0x35')]?_0x56650b[_0xefc1('0x33')]:_0x3b43ae[_0xefc1('0x2d')];if(_0x341d75['query'][_0xefc1('0x3c')]){_0x56650b[_0xefc1('0x3f')]=[{'all':!![]}];}_0x56650b=_[_0xefc1('0x3a')]({},_0x56650b,_0x341d75['options']);return db[_0xefc1('0x28')][_0xefc1('0x40')](_0x56650b)[_0xefc1('0x23')](handleEntityNotFound(_0xe2caae,null))[_0xefc1('0x23')](respondWithResult(_0xe2caae,null))['catch'](handleError(_0xe2caae,null));};exports[_0xefc1('0x41')]=function(_0x1bf7e4,_0x4e7013){return db[_0xefc1('0x28')]['create'](_0x1bf7e4['body'],{})[_0xefc1('0x23')](respondWithResult(_0x4e7013,0xc9))['catch'](handleError(_0x4e7013,null));};exports[_0xefc1('0x22')]=function(_0x3e1647,_0x19f83f){if(_0x3e1647[_0xefc1('0x42')]['id']){delete _0x3e1647['body']['id'];}return db[_0xefc1('0x28')][_0xefc1('0x40')]({'where':{'id':_0x3e1647[_0xefc1('0x3e')]['id']}})[_0xefc1('0x23')](handleEntityNotFound(_0x19f83f,null))[_0xefc1('0x23')](saveUpdates(_0x3e1647['body'],null))[_0xefc1('0x23')](respondWithResult(_0x19f83f,null))[_0xefc1('0x43')](handleError(_0x19f83f,null));};exports[_0xefc1('0x24')]=function(_0x45b0fd,_0x2caea3){return db['SugarcrmField'][_0xefc1('0x40')]({'where':{'id':_0x45b0fd['params']['id']}})[_0xefc1('0x23')](handleEntityNotFound(_0x2caea3,null))[_0xefc1('0x23')](removeEntity(_0x2caea3,null))[_0xefc1('0x43')](handleError(_0x2caea3,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index dc0d404..771cf90 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 _0x9c27=['idField','FieldId','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','int_sugarcrm_fields'];(function(_0x35c5cf,_0x27795e){var _0x549b4b=function(_0x21b6e1){while(--_0x21b6e1){_0x35c5cf['push'](_0x35c5cf['shift']());}};_0x549b4b(++_0x27795e);}(_0x9c27,0x12e));var _0x79c2=function(_0x168120,_0x4e19de){_0x168120=_0x168120-0x0;var _0x5c827e=_0x9c27[_0x168120];return _0x5c827e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x79c2('0x0'))(_0x79c2('0x1'));var moment=require('moment');var BPromise=require(_0x79c2('0x2'));var rp=require(_0x79c2('0x3'));var fs=require('fs');var path=require(_0x79c2('0x4'));var rimraf=require(_0x79c2('0x5'));var config=require(_0x79c2('0x6'));var attributes=require(_0x79c2('0x7'));module[_0x79c2('0x8')]=function(_0x5a2e9a,_0x33e690){return _0x5a2e9a['define']('SugarcrmField',attributes,{'tableName':_0x79c2('0x9'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x79c2('0xa'),_0x79c2('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x824c=['request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird'];(function(_0x502ccd,_0x36f01c){var _0x5331e5=function(_0x5719c7){while(--_0x5719c7){_0x502ccd['push'](_0x502ccd['shift']());}};_0x5331e5(++_0x36f01c);}(_0x824c,0x109));var _0xc824=function(_0x1bb7e9,_0xc548b9){_0x1bb7e9=_0x1bb7e9-0x0;var _0x16ac2f=_0x824c[_0x1bb7e9];return _0x16ac2f;};'use strict';var _=require(_0xc824('0x0'));var util=require(_0xc824('0x1'));var logger=require(_0xc824('0x2'))(_0xc824('0x3'));var moment=require('moment');var BPromise=require(_0xc824('0x4'));var rp=require(_0xc824('0x5'));var fs=require('fs');var path=require(_0xc824('0x6'));var rimraf=require(_0xc824('0x7'));var config=require(_0xc824('0x8'));var attributes=require(_0xc824('0x9'));module['exports']=function(_0x374ae9,_0x2a2f0f){return _0x374ae9[_0xc824('0xa')]('SugarcrmField',attributes,{'tableName':_0xc824('0xb'),'paranoid':![],'indexes':[{'name':_0xc824('0xc'),'fields':[_0xc824('0xd'),_0xc824('0xe')],'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 6030e81..95f2940 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 _0x0540=['jayson/promise','client','http','then','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0540,0xff));var _0x0054=function(_0x36e61b,_0x5a6ec0){_0x36e61b=_0x36e61b-0x0;var _0x4de96b=_0x0540[_0x36e61b];return _0x4de96b;};'use strict';var _=require(_0x0054('0x0'));var util=require(_0x0054('0x1'));var moment=require(_0x0054('0x2'));var BPromise=require(_0x0054('0x3'));var rs=require(_0x0054('0x4'));var fs=require('fs');var Redis=require(_0x0054('0x5'));var db=require(_0x0054('0x6'))['db'];var utils=require(_0x0054('0x7'));var logger=require('../../config/logger')(_0x0054('0x8'));var config=require('../../config/environment');var jayson=require(_0x0054('0x9'));var client=jayson[_0x0054('0xa')][_0x0054('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314d21,_0x14d156,_0x230d70){return new BPromise(function(_0x2f6b43,_0x51ba49){return client['request'](_0x314d21,_0x230d70)[_0x0054('0xc')](function(_0x2eaa9e){logger[_0x0054('0xd')](_0x0054('0xe'),_0x14d156,'request\x20sent');logger[_0x0054('0xf')](_0x0054('0x10'),_0x14d156,'request\x20sent',JSON[_0x0054('0x11')](_0x2eaa9e));if(_0x2eaa9e['error']){if(_0x2eaa9e[_0x0054('0x12')][_0x0054('0x13')]===0x1f4){logger[_0x0054('0x12')](_0x0054('0xe'),_0x14d156,_0x2eaa9e[_0x0054('0x12')][_0x0054('0x14')]);return _0x51ba49(_0x2eaa9e[_0x0054('0x12')][_0x0054('0x14')]);}logger[_0x0054('0x12')]('SugarcrmField,\x20%s,\x20%s',_0x14d156,_0x2eaa9e['error'][_0x0054('0x14')]);return _0x2f6b43(_0x2eaa9e[_0x0054('0x12')]['message']);}else{logger[_0x0054('0xd')]('SugarcrmField,\x20%s,\x20%s',_0x14d156,_0x0054('0x15'));_0x2f6b43(_0x2eaa9e['result'][_0x0054('0x14')]);}})['catch'](function(_0x1457ab){logger[_0x0054('0x12')](_0x0054('0xe'),_0x14d156,_0x1457ab);_0x51ba49(_0x1457ab);});});} \ No newline at end of file +var _0x0c72=['code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x22dbdd,_0x2c43eb){var _0x239aa4=function(_0x36d181){while(--_0x36d181){_0x22dbdd['push'](_0x22dbdd['shift']());}};_0x239aa4(++_0x2c43eb);}(_0x0c72,0xac));var _0x20c7=function(_0x2aaae0,_0x4f0fe2){_0x2aaae0=_0x2aaae0-0x0;var _0x25787e=_0x0c72[_0x2aaae0];return _0x25787e;};'use strict';var _=require(_0x20c7('0x0'));var util=require('util');var moment=require(_0x20c7('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c7('0x2'));var fs=require('fs');var Redis=require(_0x20c7('0x3'));var db=require(_0x20c7('0x4'))['db'];var utils=require(_0x20c7('0x5'));var logger=require(_0x20c7('0x6'))(_0x20c7('0x7'));var config=require('../../config/environment');var jayson=require(_0x20c7('0x8'));var client=jayson[_0x20c7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x536e67,_0x3ab060,_0x50a6b4){return new BPromise(function(_0x7a6dd3,_0x38d31b){return client['request'](_0x536e67,_0x50a6b4)[_0x20c7('0xa')](function(_0x1b0ef7){logger[_0x20c7('0xb')](_0x20c7('0xc'),_0x3ab060,_0x20c7('0xd'));logger[_0x20c7('0xe')](_0x20c7('0xf'),_0x3ab060,'request\x20sent',JSON['stringify'](_0x1b0ef7));if(_0x1b0ef7['error']){if(_0x1b0ef7[_0x20c7('0x10')][_0x20c7('0x11')]===0x1f4){logger[_0x20c7('0x10')](_0x20c7('0xc'),_0x3ab060,_0x1b0ef7[_0x20c7('0x10')][_0x20c7('0x12')]);return _0x38d31b(_0x1b0ef7['error'][_0x20c7('0x12')]);}logger[_0x20c7('0x10')](_0x20c7('0xc'),_0x3ab060,_0x1b0ef7['error'][_0x20c7('0x12')]);return _0x7a6dd3(_0x1b0ef7[_0x20c7('0x10')][_0x20c7('0x12')]);}else{logger[_0x20c7('0xb')]('SugarcrmField,\x20%s,\x20%s',_0x3ab060,_0x20c7('0xd'));_0x7a6dd3(_0x1b0ef7[_0x20c7('0x13')]['message']);}})[_0x20c7('0x14')](function(_0x2bc8e9){logger[_0x20c7('0x10')](_0x20c7('0xc'),_0x3ab060,_0x2bc8e9);_0x38d31b(_0x2bc8e9);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 15ef51d..330d535 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 _0xf53f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','post','/:id/configurations','put','/:id','delete','multer','util','path','connect-timeout','express','Router'];(function(_0x26bfb4,_0x1673ed){var _0x53579a=function(_0x256635){while(--_0x256635){_0x26bfb4['push'](_0x26bfb4['shift']());}};_0x53579a(++_0x1673ed);}(_0xf53f,0x8d));var _0xff53=function(_0x2fff4b,_0x3d6736){_0x2fff4b=_0x2fff4b-0x0;var _0x32f63b=_0xf53f[_0x2fff4b];return _0x32f63b;};'use strict';var multer=require(_0xff53('0x0'));var util=require(_0xff53('0x1'));var path=require(_0xff53('0x2'));var timeout=require(_0xff53('0x3'));var express=require(_0xff53('0x4'));var router=express[_0xff53('0x5')]();var fs_extra=require(_0xff53('0x6'));var auth=require(_0xff53('0x7'));var interaction=require(_0xff53('0x8'));var config=require(_0xff53('0x9'));var controller=require(_0xff53('0xa'));router[_0xff53('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xff53('0xb')]('/:id',auth[_0xff53('0xc')](),controller[_0xff53('0xd')]);router[_0xff53('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xff53('0xe')]);router['get'](_0xff53('0xf'),auth[_0xff53('0xc')](),controller['getFields']);router[_0xff53('0x10')]('/',auth[_0xff53('0xc')](),controller['create']);router[_0xff53('0x10')](_0xff53('0x11'),auth[_0xff53('0xc')](),controller['addConfiguration']);router[_0xff53('0x12')](_0xff53('0x13'),auth[_0xff53('0xc')](),controller['update']);router[_0xff53('0x14')](_0xff53('0x13'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb492=['index','get','/:id','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','addConfiguration','put','delete','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller'];(function(_0xd975dd,_0x58a63b){var _0x967a80=function(_0x2cd389){while(--_0x2cd389){_0xd975dd['push'](_0xd975dd['shift']());}};_0x967a80(++_0x58a63b);}(_0xb492,0x172));var _0x2b49=function(_0x444683,_0x27c302){_0x444683=_0x444683-0x0;var _0x16bd4b=_0xb492[_0x444683];return _0x16bd4b;};'use strict';var multer=require('multer');var util=require(_0x2b49('0x0'));var path=require(_0x2b49('0x1'));var timeout=require(_0x2b49('0x2'));var express=require(_0x2b49('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2b49('0x4'));var interaction=require(_0x2b49('0x5'));var config=require(_0x2b49('0x6'));var controller=require(_0x2b49('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x2b49('0x8')]);router[_0x2b49('0x9')](_0x2b49('0xa'),auth[_0x2b49('0xb')](),controller[_0x2b49('0xc')]);router[_0x2b49('0x9')](_0x2b49('0xd'),auth[_0x2b49('0xb')](),controller['getConfigurations']);router[_0x2b49('0x9')](_0x2b49('0xe'),auth['isAuthenticated'](),controller[_0x2b49('0xf')]);router[_0x2b49('0x10')]('/',auth[_0x2b49('0xb')](),controller['create']);router[_0x2b49('0x10')](_0x2b49('0xd'),auth[_0x2b49('0xb')](),controller[_0x2b49('0x11')]);router[_0x2b49('0x12')](_0x2b49('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x2b49('0x13')](_0x2b49('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x2b49('0x14')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 287b025..383cfd4 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 _0x0e66=['HelpDesk','exports','STRING'];(function(_0x2797c6,_0x37421b){var _0x54809f=function(_0x2d100c){while(--_0x2d100c){_0x2797c6['push'](_0x2797c6['shift']());}};_0x54809f(++_0x37421b);}(_0x0e66,0xdf));var _0x60e6=function(_0x53c256,_0x382a24){_0x53c256=_0x53c256-0x0;var _0x25feb6=_0x0e66[_0x53c256];return _0x25feb6;};'use strict';var Sequelize=require('sequelize');module[_0x60e6('0x0')]={'name':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![],'defaultValue':_0x60e6('0x2')},'remoteUri':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x60e6('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xc598=['sequelize','exports','STRING','HelpDesk'];(function(_0x5e5ef6,_0x28fed9){var _0x4961d4=function(_0x22cbc0){while(--_0x22cbc0){_0x5e5ef6['push'](_0x5e5ef6['shift']());}};_0x4961d4(++_0x28fed9);}(_0xc598,0x144));var _0x8c59=function(_0x19cf81,_0x3332c3){_0x19cf81=_0x19cf81-0x0;var _0x4dce2c=_0xc598[_0x19cf81];return _0x4dce2c;};'use strict';var Sequelize=require(_0x8c59('0x0'));module[_0x8c59('0x1')]={'name':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![],'defaultValue':_0x8c59('0x3')},'remoteUri':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x8c59('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8c59('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 ec02f81..bb8efc3 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 _0x874b=['label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','undefined','limit','count','offset','set','Content-Range','apply','save','destroy','name','send','map','VtigerAccount','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','then','rows','catch','show','params','rawAttributes','find','create','body','update','findOne','VtigerConfiguration','order','sort','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','GET','describe','sessionName','autogenerated','reference','owner','remove','includes','editable','false'];(function(_0x29733c,_0x2da30b){var _0x49e72f=function(_0x405c92){while(--_0x405c92){_0x29733c['push'](_0x29733c['shift']());}};_0x49e72f(++_0x2da30b);}(_0x874b,0x185));var _0xb874=function(_0xe64c79,_0x3f1a4a){_0xe64c79=_0xe64c79-0x0;var _0x4d15cf=_0x874b[_0xe64c79];return _0x4d15cf;};'use strict';var emlformat=require(_0xb874('0x0'));var rimraf=require(_0xb874('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb874('0x2'));var BPromise=require(_0xb874('0x3'));var Mustache=require(_0xb874('0x4'));var util=require(_0xb874('0x5'));var path=require(_0xb874('0x6'));var sox=require(_0xb874('0x7'));var csv=require('to-csv');var ejs=require(_0xb874('0x8'));var fs=require('fs');var fs_extra=require(_0xb874('0x9'));var _=require(_0xb874('0xa'));var squel=require(_0xb874('0xb'));var crypto=require(_0xb874('0xc'));var jsforce=require(_0xb874('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb874('0xe'));var Papa=require(_0xb874('0xf'));var Redis=require(_0xb874('0x10'));var authService=require(_0xb874('0x11'));var qs=require(_0xb874('0x12'));var as=require(_0xb874('0x13'));var hardwareService=require(_0xb874('0x14'));var logger=require('../../config/logger')(_0xb874('0x15'));var utils=require('../../config/utils');var config=require(_0xb874('0x16'));var licenseUtil=require(_0xb874('0x17'));var db=require(_0xb874('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x7b0d11,_0x3025e1){_0x3025e1=_0x3025e1||0xcc;return function(_0x422d59){if(_0x422d59){return _0x7b0d11[_0xb874('0x19')](_0x3025e1);}return _0x7b0d11[_0xb874('0x1a')](_0x3025e1)[_0xb874('0x1b')]();};}function respondWithResult(_0x3c5b6e,_0x4348a3){_0x4348a3=_0x4348a3||0xc8;return function(_0x34dce6){if(_0x34dce6){return _0x3c5b6e['status'](_0x4348a3)[_0xb874('0x1c')](_0x34dce6);}};}function respondWithFilteredResult(_0x599ee2,_0x15cd87){return function(_0x197c9b){if(_0x197c9b){var _0x557e18=typeof _0x15cd87['offset']===_0xb874('0x1d')&&typeof _0x15cd87[_0xb874('0x1e')]==='undefined';var _0x59e6cb=_0x197c9b[_0xb874('0x1f')];var _0x5635fa=_0x557e18?0x0:_0x15cd87[_0xb874('0x20')];var _0x351e55=_0x557e18?_0x197c9b[_0xb874('0x1f')]:_0x15cd87['offset']+_0x15cd87[_0xb874('0x1e')];var _0x590f1e;if(_0x351e55>=_0x59e6cb){_0x351e55=_0x59e6cb;_0x590f1e=0xc8;}else{_0x590f1e=0xce;}_0x599ee2[_0xb874('0x1a')](_0x590f1e);return _0x599ee2[_0xb874('0x21')](_0xb874('0x22'),_0x5635fa+'-'+_0x351e55+'/'+_0x59e6cb)['json'](_0x197c9b);}return null;};}function patchUpdates(_0x2dde63){return function(_0x535dee){try{jsonpatch[_0xb874('0x23')](_0x535dee,_0x2dde63,!![]);}catch(_0x3a1370){return BPromise['reject'](_0x3a1370);}return _0x535dee[_0xb874('0x24')]();};}function saveUpdates(_0x13e6ec,_0x59f3d8){return function(_0x22aaaa){if(_0x22aaaa){return _0x22aaaa['update'](_0x13e6ec)['then'](function(_0x454a96){return _0x454a96;});}return null;};}function removeEntity(_0x283bd4,_0x49f9bb){return function(_0x443d3c){if(_0x443d3c){return _0x443d3c[_0xb874('0x25')]()['then'](function(){_0x283bd4[_0xb874('0x1a')](0xcc)[_0xb874('0x1b')]();});}};}function handleEntityNotFound(_0x178bd4,_0x2207bc){return function(_0x2e720c){if(!_0x2e720c){_0x178bd4[_0xb874('0x19')](0x194);}return _0x2e720c;};}function handleError(_0x58a963,_0x2378a8){_0x2378a8=_0x2378a8||0x1f4;return function(_0x5d8d7c){logger['error'](_0x5d8d7c['stack']);if(_0x5d8d7c['name']){delete _0x5d8d7c[_0xb874('0x26')];}_0x58a963[_0xb874('0x1a')](_0x2378a8)[_0xb874('0x27')](_0x5d8d7c);};}exports['index']=function(_0x45ef20,_0x19fd87){var _0x17e74b={},_0x35489e={},_0x381027={'count':0x0,'rows':[]};var _0x426a81=_[_0xb874('0x28')](db[_0xb874('0x29')]['rawAttributes'],function(_0x3c68ae){return{'name':_0x3c68ae['fieldName'],'type':_0x3c68ae[_0xb874('0x2a')][_0xb874('0x2b')]};});_0x35489e[_0xb874('0x2c')]=_['map'](_0x426a81,_0xb874('0x26'));_0x35489e[_0xb874('0x2d')]=_[_0xb874('0x2e')](_0x45ef20[_0xb874('0x2d')]);_0x35489e['filters']=_[_0xb874('0x2f')](_0x35489e['model'],_0x35489e['query']);_0x17e74b[_0xb874('0x30')]=_[_0xb874('0x2f')](_0x35489e[_0xb874('0x2c')],qs[_0xb874('0x31')](_0x45ef20[_0xb874('0x2d')][_0xb874('0x31')]));_0x17e74b['attributes']=_0x17e74b['attributes'][_0xb874('0x32')]?_0x17e74b['attributes']:_0x35489e[_0xb874('0x2c')];if(!_0x45ef20[_0xb874('0x2d')]['hasOwnProperty'](_0xb874('0x33'))){_0x17e74b[_0xb874('0x1e')]=qs['limit'](_0x45ef20['query']['limit']);_0x17e74b['offset']=qs['offset'](_0x45ef20['query'][_0xb874('0x20')]);}_0x17e74b['order']=qs['sort'](_0x45ef20['query']['sort']);_0x17e74b[_0xb874('0x34')]=qs[_0xb874('0x35')](_[_0xb874('0x36')](_0x45ef20[_0xb874('0x2d')],_0x35489e['filters']),_0x426a81);if(_0x45ef20[_0xb874('0x2d')][_0xb874('0x37')]){_0x17e74b[_0xb874('0x34')]=_[_0xb874('0x38')](_0x17e74b[_0xb874('0x34')],{'$or':_[_0xb874('0x28')](_0x426a81,function(_0x55f796){if(_0x55f796[_0xb874('0x2a')]!==_0xb874('0x39')){var _0x14b6ee={};_0x14b6ee[_0x55f796[_0xb874('0x26')]]={'$like':'%'+_0x45ef20[_0xb874('0x2d')]['filter']+'%'};return _0x14b6ee;}})});}_0x17e74b=_[_0xb874('0x38')]({},_0x17e74b,_0x45ef20[_0xb874('0x3a')]);var _0x21309f={'where':_0x17e74b['where']};return db[_0xb874('0x29')]['count'](_0x21309f)['then'](function(_0x41787f){_0x381027[_0xb874('0x1f')]=_0x41787f;if(_0x45ef20['query']['includeAll']){_0x17e74b[_0xb874('0x3b')]=[{'all':!![]}];}return db[_0xb874('0x29')][_0xb874('0x3c')](_0x17e74b);})[_0xb874('0x3d')](function(_0x2f81c1){_0x381027[_0xb874('0x3e')]=_0x2f81c1;return _0x381027;})[_0xb874('0x3d')](respondWithFilteredResult(_0x19fd87,_0x17e74b))[_0xb874('0x3f')](handleError(_0x19fd87,null));};exports[_0xb874('0x40')]=function(_0x3d094d,_0xe93910){var _0x22a500={'raw':![],'where':{'id':_0x3d094d[_0xb874('0x41')]['id']}},_0x57f4b8={};_0x57f4b8[_0xb874('0x2c')]=_[_0xb874('0x2e')](db['VtigerAccount'][_0xb874('0x42')]);_0x57f4b8['query']=_[_0xb874('0x2e')](_0x3d094d[_0xb874('0x2d')]);_0x57f4b8['filters']=_[_0xb874('0x2f')](_0x57f4b8[_0xb874('0x2c')],_0x57f4b8[_0xb874('0x2d')]);_0x22a500['attributes']=_[_0xb874('0x2f')](_0x57f4b8[_0xb874('0x2c')],qs[_0xb874('0x31')](_0x3d094d[_0xb874('0x2d')][_0xb874('0x31')]));_0x22a500[_0xb874('0x30')]=_0x22a500[_0xb874('0x30')][_0xb874('0x32')]?_0x22a500[_0xb874('0x30')]:_0x57f4b8[_0xb874('0x2c')];if(_0x3d094d['query']['includeAll']){_0x22a500[_0xb874('0x3b')]=[{'all':!![]}];}_0x22a500=_['merge']({},_0x22a500,_0x3d094d['options']);return db['VtigerAccount'][_0xb874('0x43')](_0x22a500)[_0xb874('0x3d')](handleEntityNotFound(_0xe93910,null))[_0xb874('0x3d')](respondWithResult(_0xe93910,null))[_0xb874('0x3f')](handleError(_0xe93910,null));};exports[_0xb874('0x44')]=function(_0x251b0c,_0x457aff){return db[_0xb874('0x29')][_0xb874('0x44')](_0x251b0c[_0xb874('0x45')],{})['then'](respondWithResult(_0x457aff,0xc9))[_0xb874('0x3f')](handleError(_0x457aff,null));};exports[_0xb874('0x46')]=function(_0x54a0b8,_0x57a94d){if(_0x54a0b8[_0xb874('0x45')]['id']){delete _0x54a0b8['body']['id'];}return db[_0xb874('0x29')]['find']({'where':{'id':_0x54a0b8[_0xb874('0x41')]['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0x57a94d,null))[_0xb874('0x3d')](saveUpdates(_0x54a0b8[_0xb874('0x45')],null))[_0xb874('0x3d')](respondWithResult(_0x57a94d,null))[_0xb874('0x3f')](handleError(_0x57a94d,null));};exports[_0xb874('0x25')]=function(_0x4f4d26,_0xf333a5){return db[_0xb874('0x29')][_0xb874('0x43')]({'where':{'id':_0x4f4d26['params']['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0xf333a5,null))[_0xb874('0x3d')](removeEntity(_0xf333a5,null))['catch'](handleError(_0xf333a5,null));};exports['getConfigurations']=function(_0x113461,_0x15294c,_0x212505){var _0x1bacd9={};var _0x404981={};var _0xfbcec7;var _0x4dc364;return db[_0xb874('0x29')][_0xb874('0x47')]({'where':{'id':_0x113461['params']['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0x15294c,null))[_0xb874('0x3d')](function(_0x2773e9){if(_0x2773e9){_0xfbcec7=_0x2773e9;_0x404981[_0xb874('0x2c')]=_['keys'](db[_0xb874('0x48')][_0xb874('0x42')]);_0x404981[_0xb874('0x2d')]=_['keys'](_0x113461[_0xb874('0x2d')]);_0x404981['filters']=_[_0xb874('0x2f')](_0x404981[_0xb874('0x2c')],_0x404981[_0xb874('0x2d')]);_0x1bacd9[_0xb874('0x30')]=_[_0xb874('0x2f')](_0x404981[_0xb874('0x2c')],qs['fields'](_0x113461['query'][_0xb874('0x31')]));_0x1bacd9['attributes']=_0x1bacd9[_0xb874('0x30')][_0xb874('0x32')]?_0x1bacd9[_0xb874('0x30')]:_0x404981[_0xb874('0x2c')];_0x1bacd9[_0xb874('0x49')]=qs[_0xb874('0x4a')](_0x113461[_0xb874('0x2d')]['sort']);_0x1bacd9[_0xb874('0x34')]=qs[_0xb874('0x35')](_[_0xb874('0x36')](_0x113461[_0xb874('0x2d')],_0x404981[_0xb874('0x35')]));if(_0x113461[_0xb874('0x2d')][_0xb874('0x37')]){_0x1bacd9['where']=_[_0xb874('0x38')](_0x1bacd9[_0xb874('0x34')],{'$or':_[_0xb874('0x28')](_0x1bacd9[_0xb874('0x30')],function(_0x54fce1){var _0x14c851={};_0x14c851[_0x54fce1]={'$like':'%'+_0x113461['query'][_0xb874('0x37')]+'%'};return _0x14c851;})});}_0x1bacd9=_[_0xb874('0x38')]({},_0x1bacd9,_0x113461[_0xb874('0x3a')]);return _0xfbcec7['getConfigurations'](_0x1bacd9);}})[_0xb874('0x3d')](function(_0x11330d){if(_0x11330d){_0x4dc364=_0x11330d[_0xb874('0x32')];if(!_0x113461['query'][_0xb874('0x4b')]('nolimit')){_0x1bacd9[_0xb874('0x1e')]=qs['limit'](_0x113461[_0xb874('0x2d')]['limit']);_0x1bacd9[_0xb874('0x20')]=qs[_0xb874('0x20')](_0x113461[_0xb874('0x2d')][_0xb874('0x20')]);}return _0xfbcec7['getConfigurations'](_0x1bacd9);}})[_0xb874('0x3d')](function(_0x1a2ebb){if(_0x1a2ebb){return _0x1a2ebb?{'count':_0x4dc364,'rows':_0x1a2ebb}:null;}})[_0xb874('0x3d')](respondWithResult(_0x15294c,null))[_0xb874('0x3f')](handleError(_0x15294c,null));};exports[_0xb874('0x4c')]=function(_0x3bb793,_0x1a5f7f,_0x2f7680){if(_0x3bb793[_0xb874('0x45')]['id']){delete _0x3bb793[_0xb874('0x45')]['id'];}return db[_0xb874('0x29')][_0xb874('0x47')]({'where':{'id':_0x3bb793[_0xb874('0x41')]['id']}})[_0xb874('0x3d')](handleEntityNotFound(_0x1a5f7f,null))[_0xb874('0x3d')](function(_0x1631ff){if(_0x1631ff){_0x3bb793[_0xb874('0x45')][_0xb874('0x4d')]=_0x1631ff['id'];_0x3bb793['body'][_0xb874('0x4e')]=integrations[_0xb874('0x4f')](_0x3bb793[_0xb874('0x45')][_0xb874('0x50')],_0x3bb793[_0xb874('0x45')][_0xb874('0x2a')]);_0x3bb793[_0xb874('0x45')][_0xb874('0x51')]=integrations[_0xb874('0x52')](_0x3bb793[_0xb874('0x45')][_0xb874('0x50')],_0x3bb793[_0xb874('0x45')][_0xb874('0x2a')]);return db[_0xb874('0x48')][_0xb874('0x44')](_0x3bb793[_0xb874('0x45')],{'include':[{'model':db['VtigerField'],'as':_0xb874('0x4e')},{'model':db['VtigerField'],'as':_0xb874('0x51')}]});}return null;})[_0xb874('0x3d')](respondWithResult(_0x1a5f7f,null))[_0xb874('0x3f')](handleError(_0x1a5f7f,null));};var md5=require('md5');exports[_0xb874('0x53')]=function(_0x557c7d,_0xebd78a,_0x279ee8){var _0x3e5290=null;var _0x4de7dd=null;var _0x50e205=null;var _0x22b9b9=null;var _0x3ac06e='';return db[_0xb874('0x29')]['findOne']({'where':{'id':_0x557c7d[_0xb874('0x41')]['id']},'attributes':['id',_0xb874('0x26'),_0xb874('0x54'),_0xb874('0x55'),_0xb874('0x56'),_0xb874('0x57'),_0xb874('0x58'),'accessKey']})[_0xb874('0x3d')](handleEntityNotFound(_0xebd78a,null))[_0xb874('0x3d')](function(_0x4bb119){if(_0x4bb119){_0x3e5290=_0x4bb119[_0xb874('0x54')];_0x4de7dd=_0x4bb119[_0xb874('0x59')];_0x50e205=_0x4bb119[_0xb874('0x56')];_0x3ac06e=_0x4bb119['remoteUri'];var _0x3706f9=_0x3ac06e[_0xb874('0x5a')](-0x1);if(_0x3706f9==='/'){_0x3ac06e=_0x3ac06e[_0xb874('0x5b')](0x0,_0x3ac06e[_0xb874('0x5c')](_0x3706f9));}_0x22b9b9=util[_0xb874('0x5d')](_0xb874('0x5e'),_0x3ac06e);var _0x3b0629={'method':'GET','uri':_0x22b9b9,'qs':{'operation':_0xb874('0x5f'),'username':_0x4bb119[_0xb874('0x54')]},'json':!![]};return rp(_0x3b0629);}})[_0xb874('0x3d')](function(_0x2802df){if(_0x2802df[_0xb874('0x60')]){var _0x34801f={'method':_0xb874('0x61'),'uri':_0x22b9b9,'form':{'operation':_0xb874('0x62'),'username':_0x3e5290,'accessKey':md5(_0x2802df[_0xb874('0x63')][_0xb874('0x64')]+_0x4de7dd)},'json':!![]};return rp(_0x34801f);}})['then'](function(_0x3939cd){if(_0x3939cd['success']){var _0x5cd7b9={'method':_0xb874('0x65'),'uri':_0x22b9b9,'qs':{'operation':_0xb874('0x66'),'username':_0x3e5290,'sessionName':_0x3939cd[_0xb874('0x63')][_0xb874('0x67')],'elementType':_0x50e205},'json':!![]};return rp(_0x5cd7b9);}})[_0xb874('0x3d')](function(_0x169dc8){if(_0x169dc8[_0xb874('0x60')]){var _0x5df1e6=[_0xb874('0x68'),_0xb874('0x69'),_0xb874('0x6a')];_[_0xb874('0x6b')](_0x169dc8[_0xb874('0x63')][_0xb874('0x31')],function(_0x2dd025){return _0x5df1e6[_0xb874('0x6c')](_0x2dd025['type'][_0xb874('0x26')]);});_[_0xb874('0x6b')](_0x169dc8[_0xb874('0x63')]['fields'],function(_0x492263){return _0x492263[_0xb874('0x6d')]===_0xb874('0x6e');});return{'count':_0x169dc8[_0xb874('0x63')]['fields']['length'],'rows':_[_0xb874('0x28')](_0x169dc8[_0xb874('0x63')][_0xb874('0x31')],function(_0x203cbc){return{'id':_0x203cbc[_0xb874('0x26')],'name':_0x203cbc[_0xb874('0x6f')],'custom':_[_0xb874('0x70')](_0x203cbc[_0xb874('0x26')],_0xb874('0x71'))?!![]:![],'options':_0x203cbc[_0xb874('0x2a')][_0xb874('0x26')]===_0xb874('0x72')&&_0x203cbc[_0xb874('0x2a')][_0xb874('0x73')]['length']>0x0?_[_0xb874('0x28')](_0x203cbc[_0xb874('0x2a')]['picklistValues'],function(_0x983c39){return{'name':_0x983c39[_0xb874('0x6f')],'value':_0x983c39[_0xb874('0x74')]};}):[]};})};}})['then'](respondWithResult(_0xebd78a,null))[_0xb874('0x3f')](function(_0x1f015b){console[_0xb874('0x75')](_0xb874('0x76')+_0x1f015b);var _0x1ce3cc=_0x557c7d[_0xb874('0x2d')][_0xb874('0x77')]?0x1f4:_0x1f015b[_0xb874('0x78')]||0x1f4;logger[_0xb874('0x79')](_0xb874('0x7a'),_0xb874('0x53'),_0x1ce3cc,JSON[_0xb874('0x7b')](_0x1f015b));delete _0x1f015b['name'];if(_0x1ce3cc===0x191){_0x1ce3cc=0x190;}_0xebd78a[_0xb874('0x1a')](_0x1ce3cc)['send'](_0x557c7d[_0xb874('0x2d')][_0xb874('0x77')]?{'message':_0xb874('0x7c'),'statusCode':_0x1f015b[_0xb874('0x78')]}:_0x1f015b);});}; \ No newline at end of file +var _0x263a=['../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','merge','where','options','VtigerAccount','includeAll','findAll','rows','catch','show','params','length','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','addConfiguration','AccountId','Subjects','Descriptions','getDescriptions','channel','VtigerField','md5','getFields','description','serverUrl','accessKey','username','moduleName','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','getchallenge','success','POST','login','result','token','sessionName','owner','remove','includes','editable','label','picklist','picklistValues','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x278d8d,_0x458be8){var _0x8a6be7=function(_0xbefe2b){while(--_0xbefe2b){_0x278d8d['push'](_0x278d8d['shift']());}};_0x8a6be7(++_0x458be8);}(_0x263a,0x147));var _0xa263=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x263a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa263('0x0'));var rimraf=require(_0xa263('0x1'));var zipdir=require(_0xa263('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa263('0x3'));var moment=require('moment');var BPromise=require(_0xa263('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xa263('0x5'));var csv=require(_0xa263('0x6'));var ejs=require(_0xa263('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa263('0x8'));var squel=require(_0xa263('0x9'));var crypto=require(_0xa263('0xa'));var jsforce=require(_0xa263('0xb'));var deskjs=require(_0xa263('0xc'));var toCsv=require(_0xa263('0x6'));var querystring=require(_0xa263('0xd'));var Papa=require('papaparse');var Redis=require(_0xa263('0xe'));var authService=require(_0xa263('0xf'));var qs=require(_0xa263('0x10'));var as=require(_0xa263('0x11'));var hardwareService=require(_0xa263('0x12'));var logger=require(_0xa263('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xa263('0x14'));var licenseUtil=require(_0xa263('0x15'));var db=require(_0xa263('0x16'))['db'];var integrations=require(_0xa263('0x17'));function respondWithStatusCode(_0x5033bb,_0x1f0b86){_0x1f0b86=_0x1f0b86||0xcc;return function(_0x2e9c01){if(_0x2e9c01){return _0x5033bb[_0xa263('0x18')](_0x1f0b86);}return _0x5033bb[_0xa263('0x19')](_0x1f0b86)[_0xa263('0x1a')]();};}function respondWithResult(_0x17ac8a,_0x307b73){_0x307b73=_0x307b73||0xc8;return function(_0x1eb90f){if(_0x1eb90f){return _0x17ac8a[_0xa263('0x19')](_0x307b73)[_0xa263('0x1b')](_0x1eb90f);}};}function respondWithFilteredResult(_0x141bce,_0x1d684d){return function(_0x5b0426){if(_0x5b0426){var _0x1016d4=typeof _0x1d684d['offset']===_0xa263('0x1c')&&typeof _0x1d684d[_0xa263('0x1d')]===_0xa263('0x1c');var _0x93d27c=_0x5b0426[_0xa263('0x1e')];var _0x63d373=_0x1016d4?0x0:_0x1d684d['offset'];var _0x4afe40=_0x1016d4?_0x5b0426[_0xa263('0x1e')]:_0x1d684d[_0xa263('0x1f')]+_0x1d684d['limit'];var _0x557275;if(_0x4afe40>=_0x93d27c){_0x4afe40=_0x93d27c;_0x557275=0xc8;}else{_0x557275=0xce;}_0x141bce['status'](_0x557275);return _0x141bce['set']('Content-Range',_0x63d373+'-'+_0x4afe40+'/'+_0x93d27c)[_0xa263('0x1b')](_0x5b0426);}return null;};}function patchUpdates(_0x461c36){return function(_0x273738){try{jsonpatch[_0xa263('0x20')](_0x273738,_0x461c36,!![]);}catch(_0x4477bd){return BPromise[_0xa263('0x21')](_0x4477bd);}return _0x273738['save']();};}function saveUpdates(_0x166567,_0x4333f2){return function(_0x25c9de){if(_0x25c9de){return _0x25c9de[_0xa263('0x22')](_0x166567)['then'](function(_0x66bb23){return _0x66bb23;});}return null;};}function removeEntity(_0x2cce7,_0x6c32a0){return function(_0x34c597){if(_0x34c597){return _0x34c597['destroy']()[_0xa263('0x23')](function(){_0x2cce7[_0xa263('0x19')](0xcc)[_0xa263('0x1a')]();});}};}function handleEntityNotFound(_0x28e243,_0x3d7eaf){return function(_0x3f4756){if(!_0x3f4756){_0x28e243['sendStatus'](0x194);}return _0x3f4756;};}function handleError(_0x3c907e,_0x23c96f){_0x23c96f=_0x23c96f||0x1f4;return function(_0x20d954){logger[_0xa263('0x24')](_0x20d954['stack']);if(_0x20d954[_0xa263('0x25')]){delete _0x20d954['name'];}_0x3c907e['status'](_0x23c96f)[_0xa263('0x26')](_0x20d954);};}exports['index']=function(_0x31fcc4,_0x5c5113){var _0x7acbaa={},_0x1ba301={},_0x151f88={'count':0x0,'rows':[]};var _0x3699de=_[_0xa263('0x27')](db['VtigerAccount'][_0xa263('0x28')],function(_0x2f342b){return{'name':_0x2f342b[_0xa263('0x29')],'type':_0x2f342b[_0xa263('0x2a')][_0xa263('0x2b')]};});_0x1ba301[_0xa263('0x2c')]=_[_0xa263('0x27')](_0x3699de,'name');_0x1ba301[_0xa263('0x2d')]=_[_0xa263('0x2e')](_0x31fcc4[_0xa263('0x2d')]);_0x1ba301[_0xa263('0x2f')]=_[_0xa263('0x30')](_0x1ba301['model'],_0x1ba301[_0xa263('0x2d')]);_0x7acbaa[_0xa263('0x31')]=_[_0xa263('0x30')](_0x1ba301[_0xa263('0x2c')],qs[_0xa263('0x32')](_0x31fcc4[_0xa263('0x2d')][_0xa263('0x32')]));_0x7acbaa[_0xa263('0x31')]=_0x7acbaa[_0xa263('0x31')]['length']?_0x7acbaa[_0xa263('0x31')]:_0x1ba301['model'];if(!_0x31fcc4['query'][_0xa263('0x33')](_0xa263('0x34'))){_0x7acbaa[_0xa263('0x1d')]=qs[_0xa263('0x1d')](_0x31fcc4[_0xa263('0x2d')][_0xa263('0x1d')]);_0x7acbaa[_0xa263('0x1f')]=qs['offset'](_0x31fcc4[_0xa263('0x2d')][_0xa263('0x1f')]);}_0x7acbaa['order']=qs['sort'](_0x31fcc4['query'][_0xa263('0x35')]);_0x7acbaa['where']=qs[_0xa263('0x2f')](_[_0xa263('0x36')](_0x31fcc4[_0xa263('0x2d')],_0x1ba301[_0xa263('0x2f')]),_0x3699de);if(_0x31fcc4[_0xa263('0x2d')][_0xa263('0x37')]){_0x7acbaa['where']=_[_0xa263('0x38')](_0x7acbaa[_0xa263('0x39')],{'$or':_['map'](_0x3699de,function(_0x2527a1){if(_0x2527a1[_0xa263('0x2a')]!=='VIRTUAL'){var _0x35e012={};_0x35e012[_0x2527a1['name']]={'$like':'%'+_0x31fcc4[_0xa263('0x2d')][_0xa263('0x37')]+'%'};return _0x35e012;}})});}_0x7acbaa=_['merge']({},_0x7acbaa,_0x31fcc4[_0xa263('0x3a')]);var _0x5c6e94={'where':_0x7acbaa[_0xa263('0x39')]};return db[_0xa263('0x3b')][_0xa263('0x1e')](_0x5c6e94)['then'](function(_0x14f81d){_0x151f88['count']=_0x14f81d;if(_0x31fcc4[_0xa263('0x2d')][_0xa263('0x3c')]){_0x7acbaa['include']=[{'all':!![]}];}return db[_0xa263('0x3b')][_0xa263('0x3d')](_0x7acbaa);})[_0xa263('0x23')](function(_0x2b02cf){_0x151f88[_0xa263('0x3e')]=_0x2b02cf;return _0x151f88;})[_0xa263('0x23')](respondWithFilteredResult(_0x5c5113,_0x7acbaa))[_0xa263('0x3f')](handleError(_0x5c5113,null));};exports[_0xa263('0x40')]=function(_0xf01e3f,_0x48c841){var _0x5dc375={'raw':![],'where':{'id':_0xf01e3f[_0xa263('0x41')]['id']}},_0xc8e1b8={};_0xc8e1b8[_0xa263('0x2c')]=_[_0xa263('0x2e')](db[_0xa263('0x3b')]['rawAttributes']);_0xc8e1b8[_0xa263('0x2d')]=_['keys'](_0xf01e3f[_0xa263('0x2d')]);_0xc8e1b8['filters']=_[_0xa263('0x30')](_0xc8e1b8[_0xa263('0x2c')],_0xc8e1b8['query']);_0x5dc375[_0xa263('0x31')]=_[_0xa263('0x30')](_0xc8e1b8[_0xa263('0x2c')],qs[_0xa263('0x32')](_0xf01e3f[_0xa263('0x2d')][_0xa263('0x32')]));_0x5dc375['attributes']=_0x5dc375[_0xa263('0x31')][_0xa263('0x42')]?_0x5dc375[_0xa263('0x31')]:_0xc8e1b8['model'];if(_0xf01e3f['query'][_0xa263('0x3c')]){_0x5dc375[_0xa263('0x43')]=[{'all':!![]}];}_0x5dc375=_[_0xa263('0x38')]({},_0x5dc375,_0xf01e3f[_0xa263('0x3a')]);return db['VtigerAccount'][_0xa263('0x44')](_0x5dc375)['then'](handleEntityNotFound(_0x48c841,null))['then'](respondWithResult(_0x48c841,null))['catch'](handleError(_0x48c841,null));};exports[_0xa263('0x45')]=function(_0x5d6854,_0x39eee9){return db[_0xa263('0x3b')][_0xa263('0x45')](_0x5d6854['body'],{})[_0xa263('0x23')](respondWithResult(_0x39eee9,0xc9))[_0xa263('0x3f')](handleError(_0x39eee9,null));};exports[_0xa263('0x22')]=function(_0x114244,_0x5cdefa){if(_0x114244[_0xa263('0x46')]['id']){delete _0x114244[_0xa263('0x46')]['id'];}return db[_0xa263('0x3b')][_0xa263('0x44')]({'where':{'id':_0x114244[_0xa263('0x41')]['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x5cdefa,null))[_0xa263('0x23')](saveUpdates(_0x114244['body'],null))[_0xa263('0x23')](respondWithResult(_0x5cdefa,null))[_0xa263('0x3f')](handleError(_0x5cdefa,null));};exports['destroy']=function(_0x3625c9,_0x24ecf0){return db[_0xa263('0x3b')][_0xa263('0x44')]({'where':{'id':_0x3625c9['params']['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x24ecf0,null))[_0xa263('0x23')](removeEntity(_0x24ecf0,null))['catch'](handleError(_0x24ecf0,null));};exports[_0xa263('0x47')]=function(_0x376a9e,_0x2c9538,_0x39324d){var _0x244cec={};var _0x281bfa={};var _0x50c162;var _0x1b55db;return db[_0xa263('0x3b')][_0xa263('0x48')]({'where':{'id':_0x376a9e[_0xa263('0x41')]['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x2c9538,null))[_0xa263('0x23')](function(_0x5e02a4){if(_0x5e02a4){_0x50c162=_0x5e02a4;_0x281bfa[_0xa263('0x2c')]=_[_0xa263('0x2e')](db[_0xa263('0x49')][_0xa263('0x28')]);_0x281bfa[_0xa263('0x2d')]=_[_0xa263('0x2e')](_0x376a9e[_0xa263('0x2d')]);_0x281bfa['filters']=_[_0xa263('0x30')](_0x281bfa[_0xa263('0x2c')],_0x281bfa['query']);_0x244cec['attributes']=_['intersection'](_0x281bfa['model'],qs['fields'](_0x376a9e['query']['fields']));_0x244cec['attributes']=_0x244cec['attributes'][_0xa263('0x42')]?_0x244cec['attributes']:_0x281bfa[_0xa263('0x2c')];_0x244cec['order']=qs[_0xa263('0x35')](_0x376a9e[_0xa263('0x2d')]['sort']);_0x244cec['where']=qs[_0xa263('0x2f')](_[_0xa263('0x36')](_0x376a9e[_0xa263('0x2d')],_0x281bfa[_0xa263('0x2f')]));if(_0x376a9e[_0xa263('0x2d')][_0xa263('0x37')]){_0x244cec['where']=_[_0xa263('0x38')](_0x244cec[_0xa263('0x39')],{'$or':_['map'](_0x244cec['attributes'],function(_0xe068e9){var _0x42b017={};_0x42b017[_0xe068e9]={'$like':'%'+_0x376a9e[_0xa263('0x2d')][_0xa263('0x37')]+'%'};return _0x42b017;})});}_0x244cec=_['merge']({},_0x244cec,_0x376a9e['options']);return _0x50c162[_0xa263('0x47')](_0x244cec);}})['then'](function(_0x26371b){if(_0x26371b){_0x1b55db=_0x26371b[_0xa263('0x42')];if(!_0x376a9e[_0xa263('0x2d')][_0xa263('0x33')]('nolimit')){_0x244cec['limit']=qs[_0xa263('0x1d')](_0x376a9e[_0xa263('0x2d')][_0xa263('0x1d')]);_0x244cec['offset']=qs[_0xa263('0x1f')](_0x376a9e['query'][_0xa263('0x1f')]);}return _0x50c162['getConfigurations'](_0x244cec);}})[_0xa263('0x23')](function(_0x4f24ee){if(_0x4f24ee){return _0x4f24ee?{'count':_0x1b55db,'rows':_0x4f24ee}:null;}})['then'](respondWithResult(_0x2c9538,null))[_0xa263('0x3f')](handleError(_0x2c9538,null));};exports[_0xa263('0x4a')]=function(_0x520314,_0x35f819,_0x554668){if(_0x520314[_0xa263('0x46')]['id']){delete _0x520314['body']['id'];}return db['VtigerAccount'][_0xa263('0x48')]({'where':{'id':_0x520314[_0xa263('0x41')]['id']}})[_0xa263('0x23')](handleEntityNotFound(_0x35f819,null))[_0xa263('0x23')](function(_0x310bb2){if(_0x310bb2){_0x520314[_0xa263('0x46')][_0xa263('0x4b')]=_0x310bb2['id'];_0x520314[_0xa263('0x46')][_0xa263('0x4c')]=integrations['getSubjects'](_0x520314[_0xa263('0x46')]['channel'],_0x520314['body'][_0xa263('0x2a')]);_0x520314['body'][_0xa263('0x4d')]=integrations[_0xa263('0x4e')](_0x520314['body'][_0xa263('0x4f')],_0x520314[_0xa263('0x46')]['type']);return db[_0xa263('0x49')][_0xa263('0x45')](_0x520314[_0xa263('0x46')],{'include':[{'model':db[_0xa263('0x50')],'as':_0xa263('0x4c')},{'model':db['VtigerField'],'as':_0xa263('0x4d')}]});}return null;})[_0xa263('0x23')](respondWithResult(_0x35f819,null))['catch'](handleError(_0x35f819,null));};var md5=require(_0xa263('0x51'));exports[_0xa263('0x52')]=function(_0x4ce221,_0x16314b,_0x39e1b4){var _0x293a9d=null;var _0x20b161=null;var _0x596c0f=null;var _0x511c00=null;var _0x52f4b4='';return db[_0xa263('0x3b')][_0xa263('0x48')]({'where':{'id':_0x4ce221[_0xa263('0x41')]['id']},'attributes':['id','name','username',_0xa263('0x53'),'moduleName','remoteUri',_0xa263('0x54'),_0xa263('0x55')]})[_0xa263('0x23')](handleEntityNotFound(_0x16314b,null))['then'](function(_0x54e78a){if(_0x54e78a){_0x293a9d=_0x54e78a[_0xa263('0x56')];_0x20b161=_0x54e78a['accessKey'];_0x596c0f=_0x54e78a[_0xa263('0x57')];_0x52f4b4=_0x54e78a[_0xa263('0x58')];var _0x40bad5=_0x52f4b4[_0xa263('0x59')](-0x1);if(_0x40bad5==='/'){_0x52f4b4=_0x52f4b4[_0xa263('0x5a')](0x0,_0x52f4b4[_0xa263('0x5b')](_0x40bad5));}_0x511c00=util[_0xa263('0x5c')](_0xa263('0x5d'),_0x52f4b4);var _0x5d4c90={'method':'GET','uri':_0x511c00,'qs':{'operation':_0xa263('0x5e'),'username':_0x54e78a[_0xa263('0x56')]},'json':!![]};return rp(_0x5d4c90);}})['then'](function(_0x4ab5f4){if(_0x4ab5f4[_0xa263('0x5f')]){var _0x1dcb0b={'method':_0xa263('0x60'),'uri':_0x511c00,'form':{'operation':_0xa263('0x61'),'username':_0x293a9d,'accessKey':md5(_0x4ab5f4[_0xa263('0x62')][_0xa263('0x63')]+_0x20b161)},'json':!![]};return rp(_0x1dcb0b);}})[_0xa263('0x23')](function(_0x23cf4a){if(_0x23cf4a[_0xa263('0x5f')]){var _0x1dd40f={'method':'GET','uri':_0x511c00,'qs':{'operation':'describe','username':_0x293a9d,'sessionName':_0x23cf4a[_0xa263('0x62')][_0xa263('0x64')],'elementType':_0x596c0f},'json':!![]};return rp(_0x1dd40f);}})[_0xa263('0x23')](function(_0xb5d8a2){if(_0xb5d8a2[_0xa263('0x5f')]){var _0x375dc0=['autogenerated','reference',_0xa263('0x65')];_[_0xa263('0x66')](_0xb5d8a2['result'][_0xa263('0x32')],function(_0x42c64e){return _0x375dc0[_0xa263('0x67')](_0x42c64e['type'][_0xa263('0x25')]);});_[_0xa263('0x66')](_0xb5d8a2[_0xa263('0x62')][_0xa263('0x32')],function(_0x1ba2ac){return _0x1ba2ac[_0xa263('0x68')]==='false';});return{'count':_0xb5d8a2[_0xa263('0x62')][_0xa263('0x32')][_0xa263('0x42')],'rows':_[_0xa263('0x27')](_0xb5d8a2[_0xa263('0x62')][_0xa263('0x32')],function(_0x5ee57d){return{'id':_0x5ee57d[_0xa263('0x25')],'name':_0x5ee57d[_0xa263('0x69')],'custom':_['startsWith'](_0x5ee57d['name'],'cf_')?!![]:![],'options':_0x5ee57d[_0xa263('0x2a')][_0xa263('0x25')]===_0xa263('0x6a')&&_0x5ee57d[_0xa263('0x2a')][_0xa263('0x6b')][_0xa263('0x42')]>0x0?_[_0xa263('0x27')](_0x5ee57d[_0xa263('0x2a')][_0xa263('0x6b')],function(_0x2852e7){return{'name':_0x2852e7[_0xa263('0x69')],'value':_0x2852e7['value']};}):[]};})};}})[_0xa263('0x23')](respondWithResult(_0x16314b,null))[_0xa263('0x3f')](function(_0x514500){console[_0xa263('0x6c')](_0xa263('0x6d')+_0x514500);var _0x5ef1f8=_0x4ce221['query'][_0xa263('0x6e')]?0x1f4:_0x514500[_0xa263('0x6f')]||0x1f4;logger['error'](_0xa263('0x70'),_0xa263('0x52'),_0x5ef1f8,JSON[_0xa263('0x71')](_0x514500));delete _0x514500[_0xa263('0x25')];if(_0x5ef1f8===0x191){_0x5ef1f8=0x190;}_0x16314b[_0xa263('0x19')](_0x5ef1f8)[_0xa263('0x26')](_0x4ce221['query'][_0xa263('0x6e')]?{'message':_0xa263('0x72'),'statusCode':_0x514500['statusCode']}:_0x514500);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 3f56f1d..7a61590 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 _0x7268=['./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7268,0x1d4));var _0x8726=function(_0x529a29,_0x55c8a5){_0x529a29=_0x529a29-0x0;var _0x5ba288=_0x7268[_0x529a29];return _0x5ba288;};'use strict';var _=require(_0x8726('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8726('0x1'));var moment=require(_0x8726('0x2'));var BPromise=require(_0x8726('0x3'));var rp=require(_0x8726('0x4'));var fs=require('fs');var path=require(_0x8726('0x5'));var rimraf=require(_0x8726('0x6'));var config=require(_0x8726('0x7'));var attributes=require(_0x8726('0x8'));var integrations=require(_0x8726('0x9'));module[_0x8726('0xa')]=function(_0x282feb,_0x5c127d){return _0x282feb[_0x8726('0xb')](_0x8726('0xc'),attributes,{'tableName':_0x8726('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b50=['lodash','util','../../config/logger','api','moment','path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts'];(function(_0x2075ca,_0x38a103){var _0xc9b8e0=function(_0x11dd90){while(--_0x11dd90){_0x2075ca['push'](_0x2075ca['shift']());}};_0xc9b8e0(++_0x38a103);}(_0x1b50,0xea));var _0x01b5=function(_0x29d32b,_0x1bc829){_0x29d32b=_0x29d32b-0x0;var _0x27e2e1=_0x1b50[_0x29d32b];return _0x27e2e1;};'use strict';var _=require(_0x01b5('0x0'));var util=require(_0x01b5('0x1'));var logger=require(_0x01b5('0x2'))(_0x01b5('0x3'));var moment=require(_0x01b5('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x01b5('0x5'));var rimraf=require(_0x01b5('0x6'));var config=require('../../config/environment');var attributes=require(_0x01b5('0x7'));var integrations=require(_0x01b5('0x8'));module[_0x01b5('0x9')]=function(_0x1e984a,_0x453867){return _0x1e984a[_0x01b5('0xa')](_0x01b5('0xb'),attributes,{'tableName':_0x01b5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index fdab3bc..661c9bb 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 _0xe706=['options','raw','where','attributes','limit','include','map','model','stringify','ShowVtigerAccount','VtigerAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVtigerAccount','findAll'];(function(_0xb007e7,_0x229847){var _0x22de13=function(_0x25487c){while(--_0x25487c){_0xb007e7['push'](_0xb007e7['shift']());}};_0x22de13(++_0x229847);}(_0xe706,0xa3));var _0x6e70=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0xe706[_0x28fe94];return _0x3560da;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var moment=require(_0x6e70('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e70('0x3'));var fs=require('fs');var Redis=require(_0x6e70('0x4'));var db=require(_0x6e70('0x5'))['db'];var utils=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));var config=require(_0x6e70('0x9'));var jayson=require(_0x6e70('0xa'));var client=jayson[_0x6e70('0xb')][_0x6e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36357b,_0x293ce7,_0x45a2d4){return new BPromise(function(_0x188ed3,_0x3c4843){return client[_0x6e70('0xd')](_0x36357b,_0x45a2d4)[_0x6e70('0xe')](function(_0x25e61c){logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,_0x6e70('0x11'));logger[_0x6e70('0x12')](_0x6e70('0x13'),_0x293ce7,_0x6e70('0x11'),JSON['stringify'](_0x25e61c));if(_0x25e61c['error']){if(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x15')]===0x1f4){logger[_0x6e70('0x14')](_0x6e70('0x10'),_0x293ce7,_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);return _0x3c4843(_0x25e61c[_0x6e70('0x14')][_0x6e70('0x16')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x25e61c['error'][_0x6e70('0x16')]);return _0x188ed3(_0x25e61c['error']['message']);}else{logger[_0x6e70('0xf')](_0x6e70('0x10'),_0x293ce7,'request\x20sent');_0x188ed3(_0x25e61c[_0x6e70('0x17')]['message']);}})[_0x6e70('0x18')](function(_0x161f23){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});}exports[_0x6e70('0x19')]=function(_0x5ea7a5){var _0x28a21f=this;return new Promise(function(_0x173afe,_0x53acdc){return db['VtigerAccount'][_0x6e70('0x1a')]({'raw':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'limit':_0x5ea7a5['options']?_0x5ea7a5[_0x6e70('0x1b')][_0x6e70('0x1f')]||null:null,'include':_0x5ea7a5[_0x6e70('0x1b')]?_0x5ea7a5['options'][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x5ea7a5[_0x6e70('0x1b')]['include'],function(_0x10fc91){return{'model':db[_0x10fc91['model']],'as':_0x10fc91['as'],'attributes':_0x10fc91['attributes'],'include':_0x10fc91['include']?_[_0x6e70('0x21')](_0x10fc91[_0x6e70('0x20')],function(_0x51d292){return{'model':db[_0x51d292[_0x6e70('0x22')]],'as':_0x51d292['as'],'attributes':_0x51d292[_0x6e70('0x1e')],'include':_0x51d292['include']?_[_0x6e70('0x21')](_0x51d292[_0x6e70('0x20')],function(_0x2bb231){return{'model':db[_0x2bb231['model']],'as':_0x2bb231['as'],'attributes':_0x2bb231['attributes']};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x3af17f){logger[_0x6e70('0xf')](_0x6e70('0x19'),_0x5ea7a5);logger[_0x6e70('0x12')]('GetVtigerAccount',_0x5ea7a5,JSON[_0x6e70('0x23')](_0x3af17f));_0x173afe(_0x3af17f);})[_0x6e70('0x18')](function(_0xecf336){logger[_0x6e70('0x14')](_0x6e70('0x19'),_0xecf336[_0x6e70('0x16')],_0x5ea7a5);_0x53acdc(_0x28a21f[_0x6e70('0x14')](0x1f4,_0xecf336[_0x6e70('0x16')]));});});};exports[_0x6e70('0x24')]=function(_0x3a5d30){var _0x4b1229=this;return new Promise(function(_0x1b27d8,_0x50d60b){return db[_0x6e70('0x25')]['find']({'raw':_0x3a5d30[_0x6e70('0x1b')]?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1c')]===undefined?!![]:![]:!![],'where':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1d')]||null:null,'attributes':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x1e')]||null:null,'include':_0x3a5d30['options']?_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3a5d30[_0x6e70('0x1b')][_0x6e70('0x20')],function(_0x1e3e76){return{'model':db[_0x1e3e76[_0x6e70('0x22')]],'as':_0x1e3e76['as'],'attributes':_0x1e3e76[_0x6e70('0x1e')],'include':_0x1e3e76[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x1e3e76['include'],function(_0x3b9c06){return{'model':db[_0x3b9c06['model']],'as':_0x3b9c06['as'],'attributes':_0x3b9c06[_0x6e70('0x1e')],'include':_0x3b9c06[_0x6e70('0x20')]?_[_0x6e70('0x21')](_0x3b9c06[_0x6e70('0x20')],function(_0x233a83){return{'model':db[_0x233a83[_0x6e70('0x22')]],'as':_0x233a83['as'],'attributes':_0x233a83[_0x6e70('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x6e70('0xe')](function(_0x80bebb){logger[_0x6e70('0xf')](_0x6e70('0x24'),_0x3a5d30);logger[_0x6e70('0x12')](_0x6e70('0x24'),_0x3a5d30,JSON['stringify'](_0x80bebb));_0x1b27d8(_0x80bebb);})['catch'](function(_0x5424eb){logger[_0x6e70('0x14')](_0x6e70('0x24'),_0x5424eb[_0x6e70('0x16')],_0x3a5d30);_0x50d60b(_0x4b1229[_0x6e70('0x14')](0x1f4,_0x5424eb[_0x6e70('0x16')]));});});}; \ No newline at end of file +var _0x351d=['findAll','options','attributes','include','map','model','then','catch','ShowVtigerAccount','find','raw','where','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','VtigerAccount,\x20%s,\x20%s','message','result','GetVtigerAccount','VtigerAccount'];(function(_0x54f507,_0x4769c0){var _0x4297aa=function(_0x5e1a33){while(--_0x5e1a33){_0x54f507['push'](_0x54f507['shift']());}};_0x4297aa(++_0x4769c0);}(_0x351d,0x90));var _0xd351=function(_0x5432fa,_0x58f953){_0x5432fa=_0x5432fa-0x0;var _0x217c3d=_0x351d[_0x5432fa];return _0x217c3d;};'use strict';var _=require(_0xd351('0x0'));var util=require('util');var moment=require(_0xd351('0x1'));var BPromise=require(_0xd351('0x2'));var rs=require(_0xd351('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd351('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xd351('0x5'))(_0xd351('0x6'));var config=require('../../config/environment');var jayson=require(_0xd351('0x7'));var client=jayson[_0xd351('0x8')][_0xd351('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5318b2,_0x16b3f7,_0x235aa0){return new BPromise(function(_0x4e1b06,_0x2e9a2a){return client[_0xd351('0xa')](_0x5318b2,_0x235aa0)['then'](function(_0x586c60){logger[_0xd351('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'));logger[_0xd351('0xd')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x16b3f7,_0xd351('0xc'),JSON[_0xd351('0xe')](_0x586c60));if(_0x586c60['error']){if(_0x586c60[_0xd351('0xf')]['code']===0x1f4){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);return _0x2e9a2a(_0x586c60[_0xd351('0xf')]['message']);}logger[_0xd351('0xf')](_0xd351('0x10'),_0x16b3f7,_0x586c60['error'][_0xd351('0x11')]);return _0x4e1b06(_0x586c60[_0xd351('0xf')][_0xd351('0x11')]);}else{logger[_0xd351('0xb')](_0xd351('0x10'),_0x16b3f7,'request\x20sent');_0x4e1b06(_0x586c60[_0xd351('0x12')]['message']);}})['catch'](function(_0x2c6708){logger['error'](_0xd351('0x10'),_0x16b3f7,_0x2c6708);_0x2e9a2a(_0x2c6708);});});}exports[_0xd351('0x13')]=function(_0x4e0164){var _0x4c6693=this;return new Promise(function(_0x1e1a3c,_0x2bfc53){return db[_0xd351('0x14')][_0xd351('0x15')]({'raw':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4e0164['options']?_0x4e0164[_0xd351('0x16')]['where']||null:null,'attributes':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x17')]||null:null,'limit':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')]['limit']||null:null,'include':_0x4e0164[_0xd351('0x16')]?_0x4e0164[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x4e0164[_0xd351('0x16')][_0xd351('0x18')],function(_0x365bbc){return{'model':db[_0x365bbc['model']],'as':_0x365bbc['as'],'attributes':_0x365bbc[_0xd351('0x17')],'include':_0x365bbc[_0xd351('0x18')]?_[_0xd351('0x19')](_0x365bbc[_0xd351('0x18')],function(_0x489c9a){return{'model':db[_0x489c9a[_0xd351('0x1a')]],'as':_0x489c9a['as'],'attributes':_0x489c9a['attributes'],'include':_0x489c9a[_0xd351('0x18')]?_[_0xd351('0x19')](_0x489c9a['include'],function(_0x2648d0){return{'model':db[_0x2648d0['model']],'as':_0x2648d0['as'],'attributes':_0x2648d0['attributes']};}):[]};}):[]};}):[]:[]})[_0xd351('0x1b')](function(_0x560be9){logger['info'](_0xd351('0x13'),_0x4e0164);logger['debug'](_0xd351('0x13'),_0x4e0164,JSON[_0xd351('0xe')](_0x560be9));_0x1e1a3c(_0x560be9);})[_0xd351('0x1c')](function(_0x4d3f48){logger[_0xd351('0xf')]('GetVtigerAccount',_0x4d3f48[_0xd351('0x11')],_0x4e0164);_0x2bfc53(_0x4c6693['error'](0x1f4,_0x4d3f48['message']));});});};exports[_0xd351('0x1d')]=function(_0x38c82f){var _0x3f9ef3=this;return new Promise(function(_0x33b43d,_0x48aa96){return db[_0xd351('0x14')][_0xd351('0x1e')]({'raw':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x1f')]===undefined?!![]:![]:!![],'where':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x20')]||null:null,'attributes':_0x38c82f[_0xd351('0x16')]?_0x38c82f['options'][_0xd351('0x17')]||null:null,'include':_0x38c82f[_0xd351('0x16')]?_0x38c82f[_0xd351('0x16')][_0xd351('0x18')]?_['map'](_0x38c82f[_0xd351('0x16')][_0xd351('0x18')],function(_0x3d5b7f){return{'model':db[_0x3d5b7f[_0xd351('0x1a')]],'as':_0x3d5b7f['as'],'attributes':_0x3d5b7f[_0xd351('0x17')],'include':_0x3d5b7f[_0xd351('0x18')]?_[_0xd351('0x19')](_0x3d5b7f[_0xd351('0x18')],function(_0x238663){return{'model':db[_0x238663['model']],'as':_0x238663['as'],'attributes':_0x238663['attributes'],'include':_0x238663[_0xd351('0x18')]?_[_0xd351('0x19')](_0x238663[_0xd351('0x18')],function(_0x2907b7){return{'model':db[_0x2907b7[_0xd351('0x1a')]],'as':_0x2907b7['as'],'attributes':_0x2907b7[_0xd351('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47e2fa){logger[_0xd351('0xb')]('ShowVtigerAccount',_0x38c82f);logger[_0xd351('0xd')](_0xd351('0x1d'),_0x38c82f,JSON[_0xd351('0xe')](_0x47e2fa));_0x33b43d(_0x47e2fa);})[_0xd351('0x1c')](function(_0x33307){logger[_0xd351('0xf')](_0xd351('0x1d'),_0x33307[_0xd351('0x11')],_0x38c82f);_0x48aa96(_0x3f9ef3[_0xd351('0xf')](0x1f4,_0x33307[_0xd351('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 7ef9142..16b781a 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 _0x1022=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id/fields','getFields','getSubjects','post','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x8bddc7,_0xd736ef){var _0x415028=function(_0x130a33){while(--_0x130a33){_0x8bddc7['push'](_0x8bddc7['shift']());}};_0x415028(++_0xd736ef);}(_0x1022,0x6a));var _0x2102=function(_0x132aed,_0x2eaf18){_0x132aed=_0x132aed-0x0;var _0x5ece16=_0x1022[_0x132aed];return _0x5ece16;};'use strict';var multer=require(_0x2102('0x0'));var util=require('util');var path=require(_0x2102('0x1'));var timeout=require(_0x2102('0x2'));var express=require(_0x2102('0x3'));var router=express['Router']();var fs_extra=require(_0x2102('0x4'));var auth=require(_0x2102('0x5'));var interaction=require(_0x2102('0x6'));var config=require(_0x2102('0x7'));var controller=require(_0x2102('0x8'));router[_0x2102('0x9')]('/',auth[_0x2102('0xa')](),controller[_0x2102('0xb')]);router[_0x2102('0x9')]('/:id',auth[_0x2102('0xa')](),controller['show']);router[_0x2102('0x9')](_0x2102('0xc'),auth[_0x2102('0xa')](),controller[_0x2102('0xd')]);router[_0x2102('0x9')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x2102('0xe')]);router['get']('/:id/descriptions',auth[_0x2102('0xa')](),controller['getDescriptions']);router[_0x2102('0xf')]('/',auth[_0x2102('0xa')](),controller['create']);router[_0x2102('0x10')](_0x2102('0x11'),auth[_0x2102('0xa')](),controller[_0x2102('0x12')]);router[_0x2102('0x13')](_0x2102('0x11'),auth[_0x2102('0xa')](),controller[_0x2102('0x14')]);module[_0x2102('0x15')]=router; \ No newline at end of file +var _0x2a4f=['put','update','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intVtigerConfiguration.controller','isAuthenticated','index','/:id','show','/:id/fields','get','/:id/subjects','/:id/descriptions','getDescriptions','create'];(function(_0x45c48f,_0x4aa891){var _0xaf5037=function(_0x3e3c1f){while(--_0x3e3c1f){_0x45c48f['push'](_0x45c48f['shift']());}};_0xaf5037(++_0x4aa891);}(_0x2a4f,0xf7));var _0xf2a4=function(_0x1b361c,_0x1e904a){_0x1b361c=_0x1b361c-0x0;var _0x4440a1=_0x2a4f[_0x1b361c];return _0x4440a1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf2a4('0x0'));var timeout=require(_0xf2a4('0x1'));var express=require(_0xf2a4('0x2'));var router=express['Router']();var fs_extra=require(_0xf2a4('0x3'));var auth=require(_0xf2a4('0x4'));var interaction=require(_0xf2a4('0x5'));var config=require('../../config/environment');var controller=require(_0xf2a4('0x6'));router['get']('/',auth[_0xf2a4('0x7')](),controller[_0xf2a4('0x8')]);router['get'](_0xf2a4('0x9'),auth[_0xf2a4('0x7')](),controller[_0xf2a4('0xa')]);router['get'](_0xf2a4('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0xf2a4('0xc')](_0xf2a4('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xf2a4('0xc')](_0xf2a4('0xe'),auth['isAuthenticated'](),controller[_0xf2a4('0xf')]);router['post']('/',auth[_0xf2a4('0x7')](),controller[_0xf2a4('0x10')]);router[_0xf2a4('0x11')](_0xf2a4('0x9'),auth[_0xf2a4('0x7')](),controller[_0xf2a4('0x12')]);router[_0xf2a4('0x13')]('/:id',auth['isAuthenticated'](),controller[_0xf2a4('0x14')]);module[_0xf2a4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 4ad4790..5aa3cff 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 _0x412e=['STRING','sequelize','exports'];(function(_0x1b2a94,_0x3715d8){var _0x44d47d=function(_0x4aefe2){while(--_0x4aefe2){_0x1b2a94['push'](_0x1b2a94['shift']());}};_0x44d47d(++_0x3715d8);}(_0x412e,0x67));var _0xe412=function(_0x470b4d,_0x5b797d){_0x470b4d=_0x470b4d-0x0;var _0xa6664e=_0x412e[_0x470b4d];return _0xa6664e;};'use strict';var Sequelize=require(_0xe412('0x0'));module[_0xe412('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe412('0x2')]}}; \ No newline at end of file +var _0x0ba5=['exports','STRING','sequelize'];(function(_0xa1b3fc,_0x4f934a){var _0x248941=function(_0x22a6ff){while(--_0x22a6ff){_0xa1b3fc['push'](_0xa1b3fc['shift']());}};_0x248941(++_0x4f934a);}(_0x0ba5,0xdd));var _0x50ba=function(_0x3477c4,_0x309176){_0x3477c4=_0x3477c4-0x0;var _0xb1b1b5=_0x0ba5[_0x3477c4];return _0xb1b1b5;};'use strict';var Sequelize=require(_0x50ba('0x0'));module[_0x50ba('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x50ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 0b53e34..db3d1d1 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 _0xfc02=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','then','rows','catch','show','params','find','create','findOne','VtigerField','getFields','hasOwnProperty','getSubjects','rawAttributes','order','getDescriptions','eml-format','fast-json-patch','moment','bluebird','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','destroy','end','stack','name','send','index','map','VtigerConfiguration','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort'];(function(_0x44a859,_0xa67ac3){var _0x359d91=function(_0x173de9){while(--_0x173de9){_0x44a859['push'](_0x44a859['shift']());}};_0x359d91(++_0xa67ac3);}(_0xfc02,0x1da));var _0x2fc0=function(_0x2c763e,_0x4654de){_0x2c763e=_0x2c763e-0x0;var _0x53b5b8=_0xfc02[_0x2c763e];return _0x53b5b8;};'use strict';var emlformat=require(_0x2fc0('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2fc0('0x1'));var rp=require('request-promise');var moment=require(_0x2fc0('0x2'));var BPromise=require(_0x2fc0('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x2fc0('0x4'));var csv=require(_0x2fc0('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fc0('0x6'));var _=require(_0x2fc0('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2fc0('0x8'));var toCsv=require('to-csv');var querystring=require(_0x2fc0('0x9'));var Papa=require(_0x2fc0('0xa'));var Redis=require(_0x2fc0('0xb'));var authService=require(_0x2fc0('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2fc0('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x2fc0('0xe'));var utils=require(_0x2fc0('0xf'));var config=require(_0x2fc0('0x10'));var licenseUtil=require('../../config/license/util');var db=require(_0x2fc0('0x11'))['db'];function respondWithStatusCode(_0x528013,_0x2eb2dd){_0x2eb2dd=_0x2eb2dd||0xcc;return function(_0x1957eb){if(_0x1957eb){return _0x528013[_0x2fc0('0x12')](_0x2eb2dd);}return _0x528013['status'](_0x2eb2dd)['end']();};}function respondWithResult(_0x378a72,_0x1d7b06){_0x1d7b06=_0x1d7b06||0xc8;return function(_0x1f5e7b){if(_0x1f5e7b){return _0x378a72[_0x2fc0('0x13')](_0x1d7b06)[_0x2fc0('0x14')](_0x1f5e7b);}};}function respondWithFilteredResult(_0x37aaea,_0x548ce9){return function(_0x4e5ce4){if(_0x4e5ce4){var _0x23f8f6=typeof _0x548ce9[_0x2fc0('0x15')]===_0x2fc0('0x16')&&typeof _0x548ce9['limit']==='undefined';var _0x4c4595=_0x4e5ce4[_0x2fc0('0x17')];var _0x3b43f4=_0x23f8f6?0x0:_0x548ce9[_0x2fc0('0x15')];var _0x4a6ef4=_0x23f8f6?_0x4e5ce4[_0x2fc0('0x17')]:_0x548ce9['offset']+_0x548ce9['limit'];var _0x4ce223;if(_0x4a6ef4>=_0x4c4595){_0x4a6ef4=_0x4c4595;_0x4ce223=0xc8;}else{_0x4ce223=0xce;}_0x37aaea[_0x2fc0('0x13')](_0x4ce223);return _0x37aaea[_0x2fc0('0x18')]('Content-Range',_0x3b43f4+'-'+_0x4a6ef4+'/'+_0x4c4595)[_0x2fc0('0x14')](_0x4e5ce4);}return null;};}function patchUpdates(_0x46fc4a){return function(_0x3e6059){try{jsonpatch[_0x2fc0('0x19')](_0x3e6059,_0x46fc4a,!![]);}catch(_0x3cc6ea){return BPromise[_0x2fc0('0x1a')](_0x3cc6ea);}return _0x3e6059[_0x2fc0('0x1b')]();};}function saveUpdates(_0x270c97,_0x35e22f){return function(_0x2bf22c){if(_0x2bf22c){return _0x2bf22c[_0x2fc0('0x1c')](_0x270c97)['then'](function(_0x5d64c0){return _0x5d64c0;});}return null;};}function removeEntity(_0x239bec,_0x2fa9fb){return function(_0x1ff736){if(_0x1ff736){return _0x1ff736[_0x2fc0('0x1d')]()['then'](function(){_0x239bec['status'](0xcc)[_0x2fc0('0x1e')]();});}};}function handleEntityNotFound(_0x89afbe,_0x158b44){return function(_0x346b08){if(!_0x346b08){_0x89afbe[_0x2fc0('0x12')](0x194);}return _0x346b08;};}function handleError(_0x38f468,_0x26aa49){_0x26aa49=_0x26aa49||0x1f4;return function(_0x5667f9){logger['error'](_0x5667f9[_0x2fc0('0x1f')]);if(_0x5667f9[_0x2fc0('0x20')]){delete _0x5667f9[_0x2fc0('0x20')];}_0x38f468[_0x2fc0('0x13')](_0x26aa49)[_0x2fc0('0x21')](_0x5667f9);};}exports[_0x2fc0('0x22')]=function(_0x1245ee,_0x4d0f60){var _0x3e0585={},_0x5d0d75={},_0x1f67c9={'count':0x0,'rows':[]};var _0x21a022=_[_0x2fc0('0x23')](db[_0x2fc0('0x24')]['rawAttributes'],function(_0x1c9436){return{'name':_0x1c9436[_0x2fc0('0x25')],'type':_0x1c9436[_0x2fc0('0x26')][_0x2fc0('0x27')]};});_0x5d0d75[_0x2fc0('0x28')]=_[_0x2fc0('0x23')](_0x21a022,_0x2fc0('0x20'));_0x5d0d75[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x1245ee[_0x2fc0('0x29')]);_0x5d0d75[_0x2fc0('0x2b')]=_[_0x2fc0('0x2c')](_0x5d0d75[_0x2fc0('0x28')],_0x5d0d75[_0x2fc0('0x29')]);_0x3e0585[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x5d0d75[_0x2fc0('0x28')],qs[_0x2fc0('0x2e')](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x2e')]));_0x3e0585[_0x2fc0('0x2d')]=_0x3e0585[_0x2fc0('0x2d')][_0x2fc0('0x2f')]?_0x3e0585[_0x2fc0('0x2d')]:_0x5d0d75[_0x2fc0('0x28')];if(!_0x1245ee[_0x2fc0('0x29')]['hasOwnProperty'](_0x2fc0('0x30'))){_0x3e0585[_0x2fc0('0x31')]=qs['limit'](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x3e0585['offset']=qs[_0x2fc0('0x15')](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x15')]);}_0x3e0585['order']=qs['sort'](_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x32')]);_0x3e0585['where']=qs[_0x2fc0('0x2b')](_[_0x2fc0('0x33')](_0x1245ee[_0x2fc0('0x29')],_0x5d0d75[_0x2fc0('0x2b')]),_0x21a022);if(_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0x3e0585[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x3e0585[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x21a022,function(_0x3711d3){if(_0x3711d3['type']!==_0x2fc0('0x37')){var _0x2f4893={};_0x2f4893[_0x3711d3['name']]={'$like':'%'+_0x1245ee[_0x2fc0('0x29')]['filter']+'%'};return _0x2f4893;}})});}_0x3e0585=_[_0x2fc0('0x36')]({},_0x3e0585,_0x1245ee[_0x2fc0('0x38')]);var _0x27e4d1={'where':_0x3e0585[_0x2fc0('0x35')]};return db[_0x2fc0('0x24')][_0x2fc0('0x17')](_0x27e4d1)['then'](function(_0x191a1e){_0x1f67c9['count']=_0x191a1e;if(_0x1245ee[_0x2fc0('0x29')][_0x2fc0('0x39')]){_0x3e0585[_0x2fc0('0x3a')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x2fc0('0x3b')](_0x3e0585);})[_0x2fc0('0x3c')](function(_0x5b4a43){_0x1f67c9[_0x2fc0('0x3d')]=_0x5b4a43;return _0x1f67c9;})[_0x2fc0('0x3c')](respondWithFilteredResult(_0x4d0f60,_0x3e0585))[_0x2fc0('0x3e')](handleError(_0x4d0f60,null));};exports[_0x2fc0('0x3f')]=function(_0x3533cc,_0x115878){var _0x58323a={'raw':![],'where':{'id':_0x3533cc[_0x2fc0('0x40')]['id']}},_0x512c3b={};_0x512c3b['model']=_['keys'](db[_0x2fc0('0x24')]['rawAttributes']);_0x512c3b[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x3533cc[_0x2fc0('0x29')]);_0x512c3b['filters']=_[_0x2fc0('0x2c')](_0x512c3b[_0x2fc0('0x28')],_0x512c3b[_0x2fc0('0x29')]);_0x58323a[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x512c3b['model'],qs['fields'](_0x3533cc['query']['fields']));_0x58323a[_0x2fc0('0x2d')]=_0x58323a[_0x2fc0('0x2d')]['length']?_0x58323a[_0x2fc0('0x2d')]:_0x512c3b['model'];if(_0x3533cc[_0x2fc0('0x29')][_0x2fc0('0x39')]){_0x58323a[_0x2fc0('0x3a')]=[{'all':!![]}];}_0x58323a=_[_0x2fc0('0x36')]({},_0x58323a,_0x3533cc[_0x2fc0('0x38')]);return db['VtigerConfiguration'][_0x2fc0('0x41')](_0x58323a)['then'](handleEntityNotFound(_0x115878,null))[_0x2fc0('0x3c')](respondWithResult(_0x115878,null))[_0x2fc0('0x3e')](handleError(_0x115878,null));};exports[_0x2fc0('0x42')]=function(_0x3eb932,_0x465341){return db[_0x2fc0('0x24')][_0x2fc0('0x42')](_0x3eb932['body'],{})[_0x2fc0('0x3c')](respondWithResult(_0x465341,0xc9))[_0x2fc0('0x3e')](handleError(_0x465341,null));};exports[_0x2fc0('0x1c')]=function(_0x3c1040,_0xbc991c){if(_0x3c1040['body']['id']){delete _0x3c1040['body']['id'];}return db[_0x2fc0('0x24')][_0x2fc0('0x41')]({'where':{'id':_0x3c1040[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0xbc991c,null))[_0x2fc0('0x3c')](saveUpdates(_0x3c1040['body'],null))['then'](respondWithResult(_0xbc991c,null))['catch'](handleError(_0xbc991c,null));};exports[_0x2fc0('0x1d')]=function(_0x5eac1d,_0x264a1a){return db[_0x2fc0('0x24')]['find']({'where':{'id':_0x5eac1d[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x264a1a,null))['then'](removeEntity(_0x264a1a,null))[_0x2fc0('0x3e')](handleError(_0x264a1a,null));};exports['getFields']=function(_0x443d73,_0x25637c,_0x4c700e){var _0x4f13a9={};var _0x3e0cd0={};var _0x56bb86;var _0x39edfe;return db[_0x2fc0('0x24')][_0x2fc0('0x43')]({'where':{'id':_0x443d73[_0x2fc0('0x40')]['id']}})['then'](handleEntityNotFound(_0x25637c,null))['then'](function(_0x2598fd){if(_0x2598fd){_0x56bb86=_0x2598fd;_0x3e0cd0[_0x2fc0('0x28')]=_['keys'](db[_0x2fc0('0x44')]['rawAttributes']);_0x3e0cd0[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x443d73[_0x2fc0('0x29')]);_0x3e0cd0[_0x2fc0('0x2b')]=_[_0x2fc0('0x2c')](_0x3e0cd0[_0x2fc0('0x28')],_0x3e0cd0[_0x2fc0('0x29')]);_0x4f13a9[_0x2fc0('0x2d')]=_['intersection'](_0x3e0cd0['model'],qs[_0x2fc0('0x2e')](_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x2e')]));_0x4f13a9[_0x2fc0('0x2d')]=_0x4f13a9['attributes'][_0x2fc0('0x2f')]?_0x4f13a9[_0x2fc0('0x2d')]:_0x3e0cd0[_0x2fc0('0x28')];_0x4f13a9['order']=qs[_0x2fc0('0x32')](_0x443d73['query'][_0x2fc0('0x32')]);_0x4f13a9['where']=qs[_0x2fc0('0x2b')](_[_0x2fc0('0x33')](_0x443d73['query'],_0x3e0cd0[_0x2fc0('0x2b')]));if(_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0x4f13a9[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x4f13a9[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x4f13a9[_0x2fc0('0x2d')],function(_0x2a178b){var _0x3e1bf6={};_0x3e1bf6[_0x2a178b]={'$like':'%'+_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x34')]+'%'};return _0x3e1bf6;})});}_0x4f13a9=_[_0x2fc0('0x36')]({},_0x4f13a9,_0x443d73[_0x2fc0('0x38')]);return _0x56bb86[_0x2fc0('0x45')](_0x4f13a9);}})[_0x2fc0('0x3c')](function(_0x471d08){if(_0x471d08){_0x39edfe=_0x471d08[_0x2fc0('0x2f')];if(!_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x46')](_0x2fc0('0x30'))){_0x4f13a9[_0x2fc0('0x31')]=qs['limit'](_0x443d73[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x4f13a9[_0x2fc0('0x15')]=qs['offset'](_0x443d73[_0x2fc0('0x29')]['offset']);}return _0x56bb86[_0x2fc0('0x45')](_0x4f13a9);}})[_0x2fc0('0x3c')](function(_0x255afa){if(_0x255afa){return _0x255afa?{'count':_0x39edfe,'rows':_0x255afa}:null;}})[_0x2fc0('0x3c')](respondWithResult(_0x25637c,null))[_0x2fc0('0x3e')](handleError(_0x25637c,null));};exports[_0x2fc0('0x47')]=function(_0x54f8a7,_0x1ef2cd,_0x3914b6){var _0xbd6744={};var _0x59ac4b={};var _0x21eff0;var _0x3ea30a;return db[_0x2fc0('0x24')][_0x2fc0('0x43')]({'where':{'id':_0x54f8a7[_0x2fc0('0x40')]['id']}})[_0x2fc0('0x3c')](handleEntityNotFound(_0x1ef2cd,null))['then'](function(_0x461508){if(_0x461508){_0x21eff0=_0x461508;_0x59ac4b[_0x2fc0('0x28')]=_[_0x2fc0('0x2a')](db[_0x2fc0('0x44')][_0x2fc0('0x48')]);_0x59ac4b[_0x2fc0('0x29')]=_[_0x2fc0('0x2a')](_0x54f8a7['query']);_0x59ac4b[_0x2fc0('0x2b')]=_['intersection'](_0x59ac4b[_0x2fc0('0x28')],_0x59ac4b['query']);_0xbd6744[_0x2fc0('0x2d')]=_[_0x2fc0('0x2c')](_0x59ac4b[_0x2fc0('0x28')],qs[_0x2fc0('0x2e')](_0x54f8a7[_0x2fc0('0x29')]['fields']));_0xbd6744['attributes']=_0xbd6744['attributes'][_0x2fc0('0x2f')]?_0xbd6744[_0x2fc0('0x2d')]:_0x59ac4b[_0x2fc0('0x28')];_0xbd6744[_0x2fc0('0x49')]=qs[_0x2fc0('0x32')](_0x54f8a7['query'][_0x2fc0('0x32')]);_0xbd6744[_0x2fc0('0x35')]=qs['filters'](_[_0x2fc0('0x33')](_0x54f8a7[_0x2fc0('0x29')],_0x59ac4b[_0x2fc0('0x2b')]));if(_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x34')]){_0xbd6744[_0x2fc0('0x35')]=_['merge'](_0xbd6744['where'],{'$or':_['map'](_0xbd6744['attributes'],function(_0x1c43af){var _0x34ff7a={};_0x34ff7a[_0x1c43af]={'$like':'%'+_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x34')]+'%'};return _0x34ff7a;})});}_0xbd6744=_[_0x2fc0('0x36')]({},_0xbd6744,_0x54f8a7['options']);return _0x21eff0['getSubjects'](_0xbd6744);}})[_0x2fc0('0x3c')](function(_0x7d5901){if(_0x7d5901){_0x3ea30a=_0x7d5901[_0x2fc0('0x2f')];if(!_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x46')](_0x2fc0('0x30'))){_0xbd6744['limit']=qs['limit'](_0x54f8a7[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0xbd6744[_0x2fc0('0x15')]=qs['offset'](_0x54f8a7[_0x2fc0('0x29')]['offset']);}return _0x21eff0[_0x2fc0('0x47')](_0xbd6744);}})[_0x2fc0('0x3c')](function(_0x341bf0){if(_0x341bf0){return _0x341bf0?{'count':_0x3ea30a,'rows':_0x341bf0}:null;}})[_0x2fc0('0x3c')](respondWithResult(_0x1ef2cd,null))[_0x2fc0('0x3e')](handleError(_0x1ef2cd,null));};exports['getDescriptions']=function(_0x8b87a7,_0x2dbc56,_0x592edf){var _0x8ba151={};var _0x12a4af={};var _0x25b104;var _0x4d3909;return db[_0x2fc0('0x24')]['findOne']({'where':{'id':_0x8b87a7['params']['id']}})[_0x2fc0('0x3c')](handleEntityNotFound(_0x2dbc56,null))[_0x2fc0('0x3c')](function(_0x2fc3d4){if(_0x2fc3d4){_0x25b104=_0x2fc3d4;_0x12a4af[_0x2fc0('0x28')]=_[_0x2fc0('0x2a')](db[_0x2fc0('0x44')]['rawAttributes']);_0x12a4af['query']=_['keys'](_0x8b87a7[_0x2fc0('0x29')]);_0x12a4af['filters']=_[_0x2fc0('0x2c')](_0x12a4af['model'],_0x12a4af['query']);_0x8ba151['attributes']=_['intersection'](_0x12a4af[_0x2fc0('0x28')],qs['fields'](_0x8b87a7['query'][_0x2fc0('0x2e')]));_0x8ba151[_0x2fc0('0x2d')]=_0x8ba151['attributes'][_0x2fc0('0x2f')]?_0x8ba151['attributes']:_0x12a4af[_0x2fc0('0x28')];_0x8ba151[_0x2fc0('0x49')]=qs[_0x2fc0('0x32')](_0x8b87a7[_0x2fc0('0x29')][_0x2fc0('0x32')]);_0x8ba151[_0x2fc0('0x35')]=qs['filters'](_[_0x2fc0('0x33')](_0x8b87a7[_0x2fc0('0x29')],_0x12a4af['filters']));if(_0x8b87a7['query'][_0x2fc0('0x34')]){_0x8ba151[_0x2fc0('0x35')]=_[_0x2fc0('0x36')](_0x8ba151[_0x2fc0('0x35')],{'$or':_[_0x2fc0('0x23')](_0x8ba151['attributes'],function(_0x41fff6){var _0x570c06={};_0x570c06[_0x41fff6]={'$like':'%'+_0x8b87a7[_0x2fc0('0x29')][_0x2fc0('0x34')]+'%'};return _0x570c06;})});}_0x8ba151=_[_0x2fc0('0x36')]({},_0x8ba151,_0x8b87a7[_0x2fc0('0x38')]);return _0x25b104[_0x2fc0('0x4a')](_0x8ba151);}})[_0x2fc0('0x3c')](function(_0x134eb7){if(_0x134eb7){_0x4d3909=_0x134eb7[_0x2fc0('0x2f')];if(!_0x8b87a7[_0x2fc0('0x29')]['hasOwnProperty'](_0x2fc0('0x30'))){_0x8ba151[_0x2fc0('0x31')]=qs[_0x2fc0('0x31')](_0x8b87a7[_0x2fc0('0x29')][_0x2fc0('0x31')]);_0x8ba151[_0x2fc0('0x15')]=qs[_0x2fc0('0x15')](_0x8b87a7['query'][_0x2fc0('0x15')]);}return _0x25b104['getDescriptions'](_0x8ba151);}})['then'](function(_0x13f33f){if(_0x13f33f){return _0x13f33f?{'count':_0x4d3909,'rows':_0x13f33f}:null;}})['then'](respondWithResult(_0x2dbc56,null))[_0x2fc0('0x3e')](handleError(_0x2dbc56,null));}; \ No newline at end of file +var _0xd8fd=['filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','VtigerConfiguration','findAll','rows','catch','show','params','includeAll','include','options','create','body','find','findOne','VtigerField','order','getFields','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','end','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys'];(function(_0x38ea24,_0x4b3303){var _0x3a9f67=function(_0x35c0e2){while(--_0x35c0e2){_0x38ea24['push'](_0x38ea24['shift']());}};_0x3a9f67(++_0x4b3303);}(_0xd8fd,0x16c));var _0xdd8f=function(_0x79ebc5,_0x2df5d1){_0x79ebc5=_0x79ebc5-0x0;var _0x3813b6=_0xd8fd[_0x79ebc5];return _0x3813b6;};'use strict';var emlformat=require(_0xdd8f('0x0'));var rimraf=require(_0xdd8f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd8f('0x2'));var rp=require(_0xdd8f('0x3'));var moment=require(_0xdd8f('0x4'));var BPromise=require(_0xdd8f('0x5'));var Mustache=require(_0xdd8f('0x6'));var util=require(_0xdd8f('0x7'));var path=require(_0xdd8f('0x8'));var sox=require(_0xdd8f('0x9'));var csv=require(_0xdd8f('0xa'));var ejs=require(_0xdd8f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdd8f('0xc'));var squel=require(_0xdd8f('0xd'));var crypto=require('crypto');var jsforce=require(_0xdd8f('0xe'));var deskjs=require(_0xdd8f('0xf'));var toCsv=require(_0xdd8f('0xa'));var querystring=require(_0xdd8f('0x10'));var Papa=require(_0xdd8f('0x11'));var Redis=require('ioredis');var authService=require(_0xdd8f('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xdd8f('0x13'));var hardwareService=require(_0xdd8f('0x14'));var logger=require(_0xdd8f('0x15'))('api');var utils=require(_0xdd8f('0x16'));var config=require(_0xdd8f('0x17'));var licenseUtil=require(_0xdd8f('0x18'));var db=require(_0xdd8f('0x19'))['db'];function respondWithStatusCode(_0x513742,_0x4ace5a){_0x4ace5a=_0x4ace5a||0xcc;return function(_0x3390c4){if(_0x3390c4){return _0x513742[_0xdd8f('0x1a')](_0x4ace5a);}return _0x513742['status'](_0x4ace5a)['end']();};}function respondWithResult(_0x4e478c,_0xdd974e){_0xdd974e=_0xdd974e||0xc8;return function(_0x13b6b8){if(_0x13b6b8){return _0x4e478c[_0xdd8f('0x1b')](_0xdd974e)[_0xdd8f('0x1c')](_0x13b6b8);}};}function respondWithFilteredResult(_0x8f7507,_0x4d195b){return function(_0x33e29b){if(_0x33e29b){var _0x4eb342=typeof _0x4d195b[_0xdd8f('0x1d')]===_0xdd8f('0x1e')&&typeof _0x4d195b[_0xdd8f('0x1f')]==='undefined';var _0x3cc75a=_0x33e29b['count'];var _0x31c0a0=_0x4eb342?0x0:_0x4d195b[_0xdd8f('0x1d')];var _0x53323d=_0x4eb342?_0x33e29b[_0xdd8f('0x20')]:_0x4d195b['offset']+_0x4d195b[_0xdd8f('0x1f')];var _0x2abfdc;if(_0x53323d>=_0x3cc75a){_0x53323d=_0x3cc75a;_0x2abfdc=0xc8;}else{_0x2abfdc=0xce;}_0x8f7507[_0xdd8f('0x1b')](_0x2abfdc);return _0x8f7507[_0xdd8f('0x21')]('Content-Range',_0x31c0a0+'-'+_0x53323d+'/'+_0x3cc75a)[_0xdd8f('0x1c')](_0x33e29b);}return null;};}function patchUpdates(_0x3c2bb3){return function(_0x44ac94){try{jsonpatch[_0xdd8f('0x22')](_0x44ac94,_0x3c2bb3,!![]);}catch(_0x34b2bc){return BPromise[_0xdd8f('0x23')](_0x34b2bc);}return _0x44ac94[_0xdd8f('0x24')]();};}function saveUpdates(_0x428c54,_0x4c7b5b){return function(_0x21511f){if(_0x21511f){return _0x21511f[_0xdd8f('0x25')](_0x428c54)[_0xdd8f('0x26')](function(_0xe6d656){return _0xe6d656;});}return null;};}function removeEntity(_0x4b5382,_0xb9a33c){return function(_0x330ed7){if(_0x330ed7){return _0x330ed7[_0xdd8f('0x27')]()[_0xdd8f('0x26')](function(){_0x4b5382['status'](0xcc)[_0xdd8f('0x28')]();});}};}function handleEntityNotFound(_0x4862c2,_0x5d09de){return function(_0x3d0be7){if(!_0x3d0be7){_0x4862c2['sendStatus'](0x194);}return _0x3d0be7;};}function handleError(_0x10ac74,_0x59b8d6){_0x59b8d6=_0x59b8d6||0x1f4;return function(_0xdf3192){logger['error'](_0xdf3192[_0xdd8f('0x29')]);if(_0xdf3192[_0xdd8f('0x2a')]){delete _0xdf3192[_0xdd8f('0x2a')];}_0x10ac74[_0xdd8f('0x1b')](_0x59b8d6)[_0xdd8f('0x2b')](_0xdf3192);};}exports['index']=function(_0x254b03,_0x46896e){var _0x53c105={},_0x1ef359={},_0x4c7eec={'count':0x0,'rows':[]};var _0x3586ca=_[_0xdd8f('0x2c')](db['VtigerConfiguration'][_0xdd8f('0x2d')],function(_0x34aecb){return{'name':_0x34aecb[_0xdd8f('0x2e')],'type':_0x34aecb[_0xdd8f('0x2f')][_0xdd8f('0x30')]};});_0x1ef359['model']=_[_0xdd8f('0x2c')](_0x3586ca,_0xdd8f('0x2a'));_0x1ef359[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x254b03[_0xdd8f('0x31')]);_0x1ef359[_0xdd8f('0x33')]=_['intersection'](_0x1ef359['model'],_0x1ef359[_0xdd8f('0x31')]);_0x53c105[_0xdd8f('0x34')]=_[_0xdd8f('0x35')](_0x1ef359['model'],qs[_0xdd8f('0x36')](_0x254b03['query'][_0xdd8f('0x36')]));_0x53c105['attributes']=_0x53c105[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x53c105['attributes']:_0x1ef359[_0xdd8f('0x38')];if(!_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x39')](_0xdd8f('0x3a'))){_0x53c105[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x254b03[_0xdd8f('0x31')]['limit']);_0x53c105[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}_0x53c105['order']=qs[_0xdd8f('0x3b')](_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x3b')]);_0x53c105['where']=qs['filters'](_[_0xdd8f('0x3c')](_0x254b03['query'],_0x1ef359[_0xdd8f('0x33')]),_0x3586ca);if(_0x254b03[_0xdd8f('0x31')][_0xdd8f('0x3d')]){_0x53c105[_0xdd8f('0x3e')]=_['merge'](_0x53c105[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x3586ca,function(_0x18ed30){if(_0x18ed30[_0xdd8f('0x2f')]!==_0xdd8f('0x3f')){var _0x37fcb4={};_0x37fcb4[_0x18ed30[_0xdd8f('0x2a')]]={'$like':'%'+_0x254b03[_0xdd8f('0x31')]['filter']+'%'};return _0x37fcb4;}})});}_0x53c105=_[_0xdd8f('0x40')]({},_0x53c105,_0x254b03['options']);var _0x42d63f={'where':_0x53c105['where']};return db['VtigerConfiguration'][_0xdd8f('0x20')](_0x42d63f)[_0xdd8f('0x26')](function(_0x28fab2){_0x4c7eec[_0xdd8f('0x20')]=_0x28fab2;if(_0x254b03['query']['includeAll']){_0x53c105['include']=[{'all':!![]}];}return db[_0xdd8f('0x41')][_0xdd8f('0x42')](_0x53c105);})['then'](function(_0x3df864){_0x4c7eec[_0xdd8f('0x43')]=_0x3df864;return _0x4c7eec;})[_0xdd8f('0x26')](respondWithFilteredResult(_0x46896e,_0x53c105))[_0xdd8f('0x44')](handleError(_0x46896e,null));};exports[_0xdd8f('0x45')]=function(_0x255365,_0x4981e0){var _0x386c5b={'raw':![],'where':{'id':_0x255365[_0xdd8f('0x46')]['id']}},_0x1d3f3c={};_0x1d3f3c[_0xdd8f('0x38')]=_[_0xdd8f('0x32')](db['VtigerConfiguration']['rawAttributes']);_0x1d3f3c[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x255365[_0xdd8f('0x31')]);_0x1d3f3c[_0xdd8f('0x33')]=_[_0xdd8f('0x35')](_0x1d3f3c[_0xdd8f('0x38')],_0x1d3f3c['query']);_0x386c5b[_0xdd8f('0x34')]=_[_0xdd8f('0x35')](_0x1d3f3c[_0xdd8f('0x38')],qs[_0xdd8f('0x36')](_0x255365['query'][_0xdd8f('0x36')]));_0x386c5b[_0xdd8f('0x34')]=_0x386c5b[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x386c5b[_0xdd8f('0x34')]:_0x1d3f3c[_0xdd8f('0x38')];if(_0x255365[_0xdd8f('0x31')][_0xdd8f('0x47')]){_0x386c5b[_0xdd8f('0x48')]=[{'all':!![]}];}_0x386c5b=_[_0xdd8f('0x40')]({},_0x386c5b,_0x255365[_0xdd8f('0x49')]);return db['VtigerConfiguration']['find'](_0x386c5b)[_0xdd8f('0x26')](handleEntityNotFound(_0x4981e0,null))[_0xdd8f('0x26')](respondWithResult(_0x4981e0,null))[_0xdd8f('0x44')](handleError(_0x4981e0,null));};exports[_0xdd8f('0x4a')]=function(_0x55b821,_0x3531e9){return db[_0xdd8f('0x41')][_0xdd8f('0x4a')](_0x55b821[_0xdd8f('0x4b')],{})['then'](respondWithResult(_0x3531e9,0xc9))[_0xdd8f('0x44')](handleError(_0x3531e9,null));};exports[_0xdd8f('0x25')]=function(_0x4f8ee5,_0x5f36ed){if(_0x4f8ee5[_0xdd8f('0x4b')]['id']){delete _0x4f8ee5[_0xdd8f('0x4b')]['id'];}return db[_0xdd8f('0x41')][_0xdd8f('0x4c')]({'where':{'id':_0x4f8ee5['params']['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0x5f36ed,null))[_0xdd8f('0x26')](saveUpdates(_0x4f8ee5[_0xdd8f('0x4b')],null))[_0xdd8f('0x26')](respondWithResult(_0x5f36ed,null))['catch'](handleError(_0x5f36ed,null));};exports['destroy']=function(_0x1e9b9d,_0xe7e825){return db[_0xdd8f('0x41')][_0xdd8f('0x4c')]({'where':{'id':_0x1e9b9d[_0xdd8f('0x46')]['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0xe7e825,null))[_0xdd8f('0x26')](removeEntity(_0xe7e825,null))[_0xdd8f('0x44')](handleError(_0xe7e825,null));};exports['getFields']=function(_0x3657dc,_0x55e5fe,_0x1b1b4e){var _0x5d94bd={};var _0x47ab01={};var _0x272576;var _0x3d436d;return db['VtigerConfiguration'][_0xdd8f('0x4d')]({'where':{'id':_0x3657dc[_0xdd8f('0x46')]['id']}})['then'](handleEntityNotFound(_0x55e5fe,null))[_0xdd8f('0x26')](function(_0x1a06c0){if(_0x1a06c0){_0x272576=_0x1a06c0;_0x47ab01['model']=_['keys'](db[_0xdd8f('0x4e')][_0xdd8f('0x2d')]);_0x47ab01[_0xdd8f('0x31')]=_['keys'](_0x3657dc[_0xdd8f('0x31')]);_0x47ab01[_0xdd8f('0x33')]=_['intersection'](_0x47ab01[_0xdd8f('0x38')],_0x47ab01[_0xdd8f('0x31')]);_0x5d94bd[_0xdd8f('0x34')]=_['intersection'](_0x47ab01['model'],qs[_0xdd8f('0x36')](_0x3657dc[_0xdd8f('0x31')][_0xdd8f('0x36')]));_0x5d94bd['attributes']=_0x5d94bd[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x5d94bd[_0xdd8f('0x34')]:_0x47ab01[_0xdd8f('0x38')];_0x5d94bd[_0xdd8f('0x4f')]=qs[_0xdd8f('0x3b')](_0x3657dc[_0xdd8f('0x31')]['sort']);_0x5d94bd['where']=qs[_0xdd8f('0x33')](_[_0xdd8f('0x3c')](_0x3657dc[_0xdd8f('0x31')],_0x47ab01[_0xdd8f('0x33')]));if(_0x3657dc['query'][_0xdd8f('0x3d')]){_0x5d94bd[_0xdd8f('0x3e')]=_[_0xdd8f('0x40')](_0x5d94bd[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x5d94bd[_0xdd8f('0x34')],function(_0xc611d7){var _0x31665a={};_0x31665a[_0xc611d7]={'$like':'%'+_0x3657dc['query'][_0xdd8f('0x3d')]+'%'};return _0x31665a;})});}_0x5d94bd=_[_0xdd8f('0x40')]({},_0x5d94bd,_0x3657dc[_0xdd8f('0x49')]);return _0x272576[_0xdd8f('0x50')](_0x5d94bd);}})['then'](function(_0x1cec44){if(_0x1cec44){_0x3d436d=_0x1cec44[_0xdd8f('0x37')];if(!_0x3657dc[_0xdd8f('0x31')]['hasOwnProperty'](_0xdd8f('0x3a'))){_0x5d94bd[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x3657dc[_0xdd8f('0x31')]['limit']);_0x5d94bd[_0xdd8f('0x1d')]=qs[_0xdd8f('0x1d')](_0x3657dc[_0xdd8f('0x31')][_0xdd8f('0x1d')]);}return _0x272576[_0xdd8f('0x50')](_0x5d94bd);}})[_0xdd8f('0x26')](function(_0x2275a8){if(_0x2275a8){return _0x2275a8?{'count':_0x3d436d,'rows':_0x2275a8}:null;}})['then'](respondWithResult(_0x55e5fe,null))[_0xdd8f('0x44')](handleError(_0x55e5fe,null));};exports[_0xdd8f('0x51')]=function(_0x1d13ce,_0x374bd7,_0x4ed142){var _0x23b7bb={};var _0x45b533={};var _0x5f2767;var _0x52e6cb;return db['VtigerConfiguration'][_0xdd8f('0x4d')]({'where':{'id':_0x1d13ce[_0xdd8f('0x46')]['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0x374bd7,null))['then'](function(_0xfa0778){if(_0xfa0778){_0x5f2767=_0xfa0778;_0x45b533[_0xdd8f('0x38')]=_[_0xdd8f('0x32')](db['VtigerField'][_0xdd8f('0x2d')]);_0x45b533[_0xdd8f('0x31')]=_['keys'](_0x1d13ce[_0xdd8f('0x31')]);_0x45b533[_0xdd8f('0x33')]=_[_0xdd8f('0x35')](_0x45b533[_0xdd8f('0x38')],_0x45b533[_0xdd8f('0x31')]);_0x23b7bb[_0xdd8f('0x34')]=_[_0xdd8f('0x35')](_0x45b533[_0xdd8f('0x38')],qs[_0xdd8f('0x36')](_0x1d13ce[_0xdd8f('0x31')][_0xdd8f('0x36')]));_0x23b7bb['attributes']=_0x23b7bb[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x23b7bb[_0xdd8f('0x34')]:_0x45b533[_0xdd8f('0x38')];_0x23b7bb[_0xdd8f('0x4f')]=qs[_0xdd8f('0x3b')](_0x1d13ce['query'][_0xdd8f('0x3b')]);_0x23b7bb[_0xdd8f('0x3e')]=qs[_0xdd8f('0x33')](_['pick'](_0x1d13ce[_0xdd8f('0x31')],_0x45b533['filters']));if(_0x1d13ce['query'][_0xdd8f('0x3d')]){_0x23b7bb[_0xdd8f('0x3e')]=_['merge'](_0x23b7bb[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x23b7bb['attributes'],function(_0x29eae5){var _0x4fdf7d={};_0x4fdf7d[_0x29eae5]={'$like':'%'+_0x1d13ce[_0xdd8f('0x31')][_0xdd8f('0x3d')]+'%'};return _0x4fdf7d;})});}_0x23b7bb=_[_0xdd8f('0x40')]({},_0x23b7bb,_0x1d13ce[_0xdd8f('0x49')]);return _0x5f2767['getSubjects'](_0x23b7bb);}})[_0xdd8f('0x26')](function(_0x2c1265){if(_0x2c1265){_0x52e6cb=_0x2c1265[_0xdd8f('0x37')];if(!_0x1d13ce[_0xdd8f('0x31')]['hasOwnProperty'](_0xdd8f('0x3a'))){_0x23b7bb[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x1d13ce['query']['limit']);_0x23b7bb['offset']=qs[_0xdd8f('0x1d')](_0x1d13ce[_0xdd8f('0x31')]['offset']);}return _0x5f2767['getSubjects'](_0x23b7bb);}})['then'](function(_0x290a1b){if(_0x290a1b){return _0x290a1b?{'count':_0x52e6cb,'rows':_0x290a1b}:null;}})['then'](respondWithResult(_0x374bd7,null))[_0xdd8f('0x44')](handleError(_0x374bd7,null));};exports[_0xdd8f('0x52')]=function(_0x1c17f3,_0x5b3e3e,_0x3c7d2b){var _0x19cdad={};var _0x14b5d3={};var _0x5185b8;var _0x279750;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x1c17f3[_0xdd8f('0x46')]['id']}})[_0xdd8f('0x26')](handleEntityNotFound(_0x5b3e3e,null))[_0xdd8f('0x26')](function(_0x53ab3a){if(_0x53ab3a){_0x5185b8=_0x53ab3a;_0x14b5d3[_0xdd8f('0x38')]=_[_0xdd8f('0x32')](db[_0xdd8f('0x4e')][_0xdd8f('0x2d')]);_0x14b5d3[_0xdd8f('0x31')]=_[_0xdd8f('0x32')](_0x1c17f3['query']);_0x14b5d3[_0xdd8f('0x33')]=_['intersection'](_0x14b5d3[_0xdd8f('0x38')],_0x14b5d3[_0xdd8f('0x31')]);_0x19cdad['attributes']=_[_0xdd8f('0x35')](_0x14b5d3[_0xdd8f('0x38')],qs[_0xdd8f('0x36')](_0x1c17f3['query'][_0xdd8f('0x36')]));_0x19cdad[_0xdd8f('0x34')]=_0x19cdad[_0xdd8f('0x34')][_0xdd8f('0x37')]?_0x19cdad[_0xdd8f('0x34')]:_0x14b5d3[_0xdd8f('0x38')];_0x19cdad[_0xdd8f('0x4f')]=qs[_0xdd8f('0x3b')](_0x1c17f3['query'][_0xdd8f('0x3b')]);_0x19cdad['where']=qs[_0xdd8f('0x33')](_[_0xdd8f('0x3c')](_0x1c17f3[_0xdd8f('0x31')],_0x14b5d3[_0xdd8f('0x33')]));if(_0x1c17f3[_0xdd8f('0x31')][_0xdd8f('0x3d')]){_0x19cdad[_0xdd8f('0x3e')]=_['merge'](_0x19cdad[_0xdd8f('0x3e')],{'$or':_[_0xdd8f('0x2c')](_0x19cdad[_0xdd8f('0x34')],function(_0x6fab67){var _0x44b305={};_0x44b305[_0x6fab67]={'$like':'%'+_0x1c17f3[_0xdd8f('0x31')][_0xdd8f('0x3d')]+'%'};return _0x44b305;})});}_0x19cdad=_[_0xdd8f('0x40')]({},_0x19cdad,_0x1c17f3[_0xdd8f('0x49')]);return _0x5185b8[_0xdd8f('0x52')](_0x19cdad);}})[_0xdd8f('0x26')](function(_0x21c619){if(_0x21c619){_0x279750=_0x21c619[_0xdd8f('0x37')];if(!_0x1c17f3[_0xdd8f('0x31')][_0xdd8f('0x39')](_0xdd8f('0x3a'))){_0x19cdad[_0xdd8f('0x1f')]=qs[_0xdd8f('0x1f')](_0x1c17f3[_0xdd8f('0x31')]['limit']);_0x19cdad[_0xdd8f('0x1d')]=qs['offset'](_0x1c17f3[_0xdd8f('0x31')]['offset']);}return _0x5185b8[_0xdd8f('0x52')](_0x19cdad);}})['then'](function(_0x3b9dfc){if(_0x3b9dfc){return _0x3b9dfc?{'count':_0x279750,'rows':_0x3b9dfc}:null;}})[_0xdd8f('0x26')](respondWithResult(_0x5b3e3e,null))[_0xdd8f('0x44')](handleError(_0x5b3e3e,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 14ad7c6..0320826 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 _0x40c7=['api','moment','rimraf','../../config/environment','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','lodash'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x40c7,0x15e));var _0x740c=function(_0x2d72ab,_0x5a97f5){_0x2d72ab=_0x2d72ab-0x0;var _0x256423=_0x40c7[_0x2d72ab];return _0x256423;};'use strict';var _=require(_0x740c('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x740c('0x1'));var moment=require(_0x740c('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x740c('0x3'));var config=require(_0x740c('0x4'));var attributes=require(_0x740c('0x5'));module['exports']=function(_0x3e519e,_0x4340f8){return _0x3e519e[_0x740c('0x6')](_0x740c('0x7'),attributes,{'tableName':_0x740c('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xadf1=['int_vtiger_configurations','../../config/logger','api','moment','bluebird','path','../../config/environment','define'];(function(_0x1408bf,_0x516ced){var _0x4b658d=function(_0x594303){while(--_0x594303){_0x1408bf['push'](_0x1408bf['shift']());}};_0x4b658d(++_0x516ced);}(_0xadf1,0x1a9));var _0x1adf=function(_0x1d0b12,_0x2cea7a){_0x1d0b12=_0x1d0b12-0x0;var _0x4fea7c=_0xadf1[_0x1d0b12];return _0x4fea7c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1adf('0x0'))(_0x1adf('0x1'));var moment=require(_0x1adf('0x2'));var BPromise=require(_0x1adf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1adf('0x4'));var rimraf=require('rimraf');var config=require(_0x1adf('0x5'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x5d513d,_0x32d681){return _0x5d513d[_0x1adf('0x6')]('VtigerConfiguration',attributes,{'tableName':_0x1adf('0x7'),'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 0cdf421..448c457 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 _0xcafb=['message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2be34f,_0x1a71f8){var _0x450234=function(_0x492824){while(--_0x492824){_0x2be34f['push'](_0x2be34f['shift']());}};_0x450234(++_0x1a71f8);}(_0xcafb,0x179));var _0xbcaf=function(_0x5b947d,_0x4979f8){_0x5b947d=_0x5b947d-0x0;var _0xdd537c=_0xcafb[_0x5b947d];return _0xdd537c;};'use strict';var _=require(_0xbcaf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbcaf('0x1'));var rs=require(_0xbcaf('0x2'));var fs=require('fs');var Redis=require(_0xbcaf('0x3'));var db=require(_0xbcaf('0x4'))['db'];var utils=require(_0xbcaf('0x5'));var logger=require(_0xbcaf('0x6'))(_0xbcaf('0x7'));var config=require(_0xbcaf('0x8'));var jayson=require(_0xbcaf('0x9'));var client=jayson[_0xbcaf('0xa')][_0xbcaf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x270940,_0x43949e,_0x19581c){return new BPromise(function(_0x327c6c,_0xc380de){return client['request'](_0x270940,_0x19581c)['then'](function(_0x423ebe){logger[_0xbcaf('0xc')](_0xbcaf('0xd'),_0x43949e,_0xbcaf('0xe'));logger[_0xbcaf('0xf')](_0xbcaf('0x10'),_0x43949e,_0xbcaf('0xe'),JSON[_0xbcaf('0x11')](_0x423ebe));if(_0x423ebe[_0xbcaf('0x12')]){if(_0x423ebe[_0xbcaf('0x12')]['code']===0x1f4){logger['error'](_0xbcaf('0xd'),_0x43949e,_0x423ebe['error'][_0xbcaf('0x13')]);return _0xc380de(_0x423ebe[_0xbcaf('0x12')][_0xbcaf('0x13')]);}logger['error'](_0xbcaf('0xd'),_0x43949e,_0x423ebe[_0xbcaf('0x12')]['message']);return _0x327c6c(_0x423ebe[_0xbcaf('0x12')]['message']);}else{logger[_0xbcaf('0xc')](_0xbcaf('0xd'),_0x43949e,'request\x20sent');_0x327c6c(_0x423ebe[_0xbcaf('0x14')][_0xbcaf('0x13')]);}})[_0xbcaf('0x15')](function(_0x354cd7){logger[_0xbcaf('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x43949e,_0x354cd7);_0xc380de(_0x354cd7);});});} \ No newline at end of file +var _0x5ee1=['message','VtigerConfiguration,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x280c4b,_0xfe785d){var _0x2a5e90=function(_0x37db79){while(--_0x37db79){_0x280c4b['push'](_0x280c4b['shift']());}};_0x2a5e90(++_0xfe785d);}(_0x5ee1,0xdc));var _0x15ee=function(_0x3b4fd2,_0x4c6337){_0x3b4fd2=_0x3b4fd2-0x0;var _0x494ff2=_0x5ee1[_0x3b4fd2];return _0x494ff2;};'use strict';var _=require(_0x15ee('0x0'));var util=require(_0x15ee('0x1'));var moment=require(_0x15ee('0x2'));var BPromise=require(_0x15ee('0x3'));var rs=require(_0x15ee('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x15ee('0x5'))['db'];var utils=require(_0x15ee('0x6'));var logger=require('../../config/logger')(_0x15ee('0x7'));var config=require(_0x15ee('0x8'));var jayson=require(_0x15ee('0x9'));var client=jayson[_0x15ee('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd907d3,_0x216ce1,_0x3b6399){return new BPromise(function(_0x14fc13,_0x39f82e){return client[_0x15ee('0xb')](_0xd907d3,_0x3b6399)[_0x15ee('0xc')](function(_0x5d18d5){logger[_0x15ee('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x216ce1,_0x15ee('0xe'));logger[_0x15ee('0xf')](_0x15ee('0x10'),_0x216ce1,'request\x20sent',JSON[_0x15ee('0x11')](_0x5d18d5));if(_0x5d18d5[_0x15ee('0x12')]){if(_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x13')]===0x1f4){logger[_0x15ee('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x216ce1,_0x5d18d5[_0x15ee('0x12')]['message']);return _0x39f82e(_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x14')]);}logger[_0x15ee('0x12')](_0x15ee('0x15'),_0x216ce1,_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x14')]);return _0x14fc13(_0x5d18d5[_0x15ee('0x12')][_0x15ee('0x14')]);}else{logger['info'](_0x15ee('0x15'),_0x216ce1,_0x15ee('0xe'));_0x14fc13(_0x5d18d5[_0x15ee('0x16')][_0x15ee('0x14')]);}})[_0x15ee('0x17')](function(_0x1a653b){logger[_0x15ee('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x216ce1,_0x1a653b);_0x39f82e(_0x1a653b);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 4aaa85b..090faf8 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 _0x6dc5=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports'];(function(_0x2c4cc7,_0x3da9ef){var _0x425f72=function(_0x26f3f1){while(--_0x26f3f1){_0x2c4cc7['push'](_0x2c4cc7['shift']());}};_0x425f72(++_0x3da9ef);}(_0x6dc5,0x1f4));var _0x56dc=function(_0x2017b9,_0x3dbeda){_0x2017b9=_0x2017b9-0x0;var _0x4e7cec=_0x6dc5[_0x2017b9];return _0x4e7cec;};'use strict';var multer=require(_0x56dc('0x0'));var util=require(_0x56dc('0x1'));var path=require(_0x56dc('0x2'));var timeout=require(_0x56dc('0x3'));var express=require(_0x56dc('0x4'));var router=express[_0x56dc('0x5')]();var fs_extra=require(_0x56dc('0x6'));var auth=require(_0x56dc('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x56dc('0x8'));var controller=require(_0x56dc('0x9'));router[_0x56dc('0xa')]('/',auth[_0x56dc('0xb')](),controller['index']);router[_0x56dc('0xa')](_0x56dc('0xc'),auth['isAuthenticated'](),controller[_0x56dc('0xd')]);router[_0x56dc('0xe')]('/',auth['isAuthenticated'](),controller[_0x56dc('0xf')]);router['put'](_0x56dc('0xc'),auth[_0x56dc('0xb')](),controller[_0x56dc('0x10')]);router[_0x56dc('0x11')](_0x56dc('0xc'),auth['isAuthenticated'](),controller[_0x56dc('0x12')]);module[_0x56dc('0x13')]=router; \ No newline at end of file +var _0x95bb=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','show','post','create','update','delete','/:id','exports','multer','util','path','connect-timeout'];(function(_0x55ab84,_0x3c2197){var _0x1b88bb=function(_0x5ece15){while(--_0x5ece15){_0x55ab84['push'](_0x55ab84['shift']());}};_0x1b88bb(++_0x3c2197);}(_0x95bb,0xe0));var _0xb95b=function(_0x4e70d9,_0x20a40b){_0x4e70d9=_0x4e70d9-0x0;var _0x250928=_0x95bb[_0x4e70d9];return _0x250928;};'use strict';var multer=require(_0xb95b('0x0'));var util=require(_0xb95b('0x1'));var path=require(_0xb95b('0x2'));var timeout=require(_0xb95b('0x3'));var express=require(_0xb95b('0x4'));var router=express[_0xb95b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb95b('0x6'));var interaction=require(_0xb95b('0x7'));var config=require(_0xb95b('0x8'));var controller=require(_0xb95b('0x9'));router[_0xb95b('0xa')]('/',auth[_0xb95b('0xb')](),controller['index']);router[_0xb95b('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb95b('0xc')]);router[_0xb95b('0xd')]('/',auth[_0xb95b('0xb')](),controller[_0xb95b('0xe')]);router['put']('/:id',auth[_0xb95b('0xb')](),controller[_0xb95b('0xf')]);router[_0xb95b('0x10')](_0xb95b('0x11'),auth[_0xb95b('0xb')](),controller['destroy']);module[_0xb95b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index a2dd37f..dcf298a 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 _0x3beb=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x128552,_0x5e7e4e){var _0x31ddb5=function(_0x1bb571){while(--_0x1bb571){_0x128552['push'](_0x128552['shift']());}};_0x31ddb5(++_0x5e7e4e);}(_0x3beb,0x160));var _0xb3be=function(_0x21839a,_0x5a5e2d){_0x21839a=_0x21839a-0x0;var _0x31dfa5=_0x3beb[_0x21839a];return _0x31dfa5;};'use strict';var Sequelize=require(_0xb3be('0x0'));module[_0xb3be('0x1')]={'type':{'type':Sequelize[_0xb3be('0x2')](_0xb3be('0x3'),_0xb3be('0x4'),_0xb3be('0x5'),_0xb3be('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xb3be('0x7')]},'key':{'type':Sequelize[_0xb3be('0x7')]},'keyType':{'type':Sequelize[_0xb3be('0x2')](_0xb3be('0x3'),_0xb3be('0x4'),_0xb3be('0x5'))},'keyContent':{'type':Sequelize[_0xb3be('0x7')]},'idField':{'type':Sequelize[_0xb3be('0x7')]},'nameField':{'type':Sequelize[_0xb3be('0x7')]},'customField':{'type':Sequelize[_0xb3be('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4db8=['exports','ENUM','variable','customVariable','keyValue','picklist','string','STRING','BOOLEAN'];(function(_0x289c0f,_0x583473){var _0x35e994=function(_0x4bc2b2){while(--_0x4bc2b2){_0x289c0f['push'](_0x289c0f['shift']());}};_0x35e994(++_0x583473);}(_0x4db8,0x13b));var _0x84db=function(_0xcbfa1a,_0x4c1681){_0xcbfa1a=_0xcbfa1a-0x0;var _0x281024=_0x4db8[_0xcbfa1a];return _0x281024;};'use strict';var Sequelize=require('sequelize');module[_0x84db('0x0')]={'type':{'type':Sequelize[_0x84db('0x1')]('string',_0x84db('0x2'),_0x84db('0x3'),_0x84db('0x4'),_0x84db('0x5')),'defaultValue':_0x84db('0x6')},'content':{'type':Sequelize[_0x84db('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x84db('0x6'),_0x84db('0x2'),_0x84db('0x3'))},'keyContent':{'type':Sequelize[_0x84db('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x84db('0x7')]},'customField':{'type':Sequelize[_0x84db('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x84db('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index f7ceabf..df1c2dd 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 _0x870a=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','includeAll','include','findAll','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x870a,0x8a));var _0xa870=function(_0x6be798,_0x1675b6){_0x6be798=_0x6be798-0x0;var _0x1407e1=_0x870a[_0x6be798];return _0x1407e1;};'use strict';var emlformat=require(_0xa870('0x0'));var rimraf=require(_0xa870('0x1'));var zipdir=require(_0xa870('0x2'));var jsonpatch=require(_0xa870('0x3'));var rp=require(_0xa870('0x4'));var moment=require(_0xa870('0x5'));var BPromise=require(_0xa870('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa870('0x7'));var sox=require(_0xa870('0x8'));var csv=require('to-csv');var ejs=require(_0xa870('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa870('0xa'));var squel=require(_0xa870('0xb'));var crypto=require(_0xa870('0xc'));var jsforce=require(_0xa870('0xd'));var deskjs=require(_0xa870('0xe'));var toCsv=require(_0xa870('0xf'));var querystring=require(_0xa870('0x10'));var Papa=require(_0xa870('0x11'));var Redis=require(_0xa870('0x12'));var authService=require(_0xa870('0x13'));var qs=require(_0xa870('0x14'));var as=require(_0xa870('0x15'));var hardwareService=require(_0xa870('0x16'));var logger=require('../../config/logger')(_0xa870('0x17'));var utils=require(_0xa870('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xa870('0x19'));var db=require(_0xa870('0x1a'))['db'];function respondWithStatusCode(_0xdd8164,_0x222d3f){_0x222d3f=_0x222d3f||0xcc;return function(_0x5db917){if(_0x5db917){return _0xdd8164[_0xa870('0x1b')](_0x222d3f);}return _0xdd8164[_0xa870('0x1c')](_0x222d3f)[_0xa870('0x1d')]();};}function respondWithResult(_0x1db5a5,_0x38b9fd){_0x38b9fd=_0x38b9fd||0xc8;return function(_0x1ead02){if(_0x1ead02){return _0x1db5a5[_0xa870('0x1c')](_0x38b9fd)[_0xa870('0x1e')](_0x1ead02);}};}function respondWithFilteredResult(_0x453590,_0x18d53d){return function(_0x5e921a){if(_0x5e921a){var _0x3fd83f=typeof _0x18d53d[_0xa870('0x1f')]===_0xa870('0x20')&&typeof _0x18d53d['limit']==='undefined';var _0x37e758=_0x5e921a[_0xa870('0x21')];var _0x35f4de=_0x3fd83f?0x0:_0x18d53d['offset'];var _0x7379e7=_0x3fd83f?_0x5e921a[_0xa870('0x21')]:_0x18d53d[_0xa870('0x1f')]+_0x18d53d[_0xa870('0x22')];var _0x19dd25;if(_0x7379e7>=_0x37e758){_0x7379e7=_0x37e758;_0x19dd25=0xc8;}else{_0x19dd25=0xce;}_0x453590[_0xa870('0x1c')](_0x19dd25);return _0x453590[_0xa870('0x23')](_0xa870('0x24'),_0x35f4de+'-'+_0x7379e7+'/'+_0x37e758)[_0xa870('0x1e')](_0x5e921a);}return null;};}function patchUpdates(_0x92c00f){return function(_0x35072e){try{jsonpatch[_0xa870('0x25')](_0x35072e,_0x92c00f,!![]);}catch(_0x21c4b1){return BPromise['reject'](_0x21c4b1);}return _0x35072e[_0xa870('0x26')]();};}function saveUpdates(_0x3437b8,_0x4baf65){return function(_0x522032){if(_0x522032){return _0x522032[_0xa870('0x27')](_0x3437b8)[_0xa870('0x28')](function(_0x5d8056){return _0x5d8056;});}return null;};}function removeEntity(_0x158a30,_0x8d3492){return function(_0x1e0792){if(_0x1e0792){return _0x1e0792[_0xa870('0x29')]()['then'](function(){_0x158a30[_0xa870('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ea08c,_0x272737){return function(_0x143226){if(!_0x143226){_0x1ea08c['sendStatus'](0x194);}return _0x143226;};}function handleError(_0x572600,_0xa67345){_0xa67345=_0xa67345||0x1f4;return function(_0x1a33d6){logger[_0xa870('0x2a')](_0x1a33d6[_0xa870('0x2b')]);if(_0x1a33d6[_0xa870('0x2c')]){delete _0x1a33d6[_0xa870('0x2c')];}_0x572600[_0xa870('0x1c')](_0xa67345)[_0xa870('0x2d')](_0x1a33d6);};}exports[_0xa870('0x2e')]=function(_0x1692cc,_0x5c053c){var _0x1a8374={},_0x5d8425={},_0x142127={'count':0x0,'rows':[]};var _0x3c11a6=_[_0xa870('0x2f')](db[_0xa870('0x30')][_0xa870('0x31')],function(_0x159977){return{'name':_0x159977[_0xa870('0x32')],'type':_0x159977['type']['key']};});_0x5d8425[_0xa870('0x33')]=_[_0xa870('0x2f')](_0x3c11a6,_0xa870('0x2c'));_0x5d8425[_0xa870('0x34')]=_[_0xa870('0x35')](_0x1692cc[_0xa870('0x34')]);_0x5d8425[_0xa870('0x36')]=_['intersection'](_0x5d8425[_0xa870('0x33')],_0x5d8425[_0xa870('0x34')]);_0x1a8374[_0xa870('0x37')]=_[_0xa870('0x38')](_0x5d8425['model'],qs['fields'](_0x1692cc['query'][_0xa870('0x39')]));_0x1a8374[_0xa870('0x37')]=_0x1a8374[_0xa870('0x37')][_0xa870('0x3a')]?_0x1a8374['attributes']:_0x5d8425[_0xa870('0x33')];if(!_0x1692cc[_0xa870('0x34')]['hasOwnProperty'](_0xa870('0x3b'))){_0x1a8374['limit']=qs[_0xa870('0x22')](_0x1692cc['query'][_0xa870('0x22')]);_0x1a8374[_0xa870('0x1f')]=qs[_0xa870('0x1f')](_0x1692cc[_0xa870('0x34')][_0xa870('0x1f')]);}_0x1a8374[_0xa870('0x3c')]=qs[_0xa870('0x3d')](_0x1692cc[_0xa870('0x34')]['sort']);_0x1a8374[_0xa870('0x3e')]=qs[_0xa870('0x36')](_[_0xa870('0x3f')](_0x1692cc[_0xa870('0x34')],_0x5d8425['filters']),_0x3c11a6);if(_0x1692cc[_0xa870('0x34')][_0xa870('0x40')]){_0x1a8374[_0xa870('0x3e')]=_[_0xa870('0x41')](_0x1a8374[_0xa870('0x3e')],{'$or':_['map'](_0x3c11a6,function(_0x1d14f8){if(_0x1d14f8[_0xa870('0x42')]!=='VIRTUAL'){var _0x1c5233={};_0x1c5233[_0x1d14f8['name']]={'$like':'%'+_0x1692cc[_0xa870('0x34')][_0xa870('0x40')]+'%'};return _0x1c5233;}})});}_0x1a8374=_[_0xa870('0x41')]({},_0x1a8374,_0x1692cc['options']);var _0x1fc01f={'where':_0x1a8374[_0xa870('0x3e')]};return db[_0xa870('0x30')]['count'](_0x1fc01f)[_0xa870('0x28')](function(_0x3a794f){_0x142127[_0xa870('0x21')]=_0x3a794f;if(_0x1692cc[_0xa870('0x34')][_0xa870('0x43')]){_0x1a8374[_0xa870('0x44')]=[{'all':!![]}];}return db[_0xa870('0x30')][_0xa870('0x45')](_0x1a8374);})[_0xa870('0x28')](function(_0xa1b8ff){_0x142127['rows']=_0xa1b8ff;return _0x142127;})[_0xa870('0x28')](respondWithFilteredResult(_0x5c053c,_0x1a8374))[_0xa870('0x46')](handleError(_0x5c053c,null));};exports[_0xa870('0x47')]=function(_0x2354a2,_0x170d53){var _0x226353={'raw':!![],'where':{'id':_0x2354a2[_0xa870('0x48')]['id']}},_0x12aa25={};_0x12aa25[_0xa870('0x33')]=_['keys'](db[_0xa870('0x30')][_0xa870('0x31')]);_0x12aa25[_0xa870('0x34')]=_[_0xa870('0x35')](_0x2354a2[_0xa870('0x34')]);_0x12aa25['filters']=_[_0xa870('0x38')](_0x12aa25[_0xa870('0x33')],_0x12aa25[_0xa870('0x34')]);_0x226353[_0xa870('0x37')]=_[_0xa870('0x38')](_0x12aa25[_0xa870('0x33')],qs['fields'](_0x2354a2['query'][_0xa870('0x39')]));_0x226353[_0xa870('0x37')]=_0x226353['attributes']['length']?_0x226353[_0xa870('0x37')]:_0x12aa25[_0xa870('0x33')];if(_0x2354a2[_0xa870('0x34')][_0xa870('0x43')]){_0x226353[_0xa870('0x44')]=[{'all':!![]}];}_0x226353=_[_0xa870('0x41')]({},_0x226353,_0x2354a2[_0xa870('0x49')]);return db[_0xa870('0x30')][_0xa870('0x4a')](_0x226353)[_0xa870('0x28')](handleEntityNotFound(_0x170d53,null))[_0xa870('0x28')](respondWithResult(_0x170d53,null))[_0xa870('0x46')](handleError(_0x170d53,null));};exports[_0xa870('0x4b')]=function(_0x1cfb02,_0x3e3087){return db[_0xa870('0x30')][_0xa870('0x4b')](_0x1cfb02[_0xa870('0x4c')],{})[_0xa870('0x28')](respondWithResult(_0x3e3087,0xc9))[_0xa870('0x46')](handleError(_0x3e3087,null));};exports[_0xa870('0x27')]=function(_0x53021c,_0x388119){if(_0x53021c[_0xa870('0x4c')]['id']){delete _0x53021c['body']['id'];}return db['VtigerField'][_0xa870('0x4a')]({'where':{'id':_0x53021c[_0xa870('0x48')]['id']}})[_0xa870('0x28')](handleEntityNotFound(_0x388119,null))[_0xa870('0x28')](saveUpdates(_0x53021c[_0xa870('0x4c')],null))['then'](respondWithResult(_0x388119,null))['catch'](handleError(_0x388119,null));};exports[_0xa870('0x29')]=function(_0x3df4bd,_0x3cdfaf){return db[_0xa870('0x30')][_0xa870('0x4a')]({'where':{'id':_0x3df4bd['params']['id']}})[_0xa870('0x28')](handleEntityNotFound(_0x3cdfaf,null))[_0xa870('0x28')](removeEntity(_0x3cdfaf,null))[_0xa870('0x46')](handleError(_0x3cdfaf,null));}; \ No newline at end of file +var _0x7b7f=['../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','save','then','destroy','error','stack','name','send','index','map','VtigerField','fieldName','type','key','keys','query','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','find','create','body','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1ad68e,_0x16562f){var _0x82d21e=function(_0x755572){while(--_0x755572){_0x1ad68e['push'](_0x1ad68e['shift']());}};_0x82d21e(++_0x16562f);}(_0x7b7f,0x160));var _0xf7b7=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7b7f[_0x134c2e];return _0x2825db;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf7b7('0x0'));var zipdir=require(_0xf7b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf7b7('0x2'));var moment=require(_0xf7b7('0x3'));var BPromise=require(_0xf7b7('0x4'));var Mustache=require(_0xf7b7('0x5'));var util=require(_0xf7b7('0x6'));var path=require(_0xf7b7('0x7'));var sox=require(_0xf7b7('0x8'));var csv=require(_0xf7b7('0x9'));var ejs=require(_0xf7b7('0xa'));var fs=require('fs');var fs_extra=require(_0xf7b7('0xb'));var _=require(_0xf7b7('0xc'));var squel=require(_0xf7b7('0xd'));var crypto=require(_0xf7b7('0xe'));var jsforce=require(_0xf7b7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xf7b7('0x9'));var querystring=require(_0xf7b7('0x10'));var Papa=require(_0xf7b7('0x11'));var Redis=require('ioredis');var authService=require(_0xf7b7('0x12'));var qs=require(_0xf7b7('0x13'));var as=require(_0xf7b7('0x14'));var hardwareService=require(_0xf7b7('0x15'));var logger=require(_0xf7b7('0x16'))('api');var utils=require(_0xf7b7('0x17'));var config=require(_0xf7b7('0x18'));var licenseUtil=require(_0xf7b7('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x348d03,_0x1e2bed){_0x1e2bed=_0x1e2bed||0xcc;return function(_0x2718ec){if(_0x2718ec){return _0x348d03[_0xf7b7('0x1a')](_0x1e2bed);}return _0x348d03[_0xf7b7('0x1b')](_0x1e2bed)[_0xf7b7('0x1c')]();};}function respondWithResult(_0x1a71b8,_0x27e9e3){_0x27e9e3=_0x27e9e3||0xc8;return function(_0x52d3e4){if(_0x52d3e4){return _0x1a71b8[_0xf7b7('0x1b')](_0x27e9e3)[_0xf7b7('0x1d')](_0x52d3e4);}};}function respondWithFilteredResult(_0x1ed582,_0x2f981e){return function(_0x243099){if(_0x243099){var _0x50484a=typeof _0x2f981e[_0xf7b7('0x1e')]===_0xf7b7('0x1f')&&typeof _0x2f981e['limit']===_0xf7b7('0x1f');var _0x509741=_0x243099['count'];var _0x37cee3=_0x50484a?0x0:_0x2f981e[_0xf7b7('0x1e')];var _0xd02cfc=_0x50484a?_0x243099[_0xf7b7('0x20')]:_0x2f981e[_0xf7b7('0x1e')]+_0x2f981e['limit'];var _0x28d391;if(_0xd02cfc>=_0x509741){_0xd02cfc=_0x509741;_0x28d391=0xc8;}else{_0x28d391=0xce;}_0x1ed582[_0xf7b7('0x1b')](_0x28d391);return _0x1ed582[_0xf7b7('0x21')](_0xf7b7('0x22'),_0x37cee3+'-'+_0xd02cfc+'/'+_0x509741)['json'](_0x243099);}return null;};}function patchUpdates(_0x4397ea){return function(_0x3f89ef){try{jsonpatch['apply'](_0x3f89ef,_0x4397ea,!![]);}catch(_0x51040a){return BPromise['reject'](_0x51040a);}return _0x3f89ef[_0xf7b7('0x23')]();};}function saveUpdates(_0x59c35a,_0x22cd4e){return function(_0x2ded5e){if(_0x2ded5e){return _0x2ded5e['update'](_0x59c35a)[_0xf7b7('0x24')](function(_0x34099d){return _0x34099d;});}return null;};}function removeEntity(_0x3904f7,_0x50bb1e){return function(_0x369988){if(_0x369988){return _0x369988[_0xf7b7('0x25')]()[_0xf7b7('0x24')](function(){_0x3904f7[_0xf7b7('0x1b')](0xcc)[_0xf7b7('0x1c')]();});}};}function handleEntityNotFound(_0x394e77,_0x27ef4b){return function(_0x1ea3ac){if(!_0x1ea3ac){_0x394e77[_0xf7b7('0x1a')](0x194);}return _0x1ea3ac;};}function handleError(_0x3784cf,_0x20495e){_0x20495e=_0x20495e||0x1f4;return function(_0x3304a6){logger[_0xf7b7('0x26')](_0x3304a6[_0xf7b7('0x27')]);if(_0x3304a6[_0xf7b7('0x28')]){delete _0x3304a6['name'];}_0x3784cf[_0xf7b7('0x1b')](_0x20495e)[_0xf7b7('0x29')](_0x3304a6);};}exports[_0xf7b7('0x2a')]=function(_0x2480d7,_0x41b19a){var _0x187c7c={},_0x143bee={},_0x3466d7={'count':0x0,'rows':[]};var _0x5a41ae=_[_0xf7b7('0x2b')](db[_0xf7b7('0x2c')]['rawAttributes'],function(_0x2dc53b){return{'name':_0x2dc53b[_0xf7b7('0x2d')],'type':_0x2dc53b[_0xf7b7('0x2e')][_0xf7b7('0x2f')]};});_0x143bee['model']=_[_0xf7b7('0x2b')](_0x5a41ae,'name');_0x143bee['query']=_[_0xf7b7('0x30')](_0x2480d7[_0xf7b7('0x31')]);_0x143bee['filters']=_[_0xf7b7('0x32')](_0x143bee['model'],_0x143bee[_0xf7b7('0x31')]);_0x187c7c[_0xf7b7('0x33')]=_['intersection'](_0x143bee[_0xf7b7('0x34')],qs['fields'](_0x2480d7['query'][_0xf7b7('0x35')]));_0x187c7c[_0xf7b7('0x33')]=_0x187c7c[_0xf7b7('0x33')][_0xf7b7('0x36')]?_0x187c7c[_0xf7b7('0x33')]:_0x143bee[_0xf7b7('0x34')];if(!_0x2480d7['query'][_0xf7b7('0x37')]('nolimit')){_0x187c7c[_0xf7b7('0x38')]=qs[_0xf7b7('0x38')](_0x2480d7['query'][_0xf7b7('0x38')]);_0x187c7c[_0xf7b7('0x1e')]=qs[_0xf7b7('0x1e')](_0x2480d7['query'][_0xf7b7('0x1e')]);}_0x187c7c[_0xf7b7('0x39')]=qs[_0xf7b7('0x3a')](_0x2480d7['query'][_0xf7b7('0x3a')]);_0x187c7c[_0xf7b7('0x3b')]=qs[_0xf7b7('0x3c')](_[_0xf7b7('0x3d')](_0x2480d7['query'],_0x143bee[_0xf7b7('0x3c')]),_0x5a41ae);if(_0x2480d7[_0xf7b7('0x31')][_0xf7b7('0x3e')]){_0x187c7c['where']=_['merge'](_0x187c7c[_0xf7b7('0x3b')],{'$or':_[_0xf7b7('0x2b')](_0x5a41ae,function(_0x695d79){if(_0x695d79[_0xf7b7('0x2e')]!==_0xf7b7('0x3f')){var _0x4985ff={};_0x4985ff[_0x695d79[_0xf7b7('0x28')]]={'$like':'%'+_0x2480d7[_0xf7b7('0x31')][_0xf7b7('0x3e')]+'%'};return _0x4985ff;}})});}_0x187c7c=_[_0xf7b7('0x40')]({},_0x187c7c,_0x2480d7[_0xf7b7('0x41')]);var _0xe8fef1={'where':_0x187c7c[_0xf7b7('0x3b')]};return db['VtigerField'][_0xf7b7('0x20')](_0xe8fef1)['then'](function(_0x12be03){_0x3466d7[_0xf7b7('0x20')]=_0x12be03;if(_0x2480d7[_0xf7b7('0x31')][_0xf7b7('0x42')]){_0x187c7c[_0xf7b7('0x43')]=[{'all':!![]}];}return db[_0xf7b7('0x2c')][_0xf7b7('0x44')](_0x187c7c);})[_0xf7b7('0x24')](function(_0x54a41f){_0x3466d7['rows']=_0x54a41f;return _0x3466d7;})[_0xf7b7('0x24')](respondWithFilteredResult(_0x41b19a,_0x187c7c))[_0xf7b7('0x45')](handleError(_0x41b19a,null));};exports['show']=function(_0x1d9920,_0x545422){var _0x36e028={'raw':!![],'where':{'id':_0x1d9920[_0xf7b7('0x46')]['id']}},_0xc0f3f3={};_0xc0f3f3[_0xf7b7('0x34')]=_[_0xf7b7('0x30')](db[_0xf7b7('0x2c')]['rawAttributes']);_0xc0f3f3[_0xf7b7('0x31')]=_[_0xf7b7('0x30')](_0x1d9920[_0xf7b7('0x31')]);_0xc0f3f3['filters']=_[_0xf7b7('0x32')](_0xc0f3f3['model'],_0xc0f3f3[_0xf7b7('0x31')]);_0x36e028[_0xf7b7('0x33')]=_['intersection'](_0xc0f3f3[_0xf7b7('0x34')],qs[_0xf7b7('0x35')](_0x1d9920[_0xf7b7('0x31')][_0xf7b7('0x35')]));_0x36e028[_0xf7b7('0x33')]=_0x36e028[_0xf7b7('0x33')][_0xf7b7('0x36')]?_0x36e028[_0xf7b7('0x33')]:_0xc0f3f3[_0xf7b7('0x34')];if(_0x1d9920[_0xf7b7('0x31')][_0xf7b7('0x42')]){_0x36e028['include']=[{'all':!![]}];}_0x36e028=_[_0xf7b7('0x40')]({},_0x36e028,_0x1d9920['options']);return db[_0xf7b7('0x2c')][_0xf7b7('0x47')](_0x36e028)[_0xf7b7('0x24')](handleEntityNotFound(_0x545422,null))[_0xf7b7('0x24')](respondWithResult(_0x545422,null))[_0xf7b7('0x45')](handleError(_0x545422,null));};exports[_0xf7b7('0x48')]=function(_0x2d4bf2,_0xacf217){return db['VtigerField'][_0xf7b7('0x48')](_0x2d4bf2[_0xf7b7('0x49')],{})[_0xf7b7('0x24')](respondWithResult(_0xacf217,0xc9))[_0xf7b7('0x45')](handleError(_0xacf217,null));};exports[_0xf7b7('0x4a')]=function(_0x42e635,_0x376cec){if(_0x42e635[_0xf7b7('0x49')]['id']){delete _0x42e635[_0xf7b7('0x49')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x42e635[_0xf7b7('0x46')]['id']}})[_0xf7b7('0x24')](handleEntityNotFound(_0x376cec,null))[_0xf7b7('0x24')](saveUpdates(_0x42e635[_0xf7b7('0x49')],null))[_0xf7b7('0x24')](respondWithResult(_0x376cec,null))[_0xf7b7('0x45')](handleError(_0x376cec,null));};exports[_0xf7b7('0x25')]=function(_0x5bd277,_0x4148f5){return db[_0xf7b7('0x2c')][_0xf7b7('0x47')]({'where':{'id':_0x5bd277['params']['id']}})[_0xf7b7('0x24')](handleEntityNotFound(_0x4148f5,null))[_0xf7b7('0x24')](removeEntity(_0x4148f5,null))['catch'](handleError(_0x4148f5,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index e5a9389..8dc5c91 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 _0xc05e=['rimraf','./intVtigerField.attributes','exports','define','VtigerField','int_vtiger_fields','idField','lodash','util','../../config/logger','bluebird'];(function(_0x424b2b,_0x5b2dae){var _0x1b193e=function(_0x53a3d4){while(--_0x53a3d4){_0x424b2b['push'](_0x424b2b['shift']());}};_0x1b193e(++_0x5b2dae);}(_0xc05e,0x1b4));var _0xec05=function(_0x3eb556,_0x19f80d){_0x3eb556=_0x3eb556-0x0;var _0x24ec02=_0xc05e[_0x3eb556];return _0x24ec02;};'use strict';var _=require(_0xec05('0x0'));var util=require(_0xec05('0x1'));var logger=require(_0xec05('0x2'))('api');var moment=require('moment');var BPromise=require(_0xec05('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xec05('0x4'));var config=require('../../config/environment');var attributes=require(_0xec05('0x5'));module[_0xec05('0x6')]=function(_0x1f2978,_0x12654a){return _0x1f2978[_0xec05('0x7')](_0xec05('0x8'),attributes,{'tableName':_0xec05('0x9'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0xec05('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x453f=['int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','../../config/logger','api','bluebird','request-promise','path','./intVtigerField.attributes','exports','define','VtigerField'];(function(_0xb60ae4,_0x48b458){var _0x53d530=function(_0x5c0743){while(--_0x5c0743){_0xb60ae4['push'](_0xb60ae4['shift']());}};_0x53d530(++_0x48b458);}(_0x453f,0x12a));var _0xf453=function(_0x27dd02,_0x2d1191){_0x27dd02=_0x27dd02-0x0;var _0x3b2883=_0x453f[_0x27dd02];return _0x3b2883;};'use strict';var _=require(_0xf453('0x0'));var util=require('util');var logger=require(_0xf453('0x1'))(_0xf453('0x2'));var moment=require('moment');var BPromise=require(_0xf453('0x3'));var rp=require(_0xf453('0x4'));var fs=require('fs');var path=require(_0xf453('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xf453('0x6'));module[_0xf453('0x7')]=function(_0x5c3a52,_0x365435){return _0x5c3a52[_0xf453('0x8')](_0xf453('0x9'),attributes,{'tableName':_0xf453('0xa'),'paranoid':![],'indexes':[{'name':_0xf453('0xb'),'fields':[_0xf453('0xc'),_0xf453('0xd')],'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 17eb26d..3c23b82 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 _0xd099=['VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VtigerField,\x20%s,\x20%s','debug'];(function(_0x467f51,_0x284171){var _0x15dcf2=function(_0x18306b){while(--_0x18306b){_0x467f51['push'](_0x467f51['shift']());}};_0x15dcf2(++_0x284171);}(_0xd099,0x68));var _0x9d09=function(_0x5216e0,_0x4f8cb9){_0x5216e0=_0x5216e0-0x0;var _0x5b3f40=_0xd099[_0x5216e0];return _0x5b3f40;};'use strict';var _=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var moment=require(_0x9d09('0x2'));var BPromise=require('bluebird');var rs=require(_0x9d09('0x3'));var fs=require('fs');var Redis=require(_0x9d09('0x4'));var db=require(_0x9d09('0x5'))['db'];var utils=require(_0x9d09('0x6'));var logger=require(_0x9d09('0x7'))(_0x9d09('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9d09('0x9')][_0x9d09('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4be0e1,_0x3d1c39,_0x42bc40){return new BPromise(function(_0x44b436,_0x31a305){return client[_0x9d09('0xb')](_0x4be0e1,_0x42bc40)[_0x9d09('0xc')](function(_0x385b21){logger[_0x9d09('0xd')](_0x9d09('0xe'),_0x3d1c39,'request\x20sent');logger[_0x9d09('0xf')](_0x9d09('0x10'),_0x3d1c39,_0x9d09('0x11'),JSON[_0x9d09('0x12')](_0x385b21));if(_0x385b21['error']){if(_0x385b21[_0x9d09('0x13')][_0x9d09('0x14')]===0x1f4){logger[_0x9d09('0x13')]('VtigerField,\x20%s,\x20%s',_0x3d1c39,_0x385b21['error']['message']);return _0x31a305(_0x385b21['error']['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x3d1c39,_0x385b21[_0x9d09('0x13')][_0x9d09('0x15')]);return _0x44b436(_0x385b21[_0x9d09('0x13')]['message']);}else{logger[_0x9d09('0xd')](_0x9d09('0xe'),_0x3d1c39,_0x9d09('0x11'));_0x44b436(_0x385b21[_0x9d09('0x16')]['message']);}})[_0x9d09('0x17')](function(_0x5af809){logger[_0x9d09('0x13')](_0x9d09('0xe'),_0x3d1c39,_0x5af809);_0x31a305(_0x5af809);});});} \ No newline at end of file +var _0x12b0=['message','result','catch','util','moment','bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3f147e,_0x251ea9){var _0x4bc67c=function(_0xc9c673){while(--_0xc9c673){_0x3f147e['push'](_0x3f147e['shift']());}};_0x4bc67c(++_0x251ea9);}(_0x12b0,0x157));var _0x012b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x12b0[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0x012b('0x0'));var moment=require(_0x012b('0x1'));var BPromise=require(_0x012b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x012b('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x012b('0x4'));var config=require(_0x012b('0x5'));var jayson=require(_0x012b('0x6'));var client=jayson[_0x012b('0x7')][_0x012b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x555a1c,_0x557da8,_0x36292b){return new BPromise(function(_0x6c2083,_0x376fcf){return client[_0x012b('0x9')](_0x555a1c,_0x36292b)[_0x012b('0xa')](function(_0x35df72){logger[_0x012b('0xb')](_0x012b('0xc'),_0x557da8,'request\x20sent');logger['debug']('VtigerField,\x20%s,\x20%s,\x20%s',_0x557da8,_0x012b('0xd'),JSON[_0x012b('0xe')](_0x35df72));if(_0x35df72[_0x012b('0xf')]){if(_0x35df72[_0x012b('0xf')][_0x012b('0x10')]===0x1f4){logger[_0x012b('0xf')](_0x012b('0xc'),_0x557da8,_0x35df72[_0x012b('0xf')][_0x012b('0x11')]);return _0x376fcf(_0x35df72[_0x012b('0xf')][_0x012b('0x11')]);}logger['error'](_0x012b('0xc'),_0x557da8,_0x35df72[_0x012b('0xf')][_0x012b('0x11')]);return _0x6c2083(_0x35df72['error'][_0x012b('0x11')]);}else{logger['info'](_0x012b('0xc'),_0x557da8,_0x012b('0xd'));_0x6c2083(_0x35df72[_0x012b('0x12')][_0x012b('0x11')]);}})[_0x012b('0x13')](function(_0x3a2f61){logger[_0x012b('0xf')](_0x012b('0xc'),_0x557da8,_0x3a2f61);_0x376fcf(_0x3a2f61);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index d4cdc61..2c57bfd 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 _0xa635=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','/:id','show','isAuthenticated','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy'];(function(_0x40f6a3,_0x52c0b7){var _0x4f3511=function(_0x166649){while(--_0x166649){_0x40f6a3['push'](_0x40f6a3['shift']());}};_0x4f3511(++_0x52c0b7);}(_0xa635,0x73));var _0x5a63=function(_0x39b710,_0x195461){_0x39b710=_0x39b710-0x0;var _0x1bbfe9=_0xa635[_0x39b710];return _0x1bbfe9;};'use strict';var multer=require(_0x5a63('0x0'));var util=require(_0x5a63('0x1'));var path=require(_0x5a63('0x2'));var timeout=require(_0x5a63('0x3'));var express=require(_0x5a63('0x4'));var router=express[_0x5a63('0x5')]();var fs_extra=require(_0x5a63('0x6'));var auth=require(_0x5a63('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5a63('0x8'));var controller=require(_0x5a63('0x9'));router[_0x5a63('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5a63('0xa')](_0x5a63('0xb'),auth['isAuthenticated'](),controller[_0x5a63('0xc')]);router['get']('/:id/configurations',auth[_0x5a63('0xd')](),controller['getConfigurations']);router[_0x5a63('0xa')](_0x5a63('0xe'),auth[_0x5a63('0xd')](),controller[_0x5a63('0xf')]);router[_0x5a63('0x10')]('/',auth[_0x5a63('0xd')](),controller[_0x5a63('0x11')]);router[_0x5a63('0x10')](_0x5a63('0x12'),auth[_0x5a63('0xd')](),controller[_0x5a63('0x13')]);router[_0x5a63('0x14')](_0x5a63('0xb'),auth[_0x5a63('0xd')](),controller['update']);router[_0x5a63('0x15')](_0x5a63('0xb'),auth['isAuthenticated'](),controller[_0x5a63('0x16')]);module['exports']=router; \ No newline at end of file +var _0x3b5d=['exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','/:id','show','get','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3b5d,0x85));var _0xd3b5=function(_0xca6909,_0x31d421){_0xca6909=_0xca6909-0x0;var _0x44d08e=_0x3b5d[_0xca6909];return _0x44d08e;};'use strict';var multer=require(_0xd3b5('0x0'));var util=require(_0xd3b5('0x1'));var path=require(_0xd3b5('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xd3b5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd3b5('0x4'));var interaction=require(_0xd3b5('0x5'));var config=require('../../config/environment');var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0xd3b5('0x6')](),controller[_0xd3b5('0x7')]);router['get'](_0xd3b5('0x8'),auth[_0xd3b5('0x6')](),controller[_0xd3b5('0x9')]);router[_0xd3b5('0xa')](_0xd3b5('0xb'),auth[_0xd3b5('0x6')](),controller[_0xd3b5('0xc')]);router[_0xd3b5('0xa')]('/:id/fields',auth[_0xd3b5('0x6')](),controller[_0xd3b5('0xd')]);router[_0xd3b5('0xe')]('/',auth[_0xd3b5('0x6')](),controller[_0xd3b5('0xf')]);router['post'](_0xd3b5('0xb'),auth['isAuthenticated'](),controller[_0xd3b5('0x10')]);router[_0xd3b5('0x11')](_0xd3b5('0x8'),auth['isAuthenticated'](),controller[_0xd3b5('0x12')]);router[_0xd3b5('0x13')](_0xd3b5('0x8'),auth[_0xd3b5('0x6')](),controller[_0xd3b5('0x14')]);module[_0xd3b5('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index b745ba6..cc010cd 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 _0x90b1=['ENUM','integrationTab','newTab','sequelize','exports','STRING','username','password'];(function(_0x5e3291,_0x360223){var _0x32072b=function(_0x25b36a){while(--_0x25b36a){_0x5e3291['push'](_0x5e3291['shift']());}};_0x32072b(++_0x360223);}(_0x90b1,0x1bb));var _0x190b=function(_0x53f122,_0x2cdeca){_0x53f122=_0x53f122-0x0;var _0x59a134=_0x90b1[_0x53f122];return _0x59a134;};'use strict';var Sequelize=require(_0x190b('0x0'));module[_0x190b('0x1')]={'name':{'type':Sequelize[_0x190b('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x190b('0x3')},'password':{'type':Sequelize[_0x190b('0x2')]},'token':{'type':Sequelize[_0x190b('0x2')]},'remoteUri':{'type':Sequelize[_0x190b('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0x190b('0x4')},'serverUrl':{'type':Sequelize[_0x190b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x190b('0x5')](_0x190b('0x6'),_0x190b('0x7')),'defaultValue':_0x190b('0x6')}}; \ No newline at end of file +var _0x0650=['remoteUri','password','ENUM','integrationTab','newTab','sequelize','STRING','username'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x0650,0xed));var _0x0065=function(_0x2009c8,_0x407d34){_0x2009c8=_0x2009c8-0x0;var _0x2560c4=_0x0650[_0x2009c8];return _0x2560c4;};'use strict';var Sequelize=require(_0x0065('0x0'));module['exports']={'name':{'type':Sequelize[_0x0065('0x1')]},'description':{'type':Sequelize[_0x0065('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x0065('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x0065('0x1')]},'remoteUri':{'type':Sequelize[_0x0065('0x1')],'unique':_0x0065('0x3')},'authType':{'type':Sequelize['ENUM'](_0x0065('0x4'),'token'),'defaultValue':'password'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x0065('0x5')](_0x0065('0x6'),_0x0065('0x7')),'defaultValue':_0x0065('0x6')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 2c8a983..cd51bd8 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 _0x80ed=['rawAttributes','sort','pick','filter','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','ZendeskAccount','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne'];(function(_0x3175e6,_0x126421){var _0x321dc5=function(_0x15ccc1){while(--_0x15ccc1){_0x3175e6['push'](_0x3175e6['shift']());}};_0x321dc5(++_0x126421);}(_0x80ed,0x11c));var _0xd80e=function(_0x2fc1ec,_0x4b96e7){_0x2fc1ec=_0x2fc1ec-0x0;var _0x11a7fa=_0x80ed[_0x2fc1ec];return _0x11a7fa;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];var integrations=require(_0xd80e('0x1b'));function respondWithStatusCode(_0x1d3fcf,_0x4fb01c){_0x4fb01c=_0x4fb01c||0xcc;return function(_0x5691a1){if(_0x5691a1){return _0x1d3fcf['sendStatus'](_0x4fb01c);}return _0x1d3fcf['status'](_0x4fb01c)[_0xd80e('0x1c')]();};}function respondWithResult(_0x3d233b,_0x3096ae){_0x3096ae=_0x3096ae||0xc8;return function(_0x1e8b63){if(_0x1e8b63){return _0x3d233b[_0xd80e('0x1d')](_0x3096ae)['json'](_0x1e8b63);}};}function respondWithFilteredResult(_0x595683,_0x2c8c61){return function(_0x3124e8){if(_0x3124e8){var _0x3b48ae=typeof _0x2c8c61[_0xd80e('0x1e')]===_0xd80e('0x1f')&&typeof _0x2c8c61[_0xd80e('0x20')]===_0xd80e('0x1f');var _0x49e3e5=_0x3124e8[_0xd80e('0x21')];var _0x1cc576=_0x3b48ae?0x0:_0x2c8c61[_0xd80e('0x1e')];var _0x34e239=_0x3b48ae?_0x3124e8['count']:_0x2c8c61[_0xd80e('0x1e')]+_0x2c8c61[_0xd80e('0x20')];var _0xecfe74;if(_0x34e239>=_0x49e3e5){_0x34e239=_0x49e3e5;_0xecfe74=0xc8;}else{_0xecfe74=0xce;}_0x595683['status'](_0xecfe74);return _0x595683[_0xd80e('0x22')](_0xd80e('0x23'),_0x1cc576+'-'+_0x34e239+'/'+_0x49e3e5)[_0xd80e('0x24')](_0x3124e8);}return null;};}function patchUpdates(_0x147134){return function(_0x46b6eb){try{jsonpatch['apply'](_0x46b6eb,_0x147134,!![]);}catch(_0x4b6b8a){return BPromise[_0xd80e('0x25')](_0x4b6b8a);}return _0x46b6eb[_0xd80e('0x26')]();};}function saveUpdates(_0x3b39bf,_0x2d46e7){return function(_0x3eb3ca){if(_0x3eb3ca){return _0x3eb3ca[_0xd80e('0x27')](_0x3b39bf)[_0xd80e('0x28')](function(_0x5430b6){return _0x5430b6;});}return null;};}function removeEntity(_0x1fbf8a,_0x57d70){return function(_0x170109){if(_0x170109){return _0x170109['destroy']()[_0xd80e('0x28')](function(){_0x1fbf8a[_0xd80e('0x1d')](0xcc)[_0xd80e('0x1c')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1d')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x20')](_0x1ad3bc['query'][_0xd80e('0x20')]);_0x39088b[_0xd80e('0x1e')]=qs[_0xd80e('0x1e')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3b')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x39088b[_0xd80e('0x3c')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3e')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x3f')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x40')]['count'](_0x3ff4b4)[_0xd80e('0x28')](function(_0x5ade19){_0x361946[_0xd80e('0x21')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x40')][_0xd80e('0x41')](_0x39088b);})[_0xd80e('0x28')](function(_0x3e65a7){_0x361946[_0xd80e('0x42')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x28')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x43')](handleError(_0x845451,null));};exports[_0xd80e('0x44')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':![],'where':{'id':_0x91c6ed[_0xd80e('0x45')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x40')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x46')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3d')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x3f')]);return db[_0xd80e('0x40')]['find'](_0x1bbb36)[_0xd80e('0x28')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x28')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x43')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x40')][_0xd80e('0x47')](_0x8d5cb8[_0xd80e('0x48')],{})[_0xd80e('0x28')](respondWithResult(_0x29aaa0,0xc9))['catch'](handleError(_0x29aaa0,null));};exports['update']=function(_0x275985,_0x27134e){if(_0x275985[_0xd80e('0x48')]['id']){delete _0x275985['body']['id'];}return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x275985[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x27134e,null))[_0xd80e('0x28')](saveUpdates(_0x275985[_0xd80e('0x48')],null))['then'](respondWithResult(_0x27134e,null))[_0xd80e('0x43')](handleError(_0x27134e,null));};exports['destroy']=function(_0x46c781,_0x31107b){return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x46c781[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x31107b,null))[_0xd80e('0x28')](removeEntity(_0x31107b,null))[_0xd80e('0x43')](handleError(_0x31107b,null));};exports[_0xd80e('0x4a')]=function(_0x18dbb0,_0x50be26,_0x178c51){var _0x377e68={};var _0x419df7={};var _0x4a66ca;var _0x52ab04;return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x18dbb0[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x50be26,null))[_0xd80e('0x28')](function(_0x8b7a70){if(_0x8b7a70){_0x4a66ca=_0x8b7a70;_0x419df7[_0xd80e('0x31')]=_[_0xd80e('0x32')](db['ZendeskConfiguration'][_0xd80e('0x4c')]);_0x419df7['query']=_[_0xd80e('0x32')](_0x18dbb0[_0xd80e('0x33')]);_0x419df7[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x419df7[_0xd80e('0x31')],_0x419df7[_0xd80e('0x33')]);_0x377e68['attributes']=_[_0xd80e('0x35')](_0x419df7['model'],qs[_0xd80e('0x37')](_0x18dbb0[_0xd80e('0x33')]['fields']));_0x377e68['attributes']=_0x377e68[_0xd80e('0x36')][_0xd80e('0x38')]?_0x377e68[_0xd80e('0x36')]:_0x419df7['model'];_0x377e68['order']=qs[_0xd80e('0x4d')](_0x18dbb0[_0xd80e('0x33')]['sort']);_0x377e68[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_[_0xd80e('0x4e')](_0x18dbb0['query'],_0x419df7[_0xd80e('0x34')]));if(_0x18dbb0['query'][_0xd80e('0x4f')]){_0x377e68[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x377e68[_0xd80e('0x3c')],{'$or':_['map'](_0x377e68[_0xd80e('0x36')],function(_0x564475){var _0x53b784={};_0x53b784[_0x564475]={'$like':'%'+_0x18dbb0['query'][_0xd80e('0x4f')]+'%'};return _0x53b784;})});}_0x377e68=_[_0xd80e('0x3d')]({},_0x377e68,_0x18dbb0[_0xd80e('0x3f')]);return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x1738ff){if(_0x1738ff){_0x52ab04=_0x1738ff[_0xd80e('0x38')];if(!_0x18dbb0['query'][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x377e68[_0xd80e('0x20')]=qs[_0xd80e('0x20')](_0x18dbb0['query'][_0xd80e('0x20')]);_0x377e68[_0xd80e('0x1e')]=qs['offset'](_0x18dbb0[_0xd80e('0x33')][_0xd80e('0x1e')]);}return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x562ed7){if(_0x562ed7){return _0x562ed7?{'count':_0x52ab04,'rows':_0x562ed7}:null;}})['then'](respondWithResult(_0x50be26,null))['catch'](handleError(_0x50be26,null));};exports[_0xd80e('0x50')]=function(_0x4f283c,_0x3c8ad1,_0x1b0ad4){if(_0x4f283c[_0xd80e('0x48')]['id']){delete _0x4f283c['body']['id'];}return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x4f283c[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x3c8ad1,null))[_0xd80e('0x28')](function(_0x2a34cd){if(_0x2a34cd){_0x4f283c[_0xd80e('0x48')][_0xd80e('0x51')]=_0x2a34cd['id'];_0x4f283c[_0xd80e('0x48')]['Subjects']=integrations['getSubjects'](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')][_0xd80e('0x2f')]);_0x4f283c['body'][_0xd80e('0x53')]=integrations[_0xd80e('0x54')](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')]['type']);return db[_0xd80e('0x55')][_0xd80e('0x47')](_0x4f283c[_0xd80e('0x48')],{'include':[{'model':db[_0xd80e('0x56')],'as':'Subjects'},{'model':db[_0xd80e('0x56')],'as':_0xd80e('0x53')}]});}return null;})[_0xd80e('0x28')](respondWithResult(_0x3c8ad1,null))[_0xd80e('0x43')](handleError(_0x3c8ad1,null));};exports[_0xd80e('0x57')]=function(_0x1edcf4,_0x5cb11c,_0x3e3176){var _0x393fb6='';return db['ZendeskAccount'][_0xd80e('0x4b')]({'where':{'id':_0x1edcf4[_0xd80e('0x45')]['id']},'attributes':['id',_0xd80e('0x58'),_0xd80e('0x59'),'token',_0xd80e('0x5a'),'remoteUri']})[_0xd80e('0x28')](handleEntityNotFound(_0x5cb11c,null))[_0xd80e('0x28')](function(_0x194743){if(_0x194743){_0x393fb6=_0x194743[_0xd80e('0x5b')];var _0x4186bd=_0x393fb6['slice'](-0x1);if(_0x4186bd==='/'){_0x393fb6=_0x393fb6[_0xd80e('0x5c')](0x0,_0x393fb6[_0xd80e('0x5d')](_0x4186bd));}var _0x25e86d={'method':_0xd80e('0x5e'),'uri':util['format'](_0xd80e('0x5f'),_0x393fb6,_0xd80e('0x60')),'json':!![]};switch(_0x194743['authType']){case _0xd80e('0x59'):_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x64'),_0x194743['username'],_0x194743['password']))[_0xd80e('0x65')]('base64'))};break;case'token':_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x66'),_0x194743[_0xd80e('0x58')],_0x194743[_0xd80e('0x67')]))[_0xd80e('0x65')]('base64'))};break;default:throw new db[(_0xd80e('0x68'))][(_0xd80e('0x69'))](_0xd80e('0x6a'));}return rp(_0x25e86d);}})[_0xd80e('0x28')](function(_0x575bf6){if(_0x575bf6){var _0x192178=[_0xd80e('0x6b'),'description',_0xd80e('0x6c'),_0xd80e('0x6d')];_['remove'](_0x575bf6[_0xd80e('0x60')],function(_0x160dc4){return _0x192178[_0xd80e('0x6e')](_0x160dc4[_0xd80e('0x2f')]);});return{'count':_0x575bf6[_0xd80e('0x60')][_0xd80e('0x38')],'rows':_[_0xd80e('0x2d')](_0x575bf6[_0xd80e('0x60')],function(_0x392a8b){return{'id':_0x392a8b['id'],'name':_0x392a8b[_0xd80e('0x6f')]>0x7?_0x392a8b['title']:_0x392a8b[_0xd80e('0x2f')],'custom':_0x392a8b[_0xd80e('0x6f')]>0x7?!![]:![],'options':_0x392a8b['system_field_options']?_0x392a8b[_0xd80e('0x70')]:_0x392a8b[_0xd80e('0x71')]?_0x392a8b[_0xd80e('0x71')]:[]};})};}})['then'](respondWithResult(_0x5cb11c,null))[_0xd80e('0x43')](function(_0x5277a2){var _0x30fc66=_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?0x1f4:_0x5277a2[_0xd80e('0x73')]||0x1f4;logger[_0xd80e('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd80e('0x57'),_0x30fc66,JSON[_0xd80e('0x75')](_0x5277a2));delete _0x5277a2[_0xd80e('0x2b')];if(_0x30fc66===0x191){_0x30fc66=0x190;}_0x5cb11c[_0xd80e('0x1d')](_0x30fc66)[_0xd80e('0x76')](_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?{'message':_0xd80e('0x77'),'statusCode':_0x5277a2[_0xd80e('0x73')]}:_0x5277a2);});}; \ No newline at end of file +var _0x351d=['Subjects','Descriptions','getFields','password','token','remoteUri','slice','substring','lastIndexOf','format','%s/%s','authType','headers','Basic\x20%s','%s:%s','username','toString','base64','%s/token:%s','ValidationError','Unknown\x20authentication\x20type','subject','description','group','assignee','ticket_fields','position','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../components/integrations/configuration','status','end','json','undefined','count','offset','Content-Range','apply','reject','then','destroy','sendStatus','stack','index','rawAttributes','fieldName','type','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','where','pick','filter','merge','options','ZendeskAccount','includeAll','findAll','catch','params','include','find','create','body','update','findOne','ZendeskConfiguration','order','sort','getConfigurations','addConfiguration','AccountId','getSubjects','getDescriptions','channel','ZendeskField'];(function(_0x48fcee,_0x431a8b){var _0x28d65a=function(_0x28b4ad){while(--_0x28b4ad){_0x48fcee['push'](_0x48fcee['shift']());}};_0x28d65a(++_0x431a8b);}(_0x351d,0x90));var _0xd351=function(_0x2739bd,_0x3d7150){_0x2739bd=_0x2739bd-0x0;var _0x195ba2=_0x351d[_0x2739bd];return _0x195ba2;};'use strict';var emlformat=require(_0xd351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd351('0x1'));var jsonpatch=require(_0xd351('0x2'));var rp=require(_0xd351('0x3'));var moment=require('moment');var BPromise=require(_0xd351('0x4'));var Mustache=require('mustache');var util=require(_0xd351('0x5'));var path=require(_0xd351('0x6'));var sox=require('sox');var csv=require(_0xd351('0x7'));var ejs=require(_0xd351('0x8'));var fs=require('fs');var fs_extra=require(_0xd351('0x9'));var _=require('lodash');var squel=require(_0xd351('0xa'));var crypto=require(_0xd351('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd351('0xc'));var toCsv=require(_0xd351('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xd351('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd351('0xe'));var as=require(_0xd351('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd351('0x10'))(_0xd351('0x11'));var utils=require('../../config/utils');var config=require(_0xd351('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0xd351('0x13'));function respondWithStatusCode(_0x15549a,_0x23445f){_0x23445f=_0x23445f||0xcc;return function(_0x1eb2a9){if(_0x1eb2a9){return _0x15549a['sendStatus'](_0x23445f);}return _0x15549a[_0xd351('0x14')](_0x23445f)[_0xd351('0x15')]();};}function respondWithResult(_0x597d7c,_0xc5a145){_0xc5a145=_0xc5a145||0xc8;return function(_0xb106ef){if(_0xb106ef){return _0x597d7c[_0xd351('0x14')](_0xc5a145)[_0xd351('0x16')](_0xb106ef);}};}function respondWithFilteredResult(_0x3867fb,_0x4d238c){return function(_0x9f790f){if(_0x9f790f){var _0x49d8bb=typeof _0x4d238c['offset']===_0xd351('0x17')&&typeof _0x4d238c['limit']===_0xd351('0x17');var _0x1de35f=_0x9f790f[_0xd351('0x18')];var _0x4c6693=_0x49d8bb?0x0:_0x4d238c[_0xd351('0x19')];var _0x2bfc53=_0x49d8bb?_0x9f790f[_0xd351('0x18')]:_0x4d238c[_0xd351('0x19')]+_0x4d238c['limit'];var _0xc2d2c0;if(_0x2bfc53>=_0x1de35f){_0x2bfc53=_0x1de35f;_0xc2d2c0=0xc8;}else{_0xc2d2c0=0xce;}_0x3867fb['status'](_0xc2d2c0);return _0x3867fb['set'](_0xd351('0x1a'),_0x4c6693+'-'+_0x2bfc53+'/'+_0x1de35f)['json'](_0x9f790f);}return null;};}function patchUpdates(_0x33b1e5){return function(_0x2d75dd){try{jsonpatch[_0xd351('0x1b')](_0x2d75dd,_0x33b1e5,!![]);}catch(_0x42631b){return BPromise[_0xd351('0x1c')](_0x42631b);}return _0x2d75dd['save']();};}function saveUpdates(_0x18625b,_0xbbc58){return function(_0x241265){if(_0x241265){return _0x241265['update'](_0x18625b)[_0xd351('0x1d')](function(_0x2d9aa0){return _0x2d9aa0;});}return null;};}function removeEntity(_0x365bbc,_0x59fb6d){return function(_0x1ce279){if(_0x1ce279){return _0x1ce279[_0xd351('0x1e')]()[_0xd351('0x1d')](function(){_0x365bbc[_0xd351('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40f7f3,_0x483c92){return function(_0x358bff){if(!_0x358bff){_0x40f7f3[_0xd351('0x1f')](0x194);}return _0x358bff;};}function handleError(_0x54f471,_0x2648d0){_0x2648d0=_0x2648d0||0x1f4;return function(_0x55b4d3){logger['error'](_0x55b4d3[_0xd351('0x20')]);if(_0x55b4d3['name']){delete _0x55b4d3['name'];}_0x54f471[_0xd351('0x14')](_0x2648d0)['send'](_0x55b4d3);};}exports[_0xd351('0x21')]=function(_0x2ddae8,_0x407b50){var _0x4d3f48={},_0x71ce9c={},_0x4aa902={'count':0x0,'rows':[]};var _0x1c826b=_['map'](db['ZendeskAccount'][_0xd351('0x22')],function(_0x38c82f){return{'name':_0x38c82f[_0xd351('0x23')],'type':_0x38c82f[_0xd351('0x24')]['key']};});_0x71ce9c[_0xd351('0x25')]=_[_0xd351('0x26')](_0x1c826b,_0xd351('0x27'));_0x71ce9c[_0xd351('0x28')]=_[_0xd351('0x29')](_0x2ddae8[_0xd351('0x28')]);_0x71ce9c[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],_0x71ce9c['query']);_0x4d3f48[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x71ce9c[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x2ddae8['query'][_0xd351('0x2d')]));_0x4d3f48[_0xd351('0x2c')]=_0x4d3f48[_0xd351('0x2c')][_0xd351('0x2e')]?_0x4d3f48[_0xd351('0x2c')]:_0x71ce9c[_0xd351('0x25')];if(!_0x2ddae8[_0xd351('0x28')][_0xd351('0x2f')](_0xd351('0x30'))){_0x4d3f48['limit']=qs['limit'](_0x2ddae8[_0xd351('0x28')][_0xd351('0x31')]);_0x4d3f48[_0xd351('0x19')]=qs[_0xd351('0x19')](_0x2ddae8[_0xd351('0x28')][_0xd351('0x19')]);}_0x4d3f48['order']=qs['sort'](_0x2ddae8[_0xd351('0x28')]['sort']);_0x4d3f48[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x2ddae8[_0xd351('0x28')],_0x71ce9c[_0xd351('0x2a')]),_0x1c826b);if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]){_0x4d3f48[_0xd351('0x32')]=_[_0xd351('0x35')](_0x4d3f48[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x1c826b,function(_0x4b15db){if(_0x4b15db[_0xd351('0x24')]!=='VIRTUAL'){var _0x22631={};_0x22631[_0x4b15db[_0xd351('0x27')]]={'$like':'%'+_0x2ddae8[_0xd351('0x28')][_0xd351('0x34')]+'%'};return _0x22631;}})});}_0x4d3f48=_[_0xd351('0x35')]({},_0x4d3f48,_0x2ddae8[_0xd351('0x36')]);var _0x545bfc={'where':_0x4d3f48[_0xd351('0x32')]};return db[_0xd351('0x37')]['count'](_0x545bfc)[_0xd351('0x1d')](function(_0x2d8ea8){_0x4aa902[_0xd351('0x18')]=_0x2d8ea8;if(_0x2ddae8[_0xd351('0x28')][_0xd351('0x38')]){_0x4d3f48['include']=[{'all':!![]}];}return db['ZendeskAccount'][_0xd351('0x39')](_0x4d3f48);})[_0xd351('0x1d')](function(_0x5dae6d){_0x4aa902['rows']=_0x5dae6d;return _0x4aa902;})[_0xd351('0x1d')](respondWithFilteredResult(_0x407b50,_0x4d3f48))[_0xd351('0x3a')](handleError(_0x407b50,null));};exports['show']=function(_0x570d57,_0x46af23){var _0x18f9d1={'raw':![],'where':{'id':_0x570d57[_0xd351('0x3b')]['id']}},_0x3b8526={};_0x3b8526[_0xd351('0x25')]=_[_0xd351('0x29')](db[_0xd351('0x37')][_0xd351('0x22')]);_0x3b8526[_0xd351('0x28')]=_['keys'](_0x570d57['query']);_0x3b8526[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],_0x3b8526[_0xd351('0x28')]);_0x18f9d1[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x3b8526[_0xd351('0x25')],qs[_0xd351('0x2d')](_0x570d57[_0xd351('0x28')][_0xd351('0x2d')]));_0x18f9d1[_0xd351('0x2c')]=_0x18f9d1[_0xd351('0x2c')][_0xd351('0x2e')]?_0x18f9d1[_0xd351('0x2c')]:_0x3b8526[_0xd351('0x25')];if(_0x570d57[_0xd351('0x28')]['includeAll']){_0x18f9d1[_0xd351('0x3c')]=[{'all':!![]}];}_0x18f9d1=_[_0xd351('0x35')]({},_0x18f9d1,_0x570d57[_0xd351('0x36')]);return db['ZendeskAccount'][_0xd351('0x3d')](_0x18f9d1)[_0xd351('0x1d')](handleEntityNotFound(_0x46af23,null))[_0xd351('0x1d')](respondWithResult(_0x46af23,null))[_0xd351('0x3a')](handleError(_0x46af23,null));};exports[_0xd351('0x3e')]=function(_0x5bc86a,_0x5adea4){return db['ZendeskAccount'][_0xd351('0x3e')](_0x5bc86a[_0xd351('0x3f')],{})['then'](respondWithResult(_0x5adea4,0xc9))['catch'](handleError(_0x5adea4,null));};exports[_0xd351('0x40')]=function(_0x444206,_0x2af877){if(_0x444206['body']['id']){delete _0x444206[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')]['find']({'where':{'id':_0x444206[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2af877,null))[_0xd351('0x1d')](saveUpdates(_0x444206[_0xd351('0x3f')],null))['then'](respondWithResult(_0x2af877,null))['catch'](handleError(_0x2af877,null));};exports[_0xd351('0x1e')]=function(_0x58ce5a,_0xf9f375){return db[_0xd351('0x37')][_0xd351('0x3d')]({'where':{'id':_0x58ce5a['params']['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0xf9f375,null))['then'](removeEntity(_0xf9f375,null))['catch'](handleError(_0xf9f375,null));};exports['getConfigurations']=function(_0x7e4bad,_0x292af3,_0x334029){var _0x5a2e9b={};var _0x554e3a={};var _0x1748f0;var _0x42f248;return db['ZendeskAccount'][_0xd351('0x41')]({'where':{'id':_0x7e4bad[_0xd351('0x3b')]['id']}})['then'](handleEntityNotFound(_0x292af3,null))[_0xd351('0x1d')](function(_0x59ab0f){if(_0x59ab0f){_0x1748f0=_0x59ab0f;_0x554e3a[_0xd351('0x25')]=_['keys'](db[_0xd351('0x42')][_0xd351('0x22')]);_0x554e3a[_0xd351('0x28')]=_[_0xd351('0x29')](_0x7e4bad[_0xd351('0x28')]);_0x554e3a[_0xd351('0x2a')]=_[_0xd351('0x2b')](_0x554e3a['model'],_0x554e3a['query']);_0x5a2e9b[_0xd351('0x2c')]=_[_0xd351('0x2b')](_0x554e3a['model'],qs[_0xd351('0x2d')](_0x7e4bad[_0xd351('0x28')][_0xd351('0x2d')]));_0x5a2e9b['attributes']=_0x5a2e9b[_0xd351('0x2c')]['length']?_0x5a2e9b['attributes']:_0x554e3a[_0xd351('0x25')];_0x5a2e9b[_0xd351('0x43')]=qs['sort'](_0x7e4bad[_0xd351('0x28')][_0xd351('0x44')]);_0x5a2e9b[_0xd351('0x32')]=qs[_0xd351('0x2a')](_[_0xd351('0x33')](_0x7e4bad[_0xd351('0x28')],_0x554e3a['filters']));if(_0x7e4bad[_0xd351('0x28')][_0xd351('0x34')]){_0x5a2e9b[_0xd351('0x32')]=_[_0xd351('0x35')](_0x5a2e9b[_0xd351('0x32')],{'$or':_[_0xd351('0x26')](_0x5a2e9b[_0xd351('0x2c')],function(_0x4b2029){var _0x24dcdb={};_0x24dcdb[_0x4b2029]={'$like':'%'+_0x7e4bad['query'][_0xd351('0x34')]+'%'};return _0x24dcdb;})});}_0x5a2e9b=_[_0xd351('0x35')]({},_0x5a2e9b,_0x7e4bad[_0xd351('0x36')]);return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x4eaf18){if(_0x4eaf18){_0x42f248=_0x4eaf18[_0xd351('0x2e')];if(!_0x7e4bad['query'][_0xd351('0x2f')](_0xd351('0x30'))){_0x5a2e9b[_0xd351('0x31')]=qs[_0xd351('0x31')](_0x7e4bad[_0xd351('0x28')]['limit']);_0x5a2e9b['offset']=qs[_0xd351('0x19')](_0x7e4bad[_0xd351('0x28')]['offset']);}return _0x1748f0[_0xd351('0x45')](_0x5a2e9b);}})[_0xd351('0x1d')](function(_0x2718e9){if(_0x2718e9){return _0x2718e9?{'count':_0x42f248,'rows':_0x2718e9}:null;}})['then'](respondWithResult(_0x292af3,null))[_0xd351('0x3a')](handleError(_0x292af3,null));};exports[_0xd351('0x46')]=function(_0x284d12,_0x5dbdef,_0x5d13ec){if(_0x284d12['body']['id']){delete _0x284d12[_0xd351('0x3f')]['id'];}return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x284d12[_0xd351('0x3b')]['id']}})[_0xd351('0x1d')](handleEntityNotFound(_0x5dbdef,null))[_0xd351('0x1d')](function(_0x2c83fe){if(_0x2c83fe){_0x284d12['body'][_0xd351('0x47')]=_0x2c83fe['id'];_0x284d12['body']['Subjects']=integrations[_0xd351('0x48')](_0x284d12[_0xd351('0x3f')]['channel'],_0x284d12[_0xd351('0x3f')]['type']);_0x284d12['body']['Descriptions']=integrations[_0xd351('0x49')](_0x284d12[_0xd351('0x3f')][_0xd351('0x4a')],_0x284d12['body'][_0xd351('0x24')]);return db[_0xd351('0x42')][_0xd351('0x3e')](_0x284d12[_0xd351('0x3f')],{'include':[{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4c')},{'model':db[_0xd351('0x4b')],'as':_0xd351('0x4d')}]});}return null;})[_0xd351('0x1d')](respondWithResult(_0x5dbdef,null))[_0xd351('0x3a')](handleError(_0x5dbdef,null));};exports[_0xd351('0x4e')]=function(_0x4d20af,_0x2fcede,_0x2d59a5){var _0x431e91='';return db[_0xd351('0x37')][_0xd351('0x41')]({'where':{'id':_0x4d20af[_0xd351('0x3b')]['id']},'attributes':['id','username',_0xd351('0x4f'),_0xd351('0x50'),'authType','remoteUri']})[_0xd351('0x1d')](handleEntityNotFound(_0x2fcede,null))[_0xd351('0x1d')](function(_0x44dc58){if(_0x44dc58){_0x431e91=_0x44dc58[_0xd351('0x51')];var _0x1db455=_0x431e91[_0xd351('0x52')](-0x1);if(_0x1db455==='/'){_0x431e91=_0x431e91[_0xd351('0x53')](0x0,_0x431e91[_0xd351('0x54')](_0x1db455));}var _0x3ce2b9={'method':'GET','uri':util[_0xd351('0x55')](_0xd351('0x56'),_0x431e91,'ticket_fields'),'json':!![]};switch(_0x44dc58[_0xd351('0x57')]){case'password':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util['format'](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5a'),_0x44dc58[_0xd351('0x5b')],_0x44dc58[_0xd351('0x4f')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;case'token':_0x3ce2b9[_0xd351('0x58')]={'Authorization':util[_0xd351('0x55')](_0xd351('0x59'),new Buffer(util[_0xd351('0x55')](_0xd351('0x5e'),_0x44dc58['username'],_0x44dc58[_0xd351('0x50')]))[_0xd351('0x5c')](_0xd351('0x5d')))};break;default:throw new db['Sequelize'][(_0xd351('0x5f'))](_0xd351('0x60'));}return rp(_0x3ce2b9);}})[_0xd351('0x1d')](function(_0x3f0d27){if(_0x3f0d27){var _0x3635ad=[_0xd351('0x61'),_0xd351('0x62'),_0xd351('0x63'),_0xd351('0x64')];_['remove'](_0x3f0d27[_0xd351('0x65')],function(_0x190a00){return _0x3635ad['includes'](_0x190a00[_0xd351('0x24')]);});return{'count':_0x3f0d27['ticket_fields']['length'],'rows':_['map'](_0x3f0d27[_0xd351('0x65')],function(_0x3367f8){return{'id':_0x3367f8['id'],'name':_0x3367f8[_0xd351('0x66')]>0x7?_0x3367f8['title']:_0x3367f8[_0xd351('0x24')],'custom':_0x3367f8['position']>0x7?!![]:![],'options':_0x3367f8[_0xd351('0x67')]?_0x3367f8['system_field_options']:_0x3367f8[_0xd351('0x68')]?_0x3367f8[_0xd351('0x68')]:[]};})};}})[_0xd351('0x1d')](respondWithResult(_0x2fcede,null))[_0xd351('0x3a')](function(_0x35b148){var _0x1bb955=_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?0x1f4:_0x35b148[_0xd351('0x6a')]||0x1f4;logger[_0xd351('0x6b')](_0xd351('0x6c'),_0xd351('0x4e'),_0x1bb955,JSON['stringify'](_0x35b148));delete _0x35b148[_0xd351('0x27')];if(_0x1bb955===0x191){_0x1bb955=0x190;}_0x2fcede[_0xd351('0x14')](_0x1bb955)[_0xd351('0x6d')](_0x4d20af[_0xd351('0x28')][_0xd351('0x69')]?{'message':'Wrong\x20credentials','statusCode':_0x35b148[_0xd351('0x6a')]}:_0x35b148);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 1fe4ea9..fa0d501 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 _0xcd97=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x488b4d,_0x233540){var _0x51ee8f=function(_0x166556){while(--_0x166556){_0x488b4d['push'](_0x488b4d['shift']());}};_0x51ee8f(++_0x233540);}(_0xcd97,0x86));var _0x7cd9=function(_0x533ffd,_0x547e7b){_0x533ffd=_0x533ffd-0x0;var _0x1069f5=_0xcd97[_0x533ffd];return _0x1069f5;};'use strict';var _=require(_0x7cd9('0x0'));var util=require(_0x7cd9('0x1'));var logger=require(_0x7cd9('0x2'))(_0x7cd9('0x3'));var moment=require(_0x7cd9('0x4'));var BPromise=require('bluebird');var rp=require(_0x7cd9('0x5'));var fs=require('fs');var path=require(_0x7cd9('0x6'));var rimraf=require(_0x7cd9('0x7'));var config=require(_0x7cd9('0x8'));var attributes=require(_0x7cd9('0x9'));var integrations=require(_0x7cd9('0xa'));module[_0x7cd9('0xb')]=function(_0x546e8d,_0x5e554d){return _0x546e8d[_0x7cd9('0xc')](_0x7cd9('0xd'),attributes,{'tableName':_0x7cd9('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd08f=['moment','bluebird','path','rimraf','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','int_zendesk_accounts','lodash','util','../../config/logger','api'];(function(_0x3baaf2,_0x894e3d){var _0x50e8b0=function(_0x35dd6f){while(--_0x35dd6f){_0x3baaf2['push'](_0x3baaf2['shift']());}};_0x50e8b0(++_0x894e3d);}(_0xd08f,0x1b6));var _0xfd08=function(_0x324012,_0x23f45f){_0x324012=_0x324012-0x0;var _0x435cf2=_0xd08f[_0x324012];return _0x435cf2;};'use strict';var _=require(_0xfd08('0x0'));var util=require(_0xfd08('0x1'));var logger=require(_0xfd08('0x2'))(_0xfd08('0x3'));var moment=require(_0xfd08('0x4'));var BPromise=require(_0xfd08('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd08('0x6'));var rimraf=require(_0xfd08('0x7'));var config=require('../../config/environment');var attributes=require(_0xfd08('0x8'));var integrations=require(_0xfd08('0x9'));module[_0xfd08('0xa')]=function(_0x5bf851,_0x15a1b4){return _0x5bf851[_0xfd08('0xb')]('ZendeskAccount',attributes,{'tableName':_0xfd08('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 a490ecd..e8876a7 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 _0x8d0a=['request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','attributes','limit','include','model','map','ShowZendeskAccount','find','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s'];(function(_0x241d9b,_0x45d294){var _0x4e5a52=function(_0x35b39d){while(--_0x35b39d){_0x241d9b['push'](_0x241d9b['shift']());}};_0x4e5a52(++_0x45d294);}(_0x8d0a,0x172));var _0xa8d0=function(_0x36ae62,_0x2d10ce){_0x36ae62=_0x36ae62-0x0;var _0x4d70b3=_0x8d0a[_0x36ae62];return _0x4d70b3;};'use strict';var _=require(_0xa8d0('0x0'));var util=require(_0xa8d0('0x1'));var moment=require(_0xa8d0('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8d0('0x3'));var fs=require('fs');var Redis=require(_0xa8d0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa8d0('0x5'));var logger=require(_0xa8d0('0x6'))(_0xa8d0('0x7'));var config=require('../../config/environment');var jayson=require(_0xa8d0('0x8'));var client=jayson[_0xa8d0('0x9')][_0xa8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x40c0b3,_0xeef6d9,_0x1032ed){return new BPromise(function(_0x14b0a0,_0x3d6cce){return client[_0xa8d0('0xb')](_0x40c0b3,_0x1032ed)[_0xa8d0('0xc')](function(_0x4550cf){logger[_0xa8d0('0xd')](_0xa8d0('0xe'),_0xeef6d9,_0xa8d0('0xf'));logger[_0xa8d0('0x10')](_0xa8d0('0x11'),_0xeef6d9,_0xa8d0('0xf'),JSON[_0xa8d0('0x12')](_0x4550cf));if(_0x4550cf[_0xa8d0('0x13')]){if(_0x4550cf[_0xa8d0('0x13')]['code']===0x1f4){logger['error'](_0xa8d0('0xe'),_0xeef6d9,_0x4550cf[_0xa8d0('0x13')]['message']);return _0x3d6cce(_0x4550cf['error'][_0xa8d0('0x14')]);}logger[_0xa8d0('0x13')](_0xa8d0('0xe'),_0xeef6d9,_0x4550cf[_0xa8d0('0x13')][_0xa8d0('0x14')]);return _0x14b0a0(_0x4550cf[_0xa8d0('0x13')][_0xa8d0('0x14')]);}else{logger[_0xa8d0('0xd')](_0xa8d0('0xe'),_0xeef6d9,_0xa8d0('0xf'));_0x14b0a0(_0x4550cf[_0xa8d0('0x15')]['message']);}})[_0xa8d0('0x16')](function(_0x3a3528){logger['error'](_0xa8d0('0xe'),_0xeef6d9,_0x3a3528);_0x3d6cce(_0x3a3528);});});}exports[_0xa8d0('0x17')]=function(_0x2899fb){var _0x434ad5=this;return new Promise(function(_0x34ce5d,_0x48e8c5){return db[_0xa8d0('0x18')][_0xa8d0('0x19')]({'raw':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')]['where']||null:null,'attributes':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1c')]||null:null,'limit':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb['options'][_0xa8d0('0x1d')]||null:null,'include':_0x2899fb[_0xa8d0('0x1a')]?_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1e')]?_['map'](_0x2899fb[_0xa8d0('0x1a')][_0xa8d0('0x1e')],function(_0x20ae2c){return{'model':db[_0x20ae2c[_0xa8d0('0x1f')]],'as':_0x20ae2c['as'],'attributes':_0x20ae2c['attributes'],'include':_0x20ae2c[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x20ae2c[_0xa8d0('0x1e')],function(_0x507d18){return{'model':db[_0x507d18[_0xa8d0('0x1f')]],'as':_0x507d18['as'],'attributes':_0x507d18['attributes'],'include':_0x507d18[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x507d18['include'],function(_0x5d7292){return{'model':db[_0x5d7292[_0xa8d0('0x1f')]],'as':_0x5d7292['as'],'attributes':_0x5d7292['attributes']};}):[]};}):[]};}):[]:[]})[_0xa8d0('0xc')](function(_0x327673){logger[_0xa8d0('0xd')](_0xa8d0('0x17'),_0x2899fb);logger[_0xa8d0('0x10')]('GetZendeskAccount',_0x2899fb,JSON[_0xa8d0('0x12')](_0x327673));_0x34ce5d(_0x327673);})[_0xa8d0('0x16')](function(_0x13de71){logger['error']('GetZendeskAccount',_0x13de71['message'],_0x2899fb);_0x48e8c5(_0x434ad5[_0xa8d0('0x13')](0x1f4,_0x13de71[_0xa8d0('0x14')]));});});};exports[_0xa8d0('0x21')]=function(_0x1ae23f){var _0x2c9ff2=this;return new Promise(function(_0x3bc7b5,_0x3f6fb9){return db['ZendeskAccount'][_0xa8d0('0x22')]({'raw':_0x1ae23f['options']?_0x1ae23f[_0xa8d0('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1ae23f['options']?_0x1ae23f['options']['where']||null:null,'attributes':_0x1ae23f[_0xa8d0('0x1a')]?_0x1ae23f[_0xa8d0('0x1a')]['attributes']||null:null,'include':_0x1ae23f['options']?_0x1ae23f[_0xa8d0('0x1a')][_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x1ae23f[_0xa8d0('0x1a')][_0xa8d0('0x1e')],function(_0x4d7f6d){return{'model':db[_0x4d7f6d['model']],'as':_0x4d7f6d['as'],'attributes':_0x4d7f6d[_0xa8d0('0x1c')],'include':_0x4d7f6d[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x4d7f6d[_0xa8d0('0x1e')],function(_0x40ccb6){return{'model':db[_0x40ccb6[_0xa8d0('0x1f')]],'as':_0x40ccb6['as'],'attributes':_0x40ccb6['attributes'],'include':_0x40ccb6[_0xa8d0('0x1e')]?_[_0xa8d0('0x20')](_0x40ccb6[_0xa8d0('0x1e')],function(_0x48a087){return{'model':db[_0x48a087[_0xa8d0('0x1f')]],'as':_0x48a087['as'],'attributes':_0x48a087[_0xa8d0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa8d0('0xc')](function(_0x424a1d){logger[_0xa8d0('0xd')](_0xa8d0('0x21'),_0x1ae23f);logger[_0xa8d0('0x10')](_0xa8d0('0x21'),_0x1ae23f,JSON[_0xa8d0('0x12')](_0x424a1d));_0x3bc7b5(_0x424a1d);})[_0xa8d0('0x16')](function(_0x3563a9){logger['error'](_0xa8d0('0x21'),_0x3563a9['message'],_0x1ae23f);_0x3f6fb9(_0x2c9ff2[_0xa8d0('0x13')](0x1f4,_0x3563a9[_0xa8d0('0x14')]));});});}; \ No newline at end of file +var _0x5520=['map','model','debug','GetZendeskAccount','find','raw','ShowZendeskAccount','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','ZendeskAccount','findAll','options','where','attributes','limit','include'];(function(_0xabb00f,_0x4ef9bb){var _0x587cbb=function(_0x1471e3){while(--_0x1471e3){_0xabb00f['push'](_0xabb00f['shift']());}};_0x587cbb(++_0x4ef9bb);}(_0x5520,0x165));var _0x0552=function(_0x3d35e5,_0x44b351){_0x3d35e5=_0x3d35e5-0x0;var _0xf9e901=_0x5520[_0x3d35e5];return _0xf9e901;};'use strict';var _=require(_0x0552('0x0'));var util=require(_0x0552('0x1'));var moment=require('moment');var BPromise=require(_0x0552('0x2'));var rs=require(_0x0552('0x3'));var fs=require('fs');var Redis=require(_0x0552('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0552('0x5'));var logger=require(_0x0552('0x6'))(_0x0552('0x7'));var config=require('../../config/environment');var jayson=require(_0x0552('0x8'));var client=jayson[_0x0552('0x9')][_0x0552('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x370f0e,_0x28584a,_0x48381f){return new BPromise(function(_0x49ebfd,_0x2e1eb1){return client[_0x0552('0xb')](_0x370f0e,_0x48381f)[_0x0552('0xc')](function(_0x530f0d){logger[_0x0552('0xd')](_0x0552('0xe'),_0x28584a,_0x0552('0xf'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x28584a,'request\x20sent',JSON[_0x0552('0x10')](_0x530f0d));if(_0x530f0d[_0x0552('0x11')]){if(_0x530f0d[_0x0552('0x11')][_0x0552('0x12')]===0x1f4){logger[_0x0552('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x28584a,_0x530f0d[_0x0552('0x11')][_0x0552('0x13')]);return _0x2e1eb1(_0x530f0d[_0x0552('0x11')]['message']);}logger[_0x0552('0x11')](_0x0552('0xe'),_0x28584a,_0x530f0d[_0x0552('0x11')][_0x0552('0x13')]);return _0x49ebfd(_0x530f0d[_0x0552('0x11')][_0x0552('0x13')]);}else{logger['info'](_0x0552('0xe'),_0x28584a,'request\x20sent');_0x49ebfd(_0x530f0d['result'][_0x0552('0x13')]);}})[_0x0552('0x14')](function(_0x1ceb36){logger[_0x0552('0x11')](_0x0552('0xe'),_0x28584a,_0x1ceb36);_0x2e1eb1(_0x1ceb36);});});}exports['GetZendeskAccount']=function(_0x26df09){var _0x389bb7=this;return new Promise(function(_0x18003e,_0x57b719){return db[_0x0552('0x15')][_0x0552('0x16')]({'raw':_0x26df09['options']?_0x26df09[_0x0552('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x26df09['options']?_0x26df09[_0x0552('0x17')][_0x0552('0x18')]||null:null,'attributes':_0x26df09['options']?_0x26df09[_0x0552('0x17')][_0x0552('0x19')]||null:null,'limit':_0x26df09[_0x0552('0x17')]?_0x26df09[_0x0552('0x17')][_0x0552('0x1a')]||null:null,'include':_0x26df09[_0x0552('0x17')]?_0x26df09[_0x0552('0x17')][_0x0552('0x1b')]?_[_0x0552('0x1c')](_0x26df09[_0x0552('0x17')][_0x0552('0x1b')],function(_0x2a5fd2){return{'model':db[_0x2a5fd2[_0x0552('0x1d')]],'as':_0x2a5fd2['as'],'attributes':_0x2a5fd2[_0x0552('0x19')],'include':_0x2a5fd2[_0x0552('0x1b')]?_[_0x0552('0x1c')](_0x2a5fd2[_0x0552('0x1b')],function(_0x4dde4d){return{'model':db[_0x4dde4d[_0x0552('0x1d')]],'as':_0x4dde4d['as'],'attributes':_0x4dde4d[_0x0552('0x19')],'include':_0x4dde4d[_0x0552('0x1b')]?_['map'](_0x4dde4d[_0x0552('0x1b')],function(_0x6728b4){return{'model':db[_0x6728b4[_0x0552('0x1d')]],'as':_0x6728b4['as'],'attributes':_0x6728b4['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e6a6b){logger[_0x0552('0xd')]('GetZendeskAccount',_0x26df09);logger[_0x0552('0x1e')](_0x0552('0x1f'),_0x26df09,JSON[_0x0552('0x10')](_0x5e6a6b));_0x18003e(_0x5e6a6b);})[_0x0552('0x14')](function(_0x560747){logger[_0x0552('0x11')](_0x0552('0x1f'),_0x560747[_0x0552('0x13')],_0x26df09);_0x57b719(_0x389bb7['error'](0x1f4,_0x560747[_0x0552('0x13')]));});});};exports['ShowZendeskAccount']=function(_0x1edb24){var _0x51e45f=this;return new Promise(function(_0x146ffb,_0x4c797a){return db['ZendeskAccount'][_0x0552('0x20')]({'raw':_0x1edb24[_0x0552('0x17')]?_0x1edb24['options'][_0x0552('0x21')]===undefined?!![]:![]:!![],'where':_0x1edb24['options']?_0x1edb24[_0x0552('0x17')]['where']||null:null,'attributes':_0x1edb24[_0x0552('0x17')]?_0x1edb24[_0x0552('0x17')][_0x0552('0x19')]||null:null,'include':_0x1edb24['options']?_0x1edb24[_0x0552('0x17')][_0x0552('0x1b')]?_[_0x0552('0x1c')](_0x1edb24[_0x0552('0x17')]['include'],function(_0x250b4e){return{'model':db[_0x250b4e[_0x0552('0x1d')]],'as':_0x250b4e['as'],'attributes':_0x250b4e['attributes'],'include':_0x250b4e['include']?_[_0x0552('0x1c')](_0x250b4e[_0x0552('0x1b')],function(_0x4c84a5){return{'model':db[_0x4c84a5[_0x0552('0x1d')]],'as':_0x4c84a5['as'],'attributes':_0x4c84a5[_0x0552('0x19')],'include':_0x4c84a5[_0x0552('0x1b')]?_['map'](_0x4c84a5[_0x0552('0x1b')],function(_0x18bdee){return{'model':db[_0x18bdee['model']],'as':_0x18bdee['as'],'attributes':_0x18bdee[_0x0552('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0552('0xc')](function(_0x1f7187){logger[_0x0552('0xd')](_0x0552('0x22'),_0x1edb24);logger['debug'](_0x0552('0x22'),_0x1edb24,JSON['stringify'](_0x1f7187));_0x146ffb(_0x1f7187);})[_0x0552('0x14')](function(_0x59c807){logger[_0x0552('0x11')](_0x0552('0x22'),_0x59c807[_0x0552('0x13')],_0x1edb24);_0x4c797a(_0x51e45f[_0x0552('0x11')](0x1f4,_0x59c807[_0x0552('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index c8b4076..5ccce56 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 _0x0bb5=['put','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x1068ff,_0x3dd4f0){var _0x2040ac=function(_0x4bb635){while(--_0x4bb635){_0x1068ff['push'](_0x1068ff['shift']());}};_0x2040ac(++_0x3dd4f0);}(_0x0bb5,0x148));var _0x50bb=function(_0x51cf8b,_0x447bff){_0x51cf8b=_0x51cf8b-0x0;var _0x5c2756=_0x0bb5[_0x51cf8b];return _0x5c2756;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id/fields',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0x9')](_0x50bb('0xe'),auth['isAuthenticated'](),controller[_0x50bb('0xf')]);router[_0x50bb('0x9')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x9')](_0x50bb('0x12'),auth['isAuthenticated'](),controller[_0x50bb('0x13')]);router['post']('/',auth[_0x50bb('0xb')](),controller[_0x50bb('0x14')]);router[_0x50bb('0x15')]('/:id/tags',auth[_0x50bb('0xb')](),controller[_0x50bb('0x16')]);router[_0x50bb('0x17')]('/:id',auth[_0x50bb('0xb')](),controller['update']);router[_0x50bb('0x18')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x19')]);module[_0x50bb('0x1a')]=router; \ No newline at end of file +var _0x4024=['util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id/fields','getDescriptions','/:id/tags','getTags','create','post','setTags','put','/:id','update','delete','destroy','exports','multer'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x4024,0x89));var _0x4402=function(_0x177370,_0x57637b){_0x177370=_0x177370-0x0;var _0x13caed=_0x4024[_0x177370];return _0x13caed;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./intZendeskConfiguration.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['get'](_0x4402('0xa'),auth['isAuthenticated'](),controller['getFields']);router[_0x4402('0x9')]('/:id/subjects',auth[_0x4402('0x7')](),controller['getSubjects']);router[_0x4402('0x9')]('/:id/descriptions',auth[_0x4402('0x7')](),controller[_0x4402('0xb')]);router['get'](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0xd')]);router['post']('/',auth[_0x4402('0x7')](),controller[_0x4402('0xe')]);router[_0x4402('0xf')](_0x4402('0xc'),auth[_0x4402('0x7')](),controller[_0x4402('0x10')]);router[_0x4402('0x11')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x13')]);router[_0x4402('0x14')](_0x4402('0x12'),auth[_0x4402('0x7')](),controller[_0x4402('0x15')]);module[_0x4402('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index b3acfae..8ea4150 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 _0x14c2=['STRING','exports'];(function(_0x43798a,_0x914329){var _0x42aae3=function(_0x27d88f){while(--_0x27d88f){_0x43798a['push'](_0x43798a['shift']());}};_0x42aae3(++_0x914329);}(_0x14c2,0xaf));var _0x214c=function(_0x29aa33,_0x1e69f4){_0x29aa33=_0x29aa33-0x0;var _0x522564=_0x14c2[_0x29aa33];return _0x522564;};'use strict';var Sequelize=require('sequelize');module[_0x214c('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x214c('0x1')]}}; \ No newline at end of file +var _0x4efe=['exports','STRING','sequelize'];(function(_0x3df1f2,_0xdef69a){var _0x5d06e0=function(_0x170c48){while(--_0x170c48){_0x3df1f2['push'](_0x3df1f2['shift']());}};_0x5d06e0(++_0xdef69a);}(_0x4efe,0x1a0));var _0xe4ef=function(_0x802997,_0x5534a2){_0x802997=_0x802997-0x0;var _0x35c641=_0x4efe[_0x802997];return _0x35c641;};'use strict';var Sequelize=require(_0xe4ef('0x0'));module[_0xe4ef('0x1')]={'name':{'type':Sequelize[_0xe4ef('0x2')]},'description':{'type':Sequelize[_0xe4ef('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 6c5a7c2..03a4cda 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 _0xbff5=['../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','error','name','send','index','ZendeskConfiguration','rawAttributes','fieldName','type','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','getFields','findOne','ZendeskField','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbff5,0x1ec));var _0x5bff=function(_0x4a205f,_0x524b57){_0x4a205f=_0x4a205f-0x0;var _0x1348f2=_0xbff5[_0x4a205f];return _0x1348f2;};'use strict';var emlformat=require(_0x5bff('0x0'));var rimraf=require(_0x5bff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5bff('0x2'));var rp=require(_0x5bff('0x3'));var moment=require(_0x5bff('0x4'));var BPromise=require(_0x5bff('0x5'));var Mustache=require(_0x5bff('0x6'));var util=require(_0x5bff('0x7'));var path=require(_0x5bff('0x8'));var sox=require('sox');var csv=require(_0x5bff('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bff('0xa'));var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x9'));var querystring=require(_0x5bff('0x10'));var Papa=require(_0x5bff('0x11'));var Redis=require('ioredis');var authService=require(_0x5bff('0x12'));var qs=require(_0x5bff('0x13'));var as=require(_0x5bff('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5bff('0x15'));var utils=require('../../config/utils');var config=require(_0x5bff('0x16'));var licenseUtil=require(_0x5bff('0x17'));var db=require(_0x5bff('0x18'))['db'];function respondWithStatusCode(_0x5ef67d,_0x40447d){_0x40447d=_0x40447d||0xcc;return function(_0x105cf8){if(_0x105cf8){return _0x5ef67d[_0x5bff('0x19')](_0x40447d);}return _0x5ef67d[_0x5bff('0x1a')](_0x40447d)[_0x5bff('0x1b')]();};}function respondWithResult(_0x2a8901,_0x56bc0a){_0x56bc0a=_0x56bc0a||0xc8;return function(_0xe90802){if(_0xe90802){return _0x2a8901['status'](_0x56bc0a)[_0x5bff('0x1c')](_0xe90802);}};}function respondWithFilteredResult(_0x3e6103,_0x57c601){return function(_0x499f7b){if(_0x499f7b){var _0x3b0f6d=typeof _0x57c601[_0x5bff('0x1d')]===_0x5bff('0x1e')&&typeof _0x57c601['limit']==='undefined';var _0xb0199a=_0x499f7b[_0x5bff('0x1f')];var _0x38c4ce=_0x3b0f6d?0x0:_0x57c601['offset'];var _0x449308=_0x3b0f6d?_0x499f7b[_0x5bff('0x1f')]:_0x57c601[_0x5bff('0x1d')]+_0x57c601['limit'];var _0x282016;if(_0x449308>=_0xb0199a){_0x449308=_0xb0199a;_0x282016=0xc8;}else{_0x282016=0xce;}_0x3e6103[_0x5bff('0x1a')](_0x282016);return _0x3e6103[_0x5bff('0x20')]('Content-Range',_0x38c4ce+'-'+_0x449308+'/'+_0xb0199a)[_0x5bff('0x1c')](_0x499f7b);}return null;};}function patchUpdates(_0x4e9017){return function(_0x4e4657){try{jsonpatch[_0x5bff('0x21')](_0x4e4657,_0x4e9017,!![]);}catch(_0x199601){return BPromise[_0x5bff('0x22')](_0x199601);}return _0x4e4657[_0x5bff('0x23')]();};}function saveUpdates(_0x4b5087,_0xedbbd){return function(_0x574d17){if(_0x574d17){return _0x574d17[_0x5bff('0x24')](_0x4b5087)[_0x5bff('0x25')](function(_0x17833d){return _0x17833d;});}return null;};}function removeEntity(_0x4d707e,_0x50f410){return function(_0x3a9cb4){if(_0x3a9cb4){return _0x3a9cb4[_0x5bff('0x26')]()[_0x5bff('0x25')](function(){_0x4d707e[_0x5bff('0x1a')](0xcc)[_0x5bff('0x1b')]();});}};}function handleEntityNotFound(_0x3ae722,_0x753867){return function(_0x227b10){if(!_0x227b10){_0x3ae722[_0x5bff('0x19')](0x194);}return _0x227b10;};}function handleError(_0x24bf97,_0x410f94){_0x410f94=_0x410f94||0x1f4;return function(_0x259a60){logger[_0x5bff('0x27')](_0x259a60['stack']);if(_0x259a60['name']){delete _0x259a60[_0x5bff('0x28')];}_0x24bf97[_0x5bff('0x1a')](_0x410f94)[_0x5bff('0x29')](_0x259a60);};}exports[_0x5bff('0x2a')]=function(_0x465e29,_0x129cf7){var _0x1b0d7a={},_0x21a00c={},_0x4cad3f={'count':0x0,'rows':[]};var _0x206128=_['map'](db[_0x5bff('0x2b')][_0x5bff('0x2c')],function(_0x8bebfb){return{'name':_0x8bebfb[_0x5bff('0x2d')],'type':_0x8bebfb[_0x5bff('0x2e')]['key']};});_0x21a00c[_0x5bff('0x2f')]=_[_0x5bff('0x30')](_0x206128,_0x5bff('0x28'));_0x21a00c[_0x5bff('0x31')]=_['keys'](_0x465e29[_0x5bff('0x31')]);_0x21a00c[_0x5bff('0x32')]=_['intersection'](_0x21a00c[_0x5bff('0x2f')],_0x21a00c[_0x5bff('0x31')]);_0x1b0d7a[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x21a00c[_0x5bff('0x2f')],qs[_0x5bff('0x35')](_0x465e29[_0x5bff('0x31')][_0x5bff('0x35')]));_0x1b0d7a[_0x5bff('0x33')]=_0x1b0d7a[_0x5bff('0x33')][_0x5bff('0x36')]?_0x1b0d7a['attributes']:_0x21a00c[_0x5bff('0x2f')];if(!_0x465e29[_0x5bff('0x31')][_0x5bff('0x37')](_0x5bff('0x38'))){_0x1b0d7a[_0x5bff('0x39')]=qs['limit'](_0x465e29[_0x5bff('0x31')][_0x5bff('0x39')]);_0x1b0d7a[_0x5bff('0x1d')]=qs[_0x5bff('0x1d')](_0x465e29['query'][_0x5bff('0x1d')]);}_0x1b0d7a[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x465e29[_0x5bff('0x31')][_0x5bff('0x3b')]);_0x1b0d7a[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_['pick'](_0x465e29[_0x5bff('0x31')],_0x21a00c[_0x5bff('0x32')]),_0x206128);if(_0x465e29['query'][_0x5bff('0x3d')]){_0x1b0d7a[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x1b0d7a[_0x5bff('0x3c')],{'$or':_['map'](_0x206128,function(_0x1a23b1){if(_0x1a23b1['type']!==_0x5bff('0x3f')){var _0x3a01d0={};_0x3a01d0[_0x1a23b1[_0x5bff('0x28')]]={'$like':'%'+_0x465e29['query'][_0x5bff('0x3d')]+'%'};return _0x3a01d0;}})});}_0x1b0d7a=_[_0x5bff('0x3e')]({},_0x1b0d7a,_0x465e29[_0x5bff('0x40')]);var _0x21a420={'where':_0x1b0d7a[_0x5bff('0x3c')]};return db[_0x5bff('0x2b')]['count'](_0x21a420)[_0x5bff('0x25')](function(_0xff8960){_0x4cad3f[_0x5bff('0x1f')]=_0xff8960;if(_0x465e29[_0x5bff('0x31')][_0x5bff('0x41')]){_0x1b0d7a['include']=[{'all':!![]}];}return db[_0x5bff('0x2b')][_0x5bff('0x42')](_0x1b0d7a);})[_0x5bff('0x25')](function(_0x3543c0){_0x4cad3f[_0x5bff('0x43')]=_0x3543c0;return _0x4cad3f;})[_0x5bff('0x25')](respondWithFilteredResult(_0x129cf7,_0x1b0d7a))[_0x5bff('0x44')](handleError(_0x129cf7,null));};exports[_0x5bff('0x45')]=function(_0x1c52d5,_0x4f71e8){var _0x4a1ef4={'raw':![],'where':{'id':_0x1c52d5['params']['id']}},_0xa78029={};_0xa78029[_0x5bff('0x2f')]=_[_0x5bff('0x46')](db[_0x5bff('0x2b')][_0x5bff('0x2c')]);_0xa78029[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x1c52d5[_0x5bff('0x31')]);_0xa78029['filters']=_['intersection'](_0xa78029[_0x5bff('0x2f')],_0xa78029[_0x5bff('0x31')]);_0x4a1ef4[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0xa78029[_0x5bff('0x2f')],qs['fields'](_0x1c52d5['query'][_0x5bff('0x35')]));_0x4a1ef4['attributes']=_0x4a1ef4[_0x5bff('0x33')][_0x5bff('0x36')]?_0x4a1ef4[_0x5bff('0x33')]:_0xa78029['model'];if(_0x1c52d5['query'][_0x5bff('0x41')]){_0x4a1ef4[_0x5bff('0x47')]=[{'all':!![]}];}_0x4a1ef4=_[_0x5bff('0x3e')]({},_0x4a1ef4,_0x1c52d5['options']);return db[_0x5bff('0x2b')][_0x5bff('0x48')](_0x4a1ef4)['then'](handleEntityNotFound(_0x4f71e8,null))['then'](respondWithResult(_0x4f71e8,null))[_0x5bff('0x44')](handleError(_0x4f71e8,null));};exports[_0x5bff('0x49')]=function(_0x378210,_0x5a0d39){return db[_0x5bff('0x2b')][_0x5bff('0x49')](_0x378210[_0x5bff('0x4a')],{})[_0x5bff('0x25')](respondWithResult(_0x5a0d39,0xc9))[_0x5bff('0x44')](handleError(_0x5a0d39,null));};exports['update']=function(_0x5cdc49,_0x178781){if(_0x5cdc49[_0x5bff('0x4a')]['id']){delete _0x5cdc49[_0x5bff('0x4a')]['id'];}return db['ZendeskConfiguration'][_0x5bff('0x48')]({'where':{'id':_0x5cdc49[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x178781,null))[_0x5bff('0x25')](saveUpdates(_0x5cdc49[_0x5bff('0x4a')],null))[_0x5bff('0x25')](respondWithResult(_0x178781,null))[_0x5bff('0x44')](handleError(_0x178781,null));};exports['destroy']=function(_0x2d2cc2,_0x4cec54){return db[_0x5bff('0x2b')][_0x5bff('0x48')]({'where':{'id':_0x2d2cc2['params']['id']}})['then'](handleEntityNotFound(_0x4cec54,null))[_0x5bff('0x25')](removeEntity(_0x4cec54,null))['catch'](handleError(_0x4cec54,null));};exports[_0x5bff('0x4c')]=function(_0x5cac86,_0x59507e,_0x5f37d6){var _0x7e60dd={};var _0x1e6cac={};var _0x104f45;var _0x330ec4;return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x5cac86[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x59507e,null))[_0x5bff('0x25')](function(_0x4694e5){if(_0x4694e5){_0x104f45=_0x4694e5;_0x1e6cac[_0x5bff('0x2f')]=_['keys'](db[_0x5bff('0x4e')]['rawAttributes']);_0x1e6cac[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x5cac86[_0x5bff('0x31')]);_0x1e6cac['filters']=_[_0x5bff('0x34')](_0x1e6cac[_0x5bff('0x2f')],_0x1e6cac[_0x5bff('0x31')]);_0x7e60dd[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x1e6cac[_0x5bff('0x2f')],qs[_0x5bff('0x35')](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x35')]));_0x7e60dd['attributes']=_0x7e60dd['attributes'][_0x5bff('0x36')]?_0x7e60dd[_0x5bff('0x33')]:_0x1e6cac[_0x5bff('0x2f')];_0x7e60dd[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x3b')]);_0x7e60dd[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_[_0x5bff('0x4f')](_0x5cac86[_0x5bff('0x31')],_0x1e6cac[_0x5bff('0x32')]));if(_0x5cac86[_0x5bff('0x31')][_0x5bff('0x3d')]){_0x7e60dd[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x7e60dd[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x7e60dd['attributes'],function(_0x3512c3){var _0xd77598={};_0xd77598[_0x3512c3]={'$like':'%'+_0x5cac86[_0x5bff('0x31')][_0x5bff('0x3d')]+'%'};return _0xd77598;})});}_0x7e60dd=_['merge']({},_0x7e60dd,_0x5cac86[_0x5bff('0x40')]);return _0x104f45[_0x5bff('0x4c')](_0x7e60dd);}})['then'](function(_0x3e4ef5){if(_0x3e4ef5){_0x330ec4=_0x3e4ef5[_0x5bff('0x36')];if(!_0x5cac86[_0x5bff('0x31')][_0x5bff('0x37')](_0x5bff('0x38'))){_0x7e60dd[_0x5bff('0x39')]=qs['limit'](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x39')]);_0x7e60dd[_0x5bff('0x1d')]=qs[_0x5bff('0x1d')](_0x5cac86[_0x5bff('0x31')][_0x5bff('0x1d')]);}return _0x104f45[_0x5bff('0x4c')](_0x7e60dd);}})[_0x5bff('0x25')](function(_0x955885){if(_0x955885){return _0x955885?{'count':_0x330ec4,'rows':_0x955885}:null;}})[_0x5bff('0x25')](respondWithResult(_0x59507e,null))[_0x5bff('0x44')](handleError(_0x59507e,null));};exports['getSubjects']=function(_0x2de2cf,_0xe5cbc9,_0x5ce1c4){var _0x34feac={};var _0x5a5157={};var _0x4d48f4;var _0x390a3b;return db[_0x5bff('0x2b')]['findOne']({'where':{'id':_0x2de2cf['params']['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0xe5cbc9,null))[_0x5bff('0x25')](function(_0x5b7df5){if(_0x5b7df5){_0x4d48f4=_0x5b7df5;_0x5a5157[_0x5bff('0x2f')]=_[_0x5bff('0x46')](db['ZendeskField'][_0x5bff('0x2c')]);_0x5a5157['query']=_[_0x5bff('0x46')](_0x2de2cf[_0x5bff('0x31')]);_0x5a5157[_0x5bff('0x32')]=_[_0x5bff('0x34')](_0x5a5157[_0x5bff('0x2f')],_0x5a5157[_0x5bff('0x31')]);_0x34feac[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x5a5157[_0x5bff('0x2f')],qs['fields'](_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x35')]));_0x34feac['attributes']=_0x34feac[_0x5bff('0x33')]['length']?_0x34feac[_0x5bff('0x33')]:_0x5a5157[_0x5bff('0x2f')];_0x34feac[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x2de2cf[_0x5bff('0x31')]['sort']);_0x34feac[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_[_0x5bff('0x4f')](_0x2de2cf[_0x5bff('0x31')],_0x5a5157['filters']));if(_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x3d')]){_0x34feac[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x34feac[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x34feac['attributes'],function(_0x40689f){var _0x200217={};_0x200217[_0x40689f]={'$like':'%'+_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x3d')]+'%'};return _0x200217;})});}_0x34feac=_[_0x5bff('0x3e')]({},_0x34feac,_0x2de2cf[_0x5bff('0x40')]);return _0x4d48f4[_0x5bff('0x50')](_0x34feac);}})['then'](function(_0x23011e){if(_0x23011e){_0x390a3b=_0x23011e['length'];if(!_0x2de2cf['query']['hasOwnProperty'](_0x5bff('0x38'))){_0x34feac['limit']=qs[_0x5bff('0x39')](_0x2de2cf['query'][_0x5bff('0x39')]);_0x34feac[_0x5bff('0x1d')]=qs['offset'](_0x2de2cf[_0x5bff('0x31')][_0x5bff('0x1d')]);}return _0x4d48f4[_0x5bff('0x50')](_0x34feac);}})['then'](function(_0x40f399){if(_0x40f399){return _0x40f399?{'count':_0x390a3b,'rows':_0x40f399}:null;}})[_0x5bff('0x25')](respondWithResult(_0xe5cbc9,null))[_0x5bff('0x44')](handleError(_0xe5cbc9,null));};exports[_0x5bff('0x51')]=function(_0x400196,_0x245246,_0x59643f){var _0x4798ef={};var _0x16e427={};var _0x103f0c;var _0x42f21b;return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x400196['params']['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x245246,null))[_0x5bff('0x25')](function(_0x23efbb){if(_0x23efbb){_0x103f0c=_0x23efbb;_0x16e427['model']=_[_0x5bff('0x46')](db[_0x5bff('0x4e')][_0x5bff('0x2c')]);_0x16e427[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x400196[_0x5bff('0x31')]);_0x16e427[_0x5bff('0x32')]=_['intersection'](_0x16e427[_0x5bff('0x2f')],_0x16e427[_0x5bff('0x31')]);_0x4798ef['attributes']=_[_0x5bff('0x34')](_0x16e427['model'],qs[_0x5bff('0x35')](_0x400196[_0x5bff('0x31')][_0x5bff('0x35')]));_0x4798ef['attributes']=_0x4798ef[_0x5bff('0x33')][_0x5bff('0x36')]?_0x4798ef['attributes']:_0x16e427[_0x5bff('0x2f')];_0x4798ef[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x400196[_0x5bff('0x31')][_0x5bff('0x3b')]);_0x4798ef[_0x5bff('0x3c')]=qs[_0x5bff('0x32')](_['pick'](_0x400196[_0x5bff('0x31')],_0x16e427[_0x5bff('0x32')]));if(_0x400196['query']['filter']){_0x4798ef['where']=_[_0x5bff('0x3e')](_0x4798ef[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x4798ef['attributes'],function(_0xcab5c){var _0x41aa82={};_0x41aa82[_0xcab5c]={'$like':'%'+_0x400196[_0x5bff('0x31')]['filter']+'%'};return _0x41aa82;})});}_0x4798ef=_[_0x5bff('0x3e')]({},_0x4798ef,_0x400196['options']);return _0x103f0c[_0x5bff('0x51')](_0x4798ef);}})[_0x5bff('0x25')](function(_0x22838d){if(_0x22838d){_0x42f21b=_0x22838d[_0x5bff('0x36')];if(!_0x400196[_0x5bff('0x31')][_0x5bff('0x37')](_0x5bff('0x38'))){_0x4798ef[_0x5bff('0x39')]=qs['limit'](_0x400196[_0x5bff('0x31')][_0x5bff('0x39')]);_0x4798ef[_0x5bff('0x1d')]=qs['offset'](_0x400196[_0x5bff('0x31')][_0x5bff('0x1d')]);}return _0x103f0c['getDescriptions'](_0x4798ef);}})[_0x5bff('0x25')](function(_0x19570a){if(_0x19570a){return _0x19570a?{'count':_0x42f21b,'rows':_0x19570a}:null;}})['then'](respondWithResult(_0x245246,null))['catch'](handleError(_0x245246,null));};exports[_0x5bff('0x52')]=function(_0x56690b,_0x401d89,_0x21590b){var _0x1f4037={};var _0x4d8354={};var _0x38a29b;var _0x3b85b3;return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x56690b[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x401d89,null))[_0x5bff('0x25')](function(_0x3fed2d){if(_0x3fed2d){_0x38a29b=_0x3fed2d;_0x4d8354[_0x5bff('0x2f')]=_[_0x5bff('0x46')](db[_0x5bff('0x53')][_0x5bff('0x2c')]);_0x4d8354[_0x5bff('0x31')]=_[_0x5bff('0x46')](_0x56690b[_0x5bff('0x31')]);_0x4d8354[_0x5bff('0x32')]=_['intersection'](_0x4d8354['model'],_0x4d8354['query']);_0x1f4037[_0x5bff('0x33')]=_[_0x5bff('0x34')](_0x4d8354[_0x5bff('0x2f')],qs[_0x5bff('0x35')](_0x56690b[_0x5bff('0x31')]['fields']));_0x1f4037[_0x5bff('0x33')]=_0x1f4037[_0x5bff('0x33')]['length']?_0x1f4037['attributes']:_0x4d8354[_0x5bff('0x2f')];_0x1f4037[_0x5bff('0x3a')]=qs[_0x5bff('0x3b')](_0x56690b['query']['sort']);_0x1f4037[_0x5bff('0x3c')]=qs['filters'](_[_0x5bff('0x4f')](_0x56690b[_0x5bff('0x31')],_0x4d8354['filters']));if(_0x56690b[_0x5bff('0x31')]['filter']){_0x1f4037[_0x5bff('0x3c')]=_[_0x5bff('0x3e')](_0x1f4037[_0x5bff('0x3c')],{'$or':_[_0x5bff('0x30')](_0x1f4037[_0x5bff('0x33')],function(_0x2c0a95){var _0x317552={};_0x317552[_0x2c0a95]={'$like':'%'+_0x56690b['query'][_0x5bff('0x3d')]+'%'};return _0x317552;})});}_0x1f4037=_[_0x5bff('0x3e')]({},_0x1f4037,_0x56690b['options']);return _0x38a29b['getTags'](_0x1f4037);}})[_0x5bff('0x25')](function(_0x2db620){if(_0x2db620){_0x3b85b3=_0x2db620[_0x5bff('0x36')];if(!_0x56690b[_0x5bff('0x31')][_0x5bff('0x37')]('nolimit')){_0x1f4037[_0x5bff('0x39')]=qs[_0x5bff('0x39')](_0x56690b['query'][_0x5bff('0x39')]);_0x1f4037[_0x5bff('0x1d')]=qs['offset'](_0x56690b['query']['offset']);}return _0x38a29b[_0x5bff('0x52')](_0x1f4037);}})[_0x5bff('0x25')](function(_0x5eaf1a){if(_0x5eaf1a){return _0x5eaf1a?{'count':_0x3b85b3,'rows':_0x5eaf1a}:null;}})[_0x5bff('0x25')](respondWithResult(_0x401d89,null))['catch'](handleError(_0x401d89,null));};exports[_0x5bff('0x54')]=function(_0x25f939,_0x34a5c5,_0x1b6c6f){if(_0x25f939[_0x5bff('0x4a')]['id']){delete _0x25f939['body']['id'];}return db[_0x5bff('0x2b')][_0x5bff('0x4d')]({'where':{'id':_0x25f939[_0x5bff('0x4b')]['id']}})[_0x5bff('0x25')](handleEntityNotFound(_0x34a5c5,null))[_0x5bff('0x25')](function(_0x35c863){if(_0x35c863){return _0x35c863[_0x5bff('0x54')](_0x25f939[_0x5bff('0x4a')][_0x5bff('0x55')]||[]);}return null;})['then'](respondWithResult(_0x34a5c5,null))[_0x5bff('0x44')](handleError(_0x34a5c5,null));}; \ No newline at end of file +var _0xad94=['attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','filter','includeAll','include','ZendeskConfiguration','findAll','catch','show','params','length','options','find','create','update','body','destroy','getFields','findOne','order','getSubjects','ZendeskField','getDescriptions','Tag','getTags','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','limit','count','set','Content-Range','json','save','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters'];(function(_0x4898b2,_0x3cbd90){var _0x2a89d9=function(_0x56a69f){while(--_0x56a69f){_0x4898b2['push'](_0x4898b2['shift']());}};_0x2a89d9(++_0x3cbd90);}(_0xad94,0x1ad));var _0x4ad9=function(_0x45fee0,_0x2d0ca4){_0x45fee0=_0x45fee0-0x0;var _0x166bb3=_0xad94[_0x45fee0];return _0x166bb3;};'use strict';var emlformat=require(_0x4ad9('0x0'));var rimraf=require(_0x4ad9('0x1'));var zipdir=require(_0x4ad9('0x2'));var jsonpatch=require(_0x4ad9('0x3'));var rp=require(_0x4ad9('0x4'));var moment=require(_0x4ad9('0x5'));var BPromise=require(_0x4ad9('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ad9('0x7'));var sox=require(_0x4ad9('0x8'));var csv=require(_0x4ad9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4ad9('0xa'));var _=require(_0x4ad9('0xb'));var squel=require(_0x4ad9('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4ad9('0xd'));var Papa=require(_0x4ad9('0xe'));var Redis=require(_0x4ad9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4ad9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4ad9('0x11'))('api');var utils=require(_0x4ad9('0x12'));var config=require(_0x4ad9('0x13'));var licenseUtil=require(_0x4ad9('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14487c,_0x3ad6a6){_0x3ad6a6=_0x3ad6a6||0xcc;return function(_0x52ea5e){if(_0x52ea5e){return _0x14487c['sendStatus'](_0x3ad6a6);}return _0x14487c[_0x4ad9('0x15')](_0x3ad6a6)[_0x4ad9('0x16')]();};}function respondWithResult(_0x1b3379,_0xf66af6){_0xf66af6=_0xf66af6||0xc8;return function(_0xc19586){if(_0xc19586){return _0x1b3379['status'](_0xf66af6)['json'](_0xc19586);}};}function respondWithFilteredResult(_0xba3f1e,_0x26412e){return function(_0x198129){if(_0x198129){var _0x24813a=typeof _0x26412e[_0x4ad9('0x17')]==='undefined'&&typeof _0x26412e[_0x4ad9('0x18')]==='undefined';var _0xb5d846=_0x198129[_0x4ad9('0x19')];var _0x5532a3=_0x24813a?0x0:_0x26412e['offset'];var _0x3d7666=_0x24813a?_0x198129[_0x4ad9('0x19')]:_0x26412e[_0x4ad9('0x17')]+_0x26412e[_0x4ad9('0x18')];var _0x57bb5e;if(_0x3d7666>=_0xb5d846){_0x3d7666=_0xb5d846;_0x57bb5e=0xc8;}else{_0x57bb5e=0xce;}_0xba3f1e[_0x4ad9('0x15')](_0x57bb5e);return _0xba3f1e[_0x4ad9('0x1a')](_0x4ad9('0x1b'),_0x5532a3+'-'+_0x3d7666+'/'+_0xb5d846)[_0x4ad9('0x1c')](_0x198129);}return null;};}function patchUpdates(_0x58d1e6){return function(_0x229fce){try{jsonpatch['apply'](_0x229fce,_0x58d1e6,!![]);}catch(_0x5e3afa){return BPromise['reject'](_0x5e3afa);}return _0x229fce[_0x4ad9('0x1d')]();};}function saveUpdates(_0xdd1bc8,_0x261a7d){return function(_0x1cad67){if(_0x1cad67){return _0x1cad67['update'](_0xdd1bc8)[_0x4ad9('0x1e')](function(_0x17b639){return _0x17b639;});}return null;};}function removeEntity(_0x360a42,_0x562de3){return function(_0x42bf0e){if(_0x42bf0e){return _0x42bf0e['destroy']()[_0x4ad9('0x1e')](function(){_0x360a42[_0x4ad9('0x15')](0xcc)[_0x4ad9('0x16')]();});}};}function handleEntityNotFound(_0x55f500,_0x2235b6){return function(_0x7f0b10){if(!_0x7f0b10){_0x55f500['sendStatus'](0x194);}return _0x7f0b10;};}function handleError(_0x560789,_0x1eb78c){_0x1eb78c=_0x1eb78c||0x1f4;return function(_0x4ef83f){logger[_0x4ad9('0x1f')](_0x4ef83f[_0x4ad9('0x20')]);if(_0x4ef83f['name']){delete _0x4ef83f[_0x4ad9('0x21')];}_0x560789['status'](_0x1eb78c)[_0x4ad9('0x22')](_0x4ef83f);};}exports[_0x4ad9('0x23')]=function(_0x14dc48,_0x11e836){var _0x48351f={},_0xcacf02={},_0x591996={'count':0x0,'rows':[]};var _0x4aa660=_['map'](db['ZendeskConfiguration'][_0x4ad9('0x24')],function(_0x2e507d){return{'name':_0x2e507d[_0x4ad9('0x25')],'type':_0x2e507d[_0x4ad9('0x26')][_0x4ad9('0x27')]};});_0xcacf02[_0x4ad9('0x28')]=_[_0x4ad9('0x29')](_0x4aa660,_0x4ad9('0x21'));_0xcacf02[_0x4ad9('0x2a')]=_[_0x4ad9('0x2b')](_0x14dc48[_0x4ad9('0x2a')]);_0xcacf02[_0x4ad9('0x2c')]=_['intersection'](_0xcacf02[_0x4ad9('0x28')],_0xcacf02[_0x4ad9('0x2a')]);_0x48351f[_0x4ad9('0x2d')]=_[_0x4ad9('0x2e')](_0xcacf02['model'],qs['fields'](_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x48351f['attributes']=_0x48351f[_0x4ad9('0x2d')]['length']?_0x48351f[_0x4ad9('0x2d')]:_0xcacf02[_0x4ad9('0x28')];if(!_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x30')](_0x4ad9('0x31'))){_0x48351f['limit']=qs['limit'](_0x14dc48[_0x4ad9('0x2a')]['limit']);_0x48351f['offset']=qs[_0x4ad9('0x17')](_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x17')]);}_0x48351f['order']=qs['sort'](_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x48351f[_0x4ad9('0x33')]=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x14dc48[_0x4ad9('0x2a')],_0xcacf02[_0x4ad9('0x2c')]),_0x4aa660);if(_0x14dc48[_0x4ad9('0x2a')]['filter']){_0x48351f[_0x4ad9('0x33')]=_[_0x4ad9('0x35')](_0x48351f[_0x4ad9('0x33')],{'$or':_[_0x4ad9('0x29')](_0x4aa660,function(_0x499aef){if(_0x499aef[_0x4ad9('0x26')]!=='VIRTUAL'){var _0x15122e={};_0x15122e[_0x499aef['name']]={'$like':'%'+_0x14dc48[_0x4ad9('0x2a')][_0x4ad9('0x36')]+'%'};return _0x15122e;}})});}_0x48351f=_['merge']({},_0x48351f,_0x14dc48['options']);var _0xf52df7={'where':_0x48351f['where']};return db['ZendeskConfiguration'][_0x4ad9('0x19')](_0xf52df7)[_0x4ad9('0x1e')](function(_0x55e9e1){_0x591996[_0x4ad9('0x19')]=_0x55e9e1;if(_0x14dc48['query'][_0x4ad9('0x37')]){_0x48351f[_0x4ad9('0x38')]=[{'all':!![]}];}return db[_0x4ad9('0x39')][_0x4ad9('0x3a')](_0x48351f);})[_0x4ad9('0x1e')](function(_0xde59a9){_0x591996['rows']=_0xde59a9;return _0x591996;})['then'](respondWithFilteredResult(_0x11e836,_0x48351f))[_0x4ad9('0x3b')](handleError(_0x11e836,null));};exports[_0x4ad9('0x3c')]=function(_0x5e0244,_0x2a2908){var _0x45e344={'raw':![],'where':{'id':_0x5e0244[_0x4ad9('0x3d')]['id']}},_0x1becab={};_0x1becab[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x39')][_0x4ad9('0x24')]);_0x1becab[_0x4ad9('0x2a')]=_[_0x4ad9('0x2b')](_0x5e0244['query']);_0x1becab[_0x4ad9('0x2c')]=_[_0x4ad9('0x2e')](_0x1becab[_0x4ad9('0x28')],_0x1becab['query']);_0x45e344[_0x4ad9('0x2d')]=_[_0x4ad9('0x2e')](_0x1becab[_0x4ad9('0x28')],qs[_0x4ad9('0x2f')](_0x5e0244['query'][_0x4ad9('0x2f')]));_0x45e344[_0x4ad9('0x2d')]=_0x45e344[_0x4ad9('0x2d')][_0x4ad9('0x3e')]?_0x45e344[_0x4ad9('0x2d')]:_0x1becab[_0x4ad9('0x28')];if(_0x5e0244[_0x4ad9('0x2a')][_0x4ad9('0x37')]){_0x45e344['include']=[{'all':!![]}];}_0x45e344=_[_0x4ad9('0x35')]({},_0x45e344,_0x5e0244[_0x4ad9('0x3f')]);return db[_0x4ad9('0x39')][_0x4ad9('0x40')](_0x45e344)[_0x4ad9('0x1e')](handleEntityNotFound(_0x2a2908,null))[_0x4ad9('0x1e')](respondWithResult(_0x2a2908,null))[_0x4ad9('0x3b')](handleError(_0x2a2908,null));};exports[_0x4ad9('0x41')]=function(_0x134129,_0xcc9f61){return db['ZendeskConfiguration'][_0x4ad9('0x41')](_0x134129['body'],{})[_0x4ad9('0x1e')](respondWithResult(_0xcc9f61,0xc9))[_0x4ad9('0x3b')](handleError(_0xcc9f61,null));};exports[_0x4ad9('0x42')]=function(_0x2a83ad,_0x5378c2){if(_0x2a83ad[_0x4ad9('0x43')]['id']){delete _0x2a83ad[_0x4ad9('0x43')]['id'];}return db[_0x4ad9('0x39')][_0x4ad9('0x40')]({'where':{'id':_0x2a83ad[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x5378c2,null))[_0x4ad9('0x1e')](saveUpdates(_0x2a83ad[_0x4ad9('0x43')],null))[_0x4ad9('0x1e')](respondWithResult(_0x5378c2,null))[_0x4ad9('0x3b')](handleError(_0x5378c2,null));};exports[_0x4ad9('0x44')]=function(_0x57a52a,_0x157f53){return db[_0x4ad9('0x39')]['find']({'where':{'id':_0x57a52a[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x157f53,null))[_0x4ad9('0x1e')](removeEntity(_0x157f53,null))[_0x4ad9('0x3b')](handleError(_0x157f53,null));};exports[_0x4ad9('0x45')]=function(_0x3fe2fa,_0x288b67,_0x376929){var _0x18a22b={};var _0x5cc7fe={};var _0x44a6c1;var _0x56344b;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x3fe2fa[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x288b67,null))[_0x4ad9('0x1e')](function(_0x3739a2){if(_0x3739a2){_0x44a6c1=_0x3739a2;_0x5cc7fe[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db['ZendeskField'][_0x4ad9('0x24')]);_0x5cc7fe['query']=_[_0x4ad9('0x2b')](_0x3fe2fa[_0x4ad9('0x2a')]);_0x5cc7fe[_0x4ad9('0x2c')]=_[_0x4ad9('0x2e')](_0x5cc7fe[_0x4ad9('0x28')],_0x5cc7fe['query']);_0x18a22b['attributes']=_[_0x4ad9('0x2e')](_0x5cc7fe[_0x4ad9('0x28')],qs['fields'](_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x18a22b[_0x4ad9('0x2d')]=_0x18a22b[_0x4ad9('0x2d')]['length']?_0x18a22b[_0x4ad9('0x2d')]:_0x5cc7fe[_0x4ad9('0x28')];_0x18a22b[_0x4ad9('0x47')]=qs['sort'](_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x18a22b[_0x4ad9('0x33')]=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x3fe2fa[_0x4ad9('0x2a')],_0x5cc7fe['filters']));if(_0x3fe2fa[_0x4ad9('0x2a')]['filter']){_0x18a22b[_0x4ad9('0x33')]=_['merge'](_0x18a22b['where'],{'$or':_['map'](_0x18a22b[_0x4ad9('0x2d')],function(_0x44ad0b){var _0x2d452d={};_0x2d452d[_0x44ad0b]={'$like':'%'+_0x3fe2fa[_0x4ad9('0x2a')]['filter']+'%'};return _0x2d452d;})});}_0x18a22b=_['merge']({},_0x18a22b,_0x3fe2fa['options']);return _0x44a6c1[_0x4ad9('0x45')](_0x18a22b);}})[_0x4ad9('0x1e')](function(_0x196966){if(_0x196966){_0x56344b=_0x196966[_0x4ad9('0x3e')];if(!_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x30')](_0x4ad9('0x31'))){_0x18a22b[_0x4ad9('0x18')]=qs[_0x4ad9('0x18')](_0x3fe2fa[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x18a22b[_0x4ad9('0x17')]=qs[_0x4ad9('0x17')](_0x3fe2fa['query'][_0x4ad9('0x17')]);}return _0x44a6c1[_0x4ad9('0x45')](_0x18a22b);}})[_0x4ad9('0x1e')](function(_0x4ed8cb){if(_0x4ed8cb){return _0x4ed8cb?{'count':_0x56344b,'rows':_0x4ed8cb}:null;}})[_0x4ad9('0x1e')](respondWithResult(_0x288b67,null))['catch'](handleError(_0x288b67,null));};exports[_0x4ad9('0x48')]=function(_0x10cfa0,_0x2e6f14,_0x443f56){var _0x5c935d={};var _0x41af4b={};var _0xa17ab4;var _0x258636;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x10cfa0[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x2e6f14,null))[_0x4ad9('0x1e')](function(_0x494414){if(_0x494414){_0xa17ab4=_0x494414;_0x41af4b[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x49')]['rawAttributes']);_0x41af4b['query']=_[_0x4ad9('0x2b')](_0x10cfa0[_0x4ad9('0x2a')]);_0x41af4b[_0x4ad9('0x2c')]=_[_0x4ad9('0x2e')](_0x41af4b['model'],_0x41af4b[_0x4ad9('0x2a')]);_0x5c935d[_0x4ad9('0x2d')]=_['intersection'](_0x41af4b[_0x4ad9('0x28')],qs[_0x4ad9('0x2f')](_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x5c935d['attributes']=_0x5c935d['attributes'][_0x4ad9('0x3e')]?_0x5c935d[_0x4ad9('0x2d')]:_0x41af4b[_0x4ad9('0x28')];_0x5c935d['order']=qs[_0x4ad9('0x32')](_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x5c935d[_0x4ad9('0x33')]=qs['filters'](_[_0x4ad9('0x34')](_0x10cfa0[_0x4ad9('0x2a')],_0x41af4b['filters']));if(_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x36')]){_0x5c935d[_0x4ad9('0x33')]=_['merge'](_0x5c935d[_0x4ad9('0x33')],{'$or':_[_0x4ad9('0x29')](_0x5c935d['attributes'],function(_0x803309){var _0x24762a={};_0x24762a[_0x803309]={'$like':'%'+_0x10cfa0['query'][_0x4ad9('0x36')]+'%'};return _0x24762a;})});}_0x5c935d=_['merge']({},_0x5c935d,_0x10cfa0[_0x4ad9('0x3f')]);return _0xa17ab4[_0x4ad9('0x48')](_0x5c935d);}})[_0x4ad9('0x1e')](function(_0xa1c71c){if(_0xa1c71c){_0x258636=_0xa1c71c[_0x4ad9('0x3e')];if(!_0x10cfa0['query'][_0x4ad9('0x30')]('nolimit')){_0x5c935d[_0x4ad9('0x18')]=qs['limit'](_0x10cfa0[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x5c935d[_0x4ad9('0x17')]=qs['offset'](_0x10cfa0['query'][_0x4ad9('0x17')]);}return _0xa17ab4[_0x4ad9('0x48')](_0x5c935d);}})['then'](function(_0x3668e9){if(_0x3668e9){return _0x3668e9?{'count':_0x258636,'rows':_0x3668e9}:null;}})[_0x4ad9('0x1e')](respondWithResult(_0x2e6f14,null))[_0x4ad9('0x3b')](handleError(_0x2e6f14,null));};exports['getDescriptions']=function(_0x36f583,_0x2d005a,_0x21ec0e){var _0x42629f={};var _0x4330d7={};var _0x1c4a06;var _0x5502af;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x36f583[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x2d005a,null))[_0x4ad9('0x1e')](function(_0x1d6182){if(_0x1d6182){_0x1c4a06=_0x1d6182;_0x4330d7[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x49')][_0x4ad9('0x24')]);_0x4330d7[_0x4ad9('0x2a')]=_['keys'](_0x36f583[_0x4ad9('0x2a')]);_0x4330d7[_0x4ad9('0x2c')]=_['intersection'](_0x4330d7[_0x4ad9('0x28')],_0x4330d7['query']);_0x42629f[_0x4ad9('0x2d')]=_['intersection'](_0x4330d7[_0x4ad9('0x28')],qs['fields'](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x42629f[_0x4ad9('0x2d')]=_0x42629f[_0x4ad9('0x2d')][_0x4ad9('0x3e')]?_0x42629f[_0x4ad9('0x2d')]:_0x4330d7[_0x4ad9('0x28')];_0x42629f[_0x4ad9('0x47')]=qs[_0x4ad9('0x32')](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x32')]);_0x42629f[_0x4ad9('0x33')]=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x36f583[_0x4ad9('0x2a')],_0x4330d7[_0x4ad9('0x2c')]));if(_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x36')]){_0x42629f['where']=_['merge'](_0x42629f[_0x4ad9('0x33')],{'$or':_[_0x4ad9('0x29')](_0x42629f[_0x4ad9('0x2d')],function(_0xb102e7){var _0x22f4fc={};_0x22f4fc[_0xb102e7]={'$like':'%'+_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x36')]+'%'};return _0x22f4fc;})});}_0x42629f=_[_0x4ad9('0x35')]({},_0x42629f,_0x36f583[_0x4ad9('0x3f')]);return _0x1c4a06[_0x4ad9('0x4a')](_0x42629f);}})[_0x4ad9('0x1e')](function(_0x13d35d){if(_0x13d35d){_0x5502af=_0x13d35d[_0x4ad9('0x3e')];if(!_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x30')]('nolimit')){_0x42629f[_0x4ad9('0x18')]=qs[_0x4ad9('0x18')](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x42629f[_0x4ad9('0x17')]=qs[_0x4ad9('0x17')](_0x36f583[_0x4ad9('0x2a')][_0x4ad9('0x17')]);}return _0x1c4a06[_0x4ad9('0x4a')](_0x42629f);}})['then'](function(_0x33c6c6){if(_0x33c6c6){return _0x33c6c6?{'count':_0x5502af,'rows':_0x33c6c6}:null;}})['then'](respondWithResult(_0x2d005a,null))[_0x4ad9('0x3b')](handleError(_0x2d005a,null));};exports['getTags']=function(_0x155718,_0x9d760d,_0xae54d6){var _0x522bb1={};var _0x59640d={};var _0x1bcd6f;var _0x7ef880;return db[_0x4ad9('0x39')][_0x4ad9('0x46')]({'where':{'id':_0x155718[_0x4ad9('0x3d')]['id']}})['then'](handleEntityNotFound(_0x9d760d,null))[_0x4ad9('0x1e')](function(_0x3693b6){if(_0x3693b6){_0x1bcd6f=_0x3693b6;_0x59640d[_0x4ad9('0x28')]=_[_0x4ad9('0x2b')](db[_0x4ad9('0x4b')]['rawAttributes']);_0x59640d[_0x4ad9('0x2a')]=_[_0x4ad9('0x2b')](_0x155718[_0x4ad9('0x2a')]);_0x59640d[_0x4ad9('0x2c')]=_['intersection'](_0x59640d['model'],_0x59640d[_0x4ad9('0x2a')]);_0x522bb1[_0x4ad9('0x2d')]=_['intersection'](_0x59640d[_0x4ad9('0x28')],qs['fields'](_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x2f')]));_0x522bb1[_0x4ad9('0x2d')]=_0x522bb1[_0x4ad9('0x2d')][_0x4ad9('0x3e')]?_0x522bb1[_0x4ad9('0x2d')]:_0x59640d[_0x4ad9('0x28')];_0x522bb1['order']=qs['sort'](_0x155718[_0x4ad9('0x2a')]['sort']);_0x522bb1['where']=qs[_0x4ad9('0x2c')](_[_0x4ad9('0x34')](_0x155718[_0x4ad9('0x2a')],_0x59640d[_0x4ad9('0x2c')]));if(_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x36')]){_0x522bb1[_0x4ad9('0x33')]=_[_0x4ad9('0x35')](_0x522bb1[_0x4ad9('0x33')],{'$or':_['map'](_0x522bb1[_0x4ad9('0x2d')],function(_0x43c5c2){var _0x30b807={};_0x30b807[_0x43c5c2]={'$like':'%'+_0x155718[_0x4ad9('0x2a')]['filter']+'%'};return _0x30b807;})});}_0x522bb1=_['merge']({},_0x522bb1,_0x155718[_0x4ad9('0x3f')]);return _0x1bcd6f[_0x4ad9('0x4c')](_0x522bb1);}})[_0x4ad9('0x1e')](function(_0xb423c4){if(_0xb423c4){_0x7ef880=_0xb423c4['length'];if(!_0x155718['query'][_0x4ad9('0x30')](_0x4ad9('0x31'))){_0x522bb1[_0x4ad9('0x18')]=qs[_0x4ad9('0x18')](_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x18')]);_0x522bb1['offset']=qs[_0x4ad9('0x17')](_0x155718[_0x4ad9('0x2a')][_0x4ad9('0x17')]);}return _0x1bcd6f[_0x4ad9('0x4c')](_0x522bb1);}})['then'](function(_0x1143e8){if(_0x1143e8){return _0x1143e8?{'count':_0x7ef880,'rows':_0x1143e8}:null;}})[_0x4ad9('0x1e')](respondWithResult(_0x9d760d,null))[_0x4ad9('0x3b')](handleError(_0x9d760d,null));};exports['setTags']=function(_0x1e6fe7,_0x2459bc,_0x204f8c){if(_0x1e6fe7[_0x4ad9('0x43')]['id']){delete _0x1e6fe7[_0x4ad9('0x43')]['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1e6fe7[_0x4ad9('0x3d')]['id']}})[_0x4ad9('0x1e')](handleEntityNotFound(_0x2459bc,null))['then'](function(_0x3f3a6a){if(_0x3f3a6a){return _0x3f3a6a[_0x4ad9('0x4d')](_0x1e6fe7[_0x4ad9('0x43')][_0x4ad9('0x4e')]||[]);}return null;})[_0x4ad9('0x1e')](respondWithResult(_0x2459bc,null))[_0x4ad9('0x3b')](handleError(_0x2459bc,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 2dbdf6a..a6630f2 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 _0xb44a=['../../config/logger','moment','path','../../config/environment','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','int_zendesk_configurations'];(function(_0x58728c,_0x10bf0b){var _0x60fe60=function(_0x1e94ce){while(--_0x1e94ce){_0x58728c['push'](_0x58728c['shift']());}};_0x60fe60(++_0x10bf0b);}(_0xb44a,0x1c2));var _0xab44=function(_0x1f047e,_0x23b312){_0x1f047e=_0x1f047e-0x0;var _0x206db5=_0xb44a[_0x1f047e];return _0x206db5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xab44('0x0'))('api');var moment=require(_0xab44('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xab44('0x2'));var rimraf=require('rimraf');var config=require(_0xab44('0x3'));var attributes=require(_0xab44('0x4'));module[_0xab44('0x5')]=function(_0x28681a,_0x2f3948){return _0x28681a[_0xab44('0x6')](_0xab44('0x7'),attributes,{'tableName':_0xab44('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e2e=['exports','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskConfiguration.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4e2e,0x1f2));var _0xe4e2=function(_0xaabaa6,_0x4993c8){_0xaabaa6=_0xaabaa6-0x0;var _0x3a8e90=_0x4e2e[_0xaabaa6];return _0x3a8e90;};'use strict';var _=require('lodash');var util=require(_0xe4e2('0x0'));var logger=require(_0xe4e2('0x1'))(_0xe4e2('0x2'));var moment=require(_0xe4e2('0x3'));var BPromise=require(_0xe4e2('0x4'));var rp=require(_0xe4e2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe4e2('0x6'));var config=require(_0xe4e2('0x7'));var attributes=require(_0xe4e2('0x8'));module[_0xe4e2('0x9')]=function(_0x48e83d,_0x322295){return _0x48e83d[_0xe4e2('0xa')](_0xe4e2('0xb'),attributes,{'tableName':_0xe4e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.rpc.js index 96d1fa1..5894af3 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 _0x5c91=['../../config/environment','client','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','rpc'];(function(_0x5a0889,_0xa382e1){var _0xaada03=function(_0x110bd3){while(--_0x110bd3){_0x5a0889['push'](_0x5a0889['shift']());}};_0xaada03(++_0xa382e1);}(_0x5c91,0x1f4));var _0x15c9=function(_0x4b4dd5,_0x2a3ba9){_0x4b4dd5=_0x4b4dd5-0x0;var _0x22f23a=_0x5c91[_0x4b4dd5];return _0x22f23a;};'use strict';var _=require('lodash');var util=require(_0x15c9('0x0'));var moment=require(_0x15c9('0x1'));var BPromise=require(_0x15c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x15c9('0x3'));var db=require(_0x15c9('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x15c9('0x5'));var config=require(_0x15c9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x15c9('0x7')][_0x15c9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fc53e,_0x3ab365,_0x1773ae){return new BPromise(function(_0x2aebef,_0x183a74){return client[_0x15c9('0x9')](_0x2fc53e,_0x1773ae)[_0x15c9('0xa')](function(_0x10f91c){logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x3ab365,'request\x20sent');logger[_0x15c9('0xd')](_0x15c9('0xe'),_0x3ab365,_0x15c9('0xf'),JSON[_0x15c9('0x10')](_0x10f91c));if(_0x10f91c[_0x15c9('0x11')]){if(_0x10f91c['error'][_0x15c9('0x12')]===0x1f4){logger['error'](_0x15c9('0xc'),_0x3ab365,_0x10f91c[_0x15c9('0x11')]['message']);return _0x183a74(_0x10f91c[_0x15c9('0x11')][_0x15c9('0x13')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x3ab365,_0x10f91c['error']['message']);return _0x2aebef(_0x10f91c[_0x15c9('0x11')][_0x15c9('0x13')]);}else{logger[_0x15c9('0xb')](_0x15c9('0xc'),_0x3ab365,_0x15c9('0xf'));_0x2aebef(_0x10f91c[_0x15c9('0x14')]['message']);}})[_0x15c9('0x15')](function(_0x3179d2){logger[_0x15c9('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3ab365,_0x3179d2);_0x183a74(_0x3179d2);});});} \ No newline at end of file +var _0x8260=['then','info','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x56e7b8,_0x37cd52){var _0x564c8e=function(_0x30a352){while(--_0x30a352){_0x56e7b8['push'](_0x56e7b8['shift']());}};_0x564c8e(++_0x37cd52);}(_0x8260,0x129));var _0x0826=function(_0x319855,_0x55a20d){_0x319855=_0x319855-0x0;var _0xfb7f50=_0x8260[_0x319855];return _0xfb7f50;};'use strict';var _=require(_0x0826('0x0'));var util=require(_0x0826('0x1'));var moment=require(_0x0826('0x2'));var BPromise=require(_0x0826('0x3'));var rs=require(_0x0826('0x4'));var fs=require('fs');var Redis=require(_0x0826('0x5'));var db=require(_0x0826('0x6'))['db'];var utils=require(_0x0826('0x7'));var logger=require(_0x0826('0x8'))(_0x0826('0x9'));var config=require(_0x0826('0xa'));var jayson=require(_0x0826('0xb'));var client=jayson[_0x0826('0xc')][_0x0826('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x55c6a4,_0x40b30c,_0x151f2e){return new BPromise(function(_0x3690bb,_0x1b4036){return client[_0x0826('0xe')](_0x55c6a4,_0x151f2e)[_0x0826('0xf')](function(_0x5c0d70){logger[_0x0826('0x10')](_0x0826('0x11'),_0x40b30c,'request\x20sent');logger[_0x0826('0x12')](_0x0826('0x13'),_0x40b30c,_0x0826('0x14'),JSON[_0x0826('0x15')](_0x5c0d70));if(_0x5c0d70['error']){if(_0x5c0d70[_0x0826('0x16')][_0x0826('0x17')]===0x1f4){logger[_0x0826('0x16')](_0x0826('0x11'),_0x40b30c,_0x5c0d70[_0x0826('0x16')]['message']);return _0x1b4036(_0x5c0d70['error'][_0x0826('0x18')]);}logger['error'](_0x0826('0x11'),_0x40b30c,_0x5c0d70[_0x0826('0x16')][_0x0826('0x18')]);return _0x3690bb(_0x5c0d70[_0x0826('0x16')]['message']);}else{logger['info'](_0x0826('0x11'),_0x40b30c,_0x0826('0x14'));_0x3690bb(_0x5c0d70['result']['message']);}})[_0x0826('0x19')](function(_0x2c458f){logger['error'](_0x0826('0x11'),_0x40b30c,_0x2c458f);_0x1b4036(_0x2c458f);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index f47725a..c2b08b2 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 _0xa23d=['destroy','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x4517b2,_0x440bee){var _0x126463=function(_0x31d055){while(--_0x31d055){_0x4517b2['push'](_0x4517b2['shift']());}};_0x126463(++_0x440bee);}(_0xa23d,0x134));var _0xda23=function(_0x4ba905,_0x25891c){_0x4ba905=_0x4ba905-0x0;var _0x29ff5c=_0xa23d[_0x4ba905];return _0x29ff5c;};'use strict';var multer=require(_0xda23('0x0'));var util=require(_0xda23('0x1'));var path=require('path');var timeout=require(_0xda23('0x2'));var express=require(_0xda23('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xda23('0x4'));var interaction=require(_0xda23('0x5'));var config=require(_0xda23('0x6'));var controller=require('./intZendeskField.controller');router[_0xda23('0x7')]('/',auth[_0xda23('0x8')](),controller[_0xda23('0x9')]);router['get'](_0xda23('0xa'),auth[_0xda23('0x8')](),controller[_0xda23('0xb')]);router[_0xda23('0xc')]('/',auth['isAuthenticated'](),controller[_0xda23('0xd')]);router[_0xda23('0xe')](_0xda23('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xda23('0xa'),auth[_0xda23('0x8')](),controller[_0xda23('0xf')]);module[_0xda23('0x10')]=router; \ No newline at end of file +var _0x0102=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','index','/:id','isAuthenticated','show','post','put','update','delete','destroy','exports'];(function(_0x3a2c0f,_0x5764f4){var _0x3f1d27=function(_0x5b0f6f){while(--_0x5b0f6f){_0x3a2c0f['push'](_0x3a2c0f['shift']());}};_0x3f1d27(++_0x5764f4);}(_0x0102,0xd1));var _0x2010=function(_0x36b874,_0x3486cc){_0x36b874=_0x36b874-0x0;var _0x150eea=_0x0102[_0x36b874];return _0x150eea;};'use strict';var multer=require('multer');var util=require(_0x2010('0x0'));var path=require('path');var timeout=require(_0x2010('0x1'));var express=require(_0x2010('0x2'));var router=express[_0x2010('0x3')]();var fs_extra=require(_0x2010('0x4'));var auth=require(_0x2010('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2010('0x6'));var controller=require(_0x2010('0x7'));router[_0x2010('0x8')]('/',auth['isAuthenticated'](),controller[_0x2010('0x9')]);router[_0x2010('0x8')](_0x2010('0xa'),auth[_0x2010('0xb')](),controller[_0x2010('0xc')]);router[_0x2010('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2010('0xe')](_0x2010('0xa'),auth[_0x2010('0xb')](),controller[_0x2010('0xf')]);router[_0x2010('0x10')](_0x2010('0xa'),auth[_0x2010('0xb')](),controller[_0x2010('0x11')]);module[_0x2010('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index c8bccd8..aebadc5 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 _0xa0c2=['STRING','BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','picklist','string'];(function(_0x2a2f51,_0x2c76cf){var _0x53d7c4=function(_0x3309b3){while(--_0x3309b3){_0x2a2f51['push'](_0x2a2f51['shift']());}};_0x53d7c4(++_0x2c76cf);}(_0xa0c2,0x12e));var _0x2a0c=function(_0x573577,_0x23ef1f){_0x573577=_0x573577-0x0;var _0x453a8e=_0xa0c2[_0x573577];return _0x453a8e;};'use strict';var Sequelize=require(_0x2a0c('0x0'));module[_0x2a0c('0x1')]={'type':{'type':Sequelize[_0x2a0c('0x2')]('string',_0x2a0c('0x3'),_0x2a0c('0x4'),_0x2a0c('0x5'),_0x2a0c('0x6')),'defaultValue':_0x2a0c('0x7')},'content':{'type':Sequelize[_0x2a0c('0x8')]},'key':{'type':Sequelize[_0x2a0c('0x8')]},'keyType':{'type':Sequelize[_0x2a0c('0x2')](_0x2a0c('0x7'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x2a0c('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x2a0c('0x8')]},'customField':{'type':Sequelize[_0x2a0c('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2a0c('0x8')]}}; \ No newline at end of file +var _0xdbde=['keyValue','picklist','STRING','BOOLEAN','exports','ENUM','string','variable','customVariable'];(function(_0x5b8df6,_0x3afca6){var _0x234e78=function(_0x25fc14){while(--_0x25fc14){_0x5b8df6['push'](_0x5b8df6['shift']());}};_0x234e78(++_0x3afca6);}(_0xdbde,0xc1));var _0xedbd=function(_0x339c6f,_0x1b76ed){_0x339c6f=_0x339c6f-0x0;var _0x6c356d=_0xdbde[_0x339c6f];return _0x6c356d;};'use strict';var Sequelize=require('sequelize');module[_0xedbd('0x0')]={'type':{'type':Sequelize[_0xedbd('0x1')](_0xedbd('0x2'),_0xedbd('0x3'),_0xedbd('0x4'),_0xedbd('0x5'),_0xedbd('0x6')),'defaultValue':_0xedbd('0x2')},'content':{'type':Sequelize[_0xedbd('0x7')]},'key':{'type':Sequelize[_0xedbd('0x7')]},'keyType':{'type':Sequelize[_0xedbd('0x1')](_0xedbd('0x2'),_0xedbd('0x3'),_0xedbd('0x4'))},'keyContent':{'type':Sequelize[_0xedbd('0x7')]},'idField':{'type':Sequelize[_0xedbd('0x7')]},'nameField':{'type':Sequelize[_0xedbd('0x7')]},'customField':{'type':Sequelize[_0xedbd('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xedbd('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 448078b..7150e41 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 _0xbdb7=['sort','where','filters','pick','merge','then','findAll','rows','catch','params','rawAttributes','length','include','options','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','error','stack','name','send','index','map','ZendeskField','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','order'];(function(_0x3bd1d9,_0x3950a5){var _0x4bd72f=function(_0x175da7){while(--_0x175da7){_0x3bd1d9['push'](_0x3bd1d9['shift']());}};_0x4bd72f(++_0x3950a5);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x1c3fee,_0x26b5ac){_0x1c3fee=_0x1c3fee-0x0;var _0x112788=_0xbdb7[_0x1c3fee];return _0x112788;};'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['ZendeskField'][_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));}; \ No newline at end of file +var _0x1edd=['sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','params','catch','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3f992b,_0x366452){var _0x592572=function(_0x50a215){while(--_0x50a215){_0x3f992b['push'](_0x3f992b['shift']());}};_0x592572(++_0x366452);}(_0x1edd,0xcd));var _0xd1ed=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x1edd[_0x46d0c9];return _0x174506;};'use strict';var emlformat=require(_0xd1ed('0x0'));var rimraf=require(_0xd1ed('0x1'));var zipdir=require(_0xd1ed('0x2'));var jsonpatch=require(_0xd1ed('0x3'));var rp=require(_0xd1ed('0x4'));var moment=require(_0xd1ed('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd1ed('0x6'));var util=require(_0xd1ed('0x7'));var path=require('path');var sox=require(_0xd1ed('0x8'));var csv=require(_0xd1ed('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd1ed('0xa'));var squel=require(_0xd1ed('0xb'));var crypto=require(_0xd1ed('0xc'));var jsforce=require(_0xd1ed('0xd'));var deskjs=require(_0xd1ed('0xe'));var toCsv=require('to-csv');var querystring=require(_0xd1ed('0xf'));var Papa=require(_0xd1ed('0x10'));var Redis=require(_0xd1ed('0x11'));var authService=require(_0xd1ed('0x12'));var qs=require(_0xd1ed('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xd1ed('0x14'))('api');var utils=require(_0xd1ed('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd1ed('0x16'));var db=require(_0xd1ed('0x17'))['db'];function respondWithStatusCode(_0x5245d3,_0x830708){_0x830708=_0x830708||0xcc;return function(_0x1fcb38){if(_0x1fcb38){return _0x5245d3[_0xd1ed('0x18')](_0x830708);}return _0x5245d3[_0xd1ed('0x19')](_0x830708)[_0xd1ed('0x1a')]();};}function respondWithResult(_0x297a92,_0x58101c){_0x58101c=_0x58101c||0xc8;return function(_0x3303c7){if(_0x3303c7){return _0x297a92['status'](_0x58101c)[_0xd1ed('0x1b')](_0x3303c7);}};}function respondWithFilteredResult(_0x180d67,_0x474ba4){return function(_0x58f0b1){if(_0x58f0b1){var _0x2464f5=typeof _0x474ba4[_0xd1ed('0x1c')]==='undefined'&&typeof _0x474ba4[_0xd1ed('0x1d')]===_0xd1ed('0x1e');var _0x509cba=_0x58f0b1['count'];var _0x310d6a=_0x2464f5?0x0:_0x474ba4[_0xd1ed('0x1c')];var _0x13d7b9=_0x2464f5?_0x58f0b1[_0xd1ed('0x1f')]:_0x474ba4['offset']+_0x474ba4[_0xd1ed('0x1d')];var _0x445e57;if(_0x13d7b9>=_0x509cba){_0x13d7b9=_0x509cba;_0x445e57=0xc8;}else{_0x445e57=0xce;}_0x180d67[_0xd1ed('0x19')](_0x445e57);return _0x180d67[_0xd1ed('0x20')](_0xd1ed('0x21'),_0x310d6a+'-'+_0x13d7b9+'/'+_0x509cba)['json'](_0x58f0b1);}return null;};}function patchUpdates(_0x4b5a5e){return function(_0x643fed){try{jsonpatch[_0xd1ed('0x22')](_0x643fed,_0x4b5a5e,!![]);}catch(_0x321717){return BPromise['reject'](_0x321717);}return _0x643fed[_0xd1ed('0x23')]();};}function saveUpdates(_0x289010,_0x12e3ea){return function(_0x27161e){if(_0x27161e){return _0x27161e['update'](_0x289010)[_0xd1ed('0x24')](function(_0x1b5f5a){return _0x1b5f5a;});}return null;};}function removeEntity(_0x8981d2,_0x5d2f3e){return function(_0xc246d4){if(_0xc246d4){return _0xc246d4[_0xd1ed('0x25')]()[_0xd1ed('0x24')](function(){_0x8981d2[_0xd1ed('0x19')](0xcc)[_0xd1ed('0x1a')]();});}};}function handleEntityNotFound(_0xafe250,_0x249d34){return function(_0x1472a8){if(!_0x1472a8){_0xafe250['sendStatus'](0x194);}return _0x1472a8;};}function handleError(_0x157438,_0x3b9c18){_0x3b9c18=_0x3b9c18||0x1f4;return function(_0x4797cc){logger[_0xd1ed('0x26')](_0x4797cc[_0xd1ed('0x27')]);if(_0x4797cc[_0xd1ed('0x28')]){delete _0x4797cc[_0xd1ed('0x28')];}_0x157438[_0xd1ed('0x19')](_0x3b9c18)['send'](_0x4797cc);};}exports[_0xd1ed('0x29')]=function(_0x6c544d,_0x5d7574){var _0x4e0df4={},_0x2d701f={},_0x2f6dc1={'count':0x0,'rows':[]};var _0x4e7b75=_[_0xd1ed('0x2a')](db[_0xd1ed('0x2b')][_0xd1ed('0x2c')],function(_0x3bc06d){return{'name':_0x3bc06d[_0xd1ed('0x2d')],'type':_0x3bc06d[_0xd1ed('0x2e')][_0xd1ed('0x2f')]};});_0x2d701f[_0xd1ed('0x30')]=_[_0xd1ed('0x2a')](_0x4e7b75,'name');_0x2d701f[_0xd1ed('0x31')]=_[_0xd1ed('0x32')](_0x6c544d[_0xd1ed('0x31')]);_0x2d701f[_0xd1ed('0x33')]=_['intersection'](_0x2d701f[_0xd1ed('0x30')],_0x2d701f['query']);_0x4e0df4[_0xd1ed('0x34')]=_[_0xd1ed('0x35')](_0x2d701f['model'],qs[_0xd1ed('0x36')](_0x6c544d['query'][_0xd1ed('0x36')]));_0x4e0df4[_0xd1ed('0x34')]=_0x4e0df4['attributes'][_0xd1ed('0x37')]?_0x4e0df4[_0xd1ed('0x34')]:_0x2d701f[_0xd1ed('0x30')];if(!_0x6c544d[_0xd1ed('0x31')]['hasOwnProperty'](_0xd1ed('0x38'))){_0x4e0df4[_0xd1ed('0x1d')]=qs[_0xd1ed('0x1d')](_0x6c544d[_0xd1ed('0x31')]['limit']);_0x4e0df4[_0xd1ed('0x1c')]=qs['offset'](_0x6c544d['query'][_0xd1ed('0x1c')]);}_0x4e0df4[_0xd1ed('0x39')]=qs[_0xd1ed('0x3a')](_0x6c544d[_0xd1ed('0x31')][_0xd1ed('0x3a')]);_0x4e0df4[_0xd1ed('0x3b')]=qs['filters'](_['pick'](_0x6c544d['query'],_0x2d701f['filters']),_0x4e7b75);if(_0x6c544d[_0xd1ed('0x31')][_0xd1ed('0x3c')]){_0x4e0df4['where']=_[_0xd1ed('0x3d')](_0x4e0df4['where'],{'$or':_[_0xd1ed('0x2a')](_0x4e7b75,function(_0x6e3383){if(_0x6e3383[_0xd1ed('0x2e')]!==_0xd1ed('0x3e')){var _0x28f84a={};_0x28f84a[_0x6e3383[_0xd1ed('0x28')]]={'$like':'%'+_0x6c544d['query'][_0xd1ed('0x3c')]+'%'};return _0x28f84a;}})});}_0x4e0df4=_[_0xd1ed('0x3d')]({},_0x4e0df4,_0x6c544d['options']);var _0x54149a={'where':_0x4e0df4['where']};return db[_0xd1ed('0x2b')][_0xd1ed('0x1f')](_0x54149a)['then'](function(_0x573296){_0x2f6dc1[_0xd1ed('0x1f')]=_0x573296;if(_0x6c544d['query'][_0xd1ed('0x3f')]){_0x4e0df4[_0xd1ed('0x40')]=[{'all':!![]}];}return db[_0xd1ed('0x2b')][_0xd1ed('0x41')](_0x4e0df4);})[_0xd1ed('0x24')](function(_0x1b2bc1){_0x2f6dc1['rows']=_0x1b2bc1;return _0x2f6dc1;})[_0xd1ed('0x24')](respondWithFilteredResult(_0x5d7574,_0x4e0df4))['catch'](handleError(_0x5d7574,null));};exports['show']=function(_0x149999,_0x7c959d){var _0x3c4cf2={'raw':!![],'where':{'id':_0x149999[_0xd1ed('0x42')]['id']}},_0xb3e263={};_0xb3e263['model']=_[_0xd1ed('0x32')](db['ZendeskField'][_0xd1ed('0x2c')]);_0xb3e263[_0xd1ed('0x31')]=_[_0xd1ed('0x32')](_0x149999[_0xd1ed('0x31')]);_0xb3e263[_0xd1ed('0x33')]=_[_0xd1ed('0x35')](_0xb3e263[_0xd1ed('0x30')],_0xb3e263[_0xd1ed('0x31')]);_0x3c4cf2[_0xd1ed('0x34')]=_['intersection'](_0xb3e263[_0xd1ed('0x30')],qs[_0xd1ed('0x36')](_0x149999[_0xd1ed('0x31')][_0xd1ed('0x36')]));_0x3c4cf2[_0xd1ed('0x34')]=_0x3c4cf2[_0xd1ed('0x34')][_0xd1ed('0x37')]?_0x3c4cf2[_0xd1ed('0x34')]:_0xb3e263[_0xd1ed('0x30')];if(_0x149999['query'][_0xd1ed('0x3f')]){_0x3c4cf2[_0xd1ed('0x40')]=[{'all':!![]}];}_0x3c4cf2=_[_0xd1ed('0x3d')]({},_0x3c4cf2,_0x149999['options']);return db[_0xd1ed('0x2b')]['find'](_0x3c4cf2)['then'](handleEntityNotFound(_0x7c959d,null))[_0xd1ed('0x24')](respondWithResult(_0x7c959d,null))[_0xd1ed('0x43')](handleError(_0x7c959d,null));};exports['create']=function(_0x328068,_0x479076){return db[_0xd1ed('0x2b')]['create'](_0x328068['body'],{})[_0xd1ed('0x24')](respondWithResult(_0x479076,0xc9))[_0xd1ed('0x43')](handleError(_0x479076,null));};exports[_0xd1ed('0x44')]=function(_0xa2f036,_0xfdbc58){if(_0xa2f036['body']['id']){delete _0xa2f036[_0xd1ed('0x45')]['id'];}return db[_0xd1ed('0x2b')][_0xd1ed('0x46')]({'where':{'id':_0xa2f036[_0xd1ed('0x42')]['id']}})['then'](handleEntityNotFound(_0xfdbc58,null))['then'](saveUpdates(_0xa2f036['body'],null))[_0xd1ed('0x24')](respondWithResult(_0xfdbc58,null))[_0xd1ed('0x43')](handleError(_0xfdbc58,null));};exports[_0xd1ed('0x25')]=function(_0x1a85fa,_0x4378b8){return db[_0xd1ed('0x2b')][_0xd1ed('0x46')]({'where':{'id':_0x1a85fa[_0xd1ed('0x42')]['id']}})['then'](handleEntityNotFound(_0x4378b8,null))[_0xd1ed('0x24')](removeEntity(_0x4378b8,null))[_0xd1ed('0x43')](handleError(_0x4378b8,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index af458b2..8fe8295 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 _0x1ebe=['../../config/environment','./intZendeskField.attributes','exports','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','../../config/logger','moment','rimraf'];(function(_0x22405a,_0x4c9fa1){var _0x702303=function(_0x4d0397){while(--_0x4d0397){_0x22405a['push'](_0x22405a['shift']());}};_0x702303(++_0x4c9fa1);}(_0x1ebe,0xbf));var _0xe1eb=function(_0x467f29,_0x345a65){_0x467f29=_0x467f29-0x0;var _0x5e46b9=_0x1ebe[_0x467f29];return _0x5e46b9;};'use strict';var _=require(_0xe1eb('0x0'));var util=require('util');var logger=require(_0xe1eb('0x1'))('api');var moment=require(_0xe1eb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe1eb('0x3'));var config=require(_0xe1eb('0x4'));var attributes=require(_0xe1eb('0x5'));module[_0xe1eb('0x6')]=function(_0x4f3688,_0x3b3629){return _0x4f3688[_0xe1eb('0x7')](_0xe1eb('0x8'),attributes,{'tableName':_0xe1eb('0x9'),'paranoid':![],'indexes':[{'name':_0xe1eb('0xa'),'fields':[_0xe1eb('0xb'),_0xe1eb('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb68=['./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','idField','FieldId','lodash','util','../../config/logger','moment','rimraf'];(function(_0x54afac,_0x18c538){var _0x109416=function(_0x1b8631){while(--_0x1b8631){_0x54afac['push'](_0x54afac['shift']());}};_0x109416(++_0x18c538);}(_0xfb68,0xab));var _0x8fb6=function(_0x58084a,_0x4eeea3){_0x58084a=_0x58084a-0x0;var _0x4736ae=_0xfb68[_0x58084a];return _0x4736ae;};'use strict';var _=require(_0x8fb6('0x0'));var util=require(_0x8fb6('0x1'));var logger=require(_0x8fb6('0x2'))('api');var moment=require(_0x8fb6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8fb6('0x4'));var config=require('../../config/environment');var attributes=require(_0x8fb6('0x5'));module[_0x8fb6('0x6')]=function(_0x370720,_0x2f5505){return _0x370720['define'](_0x8fb6('0x7'),attributes,{'tableName':_0x8fb6('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0x8fb6('0x9'),_0x8fb6('0xa')],'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 facb64f..4f0b90c 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 _0x4d27=['jayson/promise','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','../../mysqldb','rpc','../../config/environment'];(function(_0x3e2936,_0x1d57a9){var _0x35d87a=function(_0x19dd6a){while(--_0x19dd6a){_0x3e2936['push'](_0x3e2936['shift']());}};_0x35d87a(++_0x1d57a9);}(_0x4d27,0x83));var _0x74d2=function(_0x44b186,_0x31f3ad){_0x44b186=_0x44b186-0x0;var _0x12efd7=_0x4d27[_0x44b186];return _0x12efd7;};'use strict';var _=require(_0x74d2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x74d2('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74d2('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x74d2('0x3'));var config=require(_0x74d2('0x4'));var jayson=require(_0x74d2('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1891a8,_0x12665a,_0x2cca94){return new BPromise(function(_0x225a6a,_0x1a5606){return client[_0x74d2('0x6')](_0x1891a8,_0x2cca94)[_0x74d2('0x7')](function(_0x369648){logger[_0x74d2('0x8')](_0x74d2('0x9'),_0x12665a,_0x74d2('0xa'));logger['debug'](_0x74d2('0xb'),_0x12665a,'request\x20sent',JSON[_0x74d2('0xc')](_0x369648));if(_0x369648[_0x74d2('0xd')]){if(_0x369648['error'][_0x74d2('0xe')]===0x1f4){logger[_0x74d2('0xd')](_0x74d2('0x9'),_0x12665a,_0x369648[_0x74d2('0xd')]['message']);return _0x1a5606(_0x369648[_0x74d2('0xd')][_0x74d2('0xf')]);}logger[_0x74d2('0xd')]('ZendeskField,\x20%s,\x20%s',_0x12665a,_0x369648[_0x74d2('0xd')][_0x74d2('0xf')]);return _0x225a6a(_0x369648[_0x74d2('0xd')]['message']);}else{logger[_0x74d2('0x8')](_0x74d2('0x9'),_0x12665a,'request\x20sent');_0x225a6a(_0x369648['result']['message']);}})[_0x74d2('0x10')](function(_0x5a83a2){logger[_0x74d2('0xd')]('ZendeskField,\x20%s,\x20%s',_0x12665a,_0x5a83a2);_0x1a5606(_0x5a83a2);});});} \ No newline at end of file +var _0x568c=['info','result','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','ZendeskField,\x20%s,\x20%s','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error','message'];(function(_0x2aa253,_0x269305){var _0xb4ee18=function(_0x4a20c1){while(--_0x4a20c1){_0x2aa253['push'](_0x2aa253['shift']());}};_0xb4ee18(++_0x269305);}(_0x568c,0xc8));var _0xc568=function(_0xecc71a,_0x180805){_0xecc71a=_0xecc71a-0x0;var _0x51fd43=_0x568c[_0xecc71a];return _0x51fd43;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc568('0x0'));var BPromise=require(_0xc568('0x1'));var rs=require(_0xc568('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc568('0x3'))['db'];var utils=require(_0xc568('0x4'));var logger=require(_0xc568('0x5'))(_0xc568('0x6'));var config=require('../../config/environment');var jayson=require(_0xc568('0x7'));var client=jayson[_0xc568('0x8')][_0xc568('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf7a16c,_0x4261bc,_0x1d66d7){return new BPromise(function(_0xf091bc,_0x52bb44){return client[_0xc568('0xa')](_0xf7a16c,_0x1d66d7)['then'](function(_0x5debb0){logger['info'](_0xc568('0xb'),_0x4261bc,'request\x20sent');logger['debug'](_0xc568('0xc'),_0x4261bc,_0xc568('0xd'),JSON['stringify'](_0x5debb0));if(_0x5debb0[_0xc568('0xe')]){if(_0x5debb0[_0xc568('0xe')]['code']===0x1f4){logger['error'](_0xc568('0xb'),_0x4261bc,_0x5debb0[_0xc568('0xe')][_0xc568('0xf')]);return _0x52bb44(_0x5debb0[_0xc568('0xe')][_0xc568('0xf')]);}logger[_0xc568('0xe')](_0xc568('0xb'),_0x4261bc,_0x5debb0['error'][_0xc568('0xf')]);return _0xf091bc(_0x5debb0[_0xc568('0xe')][_0xc568('0xf')]);}else{logger[_0xc568('0x10')](_0xc568('0xb'),_0x4261bc,_0xc568('0xd'));_0xf091bc(_0x5debb0[_0xc568('0x11')][_0xc568('0xf')]);}})['catch'](function(_0x445931){logger[_0xc568('0xe')](_0xc568('0xb'),_0x4261bc,_0x445931);_0x52bb44(_0x445931);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index fcba6aa..bf42d3d 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 _0xb19a=['isAuthenticated','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get'];(function(_0x1a3a4c,_0x50e07b){var _0x8054c0=function(_0x504e18){while(--_0x504e18){_0x1a3a4c['push'](_0x1a3a4c['shift']());}};_0x8054c0(++_0x50e07b);}(_0xb19a,0x1d7));var _0xab19=function(_0x30b505,_0x52f82a){_0x30b505=_0x30b505-0x0;var _0xd39523=_0xb19a[_0x30b505];return _0xd39523;};'use strict';var multer=require(_0xab19('0x0'));var util=require(_0xab19('0x1'));var path=require(_0xab19('0x2'));var timeout=require(_0xab19('0x3'));var express=require(_0xab19('0x4'));var router=express[_0xab19('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xab19('0x6'));var interaction=require(_0xab19('0x7'));var config=require('../../config/environment');var controller=require('./intZohoAccount.controller');router[_0xab19('0x8')]('/',auth[_0xab19('0x9')](),controller['index']);router[_0xab19('0x8')]('/:id',auth[_0xab19('0x9')](),controller['show']);router[_0xab19('0x8')](_0xab19('0xa'),auth[_0xab19('0x9')](),controller[_0xab19('0xb')]);router[_0xab19('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0xab19('0xc')]);router[_0xab19('0xd')]('/',auth[_0xab19('0x9')](),controller[_0xab19('0xe')]);router[_0xab19('0xd')](_0xab19('0xa'),auth['isAuthenticated'](),controller[_0xab19('0xf')]);router['put'](_0xab19('0x10'),auth[_0xab19('0x9')](),controller[_0xab19('0x11')]);router['delete'](_0xab19('0x10'),auth['isAuthenticated'](),controller[_0xab19('0x12')]);module[_0xab19('0x13')]=router; \ No newline at end of file +var _0x1d15=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','index','/:id','isAuthenticated','show','get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x57eff3,_0x481834){var _0x23de11=function(_0xe67e4){while(--_0xe67e4){_0x57eff3['push'](_0x57eff3['shift']());}};_0x23de11(++_0x481834);}(_0x1d15,0xe7));var _0x51d1=function(_0x148a18,_0x4972b3){_0x148a18=_0x148a18-0x0;var _0x3723b0=_0x1d15[_0x148a18];return _0x3723b0;};'use strict';var multer=require(_0x51d1('0x0'));var util=require(_0x51d1('0x1'));var path=require(_0x51d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x51d1('0x3'));var router=express[_0x51d1('0x4')]();var fs_extra=require(_0x51d1('0x5'));var auth=require(_0x51d1('0x6'));var interaction=require(_0x51d1('0x7'));var config=require(_0x51d1('0x8'));var controller=require(_0x51d1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x51d1('0xa')]);router['get'](_0x51d1('0xb'),auth[_0x51d1('0xc')](),controller[_0x51d1('0xd')]);router[_0x51d1('0xe')](_0x51d1('0xf'),auth[_0x51d1('0xc')](),controller[_0x51d1('0x10')]);router[_0x51d1('0xe')](_0x51d1('0x11'),auth['isAuthenticated'](),controller[_0x51d1('0x12')]);router[_0x51d1('0x13')]('/',auth[_0x51d1('0xc')](),controller[_0x51d1('0x14')]);router[_0x51d1('0x13')]('/:id/configurations',auth[_0x51d1('0xc')](),controller[_0x51d1('0x15')]);router[_0x51d1('0x16')]('/:id',auth[_0x51d1('0xc')](),controller[_0x51d1('0x17')]);router['delete'](_0x51d1('0xb'),auth[_0x51d1('0xc')](),controller[_0x51d1('0x18')]);module[_0x51d1('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index ac8c058..46a3c19 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 _0x5c12=['exports','STRING'];(function(_0x59d691,_0x1c958c){var _0x18650b=function(_0x188d22){while(--_0x188d22){_0x59d691['push'](_0x59d691['shift']());}};_0x18650b(++_0x1c958c);}(_0x5c12,0x188));var _0x25c1=function(_0x5d5bcb,_0x25e2ea){_0x5d5bcb=_0x5d5bcb-0x0;var _0x4ea5eb=_0x5c12[_0x5d5bcb];return _0x4ea5eb;};'use strict';var Sequelize=require('sequelize');module[_0x25c1('0x0')]={'name':{'type':Sequelize[_0x25c1('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x25c1('0x1')]},'zone':{'type':Sequelize[_0x25c1('0x1')]},'clientId':{'type':Sequelize[_0x25c1('0x1')]},'clientSecret':{'type':Sequelize[_0x25c1('0x1')]},'serverUrl':{'type':Sequelize[_0x25c1('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x25c1('0x1')]},'refreshToken':{'type':Sequelize[_0x25c1('0x1')]}}; \ No newline at end of file +var _0x1be1=['STRING'];(function(_0x1ee442,_0x2d8baa){var _0x316ad6=function(_0x3af4d6){while(--_0x3af4d6){_0x1ee442['push'](_0x1ee442['shift']());}};_0x316ad6(++_0x2d8baa);}(_0x1be1,0x192));var _0x11be=function(_0x2d39f2,_0x19e65){_0x2d39f2=_0x2d39f2-0x0;var _0x589f9d=_0x1be1[_0x2d39f2];return _0x589f9d;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x11be('0x0')]},'description':{'type':Sequelize[_0x11be('0x0')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x11be('0x0')]},'clientId':{'type':Sequelize[_0x11be('0x0')]},'clientSecret':{'type':Sequelize[_0x11be('0x0')]},'serverUrl':{'type':Sequelize[_0x11be('0x0')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x11be('0x0')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index b818ea6..418c32b 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 _0xeaa1=['ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','then','destroy','error','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','merge','where','includeAll','include','findAll','catch','show','params','options','find','create','body','update','getConfigurations','filter','AccountId','channel','ZohoConfiguration','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','getFields','findOne','host','serverUrl','code','refreshToken','zoho.eu','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Result','Call_Type','remove','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse'];(function(_0x108af6,_0x3f1249){var _0x65d03d=function(_0x272689){while(--_0x272689){_0x108af6['push'](_0x108af6['shift']());}};_0x65d03d(++_0x3f1249);}(_0xeaa1,0xee));var _0x1eaa=function(_0x21af22,_0x213566){_0x21af22=_0x21af22-0x0;var _0x5731b2=_0xeaa1[_0x21af22];return _0x5731b2;};'use strict';var emlformat=require(_0x1eaa('0x0'));var rimraf=require(_0x1eaa('0x1'));var zipdir=require(_0x1eaa('0x2'));var jsonpatch=require(_0x1eaa('0x3'));var rp=require(_0x1eaa('0x4'));var moment=require(_0x1eaa('0x5'));var BPromise=require(_0x1eaa('0x6'));var Mustache=require(_0x1eaa('0x7'));var util=require(_0x1eaa('0x8'));var path=require(_0x1eaa('0x9'));var sox=require('sox');var csv=require(_0x1eaa('0xa'));var ejs=require(_0x1eaa('0xb'));var fs=require('fs');var fs_extra=require(_0x1eaa('0xc'));var _=require('lodash');var squel=require(_0x1eaa('0xd'));var crypto=require(_0x1eaa('0xe'));var jsforce=require(_0x1eaa('0xf'));var deskjs=require(_0x1eaa('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1eaa('0x11'));var Redis=require(_0x1eaa('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1eaa('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1eaa('0x14'));var logger=require(_0x1eaa('0x15'))(_0x1eaa('0x16'));var utils=require(_0x1eaa('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x1eaa('0x18'));function respondWithStatusCode(_0x48e020,_0x10b9e7){_0x10b9e7=_0x10b9e7||0xcc;return function(_0x1bd9af){if(_0x1bd9af){return _0x48e020[_0x1eaa('0x19')](_0x10b9e7);}return _0x48e020[_0x1eaa('0x1a')](_0x10b9e7)[_0x1eaa('0x1b')]();};}function respondWithResult(_0x262b29,_0x500f49){_0x500f49=_0x500f49||0xc8;return function(_0x12807a){if(_0x12807a){return _0x262b29[_0x1eaa('0x1a')](_0x500f49)['json'](_0x12807a);}};}function respondWithFilteredResult(_0x26337c,_0x501f26){return function(_0xe315de){if(_0xe315de){var _0x47fae2=typeof _0x501f26[_0x1eaa('0x1c')]===_0x1eaa('0x1d')&&typeof _0x501f26['limit']==='undefined';var _0x33a7a7=_0xe315de[_0x1eaa('0x1e')];var _0x46d814=_0x47fae2?0x0:_0x501f26[_0x1eaa('0x1c')];var _0x113734=_0x47fae2?_0xe315de[_0x1eaa('0x1e')]:_0x501f26[_0x1eaa('0x1c')]+_0x501f26['limit'];var _0x1f1a34;if(_0x113734>=_0x33a7a7){_0x113734=_0x33a7a7;_0x1f1a34=0xc8;}else{_0x1f1a34=0xce;}_0x26337c['status'](_0x1f1a34);return _0x26337c[_0x1eaa('0x1f')]('Content-Range',_0x46d814+'-'+_0x113734+'/'+_0x33a7a7)[_0x1eaa('0x20')](_0xe315de);}return null;};}function patchUpdates(_0x1e19c5){return function(_0x2fccfc){try{jsonpatch[_0x1eaa('0x21')](_0x2fccfc,_0x1e19c5,!![]);}catch(_0x3fba12){return BPromise[_0x1eaa('0x22')](_0x3fba12);}return _0x2fccfc['save']();};}function saveUpdates(_0x49010d,_0x3056e0){return function(_0x65124c){if(_0x65124c){return _0x65124c['update'](_0x49010d)[_0x1eaa('0x23')](function(_0x294a40){return _0x294a40;});}return null;};}function removeEntity(_0x140ccf,_0x6af3e9){return function(_0x47bbc2){if(_0x47bbc2){return _0x47bbc2[_0x1eaa('0x24')]()[_0x1eaa('0x23')](function(){_0x140ccf[_0x1eaa('0x1a')](0xcc)[_0x1eaa('0x1b')]();});}};}function handleEntityNotFound(_0x3e7c5c,_0x5880e6){return function(_0x296867){if(!_0x296867){_0x3e7c5c[_0x1eaa('0x19')](0x194);}return _0x296867;};}function handleError(_0x2cdc00,_0x4b6057){_0x4b6057=_0x4b6057||0x1f4;return function(_0x5cb7bc){logger[_0x1eaa('0x25')](_0x5cb7bc['stack']);if(_0x5cb7bc['name']){delete _0x5cb7bc[_0x1eaa('0x26')];}_0x2cdc00['status'](_0x4b6057)[_0x1eaa('0x27')](_0x5cb7bc);};}exports[_0x1eaa('0x28')]=function(_0x91b921,_0xfef345){var _0x9553e7={},_0xa4cae4={},_0x297927={'count':0x0,'rows':[]};var _0x46ed77=_[_0x1eaa('0x29')](db[_0x1eaa('0x2a')][_0x1eaa('0x2b')],function(_0x40c0e6){return{'name':_0x40c0e6[_0x1eaa('0x2c')],'type':_0x40c0e6[_0x1eaa('0x2d')][_0x1eaa('0x2e')]};});_0xa4cae4['model']=_[_0x1eaa('0x29')](_0x46ed77,_0x1eaa('0x26'));_0xa4cae4[_0x1eaa('0x2f')]=_[_0x1eaa('0x30')](_0x91b921[_0x1eaa('0x2f')]);_0xa4cae4[_0x1eaa('0x31')]=_[_0x1eaa('0x32')](_0xa4cae4[_0x1eaa('0x33')],_0xa4cae4['query']);_0x9553e7[_0x1eaa('0x34')]=_[_0x1eaa('0x32')](_0xa4cae4[_0x1eaa('0x33')],qs[_0x1eaa('0x35')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x35')]));_0x9553e7[_0x1eaa('0x34')]=_0x9553e7[_0x1eaa('0x34')][_0x1eaa('0x36')]?_0x9553e7['attributes']:_0xa4cae4[_0x1eaa('0x33')];if(!_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x37')](_0x1eaa('0x38'))){_0x9553e7[_0x1eaa('0x39')]=qs[_0x1eaa('0x39')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x39')]);_0x9553e7['offset']=qs[_0x1eaa('0x1c')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x1c')]);}_0x9553e7[_0x1eaa('0x3a')]=qs[_0x1eaa('0x3b')](_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x3b')]);_0x9553e7['where']=qs[_0x1eaa('0x31')](_[_0x1eaa('0x3c')](_0x91b921[_0x1eaa('0x2f')],_0xa4cae4['filters']),_0x46ed77);if(_0x91b921[_0x1eaa('0x2f')]['filter']){_0x9553e7['where']=_[_0x1eaa('0x3d')](_0x9553e7[_0x1eaa('0x3e')],{'$or':_[_0x1eaa('0x29')](_0x46ed77,function(_0x46f87b){if(_0x46f87b['type']!=='VIRTUAL'){var _0x215805={};_0x215805[_0x46f87b[_0x1eaa('0x26')]]={'$like':'%'+_0x91b921[_0x1eaa('0x2f')]['filter']+'%'};return _0x215805;}})});}_0x9553e7=_[_0x1eaa('0x3d')]({},_0x9553e7,_0x91b921['options']);var _0x3a390c={'where':_0x9553e7['where']};return db[_0x1eaa('0x2a')]['count'](_0x3a390c)['then'](function(_0x23212c){_0x297927[_0x1eaa('0x1e')]=_0x23212c;if(_0x91b921[_0x1eaa('0x2f')][_0x1eaa('0x3f')]){_0x9553e7[_0x1eaa('0x40')]=[{'all':!![]}];}return db[_0x1eaa('0x2a')][_0x1eaa('0x41')](_0x9553e7);})['then'](function(_0x2cc011){_0x297927['rows']=_0x2cc011;return _0x297927;})['then'](respondWithFilteredResult(_0xfef345,_0x9553e7))[_0x1eaa('0x42')](handleError(_0xfef345,null));};exports[_0x1eaa('0x43')]=function(_0x4c4a41,_0x42cb49){var _0x4da428={'raw':![],'where':{'id':_0x4c4a41[_0x1eaa('0x44')]['id']}},_0x559e46={};_0x559e46[_0x1eaa('0x33')]=_[_0x1eaa('0x30')](db['ZohoAccount'][_0x1eaa('0x2b')]);_0x559e46[_0x1eaa('0x2f')]=_[_0x1eaa('0x30')](_0x4c4a41['query']);_0x559e46[_0x1eaa('0x31')]=_['intersection'](_0x559e46[_0x1eaa('0x33')],_0x559e46[_0x1eaa('0x2f')]);_0x4da428[_0x1eaa('0x34')]=_['intersection'](_0x559e46[_0x1eaa('0x33')],qs[_0x1eaa('0x35')](_0x4c4a41[_0x1eaa('0x2f')][_0x1eaa('0x35')]));_0x4da428['attributes']=_0x4da428['attributes'][_0x1eaa('0x36')]?_0x4da428[_0x1eaa('0x34')]:_0x559e46['model'];if(_0x4c4a41[_0x1eaa('0x2f')][_0x1eaa('0x3f')]){_0x4da428[_0x1eaa('0x40')]=[{'all':!![]}];}_0x4da428=_[_0x1eaa('0x3d')]({},_0x4da428,_0x4c4a41[_0x1eaa('0x45')]);return db[_0x1eaa('0x2a')][_0x1eaa('0x46')](_0x4da428)[_0x1eaa('0x23')](handleEntityNotFound(_0x42cb49,null))[_0x1eaa('0x23')](respondWithResult(_0x42cb49,null))['catch'](handleError(_0x42cb49,null));};exports['create']=function(_0x333d74,_0x8c584){return db[_0x1eaa('0x2a')][_0x1eaa('0x47')](_0x333d74[_0x1eaa('0x48')],{})[_0x1eaa('0x23')](respondWithResult(_0x8c584,0xc9))[_0x1eaa('0x42')](handleError(_0x8c584,null));};exports[_0x1eaa('0x49')]=function(_0x29d24d,_0x3ce1a5){if(_0x29d24d['body']['id']){delete _0x29d24d[_0x1eaa('0x48')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0x29d24d['params']['id']}})['then'](handleEntityNotFound(_0x3ce1a5,null))['then'](saveUpdates(_0x29d24d[_0x1eaa('0x48')],null))[_0x1eaa('0x23')](respondWithResult(_0x3ce1a5,null))[_0x1eaa('0x42')](handleError(_0x3ce1a5,null));};exports[_0x1eaa('0x24')]=function(_0x22e9f6,_0x8d901a){return db[_0x1eaa('0x2a')]['find']({'where':{'id':_0x22e9f6[_0x1eaa('0x44')]['id']}})[_0x1eaa('0x23')](handleEntityNotFound(_0x8d901a,null))['then'](removeEntity(_0x8d901a,null))['catch'](handleError(_0x8d901a,null));};exports[_0x1eaa('0x4a')]=function(_0x5ef20d,_0x405226,_0x202304){var _0x97adde={};var _0xbceb79={};var _0x41b461;var _0x4bb0f8;return db[_0x1eaa('0x2a')]['findOne']({'where':{'id':_0x5ef20d[_0x1eaa('0x44')]['id']}})[_0x1eaa('0x23')](handleEntityNotFound(_0x405226,null))[_0x1eaa('0x23')](function(_0xe0d313){if(_0xe0d313){_0x41b461=_0xe0d313;_0xbceb79[_0x1eaa('0x33')]=_[_0x1eaa('0x30')](db['ZohoConfiguration'][_0x1eaa('0x2b')]);_0xbceb79[_0x1eaa('0x2f')]=_[_0x1eaa('0x30')](_0x5ef20d['query']);_0xbceb79['filters']=_[_0x1eaa('0x32')](_0xbceb79[_0x1eaa('0x33')],_0xbceb79[_0x1eaa('0x2f')]);_0x97adde[_0x1eaa('0x34')]=_['intersection'](_0xbceb79['model'],qs['fields'](_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x35')]));_0x97adde['attributes']=_0x97adde[_0x1eaa('0x34')][_0x1eaa('0x36')]?_0x97adde[_0x1eaa('0x34')]:_0xbceb79[_0x1eaa('0x33')];_0x97adde['order']=qs['sort'](_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x3b')]);_0x97adde['where']=qs[_0x1eaa('0x31')](_['pick'](_0x5ef20d[_0x1eaa('0x2f')],_0xbceb79[_0x1eaa('0x31')]));if(_0x5ef20d['query']['filter']){_0x97adde[_0x1eaa('0x3e')]=_['merge'](_0x97adde['where'],{'$or':_[_0x1eaa('0x29')](_0x97adde['attributes'],function(_0x11811b){var _0x3dbabf={};_0x3dbabf[_0x11811b]={'$like':'%'+_0x5ef20d['query'][_0x1eaa('0x4b')]+'%'};return _0x3dbabf;})});}_0x97adde=_['merge']({},_0x97adde,_0x5ef20d['options']);return _0x41b461[_0x1eaa('0x4a')](_0x97adde);}})[_0x1eaa('0x23')](function(_0x5c9cbb){if(_0x5c9cbb){_0x4bb0f8=_0x5c9cbb['length'];if(!_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x37')](_0x1eaa('0x38'))){_0x97adde[_0x1eaa('0x39')]=qs['limit'](_0x5ef20d['query'][_0x1eaa('0x39')]);_0x97adde[_0x1eaa('0x1c')]=qs['offset'](_0x5ef20d[_0x1eaa('0x2f')][_0x1eaa('0x1c')]);}return _0x41b461[_0x1eaa('0x4a')](_0x97adde);}})[_0x1eaa('0x23')](function(_0x5eb2bc){if(_0x5eb2bc){return _0x5eb2bc?{'count':_0x4bb0f8,'rows':_0x5eb2bc}:null;}})[_0x1eaa('0x23')](respondWithResult(_0x405226,null))[_0x1eaa('0x42')](handleError(_0x405226,null));};exports['addConfiguration']=function(_0x16b285,_0x4a89e8,_0x392549){if(_0x16b285[_0x1eaa('0x48')]['id']){delete _0x16b285[_0x1eaa('0x48')]['id'];}return db[_0x1eaa('0x2a')]['findOne']({'where':{'id':_0x16b285['params']['id']}})[_0x1eaa('0x23')](handleEntityNotFound(_0x4a89e8,null))['then'](function(_0x2afc38){if(_0x2afc38){_0x16b285[_0x1eaa('0x48')][_0x1eaa('0x4c')]=_0x2afc38['id'];_0x16b285[_0x1eaa('0x48')]['Subjects']=integrations['getSubjects'](_0x16b285[_0x1eaa('0x48')][_0x1eaa('0x4d')],_0x16b285[_0x1eaa('0x48')]['type']);_0x16b285[_0x1eaa('0x48')]['Descriptions']=integrations['getDescriptions'](_0x16b285[_0x1eaa('0x48')][_0x1eaa('0x4d')],_0x16b285['body'][_0x1eaa('0x2d')]);return db[_0x1eaa('0x4e')]['create'](_0x16b285['body'],{'include':[{'model':db[_0x1eaa('0x4f')],'as':_0x1eaa('0x50')},{'model':db[_0x1eaa('0x4f')],'as':_0x1eaa('0x51')}]});}return null;})[_0x1eaa('0x23')](respondWithResult(_0x4a89e8,null))['catch'](handleError(_0x4a89e8,null));};function getAccessToken(_0x3466f4){return new Promise(function(_0x445915,_0x49d602){var _0x3ed43f;switch(_0x3466f4[_0x1eaa('0x52')]){case'US':_0x3ed43f=_0x1eaa('0x53');break;case'AU':_0x3ed43f=_0x1eaa('0x54');break;case'EU':_0x3ed43f='https://accounts.zoho.eu';break;case'IN':_0x3ed43f=_0x1eaa('0x55');break;case'CN':_0x3ed43f=_0x1eaa('0x56');break;default:_0x3ed43f=_0x1eaa('0x57');break;}var _0x59a707={'method':'POST','uri':_0x3ed43f+_0x1eaa('0x58'),'qs':{'refresh_token':_0x3466f4['refreshToken'],'client_id':_0x3466f4[_0x1eaa('0x59')],'client_secret':_0x3466f4[_0x1eaa('0x5a')],'grant_type':_0x1eaa('0x5b')},'json':!![]};return rp(_0x59a707)[_0x1eaa('0x23')](function(_0x4fc838){if(_0x4fc838[_0x1eaa('0x5c')]){_0x445915(_0x4fc838[_0x1eaa('0x5c')]);}else{_0x49d602('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x1eaa('0x42')](function(_0xb5cda9){_0x49d602(_0xb5cda9);});});}exports[_0x1eaa('0x5d')]=function(_0x31206a,_0x4ac828,_0x512557){var _0x39af7f,_0x174c1d,_0x23c685,_0x202726,_0x232f66;return db[_0x1eaa('0x2a')][_0x1eaa('0x5e')]({'where':{'id':_0x31206a[_0x1eaa('0x44')]['id']},'attributes':['id',_0x1eaa('0x5f'),_0x1eaa('0x52'),_0x1eaa('0x59'),_0x1eaa('0x5a'),_0x1eaa('0x60'),_0x1eaa('0x61'),_0x1eaa('0x62')]})['then'](handleEntityNotFound(_0x4ac828,null))[_0x1eaa('0x23')](function(_0x202282){_0x232f66=_0x202282;_0x39af7f=_0x232f66[_0x1eaa('0x5f')];_0x174c1d=_0x39af7f===_0x1eaa('0x63')?'eu':'com';_0x23c685=_0x232f66['serverUrl'];var _0x59a4bf=_0x23c685[_0x1eaa('0x64')](-0x1);if(_0x59a4bf==='/'||_0x59a4bf==='\x5c'||_0x59a4bf===':'){_0x23c685=_0x23c685[_0x1eaa('0x65')](0x0,_0x23c685[_0x1eaa('0x66')](_0x59a4bf));}if(!_0x232f66[_0x1eaa('0x62')]){throw new Error(_0x1eaa('0x67'));}return getAccessToken(_0x232f66);})['then'](function(_0x32688e){if(_0x32688e){return rp({'method':_0x1eaa('0x68'),'uri':util['format'](_0x1eaa('0x69'),_0x174c1d),'qs':{'module':_0x1eaa('0x6a')},'headers':{'Authorization':_0x1eaa('0x6b')+_0x32688e},'json':!![]});}})['then'](function(_0xc5fb9f){if(_0xc5fb9f){if(_0xc5fb9f[_0x1eaa('0x6c')]&&_0xc5fb9f[_0x1eaa('0x6c')]['error']){throw new Error(_0xc5fb9f[_0x1eaa('0x6c')][_0x1eaa('0x25')][_0x1eaa('0x6d')]);}var _0x5951c1=[];var _0x53f2f4=[];var _0x5f3b9f=[_0x1eaa('0x6e'),_0x1eaa('0x6f'),_0x1eaa('0x70'),_0x1eaa('0x71'),'Call_Duration',_0x1eaa('0x72'),'Call_Start_Time',_0x1eaa('0x73')];_0x53f2f4=_[_0x1eaa('0x74')](_0xc5fb9f[_0x1eaa('0x35')],function(_0x48be44){return _0x5f3b9f['includes'](_0x48be44[_0x1eaa('0x75')]);});for(var _0x530c40=0x0;_0x530c40<_0x53f2f4[_0x1eaa('0x36')];_0x530c40++){if(_0x53f2f4[_0x530c40][_0x1eaa('0x76')]===![]){_0x5951c1[_0x1eaa('0x77')]({'id':_0x53f2f4[_0x530c40]['id'],'name':_0x53f2f4[_0x530c40][_0x1eaa('0x78')],'custom':_0x53f2f4[_0x530c40][_0x1eaa('0x79')],'options':_0x53f2f4[_0x530c40]['data_type']===_0x1eaa('0x7a')&&_0x53f2f4[_0x530c40][_0x1eaa('0x7b')][_0x1eaa('0x36')]>-0x1?_[_0x1eaa('0x29')](_0x53f2f4[_0x530c40]['pick_list_values'],function(_0x3b6764){return{'name':_0x3b6764,'value':_0x3b6764};}):[]});}}return{'count':_0x5951c1[_0x1eaa('0x36')],'rows':_0x5951c1};}else{return{'count':0x0,'rows':[]};}})[_0x1eaa('0x23')](respondWithResult(_0x4ac828,null))['catch'](function(_0x216ec5){var _0x1df7ac=_0x31206a['query'][_0x1eaa('0x7c')]?0x1f4:_0x216ec5[_0x1eaa('0x7d')]||0x1f4;logger[_0x1eaa('0x25')](_0x1eaa('0x7e'),_0x1eaa('0x5d'),_0x1df7ac,JSON['stringify'](_0x216ec5));delete _0x216ec5['name'];if(_0x1df7ac===0x191){_0x1df7ac=0x190;}_0x4ac828[_0x1eaa('0x1a')](_0x1df7ac)[_0x1eaa('0x27')](_0x31206a[_0x1eaa('0x2f')]['test']?{'message':_0x1eaa('0x7f'),'statusCode':_0x216ec5[_0x1eaa('0x7d')]}:_0x216ec5);});}; \ No newline at end of file +var _0xdd0f=['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','../../components/integrations/configuration','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','error','stack','name','send','index','map','ZohoAccount','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','findAll','rows','catch','show','rawAttributes','keys','includeAll','include','find','body','params','findOne','ZohoConfiguration','getConfigurations','addConfiguration','AccountId','channel','getDescriptions','create','ZohoField','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','clientId','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','format','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','ejs','lodash'];(function(_0x4fe328,_0x5e456d){var _0x11a53b=function(_0x42f8cb){while(--_0x42f8cb){_0x4fe328['push'](_0x4fe328['shift']());}};_0x11a53b(++_0x5e456d);}(_0xdd0f,0x180));var _0xfdd0=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd0f[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xfdd0('0x0'));var rimraf=require(_0xfdd0('0x1'));var zipdir=require(_0xfdd0('0x2'));var jsonpatch=require(_0xfdd0('0x3'));var rp=require(_0xfdd0('0x4'));var moment=require('moment');var BPromise=require(_0xfdd0('0x5'));var Mustache=require(_0xfdd0('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfdd0('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfdd0('0x8'));var squel=require(_0xfdd0('0x9'));var crypto=require(_0xfdd0('0xa'));var jsforce=require(_0xfdd0('0xb'));var deskjs=require(_0xfdd0('0xc'));var toCsv=require('to-csv');var querystring=require(_0xfdd0('0xd'));var Papa=require(_0xfdd0('0xe'));var Redis=require(_0xfdd0('0xf'));var authService=require(_0xfdd0('0x10'));var qs=require(_0xfdd0('0x11'));var as=require(_0xfdd0('0x12'));var hardwareService=require(_0xfdd0('0x13'));var logger=require('../../config/logger')(_0xfdd0('0x14'));var utils=require(_0xfdd0('0x15'));var config=require(_0xfdd0('0x16'));var licenseUtil=require(_0xfdd0('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfdd0('0x18'));function respondWithStatusCode(_0x41ad88,_0x36d728){_0x36d728=_0x36d728||0xcc;return function(_0xb71f87){if(_0xb71f87){return _0x41ad88['sendStatus'](_0x36d728);}return _0x41ad88['status'](_0x36d728)[_0xfdd0('0x19')]();};}function respondWithResult(_0x35e351,_0x1773fd){_0x1773fd=_0x1773fd||0xc8;return function(_0x5d2eec){if(_0x5d2eec){return _0x35e351[_0xfdd0('0x1a')](_0x1773fd)[_0xfdd0('0x1b')](_0x5d2eec);}};}function respondWithFilteredResult(_0x26912f,_0x652ab){return function(_0x2416e0){if(_0x2416e0){var _0x353192=typeof _0x652ab[_0xfdd0('0x1c')]===_0xfdd0('0x1d')&&typeof _0x652ab[_0xfdd0('0x1e')]===_0xfdd0('0x1d');var _0x179bf0=_0x2416e0[_0xfdd0('0x1f')];var _0x2d5356=_0x353192?0x0:_0x652ab[_0xfdd0('0x1c')];var _0x33b096=_0x353192?_0x2416e0['count']:_0x652ab[_0xfdd0('0x1c')]+_0x652ab[_0xfdd0('0x1e')];var _0xf99095;if(_0x33b096>=_0x179bf0){_0x33b096=_0x179bf0;_0xf99095=0xc8;}else{_0xf99095=0xce;}_0x26912f[_0xfdd0('0x1a')](_0xf99095);return _0x26912f[_0xfdd0('0x20')]('Content-Range',_0x2d5356+'-'+_0x33b096+'/'+_0x179bf0)['json'](_0x2416e0);}return null;};}function patchUpdates(_0x743090){return function(_0x10a99b){try{jsonpatch['apply'](_0x10a99b,_0x743090,!![]);}catch(_0x470e53){return BPromise[_0xfdd0('0x21')](_0x470e53);}return _0x10a99b[_0xfdd0('0x22')]();};}function saveUpdates(_0x2ec7c0,_0x81ff7){return function(_0x2ab64){if(_0x2ab64){return _0x2ab64[_0xfdd0('0x23')](_0x2ec7c0)[_0xfdd0('0x24')](function(_0x5439ce){return _0x5439ce;});}return null;};}function removeEntity(_0x561df7,_0xa9cfeb){return function(_0x387f5f){if(_0x387f5f){return _0x387f5f['destroy']()['then'](function(){_0x561df7[_0xfdd0('0x1a')](0xcc)[_0xfdd0('0x19')]();});}};}function handleEntityNotFound(_0x3be01b,_0x26edd7){return function(_0x28d3e0){if(!_0x28d3e0){_0x3be01b['sendStatus'](0x194);}return _0x28d3e0;};}function handleError(_0xa7ddf4,_0x9f16e7){_0x9f16e7=_0x9f16e7||0x1f4;return function(_0x508d97){logger[_0xfdd0('0x25')](_0x508d97[_0xfdd0('0x26')]);if(_0x508d97[_0xfdd0('0x27')]){delete _0x508d97[_0xfdd0('0x27')];}_0xa7ddf4[_0xfdd0('0x1a')](_0x9f16e7)[_0xfdd0('0x28')](_0x508d97);};}exports[_0xfdd0('0x29')]=function(_0x5f4673,_0x5476eb){var _0x3fc957={},_0x45781d={},_0x2503da={'count':0x0,'rows':[]};var _0x582710=_[_0xfdd0('0x2a')](db[_0xfdd0('0x2b')]['rawAttributes'],function(_0x163847){return{'name':_0x163847['fieldName'],'type':_0x163847[_0xfdd0('0x2c')][_0xfdd0('0x2d')]};});_0x45781d[_0xfdd0('0x2e')]=_[_0xfdd0('0x2a')](_0x582710,'name');_0x45781d[_0xfdd0('0x2f')]=_['keys'](_0x5f4673[_0xfdd0('0x2f')]);_0x45781d[_0xfdd0('0x30')]=_[_0xfdd0('0x31')](_0x45781d[_0xfdd0('0x2e')],_0x45781d[_0xfdd0('0x2f')]);_0x3fc957[_0xfdd0('0x32')]=_[_0xfdd0('0x31')](_0x45781d[_0xfdd0('0x2e')],qs['fields'](_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x33')]));_0x3fc957[_0xfdd0('0x32')]=_0x3fc957[_0xfdd0('0x32')][_0xfdd0('0x34')]?_0x3fc957[_0xfdd0('0x32')]:_0x45781d[_0xfdd0('0x2e')];if(!_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x35')](_0xfdd0('0x36'))){_0x3fc957[_0xfdd0('0x1e')]=qs[_0xfdd0('0x1e')](_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x1e')]);_0x3fc957[_0xfdd0('0x1c')]=qs[_0xfdd0('0x1c')](_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x1c')]);}_0x3fc957[_0xfdd0('0x37')]=qs['sort'](_0x5f4673['query'][_0xfdd0('0x38')]);_0x3fc957['where']=qs[_0xfdd0('0x30')](_['pick'](_0x5f4673[_0xfdd0('0x2f')],_0x45781d['filters']),_0x582710);if(_0x5f4673['query'][_0xfdd0('0x39')]){_0x3fc957[_0xfdd0('0x3a')]=_[_0xfdd0('0x3b')](_0x3fc957[_0xfdd0('0x3a')],{'$or':_[_0xfdd0('0x2a')](_0x582710,function(_0x327b8c){if(_0x327b8c[_0xfdd0('0x2c')]!==_0xfdd0('0x3c')){var _0x2c2a53={};_0x2c2a53[_0x327b8c[_0xfdd0('0x27')]]={'$like':'%'+_0x5f4673[_0xfdd0('0x2f')][_0xfdd0('0x39')]+'%'};return _0x2c2a53;}})});}_0x3fc957=_['merge']({},_0x3fc957,_0x5f4673[_0xfdd0('0x3d')]);var _0x35cac5={'where':_0x3fc957['where']};return db['ZohoAccount'][_0xfdd0('0x1f')](_0x35cac5)[_0xfdd0('0x24')](function(_0x54972d){_0x2503da[_0xfdd0('0x1f')]=_0x54972d;if(_0x5f4673[_0xfdd0('0x2f')]['includeAll']){_0x3fc957['include']=[{'all':!![]}];}return db[_0xfdd0('0x2b')][_0xfdd0('0x3e')](_0x3fc957);})[_0xfdd0('0x24')](function(_0x22d0e8){_0x2503da[_0xfdd0('0x3f')]=_0x22d0e8;return _0x2503da;})[_0xfdd0('0x24')](respondWithFilteredResult(_0x5476eb,_0x3fc957))[_0xfdd0('0x40')](handleError(_0x5476eb,null));};exports[_0xfdd0('0x41')]=function(_0x1e6aad,_0xa5c60a){var _0x4078a7={'raw':![],'where':{'id':_0x1e6aad['params']['id']}},_0x3c6add={};_0x3c6add[_0xfdd0('0x2e')]=_['keys'](db[_0xfdd0('0x2b')][_0xfdd0('0x42')]);_0x3c6add[_0xfdd0('0x2f')]=_[_0xfdd0('0x43')](_0x1e6aad[_0xfdd0('0x2f')]);_0x3c6add[_0xfdd0('0x30')]=_[_0xfdd0('0x31')](_0x3c6add[_0xfdd0('0x2e')],_0x3c6add['query']);_0x4078a7[_0xfdd0('0x32')]=_['intersection'](_0x3c6add[_0xfdd0('0x2e')],qs[_0xfdd0('0x33')](_0x1e6aad[_0xfdd0('0x2f')][_0xfdd0('0x33')]));_0x4078a7['attributes']=_0x4078a7[_0xfdd0('0x32')][_0xfdd0('0x34')]?_0x4078a7[_0xfdd0('0x32')]:_0x3c6add[_0xfdd0('0x2e')];if(_0x1e6aad['query'][_0xfdd0('0x44')]){_0x4078a7[_0xfdd0('0x45')]=[{'all':!![]}];}_0x4078a7=_['merge']({},_0x4078a7,_0x1e6aad['options']);return db[_0xfdd0('0x2b')][_0xfdd0('0x46')](_0x4078a7)['then'](handleEntityNotFound(_0xa5c60a,null))[_0xfdd0('0x24')](respondWithResult(_0xa5c60a,null))[_0xfdd0('0x40')](handleError(_0xa5c60a,null));};exports['create']=function(_0x5f1f19,_0xee7a95){return db[_0xfdd0('0x2b')]['create'](_0x5f1f19[_0xfdd0('0x47')],{})[_0xfdd0('0x24')](respondWithResult(_0xee7a95,0xc9))['catch'](handleError(_0xee7a95,null));};exports[_0xfdd0('0x23')]=function(_0xcf2eb6,_0x565271){if(_0xcf2eb6[_0xfdd0('0x47')]['id']){delete _0xcf2eb6[_0xfdd0('0x47')]['id'];}return db[_0xfdd0('0x2b')][_0xfdd0('0x46')]({'where':{'id':_0xcf2eb6[_0xfdd0('0x48')]['id']}})[_0xfdd0('0x24')](handleEntityNotFound(_0x565271,null))[_0xfdd0('0x24')](saveUpdates(_0xcf2eb6[_0xfdd0('0x47')],null))[_0xfdd0('0x24')](respondWithResult(_0x565271,null))['catch'](handleError(_0x565271,null));};exports['destroy']=function(_0x1e935e,_0xb7d730){return db[_0xfdd0('0x2b')][_0xfdd0('0x46')]({'where':{'id':_0x1e935e[_0xfdd0('0x48')]['id']}})[_0xfdd0('0x24')](handleEntityNotFound(_0xb7d730,null))[_0xfdd0('0x24')](removeEntity(_0xb7d730,null))['catch'](handleError(_0xb7d730,null));};exports['getConfigurations']=function(_0x13d786,_0x52f527,_0x56c9f1){var _0x591fde={};var _0x4e79d0={};var _0x24392e;var _0x55cd80;return db['ZohoAccount'][_0xfdd0('0x49')]({'where':{'id':_0x13d786['params']['id']}})['then'](handleEntityNotFound(_0x52f527,null))['then'](function(_0xc679ce){if(_0xc679ce){_0x24392e=_0xc679ce;_0x4e79d0[_0xfdd0('0x2e')]=_['keys'](db[_0xfdd0('0x4a')][_0xfdd0('0x42')]);_0x4e79d0[_0xfdd0('0x2f')]=_['keys'](_0x13d786[_0xfdd0('0x2f')]);_0x4e79d0[_0xfdd0('0x30')]=_['intersection'](_0x4e79d0[_0xfdd0('0x2e')],_0x4e79d0[_0xfdd0('0x2f')]);_0x591fde['attributes']=_[_0xfdd0('0x31')](_0x4e79d0[_0xfdd0('0x2e')],qs[_0xfdd0('0x33')](_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x33')]));_0x591fde['attributes']=_0x591fde[_0xfdd0('0x32')][_0xfdd0('0x34')]?_0x591fde[_0xfdd0('0x32')]:_0x4e79d0['model'];_0x591fde['order']=qs[_0xfdd0('0x38')](_0x13d786[_0xfdd0('0x2f')]['sort']);_0x591fde['where']=qs[_0xfdd0('0x30')](_['pick'](_0x13d786['query'],_0x4e79d0[_0xfdd0('0x30')]));if(_0x13d786['query'][_0xfdd0('0x39')]){_0x591fde[_0xfdd0('0x3a')]=_[_0xfdd0('0x3b')](_0x591fde[_0xfdd0('0x3a')],{'$or':_[_0xfdd0('0x2a')](_0x591fde[_0xfdd0('0x32')],function(_0x12e2fb){var _0x5427e6={};_0x5427e6[_0x12e2fb]={'$like':'%'+_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x39')]+'%'};return _0x5427e6;})});}_0x591fde=_['merge']({},_0x591fde,_0x13d786[_0xfdd0('0x3d')]);return _0x24392e[_0xfdd0('0x4b')](_0x591fde);}})[_0xfdd0('0x24')](function(_0x36fba9){if(_0x36fba9){_0x55cd80=_0x36fba9[_0xfdd0('0x34')];if(!_0x13d786['query'][_0xfdd0('0x35')](_0xfdd0('0x36'))){_0x591fde[_0xfdd0('0x1e')]=qs[_0xfdd0('0x1e')](_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x1e')]);_0x591fde[_0xfdd0('0x1c')]=qs['offset'](_0x13d786[_0xfdd0('0x2f')][_0xfdd0('0x1c')]);}return _0x24392e[_0xfdd0('0x4b')](_0x591fde);}})['then'](function(_0x1814b4){if(_0x1814b4){return _0x1814b4?{'count':_0x55cd80,'rows':_0x1814b4}:null;}})[_0xfdd0('0x24')](respondWithResult(_0x52f527,null))[_0xfdd0('0x40')](handleError(_0x52f527,null));};exports[_0xfdd0('0x4c')]=function(_0x80f8c9,_0x1e8101,_0x3fb766){if(_0x80f8c9[_0xfdd0('0x47')]['id']){delete _0x80f8c9[_0xfdd0('0x47')]['id'];}return db['ZohoAccount'][_0xfdd0('0x49')]({'where':{'id':_0x80f8c9[_0xfdd0('0x48')]['id']}})[_0xfdd0('0x24')](handleEntityNotFound(_0x1e8101,null))[_0xfdd0('0x24')](function(_0x1eb0fb){if(_0x1eb0fb){_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x4d')]=_0x1eb0fb['id'];_0x80f8c9[_0xfdd0('0x47')]['Subjects']=integrations['getSubjects'](_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x4e')],_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x2c')]);_0x80f8c9[_0xfdd0('0x47')]['Descriptions']=integrations[_0xfdd0('0x4f')](_0x80f8c9[_0xfdd0('0x47')]['channel'],_0x80f8c9[_0xfdd0('0x47')][_0xfdd0('0x2c')]);return db[_0xfdd0('0x4a')][_0xfdd0('0x50')](_0x80f8c9['body'],{'include':[{'model':db['ZohoField'],'as':'Subjects'},{'model':db[_0xfdd0('0x51')],'as':_0xfdd0('0x52')}]});}return null;})[_0xfdd0('0x24')](respondWithResult(_0x1e8101,null))['catch'](handleError(_0x1e8101,null));};function getAccessToken(_0x47bcfd){return new Promise(function(_0x426ab5,_0x426631){var _0x306317;switch(_0x47bcfd[_0xfdd0('0x53')]){case'US':_0x306317=_0xfdd0('0x54');break;case'AU':_0x306317=_0xfdd0('0x55');break;case'EU':_0x306317=_0xfdd0('0x56');break;case'IN':_0x306317=_0xfdd0('0x57');break;case'CN':_0x306317=_0xfdd0('0x58');break;default:_0x306317=_0xfdd0('0x56');break;}var _0x3b29a9={'method':'POST','uri':_0x306317+_0xfdd0('0x59'),'qs':{'refresh_token':_0x47bcfd[_0xfdd0('0x5a')],'client_id':_0x47bcfd['clientId'],'client_secret':_0x47bcfd[_0xfdd0('0x5b')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3b29a9)[_0xfdd0('0x24')](function(_0x4fcf0e){if(_0x4fcf0e[_0xfdd0('0x5c')]){_0x426ab5(_0x4fcf0e[_0xfdd0('0x5c')]);}else{_0x426631(_0xfdd0('0x5d'));}})['catch'](function(_0x16125a){_0x426631(_0x16125a);});});}exports[_0xfdd0('0x5e')]=function(_0x1f6477,_0x52f96c,_0xd48a2c){var _0x579d44,_0x402692,_0x2a8fb5,_0x1fb1be,_0x37fd36;return db[_0xfdd0('0x2b')][_0xfdd0('0x49')]({'where':{'id':_0x1f6477[_0xfdd0('0x48')]['id']},'attributes':['id',_0xfdd0('0x5f'),'zone',_0xfdd0('0x60'),_0xfdd0('0x5b'),_0xfdd0('0x61'),_0xfdd0('0x62'),_0xfdd0('0x5a')]})['then'](handleEntityNotFound(_0x52f96c,null))[_0xfdd0('0x24')](function(_0x32aa20){_0x37fd36=_0x32aa20;_0x579d44=_0x37fd36[_0xfdd0('0x5f')];_0x402692=_0x579d44===_0xfdd0('0x63')?'eu':_0xfdd0('0x64');_0x2a8fb5=_0x37fd36[_0xfdd0('0x61')];var _0x806812=_0x2a8fb5[_0xfdd0('0x65')](-0x1);if(_0x806812==='/'||_0x806812==='\x5c'||_0x806812===':'){_0x2a8fb5=_0x2a8fb5[_0xfdd0('0x66')](0x0,_0x2a8fb5[_0xfdd0('0x67')](_0x806812));}if(!_0x37fd36[_0xfdd0('0x5a')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x37fd36);})[_0xfdd0('0x24')](function(_0x3a536f){if(_0x3a536f){return rp({'method':'GET','uri':util[_0xfdd0('0x68')](_0xfdd0('0x69'),_0x402692),'qs':{'module':_0xfdd0('0x6a')},'headers':{'Authorization':_0xfdd0('0x6b')+_0x3a536f},'json':!![]});}})[_0xfdd0('0x24')](function(_0x5dc0c6){if(_0x5dc0c6){if(_0x5dc0c6[_0xfdd0('0x6c')]&&_0x5dc0c6['response']['error']){throw new Error(_0x5dc0c6['response']['error'][_0xfdd0('0x6d')]);}var _0x4a32cb=[];var _0x1822f0=[];var _0x18837b=[_0xfdd0('0x6e'),_0xfdd0('0x6f'),_0xfdd0('0x70'),_0xfdd0('0x71'),_0xfdd0('0x72'),_0xfdd0('0x73'),_0xfdd0('0x74'),_0xfdd0('0x75')];_0x1822f0=_[_0xfdd0('0x76')](_0x5dc0c6[_0xfdd0('0x33')],function(_0x32f675){return _0x18837b[_0xfdd0('0x77')](_0x32f675[_0xfdd0('0x78')]);});for(var _0x2ee689=0x0;_0x2ee689<_0x1822f0[_0xfdd0('0x34')];_0x2ee689++){if(_0x1822f0[_0x2ee689][_0xfdd0('0x79')]===![]){_0x4a32cb[_0xfdd0('0x7a')]({'id':_0x1822f0[_0x2ee689]['id'],'name':_0x1822f0[_0x2ee689][_0xfdd0('0x7b')],'custom':_0x1822f0[_0x2ee689]['custom_field'],'options':_0x1822f0[_0x2ee689]['data_type']===_0xfdd0('0x7c')&&_0x1822f0[_0x2ee689][_0xfdd0('0x7d')][_0xfdd0('0x34')]>-0x1?_[_0xfdd0('0x2a')](_0x1822f0[_0x2ee689]['pick_list_values'],function(_0x249e00){return{'name':_0x249e00,'value':_0x249e00};}):[]});}}return{'count':_0x4a32cb[_0xfdd0('0x34')],'rows':_0x4a32cb};}else{return{'count':0x0,'rows':[]};}})[_0xfdd0('0x24')](respondWithResult(_0x52f96c,null))[_0xfdd0('0x40')](function(_0x50493f){var _0x2ac70e=_0x1f6477[_0xfdd0('0x2f')][_0xfdd0('0x7e')]?0x1f4:_0x50493f['statusCode']||0x1f4;logger['error'](_0xfdd0('0x7f'),_0xfdd0('0x5e'),_0x2ac70e,JSON[_0xfdd0('0x80')](_0x50493f));delete _0x50493f['name'];if(_0x2ac70e===0x191){_0x2ac70e=0x190;}_0x52f96c[_0xfdd0('0x1a')](_0x2ac70e)[_0xfdd0('0x28')](_0x1f6477[_0xfdd0('0x2f')][_0xfdd0('0x7e')]?{'message':_0xfdd0('0x81'),'statusCode':_0x50493f[_0xfdd0('0x82')]}:_0x50493f);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 361ee7e..ea02003 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 _0x3420=['application/x-www-form-urlencoded','then','parse','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','error','https://accounts.zoho.com.cn','authorization_code','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','/oauth/v2/token'];(function(_0x9caaf7,_0x28d693){var _0x5ab53f=function(_0xa974de){while(--_0xa974de){_0x9caaf7['push'](_0x9caaf7['shift']());}};_0x5ab53f(++_0x28d693);}(_0x3420,0x117));var _0x0342=function(_0x308f9b,_0x4ccd27){_0x308f9b=_0x308f9b-0x0;var _0x37847a=_0x3420[_0x308f9b];return _0x37847a;};'use strict';var _=require(_0x0342('0x0'));var util=require(_0x0342('0x1'));var logger=require(_0x0342('0x2'))(_0x0342('0x3'));var moment=require(_0x0342('0x4'));var BPromise=require(_0x0342('0x5'));var rp=require(_0x0342('0x6'));var fs=require('fs');var path=require(_0x0342('0x7'));var rimraf=require('rimraf');var config=require(_0x0342('0x8'));var attributes=require(_0x0342('0x9'));var integrations=require(_0x0342('0xa'));module['exports']=function(_0x4d6496,_0x28e6ca){return _0x4d6496[_0x0342('0xb')]('ZohoAccount',attributes,{'tableName':_0x0342('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5d1fef,_0x17e2e6,_0x57a3e9){if(_0x5d1fef[_0x0342('0xd')](_0x0342('0xe'))||_0x5d1fef['changed'](_0x0342('0xf'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x10'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x11'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x12'))||_0x5d1fef[_0x0342('0xd')](_0x0342('0x13'))){var _0xafda06,_0x5cde04;_0xafda06=_0x5d1fef['serverUrl'];var _0x5c2acf=_0xafda06[_0x0342('0x14')](-0x1);if(_0x5c2acf==='/'||_0x5c2acf==='\x5c'||_0x5c2acf===':'){_0xafda06=_0xafda06[_0x0342('0x15')](0x0,_0xafda06[_0x0342('0x16')](_0x5c2acf));}switch(_0x5d1fef[_0x0342('0xe')]){case'US':_0x5cde04=_0x0342('0x17');break;case'AU':_0x5cde04=_0x0342('0x18');break;case'IN':_0x5cde04=_0x0342('0x19');break;case'CN':_0x5cde04='https://accounts.zoho.com.cn';break;default:_0x5cde04=_0x0342('0x1a');break;}var _0x503ea4={'method':_0x0342('0x1b'),'uri':_0x5cde04+_0x0342('0x1c'),'form':{'grant_type':'authorization_code','client_id':_0x5d1fef['clientId'],'client_secret':_0x5d1fef[_0x0342('0x11')],'redirect_uri':_0x5d1fef[_0x0342('0xf')],'code':_0x5d1fef['code']},'headers':{'Content-Type':_0x0342('0x1d')}};return rp(_0x503ea4)[_0x0342('0x1e')](function(_0xa3a49f){var _0x246775=JSON[_0x0342('0x1f')](_0xa3a49f);if(_0x246775[_0x0342('0x20')]){_0x5d1fef[_0x0342('0x21')]=_0x246775[_0x0342('0x20')];logger[_0x0342('0x22')](util[_0x0342('0x23')](_0x0342('0x24'),_0x5d1fef[_0x0342('0x25')],_0x5d1fef['id']));}else{logger['error'](util[_0x0342('0x23')](_0x0342('0x26'),_0x5d1fef[_0x0342('0x25')],_0x5d1fef['id']),util[_0x0342('0x27')](_0x246775,{'showHidden':![],'depth':null}));}return _0x57a3e9(null,_0x17e2e6);})[_0x0342('0x28')](function(_0x4c7e4b){logger[_0x0342('0x29')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x5d1fef[_0x0342('0x25')],_0x5d1fef['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x57a3e9(_0x4c7e4b);});}else{return _0x57a3e9(null,_0x17e2e6);}},'beforeUpdate':function(_0x163b81,_0x56a117,_0xf0778){if(_0x163b81[_0x0342('0xd')](_0x0342('0xe'))||_0x163b81[_0x0342('0xd')](_0x0342('0xf'))||_0x163b81[_0x0342('0xd')]('clientId')||_0x163b81['changed']('clientSecret')||_0x163b81[_0x0342('0xd')]('code')||_0x163b81['changed'](_0x0342('0x13'))){var _0x539e0d,_0x30edff;_0x539e0d=_0x163b81[_0x0342('0xf')];var _0x2e269a=_0x539e0d[_0x0342('0x14')](-0x1);if(_0x2e269a==='/'||_0x2e269a==='\x5c'||_0x2e269a===':'){_0x539e0d=_0x539e0d['substring'](0x0,_0x539e0d[_0x0342('0x16')](_0x2e269a));}switch(_0x163b81[_0x0342('0xe')]){case'US':_0x30edff=_0x0342('0x17');break;case'AU':_0x30edff=_0x0342('0x18');break;case'IN':_0x30edff=_0x0342('0x19');break;case'CN':_0x30edff=_0x0342('0x2a');break;default:_0x30edff='https://accounts.zoho.eu';break;}var _0x4ccbac={'method':_0x0342('0x1b'),'uri':_0x30edff+'/oauth/v2/token','form':{'grant_type':_0x0342('0x2b'),'client_id':_0x163b81[_0x0342('0x10')],'client_secret':_0x163b81[_0x0342('0x11')],'redirect_uri':_0x163b81[_0x0342('0xf')],'code':_0x163b81['code']},'headers':{'Content-Type':_0x0342('0x1d')}};return rp(_0x4ccbac)[_0x0342('0x1e')](function(_0x130637){var _0x1935f9=JSON['parse'](_0x130637);if(_0x1935f9[_0x0342('0x20')]){_0x163b81[_0x0342('0x21')]=_0x1935f9[_0x0342('0x20')];logger[_0x0342('0x22')](util[_0x0342('0x23')](_0x0342('0x24'),_0x163b81[_0x0342('0x25')],_0x163b81['id']));}else{logger['error'](util[_0x0342('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x163b81[_0x0342('0x25')],_0x163b81['id']),util['inspect'](_0x1935f9,{'showHidden':![],'depth':null}));}return _0xf0778(null,_0x56a117);})['catch'](function(_0x5714b6){logger[_0x0342('0x29')](util[_0x0342('0x23')](_0x0342('0x26'),_0x163b81[_0x0342('0x25')],_0x163b81['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0xf0778(_0x5714b6);});}else{return _0xf0778(null,_0x56a117);}}}});}; \ No newline at end of file +var _0xda04=['info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','error','lastIndexOf','https://accounts.zoho.com.cn','then','catch','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','slice','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','POST','application/x-www-form-urlencoded','parse','refresh_token','refreshToken'];(function(_0x311c98,_0x42aee0){var _0x27b9d4=function(_0x3074cd){while(--_0x3074cd){_0x311c98['push'](_0x311c98['shift']());}};_0x27b9d4(++_0x42aee0);}(_0xda04,0x185));var _0x4da0=function(_0x3f670b,_0x10f414){_0x3f670b=_0x3f670b-0x0;var _0x1c0978=_0xda04[_0x3f670b];return _0x1c0978;};'use strict';var _=require(_0x4da0('0x0'));var util=require(_0x4da0('0x1'));var logger=require('../../config/logger')(_0x4da0('0x2'));var moment=require(_0x4da0('0x3'));var BPromise=require(_0x4da0('0x4'));var rp=require(_0x4da0('0x5'));var fs=require('fs');var path=require(_0x4da0('0x6'));var rimraf=require(_0x4da0('0x7'));var config=require(_0x4da0('0x8'));var attributes=require(_0x4da0('0x9'));var integrations=require(_0x4da0('0xa'));module[_0x4da0('0xb')]=function(_0x440428,_0x38b09f){return _0x440428['define'](_0x4da0('0xc'),attributes,{'tableName':_0x4da0('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3a933e,_0x406252,_0x5dacfa){if(_0x3a933e[_0x4da0('0xe')](_0x4da0('0xf'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x10'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x11'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x12'))||_0x3a933e[_0x4da0('0xe')](_0x4da0('0x13'))||_0x3a933e['changed']('host')){var _0x199424,_0x28918e;_0x199424=_0x3a933e[_0x4da0('0x10')];var _0x109d6b=_0x199424[_0x4da0('0x14')](-0x1);if(_0x109d6b==='/'||_0x109d6b==='\x5c'||_0x109d6b===':'){_0x199424=_0x199424[_0x4da0('0x15')](0x0,_0x199424['lastIndexOf'](_0x109d6b));}switch(_0x3a933e[_0x4da0('0xf')]){case'US':_0x28918e=_0x4da0('0x16');break;case'AU':_0x28918e=_0x4da0('0x17');break;case'IN':_0x28918e=_0x4da0('0x18');break;case'CN':_0x28918e='https://accounts.zoho.com.cn';break;default:_0x28918e=_0x4da0('0x19');break;}var _0x5a59e6={'method':_0x4da0('0x1a'),'uri':_0x28918e+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x3a933e['clientId'],'client_secret':_0x3a933e[_0x4da0('0x12')],'redirect_uri':_0x3a933e[_0x4da0('0x10')],'code':_0x3a933e['code']},'headers':{'Content-Type':_0x4da0('0x1b')}};return rp(_0x5a59e6)['then'](function(_0x229aed){var _0x3a9808=JSON[_0x4da0('0x1c')](_0x229aed);if(_0x3a9808[_0x4da0('0x1d')]){_0x3a933e[_0x4da0('0x1e')]=_0x3a9808[_0x4da0('0x1d')];logger[_0x4da0('0x1f')](util[_0x4da0('0x20')](_0x4da0('0x21'),_0x3a933e[_0x4da0('0x22')],_0x3a933e['id']));}else{logger['error'](util[_0x4da0('0x20')](_0x4da0('0x23'),_0x3a933e['name'],_0x3a933e['id']),util[_0x4da0('0x24')](_0x3a9808,{'showHidden':![],'depth':null}));}return _0x5dacfa(null,_0x406252);})['catch'](function(_0x54d373){logger[_0x4da0('0x25')](util[_0x4da0('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x3a933e[_0x4da0('0x22')],_0x3a933e['id']),util[_0x4da0('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5dacfa(_0x54d373);});}else{return _0x5dacfa(null,_0x406252);}},'beforeUpdate':function(_0x1fae49,_0x173bec,_0xc09bca){if(_0x1fae49[_0x4da0('0xe')](_0x4da0('0xf'))||_0x1fae49[_0x4da0('0xe')](_0x4da0('0x10'))||_0x1fae49[_0x4da0('0xe')]('clientId')||_0x1fae49['changed']('clientSecret')||_0x1fae49['changed'](_0x4da0('0x13'))||_0x1fae49[_0x4da0('0xe')]('host')){var _0x477c62,_0x2d1393;_0x477c62=_0x1fae49['serverUrl'];var _0x195148=_0x477c62[_0x4da0('0x14')](-0x1);if(_0x195148==='/'||_0x195148==='\x5c'||_0x195148===':'){_0x477c62=_0x477c62['substring'](0x0,_0x477c62[_0x4da0('0x26')](_0x195148));}switch(_0x1fae49['zone']){case'US':_0x2d1393=_0x4da0('0x16');break;case'AU':_0x2d1393=_0x4da0('0x17');break;case'IN':_0x2d1393=_0x4da0('0x18');break;case'CN':_0x2d1393=_0x4da0('0x27');break;default:_0x2d1393=_0x4da0('0x19');break;}var _0x463f34={'method':_0x4da0('0x1a'),'uri':_0x2d1393+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x1fae49[_0x4da0('0x11')],'client_secret':_0x1fae49[_0x4da0('0x12')],'redirect_uri':_0x1fae49[_0x4da0('0x10')],'code':_0x1fae49[_0x4da0('0x13')]},'headers':{'Content-Type':_0x4da0('0x1b')}};return rp(_0x463f34)[_0x4da0('0x28')](function(_0x4aea9c){var _0x30fea0=JSON['parse'](_0x4aea9c);if(_0x30fea0['refresh_token']){_0x1fae49['refreshToken']=_0x30fea0[_0x4da0('0x1d')];logger['info'](util[_0x4da0('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x1fae49[_0x4da0('0x22')],_0x1fae49['id']));}else{logger[_0x4da0('0x25')](util[_0x4da0('0x20')](_0x4da0('0x23'),_0x1fae49[_0x4da0('0x22')],_0x1fae49['id']),util['inspect'](_0x30fea0,{'showHidden':![],'depth':null}));}return _0xc09bca(null,_0x173bec);})[_0x4da0('0x29')](function(_0x3c353a){logger[_0x4da0('0x25')](util[_0x4da0('0x20')](_0x4da0('0x23'),_0x1fae49[_0x4da0('0x22')],_0x1fae49['id']),util[_0x4da0('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0xc09bca(_0x3c353a);});}else{return _0xc09bca(null,_0x173bec);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 83dbd6c..c4e0fc1 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 _0xab54=['where','attributes','limit','include','map','model','then','GetZohoAccount','debug','stringify','ShowZohoAccount','ZohoAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','jayson/promise','client','request','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','findAll','raw','options'];(function(_0x4001ad,_0x1e22dd){var _0x4c7ec2=function(_0x24cb8a){while(--_0x24cb8a){_0x4001ad['push'](_0x4001ad['shift']());}};_0x4c7ec2(++_0x1e22dd);}(_0xab54,0x115));var _0x4ab5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab54[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x4ab5('0x0'));var moment=require(_0x4ab5('0x1'));var BPromise=require(_0x4ab5('0x2'));var rs=require(_0x4ab5('0x3'));var fs=require('fs');var Redis=require(_0x4ab5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4ab5('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x4ab5('0x6'));var client=jayson[_0x4ab5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c39fe,_0x5c8c61,_0x467942){return new BPromise(function(_0x600112,_0xd57886){return client[_0x4ab5('0x8')](_0x2c39fe,_0x467942)['then'](function(_0x58e6a7){logger['info'](_0x4ab5('0x9'),_0x5c8c61,_0x4ab5('0xa'));logger['debug'](_0x4ab5('0xb'),_0x5c8c61,_0x4ab5('0xa'),JSON['stringify'](_0x58e6a7));if(_0x58e6a7[_0x4ab5('0xc')]){if(_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xd')]===0x1f4){logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);return _0xd57886(_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);}logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x58e6a7[_0x4ab5('0xc')][_0x4ab5('0xe')]);return _0x600112(_0x58e6a7[_0x4ab5('0xc')]['message']);}else{logger[_0x4ab5('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x5c8c61,_0x4ab5('0xa'));_0x600112(_0x58e6a7['result']['message']);}})[_0x4ab5('0x10')](function(_0x1b1ca5){logger[_0x4ab5('0xc')](_0x4ab5('0x9'),_0x5c8c61,_0x1b1ca5);_0xd57886(_0x1b1ca5);});});}exports['GetZohoAccount']=function(_0x151ec6){var _0x3f46c1=this;return new Promise(function(_0x4b60c1,_0x4acebb){return db['ZohoAccount'][_0x4ab5('0x11')]({'raw':_0x151ec6['options']?_0x151ec6['options'][_0x4ab5('0x12')]===undefined?!![]:![]:!![],'where':_0x151ec6[_0x4ab5('0x13')]?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x14')]||null:null,'attributes':_0x151ec6[_0x4ab5('0x13')]?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x15')]||null:null,'limit':_0x151ec6['options']?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x16')]||null:null,'include':_0x151ec6[_0x4ab5('0x13')]?_0x151ec6[_0x4ab5('0x13')][_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x151ec6['options'][_0x4ab5('0x17')],function(_0x5af3df){return{'model':db[_0x5af3df[_0x4ab5('0x19')]],'as':_0x5af3df['as'],'attributes':_0x5af3df[_0x4ab5('0x15')],'include':_0x5af3df[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x5af3df[_0x4ab5('0x17')],function(_0x231945){return{'model':db[_0x231945[_0x4ab5('0x19')]],'as':_0x231945['as'],'attributes':_0x231945[_0x4ab5('0x15')],'include':_0x231945[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x231945['include'],function(_0x1a5b9c){return{'model':db[_0x1a5b9c[_0x4ab5('0x19')]],'as':_0x1a5b9c['as'],'attributes':_0x1a5b9c[_0x4ab5('0x15')]};}):[]};}):[]};}):[]:[]})[_0x4ab5('0x1a')](function(_0x1c3a2e){logger[_0x4ab5('0xf')](_0x4ab5('0x1b'),_0x151ec6);logger[_0x4ab5('0x1c')](_0x4ab5('0x1b'),_0x151ec6,JSON[_0x4ab5('0x1d')](_0x1c3a2e));_0x4b60c1(_0x1c3a2e);})[_0x4ab5('0x10')](function(_0x19a1f8){logger[_0x4ab5('0xc')](_0x4ab5('0x1b'),_0x19a1f8['message'],_0x151ec6);_0x4acebb(_0x3f46c1[_0x4ab5('0xc')](0x1f4,_0x19a1f8[_0x4ab5('0xe')]));});});};exports[_0x4ab5('0x1e')]=function(_0x513a4f){var _0x5568e9=this;return new Promise(function(_0x3c0b72,_0xb507a7){return db[_0x4ab5('0x1f')][_0x4ab5('0x20')]({'raw':_0x513a4f['options']?_0x513a4f[_0x4ab5('0x13')][_0x4ab5('0x12')]===undefined?!![]:![]:!![],'where':_0x513a4f['options']?_0x513a4f[_0x4ab5('0x13')][_0x4ab5('0x14')]||null:null,'attributes':_0x513a4f[_0x4ab5('0x13')]?_0x513a4f['options'][_0x4ab5('0x15')]||null:null,'include':_0x513a4f[_0x4ab5('0x13')]?_0x513a4f[_0x4ab5('0x13')]['include']?_[_0x4ab5('0x18')](_0x513a4f['options'][_0x4ab5('0x17')],function(_0x4da284){return{'model':db[_0x4da284[_0x4ab5('0x19')]],'as':_0x4da284['as'],'attributes':_0x4da284[_0x4ab5('0x15')],'include':_0x4da284[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x4da284['include'],function(_0x2ddd58){return{'model':db[_0x2ddd58[_0x4ab5('0x19')]],'as':_0x2ddd58['as'],'attributes':_0x2ddd58['attributes'],'include':_0x2ddd58[_0x4ab5('0x17')]?_[_0x4ab5('0x18')](_0x2ddd58[_0x4ab5('0x17')],function(_0x1172e5){return{'model':db[_0x1172e5[_0x4ab5('0x19')]],'as':_0x1172e5['as'],'attributes':_0x1172e5[_0x4ab5('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8d74a){logger[_0x4ab5('0xf')](_0x4ab5('0x1e'),_0x513a4f);logger['debug'](_0x4ab5('0x1e'),_0x513a4f,JSON[_0x4ab5('0x1d')](_0x8d74a));_0x3c0b72(_0x8d74a);})[_0x4ab5('0x10')](function(_0x411c9f){logger[_0x4ab5('0xc')](_0x4ab5('0x1e'),_0x411c9f[_0x4ab5('0xe')],_0x513a4f);_0xb507a7(_0x5568e9[_0x4ab5('0xc')](0x1f4,_0x411c9f['message']));});});}; \ No newline at end of file +var _0xa3eb=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoAccount,\x20%s,\x20%s','message','result','GetZohoAccount','ZohoAccount','findAll','options','raw','where','include','map','model','attributes','catch','ShowZohoAccount','find','lodash'];(function(_0x2ff756,_0x44d619){var _0x186ae0=function(_0x303db3){while(--_0x303db3){_0x2ff756['push'](_0x2ff756['shift']());}};_0x186ae0(++_0x44d619);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa3eb[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0xba3e('0x0'));var util=require(_0xba3e('0x1'));var moment=require(_0xba3e('0x2'));var BPromise=require('bluebird');var rs=require(_0xba3e('0x3'));var fs=require('fs');var Redis=require(_0xba3e('0x4'));var db=require(_0xba3e('0x5'))['db'];var utils=require(_0xba3e('0x6'));var logger=require(_0xba3e('0x7'))(_0xba3e('0x8'));var config=require(_0xba3e('0x9'));var jayson=require(_0xba3e('0xa'));var client=jayson[_0xba3e('0xb')][_0xba3e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xf24b63,_0x426127,_0x3d1403){return new BPromise(function(_0xd7ea8d,_0x2e8339){return client[_0xba3e('0xd')](_0xf24b63,_0x3d1403)[_0xba3e('0xe')](function(_0x1722bc){logger[_0xba3e('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x426127,_0xba3e('0x10'));logger[_0xba3e('0x11')](_0xba3e('0x12'),_0x426127,'request\x20sent',JSON[_0xba3e('0x13')](_0x1722bc));if(_0x1722bc[_0xba3e('0x14')]){if(_0x1722bc[_0xba3e('0x14')][_0xba3e('0x15')]===0x1f4){logger[_0xba3e('0x14')](_0xba3e('0x16'),_0x426127,_0x1722bc[_0xba3e('0x14')][_0xba3e('0x17')]);return _0x2e8339(_0x1722bc['error']['message']);}logger[_0xba3e('0x14')](_0xba3e('0x16'),_0x426127,_0x1722bc[_0xba3e('0x14')]['message']);return _0xd7ea8d(_0x1722bc[_0xba3e('0x14')][_0xba3e('0x17')]);}else{logger['info'](_0xba3e('0x16'),_0x426127,_0xba3e('0x10'));_0xd7ea8d(_0x1722bc[_0xba3e('0x18')]['message']);}})['catch'](function(_0x3e0b33){logger['error'](_0xba3e('0x16'),_0x426127,_0x3e0b33);_0x2e8339(_0x3e0b33);});});}exports[_0xba3e('0x19')]=function(_0x37c8c9){var _0x37b74b=this;return new Promise(function(_0x241606,_0xca50ea){return db[_0xba3e('0x1a')][_0xba3e('0x1b')]({'raw':_0x37c8c9['options']?_0x37c8c9[_0xba3e('0x1c')][_0xba3e('0x1d')]===undefined?!![]:![]:!![],'where':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')][_0xba3e('0x1e')]||null:null,'attributes':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')]['attributes']||null:null,'limit':_0x37c8c9[_0xba3e('0x1c')]?_0x37c8c9[_0xba3e('0x1c')]['limit']||null:null,'include':_0x37c8c9['options']?_0x37c8c9['options'][_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x37c8c9['options'][_0xba3e('0x1f')],function(_0x570fc9){return{'model':db[_0x570fc9[_0xba3e('0x21')]],'as':_0x570fc9['as'],'attributes':_0x570fc9[_0xba3e('0x22')],'include':_0x570fc9[_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x570fc9[_0xba3e('0x1f')],function(_0x4190ab){return{'model':db[_0x4190ab[_0xba3e('0x21')]],'as':_0x4190ab['as'],'attributes':_0x4190ab[_0xba3e('0x22')],'include':_0x4190ab[_0xba3e('0x1f')]?_[_0xba3e('0x20')](_0x4190ab[_0xba3e('0x1f')],function(_0xbb2a3c){return{'model':db[_0xbb2a3c['model']],'as':_0xbb2a3c['as'],'attributes':_0xbb2a3c[_0xba3e('0x22')]};}):[]};}):[]};}):[]:[]})[_0xba3e('0xe')](function(_0x303e30){logger['info'](_0xba3e('0x19'),_0x37c8c9);logger['debug']('GetZohoAccount',_0x37c8c9,JSON[_0xba3e('0x13')](_0x303e30));_0x241606(_0x303e30);})[_0xba3e('0x23')](function(_0x26a025){logger['error'](_0xba3e('0x19'),_0x26a025[_0xba3e('0x17')],_0x37c8c9);_0xca50ea(_0x37b74b[_0xba3e('0x14')](0x1f4,_0x26a025[_0xba3e('0x17')]));});});};exports[_0xba3e('0x24')]=function(_0x21055e){var _0x1cef69=this;return new Promise(function(_0x6f0abb,_0x266041){return db[_0xba3e('0x1a')][_0xba3e('0x25')]({'raw':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')][_0xba3e('0x1e')]||null:null,'attributes':_0x21055e['options']?_0x21055e[_0xba3e('0x1c')]['attributes']||null:null,'include':_0x21055e[_0xba3e('0x1c')]?_0x21055e[_0xba3e('0x1c')]['include']?_[_0xba3e('0x20')](_0x21055e[_0xba3e('0x1c')][_0xba3e('0x1f')],function(_0x11d5f5){return{'model':db[_0x11d5f5['model']],'as':_0x11d5f5['as'],'attributes':_0x11d5f5[_0xba3e('0x22')],'include':_0x11d5f5['include']?_['map'](_0x11d5f5['include'],function(_0x2ff97f){return{'model':db[_0x2ff97f['model']],'as':_0x2ff97f['as'],'attributes':_0x2ff97f[_0xba3e('0x22')],'include':_0x2ff97f['include']?_['map'](_0x2ff97f['include'],function(_0x273eb8){return{'model':db[_0x273eb8['model']],'as':_0x273eb8['as'],'attributes':_0x273eb8['attributes']};}):[]};}):[]};}):[]:[]})[_0xba3e('0xe')](function(_0x68fe9){logger[_0xba3e('0xf')]('ShowZohoAccount',_0x21055e);logger[_0xba3e('0x11')](_0xba3e('0x24'),_0x21055e,JSON['stringify'](_0x68fe9));_0x6f0abb(_0x68fe9);})[_0xba3e('0x23')](function(_0x32c49a){logger[_0xba3e('0x14')](_0xba3e('0x24'),_0x32c49a[_0xba3e('0x17')],_0x21055e);_0x266041(_0x1cef69[_0xba3e('0x14')](0x1f4,_0x32c49a[_0xba3e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 9526194..b16e7bb 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 _0x5ddb=['post','create','update','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','index','/:id','isAuthenticated','show','getFields','/:id/subjects','getSubjects','getDescriptions'];(function(_0x42ab33,_0x49fee9){var _0x216734=function(_0x5abe20){while(--_0x5abe20){_0x42ab33['push'](_0x42ab33['shift']());}};_0x216734(++_0x49fee9);}(_0x5ddb,0xf7));var _0xb5dd=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x5ddb[_0xbd08b4];return _0x314f1e;};'use strict';var multer=require('multer');var util=require(_0xb5dd('0x0'));var path=require('path');var timeout=require(_0xb5dd('0x1'));var express=require(_0xb5dd('0x2'));var router=express[_0xb5dd('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb5dd('0x4'));var interaction=require(_0xb5dd('0x5'));var config=require(_0xb5dd('0x6'));var controller=require(_0xb5dd('0x7'));router[_0xb5dd('0x8')]('/',auth['isAuthenticated'](),controller[_0xb5dd('0x9')]);router['get'](_0xb5dd('0xa'),auth[_0xb5dd('0xb')](),controller[_0xb5dd('0xc')]);router[_0xb5dd('0x8')]('/:id/fields',auth[_0xb5dd('0xb')](),controller[_0xb5dd('0xd')]);router[_0xb5dd('0x8')](_0xb5dd('0xe'),auth[_0xb5dd('0xb')](),controller[_0xb5dd('0xf')]);router[_0xb5dd('0x8')]('/:id/descriptions',auth[_0xb5dd('0xb')](),controller[_0xb5dd('0x10')]);router[_0xb5dd('0x11')]('/',auth['isAuthenticated'](),controller[_0xb5dd('0x12')]);router['put']('/:id',auth[_0xb5dd('0xb')](),controller[_0xb5dd('0x13')]);router['delete'](_0xb5dd('0xa'),auth[_0xb5dd('0xb')](),controller[_0xb5dd('0x14')]);module[_0xb5dd('0x15')]=router; \ No newline at end of file +var _0xaaf4=['getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','/:id','update','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZohoConfiguration.controller','get','isAuthenticated','/:id/fields'];(function(_0x488a2b,_0x184543){var _0x257c60=function(_0x1ee98c){while(--_0x1ee98c){_0x488a2b['push'](_0x488a2b['shift']());}};_0x257c60(++_0x184543);}(_0xaaf4,0x8f));var _0x4aaf=function(_0x12f4dd,_0x4533fd){_0x12f4dd=_0x12f4dd-0x0;var _0x326e5b=_0xaaf4[_0x12f4dd];return _0x326e5b;};'use strict';var multer=require(_0x4aaf('0x0'));var util=require('util');var path=require(_0x4aaf('0x1'));var timeout=require('connect-timeout');var express=require(_0x4aaf('0x2'));var router=express[_0x4aaf('0x3')]();var fs_extra=require(_0x4aaf('0x4'));var auth=require(_0x4aaf('0x5'));var interaction=require(_0x4aaf('0x6'));var config=require('../../config/environment');var controller=require(_0x4aaf('0x7'));router[_0x4aaf('0x8')]('/',auth[_0x4aaf('0x9')](),controller['index']);router[_0x4aaf('0x8')]('/:id',auth[_0x4aaf('0x9')](),controller['show']);router[_0x4aaf('0x8')](_0x4aaf('0xa'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0xb')]);router[_0x4aaf('0x8')](_0x4aaf('0xc'),auth['isAuthenticated'](),controller[_0x4aaf('0xd')]);router['get'](_0x4aaf('0xe'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0xf')]);router[_0x4aaf('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4aaf('0x11')](_0x4aaf('0x12'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0x13')]);router['delete'](_0x4aaf('0x12'),auth[_0x4aaf('0x9')](),controller[_0x4aaf('0x14')]);module[_0x4aaf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 64714d3..98ddb0b 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 _0x30cb=['ENUM','lead','contact','nothing','sequelize','exports','STRING'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x30cb,0x1c4));var _0xb30c=function(_0xffa1cd,_0x533c8c){_0xffa1cd=_0xffa1cd-0x0;var _0x231e13=_0x30cb[_0xffa1cd];return _0x231e13;};'use strict';var Sequelize=require(_0xb30c('0x0'));module[_0xb30c('0x1')]={'name':{'type':Sequelize[_0xb30c('0x2')]},'moduleCreate':{'type':Sequelize[_0xb30c('0x3')](_0xb30c('0x4'),_0xb30c('0x5'),_0xb30c('0x6')),'defaultValue':_0xb30c('0x4')},'moduleSearch':{'type':Sequelize[_0xb30c('0x3')]('contact_lead','contact',_0xb30c('0x4')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xb30c('0x2')]}}; \ No newline at end of file +var _0xa1f7=['contact','sequelize','STRING','ENUM','lead','nothing','contact_lead'];(function(_0x20778c,_0x9c81a0){var _0x32d193=function(_0x43ece6){while(--_0x43ece6){_0x20778c['push'](_0x20778c['shift']());}};_0x32d193(++_0x9c81a0);}(_0xa1f7,0xda));var _0x7a1f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa1f7[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7a1f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7a1f('0x1')]},'moduleCreate':{'type':Sequelize[_0x7a1f('0x2')](_0x7a1f('0x3'),'contact',_0x7a1f('0x4')),'defaultValue':_0x7a1f('0x3')},'moduleSearch':{'type':Sequelize[_0x7a1f('0x2')](_0x7a1f('0x5'),_0x7a1f('0x6'),_0x7a1f('0x3')),'defaultValue':_0x7a1f('0x5')},'description':{'type':Sequelize[_0x7a1f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 4487a1d..5742739 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 _0xebfc=['catch','show','keys','options','find','create','body','params','destroy','getFields','findOne','ZohoField','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filters','filter','merge','includeAll','include','findAll'];(function(_0x11b3d4,_0x2da6c0){var _0xa1789=function(_0x5f5788){while(--_0x5f5788){_0x11b3d4['push'](_0x11b3d4['shift']());}};_0xa1789(++_0x2da6c0);}(_0xebfc,0x160));var _0xcebf=function(_0x58e469,_0x95ee3e){_0x58e469=_0x58e469-0x0;var _0x4c01c5=_0xebfc[_0x58e469];return _0x4c01c5;};'use strict';var emlformat=require(_0xcebf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcebf('0x1'));var jsonpatch=require(_0xcebf('0x2'));var rp=require('request-promise');var moment=require(_0xcebf('0x3'));var BPromise=require(_0xcebf('0x4'));var Mustache=require(_0xcebf('0x5'));var util=require(_0xcebf('0x6'));var path=require(_0xcebf('0x7'));var sox=require(_0xcebf('0x8'));var csv=require(_0xcebf('0x9'));var ejs=require(_0xcebf('0xa'));var fs=require('fs');var fs_extra=require(_0xcebf('0xb'));var _=require(_0xcebf('0xc'));var squel=require(_0xcebf('0xd'));var crypto=require(_0xcebf('0xe'));var jsforce=require(_0xcebf('0xf'));var deskjs=require(_0xcebf('0x10'));var toCsv=require(_0xcebf('0x9'));var querystring=require(_0xcebf('0x11'));var Papa=require(_0xcebf('0x12'));var Redis=require(_0xcebf('0x13'));var authService=require(_0xcebf('0x14'));var qs=require(_0xcebf('0x15'));var as=require(_0xcebf('0x16'));var hardwareService=require(_0xcebf('0x17'));var logger=require('../../config/logger')(_0xcebf('0x18'));var utils=require(_0xcebf('0x19'));var config=require(_0xcebf('0x1a'));var licenseUtil=require(_0xcebf('0x1b'));var db=require(_0xcebf('0x1c'))['db'];function respondWithStatusCode(_0x1c83c0,_0x413b04){_0x413b04=_0x413b04||0xcc;return function(_0x26da30){if(_0x26da30){return _0x1c83c0['sendStatus'](_0x413b04);}return _0x1c83c0[_0xcebf('0x1d')](_0x413b04)[_0xcebf('0x1e')]();};}function respondWithResult(_0x525a2a,_0x155dc8){_0x155dc8=_0x155dc8||0xc8;return function(_0x16f02f){if(_0x16f02f){return _0x525a2a[_0xcebf('0x1d')](_0x155dc8)[_0xcebf('0x1f')](_0x16f02f);}};}function respondWithFilteredResult(_0x2242d5,_0x8a0fc9){return function(_0x212a69){if(_0x212a69){var _0x29b00f=typeof _0x8a0fc9['offset']===_0xcebf('0x20')&&typeof _0x8a0fc9[_0xcebf('0x21')]===_0xcebf('0x20');var _0x537da6=_0x212a69['count'];var _0x4256b3=_0x29b00f?0x0:_0x8a0fc9['offset'];var _0x1761f7=_0x29b00f?_0x212a69[_0xcebf('0x22')]:_0x8a0fc9[_0xcebf('0x23')]+_0x8a0fc9[_0xcebf('0x21')];var _0x3ee79c;if(_0x1761f7>=_0x537da6){_0x1761f7=_0x537da6;_0x3ee79c=0xc8;}else{_0x3ee79c=0xce;}_0x2242d5['status'](_0x3ee79c);return _0x2242d5[_0xcebf('0x24')](_0xcebf('0x25'),_0x4256b3+'-'+_0x1761f7+'/'+_0x537da6)[_0xcebf('0x1f')](_0x212a69);}return null;};}function patchUpdates(_0x537a1f){return function(_0x1030d5){try{jsonpatch['apply'](_0x1030d5,_0x537a1f,!![]);}catch(_0x2ae8a7){return BPromise[_0xcebf('0x26')](_0x2ae8a7);}return _0x1030d5[_0xcebf('0x27')]();};}function saveUpdates(_0x24b474,_0x31b88c){return function(_0xd052e){if(_0xd052e){return _0xd052e[_0xcebf('0x28')](_0x24b474)[_0xcebf('0x29')](function(_0xcc593b){return _0xcc593b;});}return null;};}function removeEntity(_0x790837,_0x437582){return function(_0x34c086){if(_0x34c086){return _0x34c086['destroy']()[_0xcebf('0x29')](function(){_0x790837['status'](0xcc)[_0xcebf('0x1e')]();});}};}function handleEntityNotFound(_0x2e2ce3,_0xdb1bd){return function(_0x1766ec){if(!_0x1766ec){_0x2e2ce3['sendStatus'](0x194);}return _0x1766ec;};}function handleError(_0x10efd3,_0x2efa01){_0x2efa01=_0x2efa01||0x1f4;return function(_0x5ee935){logger[_0xcebf('0x2a')](_0x5ee935[_0xcebf('0x2b')]);if(_0x5ee935[_0xcebf('0x2c')]){delete _0x5ee935['name'];}_0x10efd3['status'](_0x2efa01)[_0xcebf('0x2d')](_0x5ee935);};}exports[_0xcebf('0x2e')]=function(_0x34bbcc,_0x8f2077){var _0x514974={},_0x34faa9={},_0x22302c={'count':0x0,'rows':[]};var _0x366a86=_[_0xcebf('0x2f')](db[_0xcebf('0x30')][_0xcebf('0x31')],function(_0x348d0f){return{'name':_0x348d0f[_0xcebf('0x32')],'type':_0x348d0f[_0xcebf('0x33')]['key']};});_0x34faa9['model']=_[_0xcebf('0x2f')](_0x366a86,_0xcebf('0x2c'));_0x34faa9['query']=_['keys'](_0x34bbcc[_0xcebf('0x34')]);_0x34faa9['filters']=_[_0xcebf('0x35')](_0x34faa9[_0xcebf('0x36')],_0x34faa9['query']);_0x514974[_0xcebf('0x37')]=_[_0xcebf('0x35')](_0x34faa9[_0xcebf('0x36')],qs[_0xcebf('0x38')](_0x34bbcc[_0xcebf('0x34')][_0xcebf('0x38')]));_0x514974[_0xcebf('0x37')]=_0x514974[_0xcebf('0x37')][_0xcebf('0x39')]?_0x514974[_0xcebf('0x37')]:_0x34faa9[_0xcebf('0x36')];if(!_0x34bbcc[_0xcebf('0x34')]['hasOwnProperty'](_0xcebf('0x3a'))){_0x514974[_0xcebf('0x21')]=qs[_0xcebf('0x21')](_0x34bbcc[_0xcebf('0x34')]['limit']);_0x514974['offset']=qs[_0xcebf('0x23')](_0x34bbcc[_0xcebf('0x34')]['offset']);}_0x514974['order']=qs[_0xcebf('0x3b')](_0x34bbcc[_0xcebf('0x34')][_0xcebf('0x3b')]);_0x514974[_0xcebf('0x3c')]=qs['filters'](_[_0xcebf('0x3d')](_0x34bbcc[_0xcebf('0x34')],_0x34faa9[_0xcebf('0x3e')]),_0x366a86);if(_0x34bbcc['query'][_0xcebf('0x3f')]){_0x514974[_0xcebf('0x3c')]=_[_0xcebf('0x40')](_0x514974[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x366a86,function(_0x2986ff){if(_0x2986ff[_0xcebf('0x33')]!=='VIRTUAL'){var _0x5b3983={};_0x5b3983[_0x2986ff['name']]={'$like':'%'+_0x34bbcc['query']['filter']+'%'};return _0x5b3983;}})});}_0x514974=_[_0xcebf('0x40')]({},_0x514974,_0x34bbcc['options']);var _0x3fb101={'where':_0x514974[_0xcebf('0x3c')]};return db['ZohoConfiguration'][_0xcebf('0x22')](_0x3fb101)[_0xcebf('0x29')](function(_0x27f04e){_0x22302c['count']=_0x27f04e;if(_0x34bbcc[_0xcebf('0x34')][_0xcebf('0x41')]){_0x514974[_0xcebf('0x42')]=[{'all':!![]}];}return db[_0xcebf('0x30')][_0xcebf('0x43')](_0x514974);})[_0xcebf('0x29')](function(_0x181731){_0x22302c['rows']=_0x181731;return _0x22302c;})[_0xcebf('0x29')](respondWithFilteredResult(_0x8f2077,_0x514974))[_0xcebf('0x44')](handleError(_0x8f2077,null));};exports[_0xcebf('0x45')]=function(_0x520a89,_0x1a49ec){var _0x1e7659={'raw':![],'where':{'id':_0x520a89['params']['id']}},_0xfd684={};_0xfd684[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x30')][_0xcebf('0x31')]);_0xfd684[_0xcebf('0x34')]=_[_0xcebf('0x46')](_0x520a89[_0xcebf('0x34')]);_0xfd684[_0xcebf('0x3e')]=_['intersection'](_0xfd684[_0xcebf('0x36')],_0xfd684[_0xcebf('0x34')]);_0x1e7659[_0xcebf('0x37')]=_[_0xcebf('0x35')](_0xfd684[_0xcebf('0x36')],qs['fields'](_0x520a89[_0xcebf('0x34')][_0xcebf('0x38')]));_0x1e7659[_0xcebf('0x37')]=_0x1e7659[_0xcebf('0x37')]['length']?_0x1e7659[_0xcebf('0x37')]:_0xfd684[_0xcebf('0x36')];if(_0x520a89['query'][_0xcebf('0x41')]){_0x1e7659[_0xcebf('0x42')]=[{'all':!![]}];}_0x1e7659=_[_0xcebf('0x40')]({},_0x1e7659,_0x520a89[_0xcebf('0x47')]);return db[_0xcebf('0x30')][_0xcebf('0x48')](_0x1e7659)[_0xcebf('0x29')](handleEntityNotFound(_0x1a49ec,null))['then'](respondWithResult(_0x1a49ec,null))[_0xcebf('0x44')](handleError(_0x1a49ec,null));};exports[_0xcebf('0x49')]=function(_0x573268,_0x57b38e){return db[_0xcebf('0x30')][_0xcebf('0x49')](_0x573268['body'],{})[_0xcebf('0x29')](respondWithResult(_0x57b38e,0xc9))['catch'](handleError(_0x57b38e,null));};exports[_0xcebf('0x28')]=function(_0x28c501,_0x3257d7){if(_0x28c501[_0xcebf('0x4a')]['id']){delete _0x28c501['body']['id'];}return db[_0xcebf('0x30')][_0xcebf('0x48')]({'where':{'id':_0x28c501[_0xcebf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3257d7,null))[_0xcebf('0x29')](saveUpdates(_0x28c501[_0xcebf('0x4a')],null))[_0xcebf('0x29')](respondWithResult(_0x3257d7,null))[_0xcebf('0x44')](handleError(_0x3257d7,null));};exports[_0xcebf('0x4c')]=function(_0x3a125d,_0x300b72){return db[_0xcebf('0x30')][_0xcebf('0x48')]({'where':{'id':_0x3a125d[_0xcebf('0x4b')]['id']}})['then'](handleEntityNotFound(_0x300b72,null))[_0xcebf('0x29')](removeEntity(_0x300b72,null))['catch'](handleError(_0x300b72,null));};exports[_0xcebf('0x4d')]=function(_0x365988,_0x400fa9,_0x529911){var _0x5909ae={};var _0x176940={};var _0x4dd315;var _0x3d1fff;return db[_0xcebf('0x30')][_0xcebf('0x4e')]({'where':{'id':_0x365988[_0xcebf('0x4b')]['id']}})[_0xcebf('0x29')](handleEntityNotFound(_0x400fa9,null))[_0xcebf('0x29')](function(_0x35e387){if(_0x35e387){_0x4dd315=_0x35e387;_0x176940[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x4f')][_0xcebf('0x31')]);_0x176940['query']=_[_0xcebf('0x46')](_0x365988['query']);_0x176940['filters']=_[_0xcebf('0x35')](_0x176940[_0xcebf('0x36')],_0x176940[_0xcebf('0x34')]);_0x5909ae['attributes']=_[_0xcebf('0x35')](_0x176940[_0xcebf('0x36')],qs[_0xcebf('0x38')](_0x365988['query'][_0xcebf('0x38')]));_0x5909ae[_0xcebf('0x37')]=_0x5909ae[_0xcebf('0x37')][_0xcebf('0x39')]?_0x5909ae[_0xcebf('0x37')]:_0x176940[_0xcebf('0x36')];_0x5909ae[_0xcebf('0x50')]=qs[_0xcebf('0x3b')](_0x365988[_0xcebf('0x34')]['sort']);_0x5909ae['where']=qs[_0xcebf('0x3e')](_[_0xcebf('0x3d')](_0x365988[_0xcebf('0x34')],_0x176940['filters']));if(_0x365988[_0xcebf('0x34')][_0xcebf('0x3f')]){_0x5909ae[_0xcebf('0x3c')]=_[_0xcebf('0x40')](_0x5909ae[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x5909ae[_0xcebf('0x37')],function(_0x5e542a){var _0x6ef62a={};_0x6ef62a[_0x5e542a]={'$like':'%'+_0x365988['query'][_0xcebf('0x3f')]+'%'};return _0x6ef62a;})});}_0x5909ae=_[_0xcebf('0x40')]({},_0x5909ae,_0x365988[_0xcebf('0x47')]);return _0x4dd315['getFields'](_0x5909ae);}})[_0xcebf('0x29')](function(_0x1c831c){if(_0x1c831c){_0x3d1fff=_0x1c831c[_0xcebf('0x39')];if(!_0x365988[_0xcebf('0x34')][_0xcebf('0x51')](_0xcebf('0x3a'))){_0x5909ae[_0xcebf('0x21')]=qs[_0xcebf('0x21')](_0x365988[_0xcebf('0x34')][_0xcebf('0x21')]);_0x5909ae[_0xcebf('0x23')]=qs[_0xcebf('0x23')](_0x365988['query'][_0xcebf('0x23')]);}return _0x4dd315[_0xcebf('0x4d')](_0x5909ae);}})[_0xcebf('0x29')](function(_0x3db4f4){if(_0x3db4f4){return _0x3db4f4?{'count':_0x3d1fff,'rows':_0x3db4f4}:null;}})[_0xcebf('0x29')](respondWithResult(_0x400fa9,null))[_0xcebf('0x44')](handleError(_0x400fa9,null));};exports[_0xcebf('0x52')]=function(_0x467b89,_0x3c7a30,_0x5e52cb){var _0x419da7={};var _0x2b1c65={};var _0x1fde0a;var _0x10d12d;return db[_0xcebf('0x30')]['findOne']({'where':{'id':_0x467b89['params']['id']}})[_0xcebf('0x29')](handleEntityNotFound(_0x3c7a30,null))['then'](function(_0x5a1c5b){if(_0x5a1c5b){_0x1fde0a=_0x5a1c5b;_0x2b1c65[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x4f')][_0xcebf('0x31')]);_0x2b1c65[_0xcebf('0x34')]=_['keys'](_0x467b89['query']);_0x2b1c65['filters']=_['intersection'](_0x2b1c65['model'],_0x2b1c65[_0xcebf('0x34')]);_0x419da7['attributes']=_[_0xcebf('0x35')](_0x2b1c65[_0xcebf('0x36')],qs['fields'](_0x467b89['query'][_0xcebf('0x38')]));_0x419da7[_0xcebf('0x37')]=_0x419da7[_0xcebf('0x37')][_0xcebf('0x39')]?_0x419da7[_0xcebf('0x37')]:_0x2b1c65['model'];_0x419da7[_0xcebf('0x50')]=qs[_0xcebf('0x3b')](_0x467b89[_0xcebf('0x34')][_0xcebf('0x3b')]);_0x419da7[_0xcebf('0x3c')]=qs['filters'](_[_0xcebf('0x3d')](_0x467b89['query'],_0x2b1c65[_0xcebf('0x3e')]));if(_0x467b89['query']['filter']){_0x419da7['where']=_[_0xcebf('0x40')](_0x419da7[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x419da7['attributes'],function(_0x2a3cfc){var _0x42e114={};_0x42e114[_0x2a3cfc]={'$like':'%'+_0x467b89[_0xcebf('0x34')]['filter']+'%'};return _0x42e114;})});}_0x419da7=_[_0xcebf('0x40')]({},_0x419da7,_0x467b89['options']);return _0x1fde0a['getSubjects'](_0x419da7);}})['then'](function(_0x6ab983){if(_0x6ab983){_0x10d12d=_0x6ab983['length'];if(!_0x467b89[_0xcebf('0x34')][_0xcebf('0x51')](_0xcebf('0x3a'))){_0x419da7['limit']=qs[_0xcebf('0x21')](_0x467b89[_0xcebf('0x34')][_0xcebf('0x21')]);_0x419da7['offset']=qs[_0xcebf('0x23')](_0x467b89[_0xcebf('0x34')][_0xcebf('0x23')]);}return _0x1fde0a[_0xcebf('0x52')](_0x419da7);}})[_0xcebf('0x29')](function(_0x56f793){if(_0x56f793){return _0x56f793?{'count':_0x10d12d,'rows':_0x56f793}:null;}})[_0xcebf('0x29')](respondWithResult(_0x3c7a30,null))[_0xcebf('0x44')](handleError(_0x3c7a30,null));};exports[_0xcebf('0x53')]=function(_0x2c1490,_0x441754,_0x30dac6){var _0x49224d={};var _0xff3b92={};var _0x4e19d2;var _0x136052;return db['ZohoConfiguration'][_0xcebf('0x4e')]({'where':{'id':_0x2c1490[_0xcebf('0x4b')]['id']}})[_0xcebf('0x29')](handleEntityNotFound(_0x441754,null))['then'](function(_0x1f8925){if(_0x1f8925){_0x4e19d2=_0x1f8925;_0xff3b92[_0xcebf('0x36')]=_[_0xcebf('0x46')](db[_0xcebf('0x4f')][_0xcebf('0x31')]);_0xff3b92['query']=_['keys'](_0x2c1490[_0xcebf('0x34')]);_0xff3b92[_0xcebf('0x3e')]=_[_0xcebf('0x35')](_0xff3b92[_0xcebf('0x36')],_0xff3b92[_0xcebf('0x34')]);_0x49224d['attributes']=_[_0xcebf('0x35')](_0xff3b92[_0xcebf('0x36')],qs[_0xcebf('0x38')](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x38')]));_0x49224d[_0xcebf('0x37')]=_0x49224d['attributes']['length']?_0x49224d[_0xcebf('0x37')]:_0xff3b92[_0xcebf('0x36')];_0x49224d['order']=qs[_0xcebf('0x3b')](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x3b')]);_0x49224d[_0xcebf('0x3c')]=qs[_0xcebf('0x3e')](_['pick'](_0x2c1490[_0xcebf('0x34')],_0xff3b92['filters']));if(_0x2c1490[_0xcebf('0x34')][_0xcebf('0x3f')]){_0x49224d[_0xcebf('0x3c')]=_['merge'](_0x49224d[_0xcebf('0x3c')],{'$or':_[_0xcebf('0x2f')](_0x49224d['attributes'],function(_0x3235a3){var _0x238328={};_0x238328[_0x3235a3]={'$like':'%'+_0x2c1490[_0xcebf('0x34')][_0xcebf('0x3f')]+'%'};return _0x238328;})});}_0x49224d=_[_0xcebf('0x40')]({},_0x49224d,_0x2c1490[_0xcebf('0x47')]);return _0x4e19d2[_0xcebf('0x53')](_0x49224d);}})[_0xcebf('0x29')](function(_0x22e3e5){if(_0x22e3e5){_0x136052=_0x22e3e5[_0xcebf('0x39')];if(!_0x2c1490['query'][_0xcebf('0x51')](_0xcebf('0x3a'))){_0x49224d['limit']=qs[_0xcebf('0x21')](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x21')]);_0x49224d['offset']=qs['offset'](_0x2c1490[_0xcebf('0x34')][_0xcebf('0x23')]);}return _0x4e19d2[_0xcebf('0x53')](_0x49224d);}})['then'](function(_0x43f530){if(_0x43f530){return _0x43f530?{'count':_0x136052,'rows':_0x43f530}:null;}})[_0xcebf('0x29')](respondWithResult(_0x441754,null))['catch'](handleError(_0x441754,null));}; \ No newline at end of file +var _0xfbf3=['findAll','rows','catch','show','params','keys','options','find','create','body','destroy','getFields','findOne','length','sort','pick','hasOwnProperty','nolimit','getSubjects','getDescriptions','ZohoField','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','index','map','ZohoConfiguration','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','order','where','filter','merge','VIRTUAL','includeAll'];(function(_0x158d17,_0x46bc33){var _0x5a0ffd=function(_0x454345){while(--_0x454345){_0x158d17['push'](_0x158d17['shift']());}};_0x5a0ffd(++_0x46bc33);}(_0xfbf3,0x1ef));var _0x3fbf=function(_0x18d833,_0x554ddc){_0x18d833=_0x18d833-0x0;var _0xed0c80=_0xfbf3[_0x18d833];return _0xed0c80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fbf('0x0'));var zipdir=require(_0x3fbf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3fbf('0x2'));var moment=require('moment');var BPromise=require(_0x3fbf('0x3'));var Mustache=require(_0x3fbf('0x4'));var util=require(_0x3fbf('0x5'));var path=require(_0x3fbf('0x6'));var sox=require(_0x3fbf('0x7'));var csv=require(_0x3fbf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3fbf('0x9'));var squel=require(_0x3fbf('0xa'));var crypto=require(_0x3fbf('0xb'));var jsforce=require(_0x3fbf('0xc'));var deskjs=require(_0x3fbf('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3fbf('0xe'));var Redis=require('ioredis');var authService=require(_0x3fbf('0xf'));var qs=require(_0x3fbf('0x10'));var as=require(_0x3fbf('0x11'));var hardwareService=require(_0x3fbf('0x12'));var logger=require(_0x3fbf('0x13'))(_0x3fbf('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3fbf('0x15'));var db=require(_0x3fbf('0x16'))['db'];function respondWithStatusCode(_0x373e3a,_0x1fefa1){_0x1fefa1=_0x1fefa1||0xcc;return function(_0x5cdfdd){if(_0x5cdfdd){return _0x373e3a[_0x3fbf('0x17')](_0x1fefa1);}return _0x373e3a[_0x3fbf('0x18')](_0x1fefa1)[_0x3fbf('0x19')]();};}function respondWithResult(_0x5791b7,_0x57fe8a){_0x57fe8a=_0x57fe8a||0xc8;return function(_0xf8d092){if(_0xf8d092){return _0x5791b7[_0x3fbf('0x18')](_0x57fe8a)[_0x3fbf('0x1a')](_0xf8d092);}};}function respondWithFilteredResult(_0x1c7675,_0x1f1501){return function(_0x4a59ab){if(_0x4a59ab){var _0x3a577c=typeof _0x1f1501[_0x3fbf('0x1b')]===_0x3fbf('0x1c')&&typeof _0x1f1501[_0x3fbf('0x1d')]===_0x3fbf('0x1c');var _0x34cfdb=_0x4a59ab['count'];var _0x5d06f4=_0x3a577c?0x0:_0x1f1501[_0x3fbf('0x1b')];var _0x15b627=_0x3a577c?_0x4a59ab[_0x3fbf('0x1e')]:_0x1f1501['offset']+_0x1f1501[_0x3fbf('0x1d')];var _0x5f3221;if(_0x15b627>=_0x34cfdb){_0x15b627=_0x34cfdb;_0x5f3221=0xc8;}else{_0x5f3221=0xce;}_0x1c7675[_0x3fbf('0x18')](_0x5f3221);return _0x1c7675[_0x3fbf('0x1f')](_0x3fbf('0x20'),_0x5d06f4+'-'+_0x15b627+'/'+_0x34cfdb)[_0x3fbf('0x1a')](_0x4a59ab);}return null;};}function patchUpdates(_0x354b0d){return function(_0x26c0b1){try{jsonpatch[_0x3fbf('0x21')](_0x26c0b1,_0x354b0d,!![]);}catch(_0x4dc720){return BPromise[_0x3fbf('0x22')](_0x4dc720);}return _0x26c0b1[_0x3fbf('0x23')]();};}function saveUpdates(_0x58ca83,_0x622c97){return function(_0x2b4f03){if(_0x2b4f03){return _0x2b4f03[_0x3fbf('0x24')](_0x58ca83)[_0x3fbf('0x25')](function(_0x4369a0){return _0x4369a0;});}return null;};}function removeEntity(_0x1c4ee7,_0x28bec1){return function(_0x347148){if(_0x347148){return _0x347148['destroy']()[_0x3fbf('0x25')](function(){_0x1c4ee7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31ff72,_0x4f9fcc){return function(_0x33f89a){if(!_0x33f89a){_0x31ff72[_0x3fbf('0x17')](0x194);}return _0x33f89a;};}function handleError(_0x5d83d3,_0x30b3d2){_0x30b3d2=_0x30b3d2||0x1f4;return function(_0x1a00b1){logger['error'](_0x1a00b1[_0x3fbf('0x26')]);if(_0x1a00b1[_0x3fbf('0x27')]){delete _0x1a00b1['name'];}_0x5d83d3['status'](_0x30b3d2)['send'](_0x1a00b1);};}exports[_0x3fbf('0x28')]=function(_0x184b0c,_0x483089){var _0x2cb1b3={},_0xb36ca={},_0x25423b={'count':0x0,'rows':[]};var _0x2cae8=_[_0x3fbf('0x29')](db[_0x3fbf('0x2a')][_0x3fbf('0x2b')],function(_0x562d56){return{'name':_0x562d56[_0x3fbf('0x2c')],'type':_0x562d56['type'][_0x3fbf('0x2d')]};});_0xb36ca['model']=_['map'](_0x2cae8,_0x3fbf('0x27'));_0xb36ca[_0x3fbf('0x2e')]=_['keys'](_0x184b0c[_0x3fbf('0x2e')]);_0xb36ca[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0xb36ca[_0x3fbf('0x31')],_0xb36ca[_0x3fbf('0x2e')]);_0x2cb1b3['attributes']=_[_0x3fbf('0x30')](_0xb36ca['model'],qs['fields'](_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x32')]));_0x2cb1b3[_0x3fbf('0x33')]=_0x2cb1b3[_0x3fbf('0x33')]['length']?_0x2cb1b3[_0x3fbf('0x33')]:_0xb36ca[_0x3fbf('0x31')];if(!_0x184b0c[_0x3fbf('0x2e')]['hasOwnProperty']('nolimit')){_0x2cb1b3[_0x3fbf('0x1d')]=qs[_0x3fbf('0x1d')](_0x184b0c['query'][_0x3fbf('0x1d')]);_0x2cb1b3['offset']=qs[_0x3fbf('0x1b')](_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x1b')]);}_0x2cb1b3[_0x3fbf('0x34')]=qs['sort'](_0x184b0c[_0x3fbf('0x2e')]['sort']);_0x2cb1b3[_0x3fbf('0x35')]=qs[_0x3fbf('0x2f')](_['pick'](_0x184b0c['query'],_0xb36ca[_0x3fbf('0x2f')]),_0x2cae8);if(_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x36')]){_0x2cb1b3['where']=_[_0x3fbf('0x37')](_0x2cb1b3[_0x3fbf('0x35')],{'$or':_[_0x3fbf('0x29')](_0x2cae8,function(_0x2f39e6){if(_0x2f39e6['type']!==_0x3fbf('0x38')){var _0x5cd28f={};_0x5cd28f[_0x2f39e6[_0x3fbf('0x27')]]={'$like':'%'+_0x184b0c['query'][_0x3fbf('0x36')]+'%'};return _0x5cd28f;}})});}_0x2cb1b3=_['merge']({},_0x2cb1b3,_0x184b0c['options']);var _0x52c80e={'where':_0x2cb1b3[_0x3fbf('0x35')]};return db[_0x3fbf('0x2a')][_0x3fbf('0x1e')](_0x52c80e)['then'](function(_0x46f5b4){_0x25423b[_0x3fbf('0x1e')]=_0x46f5b4;if(_0x184b0c[_0x3fbf('0x2e')][_0x3fbf('0x39')]){_0x2cb1b3['include']=[{'all':!![]}];}return db[_0x3fbf('0x2a')][_0x3fbf('0x3a')](_0x2cb1b3);})[_0x3fbf('0x25')](function(_0xaf6eb){_0x25423b[_0x3fbf('0x3b')]=_0xaf6eb;return _0x25423b;})[_0x3fbf('0x25')](respondWithFilteredResult(_0x483089,_0x2cb1b3))[_0x3fbf('0x3c')](handleError(_0x483089,null));};exports[_0x3fbf('0x3d')]=function(_0x21dc1f,_0x1408e7){var _0xd755f9={'raw':![],'where':{'id':_0x21dc1f[_0x3fbf('0x3e')]['id']}},_0x1dbe67={};_0x1dbe67[_0x3fbf('0x31')]=_[_0x3fbf('0x3f')](db[_0x3fbf('0x2a')][_0x3fbf('0x2b')]);_0x1dbe67['query']=_[_0x3fbf('0x3f')](_0x21dc1f[_0x3fbf('0x2e')]);_0x1dbe67[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0x1dbe67['model'],_0x1dbe67[_0x3fbf('0x2e')]);_0xd755f9['attributes']=_['intersection'](_0x1dbe67[_0x3fbf('0x31')],qs[_0x3fbf('0x32')](_0x21dc1f[_0x3fbf('0x2e')]['fields']));_0xd755f9[_0x3fbf('0x33')]=_0xd755f9[_0x3fbf('0x33')]['length']?_0xd755f9[_0x3fbf('0x33')]:_0x1dbe67[_0x3fbf('0x31')];if(_0x21dc1f[_0x3fbf('0x2e')][_0x3fbf('0x39')]){_0xd755f9['include']=[{'all':!![]}];}_0xd755f9=_[_0x3fbf('0x37')]({},_0xd755f9,_0x21dc1f[_0x3fbf('0x40')]);return db[_0x3fbf('0x2a')][_0x3fbf('0x41')](_0xd755f9)['then'](handleEntityNotFound(_0x1408e7,null))[_0x3fbf('0x25')](respondWithResult(_0x1408e7,null))[_0x3fbf('0x3c')](handleError(_0x1408e7,null));};exports['create']=function(_0x385866,_0x18644b){return db[_0x3fbf('0x2a')][_0x3fbf('0x42')](_0x385866[_0x3fbf('0x43')],{})[_0x3fbf('0x25')](respondWithResult(_0x18644b,0xc9))[_0x3fbf('0x3c')](handleError(_0x18644b,null));};exports[_0x3fbf('0x24')]=function(_0x1bc56c,_0x2a22a5){if(_0x1bc56c[_0x3fbf('0x43')]['id']){delete _0x1bc56c[_0x3fbf('0x43')]['id'];}return db[_0x3fbf('0x2a')]['find']({'where':{'id':_0x1bc56c[_0x3fbf('0x3e')]['id']}})[_0x3fbf('0x25')](handleEntityNotFound(_0x2a22a5,null))[_0x3fbf('0x25')](saveUpdates(_0x1bc56c[_0x3fbf('0x43')],null))[_0x3fbf('0x25')](respondWithResult(_0x2a22a5,null))[_0x3fbf('0x3c')](handleError(_0x2a22a5,null));};exports[_0x3fbf('0x44')]=function(_0x3dafe0,_0x5a4299){return db['ZohoConfiguration'][_0x3fbf('0x41')]({'where':{'id':_0x3dafe0[_0x3fbf('0x3e')]['id']}})[_0x3fbf('0x25')](handleEntityNotFound(_0x5a4299,null))[_0x3fbf('0x25')](removeEntity(_0x5a4299,null))[_0x3fbf('0x3c')](handleError(_0x5a4299,null));};exports[_0x3fbf('0x45')]=function(_0x194247,_0x1451c5,_0x3ad986){var _0x1f5df2={};var _0x3761e3={};var _0x4c6502;var _0x99f7b2;return db['ZohoConfiguration'][_0x3fbf('0x46')]({'where':{'id':_0x194247[_0x3fbf('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1451c5,null))[_0x3fbf('0x25')](function(_0x1afbed){if(_0x1afbed){_0x4c6502=_0x1afbed;_0x3761e3[_0x3fbf('0x31')]=_['keys'](db['ZohoField']['rawAttributes']);_0x3761e3[_0x3fbf('0x2e')]=_['keys'](_0x194247[_0x3fbf('0x2e')]);_0x3761e3[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0x3761e3[_0x3fbf('0x31')],_0x3761e3[_0x3fbf('0x2e')]);_0x1f5df2[_0x3fbf('0x33')]=_[_0x3fbf('0x30')](_0x3761e3[_0x3fbf('0x31')],qs['fields'](_0x194247['query'][_0x3fbf('0x32')]));_0x1f5df2[_0x3fbf('0x33')]=_0x1f5df2[_0x3fbf('0x33')][_0x3fbf('0x47')]?_0x1f5df2[_0x3fbf('0x33')]:_0x3761e3['model'];_0x1f5df2[_0x3fbf('0x34')]=qs[_0x3fbf('0x48')](_0x194247[_0x3fbf('0x2e')][_0x3fbf('0x48')]);_0x1f5df2[_0x3fbf('0x35')]=qs[_0x3fbf('0x2f')](_[_0x3fbf('0x49')](_0x194247[_0x3fbf('0x2e')],_0x3761e3[_0x3fbf('0x2f')]));if(_0x194247[_0x3fbf('0x2e')]['filter']){_0x1f5df2[_0x3fbf('0x35')]=_[_0x3fbf('0x37')](_0x1f5df2['where'],{'$or':_[_0x3fbf('0x29')](_0x1f5df2[_0x3fbf('0x33')],function(_0x1d7a13){var _0x56399d={};_0x56399d[_0x1d7a13]={'$like':'%'+_0x194247['query'][_0x3fbf('0x36')]+'%'};return _0x56399d;})});}_0x1f5df2=_[_0x3fbf('0x37')]({},_0x1f5df2,_0x194247['options']);return _0x4c6502['getFields'](_0x1f5df2);}})[_0x3fbf('0x25')](function(_0x503b33){if(_0x503b33){_0x99f7b2=_0x503b33['length'];if(!_0x194247[_0x3fbf('0x2e')][_0x3fbf('0x4a')](_0x3fbf('0x4b'))){_0x1f5df2[_0x3fbf('0x1d')]=qs[_0x3fbf('0x1d')](_0x194247['query'][_0x3fbf('0x1d')]);_0x1f5df2[_0x3fbf('0x1b')]=qs[_0x3fbf('0x1b')](_0x194247[_0x3fbf('0x2e')][_0x3fbf('0x1b')]);}return _0x4c6502[_0x3fbf('0x45')](_0x1f5df2);}})[_0x3fbf('0x25')](function(_0x603e3a){if(_0x603e3a){return _0x603e3a?{'count':_0x99f7b2,'rows':_0x603e3a}:null;}})[_0x3fbf('0x25')](respondWithResult(_0x1451c5,null))[_0x3fbf('0x3c')](handleError(_0x1451c5,null));};exports[_0x3fbf('0x4c')]=function(_0x2d86e2,_0x1e8e11,_0x2e8e32){var _0x19a876={};var _0x49c3c4={};var _0x3d6528;var _0x2dfcce;return db[_0x3fbf('0x2a')][_0x3fbf('0x46')]({'where':{'id':_0x2d86e2['params']['id']}})[_0x3fbf('0x25')](handleEntityNotFound(_0x1e8e11,null))['then'](function(_0x9b5e4){if(_0x9b5e4){_0x3d6528=_0x9b5e4;_0x49c3c4[_0x3fbf('0x31')]=_[_0x3fbf('0x3f')](db['ZohoField']['rawAttributes']);_0x49c3c4[_0x3fbf('0x2e')]=_['keys'](_0x2d86e2[_0x3fbf('0x2e')]);_0x49c3c4['filters']=_['intersection'](_0x49c3c4['model'],_0x49c3c4[_0x3fbf('0x2e')]);_0x19a876[_0x3fbf('0x33')]=_[_0x3fbf('0x30')](_0x49c3c4['model'],qs['fields'](_0x2d86e2['query']['fields']));_0x19a876['attributes']=_0x19a876[_0x3fbf('0x33')][_0x3fbf('0x47')]?_0x19a876[_0x3fbf('0x33')]:_0x49c3c4[_0x3fbf('0x31')];_0x19a876[_0x3fbf('0x34')]=qs[_0x3fbf('0x48')](_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x48')]);_0x19a876[_0x3fbf('0x35')]=qs['filters'](_[_0x3fbf('0x49')](_0x2d86e2[_0x3fbf('0x2e')],_0x49c3c4[_0x3fbf('0x2f')]));if(_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x36')]){_0x19a876[_0x3fbf('0x35')]=_[_0x3fbf('0x37')](_0x19a876[_0x3fbf('0x35')],{'$or':_[_0x3fbf('0x29')](_0x19a876[_0x3fbf('0x33')],function(_0x20a26d){var _0x4ca7aa={};_0x4ca7aa[_0x20a26d]={'$like':'%'+_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x36')]+'%'};return _0x4ca7aa;})});}_0x19a876=_[_0x3fbf('0x37')]({},_0x19a876,_0x2d86e2[_0x3fbf('0x40')]);return _0x3d6528['getSubjects'](_0x19a876);}})[_0x3fbf('0x25')](function(_0x2bc4ac){if(_0x2bc4ac){_0x2dfcce=_0x2bc4ac[_0x3fbf('0x47')];if(!_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x4a')](_0x3fbf('0x4b'))){_0x19a876[_0x3fbf('0x1d')]=qs[_0x3fbf('0x1d')](_0x2d86e2[_0x3fbf('0x2e')]['limit']);_0x19a876[_0x3fbf('0x1b')]=qs[_0x3fbf('0x1b')](_0x2d86e2[_0x3fbf('0x2e')][_0x3fbf('0x1b')]);}return _0x3d6528[_0x3fbf('0x4c')](_0x19a876);}})[_0x3fbf('0x25')](function(_0x539809){if(_0x539809){return _0x539809?{'count':_0x2dfcce,'rows':_0x539809}:null;}})[_0x3fbf('0x25')](respondWithResult(_0x1e8e11,null))[_0x3fbf('0x3c')](handleError(_0x1e8e11,null));};exports[_0x3fbf('0x4d')]=function(_0x2b4954,_0x350e8e,_0x25cebe){var _0xb830c9={};var _0xeaf6ea={};var _0x29c93a;var _0x1076f5;return db[_0x3fbf('0x2a')][_0x3fbf('0x46')]({'where':{'id':_0x2b4954['params']['id']}})['then'](handleEntityNotFound(_0x350e8e,null))[_0x3fbf('0x25')](function(_0x3908bb){if(_0x3908bb){_0x29c93a=_0x3908bb;_0xeaf6ea['model']=_['keys'](db[_0x3fbf('0x4e')][_0x3fbf('0x2b')]);_0xeaf6ea[_0x3fbf('0x2e')]=_[_0x3fbf('0x3f')](_0x2b4954[_0x3fbf('0x2e')]);_0xeaf6ea[_0x3fbf('0x2f')]=_[_0x3fbf('0x30')](_0xeaf6ea[_0x3fbf('0x31')],_0xeaf6ea[_0x3fbf('0x2e')]);_0xb830c9['attributes']=_[_0x3fbf('0x30')](_0xeaf6ea[_0x3fbf('0x31')],qs['fields'](_0x2b4954[_0x3fbf('0x2e')][_0x3fbf('0x32')]));_0xb830c9[_0x3fbf('0x33')]=_0xb830c9[_0x3fbf('0x33')][_0x3fbf('0x47')]?_0xb830c9[_0x3fbf('0x33')]:_0xeaf6ea[_0x3fbf('0x31')];_0xb830c9[_0x3fbf('0x34')]=qs[_0x3fbf('0x48')](_0x2b4954[_0x3fbf('0x2e')]['sort']);_0xb830c9[_0x3fbf('0x35')]=qs['filters'](_['pick'](_0x2b4954['query'],_0xeaf6ea[_0x3fbf('0x2f')]));if(_0x2b4954[_0x3fbf('0x2e')][_0x3fbf('0x36')]){_0xb830c9['where']=_[_0x3fbf('0x37')](_0xb830c9[_0x3fbf('0x35')],{'$or':_[_0x3fbf('0x29')](_0xb830c9[_0x3fbf('0x33')],function(_0xe4c571){var _0x52234e={};_0x52234e[_0xe4c571]={'$like':'%'+_0x2b4954[_0x3fbf('0x2e')]['filter']+'%'};return _0x52234e;})});}_0xb830c9=_[_0x3fbf('0x37')]({},_0xb830c9,_0x2b4954['options']);return _0x29c93a[_0x3fbf('0x4d')](_0xb830c9);}})['then'](function(_0x4435c2){if(_0x4435c2){_0x1076f5=_0x4435c2[_0x3fbf('0x47')];if(!_0x2b4954[_0x3fbf('0x2e')][_0x3fbf('0x4a')]('nolimit')){_0xb830c9['limit']=qs[_0x3fbf('0x1d')](_0x2b4954['query'][_0x3fbf('0x1d')]);_0xb830c9['offset']=qs[_0x3fbf('0x1b')](_0x2b4954[_0x3fbf('0x2e')]['offset']);}return _0x29c93a[_0x3fbf('0x4d')](_0xb830c9);}})['then'](function(_0x528806){if(_0x528806){return _0x528806?{'count':_0x1076f5,'rows':_0x528806}:null;}})[_0x3fbf('0x25')](respondWithResult(_0x350e8e,null))['catch'](handleError(_0x350e8e,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ffc0767..7d1dac7 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 _0x1184=['define','ZohoConfiguration','int_zoho_configurations','lodash','util','moment','path','rimraf','../../config/environment'];(function(_0x1c3c87,_0x1c0788){var _0xccf1bf=function(_0x3fcd7f){while(--_0x3fcd7f){_0x1c3c87['push'](_0x1c3c87['shift']());}};_0xccf1bf(++_0x1c0788);}(_0x1184,0x1b3));var _0x4118=function(_0x1e24d3,_0x48bba4){_0x1e24d3=_0x1e24d3-0x0;var _0x136f73=_0x1184[_0x1e24d3];return _0x136f73;};'use strict';var _=require(_0x4118('0x0'));var util=require(_0x4118('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4118('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4118('0x3'));var rimraf=require(_0x4118('0x4'));var config=require(_0x4118('0x5'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x126421,_0x253ab5){return _0x126421[_0x4118('0x6')](_0x4118('0x7'),attributes,{'tableName':_0x4118('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa387=['int_zoho_configurations','lodash','util','api','moment','request-promise','path','../../config/environment','exports','define','ZohoConfiguration'];(function(_0x5336af,_0x3d1cb2){var _0x59b64f=function(_0x204fa6){while(--_0x204fa6){_0x5336af['push'](_0x5336af['shift']());}};_0x59b64f(++_0x3d1cb2);}(_0xa387,0xd2));var _0x7a38=function(_0x5c2829,_0x2e1482){_0x5c2829=_0x5c2829-0x0;var _0x4d6544=_0xa387[_0x5c2829];return _0x4d6544;};'use strict';var _=require(_0x7a38('0x0'));var util=require(_0x7a38('0x1'));var logger=require('../../config/logger')(_0x7a38('0x2'));var moment=require(_0x7a38('0x3'));var BPromise=require('bluebird');var rp=require(_0x7a38('0x4'));var fs=require('fs');var path=require(_0x7a38('0x5'));var rimraf=require('rimraf');var config=require(_0x7a38('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x7a38('0x7')]=function(_0x2abcb0,_0x35b37d){return _0x2abcb0[_0x7a38('0x8')](_0x7a38('0x9'),attributes,{'tableName':_0x7a38('0xa'),'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 b88cb8e..5b66696 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 _0x1844=['client','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x468d1e,_0x259d64){var _0x368e2d=function(_0x2fb327){while(--_0x2fb327){_0x468d1e['push'](_0x468d1e['shift']());}};_0x368e2d(++_0x259d64);}(_0x1844,0xff));var _0x4184=function(_0x2ea356,_0x4c373b){_0x2ea356=_0x2ea356-0x0;var _0x1439d5=_0x1844[_0x2ea356];return _0x1439d5;};'use strict';var _=require(_0x4184('0x0'));var util=require('util');var moment=require(_0x4184('0x1'));var BPromise=require(_0x4184('0x2'));var rs=require(_0x4184('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4184('0x4'))['db'];var utils=require(_0x4184('0x5'));var logger=require(_0x4184('0x6'))(_0x4184('0x7'));var config=require(_0x4184('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4184('0x9')][_0x4184('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346dc4,_0x38ccb7,_0x5bdecf){return new BPromise(function(_0x3a7dc4,_0x2e2394){return client[_0x4184('0xb')](_0x346dc4,_0x5bdecf)[_0x4184('0xc')](function(_0x235bed){logger[_0x4184('0xd')](_0x4184('0xe'),_0x38ccb7,_0x4184('0xf'));logger[_0x4184('0x10')](_0x4184('0x11'),_0x38ccb7,_0x4184('0xf'),JSON[_0x4184('0x12')](_0x235bed));if(_0x235bed['error']){if(_0x235bed['error'][_0x4184('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x38ccb7,_0x235bed[_0x4184('0x14')]['message']);return _0x2e2394(_0x235bed['error']['message']);}logger[_0x4184('0x14')](_0x4184('0xe'),_0x38ccb7,_0x235bed['error'][_0x4184('0x15')]);return _0x3a7dc4(_0x235bed[_0x4184('0x14')][_0x4184('0x15')]);}else{logger[_0x4184('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x38ccb7,_0x4184('0xf'));_0x3a7dc4(_0x235bed[_0x4184('0x16')][_0x4184('0x15')]);}})[_0x4184('0x17')](function(_0x4e72e7){logger[_0x4184('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x38ccb7,_0x4e72e7);_0x2e2394(_0x4e72e7);});});} \ No newline at end of file +var _0x15ba=['message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x5c4e16,_0x113035){var _0x36044a=function(_0xde2f25){while(--_0xde2f25){_0x5c4e16['push'](_0x5c4e16['shift']());}};_0x36044a(++_0x113035);}(_0x15ba,0x120));var _0xa15b=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x15ba[_0xc55d64];return _0x4194f6;};'use strict';var _=require(_0xa15b('0x0'));var util=require(_0xa15b('0x1'));var moment=require(_0xa15b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa15b('0x3'));var db=require(_0xa15b('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa15b('0x5'));var config=require(_0xa15b('0x6'));var jayson=require(_0xa15b('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53e29d,_0x5889f3,_0x1823d){return new BPromise(function(_0x184c90,_0x4c2e6e){return client[_0xa15b('0x8')](_0x53e29d,_0x1823d)[_0xa15b('0x9')](function(_0x360382){logger[_0xa15b('0xa')](_0xa15b('0xb'),_0x5889f3,_0xa15b('0xc'));logger['debug'](_0xa15b('0xd'),_0x5889f3,_0xa15b('0xc'),JSON[_0xa15b('0xe')](_0x360382));if(_0x360382[_0xa15b('0xf')]){if(_0x360382['error']['code']===0x1f4){logger[_0xa15b('0xf')](_0xa15b('0xb'),_0x5889f3,_0x360382['error']['message']);return _0x4c2e6e(_0x360382[_0xa15b('0xf')][_0xa15b('0x10')]);}logger[_0xa15b('0xf')]('ZohoConfiguration,\x20%s,\x20%s',_0x5889f3,_0x360382[_0xa15b('0xf')]['message']);return _0x184c90(_0x360382[_0xa15b('0xf')][_0xa15b('0x10')]);}else{logger[_0xa15b('0xa')](_0xa15b('0xb'),_0x5889f3,_0xa15b('0xc'));_0x184c90(_0x360382[_0xa15b('0x11')]['message']);}})[_0xa15b('0x12')](function(_0x5903c2){logger['error'](_0xa15b('0xb'),_0x5889f3,_0x5903c2);_0x4c2e6e(_0x5903c2);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 4f30c2b..4195b8a 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 _0x51c3=['put','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0x5a30cb,_0x28264b){var _0x3bfaf1=function(_0x280089){while(--_0x280089){_0x5a30cb['push'](_0x5a30cb['shift']());}};_0x3bfaf1(++_0x28264b);}(_0x51c3,0x10d));var _0x351c=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x51c3[_0x1035c1];return _0x308d67;};'use strict';var multer=require(_0x351c('0x0'));var util=require(_0x351c('0x1'));var path=require(_0x351c('0x2'));var timeout=require(_0x351c('0x3'));var express=require(_0x351c('0x4'));var router=express[_0x351c('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x351c('0x6'));var interaction=require(_0x351c('0x7'));var config=require(_0x351c('0x8'));var controller=require(_0x351c('0x9'));router['get']('/',auth[_0x351c('0xa')](),controller[_0x351c('0xb')]);router[_0x351c('0xc')](_0x351c('0xd'),auth['isAuthenticated'](),controller[_0x351c('0xe')]);router['post']('/',auth[_0x351c('0xa')](),controller[_0x351c('0xf')]);router[_0x351c('0x10')](_0x351c('0xd'),auth[_0x351c('0xa')](),controller['update']);router[_0x351c('0x11')](_0x351c('0xd'),auth[_0x351c('0xa')](),controller['destroy']);module[_0x351c('0x12')]=router; \ No newline at end of file +var _0xace4=['isAuthenticated','index','/:id','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xace4,0x184));var _0x4ace=function(_0x5d88c0,_0x5d7d83){_0x5d88c0=_0x5d88c0-0x0;var _0x1b40f0=_0xace4[_0x5d88c0];return _0x1b40f0;};'use strict';var multer=require(_0x4ace('0x0'));var util=require(_0x4ace('0x1'));var path=require(_0x4ace('0x2'));var timeout=require(_0x4ace('0x3'));var express=require('express');var router=express[_0x4ace('0x4')]();var fs_extra=require(_0x4ace('0x5'));var auth=require(_0x4ace('0x6'));var interaction=require(_0x4ace('0x7'));var config=require(_0x4ace('0x8'));var controller=require(_0x4ace('0x9'));router[_0x4ace('0xa')]('/',auth[_0x4ace('0xb')](),controller[_0x4ace('0xc')]);router[_0x4ace('0xa')](_0x4ace('0xd'),auth[_0x4ace('0xb')](),controller['show']);router['post']('/',auth[_0x4ace('0xb')](),controller[_0x4ace('0xe')]);router[_0x4ace('0xf')](_0x4ace('0xd'),auth[_0x4ace('0xb')](),controller[_0x4ace('0x10')]);router[_0x4ace('0x11')]('/:id',auth[_0x4ace('0xb')](),controller[_0x4ace('0x12')]);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 07e035d..7072cbd 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 _0xd496=['variable','BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','STRING'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xd496,0x1cd));var _0x6d49=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd496[_0x166d93];return _0xba708;};'use strict';var Sequelize=require(_0x6d49('0x0'));module[_0x6d49('0x1')]={'type':{'type':Sequelize[_0x6d49('0x2')](_0x6d49('0x3'),'variable',_0x6d49('0x4'),_0x6d49('0x5'),'picklist'),'defaultValue':_0x6d49('0x3')},'content':{'type':Sequelize[_0x6d49('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6d49('0x3'),_0x6d49('0x7'),_0x6d49('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6d49('0x6')]},'nameField':{'type':Sequelize[_0x6d49('0x6')]},'customField':{'type':Sequelize[_0x6d49('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x12fd=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','picklist','STRING'];(function(_0x2dc7c9,_0x3a15f8){var _0x3e6536=function(_0x312829){while(--_0x312829){_0x2dc7c9['push'](_0x2dc7c9['shift']());}};_0x3e6536(++_0x3a15f8);}(_0x12fd,0x77));var _0xd12f=function(_0x19a4ae,_0x354c05){_0x19a4ae=_0x19a4ae-0x0;var _0x26a831=_0x12fd[_0x19a4ae];return _0x26a831;};'use strict';var Sequelize=require(_0xd12f('0x0'));module[_0xd12f('0x1')]={'type':{'type':Sequelize[_0xd12f('0x2')](_0xd12f('0x3'),_0xd12f('0x4'),'customVariable','keyValue',_0xd12f('0x5')),'defaultValue':_0xd12f('0x3')},'content':{'type':Sequelize[_0xd12f('0x6')]},'key':{'type':Sequelize[_0xd12f('0x6')]},'keyType':{'type':Sequelize[_0xd12f('0x2')](_0xd12f('0x3'),_0xd12f('0x4'),_0xd12f('0x7'))},'keyContent':{'type':Sequelize[_0xd12f('0x6')]},'idField':{'type':Sequelize[_0xd12f('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd12f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7940da4..39a098f 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 _0x6946=['sendStatus','status','end','json','undefined','count','offset','limit','set','reject','save','update','then','destroy','error','stack','name','send','index','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','ZohoField','includeAll','findAll','catch','show','params','rawAttributes','include','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x531615,_0x4a3f87){var _0x2bc611=function(_0x1ea05f){while(--_0x1ea05f){_0x531615['push'](_0x531615['shift']());}};_0x2bc611(++_0x4a3f87);}(_0x6946,0x1b3));var _0x6694=function(_0x50889e,_0xeb0acf){_0x50889e=_0x50889e-0x0;var _0x4d59db=_0x6946[_0x50889e];return _0x4d59db;};'use strict';var emlformat=require(_0x6694('0x0'));var rimraf=require(_0x6694('0x1'));var zipdir=require(_0x6694('0x2'));var jsonpatch=require(_0x6694('0x3'));var rp=require(_0x6694('0x4'));var moment=require(_0x6694('0x5'));var BPromise=require(_0x6694('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6694('0x7'));var sox=require(_0x6694('0x8'));var csv=require(_0x6694('0x9'));var ejs=require(_0x6694('0xa'));var fs=require('fs');var fs_extra=require(_0x6694('0xb'));var _=require(_0x6694('0xc'));var squel=require(_0x6694('0xd'));var crypto=require(_0x6694('0xe'));var jsforce=require(_0x6694('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6694('0x10'));var Papa=require(_0x6694('0x11'));var Redis=require(_0x6694('0x12'));var authService=require(_0x6694('0x13'));var qs=require(_0x6694('0x14'));var as=require(_0x6694('0x15'));var hardwareService=require(_0x6694('0x16'));var logger=require('../../config/logger')(_0x6694('0x17'));var utils=require(_0x6694('0x18'));var config=require(_0x6694('0x19'));var licenseUtil=require(_0x6694('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3a0c8a,_0x10d5bb){_0x10d5bb=_0x10d5bb||0xcc;return function(_0x23b640){if(_0x23b640){return _0x3a0c8a[_0x6694('0x1b')](_0x10d5bb);}return _0x3a0c8a[_0x6694('0x1c')](_0x10d5bb)[_0x6694('0x1d')]();};}function respondWithResult(_0x2b22a4,_0x505c3c){_0x505c3c=_0x505c3c||0xc8;return function(_0x1ea340){if(_0x1ea340){return _0x2b22a4[_0x6694('0x1c')](_0x505c3c)[_0x6694('0x1e')](_0x1ea340);}};}function respondWithFilteredResult(_0xc4a4f4,_0x347b0d){return function(_0xbc0b6){if(_0xbc0b6){var _0x413a38=typeof _0x347b0d['offset']===_0x6694('0x1f')&&typeof _0x347b0d['limit']===_0x6694('0x1f');var _0x4b3cdf=_0xbc0b6[_0x6694('0x20')];var _0x4286ad=_0x413a38?0x0:_0x347b0d[_0x6694('0x21')];var _0x394f29=_0x413a38?_0xbc0b6[_0x6694('0x20')]:_0x347b0d[_0x6694('0x21')]+_0x347b0d[_0x6694('0x22')];var _0x53185a;if(_0x394f29>=_0x4b3cdf){_0x394f29=_0x4b3cdf;_0x53185a=0xc8;}else{_0x53185a=0xce;}_0xc4a4f4['status'](_0x53185a);return _0xc4a4f4[_0x6694('0x23')]('Content-Range',_0x4286ad+'-'+_0x394f29+'/'+_0x4b3cdf)[_0x6694('0x1e')](_0xbc0b6);}return null;};}function patchUpdates(_0xab1d7e){return function(_0x516dda){try{jsonpatch['apply'](_0x516dda,_0xab1d7e,!![]);}catch(_0x336883){return BPromise[_0x6694('0x24')](_0x336883);}return _0x516dda[_0x6694('0x25')]();};}function saveUpdates(_0x411009,_0x436a7e){return function(_0x49dfeb){if(_0x49dfeb){return _0x49dfeb[_0x6694('0x26')](_0x411009)[_0x6694('0x27')](function(_0xd65993){return _0xd65993;});}return null;};}function removeEntity(_0x9b6ff9,_0x192a9f){return function(_0x2cb470){if(_0x2cb470){return _0x2cb470[_0x6694('0x28')]()[_0x6694('0x27')](function(){_0x9b6ff9[_0x6694('0x1c')](0xcc)[_0x6694('0x1d')]();});}};}function handleEntityNotFound(_0x569f3d,_0x94b5b2){return function(_0x5f56e6){if(!_0x5f56e6){_0x569f3d[_0x6694('0x1b')](0x194);}return _0x5f56e6;};}function handleError(_0x156765,_0x5542ff){_0x5542ff=_0x5542ff||0x1f4;return function(_0x462ef1){logger[_0x6694('0x29')](_0x462ef1[_0x6694('0x2a')]);if(_0x462ef1[_0x6694('0x2b')]){delete _0x462ef1['name'];}_0x156765[_0x6694('0x1c')](_0x5542ff)[_0x6694('0x2c')](_0x462ef1);};}exports[_0x6694('0x2d')]=function(_0x47ee35,_0x305ab6){var _0x39a067={},_0xf2991d={},_0x1172c7={'count':0x0,'rows':[]};var _0x4e2536=_['map'](db['ZohoField']['rawAttributes'],function(_0x4f8f0b){return{'name':_0x4f8f0b[_0x6694('0x2e')],'type':_0x4f8f0b[_0x6694('0x2f')][_0x6694('0x30')]};});_0xf2991d[_0x6694('0x31')]=_['map'](_0x4e2536,_0x6694('0x2b'));_0xf2991d[_0x6694('0x32')]=_[_0x6694('0x33')](_0x47ee35['query']);_0xf2991d['filters']=_[_0x6694('0x34')](_0xf2991d['model'],_0xf2991d['query']);_0x39a067[_0x6694('0x35')]=_[_0x6694('0x34')](_0xf2991d['model'],qs['fields'](_0x47ee35[_0x6694('0x32')][_0x6694('0x36')]));_0x39a067[_0x6694('0x35')]=_0x39a067[_0x6694('0x35')][_0x6694('0x37')]?_0x39a067['attributes']:_0xf2991d[_0x6694('0x31')];if(!_0x47ee35[_0x6694('0x32')][_0x6694('0x38')](_0x6694('0x39'))){_0x39a067[_0x6694('0x22')]=qs[_0x6694('0x22')](_0x47ee35['query'][_0x6694('0x22')]);_0x39a067[_0x6694('0x21')]=qs[_0x6694('0x21')](_0x47ee35[_0x6694('0x32')]['offset']);}_0x39a067[_0x6694('0x3a')]=qs[_0x6694('0x3b')](_0x47ee35[_0x6694('0x32')]['sort']);_0x39a067[_0x6694('0x3c')]=qs[_0x6694('0x3d')](_[_0x6694('0x3e')](_0x47ee35[_0x6694('0x32')],_0xf2991d[_0x6694('0x3d')]),_0x4e2536);if(_0x47ee35[_0x6694('0x32')]['filter']){_0x39a067[_0x6694('0x3c')]=_[_0x6694('0x3f')](_0x39a067[_0x6694('0x3c')],{'$or':_['map'](_0x4e2536,function(_0x396651){if(_0x396651[_0x6694('0x2f')]!==_0x6694('0x40')){var _0x4a6a52={};_0x4a6a52[_0x396651[_0x6694('0x2b')]]={'$like':'%'+_0x47ee35[_0x6694('0x32')]['filter']+'%'};return _0x4a6a52;}})});}_0x39a067=_[_0x6694('0x3f')]({},_0x39a067,_0x47ee35['options']);var _0x999a71={'where':_0x39a067['where']};return db[_0x6694('0x41')][_0x6694('0x20')](_0x999a71)[_0x6694('0x27')](function(_0x5244ad){_0x1172c7[_0x6694('0x20')]=_0x5244ad;if(_0x47ee35[_0x6694('0x32')][_0x6694('0x42')]){_0x39a067['include']=[{'all':!![]}];}return db[_0x6694('0x41')][_0x6694('0x43')](_0x39a067);})[_0x6694('0x27')](function(_0x309522){_0x1172c7['rows']=_0x309522;return _0x1172c7;})['then'](respondWithFilteredResult(_0x305ab6,_0x39a067))[_0x6694('0x44')](handleError(_0x305ab6,null));};exports[_0x6694('0x45')]=function(_0x2abeb6,_0x26b838){var _0x289e3d={'raw':!![],'where':{'id':_0x2abeb6[_0x6694('0x46')]['id']}},_0x41728f={};_0x41728f['model']=_[_0x6694('0x33')](db[_0x6694('0x41')][_0x6694('0x47')]);_0x41728f['query']=_[_0x6694('0x33')](_0x2abeb6[_0x6694('0x32')]);_0x41728f[_0x6694('0x3d')]=_['intersection'](_0x41728f[_0x6694('0x31')],_0x41728f[_0x6694('0x32')]);_0x289e3d['attributes']=_[_0x6694('0x34')](_0x41728f[_0x6694('0x31')],qs[_0x6694('0x36')](_0x2abeb6[_0x6694('0x32')][_0x6694('0x36')]));_0x289e3d[_0x6694('0x35')]=_0x289e3d[_0x6694('0x35')][_0x6694('0x37')]?_0x289e3d[_0x6694('0x35')]:_0x41728f[_0x6694('0x31')];if(_0x2abeb6[_0x6694('0x32')][_0x6694('0x42')]){_0x289e3d[_0x6694('0x48')]=[{'all':!![]}];}_0x289e3d=_[_0x6694('0x3f')]({},_0x289e3d,_0x2abeb6[_0x6694('0x49')]);return db[_0x6694('0x41')]['find'](_0x289e3d)[_0x6694('0x27')](handleEntityNotFound(_0x26b838,null))[_0x6694('0x27')](respondWithResult(_0x26b838,null))[_0x6694('0x44')](handleError(_0x26b838,null));};exports['create']=function(_0x394dba,_0x4a3103){return db[_0x6694('0x41')][_0x6694('0x4a')](_0x394dba['body'],{})['then'](respondWithResult(_0x4a3103,0xc9))[_0x6694('0x44')](handleError(_0x4a3103,null));};exports[_0x6694('0x26')]=function(_0x107ae3,_0x158599){if(_0x107ae3[_0x6694('0x4b')]['id']){delete _0x107ae3['body']['id'];}return db[_0x6694('0x41')][_0x6694('0x4c')]({'where':{'id':_0x107ae3[_0x6694('0x46')]['id']}})['then'](handleEntityNotFound(_0x158599,null))[_0x6694('0x27')](saveUpdates(_0x107ae3['body'],null))[_0x6694('0x27')](respondWithResult(_0x158599,null))['catch'](handleError(_0x158599,null));};exports['destroy']=function(_0x52ac90,_0x1900f9){return db[_0x6694('0x41')][_0x6694('0x4c')]({'where':{'id':_0x52ac90['params']['id']}})[_0x6694('0x27')](handleEntityNotFound(_0x1900f9,null))['then'](removeEntity(_0x1900f9,null))[_0x6694('0x44')](handleError(_0x1900f9,null));}; \ No newline at end of file +var _0x59ef=['find','create','body','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','sendStatus','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x59ef,0x12b));var _0xf59e=function(_0x4894c7,_0x1bf03f){_0x4894c7=_0x4894c7-0x0;var _0x4d7467=_0x59ef[_0x4894c7];return _0x4d7467;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf59e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf59e('0x1'));var rp=require(_0xf59e('0x2'));var moment=require(_0xf59e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf59e('0x4'));var util=require('util');var path=require(_0xf59e('0x5'));var sox=require(_0xf59e('0x6'));var csv=require(_0xf59e('0x7'));var ejs=require(_0xf59e('0x8'));var fs=require('fs');var fs_extra=require(_0xf59e('0x9'));var _=require(_0xf59e('0xa'));var squel=require(_0xf59e('0xb'));var crypto=require(_0xf59e('0xc'));var jsforce=require(_0xf59e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf59e('0xe'));var Papa=require(_0xf59e('0xf'));var Redis=require(_0xf59e('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf59e('0x11'));var hardwareService=require(_0xf59e('0x12'));var logger=require(_0xf59e('0x13'))(_0xf59e('0x14'));var utils=require(_0xf59e('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf59e('0x16'));var db=require(_0xf59e('0x17'))['db'];function respondWithStatusCode(_0x17f0e6,_0x2013a5){_0x2013a5=_0x2013a5||0xcc;return function(_0x5ce341){if(_0x5ce341){return _0x17f0e6['sendStatus'](_0x2013a5);}return _0x17f0e6[_0xf59e('0x18')](_0x2013a5)[_0xf59e('0x19')]();};}function respondWithResult(_0x483a62,_0x4c1458){_0x4c1458=_0x4c1458||0xc8;return function(_0x5c038a){if(_0x5c038a){return _0x483a62[_0xf59e('0x18')](_0x4c1458)[_0xf59e('0x1a')](_0x5c038a);}};}function respondWithFilteredResult(_0x220b2c,_0x922e7a){return function(_0x29b634){if(_0x29b634){var _0x147d47=typeof _0x922e7a[_0xf59e('0x1b')]===_0xf59e('0x1c')&&typeof _0x922e7a[_0xf59e('0x1d')]===_0xf59e('0x1c');var _0x512a92=_0x29b634[_0xf59e('0x1e')];var _0x1ef305=_0x147d47?0x0:_0x922e7a[_0xf59e('0x1b')];var _0x11c627=_0x147d47?_0x29b634[_0xf59e('0x1e')]:_0x922e7a[_0xf59e('0x1b')]+_0x922e7a[_0xf59e('0x1d')];var _0x28a37a;if(_0x11c627>=_0x512a92){_0x11c627=_0x512a92;_0x28a37a=0xc8;}else{_0x28a37a=0xce;}_0x220b2c[_0xf59e('0x18')](_0x28a37a);return _0x220b2c[_0xf59e('0x1f')](_0xf59e('0x20'),_0x1ef305+'-'+_0x11c627+'/'+_0x512a92)[_0xf59e('0x1a')](_0x29b634);}return null;};}function patchUpdates(_0xfd2a71){return function(_0x3dc645){try{jsonpatch[_0xf59e('0x21')](_0x3dc645,_0xfd2a71,!![]);}catch(_0x4d3918){return BPromise[_0xf59e('0x22')](_0x4d3918);}return _0x3dc645['save']();};}function saveUpdates(_0x4d5acf,_0x33fb45){return function(_0x3108e5){if(_0x3108e5){return _0x3108e5[_0xf59e('0x23')](_0x4d5acf)[_0xf59e('0x24')](function(_0x5c3ea1){return _0x5c3ea1;});}return null;};}function removeEntity(_0x451c0a,_0x3a30ad){return function(_0x470d26){if(_0x470d26){return _0x470d26['destroy']()['then'](function(){_0x451c0a[_0xf59e('0x18')](0xcc)[_0xf59e('0x19')]();});}};}function handleEntityNotFound(_0x4d846c,_0x4afda7){return function(_0x4acf69){if(!_0x4acf69){_0x4d846c[_0xf59e('0x25')](0x194);}return _0x4acf69;};}function handleError(_0x536635,_0x592205){_0x592205=_0x592205||0x1f4;return function(_0x201f92){logger['error'](_0x201f92[_0xf59e('0x26')]);if(_0x201f92[_0xf59e('0x27')]){delete _0x201f92[_0xf59e('0x27')];}_0x536635[_0xf59e('0x18')](_0x592205)[_0xf59e('0x28')](_0x201f92);};}exports['index']=function(_0x59fc37,_0x2b00a4){var _0x40016f={},_0x4099cb={},_0x50beb2={'count':0x0,'rows':[]};var _0x542297=_[_0xf59e('0x29')](db[_0xf59e('0x2a')][_0xf59e('0x2b')],function(_0x2967b4){return{'name':_0x2967b4[_0xf59e('0x2c')],'type':_0x2967b4[_0xf59e('0x2d')][_0xf59e('0x2e')]};});_0x4099cb[_0xf59e('0x2f')]=_['map'](_0x542297,_0xf59e('0x27'));_0x4099cb['query']=_[_0xf59e('0x30')](_0x59fc37['query']);_0x4099cb[_0xf59e('0x31')]=_[_0xf59e('0x32')](_0x4099cb[_0xf59e('0x2f')],_0x4099cb[_0xf59e('0x33')]);_0x40016f[_0xf59e('0x34')]=_[_0xf59e('0x32')](_0x4099cb[_0xf59e('0x2f')],qs['fields'](_0x59fc37['query'][_0xf59e('0x35')]));_0x40016f[_0xf59e('0x34')]=_0x40016f[_0xf59e('0x34')]['length']?_0x40016f[_0xf59e('0x34')]:_0x4099cb[_0xf59e('0x2f')];if(!_0x59fc37[_0xf59e('0x33')][_0xf59e('0x36')](_0xf59e('0x37'))){_0x40016f[_0xf59e('0x1d')]=qs[_0xf59e('0x1d')](_0x59fc37[_0xf59e('0x33')]['limit']);_0x40016f[_0xf59e('0x1b')]=qs[_0xf59e('0x1b')](_0x59fc37[_0xf59e('0x33')]['offset']);}_0x40016f[_0xf59e('0x38')]=qs[_0xf59e('0x39')](_0x59fc37[_0xf59e('0x33')][_0xf59e('0x39')]);_0x40016f[_0xf59e('0x3a')]=qs[_0xf59e('0x31')](_[_0xf59e('0x3b')](_0x59fc37[_0xf59e('0x33')],_0x4099cb['filters']),_0x542297);if(_0x59fc37['query'][_0xf59e('0x3c')]){_0x40016f[_0xf59e('0x3a')]=_[_0xf59e('0x3d')](_0x40016f[_0xf59e('0x3a')],{'$or':_[_0xf59e('0x29')](_0x542297,function(_0x1c702b){if(_0x1c702b['type']!==_0xf59e('0x3e')){var _0x8bf004={};_0x8bf004[_0x1c702b[_0xf59e('0x27')]]={'$like':'%'+_0x59fc37[_0xf59e('0x33')][_0xf59e('0x3c')]+'%'};return _0x8bf004;}})});}_0x40016f=_[_0xf59e('0x3d')]({},_0x40016f,_0x59fc37[_0xf59e('0x3f')]);var _0x4d6b20={'where':_0x40016f[_0xf59e('0x3a')]};return db[_0xf59e('0x2a')][_0xf59e('0x1e')](_0x4d6b20)[_0xf59e('0x24')](function(_0x2b4a69){_0x50beb2['count']=_0x2b4a69;if(_0x59fc37[_0xf59e('0x33')][_0xf59e('0x40')]){_0x40016f[_0xf59e('0x41')]=[{'all':!![]}];}return db[_0xf59e('0x2a')]['findAll'](_0x40016f);})['then'](function(_0x7952db){_0x50beb2[_0xf59e('0x42')]=_0x7952db;return _0x50beb2;})[_0xf59e('0x24')](respondWithFilteredResult(_0x2b00a4,_0x40016f))[_0xf59e('0x43')](handleError(_0x2b00a4,null));};exports[_0xf59e('0x44')]=function(_0x177863,_0xa07349){var _0x406647={'raw':!![],'where':{'id':_0x177863[_0xf59e('0x45')]['id']}},_0x127445={};_0x127445[_0xf59e('0x2f')]=_[_0xf59e('0x30')](db['ZohoField'][_0xf59e('0x2b')]);_0x127445['query']=_[_0xf59e('0x30')](_0x177863[_0xf59e('0x33')]);_0x127445['filters']=_[_0xf59e('0x32')](_0x127445[_0xf59e('0x2f')],_0x127445[_0xf59e('0x33')]);_0x406647['attributes']=_[_0xf59e('0x32')](_0x127445['model'],qs[_0xf59e('0x35')](_0x177863[_0xf59e('0x33')][_0xf59e('0x35')]));_0x406647['attributes']=_0x406647[_0xf59e('0x34')][_0xf59e('0x46')]?_0x406647[_0xf59e('0x34')]:_0x127445[_0xf59e('0x2f')];if(_0x177863[_0xf59e('0x33')][_0xf59e('0x40')]){_0x406647['include']=[{'all':!![]}];}_0x406647=_[_0xf59e('0x3d')]({},_0x406647,_0x177863[_0xf59e('0x3f')]);return db[_0xf59e('0x2a')][_0xf59e('0x47')](_0x406647)[_0xf59e('0x24')](handleEntityNotFound(_0xa07349,null))[_0xf59e('0x24')](respondWithResult(_0xa07349,null))[_0xf59e('0x43')](handleError(_0xa07349,null));};exports[_0xf59e('0x48')]=function(_0x6175c9,_0x26b2b8){return db[_0xf59e('0x2a')][_0xf59e('0x48')](_0x6175c9['body'],{})['then'](respondWithResult(_0x26b2b8,0xc9))[_0xf59e('0x43')](handleError(_0x26b2b8,null));};exports[_0xf59e('0x23')]=function(_0x1c1d5c,_0x2dcb06){if(_0x1c1d5c[_0xf59e('0x49')]['id']){delete _0x1c1d5c['body']['id'];}return db[_0xf59e('0x2a')]['find']({'where':{'id':_0x1c1d5c[_0xf59e('0x45')]['id']}})[_0xf59e('0x24')](handleEntityNotFound(_0x2dcb06,null))['then'](saveUpdates(_0x1c1d5c[_0xf59e('0x49')],null))[_0xf59e('0x24')](respondWithResult(_0x2dcb06,null))[_0xf59e('0x43')](handleError(_0x2dcb06,null));};exports['destroy']=function(_0x2730b3,_0x408570){return db[_0xf59e('0x2a')][_0xf59e('0x47')]({'where':{'id':_0x2730b3[_0xf59e('0x45')]['id']}})[_0xf59e('0x24')](handleEntityNotFound(_0x408570,null))[_0xf59e('0x24')](removeEntity(_0x408570,null))[_0xf59e('0x43')](handleError(_0x408570,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index b6a329b..5d895a3 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 _0x6455=['moment','bluebird','request-promise','path','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','FieldId','lodash','../../config/logger','api'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x6455,0x97));var _0x5645=function(_0x1ae447,_0x587a9b){_0x1ae447=_0x1ae447-0x0;var _0x18e1cb=_0x6455[_0x1ae447];return _0x18e1cb;};'use strict';var _=require(_0x5645('0x0'));var util=require('util');var logger=require(_0x5645('0x1'))(_0x5645('0x2'));var moment=require(_0x5645('0x3'));var BPromise=require(_0x5645('0x4'));var rp=require(_0x5645('0x5'));var fs=require('fs');var path=require(_0x5645('0x6'));var rimraf=require('rimraf');var config=require(_0x5645('0x7'));var attributes=require(_0x5645('0x8'));module[_0x5645('0x9')]=function(_0x9400a8,_0x3a635d){return _0x9400a8[_0x5645('0xa')](_0x5645('0xb'),attributes,{'tableName':_0x5645('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0x5645('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd943=['api','bluebird','request-promise','path','rimraf','../../config/environment','int_zoho_fields','zoho_unique_index','lodash','util','../../config/logger'];(function(_0xdccb0d,_0x5e4ed5){var _0x162c1b=function(_0x3c913f){while(--_0x3c913f){_0xdccb0d['push'](_0xdccb0d['shift']());}};_0x162c1b(++_0x5e4ed5);}(_0xd943,0x15d));var _0x3d94=function(_0x4f07ae,_0x3fe295){_0x4f07ae=_0x4f07ae-0x0;var _0x3a0e90=_0xd943[_0x4f07ae];return _0x3a0e90;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var logger=require(_0x3d94('0x2'))(_0x3d94('0x3'));var moment=require('moment');var BPromise=require(_0x3d94('0x4'));var rp=require(_0x3d94('0x5'));var fs=require('fs');var path=require(_0x3d94('0x6'));var rimraf=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x34c9c3,_0x51cf1f){return _0x34c9c3['define']('ZohoField',attributes,{'tableName':_0x3d94('0x9'),'paranoid':![],'indexes':[{'name':_0x3d94('0xa'),'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 766767d..3a848ae 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 _0x380b=['error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5300ce,_0x33c8e9){var _0x466ff9=function(_0x406d6f){while(--_0x406d6f){_0x5300ce['push'](_0x5300ce['shift']());}};_0x466ff9(++_0x33c8e9);}(_0x380b,0x15d));var _0xb380=function(_0x10cd9e,_0x230bec){_0x10cd9e=_0x10cd9e-0x0;var _0x1ffb46=_0x380b[_0x10cd9e];return _0x1ffb46;};'use strict';var _=require('lodash');var util=require(_0xb380('0x0'));var moment=require(_0xb380('0x1'));var BPromise=require(_0xb380('0x2'));var rs=require(_0xb380('0x3'));var fs=require('fs');var Redis=require(_0xb380('0x4'));var db=require(_0xb380('0x5'))['db'];var utils=require(_0xb380('0x6'));var logger=require(_0xb380('0x7'))('rpc');var config=require(_0xb380('0x8'));var jayson=require(_0xb380('0x9'));var client=jayson[_0xb380('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e6528,_0x844bdf,_0x2f1456){return new BPromise(function(_0x194082,_0x504ef7){return client[_0xb380('0xb')](_0x4e6528,_0x2f1456)[_0xb380('0xc')](function(_0x3bcab5){logger[_0xb380('0xd')](_0xb380('0xe'),_0x844bdf,_0xb380('0xf'));logger[_0xb380('0x10')](_0xb380('0x11'),_0x844bdf,_0xb380('0xf'),JSON[_0xb380('0x12')](_0x3bcab5));if(_0x3bcab5['error']){if(_0x3bcab5[_0xb380('0x13')][_0xb380('0x14')]===0x1f4){logger[_0xb380('0x13')]('ZohoField,\x20%s,\x20%s',_0x844bdf,_0x3bcab5[_0xb380('0x13')]['message']);return _0x504ef7(_0x3bcab5[_0xb380('0x13')][_0xb380('0x15')]);}logger[_0xb380('0x13')]('ZohoField,\x20%s,\x20%s',_0x844bdf,_0x3bcab5[_0xb380('0x13')]['message']);return _0x194082(_0x3bcab5[_0xb380('0x13')][_0xb380('0x15')]);}else{logger[_0xb380('0xd')](_0xb380('0xe'),_0x844bdf,'request\x20sent');_0x194082(_0x3bcab5[_0xb380('0x16')]['message']);}})['catch'](function(_0x4892c5){logger['error'](_0xb380('0xe'),_0x844bdf,_0x4892c5);_0x504ef7(_0x4892c5);});});} \ No newline at end of file +var _0x6d2f=['info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x6d2f,0x190));var _0xf6d2=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0x6d2f[_0x218972];return _0x1bb1a8;};'use strict';var _=require(_0xf6d2('0x0'));var util=require(_0xf6d2('0x1'));var moment=require(_0xf6d2('0x2'));var BPromise=require(_0xf6d2('0x3'));var rs=require(_0xf6d2('0x4'));var fs=require('fs');var Redis=require(_0xf6d2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf6d2('0x6'));var logger=require(_0xf6d2('0x7'))('rpc');var config=require(_0xf6d2('0x8'));var jayson=require(_0xf6d2('0x9'));var client=jayson[_0xf6d2('0xa')][_0xf6d2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3a5c08,_0x1cb74c,_0x389144){return new BPromise(function(_0x42ec23,_0x4a1675){return client[_0xf6d2('0xc')](_0x3a5c08,_0x389144)[_0xf6d2('0xd')](function(_0x42cdbf){logger[_0xf6d2('0xe')](_0xf6d2('0xf'),_0x1cb74c,_0xf6d2('0x10'));logger[_0xf6d2('0x11')](_0xf6d2('0x12'),_0x1cb74c,_0xf6d2('0x10'),JSON[_0xf6d2('0x13')](_0x42cdbf));if(_0x42cdbf[_0xf6d2('0x14')]){if(_0x42cdbf[_0xf6d2('0x14')]['code']===0x1f4){logger[_0xf6d2('0x14')]('ZohoField,\x20%s,\x20%s',_0x1cb74c,_0x42cdbf[_0xf6d2('0x14')][_0xf6d2('0x15')]);return _0x4a1675(_0x42cdbf[_0xf6d2('0x14')]['message']);}logger['error']('ZohoField,\x20%s,\x20%s',_0x1cb74c,_0x42cdbf[_0xf6d2('0x14')]['message']);return _0x42ec23(_0x42cdbf['error'][_0xf6d2('0x15')]);}else{logger[_0xf6d2('0xe')](_0xf6d2('0xf'),_0x1cb74c,_0xf6d2('0x10'));_0x42ec23(_0x42cdbf['result'][_0xf6d2('0x15')]);}})[_0xf6d2('0x16')](function(_0x3a669d){logger[_0xf6d2('0x14')](_0xf6d2('0xf'),_0x1cb74c,_0x3a669d);_0x4a1675(_0x3a669d);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index c44b39a..3571daa 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x379b0f,_0x1c3fd3){var _0x1175d0=function(_0x1ec81b){while(--_0x1ec81b){_0x379b0f['push'](_0x379b0f['shift']());}};_0x1175d0(++_0x1c3fd3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x41b38b,_0x6ee394){var _0x2cb8a6=function(_0x51e798){while(--_0x51e798){_0x41b38b['push'](_0x41b38b['shift']());}};_0x2cb8a6(++_0x6ee394);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 43fb13d..73eb1d4 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 _0x01a2=['exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x198ce4,_0x16c396){var _0x26e065=function(_0xc9875){while(--_0xc9875){_0x198ce4['push'](_0x198ce4['shift']());}};_0x26e065(++_0x16c396);}(_0x01a2,0x68));var _0x201a=function(_0x496945,_0x4da389){_0x496945=_0x496945-0x0;var _0xec62b6=_0x01a2[_0x496945];return _0xec62b6;};'use strict';var Sequelize=require(_0x201a('0x0'));module[_0x201a('0x1')]={'name':{'type':Sequelize[_0x201a('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0x201a('0x2')],'allowNull':![],'unique':_0x201a('0x3')},'main':{'type':Sequelize[_0x201a('0x2')],'defaultValue':_0x201a('0x4')},'filename':{'type':Sequelize[_0x201a('0x2')]},'path':{'type':Sequelize[_0x201a('0x2')]},'type':{'type':Sequelize[_0x201a('0x2')]},'size':{'type':Sequelize[_0x201a('0x5')]},'active':{'type':Sequelize[_0x201a('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x201a('0x2')]},'logo':{'type':Sequelize[_0x201a('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x201a('0x2')]},'title':{'type':Sequelize[_0x201a('0x2')]},'remoteUri':{'type':Sequelize[_0x201a('0x2')]},'link':{'type':Sequelize[_0x201a('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xaecf=['exports','STRING','app.js','INTEGER','BOOLEAN','sequelize'];(function(_0x5f40d3,_0x480260){var _0x4aa444=function(_0x1b7b2a){while(--_0x1b7b2a){_0x5f40d3['push'](_0x5f40d3['shift']());}};_0x4aa444(++_0x480260);}(_0xaecf,0x149));var _0xfaec=function(_0x5ae06d,_0x44a73d){_0x5ae06d=_0x5ae06d-0x0;var _0x10af06=_0xaecf[_0x5ae06d];return _0x10af06;};'use strict';var Sequelize=require(_0xfaec('0x0'));module[_0xfaec('0x1')]={'name':{'type':Sequelize[_0xfaec('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize[_0xfaec('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0xfaec('0x2')],'defaultValue':_0xfaec('0x3')},'filename':{'type':Sequelize['STRING']},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xfaec('0x2')]},'size':{'type':Sequelize[_0xfaec('0x4')]},'active':{'type':Sequelize[_0xfaec('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xfaec('0x2')]},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0xfaec('0x2')],'unique':'state'},'description':{'type':Sequelize[_0xfaec('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xfaec('0x2')]},'link':{'type':Sequelize[_0xfaec('0x2')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ad91da0..32effa0 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 _0xfdbd=['findAll','rows','show','length','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update','destroy','then','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include'];(function(_0x458c7f,_0x25e2fc){var _0x5c6f28=function(_0x3d7d2d){while(--_0x3d7d2d){_0x458c7f['push'](_0x458c7f['shift']());}};_0x5c6f28(++_0x25e2fc);}(_0xfdbd,0xf0));var _0xdfdb=function(_0xca1f0e,_0x2713d5){_0xca1f0e=_0xca1f0e-0x0;var _0x35e4ef=_0xfdbd[_0xca1f0e];return _0x35e4ef;};'use strict';var emlformat=require(_0xdfdb('0x0'));var rimraf=require(_0xdfdb('0x1'));var zipdir=require(_0xdfdb('0x2'));var jsonpatch=require(_0xdfdb('0x3'));var rp=require(_0xdfdb('0x4'));var moment=require(_0xdfdb('0x5'));var BPromise=require(_0xdfdb('0x6'));var Mustache=require(_0xdfdb('0x7'));var util=require(_0xdfdb('0x8'));var path=require('path');var sox=require(_0xdfdb('0x9'));var csv=require('to-csv');var ejs=require(_0xdfdb('0xa'));var fs=require('fs');var fs_extra=require(_0xdfdb('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdfdb('0xc'));var deskjs=require(_0xdfdb('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdfdb('0xe'));var Papa=require(_0xdfdb('0xf'));var Redis=require(_0xdfdb('0x10'));var authService=require(_0xdfdb('0x11'));var qs=require(_0xdfdb('0x12'));var as=require(_0xdfdb('0x13'));var hardwareService=require(_0xdfdb('0x14'));var logger=require('../../config/logger')(_0xdfdb('0x15'));var utils=require(_0xdfdb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xdfdb('0x17'));var db=require(_0xdfdb('0x18'))['db'];function respondWithStatusCode(_0x2bee3b,_0x1918c1){_0x1918c1=_0x1918c1||0xcc;return function(_0x2a95f1){if(_0x2a95f1){return _0x2bee3b[_0xdfdb('0x19')](_0x1918c1);}return _0x2bee3b[_0xdfdb('0x1a')](_0x1918c1)[_0xdfdb('0x1b')]();};}function respondWithResult(_0x51162f,_0x48a66a){_0x48a66a=_0x48a66a||0xc8;return function(_0x2c44dc){if(_0x2c44dc){return _0x51162f['status'](_0x48a66a)[_0xdfdb('0x1c')](_0x2c44dc);}};}function respondWithFilteredResult(_0x9f3039,_0x11a56a){return function(_0x40bc8a){if(_0x40bc8a){var _0x3bfd81=typeof _0x11a56a[_0xdfdb('0x1d')]==='undefined'&&typeof _0x11a56a['limit']===_0xdfdb('0x1e');var _0x8b9193=_0x40bc8a[_0xdfdb('0x1f')];var _0x55ab5a=_0x3bfd81?0x0:_0x11a56a[_0xdfdb('0x1d')];var _0xb677b1=_0x3bfd81?_0x40bc8a[_0xdfdb('0x1f')]:_0x11a56a[_0xdfdb('0x1d')]+_0x11a56a[_0xdfdb('0x20')];var _0x2294de;if(_0xb677b1>=_0x8b9193){_0xb677b1=_0x8b9193;_0x2294de=0xc8;}else{_0x2294de=0xce;}_0x9f3039[_0xdfdb('0x1a')](_0x2294de);return _0x9f3039[_0xdfdb('0x21')]('Content-Range',_0x55ab5a+'-'+_0xb677b1+'/'+_0x8b9193)[_0xdfdb('0x1c')](_0x40bc8a);}return null;};}function patchUpdates(_0xb7417c){return function(_0x172c63){try{jsonpatch['apply'](_0x172c63,_0xb7417c,!![]);}catch(_0x377112){return BPromise[_0xdfdb('0x22')](_0x377112);}return _0x172c63[_0xdfdb('0x23')]();};}function saveUpdates(_0x4d55e5,_0x280e53){return function(_0x789bd2){if(_0x789bd2){return _0x789bd2[_0xdfdb('0x24')](_0x4d55e5)['then'](function(_0x2a80c1){return _0x2a80c1;});}return null;};}function removeEntity(_0x526057,_0x2db1c1){return function(_0x145350){if(_0x145350){return _0x145350[_0xdfdb('0x25')]()[_0xdfdb('0x26')](function(){_0x526057['status'](0xcc)[_0xdfdb('0x1b')]();});}};}function handleEntityNotFound(_0x4363d8,_0x956843){return function(_0x400663){if(!_0x400663){_0x4363d8[_0xdfdb('0x19')](0x194);}return _0x400663;};}function handleError(_0x305954,_0x57d24f){_0x57d24f=_0x57d24f||0x1f4;return function(_0xec4d22){logger[_0xdfdb('0x27')](_0xec4d22[_0xdfdb('0x28')]);if(_0xec4d22['name']){delete _0xec4d22[_0xdfdb('0x29')];}_0x305954['status'](_0x57d24f)[_0xdfdb('0x2a')](_0xec4d22);};}exports[_0xdfdb('0x2b')]=function(_0x19c36f,_0x513fa0){var _0x5bc174={},_0x1c8ca8={},_0xc56435={'count':0x0,'rows':[]};var _0xedbb91=_[_0xdfdb('0x2c')](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')],function(_0x5a9fc4){return{'name':_0x5a9fc4[_0xdfdb('0x2f')],'type':_0x5a9fc4[_0xdfdb('0x30')][_0xdfdb('0x31')]};});_0x1c8ca8[_0xdfdb('0x32')]=_[_0xdfdb('0x2c')](_0xedbb91,_0xdfdb('0x29'));_0x1c8ca8[_0xdfdb('0x33')]=_[_0xdfdb('0x34')](_0x19c36f[_0xdfdb('0x33')]);_0x1c8ca8[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x1c8ca8['model'],_0x1c8ca8['query']);_0x5bc174[_0xdfdb('0x37')]=_['intersection'](_0x1c8ca8[_0xdfdb('0x32')],qs[_0xdfdb('0x38')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x38')]));_0x5bc174['attributes']=_0x5bc174[_0xdfdb('0x37')]['length']?_0x5bc174[_0xdfdb('0x37')]:_0x1c8ca8[_0xdfdb('0x32')];if(!_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x39')](_0xdfdb('0x3a'))){_0x5bc174[_0xdfdb('0x20')]=qs['limit'](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x20')]);_0x5bc174['offset']=qs[_0xdfdb('0x1d')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x1d')]);}_0x5bc174[_0xdfdb('0x3b')]=qs[_0xdfdb('0x3c')](_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3c')]);_0x5bc174[_0xdfdb('0x3d')]=qs[_0xdfdb('0x35')](_[_0xdfdb('0x3e')](_0x19c36f[_0xdfdb('0x33')],_0x1c8ca8['filters']),_0xedbb91);if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]){_0x5bc174[_0xdfdb('0x3d')]=_[_0xdfdb('0x40')](_0x5bc174[_0xdfdb('0x3d')],{'$or':_[_0xdfdb('0x2c')](_0xedbb91,function(_0x3ec73a){if(_0x3ec73a[_0xdfdb('0x30')]!=='VIRTUAL'){var _0x55d707={};_0x55d707[_0x3ec73a[_0xdfdb('0x29')]]={'$like':'%'+_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x3f')]+'%'};return _0x55d707;}})});}_0x5bc174=_[_0xdfdb('0x40')]({},_0x5bc174,_0x19c36f[_0xdfdb('0x41')]);var _0x300884={'where':_0x5bc174[_0xdfdb('0x3d')]};return db[_0xdfdb('0x2d')][_0xdfdb('0x1f')](_0x300884)['then'](function(_0x175f57){_0xc56435[_0xdfdb('0x1f')]=_0x175f57;if(_0x19c36f[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5bc174[_0xdfdb('0x43')]=[{'all':!![]}];}return db['Integration'][_0xdfdb('0x44')](_0x5bc174);})[_0xdfdb('0x26')](function(_0x3e9f88){_0xc56435[_0xdfdb('0x45')]=_0x3e9f88;return _0xc56435;})[_0xdfdb('0x26')](respondWithFilteredResult(_0x513fa0,_0x5bc174))['catch'](handleError(_0x513fa0,null));};exports[_0xdfdb('0x46')]=function(_0xd2f8bd,_0xf0482a){var _0x5b4381={'raw':![],'where':{'id':_0xd2f8bd['params']['id']}},_0x2b5139={};_0x2b5139[_0xdfdb('0x32')]=_['keys'](db[_0xdfdb('0x2d')][_0xdfdb('0x2e')]);_0x2b5139['query']=_[_0xdfdb('0x34')](_0xd2f8bd['query']);_0x2b5139[_0xdfdb('0x35')]=_[_0xdfdb('0x36')](_0x2b5139[_0xdfdb('0x32')],_0x2b5139[_0xdfdb('0x33')]);_0x5b4381[_0xdfdb('0x37')]=_['intersection'](_0x2b5139['model'],qs[_0xdfdb('0x38')](_0xd2f8bd[_0xdfdb('0x33')]['fields']));_0x5b4381[_0xdfdb('0x37')]=_0x5b4381['attributes'][_0xdfdb('0x47')]?_0x5b4381[_0xdfdb('0x37')]:_0x2b5139[_0xdfdb('0x32')];if(_0xd2f8bd[_0xdfdb('0x33')][_0xdfdb('0x42')]){_0x5b4381[_0xdfdb('0x43')]=[{'all':!![]}];}_0x5b4381=_[_0xdfdb('0x40')]({},_0x5b4381,_0xd2f8bd[_0xdfdb('0x41')]);return db[_0xdfdb('0x2d')][_0xdfdb('0x48')](_0x5b4381)[_0xdfdb('0x26')](handleEntityNotFound(_0xf0482a,null))[_0xdfdb('0x26')](respondWithResult(_0xf0482a,null))[_0xdfdb('0x49')](handleError(_0xf0482a,null));};exports[_0xdfdb('0x4a')]=function(_0x1c08fb,_0x273477){return db['Integration']['create'](_0x1c08fb[_0xdfdb('0x4b')],{})[_0xdfdb('0x26')](respondWithResult(_0x273477,0xc9))[_0xdfdb('0x49')](handleError(_0x273477,null));};exports['update']=function(_0x36149e,_0x4d4c90){if(_0x36149e[_0xdfdb('0x4b')]['id']){delete _0x36149e[_0xdfdb('0x4b')]['id'];}return db['Integration'][_0xdfdb('0x48')]({'where':{'id':_0x36149e[_0xdfdb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4d4c90,null))[_0xdfdb('0x26')](saveUpdates(_0x36149e[_0xdfdb('0x4b')],null))[_0xdfdb('0x26')](respondWithResult(_0x4d4c90,null))[_0xdfdb('0x49')](handleError(_0x4d4c90,null));};exports[_0xdfdb('0x25')]=function(_0x10b490,_0x17dfdb){return db[_0xdfdb('0x2d')][_0xdfdb('0x48')]({'where':{'id':_0x10b490['params']['id']}})[_0xdfdb('0x26')](handleEntityNotFound(_0x17dfdb,null))['then'](removeEntity(_0x17dfdb,null))[_0xdfdb('0x49')](handleError(_0x17dfdb,null));}; \ No newline at end of file +var _0x7096=['offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','Integration','find','catch','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end'];(function(_0x440269,_0x5a4ffd){var _0x2dcbfe=function(_0x3a64f2){while(--_0x3a64f2){_0x440269['push'](_0x440269['shift']());}};_0x2dcbfe(++_0x5a4ffd);}(_0x7096,0x10c));var _0x6709=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7096[_0x110c3d];return _0x226d67;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['Integration'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['Integration'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['Integration'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['Integration']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['Integration'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 208f0c0..2fde5fe 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 _0x6439=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./integration.attributes','define','Integration','lodash','../../config/logger','api'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x6439,0x159));var _0x9643=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0x6439[_0x1573ea];return _0x51c0e2;};'use strict';var _=require(_0x9643('0x0'));var util=require('util');var logger=require(_0x9643('0x1'))(_0x9643('0x2'));var moment=require(_0x9643('0x3'));var BPromise=require(_0x9643('0x4'));var rp=require(_0x9643('0x5'));var fs=require('fs');var path=require(_0x9643('0x6'));var rimraf=require(_0x9643('0x7'));var config=require(_0x9643('0x8'));var attributes=require(_0x9643('0x9'));module['exports']=function(_0x4b4a86,_0x423208){return _0x4b4a86[_0x9643('0xa')](_0x9643('0xb'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd9d7=['./integration.attributes','define','Integration','integrations','lodash','util','../../config/logger','moment','bluebird','rimraf'];(function(_0x1ae5ab,_0xc5d441){var _0x1ce001=function(_0x5ef96d){while(--_0x5ef96d){_0x1ae5ab['push'](_0x1ae5ab['shift']());}};_0x1ce001(++_0xc5d441);}(_0xd9d7,0x9a));var _0x7d9d=function(_0x2c96f6,_0x877207){_0x2c96f6=_0x2c96f6-0x0;var _0x6d4808=_0xd9d7[_0x2c96f6];return _0x6d4808;};'use strict';var _=require(_0x7d9d('0x0'));var util=require(_0x7d9d('0x1'));var logger=require(_0x7d9d('0x2'))('api');var moment=require(_0x7d9d('0x3'));var BPromise=require(_0x7d9d('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d9d('0x5'));var config=require('../../config/environment');var attributes=require(_0x7d9d('0x6'));module['exports']=function(_0x35fd5c,_0x247b68){return _0x35fd5c[_0x7d9d('0x7')](_0x7d9d('0x8'),attributes,{'tableName':_0x7d9d('0x9'),'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 b2e20e8..0493853 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 _0x524e=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Integration,\x20%s,\x20%s','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','moment','bluebird'];(function(_0x18d5d7,_0x19074b){var _0x30a9ea=function(_0x514f3f){while(--_0x514f3f){_0x18d5d7['push'](_0x18d5d7['shift']());}};_0x30a9ea(++_0x19074b);}(_0x524e,0x15e));var _0xe524=function(_0x1bd3bd,_0x474b5a){_0x1bd3bd=_0x1bd3bd-0x0;var _0x854163=_0x524e[_0x1bd3bd];return _0x854163;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe524('0x0'));var BPromise=require(_0xe524('0x1'));var rs=require(_0xe524('0x2'));var fs=require('fs');var Redis=require(_0xe524('0x3'));var db=require(_0xe524('0x4'))['db'];var utils=require(_0xe524('0x5'));var logger=require(_0xe524('0x6'))(_0xe524('0x7'));var config=require(_0xe524('0x8'));var jayson=require(_0xe524('0x9'));var client=jayson['client'][_0xe524('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41e1a3,_0x347bed,_0x533c14){return new BPromise(function(_0x384935,_0x3e4cda){return client[_0xe524('0xb')](_0x41e1a3,_0x533c14)[_0xe524('0xc')](function(_0x991924){logger[_0xe524('0xd')](_0xe524('0xe'),_0x347bed,_0xe524('0xf'));logger[_0xe524('0x10')](_0xe524('0x11'),_0x347bed,_0xe524('0xf'),JSON[_0xe524('0x12')](_0x991924));if(_0x991924[_0xe524('0x13')]){if(_0x991924[_0xe524('0x13')][_0xe524('0x14')]===0x1f4){logger[_0xe524('0x13')]('Integration,\x20%s,\x20%s',_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x3e4cda(_0x991924[_0xe524('0x13')][_0xe524('0x15')]);}logger[_0xe524('0x13')](_0xe524('0xe'),_0x347bed,_0x991924['error'][_0xe524('0x15')]);return _0x384935(_0x991924['error'][_0xe524('0x15')]);}else{logger[_0xe524('0xd')]('Integration,\x20%s,\x20%s',_0x347bed,_0xe524('0xf'));_0x384935(_0x991924['result'][_0xe524('0x15')]);}})['catch'](function(_0x29a031){logger['error']('Integration,\x20%s,\x20%s',_0x347bed,_0x29a031);_0x3e4cda(_0x29a031);});});} \ No newline at end of file +var _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x3ae6a3,_0x509eb4){var _0x414586=function(_0x578703){while(--_0x578703){_0x3ae6a3['push'](_0x3ae6a3['shift']());}};_0x414586(++_0x509eb4);}(_0x955f,0x1eb));var _0xf955=function(_0x59cdf6,_0x4dfc78){_0x59cdf6=_0x59cdf6-0x0;var _0x1ae776=_0x955f[_0x59cdf6];return _0x1ae776;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 0d8faf5..ebddc22 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x4ae879,_0xc32498){var _0x5b65f0=function(_0x19852a){while(--_0x19852a){_0x4ae879['push'](_0x4ae879['shift']());}};_0x5b65f0(++_0xc32498);}(_0x6d38,0x1ef));var _0x86d3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6d38[_0x126558];return _0x1f6d14;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0xba34=['exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x272400,_0x501dfd){var _0x322c4e=function(_0x5578f0){while(--_0x5578f0){_0x272400['push'](_0x272400['shift']());}};_0x322c4e(++_0x501dfd);}(_0xba34,0x119));var _0x4ba3=function(_0xc238d7,_0x65ea11){_0xc238d7=_0xc238d7-0x0;var _0x5311a6=_0xba34[_0xc238d7];return _0x5311a6;};'use strict';var multer=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var path=require(_0x4ba3('0x2'));var timeout=require(_0x4ba3('0x3'));var express=require(_0x4ba3('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var controller=require(_0x4ba3('0x7'));router[_0x4ba3('0x8')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xa')]);router[_0x4ba3('0x8')]('/describe',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xb')]);router[_0x4ba3('0x8')](_0x4ba3('0xc'),auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xd')]);router[_0x4ba3('0xe')]('/',auth[_0x4ba3('0x9')](),controller[_0x4ba3('0xf')]);router[_0x4ba3('0x10')](_0x4ba3('0xc'),auth['isAuthenticated'](),controller[_0x4ba3('0x11')]);router[_0x4ba3('0x12')]('/:id',auth[_0x4ba3('0x9')](),controller['destroy']);module[_0x4ba3('0x13')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 20dfe65..1acbcf8 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 _0xe703=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe703,0x180));var _0x3e70=function(_0x41b3d6,_0x21daa8){_0x41b3d6=_0x41b3d6-0x0;var _0x3e60ca=_0xe703[_0x41b3d6];return _0x3e60ca;};'use strict';var Sequelize=require('sequelize');module[_0x3e70('0x0')]={'integration':{'type':Sequelize[_0x3e70('0x1')]},'eventChannel':{'type':Sequelize[_0x3e70('0x1')]},'exitStatus':{'type':Sequelize[_0x3e70('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x3e70('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3e70('0x1')]},'calleridnum':{'type':Sequelize[_0x3e70('0x1')]},'calleridname':{'type':Sequelize[_0x3e70('0x1')]},'queue':{'type':Sequelize[_0x3e70('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3e70('0x1')]},'agentcalledAt':{'type':Sequelize[_0x3e70('0x3')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3e70('0x2')]},'agentcomplete':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3e70('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3e70('0x2')]},'reason':{'type':Sequelize[_0x3e70('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3e70('0x3')]},'agentdump':{'type':Sequelize[_0x3e70('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3e70('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3e70('0x1')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3e70('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e70('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e70('0x1')]},'language':{'type':Sequelize[_0x3e70('0x1')]},'accountcode':{'type':Sequelize[_0x3e70('0x1')]},'context':{'type':Sequelize[_0x3e70('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3e70('0x1')]},'destchannel':{'type':Sequelize[_0x3e70('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e70('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x3e70('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x3e70('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e70('0x1')]},'destlanguage':{'type':Sequelize[_0x3e70('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e70('0x1')]},'destcontext':{'type':Sequelize[_0x3e70('0x1')]},'destexten':{'type':Sequelize[_0x3e70('0x1')]},'destpriority':{'type':Sequelize[_0x3e70('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x3e70('0x1')]},'subject':{'type':Sequelize[_0x3e70('0x1')]},'from':{'type':Sequelize[_0x3e70('0x1')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0x3e70('0x5')]},'html':{'type':Sequelize[_0x3e70('0x5')]},'text':{'type':Sequelize[_0x3e70('0x5')]},'status':{'type':Sequelize[_0x3e70('0x6')](_0x3e70('0x7'),_0x3e70('0x8'),_0x3e70('0x9'),_0x3e70('0xa'))},'url':{'type':Sequelize[_0x3e70('0x1')]},'app':{'type':Sequelize['STRING']},'appdata':{'type':Sequelize[_0x3e70('0x1')]},'projectId':{'type':Sequelize[_0x3e70('0x2')]}}; \ No newline at end of file +var _0x7fc2=['INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED','sequelize','STRING'];(function(_0x387123,_0x54b6d1){var _0x109fba=function(_0xf89948){while(--_0xf89948){_0x387123['push'](_0x387123['shift']());}};_0x109fba(++_0x54b6d1);}(_0x7fc2,0x85));var _0x27fc=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7fc2[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x27fc('0x0'));module['exports']={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0x27fc('0x1')]},'exitStatus':{'type':Sequelize[_0x27fc('0x1')]},'ticketId':{'type':Sequelize[_0x27fc('0x1')]},'integrationId':{'type':Sequelize[_0x27fc('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x27fc('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x27fc('0x1')]},'interface':{'type':Sequelize[_0x27fc('0x1')]},'membername':{'type':Sequelize[_0x27fc('0x1')]},'agentcalledAt':{'type':Sequelize[_0x27fc('0x3')]},'agentconnectAt':{'type':Sequelize[_0x27fc('0x3')]},'holdtime':{'type':Sequelize[_0x27fc('0x2')]},'agentcomplete':{'type':Sequelize[_0x27fc('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0x27fc('0x2')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x27fc('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0x27fc('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x27fc('0x3')]},'agentdump':{'type':Sequelize[_0x27fc('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x27fc('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x27fc('0x1')]},'channelstate':{'type':Sequelize[_0x27fc('0x2')]},'channelstatedesc':{'type':Sequelize[_0x27fc('0x1')]},'connectedlinenum':{'type':Sequelize[_0x27fc('0x1')]},'connectedlinename':{'type':Sequelize[_0x27fc('0x1')]},'language':{'type':Sequelize[_0x27fc('0x1')]},'accountcode':{'type':Sequelize[_0x27fc('0x1')]},'context':{'type':Sequelize[_0x27fc('0x1')]},'exten':{'type':Sequelize[_0x27fc('0x1')]},'priority':{'type':Sequelize[_0x27fc('0x1')]},'destchannel':{'type':Sequelize[_0x27fc('0x1')]},'destchannelstate':{'type':Sequelize[_0x27fc('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x27fc('0x1')]},'destcalleridnum':{'type':Sequelize[_0x27fc('0x1')]},'destcalleridname':{'type':Sequelize[_0x27fc('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x27fc('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x27fc('0x1')]},'destlanguage':{'type':Sequelize[_0x27fc('0x1')]},'destaccountcode':{'type':Sequelize[_0x27fc('0x1')]},'destcontext':{'type':Sequelize[_0x27fc('0x1')]},'destexten':{'type':Sequelize[_0x27fc('0x1')]},'destpriority':{'type':Sequelize[_0x27fc('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x27fc('0x1')]},'inReplyTo':{'type':Sequelize[_0x27fc('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0x27fc('0x1')]},'cc':{'type':Sequelize[_0x27fc('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x27fc('0x5')]},'text':{'type':Sequelize[_0x27fc('0x5')]},'status':{'type':Sequelize['ENUM'](_0x27fc('0x6'),_0x27fc('0x7'),_0x27fc('0x8'),'FAILED')},'url':{'type':Sequelize[_0x27fc('0x1')]},'app':{'type':Sequelize[_0x27fc('0x1')]},'appdata':{'type':Sequelize[_0x27fc('0x1')]},'projectId':{'type':Sequelize[_0x27fc('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 59f5010..5b05e44 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 _0x330b=['to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','name','index','map','IntegrationReport','rawAttributes','fieldName','key','keys','query','filters','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','rows','catch','show','options','find','create','body','params','describe','rimraf','zip-dir','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x19745e,_0x3d468d){var _0x28e2c2=function(_0x947367){while(--_0x947367){_0x19745e['push'](_0x19745e['shift']());}};_0x28e2c2(++_0x3d468d);}(_0x330b,0x81));var _0xb330=function(_0xf2d1bf,_0x19c53a){_0xf2d1bf=_0xf2d1bf-0x0;var _0x388d2c=_0x330b[_0xf2d1bf];return _0x388d2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb330('0x0'));var zipdir=require(_0xb330('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb330('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb330('0x3'));var util=require(_0xb330('0x4'));var path=require(_0xb330('0x5'));var sox=require(_0xb330('0x6'));var csv=require('to-csv');var ejs=require(_0xb330('0x7'));var fs=require('fs');var fs_extra=require(_0xb330('0x8'));var _=require(_0xb330('0x9'));var squel=require('squel');var crypto=require(_0xb330('0xa'));var jsforce=require(_0xb330('0xb'));var deskjs=require(_0xb330('0xc'));var toCsv=require(_0xb330('0xd'));var querystring=require(_0xb330('0xe'));var Papa=require(_0xb330('0xf'));var Redis=require(_0xb330('0x10'));var authService=require(_0xb330('0x11'));var qs=require(_0xb330('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb330('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb330('0x14'))['db'];function respondWithStatusCode(_0x5316df,_0xbd5a1a){_0xbd5a1a=_0xbd5a1a||0xcc;return function(_0x22ae9b){if(_0x22ae9b){return _0x5316df[_0xb330('0x15')](_0xbd5a1a);}return _0x5316df['status'](_0xbd5a1a)[_0xb330('0x16')]();};}function respondWithResult(_0x1de312,_0x825f81){_0x825f81=_0x825f81||0xc8;return function(_0x4ec08c){if(_0x4ec08c){return _0x1de312[_0xb330('0x17')](_0x825f81)[_0xb330('0x18')](_0x4ec08c);}};}function respondWithFilteredResult(_0x4ccbf5,_0x26c759){return function(_0x429ea1){if(_0x429ea1){var _0x3727df=typeof _0x26c759[_0xb330('0x19')]===_0xb330('0x1a')&&typeof _0x26c759[_0xb330('0x1b')]===_0xb330('0x1a');var _0x22e2c2=_0x429ea1[_0xb330('0x1c')];var _0x25ce96=_0x3727df?0x0:_0x26c759[_0xb330('0x19')];var _0x2112c6=_0x3727df?_0x429ea1[_0xb330('0x1c')]:_0x26c759[_0xb330('0x19')]+_0x26c759['limit'];var _0x628225;if(_0x2112c6>=_0x22e2c2){_0x2112c6=_0x22e2c2;_0x628225=0xc8;}else{_0x628225=0xce;}_0x4ccbf5[_0xb330('0x17')](_0x628225);return _0x4ccbf5[_0xb330('0x1d')](_0xb330('0x1e'),_0x25ce96+'-'+_0x2112c6+'/'+_0x22e2c2)[_0xb330('0x18')](_0x429ea1);}return null;};}function patchUpdates(_0x495964){return function(_0x25d2bd){try{jsonpatch[_0xb330('0x1f')](_0x25d2bd,_0x495964,!![]);}catch(_0x499e62){return BPromise['reject'](_0x499e62);}return _0x25d2bd['save']();};}function saveUpdates(_0x50c9f2,_0x502973){return function(_0x45587f){if(_0x45587f){return _0x45587f[_0xb330('0x20')](_0x50c9f2)[_0xb330('0x21')](function(_0x4dec6b){return _0x4dec6b;});}return null;};}function removeEntity(_0x211958,_0x328dfe){return function(_0x726c1a){if(_0x726c1a){return _0x726c1a[_0xb330('0x22')]()['then'](function(){_0x211958[_0xb330('0x17')](0xcc)[_0xb330('0x16')]();});}};}function handleEntityNotFound(_0x3c1992,_0x35fbe5){return function(_0x5f51f6){if(!_0x5f51f6){_0x3c1992[_0xb330('0x15')](0x194);}return _0x5f51f6;};}function handleError(_0x5364bb,_0x53bcd8){_0x53bcd8=_0x53bcd8||0x1f4;return function(_0x2f78ec){logger['error'](_0x2f78ec['stack']);if(_0x2f78ec[_0xb330('0x23')]){delete _0x2f78ec[_0xb330('0x23')];}_0x5364bb[_0xb330('0x17')](_0x53bcd8)['send'](_0x2f78ec);};}exports[_0xb330('0x24')]=function(_0x46c250,_0x33af76){var _0x43f9e7={},_0x428f65={},_0x590218={'count':0x0,'rows':[]};var _0x1aa1f=_[_0xb330('0x25')](db[_0xb330('0x26')][_0xb330('0x27')],function(_0x204304){return{'name':_0x204304[_0xb330('0x28')],'type':_0x204304['type'][_0xb330('0x29')]};});_0x428f65['model']=_['map'](_0x1aa1f,_0xb330('0x23'));_0x428f65['query']=_[_0xb330('0x2a')](_0x46c250[_0xb330('0x2b')]);_0x428f65[_0xb330('0x2c')]=_[_0xb330('0x2d')](_0x428f65[_0xb330('0x2e')],_0x428f65[_0xb330('0x2b')]);_0x43f9e7['attributes']=_['intersection'](_0x428f65[_0xb330('0x2e')],qs['fields'](_0x46c250[_0xb330('0x2b')][_0xb330('0x2f')]));_0x43f9e7['attributes']=_0x43f9e7['attributes'][_0xb330('0x30')]?_0x43f9e7[_0xb330('0x31')]:_0x428f65[_0xb330('0x2e')];if(!_0x46c250[_0xb330('0x2b')][_0xb330('0x32')](_0xb330('0x33'))){_0x43f9e7[_0xb330('0x1b')]=qs['limit'](_0x46c250[_0xb330('0x2b')][_0xb330('0x1b')]);_0x43f9e7[_0xb330('0x19')]=qs[_0xb330('0x19')](_0x46c250[_0xb330('0x2b')][_0xb330('0x19')]);}_0x43f9e7[_0xb330('0x34')]=qs[_0xb330('0x35')](_0x46c250[_0xb330('0x2b')][_0xb330('0x35')]);_0x43f9e7[_0xb330('0x36')]=qs[_0xb330('0x2c')](_[_0xb330('0x37')](_0x46c250[_0xb330('0x2b')],_0x428f65[_0xb330('0x2c')]),_0x1aa1f);if(_0x46c250['query'][_0xb330('0x38')]){_0x43f9e7[_0xb330('0x36')]=_[_0xb330('0x39')](_0x43f9e7[_0xb330('0x36')],{'$or':_[_0xb330('0x25')](_0x1aa1f,function(_0x5c4346){if(_0x5c4346[_0xb330('0x3a')]!==_0xb330('0x3b')){var _0x591266={};_0x591266[_0x5c4346[_0xb330('0x23')]]={'$like':'%'+_0x46c250[_0xb330('0x2b')][_0xb330('0x38')]+'%'};return _0x591266;}})});}_0x43f9e7=_[_0xb330('0x39')]({},_0x43f9e7,_0x46c250['options']);var _0x19dace={'where':_0x43f9e7[_0xb330('0x36')]};return db[_0xb330('0x26')][_0xb330('0x1c')](_0x19dace)['then'](function(_0x47943e){_0x590218['count']=_0x47943e;if(_0x46c250['query'][_0xb330('0x3c')]){_0x43f9e7[_0xb330('0x3d')]=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x43f9e7);})[_0xb330('0x21')](function(_0x4551e1){_0x590218[_0xb330('0x3e')]=_0x4551e1;return _0x590218;})['then'](respondWithFilteredResult(_0x33af76,_0x43f9e7))[_0xb330('0x3f')](handleError(_0x33af76,null));};exports[_0xb330('0x40')]=function(_0xc6d76c,_0x645e97){var _0x3fab7d={'raw':![],'where':{'id':_0xc6d76c['params']['id']}},_0x11ee9a={};_0x11ee9a['model']=_[_0xb330('0x2a')](db[_0xb330('0x26')][_0xb330('0x27')]);_0x11ee9a[_0xb330('0x2b')]=_['keys'](_0xc6d76c['query']);_0x11ee9a[_0xb330('0x2c')]=_['intersection'](_0x11ee9a[_0xb330('0x2e')],_0x11ee9a[_0xb330('0x2b')]);_0x3fab7d[_0xb330('0x31')]=_[_0xb330('0x2d')](_0x11ee9a[_0xb330('0x2e')],qs[_0xb330('0x2f')](_0xc6d76c[_0xb330('0x2b')][_0xb330('0x2f')]));_0x3fab7d[_0xb330('0x31')]=_0x3fab7d[_0xb330('0x31')][_0xb330('0x30')]?_0x3fab7d[_0xb330('0x31')]:_0x11ee9a[_0xb330('0x2e')];if(_0xc6d76c[_0xb330('0x2b')]['includeAll']){_0x3fab7d[_0xb330('0x3d')]=[{'all':!![]}];}_0x3fab7d=_['merge']({},_0x3fab7d,_0xc6d76c[_0xb330('0x41')]);return db[_0xb330('0x26')][_0xb330('0x42')](_0x3fab7d)[_0xb330('0x21')](handleEntityNotFound(_0x645e97,null))[_0xb330('0x21')](respondWithResult(_0x645e97,null))[_0xb330('0x3f')](handleError(_0x645e97,null));};exports[_0xb330('0x43')]=function(_0x46f302,_0x5cb53f){return db[_0xb330('0x26')][_0xb330('0x43')](_0x46f302['body'],{})['then'](respondWithResult(_0x5cb53f,0xc9))[_0xb330('0x3f')](handleError(_0x5cb53f,null));};exports[_0xb330('0x20')]=function(_0x35d906,_0x321ee5){if(_0x35d906['body']['id']){delete _0x35d906[_0xb330('0x44')]['id'];}return db[_0xb330('0x26')][_0xb330('0x42')]({'where':{'id':_0x35d906[_0xb330('0x45')]['id']}})[_0xb330('0x21')](handleEntityNotFound(_0x321ee5,null))[_0xb330('0x21')](saveUpdates(_0x35d906[_0xb330('0x44')],null))[_0xb330('0x21')](respondWithResult(_0x321ee5,null))[_0xb330('0x3f')](handleError(_0x321ee5,null));};exports[_0xb330('0x22')]=function(_0x4c3d3a,_0xdd9b43){return db['IntegrationReport'][_0xb330('0x42')]({'where':{'id':_0x4c3d3a[_0xb330('0x45')]['id']}})['then'](handleEntityNotFound(_0xdd9b43,null))['then'](removeEntity(_0xdd9b43,null))[_0xb330('0x3f')](handleError(_0xdd9b43,null));};exports[_0xb330('0x46')]=function(_0xaffb44,_0x4758a4){return db[_0xb330('0x26')][_0xb330('0x46')]()['then'](respondWithResult(_0x4758a4,null))[_0xb330('0x3f')](handleError(_0x4758a4,null));}; \ No newline at end of file +var _0x935c=['undefined','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','destroy','describe','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','status','end','offset'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x935c,0x108));var _0xc935=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x935c[_0x17d9e3];return _0x14192d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc935('0x0'));var zipdir=require(_0xc935('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc935('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc935('0x3'));var util=require(_0xc935('0x4'));var path=require(_0xc935('0x5'));var sox=require(_0xc935('0x6'));var csv=require(_0xc935('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc935('0x8'));var squel=require(_0xc935('0x9'));var crypto=require('crypto');var jsforce=require(_0xc935('0xa'));var deskjs=require(_0xc935('0xb'));var toCsv=require(_0xc935('0x7'));var querystring=require(_0xc935('0xc'));var Papa=require(_0xc935('0xd'));var Redis=require(_0xc935('0xe'));var authService=require(_0xc935('0xf'));var qs=require(_0xc935('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xc935('0x11'))(_0xc935('0x12'));var utils=require(_0xc935('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc935('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe27465,_0xd41541){_0xd41541=_0xd41541||0xcc;return function(_0x1c5588){if(_0x1c5588){return _0xe27465['sendStatus'](_0xd41541);}return _0xe27465[_0xc935('0x15')](_0xd41541)[_0xc935('0x16')]();};}function respondWithResult(_0x2af1cf,_0x354f8e){_0x354f8e=_0x354f8e||0xc8;return function(_0x5f2960){if(_0x5f2960){return _0x2af1cf['status'](_0x354f8e)['json'](_0x5f2960);}};}function respondWithFilteredResult(_0x1d2697,_0x4636a9){return function(_0x354ebb){if(_0x354ebb){var _0x5481bf=typeof _0x4636a9[_0xc935('0x17')]===_0xc935('0x18')&&typeof _0x4636a9[_0xc935('0x19')]===_0xc935('0x18');var _0x3e3b9c=_0x354ebb['count'];var _0x19abaa=_0x5481bf?0x0:_0x4636a9[_0xc935('0x17')];var _0x982a4c=_0x5481bf?_0x354ebb['count']:_0x4636a9[_0xc935('0x17')]+_0x4636a9['limit'];var _0x472013;if(_0x982a4c>=_0x3e3b9c){_0x982a4c=_0x3e3b9c;_0x472013=0xc8;}else{_0x472013=0xce;}_0x1d2697['status'](_0x472013);return _0x1d2697[_0xc935('0x1a')](_0xc935('0x1b'),_0x19abaa+'-'+_0x982a4c+'/'+_0x3e3b9c)['json'](_0x354ebb);}return null;};}function patchUpdates(_0x13c62d){return function(_0x23e52e){try{jsonpatch[_0xc935('0x1c')](_0x23e52e,_0x13c62d,!![]);}catch(_0xfdf13){return BPromise[_0xc935('0x1d')](_0xfdf13);}return _0x23e52e[_0xc935('0x1e')]();};}function saveUpdates(_0x71219e,_0x32af46){return function(_0x3b4083){if(_0x3b4083){return _0x3b4083[_0xc935('0x1f')](_0x71219e)[_0xc935('0x20')](function(_0x8b665){return _0x8b665;});}return null;};}function removeEntity(_0xfa5135,_0x387a08){return function(_0x37aad3){if(_0x37aad3){return _0x37aad3['destroy']()[_0xc935('0x20')](function(){_0xfa5135[_0xc935('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x274fc0,_0x2b1bb2){return function(_0x4ec613){if(!_0x4ec613){_0x274fc0[_0xc935('0x21')](0x194);}return _0x4ec613;};}function handleError(_0x506617,_0x5b5461){_0x5b5461=_0x5b5461||0x1f4;return function(_0x23f2af){logger[_0xc935('0x22')](_0x23f2af[_0xc935('0x23')]);if(_0x23f2af[_0xc935('0x24')]){delete _0x23f2af[_0xc935('0x24')];}_0x506617[_0xc935('0x15')](_0x5b5461)[_0xc935('0x25')](_0x23f2af);};}exports['index']=function(_0x5929af,_0x49c4ae){var _0xa59785={},_0x507a21={},_0x368e65={'count':0x0,'rows':[]};var _0x3ed1fb=_['map'](db[_0xc935('0x26')][_0xc935('0x27')],function(_0xa55f5f){return{'name':_0xa55f5f[_0xc935('0x28')],'type':_0xa55f5f['type'][_0xc935('0x29')]};});_0x507a21[_0xc935('0x2a')]=_['map'](_0x3ed1fb,'name');_0x507a21[_0xc935('0x2b')]=_[_0xc935('0x2c')](_0x5929af[_0xc935('0x2b')]);_0x507a21[_0xc935('0x2d')]=_[_0xc935('0x2e')](_0x507a21[_0xc935('0x2a')],_0x507a21[_0xc935('0x2b')]);_0xa59785['attributes']=_['intersection'](_0x507a21[_0xc935('0x2a')],qs[_0xc935('0x2f')](_0x5929af[_0xc935('0x2b')][_0xc935('0x2f')]));_0xa59785[_0xc935('0x30')]=_0xa59785[_0xc935('0x30')][_0xc935('0x31')]?_0xa59785[_0xc935('0x30')]:_0x507a21[_0xc935('0x2a')];if(!_0x5929af['query'][_0xc935('0x32')](_0xc935('0x33'))){_0xa59785[_0xc935('0x19')]=qs[_0xc935('0x19')](_0x5929af[_0xc935('0x2b')][_0xc935('0x19')]);_0xa59785[_0xc935('0x17')]=qs['offset'](_0x5929af[_0xc935('0x2b')]['offset']);}_0xa59785['order']=qs[_0xc935('0x34')](_0x5929af['query'][_0xc935('0x34')]);_0xa59785[_0xc935('0x35')]=qs[_0xc935('0x2d')](_[_0xc935('0x36')](_0x5929af[_0xc935('0x2b')],_0x507a21[_0xc935('0x2d')]),_0x3ed1fb);if(_0x5929af[_0xc935('0x2b')][_0xc935('0x37')]){_0xa59785[_0xc935('0x35')]=_[_0xc935('0x38')](_0xa59785['where'],{'$or':_['map'](_0x3ed1fb,function(_0xd4936){if(_0xd4936[_0xc935('0x39')]!==_0xc935('0x3a')){var _0x108f4f={};_0x108f4f[_0xd4936[_0xc935('0x24')]]={'$like':'%'+_0x5929af[_0xc935('0x2b')][_0xc935('0x37')]+'%'};return _0x108f4f;}})});}_0xa59785=_[_0xc935('0x38')]({},_0xa59785,_0x5929af[_0xc935('0x3b')]);var _0x20bd31={'where':_0xa59785[_0xc935('0x35')]};return db['IntegrationReport'][_0xc935('0x3c')](_0x20bd31)[_0xc935('0x20')](function(_0x45bf2b){_0x368e65['count']=_0x45bf2b;if(_0x5929af[_0xc935('0x2b')][_0xc935('0x3d')]){_0xa59785[_0xc935('0x3e')]=[{'all':!![]}];}return db[_0xc935('0x26')][_0xc935('0x3f')](_0xa59785);})[_0xc935('0x20')](function(_0x52f794){_0x368e65[_0xc935('0x40')]=_0x52f794;return _0x368e65;})[_0xc935('0x20')](respondWithFilteredResult(_0x49c4ae,_0xa59785))[_0xc935('0x41')](handleError(_0x49c4ae,null));};exports[_0xc935('0x42')]=function(_0x228d7b,_0x1e1ed7){var _0x44dd69={'raw':![],'where':{'id':_0x228d7b[_0xc935('0x43')]['id']}},_0x686ca8={};_0x686ca8[_0xc935('0x2a')]=_[_0xc935('0x2c')](db[_0xc935('0x26')]['rawAttributes']);_0x686ca8['query']=_[_0xc935('0x2c')](_0x228d7b[_0xc935('0x2b')]);_0x686ca8[_0xc935('0x2d')]=_[_0xc935('0x2e')](_0x686ca8[_0xc935('0x2a')],_0x686ca8[_0xc935('0x2b')]);_0x44dd69[_0xc935('0x30')]=_[_0xc935('0x2e')](_0x686ca8[_0xc935('0x2a')],qs[_0xc935('0x2f')](_0x228d7b['query'][_0xc935('0x2f')]));_0x44dd69[_0xc935('0x30')]=_0x44dd69[_0xc935('0x30')]['length']?_0x44dd69[_0xc935('0x30')]:_0x686ca8[_0xc935('0x2a')];if(_0x228d7b[_0xc935('0x2b')][_0xc935('0x3d')]){_0x44dd69['include']=[{'all':!![]}];}_0x44dd69=_['merge']({},_0x44dd69,_0x228d7b[_0xc935('0x3b')]);return db['IntegrationReport'][_0xc935('0x44')](_0x44dd69)[_0xc935('0x20')](handleEntityNotFound(_0x1e1ed7,null))[_0xc935('0x20')](respondWithResult(_0x1e1ed7,null))[_0xc935('0x41')](handleError(_0x1e1ed7,null));};exports[_0xc935('0x45')]=function(_0x13c0f3,_0x34aec3){return db[_0xc935('0x26')][_0xc935('0x45')](_0x13c0f3['body'],{})[_0xc935('0x20')](respondWithResult(_0x34aec3,0xc9))[_0xc935('0x41')](handleError(_0x34aec3,null));};exports['update']=function(_0x29f18a,_0x2e4bed){if(_0x29f18a['body']['id']){delete _0x29f18a['body']['id'];}return db[_0xc935('0x26')]['find']({'where':{'id':_0x29f18a['params']['id']}})['then'](handleEntityNotFound(_0x2e4bed,null))[_0xc935('0x20')](saveUpdates(_0x29f18a['body'],null))[_0xc935('0x20')](respondWithResult(_0x2e4bed,null))[_0xc935('0x41')](handleError(_0x2e4bed,null));};exports[_0xc935('0x46')]=function(_0x3cb0f7,_0x29d528){return db['IntegrationReport'][_0xc935('0x44')]({'where':{'id':_0x3cb0f7[_0xc935('0x43')]['id']}})['then'](handleEntityNotFound(_0x29d528,null))['then'](removeEntity(_0x29d528,null))['catch'](handleError(_0x29d528,null));};exports[_0xc935('0x47')]=function(_0x4df8b0,_0x17125b){return db['IntegrationReport'][_0xc935('0x47')]()[_0xc935('0x20')](respondWithResult(_0x17125b,null))[_0xc935('0x41')](handleError(_0x17125b,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index ec9a454..7c1baff 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 _0xf9a3=['util','../../config/logger','api','bluebird','request-promise','path','exports','define','lodash'];(function(_0x4e3ee6,_0x1cac16){var _0x3a1887=function(_0x1d4b44){while(--_0x1d4b44){_0x4e3ee6['push'](_0x4e3ee6['shift']());}};_0x3a1887(++_0x1cac16);}(_0xf9a3,0x1e5));var _0x3f9a=function(_0x23fd7b,_0x414482){_0x23fd7b=_0x23fd7b-0x0;var _0x3d439d=_0xf9a3[_0x23fd7b];return _0x3d439d;};'use strict';var _=require(_0x3f9a('0x0'));var util=require(_0x3f9a('0x1'));var logger=require(_0x3f9a('0x2'))(_0x3f9a('0x3'));var moment=require('moment');var BPromise=require(_0x3f9a('0x4'));var rp=require(_0x3f9a('0x5'));var fs=require('fs');var path=require(_0x3f9a('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x3f9a('0x7')]=function(_0x3166fc,_0x3bb18c){return _0x3166fc[_0x3f9a('0x8')]('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8798=['./integrationReport.attributes','exports','define','report_integration','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8798,0x130));var _0x8879=function(_0x309dfa,_0x2555d0){_0x309dfa=_0x309dfa-0x0;var _0x7462c8=_0x8798[_0x309dfa];return _0x7462c8;};'use strict';var _=require(_0x8879('0x0'));var util=require(_0x8879('0x1'));var logger=require(_0x8879('0x2'))(_0x8879('0x3'));var moment=require('moment');var BPromise=require(_0x8879('0x4'));var rp=require(_0x8879('0x5'));var fs=require('fs');var path=require(_0x8879('0x6'));var rimraf=require('rimraf');var config=require(_0x8879('0x7'));var attributes=require(_0x8879('0x8'));module[_0x8879('0x9')]=function(_0x438b9b,_0x316b8){return _0x438b9b[_0x8879('0xa')]('IntegrationReport',attributes,{'tableName':_0x8879('0xb'),'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 624f2e8..ad96d63 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 _0xe2fe=['then','info','IntegrationReport,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x1baef8,_0x5f256c){var _0x9eb2eb=function(_0x4a0d4d){while(--_0x4a0d4d){_0x1baef8['push'](_0x1baef8['shift']());}};_0x9eb2eb(++_0x5f256c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +var _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0xc2c7,0x134));var _0x7c2c=function(_0x38c43d,_0x46c1b3){_0x38c43d=_0x38c43d-0x0;var _0x3a36ba=_0xc2c7[_0x38c43d];return _0x3a36ba;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 7321d04..c61a1ca 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 _0xdedc=['create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','/:id','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','index','isAuthenticated','/:id/sub_intervals','post'];(function(_0xdf3126,_0x2b9835){var _0x45d4b5=function(_0x24e108){while(--_0x24e108){_0xdf3126['push'](_0xdf3126['shift']());}};_0x45d4b5(++_0x2b9835);}(_0xdedc,0xb8));var _0xcded=function(_0x4dd15b,_0x1d880a){_0x4dd15b=_0x4dd15b-0x0;var _0x2445f2=_0xdedc[_0x4dd15b];return _0x2445f2;};'use strict';var multer=require(_0xcded('0x0'));var util=require(_0xcded('0x1'));var path=require(_0xcded('0x2'));var timeout=require(_0xcded('0x3'));var express=require(_0xcded('0x4'));var router=express['Router']();var fs_extra=require(_0xcded('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcded('0x6'));var config=require(_0xcded('0x7'));var controller=require(_0xcded('0x8'));router[_0xcded('0x9')]('/',auth['isAuthenticated'](),controller[_0xcded('0xa')]);router[_0xcded('0x9')]('/:id',auth[_0xcded('0xb')](),controller['show']);router['get'](_0xcded('0xc'),auth['isAuthenticated'](),controller['getIntervals']);router[_0xcded('0xd')]('/',auth[_0xcded('0xb')](),controller[_0xcded('0xe')]);router['post'](_0xcded('0xc'),auth[_0xcded('0xb')](),controller[_0xcded('0xf')]);router[_0xcded('0xd')](_0xcded('0x10'),auth['isAuthenticated'](),controller[_0xcded('0x11')]);router[_0xcded('0x12')](_0xcded('0x13'),auth[_0xcded('0xb')](),controller['update']);router[_0xcded('0x14')](_0xcded('0x13'),auth[_0xcded('0xb')](),controller['destroy']);module[_0xcded('0x15')]=router; \ No newline at end of file +var _0xc57c=['addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','multer','express','../../components/auth/service','../../config/environment','./interval.controller','get','isAuthenticated','index','/:id','show','/:id/sub_intervals','getIntervals','post'];(function(_0x160f2a,_0x4df30f){var _0x39f3d7=function(_0x3d8a87){while(--_0x3d8a87){_0x160f2a['push'](_0x160f2a['shift']());}};_0x39f3d7(++_0x4df30f);}(_0xc57c,0x149));var _0xcc57=function(_0x5b46fc,_0x49708a){_0x5b46fc=_0x5b46fc-0x0;var _0x52ae60=_0xc57c[_0x5b46fc];return _0x52ae60;};'use strict';var multer=require(_0xcc57('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcc57('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcc57('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0xcc57('0x3'));var controller=require(_0xcc57('0x4'));router[_0xcc57('0x5')]('/',auth[_0xcc57('0x6')](),controller[_0xcc57('0x7')]);router[_0xcc57('0x5')](_0xcc57('0x8'),auth['isAuthenticated'](),controller[_0xcc57('0x9')]);router[_0xcc57('0x5')](_0xcc57('0xa'),auth[_0xcc57('0x6')](),controller[_0xcc57('0xb')]);router[_0xcc57('0xc')]('/',auth[_0xcc57('0x6')](),controller['create']);router['post']('/:id/sub_intervals',auth[_0xcc57('0x6')](),controller[_0xcc57('0xd')]);router[_0xcc57('0xc')](_0xcc57('0xe'),auth[_0xcc57('0x6')](),controller[_0xcc57('0xf')]);router[_0xcc57('0x10')](_0xcc57('0x8'),auth[_0xcc57('0x6')](),controller[_0xcc57('0x11')]);router[_0xcc57('0x12')](_0xcc57('0x8'),auth[_0xcc57('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index b73fe90..79d8e73 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 _0xcf72=['exports','STRING'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xcf72,0x92));var _0x2cf7=function(_0xc89257,_0x5a5801){_0xc89257=_0xc89257-0x0;var _0x164ae3=_0xcf72[_0xc89257];return _0x164ae3;};'use strict';var Sequelize=require('sequelize');module[_0x2cf7('0x0')]={'name':{'type':Sequelize[_0x2cf7('0x1')]},'description':{'type':Sequelize[_0x2cf7('0x1')]},'interval':{'type':Sequelize[_0x2cf7('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x821d=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x821d,0x1c5));var _0xd821=function(_0x90312e,_0x47b8d1){_0x90312e=_0x90312e-0x0;var _0xc780bd=_0x821d[_0x90312e];return _0xc780bd;};'use strict';var Sequelize=require(_0xd821('0x0'));module[_0xd821('0x1')]={'name':{'type':Sequelize[_0xd821('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd821('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 9c116ea..7103527 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 _0x6c3e=['rimraf','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','end','error','send','index','map','Interval','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','IntervalId','getIntervals','rawAttributes','addIntervals','sequelize','transaction','eml-format'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x6c3e,0x1c6));var _0xe6c3=function(_0x345338,_0x1542a3){_0x345338=_0x345338-0x0;var _0x280312=_0x6c3e[_0x345338];return _0x280312;};'use strict';var emlformat=require(_0xe6c3('0x0'));var rimraf=require(_0xe6c3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6c3('0x2'));var rp=require('request-promise');var moment=require(_0xe6c3('0x3'));var BPromise=require(_0xe6c3('0x4'));var Mustache=require('mustache');var util=require(_0xe6c3('0x5'));var path=require(_0xe6c3('0x6'));var sox=require(_0xe6c3('0x7'));var csv=require('to-csv');var ejs=require(_0xe6c3('0x8'));var fs=require('fs');var fs_extra=require(_0xe6c3('0x9'));var _=require(_0xe6c3('0xa'));var squel=require('squel');var crypto=require(_0xe6c3('0xb'));var jsforce=require(_0xe6c3('0xc'));var deskjs=require(_0xe6c3('0xd'));var toCsv=require(_0xe6c3('0xe'));var querystring=require('querystring');var Papa=require(_0xe6c3('0xf'));var Redis=require(_0xe6c3('0x10'));var authService=require(_0xe6c3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe6c3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe6c3('0x13'))(_0xe6c3('0x14'));var utils=require(_0xe6c3('0x15'));var config=require(_0xe6c3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6c3('0x17'))['db'];var extensions=require(_0xe6c3('0x18'));function respondWithStatusCode(_0x1e635a,_0x6a3cb3){_0x6a3cb3=_0x6a3cb3||0xcc;return function(_0x9c28c3){if(_0x9c28c3){return _0x1e635a[_0xe6c3('0x19')](_0x6a3cb3);}return _0x1e635a['status'](_0x6a3cb3)['end']();};}function respondWithResult(_0x26589e,_0xfc1cd0){_0xfc1cd0=_0xfc1cd0||0xc8;return function(_0x22d2b0){if(_0x22d2b0){return _0x26589e[_0xe6c3('0x1a')](_0xfc1cd0)[_0xe6c3('0x1b')](_0x22d2b0);}};}function respondWithFilteredResult(_0x33783f,_0x210202){return function(_0x430ab6){if(_0x430ab6){var _0x15dd6f=typeof _0x210202[_0xe6c3('0x1c')]==='undefined'&&typeof _0x210202['limit']===_0xe6c3('0x1d');var _0x13015b=_0x430ab6['count'];var _0x6cb8dd=_0x15dd6f?0x0:_0x210202['offset'];var _0x522b0e=_0x15dd6f?_0x430ab6[_0xe6c3('0x1e')]:_0x210202[_0xe6c3('0x1c')]+_0x210202['limit'];var _0x83d30e;if(_0x522b0e>=_0x13015b){_0x522b0e=_0x13015b;_0x83d30e=0xc8;}else{_0x83d30e=0xce;}_0x33783f[_0xe6c3('0x1a')](_0x83d30e);return _0x33783f[_0xe6c3('0x1f')](_0xe6c3('0x20'),_0x6cb8dd+'-'+_0x522b0e+'/'+_0x13015b)[_0xe6c3('0x1b')](_0x430ab6);}return null;};}function patchUpdates(_0x1fdeb2){return function(_0x1eff35){try{jsonpatch[_0xe6c3('0x21')](_0x1eff35,_0x1fdeb2,!![]);}catch(_0x1d90b1){return BPromise[_0xe6c3('0x22')](_0x1d90b1);}return _0x1eff35[_0xe6c3('0x23')]();};}function saveUpdates(_0x39756a,_0x5976c4){return function(_0x22ca8f){if(_0x22ca8f){return _0x22ca8f[_0xe6c3('0x24')](_0x39756a)[_0xe6c3('0x25')](function(_0x2afdd2){return _0x2afdd2;});}return null;};}function removeEntity(_0x5cb509,_0x538481){return function(_0x396e62){if(_0x396e62){return _0x396e62[_0xe6c3('0x26')]()['then'](function(){var _0x422e08=_0x396e62[_0xe6c3('0x27')]({'plain':!![]});var _0x24c481=_0xe6c3('0x28');return db['UserProfileResource'][_0xe6c3('0x26')]({'where':{'type':_0x24c481,'resourceId':_0x422e08['id']}})[_0xe6c3('0x25')](function(){return _0x396e62;});})[_0xe6c3('0x25')](function(){_0x5cb509['status'](0xcc)[_0xe6c3('0x29')]();});}};}function handleEntityNotFound(_0x5a7e89,_0x541a37){return function(_0x225961){if(!_0x225961){_0x5a7e89['sendStatus'](0x194);}return _0x225961;};}function handleError(_0x3991b6,_0x783c41){_0x783c41=_0x783c41||0x1f4;return function(_0x42ce72){logger[_0xe6c3('0x2a')](_0x42ce72['stack']);if(_0x42ce72['name']){delete _0x42ce72['name'];}_0x3991b6[_0xe6c3('0x1a')](_0x783c41)[_0xe6c3('0x2b')](_0x42ce72);};}exports[_0xe6c3('0x2c')]=function(_0x3df1cb,_0x18a2a4){var _0x58a621={},_0x3affbe={},_0x3e26c1={'count':0x0,'rows':[]};var _0x124604=_[_0xe6c3('0x2d')](db[_0xe6c3('0x2e')]['rawAttributes'],function(_0x1ce4cf){return{'name':_0x1ce4cf['fieldName'],'type':_0x1ce4cf[_0xe6c3('0x2f')][_0xe6c3('0x30')]};});_0x3affbe[_0xe6c3('0x31')]=_[_0xe6c3('0x2d')](_0x124604,_0xe6c3('0x32'));_0x3affbe['query']=_[_0xe6c3('0x33')](_0x3df1cb[_0xe6c3('0x34')]);_0x3affbe[_0xe6c3('0x35')]=_[_0xe6c3('0x36')](_0x3affbe['model'],_0x3affbe[_0xe6c3('0x34')]);_0x58a621[_0xe6c3('0x37')]=_[_0xe6c3('0x36')](_0x3affbe[_0xe6c3('0x31')],qs['fields'](_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x38')]));_0x58a621['attributes']=_0x58a621[_0xe6c3('0x37')][_0xe6c3('0x39')]?_0x58a621[_0xe6c3('0x37')]:_0x3affbe[_0xe6c3('0x31')];if(!_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x3a')](_0xe6c3('0x3b'))){_0x58a621['limit']=qs[_0xe6c3('0x3c')](_0x3df1cb[_0xe6c3('0x34')]['limit']);_0x58a621[_0xe6c3('0x1c')]=qs[_0xe6c3('0x1c')](_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x1c')]);}_0x58a621[_0xe6c3('0x3d')]=qs[_0xe6c3('0x3e')](_0x3df1cb['query'][_0xe6c3('0x3e')]);_0x58a621[_0xe6c3('0x3f')]=qs[_0xe6c3('0x35')](_[_0xe6c3('0x40')](_0x3df1cb[_0xe6c3('0x34')],_0x3affbe['filters']),_0x124604);if(_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x41')]){_0x58a621[_0xe6c3('0x3f')]=_['merge'](_0x58a621[_0xe6c3('0x3f')],{'$or':_[_0xe6c3('0x2d')](_0x124604,function(_0x2c9a35){if(_0x2c9a35[_0xe6c3('0x2f')]!==_0xe6c3('0x42')){var _0x10ddd4={};_0x10ddd4[_0x2c9a35[_0xe6c3('0x32')]]={'$like':'%'+_0x3df1cb['query'][_0xe6c3('0x41')]+'%'};return _0x10ddd4;}})});}_0x58a621=_[_0xe6c3('0x43')]({},_0x58a621,_0x3df1cb[_0xe6c3('0x44')]);var _0x4db62f={'where':_0x58a621[_0xe6c3('0x3f')]};return db[_0xe6c3('0x2e')]['count'](_0x4db62f)['then'](function(_0x19e3ad){_0x3e26c1[_0xe6c3('0x1e')]=_0x19e3ad;if(_0x3df1cb[_0xe6c3('0x34')][_0xe6c3('0x45')]){_0x58a621[_0xe6c3('0x46')]=[{'all':!![]}];}return db['Interval'][_0xe6c3('0x47')](_0x58a621);})[_0xe6c3('0x25')](function(_0x42e7fe){_0x3e26c1[_0xe6c3('0x48')]=_0x42e7fe;return _0x3e26c1;})[_0xe6c3('0x25')](respondWithFilteredResult(_0x18a2a4,_0x58a621))[_0xe6c3('0x49')](handleError(_0x18a2a4,null));};exports[_0xe6c3('0x4a')]=function(_0x8038be,_0x47e711){var _0x31eb77={'raw':!![],'where':{'id':_0x8038be[_0xe6c3('0x4b')]['id']}},_0x408e09={};_0x408e09[_0xe6c3('0x31')]=_[_0xe6c3('0x33')](db[_0xe6c3('0x2e')]['rawAttributes']);_0x408e09['query']=_[_0xe6c3('0x33')](_0x8038be[_0xe6c3('0x34')]);_0x408e09[_0xe6c3('0x35')]=_[_0xe6c3('0x36')](_0x408e09[_0xe6c3('0x31')],_0x408e09[_0xe6c3('0x34')]);_0x31eb77[_0xe6c3('0x37')]=_['intersection'](_0x408e09[_0xe6c3('0x31')],qs['fields'](_0x8038be[_0xe6c3('0x34')][_0xe6c3('0x38')]));_0x31eb77['attributes']=_0x31eb77['attributes']['length']?_0x31eb77[_0xe6c3('0x37')]:_0x408e09[_0xe6c3('0x31')];if(_0x8038be[_0xe6c3('0x34')]['includeAll']){_0x31eb77['include']=[{'all':!![]}];}_0x31eb77=_[_0xe6c3('0x43')]({},_0x31eb77,_0x8038be[_0xe6c3('0x44')]);return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')](_0x31eb77)['then'](handleEntityNotFound(_0x47e711,null))[_0xe6c3('0x25')](respondWithResult(_0x47e711,null))[_0xe6c3('0x49')](handleError(_0x47e711,null));};exports[_0xe6c3('0x4d')]=function(_0x396906,_0xe5a557){return db[_0xe6c3('0x2e')][_0xe6c3('0x4d')](_0x396906[_0xe6c3('0x4e')],{})[_0xe6c3('0x25')](function(_0x5aad18){var _0x3f3a8f=_0x396906['user'][_0xe6c3('0x27')]({'plain':!![]});if(!_0x3f3a8f)throw new Error(_0xe6c3('0x4f'));if(_0x3f3a8f[_0xe6c3('0x50')]==='user'){var _0x1f393b=_0x5aad18[_0xe6c3('0x27')]({'plain':!![]});var _0x923583=_0xe6c3('0x28');return db[_0xe6c3('0x51')][_0xe6c3('0x4c')]({'where':{'name':_0x923583,'userProfileId':_0x3f3a8f[_0xe6c3('0x52')]},'raw':!![]})[_0xe6c3('0x25')](function(_0x2cbac8){if(_0x2cbac8&&_0x2cbac8['autoAssociation']===0x0){return db['UserProfileResource'][_0xe6c3('0x4d')]({'name':_0x1f393b[_0xe6c3('0x32')],'resourceId':_0x1f393b['id'],'type':_0x2cbac8[_0xe6c3('0x32')],'sectionId':_0x2cbac8['id']},{})['then'](function(){return _0x5aad18;});}else{return _0x5aad18;}})[_0xe6c3('0x49')](function(_0x5d92e2){logger['error'](_0xe6c3('0x53'),_0x5d92e2);throw _0x5d92e2;});}return _0x5aad18;})[_0xe6c3('0x25')](respondWithResult(_0xe5a557,0xc9))[_0xe6c3('0x49')](handleError(_0xe5a557,null));};exports['update']=function(_0x165ad5,_0x93c655){if(_0x165ad5[_0xe6c3('0x4e')]['id']){delete _0x165ad5['body']['id'];}return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')]({'where':{'id':_0x165ad5[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x93c655,null))[_0xe6c3('0x25')](saveUpdates(_0x165ad5[_0xe6c3('0x4e')],null))[_0xe6c3('0x25')](respondWithResult(_0x93c655,null))[_0xe6c3('0x49')](handleError(_0x93c655,null));};exports[_0xe6c3('0x26')]=function(_0x4152dc,_0x3ad262){return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')]({'where':{'id':_0x4152dc[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x3ad262,null))[_0xe6c3('0x25')](removeEntity(_0x3ad262,null))[_0xe6c3('0x49')](handleError(_0x3ad262,null));};exports[_0xe6c3('0x54')]=function(_0x1b60f0,_0x48a0b9,_0x3390b6){if(_0x1b60f0[_0xe6c3('0x4e')]['id']){delete _0x1b60f0[_0xe6c3('0x4e')]['id'];}return db[_0xe6c3('0x2e')][_0xe6c3('0x4c')]({'where':{'id':_0x1b60f0[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x48a0b9,null))[_0xe6c3('0x25')](function(_0x6f6856){if(_0x6f6856){_0x1b60f0['body'][_0xe6c3('0x55')]=_0x6f6856['id'];return db['Interval'][_0xe6c3('0x4d')](_0x1b60f0[_0xe6c3('0x4e')]);}})['then'](respondWithResult(_0x48a0b9,null))[_0xe6c3('0x49')](handleError(_0x48a0b9,null));};exports[_0xe6c3('0x56')]=function(_0x1d77de,_0x14b20b,_0x3f3ff2){var _0x4e2983={};var _0x58433c={};var _0x413f9b;var _0x23731f;return db[_0xe6c3('0x2e')]['findOne']({'where':{'id':_0x1d77de[_0xe6c3('0x4b')]['id']}})[_0xe6c3('0x25')](handleEntityNotFound(_0x14b20b,null))[_0xe6c3('0x25')](function(_0x2fb4f5){if(_0x2fb4f5){_0x413f9b=_0x2fb4f5;_0x58433c['model']=_[_0xe6c3('0x33')](db[_0xe6c3('0x2e')][_0xe6c3('0x57')]);_0x58433c['query']=_[_0xe6c3('0x33')](_0x1d77de[_0xe6c3('0x34')]);_0x58433c[_0xe6c3('0x35')]=_[_0xe6c3('0x36')](_0x58433c[_0xe6c3('0x31')],_0x58433c['query']);_0x4e2983[_0xe6c3('0x37')]=_[_0xe6c3('0x36')](_0x58433c[_0xe6c3('0x31')],qs[_0xe6c3('0x38')](_0x1d77de['query'][_0xe6c3('0x38')]));_0x4e2983[_0xe6c3('0x37')]=_0x4e2983[_0xe6c3('0x37')][_0xe6c3('0x39')]?_0x4e2983['attributes']:_0x58433c[_0xe6c3('0x31')];_0x4e2983[_0xe6c3('0x3d')]=qs[_0xe6c3('0x3e')](_0x1d77de[_0xe6c3('0x34')][_0xe6c3('0x3e')]);_0x4e2983[_0xe6c3('0x3f')]=qs[_0xe6c3('0x35')](_[_0xe6c3('0x40')](_0x1d77de[_0xe6c3('0x34')],_0x58433c[_0xe6c3('0x35')]));if(_0x1d77de[_0xe6c3('0x34')]['filter']){_0x4e2983[_0xe6c3('0x3f')]=_[_0xe6c3('0x43')](_0x4e2983['where'],{'$or':_[_0xe6c3('0x2d')](_0x4e2983[_0xe6c3('0x37')],function(_0x19dffb){var _0x2cad41={};_0x2cad41[_0x19dffb]={'$like':'%'+_0x1d77de[_0xe6c3('0x34')]['filter']+'%'};return _0x2cad41;})});}_0x4e2983=_[_0xe6c3('0x43')]({},_0x4e2983,_0x1d77de[_0xe6c3('0x44')]);return _0x413f9b['getIntervals'](_0x4e2983);}})[_0xe6c3('0x25')](function(_0x22f931){if(_0x22f931){_0x23731f=_0x22f931['length'];if(!_0x1d77de[_0xe6c3('0x34')]['hasOwnProperty']('nolimit')){_0x4e2983[_0xe6c3('0x3c')]=qs[_0xe6c3('0x3c')](_0x1d77de[_0xe6c3('0x34')][_0xe6c3('0x3c')]);_0x4e2983[_0xe6c3('0x1c')]=qs[_0xe6c3('0x1c')](_0x1d77de[_0xe6c3('0x34')][_0xe6c3('0x1c')]);}return _0x413f9b[_0xe6c3('0x56')](_0x4e2983);}})[_0xe6c3('0x25')](function(_0x1fc3f3){if(_0x1fc3f3){return _0x1fc3f3?{'count':_0x23731f,'rows':_0x1fc3f3}:null;}})[_0xe6c3('0x25')](respondWithResult(_0x14b20b,null))[_0xe6c3('0x49')](handleError(_0x14b20b,null));};exports[_0xe6c3('0x58')]=function(_0x268796,_0x2eb516,_0x591818){return db[_0xe6c3('0x2e')]['findOne']({'where':{'id':_0x268796[_0xe6c3('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2eb516,null))['then'](function(_0x330a20){if(_0x330a20){return db[_0xe6c3('0x59')][_0xe6c3('0x5a')](function(_0x5350b4){return db['Interval'][_0xe6c3('0x26')]({'where':{'IntervalId':_0x268796['params']['id']},'transaction':_0x5350b4})[_0xe6c3('0x25')](function(_0x103505){var _0x1c0b1f=_[_0xe6c3('0x2d')](_0x268796[_0xe6c3('0x4e')],function(_0x41a2aa){delete _0x41a2aa['id'];_0x41a2aa[_0xe6c3('0x55')]=_0x268796[_0xe6c3('0x4b')]['id'];return _0x41a2aa;});return db[_0xe6c3('0x2e')]['bulkCreate'](_0x1c0b1f,{'transaction':_0x5350b4});});})['then'](function(){return db[_0xe6c3('0x2e')][_0xe6c3('0x47')]({'where':{'IntervalId':_0x268796[_0xe6c3('0x4b')]['id']}});});}})['then'](respondWithResult(_0x2eb516,null))[_0xe6c3('0x49')](handleError(_0x2eb516,null));}; \ No newline at end of file +var _0xb8ef=['Interval','findAll','rows','show','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Intervals','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','IntervalId','getIntervals','findOne','hasOwnProperty','sequelize','transaction','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../components/extensions/rewrite','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','UserProfileResource','destroy','sendStatus','error','stack','name','index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include'];(function(_0x194301,_0x3e1349){var _0x2b951b=function(_0x5ae718){while(--_0x5ae718){_0x194301['push'](_0x194301['shift']());}};_0x2b951b(++_0x3e1349);}(_0xb8ef,0xca));var _0xfb8e=function(_0x375ab0,_0xc9394){_0x375ab0=_0x375ab0-0x0;var _0x39a7fc=_0xb8ef[_0x375ab0];return _0x39a7fc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb8e('0x0'));var zipdir=require(_0xfb8e('0x1'));var jsonpatch=require(_0xfb8e('0x2'));var rp=require(_0xfb8e('0x3'));var moment=require(_0xfb8e('0x4'));var BPromise=require(_0xfb8e('0x5'));var Mustache=require(_0xfb8e('0x6'));var util=require(_0xfb8e('0x7'));var path=require('path');var sox=require(_0xfb8e('0x8'));var csv=require(_0xfb8e('0x9'));var ejs=require(_0xfb8e('0xa'));var fs=require('fs');var fs_extra=require(_0xfb8e('0xb'));var _=require(_0xfb8e('0xc'));var squel=require(_0xfb8e('0xd'));var crypto=require(_0xfb8e('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfb8e('0x9'));var querystring=require(_0xfb8e('0xf'));var Papa=require(_0xfb8e('0x10'));var Redis=require(_0xfb8e('0x11'));var authService=require(_0xfb8e('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb8e('0x13'));var logger=require('../../config/logger')(_0xfb8e('0x14'));var utils=require(_0xfb8e('0x15'));var config=require(_0xfb8e('0x16'));var licenseUtil=require(_0xfb8e('0x17'));var db=require('../../mysqldb')['db'];var extensions=require(_0xfb8e('0x18'));function respondWithStatusCode(_0x48de38,_0xb090e3){_0xb090e3=_0xb090e3||0xcc;return function(_0x242e01){if(_0x242e01){return _0x48de38['sendStatus'](_0xb090e3);}return _0x48de38[_0xfb8e('0x19')](_0xb090e3)[_0xfb8e('0x1a')]();};}function respondWithResult(_0x5179b6,_0x4fad0e){_0x4fad0e=_0x4fad0e||0xc8;return function(_0x2ad9ab){if(_0x2ad9ab){return _0x5179b6[_0xfb8e('0x19')](_0x4fad0e)[_0xfb8e('0x1b')](_0x2ad9ab);}};}function respondWithFilteredResult(_0x36b522,_0x2f70cd){return function(_0x3e9ded){if(_0x3e9ded){var _0x180dd7=typeof _0x2f70cd[_0xfb8e('0x1c')]===_0xfb8e('0x1d')&&typeof _0x2f70cd[_0xfb8e('0x1e')]===_0xfb8e('0x1d');var _0x4f55b1=_0x3e9ded[_0xfb8e('0x1f')];var _0x3dbefa=_0x180dd7?0x0:_0x2f70cd[_0xfb8e('0x1c')];var _0x10179f=_0x180dd7?_0x3e9ded[_0xfb8e('0x1f')]:_0x2f70cd[_0xfb8e('0x1c')]+_0x2f70cd[_0xfb8e('0x1e')];var _0x4331ec;if(_0x10179f>=_0x4f55b1){_0x10179f=_0x4f55b1;_0x4331ec=0xc8;}else{_0x4331ec=0xce;}_0x36b522['status'](_0x4331ec);return _0x36b522[_0xfb8e('0x20')](_0xfb8e('0x21'),_0x3dbefa+'-'+_0x10179f+'/'+_0x4f55b1)[_0xfb8e('0x1b')](_0x3e9ded);}return null;};}function patchUpdates(_0x498d42){return function(_0x454f5a){try{jsonpatch['apply'](_0x454f5a,_0x498d42,!![]);}catch(_0x205e2b){return BPromise[_0xfb8e('0x22')](_0x205e2b);}return _0x454f5a[_0xfb8e('0x23')]();};}function saveUpdates(_0x19856e,_0x2793a4){return function(_0x20bec1){if(_0x20bec1){return _0x20bec1[_0xfb8e('0x24')](_0x19856e)[_0xfb8e('0x25')](function(_0x97c5d7){return _0x97c5d7;});}return null;};}function removeEntity(_0x169e75,_0x1ae4fa){return function(_0x61da1d){if(_0x61da1d){return _0x61da1d['destroy']()[_0xfb8e('0x25')](function(){var _0x1377af=_0x61da1d['get']({'plain':!![]});var _0x4a85d9='Intervals';return db[_0xfb8e('0x26')][_0xfb8e('0x27')]({'where':{'type':_0x4a85d9,'resourceId':_0x1377af['id']}})[_0xfb8e('0x25')](function(){return _0x61da1d;});})[_0xfb8e('0x25')](function(){_0x169e75[_0xfb8e('0x19')](0xcc)[_0xfb8e('0x1a')]();});}};}function handleEntityNotFound(_0x3dc99c,_0x51e09b){return function(_0x1357a7){if(!_0x1357a7){_0x3dc99c[_0xfb8e('0x28')](0x194);}return _0x1357a7;};}function handleError(_0x55fcdc,_0x251a87){_0x251a87=_0x251a87||0x1f4;return function(_0x436b0c){logger[_0xfb8e('0x29')](_0x436b0c[_0xfb8e('0x2a')]);if(_0x436b0c[_0xfb8e('0x2b')]){delete _0x436b0c[_0xfb8e('0x2b')];}_0x55fcdc[_0xfb8e('0x19')](_0x251a87)['send'](_0x436b0c);};}exports[_0xfb8e('0x2c')]=function(_0x3ae34e,_0x374ffb){var _0x1113f0={},_0x5c3130={},_0x2f37cb={'count':0x0,'rows':[]};var _0x40a14b=_[_0xfb8e('0x2d')](db['Interval'][_0xfb8e('0x2e')],function(_0x485320){return{'name':_0x485320[_0xfb8e('0x2f')],'type':_0x485320['type']['key']};});_0x5c3130['model']=_['map'](_0x40a14b,_0xfb8e('0x2b'));_0x5c3130[_0xfb8e('0x30')]=_[_0xfb8e('0x31')](_0x3ae34e[_0xfb8e('0x30')]);_0x5c3130[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x5c3130[_0xfb8e('0x34')],_0x5c3130[_0xfb8e('0x30')]);_0x1113f0[_0xfb8e('0x35')]=_['intersection'](_0x5c3130['model'],qs[_0xfb8e('0x36')](_0x3ae34e['query'][_0xfb8e('0x36')]));_0x1113f0[_0xfb8e('0x35')]=_0x1113f0['attributes'][_0xfb8e('0x37')]?_0x1113f0[_0xfb8e('0x35')]:_0x5c3130[_0xfb8e('0x34')];if(!_0x3ae34e[_0xfb8e('0x30')]['hasOwnProperty'](_0xfb8e('0x38'))){_0x1113f0[_0xfb8e('0x1e')]=qs['limit'](_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x1e')]);_0x1113f0[_0xfb8e('0x1c')]=qs[_0xfb8e('0x1c')](_0x3ae34e['query'][_0xfb8e('0x1c')]);}_0x1113f0[_0xfb8e('0x39')]=qs['sort'](_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x3a')]);_0x1113f0[_0xfb8e('0x3b')]=qs[_0xfb8e('0x32')](_[_0xfb8e('0x3c')](_0x3ae34e['query'],_0x5c3130[_0xfb8e('0x32')]),_0x40a14b);if(_0x3ae34e['query']['filter']){_0x1113f0[_0xfb8e('0x3b')]=_['merge'](_0x1113f0[_0xfb8e('0x3b')],{'$or':_[_0xfb8e('0x2d')](_0x40a14b,function(_0x4d232a){if(_0x4d232a[_0xfb8e('0x3d')]!==_0xfb8e('0x3e')){var _0x2b248f={};_0x2b248f[_0x4d232a['name']]={'$like':'%'+_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x3f')]+'%'};return _0x2b248f;}})});}_0x1113f0=_[_0xfb8e('0x40')]({},_0x1113f0,_0x3ae34e[_0xfb8e('0x41')]);var _0x13dbdc={'where':_0x1113f0['where']};return db['Interval']['count'](_0x13dbdc)[_0xfb8e('0x25')](function(_0xd53f42){_0x2f37cb[_0xfb8e('0x1f')]=_0xd53f42;if(_0x3ae34e[_0xfb8e('0x30')][_0xfb8e('0x42')]){_0x1113f0[_0xfb8e('0x43')]=[{'all':!![]}];}return db[_0xfb8e('0x44')][_0xfb8e('0x45')](_0x1113f0);})[_0xfb8e('0x25')](function(_0x36cf56){_0x2f37cb[_0xfb8e('0x46')]=_0x36cf56;return _0x2f37cb;})[_0xfb8e('0x25')](respondWithFilteredResult(_0x374ffb,_0x1113f0))['catch'](handleError(_0x374ffb,null));};exports[_0xfb8e('0x47')]=function(_0x1801af,_0x16b83e){var _0x9375b6={'raw':!![],'where':{'id':_0x1801af['params']['id']}},_0x1e20de={};_0x1e20de[_0xfb8e('0x34')]=_[_0xfb8e('0x31')](db[_0xfb8e('0x44')][_0xfb8e('0x2e')]);_0x1e20de[_0xfb8e('0x30')]=_['keys'](_0x1801af[_0xfb8e('0x30')]);_0x1e20de[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x1e20de[_0xfb8e('0x34')],_0x1e20de[_0xfb8e('0x30')]);_0x9375b6['attributes']=_[_0xfb8e('0x33')](_0x1e20de[_0xfb8e('0x34')],qs[_0xfb8e('0x36')](_0x1801af[_0xfb8e('0x30')]['fields']));_0x9375b6[_0xfb8e('0x35')]=_0x9375b6[_0xfb8e('0x35')][_0xfb8e('0x37')]?_0x9375b6['attributes']:_0x1e20de[_0xfb8e('0x34')];if(_0x1801af[_0xfb8e('0x30')][_0xfb8e('0x42')]){_0x9375b6[_0xfb8e('0x43')]=[{'all':!![]}];}_0x9375b6=_['merge']({},_0x9375b6,_0x1801af[_0xfb8e('0x41')]);return db['Interval'][_0xfb8e('0x48')](_0x9375b6)[_0xfb8e('0x25')](handleEntityNotFound(_0x16b83e,null))[_0xfb8e('0x25')](respondWithResult(_0x16b83e,null))[_0xfb8e('0x49')](handleError(_0x16b83e,null));};exports[_0xfb8e('0x4a')]=function(_0x45d2ed,_0x2ed50f){return db['Interval'][_0xfb8e('0x4a')](_0x45d2ed[_0xfb8e('0x4b')],{})[_0xfb8e('0x25')](function(_0xb561f9){var _0x260eda=_0x45d2ed[_0xfb8e('0x4c')][_0xfb8e('0x4d')]({'plain':!![]});if(!_0x260eda)throw new Error(_0xfb8e('0x4e'));if(_0x260eda[_0xfb8e('0x4f')]===_0xfb8e('0x4c')){var _0x38615b=_0xb561f9['get']({'plain':!![]});var _0xc04469=_0xfb8e('0x50');return db['UserProfileSection'][_0xfb8e('0x48')]({'where':{'name':_0xc04469,'userProfileId':_0x260eda['userProfileId']},'raw':!![]})[_0xfb8e('0x25')](function(_0x3a5103){if(_0x3a5103&&_0x3a5103['autoAssociation']===0x0){return db[_0xfb8e('0x26')][_0xfb8e('0x4a')]({'name':_0x38615b[_0xfb8e('0x2b')],'resourceId':_0x38615b['id'],'type':_0x3a5103[_0xfb8e('0x2b')],'sectionId':_0x3a5103['id']},{})[_0xfb8e('0x25')](function(){return _0xb561f9;});}else{return _0xb561f9;}})['catch'](function(_0x2d60ad){logger[_0xfb8e('0x29')](_0xfb8e('0x51'),_0x2d60ad);throw _0x2d60ad;});}return _0xb561f9;})[_0xfb8e('0x25')](respondWithResult(_0x2ed50f,0xc9))[_0xfb8e('0x49')](handleError(_0x2ed50f,null));};exports[_0xfb8e('0x24')]=function(_0x302db2,_0x1cadaf){if(_0x302db2[_0xfb8e('0x4b')]['id']){delete _0x302db2['body']['id'];}return db[_0xfb8e('0x44')][_0xfb8e('0x48')]({'where':{'id':_0x302db2[_0xfb8e('0x52')]['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x1cadaf,null))[_0xfb8e('0x25')](saveUpdates(_0x302db2[_0xfb8e('0x4b')],null))[_0xfb8e('0x25')](respondWithResult(_0x1cadaf,null))['catch'](handleError(_0x1cadaf,null));};exports[_0xfb8e('0x27')]=function(_0x3f2291,_0x1a885d){return db[_0xfb8e('0x44')][_0xfb8e('0x48')]({'where':{'id':_0x3f2291[_0xfb8e('0x52')]['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x1a885d,null))[_0xfb8e('0x25')](removeEntity(_0x1a885d,null))[_0xfb8e('0x49')](handleError(_0x1a885d,null));};exports['addInterval']=function(_0x5a2f95,_0x7fb113,_0x399d44){if(_0x5a2f95['body']['id']){delete _0x5a2f95['body']['id'];}return db[_0xfb8e('0x44')][_0xfb8e('0x48')]({'where':{'id':_0x5a2f95[_0xfb8e('0x52')]['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x7fb113,null))[_0xfb8e('0x25')](function(_0x1395a3){if(_0x1395a3){_0x5a2f95[_0xfb8e('0x4b')][_0xfb8e('0x53')]=_0x1395a3['id'];return db[_0xfb8e('0x44')][_0xfb8e('0x4a')](_0x5a2f95[_0xfb8e('0x4b')]);}})['then'](respondWithResult(_0x7fb113,null))[_0xfb8e('0x49')](handleError(_0x7fb113,null));};exports[_0xfb8e('0x54')]=function(_0x130293,_0x551d1b,_0xf22020){var _0x18272d={};var _0x44358e={};var _0x4c966f;var _0x5a2399;return db[_0xfb8e('0x44')][_0xfb8e('0x55')]({'where':{'id':_0x130293['params']['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x551d1b,null))['then'](function(_0x4dd047){if(_0x4dd047){_0x4c966f=_0x4dd047;_0x44358e[_0xfb8e('0x34')]=_[_0xfb8e('0x31')](db[_0xfb8e('0x44')]['rawAttributes']);_0x44358e[_0xfb8e('0x30')]=_[_0xfb8e('0x31')](_0x130293[_0xfb8e('0x30')]);_0x44358e[_0xfb8e('0x32')]=_[_0xfb8e('0x33')](_0x44358e['model'],_0x44358e[_0xfb8e('0x30')]);_0x18272d[_0xfb8e('0x35')]=_[_0xfb8e('0x33')](_0x44358e[_0xfb8e('0x34')],qs[_0xfb8e('0x36')](_0x130293['query']['fields']));_0x18272d[_0xfb8e('0x35')]=_0x18272d[_0xfb8e('0x35')][_0xfb8e('0x37')]?_0x18272d[_0xfb8e('0x35')]:_0x44358e[_0xfb8e('0x34')];_0x18272d[_0xfb8e('0x39')]=qs['sort'](_0x130293[_0xfb8e('0x30')][_0xfb8e('0x3a')]);_0x18272d[_0xfb8e('0x3b')]=qs[_0xfb8e('0x32')](_[_0xfb8e('0x3c')](_0x130293[_0xfb8e('0x30')],_0x44358e[_0xfb8e('0x32')]));if(_0x130293[_0xfb8e('0x30')][_0xfb8e('0x3f')]){_0x18272d[_0xfb8e('0x3b')]=_[_0xfb8e('0x40')](_0x18272d[_0xfb8e('0x3b')],{'$or':_[_0xfb8e('0x2d')](_0x18272d[_0xfb8e('0x35')],function(_0x53aa7b){var _0x518e3f={};_0x518e3f[_0x53aa7b]={'$like':'%'+_0x130293[_0xfb8e('0x30')][_0xfb8e('0x3f')]+'%'};return _0x518e3f;})});}_0x18272d=_[_0xfb8e('0x40')]({},_0x18272d,_0x130293[_0xfb8e('0x41')]);return _0x4c966f[_0xfb8e('0x54')](_0x18272d);}})[_0xfb8e('0x25')](function(_0x13a6a6){if(_0x13a6a6){_0x5a2399=_0x13a6a6[_0xfb8e('0x37')];if(!_0x130293[_0xfb8e('0x30')][_0xfb8e('0x56')](_0xfb8e('0x38'))){_0x18272d['limit']=qs[_0xfb8e('0x1e')](_0x130293[_0xfb8e('0x30')]['limit']);_0x18272d[_0xfb8e('0x1c')]=qs[_0xfb8e('0x1c')](_0x130293[_0xfb8e('0x30')]['offset']);}return _0x4c966f[_0xfb8e('0x54')](_0x18272d);}})[_0xfb8e('0x25')](function(_0x3dba40){if(_0x3dba40){return _0x3dba40?{'count':_0x5a2399,'rows':_0x3dba40}:null;}})[_0xfb8e('0x25')](respondWithResult(_0x551d1b,null))[_0xfb8e('0x49')](handleError(_0x551d1b,null));};exports['addIntervals']=function(_0xa9a79d,_0x456e8d,_0x23dc5e){return db[_0xfb8e('0x44')]['findOne']({'where':{'id':_0xa9a79d['params']['id']}})[_0xfb8e('0x25')](handleEntityNotFound(_0x456e8d,null))[_0xfb8e('0x25')](function(_0x152ffe){if(_0x152ffe){return db[_0xfb8e('0x57')][_0xfb8e('0x58')](function(_0x112100){return db[_0xfb8e('0x44')]['destroy']({'where':{'IntervalId':_0xa9a79d['params']['id']},'transaction':_0x112100})['then'](function(_0x2ea890){var _0x2aaac0=_[_0xfb8e('0x2d')](_0xa9a79d['body'],function(_0x38d2ce){delete _0x38d2ce['id'];_0x38d2ce['IntervalId']=_0xa9a79d[_0xfb8e('0x52')]['id'];return _0x38d2ce;});return db[_0xfb8e('0x44')][_0xfb8e('0x59')](_0x2aaac0,{'transaction':_0x112100});});})[_0xfb8e('0x25')](function(){return db['Interval'][_0xfb8e('0x45')]({'where':{'IntervalId':_0xa9a79d[_0xfb8e('0x52')]['id']}});});}})[_0xfb8e('0x25')](respondWithResult(_0x456e8d,null))[_0xfb8e('0x49')](handleError(_0x456e8d,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 4dcc9ef..24dda43 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 _0xd8e2=['then','all','ifTime','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','tools_intervals','rewrite','string','getIntervals'];(function(_0x44753d,_0x5653ca){var _0x5b97b7=function(_0x20b1a5){while(--_0x20b1a5){_0x44753d['push'](_0x44753d['shift']());}};_0x5b97b7(++_0x5653ca);}(_0xd8e2,0x74));var _0x2d8e=function(_0x31f733,_0x1e8d99){_0x31f733=_0x31f733-0x0;var _0x1544d8=_0xd8e2[_0x31f733];return _0x1544d8;};'use strict';var attributes=require(_0x2d8e('0x0'));var extensions=require(_0x2d8e('0x1'));var iftime=require(_0x2d8e('0x2'))[_0x2d8e('0x3')];module[_0x2d8e('0x4')]=function(_0x319b53){return _0x319b53[_0x2d8e('0x5')]('Interval',attributes,{'tableName':_0x2d8e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4672a2){extensions[_0x2d8e('0x7')](_0x319b53,_0x4672a2);},'afterBulkCreate':function(_0x1f58e8,_0x22e68a,_0xb03db0){_0xb03db0();extensions[_0x2d8e('0x7')](_0x319b53,_0x1f58e8[0x0]);},'afterUpdate':function(_0x1da4c9){extensions[_0x2d8e('0x7')](_0x319b53,_0x1da4c9);},'afterDestroy':function(_0x2ccc06){extensions[_0x2d8e('0x7')](_0x319b53,_0x2ccc06);}},'instanceMethods':{'ifTime':function(_0x26f806=undefined,_0x532ab3=new Date()){if(typeof this['interval']===_0x2d8e('0x8')){return iftime(this['interval'],_0x26f806,_0x532ab3);}else{return this[_0x2d8e('0x9')]()[_0x2d8e('0xa')](function(_0x2992bc){return Promise[_0x2d8e('0xb')](_0x2992bc['map'](function(_0x11c2ca){return _0x11c2ca[_0x2d8e('0xc')](_0x26f806,_0x532ab3);}));})[_0x2d8e('0xa')](function(_0x39972a){return _0x39972a[_0x2d8e('0xd')](function(_0xb73896,_0x235894){return _0xb73896||_0x235894;},![]);});}}}});}; \ No newline at end of file +var _0xf887=['reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval','string','getIntervals','all','map','ifTime','then'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xf887,0x67));var _0x7f88=function(_0x4b76fb,_0xb4294c){_0x4b76fb=_0x4b76fb-0x0;var _0x530b20=_0xf887[_0x4b76fb];return _0x530b20;};'use strict';var attributes=require(_0x7f88('0x0'));var extensions=require(_0x7f88('0x1'));var iftime=require(_0x7f88('0x2'))[_0x7f88('0x3')];module[_0x7f88('0x4')]=function(_0x5a7654){return _0x5a7654[_0x7f88('0x5')](_0x7f88('0x6'),attributes,{'tableName':_0x7f88('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x46e521){extensions[_0x7f88('0x8')](_0x5a7654,_0x46e521);},'afterBulkCreate':function(_0x35e0a0,_0x342858,_0x157ea9){_0x157ea9();extensions[_0x7f88('0x8')](_0x5a7654,_0x35e0a0[0x0]);},'afterUpdate':function(_0x1dc4bf){extensions['rewrite'](_0x5a7654,_0x1dc4bf);},'afterDestroy':function(_0x1a5394){extensions['rewrite'](_0x5a7654,_0x1a5394);}},'instanceMethods':{'ifTime':function(_0x47570d=undefined,_0x22bad9=new Date()){if(typeof this[_0x7f88('0x9')]===_0x7f88('0xa')){return iftime(this[_0x7f88('0x9')],_0x47570d,_0x22bad9);}else{return this[_0x7f88('0xb')]()['then'](function(_0x2f0984){return Promise[_0x7f88('0xc')](_0x2f0984[_0x7f88('0xd')](function(_0x2137da){return _0x2137da[_0x7f88('0xe')](_0x47570d,_0x22bad9);}));})[_0x7f88('0xf')](function(_0x240da9){return _0x240da9[_0x7f88('0x10')](function(_0x12b18b,_0x3d4bba){return _0x12b18b||_0x3d4bba;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 8c4b033..4601054 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 _0xc926=['../../mysqldb','iftime','../../config/logger','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','error','message','Interval','find','debug','ShowInterval','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','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','resolve','lodash','util'];(function(_0x4207f4,_0x1f778b){var _0x29a621=function(_0xa6f5b7){while(--_0xa6f5b7){_0x4207f4['push'](_0x4207f4['shift']());}};_0x29a621(++_0x1f778b);}(_0xc926,0xae));var _0x6c92=function(_0x227973,_0x29caeb){_0x227973=_0x227973-0x0;var _0x3eab52=_0xc926[_0x227973];return _0x3eab52;};'use strict';var _=require(_0x6c92('0x0'));var util=require(_0x6c92('0x1'));var db=require(_0x6c92('0x2'))['db'];var iftime=require('../../utils/iftime')[_0x6c92('0x3')];var logger=require(_0x6c92('0x4'))('rpc');exports[_0x6c92('0x5')]=function(_0xe06b57){var _0x2f847b=this;return new Promise(function(_0x1f3400,_0x491296){return db['Interval'][_0x6c92('0x6')]({'raw':_0xe06b57[_0x6c92('0x7')]?_0xe06b57[_0x6c92('0x7')][_0x6c92('0x8')]===undefined?!![]:![]:!![],'where':_0xe06b57[_0x6c92('0x7')]?_0xe06b57[_0x6c92('0x7')][_0x6c92('0x9')]||null:null,'attributes':_0xe06b57[_0x6c92('0x7')]?_0xe06b57['options'][_0x6c92('0xa')]||null:null,'limit':_0xe06b57[_0x6c92('0x7')]?_0xe06b57[_0x6c92('0x7')][_0x6c92('0xb')]||null:null,'include':_0xe06b57['options']?_0xe06b57[_0x6c92('0x7')][_0x6c92('0xc')]?_[_0x6c92('0xd')](_0xe06b57[_0x6c92('0x7')]['include'],function(_0x59a78e){return{'model':db[_0x59a78e[_0x6c92('0xe')]],'as':_0x59a78e['as'],'attributes':_0x59a78e[_0x6c92('0xa')],'include':_0x59a78e['include']?_[_0x6c92('0xd')](_0x59a78e[_0x6c92('0xc')],function(_0x1688f6){return{'model':db[_0x1688f6[_0x6c92('0xe')]],'as':_0x1688f6['as'],'attributes':_0x1688f6[_0x6c92('0xa')],'include':_0x1688f6[_0x6c92('0xc')]?_[_0x6c92('0xd')](_0x1688f6[_0x6c92('0xc')],function(_0x7bfe6){return{'model':db[_0x7bfe6['model']],'as':_0x7bfe6['as'],'attributes':_0x7bfe6[_0x6c92('0xa')]};}):[]};}):[]};}):[]:[]})[_0x6c92('0xf')](function(_0x11e511){logger[_0x6c92('0x10')](_0x6c92('0x5'),_0xe06b57);logger['debug'](_0x6c92('0x5'),_0xe06b57,JSON[_0x6c92('0x11')](_0x11e511));_0x1f3400(_0x11e511);})['catch'](function(_0x1d2eb9){logger[_0x6c92('0x12')](_0x6c92('0x5'),_0x1d2eb9[_0x6c92('0x13')],_0xe06b57);_0x491296(_0x2f847b[_0x6c92('0x12')](0x1f4,_0x1d2eb9[_0x6c92('0x13')]));});});};exports['ShowInterval']=function(_0x25aa1b){var _0x5e204c=this;return new Promise(function(_0x2f4f51,_0x7d82a9){return db[_0x6c92('0x14')][_0x6c92('0x15')]({'raw':_0x25aa1b[_0x6c92('0x7')]?_0x25aa1b['options'][_0x6c92('0x8')]===undefined?!![]:![]:!![],'where':_0x25aa1b['options']?_0x25aa1b[_0x6c92('0x7')][_0x6c92('0x9')]||null:null,'attributes':_0x25aa1b[_0x6c92('0x7')]?_0x25aa1b[_0x6c92('0x7')]['attributes']||null:null,'include':_0x25aa1b[_0x6c92('0x7')]?_0x25aa1b[_0x6c92('0x7')][_0x6c92('0xc')]?_['map'](_0x25aa1b[_0x6c92('0x7')][_0x6c92('0xc')],function(_0x1dc9ae){return{'model':db[_0x1dc9ae['model']],'as':_0x1dc9ae['as'],'attributes':_0x1dc9ae[_0x6c92('0xa')],'include':_0x1dc9ae[_0x6c92('0xc')]?_[_0x6c92('0xd')](_0x1dc9ae['include'],function(_0xe9e5b5){return{'model':db[_0xe9e5b5['model']],'as':_0xe9e5b5['as'],'attributes':_0xe9e5b5[_0x6c92('0xa')],'include':_0xe9e5b5[_0x6c92('0xc')]?_[_0x6c92('0xd')](_0xe9e5b5[_0x6c92('0xc')],function(_0x11560c){return{'model':db[_0x11560c[_0x6c92('0xe')]],'as':_0x11560c['as'],'attributes':_0x11560c[_0x6c92('0xa')]};}):[]};}):[]};}):[]:[]})[_0x6c92('0xf')](function(_0x553df1){logger[_0x6c92('0x10')]('ShowInterval',_0x25aa1b);logger[_0x6c92('0x16')](_0x6c92('0x17'),_0x25aa1b,JSON[_0x6c92('0x11')](_0x553df1));_0x2f4f51(_0x553df1);})[_0x6c92('0x18')](function(_0x4a5c31){logger['error'](_0x6c92('0x17'),_0x4a5c31[_0x6c92('0x13')],_0x25aa1b);_0x7d82a9(_0x5e204c[_0x6c92('0x12')](0x1f4,_0x4a5c31[_0x6c92('0x13')]));});});};function checkArrayOfIntervals(_0x54f55f,_0x12f38b){var _0x1ead27=[];return db[_0x6c92('0x14')][_0x6c92('0x6')]({'where':{'id':_0x54f55f}})[_0x6c92('0xf')](function(_0x5cbdf0){_0x1ead27=_0x5cbdf0;return Promise[_0x6c92('0x19')](_0x1ead27[_0x6c92('0xd')](function(_0x2aaec1){return _0x2aaec1[_0x6c92('0x1a')](_0x12f38b);}));})[_0x6c92('0xf')](function(_0x1d2910){var _0x3fdd16=_0x1d2910[_0x6c92('0x1b')](function(_0x17852f,_0x1eac98){return _0x17852f||_0x1eac98;},![]);logger[_0x6c92('0x10')](util[_0x6c92('0x1c')](_0x6c92('0x1d'),_0x1ead27['map'](function(_0x16d1be){return _0x16d1be[_0x6c92('0x1e')];})[_0x6c92('0x1f')](',\x20'),_0x1ead27[_0x6c92('0xd')](function(_0x2a8bb1){return _0x2a8bb1['id'];})[_0x6c92('0x1f')](',\x20')));return _0x3fdd16;});}function checkSingleInterval(_0x3fa385,_0x259551){return db[_0x6c92('0x14')]['findById'](_0x3fa385)[_0x6c92('0xf')](function(_0x59ea98){if(_0x59ea98){logger['info'](util[_0x6c92('0x1c')](_0x6c92('0x20'),_0x59ea98[_0x6c92('0x1e')],_0x59ea98['id']));return _0x59ea98[_0x6c92('0x1a')](_0x259551);}});}exports[_0x6c92('0x21')]=function(_0x39cd14){var _0x12c462=_0x39cd14[_0x6c92('0x22')];var _0x591e16=Array[_0x6c92('0x23')](_0x39cd14[_0x6c92('0x24')])?_0x39cd14['intervals']:typeof _0x39cd14['intervals']===_0x6c92('0x25')?[_0x39cd14[_0x6c92('0x24')]]:[];var _0x865ba6=_0x39cd14['timezone']||undefined;var _0x3cf382=![];if(_0x591e16[_0x6c92('0x26')]){logger[_0x6c92('0x10')](util['format'](_0x6c92('0x27'),_0x591e16[_0x6c92('0x1f')](';\x20')));}if(_0x865ba6){logger[_0x6c92('0x10')](util['format'](_0x6c92('0x28'),_0x865ba6));}logger[_0x6c92('0x16')](_0x6c92('0x29'),_0x3cf382);logger[_0x6c92('0x2a')](_0x6c92('0x21'),_0x39cd14);return Promise[_0x6c92('0x2b')]()[_0x6c92('0xf')](function(){if(Array['isArray'](_0x12c462)){return checkArrayOfIntervals(_0x12c462,_0x865ba6);}else if(_0x12c462){return checkSingleInterval(_0x12c462,_0x865ba6);}})[_0x6c92('0xf')](function(_0x126be7){var _0x62728b=_0x591e16[_0x6c92('0x1b')](function(_0x1d809f,_0x37b746){return _0x1d809f||iftime(_0x37b746,_0x865ba6);},![]);_0x3cf382=_0x126be7||_0x62728b;return _0x3cf382;})['catch'](function(_0x3b21c0){logger[_0x6c92('0x12')](_0x6c92('0x21'),_0x39cd14,_0x3b21c0);throw this[_0x6c92('0x12')](0x1f4,_0x3b21c0[_0x6c92('0x13')]);});}; \ No newline at end of file +var _0x202f=['reduce','format','name','join','findById','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','intervalIds','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','silly','IntervalIftime','resolve','lodash','../../utils/iftime','iftime','../../config/logger','GetInterval','Interval','findAll','options','raw','where','attributes','include','map','model','then','info','stringify','catch','message','error','find','ShowInterval','debug','all','ifTime'];(function(_0x22fee8,_0x8ffddc){var _0x1ba12d=function(_0x1383a9){while(--_0x1383a9){_0x22fee8['push'](_0x22fee8['shift']());}};_0x1ba12d(++_0x8ffddc);}(_0x202f,0xe9));var _0xf202=function(_0xb72c8c,_0x391661){_0xb72c8c=_0xb72c8c-0x0;var _0x26fd07=_0x202f[_0xb72c8c];return _0x26fd07;};'use strict';var _=require(_0xf202('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0xf202('0x1'))[_0xf202('0x2')];var logger=require(_0xf202('0x3'))('rpc');exports[_0xf202('0x4')]=function(_0x51aef1){var _0x369ae7=this;return new Promise(function(_0x2bb30b,_0x5788d6){return db[_0xf202('0x5')][_0xf202('0x6')]({'raw':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')][_0xf202('0x8')]===undefined?!![]:![]:!![],'where':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')][_0xf202('0x9')]||null:null,'attributes':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')][_0xf202('0xa')]||null:null,'limit':_0x51aef1[_0xf202('0x7')]?_0x51aef1[_0xf202('0x7')]['limit']||null:null,'include':_0x51aef1['options']?_0x51aef1[_0xf202('0x7')][_0xf202('0xb')]?_[_0xf202('0xc')](_0x51aef1[_0xf202('0x7')][_0xf202('0xb')],function(_0x3021e5){return{'model':db[_0x3021e5[_0xf202('0xd')]],'as':_0x3021e5['as'],'attributes':_0x3021e5['attributes'],'include':_0x3021e5['include']?_[_0xf202('0xc')](_0x3021e5[_0xf202('0xb')],function(_0x1bf038){return{'model':db[_0x1bf038[_0xf202('0xd')]],'as':_0x1bf038['as'],'attributes':_0x1bf038['attributes'],'include':_0x1bf038[_0xf202('0xb')]?_['map'](_0x1bf038['include'],function(_0x35ed9a){return{'model':db[_0x35ed9a['model']],'as':_0x35ed9a['as'],'attributes':_0x35ed9a[_0xf202('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf202('0xe')](function(_0x45025b){logger[_0xf202('0xf')](_0xf202('0x4'),_0x51aef1);logger['debug'](_0xf202('0x4'),_0x51aef1,JSON[_0xf202('0x10')](_0x45025b));_0x2bb30b(_0x45025b);})[_0xf202('0x11')](function(_0x329056){logger['error'](_0xf202('0x4'),_0x329056[_0xf202('0x12')],_0x51aef1);_0x5788d6(_0x369ae7[_0xf202('0x13')](0x1f4,_0x329056[_0xf202('0x12')]));});});};exports['ShowInterval']=function(_0x3427ee){var _0x51136e=this;return new Promise(function(_0x4e27ec,_0x3a01f8){return db[_0xf202('0x5')][_0xf202('0x14')]({'raw':_0x3427ee[_0xf202('0x7')]?_0x3427ee[_0xf202('0x7')][_0xf202('0x8')]===undefined?!![]:![]:!![],'where':_0x3427ee[_0xf202('0x7')]?_0x3427ee[_0xf202('0x7')][_0xf202('0x9')]||null:null,'attributes':_0x3427ee[_0xf202('0x7')]?_0x3427ee[_0xf202('0x7')][_0xf202('0xa')]||null:null,'include':_0x3427ee['options']?_0x3427ee['options'][_0xf202('0xb')]?_[_0xf202('0xc')](_0x3427ee[_0xf202('0x7')]['include'],function(_0xa62d8a){return{'model':db[_0xa62d8a[_0xf202('0xd')]],'as':_0xa62d8a['as'],'attributes':_0xa62d8a[_0xf202('0xa')],'include':_0xa62d8a['include']?_['map'](_0xa62d8a['include'],function(_0x1e5c4a){return{'model':db[_0x1e5c4a['model']],'as':_0x1e5c4a['as'],'attributes':_0x1e5c4a[_0xf202('0xa')],'include':_0x1e5c4a['include']?_['map'](_0x1e5c4a[_0xf202('0xb')],function(_0x5a3a37){return{'model':db[_0x5a3a37[_0xf202('0xd')]],'as':_0x5a3a37['as'],'attributes':_0x5a3a37[_0xf202('0xa')]};}):[]};}):[]};}):[]:[]})[_0xf202('0xe')](function(_0x2004ad){logger[_0xf202('0xf')](_0xf202('0x15'),_0x3427ee);logger[_0xf202('0x16')]('ShowInterval',_0x3427ee,JSON[_0xf202('0x10')](_0x2004ad));_0x4e27ec(_0x2004ad);})[_0xf202('0x11')](function(_0x13cc5a){logger[_0xf202('0x13')](_0xf202('0x15'),_0x13cc5a[_0xf202('0x12')],_0x3427ee);_0x3a01f8(_0x51136e['error'](0x1f4,_0x13cc5a[_0xf202('0x12')]));});});};function checkArrayOfIntervals(_0x3dde49,_0xc4c88b){var _0x243f76=[];return db[_0xf202('0x5')][_0xf202('0x6')]({'where':{'id':_0x3dde49}})[_0xf202('0xe')](function(_0x54e568){_0x243f76=_0x54e568;return Promise[_0xf202('0x17')](_0x243f76['map'](function(_0x5af510){return _0x5af510[_0xf202('0x18')](_0xc4c88b);}));})[_0xf202('0xe')](function(_0x7c67c1){var _0x5155c7=_0x7c67c1[_0xf202('0x19')](function(_0x4bf93b,_0x5db2e3){return _0x4bf93b||_0x5db2e3;},![]);logger[_0xf202('0xf')](util[_0xf202('0x1a')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x243f76['map'](function(_0xdbc508){return _0xdbc508[_0xf202('0x1b')];})[_0xf202('0x1c')](',\x20'),_0x243f76[_0xf202('0xc')](function(_0x2acdcc){return _0x2acdcc['id'];})[_0xf202('0x1c')](',\x20')));return _0x5155c7;});}function checkSingleInterval(_0x50bc6e,_0x45b739){return db['Interval'][_0xf202('0x1d')](_0x50bc6e)[_0xf202('0xe')](function(_0xb2cacf){if(_0xb2cacf){logger['info'](util[_0xf202('0x1a')](_0xf202('0x1e'),_0xb2cacf[_0xf202('0x1b')],_0xb2cacf['id']));return _0xb2cacf[_0xf202('0x18')](_0x45b739);}});}exports['IntervalIftime']=function(_0xdc88c7){var _0x14fe09=_0xdc88c7[_0xf202('0x1f')];var _0x1d2f64=Array[_0xf202('0x20')](_0xdc88c7[_0xf202('0x21')])?_0xdc88c7[_0xf202('0x21')]:typeof _0xdc88c7[_0xf202('0x21')]===_0xf202('0x22')?[_0xdc88c7[_0xf202('0x21')]]:[];var _0x4939f7=_0xdc88c7[_0xf202('0x23')]||undefined;var _0x17d87f=![];if(_0x1d2f64[_0xf202('0x24')]){logger[_0xf202('0xf')](util[_0xf202('0x1a')](_0xf202('0x25'),_0x1d2f64['join'](';\x20')));}if(_0x4939f7){logger['info'](util[_0xf202('0x1a')](_0xf202('0x26'),_0x4939f7));}logger[_0xf202('0x16')](_0xf202('0x27'),_0x17d87f);logger[_0xf202('0x28')](_0xf202('0x29'),_0xdc88c7);return Promise[_0xf202('0x2a')]()['then'](function(){if(Array[_0xf202('0x20')](_0x14fe09)){return checkArrayOfIntervals(_0x14fe09,_0x4939f7);}else if(_0x14fe09){return checkSingleInterval(_0x14fe09,_0x4939f7);}})[_0xf202('0xe')](function(_0x318ca5){var _0x2137a9=_0x1d2f64[_0xf202('0x19')](function(_0x2680d4,_0x2e88e7){return _0x2680d4||iftime(_0x2e88e7,_0x4939f7);},![]);_0x17d87f=_0x318ca5||_0x2137a9;return _0x17d87f;})[_0xf202('0x11')](function(_0x9eb5e4){logger[_0xf202('0x13')](_0xf202('0x29'),_0xdc88c7,_0x9eb5e4);throw this[_0xf202('0x13')](0x1f4,_0x9eb5e4['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 8e65f1c..d6c6cd3 100644 --- a/server/api/jira/index.js +++ b/server/api/jira/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x158a58,_0x28e8e7){var _0x4935d9=function(_0x1e698c){while(--_0x1e698c){_0x158a58['push'](_0x158a58['shift']());}};_0x4935d9(++_0x28e8e7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x5f66[_0x21a9d9];return _0x46adce;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x0b0e,0x187));var _0xe0b0=function(_0xbf8ebe,_0x3b69a5){_0xbf8ebe=_0xbf8ebe-0x0;var _0x1e25e8=_0x0b0e[_0xbf8ebe];return _0x1e25e8;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index df6f8cb..5d8212a 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 _0x05e2=['../../config/logger','api','support','3eAmWpBVP0','key','summary','\x20from\x20','stringify','issuetype','Bug','fields','customfield_11500','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','parse','error','json','api.jira','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0x05e2,0xe4));var _0x205e=function(_0x2384f6,_0x167775){_0x2384f6=_0x2384f6-0x0;var _0x370294=_0x05e2[_0x2384f6];return _0x370294;};'use strict';var BPromise=require(_0x205e('0x0'));var https=require(_0x205e('0x1'));var logger=require(_0x205e('0x2'))(_0x205e('0x3'));var USERNAME=_0x205e('0x4');var PASSWORD=_0x205e('0x5');function openIssue(_0x19eab8,_0x27c1f7){var _0xf94b9a={'fields':{'project':{'key':_0x19eab8[_0x205e('0x6')]||'MOTGUI'},'summary':(_0x19eab8[_0x205e('0x7')]||'Report')+_0x205e('0x8')+_0x19eab8['ip'],'description':_0x19eab8['description']||JSON[_0x205e('0x9')](_0x19eab8),'issuetype':{'name':_0x19eab8[_0x205e('0xa')]||_0x205e('0xb')}}};_0xf94b9a[_0x205e('0xc')][_0x205e('0xd')]=_0x19eab8['email'];_0xf94b9a['fields']['customfield_11501']=_0x19eab8['oldToken'];_0xf94b9a[_0x205e('0xc')][_0x205e('0xe')]=_0x19eab8[_0x205e('0xf')];_0xf94b9a[_0x205e('0xc')][_0x205e('0x10')]=_0x19eab8[_0x205e('0x11')];_0xf94b9a['fields'][_0x205e('0x12')]=_0x19eab8[_0x205e('0x13')];_0xf94b9a[_0x205e('0xc')][_0x205e('0x14')]=_0x19eab8['ip'];var _0x4edb18={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x205e('0x15'),'method':_0x205e('0x16'),'timeout':0x4e20,'headers':{'Content-Type':_0x205e('0x17'),'Authorization':_0x205e('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x205e('0x19')](_0x205e('0x1a'))}};var _0x483977=JSON[_0x205e('0x9')](_0xf94b9a);var _0x1b8cca=https[_0x205e('0x1b')](_0x4edb18,function(_0x5728fa){_0x5728fa[_0x205e('0x1c')](_0x205e('0x1d'));var _0x1b4d4a='';_0x5728fa['on'](_0x205e('0x1e'),function(_0x246c2a){_0x1b4d4a+=_0x246c2a;});_0x5728fa['on'](_0x205e('0x1f'),function(){if(_0x27c1f7){return _0x27c1f7[_0x205e('0x20')](_0x5728fa[_0x205e('0x21')])['json'](JSON[_0x205e('0x22')](_0x1b4d4a));}});});_0x1b8cca['on'](_0x205e('0x23'),function(_0x1657a2){if(_0x27c1f7){return _0x27c1f7['status'](0x1f4)[_0x205e('0x24')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x205e('0x25')}]});}});_0x1b8cca['write'](_0x483977);_0x1b8cca['end']();}exports[_0x205e('0x26')]=openIssue;exports[_0x205e('0x27')]=function(_0x301094,_0xa2ab60){_0x301094[_0x205e('0x28')]['ip']=_0x301094[_0x205e('0x29')][_0x205e('0x2a')]||_0x301094[_0x205e('0x2b')][_0x205e('0x2c')]||_0x301094[_0x205e('0x2d')][_0x205e('0x2c')]||_0x301094['connection']['socket'][_0x205e('0x2c')];return openIssue(_0x301094[_0x205e('0x28')],_0xa2ab60);}; \ No newline at end of file +var _0xb9b1=['status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','../../config/logger','api','support','key','Report','\x20from\x20','description','issuetype','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','setEncoding','utf8','data','end'];(function(_0x257385,_0x5e8325){var _0x42e4d6=function(_0x26199d){while(--_0x26199d){_0x257385['push'](_0x257385['shift']());}};_0x42e4d6(++_0x5e8325);}(_0xb9b1,0x1e4));var _0x1b9b=function(_0x54f430,_0x1b41fe){_0x54f430=_0x54f430-0x0;var _0x3e0e80=_0xb9b1[_0x54f430];return _0x3e0e80;};'use strict';var BPromise=require(_0x1b9b('0x0'));var https=require(_0x1b9b('0x1'));var logger=require(_0x1b9b('0x2'))(_0x1b9b('0x3'));var USERNAME=_0x1b9b('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x31866e,_0x59f073){var _0x386b9d={'fields':{'project':{'key':_0x31866e[_0x1b9b('0x5')]||'MOTGUI'},'summary':(_0x31866e['summary']||_0x1b9b('0x6'))+_0x1b9b('0x7')+_0x31866e['ip'],'description':_0x31866e[_0x1b9b('0x8')]||JSON['stringify'](_0x31866e),'issuetype':{'name':_0x31866e[_0x1b9b('0x9')]||'Bug'}}};_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0xb')]=_0x31866e['email'];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0xc')]=_0x31866e[_0x1b9b('0xd')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0xe')]=_0x31866e[_0x1b9b('0xf')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0x10')]=_0x31866e[_0x1b9b('0x11')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0x12')]=_0x31866e[_0x1b9b('0x13')];_0x386b9d[_0x1b9b('0xa')][_0x1b9b('0x14')]=_0x31866e['ip'];var _0x16ae95={'host':_0x1b9b('0x15'),'port':0x1bb,'path':_0x1b9b('0x16'),'method':_0x1b9b('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0x1b9b('0x18'),'Authorization':_0x1b9b('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0x1b9b('0x1a')](_0x1b9b('0x1b'))}};var _0x49711e=JSON[_0x1b9b('0x1c')](_0x386b9d);var _0x50843b=https['request'](_0x16ae95,function(_0x59b828){_0x59b828[_0x1b9b('0x1d')](_0x1b9b('0x1e'));var _0x3f9bcc='';_0x59b828['on'](_0x1b9b('0x1f'),function(_0x3d9b2f){_0x3f9bcc+=_0x3d9b2f;});_0x59b828['on'](_0x1b9b('0x20'),function(){if(_0x59f073){return _0x59f073[_0x1b9b('0x21')](_0x59b828[_0x1b9b('0x22')])[_0x1b9b('0x23')](JSON[_0x1b9b('0x24')](_0x3f9bcc));}});});_0x50843b['on']('error',function(_0x399e23){if(_0x59f073){return _0x59f073[_0x1b9b('0x21')](0x1f4)[_0x1b9b('0x23')]({'errors':[{'message':_0x1b9b('0x25'),'type':'api.jira'}]});}});_0x50843b[_0x1b9b('0x26')](_0x49711e);_0x50843b[_0x1b9b('0x20')]();}exports[_0x1b9b('0x27')]=openIssue;exports[_0x1b9b('0x28')]=function(_0xaab630,_0x5acd57){_0xaab630[_0x1b9b('0x29')]['ip']=_0xaab630[_0x1b9b('0x2a')][_0x1b9b('0x2b')]||_0xaab630[_0x1b9b('0x2c')]['remoteAddress']||_0xaab630['socket']['remoteAddress']||_0xaab630['connection'][_0x1b9b('0x2d')][_0x1b9b('0x2e')];return openIssue(_0xaab630[_0x1b9b('0x29')],_0x5acd57);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 9cb2a17..228cc89 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 _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x44ed01,_0x464796){var _0x561ab4=function(_0x487161){while(--_0x487161){_0x44ed01['push'](_0x44ed01['shift']());}};_0x561ab4(++_0x464796);}(_0x70e0,0x17b));var _0x070e=function(_0x5f4003,_0x2f5dda){_0x5f4003=_0x5f4003-0x0;var _0x1c7878=_0x70e0[_0x5f4003];return _0x1c7878;};'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'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file +var _0x878f=['./jscriptyAnswerReport.controller','get','/describe','/:id','post','isAuthenticated','create','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x946bb2,_0xbdde84){var _0x40d752=function(_0x895db2){while(--_0x895db2){_0x946bb2['push'](_0x946bb2['shift']());}};_0x40d752(++_0xbdde84);}(_0x878f,0x173));var _0xf878=function(_0x3dea25,_0x1aab61){_0x3dea25=_0x3dea25-0x0;var _0x1c9d5f=_0x878f[_0x3dea25];return _0x1c9d5f;};'use strict';var multer=require('multer');var util=require(_0xf878('0x0'));var path=require(_0xf878('0x1'));var timeout=require(_0xf878('0x2'));var express=require(_0xf878('0x3'));var router=express[_0xf878('0x4')]();var fs_extra=require(_0xf878('0x5'));var auth=require(_0xf878('0x6'));var interaction=require(_0xf878('0x7'));var config=require(_0xf878('0x8'));var controller=require(_0xf878('0x9'));router[_0xf878('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0xf878('0xa')](_0xf878('0xb'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xf878('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xf878('0xd')]('/',auth[_0xf878('0xe')](),controller[_0xf878('0xf')]);router['put'](_0xf878('0xc'),auth[_0xf878('0xe')](),controller['update']);router[_0xf878('0x10')]('/:id',auth[_0xf878('0xe')](),controller[_0xf878('0x11')]);module[_0xf878('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 01956a2..20d531a 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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7a54,0x106));var _0x47a5=function(_0x46050f,_0x3f3992){_0x46050f=_0x46050f-0x0;var _0x240ae6=_0x7a54[_0x46050f];return _0x240ae6;};'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(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x7a54,0x106));var _0x47a5=function(_0x205f41,_0x3d6e7b){_0x205f41=_0x205f41-0x0;var _0x231d50=_0x7a54[_0x205f41];return _0x231d50;};'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 6325f82..451350c 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 _0x8d0a=['undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','sendStatus','error','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','keys','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','map','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','params','intersection','length','find','catch','create','body','describe','eml-format','rimraf','zip-dir','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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x8d0a,0x172));var _0xa8d0=function(_0x15ec5b,_0x43b0ad){_0x15ec5b=_0x15ec5b-0x0;var _0x108593=_0x8d0a[_0x15ec5b];return _0x108593;};'use strict';var emlformat=require(_0xa8d0('0x0'));var rimraf=require(_0xa8d0('0x1'));var zipdir=require(_0xa8d0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa8d0('0x3'));var moment=require(_0xa8d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa8d0('0x5'));var util=require(_0xa8d0('0x6'));var path=require(_0xa8d0('0x7'));var sox=require('sox');var csv=require(_0xa8d0('0x8'));var ejs=require(_0xa8d0('0x9'));var fs=require('fs');var fs_extra=require(_0xa8d0('0xa'));var _=require(_0xa8d0('0xb'));var squel=require(_0xa8d0('0xc'));var crypto=require(_0xa8d0('0xd'));var jsforce=require(_0xa8d0('0xe'));var deskjs=require(_0xa8d0('0xf'));var toCsv=require(_0xa8d0('0x8'));var querystring=require(_0xa8d0('0x10'));var Papa=require(_0xa8d0('0x11'));var Redis=require(_0xa8d0('0x12'));var authService=require(_0xa8d0('0x13'));var qs=require(_0xa8d0('0x14'));var as=require(_0xa8d0('0x15'));var hardwareService=require(_0xa8d0('0x16'));var logger=require(_0xa8d0('0x17'))(_0xa8d0('0x18'));var utils=require(_0xa8d0('0x19'));var config=require(_0xa8d0('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x318fb1,_0x23b588){_0x23b588=_0x23b588||0xcc;return function(_0x572d64){if(_0x572d64){return _0x318fb1['sendStatus'](_0x23b588);}return _0x318fb1[_0xa8d0('0x1b')](_0x23b588)[_0xa8d0('0x1c')]();};}function respondWithResult(_0x3ecc36,_0xbdc234){_0xbdc234=_0xbdc234||0xc8;return function(_0x2ebddf){if(_0x2ebddf){return _0x3ecc36[_0xa8d0('0x1b')](_0xbdc234)[_0xa8d0('0x1d')](_0x2ebddf);}};}function respondWithFilteredResult(_0x1daf70,_0x2871cb){return function(_0x238e85){if(_0x238e85){var _0xfa19ee=typeof _0x2871cb['offset']===_0xa8d0('0x1e')&&typeof _0x2871cb[_0xa8d0('0x1f')]==='undefined';var _0x3e1dc6=_0x238e85[_0xa8d0('0x20')];var _0x2899fb=_0xfa19ee?0x0:_0x2871cb[_0xa8d0('0x21')];var _0x34ce5d=_0xfa19ee?_0x238e85['count']:_0x2871cb[_0xa8d0('0x21')]+_0x2871cb[_0xa8d0('0x1f')];var _0x213de2;if(_0x34ce5d>=_0x3e1dc6){_0x34ce5d=_0x3e1dc6;_0x213de2=0xc8;}else{_0x213de2=0xce;}_0x1daf70[_0xa8d0('0x1b')](_0x213de2);return _0x1daf70[_0xa8d0('0x22')](_0xa8d0('0x23'),_0x2899fb+'-'+_0x34ce5d+'/'+_0x3e1dc6)[_0xa8d0('0x1d')](_0x238e85);}return null;};}function patchUpdates(_0x595452){return function(_0x1a3345){try{jsonpatch[_0xa8d0('0x24')](_0x1a3345,_0x595452,!![]);}catch(_0x3c8843){return BPromise[_0xa8d0('0x25')](_0x3c8843);}return _0x1a3345['save']();};}function saveUpdates(_0x31cf4f,_0x31216e){return function(_0x3212a3){if(_0x3212a3){return _0x3212a3[_0xa8d0('0x26')](_0x31cf4f)['then'](function(_0x150080){return _0x150080;});}return null;};}function removeEntity(_0x30a566,_0x20ae2c){return function(_0x1e9c3e){if(_0x1e9c3e){return _0x1e9c3e['destroy']()[_0xa8d0('0x27')](function(){_0x30a566[_0xa8d0('0x1b')](0xcc)[_0xa8d0('0x1c')]();});}};}function handleEntityNotFound(_0x507d18,_0x34c0bf){return function(_0x5f5dfb){if(!_0x5f5dfb){_0x507d18[_0xa8d0('0x28')](0x194);}return _0x5f5dfb;};}function handleError(_0x291e8e,_0x548076){_0x548076=_0x548076||0x1f4;return function(_0x5d7292){logger[_0xa8d0('0x29')](_0x5d7292['stack']);if(_0x5d7292[_0xa8d0('0x2a')]){delete _0x5d7292[_0xa8d0('0x2a')];}_0x291e8e[_0xa8d0('0x1b')](_0x548076)[_0xa8d0('0x2b')](_0x5d7292);};}exports[_0xa8d0('0x2c')]=function(_0x5a5079,_0x221c6e){var _0x356892={},_0x13de71={},_0x500cec={'count':0x0,'rows':[]};var _0x48c682=_['map'](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')],function(_0x2a8e98){return{'name':_0x2a8e98[_0xa8d0('0x2f')],'type':_0x2a8e98[_0xa8d0('0x30')][_0xa8d0('0x31')]};});_0x13de71[_0xa8d0('0x32')]=_['map'](_0x48c682,_0xa8d0('0x2a'));_0x13de71['query']=_[_0xa8d0('0x33')](_0x5a5079['query']);_0x13de71['filters']=_['intersection'](_0x13de71['model'],_0x13de71[_0xa8d0('0x34')]);_0x356892[_0xa8d0('0x35')]=_['intersection'](_0x13de71['model'],qs[_0xa8d0('0x36')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x36')]));_0x356892[_0xa8d0('0x35')]=_0x356892[_0xa8d0('0x35')]['length']?_0x356892['attributes']:_0x13de71[_0xa8d0('0x32')];if(!_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x37')](_0xa8d0('0x38'))){_0x356892[_0xa8d0('0x1f')]=qs[_0xa8d0('0x1f')](_0x5a5079['query'][_0xa8d0('0x1f')]);_0x356892[_0xa8d0('0x21')]=qs[_0xa8d0('0x21')](_0x5a5079['query'][_0xa8d0('0x21')]);}_0x356892[_0xa8d0('0x39')]=qs[_0xa8d0('0x3a')](_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x3a')]);_0x356892[_0xa8d0('0x3b')]=qs[_0xa8d0('0x3c')](_[_0xa8d0('0x3d')](_0x5a5079[_0xa8d0('0x34')],_0x13de71[_0xa8d0('0x3c')]),_0x48c682);if(_0x5a5079[_0xa8d0('0x34')]['filter']){_0x356892[_0xa8d0('0x3b')]=_['merge'](_0x356892[_0xa8d0('0x3b')],{'$or':_[_0xa8d0('0x3e')](_0x48c682,function(_0xd181d1){if(_0xd181d1['type']!==_0xa8d0('0x3f')){var _0x172b6a={};_0x172b6a[_0xd181d1[_0xa8d0('0x2a')]]={'$like':'%'+_0x5a5079['query'][_0xa8d0('0x40')]+'%'};return _0x172b6a;}})});}_0x356892=_[_0xa8d0('0x41')]({},_0x356892,_0x5a5079[_0xa8d0('0x42')]);var _0x3c3080={'where':_0x356892[_0xa8d0('0x3b')]};return db[_0xa8d0('0x2d')][_0xa8d0('0x20')](_0x3c3080)[_0xa8d0('0x27')](function(_0x2e2778){_0x500cec['count']=_0x2e2778;if(_0x5a5079[_0xa8d0('0x34')][_0xa8d0('0x43')]){_0x356892[_0xa8d0('0x44')]=[{'all':!![]}];}return db[_0xa8d0('0x2d')][_0xa8d0('0x45')](_0x356892);})[_0xa8d0('0x27')](function(_0x3438b7){_0x500cec[_0xa8d0('0x46')]=_0x3438b7;return _0x500cec;})[_0xa8d0('0x27')](respondWithFilteredResult(_0x221c6e,_0x356892))['catch'](handleError(_0x221c6e,null));};exports[_0xa8d0('0x47')]=function(_0x588e17,_0x21c0e2){var _0x8bbb72={'raw':!![],'where':{'id':_0x588e17[_0xa8d0('0x48')]['id']}},_0x58ec61={};_0x58ec61['model']=_[_0xa8d0('0x33')](db[_0xa8d0('0x2d')][_0xa8d0('0x2e')]);_0x58ec61['query']=_['keys'](_0x588e17[_0xa8d0('0x34')]);_0x58ec61[_0xa8d0('0x3c')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],_0x58ec61[_0xa8d0('0x34')]);_0x8bbb72[_0xa8d0('0x35')]=_[_0xa8d0('0x49')](_0x58ec61[_0xa8d0('0x32')],qs['fields'](_0x588e17[_0xa8d0('0x34')]['fields']));_0x8bbb72[_0xa8d0('0x35')]=_0x8bbb72['attributes'][_0xa8d0('0x4a')]?_0x8bbb72[_0xa8d0('0x35')]:_0x58ec61[_0xa8d0('0x32')];if(_0x588e17['query'][_0xa8d0('0x43')]){_0x8bbb72[_0xa8d0('0x44')]=[{'all':!![]}];}_0x8bbb72=_[_0xa8d0('0x41')]({},_0x8bbb72,_0x588e17[_0xa8d0('0x42')]);return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')](_0x8bbb72)[_0xa8d0('0x27')](handleEntityNotFound(_0x21c0e2,null))[_0xa8d0('0x27')](respondWithResult(_0x21c0e2,null))[_0xa8d0('0x4c')](handleError(_0x21c0e2,null));};exports[_0xa8d0('0x4d')]=function(_0x39f402,_0x3187){return db[_0xa8d0('0x2d')][_0xa8d0('0x4d')](_0x39f402[_0xa8d0('0x4e')],{})['then'](respondWithResult(_0x3187,0xc9))['catch'](handleError(_0x3187,null));};exports[_0xa8d0('0x26')]=function(_0x15f801,_0x3ddebe){if(_0x15f801[_0xa8d0('0x4e')]['id']){delete _0x15f801[_0xa8d0('0x4e')]['id'];}return db[_0xa8d0('0x2d')][_0xa8d0('0x4b')]({'where':{'id':_0x15f801[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x3ddebe,null))[_0xa8d0('0x27')](saveUpdates(_0x15f801[_0xa8d0('0x4e')],null))[_0xa8d0('0x27')](respondWithResult(_0x3ddebe,null))[_0xa8d0('0x4c')](handleError(_0x3ddebe,null));};exports['destroy']=function(_0x2afc73,_0x31e586){return db[_0xa8d0('0x2d')]['find']({'where':{'id':_0x2afc73[_0xa8d0('0x48')]['id']}})[_0xa8d0('0x27')](handleEntityNotFound(_0x31e586,null))[_0xa8d0('0x27')](removeEntity(_0x31e586,null))[_0xa8d0('0x4c')](handleError(_0x31e586,null));};exports[_0xa8d0('0x4f')]=function(_0x5680c1,_0x54f9e6){return db[_0xa8d0('0x2d')][_0xa8d0('0x4f')]()[_0xa8d0('0x27')](respondWithResult(_0x54f9e6,null))[_0xa8d0('0x4c')](handleError(_0x54f9e6,null));}; \ No newline at end of file +var _0x078c=['lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','save','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','JscriptyAnswerReport','count','include','rows','catch','intersection','includeAll','options','create','body','find','params','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra'];(function(_0x506396,_0x265b57){var _0x4c5443=function(_0x283f1d){while(--_0x283f1d){_0x506396['push'](_0x506396['shift']());}};_0x4c5443(++_0x265b57);}(_0x078c,0x19f));var _0xc078=function(_0x481af3,_0x483fac){_0x481af3=_0x481af3-0x0;var _0x3354ea=_0x078c[_0x481af3];return _0x3354ea;};'use strict';var emlformat=require(_0xc078('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc078('0x1'));var jsonpatch=require(_0xc078('0x2'));var rp=require('request-promise');var moment=require(_0xc078('0x3'));var BPromise=require(_0xc078('0x4'));var Mustache=require(_0xc078('0x5'));var util=require(_0xc078('0x6'));var path=require('path');var sox=require(_0xc078('0x7'));var csv=require(_0xc078('0x8'));var ejs=require(_0xc078('0x9'));var fs=require('fs');var fs_extra=require(_0xc078('0xa'));var _=require(_0xc078('0xb'));var squel=require(_0xc078('0xc'));var crypto=require(_0xc078('0xd'));var jsforce=require(_0xc078('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc078('0xf'));var Redis=require(_0xc078('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc078('0x11'));var as=require(_0xc078('0x12'));var hardwareService=require(_0xc078('0x13'));var logger=require(_0xc078('0x14'))(_0xc078('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc078('0x16'));var db=require(_0xc078('0x17'))['db'];function respondWithStatusCode(_0x3fa2be,_0x25e95d){_0x25e95d=_0x25e95d||0xcc;return function(_0x3e27c7){if(_0x3e27c7){return _0x3fa2be[_0xc078('0x18')](_0x25e95d);}return _0x3fa2be[_0xc078('0x19')](_0x25e95d)[_0xc078('0x1a')]();};}function respondWithResult(_0x11a3c3,_0x393225){_0x393225=_0x393225||0xc8;return function(_0x256d7b){if(_0x256d7b){return _0x11a3c3[_0xc078('0x19')](_0x393225)[_0xc078('0x1b')](_0x256d7b);}};}function respondWithFilteredResult(_0x36b6b1,_0x404ab0){return function(_0x5a1cbc){if(_0x5a1cbc){var _0x39e242=typeof _0x404ab0[_0xc078('0x1c')]===_0xc078('0x1d')&&typeof _0x404ab0['limit']===_0xc078('0x1d');var _0x5ab33a=_0x5a1cbc['count'];var _0xfd361b=_0x39e242?0x0:_0x404ab0['offset'];var _0x2ec2d5=_0x39e242?_0x5a1cbc['count']:_0x404ab0[_0xc078('0x1c')]+_0x404ab0[_0xc078('0x1e')];var _0x25fb75;if(_0x2ec2d5>=_0x5ab33a){_0x2ec2d5=_0x5ab33a;_0x25fb75=0xc8;}else{_0x25fb75=0xce;}_0x36b6b1['status'](_0x25fb75);return _0x36b6b1[_0xc078('0x1f')]('Content-Range',_0xfd361b+'-'+_0x2ec2d5+'/'+_0x5ab33a)[_0xc078('0x1b')](_0x5a1cbc);}return null;};}function patchUpdates(_0x2a9bbf){return function(_0x19b29b){try{jsonpatch[_0xc078('0x20')](_0x19b29b,_0x2a9bbf,!![]);}catch(_0x3f68ca){return BPromise['reject'](_0x3f68ca);}return _0x19b29b[_0xc078('0x21')]();};}function saveUpdates(_0x36efa2,_0x2e56fa){return function(_0x275cbc){if(_0x275cbc){return _0x275cbc['update'](_0x36efa2)[_0xc078('0x22')](function(_0xa4cd22){return _0xa4cd22;});}return null;};}function removeEntity(_0x3bde7a,_0x1cb7cb){return function(_0x41fac6){if(_0x41fac6){return _0x41fac6[_0xc078('0x23')]()[_0xc078('0x22')](function(){_0x3bde7a[_0xc078('0x19')](0xcc)[_0xc078('0x1a')]();});}};}function handleEntityNotFound(_0x3017a3,_0x14f677){return function(_0x531945){if(!_0x531945){_0x3017a3['sendStatus'](0x194);}return _0x531945;};}function handleError(_0x29525b,_0x5c7fc9){_0x5c7fc9=_0x5c7fc9||0x1f4;return function(_0x4a022a){logger['error'](_0x4a022a[_0xc078('0x24')]);if(_0x4a022a['name']){delete _0x4a022a[_0xc078('0x25')];}_0x29525b[_0xc078('0x19')](_0x5c7fc9)[_0xc078('0x26')](_0x4a022a);};}exports[_0xc078('0x27')]=function(_0xd43338,_0x2b257c){var _0x7c965e={},_0x3c481f={},_0x50e5d={'count':0x0,'rows':[]};var _0x43c377=_[_0xc078('0x28')](db['JscriptyAnswerReport'][_0xc078('0x29')],function(_0x560cbb){return{'name':_0x560cbb[_0xc078('0x2a')],'type':_0x560cbb[_0xc078('0x2b')][_0xc078('0x2c')]};});_0x3c481f[_0xc078('0x2d')]=_['map'](_0x43c377,_0xc078('0x25'));_0x3c481f['query']=_['keys'](_0xd43338[_0xc078('0x2e')]);_0x3c481f[_0xc078('0x2f')]=_['intersection'](_0x3c481f[_0xc078('0x2d')],_0x3c481f[_0xc078('0x2e')]);_0x7c965e[_0xc078('0x30')]=_['intersection'](_0x3c481f['model'],qs[_0xc078('0x31')](_0xd43338['query'][_0xc078('0x31')]));_0x7c965e[_0xc078('0x30')]=_0x7c965e['attributes'][_0xc078('0x32')]?_0x7c965e[_0xc078('0x30')]:_0x3c481f[_0xc078('0x2d')];if(!_0xd43338['query'][_0xc078('0x33')](_0xc078('0x34'))){_0x7c965e[_0xc078('0x1e')]=qs['limit'](_0xd43338['query'][_0xc078('0x1e')]);_0x7c965e[_0xc078('0x1c')]=qs['offset'](_0xd43338['query']['offset']);}_0x7c965e['order']=qs['sort'](_0xd43338[_0xc078('0x2e')][_0xc078('0x35')]);_0x7c965e[_0xc078('0x36')]=qs[_0xc078('0x2f')](_['pick'](_0xd43338[_0xc078('0x2e')],_0x3c481f['filters']),_0x43c377);if(_0xd43338['query'][_0xc078('0x37')]){_0x7c965e[_0xc078('0x36')]=_[_0xc078('0x38')](_0x7c965e[_0xc078('0x36')],{'$or':_[_0xc078('0x28')](_0x43c377,function(_0x2d5558){if(_0x2d5558[_0xc078('0x2b')]!==_0xc078('0x39')){var _0x534def={};_0x534def[_0x2d5558['name']]={'$like':'%'+_0xd43338['query']['filter']+'%'};return _0x534def;}})});}_0x7c965e=_[_0xc078('0x38')]({},_0x7c965e,_0xd43338['options']);var _0x122555={'where':_0x7c965e['where']};return db[_0xc078('0x3a')]['count'](_0x122555)['then'](function(_0x13e765){_0x50e5d[_0xc078('0x3b')]=_0x13e765;if(_0xd43338[_0xc078('0x2e')]['includeAll']){_0x7c965e[_0xc078('0x3c')]=[{'all':!![]}];}return db[_0xc078('0x3a')]['findAll'](_0x7c965e);})[_0xc078('0x22')](function(_0x3c2bc9){_0x50e5d[_0xc078('0x3d')]=_0x3c2bc9;return _0x50e5d;})[_0xc078('0x22')](respondWithFilteredResult(_0x2b257c,_0x7c965e))[_0xc078('0x3e')](handleError(_0x2b257c,null));};exports['show']=function(_0x3ffd96,_0x1d8e5b){var _0x3710b6={'raw':!![],'where':{'id':_0x3ffd96['params']['id']}},_0x548507={};_0x548507[_0xc078('0x2d')]=_['keys'](db['JscriptyAnswerReport'][_0xc078('0x29')]);_0x548507[_0xc078('0x2e')]=_['keys'](_0x3ffd96[_0xc078('0x2e')]);_0x548507['filters']=_[_0xc078('0x3f')](_0x548507['model'],_0x548507[_0xc078('0x2e')]);_0x3710b6[_0xc078('0x30')]=_[_0xc078('0x3f')](_0x548507[_0xc078('0x2d')],qs['fields'](_0x3ffd96[_0xc078('0x2e')][_0xc078('0x31')]));_0x3710b6[_0xc078('0x30')]=_0x3710b6[_0xc078('0x30')]['length']?_0x3710b6[_0xc078('0x30')]:_0x548507[_0xc078('0x2d')];if(_0x3ffd96[_0xc078('0x2e')][_0xc078('0x40')]){_0x3710b6[_0xc078('0x3c')]=[{'all':!![]}];}_0x3710b6=_['merge']({},_0x3710b6,_0x3ffd96[_0xc078('0x41')]);return db['JscriptyAnswerReport']['find'](_0x3710b6)['then'](handleEntityNotFound(_0x1d8e5b,null))[_0xc078('0x22')](respondWithResult(_0x1d8e5b,null))[_0xc078('0x3e')](handleError(_0x1d8e5b,null));};exports[_0xc078('0x42')]=function(_0x4c3041,_0x57abc6){return db[_0xc078('0x3a')][_0xc078('0x42')](_0x4c3041['body'],{})[_0xc078('0x22')](respondWithResult(_0x57abc6,0xc9))[_0xc078('0x3e')](handleError(_0x57abc6,null));};exports['update']=function(_0x2a846f,_0x57889b){if(_0x2a846f[_0xc078('0x43')]['id']){delete _0x2a846f[_0xc078('0x43')]['id'];}return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x2a846f[_0xc078('0x45')]['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x57889b,null))['then'](saveUpdates(_0x2a846f[_0xc078('0x43')],null))[_0xc078('0x22')](respondWithResult(_0x57889b,null))[_0xc078('0x3e')](handleError(_0x57889b,null));};exports[_0xc078('0x23')]=function(_0x71ae97,_0x4c82c6){return db[_0xc078('0x3a')][_0xc078('0x44')]({'where':{'id':_0x71ae97['params']['id']}})[_0xc078('0x22')](handleEntityNotFound(_0x4c82c6,null))[_0xc078('0x22')](removeEntity(_0x4c82c6,null))[_0xc078('0x3e')](handleError(_0x4c82c6,null));};exports['describe']=function(_0x36456e,_0x5e3021){return db[_0xc078('0x3a')][_0xc078('0x46')]()[_0xc078('0x22')](respondWithResult(_0x5e3021,null))[_0xc078('0x3e')](handleError(_0x5e3021,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ca394a8..cbacc7e 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 _0x5150=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3403ec,_0xc73699){var _0x1ca50f=function(_0x1af6c1){while(--_0x1af6c1){_0x3403ec['push'](_0x3403ec['shift']());}};_0x1ca50f(++_0xc73699);}(_0x5150,0xd7));var _0x0515=function(_0x36bff5,_0x3156cb){_0x36bff5=_0x36bff5-0x0;var _0x80ade5=_0x5150[_0x36bff5];return _0x80ade5;};'use strict';var _=require(_0x0515('0x0'));var util=require(_0x0515('0x1'));var logger=require(_0x0515('0x2'))(_0x0515('0x3'));var moment=require('moment');var BPromise=require(_0x0515('0x4'));var rp=require(_0x0515('0x5'));var fs=require('fs');var path=require(_0x0515('0x6'));var rimraf=require(_0x0515('0x7'));var config=require(_0x0515('0x8'));var attributes=require(_0x0515('0x9'));module[_0x0515('0xa')]=function(_0x42b157,_0x26ee19){return _0x42b157['define'](_0x0515('0xb'),attributes,{'tableName':_0x0515('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ab9=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x283502,_0x28f79a){var _0x12818f=function(_0x217e0f){while(--_0x217e0f){_0x283502['push'](_0x283502['shift']());}};_0x12818f(++_0x28f79a);}(_0x4ab9,0x12c));var _0x94ab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x4ab9[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x94ab('0x0'));var util=require('util');var logger=require(_0x94ab('0x1'))('api');var moment=require('moment');var BPromise=require(_0x94ab('0x2'));var rp=require(_0x94ab('0x3'));var fs=require('fs');var path=require(_0x94ab('0x4'));var rimraf=require(_0x94ab('0x5'));var config=require(_0x94ab('0x6'));var attributes=require(_0x94ab('0x7'));module['exports']=function(_0x19df49,_0x36c042){return _0x19df49[_0x94ab('0x8')](_0x94ab('0x9'),attributes,{'tableName':_0x94ab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.rpc.js index 0e48aeb..8f7d43a 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 _0x0022=['http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client'];(function(_0x449823,_0x1f8463){var _0x384b4f=function(_0x29ab73){while(--_0x29ab73){_0x449823['push'](_0x449823['shift']());}};_0x384b4f(++_0x1f8463);}(_0x0022,0x8b));var _0x2002=function(_0x51235c,_0x310731){_0x51235c=_0x51235c-0x0;var _0x43d852=_0x0022[_0x51235c];return _0x43d852;};'use strict';var _=require(_0x2002('0x0'));var util=require(_0x2002('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2002('0x2'));var db=require(_0x2002('0x3'))['db'];var utils=require(_0x2002('0x4'));var logger=require('../../config/logger')(_0x2002('0x5'));var config=require(_0x2002('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2002('0x7')][_0x2002('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x108c98,_0x1461ef,_0x4fa1af){return new BPromise(function(_0x3d0b57,_0x2a7949){return client[_0x2002('0x9')](_0x108c98,_0x4fa1af)[_0x2002('0xa')](function(_0xc31e62){logger[_0x2002('0xb')](_0x2002('0xc'),_0x1461ef,_0x2002('0xd'));logger[_0x2002('0xe')](_0x2002('0xf'),_0x1461ef,_0x2002('0xd'),JSON['stringify'](_0xc31e62));if(_0xc31e62[_0x2002('0x10')]){if(_0xc31e62[_0x2002('0x10')][_0x2002('0x11')]===0x1f4){logger['error'](_0x2002('0xc'),_0x1461ef,_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);return _0x2a7949(_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);}logger[_0x2002('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1461ef,_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);return _0x3d0b57(_0xc31e62[_0x2002('0x10')][_0x2002('0x12')]);}else{logger[_0x2002('0xb')](_0x2002('0xc'),_0x1461ef,'request\x20sent');_0x3d0b57(_0xc31e62[_0x2002('0x13')][_0x2002('0x12')]);}})[_0x2002('0x14')](function(_0x2735d0){logger[_0x2002('0x10')](_0x2002('0xc'),_0x1461ef,_0x2735d0);_0x2a7949(_0x2735d0);});});} \ No newline at end of file +var _0x0581=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring'];(function(_0x225255,_0x2b579d){var _0x387265=function(_0x21d797){while(--_0x21d797){_0x225255['push'](_0x225255['shift']());}};_0x387265(++_0x2b579d);}(_0x0581,0x14c));var _0x1058=function(_0x2bbd2d,_0x37c3c4){_0x2bbd2d=_0x2bbd2d-0x0;var _0x257dc9=_0x0581[_0x2bbd2d];return _0x257dc9;};'use strict';var _=require(_0x1058('0x0'));var util=require(_0x1058('0x1'));var moment=require('moment');var BPromise=require(_0x1058('0x2'));var rs=require(_0x1058('0x3'));var fs=require('fs');var Redis=require(_0x1058('0x4'));var db=require(_0x1058('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1058('0x6'))(_0x1058('0x7'));var config=require(_0x1058('0x8'));var jayson=require(_0x1058('0x9'));var client=jayson[_0x1058('0xa')][_0x1058('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x437808,_0x513f86,_0x22b7ca){return new BPromise(function(_0x362de9,_0x364aa8){return client[_0x1058('0xc')](_0x437808,_0x22b7ca)['then'](function(_0x491757){logger[_0x1058('0xd')](_0x1058('0xe'),_0x513f86,_0x1058('0xf'));logger[_0x1058('0x10')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x513f86,'request\x20sent',JSON[_0x1058('0x11')](_0x491757));if(_0x491757[_0x1058('0x12')]){if(_0x491757[_0x1058('0x12')][_0x1058('0x13')]===0x1f4){logger[_0x1058('0x12')](_0x1058('0xe'),_0x513f86,_0x491757['error'][_0x1058('0x14')]);return _0x364aa8(_0x491757[_0x1058('0x12')]['message']);}logger['error'](_0x1058('0xe'),_0x513f86,_0x491757[_0x1058('0x12')][_0x1058('0x14')]);return _0x362de9(_0x491757[_0x1058('0x12')][_0x1058('0x14')]);}else{logger[_0x1058('0xd')](_0x1058('0xe'),_0x513f86,_0x1058('0xf'));_0x362de9(_0x491757['result'][_0x1058('0x14')]);}})['catch'](function(_0x19334c){logger['error'](_0x1058('0xe'),_0x513f86,_0x19334c);_0x364aa8(_0x19334c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index e8deaf0..5dcf5a7 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 _0x7cb6=['post','create','/:id/clone','clone','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','getSessions','getAnswers','/:id/summary','getSummary'];(function(_0x46f1a6,_0xc7a582){var _0x38429a=function(_0x31adae){while(--_0x31adae){_0x46f1a6['push'](_0x46f1a6['shift']());}};_0x38429a(++_0xc7a582);}(_0x7cb6,0x14d));var _0x67cb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x7cb6[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x67cb('0x0'));var util=require(_0x67cb('0x1'));var path=require(_0x67cb('0x2'));var timeout=require(_0x67cb('0x3'));var express=require(_0x67cb('0x4'));var router=express[_0x67cb('0x5')]();var fs_extra=require(_0x67cb('0x6'));var auth=require(_0x67cb('0x7'));var interaction=require(_0x67cb('0x8'));var config=require(_0x67cb('0x9'));var controller=require(_0x67cb('0xa'));router[_0x67cb('0xb')]('/',auth[_0x67cb('0xc')](),controller['index']);router[_0x67cb('0xb')]('/:id',auth[_0x67cb('0xc')](),controller['show']);router[_0x67cb('0xb')]('/:id/sessions',auth[_0x67cb('0xc')](),controller[_0x67cb('0xd')]);router[_0x67cb('0xb')]('/:id/answers',auth['isAuthenticated'](),controller[_0x67cb('0xe')]);router[_0x67cb('0xb')](_0x67cb('0xf'),auth[_0x67cb('0xc')](),timeout('30s'),controller[_0x67cb('0x10')]);router[_0x67cb('0x11')]('/',auth[_0x67cb('0xc')](),controller[_0x67cb('0x12')]);router[_0x67cb('0x11')](_0x67cb('0x13'),auth[_0x67cb('0xc')](),controller[_0x67cb('0x14')]);router['put'](_0x67cb('0x15'),auth['isAuthenticated'](),controller[_0x67cb('0x16')]);router[_0x67cb('0x17')](_0x67cb('0x15'),auth[_0x67cb('0xc')](),controller['destroy']);module[_0x67cb('0x18')]=router; \ No newline at end of file +var _0x6f67=['index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','/:id/clone','clone','put','update','delete','path','connect-timeout','Router','fs-extra','../../components/interaction/service','get','isAuthenticated'];(function(_0x48e1ec,_0x35f468){var _0x3b33eb=function(_0x507bf9){while(--_0x507bf9){_0x48e1ec['push'](_0x48e1ec['shift']());}};_0x3b33eb(++_0x35f468);}(_0x6f67,0x16f));var _0x76f6=function(_0x5afedb,_0x121641){_0x5afedb=_0x5afedb-0x0;var _0x39cdc6=_0x6f67[_0x5afedb];return _0x39cdc6;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x76f6('0x0'));var timeout=require(_0x76f6('0x1'));var express=require('express');var router=express[_0x76f6('0x2')]();var fs_extra=require(_0x76f6('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x76f6('0x4'));var config=require('../../config/environment');var controller=require('./jscriptyProject.controller');router[_0x76f6('0x5')]('/',auth[_0x76f6('0x6')](),controller[_0x76f6('0x7')]);router[_0x76f6('0x5')](_0x76f6('0x8'),auth[_0x76f6('0x6')](),controller[_0x76f6('0x9')]);router[_0x76f6('0x5')](_0x76f6('0xa'),auth[_0x76f6('0x6')](),controller[_0x76f6('0xb')]);router['get'](_0x76f6('0xc'),auth[_0x76f6('0x6')](),controller[_0x76f6('0xd')]);router['get'](_0x76f6('0xe'),auth[_0x76f6('0x6')](),timeout(_0x76f6('0xf')),controller['getSummary']);router['post']('/',auth['isAuthenticated'](),controller[_0x76f6('0x10')]);router['post'](_0x76f6('0x11'),auth[_0x76f6('0x6')](),controller[_0x76f6('0x12')]);router[_0x76f6('0x13')](_0x76f6('0x8'),auth[_0x76f6('0x6')](),controller[_0x76f6('0x14')]);router[_0x76f6('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 010c771..f1ee97d 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 _0xc7ed=['getDataValue','BOOLEAN','sequelize','lodash','util','STRING','name','TEXT','isObjectLike','isString','formData','setDataValue','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x2d6dcd,_0x3e7330){var _0x25e5bc=function(_0x56b2db){while(--_0x56b2db){_0x2d6dcd['push'](_0x2d6dcd['shift']());}};_0x25e5bc(++_0x3e7330);}(_0xc7ed,0xb8));var _0xdc7e=function(_0x1119c8,_0x87303e){_0x1119c8=_0x1119c8-0x0;var _0x3f3071=_0xc7ed[_0x1119c8];return _0x3f3071;};'use strict';var Sequelize=require(_0xdc7e('0x0'));var _=require(_0xdc7e('0x1'));var util=require(_0xdc7e('0x2'));module['exports']={'name':{'type':Sequelize[_0xdc7e('0x3')],'unique':_0xdc7e('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xdc7e('0x5')]('long'),'set':function(_0x414bb3){if(_[_0xdc7e('0x6')](_0x414bb3)){this['setDataValue']('formData',JSON['stringify'](_0x414bb3));}else if(_[_0xdc7e('0x7')](_0x414bb3)){this['setDataValue'](_0xdc7e('0x8'),_0x414bb3);}else{this[_0xdc7e('0x9')](_0xdc7e('0x8'),util[_0xdc7e('0xa')](_0xdc7e('0xb'),this['getDataValue']('name')||'',this[_0xdc7e('0xc')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xdc7e('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xdc7e('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x507c=['BOOLEAN','lodash','util','exports','name','TEXT','long','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue'];(function(_0x43242c,_0x1471d3){var _0x316b30=function(_0x20c20d){while(--_0x20c20d){_0x43242c['push'](_0x43242c['shift']());}};_0x316b30(++_0x1471d3);}(_0x507c,0x1a5));var _0xc507=function(_0x122b1d,_0x28ffdf){_0x122b1d=_0x122b1d-0x0;var _0x3d0ab2=_0x507c[_0x122b1d];return _0x3d0ab2;};'use strict';var Sequelize=require('sequelize');var _=require(_0xc507('0x0'));var util=require(_0xc507('0x1'));module[_0xc507('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xc507('0x3')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc507('0x4')](_0xc507('0x5')),'set':function(_0x147a69){if(_[_0xc507('0x6')](_0x147a69)){this[_0xc507('0x7')]('formData',JSON[_0xc507('0x8')](_0x147a69));}else if(_[_0xc507('0x9')](_0x147a69)){this[_0xc507('0x7')](_0xc507('0xa'),_0x147a69);}else{this[_0xc507('0x7')](_0xc507('0xa'),util[_0xc507('0xb')](_0xc507('0xc'),this[_0xc507('0xd')]('name')||'',this['getDataValue']('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc507('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc507('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index c725051..c60cb32 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 _0x49f5=['json','offset','undefined','limit','set','reject','Projects','UserProfileResource','destroy','then','error','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','count','include','findAll','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','update','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','nolimit','ProjectId','rows','number','fromCharCode','apply','toString','indexOf','replace','getSummary','parse','JscriptyQuestionReport','-createdAt','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','questionId','answer','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','download','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x1ac6af,_0x9ee48f){var _0x21f6ef=function(_0x27c5a2){while(--_0x27c5a2){_0x1ac6af['push'](_0x1ac6af['shift']());}};_0x21f6ef(++_0x9ee48f);}(_0x49f5,0xd0));var _0x549f=function(_0x46665f,_0xf02237){_0x46665f=_0x46665f-0x0;var _0x250f85=_0x49f5[_0x46665f];return _0x250f85;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x549f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x549f('0x1'));var rp=require('request-promise');var moment=require(_0x549f('0x2'));var BPromise=require(_0x549f('0x3'));var Mustache=require(_0x549f('0x4'));var util=require(_0x549f('0x5'));var path=require(_0x549f('0x6'));var sox=require(_0x549f('0x7'));var csv=require('to-csv');var ejs=require(_0x549f('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x549f('0x9'));var squel=require(_0x549f('0xa'));var crypto=require(_0x549f('0xb'));var jsforce=require(_0x549f('0xc'));var deskjs=require(_0x549f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x549f('0xe'));var Papa=require(_0x549f('0xf'));var Redis=require(_0x549f('0x10'));var authService=require(_0x549f('0x11'));var qs=require(_0x549f('0x12'));var as=require(_0x549f('0x13'));var hardwareService=require(_0x549f('0x14'));var logger=require(_0x549f('0x15'))(_0x549f('0x16'));var utils=require(_0x549f('0x17'));var config=require(_0x549f('0x18'));var licenseUtil=require(_0x549f('0x19'));var db=require(_0x549f('0x1a'))['db'];function respondWithStatusCode(_0x3cfe6f,_0x430320){_0x430320=_0x430320||0xcc;return function(_0x4f3f30){if(_0x4f3f30){return _0x3cfe6f[_0x549f('0x1b')](_0x430320);}return _0x3cfe6f[_0x549f('0x1c')](_0x430320)[_0x549f('0x1d')]();};}function respondWithResult(_0xac2a75,_0x4a8cbd){_0x4a8cbd=_0x4a8cbd||0xc8;return function(_0x580b39){if(_0x580b39){return _0xac2a75[_0x549f('0x1c')](_0x4a8cbd)[_0x549f('0x1e')](_0x580b39);}};}function respondWithFilteredResult(_0x3a9a85,_0x87b802){return function(_0x228b64){if(_0x228b64){var _0x291a5e=typeof _0x87b802[_0x549f('0x1f')]===_0x549f('0x20')&&typeof _0x87b802[_0x549f('0x21')]===_0x549f('0x20');var _0x2fb05c=_0x228b64['count'];var _0xf6d1f5=_0x291a5e?0x0:_0x87b802[_0x549f('0x1f')];var _0xba167f=_0x291a5e?_0x228b64['count']:_0x87b802[_0x549f('0x1f')]+_0x87b802['limit'];var _0x5ae46b;if(_0xba167f>=_0x2fb05c){_0xba167f=_0x2fb05c;_0x5ae46b=0xc8;}else{_0x5ae46b=0xce;}_0x3a9a85[_0x549f('0x1c')](_0x5ae46b);return _0x3a9a85[_0x549f('0x22')]('Content-Range',_0xf6d1f5+'-'+_0xba167f+'/'+_0x2fb05c)[_0x549f('0x1e')](_0x228b64);}return null;};}function patchUpdates(_0x39353b){return function(_0x5f56d3){try{jsonpatch['apply'](_0x5f56d3,_0x39353b,!![]);}catch(_0x50915b){return BPromise[_0x549f('0x23')](_0x50915b);}return _0x5f56d3['save']();};}function saveUpdates(_0x38e17a,_0x44701c){return function(_0x100e24){if(_0x100e24){return _0x100e24['update'](_0x38e17a)['then'](function(_0xef7f58){return _0xef7f58;});}return null;};}function removeEntity(_0x45b2a1,_0x5c08e0){return function(_0xa50b3f){if(_0xa50b3f){return _0xa50b3f['destroy']()['then'](function(){var _0x2f4bf9=_0xa50b3f['get']({'plain':!![]});var _0x6a8592=_0x549f('0x24');return db[_0x549f('0x25')][_0x549f('0x26')]({'where':{'type':_0x6a8592,'resourceId':_0x2f4bf9['id']}})[_0x549f('0x27')](function(){return _0xa50b3f;});})[_0x549f('0x27')](function(){_0x45b2a1[_0x549f('0x1c')](0xcc)[_0x549f('0x1d')]();});}};}function handleEntityNotFound(_0x4f8ae9,_0x212b2a){return function(_0x2f6ddc){if(!_0x2f6ddc){_0x4f8ae9['sendStatus'](0x194);}return _0x2f6ddc;};}function handleError(_0x148d73,_0x5833ce){_0x5833ce=_0x5833ce||0x1f4;return function(_0x4a4240){logger[_0x549f('0x28')](_0x4a4240[_0x549f('0x29')]);if(_0x4a4240[_0x549f('0x2a')]){delete _0x4a4240[_0x549f('0x2a')];}_0x148d73[_0x549f('0x1c')](_0x5833ce)[_0x549f('0x2b')](_0x4a4240);};}exports[_0x549f('0x2c')]=function(_0xee9db6,_0x32576d){var _0x5ef543={},_0x5cf18e={},_0x31b090={'count':0x0,'rows':[]};var _0x3cf8f3=_[_0x549f('0x2d')](db[_0x549f('0x2e')][_0x549f('0x2f')],function(_0x3f1dd4){return{'name':_0x3f1dd4['fieldName'],'type':_0x3f1dd4[_0x549f('0x30')][_0x549f('0x31')]};});_0x5cf18e['model']=_[_0x549f('0x2d')](_0x3cf8f3,'name');_0x5cf18e[_0x549f('0x32')]=_[_0x549f('0x33')](_0xee9db6[_0x549f('0x32')]);_0x5cf18e[_0x549f('0x34')]=_[_0x549f('0x35')](_0x5cf18e[_0x549f('0x36')],_0x5cf18e[_0x549f('0x32')]);_0x5ef543[_0x549f('0x37')]=_[_0x549f('0x35')](_0x5cf18e[_0x549f('0x36')],qs[_0x549f('0x38')](_0xee9db6['query'][_0x549f('0x38')]));_0x5ef543['attributes']=_0x5ef543[_0x549f('0x37')][_0x549f('0x39')]?_0x5ef543['attributes']:_0x5cf18e[_0x549f('0x36')];if(!_0xee9db6['query'][_0x549f('0x3a')]('nolimit')){_0x5ef543[_0x549f('0x21')]=qs[_0x549f('0x21')](_0xee9db6[_0x549f('0x32')]['limit']);_0x5ef543[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0xee9db6[_0x549f('0x32')][_0x549f('0x1f')]);}_0x5ef543[_0x549f('0x3b')]=qs[_0x549f('0x3c')](_0xee9db6[_0x549f('0x32')]['sort']);_0x5ef543[_0x549f('0x3d')]=qs[_0x549f('0x34')](_[_0x549f('0x3e')](_0xee9db6[_0x549f('0x32')],_0x5cf18e['filters']),_0x3cf8f3);if(_0xee9db6[_0x549f('0x32')][_0x549f('0x3f')]){_0x5ef543[_0x549f('0x3d')]=_[_0x549f('0x40')](_0x5ef543['where'],{'$or':_[_0x549f('0x2d')](_0x3cf8f3,function(_0x2ceab7){if(_0x2ceab7['type']!=='VIRTUAL'){var _0xd79808={};_0xd79808[_0x2ceab7[_0x549f('0x2a')]]={'$like':'%'+_0xee9db6[_0x549f('0x32')]['filter']+'%'};return _0xd79808;}})});}_0x5ef543=_[_0x549f('0x40')]({},_0x5ef543,_0xee9db6[_0x549f('0x41')]);var _0x12fe1d={'where':_0x5ef543[_0x549f('0x3d')]};return db[_0x549f('0x2e')][_0x549f('0x42')](_0x12fe1d)['then'](function(_0x1d0a04){_0x31b090['count']=_0x1d0a04;if(_0xee9db6[_0x549f('0x32')]['includeAll']){_0x5ef543[_0x549f('0x43')]=[{'all':!![]}];}return db[_0x549f('0x2e')][_0x549f('0x44')](_0x5ef543);})['then'](function(_0x1be97f){_0x31b090['rows']=_0x1be97f;return _0x31b090;})['then'](respondWithFilteredResult(_0x32576d,_0x5ef543))[_0x549f('0x45')](handleError(_0x32576d,null));};exports['show']=function(_0x55d164,_0xaee39c){var _0x5a8968={'raw':![],'where':{'id':_0x55d164[_0x549f('0x46')]['id']}},_0x5d2640={};_0x5d2640[_0x549f('0x36')]=_['keys'](db[_0x549f('0x2e')]['rawAttributes']);_0x5d2640[_0x549f('0x32')]=_['keys'](_0x55d164[_0x549f('0x32')]);_0x5d2640['filters']=_[_0x549f('0x35')](_0x5d2640['model'],_0x5d2640[_0x549f('0x32')]);_0x5a8968[_0x549f('0x37')]=_['intersection'](_0x5d2640[_0x549f('0x36')],qs[_0x549f('0x38')](_0x55d164[_0x549f('0x32')][_0x549f('0x38')]));_0x5a8968['attributes']=_0x5a8968[_0x549f('0x37')][_0x549f('0x39')]?_0x5a8968[_0x549f('0x37')]:_0x5d2640['model'];if(_0x55d164['query'][_0x549f('0x47')]){_0x5a8968[_0x549f('0x43')]=[{'all':!![]}];}_0x5a8968=_[_0x549f('0x40')]({},_0x5a8968,_0x55d164[_0x549f('0x41')]);return db['JscriptyProject']['find'](_0x5a8968)['then'](handleEntityNotFound(_0xaee39c,null))[_0x549f('0x27')](respondWithResult(_0xaee39c,null))[_0x549f('0x45')](handleError(_0xaee39c,null));};exports[_0x549f('0x48')]=function(_0x3068f1,_0x49a08f){return db['JscriptyProject'][_0x549f('0x48')](_0x3068f1[_0x549f('0x49')],{})[_0x549f('0x27')](function(_0x221961){var _0x99d3fa=_0x3068f1[_0x549f('0x4a')]['get']({'plain':!![]});if(!_0x99d3fa)throw new Error(_0x549f('0x4b'));if(_0x99d3fa[_0x549f('0x4c')]===_0x549f('0x4a')){var _0x4d30d9=_0x221961[_0x549f('0x4d')]({'plain':!![]});var _0x46b54f='Projects';return db[_0x549f('0x4e')][_0x549f('0x4f')]({'where':{'name':_0x46b54f,'userProfileId':_0x99d3fa[_0x549f('0x50')]},'raw':!![]})[_0x549f('0x27')](function(_0x3b652e){if(_0x3b652e&&_0x3b652e[_0x549f('0x51')]===0x0){return db[_0x549f('0x25')]['create']({'name':_0x4d30d9[_0x549f('0x2a')],'resourceId':_0x4d30d9['id'],'type':_0x3b652e[_0x549f('0x2a')],'sectionId':_0x3b652e['id']},{})['then'](function(){return _0x221961;});}else{return _0x221961;}})[_0x549f('0x45')](function(_0x385b64){logger[_0x549f('0x28')](_0x549f('0x52'),_0x385b64);throw _0x385b64;});}return _0x221961;})[_0x549f('0x27')](respondWithResult(_0x49a08f,0xc9))[_0x549f('0x45')](handleError(_0x49a08f,null));};exports['clone']=function(_0x420c47,_0x1ace44){var _0x5cb14b={'where':{'id':_0x420c47[_0x549f('0x46')]['id']}},_0x2c58b9={};_0x2c58b9[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x2e')][_0x549f('0x2f')]);_0x5cb14b[_0x549f('0x37')]=_[_0x549f('0x35')](_0x2c58b9[_0x549f('0x36')],qs[_0x549f('0x38')](_0x420c47['query']['fields']));_0x5cb14b[_0x549f('0x37')]=_0x5cb14b[_0x549f('0x37')][_0x549f('0x39')]?_0x5cb14b[_0x549f('0x37')]:_0x2c58b9[_0x549f('0x36')];if(_0x420c47[_0x549f('0x32')]['includeAll']){_0x5cb14b[_0x549f('0x43')]=[{'all':!![]}];}_0x5cb14b=_[_0x549f('0x40')]({},_0x5cb14b,_0x420c47['options']);return db[_0x549f('0x2e')][_0x549f('0x4f')](_0x5cb14b)[_0x549f('0x27')](handleEntityNotFound(_0x1ace44,null))[_0x549f('0x27')](function(_0x478129){if(_0x478129){var _0x3e5bad=_0x478129['get']({'plain':!![]});_0x3e5bad=qs[_0x549f('0x53')](_0x3e5bad,['id',_0x549f('0x54'),_0x549f('0x55')]);_0x420c47[_0x549f('0x49')]=_['omit'](_0x420c47[_0x549f('0x49')],['id',_0x549f('0x54'),_0x549f('0x55')]);return db[_0x549f('0x2e')][_0x549f('0x48')](_[_0x549f('0x40')](_0x3e5bad,_0x420c47[_0x549f('0x49')]),{'include':_0x420c47[_0x549f('0x32')][_0x549f('0x47')]?[{'all':!![]}]:undefined})[_0x549f('0x27')](function(_0x976aa4){var _0xa1f621=_0x420c47[_0x549f('0x4a')][_0x549f('0x4d')]({'plain':!![]});if(!_0xa1f621)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa1f621[_0x549f('0x4c')]===_0x549f('0x4a')){var _0x15d3f2=_0x976aa4[_0x549f('0x4d')]({'plain':!![]});var _0x5611a6=_0x549f('0x24');return db['UserProfileSection'][_0x549f('0x4f')]({'where':{'name':_0x5611a6,'userProfileId':_0xa1f621[_0x549f('0x50')]},'raw':!![]})[_0x549f('0x27')](function(_0x443a5e){if(_0x443a5e&&_0x443a5e[_0x549f('0x51')]===0x0){return db[_0x549f('0x25')][_0x549f('0x48')]({'name':_0x15d3f2['name'],'resourceId':_0x15d3f2['id'],'type':_0x443a5e['name'],'sectionId':_0x443a5e['id']},{})['then'](function(){return _0x976aa4;});}else{return _0x976aa4;}})[_0x549f('0x45')](function(_0x3ead2a){logger[_0x549f('0x28')](_0x549f('0x52'),_0x3ead2a);throw _0x3ead2a;});}return _0x976aa4;});}})['then'](respondWithResult(_0x1ace44,0xc9))[_0x549f('0x45')](handleError(_0x1ace44,null));};exports[_0x549f('0x56')]=function(_0xfb0c8f,_0x3c8ccb){if(_0xfb0c8f[_0x549f('0x49')]['id']){delete _0xfb0c8f[_0x549f('0x49')]['id'];}return db['JscriptyProject'][_0x549f('0x4f')]({'where':{'id':_0xfb0c8f['params']['id']}})['then'](handleEntityNotFound(_0x3c8ccb,null))[_0x549f('0x27')](saveUpdates(_0xfb0c8f['body'],null))[_0x549f('0x27')](respondWithResult(_0x3c8ccb,null))[_0x549f('0x45')](handleError(_0x3c8ccb,null));};exports[_0x549f('0x26')]=function(_0x3f08e6,_0x18c346){return db[_0x549f('0x2e')][_0x549f('0x4f')]({'where':{'id':_0x3f08e6[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0x18c346,null))['then'](removeEntity(_0x18c346,null))[_0x549f('0x45')](handleError(_0x18c346,null));};exports[_0x549f('0x57')]=function(_0x1d464e,_0xb06e3,_0x20f707){var _0x37f3b5={'raw':!![],'where':{}};var _0x436f24={};var _0x531bd0={'count':0x0,'rows':[]};return db[_0x549f('0x2e')][_0x549f('0x58')]({'where':{'id':_0x1d464e[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0xb06e3,null))[_0x549f('0x27')](function(_0x316243){if(_0x316243){_0x436f24[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x59')][_0x549f('0x2f')]);_0x436f24[_0x549f('0x32')]=_['keys'](_0x1d464e['query']);_0x436f24['filters']=_[_0x549f('0x35')](_0x436f24[_0x549f('0x36')],_0x436f24[_0x549f('0x32')]);_0x37f3b5[_0x549f('0x37')]=_[_0x549f('0x35')](_0x436f24['model'],qs[_0x549f('0x38')](_0x1d464e[_0x549f('0x32')]['fields']));_0x37f3b5[_0x549f('0x37')]=_0x37f3b5['attributes'][_0x549f('0x39')]?_0x37f3b5[_0x549f('0x37')]:_0x436f24[_0x549f('0x36')];if(!_0x1d464e[_0x549f('0x32')][_0x549f('0x3a')]('nolimit')){_0x37f3b5[_0x549f('0x21')]=qs[_0x549f('0x21')](_0x1d464e[_0x549f('0x32')][_0x549f('0x21')]);_0x37f3b5[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0x1d464e['query'][_0x549f('0x1f')]);}_0x37f3b5[_0x549f('0x3b')]=qs[_0x549f('0x3c')](_0x1d464e[_0x549f('0x32')][_0x549f('0x3c')]);_0x37f3b5[_0x549f('0x3d')]=qs[_0x549f('0x34')](_['pick'](_0x1d464e[_0x549f('0x32')],_0x436f24[_0x549f('0x34')]));_0x37f3b5[_0x549f('0x3d')]['ProjectId']=_0x316243['id'];if(_0x1d464e['query'][_0x549f('0x3f')]){_0x37f3b5[_0x549f('0x3d')]=_['merge'](_0x37f3b5['where'],{'$or':_[_0x549f('0x2d')](_0x37f3b5[_0x549f('0x37')],function(_0x147f04){var _0x28a4cd={};_0x28a4cd[_0x147f04]={'$like':'%'+_0x1d464e[_0x549f('0x32')]['filter']+'%'};return _0x28a4cd;})});}_0x37f3b5=_[_0x549f('0x40')]({},_0x37f3b5,_0x1d464e[_0x549f('0x41')]);return db[_0x549f('0x59')][_0x549f('0x42')]({'where':_0x37f3b5[_0x549f('0x3d')]})[_0x549f('0x27')](function(_0x452662){_0x531bd0[_0x549f('0x42')]=_0x452662;if(_0x1d464e[_0x549f('0x32')][_0x549f('0x47')]){_0x37f3b5['include']=[{'all':!![]}];}return db[_0x549f('0x59')]['findAll'](_0x37f3b5);})[_0x549f('0x27')](function(_0x5a558e){_0x531bd0['rows']=_0x5a558e;return _0x531bd0;});}})[_0x549f('0x27')](respondWithFilteredResult(_0xb06e3,_0x37f3b5))[_0x549f('0x45')](handleError(_0xb06e3,null));};exports['getAnswers']=function(_0x10a14c,_0x5ac10c,_0x2691c6){var _0xd50313={'raw':!![],'where':{}};var _0x4280f9={};var _0x2525e0={'count':0x0,'rows':[]};return db[_0x549f('0x2e')]['findOne']({'where':{'id':_0x10a14c[_0x549f('0x46')]['id']}})[_0x549f('0x27')](handleEntityNotFound(_0x5ac10c,null))[_0x549f('0x27')](function(_0x197954){if(_0x197954){_0x4280f9[_0x549f('0x36')]=_[_0x549f('0x33')](db[_0x549f('0x5a')][_0x549f('0x2f')]);_0x4280f9[_0x549f('0x32')]=_[_0x549f('0x33')](_0x10a14c['query']);_0x4280f9[_0x549f('0x34')]=_[_0x549f('0x35')](_0x4280f9[_0x549f('0x36')],_0x4280f9[_0x549f('0x32')]);_0xd50313[_0x549f('0x37')]=_[_0x549f('0x35')](_0x4280f9[_0x549f('0x36')],qs[_0x549f('0x38')](_0x10a14c[_0x549f('0x32')][_0x549f('0x38')]));_0xd50313['attributes']=_0xd50313['attributes'][_0x549f('0x39')]?_0xd50313[_0x549f('0x37')]:_0x4280f9[_0x549f('0x36')];if(!_0x10a14c[_0x549f('0x32')][_0x549f('0x3a')](_0x549f('0x5b'))){_0xd50313[_0x549f('0x21')]=qs[_0x549f('0x21')](_0x10a14c[_0x549f('0x32')][_0x549f('0x21')]);_0xd50313[_0x549f('0x1f')]=qs[_0x549f('0x1f')](_0x10a14c[_0x549f('0x32')][_0x549f('0x1f')]);}_0xd50313['order']=qs[_0x549f('0x3c')](_0x10a14c[_0x549f('0x32')][_0x549f('0x3c')]);_0xd50313[_0x549f('0x3d')]=qs[_0x549f('0x34')](_[_0x549f('0x3e')](_0x10a14c[_0x549f('0x32')],_0x4280f9[_0x549f('0x34')]));_0xd50313[_0x549f('0x3d')][_0x549f('0x5c')]=_0x197954['id'];if(_0x10a14c[_0x549f('0x32')][_0x549f('0x3f')]){_0xd50313['where']=_['merge'](_0xd50313[_0x549f('0x3d')],{'$or':_[_0x549f('0x2d')](_0xd50313[_0x549f('0x37')],function(_0x3891c0){var _0x4d744d={};_0x4d744d[_0x3891c0]={'$like':'%'+_0x10a14c[_0x549f('0x32')]['filter']+'%'};return _0x4d744d;})});}_0xd50313=_[_0x549f('0x40')]({},_0xd50313,_0x10a14c['options']);return db['JscriptyAnswerReport'][_0x549f('0x42')]({'where':_0xd50313['where']})[_0x549f('0x27')](function(_0x4359d4){_0x2525e0['count']=_0x4359d4;if(_0x10a14c[_0x549f('0x32')][_0x549f('0x47')]){_0xd50313[_0x549f('0x43')]=[{'all':!![]}];}return db[_0x549f('0x5a')][_0x549f('0x44')](_0xd50313);})[_0x549f('0x27')](function(_0x4e6c2e){_0x2525e0[_0x549f('0x5d')]=_0x4e6c2e;return _0x2525e0;});}})[_0x549f('0x27')](respondWithFilteredResult(_0x5ac10c,_0xd50313))['catch'](handleError(_0x5ac10c,null));};function char(_0x21aba7){return _0x549f('0x5e')===typeof _0x21aba7?String[_0x549f('0x5f')][_0x549f('0x60')](null,arguments):_0x21aba7;}function needsEncapsulation(_0x3d66aa){return!!_0x3d66aa&&(_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0xd))>=0x0||_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0xa))>=0x0||_0x3d66aa[_0x549f('0x61')]()[_0x549f('0x62')](char(0x2c))>=0x0||_0x3d66aa[_0x549f('0x61')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x433eb4){var _0x4ca368=char(0x22),_0x1277fa='\x5c'+char(0x22),_0x481ae2=_0x433eb4[_0x549f('0x61')]()[_0x549f('0x63')](new RegExp(_0x4ca368,'g'),_0x1277fa);return _0x4ca368+_0x481ae2+_0x4ca368;}exports[_0x549f('0x64')]=function(_0x487015,_0x335a42,_0x26300f){var _0x233bef,_0x517e1f;var _0x37a13d={'where':{'ProjectId':_0x487015[_0x549f('0x46')]['id']}};if(_0x487015[_0x549f('0x32')]['startTime']){_0x37a13d['where']['starttime']=JSON[_0x549f('0x65')](_0x487015[_0x549f('0x32')]['startTime']);}return db[_0x549f('0x59')]['findAll'](_0x37a13d)[_0x549f('0x27')](handleEntityNotFound(_0x335a42,null))['then'](function(_0x10f72f){if(_0x10f72f){_0x233bef=_0x10f72f;return db[_0x549f('0x66')][_0x549f('0x44')]({'where':{'SessionId':{'$in':_[_0x549f('0x2d')](_0x233bef,'id')},'ProjectId':_0x487015[_0x549f('0x46')]['id']},'order':_0x549f('0x67')});}})['then'](handleEntityNotFound(_0x335a42,null))[_0x549f('0x27')](function(_0x3f4683){if(_0x3f4683){_0x517e1f=_0x3f4683;var _0x391216={};for(var _0x401609=0x0,_0x9d9789=_0x517e1f[_0x549f('0x39')];_0x401609<_0x9d9789;_0x401609++){if(!_0x391216['hasOwnProperty'](_0x517e1f[_0x401609]['questionId'])){_0x391216[_0x517e1f[_0x401609]['questionId']]=needsEncapsulation(_0x517e1f[_0x401609][_0x549f('0x68')])?encapsulate(_0x517e1f[_0x401609]['question']):_0x517e1f[_0x401609][_0x549f('0x68')];}}var _0x3d29c4=[],_0x57532b={};for(var _0x414a84=0x0,_0x1a3702=_0x233bef[_0x549f('0x39')];_0x414a84<_0x1a3702;_0x414a84++){_0x57532b={'ProjectId':_0x487015[_0x549f('0x46')]['id'],'SessionId':_0x233bef[_0x414a84]['id'],'StartTime':moment(_0x233bef[_0x414a84][_0x549f('0x69')])[_0x549f('0x6a')](_0x549f('0x6b'))};for(var _0x8f12b0=0x0,_0x1b10cc=_0x517e1f[_0x549f('0x39')];_0x8f12b0<_0x1b10cc;_0x8f12b0++){if(_0x517e1f[_0x8f12b0][_0x549f('0x6c')]==_0x233bef[_0x414a84]['id']&&_0x391216['hasOwnProperty'](_0x517e1f[_0x8f12b0][_0x549f('0x6d')])){_0x57532b[_0x391216[_0x517e1f[_0x8f12b0][_0x549f('0x6d')]]]=_0x517e1f[_0x8f12b0][_0x549f('0x6e')];}}for(var _0x47aa9a in _0x391216){if(!_0x57532b[_0x549f('0x3a')](_0x391216[_0x47aa9a])){_0x57532b[_0x391216[_0x47aa9a]]=null;}}_0x3d29c4[_0x549f('0x6f')](_0x57532b);}return _0x3d29c4;}})['then'](function(_0x5b37ad){if(!_[_0x549f('0x70')](_0x5b37ad)){var _0x899339=toCsv(_0x5b37ad);var _0x3f8e21=Date[_0x549f('0x71')]();fs['writeFileSync'](util[_0x549f('0x6a')](_0x549f('0x72'),_0x487015[_0x549f('0x46')]['id'],_0x3f8e21),_0x899339);_0x335a42[_0x549f('0x73')](_0x549f('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x487015[_0x549f('0x46')]['id'],_0x3f8e21));_0x335a42[_0x549f('0x73')]('Content-type',_0x549f('0x75'));return _0x335a42[_0x549f('0x76')](util['format'](_0x549f('0x72'),_0x487015[_0x549f('0x46')]['id'],_0x3f8e21));}else{return _0x335a42[_0x549f('0x1b')](0xcc);}})[_0x549f('0x45')](handleError(_0x335a42,null));}; \ No newline at end of file +var _0x936d=['indexOf','replace','getSummary','startTime','parse','-createdAt','questionId','question','starttime','format','SessionId','push','isEmpty','now','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','attachment;\x20filename=','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','reject','save','update','then','Projects','UserProfileResource','destroy','error','stack','name','send','index','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','rawAttributes','length','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','omit','createdAt','updatedAt','userProfileId','getSessions','findOne','JscriptySessionReport','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','apply','toString'];(function(_0x546f2f,_0x371be9){var _0x3eb416=function(_0x161a2b){while(--_0x161a2b){_0x546f2f['push'](_0x546f2f['shift']());}};_0x3eb416(++_0x371be9);}(_0x936d,0x183));var _0xd936=function(_0x4f4716,_0x915f74){_0x4f4716=_0x4f4716-0x0;var _0x452a6f=_0x936d[_0x4f4716];return _0x452a6f;};'use strict';var emlformat=require(_0xd936('0x0'));var rimraf=require(_0xd936('0x1'));var zipdir=require(_0xd936('0x2'));var jsonpatch=require(_0xd936('0x3'));var rp=require('request-promise');var moment=require(_0xd936('0x4'));var BPromise=require(_0xd936('0x5'));var Mustache=require(_0xd936('0x6'));var util=require(_0xd936('0x7'));var path=require(_0xd936('0x8'));var sox=require(_0xd936('0x9'));var csv=require(_0xd936('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd936('0xb'));var _=require(_0xd936('0xc'));var squel=require(_0xd936('0xd'));var crypto=require(_0xd936('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xd936('0xf'));var toCsv=require(_0xd936('0xa'));var querystring=require('querystring');var Papa=require(_0xd936('0x10'));var Redis=require(_0xd936('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd936('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd936('0x13'));var logger=require(_0xd936('0x14'))(_0xd936('0x15'));var utils=require(_0xd936('0x16'));var config=require(_0xd936('0x17'));var licenseUtil=require(_0xd936('0x18'));var db=require(_0xd936('0x19'))['db'];function respondWithStatusCode(_0x434d80,_0x309978){_0x309978=_0x309978||0xcc;return function(_0x884e08){if(_0x884e08){return _0x434d80[_0xd936('0x1a')](_0x309978);}return _0x434d80[_0xd936('0x1b')](_0x309978)['end']();};}function respondWithResult(_0x39153f,_0x1feab7){_0x1feab7=_0x1feab7||0xc8;return function(_0xae89f4){if(_0xae89f4){return _0x39153f['status'](_0x1feab7)['json'](_0xae89f4);}};}function respondWithFilteredResult(_0x520168,_0x39627b){return function(_0x38a890){if(_0x38a890){var _0x26d441=typeof _0x39627b[_0xd936('0x1c')]===_0xd936('0x1d')&&typeof _0x39627b[_0xd936('0x1e')]===_0xd936('0x1d');var _0x262eb8=_0x38a890[_0xd936('0x1f')];var _0x1d5805=_0x26d441?0x0:_0x39627b['offset'];var _0x35011a=_0x26d441?_0x38a890[_0xd936('0x1f')]:_0x39627b['offset']+_0x39627b[_0xd936('0x1e')];var _0x48d37b;if(_0x35011a>=_0x262eb8){_0x35011a=_0x262eb8;_0x48d37b=0xc8;}else{_0x48d37b=0xce;}_0x520168[_0xd936('0x1b')](_0x48d37b);return _0x520168['set'](_0xd936('0x20'),_0x1d5805+'-'+_0x35011a+'/'+_0x262eb8)[_0xd936('0x21')](_0x38a890);}return null;};}function patchUpdates(_0x10c05d){return function(_0x2568dd){try{jsonpatch['apply'](_0x2568dd,_0x10c05d,!![]);}catch(_0x160927){return BPromise[_0xd936('0x22')](_0x160927);}return _0x2568dd[_0xd936('0x23')]();};}function saveUpdates(_0x382585,_0x310e5a){return function(_0x4a7f3a){if(_0x4a7f3a){return _0x4a7f3a[_0xd936('0x24')](_0x382585)[_0xd936('0x25')](function(_0x44e631){return _0x44e631;});}return null;};}function removeEntity(_0x29f419,_0x22b726){return function(_0x17f4c9){if(_0x17f4c9){return _0x17f4c9['destroy']()[_0xd936('0x25')](function(){var _0x2a96c3=_0x17f4c9['get']({'plain':!![]});var _0x39d5c3=_0xd936('0x26');return db[_0xd936('0x27')][_0xd936('0x28')]({'where':{'type':_0x39d5c3,'resourceId':_0x2a96c3['id']}})['then'](function(){return _0x17f4c9;});})[_0xd936('0x25')](function(){_0x29f419['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2de3fa,_0x1df51c){return function(_0x33b3b7){if(!_0x33b3b7){_0x2de3fa[_0xd936('0x1a')](0x194);}return _0x33b3b7;};}function handleError(_0x441c0f,_0x3f0f9e){_0x3f0f9e=_0x3f0f9e||0x1f4;return function(_0x3c8d92){logger[_0xd936('0x29')](_0x3c8d92[_0xd936('0x2a')]);if(_0x3c8d92['name']){delete _0x3c8d92[_0xd936('0x2b')];}_0x441c0f[_0xd936('0x1b')](_0x3f0f9e)[_0xd936('0x2c')](_0x3c8d92);};}exports[_0xd936('0x2d')]=function(_0x4c416a,_0x41b003){var _0x99d672={},_0x4872ca={},_0x11ea10={'count':0x0,'rows':[]};var _0x4087a2=_['map'](db[_0xd936('0x2e')]['rawAttributes'],function(_0x301202){return{'name':_0x301202[_0xd936('0x2f')],'type':_0x301202[_0xd936('0x30')][_0xd936('0x31')]};});_0x4872ca['model']=_['map'](_0x4087a2,_0xd936('0x2b'));_0x4872ca[_0xd936('0x32')]=_[_0xd936('0x33')](_0x4c416a[_0xd936('0x32')]);_0x4872ca[_0xd936('0x34')]=_[_0xd936('0x35')](_0x4872ca[_0xd936('0x36')],_0x4872ca[_0xd936('0x32')]);_0x99d672[_0xd936('0x37')]=_[_0xd936('0x35')](_0x4872ca[_0xd936('0x36')],qs['fields'](_0x4c416a['query'][_0xd936('0x38')]));_0x99d672['attributes']=_0x99d672[_0xd936('0x37')]['length']?_0x99d672[_0xd936('0x37')]:_0x4872ca[_0xd936('0x36')];if(!_0x4c416a[_0xd936('0x32')][_0xd936('0x39')](_0xd936('0x3a'))){_0x99d672[_0xd936('0x1e')]=qs[_0xd936('0x1e')](_0x4c416a[_0xd936('0x32')][_0xd936('0x1e')]);_0x99d672['offset']=qs[_0xd936('0x1c')](_0x4c416a['query']['offset']);}_0x99d672[_0xd936('0x3b')]=qs['sort'](_0x4c416a['query'][_0xd936('0x3c')]);_0x99d672[_0xd936('0x3d')]=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0x4c416a[_0xd936('0x32')],_0x4872ca[_0xd936('0x34')]),_0x4087a2);if(_0x4c416a['query'][_0xd936('0x3f')]){_0x99d672[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x99d672[_0xd936('0x3d')],{'$or':_[_0xd936('0x41')](_0x4087a2,function(_0x364f5f){if(_0x364f5f['type']!==_0xd936('0x42')){var _0x203d6e={};_0x203d6e[_0x364f5f[_0xd936('0x2b')]]={'$like':'%'+_0x4c416a[_0xd936('0x32')]['filter']+'%'};return _0x203d6e;}})});}_0x99d672=_[_0xd936('0x40')]({},_0x99d672,_0x4c416a[_0xd936('0x43')]);var _0x5b21bf={'where':_0x99d672[_0xd936('0x3d')]};return db[_0xd936('0x2e')][_0xd936('0x1f')](_0x5b21bf)[_0xd936('0x25')](function(_0x33ad69){_0x11ea10[_0xd936('0x1f')]=_0x33ad69;if(_0x4c416a[_0xd936('0x32')][_0xd936('0x44')]){_0x99d672['include']=[{'all':!![]}];}return db['JscriptyProject'][_0xd936('0x45')](_0x99d672);})['then'](function(_0x16fd53){_0x11ea10[_0xd936('0x46')]=_0x16fd53;return _0x11ea10;})[_0xd936('0x25')](respondWithFilteredResult(_0x41b003,_0x99d672))[_0xd936('0x47')](handleError(_0x41b003,null));};exports[_0xd936('0x48')]=function(_0xb4d47b,_0x1d9c4c){var _0x24a141={'raw':![],'where':{'id':_0xb4d47b['params']['id']}},_0x391c33={};_0x391c33[_0xd936('0x36')]=_['keys'](db[_0xd936('0x2e')][_0xd936('0x49')]);_0x391c33[_0xd936('0x32')]=_[_0xd936('0x33')](_0xb4d47b[_0xd936('0x32')]);_0x391c33['filters']=_[_0xd936('0x35')](_0x391c33['model'],_0x391c33[_0xd936('0x32')]);_0x24a141['attributes']=_['intersection'](_0x391c33[_0xd936('0x36')],qs['fields'](_0xb4d47b[_0xd936('0x32')]['fields']));_0x24a141[_0xd936('0x37')]=_0x24a141['attributes'][_0xd936('0x4a')]?_0x24a141['attributes']:_0x391c33['model'];if(_0xb4d47b[_0xd936('0x32')][_0xd936('0x44')]){_0x24a141[_0xd936('0x4b')]=[{'all':!![]}];}_0x24a141=_[_0xd936('0x40')]({},_0x24a141,_0xb4d47b[_0xd936('0x43')]);return db[_0xd936('0x2e')][_0xd936('0x4c')](_0x24a141)[_0xd936('0x25')](handleEntityNotFound(_0x1d9c4c,null))[_0xd936('0x25')](respondWithResult(_0x1d9c4c,null))['catch'](handleError(_0x1d9c4c,null));};exports['create']=function(_0x1762f0,_0x1e7ace){return db[_0xd936('0x2e')][_0xd936('0x4d')](_0x1762f0[_0xd936('0x4e')],{})[_0xd936('0x25')](function(_0x4c9e5d){var _0x47f932=_0x1762f0['user'][_0xd936('0x4f')]({'plain':!![]});if(!_0x47f932)throw new Error(_0xd936('0x50'));if(_0x47f932[_0xd936('0x51')]===_0xd936('0x52')){var _0x4bdb1c=_0x4c9e5d[_0xd936('0x4f')]({'plain':!![]});var _0x42631e='Projects';return db[_0xd936('0x53')][_0xd936('0x4c')]({'where':{'name':_0x42631e,'userProfileId':_0x47f932['userProfileId']},'raw':!![]})[_0xd936('0x25')](function(_0x27887c){if(_0x27887c&&_0x27887c[_0xd936('0x54')]===0x0){return db[_0xd936('0x27')][_0xd936('0x4d')]({'name':_0x4bdb1c['name'],'resourceId':_0x4bdb1c['id'],'type':_0x27887c[_0xd936('0x2b')],'sectionId':_0x27887c['id']},{})[_0xd936('0x25')](function(){return _0x4c9e5d;});}else{return _0x4c9e5d;}})[_0xd936('0x47')](function(_0x427972){logger[_0xd936('0x29')](_0xd936('0x55'),_0x427972);throw _0x427972;});}return _0x4c9e5d;})['then'](respondWithResult(_0x1e7ace,0xc9))['catch'](handleError(_0x1e7ace,null));};exports['clone']=function(_0x1a3a80,_0x5140a2){var _0xa5c81f={'where':{'id':_0x1a3a80[_0xd936('0x56')]['id']}},_0x3860ab={};_0x3860ab[_0xd936('0x36')]=_[_0xd936('0x33')](db[_0xd936('0x2e')][_0xd936('0x49')]);_0xa5c81f[_0xd936('0x37')]=_['intersection'](_0x3860ab[_0xd936('0x36')],qs[_0xd936('0x38')](_0x1a3a80[_0xd936('0x32')][_0xd936('0x38')]));_0xa5c81f[_0xd936('0x37')]=_0xa5c81f['attributes'][_0xd936('0x4a')]?_0xa5c81f['attributes']:_0x3860ab[_0xd936('0x36')];if(_0x1a3a80[_0xd936('0x32')][_0xd936('0x44')]){_0xa5c81f['include']=[{'all':!![]}];}_0xa5c81f=_[_0xd936('0x40')]({},_0xa5c81f,_0x1a3a80['options']);return db[_0xd936('0x2e')][_0xd936('0x4c')](_0xa5c81f)[_0xd936('0x25')](handleEntityNotFound(_0x5140a2,null))['then'](function(_0x332342){if(_0x332342){var _0x55f0b7=_0x332342[_0xd936('0x4f')]({'plain':!![]});_0x55f0b7=qs[_0xd936('0x57')](_0x55f0b7,['id',_0xd936('0x58'),_0xd936('0x59')]);_0x1a3a80['body']=_[_0xd936('0x57')](_0x1a3a80[_0xd936('0x4e')],['id',_0xd936('0x58'),_0xd936('0x59')]);return db[_0xd936('0x2e')][_0xd936('0x4d')](_[_0xd936('0x40')](_0x55f0b7,_0x1a3a80[_0xd936('0x4e')]),{'include':_0x1a3a80['query'][_0xd936('0x44')]?[{'all':!![]}]:undefined})['then'](function(_0x5c2129){var _0x49bebb=_0x1a3a80[_0xd936('0x52')]['get']({'plain':!![]});if(!_0x49bebb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x49bebb['role']==='user'){var _0x1838fb=_0x5c2129[_0xd936('0x4f')]({'plain':!![]});var _0x4b50a0=_0xd936('0x26');return db[_0xd936('0x53')]['find']({'where':{'name':_0x4b50a0,'userProfileId':_0x49bebb[_0xd936('0x5a')]},'raw':!![]})[_0xd936('0x25')](function(_0x41a12e){if(_0x41a12e&&_0x41a12e[_0xd936('0x54')]===0x0){return db[_0xd936('0x27')][_0xd936('0x4d')]({'name':_0x1838fb['name'],'resourceId':_0x1838fb['id'],'type':_0x41a12e['name'],'sectionId':_0x41a12e['id']},{})['then'](function(){return _0x5c2129;});}else{return _0x5c2129;}})[_0xd936('0x47')](function(_0x269260){logger[_0xd936('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x269260);throw _0x269260;});}return _0x5c2129;});}})[_0xd936('0x25')](respondWithResult(_0x5140a2,0xc9))[_0xd936('0x47')](handleError(_0x5140a2,null));};exports[_0xd936('0x24')]=function(_0x55030d,_0x4aeac0){if(_0x55030d[_0xd936('0x4e')]['id']){delete _0x55030d['body']['id'];}return db[_0xd936('0x2e')][_0xd936('0x4c')]({'where':{'id':_0x55030d[_0xd936('0x56')]['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x4aeac0,null))[_0xd936('0x25')](saveUpdates(_0x55030d['body'],null))[_0xd936('0x25')](respondWithResult(_0x4aeac0,null))[_0xd936('0x47')](handleError(_0x4aeac0,null));};exports[_0xd936('0x28')]=function(_0x302529,_0x1da5c8){return db[_0xd936('0x2e')][_0xd936('0x4c')]({'where':{'id':_0x302529['params']['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x1da5c8,null))[_0xd936('0x25')](removeEntity(_0x1da5c8,null))[_0xd936('0x47')](handleError(_0x1da5c8,null));};exports[_0xd936('0x5b')]=function(_0x237aac,_0x3b56b3,_0x549b6b){var _0x5ec004={'raw':!![],'where':{}};var _0x4f2baf={};var _0xdea2bd={'count':0x0,'rows':[]};return db['JscriptyProject'][_0xd936('0x5c')]({'where':{'id':_0x237aac[_0xd936('0x56')]['id']}})['then'](handleEntityNotFound(_0x3b56b3,null))['then'](function(_0x6e7684){if(_0x6e7684){_0x4f2baf['model']=_[_0xd936('0x33')](db[_0xd936('0x5d')][_0xd936('0x49')]);_0x4f2baf['query']=_[_0xd936('0x33')](_0x237aac[_0xd936('0x32')]);_0x4f2baf[_0xd936('0x34')]=_['intersection'](_0x4f2baf['model'],_0x4f2baf[_0xd936('0x32')]);_0x5ec004[_0xd936('0x37')]=_[_0xd936('0x35')](_0x4f2baf['model'],qs[_0xd936('0x38')](_0x237aac[_0xd936('0x32')][_0xd936('0x38')]));_0x5ec004[_0xd936('0x37')]=_0x5ec004[_0xd936('0x37')]['length']?_0x5ec004['attributes']:_0x4f2baf[_0xd936('0x36')];if(!_0x237aac[_0xd936('0x32')][_0xd936('0x39')]('nolimit')){_0x5ec004[_0xd936('0x1e')]=qs['limit'](_0x237aac[_0xd936('0x32')]['limit']);_0x5ec004[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0x237aac[_0xd936('0x32')]['offset']);}_0x5ec004[_0xd936('0x3b')]=qs[_0xd936('0x3c')](_0x237aac[_0xd936('0x32')][_0xd936('0x3c')]);_0x5ec004['where']=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0x237aac['query'],_0x4f2baf[_0xd936('0x34')]));_0x5ec004[_0xd936('0x3d')]['ProjectId']=_0x6e7684['id'];if(_0x237aac[_0xd936('0x32')][_0xd936('0x3f')]){_0x5ec004[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x5ec004[_0xd936('0x3d')],{'$or':_[_0xd936('0x41')](_0x5ec004[_0xd936('0x37')],function(_0x365ae1){var _0x10601f={};_0x10601f[_0x365ae1]={'$like':'%'+_0x237aac[_0xd936('0x32')][_0xd936('0x3f')]+'%'};return _0x10601f;})});}_0x5ec004=_[_0xd936('0x40')]({},_0x5ec004,_0x237aac[_0xd936('0x43')]);return db['JscriptySessionReport']['count']({'where':_0x5ec004[_0xd936('0x3d')]})[_0xd936('0x25')](function(_0x1e410d){_0xdea2bd[_0xd936('0x1f')]=_0x1e410d;if(_0x237aac[_0xd936('0x32')][_0xd936('0x44')]){_0x5ec004[_0xd936('0x4b')]=[{'all':!![]}];}return db[_0xd936('0x5d')]['findAll'](_0x5ec004);})['then'](function(_0x2cb900){_0xdea2bd['rows']=_0x2cb900;return _0xdea2bd;});}})['then'](respondWithFilteredResult(_0x3b56b3,_0x5ec004))[_0xd936('0x47')](handleError(_0x3b56b3,null));};exports[_0xd936('0x5e')]=function(_0xd8a27,_0x536000,_0xd77cad){var _0x478a5c={'raw':!![],'where':{}};var _0x534959={};var _0x45ca8f={'count':0x0,'rows':[]};return db[_0xd936('0x2e')]['findOne']({'where':{'id':_0xd8a27['params']['id']}})[_0xd936('0x25')](handleEntityNotFound(_0x536000,null))['then'](function(_0x2881e1){if(_0x2881e1){_0x534959['model']=_[_0xd936('0x33')](db[_0xd936('0x5f')]['rawAttributes']);_0x534959[_0xd936('0x32')]=_[_0xd936('0x33')](_0xd8a27[_0xd936('0x32')]);_0x534959[_0xd936('0x34')]=_[_0xd936('0x35')](_0x534959['model'],_0x534959[_0xd936('0x32')]);_0x478a5c[_0xd936('0x37')]=_[_0xd936('0x35')](_0x534959[_0xd936('0x36')],qs[_0xd936('0x38')](_0xd8a27[_0xd936('0x32')][_0xd936('0x38')]));_0x478a5c[_0xd936('0x37')]=_0x478a5c[_0xd936('0x37')][_0xd936('0x4a')]?_0x478a5c[_0xd936('0x37')]:_0x534959['model'];if(!_0xd8a27[_0xd936('0x32')][_0xd936('0x39')](_0xd936('0x3a'))){_0x478a5c[_0xd936('0x1e')]=qs[_0xd936('0x1e')](_0xd8a27[_0xd936('0x32')][_0xd936('0x1e')]);_0x478a5c[_0xd936('0x1c')]=qs[_0xd936('0x1c')](_0xd8a27['query'][_0xd936('0x1c')]);}_0x478a5c['order']=qs['sort'](_0xd8a27['query'][_0xd936('0x3c')]);_0x478a5c['where']=qs[_0xd936('0x34')](_[_0xd936('0x3e')](_0xd8a27[_0xd936('0x32')],_0x534959[_0xd936('0x34')]));_0x478a5c[_0xd936('0x3d')][_0xd936('0x60')]=_0x2881e1['id'];if(_0xd8a27['query']['filter']){_0x478a5c[_0xd936('0x3d')]=_[_0xd936('0x40')](_0x478a5c[_0xd936('0x3d')],{'$or':_['map'](_0x478a5c[_0xd936('0x37')],function(_0x13b096){var _0x126e60={};_0x126e60[_0x13b096]={'$like':'%'+_0xd8a27[_0xd936('0x32')][_0xd936('0x3f')]+'%'};return _0x126e60;})});}_0x478a5c=_[_0xd936('0x40')]({},_0x478a5c,_0xd8a27[_0xd936('0x43')]);return db[_0xd936('0x5f')]['count']({'where':_0x478a5c['where']})[_0xd936('0x25')](function(_0x1cc3d7){_0x45ca8f[_0xd936('0x1f')]=_0x1cc3d7;if(_0xd8a27[_0xd936('0x32')][_0xd936('0x44')]){_0x478a5c[_0xd936('0x4b')]=[{'all':!![]}];}return db[_0xd936('0x5f')]['findAll'](_0x478a5c);})[_0xd936('0x25')](function(_0x3d1b78){_0x45ca8f[_0xd936('0x46')]=_0x3d1b78;return _0x45ca8f;});}})[_0xd936('0x25')](respondWithFilteredResult(_0x536000,_0x478a5c))[_0xd936('0x47')](handleError(_0x536000,null));};function char(_0x3b94a2){return _0xd936('0x61')===typeof _0x3b94a2?String[_0xd936('0x62')][_0xd936('0x63')](null,arguments):_0x3b94a2;}function needsEncapsulation(_0x3faafa){return!!_0x3faafa&&(_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0xd))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0xa))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0x2c))>=0x0||_0x3faafa[_0xd936('0x64')]()[_0xd936('0x65')](char(0x22))>=0x0);}function encapsulate(_0x685a12){var _0x30ea1b=char(0x22),_0x474a3e='\x5c'+char(0x22),_0x7dc026=_0x685a12[_0xd936('0x64')]()[_0xd936('0x66')](new RegExp(_0x30ea1b,'g'),_0x474a3e);return _0x30ea1b+_0x7dc026+_0x30ea1b;}exports[_0xd936('0x67')]=function(_0x3ce5f1,_0x18b5e1,_0x1e072a){var _0x552c76,_0x2188c1;var _0x1f2d29={'where':{'ProjectId':_0x3ce5f1[_0xd936('0x56')]['id']}};if(_0x3ce5f1[_0xd936('0x32')][_0xd936('0x68')]){_0x1f2d29[_0xd936('0x3d')]['starttime']=JSON[_0xd936('0x69')](_0x3ce5f1[_0xd936('0x32')]['startTime']);}return db[_0xd936('0x5d')][_0xd936('0x45')](_0x1f2d29)[_0xd936('0x25')](handleEntityNotFound(_0x18b5e1,null))[_0xd936('0x25')](function(_0x15a1f3){if(_0x15a1f3){_0x552c76=_0x15a1f3;return db['JscriptyQuestionReport'][_0xd936('0x45')]({'where':{'SessionId':{'$in':_[_0xd936('0x41')](_0x552c76,'id')},'ProjectId':_0x3ce5f1['params']['id']},'order':_0xd936('0x6a')});}})[_0xd936('0x25')](handleEntityNotFound(_0x18b5e1,null))[_0xd936('0x25')](function(_0x5046c5){if(_0x5046c5){_0x2188c1=_0x5046c5;var _0x38f3e7={};for(var _0x1699dc=0x0,_0x274cfa=_0x2188c1[_0xd936('0x4a')];_0x1699dc<_0x274cfa;_0x1699dc++){if(!_0x38f3e7[_0xd936('0x39')](_0x2188c1[_0x1699dc][_0xd936('0x6b')])){_0x38f3e7[_0x2188c1[_0x1699dc][_0xd936('0x6b')]]=needsEncapsulation(_0x2188c1[_0x1699dc][_0xd936('0x6c')])?encapsulate(_0x2188c1[_0x1699dc][_0xd936('0x6c')]):_0x2188c1[_0x1699dc]['question'];}}var _0x575cd4=[],_0x290492={};for(var _0x41c65e=0x0,_0x1d8f12=_0x552c76[_0xd936('0x4a')];_0x41c65e<_0x1d8f12;_0x41c65e++){_0x290492={'ProjectId':_0x3ce5f1[_0xd936('0x56')]['id'],'SessionId':_0x552c76[_0x41c65e]['id'],'StartTime':moment(_0x552c76[_0x41c65e][_0xd936('0x6d')])[_0xd936('0x6e')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x302f24=0x0,_0x25f353=_0x2188c1[_0xd936('0x4a')];_0x302f24<_0x25f353;_0x302f24++){if(_0x2188c1[_0x302f24][_0xd936('0x6f')]==_0x552c76[_0x41c65e]['id']&&_0x38f3e7['hasOwnProperty'](_0x2188c1[_0x302f24][_0xd936('0x6b')])){_0x290492[_0x38f3e7[_0x2188c1[_0x302f24]['questionId']]]=_0x2188c1[_0x302f24]['answer'];}}for(var _0x4a6786 in _0x38f3e7){if(!_0x290492['hasOwnProperty'](_0x38f3e7[_0x4a6786])){_0x290492[_0x38f3e7[_0x4a6786]]=null;}}_0x575cd4[_0xd936('0x70')](_0x290492);}return _0x575cd4;}})[_0xd936('0x25')](function(_0x2e0a91){if(!_[_0xd936('0x71')](_0x2e0a91)){var _0x5be4dc=toCsv(_0x2e0a91);var _0xca355=Date[_0xd936('0x72')]();fs['writeFileSync'](util[_0xd936('0x6e')](_0xd936('0x73'),_0x3ce5f1[_0xd936('0x56')]['id'],_0xca355),_0x5be4dc);_0x18b5e1['setHeader'](_0xd936('0x74'),_0xd936('0x75')+util[_0xd936('0x6e')]('Jscripty_Project_%d_Summary_%s.csv',_0x3ce5f1['params']['id'],_0xca355));_0x18b5e1[_0xd936('0x76')](_0xd936('0x77'),_0xd936('0x78'));return _0x18b5e1[_0xd936('0x79')](util[_0xd936('0x6e')](_0xd936('0x73'),_0x3ce5f1['params']['id'],_0xca355));}else{return _0x18b5e1['sendStatus'](0xcc);}})[_0xd936('0x47')](handleError(_0x18b5e1,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 412c5d2..b191a59 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 _0xb91a=['./jscriptyProject.attributes','exports','define','jscripty_projects','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dc103,_0x48a943){var _0x319cbd=function(_0x5263a){while(--_0x5263a){_0x3dc103['push'](_0x3dc103['shift']());}};_0x319cbd(++_0x48a943);}(_0xb91a,0xf4));var _0xab91=function(_0x1d40b4,_0x4a2ffd){_0x1d40b4=_0x1d40b4-0x0;var _0x49b1f6=_0xb91a[_0x1d40b4];return _0x49b1f6;};'use strict';var _=require(_0xab91('0x0'));var util=require(_0xab91('0x1'));var logger=require(_0xab91('0x2'))('api');var moment=require('moment');var BPromise=require(_0xab91('0x3'));var rp=require(_0xab91('0x4'));var fs=require('fs');var path=require(_0xab91('0x5'));var rimraf=require(_0xab91('0x6'));var config=require(_0xab91('0x7'));var attributes=require(_0xab91('0x8'));module[_0xab91('0x9')]=function(_0x429933,_0x290af9){return _0x429933[_0xab91('0xa')]('JscriptyProject',attributes,{'tableName':_0xab91('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe953=['JscriptyProject','jscripty_projects','bluebird','request-promise','rimraf','./jscriptyProject.attributes','define'];(function(_0x3b16e1,_0x3bda3e){var _0x311d1b=function(_0x2a979b){while(--_0x2a979b){_0x3b16e1['push'](_0x3b16e1['shift']());}};_0x311d1b(++_0x3bda3e);}(_0xe953,0x1d0));var _0x3e95=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0xe953[_0xf2628e];return _0x13863a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3e95('0x0'));var rp=require(_0x3e95('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3e95('0x2'));var config=require('../../config/environment');var attributes=require(_0x3e95('0x3'));module['exports']=function(_0x30637c,_0x3faa2b){return _0x30637c[_0x3e95('0x4')](_0x3e95('0x5'),attributes,{'tableName':_0x3e95('0x6'),'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 7d20e9b..d6922f6 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 _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4af98e,_0x2065bc){var _0x252a91=function(_0x3ea87a){while(--_0x3ea87a){_0x4af98e['push'](_0x4af98e['shift']());}};_0x252a91(++_0x2065bc);}(_0xb43b,0x1b2));var _0xbb43=function(_0x43f022,_0x4f2c05){_0x43f022=_0x43f022-0x0;var _0x22f6b9=_0xb43b[_0x43f022];return _0x22f6b9;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file +var _0xb7e7=['JscriptyProject,\x20%s,\x20%s','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0xc94e68,_0x55f2c2){var _0x2c3938=function(_0x2c897d){while(--_0x2c897d){_0xc94e68['push'](_0xc94e68['shift']());}};_0x2c3938(++_0x55f2c2);}(_0xb7e7,0x121));var _0x7b7e=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0xb7e7[_0x50007c];return _0x5c1ec7;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index 4c9dafc..131041c 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 _0xd7e4=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','destroy','multer','path','connect-timeout','express','Router'];(function(_0x18088f,_0x39942d){var _0x1c26e7=function(_0x786dd0){while(--_0x786dd0){_0x18088f['push'](_0x18088f['shift']());}};_0x1c26e7(++_0x39942d);}(_0xd7e4,0xe2));var _0x4d7e=function(_0x3fa765,_0x378ef3){_0x3fa765=_0x3fa765-0x0;var _0x68bf93=_0xd7e4[_0x3fa765];return _0x68bf93;};'use strict';var multer=require(_0x4d7e('0x0'));var util=require('util');var path=require(_0x4d7e('0x1'));var timeout=require(_0x4d7e('0x2'));var express=require(_0x4d7e('0x3'));var router=express[_0x4d7e('0x4')]();var fs_extra=require(_0x4d7e('0x5'));var auth=require(_0x4d7e('0x6'));var interaction=require(_0x4d7e('0x7'));var config=require(_0x4d7e('0x8'));var controller=require(_0x4d7e('0x9'));router[_0x4d7e('0xa')]('/',auth[_0x4d7e('0xb')](),controller[_0x4d7e('0xc')]);router[_0x4d7e('0xa')]('/describe',auth[_0x4d7e('0xb')](),controller[_0x4d7e('0xd')]);router[_0x4d7e('0xa')](_0x4d7e('0xe'),auth['isAuthenticated'](),controller[_0x4d7e('0xf')]);router[_0x4d7e('0x10')]('/',auth[_0x4d7e('0xb')](),controller[_0x4d7e('0x11')]);router[_0x4d7e('0x12')](_0x4d7e('0xe'),auth['isAuthenticated'](),controller[_0x4d7e('0x13')]);router['delete'](_0x4d7e('0xe'),auth[_0x4d7e('0xb')](),controller[_0x4d7e('0x14')]);module['exports']=router; \ No newline at end of file +var _0x50f3=['destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','/:id','create'];(function(_0x3a6468,_0x59ff97){var _0x185910=function(_0xfac5b2){while(--_0xfac5b2){_0x3a6468['push'](_0x3a6468['shift']());}};_0x185910(++_0x59ff97);}(_0x50f3,0x146));var _0x350f=function(_0x5cce81,_0x418807){_0x5cce81=_0x5cce81-0x0;var _0x4d622e=_0x50f3[_0x5cce81];return _0x4d622e;};'use strict';var multer=require(_0x350f('0x0'));var util=require(_0x350f('0x1'));var path=require(_0x350f('0x2'));var timeout=require(_0x350f('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x350f('0x4'));var auth=require(_0x350f('0x5'));var interaction=require(_0x350f('0x6'));var config=require(_0x350f('0x7'));var controller=require(_0x350f('0x8'));router['get']('/',auth[_0x350f('0x9')](),controller[_0x350f('0xa')]);router['get'](_0x350f('0xb'),auth[_0x350f('0x9')](),controller[_0x350f('0xc')]);router[_0x350f('0xd')](_0x350f('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x350f('0xf')]);router['put'](_0x350f('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x350f('0xe'),auth[_0x350f('0x9')](),controller[_0x350f('0x10')]);module[_0x350f('0x11')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 56460bd..4908f24 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(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x7a54,0x106));var _0x47a5=function(_0x2f4217,_0x178100){_0x2f4217=_0x2f4217-0x0;var _0x390456=_0x7a54[_0x2f4217];return _0x390456;};'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(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x7a54,0x106));var _0x47a5=function(_0xb99f3d,_0x3584ea){_0xb99f3d=_0xb99f3d-0x0;var _0x315b6c=_0x7a54[_0xb99f3d];return _0x315b6c;};'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 67d2336..671f24b 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 _0xe424=['then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','JscriptyQuestionReport','include','rows','catch','show','params','includeAll','find','create','body','describe','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','save','update'];(function(_0x5a6bdc,_0x46d896){var _0x1218d8=function(_0x111dac){while(--_0x111dac){_0x5a6bdc['push'](_0x5a6bdc['shift']());}};_0x1218d8(++_0x46d896);}(_0xe424,0xf8));var _0x4e42=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xe424[_0x1cfa0d];return _0xe33279;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4e42('0x0'));var rp=require(_0x4e42('0x1'));var moment=require(_0x4e42('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4e42('0x3'));var path=require('path');var sox=require(_0x4e42('0x4'));var csv=require(_0x4e42('0x5'));var ejs=require(_0x4e42('0x6'));var fs=require('fs');var fs_extra=require(_0x4e42('0x7'));var _=require(_0x4e42('0x8'));var squel=require(_0x4e42('0x9'));var crypto=require('crypto');var jsforce=require(_0x4e42('0xa'));var deskjs=require(_0x4e42('0xb'));var toCsv=require(_0x4e42('0x5'));var querystring=require('querystring');var Papa=require(_0x4e42('0xc'));var Redis=require(_0x4e42('0xd'));var authService=require(_0x4e42('0xe'));var qs=require(_0x4e42('0xf'));var as=require(_0x4e42('0x10'));var hardwareService=require(_0x4e42('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x4e42('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4e42('0x13'))['db'];function respondWithStatusCode(_0x285427,_0x46dc80){_0x46dc80=_0x46dc80||0xcc;return function(_0x5b8822){if(_0x5b8822){return _0x285427['sendStatus'](_0x46dc80);}return _0x285427[_0x4e42('0x14')](_0x46dc80)[_0x4e42('0x15')]();};}function respondWithResult(_0x8728a7,_0x2c9b14){_0x2c9b14=_0x2c9b14||0xc8;return function(_0x491be7){if(_0x491be7){return _0x8728a7[_0x4e42('0x14')](_0x2c9b14)[_0x4e42('0x16')](_0x491be7);}};}function respondWithFilteredResult(_0x2bae4b,_0x306cbc){return function(_0x4941ca){if(_0x4941ca){var _0x32fd45=typeof _0x306cbc['offset']===_0x4e42('0x17')&&typeof _0x306cbc['limit']==='undefined';var _0x4336de=_0x4941ca[_0x4e42('0x18')];var _0x1a9287=_0x32fd45?0x0:_0x306cbc[_0x4e42('0x19')];var _0x5ddf18=_0x32fd45?_0x4941ca['count']:_0x306cbc['offset']+_0x306cbc[_0x4e42('0x1a')];var _0x258c65;if(_0x5ddf18>=_0x4336de){_0x5ddf18=_0x4336de;_0x258c65=0xc8;}else{_0x258c65=0xce;}_0x2bae4b[_0x4e42('0x14')](_0x258c65);return _0x2bae4b['set'](_0x4e42('0x1b'),_0x1a9287+'-'+_0x5ddf18+'/'+_0x4336de)[_0x4e42('0x16')](_0x4941ca);}return null;};}function patchUpdates(_0x926a5a){return function(_0x5ddd69){try{jsonpatch[_0x4e42('0x1c')](_0x5ddd69,_0x926a5a,!![]);}catch(_0x36b724){return BPromise[_0x4e42('0x1d')](_0x36b724);}return _0x5ddd69[_0x4e42('0x1e')]();};}function saveUpdates(_0x45ab5c,_0x103cb9){return function(_0xe2505a){if(_0xe2505a){return _0xe2505a[_0x4e42('0x1f')](_0x45ab5c)[_0x4e42('0x20')](function(_0x5ce48f){return _0x5ce48f;});}return null;};}function removeEntity(_0xc25dfd,_0x2aa961){return function(_0x454aa6){if(_0x454aa6){return _0x454aa6[_0x4e42('0x21')]()[_0x4e42('0x20')](function(){_0xc25dfd[_0x4e42('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3d249f,_0x58d70c){return function(_0x383fd8){if(!_0x383fd8){_0x3d249f[_0x4e42('0x22')](0x194);}return _0x383fd8;};}function handleError(_0x4e56a1,_0x1a7a3d){_0x1a7a3d=_0x1a7a3d||0x1f4;return function(_0x2bbe69){logger[_0x4e42('0x23')](_0x2bbe69[_0x4e42('0x24')]);if(_0x2bbe69[_0x4e42('0x25')]){delete _0x2bbe69['name'];}_0x4e56a1[_0x4e42('0x14')](_0x1a7a3d)[_0x4e42('0x26')](_0x2bbe69);};}exports[_0x4e42('0x27')]=function(_0x41cbf7,_0x52f75f){var _0x1b482a={},_0x4091bd={},_0x15f080={'count':0x0,'rows':[]};var _0x1b09e2=_[_0x4e42('0x28')](db['JscriptyQuestionReport'][_0x4e42('0x29')],function(_0x4dca15){return{'name':_0x4dca15['fieldName'],'type':_0x4dca15[_0x4e42('0x2a')]['key']};});_0x4091bd['model']=_[_0x4e42('0x28')](_0x1b09e2,'name');_0x4091bd[_0x4e42('0x2b')]=_[_0x4e42('0x2c')](_0x41cbf7['query']);_0x4091bd[_0x4e42('0x2d')]=_[_0x4e42('0x2e')](_0x4091bd[_0x4e42('0x2f')],_0x4091bd[_0x4e42('0x2b')]);_0x1b482a[_0x4e42('0x30')]=_[_0x4e42('0x2e')](_0x4091bd[_0x4e42('0x2f')],qs[_0x4e42('0x31')](_0x41cbf7['query'][_0x4e42('0x31')]));_0x1b482a['attributes']=_0x1b482a['attributes'][_0x4e42('0x32')]?_0x1b482a[_0x4e42('0x30')]:_0x4091bd[_0x4e42('0x2f')];if(!_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x33')](_0x4e42('0x34'))){_0x1b482a[_0x4e42('0x1a')]=qs[_0x4e42('0x1a')](_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x1a')]);_0x1b482a[_0x4e42('0x19')]=qs[_0x4e42('0x19')](_0x41cbf7['query'][_0x4e42('0x19')]);}_0x1b482a[_0x4e42('0x35')]=qs['sort'](_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x36')]);_0x1b482a[_0x4e42('0x37')]=qs['filters'](_['pick'](_0x41cbf7[_0x4e42('0x2b')],_0x4091bd[_0x4e42('0x2d')]),_0x1b09e2);if(_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x38')]){_0x1b482a[_0x4e42('0x37')]=_[_0x4e42('0x39')](_0x1b482a[_0x4e42('0x37')],{'$or':_[_0x4e42('0x28')](_0x1b09e2,function(_0x7ea1c7){if(_0x7ea1c7['type']!=='VIRTUAL'){var _0x10f8b6={};_0x10f8b6[_0x7ea1c7[_0x4e42('0x25')]]={'$like':'%'+_0x41cbf7[_0x4e42('0x2b')][_0x4e42('0x38')]+'%'};return _0x10f8b6;}})});}_0x1b482a=_[_0x4e42('0x39')]({},_0x1b482a,_0x41cbf7[_0x4e42('0x3a')]);var _0x4fdfd2={'where':_0x1b482a[_0x4e42('0x37')]};return db[_0x4e42('0x3b')][_0x4e42('0x18')](_0x4fdfd2)[_0x4e42('0x20')](function(_0xb55833){_0x15f080['count']=_0xb55833;if(_0x41cbf7[_0x4e42('0x2b')]['includeAll']){_0x1b482a[_0x4e42('0x3c')]=[{'all':!![]}];}return db[_0x4e42('0x3b')]['findAll'](_0x1b482a);})['then'](function(_0x3fb90b){_0x15f080[_0x4e42('0x3d')]=_0x3fb90b;return _0x15f080;})[_0x4e42('0x20')](respondWithFilteredResult(_0x52f75f,_0x1b482a))[_0x4e42('0x3e')](handleError(_0x52f75f,null));};exports[_0x4e42('0x3f')]=function(_0xda3d77,_0x314935){var _0x18b57a={'raw':!![],'where':{'id':_0xda3d77[_0x4e42('0x40')]['id']}},_0x19af6b={};_0x19af6b[_0x4e42('0x2f')]=_[_0x4e42('0x2c')](db[_0x4e42('0x3b')]['rawAttributes']);_0x19af6b[_0x4e42('0x2b')]=_[_0x4e42('0x2c')](_0xda3d77['query']);_0x19af6b[_0x4e42('0x2d')]=_[_0x4e42('0x2e')](_0x19af6b[_0x4e42('0x2f')],_0x19af6b[_0x4e42('0x2b')]);_0x18b57a[_0x4e42('0x30')]=_[_0x4e42('0x2e')](_0x19af6b['model'],qs['fields'](_0xda3d77[_0x4e42('0x2b')][_0x4e42('0x31')]));_0x18b57a['attributes']=_0x18b57a[_0x4e42('0x30')]['length']?_0x18b57a[_0x4e42('0x30')]:_0x19af6b[_0x4e42('0x2f')];if(_0xda3d77['query'][_0x4e42('0x41')]){_0x18b57a[_0x4e42('0x3c')]=[{'all':!![]}];}_0x18b57a=_[_0x4e42('0x39')]({},_0x18b57a,_0xda3d77[_0x4e42('0x3a')]);return db[_0x4e42('0x3b')][_0x4e42('0x42')](_0x18b57a)[_0x4e42('0x20')](handleEntityNotFound(_0x314935,null))['then'](respondWithResult(_0x314935,null))[_0x4e42('0x3e')](handleError(_0x314935,null));};exports[_0x4e42('0x43')]=function(_0x487d67,_0x38bebc){return db[_0x4e42('0x3b')][_0x4e42('0x43')](_0x487d67[_0x4e42('0x44')],{})[_0x4e42('0x20')](respondWithResult(_0x38bebc,0xc9))[_0x4e42('0x3e')](handleError(_0x38bebc,null));};exports['update']=function(_0x3e89e4,_0x2d1e2d){if(_0x3e89e4[_0x4e42('0x44')]['id']){delete _0x3e89e4[_0x4e42('0x44')]['id'];}return db[_0x4e42('0x3b')][_0x4e42('0x42')]({'where':{'id':_0x3e89e4[_0x4e42('0x40')]['id']}})[_0x4e42('0x20')](handleEntityNotFound(_0x2d1e2d,null))['then'](saveUpdates(_0x3e89e4[_0x4e42('0x44')],null))[_0x4e42('0x20')](respondWithResult(_0x2d1e2d,null))[_0x4e42('0x3e')](handleError(_0x2d1e2d,null));};exports[_0x4e42('0x21')]=function(_0x47d2c,_0x796d50){return db[_0x4e42('0x3b')][_0x4e42('0x42')]({'where':{'id':_0x47d2c['params']['id']}})[_0x4e42('0x20')](handleEntityNotFound(_0x796d50,null))[_0x4e42('0x20')](removeEntity(_0x796d50,null))[_0x4e42('0x3e')](handleError(_0x796d50,null));};exports['describe']=function(_0x3f6d79,_0x25f5b1){return db[_0x4e42('0x3b')][_0x4e42('0x45')]()[_0x4e42('0x20')](respondWithResult(_0x25f5b1,null))[_0x4e42('0x3e')](handleError(_0x25f5b1,null));}; \ No newline at end of file +var _0x9c14=['lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','set','apply','reject','save','update','then','destroy','status','error','stack','name','send','index','map','JscriptyQuestionReport','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','nolimit','offset','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs'];(function(_0x20cf95,_0x221ec8){var _0x64e1a1=function(_0x2193bd){while(--_0x2193bd){_0x20cf95['push'](_0x20cf95['shift']());}};_0x64e1a1(++_0x221ec8);}(_0x9c14,0xd9));var _0x49c1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c14[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x49c1('0x0'));var rimraf=require(_0x49c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x49c1('0x2'));var rp=require(_0x49c1('0x3'));var moment=require(_0x49c1('0x4'));var BPromise=require(_0x49c1('0x5'));var Mustache=require('mustache');var util=require(_0x49c1('0x6'));var path=require(_0x49c1('0x7'));var sox=require(_0x49c1('0x8'));var csv=require(_0x49c1('0x9'));var ejs=require(_0x49c1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x49c1('0xb'));var squel=require(_0x49c1('0xc'));var crypto=require(_0x49c1('0xd'));var jsforce=require(_0x49c1('0xe'));var deskjs=require(_0x49c1('0xf'));var toCsv=require('to-csv');var querystring=require(_0x49c1('0x10'));var Papa=require('papaparse');var Redis=require(_0x49c1('0x11'));var authService=require(_0x49c1('0x12'));var qs=require(_0x49c1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c1('0x14'))(_0x49c1('0x15'));var utils=require('../../config/utils');var config=require(_0x49c1('0x16'));var licenseUtil=require(_0x49c1('0x17'));var db=require(_0x49c1('0x18'))['db'];function respondWithStatusCode(_0x15bec5,_0x294151){_0x294151=_0x294151||0xcc;return function(_0x391b90){if(_0x391b90){return _0x15bec5[_0x49c1('0x19')](_0x294151);}return _0x15bec5['status'](_0x294151)[_0x49c1('0x1a')]();};}function respondWithResult(_0x32d0c9,_0x513a74){_0x513a74=_0x513a74||0xc8;return function(_0x550e25){if(_0x550e25){return _0x32d0c9['status'](_0x513a74)[_0x49c1('0x1b')](_0x550e25);}};}function respondWithFilteredResult(_0x51c3a7,_0x581951){return function(_0x5ce5ac){if(_0x5ce5ac){var _0x5ab712=typeof _0x581951['offset']===_0x49c1('0x1c')&&typeof _0x581951[_0x49c1('0x1d')]===_0x49c1('0x1c');var _0x3a7a85=_0x5ce5ac[_0x49c1('0x1e')];var _0x527280=_0x5ab712?0x0:_0x581951['offset'];var _0x5a5afc=_0x5ab712?_0x5ce5ac[_0x49c1('0x1e')]:_0x581951['offset']+_0x581951['limit'];var _0x5b65e6;if(_0x5a5afc>=_0x3a7a85){_0x5a5afc=_0x3a7a85;_0x5b65e6=0xc8;}else{_0x5b65e6=0xce;}_0x51c3a7['status'](_0x5b65e6);return _0x51c3a7[_0x49c1('0x1f')]('Content-Range',_0x527280+'-'+_0x5a5afc+'/'+_0x3a7a85)[_0x49c1('0x1b')](_0x5ce5ac);}return null;};}function patchUpdates(_0x5d381f){return function(_0x59d39a){try{jsonpatch[_0x49c1('0x20')](_0x59d39a,_0x5d381f,!![]);}catch(_0x5eddea){return BPromise[_0x49c1('0x21')](_0x5eddea);}return _0x59d39a[_0x49c1('0x22')]();};}function saveUpdates(_0x1db39c,_0x39cf24){return function(_0x315566){if(_0x315566){return _0x315566[_0x49c1('0x23')](_0x1db39c)[_0x49c1('0x24')](function(_0x5da32b){return _0x5da32b;});}return null;};}function removeEntity(_0x409afe,_0x251c3c){return function(_0x37aae7){if(_0x37aae7){return _0x37aae7[_0x49c1('0x25')]()['then'](function(){_0x409afe[_0x49c1('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x241ed3,_0x3af94e){return function(_0x1cae3a){if(!_0x1cae3a){_0x241ed3[_0x49c1('0x19')](0x194);}return _0x1cae3a;};}function handleError(_0x1f053f,_0x3c4d93){_0x3c4d93=_0x3c4d93||0x1f4;return function(_0x4b5e5d){logger[_0x49c1('0x27')](_0x4b5e5d[_0x49c1('0x28')]);if(_0x4b5e5d[_0x49c1('0x29')]){delete _0x4b5e5d[_0x49c1('0x29')];}_0x1f053f[_0x49c1('0x26')](_0x3c4d93)[_0x49c1('0x2a')](_0x4b5e5d);};}exports[_0x49c1('0x2b')]=function(_0x20465b,_0x5c34da){var _0xbc62f3={},_0x1db2d3={},_0x371dc1={'count':0x0,'rows':[]};var _0x5ee8fd=_[_0x49c1('0x2c')](db[_0x49c1('0x2d')][_0x49c1('0x2e')],function(_0x248cfc){return{'name':_0x248cfc[_0x49c1('0x2f')],'type':_0x248cfc[_0x49c1('0x30')][_0x49c1('0x31')]};});_0x1db2d3['model']=_['map'](_0x5ee8fd,_0x49c1('0x29'));_0x1db2d3[_0x49c1('0x32')]=_['keys'](_0x20465b[_0x49c1('0x32')]);_0x1db2d3[_0x49c1('0x33')]=_[_0x49c1('0x34')](_0x1db2d3['model'],_0x1db2d3[_0x49c1('0x32')]);_0xbc62f3[_0x49c1('0x35')]=_[_0x49c1('0x34')](_0x1db2d3[_0x49c1('0x36')],qs['fields'](_0x20465b[_0x49c1('0x32')][_0x49c1('0x37')]));_0xbc62f3[_0x49c1('0x35')]=_0xbc62f3['attributes'][_0x49c1('0x38')]?_0xbc62f3['attributes']:_0x1db2d3[_0x49c1('0x36')];if(!_0x20465b[_0x49c1('0x32')]['hasOwnProperty'](_0x49c1('0x39'))){_0xbc62f3[_0x49c1('0x1d')]=qs[_0x49c1('0x1d')](_0x20465b[_0x49c1('0x32')][_0x49c1('0x1d')]);_0xbc62f3[_0x49c1('0x3a')]=qs[_0x49c1('0x3a')](_0x20465b['query'][_0x49c1('0x3a')]);}_0xbc62f3['order']=qs[_0x49c1('0x3b')](_0x20465b[_0x49c1('0x32')][_0x49c1('0x3b')]);_0xbc62f3[_0x49c1('0x3c')]=qs[_0x49c1('0x33')](_['pick'](_0x20465b['query'],_0x1db2d3[_0x49c1('0x33')]),_0x5ee8fd);if(_0x20465b[_0x49c1('0x32')]['filter']){_0xbc62f3[_0x49c1('0x3c')]=_[_0x49c1('0x3d')](_0xbc62f3[_0x49c1('0x3c')],{'$or':_[_0x49c1('0x2c')](_0x5ee8fd,function(_0x8484fd){if(_0x8484fd[_0x49c1('0x30')]!==_0x49c1('0x3e')){var _0x5a9859={};_0x5a9859[_0x8484fd[_0x49c1('0x29')]]={'$like':'%'+_0x20465b['query']['filter']+'%'};return _0x5a9859;}})});}_0xbc62f3=_[_0x49c1('0x3d')]({},_0xbc62f3,_0x20465b[_0x49c1('0x3f')]);var _0x418e91={'where':_0xbc62f3[_0x49c1('0x3c')]};return db['JscriptyQuestionReport'][_0x49c1('0x1e')](_0x418e91)[_0x49c1('0x24')](function(_0x47bbd7){_0x371dc1['count']=_0x47bbd7;if(_0x20465b[_0x49c1('0x32')][_0x49c1('0x40')]){_0xbc62f3[_0x49c1('0x41')]=[{'all':!![]}];}return db[_0x49c1('0x2d')][_0x49c1('0x42')](_0xbc62f3);})[_0x49c1('0x24')](function(_0x5582c8){_0x371dc1[_0x49c1('0x43')]=_0x5582c8;return _0x371dc1;})[_0x49c1('0x24')](respondWithFilteredResult(_0x5c34da,_0xbc62f3))['catch'](handleError(_0x5c34da,null));};exports[_0x49c1('0x44')]=function(_0x53bfa4,_0x53dfa3){var _0x5fbf2={'raw':!![],'where':{'id':_0x53bfa4[_0x49c1('0x45')]['id']}},_0x358435={};_0x358435['model']=_[_0x49c1('0x46')](db['JscriptyQuestionReport'][_0x49c1('0x2e')]);_0x358435[_0x49c1('0x32')]=_['keys'](_0x53bfa4[_0x49c1('0x32')]);_0x358435[_0x49c1('0x33')]=_[_0x49c1('0x34')](_0x358435[_0x49c1('0x36')],_0x358435[_0x49c1('0x32')]);_0x5fbf2[_0x49c1('0x35')]=_[_0x49c1('0x34')](_0x358435[_0x49c1('0x36')],qs['fields'](_0x53bfa4['query'][_0x49c1('0x37')]));_0x5fbf2[_0x49c1('0x35')]=_0x5fbf2['attributes'][_0x49c1('0x38')]?_0x5fbf2[_0x49c1('0x35')]:_0x358435[_0x49c1('0x36')];if(_0x53bfa4[_0x49c1('0x32')][_0x49c1('0x40')]){_0x5fbf2[_0x49c1('0x41')]=[{'all':!![]}];}_0x5fbf2=_[_0x49c1('0x3d')]({},_0x5fbf2,_0x53bfa4[_0x49c1('0x3f')]);return db[_0x49c1('0x2d')]['find'](_0x5fbf2)[_0x49c1('0x24')](handleEntityNotFound(_0x53dfa3,null))[_0x49c1('0x24')](respondWithResult(_0x53dfa3,null))[_0x49c1('0x47')](handleError(_0x53dfa3,null));};exports['create']=function(_0x3240b8,_0x2bd5e0){return db['JscriptyQuestionReport'][_0x49c1('0x48')](_0x3240b8[_0x49c1('0x49')],{})['then'](respondWithResult(_0x2bd5e0,0xc9))['catch'](handleError(_0x2bd5e0,null));};exports[_0x49c1('0x23')]=function(_0x5c812e,_0x313ffb){if(_0x5c812e[_0x49c1('0x49')]['id']){delete _0x5c812e['body']['id'];}return db[_0x49c1('0x2d')][_0x49c1('0x4a')]({'where':{'id':_0x5c812e[_0x49c1('0x45')]['id']}})[_0x49c1('0x24')](handleEntityNotFound(_0x313ffb,null))[_0x49c1('0x24')](saveUpdates(_0x5c812e[_0x49c1('0x49')],null))['then'](respondWithResult(_0x313ffb,null))[_0x49c1('0x47')](handleError(_0x313ffb,null));};exports[_0x49c1('0x25')]=function(_0x5b6a17,_0x2a57fa){return db[_0x49c1('0x2d')][_0x49c1('0x4a')]({'where':{'id':_0x5b6a17[_0x49c1('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a57fa,null))[_0x49c1('0x24')](removeEntity(_0x2a57fa,null))['catch'](handleError(_0x2a57fa,null));};exports[_0x49c1('0x4b')]=function(_0x5ad924,_0x29177){return db['JscriptyQuestionReport'][_0x49c1('0x4b')]()[_0x49c1('0x24')](respondWithResult(_0x29177,null))[_0x49c1('0x47')](handleError(_0x29177,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 4ffbede..2673869 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 _0x719d=['../../config/environment','./jscriptyQuestionReport.attributes','exports','report_jscripty_questions','util','../../config/logger','api','bluebird','rimraf'];(function(_0x428c50,_0x49dc7a){var _0x3779b6=function(_0x2f1274){while(--_0x2f1274){_0x428c50['push'](_0x428c50['shift']());}};_0x3779b6(++_0x49dc7a);}(_0x719d,0xca));var _0xd719=function(_0x9fea2a,_0x57100d){_0x9fea2a=_0x9fea2a-0x0;var _0x379db0=_0x719d[_0x9fea2a];return _0x379db0;};'use strict';var _=require('lodash');var util=require(_0xd719('0x0'));var logger=require(_0xd719('0x1'))(_0xd719('0x2'));var moment=require('moment');var BPromise=require(_0xd719('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd719('0x4'));var config=require(_0xd719('0x5'));var attributes=require(_0xd719('0x6'));module[_0xd719('0x7')]=function(_0x515bfc,_0x5c28d1){return _0x515bfc['define']('JscriptyQuestionReport',attributes,{'tableName':_0xd719('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x326b=['report_jscripty_questions','lodash','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x326b,0x109));var _0xb326=function(_0x290a56,_0x5c540a){_0x290a56=_0x290a56-0x0;var _0x89610=_0x326b[_0x290a56];return _0x89610;};'use strict';var _=require(_0xb326('0x0'));var util=require(_0xb326('0x1'));var logger=require(_0xb326('0x2'))('api');var moment=require('moment');var BPromise=require(_0xb326('0x3'));var rp=require(_0xb326('0x4'));var fs=require('fs');var path=require(_0xb326('0x5'));var rimraf=require('rimraf');var config=require(_0xb326('0x6'));var attributes=require(_0xb326('0x7'));module[_0xb326('0x8')]=function(_0x377757,_0x8060ed){return _0x377757[_0xb326('0x9')](_0xb326('0xa'),attributes,{'tableName':_0xb326('0xb'),'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 cf5aed5..a49f6db 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 _0x43f6=['message','error','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','request\x20sent','stringify','JscriptyQuestionReport,\x20%s,\x20%s'];(function(_0x515a50,_0x51e170){var _0x592a66=function(_0x3f78aa){while(--_0x3f78aa){_0x515a50['push'](_0x515a50['shift']());}};_0x592a66(++_0x51e170);}(_0x43f6,0x12a));var _0x643f=function(_0x5c918d,_0x1ca4a7){_0x5c918d=_0x5c918d-0x0;var _0x3c4d98=_0x43f6[_0x5c918d];return _0x3c4d98;};'use strict';var _=require(_0x643f('0x0'));var util=require(_0x643f('0x1'));var moment=require(_0x643f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x643f('0x3'));var db=require(_0x643f('0x4'))['db'];var utils=require(_0x643f('0x5'));var logger=require(_0x643f('0x6'))(_0x643f('0x7'));var config=require(_0x643f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x643f('0x9')][_0x643f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cca27,_0x4d51af,_0x46b542){return new BPromise(function(_0x36414e,_0x78ce6c){return client[_0x643f('0xb')](_0x2cca27,_0x46b542)[_0x643f('0xc')](function(_0x36cf42){logger[_0x643f('0xd')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4d51af,_0x643f('0xe'));logger['debug']('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x4d51af,'request\x20sent',JSON[_0x643f('0xf')](_0x36cf42));if(_0x36cf42['error']){if(_0x36cf42['error']['code']===0x1f4){logger['error'](_0x643f('0x10'),_0x4d51af,_0x36cf42['error'][_0x643f('0x11')]);return _0x78ce6c(_0x36cf42[_0x643f('0x12')][_0x643f('0x11')]);}logger['error'](_0x643f('0x10'),_0x4d51af,_0x36cf42[_0x643f('0x12')][_0x643f('0x11')]);return _0x36414e(_0x36cf42[_0x643f('0x12')][_0x643f('0x11')]);}else{logger[_0x643f('0xd')](_0x643f('0x10'),_0x4d51af,_0x643f('0xe'));_0x36414e(_0x36cf42[_0x643f('0x13')]['message']);}})[_0x643f('0x14')](function(_0x1ab388){logger[_0x643f('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x4d51af,_0x1ab388);_0x78ce6c(_0x1ab388);});});} \ No newline at end of file +var _0x370d=['../../config/environment','jayson/promise','client','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','randomstring','../../config/utils','rpc'];(function(_0x50974b,_0x2ef9d1){var _0x4842e4=function(_0x41efdc){while(--_0x41efdc){_0x50974b['push'](_0x50974b['shift']());}};_0x4842e4(++_0x2ef9d1);}(_0x370d,0x14f));var _0xd370=function(_0x1e152d,_0x892f35){_0x1e152d=_0x1e152d-0x0;var _0x4114d0=_0x370d[_0x1e152d];return _0x4114d0;};'use strict';var _=require(_0xd370('0x0'));var util=require(_0xd370('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd370('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd370('0x3'));var logger=require('../../config/logger')(_0xd370('0x4'));var config=require(_0xd370('0x5'));var jayson=require(_0xd370('0x6'));var client=jayson[_0xd370('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37c5aa,_0x2949fc,_0x3057ef){return new BPromise(function(_0x58b9ac,_0x3c66fa){return client['request'](_0x37c5aa,_0x3057ef)[_0xd370('0x8')](function(_0x300c16){logger[_0xd370('0x9')](_0xd370('0xa'),_0x2949fc,_0xd370('0xb'));logger[_0xd370('0xc')](_0xd370('0xd'),_0x2949fc,_0xd370('0xb'),JSON['stringify'](_0x300c16));if(_0x300c16[_0xd370('0xe')]){if(_0x300c16[_0xd370('0xe')][_0xd370('0xf')]===0x1f4){logger[_0xd370('0xe')](_0xd370('0xa'),_0x2949fc,_0x300c16[_0xd370('0xe')]['message']);return _0x3c66fa(_0x300c16[_0xd370('0xe')][_0xd370('0x10')]);}logger['error'](_0xd370('0xa'),_0x2949fc,_0x300c16[_0xd370('0xe')][_0xd370('0x10')]);return _0x58b9ac(_0x300c16[_0xd370('0xe')][_0xd370('0x10')]);}else{logger[_0xd370('0x9')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2949fc,_0xd370('0xb'));_0x58b9ac(_0x300c16['result'][_0xd370('0x10')]);}})['catch'](function(_0x3df039){logger[_0xd370('0xe')](_0xd370('0xa'),_0x2949fc,_0x3df039);_0x3c66fa(_0x3df039);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index dab9b48..47563cb 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 _0x2e8e=['/:id/questions','getQuestions','post','create','put','update','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2e8e,0x181));var _0xe2e8=function(_0x12aaee,_0x5bf50c){_0x12aaee=_0x12aaee-0x0;var _0x37c350=_0x2e8e[_0x12aaee];return _0x37c350;};'use strict';var multer=require('multer');var util=require(_0xe2e8('0x0'));var path=require('path');var timeout=require(_0xe2e8('0x1'));var express=require(_0xe2e8('0x2'));var router=express[_0xe2e8('0x3')]();var fs_extra=require(_0xe2e8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe2e8('0x5'));var config=require(_0xe2e8('0x6'));var controller=require(_0xe2e8('0x7'));router[_0xe2e8('0x8')]('/',auth[_0xe2e8('0x9')](),controller[_0xe2e8('0xa')]);router[_0xe2e8('0x8')](_0xe2e8('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe2e8('0x8')](_0xe2e8('0xc'),auth['isAuthenticated'](),controller[_0xe2e8('0xd')]);router['get'](_0xe2e8('0xe'),auth['isAuthenticated'](),controller[_0xe2e8('0xf')]);router[_0xe2e8('0x10')]('/',auth['isAuthenticated'](),controller[_0xe2e8('0x11')]);router[_0xe2e8('0x12')](_0xe2e8('0xc'),auth[_0xe2e8('0x9')](),controller[_0xe2e8('0x13')]);router['delete'](_0xe2e8('0xc'),auth[_0xe2e8('0x9')](),controller['destroy']);module[_0xe2e8('0x14')]=router; \ No newline at end of file +var _0xe874=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/questions','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xe874,0x1f3));var _0x4e87=function(_0x542d80,_0x150561){_0x542d80=_0x542d80-0x0;var _0x1f4492=_0xe874[_0x542d80];return _0x1f4492;};'use strict';var multer=require(_0x4e87('0x0'));var util=require(_0x4e87('0x1'));var path=require(_0x4e87('0x2'));var timeout=require(_0x4e87('0x3'));var express=require('express');var router=express[_0x4e87('0x4')]();var fs_extra=require(_0x4e87('0x5'));var auth=require(_0x4e87('0x6'));var interaction=require(_0x4e87('0x7'));var config=require(_0x4e87('0x8'));var controller=require(_0x4e87('0x9'));router[_0x4e87('0xa')]('/',auth[_0x4e87('0xb')](),controller[_0x4e87('0xc')]);router[_0x4e87('0xa')](_0x4e87('0xd'),auth[_0x4e87('0xb')](),controller['describe']);router[_0x4e87('0xa')](_0x4e87('0xe'),auth['isAuthenticated'](),controller[_0x4e87('0xf')]);router[_0x4e87('0xa')](_0x4e87('0x10'),auth[_0x4e87('0xb')](),controller['getQuestions']);router[_0x4e87('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4e87('0x12')](_0x4e87('0xe'),auth[_0x4e87('0xb')](),controller[_0x4e87('0x13')]);router['delete'](_0x4e87('0xe'),auth[_0x4e87('0xb')](),controller[_0x4e87('0x14')]);module[_0x4e87('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 89cdc4c..02332bf 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 _0xb8cd=['YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','starttime','setDataValue','format'];(function(_0x31ea5d,_0x19ecdd){var _0x2d9985=function(_0xa90f2d){while(--_0xa90f2d){_0x31ea5d['push'](_0x31ea5d['shift']());}};_0x2d9985(++_0x19ecdd);}(_0xb8cd,0x1d9));var _0xdb8c=function(_0x303dbc,_0x23de7c){_0x303dbc=_0x303dbc-0x0;var _0x262078=_0xb8cd[_0x303dbc];return _0x262078;};'use strict';var moment=require(_0xdb8c('0x0'));var Sequelize=require(_0xdb8c('0x1'));module[_0xdb8c('0x2')]={'starttime':{'type':Sequelize[_0xdb8c('0x3')],'set':function(_0x10354b){this['setDataValue'](_0xdb8c('0x4'),_0x10354b);this[_0xdb8c('0x5')]('endtime',moment()[_0xdb8c('0x6')](_0xdb8c('0x7')));}},'endtime':{'type':Sequelize[_0xdb8c('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xdb8c('0x8')]},'queue':{'type':Sequelize[_0xdb8c('0x8')]},'uniqueid':{'type':Sequelize[_0xdb8c('0x8')]},'calleridname':{'type':Sequelize[_0xdb8c('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xdb8c('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x2bbc=['moment','sequelize','exports','DATE','setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x2bbc,0xa5));var _0xc2bb=function(_0x3bf68a,_0x33695f){_0x3bf68a=_0x3bf68a-0x0;var _0x49f047=_0x2bbc[_0x3bf68a];return _0x49f047;};'use strict';var moment=require(_0xc2bb('0x0'));var Sequelize=require(_0xc2bb('0x1'));module[_0xc2bb('0x2')]={'starttime':{'type':Sequelize[_0xc2bb('0x3')],'set':function(_0xbced50){this[_0xc2bb('0x4')](_0xc2bb('0x5'),_0xbced50);this[_0xc2bb('0x4')](_0xc2bb('0x6'),moment()[_0xc2bb('0x7')](_0xc2bb('0x8')));}},'endtime':{'type':Sequelize[_0xc2bb('0x3')]},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xc2bb('0x9')]},'queue':{'type':Sequelize[_0xc2bb('0x9')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc2bb('0x9')]},'completed':{'type':Sequelize[_0xc2bb('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 6e5c236..5c17bd2 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 _0x183c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','name','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','filter','VIRTUAL','merge','options','JscriptySessionReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','rawAttributes','nolimit','sort','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse'];(function(_0x34537f,_0x213a48){var _0x4bc478=function(_0x22690e){while(--_0x22690e){_0x34537f['push'](_0x34537f['shift']());}};_0x4bc478(++_0x213a48);}(_0x183c,0x94));var _0xc183=function(_0x476859,_0x298703){_0x476859=_0x476859-0x0;var _0x5c9af3=_0x183c[_0x476859];return _0x5c9af3;};'use strict';var emlformat=require(_0xc183('0x0'));var rimraf=require(_0xc183('0x1'));var zipdir=require(_0xc183('0x2'));var jsonpatch=require(_0xc183('0x3'));var rp=require(_0xc183('0x4'));var moment=require('moment');var BPromise=require(_0xc183('0x5'));var Mustache=require(_0xc183('0x6'));var util=require(_0xc183('0x7'));var path=require('path');var sox=require(_0xc183('0x8'));var csv=require(_0xc183('0x9'));var ejs=require(_0xc183('0xa'));var fs=require('fs');var fs_extra=require(_0xc183('0xb'));var _=require(_0xc183('0xc'));var squel=require(_0xc183('0xd'));var crypto=require(_0xc183('0xe'));var jsforce=require(_0xc183('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc183('0x10'));var Papa=require(_0xc183('0x11'));var Redis=require(_0xc183('0x12'));var authService=require(_0xc183('0x13'));var qs=require(_0xc183('0x14'));var as=require(_0xc183('0x15'));var hardwareService=require(_0xc183('0x16'));var logger=require(_0xc183('0x17'))('api');var utils=require(_0xc183('0x18'));var config=require(_0xc183('0x19'));var licenseUtil=require(_0xc183('0x1a'));var db=require(_0xc183('0x1b'))['db'];function respondWithStatusCode(_0x3da77a,_0x3b2a42){_0x3b2a42=_0x3b2a42||0xcc;return function(_0x39f7e8){if(_0x39f7e8){return _0x3da77a[_0xc183('0x1c')](_0x3b2a42);}return _0x3da77a[_0xc183('0x1d')](_0x3b2a42)[_0xc183('0x1e')]();};}function respondWithResult(_0x5e5fd1,_0x50ac15){_0x50ac15=_0x50ac15||0xc8;return function(_0x1a7eb7){if(_0x1a7eb7){return _0x5e5fd1['status'](_0x50ac15)[_0xc183('0x1f')](_0x1a7eb7);}};}function respondWithFilteredResult(_0x2615ff,_0x41802f){return function(_0x302816){if(_0x302816){var _0x97a23=typeof _0x41802f[_0xc183('0x20')]===_0xc183('0x21')&&typeof _0x41802f[_0xc183('0x22')]===_0xc183('0x21');var _0xd214c0=_0x302816['count'];var _0x350701=_0x97a23?0x0:_0x41802f['offset'];var _0x555ee9=_0x97a23?_0x302816[_0xc183('0x23')]:_0x41802f[_0xc183('0x20')]+_0x41802f['limit'];var _0x1201a1;if(_0x555ee9>=_0xd214c0){_0x555ee9=_0xd214c0;_0x1201a1=0xc8;}else{_0x1201a1=0xce;}_0x2615ff[_0xc183('0x1d')](_0x1201a1);return _0x2615ff[_0xc183('0x24')](_0xc183('0x25'),_0x350701+'-'+_0x555ee9+'/'+_0xd214c0)[_0xc183('0x1f')](_0x302816);}return null;};}function patchUpdates(_0x1eda84){return function(_0x3277e2){try{jsonpatch[_0xc183('0x26')](_0x3277e2,_0x1eda84,!![]);}catch(_0x88b777){return BPromise['reject'](_0x88b777);}return _0x3277e2[_0xc183('0x27')]();};}function saveUpdates(_0x14e5e4,_0x1db6ea){return function(_0x143eb3){if(_0x143eb3){return _0x143eb3[_0xc183('0x28')](_0x14e5e4)[_0xc183('0x29')](function(_0x33c7b5){return _0x33c7b5;});}return null;};}function removeEntity(_0x493d80,_0x2e240c){return function(_0x4a870e){if(_0x4a870e){return _0x4a870e['destroy']()['then'](function(){_0x493d80['status'](0xcc)[_0xc183('0x1e')]();});}};}function handleEntityNotFound(_0x457c5e,_0x4684e1){return function(_0x1e4f29){if(!_0x1e4f29){_0x457c5e[_0xc183('0x1c')](0x194);}return _0x1e4f29;};}function handleError(_0x4e44ff,_0x2f9e5a){_0x2f9e5a=_0x2f9e5a||0x1f4;return function(_0x3fbed1){logger[_0xc183('0x2a')](_0x3fbed1[_0xc183('0x2b')]);if(_0x3fbed1[_0xc183('0x2c')]){delete _0x3fbed1[_0xc183('0x2c')];}_0x4e44ff[_0xc183('0x1d')](_0x2f9e5a)['send'](_0x3fbed1);};}exports['index']=function(_0x4f4a2e,_0x3fcf8c){var _0x9b68f5={},_0x1e095e={},_0x198a10={'count':0x0,'rows':[]};var _0x447ed4=_['map'](db['JscriptySessionReport']['rawAttributes'],function(_0x5d2730){return{'name':_0x5d2730[_0xc183('0x2d')],'type':_0x5d2730[_0xc183('0x2e')][_0xc183('0x2f')]};});_0x1e095e[_0xc183('0x30')]=_[_0xc183('0x31')](_0x447ed4,'name');_0x1e095e[_0xc183('0x32')]=_[_0xc183('0x33')](_0x4f4a2e['query']);_0x1e095e[_0xc183('0x34')]=_['intersection'](_0x1e095e[_0xc183('0x30')],_0x1e095e['query']);_0x9b68f5[_0xc183('0x35')]=_[_0xc183('0x36')](_0x1e095e['model'],qs[_0xc183('0x37')](_0x4f4a2e[_0xc183('0x32')][_0xc183('0x37')]));_0x9b68f5[_0xc183('0x35')]=_0x9b68f5[_0xc183('0x35')][_0xc183('0x38')]?_0x9b68f5[_0xc183('0x35')]:_0x1e095e[_0xc183('0x30')];if(!_0x4f4a2e[_0xc183('0x32')][_0xc183('0x39')]('nolimit')){_0x9b68f5[_0xc183('0x22')]=qs[_0xc183('0x22')](_0x4f4a2e[_0xc183('0x32')][_0xc183('0x22')]);_0x9b68f5[_0xc183('0x20')]=qs[_0xc183('0x20')](_0x4f4a2e['query'][_0xc183('0x20')]);}_0x9b68f5[_0xc183('0x3a')]=qs['sort'](_0x4f4a2e[_0xc183('0x32')]['sort']);_0x9b68f5[_0xc183('0x3b')]=qs['filters'](_['pick'](_0x4f4a2e[_0xc183('0x32')],_0x1e095e[_0xc183('0x34')]),_0x447ed4);if(_0x4f4a2e['query'][_0xc183('0x3c')]){_0x9b68f5[_0xc183('0x3b')]=_['merge'](_0x9b68f5[_0xc183('0x3b')],{'$or':_['map'](_0x447ed4,function(_0x16ad55){if(_0x16ad55[_0xc183('0x2e')]!==_0xc183('0x3d')){var _0x5812c0={};_0x5812c0[_0x16ad55[_0xc183('0x2c')]]={'$like':'%'+_0x4f4a2e['query'][_0xc183('0x3c')]+'%'};return _0x5812c0;}})});}_0x9b68f5=_[_0xc183('0x3e')]({},_0x9b68f5,_0x4f4a2e[_0xc183('0x3f')]);var _0x2492e3={'where':_0x9b68f5[_0xc183('0x3b')]};return db[_0xc183('0x40')]['count'](_0x2492e3)[_0xc183('0x29')](function(_0x2d2cb3){_0x198a10['count']=_0x2d2cb3;if(_0x4f4a2e[_0xc183('0x32')][_0xc183('0x41')]){_0x9b68f5[_0xc183('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xc183('0x43')](_0x9b68f5);})[_0xc183('0x29')](function(_0x362527){_0x198a10[_0xc183('0x44')]=_0x362527;return _0x198a10;})[_0xc183('0x29')](respondWithFilteredResult(_0x3fcf8c,_0x9b68f5))[_0xc183('0x45')](handleError(_0x3fcf8c,null));};exports[_0xc183('0x46')]=function(_0x552ea5,_0x2fb49d){var _0x5eab2d={'raw':!![],'where':{'id':_0x552ea5[_0xc183('0x47')]['id']}},_0x11d1c0={};_0x11d1c0[_0xc183('0x30')]=_[_0xc183('0x33')](db[_0xc183('0x40')]['rawAttributes']);_0x11d1c0[_0xc183('0x32')]=_[_0xc183('0x33')](_0x552ea5['query']);_0x11d1c0[_0xc183('0x34')]=_[_0xc183('0x36')](_0x11d1c0[_0xc183('0x30')],_0x11d1c0['query']);_0x5eab2d['attributes']=_[_0xc183('0x36')](_0x11d1c0['model'],qs[_0xc183('0x37')](_0x552ea5[_0xc183('0x32')][_0xc183('0x37')]));_0x5eab2d[_0xc183('0x35')]=_0x5eab2d[_0xc183('0x35')][_0xc183('0x38')]?_0x5eab2d['attributes']:_0x11d1c0[_0xc183('0x30')];if(_0x552ea5['query'][_0xc183('0x41')]){_0x5eab2d[_0xc183('0x42')]=[{'all':!![]}];}_0x5eab2d=_[_0xc183('0x3e')]({},_0x5eab2d,_0x552ea5['options']);return db[_0xc183('0x40')][_0xc183('0x48')](_0x5eab2d)['then'](handleEntityNotFound(_0x2fb49d,null))[_0xc183('0x29')](respondWithResult(_0x2fb49d,null))[_0xc183('0x45')](handleError(_0x2fb49d,null));};exports[_0xc183('0x49')]=function(_0x5ea719,_0x56176a){return db[_0xc183('0x40')]['create'](_0x5ea719[_0xc183('0x4a')],{})['then'](respondWithResult(_0x56176a,0xc9))['catch'](handleError(_0x56176a,null));};exports[_0xc183('0x28')]=function(_0xe6d433,_0x292b8d){if(_0xe6d433[_0xc183('0x4a')]['id']){delete _0xe6d433[_0xc183('0x4a')]['id'];}return db[_0xc183('0x40')][_0xc183('0x48')]({'where':{'id':_0xe6d433[_0xc183('0x47')]['id']}})[_0xc183('0x29')](handleEntityNotFound(_0x292b8d,null))[_0xc183('0x29')](saveUpdates(_0xe6d433[_0xc183('0x4a')],null))[_0xc183('0x29')](respondWithResult(_0x292b8d,null))[_0xc183('0x45')](handleError(_0x292b8d,null));};exports[_0xc183('0x4b')]=function(_0x14fda8,_0x3d50d6){return db['JscriptySessionReport'][_0xc183('0x48')]({'where':{'id':_0x14fda8['params']['id']}})['then'](handleEntityNotFound(_0x3d50d6,null))[_0xc183('0x29')](removeEntity(_0x3d50d6,null))[_0xc183('0x45')](handleError(_0x3d50d6,null));};exports[_0xc183('0x4c')]=function(_0x27a3cf,_0x526e73){return db[_0xc183('0x40')][_0xc183('0x4c')]()[_0xc183('0x29')](respondWithResult(_0x526e73,null))[_0xc183('0x45')](handleError(_0x526e73,null));};exports[_0xc183('0x4d')]=function(_0x33844a,_0x49f3e1,_0x1c5f45){var _0x441950={'raw':!![],'where':{}};var _0x405e43={};var _0x28dcd6={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0xc183('0x4e')]({'where':{'id':_0x33844a[_0xc183('0x47')]['id']}})[_0xc183('0x29')](handleEntityNotFound(_0x49f3e1,null))['then'](function(_0x539ccd){if(_0x539ccd){_0x405e43['model']=_[_0xc183('0x33')](db[_0xc183('0x4f')][_0xc183('0x50')]);_0x405e43[_0xc183('0x32')]=_['keys'](_0x33844a[_0xc183('0x32')]);_0x405e43['filters']=_[_0xc183('0x36')](_0x405e43[_0xc183('0x30')],_0x405e43['query']);_0x441950[_0xc183('0x35')]=_[_0xc183('0x36')](_0x405e43['model'],qs['fields'](_0x33844a[_0xc183('0x32')][_0xc183('0x37')]));_0x441950['attributes']=_0x441950['attributes'][_0xc183('0x38')]?_0x441950[_0xc183('0x35')]:_0x405e43[_0xc183('0x30')];if(!_0x33844a[_0xc183('0x32')][_0xc183('0x39')](_0xc183('0x51'))){_0x441950[_0xc183('0x22')]=qs['limit'](_0x33844a['query'][_0xc183('0x22')]);_0x441950[_0xc183('0x20')]=qs[_0xc183('0x20')](_0x33844a['query'][_0xc183('0x20')]);}_0x441950['order']=qs[_0xc183('0x52')](_0x33844a[_0xc183('0x32')][_0xc183('0x52')]);_0x441950[_0xc183('0x3b')]=qs['filters'](_['pick'](_0x33844a[_0xc183('0x32')],_0x405e43[_0xc183('0x34')]));_0x441950['where']['SessionId']=_0x539ccd['id'];if(_0x33844a[_0xc183('0x32')]['filter']){_0x441950['where']=_[_0xc183('0x3e')](_0x441950['where'],{'$or':_[_0xc183('0x31')](_0x441950['attributes'],function(_0x452662){var _0x23b912={};_0x23b912[_0x452662]={'$like':'%'+_0x33844a['query'][_0xc183('0x3c')]+'%'};return _0x23b912;})});}_0x441950=_[_0xc183('0x3e')]({},_0x441950,_0x33844a[_0xc183('0x3f')]);return db[_0xc183('0x4f')][_0xc183('0x23')]({'where':_0x441950[_0xc183('0x3b')]})[_0xc183('0x29')](function(_0x4b1921){_0x28dcd6['count']=_0x4b1921;if(_0x33844a['query']['includeAll']){_0x441950[_0xc183('0x42')]=[{'all':!![]}];}return db[_0xc183('0x4f')][_0xc183('0x43')](_0x441950);})[_0xc183('0x29')](function(_0x34681d){_0x28dcd6['rows']=_0x34681d;return _0x28dcd6;});}})[_0xc183('0x29')](respondWithFilteredResult(_0x49f3e1,_0x441950))[_0xc183('0x45')](handleError(_0x49f3e1,null));}; \ No newline at end of file +var _0xf6bb=['getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','pick','SessionId','options','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','count','set','Content-Range','json','reject','save','update','then','end','stack','name','send','map','JscriptySessionReport','rawAttributes','fieldName','type','key','query','keys','filters','attributes','intersection','model','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','body','find','destroy','describe'];(function(_0xbf5006,_0x42b5da){var _0x22119d=function(_0x15d220){while(--_0x15d220){_0xbf5006['push'](_0xbf5006['shift']());}};_0x22119d(++_0x42b5da);}(_0xf6bb,0x100));var _0xbf6b=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0xf6bb[_0xc87d08];return _0x30a714;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf6b('0x0'));var zipdir=require(_0xbf6b('0x1'));var jsonpatch=require(_0xbf6b('0x2'));var rp=require(_0xbf6b('0x3'));var moment=require(_0xbf6b('0x4'));var BPromise=require(_0xbf6b('0x5'));var Mustache=require(_0xbf6b('0x6'));var util=require(_0xbf6b('0x7'));var path=require(_0xbf6b('0x8'));var sox=require('sox');var csv=require(_0xbf6b('0x9'));var ejs=require(_0xbf6b('0xa'));var fs=require('fs');var fs_extra=require(_0xbf6b('0xb'));var _=require(_0xbf6b('0xc'));var squel=require('squel');var crypto=require(_0xbf6b('0xd'));var jsforce=require(_0xbf6b('0xe'));var deskjs=require(_0xbf6b('0xf'));var toCsv=require(_0xbf6b('0x9'));var querystring=require(_0xbf6b('0x10'));var Papa=require(_0xbf6b('0x11'));var Redis=require(_0xbf6b('0x12'));var authService=require(_0xbf6b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xbf6b('0x14'));var hardwareService=require(_0xbf6b('0x15'));var logger=require(_0xbf6b('0x16'))(_0xbf6b('0x17'));var utils=require(_0xbf6b('0x18'));var config=require(_0xbf6b('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xbf6b('0x1a'))['db'];function respondWithStatusCode(_0x14ef5e,_0xabf5ec){_0xabf5ec=_0xabf5ec||0xcc;return function(_0x3220ba){if(_0x3220ba){return _0x14ef5e[_0xbf6b('0x1b')](_0xabf5ec);}return _0x14ef5e['status'](_0xabf5ec)['end']();};}function respondWithResult(_0xdf7d4c,_0xb679){_0xb679=_0xb679||0xc8;return function(_0x44312b){if(_0x44312b){return _0xdf7d4c[_0xbf6b('0x1c')](_0xb679)['json'](_0x44312b);}};}function respondWithFilteredResult(_0x101070,_0x57b2b1){return function(_0x8fc6e5){if(_0x8fc6e5){var _0x3847a0=typeof _0x57b2b1[_0xbf6b('0x1d')]==='undefined'&&typeof _0x57b2b1[_0xbf6b('0x1e')]===_0xbf6b('0x1f');var _0x25993b=_0x8fc6e5['count'];var _0x122d36=_0x3847a0?0x0:_0x57b2b1['offset'];var _0x5da753=_0x3847a0?_0x8fc6e5[_0xbf6b('0x20')]:_0x57b2b1[_0xbf6b('0x1d')]+_0x57b2b1[_0xbf6b('0x1e')];var _0x2c3d99;if(_0x5da753>=_0x25993b){_0x5da753=_0x25993b;_0x2c3d99=0xc8;}else{_0x2c3d99=0xce;}_0x101070['status'](_0x2c3d99);return _0x101070[_0xbf6b('0x21')](_0xbf6b('0x22'),_0x122d36+'-'+_0x5da753+'/'+_0x25993b)[_0xbf6b('0x23')](_0x8fc6e5);}return null;};}function patchUpdates(_0x1f4a44){return function(_0x371880){try{jsonpatch['apply'](_0x371880,_0x1f4a44,!![]);}catch(_0x307486){return BPromise[_0xbf6b('0x24')](_0x307486);}return _0x371880[_0xbf6b('0x25')]();};}function saveUpdates(_0x40469b,_0x55bfb3){return function(_0x6d22bc){if(_0x6d22bc){return _0x6d22bc[_0xbf6b('0x26')](_0x40469b)[_0xbf6b('0x27')](function(_0x1084bf){return _0x1084bf;});}return null;};}function removeEntity(_0x3bf0f9,_0x4f1458){return function(_0x566580){if(_0x566580){return _0x566580['destroy']()[_0xbf6b('0x27')](function(){_0x3bf0f9[_0xbf6b('0x1c')](0xcc)[_0xbf6b('0x28')]();});}};}function handleEntityNotFound(_0x5cefa0,_0x5e81f0){return function(_0x123361){if(!_0x123361){_0x5cefa0[_0xbf6b('0x1b')](0x194);}return _0x123361;};}function handleError(_0x1465b9,_0x2af574){_0x2af574=_0x2af574||0x1f4;return function(_0x650f9){logger['error'](_0x650f9[_0xbf6b('0x29')]);if(_0x650f9[_0xbf6b('0x2a')]){delete _0x650f9[_0xbf6b('0x2a')];}_0x1465b9['status'](_0x2af574)[_0xbf6b('0x2b')](_0x650f9);};}exports['index']=function(_0x54a405,_0x147798){var _0x4d8a65={},_0x48855d={},_0x2dfc42={'count':0x0,'rows':[]};var _0x49a981=_[_0xbf6b('0x2c')](db[_0xbf6b('0x2d')][_0xbf6b('0x2e')],function(_0x3653cb){return{'name':_0x3653cb[_0xbf6b('0x2f')],'type':_0x3653cb[_0xbf6b('0x30')][_0xbf6b('0x31')]};});_0x48855d['model']=_[_0xbf6b('0x2c')](_0x49a981,'name');_0x48855d[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0x54a405[_0xbf6b('0x32')]);_0x48855d[_0xbf6b('0x34')]=_['intersection'](_0x48855d['model'],_0x48855d['query']);_0x4d8a65[_0xbf6b('0x35')]=_[_0xbf6b('0x36')](_0x48855d[_0xbf6b('0x37')],qs[_0xbf6b('0x38')](_0x54a405['query'][_0xbf6b('0x38')]));_0x4d8a65[_0xbf6b('0x35')]=_0x4d8a65[_0xbf6b('0x35')][_0xbf6b('0x39')]?_0x4d8a65[_0xbf6b('0x35')]:_0x48855d[_0xbf6b('0x37')];if(!_0x54a405[_0xbf6b('0x32')]['hasOwnProperty'](_0xbf6b('0x3a'))){_0x4d8a65[_0xbf6b('0x1e')]=qs[_0xbf6b('0x1e')](_0x54a405['query'][_0xbf6b('0x1e')]);_0x4d8a65[_0xbf6b('0x1d')]=qs[_0xbf6b('0x1d')](_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x1d')]);}_0x4d8a65[_0xbf6b('0x3b')]=qs[_0xbf6b('0x3c')](_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x3c')]);_0x4d8a65['where']=qs[_0xbf6b('0x34')](_['pick'](_0x54a405['query'],_0x48855d[_0xbf6b('0x34')]),_0x49a981);if(_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x3d')]){_0x4d8a65[_0xbf6b('0x3e')]=_[_0xbf6b('0x3f')](_0x4d8a65[_0xbf6b('0x3e')],{'$or':_[_0xbf6b('0x2c')](_0x49a981,function(_0x5cbb06){if(_0x5cbb06[_0xbf6b('0x30')]!==_0xbf6b('0x40')){var _0x240ed9={};_0x240ed9[_0x5cbb06['name']]={'$like':'%'+_0x54a405['query']['filter']+'%'};return _0x240ed9;}})});}_0x4d8a65=_[_0xbf6b('0x3f')]({},_0x4d8a65,_0x54a405['options']);var _0x4daafc={'where':_0x4d8a65[_0xbf6b('0x3e')]};return db['JscriptySessionReport'][_0xbf6b('0x20')](_0x4daafc)[_0xbf6b('0x27')](function(_0x19d056){_0x2dfc42['count']=_0x19d056;if(_0x54a405[_0xbf6b('0x32')][_0xbf6b('0x41')]){_0x4d8a65[_0xbf6b('0x42')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xbf6b('0x43')](_0x4d8a65);})[_0xbf6b('0x27')](function(_0x187e30){_0x2dfc42[_0xbf6b('0x44')]=_0x187e30;return _0x2dfc42;})[_0xbf6b('0x27')](respondWithFilteredResult(_0x147798,_0x4d8a65))[_0xbf6b('0x45')](handleError(_0x147798,null));};exports[_0xbf6b('0x46')]=function(_0x28bfca,_0xb9726b){var _0xeb7ef2={'raw':!![],'where':{'id':_0x28bfca[_0xbf6b('0x47')]['id']}},_0xc219f8={};_0xc219f8['model']=_[_0xbf6b('0x33')](db[_0xbf6b('0x2d')][_0xbf6b('0x2e')]);_0xc219f8[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0x28bfca[_0xbf6b('0x32')]);_0xc219f8['filters']=_['intersection'](_0xc219f8[_0xbf6b('0x37')],_0xc219f8[_0xbf6b('0x32')]);_0xeb7ef2[_0xbf6b('0x35')]=_[_0xbf6b('0x36')](_0xc219f8[_0xbf6b('0x37')],qs[_0xbf6b('0x38')](_0x28bfca[_0xbf6b('0x32')][_0xbf6b('0x38')]));_0xeb7ef2['attributes']=_0xeb7ef2[_0xbf6b('0x35')][_0xbf6b('0x39')]?_0xeb7ef2[_0xbf6b('0x35')]:_0xc219f8[_0xbf6b('0x37')];if(_0x28bfca[_0xbf6b('0x32')][_0xbf6b('0x41')]){_0xeb7ef2['include']=[{'all':!![]}];}_0xeb7ef2=_[_0xbf6b('0x3f')]({},_0xeb7ef2,_0x28bfca['options']);return db['JscriptySessionReport']['find'](_0xeb7ef2)[_0xbf6b('0x27')](handleEntityNotFound(_0xb9726b,null))[_0xbf6b('0x27')](respondWithResult(_0xb9726b,null))[_0xbf6b('0x45')](handleError(_0xb9726b,null));};exports['create']=function(_0x7c9be4,_0x424872){return db[_0xbf6b('0x2d')]['create'](_0x7c9be4[_0xbf6b('0x48')],{})[_0xbf6b('0x27')](respondWithResult(_0x424872,0xc9))[_0xbf6b('0x45')](handleError(_0x424872,null));};exports['update']=function(_0x2fa857,_0x5f0b45){if(_0x2fa857[_0xbf6b('0x48')]['id']){delete _0x2fa857[_0xbf6b('0x48')]['id'];}return db[_0xbf6b('0x2d')][_0xbf6b('0x49')]({'where':{'id':_0x2fa857[_0xbf6b('0x47')]['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x5f0b45,null))[_0xbf6b('0x27')](saveUpdates(_0x2fa857[_0xbf6b('0x48')],null))[_0xbf6b('0x27')](respondWithResult(_0x5f0b45,null))[_0xbf6b('0x45')](handleError(_0x5f0b45,null));};exports[_0xbf6b('0x4a')]=function(_0x248fa7,_0x5b0d69){return db[_0xbf6b('0x2d')]['find']({'where':{'id':_0x248fa7[_0xbf6b('0x47')]['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x5b0d69,null))[_0xbf6b('0x27')](removeEntity(_0x5b0d69,null))['catch'](handleError(_0x5b0d69,null));};exports['describe']=function(_0x30fc58,_0x1e224d){return db[_0xbf6b('0x2d')][_0xbf6b('0x4b')]()['then'](respondWithResult(_0x1e224d,null))[_0xbf6b('0x45')](handleError(_0x1e224d,null));};exports[_0xbf6b('0x4c')]=function(_0xb2dce9,_0x5d1ae7,_0x38b14e){var _0x37bccb={'raw':!![],'where':{}};var _0x4ac812={};var _0x122d08={'count':0x0,'rows':[]};return db[_0xbf6b('0x2d')][_0xbf6b('0x4d')]({'where':{'id':_0xb2dce9[_0xbf6b('0x47')]['id']}})[_0xbf6b('0x27')](handleEntityNotFound(_0x5d1ae7,null))[_0xbf6b('0x27')](function(_0x7c9f68){if(_0x7c9f68){_0x4ac812['model']=_[_0xbf6b('0x33')](db[_0xbf6b('0x4e')][_0xbf6b('0x2e')]);_0x4ac812[_0xbf6b('0x32')]=_[_0xbf6b('0x33')](_0xb2dce9[_0xbf6b('0x32')]);_0x4ac812[_0xbf6b('0x34')]=_[_0xbf6b('0x36')](_0x4ac812[_0xbf6b('0x37')],_0x4ac812[_0xbf6b('0x32')]);_0x37bccb[_0xbf6b('0x35')]=_[_0xbf6b('0x36')](_0x4ac812['model'],qs[_0xbf6b('0x38')](_0xb2dce9[_0xbf6b('0x32')][_0xbf6b('0x38')]));_0x37bccb[_0xbf6b('0x35')]=_0x37bccb[_0xbf6b('0x35')][_0xbf6b('0x39')]?_0x37bccb['attributes']:_0x4ac812[_0xbf6b('0x37')];if(!_0xb2dce9[_0xbf6b('0x32')][_0xbf6b('0x4f')]('nolimit')){_0x37bccb['limit']=qs['limit'](_0xb2dce9['query'][_0xbf6b('0x1e')]);_0x37bccb[_0xbf6b('0x1d')]=qs[_0xbf6b('0x1d')](_0xb2dce9[_0xbf6b('0x32')][_0xbf6b('0x1d')]);}_0x37bccb[_0xbf6b('0x3b')]=qs[_0xbf6b('0x3c')](_0xb2dce9['query'][_0xbf6b('0x3c')]);_0x37bccb[_0xbf6b('0x3e')]=qs[_0xbf6b('0x34')](_[_0xbf6b('0x50')](_0xb2dce9[_0xbf6b('0x32')],_0x4ac812['filters']));_0x37bccb[_0xbf6b('0x3e')][_0xbf6b('0x51')]=_0x7c9f68['id'];if(_0xb2dce9[_0xbf6b('0x32')]['filter']){_0x37bccb[_0xbf6b('0x3e')]=_[_0xbf6b('0x3f')](_0x37bccb[_0xbf6b('0x3e')],{'$or':_[_0xbf6b('0x2c')](_0x37bccb[_0xbf6b('0x35')],function(_0x241474){var _0x306212={};_0x306212[_0x241474]={'$like':'%'+_0xb2dce9['query'][_0xbf6b('0x3d')]+'%'};return _0x306212;})});}_0x37bccb=_[_0xbf6b('0x3f')]({},_0x37bccb,_0xb2dce9[_0xbf6b('0x52')]);return db[_0xbf6b('0x4e')][_0xbf6b('0x20')]({'where':_0x37bccb['where']})[_0xbf6b('0x27')](function(_0x312c91){_0x122d08['count']=_0x312c91;if(_0xb2dce9['query'][_0xbf6b('0x41')]){_0x37bccb[_0xbf6b('0x42')]=[{'all':!![]}];}return db[_0xbf6b('0x4e')][_0xbf6b('0x43')](_0x37bccb);})[_0xbf6b('0x27')](function(_0xe35bff){_0x122d08[_0xbf6b('0x44')]=_0xe35bff;return _0x122d08;});}})['then'](respondWithFilteredResult(_0x5d1ae7,_0x37bccb))[_0xbf6b('0x45')](handleError(_0x5d1ae7,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 19b0d91..049e564 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 _0x1cb9=['./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x2046ed,_0x54ac19){var _0x437fe4=function(_0x526959){while(--_0x526959){_0x2046ed['push'](_0x2046ed['shift']());}};_0x437fe4(++_0x54ac19);}(_0x1cb9,0x14e));var _0x91cb=function(_0x4104df,_0x33eaa7){_0x4104df=_0x4104df-0x0;var _0x2ca8a4=_0x1cb9[_0x4104df];return _0x2ca8a4;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c7b=['path','rimraf','./jscriptySessionReport.attributes','exports','define','report_jscripty_sessions','lodash','moment','request-promise'];(function(_0x4fb32f,_0x39f177){var _0x2fd978=function(_0x516ff9){while(--_0x516ff9){_0x4fb32f['push'](_0x4fb32f['shift']());}};_0x2fd978(++_0x39f177);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x376c87,_0x259f10){_0x376c87=_0x376c87-0x0;var _0x265832=_0x6c7b[_0x376c87];return _0x265832;};'use strict';var _=require(_0xb6c7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb6c7('0x1'));var BPromise=require('bluebird');var rp=require(_0xb6c7('0x2'));var fs=require('fs');var path=require(_0xb6c7('0x3'));var rimraf=require(_0xb6c7('0x4'));var config=require('../../config/environment');var attributes=require(_0xb6c7('0x5'));module[_0xb6c7('0x6')]=function(_0xfe3eb9,_0x219abc){return _0xfe3eb9[_0xb6c7('0x7')]('JscriptySessionReport',attributes,{'tableName':_0xb6c7('0x8'),'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 eea237f..ca405a2 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 _0x4888=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0xf3a8e,_0x332fc9){var _0x36c459=function(_0x2a24fb){while(--_0x2a24fb){_0xf3a8e['push'](_0xf3a8e['shift']());}};_0x36c459(++_0x332fc9);}(_0x4888,0x198));var _0x8488=function(_0x9171e0,_0x2ee1b3){_0x9171e0=_0x9171e0-0x0;var _0x2659fb=_0x4888[_0x9171e0];return _0x2659fb;};'use strict';var _=require('lodash');var util=require(_0x8488('0x0'));var moment=require(_0x8488('0x1'));var BPromise=require(_0x8488('0x2'));var rs=require(_0x8488('0x3'));var fs=require('fs');var Redis=require(_0x8488('0x4'));var db=require(_0x8488('0x5'))['db'];var utils=require(_0x8488('0x6'));var logger=require('../../config/logger')(_0x8488('0x7'));var config=require(_0x8488('0x8'));var jayson=require(_0x8488('0x9'));var client=jayson[_0x8488('0xa')][_0x8488('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x19e508,_0x5250a1,_0x5b30a7){return new BPromise(function(_0x56aad0,_0x568a82){return client[_0x8488('0xc')](_0x19e508,_0x5b30a7)[_0x8488('0xd')](function(_0x542bd8){logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));logger[_0x8488('0x11')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x5250a1,_0x8488('0x10'),JSON[_0x8488('0x12')](_0x542bd8));if(_0x542bd8[_0x8488('0x13')]){if(_0x542bd8[_0x8488('0x13')][_0x8488('0x14')]===0x1f4){logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8[_0x8488('0x13')]['message']);return _0x568a82(_0x542bd8['error'][_0x8488('0x15')]);}logger['error'](_0x8488('0xf'),_0x5250a1,_0x542bd8['error']['message']);return _0x56aad0(_0x542bd8[_0x8488('0x13')][_0x8488('0x15')]);}else{logger[_0x8488('0xe')](_0x8488('0xf'),_0x5250a1,_0x8488('0x10'));_0x56aad0(_0x542bd8[_0x8488('0x16')][_0x8488('0x15')]);}})['catch'](function(_0x3dad45){logger[_0x8488('0x13')](_0x8488('0xf'),_0x5250a1,_0x3dad45);_0x568a82(_0x3dad45);});});} \ No newline at end of file +var _0xc1c6=['lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch'];(function(_0xae507b,_0x57ded3){var _0x50d288=function(_0xbb891d){while(--_0xbb891d){_0xae507b['push'](_0xae507b['shift']());}};_0x50d288(++_0x57ded3);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2ffe72,_0x58ade9){_0x2ffe72=_0x2ffe72-0x0;var _0x2711a3=_0xc1c6[_0x2ffe72];return _0x2711a3;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 37f51f4..d6917fd 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 _0x4c7f=['../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','util','path','express','Router','fs-extra'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x4c7f,0x82));var _0xf4c7=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4c7f[_0x68c979];return _0x4f0001;};'use strict';var multer=require(_0xf4c7('0x0'));var util=require(_0xf4c7('0x1'));var path=require(_0xf4c7('0x2'));var timeout=require('connect-timeout');var express=require(_0xf4c7('0x3'));var router=express[_0xf4c7('0x4')]();var fs_extra=require(_0xf4c7('0x5'));var auth=require(_0xf4c7('0x6'));var interaction=require(_0xf4c7('0x7'));var config=require(_0xf4c7('0x8'));var controller=require(_0xf4c7('0x9'));router[_0xf4c7('0xa')]('/',controller[_0xf4c7('0xb')]);router['put'](_0xf4c7('0xc'),auth[_0xf4c7('0xd')](),controller['update']);router['get'](_0xf4c7('0xe'),auth[_0xf4c7('0xd')](),controller[_0xf4c7('0xf')]);module[_0xf4c7('0x10')]=router; \ No newline at end of file +var _0x9f19=['get','index','/:id','isAuthenticated','update','/download_log_file','downloadLogFile','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller'];(function(_0x47f0cd,_0x6ea560){var _0x50bd1d=function(_0x2913c8){while(--_0x2913c8){_0x47f0cd['push'](_0x47f0cd['shift']());}};_0x50bd1d(++_0x6ea560);}(_0x9f19,0xa7));var _0x99f1=function(_0x100f66,_0x1959ad){_0x100f66=_0x100f66-0x0;var _0x4ec96d=_0x9f19[_0x100f66];return _0x4ec96d;};'use strict';var multer=require(_0x99f1('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x99f1('0x1'));var express=require(_0x99f1('0x2'));var router=express[_0x99f1('0x3')]();var fs_extra=require(_0x99f1('0x4'));var auth=require(_0x99f1('0x5'));var interaction=require(_0x99f1('0x6'));var config=require(_0x99f1('0x7'));var controller=require(_0x99f1('0x8'));router[_0x99f1('0x9')]('/',controller[_0x99f1('0xa')]);router['put'](_0x99f1('0xb'),auth[_0x99f1('0xc')](),controller[_0x99f1('0xd')]);router[_0x99f1('0x9')](_0x99f1('0xe'),auth[_0x99f1('0xc')](),controller[_0x99f1('0xf')]);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 16058af..3926226 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 _0x12f4=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x7eeee3,_0x17bd80){var _0x67e198=function(_0x42d3bd){while(--_0x42d3bd){_0x7eeee3['push'](_0x7eeee3['shift']());}};_0x67e198(++_0x17bd80);}(_0x12f4,0x1b2));var _0x412f=function(_0x4b9323,_0xd1772b){_0x4b9323=_0x4b9323-0x0;var _0x355e95=_0x12f4[_0x4b9323];return _0x355e95;};'use strict';var Sequelize=require(_0x412f('0x0'));module[_0x412f('0x1')]={'license':{'type':Sequelize[_0x412f('0x2')]},'data1':{'type':Sequelize[_0x412f('0x3')]},'data2':{'type':Sequelize[_0x412f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x412f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2859=['exports','TEXT','STRING','INTEGER','sequelize'];(function(_0x24b710,_0x2d5dcf){var _0x2722d4=function(_0x188173){while(--_0x188173){_0x24b710['push'](_0x24b710['shift']());}};_0x2722d4(++_0x2d5dcf);}(_0x2859,0x14e));var _0x9285=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x2859[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x9285('0x0'));module[_0x9285('0x1')]={'license':{'type':Sequelize[_0x9285('0x2')]},'data1':{'type':Sequelize[_0x9285('0x3')]},'data2':{'type':Sequelize[_0x9285('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x9285('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index a06ec94..76cdf59 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 _0x3438=['length','options','getLicense','catch','body','params','get','checkLicense','key','demo','downloadLogFile','license-info.log','join','/var','xcally','setHeader','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','zip-dir','fast-json-patch','request-promise','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','send','../../config/license/util','index','model','keys','License','query','filters','attributes','fields'];(function(_0x21b359,_0x4dc80e){var _0x57b8e7=function(_0x135adb){while(--_0x135adb){_0x21b359['push'](_0x21b359['shift']());}};_0x57b8e7(++_0x4dc80e);}(_0x3438,0x141));var _0x8343=function(_0x217203,_0x3c6629){_0x217203=_0x217203-0x0;var _0x5581d3=_0x3438[_0x217203];return _0x5581d3;};'use strict';var emlformat=require(_0x8343('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8343('0x1'));var jsonpatch=require(_0x8343('0x2'));var rp=require(_0x8343('0x3'));var moment=require('moment');var BPromise=require(_0x8343('0x4'));var Mustache=require(_0x8343('0x5'));var util=require(_0x8343('0x6'));var path=require(_0x8343('0x7'));var sox=require(_0x8343('0x8'));var csv=require(_0x8343('0x9'));var ejs=require(_0x8343('0xa'));var fs=require('fs');var fs_extra=require(_0x8343('0xb'));var _=require(_0x8343('0xc'));var squel=require(_0x8343('0xd'));var crypto=require(_0x8343('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8343('0xf'));var toCsv=require(_0x8343('0x9'));var querystring=require('querystring');var Papa=require(_0x8343('0x10'));var Redis=require(_0x8343('0x11'));var authService=require(_0x8343('0x12'));var qs=require(_0x8343('0x13'));var as=require(_0x8343('0x14'));var hardwareService=require(_0x8343('0x15'));var logger=require(_0x8343('0x16'))(_0x8343('0x17'));var utils=require(_0x8343('0x18'));var config=require(_0x8343('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x8343('0x1a'))['db'];function respondWithStatusCode(_0x2dfd33,_0x40bf42){_0x40bf42=_0x40bf42||0xcc;return function(_0x16422d){if(_0x16422d){return _0x2dfd33['sendStatus'](_0x40bf42);}return _0x2dfd33['status'](_0x40bf42)['end']();};}function respondWithResult(_0x9ddfd0,_0xc1b19c){_0xc1b19c=_0xc1b19c||0xc8;return function(_0x1c10fe){if(_0x1c10fe){return _0x9ddfd0[_0x8343('0x1b')](_0xc1b19c)[_0x8343('0x1c')](_0x1c10fe);}};}function respondWithFilteredResult(_0x45aca8,_0x505cb7){return function(_0x415b00){if(_0x415b00){var _0x3ade21=typeof _0x505cb7[_0x8343('0x1d')]===_0x8343('0x1e')&&typeof _0x505cb7['limit']===_0x8343('0x1e');var _0x38b963=_0x415b00[_0x8343('0x1f')];var _0x47fc71=_0x3ade21?0x0:_0x505cb7[_0x8343('0x1d')];var _0x4e488f=_0x3ade21?_0x415b00[_0x8343('0x1f')]:_0x505cb7['offset']+_0x505cb7[_0x8343('0x20')];var _0x4d3cba;if(_0x4e488f>=_0x38b963){_0x4e488f=_0x38b963;_0x4d3cba=0xc8;}else{_0x4d3cba=0xce;}_0x45aca8[_0x8343('0x1b')](_0x4d3cba);return _0x45aca8[_0x8343('0x21')](_0x8343('0x22'),_0x47fc71+'-'+_0x4e488f+'/'+_0x38b963)['json'](_0x415b00);}return null;};}function patchUpdates(_0x5ae491){return function(_0x1b412f){try{jsonpatch[_0x8343('0x23')](_0x1b412f,_0x5ae491,!![]);}catch(_0x33bf19){return BPromise['reject'](_0x33bf19);}return _0x1b412f[_0x8343('0x24')]();};}function saveUpdates(_0xe13101,_0x1bf576){return function(_0x4d6dd7){if(_0x4d6dd7){return _0x4d6dd7[_0x8343('0x25')](_0xe13101)[_0x8343('0x26')](function(_0x13bba2){return _0x13bba2;});}return null;};}function removeEntity(_0xd00066,_0x3e6df0){return function(_0xe1865e){if(_0xe1865e){return _0xe1865e[_0x8343('0x27')]()['then'](function(){_0xd00066['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a0bd7,_0x130879){return function(_0x33028a){if(!_0x33028a){_0x5a0bd7[_0x8343('0x28')](0x194);}return _0x33028a;};}function handleError(_0x1fa58a,_0xc9bc8b){_0xc9bc8b=_0xc9bc8b||0x1f4;return function(_0x54f19e){logger[_0x8343('0x29')](_0x54f19e[_0x8343('0x2a')]);if(_0x54f19e['name']){delete _0x54f19e[_0x8343('0x2b')];}_0x1fa58a['status'](_0xc9bc8b)[_0x8343('0x2c')](_0x54f19e);};}var utilLicense=require(_0x8343('0x2d'));exports[_0x8343('0x2e')]=function(_0x23487c,_0x2ac20a){var _0x4cbd5a={'raw':!![],'where':{'id':0x1}},_0x4ddd84={};_0x4ddd84[_0x8343('0x2f')]=_[_0x8343('0x30')](db[_0x8343('0x31')]['rawAttributes']);_0x4ddd84['query']=_[_0x8343('0x30')](_0x23487c[_0x8343('0x32')]);_0x4ddd84[_0x8343('0x33')]=_['intersection'](_0x4ddd84[_0x8343('0x2f')],_0x4ddd84[_0x8343('0x32')]);_0x4cbd5a[_0x8343('0x34')]=_['intersection'](_0x4ddd84[_0x8343('0x2f')],qs[_0x8343('0x35')](_0x23487c['query'][_0x8343('0x35')]));_0x4cbd5a[_0x8343('0x34')]=_0x4cbd5a[_0x8343('0x34')][_0x8343('0x36')]?_0x4cbd5a['attributes']:_0x4ddd84['model'];_0x4cbd5a=_['merge']({},_0x4cbd5a,_0x23487c[_0x8343('0x37')]);return utilLicense[_0x8343('0x38')](_0x4cbd5a)['then'](respondWithResult(_0x2ac20a,null))[_0x8343('0x39')](handleError(_0x2ac20a,null));};exports[_0x8343('0x25')]=function(_0x40b283,_0x39bfdc){if(_0x40b283[_0x8343('0x3a')]['id']){delete _0x40b283['body']['id'];}return db[_0x8343('0x31')]['find']({'where':{'id':_0x40b283[_0x8343('0x3b')]['id']}})[_0x8343('0x26')](handleEntityNotFound(_0x39bfdc,null))[_0x8343('0x26')](function(_0x37956b){var _0x4501dd=_0x37956b[_0x8343('0x3c')]({'plain':!![]});return utilLicense[_0x8343('0x3d')](_0x4501dd,_0x40b283[_0x8343('0x3a')][_0x8343('0x3e')]);})[_0x8343('0x26')](function(_0x584a36){if(!_0x584a36[_0x8343('0x3f')]){return saveUpdates(_0x40b283['body'],null);}return _0x584a36;})[_0x8343('0x26')](respondWithResult(_0x39bfdc,null))['catch'](handleError(_0x39bfdc,null));};exports[_0x8343('0x40')]=function(_0x6451c8,_0x16cdd7){var _0x5ad365=_0x8343('0x41');var _0x3dc7ce=path[_0x8343('0x42')](_0x8343('0x43'),'log',_0x8343('0x44'),_0x5ad365);_0x16cdd7[_0x8343('0x45')](_0x8343('0x46'),_0x8343('0x47')+_0x5ad365);_0x16cdd7[_0x8343('0x21')](_0x8343('0x48'),_0x8343('0x49'));_0x16cdd7[_0x8343('0x4a')](_0x3dc7ce);}; \ No newline at end of file +var _0xed2a=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','count','Content-Range','apply','reject','update','then','stack','send','../../config/license/util','index','keys','License','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options','getLicense','body','find','params','checkLicense','key','catch','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','Content-disposition','attachment;\x20filename=','set','download','eml-format','rimraf'];(function(_0xcafb2b,_0x2cc85e){var _0x539f9a=function(_0x9a96e6){while(--_0x9a96e6){_0xcafb2b['push'](_0xcafb2b['shift']());}};_0x539f9a(++_0x2cc85e);}(_0xed2a,0x1e8));var _0xaed2=function(_0x52cc9,_0xe92438){_0x52cc9=_0x52cc9-0x0;var _0xc87a2e=_0xed2a[_0x52cc9];return _0xc87a2e;};'use strict';var emlformat=require(_0xaed2('0x0'));var rimraf=require(_0xaed2('0x1'));var zipdir=require(_0xaed2('0x2'));var jsonpatch=require(_0xaed2('0x3'));var rp=require(_0xaed2('0x4'));var moment=require(_0xaed2('0x5'));var BPromise=require(_0xaed2('0x6'));var Mustache=require(_0xaed2('0x7'));var util=require(_0xaed2('0x8'));var path=require(_0xaed2('0x9'));var sox=require(_0xaed2('0xa'));var csv=require(_0xaed2('0xb'));var ejs=require(_0xaed2('0xc'));var fs=require('fs');var fs_extra=require(_0xaed2('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xaed2('0xe'));var jsforce=require(_0xaed2('0xf'));var deskjs=require(_0xaed2('0x10'));var toCsv=require(_0xaed2('0xb'));var querystring=require('querystring');var Papa=require(_0xaed2('0x11'));var Redis=require('ioredis');var authService=require(_0xaed2('0x12'));var qs=require(_0xaed2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaed2('0x14'))(_0xaed2('0x15'));var utils=require(_0xaed2('0x16'));var config=require(_0xaed2('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaed2('0x18'))['db'];function respondWithStatusCode(_0x295cb6,_0x310033){_0x310033=_0x310033||0xcc;return function(_0x12f6c9){if(_0x12f6c9){return _0x295cb6[_0xaed2('0x19')](_0x310033);}return _0x295cb6[_0xaed2('0x1a')](_0x310033)[_0xaed2('0x1b')]();};}function respondWithResult(_0x337344,_0x4d9c2a){_0x4d9c2a=_0x4d9c2a||0xc8;return function(_0x4e525e){if(_0x4e525e){return _0x337344[_0xaed2('0x1a')](_0x4d9c2a)['json'](_0x4e525e);}};}function respondWithFilteredResult(_0x14e57c,_0x5f099a){return function(_0x330c0e){if(_0x330c0e){var _0x101d63=typeof _0x5f099a[_0xaed2('0x1c')]===_0xaed2('0x1d')&&typeof _0x5f099a['limit']==='undefined';var _0x22a315=_0x330c0e[_0xaed2('0x1e')];var _0x135a0e=_0x101d63?0x0:_0x5f099a[_0xaed2('0x1c')];var _0x28b4b2=_0x101d63?_0x330c0e['count']:_0x5f099a[_0xaed2('0x1c')]+_0x5f099a['limit'];var _0x5cf7ba;if(_0x28b4b2>=_0x22a315){_0x28b4b2=_0x22a315;_0x5cf7ba=0xc8;}else{_0x5cf7ba=0xce;}_0x14e57c['status'](_0x5cf7ba);return _0x14e57c['set'](_0xaed2('0x1f'),_0x135a0e+'-'+_0x28b4b2+'/'+_0x22a315)['json'](_0x330c0e);}return null;};}function patchUpdates(_0x44309a){return function(_0x569dc){try{jsonpatch[_0xaed2('0x20')](_0x569dc,_0x44309a,!![]);}catch(_0x2547f9){return BPromise[_0xaed2('0x21')](_0x2547f9);}return _0x569dc['save']();};}function saveUpdates(_0x26db14,_0x5af0b0){return function(_0x159b90){if(_0x159b90){return _0x159b90[_0xaed2('0x22')](_0x26db14)[_0xaed2('0x23')](function(_0x24597e){return _0x24597e;});}return null;};}function removeEntity(_0x404321,_0x332ae6){return function(_0x423dda){if(_0x423dda){return _0x423dda['destroy']()[_0xaed2('0x23')](function(){_0x404321[_0xaed2('0x1a')](0xcc)[_0xaed2('0x1b')]();});}};}function handleEntityNotFound(_0x241252,_0x40a4be){return function(_0x3b805a){if(!_0x3b805a){_0x241252['sendStatus'](0x194);}return _0x3b805a;};}function handleError(_0x1b5e68,_0x36e5f3){_0x36e5f3=_0x36e5f3||0x1f4;return function(_0x1ba7f9){logger['error'](_0x1ba7f9[_0xaed2('0x24')]);if(_0x1ba7f9['name']){delete _0x1ba7f9['name'];}_0x1b5e68['status'](_0x36e5f3)[_0xaed2('0x25')](_0x1ba7f9);};}var utilLicense=require(_0xaed2('0x26'));exports[_0xaed2('0x27')]=function(_0x254a78,_0x13828a){var _0x3ef99a={'raw':!![],'where':{'id':0x1}},_0x238572={};_0x238572['model']=_[_0xaed2('0x28')](db[_0xaed2('0x29')][_0xaed2('0x2a')]);_0x238572[_0xaed2('0x2b')]=_[_0xaed2('0x28')](_0x254a78['query']);_0x238572[_0xaed2('0x2c')]=_[_0xaed2('0x2d')](_0x238572[_0xaed2('0x2e')],_0x238572['query']);_0x3ef99a['attributes']=_[_0xaed2('0x2d')](_0x238572['model'],qs[_0xaed2('0x2f')](_0x254a78[_0xaed2('0x2b')]['fields']));_0x3ef99a[_0xaed2('0x30')]=_0x3ef99a[_0xaed2('0x30')][_0xaed2('0x31')]?_0x3ef99a[_0xaed2('0x30')]:_0x238572[_0xaed2('0x2e')];_0x3ef99a=_[_0xaed2('0x32')]({},_0x3ef99a,_0x254a78[_0xaed2('0x33')]);return utilLicense[_0xaed2('0x34')](_0x3ef99a)[_0xaed2('0x23')](respondWithResult(_0x13828a,null))['catch'](handleError(_0x13828a,null));};exports['update']=function(_0x2bd4f2,_0x1124f8){if(_0x2bd4f2['body']['id']){delete _0x2bd4f2[_0xaed2('0x35')]['id'];}return db['License'][_0xaed2('0x36')]({'where':{'id':_0x2bd4f2[_0xaed2('0x37')]['id']}})[_0xaed2('0x23')](handleEntityNotFound(_0x1124f8,null))[_0xaed2('0x23')](function(_0x146f16){var _0x14414c=_0x146f16['get']({'plain':!![]});return utilLicense[_0xaed2('0x38')](_0x14414c,_0x2bd4f2[_0xaed2('0x35')][_0xaed2('0x39')]);})[_0xaed2('0x23')](function(_0x545099){if(!_0x545099['demo']){return saveUpdates(_0x2bd4f2[_0xaed2('0x35')],null);}return _0x545099;})[_0xaed2('0x23')](respondWithResult(_0x1124f8,null))[_0xaed2('0x3a')](handleError(_0x1124f8,null));};exports[_0xaed2('0x3b')]=function(_0x126e07,_0x4e17d9){var _0x3b82e5=_0xaed2('0x3c');var _0xdc8655=path[_0xaed2('0x3d')](_0xaed2('0x3e'),_0xaed2('0x3f'),_0xaed2('0x40'),_0x3b82e5);_0x4e17d9[_0xaed2('0x41')](_0xaed2('0x42'),_0xaed2('0x43')+_0x3b82e5);_0x4e17d9[_0xaed2('0x44')]('Content-Type','text/plain');_0x4e17d9[_0xaed2('0x45')](_0xdc8655);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 03d3d10..1faf487 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 _0xa4db=['lodash','util','api','moment','bluebird','request-promise','path','./license.attributes','exports','define','License','license'];(function(_0x3e2f39,_0x52276d){var _0x1f915c=function(_0x2bbf27){while(--_0x2bbf27){_0x3e2f39['push'](_0x3e2f39['shift']());}};_0x1f915c(++_0x52276d);}(_0xa4db,0x144));var _0xba4d=function(_0x14bd92,_0x19d392){_0x14bd92=_0x14bd92-0x0;var _0xea44cc=_0xa4db[_0x14bd92];return _0xea44cc;};'use strict';var _=require(_0xba4d('0x0'));var util=require(_0xba4d('0x1'));var logger=require('../../config/logger')(_0xba4d('0x2'));var moment=require(_0xba4d('0x3'));var BPromise=require(_0xba4d('0x4'));var rp=require(_0xba4d('0x5'));var fs=require('fs');var path=require(_0xba4d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba4d('0x7'));module[_0xba4d('0x8')]=function(_0x4a699a,_0x58bef8){return _0x4a699a[_0xba4d('0x9')](_0xba4d('0xa'),attributes,{'tableName':_0xba4d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f23=['path','../../config/environment','./license.attributes','exports','license','lodash','util','moment','bluebird','request-promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7f23,0x131));var _0x37f2=function(_0x4dc32f,_0x32437a){_0x4dc32f=_0x4dc32f-0x0;var _0x23bf25=_0x7f23[_0x4dc32f];return _0x23bf25;};'use strict';var _=require(_0x37f2('0x0'));var util=require(_0x37f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x37f2('0x2'));var BPromise=require(_0x37f2('0x3'));var rp=require(_0x37f2('0x4'));var fs=require('fs');var path=require(_0x37f2('0x5'));var rimraf=require('rimraf');var config=require(_0x37f2('0x6'));var attributes=require(_0x37f2('0x7'));module[_0x37f2('0x8')]=function(_0x2f7bf,_0xdac558){return _0x2f7bf['define']('License',attributes,{'tableName':_0x37f2('0x9'),'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 23eec8e..1e9e571 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 _0x0645=['request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','License,\x20%s,\x20%s'];(function(_0x4d515d,_0x108c96){var _0x58fe07=function(_0x2e18bf){while(--_0x2e18bf){_0x4d515d['push'](_0x4d515d['shift']());}};_0x58fe07(++_0x108c96);}(_0x0645,0x110));var _0x5064=function(_0x40be20,_0x37422f){_0x40be20=_0x40be20-0x0;var _0x27be68=_0x0645[_0x40be20];return _0x27be68;};'use strict';var _=require('lodash');var util=require(_0x5064('0x0'));var moment=require(_0x5064('0x1'));var BPromise=require(_0x5064('0x2'));var rs=require(_0x5064('0x3'));var fs=require('fs');var Redis=require(_0x5064('0x4'));var db=require(_0x5064('0x5'))['db'];var utils=require(_0x5064('0x6'));var logger=require(_0x5064('0x7'))(_0x5064('0x8'));var config=require(_0x5064('0x9'));var jayson=require(_0x5064('0xa'));var client=jayson[_0x5064('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2398b0,_0x56036b,_0x33e7e1){return new BPromise(function(_0x3fac8d,_0x1f8bf5){return client[_0x5064('0xc')](_0x2398b0,_0x33e7e1)[_0x5064('0xd')](function(_0x4960bc){logger[_0x5064('0xe')](_0x5064('0xf'),_0x56036b,_0x5064('0x10'));logger[_0x5064('0x11')](_0x5064('0x12'),_0x56036b,_0x5064('0x10'),JSON['stringify'](_0x4960bc));if(_0x4960bc['error']){if(_0x4960bc[_0x5064('0x13')][_0x5064('0x14')]===0x1f4){logger[_0x5064('0x13')](_0x5064('0xf'),_0x56036b,_0x4960bc[_0x5064('0x13')][_0x5064('0x15')]);return _0x1f8bf5(_0x4960bc[_0x5064('0x13')]['message']);}logger[_0x5064('0x13')](_0x5064('0xf'),_0x56036b,_0x4960bc['error'][_0x5064('0x15')]);return _0x3fac8d(_0x4960bc[_0x5064('0x13')]['message']);}else{logger['info']('License,\x20%s,\x20%s',_0x56036b,_0x5064('0x10'));_0x3fac8d(_0x4960bc[_0x5064('0x16')]['message']);}})[_0x5064('0x17')](function(_0x4ce282){logger['error'](_0x5064('0xf'),_0x56036b,_0x4ce282);_0x1f8bf5(_0x4ce282);});});} \ No newline at end of file +var _0xd822=['result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x53b76e,_0x209fe3){var _0x311645=function(_0x314846){while(--_0x314846){_0x53b76e['push'](_0x53b76e['shift']());}};_0x311645(++_0x209fe3);}(_0xd822,0xd1));var _0x2d82=function(_0x5b0c60,_0x10f29b){_0x5b0c60=_0x5b0c60-0x0;var _0x5683a6=_0xd822[_0x5b0c60];return _0x5683a6;};'use strict';var _=require(_0x2d82('0x0'));var util=require(_0x2d82('0x1'));var moment=require('moment');var BPromise=require(_0x2d82('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d82('0x3'));var db=require(_0x2d82('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2d82('0x5'))(_0x2d82('0x6'));var config=require(_0x2d82('0x7'));var jayson=require(_0x2d82('0x8'));var client=jayson[_0x2d82('0x9')][_0x2d82('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b6a79,_0x179091,_0x1432b8){return new BPromise(function(_0x38b37b,_0x210ef6){return client['request'](_0x1b6a79,_0x1432b8)[_0x2d82('0xb')](function(_0x329171){logger[_0x2d82('0xc')](_0x2d82('0xd'),_0x179091,'request\x20sent');logger[_0x2d82('0xe')](_0x2d82('0xf'),_0x179091,_0x2d82('0x10'),JSON[_0x2d82('0x11')](_0x329171));if(_0x329171[_0x2d82('0x12')]){if(_0x329171[_0x2d82('0x12')][_0x2d82('0x13')]===0x1f4){logger[_0x2d82('0x12')](_0x2d82('0xd'),_0x179091,_0x329171[_0x2d82('0x12')]['message']);return _0x210ef6(_0x329171['error'][_0x2d82('0x14')]);}logger['error'](_0x2d82('0xd'),_0x179091,_0x329171[_0x2d82('0x12')][_0x2d82('0x14')]);return _0x38b37b(_0x329171[_0x2d82('0x12')]['message']);}else{logger[_0x2d82('0xc')](_0x2d82('0xd'),_0x179091,_0x2d82('0x10'));_0x38b37b(_0x329171[_0x2d82('0x15')]['message']);}})[_0x2d82('0x16')](function(_0x367e0a){logger[_0x2d82('0x12')]('License,\x20%s,\x20%s',_0x179091,_0x367e0a);_0x210ef6(_0x367e0a);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 150fad9..63731ea 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 _0x5876=['destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','getSmtp','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','put','update','delete','removeDispositions','removeAnswers','removeImap'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5876,0x18b));var _0x6587=function(_0x2dd628,_0x3c22e4){_0x2dd628=_0x2dd628-0x0;var _0x2e138c=_0x5876[_0x2dd628];return _0x2e138c;};'use strict';var multer=require(_0x6587('0x0'));var util=require(_0x6587('0x1'));var path=require(_0x6587('0x2'));var timeout=require(_0x6587('0x3'));var express=require(_0x6587('0x4'));var router=express[_0x6587('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6587('0x6'));var config=require(_0x6587('0x7'));var controller=require(_0x6587('0x8'));router[_0x6587('0x9')]('/',auth[_0x6587('0xa')](),controller[_0x6587('0xb')]);router[_0x6587('0x9')](_0x6587('0xc'),auth[_0x6587('0xa')](),controller[_0x6587('0xd')]);router[_0x6587('0x9')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0xf')]);router['get'](_0x6587('0x10'),auth[_0x6587('0xa')](),controller[_0x6587('0x11')]);router[_0x6587('0x9')](_0x6587('0x12'),auth[_0x6587('0xa')](),controller[_0x6587('0x13')]);router['get'](_0x6587('0x14'),auth[_0x6587('0xa')](),controller[_0x6587('0x15')]);router[_0x6587('0x9')]('/:id/out_servers',auth[_0x6587('0xa')](),controller[_0x6587('0x16')]);router[_0x6587('0x9')]('/:id/interactions',auth[_0x6587('0xa')](),controller[_0x6587('0x17')]);router[_0x6587('0x9')](_0x6587('0x18'),auth[_0x6587('0xa')](),controller['getApplications']);router['get'](_0x6587('0x19'),auth[_0x6587('0xa')](),controller[_0x6587('0x1a')]);router[_0x6587('0x9')](_0x6587('0x1b'),auth[_0x6587('0xa')](),controller[_0x6587('0x1c')]);router[_0x6587('0x9')](_0x6587('0x1d'),auth[_0x6587('0xa')](),controller[_0x6587('0x1e')]);router[_0x6587('0x1f')]('/:id/dispositions',auth[_0x6587('0xa')](),controller[_0x6587('0x20')]);router[_0x6587('0x1f')](_0x6587('0x12'),auth[_0x6587('0xa')](),controller[_0x6587('0x21')]);router['post']('/',auth[_0x6587('0xa')](),controller['create']);router['post']('/:id/in_servers',auth[_0x6587('0xa')](),controller[_0x6587('0x22')]);router[_0x6587('0x1f')](_0x6587('0x23'),auth['isAuthenticated'](),controller[_0x6587('0x24')]);router[_0x6587('0x1f')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x6587('0x25')]);router[_0x6587('0x1f')](_0x6587('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x6587('0x1f')](_0x6587('0x26'),auth[_0x6587('0xa')](),controller[_0x6587('0x27')]);router['post']('/:id/users',auth[_0x6587('0xa')](),controller['addAgents']);router[_0x6587('0x28')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0x29')]);router[_0x6587('0x2a')](_0x6587('0x10'),auth[_0x6587('0xa')](),controller[_0x6587('0x2b')]);router['delete'](_0x6587('0x12'),auth[_0x6587('0xa')](),controller[_0x6587('0x2c')]);router[_0x6587('0x2a')]('/:id/in_servers',auth[_0x6587('0xa')](),controller[_0x6587('0x2d')]);router[_0x6587('0x2a')](_0x6587('0x23'),auth[_0x6587('0xa')](),controller['removeSmtp']);router[_0x6587('0x2a')](_0x6587('0xe'),auth[_0x6587('0xa')](),controller[_0x6587('0x2e')]);router[_0x6587('0x2a')](_0x6587('0x1d'),auth[_0x6587('0xa')](),controller[_0x6587('0x2f')]);module[_0x6587('0x30')]=router; \ No newline at end of file +var _0x3716=['addAgents','put','update','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','index','get','/describe','isAuthenticated','/:id','show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','addImap','/:id/out_servers','addInteraction','addApplications','/:id/send','send'];(function(_0x296c75,_0x2909e8){var _0x131aa5=function(_0x11be3f){while(--_0x11be3f){_0x296c75['push'](_0x296c75['shift']());}};_0x131aa5(++_0x2909e8);}(_0x3716,0xc6));var _0x6371=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x3716[_0x279d37];return _0x530173;};'use strict';var multer=require(_0x6371('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6371('0x1'));var express=require(_0x6371('0x2'));var router=express[_0x6371('0x3')]();var fs_extra=require(_0x6371('0x4'));var auth=require(_0x6371('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6371('0x6'));var controller=require(_0x6371('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x6371('0x8')]);router[_0x6371('0x9')](_0x6371('0xa'),auth[_0x6371('0xb')](),controller['describe']);router[_0x6371('0x9')](_0x6371('0xc'),auth[_0x6371('0xb')](),controller[_0x6371('0xd')]);router[_0x6371('0x9')](_0x6371('0xe'),auth[_0x6371('0xb')](),controller['getDispositions']);router['get'](_0x6371('0xf'),auth[_0x6371('0xb')](),controller[_0x6371('0x10')]);router[_0x6371('0x9')](_0x6371('0x11'),auth['isAuthenticated'](),controller[_0x6371('0x12')]);router[_0x6371('0x9')]('/:id/out_servers',auth['isAuthenticated'](),controller['getSmtp']);router[_0x6371('0x9')](_0x6371('0x13'),auth[_0x6371('0xb')](),controller[_0x6371('0x14')]);router[_0x6371('0x9')](_0x6371('0x15'),auth[_0x6371('0xb')](),controller['getApplications']);router[_0x6371('0x9')](_0x6371('0x16'),auth[_0x6371('0xb')](),controller[_0x6371('0x17')]);router[_0x6371('0x9')](_0x6371('0x18'),auth['isAuthenticated'](),controller[_0x6371('0x19')]);router[_0x6371('0x9')](_0x6371('0x1a'),auth['isAuthenticated'](),controller[_0x6371('0x1b')]);router[_0x6371('0x1c')](_0x6371('0xe'),auth['isAuthenticated'](),controller[_0x6371('0x1d')]);router[_0x6371('0x1c')]('/:id/canned_answers',auth[_0x6371('0xb')](),controller[_0x6371('0x1e')]);router[_0x6371('0x1c')]('/',auth[_0x6371('0xb')](),controller['create']);router[_0x6371('0x1c')](_0x6371('0x11'),auth[_0x6371('0xb')](),controller[_0x6371('0x1f')]);router[_0x6371('0x1c')](_0x6371('0x20'),auth[_0x6371('0xb')](),controller['addSmtp']);router[_0x6371('0x1c')](_0x6371('0x13'),auth[_0x6371('0xb')](),controller[_0x6371('0x21')]);router['post'](_0x6371('0x15'),auth['isAuthenticated'](),controller[_0x6371('0x22')]);router[_0x6371('0x1c')](_0x6371('0x23'),auth['isAuthenticated'](),controller[_0x6371('0x24')]);router[_0x6371('0x1c')](_0x6371('0x1a'),auth['isAuthenticated'](),controller[_0x6371('0x25')]);router[_0x6371('0x26')]('/:id',auth[_0x6371('0xb')](),controller[_0x6371('0x27')]);router[_0x6371('0x28')]('/:id/dispositions',auth[_0x6371('0xb')](),controller['removeDispositions']);router[_0x6371('0x28')]('/:id/canned_answers',auth[_0x6371('0xb')](),controller[_0x6371('0x29')]);router[_0x6371('0x28')](_0x6371('0x11'),auth['isAuthenticated'](),controller[_0x6371('0x2a')]);router[_0x6371('0x28')](_0x6371('0x20'),auth['isAuthenticated'](),controller[_0x6371('0x2b')]);router['delete']('/:id',auth[_0x6371('0xb')](),controller[_0x6371('0x2c')]);router[_0x6371('0x28')](_0x6371('0x1a'),auth[_0x6371('0xb')](),controller[_0x6371('0x2d')]);module[_0x6371('0x2e')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 1974ee7..a43e232 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 _0xee69=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','hotmail','outlook365','getDataValue','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x55e631,_0x4e9bdb){var _0x1a0670=function(_0x3b53b1){while(--_0x3b53b1){_0x55e631['push'](_0x55e631['shift']());}};_0x1a0670(++_0x4e9bdb);}(_0xee69,0x171));var _0x9ee6=function(_0x15fcac,_0x3391f2){_0x15fcac=_0x15fcac-0x0;var _0x34ab36=_0xee69[_0x15fcac];return _0x34ab36;};'use strict';var Sequelize=require(_0x9ee6('0x0'));module[_0x9ee6('0x1')]={'description':{'type':Sequelize[_0x9ee6('0x2')]},'name':{'type':Sequelize[_0x9ee6('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x9ee6('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x9ee6('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x9ee6('0x4')]},'markAsUnread':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x9ee6('0x2')],'allowNull':![],'defaultValue':_0x9ee6('0x5')},'fontSize':{'type':Sequelize[_0x9ee6('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x9ee6('0x4')],'defaultValue':function(){return _0x9ee6('0x7');}},'notificationSound':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9ee6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9ee6('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9ee6('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x9ee6('0x8')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x1cf9ee){if(!_0x1cf9ee)this[_0x9ee6('0x9')](_0x9ee6('0xa'),null);this[_0x9ee6('0x9')](_0x9ee6('0xb'),_0x1cf9ee);}},'provider':{'type':Sequelize['ENUM'](_0x9ee6('0xc'),_0x9ee6('0xd'),'yahoo',_0x9ee6('0xe')),'defaultValue':null,'get':function(){var _0x4e92ec=this[_0x9ee6('0xf')](_0x9ee6('0x10'));return _0x4e92ec||'custom';},'set':function(_0x53e7e3){if(_0x53e7e3===_0x9ee6('0x11')){_0x53e7e3=null;}return this['setDataValue'](_0x9ee6('0x10'),_0x53e7e3);}}}; \ No newline at end of file +var _0x771b=['provider','custom','sequelize','exports','BOOLEAN','STRING','TEXT','Arial,Helvetica,sans-serif','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','gmail','yahoo','outlook365','getDataValue'];(function(_0x4510dc,_0x5431ac){var _0x319934=function(_0x57fcb1){while(--_0x57fcb1){_0x4510dc['push'](_0x4510dc['shift']());}};_0x319934(++_0x5431ac);}(_0x771b,0x1ab));var _0xb771=function(_0x3b5e9d,_0x5970dc){_0x3b5e9d=_0x3b5e9d-0x0;var _0x44681d=_0x771b[_0x3b5e9d];return _0x44681d;};'use strict';var Sequelize=require(_0xb771('0x0'));module[_0xb771('0x1')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xb771('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xb771('0x3')],'allowNull':![]},'template':{'type':Sequelize[_0xb771('0x4')]},'markAsUnread':{'type':Sequelize[_0xb771('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xb771('0x3')],'allowNull':![],'defaultValue':_0xb771('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xb771('0x4')],'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[_0xb771('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb771('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb771('0x6')],'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[_0xb771('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb771('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb771('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x693a37){if(!_0x693a37)this[_0xb771('0x8')](_0xb771('0x9'),null);this['setDataValue'](_0xb771('0xa'),_0x693a37);}},'provider':{'type':Sequelize['ENUM'](_0xb771('0xb'),'hotmail',_0xb771('0xc'),_0xb771('0xd')),'defaultValue':null,'get':function(){var _0x25b7a1=this[_0xb771('0xe')](_0xb771('0xf'));return _0x25b7a1||_0xb771('0x10');},'set':function(_0x1656ea){if(_0x1656ea===_0xb771('0x10')){_0x1656ea=null;}return this[_0xb771('0x8')](_0xb771('0xf'),_0x1656ea);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index c0d5214..76ee461 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 _0x6010=['Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','outlook365','user','username','password','pass','modernAuthentication','CloudProviderId','port','secure','service','authentication','host','Imap','Smtp','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','name','keys','filters','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','options','MailAccount','include','show','params','find','catch','body','provider','custom','MailServerIn','MailServerOut','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','create','getDispositions','pick','MailAccountId','filter','includeAll','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','getImap','getSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List','List\x20not\x20found','ListId','attach','out','messageId','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','bluebird','util','path','lodash','juice','ioredis','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','destroy','get','MailAccounts','UserProfileResource','stack','send','gmail','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com'];(function(_0x4c725c,_0x3921b8){var _0x43c07d=function(_0x47165a){while(--_0x47165a){_0x4c725c['push'](_0x4c725c['shift']());}};_0x43c07d(++_0x3921b8);}(_0x6010,0x91));var _0x0601=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x6010[_0x264b9b];return _0x4c7a0e;};'use strict';var moment=require('moment');var BPromise=require(_0x0601('0x0'));var util=require(_0x0601('0x1'));var path=require(_0x0601('0x2'));var _=require(_0x0601('0x3'));var juice=require(_0x0601('0x4'));var Redis=require(_0x0601('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0x0601('0x6'))('api');var config=require(_0x0601('0x7'));var db=require(_0x0601('0x8'))['db'];config['redis']=_[_0x0601('0x9')](config[_0x0601('0xa')],{'host':_0x0601('0xb'),'port':0x18eb});var socket=require(_0x0601('0xc'))(new Redis(config[_0x0601('0xa')]));require(_0x0601('0xd'))[_0x0601('0xe')](socket);var jayson=require(_0x0601('0xf'));var client=jayson['client'][_0x0601('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x25701e,_0x90d24c,_0x1c81b5,_0xcaa3de){return new BPromise(function(_0x4f09ae,_0x13cc0b){var _0x6c177d=_0xcaa3de||client;return _0x6c177d[_0x0601('0x11')](_0x25701e,_0x1c81b5)[_0x0601('0x12')](function(_0x51b2d7){logger['info']('MailAccount,\x20%s,\x20%s',_0x90d24c,'request\x20sent');logger[_0x0601('0x13')](_0x0601('0x14'),_0x90d24c,'request\x20sent',JSON[_0x0601('0x15')](_0x51b2d7));if(_0x51b2d7[_0x0601('0x16')]){if(_0x51b2d7[_0x0601('0x16')][_0x0601('0x17')]===0x1f4){logger['error'](_0x0601('0x18'),_0x90d24c,_0x51b2d7['error'][_0x0601('0x19')]);return _0x13cc0b(_0x51b2d7[_0x0601('0x16')][_0x0601('0x19')]);}logger['error'](_0x0601('0x18'),_0x90d24c,_0x51b2d7[_0x0601('0x16')][_0x0601('0x19')]);return _0x4f09ae(_0x51b2d7['error'][_0x0601('0x19')]);}else{logger['info'](_0x0601('0x18'),_0x90d24c,'request\x20sent');_0x4f09ae(_0x51b2d7[_0x0601('0x1a')][_0x0601('0x19')]);}})['catch'](function(_0x4757c7){logger[_0x0601('0x16')](_0x0601('0x18'),_0x90d24c,_0x4757c7);_0x13cc0b(_0x4757c7);});});}function respondWithStatusCode(_0x10882f,_0xe2840e){_0xe2840e=_0xe2840e||0xcc;return function(_0x111439){if(_0x111439){return _0x10882f[_0x0601('0x1b')](_0xe2840e);}return _0x10882f[_0x0601('0x1c')](_0xe2840e)[_0x0601('0x1d')]();};}function respondWithResult(_0x51efdd,_0x324b42){_0x324b42=_0x324b42||0xc8;return function(_0x2cf7a4){if(_0x2cf7a4){return _0x51efdd[_0x0601('0x1c')](_0x324b42)[_0x0601('0x1e')](_0x2cf7a4);}};}function respondWithFilteredResult(_0x36743f,_0x1250f4){return function(_0x242ab1){if(_0x242ab1){var _0x27e35e=typeof _0x1250f4[_0x0601('0x1f')]===_0x0601('0x20')&&typeof _0x1250f4[_0x0601('0x21')]===_0x0601('0x20');var _0x3556a2=_0x242ab1[_0x0601('0x22')];var _0x75d72d=_0x27e35e?0x0:_0x1250f4[_0x0601('0x1f')];var _0x11d403=_0x27e35e?_0x242ab1[_0x0601('0x22')]:_0x1250f4[_0x0601('0x1f')]+_0x1250f4['limit'];var _0x412696;if(_0x11d403>=_0x3556a2){_0x11d403=_0x3556a2;_0x412696=0xc8;}else{_0x412696=0xce;}_0x36743f[_0x0601('0x1c')](_0x412696);return _0x36743f['set'](_0x0601('0x23'),_0x75d72d+'-'+_0x11d403+'/'+_0x3556a2)[_0x0601('0x1e')](_0x242ab1);}return null;};}function saveUpdates(_0x4c76b3){return function(_0x51a459){if(_0x51a459){return _0x51a459[_0x0601('0x24')](_0x4c76b3)[_0x0601('0x12')](function(_0x5a244e){return _0x5a244e;});}return null;};}function removeEntity(_0x27363c){return function(_0x3afbab){if(_0x3afbab){return _0x3afbab[_0x0601('0x25')]()[_0x0601('0x12')](function(){var _0xd9377f=_0x3afbab[_0x0601('0x26')]({'plain':!![]});var _0x596d86=_0x0601('0x27');return db[_0x0601('0x28')][_0x0601('0x25')]({'where':{'type':_0x596d86,'resourceId':_0xd9377f['id']}})[_0x0601('0x12')](function(){return _0x3afbab;});})['then'](function(){_0x27363c[_0x0601('0x1c')](0xcc)[_0x0601('0x1d')]();});}};}function handleEntityNotFound(_0x48b6bb){return function(_0x454965){if(!_0x454965){_0x48b6bb[_0x0601('0x1b')](0x194);}return _0x454965;};}function handleError(_0x12e0bb,_0x52a820){_0x52a820=_0x52a820||0x1f4;return function(_0x4cc284){logger[_0x0601('0x16')](_0x4cc284[_0x0601('0x29')]);if(_0x4cc284['name']){delete _0x4cc284['name'];}_0x12e0bb[_0x0601('0x1c')](_0x52a820)[_0x0601('0x2a')](_0x4cc284);};}function getImapHost(_0x452f54){switch(_0x452f54){case _0x0601('0x2b'):return'imap.gmail.com';case _0x0601('0x2c'):return _0x0601('0x2d');case _0x0601('0x2e'):return _0x0601('0x2f');case'outlook365':return _0x0601('0x30');}throw new Error(_0x0601('0x31'),_0x452f54);}function getSmtpHost(_0x4d2c38){switch(_0x4d2c38){case _0x0601('0x2b'):return _0x0601('0x32');case'yahoo':return _0x0601('0x33');case _0x0601('0x2e'):return _0x0601('0x34');case _0x0601('0x35'):return'smtp.office365.com';}throw new Error('Unknown\x20email\x20service\x20provider',_0x4d2c38);}function getAuthenticationOptions(_0x3704b3,_0xe06892){var _0x1c72a4={};var _0x375d02={};if(_0x3704b3){_0x1c72a4[_0x0601('0x36')]=_0x375d02[_0x0601('0x36')]=_0xe06892[_0x0601('0x37')];_0x1c72a4[_0x0601('0x38')]=_0x375d02[_0x0601('0x39')]=_0xe06892[_0x0601('0x38')];if(_0xe06892[_0x0601('0x3a')]){_0x1c72a4[_0x0601('0x3a')]=_0x375d02['modernAuthentication']=!![];_0x1c72a4['CloudProviderId']=_0x375d02[_0x0601('0x3b')]=_0xe06892[_0x0601('0x3b')];_0x1c72a4[_0x0601('0x38')]=_0x375d02[_0x0601('0x39')]=null;}else{_0x1c72a4['CloudProviderId']=_0x375d02['CloudProviderId']=null;}_0x1c72a4['host']=getImapHost(_0x3704b3);_0x1c72a4['port']=0x3e1;_0x375d02['host']=getSmtpHost(_0x3704b3);_0x375d02[_0x0601('0x3c')]=0x24b;_0x375d02[_0x0601('0x3d')]=![];_0x1c72a4[_0x0601('0x3e')]=_0x375d02['service']=null;}else{if(_0xe06892[_0x0601('0x3f')]){_0x1c72a4[_0x0601('0x36')]=_0x375d02[_0x0601('0x36')]=_0xe06892['username'];_0x1c72a4['password']=_0x375d02[_0x0601('0x39')]=_0xe06892[_0x0601('0x38')];}else{_0x1c72a4[_0x0601('0x3f')]=_0x375d02['authentication']=![];_0x1c72a4[_0x0601('0x36')]=_0x375d02[_0x0601('0x36')]=null;_0x1c72a4[_0x0601('0x38')]=_0x375d02[_0x0601('0x39')]=null;}_0x1c72a4[_0x0601('0x40')]=_0xe06892[_0x0601('0x41')][_0x0601('0x40')];_0x1c72a4['port']=_0xe06892[_0x0601('0x41')]['port'];_0x375d02[_0x0601('0x40')]=_0xe06892[_0x0601('0x42')][_0x0601('0x40')];_0x375d02[_0x0601('0x3c')]=_0xe06892[_0x0601('0x42')][_0x0601('0x3c')];}return{'Imap':_0x1c72a4,'Smtp':_0x375d02};}exports[_0x0601('0x43')]=function(_0x385098,_0x181840){var _0x3d9571={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x0601('0x42')},{'model':db[_0x0601('0x44')],'as':_0x0601('0x45')}]},_0x1fc4bb={},_0x266951={'count':0x0,'rows':[]};var _0x200751=_[_0x0601('0x46')](db['MailAccount'][_0x0601('0x47')],function(_0x5d2ac9){return{'name':_0x5d2ac9['fieldName'],'type':_0x5d2ac9[_0x0601('0x48')][_0x0601('0x49')]};});_0x1fc4bb['model']=_['map'](_0x200751,_0x0601('0x4a'));_0x1fc4bb['query']=_[_0x0601('0x4b')](_0x385098['query']);_0x1fc4bb[_0x0601('0x4c')]=_['intersection'](_0x1fc4bb[_0x0601('0x4d')],_0x1fc4bb[_0x0601('0x4e')]);_0x3d9571[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x1fc4bb[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x385098[_0x0601('0x4e')][_0x0601('0x51')]));_0x3d9571[_0x0601('0x4f')]=_0x3d9571[_0x0601('0x4f')][_0x0601('0x52')]?_0x3d9571['attributes']:_0x1fc4bb[_0x0601('0x4d')];if(!_0x385098['query'][_0x0601('0x53')](_0x0601('0x54'))){_0x3d9571[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x385098['query'][_0x0601('0x21')]);_0x3d9571[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x385098[_0x0601('0x4e')][_0x0601('0x1f')]);}_0x3d9571[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x385098['query'][_0x0601('0x56')]);_0x3d9571[_0x0601('0x57')]=qs[_0x0601('0x4c')](_['pick'](_0x385098[_0x0601('0x4e')],_0x1fc4bb[_0x0601('0x4c')]),_0x200751);if(_0x385098[_0x0601('0x4e')]['filter']){_0x3d9571[_0x0601('0x57')]=_[_0x0601('0x58')](_0x3d9571[_0x0601('0x57')],{'$or':_['map'](_0x200751,function(_0x6fd607){if(_0x6fd607[_0x0601('0x48')]!=='VIRTUAL'){var _0x4e0ba0={};_0x4e0ba0[_0x6fd607[_0x0601('0x4a')]]={'$like':'%'+_0x385098[_0x0601('0x4e')]['filter']+'%'};return _0x4e0ba0;}})});}_0x3d9571=_[_0x0601('0x58')]({},_0x3d9571,_0x385098[_0x0601('0x59')]);var _0x41403b={'where':_0x3d9571['where']};return db[_0x0601('0x5a')][_0x0601('0x22')](_0x41403b)[_0x0601('0x12')](function(_0x3feda9){_0x266951[_0x0601('0x22')]=_0x3feda9;if(_0x385098[_0x0601('0x4e')]['includeAll']){_0x3d9571[_0x0601('0x5b')]=[{'all':!![]}];}return db[_0x0601('0x5a')]['findAll'](_0x3d9571);})[_0x0601('0x12')](function(_0x41bc9b){_0x266951['rows']=_0x41bc9b;return _0x266951;})[_0x0601('0x12')](respondWithFilteredResult(_0x181840,_0x3d9571))['catch'](handleError(_0x181840,null));};exports[_0x0601('0x5c')]=function(_0x231226,_0x2bb1e7){var _0x379d9f={'raw':![],'where':{'id':_0x231226[_0x0601('0x5d')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x0601('0x41')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db['Pause'],'as':_0x0601('0x45')}]},_0x4cbba1={};_0x4cbba1[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x5a')][_0x0601('0x47')]);_0x4cbba1[_0x0601('0x4e')]=_['keys'](_0x231226[_0x0601('0x4e')]);_0x4cbba1[_0x0601('0x4c')]=_['intersection'](_0x4cbba1[_0x0601('0x4d')],_0x4cbba1[_0x0601('0x4e')]);_0x379d9f['attributes']=_['intersection'](_0x4cbba1[_0x0601('0x4d')],qs['fields'](_0x231226['query'][_0x0601('0x51')]));_0x379d9f['attributes']=_0x379d9f['attributes'][_0x0601('0x52')]?_0x379d9f[_0x0601('0x4f')]:_0x4cbba1[_0x0601('0x4d')];if(_0x231226['query']['includeAll']){_0x379d9f[_0x0601('0x5b')]=[{'all':!![]}];}_0x379d9f=_['merge']({},_0x379d9f,_0x231226[_0x0601('0x59')]);return db[_0x0601('0x5a')][_0x0601('0x5e')](_0x379d9f)[_0x0601('0x12')](handleEntityNotFound(_0x2bb1e7,null))[_0x0601('0x12')](respondWithResult(_0x2bb1e7,null))[_0x0601('0x5f')](handleError(_0x2bb1e7,null));};exports[_0x0601('0x24')]=function(_0x20e402,_0x4425e4){if(_0x20e402[_0x0601('0x60')]['id']){delete _0x20e402['body']['id'];}var _0x51bd7b=_0x20e402[_0x0601('0x60')][_0x0601('0x61')]===_0x0601('0x62')?null:_0x20e402['body'][_0x0601('0x61')];var _0x1e430d=_0x20e402[_0x0601('0x60')][_0x0601('0x41')]||{};var _0x620bb1=_0x20e402[_0x0601('0x60')][_0x0601('0x42')]||{};if(_0x51bd7b){_0x1e430d[_0x0601('0x40')]=getImapHost(_0x51bd7b);_0x1e430d[_0x0601('0x3c')]=0x3e1;_0x620bb1[_0x0601('0x40')]=getSmtpHost(_0x51bd7b);_0x620bb1[_0x0601('0x3c')]=0x24b;_0x620bb1[_0x0601('0x3d')]=![];}if(_0x620bb1[_0x0601('0x3a')]){_0x620bb1[_0x0601('0x3d')]=![];}else{_0x620bb1['CloudProviderId']=null;}if(!_0x1e430d[_0x0601('0x3a')])_0x1e430d[_0x0601('0x3b')]=null;_0x20e402[_0x0601('0x60')][_0x0601('0x41')]=_0x1e430d;_0x20e402[_0x0601('0x60')][_0x0601('0x42')]=_0x620bb1;return db['MailAccount'][_0x0601('0x5e')]({'where':{'id':_0x20e402[_0x0601('0x5d')]['id']},'include':[{'model':db[_0x0601('0x63')],'as':_0x0601('0x41')},{'model':db[_0x0601('0x64')],'as':'Smtp'},{'model':db[_0x0601('0x44')],'as':_0x0601('0x45')}]})[_0x0601('0x12')](handleEntityNotFound(_0x4425e4,null))[_0x0601('0x12')](function(_0x12c559){if(!_0x12c559)throw new Error(_0x0601('0x65'));if(_0x12c559['service'])delete _0x20e402[_0x0601('0x60')][_0x0601('0x41')];return _0x12c559;})[_0x0601('0x12')](saveUpdates(_0x20e402[_0x0601('0x60')],null))[_0x0601('0x12')](function(_0x3d5760){if(!_0x20e402[_0x0601('0x60')][_0x0601('0x41')])return _0x3d5760;return db[_0x0601('0x63')]['update'](_0x20e402['body'][_0x0601('0x41')],{'where':{'MailAccountId':_0x3d5760['id']}})['then'](function(){return _0x3d5760;});})['then'](function(_0x447c7e){if(!_0x20e402[_0x0601('0x60')][_0x0601('0x42')])return _0x447c7e;return db[_0x0601('0x64')][_0x0601('0x24')](_0x20e402[_0x0601('0x60')][_0x0601('0x42')],{'where':{'MailAccountId':_0x447c7e['id']}})[_0x0601('0x12')](function(){return _0x447c7e;});})['then'](respondWithResult(_0x4425e4,null))[_0x0601('0x5f')](handleError(_0x4425e4,null));};exports[_0x0601('0x66')]=function(_0x58bea5,_0x4498c0){return db[_0x0601('0x5a')][_0x0601('0x66')]()[_0x0601('0x12')](respondWithResult(_0x4498c0,null))['catch'](handleError(_0x4498c0,null));};exports[_0x0601('0x67')]=function(_0x1a2349,_0x244aea){if(_0x1a2349[_0x0601('0x60')]['id']){delete _0x1a2349['body']['id'];}return db['MailAccount'][_0x0601('0x5e')]({'where':{'id':_0x1a2349[_0x0601('0x5d')]['id']}})['then'](handleEntityNotFound(_0x244aea,null))[_0x0601('0x12')](function(_0x1b3d7d){if(_0x1b3d7d){_0x1a2349[_0x0601('0x60')]['MailAccountId']=_0x1b3d7d['id'];return db[_0x0601('0x68')][_0x0601('0x69')](_0x1a2349['body']);}})[_0x0601('0x12')](respondWithResult(_0x244aea,null))[_0x0601('0x5f')](handleError(_0x244aea,null));};exports[_0x0601('0x6a')]=function(_0x82586c,_0x2c77bc){var _0x41ac47={'raw':![],'where':{}};var _0x49f30b={};var _0x1ce44a={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x82586c['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x2c77bc,null))[_0x0601('0x12')](function(_0x526dc1){if(_0x526dc1){_0x49f30b[_0x0601('0x4d')]=_[_0x0601('0x4b')](db['Disposition'][_0x0601('0x47')]);_0x49f30b[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x82586c[_0x0601('0x4e')]);_0x49f30b['filters']=_[_0x0601('0x50')](_0x49f30b['model'],_0x49f30b[_0x0601('0x4e')]);_0x41ac47['attributes']=_[_0x0601('0x50')](_0x49f30b[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x82586c[_0x0601('0x4e')][_0x0601('0x51')]));_0x41ac47[_0x0601('0x4f')]=_0x41ac47[_0x0601('0x4f')][_0x0601('0x52')]?_0x41ac47[_0x0601('0x4f')]:_0x49f30b[_0x0601('0x4d')];if(!_0x82586c['query']['hasOwnProperty']('nolimit')){_0x41ac47[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x82586c[_0x0601('0x4e')][_0x0601('0x21')]);_0x41ac47[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x82586c[_0x0601('0x4e')][_0x0601('0x1f')]);}_0x41ac47[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x82586c[_0x0601('0x4e')][_0x0601('0x56')]);_0x41ac47[_0x0601('0x57')]=qs['filters'](_[_0x0601('0x6b')](_0x82586c[_0x0601('0x4e')],_0x49f30b['filters']));_0x41ac47[_0x0601('0x57')][_0x0601('0x6c')]=_0x526dc1['id'];if(_0x82586c[_0x0601('0x4e')][_0x0601('0x6d')]){_0x41ac47[_0x0601('0x57')]=_[_0x0601('0x58')](_0x41ac47[_0x0601('0x57')],{'$or':_[_0x0601('0x46')](_0x41ac47[_0x0601('0x4f')],function(_0x4e2189){var _0x42bca0={};_0x42bca0[_0x4e2189]={'$like':'%'+_0x82586c[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x42bca0;})});}_0x41ac47=_['merge']({},_0x41ac47,_0x82586c[_0x0601('0x59')]);return db[_0x0601('0x68')]['count']({'where':_0x41ac47[_0x0601('0x57')]})[_0x0601('0x12')](function(_0x501ff8){_0x1ce44a[_0x0601('0x22')]=_0x501ff8;if(_0x82586c[_0x0601('0x4e')][_0x0601('0x6e')]){_0x41ac47[_0x0601('0x5b')]=[{'all':!![]}];}return db[_0x0601('0x68')][_0x0601('0x6f')](_0x41ac47);})[_0x0601('0x12')](function(_0x23b685){_0x1ce44a[_0x0601('0x70')]=_0x23b685;return _0x1ce44a;});}})[_0x0601('0x12')](respondWithFilteredResult(_0x2c77bc,_0x41ac47))[_0x0601('0x5f')](handleError(_0x2c77bc,null));};exports[_0x0601('0x71')]=function(_0x21a75a,_0x125304){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x21a75a[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x125304,null))[_0x0601('0x12')](function(_0x5efacb){if(_0x5efacb){return _0x5efacb['removeDispositions'](_0x21a75a[_0x0601('0x4e')][_0x0601('0x72')]);}})[_0x0601('0x12')](respondWithStatusCode(_0x125304,null))[_0x0601('0x5f')](handleError(_0x125304,null));};exports[_0x0601('0x73')]=function(_0x480779,_0x35eee8){if(_0x480779[_0x0601('0x60')]['id']){delete _0x480779[_0x0601('0x60')]['id'];}return db['MailAccount'][_0x0601('0x5e')]({'where':{'id':_0x480779[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x35eee8,null))[_0x0601('0x12')](function(_0x5c5d21){if(_0x5c5d21){_0x480779['body'][_0x0601('0x6c')]=_0x5c5d21['id'];return db[_0x0601('0x74')][_0x0601('0x69')](_0x480779['body']);}})[_0x0601('0x12')](respondWithResult(_0x35eee8,null))['catch'](handleError(_0x35eee8,null));};exports[_0x0601('0x75')]=function(_0x1baa4a,_0x4063c5){var _0x3e094b={'raw':![],'where':{}};var _0x58a73d={};var _0x9e834d={'count':0x0,'rows':[]};return db['MailAccount'][_0x0601('0x76')]({'where':{'id':_0x1baa4a['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x4063c5,null))[_0x0601('0x12')](function(_0xffdd79){if(_0xffdd79){_0x58a73d[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x74')][_0x0601('0x47')]);_0x58a73d[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x1baa4a['query']);_0x58a73d[_0x0601('0x4c')]=_[_0x0601('0x50')](_0x58a73d[_0x0601('0x4d')],_0x58a73d['query']);_0x3e094b[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x58a73d[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x1baa4a[_0x0601('0x4e')][_0x0601('0x51')]));_0x3e094b[_0x0601('0x4f')]=_0x3e094b[_0x0601('0x4f')][_0x0601('0x52')]?_0x3e094b[_0x0601('0x4f')]:_0x58a73d[_0x0601('0x4d')];if(!_0x1baa4a[_0x0601('0x4e')][_0x0601('0x53')]('nolimit')){_0x3e094b[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x1baa4a[_0x0601('0x4e')][_0x0601('0x21')]);_0x3e094b[_0x0601('0x1f')]=qs['offset'](_0x1baa4a['query'][_0x0601('0x1f')]);}_0x3e094b[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x1baa4a[_0x0601('0x4e')][_0x0601('0x56')]);_0x3e094b['where']=qs[_0x0601('0x4c')](_['pick'](_0x1baa4a['query'],_0x58a73d['filters']));_0x3e094b[_0x0601('0x57')]['MailAccountId']=_0xffdd79['id'];if(_0x1baa4a[_0x0601('0x4e')][_0x0601('0x6d')]){_0x3e094b['where']=_['merge'](_0x3e094b[_0x0601('0x57')],{'$or':_[_0x0601('0x46')](_0x3e094b[_0x0601('0x4f')],function(_0x80a65){var _0x38262b={};_0x38262b[_0x80a65]={'$like':'%'+_0x1baa4a[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x38262b;})});}_0x3e094b=_[_0x0601('0x58')]({},_0x3e094b,_0x1baa4a[_0x0601('0x59')]);return db['CannedAnswer'][_0x0601('0x22')]({'where':_0x3e094b['where']})[_0x0601('0x12')](function(_0x221e1f){_0x9e834d[_0x0601('0x22')]=_0x221e1f;if(_0x1baa4a[_0x0601('0x4e')][_0x0601('0x6e')]){_0x3e094b[_0x0601('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0x0601('0x6f')](_0x3e094b);})['then'](function(_0x4f39e3){_0x9e834d[_0x0601('0x70')]=_0x4f39e3;return _0x9e834d;});}})[_0x0601('0x12')](respondWithFilteredResult(_0x4063c5,_0x3e094b))['catch'](handleError(_0x4063c5,null));};exports[_0x0601('0x77')]=function(_0x9507f,_0x233752){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x9507f['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x233752,null))['then'](function(_0x466622){if(_0x466622){return _0x466622[_0x0601('0x77')](_0x9507f['query'][_0x0601('0x72')]);}})[_0x0601('0x12')](respondWithStatusCode(_0x233752,null))[_0x0601('0x5f')](handleError(_0x233752,null));};exports['create']=function(_0x224a0f,_0x5477db){var _0x14dfd3={'name':_0x224a0f[_0x0601('0x60')][_0x0601('0x4a')],'key':_0x224a0f[_0x0601('0x60')][_0x0601('0x49')],'provider':_0x224a0f['body'][_0x0601('0x61')]===_0x0601('0x62')?null:_0x224a0f[_0x0601('0x60')][_0x0601('0x61')],'email':_0x224a0f[_0x0601('0x60')][_0x0601('0x78')],'ListId':_0x224a0f[_0x0601('0x60')]['ListId'],'active':!_[_0x0601('0x79')](_0x224a0f['body']['active'])?_0x224a0f[_0x0601('0x60')][_0x0601('0x7a')]:!![],'description':_0x224a0f[_0x0601('0x60')][_0x0601('0x7b')]||null};var _0xda7ab0=getAuthenticationOptions(_0x14dfd3[_0x0601('0x61')],_0x224a0f[_0x0601('0x60')]);_0x14dfd3[_0x0601('0x41')]=_0xda7ab0[_0x0601('0x41')];_0x14dfd3['Smtp']=_0xda7ab0[_0x0601('0x42')];return db[_0x0601('0x5a')]['create'](_0x14dfd3,{'include':[{'model':db[_0x0601('0x64')],'as':_0x0601('0x42')},{'model':db[_0x0601('0x63')],'as':_0x0601('0x41')}]})[_0x0601('0x12')](function(_0x4affff){var _0x341d24=_0x224a0f[_0x0601('0x36')][_0x0601('0x26')]({'plain':!![]});if(!_0x341d24)throw new Error(_0x0601('0x7c'));if(_0x341d24[_0x0601('0x7d')]===_0x0601('0x36')){var _0xec6e50=_0x4affff[_0x0601('0x26')]({'plain':!![]});return db[_0x0601('0x7e')][_0x0601('0x5e')]({'where':{'name':_0x0601('0x27'),'userProfileId':_0x341d24[_0x0601('0x7f')]},'raw':!![]})[_0x0601('0x12')](function(_0x5a67d0){if(_0x5a67d0&&_0x5a67d0[_0x0601('0x80')]===0x0){return db['UserProfileResource']['create']({'name':_0xec6e50[_0x0601('0x4a')],'resourceId':_0xec6e50['id'],'type':_0x5a67d0[_0x0601('0x4a')],'sectionId':_0x5a67d0['id']},{})[_0x0601('0x12')](function(){return _0x4affff;});}else{return _0x4affff;}})[_0x0601('0x5f')](function(_0x2177a6){logger[_0x0601('0x16')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2177a6);throw _0x2177a6;});}return _0x4affff;})[_0x0601('0x12')](respondWithResult(_0x5477db,0xc9))[_0x0601('0x5f')](handleError(_0x5477db,null));};exports[_0x0601('0x81')]=function(_0x47a71d,_0x2196df){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x47a71d[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x2196df,null))[_0x0601('0x12')](function(_0x5b0dc0){if(_0x5b0dc0){return _0x5b0dc0[_0x0601('0x81')]();}return null;})[_0x0601('0x12')](respondWithResult(_0x2196df,null))[_0x0601('0x5f')](handleError(_0x2196df,null));};exports['addImap']=function(_0x59483e,_0x32ddfc){if(_0x59483e[_0x0601('0x60')]['id']){delete _0x59483e[_0x0601('0x60')]['id'];}return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x59483e[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x32ddfc,null))['then'](function(_0x44f3ef){if(_0x44f3ef){_0x59483e['body']['MailAccountId']=_0x44f3ef['id'];return db['MailServerIn'][_0x0601('0x69')](_0x59483e[_0x0601('0x60')]);}})[_0x0601('0x12')](respondWithResult(_0x32ddfc,null))['catch'](handleError(_0x32ddfc,null));};exports['removeImap']=function(_0x4b90f9,_0x1ce3f5){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x4b90f9['params']['id']}})['then'](handleEntityNotFound(_0x1ce3f5,null))['then'](function(_0x10121d){if(_0x10121d){return _0x10121d['setImap'](null);}return null;})['then'](respondWithStatusCode(_0x1ce3f5,null))[_0x0601('0x5f')](handleError(_0x1ce3f5,null));};exports[_0x0601('0x82')]=function(_0x5983df,_0x3b5844){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x5983df['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x3b5844,null))[_0x0601('0x12')](function(_0x3a007a){if(_0x3a007a){return _0x3a007a[_0x0601('0x82')]();}return null;})[_0x0601('0x12')](respondWithResult(_0x3b5844,null))['catch'](handleError(_0x3b5844,null));};exports['addSmtp']=function(_0x584945,_0x390741){if(_0x584945[_0x0601('0x60')]['id']){delete _0x584945['body']['id'];}return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x584945['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x390741,null))[_0x0601('0x12')](function(_0x177505){if(_0x177505){_0x584945['body'][_0x0601('0x6c')]=_0x177505['id'];return db['MailServerOut'][_0x0601('0x69')](_0x584945[_0x0601('0x60')]);}})['then'](respondWithResult(_0x390741,null))[_0x0601('0x5f')](handleError(_0x390741,null));};exports['removeSmtp']=function(_0x45e970,_0x31649b){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x45e970['params']['id']}})['then'](handleEntityNotFound(_0x31649b,null))[_0x0601('0x12')](function(_0x1445d9){if(_0x1445d9){return _0x1445d9[_0x0601('0x83')](null);}return null;})[_0x0601('0x12')](respondWithStatusCode(_0x31649b,null))[_0x0601('0x5f')](handleError(_0x31649b,null));};exports[_0x0601('0x84')]=function(_0xcc11d8,_0x2524eb){return db[_0x0601('0x85')][_0x0601('0x5e')]({'where':{'id':_0xcc11d8['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x2524eb,null))[_0x0601('0x12')](function(_0x2c594a){if(_0x2c594a){return _0x2c594a[_0x0601('0x84')](_0xcc11d8[_0x0601('0x60')][_0x0601('0x72')],_[_0x0601('0x86')](_0xcc11d8[_0x0601('0x60')],[_0x0601('0x72'),'id'])||{});}})['then'](respondWithResult(_0x2524eb,null))[_0x0601('0x5f')](handleError(_0x2524eb,null));};exports[_0x0601('0x87')]=function(_0x1025a9,_0x5ba9b2){var _0x1255d3={'raw':![],'where':{}};var _0x3f0acc={};var _0x227f0f={'count':0x0,'rows':[]};return db[_0x0601('0x5a')]['findOne']({'where':{'id':_0x1025a9[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x5ba9b2,null))[_0x0601('0x12')](function(_0x4ff440){if(_0x4ff440){_0x3f0acc[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x85')][_0x0601('0x47')]);_0x3f0acc['query']=_['keys'](_0x1025a9[_0x0601('0x4e')]);_0x3f0acc[_0x0601('0x4c')]=_['intersection'](_0x3f0acc[_0x0601('0x4d')],_0x3f0acc[_0x0601('0x4e')]);_0x1255d3[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x3f0acc[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x1025a9[_0x0601('0x4e')][_0x0601('0x51')]));_0x1255d3['attributes']=_0x1255d3[_0x0601('0x4f')][_0x0601('0x52')]?_0x1255d3[_0x0601('0x4f')]:_0x3f0acc['model'];if(!_0x1025a9[_0x0601('0x4e')][_0x0601('0x53')]('nolimit')){_0x1255d3[_0x0601('0x21')]=qs[_0x0601('0x21')](_0x1025a9[_0x0601('0x4e')][_0x0601('0x21')]);_0x1255d3[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x1025a9['query']['offset']);}_0x1255d3['order']=qs[_0x0601('0x56')](_0x1025a9[_0x0601('0x4e')]['sort']);_0x1255d3[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x1025a9['query'],_0x3f0acc[_0x0601('0x4c')]));_0x1255d3[_0x0601('0x57')][_0x0601('0x6c')]=_0x4ff440['id'];if(_0x1025a9['query'][_0x0601('0x6d')]){_0x1255d3['where']=_[_0x0601('0x58')](_0x1255d3[_0x0601('0x57')],{'$or':_[_0x0601('0x46')](_0x1255d3[_0x0601('0x4f')],function(_0x44506f){var _0x3e9fc9={};_0x3e9fc9[_0x44506f]={'$like':'%'+_0x1025a9[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x3e9fc9;})});}_0x1255d3=_['merge']({},_0x1255d3,_0x1025a9[_0x0601('0x59')]);return db[_0x0601('0x85')][_0x0601('0x22')]({'where':_0x1255d3['where']})['then'](function(_0x391002){_0x227f0f[_0x0601('0x22')]=_0x391002;if(_0x1025a9[_0x0601('0x4e')][_0x0601('0x6e')]){_0x1255d3[_0x0601('0x5b')]=[{'model':db[_0x0601('0x88')],'as':_0x0601('0x89'),'required':![]},{'model':db[_0x0601('0x8a')],'as':'Owner','attributes':['name','fullname',_0x0601('0x8b')],'required':![]},{'model':db[_0x0601('0x8c')],'as':_0x0601('0x8d'),'attributes':['id',_0x0601('0x4a'),_0x0601('0x8e')],'where':_0x1025a9[_0x0601('0x4e')][_0x0601('0x8f')]?{'id':_0x1025a9[_0x0601('0x4e')][_0x0601('0x8f')]}:undefined,'required':_0x1025a9[_0x0601('0x4e')][_0x0601('0x8f')]?!![]:![]}];}return db[_0x0601('0x85')][_0x0601('0x6f')](_0x1255d3);})[_0x0601('0x12')](function(_0x1f9461){_0x227f0f[_0x0601('0x70')]=_0x1f9461;return _0x227f0f;});}})['then'](respondWithFilteredResult(_0x5ba9b2,_0x1255d3))[_0x0601('0x5f')](handleError(_0x5ba9b2,null));};exports[_0x0601('0x90')]=function addApplications(_0x2808fe,_0xa68064){var _0xa90d7a=_0x2808fe['params']['id'];var _0x96d703=_0x2808fe[_0x0601('0x60')];var _0x28af1a=0xc8;var _0x33c0f5=null;return db[_0x0601('0x91')][_0x0601('0x92')]({'isolationLevel':db[_0x0601('0x91')][_0x0601('0x93')]['ISOLATION_LEVELS'][_0x0601('0x94')]},function(_0x510029){return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0xa90d7a},'transaction':_0x510029})[_0x0601('0x12')](function(_0x51222e){if(_0x51222e){return db[_0x0601('0x95')][_0x0601('0x25')]({'where':{'MailAccountId':_0xa90d7a},'transaction':_0x510029})[_0x0601('0x12')](function(){var _0x2d5a35=_[_0x0601('0x46')](_0x96d703,function(_0x195acd){_0x195acd['MailAccountId']=_0xa90d7a;return _0x195acd;});return db['MailApplication'][_0x0601('0x96')](_0x2d5a35,{'transaction':_0x510029});});}else{_0x28af1a=0x194;_0x33c0f5=[];}});})[_0x0601('0x12')](function(){if(_0x28af1a!==0x194){return db['MailApplication'][_0x0601('0x97')]({'where':{'MailAccountId':_0xa90d7a},'order':_0x0601('0x98')})[_0x0601('0x12')](function(_0x4bb550){_0x33c0f5=_0x4bb550;});}})[_0x0601('0x5f')](function(_0x51712b){_0x28af1a=0x1f4;logger[_0x0601('0x16')](_0x51712b[_0x0601('0x29')]);if(_0x51712b['name']){delete _0x51712b[_0x0601('0x4a')];}_0x33c0f5=_0x51712b;})['finally'](function(){if(_0x33c0f5===null){_0xa68064[_0x0601('0x1b')](_0x28af1a);}else{if(_0x28af1a===0x1f4){_0xa68064['status'](_0x28af1a)[_0x0601('0x2a')](_0x33c0f5);}else{_0xa68064[_0x0601('0x1c')](_0x28af1a)[_0x0601('0x1e')](_0x33c0f5);}}});};exports[_0x0601('0x99')]=function(_0x24e9b9,_0xa243e3){var _0x5ae89e={};var _0x328c52={};var _0x2c276b;var _0x2a8a0c;return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x24e9b9['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0xa243e3,null))['then'](function(_0x2fa292){if(_0x2fa292){_0x2c276b=_0x2fa292;_0x328c52[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x95')][_0x0601('0x47')]);_0x328c52['query']=_['keys'](_0x24e9b9[_0x0601('0x4e')]);_0x328c52['filters']=_[_0x0601('0x50')](_0x328c52['model'],_0x328c52[_0x0601('0x4e')]);_0x5ae89e[_0x0601('0x4f')]=_[_0x0601('0x50')](_0x328c52[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x24e9b9['query'][_0x0601('0x51')]));_0x5ae89e[_0x0601('0x4f')]=_0x5ae89e['attributes'][_0x0601('0x52')]?_0x5ae89e[_0x0601('0x4f')]:_0x328c52[_0x0601('0x4d')];_0x5ae89e[_0x0601('0x55')]=qs['sort'](_0x24e9b9[_0x0601('0x4e')][_0x0601('0x56')]);_0x5ae89e[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x24e9b9[_0x0601('0x4e')],_0x328c52[_0x0601('0x4c')]));if(_0x24e9b9[_0x0601('0x4e')][_0x0601('0x6d')]){_0x5ae89e['where']=_['merge'](_0x5ae89e[_0x0601('0x57')],{'$or':_['map'](_0x5ae89e[_0x0601('0x4f')],function(_0x5c1c4a){var _0x1130ff={};_0x1130ff[_0x5c1c4a]={'$like':'%'+_0x24e9b9['query'][_0x0601('0x6d')]+'%'};return _0x1130ff;})});}_0x5ae89e=_[_0x0601('0x58')]({},_0x5ae89e,_0x24e9b9[_0x0601('0x59')]);return _0x2c276b[_0x0601('0x99')](_0x5ae89e);}})[_0x0601('0x12')](function(_0x42964f){if(_0x42964f){_0x2a8a0c=_0x42964f[_0x0601('0x52')];if(!_0x24e9b9[_0x0601('0x4e')][_0x0601('0x53')](_0x0601('0x54'))){_0x5ae89e['limit']=qs[_0x0601('0x21')](_0x24e9b9[_0x0601('0x4e')][_0x0601('0x21')]);_0x5ae89e[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x24e9b9[_0x0601('0x4e')][_0x0601('0x1f')]);}return _0x2c276b[_0x0601('0x99')](_0x5ae89e);}})[_0x0601('0x12')](function(_0x5ef669){if(_0x5ef669){return _0x5ef669?{'count':_0x2a8a0c,'rows':_0x5ef669}:null;}})[_0x0601('0x12')](respondWithResult(_0xa243e3,null))[_0x0601('0x5f')](handleError(_0xa243e3,null));};exports['getMessages']=function(_0x4a4ce5,_0x32f32a){var _0x4bbff0={'raw':!![],'where':{}};var _0x518039={};var _0xa7099a={'count':0x0,'rows':[]};return db[_0x0601('0x5a')][_0x0601('0x76')]({'where':{'id':_0x4a4ce5['params']['id']}})['then'](handleEntityNotFound(_0x32f32a,null))[_0x0601('0x12')](function(_0x3488da){if(_0x3488da){_0x518039[_0x0601('0x4d')]=_[_0x0601('0x4b')](db[_0x0601('0x9a')]['rawAttributes']);_0x518039[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x4a4ce5[_0x0601('0x4e')]);_0x518039[_0x0601('0x4c')]=_[_0x0601('0x50')](_0x518039['model'],_0x518039[_0x0601('0x4e')]);_0x4bbff0[_0x0601('0x4f')]=_['intersection'](_0x518039[_0x0601('0x4d')],qs[_0x0601('0x51')](_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x51')]));_0x4bbff0[_0x0601('0x4f')]=_0x4bbff0['attributes'][_0x0601('0x52')]?_0x4bbff0['attributes']:_0x518039['model'];if(!_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x53')](_0x0601('0x54'))){_0x4bbff0['limit']=qs['limit'](_0x4a4ce5['query'][_0x0601('0x21')]);_0x4bbff0[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x1f')]);}_0x4bbff0[_0x0601('0x55')]=qs[_0x0601('0x56')](_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x56')]);_0x4bbff0[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x4a4ce5[_0x0601('0x4e')],_0x518039[_0x0601('0x4c')]));_0x4bbff0['where'][_0x0601('0x6c')]=_0x3488da['id'];if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x6d')]){_0x4bbff0[_0x0601('0x57')]=_['merge'](_0x4bbff0[_0x0601('0x57')],{'$or':_['map'](_0x4bbff0[_0x0601('0x4f')],function(_0x1e66a1){var _0x3f5afd={};_0x3f5afd[_0x1e66a1]={'$like':'%'+_0x4a4ce5['query']['filter']+'%'};return _0x3f5afd;})});}if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x9b')]){var _0xb93286=_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x9b')][_0x0601('0x9c')](',');var _0x2fc4d3={};_0x2fc4d3[_0xb93286[0x0]]={'$gte':moment(_0xb93286[0x1])[_0x0601('0x9d')](_0x0601('0x9e'))};_0x4bbff0['where']=_[_0x0601('0x58')](_0x4bbff0[_0x0601('0x57')],_0x2fc4d3);}_0x4bbff0=_[_0x0601('0x58')]({},_0x4bbff0,_0x4a4ce5[_0x0601('0x59')]);return db[_0x0601('0x9a')]['count']({'where':_0x4bbff0['where']})[_0x0601('0x12')](function(_0x2f88a1){_0xa7099a[_0x0601('0x22')]=_0x2f88a1;if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x6e')]){_0x4bbff0['include']=[{'all':!![]}];}return db[_0x0601('0x9a')][_0x0601('0x6f')](_0x4bbff0);})['then'](function(_0x49a2b4){if(_0x4a4ce5[_0x0601('0x4e')][_0x0601('0x9f')]===_0x0601('0xa0')){for(var _0x47fd71=0x0;_0x47fd71<_0x49a2b4['length'];_0x47fd71++){_0x49a2b4[_0x47fd71]['body']=juice(_0x49a2b4[_0x47fd71][_0x0601('0x60')]);}}_0xa7099a[_0x0601('0x70')]=_0x49a2b4;return _0xa7099a;});}})[_0x0601('0x12')](respondWithFilteredResult(_0x32f32a,_0x4bbff0))[_0x0601('0x5f')](handleError(_0x32f32a,null));};exports['send']=function(_0x1e0e19,_0x257a92){var _0x4c6199,_0x4977c0={},_0x68ab58;if(_0x1e0e19['body']['to']){_0x68ab58=_0x1e0e19[_0x0601('0x60')]['to'][_0x0601('0x9c')](',')[0x0];}return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x1e0e19[_0x0601('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x0601('0x88')],'as':_0x0601('0xa1'),'where':{'email':_0x68ab58},'limit':0x1,'order':[[_0x0601('0xa2'),_0x0601('0xa3')]]}]},{'model':db[_0x0601('0x64')],'as':_0x0601('0x42'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x0601('0xa4'),'raw':!![]}]}]})[_0x0601('0x12')](handleEntityNotFound(_0x257a92,null))['then'](function(_0x252abc){if(!_0x252abc)return;_0x4c6199=_0x252abc;if(!_0x252abc[_0x0601('0x42')])throw new Error(_0x0601('0xa5'));if(_[_0x0601('0x79')](_0x1e0e19[_0x0601('0x60')][_0x0601('0xa6')])){_0x1e0e19['body'][_0x0601('0xa6')]=util[_0x0601('0x9d')](_0x0601('0xa7'),_0x252abc['name'],_0x252abc[_0x0601('0x78')]||_0x252abc['Smtp'][_0x0601('0x36')]);}if(_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')]&&_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')]['length']){for(var _0x11f286=0x0;_0x11f286<_0x1e0e19['body'][_0x0601('0xa8')][_0x0601('0x52')];_0x11f286+=0x1){_0x1e0e19['body']['attachments'][_0x11f286]={'filename':_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')][_0x11f286][_0x0601('0x4a')],'path':path[_0x0601('0xa9')](config[_0x0601('0xaa')],_0x0601('0xab'),_0x1e0e19[_0x0601('0x60')][_0x0601('0xa8')][_0x11f286][_0x0601('0xac')])};}}var _0x37fa26=_0x252abc[_0x0601('0xad')]();return respondWithRpcPromise(_0x0601('0xae'),_0x0601('0xaf'),{'account':_0x37fa26,'message':_0x1e0e19[_0x0601('0x60')]});})[_0x0601('0x12')](function(_0x2aa3bb){if(!_0x2aa3bb)return;_0x4977c0=_0x2aa3bb;if(!_0x4c6199[_0x0601('0xb0')])throw new Error(_0x0601('0xb1'));if(_0x4c6199['List']['Contacts']['length'])return _0x4c6199[_0x0601('0xb0')][_0x0601('0xa1')][0x0];return db[_0x0601('0x88')][_0x0601('0x69')](_[_0x0601('0x9')](_0x1e0e19[_0x0601('0x60')],{'firstName':_0x1e0e19['body']['to'],'email':_0x1e0e19['body']['to'],'phone':_0x1e0e19[_0x0601('0x60')]['to'],'ListId':_0x4c6199[_0x0601('0xb2')]}));})[_0x0601('0x12')](function(_0x2b4795){if(!_0x2b4795)return;var _0x5f3f90={'UserId':_0x1e0e19[_0x0601('0x36')]['id'],'ContactId':_0x2b4795['id'],'MailAccountId':_0x4c6199['id'],'inReplyTo':_0x4977c0['messageId'],'to':_0x1e0e19['body'][_0x0601('0xa6')],'cc':_0x1e0e19[_0x0601('0x60')]['cc'],'subject':_0x1e0e19[_0x0601('0x60')]['subject'],'attach':_0x1e0e19[_0x0601('0x60')][_0x0601('0xb3')],'firstMsgDirection':_0x0601('0xb4'),'lastMsgAt':moment()[_0x0601('0x9d')](_0x0601('0x9e')),'lastMsgDirection':_0x0601('0xb4'),'Messages':[_[_0x0601('0x58')](_0x1e0e19['body'],{'messageId':_0x4977c0[_0x0601('0xb5')],'sentAt':moment()[_0x0601('0x9d')](_0x0601('0x9e')),'read':!![],'MailAccountId':_0x4c6199['id'],'UserId':_0x1e0e19[_0x0601('0x36')]['id'],'ContactId':_0x2b4795['id']})]};if(_0x1e0e19[_0x0601('0x60')]['Interaction']){_0x5f3f90=_[_0x0601('0x58')](_0x5f3f90,_0x1e0e19[_0x0601('0x60')]['Interaction']);}return db[_0x0601('0x85')][_0x0601('0x69')](_0x5f3f90,{'include':[{'model':db[_0x0601('0x9a')],'as':'Messages'}]});})[_0x0601('0x12')](respondWithResult(_0x257a92,null))[_0x0601('0x5f')](handleError(_0x257a92,null));};exports['verifySmtp']=function(_0x27ed32,_0x160461){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x27ed32[_0x0601('0x5d')]['id']},'include':[{'model':db[_0x0601('0x64')],'as':_0x0601('0x42'),'raw':!![],'include':[{'model':db[_0x0601('0xa4')],'as':_0x0601('0xa4'),'raw':!![]}]}]})[_0x0601('0x12')](handleEntityNotFound(_0x160461,null))['then'](function(_0x485d0b){if(!_0x485d0b['Smtp'])return;var _0xebc46e=_0x485d0b[_0x0601('0xad')]();return respondWithRpcPromise(_0x0601('0xb6'),_0x0601('0xb7'),{'account':_0xebc46e});})[_0x0601('0x12')](respondWithResult(_0x160461,null))[_0x0601('0x5f')](handleError(_0x160461,null));};exports[_0x0601('0x25')]=function(_0x22be14,_0x390ec4){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x22be14[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x390ec4,null))[_0x0601('0x12')](function(_0x34ca7b){if(_0x34ca7b&&_0x34ca7b[_0x0601('0x3e')]){throw new db[(_0x0601('0xb8'))][(_0x0601('0xb9'))](_0x0601('0xba'));}return _0x34ca7b;})['then'](removeEntity(_0x390ec4,null))[_0x0601('0x5f')](handleError(_0x390ec4,null));};exports[_0x0601('0xbb')]=function(_0x117f9c,_0x1e50b3){return db['MailAccount']['find']({'where':{'id':_0x117f9c[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x1e50b3,null))[_0x0601('0x12')](function(_0x1539db){if(_0x1539db){return _0x1539db['addAgents'](_0x117f9c['body'][_0x0601('0x72')],_[_0x0601('0x86')](_0x117f9c[_0x0601('0x60')],[_0x0601('0x72'),'id'])||{})[_0x0601('0xbc')](function(_0x29f4db){for(var _0x3e011f=0x0;_0x3e011f<_0x117f9c['body'][_0x0601('0x72')]['length'];_0x3e011f+=0x1){socket[_0x0601('0xbd')](_0x0601('0xbe'),{'UserId':Number(_0x117f9c[_0x0601('0x60')][_0x0601('0x72')][_0x3e011f]),'MailAccountId':Number(_0x117f9c[_0x0601('0x5d')]['id'])});}return _0x29f4db;});}})[_0x0601('0x12')](respondWithResult(_0x1e50b3,null))['catch'](handleError(_0x1e50b3,null));};exports[_0x0601('0xbf')]=function(_0x59f684,_0xb3cf2b){return db[_0x0601('0x5a')][_0x0601('0x5e')]({'where':{'id':_0x59f684[_0x0601('0x5d')]['id']}})[_0x0601('0x12')](handleEntityNotFound(_0xb3cf2b,null))[_0x0601('0x12')](function(_0x298486){if(_0x298486){return _0x298486[_0x0601('0xbf')](_0x59f684[_0x0601('0x4e')]['ids'])['then'](function(){if(_['isArray'](_0x59f684[_0x0601('0x4e')][_0x0601('0x72')])){for(var _0x2a530c=0x0;_0x2a530c<_0x59f684[_0x0601('0x4e')]['ids']['length'];_0x2a530c+=0x1){socket[_0x0601('0xbd')](_0x0601('0xc0'),{'UserId':Number(_0x59f684[_0x0601('0x4e')][_0x0601('0x72')][_0x2a530c]),'MailAccountId':Number(_0x59f684[_0x0601('0x5d')]['id'])});}}else{socket[_0x0601('0xbd')](_0x0601('0xc0'),{'UserId':Number(_0x59f684[_0x0601('0x4e')][_0x0601('0x72')]),'MailAccountId':Number(_0x59f684['params']['id'])});}});}})[_0x0601('0x12')](respondWithStatusCode(_0xb3cf2b,null))[_0x0601('0x5f')](handleError(_0xb3cf2b,null));};exports[_0x0601('0xc1')]=function(_0x17fd6f,_0x41408b){var _0x463fa9={};var _0x2c9f96={};var _0x4708ac;var _0x3277c7;return db[_0x0601('0x5a')]['findOne']({'where':{'id':_0x17fd6f['params']['id']}})[_0x0601('0x12')](handleEntityNotFound(_0x41408b,null))['then'](function(_0x3019ee){if(_0x3019ee){_0x4708ac=_0x3019ee;_0x2c9f96['model']=_['keys'](db[_0x0601('0x8a')][_0x0601('0x47')]);_0x2c9f96[_0x0601('0x4e')]=_[_0x0601('0x4b')](_0x17fd6f['query']);_0x2c9f96['filters']=_[_0x0601('0x50')](_0x2c9f96['model'],_0x2c9f96['query']);_0x463fa9['attributes']=_['intersection'](_0x2c9f96['model'],qs[_0x0601('0x51')](_0x17fd6f[_0x0601('0x4e')][_0x0601('0x51')]));_0x463fa9['attributes']=_0x463fa9[_0x0601('0x4f')][_0x0601('0x52')]?_0x463fa9[_0x0601('0x4f')]:_0x2c9f96['model'];_0x463fa9['order']=qs[_0x0601('0x56')](_0x17fd6f[_0x0601('0x4e')]['sort']);_0x463fa9[_0x0601('0x57')]=qs[_0x0601('0x4c')](_[_0x0601('0x6b')](_0x17fd6f[_0x0601('0x4e')],_0x2c9f96[_0x0601('0x4c')]));if(_0x17fd6f[_0x0601('0x4e')][_0x0601('0x6d')]){_0x463fa9[_0x0601('0x57')]=_[_0x0601('0x58')](_0x463fa9[_0x0601('0x57')],{'$or':_['map'](_0x463fa9[_0x0601('0x4f')],function(_0x4824c1){var _0x5cfebe={};_0x5cfebe[_0x4824c1]={'$like':'%'+_0x17fd6f[_0x0601('0x4e')][_0x0601('0x6d')]+'%'};return _0x5cfebe;})});}_0x463fa9=_[_0x0601('0x58')]({},_0x463fa9,_0x17fd6f['options']);return _0x4708ac[_0x0601('0xc1')](_0x463fa9);}})[_0x0601('0x12')](function(_0x1e660b){if(_0x1e660b){_0x3277c7=_0x1e660b[_0x0601('0x52')];if(!_0x17fd6f[_0x0601('0x4e')][_0x0601('0x53')]('nolimit')){_0x463fa9['limit']=qs['limit'](_0x17fd6f[_0x0601('0x4e')][_0x0601('0x21')]);_0x463fa9[_0x0601('0x1f')]=qs[_0x0601('0x1f')](_0x17fd6f[_0x0601('0x4e')][_0x0601('0x1f')]);}return _0x4708ac[_0x0601('0xc1')](_0x463fa9);}})['then'](function(_0x5ea8c7){if(_0x5ea8c7){return _0x5ea8c7?{'count':_0x3277c7,'rows':_0x5ea8c7}:null;}})[_0x0601('0x12')](respondWithResult(_0x41408b,null))[_0x0601('0x5f')](handleError(_0x41408b,null));}; \ No newline at end of file +var _0x128e=['destroy','get','MailAccounts','UserProfileResource','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','map','rawAttributes','fieldName','type','key','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','includeAll','include','MailAccount','findAll','rows','show','params','mandatoryDispositionPause','find','catch','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','Disposition','getDispositions','findOne','pick','removeDispositions','ids','addAnswer','MailAccountId','CannedAnswer','getAnswers','removeAnswers','create','email','ListId','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','removeImap','setImap','getSmtp','addSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','split','format','List','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','sendMail','messageId','from','subject','YYYY-MM-DD\x20HH:mm:ss','out','Interaction','VerifySmtp','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','moment','bluebird','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./mailAccount.socket','jayson/promise','client','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','update'];(function(_0xab8465,_0x3c5ebd){var _0x5551ac=function(_0x2150fd){while(--_0x2150fd){_0xab8465['push'](_0xab8465['shift']());}};_0x5551ac(++_0x3c5ebd);}(_0x128e,0x15d));var _0xe128=function(_0x19bd67,_0x36a677){_0x19bd67=_0x19bd67-0x0;var _0x46f227=_0x128e[_0x19bd67];return _0x46f227;};'use strict';var moment=require(_0xe128('0x0'));var BPromise=require(_0xe128('0x1'));var util=require('util');var path=require('path');var _=require(_0xe128('0x2'));var juice=require(_0xe128('0x3'));var Redis=require('ioredis');var qs=require(_0xe128('0x4'));var logger=require(_0xe128('0x5'))(_0xe128('0x6'));var config=require('../../config/environment');var db=require(_0xe128('0x7'))['db'];config[_0xe128('0x8')]=_[_0xe128('0x9')](config[_0xe128('0x8')],{'host':_0xe128('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe128('0xb'))['register'](socket);var jayson=require(_0xe128('0xc'));var client=jayson[_0xe128('0xd')]['http']({'port':0x232b});function respondWithRpcPromise(_0xb3a3d6,_0x2e2261,_0x2cd119,_0x286833){return new BPromise(function(_0x4da0fd,_0x420872){var _0x3325fa=_0x286833||client;return _0x3325fa[_0xe128('0xe')](_0xb3a3d6,_0x2cd119)[_0xe128('0xf')](function(_0x3e2ec5){logger[_0xe128('0x10')](_0xe128('0x11'),_0x2e2261,'request\x20sent');logger[_0xe128('0x12')](_0xe128('0x13'),_0x2e2261,_0xe128('0x14'),JSON['stringify'](_0x3e2ec5));if(_0x3e2ec5[_0xe128('0x15')]){if(_0x3e2ec5[_0xe128('0x15')][_0xe128('0x16')]===0x1f4){logger['error'](_0xe128('0x11'),_0x2e2261,_0x3e2ec5[_0xe128('0x15')][_0xe128('0x17')]);return _0x420872(_0x3e2ec5[_0xe128('0x15')][_0xe128('0x17')]);}logger[_0xe128('0x15')](_0xe128('0x11'),_0x2e2261,_0x3e2ec5['error']['message']);return _0x4da0fd(_0x3e2ec5[_0xe128('0x15')][_0xe128('0x17')]);}else{logger[_0xe128('0x10')]('MailAccount,\x20%s,\x20%s',_0x2e2261,_0xe128('0x14'));_0x4da0fd(_0x3e2ec5[_0xe128('0x18')][_0xe128('0x17')]);}})['catch'](function(_0x15a2ec){logger[_0xe128('0x15')](_0xe128('0x11'),_0x2e2261,_0x15a2ec);_0x420872(_0x15a2ec);});});}function respondWithStatusCode(_0x49a6d5,_0x459034){_0x459034=_0x459034||0xcc;return function(_0x5d86e3){if(_0x5d86e3){return _0x49a6d5[_0xe128('0x19')](_0x459034);}return _0x49a6d5[_0xe128('0x1a')](_0x459034)[_0xe128('0x1b')]();};}function respondWithResult(_0x4fda6f,_0x14aee1){_0x14aee1=_0x14aee1||0xc8;return function(_0x1243da){if(_0x1243da){return _0x4fda6f['status'](_0x14aee1)[_0xe128('0x1c')](_0x1243da);}};}function respondWithFilteredResult(_0x2ec255,_0x48053f){return function(_0x522c45){if(_0x522c45){var _0x194d3b=typeof _0x48053f[_0xe128('0x1d')]===_0xe128('0x1e')&&typeof _0x48053f[_0xe128('0x1f')]===_0xe128('0x1e');var _0x321944=_0x522c45[_0xe128('0x20')];var _0xe670ca=_0x194d3b?0x0:_0x48053f[_0xe128('0x1d')];var _0x394ca6=_0x194d3b?_0x522c45[_0xe128('0x20')]:_0x48053f[_0xe128('0x1d')]+_0x48053f[_0xe128('0x1f')];var _0x2e13c3;if(_0x394ca6>=_0x321944){_0x394ca6=_0x321944;_0x2e13c3=0xc8;}else{_0x2e13c3=0xce;}_0x2ec255[_0xe128('0x1a')](_0x2e13c3);return _0x2ec255[_0xe128('0x21')]('Content-Range',_0xe670ca+'-'+_0x394ca6+'/'+_0x321944)[_0xe128('0x1c')](_0x522c45);}return null;};}function saveUpdates(_0x210ddf){return function(_0x20bf9b){if(_0x20bf9b){return _0x20bf9b[_0xe128('0x22')](_0x210ddf)['then'](function(_0x165bef){return _0x165bef;});}return null;};}function removeEntity(_0x260002){return function(_0xc4b4d6){if(_0xc4b4d6){return _0xc4b4d6[_0xe128('0x23')]()[_0xe128('0xf')](function(){var _0x52366e=_0xc4b4d6[_0xe128('0x24')]({'plain':!![]});var _0x5b40f6=_0xe128('0x25');return db[_0xe128('0x26')]['destroy']({'where':{'type':_0x5b40f6,'resourceId':_0x52366e['id']}})[_0xe128('0xf')](function(){return _0xc4b4d6;});})[_0xe128('0xf')](function(){_0x260002[_0xe128('0x1a')](0xcc)[_0xe128('0x1b')]();});}};}function handleEntityNotFound(_0x50e00a){return function(_0x407317){if(!_0x407317){_0x50e00a[_0xe128('0x19')](0x194);}return _0x407317;};}function handleError(_0x51240b,_0x42d043){_0x42d043=_0x42d043||0x1f4;return function(_0x1df891){logger['error'](_0x1df891['stack']);if(_0x1df891['name']){delete _0x1df891[_0xe128('0x27')];}_0x51240b[_0xe128('0x1a')](_0x42d043)[_0xe128('0x28')](_0x1df891);};}function getImapHost(_0x39417a){switch(_0x39417a){case _0xe128('0x29'):return _0xe128('0x2a');case _0xe128('0x2b'):return _0xe128('0x2c');case _0xe128('0x2d'):return _0xe128('0x2e');case _0xe128('0x2f'):return'outlook.office365.com';}throw new Error(_0xe128('0x30'),_0x39417a);}function getSmtpHost(_0x12047a){switch(_0x12047a){case _0xe128('0x29'):return _0xe128('0x31');case'yahoo':return _0xe128('0x32');case _0xe128('0x2d'):return _0xe128('0x33');case'outlook365':return'smtp.office365.com';}throw new Error(_0xe128('0x30'),_0x12047a);}function getAuthenticationOptions(_0x5ec983,_0x2b201d){var _0x24e1e9={};var _0x6ca82={};if(_0x5ec983){_0x24e1e9[_0xe128('0x34')]=_0x6ca82[_0xe128('0x34')]=_0x2b201d[_0xe128('0x35')];_0x24e1e9[_0xe128('0x36')]=_0x6ca82[_0xe128('0x37')]=_0x2b201d[_0xe128('0x36')];if(_0x2b201d[_0xe128('0x38')]){_0x24e1e9[_0xe128('0x38')]=_0x6ca82[_0xe128('0x38')]=!![];_0x24e1e9[_0xe128('0x39')]=_0x6ca82[_0xe128('0x39')]=_0x2b201d[_0xe128('0x39')];_0x24e1e9[_0xe128('0x36')]=_0x6ca82['pass']=null;}else{_0x24e1e9[_0xe128('0x39')]=_0x6ca82[_0xe128('0x39')]=null;}_0x24e1e9[_0xe128('0x3a')]=getImapHost(_0x5ec983);_0x24e1e9[_0xe128('0x3b')]=0x3e1;_0x6ca82[_0xe128('0x3a')]=getSmtpHost(_0x5ec983);_0x6ca82[_0xe128('0x3b')]=0x24b;_0x6ca82[_0xe128('0x3c')]=![];_0x24e1e9[_0xe128('0x3d')]=_0x6ca82['service']=null;}else{if(_0x2b201d[_0xe128('0x3e')]){_0x24e1e9['user']=_0x6ca82['user']=_0x2b201d[_0xe128('0x35')];_0x24e1e9[_0xe128('0x36')]=_0x6ca82[_0xe128('0x37')]=_0x2b201d['password'];}else{_0x24e1e9[_0xe128('0x3e')]=_0x6ca82['authentication']=![];_0x24e1e9['user']=_0x6ca82[_0xe128('0x34')]=null;_0x24e1e9['password']=_0x6ca82[_0xe128('0x37')]=null;}_0x24e1e9[_0xe128('0x3a')]=_0x2b201d['Imap'][_0xe128('0x3a')];_0x24e1e9[_0xe128('0x3b')]=_0x2b201d[_0xe128('0x3f')][_0xe128('0x3b')];_0x6ca82[_0xe128('0x3a')]=_0x2b201d[_0xe128('0x40')][_0xe128('0x3a')];_0x6ca82[_0xe128('0x3b')]=_0x2b201d[_0xe128('0x40')][_0xe128('0x3b')];}return{'Imap':_0x24e1e9,'Smtp':_0x6ca82};}exports['index']=function(_0x310709,_0xe29b3f){var _0x142b12={'include':[{'model':db[_0xe128('0x41')],'as':_0xe128('0x3f')},{'model':db[_0xe128('0x42')],'as':_0xe128('0x40')},{'model':db[_0xe128('0x43')],'as':'mandatoryDispositionPause'}]},_0x3cccba={},_0x5294d5={'count':0x0,'rows':[]};var _0x1b87d8=_[_0xe128('0x44')](db['MailAccount'][_0xe128('0x45')],function(_0xa4ae6d){return{'name':_0xa4ae6d[_0xe128('0x46')],'type':_0xa4ae6d[_0xe128('0x47')][_0xe128('0x48')]};});_0x3cccba['model']=_[_0xe128('0x44')](_0x1b87d8,_0xe128('0x27'));_0x3cccba[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x310709['query']);_0x3cccba['filters']=_[_0xe128('0x4b')](_0x3cccba['model'],_0x3cccba[_0xe128('0x49')]);_0x142b12[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x3cccba[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0x310709[_0xe128('0x49')][_0xe128('0x4e')]));_0x142b12[_0xe128('0x4c')]=_0x142b12[_0xe128('0x4c')][_0xe128('0x4f')]?_0x142b12['attributes']:_0x3cccba[_0xe128('0x4d')];if(!_0x310709['query'][_0xe128('0x50')](_0xe128('0x51'))){_0x142b12[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0x310709[_0xe128('0x49')][_0xe128('0x1f')]);_0x142b12[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x310709['query']['offset']);}_0x142b12[_0xe128('0x52')]=qs['sort'](_0x310709[_0xe128('0x49')][_0xe128('0x53')]);_0x142b12[_0xe128('0x54')]=qs[_0xe128('0x55')](_['pick'](_0x310709[_0xe128('0x49')],_0x3cccba['filters']),_0x1b87d8);if(_0x310709[_0xe128('0x49')]['filter']){_0x142b12[_0xe128('0x54')]=_['merge'](_0x142b12[_0xe128('0x54')],{'$or':_['map'](_0x1b87d8,function(_0x5b2e19){if(_0x5b2e19['type']!=='VIRTUAL'){var _0x517ed5={};_0x517ed5[_0x5b2e19[_0xe128('0x27')]]={'$like':'%'+_0x310709[_0xe128('0x49')][_0xe128('0x56')]+'%'};return _0x517ed5;}})});}_0x142b12=_[_0xe128('0x57')]({},_0x142b12,_0x310709[_0xe128('0x58')]);var _0x3718db={'where':_0x142b12[_0xe128('0x54')]};return db['MailAccount'][_0xe128('0x20')](_0x3718db)[_0xe128('0xf')](function(_0x2ba924){_0x5294d5[_0xe128('0x20')]=_0x2ba924;if(_0x310709['query'][_0xe128('0x59')]){_0x142b12[_0xe128('0x5a')]=[{'all':!![]}];}return db[_0xe128('0x5b')][_0xe128('0x5c')](_0x142b12);})[_0xe128('0xf')](function(_0xd2815c){_0x5294d5[_0xe128('0x5d')]=_0xd2815c;return _0x5294d5;})['then'](respondWithFilteredResult(_0xe29b3f,_0x142b12))['catch'](handleError(_0xe29b3f,null));};exports[_0xe128('0x5e')]=function(_0x4d1a4e,_0x4fa480){var _0xf8a883={'raw':![],'where':{'id':_0x4d1a4e[_0xe128('0x5f')]['id']},'include':[{'model':db[_0xe128('0x41')],'as':_0xe128('0x3f')},{'model':db['MailServerOut'],'as':_0xe128('0x40')},{'model':db['Pause'],'as':_0xe128('0x60')}]},_0x5e1bbb={};_0x5e1bbb[_0xe128('0x4d')]=_[_0xe128('0x4a')](db['MailAccount'][_0xe128('0x45')]);_0x5e1bbb[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x4d1a4e[_0xe128('0x49')]);_0x5e1bbb['filters']=_['intersection'](_0x5e1bbb[_0xe128('0x4d')],_0x5e1bbb[_0xe128('0x49')]);_0xf8a883[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x5e1bbb[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0x4d1a4e[_0xe128('0x49')][_0xe128('0x4e')]));_0xf8a883['attributes']=_0xf8a883[_0xe128('0x4c')][_0xe128('0x4f')]?_0xf8a883[_0xe128('0x4c')]:_0x5e1bbb[_0xe128('0x4d')];if(_0x4d1a4e['query']['includeAll']){_0xf8a883[_0xe128('0x5a')]=[{'all':!![]}];}_0xf8a883=_['merge']({},_0xf8a883,_0x4d1a4e['options']);return db[_0xe128('0x5b')][_0xe128('0x61')](_0xf8a883)[_0xe128('0xf')](handleEntityNotFound(_0x4fa480,null))[_0xe128('0xf')](respondWithResult(_0x4fa480,null))[_0xe128('0x62')](handleError(_0x4fa480,null));};exports[_0xe128('0x22')]=function(_0x5cce68,_0x5a16d8){if(_0x5cce68[_0xe128('0x63')]['id']){delete _0x5cce68['body']['id'];}var _0x2ac64f=_0x5cce68['body'][_0xe128('0x64')]===_0xe128('0x65')?null:_0x5cce68[_0xe128('0x63')]['provider'];var _0x48e95d=_0x5cce68['body'][_0xe128('0x3f')]||{};var _0x2916d8=_0x5cce68[_0xe128('0x63')][_0xe128('0x40')]||{};if(_0x2ac64f){_0x48e95d[_0xe128('0x3a')]=getImapHost(_0x2ac64f);_0x48e95d[_0xe128('0x3b')]=0x3e1;_0x2916d8[_0xe128('0x3a')]=getSmtpHost(_0x2ac64f);_0x2916d8['port']=0x24b;_0x2916d8[_0xe128('0x3c')]=![];}if(_0x2916d8['modernAuthentication']){_0x2916d8[_0xe128('0x3c')]=![];}else{_0x2916d8['CloudProviderId']=null;}if(!_0x48e95d[_0xe128('0x38')])_0x48e95d[_0xe128('0x39')]=null;_0x5cce68[_0xe128('0x63')][_0xe128('0x3f')]=_0x48e95d;_0x5cce68[_0xe128('0x63')][_0xe128('0x40')]=_0x2916d8;return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x5cce68['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xe128('0x3f')},{'model':db[_0xe128('0x42')],'as':'Smtp'},{'model':db[_0xe128('0x43')],'as':_0xe128('0x60')}]})['then'](handleEntityNotFound(_0x5a16d8,null))[_0xe128('0xf')](function(_0x5b6f87){if(!_0x5b6f87)throw new Error(_0xe128('0x66'));if(_0x5b6f87[_0xe128('0x3d')])delete _0x5cce68[_0xe128('0x63')][_0xe128('0x3f')];return _0x5b6f87;})[_0xe128('0xf')](saveUpdates(_0x5cce68[_0xe128('0x63')],null))['then'](function(_0x199d74){if(!_0x5cce68[_0xe128('0x63')][_0xe128('0x3f')])return _0x199d74;return db[_0xe128('0x41')][_0xe128('0x22')](_0x5cce68[_0xe128('0x63')][_0xe128('0x3f')],{'where':{'MailAccountId':_0x199d74['id']}})[_0xe128('0xf')](function(){return _0x199d74;});})[_0xe128('0xf')](function(_0x3a2122){if(!_0x5cce68[_0xe128('0x63')][_0xe128('0x40')])return _0x3a2122;return db[_0xe128('0x42')][_0xe128('0x22')](_0x5cce68['body'][_0xe128('0x40')],{'where':{'MailAccountId':_0x3a2122['id']}})[_0xe128('0xf')](function(){return _0x3a2122;});})[_0xe128('0xf')](respondWithResult(_0x5a16d8,null))[_0xe128('0x62')](handleError(_0x5a16d8,null));};exports[_0xe128('0x67')]=function(_0x1bc3a2,_0x2867c2){return db[_0xe128('0x5b')][_0xe128('0x67')]()[_0xe128('0xf')](respondWithResult(_0x2867c2,null))[_0xe128('0x62')](handleError(_0x2867c2,null));};exports[_0xe128('0x68')]=function(_0x159b88,_0x4fa9d9){if(_0x159b88[_0xe128('0x63')]['id']){delete _0x159b88['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x159b88[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x4fa9d9,null))['then'](function(_0x5f1564){if(_0x5f1564){_0x159b88[_0xe128('0x63')]['MailAccountId']=_0x5f1564['id'];return db[_0xe128('0x69')]['create'](_0x159b88['body']);}})[_0xe128('0xf')](respondWithResult(_0x4fa9d9,null))[_0xe128('0x62')](handleError(_0x4fa9d9,null));};exports[_0xe128('0x6a')]=function(_0x243378,_0x3df590){var _0x3c8da4={'raw':![],'where':{}};var _0xb1498a={};var _0x5e93fb={'count':0x0,'rows':[]};return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x243378[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x3df590,null))[_0xe128('0xf')](function(_0x3ce85d){if(_0x3ce85d){_0xb1498a['model']=_['keys'](db[_0xe128('0x69')][_0xe128('0x45')]);_0xb1498a[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x243378['query']);_0xb1498a[_0xe128('0x55')]=_[_0xe128('0x4b')](_0xb1498a['model'],_0xb1498a[_0xe128('0x49')]);_0x3c8da4[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0xb1498a['model'],qs[_0xe128('0x4e')](_0x243378[_0xe128('0x49')][_0xe128('0x4e')]));_0x3c8da4[_0xe128('0x4c')]=_0x3c8da4[_0xe128('0x4c')][_0xe128('0x4f')]?_0x3c8da4['attributes']:_0xb1498a['model'];if(!_0x243378[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x3c8da4[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0x243378['query'][_0xe128('0x1f')]);_0x3c8da4[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x243378['query'][_0xe128('0x1d')]);}_0x3c8da4[_0xe128('0x52')]=qs[_0xe128('0x53')](_0x243378[_0xe128('0x49')][_0xe128('0x53')]);_0x3c8da4[_0xe128('0x54')]=qs['filters'](_[_0xe128('0x6c')](_0x243378[_0xe128('0x49')],_0xb1498a[_0xe128('0x55')]));_0x3c8da4[_0xe128('0x54')]['MailAccountId']=_0x3ce85d['id'];if(_0x243378['query']['filter']){_0x3c8da4[_0xe128('0x54')]=_[_0xe128('0x57')](_0x3c8da4[_0xe128('0x54')],{'$or':_['map'](_0x3c8da4[_0xe128('0x4c')],function(_0x4de7e2){var _0x10619e={};_0x10619e[_0x4de7e2]={'$like':'%'+_0x243378['query']['filter']+'%'};return _0x10619e;})});}_0x3c8da4=_[_0xe128('0x57')]({},_0x3c8da4,_0x243378[_0xe128('0x58')]);return db[_0xe128('0x69')]['count']({'where':_0x3c8da4[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x3587ab){_0x5e93fb[_0xe128('0x20')]=_0x3587ab;if(_0x243378[_0xe128('0x49')][_0xe128('0x59')]){_0x3c8da4[_0xe128('0x5a')]=[{'all':!![]}];}return db[_0xe128('0x69')][_0xe128('0x5c')](_0x3c8da4);})[_0xe128('0xf')](function(_0x6628b8){_0x5e93fb['rows']=_0x6628b8;return _0x5e93fb;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x3df590,_0x3c8da4))[_0xe128('0x62')](handleError(_0x3df590,null));};exports[_0xe128('0x6d')]=function(_0x40884a,_0x273b68){return db[_0xe128('0x5b')]['find']({'where':{'id':_0x40884a[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x273b68,null))['then'](function(_0x136dbd){if(_0x136dbd){return _0x136dbd[_0xe128('0x6d')](_0x40884a[_0xe128('0x49')][_0xe128('0x6e')]);}})[_0xe128('0xf')](respondWithStatusCode(_0x273b68,null))['catch'](handleError(_0x273b68,null));};exports[_0xe128('0x6f')]=function(_0x431f3c,_0x189d07){if(_0x431f3c[_0xe128('0x63')]['id']){delete _0x431f3c[_0xe128('0x63')]['id'];}return db[_0xe128('0x5b')]['find']({'where':{'id':_0x431f3c[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x189d07,null))[_0xe128('0xf')](function(_0x1a1282){if(_0x1a1282){_0x431f3c[_0xe128('0x63')][_0xe128('0x70')]=_0x1a1282['id'];return db[_0xe128('0x71')]['create'](_0x431f3c['body']);}})[_0xe128('0xf')](respondWithResult(_0x189d07,null))[_0xe128('0x62')](handleError(_0x189d07,null));};exports[_0xe128('0x72')]=function(_0xa84dfd,_0x189ef5){var _0x186b42={'raw':![],'where':{}};var _0x4687cc={};var _0x59136f={'count':0x0,'rows':[]};return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0xa84dfd['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x189ef5,null))[_0xe128('0xf')](function(_0x21552f){if(_0x21552f){_0x4687cc[_0xe128('0x4d')]=_[_0xe128('0x4a')](db['CannedAnswer'][_0xe128('0x45')]);_0x4687cc[_0xe128('0x49')]=_['keys'](_0xa84dfd[_0xe128('0x49')]);_0x4687cc[_0xe128('0x55')]=_[_0xe128('0x4b')](_0x4687cc[_0xe128('0x4d')],_0x4687cc[_0xe128('0x49')]);_0x186b42['attributes']=_['intersection'](_0x4687cc['model'],qs['fields'](_0xa84dfd[_0xe128('0x49')][_0xe128('0x4e')]));_0x186b42[_0xe128('0x4c')]=_0x186b42[_0xe128('0x4c')][_0xe128('0x4f')]?_0x186b42[_0xe128('0x4c')]:_0x4687cc[_0xe128('0x4d')];if(!_0xa84dfd[_0xe128('0x49')][_0xe128('0x50')](_0xe128('0x51'))){_0x186b42[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0xa84dfd[_0xe128('0x49')][_0xe128('0x1f')]);_0x186b42['offset']=qs[_0xe128('0x1d')](_0xa84dfd[_0xe128('0x49')][_0xe128('0x1d')]);}_0x186b42['order']=qs[_0xe128('0x53')](_0xa84dfd[_0xe128('0x49')]['sort']);_0x186b42[_0xe128('0x54')]=qs[_0xe128('0x55')](_[_0xe128('0x6c')](_0xa84dfd['query'],_0x4687cc[_0xe128('0x55')]));_0x186b42['where'][_0xe128('0x70')]=_0x21552f['id'];if(_0xa84dfd['query'][_0xe128('0x56')]){_0x186b42[_0xe128('0x54')]=_[_0xe128('0x57')](_0x186b42[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x186b42['attributes'],function(_0x51ffe2){var _0x39afea={};_0x39afea[_0x51ffe2]={'$like':'%'+_0xa84dfd[_0xe128('0x49')]['filter']+'%'};return _0x39afea;})});}_0x186b42=_['merge']({},_0x186b42,_0xa84dfd['options']);return db[_0xe128('0x71')][_0xe128('0x20')]({'where':_0x186b42[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x55ea16){_0x59136f['count']=_0x55ea16;if(_0xa84dfd[_0xe128('0x49')][_0xe128('0x59')]){_0x186b42[_0xe128('0x5a')]=[{'all':!![]}];}return db[_0xe128('0x71')][_0xe128('0x5c')](_0x186b42);})[_0xe128('0xf')](function(_0x1ad6a6){_0x59136f[_0xe128('0x5d')]=_0x1ad6a6;return _0x59136f;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x189ef5,_0x186b42))['catch'](handleError(_0x189ef5,null));};exports[_0xe128('0x73')]=function(_0x36e97a,_0x30533f){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x36e97a[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x30533f,null))[_0xe128('0xf')](function(_0x3be720){if(_0x3be720){return _0x3be720['removeAnswers'](_0x36e97a['query'][_0xe128('0x6e')]);}})['then'](respondWithStatusCode(_0x30533f,null))[_0xe128('0x62')](handleError(_0x30533f,null));};exports[_0xe128('0x74')]=function(_0x479d65,_0x5da536){var _0x404b43={'name':_0x479d65[_0xe128('0x63')]['name'],'key':_0x479d65[_0xe128('0x63')][_0xe128('0x48')],'provider':_0x479d65['body'][_0xe128('0x64')]===_0xe128('0x65')?null:_0x479d65['body'][_0xe128('0x64')],'email':_0x479d65[_0xe128('0x63')][_0xe128('0x75')],'ListId':_0x479d65['body'][_0xe128('0x76')],'active':!_[_0xe128('0x77')](_0x479d65[_0xe128('0x63')][_0xe128('0x78')])?_0x479d65[_0xe128('0x63')][_0xe128('0x78')]:!![],'description':_0x479d65[_0xe128('0x63')][_0xe128('0x79')]||null};var _0xe588aa=getAuthenticationOptions(_0x404b43['provider'],_0x479d65['body']);_0x404b43[_0xe128('0x3f')]=_0xe588aa[_0xe128('0x3f')];_0x404b43['Smtp']=_0xe588aa['Smtp'];return db[_0xe128('0x5b')]['create'](_0x404b43,{'include':[{'model':db['MailServerOut'],'as':_0xe128('0x40')},{'model':db['MailServerIn'],'as':_0xe128('0x3f')}]})[_0xe128('0xf')](function(_0x2decb2){var _0x2944ba=_0x479d65[_0xe128('0x34')][_0xe128('0x24')]({'plain':!![]});if(!_0x2944ba)throw new Error(_0xe128('0x7a'));if(_0x2944ba[_0xe128('0x7b')]==='user'){var _0x5503fc=_0x2decb2[_0xe128('0x24')]({'plain':!![]});return db['UserProfileSection'][_0xe128('0x61')]({'where':{'name':_0xe128('0x25'),'userProfileId':_0x2944ba[_0xe128('0x7c')]},'raw':!![]})[_0xe128('0xf')](function(_0x1ea0ee){if(_0x1ea0ee&&_0x1ea0ee[_0xe128('0x7d')]===0x0){return db[_0xe128('0x26')][_0xe128('0x74')]({'name':_0x5503fc[_0xe128('0x27')],'resourceId':_0x5503fc['id'],'type':_0x1ea0ee[_0xe128('0x27')],'sectionId':_0x1ea0ee['id']},{})[_0xe128('0xf')](function(){return _0x2decb2;});}else{return _0x2decb2;}})['catch'](function(_0x592595){logger[_0xe128('0x15')](_0xe128('0x7e'),_0x592595);throw _0x592595;});}return _0x2decb2;})[_0xe128('0xf')](respondWithResult(_0x5da536,0xc9))['catch'](handleError(_0x5da536,null));};exports[_0xe128('0x7f')]=function(_0x214513,_0x2a77fc){return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x214513['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x2a77fc,null))[_0xe128('0xf')](function(_0x11aa33){if(_0x11aa33){return _0x11aa33[_0xe128('0x7f')]();}return null;})[_0xe128('0xf')](respondWithResult(_0x2a77fc,null))[_0xe128('0x62')](handleError(_0x2a77fc,null));};exports['addImap']=function(_0x2fbfc1,_0x12682a){if(_0x2fbfc1[_0xe128('0x63')]['id']){delete _0x2fbfc1[_0xe128('0x63')]['id'];}return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x2fbfc1[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x12682a,null))[_0xe128('0xf')](function(_0xcd3575){if(_0xcd3575){_0x2fbfc1[_0xe128('0x63')]['MailAccountId']=_0xcd3575['id'];return db[_0xe128('0x41')][_0xe128('0x74')](_0x2fbfc1[_0xe128('0x63')]);}})[_0xe128('0xf')](respondWithResult(_0x12682a,null))['catch'](handleError(_0x12682a,null));};exports[_0xe128('0x80')]=function(_0x40b45c,_0x487808){return db[_0xe128('0x5b')]['findOne']({'where':{'id':_0x40b45c['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x487808,null))[_0xe128('0xf')](function(_0x3d8fb6){if(_0x3d8fb6){return _0x3d8fb6[_0xe128('0x81')](null);}return null;})[_0xe128('0xf')](respondWithStatusCode(_0x487808,null))[_0xe128('0x62')](handleError(_0x487808,null));};exports[_0xe128('0x82')]=function(_0x2ba45c,_0x45af67){return db['MailAccount'][_0xe128('0x6b')]({'where':{'id':_0x2ba45c['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x45af67,null))[_0xe128('0xf')](function(_0x4f6b67){if(_0x4f6b67){return _0x4f6b67['getSmtp']();}return null;})[_0xe128('0xf')](respondWithResult(_0x45af67,null))['catch'](handleError(_0x45af67,null));};exports[_0xe128('0x83')]=function(_0x5e359c,_0x47c57e){if(_0x5e359c[_0xe128('0x63')]['id']){delete _0x5e359c[_0xe128('0x63')]['id'];}return db[_0xe128('0x5b')]['find']({'where':{'id':_0x5e359c[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x47c57e,null))[_0xe128('0xf')](function(_0x47ab62){if(_0x47ab62){_0x5e359c[_0xe128('0x63')][_0xe128('0x70')]=_0x47ab62['id'];return db[_0xe128('0x42')]['create'](_0x5e359c[_0xe128('0x63')]);}})[_0xe128('0xf')](respondWithResult(_0x47c57e,null))[_0xe128('0x62')](handleError(_0x47c57e,null));};exports['removeSmtp']=function(_0x5705a8,_0x260e37){return db[_0xe128('0x5b')]['findOne']({'where':{'id':_0x5705a8[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x260e37,null))[_0xe128('0xf')](function(_0x22da3b){if(_0x22da3b){return _0x22da3b['setSmtp'](null);}return null;})[_0xe128('0xf')](respondWithStatusCode(_0x260e37,null))[_0xe128('0x62')](handleError(_0x260e37,null));};exports[_0xe128('0x84')]=function(_0x467bb4,_0x1d3c19){return db[_0xe128('0x85')][_0xe128('0x61')]({'where':{'id':_0x467bb4[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x1d3c19,null))[_0xe128('0xf')](function(_0x28e99c){if(_0x28e99c){return _0x28e99c[_0xe128('0x84')](_0x467bb4['body'][_0xe128('0x6e')],_[_0xe128('0x86')](_0x467bb4['body'],[_0xe128('0x6e'),'id'])||{});}})[_0xe128('0xf')](respondWithResult(_0x1d3c19,null))[_0xe128('0x62')](handleError(_0x1d3c19,null));};exports[_0xe128('0x87')]=function(_0xc26221,_0x46facc){var _0x14cd69={'raw':![],'where':{}};var _0x25ccfc={};var _0x53f9c0={'count':0x0,'rows':[]};return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0xc26221[_0xe128('0x5f')]['id']}})['then'](handleEntityNotFound(_0x46facc,null))['then'](function(_0x1d5afd){if(_0x1d5afd){_0x25ccfc[_0xe128('0x4d')]=_[_0xe128('0x4a')](db['MailInteraction'][_0xe128('0x45')]);_0x25ccfc[_0xe128('0x49')]=_['keys'](_0xc26221[_0xe128('0x49')]);_0x25ccfc['filters']=_[_0xe128('0x4b')](_0x25ccfc[_0xe128('0x4d')],_0x25ccfc[_0xe128('0x49')]);_0x14cd69[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x25ccfc[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0xc26221[_0xe128('0x49')][_0xe128('0x4e')]));_0x14cd69[_0xe128('0x4c')]=_0x14cd69[_0xe128('0x4c')]['length']?_0x14cd69[_0xe128('0x4c')]:_0x25ccfc[_0xe128('0x4d')];if(!_0xc26221[_0xe128('0x49')][_0xe128('0x50')](_0xe128('0x51'))){_0x14cd69[_0xe128('0x1f')]=qs['limit'](_0xc26221['query']['limit']);_0x14cd69[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0xc26221[_0xe128('0x49')][_0xe128('0x1d')]);}_0x14cd69[_0xe128('0x52')]=qs[_0xe128('0x53')](_0xc26221['query'][_0xe128('0x53')]);_0x14cd69['where']=qs['filters'](_['pick'](_0xc26221[_0xe128('0x49')],_0x25ccfc[_0xe128('0x55')]));_0x14cd69[_0xe128('0x54')][_0xe128('0x70')]=_0x1d5afd['id'];if(_0xc26221[_0xe128('0x49')][_0xe128('0x56')]){_0x14cd69['where']=_['merge'](_0x14cd69[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x14cd69[_0xe128('0x4c')],function(_0x393949){var _0x887837={};_0x887837[_0x393949]={'$like':'%'+_0xc26221['query'][_0xe128('0x56')]+'%'};return _0x887837;})});}_0x14cd69=_[_0xe128('0x57')]({},_0x14cd69,_0xc26221[_0xe128('0x58')]);return db[_0xe128('0x85')]['count']({'where':_0x14cd69[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x203011){_0x53f9c0[_0xe128('0x20')]=_0x203011;if(_0xc26221[_0xe128('0x49')][_0xe128('0x59')]){_0x14cd69[_0xe128('0x5a')]=[{'model':db[_0xe128('0x88')],'as':_0xe128('0x89'),'required':![]},{'model':db[_0xe128('0x8a')],'as':_0xe128('0x8b'),'attributes':[_0xe128('0x27'),_0xe128('0x8c'),'internal'],'required':![]},{'model':db[_0xe128('0x8d')],'as':_0xe128('0x8e'),'attributes':['id',_0xe128('0x27'),_0xe128('0x8f')],'where':_0xc26221['query']['tag']?{'id':_0xc26221[_0xe128('0x49')][_0xe128('0x90')]}:undefined,'required':_0xc26221[_0xe128('0x49')]['tag']?!![]:![]}];}return db[_0xe128('0x85')][_0xe128('0x5c')](_0x14cd69);})['then'](function(_0x1b01ac){_0x53f9c0[_0xe128('0x5d')]=_0x1b01ac;return _0x53f9c0;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x46facc,_0x14cd69))[_0xe128('0x62')](handleError(_0x46facc,null));};exports[_0xe128('0x91')]=function addApplications(_0x3069e7,_0x4d8414){var _0x177e8e=_0x3069e7['params']['id'];var _0x267553=_0x3069e7['body'];var _0x4fcb18=0xc8;var _0x290fb6=null;return db[_0xe128('0x92')][_0xe128('0x93')]({'isolationLevel':db['sequelize']['Transaction'][_0xe128('0x94')][_0xe128('0x95')]},function(_0x42a7aa){return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x177e8e},'transaction':_0x42a7aa})[_0xe128('0xf')](function(_0x2b2600){if(_0x2b2600){return db[_0xe128('0x96')][_0xe128('0x23')]({'where':{'MailAccountId':_0x177e8e},'transaction':_0x42a7aa})[_0xe128('0xf')](function(){var _0x17b6fb=_[_0xe128('0x44')](_0x267553,function(_0x3d52c7){_0x3d52c7[_0xe128('0x70')]=_0x177e8e;return _0x3d52c7;});return db[_0xe128('0x96')][_0xe128('0x97')](_0x17b6fb,{'transaction':_0x42a7aa});});}else{_0x4fcb18=0x194;_0x290fb6=[];}});})[_0xe128('0xf')](function(){if(_0x4fcb18!==0x194){return db[_0xe128('0x96')][_0xe128('0x98')]({'where':{'MailAccountId':_0x177e8e},'order':_0xe128('0x99')})['then'](function(_0x32103a){_0x290fb6=_0x32103a;});}})['catch'](function(_0x34b753){_0x4fcb18=0x1f4;logger[_0xe128('0x15')](_0x34b753['stack']);if(_0x34b753[_0xe128('0x27')]){delete _0x34b753[_0xe128('0x27')];}_0x290fb6=_0x34b753;})[_0xe128('0x9a')](function(){if(_0x290fb6===null){_0x4d8414[_0xe128('0x19')](_0x4fcb18);}else{if(_0x4fcb18===0x1f4){_0x4d8414[_0xe128('0x1a')](_0x4fcb18)['send'](_0x290fb6);}else{_0x4d8414['status'](_0x4fcb18)[_0xe128('0x1c')](_0x290fb6);}}});};exports[_0xe128('0x9b')]=function(_0x1921fa,_0x40d1db){var _0x52f42a={};var _0x373f73={};var _0x1caf2b;var _0x2e9f24;return db[_0xe128('0x5b')][_0xe128('0x6b')]({'where':{'id':_0x1921fa[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x40d1db,null))[_0xe128('0xf')](function(_0x36391c){if(_0x36391c){_0x1caf2b=_0x36391c;_0x373f73['model']=_[_0xe128('0x4a')](db[_0xe128('0x96')][_0xe128('0x45')]);_0x373f73[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x1921fa[_0xe128('0x49')]);_0x373f73['filters']=_[_0xe128('0x4b')](_0x373f73['model'],_0x373f73[_0xe128('0x49')]);_0x52f42a['attributes']=_[_0xe128('0x4b')](_0x373f73[_0xe128('0x4d')],qs['fields'](_0x1921fa['query']['fields']));_0x52f42a[_0xe128('0x4c')]=_0x52f42a[_0xe128('0x4c')][_0xe128('0x4f')]?_0x52f42a[_0xe128('0x4c')]:_0x373f73[_0xe128('0x4d')];_0x52f42a['order']=qs[_0xe128('0x53')](_0x1921fa['query'][_0xe128('0x53')]);_0x52f42a[_0xe128('0x54')]=qs[_0xe128('0x55')](_[_0xe128('0x6c')](_0x1921fa[_0xe128('0x49')],_0x373f73[_0xe128('0x55')]));if(_0x1921fa[_0xe128('0x49')]['filter']){_0x52f42a[_0xe128('0x54')]=_[_0xe128('0x57')](_0x52f42a[_0xe128('0x54')],{'$or':_['map'](_0x52f42a[_0xe128('0x4c')],function(_0x189db0){var _0x25a76e={};_0x25a76e[_0x189db0]={'$like':'%'+_0x1921fa[_0xe128('0x49')][_0xe128('0x56')]+'%'};return _0x25a76e;})});}_0x52f42a=_[_0xe128('0x57')]({},_0x52f42a,_0x1921fa[_0xe128('0x58')]);return _0x1caf2b[_0xe128('0x9b')](_0x52f42a);}})[_0xe128('0xf')](function(_0x4a2c61){if(_0x4a2c61){_0x2e9f24=_0x4a2c61[_0xe128('0x4f')];if(!_0x1921fa[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x52f42a[_0xe128('0x1f')]=qs[_0xe128('0x1f')](_0x1921fa['query'][_0xe128('0x1f')]);_0x52f42a[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x1921fa[_0xe128('0x49')]['offset']);}return _0x1caf2b[_0xe128('0x9b')](_0x52f42a);}})[_0xe128('0xf')](function(_0xd9ee41){if(_0xd9ee41){return _0xd9ee41?{'count':_0x2e9f24,'rows':_0xd9ee41}:null;}})[_0xe128('0xf')](respondWithResult(_0x40d1db,null))[_0xe128('0x62')](handleError(_0x40d1db,null));};exports[_0xe128('0x9c')]=function(_0xf0c925,_0x408d19){var _0x8ba4d9={'raw':!![],'where':{}};var _0x4efc0b={};var _0x4c2e90={'count':0x0,'rows':[]};return db['MailAccount'][_0xe128('0x6b')]({'where':{'id':_0xf0c925['params']['id']}})['then'](handleEntityNotFound(_0x408d19,null))[_0xe128('0xf')](function(_0x4f781f){if(_0x4f781f){_0x4efc0b[_0xe128('0x4d')]=_[_0xe128('0x4a')](db[_0xe128('0x9d')][_0xe128('0x45')]);_0x4efc0b['query']=_[_0xe128('0x4a')](_0xf0c925[_0xe128('0x49')]);_0x4efc0b[_0xe128('0x55')]=_[_0xe128('0x4b')](_0x4efc0b[_0xe128('0x4d')],_0x4efc0b['query']);_0x8ba4d9[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x4efc0b['model'],qs['fields'](_0xf0c925['query']['fields']));_0x8ba4d9[_0xe128('0x4c')]=_0x8ba4d9[_0xe128('0x4c')][_0xe128('0x4f')]?_0x8ba4d9[_0xe128('0x4c')]:_0x4efc0b[_0xe128('0x4d')];if(!_0xf0c925[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x8ba4d9['limit']=qs[_0xe128('0x1f')](_0xf0c925[_0xe128('0x49')][_0xe128('0x1f')]);_0x8ba4d9[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0xf0c925[_0xe128('0x49')]['offset']);}_0x8ba4d9[_0xe128('0x52')]=qs[_0xe128('0x53')](_0xf0c925[_0xe128('0x49')][_0xe128('0x53')]);_0x8ba4d9[_0xe128('0x54')]=qs[_0xe128('0x55')](_['pick'](_0xf0c925[_0xe128('0x49')],_0x4efc0b['filters']));_0x8ba4d9[_0xe128('0x54')][_0xe128('0x70')]=_0x4f781f['id'];if(_0xf0c925['query']['filter']){_0x8ba4d9[_0xe128('0x54')]=_[_0xe128('0x57')](_0x8ba4d9[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x8ba4d9[_0xe128('0x4c')],function(_0x2f2577){var _0x1155f4={};_0x1155f4[_0x2f2577]={'$like':'%'+_0xf0c925['query'][_0xe128('0x56')]+'%'};return _0x1155f4;})});}if(_0xf0c925[_0xe128('0x49')][_0xe128('0x9e')]){var _0x2b49d8=_0xf0c925['query'][_0xe128('0x9e')][_0xe128('0x9f')](',');var _0x4bed7d={};_0x4bed7d[_0x2b49d8[0x0]]={'$gte':moment(_0x2b49d8[0x1])[_0xe128('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0x8ba4d9['where']=_[_0xe128('0x57')](_0x8ba4d9[_0xe128('0x54')],_0x4bed7d);}_0x8ba4d9=_[_0xe128('0x57')]({},_0x8ba4d9,_0xf0c925[_0xe128('0x58')]);return db[_0xe128('0x9d')]['count']({'where':_0x8ba4d9[_0xe128('0x54')]})[_0xe128('0xf')](function(_0x1460a9){_0x4c2e90[_0xe128('0x20')]=_0x1460a9;if(_0xf0c925['query']['includeAll']){_0x8ba4d9[_0xe128('0x5a')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x8ba4d9);})[_0xe128('0xf')](function(_0x184406){if(_0xf0c925[_0xe128('0x49')]['inlineCss']==='true'){for(var _0x341a1f=0x0;_0x341a1f<_0x184406['length'];_0x341a1f++){_0x184406[_0x341a1f]['body']=juice(_0x184406[_0x341a1f][_0xe128('0x63')]);}}_0x4c2e90[_0xe128('0x5d')]=_0x184406;return _0x4c2e90;});}})[_0xe128('0xf')](respondWithFilteredResult(_0x408d19,_0x8ba4d9))[_0xe128('0x62')](handleError(_0x408d19,null));};exports['send']=function(_0x29950f,_0xb1b774){var _0x237a0a,_0x2e2e1b={},_0x1a5d42;if(_0x29950f['body']['to']){_0x1a5d42=_0x29950f['body']['to'][_0xe128('0x9f')](',')[0x0];}return db[_0xe128('0x5b')]['find']({'where':{'id':_0x29950f[_0xe128('0x5f')]['id']},'include':[{'model':db['CmList'],'as':_0xe128('0xa1'),'include':[{'model':db['CmContact'],'as':_0xe128('0xa2'),'where':{'email':_0x1a5d42},'limit':0x1,'order':[[_0xe128('0xa3'),_0xe128('0xa4')]]}]},{'model':db['MailServerOut'],'as':_0xe128('0x40'),'raw':!![],'include':[{'model':db[_0xe128('0xa5')],'as':_0xe128('0xa5'),'raw':!![]}]}]})['then'](handleEntityNotFound(_0xb1b774,null))[_0xe128('0xf')](function(_0x433e9d){if(!_0x433e9d)return;_0x237a0a=_0x433e9d;if(!_0x433e9d[_0xe128('0x40')])throw new Error(_0xe128('0xa6'));if(_[_0xe128('0x77')](_0x29950f[_0xe128('0x63')]['from'])){_0x29950f[_0xe128('0x63')]['from']=util[_0xe128('0xa0')](_0xe128('0xa7'),_0x433e9d['name'],_0x433e9d['email']||_0x433e9d[_0xe128('0x40')][_0xe128('0x34')]);}if(_0x29950f[_0xe128('0x63')]['attachments']&&_0x29950f[_0xe128('0x63')][_0xe128('0xa8')]['length']){for(var _0x4dfeb6=0x0;_0x4dfeb6<_0x29950f[_0xe128('0x63')]['attachments']['length'];_0x4dfeb6+=0x1){_0x29950f[_0xe128('0x63')][_0xe128('0xa8')][_0x4dfeb6]={'filename':_0x29950f[_0xe128('0x63')][_0xe128('0xa8')][_0x4dfeb6]['name'],'path':path['join'](config[_0xe128('0xa9')],_0xe128('0xaa'),_0x29950f[_0xe128('0x63')][_0xe128('0xa8')][_0x4dfeb6]['basename'])};}}var _0x502a8c=_0x433e9d[_0xe128('0xab')]();return respondWithRpcPromise(_0xe128('0xac'),_0xe128('0xad'),{'account':_0x502a8c,'message':_0x29950f[_0xe128('0x63')]});})[_0xe128('0xf')](function(_0x877e2b){if(!_0x877e2b)return;_0x2e2e1b=_0x877e2b;if(!_0x237a0a[_0xe128('0xa1')])throw new Error('List\x20not\x20found');if(_0x237a0a['List'][_0xe128('0xa2')][_0xe128('0x4f')])return _0x237a0a[_0xe128('0xa1')]['Contacts'][0x0];return db[_0xe128('0x88')][_0xe128('0x74')](_[_0xe128('0x9')](_0x29950f[_0xe128('0x63')],{'firstName':_0x29950f['body']['to'],'email':_0x29950f[_0xe128('0x63')]['to'],'phone':_0x29950f[_0xe128('0x63')]['to'],'ListId':_0x237a0a[_0xe128('0x76')]}));})[_0xe128('0xf')](function(_0x55b795){if(!_0x55b795)return;var _0x5e7fae={'UserId':_0x29950f[_0xe128('0x34')]['id'],'ContactId':_0x55b795['id'],'MailAccountId':_0x237a0a['id'],'inReplyTo':_0x2e2e1b[_0xe128('0xae')],'to':_0x29950f['body'][_0xe128('0xaf')],'cc':_0x29950f['body']['cc'],'subject':_0x29950f[_0xe128('0x63')][_0xe128('0xb0')],'attach':_0x29950f[_0xe128('0x63')]['attach'],'firstMsgDirection':'out','lastMsgAt':moment()['format'](_0xe128('0xb1')),'lastMsgDirection':_0xe128('0xb2'),'Messages':[_[_0xe128('0x57')](_0x29950f[_0xe128('0x63')],{'messageId':_0x2e2e1b[_0xe128('0xae')],'sentAt':moment()['format'](_0xe128('0xb1')),'read':!![],'MailAccountId':_0x237a0a['id'],'UserId':_0x29950f[_0xe128('0x34')]['id'],'ContactId':_0x55b795['id']})]};if(_0x29950f['body'][_0xe128('0xb3')]){_0x5e7fae=_[_0xe128('0x57')](_0x5e7fae,_0x29950f[_0xe128('0x63')][_0xe128('0xb3')]);}return db[_0xe128('0x85')]['create'](_0x5e7fae,{'include':[{'model':db[_0xe128('0x9d')],'as':'Messages'}]});})[_0xe128('0xf')](respondWithResult(_0xb1b774,null))[_0xe128('0x62')](handleError(_0xb1b774,null));};exports['verifySmtp']=function(_0x44bdde,_0x5737d6){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x44bdde['params']['id']},'include':[{'model':db[_0xe128('0x42')],'as':'Smtp','raw':!![],'include':[{'model':db[_0xe128('0xa5')],'as':'CloudProvider','raw':!![]}]}]})[_0xe128('0xf')](handleEntityNotFound(_0x5737d6,null))[_0xe128('0xf')](function(_0x4c109e){if(!_0x4c109e[_0xe128('0x40')])return;var _0x1dd46e=_0x4c109e[_0xe128('0xab')]();return respondWithRpcPromise(_0xe128('0xb4'),_0xe128('0xb5'),{'account':_0x1dd46e});})['then'](respondWithResult(_0x5737d6,null))[_0xe128('0x62')](handleError(_0x5737d6,null));};exports['destroy']=function(_0x5c1cd8,_0x51f692){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x5c1cd8[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x51f692,null))[_0xe128('0xf')](function(_0xc8f05){if(_0xc8f05&&_0xc8f05[_0xe128('0x3d')]){throw new db[(_0xe128('0xb6'))][(_0xe128('0xb7'))](_0xe128('0xb8'));}return _0xc8f05;})[_0xe128('0xf')](removeEntity(_0x51f692,null))[_0xe128('0x62')](handleError(_0x51f692,null));};exports[_0xe128('0xb9')]=function(_0x1c9808,_0x1f5fd4){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x1c9808[_0xe128('0x5f')]['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x1f5fd4,null))[_0xe128('0xf')](function(_0x44523e){if(_0x44523e){return _0x44523e[_0xe128('0xb9')](_0x1c9808[_0xe128('0x63')]['ids'],_[_0xe128('0x86')](_0x1c9808['body'],['ids','id'])||{})[_0xe128('0xba')](function(_0x224f60){for(var _0x55134e=0x0;_0x55134e<_0x1c9808[_0xe128('0x63')]['ids']['length'];_0x55134e+=0x1){socket[_0xe128('0xbb')](_0xe128('0xbc'),{'UserId':Number(_0x1c9808[_0xe128('0x63')]['ids'][_0x55134e]),'MailAccountId':Number(_0x1c9808[_0xe128('0x5f')]['id'])});}return _0x224f60;});}})[_0xe128('0xf')](respondWithResult(_0x1f5fd4,null))[_0xe128('0x62')](handleError(_0x1f5fd4,null));};exports['removeAgents']=function(_0x2721df,_0x41850f){return db[_0xe128('0x5b')][_0xe128('0x61')]({'where':{'id':_0x2721df[_0xe128('0x5f')]['id']}})['then'](handleEntityNotFound(_0x41850f,null))[_0xe128('0xf')](function(_0x268494){if(_0x268494){return _0x268494['removeAgents'](_0x2721df[_0xe128('0x49')][_0xe128('0x6e')])[_0xe128('0xf')](function(){if(_[_0xe128('0xbd')](_0x2721df[_0xe128('0x49')]['ids'])){for(var _0x331894=0x0;_0x331894<_0x2721df[_0xe128('0x49')][_0xe128('0x6e')][_0xe128('0x4f')];_0x331894+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2721df[_0xe128('0x49')][_0xe128('0x6e')][_0x331894]),'MailAccountId':Number(_0x2721df['params']['id'])});}}else{socket['emit'](_0xe128('0xbe'),{'UserId':Number(_0x2721df[_0xe128('0x49')][_0xe128('0x6e')]),'MailAccountId':Number(_0x2721df[_0xe128('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x41850f,null))['catch'](handleError(_0x41850f,null));};exports[_0xe128('0xbf')]=function(_0x1b9ee6,_0x4d04ba){var _0x26dc19={};var _0x23e46e={};var _0x18855;var _0x5c491a;return db['MailAccount'][_0xe128('0x6b')]({'where':{'id':_0x1b9ee6['params']['id']}})[_0xe128('0xf')](handleEntityNotFound(_0x4d04ba,null))['then'](function(_0x5741b6){if(_0x5741b6){_0x18855=_0x5741b6;_0x23e46e[_0xe128('0x4d')]=_[_0xe128('0x4a')](db[_0xe128('0x8a')][_0xe128('0x45')]);_0x23e46e[_0xe128('0x49')]=_[_0xe128('0x4a')](_0x1b9ee6[_0xe128('0x49')]);_0x23e46e[_0xe128('0x55')]=_['intersection'](_0x23e46e[_0xe128('0x4d')],_0x23e46e['query']);_0x26dc19[_0xe128('0x4c')]=_[_0xe128('0x4b')](_0x23e46e[_0xe128('0x4d')],qs[_0xe128('0x4e')](_0x1b9ee6['query'][_0xe128('0x4e')]));_0x26dc19[_0xe128('0x4c')]=_0x26dc19[_0xe128('0x4c')][_0xe128('0x4f')]?_0x26dc19[_0xe128('0x4c')]:_0x23e46e[_0xe128('0x4d')];_0x26dc19['order']=qs['sort'](_0x1b9ee6[_0xe128('0x49')][_0xe128('0x53')]);_0x26dc19[_0xe128('0x54')]=qs[_0xe128('0x55')](_['pick'](_0x1b9ee6['query'],_0x23e46e['filters']));if(_0x1b9ee6[_0xe128('0x49')]['filter']){_0x26dc19[_0xe128('0x54')]=_[_0xe128('0x57')](_0x26dc19[_0xe128('0x54')],{'$or':_[_0xe128('0x44')](_0x26dc19[_0xe128('0x4c')],function(_0x3b8a6e){var _0x2c1dd8={};_0x2c1dd8[_0x3b8a6e]={'$like':'%'+_0x1b9ee6[_0xe128('0x49')]['filter']+'%'};return _0x2c1dd8;})});}_0x26dc19=_[_0xe128('0x57')]({},_0x26dc19,_0x1b9ee6[_0xe128('0x58')]);return _0x18855['getAgents'](_0x26dc19);}})[_0xe128('0xf')](function(_0x39eb50){if(_0x39eb50){_0x5c491a=_0x39eb50[_0xe128('0x4f')];if(!_0x1b9ee6[_0xe128('0x49')][_0xe128('0x50')]('nolimit')){_0x26dc19[_0xe128('0x1f')]=qs['limit'](_0x1b9ee6[_0xe128('0x49')][_0xe128('0x1f')]);_0x26dc19[_0xe128('0x1d')]=qs[_0xe128('0x1d')](_0x1b9ee6['query']['offset']);}return _0x18855[_0xe128('0xbf')](_0x26dc19);}})['then'](function(_0x171b55){if(_0x171b55){return _0x171b55?{'count':_0x5c491a,'rows':_0x171b55}:null;}})['then'](respondWithResult(_0x4d04ba,null))[_0xe128('0x62')](handleError(_0x4d04ba,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index db5e4e7..1db867f 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 _0x0295=['remove','emit','hasOwnProperty','hook','events','setMaxListeners'];(function(_0x343dfe,_0x5be28e){var _0x59d1a8=function(_0x50c679){while(--_0x50c679){_0x343dfe['push'](_0x343dfe['shift']());}};_0x59d1a8(++_0x5be28e);}(_0x0295,0x1f0));var _0x5029=function(_0x4941c6,_0x3ca9f8){_0x4941c6=_0x4941c6-0x0;var _0x4d3654=_0x0295[_0x4941c6];return _0x4d3654;};'use strict';var EventEmitter=require(_0x5029('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x5029('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5029('0x2')};function emitEvent(_0x36335d){return function(_0x157a4f,_0x3d0af1,_0x170504){MailAccountEvents[_0x5029('0x3')](_0x36335d+':'+_0x157a4f['id'],_0x157a4f);MailAccountEvents[_0x5029('0x3')](_0x36335d,_0x157a4f);_0x170504(null);};}for(var e in events){if(events[_0x5029('0x4')](e)){var event=events[e];MailAccount[_0x5029('0x5')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xb296=['MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x35fa5a,_0x4af32b){var _0x43a05b=function(_0x3fed9b){while(--_0x3fed9b){_0x35fa5a['push'](_0x35fa5a['shift']());}};_0x43a05b(++_0x4af32b);}(_0xb296,0xa3));var _0x6b29=function(_0x47fd89,_0xd35aab){_0x47fd89=_0x47fd89-0x0;var _0x52d995=_0xb296[_0x47fd89];return _0x52d995;};'use strict';var EventEmitter=require(_0x6b29('0x0'));var MailAccount=require(_0x6b29('0x1'))['db'][_0x6b29('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6b29('0x3')](0x0);var events={'afterCreate':_0x6b29('0x4'),'afterUpdate':_0x6b29('0x5'),'afterDestroy':_0x6b29('0x6')};function emitEvent(_0x48e967){return function(_0x3ff65c,_0x5c1cf5,_0x50a1ba){MailAccountEvents[_0x6b29('0x7')](_0x48e967+':'+_0x3ff65c['id'],_0x3ff65c);MailAccountEvents['emit'](_0x48e967,_0x3ff65c);_0x50a1ba(null);};}for(var e in events){if(events[_0x6b29('0x8')](e)){var event=events[e];MailAccount[_0x6b29('0x9')](e,emitEvent(event));}}module[_0x6b29('0xa')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 57cc4d4..affe603 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 _0xac2d=['exports','define','mail_accounts','provider','service','host','Smtp','port','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','data5','pass'];(function(_0x37dc1d,_0xbf91ef){var _0x4ac931=function(_0x1a45dd){while(--_0x1a45dd){_0x37dc1d['push'](_0x37dc1d['shift']());}};_0x4ac931(++_0xbf91ef);}(_0xac2d,0xee));var _0xdac2=function(_0x15801d,_0x398156){_0x15801d=_0x15801d-0x0;var _0x1944a4=_0xac2d[_0x15801d];return _0x1944a4;};'use strict';var attributes=require('./mailAccount.attributes');module[_0xdac2('0x0')]=function(_0x742941){return _0x742941[_0xdac2('0x1')]('MailAccount',attributes,{'tableName':_0xdac2('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x48a549=this;var _0x247ba4={'id':_0x48a549['id'],'tls':{'rejectUnauthorized':![]}};if(_0x48a549[_0xdac2('0x3')]!=='custom'){_0x247ba4[_0xdac2('0x4')]=_0x48a549['provider'];}else{_0x247ba4[_0xdac2('0x5')]=_0x48a549[_0xdac2('0x6')][_0xdac2('0x5')];_0x247ba4[_0xdac2('0x7')]=_0x48a549['Smtp'][_0xdac2('0x7')];_0x247ba4[_0xdac2('0x8')]=_0x48a549[_0xdac2('0x6')][_0xdac2('0x8')];}if(_0x48a549[_0xdac2('0x6')][_0xdac2('0x9')]){if(_0x48a549[_0xdac2('0x6')][_0xdac2('0xa')]){if(!_0x48a549[_0xdac2('0x6')][_0xdac2('0xb')])throw new Error(_0xdac2('0xc'));_0x247ba4[_0xdac2('0xd')]={'type':_0xdac2('0xe'),'user':_0x48a549['Smtp']['user'],'accessToken':_0x48a549[_0xdac2('0x6')][_0xdac2('0xb')][_0xdac2('0xf')]};}else{_0x247ba4[_0xdac2('0xd')]={'user':_0x48a549['Smtp']['user'],'pass':_0x48a549[_0xdac2('0x6')][_0xdac2('0x10')]};}}return _0x247ba4;}}});}; \ No newline at end of file +var _0x0083=['custom','host','Smtp','port','authentication','modernAuthentication','CloudProvider','auth','user','data5','pass','./mailAccount.attributes','define','MailAccount','provider'];(function(_0x2d56c0,_0x3a6681){var _0x5c87fe=function(_0x539196){while(--_0x539196){_0x2d56c0['push'](_0x2d56c0['shift']());}};_0x5c87fe(++_0x3a6681);}(_0x0083,0x83));var _0x3008=function(_0x559ed8,_0x4d98b7){_0x559ed8=_0x559ed8-0x0;var _0x12cc24=_0x0083[_0x559ed8];return _0x12cc24;};'use strict';var attributes=require(_0x3008('0x0'));module['exports']=function(_0x28b828){return _0x28b828[_0x3008('0x1')](_0x3008('0x2'),attributes,{'tableName':'mail_accounts','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3392f5=this;var _0xefccb9={'id':_0x3392f5['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3392f5[_0x3008('0x3')]!==_0x3008('0x4')){_0xefccb9['service']=_0x3392f5[_0x3008('0x3')];}else{_0xefccb9[_0x3008('0x5')]=_0x3392f5[_0x3008('0x6')][_0x3008('0x5')];_0xefccb9['port']=_0x3392f5['Smtp'][_0x3008('0x7')];_0xefccb9['secure']=_0x3392f5['Smtp']['secure'];}if(_0x3392f5[_0x3008('0x6')][_0x3008('0x8')]){if(_0x3392f5[_0x3008('0x6')][_0x3008('0x9')]){if(!_0x3392f5[_0x3008('0x6')][_0x3008('0xa')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0xefccb9[_0x3008('0xb')]={'type':'OAuth2','user':_0x3392f5['Smtp'][_0x3008('0xc')],'accessToken':_0x3392f5[_0x3008('0x6')]['CloudProvider'][_0x3008('0xd')]};}else{_0xefccb9['auth']={'user':_0x3392f5[_0x3008('0x6')][_0x3008('0xc')],'pass':_0x3392f5[_0x3008('0x6')][_0x3008('0xe')]};}}return _0xefccb9;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 35ab5e1..5f92d13 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 _0x7579=['error','message','result','catch','GetMailAccount','options','raw','attributes','map','model','include','ShowMailAccount','MailAccount','find','smtp','setDataValue','NotifyMailAccount','body','mail','difference','keys','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','CmContact','MailApplication','Applications','Smtp','CloudProvider','get','account','omit','applications','orderBy','autoclose','push','length','close','*,*,*,*','Contacts','create','contact','messageId','generate','attach','YYYY-MM-DD\x20HH:mm:ss','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','subject','format','interaction','created','MailMessage','attachments','originTo','originCc','Attachment','Attachments','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1e4022,_0x2ce85a){var _0x51c0c2=function(_0x12431f){while(--_0x12431f){_0x1e4022['push'](_0x1e4022['shift']());}};_0x51c0c2(++_0x2ce85a);}(_0x7579,0x1e2));var _0x9757=function(_0x22b664,_0x1e1951){_0x22b664=_0x22b664-0x0;var _0x2d2109=_0x7579[_0x22b664];return _0x2d2109;};'use strict';var _=require(_0x9757('0x0'));var moment=require(_0x9757('0x1'));var BPromise=require(_0x9757('0x2'));var rs=require(_0x9757('0x3'));var Redis=require(_0x9757('0x4'));var db=require(_0x9757('0x5'))['db'];var logger=require('../../config/logger')(_0x9757('0x6'));var config=require(_0x9757('0x7'));var jayson=require(_0x9757('0x8'));var client=jayson[_0x9757('0x9')]['http']({'port':0x232c});config[_0x9757('0xa')]=_[_0x9757('0xb')](config[_0x9757('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9757('0xc'))(new Redis(config['redis']));require(_0x9757('0xd'))[_0x9757('0xe')](socket);function respondWithRpcPromise(_0x1b4bf0,_0x5b5749,_0x375d91){return new BPromise(function(_0x13f01a,_0x271207){return client[_0x9757('0xf')](_0x1b4bf0,_0x375d91)[_0x9757('0x10')](function(_0x399cca){logger[_0x9757('0x11')](_0x9757('0x12'),_0x5b5749,_0x9757('0x13'));logger[_0x9757('0x14')](_0x9757('0x15'),_0x5b5749,'request\x20sent',JSON[_0x9757('0x16')](_0x399cca));if(_0x399cca[_0x9757('0x17')]){if(_0x399cca[_0x9757('0x17')]['code']===0x1f4){logger[_0x9757('0x17')](_0x9757('0x12'),_0x5b5749,_0x399cca[_0x9757('0x17')][_0x9757('0x18')]);return _0x271207(_0x399cca[_0x9757('0x17')][_0x9757('0x18')]);}logger[_0x9757('0x17')]('MailAccount,\x20%s,\x20%s',_0x5b5749,_0x399cca[_0x9757('0x17')]['message']);return _0x13f01a(_0x399cca[_0x9757('0x17')][_0x9757('0x18')]);}else{logger[_0x9757('0x11')](_0x9757('0x12'),_0x5b5749,_0x9757('0x13'));_0x13f01a(_0x399cca[_0x9757('0x19')]['message']);}})[_0x9757('0x1a')](function(_0x2aa360){logger[_0x9757('0x17')](_0x9757('0x12'),_0x5b5749,_0x2aa360);_0x271207(_0x2aa360);});});}exports[_0x9757('0x1b')]=function(_0xd2306b){var _0x376e03=this;return new Promise(function(_0x593e43,_0x185506){return db['MailAccount']['findAll']({'raw':_0xd2306b[_0x9757('0x1c')]?_0xd2306b[_0x9757('0x1c')][_0x9757('0x1d')]===undefined?!![]:![]:!![],'where':_0xd2306b[_0x9757('0x1c')]?_0xd2306b['options']['where']||null:null,'attributes':_0xd2306b['options']?_0xd2306b[_0x9757('0x1c')][_0x9757('0x1e')]||null:null,'limit':_0xd2306b[_0x9757('0x1c')]?_0xd2306b[_0x9757('0x1c')]['limit']||null:null,'include':_0xd2306b[_0x9757('0x1c')]?_0xd2306b[_0x9757('0x1c')]['include']?_[_0x9757('0x1f')](_0xd2306b[_0x9757('0x1c')]['include'],function(_0x2b6915){return{'model':db[_0x2b6915[_0x9757('0x20')]],'as':_0x2b6915['as'],'attributes':_0x2b6915[_0x9757('0x1e')],'include':_0x2b6915[_0x9757('0x21')]?_[_0x9757('0x1f')](_0x2b6915[_0x9757('0x21')],function(_0x4e6b86){return{'model':db[_0x4e6b86[_0x9757('0x20')]],'as':_0x4e6b86['as'],'attributes':_0x4e6b86['attributes'],'include':_0x4e6b86[_0x9757('0x21')]?_[_0x9757('0x1f')](_0x4e6b86['include'],function(_0x490e10){return{'model':db[_0x490e10[_0x9757('0x20')]],'as':_0x490e10['as'],'attributes':_0x490e10[_0x9757('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9757('0x10')](function(_0x3aae8b){logger['info'](_0x9757('0x1b'),_0xd2306b);logger[_0x9757('0x14')](_0x9757('0x1b'),_0xd2306b,JSON[_0x9757('0x16')](_0x3aae8b));_0x593e43(_0x3aae8b);})[_0x9757('0x1a')](function(_0xa471a9){logger['error'](_0x9757('0x1b'),_0xa471a9[_0x9757('0x18')],_0xd2306b);_0x185506(_0x376e03[_0x9757('0x17')](0x1f4,_0xa471a9[_0x9757('0x18')]));});});};exports[_0x9757('0x22')]=function(_0x328c9e){var _0x115d93=this;return new Promise(function(_0x586e71,_0x335212){return db[_0x9757('0x23')][_0x9757('0x24')]({'raw':_0x328c9e[_0x9757('0x1c')]?_0x328c9e[_0x9757('0x1c')][_0x9757('0x1d')]===undefined?!![]:![]:!![],'where':_0x328c9e[_0x9757('0x1c')]?_0x328c9e[_0x9757('0x1c')]['where']||null:null,'attributes':_0x328c9e[_0x9757('0x1c')]?_0x328c9e['options'][_0x9757('0x1e')]||null:null,'include':_0x328c9e[_0x9757('0x1c')]?_0x328c9e['options'][_0x9757('0x21')]?_[_0x9757('0x1f')](_0x328c9e[_0x9757('0x1c')][_0x9757('0x21')],function(_0x459bcc){return{'model':db[_0x459bcc[_0x9757('0x20')]],'as':_0x459bcc['as'],'attributes':_0x459bcc[_0x9757('0x1e')],'include':_0x459bcc[_0x9757('0x21')]?_[_0x9757('0x1f')](_0x459bcc[_0x9757('0x21')],function(_0x594c50){return{'model':db[_0x594c50[_0x9757('0x20')]],'as':_0x594c50['as'],'attributes':_0x594c50[_0x9757('0x1e')],'include':_0x594c50[_0x9757('0x21')]?_['map'](_0x594c50[_0x9757('0x21')],function(_0x2c2e5f){return{'model':db[_0x2c2e5f[_0x9757('0x20')]],'as':_0x2c2e5f['as'],'attributes':_0x2c2e5f[_0x9757('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9757('0x10')](function(_0x959db3){if(_0x328c9e[_0x9757('0x1c')][_0x9757('0x25')]===!![])_0x959db3[_0x9757('0x26')]('smtpOptions',_0x959db3['getSmtpOptions']());logger[_0x9757('0x11')](_0x9757('0x22'),_0x328c9e);logger[_0x9757('0x14')](_0x9757('0x22'),_0x328c9e,JSON['stringify'](_0x959db3));_0x586e71(_0x959db3);})[_0x9757('0x1a')](function(_0x4dfa93){logger[_0x9757('0x17')](_0x9757('0x22'),_0x4dfa93[_0x9757('0x18')],_0x328c9e);_0x335212(_0x115d93['error'](0x1f4,_0x4dfa93[_0x9757('0x18')]));});});};exports[_0x9757('0x27')]=function(_0x3d98c8){var _0x5d143b=this;return new Promise(function(_0x37b223,_0x5eea8b){var _0x50f0e4={'body':_0x3d98c8[_0x9757('0x28')],'channel':_0x9757('0x29')};var _0x3765e7=_[_0x9757('0x2a')](_[_0x9757('0x2b')](db['CmContact']['rawAttributes']),['createdAt',_0x9757('0x2c'),_0x9757('0x2d'),_0x9757('0x2e')]);var _0x596d57=![];if(_0x3d98c8[_0x9757('0x28')]['id']){delete _0x3d98c8[_0x9757('0x28')]['id'];}if(_['isNil'](_0x3d98c8[_0x9757('0x28')][_0x9757('0x2f')])){return _0x5eea8b(_0x5d143b[_0x9757('0x17')](0x1f4,_0x9757('0x30')));}if(_['isNil'](_0x3d98c8[_0x9757('0x28')][_0x9757('0x28')])||_0x3d98c8[_0x9757('0x28')][_0x9757('0x28')]===''){return _0x5eea8b(_0x5d143b[_0x9757('0x17')](0x1f4,_0x9757('0x31')));}if(_[_0x9757('0x32')](_0x3d98c8[_0x9757('0x28')][_0x9757('0x33')])){return _0x5eea8b(_0x5d143b['error'](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x3765e7));}if(!_[_0x9757('0x34')](_0x3765e7,_0x3d98c8[_0x9757('0x28')][_0x9757('0x33')])){return _0x5eea8b(_0x5d143b['error'](0x1f4,_0x9757('0x35')+_0x3765e7));}var _0x20413a={};_0x20413a[_0x3d98c8[_0x9757('0x28')]['mapKey']]=_0x3d98c8[_0x9757('0x28')][_0x9757('0x2f')];return db['MailAccount']['find']({'where':{'id':_0x3d98c8['account']['id']},'include':[{'model':db[_0x9757('0x36')],'as':_0x9757('0x37'),'include':[{'model':db[_0x9757('0x38')],'as':'Contacts','where':_0x20413a,'limit':0x1,'order':[[_0x9757('0x2c'),'DESC']]}]},{'model':db[_0x9757('0x39')],'as':_0x9757('0x3a')},{'model':db['MailServerOut'],'as':_0x9757('0x3b'),'include':[{'model':db[_0x9757('0x3c')],'as':_0x9757('0x3c')}]}]})[_0x9757('0x10')](function(_0x118d02){if(_0x118d02&&_0x118d02['List']){var _0x820ace=_0x118d02[_0x9757('0x3d')]({'plain':!![]});_0x50f0e4[_0x9757('0x3e')]=_[_0x9757('0x3f')](_0x820ace,[_0x9757('0x3a'),_0x9757('0x37')]);_0x50f0e4[_0x9757('0x3e')]['smtpOptions']=_0x118d02['getSmtpOptions']();_0x50f0e4[_0x9757('0x40')]=_0x820ace['Applications'];_0x50f0e4['list']=_0x820ace[_0x9757('0x37')];_0x50f0e4['applications']=_[_0x9757('0x41')](_0x50f0e4[_0x9757('0x40')],['priority'],['asc']);if(_0x50f0e4[_0x9757('0x3e')]&&_0x50f0e4['account'][_0x9757('0x42')]){_0x50f0e4['applications'][_0x9757('0x43')]({'id':0x0,'priority':_0x50f0e4['applications'][_0x9757('0x44')]+0x1,'app':_0x9757('0x45'),'appdata':_0x9757('0x42'),'interval':_0x9757('0x46')});}if(_0x50f0e4[_0x9757('0x3e')][_0x9757('0x3a')]){delete _0x50f0e4[_0x9757('0x3e')][_0x9757('0x3a')];}if(_0x50f0e4['account'][_0x9757('0x37')]){delete _0x50f0e4[_0x9757('0x3e')][_0x9757('0x37')];}if(_0x820ace[_0x9757('0x37')][_0x9757('0x47')][_0x9757('0x44')]){return _0x820ace[_0x9757('0x37')][_0x9757('0x47')][0x0];}var _0x296333=_[_0x9757('0xb')](_0x3d98c8[_0x9757('0x28')],{'firstName':_0x3d98c8[_0x9757('0x28')][_0x9757('0x2f')],'ListId':_0x820ace['ListId']});_0x296333[_0x3d98c8['body'][_0x9757('0x33')]]=_0x3d98c8['body'][_0x9757('0x2f')];return db[_0x9757('0x38')][_0x9757('0x48')](_0x296333);}else{throw new Error('List\x20not\x20found');}})[_0x9757('0x10')](function(_0x338370){_0x50f0e4[_0x9757('0x49')]=_0x338370;if(_0x338370){if(!_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')]){_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')]=rs[_0x9757('0x4b')]()+'\x20'+_0x3d98c8[_0x9757('0x28')]['message'][_0x9757('0x2f')];}var _0x3bc9f5={'ContactId':_0x338370['id'],'MailAccountId':_0x3d98c8[_0x9757('0x3e')]['id'],'inReplyTo':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')],'to':_0x3d98c8[_0x9757('0x28')]['message'][_0x9757('0x2f')],'cc':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['cc'],'subject':_0x3d98c8['body']['message']['subject'],'attach':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4c')],'lastMsgAt':moment()['format'](_0x9757('0x4d')),'lastMsgDirection':'in'};return db['MailInteraction'][_0x9757('0x24')]({'where':{'closed':![],'MailAccountId':_0x3d98c8['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x9757('0x4e'),'attributes':[_0x9757('0x4a')],'where':{'messageId':_0x3d98c8[_0x9757('0x28')]['message'][_0x9757('0x4f')]}}]})[_0x9757('0x10')](function(_0x38caa3){if(_0x38caa3){return[_0x38caa3,![]];}return db[_0x9757('0x50')][_0x9757('0x48')](_0x3bc9f5)[_0x9757('0x10')](function(_0x3e2119){return[_0x3e2119,!![]];});});}else{throw new Error(_0x9757('0x51'));}})['spread'](function(_0x4df00e,_0x5b6c80){if(_0x4df00e){_0x596d57=_0x5b6c80;if(!_0x5b6c80){return _0x4df00e['update']({'inReplyTo':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4a')],'to':_0x3d98c8[_0x9757('0x28')]['message']['from'],'cc':_0x3d98c8[_0x9757('0x28')]['message']['cc'],'subject':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x52')],'attach':_0x4df00e[_0x9757('0x4c')]?_0x4df00e[_0x9757('0x4c')]:_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4c')],'substatus':null,'substatusAt':moment()[_0x9757('0x53')](_0x9757('0x4d')),'lastMsgAt':moment()[_0x9757('0x53')](_0x9757('0x4d')),'lastMsgDirection':'in'});}else{return _0x4df00e;}}})[_0x9757('0x10')](function(_0x104fbb){_0x50f0e4['interaction']=_0x104fbb[_0x9757('0x3d')]({'plain':!![]});_0x50f0e4[_0x9757('0x54')][_0x9757('0x55')]=_0x596d57;return db[_0x9757('0x56')][_0x9757('0x48')]({'body':_0x3d98c8[_0x9757('0x28')][_0x9757('0x28')],'MailAccountId':_0x3d98c8['account']['id'],'MailInteractionId':_0x104fbb['id'],'direction':'in','ContactId':_0x50f0e4[_0x9757('0x49')]['id'],'messageId':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['messageId'],'from':_0x3d98c8['body'][_0x9757('0x18')]['from'],'to':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['to'],'cc':_0x3d98c8[_0x9757('0x28')]['message']['cc'],'subject':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x52')],'attach':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x4c')],'Attachments':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x57')],'originTo':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')][_0x9757('0x58')],'originCc':_0x3d98c8['body']['message'][_0x9757('0x59')],'bcc':_0x3d98c8[_0x9757('0x28')]['message']['bcc'],'ChatWebsiteId':_0x3d98c8[_0x9757('0x28')]['message']['ChatWebsiteId']||null,'originChannel':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['originChannel']||'Email','ChatOfflineMessageId':_0x3d98c8[_0x9757('0x28')][_0x9757('0x18')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x9757('0x5a')],'as':_0x9757('0x5b')}]});})[_0x9757('0x10')](function(_0x2fe5c5){_0x50f0e4['message']=_0x2fe5c5;if(!_0x50f0e4[_0x9757('0x54')][_0x9757('0x5c')]){return;}return db[_0x9757('0x5d')][_0x9757('0x24')]({'attributes':['id',_0x9757('0x5e')],'where':{'id':_0x50f0e4[_0x9757('0x54')][_0x9757('0x5c')]}});})['then'](function(_0x3fe6c7){if(_0x3fe6c7){_0x50f0e4[_0x9757('0x40')][_0x9757('0x5f')]({'id':0x0,'priority':0x0,'app':_0x9757('0x60'),'appdata':_0x3fe6c7[_0x9757('0x5e')]+','+(_0x50f0e4['account'][_0x9757('0x61')]||0xa),'interval':_0x9757('0x46')});}if(!_0x50f0e4[_0x9757('0x54')][_0x9757('0x62')]){return;}return db[_0x9757('0x63')][_0x9757('0x24')]({'attributes':['id',_0x9757('0x5e')],'where':{'id':_0x50f0e4['interaction']['queueId']}});})[_0x9757('0x10')](function(_0x48f208){if(_0x48f208){_0x50f0e4[_0x9757('0x40')]['unshift']({'id':0x0,'priority':0x1,'app':_0x9757('0x64'),'appdata':_0x48f208[_0x9757('0x5e')]+','+(_0x50f0e4[_0x9757('0x3e')]['waitForTheAssignedQueue']||0x12c),'interval':_0x9757('0x46')});}return respondWithRpcPromise('Start','startRouting',_0x50f0e4);})[_0x9757('0x10')](function(_0x179f48){_0x37b223(_0x179f48);})[_0x9757('0x1a')](function(_0x212c5d){_0x5eea8b(_0x5d143b[_0x9757('0x17')](0x1f4,_0x212c5d[_0x9757('0x18')]));});});}; \ No newline at end of file +var _0x07e8=['Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','List','list','applications','orderBy','priority','asc','autoclose','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','format','MailInteraction','MailMessage','Messages','Contact\x20not\x20found','spread','update','attach','YYYY-MM-DD\x20HH:mm:ss','interaction','get','attachments','originTo','originCc','ChatWebsiteId','originChannel','Email','Attachment','UserId','unshift','name','queueId','MailQueue','queue','Start','startRouting','lodash','moment','bluebird','ioredis','../../config/logger','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','raw','options','where','attributes','limit','include','map','model','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x07e8,0x10f));var _0x807e=function(_0xc5aa42,_0x1bdaa2){_0xc5aa42=_0xc5aa42-0x0;var _0x221d83=_0x07e8[_0xc5aa42];return _0x221d83;};'use strict';var _=require(_0x807e('0x0'));var moment=require(_0x807e('0x1'));var BPromise=require(_0x807e('0x2'));var rs=require('randomstring');var Redis=require(_0x807e('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x807e('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x807e('0x5'));var client=jayson[_0x807e('0x6')][_0x807e('0x7')]({'port':0x232c});config['redis']=_[_0x807e('0x8')](config[_0x807e('0x9')],{'host':_0x807e('0xa'),'port':0x18eb});var socket=require(_0x807e('0xb'))(new Redis(config[_0x807e('0x9')]));require('./mailAccount.socket')[_0x807e('0xc')](socket);function respondWithRpcPromise(_0x348133,_0x400374,_0x3c6c7a){return new BPromise(function(_0x1c2fdd,_0x45e953){return client[_0x807e('0xd')](_0x348133,_0x3c6c7a)[_0x807e('0xe')](function(_0x2521da){logger[_0x807e('0xf')](_0x807e('0x10'),_0x400374,_0x807e('0x11'));logger[_0x807e('0x12')](_0x807e('0x13'),_0x400374,'request\x20sent',JSON[_0x807e('0x14')](_0x2521da));if(_0x2521da[_0x807e('0x15')]){if(_0x2521da[_0x807e('0x15')][_0x807e('0x16')]===0x1f4){logger[_0x807e('0x15')](_0x807e('0x10'),_0x400374,_0x2521da[_0x807e('0x15')]['message']);return _0x45e953(_0x2521da['error'][_0x807e('0x17')]);}logger[_0x807e('0x15')](_0x807e('0x10'),_0x400374,_0x2521da[_0x807e('0x15')]['message']);return _0x1c2fdd(_0x2521da[_0x807e('0x15')][_0x807e('0x17')]);}else{logger[_0x807e('0xf')](_0x807e('0x10'),_0x400374,_0x807e('0x11'));_0x1c2fdd(_0x2521da[_0x807e('0x18')]['message']);}})[_0x807e('0x19')](function(_0x57af7a){logger[_0x807e('0x15')](_0x807e('0x10'),_0x400374,_0x57af7a);_0x45e953(_0x57af7a);});});}exports[_0x807e('0x1a')]=function(_0x45d67d){var _0x3fba0b=this;return new Promise(function(_0xad3e35,_0x1e39ef){return db[_0x807e('0x1b')][_0x807e('0x1c')]({'raw':_0x45d67d['options']?_0x45d67d['options'][_0x807e('0x1d')]===undefined?!![]:![]:!![],'where':_0x45d67d[_0x807e('0x1e')]?_0x45d67d[_0x807e('0x1e')][_0x807e('0x1f')]||null:null,'attributes':_0x45d67d[_0x807e('0x1e')]?_0x45d67d[_0x807e('0x1e')][_0x807e('0x20')]||null:null,'limit':_0x45d67d[_0x807e('0x1e')]?_0x45d67d['options'][_0x807e('0x21')]||null:null,'include':_0x45d67d[_0x807e('0x1e')]?_0x45d67d[_0x807e('0x1e')][_0x807e('0x22')]?_[_0x807e('0x23')](_0x45d67d[_0x807e('0x1e')]['include'],function(_0x277560){return{'model':db[_0x277560['model']],'as':_0x277560['as'],'attributes':_0x277560[_0x807e('0x20')],'include':_0x277560[_0x807e('0x22')]?_[_0x807e('0x23')](_0x277560['include'],function(_0x36bb30){return{'model':db[_0x36bb30[_0x807e('0x24')]],'as':_0x36bb30['as'],'attributes':_0x36bb30[_0x807e('0x20')],'include':_0x36bb30[_0x807e('0x22')]?_[_0x807e('0x23')](_0x36bb30[_0x807e('0x22')],function(_0x4cc948){return{'model':db[_0x4cc948[_0x807e('0x24')]],'as':_0x4cc948['as'],'attributes':_0x4cc948['attributes']};}):[]};}):[]};}):[]:[]})[_0x807e('0xe')](function(_0x285e27){logger[_0x807e('0xf')]('GetMailAccount',_0x45d67d);logger[_0x807e('0x12')](_0x807e('0x1a'),_0x45d67d,JSON['stringify'](_0x285e27));_0xad3e35(_0x285e27);})[_0x807e('0x19')](function(_0x11fc8d){logger['error'](_0x807e('0x1a'),_0x11fc8d[_0x807e('0x17')],_0x45d67d);_0x1e39ef(_0x3fba0b[_0x807e('0x15')](0x1f4,_0x11fc8d[_0x807e('0x17')]));});});};exports[_0x807e('0x25')]=function(_0x2a45d8){var _0x493c2a=this;return new Promise(function(_0x50a728,_0xc7c64c){return db[_0x807e('0x1b')][_0x807e('0x26')]({'raw':_0x2a45d8[_0x807e('0x1e')]?_0x2a45d8[_0x807e('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x2a45d8['options']?_0x2a45d8[_0x807e('0x1e')][_0x807e('0x1f')]||null:null,'attributes':_0x2a45d8['options']?_0x2a45d8[_0x807e('0x1e')][_0x807e('0x20')]||null:null,'include':_0x2a45d8[_0x807e('0x1e')]?_0x2a45d8[_0x807e('0x1e')][_0x807e('0x22')]?_[_0x807e('0x23')](_0x2a45d8[_0x807e('0x1e')][_0x807e('0x22')],function(_0x1632a7){return{'model':db[_0x1632a7[_0x807e('0x24')]],'as':_0x1632a7['as'],'attributes':_0x1632a7['attributes'],'include':_0x1632a7[_0x807e('0x22')]?_[_0x807e('0x23')](_0x1632a7[_0x807e('0x22')],function(_0x498301){return{'model':db[_0x498301[_0x807e('0x24')]],'as':_0x498301['as'],'attributes':_0x498301[_0x807e('0x20')],'include':_0x498301[_0x807e('0x22')]?_['map'](_0x498301['include'],function(_0x266017){return{'model':db[_0x266017['model']],'as':_0x266017['as'],'attributes':_0x266017['attributes']};}):[]};}):[]};}):[]:[]})[_0x807e('0xe')](function(_0x703909){if(_0x2a45d8[_0x807e('0x1e')][_0x807e('0x27')]===!![])_0x703909[_0x807e('0x28')](_0x807e('0x29'),_0x703909[_0x807e('0x2a')]());logger[_0x807e('0xf')](_0x807e('0x25'),_0x2a45d8);logger['debug']('ShowMailAccount',_0x2a45d8,JSON[_0x807e('0x14')](_0x703909));_0x50a728(_0x703909);})['catch'](function(_0x2e3eb4){logger[_0x807e('0x15')](_0x807e('0x25'),_0x2e3eb4['message'],_0x2a45d8);_0xc7c64c(_0x493c2a[_0x807e('0x15')](0x1f4,_0x2e3eb4[_0x807e('0x17')]));});});};exports[_0x807e('0x2b')]=function(_0x160a5c){var _0x56d88b=this;return new Promise(function(_0x53a3d0,_0x3a8eae){var _0x4da2b5={'body':_0x160a5c[_0x807e('0x2c')],'channel':_0x807e('0x2d')};var _0x47d331=_['difference'](_[_0x807e('0x2e')](db[_0x807e('0x2f')][_0x807e('0x30')]),[_0x807e('0x31'),_0x807e('0x32'),_0x807e('0x33'),_0x807e('0x34')]);var _0x904874=![];if(_0x160a5c[_0x807e('0x2c')]['id']){delete _0x160a5c[_0x807e('0x2c')]['id'];}if(_[_0x807e('0x35')](_0x160a5c[_0x807e('0x2c')][_0x807e('0x36')])){return _0x3a8eae(_0x56d88b['error'](0x1f4,_0x807e('0x37')));}if(_['isNil'](_0x160a5c[_0x807e('0x2c')][_0x807e('0x2c')])||_0x160a5c['body'][_0x807e('0x2c')]===''){return _0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_['isNil'](_0x160a5c['body']['mapKey'])){return _0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,_0x807e('0x38')+_0x47d331));}if(!_[_0x807e('0x39')](_0x47d331,_0x160a5c[_0x807e('0x2c')][_0x807e('0x3a')])){return _0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,_0x807e('0x3b')+_0x47d331));}var _0x58185a={};_0x58185a[_0x160a5c['body']['mapKey']]=_0x160a5c[_0x807e('0x2c')][_0x807e('0x36')];return db[_0x807e('0x1b')][_0x807e('0x26')]({'where':{'id':_0x160a5c[_0x807e('0x3c')]['id']},'include':[{'model':db[_0x807e('0x3d')],'as':'List','include':[{'model':db[_0x807e('0x2f')],'as':_0x807e('0x3e'),'where':_0x58185a,'limit':0x1,'order':[[_0x807e('0x32'),_0x807e('0x3f')]]}]},{'model':db[_0x807e('0x40')],'as':_0x807e('0x41')},{'model':db[_0x807e('0x42')],'as':_0x807e('0x43'),'include':[{'model':db[_0x807e('0x44')],'as':_0x807e('0x44')}]}]})[_0x807e('0xe')](function(_0x5b41ac){if(_0x5b41ac&&_0x5b41ac['List']){var _0x2a353f=_0x5b41ac['get']({'plain':!![]});_0x4da2b5['account']=_['omit'](_0x2a353f,['Applications',_0x807e('0x45')]);_0x4da2b5['account'][_0x807e('0x29')]=_0x5b41ac[_0x807e('0x2a')]();_0x4da2b5['applications']=_0x2a353f[_0x807e('0x41')];_0x4da2b5[_0x807e('0x46')]=_0x2a353f[_0x807e('0x45')];_0x4da2b5[_0x807e('0x47')]=_[_0x807e('0x48')](_0x4da2b5[_0x807e('0x47')],[_0x807e('0x49')],[_0x807e('0x4a')]);if(_0x4da2b5[_0x807e('0x3c')]&&_0x4da2b5[_0x807e('0x3c')][_0x807e('0x4b')]){_0x4da2b5[_0x807e('0x47')]['push']({'id':0x0,'priority':_0x4da2b5['applications']['length']+0x1,'app':_0x807e('0x4c'),'appdata':_0x807e('0x4b'),'interval':_0x807e('0x4d')});}if(_0x4da2b5[_0x807e('0x3c')][_0x807e('0x41')]){delete _0x4da2b5[_0x807e('0x3c')][_0x807e('0x41')];}if(_0x4da2b5[_0x807e('0x3c')][_0x807e('0x45')]){delete _0x4da2b5[_0x807e('0x3c')][_0x807e('0x45')];}if(_0x2a353f['List'][_0x807e('0x3e')][_0x807e('0x4e')]){return _0x2a353f[_0x807e('0x45')]['Contacts'][0x0];}var _0x2f585d=_[_0x807e('0x8')](_0x160a5c[_0x807e('0x2c')],{'firstName':_0x160a5c[_0x807e('0x2c')]['from'],'ListId':_0x2a353f['ListId']});_0x2f585d[_0x160a5c[_0x807e('0x2c')]['mapKey']]=_0x160a5c[_0x807e('0x2c')]['from'];return db[_0x807e('0x2f')][_0x807e('0x4f')](_0x2f585d);}else{throw new Error(_0x807e('0x50'));}})[_0x807e('0xe')](function(_0x469c0e){_0x4da2b5[_0x807e('0x51')]=_0x469c0e;if(_0x469c0e){if(!_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x52')]){_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x52')]=rs[_0x807e('0x53')]()+'\x20'+_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')];}var _0x1532de={'ContactId':_0x469c0e['id'],'MailAccountId':_0x160a5c['account']['id'],'inReplyTo':_0x160a5c['body'][_0x807e('0x17')][_0x807e('0x52')],'to':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')],'cc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['cc'],'subject':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x54')],'attach':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['attach'],'lastMsgAt':moment()[_0x807e('0x55')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x807e('0x56')][_0x807e('0x26')]({'where':{'closed':![],'MailAccountId':_0x160a5c[_0x807e('0x3c')]['id']},'include':[{'model':db[_0x807e('0x57')],'as':_0x807e('0x58'),'attributes':[_0x807e('0x52')],'where':{'messageId':_0x160a5c['body'][_0x807e('0x17')]['inReplyTo']}}]})[_0x807e('0xe')](function(_0x4b2ab2){if(_0x4b2ab2){return[_0x4b2ab2,![]];}return db[_0x807e('0x56')][_0x807e('0x4f')](_0x1532de)['then'](function(_0x4bc144){return[_0x4bc144,!![]];});});}else{throw new Error(_0x807e('0x59'));}})[_0x807e('0x5a')](function(_0x545cdc,_0x11918b){if(_0x545cdc){_0x904874=_0x11918b;if(!_0x11918b){return _0x545cdc[_0x807e('0x5b')]({'inReplyTo':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['messageId'],'to':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')],'cc':_0x160a5c[_0x807e('0x2c')]['message']['cc'],'subject':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x54')],'attach':_0x545cdc[_0x807e('0x5c')]?_0x545cdc[_0x807e('0x5c')]:_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x5c')],'substatus':null,'substatusAt':moment()['format'](_0x807e('0x5d')),'lastMsgAt':moment()[_0x807e('0x55')](_0x807e('0x5d')),'lastMsgDirection':'in'});}else{return _0x545cdc;}}})[_0x807e('0xe')](function(_0x4207a3){_0x4da2b5[_0x807e('0x5e')]=_0x4207a3[_0x807e('0x5f')]({'plain':!![]});_0x4da2b5[_0x807e('0x5e')]['created']=_0x904874;return db[_0x807e('0x57')]['create']({'body':_0x160a5c[_0x807e('0x2c')]['body'],'MailAccountId':_0x160a5c['account']['id'],'MailInteractionId':_0x4207a3['id'],'direction':'in','ContactId':_0x4da2b5['contact']['id'],'messageId':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['messageId'],'from':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x36')],'to':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['to'],'cc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['cc'],'subject':_0x160a5c['body'][_0x807e('0x17')]['subject'],'attach':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x5c')],'Attachments':_0x160a5c['body']['message'][_0x807e('0x60')],'originTo':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x61')],'originCc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x62')],'bcc':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['bcc'],'ChatWebsiteId':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x63')]||null,'originChannel':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')][_0x807e('0x64')]||_0x807e('0x65'),'ChatOfflineMessageId':_0x160a5c[_0x807e('0x2c')][_0x807e('0x17')]['ChatOfflineMessageId']||null},{'include':[{'model':db[_0x807e('0x66')],'as':'Attachments'}]});})[_0x807e('0xe')](function(_0xd00729){_0x4da2b5[_0x807e('0x17')]=_0xd00729;if(!_0x4da2b5[_0x807e('0x5e')][_0x807e('0x67')]){return;}return db['User'][_0x807e('0x26')]({'attributes':['id','name'],'where':{'id':_0x4da2b5[_0x807e('0x5e')][_0x807e('0x67')]}});})['then'](function(_0x1ddf23){if(_0x1ddf23){_0x4da2b5[_0x807e('0x47')][_0x807e('0x68')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1ddf23[_0x807e('0x69')]+','+(_0x4da2b5[_0x807e('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0x807e('0x4d')});}if(!_0x4da2b5[_0x807e('0x5e')][_0x807e('0x6a')]){return;}return db[_0x807e('0x6b')]['find']({'attributes':['id',_0x807e('0x69')],'where':{'id':_0x4da2b5[_0x807e('0x5e')][_0x807e('0x6a')]}});})[_0x807e('0xe')](function(_0x5ee542){if(_0x5ee542){_0x4da2b5[_0x807e('0x47')][_0x807e('0x68')]({'id':0x0,'priority':0x1,'app':_0x807e('0x6c'),'appdata':_0x5ee542[_0x807e('0x69')]+','+(_0x4da2b5['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x807e('0x4d')});}return respondWithRpcPromise(_0x807e('0x6d'),_0x807e('0x6e'),_0x4da2b5);})[_0x807e('0xe')](function(_0x4463b6){_0x53a3d0(_0x4463b6);})[_0x807e('0x19')](function(_0x4e6968){_0x3a8eae(_0x56d88b[_0x807e('0x15')](0x1f4,_0x4e6968['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 033567e..bb36481 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 _0xc808=['emit','removeListener','register','mailAccount:','./mailAccount.events','save','remove'];(function(_0x3d6e22,_0x4a2205){var _0x2d2580=function(_0x1330d5){while(--_0x1330d5){_0x3d6e22['push'](_0x3d6e22['shift']());}};_0x2d2580(++_0x4a2205);}(_0xc808,0x97));var _0x8c80=function(_0x4d3187,_0x267c51){_0x4d3187=_0x4d3187-0x0;var _0x107906=_0xc808[_0x4d3187];return _0x107906;};'use strict';var MailAccountEvents=require(_0x8c80('0x0'));var events=[_0x8c80('0x1'),_0x8c80('0x2'),'update'];function createListener(_0xbd6121,_0x1dd73c){return function(_0x139a4e){_0x1dd73c[_0x8c80('0x3')](_0xbd6121,_0x139a4e);};}function removeListener(_0x27f9f5,_0x3e6da3){return function(){MailAccountEvents[_0x8c80('0x4')](_0x27f9f5,_0x3e6da3);};}exports[_0x8c80('0x5')]=function(_0x198d66){for(var _0x44d226=0x0,_0x532fd8=events['length'];_0x44d226<_0x532fd8;_0x44d226++){var _0xf929ab=events[_0x44d226];var _0x5468a3=createListener(_0x8c80('0x6')+_0xf929ab,_0x198d66);MailAccountEvents['on'](_0xf929ab,_0x5468a3);}}; \ No newline at end of file +var _0x226b=['mailAccount:','./mailAccount.events','save','remove','update','removeListener','register','length'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x226b,0x161));var _0xb226=function(_0x29036f,_0x3271bf){_0x29036f=_0x29036f-0x0;var _0x3afb87=_0x226b[_0x29036f];return _0x3afb87;};'use strict';var MailAccountEvents=require(_0xb226('0x0'));var events=[_0xb226('0x1'),_0xb226('0x2'),_0xb226('0x3')];function createListener(_0x5e61be,_0x420263){return function(_0x30304e){_0x420263['emit'](_0x5e61be,_0x30304e);};}function removeListener(_0x34db55,_0x3e6a8c){return function(){MailAccountEvents[_0xb226('0x4')](_0x34db55,_0x3e6a8c);};}exports[_0xb226('0x5')]=function(_0x1db1ba){for(var _0x34fd11=0x0,_0x3fd6bc=events[_0xb226('0x6')];_0x34fd11<_0x3fd6bc;_0x34fd11++){var _0x450420=events[_0x34fd11];var _0x5ee216=createListener(_0xb226('0x7')+_0x450420,_0x1db1ba);MailAccountEvents['on'](_0x450420,_0x5ee216);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index cd99090..8f56c8e 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 _0xad4b=['update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./mailApplication.controller','get','/:id','put','isAuthenticated'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xad4b,0x1e2));var _0xbad4=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xad4b[_0x21aec3];return _0x288bbc;};'use strict';var multer=require(_0xbad4('0x0'));var util=require(_0xbad4('0x1'));var path=require(_0xbad4('0x2'));var timeout=require(_0xbad4('0x3'));var express=require(_0xbad4('0x4'));var router=express[_0xbad4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbad4('0x6'));var interaction=require(_0xbad4('0x7'));var config=require('../../config/environment');var controller=require(_0xbad4('0x8'));router[_0xbad4('0x9')](_0xbad4('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xbad4('0xb')](_0xbad4('0xa'),auth[_0xbad4('0xc')](),controller[_0xbad4('0xd')]);router['delete'](_0xbad4('0xa'),auth[_0xbad4('0xc')](),controller['destroy']);module[_0xbad4('0xe')]=router; \ No newline at end of file +var _0xe144=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','put','/:id','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x3119e7,_0x1d1253){var _0x49640d=function(_0xac293d){while(--_0xac293d){_0x3119e7['push'](_0x3119e7['shift']());}};_0x49640d(++_0x1d1253);}(_0xe144,0x1ec));var _0x4e14=function(_0x4ef734,_0x5826d){_0x4ef734=_0x4ef734-0x0;var _0x33a7cb=_0xe144[_0x4ef734];return _0x33a7cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4e14('0x0'));var timeout=require(_0x4e14('0x1'));var express=require(_0x4e14('0x2'));var router=express[_0x4e14('0x3')]();var fs_extra=require(_0x4e14('0x4'));var auth=require(_0x4e14('0x5'));var interaction=require(_0x4e14('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x4e14('0x7')]('/:id',auth[_0x4e14('0x8')](),controller['show']);router[_0x4e14('0x9')](_0x4e14('0xa'),auth['isAuthenticated'](),controller[_0x4e14('0xb')]);router[_0x4e14('0xc')]('/:id',auth[_0x4e14('0x8')](),controller[_0x4e14('0xd')]);module[_0x4e14('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0069e0d..58915ea 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 _0xc28e=['exports','INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x4847db,_0x2065fe){var _0x49793f=function(_0x39c632){while(--_0x39c632){_0x4847db['push'](_0x4847db['shift']());}};_0x49793f(++_0x2065fe);}(_0xc28e,0xef));var _0xec28=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xc28e[_0x1db251];return _0x56685a;};'use strict';var Sequelize=require(_0xec28('0x0'));module[_0xec28('0x1')]={'priority':{'type':Sequelize[_0xec28('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xec28('0x3')],'allowNull':![],'defaultValue':_0xec28('0x4')},'appdata':{'type':Sequelize[_0xec28('0x5')]()},'description':{'type':Sequelize[_0xec28('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x6299=['STRING','noop','TEXT','sequelize','exports','INTEGER'];(function(_0x32c154,_0xfd915b){var _0x43a11a=function(_0x4e170c){while(--_0x4e170c){_0x32c154['push'](_0x32c154['shift']());}};_0x43a11a(++_0xfd915b);}(_0x6299,0x1d7));var _0x9629=function(_0x551f37,_0x5273ae){_0x551f37=_0x551f37-0x0;var _0x1cd90e=_0x6299[_0x551f37];return _0x1cd90e;};'use strict';var Sequelize=require(_0x9629('0x0'));module[_0x9629('0x1')]={'priority':{'type':Sequelize[_0x9629('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9629('0x3')],'allowNull':![],'defaultValue':_0x9629('0x4')},'appdata':{'type':Sequelize[_0x9629('0x5')]()},'description':{'type':Sequelize[_0x9629('0x3')]},'interval':{'type':Sequelize[_0x9629('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index dd5f3de..aa81a17 100644 --- a/server/api/mailApplication/mailApplication.controller.js +++ b/server/api/mailApplication/mailApplication.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb43b=['name','status','send','show','params','keys','MailApplication','rawAttributes','query','intersection','model','fields','attributes','length','includeAll','merge','options','find','then','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','undefined','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','sendStatus'];(function(_0x5d2db0,_0x5de79c){var _0x42e33e=function(_0x3ceef0){while(--_0x3ceef0){_0x5d2db0['push'](_0x5d2db0['shift']());}};_0x42e33e(++_0x5de79c);}(_0xb43b,0x1b2));var _0xbb43=function(_0x50b543,_0x3fbafa){_0x50b543=_0x50b543-0x0;var _0x1fecf5=_0xb43b[_0x50b543];return _0x1fecf5;};'use strict';var emlformat=require(_0xbb43('0x0'));var rimraf=require(_0xbb43('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbb43('0x2'));var rp=require(_0xbb43('0x3'));var moment=require(_0xbb43('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xbb43('0x5'));var util=require(_0xbb43('0x6'));var path=require(_0xbb43('0x7'));var sox=require(_0xbb43('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb43('0x9'));var _=require('lodash');var squel=require(_0xbb43('0xa'));var crypto=require(_0xbb43('0xb'));var jsforce=require(_0xbb43('0xc'));var deskjs=require(_0xbb43('0xd'));var toCsv=require(_0xbb43('0xe'));var querystring=require('querystring');var Papa=require(_0xbb43('0xf'));var Redis=require(_0xbb43('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbb43('0x11'));var as=require(_0xbb43('0x12'));var hardwareService=require(_0xbb43('0x13'));var logger=require(_0xbb43('0x14'))(_0xbb43('0x15'));var utils=require(_0xbb43('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xbb43('0x17'));var db=require(_0xbb43('0x18'))['db'];function respondWithStatusCode(_0x50e2c0,_0x578392){_0x578392=_0x578392||0xcc;return function(_0x41e7e5){if(_0x41e7e5){return _0x50e2c0['sendStatus'](_0x578392);}return _0x50e2c0['status'](_0x578392)[_0xbb43('0x19')]();};}function respondWithResult(_0x5a509f,_0x68d45d){_0x68d45d=_0x68d45d||0xc8;return function(_0x43021d){if(_0x43021d){return _0x5a509f['status'](_0x68d45d)['json'](_0x43021d);}};}function respondWithFilteredResult(_0x4d5bcf,_0x338120){return function(_0x2abce0){if(_0x2abce0){var _0x57bd1d=typeof _0x338120['offset']===_0xbb43('0x1a')&&typeof _0x338120['limit']==='undefined';var _0x2b0797=_0x2abce0[_0xbb43('0x1b')];var _0x2e3b43=_0x57bd1d?0x0:_0x338120['offset'];var _0x1c16d7=_0x57bd1d?_0x2abce0['count']:_0x338120[_0xbb43('0x1c')]+_0x338120[_0xbb43('0x1d')];var _0x4dfc54;if(_0x1c16d7>=_0x2b0797){_0x1c16d7=_0x2b0797;_0x4dfc54=0xc8;}else{_0x4dfc54=0xce;}_0x4d5bcf['status'](_0x4dfc54);return _0x4d5bcf[_0xbb43('0x1e')](_0xbb43('0x1f'),_0x2e3b43+'-'+_0x1c16d7+'/'+_0x2b0797)[_0xbb43('0x20')](_0x2abce0);}return null;};}function patchUpdates(_0x2bf2d4){return function(_0x5bcce7){try{jsonpatch[_0xbb43('0x21')](_0x5bcce7,_0x2bf2d4,!![]);}catch(_0x5f4416){return BPromise[_0xbb43('0x22')](_0x5f4416);}return _0x5bcce7['save']();};}function saveUpdates(_0x2f5e31,_0x565256){return function(_0x3f323e){if(_0x3f323e){return _0x3f323e[_0xbb43('0x23')](_0x2f5e31)['then'](function(_0x1d0768){return _0x1d0768;});}return null;};}function removeEntity(_0x4dfb7f,_0xf24e60){return function(_0x298ce2){if(_0x298ce2){return _0x298ce2[_0xbb43('0x24')]()['then'](function(){_0x4dfb7f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x269ca5,_0x32d7f0){return function(_0x5d8310){if(!_0x5d8310){_0x269ca5[_0xbb43('0x25')](0x194);}return _0x5d8310;};}function handleError(_0x2da653,_0x226827){_0x226827=_0x226827||0x1f4;return function(_0x3874fb){logger['error'](_0x3874fb['stack']);if(_0x3874fb[_0xbb43('0x26')]){delete _0x3874fb[_0xbb43('0x26')];}_0x2da653[_0xbb43('0x27')](_0x226827)[_0xbb43('0x28')](_0x3874fb);};}exports[_0xbb43('0x29')]=function(_0x40b04b,_0x21d386){var _0x473828={'raw':!![],'where':{'id':_0x40b04b[_0xbb43('0x2a')]['id']}},_0x539730={};_0x539730['model']=_[_0xbb43('0x2b')](db[_0xbb43('0x2c')][_0xbb43('0x2d')]);_0x539730[_0xbb43('0x2e')]=_['keys'](_0x40b04b[_0xbb43('0x2e')]);_0x539730['filters']=_['intersection'](_0x539730['model'],_0x539730[_0xbb43('0x2e')]);_0x473828['attributes']=_[_0xbb43('0x2f')](_0x539730[_0xbb43('0x30')],qs[_0xbb43('0x31')](_0x40b04b['query'][_0xbb43('0x31')]));_0x473828[_0xbb43('0x32')]=_0x473828[_0xbb43('0x32')][_0xbb43('0x33')]?_0x473828[_0xbb43('0x32')]:_0x539730[_0xbb43('0x30')];if(_0x40b04b[_0xbb43('0x2e')][_0xbb43('0x34')]){_0x473828['include']=[{'all':!![]}];}_0x473828=_[_0xbb43('0x35')]({},_0x473828,_0x40b04b[_0xbb43('0x36')]);return db[_0xbb43('0x2c')][_0xbb43('0x37')](_0x473828)[_0xbb43('0x38')](handleEntityNotFound(_0x21d386,null))[_0xbb43('0x38')](respondWithResult(_0x21d386,null))[_0xbb43('0x39')](handleError(_0x21d386,null));};exports[_0xbb43('0x23')]=function(_0x349a83,_0x57105c){if(_0x349a83[_0xbb43('0x3a')]['id']){delete _0x349a83[_0xbb43('0x3a')]['id'];}return db[_0xbb43('0x2c')][_0xbb43('0x37')]({'where':{'id':_0x349a83[_0xbb43('0x2a')]['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x57105c,null))['then'](saveUpdates(_0x349a83[_0xbb43('0x3a')],null))[_0xbb43('0x38')](respondWithResult(_0x57105c,null))['catch'](handleError(_0x57105c,null));};exports[_0xbb43('0x24')]=function(_0x2c9a7c,_0x11d384){return db['MailApplication']['find']({'where':{'id':_0x2c9a7c['params']['id']}})[_0xbb43('0x38')](handleEntityNotFound(_0x11d384,null))[_0xbb43('0x38')](removeEntity(_0x11d384,null))['catch'](handleError(_0x11d384,null));}; \ No newline at end of file +var _0x9c44=['Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','show','params','model','keys','MailApplication','rawAttributes','query','attributes','intersection','fields','length','includeAll','include','merge','options','find','then','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x9c44,0x178));var _0x49c4=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0x9c44[_0x273c39];return _0x46d6b5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={'raw':!![],'where':{'id':_0x5987ae[_0x49c4('0x29')]['id']}},_0x46e04d={};_0x46e04d[_0x49c4('0x2a')]=_[_0x49c4('0x2b')](db[_0x49c4('0x2c')][_0x49c4('0x2d')]);_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2b')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d['filters']=_['intersection'](_0x46e04d['model'],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x2f')]=_[_0x49c4('0x30')](_0x46e04d[_0x49c4('0x2a')],qs[_0x49c4('0x31')](_0x5987ae['query'][_0x49c4('0x31')]));_0x2b2793[_0x49c4('0x2f')]=_0x2b2793[_0x49c4('0x2f')][_0x49c4('0x32')]?_0x2b2793['attributes']:_0x46e04d['model'];if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x33')]){_0x2b2793[_0x49c4('0x34')]=[{'all':!![]}];}_0x2b2793=_[_0x49c4('0x35')]({},_0x2b2793,_0x5987ae[_0x49c4('0x36')]);return db['MailApplication'][_0x49c4('0x37')](_0x2b2793)[_0x49c4('0x38')](handleEntityNotFound(_0x889909,null))[_0x49c4('0x38')](respondWithResult(_0x889909,null))['catch'](handleError(_0x889909,null));};exports['update']=function(_0x85dce2,_0x1991e9){if(_0x85dce2[_0x49c4('0x39')]['id']){delete _0x85dce2[_0x49c4('0x39')]['id'];}return db[_0x49c4('0x2c')][_0x49c4('0x37')]({'where':{'id':_0x85dce2[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x1991e9,null))[_0x49c4('0x38')](saveUpdates(_0x85dce2['body'],null))[_0x49c4('0x38')](respondWithResult(_0x1991e9,null))['catch'](handleError(_0x1991e9,null));};exports[_0x49c4('0x23')]=function(_0x349791,_0x2625a6){return db[_0x49c4('0x2c')]['find']({'where':{'id':_0x349791[_0x49c4('0x29')]['id']}})[_0x49c4('0x38')](handleEntityNotFound(_0x2625a6,null))[_0x49c4('0x38')](removeEntity(_0x2625a6,null))['catch'](handleError(_0x2625a6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 248202d..5dde711 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 _0x271e=['bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1be3c1,_0x5a123e){var _0x2165b2=function(_0x3c5a79){while(--_0x3c5a79){_0x1be3c1['push'](_0x1be3c1['shift']());}};_0x2165b2(++_0x5a123e);}(_0x271e,0xab));var _0xe271=function(_0xa872f0,_0x281875){_0xa872f0=_0xa872f0-0x0;var _0x36be10=_0x271e[_0xa872f0];return _0x36be10;};'use strict';var _=require(_0xe271('0x0'));var util=require(_0xe271('0x1'));var logger=require(_0xe271('0x2'))(_0xe271('0x3'));var moment=require(_0xe271('0x4'));var BPromise=require(_0xe271('0x5'));var rp=require(_0xe271('0x6'));var fs=require('fs');var path=require(_0xe271('0x7'));var rimraf=require(_0xe271('0x8'));var config=require(_0xe271('0x9'));var attributes=require(_0xe271('0xa'));module[_0xe271('0xb')]=function(_0x5d803a,_0xd98688){return _0x5d803a[_0xe271('0xc')](_0xe271('0xd'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe271('0xe'),'collate':_0xe271('0xf')});}; \ No newline at end of file +var _0x6bc9=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./mailApplication.attributes','exports'];(function(_0x494315,_0x2d42bd){var _0x49cc18=function(_0x419de9){while(--_0x419de9){_0x494315['push'](_0x494315['shift']());}};_0x49cc18(++_0x2d42bd);}(_0x6bc9,0xf3));var _0x96bc=function(_0x5a9017,_0x4312fc){_0x5a9017=_0x5a9017-0x0;var _0x596e52=_0x6bc9[_0x5a9017];return _0x596e52;};'use strict';var _=require('lodash');var util=require(_0x96bc('0x0'));var logger=require(_0x96bc('0x1'))('api');var moment=require(_0x96bc('0x2'));var BPromise=require(_0x96bc('0x3'));var rp=require(_0x96bc('0x4'));var fs=require('fs');var path=require(_0x96bc('0x5'));var rimraf=require(_0x96bc('0x6'));var config=require('../../config/environment');var attributes=require(_0x96bc('0x7'));module[_0x96bc('0x8')]=function(_0x293b8c,_0x1bead4){return _0x293b8c[_0x96bc('0x9')](_0x96bc('0xa'),attributes,{'tableName':_0x96bc('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x96bc('0xc'),'collate':_0x96bc('0xd')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index fe004ca..b7ed7ce 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 _0x58ff=['result','catch','UpdateMailApplication','MailApplication','options','raw','where','attributes','limit','then','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info','MailApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','MailApplication,\x20%s,\x20%s','message'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x58ff,0x180));var _0xf58f=function(_0x2ab66e,_0x99cf8b){_0x2ab66e=_0x2ab66e-0x0;var _0x5034ed=_0x58ff[_0x2ab66e];return _0x5034ed;};'use strict';var _=require(_0xf58f('0x0'));var util=require(_0xf58f('0x1'));var moment=require(_0xf58f('0x2'));var BPromise=require(_0xf58f('0x3'));var rs=require(_0xf58f('0x4'));var fs=require('fs');var Redis=require(_0xf58f('0x5'));var db=require(_0xf58f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf58f('0x7'))('rpc');var config=require(_0xf58f('0x8'));var jayson=require(_0xf58f('0x9'));var client=jayson[_0xf58f('0xa')][_0xf58f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2d7d2d,_0x2f1d48,_0x36a21d){return new BPromise(function(_0x2abd25,_0x320bea){return client['request'](_0x2d7d2d,_0x36a21d)['then'](function(_0x18adcb){logger[_0xf58f('0xc')]('MailApplication,\x20%s,\x20%s',_0x2f1d48,'request\x20sent');logger['debug'](_0xf58f('0xd'),_0x2f1d48,_0xf58f('0xe'),JSON['stringify'](_0x18adcb));if(_0x18adcb[_0xf58f('0xf')]){if(_0x18adcb['error'][_0xf58f('0x10')]===0x1f4){logger[_0xf58f('0xf')](_0xf58f('0x11'),_0x2f1d48,_0x18adcb['error'][_0xf58f('0x12')]);return _0x320bea(_0x18adcb[_0xf58f('0xf')]['message']);}logger[_0xf58f('0xf')]('MailApplication,\x20%s,\x20%s',_0x2f1d48,_0x18adcb[_0xf58f('0xf')][_0xf58f('0x12')]);return _0x2abd25(_0x18adcb['error']['message']);}else{logger[_0xf58f('0xc')](_0xf58f('0x11'),_0x2f1d48,_0xf58f('0xe'));_0x2abd25(_0x18adcb[_0xf58f('0x13')][_0xf58f('0x12')]);}})[_0xf58f('0x14')](function(_0xcf06a9){logger[_0xf58f('0xf')](_0xf58f('0x11'),_0x2f1d48,_0xcf06a9);_0x320bea(_0xcf06a9);});});}exports[_0xf58f('0x15')]=function(_0x4608e8){var _0x2d6f50=this;return new Promise(function(_0x517c19,_0x2dee87){return db[_0xf58f('0x16')]['update'](_0x4608e8['body'],{'raw':_0x4608e8[_0xf58f('0x17')]?_0x4608e8[_0xf58f('0x17')][_0xf58f('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4608e8[_0xf58f('0x17')]?_0x4608e8[_0xf58f('0x17')][_0xf58f('0x19')]||null:null,'attributes':_0x4608e8['options']?_0x4608e8['options'][_0xf58f('0x1a')]||null:null,'limit':_0x4608e8[_0xf58f('0x17')]?_0x4608e8[_0xf58f('0x17')][_0xf58f('0x1b')]||null:null})[_0xf58f('0x1c')](function(_0x7fb7cf){logger['info'](_0xf58f('0x15'),_0x4608e8);logger[_0xf58f('0x1d')](_0xf58f('0x15'),_0x4608e8,JSON[_0xf58f('0x1e')](_0x7fb7cf));_0x517c19(_0x7fb7cf);})[_0xf58f('0x14')](function(_0x30c27f){logger[_0xf58f('0xf')](_0xf58f('0x15'),_0x30c27f['message'],_0x4608e8);_0x2dee87(_0x2d6f50[_0xf58f('0xf')](0x1f4,_0x30c27f[_0xf58f('0x12')]));});});}; \ No newline at end of file +var _0x85d6=['../../config/logger','rpc','jayson/promise','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','UpdateMailApplication','MailApplication','update','body','options','where','info','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1b92a6,_0x14444b){var _0x24be5b=function(_0x3a5fb5){while(--_0x3a5fb5){_0x1b92a6['push'](_0x1b92a6['shift']());}};_0x24be5b(++_0x14444b);}(_0x85d6,0xed));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x685d('0x0'));var moment=require(_0x685d('0x1'));var BPromise=require(_0x685d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x685d('0x3'));var db=require(_0x685d('0x4'))['db'];var utils=require(_0x685d('0x5'));var logger=require(_0x685d('0x6'))(_0x685d('0x7'));var config=require('../../config/environment');var jayson=require(_0x685d('0x8'));var client=jayson[_0x685d('0x9')][_0x685d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2062fc,_0x416e38,_0x20bf51){return new BPromise(function(_0x116f97,_0x81a9dd){return client['request'](_0x2062fc,_0x20bf51)[_0x685d('0xb')](function(_0x47fa36){logger['info'](_0x685d('0xc'),_0x416e38,_0x685d('0xd'));logger[_0x685d('0xe')]('MailApplication,\x20%s,\x20%s,\x20%s',_0x416e38,'request\x20sent',JSON['stringify'](_0x47fa36));if(_0x47fa36['error']){if(_0x47fa36[_0x685d('0xf')][_0x685d('0x10')]===0x1f4){logger[_0x685d('0xf')]('MailApplication,\x20%s,\x20%s',_0x416e38,_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);return _0x81a9dd(_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);}logger[_0x685d('0xf')]('MailApplication,\x20%s,\x20%s',_0x416e38,_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);return _0x116f97(_0x47fa36[_0x685d('0xf')][_0x685d('0x11')]);}else{logger['info'](_0x685d('0xc'),_0x416e38,_0x685d('0xd'));_0x116f97(_0x47fa36[_0x685d('0x12')][_0x685d('0x11')]);}})['catch'](function(_0x22f333){logger[_0x685d('0xf')]('MailApplication,\x20%s,\x20%s',_0x416e38,_0x22f333);_0x81a9dd(_0x22f333);});});}exports[_0x685d('0x13')]=function(_0x4289ab){var _0x528f5a=this;return new Promise(function(_0x409374,_0x113ed2){return db[_0x685d('0x14')][_0x685d('0x15')](_0x4289ab[_0x685d('0x16')],{'raw':_0x4289ab['options']?_0x4289ab[_0x685d('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4289ab[_0x685d('0x17')]?_0x4289ab[_0x685d('0x17')][_0x685d('0x18')]||null:null,'attributes':_0x4289ab[_0x685d('0x17')]?_0x4289ab[_0x685d('0x17')]['attributes']||null:null,'limit':_0x4289ab[_0x685d('0x17')]?_0x4289ab[_0x685d('0x17')]['limit']||null:null})[_0x685d('0xb')](function(_0xa6cce0){logger[_0x685d('0x19')](_0x685d('0x13'),_0x4289ab);logger[_0x685d('0xe')](_0x685d('0x13'),_0x4289ab,JSON['stringify'](_0xa6cce0));_0x409374(_0xa6cce0);})[_0x685d('0x1a')](function(_0x1ccf43){logger['error'](_0x685d('0x13'),_0x1ccf43[_0x685d('0x11')],_0x4289ab);_0x113ed2(_0x528f5a[_0x685d('0xf')](0x1f4,_0x1ccf43[_0x685d('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 5863e58..6d2c802 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 _0xacf4=['create','post','/:id/messages','addMessage','/:id/tags','tracked','addTags','mail','mailinteraction:update','update','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/describe','describe','/:id','getMessages','/:id/download'];(function(_0x502630,_0x55d533){var _0x3b4819=function(_0x6618cf){while(--_0x6618cf){_0x502630['push'](_0x502630['shift']());}};_0x3b4819(++_0x55d533);}(_0xacf4,0x9d));var _0x4acf=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xacf4[_0x45c48f];return _0xaf5037;};'use strict';var express=require(_0x4acf('0x0'));var router=express[_0x4acf('0x1')]();var auth=require(_0x4acf('0x2'));var interaction=require(_0x4acf('0x3'));var controller=require('./mailInteraction.controller');router[_0x4acf('0x4')]('/',auth[_0x4acf('0x5')](),controller['index']);router['get'](_0x4acf('0x6'),auth[_0x4acf('0x5')](),controller[_0x4acf('0x7')]);router[_0x4acf('0x4')](_0x4acf('0x8'),auth[_0x4acf('0x5')](),controller['show']);router['get']('/:id/messages',auth[_0x4acf('0x5')](),controller[_0x4acf('0x9')]);router[_0x4acf('0x4')](_0x4acf('0xa'),auth[_0x4acf('0x5')](),controller['download']);router['post']('/',auth[_0x4acf('0x5')](),controller[_0x4acf('0xb')]);router[_0x4acf('0xc')](_0x4acf('0xd'),auth[_0x4acf('0x5')](),controller[_0x4acf('0xe')]);router[_0x4acf('0xc')](_0x4acf('0xf'),auth[_0x4acf('0x5')](),interaction[_0x4acf('0x10')]('mail','mailinteraction:addtags'),controller[_0x4acf('0x11')]);router['put'](_0x4acf('0x8'),auth[_0x4acf('0x5')](),interaction['tracked'](_0x4acf('0x12'),_0x4acf('0x13')),controller[_0x4acf('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),interaction['tracked']('mail',_0x4acf('0x15')),controller[_0x4acf('0x16')]);router['delete'](_0x4acf('0xf'),auth[_0x4acf('0x5')](),controller['removeTags']);module[_0x4acf('0x17')]=router; \ No newline at end of file +var _0x0b92=['update','delete','mailinteraction:destroy','/:id/tags','removeTags','exports','express','Router','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','show','/:id/messages','/:id/download','post','create','addMessage','tracked','mail','mailinteraction:addtags','put','/:id','mailinteraction:update'];(function(_0x1cd126,_0x217049){var _0x29d149=function(_0x63a1e){while(--_0x63a1e){_0x1cd126['push'](_0x1cd126['shift']());}};_0x29d149(++_0x217049);}(_0x0b92,0xf0));var _0x20b9=function(_0x52095b,_0x27ff9f){_0x52095b=_0x52095b-0x0;var _0x34d7ac=_0x0b92[_0x52095b];return _0x34d7ac;};'use strict';var express=require(_0x20b9('0x0'));var router=express[_0x20b9('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0x20b9('0x2'));var controller=require(_0x20b9('0x3'));router[_0x20b9('0x4')]('/',auth['isAuthenticated'](),controller[_0x20b9('0x5')]);router[_0x20b9('0x4')](_0x20b9('0x6'),auth[_0x20b9('0x7')](),controller['describe']);router[_0x20b9('0x4')]('/:id',auth[_0x20b9('0x7')](),controller[_0x20b9('0x8')]);router['get'](_0x20b9('0x9'),auth['isAuthenticated'](),controller['getMessages']);router['get'](_0x20b9('0xa'),auth[_0x20b9('0x7')](),controller['download']);router[_0x20b9('0xb')]('/',auth['isAuthenticated'](),controller[_0x20b9('0xc')]);router[_0x20b9('0xb')]('/:id/messages',auth[_0x20b9('0x7')](),controller[_0x20b9('0xd')]);router[_0x20b9('0xb')]('/:id/tags',auth[_0x20b9('0x7')](),interaction[_0x20b9('0xe')](_0x20b9('0xf'),_0x20b9('0x10')),controller['addTags']);router[_0x20b9('0x11')](_0x20b9('0x12'),auth['isAuthenticated'](),interaction[_0x20b9('0xe')](_0x20b9('0xf'),_0x20b9('0x13')),controller[_0x20b9('0x14')]);router[_0x20b9('0x15')]('/:id',auth[_0x20b9('0x7')](),interaction[_0x20b9('0xe')](_0x20b9('0xf'),_0x20b9('0x16')),controller['destroy']);router[_0x20b9('0x15')](_0x20b9('0x17'),auth[_0x20b9('0x7')](),controller[_0x20b9('0x18')]);module[_0x20b9('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 357eeb8..8c7f82c 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 _0x4c37=['out','INTEGER','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x536bf2,_0x45f6db){var _0x85c61f=function(_0x29ad0f){while(--_0x29ad0f){_0x536bf2['push'](_0x536bf2['shift']());}};_0x85c61f(++_0x45f6db);}(_0x4c37,0x8e));var _0x74c3=function(_0x265c9e,_0x3ccce3){_0x265c9e=_0x265c9e-0x0;var _0x735c3e=_0x4c37[_0x265c9e];return _0x735c3e;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x74c3('0x0'));module[_0x74c3('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x74c3('0x2')]},'disposition':{'type':Sequelize[_0x74c3('0x3')]},'secondDisposition':{'type':Sequelize[_0x74c3('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x74c3('0x3')]},'inReplyTo':{'type':Sequelize[_0x74c3('0x3')](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x74c3('0x4')](_0x74c3('0x5'))},'subject':{'type':Sequelize[_0x74c3('0x4')]()},'attach':{'type':Sequelize[_0x74c3('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x74c3('0x2')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x74c3('0x7')]('in',_0x74c3('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x74c3('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x74c3('0x7')]('in',_0x74c3('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x74c3('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x74c3('0x9')]}}; \ No newline at end of file +var _0xc9a0=['TEXT','long','DATE','ENUM','out','INTEGER','sequelize','iconv','exports','BOOLEAN','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc9a0,0x1b3));var _0x0c9a=function(_0x4a17de,_0x5d896f){_0x4a17de=_0x4a17de-0x0;var _0xb7b08a=_0xc9a0[_0x4a17de];return _0xb7b08a;};'use strict';var Sequelize=require(_0x0c9a('0x0'));var iconv=require(_0x0c9a('0x1'));module[_0x0c9a('0x2')]={'closed':{'type':Sequelize[_0x0c9a('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x0c9a('0x4')]},'secondDisposition':{'type':Sequelize[_0x0c9a('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x0c9a('0x4')](0x1fe)},'to':{'type':Sequelize[_0x0c9a('0x4')]},'cc':{'type':Sequelize[_0x0c9a('0x5')](_0x0c9a('0x6'))},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x0c9a('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x0c9a('0x7')]},'substatus':{'type':Sequelize[_0x0c9a('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x0c9a('0x7')]},'firstMsgDirection':{'type':Sequelize[_0x0c9a('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0c9a('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x0c9a('0x8')]('in',_0x0c9a('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0c9a('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x0c9a('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 1697ec3..e2fb3ee 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 _0x559c=['index','map','rawAttributes','key','getOptions','findAll','user','catch','show','params','model','MailInteraction','keys','intersection','query','fields','attributes','length','include','merge','options','find','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','nolimit','order','sort','where','filters','MailInteractionId','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','setTags','Tag','color','emit','mailInteractionTags:save','removeTags','unix','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','Attachment','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','missing.recipient@your.company.com','format','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','readFileSync','build','writeFileSync','message%d.eml','download','unlinkSync','rimraf','zip-dir','moment','bluebird','path','lodash','juice','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','html-entities','redis','defaults','localhost','./mailInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','then','end','error','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x559c,0x19a));var _0xc559=function(_0x5c5f3b,_0x5b9190){_0x5c5f3b=_0x5c5f3b-0x0;var _0x8a59e4=_0x559c[_0x5c5f3b];return _0x8a59e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc559('0x0'));var zipdir=require(_0xc559('0x1'));var moment=require(_0xc559('0x2'));var BPromise=require(_0xc559('0x3'));var util=require('util');var path=require(_0xc559('0x4'));var fs=require('fs');var _=require(_0xc559('0x5'));var juice=require(_0xc559('0x6'));var Redis=require('ioredis');var interaction=require(_0xc559('0x7'));var qs=require(_0xc559('0x8'));var logger=require(_0xc559('0x9'))('api');var config=require(_0xc559('0xa'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xc559('0xb'));config[_0xc559('0xc')]=_[_0xc559('0xd')](config['redis'],{'host':_0xc559('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc559('0xc')]));require(_0xc559('0xf'))['register'](socket);function respondWithStatusCode(_0x4a547b,_0x271ee3){_0x271ee3=_0x271ee3||0xcc;return function(_0x150f3d){if(_0x150f3d){return _0x4a547b[_0xc559('0x10')](_0x271ee3);}return _0x4a547b[_0xc559('0x11')](_0x271ee3)['end']();};}function respondWithResult(_0x656eb9,_0x5002b1){_0x5002b1=_0x5002b1||0xc8;return function(_0x151d7f){if(_0x151d7f){return _0x656eb9[_0xc559('0x11')](_0x5002b1)[_0xc559('0x12')](_0x151d7f);}};}function respondWithFilteredResult(_0x39fee6,_0x3797eb){return function(_0x49c424){if(_0x49c424){var _0x334c39=typeof _0x3797eb[_0xc559('0x13')]===_0xc559('0x14')&&typeof _0x3797eb[_0xc559('0x15')]===_0xc559('0x14');var _0x22f4d8=_0x49c424[_0xc559('0x16')];var _0x32be87=_0x334c39?0x0:_0x3797eb[_0xc559('0x13')];var _0x3740b9=_0x334c39?_0x49c424['count']:_0x3797eb[_0xc559('0x13')]+_0x3797eb[_0xc559('0x15')];var _0x1a4ab3;if(_0x3740b9>=_0x22f4d8){_0x3740b9=_0x22f4d8;_0x1a4ab3=0xc8;}else{_0x1a4ab3=0xce;}_0x39fee6[_0xc559('0x11')](_0x1a4ab3);return _0x39fee6[_0xc559('0x17')]('Content-Range',_0x32be87+'-'+_0x3740b9+'/'+_0x22f4d8)[_0xc559('0x12')](_0x49c424);}return null;};}function saveUpdates(_0x1900c0){return function(_0x50e855){if(_0x50e855){return _0x50e855['update'](_0x1900c0)[_0xc559('0x18')](function(_0x4c5ead){return _0x4c5ead;});}return null;};}function removeEntity(_0x4ad4bc){return function(_0x3d18de){if(_0x3d18de){return _0x3d18de['destroy']()['then'](function(){_0x4ad4bc['status'](0xcc)[_0xc559('0x19')]();});}};}function handleEntityNotFound(_0x1e98ec){return function(_0x4df096){if(!_0x4df096){_0x1e98ec[_0xc559('0x10')](0x194);}return _0x4df096;};}function handleError(_0x5e630d,_0xacd2fd){_0xacd2fd=_0xacd2fd||0x1f4;return function(_0x1bbe93){logger[_0xc559('0x1a')](_0x1bbe93[_0xc559('0x1b')]);if(_0x1bbe93[_0xc559('0x1c')]){delete _0x1bbe93[_0xc559('0x1c')];}_0x5e630d['status'](_0xacd2fd)[_0xc559('0x1d')](_0x1bbe93);};}exports[_0xc559('0x1e')]=function(_0x1c8ed1,_0x1b7dac){var _0x47ae8f={};var _0x346c87=_[_0xc559('0x1f')](db['MailInteraction'][_0xc559('0x20')],function(_0x2729c3){return{'name':_0x2729c3['fieldName'],'type':_0x2729c3['type'][_0xc559('0x21')]};});_0x47ae8f=qs[_0xc559('0x22')](_0x346c87,_0x1c8ed1);return interaction[_0xc559('0x23')]('mail',_0x1c8ed1['query'],_0x1c8ed1[_0xc559('0x24')],_0x47ae8f,_0x346c87)['then'](respondWithFilteredResult(_0x1b7dac,_0x47ae8f))[_0xc559('0x25')](handleError(_0x1b7dac,null));};exports[_0xc559('0x26')]=function(_0x41e944,_0x5a20c0){var _0x2eb03f={'raw':![],'where':{'id':_0x41e944[_0xc559('0x27')]['id']}},_0x56cb6c={};_0x56cb6c[_0xc559('0x28')]=_['keys'](db[_0xc559('0x29')][_0xc559('0x20')]);_0x56cb6c['query']=_[_0xc559('0x2a')](_0x41e944['query']);_0x56cb6c['filters']=_[_0xc559('0x2b')](_0x56cb6c[_0xc559('0x28')],_0x56cb6c[_0xc559('0x2c')]);_0x2eb03f['attributes']=_[_0xc559('0x2b')](_0x56cb6c['model'],qs[_0xc559('0x2d')](_0x41e944[_0xc559('0x2c')]['fields']));_0x2eb03f[_0xc559('0x2e')]=_0x2eb03f[_0xc559('0x2e')][_0xc559('0x2f')]?_0x2eb03f[_0xc559('0x2e')]:_0x56cb6c[_0xc559('0x28')];if(_0x41e944['query']['includeAll']){_0x2eb03f[_0xc559('0x30')]=[{'all':!![]}];}_0x2eb03f=_[_0xc559('0x31')]({},_0x2eb03f,_0x41e944[_0xc559('0x32')]);return db[_0xc559('0x29')][_0xc559('0x33')](_0x2eb03f)[_0xc559('0x18')](handleEntityNotFound(_0x5a20c0,null))[_0xc559('0x18')](respondWithResult(_0x5a20c0,null))[_0xc559('0x25')](handleError(_0x5a20c0,null));};exports[_0xc559('0x34')]=function(_0x33b6b8,_0x293721){return db[_0xc559('0x29')]['create'](_0x33b6b8[_0xc559('0x35')],{})[_0xc559('0x18')](respondWithResult(_0x293721,0xc9))[_0xc559('0x25')](handleError(_0x293721,null));};exports[_0xc559('0x36')]=function(_0x5cf86a,_0x115139){if(_0x5cf86a[_0xc559('0x35')]['id']){delete _0x5cf86a[_0xc559('0x35')]['id'];}return db[_0xc559('0x29')][_0xc559('0x33')]({'where':{'id':_0x5cf86a['params']['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x115139,null))['then'](saveUpdates(_0x5cf86a[_0xc559('0x35')],null))['then'](respondWithResult(_0x115139,null))[_0xc559('0x25')](handleError(_0x115139,null));};exports['destroy']=function(_0x1cd75b,_0x4a1251){return db[_0xc559('0x29')][_0xc559('0x33')]({'where':{'id':_0x1cd75b[_0xc559('0x27')]['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x4a1251,null))[_0xc559('0x18')](removeEntity(_0x4a1251,null))[_0xc559('0x25')](handleError(_0x4a1251,null));};exports[_0xc559('0x37')]=function(_0x451346,_0x298e59){return db[_0xc559('0x29')][_0xc559('0x37')]()['then'](respondWithResult(_0x298e59,null))['catch'](handleError(_0x298e59,null));};exports[_0xc559('0x38')]=function(_0x44aa29,_0x7c4f8d){return db['MailMessage']['find']({'where':{'id':_0x44aa29[_0xc559('0x27')]['id']}})['then'](handleEntityNotFound(_0x7c4f8d,null))[_0xc559('0x18')](function(_0x507b75){if(_0x507b75){return _0x507b75['addMessage'](_0x44aa29[_0xc559('0x35')][_0xc559('0x39')],_[_0xc559('0x3a')](_0x44aa29[_0xc559('0x35')],[_0xc559('0x39'),'id'])||{});}})[_0xc559('0x18')](respondWithResult(_0x7c4f8d,null))[_0xc559('0x25')](handleError(_0x7c4f8d,null));};exports[_0xc559('0x3b')]=function(_0x1c742d,_0x53f904){var _0x3b5280={'raw':![],'where':{}};var _0x21c9e8={};var _0x44e8e9={'count':0x0,'rows':[]};return db[_0xc559('0x29')][_0xc559('0x3c')]({'where':{'id':_0x1c742d[_0xc559('0x27')]['id']}})['then'](handleEntityNotFound(_0x53f904,null))[_0xc559('0x18')](function(_0x1604b3){if(_0x1604b3){_0x21c9e8[_0xc559('0x28')]=_[_0xc559('0x2a')](db[_0xc559('0x3d')][_0xc559('0x20')]);_0x21c9e8[_0xc559('0x2c')]=_['keys'](_0x1c742d[_0xc559('0x2c')]);_0x21c9e8['filters']=_[_0xc559('0x2b')](_0x21c9e8[_0xc559('0x28')],_0x21c9e8[_0xc559('0x2c')]);_0x3b5280[_0xc559('0x2e')]=_[_0xc559('0x2b')](_0x21c9e8[_0xc559('0x28')],qs['fields'](_0x1c742d[_0xc559('0x2c')][_0xc559('0x2d')]));_0x3b5280['attributes']=_0x3b5280[_0xc559('0x2e')]['length']?_0x3b5280[_0xc559('0x2e')]:_0x21c9e8[_0xc559('0x28')];if(!_0x1c742d[_0xc559('0x2c')]['hasOwnProperty'](_0xc559('0x3e'))){_0x3b5280[_0xc559('0x15')]=qs['limit'](_0x1c742d[_0xc559('0x2c')]['limit']);_0x3b5280[_0xc559('0x13')]=qs[_0xc559('0x13')](_0x1c742d[_0xc559('0x2c')][_0xc559('0x13')]);}_0x3b5280[_0xc559('0x3f')]=qs[_0xc559('0x40')](_0x1c742d['query'][_0xc559('0x40')]);_0x3b5280[_0xc559('0x41')]=qs[_0xc559('0x42')](_['pick'](_0x1c742d[_0xc559('0x2c')],_0x21c9e8[_0xc559('0x42')]));_0x3b5280['where'][_0xc559('0x43')]=_0x1604b3['id'];if(_0x1c742d['query']['filter']){_0x3b5280[_0xc559('0x41')]=_[_0xc559('0x31')](_0x3b5280[_0xc559('0x41')],{'$or':_['map'](_0x3b5280[_0xc559('0x2e')],function(_0x3eb732){var _0x52e4f5={};_0x52e4f5[_0x3eb732]={'$like':'%'+_0x1c742d[_0xc559('0x2c')]['filter']+'%'};return _0x52e4f5;})});}if(_0x1c742d[_0xc559('0x2c')][_0xc559('0x44')]){var _0x41ef26=_0x1c742d[_0xc559('0x2c')][_0xc559('0x44')][_0xc559('0x45')](',');var _0x35f653={};_0x35f653[_0x41ef26[0x0]]={'$gte':moment(_0x41ef26[0x1])['format'](_0xc559('0x46'))};_0x3b5280[_0xc559('0x41')]=_[_0xc559('0x31')](_0x3b5280[_0xc559('0x41')],_0x35f653);}_0x3b5280=_['merge']({},_0x3b5280,_0x1c742d[_0xc559('0x32')]);return db[_0xc559('0x3d')][_0xc559('0x16')]({'where':_0x3b5280[_0xc559('0x41')]})['then'](function(_0x3ec9df){_0x44e8e9['count']=_0x3ec9df;if(_0x1c742d[_0xc559('0x2c')]['includeAll']){_0x3b5280[_0xc559('0x30')]=[{'all':!![]}];}return db['MailMessage'][_0xc559('0x23')](_0x3b5280);})[_0xc559('0x18')](function(_0x17da1b){if(_0x1c742d['query'][_0xc559('0x47')]===_0xc559('0x48')){for(var _0x169c94=0x0;_0x169c94<_0x17da1b[_0xc559('0x2f')];_0x169c94++){_0x17da1b[_0x169c94]['body']=juice(_0x17da1b[_0x169c94][_0xc559('0x35')]);}}_0x44e8e9[_0xc559('0x49')]=_0x17da1b;return _0x44e8e9;});}})[_0xc559('0x18')](respondWithFilteredResult(_0x53f904,_0x3b5280))[_0xc559('0x25')](handleError(_0x53f904,null));};exports['addTags']=function(_0x48d09f,_0x4ca80e){return db[_0xc559('0x29')][_0xc559('0x33')]({'where':{'id':_0x48d09f[_0xc559('0x27')]['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x4ca80e,null))[_0xc559('0x18')](function(_0x23e9f2){if(_0x23e9f2){return _0x23e9f2[_0xc559('0x4a')](_0x48d09f[_0xc559('0x35')][_0xc559('0x39')],_[_0xc559('0x3a')](_0x48d09f[_0xc559('0x35')],[_0xc559('0x39'),'id'])||{})['spread'](function(){return db[_0xc559('0x4b')][_0xc559('0x23')]({'attributes':['id',_0xc559('0x1c'),_0xc559('0x4c')],'where':{'id':_0x48d09f[_0xc559('0x35')][_0xc559('0x39')]}});})['then'](function(_0x840b36){socket[_0xc559('0x4d')](_0xc559('0x4e'),{'id':Number(_0x48d09f[_0xc559('0x27')]['id']),'tags':_0x840b36||[]});return{'id':Number(_0x48d09f[_0xc559('0x27')]['id']),'tags':_0x840b36||[]};});}})['then'](respondWithResult(_0x4ca80e,null))[_0xc559('0x25')](handleError(_0x4ca80e,null));};exports[_0xc559('0x4f')]=function(_0x4d1d18,_0x4ea6d3){return db['MailInteraction']['find']({'where':{'id':_0x4d1d18[_0xc559('0x27')]['id']}})[_0xc559('0x18')](handleEntityNotFound(_0x4ea6d3,null))[_0xc559('0x18')](function(_0x193d96){if(_0x193d96){return _0x193d96[_0xc559('0x4f')](_0x4d1d18[_0xc559('0x2c')][_0xc559('0x39')]);}})['then'](respondWithStatusCode(_0x4ea6d3,null))[_0xc559('0x25')](handleError(_0x4ea6d3,null));};exports['download']=function(_0x574062,_0x59b3fe){var _0x2406cf=moment()[_0xc559('0x50')]()['toString']();var _0x274098=path['join'](config[_0xc559('0x51')],_0xc559('0x52'),_0xc559('0x53'),_0xc559('0x54'));var _0x4ee97a=path[_0xc559('0x55')](config['root'],_0xc559('0x52'),_0xc559('0x53'),_0xc559('0x56'));var _0x542648=path['join'](_0x274098,_0x2406cf);var _0x393209=util['format'](_0xc559('0x57'),_0x574062['params']['id'],_0x2406cf);var _0x39abe2=path[_0xc559('0x55')](_0x274098,_0x393209);var _0x342046=[];if(_0x574062[_0xc559('0x2c')][_0xc559('0x56')]){_0x342046[_0xc559('0x58')]({'model':db[_0xc559('0x59')],'as':_0xc559('0x5a'),'raw':!![]});}var _0x4fa169=[{'model':db[_0xc559('0x3d')],'as':_0xc559('0x5b'),'attributes':['id',_0xc559('0x35'),_0xc559('0x5c'),'to','cc',_0xc559('0x5d'),_0xc559('0x5e'),_0xc559('0x5f')],'where':{'secret':![]},'order':qs[_0xc559('0x40')]('id'),'include':_0x342046}];return db['MailInteraction'][_0xc559('0x33')]({'where':{'id':_0x574062[_0xc559('0x27')]['id']},'include':_0x4fa169})[_0xc559('0x18')](handleEntityNotFound(_0x59b3fe,null))[_0xc559('0x18')](function(_0x4aa24b){if(_0x4aa24b&&_0x4aa24b[_0xc559('0x5b')]){var _0x2913aa=_0x4aa24b[_0xc559('0x60')]({'plain':!![]});fs[_0xc559('0x61')](_0x542648);return BPromise['each'](_0x2913aa[_0xc559('0x5b')],function(_0x904717,_0x466555){var _0x4bea7b={'from':_0x904717[_0xc559('0x5c')],'to':_0x904717['to']||_0xc559('0x62'),'subject':_0x904717['subject'],'html':htmlEntities['decode'](_0x904717[_0xc559('0x35')]),'headers':{'Date':moment(_0x904717[_0xc559('0x5f')])[_0xc559('0x63')](_0xc559('0x64'))},'attachments':[]};if(_0x904717['cc']){_0x4bea7b[_0xc559('0x65')]['Cc']=_0x904717['cc'];}if(_0x904717[_0xc559('0x5d')]){_0x4bea7b[_0xc559('0x65')][_0xc559('0x66')]=_0x904717[_0xc559('0x5d')];}return new BPromise(function(_0x2d3f8c,_0x1ba0fd){if(_0x904717['Attachments']){for(var _0x204fc6=0x0;_0x204fc6<_0x904717[_0xc559('0x5a')][_0xc559('0x2f')];_0x204fc6++){var _0x1e6cc9=_0x904717['Attachments'][_0x204fc6];var _0x2f0f9d=path['join'](_0x4ee97a,_0x1e6cc9['basename']);if(fs[_0xc559('0x67')](_0x2f0f9d)){_0x4bea7b[_0xc559('0x56')][_0xc559('0x58')]({'name':_0x1e6cc9[_0xc559('0x1c')],'contentType':_0x1e6cc9['type'],'data':fs[_0xc559('0x68')](_0x2f0f9d)});}}}emlformat[_0xc559('0x69')](_0x4bea7b,function(_0x90b4b4,_0x4f16c3){if(_0x90b4b4)return _0x1ba0fd(_0x90b4b4);fs[_0xc559('0x6a')](path[_0xc559('0x55')](_0x542648,util[_0xc559('0x63')](_0xc559('0x6b'),_0x466555)),_0x4f16c3);return _0x2d3f8c(_0x4f16c3);});});})['then'](function(){return new BPromise(function(_0x3566de,_0x570855){zipdir(_0x542648,{'saveTo':_0x39abe2},function(_0x13f749,_0x1508fa){if(_0x13f749)return _0x570855(_0x13f749);return _0x3566de(_0x1508fa);});})[_0xc559('0x18')](function(){return new BPromise(function(_0x449b74,_0x45ca45){rimraf(_0x542648,function(_0x465dde){if(_0x465dde)_0x45ca45(_0x465dde);return _0x449b74();});});})[_0xc559('0x18')](function(){return _0x59b3fe[_0xc559('0x6c')](_0x39abe2,_0x393209,function(_0x48f58e){if(!_0x48f58e)fs[_0xc559('0x6d')](_0x39abe2);});});});}else{return _0x59b3fe['sendStatus'](0xc8);}})[_0xc559('0x25')](handleError(_0x59b3fe,null));}; \ No newline at end of file +var _0x08d7=['ids','getMessages','hasOwnProperty','nolimit','order','sort','MailInteractionId','where','merge','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','rows','addTags','setTags','spread','Tag','color','emit','mailInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','format','transcript-%d-%s.zip','attachments','push','Attachment','Attachments','Messages','bcc','createdAt','get','each','from','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','readFileSync','build','message%d.eml','download','unlinkSync','eml-format','rimraf','bluebird','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','register','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','update','then','stack','name','index','map','rawAttributes','fieldName','type','findAll','mail','query','user','catch','show','params','keys','MailInteraction','filters','intersection','model','attributes','fields','length','includeAll','include','options','find','create','body','destroy','describe','MailMessage','addMessage','omit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x08d7,0x1f4));var _0x708d=function(_0xdc9b83,_0x446c70){_0xdc9b83=_0xdc9b83-0x0;var _0x52cd13=_0x08d7[_0xdc9b83];return _0x52cd13;};'use strict';var emlformat=require(_0x708d('0x0'));var rimraf=require(_0x708d('0x1'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x708d('0x2'));var util=require(_0x708d('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x708d('0x4'));var juice=require(_0x708d('0x5'));var Redis=require(_0x708d('0x6'));var interaction=require(_0x708d('0x7'));var qs=require(_0x708d('0x8'));var logger=require(_0x708d('0x9'))(_0x708d('0xa'));var config=require(_0x708d('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x708d('0xc')]=_['defaults'](config[_0x708d('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x708d('0xd'))(new Redis(config[_0x708d('0xc')]));require('./mailInteraction.socket')[_0x708d('0xe')](socket);function respondWithStatusCode(_0x2dcfe5,_0x44b5c7){_0x44b5c7=_0x44b5c7||0xcc;return function(_0x46b198){if(_0x46b198){return _0x2dcfe5[_0x708d('0xf')](_0x44b5c7);}return _0x2dcfe5['status'](_0x44b5c7)[_0x708d('0x10')]();};}function respondWithResult(_0x1c58a0,_0x156a65){_0x156a65=_0x156a65||0xc8;return function(_0x3d83c5){if(_0x3d83c5){return _0x1c58a0['status'](_0x156a65)[_0x708d('0x11')](_0x3d83c5);}};}function respondWithFilteredResult(_0x4e7422,_0x7c032d){return function(_0x5aa220){if(_0x5aa220){var _0x2e0c67=typeof _0x7c032d['offset']===_0x708d('0x12')&&typeof _0x7c032d[_0x708d('0x13')]===_0x708d('0x12');var _0x5eb4c5=_0x5aa220[_0x708d('0x14')];var _0x3d1803=_0x2e0c67?0x0:_0x7c032d[_0x708d('0x15')];var _0x280ee9=_0x2e0c67?_0x5aa220['count']:_0x7c032d[_0x708d('0x15')]+_0x7c032d[_0x708d('0x13')];var _0x28bca3;if(_0x280ee9>=_0x5eb4c5){_0x280ee9=_0x5eb4c5;_0x28bca3=0xc8;}else{_0x28bca3=0xce;}_0x4e7422[_0x708d('0x16')](_0x28bca3);return _0x4e7422[_0x708d('0x17')](_0x708d('0x18'),_0x3d1803+'-'+_0x280ee9+'/'+_0x5eb4c5)[_0x708d('0x11')](_0x5aa220);}return null;};}function saveUpdates(_0x20377c){return function(_0x4ac651){if(_0x4ac651){return _0x4ac651[_0x708d('0x19')](_0x20377c)[_0x708d('0x1a')](function(_0x2126a4){return _0x2126a4;});}return null;};}function removeEntity(_0x523814){return function(_0x3f9975){if(_0x3f9975){return _0x3f9975['destroy']()[_0x708d('0x1a')](function(){_0x523814[_0x708d('0x16')](0xcc)[_0x708d('0x10')]();});}};}function handleEntityNotFound(_0x1c092a){return function(_0x1e04ee){if(!_0x1e04ee){_0x1c092a[_0x708d('0xf')](0x194);}return _0x1e04ee;};}function handleError(_0x49ce0f,_0x3525ec){_0x3525ec=_0x3525ec||0x1f4;return function(_0x15f6a6){logger['error'](_0x15f6a6[_0x708d('0x1b')]);if(_0x15f6a6[_0x708d('0x1c')]){delete _0x15f6a6[_0x708d('0x1c')];}_0x49ce0f['status'](_0x3525ec)['send'](_0x15f6a6);};}exports[_0x708d('0x1d')]=function(_0x4f3c03,_0x2b5473){var _0x2959bc={};var _0x231b54=_[_0x708d('0x1e')](db['MailInteraction'][_0x708d('0x1f')],function(_0x5089a5){return{'name':_0x5089a5[_0x708d('0x20')],'type':_0x5089a5[_0x708d('0x21')]['key']};});_0x2959bc=qs['getOptions'](_0x231b54,_0x4f3c03);return interaction[_0x708d('0x22')](_0x708d('0x23'),_0x4f3c03[_0x708d('0x24')],_0x4f3c03[_0x708d('0x25')],_0x2959bc,_0x231b54)[_0x708d('0x1a')](respondWithFilteredResult(_0x2b5473,_0x2959bc))[_0x708d('0x26')](handleError(_0x2b5473,null));};exports[_0x708d('0x27')]=function(_0x28f98c,_0x5be554){var _0x1ac2c5={'raw':![],'where':{'id':_0x28f98c[_0x708d('0x28')]['id']}},_0x6769c5={};_0x6769c5['model']=_[_0x708d('0x29')](db[_0x708d('0x2a')][_0x708d('0x1f')]);_0x6769c5[_0x708d('0x24')]=_[_0x708d('0x29')](_0x28f98c[_0x708d('0x24')]);_0x6769c5[_0x708d('0x2b')]=_[_0x708d('0x2c')](_0x6769c5[_0x708d('0x2d')],_0x6769c5[_0x708d('0x24')]);_0x1ac2c5[_0x708d('0x2e')]=_[_0x708d('0x2c')](_0x6769c5['model'],qs[_0x708d('0x2f')](_0x28f98c['query']['fields']));_0x1ac2c5[_0x708d('0x2e')]=_0x1ac2c5[_0x708d('0x2e')][_0x708d('0x30')]?_0x1ac2c5[_0x708d('0x2e')]:_0x6769c5[_0x708d('0x2d')];if(_0x28f98c['query'][_0x708d('0x31')]){_0x1ac2c5[_0x708d('0x32')]=[{'all':!![]}];}_0x1ac2c5=_['merge']({},_0x1ac2c5,_0x28f98c[_0x708d('0x33')]);return db['MailInteraction'][_0x708d('0x34')](_0x1ac2c5)[_0x708d('0x1a')](handleEntityNotFound(_0x5be554,null))['then'](respondWithResult(_0x5be554,null))[_0x708d('0x26')](handleError(_0x5be554,null));};exports[_0x708d('0x35')]=function(_0x28928d,_0x322faa){return db[_0x708d('0x2a')][_0x708d('0x35')](_0x28928d[_0x708d('0x36')],{})['then'](respondWithResult(_0x322faa,0xc9))[_0x708d('0x26')](handleError(_0x322faa,null));};exports[_0x708d('0x19')]=function(_0x4fc801,_0x5b45e0){if(_0x4fc801[_0x708d('0x36')]['id']){delete _0x4fc801[_0x708d('0x36')]['id'];}return db['MailInteraction']['find']({'where':{'id':_0x4fc801['params']['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x5b45e0,null))[_0x708d('0x1a')](saveUpdates(_0x4fc801['body'],null))[_0x708d('0x1a')](respondWithResult(_0x5b45e0,null))[_0x708d('0x26')](handleError(_0x5b45e0,null));};exports[_0x708d('0x37')]=function(_0x465c73,_0x234eb6){return db['MailInteraction'][_0x708d('0x34')]({'where':{'id':_0x465c73[_0x708d('0x28')]['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x234eb6,null))[_0x708d('0x1a')](removeEntity(_0x234eb6,null))[_0x708d('0x26')](handleError(_0x234eb6,null));};exports[_0x708d('0x38')]=function(_0x3d925a,_0x56b7ae){return db[_0x708d('0x2a')]['describe']()[_0x708d('0x1a')](respondWithResult(_0x56b7ae,null))[_0x708d('0x26')](handleError(_0x56b7ae,null));};exports['addMessage']=function(_0x365764,_0xa4cb00){return db[_0x708d('0x39')][_0x708d('0x34')]({'where':{'id':_0x365764['params']['id']}})['then'](handleEntityNotFound(_0xa4cb00,null))[_0x708d('0x1a')](function(_0x44e467){if(_0x44e467){return _0x44e467[_0x708d('0x3a')](_0x365764[_0x708d('0x36')]['ids'],_[_0x708d('0x3b')](_0x365764[_0x708d('0x36')],[_0x708d('0x3c'),'id'])||{});}})[_0x708d('0x1a')](respondWithResult(_0xa4cb00,null))['catch'](handleError(_0xa4cb00,null));};exports[_0x708d('0x3d')]=function(_0x4c6e5a,_0x4574e9){var _0x285a8c={'raw':![],'where':{}};var _0xc7ddb0={};var _0x2a2ec8={'count':0x0,'rows':[]};return db[_0x708d('0x2a')]['findOne']({'where':{'id':_0x4c6e5a[_0x708d('0x28')]['id']}})['then'](handleEntityNotFound(_0x4574e9,null))[_0x708d('0x1a')](function(_0x43568f){if(_0x43568f){_0xc7ddb0[_0x708d('0x2d')]=_[_0x708d('0x29')](db[_0x708d('0x39')][_0x708d('0x1f')]);_0xc7ddb0['query']=_[_0x708d('0x29')](_0x4c6e5a[_0x708d('0x24')]);_0xc7ddb0[_0x708d('0x2b')]=_[_0x708d('0x2c')](_0xc7ddb0[_0x708d('0x2d')],_0xc7ddb0[_0x708d('0x24')]);_0x285a8c['attributes']=_[_0x708d('0x2c')](_0xc7ddb0[_0x708d('0x2d')],qs[_0x708d('0x2f')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x2f')]));_0x285a8c[_0x708d('0x2e')]=_0x285a8c[_0x708d('0x2e')][_0x708d('0x30')]?_0x285a8c[_0x708d('0x2e')]:_0xc7ddb0[_0x708d('0x2d')];if(!_0x4c6e5a['query'][_0x708d('0x3e')](_0x708d('0x3f'))){_0x285a8c[_0x708d('0x13')]=qs[_0x708d('0x13')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x13')]);_0x285a8c[_0x708d('0x15')]=qs[_0x708d('0x15')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x15')]);}_0x285a8c[_0x708d('0x40')]=qs[_0x708d('0x41')](_0x4c6e5a[_0x708d('0x24')][_0x708d('0x41')]);_0x285a8c['where']=qs[_0x708d('0x2b')](_['pick'](_0x4c6e5a[_0x708d('0x24')],_0xc7ddb0[_0x708d('0x2b')]));_0x285a8c['where'][_0x708d('0x42')]=_0x43568f['id'];if(_0x4c6e5a[_0x708d('0x24')]['filter']){_0x285a8c[_0x708d('0x43')]=_[_0x708d('0x44')](_0x285a8c[_0x708d('0x43')],{'$or':_[_0x708d('0x1e')](_0x285a8c['attributes'],function(_0x4d6559){var _0xd8f76c={};_0xd8f76c[_0x4d6559]={'$like':'%'+_0x4c6e5a[_0x708d('0x24')][_0x708d('0x45')]+'%'};return _0xd8f76c;})});}if(_0x4c6e5a[_0x708d('0x24')]['$gte']){var _0x4fc972=_0x4c6e5a[_0x708d('0x24')][_0x708d('0x46')][_0x708d('0x47')](',');var _0x545b60={};_0x545b60[_0x4fc972[0x0]]={'$gte':moment(_0x4fc972[0x1])['format'](_0x708d('0x48'))};_0x285a8c[_0x708d('0x43')]=_['merge'](_0x285a8c[_0x708d('0x43')],_0x545b60);}_0x285a8c=_[_0x708d('0x44')]({},_0x285a8c,_0x4c6e5a[_0x708d('0x33')]);return db[_0x708d('0x39')][_0x708d('0x14')]({'where':_0x285a8c[_0x708d('0x43')]})[_0x708d('0x1a')](function(_0x56d6d4){_0x2a2ec8[_0x708d('0x14')]=_0x56d6d4;if(_0x4c6e5a[_0x708d('0x24')]['includeAll']){_0x285a8c[_0x708d('0x32')]=[{'all':!![]}];}return db[_0x708d('0x39')][_0x708d('0x22')](_0x285a8c);})[_0x708d('0x1a')](function(_0x23bd1d){if(_0x4c6e5a['query'][_0x708d('0x49')]===_0x708d('0x4a')){for(var _0x4169d8=0x0;_0x4169d8<_0x23bd1d['length'];_0x4169d8++){_0x23bd1d[_0x4169d8]['body']=juice(_0x23bd1d[_0x4169d8]['body']);}}_0x2a2ec8[_0x708d('0x4b')]=_0x23bd1d;return _0x2a2ec8;});}})['then'](respondWithFilteredResult(_0x4574e9,_0x285a8c))[_0x708d('0x26')](handleError(_0x4574e9,null));};exports[_0x708d('0x4c')]=function(_0x322187,_0x4d8fae){return db[_0x708d('0x2a')][_0x708d('0x34')]({'where':{'id':_0x322187[_0x708d('0x28')]['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x4d8fae,null))[_0x708d('0x1a')](function(_0x55b1a8){if(_0x55b1a8){return _0x55b1a8[_0x708d('0x4d')](_0x322187['body'][_0x708d('0x3c')],_[_0x708d('0x3b')](_0x322187[_0x708d('0x36')],['ids','id'])||{})[_0x708d('0x4e')](function(){return db[_0x708d('0x4f')][_0x708d('0x22')]({'attributes':['id',_0x708d('0x1c'),_0x708d('0x50')],'where':{'id':_0x322187[_0x708d('0x36')]['ids']}});})[_0x708d('0x1a')](function(_0x3cb517){socket[_0x708d('0x51')](_0x708d('0x52'),{'id':Number(_0x322187[_0x708d('0x28')]['id']),'tags':_0x3cb517||[]});return{'id':Number(_0x322187[_0x708d('0x28')]['id']),'tags':_0x3cb517||[]};});}})[_0x708d('0x1a')](respondWithResult(_0x4d8fae,null))[_0x708d('0x26')](handleError(_0x4d8fae,null));};exports[_0x708d('0x53')]=function(_0x24333c,_0x492913){return db[_0x708d('0x2a')][_0x708d('0x34')]({'where':{'id':_0x24333c['params']['id']}})[_0x708d('0x1a')](handleEntityNotFound(_0x492913,null))['then'](function(_0x56d10f){if(_0x56d10f){return _0x56d10f['removeTags'](_0x24333c[_0x708d('0x24')][_0x708d('0x3c')]);}})['then'](respondWithStatusCode(_0x492913,null))[_0x708d('0x26')](handleError(_0x492913,null));};exports['download']=function(_0x541c95,_0x2c500b){var _0x34d7d6=moment()[_0x708d('0x54')]()[_0x708d('0x55')]();var _0x52e008=path[_0x708d('0x56')](config[_0x708d('0x57')],'server',_0x708d('0x58'),_0x708d('0x59'));var _0x3d3f18=path[_0x708d('0x56')](config[_0x708d('0x57')],'server',_0x708d('0x58'),'attachments');var _0x4e85ea=path[_0x708d('0x56')](_0x52e008,_0x34d7d6);var _0x4af72b=util[_0x708d('0x5a')](_0x708d('0x5b'),_0x541c95[_0x708d('0x28')]['id'],_0x34d7d6);var _0x4ed857=path[_0x708d('0x56')](_0x52e008,_0x4af72b);var _0x3bc8a0=[];if(_0x541c95[_0x708d('0x24')][_0x708d('0x5c')]){_0x3bc8a0[_0x708d('0x5d')]({'model':db[_0x708d('0x5e')],'as':_0x708d('0x5f'),'raw':!![]});}var _0x20ea3c=[{'model':db[_0x708d('0x39')],'as':_0x708d('0x60'),'attributes':['id',_0x708d('0x36'),'from','to','cc',_0x708d('0x61'),'subject',_0x708d('0x62')],'where':{'secret':![]},'order':qs[_0x708d('0x41')]('id'),'include':_0x3bc8a0}];return db[_0x708d('0x2a')][_0x708d('0x34')]({'where':{'id':_0x541c95[_0x708d('0x28')]['id']},'include':_0x20ea3c})['then'](handleEntityNotFound(_0x2c500b,null))[_0x708d('0x1a')](function(_0x496c01){if(_0x496c01&&_0x496c01[_0x708d('0x60')]){var _0x3995ad=_0x496c01[_0x708d('0x63')]({'plain':!![]});fs['mkdirSync'](_0x4e85ea);return BPromise[_0x708d('0x64')](_0x3995ad[_0x708d('0x60')],function(_0x55727b,_0x4bda6a){var _0x437e4a={'from':_0x55727b[_0x708d('0x65')],'to':_0x55727b['to']||_0x708d('0x66'),'subject':_0x55727b['subject'],'html':htmlEntities['decode'](_0x55727b[_0x708d('0x36')]),'headers':{'Date':moment(_0x55727b[_0x708d('0x62')])[_0x708d('0x5a')](_0x708d('0x67'))},'attachments':[]};if(_0x55727b['cc']){_0x437e4a[_0x708d('0x68')]['Cc']=_0x55727b['cc'];}if(_0x55727b[_0x708d('0x61')]){_0x437e4a[_0x708d('0x68')]['Bcc']=_0x55727b[_0x708d('0x61')];}return new BPromise(function(_0x20cdec,_0x191f88){if(_0x55727b[_0x708d('0x5f')]){for(var _0x45c009=0x0;_0x45c009<_0x55727b[_0x708d('0x5f')][_0x708d('0x30')];_0x45c009++){var _0x15f16b=_0x55727b['Attachments'][_0x45c009];var _0x4f7366=path['join'](_0x3d3f18,_0x15f16b[_0x708d('0x69')]);if(fs[_0x708d('0x6a')](_0x4f7366)){_0x437e4a[_0x708d('0x5c')][_0x708d('0x5d')]({'name':_0x15f16b[_0x708d('0x1c')],'contentType':_0x15f16b['type'],'data':fs[_0x708d('0x6b')](_0x4f7366)});}}}emlformat[_0x708d('0x6c')](_0x437e4a,function(_0xc1718d,_0x4e9f8b){if(_0xc1718d)return _0x191f88(_0xc1718d);fs['writeFileSync'](path['join'](_0x4e85ea,util['format'](_0x708d('0x6d'),_0x4bda6a)),_0x4e9f8b);return _0x20cdec(_0x4e9f8b);});});})['then'](function(){return new BPromise(function(_0x36ab56,_0x581851){zipdir(_0x4e85ea,{'saveTo':_0x4ed857},function(_0x152da4,_0x179dec){if(_0x152da4)return _0x581851(_0x152da4);return _0x36ab56(_0x179dec);});})[_0x708d('0x1a')](function(){return new BPromise(function(_0x526641,_0x568bd8){rimraf(_0x4e85ea,function(_0x2c8511){if(_0x2c8511)_0x568bd8(_0x2c8511);return _0x526641();});});})[_0x708d('0x1a')](function(){return _0x2c500b[_0x708d('0x6e')](_0x4ed857,_0x4af72b,function(_0x52dc2d){if(!_0x52dc2d)fs[_0x708d('0x6f')](_0x4ed857);});});});}else{return _0x2c500b[_0x708d('0xf')](0xc8);}})['catch'](handleError(_0x2c500b,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 5b5b270..c44160a 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 _0x4c88=['MailMessage','setMaxListeners','save','update','remove','getUsers','then','Users','findAll','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x593dd4,_0x111835){var _0x4b0e4b=function(_0x594bad){while(--_0x594bad){_0x593dd4['push'](_0x593dd4['shift']());}};_0x4b0e4b(++_0x111835);}(_0x4c88,0x1c6));var _0x84c8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4c88[_0x59ee6f];return _0x4c0979;};'use strict';var EventEmitter=require(_0x84c8('0x0'));var MailInteraction=require(_0x84c8('0x1'))['db']['MailInteraction'];var MailMessage=require('../../mysqldb')['db'][_0x84c8('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x84c8('0x3')](0x0);var events={'afterCreate':_0x84c8('0x4'),'afterUpdate':_0x84c8('0x5'),'afterDestroy':_0x84c8('0x6')};function emitEvent(_0xb96aca){return function(_0x51931a,_0x1a60be,_0x1d0174){_0x51931a[_0x84c8('0x7')]({'attributes':['id'],'raw':!![]})[_0x84c8('0x8')](function(_0x1d6c41){_0x51931a['setDataValue'](_0x84c8('0x9'),_0x1d6c41['map'](function(_0x13c48b){return{'id':_0x13c48b['id']};}));return MailMessage[_0x84c8('0xa')]({'where':{'MailInteractionId':_0x51931a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x84c8('0x8')](function(_0x402a89){_0x51931a[_0x84c8('0xb')](_0x84c8('0xc'),_0x402a89[_0x84c8('0xd')]);MailInteractionEvents[_0x84c8('0xe')](_0xb96aca+':'+_0x51931a['id'],_0x51931a);MailInteractionEvents[_0x84c8('0xe')](_0xb96aca,_0x51931a);_0x1d0174(null);})[_0x84c8('0xf')](_0x1d0174(null));};}for(var e in events){if(events[_0x84c8('0x10')](e)){var event=events[e];MailInteraction[_0x84c8('0x11')](e,emitEvent(event));}}module[_0x84c8('0x12')]=MailInteractionEvents; \ No newline at end of file +var _0xd894=['catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','findAll','unreadMessages','length','emit'];(function(_0x472356,_0x1f4629){var _0x2a5194=function(_0x153861){while(--_0x153861){_0x472356['push'](_0x472356['shift']());}};_0x2a5194(++_0x1f4629);}(_0xd894,0x16c));var _0x4d89=function(_0x52fbd8,_0x23925a){_0x52fbd8=_0x52fbd8-0x0;var _0x452193=_0xd894[_0x52fbd8];return _0x452193;};'use strict';var EventEmitter=require(_0x4d89('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x4d89('0x1')];var MailMessage=require(_0x4d89('0x2'))['db'][_0x4d89('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x4d89('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4d89('0x5'),'afterDestroy':_0x4d89('0x6')};function emitEvent(_0x89fafd){return function(_0xcbad04,_0x5095e4,_0x1ceecd){_0xcbad04[_0x4d89('0x7')]({'attributes':['id'],'raw':!![]})[_0x4d89('0x8')](function(_0x4e6dda){_0xcbad04[_0x4d89('0x9')]('Users',_0x4e6dda['map'](function(_0x3fc6ad){return{'id':_0x3fc6ad['id']};}));return MailMessage[_0x4d89('0xa')]({'where':{'MailInteractionId':_0xcbad04['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0xa0de3c){_0xcbad04[_0x4d89('0x9')](_0x4d89('0xb'),_0xa0de3c[_0x4d89('0xc')]);MailInteractionEvents[_0x4d89('0xd')](_0x89fafd+':'+_0xcbad04['id'],_0xcbad04);MailInteractionEvents[_0x4d89('0xd')](_0x89fafd,_0xcbad04);_0x1ceecd(null);})[_0x4d89('0xe')](_0x1ceecd(null));};}for(var e in events){if(events[_0x4d89('0xf')](e)){var event=events[e];MailInteraction[_0x4d89('0x10')](e,emitEvent(event));}}module[_0x4d89('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 23ded27..ec54ed6 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 _0x76a6=['exports','define','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','changed','substatusAt','models','get','MailMessage','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes'];(function(_0x276f6d,_0x10a50e){var _0xda31b5=function(_0x5cfb89){while(--_0x5cfb89){_0x276f6d['push'](_0x276f6d['shift']());}};_0xda31b5(++_0x10a50e);}(_0x76a6,0xb5));var _0x676a=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x76a6[_0x422ac3];return _0x53c0d4;};'use strict';var _=require(_0x676a('0x0'));var util=require(_0x676a('0x1'));var logger=require(_0x676a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x676a('0x3'));var rp=require(_0x676a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x676a('0x5'));var config=require(_0x676a('0x6'));var attributes=require(_0x676a('0x7'));module[_0x676a('0x8')]=function(_0x4ec939,_0x449e2f){return _0x4ec939[_0x676a('0x9')]('MailInteraction',attributes,{'tableName':_0x676a('0xa'),'paranoid':![],'indexes':[{'name':_0x676a('0xb'),'fields':[_0x676a('0xc'),'to'],'type':_0x676a('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x34defd,_0x32a568,_0x4df681){if(_0x34defd[_0x676a('0xe')]){_0x34defd['substatusAt']=moment()[_0x676a('0xf')](_0x676a('0x10'));}if(_0x34defd[_0x676a('0x11')]){_0x34defd[_0x676a('0x12')]=moment()[_0x676a('0xf')](_0x676a('0x10'));}_0x4df681(null,_0x32a568);},'beforeUpdate':function(_0x231403,_0x4218ad,_0x368ed9){if(_0x231403[_0x676a('0x13')]('substatus')){_0x231403['substatusAt']=_0x231403[_0x676a('0xe')]?moment()[_0x676a('0xf')](_0x676a('0x10')):null;}if(_0x231403['changed'](_0x676a('0x11'))){_0x231403[_0x676a('0x12')]=moment()[_0x676a('0xf')](_0x676a('0x10'));_0x231403[_0x676a('0xe')]=null;_0x231403[_0x676a('0x14')]=null;}_0x368ed9(null,_0x231403);},'afterUpdate':function(_0x1a781c,_0x42391d,_0x598445){var _0x4c4d0f=_0x4ec939[_0x676a('0x15')];var _0xb77f97=_0x1a781c[_0x676a('0x16')]({'plain':!![]});if(_0xb77f97['closed']){return _0x4c4d0f[_0x676a('0x17')]['update']({'read':!![]},{'where':{'MailInteractionId':_0xb77f97['id']}})[_0x676a('0x18')](function(){_0x598445();})['catch'](function(_0x5b55d7){_0x598445(_0x5b55d7);});}else{_0x598445();}}},'charset':_0x676a('0x19'),'collate':_0x676a('0x1a')});}; \ No newline at end of file +var _0xca4f=['path','rimraf','./mailInteraction.attributes','define','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','substatus','closedAt','models','get','MailMessage','catch','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird'];(function(_0xc2dacc,_0x121118){var _0x117498=function(_0x235c1d){while(--_0x235c1d){_0xc2dacc['push'](_0xc2dacc['shift']());}};_0x117498(++_0x121118);}(_0xca4f,0x127));var _0xfca4=function(_0x17830c,_0xee03){_0x17830c=_0x17830c-0x0;var _0x3d5357=_0xca4f[_0x17830c];return _0x3d5357;};'use strict';var _=require(_0xfca4('0x0'));var util=require('util');var logger=require(_0xfca4('0x1'))(_0xfca4('0x2'));var moment=require('moment');var BPromise=require(_0xfca4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfca4('0x4'));var rimraf=require(_0xfca4('0x5'));var config=require('../../config/environment');var attributes=require(_0xfca4('0x6'));module['exports']=function(_0xb979c2,_0x5ea0f6){return _0xb979c2[_0xfca4('0x7')]('MailInteraction',attributes,{'tableName':_0xfca4('0x8'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfca4('0x9'),'to'],'type':_0xfca4('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21253a,_0xda6acd,_0x2ea27d){if(_0x21253a['substatus']){_0x21253a[_0xfca4('0xb')]=moment()[_0xfca4('0xc')](_0xfca4('0xd'));}if(_0x21253a[_0xfca4('0xe')]){_0x21253a['closedAt']=moment()[_0xfca4('0xc')](_0xfca4('0xd'));}_0x2ea27d(null,_0xda6acd);},'beforeUpdate':function(_0x42f5fd,_0xb5a26f,_0x3ecced){if(_0x42f5fd['changed'](_0xfca4('0xf'))){_0x42f5fd[_0xfca4('0xb')]=_0x42f5fd[_0xfca4('0xf')]?moment()[_0xfca4('0xc')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x42f5fd['changed'](_0xfca4('0xe'))){_0x42f5fd[_0xfca4('0x10')]=moment()[_0xfca4('0xc')]('YYYY-MM-DD\x20HH:mm:ss');_0x42f5fd['substatus']=null;_0x42f5fd[_0xfca4('0xb')]=null;}_0x3ecced(null,_0x42f5fd);},'afterUpdate':function(_0x24923a,_0x1e209c,_0x16daf0){var _0x3f8514=_0xb979c2[_0xfca4('0x11')];var _0x595dc1=_0x24923a[_0xfca4('0x12')]({'plain':!![]});if(_0x595dc1[_0xfca4('0xe')]){return _0x3f8514[_0xfca4('0x13')]['update']({'read':!![]},{'where':{'MailInteractionId':_0x595dc1['id']}})['then'](function(){_0x16daf0();})[_0xfca4('0x14')](function(_0xf2a410){_0x16daf0(_0xf2a410);});}else{_0x16daf0();}}},'charset':_0xfca4('0x15'),'collate':_0xfca4('0x16')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index c9be063..4e64d52 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 _0x4c8f=['socket.io-emitter','register','then','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','result','catch','MailInteraction','options','raw','attributes','limit','debug','UpdateMailInteraction','AddTagsToMailInteraction','find','where','addTags','body','ids','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost'];(function(_0x2446ef,_0x5b42d5){var _0x53e0a9=function(_0xd9637b){while(--_0xd9637b){_0x2446ef['push'](_0x2446ef['shift']());}};_0x53e0a9(++_0x5b42d5);}(_0x4c8f,0x10b));var _0xf4c8=function(_0x447148,_0x33379b){_0x447148=_0x447148-0x0;var _0x3ee5df=_0x4c8f[_0x447148];return _0x3ee5df;};'use strict';var _=require(_0xf4c8('0x0'));var util=require(_0xf4c8('0x1'));var moment=require('moment');var BPromise=require(_0xf4c8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf4c8('0x3'));var db=require(_0xf4c8('0x4'))['db'];var utils=require(_0xf4c8('0x5'));var logger=require(_0xf4c8('0x6'))(_0xf4c8('0x7'));var config=require(_0xf4c8('0x8'));var jayson=require(_0xf4c8('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xf4c8('0xa')]=_[_0xf4c8('0xb')](config[_0xf4c8('0xa')],{'host':_0xf4c8('0xc'),'port':0x18eb});var socket=require(_0xf4c8('0xd'))(new Redis(config[_0xf4c8('0xa')]));require('./mailInteraction.socket')[_0xf4c8('0xe')](socket);function respondWithRpcPromise(_0x5978a6,_0x45fb7a,_0x1981fc){return new BPromise(function(_0xb07b04,_0x124bf3){return client['request'](_0x5978a6,_0x1981fc)[_0xf4c8('0xf')](function(_0x2798f8){logger[_0xf4c8('0x10')]('MailInteraction,\x20%s,\x20%s',_0x45fb7a,_0xf4c8('0x11'));logger['debug'](_0xf4c8('0x12'),_0x45fb7a,'request\x20sent',JSON[_0xf4c8('0x13')](_0x2798f8));if(_0x2798f8[_0xf4c8('0x14')]){if(_0x2798f8[_0xf4c8('0x14')][_0xf4c8('0x15')]===0x1f4){logger['error'](_0xf4c8('0x16'),_0x45fb7a,_0x2798f8[_0xf4c8('0x14')]['message']);return _0x124bf3(_0x2798f8['error'][_0xf4c8('0x17')]);}logger[_0xf4c8('0x14')](_0xf4c8('0x16'),_0x45fb7a,_0x2798f8[_0xf4c8('0x14')][_0xf4c8('0x17')]);return _0xb07b04(_0x2798f8[_0xf4c8('0x14')][_0xf4c8('0x17')]);}else{logger['info'](_0xf4c8('0x16'),_0x45fb7a,_0xf4c8('0x11'));_0xb07b04(_0x2798f8[_0xf4c8('0x18')][_0xf4c8('0x17')]);}})[_0xf4c8('0x19')](function(_0x19a0bf){logger[_0xf4c8('0x14')](_0xf4c8('0x16'),_0x45fb7a,_0x19a0bf);_0x124bf3(_0x19a0bf);});});}exports['UpdateMailInteraction']=function(_0x3d2786){var _0xe1734b=this;return new Promise(function(_0xb3b00b,_0x340889){return db[_0xf4c8('0x1a')]['update'](_0x3d2786['body'],{'raw':_0x3d2786[_0xf4c8('0x1b')]?_0x3d2786['options'][_0xf4c8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d2786['options']?_0x3d2786['options']['where']||null:null,'attributes':_0x3d2786[_0xf4c8('0x1b')]?_0x3d2786[_0xf4c8('0x1b')][_0xf4c8('0x1d')]||null:null,'limit':_0x3d2786[_0xf4c8('0x1b')]?_0x3d2786[_0xf4c8('0x1b')][_0xf4c8('0x1e')]||null:null})[_0xf4c8('0xf')](function(_0x3ac8d3){logger['info']('UpdateMailInteraction',_0x3d2786);logger[_0xf4c8('0x1f')]('UpdateMailInteraction',_0x3d2786,JSON[_0xf4c8('0x13')](_0x3ac8d3));_0xb3b00b(_0x3ac8d3);})[_0xf4c8('0x19')](function(_0xb624d0){logger['error'](_0xf4c8('0x20'),_0xb624d0['message'],_0x3d2786);_0x340889(_0xe1734b[_0xf4c8('0x14')](0x1f4,_0xb624d0[_0xf4c8('0x17')]));});});};exports[_0xf4c8('0x21')]=function(_0x21d94e){return new Promise(function(_0x4fdaeb,_0x21dcb9){return db[_0xf4c8('0x1a')][_0xf4c8('0x22')]({'where':_0x21d94e['options']?_0x21d94e[_0xf4c8('0x1b')][_0xf4c8('0x23')]||null:null})[_0xf4c8('0xf')](function(_0x1c8ee8){if(_0x1c8ee8){return _0x1c8ee8[_0xf4c8('0x24')](_0x21d94e[_0xf4c8('0x25')][_0xf4c8('0x26')],_['omit'](_0x21d94e[_0xf4c8('0x25')],[_0xf4c8('0x26'),'id'])||{});}})['spread'](function(_0x2380ff){logger[_0xf4c8('0x10')](_0xf4c8('0x27'),_0x21d94e);logger[_0xf4c8('0x1f')](_0xf4c8('0x27'),_0x21d94e,JSON['stringify'](_0x2380ff));_0x4fdaeb(_0x2380ff);})['catch'](function(_0x368f33){logger[_0xf4c8('0x14')](_0xf4c8('0x27'),_0x368f33[_0xf4c8('0x17')],_0x21d94e);_0x21dcb9(_this[_0xf4c8('0x14')](0x1f4,_0x368f33[_0xf4c8('0x17')]));});});}; \ No newline at end of file +var _0xa8bf=['result','catch','UpdateMailInteraction','update','body','options','raw','where','attributes','limit','then','debug','stringify','AddTagsToMailInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','info','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','error','code','message','MailInteraction,\x20%s,\x20%s'];(function(_0xf363f0,_0x3b5eeb){var _0x55a386=function(_0x548349){while(--_0x548349){_0xf363f0['push'](_0xf363f0['shift']());}};_0x55a386(++_0x3b5eeb);}(_0xa8bf,0x1c2));var _0xfa8b=function(_0x5e1eae,_0x2d2a56){_0x5e1eae=_0x5e1eae-0x0;var _0x3217c5=_0xa8bf[_0x5e1eae];return _0x3217c5;};'use strict';var _=require(_0xfa8b('0x0'));var util=require(_0xfa8b('0x1'));var moment=require(_0xfa8b('0x2'));var BPromise=require(_0xfa8b('0x3'));var rs=require(_0xfa8b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfa8b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa8b('0x6'))(_0xfa8b('0x7'));var config=require('../../config/environment');var jayson=require(_0xfa8b('0x8'));var client=jayson[_0xfa8b('0x9')][_0xfa8b('0xa')]({'port':0x232a});config[_0xfa8b('0xb')]=_['defaults'](config['redis'],{'host':_0xfa8b('0xc'),'port':0x18eb});var socket=require(_0xfa8b('0xd'))(new Redis(config[_0xfa8b('0xb')]));require(_0xfa8b('0xe'))['register'](socket);function respondWithRpcPromise(_0x19ec1b,_0x32f805,_0x5aaa70){return new BPromise(function(_0x113639,_0x2e7ae7){return client[_0xfa8b('0xf')](_0x19ec1b,_0x5aaa70)['then'](function(_0x4862cd){logger[_0xfa8b('0x10')]('MailInteraction,\x20%s,\x20%s',_0x32f805,_0xfa8b('0x11'));logger['debug'](_0xfa8b('0x12'),_0x32f805,'request\x20sent',JSON['stringify'](_0x4862cd));if(_0x4862cd[_0xfa8b('0x13')]){if(_0x4862cd['error'][_0xfa8b('0x14')]===0x1f4){logger[_0xfa8b('0x13')]('MailInteraction,\x20%s,\x20%s',_0x32f805,_0x4862cd[_0xfa8b('0x13')][_0xfa8b('0x15')]);return _0x2e7ae7(_0x4862cd['error']['message']);}logger['error'](_0xfa8b('0x16'),_0x32f805,_0x4862cd[_0xfa8b('0x13')][_0xfa8b('0x15')]);return _0x113639(_0x4862cd['error'][_0xfa8b('0x15')]);}else{logger[_0xfa8b('0x10')](_0xfa8b('0x16'),_0x32f805,_0xfa8b('0x11'));_0x113639(_0x4862cd[_0xfa8b('0x17')]['message']);}})[_0xfa8b('0x18')](function(_0x96a6a){logger[_0xfa8b('0x13')](_0xfa8b('0x16'),_0x32f805,_0x96a6a);_0x2e7ae7(_0x96a6a);});});}exports[_0xfa8b('0x19')]=function(_0x4cda66){var _0x138c3e=this;return new Promise(function(_0x1cfe4d,_0x34d284){return db['MailInteraction'][_0xfa8b('0x1a')](_0x4cda66[_0xfa8b('0x1b')],{'raw':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66['options'][_0xfa8b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66[_0xfa8b('0x1c')][_0xfa8b('0x1e')]||null:null,'attributes':_0x4cda66['options']?_0x4cda66[_0xfa8b('0x1c')][_0xfa8b('0x1f')]||null:null,'limit':_0x4cda66[_0xfa8b('0x1c')]?_0x4cda66['options'][_0xfa8b('0x20')]||null:null})[_0xfa8b('0x21')](function(_0x370cae){logger[_0xfa8b('0x10')](_0xfa8b('0x19'),_0x4cda66);logger[_0xfa8b('0x22')](_0xfa8b('0x19'),_0x4cda66,JSON[_0xfa8b('0x23')](_0x370cae));_0x1cfe4d(_0x370cae);})[_0xfa8b('0x18')](function(_0x237d6b){logger['error'](_0xfa8b('0x19'),_0x237d6b[_0xfa8b('0x15')],_0x4cda66);_0x34d284(_0x138c3e[_0xfa8b('0x13')](0x1f4,_0x237d6b[_0xfa8b('0x15')]));});});};exports[_0xfa8b('0x24')]=function(_0x55b3e3){return new Promise(function(_0x1659fa,_0x1e08c9){return db['MailInteraction'][_0xfa8b('0x25')]({'where':_0x55b3e3[_0xfa8b('0x1c')]?_0x55b3e3['options'][_0xfa8b('0x1e')]||null:null})[_0xfa8b('0x21')](function(_0x268356){if(_0x268356){return _0x268356[_0xfa8b('0x26')](_0x55b3e3[_0xfa8b('0x1b')][_0xfa8b('0x27')],_[_0xfa8b('0x28')](_0x55b3e3[_0xfa8b('0x1b')],[_0xfa8b('0x27'),'id'])||{});}})[_0xfa8b('0x29')](function(_0x27f158){logger['info']('AddTags',_0x55b3e3);logger['debug'](_0xfa8b('0x2a'),_0x55b3e3,JSON[_0xfa8b('0x23')](_0x27f158));_0x1659fa(_0x27f158);})[_0xfa8b('0x18')](function(_0x3a00ea){logger[_0xfa8b('0x13')](_0xfa8b('0x2a'),_0x3a00ea['message'],_0x55b3e3);_0x1e08c9(_this[_0xfa8b('0x13')](0x1f4,_0x3a00ea['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index aa7d1be..b34f217 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 _0xf093=['removeListener','register','./mailInteraction.events','save','remove','emit'];(function(_0x26ce63,_0x21ead2){var _0x48ce1=function(_0x4fc8aa){while(--_0x4fc8aa){_0x26ce63['push'](_0x26ce63['shift']());}};_0x48ce1(++_0x21ead2);}(_0xf093,0xaa));var _0x3f09=function(_0x3e57d0,_0x3a586b){_0x3e57d0=_0x3e57d0-0x0;var _0x14f87e=_0xf093[_0x3e57d0];return _0x14f87e;};'use strict';var MailInteractionEvents=require(_0x3f09('0x0'));var events=[_0x3f09('0x1'),_0x3f09('0x2'),'update'];function createListener(_0x3ca55e,_0x516f35){return function(_0x1f1c9e){_0x516f35[_0x3f09('0x3')](_0x3ca55e,_0x1f1c9e);};}function removeListener(_0x59483c,_0x1299b5){return function(){MailInteractionEvents[_0x3f09('0x4')](_0x59483c,_0x1299b5);};}exports[_0x3f09('0x5')]=function(_0x28e5b6){for(var _0x2fae31=0x0,_0x112b23=events['length'];_0x2fae31<_0x112b23;_0x2fae31++){var _0xd70095=events[_0x2fae31];var _0x3174fc=createListener('mailInteraction:'+_0xd70095,_0x28e5b6);MailInteractionEvents['on'](_0xd70095,_0x3174fc);}}; \ No newline at end of file +var _0x74e1=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','removeListener'];(function(_0x411d16,_0x3547ff){var _0x181975=function(_0x49300d){while(--_0x49300d){_0x411d16['push'](_0x411d16['shift']());}};_0x181975(++_0x3547ff);}(_0x74e1,0x7b));var _0x174e=function(_0x4c3c85,_0x49530b){_0x4c3c85=_0x4c3c85-0x0;var _0x6b69ea=_0x74e1[_0x4c3c85];return _0x6b69ea;};'use strict';var MailInteractionEvents=require(_0x174e('0x0'));var events=[_0x174e('0x1'),_0x174e('0x2'),_0x174e('0x3')];function createListener(_0x2b9e23,_0x429744){return function(_0x4382fa){_0x429744['emit'](_0x2b9e23,_0x4382fa);};}function removeListener(_0x31401a,_0x107fbb){return function(){MailInteractionEvents[_0x174e('0x4')](_0x31401a,_0x107fbb);};}exports[_0x174e('0x5')]=function(_0x45a6ef){for(var _0x495d1a=0x0,_0x441fc9=events[_0x174e('0x6')];_0x495d1a<_0x441fc9;_0x495d1a++){var _0x2caf73=events[_0x495d1a];var _0x4833fb=createListener(_0x174e('0x7')+_0x2caf73,_0x45a6ef);MailInteractionEvents['on'](_0x2caf73,_0x4833fb);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 49b456b..c2820c0 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 _0xe861=['/describe','isAuthenticated','exports','express','Router','../../components/auth/service','./mailInteractionHasTag.controller','get'];(function(_0x37135e,_0x1879ac){var _0x3ab8f9=function(_0x28089f){while(--_0x28089f){_0x37135e['push'](_0x37135e['shift']());}};_0x3ab8f9(++_0x1879ac);}(_0xe861,0xb3));var _0x1e86=function(_0x503921,_0x40ffe2){_0x503921=_0x503921-0x0;var _0x307628=_0xe861[_0x503921];return _0x307628;};'use strict';var express=require(_0x1e86('0x0'));var router=express[_0x1e86('0x1')]();var auth=require(_0x1e86('0x2'));var controller=require(_0x1e86('0x3'));router[_0x1e86('0x4')](_0x1e86('0x5'),auth[_0x1e86('0x6')](),controller['describe']);module[_0x1e86('0x7')]=router; \ No newline at end of file +var _0x4c9c=['/describe','isAuthenticated','describe','exports','express','Router','./mailInteractionHasTag.controller','get'];(function(_0x2bc081,_0x15f9de){var _0x8b3bdf=function(_0x1cf44d){while(--_0x1cf44d){_0x2bc081['push'](_0x2bc081['shift']());}};_0x8b3bdf(++_0x15f9de);}(_0x4c9c,0x1ac));var _0xc4c9=function(_0x58779c,_0xe8471b){_0x58779c=_0x58779c-0x0;var _0x5e1897=_0x4c9c[_0x58779c];return _0x5e1897;};'use strict';var express=require(_0xc4c9('0x0'));var router=express[_0xc4c9('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc4c9('0x2'));router[_0xc4c9('0x3')](_0xc4c9('0x4'),auth[_0xc4c9('0x5')](),controller[_0xc4c9('0x6')]);module[_0xc4c9('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index 9d70f2a..2d4e06b 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(_0x100488,_0x4f9422){var _0x464ce5=function(_0x42cbaa){while(--_0x42cbaa){_0x100488['push'](_0x100488['shift']());}};_0x464ce5(++_0x4f9422);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x3add92,_0x41a20d){var _0x3e37af=function(_0x2b7d3e){while(--_0x2b7d3e){_0x3add92['push'](_0x3add92['shift']());}};_0x3e37af(++_0x41a20d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 ac6de4e..3cb2cbd 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 _0x8ebd=['INTEGER','sequelize'];(function(_0x24d06d,_0x392e7b){var _0xaf5708=function(_0x219b1e){while(--_0x219b1e){_0x24d06d['push'](_0x24d06d['shift']());}};_0xaf5708(++_0x392e7b);}(_0x8ebd,0x109));var _0xd8eb=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x8ebd[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0xd8eb('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0xd8eb('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xd8eb('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0x5be3=['sequelize','exports'];(function(_0x51c883,_0x4f8500){var _0xb1175a=function(_0x5e104b){while(--_0x5e104b){_0x51c883['push'](_0x51c883['shift']());}};_0xb1175a(++_0x4f8500);}(_0x5be3,0x15c));var _0x35be=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5be3[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x35be('0x0'));module[_0x35be('0x1')]={'MailInteractionId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'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 6156bbf..348643d 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 _0xd1fa=['define','mail_interaction_has_tags','exports'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0xd1fa,0xc5));var _0xad1f=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xd1fa[_0x8de54f];return _0x14cba4;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0xad1f('0x0')]=function(_0x1dd601){return _0x1dd601[_0xad1f('0x1')]('MailInteractionHasTag',attributes,{'tableName':_0xad1f('0x2'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34a9=['exports','define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0x34a9,0x13f));var _0x934a=function(_0x4effbe,_0x39beb3){_0x4effbe=_0x4effbe-0x0;var _0x26d43e=_0x34a9[_0x4effbe];return _0x26d43e;};'use strict';var attributes=require(_0x934a('0x0'));module[_0x934a('0x1')]=function(_0x4201ce){return _0x4201ce[_0x934a('0x2')](_0x934a('0x3'),attributes,{'tableName':_0x934a('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 f897357..a3be96f 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 _0x58a4=['reject','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','tracked','mail','create','put','update','/:id/reject'];(function(_0x4df1f5,_0x39c6d2){var _0x56585b=function(_0x287b6e){while(--_0x287b6e){_0x4df1f5['push'](_0x4df1f5['shift']());}};_0x56585b(++_0x39c6d2);}(_0x58a4,0xbf));var _0x458a=function(_0x3198fd,_0x3729d8){_0x3198fd=_0x3198fd-0x0;var _0x2dd0b=_0x58a4[_0x3198fd];return _0x2dd0b;};'use strict';var multer=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var path=require(_0x458a('0x2'));var timeout=require(_0x458a('0x3'));var express=require(_0x458a('0x4'));var router=express[_0x458a('0x5')]();var fs_extra=require(_0x458a('0x6'));var auth=require(_0x458a('0x7'));var interaction=require(_0x458a('0x8'));var config=require(_0x458a('0x9'));var controller=require(_0x458a('0xa'));router[_0x458a('0xb')]('/',auth[_0x458a('0xc')](),controller['index']);router['get'](_0x458a('0xd'),auth[_0x458a('0xc')](),controller[_0x458a('0xe')]);router[_0x458a('0xb')](_0x458a('0xf'),auth['isAuthenticated'](),controller['show']);router[_0x458a('0xb')](_0x458a('0x10'),auth[_0x458a('0xc')](),controller[_0x458a('0x11')]);router[_0x458a('0x12')]('/',auth['isAuthenticated'](),interaction[_0x458a('0x13')](_0x458a('0x14'),'mailmessage:create'),controller[_0x458a('0x15')]);router[_0x458a('0x16')](_0x458a('0xf'),auth[_0x458a('0xc')](),controller[_0x458a('0x17')]);router['put']('/:id/accept',auth[_0x458a('0xc')](),controller['accept']);router[_0x458a('0x16')](_0x458a('0x18'),auth[_0x458a('0xc')](),controller[_0x458a('0x19')]);router[_0x458a('0x1a')](_0x458a('0xf'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe9ad=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','tracked','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x1b2ff7,_0x12a034){var _0x31656a=function(_0x1165a5){while(--_0x1165a5){_0x1b2ff7['push'](_0x1b2ff7['shift']());}};_0x31656a(++_0x12a034);}(_0xe9ad,0x82));var _0xde9a=function(_0x5bf840,_0x9fc2ab){_0x5bf840=_0x5bf840-0x0;var _0x4f4355=_0xe9ad[_0x5bf840];return _0x4f4355;};'use strict';var multer=require(_0xde9a('0x0'));var util=require(_0xde9a('0x1'));var path=require(_0xde9a('0x2'));var timeout=require(_0xde9a('0x3'));var express=require(_0xde9a('0x4'));var router=express[_0xde9a('0x5')]();var fs_extra=require(_0xde9a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xde9a('0x7'));var config=require(_0xde9a('0x8'));var controller=require(_0xde9a('0x9'));router[_0xde9a('0xa')]('/',auth['isAuthenticated'](),controller[_0xde9a('0xb')]);router[_0xde9a('0xa')](_0xde9a('0xc'),auth['isAuthenticated'](),controller[_0xde9a('0xd')]);router[_0xde9a('0xa')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x10')]);router[_0xde9a('0xa')](_0xde9a('0x11'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x12')]);router['post']('/',auth[_0xde9a('0xf')](),interaction[_0xde9a('0x13')](_0xde9a('0x14'),_0xde9a('0x15')),controller[_0xde9a('0x16')]);router[_0xde9a('0x17')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x18')]);router['put'](_0xde9a('0x19'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1a')]);router[_0xde9a('0x17')](_0xde9a('0x1b'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1c')]);router[_0xde9a('0x1d')](_0xde9a('0xe'),auth[_0xde9a('0xf')](),controller[_0xde9a('0x1e')]);module[_0xde9a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index f686ea8..c851af6 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 _0xe139=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','Email','Chat','sequelize','exports','TEXT'];(function(_0x34c027,_0x123688){var _0x47bff0=function(_0x19c4a9){while(--_0x19c4a9){_0x34c027['push'](_0x34c027['shift']());}};_0x47bff0(++_0x123688);}(_0xe139,0x1eb));var _0x9e13=function(_0x5edf2d,_0x1018a2){_0x5edf2d=_0x5edf2d-0x0;var _0x59433f=_0xe139[_0x5edf2d];return _0x59433f;};'use strict';var Sequelize=require(_0x9e13('0x0'));var _=require('lodash');module[_0x9e13('0x1')]={'body':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x9e13('0x4'))},'read':{'type':Sequelize[_0x9e13('0x5')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9e13('0x6')]('in',_0x9e13('0x7')),'defaultValue':_0x9e13('0x7'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x9e13('0x8')]},'to':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'cc':{'type':Sequelize['TEXT']('long')},'bcc':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'subject':{'type':Sequelize[_0x9e13('0x2')]},'sentAt':{'type':Sequelize[_0x9e13('0x9')]},'attach':{'type':Sequelize[_0x9e13('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x9e13('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0x9e13('0x9')]},'originTo':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'originCc':{'type':Sequelize[_0x9e13('0x2')](_0x9e13('0x3'))},'originChannel':{'type':Sequelize[_0x9e13('0x6')](_0x9e13('0xb'),_0x9e13('0xc')),'defaultValue':_0x9e13('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x1fcf=['lodash','exports','long','medium','BOOLEAN','STRING','TEXT','INTEGER','DATE','ENUM','Email','Chat','sequelize'];(function(_0x190ceb,_0x2345b2){var _0x5ce806=function(_0x432853){while(--_0x432853){_0x190ceb['push'](_0x190ceb['shift']());}};_0x5ce806(++_0x2345b2);}(_0x1fcf,0x144));var _0xf1fc=function(_0x276232,_0x20b6b8){_0x276232=_0x276232-0x0;var _0x427024=_0x1fcf[_0x276232];return _0x427024;};'use strict';var Sequelize=require(_0xf1fc('0x0'));var _=require(_0xf1fc('0x1'));module[_0xf1fc('0x2')]={'body':{'type':Sequelize['TEXT'](_0xf1fc('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0xf1fc('0x4'))},'read':{'type':Sequelize[_0xf1fc('0x5')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xf1fc('0x6')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'cc':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'bcc':{'type':Sequelize[_0xf1fc('0x7')]('long')},'subject':{'type':Sequelize[_0xf1fc('0x7')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xf1fc('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf1fc('0x5')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf1fc('0x9')]},'originTo':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'originCc':{'type':Sequelize[_0xf1fc('0x7')](_0xf1fc('0x3'))},'originChannel':{'type':Sequelize[_0xf1fc('0xa')](_0xf1fc('0xb'),_0xf1fc('0xc')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index fabdea4..9993c8e 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 _0x9d27=['subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','existsSync','build','unlinkSync','eml-format','moment','util','../../components/interaction/service','api','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','MailMessage,\x20%s,\x20%s','message','result','catch','offset','undefined','limit','count','set','Content-Range','update','end','sendStatus','name','status','index','map','MailMessage','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','include','findAll','rows','params','keys','rawAttributes','includeAll','options','find','body','destroy','describe','create','direction','secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','sendMail','messageId','format','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteractionId','interaction','user','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','email','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','download','unix','toString','server','files','tmp','message-%s.eml','bcc'];(function(_0x40d0a3,_0x2977d0){var _0x546309=function(_0x43383f){while(--_0x43383f){_0x40d0a3['push'](_0x40d0a3['shift']());}};_0x546309(++_0x2977d0);}(_0x9d27,0x9c));var _0x79d2=function(_0x43bd62,_0x107420){_0x43bd62=_0x43bd62-0x0;var _0x22321c=_0x9d27[_0x43bd62];return _0x22321c;};'use strict';var emlformat=require(_0x79d2('0x0'));var moment=require(_0x79d2('0x1'));var util=require(_0x79d2('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var htmlToText=require('html-to-text');var interactionService=require(_0x79d2('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x79d2('0x4'));var interaction_log=require(_0x79d2('0x5'))('mail-interactions');var config=require('../../config/environment');var db=require(_0x79d2('0x6'))['db'];config[_0x79d2('0x7')]=_[_0x79d2('0x8')](config['redis'],{'host':_0x79d2('0x9'),'port':0x18eb});var socket=require(_0x79d2('0xa'))(new Redis(config[_0x79d2('0x7')]));var htmlEntities=require(_0x79d2('0xb'));require('./mailMessage.socket')[_0x79d2('0xc')](socket);var jayson=require(_0x79d2('0xd'));var client=jayson[_0x79d2('0xe')][_0x79d2('0xf')]({'port':0x232c});var client9003=jayson['client'][_0x79d2('0xf')]({'port':0x232b});var client9002=jayson[_0x79d2('0xe')][_0x79d2('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x14c0b0,_0x185996,_0x3cf47b,_0x12b2ee){return new Promise(function(_0xbc24c3,_0x186bd6){var _0x2cfac0=_0x12b2ee||client;return _0x2cfac0[_0x79d2('0x10')](_0x14c0b0,_0x3cf47b)[_0x79d2('0x11')](function(_0x2cf106){logger[_0x79d2('0x12')]('MailMessage,\x20%s,\x20%s',_0x185996,_0x79d2('0x13'));logger[_0x79d2('0x14')](_0x79d2('0x15'),_0x185996,'request\x20sent',JSON[_0x79d2('0x16')](_0x2cf106));if(_0x2cf106[_0x79d2('0x17')]){if(_0x2cf106[_0x79d2('0x17')][_0x79d2('0x18')]===0x1f4){logger[_0x79d2('0x17')](_0x79d2('0x19'),_0x185996,_0x2cf106[_0x79d2('0x17')][_0x79d2('0x1a')]);return _0x186bd6(_0x2cf106[_0x79d2('0x17')][_0x79d2('0x1a')]);}logger[_0x79d2('0x17')](_0x79d2('0x19'),_0x185996,_0x2cf106[_0x79d2('0x17')][_0x79d2('0x1a')]);return _0xbc24c3(_0x2cf106['error'][_0x79d2('0x1a')]);}else{logger['info'](_0x79d2('0x19'),_0x185996,'request\x20sent');_0xbc24c3(_0x2cf106[_0x79d2('0x1b')][_0x79d2('0x1a')]);}})[_0x79d2('0x1c')](function(_0x1c7b22){logger[_0x79d2('0x17')]('MailMessage,\x20%s,\x20%s',_0x185996,_0x1c7b22);_0x186bd6(_0x1c7b22);});});}function respondWithResult(_0x30539a,_0x2f2f60){_0x2f2f60=_0x2f2f60||0xc8;return function(_0x5bdb29){if(_0x5bdb29){return _0x30539a['status'](_0x2f2f60)['json'](_0x5bdb29);}};}function respondWithFilteredResult(_0x41c9ab,_0x4e8d26){return function(_0x4437eb){if(_0x4437eb){var _0x176e68=typeof _0x4e8d26[_0x79d2('0x1d')]===_0x79d2('0x1e')&&typeof _0x4e8d26[_0x79d2('0x1f')]===_0x79d2('0x1e');var _0x5a15d4=_0x4437eb[_0x79d2('0x20')];var _0x338e43=_0x176e68?0x0:_0x4e8d26[_0x79d2('0x1d')];var _0x1f8b8d=_0x176e68?_0x4437eb[_0x79d2('0x20')]:_0x4e8d26[_0x79d2('0x1d')]+_0x4e8d26[_0x79d2('0x1f')];var _0x1af8ec;if(_0x1f8b8d>=_0x5a15d4){_0x1f8b8d=_0x5a15d4;_0x1af8ec=0xc8;}else{_0x1af8ec=0xce;}_0x41c9ab['status'](_0x1af8ec);return _0x41c9ab[_0x79d2('0x21')](_0x79d2('0x22'),_0x338e43+'-'+_0x1f8b8d+'/'+_0x5a15d4)['json'](_0x4437eb);}return null;};}function saveUpdates(_0x253bf2){return function(_0x509750){if(_0x509750){return _0x509750[_0x79d2('0x23')](_0x253bf2)['then'](function(_0x3cf2fe){return _0x3cf2fe;});}return null;};}function removeEntity(_0x1d9f6c){return function(_0x34f80c){if(_0x34f80c){return _0x34f80c['destroy']()[_0x79d2('0x11')](function(){_0x1d9f6c['status'](0xcc)[_0x79d2('0x24')]();});}};}function handleEntityNotFound(_0x1ad9cf){return function(_0x4fcb78){if(!_0x4fcb78){_0x1ad9cf[_0x79d2('0x25')](0x194);}return _0x4fcb78;};}function handleError(_0x464ace,_0x3d8136){_0x3d8136=_0x3d8136||0x1f4;return function(_0x40fa15){logger[_0x79d2('0x17')](_0x40fa15['stack']);if(_0x40fa15[_0x79d2('0x26')]){delete _0x40fa15['name'];}_0x464ace[_0x79d2('0x27')](_0x3d8136)['send'](_0x40fa15);};}exports[_0x79d2('0x28')]=function(_0x64491d,_0x3e1796){var _0x4bfff7={},_0x732d9d={},_0x675198={'count':0x0,'rows':[]};var _0x5e5095=_[_0x79d2('0x29')](db[_0x79d2('0x2a')]['rawAttributes'],function(_0x157e24){return{'name':_0x157e24[_0x79d2('0x2b')],'type':_0x157e24[_0x79d2('0x2c')][_0x79d2('0x2d')]};});_0x732d9d[_0x79d2('0x2e')]=_[_0x79d2('0x29')](_0x5e5095,_0x79d2('0x26'));_0x732d9d[_0x79d2('0x2f')]=_['keys'](_0x64491d[_0x79d2('0x2f')]);_0x732d9d[_0x79d2('0x30')]=_[_0x79d2('0x31')](_0x732d9d[_0x79d2('0x2e')],_0x732d9d[_0x79d2('0x2f')]);_0x4bfff7['attributes']=_[_0x79d2('0x31')](_0x732d9d['model'],qs['fields'](_0x64491d[_0x79d2('0x2f')][_0x79d2('0x32')]));_0x4bfff7['attributes']=_0x4bfff7[_0x79d2('0x33')][_0x79d2('0x34')]?_0x4bfff7[_0x79d2('0x33')]:_0x732d9d[_0x79d2('0x2e')];if(!_0x64491d['query'][_0x79d2('0x35')](_0x79d2('0x36'))){_0x4bfff7[_0x79d2('0x1f')]=qs[_0x79d2('0x1f')](_0x64491d[_0x79d2('0x2f')][_0x79d2('0x1f')]);_0x4bfff7['offset']=qs[_0x79d2('0x1d')](_0x64491d[_0x79d2('0x2f')]['offset']);}_0x4bfff7[_0x79d2('0x37')]=qs[_0x79d2('0x38')](_0x64491d[_0x79d2('0x2f')][_0x79d2('0x38')]);_0x4bfff7['where']=qs[_0x79d2('0x30')](_[_0x79d2('0x39')](_0x64491d[_0x79d2('0x2f')],_0x732d9d['filters']),_0x5e5095);if(_0x64491d[_0x79d2('0x2f')][_0x79d2('0x3a')]){_0x4bfff7[_0x79d2('0x3b')]=_[_0x79d2('0x3c')](_0x4bfff7[_0x79d2('0x3b')],{'$or':_[_0x79d2('0x29')](_0x5e5095,function(_0x5453d8){if(_0x5453d8['type']!=='VIRTUAL'){var _0x475fec={};_0x475fec[_0x5453d8[_0x79d2('0x26')]]={'$like':'%'+_0x64491d[_0x79d2('0x2f')][_0x79d2('0x3a')]+'%'};return _0x475fec;}})});}_0x4bfff7=_[_0x79d2('0x3c')]({},_0x4bfff7,_0x64491d['options']);var _0x515412={'where':_0x4bfff7['where']};return db[_0x79d2('0x2a')][_0x79d2('0x20')](_0x515412)['then'](function(_0xfa891b){_0x675198[_0x79d2('0x20')]=_0xfa891b;if(_0x64491d[_0x79d2('0x2f')]['includeAll']){_0x4bfff7[_0x79d2('0x3d')]=[{'all':!![]}];}return db[_0x79d2('0x2a')][_0x79d2('0x3e')](_0x4bfff7);})[_0x79d2('0x11')](function(_0x196930){_0x675198[_0x79d2('0x3f')]=_0x196930;return _0x675198;})['then'](respondWithFilteredResult(_0x3e1796,_0x4bfff7))['catch'](handleError(_0x3e1796,null));};exports['show']=function(_0x3a4afa,_0xe34997){var _0x24d507={'raw':!![],'where':{'id':_0x3a4afa[_0x79d2('0x40')]['id']}},_0x552ae5={};_0x552ae5[_0x79d2('0x2e')]=_[_0x79d2('0x41')](db[_0x79d2('0x2a')][_0x79d2('0x42')]);_0x552ae5['query']=_[_0x79d2('0x41')](_0x3a4afa[_0x79d2('0x2f')]);_0x552ae5['filters']=_['intersection'](_0x552ae5[_0x79d2('0x2e')],_0x552ae5[_0x79d2('0x2f')]);_0x24d507[_0x79d2('0x33')]=_[_0x79d2('0x31')](_0x552ae5[_0x79d2('0x2e')],qs[_0x79d2('0x32')](_0x3a4afa[_0x79d2('0x2f')][_0x79d2('0x32')]));_0x24d507[_0x79d2('0x33')]=_0x24d507[_0x79d2('0x33')]['length']?_0x24d507['attributes']:_0x552ae5[_0x79d2('0x2e')];if(_0x3a4afa[_0x79d2('0x2f')][_0x79d2('0x43')]){_0x24d507[_0x79d2('0x3d')]=[{'all':!![]}];}_0x24d507=_[_0x79d2('0x3c')]({},_0x24d507,_0x3a4afa[_0x79d2('0x44')]);return db[_0x79d2('0x2a')][_0x79d2('0x45')](_0x24d507)[_0x79d2('0x11')](handleEntityNotFound(_0xe34997,null))[_0x79d2('0x11')](respondWithResult(_0xe34997,null))[_0x79d2('0x1c')](handleError(_0xe34997,null));};exports[_0x79d2('0x23')]=function(_0x2a6385,_0x22ec88){if(_0x2a6385[_0x79d2('0x46')]['id']){delete _0x2a6385[_0x79d2('0x46')]['id'];}return db[_0x79d2('0x2a')]['find']({'where':{'id':_0x2a6385[_0x79d2('0x40')]['id']}})[_0x79d2('0x11')](handleEntityNotFound(_0x22ec88,null))[_0x79d2('0x11')](saveUpdates(_0x2a6385[_0x79d2('0x46')],null))[_0x79d2('0x11')](respondWithResult(_0x22ec88,null))['catch'](handleError(_0x22ec88,null));};exports[_0x79d2('0x47')]=function(_0x265031,_0x3d80ae){return db[_0x79d2('0x2a')][_0x79d2('0x45')]({'where':{'id':_0x265031[_0x79d2('0x40')]['id']}})['then'](handleEntityNotFound(_0x3d80ae,null))[_0x79d2('0x11')](removeEntity(_0x3d80ae,null))[_0x79d2('0x1c')](handleError(_0x3d80ae,null));};exports[_0x79d2('0x48')]=function(_0x4ccdd1,_0x1a8e20){return db[_0x79d2('0x2a')][_0x79d2('0x48')]()['then'](respondWithResult(_0x1a8e20,null))[_0x79d2('0x1c')](handleError(_0x1a8e20,null));};exports[_0x79d2('0x49')]=function(_0x1152d3,_0x10186){return db[_0x79d2('0x2a')][_0x79d2('0x49')](_0x1152d3[_0x79d2('0x46')])[_0x79d2('0x11')](function(_0xdaf4e6){if(_0xdaf4e6){if(_0xdaf4e6[_0x79d2('0x4a')]==='out'&&!_0xdaf4e6[_0x79d2('0x4b')]){var _0x3881ee,_0x5ac246,_0x473745;if(_0x1152d3[_0x79d2('0x46')]['to']){_0x5ac246=_0x1152d3[_0x79d2('0x46')]['to'][_0x79d2('0x4c')](',')[0x0];}return db[_0x79d2('0x4d')][_0x79d2('0x4e')]({'where':{'id':_0xdaf4e6[_0x79d2('0x4f')]},'include':[{'model':db['CmList'],'as':_0x79d2('0x50'),'include':[{'model':db[_0x79d2('0x51')],'as':_0x79d2('0x52'),'where':{'email':_0x5ac246},'limit':0x1,'order':[[_0x79d2('0x53'),_0x79d2('0x54')]]}]},{'model':db[_0x79d2('0x55')],'as':_0x79d2('0x56'),'raw':!![],'include':[{'model':db[_0x79d2('0x57')],'as':_0x79d2('0x57'),'raw':!![]}]}]})['then'](function(_0x47145a){_0x3881ee=_0x47145a;if(!_0x3881ee||!_0x3881ee[_0x79d2('0x56')])return;var _0x38ffe9=_0x3881ee[_0x79d2('0x58')]();if(_0x1152d3['body'][_0x79d2('0x59')]&&_0x1152d3['body']['attachments'][_0x79d2('0x34')]){for(var _0x385553=0x0;_0x385553<_0x1152d3['body'][_0x79d2('0x59')][_0x79d2('0x34')];_0x385553+=0x1){_0x1152d3['body'][_0x79d2('0x59')][_0x385553]={'filename':_0x1152d3['body']['attachments'][_0x385553][_0x79d2('0x26')],'path':path[_0x79d2('0x5a')](config[_0x79d2('0x5b')],_0x79d2('0x5c'),_0x1152d3[_0x79d2('0x46')][_0x79d2('0x59')][_0x385553][_0x79d2('0x5d')])};}}_0x473745={'account':_0x38ffe9,'message':_0x1152d3['body']};return;})[_0x79d2('0x11')](function(){if(_0x3881ee[_0x79d2('0x50')]){if(_0x3881ee[_0x79d2('0x50')][_0x79d2('0x52')][_0x79d2('0x34')]){return _0x3881ee[_0x79d2('0x50')][_0x79d2('0x52')][0x0];}else{return db['CmContact']['create'](_[_0x79d2('0x8')](_0x1152d3['body'],{'firstName':_0x1152d3[_0x79d2('0x46')]['to'],'email':_0x1152d3[_0x79d2('0x46')]['to'],'phone':_0x1152d3[_0x79d2('0x46')]['to'],'ListId':_0x3881ee[_0x79d2('0x5e')]}));}}else{throw new Error(_0x79d2('0x5f'));}})['then'](function(){if(_0x473745){return respondWithRpcPromise('SendMail',_0x79d2('0x60'),_0x473745,client9003)[_0x79d2('0x11')](function(_0x362a9f){return _0xdaf4e6['update']({'read':!![],'messageId':_0x362a9f[_0x79d2('0x61')],'sentAt':moment()[_0x79d2('0x62')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x79d2('0x1c')](function(_0x19c764){logger[_0x79d2('0x17')]('%s',JSON[_0x79d2('0x16')](_0x19c764));return _0xdaf4e6;});}return _0xdaf4e6;});}return _0xdaf4e6;}})[_0x79d2('0x11')](respondWithResult(_0x10186,0xc9))[_0x79d2('0x1c')](handleError(_0x10186,null));};exports[_0x79d2('0x63')]=function(_0x1272a8,_0x53c92e){var _0x3ff86d=_0x79d2('0x64');return interactionService[_0x79d2('0x65')](_0x1272a8,_0x3ff86d)[_0x79d2('0x11')](respondWithResult(_0x53c92e,null))[_0x79d2('0x1c')](handleError(_0x53c92e,null));};exports[_0x79d2('0x66')]=function(_0x3bedbe,_0x12489b){var _0x277e59={'agent':{},'channel':_0x79d2('0x64')};if(_0x3bedbe[_0x79d2('0x46')]['id']){delete _0x3bedbe[_0x79d2('0x46')]['id'];}_0x3bedbe[_0x79d2('0x46')][_0x79d2('0x67')]=_0x3bedbe['body']['UserId']||_0x3bedbe['user']['id'];_0x277e59[_0x79d2('0x68')]['id']=_0x3bedbe['body'][_0x79d2('0x67')];return db[_0x79d2('0x2a')][_0x79d2('0x45')]({'where':{'id':_0x3bedbe['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12489b,null))[_0x79d2('0x11')](function(_0x42e313){if(_0x42e313){_0x277e59[_0x79d2('0x1a')]=_0x42e313[_0x79d2('0x69')]({'plain':!![]});return db['MailInteraction'][_0x79d2('0x45')]({'where':{'id':_0x42e313[_0x79d2('0x6a')]}});}return null;})[_0x79d2('0x11')](handleEntityNotFound(_0x12489b,null))['then'](function(_0x30ee7e){if(_0x30ee7e){_0x277e59[_0x79d2('0x6b')]=_0x30ee7e[_0x79d2('0x69')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3bedbe[_0x79d2('0x6c')]['id'],_0x3bedbe['user']['name'],_0x3bedbe['user']['role'],_0x277e59[_0x79d2('0x6b')]['id'],_0x3bedbe[_0x79d2('0x46')]?JSON[_0x79d2('0x16')](_0x3bedbe[_0x79d2('0x46')]):_0x79d2('0x6d'));return respondWithRpcPromise(_0x79d2('0x6e'),_0x79d2('0x6f'),_0x277e59);}return null;})[_0x79d2('0x11')](function(_0x25ea5d){var _0x38c95e=_0x79d2('0x70')+_0x25ea5d[_0x79d2('0x1a')][_0x79d2('0x71')];return db[_0x79d2('0x72')][_0x79d2('0x2f')](_0x38c95e,{'type':db[_0x79d2('0x73')][_0x79d2('0x74')][_0x79d2('0x75')],'raw':!![]})[_0x79d2('0x11')](function(_0x72f53c){return _0x72f53c;});})[_0x79d2('0x11')](function(_0x3ba39a){if(_0x3ba39a){_0x277e59['message']['contact']=_0x3ba39a[0x0];if(!_0x3bedbe[_0x79d2('0x46')][_0x79d2('0x67')])return;return db[_0x79d2('0x76')][_0x79d2('0x45')]({'where':{'id':_0x3bedbe[_0x79d2('0x46')][_0x79d2('0x67')],'role':_0x79d2('0x68')},'attributes':['id',_0x79d2('0x26'),'fullname',_0x79d2('0x77'),_0x79d2('0x78')],'raw':!![]});}return null;})[_0x79d2('0x11')](function(_0x567046){if(!_0x567046)return null;_0x277e59['message'][_0x79d2('0x68')]=_0x567046;return _0x277e59;})[_0x79d2('0x11')](function(_0x22e5b4){if(_0x22e5b4){_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x79')]=util[_0x79d2('0x62')](_0x79d2('0x7a'),_0x3bedbe[_0x79d2('0x6c')][_0x79d2('0x26')]);_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x7b')]=_0x277e59['channel'];_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x7c')]=_0x277e59[_0x79d2('0x7b')];_0x22e5b4['message'][_0x79d2('0x7d')]=_0x79d2('0x66');_0x22e5b4[_0x79d2('0x1a')][_0x79d2('0x46')]=htmlToText['fromString'](_0x277e59[_0x79d2('0x1a')][_0x79d2('0x46')]);respondWithRpcPromise(_0x79d2('0x7e'),_0x79d2('0x7e'),{'event':_0x79d2('0x7f'),'message':_0x22e5b4[_0x79d2('0x1a')]},client9002);return _0x277e59;}return null;})[_0x79d2('0x11')](respondWithResult(_0x12489b,null))[_0x79d2('0x1c')](handleError(_0x12489b,null));};exports[_0x79d2('0x80')]=function(_0x24f31c,_0x4ae241){var _0x2b54ce=moment()[_0x79d2('0x81')]()[_0x79d2('0x82')]();var _0x5bb067=path[_0x79d2('0x5a')](config[_0x79d2('0x5b')],_0x79d2('0x83'),_0x79d2('0x84'),_0x79d2('0x85'));var _0x41f84d=path['join'](config['root'],_0x79d2('0x83'),_0x79d2('0x84'),_0x79d2('0x59'));var _0x47a6e5=util['format'](_0x79d2('0x86'),_0x2b54ce);return db[_0x79d2('0x2a')]['find']({'where':{'id':_0x24f31c[_0x79d2('0x40')]['id']},'attributes':['id',_0x79d2('0x46'),'from','to','cc',_0x79d2('0x87'),_0x79d2('0x88'),_0x79d2('0x89')],'include':_0x24f31c[_0x79d2('0x2f')][_0x79d2('0x59')]?[{'model':db[_0x79d2('0x8a')],'as':_0x79d2('0x8b')}]:undefined})[_0x79d2('0x11')](handleEntityNotFound(_0x4ae241,null))[_0x79d2('0x11')](function(_0x131dd4){if(_0x131dd4){var _0x240808=_0x131dd4;var _0x4e6b2a={'from':_0x240808['from'],'to':_0x240808['to'],'subject':_0x240808[_0x79d2('0x88')],'html':htmlEntities[_0x79d2('0x8c')](_0x240808[_0x79d2('0x46')]),'headers':{'Date':moment(_0x240808[_0x79d2('0x89')])[_0x79d2('0x62')](_0x79d2('0x8d'))},'attachments':[]};if(_0x131dd4['cc']){_0x4e6b2a[_0x79d2('0x8e')]['Cc']=_0x131dd4['cc'];}if(_0x131dd4['bcc']){_0x4e6b2a['headers']['Bcc']=_0x131dd4['bcc'];}return new Promise(function(_0x33967b,_0x3a5199){if(_0x131dd4['Attachments']){for(var _0x91363e=0x0;_0x91363e<_0x131dd4['Attachments'][_0x79d2('0x34')];_0x91363e++){var _0x42e482=_0x131dd4[_0x79d2('0x8b')][_0x91363e];var _0x418295=path[_0x79d2('0x5a')](_0x41f84d,_0x42e482[_0x79d2('0x5d')]);if(fs[_0x79d2('0x8f')](_0x418295)){_0x4e6b2a[_0x79d2('0x59')]['push']({'name':_0x42e482['name'],'contentType':_0x42e482[_0x79d2('0x2c')],'data':fs['readFileSync'](_0x418295)});}}}emlformat[_0x79d2('0x90')](_0x4e6b2a,function(_0x46cc0a,_0x971fb9){if(_0x46cc0a)return _0x3a5199(_0x46cc0a);fs['writeFileSync'](path[_0x79d2('0x5a')](_0x5bb067,_0x47a6e5),_0x971fb9);return _0x33967b(_0x971fb9);});});}})[_0x79d2('0x11')](function(_0x234b45){if(_0x234b45){return _0x4ae241[_0x79d2('0x80')](path['join'](_0x5bb067,_0x47a6e5),_0x47a6e5,function(_0x14f4e1){if(!_0x14f4e1)fs[_0x79d2('0x91')](path[_0x79d2('0x5a')](_0x5bb067,_0x47a6e5));});}})['catch'](handleError(_0x4ae241,null));}; \ No newline at end of file +var _0xab26=['secret','split','MailAccount','findOne','MailAccountId','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','CloudProvider','getSmtpOptions','attachments','root','server/files/attachments','ListId','List\x20not\x20found','SendMail','messageId','YYYY-MM-DD\x20HH:mm:ss','stringify','accept','mail','acceptMessage','reject','UserId','agent','get','MailInteractionId','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','internal','interface','SIP/%s','motionChannel','channel','fromString','EventManager','unix','toString','tmp','join','files','format','message-%s.eml','from','bcc','subject','Attachment','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','push','readFileSync','build','writeFileSync','download','unlinkSync','eml-format','moment','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','MailMessage,\x20%s,\x20%s','status','json','offset','undefined','count','limit','set','Content-Range','then','destroy','end','sendStatus','stack','name','map','MailMessage','type','key','model','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','body','describe','create','direction','out'];(function(_0x6b2c5c,_0x3f6949){var _0x18e3ce=function(_0x1a143f){while(--_0x1a143f){_0x6b2c5c['push'](_0x6b2c5c['shift']());}};_0x18e3ce(++_0x3f6949);}(_0xab26,0xe4));var _0x6ab2=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xab26[_0x122ef9];return _0x42fba0;};'use strict';var emlformat=require(_0x6ab2('0x0'));var moment=require(_0x6ab2('0x1'));var util=require(_0x6ab2('0x2'));var path=require('path');var fs=require('fs');var _=require(_0x6ab2('0x3'));var Redis=require(_0x6ab2('0x4'));var htmlToText=require('html-to-text');var interactionService=require(_0x6ab2('0x5'));var qs=require(_0x6ab2('0x6'));var logger=require(_0x6ab2('0x7'))(_0x6ab2('0x8'));var interaction_log=require(_0x6ab2('0x7'))(_0x6ab2('0x9'));var config=require(_0x6ab2('0xa'));var db=require(_0x6ab2('0xb'))['db'];config[_0x6ab2('0xc')]=_[_0x6ab2('0xd')](config[_0x6ab2('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x6ab2('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x6ab2('0xf'));require(_0x6ab2('0x10'))[_0x6ab2('0x11')](socket);var jayson=require(_0x6ab2('0x12'));var client=jayson[_0x6ab2('0x13')][_0x6ab2('0x14')]({'port':0x232c});var client9003=jayson[_0x6ab2('0x13')][_0x6ab2('0x14')]({'port':0x232b});var client9002=jayson[_0x6ab2('0x13')][_0x6ab2('0x14')]({'port':0x232a});function respondWithRpcPromise(_0x140cb4,_0x133c1c,_0x693aed,_0x51f386){return new Promise(function(_0xd61890,_0x3cf1c7){var _0x32740d=_0x51f386||client;return _0x32740d[_0x6ab2('0x15')](_0x140cb4,_0x693aed)['then'](function(_0x41ef37){logger[_0x6ab2('0x16')]('MailMessage,\x20%s,\x20%s',_0x133c1c,_0x6ab2('0x17'));logger[_0x6ab2('0x18')](_0x6ab2('0x19'),_0x133c1c,_0x6ab2('0x17'),JSON['stringify'](_0x41ef37));if(_0x41ef37['error']){if(_0x41ef37[_0x6ab2('0x1a')][_0x6ab2('0x1b')]===0x1f4){logger[_0x6ab2('0x1a')]('MailMessage,\x20%s,\x20%s',_0x133c1c,_0x41ef37[_0x6ab2('0x1a')]['message']);return _0x3cf1c7(_0x41ef37[_0x6ab2('0x1a')][_0x6ab2('0x1c')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x133c1c,_0x41ef37['error'][_0x6ab2('0x1c')]);return _0xd61890(_0x41ef37[_0x6ab2('0x1a')][_0x6ab2('0x1c')]);}else{logger[_0x6ab2('0x16')](_0x6ab2('0x1d'),_0x133c1c,'request\x20sent');_0xd61890(_0x41ef37['result'][_0x6ab2('0x1c')]);}})['catch'](function(_0x9ed256){logger[_0x6ab2('0x1a')](_0x6ab2('0x1d'),_0x133c1c,_0x9ed256);_0x3cf1c7(_0x9ed256);});});}function respondWithResult(_0x32b0b5,_0x52afe3){_0x52afe3=_0x52afe3||0xc8;return function(_0x239eeb){if(_0x239eeb){return _0x32b0b5[_0x6ab2('0x1e')](_0x52afe3)[_0x6ab2('0x1f')](_0x239eeb);}};}function respondWithFilteredResult(_0x5775c0,_0x46dd25){return function(_0x78b647){if(_0x78b647){var _0x31c867=typeof _0x46dd25[_0x6ab2('0x20')]===_0x6ab2('0x21')&&typeof _0x46dd25['limit']===_0x6ab2('0x21');var _0x538f01=_0x78b647['count'];var _0x17c045=_0x31c867?0x0:_0x46dd25[_0x6ab2('0x20')];var _0x33a09b=_0x31c867?_0x78b647[_0x6ab2('0x22')]:_0x46dd25['offset']+_0x46dd25[_0x6ab2('0x23')];var _0x4c6c2a;if(_0x33a09b>=_0x538f01){_0x33a09b=_0x538f01;_0x4c6c2a=0xc8;}else{_0x4c6c2a=0xce;}_0x5775c0['status'](_0x4c6c2a);return _0x5775c0[_0x6ab2('0x24')](_0x6ab2('0x25'),_0x17c045+'-'+_0x33a09b+'/'+_0x538f01)[_0x6ab2('0x1f')](_0x78b647);}return null;};}function saveUpdates(_0x135bfb){return function(_0xf54109){if(_0xf54109){return _0xf54109['update'](_0x135bfb)[_0x6ab2('0x26')](function(_0x285c76){return _0x285c76;});}return null;};}function removeEntity(_0x28fac9){return function(_0x52209d){if(_0x52209d){return _0x52209d[_0x6ab2('0x27')]()[_0x6ab2('0x26')](function(){_0x28fac9[_0x6ab2('0x1e')](0xcc)[_0x6ab2('0x28')]();});}};}function handleEntityNotFound(_0x39ffe0){return function(_0x27bdf2){if(!_0x27bdf2){_0x39ffe0[_0x6ab2('0x29')](0x194);}return _0x27bdf2;};}function handleError(_0x128f9a,_0x2ebe16){_0x2ebe16=_0x2ebe16||0x1f4;return function(_0x29e10a){logger['error'](_0x29e10a[_0x6ab2('0x2a')]);if(_0x29e10a['name']){delete _0x29e10a[_0x6ab2('0x2b')];}_0x128f9a[_0x6ab2('0x1e')](_0x2ebe16)['send'](_0x29e10a);};}exports['index']=function(_0x286e72,_0x4dcee7){var _0x9cedb5={},_0x171df5={},_0x5f3522={'count':0x0,'rows':[]};var _0x2c7881=_[_0x6ab2('0x2c')](db[_0x6ab2('0x2d')]['rawAttributes'],function(_0x3c2e41){return{'name':_0x3c2e41['fieldName'],'type':_0x3c2e41[_0x6ab2('0x2e')][_0x6ab2('0x2f')]};});_0x171df5[_0x6ab2('0x30')]=_[_0x6ab2('0x2c')](_0x2c7881,_0x6ab2('0x2b'));_0x171df5[_0x6ab2('0x31')]=_[_0x6ab2('0x32')](_0x286e72['query']);_0x171df5['filters']=_[_0x6ab2('0x33')](_0x171df5[_0x6ab2('0x30')],_0x171df5[_0x6ab2('0x31')]);_0x9cedb5['attributes']=_['intersection'](_0x171df5[_0x6ab2('0x30')],qs[_0x6ab2('0x34')](_0x286e72[_0x6ab2('0x31')]['fields']));_0x9cedb5[_0x6ab2('0x35')]=_0x9cedb5[_0x6ab2('0x35')][_0x6ab2('0x36')]?_0x9cedb5[_0x6ab2('0x35')]:_0x171df5['model'];if(!_0x286e72[_0x6ab2('0x31')]['hasOwnProperty']('nolimit')){_0x9cedb5[_0x6ab2('0x23')]=qs['limit'](_0x286e72['query'][_0x6ab2('0x23')]);_0x9cedb5[_0x6ab2('0x20')]=qs[_0x6ab2('0x20')](_0x286e72[_0x6ab2('0x31')][_0x6ab2('0x20')]);}_0x9cedb5[_0x6ab2('0x37')]=qs[_0x6ab2('0x38')](_0x286e72[_0x6ab2('0x31')][_0x6ab2('0x38')]);_0x9cedb5[_0x6ab2('0x39')]=qs[_0x6ab2('0x3a')](_[_0x6ab2('0x3b')](_0x286e72[_0x6ab2('0x31')],_0x171df5[_0x6ab2('0x3a')]),_0x2c7881);if(_0x286e72[_0x6ab2('0x31')][_0x6ab2('0x3c')]){_0x9cedb5[_0x6ab2('0x39')]=_[_0x6ab2('0x3d')](_0x9cedb5['where'],{'$or':_[_0x6ab2('0x2c')](_0x2c7881,function(_0x248355){if(_0x248355[_0x6ab2('0x2e')]!==_0x6ab2('0x3e')){var _0x4b055c={};_0x4b055c[_0x248355[_0x6ab2('0x2b')]]={'$like':'%'+_0x286e72[_0x6ab2('0x31')]['filter']+'%'};return _0x4b055c;}})});}_0x9cedb5=_[_0x6ab2('0x3d')]({},_0x9cedb5,_0x286e72[_0x6ab2('0x3f')]);var _0x28f77a={'where':_0x9cedb5[_0x6ab2('0x39')]};return db[_0x6ab2('0x2d')][_0x6ab2('0x22')](_0x28f77a)[_0x6ab2('0x26')](function(_0x4d87fc){_0x5f3522['count']=_0x4d87fc;if(_0x286e72[_0x6ab2('0x31')]['includeAll']){_0x9cedb5[_0x6ab2('0x40')]=[{'all':!![]}];}return db[_0x6ab2('0x2d')][_0x6ab2('0x41')](_0x9cedb5);})[_0x6ab2('0x26')](function(_0xbdcff2){_0x5f3522[_0x6ab2('0x42')]=_0xbdcff2;return _0x5f3522;})[_0x6ab2('0x26')](respondWithFilteredResult(_0x4dcee7,_0x9cedb5))[_0x6ab2('0x43')](handleError(_0x4dcee7,null));};exports[_0x6ab2('0x44')]=function(_0x518253,_0xcc05e9){var _0x5d5ec6={'raw':!![],'where':{'id':_0x518253[_0x6ab2('0x45')]['id']}},_0x131259={};_0x131259[_0x6ab2('0x30')]=_[_0x6ab2('0x32')](db['MailMessage'][_0x6ab2('0x46')]);_0x131259[_0x6ab2('0x31')]=_[_0x6ab2('0x32')](_0x518253[_0x6ab2('0x31')]);_0x131259[_0x6ab2('0x3a')]=_[_0x6ab2('0x33')](_0x131259[_0x6ab2('0x30')],_0x131259[_0x6ab2('0x31')]);_0x5d5ec6[_0x6ab2('0x35')]=_['intersection'](_0x131259['model'],qs[_0x6ab2('0x34')](_0x518253[_0x6ab2('0x31')][_0x6ab2('0x34')]));_0x5d5ec6[_0x6ab2('0x35')]=_0x5d5ec6[_0x6ab2('0x35')][_0x6ab2('0x36')]?_0x5d5ec6['attributes']:_0x131259[_0x6ab2('0x30')];if(_0x518253[_0x6ab2('0x31')][_0x6ab2('0x47')]){_0x5d5ec6[_0x6ab2('0x40')]=[{'all':!![]}];}_0x5d5ec6=_[_0x6ab2('0x3d')]({},_0x5d5ec6,_0x518253['options']);return db['MailMessage'][_0x6ab2('0x48')](_0x5d5ec6)['then'](handleEntityNotFound(_0xcc05e9,null))[_0x6ab2('0x26')](respondWithResult(_0xcc05e9,null))[_0x6ab2('0x43')](handleError(_0xcc05e9,null));};exports['update']=function(_0x5e663a,_0x565562){if(_0x5e663a[_0x6ab2('0x49')]['id']){delete _0x5e663a[_0x6ab2('0x49')]['id'];}return db[_0x6ab2('0x2d')][_0x6ab2('0x48')]({'where':{'id':_0x5e663a['params']['id']}})[_0x6ab2('0x26')](handleEntityNotFound(_0x565562,null))[_0x6ab2('0x26')](saveUpdates(_0x5e663a['body'],null))[_0x6ab2('0x26')](respondWithResult(_0x565562,null))[_0x6ab2('0x43')](handleError(_0x565562,null));};exports['destroy']=function(_0x3408d8,_0x3fd966){return db[_0x6ab2('0x2d')]['find']({'where':{'id':_0x3408d8[_0x6ab2('0x45')]['id']}})[_0x6ab2('0x26')](handleEntityNotFound(_0x3fd966,null))[_0x6ab2('0x26')](removeEntity(_0x3fd966,null))['catch'](handleError(_0x3fd966,null));};exports[_0x6ab2('0x4a')]=function(_0x369978,_0x4e826b){return db[_0x6ab2('0x2d')][_0x6ab2('0x4a')]()[_0x6ab2('0x26')](respondWithResult(_0x4e826b,null))['catch'](handleError(_0x4e826b,null));};exports[_0x6ab2('0x4b')]=function(_0x3aa429,_0x2f9b4d){return db[_0x6ab2('0x2d')][_0x6ab2('0x4b')](_0x3aa429[_0x6ab2('0x49')])[_0x6ab2('0x26')](function(_0x45f608){if(_0x45f608){if(_0x45f608[_0x6ab2('0x4c')]===_0x6ab2('0x4d')&&!_0x45f608[_0x6ab2('0x4e')]){var _0x3a853c,_0x22cc81,_0x562960;if(_0x3aa429[_0x6ab2('0x49')]['to']){_0x22cc81=_0x3aa429[_0x6ab2('0x49')]['to'][_0x6ab2('0x4f')](',')[0x0];}return db[_0x6ab2('0x50')][_0x6ab2('0x51')]({'where':{'id':_0x45f608[_0x6ab2('0x52')]},'include':[{'model':db['CmList'],'as':_0x6ab2('0x53'),'include':[{'model':db[_0x6ab2('0x54')],'as':_0x6ab2('0x55'),'where':{'email':_0x22cc81},'limit':0x1,'order':[[_0x6ab2('0x56'),_0x6ab2('0x57')]]}]},{'model':db[_0x6ab2('0x58')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x6ab2('0x59'),'raw':!![]}]}]})[_0x6ab2('0x26')](function(_0x1e65d3){_0x3a853c=_0x1e65d3;if(!_0x3a853c||!_0x3a853c['Smtp'])return;var _0x1cd753=_0x3a853c[_0x6ab2('0x5a')]();if(_0x3aa429[_0x6ab2('0x49')]['attachments']&&_0x3aa429['body'][_0x6ab2('0x5b')]['length']){for(var _0x3a2b4f=0x0;_0x3a2b4f<_0x3aa429[_0x6ab2('0x49')]['attachments'][_0x6ab2('0x36')];_0x3a2b4f+=0x1){_0x3aa429[_0x6ab2('0x49')][_0x6ab2('0x5b')][_0x3a2b4f]={'filename':_0x3aa429[_0x6ab2('0x49')][_0x6ab2('0x5b')][_0x3a2b4f][_0x6ab2('0x2b')],'path':path['join'](config[_0x6ab2('0x5c')],_0x6ab2('0x5d'),_0x3aa429[_0x6ab2('0x49')][_0x6ab2('0x5b')][_0x3a2b4f]['basename'])};}}_0x562960={'account':_0x1cd753,'message':_0x3aa429[_0x6ab2('0x49')]};return;})[_0x6ab2('0x26')](function(){if(_0x3a853c['List']){if(_0x3a853c[_0x6ab2('0x53')][_0x6ab2('0x55')][_0x6ab2('0x36')]){return _0x3a853c['List']['Contacts'][0x0];}else{return db[_0x6ab2('0x54')][_0x6ab2('0x4b')](_['defaults'](_0x3aa429['body'],{'firstName':_0x3aa429[_0x6ab2('0x49')]['to'],'email':_0x3aa429['body']['to'],'phone':_0x3aa429[_0x6ab2('0x49')]['to'],'ListId':_0x3a853c[_0x6ab2('0x5e')]}));}}else{throw new Error(_0x6ab2('0x5f'));}})[_0x6ab2('0x26')](function(){if(_0x562960){return respondWithRpcPromise(_0x6ab2('0x60'),'sendMail',_0x562960,client9003)['then'](function(_0x5137ab){return _0x45f608['update']({'read':!![],'messageId':_0x5137ab[_0x6ab2('0x61')],'sentAt':moment()['format'](_0x6ab2('0x62'))});})['catch'](function(_0x47dbfd){logger['error']('%s',JSON[_0x6ab2('0x63')](_0x47dbfd));return _0x45f608;});}return _0x45f608;});}return _0x45f608;}})[_0x6ab2('0x26')](respondWithResult(_0x2f9b4d,0xc9))[_0x6ab2('0x43')](handleError(_0x2f9b4d,null));};exports[_0x6ab2('0x64')]=function(_0x5748ff,_0x5ade6a){var _0x33ced1=_0x6ab2('0x65');return interactionService[_0x6ab2('0x66')](_0x5748ff,_0x33ced1)[_0x6ab2('0x26')](respondWithResult(_0x5ade6a,null))[_0x6ab2('0x43')](handleError(_0x5ade6a,null));};exports[_0x6ab2('0x67')]=function(_0xc0bd43,_0x2d5e27){var _0xd6ee18={'agent':{},'channel':'mail'};if(_0xc0bd43['body']['id']){delete _0xc0bd43['body']['id'];}_0xc0bd43[_0x6ab2('0x49')][_0x6ab2('0x68')]=_0xc0bd43[_0x6ab2('0x49')][_0x6ab2('0x68')]||_0xc0bd43['user']['id'];_0xd6ee18[_0x6ab2('0x69')]['id']=_0xc0bd43[_0x6ab2('0x49')][_0x6ab2('0x68')];return db[_0x6ab2('0x2d')][_0x6ab2('0x48')]({'where':{'id':_0xc0bd43[_0x6ab2('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d5e27,null))[_0x6ab2('0x26')](function(_0x3df78a){if(_0x3df78a){_0xd6ee18[_0x6ab2('0x1c')]=_0x3df78a[_0x6ab2('0x6a')]({'plain':!![]});return db['MailInteraction'][_0x6ab2('0x48')]({'where':{'id':_0x3df78a[_0x6ab2('0x6b')]}});}return null;})[_0x6ab2('0x26')](handleEntityNotFound(_0x2d5e27,null))[_0x6ab2('0x26')](function(_0x484dcf){if(_0x484dcf){_0xd6ee18[_0x6ab2('0x6c')]=_0x484dcf['get']({'plain':!![]});interaction_log[_0x6ab2('0x16')](_0x6ab2('0x6d'),_0xc0bd43[_0x6ab2('0x6e')]['id'],_0xc0bd43[_0x6ab2('0x6e')][_0x6ab2('0x2b')],_0xc0bd43[_0x6ab2('0x6e')][_0x6ab2('0x6f')],_0xd6ee18[_0x6ab2('0x6c')]['id'],_0xc0bd43[_0x6ab2('0x49')]?JSON[_0x6ab2('0x63')](_0xc0bd43[_0x6ab2('0x49')]):_0x6ab2('0x70'));return respondWithRpcPromise(_0x6ab2('0x71'),_0x6ab2('0x72'),_0xd6ee18);}return null;})['then'](function(_0x126b0b){var _0x2e151e=_0x6ab2('0x73')+_0x126b0b[_0x6ab2('0x1c')][_0x6ab2('0x74')];return db[_0x6ab2('0x75')][_0x6ab2('0x31')](_0x2e151e,{'type':db[_0x6ab2('0x76')][_0x6ab2('0x77')][_0x6ab2('0x78')],'raw':!![]})[_0x6ab2('0x26')](function(_0x4ca1e1){return _0x4ca1e1;});})[_0x6ab2('0x26')](function(_0x557e5b){if(_0x557e5b){_0xd6ee18['message'][_0x6ab2('0x79')]=_0x557e5b[0x0];if(!_0xc0bd43['body'][_0x6ab2('0x68')])return;return db['User']['find']({'where':{'id':_0xc0bd43[_0x6ab2('0x49')]['UserId'],'role':_0x6ab2('0x69')},'attributes':['id',_0x6ab2('0x2b'),_0x6ab2('0x7a'),'email',_0x6ab2('0x7b')],'raw':!![]});}return null;})[_0x6ab2('0x26')](function(_0x130322){if(!_0x130322)return null;_0xd6ee18['message'][_0x6ab2('0x69')]=_0x130322;return _0xd6ee18;})[_0x6ab2('0x26')](function(_0x12308d){if(_0x12308d){_0x12308d[_0x6ab2('0x1c')][_0x6ab2('0x7c')]=util['format'](_0x6ab2('0x7d'),_0xc0bd43[_0x6ab2('0x6e')][_0x6ab2('0x2b')]);_0x12308d[_0x6ab2('0x1c')]['channel']=_0xd6ee18['channel'];_0x12308d[_0x6ab2('0x1c')][_0x6ab2('0x7e')]=_0xd6ee18[_0x6ab2('0x7f')];_0x12308d[_0x6ab2('0x1c')]['event']=_0x6ab2('0x67');_0x12308d['message'][_0x6ab2('0x49')]=htmlToText[_0x6ab2('0x80')](_0xd6ee18[_0x6ab2('0x1c')][_0x6ab2('0x49')]);respondWithRpcPromise(_0x6ab2('0x81'),_0x6ab2('0x81'),{'event':'rejectmessage','message':_0x12308d[_0x6ab2('0x1c')]},client9002);return _0xd6ee18;}return null;})['then'](respondWithResult(_0x2d5e27,null))['catch'](handleError(_0x2d5e27,null));};exports['download']=function(_0x1000c9,_0x38207f){var _0x4a1bf8=moment()[_0x6ab2('0x82')]()[_0x6ab2('0x83')]();var _0x34df09=path['join'](config[_0x6ab2('0x5c')],'server','files',_0x6ab2('0x84'));var _0x43b220=path[_0x6ab2('0x85')](config[_0x6ab2('0x5c')],'server',_0x6ab2('0x86'),_0x6ab2('0x5b'));var _0x446a19=util[_0x6ab2('0x87')](_0x6ab2('0x88'),_0x4a1bf8);return db[_0x6ab2('0x2d')]['find']({'where':{'id':_0x1000c9[_0x6ab2('0x45')]['id']},'attributes':['id',_0x6ab2('0x49'),_0x6ab2('0x89'),'to','cc',_0x6ab2('0x8a'),_0x6ab2('0x8b'),'createdAt'],'include':_0x1000c9['query'][_0x6ab2('0x5b')]?[{'model':db[_0x6ab2('0x8c')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x38207f,null))[_0x6ab2('0x26')](function(_0x18768a){if(_0x18768a){var _0x25f9ae=_0x18768a;var _0xe5c567={'from':_0x25f9ae['from'],'to':_0x25f9ae['to'],'subject':_0x25f9ae[_0x6ab2('0x8b')],'html':htmlEntities[_0x6ab2('0x8d')](_0x25f9ae[_0x6ab2('0x49')]),'headers':{'Date':moment(_0x25f9ae['createdAt'])[_0x6ab2('0x87')](_0x6ab2('0x8e'))},'attachments':[]};if(_0x18768a['cc']){_0xe5c567[_0x6ab2('0x8f')]['Cc']=_0x18768a['cc'];}if(_0x18768a['bcc']){_0xe5c567['headers'][_0x6ab2('0x90')]=_0x18768a[_0x6ab2('0x8a')];}return new Promise(function(_0x2fa59e,_0x212fe2){if(_0x18768a['Attachments']){for(var _0x37f3d1=0x0;_0x37f3d1<_0x18768a[_0x6ab2('0x91')][_0x6ab2('0x36')];_0x37f3d1++){var _0xa3ef5=_0x18768a[_0x6ab2('0x91')][_0x37f3d1];var _0x5f5a09=path[_0x6ab2('0x85')](_0x43b220,_0xa3ef5[_0x6ab2('0x92')]);if(fs['existsSync'](_0x5f5a09)){_0xe5c567[_0x6ab2('0x5b')][_0x6ab2('0x93')]({'name':_0xa3ef5['name'],'contentType':_0xa3ef5[_0x6ab2('0x2e')],'data':fs[_0x6ab2('0x94')](_0x5f5a09)});}}}emlformat[_0x6ab2('0x95')](_0xe5c567,function(_0x4d6289,_0x2da3a9){if(_0x4d6289)return _0x212fe2(_0x4d6289);fs[_0x6ab2('0x96')](path[_0x6ab2('0x85')](_0x34df09,_0x446a19),_0x2da3a9);return _0x2fa59e(_0x2da3a9);});});}})[_0x6ab2('0x26')](function(_0x27414e){if(_0x27414e){return _0x38207f[_0x6ab2('0x97')](path[_0x6ab2('0x85')](_0x34df09,_0x446a19),_0x446a19,function(_0xffa4e4){if(!_0xffa4e4)fs[_0x6ab2('0x98')](path[_0x6ab2('0x85')](_0x34df09,_0x446a19));});}})[_0x6ab2('0x43')](handleError(_0x38207f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index a79c6e9..880f061 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 _0x971b=['MailMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x15beeb,_0x32bd4f){var _0x5b681a=function(_0x2f9b5c){while(--_0x2f9b5c){_0x15beeb['push'](_0x15beeb['shift']());}};_0x5b681a(++_0x32bd4f);}(_0x971b,0x1ae));var _0xb971=function(_0x34232c,_0x18e61d){_0x34232c=_0x34232c-0x0;var _0x4d4f4e=_0x971b[_0x34232c];return _0x4d4f4e;};'use strict';var EventEmitter=require(_0xb971('0x0'));var MailMessage=require(_0xb971('0x1'))['db'][_0xb971('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xb971('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb971('0x4'),'afterDestroy':_0xb971('0x5')};function emitEvent(_0x2e2237){return function(_0x284f4f,_0x17a342,_0x1cfddc){MailMessageEvents[_0xb971('0x6')](_0x2e2237+':'+_0x284f4f['id'],_0x284f4f);MailMessageEvents[_0xb971('0x6')](_0x2e2237,_0x284f4f);_0x1cfddc(null);};}for(var e in events){if(events[_0xb971('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xb971('0x8')]=MailMessageEvents; \ No newline at end of file +var _0xbaa1=['hasOwnProperty','hook','exports','events','MailMessage','setMaxListeners','save','update','remove','emit'];(function(_0x26a8ea,_0x3e92ec){var _0x124afa=function(_0x47306a){while(--_0x47306a){_0x26a8ea['push'](_0x26a8ea['shift']());}};_0x124afa(++_0x3e92ec);}(_0xbaa1,0x85));var _0x1baa=function(_0x5b47a8,_0x63735d){_0x5b47a8=_0x5b47a8-0x0;var _0x567ebf=_0xbaa1[_0x5b47a8];return _0x567ebf;};'use strict';var EventEmitter=require(_0x1baa('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x1baa('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x1baa('0x2')](0x0);var events={'afterCreate':_0x1baa('0x3'),'afterUpdate':_0x1baa('0x4'),'afterDestroy':_0x1baa('0x5')};function emitEvent(_0x42d334){return function(_0x360712,_0x98bcd4,_0x46b996){MailMessageEvents['emit'](_0x42d334+':'+_0x360712['id'],_0x360712);MailMessageEvents[_0x1baa('0x6')](_0x42d334,_0x360712);_0x46b996(null);};}for(var e in events){if(events[_0x1baa('0x7')](e)){var event=events[e];MailMessage[_0x1baa('0x8')](e,emitEvent(event));}}module[_0x1baa('0x9')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 40be2fd..3c6ff42 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 _0x44a1=['exports','define','MailMessage','mail_messages','messageId','plainBody','subject','body','models','get','toLowerCase','direction','out','secret','MailInteraction','findOne','then','createdAt','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44a1,0xf5));var _0x144a=function(_0x43725a,_0x198380){_0x43725a=_0x43725a-0x0;var _0x4024cd=_0x44a1[_0x43725a];return _0x4024cd;};'use strict';var _=require(_0x144a('0x0'));var util=require(_0x144a('0x1'));var logger=require('../../config/logger')(_0x144a('0x2'));var moment=require(_0x144a('0x3'));var BPromise=require(_0x144a('0x4'));var rp=require(_0x144a('0x5'));var htmlToText=require(_0x144a('0x6'));var fs=require('fs');var path=require(_0x144a('0x7'));var rimraf=require(_0x144a('0x8'));var config=require(_0x144a('0x9'));var attributes=require(_0x144a('0xa'));module[_0x144a('0xb')]=function(_0x2a92fb,_0xaf9232){return _0x2a92fb[_0x144a('0xc')](_0x144a('0xd'),attributes,{'tableName':_0x144a('0xe'),'paranoid':![],'indexes':[{'name':_0x144a('0xf'),'fields':[_0x144a('0xf')]},{'name':'fti_mail_messages','fields':[_0x144a('0x10'),_0x144a('0x11')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x45ee7b,_0x35828e,_0x1f4e94){if(_0x45ee7b[_0x144a('0x12')]){_0x45ee7b['plainBody']=htmlToText['fromString'](_0x45ee7b[_0x144a('0x12')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x1f4e94(null,_0x35828e);},'afterCreate':function(_0x46414f,_0x30a031,_0x1461a6){var _0x4ac246=_0x2a92fb[_0x144a('0x13')];var _0x1d509f=_0x46414f[_0x144a('0x14')]({'plain':!![]});if(_0x1d509f['direction'][_0x144a('0x15')]()==='in'||_0x1d509f[_0x144a('0x16')][_0x144a('0x15')]()===_0x144a('0x17')&&!_0x1d509f[_0x144a('0x18')]&&!_['isNil'](_0x1d509f['UserId'])){_0x4ac246[_0x144a('0x19')][_0x144a('0x1a')]({'where':{'id':_0x1d509f['MailInteractionId']}})[_0x144a('0x1b')](function(_0x13d224){if(_0x13d224){_0x13d224['update']({'lastMsgAt':_0x1d509f[_0x144a('0x1c')],'lastMsgDirection':_0x1d509f[_0x144a('0x16')]['toLowerCase']()});}})[_0x144a('0x1d')](function(_0x2d54c5){console[_0x144a('0x1e')](_0x2d54c5);});}_0x1461a6();}},'charset':_0x144a('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xa19a=['FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','isNil','UserId','MailInteraction','findOne','MailInteractionId','then','createdAt','error','utf8mb4','lodash','../../config/logger','api','bluebird','html-to-text','./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xa19a,0x1e1));var _0xaa19=function(_0x963de3,_0x4afa2d){_0x963de3=_0x963de3-0x0;var _0x4f7d3e=_0xa19a[_0x963de3];return _0x4f7d3e;};'use strict';var _=require(_0xaa19('0x0'));var util=require('util');var logger=require(_0xaa19('0x1'))(_0xaa19('0x2'));var moment=require('moment');var BPromise=require(_0xaa19('0x3'));var rp=require('request-promise');var htmlToText=require(_0xaa19('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaa19('0x5'));module['exports']=function(_0x5ecbca,_0x1e7311){return _0x5ecbca[_0xaa19('0x6')](_0xaa19('0x7'),attributes,{'tableName':_0xaa19('0x8'),'paranoid':![],'indexes':[{'name':_0xaa19('0x9'),'fields':['messageId']},{'name':_0xaa19('0xa'),'fields':[_0xaa19('0xb'),'subject'],'type':_0xaa19('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x173c18,_0x56acf0,_0x4c8415){if(_0x173c18[_0xaa19('0xd')]){_0x173c18[_0xaa19('0xb')]=htmlToText[_0xaa19('0xe')](_0x173c18[_0xaa19('0xd')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x4c8415(null,_0x56acf0);},'afterCreate':function(_0x9efbe4,_0x5949bc,_0x3dcdd3){var _0xed8ec4=_0x5ecbca[_0xaa19('0xf')];var _0xe0cc65=_0x9efbe4[_0xaa19('0x10')]({'plain':!![]});if(_0xe0cc65['direction'][_0xaa19('0x11')]()==='in'||_0xe0cc65[_0xaa19('0x12')][_0xaa19('0x11')]()===_0xaa19('0x13')&&!_0xe0cc65['secret']&&!_[_0xaa19('0x14')](_0xe0cc65[_0xaa19('0x15')])){_0xed8ec4[_0xaa19('0x16')][_0xaa19('0x17')]({'where':{'id':_0xe0cc65[_0xaa19('0x18')]}})[_0xaa19('0x19')](function(_0x1d90dc){if(_0x1d90dc){_0x1d90dc['update']({'lastMsgAt':_0xe0cc65[_0xaa19('0x1a')],'lastMsgDirection':_0xe0cc65['direction'][_0xaa19('0x11')]()});}})['catch'](function(_0x198ab8){console[_0xaa19('0x1b')](_0x198ab8);});}_0x3dcdd3();}},'charset':_0xaa19('0x1c'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 3b5c6e0..9abebcc 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 _0xea28=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateMailMessage','MailMessage','body','options','raw','stringify','lodash'];(function(_0x4c0622,_0x5dacaf){var _0x1799d8=function(_0x2ba801){while(--_0x2ba801){_0x4c0622['push'](_0x4c0622['shift']());}};_0x1799d8(++_0x5dacaf);}(_0xea28,0x13a));var _0x8ea2=function(_0x2f5411,_0x2b8059){_0x2f5411=_0x2f5411-0x0;var _0x5ea8e0=_0xea28[_0x2f5411];return _0x5ea8e0;};'use strict';var _=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var moment=require(_0x8ea2('0x2'));var BPromise=require(_0x8ea2('0x3'));var rs=require(_0x8ea2('0x4'));var fs=require('fs');var Redis=require(_0x8ea2('0x5'));var db=require(_0x8ea2('0x6'))['db'];var utils=require(_0x8ea2('0x7'));var logger=require('../../config/logger')(_0x8ea2('0x8'));var config=require(_0x8ea2('0x9'));var jayson=require(_0x8ea2('0xa'));var client=jayson['client'][_0x8ea2('0xb')]({'port':0x232a});config[_0x8ea2('0xc')]=_[_0x8ea2('0xd')](config[_0x8ea2('0xc')],{'host':_0x8ea2('0xe'),'port':0x18eb});var socket=require(_0x8ea2('0xf'))(new Redis(config[_0x8ea2('0xc')]));require(_0x8ea2('0x10'))[_0x8ea2('0x11')](socket);function respondWithRpcPromise(_0x3000f9,_0x3d0b35,_0x21ae3d){return new BPromise(function(_0x500b82,_0x4da3b1){return client[_0x8ea2('0x12')](_0x3000f9,_0x21ae3d)[_0x8ea2('0x13')](function(_0x374973){logger['info'](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));logger[_0x8ea2('0x16')](_0x8ea2('0x17'),_0x3d0b35,_0x8ea2('0x15'),JSON['stringify'](_0x374973));if(_0x374973[_0x8ea2('0x18')]){if(_0x374973['error']['code']===0x1f4){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x4da3b1(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);return _0x500b82(_0x374973[_0x8ea2('0x18')][_0x8ea2('0x19')]);}else{logger[_0x8ea2('0x1a')](_0x8ea2('0x14'),_0x3d0b35,_0x8ea2('0x15'));_0x500b82(_0x374973[_0x8ea2('0x1b')][_0x8ea2('0x19')]);}})[_0x8ea2('0x1c')](function(_0x1068b6){logger[_0x8ea2('0x18')](_0x8ea2('0x14'),_0x3d0b35,_0x1068b6);_0x4da3b1(_0x1068b6);});});}exports[_0x8ea2('0x1d')]=function(_0x52b58c){var _0x4be7c9=this;return new Promise(function(_0x3790e9,_0x248c18){return db[_0x8ea2('0x1e')]['create'](_0x52b58c[_0x8ea2('0x1f')],{'raw':_0x52b58c[_0x8ea2('0x20')]?_0x52b58c['options'][_0x8ea2('0x21')]===undefined?!![]:![]:!![]})[_0x8ea2('0x13')](function(_0x37229a){logger[_0x8ea2('0x1a')](_0x8ea2('0x1d'),_0x52b58c);logger[_0x8ea2('0x16')](_0x8ea2('0x1d'),_0x52b58c,JSON[_0x8ea2('0x22')](_0x37229a));_0x3790e9(_0x37229a);})[_0x8ea2('0x1c')](function(_0x4d5030){logger[_0x8ea2('0x18')]('CreateMailMessage',_0x4d5030[_0x8ea2('0x19')],_0x52b58c);_0x248c18(_0x4be7c9[_0x8ea2('0x18')](0x1f4,_0x4d5030[_0x8ea2('0x19')]));});});}; \ No newline at end of file +var _0xbaf0=['request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailMessage,\x20%s,\x20%s','message','result','catch','MailMessage','create','body','options','raw','CreateMailMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','register'];(function(_0x2cbc1e,_0x297280){var _0x3df1b7=function(_0x31bac0){while(--_0x31bac0){_0x2cbc1e['push'](_0x2cbc1e['shift']());}};_0x3df1b7(++_0x297280);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});config[_0x0baf('0xc')]=_[_0x0baf('0xd')](config[_0x0baf('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x0baf('0xe'))(new Redis(config['redis']));require(_0x0baf('0xf'))[_0x0baf('0x10')](socket);function respondWithRpcPromise(_0x465528,_0x2f46e8,_0x7f54d4){return new BPromise(function(_0xf4c8ac,_0x41cead){return client[_0x0baf('0x11')](_0x465528,_0x7f54d4)[_0x0baf('0x12')](function(_0x1d60a2){logger[_0x0baf('0x13')]('MailMessage,\x20%s,\x20%s',_0x2f46e8,'request\x20sent');logger[_0x0baf('0x14')](_0x0baf('0x15'),_0x2f46e8,_0x0baf('0x16'),JSON[_0x0baf('0x17')](_0x1d60a2));if(_0x1d60a2['error']){if(_0x1d60a2[_0x0baf('0x18')]['code']===0x1f4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0x41cead(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x2f46e8,_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);return _0xf4c8ac(_0x1d60a2[_0x0baf('0x18')][_0x0baf('0x1a')]);}else{logger[_0x0baf('0x13')](_0x0baf('0x19'),_0x2f46e8,'request\x20sent');_0xf4c8ac(_0x1d60a2[_0x0baf('0x1b')][_0x0baf('0x1a')]);}})[_0x0baf('0x1c')](function(_0x3e9cb4){logger[_0x0baf('0x18')](_0x0baf('0x19'),_0x2f46e8,_0x3e9cb4);_0x41cead(_0x3e9cb4);});});}exports['CreateMailMessage']=function(_0x5cff5d){var _0x1410ec=this;return new Promise(function(_0x154f48,_0x32e839){return db[_0x0baf('0x1d')][_0x0baf('0x1e')](_0x5cff5d[_0x0baf('0x1f')],{'raw':_0x5cff5d[_0x0baf('0x20')]?_0x5cff5d[_0x0baf('0x20')][_0x0baf('0x21')]===undefined?!![]:![]:!![]})[_0x0baf('0x12')](function(_0x54f2fa){logger[_0x0baf('0x13')]('CreateMailMessage',_0x5cff5d);logger[_0x0baf('0x14')]('CreateMailMessage',_0x5cff5d,JSON['stringify'](_0x54f2fa));_0x154f48(_0x54f2fa);})[_0x0baf('0x1c')](function(_0x48a0e9){logger['error'](_0x0baf('0x22'),_0x48a0e9[_0x0baf('0x1a')],_0x5cff5d);_0x32e839(_0x1410ec[_0x0baf('0x18')](0x1f4,_0x48a0e9[_0x0baf('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 36bfd9d..d8967ed 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 _0x209f=['mailMessage:','./mailMessage.events','remove','update','emit','removeListener','register','length'];(function(_0x4ae2fb,_0x1c1c67){var _0x4f5268=function(_0x11236b){while(--_0x11236b){_0x4ae2fb['push'](_0x4ae2fb['shift']());}};_0x4f5268(++_0x1c1c67);}(_0x209f,0x199));var _0xf209=function(_0x138014,_0x4ae22b){_0x138014=_0x138014-0x0;var _0x3941e3=_0x209f[_0x138014];return _0x3941e3;};'use strict';var MailMessageEvents=require(_0xf209('0x0'));var events=['save',_0xf209('0x1'),_0xf209('0x2')];function createListener(_0x5e4952,_0x39ff77){return function(_0x3878ac){_0x39ff77[_0xf209('0x3')](_0x5e4952,_0x3878ac);};}function removeListener(_0x5c9f66,_0x3e0100){return function(){MailMessageEvents[_0xf209('0x4')](_0x5c9f66,_0x3e0100);};}exports[_0xf209('0x5')]=function(_0x24b4e2){for(var _0x46c481=0x0,_0x5ba6df=events[_0xf209('0x6')];_0x46c481<_0x5ba6df;_0x46c481++){var _0x644a7b=events[_0x46c481];var _0x453721=createListener(_0xf209('0x7')+_0x644a7b,_0x24b4e2);MailMessageEvents['on'](_0x644a7b,_0x453721);}}; \ No newline at end of file +var _0x2911=['./mailMessage.events','save','remove','update','emit','removeListener','register','length','mailMessage:'];(function(_0x3695d5,_0x1b8740){var _0x599a61=function(_0x5f2e74){while(--_0x5f2e74){_0x3695d5['push'](_0x3695d5['shift']());}};_0x599a61(++_0x1b8740);}(_0x2911,0x90));var _0x1291=function(_0x43a89e,_0xdfaddb){_0x43a89e=_0x43a89e-0x0;var _0x3ddb80=_0x2911[_0x43a89e];return _0x3ddb80;};'use strict';var MailMessageEvents=require(_0x1291('0x0'));var events=[_0x1291('0x1'),_0x1291('0x2'),_0x1291('0x3')];function createListener(_0x8711c2,_0x2833de){return function(_0x232ebe){_0x2833de[_0x1291('0x4')](_0x8711c2,_0x232ebe);};}function removeListener(_0x38ab01,_0x5155f7){return function(){MailMessageEvents[_0x1291('0x5')](_0x38ab01,_0x5155f7);};}exports[_0x1291('0x6')]=function(_0x78646e){for(var _0x1115dd=0x0,_0x4672f8=events[_0x1291('0x7')];_0x1115dd<_0x4672f8;_0x1115dd++){var _0x67dc43=events[_0x1115dd];var _0x2151ea=createListener(_0x1291('0x8')+_0x67dc43,_0x78646e);MailMessageEvents['on'](_0x67dc43,_0x2151ea);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index b07d721..b8bd093 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 _0x7dfd=['get','/describe','isAuthenticated','describe','/:id','show','/:id/members','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller'];(function(_0x254973,_0x296153){var _0x25008e=function(_0x2080e9){while(--_0x2080e9){_0x254973['push'](_0x254973['shift']());}};_0x25008e(++_0x296153);}(_0x7dfd,0x1e6));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xd7df('0x0'));var util=require(_0xd7df('0x1'));var path=require(_0xd7df('0x2'));var timeout=require(_0xd7df('0x3'));var express=require(_0xd7df('0x4'));var router=express[_0xd7df('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd7df('0x6'));var interaction=require(_0xd7df('0x7'));var config=require(_0xd7df('0x8'));var controller=require(_0xd7df('0x9'));router[_0xd7df('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd7df('0xb'),auth[_0xd7df('0xc')](),controller[_0xd7df('0xd')]);router[_0xd7df('0xa')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller[_0xd7df('0xf')]);router['get'](_0xd7df('0x10'),auth[_0xd7df('0xc')](),controller['getMembers']);router[_0xd7df('0xa')]('/:id/teams',auth[_0xd7df('0xc')](),controller[_0xd7df('0x11')]);router[_0xd7df('0xa')](_0xd7df('0x12'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x13')]);router[_0xd7df('0x14')]('/',auth[_0xd7df('0xc')](),controller[_0xd7df('0x15')]);router[_0xd7df('0x14')](_0xd7df('0x16'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x17')]);router[_0xd7df('0x14')](_0xd7df('0x12'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x18')]);router[_0xd7df('0x19')](_0xd7df('0xe'),auth[_0xd7df('0xc')](),controller['update']);router[_0xd7df('0x1a')]('/:id',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1b')]);router['delete']('/:id/teams',auth[_0xd7df('0xc')](),controller[_0xd7df('0x1c')]);router[_0xd7df('0x1a')](_0xd7df('0x12'),auth[_0xd7df('0xc')](),controller[_0xd7df('0x1d')]);module[_0xd7df('0x1e')]=router; \ No newline at end of file +var _0x9682=['destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','/:id','delete'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x9682,0x109));var _0x2968=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9682[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require(_0x2968('0x0'));var util=require(_0x2968('0x1'));var path=require('path');var timeout=require(_0x2968('0x2'));var express=require(_0x2968('0x3'));var router=express['Router']();var fs_extra=require(_0x2968('0x4'));var auth=require(_0x2968('0x5'));var interaction=require(_0x2968('0x6'));var config=require('../../config/environment');var controller=require(_0x2968('0x7'));router[_0x2968('0x8')]('/',auth[_0x2968('0x9')](),controller[_0x2968('0xa')]);router[_0x2968('0x8')]('/describe',auth[_0x2968('0x9')](),controller[_0x2968('0xb')]);router[_0x2968('0x8')]('/:id',auth[_0x2968('0x9')](),controller[_0x2968('0xc')]);router[_0x2968('0x8')](_0x2968('0xd'),auth[_0x2968('0x9')](),controller[_0x2968('0xe')]);router['get'](_0x2968('0xf'),auth[_0x2968('0x9')](),controller[_0x2968('0x10')]);router[_0x2968('0x8')](_0x2968('0x11'),auth[_0x2968('0x9')](),controller['getAgents']);router[_0x2968('0x12')]('/',auth['isAuthenticated'](),controller[_0x2968('0x13')]);router[_0x2968('0x12')](_0x2968('0xf'),auth[_0x2968('0x9')](),controller[_0x2968('0x14')]);router['post'](_0x2968('0x11'),auth['isAuthenticated'](),controller[_0x2968('0x15')]);router[_0x2968('0x16')](_0x2968('0x17'),auth[_0x2968('0x9')](),controller['update']);router[_0x2968('0x18')]('/:id',auth[_0x2968('0x9')](),controller[_0x2968('0x19')]);router[_0x2968('0x18')](_0x2968('0xf'),auth[_0x2968('0x9')](),controller[_0x2968('0x1a')]);router[_0x2968('0x18')](_0x2968('0x11'),auth['isAuthenticated'](),controller[_0x2968('0x1b')]);module[_0x2968('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index d0af94c..abc3819 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 _0x26a8=['sequelize','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x2f3c64,_0x2427d3){var _0x1137e9=function(_0x1664cf){while(--_0x1664cf){_0x2f3c64['push'](_0x2f3c64['shift']());}};_0x1137e9(++_0x2427d3);}(_0x26a8,0x1e0));var _0x826a=function(_0x51993e,_0x582b97){_0x51993e=_0x51993e-0x0;var _0x356c4e=_0x26a8[_0x51993e];return _0x356c4e;};'use strict';var Sequelize=require(_0x826a('0x0'));module['exports']={'name':{'type':Sequelize[_0x826a('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x826a('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x826a('0x3')](_0x826a('0x4'),_0x826a('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x5c4f=['ENUM'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5c4f,0x9d));var _0xf5c4=function(_0x593655,_0x5f272b){_0x593655=_0x593655-0x0;var _0x3852f4=_0x5c4f[_0x593655];return _0x3852f4;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf5c4('0x0')]('rrmemory','beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index c4144df..ac02718 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 _0x95f6=['get','MailQueues','UserProfileResource','error','stack','name','index','MailQueue','fieldName','type','key','getOptions','where','include','findAll','rows','show','params','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','body','describe','getMembers','findOne','hasOwnProperty','order','pick','filter','map','UserMailQueue','findAndCountAll','UserId','agent','format','SIP','mailPause','createdAt','updatedAt','getTeams','sort','Team','User','online','voicePause','flatMap','Agents','sequelize','addTeams','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','value','transaction','removeAgents','omit','spread','isArray','userMailQueue:remove','getAgents','nolimit','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','offset','undefined','limit','count','Content-Range','json','update','then','destroy'];(function(_0x7deec6,_0x4a071a){var _0x5e538f=function(_0x30fded){while(--_0x30fded){_0x7deec6['push'](_0x7deec6['shift']());}};_0x5e538f(++_0x4a071a);}(_0x95f6,0x1d9));var _0x695f=function(_0x47761d,_0x3f8494){_0x47761d=_0x47761d-0x0;var _0x3d1c05=_0x95f6[_0x47761d];return _0x3d1c05;};'use strict';var BPromise=require(_0x695f('0x0'));var util=require(_0x695f('0x1'));var _=require(_0x695f('0x2'));var squel=require(_0x695f('0x3'));var Redis=require(_0x695f('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x695f('0x5'))(_0x695f('0x6'));var config=require(_0x695f('0x7'));var db=require(_0x695f('0x8'))['db'];config[_0x695f('0x9')]=_[_0x695f('0xa')](config[_0x695f('0x9')],{'host':_0x695f('0xb'),'port':0x18eb});var socket=require(_0x695f('0xc'))(new Redis(config[_0x695f('0x9')]));require(_0x695f('0xd'))[_0x695f('0xe')](socket);function respondWithStatusCode(_0x22d7c9,_0x1b6910){_0x1b6910=_0x1b6910||0xcc;return function(_0x2862d8){if(_0x2862d8){return _0x22d7c9[_0x695f('0xf')](_0x1b6910);}return _0x22d7c9['status'](_0x1b6910)[_0x695f('0x10')]();};}function respondWithResult(_0x52d29c,_0x110628){_0x110628=_0x110628||0xc8;return function(_0xeda05c){if(_0xeda05c){return _0x52d29c[_0x695f('0x11')](_0x110628)['json'](_0xeda05c);}};}function respondWithFilteredResult(_0x2baaa0,_0xb0f750){return function(_0x155e32){if(_0x155e32){var _0x588aac=typeof _0xb0f750[_0x695f('0x12')]===_0x695f('0x13')&&typeof _0xb0f750[_0x695f('0x14')]===_0x695f('0x13');var _0x13e0f2=_0x155e32[_0x695f('0x15')];var _0x9a4f01=_0x588aac?0x0:_0xb0f750[_0x695f('0x12')];var _0x307845=_0x588aac?_0x155e32[_0x695f('0x15')]:_0xb0f750[_0x695f('0x12')]+_0xb0f750[_0x695f('0x14')];var _0x3f2b08;if(_0x307845>=_0x13e0f2){_0x307845=_0x13e0f2;_0x3f2b08=0xc8;}else{_0x3f2b08=0xce;}_0x2baaa0[_0x695f('0x11')](_0x3f2b08);return _0x2baaa0['set'](_0x695f('0x16'),_0x9a4f01+'-'+_0x307845+'/'+_0x13e0f2)[_0x695f('0x17')](_0x155e32);}return null;};}function saveUpdates(_0x29ed03){return function(_0x13bc0a){if(_0x13bc0a){return _0x13bc0a[_0x695f('0x18')](_0x29ed03)[_0x695f('0x19')](function(_0x630f9b){return _0x630f9b;});}return null;};}function removeEntity(_0x459f4d){return function(_0x1a544b){if(_0x1a544b){return _0x1a544b[_0x695f('0x1a')]()[_0x695f('0x19')](function(){var _0x26b207=_0x1a544b[_0x695f('0x1b')]({'plain':!![]});var _0x39aaef=_0x695f('0x1c');return db[_0x695f('0x1d')]['destroy']({'where':{'type':_0x39aaef,'resourceId':_0x26b207['id']}})[_0x695f('0x19')](function(){return _0x1a544b;});})[_0x695f('0x19')](function(){_0x459f4d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59dbbb){return function(_0x12b117){if(!_0x12b117){_0x59dbbb[_0x695f('0xf')](0x194);}return _0x12b117;};}function handleError(_0x596f46,_0x53cec9){_0x53cec9=_0x53cec9||0x1f4;return function(_0x47976c){logger[_0x695f('0x1e')](_0x47976c[_0x695f('0x1f')]);if(_0x47976c['name']){delete _0x47976c[_0x695f('0x20')];}_0x596f46[_0x695f('0x11')](_0x53cec9)['send'](_0x47976c);};}exports[_0x695f('0x21')]=function(_0x1724ef,_0x1e24ac){var _0x23fad9={};var _0x3f7b38={'count':0x0,'rows':[]};var _0x31add0=_['map'](db[_0x695f('0x22')]['rawAttributes'],function(_0x42dc3f){return{'name':_0x42dc3f[_0x695f('0x23')],'type':_0x42dc3f[_0x695f('0x24')][_0x695f('0x25')]};});_0x23fad9=qs[_0x695f('0x26')](_0x31add0,_0x1724ef);var _0x426764={'where':_0x23fad9[_0x695f('0x27')]};return db[_0x695f('0x22')][_0x695f('0x15')](_0x426764)[_0x695f('0x19')](function(_0x41df5d){_0x3f7b38[_0x695f('0x15')]=_0x41df5d;_0x23fad9['include']=qs[_0x695f('0x28')](_0x1724ef['query']);return db[_0x695f('0x22')][_0x695f('0x29')](_0x23fad9);})[_0x695f('0x19')](function(_0x2c6451){_0x3f7b38[_0x695f('0x2a')]=_0x2c6451;return _0x3f7b38;})['then'](respondWithFilteredResult(_0x1e24ac,_0x23fad9))['catch'](handleError(_0x1e24ac,null));};exports[_0x695f('0x2b')]=function(_0xf2b3e,_0x2ba8cd){var _0xbc6cd6={'raw':!![],'where':{'id':_0xf2b3e[_0x695f('0x2c')]['id']}},_0x414562={};_0x414562['model']=_[_0x695f('0x2d')](db[_0x695f('0x22')][_0x695f('0x2e')]);_0x414562[_0x695f('0x2f')]=_['keys'](_0xf2b3e[_0x695f('0x2f')]);_0x414562[_0x695f('0x30')]=_[_0x695f('0x31')](_0x414562[_0x695f('0x32')],_0x414562[_0x695f('0x2f')]);_0xbc6cd6[_0x695f('0x33')]=_[_0x695f('0x31')](_0x414562[_0x695f('0x32')],qs[_0x695f('0x34')](_0xf2b3e[_0x695f('0x2f')][_0x695f('0x34')]));_0xbc6cd6[_0x695f('0x33')]=_0xbc6cd6[_0x695f('0x33')][_0x695f('0x35')]?_0xbc6cd6['attributes']:_0x414562[_0x695f('0x32')];if(_0xf2b3e['query'][_0x695f('0x36')]){_0xbc6cd6[_0x695f('0x28')]=[{'all':!![]}];}_0xbc6cd6=_[_0x695f('0x37')]({},_0xbc6cd6,_0xf2b3e[_0x695f('0x38')]);return db[_0x695f('0x22')]['find'](_0xbc6cd6)['then'](handleEntityNotFound(_0x2ba8cd,null))['then'](respondWithResult(_0x2ba8cd,null))[_0x695f('0x39')](handleError(_0x2ba8cd,null));};exports[_0x695f('0x3a')]=function(_0x200790,_0x1f710c){return db[_0x695f('0x22')][_0x695f('0x3a')](_0x200790['body'],{})[_0x695f('0x19')](function(_0x1b981e){var _0x671f9e=_0x200790[_0x695f('0x3b')][_0x695f('0x1b')]({'plain':!![]});if(!_0x671f9e)throw new Error(_0x695f('0x3c'));if(_0x671f9e['role']===_0x695f('0x3b')){var _0x54d9fb=_0x1b981e[_0x695f('0x1b')]({'plain':!![]});var _0x25dd3e=_0x695f('0x1c');return db[_0x695f('0x3d')][_0x695f('0x3e')]({'where':{'name':_0x25dd3e,'userProfileId':_0x671f9e['userProfileId']},'raw':!![]})['then'](function(_0x212e03){if(_0x212e03&&_0x212e03[_0x695f('0x3f')]===0x0){return db[_0x695f('0x1d')][_0x695f('0x3a')]({'name':_0x54d9fb[_0x695f('0x20')],'resourceId':_0x54d9fb['id'],'type':_0x212e03[_0x695f('0x20')],'sectionId':_0x212e03['id']},{})[_0x695f('0x19')](function(){return _0x1b981e;});}else{return _0x1b981e;}})[_0x695f('0x39')](function(_0x5d5862){logger[_0x695f('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5d5862);throw _0x5d5862;});}return _0x1b981e;})[_0x695f('0x19')](respondWithResult(_0x1f710c,0xc9))['catch'](handleError(_0x1f710c,null));};exports[_0x695f('0x18')]=function(_0x22ecc4,_0x454f29){if(_0x22ecc4[_0x695f('0x40')]['id']){delete _0x22ecc4[_0x695f('0x40')]['id'];}return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x22ecc4[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x454f29,null))['then'](saveUpdates(_0x22ecc4[_0x695f('0x40')],null))[_0x695f('0x19')](respondWithResult(_0x454f29,null))['catch'](handleError(_0x454f29,null));};exports[_0x695f('0x1a')]=function(_0x187564,_0x29c2a5){return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x187564['params']['id']}})['then'](handleEntityNotFound(_0x29c2a5,null))[_0x695f('0x19')](removeEntity(_0x29c2a5,null))[_0x695f('0x39')](handleError(_0x29c2a5,null));};exports[_0x695f('0x41')]=function(_0x403b06,_0x362346){return db[_0x695f('0x22')][_0x695f('0x41')]()[_0x695f('0x19')](respondWithResult(_0x362346,null))['catch'](handleError(_0x362346,null));};exports[_0x695f('0x42')]=function(_0x38d7b4,_0x29cf31){var _0x30387d={'raw':!![],'where':{}},_0x1ea066={},_0x4bb670;return db[_0x695f('0x22')][_0x695f('0x43')]({'where':{'id':_0x38d7b4['params']['id']}})['then'](handleEntityNotFound(_0x29cf31,null))[_0x695f('0x19')](function(_0xec0748){if(_0xec0748){_0x4bb670=_0xec0748[_0x695f('0x1b')]({'plain':!![]});_0x1ea066['model']=_['keys'](db['UserMailQueue'][_0x695f('0x2e')]);_0x1ea066[_0x695f('0x2f')]=_['keys'](_0x38d7b4[_0x695f('0x2f')]);_0x1ea066[_0x695f('0x30')]=_['intersection'](_0x1ea066[_0x695f('0x32')],_0x1ea066[_0x695f('0x2f')]);_0x30387d[_0x695f('0x33')]=_['intersection'](_0x1ea066[_0x695f('0x32')],qs[_0x695f('0x34')](_0x38d7b4[_0x695f('0x2f')][_0x695f('0x34')]));_0x30387d[_0x695f('0x33')]=_0x30387d['attributes']['length']?_0x30387d[_0x695f('0x33')]:_0x1ea066[_0x695f('0x32')];if(!_0x38d7b4[_0x695f('0x2f')][_0x695f('0x44')]('nolimit')){_0x30387d[_0x695f('0x14')]=qs['limit'](_0x38d7b4['query'][_0x695f('0x14')]);_0x30387d[_0x695f('0x12')]=qs['offset'](_0x38d7b4[_0x695f('0x2f')]['offset']);}_0x30387d[_0x695f('0x45')]=qs['sort'](_0x38d7b4[_0x695f('0x2f')]['sort']);_0x30387d[_0x695f('0x27')]=qs['filters'](_[_0x695f('0x46')](_0x38d7b4['query'],_0x1ea066[_0x695f('0x30')]));_0x30387d[_0x695f('0x27')]['MailQueueId']=_0xec0748['id'];if(_0x38d7b4['query'][_0x695f('0x47')]){_0x30387d[_0x695f('0x27')]=_[_0x695f('0x37')](_0x30387d[_0x695f('0x27')],{'$or':_[_0x695f('0x48')](_0x30387d[_0x695f('0x33')],function(_0x5599a0){var _0x5bae62={};_0x5bae62[_0x5599a0]={'$like':'%'+_0x38d7b4[_0x695f('0x2f')][_0x695f('0x47')]+'%'};return _0x5bae62;})});}_0x30387d=_['merge']({},_0x30387d,_0x38d7b4[_0x695f('0x38')]);return db[_0x695f('0x49')][_0x695f('0x29')](_0x30387d);}})[_0x695f('0x19')](function(_0x2c1eaa){if(_0x2c1eaa){return db['User'][_0x695f('0x4a')]({'where':{'id':_[_0x695f('0x48')](_0x2c1eaa,_0x695f('0x4b')),'role':_0x695f('0x4c')},'attributes':['id',_0x695f('0x20'),'mailPause','updatedAt','createdAt']});}})[_0x695f('0x19')](function(_0x2700ae){if(_0x2700ae){return{'count':_0x2700ae['count'],'rows':_[_0x695f('0x48')](_0x2700ae[_0x695f('0x2a')],function(_0x42957f){return{'membername':_0x42957f['name'],'UserId':_0x42957f['id'],'queue_name':_0x4bb670[_0x695f('0x20')],'MailQueueId':_0x4bb670['id'],'interface':util[_0x695f('0x4d')]('%s/%s',_0x695f('0x4e'),_0x42957f[_0x695f('0x20')]),'penalty':0x0,'paused':_0x42957f[_0x695f('0x4f')],'createdAt':_0x42957f[_0x695f('0x50')],'updatedAt':_0x42957f[_0x695f('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x695f('0x19')](respondWithFilteredResult(_0x29cf31,_0x30387d))['catch'](handleError(_0x29cf31,null));};exports[_0x695f('0x52')]=function(_0x223afc,_0x474cbd){var _0x68abdd={};var _0x500a7b={};var _0x23bf64;var _0x1f8626;return db[_0x695f('0x22')]['findOne']({'where':{'id':_0x223afc[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x474cbd,null))[_0x695f('0x19')](function(_0x355f01){if(_0x355f01){_0x23bf64=_0x355f01;_0x500a7b[_0x695f('0x32')]=_[_0x695f('0x2d')](db['Team'][_0x695f('0x2e')]);_0x500a7b[_0x695f('0x2f')]=_[_0x695f('0x2d')](_0x223afc[_0x695f('0x2f')]);_0x500a7b[_0x695f('0x30')]=_[_0x695f('0x31')](_0x500a7b[_0x695f('0x32')],_0x500a7b[_0x695f('0x2f')]);_0x68abdd[_0x695f('0x33')]=_[_0x695f('0x31')](_0x500a7b[_0x695f('0x32')],qs[_0x695f('0x34')](_0x223afc[_0x695f('0x2f')]['fields']));_0x68abdd[_0x695f('0x33')]=_0x68abdd[_0x695f('0x33')][_0x695f('0x35')]?_0x68abdd['attributes']:_0x500a7b[_0x695f('0x32')];_0x68abdd['order']=qs['sort'](_0x223afc[_0x695f('0x2f')][_0x695f('0x53')]);_0x68abdd['where']=qs['filters'](_[_0x695f('0x46')](_0x223afc[_0x695f('0x2f')],_0x500a7b[_0x695f('0x30')]));if(_0x223afc[_0x695f('0x2f')]['filter']){_0x68abdd['where']=_[_0x695f('0x37')](_0x68abdd[_0x695f('0x27')],{'$or':_['map'](_0x68abdd[_0x695f('0x33')],function(_0xe5b4cc){var _0x1768dd={};_0x1768dd[_0xe5b4cc]={'$like':'%'+_0x223afc[_0x695f('0x2f')]['filter']+'%'};return _0x1768dd;})});}_0x68abdd=_[_0x695f('0x37')]({},_0x68abdd,_0x223afc[_0x695f('0x38')]);return _0x23bf64[_0x695f('0x52')](_0x68abdd);}})[_0x695f('0x19')](function(_0x5b39c0){if(_0x5b39c0){_0x1f8626=_0x5b39c0[_0x695f('0x35')];if(!_0x223afc[_0x695f('0x2f')][_0x695f('0x44')]('nolimit')){_0x68abdd[_0x695f('0x14')]=qs['limit'](_0x223afc[_0x695f('0x2f')][_0x695f('0x14')]);_0x68abdd[_0x695f('0x12')]=qs['offset'](_0x223afc[_0x695f('0x2f')]['offset']);}return _0x23bf64[_0x695f('0x52')](_0x68abdd);}})[_0x695f('0x19')](function(_0x18d16b){if(_0x18d16b){return _0x18d16b?{'count':_0x1f8626,'rows':_0x18d16b}:null;}})[_0x695f('0x19')](respondWithResult(_0x474cbd,null))[_0x695f('0x39')](handleError(_0x474cbd,null));};exports['addTeams']=function(_0x527f68,_0x9a18fd){var _0x49b9c0=_0x527f68[_0x695f('0x40')]['ids'];return db[_0x695f('0x54')][_0x695f('0x29')]({'where':{'id':_0x49b9c0},'attributes':['id'],'include':[{'model':db[_0x695f('0x55')],'as':'Agents','attributes':['id','name',_0x695f('0x56'),_0x695f('0x57'),'interface'],'raw':!![]}]})['then'](function(_0x7ab569){if(_0x7ab569){var _0x3d74de=_[_0x695f('0x58')](_0x7ab569,function(_0x2df425){var _0x3f4d73=_0x2df425[_0x695f('0x1b')]({'plain':!![]});return _0x3f4d73[_0x695f('0x59')];});return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x527f68[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](function(_0x5d62fc){return db[_0x695f('0x5a')]['transaction'](function(_0x28d962){return _0x5d62fc[_0x695f('0x5b')](_0x49b9c0,{'transaction':_0x28d962})[_0x695f('0x19')](function(){return BPromise[_0x695f('0x5c')](_0x3d74de,function(_0x10358b){return db[_0x695f('0x49')][_0x695f('0x5d')]({'where':{'UserId':_0x10358b['id'],'MailQueueId':_0x527f68['params']['id']},'transaction':_0x28d962});});})[_0x695f('0x19')](function(){_0x3d74de[_0x695f('0x5e')](function(_0x54fe9b){socket[_0x695f('0x5f')](_0x695f('0x60'),{'UserId':_0x54fe9b['id'],'MailQueueId':_0x5d62fc['id']});});});});});}})[_0x695f('0x19')](respondWithStatusCode(_0x9a18fd,null))[_0x695f('0x39')](handleError(_0x9a18fd,null));};exports[_0x695f('0x61')]=function(_0x4ac87e,_0x1d8b84){return db['Team']['findAll']({'where':{'id':_0x4ac87e[_0x695f('0x2f')][_0x695f('0x62')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x695f('0x59'),'attributes':['id'],'raw':!![]}]})[_0x695f('0x19')](handleEntityNotFound(_0x1d8b84,null))[_0x695f('0x19')](function(_0x457f01){var _0x3bd0ea=_[_0x695f('0x48')](_0x457f01,'id');var _0x3055b2=[];var _0x16c5ca=[];var _0xac68dd=squel[_0x695f('0x63')]();_0xac68dd[_0x695f('0x64')](_0x695f('0x65'))[_0x695f('0x66')]('team_has_mail_queues','tq')['join'](_0x695f('0x67'),'ut',_0x695f('0x68'))[_0x695f('0x27')](_0x695f('0x69'),_0x4ac87e[_0x695f('0x2c')]['id']);for(var _0x5865bf=0x0;_0x5865bf<_0x457f01[_0x695f('0x35')];_0x5865bf+=0x1){let _0x4b2af0=_0x457f01[_0x5865bf];for(var _0x11afdb=0x0;_0x11afdb<_0x4b2af0[_0x695f('0x59')][_0x695f('0x35')];_0x11afdb+=0x1){let _0x3421fc=_0x4b2af0[_0x695f('0x59')][_0x11afdb];var _0x3311a8=_0xac68dd[_0x695f('0x6a')]();_0x3311a8['where'](_0x695f('0x6b'),_0x3421fc['id']);_0x16c5ca['push'](db[_0x695f('0x5a')][_0x695f('0x2f')](_0x3311a8[_0x695f('0x6c')](),{'type':db['sequelize'][_0x695f('0x6d')][_0x695f('0x6e')]})[_0x695f('0x19')](function(_0x3c447f){if(_0x3c447f['length']===0x1){return _0x3421fc['id'];}else{var _0x2cef49=_[_0x695f('0x6f')](_[_0x695f('0x48')](_0x3c447f,_0x695f('0x70')),function(_0x56f64a){return _[_0x695f('0x71')](_0x3bd0ea,_0x56f64a);});if(_0x2cef49){return _0x3421fc['id'];}}}));}}return BPromise[_0x695f('0x72')](_0x16c5ca)[_0x695f('0x19')](function(_0x18c18c){_0x3055b2=_(_0x3055b2)[_0x695f('0x73')](_0x18c18c)['compact']()[_0x695f('0x74')]();return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x4ac87e['params']['id']}})[_0x695f('0x19')](function(_0x401866){return db[_0x695f('0x5a')][_0x695f('0x75')](function(_0xfd97e1){return _0x401866['removeTeams'](_0x4ac87e['query'][_0x695f('0x62')],{'transaction':_0xfd97e1})[_0x695f('0x19')](function(){if(!_['isEmpty'](_0x3055b2)){return _0x401866[_0x695f('0x76')](_0x3055b2,{'transaction':_0xfd97e1});}})[_0x695f('0x19')](function(){_0x3055b2[_0x695f('0x5e')](function(_0x36c43f){socket['emit']('userMailQueue:remove',{'UserId':_0x36c43f,'MailQueueId':_0x401866['id']});});});});});});})[_0x695f('0x19')](respondWithStatusCode(_0x1d8b84,null))[_0x695f('0x39')](handleError(_0x1d8b84,null));};exports['addAgents']=function(_0x2c505a,_0x36f5bc){return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x2c505a[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x36f5bc,null))['then'](function(_0x156d9b){if(_0x156d9b){return _0x156d9b['addAgents'](_0x2c505a[_0x695f('0x40')][_0x695f('0x62')],_[_0x695f('0x77')](_0x2c505a['body'],[_0x695f('0x62'),'id'])||{})[_0x695f('0x78')](function(_0x34f707){for(var _0x38ef0e=0x0;_0x38ef0e<_0x2c505a[_0x695f('0x40')][_0x695f('0x62')][_0x695f('0x35')];_0x38ef0e+=0x1){socket['emit'](_0x695f('0x60'),{'UserId':Number(_0x2c505a[_0x695f('0x40')][_0x695f('0x62')][_0x38ef0e]),'MailQueueId':Number(_0x2c505a[_0x695f('0x2c')]['id'])});}return _0x34f707;});}})['then'](respondWithResult(_0x36f5bc,null))[_0x695f('0x39')](handleError(_0x36f5bc,null));};exports[_0x695f('0x76')]=function(_0x1f17e7,_0x32c23a){return db[_0x695f('0x22')][_0x695f('0x3e')]({'where':{'id':_0x1f17e7[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x32c23a,null))[_0x695f('0x19')](function(_0x417f02){if(_0x417f02){return _0x417f02['removeAgents'](_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')])[_0x695f('0x19')](function(){if(_[_0x695f('0x79')](_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')])){for(var _0xf55fb5=0x0;_0xf55fb5<_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')][_0x695f('0x35')];_0xf55fb5+=0x1){socket[_0x695f('0x5f')]('userMailQueue:remove',{'UserId':Number(_0x1f17e7['query']['ids'][_0xf55fb5]),'MailQueueId':Number(_0x1f17e7['params']['id'])});}}else{socket[_0x695f('0x5f')](_0x695f('0x7a'),{'UserId':Number(_0x1f17e7[_0x695f('0x2f')][_0x695f('0x62')]),'MailQueueId':Number(_0x1f17e7[_0x695f('0x2c')]['id'])});}});}})[_0x695f('0x19')](respondWithStatusCode(_0x32c23a,null))['catch'](handleError(_0x32c23a,null));};exports['getAgents']=function(_0x52f99f,_0x1ab042){var _0x6ce95c={};var _0x51220b={};var _0x47d711;var _0x56545c;return db[_0x695f('0x22')]['findOne']({'where':{'id':_0x52f99f[_0x695f('0x2c')]['id']}})[_0x695f('0x19')](handleEntityNotFound(_0x1ab042,null))[_0x695f('0x19')](function(_0x4654ad){if(_0x4654ad){_0x47d711=_0x4654ad;_0x51220b[_0x695f('0x32')]=_['keys'](db['User'][_0x695f('0x2e')]);_0x51220b[_0x695f('0x2f')]=_['keys'](_0x52f99f[_0x695f('0x2f')]);_0x51220b[_0x695f('0x30')]=_[_0x695f('0x31')](_0x51220b['model'],_0x51220b['query']);_0x6ce95c[_0x695f('0x33')]=_['intersection'](_0x51220b[_0x695f('0x32')],qs[_0x695f('0x34')](_0x52f99f[_0x695f('0x2f')][_0x695f('0x34')]));_0x6ce95c[_0x695f('0x33')]=_0x6ce95c[_0x695f('0x33')][_0x695f('0x35')]?_0x6ce95c[_0x695f('0x33')]:_0x51220b[_0x695f('0x32')];_0x6ce95c[_0x695f('0x45')]=qs['sort'](_0x52f99f[_0x695f('0x2f')]['sort']);_0x6ce95c[_0x695f('0x27')]=qs[_0x695f('0x30')](_[_0x695f('0x46')](_0x52f99f['query'],_0x51220b[_0x695f('0x30')]));if(_0x52f99f[_0x695f('0x2f')][_0x695f('0x47')]){_0x6ce95c[_0x695f('0x27')]=_[_0x695f('0x37')](_0x6ce95c[_0x695f('0x27')],{'$or':_[_0x695f('0x48')](_0x6ce95c[_0x695f('0x33')],function(_0x5b4327){var _0x44f05d={};_0x44f05d[_0x5b4327]={'$like':'%'+_0x52f99f[_0x695f('0x2f')][_0x695f('0x47')]+'%'};return _0x44f05d;})});}_0x6ce95c=_[_0x695f('0x37')]({},_0x6ce95c,_0x52f99f[_0x695f('0x38')]);return _0x47d711[_0x695f('0x7b')](_0x6ce95c);}})[_0x695f('0x19')](function(_0x56a525){if(_0x56a525){_0x56545c=_0x56a525[_0x695f('0x35')];if(!_0x52f99f[_0x695f('0x2f')][_0x695f('0x44')](_0x695f('0x7c'))){_0x6ce95c[_0x695f('0x14')]=qs[_0x695f('0x14')](_0x52f99f[_0x695f('0x2f')][_0x695f('0x14')]);_0x6ce95c[_0x695f('0x12')]=qs[_0x695f('0x12')](_0x52f99f[_0x695f('0x2f')][_0x695f('0x12')]);}return _0x47d711[_0x695f('0x7b')](_0x6ce95c);}})[_0x695f('0x19')](function(_0x5ee93a){if(_0x5ee93a){return _0x5ee93a?{'count':_0x56545c,'rows':_0x5ee93a}:null;}})[_0x695f('0x19')](respondWithResult(_0x1ab042,null))[_0x695f('0x39')](handleError(_0x1ab042,null));}; \ No newline at end of file +var _0x0ace=['send','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','keys','filters','intersection','model','attributes','fields','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','getMembers','hasOwnProperty','nolimit','order','sort','pick','MailQueueId','filter','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','SIP','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','removeTeams','User','select','field','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','includes','all','union','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','emit','userMailQueue:save','isArray','getAgents','bluebird','util','lodash','ioredis','../../components/parsers/qs','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','status','json','offset','undefined','limit','count','set','then','destroy','get','UserProfileResource','end','sendStatus','stack','name'];(function(_0x558951,_0x41fe79){var _0x3244fb=function(_0x19c16c){while(--_0x19c16c){_0x558951['push'](_0x558951['shift']());}};_0x3244fb(++_0x41fe79);}(_0x0ace,0x1c6));var _0xe0ac=function(_0x136e17,_0x4cc300){_0x136e17=_0x136e17-0x0;var _0x5099c9=_0x0ace[_0x136e17];return _0x5099c9;};'use strict';var BPromise=require(_0xe0ac('0x0'));var util=require(_0xe0ac('0x1'));var _=require(_0xe0ac('0x2'));var squel=require('squel');var Redis=require(_0xe0ac('0x3'));var qs=require(_0xe0ac('0x4'));var logger=require('../../config/logger')('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xe0ac('0x5')]=_[_0xe0ac('0x6')](config[_0xe0ac('0x5')],{'host':_0xe0ac('0x7'),'port':0x18eb});var socket=require(_0xe0ac('0x8'))(new Redis(config[_0xe0ac('0x5')]));require(_0xe0ac('0x9'))[_0xe0ac('0xa')](socket);function respondWithStatusCode(_0x12fad2,_0x4d0475){_0x4d0475=_0x4d0475||0xcc;return function(_0xb06525){if(_0xb06525){return _0x12fad2['sendStatus'](_0x4d0475);}return _0x12fad2[_0xe0ac('0xb')](_0x4d0475)['end']();};}function respondWithResult(_0x21c98e,_0x54c190){_0x54c190=_0x54c190||0xc8;return function(_0x3bc477){if(_0x3bc477){return _0x21c98e[_0xe0ac('0xb')](_0x54c190)[_0xe0ac('0xc')](_0x3bc477);}};}function respondWithFilteredResult(_0xa183ac,_0xbc330e){return function(_0x573cb2){if(_0x573cb2){var _0x26e326=typeof _0xbc330e[_0xe0ac('0xd')]===_0xe0ac('0xe')&&typeof _0xbc330e[_0xe0ac('0xf')]==='undefined';var _0x15021c=_0x573cb2[_0xe0ac('0x10')];var _0x12a41c=_0x26e326?0x0:_0xbc330e['offset'];var _0x8eff1d=_0x26e326?_0x573cb2[_0xe0ac('0x10')]:_0xbc330e[_0xe0ac('0xd')]+_0xbc330e['limit'];var _0x34ed17;if(_0x8eff1d>=_0x15021c){_0x8eff1d=_0x15021c;_0x34ed17=0xc8;}else{_0x34ed17=0xce;}_0xa183ac['status'](_0x34ed17);return _0xa183ac[_0xe0ac('0x11')]('Content-Range',_0x12a41c+'-'+_0x8eff1d+'/'+_0x15021c)[_0xe0ac('0xc')](_0x573cb2);}return null;};}function saveUpdates(_0x327adf){return function(_0x14b04a){if(_0x14b04a){return _0x14b04a['update'](_0x327adf)[_0xe0ac('0x12')](function(_0x2f471a){return _0x2f471a;});}return null;};}function removeEntity(_0x1158f1){return function(_0x4fc656){if(_0x4fc656){return _0x4fc656[_0xe0ac('0x13')]()[_0xe0ac('0x12')](function(){var _0x379942=_0x4fc656[_0xe0ac('0x14')]({'plain':!![]});var _0x1a8987='MailQueues';return db[_0xe0ac('0x15')][_0xe0ac('0x13')]({'where':{'type':_0x1a8987,'resourceId':_0x379942['id']}})[_0xe0ac('0x12')](function(){return _0x4fc656;});})[_0xe0ac('0x12')](function(){_0x1158f1[_0xe0ac('0xb')](0xcc)[_0xe0ac('0x16')]();});}};}function handleEntityNotFound(_0x23bc8b){return function(_0x5ad0ce){if(!_0x5ad0ce){_0x23bc8b[_0xe0ac('0x17')](0x194);}return _0x5ad0ce;};}function handleError(_0x47e3be,_0x2f0112){_0x2f0112=_0x2f0112||0x1f4;return function(_0x5ea3e9){logger['error'](_0x5ea3e9[_0xe0ac('0x18')]);if(_0x5ea3e9[_0xe0ac('0x19')]){delete _0x5ea3e9[_0xe0ac('0x19')];}_0x47e3be[_0xe0ac('0xb')](_0x2f0112)[_0xe0ac('0x1a')](_0x5ea3e9);};}exports['index']=function(_0x2f1d8d,_0x2a4375){var _0x2f1062={};var _0x4f2649={'count':0x0,'rows':[]};var _0x7f3329=_[_0xe0ac('0x1b')](db[_0xe0ac('0x1c')][_0xe0ac('0x1d')],function(_0x5ea905){return{'name':_0x5ea905[_0xe0ac('0x1e')],'type':_0x5ea905[_0xe0ac('0x1f')][_0xe0ac('0x20')]};});_0x2f1062=qs[_0xe0ac('0x21')](_0x7f3329,_0x2f1d8d);var _0x335050={'where':_0x2f1062[_0xe0ac('0x22')]};return db[_0xe0ac('0x1c')][_0xe0ac('0x10')](_0x335050)[_0xe0ac('0x12')](function(_0x260311){_0x4f2649[_0xe0ac('0x10')]=_0x260311;_0x2f1062['include']=qs[_0xe0ac('0x23')](_0x2f1d8d[_0xe0ac('0x24')]);return db[_0xe0ac('0x1c')][_0xe0ac('0x25')](_0x2f1062);})['then'](function(_0x4d96cf){_0x4f2649[_0xe0ac('0x26')]=_0x4d96cf;return _0x4f2649;})['then'](respondWithFilteredResult(_0x2a4375,_0x2f1062))[_0xe0ac('0x27')](handleError(_0x2a4375,null));};exports[_0xe0ac('0x28')]=function(_0xcc0068,_0x44e2c4){var _0x1e293f={'raw':!![],'where':{'id':_0xcc0068['params']['id']}},_0x29bd8d={};_0x29bd8d['model']=_[_0xe0ac('0x29')](db[_0xe0ac('0x1c')]['rawAttributes']);_0x29bd8d[_0xe0ac('0x24')]=_[_0xe0ac('0x29')](_0xcc0068[_0xe0ac('0x24')]);_0x29bd8d[_0xe0ac('0x2a')]=_[_0xe0ac('0x2b')](_0x29bd8d[_0xe0ac('0x2c')],_0x29bd8d[_0xe0ac('0x24')]);_0x1e293f[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x29bd8d[_0xe0ac('0x2c')],qs[_0xe0ac('0x2e')](_0xcc0068[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x1e293f['attributes']=_0x1e293f[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x1e293f[_0xe0ac('0x2d')]:_0x29bd8d['model'];if(_0xcc0068[_0xe0ac('0x24')]['includeAll']){_0x1e293f[_0xe0ac('0x23')]=[{'all':!![]}];}_0x1e293f=_[_0xe0ac('0x30')]({},_0x1e293f,_0xcc0068[_0xe0ac('0x31')]);return db[_0xe0ac('0x1c')][_0xe0ac('0x32')](_0x1e293f)[_0xe0ac('0x12')](handleEntityNotFound(_0x44e2c4,null))[_0xe0ac('0x12')](respondWithResult(_0x44e2c4,null))[_0xe0ac('0x27')](handleError(_0x44e2c4,null));};exports[_0xe0ac('0x33')]=function(_0x292c69,_0x56c995){return db[_0xe0ac('0x1c')][_0xe0ac('0x33')](_0x292c69[_0xe0ac('0x34')],{})[_0xe0ac('0x12')](function(_0x18d7c3){var _0x570895=_0x292c69[_0xe0ac('0x35')][_0xe0ac('0x14')]({'plain':!![]});if(!_0x570895)throw new Error(_0xe0ac('0x36'));if(_0x570895['role']===_0xe0ac('0x35')){var _0x50009e=_0x18d7c3[_0xe0ac('0x14')]({'plain':!![]});var _0x43d95f=_0xe0ac('0x37');return db[_0xe0ac('0x38')][_0xe0ac('0x32')]({'where':{'name':_0x43d95f,'userProfileId':_0x570895[_0xe0ac('0x39')]},'raw':!![]})[_0xe0ac('0x12')](function(_0x17cd39){if(_0x17cd39&&_0x17cd39[_0xe0ac('0x3a')]===0x0){return db['UserProfileResource']['create']({'name':_0x50009e['name'],'resourceId':_0x50009e['id'],'type':_0x17cd39[_0xe0ac('0x19')],'sectionId':_0x17cd39['id']},{})['then'](function(){return _0x18d7c3;});}else{return _0x18d7c3;}})[_0xe0ac('0x27')](function(_0x944be1){logger['error'](_0xe0ac('0x3b'),_0x944be1);throw _0x944be1;});}return _0x18d7c3;})[_0xe0ac('0x12')](respondWithResult(_0x56c995,0xc9))[_0xe0ac('0x27')](handleError(_0x56c995,null));};exports[_0xe0ac('0x3c')]=function(_0x292936,_0x3edc38){if(_0x292936[_0xe0ac('0x34')]['id']){delete _0x292936['body']['id'];}return db['MailQueue'][_0xe0ac('0x32')]({'where':{'id':_0x292936[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x3edc38,null))[_0xe0ac('0x12')](saveUpdates(_0x292936[_0xe0ac('0x34')],null))[_0xe0ac('0x12')](respondWithResult(_0x3edc38,null))[_0xe0ac('0x27')](handleError(_0x3edc38,null));};exports[_0xe0ac('0x13')]=function(_0x4ea59b,_0x5a3878){return db['MailQueue'][_0xe0ac('0x32')]({'where':{'id':_0x4ea59b[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x5a3878,null))['then'](removeEntity(_0x5a3878,null))[_0xe0ac('0x27')](handleError(_0x5a3878,null));};exports[_0xe0ac('0x3e')]=function(_0x106861,_0x30234f){return db[_0xe0ac('0x1c')][_0xe0ac('0x3e')]()[_0xe0ac('0x12')](respondWithResult(_0x30234f,null))[_0xe0ac('0x27')](handleError(_0x30234f,null));};exports[_0xe0ac('0x3f')]=function(_0x46054d,_0x46048d){var _0x396051={'raw':!![],'where':{}},_0x3a9122={},_0x5e3b0e;return db[_0xe0ac('0x1c')]['findOne']({'where':{'id':_0x46054d['params']['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x46048d,null))[_0xe0ac('0x12')](function(_0x2ea188){if(_0x2ea188){_0x5e3b0e=_0x2ea188[_0xe0ac('0x14')]({'plain':!![]});_0x3a9122[_0xe0ac('0x2c')]=_[_0xe0ac('0x29')](db['UserMailQueue'][_0xe0ac('0x1d')]);_0x3a9122[_0xe0ac('0x24')]=_[_0xe0ac('0x29')](_0x46054d[_0xe0ac('0x24')]);_0x3a9122['filters']=_['intersection'](_0x3a9122[_0xe0ac('0x2c')],_0x3a9122[_0xe0ac('0x24')]);_0x396051[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x3a9122['model'],qs[_0xe0ac('0x2e')](_0x46054d[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x396051[_0xe0ac('0x2d')]=_0x396051[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x396051[_0xe0ac('0x2d')]:_0x3a9122['model'];if(!_0x46054d[_0xe0ac('0x24')][_0xe0ac('0x40')](_0xe0ac('0x41'))){_0x396051[_0xe0ac('0xf')]=qs[_0xe0ac('0xf')](_0x46054d[_0xe0ac('0x24')][_0xe0ac('0xf')]);_0x396051[_0xe0ac('0xd')]=qs[_0xe0ac('0xd')](_0x46054d[_0xe0ac('0x24')][_0xe0ac('0xd')]);}_0x396051[_0xe0ac('0x42')]=qs[_0xe0ac('0x43')](_0x46054d['query']['sort']);_0x396051['where']=qs[_0xe0ac('0x2a')](_[_0xe0ac('0x44')](_0x46054d[_0xe0ac('0x24')],_0x3a9122['filters']));_0x396051[_0xe0ac('0x22')][_0xe0ac('0x45')]=_0x2ea188['id'];if(_0x46054d['query'][_0xe0ac('0x46')]){_0x396051['where']=_[_0xe0ac('0x30')](_0x396051[_0xe0ac('0x22')],{'$or':_[_0xe0ac('0x1b')](_0x396051[_0xe0ac('0x2d')],function(_0x11090c){var _0x54afe5={};_0x54afe5[_0x11090c]={'$like':'%'+_0x46054d[_0xe0ac('0x24')][_0xe0ac('0x46')]+'%'};return _0x54afe5;})});}_0x396051=_[_0xe0ac('0x30')]({},_0x396051,_0x46054d[_0xe0ac('0x31')]);return db['UserMailQueue'][_0xe0ac('0x25')](_0x396051);}})[_0xe0ac('0x12')](function(_0x14d1ca){if(_0x14d1ca){return db['User'][_0xe0ac('0x47')]({'where':{'id':_[_0xe0ac('0x1b')](_0x14d1ca,_0xe0ac('0x48')),'role':'agent'},'attributes':['id',_0xe0ac('0x19'),_0xe0ac('0x49'),_0xe0ac('0x4a'),_0xe0ac('0x4b')]});}})['then'](function(_0x21c796){if(_0x21c796){return{'count':_0x21c796[_0xe0ac('0x10')],'rows':_[_0xe0ac('0x1b')](_0x21c796['rows'],function(_0x361761){return{'membername':_0x361761[_0xe0ac('0x19')],'UserId':_0x361761['id'],'queue_name':_0x5e3b0e[_0xe0ac('0x19')],'MailQueueId':_0x5e3b0e['id'],'interface':util[_0xe0ac('0x4c')]('%s/%s',_0xe0ac('0x4d'),_0x361761[_0xe0ac('0x19')]),'penalty':0x0,'paused':_0x361761[_0xe0ac('0x49')],'createdAt':_0x361761['createdAt'],'updatedAt':_0x361761[_0xe0ac('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xe0ac('0x12')](respondWithFilteredResult(_0x46048d,_0x396051))[_0xe0ac('0x27')](handleError(_0x46048d,null));};exports[_0xe0ac('0x4e')]=function(_0x30c3e0,_0x5b21ad){var _0x6b4643={};var _0x57b7d5={};var _0x240714;var _0x3c6232;return db['MailQueue'][_0xe0ac('0x4f')]({'where':{'id':_0x30c3e0[_0xe0ac('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b21ad,null))['then'](function(_0x351866){if(_0x351866){_0x240714=_0x351866;_0x57b7d5['model']=_['keys'](db[_0xe0ac('0x50')]['rawAttributes']);_0x57b7d5[_0xe0ac('0x24')]=_['keys'](_0x30c3e0[_0xe0ac('0x24')]);_0x57b7d5[_0xe0ac('0x2a')]=_[_0xe0ac('0x2b')](_0x57b7d5['model'],_0x57b7d5[_0xe0ac('0x24')]);_0x6b4643[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x57b7d5[_0xe0ac('0x2c')],qs[_0xe0ac('0x2e')](_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x6b4643[_0xe0ac('0x2d')]=_0x6b4643[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x6b4643[_0xe0ac('0x2d')]:_0x57b7d5[_0xe0ac('0x2c')];_0x6b4643[_0xe0ac('0x42')]=qs['sort'](_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x43')]);_0x6b4643[_0xe0ac('0x22')]=qs[_0xe0ac('0x2a')](_['pick'](_0x30c3e0['query'],_0x57b7d5[_0xe0ac('0x2a')]));if(_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x46')]){_0x6b4643[_0xe0ac('0x22')]=_[_0xe0ac('0x30')](_0x6b4643['where'],{'$or':_['map'](_0x6b4643[_0xe0ac('0x2d')],function(_0x3486f5){var _0x5b61d0={};_0x5b61d0[_0x3486f5]={'$like':'%'+_0x30c3e0['query'][_0xe0ac('0x46')]+'%'};return _0x5b61d0;})});}_0x6b4643=_[_0xe0ac('0x30')]({},_0x6b4643,_0x30c3e0[_0xe0ac('0x31')]);return _0x240714[_0xe0ac('0x4e')](_0x6b4643);}})[_0xe0ac('0x12')](function(_0x4fbe80){if(_0x4fbe80){_0x3c6232=_0x4fbe80['length'];if(!_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0x40')](_0xe0ac('0x41'))){_0x6b4643[_0xe0ac('0xf')]=qs[_0xe0ac('0xf')](_0x30c3e0[_0xe0ac('0x24')][_0xe0ac('0xf')]);_0x6b4643['offset']=qs[_0xe0ac('0xd')](_0x30c3e0[_0xe0ac('0x24')]['offset']);}return _0x240714['getTeams'](_0x6b4643);}})[_0xe0ac('0x12')](function(_0x24b0ed){if(_0x24b0ed){return _0x24b0ed?{'count':_0x3c6232,'rows':_0x24b0ed}:null;}})['then'](respondWithResult(_0x5b21ad,null))[_0xe0ac('0x27')](handleError(_0x5b21ad,null));};exports[_0xe0ac('0x51')]=function(_0x27ffcb,_0x30e410){var _0x3eacd7=_0x27ffcb[_0xe0ac('0x34')][_0xe0ac('0x52')];return db['Team'][_0xe0ac('0x25')]({'where':{'id':_0x3eacd7},'attributes':['id'],'include':[{'model':db['User'],'as':_0xe0ac('0x53'),'attributes':['id',_0xe0ac('0x19'),'online',_0xe0ac('0x54'),_0xe0ac('0x55')],'raw':!![]}]})[_0xe0ac('0x12')](function(_0x33c4ae){if(_0x33c4ae){var _0x3764c2=_[_0xe0ac('0x56')](_0x33c4ae,function(_0x183fcf){var _0x27d9c8=_0x183fcf['get']({'plain':!![]});return _0x27d9c8['Agents'];});return db[_0xe0ac('0x1c')]['find']({'where':{'id':_0x27ffcb[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](function(_0x37cafc){return db['sequelize'][_0xe0ac('0x57')](function(_0x1e5434){return _0x37cafc['addTeams'](_0x3eacd7,{'transaction':_0x1e5434})['then'](function(){return BPromise[_0xe0ac('0x58')](_0x3764c2,function(_0x488f4f){return db['UserMailQueue'][_0xe0ac('0x59')]({'where':{'UserId':_0x488f4f['id'],'MailQueueId':_0x27ffcb[_0xe0ac('0x3d')]['id']},'transaction':_0x1e5434});});})[_0xe0ac('0x12')](function(){_0x3764c2[_0xe0ac('0x5a')](function(_0xfa985d){socket['emit']('userMailQueue:save',{'UserId':_0xfa985d['id'],'MailQueueId':_0x37cafc['id']});});});});});}})[_0xe0ac('0x12')](respondWithStatusCode(_0x30e410,null))[_0xe0ac('0x27')](handleError(_0x30e410,null));};exports[_0xe0ac('0x5b')]=function(_0x4cd52b,_0x2d5dda){return db['Team']['findAll']({'where':{'id':_0x4cd52b[_0xe0ac('0x24')][_0xe0ac('0x52')]},'attributes':['id'],'include':[{'model':db[_0xe0ac('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xe0ac('0x12')](handleEntityNotFound(_0x2d5dda,null))[_0xe0ac('0x12')](function(_0x2b9a37){var _0x4fbff1=_[_0xe0ac('0x1b')](_0x2b9a37,'id');var _0x549411=[];var _0x39bacd=[];var _0x324ef0=squel[_0xe0ac('0x5d')]();_0x324ef0[_0xe0ac('0x5e')]('tq.TeamId')['from'](_0xe0ac('0x5f'),'tq')[_0xe0ac('0x60')](_0xe0ac('0x61'),'ut',_0xe0ac('0x62'))['where'](_0xe0ac('0x63'),_0x4cd52b['params']['id']);for(var _0x452bd0=0x0;_0x452bd0<_0x2b9a37[_0xe0ac('0x2f')];_0x452bd0+=0x1){let _0x57b210=_0x2b9a37[_0x452bd0];for(var _0xce312d=0x0;_0xce312d<_0x57b210[_0xe0ac('0x53')][_0xe0ac('0x2f')];_0xce312d+=0x1){let _0x146a79=_0x57b210[_0xe0ac('0x53')][_0xce312d];var _0x5292f3=_0x324ef0['clone']();_0x5292f3[_0xe0ac('0x22')](_0xe0ac('0x64'),_0x146a79['id']);_0x39bacd[_0xe0ac('0x65')](db[_0xe0ac('0x66')]['query'](_0x5292f3[_0xe0ac('0x67')](),{'type':db[_0xe0ac('0x66')][_0xe0ac('0x68')][_0xe0ac('0x69')]})[_0xe0ac('0x12')](function(_0x44bcd5){if(_0x44bcd5[_0xe0ac('0x2f')]===0x1){return _0x146a79['id'];}else{var _0x215539=_[_0xe0ac('0x6a')](_['map'](_0x44bcd5,'TeamId'),function(_0x4e9b0a){return _[_0xe0ac('0x6b')](_0x4fbff1,_0x4e9b0a);});if(_0x215539){return _0x146a79['id'];}}}));}}return BPromise[_0xe0ac('0x6c')](_0x39bacd)[_0xe0ac('0x12')](function(_0x27f3b7){_0x549411=_(_0x549411)[_0xe0ac('0x6d')](_0x27f3b7)['compact']()['value']();return db[_0xe0ac('0x1c')][_0xe0ac('0x32')]({'where':{'id':_0x4cd52b[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](function(_0x4eabad){return db[_0xe0ac('0x66')][_0xe0ac('0x57')](function(_0x2f75ab){return _0x4eabad[_0xe0ac('0x5b')](_0x4cd52b[_0xe0ac('0x24')][_0xe0ac('0x52')],{'transaction':_0x2f75ab})['then'](function(){if(!_[_0xe0ac('0x6e')](_0x549411)){return _0x4eabad[_0xe0ac('0x6f')](_0x549411,{'transaction':_0x2f75ab});}})['then'](function(){_0x549411['forEach'](function(_0x7f4e51){socket['emit'](_0xe0ac('0x70'),{'UserId':_0x7f4e51,'MailQueueId':_0x4eabad['id']});});});});});});})['then'](respondWithStatusCode(_0x2d5dda,null))[_0xe0ac('0x27')](handleError(_0x2d5dda,null));};exports[_0xe0ac('0x71')]=function(_0x455a65,_0x4d2a2d){return db[_0xe0ac('0x1c')][_0xe0ac('0x32')]({'where':{'id':_0x455a65[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x4d2a2d,null))[_0xe0ac('0x12')](function(_0x233bfe){if(_0x233bfe){return _0x233bfe[_0xe0ac('0x71')](_0x455a65['body']['ids'],_[_0xe0ac('0x72')](_0x455a65['body'],[_0xe0ac('0x52'),'id'])||{})[_0xe0ac('0x73')](function(_0x2fc65e){for(var _0x821eec=0x0;_0x821eec<_0x455a65[_0xe0ac('0x34')][_0xe0ac('0x52')][_0xe0ac('0x2f')];_0x821eec+=0x1){socket[_0xe0ac('0x74')](_0xe0ac('0x75'),{'UserId':Number(_0x455a65[_0xe0ac('0x34')][_0xe0ac('0x52')][_0x821eec]),'MailQueueId':Number(_0x455a65[_0xe0ac('0x3d')]['id'])});}return _0x2fc65e;});}})['then'](respondWithResult(_0x4d2a2d,null))[_0xe0ac('0x27')](handleError(_0x4d2a2d,null));};exports[_0xe0ac('0x6f')]=function(_0x4f24b1,_0x9006ad){return db['MailQueue'][_0xe0ac('0x32')]({'where':{'id':_0x4f24b1[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x9006ad,null))[_0xe0ac('0x12')](function(_0x588889){if(_0x588889){return _0x588889[_0xe0ac('0x6f')](_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')])[_0xe0ac('0x12')](function(){if(_[_0xe0ac('0x76')](_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')])){for(var _0x2eb748=0x0;_0x2eb748<_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')][_0xe0ac('0x2f')];_0x2eb748+=0x1){socket['emit'](_0xe0ac('0x70'),{'UserId':Number(_0x4f24b1[_0xe0ac('0x24')][_0xe0ac('0x52')][_0x2eb748]),'MailQueueId':Number(_0x4f24b1[_0xe0ac('0x3d')]['id'])});}}else{socket['emit'](_0xe0ac('0x70'),{'UserId':Number(_0x4f24b1['query']['ids']),'MailQueueId':Number(_0x4f24b1[_0xe0ac('0x3d')]['id'])});}});}})[_0xe0ac('0x12')](respondWithStatusCode(_0x9006ad,null))['catch'](handleError(_0x9006ad,null));};exports[_0xe0ac('0x77')]=function(_0x5ed9d6,_0x2d763f){var _0x2db91d={};var _0x42ae6d={};var _0x3dd251;var _0x5f7d4f;return db['MailQueue'][_0xe0ac('0x4f')]({'where':{'id':_0x5ed9d6[_0xe0ac('0x3d')]['id']}})[_0xe0ac('0x12')](handleEntityNotFound(_0x2d763f,null))[_0xe0ac('0x12')](function(_0x447702){if(_0x447702){_0x3dd251=_0x447702;_0x42ae6d[_0xe0ac('0x2c')]=_['keys'](db[_0xe0ac('0x5c')][_0xe0ac('0x1d')]);_0x42ae6d['query']=_[_0xe0ac('0x29')](_0x5ed9d6[_0xe0ac('0x24')]);_0x42ae6d['filters']=_[_0xe0ac('0x2b')](_0x42ae6d['model'],_0x42ae6d[_0xe0ac('0x24')]);_0x2db91d[_0xe0ac('0x2d')]=_[_0xe0ac('0x2b')](_0x42ae6d[_0xe0ac('0x2c')],qs[_0xe0ac('0x2e')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0x2e')]));_0x2db91d[_0xe0ac('0x2d')]=_0x2db91d[_0xe0ac('0x2d')][_0xe0ac('0x2f')]?_0x2db91d[_0xe0ac('0x2d')]:_0x42ae6d['model'];_0x2db91d[_0xe0ac('0x42')]=qs[_0xe0ac('0x43')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0x43')]);_0x2db91d['where']=qs[_0xe0ac('0x2a')](_[_0xe0ac('0x44')](_0x5ed9d6[_0xe0ac('0x24')],_0x42ae6d[_0xe0ac('0x2a')]));if(_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0x46')]){_0x2db91d[_0xe0ac('0x22')]=_[_0xe0ac('0x30')](_0x2db91d[_0xe0ac('0x22')],{'$or':_[_0xe0ac('0x1b')](_0x2db91d['attributes'],function(_0x16c280){var _0xbfba5={};_0xbfba5[_0x16c280]={'$like':'%'+_0x5ed9d6['query'][_0xe0ac('0x46')]+'%'};return _0xbfba5;})});}_0x2db91d=_['merge']({},_0x2db91d,_0x5ed9d6['options']);return _0x3dd251[_0xe0ac('0x77')](_0x2db91d);}})[_0xe0ac('0x12')](function(_0x25972a){if(_0x25972a){_0x5f7d4f=_0x25972a['length'];if(!_0x5ed9d6[_0xe0ac('0x24')]['hasOwnProperty'](_0xe0ac('0x41'))){_0x2db91d[_0xe0ac('0xf')]=qs[_0xe0ac('0xf')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0xf')]);_0x2db91d[_0xe0ac('0xd')]=qs[_0xe0ac('0xd')](_0x5ed9d6[_0xe0ac('0x24')][_0xe0ac('0xd')]);}return _0x3dd251[_0xe0ac('0x77')](_0x2db91d);}})[_0xe0ac('0x12')](function(_0x2f56eb){if(_0x2f56eb){return _0x2f56eb?{'count':_0x5f7d4f,'rows':_0x2f56eb}:null;}})[_0xe0ac('0x12')](respondWithResult(_0x2d763f,null))[_0xe0ac('0x27')](handleError(_0x2d763f,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index ffdfb6e..7736620 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 _0x1c13=['MailQueue','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x1c13,0x1c9));var _0x31c1=function(_0x34da88,_0x5f2281){_0x34da88=_0x34da88-0x0;var _0x1fe876=_0x1c13[_0x34da88];return _0x1fe876;};'use strict';var EventEmitter=require(_0x31c1('0x0'));var MailQueue=require(_0x31c1('0x1'))['db'][_0x31c1('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x31c1('0x3'),'afterUpdate':_0x31c1('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d5d53){return function(_0x231fa1,_0x18f6a4,_0x3b7013){MailQueueEvents[_0x31c1('0x5')](_0x3d5d53+':'+_0x231fa1['id'],_0x231fa1);MailQueueEvents[_0x31c1('0x5')](_0x3d5d53,_0x231fa1);_0x3b7013(null);};}for(var e in events){if(events[_0x31c1('0x6')](e)){var event=events[e];MailQueue[_0x31c1('0x7')](e,emitEvent(event));}}module[_0x31c1('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xd78f=['save','remove','emit','hook','exports','../../mysqldb','MailQueue','setMaxListeners'];(function(_0x573e08,_0x185b22){var _0x1730bb=function(_0x34b0cc){while(--_0x34b0cc){_0x573e08['push'](_0x573e08['shift']());}};_0x1730bb(++_0x185b22);}(_0xd78f,0x1ad));var _0xfd78=function(_0x20668b,_0x2b7c6f){_0x20668b=_0x20668b-0x0;var _0x3e9a1c=_0xd78f[_0x20668b];return _0x3e9a1c;};'use strict';var EventEmitter=require('events');var MailQueue=require(_0xfd78('0x0'))['db'][_0xfd78('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0xfd78('0x2')](0x0);var events={'afterCreate':_0xfd78('0x3'),'afterUpdate':'update','afterDestroy':_0xfd78('0x4')};function emitEvent(_0x358120){return function(_0x103943,_0x3621aa,_0x218005){MailQueueEvents[_0xfd78('0x5')](_0x358120+':'+_0x103943['id'],_0x103943);MailQueueEvents[_0xfd78('0x5')](_0x358120,_0x103943);_0x218005(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0xfd78('0x6')](e,emitEvent(event));}}module[_0xfd78('0x7')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index c866d38..4138bc8 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 _0x9115=['path','../../config/environment','exports','define','mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x9115,0x1c1));var _0x5911=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x9115[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x5911('0x0'));var util=require(_0x5911('0x1'));var logger=require(_0x5911('0x2'))(_0x5911('0x3'));var moment=require(_0x5911('0x4'));var BPromise=require(_0x5911('0x5'));var rp=require(_0x5911('0x6'));var fs=require('fs');var path=require(_0x5911('0x7'));var rimraf=require('rimraf');var config=require(_0x5911('0x8'));var attributes=require('./mailQueue.attributes');module[_0x5911('0x9')]=function(_0x221d02,_0x19f782){return _0x221d02[_0x5911('0xa')]('MailQueue',attributes,{'tableName':_0x5911('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71fa=['../../config/environment','./mailQueue.attributes','exports','define','MailQueue','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x2460e9,_0x1a481b){var _0x598bfc=function(_0x1fb944){while(--_0x1fb944){_0x2460e9['push'](_0x2460e9['shift']());}};_0x598bfc(++_0x1a481b);}(_0x71fa,0x17b));var _0xa71f=function(_0x3ab70f,_0x198fdc){_0x3ab70f=_0x3ab70f-0x0;var _0x5ef3b3=_0x71fa[_0x3ab70f];return _0x5ef3b3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa71f('0x0'))(_0xa71f('0x1'));var moment=require('moment');var BPromise=require(_0xa71f('0x2'));var rp=require(_0xa71f('0x3'));var fs=require('fs');var path=require(_0xa71f('0x4'));var rimraf=require(_0xa71f('0x5'));var config=require(_0xa71f('0x6'));var attributes=require(_0xa71f('0x7'));module[_0xa71f('0x8')]=function(_0x23189d,_0x1e0765){return _0x23189d[_0xa71f('0x9')](_0xa71f('0xa'),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 55e4b23..1b2fcbe 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 _0x1202=['model','GetMailQueue','debug','catch','ShowMailQueue','MailQueue','find','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','findAll','options','raw','where','attributes','limit','include','map'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x1202,0x11c));var _0x2120=function(_0x15a6c2,_0x1553f8){_0x15a6c2=_0x15a6c2-0x0;var _0x35fadc=_0x1202[_0x15a6c2];return _0x35fadc;};'use strict';var _=require(_0x2120('0x0'));var util=require(_0x2120('0x1'));var moment=require(_0x2120('0x2'));var BPromise=require(_0x2120('0x3'));var rs=require(_0x2120('0x4'));var fs=require('fs');var Redis=require(_0x2120('0x5'));var db=require(_0x2120('0x6'))['db'];var utils=require(_0x2120('0x7'));var logger=require(_0x2120('0x8'))(_0x2120('0x9'));var config=require(_0x2120('0xa'));var jayson=require(_0x2120('0xb'));var client=jayson[_0x2120('0xc')][_0x2120('0xd')]({'port':0x232a});config[_0x2120('0xe')]=_[_0x2120('0xf')](config[_0x2120('0xe')],{'host':_0x2120('0x10'),'port':0x18eb});var socket=require(_0x2120('0x11'))(new Redis(config['redis']));require(_0x2120('0x12'))[_0x2120('0x13')](socket);function respondWithRpcPromise(_0x333c54,_0x204fbd,_0x31986f){return new BPromise(function(_0x5c89f5,_0x43c3d0){return client[_0x2120('0x14')](_0x333c54,_0x31986f)[_0x2120('0x15')](function(_0x3cd502){logger[_0x2120('0x16')](_0x2120('0x17'),_0x204fbd,'request\x20sent');logger['debug'](_0x2120('0x18'),_0x204fbd,_0x2120('0x19'),JSON['stringify'](_0x3cd502));if(_0x3cd502[_0x2120('0x1a')]){if(_0x3cd502[_0x2120('0x1a')][_0x2120('0x1b')]===0x1f4){logger['error']('MailQueue,\x20%s,\x20%s',_0x204fbd,_0x3cd502[_0x2120('0x1a')]['message']);return _0x43c3d0(_0x3cd502[_0x2120('0x1a')][_0x2120('0x1c')]);}logger[_0x2120('0x1a')](_0x2120('0x17'),_0x204fbd,_0x3cd502['error'][_0x2120('0x1c')]);return _0x5c89f5(_0x3cd502[_0x2120('0x1a')][_0x2120('0x1c')]);}else{logger[_0x2120('0x16')](_0x2120('0x17'),_0x204fbd,_0x2120('0x19'));_0x5c89f5(_0x3cd502[_0x2120('0x1d')][_0x2120('0x1c')]);}})['catch'](function(_0x11d93b){logger[_0x2120('0x1a')](_0x2120('0x17'),_0x204fbd,_0x11d93b);_0x43c3d0(_0x11d93b);});});}exports['GetMailQueue']=function(_0x1b8d86){var _0x40eadc=this;return new Promise(function(_0x562734,_0x15bab7){return db['MailQueue'][_0x2120('0x1e')]({'raw':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x20')]===undefined?!![]:![]:!![],'where':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x21')]||null:null,'attributes':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x22')]||null:null,'limit':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86[_0x2120('0x1f')][_0x2120('0x23')]||null:null,'include':_0x1b8d86[_0x2120('0x1f')]?_0x1b8d86['options'][_0x2120('0x24')]?_[_0x2120('0x25')](_0x1b8d86[_0x2120('0x1f')][_0x2120('0x24')],function(_0x38a90a){return{'model':db[_0x38a90a[_0x2120('0x26')]],'as':_0x38a90a['as'],'attributes':_0x38a90a['attributes'],'include':_0x38a90a['include']?_[_0x2120('0x25')](_0x38a90a[_0x2120('0x24')],function(_0x4d3c1c){return{'model':db[_0x4d3c1c['model']],'as':_0x4d3c1c['as'],'attributes':_0x4d3c1c[_0x2120('0x22')],'include':_0x4d3c1c[_0x2120('0x24')]?_[_0x2120('0x25')](_0x4d3c1c[_0x2120('0x24')],function(_0x2d4a58){return{'model':db[_0x2d4a58[_0x2120('0x26')]],'as':_0x2d4a58['as'],'attributes':_0x2d4a58['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x36657b){logger['info'](_0x2120('0x27'),_0x1b8d86);logger[_0x2120('0x28')](_0x2120('0x27'),_0x1b8d86,JSON['stringify'](_0x36657b));_0x562734(_0x36657b);})[_0x2120('0x29')](function(_0x17efa8){logger[_0x2120('0x1a')](_0x2120('0x27'),_0x17efa8['message'],_0x1b8d86);_0x15bab7(_0x40eadc[_0x2120('0x1a')](0x1f4,_0x17efa8[_0x2120('0x1c')]));});});};exports[_0x2120('0x2a')]=function(_0x1a9761){var _0x3f83f1=this;return new Promise(function(_0x2a7e47,_0x306021){return db[_0x2120('0x2b')][_0x2120('0x2c')]({'raw':_0x1a9761[_0x2120('0x1f')]?_0x1a9761[_0x2120('0x1f')][_0x2120('0x20')]===undefined?!![]:![]:!![],'where':_0x1a9761[_0x2120('0x1f')]?_0x1a9761[_0x2120('0x1f')][_0x2120('0x21')]||null:null,'attributes':_0x1a9761[_0x2120('0x1f')]?_0x1a9761[_0x2120('0x1f')][_0x2120('0x22')]||null:null,'include':_0x1a9761['options']?_0x1a9761[_0x2120('0x1f')][_0x2120('0x24')]?_[_0x2120('0x25')](_0x1a9761['options'][_0x2120('0x24')],function(_0x5a7674){return{'model':db[_0x5a7674[_0x2120('0x26')]],'as':_0x5a7674['as'],'attributes':_0x5a7674[_0x2120('0x22')],'include':_0x5a7674[_0x2120('0x24')]?_[_0x2120('0x25')](_0x5a7674['include'],function(_0x33edeb){return{'model':db[_0x33edeb[_0x2120('0x26')]],'as':_0x33edeb['as'],'attributes':_0x33edeb['attributes'],'include':_0x33edeb[_0x2120('0x24')]?_['map'](_0x33edeb['include'],function(_0x1e244c){return{'model':db[_0x1e244c[_0x2120('0x26')]],'as':_0x1e244c['as'],'attributes':_0x1e244c[_0x2120('0x22')]};}):[]};}):[]};}):[]:[]})[_0x2120('0x15')](function(_0x52d1aa){logger[_0x2120('0x16')](_0x2120('0x2a'),_0x1a9761);logger['debug']('ShowMailQueue',_0x1a9761,JSON[_0x2120('0x2d')](_0x52d1aa));_0x2a7e47(_0x52d1aa);})[_0x2120('0x29')](function(_0x34fe62){logger[_0x2120('0x1a')](_0x2120('0x2a'),_0x34fe62[_0x2120('0x1c')],_0x1a9761);_0x306021(_0x3f83f1[_0x2120('0x1a')](0x1f4,_0x34fe62['message']));});});}; \ No newline at end of file +var _0x4bab=['limit','map','include','model','ShowMailQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','./mailQueue.socket','request','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes'];(function(_0x53c7a7,_0x2923bd){var _0x1016df=function(_0x3267fa){while(--_0x3267fa){_0x53c7a7['push'](_0x53c7a7['shift']());}};_0x1016df(++_0x2923bd);}(_0x4bab,0x1d4));var _0xb4ba=function(_0x5922d0,_0x419c85){_0x5922d0=_0x5922d0-0x0;var _0x5fbf0f=_0x4bab[_0x5922d0];return _0x5fbf0f;};'use strict';var _=require(_0xb4ba('0x0'));var util=require(_0xb4ba('0x1'));var moment=require(_0xb4ba('0x2'));var BPromise=require(_0xb4ba('0x3'));var rs=require(_0xb4ba('0x4'));var fs=require('fs');var Redis=require(_0xb4ba('0x5'));var db=require(_0xb4ba('0x6'))['db'];var utils=require(_0xb4ba('0x7'));var logger=require(_0xb4ba('0x8'))('rpc');var config=require(_0xb4ba('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xb4ba('0xa')][_0xb4ba('0xb')]({'port':0x232a});config[_0xb4ba('0xc')]=_[_0xb4ba('0xd')](config[_0xb4ba('0xc')],{'host':_0xb4ba('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb4ba('0xc')]));require(_0xb4ba('0xf'))['register'](socket);function respondWithRpcPromise(_0x15fd1c,_0x1ae584,_0x5e3874){return new BPromise(function(_0x3d3e8e,_0x4528f9){return client[_0xb4ba('0x10')](_0x15fd1c,_0x5e3874)[_0xb4ba('0x11')](function(_0x1671ae){logger['info']('MailQueue,\x20%s,\x20%s',_0x1ae584,_0xb4ba('0x12'));logger[_0xb4ba('0x13')](_0xb4ba('0x14'),_0x1ae584,_0xb4ba('0x12'),JSON[_0xb4ba('0x15')](_0x1671ae));if(_0x1671ae[_0xb4ba('0x16')]){if(_0x1671ae[_0xb4ba('0x16')][_0xb4ba('0x17')]===0x1f4){logger[_0xb4ba('0x16')](_0xb4ba('0x18'),_0x1ae584,_0x1671ae[_0xb4ba('0x16')]['message']);return _0x4528f9(_0x1671ae[_0xb4ba('0x16')][_0xb4ba('0x19')]);}logger[_0xb4ba('0x16')](_0xb4ba('0x18'),_0x1ae584,_0x1671ae[_0xb4ba('0x16')]['message']);return _0x3d3e8e(_0x1671ae['error'][_0xb4ba('0x19')]);}else{logger[_0xb4ba('0x1a')](_0xb4ba('0x18'),_0x1ae584,'request\x20sent');_0x3d3e8e(_0x1671ae[_0xb4ba('0x1b')][_0xb4ba('0x19')]);}})[_0xb4ba('0x1c')](function(_0x16ec34){logger['error'](_0xb4ba('0x18'),_0x1ae584,_0x16ec34);_0x4528f9(_0x16ec34);});});}exports[_0xb4ba('0x1d')]=function(_0x2785af){var _0x27a791=this;return new Promise(function(_0x379213,_0x5a17f9){return db[_0xb4ba('0x1e')][_0xb4ba('0x1f')]({'raw':_0x2785af['options']?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x21')]===undefined?!![]:![]:!![],'where':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x22')]||null:null,'attributes':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x23')]||null:null,'limit':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x24')]||null:null,'include':_0x2785af[_0xb4ba('0x20')]?_0x2785af[_0xb4ba('0x20')]['include']?_[_0xb4ba('0x25')](_0x2785af[_0xb4ba('0x20')][_0xb4ba('0x26')],function(_0x294b85){return{'model':db[_0x294b85[_0xb4ba('0x27')]],'as':_0x294b85['as'],'attributes':_0x294b85[_0xb4ba('0x23')],'include':_0x294b85['include']?_[_0xb4ba('0x25')](_0x294b85[_0xb4ba('0x26')],function(_0x1de550){return{'model':db[_0x1de550[_0xb4ba('0x27')]],'as':_0x1de550['as'],'attributes':_0x1de550[_0xb4ba('0x23')],'include':_0x1de550[_0xb4ba('0x26')]?_[_0xb4ba('0x25')](_0x1de550['include'],function(_0x4ecb53){return{'model':db[_0x4ecb53[_0xb4ba('0x27')]],'as':_0x4ecb53['as'],'attributes':_0x4ecb53[_0xb4ba('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4866d8){logger[_0xb4ba('0x1a')](_0xb4ba('0x1d'),_0x2785af);logger[_0xb4ba('0x13')](_0xb4ba('0x1d'),_0x2785af,JSON[_0xb4ba('0x15')](_0x4866d8));_0x379213(_0x4866d8);})['catch'](function(_0x2a3e5b){logger[_0xb4ba('0x16')]('GetMailQueue',_0x2a3e5b[_0xb4ba('0x19')],_0x2785af);_0x5a17f9(_0x27a791['error'](0x1f4,_0x2a3e5b[_0xb4ba('0x19')]));});});};exports[_0xb4ba('0x28')]=function(_0x3a8027){var _0x5bfc81=this;return new Promise(function(_0x5abcb0,_0x1420a0){return db[_0xb4ba('0x1e')][_0xb4ba('0x29')]({'raw':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027[_0xb4ba('0x20')][_0xb4ba('0x21')]===undefined?!![]:![]:!![],'where':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027[_0xb4ba('0x20')][_0xb4ba('0x22')]||null:null,'attributes':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027[_0xb4ba('0x20')]['attributes']||null:null,'include':_0x3a8027[_0xb4ba('0x20')]?_0x3a8027['options']['include']?_['map'](_0x3a8027[_0xb4ba('0x20')]['include'],function(_0x3d9db3){return{'model':db[_0x3d9db3['model']],'as':_0x3d9db3['as'],'attributes':_0x3d9db3[_0xb4ba('0x23')],'include':_0x3d9db3[_0xb4ba('0x26')]?_[_0xb4ba('0x25')](_0x3d9db3[_0xb4ba('0x26')],function(_0x27321f){return{'model':db[_0x27321f[_0xb4ba('0x27')]],'as':_0x27321f['as'],'attributes':_0x27321f[_0xb4ba('0x23')],'include':_0x27321f[_0xb4ba('0x26')]?_[_0xb4ba('0x25')](_0x27321f[_0xb4ba('0x26')],function(_0x26558c){return{'model':db[_0x26558c[_0xb4ba('0x27')]],'as':_0x26558c['as'],'attributes':_0x26558c[_0xb4ba('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb4ba('0x11')](function(_0x36bab1){logger[_0xb4ba('0x1a')](_0xb4ba('0x28'),_0x3a8027);logger[_0xb4ba('0x13')](_0xb4ba('0x28'),_0x3a8027,JSON[_0xb4ba('0x15')](_0x36bab1));_0x5abcb0(_0x36bab1);})[_0xb4ba('0x1c')](function(_0x269eee){logger[_0xb4ba('0x16')](_0xb4ba('0x28'),_0x269eee[_0xb4ba('0x19')],_0x3a8027);_0x1420a0(_0x5bfc81['error'](0x1f4,_0x269eee[_0xb4ba('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index d396a1e..7cf341f 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 _0x1ad2=['register','length','mailQueue:','./mailQueue.events','save','remove','emit','removeListener'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0x1ad2,0x19b));var _0x21ad=function(_0x1e89c1,_0x3ef6e1){_0x1e89c1=_0x1e89c1-0x0;var _0xffbc2=_0x1ad2[_0x1e89c1];return _0xffbc2;};'use strict';var MailQueueEvents=require(_0x21ad('0x0'));var events=[_0x21ad('0x1'),_0x21ad('0x2'),'update'];function createListener(_0x5aa815,_0x4b5ebe){return function(_0x5a166a){_0x4b5ebe[_0x21ad('0x3')](_0x5aa815,_0x5a166a);};}function removeListener(_0x3fd6e6,_0xd26d0e){return function(){MailQueueEvents[_0x21ad('0x4')](_0x3fd6e6,_0xd26d0e);};}exports[_0x21ad('0x5')]=function(_0x3816a9){for(var _0x5a70f5=0x0,_0x375aec=events[_0x21ad('0x6')];_0x5a70f5<_0x375aec;_0x5a70f5++){var _0x3aca19=events[_0x5a70f5];var _0x4bba32=createListener(_0x21ad('0x7')+_0x3aca19,_0x3816a9);MailQueueEvents['on'](_0x3aca19,_0x4bba32);}}; \ No newline at end of file +var _0xe9ee=['length','mailQueue:','./mailQueue.events','save','remove','update','emit','removeListener','register'];(function(_0x3bb12c,_0xb8b0ea){var _0x306928=function(_0x414a15){while(--_0x414a15){_0x3bb12c['push'](_0x3bb12c['shift']());}};_0x306928(++_0xb8b0ea);}(_0xe9ee,0x1e8));var _0xee9e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe9ee[_0x3dd15e];return _0x231fd0;};'use strict';var MailQueueEvents=require(_0xee9e('0x0'));var events=[_0xee9e('0x1'),_0xee9e('0x2'),_0xee9e('0x3')];function createListener(_0x1385ea,_0x530785){return function(_0x530190){_0x530785[_0xee9e('0x4')](_0x1385ea,_0x530190);};}function removeListener(_0xf9edb7,_0x989bd4){return function(){MailQueueEvents[_0xee9e('0x5')](_0xf9edb7,_0x989bd4);};}exports[_0xee9e('0x6')]=function(_0x33fc84){for(var _0x4820c5=0x0,_0x3c6837=events[_0xee9e('0x7')];_0x4820c5<_0x3c6837;_0x4820c5++){var _0x54ac3d=events[_0x4820c5];var _0x2718e9=createListener(_0xee9e('0x8')+_0x54ac3d,_0x33fc84);MailQueueEvents['on'](_0x54ac3d,_0x2718e9);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 17d0a88..6b0fb3c 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 _0xa6d2=['create','put','update','destroy','exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x163c25,_0x1952a6){var _0x2cf45f=function(_0x58e936){while(--_0x58e936){_0x163c25['push'](_0x163c25['shift']());}};_0x2cf45f(++_0x1952a6);}(_0xa6d2,0x131));var _0x2a6d=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xa6d2[_0x502c7d];return _0x30b7ed;};'use strict';var multer=require(_0x2a6d('0x0'));var util=require('util');var path=require(_0x2a6d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x2a6d('0x2'));var auth=require(_0x2a6d('0x3'));var interaction=require(_0x2a6d('0x4'));var config=require(_0x2a6d('0x5'));var controller=require(_0x2a6d('0x6'));router[_0x2a6d('0x7')]('/',auth[_0x2a6d('0x8')](),controller[_0x2a6d('0x9')]);router[_0x2a6d('0x7')](_0x2a6d('0xa'),auth[_0x2a6d('0x8')](),controller[_0x2a6d('0xb')]);router[_0x2a6d('0x7')](_0x2a6d('0xc'),auth[_0x2a6d('0x8')](),controller[_0x2a6d('0xd')]);router[_0x2a6d('0xe')]('/',auth[_0x2a6d('0x8')](),controller[_0x2a6d('0xf')]);router[_0x2a6d('0x10')]('/:id',auth[_0x2a6d('0x8')](),controller[_0x2a6d('0x11')]);router['delete'](_0x2a6d('0xc'),auth[_0x2a6d('0x8')](),controller[_0x2a6d('0x12')]);module[_0x2a6d('0x13')]=router; \ No newline at end of file +var _0xf620=['delete','destroy','exports','express','Router','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','get','isAuthenticated','describe','/:id','post','create','put'];(function(_0x16a132,_0x46022a){var _0x291c01=function(_0x424c67){while(--_0x424c67){_0x16a132['push'](_0x16a132['shift']());}};_0x291c01(++_0x46022a);}(_0xf620,0x16b));var _0x0f62=function(_0x16fa90,_0xce4a45){_0x16fa90=_0x16fa90-0x0;var _0x4a3050=_0xf620[_0x16fa90];return _0x4a3050;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0f62('0x0'));var router=express[_0x0f62('0x1')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0f62('0x2'));var config=require(_0x0f62('0x3'));var controller=require(_0x0f62('0x4'));router[_0x0f62('0x5')]('/',auth[_0x0f62('0x6')](),controller['index']);router[_0x0f62('0x5')]('/describe',auth[_0x0f62('0x6')](),controller[_0x0f62('0x7')]);router[_0x0f62('0x5')](_0x0f62('0x8'),auth[_0x0f62('0x6')](),controller['show']);router[_0x0f62('0x9')]('/',auth['isAuthenticated'](),controller[_0x0f62('0xa')]);router[_0x0f62('0xb')](_0x0f62('0x8'),auth[_0x0f62('0x6')](),controller['update']);router[_0x0f62('0xc')]('/:id',auth[_0x0f62('0x6')](),controller[_0x0f62('0xd')]);module[_0x0f62('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9487a15..530b5da 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 _0xf2a5=['sequelize','exports','DATE','STRING'];(function(_0x1d6a26,_0x1de4f2){var _0x27527c=function(_0x7ab7c6){while(--_0x7ab7c6){_0x1d6a26['push'](_0x1d6a26['shift']());}};_0x27527c(++_0x1de4f2);}(_0xf2a5,0xc8));var _0x5f2a=function(_0x906657,_0x415967){_0x906657=_0x906657-0x0;var _0x28535e=_0xf2a5[_0x906657];return _0x28535e;};'use strict';var moment=require('moment');var Sequelize=require(_0x5f2a('0x0'));module[_0x5f2a('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x5f2a('0x2')]},'exitAt':{'type':Sequelize[_0x5f2a('0x2')]},'reason':{'type':Sequelize[_0x5f2a('0x3')]}}; \ No newline at end of file +var _0x41ed=['STRING','DATE','moment','exports'];(function(_0x656c05,_0x1d4b18){var _0x28475a=function(_0x21ef6a){while(--_0x21ef6a){_0x656c05['push'](_0x656c05['shift']());}};_0x28475a(++_0x1d4b18);}(_0x41ed,0xa6));var _0xd41e=function(_0x20f191,_0x43ab4b){_0x20f191=_0x20f191-0x0;var _0x3f5153=_0x41ed[_0x20f191];return _0x3f5153;};'use strict';var moment=require(_0xd41e('0x0'));var Sequelize=require('sequelize');module[_0xd41e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xd41e('0x2')]},'joinAt':{'type':Sequelize[_0xd41e('0x3')]},'leaveAt':{'type':Sequelize[_0xd41e('0x3')]},'acceptAt':{'type':Sequelize[_0xd41e('0x3')]},'exitAt':{'type':Sequelize[_0xd41e('0x3')]},'reason':{'type':Sequelize[_0xd41e('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 6ab7c7f..547ee74 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 _0x7bd0=['model','name','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','MailQueueReport','findAll','rows','show','keys','length','includeAll','find','catch','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x24f0b0,_0x4c9360){var _0x30a697=function(_0x1e1f24){while(--_0x1e1f24){_0x24f0b0['push'](_0x24f0b0['shift']());}};_0x30a697(++_0x4c9360);}(_0x7bd0,0x111));var _0x07bd=function(_0x20cf8a,_0x44cd6b){_0x20cf8a=_0x20cf8a-0x0;var _0x54e165=_0x7bd0[_0x20cf8a];return _0x54e165;};'use strict';var emlformat=require(_0x07bd('0x0'));var rimraf=require(_0x07bd('0x1'));var zipdir=require(_0x07bd('0x2'));var jsonpatch=require(_0x07bd('0x3'));var rp=require(_0x07bd('0x4'));var moment=require(_0x07bd('0x5'));var BPromise=require(_0x07bd('0x6'));var Mustache=require(_0x07bd('0x7'));var util=require('util');var path=require(_0x07bd('0x8'));var sox=require(_0x07bd('0x9'));var csv=require(_0x07bd('0xa'));var ejs=require(_0x07bd('0xb'));var fs=require('fs');var fs_extra=require(_0x07bd('0xc'));var _=require(_0x07bd('0xd'));var squel=require(_0x07bd('0xe'));var crypto=require('crypto');var jsforce=require(_0x07bd('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x07bd('0xa'));var querystring=require(_0x07bd('0x10'));var Papa=require(_0x07bd('0x11'));var Redis=require('ioredis');var authService=require(_0x07bd('0x12'));var qs=require(_0x07bd('0x13'));var as=require(_0x07bd('0x14'));var hardwareService=require(_0x07bd('0x15'));var logger=require('../../config/logger')(_0x07bd('0x16'));var utils=require(_0x07bd('0x17'));var config=require(_0x07bd('0x18'));var licenseUtil=require(_0x07bd('0x19'));var db=require(_0x07bd('0x1a'))['db'];function respondWithStatusCode(_0x1eff6c,_0x10aa2e){_0x10aa2e=_0x10aa2e||0xcc;return function(_0x2b8409){if(_0x2b8409){return _0x1eff6c['sendStatus'](_0x10aa2e);}return _0x1eff6c['status'](_0x10aa2e)[_0x07bd('0x1b')]();};}function respondWithResult(_0x3fe523,_0x1c59c2){_0x1c59c2=_0x1c59c2||0xc8;return function(_0x247f3f){if(_0x247f3f){return _0x3fe523[_0x07bd('0x1c')](_0x1c59c2)[_0x07bd('0x1d')](_0x247f3f);}};}function respondWithFilteredResult(_0x2c9166,_0x49d962){return function(_0x418444){if(_0x418444){var _0x505839=typeof _0x49d962[_0x07bd('0x1e')]===_0x07bd('0x1f')&&typeof _0x49d962[_0x07bd('0x20')]===_0x07bd('0x1f');var _0x8aa645=_0x418444['count'];var _0x3f9f0b=_0x505839?0x0:_0x49d962[_0x07bd('0x1e')];var _0x4948f4=_0x505839?_0x418444[_0x07bd('0x21')]:_0x49d962[_0x07bd('0x1e')]+_0x49d962[_0x07bd('0x20')];var _0x2fcc59;if(_0x4948f4>=_0x8aa645){_0x4948f4=_0x8aa645;_0x2fcc59=0xc8;}else{_0x2fcc59=0xce;}_0x2c9166[_0x07bd('0x1c')](_0x2fcc59);return _0x2c9166[_0x07bd('0x22')](_0x07bd('0x23'),_0x3f9f0b+'-'+_0x4948f4+'/'+_0x8aa645)[_0x07bd('0x1d')](_0x418444);}return null;};}function patchUpdates(_0x29a52e){return function(_0x50109f){try{jsonpatch[_0x07bd('0x24')](_0x50109f,_0x29a52e,!![]);}catch(_0x227807){return BPromise[_0x07bd('0x25')](_0x227807);}return _0x50109f[_0x07bd('0x26')]();};}function saveUpdates(_0x16d0e6,_0x47bd50){return function(_0x4c673a){if(_0x4c673a){return _0x4c673a[_0x07bd('0x27')](_0x16d0e6)['then'](function(_0x2b0dee){return _0x2b0dee;});}return null;};}function removeEntity(_0x480c9c,_0x50bd12){return function(_0x4165bc){if(_0x4165bc){return _0x4165bc[_0x07bd('0x28')]()[_0x07bd('0x29')](function(){_0x480c9c[_0x07bd('0x1c')](0xcc)[_0x07bd('0x1b')]();});}};}function handleEntityNotFound(_0x43cbc8,_0x557042){return function(_0x180b43){if(!_0x180b43){_0x43cbc8[_0x07bd('0x2a')](0x194);}return _0x180b43;};}function handleError(_0x3db9d0,_0x2a7202){_0x2a7202=_0x2a7202||0x1f4;return function(_0x12ce26){logger[_0x07bd('0x2b')](_0x12ce26['stack']);if(_0x12ce26['name']){delete _0x12ce26['name'];}_0x3db9d0[_0x07bd('0x1c')](_0x2a7202)[_0x07bd('0x2c')](_0x12ce26);};}exports[_0x07bd('0x2d')]=function(_0x51efa8,_0x1a3aa9){var _0x400cc0={},_0x253dc0={},_0x46ed12={'count':0x0,'rows':[]};var _0x3f9424=_[_0x07bd('0x2e')](db['MailQueueReport'][_0x07bd('0x2f')],function(_0x20cc94){return{'name':_0x20cc94[_0x07bd('0x30')],'type':_0x20cc94[_0x07bd('0x31')][_0x07bd('0x32')]};});_0x253dc0[_0x07bd('0x33')]=_[_0x07bd('0x2e')](_0x3f9424,_0x07bd('0x34'));_0x253dc0['query']=_['keys'](_0x51efa8[_0x07bd('0x35')]);_0x253dc0[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x253dc0['model'],_0x253dc0[_0x07bd('0x35')]);_0x400cc0[_0x07bd('0x38')]=_[_0x07bd('0x37')](_0x253dc0['model'],qs['fields'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x39')]));_0x400cc0[_0x07bd('0x38')]=_0x400cc0[_0x07bd('0x38')]['length']?_0x400cc0[_0x07bd('0x38')]:_0x253dc0[_0x07bd('0x33')];if(!_0x51efa8[_0x07bd('0x35')]['hasOwnProperty'](_0x07bd('0x3a'))){_0x400cc0[_0x07bd('0x20')]=qs['limit'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x20')]);_0x400cc0[_0x07bd('0x1e')]=qs[_0x07bd('0x1e')](_0x51efa8['query']['offset']);}_0x400cc0[_0x07bd('0x3b')]=qs['sort'](_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3c')]);_0x400cc0[_0x07bd('0x3d')]=qs[_0x07bd('0x36')](_[_0x07bd('0x3e')](_0x51efa8[_0x07bd('0x35')],_0x253dc0[_0x07bd('0x36')]),_0x3f9424);if(_0x51efa8[_0x07bd('0x35')][_0x07bd('0x3f')]){_0x400cc0[_0x07bd('0x3d')]=_[_0x07bd('0x40')](_0x400cc0[_0x07bd('0x3d')],{'$or':_[_0x07bd('0x2e')](_0x3f9424,function(_0x51e8e2){if(_0x51e8e2[_0x07bd('0x31')]!==_0x07bd('0x41')){var _0x220a8e={};_0x220a8e[_0x51e8e2[_0x07bd('0x34')]]={'$like':'%'+_0x51efa8['query'][_0x07bd('0x3f')]+'%'};return _0x220a8e;}})});}_0x400cc0=_[_0x07bd('0x40')]({},_0x400cc0,_0x51efa8[_0x07bd('0x42')]);var _0x408a0a={'where':_0x400cc0[_0x07bd('0x3d')]};return db['MailQueueReport']['count'](_0x408a0a)[_0x07bd('0x29')](function(_0x88e174){_0x46ed12[_0x07bd('0x21')]=_0x88e174;if(_0x51efa8[_0x07bd('0x35')]['includeAll']){_0x400cc0[_0x07bd('0x43')]=[{'all':!![]}];}return db[_0x07bd('0x44')][_0x07bd('0x45')](_0x400cc0);})[_0x07bd('0x29')](function(_0x318b7c){_0x46ed12[_0x07bd('0x46')]=_0x318b7c;return _0x46ed12;})[_0x07bd('0x29')](respondWithFilteredResult(_0x1a3aa9,_0x400cc0))['catch'](handleError(_0x1a3aa9,null));};exports[_0x07bd('0x47')]=function(_0x7b1042,_0x33389b){var _0x3a5827={'raw':!![],'where':{'id':_0x7b1042['params']['id']}},_0x418f26={};_0x418f26[_0x07bd('0x33')]=_[_0x07bd('0x48')](db[_0x07bd('0x44')][_0x07bd('0x2f')]);_0x418f26[_0x07bd('0x35')]=_['keys'](_0x7b1042[_0x07bd('0x35')]);_0x418f26[_0x07bd('0x36')]=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],_0x418f26['query']);_0x3a5827['attributes']=_[_0x07bd('0x37')](_0x418f26[_0x07bd('0x33')],qs[_0x07bd('0x39')](_0x7b1042[_0x07bd('0x35')][_0x07bd('0x39')]));_0x3a5827[_0x07bd('0x38')]=_0x3a5827[_0x07bd('0x38')][_0x07bd('0x49')]?_0x3a5827[_0x07bd('0x38')]:_0x418f26['model'];if(_0x7b1042['query'][_0x07bd('0x4a')]){_0x3a5827[_0x07bd('0x43')]=[{'all':!![]}];}_0x3a5827=_[_0x07bd('0x40')]({},_0x3a5827,_0x7b1042[_0x07bd('0x42')]);return db[_0x07bd('0x44')][_0x07bd('0x4b')](_0x3a5827)['then'](handleEntityNotFound(_0x33389b,null))[_0x07bd('0x29')](respondWithResult(_0x33389b,null))[_0x07bd('0x4c')](handleError(_0x33389b,null));};exports[_0x07bd('0x4d')]=function(_0x39823e,_0x7755e2){return db[_0x07bd('0x44')]['create'](_0x39823e[_0x07bd('0x4e')],{})[_0x07bd('0x29')](respondWithResult(_0x7755e2,0xc9))[_0x07bd('0x4c')](handleError(_0x7755e2,null));};exports[_0x07bd('0x27')]=function(_0x1d05ad,_0xc96a7d){if(_0x1d05ad[_0x07bd('0x4e')]['id']){delete _0x1d05ad[_0x07bd('0x4e')]['id'];}return db[_0x07bd('0x44')][_0x07bd('0x4b')]({'where':{'id':_0x1d05ad[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0xc96a7d,null))['then'](saveUpdates(_0x1d05ad[_0x07bd('0x4e')],null))[_0x07bd('0x29')](respondWithResult(_0xc96a7d,null))[_0x07bd('0x4c')](handleError(_0xc96a7d,null));};exports['destroy']=function(_0x51c9f4,_0x1e7a6e){return db['MailQueueReport'][_0x07bd('0x4b')]({'where':{'id':_0x51c9f4[_0x07bd('0x4f')]['id']}})[_0x07bd('0x29')](handleEntityNotFound(_0x1e7a6e,null))[_0x07bd('0x29')](removeEntity(_0x1e7a6e,null))[_0x07bd('0x4c')](handleError(_0x1e7a6e,null));};exports[_0x07bd('0x50')]=function(_0x2cadbb,_0x157eb4){return db['MailQueueReport'][_0x07bd('0x50')]()[_0x07bd('0x29')](respondWithResult(_0x157eb4,null))[_0x07bd('0x4c')](handleError(_0x157eb4,null));}; \ No newline at end of file +var _0xa456=['where','filters','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','params','keys','options','catch','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','undefined','count','offset','set','json','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x13ff53,_0x5e1424){var _0x290228=function(_0x3e3133){while(--_0x3e3133){_0x13ff53['push'](_0x13ff53['shift']());}};_0x290228(++_0x5e1424);}(_0xa456,0x142));var _0x6a45=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa456[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x6a45('0x0'));var rimraf=require(_0x6a45('0x1'));var zipdir=require(_0x6a45('0x2'));var jsonpatch=require(_0x6a45('0x3'));var rp=require('request-promise');var moment=require(_0x6a45('0x4'));var BPromise=require(_0x6a45('0x5'));var Mustache=require(_0x6a45('0x6'));var util=require('util');var path=require(_0x6a45('0x7'));var sox=require(_0x6a45('0x8'));var csv=require(_0x6a45('0x9'));var ejs=require(_0x6a45('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6a45('0xb'));var squel=require(_0x6a45('0xc'));var crypto=require(_0x6a45('0xd'));var jsforce=require(_0x6a45('0xe'));var deskjs=require(_0x6a45('0xf'));var toCsv=require('to-csv');var querystring=require(_0x6a45('0x10'));var Papa=require('papaparse');var Redis=require(_0x6a45('0x11'));var authService=require(_0x6a45('0x12'));var qs=require(_0x6a45('0x13'));var as=require(_0x6a45('0x14'));var hardwareService=require(_0x6a45('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x6a45('0x16'));var config=require(_0x6a45('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x511b92,_0x1aa4b4){_0x1aa4b4=_0x1aa4b4||0xcc;return function(_0x25a8b9){if(_0x25a8b9){return _0x511b92[_0x6a45('0x18')](_0x1aa4b4);}return _0x511b92[_0x6a45('0x19')](_0x1aa4b4)[_0x6a45('0x1a')]();};}function respondWithResult(_0x5a9f29,_0x563c3b){_0x563c3b=_0x563c3b||0xc8;return function(_0x3a5d94){if(_0x3a5d94){return _0x5a9f29[_0x6a45('0x19')](_0x563c3b)['json'](_0x3a5d94);}};}function respondWithFilteredResult(_0x2c20db,_0x171176){return function(_0x3fab82){if(_0x3fab82){var _0x13adc0=typeof _0x171176['offset']==='undefined'&&typeof _0x171176['limit']===_0x6a45('0x1b');var _0x391f81=_0x3fab82[_0x6a45('0x1c')];var _0x52a055=_0x13adc0?0x0:_0x171176[_0x6a45('0x1d')];var _0x102981=_0x13adc0?_0x3fab82[_0x6a45('0x1c')]:_0x171176['offset']+_0x171176['limit'];var _0x573453;if(_0x102981>=_0x391f81){_0x102981=_0x391f81;_0x573453=0xc8;}else{_0x573453=0xce;}_0x2c20db[_0x6a45('0x19')](_0x573453);return _0x2c20db[_0x6a45('0x1e')]('Content-Range',_0x52a055+'-'+_0x102981+'/'+_0x391f81)[_0x6a45('0x1f')](_0x3fab82);}return null;};}function patchUpdates(_0x1be485){return function(_0x4f7000){try{jsonpatch[_0x6a45('0x20')](_0x4f7000,_0x1be485,!![]);}catch(_0xdf10c6){return BPromise[_0x6a45('0x21')](_0xdf10c6);}return _0x4f7000[_0x6a45('0x22')]();};}function saveUpdates(_0x15ad0e,_0x487666){return function(_0x5d990e){if(_0x5d990e){return _0x5d990e[_0x6a45('0x23')](_0x15ad0e)[_0x6a45('0x24')](function(_0x11290c){return _0x11290c;});}return null;};}function removeEntity(_0x22373c,_0x25a380){return function(_0x3ad898){if(_0x3ad898){return _0x3ad898[_0x6a45('0x25')]()[_0x6a45('0x24')](function(){_0x22373c[_0x6a45('0x19')](0xcc)[_0x6a45('0x1a')]();});}};}function handleEntityNotFound(_0x1310d7,_0x46587a){return function(_0x5cd761){if(!_0x5cd761){_0x1310d7[_0x6a45('0x18')](0x194);}return _0x5cd761;};}function handleError(_0x5a0389,_0x1b83fa){_0x1b83fa=_0x1b83fa||0x1f4;return function(_0x25467d){logger[_0x6a45('0x26')](_0x25467d[_0x6a45('0x27')]);if(_0x25467d[_0x6a45('0x28')]){delete _0x25467d['name'];}_0x5a0389[_0x6a45('0x19')](_0x1b83fa)[_0x6a45('0x29')](_0x25467d);};}exports[_0x6a45('0x2a')]=function(_0x1ccff0,_0x8265d9){var _0x227b6f={},_0x3fac9b={},_0x313c13={'count':0x0,'rows':[]};var _0x54286d=_[_0x6a45('0x2b')](db[_0x6a45('0x2c')][_0x6a45('0x2d')],function(_0x201369){return{'name':_0x201369[_0x6a45('0x2e')],'type':_0x201369['type'][_0x6a45('0x2f')]};});_0x3fac9b[_0x6a45('0x30')]=_[_0x6a45('0x2b')](_0x54286d,_0x6a45('0x28'));_0x3fac9b['query']=_['keys'](_0x1ccff0[_0x6a45('0x31')]);_0x3fac9b['filters']=_[_0x6a45('0x32')](_0x3fac9b['model'],_0x3fac9b[_0x6a45('0x31')]);_0x227b6f[_0x6a45('0x33')]=_[_0x6a45('0x32')](_0x3fac9b[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x34')]));_0x227b6f[_0x6a45('0x33')]=_0x227b6f[_0x6a45('0x33')][_0x6a45('0x35')]?_0x227b6f[_0x6a45('0x33')]:_0x3fac9b[_0x6a45('0x30')];if(!_0x1ccff0[_0x6a45('0x31')]['hasOwnProperty'](_0x6a45('0x36'))){_0x227b6f['limit']=qs[_0x6a45('0x37')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x37')]);_0x227b6f[_0x6a45('0x1d')]=qs[_0x6a45('0x1d')](_0x1ccff0[_0x6a45('0x31')]['offset']);}_0x227b6f[_0x6a45('0x38')]=qs[_0x6a45('0x39')](_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x39')]);_0x227b6f[_0x6a45('0x3a')]=qs[_0x6a45('0x3b')](_['pick'](_0x1ccff0[_0x6a45('0x31')],_0x3fac9b[_0x6a45('0x3b')]),_0x54286d);if(_0x1ccff0['query'][_0x6a45('0x3c')]){_0x227b6f[_0x6a45('0x3a')]=_[_0x6a45('0x3d')](_0x227b6f[_0x6a45('0x3a')],{'$or':_[_0x6a45('0x2b')](_0x54286d,function(_0x50ebe0){if(_0x50ebe0[_0x6a45('0x3e')]!==_0x6a45('0x3f')){var _0x205afd={};_0x205afd[_0x50ebe0[_0x6a45('0x28')]]={'$like':'%'+_0x1ccff0[_0x6a45('0x31')][_0x6a45('0x3c')]+'%'};return _0x205afd;}})});}_0x227b6f=_[_0x6a45('0x3d')]({},_0x227b6f,_0x1ccff0['options']);var _0x1c941a={'where':_0x227b6f['where']};return db[_0x6a45('0x2c')][_0x6a45('0x1c')](_0x1c941a)[_0x6a45('0x24')](function(_0x2715dc){_0x313c13['count']=_0x2715dc;if(_0x1ccff0['query'][_0x6a45('0x40')]){_0x227b6f[_0x6a45('0x41')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6a45('0x42')](_0x227b6f);})[_0x6a45('0x24')](function(_0x3bd926){_0x313c13[_0x6a45('0x43')]=_0x3bd926;return _0x313c13;})['then'](respondWithFilteredResult(_0x8265d9,_0x227b6f))['catch'](handleError(_0x8265d9,null));};exports['show']=function(_0x5b9798,_0xe90201){var _0xb5d191={'raw':!![],'where':{'id':_0x5b9798[_0x6a45('0x44')]['id']}},_0x328d9f={};_0x328d9f[_0x6a45('0x30')]=_[_0x6a45('0x45')](db[_0x6a45('0x2c')][_0x6a45('0x2d')]);_0x328d9f['query']=_[_0x6a45('0x45')](_0x5b9798['query']);_0x328d9f['filters']=_[_0x6a45('0x32')](_0x328d9f[_0x6a45('0x30')],_0x328d9f['query']);_0xb5d191[_0x6a45('0x33')]=_['intersection'](_0x328d9f[_0x6a45('0x30')],qs[_0x6a45('0x34')](_0x5b9798[_0x6a45('0x31')][_0x6a45('0x34')]));_0xb5d191['attributes']=_0xb5d191[_0x6a45('0x33')][_0x6a45('0x35')]?_0xb5d191[_0x6a45('0x33')]:_0x328d9f[_0x6a45('0x30')];if(_0x5b9798[_0x6a45('0x31')]['includeAll']){_0xb5d191[_0x6a45('0x41')]=[{'all':!![]}];}_0xb5d191=_['merge']({},_0xb5d191,_0x5b9798[_0x6a45('0x46')]);return db[_0x6a45('0x2c')]['find'](_0xb5d191)[_0x6a45('0x24')](handleEntityNotFound(_0xe90201,null))[_0x6a45('0x24')](respondWithResult(_0xe90201,null))[_0x6a45('0x47')](handleError(_0xe90201,null));};exports[_0x6a45('0x48')]=function(_0x524296,_0x34bbb7){return db['MailQueueReport'][_0x6a45('0x48')](_0x524296['body'],{})[_0x6a45('0x24')](respondWithResult(_0x34bbb7,0xc9))[_0x6a45('0x47')](handleError(_0x34bbb7,null));};exports[_0x6a45('0x23')]=function(_0x2bf8d3,_0x5d9f52){if(_0x2bf8d3[_0x6a45('0x49')]['id']){delete _0x2bf8d3[_0x6a45('0x49')]['id'];}return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x2bf8d3[_0x6a45('0x44')]['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x5d9f52,null))[_0x6a45('0x24')](saveUpdates(_0x2bf8d3[_0x6a45('0x49')],null))[_0x6a45('0x24')](respondWithResult(_0x5d9f52,null))[_0x6a45('0x47')](handleError(_0x5d9f52,null));};exports['destroy']=function(_0x3ea4a7,_0x8877c7){return db[_0x6a45('0x2c')][_0x6a45('0x4a')]({'where':{'id':_0x3ea4a7['params']['id']}})[_0x6a45('0x24')](handleEntityNotFound(_0x8877c7,null))[_0x6a45('0x24')](removeEntity(_0x8877c7,null))[_0x6a45('0x47')](handleError(_0x8877c7,null));};exports['describe']=function(_0x4e7967,_0x5a17b8){return db[_0x6a45('0x2c')][_0x6a45('0x4b')]()[_0x6a45('0x24')](respondWithResult(_0x5a17b8,null))[_0x6a45('0x47')](handleError(_0x5a17b8,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 007d829..2a53575 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 _0x0cfe=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid'];(function(_0x5614a3,_0x44be51){var _0x505e19=function(_0x4d178c){while(--_0x4d178c){_0x5614a3['push'](_0x5614a3['shift']());}};_0x505e19(++_0x44be51);}(_0x0cfe,0x9c));var _0xe0cf=function(_0x29a91f,_0x58e323){_0x29a91f=_0x29a91f-0x0;var _0x358c19=_0x0cfe[_0x29a91f];return _0x358c19;};'use strict';var _=require(_0xe0cf('0x0'));var util=require('util');var logger=require(_0xe0cf('0x1'))(_0xe0cf('0x2'));var moment=require(_0xe0cf('0x3'));var BPromise=require('bluebird');var rp=require(_0xe0cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe0cf('0x5'));var config=require(_0xe0cf('0x6'));var attributes=require(_0xe0cf('0x7'));module[_0xe0cf('0x8')]=function(_0x58a4f7,_0x27c9ca){return _0x58a4f7[_0xe0cf('0x9')](_0xe0cf('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0xe0cf('0xb'),'fields':[_0xe0cf('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2f61=['path','./mailQueueReport.attributes','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x38784f,_0x8b4b6b){var _0x63895f=function(_0x1b5260){while(--_0x1b5260){_0x38784f['push'](_0x38784f['shift']());}};_0x63895f(++_0x8b4b6b);}(_0x2f61,0x7e));var _0x12f6=function(_0xfee47a,_0x448287){_0xfee47a=_0xfee47a-0x0;var _0x9820c=_0x2f61[_0xfee47a];return _0x9820c;};'use strict';var _=require(_0x12f6('0x0'));var util=require(_0x12f6('0x1'));var logger=require(_0x12f6('0x2'))(_0x12f6('0x3'));var moment=require('moment');var BPromise=require(_0x12f6('0x4'));var rp=require(_0x12f6('0x5'));var fs=require('fs');var path=require(_0x12f6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x12f6('0x7'));module['exports']=function(_0x17bbcb,_0x50a925){return _0x17bbcb[_0x12f6('0x8')](_0x12f6('0x9'),attributes,{'tableName':_0x12f6('0xa'),'paranoid':![],'indexes':[{'name':_0x12f6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 64cb88c..8673125 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateMailQueueReport','body','options','raw','stringify','MailQueueReport','update','where','UpdateMailQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x50721b,_0xcb5807){var _0x5c4285=function(_0x5b161f){while(--_0x5b161f){_0x50721b['push'](_0x50721b['shift']());}};_0x5c4285(++_0xcb5807);}(_0x1261,0x144));var _0x1126=function(_0x3cf387,_0x31ed26){_0x3cf387=_0x3cf387-0x0;var _0x24425f=_0x1261[_0x3cf387];return _0x24425f;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('MailQueueReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});}exports[_0x1126('0x15')]=function(_0x4a7b49){var _0x4d2b38=this;return new Promise(function(_0x22ae0b,_0x2b2487){return db['MailQueueReport']['create'](_0x4a7b49[_0x1126('0x16')],{'raw':_0x4a7b49['options']?_0x4a7b49[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![]})[_0x1126('0xc')](function(_0x54400a){logger[_0x1126('0xd')]('CreateMailQueueReport',_0x4a7b49);logger['debug'](_0x1126('0x15'),_0x4a7b49,JSON[_0x1126('0x19')](_0x54400a));_0x22ae0b(_0x54400a);})[_0x1126('0x14')](function(_0x36d254){logger['error'](_0x1126('0x15'),_0x36d254[_0x1126('0x13')],_0x4a7b49);_0x2b2487(_0x4d2b38['error'](0x1f4,_0x36d254[_0x1126('0x13')]));});});};exports['UpdateMailQueueReport']=function(_0x529dd9){var _0x4b57ab=this;return new Promise(function(_0x2199d9,_0x15bcc3){return db[_0x1126('0x1a')][_0x1126('0x1b')](_0x529dd9[_0x1126('0x16')],{'raw':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')][_0x1126('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529dd9['options']?_0x529dd9[_0x1126('0x17')][_0x1126('0x1c')]||null:null,'attributes':_0x529dd9[_0x1126('0x17')]?_0x529dd9['options']['attributes']||null:null,'limit':_0x529dd9[_0x1126('0x17')]?_0x529dd9[_0x1126('0x17')]['limit']||null:null})[_0x1126('0xc')](function(_0x23d2bc){logger['info'](_0x1126('0x1d'),_0x529dd9);logger['debug'](_0x1126('0x1d'),_0x529dd9,JSON['stringify'](_0x23d2bc));_0x2199d9(_0x23d2bc);})[_0x1126('0x14')](function(_0x583ce6){logger[_0x1126('0x11')]('UpdateMailQueueReport',_0x583ce6['message'],_0x529dd9);_0x15bcc3(_0x4b57ab['error'](0x1f4,_0x583ce6[_0x1126('0x13')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x2c503c,_0xd88a2a){var _0x39dce7=function(_0x4b01a5){while(--_0x4b01a5){_0x2c503c['push'](_0x2c503c['shift']());}};_0x39dce7(++_0xd88a2a);}(_0xdb28,0x106));var _0x8db2=function(_0x577a93,_0x379a44){_0x577a93=_0x577a93-0x0;var _0x31f87d=_0xdb28[_0x577a93];return _0x31f87d;};'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')]('MailQueueReport,\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);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index bf1fa07..487e670 100644 --- a/server/api/mailServerIn/index.js +++ b/server/api/mailServerIn/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5ada87,_0x39ce09){var _0x133b12=function(_0x4796f4){while(--_0x4796f4){_0x5ada87['push'](_0x5ada87['shift']());}};_0x133b12(++_0x39ce09);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x59c301,_0x359c50){_0x59c301=_0x59c301-0x0;var _0x3866b9=_0xcb91[_0x59c301];return _0x3866b9;};'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(_0x2160d4,_0x2fcdd2){var _0x329777=function(_0x19bc18){while(--_0x19bc18){_0x2160d4['push'](_0x2160d4['shift']());}};_0x329777(++_0x2fcdd2);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0xcb91[_0x39106e];return _0x892aec;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 446ba70..c41689c 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 _0xd1af=['sequelize','exports','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0xee0d98,_0x1e4d5f){var _0xb048b2=function(_0x406038){while(--_0x406038){_0xee0d98['push'](_0xee0d98['shift']());}};_0xb048b2(++_0x1e4d5f);}(_0xd1af,0xae));var _0xfd1a=function(_0x34172b,_0x25d399){_0x34172b=_0x34172b-0x0;var _0x51f8f1=_0xd1af[_0x34172b];return _0x51f8f1;};'use strict';var Sequelize=require(_0xfd1a('0x0'));module[_0xfd1a('0x1')]={'description':{'type':Sequelize[_0xfd1a('0x2')]},'host':{'type':Sequelize[_0xfd1a('0x2')]},'authentication':{'type':Sequelize[_0xfd1a('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xfd1a('0x2')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xfd1a('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xfd1a('0x2')],'defaultValue':_0xfd1a('0x5')},'connTimeout':{'type':Sequelize[_0xfd1a('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xfd1a('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xfd1a('0x2')]},'modernAuthentication':{'type':Sequelize[_0xfd1a('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x62d7=['sequelize','STRING','BOOLEAN','INTEGER','INBOX'];(function(_0x31bdb0,_0x5c0fe9){var _0x5e1e23=function(_0x53a17a){while(--_0x53a17a){_0x31bdb0['push'](_0x31bdb0['shift']());}};_0x5e1e23(++_0x5c0fe9);}(_0x62d7,0x172));var _0x762d=function(_0x476c36,_0x2aeadd){_0x476c36=_0x476c36-0x0;var _0x331fe0=_0x62d7[_0x476c36];return _0x331fe0;};'use strict';var Sequelize=require(_0x762d('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x762d('0x1')]},'authentication':{'type':Sequelize[_0x762d('0x2')],'defaultValue':!![]},'user':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x762d('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x762d('0x1')],'defaultValue':_0x762d('0x4')},'connTimeout':{'type':Sequelize[_0x762d('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x762d('0x3')],'defaultValue':0x5},'service':{'type':Sequelize[_0x762d('0x1')]},'modernAuthentication':{'type':Sequelize[_0x762d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 24363f2..d50c0c1 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 _0x6807=['request-promise','rimraf','exports','MailServerIn','lodash','../../config/logger','api','moment','bluebird'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x6807,0x109));var _0x7680=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6807[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7680('0x0'));var util=require('util');var logger=require(_0x7680('0x1'))(_0x7680('0x2'));var moment=require(_0x7680('0x3'));var BPromise=require(_0x7680('0x4'));var rp=require(_0x7680('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7680('0x6'));var config=require('../../config/environment');var attributes=require('./mailServerIn.attributes');module[_0x7680('0x7')]=function(_0x267c3b,_0x2240d9){return _0x267c3b['define'](_0x7680('0x8'),attributes,{'tableName':'mail_servers_in','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc203=['path','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2698b5,_0x2faad4){var _0x5375c1=function(_0x5d5348){while(--_0x5d5348){_0x2698b5['push'](_0x2698b5['shift']());}};_0x5375c1(++_0x2faad4);}(_0xc203,0x165));var _0x3c20=function(_0x1f0464,_0x74c830){_0x1f0464=_0x1f0464-0x0;var _0x3b8414=_0xc203[_0x1f0464];return _0x3b8414;};'use strict';var _=require(_0x3c20('0x0'));var util=require(_0x3c20('0x1'));var logger=require(_0x3c20('0x2'))(_0x3c20('0x3'));var moment=require('moment');var BPromise=require(_0x3c20('0x4'));var rp=require(_0x3c20('0x5'));var fs=require('fs');var path=require(_0x3c20('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3c20('0x7'));module[_0x3c20('0x8')]=function(_0x4aa0e7,_0x503066){return _0x4aa0e7[_0x3c20('0x9')]('MailServerIn',attributes,{'tableName':_0x3c20('0xa'),'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 70ce950..141bca0 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 _0x4a2e=['model','attributes','map','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','where','include'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x4a2e,0x125));var _0xe4a2=function(_0x2410e9,_0x6028ce){_0x2410e9=_0x2410e9-0x0;var _0x560eba=_0x4a2e[_0x2410e9];return _0x560eba;};'use strict';var _=require(_0xe4a2('0x0'));var util=require(_0xe4a2('0x1'));var moment=require(_0xe4a2('0x2'));var BPromise=require('bluebird');var rs=require(_0xe4a2('0x3'));var fs=require('fs');var Redis=require(_0xe4a2('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4a2('0x5'));var logger=require(_0xe4a2('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe4a2('0x7'));var client=jayson['client'][_0xe4a2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53fef5,_0xf15155,_0x4ec2aa){return new BPromise(function(_0x2445da,_0x5aa55e){return client['request'](_0x53fef5,_0x4ec2aa)[_0xe4a2('0x9')](function(_0x101db8){logger[_0xe4a2('0xa')](_0xe4a2('0xb'),_0xf15155,_0xe4a2('0xc'));logger[_0xe4a2('0xd')]('MailServerIn,\x20%s,\x20%s,\x20%s',_0xf15155,_0xe4a2('0xc'),JSON[_0xe4a2('0xe')](_0x101db8));if(_0x101db8[_0xe4a2('0xf')]){if(_0x101db8['error'][_0xe4a2('0x10')]===0x1f4){logger['error'](_0xe4a2('0xb'),_0xf15155,_0x101db8[_0xe4a2('0xf')][_0xe4a2('0x11')]);return _0x5aa55e(_0x101db8[_0xe4a2('0xf')]['message']);}logger[_0xe4a2('0xf')](_0xe4a2('0xb'),_0xf15155,_0x101db8[_0xe4a2('0xf')][_0xe4a2('0x11')]);return _0x2445da(_0x101db8[_0xe4a2('0xf')]['message']);}else{logger['info'](_0xe4a2('0xb'),_0xf15155,_0xe4a2('0xc'));_0x2445da(_0x101db8[_0xe4a2('0x12')][_0xe4a2('0x11')]);}})[_0xe4a2('0x13')](function(_0x1a77ef){logger['error'](_0xe4a2('0xb'),_0xf15155,_0x1a77ef);_0x5aa55e(_0x1a77ef);});});}exports[_0xe4a2('0x14')]=function(_0x255407){var _0x129f14=this;return new Promise(function(_0x4e6646,_0x23a6b5){return db[_0xe4a2('0x15')][_0xe4a2('0x16')]({'raw':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')][_0xe4a2('0x18')]||null:null,'attributes':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')]['attributes']||null:null,'limit':_0x255407[_0xe4a2('0x17')]?_0x255407[_0xe4a2('0x17')]['limit']||null:null,'include':_0x255407['options']?_0x255407[_0xe4a2('0x17')][_0xe4a2('0x19')]?_['map'](_0x255407[_0xe4a2('0x17')][_0xe4a2('0x19')],function(_0x2dd3aa){return{'model':db[_0x2dd3aa[_0xe4a2('0x1a')]],'as':_0x2dd3aa['as'],'attributes':_0x2dd3aa[_0xe4a2('0x1b')],'include':_0x2dd3aa[_0xe4a2('0x19')]?_[_0xe4a2('0x1c')](_0x2dd3aa[_0xe4a2('0x19')],function(_0x151f21){return{'model':db[_0x151f21[_0xe4a2('0x1a')]],'as':_0x151f21['as'],'attributes':_0x151f21[_0xe4a2('0x1b')],'include':_0x151f21['include']?_[_0xe4a2('0x1c')](_0x151f21['include'],function(_0x3eabc8){return{'model':db[_0x3eabc8[_0xe4a2('0x1a')]],'as':_0x3eabc8['as'],'attributes':_0x3eabc8['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4a2('0x9')](function(_0x57545f){logger[_0xe4a2('0xa')](_0xe4a2('0x14'),_0x255407);logger[_0xe4a2('0xd')](_0xe4a2('0x14'),_0x255407,JSON[_0xe4a2('0xe')](_0x57545f));_0x4e6646(_0x57545f);})[_0xe4a2('0x13')](function(_0x1715ac){logger[_0xe4a2('0xf')](_0xe4a2('0x14'),_0x1715ac[_0xe4a2('0x11')],_0x255407);_0x23a6b5(_0x129f14[_0xe4a2('0xf')](0x1f4,_0x1715ac['message']));});});}; \ No newline at end of file +var _0x561f=['where','attributes','limit','include','map','model','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','GetMailServerIn','MailServerIn','options','raw'];(function(_0x3e6698,_0xba1360){var _0x53d4c0=function(_0x5a2393){while(--_0x5a2393){_0x3e6698['push'](_0x3e6698['shift']());}};_0x53d4c0(++_0xba1360);}(_0x561f,0x15b));var _0xf561=function(_0x1a154f,_0x392be5){_0x1a154f=_0x1a154f-0x0;var _0x307e96=_0x561f[_0x1a154f];return _0x307e96;};'use strict';var _=require(_0xf561('0x0'));var util=require(_0xf561('0x1'));var moment=require(_0xf561('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf561('0x3'));var db=require(_0xf561('0x4'))['db'];var utils=require(_0xf561('0x5'));var logger=require(_0xf561('0x6'))(_0xf561('0x7'));var config=require('../../config/environment');var jayson=require(_0xf561('0x8'));var client=jayson['client'][_0xf561('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5afdb3,_0x46afd3,_0x35f017){return new BPromise(function(_0xae92ad,_0x332c2c){return client['request'](_0x5afdb3,_0x35f017)[_0xf561('0xa')](function(_0x1cd734){logger['info'](_0xf561('0xb'),_0x46afd3,'request\x20sent');logger[_0xf561('0xc')](_0xf561('0xd'),_0x46afd3,'request\x20sent',JSON[_0xf561('0xe')](_0x1cd734));if(_0x1cd734['error']){if(_0x1cd734[_0xf561('0xf')][_0xf561('0x10')]===0x1f4){logger[_0xf561('0xf')](_0xf561('0xb'),_0x46afd3,_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);return _0x332c2c(_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x46afd3,_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);return _0xae92ad(_0x1cd734[_0xf561('0xf')][_0xf561('0x11')]);}else{logger[_0xf561('0x12')](_0xf561('0xb'),_0x46afd3,_0xf561('0x13'));_0xae92ad(_0x1cd734['result'][_0xf561('0x11')]);}})[_0xf561('0x14')](function(_0x251b01){logger[_0xf561('0xf')]('MailServerIn,\x20%s,\x20%s',_0x46afd3,_0x251b01);_0x332c2c(_0x251b01);});});}exports[_0xf561('0x15')]=function(_0x591e89){var _0x3c6cae=this;return new Promise(function(_0x2a9bf1,_0x156d3c){return db[_0xf561('0x16')]['findAll']({'raw':_0x591e89[_0xf561('0x17')]?_0x591e89[_0xf561('0x17')][_0xf561('0x18')]===undefined?!![]:![]:!![],'where':_0x591e89[_0xf561('0x17')]?_0x591e89['options'][_0xf561('0x19')]||null:null,'attributes':_0x591e89[_0xf561('0x17')]?_0x591e89[_0xf561('0x17')][_0xf561('0x1a')]||null:null,'limit':_0x591e89[_0xf561('0x17')]?_0x591e89[_0xf561('0x17')][_0xf561('0x1b')]||null:null,'include':_0x591e89['options']?_0x591e89[_0xf561('0x17')][_0xf561('0x1c')]?_['map'](_0x591e89[_0xf561('0x17')][_0xf561('0x1c')],function(_0x5c3291){return{'model':db[_0x5c3291['model']],'as':_0x5c3291['as'],'attributes':_0x5c3291['attributes'],'include':_0x5c3291[_0xf561('0x1c')]?_[_0xf561('0x1d')](_0x5c3291[_0xf561('0x1c')],function(_0x4675c3){return{'model':db[_0x4675c3[_0xf561('0x1e')]],'as':_0x4675c3['as'],'attributes':_0x4675c3[_0xf561('0x1a')],'include':_0x4675c3[_0xf561('0x1c')]?_[_0xf561('0x1d')](_0x4675c3[_0xf561('0x1c')],function(_0x1afa6c){return{'model':db[_0x1afa6c[_0xf561('0x1e')]],'as':_0x1afa6c['as'],'attributes':_0x1afa6c[_0xf561('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x473c0f){logger[_0xf561('0x12')](_0xf561('0x15'),_0x591e89);logger[_0xf561('0xc')](_0xf561('0x15'),_0x591e89,JSON[_0xf561('0xe')](_0x473c0f));_0x2a9bf1(_0x473c0f);})[_0xf561('0x14')](function(_0x1f3d16){logger[_0xf561('0xf')](_0xf561('0x15'),_0x1f3d16[_0xf561('0x11')],_0x591e89);_0x156d3c(_0x3c6cae[_0xf561('0xf')](0x1f4,_0x1f3d16[_0xf561('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 4ca65d7..9138b3d 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7a54,0x106));var _0x47a5=function(_0x3516a4,_0x2388de){_0x3516a4=_0x3516a4-0x0;var _0x3d485a=_0x7a54[_0x3516a4];return _0x3d485a;};'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 d05d6cd..d4cf950 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 _0x878f=['STRING','INTEGER','BOOLEAN','exports'];(function(_0x36b8c3,_0x510529){var _0x10b676=function(_0xf23c48){while(--_0xf23c48){_0x36b8c3['push'](_0x36b8c3['shift']());}};_0x10b676(++_0x510529);}(_0x878f,0x173));var _0xf878=function(_0xc7851b,_0x578d41){_0xc7851b=_0xc7851b-0x0;var _0x513569=_0x878f[_0xc7851b];return _0x513569;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'description':{'type':Sequelize[_0xf878('0x1')]},'host':{'type':Sequelize[_0xf878('0x1')]},'user':{'type':Sequelize[_0xf878('0x1')]},'pass':{'type':Sequelize[_0xf878('0x1')]},'port':{'type':Sequelize[_0xf878('0x2')]},'secure':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0xf878('0x1')]},'authentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xf878('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xbfcc=['sequelize','STRING','INTEGER'];(function(_0x55b5fd,_0x42412a){var _0x5459a3=function(_0x190a15){while(--_0x190a15){_0x55b5fd['push'](_0x55b5fd['shift']());}};_0x5459a3(++_0x42412a);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x148c09,_0x4fd39f){_0x148c09=_0x148c09-0x0;var _0x18e613=_0xbfcc[_0x148c09];return _0x18e613;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xcbfc('0x1')]},'user':{'type':Sequelize[_0xcbfc('0x1')]},'pass':{'type':Sequelize[_0xcbfc('0x1')]},'port':{'type':Sequelize[_0xcbfc('0x2')]},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 3a4bb0c..fce5b36 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 _0x12f7=['../../mysqldb','status','end','offset','limit','count','set','json','apply','reject','save','update','destroy','then','sendStatus','error','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','rows','catch','show','params','create','body','find','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x182d8c,_0x32c47c){var _0x58b4a3=function(_0x2907f6){while(--_0x2907f6){_0x182d8c['push'](_0x182d8c['shift']());}};_0x58b4a3(++_0x32c47c);}(_0x12f7,0x7f));var _0x712f=function(_0x4ec2ed,_0x548881){_0x4ec2ed=_0x4ec2ed-0x0;var _0x2eca99=_0x12f7[_0x4ec2ed];return _0x2eca99;};'use strict';var emlformat=require(_0x712f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x712f('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x712f('0x2'));var moment=require(_0x712f('0x3'));var BPromise=require(_0x712f('0x4'));var Mustache=require(_0x712f('0x5'));var util=require(_0x712f('0x6'));var path=require(_0x712f('0x7'));var sox=require(_0x712f('0x8'));var csv=require(_0x712f('0x9'));var ejs=require(_0x712f('0xa'));var fs=require('fs');var fs_extra=require(_0x712f('0xb'));var _=require('lodash');var squel=require(_0x712f('0xc'));var crypto=require('crypto');var jsforce=require(_0x712f('0xd'));var deskjs=require(_0x712f('0xe'));var toCsv=require(_0x712f('0x9'));var querystring=require('querystring');var Papa=require(_0x712f('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x712f('0x10'));var hardwareService=require(_0x712f('0x11'));var logger=require(_0x712f('0x12'))(_0x712f('0x13'));var utils=require(_0x712f('0x14'));var config=require(_0x712f('0x15'));var licenseUtil=require(_0x712f('0x16'));var db=require(_0x712f('0x17'))['db'];function respondWithStatusCode(_0x553242,_0x1954f0){_0x1954f0=_0x1954f0||0xcc;return function(_0x183826){if(_0x183826){return _0x553242['sendStatus'](_0x1954f0);}return _0x553242[_0x712f('0x18')](_0x1954f0)[_0x712f('0x19')]();};}function respondWithResult(_0x14fc5b,_0x2cb637){_0x2cb637=_0x2cb637||0xc8;return function(_0x5e7949){if(_0x5e7949){return _0x14fc5b[_0x712f('0x18')](_0x2cb637)['json'](_0x5e7949);}};}function respondWithFilteredResult(_0x3a4aff,_0x5e334f){return function(_0x2155a5){if(_0x2155a5){var _0x232c26=typeof _0x5e334f[_0x712f('0x1a')]==='undefined'&&typeof _0x5e334f[_0x712f('0x1b')]==='undefined';var _0x133f0b=_0x2155a5['count'];var _0x37eb2f=_0x232c26?0x0:_0x5e334f[_0x712f('0x1a')];var _0x51aef5=_0x232c26?_0x2155a5[_0x712f('0x1c')]:_0x5e334f['offset']+_0x5e334f[_0x712f('0x1b')];var _0x1499f6;if(_0x51aef5>=_0x133f0b){_0x51aef5=_0x133f0b;_0x1499f6=0xc8;}else{_0x1499f6=0xce;}_0x3a4aff[_0x712f('0x18')](_0x1499f6);return _0x3a4aff[_0x712f('0x1d')]('Content-Range',_0x37eb2f+'-'+_0x51aef5+'/'+_0x133f0b)[_0x712f('0x1e')](_0x2155a5);}return null;};}function patchUpdates(_0xd9c2fa){return function(_0xd6d404){try{jsonpatch[_0x712f('0x1f')](_0xd6d404,_0xd9c2fa,!![]);}catch(_0x25f4e3){return BPromise[_0x712f('0x20')](_0x25f4e3);}return _0xd6d404[_0x712f('0x21')]();};}function saveUpdates(_0x4a4ffd,_0x1f34f3){return function(_0x477e3c){if(_0x477e3c){return _0x477e3c[_0x712f('0x22')](_0x4a4ffd)['then'](function(_0x244f22){return _0x244f22;});}return null;};}function removeEntity(_0x4b201e,_0x37cf38){return function(_0x15d5e1){if(_0x15d5e1){return _0x15d5e1[_0x712f('0x23')]()[_0x712f('0x24')](function(){_0x4b201e[_0x712f('0x18')](0xcc)[_0x712f('0x19')]();});}};}function handleEntityNotFound(_0xc63c64,_0x49f121){return function(_0x2245bc){if(!_0x2245bc){_0xc63c64[_0x712f('0x25')](0x194);}return _0x2245bc;};}function handleError(_0x577b0e,_0x16f170){_0x16f170=_0x16f170||0x1f4;return function(_0x495b59){logger[_0x712f('0x26')](_0x495b59['stack']);if(_0x495b59[_0x712f('0x27')]){delete _0x495b59[_0x712f('0x27')];}_0x577b0e[_0x712f('0x18')](_0x16f170)[_0x712f('0x28')](_0x495b59);};}exports['index']=function(_0x3283c5,_0xeb8701){var _0x5deb21={},_0x3252ce={},_0x23c956={'count':0x0,'rows':[]};var _0x2065a4=_[_0x712f('0x29')](db['MailServerOut'][_0x712f('0x2a')],function(_0x6caa90){return{'name':_0x6caa90[_0x712f('0x2b')],'type':_0x6caa90[_0x712f('0x2c')][_0x712f('0x2d')]};});_0x3252ce['model']=_[_0x712f('0x29')](_0x2065a4,_0x712f('0x27'));_0x3252ce[_0x712f('0x2e')]=_[_0x712f('0x2f')](_0x3283c5[_0x712f('0x2e')]);_0x3252ce[_0x712f('0x30')]=_[_0x712f('0x31')](_0x3252ce[_0x712f('0x32')],_0x3252ce[_0x712f('0x2e')]);_0x5deb21[_0x712f('0x33')]=_[_0x712f('0x31')](_0x3252ce['model'],qs[_0x712f('0x34')](_0x3283c5['query'][_0x712f('0x34')]));_0x5deb21[_0x712f('0x33')]=_0x5deb21[_0x712f('0x33')][_0x712f('0x35')]?_0x5deb21[_0x712f('0x33')]:_0x3252ce[_0x712f('0x32')];if(!_0x3283c5[_0x712f('0x2e')][_0x712f('0x36')](_0x712f('0x37'))){_0x5deb21[_0x712f('0x1b')]=qs[_0x712f('0x1b')](_0x3283c5[_0x712f('0x2e')][_0x712f('0x1b')]);_0x5deb21[_0x712f('0x1a')]=qs['offset'](_0x3283c5['query'][_0x712f('0x1a')]);}_0x5deb21[_0x712f('0x38')]=qs[_0x712f('0x39')](_0x3283c5[_0x712f('0x2e')][_0x712f('0x39')]);_0x5deb21[_0x712f('0x3a')]=qs[_0x712f('0x30')](_[_0x712f('0x3b')](_0x3283c5[_0x712f('0x2e')],_0x3252ce[_0x712f('0x30')]),_0x2065a4);if(_0x3283c5[_0x712f('0x2e')][_0x712f('0x3c')]){_0x5deb21['where']=_[_0x712f('0x3d')](_0x5deb21[_0x712f('0x3a')],{'$or':_[_0x712f('0x29')](_0x2065a4,function(_0x57ea59){if(_0x57ea59[_0x712f('0x2c')]!==_0x712f('0x3e')){var _0x78a6bc={};_0x78a6bc[_0x57ea59[_0x712f('0x27')]]={'$like':'%'+_0x3283c5[_0x712f('0x2e')][_0x712f('0x3c')]+'%'};return _0x78a6bc;}})});}_0x5deb21=_[_0x712f('0x3d')]({},_0x5deb21,_0x3283c5[_0x712f('0x3f')]);var _0x1a0fe1={'where':_0x5deb21[_0x712f('0x3a')]};return db[_0x712f('0x40')][_0x712f('0x1c')](_0x1a0fe1)[_0x712f('0x24')](function(_0x5d5347){_0x23c956[_0x712f('0x1c')]=_0x5d5347;if(_0x3283c5[_0x712f('0x2e')][_0x712f('0x41')]){_0x5deb21[_0x712f('0x42')]=[{'all':!![]}];}return db[_0x712f('0x40')][_0x712f('0x43')](_0x5deb21);})[_0x712f('0x24')](function(_0x1647d7){_0x23c956[_0x712f('0x44')]=_0x1647d7;return _0x23c956;})[_0x712f('0x24')](respondWithFilteredResult(_0xeb8701,_0x5deb21))[_0x712f('0x45')](handleError(_0xeb8701,null));};exports[_0x712f('0x46')]=function(_0x5223c7,_0x2727f3){var _0x1201e0={'raw':!![],'where':{'id':_0x5223c7[_0x712f('0x47')]['id']}},_0x50931e={};_0x50931e[_0x712f('0x32')]=_[_0x712f('0x2f')](db['MailServerOut']['rawAttributes']);_0x50931e[_0x712f('0x2e')]=_['keys'](_0x5223c7[_0x712f('0x2e')]);_0x50931e[_0x712f('0x30')]=_['intersection'](_0x50931e['model'],_0x50931e[_0x712f('0x2e')]);_0x1201e0['attributes']=_[_0x712f('0x31')](_0x50931e[_0x712f('0x32')],qs[_0x712f('0x34')](_0x5223c7[_0x712f('0x2e')]['fields']));_0x1201e0[_0x712f('0x33')]=_0x1201e0[_0x712f('0x33')][_0x712f('0x35')]?_0x1201e0['attributes']:_0x50931e[_0x712f('0x32')];if(_0x5223c7[_0x712f('0x2e')][_0x712f('0x41')]){_0x1201e0['include']=[{'all':!![]}];}_0x1201e0=_[_0x712f('0x3d')]({},_0x1201e0,_0x5223c7['options']);return db['MailServerOut']['find'](_0x1201e0)[_0x712f('0x24')](handleEntityNotFound(_0x2727f3,null))['then'](respondWithResult(_0x2727f3,null))[_0x712f('0x45')](handleError(_0x2727f3,null));};exports[_0x712f('0x48')]=function(_0x1ff0c8,_0x48d8c9){return db['MailServerOut'][_0x712f('0x48')](_0x1ff0c8['body'],{})[_0x712f('0x24')](respondWithResult(_0x48d8c9,0xc9))[_0x712f('0x45')](handleError(_0x48d8c9,null));};exports['update']=function(_0x225d40,_0x1c3383){if(_0x225d40[_0x712f('0x49')]['id']){delete _0x225d40[_0x712f('0x49')]['id'];}return db[_0x712f('0x40')][_0x712f('0x4a')]({'where':{'id':_0x225d40[_0x712f('0x47')]['id']}})[_0x712f('0x24')](handleEntityNotFound(_0x1c3383,null))[_0x712f('0x24')](saveUpdates(_0x225d40['body'],null))['then'](respondWithResult(_0x1c3383,null))[_0x712f('0x45')](handleError(_0x1c3383,null));};exports[_0x712f('0x23')]=function(_0x3a3f3a,_0x1446e1){return db[_0x712f('0x40')][_0x712f('0x4a')]({'where':{'id':_0x3a3f3a['params']['id']}})[_0x712f('0x24')](handleEntityNotFound(_0x1446e1,null))['then'](removeEntity(_0x1446e1,null))[_0x712f('0x45')](handleError(_0x1446e1,null));}; \ No newline at end of file +var _0x7afd=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','map','MailServerOut','rawAttributes','type','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','options','find','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel'];(function(_0x4d282a,_0x3204e4){var _0x4fce00=function(_0x2bb779){while(--_0x2bb779){_0x4d282a['push'](_0x4d282a['shift']());}};_0x4fce00(++_0x3204e4);}(_0x7afd,0x116));var _0xd7af=function(_0x4bcb3c,_0x192122){_0x4bcb3c=_0x4bcb3c-0x0;var _0xfe09bb=_0x7afd[_0x4bcb3c];return _0xfe09bb;};'use strict';var emlformat=require(_0xd7af('0x0'));var rimraf=require(_0xd7af('0x1'));var zipdir=require(_0xd7af('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd7af('0x3'));var moment=require(_0xd7af('0x4'));var BPromise=require(_0xd7af('0x5'));var Mustache=require(_0xd7af('0x6'));var util=require(_0xd7af('0x7'));var path=require(_0xd7af('0x8'));var sox=require(_0xd7af('0x9'));var csv=require(_0xd7af('0xa'));var ejs=require(_0xd7af('0xb'));var fs=require('fs');var fs_extra=require(_0xd7af('0xc'));var _=require('lodash');var squel=require(_0xd7af('0xd'));var crypto=require('crypto');var jsforce=require(_0xd7af('0xe'));var deskjs=require(_0xd7af('0xf'));var toCsv=require(_0xd7af('0xa'));var querystring=require(_0xd7af('0x10'));var Papa=require(_0xd7af('0x11'));var Redis=require(_0xd7af('0x12'));var authService=require(_0xd7af('0x13'));var qs=require(_0xd7af('0x14'));var as=require(_0xd7af('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd7af('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xd7af('0x17'))['db'];function respondWithStatusCode(_0x21acc9,_0x133838){_0x133838=_0x133838||0xcc;return function(_0x4e2a87){if(_0x4e2a87){return _0x21acc9['sendStatus'](_0x133838);}return _0x21acc9['status'](_0x133838)['end']();};}function respondWithResult(_0x2f81d9,_0x4ff3b9){_0x4ff3b9=_0x4ff3b9||0xc8;return function(_0x317306){if(_0x317306){return _0x2f81d9[_0xd7af('0x18')](_0x4ff3b9)[_0xd7af('0x19')](_0x317306);}};}function respondWithFilteredResult(_0x2abdc3,_0x3a8737){return function(_0x50ca29){if(_0x50ca29){var _0x451920=typeof _0x3a8737[_0xd7af('0x1a')]===_0xd7af('0x1b')&&typeof _0x3a8737[_0xd7af('0x1c')]===_0xd7af('0x1b');var _0x4901d2=_0x50ca29[_0xd7af('0x1d')];var _0x117604=_0x451920?0x0:_0x3a8737[_0xd7af('0x1a')];var _0x38b298=_0x451920?_0x50ca29[_0xd7af('0x1d')]:_0x3a8737[_0xd7af('0x1a')]+_0x3a8737[_0xd7af('0x1c')];var _0x482573;if(_0x38b298>=_0x4901d2){_0x38b298=_0x4901d2;_0x482573=0xc8;}else{_0x482573=0xce;}_0x2abdc3['status'](_0x482573);return _0x2abdc3[_0xd7af('0x1e')](_0xd7af('0x1f'),_0x117604+'-'+_0x38b298+'/'+_0x4901d2)[_0xd7af('0x19')](_0x50ca29);}return null;};}function patchUpdates(_0x1a9923){return function(_0x1a5111){try{jsonpatch[_0xd7af('0x20')](_0x1a5111,_0x1a9923,!![]);}catch(_0x25a1e5){return BPromise[_0xd7af('0x21')](_0x25a1e5);}return _0x1a5111[_0xd7af('0x22')]();};}function saveUpdates(_0x16352c,_0x13ef86){return function(_0x125f9d){if(_0x125f9d){return _0x125f9d[_0xd7af('0x23')](_0x16352c)[_0xd7af('0x24')](function(_0x1087f5){return _0x1087f5;});}return null;};}function removeEntity(_0x5103d0,_0x3d81f2){return function(_0x17c3e7){if(_0x17c3e7){return _0x17c3e7['destroy']()[_0xd7af('0x24')](function(){_0x5103d0[_0xd7af('0x18')](0xcc)[_0xd7af('0x25')]();});}};}function handleEntityNotFound(_0x404182,_0x1765c0){return function(_0x4b016d){if(!_0x4b016d){_0x404182[_0xd7af('0x26')](0x194);}return _0x4b016d;};}function handleError(_0x31126d,_0x32e0d1){_0x32e0d1=_0x32e0d1||0x1f4;return function(_0x5cd926){logger[_0xd7af('0x27')](_0x5cd926[_0xd7af('0x28')]);if(_0x5cd926[_0xd7af('0x29')]){delete _0x5cd926[_0xd7af('0x29')];}_0x31126d[_0xd7af('0x18')](_0x32e0d1)[_0xd7af('0x2a')](_0x5cd926);};}exports['index']=function(_0x87c410,_0x3dfd4e){var _0x5c8bec={},_0x794d52={},_0x1b6b10={'count':0x0,'rows':[]};var _0x491872=_[_0xd7af('0x2b')](db[_0xd7af('0x2c')][_0xd7af('0x2d')],function(_0x492cb0){return{'name':_0x492cb0['fieldName'],'type':_0x492cb0[_0xd7af('0x2e')]['key']};});_0x794d52['model']=_[_0xd7af('0x2b')](_0x491872,_0xd7af('0x29'));_0x794d52[_0xd7af('0x2f')]=_[_0xd7af('0x30')](_0x87c410['query']);_0x794d52[_0xd7af('0x31')]=_['intersection'](_0x794d52[_0xd7af('0x32')],_0x794d52[_0xd7af('0x2f')]);_0x5c8bec['attributes']=_[_0xd7af('0x33')](_0x794d52[_0xd7af('0x32')],qs['fields'](_0x87c410[_0xd7af('0x2f')][_0xd7af('0x34')]));_0x5c8bec[_0xd7af('0x35')]=_0x5c8bec[_0xd7af('0x35')]['length']?_0x5c8bec[_0xd7af('0x35')]:_0x794d52[_0xd7af('0x32')];if(!_0x87c410[_0xd7af('0x2f')][_0xd7af('0x36')](_0xd7af('0x37'))){_0x5c8bec['limit']=qs['limit'](_0x87c410[_0xd7af('0x2f')][_0xd7af('0x1c')]);_0x5c8bec['offset']=qs[_0xd7af('0x1a')](_0x87c410[_0xd7af('0x2f')][_0xd7af('0x1a')]);}_0x5c8bec[_0xd7af('0x38')]=qs[_0xd7af('0x39')](_0x87c410[_0xd7af('0x2f')]['sort']);_0x5c8bec[_0xd7af('0x3a')]=qs[_0xd7af('0x31')](_[_0xd7af('0x3b')](_0x87c410['query'],_0x794d52['filters']),_0x491872);if(_0x87c410[_0xd7af('0x2f')][_0xd7af('0x3c')]){_0x5c8bec['where']=_[_0xd7af('0x3d')](_0x5c8bec[_0xd7af('0x3a')],{'$or':_[_0xd7af('0x2b')](_0x491872,function(_0x11b001){if(_0x11b001[_0xd7af('0x2e')]!==_0xd7af('0x3e')){var _0x52e78d={};_0x52e78d[_0x11b001[_0xd7af('0x29')]]={'$like':'%'+_0x87c410['query'][_0xd7af('0x3c')]+'%'};return _0x52e78d;}})});}_0x5c8bec=_[_0xd7af('0x3d')]({},_0x5c8bec,_0x87c410['options']);var _0x151971={'where':_0x5c8bec[_0xd7af('0x3a')]};return db['MailServerOut'][_0xd7af('0x1d')](_0x151971)['then'](function(_0x3af5d6){_0x1b6b10['count']=_0x3af5d6;if(_0x87c410[_0xd7af('0x2f')][_0xd7af('0x3f')]){_0x5c8bec[_0xd7af('0x40')]=[{'all':!![]}];}return db[_0xd7af('0x2c')][_0xd7af('0x41')](_0x5c8bec);})[_0xd7af('0x24')](function(_0x3e6b7b){_0x1b6b10['rows']=_0x3e6b7b;return _0x1b6b10;})[_0xd7af('0x24')](respondWithFilteredResult(_0x3dfd4e,_0x5c8bec))[_0xd7af('0x42')](handleError(_0x3dfd4e,null));};exports[_0xd7af('0x43')]=function(_0x22d66a,_0x143894){var _0x7674b0={'raw':!![],'where':{'id':_0x22d66a['params']['id']}},_0x2a7f0d={};_0x2a7f0d[_0xd7af('0x32')]=_['keys'](db[_0xd7af('0x2c')][_0xd7af('0x2d')]);_0x2a7f0d[_0xd7af('0x2f')]=_[_0xd7af('0x30')](_0x22d66a[_0xd7af('0x2f')]);_0x2a7f0d['filters']=_['intersection'](_0x2a7f0d[_0xd7af('0x32')],_0x2a7f0d[_0xd7af('0x2f')]);_0x7674b0[_0xd7af('0x35')]=_[_0xd7af('0x33')](_0x2a7f0d[_0xd7af('0x32')],qs[_0xd7af('0x34')](_0x22d66a[_0xd7af('0x2f')][_0xd7af('0x34')]));_0x7674b0[_0xd7af('0x35')]=_0x7674b0[_0xd7af('0x35')]['length']?_0x7674b0[_0xd7af('0x35')]:_0x2a7f0d[_0xd7af('0x32')];if(_0x22d66a['query']['includeAll']){_0x7674b0[_0xd7af('0x40')]=[{'all':!![]}];}_0x7674b0=_[_0xd7af('0x3d')]({},_0x7674b0,_0x22d66a[_0xd7af('0x44')]);return db[_0xd7af('0x2c')][_0xd7af('0x45')](_0x7674b0)[_0xd7af('0x24')](handleEntityNotFound(_0x143894,null))[_0xd7af('0x24')](respondWithResult(_0x143894,null))[_0xd7af('0x42')](handleError(_0x143894,null));};exports[_0xd7af('0x46')]=function(_0xa46feb,_0x20a241){return db['MailServerOut'][_0xd7af('0x46')](_0xa46feb[_0xd7af('0x47')],{})['then'](respondWithResult(_0x20a241,0xc9))[_0xd7af('0x42')](handleError(_0x20a241,null));};exports[_0xd7af('0x23')]=function(_0x441a5a,_0x2ebd40){if(_0x441a5a[_0xd7af('0x47')]['id']){delete _0x441a5a['body']['id'];}return db[_0xd7af('0x2c')][_0xd7af('0x45')]({'where':{'id':_0x441a5a[_0xd7af('0x48')]['id']}})[_0xd7af('0x24')](handleEntityNotFound(_0x2ebd40,null))['then'](saveUpdates(_0x441a5a[_0xd7af('0x47')],null))[_0xd7af('0x24')](respondWithResult(_0x2ebd40,null))[_0xd7af('0x42')](handleError(_0x2ebd40,null));};exports['destroy']=function(_0x294f47,_0x2d604f){return db[_0xd7af('0x2c')][_0xd7af('0x45')]({'where':{'id':_0x294f47[_0xd7af('0x48')]['id']}})[_0xd7af('0x24')](handleEntityNotFound(_0x2d604f,null))[_0xd7af('0x24')](removeEntity(_0x2d604f,null))[_0xd7af('0x42')](handleError(_0x2d604f,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 70fc90a..311d217 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 _0xf084=['bluebird','path','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api'];(function(_0x1e6bc1,_0x1e3986){var _0x1d148c=function(_0x4a7023){while(--_0x4a7023){_0x1e6bc1['push'](_0x1e6bc1['shift']());}};_0x1d148c(++_0x1e3986);}(_0xf084,0x74));var _0x4f08=function(_0x59b6d7,_0x399af3){_0x59b6d7=_0x59b6d7-0x0;var _0x8ec1df=_0xf084[_0x59b6d7];return _0x8ec1df;};'use strict';var _=require(_0x4f08('0x0'));var util=require(_0x4f08('0x1'));var logger=require(_0x4f08('0x2'))(_0x4f08('0x3'));var moment=require('moment');var BPromise=require(_0x4f08('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4f08('0x5'));var rimraf=require('rimraf');var config=require(_0x4f08('0x6'));var attributes=require(_0x4f08('0x7'));module[_0x4f08('0x8')]=function(_0x330b6e,_0x1862ac){return _0x330b6e[_0x4f08('0x9')](_0x4f08('0xa'),attributes,{'tableName':_0x4f08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4331=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4331,0x1c1));var _0x1433=function(_0x480fc2,_0x482fba){_0x480fc2=_0x480fc2-0x0;var _0x540a95=_0x4331[_0x480fc2];return _0x540a95;};'use strict';var _=require(_0x1433('0x0'));var util=require(_0x1433('0x1'));var logger=require(_0x1433('0x2'))(_0x1433('0x3'));var moment=require('moment');var BPromise=require(_0x1433('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1433('0x5'));var rimraf=require(_0x1433('0x6'));var config=require(_0x1433('0x7'));var attributes=require(_0x1433('0x8'));module[_0x1433('0x9')]=function(_0x43a410,_0x119e93){return _0x43a410[_0x1433('0xa')](_0x1433('0xb'),attributes,{'tableName':_0x1433('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index c411a6a..602a030 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x310428,_0xec9879){var _0x56c99d=function(_0x5f070a){while(--_0x5f070a){_0x310428['push'](_0x310428['shift']());}};_0x56c99d(++_0xec9879);}(_0x2ef3,0xba));var _0x32ef=function(_0x2e49ce,_0x25ef32){_0x2e49ce=_0x2e49ce-0x0;var _0x54b588=_0x2ef3[_0x2e49ce];return _0x54b588;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x296d1b,_0x1f0bf0){var _0x3c747f=function(_0x1d5096){while(--_0x1d5096){_0x296d1b['push'](_0x296d1b['shift']());}};_0x3c747f(++_0x1f0bf0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x5f66[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 84b28c9..73fe0bd 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 _0xd78b=['post','put','delete','destroy','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index','/describe','describe','get','/:id','show'];(function(_0x1b8a3d,_0x110236){var _0x58c1d2=function(_0x55fa22){while(--_0x55fa22){_0x1b8a3d['push'](_0x1b8a3d['shift']());}};_0x58c1d2(++_0x110236);}(_0xd78b,0x1bc));var _0xbd78=function(_0x4b342e,_0x425550){_0x4b342e=_0x4b342e-0x0;var _0x42e1cd=_0xd78b[_0x4b342e];return _0x42e1cd;};'use strict';var multer=require('multer');var util=require(_0xbd78('0x0'));var path=require(_0xbd78('0x1'));var timeout=require('connect-timeout');var express=require(_0xbd78('0x2'));var router=express[_0xbd78('0x3')]();var fs_extra=require(_0xbd78('0x4'));var auth=require(_0xbd78('0x5'));var interaction=require(_0xbd78('0x6'));var config=require(_0xbd78('0x7'));var controller=require(_0xbd78('0x8'));router['get']('/',auth[_0xbd78('0x9')](),controller[_0xbd78('0xa')]);router['get'](_0xbd78('0xb'),auth[_0xbd78('0x9')](),controller[_0xbd78('0xc')]);router[_0xbd78('0xd')](_0xbd78('0xe'),auth[_0xbd78('0x9')](),controller[_0xbd78('0xf')]);router[_0xbd78('0x10')]('/',auth[_0xbd78('0x9')](),controller['create']);router[_0xbd78('0x11')](_0xbd78('0xe'),auth[_0xbd78('0x9')](),controller['update']);router[_0xbd78('0x12')]('/:id',auth[_0xbd78('0x9')](),controller[_0xbd78('0x13')]);module['exports']=router; \ No newline at end of file +var _0x2b6e=['path','express','Router','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0x2b6e,0x11f));var _0xe2b6=function(_0x32024f,_0x8c3d41){_0x32024f=_0x32024f-0x0;var _0x3dba3f=_0x2b6e[_0x32024f];return _0x3dba3f;};'use strict';var multer=require('multer');var util=require(_0xe2b6('0x0'));var path=require(_0xe2b6('0x1'));var timeout=require('connect-timeout');var express=require(_0xe2b6('0x2'));var router=express[_0xe2b6('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe2b6('0x4'));var config=require(_0xe2b6('0x5'));var controller=require('./mailSubstatus.controller');router[_0xe2b6('0x6')]('/',auth['isAuthenticated'](),controller[_0xe2b6('0x7')]);router['get']('/describe',auth[_0xe2b6('0x8')](),controller['describe']);router[_0xe2b6('0x6')](_0xe2b6('0x9'),auth['isAuthenticated'](),controller[_0xe2b6('0xa')]);router[_0xe2b6('0xb')]('/',auth[_0xe2b6('0x8')](),controller[_0xe2b6('0xc')]);router[_0xe2b6('0xd')](_0xe2b6('0x9'),auth[_0xe2b6('0x8')](),controller[_0xe2b6('0xe')]);router[_0xe2b6('0xf')](_0xe2b6('0x9'),auth['isAuthenticated'](),controller[_0xe2b6('0x10')]);module[_0xe2b6('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index bd73c83..adc28c4 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 _0x7d9f=['sequelize','exports','STRING','name'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x13c2cf,_0x568ba5){_0x13c2cf=_0x13c2cf-0x0;var _0x237785=_0x7d9f[_0x13c2cf];return _0x237785;};'use strict';var Sequelize=require(_0xf7d9('0x0'));module[_0xf7d9('0x1')]={'name':{'type':Sequelize[_0xf7d9('0x2')],'unique':_0xf7d9('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xf7d9('0x2')]}}; \ No newline at end of file +var _0x1dcc=['STRING','name','sequelize','exports'];(function(_0x1f4d78,_0xa5f88b){var _0x51b14c=function(_0xc2386d){while(--_0xc2386d){_0x1f4d78['push'](_0x1f4d78['shift']());}};_0x51b14c(++_0xa5f88b);}(_0x1dcc,0x1ea));var _0xc1dc=function(_0x3ebf84,_0x5d0b52){_0x3ebf84=_0x3ebf84-0x0;var _0x1f1f9d=_0x1dcc[_0x3ebf84];return _0x1f1f9d;};'use strict';var Sequelize=require(_0xc1dc('0x0'));module[_0xc1dc('0x1')]={'name':{'type':Sequelize[_0xc1dc('0x2')],'unique':_0xc1dc('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 0e300a2..4310072 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 _0xf4db=['intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','include','options','find','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','limit','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','MailSubstatus','type','key','model','map','query','keys','filters'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xf4db,0xa5));var _0xbf4d=function(_0x42e7ce,_0x375d2e){_0x42e7ce=_0x42e7ce-0x0;var _0x3d5428=_0xf4db[_0x42e7ce];return _0x3d5428;};'use strict';var emlformat=require(_0xbf4d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbf4d('0x1'));var jsonpatch=require(_0xbf4d('0x2'));var rp=require(_0xbf4d('0x3'));var moment=require(_0xbf4d('0x4'));var BPromise=require(_0xbf4d('0x5'));var Mustache=require(_0xbf4d('0x6'));var util=require('util');var path=require(_0xbf4d('0x7'));var sox=require(_0xbf4d('0x8'));var csv=require(_0xbf4d('0x9'));var ejs=require(_0xbf4d('0xa'));var fs=require('fs');var fs_extra=require(_0xbf4d('0xb'));var _=require(_0xbf4d('0xc'));var squel=require('squel');var crypto=require(_0xbf4d('0xd'));var jsforce=require(_0xbf4d('0xe'));var deskjs=require(_0xbf4d('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf4d('0x10'));var Redis=require(_0xbf4d('0x11'));var authService=require(_0xbf4d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf4d('0x13'));var logger=require('../../config/logger')(_0xbf4d('0x14'));var utils=require(_0xbf4d('0x15'));var config=require(_0xbf4d('0x16'));var licenseUtil=require(_0xbf4d('0x17'));var db=require(_0xbf4d('0x18'))['db'];function respondWithStatusCode(_0x39f080,_0x477e3c){_0x477e3c=_0x477e3c||0xcc;return function(_0x3815f1){if(_0x3815f1){return _0x39f080[_0xbf4d('0x19')](_0x477e3c);}return _0x39f080[_0xbf4d('0x1a')](_0x477e3c)['end']();};}function respondWithResult(_0x389a64,_0x55b541){_0x55b541=_0x55b541||0xc8;return function(_0x12d55a){if(_0x12d55a){return _0x389a64[_0xbf4d('0x1a')](_0x55b541)[_0xbf4d('0x1b')](_0x12d55a);}};}function respondWithFilteredResult(_0x14fd64,_0x526deb){return function(_0x2ac874){if(_0x2ac874){var _0x1b5e7e=typeof _0x526deb[_0xbf4d('0x1c')]==='undefined'&&typeof _0x526deb['limit']==='undefined';var _0x180b68=_0x2ac874['count'];var _0xccec17=_0x1b5e7e?0x0:_0x526deb[_0xbf4d('0x1c')];var _0x14d864=_0x1b5e7e?_0x2ac874[_0xbf4d('0x1d')]:_0x526deb[_0xbf4d('0x1c')]+_0x526deb[_0xbf4d('0x1e')];var _0x4dbe6e;if(_0x14d864>=_0x180b68){_0x14d864=_0x180b68;_0x4dbe6e=0xc8;}else{_0x4dbe6e=0xce;}_0x14fd64[_0xbf4d('0x1a')](_0x4dbe6e);return _0x14fd64['set'](_0xbf4d('0x1f'),_0xccec17+'-'+_0x14d864+'/'+_0x180b68)[_0xbf4d('0x1b')](_0x2ac874);}return null;};}function patchUpdates(_0x348e11){return function(_0x5a1eac){try{jsonpatch['apply'](_0x5a1eac,_0x348e11,!![]);}catch(_0x2585f8){return BPromise[_0xbf4d('0x20')](_0x2585f8);}return _0x5a1eac[_0xbf4d('0x21')]();};}function saveUpdates(_0x4580c0,_0x50371d){return function(_0x551a40){if(_0x551a40){return _0x551a40[_0xbf4d('0x22')](_0x4580c0)[_0xbf4d('0x23')](function(_0x2ad341){return _0x2ad341;});}return null;};}function removeEntity(_0x11613c,_0x20e0b5){return function(_0x2816c1){if(_0x2816c1){return _0x2816c1[_0xbf4d('0x24')]()[_0xbf4d('0x23')](function(){_0x11613c['status'](0xcc)[_0xbf4d('0x25')]();});}};}function handleEntityNotFound(_0x2281b7,_0x3337fb){return function(_0x226cc5){if(!_0x226cc5){_0x2281b7['sendStatus'](0x194);}return _0x226cc5;};}function handleError(_0x20bfbf,_0x297257){_0x297257=_0x297257||0x1f4;return function(_0x50a815){logger[_0xbf4d('0x26')](_0x50a815[_0xbf4d('0x27')]);if(_0x50a815[_0xbf4d('0x28')]){delete _0x50a815[_0xbf4d('0x28')];}_0x20bfbf['status'](_0x297257)[_0xbf4d('0x29')](_0x50a815);};}exports[_0xbf4d('0x2a')]=function(_0x26fc37,_0x59214c){var _0x27e261={},_0x1f1743={},_0xe8347d={'count':0x0,'rows':[]};var _0x30a597=_['map'](db[_0xbf4d('0x2b')]['rawAttributes'],function(_0x484260){return{'name':_0x484260['fieldName'],'type':_0x484260[_0xbf4d('0x2c')][_0xbf4d('0x2d')]};});_0x1f1743[_0xbf4d('0x2e')]=_[_0xbf4d('0x2f')](_0x30a597,'name');_0x1f1743[_0xbf4d('0x30')]=_[_0xbf4d('0x31')](_0x26fc37[_0xbf4d('0x30')]);_0x1f1743[_0xbf4d('0x32')]=_[_0xbf4d('0x33')](_0x1f1743['model'],_0x1f1743[_0xbf4d('0x30')]);_0x27e261[_0xbf4d('0x34')]=_[_0xbf4d('0x33')](_0x1f1743['model'],qs[_0xbf4d('0x35')](_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x35')]));_0x27e261[_0xbf4d('0x34')]=_0x27e261[_0xbf4d('0x34')][_0xbf4d('0x36')]?_0x27e261['attributes']:_0x1f1743[_0xbf4d('0x2e')];if(!_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x37')](_0xbf4d('0x38'))){_0x27e261[_0xbf4d('0x1e')]=qs[_0xbf4d('0x1e')](_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x1e')]);_0x27e261['offset']=qs[_0xbf4d('0x1c')](_0x26fc37[_0xbf4d('0x30')]['offset']);}_0x27e261['order']=qs[_0xbf4d('0x39')](_0x26fc37[_0xbf4d('0x30')]['sort']);_0x27e261[_0xbf4d('0x3a')]=qs[_0xbf4d('0x32')](_['pick'](_0x26fc37[_0xbf4d('0x30')],_0x1f1743['filters']),_0x30a597);if(_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x3b')]){_0x27e261[_0xbf4d('0x3a')]=_[_0xbf4d('0x3c')](_0x27e261[_0xbf4d('0x3a')],{'$or':_['map'](_0x30a597,function(_0x2e0a54){if(_0x2e0a54[_0xbf4d('0x2c')]!==_0xbf4d('0x3d')){var _0x4aeaef={};_0x4aeaef[_0x2e0a54[_0xbf4d('0x28')]]={'$like':'%'+_0x26fc37['query'][_0xbf4d('0x3b')]+'%'};return _0x4aeaef;}})});}_0x27e261=_[_0xbf4d('0x3c')]({},_0x27e261,_0x26fc37['options']);var _0x24c14b={'where':_0x27e261[_0xbf4d('0x3a')]};return db['MailSubstatus'][_0xbf4d('0x1d')](_0x24c14b)['then'](function(_0x1c2768){_0xe8347d[_0xbf4d('0x1d')]=_0x1c2768;if(_0x26fc37[_0xbf4d('0x30')][_0xbf4d('0x3e')]){_0x27e261['include']=[{'all':!![]}];}return db[_0xbf4d('0x2b')]['findAll'](_0x27e261);})[_0xbf4d('0x23')](function(_0x29c922){_0xe8347d[_0xbf4d('0x3f')]=_0x29c922;return _0xe8347d;})[_0xbf4d('0x23')](respondWithFilteredResult(_0x59214c,_0x27e261))['catch'](handleError(_0x59214c,null));};exports[_0xbf4d('0x40')]=function(_0x4ff719,_0x2787e2){var _0xd4ee25={'raw':!![],'where':{'id':_0x4ff719[_0xbf4d('0x41')]['id']}},_0x21bf5c={};_0x21bf5c[_0xbf4d('0x2e')]=_[_0xbf4d('0x31')](db[_0xbf4d('0x2b')]['rawAttributes']);_0x21bf5c['query']=_['keys'](_0x4ff719[_0xbf4d('0x30')]);_0x21bf5c[_0xbf4d('0x32')]=_[_0xbf4d('0x33')](_0x21bf5c[_0xbf4d('0x2e')],_0x21bf5c[_0xbf4d('0x30')]);_0xd4ee25[_0xbf4d('0x34')]=_[_0xbf4d('0x33')](_0x21bf5c[_0xbf4d('0x2e')],qs[_0xbf4d('0x35')](_0x4ff719[_0xbf4d('0x30')][_0xbf4d('0x35')]));_0xd4ee25[_0xbf4d('0x34')]=_0xd4ee25[_0xbf4d('0x34')][_0xbf4d('0x36')]?_0xd4ee25[_0xbf4d('0x34')]:_0x21bf5c['model'];if(_0x4ff719['query'][_0xbf4d('0x3e')]){_0xd4ee25[_0xbf4d('0x42')]=[{'all':!![]}];}_0xd4ee25=_[_0xbf4d('0x3c')]({},_0xd4ee25,_0x4ff719[_0xbf4d('0x43')]);return db['MailSubstatus'][_0xbf4d('0x44')](_0xd4ee25)[_0xbf4d('0x23')](handleEntityNotFound(_0x2787e2,null))[_0xbf4d('0x23')](respondWithResult(_0x2787e2,null))[_0xbf4d('0x45')](handleError(_0x2787e2,null));};exports['create']=function(_0x1ff252,_0x734027){return db[_0xbf4d('0x2b')]['create'](_0x1ff252['body'],{})[_0xbf4d('0x23')](respondWithResult(_0x734027,0xc9))['catch'](handleError(_0x734027,null));};exports[_0xbf4d('0x22')]=function(_0x5183c0,_0x105a81){if(_0x5183c0[_0xbf4d('0x46')]['id']){delete _0x5183c0[_0xbf4d('0x46')]['id'];}return db[_0xbf4d('0x2b')][_0xbf4d('0x44')]({'where':{'id':_0x5183c0[_0xbf4d('0x41')]['id']}})[_0xbf4d('0x23')](handleEntityNotFound(_0x105a81,null))['then'](saveUpdates(_0x5183c0[_0xbf4d('0x46')],null))[_0xbf4d('0x23')](respondWithResult(_0x105a81,null))[_0xbf4d('0x45')](handleError(_0x105a81,null));};exports[_0xbf4d('0x24')]=function(_0x175284,_0x457597){return db[_0xbf4d('0x2b')]['find']({'where':{'id':_0x175284[_0xbf4d('0x41')]['id']}})[_0xbf4d('0x23')](handleEntityNotFound(_0x457597,null))[_0xbf4d('0x23')](removeEntity(_0x457597,null))[_0xbf4d('0x45')](handleError(_0x457597,null));};exports[_0xbf4d('0x47')]=function(_0x377f9c,_0x314ea8){return db['MailSubstatus'][_0xbf4d('0x47')]()[_0xbf4d('0x23')](respondWithResult(_0x314ea8,null))[_0xbf4d('0x45')](handleError(_0x314ea8,null));}; \ No newline at end of file +var _0x89f0=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','set','apply','save','update','then','destroy','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','pick','filter','where','merge','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x89f0,0x1af));var _0x089f=function(_0x5970d7,_0x1d87a0){_0x5970d7=_0x5970d7-0x0;var _0x53691e=_0x89f0[_0x5970d7];return _0x53691e;};'use strict';var emlformat=require(_0x089f('0x0'));var rimraf=require(_0x089f('0x1'));var zipdir=require(_0x089f('0x2'));var jsonpatch=require(_0x089f('0x3'));var rp=require(_0x089f('0x4'));var moment=require(_0x089f('0x5'));var BPromise=require(_0x089f('0x6'));var Mustache=require('mustache');var util=require(_0x089f('0x7'));var path=require(_0x089f('0x8'));var sox=require(_0x089f('0x9'));var csv=require(_0x089f('0xa'));var ejs=require(_0x089f('0xb'));var fs=require('fs');var fs_extra=require(_0x089f('0xc'));var _=require(_0x089f('0xd'));var squel=require(_0x089f('0xe'));var crypto=require(_0x089f('0xf'));var jsforce=require(_0x089f('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x089f('0xa'));var querystring=require(_0x089f('0x11'));var Papa=require('papaparse');var Redis=require(_0x089f('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x089f('0x13'));var hardwareService=require(_0x089f('0x14'));var logger=require(_0x089f('0x15'))(_0x089f('0x16'));var utils=require('../../config/utils');var config=require(_0x089f('0x17'));var licenseUtil=require(_0x089f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9b52c0,_0x1ca921){_0x1ca921=_0x1ca921||0xcc;return function(_0x2fe961){if(_0x2fe961){return _0x9b52c0['sendStatus'](_0x1ca921);}return _0x9b52c0[_0x089f('0x19')](_0x1ca921)[_0x089f('0x1a')]();};}function respondWithResult(_0x1f8d8c,_0x51dce5){_0x51dce5=_0x51dce5||0xc8;return function(_0x1026ee){if(_0x1026ee){return _0x1f8d8c[_0x089f('0x19')](_0x51dce5)[_0x089f('0x1b')](_0x1026ee);}};}function respondWithFilteredResult(_0x4a062c,_0x2ec329){return function(_0x1ad76e){if(_0x1ad76e){var _0x1e1115=typeof _0x2ec329[_0x089f('0x1c')]===_0x089f('0x1d')&&typeof _0x2ec329['limit']==='undefined';var _0x19a08d=_0x1ad76e[_0x089f('0x1e')];var _0x1c9369=_0x1e1115?0x0:_0x2ec329['offset'];var _0x162984=_0x1e1115?_0x1ad76e[_0x089f('0x1e')]:_0x2ec329[_0x089f('0x1c')]+_0x2ec329['limit'];var _0x48e917;if(_0x162984>=_0x19a08d){_0x162984=_0x19a08d;_0x48e917=0xc8;}else{_0x48e917=0xce;}_0x4a062c[_0x089f('0x19')](_0x48e917);return _0x4a062c[_0x089f('0x1f')]('Content-Range',_0x1c9369+'-'+_0x162984+'/'+_0x19a08d)[_0x089f('0x1b')](_0x1ad76e);}return null;};}function patchUpdates(_0x949a80){return function(_0x58c42a){try{jsonpatch[_0x089f('0x20')](_0x58c42a,_0x949a80,!![]);}catch(_0x57113c){return BPromise['reject'](_0x57113c);}return _0x58c42a[_0x089f('0x21')]();};}function saveUpdates(_0x20422a,_0x25a694){return function(_0x33eb90){if(_0x33eb90){return _0x33eb90[_0x089f('0x22')](_0x20422a)[_0x089f('0x23')](function(_0x232fdf){return _0x232fdf;});}return null;};}function removeEntity(_0x28bb2a,_0x136506){return function(_0x3318f8){if(_0x3318f8){return _0x3318f8[_0x089f('0x24')]()[_0x089f('0x23')](function(){_0x28bb2a[_0x089f('0x19')](0xcc)[_0x089f('0x1a')]();});}};}function handleEntityNotFound(_0x17c70b,_0xf298c7){return function(_0xc51950){if(!_0xc51950){_0x17c70b['sendStatus'](0x194);}return _0xc51950;};}function handleError(_0x17cd59,_0x443362){_0x443362=_0x443362||0x1f4;return function(_0x435187){logger['error'](_0x435187[_0x089f('0x25')]);if(_0x435187[_0x089f('0x26')]){delete _0x435187[_0x089f('0x26')];}_0x17cd59[_0x089f('0x19')](_0x443362)[_0x089f('0x27')](_0x435187);};}exports[_0x089f('0x28')]=function(_0x5eb8fd,_0x3cfe8f){var _0x58d644={},_0x2978f4={},_0x488c7d={'count':0x0,'rows':[]};var _0x480043=_[_0x089f('0x29')](db[_0x089f('0x2a')][_0x089f('0x2b')],function(_0x92b166){return{'name':_0x92b166[_0x089f('0x2c')],'type':_0x92b166[_0x089f('0x2d')][_0x089f('0x2e')]};});_0x2978f4[_0x089f('0x2f')]=_[_0x089f('0x29')](_0x480043,'name');_0x2978f4['query']=_[_0x089f('0x30')](_0x5eb8fd[_0x089f('0x31')]);_0x2978f4[_0x089f('0x32')]=_['intersection'](_0x2978f4[_0x089f('0x2f')],_0x2978f4['query']);_0x58d644[_0x089f('0x33')]=_[_0x089f('0x34')](_0x2978f4[_0x089f('0x2f')],qs[_0x089f('0x35')](_0x5eb8fd[_0x089f('0x31')][_0x089f('0x35')]));_0x58d644[_0x089f('0x33')]=_0x58d644[_0x089f('0x33')][_0x089f('0x36')]?_0x58d644[_0x089f('0x33')]:_0x2978f4[_0x089f('0x2f')];if(!_0x5eb8fd[_0x089f('0x31')][_0x089f('0x37')]('nolimit')){_0x58d644[_0x089f('0x38')]=qs['limit'](_0x5eb8fd[_0x089f('0x31')][_0x089f('0x38')]);_0x58d644['offset']=qs[_0x089f('0x1c')](_0x5eb8fd[_0x089f('0x31')][_0x089f('0x1c')]);}_0x58d644[_0x089f('0x39')]=qs['sort'](_0x5eb8fd[_0x089f('0x31')]['sort']);_0x58d644['where']=qs['filters'](_[_0x089f('0x3a')](_0x5eb8fd[_0x089f('0x31')],_0x2978f4['filters']),_0x480043);if(_0x5eb8fd[_0x089f('0x31')][_0x089f('0x3b')]){_0x58d644[_0x089f('0x3c')]=_[_0x089f('0x3d')](_0x58d644[_0x089f('0x3c')],{'$or':_[_0x089f('0x29')](_0x480043,function(_0x5769a1){if(_0x5769a1[_0x089f('0x2d')]!=='VIRTUAL'){var _0x4e5429={};_0x4e5429[_0x5769a1['name']]={'$like':'%'+_0x5eb8fd[_0x089f('0x31')]['filter']+'%'};return _0x4e5429;}})});}_0x58d644=_[_0x089f('0x3d')]({},_0x58d644,_0x5eb8fd['options']);var _0x508f9f={'where':_0x58d644['where']};return db[_0x089f('0x2a')][_0x089f('0x1e')](_0x508f9f)[_0x089f('0x23')](function(_0x2ba2f1){_0x488c7d['count']=_0x2ba2f1;if(_0x5eb8fd[_0x089f('0x31')][_0x089f('0x3e')]){_0x58d644[_0x089f('0x3f')]=[{'all':!![]}];}return db[_0x089f('0x2a')][_0x089f('0x40')](_0x58d644);})['then'](function(_0x315ee6){_0x488c7d['rows']=_0x315ee6;return _0x488c7d;})[_0x089f('0x23')](respondWithFilteredResult(_0x3cfe8f,_0x58d644))['catch'](handleError(_0x3cfe8f,null));};exports[_0x089f('0x41')]=function(_0x328c70,_0x36c13b){var _0x177849={'raw':!![],'where':{'id':_0x328c70[_0x089f('0x42')]['id']}},_0x4ff22b={};_0x4ff22b[_0x089f('0x2f')]=_[_0x089f('0x30')](db[_0x089f('0x2a')][_0x089f('0x2b')]);_0x4ff22b[_0x089f('0x31')]=_[_0x089f('0x30')](_0x328c70[_0x089f('0x31')]);_0x4ff22b[_0x089f('0x32')]=_[_0x089f('0x34')](_0x4ff22b[_0x089f('0x2f')],_0x4ff22b[_0x089f('0x31')]);_0x177849[_0x089f('0x33')]=_[_0x089f('0x34')](_0x4ff22b[_0x089f('0x2f')],qs[_0x089f('0x35')](_0x328c70[_0x089f('0x31')][_0x089f('0x35')]));_0x177849[_0x089f('0x33')]=_0x177849[_0x089f('0x33')][_0x089f('0x36')]?_0x177849['attributes']:_0x4ff22b[_0x089f('0x2f')];if(_0x328c70[_0x089f('0x31')][_0x089f('0x3e')]){_0x177849[_0x089f('0x3f')]=[{'all':!![]}];}_0x177849=_[_0x089f('0x3d')]({},_0x177849,_0x328c70[_0x089f('0x43')]);return db[_0x089f('0x2a')][_0x089f('0x44')](_0x177849)['then'](handleEntityNotFound(_0x36c13b,null))[_0x089f('0x23')](respondWithResult(_0x36c13b,null))[_0x089f('0x45')](handleError(_0x36c13b,null));};exports[_0x089f('0x46')]=function(_0x440d4b,_0x4e1090){return db[_0x089f('0x2a')]['create'](_0x440d4b[_0x089f('0x47')],{})[_0x089f('0x23')](respondWithResult(_0x4e1090,0xc9))[_0x089f('0x45')](handleError(_0x4e1090,null));};exports[_0x089f('0x22')]=function(_0x1c0e90,_0xa01067){if(_0x1c0e90['body']['id']){delete _0x1c0e90[_0x089f('0x47')]['id'];}return db[_0x089f('0x2a')][_0x089f('0x44')]({'where':{'id':_0x1c0e90['params']['id']}})['then'](handleEntityNotFound(_0xa01067,null))[_0x089f('0x23')](saveUpdates(_0x1c0e90[_0x089f('0x47')],null))['then'](respondWithResult(_0xa01067,null))[_0x089f('0x45')](handleError(_0xa01067,null));};exports[_0x089f('0x24')]=function(_0x291570,_0x19c290){return db['MailSubstatus'][_0x089f('0x44')]({'where':{'id':_0x291570[_0x089f('0x42')]['id']}})[_0x089f('0x23')](handleEntityNotFound(_0x19c290,null))[_0x089f('0x23')](removeEntity(_0x19c290,null))[_0x089f('0x45')](handleError(_0x19c290,null));};exports[_0x089f('0x48')]=function(_0x1170ce,_0x771421){return db[_0x089f('0x2a')][_0x089f('0x48')]()[_0x089f('0x23')](respondWithResult(_0x771421,null))[_0x089f('0x45')](handleError(_0x771421,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 771590a..cf94760 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 _0x6b49=['hasOwnProperty','exports','MailSubstatus','update','emit'];(function(_0x4a01f6,_0x4cdaa8){var _0x1a00e0=function(_0x274c93){while(--_0x274c93){_0x4a01f6['push'](_0x4a01f6['shift']());}};_0x1a00e0(++_0x4cdaa8);}(_0x6b49,0x1d3));var _0x96b4=function(_0x13b392,_0x3481f2){_0x13b392=_0x13b392-0x0;var _0x39db24=_0x6b49[_0x13b392];return _0x39db24;};'use strict';var EventEmitter=require('events');var MailSubstatus=require('../../mysqldb')['db'][_0x96b4('0x0')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x96b4('0x1')};function emitEvent(_0xcfca68){return function(_0x104b0e,_0x402fae,_0x201229){MailSubstatusEvents[_0x96b4('0x2')](_0xcfca68+':'+_0x104b0e['id'],_0x104b0e);MailSubstatusEvents[_0x96b4('0x2')](_0xcfca68,_0x104b0e);_0x201229(null);};}for(var e in events){if(events[_0x96b4('0x3')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x96b4('0x4')]=MailSubstatusEvents; \ No newline at end of file +var _0x89f5=['hook','exports','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x58c049,_0x166018){var _0x54671e=function(_0x3f8465){while(--_0x3f8465){_0x58c049['push'](_0x58c049['shift']());}};_0x54671e(++_0x166018);}(_0x89f5,0x1b2));var _0x589f=function(_0x263271,_0x402519){_0x263271=_0x263271-0x0;var _0x49e2ac=_0x89f5[_0x263271];return _0x49e2ac;};'use strict';var EventEmitter=require(_0x589f('0x0'));var MailSubstatus=require(_0x589f('0x1'))['db'][_0x589f('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x589f('0x3')](0x0);var events={'afterUpdate':_0x589f('0x4')};function emitEvent(_0x2ed42a){return function(_0x52576a,_0x495c8c,_0x4f2771){MailSubstatusEvents[_0x589f('0x5')](_0x2ed42a+':'+_0x52576a['id'],_0x52576a);MailSubstatusEvents[_0x589f('0x5')](_0x2ed42a,_0x52576a);_0x4f2771(null);};}for(var e in events){if(events[_0x589f('0x6')](e)){var event=events[e];MailSubstatus[_0x589f('0x7')](e,emitEvent(event));}}module[_0x589f('0x8')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 99bd896..51fd173 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 _0x10dc=['./mailSubstatus.attributes','exports','models','Condition','name','mailSubstatus','_previousDataValues','then','catch'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x10dc,0x90));var _0xc10d=function(_0x12399a,_0x2462c2){_0x12399a=_0x12399a-0x0;var _0x590db3=_0x10dc[_0x12399a];return _0x590db3;};'use strict';var attributes=require(_0xc10d('0x0'));module[_0xc10d('0x1')]=function(_0x379acd){var _0x30f4b6=_0x379acd[_0xc10d('0x2')];return _0x379acd['define']('MailSubstatus',attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x3687e3,_0x140715,_0x45911d){return _0x30f4b6[_0xc10d('0x3')]['update']({'value':_0x3687e3[_0xc10d('0x4')]},{'where':{'field':_0xc10d('0x5'),'value':_0x3687e3[_0xc10d('0x6')][_0xc10d('0x4')]}})[_0xc10d('0x7')](function(){_0x45911d();})[_0xc10d('0x8')](function(_0x1327d6){_0x45911d(_0x1327d6);});}}});}; \ No newline at end of file +var _0xd488=['Condition','update','name','catch','exports','define','MailSubstatus','mail_substatuses'];(function(_0xcb8fde,_0x24399c){var _0x16dd77=function(_0x27cab4){while(--_0x27cab4){_0xcb8fde['push'](_0xcb8fde['shift']());}};_0x16dd77(++_0x24399c);}(_0xd488,0x104));var _0x8d48=function(_0x1a7e4b,_0x2fbd40){_0x1a7e4b=_0x1a7e4b-0x0;var _0x37a8fd=_0xd488[_0x1a7e4b];return _0x37a8fd;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x8d48('0x0')]=function(_0x4e11b6){var _0x5c7c8e=_0x4e11b6['models'];return _0x4e11b6[_0x8d48('0x1')](_0x8d48('0x2'),attributes,{'tableName':_0x8d48('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x5d4217,_0x252d86,_0x41c590){return _0x5c7c8e[_0x8d48('0x4')][_0x8d48('0x5')]({'value':_0x5d4217['name']},{'where':{'field':'mailSubstatus','value':_0x5d4217['_previousDataValues'][_0x8d48('0x6')]}})['then'](function(){_0x41c590();})[_0x8d48('0x7')](function(_0x16c856){_0x41c590(_0x16c856);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4d89599..8789910 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 _0x6761=['../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','message','MailSubstatus,\x20%s,\x20%s','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x408339,_0xed63d4){var _0x28ceb4=function(_0x7b5f4e){while(--_0x7b5f4e){_0x408339['push'](_0x408339['shift']());}};_0x28ceb4(++_0xed63d4);}(_0x6761,0xc0));var _0x1676=function(_0x2a74e3,_0x58b6d6){_0x2a74e3=_0x2a74e3-0x0;var _0x450156=_0x6761[_0x2a74e3];return _0x450156;};'use strict';var _=require(_0x1676('0x0'));var util=require('util');var moment=require(_0x1676('0x1'));var BPromise=require(_0x1676('0x2'));var rs=require(_0x1676('0x3'));var fs=require('fs');var Redis=require(_0x1676('0x4'));var db=require(_0x1676('0x5'))['db'];var utils=require(_0x1676('0x6'));var logger=require(_0x1676('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1676('0x8'));var client=jayson[_0x1676('0x9')][_0x1676('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x591088,_0x4eccec,_0x406f7f){return new BPromise(function(_0x3df338,_0x58fb8e){return client['request'](_0x591088,_0x406f7f)[_0x1676('0xb')](function(_0x5e9b9e){logger[_0x1676('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x4eccec,_0x1676('0xd'));logger[_0x1676('0xe')](_0x1676('0xf'),_0x4eccec,'request\x20sent',JSON[_0x1676('0x10')](_0x5e9b9e));if(_0x5e9b9e[_0x1676('0x11')]){if(_0x5e9b9e['error']['code']===0x1f4){logger[_0x1676('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x4eccec,_0x5e9b9e[_0x1676('0x11')][_0x1676('0x12')]);return _0x58fb8e(_0x5e9b9e[_0x1676('0x11')]['message']);}logger[_0x1676('0x11')](_0x1676('0x13'),_0x4eccec,_0x5e9b9e['error'][_0x1676('0x12')]);return _0x3df338(_0x5e9b9e[_0x1676('0x11')][_0x1676('0x12')]);}else{logger[_0x1676('0xc')](_0x1676('0x13'),_0x4eccec,_0x1676('0xd'));_0x3df338(_0x5e9b9e[_0x1676('0x14')]['message']);}})[_0x1676('0x15')](function(_0x3d88fc){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x4eccec,_0x3d88fc);_0x58fb8e(_0x3d88fc);});});} \ No newline at end of file +var _0x0edf=['stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x445f32,_0x2a3234){var _0x12e86a=function(_0x477b65){while(--_0x477b65){_0x445f32['push'](_0x445f32['shift']());}};_0x12e86a(++_0x2a3234);}(_0x0edf,0x83));var _0xf0ed=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x0edf[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0xf0ed('0x0'));var util=require(_0xf0ed('0x1'));var moment=require(_0xf0ed('0x2'));var BPromise=require(_0xf0ed('0x3'));var rs=require(_0xf0ed('0x4'));var fs=require('fs');var Redis=require(_0xf0ed('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf0ed('0x6'))(_0xf0ed('0x7'));var config=require(_0xf0ed('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x193467,_0x121068,_0x48c5d5){return new BPromise(function(_0x2db0eb,_0x25fe37){return client['request'](_0x193467,_0x48c5d5)['then'](function(_0x41c751){logger[_0xf0ed('0x9')](_0xf0ed('0xa'),_0x121068,_0xf0ed('0xb'));logger[_0xf0ed('0xc')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x121068,_0xf0ed('0xb'),JSON[_0xf0ed('0xd')](_0x41c751));if(_0x41c751[_0xf0ed('0xe')]){if(_0x41c751['error'][_0xf0ed('0xf')]===0x1f4){logger[_0xf0ed('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x121068,_0x41c751[_0xf0ed('0xe')][_0xf0ed('0x10')]);return _0x25fe37(_0x41c751[_0xf0ed('0xe')][_0xf0ed('0x10')]);}logger[_0xf0ed('0xe')](_0xf0ed('0xa'),_0x121068,_0x41c751[_0xf0ed('0xe')]['message']);return _0x2db0eb(_0x41c751[_0xf0ed('0xe')]['message']);}else{logger[_0xf0ed('0x9')](_0xf0ed('0xa'),_0x121068,_0xf0ed('0xb'));_0x2db0eb(_0x41c751[_0xf0ed('0x11')][_0xf0ed('0x10')]);}})['catch'](function(_0x1f603d){logger[_0xf0ed('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x121068,_0x1f603d);_0x25fe37(_0x1f603d);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 3c9f03a..06d004e 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 _0xaaaf=['delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put'];(function(_0x2d1198,_0x37ddcc){var _0x88805f=function(_0x1fd073){while(--_0x1fd073){_0x2d1198['push'](_0x2d1198['shift']());}};_0x88805f(++_0x37ddcc);}(_0xaaaf,0x6c));var _0xfaaa=function(_0x575142,_0xd931de){_0x575142=_0x575142-0x0;var _0x5c8770=_0xaaaf[_0x575142];return _0x5c8770;};'use strict';var multer=require(_0xfaaa('0x0'));var util=require(_0xfaaa('0x1'));var path=require(_0xfaaa('0x2'));var timeout=require('connect-timeout');var express=require(_0xfaaa('0x3'));var router=express[_0xfaaa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfaaa('0x5'));var interaction=require(_0xfaaa('0x6'));var config=require('../../config/environment');var controller=require(_0xfaaa('0x7'));router[_0xfaaa('0x8')]('/',auth['isAuthenticated'](),controller[_0xfaaa('0x9')]);router[_0xfaaa('0x8')](_0xfaaa('0xa'),auth[_0xfaaa('0xb')](),controller[_0xfaaa('0xc')]);router[_0xfaaa('0x8')](_0xfaaa('0xd'),auth[_0xfaaa('0xb')](),controller[_0xfaaa('0xe')]);router[_0xfaaa('0xf')]('/',auth[_0xfaaa('0xb')](),controller[_0xfaaa('0x10')]);router[_0xfaaa('0x11')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfaaa('0x12')](_0xfaaa('0xd'),auth[_0xfaaa('0xb')](),controller[_0xfaaa('0x13')]);module[_0xfaaa('0x14')]=router; \ No newline at end of file +var _0x6b6a=['describe','/:id','isAuthenticated','show','put','update','delete','exports','util','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','/describe'];(function(_0x4c2195,_0x41dd48){var _0x36d211=function(_0x399eeb){while(--_0x399eeb){_0x4c2195['push'](_0x4c2195['shift']());}};_0x36d211(++_0x41dd48);}(_0x6b6a,0x158));var _0xa6b6=function(_0x4dbc76,_0x9a8d25){_0x4dbc76=_0x4dbc76-0x0;var _0x3f3d8f=_0x6b6a[_0x4dbc76];return _0x3f3d8f;};'use strict';var multer=require('multer');var util=require(_0xa6b6('0x0'));var path=require('path');var timeout=require(_0xa6b6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa6b6('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xa6b6('0x3'));var config=require(_0xa6b6('0x4'));var controller=require(_0xa6b6('0x5'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xa6b6('0x6')](_0xa6b6('0x7'),auth['isAuthenticated'](),controller[_0xa6b6('0x8')]);router[_0xa6b6('0x6')](_0xa6b6('0x9'),auth[_0xa6b6('0xa')](),controller[_0xa6b6('0xb')]);router['post']('/',auth[_0xa6b6('0xa')](),controller['create']);router[_0xa6b6('0xc')](_0xa6b6('0x9'),auth[_0xa6b6('0xa')](),controller[_0xa6b6('0xd')]);router[_0xa6b6('0xe')](_0xa6b6('0x9'),auth[_0xa6b6('0xa')](),controller['destroy']);module[_0xa6b6('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index d33e3fc..051a53d 100644 --- a/server/api/mailTransferReport/mailTransferReport.attributes.js +++ b/server/api/mailTransferReport/mailTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x1a1b93,_0x5d8eae){var _0x4c3ce0=function(_0x2a45ea){while(--_0x2a45ea){_0x1a1b93['push'](_0x1a1b93['shift']());}};_0x4c3ce0(++_0x5d8eae);}(_0x00bb,0x1d8));var _0xb00b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x00bb[_0x14add3];return _0x4a174f;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2defb5,_0x1cda14){var _0x229c53=function(_0x5dd408){while(--_0x5dd408){_0x2defb5['push'](_0x2defb5['shift']());}};_0x229c53(++_0x1cda14);}(_0xb43b,0x1b2));var _0xbb43=function(_0x141631,_0x5133e9){_0x141631=_0x141631-0x0;var _0x3863b4=_0xb43b[_0x141631];return _0x3863b4;};'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 diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index eeb7eaa..fb76895 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 _0x0f2e=['end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','MailTransferReport','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','order','sort','filter','where','VIRTUAL','merge','options','include','rows','catch','show','keys','includeAll','create','body','find','describe','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status'];(function(_0x42b54e,_0x5a194f){var _0x3f17cd=function(_0x54bd8a){while(--_0x54bd8a){_0x42b54e['push'](_0x42b54e['shift']());}};_0x3f17cd(++_0x5a194f);}(_0x0f2e,0x75));var _0xe0f2=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0x0f2e[_0x2714ec];return _0x2608e5;};'use strict';var emlformat=require(_0xe0f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe0f2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe0f2('0x2'));var moment=require('moment');var BPromise=require(_0xe0f2('0x3'));var Mustache=require(_0xe0f2('0x4'));var util=require('util');var path=require(_0xe0f2('0x5'));var sox=require(_0xe0f2('0x6'));var csv=require(_0xe0f2('0x7'));var ejs=require(_0xe0f2('0x8'));var fs=require('fs');var fs_extra=require(_0xe0f2('0x9'));var _=require(_0xe0f2('0xa'));var squel=require(_0xe0f2('0xb'));var crypto=require(_0xe0f2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe0f2('0xd'));var toCsv=require(_0xe0f2('0x7'));var querystring=require(_0xe0f2('0xe'));var Papa=require(_0xe0f2('0xf'));var Redis=require('ioredis');var authService=require(_0xe0f2('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0f2('0x11'))(_0xe0f2('0x12'));var utils=require(_0xe0f2('0x13'));var config=require(_0xe0f2('0x14'));var licenseUtil=require(_0xe0f2('0x15'));var db=require(_0xe0f2('0x16'))['db'];function respondWithStatusCode(_0x20c464,_0x2f0be2){_0x2f0be2=_0x2f0be2||0xcc;return function(_0x54065b){if(_0x54065b){return _0x20c464[_0xe0f2('0x17')](_0x2f0be2);}return _0x20c464[_0xe0f2('0x18')](_0x2f0be2)[_0xe0f2('0x19')]();};}function respondWithResult(_0x4fa0cc,_0x54e243){_0x54e243=_0x54e243||0xc8;return function(_0x5f56db){if(_0x5f56db){return _0x4fa0cc[_0xe0f2('0x18')](_0x54e243)[_0xe0f2('0x1a')](_0x5f56db);}};}function respondWithFilteredResult(_0x44260e,_0xb57309){return function(_0x229415){if(_0x229415){var _0x2b1fa9=typeof _0xb57309['offset']===_0xe0f2('0x1b')&&typeof _0xb57309[_0xe0f2('0x1c')]===_0xe0f2('0x1b');var _0x381803=_0x229415[_0xe0f2('0x1d')];var _0x478d00=_0x2b1fa9?0x0:_0xb57309[_0xe0f2('0x1e')];var _0x166ed1=_0x2b1fa9?_0x229415[_0xe0f2('0x1d')]:_0xb57309[_0xe0f2('0x1e')]+_0xb57309[_0xe0f2('0x1c')];var _0x5c4357;if(_0x166ed1>=_0x381803){_0x166ed1=_0x381803;_0x5c4357=0xc8;}else{_0x5c4357=0xce;}_0x44260e[_0xe0f2('0x18')](_0x5c4357);return _0x44260e[_0xe0f2('0x1f')](_0xe0f2('0x20'),_0x478d00+'-'+_0x166ed1+'/'+_0x381803)[_0xe0f2('0x1a')](_0x229415);}return null;};}function patchUpdates(_0x1012cc){return function(_0x53f374){try{jsonpatch[_0xe0f2('0x21')](_0x53f374,_0x1012cc,!![]);}catch(_0x254eff){return BPromise[_0xe0f2('0x22')](_0x254eff);}return _0x53f374['save']();};}function saveUpdates(_0xda10c3,_0x9551bd){return function(_0x41db6c){if(_0x41db6c){return _0x41db6c[_0xe0f2('0x23')](_0xda10c3)[_0xe0f2('0x24')](function(_0x562424){return _0x562424;});}return null;};}function removeEntity(_0x4c2c6e,_0x3bb01e){return function(_0x3fef0f){if(_0x3fef0f){return _0x3fef0f[_0xe0f2('0x25')]()['then'](function(){_0x4c2c6e[_0xe0f2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0011,_0x4eafa5){return function(_0xa896df){if(!_0xa896df){_0x4e0011[_0xe0f2('0x17')](0x194);}return _0xa896df;};}function handleError(_0x42abde,_0x82f4e3){_0x82f4e3=_0x82f4e3||0x1f4;return function(_0x54d859){logger[_0xe0f2('0x26')](_0x54d859[_0xe0f2('0x27')]);if(_0x54d859[_0xe0f2('0x28')]){delete _0x54d859['name'];}_0x42abde['status'](_0x82f4e3)['send'](_0x54d859);};}exports[_0xe0f2('0x29')]=function(_0x491c14,_0x4fedb5){var _0x25ba07={},_0x4d89de={},_0x3f7df3={'count':0x0,'rows':[]};var _0x396eb7=_['map'](db[_0xe0f2('0x2a')][_0xe0f2('0x2b')],function(_0x475096){return{'name':_0x475096[_0xe0f2('0x2c')],'type':_0x475096['type'][_0xe0f2('0x2d')]};});_0x4d89de[_0xe0f2('0x2e')]=_[_0xe0f2('0x2f')](_0x396eb7,'name');_0x4d89de[_0xe0f2('0x30')]=_['keys'](_0x491c14['query']);_0x4d89de[_0xe0f2('0x31')]=_[_0xe0f2('0x32')](_0x4d89de[_0xe0f2('0x2e')],_0x4d89de[_0xe0f2('0x30')]);_0x25ba07[_0xe0f2('0x33')]=_[_0xe0f2('0x32')](_0x4d89de[_0xe0f2('0x2e')],qs['fields'](_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x34')]));_0x25ba07[_0xe0f2('0x33')]=_0x25ba07[_0xe0f2('0x33')][_0xe0f2('0x35')]?_0x25ba07[_0xe0f2('0x33')]:_0x4d89de[_0xe0f2('0x2e')];if(!_0x491c14[_0xe0f2('0x30')]['hasOwnProperty']('nolimit')){_0x25ba07[_0xe0f2('0x1c')]=qs[_0xe0f2('0x1c')](_0x491c14[_0xe0f2('0x30')]['limit']);_0x25ba07[_0xe0f2('0x1e')]=qs[_0xe0f2('0x1e')](_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x1e')]);}_0x25ba07[_0xe0f2('0x36')]=qs['sort'](_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x37')]);_0x25ba07['where']=qs[_0xe0f2('0x31')](_['pick'](_0x491c14[_0xe0f2('0x30')],_0x4d89de[_0xe0f2('0x31')]),_0x396eb7);if(_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x38')]){_0x25ba07[_0xe0f2('0x39')]=_['merge'](_0x25ba07[_0xe0f2('0x39')],{'$or':_[_0xe0f2('0x2f')](_0x396eb7,function(_0x2170e2){if(_0x2170e2['type']!==_0xe0f2('0x3a')){var _0x19b8c0={};_0x19b8c0[_0x2170e2['name']]={'$like':'%'+_0x491c14[_0xe0f2('0x30')][_0xe0f2('0x38')]+'%'};return _0x19b8c0;}})});}_0x25ba07=_[_0xe0f2('0x3b')]({},_0x25ba07,_0x491c14[_0xe0f2('0x3c')]);var _0x1709a5={'where':_0x25ba07['where']};return db['MailTransferReport'][_0xe0f2('0x1d')](_0x1709a5)[_0xe0f2('0x24')](function(_0x2b5999){_0x3f7df3[_0xe0f2('0x1d')]=_0x2b5999;if(_0x491c14[_0xe0f2('0x30')]['includeAll']){_0x25ba07[_0xe0f2('0x3d')]=[{'all':!![]}];}return db[_0xe0f2('0x2a')]['findAll'](_0x25ba07);})[_0xe0f2('0x24')](function(_0x2784da){_0x3f7df3[_0xe0f2('0x3e')]=_0x2784da;return _0x3f7df3;})[_0xe0f2('0x24')](respondWithFilteredResult(_0x4fedb5,_0x25ba07))[_0xe0f2('0x3f')](handleError(_0x4fedb5,null));};exports[_0xe0f2('0x40')]=function(_0x1707fa,_0x48e1b7){var _0x1fa47f={'raw':!![],'where':{'id':_0x1707fa['params']['id']}},_0x8a8089={};_0x8a8089['model']=_[_0xe0f2('0x41')](db['MailTransferReport'][_0xe0f2('0x2b')]);_0x8a8089['query']=_[_0xe0f2('0x41')](_0x1707fa['query']);_0x8a8089[_0xe0f2('0x31')]=_[_0xe0f2('0x32')](_0x8a8089['model'],_0x8a8089[_0xe0f2('0x30')]);_0x1fa47f[_0xe0f2('0x33')]=_[_0xe0f2('0x32')](_0x8a8089[_0xe0f2('0x2e')],qs[_0xe0f2('0x34')](_0x1707fa[_0xe0f2('0x30')]['fields']));_0x1fa47f['attributes']=_0x1fa47f[_0xe0f2('0x33')]['length']?_0x1fa47f[_0xe0f2('0x33')]:_0x8a8089['model'];if(_0x1707fa[_0xe0f2('0x30')][_0xe0f2('0x42')]){_0x1fa47f[_0xe0f2('0x3d')]=[{'all':!![]}];}_0x1fa47f=_[_0xe0f2('0x3b')]({},_0x1fa47f,_0x1707fa[_0xe0f2('0x3c')]);return db[_0xe0f2('0x2a')]['find'](_0x1fa47f)[_0xe0f2('0x24')](handleEntityNotFound(_0x48e1b7,null))[_0xe0f2('0x24')](respondWithResult(_0x48e1b7,null))[_0xe0f2('0x3f')](handleError(_0x48e1b7,null));};exports['create']=function(_0x40db37,_0x474dc9){return db[_0xe0f2('0x2a')][_0xe0f2('0x43')](_0x40db37[_0xe0f2('0x44')],{})[_0xe0f2('0x24')](respondWithResult(_0x474dc9,0xc9))['catch'](handleError(_0x474dc9,null));};exports[_0xe0f2('0x23')]=function(_0x2f7e63,_0x2604f4){if(_0x2f7e63[_0xe0f2('0x44')]['id']){delete _0x2f7e63[_0xe0f2('0x44')]['id'];}return db[_0xe0f2('0x2a')][_0xe0f2('0x45')]({'where':{'id':_0x2f7e63['params']['id']}})[_0xe0f2('0x24')](handleEntityNotFound(_0x2604f4,null))[_0xe0f2('0x24')](saveUpdates(_0x2f7e63[_0xe0f2('0x44')],null))['then'](respondWithResult(_0x2604f4,null))[_0xe0f2('0x3f')](handleError(_0x2604f4,null));};exports['destroy']=function(_0x30e770,_0x58f4b1){return db[_0xe0f2('0x2a')][_0xe0f2('0x45')]({'where':{'id':_0x30e770['params']['id']}})[_0xe0f2('0x24')](handleEntityNotFound(_0x58f4b1,null))[_0xe0f2('0x24')](removeEntity(_0x58f4b1,null))['catch'](handleError(_0x58f4b1,null));};exports[_0xe0f2('0x46')]=function(_0x4869d3,_0x5858c1){return db[_0xe0f2('0x2a')][_0xe0f2('0x46')]()['then'](respondWithResult(_0x5858c1,null))[_0xe0f2('0x3f')](handleError(_0x5858c1,null));}; \ No newline at end of file +var _0xe099=['name','send','index','map','MailTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x3612d5,_0xba7292){var _0x2febbf=function(_0x15a004){while(--_0x15a004){_0x3612d5['push'](_0x3612d5['shift']());}};_0x2febbf(++_0xba7292);}(_0xe099,0xbd));var _0x9e09=function(_0x4e01e5,_0x300dec){_0x4e01e5=_0x4e01e5-0x0;var _0x3572fc=_0xe099[_0x4e01e5];return _0x3572fc;};'use strict';var emlformat=require(_0x9e09('0x0'));var rimraf=require(_0x9e09('0x1'));var zipdir=require(_0x9e09('0x2'));var jsonpatch=require(_0x9e09('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9e09('0x4'));var Mustache=require('mustache');var util=require(_0x9e09('0x5'));var path=require(_0x9e09('0x6'));var sox=require('sox');var csv=require(_0x9e09('0x7'));var ejs=require(_0x9e09('0x8'));var fs=require('fs');var fs_extra=require(_0x9e09('0x9'));var _=require(_0x9e09('0xa'));var squel=require(_0x9e09('0xb'));var crypto=require(_0x9e09('0xc'));var jsforce=require(_0x9e09('0xd'));var deskjs=require(_0x9e09('0xe'));var toCsv=require(_0x9e09('0x7'));var querystring=require('querystring');var Papa=require(_0x9e09('0xf'));var Redis=require(_0x9e09('0x10'));var authService=require(_0x9e09('0x11'));var qs=require(_0x9e09('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e09('0x13'))('api');var utils=require(_0x9e09('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9e09('0x15'));var db=require(_0x9e09('0x16'))['db'];function respondWithStatusCode(_0x212e21,_0x1a64b8){_0x1a64b8=_0x1a64b8||0xcc;return function(_0x96fa34){if(_0x96fa34){return _0x212e21[_0x9e09('0x17')](_0x1a64b8);}return _0x212e21[_0x9e09('0x18')](_0x1a64b8)[_0x9e09('0x19')]();};}function respondWithResult(_0x4f1d50,_0x2c8a71){_0x2c8a71=_0x2c8a71||0xc8;return function(_0x487465){if(_0x487465){return _0x4f1d50[_0x9e09('0x18')](_0x2c8a71)[_0x9e09('0x1a')](_0x487465);}};}function respondWithFilteredResult(_0x47f813,_0x24ca1f){return function(_0x436740){if(_0x436740){var _0x29d26c=typeof _0x24ca1f[_0x9e09('0x1b')]==='undefined'&&typeof _0x24ca1f[_0x9e09('0x1c')]==='undefined';var _0x534a2a=_0x436740[_0x9e09('0x1d')];var _0x58a91f=_0x29d26c?0x0:_0x24ca1f[_0x9e09('0x1b')];var _0x29baf9=_0x29d26c?_0x436740[_0x9e09('0x1d')]:_0x24ca1f['offset']+_0x24ca1f[_0x9e09('0x1c')];var _0x4ce8a1;if(_0x29baf9>=_0x534a2a){_0x29baf9=_0x534a2a;_0x4ce8a1=0xc8;}else{_0x4ce8a1=0xce;}_0x47f813[_0x9e09('0x18')](_0x4ce8a1);return _0x47f813[_0x9e09('0x1e')](_0x9e09('0x1f'),_0x58a91f+'-'+_0x29baf9+'/'+_0x534a2a)['json'](_0x436740);}return null;};}function patchUpdates(_0x548f96){return function(_0x3cc84c){try{jsonpatch[_0x9e09('0x20')](_0x3cc84c,_0x548f96,!![]);}catch(_0x1d19c9){return BPromise[_0x9e09('0x21')](_0x1d19c9);}return _0x3cc84c[_0x9e09('0x22')]();};}function saveUpdates(_0x1fffe4,_0x1d7072){return function(_0x34ec31){if(_0x34ec31){return _0x34ec31[_0x9e09('0x23')](_0x1fffe4)[_0x9e09('0x24')](function(_0x28b2c7){return _0x28b2c7;});}return null;};}function removeEntity(_0x794258,_0x28773c){return function(_0xf50689){if(_0xf50689){return _0xf50689['destroy']()[_0x9e09('0x24')](function(){_0x794258['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x239b6e,_0x3ca938){return function(_0x434081){if(!_0x434081){_0x239b6e['sendStatus'](0x194);}return _0x434081;};}function handleError(_0x1f4b66,_0x44c715){_0x44c715=_0x44c715||0x1f4;return function(_0x4aac48){logger[_0x9e09('0x25')](_0x4aac48[_0x9e09('0x26')]);if(_0x4aac48['name']){delete _0x4aac48[_0x9e09('0x27')];}_0x1f4b66[_0x9e09('0x18')](_0x44c715)[_0x9e09('0x28')](_0x4aac48);};}exports[_0x9e09('0x29')]=function(_0x594341,_0x347fcb){var _0xaa4381={},_0x55ba0d={},_0x406cd4={'count':0x0,'rows':[]};var _0x2e3774=_[_0x9e09('0x2a')](db[_0x9e09('0x2b')][_0x9e09('0x2c')],function(_0x38b215){return{'name':_0x38b215[_0x9e09('0x2d')],'type':_0x38b215[_0x9e09('0x2e')][_0x9e09('0x2f')]};});_0x55ba0d[_0x9e09('0x30')]=_['map'](_0x2e3774,'name');_0x55ba0d[_0x9e09('0x31')]=_[_0x9e09('0x32')](_0x594341[_0x9e09('0x31')]);_0x55ba0d[_0x9e09('0x33')]=_[_0x9e09('0x34')](_0x55ba0d[_0x9e09('0x30')],_0x55ba0d[_0x9e09('0x31')]);_0xaa4381[_0x9e09('0x35')]=_['intersection'](_0x55ba0d[_0x9e09('0x30')],qs['fields'](_0x594341[_0x9e09('0x31')][_0x9e09('0x36')]));_0xaa4381[_0x9e09('0x35')]=_0xaa4381[_0x9e09('0x35')][_0x9e09('0x37')]?_0xaa4381['attributes']:_0x55ba0d[_0x9e09('0x30')];if(!_0x594341[_0x9e09('0x31')][_0x9e09('0x38')](_0x9e09('0x39'))){_0xaa4381[_0x9e09('0x1c')]=qs[_0x9e09('0x1c')](_0x594341['query'][_0x9e09('0x1c')]);_0xaa4381[_0x9e09('0x1b')]=qs[_0x9e09('0x1b')](_0x594341['query'][_0x9e09('0x1b')]);}_0xaa4381[_0x9e09('0x3a')]=qs[_0x9e09('0x3b')](_0x594341[_0x9e09('0x31')][_0x9e09('0x3b')]);_0xaa4381[_0x9e09('0x3c')]=qs['filters'](_['pick'](_0x594341[_0x9e09('0x31')],_0x55ba0d[_0x9e09('0x33')]),_0x2e3774);if(_0x594341[_0x9e09('0x31')]['filter']){_0xaa4381[_0x9e09('0x3c')]=_[_0x9e09('0x3d')](_0xaa4381[_0x9e09('0x3c')],{'$or':_[_0x9e09('0x2a')](_0x2e3774,function(_0x4d082a){if(_0x4d082a[_0x9e09('0x2e')]!==_0x9e09('0x3e')){var _0x137990={};_0x137990[_0x4d082a[_0x9e09('0x27')]]={'$like':'%'+_0x594341[_0x9e09('0x31')]['filter']+'%'};return _0x137990;}})});}_0xaa4381=_[_0x9e09('0x3d')]({},_0xaa4381,_0x594341[_0x9e09('0x3f')]);var _0x206abd={'where':_0xaa4381[_0x9e09('0x3c')]};return db[_0x9e09('0x2b')][_0x9e09('0x1d')](_0x206abd)[_0x9e09('0x24')](function(_0x3557d0){_0x406cd4[_0x9e09('0x1d')]=_0x3557d0;if(_0x594341[_0x9e09('0x31')][_0x9e09('0x40')]){_0xaa4381[_0x9e09('0x41')]=[{'all':!![]}];}return db[_0x9e09('0x2b')][_0x9e09('0x42')](_0xaa4381);})[_0x9e09('0x24')](function(_0x5b3563){_0x406cd4[_0x9e09('0x43')]=_0x5b3563;return _0x406cd4;})['then'](respondWithFilteredResult(_0x347fcb,_0xaa4381))[_0x9e09('0x44')](handleError(_0x347fcb,null));};exports[_0x9e09('0x45')]=function(_0x26a54d,_0x4afcd1){var _0xb99733={'raw':!![],'where':{'id':_0x26a54d[_0x9e09('0x46')]['id']}},_0x5e708b={};_0x5e708b['model']=_[_0x9e09('0x32')](db[_0x9e09('0x2b')][_0x9e09('0x2c')]);_0x5e708b[_0x9e09('0x31')]=_[_0x9e09('0x32')](_0x26a54d[_0x9e09('0x31')]);_0x5e708b[_0x9e09('0x33')]=_[_0x9e09('0x34')](_0x5e708b[_0x9e09('0x30')],_0x5e708b[_0x9e09('0x31')]);_0xb99733[_0x9e09('0x35')]=_[_0x9e09('0x34')](_0x5e708b[_0x9e09('0x30')],qs['fields'](_0x26a54d['query'][_0x9e09('0x36')]));_0xb99733[_0x9e09('0x35')]=_0xb99733['attributes'][_0x9e09('0x37')]?_0xb99733[_0x9e09('0x35')]:_0x5e708b[_0x9e09('0x30')];if(_0x26a54d['query']['includeAll']){_0xb99733[_0x9e09('0x41')]=[{'all':!![]}];}_0xb99733=_['merge']({},_0xb99733,_0x26a54d[_0x9e09('0x3f')]);return db[_0x9e09('0x2b')][_0x9e09('0x47')](_0xb99733)[_0x9e09('0x24')](handleEntityNotFound(_0x4afcd1,null))['then'](respondWithResult(_0x4afcd1,null))[_0x9e09('0x44')](handleError(_0x4afcd1,null));};exports[_0x9e09('0x48')]=function(_0x41ef06,_0x5e5f09){return db[_0x9e09('0x2b')][_0x9e09('0x48')](_0x41ef06['body'],{})[_0x9e09('0x24')](respondWithResult(_0x5e5f09,0xc9))[_0x9e09('0x44')](handleError(_0x5e5f09,null));};exports[_0x9e09('0x23')]=function(_0x28dac7,_0x422128){if(_0x28dac7[_0x9e09('0x49')]['id']){delete _0x28dac7['body']['id'];}return db[_0x9e09('0x2b')][_0x9e09('0x47')]({'where':{'id':_0x28dac7[_0x9e09('0x46')]['id']}})[_0x9e09('0x24')](handleEntityNotFound(_0x422128,null))[_0x9e09('0x24')](saveUpdates(_0x28dac7['body'],null))[_0x9e09('0x24')](respondWithResult(_0x422128,null))[_0x9e09('0x44')](handleError(_0x422128,null));};exports[_0x9e09('0x4a')]=function(_0x2f878a,_0x88c645){return db[_0x9e09('0x2b')][_0x9e09('0x47')]({'where':{'id':_0x2f878a[_0x9e09('0x46')]['id']}})[_0x9e09('0x24')](handleEntityNotFound(_0x88c645,null))['then'](removeEntity(_0x88c645,null))[_0x9e09('0x44')](handleError(_0x88c645,null));};exports[_0x9e09('0x4b')]=function(_0x430640,_0x1bb9ed){return db[_0x9e09('0x2b')]['describe']()['then'](respondWithResult(_0x1bb9ed,null))[_0x9e09('0x44')](handleError(_0x1bb9ed,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index a68759c..7b6a8c0 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 _0x70d8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer'];(function(_0x4ad867,_0xb1f4ad){var _0x1f5cb6=function(_0x32d4ce){while(--_0x32d4ce){_0x4ad867['push'](_0x4ad867['shift']());}};_0x1f5cb6(++_0xb1f4ad);}(_0x70d8,0xa9));var _0x870d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x70d8[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x870d('0x0'));var util=require(_0x870d('0x1'));var logger=require(_0x870d('0x2'))(_0x870d('0x3'));var moment=require(_0x870d('0x4'));var BPromise=require(_0x870d('0x5'));var rp=require(_0x870d('0x6'));var fs=require('fs');var path=require(_0x870d('0x7'));var rimraf=require(_0x870d('0x8'));var config=require('../../config/environment');var attributes=require(_0x870d('0x9'));module['exports']=function(_0x5b131d,_0x161ad6){return _0x5b131d[_0x870d('0xa')](_0x870d('0xb'),attributes,{'tableName':_0x870d('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x80d9=['request-promise','path','rimraf','../../config/environment','./mailTransferReport.attributes','report_mail_transfer','uniqueid','lodash','../../config/logger','api','moment'];(function(_0xdb3813,_0x3af352){var _0x47e29f=function(_0x4077fa){while(--_0x4077fa){_0xdb3813['push'](_0xdb3813['shift']());}};_0x47e29f(++_0x3af352);}(_0x80d9,0x15c));var _0x980d=function(_0x278bfa,_0xd3eb7f){_0x278bfa=_0x278bfa-0x0;var _0x819e56=_0x80d9[_0x278bfa];return _0x819e56;};'use strict';var _=require(_0x980d('0x0'));var util=require('util');var logger=require(_0x980d('0x1'))(_0x980d('0x2'));var moment=require(_0x980d('0x3'));var BPromise=require('bluebird');var rp=require(_0x980d('0x4'));var fs=require('fs');var path=require(_0x980d('0x5'));var rimraf=require(_0x980d('0x6'));var config=require(_0x980d('0x7'));var attributes=require(_0x980d('0x8'));module['exports']=function(_0x4c3533,_0x2fd4b9){return _0x4c3533['define']('MailTransferReport',attributes,{'tableName':_0x980d('0x9'),'paranoid':![],'indexes':[{'name':_0x980d('0xa'),'fields':[_0x980d('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 5b5c487..bea7421 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 _0x733d=['then','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client'];(function(_0x2a690a,_0x4afc04){var _0x8ba65a=function(_0x84d6ce){while(--_0x84d6ce){_0x2a690a['push'](_0x2a690a['shift']());}};_0x8ba65a(++_0x4afc04);}(_0x733d,0x186));var _0xd733=function(_0x285ba,_0x1f8fe8){_0x285ba=_0x285ba-0x0;var _0x279a75=_0x733d[_0x285ba];return _0x279a75;};'use strict';var _=require('lodash');var util=require(_0xd733('0x0'));var moment=require(_0xd733('0x1'));var BPromise=require(_0xd733('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd733('0x3'));var db=require(_0xd733('0x4'))['db'];var utils=require(_0xd733('0x5'));var logger=require(_0xd733('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd733('0x7'));var client=jayson[_0xd733('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d9090,_0x217820,_0x2d6ac5){return new BPromise(function(_0x12f1f6,_0x2d66a3){return client['request'](_0x2d9090,_0x2d6ac5)[_0xd733('0x9')](function(_0x3c40b1){logger['info'](_0xd733('0xa'),_0x217820,'request\x20sent');logger[_0xd733('0xb')](_0xd733('0xc'),_0x217820,_0xd733('0xd'),JSON[_0xd733('0xe')](_0x3c40b1));if(_0x3c40b1[_0xd733('0xf')]){if(_0x3c40b1[_0xd733('0xf')][_0xd733('0x10')]===0x1f4){logger[_0xd733('0xf')](_0xd733('0xa'),_0x217820,_0x3c40b1['error'][_0xd733('0x11')]);return _0x2d66a3(_0x3c40b1[_0xd733('0xf')]['message']);}logger['error'](_0xd733('0xa'),_0x217820,_0x3c40b1['error'][_0xd733('0x11')]);return _0x12f1f6(_0x3c40b1[_0xd733('0xf')][_0xd733('0x11')]);}else{logger[_0xd733('0x12')](_0xd733('0xa'),_0x217820,_0xd733('0xd'));_0x12f1f6(_0x3c40b1[_0xd733('0x13')][_0xd733('0x11')]);}})[_0xd733('0x14')](function(_0x32c7a0){logger[_0xd733('0xf')](_0xd733('0xa'),_0x217820,_0x32c7a0);_0x2d66a3(_0x32c7a0);});});} \ No newline at end of file +var _0x719b=['info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x44737b,_0x116026){var _0x139a9a=function(_0x9bedbf){while(--_0x9bedbf){_0x44737b['push'](_0x44737b['shift']());}};_0x139a9a(++_0x116026);}(_0x719b,0x173));var _0xb719=function(_0x5dde61,_0x48d7d1){_0x5dde61=_0x5dde61-0x0;var _0x283467=_0x719b[_0x5dde61];return _0x283467;};'use strict';var _=require(_0xb719('0x0'));var util=require(_0xb719('0x1'));var moment=require(_0xb719('0x2'));var BPromise=require(_0xb719('0x3'));var rs=require(_0xb719('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb719('0x5'))['db'];var utils=require(_0xb719('0x6'));var logger=require(_0xb719('0x7'))(_0xb719('0x8'));var config=require(_0xb719('0x9'));var jayson=require(_0xb719('0xa'));var client=jayson[_0xb719('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc9d774,_0xb2fe74,_0x21b3f1){return new BPromise(function(_0x1b1c03,_0x48f7cc){return client[_0xb719('0xc')](_0xc9d774,_0x21b3f1)['then'](function(_0x50927b){logger[_0xb719('0xd')](_0xb719('0xe'),_0xb2fe74,_0xb719('0xf'));logger[_0xb719('0x10')](_0xb719('0x11'),_0xb2fe74,_0xb719('0xf'),JSON[_0xb719('0x12')](_0x50927b));if(_0x50927b['error']){if(_0x50927b['error'][_0xb719('0x13')]===0x1f4){logger[_0xb719('0x14')](_0xb719('0xe'),_0xb2fe74,_0x50927b[_0xb719('0x14')]['message']);return _0x48f7cc(_0x50927b[_0xb719('0x14')][_0xb719('0x15')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0xb2fe74,_0x50927b[_0xb719('0x14')][_0xb719('0x15')]);return _0x1b1c03(_0x50927b[_0xb719('0x14')][_0xb719('0x15')]);}else{logger['info'](_0xb719('0xe'),_0xb2fe74,'request\x20sent');_0x1b1c03(_0x50927b[_0xb719('0x16')][_0xb719('0x15')]);}})[_0xb719('0x17')](function(_0x1e8635){logger[_0xb719('0x14')]('MailTransferReport,\x20%s,\x20%s',_0xb2fe74,_0x1e8635);_0x48f7cc(_0x1e8635);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 6d5a5af..846a14a 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 _0x0902=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','update','delete','destroy'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x0902,0x1a3));var _0x2090=function(_0x2c3201,_0x1f76ff){_0x2c3201=_0x2c3201-0x0;var _0x564fc4=_0x0902[_0x2c3201];return _0x564fc4;};'use strict';var multer=require(_0x2090('0x0'));var util=require('util');var path=require(_0x2090('0x1'));var timeout=require(_0x2090('0x2'));var express=require(_0x2090('0x3'));var router=express[_0x2090('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2090('0x5'));var interaction=require(_0x2090('0x6'));var config=require(_0x2090('0x7'));var controller=require(_0x2090('0x8'));router[_0x2090('0x9')]('/',auth[_0x2090('0xa')](),controller[_0x2090('0xb')]);router[_0x2090('0x9')](_0x2090('0xc'),auth['isAuthenticated'](),controller[_0x2090('0xd')]);router[_0x2090('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2090('0xe')]);router['post']('/',auth[_0x2090('0xa')](),controller[_0x2090('0xf')]);router[_0x2090('0x10')](_0x2090('0x11'),auth[_0x2090('0xa')](),controller[_0x2090('0x12')]);router[_0x2090('0x13')](_0x2090('0x11'),auth[_0x2090('0xa')](),controller[_0x2090('0x14')]);module[_0x2090('0x15')]=router; \ No newline at end of file +var _0x6dae=['delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update'];(function(_0x2ec86d,_0x20bf38){var _0xdc538e=function(_0x34035e){while(--_0x34035e){_0x2ec86d['push'](_0x2ec86d['shift']());}};_0xdc538e(++_0x20bf38);}(_0x6dae,0x1e1));var _0xe6da=function(_0x36a3af,_0x13b630){_0x36a3af=_0x36a3af-0x0;var _0xa65201=_0x6dae[_0x36a3af];return _0xa65201;};'use strict';var multer=require(_0xe6da('0x0'));var util=require('util');var path=require(_0xe6da('0x1'));var timeout=require(_0xe6da('0x2'));var express=require(_0xe6da('0x3'));var router=express[_0xe6da('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe6da('0x5'));var interaction=require(_0xe6da('0x6'));var config=require(_0xe6da('0x7'));var controller=require(_0xe6da('0x8'));router[_0xe6da('0x9')]('/',auth[_0xe6da('0xa')](),controller[_0xe6da('0xb')]);router[_0xe6da('0x9')](_0xe6da('0xc'),auth[_0xe6da('0xa')](),controller[_0xe6da('0xd')]);router[_0xe6da('0x9')](_0xe6da('0xe'),auth[_0xe6da('0xa')](),controller['show']);router[_0xe6da('0xf')]('/',auth[_0xe6da('0xa')](),controller[_0xe6da('0x10')]);router[_0xe6da('0x11')](_0xe6da('0xe'),auth[_0xe6da('0xa')](),controller[_0xe6da('0x12')]);router[_0xe6da('0x13')](_0xe6da('0xe'),auth[_0xe6da('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 306e1f2..9b6a989 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 _0x5011=['sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','diff','seconds','setDataValue','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x385cda,_0x2e32d1){var _0x5488b7=function(_0x1e8bfc){while(--_0x1e8bfc){_0x385cda['push'](_0x385cda['shift']());}};_0x5488b7(++_0x2e32d1);}(_0x5011,0x10e));var _0x1501=function(_0x2b35ca,_0x4943ce){_0x2b35ca=_0x2b35ca-0x0;var _0x68389e=_0x5011[_0x2b35ca];return _0x68389e;};'use strict';var Sequelize=require(_0x1501('0x0'));var moment=require(_0x1501('0x1'));module[_0x1501('0x2')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x1501('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1501('0x3')],'defaultValue':_0x1501('0x4'),'comment':_0x1501('0x5')},'duration':{'type':Sequelize[_0x1501('0x6')]},'enterAt':{'type':Sequelize[_0x1501('0x7')]},'exitAt':{'type':Sequelize[_0x1501('0x7')],'set':function(_0x51b890){var _0x136a2a=moment(_0x51b890);var _0x51b982=moment(this[_0x1501('0x8')]('enterAt'));var _0x317452=_0x136a2a[_0x1501('0x9')](_0x51b982,_0x1501('0xa'));this[_0x1501('0xb')]('exitAt',_0x51b890);this[_0x1501('0xb')]('duration',_0x317452>=0x0?_0x317452:null);}},'data1':{'type':Sequelize[_0x1501('0x3')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0x1501('0x3')],'comment':_0x1501('0xc')},'data3':{'type':Sequelize[_0x1501('0x3')],'comment':_0x1501('0xd')},'data4':{'type':Sequelize[_0x1501('0x3')],'comment':_0x1501('0xe')},'data5':{'type':Sequelize[_0x1501('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9fa6=['talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x9fa6,0x158));var _0x69fa=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0x9fa6[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x69fa('0x0'));module[_0x69fa('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x69fa('0x2')]},'interface':{'type':Sequelize[_0x69fa('0x2')]},'type':{'type':Sequelize[_0x69fa('0x2')],'defaultValue':_0x69fa('0x3'),'comment':_0x69fa('0x4')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x69fa('0x5')]},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x429de7){var _0x6036e3=moment(_0x429de7);var _0x1721b4=moment(this[_0x69fa('0x6')](_0x69fa('0x7')));var _0x485ebb=_0x6036e3[_0x69fa('0x8')](_0x1721b4,_0x69fa('0x9'));this[_0x69fa('0xa')](_0x69fa('0xb'),_0x429de7);this[_0x69fa('0xa')](_0x69fa('0xc'),_0x485ebb>=0x0?_0x485ebb:null);}},'data1':{'type':Sequelize[_0x69fa('0x2')],'comment':_0x69fa('0xd')},'data2':{'type':Sequelize[_0x69fa('0x2')],'comment':_0x69fa('0xe')},'data3':{'type':Sequelize['STRING'],'comment':_0x69fa('0xf')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0x69fa('0x2')],'comment':_0x69fa('0x10')},'role':{'type':Sequelize[_0x69fa('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x69fa('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index f13ab96..0adecde 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2ae86e,_0x110e55){var _0x3f425c=function(_0x4a2135){while(--_0x4a2135){_0x2ae86e['push'](_0x2ae86e['shift']());}};_0x3f425c(++_0x110e55);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x9c44=['catch','params','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','MemberReport','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','include','findAll','rows'];(function(_0x18f661,_0x2ae691){var _0x1a198b=function(_0x92bad8){while(--_0x92bad8){_0x18f661['push'](_0x18f661['shift']());}};_0x1a198b(++_0x2ae691);}(_0x9c44,0x178));var _0x49c4=function(_0x334841,_0x2bbc4c){_0x334841=_0x334841-0x0;var _0x5beb4b=_0x9c44[_0x334841];return _0x5beb4b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x49c4('0x0'));var jsonpatch=require(_0x49c4('0x1'));var rp=require(_0x49c4('0x2'));var moment=require(_0x49c4('0x3'));var BPromise=require(_0x49c4('0x4'));var Mustache=require(_0x49c4('0x5'));var util=require('util');var path=require('path');var sox=require(_0x49c4('0x6'));var csv=require('to-csv');var ejs=require(_0x49c4('0x7'));var fs=require('fs');var fs_extra=require(_0x49c4('0x8'));var _=require(_0x49c4('0x9'));var squel=require(_0x49c4('0xa'));var crypto=require(_0x49c4('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x49c4('0xc'));var toCsv=require(_0x49c4('0xd'));var querystring=require(_0x49c4('0xe'));var Papa=require(_0x49c4('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x49c4('0x10'));var as=require(_0x49c4('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x49c4('0x12'))(_0x49c4('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x49c4('0x14'));var db=require(_0x49c4('0x15'))['db'];function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x16')](_0x7df3a9)[_0x49c4('0x17')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x16')](_0x2decee)[_0x49c4('0x18')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=typeof _0x58d177[_0x49c4('0x19')]===_0x49c4('0x1a')&&typeof _0x58d177[_0x49c4('0x1b')]==='undefined';var _0x44e607=_0x3acd06[_0x49c4('0x1c')];var _0x4c3253=_0x141003?0x0:_0x58d177['offset'];var _0x3c782d=_0x141003?_0x3acd06[_0x49c4('0x1c')]:_0x58d177[_0x49c4('0x19')]+_0x58d177['limit'];var _0x24856d;if(_0x3c782d>=_0x44e607){_0x3c782d=_0x44e607;_0x24856d=0xc8;}else{_0x24856d=0xce;}_0x3de397['status'](_0x24856d);return _0x3de397[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x4c3253+'-'+_0x3c782d+'/'+_0x44e607)[_0x49c4('0x18')](_0x3acd06);}return null;};}function patchUpdates(_0x291526){return function(_0x382040){try{jsonpatch[_0x49c4('0x1f')](_0x382040,_0x291526,!![]);}catch(_0x280893){return BPromise[_0x49c4('0x20')](_0x280893);}return _0x382040[_0x49c4('0x21')]();};}function saveUpdates(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x22')](_0x578447)['then'](function(_0x592bb8){return _0x592bb8;});}return null;};}function removeEntity(_0x2263ae,_0x15581b){return function(_0x26c640){if(_0x26c640){return _0x26c640[_0x49c4('0x23')]()['then'](function(){_0x2263ae['status'](0xcc)[_0x49c4('0x17')]();});}};}function handleEntityNotFound(_0x9cb797,_0x565423){return function(_0x207358){if(!_0x207358){_0x9cb797[_0x49c4('0x24')](0x194);}return _0x207358;};}function handleError(_0x210159,_0xa7a826){_0xa7a826=_0xa7a826||0x1f4;return function(_0x531d92){logger['error'](_0x531d92[_0x49c4('0x25')]);if(_0x531d92['name']){delete _0x531d92[_0x49c4('0x26')];}_0x210159[_0x49c4('0x16')](_0xa7a826)[_0x49c4('0x27')](_0x531d92);};}exports[_0x49c4('0x28')]=function(_0x5987ae,_0x889909){var _0x2b2793={},_0x46e04d={},_0x4f28a2={'count':0x0,'rows':[]};var _0x6329b3=_[_0x49c4('0x29')](db[_0x49c4('0x2a')][_0x49c4('0x2b')],function(_0x17b50f){return{'name':_0x17b50f[_0x49c4('0x2c')],'type':_0x17b50f[_0x49c4('0x2d')]['key']};});_0x46e04d['model']=_['map'](_0x6329b3,_0x49c4('0x26'));_0x46e04d[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x5987ae[_0x49c4('0x2e')]);_0x46e04d[_0x49c4('0x30')]=_['intersection'](_0x46e04d[_0x49c4('0x31')],_0x46e04d[_0x49c4('0x2e')]);_0x2b2793[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x46e04d['model'],qs['fields'](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x2b2793[_0x49c4('0x32')]=_0x2b2793[_0x49c4('0x32')][_0x49c4('0x35')]?_0x2b2793['attributes']:_0x46e04d[_0x49c4('0x31')];if(!_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x36')]('nolimit')){_0x2b2793['limit']=qs[_0x49c4('0x1b')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x1b')]);_0x2b2793[_0x49c4('0x19')]=qs[_0x49c4('0x19')](_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x19')]);}_0x2b2793[_0x49c4('0x37')]=qs[_0x49c4('0x38')](_0x5987ae['query'][_0x49c4('0x38')]);_0x2b2793['where']=qs[_0x49c4('0x30')](_[_0x49c4('0x39')](_0x5987ae[_0x49c4('0x2e')],_0x46e04d[_0x49c4('0x30')]),_0x6329b3);if(_0x5987ae['query'][_0x49c4('0x3a')]){_0x2b2793[_0x49c4('0x3b')]=_[_0x49c4('0x3c')](_0x2b2793['where'],{'$or':_[_0x49c4('0x29')](_0x6329b3,function(_0x21d8c7){if(_0x21d8c7[_0x49c4('0x2d')]!==_0x49c4('0x3d')){var _0x1ba7a0={};_0x1ba7a0[_0x21d8c7[_0x49c4('0x26')]]={'$like':'%'+_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x3a')]+'%'};return _0x1ba7a0;}})});}_0x2b2793=_[_0x49c4('0x3c')]({},_0x2b2793,_0x5987ae[_0x49c4('0x3e')]);var _0x1e506a={'where':_0x2b2793['where']};return db[_0x49c4('0x2a')][_0x49c4('0x1c')](_0x1e506a)[_0x49c4('0x3f')](function(_0x23aa32){_0x4f28a2[_0x49c4('0x1c')]=_0x23aa32;if(_0x5987ae[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x2b2793[_0x49c4('0x41')]=[{'all':!![]}];}return db[_0x49c4('0x2a')][_0x49c4('0x42')](_0x2b2793);})[_0x49c4('0x3f')](function(_0xa3d59e){_0x4f28a2[_0x49c4('0x43')]=_0xa3d59e;return _0x4f28a2;})['then'](respondWithFilteredResult(_0x889909,_0x2b2793))[_0x49c4('0x44')](handleError(_0x889909,null));};exports['show']=function(_0x104efb,_0x4915bc){var _0x28d4fb={'raw':!![],'where':{'id':_0x104efb[_0x49c4('0x45')]['id']}},_0x1480da={};_0x1480da[_0x49c4('0x31')]=_['keys'](db['MemberReport'][_0x49c4('0x2b')]);_0x1480da[_0x49c4('0x2e')]=_[_0x49c4('0x2f')](_0x104efb[_0x49c4('0x2e')]);_0x1480da['filters']=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],_0x1480da[_0x49c4('0x2e')]);_0x28d4fb[_0x49c4('0x32')]=_[_0x49c4('0x33')](_0x1480da[_0x49c4('0x31')],qs[_0x49c4('0x34')](_0x104efb[_0x49c4('0x2e')][_0x49c4('0x34')]));_0x28d4fb['attributes']=_0x28d4fb[_0x49c4('0x32')]['length']?_0x28d4fb[_0x49c4('0x32')]:_0x1480da[_0x49c4('0x31')];if(_0x104efb[_0x49c4('0x2e')][_0x49c4('0x40')]){_0x28d4fb[_0x49c4('0x41')]=[{'all':!![]}];}_0x28d4fb=_['merge']({},_0x28d4fb,_0x104efb[_0x49c4('0x3e')]);return db[_0x49c4('0x2a')][_0x49c4('0x46')](_0x28d4fb)[_0x49c4('0x3f')](handleEntityNotFound(_0x4915bc,null))[_0x49c4('0x3f')](respondWithResult(_0x4915bc,null))[_0x49c4('0x44')](handleError(_0x4915bc,null));};exports[_0x49c4('0x47')]=function(_0x4d89e0,_0x3bac1b){return db['MemberReport'][_0x49c4('0x47')](_0x4d89e0[_0x49c4('0x48')],{})[_0x49c4('0x3f')](respondWithResult(_0x3bac1b,0xc9))[_0x49c4('0x44')](handleError(_0x3bac1b,null));};exports[_0x49c4('0x22')]=function(_0x30bea5,_0x2c6be1){if(_0x30bea5['body']['id']){delete _0x30bea5[_0x49c4('0x48')]['id'];}return db[_0x49c4('0x2a')]['find']({'where':{'id':_0x30bea5[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x2c6be1,null))[_0x49c4('0x3f')](saveUpdates(_0x30bea5[_0x49c4('0x48')],null))['then'](respondWithResult(_0x2c6be1,null))['catch'](handleError(_0x2c6be1,null));};exports[_0x49c4('0x23')]=function(_0x4e8221,_0x4597c3){return db[_0x49c4('0x2a')][_0x49c4('0x46')]({'where':{'id':_0x4e8221[_0x49c4('0x45')]['id']}})[_0x49c4('0x3f')](handleEntityNotFound(_0x4597c3,null))[_0x49c4('0x3f')](removeEntity(_0x4597c3,null))[_0x49c4('0x44')](handleError(_0x4597c3,null));};exports['describe']=function(_0x1f26c2,_0x1550ce){return db[_0x49c4('0x2a')][_0x49c4('0x49')]()[_0x49c4('0x3f')](respondWithResult(_0x1550ce,null))[_0x49c4('0x44')](handleError(_0x1550ce,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 456597e..909dde2 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 _0x1315=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x1f9451,_0x2133d4){var _0x5ba640=function(_0x605adc){while(--_0x605adc){_0x1f9451['push'](_0x1f9451['shift']());}};_0x5ba640(++_0x2133d4);}(_0x1315,0xdd));var _0x5131=function(_0x1aab5d,_0x288dad){_0x1aab5d=_0x1aab5d-0x0;var _0x56b096=_0x1315[_0x1aab5d];return _0x56b096;};'use strict';var _=require(_0x5131('0x0'));var util=require(_0x5131('0x1'));var logger=require(_0x5131('0x2'))(_0x5131('0x3'));var moment=require(_0x5131('0x4'));var BPromise=require(_0x5131('0x5'));var rp=require(_0x5131('0x6'));var fs=require('fs');var path=require(_0x5131('0x7'));var rimraf=require(_0x5131('0x8'));var config=require('../../config/environment');var attributes=require(_0x5131('0x9'));module[_0x5131('0xa')]=function(_0x539190,_0x1762f7){return _0x539190[_0x5131('0xb')](_0x5131('0xc'),attributes,{'tableName':_0x5131('0xd'),'paranoid':![],'indexes':[{'name':_0x5131('0xe'),'fields':[_0x5131('0xf'),_0x5131('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x47b3=['report_member','membername_interface','interface','util','../../config/logger','bluebird','path','rimraf','./memberReport.attributes','exports','define','MemberReport'];(function(_0x5214b0,_0x546abd){var _0x58af72=function(_0x3ef9ca){while(--_0x3ef9ca){_0x5214b0['push'](_0x5214b0['shift']());}};_0x58af72(++_0x546abd);}(_0x47b3,0x153));var _0x347b=function(_0x1d3e81,_0x290745){_0x1d3e81=_0x1d3e81-0x0;var _0x26b05b=_0x47b3[_0x1d3e81];return _0x26b05b;};'use strict';var _=require('lodash');var util=require(_0x347b('0x0'));var logger=require(_0x347b('0x1'))('api');var moment=require('moment');var BPromise=require(_0x347b('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x347b('0x3'));var rimraf=require(_0x347b('0x4'));var config=require('../../config/environment');var attributes=require(_0x347b('0x5'));module[_0x347b('0x6')]=function(_0x2b9d8e,_0x1b4b63){return _0x2b9d8e[_0x347b('0x7')](_0x347b('0x8'),attributes,{'tableName':_0x347b('0x9'),'paranoid':![],'indexes':[{'name':_0x347b('0xa'),'fields':['membername',_0x347b('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index c15d983..947ac18 100644 --- a/server/api/memberReport/memberReport.rpc.js +++ b/server/api/memberReport/memberReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ca0=['MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','limit','include','map','model','attributes','create','body','CreateMemberReport','UpdateMemberReport','update','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','http','then'];(function(_0x14e206,_0x50b956){var _0x33afc4=function(_0x1a2cd5){while(--_0x1a2cd5){_0x14e206['push'](_0x14e206['shift']());}};_0x33afc4(++_0x50b956);}(_0x9ca0,0x65));var _0x09ca=function(_0x39772f,_0x5605cb){_0x39772f=_0x39772f-0x0;var _0xc9edbf=_0x9ca0[_0x39772f];return _0xc9edbf;};'use strict';var _=require(_0x09ca('0x0'));var util=require(_0x09ca('0x1'));var moment=require(_0x09ca('0x2'));var BPromise=require('bluebird');var rs=require(_0x09ca('0x3'));var fs=require('fs');var Redis=require(_0x09ca('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x09ca('0x5'));var logger=require(_0x09ca('0x6'))('rpc');var config=require(_0x09ca('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x09ca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f8649,_0x3bf4d9,_0x224661){return new BPromise(function(_0x35e94d,_0x498d91){return client['request'](_0x1f8649,_0x224661)[_0x09ca('0x9')](function(_0x44b875){logger['info'](_0x09ca('0xa'),_0x3bf4d9,_0x09ca('0xb'));logger[_0x09ca('0xc')](_0x09ca('0xd'),_0x3bf4d9,_0x09ca('0xb'),JSON[_0x09ca('0xe')](_0x44b875));if(_0x44b875['error']){if(_0x44b875[_0x09ca('0xf')][_0x09ca('0x10')]===0x1f4){logger['error'](_0x09ca('0xa'),_0x3bf4d9,_0x44b875['error'][_0x09ca('0x11')]);return _0x498d91(_0x44b875[_0x09ca('0xf')][_0x09ca('0x11')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x3bf4d9,_0x44b875[_0x09ca('0xf')][_0x09ca('0x11')]);return _0x35e94d(_0x44b875['error'][_0x09ca('0x11')]);}else{logger[_0x09ca('0x12')](_0x09ca('0xa'),_0x3bf4d9,_0x09ca('0xb'));_0x35e94d(_0x44b875[_0x09ca('0x13')][_0x09ca('0x11')]);}})[_0x09ca('0x14')](function(_0x118c6c){logger[_0x09ca('0xf')](_0x09ca('0xa'),_0x3bf4d9,_0x118c6c);_0x498d91(_0x118c6c);});});}exports[_0x09ca('0x15')]=function(_0x3d8f28){var _0x53ecd4=this;return new Promise(function(_0x62be0c,_0x23c9ea){return db[_0x09ca('0x16')][_0x09ca('0x17')]({'raw':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![],'where':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28['options'][_0x09ca('0x1a')]||null:null,'attributes':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')]['attributes']||null:null,'limit':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x1b')]||null:null,'include':_0x3d8f28[_0x09ca('0x18')]?_0x3d8f28['options'][_0x09ca('0x1c')]?_[_0x09ca('0x1d')](_0x3d8f28[_0x09ca('0x18')][_0x09ca('0x1c')],function(_0x44f036){return{'model':db[_0x44f036[_0x09ca('0x1e')]],'as':_0x44f036['as'],'attributes':_0x44f036[_0x09ca('0x1f')],'include':_0x44f036['include']?_[_0x09ca('0x1d')](_0x44f036[_0x09ca('0x1c')],function(_0x459822){return{'model':db[_0x459822[_0x09ca('0x1e')]],'as':_0x459822['as'],'attributes':_0x459822[_0x09ca('0x1f')],'include':_0x459822[_0x09ca('0x1c')]?_[_0x09ca('0x1d')](_0x459822[_0x09ca('0x1c')],function(_0x576466){return{'model':db[_0x576466[_0x09ca('0x1e')]],'as':_0x576466['as'],'attributes':_0x576466[_0x09ca('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x09ca('0x9')](function(_0x4b3da5){logger['info'](_0x09ca('0x15'),_0x3d8f28);logger[_0x09ca('0xc')](_0x09ca('0x15'),_0x3d8f28,JSON[_0x09ca('0xe')](_0x4b3da5));_0x62be0c(_0x4b3da5);})['catch'](function(_0x2d2f54){logger['error'](_0x09ca('0x15'),_0x2d2f54[_0x09ca('0x11')],_0x3d8f28);_0x23c9ea(_0x53ecd4[_0x09ca('0xf')](0x1f4,_0x2d2f54['message']));});});};exports['CreateMemberReport']=function(_0x2d6280){var _0x476134=this;return new Promise(function(_0x4b5f00,_0x490dc4){return db[_0x09ca('0x16')][_0x09ca('0x20')](_0x2d6280[_0x09ca('0x21')],{'raw':_0x2d6280[_0x09ca('0x18')]?_0x2d6280[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0xbeec46){logger['info'](_0x09ca('0x22'),_0x2d6280);logger[_0x09ca('0xc')](_0x09ca('0x22'),_0x2d6280,JSON['stringify'](_0xbeec46));_0x4b5f00(_0xbeec46);})[_0x09ca('0x14')](function(_0x53f472){logger[_0x09ca('0xf')]('CreateMemberReport',_0x53f472[_0x09ca('0x11')],_0x2d6280);_0x490dc4(_0x476134[_0x09ca('0xf')](0x1f4,_0x53f472['message']));});});};exports[_0x09ca('0x23')]=function(_0x11cb3b){var _0x46f089=this;return new Promise(function(_0x4e1dd9,_0x3ae5de){return db[_0x09ca('0x16')][_0x09ca('0x24')](_0x11cb3b[_0x09ca('0x21')],{'raw':_0x11cb3b['options']?_0x11cb3b[_0x09ca('0x18')][_0x09ca('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b[_0x09ca('0x18')]['where']||null:null,'attributes':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b['options']['attributes']||null:null,'limit':_0x11cb3b[_0x09ca('0x18')]?_0x11cb3b['options'][_0x09ca('0x1b')]||null:null})[_0x09ca('0x9')](function(_0x10fcb7){logger[_0x09ca('0x12')]('UpdateMemberReport',_0x11cb3b);logger[_0x09ca('0xc')]('UpdateMemberReport',_0x11cb3b,JSON['stringify'](_0x10fcb7));_0x4e1dd9(_0x10fcb7);})[_0x09ca('0x14')](function(_0x140f70){logger['error'](_0x09ca('0x23'),_0x140f70[_0x09ca('0x11')],_0x11cb3b);_0x3ae5de(_0x46f089['error'](0x1f4,_0x140f70[_0x09ca('0x11')]));});});}; \ No newline at end of file +var _0x34f2=['GetMemberReport','MemberReport','findAll','options','raw','where','include','map','model','attributes','info','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x358a65,_0x4f8b73){var _0xeacb3a=function(_0x10be33){while(--_0x10be33){_0x358a65['push'](_0x358a65['shift']());}};_0xeacb3a(++_0x4f8b73);}(_0x34f2,0x15a));var _0x234f=function(_0x4545fd,_0x493068){_0x4545fd=_0x4545fd-0x0;var _0x162cab=_0x34f2[_0x4545fd];return _0x162cab;};'use strict';var _=require(_0x234f('0x0'));var util=require(_0x234f('0x1'));var moment=require('moment');var BPromise=require(_0x234f('0x2'));var rs=require(_0x234f('0x3'));var fs=require('fs');var Redis=require(_0x234f('0x4'));var db=require(_0x234f('0x5'))['db'];var utils=require(_0x234f('0x6'));var logger=require(_0x234f('0x7'))(_0x234f('0x8'));var config=require(_0x234f('0x9'));var jayson=require(_0x234f('0xa'));var client=jayson[_0x234f('0xb')][_0x234f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x254f37,_0x3aaf6c,_0x477918){return new BPromise(function(_0x691793,_0x514588){return client[_0x234f('0xd')](_0x254f37,_0x477918)[_0x234f('0xe')](function(_0x5d9661){logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));logger[_0x234f('0x11')](_0x234f('0x12'),_0x3aaf6c,_0x234f('0x10'),JSON['stringify'](_0x5d9661));if(_0x5d9661[_0x234f('0x13')]){if(_0x5d9661[_0x234f('0x13')][_0x234f('0x14')]===0x1f4){logger[_0x234f('0x13')]('MemberReport,\x20%s,\x20%s',_0x3aaf6c,_0x5d9661[_0x234f('0x13')]['message']);return _0x514588(_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);}logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x5d9661[_0x234f('0x13')][_0x234f('0x15')]);return _0x691793(_0x5d9661[_0x234f('0x13')]['message']);}else{logger['info'](_0x234f('0xf'),_0x3aaf6c,_0x234f('0x10'));_0x691793(_0x5d9661['result'][_0x234f('0x15')]);}})[_0x234f('0x16')](function(_0x228dcc){logger[_0x234f('0x13')](_0x234f('0xf'),_0x3aaf6c,_0x228dcc);_0x514588(_0x228dcc);});});}exports[_0x234f('0x17')]=function(_0x144ea0){var _0x2ce5e1=this;return new Promise(function(_0x77399f,_0x5892e0){return db[_0x234f('0x18')][_0x234f('0x19')]({'raw':_0x144ea0[_0x234f('0x1a')]?_0x144ea0[_0x234f('0x1a')][_0x234f('0x1b')]===undefined?!![]:![]:!![],'where':_0x144ea0[_0x234f('0x1a')]?_0x144ea0[_0x234f('0x1a')][_0x234f('0x1c')]||null:null,'attributes':_0x144ea0[_0x234f('0x1a')]?_0x144ea0['options']['attributes']||null:null,'limit':_0x144ea0[_0x234f('0x1a')]?_0x144ea0[_0x234f('0x1a')]['limit']||null:null,'include':_0x144ea0[_0x234f('0x1a')]?_0x144ea0['options'][_0x234f('0x1d')]?_[_0x234f('0x1e')](_0x144ea0[_0x234f('0x1a')][_0x234f('0x1d')],function(_0x34cc19){return{'model':db[_0x34cc19[_0x234f('0x1f')]],'as':_0x34cc19['as'],'attributes':_0x34cc19[_0x234f('0x20')],'include':_0x34cc19[_0x234f('0x1d')]?_[_0x234f('0x1e')](_0x34cc19[_0x234f('0x1d')],function(_0x758e8d){return{'model':db[_0x758e8d[_0x234f('0x1f')]],'as':_0x758e8d['as'],'attributes':_0x758e8d[_0x234f('0x20')],'include':_0x758e8d[_0x234f('0x1d')]?_[_0x234f('0x1e')](_0x758e8d[_0x234f('0x1d')],function(_0x2b6641){return{'model':db[_0x2b6641[_0x234f('0x1f')]],'as':_0x2b6641['as'],'attributes':_0x2b6641[_0x234f('0x20')]};}):[]};}):[]};}):[]:[]})[_0x234f('0xe')](function(_0xf16a84){logger[_0x234f('0x21')](_0x234f('0x17'),_0x144ea0);logger['debug'](_0x234f('0x17'),_0x144ea0,JSON[_0x234f('0x22')](_0xf16a84));_0x77399f(_0xf16a84);})[_0x234f('0x16')](function(_0x2522b1){logger[_0x234f('0x13')](_0x234f('0x17'),_0x2522b1[_0x234f('0x15')],_0x144ea0);_0x5892e0(_0x2ce5e1[_0x234f('0x13')](0x1f4,_0x2522b1[_0x234f('0x15')]));});});};exports[_0x234f('0x23')]=function(_0x5ecf4e){var _0x3eb02e=this;return new Promise(function(_0x5e6013,_0x193dc9){return db[_0x234f('0x18')][_0x234f('0x24')](_0x5ecf4e[_0x234f('0x25')],{'raw':_0x5ecf4e['options']?_0x5ecf4e[_0x234f('0x1a')][_0x234f('0x1b')]===undefined?!![]:![]:!![]})[_0x234f('0xe')](function(_0x4b1198){logger['info'](_0x234f('0x23'),_0x5ecf4e);logger[_0x234f('0x11')]('CreateMemberReport',_0x5ecf4e,JSON['stringify'](_0x4b1198));_0x5e6013(_0x4b1198);})[_0x234f('0x16')](function(_0x4bad3e){logger['error'](_0x234f('0x23'),_0x4bad3e['message'],_0x5ecf4e);_0x193dc9(_0x3eb02e[_0x234f('0x13')](0x1f4,_0x4bad3e[_0x234f('0x15')]));});});};exports[_0x234f('0x26')]=function(_0x1b1a56){var _0x266d62=this;return new Promise(function(_0x36c893,_0x8590f2){return db[_0x234f('0x18')][_0x234f('0x27')](_0x1b1a56['body'],{'raw':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')][_0x234f('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')][_0x234f('0x1c')]||null:null,'attributes':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')]['attributes']||null:null,'limit':_0x1b1a56[_0x234f('0x1a')]?_0x1b1a56[_0x234f('0x1a')][_0x234f('0x28')]||null:null})[_0x234f('0xe')](function(_0x5c125c){logger['info']('UpdateMemberReport',_0x1b1a56);logger[_0x234f('0x11')]('UpdateMemberReport',_0x1b1a56,JSON[_0x234f('0x22')](_0x5c125c));_0x36c893(_0x5c125c);})[_0x234f('0x16')](function(_0x348aad){logger[_0x234f('0x13')](_0x234f('0x26'),_0x348aad[_0x234f('0x15')],_0x1b1a56);_0x8590f2(_0x266d62[_0x234f('0x13')](0x1f4,_0x348aad[_0x234f('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 84ba6b4..1c32d56 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 _0x9d3e=['get','index','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x9d3e,0x1c3));var _0xe9d3=function(_0x2f5c30,_0x4b8aa0){_0x2f5c30=_0x2f5c30-0x0;var _0x9f5f99=_0x9d3e[_0x2f5c30];return _0x9f5f99;};'use strict';var multer=require(_0xe9d3('0x0'));var util=require(_0xe9d3('0x1'));var path=require(_0xe9d3('0x2'));var timeout=require(_0xe9d3('0x3'));var express=require(_0xe9d3('0x4'));var router=express[_0xe9d3('0x5')]();var fs_extra=require(_0xe9d3('0x6'));var auth=require(_0xe9d3('0x7'));var interaction=require(_0xe9d3('0x8'));var config=require(_0xe9d3('0x9'));var controller=require(_0xe9d3('0xa'));router[_0xe9d3('0xb')]('/',controller[_0xe9d3('0xc')]);module[_0xe9d3('0xd')]=router; \ No newline at end of file +var _0xf098=['connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','get','index','exports','multer','util','path'];(function(_0x1ebce2,_0x10e903){var _0x4a330c=function(_0x4fd810){while(--_0x4fd810){_0x1ebce2['push'](_0x1ebce2['shift']());}};_0x4a330c(++_0x10e903);}(_0xf098,0x194));var _0x8f09=function(_0x21b475,_0x518fdb){_0x21b475=_0x21b475-0x0;var _0x5ac52c=_0xf098[_0x21b475];return _0x5ac52c;};'use strict';var multer=require(_0x8f09('0x0'));var util=require(_0x8f09('0x1'));var path=require(_0x8f09('0x2'));var timeout=require(_0x8f09('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8f09('0x4'));var auth=require(_0x8f09('0x5'));var interaction=require(_0x8f09('0x6'));var config=require('../../config/environment');var controller=require(_0x8f09('0x7'));router[_0x8f09('0x8')]('/',controller[_0x8f09('0x9')]);module[_0x8f09('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 438b064..a80903e 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 _0x4477=['STRING','exports'];(function(_0x2a1267,_0x55b7ef){var _0x384d41=function(_0x41c255){while(--_0x41c255){_0x2a1267['push'](_0x2a1267['shift']());}};_0x384d41(++_0x55b7ef);}(_0x4477,0x181));var _0x7447=function(_0xf6cfc3,_0x480008){_0xf6cfc3=_0xf6cfc3-0x0;var _0x1fddc8=_0x4477[_0xf6cfc3];return _0x1fddc8;};'use strict';var Sequelize=require('sequelize');module[_0x7447('0x0')]={'version':{'type':Sequelize[_0x7447('0x1')],'unique':'version'}}; \ No newline at end of file +var _0x0e8a=['STRING','version','sequelize','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x0e8a,0x1de));var _0xa0e8=function(_0x18959e,_0x24e830){_0x18959e=_0x18959e-0x0;var _0x308aba=_0x0e8a[_0x18959e];return _0x308aba;};'use strict';var Sequelize=require(_0xa0e8('0x0'));module[_0xa0e8('0x1')]={'version':{'type':Sequelize[_0xa0e8('0x2')],'unique':_0xa0e8('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index ebf4289..0159d64 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 _0x64f3=['mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x2355a4,_0xc0b80d){var _0xe22dd=function(_0x43282c){while(--_0x43282c){_0x2355a4['push'](_0x2355a4['shift']());}};_0xe22dd(++_0xc0b80d);}(_0x64f3,0x83));var _0x364f=function(_0x2ff981,_0x5e4baf){_0x2ff981=_0x2ff981-0x0;var _0x1aec23=_0x64f3[_0x2ff981];return _0x1aec23;};'use strict';var emlformat=require(_0x364f('0x0'));var rimraf=require(_0x364f('0x1'));var zipdir=require(_0x364f('0x2'));var jsonpatch=require(_0x364f('0x3'));var rp=require(_0x364f('0x4'));var moment=require(_0x364f('0x5'));var BPromise=require(_0x364f('0x6'));var Mustache=require(_0x364f('0x7'));var util=require(_0x364f('0x8'));var path=require(_0x364f('0x9'));var sox=require(_0x364f('0xa'));var csv=require(_0x364f('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x364f('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x364f('0xd'));var jsforce=require(_0x364f('0xe'));var deskjs=require(_0x364f('0xf'));var toCsv=require(_0x364f('0xb'));var querystring=require(_0x364f('0x10'));var Papa=require(_0x364f('0x11'));var Redis=require(_0x364f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x364f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x364f('0x14'));var logger=require(_0x364f('0x15'))(_0x364f('0x16'));var utils=require(_0x364f('0x17'));var config=require(_0x364f('0x18'));var licenseUtil=require(_0x364f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xe6e3ff,_0xbe9d72){_0xbe9d72=_0xbe9d72||0xcc;return function(_0x13bdfa){if(_0x13bdfa){return _0xe6e3ff[_0x364f('0x1a')](_0xbe9d72);}return _0xe6e3ff[_0x364f('0x1b')](_0xbe9d72)[_0x364f('0x1c')]();};}function respondWithResult(_0x246b01,_0x4e8432){_0x4e8432=_0x4e8432||0xc8;return function(_0x1d15d2){if(_0x1d15d2){return _0x246b01[_0x364f('0x1b')](_0x4e8432)['json'](_0x1d15d2);}};}function respondWithFilteredResult(_0x4b3261,_0xd6c762){return function(_0x1b13ea){if(_0x1b13ea){var _0x553e25=typeof _0xd6c762[_0x364f('0x1d')]==='undefined'&&typeof _0xd6c762[_0x364f('0x1e')]===_0x364f('0x1f');var _0x2252f3=_0x1b13ea[_0x364f('0x20')];var _0x492a67=_0x553e25?0x0:_0xd6c762[_0x364f('0x1d')];var _0x1947f1=_0x553e25?_0x1b13ea[_0x364f('0x20')]:_0xd6c762[_0x364f('0x1d')]+_0xd6c762[_0x364f('0x1e')];var _0x53326a;if(_0x1947f1>=_0x2252f3){_0x1947f1=_0x2252f3;_0x53326a=0xc8;}else{_0x53326a=0xce;}_0x4b3261[_0x364f('0x1b')](_0x53326a);return _0x4b3261['set'](_0x364f('0x21'),_0x492a67+'-'+_0x1947f1+'/'+_0x2252f3)[_0x364f('0x22')](_0x1b13ea);}return null;};}function patchUpdates(_0x5744b0){return function(_0x28dec8){try{jsonpatch['apply'](_0x28dec8,_0x5744b0,!![]);}catch(_0x1a06dd){return BPromise[_0x364f('0x23')](_0x1a06dd);}return _0x28dec8[_0x364f('0x24')]();};}function saveUpdates(_0x2d717b,_0x6e226c){return function(_0x1faaaf){if(_0x1faaaf){return _0x1faaaf[_0x364f('0x25')](_0x2d717b)[_0x364f('0x26')](function(_0x4af2ca){return _0x4af2ca;});}return null;};}function removeEntity(_0x48b8a1,_0x2b4fde){return function(_0x42ff75){if(_0x42ff75){return _0x42ff75[_0x364f('0x27')]()[_0x364f('0x26')](function(){_0x48b8a1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42243a,_0x589201){return function(_0x2475de){if(!_0x2475de){_0x42243a['sendStatus'](0x194);}return _0x2475de;};}function handleError(_0x10f6ca,_0x29d78d){_0x29d78d=_0x29d78d||0x1f4;return function(_0x3da744){logger[_0x364f('0x28')](_0x3da744[_0x364f('0x29')]);if(_0x3da744[_0x364f('0x2a')]){delete _0x3da744[_0x364f('0x2a')];}_0x10f6ca[_0x364f('0x1b')](_0x29d78d)[_0x364f('0x2b')](_0x3da744);};}exports[_0x364f('0x2c')]=function(_0x3022c8,_0x5ed312){var _0x102578={},_0x19287c={},_0x40a2d4={'count':0x0,'rows':[]};var _0x267819=_[_0x364f('0x2d')](db[_0x364f('0x2e')]['rawAttributes'],function(_0x2148cd){return{'name':_0x2148cd['fieldName'],'type':_0x2148cd[_0x364f('0x2f')][_0x364f('0x30')]};});_0x19287c[_0x364f('0x31')]=_[_0x364f('0x2d')](_0x267819,_0x364f('0x2a'));_0x19287c[_0x364f('0x32')]=_[_0x364f('0x33')](_0x3022c8[_0x364f('0x32')]);_0x19287c[_0x364f('0x34')]=_[_0x364f('0x35')](_0x19287c[_0x364f('0x31')],_0x19287c[_0x364f('0x32')]);_0x102578[_0x364f('0x36')]=_[_0x364f('0x35')](_0x19287c[_0x364f('0x31')],qs['fields'](_0x3022c8[_0x364f('0x32')]['fields']));_0x102578[_0x364f('0x36')]=_0x102578['attributes'][_0x364f('0x37')]?_0x102578[_0x364f('0x36')]:_0x19287c['model'];if(!_0x3022c8['query'][_0x364f('0x38')](_0x364f('0x39'))){_0x102578[_0x364f('0x1e')]=qs[_0x364f('0x1e')](_0x3022c8[_0x364f('0x32')][_0x364f('0x1e')]);_0x102578[_0x364f('0x1d')]=qs['offset'](_0x3022c8[_0x364f('0x32')][_0x364f('0x1d')]);}_0x102578['order']=qs['sort'](_0x3022c8[_0x364f('0x32')][_0x364f('0x3a')]);_0x102578[_0x364f('0x3b')]=qs['filters'](_[_0x364f('0x3c')](_0x3022c8[_0x364f('0x32')],_0x19287c[_0x364f('0x34')]),_0x267819);if(_0x3022c8[_0x364f('0x32')][_0x364f('0x3d')]){_0x102578[_0x364f('0x3b')]=_[_0x364f('0x3e')](_0x102578[_0x364f('0x3b')],{'$or':_[_0x364f('0x2d')](_0x267819,function(_0x181e23){if(_0x181e23[_0x364f('0x2f')]!=='VIRTUAL'){var _0x3c5c6a={};_0x3c5c6a[_0x181e23['name']]={'$like':'%'+_0x3022c8['query'][_0x364f('0x3d')]+'%'};return _0x3c5c6a;}})});}_0x102578=_[_0x364f('0x3e')]({},_0x102578,_0x3022c8[_0x364f('0x3f')]);var _0x58cd19={'where':_0x102578['where']};return db[_0x364f('0x2e')]['count'](_0x58cd19)[_0x364f('0x26')](function(_0x12a72b){_0x40a2d4[_0x364f('0x20')]=_0x12a72b;if(_0x3022c8[_0x364f('0x32')][_0x364f('0x40')]){_0x102578[_0x364f('0x41')]=[{'all':!![]}];}return db['Migration'][_0x364f('0x42')](_0x102578);})[_0x364f('0x26')](function(_0x3842b5){_0x40a2d4[_0x364f('0x43')]=_0x3842b5;return _0x40a2d4;})[_0x364f('0x26')](respondWithFilteredResult(_0x5ed312,_0x102578))[_0x364f('0x44')](handleError(_0x5ed312,null));}; \ No newline at end of file +var _0xaf7e=['filter','merge','includeAll','findAll','rows','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','map','fieldName','type','key','model','query','keys','intersection','attributes','nolimit','sort','where','filters','pick','VIRTUAL'];(function(_0x5b5bed,_0xd9474c){var _0x57255f=function(_0x3b077b){while(--_0x3b077b){_0x5b5bed['push'](_0x5b5bed['shift']());}};_0x57255f(++_0xd9474c);}(_0xaf7e,0xb9));var _0xeaf7=function(_0x1e4977,_0x14aad9){_0x1e4977=_0x1e4977-0x0;var _0x18afd8=_0xaf7e[_0x1e4977];return _0x18afd8;};'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(_0xeaf7('0x0'));var moment=require('moment');var BPromise=require(_0xeaf7('0x1'));var Mustache=require(_0xeaf7('0x2'));var util=require('util');var path=require(_0xeaf7('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeaf7('0x4'));var _=require(_0xeaf7('0x5'));var squel=require(_0xeaf7('0x6'));var crypto=require('crypto');var jsforce=require(_0xeaf7('0x7'));var deskjs=require(_0xeaf7('0x8'));var toCsv=require(_0xeaf7('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeaf7('0xa'));var authService=require(_0xeaf7('0xb'));var qs=require(_0xeaf7('0xc'));var as=require(_0xeaf7('0xd'));var hardwareService=require(_0xeaf7('0xe'));var logger=require(_0xeaf7('0xf'))(_0xeaf7('0x10'));var utils=require(_0xeaf7('0x11'));var config=require(_0xeaf7('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xeaf7('0x13'))['db'];function respondWithStatusCode(_0x348c67,_0x3d02f0){_0x3d02f0=_0x3d02f0||0xcc;return function(_0x2cc185){if(_0x2cc185){return _0x348c67['sendStatus'](_0x3d02f0);}return _0x348c67[_0xeaf7('0x14')](_0x3d02f0)[_0xeaf7('0x15')]();};}function respondWithResult(_0x2e3678,_0x413caf){_0x413caf=_0x413caf||0xc8;return function(_0x546802){if(_0x546802){return _0x2e3678[_0xeaf7('0x14')](_0x413caf)['json'](_0x546802);}};}function respondWithFilteredResult(_0x18cbe2,_0xe64eaa){return function(_0x2fc5f7){if(_0x2fc5f7){var _0x369453=typeof _0xe64eaa[_0xeaf7('0x16')]==='undefined'&&typeof _0xe64eaa[_0xeaf7('0x17')]===_0xeaf7('0x18');var _0x2ae3c3=_0x2fc5f7['count'];var _0x4ef5c5=_0x369453?0x0:_0xe64eaa['offset'];var _0x36c4b8=_0x369453?_0x2fc5f7[_0xeaf7('0x19')]:_0xe64eaa[_0xeaf7('0x16')]+_0xe64eaa['limit'];var _0x218ba6;if(_0x36c4b8>=_0x2ae3c3){_0x36c4b8=_0x2ae3c3;_0x218ba6=0xc8;}else{_0x218ba6=0xce;}_0x18cbe2[_0xeaf7('0x14')](_0x218ba6);return _0x18cbe2[_0xeaf7('0x1a')](_0xeaf7('0x1b'),_0x4ef5c5+'-'+_0x36c4b8+'/'+_0x2ae3c3)[_0xeaf7('0x1c')](_0x2fc5f7);}return null;};}function patchUpdates(_0x17327d){return function(_0x1c3359){try{jsonpatch[_0xeaf7('0x1d')](_0x1c3359,_0x17327d,!![]);}catch(_0x50d770){return BPromise[_0xeaf7('0x1e')](_0x50d770);}return _0x1c3359[_0xeaf7('0x1f')]();};}function saveUpdates(_0x168649,_0xb05a0f){return function(_0xe06502){if(_0xe06502){return _0xe06502[_0xeaf7('0x20')](_0x168649)['then'](function(_0x5cbb44){return _0x5cbb44;});}return null;};}function removeEntity(_0x36d44d,_0x4ab839){return function(_0x5dd70f){if(_0x5dd70f){return _0x5dd70f[_0xeaf7('0x21')]()[_0xeaf7('0x22')](function(){_0x36d44d[_0xeaf7('0x14')](0xcc)[_0xeaf7('0x15')]();});}};}function handleEntityNotFound(_0x59b970,_0x284546){return function(_0x107d04){if(!_0x107d04){_0x59b970[_0xeaf7('0x23')](0x194);}return _0x107d04;};}function handleError(_0x118369,_0x255b24){_0x255b24=_0x255b24||0x1f4;return function(_0x59b804){logger[_0xeaf7('0x24')](_0x59b804[_0xeaf7('0x25')]);if(_0x59b804[_0xeaf7('0x26')]){delete _0x59b804['name'];}_0x118369['status'](_0x255b24)[_0xeaf7('0x27')](_0x59b804);};}exports['index']=function(_0x12af31,_0x2f0add){var _0x56f82={},_0x5ed605={},_0x36f6b9={'count':0x0,'rows':[]};var _0x358d27=_[_0xeaf7('0x28')](db['Migration']['rawAttributes'],function(_0x1c5e21){return{'name':_0x1c5e21[_0xeaf7('0x29')],'type':_0x1c5e21[_0xeaf7('0x2a')][_0xeaf7('0x2b')]};});_0x5ed605[_0xeaf7('0x2c')]=_[_0xeaf7('0x28')](_0x358d27,'name');_0x5ed605[_0xeaf7('0x2d')]=_[_0xeaf7('0x2e')](_0x12af31[_0xeaf7('0x2d')]);_0x5ed605['filters']=_[_0xeaf7('0x2f')](_0x5ed605[_0xeaf7('0x2c')],_0x5ed605[_0xeaf7('0x2d')]);_0x56f82[_0xeaf7('0x30')]=_[_0xeaf7('0x2f')](_0x5ed605[_0xeaf7('0x2c')],qs['fields'](_0x12af31['query']['fields']));_0x56f82[_0xeaf7('0x30')]=_0x56f82[_0xeaf7('0x30')]['length']?_0x56f82['attributes']:_0x5ed605['model'];if(!_0x12af31[_0xeaf7('0x2d')]['hasOwnProperty'](_0xeaf7('0x31'))){_0x56f82['limit']=qs['limit'](_0x12af31[_0xeaf7('0x2d')][_0xeaf7('0x17')]);_0x56f82[_0xeaf7('0x16')]=qs['offset'](_0x12af31[_0xeaf7('0x2d')]['offset']);}_0x56f82['order']=qs['sort'](_0x12af31['query'][_0xeaf7('0x32')]);_0x56f82[_0xeaf7('0x33')]=qs[_0xeaf7('0x34')](_[_0xeaf7('0x35')](_0x12af31[_0xeaf7('0x2d')],_0x5ed605[_0xeaf7('0x34')]),_0x358d27);if(_0x12af31['query']['filter']){_0x56f82['where']=_['merge'](_0x56f82[_0xeaf7('0x33')],{'$or':_[_0xeaf7('0x28')](_0x358d27,function(_0x16fe1d){if(_0x16fe1d['type']!==_0xeaf7('0x36')){var _0x157134={};_0x157134[_0x16fe1d[_0xeaf7('0x26')]]={'$like':'%'+_0x12af31['query'][_0xeaf7('0x37')]+'%'};return _0x157134;}})});}_0x56f82=_[_0xeaf7('0x38')]({},_0x56f82,_0x12af31['options']);var _0xa6c417={'where':_0x56f82['where']};return db['Migration']['count'](_0xa6c417)[_0xeaf7('0x22')](function(_0x6a78f0){_0x36f6b9[_0xeaf7('0x19')]=_0x6a78f0;if(_0x12af31['query'][_0xeaf7('0x39')]){_0x56f82['include']=[{'all':!![]}];}return db['Migration'][_0xeaf7('0x3a')](_0x56f82);})[_0xeaf7('0x22')](function(_0x475746){_0x36f6b9[_0xeaf7('0x3b')]=_0x475746;return _0x36f6b9;})[_0xeaf7('0x22')](respondWithFilteredResult(_0x2f0add,_0x56f82))['catch'](handleError(_0x2f0add,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 0aff079..2a7bace 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 _0x0bf4=['exports','define','Migration','migrations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./migration.attributes'];(function(_0x5e29c7,_0xc2f44e){var _0x5ba897=function(_0x650b47){while(--_0x650b47){_0x5e29c7['push'](_0x5e29c7['shift']());}};_0x5ba897(++_0xc2f44e);}(_0x0bf4,0xe8));var _0x40bf=function(_0x347471,_0x1c9a02){_0x347471=_0x347471-0x0;var _0x422b6a=_0x0bf4[_0x347471];return _0x422b6a;};'use strict';var _=require(_0x40bf('0x0'));var util=require(_0x40bf('0x1'));var logger=require(_0x40bf('0x2'))(_0x40bf('0x3'));var moment=require(_0x40bf('0x4'));var BPromise=require(_0x40bf('0x5'));var rp=require(_0x40bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x40bf('0x7'));module[_0x40bf('0x8')]=function(_0x3c807b,_0x2de9fb){return _0x3c807b[_0x40bf('0x9')](_0x40bf('0xa'),attributes,{'tableName':_0x40bf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce89=['exports','define','Migration','util','moment','path','rimraf'];(function(_0x241119,_0x426e1e){var _0x417add=function(_0x45530a){while(--_0x45530a){_0x241119['push'](_0x241119['shift']());}};_0x417add(++_0x426e1e);}(_0xce89,0xb2));var _0x9ce8=function(_0x1dd907,_0x49e59f){_0x1dd907=_0x1dd907-0x0;var _0x33c1ef=_0xce89[_0x1dd907];return _0x33c1ef;};'use strict';var _=require('lodash');var util=require(_0x9ce8('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9ce8('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x9ce8('0x2'));var rimraf=require(_0x9ce8('0x3'));var config=require('../../config/environment');var attributes=require('./migration.attributes');module[_0x9ce8('0x4')]=function(_0x458c29,_0x5955e3){return _0x458c29[_0x9ce8('0x5')](_0x9ce8('0x6'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index cb6eddd..a6d7c68 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 _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x34dc3d,_0x3548b2){var _0x5837b1=function(_0x7119bd){while(--_0x7119bd){_0x34dc3d['push'](_0x34dc3d['shift']());}};_0x5837b1(++_0x3548b2);}(_0x153f,0x15b));var _0xf153=function(_0x590fd3,_0x5ec0c8){_0x590fd3=_0x590fd3-0x0;var _0x3293ff=_0x153f[_0x590fd3];return _0x3293ff;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file +var _0x3a79=['rpc','../../config/environment','client','request','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','error','code','message','Migration,\x20%s,\x20%s','info','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a6963,_0x23a275){var _0x23948b=function(_0x5899a7){while(--_0x5899a7){_0x5a6963['push'](_0x5a6963['shift']());}};_0x23948b(++_0x23a275);}(_0x3a79,0xca));var _0x93a7=function(_0x4d2560,_0x399901){_0x4d2560=_0x4d2560-0x0;var _0x40b9da=_0x3a79[_0x4d2560];return _0x40b9da;};'use strict';var _=require('lodash');var util=require(_0x93a7('0x0'));var moment=require(_0x93a7('0x1'));var BPromise=require('bluebird');var rs=require(_0x93a7('0x2'));var fs=require('fs');var Redis=require(_0x93a7('0x3'));var db=require(_0x93a7('0x4'))['db'];var utils=require(_0x93a7('0x5'));var logger=require(_0x93a7('0x6'))(_0x93a7('0x7'));var config=require(_0x93a7('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x93a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2579e5,_0x4690bb,_0x1b59d1){return new BPromise(function(_0x2417da,_0x3a512b){return client[_0x93a7('0xa')](_0x2579e5,_0x1b59d1)['then'](function(_0x2996db){logger['info']('Migration,\x20%s,\x20%s',_0x4690bb,_0x93a7('0xb'));logger[_0x93a7('0xc')](_0x93a7('0xd'),_0x4690bb,'request\x20sent',JSON['stringify'](_0x2996db));if(_0x2996db[_0x93a7('0xe')]){if(_0x2996db[_0x93a7('0xe')][_0x93a7('0xf')]===0x1f4){logger['error']('Migration,\x20%s,\x20%s',_0x4690bb,_0x2996db[_0x93a7('0xe')]['message']);return _0x3a512b(_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);}logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0x2996db[_0x93a7('0xe')][_0x93a7('0x10')]);return _0x2417da(_0x2996db[_0x93a7('0xe')]['message']);}else{logger[_0x93a7('0x12')](_0x93a7('0x11'),_0x4690bb,'request\x20sent');_0x2417da(_0x2996db['result'][_0x93a7('0x10')]);}})['catch'](function(_0xfac49d){logger[_0x93a7('0xe')](_0x93a7('0x11'),_0x4690bb,_0xfac49d);_0x3a512b(_0xfac49d);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index f87ba32..961a2f9 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 _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id','post','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x8f9d,0x93));var _0xd8f9=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x8f9d[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['show']);router[_0xd8f9('0xd')]('/',auth[_0xd8f9('0x9')](),controller['create']);router[_0xd8f9('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file +var _0xf5e2=['/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','index'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xf5e2,0xa7));var _0x2f5e=function(_0x53ad80,_0x59bc4a){_0x53ad80=_0x53ad80-0x0;var _0x53cf73=_0xf5e2[_0x53ad80];return _0x53cf73;};'use strict';var multer=require(_0x2f5e('0x0'));var util=require(_0x2f5e('0x1'));var path=require(_0x2f5e('0x2'));var timeout=require(_0x2f5e('0x3'));var express=require(_0x2f5e('0x4'));var router=express['Router']();var fs_extra=require(_0x2f5e('0x5'));var auth=require(_0x2f5e('0x6'));var interaction=require(_0x2f5e('0x7'));var config=require(_0x2f5e('0x8'));var controller=require(_0x2f5e('0x9'));router[_0x2f5e('0xa')]('/',auth[_0x2f5e('0xb')](),controller[_0x2f5e('0xc')]);router[_0x2f5e('0xa')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0xe')]);router[_0x2f5e('0xf')]('/',auth[_0x2f5e('0xb')](),controller['create']);router[_0x2f5e('0x10')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller['update']);router[_0x2f5e('0x11')](_0x2f5e('0xd'),auth[_0x2f5e('0xb')](),controller[_0x2f5e('0x12')]);module[_0x2f5e('0x13')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 6d91986..a8120b0 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 _0xed4b=['exports','ENUM','localnet','stun','turn','STRING'];(function(_0x225fc8,_0x2f9b09){var _0x3a601f=function(_0x144e04){while(--_0x144e04){_0x225fc8['push'](_0x225fc8['shift']());}};_0x3a601f(++_0x2f9b09);}(_0xed4b,0x7e));var _0xbed4=function(_0x27579d,_0x568070){_0x27579d=_0x27579d-0x0;var _0x37fbc2=_0xed4b[_0x27579d];return _0x37fbc2;};'use strict';var Sequelize=require('sequelize');module[_0xbed4('0x0')]={'type':{'type':Sequelize[_0xbed4('0x1')](_0xbed4('0x2'),'externip',_0xbed4('0x3'),_0xbed4('0x4'))},'value':{'type':Sequelize[_0xbed4('0x5')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3d6d=['sequelize','ENUM','localnet','stun','STRING'];(function(_0x1db420,_0xe50b67){var _0x136363=function(_0x3f4697){while(--_0x3f4697){_0x1db420['push'](_0x1db420['shift']());}};_0x136363(++_0xe50b67);}(_0x3d6d,0x96));var _0xd3d6=function(_0xf72786,_0x1a0ddd){_0xf72786=_0xf72786-0x0;var _0x113f3e=_0x3d6d[_0xf72786];return _0x113f3e;};'use strict';var Sequelize=require(_0xd3d6('0x0'));module['exports']={'type':{'type':Sequelize[_0xd3d6('0x1')](_0xd3d6('0x2'),'externip',_0xd3d6('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xd3d6('0x4')]},'password':{'type':Sequelize[_0xd3d6('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index d24e558..d2a5992 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 _0xf90f=['readFileSync','server/files/templates/turn_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/turn_xcally.conf','join','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','Reload','chan_sip.so','update','find','res_stun_monitor.so','format','util','ejs','lodash','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','undefined','limit','offset','count','set','Content-Range','destroy','end','name','send','index','map','Network','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','keys','includeAll','create','body','toUpperCase','STUN','root','server/files/templates/stun_multiple.ejs','/etc/asterisk/stun_xcally.conf','TURN'];(function(_0x2048c7,_0x14e572){var _0x3f0795=function(_0x1747ee){while(--_0x1747ee){_0x2048c7['push'](_0x2048c7['shift']());}};_0x3f0795(++_0x14e572);}(_0xf90f,0x66));var _0xff90=function(_0x380e1e,_0x393f7b){_0x380e1e=_0x380e1e-0x0;var _0x5e346d=_0xf90f[_0x380e1e];return _0x5e346d;};'use strict';var util=require(_0xff90('0x0'));var path=require('path');var ejs=require(_0xff90('0x1'));var fs=require('fs');var _=require(_0xff90('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0xff90('0x3'))(_0xff90('0x4'));var config=require('../../config/environment');var db=require(_0xff90('0x5'))['db'];var jayson=require(_0xff90('0x6'));var client=jayson[_0xff90('0x7')][_0xff90('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x44096b,_0x5631b4,_0x53394e,_0x182b3d){return new Promise(function(_0x708e4c,_0x451c15){var _0xd21d3e=_0x182b3d||client;return _0xd21d3e[_0xff90('0x9')](_0x44096b,_0x53394e)[_0xff90('0xa')](function(_0x57c54e){logger[_0xff90('0xb')](_0xff90('0xc'),_0x5631b4,_0xff90('0xd'));logger[_0xff90('0xe')](_0xff90('0xf'),_0x5631b4,_0xff90('0xd'),JSON[_0xff90('0x10')](_0x57c54e));if(_0x57c54e[_0xff90('0x11')]){if(_0x57c54e[_0xff90('0x11')][_0xff90('0x12')]===0x1f4){logger[_0xff90('0x11')]('Network,\x20%s,\x20%s',_0x5631b4,_0x57c54e[_0xff90('0x11')][_0xff90('0x13')]);return _0x451c15(_0x57c54e[_0xff90('0x11')][_0xff90('0x13')]);}logger['error'](_0xff90('0xc'),_0x5631b4,_0x57c54e['error'][_0xff90('0x13')]);return _0x708e4c(_0x57c54e[_0xff90('0x11')]['message']);}else{logger[_0xff90('0xb')]('Network,\x20%s,\x20%s',_0x5631b4,_0xff90('0xd'));_0x708e4c(_0x57c54e['result'][_0xff90('0x13')]);}})[_0xff90('0x14')](function(_0x511d39){logger['error'](_0xff90('0xc'),_0x5631b4,_0x511d39);_0x451c15(_0x511d39);});});}function respondWithResult(_0x32f765,_0x2fe875){_0x2fe875=_0x2fe875||0xc8;return function(_0xa1278a){if(_0xa1278a){return _0x32f765[_0xff90('0x15')](_0x2fe875)[_0xff90('0x16')](_0xa1278a);}};}function respondWithFilteredResult(_0x274ebc,_0x445be3){return function(_0x2e2bbd){if(_0x2e2bbd){var _0x24d8f5=typeof _0x445be3['offset']===_0xff90('0x17')&&typeof _0x445be3[_0xff90('0x18')]===_0xff90('0x17');var _0x202f43=_0x2e2bbd['count'];var _0x207de9=_0x24d8f5?0x0:_0x445be3[_0xff90('0x19')];var _0x27c208=_0x24d8f5?_0x2e2bbd[_0xff90('0x1a')]:_0x445be3[_0xff90('0x19')]+_0x445be3['limit'];var _0x4a851f;if(_0x27c208>=_0x202f43){_0x27c208=_0x202f43;_0x4a851f=0xc8;}else{_0x4a851f=0xce;}_0x274ebc['status'](_0x4a851f);return _0x274ebc[_0xff90('0x1b')](_0xff90('0x1c'),_0x207de9+'-'+_0x27c208+'/'+_0x202f43)[_0xff90('0x16')](_0x2e2bbd);}return null;};}function saveUpdates(_0x3d271a){return function(_0x441887){if(_0x441887){return _0x441887['update'](_0x3d271a)['then'](function(_0x19c51b){return _0x19c51b;});}return null;};}function removeEntity(_0x46d5a4){return function(_0x19c456){if(_0x19c456){return _0x19c456[_0xff90('0x1d')]()[_0xff90('0xa')](function(){_0x46d5a4[_0xff90('0x15')](0xcc)[_0xff90('0x1e')]();});}};}function handleEntityNotFound(_0x2b21c7){return function(_0x493157){if(!_0x493157){_0x2b21c7['sendStatus'](0x194);}return _0x493157;};}function handleError(_0x5828be,_0x47e24c){_0x47e24c=_0x47e24c||0x1f4;return function(_0x562dae){logger['error'](_0x562dae['stack']);if(_0x562dae[_0xff90('0x1f')]){delete _0x562dae['name'];}_0x5828be[_0xff90('0x15')](_0x47e24c)[_0xff90('0x20')](_0x562dae);};}exports[_0xff90('0x21')]=function(_0x3c0fbc,_0x5b5e30){var _0x1cd908={},_0x215a49={},_0x4a1e13={'count':0x0,'rows':[]};var _0x3cf242=_[_0xff90('0x22')](db[_0xff90('0x23')]['rawAttributes'],function(_0x166781){return{'name':_0x166781[_0xff90('0x24')],'type':_0x166781[_0xff90('0x25')][_0xff90('0x26')]};});_0x215a49[_0xff90('0x27')]=_['map'](_0x3cf242,_0xff90('0x1f'));_0x215a49[_0xff90('0x28')]=_['keys'](_0x3c0fbc[_0xff90('0x28')]);_0x215a49[_0xff90('0x29')]=_[_0xff90('0x2a')](_0x215a49['model'],_0x215a49[_0xff90('0x28')]);_0x1cd908['attributes']=_[_0xff90('0x2a')](_0x215a49[_0xff90('0x27')],qs['fields'](_0x3c0fbc[_0xff90('0x28')][_0xff90('0x2b')]));_0x1cd908[_0xff90('0x2c')]=_0x1cd908[_0xff90('0x2c')][_0xff90('0x2d')]?_0x1cd908[_0xff90('0x2c')]:_0x215a49['model'];if(!_0x3c0fbc[_0xff90('0x28')][_0xff90('0x2e')](_0xff90('0x2f'))){_0x1cd908[_0xff90('0x18')]=qs[_0xff90('0x18')](_0x3c0fbc[_0xff90('0x28')]['limit']);_0x1cd908[_0xff90('0x19')]=qs['offset'](_0x3c0fbc[_0xff90('0x28')][_0xff90('0x19')]);}_0x1cd908['order']=qs['sort'](_0x3c0fbc[_0xff90('0x28')][_0xff90('0x30')]);_0x1cd908[_0xff90('0x31')]=qs[_0xff90('0x29')](_['pick'](_0x3c0fbc[_0xff90('0x28')],_0x215a49[_0xff90('0x29')]),_0x3cf242);if(_0x3c0fbc[_0xff90('0x28')][_0xff90('0x32')]){_0x1cd908[_0xff90('0x31')]=_[_0xff90('0x33')](_0x1cd908[_0xff90('0x31')],{'$or':_[_0xff90('0x22')](_0x3cf242,function(_0x1103fd){if(_0x1103fd[_0xff90('0x25')]!==_0xff90('0x34')){var _0x4c56a5={};_0x4c56a5[_0x1103fd[_0xff90('0x1f')]]={'$like':'%'+_0x3c0fbc[_0xff90('0x28')][_0xff90('0x32')]+'%'};return _0x4c56a5;}})});}_0x1cd908=_[_0xff90('0x33')]({},_0x1cd908,_0x3c0fbc[_0xff90('0x35')]);var _0x3bde89={'where':_0x1cd908[_0xff90('0x31')]};return db[_0xff90('0x23')][_0xff90('0x1a')](_0x3bde89)['then'](function(_0x463f7f){_0x4a1e13[_0xff90('0x1a')]=_0x463f7f;if(_0x3c0fbc[_0xff90('0x28')]['includeAll']){_0x1cd908[_0xff90('0x36')]=[{'all':!![]}];}return db[_0xff90('0x23')][_0xff90('0x37')](_0x1cd908);})['then'](function(_0x336ece){_0x4a1e13[_0xff90('0x38')]=_0x336ece;return _0x4a1e13;})[_0xff90('0xa')](respondWithFilteredResult(_0x5b5e30,_0x1cd908))[_0xff90('0x14')](handleError(_0x5b5e30,null));};exports[_0xff90('0x39')]=function(_0xea5cf2,_0x1b4ef2){var _0x12114a={'raw':!![],'where':{'id':_0xea5cf2[_0xff90('0x3a')]['id']}},_0x364b04={};_0x364b04[_0xff90('0x27')]=_['keys'](db[_0xff90('0x23')][_0xff90('0x3b')]);_0x364b04[_0xff90('0x28')]=_[_0xff90('0x3c')](_0xea5cf2[_0xff90('0x28')]);_0x364b04[_0xff90('0x29')]=_[_0xff90('0x2a')](_0x364b04['model'],_0x364b04[_0xff90('0x28')]);_0x12114a[_0xff90('0x2c')]=_[_0xff90('0x2a')](_0x364b04['model'],qs[_0xff90('0x2b')](_0xea5cf2[_0xff90('0x28')][_0xff90('0x2b')]));_0x12114a['attributes']=_0x12114a['attributes'][_0xff90('0x2d')]?_0x12114a[_0xff90('0x2c')]:_0x364b04[_0xff90('0x27')];if(_0xea5cf2[_0xff90('0x28')][_0xff90('0x3d')]){_0x12114a[_0xff90('0x36')]=[{'all':!![]}];}_0x12114a=_[_0xff90('0x33')]({},_0x12114a,_0xea5cf2[_0xff90('0x35')]);return db['Network']['find'](_0x12114a)['then'](handleEntityNotFound(_0x1b4ef2,null))['then'](respondWithResult(_0x1b4ef2,null))[_0xff90('0x14')](handleError(_0x1b4ef2,null));};exports[_0xff90('0x3e')]=function(_0x61a22a,_0x15e0e7){var _0xf4483e;return db[_0xff90('0x23')][_0xff90('0x3e')](_0x61a22a[_0xff90('0x3f')],{'raw':!![]})[_0xff90('0xa')](function(_0x134888){_0xf4483e=_0x134888;return db[_0xff90('0x23')][_0xff90('0x37')]({'where':{'type':_0x61a22a[_0xff90('0x3f')][_0xff90('0x25')]},'raw':!![]});})[_0xff90('0xa')](function(_0x4206e7){if(_0xf4483e[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x41')){var _0x1e9c90=fs['readFileSync'](path['join'](config[_0xff90('0x42')],_0xff90('0x43')),'utf8');var _0x4b15c7=ejs['render'](_0x1e9c90,{'networks':_0x4206e7||[]});fs['writeFileSync'](_0xff90('0x44'),_0x4b15c7);return respondWithRpcPromise('Reload','create',{'module':'res_stun_monitor.so'});}else if(_0xf4483e[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x45')){var _0xa90cb9=fs[_0xff90('0x46')](path['join'](config[_0xff90('0x42')],_0xff90('0x47')),_0xff90('0x48'));var _0x58e98b=ejs[_0xff90('0x49')](_0xa90cb9,{'networks':_0x4206e7||[]});fs[_0xff90('0x4a')](_0xff90('0x4b'),_0x58e98b);return respondWithRpcPromise('Reload',_0xff90('0x3e'),{'module':'res_stun_monitor.so'});}else{var _0x295367=fs[_0xff90('0x46')](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x4d')),'utf8');var _0x1ac4d1=ejs[_0xff90('0x49')](_0x295367,{'networks':_0x4206e7||[]});fs[_0xff90('0x4a')](util['format'](_0xff90('0x4e'),_0x61a22a['body'][_0xff90('0x25')][_0xff90('0x4f')]()),_0x1ac4d1);return respondWithRpcPromise(_0xff90('0x50'),'create',{'module':_0xff90('0x51')});}})[_0xff90('0xa')](function(){return _0xf4483e;})[_0xff90('0xa')](respondWithResult(_0x15e0e7,0xc9))[_0xff90('0x14')](handleError(_0x15e0e7,null));};exports[_0xff90('0x52')]=function(_0x2b1d5d,_0xf13df){var _0x35dd2a;return db['Network'][_0xff90('0x53')]({'where':{'id':_0x2b1d5d[_0xff90('0x3a')]['id']}})[_0xff90('0xa')](handleEntityNotFound(_0xf13df,null))['then'](saveUpdates(_0x2b1d5d['body'],null))[_0xff90('0xa')](function(_0x534aaa){if(_0x534aaa){_0x35dd2a=_0x534aaa;return db['Network'][_0xff90('0x37')]({'where':{'type':_0x35dd2a[_0xff90('0x25')]},'raw':!![]});}return null;})['then'](function(_0x441bab){if(_0x35dd2a[_0xff90('0x25')][_0xff90('0x40')]()=='STUN'){var _0x4403d1=fs[_0xff90('0x46')](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x43')),_0xff90('0x48'));var _0x3d7040=ejs[_0xff90('0x49')](_0x4403d1,{'networks':_0x441bab||[]});fs[_0xff90('0x4a')](_0xff90('0x44'),_0x3d7040);return respondWithRpcPromise('Reload','update',{'module':_0xff90('0x54')});}else if(_0x35dd2a[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x45')){var _0x787295=fs[_0xff90('0x46')](path['join'](config['root'],_0xff90('0x47')),_0xff90('0x48'));var _0x7cb365=ejs[_0xff90('0x49')](_0x787295,{'networks':_0x441bab||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x7cb365);return respondWithRpcPromise(_0xff90('0x50'),_0xff90('0x52'),{'module':_0xff90('0x54')});}else{var _0x5bf640=fs['readFileSync'](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x4d')),_0xff90('0x48'));var _0x5e35d1=ejs[_0xff90('0x49')](_0x5bf640,{'networks':_0x441bab||[]});fs[_0xff90('0x4a')](util[_0xff90('0x55')](_0xff90('0x4e'),_0x2b1d5d[_0xff90('0x3f')][_0xff90('0x25')][_0xff90('0x4f')]()),_0x5e35d1);return respondWithRpcPromise(_0xff90('0x50'),_0xff90('0x52'),{'module':_0xff90('0x51')});}})[_0xff90('0xa')](function(_0x3ba2ea){if(_0x3ba2ea){return _0x35dd2a;}return null;})[_0xff90('0xa')](respondWithResult(_0xf13df,null))[_0xff90('0x14')](handleError(_0xf13df,null));};exports[_0xff90('0x1d')]=function(_0x8a080c,_0x37b695){var _0x564dd6;return db[_0xff90('0x23')][_0xff90('0x53')]({'where':{'id':_0x8a080c[_0xff90('0x3a')]['id']}})[_0xff90('0xa')](function(_0x38f19e){_0x564dd6=_0x38f19e;return _0x38f19e;})[_0xff90('0xa')](handleEntityNotFound(_0x37b695,null))[_0xff90('0xa')](removeEntity(_0x37b695,null))[_0xff90('0xa')](function(){if(_0x564dd6){return db[_0xff90('0x23')][_0xff90('0x37')]({'where':{'type':_0x564dd6[_0xff90('0x25')]},'raw':!![]});}})['then'](function(_0x270246){if(_0x564dd6['type'][_0xff90('0x40')]()==_0xff90('0x41')){var _0x39e621=fs[_0xff90('0x46')](path['join'](config[_0xff90('0x42')],_0xff90('0x43')),'utf8');var _0x1d2db3=ejs[_0xff90('0x49')](_0x39e621,{'networks':_0x270246||[]});fs['writeFileSync'](_0xff90('0x44'),_0x1d2db3);return respondWithRpcPromise(_0xff90('0x50'),'destroy',{'module':_0xff90('0x54')});}else if(_0x564dd6[_0xff90('0x25')][_0xff90('0x40')]()==_0xff90('0x45')){var _0x126d8d=fs[_0xff90('0x46')](path['join'](config[_0xff90('0x42')],_0xff90('0x47')),_0xff90('0x48'));var _0xb56baa=ejs[_0xff90('0x49')](_0x126d8d,{'networks':_0x270246||[]});fs[_0xff90('0x4a')](_0xff90('0x4b'),_0xb56baa);return respondWithRpcPromise('Reload',_0xff90('0x1d'),{'module':_0xff90('0x54')});}else{var _0x4f6758=fs[_0xff90('0x46')](path[_0xff90('0x4c')](config[_0xff90('0x42')],_0xff90('0x4d')),'utf8');var _0x30869a=ejs['render'](_0x4f6758,{'networks':_0x270246||[]});fs[_0xff90('0x4a')](util[_0xff90('0x55')](_0xff90('0x4e'),_0x564dd6[_0xff90('0x25')]['toLowerCase']()),_0x30869a);return respondWithRpcPromise(_0xff90('0x50'),'destroy',{'module':_0xff90('0x51')});}})[_0xff90('0x14')](handleError(_0x37b695,null));}; \ No newline at end of file +var _0x3041=['server/files/templates/turn_multiple.ejs','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','server/files/templates/stun_multiple.ejs','toLowerCase','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','jayson/promise','client','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','sendStatus','stack','name','Network','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','options','includeAll','include','show','params','rawAttributes','keys','find','create','body','findAll','toUpperCase','STUN','readFileSync','join','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','root'];(function(_0x4e5ef0,_0x1370b1){var _0x2a198a=function(_0x358fdd){while(--_0x358fdd){_0x4e5ef0['push'](_0x4e5ef0['shift']());}};_0x2a198a(++_0x1370b1);}(_0x3041,0xab));var _0x1304=function(_0x110596,_0x1faae7){_0x110596=_0x110596-0x0;var _0x51fef2=_0x3041[_0x110596];return _0x51fef2;};'use strict';var util=require(_0x1304('0x0'));var path=require(_0x1304('0x1'));var ejs=require(_0x1304('0x2'));var fs=require('fs');var _=require(_0x1304('0x3'));var qs=require(_0x1304('0x4'));var logger=require(_0x1304('0x5'))('api');var config=require(_0x1304('0x6'));var db=require(_0x1304('0x7'))['db'];var jayson=require(_0x1304('0x8'));var client=jayson[_0x1304('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc8125e,_0x3286b4,_0x43b3f3,_0x79f3f){return new Promise(function(_0x21d1a0,_0x4b9bdc){var _0x272602=_0x79f3f||client;return _0x272602[_0x1304('0xa')](_0xc8125e,_0x43b3f3)[_0x1304('0xb')](function(_0x3393d7){logger[_0x1304('0xc')](_0x1304('0xd'),_0x3286b4,_0x1304('0xe'));logger[_0x1304('0xf')](_0x1304('0x10'),_0x3286b4,'request\x20sent',JSON['stringify'](_0x3393d7));if(_0x3393d7[_0x1304('0x11')]){if(_0x3393d7[_0x1304('0x11')][_0x1304('0x12')]===0x1f4){logger[_0x1304('0x11')](_0x1304('0xd'),_0x3286b4,_0x3393d7[_0x1304('0x11')]['message']);return _0x4b9bdc(_0x3393d7[_0x1304('0x11')][_0x1304('0x13')]);}logger[_0x1304('0x11')](_0x1304('0xd'),_0x3286b4,_0x3393d7[_0x1304('0x11')]['message']);return _0x21d1a0(_0x3393d7[_0x1304('0x11')][_0x1304('0x13')]);}else{logger[_0x1304('0xc')](_0x1304('0xd'),_0x3286b4,_0x1304('0xe'));_0x21d1a0(_0x3393d7[_0x1304('0x14')][_0x1304('0x13')]);}})[_0x1304('0x15')](function(_0x217332){logger['error'](_0x1304('0xd'),_0x3286b4,_0x217332);_0x4b9bdc(_0x217332);});});}function respondWithResult(_0x53e963,_0x4c2032){_0x4c2032=_0x4c2032||0xc8;return function(_0x4b8091){if(_0x4b8091){return _0x53e963[_0x1304('0x16')](_0x4c2032)[_0x1304('0x17')](_0x4b8091);}};}function respondWithFilteredResult(_0x506bb2,_0x80de76){return function(_0xe365c8){if(_0xe365c8){var _0x3f897a=typeof _0x80de76[_0x1304('0x18')]==='undefined'&&typeof _0x80de76['limit']===_0x1304('0x19');var _0x287123=_0xe365c8[_0x1304('0x1a')];var _0x4794e1=_0x3f897a?0x0:_0x80de76[_0x1304('0x18')];var _0x552161=_0x3f897a?_0xe365c8[_0x1304('0x1a')]:_0x80de76[_0x1304('0x18')]+_0x80de76['limit'];var _0x182e79;if(_0x552161>=_0x287123){_0x552161=_0x287123;_0x182e79=0xc8;}else{_0x182e79=0xce;}_0x506bb2[_0x1304('0x16')](_0x182e79);return _0x506bb2[_0x1304('0x1b')](_0x1304('0x1c'),_0x4794e1+'-'+_0x552161+'/'+_0x287123)[_0x1304('0x17')](_0xe365c8);}return null;};}function saveUpdates(_0x22fe2f){return function(_0x3059c0){if(_0x3059c0){return _0x3059c0[_0x1304('0x1d')](_0x22fe2f)['then'](function(_0x1764ef){return _0x1764ef;});}return null;};}function removeEntity(_0x2836e8){return function(_0x420ee6){if(_0x420ee6){return _0x420ee6[_0x1304('0x1e')]()[_0x1304('0xb')](function(){_0x2836e8[_0x1304('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x235a02){return function(_0x1f06d3){if(!_0x1f06d3){_0x235a02[_0x1304('0x1f')](0x194);}return _0x1f06d3;};}function handleError(_0x28a234,_0x274c6e){_0x274c6e=_0x274c6e||0x1f4;return function(_0x4ddb27){logger['error'](_0x4ddb27[_0x1304('0x20')]);if(_0x4ddb27[_0x1304('0x21')]){delete _0x4ddb27[_0x1304('0x21')];}_0x28a234['status'](_0x274c6e)['send'](_0x4ddb27);};}exports['index']=function(_0x1d0577,_0x2271b7){var _0x593fdb={},_0x108a9f={},_0x1d5788={'count':0x0,'rows':[]};var _0x2362ff=_['map'](db[_0x1304('0x22')]['rawAttributes'],function(_0x283d16){return{'name':_0x283d16[_0x1304('0x23')],'type':_0x283d16[_0x1304('0x24')]['key']};});_0x108a9f[_0x1304('0x25')]=_['map'](_0x2362ff,'name');_0x108a9f[_0x1304('0x26')]=_['keys'](_0x1d0577[_0x1304('0x26')]);_0x108a9f[_0x1304('0x27')]=_[_0x1304('0x28')](_0x108a9f['model'],_0x108a9f['query']);_0x593fdb['attributes']=_[_0x1304('0x28')](_0x108a9f[_0x1304('0x25')],qs[_0x1304('0x29')](_0x1d0577['query']['fields']));_0x593fdb[_0x1304('0x2a')]=_0x593fdb[_0x1304('0x2a')][_0x1304('0x2b')]?_0x593fdb[_0x1304('0x2a')]:_0x108a9f[_0x1304('0x25')];if(!_0x1d0577[_0x1304('0x26')][_0x1304('0x2c')](_0x1304('0x2d'))){_0x593fdb[_0x1304('0x2e')]=qs[_0x1304('0x2e')](_0x1d0577['query'][_0x1304('0x2e')]);_0x593fdb[_0x1304('0x18')]=qs[_0x1304('0x18')](_0x1d0577['query'][_0x1304('0x18')]);}_0x593fdb[_0x1304('0x2f')]=qs[_0x1304('0x30')](_0x1d0577[_0x1304('0x26')]['sort']);_0x593fdb[_0x1304('0x31')]=qs[_0x1304('0x27')](_['pick'](_0x1d0577[_0x1304('0x26')],_0x108a9f[_0x1304('0x27')]),_0x2362ff);if(_0x1d0577[_0x1304('0x26')][_0x1304('0x32')]){_0x593fdb['where']=_[_0x1304('0x33')](_0x593fdb[_0x1304('0x31')],{'$or':_['map'](_0x2362ff,function(_0x47e794){if(_0x47e794[_0x1304('0x24')]!=='VIRTUAL'){var _0x492d63={};_0x492d63[_0x47e794[_0x1304('0x21')]]={'$like':'%'+_0x1d0577['query'][_0x1304('0x32')]+'%'};return _0x492d63;}})});}_0x593fdb=_[_0x1304('0x33')]({},_0x593fdb,_0x1d0577[_0x1304('0x34')]);var _0x21f862={'where':_0x593fdb[_0x1304('0x31')]};return db[_0x1304('0x22')][_0x1304('0x1a')](_0x21f862)[_0x1304('0xb')](function(_0x37ede4){_0x1d5788[_0x1304('0x1a')]=_0x37ede4;if(_0x1d0577['query'][_0x1304('0x35')]){_0x593fdb[_0x1304('0x36')]=[{'all':!![]}];}return db['Network']['findAll'](_0x593fdb);})[_0x1304('0xb')](function(_0x4e7c70){_0x1d5788['rows']=_0x4e7c70;return _0x1d5788;})['then'](respondWithFilteredResult(_0x2271b7,_0x593fdb))[_0x1304('0x15')](handleError(_0x2271b7,null));};exports[_0x1304('0x37')]=function(_0x317339,_0x91814f){var _0x22c365={'raw':!![],'where':{'id':_0x317339[_0x1304('0x38')]['id']}},_0xd232cc={};_0xd232cc['model']=_['keys'](db['Network'][_0x1304('0x39')]);_0xd232cc[_0x1304('0x26')]=_[_0x1304('0x3a')](_0x317339[_0x1304('0x26')]);_0xd232cc[_0x1304('0x27')]=_[_0x1304('0x28')](_0xd232cc[_0x1304('0x25')],_0xd232cc[_0x1304('0x26')]);_0x22c365[_0x1304('0x2a')]=_[_0x1304('0x28')](_0xd232cc['model'],qs[_0x1304('0x29')](_0x317339[_0x1304('0x26')][_0x1304('0x29')]));_0x22c365['attributes']=_0x22c365[_0x1304('0x2a')][_0x1304('0x2b')]?_0x22c365[_0x1304('0x2a')]:_0xd232cc[_0x1304('0x25')];if(_0x317339[_0x1304('0x26')][_0x1304('0x35')]){_0x22c365[_0x1304('0x36')]=[{'all':!![]}];}_0x22c365=_[_0x1304('0x33')]({},_0x22c365,_0x317339[_0x1304('0x34')]);return db['Network'][_0x1304('0x3b')](_0x22c365)['then'](handleEntityNotFound(_0x91814f,null))[_0x1304('0xb')](respondWithResult(_0x91814f,null))[_0x1304('0x15')](handleError(_0x91814f,null));};exports[_0x1304('0x3c')]=function(_0x3941d6,_0x1c88b7){var _0x224ee4;return db['Network'][_0x1304('0x3c')](_0x3941d6[_0x1304('0x3d')],{'raw':!![]})[_0x1304('0xb')](function(_0x363cb2){_0x224ee4=_0x363cb2;return db[_0x1304('0x22')][_0x1304('0x3e')]({'where':{'type':_0x3941d6[_0x1304('0x3d')]['type']},'raw':!![]});})[_0x1304('0xb')](function(_0x58106a){if(_0x224ee4['type'][_0x1304('0x3f')]()==_0x1304('0x40')){var _0x47f71e=fs[_0x1304('0x41')](path[_0x1304('0x42')](config['root'],'server/files/templates/stun_multiple.ejs'),_0x1304('0x43'));var _0x57e832=ejs[_0x1304('0x44')](_0x47f71e,{'networks':_0x58106a||[]});fs[_0x1304('0x45')](_0x1304('0x46'),_0x57e832);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x3c'),{'module':_0x1304('0x48')});}else if(_0x224ee4[_0x1304('0x24')][_0x1304('0x3f')]()==_0x1304('0x49')){var _0x35cbe1=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x4b')),_0x1304('0x43'));var _0x22c0e7=ejs[_0x1304('0x44')](_0x35cbe1,{'networks':_0x58106a||[]});fs[_0x1304('0x45')]('/etc/asterisk/turn_xcally.conf',_0x22c0e7);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x3c'),{'module':'res_stun_monitor.so'});}else{var _0x594d67=fs['readFileSync'](path['join'](config['root'],_0x1304('0x4c')),_0x1304('0x43'));var _0x181cf7=ejs[_0x1304('0x44')](_0x594d67,{'networks':_0x58106a||[]});fs[_0x1304('0x45')](util[_0x1304('0x4d')](_0x1304('0x4e'),_0x3941d6['body'][_0x1304('0x24')]['toLowerCase']()),_0x181cf7);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x3c'),{'module':_0x1304('0x4f')});}})['then'](function(){return _0x224ee4;})[_0x1304('0xb')](respondWithResult(_0x1c88b7,0xc9))['catch'](handleError(_0x1c88b7,null));};exports[_0x1304('0x1d')]=function(_0x2d3984,_0x1f3be2){var _0x106503;return db['Network'][_0x1304('0x3b')]({'where':{'id':_0x2d3984['params']['id']}})['then'](handleEntityNotFound(_0x1f3be2,null))[_0x1304('0xb')](saveUpdates(_0x2d3984[_0x1304('0x3d')],null))[_0x1304('0xb')](function(_0x10b383){if(_0x10b383){_0x106503=_0x10b383;return db[_0x1304('0x22')][_0x1304('0x3e')]({'where':{'type':_0x106503[_0x1304('0x24')]},'raw':!![]});}return null;})[_0x1304('0xb')](function(_0xf3daec){if(_0x106503[_0x1304('0x24')][_0x1304('0x3f')]()=='STUN'){var _0x55241a=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x50')),'utf8');var _0x119cc3=ejs[_0x1304('0x44')](_0x55241a,{'networks':_0xf3daec||[]});fs[_0x1304('0x45')](_0x1304('0x46'),_0x119cc3);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1d'),{'module':_0x1304('0x48')});}else if(_0x106503[_0x1304('0x24')][_0x1304('0x3f')]()==_0x1304('0x49')){var _0x116175=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],'server/files/templates/turn_multiple.ejs'),_0x1304('0x43'));var _0x342079=ejs['render'](_0x116175,{'networks':_0xf3daec||[]});fs[_0x1304('0x45')]('/etc/asterisk/turn_xcally.conf',_0x342079);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x2c7d19=fs[_0x1304('0x41')](path['join'](config['root'],'server/files/templates/network.ejs'),'utf8');var _0x5555e9=ejs[_0x1304('0x44')](_0x2c7d19,{'networks':_0xf3daec||[]});fs[_0x1304('0x45')](util[_0x1304('0x4d')](_0x1304('0x4e'),_0x2d3984[_0x1304('0x3d')][_0x1304('0x24')][_0x1304('0x51')]()),_0x5555e9);return respondWithRpcPromise(_0x1304('0x47'),'update',{'module':_0x1304('0x4f')});}})[_0x1304('0xb')](function(_0x5d761c){if(_0x5d761c){return _0x106503;}return null;})[_0x1304('0xb')](respondWithResult(_0x1f3be2,null))[_0x1304('0x15')](handleError(_0x1f3be2,null));};exports[_0x1304('0x1e')]=function(_0x180144,_0x4a8648){var _0x2cc6f5;return db['Network'][_0x1304('0x3b')]({'where':{'id':_0x180144['params']['id']}})[_0x1304('0xb')](function(_0xc2af7d){_0x2cc6f5=_0xc2af7d;return _0xc2af7d;})[_0x1304('0xb')](handleEntityNotFound(_0x4a8648,null))[_0x1304('0xb')](removeEntity(_0x4a8648,null))[_0x1304('0xb')](function(){if(_0x2cc6f5){return db[_0x1304('0x22')][_0x1304('0x3e')]({'where':{'type':_0x2cc6f5[_0x1304('0x24')]},'raw':!![]});}})[_0x1304('0xb')](function(_0x548c24){if(_0x2cc6f5[_0x1304('0x24')][_0x1304('0x3f')]()=='STUN'){var _0x41aa00=fs['readFileSync'](path[_0x1304('0x42')](config[_0x1304('0x4a')],'server/files/templates/stun_multiple.ejs'),'utf8');var _0x756594=ejs[_0x1304('0x44')](_0x41aa00,{'networks':_0x548c24||[]});fs[_0x1304('0x45')]('/etc/asterisk/stun_xcally.conf',_0x756594);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1e'),{'module':_0x1304('0x48')});}else if(_0x2cc6f5[_0x1304('0x24')][_0x1304('0x3f')]()==_0x1304('0x49')){var _0x4fca54=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x4b')),_0x1304('0x43'));var _0x15dcdb=ejs['render'](_0x4fca54,{'networks':_0x548c24||[]});fs[_0x1304('0x45')]('/etc/asterisk/turn_xcally.conf',_0x15dcdb);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1e'),{'module':'res_stun_monitor.so'});}else{var _0x3ec7c3=fs[_0x1304('0x41')](path[_0x1304('0x42')](config[_0x1304('0x4a')],_0x1304('0x4c')),'utf8');var _0x2313a7=ejs['render'](_0x3ec7c3,{'networks':_0x548c24||[]});fs['writeFileSync'](util[_0x1304('0x4d')]('/etc/asterisk/sip_xcally_%s.conf',_0x2cc6f5['type'][_0x1304('0x51')]()),_0x2313a7);return respondWithRpcPromise(_0x1304('0x47'),_0x1304('0x1e'),{'module':'chan_sip.so'});}})['catch'](handleError(_0x4a8648,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 7cd34ac..8970815 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 _0x1752=['bluebird','request-promise','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','api','moment'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x1752,0xa5));var _0x2175=function(_0x29ab7d,_0x46867f){_0x29ab7d=_0x29ab7d-0x0;var _0xabacd9=_0x1752[_0x29ab7d];return _0xabacd9;};'use strict';var _=require('lodash');var util=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));var moment=require(_0x2175('0x3'));var BPromise=require(_0x2175('0x4'));var rp=require(_0x2175('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2175('0x6'));var config=require(_0x2175('0x7'));var attributes=require(_0x2175('0x8'));module[_0x2175('0x9')]=function(_0x222868,_0x27ff0b){return _0x222868[_0x2175('0xa')](_0x2175('0xb'),attributes,{'tableName':_0x2175('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa45c=['request-promise','rimraf','exports','define','network','lodash','util','moment'];(function(_0x6f2f43,_0x3c223a){var _0x3d6334=function(_0x5f3894){while(--_0x5f3894){_0x6f2f43['push'](_0x6f2f43['shift']());}};_0x3d6334(++_0x3c223a);}(_0xa45c,0x6d));var _0xca45=function(_0x31eb02,_0x471e95){_0x31eb02=_0x31eb02-0x0;var _0x1c617d=_0xa45c[_0x31eb02];return _0x1c617d;};'use strict';var _=require(_0xca45('0x0'));var util=require(_0xca45('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xca45('0x2'));var BPromise=require('bluebird');var rp=require(_0xca45('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xca45('0x4'));var config=require('../../config/environment');var attributes=require('./network.attributes');module[_0xca45('0x5')]=function(_0x3803d6,_0x18d789){return _0x3803d6[_0xca45('0x6')]('Network',attributes,{'tableName':_0xca45('0x7'),'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 2b9820a..7f31f57 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(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x7a54,0x106));var _0x47a5=function(_0x4662e1,_0x3c6c75){_0x4662e1=_0x4662e1-0x0;var _0xac77ca=_0x7a54[_0x4662e1];return _0xac77ca;};'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(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x10e5e8,_0x57fb63){_0x10e5e8=_0x10e5e8-0x0;var _0xd3f7cc=_0x7a54[_0x10e5e8];return _0xd3f7cc;};'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 683ac99..a1a5852 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 _0x7b84=['notify','addAgents','/:id/send','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addDisposition'];(function(_0x378ae2,_0x564353){var _0x597f74=function(_0x2369b2){while(--_0x2369b2){_0x378ae2['push'](_0x378ae2['shift']());}};_0x597f74(++_0x564353);}(_0x7b84,0x17c));var _0x47b8=function(_0x115569,_0x99a003){_0x115569=_0x115569-0x0;var _0x392d72=_0x7b84[_0x115569];return _0x392d72;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var fs_extra=require(_0x47b8('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x47b8('0x7'));var config=require(_0x47b8('0x8'));var controller=require(_0x47b8('0x9'));router[_0x47b8('0xa')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0xc')]);router['get'](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xa')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x10')]);router[_0x47b8('0xa')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0xa')](_0x47b8('0x13'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0xa')](_0x47b8('0x15'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);router[_0x47b8('0xa')](_0x47b8('0x17'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x18')]);router[_0x47b8('0xa')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1a')]);router['post']('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x1b')]);router[_0x47b8('0x1c')](_0x47b8('0x11'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x1d')]);router[_0x47b8('0x1c')]('/:id/canned_answers',auth[_0x47b8('0xb')](),controller['addAnswer']);router['post']('/:id/notify',controller[_0x47b8('0x1e')]);router[_0x47b8('0x1c')](_0x47b8('0x15'),auth['isAuthenticated'](),controller['addApplications']);router['post'](_0x47b8('0x19'),auth['isAuthenticated'](),controller[_0x47b8('0x1f')]);router[_0x47b8('0x1c')](_0x47b8('0x20'),auth[_0x47b8('0xb')](),controller['send']);router[_0x47b8('0x21')](_0x47b8('0xf'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x22')]);router[_0x47b8('0x23')](_0x47b8('0xf'),auth['isAuthenticated'](),controller[_0x47b8('0x24')]);router[_0x47b8('0x23')]('/:id/dispositions',auth[_0x47b8('0xb')](),controller[_0x47b8('0x25')]);router[_0x47b8('0x23')](_0x47b8('0x13'),auth['isAuthenticated'](),controller[_0x47b8('0x26')]);router[_0x47b8('0x23')](_0x47b8('0x19'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x27')]);module[_0x47b8('0x28')]=router; \ No newline at end of file +var _0x4213=['/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','put','update','delete','destroy','/:id/dispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions'];(function(_0x4a103,_0x45dc99){var _0x4680d2=function(_0x58e6a8){while(--_0x58e6a8){_0x4a103['push'](_0x4a103['shift']());}};_0x4680d2(++_0x45dc99);}(_0x4213,0x77));var _0x3421=function(_0x282160,_0x2b7f23){_0x282160=_0x282160-0x0;var _0x1b9077=_0x4213[_0x282160];return _0x1b9077;};'use strict';var multer=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var path=require(_0x3421('0x2'));var timeout=require(_0x3421('0x3'));var express=require(_0x3421('0x4'));var router=express[_0x3421('0x5')]();var fs_extra=require(_0x3421('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x3421('0x7'));var config=require('../../config/environment');var controller=require(_0x3421('0x8'));router[_0x3421('0x9')]('/',auth[_0x3421('0xa')](),controller[_0x3421('0xb')]);router['get'](_0x3421('0xc'),auth[_0x3421('0xa')](),controller[_0x3421('0xd')]);router[_0x3421('0x9')](_0x3421('0xe'),auth['isAuthenticated'](),controller[_0x3421('0xf')]);router['get']('/:id/dispositions',auth[_0x3421('0xa')](),controller['getDispositions']);router[_0x3421('0x9')](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x11')]);router[_0x3421('0x9')](_0x3421('0x12'),auth[_0x3421('0xa')](),controller['getApplications']);router[_0x3421('0x9')](_0x3421('0x13'),auth[_0x3421('0xa')](),controller[_0x3421('0x14')]);router[_0x3421('0x9')](_0x3421('0x15'),auth[_0x3421('0xa')](),controller['getAgents']);router[_0x3421('0x16')]('/',auth['isAuthenticated'](),controller[_0x3421('0x17')]);router[_0x3421('0x16')]('/:id/dispositions',auth[_0x3421('0xa')](),controller['addDisposition']);router[_0x3421('0x16')](_0x3421('0x10'),auth['isAuthenticated'](),controller[_0x3421('0x18')]);router[_0x3421('0x16')](_0x3421('0x19'),controller[_0x3421('0x1a')]);router[_0x3421('0x16')](_0x3421('0x12'),auth[_0x3421('0xa')](),controller[_0x3421('0x1b')]);router[_0x3421('0x16')](_0x3421('0x15'),auth[_0x3421('0xa')](),controller['addAgents']);router[_0x3421('0x16')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x3421('0x1c')](_0x3421('0xe'),auth[_0x3421('0xa')](),controller[_0x3421('0x1d')]);router[_0x3421('0x1e')](_0x3421('0xe'),auth[_0x3421('0xa')](),controller[_0x3421('0x1f')]);router[_0x3421('0x1e')](_0x3421('0x20'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x3421('0x10'),auth[_0x3421('0xa')](),controller[_0x3421('0x21')]);router['delete']('/:id/users',auth[_0x3421('0xa')](),controller['removeAgents']);module[_0x3421('0x22')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index fd57501..34ac878 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 _0xad8c=['generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','randomstring','exports','STRING'];(function(_0x225ecc,_0x2deeb3){var _0x2ea166=function(_0x240d94){while(--_0x240d94){_0x225ecc['push'](_0x225ecc['shift']());}};_0x2ea166(++_0x2deeb3);}(_0xad8c,0xc3));var _0xcad8=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xad8c[_0x376db5];return _0x304c17;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xcad8('0x0'));module[_0xcad8('0x1')]={'name':{'type':Sequelize[_0xcad8('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xcad8('0x2')]},'token':{'type':Sequelize[_0xcad8('0x2')],'defaultValue':function(){return rs[_0xcad8('0x3')]();}},'replyUri':{'type':Sequelize[_0xcad8('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xcad8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xcad8('0x4');}},'notificationSound':{'type':Sequelize[_0xcad8('0x5')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcad8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xcad8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xcad8('0x5')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcad8('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcad8('0x5')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcad8('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0xcad8('0x7')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xcad8('0x8'),'set':function(_0x34fa96){if(!_0x34fa96)this[_0xcad8('0x9')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xcad8('0xa'),_0x34fa96);}}}; \ No newline at end of file +var _0x9d4e=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','exports','STRING','name'];(function(_0x4b7a31,_0x54b8f8){var _0x5c2c6e=function(_0x141904){while(--_0x141904){_0x4b7a31['push'](_0x4b7a31['shift']());}};_0x5c2c6e(++_0x54b8f8);}(_0x9d4e,0x140));var _0xe9d4=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x9d4e[_0x13b02f];return _0x12e9a6;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xe9d4('0x0'));module[_0xe9d4('0x1')]={'name':{'type':Sequelize[_0xe9d4('0x2')],'unique':_0xe9d4('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xe9d4('0x2')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xe9d4('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xe9d4('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xe9d4('0x4')],'defaultValue':function(){return _0xe9d4('0x5');}},'notificationSound':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xe9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe9d4('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe9d4('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0xe9d4('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xe9d4('0x6')],'defaultValue':![],'comment':_0xe9d4('0x9'),'set':function(_0x2e2795){if(!_0x2e2795)this[_0xe9d4('0xa')](_0xe9d4('0xb'),null);this[_0xe9d4('0xa')]('mandatoryDisposition',_0x2e2795);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ecdbc3a..2471e36 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 _0x1a0b=['queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','Contact','fullname','internal','Tag','color','tag','addAgents','omit','emit','removeAgents','isArray','getAgents','out','Messages','dataValues','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','error','code','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','end','status','offset','undefined','limit','count','set','reject','save','update','destroy','OpenchannelAccounts','UserProfileResource','sendStatus','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','name','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','keys','length','include','find','create','body','user','get','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CannedAnswer','removeAnswers','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','Contacts','DESC','OpenchannelApplication','List','account','applications','Applications','list','orderBy','priority','asc','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','firstName','messageId','interaction','created','push','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','unshift'];(function(_0x1a9204,_0x1c9e00){var _0x17ca68=function(_0x1f4399){while(--_0x1f4399){_0x1a9204['push'](_0x1a9204['shift']());}};_0x17ca68(++_0x1c9e00);}(_0x1a0b,0x18f));var _0xb1a0=function(_0x214fc4,_0x3fe28b){_0x214fc4=_0x214fc4-0x0;var _0x3bb477=_0x1a0b[_0x214fc4];return _0x3bb477;};'use strict';var emlformat=require(_0xb1a0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb1a0('0x1'));var jsonpatch=require(_0xb1a0('0x2'));var rp=require(_0xb1a0('0x3'));var moment=require(_0xb1a0('0x4'));var BPromise=require(_0xb1a0('0x5'));var Mustache=require(_0xb1a0('0x6'));var util=require(_0xb1a0('0x7'));var path=require(_0xb1a0('0x8'));var sox=require(_0xb1a0('0x9'));var csv=require(_0xb1a0('0xa'));var ejs=require(_0xb1a0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xb1a0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb1a0('0xd'));var toCsv=require(_0xb1a0('0xa'));var querystring=require(_0xb1a0('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb1a0('0xf'));var qs=require(_0xb1a0('0x10'));var as=require(_0xb1a0('0x11'));var hardwareService=require(_0xb1a0('0x12'));var logger=require(_0xb1a0('0x13'))(_0xb1a0('0x14'));var utils=require('../../config/utils');var config=require(_0xb1a0('0x15'));var licenseUtil=require(_0xb1a0('0x16'));var db=require(_0xb1a0('0x17'))['db'];config['redis']=_[_0xb1a0('0x18')](config[_0xb1a0('0x19')],{'host':_0xb1a0('0x1a'),'port':0x18eb});var socket=require(_0xb1a0('0x1b'))(new Redis(config['redis']));require(_0xb1a0('0x1c'))[_0xb1a0('0x1d')](socket);var jayson=require(_0xb1a0('0x1e'));var client=jayson[_0xb1a0('0x1f')][_0xb1a0('0x20')]({'port':0x232c});var client9002=jayson[_0xb1a0('0x1f')][_0xb1a0('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x44c05d,_0x393c2e,_0x437d8a,_0x104389){return new BPromise(function(_0x65f9b3,_0x2bbb14){var _0x3e6d71=_0x104389||client;return _0x3e6d71[_0xb1a0('0x21')](_0x44c05d,_0x437d8a)[_0xb1a0('0x22')](function(_0x2c3d0e){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x393c2e,'request\x20sent');logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x393c2e,'request\x20sent',JSON['stringify'](_0x2c3d0e));if(_0x2c3d0e['error']){if(_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x24')]===0x1f4){logger[_0xb1a0('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x393c2e,_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);return _0x2bbb14(_0x2c3d0e[_0xb1a0('0x23')]['message']);}logger[_0xb1a0('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x393c2e,_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);return _0x65f9b3(_0x2c3d0e[_0xb1a0('0x23')][_0xb1a0('0x25')]);}else{logger['info'](_0xb1a0('0x26'),_0x393c2e,'request\x20sent');_0x65f9b3(_0x2c3d0e[_0xb1a0('0x27')][_0xb1a0('0x25')]);}})[_0xb1a0('0x28')](function(_0x10e675){logger[_0xb1a0('0x23')](_0xb1a0('0x26'),_0x393c2e,_0x10e675);_0x2bbb14(_0x10e675);});});}function respondWithStatusCode(_0xb64c7d,_0x282119){_0x282119=_0x282119||0xcc;return function(_0x2e4630){if(_0x2e4630){return _0xb64c7d['sendStatus'](_0x282119);}return _0xb64c7d['status'](_0x282119)[_0xb1a0('0x29')]();};}function respondWithResult(_0x1006dc,_0x3b8900){_0x3b8900=_0x3b8900||0xc8;return function(_0x480854){if(_0x480854){return _0x1006dc[_0xb1a0('0x2a')](_0x3b8900)['json'](_0x480854);}};}function respondWithFilteredResult(_0x3fff58,_0x5a809f){return function(_0x38eab3){if(_0x38eab3){var _0x1d5ec7=typeof _0x5a809f[_0xb1a0('0x2b')]===_0xb1a0('0x2c')&&typeof _0x5a809f[_0xb1a0('0x2d')]===_0xb1a0('0x2c');var _0x320e38=_0x38eab3[_0xb1a0('0x2e')];var _0x1abda5=_0x1d5ec7?0x0:_0x5a809f['offset'];var _0x19b4e4=_0x1d5ec7?_0x38eab3[_0xb1a0('0x2e')]:_0x5a809f[_0xb1a0('0x2b')]+_0x5a809f[_0xb1a0('0x2d')];var _0x3953b2;if(_0x19b4e4>=_0x320e38){_0x19b4e4=_0x320e38;_0x3953b2=0xc8;}else{_0x3953b2=0xce;}_0x3fff58[_0xb1a0('0x2a')](_0x3953b2);return _0x3fff58[_0xb1a0('0x2f')]('Content-Range',_0x1abda5+'-'+_0x19b4e4+'/'+_0x320e38)['json'](_0x38eab3);}return null;};}function patchUpdates(_0xa038bc){return function(_0x1826c3){try{jsonpatch['apply'](_0x1826c3,_0xa038bc,!![]);}catch(_0x42008f){return BPromise[_0xb1a0('0x30')](_0x42008f);}return _0x1826c3[_0xb1a0('0x31')]();};}function saveUpdates(_0x25f44f,_0x69ef32){return function(_0x1822d9){if(_0x1822d9){return _0x1822d9[_0xb1a0('0x32')](_0x25f44f)[_0xb1a0('0x22')](function(_0x39e4f2){return _0x39e4f2;});}return null;};}function removeEntity(_0x357e23,_0x12ef87){return function(_0x1a0e11){if(_0x1a0e11){return _0x1a0e11[_0xb1a0('0x33')]()[_0xb1a0('0x22')](function(){var _0x2d5d11=_0x1a0e11['get']({'plain':!![]});var _0x297e1d=_0xb1a0('0x34');return db[_0xb1a0('0x35')][_0xb1a0('0x33')]({'where':{'type':_0x297e1d,'resourceId':_0x2d5d11['id']}})[_0xb1a0('0x22')](function(){return _0x1a0e11;});})['then'](function(){_0x357e23['status'](0xcc)[_0xb1a0('0x29')]();});}};}function handleEntityNotFound(_0x1e89da,_0x2c2375){return function(_0x3e8dd6){if(!_0x3e8dd6){_0x1e89da[_0xb1a0('0x36')](0x194);}return _0x3e8dd6;};}function handleError(_0xab9e36,_0x503a1b){_0x503a1b=_0x503a1b||0x1f4;return function(_0x21ba57){logger[_0xb1a0('0x23')](_0x21ba57['stack']);if(_0x21ba57['name']){delete _0x21ba57['name'];}_0xab9e36['status'](_0x503a1b)[_0xb1a0('0x37')](_0x21ba57);};}exports['index']=function(_0x30bf80,_0x33efbd){var _0x265e04={'include':[{'model':db[_0xb1a0('0x38')],'as':_0xb1a0('0x39')}]},_0x3eea9a={},_0x418815={'count':0x0,'rows':[]};var _0x1b7d70=_[_0xb1a0('0x3a')](db[_0xb1a0('0x3b')][_0xb1a0('0x3c')],function(_0x283000){return{'name':_0x283000[_0xb1a0('0x3d')],'type':_0x283000[_0xb1a0('0x3e')]['key']};});_0x3eea9a['model']=_[_0xb1a0('0x3a')](_0x1b7d70,_0xb1a0('0x3f'));_0x3eea9a[_0xb1a0('0x40')]=_['keys'](_0x30bf80['query']);_0x3eea9a[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x3eea9a[_0xb1a0('0x43')],_0x3eea9a[_0xb1a0('0x40')]);_0x265e04[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x3eea9a[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x30bf80['query'][_0xb1a0('0x45')]));_0x265e04['attributes']=_0x265e04[_0xb1a0('0x44')]['length']?_0x265e04[_0xb1a0('0x44')]:_0x3eea9a[_0xb1a0('0x43')];if(!_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x46')]('nolimit')){_0x265e04['limit']=qs['limit'](_0x30bf80['query']['limit']);_0x265e04[_0xb1a0('0x2b')]=qs[_0xb1a0('0x2b')](_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}_0x265e04[_0xb1a0('0x47')]=qs['sort'](_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x265e04[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x30bf80[_0xb1a0('0x40')],_0x3eea9a['filters']),_0x1b7d70);if(_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x265e04['where']=_[_0xb1a0('0x4c')](_0x265e04[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x1b7d70,function(_0x4aa192){if(_0x4aa192['type']!==_0xb1a0('0x4d')){var _0xeff1e1={};_0xeff1e1[_0x4aa192['name']]={'$like':'%'+_0x30bf80[_0xb1a0('0x40')][_0xb1a0('0x4b')]+'%'};return _0xeff1e1;}})});}_0x265e04=_[_0xb1a0('0x4c')]({},_0x265e04,_0x30bf80[_0xb1a0('0x4e')]);var _0x303d91={'where':_0x265e04[_0xb1a0('0x49')]};return db[_0xb1a0('0x3b')][_0xb1a0('0x2e')](_0x303d91)[_0xb1a0('0x22')](function(_0x116c7a){_0x418815[_0xb1a0('0x2e')]=_0x116c7a;if(_0x30bf80['query'][_0xb1a0('0x4f')]){_0x265e04['include']=[{'all':!![]}];}return db[_0xb1a0('0x3b')][_0xb1a0('0x50')](_0x265e04);})['then'](function(_0x15012b){_0x418815[_0xb1a0('0x51')]=_0x15012b;return _0x418815;})[_0xb1a0('0x22')](respondWithFilteredResult(_0x33efbd,_0x265e04))[_0xb1a0('0x28')](handleError(_0x33efbd,null));};exports[_0xb1a0('0x52')]=function(_0x3c7c27,_0xeefaab){var _0x238696={'raw':![],'where':{'id':_0x3c7c27[_0xb1a0('0x53')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x48d0a0={};_0x48d0a0[_0xb1a0('0x43')]=_['keys'](db['OpenchannelAccount'][_0xb1a0('0x3c')]);_0x48d0a0[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x3c7c27[_0xb1a0('0x40')]);_0x48d0a0[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x48d0a0['model'],_0x48d0a0['query']);_0x238696[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x48d0a0[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x3c7c27[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x238696[_0xb1a0('0x44')]=_0x238696[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x238696[_0xb1a0('0x44')]:_0x48d0a0['model'];if(_0x3c7c27[_0xb1a0('0x40')][_0xb1a0('0x4f')]){_0x238696[_0xb1a0('0x56')]=[{'all':!![]}];}_0x238696=_[_0xb1a0('0x4c')]({},_0x238696,_0x3c7c27[_0xb1a0('0x4e')]);return db[_0xb1a0('0x3b')][_0xb1a0('0x57')](_0x238696)[_0xb1a0('0x22')](handleEntityNotFound(_0xeefaab,null))[_0xb1a0('0x22')](respondWithResult(_0xeefaab,null))['catch'](handleError(_0xeefaab,null));};exports['create']=function(_0x103f50,_0x20a5b2){return db[_0xb1a0('0x3b')][_0xb1a0('0x58')](_0x103f50[_0xb1a0('0x59')],{})[_0xb1a0('0x22')](function(_0x2f9128){var _0x18f8f3=_0x103f50[_0xb1a0('0x5a')]['get']({'plain':!![]});if(!_0x18f8f3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x18f8f3['role']===_0xb1a0('0x5a')){var _0x41965d=_0x2f9128[_0xb1a0('0x5b')]({'plain':!![]});var _0x4e0420=_0xb1a0('0x34');return db['UserProfileSection']['find']({'where':{'name':_0x4e0420,'userProfileId':_0x18f8f3[_0xb1a0('0x5c')]},'raw':!![]})[_0xb1a0('0x22')](function(_0x37c876){if(_0x37c876&&_0x37c876['autoAssociation']===0x0){return db[_0xb1a0('0x35')]['create']({'name':_0x41965d[_0xb1a0('0x3f')],'resourceId':_0x41965d['id'],'type':_0x37c876[_0xb1a0('0x3f')],'sectionId':_0x37c876['id']},{})[_0xb1a0('0x22')](function(){return _0x2f9128;});}else{return _0x2f9128;}})['catch'](function(_0x1a9691){logger[_0xb1a0('0x23')](_0xb1a0('0x5d'),_0x1a9691);throw _0x1a9691;});}return _0x2f9128;})[_0xb1a0('0x22')](respondWithResult(_0x20a5b2,0xc9))[_0xb1a0('0x28')](handleError(_0x20a5b2,null));};exports['update']=function(_0x3596b9,_0x4a6049){if(_0x3596b9[_0xb1a0('0x59')]['id']){delete _0x3596b9[_0xb1a0('0x59')]['id'];}return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x3596b9['params']['id']},'include':[{'model':db['Pause'],'as':_0xb1a0('0x39')}]})[_0xb1a0('0x22')](handleEntityNotFound(_0x4a6049,null))['then'](saveUpdates(_0x3596b9[_0xb1a0('0x59')],null))[_0xb1a0('0x22')](respondWithResult(_0x4a6049,null))[_0xb1a0('0x28')](handleError(_0x4a6049,null));};exports[_0xb1a0('0x33')]=function(_0x1275ef,_0x488c20){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x1275ef[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x488c20,null))[_0xb1a0('0x22')](removeEntity(_0x488c20,null))[_0xb1a0('0x28')](handleError(_0x488c20,null));};exports[_0xb1a0('0x5e')]=function(_0x23c26b,_0x55d6f3){return db[_0xb1a0('0x3b')]['describe']()[_0xb1a0('0x22')](respondWithResult(_0x55d6f3,null))['catch'](handleError(_0x55d6f3,null));};exports[_0xb1a0('0x5f')]=function(_0x970dd,_0x331a42,_0x26ca1a){if(_0x970dd[_0xb1a0('0x59')]['id']){delete _0x970dd['body']['id'];}return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x970dd['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x331a42,null))[_0xb1a0('0x22')](function(_0x4195a8){if(_0x4195a8){_0x970dd[_0xb1a0('0x59')][_0xb1a0('0x60')]=_0x4195a8['id'];return db[_0xb1a0('0x61')][_0xb1a0('0x58')](_0x970dd[_0xb1a0('0x59')]);}})[_0xb1a0('0x22')](respondWithResult(_0x331a42,null))[_0xb1a0('0x28')](handleError(_0x331a42,null));};exports[_0xb1a0('0x62')]=function(_0x2c34a3,_0x4fa868,_0xf688ea){var _0x2cd939={'raw':![],'where':{}};var _0x5535a5={};var _0x2a97ab={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb1a0('0x63')]({'where':{'id':_0x2c34a3['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x4fa868,null))[_0xb1a0('0x22')](function(_0xa774c3){if(_0xa774c3){_0x5535a5[_0xb1a0('0x43')]=_['keys'](db[_0xb1a0('0x61')][_0xb1a0('0x3c')]);_0x5535a5[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x2c34a3[_0xb1a0('0x40')]);_0x5535a5[_0xb1a0('0x41')]=_['intersection'](_0x5535a5['model'],_0x5535a5['query']);_0x2cd939[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x5535a5[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x2cd939[_0xb1a0('0x44')]=_0x2cd939['attributes'][_0xb1a0('0x55')]?_0x2cd939['attributes']:_0x5535a5[_0xb1a0('0x43')];if(!_0x2c34a3['query']['hasOwnProperty'](_0xb1a0('0x64'))){_0x2cd939[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0x2c34a3['query']['limit']);_0x2cd939['offset']=qs[_0xb1a0('0x2b')](_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}_0x2cd939[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x2cd939[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x2c34a3[_0xb1a0('0x40')],_0x5535a5[_0xb1a0('0x41')]));_0x2cd939['where']['OpenchannelAccountId']=_0xa774c3['id'];if(_0x2c34a3[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x2cd939[_0xb1a0('0x49')]=_[_0xb1a0('0x4c')](_0x2cd939[_0xb1a0('0x49')],{'$or':_['map'](_0x2cd939[_0xb1a0('0x44')],function(_0x4fbb80){var _0x4d804b={};_0x4d804b[_0x4fbb80]={'$like':'%'+_0x2c34a3['query']['filter']+'%'};return _0x4d804b;})});}_0x2cd939=_['merge']({},_0x2cd939,_0x2c34a3[_0xb1a0('0x4e')]);return db[_0xb1a0('0x61')]['count']({'where':_0x2cd939[_0xb1a0('0x49')]})[_0xb1a0('0x22')](function(_0x2a4ac6){_0x2a97ab[_0xb1a0('0x2e')]=_0x2a4ac6;if(_0x2c34a3[_0xb1a0('0x40')]['includeAll']){_0x2cd939[_0xb1a0('0x56')]=[{'all':!![]}];}return db[_0xb1a0('0x61')][_0xb1a0('0x50')](_0x2cd939);})[_0xb1a0('0x22')](function(_0x1708b9){_0x2a97ab['rows']=_0x1708b9;return _0x2a97ab;});}})[_0xb1a0('0x22')](respondWithFilteredResult(_0x4fa868,_0x2cd939))['catch'](handleError(_0x4fa868,null));};exports[_0xb1a0('0x65')]=function(_0x49d0a4,_0x29aa4a,_0x4d6501){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x49d0a4[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x29aa4a,null))[_0xb1a0('0x22')](function(_0x338350){if(_0x338350){return _0x338350['removeDispositions'](_0x49d0a4[_0xb1a0('0x40')][_0xb1a0('0x66')]);}})['then'](respondWithStatusCode(_0x29aa4a,null))['catch'](handleError(_0x29aa4a,null));};exports['addAnswer']=function(_0x42a260,_0xb221c6,_0x3da335){if(_0x42a260[_0xb1a0('0x59')]['id']){delete _0x42a260[_0xb1a0('0x59')]['id'];}return db[_0xb1a0('0x3b')]['find']({'where':{'id':_0x42a260[_0xb1a0('0x53')]['id']}})['then'](handleEntityNotFound(_0xb221c6,null))[_0xb1a0('0x22')](function(_0x111546){if(_0x111546){_0x42a260[_0xb1a0('0x59')][_0xb1a0('0x60')]=_0x111546['id'];return db[_0xb1a0('0x67')][_0xb1a0('0x58')](_0x42a260[_0xb1a0('0x59')]);}})[_0xb1a0('0x22')](respondWithResult(_0xb221c6,null))[_0xb1a0('0x28')](handleError(_0xb221c6,null));};exports['getAnswers']=function(_0x7f7294,_0x1a82f4,_0xd7009c){var _0x4a7a21={'raw':![],'where':{}};var _0x44e00c={};var _0x13df36={'count':0x0,'rows':[]};return db[_0xb1a0('0x3b')][_0xb1a0('0x63')]({'where':{'id':_0x7f7294[_0xb1a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x1a82f4,null))[_0xb1a0('0x22')](function(_0x3175fd){if(_0x3175fd){_0x44e00c[_0xb1a0('0x43')]=_[_0xb1a0('0x54')](db[_0xb1a0('0x67')][_0xb1a0('0x3c')]);_0x44e00c['query']=_[_0xb1a0('0x54')](_0x7f7294[_0xb1a0('0x40')]);_0x44e00c[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x44e00c[_0xb1a0('0x43')],_0x44e00c[_0xb1a0('0x40')]);_0x4a7a21['attributes']=_[_0xb1a0('0x42')](_0x44e00c[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x4a7a21[_0xb1a0('0x44')]=_0x4a7a21[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x4a7a21[_0xb1a0('0x44')]:_0x44e00c[_0xb1a0('0x43')];if(!_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x46')](_0xb1a0('0x64'))){_0x4a7a21['limit']=qs[_0xb1a0('0x2d')](_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x2d')]);_0x4a7a21[_0xb1a0('0x2b')]=qs['offset'](_0x7f7294[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}_0x4a7a21[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x7f7294[_0xb1a0('0x40')]['sort']);_0x4a7a21[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x7f7294[_0xb1a0('0x40')],_0x44e00c[_0xb1a0('0x41')]));_0x4a7a21['where'][_0xb1a0('0x60')]=_0x3175fd['id'];if(_0x7f7294[_0xb1a0('0x40')]['filter']){_0x4a7a21['where']=_['merge'](_0x4a7a21[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x4a7a21[_0xb1a0('0x44')],function(_0x707cb5){var _0x175f32={};_0x175f32[_0x707cb5]={'$like':'%'+_0x7f7294[_0xb1a0('0x40')]['filter']+'%'};return _0x175f32;})});}_0x4a7a21=_[_0xb1a0('0x4c')]({},_0x4a7a21,_0x7f7294[_0xb1a0('0x4e')]);return db[_0xb1a0('0x67')][_0xb1a0('0x2e')]({'where':_0x4a7a21[_0xb1a0('0x49')]})[_0xb1a0('0x22')](function(_0x192fb7){_0x13df36['count']=_0x192fb7;if(_0x7f7294[_0xb1a0('0x40')]['includeAll']){_0x4a7a21['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x4a7a21);})['then'](function(_0x4e97d7){_0x13df36[_0xb1a0('0x51')]=_0x4e97d7;return _0x13df36;});}})[_0xb1a0('0x22')](respondWithFilteredResult(_0x1a82f4,_0x4a7a21))[_0xb1a0('0x28')](handleError(_0x1a82f4,null));};exports[_0xb1a0('0x68')]=function(_0x5f3d45,_0x412a63,_0x32e15e){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x5f3d45[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x412a63,null))[_0xb1a0('0x22')](function(_0x32f983){if(_0x32f983){return _0x32f983[_0xb1a0('0x68')](_0x5f3d45[_0xb1a0('0x40')]['ids']);}})[_0xb1a0('0x22')](respondWithStatusCode(_0x412a63,null))['catch'](handleError(_0x412a63,null));};exports['notify']=function(_0x88b9eb,_0xf95cb2,_0x327a5d){var _0x266384={'body':_0x88b9eb['body'],'channel':'openchannel'};var _0x449c0d=[];var _0x33707b=[];var _0x1adf0b={};var _0x2d34fb=![];return db['CmContact'][_0xb1a0('0x5e')]()[_0xb1a0('0x22')](function(_0x4ffbad){if(!_0x4ffbad){throw new db['Sequelize'][(_0xb1a0('0x69'))](_0xb1a0('0x6a'));}_0x449c0d=_['difference'](_[_0xb1a0('0x54')](_0x4ffbad),[_0xb1a0('0x6b'),'updatedAt']);_0x33707b=_[_0xb1a0('0x6c')](_[_0xb1a0('0x54')](_0x4ffbad),['createdAt',_0xb1a0('0x6d'),_0xb1a0('0x6e'),_0xb1a0('0x6f')]);if(_0x88b9eb['body']['id']){delete _0x88b9eb[_0xb1a0('0x59')]['id'];}if(_[_0xb1a0('0x70')](_0x88b9eb['body'][_0xb1a0('0x71')])){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))](_0xb1a0('0x73'));}if(_['isNil'](_0x88b9eb['body'][_0xb1a0('0x59')])||_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x59')]===''){throw new db['Sequelize']['ValidationError'](_0xb1a0('0x74'));}if(_['isNil'](_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x75')])){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))](_0xb1a0('0x76')+_0x33707b);}if(!_[_0xb1a0('0x77')](_0x33707b,_0x88b9eb[_0xb1a0('0x59')]['mapKey'])){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))](_0xb1a0('0x78')+_0x33707b);}_0x1adf0b[_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x75')]]=_0x88b9eb['body']['from'];})[_0xb1a0('0x22')](function(){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x88b9eb['params']['id']},'include':[{'model':db[_0xb1a0('0x79')],'as':'List','include':[{'model':db[_0xb1a0('0x7a')],'as':_0xb1a0('0x7b'),'where':_0x1adf0b,'limit':0x1,'order':[[_0xb1a0('0x6d'),_0xb1a0('0x7c')]]}]},{'model':db[_0xb1a0('0x7d')],'as':'Applications'}]});})['then'](handleEntityNotFound(_0xf95cb2,null))[_0xb1a0('0x22')](function(_0x29cc7d){if(_0x29cc7d&&_0x29cc7d[_0xb1a0('0x7e')]){_0x266384[_0xb1a0('0x7f')]=_0x29cc7d;_0x266384[_0xb1a0('0x80')]=_0x29cc7d[_0xb1a0('0x81')];_0x266384[_0xb1a0('0x82')]=_0x29cc7d['List'];_0x266384[_0xb1a0('0x80')]=_[_0xb1a0('0x83')](_0x266384[_0xb1a0('0x80')],[_0xb1a0('0x84')],[_0xb1a0('0x85')]);if(_0x266384[_0xb1a0('0x7f')][_0xb1a0('0x81')]){delete _0x266384[_0xb1a0('0x7f')][_0xb1a0('0x81')];}if(_0x266384[_0xb1a0('0x7f')]['List']&&_0x266384['account']['List'][_0xb1a0('0x7b')][_0xb1a0('0x55')]){return _0x266384[_0xb1a0('0x7f')][_0xb1a0('0x7e')][_0xb1a0('0x7b')][0x0];}var _0x24fa6f=_['defaults'](_0x88b9eb[_0xb1a0('0x59')],{'firstName':_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x71')],'ListId':_0x29cc7d[_0xb1a0('0x6f')]});_0x24fa6f[_0x88b9eb['body']['mapKey']]=_0x88b9eb['body'][_0xb1a0('0x71')];return db[_0xb1a0('0x7a')][_0xb1a0('0x58')](_0x24fa6f,{'fields':_0x449c0d,'raw':!![]});}})['then'](handleEntityNotFound(_0xf95cb2,null))[_0xb1a0('0x22')](function(_0x44702c){_0x266384[_0xb1a0('0x86')]=_0x44702c;if(_0x44702c){var _0x46c8ad={'ContactId':_0x44702c['id'],'OpenchannelAccountId':_0x88b9eb['params']['id'],'from':(_0x44702c['firstName']||'')+'\x20'+(_0x44702c[_0xb1a0('0x87')]||'')};var _0x560475={'OpenchannelAccountId':_0x88b9eb[_0xb1a0('0x53')]['id'],'closed':![]};if(_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')]){_0x560475[_0xb1a0('0x88')]=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')];return db[_0xb1a0('0x89')][_0xb1a0('0x57')]({'where':_0x560475})['then'](function(_0x11a7b6){if(_0x11a7b6){return[_0x11a7b6,![]];}_0x46c8ad[_0xb1a0('0x88')]=_0x88b9eb['body'][_0xb1a0('0x88')];_0x46c8ad['externalUrl']=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x8a')];return db['OpenchannelInteraction'][_0xb1a0('0x58')](_0x46c8ad)[_0xb1a0('0x22')](function(_0x114060){return[_0x114060,!![]];});});}else{_0x560475['threadId']=null;}_0x560475['ContactId']=_0x44702c['id'];return db[_0xb1a0('0x89')][_0xb1a0('0x57')]({'where':_0x560475})[_0xb1a0('0x22')](function(_0x8dc0ce){if(_0x8dc0ce){return[_0x8dc0ce,![]];}return db['OpenchannelInteraction'][_0xb1a0('0x58')](_0x46c8ad)[_0xb1a0('0x22')](function(_0x1638fc){return[_0x1638fc,!![]];});});}})[_0xb1a0('0x8b')](function(_0x6615ce,_0x4252a6){if(_0x6615ce){_0x2d34fb=_0x4252a6;if(!_0x4252a6){var _0xee284e={'from':(_0x266384[_0xb1a0('0x86')][_0xb1a0('0x8c')]||'')+'\x20'+(_0x266384[_0xb1a0('0x86')][_0xb1a0('0x87')]||'')};if(_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')]&&_0x88b9eb[_0xb1a0('0x59')]['messageId']&&_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x88')]!=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x8d')]){_0xee284e[_0xb1a0('0x88')]=_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x8d')];}return _0x6615ce['update'](_0xee284e);}else{return _0x6615ce;}}})[_0xb1a0('0x22')](function(_0x235a2c){_0x266384['interaction']=_0x235a2c['get']({'plain':!![]});_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x8f')]=_0x2d34fb;if(_0x266384['interaction'][_0xb1a0('0x8f')]){if(_0x266384['account']['autoclose']){_0x266384[_0xb1a0('0x80')][_0xb1a0('0x90')]({'id':0x0,'priority':_0x266384[_0xb1a0('0x80')][_0xb1a0('0x55')]+0x1,'app':'close','appdata':_0xb1a0('0x91'),'interval':_0xb1a0('0x92')});}}return db[_0xb1a0('0x93')]['create']({'body':_0x88b9eb[_0xb1a0('0x59')]['body'],'OpenchannelAccountId':_0x88b9eb['params']['id'],'OpenchannelInteractionId':_0x235a2c['id'],'direction':'in','ContactId':_0x266384[_0xb1a0('0x86')]['id'],'AttachmentId':_0x88b9eb[_0xb1a0('0x59')][_0xb1a0('0x94')]});})['then'](function(_0x107ceb){_0x266384['message']=_0x107ceb;if(!_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x95')])return;return db[_0xb1a0('0x96')][_0xb1a0('0x57')]({'attributes':['id',_0xb1a0('0x3f')],'where':{'id':_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x95')]}});})[_0xb1a0('0x22')](function(_0x1b95ed){if(_0x1b95ed){_0x266384[_0xb1a0('0x80')]['unshift']({'id':0x0,'priority':0x0,'app':_0xb1a0('0x97'),'appdata':_0x1b95ed[_0xb1a0('0x3f')]+','+(_0x266384[_0xb1a0('0x7f')][_0xb1a0('0x98')]||0xa),'interval':_0xb1a0('0x92')});}if(!_0x266384[_0xb1a0('0x8e')][_0xb1a0('0x99')])return;return db[_0xb1a0('0x9a')][_0xb1a0('0x57')]({'attributes':['id',_0xb1a0('0x3f')],'where':{'id':_0x266384['interaction'][_0xb1a0('0x99')]}});})['then'](function(_0x62896f){if(_0x62896f){_0x266384[_0xb1a0('0x80')][_0xb1a0('0x9b')]({'id':0x0,'priority':0x1,'app':_0xb1a0('0x9c'),'appdata':_0x62896f['name']+','+(_0x266384[_0xb1a0('0x7f')][_0xb1a0('0x9d')]||0x12c),'interval':_0xb1a0('0x92')});}return respondWithRpcPromise(_0xb1a0('0x9e'),_0xb1a0('0x9f'),_0x266384);})[_0xb1a0('0x22')](function(_0x2fef3e){respondWithRpcPromise(_0xb1a0('0xa0'),_0xb1a0('0xa0'),{'event':'notify','message':_0x2fef3e},client9002);return _0x2fef3e;})[_0xb1a0('0x22')](respondWithResult(_0xf95cb2,null))[_0xb1a0('0x28')](handleError(_0xf95cb2,null));};exports[_0xb1a0('0xa1')]=function(_0x5e91c4,_0x53864f){var _0x1fe334=_0x5e91c4[_0xb1a0('0x53')]['id'];var _0x1d939d=_0x5e91c4[_0xb1a0('0x59')];var _0x59235b=0xc8;var _0xf015d6=null;return db[_0xb1a0('0xa2')]['transaction']({'isolationLevel':db['sequelize']['Transaction'][_0xb1a0('0xa3')][_0xb1a0('0xa4')]},function(_0x4f02f1){return db['OpenchannelAccount'][_0xb1a0('0x63')]({'where':{'id':_0x1fe334},'transaction':_0x4f02f1})['then'](function(_0x508d78){if(_0x508d78){return db[_0xb1a0('0x7d')][_0xb1a0('0x33')]({'where':{'OpenchannelAccountId':_0x1fe334},'transaction':_0x4f02f1})[_0xb1a0('0x22')](function(){var _0x42be80=_['map'](_0x1d939d,function(_0xc6fb7f){_0xc6fb7f[_0xb1a0('0x60')]=_0x1fe334;return _0xc6fb7f;});return db[_0xb1a0('0x7d')][_0xb1a0('0xa5')](_0x42be80,{'transaction':_0x4f02f1});});}else{_0x59235b=0x194;_0xf015d6=[];}});})['then'](function(){if(_0x59235b!==0x194){return db[_0xb1a0('0x7d')][_0xb1a0('0xa6')]({'where':{'OpenchannelAccountId':_0x1fe334},'order':_0xb1a0('0x84')})[_0xb1a0('0x22')](function(_0x375ea4){_0xf015d6=_0x375ea4;});}})['catch'](function(_0x2d7066){_0x59235b=0x1f4;logger[_0xb1a0('0x23')](_0x2d7066[_0xb1a0('0xa7')]);if(_0x2d7066['name']){delete _0x2d7066[_0xb1a0('0x3f')];}_0xf015d6=_0x2d7066;})[_0xb1a0('0xa8')](function(){if(_0xf015d6===null){_0x53864f['sendStatus'](_0x59235b);}else{if(_0x59235b===0x1f4){_0x53864f[_0xb1a0('0x2a')](_0x59235b)[_0xb1a0('0x37')](_0xf015d6);}else{_0x53864f[_0xb1a0('0x2a')](_0x59235b)['json'](_0xf015d6);}}});};exports[_0xb1a0('0xa9')]=function(_0x1a9bb6,_0x27f270,_0x583f6f){var _0x184d28={};var _0x58f562={};var _0x30774d;var _0x3eeb22;return db[_0xb1a0('0x3b')][_0xb1a0('0x63')]({'where':{'id':_0x1a9bb6[_0xb1a0('0x53')]['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x27f270,null))[_0xb1a0('0x22')](function(_0x2c6fd6){if(_0x2c6fd6){_0x30774d=_0x2c6fd6;_0x58f562[_0xb1a0('0x43')]=_[_0xb1a0('0x54')](db[_0xb1a0('0x7d')][_0xb1a0('0x3c')]);_0x58f562[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x1a9bb6['query']);_0x58f562[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x58f562['model'],_0x58f562[_0xb1a0('0x40')]);_0x184d28[_0xb1a0('0x44')]=_[_0xb1a0('0x42')](_0x58f562[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x184d28[_0xb1a0('0x44')]=_0x184d28[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x184d28[_0xb1a0('0x44')]:_0x58f562[_0xb1a0('0x43')];_0x184d28[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x1a9bb6['query'][_0xb1a0('0x48')]);_0x184d28[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_['pick'](_0x1a9bb6[_0xb1a0('0x40')],_0x58f562[_0xb1a0('0x41')]));if(_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x184d28[_0xb1a0('0x49')]=_[_0xb1a0('0x4c')](_0x184d28[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x184d28['attributes'],function(_0x466567){var _0x1d1bb8={};_0x1d1bb8[_0x466567]={'$like':'%'+_0x1a9bb6[_0xb1a0('0x40')]['filter']+'%'};return _0x1d1bb8;})});}_0x184d28=_[_0xb1a0('0x4c')]({},_0x184d28,_0x1a9bb6[_0xb1a0('0x4e')]);return _0x30774d[_0xb1a0('0xa9')](_0x184d28);}})[_0xb1a0('0x22')](function(_0x1b0dd1){if(_0x1b0dd1){_0x3eeb22=_0x1b0dd1[_0xb1a0('0x55')];if(!_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x46')]('nolimit')){_0x184d28[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0x1a9bb6['query'][_0xb1a0('0x2d')]);_0x184d28[_0xb1a0('0x2b')]=qs[_0xb1a0('0x2b')](_0x1a9bb6[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}return _0x30774d['getApplications'](_0x184d28);}})[_0xb1a0('0x22')](function(_0x42911){if(_0x42911){return _0x42911?{'count':_0x3eeb22,'rows':_0x42911}:null;}})['then'](respondWithResult(_0x27f270,null))['catch'](handleError(_0x27f270,null));};exports['getInteractions']=function(_0x5d0823,_0x4f198b,_0x34e405){var _0x3b9441={'raw':![],'where':{}};var _0x3083a9={};var _0x346c5d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb1a0('0x63')]({'where':{'id':_0x5d0823['params']['id']}})['then'](handleEntityNotFound(_0x4f198b,null))[_0xb1a0('0x22')](function(_0xec6565){if(_0xec6565){_0x3083a9[_0xb1a0('0x43')]=_['keys'](db[_0xb1a0('0x89')][_0xb1a0('0x3c')]);_0x3083a9[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0x5d0823[_0xb1a0('0x40')]);_0x3083a9[_0xb1a0('0x41')]=_[_0xb1a0('0x42')](_0x3083a9[_0xb1a0('0x43')],_0x3083a9['query']);_0x3b9441[_0xb1a0('0x44')]=_['intersection'](_0x3083a9[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0x5d0823['query']['fields']));_0x3b9441[_0xb1a0('0x44')]=_0x3b9441[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x3b9441['attributes']:_0x3083a9[_0xb1a0('0x43')];if(!_0x5d0823[_0xb1a0('0x40')]['hasOwnProperty'](_0xb1a0('0x64'))){_0x3b9441[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x2d')]);_0x3b9441['offset']=qs[_0xb1a0('0x2b')](_0x5d0823['query']['offset']);}_0x3b9441[_0xb1a0('0x47')]=qs[_0xb1a0('0x48')](_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x3b9441[_0xb1a0('0x49')]=qs[_0xb1a0('0x41')](_[_0xb1a0('0x4a')](_0x5d0823['query'],_0x3083a9[_0xb1a0('0x41')]));_0x3b9441[_0xb1a0('0x49')][_0xb1a0('0x60')]=_0xec6565['id'];if(_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x4b')]){_0x3b9441['where']=_[_0xb1a0('0x4c')](_0x3b9441[_0xb1a0('0x49')],{'$or':_[_0xb1a0('0x3a')](_0x3b9441[_0xb1a0('0x44')],function(_0x2a3389){var _0x9933df={};_0x9933df[_0x2a3389]={'$like':'%'+_0x5d0823['query'][_0xb1a0('0x4b')]+'%'};return _0x9933df;})});}_0x3b9441=_['merge']({},_0x3b9441,_0x5d0823[_0xb1a0('0x4e')]);return db[_0xb1a0('0x89')][_0xb1a0('0x2e')]({'where':_0x3b9441[_0xb1a0('0x49')]})[_0xb1a0('0x22')](function(_0x12471d){_0x346c5d[_0xb1a0('0x2e')]=_0x12471d;if(_0x5d0823[_0xb1a0('0x40')][_0xb1a0('0x4f')]){_0x3b9441[_0xb1a0('0x56')]=[{'model':db['CmContact'],'as':_0xb1a0('0xaa'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xb1a0('0x3f'),_0xb1a0('0xab'),_0xb1a0('0xac')],'required':![]},{'model':db[_0xb1a0('0xad')],'as':'Tags','attributes':['id',_0xb1a0('0x3f'),_0xb1a0('0xae')],'where':_0x5d0823['query'][_0xb1a0('0xaf')]?{'id':_0x5d0823['query'][_0xb1a0('0xaf')]}:undefined,'required':_0x5d0823[_0xb1a0('0x40')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xb1a0('0x50')](_0x3b9441);})[_0xb1a0('0x22')](function(_0x45fc91){_0x346c5d[_0xb1a0('0x51')]=_0x45fc91;return _0x346c5d;});}})[_0xb1a0('0x22')](respondWithFilteredResult(_0x4f198b,_0x3b9441))[_0xb1a0('0x28')](handleError(_0x4f198b,null));};exports[_0xb1a0('0xb0')]=function(_0x1ac2ca,_0x2c3f93,_0x2732e8){return db[_0xb1a0('0x3b')][_0xb1a0('0x57')]({'where':{'id':_0x1ac2ca['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x2c3f93,null))[_0xb1a0('0x22')](function(_0x49bf10){if(_0x49bf10){return _0x49bf10[_0xb1a0('0xb0')](_0x1ac2ca['body'][_0xb1a0('0x66')],_[_0xb1a0('0xb1')](_0x1ac2ca['body'],[_0xb1a0('0x66'),'id'])||{})[_0xb1a0('0x8b')](function(_0x11ee8d){for(var _0x2a9558=0x0;_0x2a9558<_0x1ac2ca['body'][_0xb1a0('0x66')][_0xb1a0('0x55')];_0x2a9558+=0x1){socket[_0xb1a0('0xb2')]('userOpenchannelAccount:save',{'UserId':Number(_0x1ac2ca[_0xb1a0('0x59')]['ids'][_0x2a9558]),'OpenchannelAccountId':Number(_0x1ac2ca[_0xb1a0('0x53')]['id'])});}return _0x11ee8d;});}})[_0xb1a0('0x22')](respondWithResult(_0x2c3f93,null))[_0xb1a0('0x28')](handleError(_0x2c3f93,null));};exports[_0xb1a0('0xb3')]=function(_0x4c0678,_0x1a7a1b,_0x2f1d67){return db['OpenchannelAccount'][_0xb1a0('0x57')]({'where':{'id':_0x4c0678['params']['id']}})['then'](handleEntityNotFound(_0x1a7a1b,null))[_0xb1a0('0x22')](function(_0xb25c6c){if(_0xb25c6c){return _0xb25c6c[_0xb1a0('0xb3')](_0x4c0678['query'][_0xb1a0('0x66')])[_0xb1a0('0x22')](function(){if(_[_0xb1a0('0xb4')](_0x4c0678[_0xb1a0('0x40')][_0xb1a0('0x66')])){for(var _0x5885d5=0x0;_0x5885d5<_0x4c0678[_0xb1a0('0x40')][_0xb1a0('0x66')]['length'];_0x5885d5+=0x1){socket[_0xb1a0('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4c0678[_0xb1a0('0x40')][_0xb1a0('0x66')][_0x5885d5]),'OpenchannelAccountId':Number(_0x4c0678[_0xb1a0('0x53')]['id'])});}}else{socket[_0xb1a0('0xb2')]('userOpenchannelAccount:remove',{'UserId':Number(_0x4c0678['query']['ids']),'OpenchannelAccountId':Number(_0x4c0678[_0xb1a0('0x53')]['id'])});}});}})[_0xb1a0('0x22')](respondWithStatusCode(_0x1a7a1b,null))[_0xb1a0('0x28')](handleError(_0x1a7a1b,null));};exports['getAgents']=function(_0xcae218,_0x591657,_0x4d1b83){var _0x15cdce={};var _0x2ba0a6={};var _0x56c51c;var _0x496a0b;return db[_0xb1a0('0x3b')]['findOne']({'where':{'id':_0xcae218[_0xb1a0('0x53')]['id']}})['then'](handleEntityNotFound(_0x591657,null))['then'](function(_0x57f10d){if(_0x57f10d){_0x56c51c=_0x57f10d;_0x2ba0a6[_0xb1a0('0x43')]=_[_0xb1a0('0x54')](db[_0xb1a0('0x96')][_0xb1a0('0x3c')]);_0x2ba0a6[_0xb1a0('0x40')]=_[_0xb1a0('0x54')](_0xcae218['query']);_0x2ba0a6[_0xb1a0('0x41')]=_['intersection'](_0x2ba0a6[_0xb1a0('0x43')],_0x2ba0a6[_0xb1a0('0x40')]);_0x15cdce['attributes']=_[_0xb1a0('0x42')](_0x2ba0a6[_0xb1a0('0x43')],qs[_0xb1a0('0x45')](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x45')]));_0x15cdce['attributes']=_0x15cdce[_0xb1a0('0x44')][_0xb1a0('0x55')]?_0x15cdce['attributes']:_0x2ba0a6[_0xb1a0('0x43')];_0x15cdce[_0xb1a0('0x47')]=qs['sort'](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x48')]);_0x15cdce[_0xb1a0('0x49')]=qs['filters'](_[_0xb1a0('0x4a')](_0xcae218[_0xb1a0('0x40')],_0x2ba0a6['filters']));if(_0xcae218['query'][_0xb1a0('0x4b')]){_0x15cdce[_0xb1a0('0x49')]=_['merge'](_0x15cdce['where'],{'$or':_[_0xb1a0('0x3a')](_0x15cdce['attributes'],function(_0x218343){var _0x1eb1b4={};_0x1eb1b4[_0x218343]={'$like':'%'+_0xcae218[_0xb1a0('0x40')]['filter']+'%'};return _0x1eb1b4;})});}_0x15cdce=_['merge']({},_0x15cdce,_0xcae218[_0xb1a0('0x4e')]);return _0x56c51c['getAgents'](_0x15cdce);}})[_0xb1a0('0x22')](function(_0xb9152d){if(_0xb9152d){_0x496a0b=_0xb9152d['length'];if(!_0xcae218['query'][_0xb1a0('0x46')](_0xb1a0('0x64'))){_0x15cdce[_0xb1a0('0x2d')]=qs[_0xb1a0('0x2d')](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x2d')]);_0x15cdce[_0xb1a0('0x2b')]=qs[_0xb1a0('0x2b')](_0xcae218[_0xb1a0('0x40')][_0xb1a0('0x2b')]);}return _0x56c51c[_0xb1a0('0xb5')](_0x15cdce);}})['then'](function(_0x58e1c4){if(_0x58e1c4){return _0x58e1c4?{'count':_0x496a0b,'rows':_0x58e1c4}:null;}})[_0xb1a0('0x22')](respondWithResult(_0x591657,null))[_0xb1a0('0x28')](handleError(_0x591657,null));};exports['send']=function(_0x185c04,_0x1550f5,_0x5aad4f){var _0x20275b,_0x429a5a,_0x162774;if(_[_0xb1a0('0x70')](_0x185c04[_0xb1a0('0x59')][_0xb1a0('0x59')])||_0x185c04[_0xb1a0('0x59')][_0xb1a0('0x59')]===''){throw new db[(_0xb1a0('0x72'))][(_0xb1a0('0x69'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb1a0('0x70')](_0x185c04[_0xb1a0('0x59')]['to'])){}_0x20275b=_0x185c04[_0xb1a0('0x59')]['to'];return db[_0xb1a0('0x3b')][_0xb1a0('0x63')]({'where':{'id':_0x185c04['params']['id']}})[_0xb1a0('0x22')](handleEntityNotFound(_0x1550f5,null))[_0xb1a0('0x22')](function(_0x26162d){if(_0x26162d){return db[_0xb1a0('0x3b')]['find']({'where':{'id':_0x26162d['id']},'include':[{'model':db[_0xb1a0('0x79')],'as':_0xb1a0('0x7e'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{[_0x26162d['mapKey']]:_0x20275b},'limit':0x1,'order':[[_0xb1a0('0x6d'),_0xb1a0('0x7c')]]}]}]})[_0xb1a0('0x22')](handleEntityNotFound(_0x1550f5,null))[_0xb1a0('0x22')](function(_0x4931b7){if(_0x4931b7&&_0x4931b7[_0xb1a0('0x7e')]){_0x429a5a=_0x4931b7[_0xb1a0('0x5b')]({'plain':!![]});if(_0x429a5a['List']&&_0x429a5a['List'][_0xb1a0('0x7b')][_0xb1a0('0x55')]){return _0x429a5a[_0xb1a0('0x7e')][_0xb1a0('0x7b')][0x0];}return db[_0xb1a0('0x7a')][_0xb1a0('0x58')](_[_0xb1a0('0x18')](_0x185c04[_0xb1a0('0x59')],{'firstName':_0x20275b,[_0x4931b7[_0xb1a0('0x75')]]:_0x20275b,'phone':_0x20275b,'ListId':_0x429a5a[_0xb1a0('0x6f')]}));}})[_0xb1a0('0x22')](handleEntityNotFound(_0x1550f5,null))[_0xb1a0('0x22')](function(_0x3631a9){if(_0x3631a9){_0x162774=_0x3631a9;return db[_0xb1a0('0x89')][_0xb1a0('0x57')]({'where':{'ContactId':_0x162774['id'],'closed':![],'OpenchannelAccountId':_0x429a5a['id']}})['then'](function(_0x1e5a3f){if(_0x1e5a3f){return[_0x1e5a3f,![]];}return db[_0xb1a0('0x89')][_0xb1a0('0x58')]({'UserId':_0x185c04['user']['id'],'ContactId':_0x162774['id'],'OpenchannelAccountId':_0x429a5a['id'],'lastMsgDirection':_0xb1a0('0xb6'),'firstMsgDirection':_0xb1a0('0xb6'),'Messages':[_[_0xb1a0('0x4c')](_0x185c04['body'],{'read':![],'body':_0x185c04[_0xb1a0('0x59')][_0xb1a0('0x59')],'OpenchannelAccountId':_0x429a5a['id'],'UserId':_0x185c04[_0xb1a0('0x5a')]['id'],'ContactId':_0x162774['id']})]},{'include':[{'model':db[_0xb1a0('0x93')],'as':_0xb1a0('0xb7')}]})[_0xb1a0('0x22')](function(_0x34a84f){return[_0x34a84f,!![]];});});}})[_0xb1a0('0x8b')](function(_0x4b73a4,_0x5dc3e8){if(_0x5dc3e8){return _0x4b73a4;}return db[_0xb1a0('0x93')][_0xb1a0('0x58')](_[_0xb1a0('0x4c')](_0x185c04[_0xb1a0('0x59')],{'read':![],'body':_0x185c04['body'][_0xb1a0('0x59')],'OpenchannelAccountId':_0x429a5a['id'],'OpenchannelInteractionId':_0x4b73a4['id'],'UserId':_0x185c04[_0xb1a0('0x5a')]['id'],'ContactId':_0x162774['id']}))[_0xb1a0('0x22')](function(_0x5622ab){_0x4b73a4[_0xb1a0('0xb8')][_0xb1a0('0xb7')]=[];_0x4b73a4['dataValues']['Messages'][_0xb1a0('0x90')](_0x5622ab['dataValues']);return _0x4b73a4;});});}})['then'](respondWithResult(_0x1550f5,null))['catch'](handleError(_0x1550f5,null));}; \ No newline at end of file +var _0x6ec2=['filters','pick','filter','VIRTUAL','include','rows','show','params','Pause','includeAll','merge','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','update','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','isNil','from','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','OpenchannelApplication','Applications','List','applications','orderBy','priority','account','ListId','contact','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','lastName','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','User','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','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','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','client','http','request','then','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','OpenchannelAccount,\x20%s,\x20%s','message','info','catch','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','destroy','get','OpenchannelAccounts','UserProfileResource','sendStatus','stack','name','index','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where'];(function(_0x12df3c,_0xf0ae04){var _0x4f208c=function(_0x55e709){while(--_0x55e709){_0x12df3c['push'](_0x12df3c['shift']());}};_0x4f208c(++_0xf0ae04);}(_0x6ec2,0x78));var _0x26ec=function(_0x140c7a,_0x22d388){_0x140c7a=_0x140c7a-0x0;var _0x4a4a38=_0x6ec2[_0x140c7a];return _0x4a4a38;};'use strict';var emlformat=require(_0x26ec('0x0'));var rimraf=require(_0x26ec('0x1'));var zipdir=require(_0x26ec('0x2'));var jsonpatch=require(_0x26ec('0x3'));var rp=require(_0x26ec('0x4'));var moment=require(_0x26ec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x26ec('0x6'));var util=require(_0x26ec('0x7'));var path=require(_0x26ec('0x8'));var sox=require(_0x26ec('0x9'));var csv=require(_0x26ec('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x26ec('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x26ec('0xc'));var jsforce=require(_0x26ec('0xd'));var deskjs=require(_0x26ec('0xe'));var toCsv=require('to-csv');var querystring=require(_0x26ec('0xf'));var Papa=require('papaparse');var Redis=require(_0x26ec('0x10'));var authService=require(_0x26ec('0x11'));var qs=require(_0x26ec('0x12'));var as=require(_0x26ec('0x13'));var hardwareService=require(_0x26ec('0x14'));var logger=require(_0x26ec('0x15'))(_0x26ec('0x16'));var utils=require(_0x26ec('0x17'));var config=require(_0x26ec('0x18'));var licenseUtil=require(_0x26ec('0x19'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x26ec('0x1a')](config[_0x26ec('0x1b')],{'host':_0x26ec('0x1c'),'port':0x18eb});var socket=require(_0x26ec('0x1d'))(new Redis(config[_0x26ec('0x1b')]));require(_0x26ec('0x1e'))[_0x26ec('0x1f')](socket);var jayson=require('jayson/promise');var client=jayson[_0x26ec('0x20')][_0x26ec('0x21')]({'port':0x232c});var client9002=jayson[_0x26ec('0x20')][_0x26ec('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x4f9950,_0x4d366c,_0x438985,_0x127385){return new BPromise(function(_0x4bdced,_0x20c407){var _0x49dc68=_0x127385||client;return _0x49dc68[_0x26ec('0x22')](_0x4f9950,_0x438985)[_0x26ec('0x23')](function(_0x50c9de){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x4d366c,_0x26ec('0x24'));logger[_0x26ec('0x25')](_0x26ec('0x26'),_0x4d366c,'request\x20sent',JSON['stringify'](_0x50c9de));if(_0x50c9de[_0x26ec('0x27')]){if(_0x50c9de[_0x26ec('0x27')][_0x26ec('0x28')]===0x1f4){logger[_0x26ec('0x27')](_0x26ec('0x29'),_0x4d366c,_0x50c9de[_0x26ec('0x27')]['message']);return _0x20c407(_0x50c9de[_0x26ec('0x27')][_0x26ec('0x2a')]);}logger[_0x26ec('0x27')](_0x26ec('0x29'),_0x4d366c,_0x50c9de[_0x26ec('0x27')]['message']);return _0x4bdced(_0x50c9de['error'][_0x26ec('0x2a')]);}else{logger[_0x26ec('0x2b')](_0x26ec('0x29'),_0x4d366c,'request\x20sent');_0x4bdced(_0x50c9de['result'][_0x26ec('0x2a')]);}})[_0x26ec('0x2c')](function(_0x16aba4){logger[_0x26ec('0x27')](_0x26ec('0x29'),_0x4d366c,_0x16aba4);_0x20c407(_0x16aba4);});});}function respondWithStatusCode(_0x89bd5f,_0x439f78){_0x439f78=_0x439f78||0xcc;return function(_0x4e9cf8){if(_0x4e9cf8){return _0x89bd5f['sendStatus'](_0x439f78);}return _0x89bd5f['status'](_0x439f78)[_0x26ec('0x2d')]();};}function respondWithResult(_0xddd5fc,_0x352bef){_0x352bef=_0x352bef||0xc8;return function(_0x3fd842){if(_0x3fd842){return _0xddd5fc[_0x26ec('0x2e')](_0x352bef)[_0x26ec('0x2f')](_0x3fd842);}};}function respondWithFilteredResult(_0x3268e9,_0x4a1371){return function(_0x30231e){if(_0x30231e){var _0x5d10ba=typeof _0x4a1371[_0x26ec('0x30')]===_0x26ec('0x31')&&typeof _0x4a1371['limit']===_0x26ec('0x31');var _0x2d30e6=_0x30231e[_0x26ec('0x32')];var _0x18999a=_0x5d10ba?0x0:_0x4a1371[_0x26ec('0x30')];var _0x24d390=_0x5d10ba?_0x30231e['count']:_0x4a1371[_0x26ec('0x30')]+_0x4a1371['limit'];var _0x3d8b89;if(_0x24d390>=_0x2d30e6){_0x24d390=_0x2d30e6;_0x3d8b89=0xc8;}else{_0x3d8b89=0xce;}_0x3268e9['status'](_0x3d8b89);return _0x3268e9[_0x26ec('0x33')](_0x26ec('0x34'),_0x18999a+'-'+_0x24d390+'/'+_0x2d30e6)['json'](_0x30231e);}return null;};}function patchUpdates(_0x4555ea){return function(_0x13c4c3){try{jsonpatch[_0x26ec('0x35')](_0x13c4c3,_0x4555ea,!![]);}catch(_0x5fe57f){return BPromise[_0x26ec('0x36')](_0x5fe57f);}return _0x13c4c3[_0x26ec('0x37')]();};}function saveUpdates(_0x4f1806,_0x5bf0b8){return function(_0x56e03c){if(_0x56e03c){return _0x56e03c['update'](_0x4f1806)['then'](function(_0x187e7d){return _0x187e7d;});}return null;};}function removeEntity(_0x2543a6,_0x2737c6){return function(_0x27652d){if(_0x27652d){return _0x27652d[_0x26ec('0x38')]()['then'](function(){var _0xfdd95=_0x27652d[_0x26ec('0x39')]({'plain':!![]});var _0x35a745=_0x26ec('0x3a');return db[_0x26ec('0x3b')]['destroy']({'where':{'type':_0x35a745,'resourceId':_0xfdd95['id']}})[_0x26ec('0x23')](function(){return _0x27652d;});})[_0x26ec('0x23')](function(){_0x2543a6[_0x26ec('0x2e')](0xcc)[_0x26ec('0x2d')]();});}};}function handleEntityNotFound(_0x6b217f,_0x171118){return function(_0x39c514){if(!_0x39c514){_0x6b217f[_0x26ec('0x3c')](0x194);}return _0x39c514;};}function handleError(_0x354adf,_0x16c0ee){_0x16c0ee=_0x16c0ee||0x1f4;return function(_0x48d7cf){logger['error'](_0x48d7cf[_0x26ec('0x3d')]);if(_0x48d7cf[_0x26ec('0x3e')]){delete _0x48d7cf['name'];}_0x354adf[_0x26ec('0x2e')](_0x16c0ee)['send'](_0x48d7cf);};}exports[_0x26ec('0x3f')]=function(_0x1244aa,_0x11fc8c){var _0xb4942e={'include':[{'model':db['Pause'],'as':_0x26ec('0x40')}]},_0x2a0c92={},_0xfb68c9={'count':0x0,'rows':[]};var _0x3441f4=_[_0x26ec('0x41')](db[_0x26ec('0x42')][_0x26ec('0x43')],function(_0x304194){return{'name':_0x304194[_0x26ec('0x44')],'type':_0x304194[_0x26ec('0x45')][_0x26ec('0x46')]};});_0x2a0c92[_0x26ec('0x47')]=_[_0x26ec('0x41')](_0x3441f4,_0x26ec('0x3e'));_0x2a0c92[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x1244aa[_0x26ec('0x48')]);_0x2a0c92['filters']=_[_0x26ec('0x4a')](_0x2a0c92[_0x26ec('0x47')],_0x2a0c92[_0x26ec('0x48')]);_0xb4942e[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x2a0c92[_0x26ec('0x47')],qs['fields'](_0x1244aa['query'][_0x26ec('0x4c')]));_0xb4942e['attributes']=_0xb4942e[_0x26ec('0x4b')][_0x26ec('0x4d')]?_0xb4942e[_0x26ec('0x4b')]:_0x2a0c92[_0x26ec('0x47')];if(!_0x1244aa[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0xb4942e[_0x26ec('0x50')]=qs['limit'](_0x1244aa[_0x26ec('0x48')][_0x26ec('0x50')]);_0xb4942e[_0x26ec('0x30')]=qs['offset'](_0x1244aa[_0x26ec('0x48')][_0x26ec('0x30')]);}_0xb4942e[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x1244aa[_0x26ec('0x48')][_0x26ec('0x52')]);_0xb4942e[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_[_0x26ec('0x55')](_0x1244aa[_0x26ec('0x48')],_0x2a0c92[_0x26ec('0x54')]),_0x3441f4);if(_0x1244aa[_0x26ec('0x48')][_0x26ec('0x56')]){_0xb4942e[_0x26ec('0x53')]=_['merge'](_0xb4942e['where'],{'$or':_[_0x26ec('0x41')](_0x3441f4,function(_0x5be55c){if(_0x5be55c['type']!==_0x26ec('0x57')){var _0xc9eda3={};_0xc9eda3[_0x5be55c[_0x26ec('0x3e')]]={'$like':'%'+_0x1244aa['query']['filter']+'%'};return _0xc9eda3;}})});}_0xb4942e=_['merge']({},_0xb4942e,_0x1244aa['options']);var _0x3faf2b={'where':_0xb4942e['where']};return db[_0x26ec('0x42')][_0x26ec('0x32')](_0x3faf2b)['then'](function(_0x4c1355){_0xfb68c9[_0x26ec('0x32')]=_0x4c1355;if(_0x1244aa[_0x26ec('0x48')]['includeAll']){_0xb4942e[_0x26ec('0x58')]=[{'all':!![]}];}return db[_0x26ec('0x42')]['findAll'](_0xb4942e);})['then'](function(_0x34ee55){_0xfb68c9[_0x26ec('0x59')]=_0x34ee55;return _0xfb68c9;})[_0x26ec('0x23')](respondWithFilteredResult(_0x11fc8c,_0xb4942e))['catch'](handleError(_0x11fc8c,null));};exports[_0x26ec('0x5a')]=function(_0x584c35,_0x3c743a){var _0x179f9f={'raw':![],'where':{'id':_0x584c35[_0x26ec('0x5b')]['id']},'include':[{'model':db[_0x26ec('0x5c')],'as':_0x26ec('0x40')}]},_0x2af53a={};_0x2af53a['model']=_[_0x26ec('0x49')](db[_0x26ec('0x42')]['rawAttributes']);_0x2af53a[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x584c35['query']);_0x2af53a[_0x26ec('0x54')]=_['intersection'](_0x2af53a['model'],_0x2af53a[_0x26ec('0x48')]);_0x179f9f[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x2af53a['model'],qs['fields'](_0x584c35[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x179f9f[_0x26ec('0x4b')]=_0x179f9f['attributes'][_0x26ec('0x4d')]?_0x179f9f[_0x26ec('0x4b')]:_0x2af53a['model'];if(_0x584c35['query'][_0x26ec('0x5d')]){_0x179f9f['include']=[{'all':!![]}];}_0x179f9f=_[_0x26ec('0x5e')]({},_0x179f9f,_0x584c35[_0x26ec('0x5f')]);return db[_0x26ec('0x42')][_0x26ec('0x60')](_0x179f9f)['then'](handleEntityNotFound(_0x3c743a,null))['then'](respondWithResult(_0x3c743a,null))[_0x26ec('0x2c')](handleError(_0x3c743a,null));};exports[_0x26ec('0x61')]=function(_0x2e1eec,_0x11440c){return db[_0x26ec('0x42')][_0x26ec('0x61')](_0x2e1eec[_0x26ec('0x62')],{})['then'](function(_0x92dd6f){var _0x4a67e4=_0x2e1eec[_0x26ec('0x63')][_0x26ec('0x39')]({'plain':!![]});if(!_0x4a67e4)throw new Error(_0x26ec('0x64'));if(_0x4a67e4[_0x26ec('0x65')]===_0x26ec('0x63')){var _0x5f599c=_0x92dd6f[_0x26ec('0x39')]({'plain':!![]});var _0xefa3aa=_0x26ec('0x3a');return db[_0x26ec('0x66')]['find']({'where':{'name':_0xefa3aa,'userProfileId':_0x4a67e4[_0x26ec('0x67')]},'raw':!![]})[_0x26ec('0x23')](function(_0x4bd26b){if(_0x4bd26b&&_0x4bd26b[_0x26ec('0x68')]===0x0){return db[_0x26ec('0x3b')][_0x26ec('0x61')]({'name':_0x5f599c[_0x26ec('0x3e')],'resourceId':_0x5f599c['id'],'type':_0x4bd26b[_0x26ec('0x3e')],'sectionId':_0x4bd26b['id']},{})[_0x26ec('0x23')](function(){return _0x92dd6f;});}else{return _0x92dd6f;}})[_0x26ec('0x2c')](function(_0x4a9218){logger[_0x26ec('0x27')](_0x26ec('0x69'),_0x4a9218);throw _0x4a9218;});}return _0x92dd6f;})['then'](respondWithResult(_0x11440c,0xc9))[_0x26ec('0x2c')](handleError(_0x11440c,null));};exports[_0x26ec('0x6a')]=function(_0x329899,_0x2d93e9){if(_0x329899[_0x26ec('0x62')]['id']){delete _0x329899[_0x26ec('0x62')]['id'];}return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x329899[_0x26ec('0x5b')]['id']},'include':[{'model':db[_0x26ec('0x5c')],'as':_0x26ec('0x40')}]})[_0x26ec('0x23')](handleEntityNotFound(_0x2d93e9,null))[_0x26ec('0x23')](saveUpdates(_0x329899[_0x26ec('0x62')],null))[_0x26ec('0x23')](respondWithResult(_0x2d93e9,null))['catch'](handleError(_0x2d93e9,null));};exports['destroy']=function(_0x4b3718,_0x57144c){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x4b3718[_0x26ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x57144c,null))[_0x26ec('0x23')](removeEntity(_0x57144c,null))['catch'](handleError(_0x57144c,null));};exports[_0x26ec('0x6b')]=function(_0x80a521,_0x364d24){return db['OpenchannelAccount'][_0x26ec('0x6b')]()[_0x26ec('0x23')](respondWithResult(_0x364d24,null))[_0x26ec('0x2c')](handleError(_0x364d24,null));};exports[_0x26ec('0x6c')]=function(_0x1c0c79,_0x48de36,_0x169a12){if(_0x1c0c79[_0x26ec('0x62')]['id']){delete _0x1c0c79['body']['id'];}return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x1c0c79[_0x26ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x48de36,null))[_0x26ec('0x23')](function(_0xb64f7a){if(_0xb64f7a){_0x1c0c79[_0x26ec('0x62')][_0x26ec('0x6d')]=_0xb64f7a['id'];return db[_0x26ec('0x6e')][_0x26ec('0x61')](_0x1c0c79[_0x26ec('0x62')]);}})[_0x26ec('0x23')](respondWithResult(_0x48de36,null))[_0x26ec('0x2c')](handleError(_0x48de36,null));};exports[_0x26ec('0x6f')]=function(_0x1ab092,_0x6ab7d4,_0x1f5fc4){var _0x2ad951={'raw':![],'where':{}};var _0x20d69e={};var _0x463cba={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x1ab092[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x6ab7d4,null))[_0x26ec('0x23')](function(_0x3ca5ce){if(_0x3ca5ce){_0x20d69e[_0x26ec('0x47')]=_[_0x26ec('0x49')](db['Disposition'][_0x26ec('0x43')]);_0x20d69e[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x1ab092[_0x26ec('0x48')]);_0x20d69e[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0x20d69e[_0x26ec('0x47')],_0x20d69e[_0x26ec('0x48')]);_0x2ad951[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x20d69e[_0x26ec('0x47')],qs['fields'](_0x1ab092[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x2ad951[_0x26ec('0x4b')]=_0x2ad951['attributes'][_0x26ec('0x4d')]?_0x2ad951[_0x26ec('0x4b')]:_0x20d69e['model'];if(!_0x1ab092[_0x26ec('0x48')]['hasOwnProperty'](_0x26ec('0x4f'))){_0x2ad951[_0x26ec('0x50')]=qs[_0x26ec('0x50')](_0x1ab092[_0x26ec('0x48')][_0x26ec('0x50')]);_0x2ad951[_0x26ec('0x30')]=qs['offset'](_0x1ab092[_0x26ec('0x48')][_0x26ec('0x30')]);}_0x2ad951['order']=qs[_0x26ec('0x52')](_0x1ab092[_0x26ec('0x48')]['sort']);_0x2ad951[_0x26ec('0x53')]=qs['filters'](_[_0x26ec('0x55')](_0x1ab092[_0x26ec('0x48')],_0x20d69e['filters']));_0x2ad951[_0x26ec('0x53')][_0x26ec('0x6d')]=_0x3ca5ce['id'];if(_0x1ab092['query'][_0x26ec('0x56')]){_0x2ad951[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x2ad951[_0x26ec('0x53')],{'$or':_[_0x26ec('0x41')](_0x2ad951[_0x26ec('0x4b')],function(_0x2765bc){var _0x5e46c8={};_0x5e46c8[_0x2765bc]={'$like':'%'+_0x1ab092[_0x26ec('0x48')][_0x26ec('0x56')]+'%'};return _0x5e46c8;})});}_0x2ad951=_['merge']({},_0x2ad951,_0x1ab092['options']);return db['Disposition'][_0x26ec('0x32')]({'where':_0x2ad951[_0x26ec('0x53')]})[_0x26ec('0x23')](function(_0x51cf47){_0x463cba[_0x26ec('0x32')]=_0x51cf47;if(_0x1ab092[_0x26ec('0x48')][_0x26ec('0x5d')]){_0x2ad951[_0x26ec('0x58')]=[{'all':!![]}];}return db[_0x26ec('0x6e')][_0x26ec('0x70')](_0x2ad951);})[_0x26ec('0x23')](function(_0x597c97){_0x463cba[_0x26ec('0x59')]=_0x597c97;return _0x463cba;});}})[_0x26ec('0x23')](respondWithFilteredResult(_0x6ab7d4,_0x2ad951))[_0x26ec('0x2c')](handleError(_0x6ab7d4,null));};exports[_0x26ec('0x71')]=function(_0x18a155,_0x457b03,_0x3bbd9c){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x18a155[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x457b03,null))[_0x26ec('0x23')](function(_0x260436){if(_0x260436){return _0x260436[_0x26ec('0x71')](_0x18a155[_0x26ec('0x48')][_0x26ec('0x72')]);}})[_0x26ec('0x23')](respondWithStatusCode(_0x457b03,null))[_0x26ec('0x2c')](handleError(_0x457b03,null));};exports[_0x26ec('0x73')]=function(_0x289ca2,_0x3d197f,_0x15d5dd){if(_0x289ca2[_0x26ec('0x62')]['id']){delete _0x289ca2[_0x26ec('0x62')]['id'];}return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x289ca2['params']['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x3d197f,null))[_0x26ec('0x23')](function(_0x42ae13){if(_0x42ae13){_0x289ca2[_0x26ec('0x62')][_0x26ec('0x6d')]=_0x42ae13['id'];return db[_0x26ec('0x74')][_0x26ec('0x61')](_0x289ca2[_0x26ec('0x62')]);}})[_0x26ec('0x23')](respondWithResult(_0x3d197f,null))['catch'](handleError(_0x3d197f,null));};exports[_0x26ec('0x75')]=function(_0x3ce8eb,_0x248ca0,_0xa43ab5){var _0x101cfc={'raw':![],'where':{}};var _0x9eaa77={};var _0x13ca0b={'count':0x0,'rows':[]};return db[_0x26ec('0x42')]['findOne']({'where':{'id':_0x3ce8eb[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x248ca0,null))['then'](function(_0x2b14c8){if(_0x2b14c8){_0x9eaa77[_0x26ec('0x47')]=_['keys'](db['CannedAnswer'][_0x26ec('0x43')]);_0x9eaa77[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x3ce8eb[_0x26ec('0x48')]);_0x9eaa77[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0x9eaa77[_0x26ec('0x47')],_0x9eaa77[_0x26ec('0x48')]);_0x101cfc[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x9eaa77[_0x26ec('0x47')],qs[_0x26ec('0x4c')](_0x3ce8eb['query'][_0x26ec('0x4c')]));_0x101cfc['attributes']=_0x101cfc['attributes']['length']?_0x101cfc['attributes']:_0x9eaa77[_0x26ec('0x47')];if(!_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x101cfc[_0x26ec('0x50')]=qs['limit'](_0x3ce8eb['query']['limit']);_0x101cfc[_0x26ec('0x30')]=qs[_0x26ec('0x30')](_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x30')]);}_0x101cfc['order']=qs[_0x26ec('0x52')](_0x3ce8eb['query'][_0x26ec('0x52')]);_0x101cfc[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_[_0x26ec('0x55')](_0x3ce8eb[_0x26ec('0x48')],_0x9eaa77['filters']));_0x101cfc[_0x26ec('0x53')]['OpenchannelAccountId']=_0x2b14c8['id'];if(_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x56')]){_0x101cfc[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x101cfc[_0x26ec('0x53')],{'$or':_['map'](_0x101cfc[_0x26ec('0x4b')],function(_0x5c9f1f){var _0x19ac76={};_0x19ac76[_0x5c9f1f]={'$like':'%'+_0x3ce8eb[_0x26ec('0x48')][_0x26ec('0x56')]+'%'};return _0x19ac76;})});}_0x101cfc=_[_0x26ec('0x5e')]({},_0x101cfc,_0x3ce8eb['options']);return db[_0x26ec('0x74')]['count']({'where':_0x101cfc[_0x26ec('0x53')]})[_0x26ec('0x23')](function(_0x1f3972){_0x13ca0b['count']=_0x1f3972;if(_0x3ce8eb['query'][_0x26ec('0x5d')]){_0x101cfc[_0x26ec('0x58')]=[{'all':!![]}];}return db[_0x26ec('0x74')][_0x26ec('0x70')](_0x101cfc);})['then'](function(_0x53471c){_0x13ca0b[_0x26ec('0x59')]=_0x53471c;return _0x13ca0b;});}})['then'](respondWithFilteredResult(_0x248ca0,_0x101cfc))[_0x26ec('0x2c')](handleError(_0x248ca0,null));};exports['removeAnswers']=function(_0x430bb4,_0x4da032,_0x136140){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x430bb4[_0x26ec('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4da032,null))[_0x26ec('0x23')](function(_0x24f3b8){if(_0x24f3b8){return _0x24f3b8[_0x26ec('0x76')](_0x430bb4['query'][_0x26ec('0x72')]);}})['then'](respondWithStatusCode(_0x4da032,null))[_0x26ec('0x2c')](handleError(_0x4da032,null));};exports[_0x26ec('0x77')]=function(_0x2a6c21,_0x48d67c,_0x1c885f){var _0x6cd0f6={'body':_0x2a6c21[_0x26ec('0x62')],'channel':_0x26ec('0x78')};var _0x44de7e=[];var _0x594632=[];var _0x13ef95={};var _0x14dd26=![];return db[_0x26ec('0x79')]['describe']()[_0x26ec('0x23')](function(_0x4b5cf8){if(!_0x4b5cf8){throw new db['Sequelize'][(_0x26ec('0x7a'))](_0x26ec('0x7b'));}_0x44de7e=_['difference'](_['keys'](_0x4b5cf8),[_0x26ec('0x7c'),_0x26ec('0x7d')]);_0x594632=_[_0x26ec('0x7e')](_['keys'](_0x4b5cf8),[_0x26ec('0x7c'),_0x26ec('0x7d'),_0x26ec('0x7f'),'ListId']);if(_0x2a6c21[_0x26ec('0x62')]['id']){delete _0x2a6c21['body']['id'];}if(_[_0x26ec('0x80')](_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x81')])){throw new db['Sequelize'][(_0x26ec('0x7a'))](_0x26ec('0x82'));}if(_[_0x26ec('0x80')](_0x2a6c21[_0x26ec('0x62')]['body'])||_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x62')]===''){throw new db[(_0x26ec('0x83'))]['ValidationError'](_0x26ec('0x84'));}if(_[_0x26ec('0x80')](_0x2a6c21[_0x26ec('0x62')]['mapKey'])){throw new db[(_0x26ec('0x83'))][(_0x26ec('0x7a'))](_0x26ec('0x85')+_0x594632);}if(!_[_0x26ec('0x86')](_0x594632,_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x87')])){throw new db[(_0x26ec('0x83'))][(_0x26ec('0x7a'))](_0x26ec('0x88')+_0x594632);}_0x13ef95[_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x87')]]=_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x81')];})['then'](function(){return db[_0x26ec('0x42')]['find']({'where':{'id':_0x2a6c21[_0x26ec('0x5b')]['id']},'include':[{'model':db[_0x26ec('0x89')],'as':'List','include':[{'model':db[_0x26ec('0x79')],'as':_0x26ec('0x8a'),'where':_0x13ef95,'limit':0x1,'order':[[_0x26ec('0x7d'),_0x26ec('0x8b')]]}]},{'model':db[_0x26ec('0x8c')],'as':_0x26ec('0x8d')}]});})[_0x26ec('0x23')](handleEntityNotFound(_0x48d67c,null))[_0x26ec('0x23')](function(_0x4978d0){if(_0x4978d0&&_0x4978d0[_0x26ec('0x8e')]){_0x6cd0f6['account']=_0x4978d0;_0x6cd0f6['applications']=_0x4978d0[_0x26ec('0x8d')];_0x6cd0f6['list']=_0x4978d0[_0x26ec('0x8e')];_0x6cd0f6[_0x26ec('0x8f')]=_[_0x26ec('0x90')](_0x6cd0f6[_0x26ec('0x8f')],[_0x26ec('0x91')],['asc']);if(_0x6cd0f6['account']['Applications']){delete _0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8d')];}if(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8e')]&&_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8e')][_0x26ec('0x8a')][_0x26ec('0x4d')]){return _0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x8e')]['Contacts'][0x0];}var _0x486a4e=_[_0x26ec('0x1a')](_0x2a6c21[_0x26ec('0x62')],{'firstName':_0x2a6c21['body']['from'],'ListId':_0x4978d0[_0x26ec('0x93')]});_0x486a4e[_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x87')]]=_0x2a6c21[_0x26ec('0x62')]['from'];return db[_0x26ec('0x79')]['create'](_0x486a4e,{'fields':_0x44de7e,'raw':!![]});}})[_0x26ec('0x23')](handleEntityNotFound(_0x48d67c,null))[_0x26ec('0x23')](function(_0x33a744){_0x6cd0f6[_0x26ec('0x94')]=_0x33a744;if(_0x33a744){var _0x5574c9={'ContactId':_0x33a744['id'],'OpenchannelAccountId':_0x2a6c21['params']['id'],'from':(_0x33a744['firstName']||'')+'\x20'+(_0x33a744['lastName']||'')};var _0x1373ce={'OpenchannelAccountId':_0x2a6c21['params']['id'],'closed':![]};if(_0x2a6c21[_0x26ec('0x62')]['threadId']){_0x1373ce[_0x26ec('0x95')]=_0x2a6c21[_0x26ec('0x62')]['threadId'];return db[_0x26ec('0x96')][_0x26ec('0x60')]({'where':_0x1373ce})[_0x26ec('0x23')](function(_0x18f802){if(_0x18f802){return[_0x18f802,![]];}_0x5574c9[_0x26ec('0x95')]=_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x95')];_0x5574c9[_0x26ec('0x97')]=_0x2a6c21['body'][_0x26ec('0x97')];return db[_0x26ec('0x96')]['create'](_0x5574c9)['then'](function(_0x2b0b3e){return[_0x2b0b3e,!![]];});});}else{_0x1373ce[_0x26ec('0x95')]=null;}_0x1373ce[_0x26ec('0x98')]=_0x33a744['id'];return db['OpenchannelInteraction']['find']({'where':_0x1373ce})['then'](function(_0x50e1ab){if(_0x50e1ab){return[_0x50e1ab,![]];}return db['OpenchannelInteraction'][_0x26ec('0x61')](_0x5574c9)[_0x26ec('0x23')](function(_0x2f8396){return[_0x2f8396,!![]];});});}})[_0x26ec('0x99')](function(_0x1c9101,_0x3f6943){if(_0x1c9101){_0x14dd26=_0x3f6943;if(!_0x3f6943){var _0x207ea5={'from':(_0x6cd0f6['contact'][_0x26ec('0x9a')]||'')+'\x20'+(_0x6cd0f6[_0x26ec('0x94')][_0x26ec('0x9b')]||'')};if(_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x95')]&&_0x2a6c21[_0x26ec('0x62')][_0x26ec('0x9c')]&&_0x2a6c21['body']['threadId']!=_0x2a6c21['body']['messageId']){_0x207ea5[_0x26ec('0x95')]=_0x2a6c21[_0x26ec('0x62')]['messageId'];}return _0x1c9101[_0x26ec('0x6a')](_0x207ea5);}else{return _0x1c9101;}}})['then'](function(_0x1b0f41){_0x6cd0f6['interaction']=_0x1b0f41[_0x26ec('0x39')]({'plain':!![]});_0x6cd0f6[_0x26ec('0x9d')][_0x26ec('0x9e')]=_0x14dd26;if(_0x6cd0f6['interaction'][_0x26ec('0x9e')]){if(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0x9f')]){_0x6cd0f6[_0x26ec('0x8f')][_0x26ec('0xa0')]({'id':0x0,'priority':_0x6cd0f6['applications']['length']+0x1,'app':_0x26ec('0xa1'),'appdata':_0x26ec('0xa2'),'interval':_0x26ec('0xa3')});}}return db[_0x26ec('0xa4')][_0x26ec('0x61')]({'body':_0x2a6c21['body']['body'],'OpenchannelAccountId':_0x2a6c21[_0x26ec('0x5b')]['id'],'OpenchannelInteractionId':_0x1b0f41['id'],'direction':'in','ContactId':_0x6cd0f6[_0x26ec('0x94')]['id'],'AttachmentId':_0x2a6c21[_0x26ec('0x62')][_0x26ec('0xa5')]});})[_0x26ec('0x23')](function(_0x2ee8e7){_0x6cd0f6[_0x26ec('0x2a')]=_0x2ee8e7;if(!_0x6cd0f6['interaction'][_0x26ec('0xa6')])return;return db['User'][_0x26ec('0x60')]({'attributes':['id',_0x26ec('0x3e')],'where':{'id':_0x6cd0f6[_0x26ec('0x9d')]['UserId']}});})[_0x26ec('0x23')](function(_0x143591){if(_0x143591){_0x6cd0f6[_0x26ec('0x8f')][_0x26ec('0xa7')]({'id':0x0,'priority':0x0,'app':_0x26ec('0xa8'),'appdata':_0x143591['name']+','+(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0xa9')]||0xa),'interval':_0x26ec('0xa3')});}if(!_0x6cd0f6[_0x26ec('0x9d')][_0x26ec('0xaa')])return;return db[_0x26ec('0xab')]['find']({'attributes':['id',_0x26ec('0x3e')],'where':{'id':_0x6cd0f6[_0x26ec('0x9d')][_0x26ec('0xaa')]}});})[_0x26ec('0x23')](function(_0xdef8cd){if(_0xdef8cd){_0x6cd0f6['applications'][_0x26ec('0xa7')]({'id':0x0,'priority':0x1,'app':_0x26ec('0xac'),'appdata':_0xdef8cd[_0x26ec('0x3e')]+','+(_0x6cd0f6[_0x26ec('0x92')][_0x26ec('0xad')]||0x12c),'interval':_0x26ec('0xa3')});}return respondWithRpcPromise(_0x26ec('0xae'),'startRouting',_0x6cd0f6);})[_0x26ec('0x23')](function(_0x21b8e7){respondWithRpcPromise(_0x26ec('0xaf'),_0x26ec('0xaf'),{'event':'notify','message':_0x21b8e7},client9002);return _0x21b8e7;})[_0x26ec('0x23')](respondWithResult(_0x48d67c,null))[_0x26ec('0x2c')](handleError(_0x48d67c,null));};exports[_0x26ec('0xb0')]=function(_0xd7195f,_0x1debd5){var _0x3c0ed1=_0xd7195f['params']['id'];var _0x4d439d=_0xd7195f[_0x26ec('0x62')];var _0x4abd0e=0xc8;var _0x46d2b3=null;return db[_0x26ec('0xb1')]['transaction']({'isolationLevel':db['sequelize'][_0x26ec('0xb2')][_0x26ec('0xb3')][_0x26ec('0xb4')]},function(_0x17a503){return db['OpenchannelAccount'][_0x26ec('0xb5')]({'where':{'id':_0x3c0ed1},'transaction':_0x17a503})[_0x26ec('0x23')](function(_0x229948){if(_0x229948){return db[_0x26ec('0x8c')][_0x26ec('0x38')]({'where':{'OpenchannelAccountId':_0x3c0ed1},'transaction':_0x17a503})[_0x26ec('0x23')](function(){var _0x243a65=_[_0x26ec('0x41')](_0x4d439d,function(_0x4af2f4){_0x4af2f4[_0x26ec('0x6d')]=_0x3c0ed1;return _0x4af2f4;});return db[_0x26ec('0x8c')]['bulkCreate'](_0x243a65,{'transaction':_0x17a503});});}else{_0x4abd0e=0x194;_0x46d2b3=[];}});})[_0x26ec('0x23')](function(){if(_0x4abd0e!==0x194){return db[_0x26ec('0x8c')][_0x26ec('0xb6')]({'where':{'OpenchannelAccountId':_0x3c0ed1},'order':'priority'})[_0x26ec('0x23')](function(_0x4ee48e){_0x46d2b3=_0x4ee48e;});}})[_0x26ec('0x2c')](function(_0x2de290){_0x4abd0e=0x1f4;logger[_0x26ec('0x27')](_0x2de290['stack']);if(_0x2de290['name']){delete _0x2de290['name'];}_0x46d2b3=_0x2de290;})['finally'](function(){if(_0x46d2b3===null){_0x1debd5[_0x26ec('0x3c')](_0x4abd0e);}else{if(_0x4abd0e===0x1f4){_0x1debd5[_0x26ec('0x2e')](_0x4abd0e)['send'](_0x46d2b3);}else{_0x1debd5[_0x26ec('0x2e')](_0x4abd0e)[_0x26ec('0x2f')](_0x46d2b3);}}});};exports[_0x26ec('0xb7')]=function(_0x10513b,_0x27492d,_0x43b770){var _0x33f661={};var _0x4968a5={};var _0x40c72b;var _0x1c28b4;return db[_0x26ec('0x42')][_0x26ec('0xb5')]({'where':{'id':_0x10513b[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x27492d,null))['then'](function(_0x3faae3){if(_0x3faae3){_0x40c72b=_0x3faae3;_0x4968a5[_0x26ec('0x47')]=_['keys'](db['OpenchannelApplication']['rawAttributes']);_0x4968a5[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x10513b[_0x26ec('0x48')]);_0x4968a5[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0x4968a5[_0x26ec('0x47')],_0x4968a5[_0x26ec('0x48')]);_0x33f661[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0x4968a5['model'],qs[_0x26ec('0x4c')](_0x10513b[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x33f661[_0x26ec('0x4b')]=_0x33f661[_0x26ec('0x4b')]['length']?_0x33f661[_0x26ec('0x4b')]:_0x4968a5[_0x26ec('0x47')];_0x33f661[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x10513b[_0x26ec('0x48')][_0x26ec('0x52')]);_0x33f661['where']=qs[_0x26ec('0x54')](_['pick'](_0x10513b[_0x26ec('0x48')],_0x4968a5['filters']));if(_0x10513b[_0x26ec('0x48')]['filter']){_0x33f661[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x33f661['where'],{'$or':_['map'](_0x33f661[_0x26ec('0x4b')],function(_0x3730dd){var _0x550ef1={};_0x550ef1[_0x3730dd]={'$like':'%'+_0x10513b[_0x26ec('0x48')][_0x26ec('0x56')]+'%'};return _0x550ef1;})});}_0x33f661=_['merge']({},_0x33f661,_0x10513b['options']);return _0x40c72b[_0x26ec('0xb7')](_0x33f661);}})['then'](function(_0x21089c){if(_0x21089c){_0x1c28b4=_0x21089c['length'];if(!_0x10513b[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x33f661['limit']=qs['limit'](_0x10513b[_0x26ec('0x48')][_0x26ec('0x50')]);_0x33f661[_0x26ec('0x30')]=qs[_0x26ec('0x30')](_0x10513b['query'][_0x26ec('0x30')]);}return _0x40c72b[_0x26ec('0xb7')](_0x33f661);}})[_0x26ec('0x23')](function(_0x18db24){if(_0x18db24){return _0x18db24?{'count':_0x1c28b4,'rows':_0x18db24}:null;}})[_0x26ec('0x23')](respondWithResult(_0x27492d,null))[_0x26ec('0x2c')](handleError(_0x27492d,null));};exports[_0x26ec('0xb8')]=function(_0x44416b,_0x344173,_0x46cfd4){var _0x4fdf95={'raw':![],'where':{}};var _0xa8a550={};var _0x1768e3={'count':0x0,'rows':[]};return db[_0x26ec('0x42')]['findOne']({'where':{'id':_0x44416b[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x344173,null))[_0x26ec('0x23')](function(_0x4e5a0d){if(_0x4e5a0d){_0xa8a550[_0x26ec('0x47')]=_['keys'](db['OpenchannelInteraction'][_0x26ec('0x43')]);_0xa8a550['query']=_[_0x26ec('0x49')](_0x44416b[_0x26ec('0x48')]);_0xa8a550[_0x26ec('0x54')]=_[_0x26ec('0x4a')](_0xa8a550[_0x26ec('0x47')],_0xa8a550[_0x26ec('0x48')]);_0x4fdf95[_0x26ec('0x4b')]=_[_0x26ec('0x4a')](_0xa8a550[_0x26ec('0x47')],qs[_0x26ec('0x4c')](_0x44416b[_0x26ec('0x48')][_0x26ec('0x4c')]));_0x4fdf95['attributes']=_0x4fdf95[_0x26ec('0x4b')][_0x26ec('0x4d')]?_0x4fdf95[_0x26ec('0x4b')]:_0xa8a550[_0x26ec('0x47')];if(!_0x44416b[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x4fdf95[_0x26ec('0x50')]=qs['limit'](_0x44416b['query'][_0x26ec('0x50')]);_0x4fdf95['offset']=qs[_0x26ec('0x30')](_0x44416b['query'][_0x26ec('0x30')]);}_0x4fdf95[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x44416b['query'][_0x26ec('0x52')]);_0x4fdf95[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_[_0x26ec('0x55')](_0x44416b[_0x26ec('0x48')],_0xa8a550[_0x26ec('0x54')]));_0x4fdf95[_0x26ec('0x53')][_0x26ec('0x6d')]=_0x4e5a0d['id'];if(_0x44416b['query'][_0x26ec('0x56')]){_0x4fdf95['where']=_[_0x26ec('0x5e')](_0x4fdf95['where'],{'$or':_[_0x26ec('0x41')](_0x4fdf95[_0x26ec('0x4b')],function(_0x438af7){var _0x306a80={};_0x306a80[_0x438af7]={'$like':'%'+_0x44416b['query'][_0x26ec('0x56')]+'%'};return _0x306a80;})});}_0x4fdf95=_[_0x26ec('0x5e')]({},_0x4fdf95,_0x44416b['options']);return db[_0x26ec('0x96')][_0x26ec('0x32')]({'where':_0x4fdf95[_0x26ec('0x53')]})['then'](function(_0xed753d){_0x1768e3['count']=_0xed753d;if(_0x44416b[_0x26ec('0x48')]['includeAll']){_0x4fdf95[_0x26ec('0x58')]=[{'model':db[_0x26ec('0x79')],'as':_0x26ec('0xb9'),'required':![]},{'model':db['User'],'as':_0x26ec('0xba'),'attributes':[_0x26ec('0x3e'),_0x26ec('0xbb'),_0x26ec('0xbc')],'required':![]},{'model':db[_0x26ec('0xbd')],'as':_0x26ec('0xbe'),'attributes':['id','name',_0x26ec('0xbf')],'where':_0x44416b[_0x26ec('0x48')][_0x26ec('0xc0')]?{'id':_0x44416b[_0x26ec('0x48')]['tag']}:undefined,'required':_0x44416b[_0x26ec('0x48')][_0x26ec('0xc0')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x26ec('0x70')](_0x4fdf95);})[_0x26ec('0x23')](function(_0x4e3431){_0x1768e3[_0x26ec('0x59')]=_0x4e3431;return _0x1768e3;});}})['then'](respondWithFilteredResult(_0x344173,_0x4fdf95))['catch'](handleError(_0x344173,null));};exports[_0x26ec('0xc1')]=function(_0x18dbcf,_0xda0a78,_0x2e9dd2){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x18dbcf['params']['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0xda0a78,null))[_0x26ec('0x23')](function(_0xcda910){if(_0xcda910){return _0xcda910[_0x26ec('0xc1')](_0x18dbcf[_0x26ec('0x62')][_0x26ec('0x72')],_[_0x26ec('0xc2')](_0x18dbcf['body'],[_0x26ec('0x72'),'id'])||{})[_0x26ec('0x99')](function(_0x55747d){for(var _0x50ef82=0x0;_0x50ef82<_0x18dbcf[_0x26ec('0x62')]['ids']['length'];_0x50ef82+=0x1){socket[_0x26ec('0xc3')]('userOpenchannelAccount:save',{'UserId':Number(_0x18dbcf[_0x26ec('0x62')][_0x26ec('0x72')][_0x50ef82]),'OpenchannelAccountId':Number(_0x18dbcf[_0x26ec('0x5b')]['id'])});}return _0x55747d;});}})[_0x26ec('0x23')](respondWithResult(_0xda0a78,null))[_0x26ec('0x2c')](handleError(_0xda0a78,null));};exports['removeAgents']=function(_0x5cec80,_0x203b3a,_0x62297e){return db[_0x26ec('0x42')]['find']({'where':{'id':_0x5cec80[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x203b3a,null))[_0x26ec('0x23')](function(_0x3f616b){if(_0x3f616b){return _0x3f616b[_0x26ec('0xc4')](_0x5cec80[_0x26ec('0x48')][_0x26ec('0x72')])[_0x26ec('0x23')](function(){if(_[_0x26ec('0xc5')](_0x5cec80[_0x26ec('0x48')][_0x26ec('0x72')])){for(var _0x4b6e33=0x0;_0x4b6e33<_0x5cec80[_0x26ec('0x48')]['ids']['length'];_0x4b6e33+=0x1){socket['emit'](_0x26ec('0xc6'),{'UserId':Number(_0x5cec80[_0x26ec('0x48')][_0x26ec('0x72')][_0x4b6e33]),'OpenchannelAccountId':Number(_0x5cec80[_0x26ec('0x5b')]['id'])});}}else{socket['emit'](_0x26ec('0xc6'),{'UserId':Number(_0x5cec80['query']['ids']),'OpenchannelAccountId':Number(_0x5cec80[_0x26ec('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x203b3a,null))['catch'](handleError(_0x203b3a,null));};exports[_0x26ec('0xc7')]=function(_0x4c0f82,_0x2d060e,_0xa31d01){var _0x1ab6f9={};var _0x4a823e={};var _0x3b92d9;var _0x564c00;return db['OpenchannelAccount'][_0x26ec('0xb5')]({'where':{'id':_0x4c0f82['params']['id']}})['then'](handleEntityNotFound(_0x2d060e,null))[_0x26ec('0x23')](function(_0x1a7b51){if(_0x1a7b51){_0x3b92d9=_0x1a7b51;_0x4a823e[_0x26ec('0x47')]=_['keys'](db[_0x26ec('0xc8')][_0x26ec('0x43')]);_0x4a823e[_0x26ec('0x48')]=_[_0x26ec('0x49')](_0x4c0f82[_0x26ec('0x48')]);_0x4a823e[_0x26ec('0x54')]=_['intersection'](_0x4a823e[_0x26ec('0x47')],_0x4a823e[_0x26ec('0x48')]);_0x1ab6f9['attributes']=_[_0x26ec('0x4a')](_0x4a823e[_0x26ec('0x47')],qs[_0x26ec('0x4c')](_0x4c0f82[_0x26ec('0x48')]['fields']));_0x1ab6f9[_0x26ec('0x4b')]=_0x1ab6f9['attributes']['length']?_0x1ab6f9['attributes']:_0x4a823e[_0x26ec('0x47')];_0x1ab6f9[_0x26ec('0x51')]=qs[_0x26ec('0x52')](_0x4c0f82['query'][_0x26ec('0x52')]);_0x1ab6f9[_0x26ec('0x53')]=qs[_0x26ec('0x54')](_['pick'](_0x4c0f82['query'],_0x4a823e[_0x26ec('0x54')]));if(_0x4c0f82['query'][_0x26ec('0x56')]){_0x1ab6f9[_0x26ec('0x53')]=_[_0x26ec('0x5e')](_0x1ab6f9[_0x26ec('0x53')],{'$or':_[_0x26ec('0x41')](_0x1ab6f9[_0x26ec('0x4b')],function(_0x106f13){var _0x210cc5={};_0x210cc5[_0x106f13]={'$like':'%'+_0x4c0f82['query']['filter']+'%'};return _0x210cc5;})});}_0x1ab6f9=_[_0x26ec('0x5e')]({},_0x1ab6f9,_0x4c0f82['options']);return _0x3b92d9[_0x26ec('0xc7')](_0x1ab6f9);}})[_0x26ec('0x23')](function(_0x4697c6){if(_0x4697c6){_0x564c00=_0x4697c6[_0x26ec('0x4d')];if(!_0x4c0f82[_0x26ec('0x48')][_0x26ec('0x4e')](_0x26ec('0x4f'))){_0x1ab6f9['limit']=qs[_0x26ec('0x50')](_0x4c0f82['query'][_0x26ec('0x50')]);_0x1ab6f9[_0x26ec('0x30')]=qs[_0x26ec('0x30')](_0x4c0f82[_0x26ec('0x48')][_0x26ec('0x30')]);}return _0x3b92d9['getAgents'](_0x1ab6f9);}})[_0x26ec('0x23')](function(_0x4e383b){if(_0x4e383b){return _0x4e383b?{'count':_0x564c00,'rows':_0x4e383b}:null;}})[_0x26ec('0x23')](respondWithResult(_0x2d060e,null))[_0x26ec('0x2c')](handleError(_0x2d060e,null));};exports['send']=function(_0x5cce32,_0x5a9be4,_0x4cad1f){var _0x425a36,_0x1ac026,_0xbdc050;if(_[_0x26ec('0x80')](_0x5cce32[_0x26ec('0x62')]['body'])||_0x5cce32[_0x26ec('0x62')]['body']===''){throw new db[(_0x26ec('0x83'))][(_0x26ec('0x7a'))](_0x26ec('0x84'));}if(_['isNil'](_0x5cce32[_0x26ec('0x62')]['to'])){}_0x425a36=_0x5cce32[_0x26ec('0x62')]['to'];return db[_0x26ec('0x42')][_0x26ec('0xb5')]({'where':{'id':_0x5cce32[_0x26ec('0x5b')]['id']}})[_0x26ec('0x23')](handleEntityNotFound(_0x5a9be4,null))[_0x26ec('0x23')](function(_0x2bca8c){if(_0x2bca8c){return db[_0x26ec('0x42')][_0x26ec('0x60')]({'where':{'id':_0x2bca8c['id']},'include':[{'model':db[_0x26ec('0x89')],'as':_0x26ec('0x8e'),'include':[{'model':db[_0x26ec('0x79')],'as':'Contacts','where':{[_0x2bca8c[_0x26ec('0x87')]]:_0x425a36},'limit':0x1,'order':[[_0x26ec('0x7d'),_0x26ec('0x8b')]]}]}]})[_0x26ec('0x23')](handleEntityNotFound(_0x5a9be4,null))['then'](function(_0x182b74){if(_0x182b74&&_0x182b74[_0x26ec('0x8e')]){_0x1ac026=_0x182b74[_0x26ec('0x39')]({'plain':!![]});if(_0x1ac026[_0x26ec('0x8e')]&&_0x1ac026[_0x26ec('0x8e')][_0x26ec('0x8a')]['length']){return _0x1ac026['List'][_0x26ec('0x8a')][0x0];}return db[_0x26ec('0x79')][_0x26ec('0x61')](_[_0x26ec('0x1a')](_0x5cce32['body'],{'firstName':_0x425a36,[_0x182b74[_0x26ec('0x87')]]:_0x425a36,'phone':_0x425a36,'ListId':_0x1ac026[_0x26ec('0x93')]}));}})['then'](handleEntityNotFound(_0x5a9be4,null))[_0x26ec('0x23')](function(_0x56df70){if(_0x56df70){_0xbdc050=_0x56df70;return db[_0x26ec('0x96')][_0x26ec('0x60')]({'where':{'ContactId':_0xbdc050['id'],'closed':![],'OpenchannelAccountId':_0x1ac026['id']}})[_0x26ec('0x23')](function(_0x322847){if(_0x322847){return[_0x322847,![]];}return db[_0x26ec('0x96')][_0x26ec('0x61')]({'UserId':_0x5cce32[_0x26ec('0x63')]['id'],'ContactId':_0xbdc050['id'],'OpenchannelAccountId':_0x1ac026['id'],'lastMsgDirection':_0x26ec('0xc9'),'firstMsgDirection':_0x26ec('0xc9'),'Messages':[_[_0x26ec('0x5e')](_0x5cce32[_0x26ec('0x62')],{'read':![],'body':_0x5cce32[_0x26ec('0x62')][_0x26ec('0x62')],'OpenchannelAccountId':_0x1ac026['id'],'UserId':_0x5cce32[_0x26ec('0x63')]['id'],'ContactId':_0xbdc050['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0x26ec('0xca')}]})[_0x26ec('0x23')](function(_0xfe2b1c){return[_0xfe2b1c,!![]];});});}})[_0x26ec('0x99')](function(_0x34b736,_0x5a2220){if(_0x5a2220){return _0x34b736;}return db[_0x26ec('0xa4')]['create'](_[_0x26ec('0x5e')](_0x5cce32[_0x26ec('0x62')],{'read':![],'body':_0x5cce32['body'][_0x26ec('0x62')],'OpenchannelAccountId':_0x1ac026['id'],'OpenchannelInteractionId':_0x34b736['id'],'UserId':_0x5cce32['user']['id'],'ContactId':_0xbdc050['id']}))[_0x26ec('0x23')](function(_0x5c04d8){_0x34b736[_0x26ec('0xcb')][_0x26ec('0xca')]=[];_0x34b736[_0x26ec('0xcb')][_0x26ec('0xca')]['push'](_0x5c04d8[_0x26ec('0xcb')]);return _0x34b736;});});}})[_0x26ec('0x23')](respondWithResult(_0x5a9be4,null))[_0x26ec('0x2c')](handleError(_0x5a9be4,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index f3e4daa..0e46517 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 _0x6f0d=['remove','emit','hook','exports','../../mysqldb','OpenchannelAccount','setMaxListeners','save'];(function(_0x2e2676,_0x581376){var _0x38997b=function(_0x509528){while(--_0x509528){_0x2e2676['push'](_0x2e2676['shift']());}};_0x38997b(++_0x581376);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x4b8609,_0x45bfdc){_0x4b8609=_0x4b8609-0x0;var _0x1f2269=_0x6f0d[_0x4b8609];return _0x1f2269;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xd6f0('0x0'))['db'][_0xd6f0('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd6f0('0x2')](0x0);var events={'afterCreate':_0xd6f0('0x3'),'afterUpdate':'update','afterDestroy':_0xd6f0('0x4')};function emitEvent(_0x135a93){return function(_0x2f78fb,_0x25344b,_0x3a757f){OpenchannelAccountEvents['emit'](_0x135a93+':'+_0x2f78fb['id'],_0x2f78fb);OpenchannelAccountEvents[_0xd6f0('0x5')](_0x135a93,_0x2f78fb);_0x3a757f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount[_0xd6f0('0x6')](e,emitEvent(event));}}module[_0xd6f0('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb58b=['exports','../../mysqldb','OpenchannelAccount','setMaxListeners','update','remove','emit','hook'];(function(_0x2970f4,_0x171125){var _0x15bb2b=function(_0x48ab7c){while(--_0x48ab7c){_0x2970f4['push'](_0x2970f4['shift']());}};_0x15bb2b(++_0x171125);}(_0xb58b,0x1f1));var _0xbb58=function(_0x4c0cc6,_0x12de3b){_0x4c0cc6=_0x4c0cc6-0x0;var _0x403708=_0xb58b[_0x4c0cc6];return _0x403708;};'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 diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index f5c7de5..c87f813 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(_0x329572,_0x5dbb9f){var _0x15bd1f=function(_0x271455){while(--_0x271455){_0x329572['push'](_0x329572['shift']());}};_0x15bd1f(++_0x5dbb9f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4581cb,_0x4f7523){var _0x2035d2=function(_0x1c00bc){while(--_0x1c00bc){_0x4581cb['push'](_0x4581cb['shift']());}};_0x2035d2(++_0x4f7523);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'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 dcace57..551b867 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 _0x6e6c=['OpenchannelAccount,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','request','then','info','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1694ce,_0x220256){var _0x5895be=function(_0x3693e8){while(--_0x3693e8){_0x1694ce['push'](_0x1694ce['shift']());}};_0x5895be(++_0x220256);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x6e6c[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var moment=require('moment');var BPromise=require(_0xc6e6('0x2'));var rs=require(_0xc6e6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc6e6('0x4'));var logger=require('../../config/logger')(_0xc6e6('0x5'));var config=require('../../config/environment');var jayson=require(_0xc6e6('0x6'));var client=jayson[_0xc6e6('0x7')]['http']({'port':0x232a});config[_0xc6e6('0x8')]=_[_0xc6e6('0x9')](config['redis'],{'host':_0xc6e6('0xa'),'port':0x18eb});var socket=require(_0xc6e6('0xb'))(new Redis(config['redis']));require(_0xc6e6('0xc'))['register'](socket);function respondWithRpcPromise(_0x172aa9,_0x3b2f50,_0x29f78a){return new BPromise(function(_0x3ddf6f,_0x12596b){return client[_0xc6e6('0xd')](_0x172aa9,_0x29f78a)[_0xc6e6('0xe')](function(_0x10aae5){logger[_0xc6e6('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));logger['debug'](_0xc6e6('0x11'),_0x3b2f50,_0xc6e6('0x10'),JSON[_0xc6e6('0x12')](_0x10aae5));if(_0x10aae5[_0xc6e6('0x13')]){if(_0x10aae5['error'][_0xc6e6('0x14')]===0x1f4){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x12596b(_0x10aae5['error'][_0xc6e6('0x16')]);}logger[_0xc6e6('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0x10aae5[_0xc6e6('0x13')][_0xc6e6('0x16')]);return _0x3ddf6f(_0x10aae5[_0xc6e6('0x13')]['message']);}else{logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x3b2f50,_0xc6e6('0x10'));_0x3ddf6f(_0x10aae5['result'][_0xc6e6('0x16')]);}})[_0xc6e6('0x17')](function(_0x1ecc8f){logger[_0xc6e6('0x13')](_0xc6e6('0x15'),_0x3b2f50,_0x1ecc8f);_0x12596b(_0x1ecc8f);});});} \ No newline at end of file +var _0x00b3=['OpenchannelAccount,\x20%s,\x20%s','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','redis','./openchannelAccount.socket','register','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x37d0bc,_0x109b96){var _0x170e60=function(_0xae2ad){while(--_0xae2ad){_0x37d0bc['push'](_0x37d0bc['shift']());}};_0x170e60(++_0x109b96);}(_0x00b3,0x17a));var _0x300b=function(_0x258253,_0x22d730){_0x258253=_0x258253-0x0;var _0xaa0415=_0x00b3[_0x258253];return _0xaa0415;};'use strict';var _=require('lodash');var util=require(_0x300b('0x0'));var moment=require(_0x300b('0x1'));var BPromise=require(_0x300b('0x2'));var rs=require(_0x300b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x300b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x300b('0x5'))('rpc');var config=require(_0x300b('0x6'));var jayson=require(_0x300b('0x7'));var client=jayson[_0x300b('0x8')][_0x300b('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x300b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x300b('0xa')]));require(_0x300b('0xb'))[_0x300b('0xc')](socket);function respondWithRpcPromise(_0x4d8d78,_0x42e5a5,_0x3d907e){return new BPromise(function(_0x243abf,_0x212b2b){return client['request'](_0x4d8d78,_0x3d907e)[_0x300b('0xd')](function(_0x2eeb2d){logger[_0x300b('0xe')]('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x300b('0xf'));logger[_0x300b('0x10')](_0x300b('0x11'),_0x42e5a5,_0x300b('0xf'),JSON[_0x300b('0x12')](_0x2eeb2d));if(_0x2eeb2d[_0x300b('0x13')]){if(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x14')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x42e5a5,_0x2eeb2d['error']['message']);return _0x212b2b(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x2eeb2d['error']['message']);return _0x243abf(_0x2eeb2d[_0x300b('0x13')][_0x300b('0x15')]);}else{logger[_0x300b('0xe')](_0x300b('0x16'),_0x42e5a5,'request\x20sent');_0x243abf(_0x2eeb2d[_0x300b('0x17')][_0x300b('0x15')]);}})[_0x300b('0x18')](function(_0x5cba7c){logger[_0x300b('0x13')](_0x300b('0x16'),_0x42e5a5,_0x5cba7c);_0x212b2b(_0x5cba7c);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 05b9412..26c38ef 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 _0xc91b=['save','remove','update','emit','removeListener','length','openchannelAccount:','./openchannelAccount.events'];(function(_0x51cc1d,_0xaa88ae){var _0x2eb9f2=function(_0x1ca525){while(--_0x1ca525){_0x51cc1d['push'](_0x51cc1d['shift']());}};_0x2eb9f2(++_0xaa88ae);}(_0xc91b,0x16f));var _0xbc91=function(_0x4dc244,_0x3c19d0){_0x4dc244=_0x4dc244-0x0;var _0x42e7ae=_0xc91b[_0x4dc244];return _0x42e7ae;};'use strict';var OpenchannelAccountEvents=require(_0xbc91('0x0'));var events=[_0xbc91('0x1'),_0xbc91('0x2'),_0xbc91('0x3')];function createListener(_0x2a5f39,_0xb4810d){return function(_0x1ac340){_0xb4810d[_0xbc91('0x4')](_0x2a5f39,_0x1ac340);};}function removeListener(_0x5e8e01,_0x38fe3a){return function(){OpenchannelAccountEvents[_0xbc91('0x5')](_0x5e8e01,_0x38fe3a);};}exports['register']=function(_0x222ed7){for(var _0x1e295b=0x0,_0x535cb9=events[_0xbc91('0x6')];_0x1e295b<_0x535cb9;_0x1e295b++){var _0x43731a=events[_0x1e295b];var _0x36e15f=createListener(_0xbc91('0x7')+_0x43731a,_0x222ed7);OpenchannelAccountEvents['on'](_0x43731a,_0x36e15f);}}; \ No newline at end of file +var _0x9780=['update','emit','removeListener','register','length','openchannelAccount:','remove'];(function(_0x24774f,_0x4b98ff){var _0x404657=function(_0x1eed6d){while(--_0x1eed6d){_0x24774f['push'](_0x24774f['shift']());}};_0x404657(++_0x4b98ff);}(_0x9780,0x1d4));var _0x0978=function(_0x1d20ba,_0x5425bf){_0x1d20ba=_0x1d20ba-0x0;var _0x347f2a=_0x9780[_0x1d20ba];return _0x347f2a;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=['save',_0x0978('0x0'),_0x0978('0x1')];function createListener(_0x2b231c,_0x40b85f){return function(_0x30a2b7){_0x40b85f[_0x0978('0x2')](_0x2b231c,_0x30a2b7);};}function removeListener(_0x173398,_0x1e1969){return function(){OpenchannelAccountEvents[_0x0978('0x3')](_0x173398,_0x1e1969);};}exports[_0x0978('0x4')]=function(_0x21b165){for(var _0x5bb746=0x0,_0x422038=events[_0x0978('0x5')];_0x5bb746<_0x422038;_0x5bb746++){var _0x3e4d16=events[_0x5bb746];var _0xefd03b=createListener(_0x0978('0x6')+_0x3e4d16,_0x21b165);OpenchannelAccountEvents['on'](_0x3e4d16,_0xefd03b);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 6adab7e..c3d5744 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 _0x8d29=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','create','put','/:id','update'];(function(_0x57b540,_0x5eb3da){var _0x412e0f=function(_0x1a2bc4){while(--_0x1a2bc4){_0x57b540['push'](_0x57b540['shift']());}};_0x412e0f(++_0x5eb3da);}(_0x8d29,0x16c));var _0x98d2=function(_0x46b638,_0x4d784d){_0x46b638=_0x46b638-0x0;var _0x45a09d=_0x8d29[_0x46b638];return _0x45a09d;};'use strict';var multer=require('multer');var util=require(_0x98d2('0x0'));var path=require(_0x98d2('0x1'));var timeout=require(_0x98d2('0x2'));var express=require(_0x98d2('0x3'));var router=express[_0x98d2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x98d2('0x5'));var interaction=require(_0x98d2('0x6'));var config=require(_0x98d2('0x7'));var controller=require(_0x98d2('0x8'));router[_0x98d2('0x9')]('/',auth[_0x98d2('0xa')](),controller[_0x98d2('0xb')]);router[_0x98d2('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x98d2('0xa')](),controller[_0x98d2('0xc')]);router[_0x98d2('0xd')](_0x98d2('0xe'),auth[_0x98d2('0xa')](),controller[_0x98d2('0xf')]);router[_0x98d2('0x10')](_0x98d2('0xe'),auth[_0x98d2('0xa')](),controller[_0x98d2('0x11')]);module[_0x98d2('0x12')]=router; \ No newline at end of file +var _0xb0b1=['isAuthenticated','index','/:id','create','update','destroy','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb0b1,0xba));var _0x1b0b=function(_0x1b04da,_0x39afef){_0x1b04da=_0x1b04da-0x0;var _0x17af6b=_0xb0b1[_0x1b04da];return _0x17af6b;};'use strict';var multer=require('multer');var util=require(_0x1b0b('0x0'));var path=require('path');var timeout=require(_0x1b0b('0x1'));var express=require(_0x1b0b('0x2'));var router=express['Router']();var fs_extra=require(_0x1b0b('0x3'));var auth=require(_0x1b0b('0x4'));var interaction=require(_0x1b0b('0x5'));var config=require(_0x1b0b('0x6'));var controller=require(_0x1b0b('0x7'));router[_0x1b0b('0x8')]('/',auth[_0x1b0b('0x9')](),controller[_0x1b0b('0xa')]);router['get'](_0x1b0b('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x1b0b('0xc')]);router['put']('/:id',auth[_0x1b0b('0x9')](),controller[_0x1b0b('0xd')]);router['delete'](_0x1b0b('0xb'),auth[_0x1b0b('0x9')](),controller[_0x1b0b('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 69dd6c3..2e47f16 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 _0x49c8=['exports','INTEGER','STRING','noop','*,*,*,*','sequelize'];(function(_0x1ba0a4,_0xf4dc80){var _0x561400=function(_0x54f3ef){while(--_0x54f3ef){_0x1ba0a4['push'](_0x1ba0a4['shift']());}};_0x561400(++_0xf4dc80);}(_0x49c8,0x14f));var _0x849c=function(_0x3cbbe0,_0x3a0614){_0x3cbbe0=_0x3cbbe0-0x0;var _0xb72693=_0x49c8[_0x3cbbe0];return _0xb72693;};'use strict';var Sequelize=require(_0x849c('0x0'));module[_0x849c('0x1')]={'priority':{'type':Sequelize[_0x849c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x849c('0x3')],'allowNull':![],'defaultValue':_0x849c('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x849c('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x849c('0x5')}}; \ No newline at end of file +var _0x410c=['exports','INTEGER','noop','TEXT','STRING'];(function(_0x6646c2,_0x142a02){var _0x18c158=function(_0x9bbbe5){while(--_0x9bbbe5){_0x6646c2['push'](_0x6646c2['shift']());}};_0x18c158(++_0x142a02);}(_0x410c,0x18b));var _0xc410=function(_0x2e691d,_0x4c56b6){_0x2e691d=_0x2e691d-0x0;var _0x3ad4da=_0x410c[_0x2e691d];return _0x3ad4da;};'use strict';var Sequelize=require('sequelize');module[_0xc410('0x0')]={'priority':{'type':Sequelize[_0xc410('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc410('0x2')},'appdata':{'type':Sequelize[_0xc410('0x3')]()},'description':{'type':Sequelize[_0xc410('0x4')]},'interval':{'type':Sequelize[_0xc410('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 02a93bd..ea5a7ec 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 _0xa49a=['sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','rawAttributes','catch','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','undefined','limit','count','offset','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','map','OpenchannelApplication','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa49a,0x139));var _0xaa49=function(_0x1f7521,_0x1d41f7){_0x1f7521=_0x1f7521-0x0;var _0x42b163=_0xa49a[_0x1f7521];return _0x42b163;};'use strict';var emlformat=require(_0xaa49('0x0'));var rimraf=require(_0xaa49('0x1'));var zipdir=require(_0xaa49('0x2'));var jsonpatch=require(_0xaa49('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xaa49('0x4'));var Mustache=require(_0xaa49('0x5'));var util=require('util');var path=require(_0xaa49('0x6'));var sox=require(_0xaa49('0x7'));var csv=require(_0xaa49('0x8'));var ejs=require(_0xaa49('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa49('0xa'));var squel=require(_0xaa49('0xb'));var crypto=require(_0xaa49('0xc'));var jsforce=require(_0xaa49('0xd'));var deskjs=require(_0xaa49('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xaa49('0xf'));var authService=require(_0xaa49('0x10'));var qs=require(_0xaa49('0x11'));var as=require(_0xaa49('0x12'));var hardwareService=require(_0xaa49('0x13'));var logger=require(_0xaa49('0x14'))(_0xaa49('0x15'));var utils=require(_0xaa49('0x16'));var config=require(_0xaa49('0x17'));var licenseUtil=require(_0xaa49('0x18'));var db=require(_0xaa49('0x19'))['db'];function respondWithStatusCode(_0x5527b3,_0x404041){_0x404041=_0x404041||0xcc;return function(_0x151147){if(_0x151147){return _0x5527b3['sendStatus'](_0x404041);}return _0x5527b3['status'](_0x404041)[_0xaa49('0x1a')]();};}function respondWithResult(_0x43c6b4,_0x198365){_0x198365=_0x198365||0xc8;return function(_0x497633){if(_0x497633){return _0x43c6b4[_0xaa49('0x1b')](_0x198365)['json'](_0x497633);}};}function respondWithFilteredResult(_0x5e067b,_0x11ec7b){return function(_0x27a98e){if(_0x27a98e){var _0x144a6d=typeof _0x11ec7b['offset']===_0xaa49('0x1c')&&typeof _0x11ec7b[_0xaa49('0x1d')]===_0xaa49('0x1c');var _0x5f4140=_0x27a98e[_0xaa49('0x1e')];var _0x4fa190=_0x144a6d?0x0:_0x11ec7b[_0xaa49('0x1f')];var _0x22bea9=_0x144a6d?_0x27a98e[_0xaa49('0x1e')]:_0x11ec7b[_0xaa49('0x1f')]+_0x11ec7b['limit'];var _0x13d8fe;if(_0x22bea9>=_0x5f4140){_0x22bea9=_0x5f4140;_0x13d8fe=0xc8;}else{_0x13d8fe=0xce;}_0x5e067b['status'](_0x13d8fe);return _0x5e067b['set'](_0xaa49('0x20'),_0x4fa190+'-'+_0x22bea9+'/'+_0x5f4140)[_0xaa49('0x21')](_0x27a98e);}return null;};}function patchUpdates(_0x3ce0aa){return function(_0x45aba9){try{jsonpatch['apply'](_0x45aba9,_0x3ce0aa,!![]);}catch(_0x3d7e18){return BPromise[_0xaa49('0x22')](_0x3d7e18);}return _0x45aba9[_0xaa49('0x23')]();};}function saveUpdates(_0x876141,_0x198e29){return function(_0x24a2f8){if(_0x24a2f8){return _0x24a2f8[_0xaa49('0x24')](_0x876141)['then'](function(_0x3c4c1d){return _0x3c4c1d;});}return null;};}function removeEntity(_0x35c3d4,_0x3d73a2){return function(_0x3f9428){if(_0x3f9428){return _0x3f9428[_0xaa49('0x25')]()[_0xaa49('0x26')](function(){_0x35c3d4[_0xaa49('0x1b')](0xcc)[_0xaa49('0x1a')]();});}};}function handleEntityNotFound(_0x5f1b69,_0x5d2b57){return function(_0x465993){if(!_0x465993){_0x5f1b69['sendStatus'](0x194);}return _0x465993;};}function handleError(_0x4ae9a0,_0x4802b5){_0x4802b5=_0x4802b5||0x1f4;return function(_0x24249f){logger[_0xaa49('0x27')](_0x24249f[_0xaa49('0x28')]);if(_0x24249f[_0xaa49('0x29')]){delete _0x24249f[_0xaa49('0x29')];}_0x4ae9a0[_0xaa49('0x1b')](_0x4802b5)[_0xaa49('0x2a')](_0x24249f);};}exports['index']=function(_0x342fc2,_0x4abb63){var _0x44b90c={},_0x4d7154={},_0x12e7d2={'count':0x0,'rows':[]};var _0x5e177b=_[_0xaa49('0x2b')](db[_0xaa49('0x2c')]['rawAttributes'],function(_0x3d276c){return{'name':_0x3d276c['fieldName'],'type':_0x3d276c[_0xaa49('0x2d')][_0xaa49('0x2e')]};});_0x4d7154[_0xaa49('0x2f')]=_[_0xaa49('0x2b')](_0x5e177b,_0xaa49('0x29'));_0x4d7154[_0xaa49('0x30')]=_['keys'](_0x342fc2[_0xaa49('0x30')]);_0x4d7154[_0xaa49('0x31')]=_[_0xaa49('0x32')](_0x4d7154['model'],_0x4d7154['query']);_0x44b90c[_0xaa49('0x33')]=_[_0xaa49('0x32')](_0x4d7154[_0xaa49('0x2f')],qs[_0xaa49('0x34')](_0x342fc2['query'][_0xaa49('0x34')]));_0x44b90c['attributes']=_0x44b90c['attributes'][_0xaa49('0x35')]?_0x44b90c[_0xaa49('0x33')]:_0x4d7154[_0xaa49('0x2f')];if(!_0x342fc2[_0xaa49('0x30')][_0xaa49('0x36')](_0xaa49('0x37'))){_0x44b90c[_0xaa49('0x1d')]=qs[_0xaa49('0x1d')](_0x342fc2[_0xaa49('0x30')][_0xaa49('0x1d')]);_0x44b90c[_0xaa49('0x1f')]=qs[_0xaa49('0x1f')](_0x342fc2['query'][_0xaa49('0x1f')]);}_0x44b90c[_0xaa49('0x38')]=qs[_0xaa49('0x39')](_0x342fc2[_0xaa49('0x30')][_0xaa49('0x39')]);_0x44b90c[_0xaa49('0x3a')]=qs[_0xaa49('0x31')](_[_0xaa49('0x3b')](_0x342fc2[_0xaa49('0x30')],_0x4d7154[_0xaa49('0x31')]),_0x5e177b);if(_0x342fc2[_0xaa49('0x30')]['filter']){_0x44b90c[_0xaa49('0x3a')]=_[_0xaa49('0x3c')](_0x44b90c[_0xaa49('0x3a')],{'$or':_[_0xaa49('0x2b')](_0x5e177b,function(_0x592b53){if(_0x592b53['type']!==_0xaa49('0x3d')){var _0x3468eb={};_0x3468eb[_0x592b53[_0xaa49('0x29')]]={'$like':'%'+_0x342fc2[_0xaa49('0x30')]['filter']+'%'};return _0x3468eb;}})});}_0x44b90c=_['merge']({},_0x44b90c,_0x342fc2[_0xaa49('0x3e')]);var _0x4de4cc={'where':_0x44b90c['where']};return db['OpenchannelApplication']['count'](_0x4de4cc)[_0xaa49('0x26')](function(_0xebddcf){_0x12e7d2[_0xaa49('0x1e')]=_0xebddcf;if(_0x342fc2['query'][_0xaa49('0x3f')]){_0x44b90c[_0xaa49('0x40')]=[{'all':!![]}];}return db[_0xaa49('0x2c')]['findAll'](_0x44b90c);})['then'](function(_0x150986){_0x12e7d2[_0xaa49('0x41')]=_0x150986;return _0x12e7d2;})[_0xaa49('0x26')](respondWithFilteredResult(_0x4abb63,_0x44b90c))['catch'](handleError(_0x4abb63,null));};exports[_0xaa49('0x42')]=function(_0x1c91b9,_0x432db9){var _0x454008={'raw':!![],'where':{'id':_0x1c91b9[_0xaa49('0x43')]['id']}},_0x200052={};_0x200052[_0xaa49('0x2f')]=_[_0xaa49('0x44')](db[_0xaa49('0x2c')][_0xaa49('0x45')]);_0x200052['query']=_[_0xaa49('0x44')](_0x1c91b9[_0xaa49('0x30')]);_0x200052['filters']=_[_0xaa49('0x32')](_0x200052[_0xaa49('0x2f')],_0x200052[_0xaa49('0x30')]);_0x454008[_0xaa49('0x33')]=_[_0xaa49('0x32')](_0x200052[_0xaa49('0x2f')],qs[_0xaa49('0x34')](_0x1c91b9['query']['fields']));_0x454008[_0xaa49('0x33')]=_0x454008[_0xaa49('0x33')][_0xaa49('0x35')]?_0x454008['attributes']:_0x200052['model'];if(_0x1c91b9[_0xaa49('0x30')][_0xaa49('0x3f')]){_0x454008['include']=[{'all':!![]}];}_0x454008=_[_0xaa49('0x3c')]({},_0x454008,_0x1c91b9[_0xaa49('0x3e')]);return db[_0xaa49('0x2c')]['find'](_0x454008)['then'](handleEntityNotFound(_0x432db9,null))[_0xaa49('0x26')](respondWithResult(_0x432db9,null))[_0xaa49('0x46')](handleError(_0x432db9,null));};exports['create']=function(_0x111285,_0x157df0){return db[_0xaa49('0x2c')][_0xaa49('0x47')](_0x111285[_0xaa49('0x48')],{})['then'](respondWithResult(_0x157df0,0xc9))[_0xaa49('0x46')](handleError(_0x157df0,null));};exports[_0xaa49('0x24')]=function(_0x9c7104,_0xf3425c){if(_0x9c7104['body']['id']){delete _0x9c7104['body']['id'];}return db[_0xaa49('0x2c')][_0xaa49('0x49')]({'where':{'id':_0x9c7104[_0xaa49('0x43')]['id']}})[_0xaa49('0x26')](handleEntityNotFound(_0xf3425c,null))[_0xaa49('0x26')](saveUpdates(_0x9c7104[_0xaa49('0x48')],null))[_0xaa49('0x26')](respondWithResult(_0xf3425c,null))[_0xaa49('0x46')](handleError(_0xf3425c,null));};exports[_0xaa49('0x25')]=function(_0x1cd053,_0x2159a3){return db[_0xaa49('0x2c')][_0xaa49('0x49')]({'where':{'id':_0x1cd053[_0xaa49('0x43')]['id']}})[_0xaa49('0x26')](handleEntityNotFound(_0x2159a3,null))['then'](removeEntity(_0x2159a3,null))['catch'](handleError(_0x2159a3,null));}; \ No newline at end of file +var _0x5408=['includeAll','include','rows','catch','show','keys','rawAttributes','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','send','index','map','OpenchannelApplication','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options'];(function(_0x72222d,_0x270476){var _0x36a7f8=function(_0x532910){while(--_0x532910){_0x72222d['push'](_0x72222d['shift']());}};_0x36a7f8(++_0x270476);}(_0x5408,0x13c));var _0x8540=function(_0x20bc66,_0x2aef37){_0x20bc66=_0x20bc66-0x0;var _0x3c1b3c=_0x5408[_0x20bc66];return _0x3c1b3c;};'use strict';var emlformat=require(_0x8540('0x0'));var rimraf=require(_0x8540('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8540('0x2'));var rp=require(_0x8540('0x3'));var moment=require(_0x8540('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8540('0x5'));var util=require(_0x8540('0x6'));var path=require(_0x8540('0x7'));var sox=require(_0x8540('0x8'));var csv=require(_0x8540('0x9'));var ejs=require(_0x8540('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8540('0xb'));var squel=require(_0x8540('0xc'));var crypto=require(_0x8540('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8540('0xe'));var toCsv=require(_0x8540('0x9'));var querystring=require(_0x8540('0xf'));var Papa=require(_0x8540('0x10'));var Redis=require('ioredis');var authService=require(_0x8540('0x11'));var qs=require(_0x8540('0x12'));var as=require(_0x8540('0x13'));var hardwareService=require(_0x8540('0x14'));var logger=require(_0x8540('0x15'))('api');var utils=require(_0x8540('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8540('0x17'));var db=require(_0x8540('0x18'))['db'];function respondWithStatusCode(_0x28eb70,_0xe04f2c){_0xe04f2c=_0xe04f2c||0xcc;return function(_0x45c68b){if(_0x45c68b){return _0x28eb70['sendStatus'](_0xe04f2c);}return _0x28eb70[_0x8540('0x19')](_0xe04f2c)[_0x8540('0x1a')]();};}function respondWithResult(_0x230b20,_0x292b3e){_0x292b3e=_0x292b3e||0xc8;return function(_0x9bf58){if(_0x9bf58){return _0x230b20[_0x8540('0x19')](_0x292b3e)[_0x8540('0x1b')](_0x9bf58);}};}function respondWithFilteredResult(_0x807591,_0x56675e){return function(_0x62fa07){if(_0x62fa07){var _0x5ad1a2=typeof _0x56675e[_0x8540('0x1c')]===_0x8540('0x1d')&&typeof _0x56675e['limit']===_0x8540('0x1d');var _0x5bc1f1=_0x62fa07['count'];var _0x33a39c=_0x5ad1a2?0x0:_0x56675e[_0x8540('0x1c')];var _0x1c14f7=_0x5ad1a2?_0x62fa07[_0x8540('0x1e')]:_0x56675e[_0x8540('0x1c')]+_0x56675e['limit'];var _0x1d85fe;if(_0x1c14f7>=_0x5bc1f1){_0x1c14f7=_0x5bc1f1;_0x1d85fe=0xc8;}else{_0x1d85fe=0xce;}_0x807591[_0x8540('0x19')](_0x1d85fe);return _0x807591[_0x8540('0x1f')](_0x8540('0x20'),_0x33a39c+'-'+_0x1c14f7+'/'+_0x5bc1f1)[_0x8540('0x1b')](_0x62fa07);}return null;};}function patchUpdates(_0x2b38e9){return function(_0x4447b7){try{jsonpatch[_0x8540('0x21')](_0x4447b7,_0x2b38e9,!![]);}catch(_0x5b70f6){return BPromise[_0x8540('0x22')](_0x5b70f6);}return _0x4447b7['save']();};}function saveUpdates(_0x1c4ac5,_0x1986e1){return function(_0x4d2029){if(_0x4d2029){return _0x4d2029['update'](_0x1c4ac5)['then'](function(_0x159127){return _0x159127;});}return null;};}function removeEntity(_0x3710d8,_0x26c1db){return function(_0x2425c8){if(_0x2425c8){return _0x2425c8[_0x8540('0x23')]()[_0x8540('0x24')](function(){_0x3710d8[_0x8540('0x19')](0xcc)[_0x8540('0x1a')]();});}};}function handleEntityNotFound(_0x177dc5,_0x2e2ba5){return function(_0x1957d5){if(!_0x1957d5){_0x177dc5[_0x8540('0x25')](0x194);}return _0x1957d5;};}function handleError(_0xa2f855,_0x53c6a2){_0x53c6a2=_0x53c6a2||0x1f4;return function(_0x5dbe87){logger[_0x8540('0x26')](_0x5dbe87[_0x8540('0x27')]);if(_0x5dbe87[_0x8540('0x28')]){delete _0x5dbe87[_0x8540('0x28')];}_0xa2f855[_0x8540('0x19')](_0x53c6a2)[_0x8540('0x29')](_0x5dbe87);};}exports[_0x8540('0x2a')]=function(_0x153104,_0x143520){var _0x139a1e={},_0x2b638f={},_0x654eeb={'count':0x0,'rows':[]};var _0x2b6a97=_[_0x8540('0x2b')](db[_0x8540('0x2c')]['rawAttributes'],function(_0xbcd46c){return{'name':_0xbcd46c['fieldName'],'type':_0xbcd46c[_0x8540('0x2d')]['key']};});_0x2b638f[_0x8540('0x2e')]=_[_0x8540('0x2b')](_0x2b6a97,_0x8540('0x28'));_0x2b638f[_0x8540('0x2f')]=_['keys'](_0x153104[_0x8540('0x2f')]);_0x2b638f['filters']=_[_0x8540('0x30')](_0x2b638f[_0x8540('0x2e')],_0x2b638f['query']);_0x139a1e[_0x8540('0x31')]=_[_0x8540('0x30')](_0x2b638f[_0x8540('0x2e')],qs[_0x8540('0x32')](_0x153104[_0x8540('0x2f')]['fields']));_0x139a1e['attributes']=_0x139a1e[_0x8540('0x31')][_0x8540('0x33')]?_0x139a1e[_0x8540('0x31')]:_0x2b638f[_0x8540('0x2e')];if(!_0x153104['query'][_0x8540('0x34')](_0x8540('0x35'))){_0x139a1e[_0x8540('0x36')]=qs['limit'](_0x153104[_0x8540('0x2f')][_0x8540('0x36')]);_0x139a1e[_0x8540('0x1c')]=qs[_0x8540('0x1c')](_0x153104[_0x8540('0x2f')][_0x8540('0x1c')]);}_0x139a1e[_0x8540('0x37')]=qs[_0x8540('0x38')](_0x153104['query'][_0x8540('0x38')]);_0x139a1e[_0x8540('0x39')]=qs[_0x8540('0x3a')](_[_0x8540('0x3b')](_0x153104[_0x8540('0x2f')],_0x2b638f[_0x8540('0x3a')]),_0x2b6a97);if(_0x153104[_0x8540('0x2f')][_0x8540('0x3c')]){_0x139a1e[_0x8540('0x39')]=_['merge'](_0x139a1e[_0x8540('0x39')],{'$or':_[_0x8540('0x2b')](_0x2b6a97,function(_0x5efa27){if(_0x5efa27['type']!==_0x8540('0x3d')){var _0x17e974={};_0x17e974[_0x5efa27['name']]={'$like':'%'+_0x153104[_0x8540('0x2f')]['filter']+'%'};return _0x17e974;}})});}_0x139a1e=_[_0x8540('0x3e')]({},_0x139a1e,_0x153104[_0x8540('0x3f')]);var _0x19a30d={'where':_0x139a1e[_0x8540('0x39')]};return db['OpenchannelApplication'][_0x8540('0x1e')](_0x19a30d)['then'](function(_0x3b58f7){_0x654eeb[_0x8540('0x1e')]=_0x3b58f7;if(_0x153104[_0x8540('0x2f')][_0x8540('0x40')]){_0x139a1e[_0x8540('0x41')]=[{'all':!![]}];}return db[_0x8540('0x2c')]['findAll'](_0x139a1e);})['then'](function(_0x4375d7){_0x654eeb[_0x8540('0x42')]=_0x4375d7;return _0x654eeb;})[_0x8540('0x24')](respondWithFilteredResult(_0x143520,_0x139a1e))[_0x8540('0x43')](handleError(_0x143520,null));};exports[_0x8540('0x44')]=function(_0x45a9fd,_0x86aa25){var _0xddca96={'raw':!![],'where':{'id':_0x45a9fd['params']['id']}},_0x3cc126={};_0x3cc126['model']=_[_0x8540('0x45')](db[_0x8540('0x2c')][_0x8540('0x46')]);_0x3cc126['query']=_[_0x8540('0x45')](_0x45a9fd[_0x8540('0x2f')]);_0x3cc126[_0x8540('0x3a')]=_[_0x8540('0x30')](_0x3cc126[_0x8540('0x2e')],_0x3cc126[_0x8540('0x2f')]);_0xddca96['attributes']=_[_0x8540('0x30')](_0x3cc126[_0x8540('0x2e')],qs[_0x8540('0x32')](_0x45a9fd['query'][_0x8540('0x32')]));_0xddca96['attributes']=_0xddca96[_0x8540('0x31')][_0x8540('0x33')]?_0xddca96[_0x8540('0x31')]:_0x3cc126[_0x8540('0x2e')];if(_0x45a9fd[_0x8540('0x2f')][_0x8540('0x40')]){_0xddca96['include']=[{'all':!![]}];}_0xddca96=_[_0x8540('0x3e')]({},_0xddca96,_0x45a9fd[_0x8540('0x3f')]);return db[_0x8540('0x2c')][_0x8540('0x47')](_0xddca96)['then'](handleEntityNotFound(_0x86aa25,null))[_0x8540('0x24')](respondWithResult(_0x86aa25,null))[_0x8540('0x43')](handleError(_0x86aa25,null));};exports[_0x8540('0x48')]=function(_0x2cd208,_0xc18754){return db[_0x8540('0x2c')][_0x8540('0x48')](_0x2cd208[_0x8540('0x49')],{})[_0x8540('0x24')](respondWithResult(_0xc18754,0xc9))['catch'](handleError(_0xc18754,null));};exports[_0x8540('0x4a')]=function(_0x474f96,_0x420181){if(_0x474f96[_0x8540('0x49')]['id']){delete _0x474f96[_0x8540('0x49')]['id'];}return db['OpenchannelApplication'][_0x8540('0x47')]({'where':{'id':_0x474f96[_0x8540('0x4b')]['id']}})[_0x8540('0x24')](handleEntityNotFound(_0x420181,null))['then'](saveUpdates(_0x474f96[_0x8540('0x49')],null))[_0x8540('0x24')](respondWithResult(_0x420181,null))[_0x8540('0x43')](handleError(_0x420181,null));};exports[_0x8540('0x23')]=function(_0x2aa7c4,_0x38790c){return db[_0x8540('0x2c')][_0x8540('0x47')]({'where':{'id':_0x2aa7c4['params']['id']}})['then'](handleEntityNotFound(_0x38790c,null))[_0x8540('0x24')](removeEntity(_0x38790c,null))[_0x8540('0x43')](handleError(_0x38790c,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 16664a0..0decc69 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 _0x4147=['exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./openchannelApplication.attributes'];(function(_0x35d211,_0x4fbae4){var _0x3b0892=function(_0x452b6f){while(--_0x452b6f){_0x35d211['push'](_0x35d211['shift']());}};_0x3b0892(++_0x4fbae4);}(_0x4147,0xf4));var _0x7414=function(_0x12010d,_0x43e72c){_0x12010d=_0x12010d-0x0;var _0xcc8c1c=_0x4147[_0x12010d];return _0xcc8c1c;};'use strict';var _=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var logger=require(_0x7414('0x2'))('api');var moment=require(_0x7414('0x3'));var BPromise=require(_0x7414('0x4'));var rp=require(_0x7414('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7414('0x6'));var config=require('../../config/environment');var attributes=require(_0x7414('0x7'));module[_0x7414('0x8')]=function(_0x4afb14,_0x2e66af){return _0x4afb14[_0x7414('0x9')](_0x7414('0xa'),attributes,{'tableName':_0x7414('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7414('0xc'),'collate':_0x7414('0xd')});}; \ No newline at end of file +var _0x0d29=['path','rimraf','../../config/environment','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','api','moment','request-promise'];(function(_0xe0f6f9,_0x13c46e){var _0x339214=function(_0x31fcfb){while(--_0x31fcfb){_0xe0f6f9['push'](_0xe0f6f9['shift']());}};_0x339214(++_0x13c46e);}(_0x0d29,0x1b9));var _0x90d2=function(_0x22dd0e,_0x18ac72){_0x22dd0e=_0x22dd0e-0x0;var _0x41b401=_0x0d29[_0x22dd0e];return _0x41b401;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x90d2('0x0'));var moment=require(_0x90d2('0x1'));var BPromise=require('bluebird');var rp=require(_0x90d2('0x2'));var fs=require('fs');var path=require(_0x90d2('0x3'));var rimraf=require(_0x90d2('0x4'));var config=require(_0x90d2('0x5'));var attributes=require('./openchannelApplication.attributes');module[_0x90d2('0x6')]=function(_0x11de82,_0xec35e0){return _0x11de82[_0x90d2('0x7')](_0x90d2('0x8'),attributes,{'tableName':_0x90d2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x90d2('0xa'),'collate':_0x90d2('0xb')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 753ef73..f4cc20a 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 _0xae0c=['options','raw','attributes','then','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','update','body'];(function(_0x323d3a,_0x325482){var _0x24847a=function(_0x9b0376){while(--_0x9b0376){_0x323d3a['push'](_0x323d3a['shift']());}};_0x24847a(++_0x325482);}(_0xae0c,0xec));var _0xcae0=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xae0c[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xcae0('0x0'));var util=require(_0xcae0('0x1'));var moment=require(_0xcae0('0x2'));var BPromise=require(_0xcae0('0x3'));var rs=require(_0xcae0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcae0('0x5'));var logger=require(_0xcae0('0x6'))('rpc');var config=require(_0xcae0('0x7'));var jayson=require(_0xcae0('0x8'));var client=jayson[_0xcae0('0x9')][_0xcae0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27853a,_0x6754f7,_0x42c0c4){return new BPromise(function(_0x33ae1b,_0x5843ab){return client[_0xcae0('0xb')](_0x27853a,_0x42c0c4)['then'](function(_0xfb11df){logger[_0xcae0('0xc')](_0xcae0('0xd'),_0x6754f7,_0xcae0('0xe'));logger[_0xcae0('0xf')](_0xcae0('0x10'),_0x6754f7,_0xcae0('0xe'),JSON[_0xcae0('0x11')](_0xfb11df));if(_0xfb11df[_0xcae0('0x12')]){if(_0xfb11df[_0xcae0('0x12')]['code']===0x1f4){logger['error'](_0xcae0('0xd'),_0x6754f7,_0xfb11df['error'][_0xcae0('0x13')]);return _0x5843ab(_0xfb11df[_0xcae0('0x12')][_0xcae0('0x13')]);}logger[_0xcae0('0x12')]('OpenchannelApplication,\x20%s,\x20%s',_0x6754f7,_0xfb11df[_0xcae0('0x12')][_0xcae0('0x13')]);return _0x33ae1b(_0xfb11df[_0xcae0('0x12')][_0xcae0('0x13')]);}else{logger['info'](_0xcae0('0xd'),_0x6754f7,_0xcae0('0xe'));_0x33ae1b(_0xfb11df[_0xcae0('0x14')][_0xcae0('0x13')]);}})[_0xcae0('0x15')](function(_0x2c32cd){logger['error'](_0xcae0('0xd'),_0x6754f7,_0x2c32cd);_0x5843ab(_0x2c32cd);});});}exports[_0xcae0('0x16')]=function(_0x3ef191){var _0x5482bb=this;return new Promise(function(_0x574da6,_0x11d284){return db['OpenchannelApplication'][_0xcae0('0x17')](_0x3ef191[_0xcae0('0x18')],{'raw':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')][_0xcae0('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')]['where']||null:null,'attributes':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')][_0xcae0('0x1b')]||null:null,'limit':_0x3ef191[_0xcae0('0x19')]?_0x3ef191[_0xcae0('0x19')]['limit']||null:null})[_0xcae0('0x1c')](function(_0x4b892b){logger[_0xcae0('0xc')](_0xcae0('0x16'),_0x3ef191);logger[_0xcae0('0xf')]('UpdateOpenchannelApplication',_0x3ef191,JSON['stringify'](_0x4b892b));_0x574da6(_0x4b892b);})['catch'](function(_0x5dbde2){logger['error'](_0xcae0('0x16'),_0x5dbde2[_0xcae0('0x13')],_0x3ef191);_0x11d284(_0x5482bb[_0xcae0('0x12')](0x1f4,_0x5dbde2[_0xcae0('0x13')]));});});}; \ No newline at end of file +var _0x93ee=['client','http','request','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','attributes','limit','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3f3689,_0x155be4){var _0x56c909=function(_0x23e9bb){while(--_0x23e9bb){_0x3f3689['push'](_0x3f3689['shift']());}};_0x56c909(++_0x155be4);}(_0x93ee,0x18e));var _0xe93e=function(_0x2a18b7,_0x5041c8){_0x2a18b7=_0x2a18b7-0x0;var _0x45e74e=_0x93ee[_0x2a18b7];return _0x45e74e;};'use strict';var _=require('lodash');var util=require(_0xe93e('0x0'));var moment=require(_0xe93e('0x1'));var BPromise=require(_0xe93e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe93e('0x3'));var db=require(_0xe93e('0x4'))['db'];var utils=require(_0xe93e('0x5'));var logger=require(_0xe93e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe93e('0x7')][_0xe93e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d76d9,_0x4465f4,_0x54ebe6){return new BPromise(function(_0x21b926,_0x841f10){return client[_0xe93e('0x9')](_0x3d76d9,_0x54ebe6)[_0xe93e('0xa')](function(_0x13b394){logger['info'](_0xe93e('0xb'),_0x4465f4,_0xe93e('0xc'));logger[_0xe93e('0xd')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x4465f4,'request\x20sent',JSON[_0xe93e('0xe')](_0x13b394));if(_0x13b394[_0xe93e('0xf')]){if(_0x13b394[_0xe93e('0xf')][_0xe93e('0x10')]===0x1f4){logger['error'](_0xe93e('0xb'),_0x4465f4,_0x13b394['error']['message']);return _0x841f10(_0x13b394['error']['message']);}logger[_0xe93e('0xf')](_0xe93e('0xb'),_0x4465f4,_0x13b394[_0xe93e('0xf')]['message']);return _0x21b926(_0x13b394[_0xe93e('0xf')][_0xe93e('0x11')]);}else{logger[_0xe93e('0x12')](_0xe93e('0xb'),_0x4465f4,_0xe93e('0xc'));_0x21b926(_0x13b394['result']['message']);}})[_0xe93e('0x13')](function(_0x25aa29){logger[_0xe93e('0xf')](_0xe93e('0xb'),_0x4465f4,_0x25aa29);_0x841f10(_0x25aa29);});});}exports[_0xe93e('0x14')]=function(_0x47b569){var _0xbf37e3=this;return new Promise(function(_0x31c0f5,_0x5a8949){return db[_0xe93e('0x15')][_0xe93e('0x16')](_0x47b569['body'],{'raw':_0x47b569[_0xe93e('0x17')]?_0x47b569['options'][_0xe93e('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x47b569[_0xe93e('0x17')]?_0x47b569[_0xe93e('0x17')]['where']||null:null,'attributes':_0x47b569[_0xe93e('0x17')]?_0x47b569['options'][_0xe93e('0x19')]||null:null,'limit':_0x47b569[_0xe93e('0x17')]?_0x47b569['options'][_0xe93e('0x1a')]||null:null})[_0xe93e('0xa')](function(_0x260d66){logger['info'](_0xe93e('0x14'),_0x47b569);logger[_0xe93e('0xd')](_0xe93e('0x14'),_0x47b569,JSON[_0xe93e('0xe')](_0x260d66));_0x31c0f5(_0x260d66);})[_0xe93e('0x13')](function(_0x5504cd){logger[_0xe93e('0xf')](_0xe93e('0x14'),_0x5504cd[_0xe93e('0x11')],_0x47b569);_0x5a8949(_0xbf37e3[_0xe93e('0xf')](0x1f4,_0x5504cd[_0xe93e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d917c63..a63d514 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 _0xa360=['delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update'];(function(_0x423df1,_0x41a8de){var _0x3d9851=function(_0x5460c6){while(--_0x5460c6){_0x423df1['push'](_0x423df1['shift']());}};_0x3d9851(++_0x41a8de);}(_0xa360,0xed));var _0x0a36=function(_0x3b0490,_0x546412){_0x3b0490=_0x3b0490-0x0;var _0x234faf=_0xa360[_0x3b0490];return _0x234faf;};'use strict';var multer=require('multer');var util=require(_0x0a36('0x0'));var path=require(_0x0a36('0x1'));var timeout=require(_0x0a36('0x2'));var express=require(_0x0a36('0x3'));var router=express[_0x0a36('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0a36('0x5'));var interaction=require(_0x0a36('0x6'));var config=require(_0x0a36('0x7'));var controller=require('./openchannelInteraction.controller');router['get']('/',auth[_0x0a36('0x8')](),controller[_0x0a36('0x9')]);router[_0x0a36('0xa')](_0x0a36('0xb'),auth[_0x0a36('0x8')](),controller[_0x0a36('0xc')]);router['get'](_0x0a36('0xd'),auth[_0x0a36('0x8')](),controller['show']);router[_0x0a36('0xa')](_0x0a36('0xe'),auth[_0x0a36('0x8')](),controller[_0x0a36('0xf')]);router[_0x0a36('0xa')](_0x0a36('0x10'),auth['isAuthenticated'](),controller[_0x0a36('0x11')]);router[_0x0a36('0x12')]('/',auth[_0x0a36('0x8')](),controller[_0x0a36('0x13')]);router['post']('/:id/messages',auth[_0x0a36('0x8')](),controller[_0x0a36('0x14')]);router[_0x0a36('0x12')]('/:id/tags',auth[_0x0a36('0x8')](),interaction[_0x0a36('0x15')](_0x0a36('0x16'),_0x0a36('0x17')),controller[_0x0a36('0x18')]);router[_0x0a36('0x19')](_0x0a36('0xd'),auth[_0x0a36('0x8')](),interaction[_0x0a36('0x15')]('openchannel',_0x0a36('0x1a')),controller['update']);router[_0x0a36('0x1b')]('/:id',auth[_0x0a36('0x8')](),interaction['tracked'](_0x0a36('0x16'),_0x0a36('0x1c')),controller[_0x0a36('0x1d')]);router['delete'](_0x0a36('0x1e'),auth[_0x0a36('0x8')](),controller[_0x0a36('0x1f')]);module[_0x0a36('0x20')]=router; \ No newline at end of file +var _0x3edc=['put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','/:id/tags','removeTags','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','/describe','/:id','show','/:id/messages','getMessages','download','post','create','addMessage','tracked','openchannelinteraction:addtags','addTags'];(function(_0x59eb64,_0x181d19){var _0x2df4b1=function(_0x452d59){while(--_0x452d59){_0x59eb64['push'](_0x59eb64['shift']());}};_0x2df4b1(++_0x181d19);}(_0x3edc,0x19b));var _0xc3ed=function(_0xae6db5,_0x5b81e9){_0xae6db5=_0xae6db5-0x0;var _0x526e3c=_0x3edc[_0xae6db5];return _0x526e3c;};'use strict';var multer=require(_0xc3ed('0x0'));var util=require(_0xc3ed('0x1'));var path=require(_0xc3ed('0x2'));var timeout=require(_0xc3ed('0x3'));var express=require(_0xc3ed('0x4'));var router=express['Router']();var fs_extra=require(_0xc3ed('0x5'));var auth=require(_0xc3ed('0x6'));var interaction=require(_0xc3ed('0x7'));var config=require('../../config/environment');var controller=require(_0xc3ed('0x8'));router[_0xc3ed('0x9')]('/',auth[_0xc3ed('0xa')](),controller['index']);router[_0xc3ed('0x9')](_0xc3ed('0xb'),auth[_0xc3ed('0xa')](),controller['describe']);router[_0xc3ed('0x9')](_0xc3ed('0xc'),auth['isAuthenticated'](),controller[_0xc3ed('0xd')]);router['get'](_0xc3ed('0xe'),auth[_0xc3ed('0xa')](),controller[_0xc3ed('0xf')]);router[_0xc3ed('0x9')]('/:id/download',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x10')]);router[_0xc3ed('0x11')]('/',auth[_0xc3ed('0xa')](),controller[_0xc3ed('0x12')]);router['post'](_0xc3ed('0xe'),auth['isAuthenticated'](),controller[_0xc3ed('0x13')]);router[_0xc3ed('0x11')]('/:id/tags',auth['isAuthenticated'](),interaction[_0xc3ed('0x14')]('openchannel',_0xc3ed('0x15')),controller[_0xc3ed('0x16')]);router[_0xc3ed('0x17')](_0xc3ed('0xc'),auth[_0xc3ed('0xa')](),interaction[_0xc3ed('0x14')]('openchannel',_0xc3ed('0x18')),controller[_0xc3ed('0x19')]);router[_0xc3ed('0x1a')]('/:id',auth[_0xc3ed('0xa')](),interaction[_0xc3ed('0x14')]('openchannel',_0xc3ed('0x1b')),controller[_0xc3ed('0x1c')]);router[_0xc3ed('0x1a')](_0xc3ed('0x1d'),auth['isAuthenticated'](),controller[_0xc3ed('0x1e')]);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 9836295..15d0a40 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 _0x609a=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0xae4f19,_0xab2aee){var _0x2a7b03=function(_0x10647d){while(--_0x10647d){_0xae4f19['push'](_0xae4f19['shift']());}};_0x2a7b03(++_0xab2aee);}(_0x609a,0x1ec));var _0xa609=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x609a[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0xa609('0x0'));module[_0xa609('0x1')]={'closed':{'type':Sequelize[_0xa609('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa609('0x3')]},'disposition':{'type':Sequelize[_0xa609('0x4')]},'secondDisposition':{'type':Sequelize[_0xa609('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xa609('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xa609('0x4')]},'externalUrl':{'type':Sequelize[_0xa609('0x4')]},'lastMsgAt':{'type':Sequelize[_0xa609('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa609('0x5')]('in',_0xa609('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xa609('0x5')]('in',_0xa609('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xa609('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xa609('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa609('0x7')]}}; \ No newline at end of file +var _0x30c7=['STRING','ENUM','out','sequelize','BOOLEAN','DATE'];(function(_0x38b3cb,_0x2b3f46){var _0x145400=function(_0x19c486){while(--_0x19c486){_0x38b3cb['push'](_0x38b3cb['shift']());}};_0x145400(++_0x2b3f46);}(_0x30c7,0x111));var _0x730c=function(_0x55b0b9,_0x151dc3){_0x55b0b9=_0x55b0b9-0x0;var _0x354b7f=_0x30c7[_0x55b0b9];return _0x354b7f;};'use strict';var Sequelize=require(_0x730c('0x0'));module['exports']={'closed':{'type':Sequelize[_0x730c('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x730c('0x2')]},'disposition':{'type':Sequelize[_0x730c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x730c('0x3')]},'note':{'type':Sequelize[_0x730c('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x730c('0x4')]('in',_0x730c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x730c('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x730c('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x730c('0x1')],'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 8d9537b..e216354 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 _0xb642=['createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/parsers/qs','api','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','json','undefined','limit','count','offset','set','update','destroy','then','status','end','error','stack','name','index','rawAttributes','fieldName','type','getOptions','findAll','openchannel','query','user','catch','show','from','params','model','keys','intersection','fields','attributes','length','includeAll','include','merge','options','OpenchannelInteraction','find','create','body','describe','addMessage','OpenchannelMessage','ids','omit','hasOwnProperty','order','sort','filters','pick','where','filter','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','color','emit','openchannelInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','join','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Attachment','Messages','secret','Account','Owner','get','mkdirSync','Openchannel','createdAt','Public','Private','basename','existsSync','createReadStream','createWriteStream','direction','Contact','lastName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x4d7682,_0x373768){var _0x58af3d=function(_0x15aab8){while(--_0x15aab8){_0x4d7682['push'](_0x4d7682['shift']());}};_0x58af3d(++_0x373768);}(_0xb642,0x7f));var _0x2b64=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb642[_0x3054be];return _0x3df150;};'use strict';var rimraf=require(_0x2b64('0x0'));var zipdir=require(_0x2b64('0x1'));var moment=require(_0x2b64('0x2'));var util=require(_0x2b64('0x3'));var path=require(_0x2b64('0x4'));var ejs=require(_0x2b64('0x5'));var fs=require('fs');var _=require(_0x2b64('0x6'));var Redis=require(_0x2b64('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x2b64('0x8'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x2b64('0x9'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x2b64('0xa')]=_['defaults'](config[_0x2b64('0xa')],{'host':_0x2b64('0xb'),'port':0x18eb});var socket=require(_0x2b64('0xc'))(new Redis(config[_0x2b64('0xa')]));require(_0x2b64('0xd'))[_0x2b64('0xe')](socket);function respondWithStatusCode(_0x3fccad,_0x235f74){_0x235f74=_0x235f74||0xcc;return function(_0x4c3cc8){if(_0x4c3cc8){return _0x3fccad[_0x2b64('0xf')](_0x235f74);}return _0x3fccad['status'](_0x235f74)['end']();};}function respondWithResult(_0x2859cc,_0x5a3812){_0x5a3812=_0x5a3812||0xc8;return function(_0x35e43a){if(_0x35e43a){return _0x2859cc['status'](_0x5a3812)[_0x2b64('0x10')](_0x35e43a);}};}function respondWithFilteredResult(_0x17c6e5,_0x3b19f3){return function(_0x37141d){if(_0x37141d){var _0x944586=typeof _0x3b19f3['offset']===_0x2b64('0x11')&&typeof _0x3b19f3[_0x2b64('0x12')]===_0x2b64('0x11');var _0x19c0fe=_0x37141d[_0x2b64('0x13')];var _0x51c642=_0x944586?0x0:_0x3b19f3[_0x2b64('0x14')];var _0x4e56ee=_0x944586?_0x37141d[_0x2b64('0x13')]:_0x3b19f3[_0x2b64('0x14')]+_0x3b19f3['limit'];var _0x11b7ea;if(_0x4e56ee>=_0x19c0fe){_0x4e56ee=_0x19c0fe;_0x11b7ea=0xc8;}else{_0x11b7ea=0xce;}_0x17c6e5['status'](_0x11b7ea);return _0x17c6e5[_0x2b64('0x15')]('Content-Range',_0x51c642+'-'+_0x4e56ee+'/'+_0x19c0fe)[_0x2b64('0x10')](_0x37141d);}return null;};}function saveUpdates(_0x32c7d1){return function(_0x56e833){if(_0x56e833){return _0x56e833[_0x2b64('0x16')](_0x32c7d1)['then'](function(_0x179f66){return _0x179f66;});}return null;};}function removeEntity(_0x762d53){return function(_0x2a400d){if(_0x2a400d){return _0x2a400d[_0x2b64('0x17')]()[_0x2b64('0x18')](function(){_0x762d53[_0x2b64('0x19')](0xcc)[_0x2b64('0x1a')]();});}};}function handleEntityNotFound(_0x2ffadc){return function(_0x4dca3e){if(!_0x4dca3e){_0x2ffadc['sendStatus'](0x194);}return _0x4dca3e;};}function handleError(_0x2c3d55,_0xb99cfc){_0xb99cfc=_0xb99cfc||0x1f4;return function(_0x3c4d68){logger[_0x2b64('0x1b')](_0x3c4d68[_0x2b64('0x1c')]);if(_0x3c4d68[_0x2b64('0x1d')]){delete _0x3c4d68[_0x2b64('0x1d')];}_0x2c3d55[_0x2b64('0x19')](_0xb99cfc)['send'](_0x3c4d68);};}exports[_0x2b64('0x1e')]=function(_0x5e5788,_0x1878b2){var _0x1266e1={};var _0x3e3705=_['map'](db['OpenchannelInteraction'][_0x2b64('0x1f')],function(_0x415406){return{'name':_0x415406[_0x2b64('0x20')],'type':_0x415406[_0x2b64('0x21')]['key']};});_0x1266e1=qs[_0x2b64('0x22')](_0x3e3705,_0x5e5788);return interaction[_0x2b64('0x23')](_0x2b64('0x24'),_0x5e5788[_0x2b64('0x25')],_0x5e5788[_0x2b64('0x26')],_0x1266e1,_0x3e3705)[_0x2b64('0x18')](respondWithFilteredResult(_0x1878b2,_0x1266e1))[_0x2b64('0x27')](handleError(_0x1878b2,null));};exports[_0x2b64('0x28')]=function(_0xcb4cbb,_0x3d04de){var _0x27abd9={};if(_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x21')]&&_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x21')]===_0x2b64('0x29')){_0x27abd9[_0x2b64('0x29')]=_0xcb4cbb[_0x2b64('0x2a')]['id'];}else{_0x27abd9['id']=_0xcb4cbb[_0x2b64('0x2a')]['id'];}var _0x1777de={'raw':![],'where':_0x27abd9},_0x3bbfcd={};_0x3bbfcd[_0x2b64('0x2b')]=_[_0x2b64('0x2c')](db['OpenchannelInteraction'][_0x2b64('0x1f')]);_0x3bbfcd['query']=_[_0x2b64('0x2c')](_0xcb4cbb[_0x2b64('0x25')]);_0x3bbfcd['filters']=_[_0x2b64('0x2d')](_0x3bbfcd[_0x2b64('0x2b')],_0x3bbfcd[_0x2b64('0x25')]);_0x1777de['attributes']=_[_0x2b64('0x2d')](_0x3bbfcd[_0x2b64('0x2b')],qs['fields'](_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x2e')]));_0x1777de[_0x2b64('0x2f')]=_0x1777de[_0x2b64('0x2f')][_0x2b64('0x30')]?_0x1777de[_0x2b64('0x2f')]:_0x3bbfcd[_0x2b64('0x2b')];if(_0xcb4cbb[_0x2b64('0x25')][_0x2b64('0x31')]){_0x1777de[_0x2b64('0x32')]=[{'all':!![]}];}_0x1777de=_[_0x2b64('0x33')]({},_0x1777de,_0xcb4cbb[_0x2b64('0x34')]);return db[_0x2b64('0x35')][_0x2b64('0x36')](_0x1777de)[_0x2b64('0x18')](handleEntityNotFound(_0x3d04de,null))[_0x2b64('0x18')](respondWithResult(_0x3d04de,null))[_0x2b64('0x27')](handleError(_0x3d04de,null));};exports[_0x2b64('0x37')]=function(_0x572ea9,_0x50ea9d){return db[_0x2b64('0x35')]['create'](_0x572ea9['body'],{})[_0x2b64('0x18')](respondWithResult(_0x50ea9d,0xc9))[_0x2b64('0x27')](handleError(_0x50ea9d,null));};exports[_0x2b64('0x16')]=function(_0x3d955b,_0x37d347){if(_0x3d955b['body']['id']){delete _0x3d955b[_0x2b64('0x38')]['id'];}return db[_0x2b64('0x35')]['find']({'where':{'id':_0x3d955b[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x37d347,null))[_0x2b64('0x18')](saveUpdates(_0x3d955b[_0x2b64('0x38')],null))[_0x2b64('0x18')](respondWithResult(_0x37d347,null))[_0x2b64('0x27')](handleError(_0x37d347,null));};exports[_0x2b64('0x17')]=function(_0x581d6d,_0x26a11c){return db[_0x2b64('0x35')][_0x2b64('0x36')]({'where':{'id':_0x581d6d[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x26a11c,null))[_0x2b64('0x18')](removeEntity(_0x26a11c,null))[_0x2b64('0x27')](handleError(_0x26a11c,null));};exports[_0x2b64('0x39')]=function(_0x371635,_0x31bf3e){return db[_0x2b64('0x35')]['describe']()[_0x2b64('0x18')](respondWithResult(_0x31bf3e,null))[_0x2b64('0x27')](handleError(_0x31bf3e,null));};exports[_0x2b64('0x3a')]=function(_0x3b844b,_0x1773fa){return db[_0x2b64('0x3b')][_0x2b64('0x36')]({'where':{'id':_0x3b844b[_0x2b64('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1773fa,null))['then'](function(_0x7b38fe){if(_0x7b38fe){return _0x7b38fe['addMessage'](_0x3b844b[_0x2b64('0x38')][_0x2b64('0x3c')],_[_0x2b64('0x3d')](_0x3b844b[_0x2b64('0x38')],[_0x2b64('0x3c'),'id'])||{});}})['then'](respondWithResult(_0x1773fa,null))[_0x2b64('0x27')](handleError(_0x1773fa,null));};exports['getMessages']=function(_0x3f66a0,_0x319f98){var _0x4e353c={'raw':![],'where':{}};var _0x52e992={};var _0x4d5a81={'count':0x0,'rows':[]};return db[_0x2b64('0x35')]['findOne']({'where':{'id':_0x3f66a0['params']['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x319f98,null))[_0x2b64('0x18')](function(_0x44bed4){if(_0x44bed4){_0x52e992[_0x2b64('0x2b')]=_[_0x2b64('0x2c')](db[_0x2b64('0x3b')][_0x2b64('0x1f')]);_0x52e992[_0x2b64('0x25')]=_['keys'](_0x3f66a0[_0x2b64('0x25')]);_0x52e992['filters']=_['intersection'](_0x52e992[_0x2b64('0x2b')],_0x52e992[_0x2b64('0x25')]);_0x4e353c[_0x2b64('0x2f')]=_[_0x2b64('0x2d')](_0x52e992[_0x2b64('0x2b')],qs['fields'](_0x3f66a0[_0x2b64('0x25')]['fields']));_0x4e353c[_0x2b64('0x2f')]=_0x4e353c[_0x2b64('0x2f')]['length']?_0x4e353c['attributes']:_0x52e992[_0x2b64('0x2b')];if(!_0x3f66a0['query'][_0x2b64('0x3e')]('nolimit')){_0x4e353c[_0x2b64('0x12')]=qs[_0x2b64('0x12')](_0x3f66a0[_0x2b64('0x25')]['limit']);_0x4e353c[_0x2b64('0x14')]=qs[_0x2b64('0x14')](_0x3f66a0[_0x2b64('0x25')][_0x2b64('0x14')]);}_0x4e353c[_0x2b64('0x3f')]=qs[_0x2b64('0x40')](_0x3f66a0['query']['sort']);_0x4e353c['where']=qs[_0x2b64('0x41')](_[_0x2b64('0x42')](_0x3f66a0['query'],_0x52e992[_0x2b64('0x41')]));_0x4e353c[_0x2b64('0x43')]['OpenchannelInteractionId']=_0x44bed4['id'];if(_0x3f66a0[_0x2b64('0x25')][_0x2b64('0x44')]){_0x4e353c[_0x2b64('0x43')]=_['merge'](_0x4e353c[_0x2b64('0x43')],{'$or':_[_0x2b64('0x45')](_0x4e353c[_0x2b64('0x2f')],function(_0x1b1bf8){var _0x4d194d={};_0x4d194d[_0x1b1bf8]={'$like':'%'+_0x3f66a0['query'][_0x2b64('0x44')]+'%'};return _0x4d194d;})});}if(_0x3f66a0[_0x2b64('0x25')]['$gte']){var _0x4c6f9c=_0x3f66a0['query'][_0x2b64('0x46')][_0x2b64('0x47')](',');var _0x591f50={};_0x591f50[_0x4c6f9c[0x0]]={'$gte':moment(_0x4c6f9c[0x1])[_0x2b64('0x48')](_0x2b64('0x49'))};_0x4e353c[_0x2b64('0x43')]=_[_0x2b64('0x33')](_0x4e353c[_0x2b64('0x43')],_0x591f50);}_0x4e353c=_[_0x2b64('0x33')]({},_0x4e353c,_0x3f66a0[_0x2b64('0x34')]);return db[_0x2b64('0x3b')][_0x2b64('0x13')]({'where':_0x4e353c['where']})[_0x2b64('0x18')](function(_0x352b90){_0x4d5a81['count']=_0x352b90;if(_0x3f66a0['query'][_0x2b64('0x31')]){_0x4e353c[_0x2b64('0x32')]=[{'all':!![]}];}return db[_0x2b64('0x3b')]['findAll'](_0x4e353c);})[_0x2b64('0x18')](function(_0x208565){_0x4d5a81['rows']=_0x208565;return _0x4d5a81;});}})[_0x2b64('0x18')](respondWithFilteredResult(_0x319f98,_0x4e353c))[_0x2b64('0x27')](handleError(_0x319f98,null));};exports[_0x2b64('0x4a')]=function(_0x2e1ca9,_0x359d99){return db[_0x2b64('0x35')][_0x2b64('0x36')]({'where':{'id':_0x2e1ca9[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x359d99,null))[_0x2b64('0x18')](function(_0x190697){if(_0x190697){return _0x190697[_0x2b64('0x4b')](_0x2e1ca9[_0x2b64('0x38')][_0x2b64('0x3c')],_['omit'](_0x2e1ca9[_0x2b64('0x38')],[_0x2b64('0x3c'),'id'])||{})[_0x2b64('0x4c')](function(){return db['Tag'][_0x2b64('0x23')]({'attributes':['id',_0x2b64('0x1d'),_0x2b64('0x4d')],'where':{'id':_0x2e1ca9[_0x2b64('0x38')]['ids']}});})[_0x2b64('0x18')](function(_0x626661){socket[_0x2b64('0x4e')](_0x2b64('0x4f'),{'id':Number(_0x2e1ca9[_0x2b64('0x2a')]['id']),'tags':_0x626661||[]});return{'id':Number(_0x2e1ca9['params']['id']),'tags':_0x626661||[]};});}})['then'](respondWithResult(_0x359d99,null))[_0x2b64('0x27')](handleError(_0x359d99,null));};exports[_0x2b64('0x50')]=function(_0x2a79f5,_0x529990){return db['OpenchannelInteraction'][_0x2b64('0x36')]({'where':{'id':_0x2a79f5[_0x2b64('0x2a')]['id']}})[_0x2b64('0x18')](handleEntityNotFound(_0x529990,null))[_0x2b64('0x18')](function(_0x4573cc){if(_0x4573cc){return _0x4573cc[_0x2b64('0x50')](_0x2a79f5[_0x2b64('0x25')][_0x2b64('0x3c')]);}})[_0x2b64('0x18')](respondWithStatusCode(_0x529990,null))[_0x2b64('0x27')](handleError(_0x529990,null));};exports[_0x2b64('0x51')]=function(_0x4e9960,_0x5a9aad){var _0x415a6c=moment()[_0x2b64('0x52')]()[_0x2b64('0x53')]();var _0x544191=path['join'](config[_0x2b64('0x54')],_0x2b64('0x55'),_0x2b64('0x56'),_0x2b64('0x57'));var _0x84661c=path[_0x2b64('0x58')](config[_0x2b64('0x54')],'server',_0x2b64('0x56'),_0x2b64('0x59'));var _0x4dc12d=path[_0x2b64('0x58')](_0x544191,_0x415a6c);var _0xe4e07b=util[_0x2b64('0x48')](_0x2b64('0x5a'),_0x4e9960[_0x2b64('0x2a')]['id'],_0x415a6c);var _0x5b37fe=path['join'](_0x544191,_0xe4e07b);var _0x32ef91=[];_0x32ef91[_0x2b64('0x5b')]({'model':db[_0x2b64('0x5c')],'as':_0x2b64('0x5c'),'attributes':['id',_0x2b64('0x5d')],'raw':!![]});_0x32ef91[_0x2b64('0x5b')]({'model':db[_0x2b64('0x5e')],'as':'Contact','attributes':['id',_0x2b64('0x5f'),'lastName'],'raw':!![]});if(_0x4e9960[_0x2b64('0x25')][_0x2b64('0x59')]){_0x32ef91['push']({'model':db[_0x2b64('0x60')],'as':_0x2b64('0x60'),'raw':!![]});}var _0xd1e9ca=[{'model':db[_0x2b64('0x3b')],'as':_0x2b64('0x61'),'attributes':['id',_0x2b64('0x38'),'createdAt','direction',_0x2b64('0x62'),'read'],'include':_0x32ef91}];_0xd1e9ca['push']({'model':db['OpenchannelAccount'],'as':_0x2b64('0x63'),'attributes':['id','name']});_0xd1e9ca[_0x2b64('0x5b')]({'model':db['User'],'as':_0x2b64('0x64'),'attributes':['id','fullname']});return db['OpenchannelInteraction'][_0x2b64('0x36')]({'where':{'id':_0x4e9960['params']['id']},'include':_0xd1e9ca})[_0x2b64('0x18')](handleEntityNotFound(_0x5a9aad,null))[_0x2b64('0x18')](function(_0x4ccf5a){if(_0x4ccf5a){var _0x3efd64=_0x4ccf5a[_0x2b64('0x65')]({'plain':!![]});fs[_0x2b64('0x66')](_0x4dc12d);var _0x437ee4={'channel':_0x2b64('0x67'),'account':_0x3efd64[_0x2b64('0x63')]['name'],'agent':_0x3efd64[_0x2b64('0x64')]?_0x3efd64[_0x2b64('0x64')][_0x2b64('0x5d')]:'N.A.','createdAt':moment(_0x3efd64[_0x2b64('0x68')])[_0x2b64('0x48')](_0x2b64('0x49'))['toString'](),'closedAt':_0x3efd64['closed']?moment(_0x3efd64['closedAt'])['format'](_0x2b64('0x49'))[_0x2b64('0x53')]():'','disposition':_0x3efd64['disposition'],'visibility':_0x3efd64['threadId']?_0x2b64('0x69'):_0x2b64('0x6a'),'messages':_(_0x3efd64['Messages'])[_0x2b64('0x44')]({'secret':![]})['map'](function(_0x6410eb){if(_0x6410eb[_0x2b64('0x60')]){var _0x129b2d=path[_0x2b64('0x58')](_0x84661c,_0x6410eb[_0x2b64('0x60')][_0x2b64('0x6b')]);if(fs[_0x2b64('0x6c')](_0x129b2d)){fs[_0x2b64('0x6d')](_0x129b2d)['pipe'](fs[_0x2b64('0x6e')](path[_0x2b64('0x58')](_0x4dc12d,_0x6410eb[_0x2b64('0x60')][_0x2b64('0x6b')])));}}return{'date':moment(_0x6410eb[_0x2b64('0x68')])[_0x2b64('0x48')](_0x2b64('0x49'))['toString'](),'sender':_0x6410eb[_0x2b64('0x6f')]==='out'?_0x6410eb['User']?_0x6410eb['User'][_0x2b64('0x5d')]:'System':_0x6410eb['Contact'][_0x2b64('0x5f')]+(_0x6410eb[_0x2b64('0x70')][_0x2b64('0x71')]?'\x20'+_0x6410eb[_0x2b64('0x70')][_0x2b64('0x71')]:''),'body':_0x6410eb['Attachment']?_0x6410eb['Attachment'][_0x2b64('0x6b')]:_0x6410eb[_0x2b64('0x38')],'direction':_0x6410eb[_0x2b64('0x6f')]==='out'?'A':'C','secret':_0x6410eb[_0x2b64('0x62')],'read':_0x6410eb[_0x2b64('0x72')],'attachment':_0x6410eb[_0x2b64('0x60')]};})[_0x2b64('0x73')]()};return ejs[_0x2b64('0x74')](path['join'](config[_0x2b64('0x54')],_0x2b64('0x55'),_0x2b64('0x75'),_0x2b64('0x76')),{'interaction':_0x437ee4})[_0x2b64('0x18')](function(_0x3c25c9){var _0x2edcbc=path[_0x2b64('0x58')](_0x4dc12d,_0x2b64('0x77')+_0x3efd64['id']+'-'+_0x415a6c+_0x2b64('0x78'));var _0x428157={'path':_0x2edcbc,'channel':_0x2b64('0x67'),'interactionId':_0x3efd64['id']};return pdf[_0x2b64('0x79')](_0x3c25c9,_0x428157);})[_0x2b64('0x18')](function(){return new Promise(function(_0x3c8de3,_0x25ad60){zipdir(_0x4dc12d,{'saveTo':_0x5b37fe},function(_0x395b17,_0x4da1d2){if(_0x395b17)return _0x25ad60(_0x395b17);return _0x3c8de3(_0x4da1d2);});})[_0x2b64('0x18')](function(){return new Promise(function(_0x5a07cc,_0x39ee12){rimraf(_0x4dc12d,function(_0x28f0e0){if(_0x28f0e0)_0x39ee12(_0x28f0e0);return _0x5a07cc();});});})[_0x2b64('0x18')](function(){return _0x5a9aad['download'](_0x5b37fe,_0xe4e07b,function(_0xcb47f6){if(_0xcb47f6){logger[_0x2b64('0x1b')](_0x2b64('0x7a'),_0xcb47f6);}else{fs[_0x2b64('0x7b')](_0x5b37fe);}});});});}else{return _0x5a9aad[_0x2b64('0xf')](0xc8);}})[_0x2b64('0x27')](handleError(_0x5a9aad,null));}; \ No newline at end of file +var _0xee82=['lastName','attachments','Attachment','createdAt','direction','secret','OpenchannelAccount','Account','Owner','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','threadId','Public','Private','Messages','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','transcript-','Openchannel','createPdfFromHTML','download','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','stack','name','send','index','OpenchannelInteraction','rawAttributes','fieldName','type','getOptions','findAll','openchannel','user','catch','query','from','params','model','keys','filters','attributes','intersection','fields','includeAll','include','merge','find','create','body','describe','addMessage','OpenchannelMessage','findOne','length','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','map','$gte','format','options','rows','addTags','setTags','ids','Tag','color','emit','openchannelInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xee82,0x1b7));var _0x2ee8=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0xee82[_0x1fc84d];return _0x2658fa;};'use strict';var rimraf=require(_0x2ee8('0x0'));var zipdir=require(_0x2ee8('0x1'));var moment=require(_0x2ee8('0x2'));var util=require(_0x2ee8('0x3'));var path=require(_0x2ee8('0x4'));var ejs=require(_0x2ee8('0x5'));var fs=require('fs');var _=require(_0x2ee8('0x6'));var Redis=require(_0x2ee8('0x7'));var interaction=require(_0x2ee8('0x8'));var qs=require(_0x2ee8('0x9'));var pdf=require('../../components/export/pdf');var logger=require(_0x2ee8('0xa'))(_0x2ee8('0xb'));var config=require(_0x2ee8('0xc'));var db=require(_0x2ee8('0xd'))['db'];config[_0x2ee8('0xe')]=_[_0x2ee8('0xf')](config[_0x2ee8('0xe')],{'host':_0x2ee8('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2ee8('0xe')]));require(_0x2ee8('0x11'))[_0x2ee8('0x12')](socket);function respondWithStatusCode(_0x358839,_0x3008b8){_0x3008b8=_0x3008b8||0xcc;return function(_0x4bd133){if(_0x4bd133){return _0x358839['sendStatus'](_0x3008b8);}return _0x358839[_0x2ee8('0x13')](_0x3008b8)[_0x2ee8('0x14')]();};}function respondWithResult(_0x3c9679,_0x32640e){_0x32640e=_0x32640e||0xc8;return function(_0x401a68){if(_0x401a68){return _0x3c9679[_0x2ee8('0x13')](_0x32640e)[_0x2ee8('0x15')](_0x401a68);}};}function respondWithFilteredResult(_0x4772c1,_0x4c18cd){return function(_0x7a6591){if(_0x7a6591){var _0x15909d=typeof _0x4c18cd[_0x2ee8('0x16')]===_0x2ee8('0x17')&&typeof _0x4c18cd[_0x2ee8('0x18')]===_0x2ee8('0x17');var _0x266d83=_0x7a6591[_0x2ee8('0x19')];var _0x5813d0=_0x15909d?0x0:_0x4c18cd[_0x2ee8('0x16')];var _0x4a246a=_0x15909d?_0x7a6591[_0x2ee8('0x19')]:_0x4c18cd[_0x2ee8('0x16')]+_0x4c18cd[_0x2ee8('0x18')];var _0x3c6c6c;if(_0x4a246a>=_0x266d83){_0x4a246a=_0x266d83;_0x3c6c6c=0xc8;}else{_0x3c6c6c=0xce;}_0x4772c1[_0x2ee8('0x13')](_0x3c6c6c);return _0x4772c1['set'](_0x2ee8('0x1a'),_0x5813d0+'-'+_0x4a246a+'/'+_0x266d83)['json'](_0x7a6591);}return null;};}function saveUpdates(_0x5c8783){return function(_0x37a872){if(_0x37a872){return _0x37a872[_0x2ee8('0x1b')](_0x5c8783)[_0x2ee8('0x1c')](function(_0x123a01){return _0x123a01;});}return null;};}function removeEntity(_0x1aafad){return function(_0x26f525){if(_0x26f525){return _0x26f525[_0x2ee8('0x1d')]()[_0x2ee8('0x1c')](function(){_0x1aafad[_0x2ee8('0x13')](0xcc)[_0x2ee8('0x14')]();});}};}function handleEntityNotFound(_0x5d2f30){return function(_0x6a6725){if(!_0x6a6725){_0x5d2f30[_0x2ee8('0x1e')](0x194);}return _0x6a6725;};}function handleError(_0x67497c,_0x4c0769){_0x4c0769=_0x4c0769||0x1f4;return function(_0xc71332){logger['error'](_0xc71332[_0x2ee8('0x1f')]);if(_0xc71332[_0x2ee8('0x20')]){delete _0xc71332[_0x2ee8('0x20')];}_0x67497c[_0x2ee8('0x13')](_0x4c0769)[_0x2ee8('0x21')](_0xc71332);};}exports[_0x2ee8('0x22')]=function(_0x4557f7,_0x3bb393){var _0x363d06={};var _0x1b039c=_['map'](db[_0x2ee8('0x23')][_0x2ee8('0x24')],function(_0x21a258){return{'name':_0x21a258[_0x2ee8('0x25')],'type':_0x21a258[_0x2ee8('0x26')]['key']};});_0x363d06=qs[_0x2ee8('0x27')](_0x1b039c,_0x4557f7);return interaction[_0x2ee8('0x28')](_0x2ee8('0x29'),_0x4557f7['query'],_0x4557f7[_0x2ee8('0x2a')],_0x363d06,_0x1b039c)['then'](respondWithFilteredResult(_0x3bb393,_0x363d06))[_0x2ee8('0x2b')](handleError(_0x3bb393,null));};exports['show']=function(_0x442cad,_0x24574c){var _0x11ab13={};if(_0x442cad[_0x2ee8('0x2c')][_0x2ee8('0x26')]&&_0x442cad[_0x2ee8('0x2c')][_0x2ee8('0x26')]===_0x2ee8('0x2d')){_0x11ab13['from']=_0x442cad[_0x2ee8('0x2e')]['id'];}else{_0x11ab13['id']=_0x442cad['params']['id'];}var _0x299e26={'raw':![],'where':_0x11ab13},_0x56f295={};_0x56f295[_0x2ee8('0x2f')]=_['keys'](db[_0x2ee8('0x23')][_0x2ee8('0x24')]);_0x56f295[_0x2ee8('0x2c')]=_[_0x2ee8('0x30')](_0x442cad[_0x2ee8('0x2c')]);_0x56f295[_0x2ee8('0x31')]=_['intersection'](_0x56f295[_0x2ee8('0x2f')],_0x56f295['query']);_0x299e26[_0x2ee8('0x32')]=_[_0x2ee8('0x33')](_0x56f295[_0x2ee8('0x2f')],qs['fields'](_0x442cad[_0x2ee8('0x2c')][_0x2ee8('0x34')]));_0x299e26['attributes']=_0x299e26[_0x2ee8('0x32')]['length']?_0x299e26[_0x2ee8('0x32')]:_0x56f295[_0x2ee8('0x2f')];if(_0x442cad['query'][_0x2ee8('0x35')]){_0x299e26[_0x2ee8('0x36')]=[{'all':!![]}];}_0x299e26=_[_0x2ee8('0x37')]({},_0x299e26,_0x442cad['options']);return db[_0x2ee8('0x23')][_0x2ee8('0x38')](_0x299e26)[_0x2ee8('0x1c')](handleEntityNotFound(_0x24574c,null))[_0x2ee8('0x1c')](respondWithResult(_0x24574c,null))['catch'](handleError(_0x24574c,null));};exports[_0x2ee8('0x39')]=function(_0x3d3701,_0x3991b4){return db['OpenchannelInteraction'][_0x2ee8('0x39')](_0x3d3701[_0x2ee8('0x3a')],{})[_0x2ee8('0x1c')](respondWithResult(_0x3991b4,0xc9))[_0x2ee8('0x2b')](handleError(_0x3991b4,null));};exports[_0x2ee8('0x1b')]=function(_0x31c055,_0x8480b7){if(_0x31c055[_0x2ee8('0x3a')]['id']){delete _0x31c055[_0x2ee8('0x3a')]['id'];}return db['OpenchannelInteraction'][_0x2ee8('0x38')]({'where':{'id':_0x31c055['params']['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x8480b7,null))[_0x2ee8('0x1c')](saveUpdates(_0x31c055[_0x2ee8('0x3a')],null))['then'](respondWithResult(_0x8480b7,null))[_0x2ee8('0x2b')](handleError(_0x8480b7,null));};exports[_0x2ee8('0x1d')]=function(_0x1cabd2,_0x51a9f1){return db[_0x2ee8('0x23')][_0x2ee8('0x38')]({'where':{'id':_0x1cabd2[_0x2ee8('0x2e')]['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x51a9f1,null))[_0x2ee8('0x1c')](removeEntity(_0x51a9f1,null))[_0x2ee8('0x2b')](handleError(_0x51a9f1,null));};exports[_0x2ee8('0x3b')]=function(_0x27ecde,_0x25a50f){return db[_0x2ee8('0x23')][_0x2ee8('0x3b')]()[_0x2ee8('0x1c')](respondWithResult(_0x25a50f,null))['catch'](handleError(_0x25a50f,null));};exports[_0x2ee8('0x3c')]=function(_0x59f070,_0x206815){return db[_0x2ee8('0x3d')][_0x2ee8('0x38')]({'where':{'id':_0x59f070[_0x2ee8('0x2e')]['id']}})['then'](handleEntityNotFound(_0x206815,null))[_0x2ee8('0x1c')](function(_0x1e77cb){if(_0x1e77cb){return _0x1e77cb[_0x2ee8('0x3c')](_0x59f070[_0x2ee8('0x3a')]['ids'],_['omit'](_0x59f070[_0x2ee8('0x3a')],['ids','id'])||{});}})[_0x2ee8('0x1c')](respondWithResult(_0x206815,null))[_0x2ee8('0x2b')](handleError(_0x206815,null));};exports['getMessages']=function(_0x4213bf,_0x2fd0a5){var _0x12c1e3={'raw':![],'where':{}};var _0x28db73={};var _0x124e49={'count':0x0,'rows':[]};return db[_0x2ee8('0x23')][_0x2ee8('0x3e')]({'where':{'id':_0x4213bf[_0x2ee8('0x2e')]['id']}})['then'](handleEntityNotFound(_0x2fd0a5,null))[_0x2ee8('0x1c')](function(_0x5d10fb){if(_0x5d10fb){_0x28db73[_0x2ee8('0x2f')]=_[_0x2ee8('0x30')](db['OpenchannelMessage'][_0x2ee8('0x24')]);_0x28db73['query']=_[_0x2ee8('0x30')](_0x4213bf['query']);_0x28db73[_0x2ee8('0x31')]=_[_0x2ee8('0x33')](_0x28db73[_0x2ee8('0x2f')],_0x28db73[_0x2ee8('0x2c')]);_0x12c1e3[_0x2ee8('0x32')]=_[_0x2ee8('0x33')](_0x28db73[_0x2ee8('0x2f')],qs['fields'](_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x34')]));_0x12c1e3[_0x2ee8('0x32')]=_0x12c1e3[_0x2ee8('0x32')][_0x2ee8('0x3f')]?_0x12c1e3[_0x2ee8('0x32')]:_0x28db73[_0x2ee8('0x2f')];if(!_0x4213bf[_0x2ee8('0x2c')]['hasOwnProperty'](_0x2ee8('0x40'))){_0x12c1e3[_0x2ee8('0x18')]=qs['limit'](_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x18')]);_0x12c1e3[_0x2ee8('0x16')]=qs[_0x2ee8('0x16')](_0x4213bf[_0x2ee8('0x2c')]['offset']);}_0x12c1e3[_0x2ee8('0x41')]=qs['sort'](_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x42')]);_0x12c1e3[_0x2ee8('0x43')]=qs[_0x2ee8('0x31')](_[_0x2ee8('0x44')](_0x4213bf[_0x2ee8('0x2c')],_0x28db73[_0x2ee8('0x31')]));_0x12c1e3['where'][_0x2ee8('0x45')]=_0x5d10fb['id'];if(_0x4213bf['query'][_0x2ee8('0x46')]){_0x12c1e3[_0x2ee8('0x43')]=_[_0x2ee8('0x37')](_0x12c1e3[_0x2ee8('0x43')],{'$or':_[_0x2ee8('0x47')](_0x12c1e3[_0x2ee8('0x32')],function(_0x5c3d53){var _0x53cfb7={};_0x53cfb7[_0x5c3d53]={'$like':'%'+_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x46')]+'%'};return _0x53cfb7;})});}if(_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x48')]){var _0x465b9f=_0x4213bf[_0x2ee8('0x2c')][_0x2ee8('0x48')]['split'](',');var _0x555c8e={};_0x555c8e[_0x465b9f[0x0]]={'$gte':moment(_0x465b9f[0x1])[_0x2ee8('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x12c1e3['where']=_[_0x2ee8('0x37')](_0x12c1e3[_0x2ee8('0x43')],_0x555c8e);}_0x12c1e3=_[_0x2ee8('0x37')]({},_0x12c1e3,_0x4213bf[_0x2ee8('0x4a')]);return db['OpenchannelMessage']['count']({'where':_0x12c1e3[_0x2ee8('0x43')]})['then'](function(_0xcce66f){_0x124e49['count']=_0xcce66f;if(_0x4213bf['query'][_0x2ee8('0x35')]){_0x12c1e3[_0x2ee8('0x36')]=[{'all':!![]}];}return db[_0x2ee8('0x3d')][_0x2ee8('0x28')](_0x12c1e3);})[_0x2ee8('0x1c')](function(_0x5de327){_0x124e49[_0x2ee8('0x4b')]=_0x5de327;return _0x124e49;});}})[_0x2ee8('0x1c')](respondWithFilteredResult(_0x2fd0a5,_0x12c1e3))[_0x2ee8('0x2b')](handleError(_0x2fd0a5,null));};exports[_0x2ee8('0x4c')]=function(_0x21a2e9,_0x2f2123){return db[_0x2ee8('0x23')][_0x2ee8('0x38')]({'where':{'id':_0x21a2e9[_0x2ee8('0x2e')]['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x2f2123,null))[_0x2ee8('0x1c')](function(_0xdfaad){if(_0xdfaad){return _0xdfaad[_0x2ee8('0x4d')](_0x21a2e9[_0x2ee8('0x3a')][_0x2ee8('0x4e')],_['omit'](_0x21a2e9[_0x2ee8('0x3a')],[_0x2ee8('0x4e'),'id'])||{})['spread'](function(){return db[_0x2ee8('0x4f')][_0x2ee8('0x28')]({'attributes':['id',_0x2ee8('0x20'),_0x2ee8('0x50')],'where':{'id':_0x21a2e9[_0x2ee8('0x3a')][_0x2ee8('0x4e')]}});})[_0x2ee8('0x1c')](function(_0x5e7d0b){socket[_0x2ee8('0x51')](_0x2ee8('0x52'),{'id':Number(_0x21a2e9[_0x2ee8('0x2e')]['id']),'tags':_0x5e7d0b||[]});return{'id':Number(_0x21a2e9['params']['id']),'tags':_0x5e7d0b||[]};});}})[_0x2ee8('0x1c')](respondWithResult(_0x2f2123,null))[_0x2ee8('0x2b')](handleError(_0x2f2123,null));};exports[_0x2ee8('0x53')]=function(_0x5127f0,_0x539641){return db['OpenchannelInteraction']['find']({'where':{'id':_0x5127f0[_0x2ee8('0x2e')]['id']}})[_0x2ee8('0x1c')](handleEntityNotFound(_0x539641,null))[_0x2ee8('0x1c')](function(_0x1322a0){if(_0x1322a0){return _0x1322a0['removeTags'](_0x5127f0[_0x2ee8('0x2c')][_0x2ee8('0x4e')]);}})['then'](respondWithStatusCode(_0x539641,null))[_0x2ee8('0x2b')](handleError(_0x539641,null));};exports['download']=function(_0x1312f0,_0x5d497b){var _0x34f145=moment()[_0x2ee8('0x54')]()[_0x2ee8('0x55')]();var _0x4f1be2=path[_0x2ee8('0x56')](config[_0x2ee8('0x57')],_0x2ee8('0x58'),_0x2ee8('0x59'),'tmp');var _0x42f36c=path['join'](config[_0x2ee8('0x57')],_0x2ee8('0x58'),_0x2ee8('0x59'),'attachments');var _0x399f80=path['join'](_0x4f1be2,_0x34f145);var _0x428a4d=util[_0x2ee8('0x49')](_0x2ee8('0x5a'),_0x1312f0[_0x2ee8('0x2e')]['id'],_0x34f145);var _0x3e4e69=path['join'](_0x4f1be2,_0x428a4d);var _0x34c04b=[];_0x34c04b[_0x2ee8('0x5b')]({'model':db[_0x2ee8('0x5c')],'as':_0x2ee8('0x5c'),'attributes':['id',_0x2ee8('0x5d')],'raw':!![]});_0x34c04b[_0x2ee8('0x5b')]({'model':db[_0x2ee8('0x5e')],'as':_0x2ee8('0x5f'),'attributes':['id',_0x2ee8('0x60'),_0x2ee8('0x61')],'raw':!![]});if(_0x1312f0[_0x2ee8('0x2c')][_0x2ee8('0x62')]){_0x34c04b[_0x2ee8('0x5b')]({'model':db['Attachment'],'as':_0x2ee8('0x63'),'raw':!![]});}var _0x419074=[{'model':db['OpenchannelMessage'],'as':'Messages','attributes':['id',_0x2ee8('0x3a'),_0x2ee8('0x64'),_0x2ee8('0x65'),_0x2ee8('0x66'),'read'],'include':_0x34c04b}];_0x419074[_0x2ee8('0x5b')]({'model':db[_0x2ee8('0x67')],'as':_0x2ee8('0x68'),'attributes':['id',_0x2ee8('0x20')]});_0x419074['push']({'model':db[_0x2ee8('0x5c')],'as':_0x2ee8('0x69'),'attributes':['id',_0x2ee8('0x5d')]});return db[_0x2ee8('0x23')][_0x2ee8('0x38')]({'where':{'id':_0x1312f0[_0x2ee8('0x2e')]['id']},'include':_0x419074})[_0x2ee8('0x1c')](handleEntityNotFound(_0x5d497b,null))[_0x2ee8('0x1c')](function(_0x16ec0c){if(_0x16ec0c){var _0x327770=_0x16ec0c['get']({'plain':!![]});fs[_0x2ee8('0x6a')](_0x399f80);var _0x51eed8={'channel':'Openchannel','account':_0x327770[_0x2ee8('0x68')][_0x2ee8('0x20')],'agent':_0x327770['Owner']?_0x327770[_0x2ee8('0x69')][_0x2ee8('0x5d')]:_0x2ee8('0x6b'),'createdAt':moment(_0x327770[_0x2ee8('0x64')])[_0x2ee8('0x49')](_0x2ee8('0x6c'))['toString'](),'closedAt':_0x327770[_0x2ee8('0x6d')]?moment(_0x327770[_0x2ee8('0x6e')])[_0x2ee8('0x49')](_0x2ee8('0x6c'))[_0x2ee8('0x55')]():'','disposition':_0x327770[_0x2ee8('0x6f')],'visibility':_0x327770[_0x2ee8('0x70')]?_0x2ee8('0x71'):_0x2ee8('0x72'),'messages':_(_0x327770[_0x2ee8('0x73')])[_0x2ee8('0x46')]({'secret':![]})['map'](function(_0x25014c){if(_0x25014c[_0x2ee8('0x63')]){var _0x4b462f=path['join'](_0x42f36c,_0x25014c['Attachment'][_0x2ee8('0x74')]);if(fs[_0x2ee8('0x75')](_0x4b462f)){fs[_0x2ee8('0x76')](_0x4b462f)[_0x2ee8('0x77')](fs[_0x2ee8('0x78')](path[_0x2ee8('0x56')](_0x399f80,_0x25014c[_0x2ee8('0x63')]['basename'])));}}return{'date':moment(_0x25014c[_0x2ee8('0x64')])[_0x2ee8('0x49')](_0x2ee8('0x6c'))[_0x2ee8('0x55')](),'sender':_0x25014c[_0x2ee8('0x65')]===_0x2ee8('0x79')?_0x25014c[_0x2ee8('0x5c')]?_0x25014c[_0x2ee8('0x5c')][_0x2ee8('0x5d')]:_0x2ee8('0x7a'):_0x25014c['Contact'][_0x2ee8('0x60')]+(_0x25014c['Contact'][_0x2ee8('0x61')]?'\x20'+_0x25014c[_0x2ee8('0x5f')]['lastName']:''),'body':_0x25014c[_0x2ee8('0x63')]?_0x25014c[_0x2ee8('0x63')][_0x2ee8('0x74')]:_0x25014c['body'],'direction':_0x25014c[_0x2ee8('0x65')]===_0x2ee8('0x79')?'A':'C','secret':_0x25014c[_0x2ee8('0x66')],'read':_0x25014c['read'],'attachment':_0x25014c[_0x2ee8('0x63')]};})[_0x2ee8('0x7b')]()};return ejs[_0x2ee8('0x7c')](path[_0x2ee8('0x56')](config['root'],_0x2ee8('0x58'),_0x2ee8('0x7d'),_0x2ee8('0x7e')),{'interaction':_0x51eed8})[_0x2ee8('0x1c')](function(_0x170d8c){var _0x538af1=path[_0x2ee8('0x56')](_0x399f80,_0x2ee8('0x7f')+_0x327770['id']+'-'+_0x34f145+'.pdf');var _0x41076b={'path':_0x538af1,'channel':_0x2ee8('0x80'),'interactionId':_0x327770['id']};return pdf[_0x2ee8('0x81')](_0x170d8c,_0x41076b);})[_0x2ee8('0x1c')](function(){return new Promise(function(_0x27345c,_0x21ce80){zipdir(_0x399f80,{'saveTo':_0x3e4e69},function(_0x4dc7d3,_0x108f37){if(_0x4dc7d3)return _0x21ce80(_0x4dc7d3);return _0x27345c(_0x108f37);});})['then'](function(){return new Promise(function(_0x55e143,_0x51669a){rimraf(_0x399f80,function(_0x48bf2e){if(_0x48bf2e)_0x51669a(_0x48bf2e);return _0x55e143();});});})['then'](function(){return _0x5d497b[_0x2ee8('0x82')](_0x3e4e69,_0x428a4d,function(_0x4c9e75){if(_0x4c9e75){logger[_0x2ee8('0x83')](_0x2ee8('0x84'),_0x4c9e75);}else{fs[_0x2ee8('0x85')](_0x3e4e69);}});});});}else{return _0x5d497b[_0x2ee8('0x1e')](0xc8);}})[_0x2ee8('0x2b')](handleError(_0x5d497b,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index cbddfee..b4dd6d9 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 _0xa78a=['exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook'];(function(_0x51f2bb,_0x59e870){var _0x3c8b5d=function(_0x3de75b){while(--_0x3de75b){_0x51f2bb['push'](_0x51f2bb['shift']());}};_0x3c8b5d(++_0x59e870);}(_0xa78a,0xeb));var _0xaa78=function(_0x8a1f44,_0x2c92d3){_0x8a1f44=_0x8a1f44-0x0;var _0x3f7bee=_0xa78a[_0x8a1f44];return _0x3f7bee;};'use strict';var EventEmitter=require(_0xaa78('0x0'));var OpenchannelInteraction=require(_0xaa78('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xaa78('0x1'))['db'][_0xaa78('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xaa78('0x3')](0x0);var events={'afterCreate':_0xaa78('0x4'),'afterUpdate':_0xaa78('0x5'),'afterDestroy':'remove'};function emitEvent(_0x227d24){return function(_0x51fd0e,_0x5a91b0,_0x3390a1){_0x51fd0e[_0xaa78('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x40c75e){_0x51fd0e[_0xaa78('0x7')](_0xaa78('0x8'),_0x40c75e[_0xaa78('0x9')](function(_0xc21896){return{'id':_0xc21896['id']};}));return OpenchannelMessage[_0xaa78('0xa')]({'where':{'OpenchannelInteractionId':_0x51fd0e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xaa78('0xb')](function(_0x244f57){_0x51fd0e[_0xaa78('0x7')]('unreadMessages',_0x244f57[_0xaa78('0xc')]);OpenchannelInteractionEvents[_0xaa78('0xd')](_0x227d24+':'+_0x51fd0e['id'],_0x51fd0e);OpenchannelInteractionEvents[_0xaa78('0xd')](_0x227d24,_0x51fd0e);_0x3390a1(null);})[_0xaa78('0xe')](_0x3390a1(null));};}for(var e in events){if(events[_0xaa78('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xaa78('0x10')](e,emitEvent(event));}}module[_0xaa78('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x8210=['then','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','getUsers','setDataValue','Users','findAll'];(function(_0x56d9a1,_0x5e6784){var _0x40e340=function(_0x329040){while(--_0x329040){_0x56d9a1['push'](_0x56d9a1['shift']());}};_0x40e340(++_0x5e6784);}(_0x8210,0x137));var _0x0821=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x8210[_0x18ab2a];return _0x16dcee;};'use strict';var EventEmitter=require(_0x0821('0x0'));var OpenchannelInteraction=require(_0x0821('0x1'))['db'][_0x0821('0x2')];var OpenchannelMessage=require(_0x0821('0x1'))['db'][_0x0821('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x0821('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3b2c9a){return function(_0x38efb8,_0x28496c,_0x2a89dc){_0x38efb8[_0x0821('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x383f91){_0x38efb8[_0x0821('0x6')](_0x0821('0x7'),_0x383f91['map'](function(_0x147b17){return{'id':_0x147b17['id']};}));return OpenchannelMessage[_0x0821('0x8')]({'where':{'OpenchannelInteractionId':_0x38efb8['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0821('0x9')](function(_0x27cace){_0x38efb8[_0x0821('0x6')](_0x0821('0xa'),_0x27cace[_0x0821('0xb')]);OpenchannelInteractionEvents[_0x0821('0xc')](_0x3b2c9a+':'+_0x38efb8['id'],_0x38efb8);OpenchannelInteractionEvents['emit'](_0x3b2c9a,_0x38efb8);_0x2a89dc(null);})[_0x0821('0xd')](_0x2a89dc(null));};}for(var e in events){if(events[_0x0821('0xe')](e)){var event=events[e];OpenchannelInteraction[_0x0821('0xf')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 23d4fcb..1460984 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 _0xfb98=['../../config/environment','./openchannelInteraction.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','changed','closed','format','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x225f62,_0x5cd94a){var _0xc44e8a=function(_0x4bb0f2){while(--_0x4bb0f2){_0x225f62['push'](_0x225f62['shift']());}};_0xc44e8a(++_0x5cd94a);}(_0xfb98,0xd5));var _0x8fb9=function(_0x5c7fd8,_0x16f4b1){_0x5c7fd8=_0x5c7fd8-0x0;var _0x1d314f=_0xfb98[_0x5c7fd8];return _0x1d314f;};'use strict';var _=require('lodash');var util=require(_0x8fb9('0x0'));var logger=require(_0x8fb9('0x1'))(_0x8fb9('0x2'));var moment=require(_0x8fb9('0x3'));var BPromise=require(_0x8fb9('0x4'));var rp=require(_0x8fb9('0x5'));var fs=require('fs');var path=require(_0x8fb9('0x6'));var rimraf=require(_0x8fb9('0x7'));var config=require(_0x8fb9('0x8'));var attributes=require(_0x8fb9('0x9'));module[_0x8fb9('0xa')]=function(_0x2be9c4,_0x465df2){return _0x2be9c4[_0x8fb9('0xb')]('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fb9('0xc'),'collate':_0x8fb9('0xd'),'hooks':{'beforeUpdate':function(_0x9f3681,_0x59b28c,_0x7af428){if(_0x9f3681[_0x8fb9('0xe')](_0x8fb9('0xf'))){_0x9f3681['closedAt']=moment()[_0x8fb9('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x7af428(null,_0x9f3681);}}});}; \ No newline at end of file +var _0x9552=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x4c8281,_0x964908){var _0x3ceece=function(_0x42d82d){while(--_0x42d82d){_0x4c8281['push'](_0x4c8281['shift']());}};_0x3ceece(++_0x964908);}(_0x9552,0xea));var _0x2955=function(_0x556330,_0x31816a){_0x556330=_0x556330-0x0;var _0xb4364f=_0x9552[_0x556330];return _0xb4364f;};'use strict';var _=require(_0x2955('0x0'));var util=require(_0x2955('0x1'));var logger=require(_0x2955('0x2'))('api');var moment=require(_0x2955('0x3'));var BPromise=require(_0x2955('0x4'));var rp=require(_0x2955('0x5'));var fs=require('fs');var path=require(_0x2955('0x6'));var rimraf=require(_0x2955('0x7'));var config=require(_0x2955('0x8'));var attributes=require(_0x2955('0x9'));module[_0x2955('0xa')]=function(_0x3e8a1e,_0x4f5e98){return _0x3e8a1e[_0x2955('0xb')](_0x2955('0xc'),attributes,{'tableName':_0x2955('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2955('0xe'),'collate':'utf8mb4_unicode_ci','hooks':{'beforeUpdate':function(_0x27e3ee,_0x26e6dc,_0x2c4ef7){if(_0x27e3ee[_0x2955('0xf')]('closed')){_0x27e3ee[_0x2955('0x10')]=moment()['format'](_0x2955('0x11'));}_0x2c4ef7(null,_0x27e3ee);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3644e70..ceb3d99 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 _0xca91=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','body','options','where','attributes','debug','AddTagsToOpenchannelInteraction'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xca91,0x19b));var _0x1ca9=function(_0x3f578f,_0x51f172){_0x3f578f=_0x3f578f-0x0;var _0x32c754=_0xca91[_0x3f578f];return _0x32c754;};'use strict';var _=require(_0x1ca9('0x0'));var util=require(_0x1ca9('0x1'));var moment=require(_0x1ca9('0x2'));var BPromise=require(_0x1ca9('0x3'));var rs=require(_0x1ca9('0x4'));var fs=require('fs');var Redis=require(_0x1ca9('0x5'));var db=require(_0x1ca9('0x6'))['db'];var utils=require(_0x1ca9('0x7'));var logger=require(_0x1ca9('0x8'))(_0x1ca9('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ca9('0xa'));var client=jayson[_0x1ca9('0xb')][_0x1ca9('0xc')]({'port':0x232a});config[_0x1ca9('0xd')]=_[_0x1ca9('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1ca9('0xf'))(new Redis(config[_0x1ca9('0xd')]));require(_0x1ca9('0x10'))[_0x1ca9('0x11')](socket);function respondWithRpcPromise(_0x4ea50f,_0x26e8c2,_0x46498c){return new BPromise(function(_0x4006e4,_0x4e09d8){return client[_0x1ca9('0x12')](_0x4ea50f,_0x46498c)[_0x1ca9('0x13')](function(_0x44fa2d){logger[_0x1ca9('0x14')](_0x1ca9('0x15'),_0x26e8c2,'request\x20sent');logger['debug'](_0x1ca9('0x16'),_0x26e8c2,_0x1ca9('0x17'),JSON[_0x1ca9('0x18')](_0x44fa2d));if(_0x44fa2d['error']){if(_0x44fa2d['error'][_0x1ca9('0x19')]===0x1f4){logger[_0x1ca9('0x1a')](_0x1ca9('0x15'),_0x26e8c2,_0x44fa2d[_0x1ca9('0x1a')][_0x1ca9('0x1b')]);return _0x4e09d8(_0x44fa2d[_0x1ca9('0x1a')][_0x1ca9('0x1b')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x26e8c2,_0x44fa2d['error'][_0x1ca9('0x1b')]);return _0x4006e4(_0x44fa2d['error'][_0x1ca9('0x1b')]);}else{logger[_0x1ca9('0x14')](_0x1ca9('0x15'),_0x26e8c2,'request\x20sent');_0x4006e4(_0x44fa2d[_0x1ca9('0x1c')][_0x1ca9('0x1b')]);}})[_0x1ca9('0x1d')](function(_0x8b8e49){logger['error'](_0x1ca9('0x15'),_0x26e8c2,_0x8b8e49);_0x4e09d8(_0x8b8e49);});});}exports[_0x1ca9('0x1e')]=function(_0x5cc3b6){var _0x1e1b8b=this;return new Promise(function(_0x3f933f,_0x1e2681){return db[_0x1ca9('0x1f')][_0x1ca9('0x20')](_0x5cc3b6[_0x1ca9('0x21')],{'raw':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6[_0x1ca9('0x22')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6['options'][_0x1ca9('0x23')]||null:null,'attributes':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6[_0x1ca9('0x22')][_0x1ca9('0x24')]||null:null,'limit':_0x5cc3b6[_0x1ca9('0x22')]?_0x5cc3b6[_0x1ca9('0x22')]['limit']||null:null})[_0x1ca9('0x13')](function(_0x428919){logger['info'](_0x1ca9('0x1e'),_0x5cc3b6);logger[_0x1ca9('0x25')](_0x1ca9('0x1e'),_0x5cc3b6,JSON[_0x1ca9('0x18')](_0x428919));_0x3f933f(_0x428919);})['catch'](function(_0x17b825){logger['error'](_0x1ca9('0x1e'),_0x17b825[_0x1ca9('0x1b')],_0x5cc3b6);_0x1e2681(_0x1e1b8b[_0x1ca9('0x1a')](0x1f4,_0x17b825[_0x1ca9('0x1b')]));});});};exports[_0x1ca9('0x26')]=function(_0x4da016){return new Promise(function(_0x554c8f,_0x29a434){return db[_0x1ca9('0x1f')][_0x1ca9('0x27')]({'where':_0x4da016[_0x1ca9('0x22')]?_0x4da016[_0x1ca9('0x22')]['where']||null:null})[_0x1ca9('0x13')](function(_0x10d9c2){if(_0x10d9c2){return _0x10d9c2[_0x1ca9('0x28')](_0x4da016[_0x1ca9('0x21')][_0x1ca9('0x29')],_[_0x1ca9('0x2a')](_0x4da016[_0x1ca9('0x21')],[_0x1ca9('0x29'),'id'])||{});}})[_0x1ca9('0x2b')](function(_0x2d2c31){logger[_0x1ca9('0x14')](_0x1ca9('0x2c'),_0x4da016);logger['debug']('AddTags',_0x4da016,JSON[_0x1ca9('0x18')](_0x2d2c31));_0x554c8f(_0x2d2c31);})[_0x1ca9('0x1d')](function(_0x36f8d5){logger[_0x1ca9('0x1a')](_0x1ca9('0x2c'),_0x36f8d5[_0x1ca9('0x1b')],_0x4da016);_0x29a434(_this['error'](0x1f4,_0x36f8d5[_0x1ca9('0x1b')]));});});}; \ No newline at end of file +var _0xccec=['debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelInteraction,\x20%s,\x20%s','message','info','result','UpdateOpenchannelInteraction','update','body','options','raw','attributes','limit','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','then','addTags','ids','omit','AddTags','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','register','request','request\x20sent'];(function(_0x32eefb,_0xee05a3){var _0x3ef53a=function(_0x2a6c69){while(--_0x2a6c69){_0x32eefb['push'](_0x32eefb['shift']());}};_0x3ef53a(++_0xee05a3);}(_0xccec,0x97));var _0xccce=function(_0x532d86,_0x2067ff){_0x532d86=_0x532d86-0x0;var _0x152b27=_0xccec[_0x532d86];return _0x152b27;};'use strict';var _=require('lodash');var util=require(_0xccce('0x0'));var moment=require(_0xccce('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xccce('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xccce('0x3'));var logger=require(_0xccce('0x4'))(_0xccce('0x5'));var config=require(_0xccce('0x6'));var jayson=require(_0xccce('0x7'));var client=jayson[_0xccce('0x8')][_0xccce('0x9')]({'port':0x232a});config['redis']=_[_0xccce('0xa')](config['redis'],{'host':_0xccce('0xb'),'port':0x18eb});var socket=require(_0xccce('0xc'))(new Redis(config[_0xccce('0xd')]));require('./openchannelInteraction.socket')[_0xccce('0xe')](socket);function respondWithRpcPromise(_0x2a5011,_0x427450,_0x16d733){return new BPromise(function(_0x5c75ec,_0x4a45ff){return client[_0xccce('0xf')](_0x2a5011,_0x16d733)['then'](function(_0x3ce2a6){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0xccce('0x10'));logger[_0xccce('0x11')](_0xccce('0x12'),_0x427450,_0xccce('0x10'),JSON[_0xccce('0x13')](_0x3ce2a6));if(_0x3ce2a6[_0xccce('0x14')]){if(_0x3ce2a6[_0xccce('0x14')][_0xccce('0x15')]===0x1f4){logger[_0xccce('0x14')](_0xccce('0x16'),_0x427450,_0x3ce2a6[_0xccce('0x14')][_0xccce('0x17')]);return _0x4a45ff(_0x3ce2a6[_0xccce('0x14')][_0xccce('0x17')]);}logger[_0xccce('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0x3ce2a6[_0xccce('0x14')][_0xccce('0x17')]);return _0x5c75ec(_0x3ce2a6['error'][_0xccce('0x17')]);}else{logger[_0xccce('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0xccce('0x10'));_0x5c75ec(_0x3ce2a6[_0xccce('0x19')][_0xccce('0x17')]);}})['catch'](function(_0x2d7664){logger[_0xccce('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x427450,_0x2d7664);_0x4a45ff(_0x2d7664);});});}exports[_0xccce('0x1a')]=function(_0x277d01){var _0x1d66f6=this;return new Promise(function(_0x365a8f,_0x3726a5){return db['OpenchannelInteraction'][_0xccce('0x1b')](_0x277d01[_0xccce('0x1c')],{'raw':_0x277d01[_0xccce('0x1d')]?_0x277d01[_0xccce('0x1d')][_0xccce('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x277d01[_0xccce('0x1d')]?_0x277d01[_0xccce('0x1d')]['where']||null:null,'attributes':_0x277d01[_0xccce('0x1d')]?_0x277d01['options'][_0xccce('0x1f')]||null:null,'limit':_0x277d01[_0xccce('0x1d')]?_0x277d01[_0xccce('0x1d')][_0xccce('0x20')]||null:null})['then'](function(_0x3cf718){logger['info'](_0xccce('0x1a'),_0x277d01);logger[_0xccce('0x11')](_0xccce('0x1a'),_0x277d01,JSON[_0xccce('0x13')](_0x3cf718));_0x365a8f(_0x3cf718);})[_0xccce('0x21')](function(_0x4788b3){logger[_0xccce('0x14')](_0xccce('0x1a'),_0x4788b3['message'],_0x277d01);_0x3726a5(_0x1d66f6[_0xccce('0x14')](0x1f4,_0x4788b3[_0xccce('0x17')]));});});};exports[_0xccce('0x22')]=function(_0x9222f2){return new Promise(function(_0x4dd463,_0x1b790e){return db[_0xccce('0x23')][_0xccce('0x24')]({'where':_0x9222f2[_0xccce('0x1d')]?_0x9222f2['options']['where']||null:null})[_0xccce('0x25')](function(_0x3b3160){if(_0x3b3160){return _0x3b3160[_0xccce('0x26')](_0x9222f2[_0xccce('0x1c')][_0xccce('0x27')],_[_0xccce('0x28')](_0x9222f2[_0xccce('0x1c')],['ids','id'])||{});}})['spread'](function(_0x137cd8){logger['info'](_0xccce('0x29'),_0x9222f2);logger[_0xccce('0x11')](_0xccce('0x29'),_0x9222f2,JSON['stringify'](_0x137cd8));_0x4dd463(_0x137cd8);})[_0xccce('0x21')](function(_0x1d2fb4){logger[_0xccce('0x14')]('AddTags',_0x1d2fb4[_0xccce('0x17')],_0x9222f2);_0x1b790e(_this['error'](0x1f4,_0x1d2fb4['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 411a0f2..54394c4 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 _0x1fde=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','update'];(function(_0x50ff28,_0x5e9631){var _0x1a9cdb=function(_0x21c28b){while(--_0x21c28b){_0x50ff28['push'](_0x50ff28['shift']());}};_0x1a9cdb(++_0x5e9631);}(_0x1fde,0xfa));var _0xe1fd=function(_0x10dbf6,_0x3ff964){_0x10dbf6=_0x10dbf6-0x0;var _0x452147=_0x1fde[_0x10dbf6];return _0x452147;};'use strict';var OpenchannelInteractionEvents=require(_0xe1fd('0x0'));var events=['save','remove',_0xe1fd('0x1')];function createListener(_0x568da4,_0x54a6da){return function(_0x5a8142){_0x54a6da[_0xe1fd('0x2')](_0x568da4,_0x5a8142);};}function removeListener(_0x314049,_0x225678){return function(){OpenchannelInteractionEvents[_0xe1fd('0x3')](_0x314049,_0x225678);};}exports[_0xe1fd('0x4')]=function(_0x424fb4){for(var _0x1b487f=0x0,_0xd761e4=events[_0xe1fd('0x5')];_0x1b487f<_0xd761e4;_0x1b487f++){var _0x37ac5d=events[_0x1b487f];var _0x831e0c=createListener(_0xe1fd('0x6')+_0x37ac5d,_0x424fb4);OpenchannelInteractionEvents['on'](_0x37ac5d,_0x831e0c);}}; \ No newline at end of file +var _0xcea1=['removeListener','register','length','./openchannelInteraction.events','save','emit'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xcea1,0xf9));var _0x1cea=function(_0x14f6db,_0x4d9f26){_0x14f6db=_0x14f6db-0x0;var _0x45344d=_0xcea1[_0x14f6db];return _0x45344d;};'use strict';var OpenchannelInteractionEvents=require(_0x1cea('0x0'));var events=[_0x1cea('0x1'),'remove','update'];function createListener(_0x154fc3,_0x4d5431){return function(_0x350780){_0x4d5431[_0x1cea('0x2')](_0x154fc3,_0x350780);};}function removeListener(_0x4603c1,_0x2d29f0){return function(){OpenchannelInteractionEvents[_0x1cea('0x3')](_0x4603c1,_0x2d29f0);};}exports[_0x1cea('0x4')]=function(_0x1cb4bb){for(var _0x4b7549=0x0,_0x60b245=events[_0x1cea('0x5')];_0x4b7549<_0x60b245;_0x4b7549++){var _0xcacc1b=events[_0x4b7549];var _0x2b4911=createListener('openchannelInteraction:'+_0xcacc1b,_0x1cb4bb);OpenchannelInteractionEvents['on'](_0xcacc1b,_0x2b4911);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 77ddbf4..5bf9865 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(_0x2e00b6,_0x8c052c){var _0x5777d6=function(_0x3ba097){while(--_0x3ba097){_0x2e00b6['push'](_0x2e00b6['shift']());}};_0x5777d6(++_0x8c052c);}(_0xedd9,0xfc));var _0x9edd=function(_0x5d6161,_0x2608f8){_0x5d6161=_0x5d6161-0x0;var _0x24135c=_0xedd9[_0x5d6161];return _0x24135c;};'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 _0xcb91=['openchannelmessage:create','put','update','/:id/reject','reject','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','get','index','isAuthenticated','describe','/:id','post','tracked','openchannel'];(function(_0x955747,_0xd1ab29){var _0x3ff6d5=function(_0x56ef79){while(--_0x56ef79){_0x955747['push'](_0x955747['shift']());}};_0x3ff6d5(++_0xd1ab29);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xcb91[_0x1ee351];return _0x245aaf;};'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');var controller=require(_0x1cb9('0x6'));router[_0x1cb9('0x7')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0x8')]);router[_0x1cb9('0x7')]('/describe',auth[_0x1cb9('0x9')](),controller[_0x1cb9('0xa')]);router['get'](_0x1cb9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x1cb9('0xc')]('/',auth[_0x1cb9('0x9')](),interaction[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x1cb9('0xf')),controller['create']);router[_0x1cb9('0x10')](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x11')]);router[_0x1cb9('0x10')]('/:id/accept',auth['isAuthenticated'](),controller['accept']);router[_0x1cb9('0x10')](_0x1cb9('0x12'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x13')]);router['delete'](_0x1cb9('0xb'),auth[_0x1cb9('0x9')](),controller[_0x1cb9('0x14')]);module[_0x1cb9('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index d838c48..b4caa36 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 _0x594d=['DATE','STRING','sequelize','medium','BOOLEAN','out'];(function(_0x289bc0,_0x3503bb){var _0x3f5c89=function(_0x6289f8){while(--_0x6289f8){_0x289bc0['push'](_0x289bc0['shift']());}};_0x3f5c89(++_0x3503bb);}(_0x594d,0x92));var _0xd594=function(_0x4ceac4,_0x44efad){_0x4ceac4=_0x4ceac4-0x0;var _0x10eb6d=_0x594d[_0x4ceac4];return _0x10eb6d;};'use strict';var Sequelize=require(_0xd594('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xd594('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xd594('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd594('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd594('0x3')),'defaultValue':_0xd594('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xd594('0x4')]},'providerName':{'type':Sequelize[_0xd594('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xf3aa=['STRING','sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x3de97a,_0x4f9bba){var _0x463d5d=function(_0x34ad1f){while(--_0x34ad1f){_0x3de97a['push'](_0x3de97a['shift']());}};_0x463d5d(++_0x4f9bba);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x19cbac,_0x4a7597){_0x19cbac=_0x19cbac-0x0;var _0x180da3=_0xf3aa[_0x19cbac];return _0x180da3;};'use strict';var Sequelize=require(_0xaf3a('0x0'));module[_0xaf3a('0x1')]={'body':{'type':Sequelize[_0xaf3a('0x2')](_0xaf3a('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xaf3a('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xaf3a('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaf3a('0x6')]},'providerName':{'type':Sequelize[_0xaf3a('0x7')]},'providerResponse':{'type':Sequelize[_0xaf3a('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index d29f007..3a567d2 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 _0xeef0=['VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','destroy','describe','accept','openchannel','acceptMessage','reject','UserId','user','OpenchannelInteractionId','get','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','fullname','email','internal','agent','interface','format','SIP/%s','channel','motionChannel','event','EventManager','rejectmessage','util','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','register','jayson/promise','client','http','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','count','limit','set','Content-Range','update','then','end','sendStatus','stack','name','index','map','OpenchannelMessage','rawAttributes','fieldName','key','query','keys','intersection','model','fields','attributes','length','sort','where','filters','pick','filter','merge'];(function(_0x43ffe1,_0x933b2){var _0xc145bc=function(_0x3ef608){while(--_0x3ef608){_0x43ffe1['push'](_0x43ffe1['shift']());}};_0xc145bc(++_0x933b2);}(_0xeef0,0x1c8));var _0x0eef=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xeef0[_0x4b2436];return _0x4f5ab2;};'use strict';var util=require(_0x0eef('0x0'));var _=require(_0x0eef('0x1'));var Redis=require(_0x0eef('0x2'));var interactionService=require(_0x0eef('0x3'));var qs=require(_0x0eef('0x4'));var logger=require(_0x0eef('0x5'))(_0x0eef('0x6'));var config=require(_0x0eef('0x7'));var db=require(_0x0eef('0x8'))['db'];config[_0x0eef('0x9')]=_[_0x0eef('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelMessage.socket')[_0x0eef('0xb')](socket);var jayson=require(_0x0eef('0xc'));var client=jayson[_0x0eef('0xd')][_0x0eef('0xe')]({'port':0x232c});var client9002=jayson[_0x0eef('0xd')][_0x0eef('0xe')]({'port':0x232a});var interaction_log=require(_0x0eef('0x5'))('openchannel-interactions');function respondWithRpcPromise(_0x4280db,_0x1818c0,_0x509f1b,_0xb2efeb){return new Promise(function(_0x261a15,_0x36ba8f){var _0x440bbe=_0xb2efeb||client;return _0x440bbe[_0x0eef('0xf')](_0x4280db,_0x509f1b)['then'](function(_0x5c85ed){logger[_0x0eef('0x10')](_0x0eef('0x11'),_0x1818c0,_0x0eef('0x12'));logger[_0x0eef('0x13')](_0x0eef('0x14'),_0x1818c0,_0x0eef('0x12'),JSON[_0x0eef('0x15')](_0x5c85ed));if(_0x5c85ed[_0x0eef('0x16')]){if(_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x17')]===0x1f4){logger[_0x0eef('0x16')](_0x0eef('0x11'),_0x1818c0,_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x18')]);return _0x36ba8f(_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x18')]);}logger[_0x0eef('0x16')](_0x0eef('0x11'),_0x1818c0,_0x5c85ed[_0x0eef('0x16')]['message']);return _0x261a15(_0x5c85ed[_0x0eef('0x16')][_0x0eef('0x18')]);}else{logger[_0x0eef('0x10')](_0x0eef('0x11'),_0x1818c0,_0x0eef('0x12'));_0x261a15(_0x5c85ed[_0x0eef('0x19')]['message']);}})['catch'](function(_0x41c95d){logger[_0x0eef('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1818c0,_0x41c95d);_0x36ba8f(_0x41c95d);});});}function respondWithResult(_0x52875f,_0x5e9e02){_0x5e9e02=_0x5e9e02||0xc8;return function(_0x4c4d22){if(_0x4c4d22){return _0x52875f[_0x0eef('0x1a')](_0x5e9e02)[_0x0eef('0x1b')](_0x4c4d22);}};}function respondWithFilteredResult(_0x4e0944,_0x45028b){return function(_0x939926){if(_0x939926){var _0x5be8ff=typeof _0x45028b[_0x0eef('0x1c')]===_0x0eef('0x1d')&&typeof _0x45028b['limit']===_0x0eef('0x1d');var _0x4891eb=_0x939926[_0x0eef('0x1e')];var _0x42095b=_0x5be8ff?0x0:_0x45028b[_0x0eef('0x1c')];var _0x349deb=_0x5be8ff?_0x939926[_0x0eef('0x1e')]:_0x45028b[_0x0eef('0x1c')]+_0x45028b[_0x0eef('0x1f')];var _0x137c33;if(_0x349deb>=_0x4891eb){_0x349deb=_0x4891eb;_0x137c33=0xc8;}else{_0x137c33=0xce;}_0x4e0944[_0x0eef('0x1a')](_0x137c33);return _0x4e0944[_0x0eef('0x20')](_0x0eef('0x21'),_0x42095b+'-'+_0x349deb+'/'+_0x4891eb)[_0x0eef('0x1b')](_0x939926);}return null;};}function saveUpdates(_0x49fa1f){return function(_0x6c0726){if(_0x6c0726){return _0x6c0726[_0x0eef('0x22')](_0x49fa1f)[_0x0eef('0x23')](function(_0x3c618a){return _0x3c618a;});}return null;};}function removeEntity(_0x593393){return function(_0x5c3315){if(_0x5c3315){return _0x5c3315['destroy']()[_0x0eef('0x23')](function(){_0x593393[_0x0eef('0x1a')](0xcc)[_0x0eef('0x24')]();});}};}function handleEntityNotFound(_0x57a384){return function(_0x400414){if(!_0x400414){_0x57a384[_0x0eef('0x25')](0x194);}return _0x400414;};}function handleError(_0x6947de,_0x24609e){_0x24609e=_0x24609e||0x1f4;return function(_0x2c36ef){logger[_0x0eef('0x16')](_0x2c36ef[_0x0eef('0x26')]);if(_0x2c36ef[_0x0eef('0x27')]){delete _0x2c36ef[_0x0eef('0x27')];}_0x6947de['status'](_0x24609e)['send'](_0x2c36ef);};}exports[_0x0eef('0x28')]=function(_0x49552b,_0x4152e8){var _0x2bfbdf={},_0x460e10={},_0x219e0f={'count':0x0,'rows':[]};var _0x270adc=_[_0x0eef('0x29')](db[_0x0eef('0x2a')][_0x0eef('0x2b')],function(_0x11c5da){return{'name':_0x11c5da[_0x0eef('0x2c')],'type':_0x11c5da['type'][_0x0eef('0x2d')]};});_0x460e10['model']=_['map'](_0x270adc,_0x0eef('0x27'));_0x460e10[_0x0eef('0x2e')]=_[_0x0eef('0x2f')](_0x49552b[_0x0eef('0x2e')]);_0x460e10['filters']=_['intersection'](_0x460e10['model'],_0x460e10['query']);_0x2bfbdf['attributes']=_[_0x0eef('0x30')](_0x460e10[_0x0eef('0x31')],qs[_0x0eef('0x32')](_0x49552b[_0x0eef('0x2e')][_0x0eef('0x32')]));_0x2bfbdf[_0x0eef('0x33')]=_0x2bfbdf[_0x0eef('0x33')][_0x0eef('0x34')]?_0x2bfbdf[_0x0eef('0x33')]:_0x460e10[_0x0eef('0x31')];if(!_0x49552b[_0x0eef('0x2e')]['hasOwnProperty']('nolimit')){_0x2bfbdf['limit']=qs[_0x0eef('0x1f')](_0x49552b['query'][_0x0eef('0x1f')]);_0x2bfbdf['offset']=qs[_0x0eef('0x1c')](_0x49552b[_0x0eef('0x2e')][_0x0eef('0x1c')]);}_0x2bfbdf['order']=qs[_0x0eef('0x35')](_0x49552b[_0x0eef('0x2e')][_0x0eef('0x35')]);_0x2bfbdf[_0x0eef('0x36')]=qs[_0x0eef('0x37')](_[_0x0eef('0x38')](_0x49552b['query'],_0x460e10[_0x0eef('0x37')]),_0x270adc);if(_0x49552b[_0x0eef('0x2e')][_0x0eef('0x39')]){_0x2bfbdf['where']=_[_0x0eef('0x3a')](_0x2bfbdf[_0x0eef('0x36')],{'$or':_[_0x0eef('0x29')](_0x270adc,function(_0x4e7ba5){if(_0x4e7ba5['type']!==_0x0eef('0x3b')){var _0x5962e0={};_0x5962e0[_0x4e7ba5[_0x0eef('0x27')]]={'$like':'%'+_0x49552b[_0x0eef('0x2e')][_0x0eef('0x39')]+'%'};return _0x5962e0;}})});}_0x2bfbdf=_[_0x0eef('0x3a')]({},_0x2bfbdf,_0x49552b[_0x0eef('0x3c')]);var _0x491ee7={'where':_0x2bfbdf['where']};return db[_0x0eef('0x2a')][_0x0eef('0x1e')](_0x491ee7)[_0x0eef('0x23')](function(_0x122bb0){_0x219e0f[_0x0eef('0x1e')]=_0x122bb0;if(_0x49552b[_0x0eef('0x2e')][_0x0eef('0x3d')]){_0x2bfbdf[_0x0eef('0x3e')]=[{'all':!![]}];}return db[_0x0eef('0x2a')]['findAll'](_0x2bfbdf);})[_0x0eef('0x23')](function(_0x3de309){_0x219e0f[_0x0eef('0x3f')]=_0x3de309;return _0x219e0f;})[_0x0eef('0x23')](respondWithFilteredResult(_0x4152e8,_0x2bfbdf))[_0x0eef('0x40')](handleError(_0x4152e8,null));};exports[_0x0eef('0x41')]=function(_0x42d5a4,_0x2ad2fc){var _0x57fcf5={'raw':!![],'where':{'id':_0x42d5a4[_0x0eef('0x42')]['id']}},_0x4fbaf0={};_0x4fbaf0['model']=_[_0x0eef('0x2f')](db[_0x0eef('0x2a')][_0x0eef('0x2b')]);_0x4fbaf0[_0x0eef('0x2e')]=_[_0x0eef('0x2f')](_0x42d5a4['query']);_0x4fbaf0[_0x0eef('0x37')]=_[_0x0eef('0x30')](_0x4fbaf0[_0x0eef('0x31')],_0x4fbaf0[_0x0eef('0x2e')]);_0x57fcf5[_0x0eef('0x33')]=_[_0x0eef('0x30')](_0x4fbaf0['model'],qs[_0x0eef('0x32')](_0x42d5a4[_0x0eef('0x2e')][_0x0eef('0x32')]));_0x57fcf5[_0x0eef('0x33')]=_0x57fcf5[_0x0eef('0x33')][_0x0eef('0x34')]?_0x57fcf5[_0x0eef('0x33')]:_0x4fbaf0['model'];if(_0x42d5a4[_0x0eef('0x2e')][_0x0eef('0x3d')]){_0x57fcf5[_0x0eef('0x3e')]=[{'all':!![]}];}_0x57fcf5=_[_0x0eef('0x3a')]({},_0x57fcf5,_0x42d5a4[_0x0eef('0x3c')]);return db[_0x0eef('0x2a')][_0x0eef('0x43')](_0x57fcf5)[_0x0eef('0x23')](handleEntityNotFound(_0x2ad2fc,null))[_0x0eef('0x23')](respondWithResult(_0x2ad2fc,null))[_0x0eef('0x40')](handleError(_0x2ad2fc,null));};exports[_0x0eef('0x44')]=function(_0x33a372,_0x28ec88){return db[_0x0eef('0x2a')]['create'](_0x33a372[_0x0eef('0x45')],{})[_0x0eef('0x23')](respondWithResult(_0x28ec88,0xc9))[_0x0eef('0x40')](handleError(_0x28ec88,null));};exports[_0x0eef('0x22')]=function(_0xb0a73,_0x166c27){if(_0xb0a73['body']['id']){delete _0xb0a73[_0x0eef('0x45')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0xb0a73[_0x0eef('0x42')]['id']}})[_0x0eef('0x23')](handleEntityNotFound(_0x166c27,null))['then'](saveUpdates(_0xb0a73[_0x0eef('0x45')],null))['then'](respondWithResult(_0x166c27,null))[_0x0eef('0x40')](handleError(_0x166c27,null));};exports[_0x0eef('0x46')]=function(_0x4842f3,_0x2c1c21){return db['OpenchannelMessage']['find']({'where':{'id':_0x4842f3[_0x0eef('0x42')]['id']}})[_0x0eef('0x23')](handleEntityNotFound(_0x2c1c21,null))[_0x0eef('0x23')](removeEntity(_0x2c1c21,null))['catch'](handleError(_0x2c1c21,null));};exports[_0x0eef('0x47')]=function(_0x36825a,_0x14ef25){return db['OpenchannelMessage'][_0x0eef('0x47')]()[_0x0eef('0x23')](respondWithResult(_0x14ef25,null))[_0x0eef('0x40')](handleError(_0x14ef25,null));};exports[_0x0eef('0x48')]=function(_0x307266,_0x53877a){var _0xbbdcdd=_0x0eef('0x49');return interactionService[_0x0eef('0x4a')](_0x307266,_0xbbdcdd)[_0x0eef('0x23')](respondWithResult(_0x53877a,null))[_0x0eef('0x40')](handleError(_0x53877a,null));};exports[_0x0eef('0x4b')]=function(_0x40aad5,_0x26f8d5){var _0x5461de={'agent':{},'channel':_0x0eef('0x49')};if(_0x40aad5['body']['id']){delete _0x40aad5['body']['id'];}_0x40aad5['body'][_0x0eef('0x4c')]=_0x40aad5[_0x0eef('0x45')][_0x0eef('0x4c')]||_0x40aad5[_0x0eef('0x4d')]['id'];_0x5461de['agent']['id']=_0x40aad5[_0x0eef('0x45')]['UserId'];return db['OpenchannelMessage'][_0x0eef('0x43')]({'where':{'id':_0x40aad5[_0x0eef('0x42')]['id'],'UserId':null}})[_0x0eef('0x23')](handleEntityNotFound(_0x26f8d5,null))[_0x0eef('0x23')](function(_0x474461){if(_0x474461){_0x5461de[_0x0eef('0x18')]=_0x474461['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x0eef('0x43')]({'where':{'id':_0x474461[_0x0eef('0x4e')]}});}return null;})[_0x0eef('0x23')](handleEntityNotFound(_0x26f8d5,null))[_0x0eef('0x23')](function(_0x503dd5){if(_0x503dd5){_0x5461de['interaction']=_0x503dd5[_0x0eef('0x4f')]({'plain':!![]});interaction_log['info'](_0x0eef('0x50'),_0x40aad5[_0x0eef('0x4d')]['id'],_0x40aad5[_0x0eef('0x4d')][_0x0eef('0x27')],_0x40aad5[_0x0eef('0x4d')][_0x0eef('0x51')],_0x5461de[_0x0eef('0x52')]['id'],_0x40aad5['body']?JSON[_0x0eef('0x15')](_0x40aad5[_0x0eef('0x45')]):'null');return respondWithRpcPromise(_0x0eef('0x53'),_0x0eef('0x54'),_0x5461de);}return null;})[_0x0eef('0x23')](function(_0x307c3f){var _0x1d1d27=_0x0eef('0x55')+_0x307c3f[_0x0eef('0x18')][_0x0eef('0x56')];return db['sequelize'][_0x0eef('0x2e')](_0x1d1d27,{'type':db[_0x0eef('0x57')][_0x0eef('0x58')]['SELECT'],'raw':!![]})[_0x0eef('0x23')](function(_0xaed919){return _0xaed919;});})[_0x0eef('0x23')](function(_0x14e4cf){if(_0x14e4cf){_0x5461de[_0x0eef('0x18')][_0x0eef('0x59')]=_0x14e4cf[0x0];if(!_0x40aad5[_0x0eef('0x45')][_0x0eef('0x4c')])return;return db[_0x0eef('0x5a')][_0x0eef('0x43')]({'where':{'id':_0x40aad5['body'][_0x0eef('0x4c')],'role':'agent'},'attributes':['id',_0x0eef('0x27'),_0x0eef('0x5b'),_0x0eef('0x5c'),_0x0eef('0x5d')],'raw':!![]});}return null;})['then'](function(_0x20cac8){if(!_0x20cac8)return null;_0x5461de[_0x0eef('0x18')][_0x0eef('0x5e')]=_0x20cac8;return _0x5461de;})[_0x0eef('0x23')](function(_0x31fc8a){if(_0x31fc8a){_0x31fc8a['message'][_0x0eef('0x5f')]=util[_0x0eef('0x60')](_0x0eef('0x61'),_0x40aad5['user']['name']);_0x31fc8a['message'][_0x0eef('0x62')]=_0x5461de[_0x0eef('0x62')];_0x31fc8a[_0x0eef('0x18')][_0x0eef('0x63')]=_0x5461de['channel'];_0x31fc8a[_0x0eef('0x18')][_0x0eef('0x64')]=_0x0eef('0x4b');respondWithRpcPromise('EventManager',_0x0eef('0x65'),{'event':_0x0eef('0x66'),'message':_0x31fc8a[_0x0eef('0x18')]},client9002);return _0x5461de;}return null;})[_0x0eef('0x23')](respondWithResult(_0x26f8d5,null))[_0x0eef('0x40')](handleError(_0x26f8d5,null));}; \ No newline at end of file +var _0xd0e0=['channel','reject','EventManager','rejectmessage','util','lodash','ioredis','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','../../config/logger','openchannel-interactions','request','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','json','offset','undefined','count','Content-Range','update','then','destroy','status','end','name','send','index','map','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','OpenchannelMessage','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','describe','accept','openchannel','acceptMessage','UserId','agent','get','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','RejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','interface','format','SIP/%s'];(function(_0x49c890,_0x15e07f){var _0x310738=function(_0x3c604e){while(--_0x3c604e){_0x49c890['push'](_0x49c890['shift']());}};_0x310738(++_0x15e07f);}(_0xd0e0,0x66));var _0x0d0e=function(_0x88764f,_0x22546f){_0x88764f=_0x88764f-0x0;var _0x2d0461=_0xd0e0[_0x88764f];return _0x2d0461;};'use strict';var util=require(_0x0d0e('0x0'));var _=require(_0x0d0e('0x1'));var Redis=require(_0x0d0e('0x2'));var interactionService=require('../../components/interaction/service');var qs=require(_0x0d0e('0x3'));var logger=require('../../config/logger')('api');var config=require(_0x0d0e('0x4'));var db=require(_0x0d0e('0x5'))['db'];config[_0x0d0e('0x6')]=_['defaults'](config['redis'],{'host':_0x0d0e('0x7'),'port':0x18eb});var socket=require(_0x0d0e('0x8'))(new Redis(config[_0x0d0e('0x6')]));require(_0x0d0e('0x9'))['register'](socket);var jayson=require(_0x0d0e('0xa'));var client=jayson[_0x0d0e('0xb')][_0x0d0e('0xc')]({'port':0x232c});var client9002=jayson[_0x0d0e('0xb')][_0x0d0e('0xc')]({'port':0x232a});var interaction_log=require(_0x0d0e('0xd'))(_0x0d0e('0xe'));function respondWithRpcPromise(_0x310bd9,_0x19f64d,_0x1f7f94,_0x4e34da){return new Promise(function(_0x5ad4a0,_0x3c0735){var _0x2221dc=_0x4e34da||client;return _0x2221dc[_0x0d0e('0xf')](_0x310bd9,_0x1f7f94)['then'](function(_0x350fd7){logger[_0x0d0e('0x10')](_0x0d0e('0x11'),_0x19f64d,_0x0d0e('0x12'));logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x19f64d,'request\x20sent',JSON[_0x0d0e('0x13')](_0x350fd7));if(_0x350fd7['error']){if(_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x15')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x19f64d,_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);return _0x3c0735(_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);}logger[_0x0d0e('0x14')]('OpenchannelMessage,\x20%s,\x20%s',_0x19f64d,_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);return _0x5ad4a0(_0x350fd7[_0x0d0e('0x14')][_0x0d0e('0x16')]);}else{logger[_0x0d0e('0x10')](_0x0d0e('0x11'),_0x19f64d,_0x0d0e('0x12'));_0x5ad4a0(_0x350fd7[_0x0d0e('0x17')][_0x0d0e('0x16')]);}})['catch'](function(_0x89012a){logger['error'](_0x0d0e('0x11'),_0x19f64d,_0x89012a);_0x3c0735(_0x89012a);});});}function respondWithResult(_0x4aef62,_0x199eda){_0x199eda=_0x199eda||0xc8;return function(_0x238daa){if(_0x238daa){return _0x4aef62['status'](_0x199eda)[_0x0d0e('0x18')](_0x238daa);}};}function respondWithFilteredResult(_0x584d68,_0x355166){return function(_0x1527de){if(_0x1527de){var _0x452271=typeof _0x355166[_0x0d0e('0x19')]===_0x0d0e('0x1a')&&typeof _0x355166['limit']===_0x0d0e('0x1a');var _0x5066e5=_0x1527de[_0x0d0e('0x1b')];var _0x47cc14=_0x452271?0x0:_0x355166['offset'];var _0x1f1d9c=_0x452271?_0x1527de[_0x0d0e('0x1b')]:_0x355166[_0x0d0e('0x19')]+_0x355166['limit'];var _0x8a6f0d;if(_0x1f1d9c>=_0x5066e5){_0x1f1d9c=_0x5066e5;_0x8a6f0d=0xc8;}else{_0x8a6f0d=0xce;}_0x584d68['status'](_0x8a6f0d);return _0x584d68['set'](_0x0d0e('0x1c'),_0x47cc14+'-'+_0x1f1d9c+'/'+_0x5066e5)[_0x0d0e('0x18')](_0x1527de);}return null;};}function saveUpdates(_0x16ce96){return function(_0x2a79d3){if(_0x2a79d3){return _0x2a79d3[_0x0d0e('0x1d')](_0x16ce96)[_0x0d0e('0x1e')](function(_0x44c1d5){return _0x44c1d5;});}return null;};}function removeEntity(_0x4f7b46){return function(_0x137497){if(_0x137497){return _0x137497[_0x0d0e('0x1f')]()[_0x0d0e('0x1e')](function(){_0x4f7b46[_0x0d0e('0x20')](0xcc)[_0x0d0e('0x21')]();});}};}function handleEntityNotFound(_0x7a5237){return function(_0xe4ba2d){if(!_0xe4ba2d){_0x7a5237['sendStatus'](0x194);}return _0xe4ba2d;};}function handleError(_0x5dd496,_0x34c443){_0x34c443=_0x34c443||0x1f4;return function(_0x33f42b){logger[_0x0d0e('0x14')](_0x33f42b['stack']);if(_0x33f42b[_0x0d0e('0x22')]){delete _0x33f42b[_0x0d0e('0x22')];}_0x5dd496[_0x0d0e('0x20')](_0x34c443)[_0x0d0e('0x23')](_0x33f42b);};}exports[_0x0d0e('0x24')]=function(_0x96456f,_0x147dc9){var _0x290448={},_0x2e54bc={},_0x2608be={'count':0x0,'rows':[]};var _0x50fee4=_[_0x0d0e('0x25')](db['OpenchannelMessage']['rawAttributes'],function(_0x3193fb){return{'name':_0x3193fb['fieldName'],'type':_0x3193fb[_0x0d0e('0x26')][_0x0d0e('0x27')]};});_0x2e54bc['model']=_[_0x0d0e('0x25')](_0x50fee4,_0x0d0e('0x22'));_0x2e54bc[_0x0d0e('0x28')]=_[_0x0d0e('0x29')](_0x96456f[_0x0d0e('0x28')]);_0x2e54bc[_0x0d0e('0x2a')]=_[_0x0d0e('0x2b')](_0x2e54bc[_0x0d0e('0x2c')],_0x2e54bc[_0x0d0e('0x28')]);_0x290448[_0x0d0e('0x2d')]=_[_0x0d0e('0x2b')](_0x2e54bc[_0x0d0e('0x2c')],qs[_0x0d0e('0x2e')](_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x2e')]));_0x290448[_0x0d0e('0x2d')]=_0x290448[_0x0d0e('0x2d')][_0x0d0e('0x2f')]?_0x290448[_0x0d0e('0x2d')]:_0x2e54bc[_0x0d0e('0x2c')];if(!_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x30')](_0x0d0e('0x31'))){_0x290448['limit']=qs['limit'](_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x32')]);_0x290448['offset']=qs[_0x0d0e('0x19')](_0x96456f['query'][_0x0d0e('0x19')]);}_0x290448['order']=qs[_0x0d0e('0x33')](_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x33')]);_0x290448[_0x0d0e('0x34')]=qs[_0x0d0e('0x2a')](_['pick'](_0x96456f[_0x0d0e('0x28')],_0x2e54bc[_0x0d0e('0x2a')]),_0x50fee4);if(_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x35')]){_0x290448[_0x0d0e('0x34')]=_[_0x0d0e('0x36')](_0x290448[_0x0d0e('0x34')],{'$or':_[_0x0d0e('0x25')](_0x50fee4,function(_0x2c7de4){if(_0x2c7de4[_0x0d0e('0x26')]!==_0x0d0e('0x37')){var _0x538764={};_0x538764[_0x2c7de4[_0x0d0e('0x22')]]={'$like':'%'+_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x35')]+'%'};return _0x538764;}})});}_0x290448=_[_0x0d0e('0x36')]({},_0x290448,_0x96456f['options']);var _0x4a7005={'where':_0x290448[_0x0d0e('0x34')]};return db[_0x0d0e('0x38')][_0x0d0e('0x1b')](_0x4a7005)[_0x0d0e('0x1e')](function(_0xf05d0b){_0x2608be[_0x0d0e('0x1b')]=_0xf05d0b;if(_0x96456f[_0x0d0e('0x28')][_0x0d0e('0x39')]){_0x290448[_0x0d0e('0x3a')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x0d0e('0x3b')](_0x290448);})[_0x0d0e('0x1e')](function(_0x44c66e){_0x2608be[_0x0d0e('0x3c')]=_0x44c66e;return _0x2608be;})[_0x0d0e('0x1e')](respondWithFilteredResult(_0x147dc9,_0x290448))[_0x0d0e('0x3d')](handleError(_0x147dc9,null));};exports[_0x0d0e('0x3e')]=function(_0x186aa,_0x3fe15f){var _0x57d9ac={'raw':!![],'where':{'id':_0x186aa[_0x0d0e('0x3f')]['id']}},_0x2e2631={};_0x2e2631[_0x0d0e('0x2c')]=_['keys'](db[_0x0d0e('0x38')]['rawAttributes']);_0x2e2631[_0x0d0e('0x28')]=_['keys'](_0x186aa[_0x0d0e('0x28')]);_0x2e2631[_0x0d0e('0x2a')]=_['intersection'](_0x2e2631[_0x0d0e('0x2c')],_0x2e2631['query']);_0x57d9ac[_0x0d0e('0x2d')]=_[_0x0d0e('0x2b')](_0x2e2631[_0x0d0e('0x2c')],qs[_0x0d0e('0x2e')](_0x186aa[_0x0d0e('0x28')][_0x0d0e('0x2e')]));_0x57d9ac[_0x0d0e('0x2d')]=_0x57d9ac[_0x0d0e('0x2d')]['length']?_0x57d9ac[_0x0d0e('0x2d')]:_0x2e2631[_0x0d0e('0x2c')];if(_0x186aa[_0x0d0e('0x28')]['includeAll']){_0x57d9ac['include']=[{'all':!![]}];}_0x57d9ac=_[_0x0d0e('0x36')]({},_0x57d9ac,_0x186aa[_0x0d0e('0x40')]);return db['OpenchannelMessage']['find'](_0x57d9ac)['then'](handleEntityNotFound(_0x3fe15f,null))[_0x0d0e('0x1e')](respondWithResult(_0x3fe15f,null))[_0x0d0e('0x3d')](handleError(_0x3fe15f,null));};exports[_0x0d0e('0x41')]=function(_0x40079a,_0x39c61b){return db[_0x0d0e('0x38')]['create'](_0x40079a[_0x0d0e('0x42')],{})[_0x0d0e('0x1e')](respondWithResult(_0x39c61b,0xc9))[_0x0d0e('0x3d')](handleError(_0x39c61b,null));};exports['update']=function(_0x26e579,_0x441099){if(_0x26e579[_0x0d0e('0x42')]['id']){delete _0x26e579[_0x0d0e('0x42')]['id'];}return db['OpenchannelMessage'][_0x0d0e('0x43')]({'where':{'id':_0x26e579[_0x0d0e('0x3f')]['id']}})[_0x0d0e('0x1e')](handleEntityNotFound(_0x441099,null))[_0x0d0e('0x1e')](saveUpdates(_0x26e579['body'],null))[_0x0d0e('0x1e')](respondWithResult(_0x441099,null))['catch'](handleError(_0x441099,null));};exports['destroy']=function(_0xda3505,_0x9b670d){return db[_0x0d0e('0x38')]['find']({'where':{'id':_0xda3505[_0x0d0e('0x3f')]['id']}})[_0x0d0e('0x1e')](handleEntityNotFound(_0x9b670d,null))[_0x0d0e('0x1e')](removeEntity(_0x9b670d,null))[_0x0d0e('0x3d')](handleError(_0x9b670d,null));};exports[_0x0d0e('0x44')]=function(_0x1c417f,_0x5da8e6){return db[_0x0d0e('0x38')][_0x0d0e('0x44')]()['then'](respondWithResult(_0x5da8e6,null))['catch'](handleError(_0x5da8e6,null));};exports[_0x0d0e('0x45')]=function(_0x4cadb4,_0x58f183){var _0x5a4962=_0x0d0e('0x46');return interactionService[_0x0d0e('0x47')](_0x4cadb4,_0x5a4962)['then'](respondWithResult(_0x58f183,null))[_0x0d0e('0x3d')](handleError(_0x58f183,null));};exports['reject']=function(_0x85c085,_0xa86697){var _0x5decfb={'agent':{},'channel':'openchannel'};if(_0x85c085[_0x0d0e('0x42')]['id']){delete _0x85c085[_0x0d0e('0x42')]['id'];}_0x85c085['body'][_0x0d0e('0x48')]=_0x85c085[_0x0d0e('0x42')][_0x0d0e('0x48')]||_0x85c085['user']['id'];_0x5decfb[_0x0d0e('0x49')]['id']=_0x85c085[_0x0d0e('0x42')][_0x0d0e('0x48')];return db[_0x0d0e('0x38')]['find']({'where':{'id':_0x85c085[_0x0d0e('0x3f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xa86697,null))[_0x0d0e('0x1e')](function(_0x1f0717){if(_0x1f0717){_0x5decfb[_0x0d0e('0x16')]=_0x1f0717[_0x0d0e('0x4a')]({'plain':!![]});return db[_0x0d0e('0x4b')][_0x0d0e('0x43')]({'where':{'id':_0x1f0717[_0x0d0e('0x4c')]}});}return null;})['then'](handleEntityNotFound(_0xa86697,null))[_0x0d0e('0x1e')](function(_0x571775){if(_0x571775){_0x5decfb['interaction']=_0x571775[_0x0d0e('0x4a')]({'plain':!![]});interaction_log[_0x0d0e('0x10')](_0x0d0e('0x4d'),_0x85c085[_0x0d0e('0x4e')]['id'],_0x85c085['user'][_0x0d0e('0x22')],_0x85c085[_0x0d0e('0x4e')][_0x0d0e('0x4f')],_0x5decfb['interaction']['id'],_0x85c085[_0x0d0e('0x42')]?JSON[_0x0d0e('0x13')](_0x85c085[_0x0d0e('0x42')]):_0x0d0e('0x50'));return respondWithRpcPromise(_0x0d0e('0x51'),'rejectMessage',_0x5decfb);}return null;})[_0x0d0e('0x1e')](function(_0x454b23){var _0x28b17c=_0x0d0e('0x52')+_0x454b23[_0x0d0e('0x16')][_0x0d0e('0x53')];return db['sequelize'][_0x0d0e('0x28')](_0x28b17c,{'type':db[_0x0d0e('0x54')][_0x0d0e('0x55')][_0x0d0e('0x56')],'raw':!![]})[_0x0d0e('0x1e')](function(_0x5f31cc){return _0x5f31cc;});})['then'](function(_0x395a17){if(_0x395a17){_0x5decfb[_0x0d0e('0x16')][_0x0d0e('0x57')]=_0x395a17[0x0];if(!_0x85c085['body'][_0x0d0e('0x48')])return;return db['User'][_0x0d0e('0x43')]({'where':{'id':_0x85c085['body']['UserId'],'role':'agent'},'attributes':['id',_0x0d0e('0x22'),_0x0d0e('0x58'),_0x0d0e('0x59'),_0x0d0e('0x5a')],'raw':!![]});}return null;})[_0x0d0e('0x1e')](function(_0x544955){if(!_0x544955)return null;_0x5decfb[_0x0d0e('0x16')][_0x0d0e('0x49')]=_0x544955;return _0x5decfb;})[_0x0d0e('0x1e')](function(_0x13e75f){if(_0x13e75f){_0x13e75f[_0x0d0e('0x16')][_0x0d0e('0x5b')]=util[_0x0d0e('0x5c')](_0x0d0e('0x5d'),_0x85c085[_0x0d0e('0x4e')]['name']);_0x13e75f[_0x0d0e('0x16')][_0x0d0e('0x5e')]=_0x5decfb['channel'];_0x13e75f[_0x0d0e('0x16')]['motionChannel']=_0x5decfb[_0x0d0e('0x5e')];_0x13e75f[_0x0d0e('0x16')]['event']=_0x0d0e('0x5f');respondWithRpcPromise(_0x0d0e('0x60'),'EventManager',{'event':_0x0d0e('0x61'),'message':_0x13e75f['message']},client9002);return _0x5decfb;}return null;})[_0x0d0e('0x1e')](respondWithResult(_0xa86697,null))[_0x0d0e('0x3d')](handleError(_0xa86697,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 06abc52..1ae2413 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 _0x7790=['events','../../mysqldb','OpenchannelMessage','save','update','emit','exports'];(function(_0x26371f,_0x3529d6){var _0x7bf77f=function(_0xaaf7ec){while(--_0xaaf7ec){_0x26371f['push'](_0x26371f['shift']());}};_0x7bf77f(++_0x3529d6);}(_0x7790,0x10a));var _0x0779=function(_0x151d3a,_0x485697){_0x151d3a=_0x151d3a-0x0;var _0x3b5c29=_0x7790[_0x151d3a];return _0x3b5c29;};'use strict';var EventEmitter=require(_0x0779('0x0'));var OpenchannelMessage=require(_0x0779('0x1'))['db'][_0x0779('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0779('0x3'),'afterUpdate':_0x0779('0x4'),'afterDestroy':'remove'};function emitEvent(_0x39266a){return function(_0x56ce83,_0x43485f,_0x194023){OpenchannelMessageEvents[_0x0779('0x5')](_0x39266a+':'+_0x56ce83['id'],_0x56ce83);OpenchannelMessageEvents[_0x0779('0x5')](_0x39266a,_0x56ce83);_0x194023(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0x0779('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x375c=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove'];(function(_0x574617,_0x42eccc){var _0x29de90=function(_0x367aff){while(--_0x367aff){_0x574617['push'](_0x574617['shift']());}};_0x29de90(++_0x42eccc);}(_0x375c,0x159));var _0xc375=function(_0x99f205,_0x3ac6cd){_0x99f205=_0x99f205-0x0;var _0x43d038=_0x375c[_0x99f205];return _0x43d038;};'use strict';var EventEmitter=require(_0xc375('0x0'));var OpenchannelMessage=require(_0xc375('0x1'))['db'][_0xc375('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc375('0x3')](0x0);var events={'afterCreate':_0xc375('0x4'),'afterUpdate':_0xc375('0x5'),'afterDestroy':_0xc375('0x6')};function emitEvent(_0x16ab1f){return function(_0xfd77a0,_0x2c875c,_0x3acc6c){OpenchannelMessageEvents[_0xc375('0x7')](_0x16ab1f+':'+_0xfd77a0['id'],_0xfd77a0);OpenchannelMessageEvents['emit'](_0x16ab1f,_0xfd77a0);_0x3acc6c(null);};}for(var e in events){if(events[_0xc375('0x8')](e)){var event=events[e];OpenchannelMessage[_0xc375('0x9')](e,emitEvent(event));}}module[_0xc375('0xa')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 9257cdd..5677896 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 _0x9548=['OpenchannelInteractionId','then','createdAt','catch','error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','POST','method','GET','body','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','lodash','util','api','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9548,0xb3));var _0x8954=function(_0x1d675d,_0xe64d4e){_0x1d675d=_0x1d675d-0x0;var _0x134ec8=_0x9548[_0x1d675d];return _0x134ec8;};'use strict';var _=require(_0x8954('0x0'));var util=require(_0x8954('0x1'));var logger=require('../../config/logger')(_0x8954('0x2'));var moment=require(_0x8954('0x3'));var BPromise=require(_0x8954('0x4'));var rp=require(_0x8954('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8954('0x6'));var config=require('../../config/environment');var attributes=require(_0x8954('0x7'));module[_0x8954('0x8')]=function(_0x4e7872,_0x4dde0d){return _0x4e7872[_0x8954('0x9')](_0x8954('0xa'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x8954('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x57abc7,_0x47ce81,_0x4dbe97){var _0x3cd5da=_0x4e7872[_0x8954('0xc')];var _0x2799b2=_0x57abc7[_0x8954('0xd')]({'plain':!![]});if(_0x2799b2[_0x8954('0xe')]['toLowerCase']()==='in'||_0x2799b2[_0x8954('0xe')][_0x8954('0xf')]()===_0x8954('0x10')&&!_0x2799b2[_0x8954('0x11')]&&!_['isNil'](_0x2799b2[_0x8954('0x12')])){_0x3cd5da[_0x8954('0x13')][_0x8954('0x14')]({'where':{'id':_0x2799b2[_0x8954('0x15')]}})[_0x8954('0x16')](function(_0x24a709){if(_0x24a709){_0x24a709['update']({'lastMsgAt':_0x2799b2[_0x8954('0x17')],'lastMsgDirection':_0x2799b2[_0x8954('0xe')][_0x8954('0xf')]()});}})[_0x8954('0x18')](function(_0x125f60){console[_0x8954('0x19')](_0x125f60);});}if(_0x2799b2[_0x8954('0xe')]===_0x8954('0x10')&&!_0x2799b2[_0x8954('0x11')]){var _0x142d56;_0x3cd5da[_0x8954('0x1a')][_0x8954('0x1b')]()[_0x8954('0x16')](function(_0x1a4795){return _0x3cd5da[_0x8954('0x1c')][_0x8954('0x1d')]({'where':{'id':_0x2799b2[_0x8954('0x1e')]},'include':[{'model':_0x3cd5da[_0x8954('0x13')],'as':_0x8954('0x1f'),'where':{'id':_0x2799b2[_0x8954('0x15')]},'limit':0x1,'include':[{'model':_0x3cd5da[_0x8954('0x1a')],'as':_0x8954('0x20'),'attributes':_['keys'](_0x1a4795)}]}]});})['then'](function(_0xcdde40){_0x142d56=_0xcdde40[_0x8954('0xd')]({'plain':!![]});if(_0x142d56&&_0x142d56['replyUri']){logger['info'](_0x8954('0x21'),'afterCreate',util[_0x8954('0x22')](_0x8954('0x23'),_0x2799b2['id'],_0x142d56[_0x8954('0x24')]));if(_0x142d56[_0x8954('0x1f')]&&_0x142d56[_0x8954('0x1f')][_0x8954('0x25')]){_0x2799b2[_0x8954('0x26')]=_['omit'](_0x142d56['Interactions'][0x0],_0x8954('0x20'));_0x2799b2[_0x8954('0x20')]=_0x142d56[_0x8954('0x1f')][0x0]['Contact'];}var _0x47ce81={'method':_0x8954('0x27'),'uri':encodeURI(_0x142d56[_0x8954('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x47ce81[_0x8954('0x28')]){case _0x8954('0x29'):_0x47ce81['qs']=_0x2799b2;break;case _0x8954('0x27'):_0x47ce81[_0x8954('0x2a')]=_0x2799b2;break;}return rp(_0x47ce81)[_0x8954('0x16')](function(_0x3a3518){logger[_0x8954('0x2b')](_0x8954('0x21'),_0x8954('0x2c'),util[_0x8954('0x22')](_0x8954('0x2d'),_0x2799b2['id'],_0x142d56['replyUri']));if(_0x3a3518['body'][_0x8954('0x2e')]&&_0x3a3518[_0x8954('0x2a')][_0x8954('0x2e')]!=_0x2799b2[_0x8954('0x26')]['threadId']){return _0x3cd5da[_0x8954('0x13')]['update']({'threadId':_0x3a3518[_0x8954('0x2a')][_0x8954('0x2e')]},{'where':{'id':_0x2799b2['Interaction']['id']}});}else{return;}})[_0x8954('0x16')](function(){return _0x57abc7[_0x8954('0x2f')]({'read':!![]});})[_0x8954('0x18')](function(_0x1a8c12){logger[_0x8954('0x19')]('OpenchannelMessage,\x20%s,\x20%s',_0x8954('0x2c'),util[_0x8954('0x30')](_0x1a8c12,{'showHidden':![],'depth':null}));_0x4dbe97();});}else{_0x4dbe97();}})[_0x8954('0x31')](function(){_0x4dbe97();});}else{_0x4dbe97();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x38fb=['Interactions','length','Interaction','omit','POST','method','GET','info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','findOne','then','update','createdAt','catch','error','CmContact','find','OpenchannelInteractionId','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s'];(function(_0x91d019,_0x5223c4){var _0x19de1f=function(_0x3e1311){while(--_0x3e1311){_0x91d019['push'](_0x91d019['shift']());}};_0x19de1f(++_0x5223c4);}(_0x38fb,0xa5));var _0xb38f=function(_0x513254,_0x1305ca){_0x513254=_0x513254-0x0;var _0x384c92=_0x38fb[_0x513254];return _0x384c92;};'use strict';var _=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var logger=require(_0xb38f('0x2'))(_0xb38f('0x3'));var moment=require(_0xb38f('0x4'));var BPromise=require(_0xb38f('0x5'));var rp=require(_0xb38f('0x6'));var fs=require('fs');var path=require(_0xb38f('0x7'));var rimraf=require('rimraf');var config=require(_0xb38f('0x8'));var attributes=require(_0xb38f('0x9'));module[_0xb38f('0xa')]=function(_0x5b8615,_0x3c2051){return _0x5b8615[_0xb38f('0xb')](_0xb38f('0xc'),attributes,{'tableName':_0xb38f('0xd'),'paranoid':![],'indexes':[{'name':_0xb38f('0xe'),'fields':[_0xb38f('0xf')],'type':_0xb38f('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5a09d1,_0xe65e24,_0x1dc055){var _0x32c409=_0x5b8615['models'];var _0x242ca1=_0x5a09d1['get']({'plain':!![]});if(_0x242ca1[_0xb38f('0x11')][_0xb38f('0x12')]()==='in'||_0x242ca1[_0xb38f('0x11')]['toLowerCase']()===_0xb38f('0x13')&&!_0x242ca1[_0xb38f('0x14')]&&!_[_0xb38f('0x15')](_0x242ca1['UserId'])){_0x32c409[_0xb38f('0x16')][_0xb38f('0x17')]({'where':{'id':_0x242ca1['OpenchannelInteractionId']}})[_0xb38f('0x18')](function(_0x2d53f4){if(_0x2d53f4){_0x2d53f4[_0xb38f('0x19')]({'lastMsgAt':_0x242ca1[_0xb38f('0x1a')],'lastMsgDirection':_0x242ca1[_0xb38f('0x11')][_0xb38f('0x12')]()});}})[_0xb38f('0x1b')](function(_0x26c862){console[_0xb38f('0x1c')](_0x26c862);});}if(_0x242ca1[_0xb38f('0x11')]==='out'&&!_0x242ca1[_0xb38f('0x14')]){var _0x38742e;_0x32c409[_0xb38f('0x1d')]['describe']()[_0xb38f('0x18')](function(_0x3ad4dc){return _0x32c409['OpenchannelAccount'][_0xb38f('0x1e')]({'where':{'id':_0x242ca1['OpenchannelAccountId']},'include':[{'model':_0x32c409[_0xb38f('0x16')],'as':'Interactions','where':{'id':_0x242ca1[_0xb38f('0x1f')]},'limit':0x1,'include':[{'model':_0x32c409[_0xb38f('0x1d')],'as':_0xb38f('0x20'),'attributes':_[_0xb38f('0x21')](_0x3ad4dc)}]}]});})[_0xb38f('0x18')](function(_0x3dfe98){_0x38742e=_0x3dfe98[_0xb38f('0x22')]({'plain':!![]});if(_0x38742e&&_0x38742e[_0xb38f('0x23')]){logger['info'](_0xb38f('0x24'),_0xb38f('0x25'),util['format'](_0xb38f('0x26'),_0x242ca1['id'],_0x38742e['replyUri']));if(_0x38742e[_0xb38f('0x27')]&&_0x38742e[_0xb38f('0x27')][_0xb38f('0x28')]){_0x242ca1[_0xb38f('0x29')]=_[_0xb38f('0x2a')](_0x38742e['Interactions'][0x0],_0xb38f('0x20'));_0x242ca1['Contact']=_0x38742e[_0xb38f('0x27')][0x0][_0xb38f('0x20')];}var _0xe65e24={'method':_0xb38f('0x2b'),'uri':encodeURI(_0x38742e[_0xb38f('0x23')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0xe65e24[_0xb38f('0x2c')]){case _0xb38f('0x2d'):_0xe65e24['qs']=_0x242ca1;break;case _0xb38f('0x2b'):_0xe65e24[_0xb38f('0xf')]=_0x242ca1;break;}return rp(_0xe65e24)[_0xb38f('0x18')](function(_0x17d99c){logger[_0xb38f('0x2e')](_0xb38f('0x24'),_0xb38f('0x25'),util[_0xb38f('0x2f')](_0xb38f('0x30'),_0x242ca1['id'],_0x38742e['replyUri']));if(_0x17d99c['body'][_0xb38f('0x31')]&&_0x17d99c[_0xb38f('0xf')][_0xb38f('0x31')]!=_0x242ca1[_0xb38f('0x29')][_0xb38f('0x31')]){return _0x32c409[_0xb38f('0x16')][_0xb38f('0x19')]({'threadId':_0x17d99c[_0xb38f('0xf')][_0xb38f('0x31')]},{'where':{'id':_0x242ca1[_0xb38f('0x29')]['id']}});}else{return;}})[_0xb38f('0x18')](function(){return _0x5a09d1[_0xb38f('0x19')]({'read':!![]});})[_0xb38f('0x1b')](function(_0x3866fa){logger[_0xb38f('0x1c')](_0xb38f('0x24'),_0xb38f('0x25'),util['inspect'](_0x3866fa,{'showHidden':![],'depth':null}));_0x1dc055();});}else{_0x1dc055();}})['finally'](function(){_0x1dc055();});}else{_0x1dc055();}}},'charset':_0xb38f('0x32'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 37c838c..6234800 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 _0x7a54=['../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateOpenchannelMessage','OpenchannelMessage','body','options','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x58503e,_0x4cc2a5){var _0x52c1db=function(_0x2ba642){while(--_0x2ba642){_0x58503e['push'](_0x58503e['shift']());}};_0x52c1db(++_0x4cc2a5);}(_0x7a54,0x106));var _0x47a5=function(_0x295e76,_0x38ac2a){_0x295e76=_0x295e76-0x0;var _0x218b14=_0x7a54[_0x295e76];return _0x218b14;};'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});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./openchannelMessage.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('OpenchannelMessage,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});}exports[_0x47a5('0x1a')]=function(_0xe3c618){var _0x3aed38=this;return new Promise(function(_0x4a9fcb,_0x1570bc){return db[_0x47a5('0x1b')]['create'](_0xe3c618[_0x47a5('0x1c')],{'raw':_0xe3c618[_0x47a5('0x1d')]?_0xe3c618[_0x47a5('0x1d')]['raw']===undefined?!![]:![]:!![]})[_0x47a5('0xe')](function(_0x2f142b){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xe3c618);logger['debug'](_0x47a5('0x1a'),_0xe3c618,JSON[_0x47a5('0x14')](_0x2f142b));_0x4a9fcb(_0x2f142b);})['catch'](function(_0x28747d){logger[_0x47a5('0x15')](_0x47a5('0x1a'),_0x28747d[_0x47a5('0x17')],_0xe3c618);_0x1570bc(_0x3aed38[_0x47a5('0x15')](0x1f4,_0x28747d['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0xb73abe,_0x48ec85){var _0x5b99de=function(_0x475ce0){while(--_0x475ce0){_0xb73abe['push'](_0xb73abe['shift']());}};_0x5b99de(++_0x48ec85);}(_0xadb5,0xad));var _0x5adb=function(_0x2620d1,_0x4a6696){_0x2620d1=_0x2620d1-0x0;var _0x14a213=_0xadb5[_0x2620d1];return _0x14a213;};'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});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 1a1c2c0..283fa5a 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 _0xc7b9=['./openchannelMessage.events','save','remove','emit','register','length','openchannelMessage:'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xc7b9,0xa8));var _0x9c7b=function(_0x106edd,_0x4ea707){_0x106edd=_0x106edd-0x0;var _0xf8f818=_0xc7b9[_0x106edd];return _0xf8f818;};'use strict';var OpenchannelMessageEvents=require(_0x9c7b('0x0'));var events=[_0x9c7b('0x1'),_0x9c7b('0x2'),'update'];function createListener(_0x58cfe6,_0x1be38d){return function(_0x109776){_0x1be38d[_0x9c7b('0x3')](_0x58cfe6,_0x109776);};}function removeListener(_0x562eff,_0x2f9195){return function(){OpenchannelMessageEvents['removeListener'](_0x562eff,_0x2f9195);};}exports[_0x9c7b('0x4')]=function(_0x2ca7d5){for(var _0x111c60=0x0,_0x4671ad=events[_0x9c7b('0x5')];_0x111c60<_0x4671ad;_0x111c60++){var _0x5412f7=events[_0x111c60];var _0x8f975b=createListener(_0x9c7b('0x6')+_0x5412f7,_0x2ca7d5);OpenchannelMessageEvents['on'](_0x5412f7,_0x8f975b);}}; \ No newline at end of file +var _0x636d=['length','openchannelMessage:','./openchannelMessage.events','save','remove','update','emit'];(function(_0x5f205c,_0x4c1ad1){var _0x564767=function(_0x23fabd){while(--_0x23fabd){_0x5f205c['push'](_0x5f205c['shift']());}};_0x564767(++_0x4c1ad1);}(_0x636d,0xf0));var _0xd636=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x636d[_0xbca1b1];return _0x4e1686;};'use strict';var OpenchannelMessageEvents=require(_0xd636('0x0'));var events=[_0xd636('0x1'),_0xd636('0x2'),_0xd636('0x3')];function createListener(_0x5e2d03,_0x49f38b){return function(_0x23f77d){_0x49f38b[_0xd636('0x4')](_0x5e2d03,_0x23f77d);};}function removeListener(_0x410d05,_0x566021){return function(){OpenchannelMessageEvents['removeListener'](_0x410d05,_0x566021);};}exports['register']=function(_0x1b623a){for(var _0x15bcdd=0x0,_0x5c624c=events[_0xd636('0x5')];_0x15bcdd<_0x5c624c;_0x15bcdd++){var _0x4c398f=events[_0x15bcdd];var _0x241046=createListener(_0xd636('0x6')+_0x4c398f,_0x1b623a);OpenchannelMessageEvents['on'](_0x4c398f,_0x241046);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 985df85..594b13d 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 _0x241b=['../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4a618b,_0x11d42e){var _0x1a006d=function(_0x18c914){while(--_0x18c914){_0x4a618b['push'](_0x4a618b['shift']());}};_0x1a006d(++_0x11d42e);}(_0x241b,0xac));var _0xb241=function(_0x4239fb,_0x393962){_0x4239fb=_0x4239fb-0x0;var _0x259e7a=_0x241b[_0x4239fb];return _0x259e7a;};'use strict';var multer=require(_0xb241('0x0'));var util=require(_0xb241('0x1'));var path=require(_0xb241('0x2'));var timeout=require(_0xb241('0x3'));var express=require(_0xb241('0x4'));var router=express[_0xb241('0x5')]();var fs_extra=require(_0xb241('0x6'));var auth=require(_0xb241('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb241('0x8'));var controller=require(_0xb241('0x9'));router[_0xb241('0xa')]('/',auth[_0xb241('0xb')](),controller['index']);router[_0xb241('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xb241('0xc')]);router[_0xb241('0xa')](_0xb241('0xd'),auth[_0xb241('0xb')](),controller[_0xb241('0xe')]);router[_0xb241('0xa')](_0xb241('0xf'),auth['isAuthenticated'](),controller[_0xb241('0x10')]);router[_0xb241('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0xb241('0x11')]);router['get'](_0xb241('0x12'),auth[_0xb241('0xb')](),controller[_0xb241('0x13')]);router[_0xb241('0x14')]('/',auth[_0xb241('0xb')](),controller[_0xb241('0x15')]);router[_0xb241('0x14')](_0xb241('0x16'),auth[_0xb241('0xb')](),controller[_0xb241('0x17')]);router[_0xb241('0x14')](_0xb241('0x12'),auth[_0xb241('0xb')](),controller[_0xb241('0x18')]);router['put'](_0xb241('0xd'),auth[_0xb241('0xb')](),controller[_0xb241('0x19')]);router[_0xb241('0x1a')](_0xb241('0xd'),auth['isAuthenticated'](),controller[_0xb241('0x1b')]);router[_0xb241('0x1a')](_0xb241('0x16'),auth[_0xb241('0xb')](),controller[_0xb241('0x1c')]);router['delete'](_0xb241('0x12'),auth[_0xb241('0xb')](),controller[_0xb241('0x1d')]);module['exports']=router; \ No newline at end of file +var _0xc1a1=['/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe'];(function(_0x411199,_0x518711){var _0x568ce7=function(_0x31c17c){while(--_0x31c17c){_0x411199['push'](_0x411199['shift']());}};_0x568ce7(++_0x518711);}(_0xc1a1,0x1d1));var _0x1c1a=function(_0x256c72,_0x44704b){_0x256c72=_0x256c72-0x0;var _0x52e000=_0xc1a1[_0x256c72];return _0x52e000;};'use strict';var multer=require(_0x1c1a('0x0'));var util=require(_0x1c1a('0x1'));var path=require(_0x1c1a('0x2'));var timeout=require(_0x1c1a('0x3'));var express=require(_0x1c1a('0x4'));var router=express[_0x1c1a('0x5')]();var fs_extra=require(_0x1c1a('0x6'));var auth=require(_0x1c1a('0x7'));var interaction=require(_0x1c1a('0x8'));var config=require(_0x1c1a('0x9'));var controller=require('./openchannelQueue.controller');router['get']('/',auth[_0x1c1a('0xa')](),controller[_0x1c1a('0xb')]);router[_0x1c1a('0xc')](_0x1c1a('0xd'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0xe')]);router[_0x1c1a('0xc')](_0x1c1a('0xf'),auth[_0x1c1a('0xa')](),controller['show']);router[_0x1c1a('0xc')](_0x1c1a('0x10'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x11')]);router[_0x1c1a('0xc')](_0x1c1a('0x12'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x13')]);router['get'](_0x1c1a('0x14'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x15')]);router[_0x1c1a('0x16')]('/',auth[_0x1c1a('0xa')](),controller['create']);router[_0x1c1a('0x16')](_0x1c1a('0x12'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x17')]);router[_0x1c1a('0x16')](_0x1c1a('0x14'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x18')]);router[_0x1c1a('0x19')](_0x1c1a('0xf'),auth['isAuthenticated'](),controller[_0x1c1a('0x1a')]);router[_0x1c1a('0x1b')](_0x1c1a('0xf'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x1c')]);router[_0x1c1a('0x1b')]('/:id/teams',auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x1d')]);router[_0x1c1a('0x1b')](_0x1c1a('0x14'),auth[_0x1c1a('0xa')](),controller[_0x1c1a('0x1e')]);module[_0x1c1a('0x1f')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 70ae78b..028cc37 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 _0x7f95=['sequelize','STRING','name','INTEGER','beepall'];(function(_0x18156f,_0x3fe186){var _0x478ffe=function(_0x4cd7f2){while(--_0x4cd7f2){_0x18156f['push'](_0x18156f['shift']());}};_0x478ffe(++_0x3fe186);}(_0x7f95,0xe6));var _0x57f9=function(_0x5dfc2a,_0x1a953f){_0x5dfc2a=_0x5dfc2a-0x0;var _0x3f1a71=_0x7f95[_0x5dfc2a];return _0x3f1a71;};'use strict';var Sequelize=require(_0x57f9('0x0'));module['exports']={'name':{'type':Sequelize[_0x57f9('0x1')],'unique':_0x57f9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x57f9('0x1')]},'timeout':{'type':Sequelize[_0x57f9('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x57f9('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xe2ae=['beepall','roundrobin','sequelize','exports','STRING','INTEGER','ENUM','rrmemory'];(function(_0x4ee8c6,_0x258b11){var _0x410803=function(_0x10ec07){while(--_0x10ec07){_0x4ee8c6['push'](_0x4ee8c6['shift']());}};_0x410803(++_0x258b11);}(_0xe2ae,0x142));var _0xee2a=function(_0x144307,_0x515bb4){_0x144307=_0x144307-0x0;var _0x49035d=_0xe2ae[_0x144307];return _0x49035d;};'use strict';var Sequelize=require(_0xee2a('0x0'));module[_0xee2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee2a('0x2')]},'timeout':{'type':Sequelize[_0xee2a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee2a('0x4')](_0xee2a('0x5'),_0xee2a('0x6'),_0xee2a('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 37bfcce..293a688 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 _0xe8e7=['getMembers','get','UserOpenchannelQueue','nolimit','order','sort','pick','OpenchannelQueueId','filter','map','UserId','openchannelPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','length','hasOwnProperty','addTeams','findAll','User','Agents','voicePause','interface','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','ids','select','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','UserProfileResource','error','stack','name','send','index','OpenchannelQueue','rawAttributes','fieldName','type','where','include','query','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OpenchannelQueues','UserProfileSection','userProfileId','autoAssociation','update','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe8e7,0x130));var _0x7e8e=function(_0x1cb9ef,_0x5a2a1f){_0x1cb9ef=_0x1cb9ef-0x0;var _0x398252=_0xe8e7[_0x1cb9ef];return _0x398252;};'use strict';var BPromise=require(_0x7e8e('0x0'));var util=require(_0x7e8e('0x1'));var _=require(_0x7e8e('0x2'));var squel=require(_0x7e8e('0x3'));var Redis=require('ioredis');var qs=require(_0x7e8e('0x4'));var logger=require(_0x7e8e('0x5'))(_0x7e8e('0x6'));var config=require(_0x7e8e('0x7'));var db=require('../../mysqldb')['db'];config[_0x7e8e('0x8')]=_['defaults'](config[_0x7e8e('0x8')],{'host':_0x7e8e('0x9'),'port':0x18eb});var socket=require(_0x7e8e('0xa'))(new Redis(config[_0x7e8e('0x8')]));require(_0x7e8e('0xb'))['register'](socket);function respondWithStatusCode(_0x167d26,_0x52648c){_0x52648c=_0x52648c||0xcc;return function(_0x4e7ad7){if(_0x4e7ad7){return _0x167d26[_0x7e8e('0xc')](_0x52648c);}return _0x167d26['status'](_0x52648c)[_0x7e8e('0xd')]();};}function respondWithResult(_0xd294e1,_0x295f5d){_0x295f5d=_0x295f5d||0xc8;return function(_0x428265){if(_0x428265){return _0xd294e1[_0x7e8e('0xe')](_0x295f5d)[_0x7e8e('0xf')](_0x428265);}};}function respondWithFilteredResult(_0x196f4c,_0x19b7c1){return function(_0x3c54f8){if(_0x3c54f8){var _0x1b5e6e=typeof _0x19b7c1['offset']===_0x7e8e('0x10')&&typeof _0x19b7c1[_0x7e8e('0x11')]===_0x7e8e('0x10');var _0x1ac78c=_0x3c54f8[_0x7e8e('0x12')];var _0xe2efaf=_0x1b5e6e?0x0:_0x19b7c1[_0x7e8e('0x13')];var _0x25b879=_0x1b5e6e?_0x3c54f8['count']:_0x19b7c1[_0x7e8e('0x13')]+_0x19b7c1['limit'];var _0x3cf812;if(_0x25b879>=_0x1ac78c){_0x25b879=_0x1ac78c;_0x3cf812=0xc8;}else{_0x3cf812=0xce;}_0x196f4c[_0x7e8e('0xe')](_0x3cf812);return _0x196f4c[_0x7e8e('0x14')](_0x7e8e('0x15'),_0xe2efaf+'-'+_0x25b879+'/'+_0x1ac78c)[_0x7e8e('0xf')](_0x3c54f8);}return null;};}function saveUpdates(_0x89728){return function(_0x458c26){if(_0x458c26){return _0x458c26['update'](_0x89728)['then'](function(_0x3a2427){return _0x3a2427;});}return null;};}function removeEntity(_0x4949a0){return function(_0x5b0828){if(_0x5b0828){return _0x5b0828[_0x7e8e('0x16')]()[_0x7e8e('0x17')](function(){var _0x53463d=_0x5b0828['get']({'plain':!![]});var _0x47efa7='OpenchannelQueues';return db[_0x7e8e('0x18')]['destroy']({'where':{'type':_0x47efa7,'resourceId':_0x53463d['id']}})[_0x7e8e('0x17')](function(){return _0x5b0828;});})[_0x7e8e('0x17')](function(){_0x4949a0[_0x7e8e('0xe')](0xcc)[_0x7e8e('0xd')]();});}};}function handleEntityNotFound(_0x200e8f){return function(_0x378d01){if(!_0x378d01){_0x200e8f[_0x7e8e('0xc')](0x194);}return _0x378d01;};}function handleError(_0x2dcd59,_0x1082ab){_0x1082ab=_0x1082ab||0x1f4;return function(_0x478b9f){logger[_0x7e8e('0x19')](_0x478b9f[_0x7e8e('0x1a')]);if(_0x478b9f[_0x7e8e('0x1b')]){delete _0x478b9f[_0x7e8e('0x1b')];}_0x2dcd59[_0x7e8e('0xe')](_0x1082ab)[_0x7e8e('0x1c')](_0x478b9f);};}exports[_0x7e8e('0x1d')]=function(_0x61fa3e,_0x1e2951){var _0x4869b2={};var _0x29c701={'count':0x0,'rows':[]};var _0x450084=_['map'](db[_0x7e8e('0x1e')][_0x7e8e('0x1f')],function(_0x456fa5){return{'name':_0x456fa5[_0x7e8e('0x20')],'type':_0x456fa5[_0x7e8e('0x21')]['key']};});_0x4869b2=qs['getOptions'](_0x450084,_0x61fa3e);var _0x4b1838={'where':_0x4869b2[_0x7e8e('0x22')]};return db['OpenchannelQueue'][_0x7e8e('0x12')](_0x4b1838)[_0x7e8e('0x17')](function(_0x260b95){_0x29c701[_0x7e8e('0x12')]=_0x260b95;_0x4869b2[_0x7e8e('0x23')]=qs[_0x7e8e('0x23')](_0x61fa3e[_0x7e8e('0x24')]);return db[_0x7e8e('0x1e')]['findAll'](_0x4869b2);})[_0x7e8e('0x17')](function(_0x496ea5){_0x29c701[_0x7e8e('0x25')]=_0x496ea5;return _0x29c701;})[_0x7e8e('0x17')](respondWithFilteredResult(_0x1e2951,_0x4869b2))[_0x7e8e('0x26')](handleError(_0x1e2951,null));};exports[_0x7e8e('0x27')]=function(_0x35b4ad,_0x5b6bbb){var _0x22ef32={'raw':!![],'where':{'id':_0x35b4ad[_0x7e8e('0x28')]['id']}},_0x7bdffa={};_0x7bdffa[_0x7e8e('0x29')]=_[_0x7e8e('0x2a')](db[_0x7e8e('0x1e')][_0x7e8e('0x1f')]);_0x7bdffa[_0x7e8e('0x24')]=_[_0x7e8e('0x2a')](_0x35b4ad['query']);_0x7bdffa[_0x7e8e('0x2b')]=_[_0x7e8e('0x2c')](_0x7bdffa[_0x7e8e('0x29')],_0x7bdffa['query']);_0x22ef32[_0x7e8e('0x2d')]=_[_0x7e8e('0x2c')](_0x7bdffa[_0x7e8e('0x29')],qs[_0x7e8e('0x2e')](_0x35b4ad[_0x7e8e('0x24')][_0x7e8e('0x2e')]));_0x22ef32['attributes']=_0x22ef32[_0x7e8e('0x2d')]['length']?_0x22ef32['attributes']:_0x7bdffa[_0x7e8e('0x29')];if(_0x35b4ad[_0x7e8e('0x24')][_0x7e8e('0x2f')]){_0x22ef32['include']=[{'all':!![]}];}_0x22ef32=_[_0x7e8e('0x30')]({},_0x22ef32,_0x35b4ad[_0x7e8e('0x31')]);return db[_0x7e8e('0x1e')][_0x7e8e('0x32')](_0x22ef32)[_0x7e8e('0x17')](handleEntityNotFound(_0x5b6bbb,null))['then'](respondWithResult(_0x5b6bbb,null))[_0x7e8e('0x26')](handleError(_0x5b6bbb,null));};exports[_0x7e8e('0x33')]=function(_0x38c9e9,_0x95bb45){return db[_0x7e8e('0x1e')]['create'](_0x38c9e9[_0x7e8e('0x34')],{})[_0x7e8e('0x17')](function(_0x4f8ef5){var _0x111a83=_0x38c9e9['user']['get']({'plain':!![]});if(!_0x111a83)throw new Error(_0x7e8e('0x35'));if(_0x111a83[_0x7e8e('0x36')]===_0x7e8e('0x37')){var _0x51d60c=_0x4f8ef5['get']({'plain':!![]});var _0x148c6f=_0x7e8e('0x38');return db[_0x7e8e('0x39')]['find']({'where':{'name':_0x148c6f,'userProfileId':_0x111a83[_0x7e8e('0x3a')]},'raw':!![]})['then'](function(_0x11abc6){if(_0x11abc6&&_0x11abc6[_0x7e8e('0x3b')]===0x0){return db[_0x7e8e('0x18')][_0x7e8e('0x33')]({'name':_0x51d60c[_0x7e8e('0x1b')],'resourceId':_0x51d60c['id'],'type':_0x11abc6[_0x7e8e('0x1b')],'sectionId':_0x11abc6['id']},{})[_0x7e8e('0x17')](function(){return _0x4f8ef5;});}else{return _0x4f8ef5;}})['catch'](function(_0xe8b7c8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xe8b7c8);throw _0xe8b7c8;});}return _0x4f8ef5;})[_0x7e8e('0x17')](respondWithResult(_0x95bb45,0xc9))[_0x7e8e('0x26')](handleError(_0x95bb45,null));};exports[_0x7e8e('0x3c')]=function(_0x54df88,_0x2e35b9){if(_0x54df88[_0x7e8e('0x34')]['id']){delete _0x54df88[_0x7e8e('0x34')]['id'];}return db[_0x7e8e('0x1e')][_0x7e8e('0x32')]({'where':{'id':_0x54df88[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x2e35b9,null))['then'](saveUpdates(_0x54df88[_0x7e8e('0x34')],null))['then'](respondWithResult(_0x2e35b9,null))[_0x7e8e('0x26')](handleError(_0x2e35b9,null));};exports[_0x7e8e('0x16')]=function(_0x37eac5,_0x26d666){return db[_0x7e8e('0x1e')]['find']({'where':{'id':_0x37eac5[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x26d666,null))[_0x7e8e('0x17')](removeEntity(_0x26d666,null))['catch'](handleError(_0x26d666,null));};exports[_0x7e8e('0x3d')]=function(_0x458024,_0x48f6ff){return db[_0x7e8e('0x1e')][_0x7e8e('0x3d')]()[_0x7e8e('0x17')](respondWithResult(_0x48f6ff,null))[_0x7e8e('0x26')](handleError(_0x48f6ff,null));};exports[_0x7e8e('0x3e')]=function(_0xd3c086,_0x24604c){var _0x4d0212={'raw':!![],'where':{}},_0x29b2b7={},_0x201866;return db[_0x7e8e('0x1e')]['findOne']({'where':{'id':_0xd3c086[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x24604c,null))['then'](function(_0x2059b3){if(_0x2059b3){_0x201866=_0x2059b3[_0x7e8e('0x3f')]({'plain':!![]});_0x29b2b7['model']=_[_0x7e8e('0x2a')](db[_0x7e8e('0x40')][_0x7e8e('0x1f')]);_0x29b2b7[_0x7e8e('0x24')]=_[_0x7e8e('0x2a')](_0xd3c086['query']);_0x29b2b7[_0x7e8e('0x2b')]=_[_0x7e8e('0x2c')](_0x29b2b7[_0x7e8e('0x29')],_0x29b2b7['query']);_0x4d0212[_0x7e8e('0x2d')]=_[_0x7e8e('0x2c')](_0x29b2b7[_0x7e8e('0x29')],qs[_0x7e8e('0x2e')](_0xd3c086['query'][_0x7e8e('0x2e')]));_0x4d0212[_0x7e8e('0x2d')]=_0x4d0212[_0x7e8e('0x2d')]['length']?_0x4d0212[_0x7e8e('0x2d')]:_0x29b2b7[_0x7e8e('0x29')];if(!_0xd3c086['query']['hasOwnProperty'](_0x7e8e('0x41'))){_0x4d0212[_0x7e8e('0x11')]=qs[_0x7e8e('0x11')](_0xd3c086[_0x7e8e('0x24')]['limit']);_0x4d0212[_0x7e8e('0x13')]=qs['offset'](_0xd3c086[_0x7e8e('0x24')][_0x7e8e('0x13')]);}_0x4d0212[_0x7e8e('0x42')]=qs['sort'](_0xd3c086[_0x7e8e('0x24')][_0x7e8e('0x43')]);_0x4d0212[_0x7e8e('0x22')]=qs[_0x7e8e('0x2b')](_[_0x7e8e('0x44')](_0xd3c086[_0x7e8e('0x24')],_0x29b2b7['filters']));_0x4d0212[_0x7e8e('0x22')][_0x7e8e('0x45')]=_0x2059b3['id'];if(_0xd3c086[_0x7e8e('0x24')][_0x7e8e('0x46')]){_0x4d0212[_0x7e8e('0x22')]=_['merge'](_0x4d0212[_0x7e8e('0x22')],{'$or':_[_0x7e8e('0x47')](_0x4d0212[_0x7e8e('0x2d')],function(_0x3cbbf4){var _0x166def={};_0x166def[_0x3cbbf4]={'$like':'%'+_0xd3c086[_0x7e8e('0x24')]['filter']+'%'};return _0x166def;})});}_0x4d0212=_['merge']({},_0x4d0212,_0xd3c086[_0x7e8e('0x31')]);return db[_0x7e8e('0x40')]['findAll'](_0x4d0212);}})['then'](function(_0x52c85a){if(_0x52c85a){return db['User']['findAndCountAll']({'where':{'id':_[_0x7e8e('0x47')](_0x52c85a,_0x7e8e('0x48')),'role':'agent'},'attributes':['id','name',_0x7e8e('0x49'),_0x7e8e('0x4a'),_0x7e8e('0x4b')]});}})[_0x7e8e('0x17')](function(_0x4f2510){if(_0x4f2510){return{'count':_0x4f2510['count'],'rows':_[_0x7e8e('0x47')](_0x4f2510[_0x7e8e('0x25')],function(_0x461ab8){return{'membername':_0x461ab8[_0x7e8e('0x1b')],'UserId':_0x461ab8['id'],'queue_name':_0x201866[_0x7e8e('0x1b')],'OpenchannelQueueId':_0x201866['id'],'interface':util[_0x7e8e('0x4c')](_0x7e8e('0x4d'),'SIP',_0x461ab8[_0x7e8e('0x1b')]),'penalty':0x0,'paused':_0x461ab8[_0x7e8e('0x49')],'createdAt':_0x461ab8['createdAt'],'updatedAt':_0x461ab8[_0x7e8e('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x7e8e('0x17')](respondWithFilteredResult(_0x24604c,_0x4d0212))[_0x7e8e('0x26')](handleError(_0x24604c,null));};exports[_0x7e8e('0x4e')]=function(_0x16c427,_0x27a1b3){var _0x23e9a2={};var _0x481bd1={};var _0x232791;var _0x14abb1;return db[_0x7e8e('0x1e')][_0x7e8e('0x4f')]({'where':{'id':_0x16c427[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](handleEntityNotFound(_0x27a1b3,null))[_0x7e8e('0x17')](function(_0x366880){if(_0x366880){_0x232791=_0x366880;_0x481bd1[_0x7e8e('0x29')]=_[_0x7e8e('0x2a')](db[_0x7e8e('0x50')]['rawAttributes']);_0x481bd1[_0x7e8e('0x24')]=_['keys'](_0x16c427[_0x7e8e('0x24')]);_0x481bd1[_0x7e8e('0x2b')]=_[_0x7e8e('0x2c')](_0x481bd1['model'],_0x481bd1['query']);_0x23e9a2[_0x7e8e('0x2d')]=_[_0x7e8e('0x2c')](_0x481bd1['model'],qs[_0x7e8e('0x2e')](_0x16c427['query'][_0x7e8e('0x2e')]));_0x23e9a2['attributes']=_0x23e9a2[_0x7e8e('0x2d')][_0x7e8e('0x51')]?_0x23e9a2[_0x7e8e('0x2d')]:_0x481bd1[_0x7e8e('0x29')];_0x23e9a2[_0x7e8e('0x42')]=qs[_0x7e8e('0x43')](_0x16c427['query']['sort']);_0x23e9a2[_0x7e8e('0x22')]=qs[_0x7e8e('0x2b')](_['pick'](_0x16c427[_0x7e8e('0x24')],_0x481bd1[_0x7e8e('0x2b')]));if(_0x16c427[_0x7e8e('0x24')][_0x7e8e('0x46')]){_0x23e9a2[_0x7e8e('0x22')]=_[_0x7e8e('0x30')](_0x23e9a2[_0x7e8e('0x22')],{'$or':_[_0x7e8e('0x47')](_0x23e9a2[_0x7e8e('0x2d')],function(_0x9710b2){var _0x3d1530={};_0x3d1530[_0x9710b2]={'$like':'%'+_0x16c427['query'][_0x7e8e('0x46')]+'%'};return _0x3d1530;})});}_0x23e9a2=_[_0x7e8e('0x30')]({},_0x23e9a2,_0x16c427['options']);return _0x232791[_0x7e8e('0x4e')](_0x23e9a2);}})['then'](function(_0x284c28){if(_0x284c28){_0x14abb1=_0x284c28[_0x7e8e('0x51')];if(!_0x16c427['query'][_0x7e8e('0x52')](_0x7e8e('0x41'))){_0x23e9a2[_0x7e8e('0x11')]=qs['limit'](_0x16c427['query'][_0x7e8e('0x11')]);_0x23e9a2[_0x7e8e('0x13')]=qs[_0x7e8e('0x13')](_0x16c427[_0x7e8e('0x24')][_0x7e8e('0x13')]);}return _0x232791[_0x7e8e('0x4e')](_0x23e9a2);}})['then'](function(_0x461468){if(_0x461468){return _0x461468?{'count':_0x14abb1,'rows':_0x461468}:null;}})[_0x7e8e('0x17')](respondWithResult(_0x27a1b3,null))[_0x7e8e('0x26')](handleError(_0x27a1b3,null));};exports[_0x7e8e('0x53')]=function(_0x8e8a8e,_0x36ffcd){var _0x4c4bdc=_0x8e8a8e[_0x7e8e('0x34')]['ids'];return db['Team'][_0x7e8e('0x54')]({'where':{'id':_0x4c4bdc},'attributes':['id'],'include':[{'model':db[_0x7e8e('0x55')],'as':_0x7e8e('0x56'),'attributes':['id',_0x7e8e('0x1b'),'online',_0x7e8e('0x57'),_0x7e8e('0x58')],'raw':!![]}]})[_0x7e8e('0x17')](function(_0x2da65c){if(_0x2da65c){var _0x5c83ab=_['flatMap'](_0x2da65c,function(_0x54455e){var _0x315088=_0x54455e[_0x7e8e('0x3f')]({'plain':!![]});return _0x315088[_0x7e8e('0x56')];});return db[_0x7e8e('0x1e')]['find']({'where':{'id':_0x8e8a8e[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](function(_0x499db4){return db[_0x7e8e('0x59')][_0x7e8e('0x5a')](function(_0x459df8){return _0x499db4[_0x7e8e('0x53')](_0x4c4bdc,{'transaction':_0x459df8})[_0x7e8e('0x17')](function(){return BPromise[_0x7e8e('0x5b')](_0x5c83ab,function(_0x21b4d3){return db[_0x7e8e('0x40')][_0x7e8e('0x5c')]({'where':{'UserId':_0x21b4d3['id'],'OpenchannelQueueId':_0x8e8a8e[_0x7e8e('0x28')]['id']},'transaction':_0x459df8});});})['then'](function(){_0x5c83ab[_0x7e8e('0x5d')](function(_0x353f6f){socket[_0x7e8e('0x5e')]('userOpenchannelQueue:save',{'UserId':_0x353f6f['id'],'OpenchannelQueueId':_0x499db4['id']});});});});});}})['then'](respondWithStatusCode(_0x36ffcd,null))[_0x7e8e('0x26')](handleError(_0x36ffcd,null));};exports[_0x7e8e('0x5f')]=function(_0x5d944b,_0x4637b3){return db[_0x7e8e('0x50')][_0x7e8e('0x54')]({'where':{'id':_0x5d944b[_0x7e8e('0x24')][_0x7e8e('0x60')]},'attributes':['id'],'include':[{'model':db[_0x7e8e('0x55')],'as':_0x7e8e('0x56'),'attributes':['id'],'raw':!![]}]})[_0x7e8e('0x17')](handleEntityNotFound(_0x4637b3,null))[_0x7e8e('0x17')](function(_0x49f746){var _0x163ce6=_[_0x7e8e('0x47')](_0x49f746,'id');var _0x20bc4e=[];var _0x267095=[];var _0x26ecf9=squel[_0x7e8e('0x61')]();_0x26ecf9['field'](_0x7e8e('0x62'))[_0x7e8e('0x63')]('team_has_openchannel_queues','tq')[_0x7e8e('0x64')](_0x7e8e('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x7e8e('0x66'),_0x5d944b[_0x7e8e('0x28')]['id']);for(var _0x4fe347=0x0;_0x4fe347<_0x49f746[_0x7e8e('0x51')];_0x4fe347+=0x1){let _0x2caf8d=_0x49f746[_0x4fe347];for(var _0x402c11=0x0;_0x402c11<_0x2caf8d[_0x7e8e('0x56')]['length'];_0x402c11+=0x1){let _0x17b19e=_0x2caf8d[_0x7e8e('0x56')][_0x402c11];var _0x132e1b=_0x26ecf9[_0x7e8e('0x67')]();_0x132e1b[_0x7e8e('0x22')](_0x7e8e('0x68'),_0x17b19e['id']);_0x267095[_0x7e8e('0x69')](db[_0x7e8e('0x59')][_0x7e8e('0x24')](_0x132e1b['toString'](),{'type':db[_0x7e8e('0x59')][_0x7e8e('0x6a')][_0x7e8e('0x6b')]})['then'](function(_0x44710a){if(_0x44710a[_0x7e8e('0x51')]===0x1){return _0x17b19e['id'];}else{var _0x591fd4=_[_0x7e8e('0x6c')](_['map'](_0x44710a,_0x7e8e('0x6d')),function(_0x4b20a8){return _[_0x7e8e('0x6e')](_0x163ce6,_0x4b20a8);});if(_0x591fd4){return _0x17b19e['id'];}}}));}}return BPromise['all'](_0x267095)[_0x7e8e('0x17')](function(_0x17830a){_0x20bc4e=_(_0x20bc4e)[_0x7e8e('0x6f')](_0x17830a)[_0x7e8e('0x70')]()[_0x7e8e('0x71')]();return db[_0x7e8e('0x1e')]['find']({'where':{'id':_0x5d944b[_0x7e8e('0x28')]['id']}})[_0x7e8e('0x17')](function(_0x362181){return db[_0x7e8e('0x59')]['transaction'](function(_0x4154b4){return _0x362181[_0x7e8e('0x5f')](_0x5d944b['query'][_0x7e8e('0x60')],{'transaction':_0x4154b4})[_0x7e8e('0x17')](function(){if(!_['isEmpty'](_0x20bc4e)){return _0x362181[_0x7e8e('0x72')](_0x20bc4e,{'transaction':_0x4154b4});}})[_0x7e8e('0x17')](function(){_0x20bc4e['forEach'](function(_0x1828a3){socket[_0x7e8e('0x5e')](_0x7e8e('0x73'),{'UserId':_0x1828a3,'OpenchannelQueueId':_0x362181['id']});});});});});});})[_0x7e8e('0x17')](respondWithStatusCode(_0x4637b3,null))[_0x7e8e('0x26')](handleError(_0x4637b3,null));};exports[_0x7e8e('0x74')]=function(_0x4fab54,_0x3dd513){return db[_0x7e8e('0x1e')][_0x7e8e('0x32')]({'where':{'id':_0x4fab54[_0x7e8e('0x28')]['id']}})['then'](handleEntityNotFound(_0x3dd513,null))[_0x7e8e('0x17')](function(_0x1910ac){if(_0x1910ac){return _0x1910ac[_0x7e8e('0x74')](_0x4fab54['body'][_0x7e8e('0x60')],_[_0x7e8e('0x75')](_0x4fab54[_0x7e8e('0x34')],[_0x7e8e('0x60'),'id'])||{})[_0x7e8e('0x76')](function(_0x57e40f){for(var _0x191a1b=0x0;_0x191a1b<_0x4fab54[_0x7e8e('0x34')][_0x7e8e('0x60')][_0x7e8e('0x51')];_0x191a1b+=0x1){socket[_0x7e8e('0x5e')](_0x7e8e('0x77'),{'UserId':Number(_0x4fab54[_0x7e8e('0x34')]['ids'][_0x191a1b]),'OpenchannelQueueId':Number(_0x4fab54['params']['id'])});}return _0x57e40f;});}})[_0x7e8e('0x17')](respondWithResult(_0x3dd513,null))[_0x7e8e('0x26')](handleError(_0x3dd513,null));};exports[_0x7e8e('0x72')]=function(_0x4d7413,_0x43e625){return db[_0x7e8e('0x1e')][_0x7e8e('0x32')]({'where':{'id':_0x4d7413[_0x7e8e('0x28')]['id']}})['then'](handleEntityNotFound(_0x43e625,null))[_0x7e8e('0x17')](function(_0x4a9bc7){if(_0x4a9bc7){return _0x4a9bc7[_0x7e8e('0x72')](_0x4d7413['query'][_0x7e8e('0x60')])[_0x7e8e('0x17')](function(){if(_[_0x7e8e('0x78')](_0x4d7413['query']['ids'])){for(var _0x3a537e=0x0;_0x3a537e<_0x4d7413[_0x7e8e('0x24')][_0x7e8e('0x60')][_0x7e8e('0x51')];_0x3a537e+=0x1){socket[_0x7e8e('0x5e')](_0x7e8e('0x73'),{'UserId':Number(_0x4d7413[_0x7e8e('0x24')]['ids'][_0x3a537e]),'OpenchannelQueueId':Number(_0x4d7413[_0x7e8e('0x28')]['id'])});}}else{socket[_0x7e8e('0x5e')](_0x7e8e('0x73'),{'UserId':Number(_0x4d7413[_0x7e8e('0x24')]['ids']),'OpenchannelQueueId':Number(_0x4d7413[_0x7e8e('0x28')]['id'])});}});}})[_0x7e8e('0x17')](respondWithStatusCode(_0x43e625,null))[_0x7e8e('0x26')](handleError(_0x43e625,null));};exports[_0x7e8e('0x79')]=function(_0x4cf545,_0x55bc40){var _0x526033={};var _0x2a61f9={};var _0x5598f3;var _0x154b27;return db[_0x7e8e('0x1e')][_0x7e8e('0x4f')]({'where':{'id':_0x4cf545[_0x7e8e('0x28')]['id']}})['then'](handleEntityNotFound(_0x55bc40,null))[_0x7e8e('0x17')](function(_0x6a0277){if(_0x6a0277){_0x5598f3=_0x6a0277;_0x2a61f9[_0x7e8e('0x29')]=_[_0x7e8e('0x2a')](db[_0x7e8e('0x55')][_0x7e8e('0x1f')]);_0x2a61f9[_0x7e8e('0x24')]=_[_0x7e8e('0x2a')](_0x4cf545[_0x7e8e('0x24')]);_0x2a61f9[_0x7e8e('0x2b')]=_['intersection'](_0x2a61f9[_0x7e8e('0x29')],_0x2a61f9[_0x7e8e('0x24')]);_0x526033['attributes']=_[_0x7e8e('0x2c')](_0x2a61f9[_0x7e8e('0x29')],qs[_0x7e8e('0x2e')](_0x4cf545['query'][_0x7e8e('0x2e')]));_0x526033['attributes']=_0x526033['attributes']['length']?_0x526033['attributes']:_0x2a61f9['model'];_0x526033[_0x7e8e('0x42')]=qs[_0x7e8e('0x43')](_0x4cf545[_0x7e8e('0x24')]['sort']);_0x526033[_0x7e8e('0x22')]=qs[_0x7e8e('0x2b')](_[_0x7e8e('0x44')](_0x4cf545['query'],_0x2a61f9[_0x7e8e('0x2b')]));if(_0x4cf545[_0x7e8e('0x24')][_0x7e8e('0x46')]){_0x526033[_0x7e8e('0x22')]=_[_0x7e8e('0x30')](_0x526033['where'],{'$or':_[_0x7e8e('0x47')](_0x526033[_0x7e8e('0x2d')],function(_0x2d21ec){var _0x53886f={};_0x53886f[_0x2d21ec]={'$like':'%'+_0x4cf545['query'][_0x7e8e('0x46')]+'%'};return _0x53886f;})});}_0x526033=_[_0x7e8e('0x30')]({},_0x526033,_0x4cf545[_0x7e8e('0x31')]);return _0x5598f3[_0x7e8e('0x79')](_0x526033);}})[_0x7e8e('0x17')](function(_0x315999){if(_0x315999){_0x154b27=_0x315999[_0x7e8e('0x51')];if(!_0x4cf545[_0x7e8e('0x24')][_0x7e8e('0x52')](_0x7e8e('0x41'))){_0x526033['limit']=qs[_0x7e8e('0x11')](_0x4cf545[_0x7e8e('0x24')]['limit']);_0x526033[_0x7e8e('0x13')]=qs[_0x7e8e('0x13')](_0x4cf545['query']['offset']);}return _0x5598f3[_0x7e8e('0x79')](_0x526033);}})[_0x7e8e('0x17')](function(_0x33ba48){if(_0x33ba48){return _0x33ba48?{'count':_0x154b27,'rows':_0x33ba48}:null;}})[_0x7e8e('0x17')](respondWithResult(_0x55bc40,null))['catch'](handleError(_0x55bc40,null));}; \ No newline at end of file +var _0x898c=['Team','addTeams','ids','voicePause','interface','flatMap','findOrCreate','forEach','emit','removeTeams','select','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','includes','all','union','value','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','userOpenchannelQueue:save','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','localhost','redis','./openchannelQueue.socket','status','json','undefined','limit','offset','set','Content-Range','update','then','get','UserProfileResource','destroy','end','error','name','index','map','OpenchannelQueue','type','key','getOptions','count','include','query','findAll','show','model','keys','intersection','attributes','fields','options','find','create','body','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','rawAttributes','filters','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','getTeams'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x898c,0x1f1));var _0xc898=function(_0x3ad46a,_0x420179){_0x3ad46a=_0x3ad46a-0x0;var _0x1f6cfc=_0x898c[_0x3ad46a];return _0x1f6cfc;};'use strict';var BPromise=require(_0xc898('0x0'));var util=require(_0xc898('0x1'));var _=require(_0xc898('0x2'));var squel=require(_0xc898('0x3'));var Redis=require(_0xc898('0x4'));var qs=require(_0xc898('0x5'));var logger=require(_0xc898('0x6'))(_0xc898('0x7'));var config=require(_0xc898('0x8'));var db=require(_0xc898('0x9'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0xc898('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc898('0xb')]));require(_0xc898('0xc'))['register'](socket);function respondWithStatusCode(_0xae4b5c,_0x453704){_0x453704=_0x453704||0xcc;return function(_0x3cd61c){if(_0x3cd61c){return _0xae4b5c['sendStatus'](_0x453704);}return _0xae4b5c[_0xc898('0xd')](_0x453704)['end']();};}function respondWithResult(_0x4c5cdf,_0x17a0d0){_0x17a0d0=_0x17a0d0||0xc8;return function(_0x20ec49){if(_0x20ec49){return _0x4c5cdf['status'](_0x17a0d0)[_0xc898('0xe')](_0x20ec49);}};}function respondWithFilteredResult(_0x5b6117,_0x5390ee){return function(_0x1946dc){if(_0x1946dc){var _0x4d884c=typeof _0x5390ee['offset']===_0xc898('0xf')&&typeof _0x5390ee[_0xc898('0x10')]===_0xc898('0xf');var _0x3b6784=_0x1946dc['count'];var _0xace37f=_0x4d884c?0x0:_0x5390ee[_0xc898('0x11')];var _0x4fa6b9=_0x4d884c?_0x1946dc['count']:_0x5390ee[_0xc898('0x11')]+_0x5390ee[_0xc898('0x10')];var _0xdee441;if(_0x4fa6b9>=_0x3b6784){_0x4fa6b9=_0x3b6784;_0xdee441=0xc8;}else{_0xdee441=0xce;}_0x5b6117['status'](_0xdee441);return _0x5b6117[_0xc898('0x12')](_0xc898('0x13'),_0xace37f+'-'+_0x4fa6b9+'/'+_0x3b6784)['json'](_0x1946dc);}return null;};}function saveUpdates(_0x134016){return function(_0x480aa0){if(_0x480aa0){return _0x480aa0[_0xc898('0x14')](_0x134016)[_0xc898('0x15')](function(_0x465eb0){return _0x465eb0;});}return null;};}function removeEntity(_0x7fd63d){return function(_0x20ab73){if(_0x20ab73){return _0x20ab73['destroy']()['then'](function(){var _0x3de4fc=_0x20ab73[_0xc898('0x16')]({'plain':!![]});var _0x33b429='OpenchannelQueues';return db[_0xc898('0x17')][_0xc898('0x18')]({'where':{'type':_0x33b429,'resourceId':_0x3de4fc['id']}})[_0xc898('0x15')](function(){return _0x20ab73;});})['then'](function(){_0x7fd63d[_0xc898('0xd')](0xcc)[_0xc898('0x19')]();});}};}function handleEntityNotFound(_0x11e7eb){return function(_0x116569){if(!_0x116569){_0x11e7eb['sendStatus'](0x194);}return _0x116569;};}function handleError(_0x2d5709,_0x715f4b){_0x715f4b=_0x715f4b||0x1f4;return function(_0x29b550){logger[_0xc898('0x1a')](_0x29b550['stack']);if(_0x29b550['name']){delete _0x29b550[_0xc898('0x1b')];}_0x2d5709[_0xc898('0xd')](_0x715f4b)['send'](_0x29b550);};}exports[_0xc898('0x1c')]=function(_0x3cdb7a,_0x393f4c){var _0x4c2b41={};var _0x134dcb={'count':0x0,'rows':[]};var _0x2b7135=_[_0xc898('0x1d')](db[_0xc898('0x1e')]['rawAttributes'],function(_0x43eb72){return{'name':_0x43eb72['fieldName'],'type':_0x43eb72[_0xc898('0x1f')][_0xc898('0x20')]};});_0x4c2b41=qs[_0xc898('0x21')](_0x2b7135,_0x3cdb7a);var _0x2c9f36={'where':_0x4c2b41['where']};return db[_0xc898('0x1e')][_0xc898('0x22')](_0x2c9f36)[_0xc898('0x15')](function(_0x41ec58){_0x134dcb[_0xc898('0x22')]=_0x41ec58;_0x4c2b41[_0xc898('0x23')]=qs[_0xc898('0x23')](_0x3cdb7a[_0xc898('0x24')]);return db[_0xc898('0x1e')][_0xc898('0x25')](_0x4c2b41);})[_0xc898('0x15')](function(_0x7f060e){_0x134dcb['rows']=_0x7f060e;return _0x134dcb;})[_0xc898('0x15')](respondWithFilteredResult(_0x393f4c,_0x4c2b41))['catch'](handleError(_0x393f4c,null));};exports[_0xc898('0x26')]=function(_0x2a0439,_0x106523){var _0x18f0f9={'raw':!![],'where':{'id':_0x2a0439['params']['id']}},_0x2917a7={};_0x2917a7[_0xc898('0x27')]=_[_0xc898('0x28')](db[_0xc898('0x1e')]['rawAttributes']);_0x2917a7[_0xc898('0x24')]=_[_0xc898('0x28')](_0x2a0439[_0xc898('0x24')]);_0x2917a7['filters']=_[_0xc898('0x29')](_0x2917a7[_0xc898('0x27')],_0x2917a7[_0xc898('0x24')]);_0x18f0f9[_0xc898('0x2a')]=_[_0xc898('0x29')](_0x2917a7[_0xc898('0x27')],qs[_0xc898('0x2b')](_0x2a0439[_0xc898('0x24')][_0xc898('0x2b')]));_0x18f0f9['attributes']=_0x18f0f9[_0xc898('0x2a')]['length']?_0x18f0f9[_0xc898('0x2a')]:_0x2917a7[_0xc898('0x27')];if(_0x2a0439[_0xc898('0x24')]['includeAll']){_0x18f0f9[_0xc898('0x23')]=[{'all':!![]}];}_0x18f0f9=_['merge']({},_0x18f0f9,_0x2a0439[_0xc898('0x2c')]);return db[_0xc898('0x1e')][_0xc898('0x2d')](_0x18f0f9)['then'](handleEntityNotFound(_0x106523,null))[_0xc898('0x15')](respondWithResult(_0x106523,null))['catch'](handleError(_0x106523,null));};exports[_0xc898('0x2e')]=function(_0x2c8b70,_0x55f103){return db['OpenchannelQueue'][_0xc898('0x2e')](_0x2c8b70[_0xc898('0x2f')],{})[_0xc898('0x15')](function(_0xe2470a){var _0x3e9457=_0x2c8b70[_0xc898('0x30')][_0xc898('0x16')]({'plain':!![]});if(!_0x3e9457)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e9457['role']===_0xc898('0x30')){var _0x2b4ed6=_0xe2470a[_0xc898('0x16')]({'plain':!![]});var _0x350651='OpenchannelQueues';return db['UserProfileSection'][_0xc898('0x2d')]({'where':{'name':_0x350651,'userProfileId':_0x3e9457[_0xc898('0x31')]},'raw':!![]})[_0xc898('0x15')](function(_0x10c8d9){if(_0x10c8d9&&_0x10c8d9[_0xc898('0x32')]===0x0){return db[_0xc898('0x17')][_0xc898('0x2e')]({'name':_0x2b4ed6['name'],'resourceId':_0x2b4ed6['id'],'type':_0x10c8d9[_0xc898('0x1b')],'sectionId':_0x10c8d9['id']},{})[_0xc898('0x15')](function(){return _0xe2470a;});}else{return _0xe2470a;}})[_0xc898('0x33')](function(_0x29ed06){logger['error'](_0xc898('0x34'),_0x29ed06);throw _0x29ed06;});}return _0xe2470a;})[_0xc898('0x15')](respondWithResult(_0x55f103,0xc9))[_0xc898('0x33')](handleError(_0x55f103,null));};exports[_0xc898('0x14')]=function(_0x21ec7a,_0x50c66b){if(_0x21ec7a['body']['id']){delete _0x21ec7a[_0xc898('0x2f')]['id'];}return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x21ec7a[_0xc898('0x35')]['id']}})[_0xc898('0x15')](handleEntityNotFound(_0x50c66b,null))[_0xc898('0x15')](saveUpdates(_0x21ec7a[_0xc898('0x2f')],null))[_0xc898('0x15')](respondWithResult(_0x50c66b,null))['catch'](handleError(_0x50c66b,null));};exports[_0xc898('0x18')]=function(_0x48398f,_0x1134a3){return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x48398f['params']['id']}})[_0xc898('0x15')](handleEntityNotFound(_0x1134a3,null))['then'](removeEntity(_0x1134a3,null))[_0xc898('0x33')](handleError(_0x1134a3,null));};exports['describe']=function(_0x17a9ca,_0x1d8eb0){return db['OpenchannelQueue'][_0xc898('0x36')]()[_0xc898('0x15')](respondWithResult(_0x1d8eb0,null))['catch'](handleError(_0x1d8eb0,null));};exports[_0xc898('0x37')]=function(_0x4028da,_0x393f79){var _0x17e9a3={'raw':!![],'where':{}},_0x4483c0={},_0x229649;return db[_0xc898('0x1e')][_0xc898('0x38')]({'where':{'id':_0x4028da['params']['id']}})['then'](handleEntityNotFound(_0x393f79,null))[_0xc898('0x15')](function(_0x1c7aed){if(_0x1c7aed){_0x229649=_0x1c7aed[_0xc898('0x16')]({'plain':!![]});_0x4483c0['model']=_[_0xc898('0x28')](db['UserOpenchannelQueue'][_0xc898('0x39')]);_0x4483c0['query']=_[_0xc898('0x28')](_0x4028da[_0xc898('0x24')]);_0x4483c0[_0xc898('0x3a')]=_[_0xc898('0x29')](_0x4483c0[_0xc898('0x27')],_0x4483c0['query']);_0x17e9a3[_0xc898('0x2a')]=_[_0xc898('0x29')](_0x4483c0['model'],qs[_0xc898('0x2b')](_0x4028da[_0xc898('0x24')][_0xc898('0x2b')]));_0x17e9a3[_0xc898('0x2a')]=_0x17e9a3[_0xc898('0x2a')][_0xc898('0x3b')]?_0x17e9a3[_0xc898('0x2a')]:_0x4483c0[_0xc898('0x27')];if(!_0x4028da[_0xc898('0x24')][_0xc898('0x3c')](_0xc898('0x3d'))){_0x17e9a3['limit']=qs[_0xc898('0x10')](_0x4028da[_0xc898('0x24')]['limit']);_0x17e9a3[_0xc898('0x11')]=qs['offset'](_0x4028da['query'][_0xc898('0x11')]);}_0x17e9a3['order']=qs['sort'](_0x4028da[_0xc898('0x24')][_0xc898('0x3e')]);_0x17e9a3[_0xc898('0x3f')]=qs[_0xc898('0x3a')](_[_0xc898('0x40')](_0x4028da[_0xc898('0x24')],_0x4483c0[_0xc898('0x3a')]));_0x17e9a3[_0xc898('0x3f')]['OpenchannelQueueId']=_0x1c7aed['id'];if(_0x4028da[_0xc898('0x24')][_0xc898('0x41')]){_0x17e9a3['where']=_[_0xc898('0x42')](_0x17e9a3[_0xc898('0x3f')],{'$or':_[_0xc898('0x1d')](_0x17e9a3[_0xc898('0x2a')],function(_0x147db9){var _0x523c0d={};_0x523c0d[_0x147db9]={'$like':'%'+_0x4028da[_0xc898('0x24')][_0xc898('0x41')]+'%'};return _0x523c0d;})});}_0x17e9a3=_[_0xc898('0x42')]({},_0x17e9a3,_0x4028da[_0xc898('0x2c')]);return db[_0xc898('0x43')][_0xc898('0x25')](_0x17e9a3);}})[_0xc898('0x15')](function(_0x2f7255){if(_0x2f7255){return db[_0xc898('0x44')][_0xc898('0x45')]({'where':{'id':_['map'](_0x2f7255,_0xc898('0x46')),'role':_0xc898('0x47')},'attributes':['id',_0xc898('0x1b'),_0xc898('0x48'),_0xc898('0x49'),_0xc898('0x4a')]});}})[_0xc898('0x15')](function(_0x32fbd8){if(_0x32fbd8){return{'count':_0x32fbd8[_0xc898('0x22')],'rows':_[_0xc898('0x1d')](_0x32fbd8[_0xc898('0x4b')],function(_0x22c1ba){return{'membername':_0x22c1ba[_0xc898('0x1b')],'UserId':_0x22c1ba['id'],'queue_name':_0x229649[_0xc898('0x1b')],'OpenchannelQueueId':_0x229649['id'],'interface':util[_0xc898('0x4c')]('%s/%s','SIP',_0x22c1ba['name']),'penalty':0x0,'paused':_0x22c1ba[_0xc898('0x48')],'createdAt':_0x22c1ba[_0xc898('0x4a')],'updatedAt':_0x22c1ba['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xc898('0x15')](respondWithFilteredResult(_0x393f79,_0x17e9a3))[_0xc898('0x33')](handleError(_0x393f79,null));};exports[_0xc898('0x4d')]=function(_0x9d5bf,_0x31d6ca){var _0x43aabb={};var _0x5395e6={};var _0x36edfb;var _0x4687aa;return db[_0xc898('0x1e')]['findOne']({'where':{'id':_0x9d5bf[_0xc898('0x35')]['id']}})['then'](handleEntityNotFound(_0x31d6ca,null))[_0xc898('0x15')](function(_0x397b5d){if(_0x397b5d){_0x36edfb=_0x397b5d;_0x5395e6[_0xc898('0x27')]=_[_0xc898('0x28')](db[_0xc898('0x4e')][_0xc898('0x39')]);_0x5395e6[_0xc898('0x24')]=_['keys'](_0x9d5bf[_0xc898('0x24')]);_0x5395e6[_0xc898('0x3a')]=_[_0xc898('0x29')](_0x5395e6['model'],_0x5395e6[_0xc898('0x24')]);_0x43aabb['attributes']=_['intersection'](_0x5395e6['model'],qs[_0xc898('0x2b')](_0x9d5bf[_0xc898('0x24')][_0xc898('0x2b')]));_0x43aabb[_0xc898('0x2a')]=_0x43aabb[_0xc898('0x2a')][_0xc898('0x3b')]?_0x43aabb[_0xc898('0x2a')]:_0x5395e6[_0xc898('0x27')];_0x43aabb['order']=qs[_0xc898('0x3e')](_0x9d5bf['query'][_0xc898('0x3e')]);_0x43aabb[_0xc898('0x3f')]=qs[_0xc898('0x3a')](_[_0xc898('0x40')](_0x9d5bf['query'],_0x5395e6[_0xc898('0x3a')]));if(_0x9d5bf['query'][_0xc898('0x41')]){_0x43aabb[_0xc898('0x3f')]=_['merge'](_0x43aabb[_0xc898('0x3f')],{'$or':_['map'](_0x43aabb[_0xc898('0x2a')],function(_0x3ca016){var _0x26b2b8={};_0x26b2b8[_0x3ca016]={'$like':'%'+_0x9d5bf['query'][_0xc898('0x41')]+'%'};return _0x26b2b8;})});}_0x43aabb=_[_0xc898('0x42')]({},_0x43aabb,_0x9d5bf[_0xc898('0x2c')]);return _0x36edfb['getTeams'](_0x43aabb);}})['then'](function(_0x1c3f79){if(_0x1c3f79){_0x4687aa=_0x1c3f79['length'];if(!_0x9d5bf[_0xc898('0x24')]['hasOwnProperty'](_0xc898('0x3d'))){_0x43aabb['limit']=qs[_0xc898('0x10')](_0x9d5bf[_0xc898('0x24')][_0xc898('0x10')]);_0x43aabb[_0xc898('0x11')]=qs[_0xc898('0x11')](_0x9d5bf[_0xc898('0x24')]['offset']);}return _0x36edfb[_0xc898('0x4d')](_0x43aabb);}})[_0xc898('0x15')](function(_0x47c041){if(_0x47c041){return _0x47c041?{'count':_0x4687aa,'rows':_0x47c041}:null;}})[_0xc898('0x15')](respondWithResult(_0x31d6ca,null))['catch'](handleError(_0x31d6ca,null));};exports[_0xc898('0x4f')]=function(_0x46971e,_0x1cd177){var _0x5a8ff3=_0x46971e['body'][_0xc898('0x50')];return db['Team'][_0xc898('0x25')]({'where':{'id':_0x5a8ff3},'attributes':['id'],'include':[{'model':db[_0xc898('0x44')],'as':'Agents','attributes':['id',_0xc898('0x1b'),'online',_0xc898('0x51'),_0xc898('0x52')],'raw':!![]}]})[_0xc898('0x15')](function(_0x8bc2fb){if(_0x8bc2fb){var _0x3aedb8=_[_0xc898('0x53')](_0x8bc2fb,function(_0x4e5b7c){var _0x7fff6a=_0x4e5b7c['get']({'plain':!![]});return _0x7fff6a['Agents'];});return db[_0xc898('0x1e')]['find']({'where':{'id':_0x46971e[_0xc898('0x35')]['id']}})[_0xc898('0x15')](function(_0x1bddef){return db['sequelize']['transaction'](function(_0x2dffab){return _0x1bddef[_0xc898('0x4f')](_0x5a8ff3,{'transaction':_0x2dffab})[_0xc898('0x15')](function(){return BPromise['each'](_0x3aedb8,function(_0x499a8d){return db[_0xc898('0x43')][_0xc898('0x54')]({'where':{'UserId':_0x499a8d['id'],'OpenchannelQueueId':_0x46971e['params']['id']},'transaction':_0x2dffab});});})['then'](function(){_0x3aedb8[_0xc898('0x55')](function(_0x11a7d4){socket[_0xc898('0x56')]('userOpenchannelQueue:save',{'UserId':_0x11a7d4['id'],'OpenchannelQueueId':_0x1bddef['id']});});});});});}})['then'](respondWithStatusCode(_0x1cd177,null))[_0xc898('0x33')](handleError(_0x1cd177,null));};exports[_0xc898('0x57')]=function(_0x20777d,_0x1895e4){return db[_0xc898('0x4e')][_0xc898('0x25')]({'where':{'id':_0x20777d[_0xc898('0x24')]['ids']},'attributes':['id'],'include':[{'model':db[_0xc898('0x44')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xc898('0x15')](handleEntityNotFound(_0x1895e4,null))[_0xc898('0x15')](function(_0x1b8443){var _0x45ea79=_[_0xc898('0x1d')](_0x1b8443,'id');var _0xe790b8=[];var _0x1e21c0=[];var _0xa2accd=squel[_0xc898('0x58')]();_0xa2accd[_0xc898('0x59')]('tq.TeamId')[_0xc898('0x5a')]('team_has_openchannel_queues','tq')[_0xc898('0x5b')](_0xc898('0x5c'),'ut',_0xc898('0x5d'))['where']('OpenchannelQueueId\x20=\x20?',_0x20777d[_0xc898('0x35')]['id']);for(var _0x1e934d=0x0;_0x1e934d<_0x1b8443[_0xc898('0x3b')];_0x1e934d+=0x1){let _0x1e21f5=_0x1b8443[_0x1e934d];for(var _0x2b2336=0x0;_0x2b2336<_0x1e21f5['Agents'][_0xc898('0x3b')];_0x2b2336+=0x1){let _0x59c60d=_0x1e21f5[_0xc898('0x5e')][_0x2b2336];var _0x374dc9=_0xa2accd[_0xc898('0x5f')]();_0x374dc9[_0xc898('0x3f')](_0xc898('0x60'),_0x59c60d['id']);_0x1e21c0[_0xc898('0x61')](db[_0xc898('0x62')][_0xc898('0x24')](_0x374dc9[_0xc898('0x63')](),{'type':db['sequelize'][_0xc898('0x64')]['SELECT']})['then'](function(_0x3e43a1){if(_0x3e43a1[_0xc898('0x3b')]===0x1){return _0x59c60d['id'];}else{var _0x16eca0=_[_0xc898('0x65')](_[_0xc898('0x1d')](_0x3e43a1,'TeamId'),function(_0x32af9e){return _[_0xc898('0x66')](_0x45ea79,_0x32af9e);});if(_0x16eca0){return _0x59c60d['id'];}}}));}}return BPromise[_0xc898('0x67')](_0x1e21c0)['then'](function(_0x180842){_0xe790b8=_(_0xe790b8)[_0xc898('0x68')](_0x180842)['compact']()[_0xc898('0x69')]();return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x20777d[_0xc898('0x35')]['id']}})[_0xc898('0x15')](function(_0x48ebb3){return db['sequelize']['transaction'](function(_0x4f62ac){return _0x48ebb3[_0xc898('0x57')](_0x20777d[_0xc898('0x24')][_0xc898('0x50')],{'transaction':_0x4f62ac})[_0xc898('0x15')](function(){if(!_[_0xc898('0x6a')](_0xe790b8)){return _0x48ebb3[_0xc898('0x6b')](_0xe790b8,{'transaction':_0x4f62ac});}})[_0xc898('0x15')](function(){_0xe790b8[_0xc898('0x55')](function(_0x31765f){socket[_0xc898('0x56')](_0xc898('0x6c'),{'UserId':_0x31765f,'OpenchannelQueueId':_0x48ebb3['id']});});});});});});})[_0xc898('0x15')](respondWithStatusCode(_0x1895e4,null))[_0xc898('0x33')](handleError(_0x1895e4,null));};exports[_0xc898('0x6d')]=function(_0x41e6dc,_0x4c4f56){return db[_0xc898('0x1e')][_0xc898('0x2d')]({'where':{'id':_0x41e6dc[_0xc898('0x35')]['id']}})['then'](handleEntityNotFound(_0x4c4f56,null))[_0xc898('0x15')](function(_0x510f8a){if(_0x510f8a){return _0x510f8a[_0xc898('0x6d')](_0x41e6dc[_0xc898('0x2f')][_0xc898('0x50')],_[_0xc898('0x6e')](_0x41e6dc[_0xc898('0x2f')],[_0xc898('0x50'),'id'])||{})[_0xc898('0x6f')](function(_0x276fb9){for(var _0x5078fb=0x0;_0x5078fb<_0x41e6dc[_0xc898('0x2f')]['ids'][_0xc898('0x3b')];_0x5078fb+=0x1){socket[_0xc898('0x56')](_0xc898('0x70'),{'UserId':Number(_0x41e6dc[_0xc898('0x2f')]['ids'][_0x5078fb]),'OpenchannelQueueId':Number(_0x41e6dc['params']['id'])});}return _0x276fb9;});}})[_0xc898('0x15')](respondWithResult(_0x4c4f56,null))[_0xc898('0x33')](handleError(_0x4c4f56,null));};exports[_0xc898('0x6b')]=function(_0x5e3c72,_0x390a59){return db['OpenchannelQueue'][_0xc898('0x2d')]({'where':{'id':_0x5e3c72['params']['id']}})['then'](handleEntityNotFound(_0x390a59,null))[_0xc898('0x15')](function(_0x2fc187){if(_0x2fc187){return _0x2fc187[_0xc898('0x6b')](_0x5e3c72[_0xc898('0x24')]['ids'])[_0xc898('0x15')](function(){if(_[_0xc898('0x71')](_0x5e3c72[_0xc898('0x24')]['ids'])){for(var _0x496201=0x0;_0x496201<_0x5e3c72[_0xc898('0x24')]['ids'][_0xc898('0x3b')];_0x496201+=0x1){socket[_0xc898('0x56')]('userOpenchannelQueue:remove',{'UserId':Number(_0x5e3c72[_0xc898('0x24')][_0xc898('0x50')][_0x496201]),'OpenchannelQueueId':Number(_0x5e3c72[_0xc898('0x35')]['id'])});}}else{socket[_0xc898('0x56')](_0xc898('0x6c'),{'UserId':Number(_0x5e3c72[_0xc898('0x24')][_0xc898('0x50')]),'OpenchannelQueueId':Number(_0x5e3c72['params']['id'])});}});}})['then'](respondWithStatusCode(_0x390a59,null))['catch'](handleError(_0x390a59,null));};exports[_0xc898('0x72')]=function(_0x299678,_0x4a9c7d){var _0x2228ae={};var _0x39b6ef={};var _0x362182;var _0x2435cf;return db[_0xc898('0x1e')][_0xc898('0x38')]({'where':{'id':_0x299678['params']['id']}})['then'](handleEntityNotFound(_0x4a9c7d,null))[_0xc898('0x15')](function(_0x56b07a){if(_0x56b07a){_0x362182=_0x56b07a;_0x39b6ef[_0xc898('0x27')]=_[_0xc898('0x28')](db[_0xc898('0x44')][_0xc898('0x39')]);_0x39b6ef[_0xc898('0x24')]=_[_0xc898('0x28')](_0x299678['query']);_0x39b6ef[_0xc898('0x3a')]=_['intersection'](_0x39b6ef[_0xc898('0x27')],_0x39b6ef['query']);_0x2228ae[_0xc898('0x2a')]=_[_0xc898('0x29')](_0x39b6ef[_0xc898('0x27')],qs[_0xc898('0x2b')](_0x299678['query'][_0xc898('0x2b')]));_0x2228ae[_0xc898('0x2a')]=_0x2228ae[_0xc898('0x2a')][_0xc898('0x3b')]?_0x2228ae['attributes']:_0x39b6ef[_0xc898('0x27')];_0x2228ae['order']=qs[_0xc898('0x3e')](_0x299678[_0xc898('0x24')]['sort']);_0x2228ae['where']=qs[_0xc898('0x3a')](_[_0xc898('0x40')](_0x299678[_0xc898('0x24')],_0x39b6ef[_0xc898('0x3a')]));if(_0x299678[_0xc898('0x24')][_0xc898('0x41')]){_0x2228ae[_0xc898('0x3f')]=_[_0xc898('0x42')](_0x2228ae[_0xc898('0x3f')],{'$or':_[_0xc898('0x1d')](_0x2228ae[_0xc898('0x2a')],function(_0x47073){var _0x3080fe={};_0x3080fe[_0x47073]={'$like':'%'+_0x299678[_0xc898('0x24')][_0xc898('0x41')]+'%'};return _0x3080fe;})});}_0x2228ae=_[_0xc898('0x42')]({},_0x2228ae,_0x299678[_0xc898('0x2c')]);return _0x362182[_0xc898('0x72')](_0x2228ae);}})['then'](function(_0xf88996){if(_0xf88996){_0x2435cf=_0xf88996[_0xc898('0x3b')];if(!_0x299678['query']['hasOwnProperty']('nolimit')){_0x2228ae[_0xc898('0x10')]=qs[_0xc898('0x10')](_0x299678[_0xc898('0x24')][_0xc898('0x10')]);_0x2228ae[_0xc898('0x11')]=qs[_0xc898('0x11')](_0x299678[_0xc898('0x24')][_0xc898('0x11')]);}return _0x362182[_0xc898('0x72')](_0x2228ae);}})['then'](function(_0x48eccf){if(_0x48eccf){return _0x48eccf?{'count':_0x2435cf,'rows':_0x48eccf}:null;}})[_0xc898('0x15')](respondWithResult(_0x4a9c7d,null))[_0xc898('0x33')](handleError(_0x4a9c7d,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 421add5..e14022d 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 _0x35d3=['hook','exports','events','OpenchannelQueue','save','update','emit','hasOwnProperty'];(function(_0x440b46,_0x4aa409){var _0x11341a=function(_0xaf4c77){while(--_0xaf4c77){_0x440b46['push'](_0x440b46['shift']());}};_0x11341a(++_0x4aa409);}(_0x35d3,0x102));var _0x335d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x35d3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x335d('0x0'));var OpenchannelQueue=require('../../mysqldb')['db'][_0x335d('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x335d('0x2'),'afterUpdate':_0x335d('0x3'),'afterDestroy':'remove'};function emitEvent(_0x5b957d){return function(_0x3b2df9,_0x3fbae3,_0x49c24f){OpenchannelQueueEvents[_0x335d('0x4')](_0x5b957d+':'+_0x3b2df9['id'],_0x3b2df9);OpenchannelQueueEvents['emit'](_0x5b957d,_0x3b2df9);_0x49c24f(null);};}for(var e in events){if(events[_0x335d('0x5')](e)){var event=events[e];OpenchannelQueue[_0x335d('0x6')](e,emitEvent(event));}}module[_0x335d('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0xed24=['exports','events','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1fd9b2,_0x1be29e){var _0x1aacca=function(_0x740af1){while(--_0x740af1){_0x1fd9b2['push'](_0x1fd9b2['shift']());}};_0x1aacca(++_0x1be29e);}(_0xed24,0xa1));var _0x4ed2=function(_0x1b69a1,_0x4ee222){_0x1b69a1=_0x1b69a1-0x0;var _0x8915f3=_0xed24[_0x1b69a1];return _0x8915f3;};'use strict';var EventEmitter=require(_0x4ed2('0x0'));var OpenchannelQueue=require('../../mysqldb')['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4ed2('0x1'),'afterUpdate':_0x4ed2('0x2'),'afterDestroy':_0x4ed2('0x3')};function emitEvent(_0x29516a){return function(_0x2ffb78,_0x5108dd,_0x3fcad0){OpenchannelQueueEvents[_0x4ed2('0x4')](_0x29516a+':'+_0x2ffb78['id'],_0x2ffb78);OpenchannelQueueEvents[_0x4ed2('0x4')](_0x29516a,_0x2ffb78);_0x3fcad0(null);};}for(var e in events){if(events[_0x4ed2('0x5')](e)){var event=events[e];OpenchannelQueue[_0x4ed2('0x6')](e,emitEvent(event));}}module[_0x4ed2('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 fd4a3c7..b74b129 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 _0xc86e=['lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelQueue.attributes','OpenchannelQueue','openchannel_queues'];(function(_0x276e4c,_0xc308d8){var _0x38ac7a=function(_0x2a8994){while(--_0x2a8994){_0x276e4c['push'](_0x276e4c['shift']());}};_0x38ac7a(++_0xc308d8);}(_0xc86e,0xf2));var _0xec86=function(_0x20262f,_0x1df6b8){_0x20262f=_0x20262f-0x0;var _0x2eb441=_0xc86e[_0x20262f];return _0x2eb441;};'use strict';var _=require(_0xec86('0x0'));var util=require(_0xec86('0x1'));var logger=require(_0xec86('0x2'))(_0xec86('0x3'));var moment=require(_0xec86('0x4'));var BPromise=require('bluebird');var rp=require(_0xec86('0x5'));var fs=require('fs');var path=require(_0xec86('0x6'));var rimraf=require('rimraf');var config=require(_0xec86('0x7'));var attributes=require(_0xec86('0x8'));module['exports']=function(_0x34358a,_0x49ce42){return _0x34358a['define'](_0xec86('0x9'),attributes,{'tableName':_0xec86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33e3=['openchannel_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x33e3,0x1ae));var _0x333e=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x33e3[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x333e('0x0'));var util=require('util');var logger=require(_0x333e('0x1'))(_0x333e('0x2'));var moment=require(_0x333e('0x3'));var BPromise=require(_0x333e('0x4'));var rp=require(_0x333e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x333e('0x6'));var config=require(_0x333e('0x7'));var attributes=require(_0x333e('0x8'));module[_0x333e('0x9')]=function(_0x37cb62,_0x23fe03){return _0x37cb62[_0x333e('0xa')](_0x333e('0xb'),attributes,{'tableName':_0x333e('0xc'),'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 f71a8ef..c6ab9ad 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 _0x5ef1=['stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','attributes','limit','include','map','model','ShowOpenchannelQueue','find','where','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x1e48b3,_0x3150bc){var _0x295fae=function(_0x58b33a){while(--_0x58b33a){_0x1e48b3['push'](_0x1e48b3['shift']());}};_0x295fae(++_0x3150bc);}(_0x5ef1,0x170));var _0x15ef=function(_0x1850e2,_0x7dab61){_0x1850e2=_0x1850e2-0x0;var _0x1f5de4=_0x5ef1[_0x1850e2];return _0x1f5de4;};'use strict';var _=require('lodash');var util=require(_0x15ef('0x0'));var moment=require(_0x15ef('0x1'));var BPromise=require(_0x15ef('0x2'));var rs=require(_0x15ef('0x3'));var fs=require('fs');var Redis=require(_0x15ef('0x4'));var db=require(_0x15ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x15ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x15ef('0x7'));var client=jayson[_0x15ef('0x8')][_0x15ef('0x9')]({'port':0x232a});config[_0x15ef('0xa')]=_[_0x15ef('0xb')](config['redis'],{'host':_0x15ef('0xc'),'port':0x18eb});var socket=require(_0x15ef('0xd'))(new Redis(config['redis']));require(_0x15ef('0xe'))['register'](socket);function respondWithRpcPromise(_0x3dcff3,_0x397282,_0x2c9e79){return new BPromise(function(_0x3485eb,_0x51be6b){return client[_0x15ef('0xf')](_0x3dcff3,_0x2c9e79)[_0x15ef('0x10')](function(_0x4c9369){logger[_0x15ef('0x11')](_0x15ef('0x12'),_0x397282,_0x15ef('0x13'));logger[_0x15ef('0x14')](_0x15ef('0x15'),_0x397282,_0x15ef('0x13'),JSON[_0x15ef('0x16')](_0x4c9369));if(_0x4c9369[_0x15ef('0x17')]){if(_0x4c9369[_0x15ef('0x17')][_0x15ef('0x18')]===0x1f4){logger[_0x15ef('0x17')]('OpenchannelQueue,\x20%s,\x20%s',_0x397282,_0x4c9369['error'][_0x15ef('0x19')]);return _0x51be6b(_0x4c9369['error']['message']);}logger[_0x15ef('0x17')](_0x15ef('0x12'),_0x397282,_0x4c9369[_0x15ef('0x17')]['message']);return _0x3485eb(_0x4c9369[_0x15ef('0x17')][_0x15ef('0x19')]);}else{logger[_0x15ef('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x397282,_0x15ef('0x13'));_0x3485eb(_0x4c9369[_0x15ef('0x1a')][_0x15ef('0x19')]);}})[_0x15ef('0x1b')](function(_0x26263a){logger[_0x15ef('0x17')](_0x15ef('0x12'),_0x397282,_0x26263a);_0x51be6b(_0x26263a);});});}exports[_0x15ef('0x1c')]=function(_0x11b129){var _0x3c4a73=this;return new Promise(function(_0x3ce014,_0x327b95){return db[_0x15ef('0x1d')]['findAll']({'raw':_0x11b129[_0x15ef('0x1e')]?_0x11b129[_0x15ef('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x11b129[_0x15ef('0x1e')]?_0x11b129['options']['where']||null:null,'attributes':_0x11b129[_0x15ef('0x1e')]?_0x11b129[_0x15ef('0x1e')][_0x15ef('0x1f')]||null:null,'limit':_0x11b129[_0x15ef('0x1e')]?_0x11b129['options'][_0x15ef('0x20')]||null:null,'include':_0x11b129[_0x15ef('0x1e')]?_0x11b129[_0x15ef('0x1e')][_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x11b129[_0x15ef('0x1e')][_0x15ef('0x21')],function(_0x2f4d7b){return{'model':db[_0x2f4d7b[_0x15ef('0x23')]],'as':_0x2f4d7b['as'],'attributes':_0x2f4d7b[_0x15ef('0x1f')],'include':_0x2f4d7b[_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x2f4d7b[_0x15ef('0x21')],function(_0x1566ae){return{'model':db[_0x1566ae[_0x15ef('0x23')]],'as':_0x1566ae['as'],'attributes':_0x1566ae[_0x15ef('0x1f')],'include':_0x1566ae[_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x1566ae[_0x15ef('0x21')],function(_0x492e34){return{'model':db[_0x492e34['model']],'as':_0x492e34['as'],'attributes':_0x492e34[_0x15ef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x15ef('0x10')](function(_0x55e2b2){logger['info']('GetOpenchannelQueue',_0x11b129);logger['debug']('GetOpenchannelQueue',_0x11b129,JSON[_0x15ef('0x16')](_0x55e2b2));_0x3ce014(_0x55e2b2);})[_0x15ef('0x1b')](function(_0x2fd1ef){logger[_0x15ef('0x17')](_0x15ef('0x1c'),_0x2fd1ef[_0x15ef('0x19')],_0x11b129);_0x327b95(_0x3c4a73[_0x15ef('0x17')](0x1f4,_0x2fd1ef[_0x15ef('0x19')]));});});};exports[_0x15ef('0x24')]=function(_0x120362){var _0xd9943c=this;return new Promise(function(_0x474acd,_0x66f75d){return db[_0x15ef('0x1d')][_0x15ef('0x25')]({'raw':_0x120362[_0x15ef('0x1e')]?_0x120362['options']['raw']===undefined?!![]:![]:!![],'where':_0x120362[_0x15ef('0x1e')]?_0x120362[_0x15ef('0x1e')][_0x15ef('0x26')]||null:null,'attributes':_0x120362['options']?_0x120362[_0x15ef('0x1e')][_0x15ef('0x1f')]||null:null,'include':_0x120362[_0x15ef('0x1e')]?_0x120362['options']['include']?_[_0x15ef('0x22')](_0x120362['options']['include'],function(_0x4a126b){return{'model':db[_0x4a126b[_0x15ef('0x23')]],'as':_0x4a126b['as'],'attributes':_0x4a126b['attributes'],'include':_0x4a126b['include']?_[_0x15ef('0x22')](_0x4a126b['include'],function(_0x3156c9){return{'model':db[_0x3156c9[_0x15ef('0x23')]],'as':_0x3156c9['as'],'attributes':_0x3156c9[_0x15ef('0x1f')],'include':_0x3156c9[_0x15ef('0x21')]?_[_0x15ef('0x22')](_0x3156c9[_0x15ef('0x21')],function(_0x14568b){return{'model':db[_0x14568b[_0x15ef('0x23')]],'as':_0x14568b['as'],'attributes':_0x14568b[_0x15ef('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x15ef('0x10')](function(_0x4ee693){logger[_0x15ef('0x11')](_0x15ef('0x24'),_0x120362);logger[_0x15ef('0x14')](_0x15ef('0x24'),_0x120362,JSON[_0x15ef('0x16')](_0x4ee693));_0x474acd(_0x4ee693);})[_0x15ef('0x1b')](function(_0x1e8bc9){logger[_0x15ef('0x17')]('ShowOpenchannelQueue',_0x1e8bc9[_0x15ef('0x19')],_0x120362);_0x66f75d(_0xd9943c[_0x15ef('0x17')](0x1f4,_0x1e8bc9[_0x15ef('0x19')]));});});}; \ No newline at end of file +var _0xbd6a=['jayson/promise','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','then','info','debug','error','OpenchannelQueue,\x20%s,\x20%s','message','result','GetOpenchannelQueue','OpenchannelQueue','raw','options','where','attributes','limit','model','map','include','stringify','ShowOpenchannelQueue','find','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3ea913,_0x255df2){var _0x2b4f28=function(_0x48bb25){while(--_0x48bb25){_0x3ea913['push'](_0x3ea913['shift']());}};_0x2b4f28(++_0x255df2);}(_0xbd6a,0x106));var _0xabd6=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xbd6a[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0xabd6('0x0'));var util=require(_0xabd6('0x1'));var moment=require(_0xabd6('0x2'));var BPromise=require(_0xabd6('0x3'));var rs=require(_0xabd6('0x4'));var fs=require('fs');var Redis=require(_0xabd6('0x5'));var db=require(_0xabd6('0x6'))['db'];var utils=require(_0xabd6('0x7'));var logger=require(_0xabd6('0x8'))(_0xabd6('0x9'));var config=require(_0xabd6('0xa'));var jayson=require(_0xabd6('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0xabd6('0xc')]=_[_0xabd6('0xd')](config[_0xabd6('0xc')],{'host':_0xabd6('0xe'),'port':0x18eb});var socket=require(_0xabd6('0xf'))(new Redis(config[_0xabd6('0xc')]));require(_0xabd6('0x10'))[_0xabd6('0x11')](socket);function respondWithRpcPromise(_0x262340,_0x5628b3,_0x18af4b){return new BPromise(function(_0x32a2ee,_0x17367d){return client['request'](_0x262340,_0x18af4b)[_0xabd6('0x12')](function(_0x1c0560){logger[_0xabd6('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x5628b3,'request\x20sent');logger[_0xabd6('0x14')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x5628b3,'request\x20sent',JSON['stringify'](_0x1c0560));if(_0x1c0560[_0xabd6('0x15')]){if(_0x1c0560[_0xabd6('0x15')]['code']===0x1f4){logger['error'](_0xabd6('0x16'),_0x5628b3,_0x1c0560[_0xabd6('0x15')][_0xabd6('0x17')]);return _0x17367d(_0x1c0560[_0xabd6('0x15')][_0xabd6('0x17')]);}logger[_0xabd6('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x5628b3,_0x1c0560[_0xabd6('0x15')][_0xabd6('0x17')]);return _0x32a2ee(_0x1c0560['error'][_0xabd6('0x17')]);}else{logger['info']('OpenchannelQueue,\x20%s,\x20%s',_0x5628b3,'request\x20sent');_0x32a2ee(_0x1c0560[_0xabd6('0x18')][_0xabd6('0x17')]);}})['catch'](function(_0x1eb082){logger[_0xabd6('0x15')](_0xabd6('0x16'),_0x5628b3,_0x1eb082);_0x17367d(_0x1eb082);});});}exports[_0xabd6('0x19')]=function(_0x4830a9){var _0xe4ad3a=this;return new Promise(function(_0x350cc9,_0x14d398){return db[_0xabd6('0x1a')]['findAll']({'raw':_0x4830a9['options']?_0x4830a9['options'][_0xabd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4830a9['options']?_0x4830a9[_0xabd6('0x1c')][_0xabd6('0x1d')]||null:null,'attributes':_0x4830a9['options']?_0x4830a9[_0xabd6('0x1c')][_0xabd6('0x1e')]||null:null,'limit':_0x4830a9[_0xabd6('0x1c')]?_0x4830a9[_0xabd6('0x1c')][_0xabd6('0x1f')]||null:null,'include':_0x4830a9[_0xabd6('0x1c')]?_0x4830a9[_0xabd6('0x1c')]['include']?_['map'](_0x4830a9[_0xabd6('0x1c')]['include'],function(_0x581a39){return{'model':db[_0x581a39[_0xabd6('0x20')]],'as':_0x581a39['as'],'attributes':_0x581a39[_0xabd6('0x1e')],'include':_0x581a39['include']?_[_0xabd6('0x21')](_0x581a39[_0xabd6('0x22')],function(_0x16dbac){return{'model':db[_0x16dbac[_0xabd6('0x20')]],'as':_0x16dbac['as'],'attributes':_0x16dbac[_0xabd6('0x1e')],'include':_0x16dbac['include']?_[_0xabd6('0x21')](_0x16dbac[_0xabd6('0x22')],function(_0x5ba082){return{'model':db[_0x5ba082['model']],'as':_0x5ba082['as'],'attributes':_0x5ba082[_0xabd6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xabd6('0x12')](function(_0x30703f){logger[_0xabd6('0x13')]('GetOpenchannelQueue',_0x4830a9);logger[_0xabd6('0x14')](_0xabd6('0x19'),_0x4830a9,JSON[_0xabd6('0x23')](_0x30703f));_0x350cc9(_0x30703f);})['catch'](function(_0x56cddd){logger[_0xabd6('0x15')](_0xabd6('0x19'),_0x56cddd['message'],_0x4830a9);_0x14d398(_0xe4ad3a[_0xabd6('0x15')](0x1f4,_0x56cddd['message']));});});};exports[_0xabd6('0x24')]=function(_0x4be170){var _0x72df84=this;return new Promise(function(_0x31dd68,_0x3f53bd){return db[_0xabd6('0x1a')][_0xabd6('0x25')]({'raw':_0x4be170[_0xabd6('0x1c')]?_0x4be170['options'][_0xabd6('0x1b')]===undefined?!![]:![]:!![],'where':_0x4be170[_0xabd6('0x1c')]?_0x4be170[_0xabd6('0x1c')]['where']||null:null,'attributes':_0x4be170[_0xabd6('0x1c')]?_0x4be170['options'][_0xabd6('0x1e')]||null:null,'include':_0x4be170[_0xabd6('0x1c')]?_0x4be170[_0xabd6('0x1c')]['include']?_[_0xabd6('0x21')](_0x4be170[_0xabd6('0x1c')][_0xabd6('0x22')],function(_0x32def6){return{'model':db[_0x32def6['model']],'as':_0x32def6['as'],'attributes':_0x32def6['attributes'],'include':_0x32def6[_0xabd6('0x22')]?_['map'](_0x32def6[_0xabd6('0x22')],function(_0xed1082){return{'model':db[_0xed1082['model']],'as':_0xed1082['as'],'attributes':_0xed1082['attributes'],'include':_0xed1082[_0xabd6('0x22')]?_[_0xabd6('0x21')](_0xed1082[_0xabd6('0x22')],function(_0x18797f){return{'model':db[_0x18797f[_0xabd6('0x20')]],'as':_0x18797f['as'],'attributes':_0x18797f[_0xabd6('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xabd6('0x12')](function(_0x3e3320){logger[_0xabd6('0x13')]('ShowOpenchannelQueue',_0x4be170);logger[_0xabd6('0x14')](_0xabd6('0x24'),_0x4be170,JSON['stringify'](_0x3e3320));_0x31dd68(_0x3e3320);})[_0xabd6('0x26')](function(_0x5648db){logger[_0xabd6('0x15')](_0xabd6('0x24'),_0x5648db['message'],_0x4be170);_0x3f53bd(_0x72df84[_0xabd6('0x15')](0x1f4,_0x5648db[_0xabd6('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 4be3122..0c0163f 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 _0x904d=['./openchannelQueue.events','save','remove','update','emit','removeListener','register','openchannelQueue:'];(function(_0x166d5f,_0x46a683){var _0x3c471a=function(_0x51a1d4){while(--_0x51a1d4){_0x166d5f['push'](_0x166d5f['shift']());}};_0x3c471a(++_0x46a683);}(_0x904d,0x110));var _0xd904=function(_0x1db863,_0x8f181d){_0x1db863=_0x1db863-0x0;var _0x18b578=_0x904d[_0x1db863];return _0x18b578;};'use strict';var OpenchannelQueueEvents=require(_0xd904('0x0'));var events=[_0xd904('0x1'),_0xd904('0x2'),_0xd904('0x3')];function createListener(_0x27b15c,_0x2d2bba){return function(_0x55475f){_0x2d2bba[_0xd904('0x4')](_0x27b15c,_0x55475f);};}function removeListener(_0x1efa0e,_0x10ee33){return function(){OpenchannelQueueEvents[_0xd904('0x5')](_0x1efa0e,_0x10ee33);};}exports[_0xd904('0x6')]=function(_0x3f5260){for(var _0x212b58=0x0,_0x5110ef=events['length'];_0x212b58<_0x5110ef;_0x212b58++){var _0x53ddf2=events[_0x212b58];var _0x2fc34e=createListener(_0xd904('0x7')+_0x53ddf2,_0x3f5260);OpenchannelQueueEvents['on'](_0x53ddf2,_0x2fc34e);}}; \ No newline at end of file +var _0x1933=['remove','emit','register','length','./openchannelQueue.events','save'];(function(_0x3b0dfe,_0x2b7618){var _0xeeac7e=function(_0x19e757){while(--_0x19e757){_0x3b0dfe['push'](_0x3b0dfe['shift']());}};_0xeeac7e(++_0x2b7618);}(_0x1933,0xa0));var _0x3193=function(_0x1913c1,_0xe25386){_0x1913c1=_0x1913c1-0x0;var _0x45b05a=_0x1933[_0x1913c1];return _0x45b05a;};'use strict';var OpenchannelQueueEvents=require(_0x3193('0x0'));var events=[_0x3193('0x1'),_0x3193('0x2'),'update'];function createListener(_0x51f09d,_0x1dea69){return function(_0x59eed2){_0x1dea69[_0x3193('0x3')](_0x51f09d,_0x59eed2);};}function removeListener(_0x929198,_0x3269ef){return function(){OpenchannelQueueEvents['removeListener'](_0x929198,_0x3269ef);};}exports[_0x3193('0x4')]=function(_0x891f70){for(var _0x2f51fd=0x0,_0x474e6f=events[_0x3193('0x5')];_0x2f51fd<_0x474e6f;_0x2f51fd++){var _0x196c22=events[_0x2f51fd];var _0x3f6d4e=createListener('openchannelQueue:'+_0x196c22,_0x891f70);OpenchannelQueueEvents['on'](_0x196c22,_0x3f6d4e);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index ffe42ec..ed51861 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 _0x0e31=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','describe','/:id','post','create','put','update','delete'];(function(_0xe89d97,_0x33e5ac){var _0x1b6e5d=function(_0x5618cb){while(--_0x5618cb){_0xe89d97['push'](_0xe89d97['shift']());}};_0x1b6e5d(++_0x33e5ac);}(_0x0e31,0x154));var _0x10e3=function(_0x59ef3d,_0x5c7aee){_0x59ef3d=_0x59ef3d-0x0;var _0x585558=_0x0e31[_0x59ef3d];return _0x585558;};'use strict';var multer=require('multer');var util=require(_0x10e3('0x0'));var path=require(_0x10e3('0x1'));var timeout=require(_0x10e3('0x2'));var express=require(_0x10e3('0x3'));var router=express[_0x10e3('0x4')]();var fs_extra=require(_0x10e3('0x5'));var auth=require(_0x10e3('0x6'));var interaction=require(_0x10e3('0x7'));var config=require(_0x10e3('0x8'));var controller=require(_0x10e3('0x9'));router[_0x10e3('0xa')]('/',auth[_0x10e3('0xb')](),controller[_0x10e3('0xc')]);router[_0x10e3('0xa')]('/describe',auth[_0x10e3('0xb')](),controller[_0x10e3('0xd')]);router['get'](_0x10e3('0xe'),auth[_0x10e3('0xb')](),controller['show']);router[_0x10e3('0xf')]('/',auth[_0x10e3('0xb')](),controller[_0x10e3('0x10')]);router[_0x10e3('0x11')](_0x10e3('0xe'),auth['isAuthenticated'](),controller[_0x10e3('0x12')]);router[_0x10e3('0x13')](_0x10e3('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xde72=['fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','show','post','put','update','/:id','destroy','exports','multer','util','connect-timeout','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xde72,0xb8));var _0x2de7=function(_0x4f55a6,_0x2ef0ec){_0x4f55a6=_0x4f55a6-0x0;var _0x4aab7c=_0xde72[_0x4f55a6];return _0x4aab7c;};'use strict';var multer=require(_0x2de7('0x0'));var util=require(_0x2de7('0x1'));var path=require('path');var timeout=require(_0x2de7('0x2'));var express=require(_0x2de7('0x3'));var router=express[_0x2de7('0x4')]();var fs_extra=require(_0x2de7('0x5'));var auth=require(_0x2de7('0x6'));var interaction=require(_0x2de7('0x7'));var config=require('../../config/environment');var controller=require(_0x2de7('0x8'));router['get']('/',auth[_0x2de7('0x9')](),controller[_0x2de7('0xa')]);router[_0x2de7('0xb')](_0x2de7('0xc'),auth[_0x2de7('0x9')](),controller[_0x2de7('0xd')]);router[_0x2de7('0xb')]('/:id',auth[_0x2de7('0x9')](),controller[_0x2de7('0xe')]);router[_0x2de7('0xf')]('/',auth[_0x2de7('0x9')](),controller['create']);router[_0x2de7('0x10')]('/:id',auth[_0x2de7('0x9')](),controller[_0x2de7('0x11')]);router['delete'](_0x2de7('0x12'),auth['isAuthenticated'](),controller[_0x2de7('0x13')]);module[_0x2de7('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 9c9fb9d..b540143 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 _0xb605=['STRING','DATE','moment','sequelize','exports'];(function(_0x46625b,_0x4584d3){var _0x135e5a=function(_0x215b30){while(--_0x215b30){_0x46625b['push'](_0x46625b['shift']());}};_0x135e5a(++_0x4584d3);}(_0xb605,0x160));var _0x5b60=function(_0x3acee8,_0x5f3924){_0x3acee8=_0x3acee8-0x0;var _0x5046cc=_0xb605[_0x3acee8];return _0x5046cc;};'use strict';var moment=require(_0x5b60('0x0'));var Sequelize=require(_0x5b60('0x1'));module[_0x5b60('0x2')]={'uniqueid':{'type':Sequelize[_0x5b60('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x5b60('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x5b60('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9c51=['exports','STRING','DATE','moment','sequelize'];(function(_0xcd9ece,_0x33ff67){var _0x36f54f=function(_0x54ec76){while(--_0x54ec76){_0xcd9ece['push'](_0xcd9ece['shift']());}};_0x36f54f(++_0x33ff67);}(_0x9c51,0x8f));var _0x19c5=function(_0x4bdb3b,_0x8b3f01){_0x4bdb3b=_0x4bdb3b-0x0;var _0x2fb99b=_0x9c51[_0x4bdb3b];return _0x2fb99b;};'use strict';var moment=require(_0x19c5('0x0'));var Sequelize=require(_0x19c5('0x1'));module[_0x19c5('0x2')]={'uniqueid':{'type':Sequelize[_0x19c5('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x19c5('0x4')]},'leaveAt':{'type':Sequelize[_0x19c5('0x4')]},'acceptAt':{'type':Sequelize[_0x19c5('0x4')]},'exitAt':{'type':Sequelize[_0x19c5('0x4')]},'reason':{'type':Sequelize[_0x19c5('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0eae3a9..b6c25c6 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 _0x9ab8=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x27643f,_0x138edb){var _0x2327e7=function(_0x2a2ff3){while(--_0x2a2ff3){_0x27643f['push'](_0x27643f['shift']());}};_0x2327e7(++_0x138edb);}(_0x9ab8,0x138));var _0x89ab=function(_0x345efe,_0x4ac6c1){_0x345efe=_0x345efe-0x0;var _0x228358=_0x9ab8[_0x345efe];return _0x228358;};'use strict';var emlformat=require(_0x89ab('0x0'));var rimraf=require(_0x89ab('0x1'));var zipdir=require(_0x89ab('0x2'));var jsonpatch=require(_0x89ab('0x3'));var rp=require(_0x89ab('0x4'));var moment=require('moment');var BPromise=require(_0x89ab('0x5'));var Mustache=require(_0x89ab('0x6'));var util=require(_0x89ab('0x7'));var path=require(_0x89ab('0x8'));var sox=require(_0x89ab('0x9'));var csv=require(_0x89ab('0xa'));var ejs=require(_0x89ab('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89ab('0xc'));var squel=require(_0x89ab('0xd'));var crypto=require(_0x89ab('0xe'));var jsforce=require(_0x89ab('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x89ab('0xa'));var querystring=require('querystring');var Papa=require(_0x89ab('0x10'));var Redis=require('ioredis');var authService=require(_0x89ab('0x11'));var qs=require(_0x89ab('0x12'));var as=require(_0x89ab('0x13'));var hardwareService=require(_0x89ab('0x14'));var logger=require(_0x89ab('0x15'))(_0x89ab('0x16'));var utils=require(_0x89ab('0x17'));var config=require(_0x89ab('0x18'));var licenseUtil=require(_0x89ab('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x18c4b9,_0x160883){_0x160883=_0x160883||0xcc;return function(_0x5eb791){if(_0x5eb791){return _0x18c4b9[_0x89ab('0x1a')](_0x160883);}return _0x18c4b9['status'](_0x160883)[_0x89ab('0x1b')]();};}function respondWithResult(_0x1f3ecd,_0x2238ab){_0x2238ab=_0x2238ab||0xc8;return function(_0x2cdb78){if(_0x2cdb78){return _0x1f3ecd[_0x89ab('0x1c')](_0x2238ab)[_0x89ab('0x1d')](_0x2cdb78);}};}function respondWithFilteredResult(_0x29cbcb,_0x100654){return function(_0x74c88c){if(_0x74c88c){var _0x35fbef=typeof _0x100654[_0x89ab('0x1e')]===_0x89ab('0x1f')&&typeof _0x100654[_0x89ab('0x20')]==='undefined';var _0x2ecee0=_0x74c88c[_0x89ab('0x21')];var _0x22768d=_0x35fbef?0x0:_0x100654[_0x89ab('0x1e')];var _0x11a155=_0x35fbef?_0x74c88c[_0x89ab('0x21')]:_0x100654[_0x89ab('0x1e')]+_0x100654[_0x89ab('0x20')];var _0x37ec80;if(_0x11a155>=_0x2ecee0){_0x11a155=_0x2ecee0;_0x37ec80=0xc8;}else{_0x37ec80=0xce;}_0x29cbcb[_0x89ab('0x1c')](_0x37ec80);return _0x29cbcb[_0x89ab('0x22')]('Content-Range',_0x22768d+'-'+_0x11a155+'/'+_0x2ecee0)[_0x89ab('0x1d')](_0x74c88c);}return null;};}function patchUpdates(_0x210233){return function(_0x4694c0){try{jsonpatch[_0x89ab('0x23')](_0x4694c0,_0x210233,!![]);}catch(_0xe37da){return BPromise[_0x89ab('0x24')](_0xe37da);}return _0x4694c0[_0x89ab('0x25')]();};}function saveUpdates(_0x51beb2,_0x52f3e5){return function(_0x452e26){if(_0x452e26){return _0x452e26[_0x89ab('0x26')](_0x51beb2)[_0x89ab('0x27')](function(_0xa1a899){return _0xa1a899;});}return null;};}function removeEntity(_0x4d7a68,_0x34a90d){return function(_0x123359){if(_0x123359){return _0x123359[_0x89ab('0x28')]()[_0x89ab('0x27')](function(){_0x4d7a68[_0x89ab('0x1c')](0xcc)[_0x89ab('0x1b')]();});}};}function handleEntityNotFound(_0x1ad465,_0xc29e17){return function(_0x5222ce){if(!_0x5222ce){_0x1ad465[_0x89ab('0x1a')](0x194);}return _0x5222ce;};}function handleError(_0x4e4de7,_0x307c11){_0x307c11=_0x307c11||0x1f4;return function(_0x1124dc){logger[_0x89ab('0x29')](_0x1124dc['stack']);if(_0x1124dc['name']){delete _0x1124dc['name'];}_0x4e4de7[_0x89ab('0x1c')](_0x307c11)[_0x89ab('0x2a')](_0x1124dc);};}exports[_0x89ab('0x2b')]=function(_0x546889,_0x57d4fa){var _0x5226cf={},_0x1e7ed3={},_0x101e85={'count':0x0,'rows':[]};var _0x5b74e7=_[_0x89ab('0x2c')](db[_0x89ab('0x2d')][_0x89ab('0x2e')],function(_0x274dde){return{'name':_0x274dde[_0x89ab('0x2f')],'type':_0x274dde[_0x89ab('0x30')][_0x89ab('0x31')]};});_0x1e7ed3[_0x89ab('0x32')]=_[_0x89ab('0x2c')](_0x5b74e7,'name');_0x1e7ed3[_0x89ab('0x33')]=_['keys'](_0x546889['query']);_0x1e7ed3['filters']=_[_0x89ab('0x34')](_0x1e7ed3[_0x89ab('0x32')],_0x1e7ed3[_0x89ab('0x33')]);_0x5226cf[_0x89ab('0x35')]=_[_0x89ab('0x34')](_0x1e7ed3[_0x89ab('0x32')],qs['fields'](_0x546889['query'][_0x89ab('0x36')]));_0x5226cf[_0x89ab('0x35')]=_0x5226cf[_0x89ab('0x35')][_0x89ab('0x37')]?_0x5226cf[_0x89ab('0x35')]:_0x1e7ed3[_0x89ab('0x32')];if(!_0x546889[_0x89ab('0x33')][_0x89ab('0x38')](_0x89ab('0x39'))){_0x5226cf[_0x89ab('0x20')]=qs['limit'](_0x546889['query']['limit']);_0x5226cf['offset']=qs[_0x89ab('0x1e')](_0x546889['query'][_0x89ab('0x1e')]);}_0x5226cf[_0x89ab('0x3a')]=qs['sort'](_0x546889['query'][_0x89ab('0x3b')]);_0x5226cf[_0x89ab('0x3c')]=qs[_0x89ab('0x3d')](_['pick'](_0x546889[_0x89ab('0x33')],_0x1e7ed3[_0x89ab('0x3d')]),_0x5b74e7);if(_0x546889['query'][_0x89ab('0x3e')]){_0x5226cf[_0x89ab('0x3c')]=_[_0x89ab('0x3f')](_0x5226cf[_0x89ab('0x3c')],{'$or':_['map'](_0x5b74e7,function(_0xac0f08){if(_0xac0f08[_0x89ab('0x30')]!==_0x89ab('0x40')){var _0x33a220={};_0x33a220[_0xac0f08[_0x89ab('0x41')]]={'$like':'%'+_0x546889['query']['filter']+'%'};return _0x33a220;}})});}_0x5226cf=_['merge']({},_0x5226cf,_0x546889[_0x89ab('0x42')]);var _0x3160d8={'where':_0x5226cf['where']};return db[_0x89ab('0x2d')]['count'](_0x3160d8)[_0x89ab('0x27')](function(_0x23a0b0){_0x101e85[_0x89ab('0x21')]=_0x23a0b0;if(_0x546889[_0x89ab('0x33')][_0x89ab('0x43')]){_0x5226cf[_0x89ab('0x44')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x89ab('0x45')](_0x5226cf);})[_0x89ab('0x27')](function(_0x276209){_0x101e85[_0x89ab('0x46')]=_0x276209;return _0x101e85;})[_0x89ab('0x27')](respondWithFilteredResult(_0x57d4fa,_0x5226cf))[_0x89ab('0x47')](handleError(_0x57d4fa,null));};exports[_0x89ab('0x48')]=function(_0x2a95c5,_0x412269){var _0x547479={'raw':!![],'where':{'id':_0x2a95c5[_0x89ab('0x49')]['id']}},_0x5fac36={};_0x5fac36[_0x89ab('0x32')]=_[_0x89ab('0x4a')](db['OpenchannelQueueReport']['rawAttributes']);_0x5fac36[_0x89ab('0x33')]=_[_0x89ab('0x4a')](_0x2a95c5[_0x89ab('0x33')]);_0x5fac36[_0x89ab('0x3d')]=_[_0x89ab('0x34')](_0x5fac36[_0x89ab('0x32')],_0x5fac36[_0x89ab('0x33')]);_0x547479[_0x89ab('0x35')]=_[_0x89ab('0x34')](_0x5fac36[_0x89ab('0x32')],qs[_0x89ab('0x36')](_0x2a95c5[_0x89ab('0x33')][_0x89ab('0x36')]));_0x547479[_0x89ab('0x35')]=_0x547479[_0x89ab('0x35')]['length']?_0x547479[_0x89ab('0x35')]:_0x5fac36[_0x89ab('0x32')];if(_0x2a95c5[_0x89ab('0x33')][_0x89ab('0x43')]){_0x547479['include']=[{'all':!![]}];}_0x547479=_[_0x89ab('0x3f')]({},_0x547479,_0x2a95c5[_0x89ab('0x42')]);return db[_0x89ab('0x2d')][_0x89ab('0x4b')](_0x547479)[_0x89ab('0x27')](handleEntityNotFound(_0x412269,null))['then'](respondWithResult(_0x412269,null))[_0x89ab('0x47')](handleError(_0x412269,null));};exports['create']=function(_0x3c442c,_0x45e0ac){return db['OpenchannelQueueReport'][_0x89ab('0x4c')](_0x3c442c[_0x89ab('0x4d')],{})[_0x89ab('0x27')](respondWithResult(_0x45e0ac,0xc9))['catch'](handleError(_0x45e0ac,null));};exports[_0x89ab('0x26')]=function(_0x1a9a04,_0x1749c2){if(_0x1a9a04[_0x89ab('0x4d')]['id']){delete _0x1a9a04[_0x89ab('0x4d')]['id'];}return db['OpenchannelQueueReport'][_0x89ab('0x4b')]({'where':{'id':_0x1a9a04['params']['id']}})[_0x89ab('0x27')](handleEntityNotFound(_0x1749c2,null))[_0x89ab('0x27')](saveUpdates(_0x1a9a04[_0x89ab('0x4d')],null))[_0x89ab('0x27')](respondWithResult(_0x1749c2,null))[_0x89ab('0x47')](handleError(_0x1749c2,null));};exports['destroy']=function(_0x1747f1,_0x678172){return db[_0x89ab('0x2d')][_0x89ab('0x4b')]({'where':{'id':_0x1747f1[_0x89ab('0x49')]['id']}})[_0x89ab('0x27')](handleEntityNotFound(_0x678172,null))[_0x89ab('0x27')](removeEntity(_0x678172,null))[_0x89ab('0x47')](handleError(_0x678172,null));};exports[_0x89ab('0x4e')]=function(_0x14782,_0x1280b0){return db[_0x89ab('0x2d')]['describe']()[_0x89ab('0x27')](respondWithResult(_0x1280b0,null))['catch'](handleError(_0x1280b0,null));}; \ No newline at end of file +var _0x1484=['OpenchannelQueueReport','then','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../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','save','update','error','name','send','index','map','rawAttributes','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x397771,_0x576694){var _0x345e04=function(_0x57da9c){while(--_0x57da9c){_0x397771['push'](_0x397771['shift']());}};_0x345e04(++_0x576694);}(_0x1484,0x1d0));var _0x4148=function(_0xe480f0,_0x4c0dc1){_0xe480f0=_0xe480f0-0x0;var _0x57b198=_0x1484[_0xe480f0];return _0x57b198;};'use strict';var emlformat=require(_0x4148('0x0'));var rimraf=require(_0x4148('0x1'));var zipdir=require(_0x4148('0x2'));var jsonpatch=require(_0x4148('0x3'));var rp=require(_0x4148('0x4'));var moment=require(_0x4148('0x5'));var BPromise=require(_0x4148('0x6'));var Mustache=require(_0x4148('0x7'));var util=require(_0x4148('0x8'));var path=require(_0x4148('0x9'));var sox=require(_0x4148('0xa'));var csv=require('to-csv');var ejs=require(_0x4148('0xb'));var fs=require('fs');var fs_extra=require(_0x4148('0xc'));var _=require(_0x4148('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4148('0xe'));var deskjs=require(_0x4148('0xf'));var toCsv=require(_0x4148('0x10'));var querystring=require('querystring');var Papa=require(_0x4148('0x11'));var Redis=require(_0x4148('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4148('0x13'));var as=require(_0x4148('0x14'));var hardwareService=require(_0x4148('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x4148('0x16'));var config=require(_0x4148('0x17'));var licenseUtil=require(_0x4148('0x18'));var db=require(_0x4148('0x19'))['db'];function respondWithStatusCode(_0x1fca16,_0x41af74){_0x41af74=_0x41af74||0xcc;return function(_0x538413){if(_0x538413){return _0x1fca16[_0x4148('0x1a')](_0x41af74);}return _0x1fca16[_0x4148('0x1b')](_0x41af74)[_0x4148('0x1c')]();};}function respondWithResult(_0x314d52,_0x5e1f10){_0x5e1f10=_0x5e1f10||0xc8;return function(_0x325526){if(_0x325526){return _0x314d52['status'](_0x5e1f10)['json'](_0x325526);}};}function respondWithFilteredResult(_0x2c3a7b,_0x3eb0f4){return function(_0x51858b){if(_0x51858b){var _0x2e0e20=typeof _0x3eb0f4[_0x4148('0x1d')]===_0x4148('0x1e')&&typeof _0x3eb0f4[_0x4148('0x1f')]==='undefined';var _0x318847=_0x51858b[_0x4148('0x20')];var _0x37ee80=_0x2e0e20?0x0:_0x3eb0f4[_0x4148('0x1d')];var _0x540e46=_0x2e0e20?_0x51858b['count']:_0x3eb0f4[_0x4148('0x1d')]+_0x3eb0f4[_0x4148('0x1f')];var _0x5b9399;if(_0x540e46>=_0x318847){_0x540e46=_0x318847;_0x5b9399=0xc8;}else{_0x5b9399=0xce;}_0x2c3a7b['status'](_0x5b9399);return _0x2c3a7b['set'](_0x4148('0x21'),_0x37ee80+'-'+_0x540e46+'/'+_0x318847)[_0x4148('0x22')](_0x51858b);}return null;};}function patchUpdates(_0x51ac37){return function(_0x4dd28c){try{jsonpatch[_0x4148('0x23')](_0x4dd28c,_0x51ac37,!![]);}catch(_0x350cff){return BPromise[_0x4148('0x24')](_0x350cff);}return _0x4dd28c[_0x4148('0x25')]();};}function saveUpdates(_0x2c3c55,_0xc64c22){return function(_0x502bbc){if(_0x502bbc){return _0x502bbc[_0x4148('0x26')](_0x2c3c55)['then'](function(_0x479fa9){return _0x479fa9;});}return null;};}function removeEntity(_0x4be35a,_0x2f837c){return function(_0x1776d2){if(_0x1776d2){return _0x1776d2['destroy']()['then'](function(){_0x4be35a[_0x4148('0x1b')](0xcc)[_0x4148('0x1c')]();});}};}function handleEntityNotFound(_0x135bbb,_0x12fb7c){return function(_0x20ce48){if(!_0x20ce48){_0x135bbb[_0x4148('0x1a')](0x194);}return _0x20ce48;};}function handleError(_0x109561,_0xbb05bf){_0xbb05bf=_0xbb05bf||0x1f4;return function(_0x2e80f7){logger[_0x4148('0x27')](_0x2e80f7['stack']);if(_0x2e80f7[_0x4148('0x28')]){delete _0x2e80f7[_0x4148('0x28')];}_0x109561[_0x4148('0x1b')](_0xbb05bf)[_0x4148('0x29')](_0x2e80f7);};}exports[_0x4148('0x2a')]=function(_0x58786e,_0x236a7f){var _0x6b49ce={},_0x3ca902={},_0x1e6f38={'count':0x0,'rows':[]};var _0x573712=_[_0x4148('0x2b')](db['OpenchannelQueueReport'][_0x4148('0x2c')],function(_0x4f4989){return{'name':_0x4f4989['fieldName'],'type':_0x4f4989['type']['key']};});_0x3ca902[_0x4148('0x2d')]=_[_0x4148('0x2b')](_0x573712,_0x4148('0x28'));_0x3ca902['query']=_[_0x4148('0x2e')](_0x58786e[_0x4148('0x2f')]);_0x3ca902[_0x4148('0x30')]=_['intersection'](_0x3ca902[_0x4148('0x2d')],_0x3ca902[_0x4148('0x2f')]);_0x6b49ce['attributes']=_[_0x4148('0x31')](_0x3ca902[_0x4148('0x2d')],qs[_0x4148('0x32')](_0x58786e[_0x4148('0x2f')][_0x4148('0x32')]));_0x6b49ce[_0x4148('0x33')]=_0x6b49ce['attributes'][_0x4148('0x34')]?_0x6b49ce[_0x4148('0x33')]:_0x3ca902[_0x4148('0x2d')];if(!_0x58786e[_0x4148('0x2f')]['hasOwnProperty'](_0x4148('0x35'))){_0x6b49ce[_0x4148('0x1f')]=qs['limit'](_0x58786e['query'][_0x4148('0x1f')]);_0x6b49ce[_0x4148('0x1d')]=qs[_0x4148('0x1d')](_0x58786e[_0x4148('0x2f')][_0x4148('0x1d')]);}_0x6b49ce[_0x4148('0x36')]=qs[_0x4148('0x37')](_0x58786e[_0x4148('0x2f')][_0x4148('0x37')]);_0x6b49ce[_0x4148('0x38')]=qs[_0x4148('0x30')](_['pick'](_0x58786e[_0x4148('0x2f')],_0x3ca902['filters']),_0x573712);if(_0x58786e[_0x4148('0x2f')][_0x4148('0x39')]){_0x6b49ce[_0x4148('0x38')]=_[_0x4148('0x3a')](_0x6b49ce[_0x4148('0x38')],{'$or':_[_0x4148('0x2b')](_0x573712,function(_0x4a42bc){if(_0x4a42bc['type']!==_0x4148('0x3b')){var _0x14a27c={};_0x14a27c[_0x4a42bc[_0x4148('0x28')]]={'$like':'%'+_0x58786e[_0x4148('0x2f')][_0x4148('0x39')]+'%'};return _0x14a27c;}})});}_0x6b49ce=_['merge']({},_0x6b49ce,_0x58786e[_0x4148('0x3c')]);var _0xe64fff={'where':_0x6b49ce[_0x4148('0x38')]};return db[_0x4148('0x3d')][_0x4148('0x20')](_0xe64fff)[_0x4148('0x3e')](function(_0x1cb93d){_0x1e6f38[_0x4148('0x20')]=_0x1cb93d;if(_0x58786e[_0x4148('0x2f')][_0x4148('0x3f')]){_0x6b49ce['include']=[{'all':!![]}];}return db[_0x4148('0x3d')][_0x4148('0x40')](_0x6b49ce);})['then'](function(_0x1386e0){_0x1e6f38[_0x4148('0x41')]=_0x1386e0;return _0x1e6f38;})[_0x4148('0x3e')](respondWithFilteredResult(_0x236a7f,_0x6b49ce))[_0x4148('0x42')](handleError(_0x236a7f,null));};exports[_0x4148('0x43')]=function(_0x41b3eb,_0x37f178){var _0x58ecac={'raw':!![],'where':{'id':_0x41b3eb[_0x4148('0x44')]['id']}},_0x364073={};_0x364073[_0x4148('0x2d')]=_[_0x4148('0x2e')](db[_0x4148('0x3d')][_0x4148('0x2c')]);_0x364073[_0x4148('0x2f')]=_[_0x4148('0x2e')](_0x41b3eb['query']);_0x364073[_0x4148('0x30')]=_[_0x4148('0x31')](_0x364073[_0x4148('0x2d')],_0x364073[_0x4148('0x2f')]);_0x58ecac[_0x4148('0x33')]=_['intersection'](_0x364073[_0x4148('0x2d')],qs['fields'](_0x41b3eb[_0x4148('0x2f')][_0x4148('0x32')]));_0x58ecac['attributes']=_0x58ecac[_0x4148('0x33')][_0x4148('0x34')]?_0x58ecac[_0x4148('0x33')]:_0x364073[_0x4148('0x2d')];if(_0x41b3eb['query'][_0x4148('0x3f')]){_0x58ecac[_0x4148('0x45')]=[{'all':!![]}];}_0x58ecac=_[_0x4148('0x3a')]({},_0x58ecac,_0x41b3eb[_0x4148('0x3c')]);return db[_0x4148('0x3d')][_0x4148('0x46')](_0x58ecac)[_0x4148('0x3e')](handleEntityNotFound(_0x37f178,null))['then'](respondWithResult(_0x37f178,null))[_0x4148('0x42')](handleError(_0x37f178,null));};exports[_0x4148('0x47')]=function(_0x4caf61,_0x14b24a){return db[_0x4148('0x3d')][_0x4148('0x47')](_0x4caf61[_0x4148('0x48')],{})[_0x4148('0x3e')](respondWithResult(_0x14b24a,0xc9))[_0x4148('0x42')](handleError(_0x14b24a,null));};exports[_0x4148('0x26')]=function(_0x5046b7,_0x4e561f){if(_0x5046b7['body']['id']){delete _0x5046b7[_0x4148('0x48')]['id'];}return db['OpenchannelQueueReport'][_0x4148('0x46')]({'where':{'id':_0x5046b7['params']['id']}})[_0x4148('0x3e')](handleEntityNotFound(_0x4e561f,null))[_0x4148('0x3e')](saveUpdates(_0x5046b7[_0x4148('0x48')],null))['then'](respondWithResult(_0x4e561f,null))['catch'](handleError(_0x4e561f,null));};exports[_0x4148('0x49')]=function(_0x53c206,_0x380a41){return db[_0x4148('0x3d')][_0x4148('0x46')]({'where':{'id':_0x53c206[_0x4148('0x44')]['id']}})[_0x4148('0x3e')](handleEntityNotFound(_0x380a41,null))[_0x4148('0x3e')](removeEntity(_0x380a41,null))[_0x4148('0x42')](handleError(_0x380a41,null));};exports[_0x4148('0x4a')]=function(_0x42f02c,_0x4851c9){return db[_0x4148('0x3d')][_0x4148('0x4a')]()[_0x4148('0x3e')](respondWithResult(_0x4851c9,null))[_0x4148('0x42')](handleError(_0x4851c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index 034632a..212d8b0 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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x414c8b,_0x49a096){var _0x561db9=function(_0x229ec5){while(--_0x229ec5){_0x414c8b['push'](_0x414c8b['shift']());}};_0x561db9(++_0x49a096);}(_0x1261,0x144));var _0x1126=function(_0x24b53b,_0x57c20d){_0x24b53b=_0x24b53b-0x0;var _0x3b5c00=_0x1261[_0x24b53b];return _0x3b5c00;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x170e56,_0x4750dc){var _0x141888=function(_0x11fe4b){while(--_0x11fe4b){_0x170e56['push'](_0x170e56['shift']());}};_0x141888(++_0x4750dc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x339129,_0x86dcc6){_0x339129=_0x339129-0x0;var _0x1570df=_0x5fc3[_0x339129];return _0x1570df;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index bf5742b..f7c7119 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 _0x0447=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','OpenchannelQueueReport,\x20%s,\x20%s','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','raw','then','UpdateOpenchannelQueueReport','update','body','options','where','attributes','limit','catch','lodash'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x0447,0x8b));var _0x7044=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0x0447[_0x26a4ea];return _0x1b669e;};'use strict';var _=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var moment=require(_0x7044('0x2'));var BPromise=require(_0x7044('0x3'));var rs=require(_0x7044('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7044('0x5'))['db'];var utils=require(_0x7044('0x6'));var logger=require(_0x7044('0x7'))(_0x7044('0x8'));var config=require(_0x7044('0x9'));var jayson=require(_0x7044('0xa'));var client=jayson[_0x7044('0xb')][_0x7044('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x66b8cb,_0x51de50,_0x72d341){return new BPromise(function(_0x42d53b,_0x2a2b36){return client[_0x7044('0xd')](_0x66b8cb,_0x72d341)['then'](function(_0x41616d){logger[_0x7044('0xe')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x51de50,_0x7044('0xf'));logger[_0x7044('0x10')](_0x7044('0x11'),_0x51de50,_0x7044('0xf'),JSON['stringify'](_0x41616d));if(_0x41616d[_0x7044('0x12')]){if(_0x41616d['error']['code']===0x1f4){logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')][_0x7044('0x14')]);return _0x2a2b36(_0x41616d[_0x7044('0x12')]['message']);}logger['error'](_0x7044('0x13'),_0x51de50,_0x41616d[_0x7044('0x12')]['message']);return _0x42d53b(_0x41616d['error'][_0x7044('0x14')]);}else{logger[_0x7044('0xe')](_0x7044('0x13'),_0x51de50,_0x7044('0xf'));_0x42d53b(_0x41616d[_0x7044('0x15')][_0x7044('0x14')]);}})['catch'](function(_0xdae8a){logger[_0x7044('0x12')](_0x7044('0x13'),_0x51de50,_0xdae8a);_0x2a2b36(_0xdae8a);});});}exports[_0x7044('0x16')]=function(_0x219486){var _0x3f373c=this;return new Promise(function(_0x4df89b,_0x1f300e){return db[_0x7044('0x17')][_0x7044('0x18')](_0x219486['body'],{'raw':_0x219486['options']?_0x219486['options'][_0x7044('0x19')]===undefined?!![]:![]:!![]})[_0x7044('0x1a')](function(_0x2c5dcb){logger[_0x7044('0xe')](_0x7044('0x16'),_0x219486);logger['debug'](_0x7044('0x16'),_0x219486,JSON['stringify'](_0x2c5dcb));_0x4df89b(_0x2c5dcb);})['catch'](function(_0x3db88b){logger[_0x7044('0x12')](_0x7044('0x16'),_0x3db88b[_0x7044('0x14')],_0x219486);_0x1f300e(_0x3f373c[_0x7044('0x12')](0x1f4,_0x3db88b[_0x7044('0x14')]));});});};exports[_0x7044('0x1b')]=function(_0x9452a1){var _0x4271b5=this;return new Promise(function(_0x5e2c9a,_0x5d7d8a){return db[_0x7044('0x17')][_0x7044('0x1c')](_0x9452a1[_0x7044('0x1d')],{'raw':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x1f')]||null:null,'attributes':_0x9452a1[_0x7044('0x1e')]?_0x9452a1[_0x7044('0x1e')][_0x7044('0x20')]||null:null,'limit':_0x9452a1['options']?_0x9452a1[_0x7044('0x1e')][_0x7044('0x21')]||null:null})[_0x7044('0x1a')](function(_0x1a75ff){logger['info'](_0x7044('0x1b'),_0x9452a1);logger['debug']('UpdateOpenchannelQueueReport',_0x9452a1,JSON['stringify'](_0x1a75ff));_0x5e2c9a(_0x1a75ff);})[_0x7044('0x22')](function(_0x55ea91){logger[_0x7044('0x12')](_0x7044('0x1b'),_0x55ea91['message'],_0x9452a1);_0x5d7d8a(_0x4271b5['error'](0x1f4,_0x55ea91[_0x7044('0x14')]));});});}; \ No newline at end of file +var _0x47c5=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueueReport','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4b9d10,_0x546ad4){var _0xd7750a=function(_0x400a9a){while(--_0x400a9a){_0x4b9d10['push'](_0x4b9d10['shift']());}};_0xd7750a(++_0x546ad4);}(_0x47c5,0x165));var _0x547c=function(_0x568ae7,_0x2b5fa3){_0x568ae7=_0x568ae7-0x0;var _0x257050=_0x47c5[_0x568ae7];return _0x257050;};'use strict';var _=require(_0x547c('0x0'));var util=require(_0x547c('0x1'));var moment=require(_0x547c('0x2'));var BPromise=require(_0x547c('0x3'));var rs=require(_0x547c('0x4'));var fs=require('fs');var Redis=require(_0x547c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x547c('0x6'));var logger=require(_0x547c('0x7'))('rpc');var config=require(_0x547c('0x8'));var jayson=require(_0x547c('0x9'));var client=jayson['client'][_0x547c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x439f25,_0x381f2e,_0x10a334){return new BPromise(function(_0x12fb7d,_0x4ef079){return client[_0x547c('0xb')](_0x439f25,_0x10a334)[_0x547c('0xc')](function(_0x10dec9){logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));logger[_0x547c('0x10')](_0x547c('0x11'),_0x381f2e,_0x547c('0xf'),JSON[_0x547c('0x12')](_0x10dec9));if(_0x10dec9[_0x547c('0x13')]){if(_0x10dec9['error'][_0x547c('0x14')]===0x1f4){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x4ef079(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}logger[_0x547c('0x13')](_0x547c('0xe'),_0x381f2e,_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);return _0x12fb7d(_0x10dec9[_0x547c('0x13')][_0x547c('0x15')]);}else{logger[_0x547c('0xd')](_0x547c('0xe'),_0x381f2e,_0x547c('0xf'));_0x12fb7d(_0x10dec9[_0x547c('0x16')][_0x547c('0x15')]);}})[_0x547c('0x17')](function(_0x39498d){logger[_0x547c('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x381f2e,_0x39498d);_0x4ef079(_0x39498d);});});}exports['CreateOpenchannelQueueReport']=function(_0x23fa9e){var _0x199e4f=this;return new Promise(function(_0xeb059e,_0x4a8901){return db[_0x547c('0x18')][_0x547c('0x19')](_0x23fa9e[_0x547c('0x1a')],{'raw':_0x23fa9e['options']?_0x23fa9e[_0x547c('0x1b')][_0x547c('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x5453f9){logger[_0x547c('0xd')](_0x547c('0x1d'),_0x23fa9e);logger['debug'](_0x547c('0x1d'),_0x23fa9e,JSON[_0x547c('0x12')](_0x5453f9));_0xeb059e(_0x5453f9);})['catch'](function(_0x2e317a){logger[_0x547c('0x13')](_0x547c('0x1d'),_0x2e317a['message'],_0x23fa9e);_0x4a8901(_0x199e4f[_0x547c('0x13')](0x1f4,_0x2e317a[_0x547c('0x15')]));});});};exports[_0x547c('0x1e')]=function(_0x26823c){var _0x1f3581=this;return new Promise(function(_0x2663bc,_0x2ab2cc){return db[_0x547c('0x18')]['update'](_0x26823c[_0x547c('0x1a')],{'raw':_0x26823c['options']?_0x26823c['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26823c['options']?_0x26823c[_0x547c('0x1b')]['where']||null:null,'attributes':_0x26823c[_0x547c('0x1b')]?_0x26823c['options'][_0x547c('0x1f')]||null:null,'limit':_0x26823c['options']?_0x26823c[_0x547c('0x1b')][_0x547c('0x20')]||null:null})[_0x547c('0xc')](function(_0x30a96c){logger[_0x547c('0xd')]('UpdateOpenchannelQueueReport',_0x26823c);logger['debug'](_0x547c('0x1e'),_0x26823c,JSON['stringify'](_0x30a96c));_0x2663bc(_0x30a96c);})[_0x547c('0x17')](function(_0xed2d39){logger[_0x547c('0x13')](_0x547c('0x1e'),_0xed2d39[_0x547c('0x15')],_0x26823c);_0x2ab2cc(_0x1f3581[_0x547c('0x13')](0x1f4,_0xed2d39[_0x547c('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 15ec7b5..f613e7c 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 _0x12f9=['./openchannelTransferReport.controller','get','isAuthenticated','describe','/:id','show','put','update','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd9f102,_0x5a0d28){var _0x2652e4=function(_0x5021a1){while(--_0x5021a1){_0xd9f102['push'](_0xd9f102['shift']());}};_0x2652e4(++_0x5a0d28);}(_0x12f9,0x199));var _0x912f=function(_0x1b9f97,_0xcc9cd3){_0x1b9f97=_0x1b9f97-0x0;var _0x3e9a9b=_0x12f9[_0x1b9f97];return _0x3e9a9b;};'use strict';var multer=require('multer');var util=require(_0x912f('0x0'));var path=require(_0x912f('0x1'));var timeout=require(_0x912f('0x2'));var express=require(_0x912f('0x3'));var router=express[_0x912f('0x4')]();var fs_extra=require(_0x912f('0x5'));var auth=require(_0x912f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x912f('0x7'));router[_0x912f('0x8')]('/',auth[_0x912f('0x9')](),controller['index']);router['get']('/describe',auth[_0x912f('0x9')](),controller[_0x912f('0xa')]);router[_0x912f('0x8')](_0x912f('0xb'),auth['isAuthenticated'](),controller[_0x912f('0xc')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x912f('0xd')]('/:id',auth[_0x912f('0x9')](),controller[_0x912f('0xe')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x912f('0xf')]);module['exports']=router; \ No newline at end of file +var _0xa3f5=['show','create','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xa3f5,0x11c));var _0x5a3f=function(_0x5dd0aa,_0x4f5d0c){_0x5dd0aa=_0x5dd0aa-0x0;var _0x71501c=_0xa3f5[_0x5dd0aa];return _0x71501c;};'use strict';var multer=require(_0x5a3f('0x0'));var util=require(_0x5a3f('0x1'));var path=require(_0x5a3f('0x2'));var timeout=require(_0x5a3f('0x3'));var express=require(_0x5a3f('0x4'));var router=express[_0x5a3f('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5a3f('0x6'));var interaction=require(_0x5a3f('0x7'));var config=require(_0x5a3f('0x8'));var controller=require(_0x5a3f('0x9'));router['get']('/',auth[_0x5a3f('0xa')](),controller[_0x5a3f('0xb')]);router[_0x5a3f('0xc')](_0x5a3f('0xd'),auth['isAuthenticated'](),controller[_0x5a3f('0xe')]);router[_0x5a3f('0xc')](_0x5a3f('0xf'),auth['isAuthenticated'](),controller[_0x5a3f('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x5a3f('0x11')]);router['put'](_0x5a3f('0xf'),auth[_0x5a3f('0xa')](),controller['update']);router['delete'](_0x5a3f('0xf'),auth[_0x5a3f('0xa')](),controller[_0x5a3f('0x12')]);module[_0x5a3f('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 79cae59..238f54b 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x44f415,_0x276134){var _0x2cc367=function(_0x404c6d){while(--_0x404c6d){_0x44f415['push'](_0x44f415['shift']());}};_0x2cc367(++_0x276134);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xf3cd[_0x3eb630];return _0x1b840d;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x464d67,_0x3d5705){var _0x4e60ac=function(_0x257b07){while(--_0x257b07){_0x464d67['push'](_0x464d67['shift']());}};_0x4e60ac(++_0x3d5705);}(_0x70e0,0x17b));var _0x070e=function(_0x3b232a,_0x3926bd){_0x3b232a=_0x3b232a-0x0;var _0x2a96be=_0x70e0[_0x3b232a];return _0x2a96be;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index ae3ebaf..04dfc6f 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 _0xac9d=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xac9d,0x14d));var _0xdac9=function(_0x211576,_0xcc41af){_0x211576=_0x211576-0x0;var _0x3ce235=_0xac9d[_0x211576];return _0x3ce235;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b'));_0x3eed7a[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x170afd[_0xdac9('0x34')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a[_0xdac9('0x34')]);_0x4c4e21[_0xdac9('0x38')]=_['intersection'](_0x3eed7a['model'],qs[_0xdac9('0x39')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x39')]));_0x4c4e21[_0xdac9('0x38')]=_0x4c4e21[_0xdac9('0x38')]['length']?_0x4c4e21[_0xdac9('0x38')]:_0x3eed7a['model'];if(!_0x170afd[_0xdac9('0x34')][_0xdac9('0x3a')]('nolimit')){_0x4c4e21[_0xdac9('0x20')]=qs['limit'](_0x170afd['query'][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x1e')]);}_0x4c4e21[_0xdac9('0x3b')]=qs['sort'](_0x170afd[_0xdac9('0x34')][_0xdac9('0x3c')]);_0x4c4e21['where']=qs[_0xdac9('0x36')](_[_0xdac9('0x3d')](_0x170afd[_0xdac9('0x34')],_0x3eed7a[_0xdac9('0x36')]),_0x13efba);if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x3e')]){_0x4c4e21[_0xdac9('0x3f')]=_['merge'](_0x4c4e21[_0xdac9('0x3f')],{'$or':_[_0xdac9('0x2d')](_0x13efba,function(_0x238769){if(_0x238769['type']!==_0xdac9('0x40')){var _0x338e4a={};_0x338e4a[_0x238769[_0xdac9('0x2b')]]={'$like':'%'+_0x170afd[_0xdac9('0x34')]['filter']+'%'};return _0x338e4a;}})});}_0x4c4e21=_['merge']({},_0x4c4e21,_0x170afd[_0xdac9('0x41')]);var _0xe47a3c={'where':_0x4c4e21[_0xdac9('0x3f')]};return db[_0xdac9('0x2e')][_0xdac9('0x21')](_0xe47a3c)['then'](function(_0x8435e8){_0x3505c5['count']=_0x8435e8;if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x42')]){_0x4c4e21[_0xdac9('0x43')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x44')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x413fb1){_0x3505c5[_0xdac9('0x45')]=_0x413fb1;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x46')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x47')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x48')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x33')]=_['keys'](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x5335ae[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x24b570[_0xdac9('0x34')]);_0x5335ae[_0xdac9('0x36')]=_['intersection'](_0x5335ae[_0xdac9('0x33')],_0x5335ae['query']);_0x441676[_0xdac9('0x38')]=_[_0xdac9('0x37')](_0x5335ae[_0xdac9('0x33')],qs[_0xdac9('0x39')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x38')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x33')];if(_0x24b570[_0xdac9('0x34')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x49')]({},_0x441676,_0x24b570[_0xdac9('0x41')]);return db[_0xdac9('0x2e')][_0xdac9('0x4a')](_0x441676)[_0xdac9('0x26')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x26')](respondWithResult(_0x278826,null))[_0xdac9('0x46')](handleError(_0x278826,null));};exports[_0xdac9('0x4b')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x2e')][_0xdac9('0x4b')](_0x5c008b[_0xdac9('0x4c')],{})[_0xdac9('0x26')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x46')](handleError(_0x621cf,null));};exports[_0xdac9('0x25')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x4c')]['id']){delete _0x37b498[_0xdac9('0x4c')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4a')]({'where':{'id':_0x37b498[_0xdac9('0x48')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x26')](respondWithResult(_0x140dc5,null))[_0xdac9('0x46')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x2e')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x48')]['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x4d')]=function(_0x4469d8,_0x222de9){return db[_0xdac9('0x2e')][_0xdac9('0x4d')]()[_0xdac9('0x26')](respondWithResult(_0x222de9,null))[_0xdac9('0x46')](handleError(_0x222de9,null));}; \ No newline at end of file +var _0x93f4=['length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes'];(function(_0x30c3c2,_0x330cca){var _0x738110=function(_0x13891e){while(--_0x13891e){_0x30c3c2['push'](_0x30c3c2['shift']());}};_0x738110(++_0x330cca);}(_0x93f4,0x13a));var _0x493f=function(_0x4b8618,_0x3dcb39){_0x4b8618=_0x4b8618-0x0;var _0x3da94d=_0x93f4[_0x4b8618];return _0x3da94d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x493f('0x0'));var zipdir=require(_0x493f('0x1'));var jsonpatch=require(_0x493f('0x2'));var rp=require(_0x493f('0x3'));var moment=require(_0x493f('0x4'));var BPromise=require(_0x493f('0x5'));var Mustache=require(_0x493f('0x6'));var util=require('util');var path=require(_0x493f('0x7'));var sox=require('sox');var csv=require(_0x493f('0x8'));var ejs=require(_0x493f('0x9'));var fs=require('fs');var fs_extra=require(_0x493f('0xa'));var _=require(_0x493f('0xb'));var squel=require(_0x493f('0xc'));var crypto=require(_0x493f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x493f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x493f('0xf'));var Papa=require(_0x493f('0x10'));var Redis=require('ioredis');var authService=require(_0x493f('0x11'));var qs=require(_0x493f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x493f('0x13'));var utils=require('../../config/utils');var config=require(_0x493f('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x493f('0x15'))['db'];function respondWithStatusCode(_0x25eb44,_0x36aa24){_0x36aa24=_0x36aa24||0xcc;return function(_0x1e5126){if(_0x1e5126){return _0x25eb44[_0x493f('0x16')](_0x36aa24);}return _0x25eb44[_0x493f('0x17')](_0x36aa24)['end']();};}function respondWithResult(_0x54c788,_0x395ad4){_0x395ad4=_0x395ad4||0xc8;return function(_0x30496d){if(_0x30496d){return _0x54c788[_0x493f('0x17')](_0x395ad4)[_0x493f('0x18')](_0x30496d);}};}function respondWithFilteredResult(_0x419fb7,_0x55cd17){return function(_0x21dd33){if(_0x21dd33){var _0x1b034b=typeof _0x55cd17[_0x493f('0x19')]===_0x493f('0x1a')&&typeof _0x55cd17['limit']===_0x493f('0x1a');var _0x59f18a=_0x21dd33[_0x493f('0x1b')];var _0x4ecfc2=_0x1b034b?0x0:_0x55cd17[_0x493f('0x19')];var _0x1c6237=_0x1b034b?_0x21dd33[_0x493f('0x1b')]:_0x55cd17[_0x493f('0x19')]+_0x55cd17[_0x493f('0x1c')];var _0x362032;if(_0x1c6237>=_0x59f18a){_0x1c6237=_0x59f18a;_0x362032=0xc8;}else{_0x362032=0xce;}_0x419fb7['status'](_0x362032);return _0x419fb7[_0x493f('0x1d')](_0x493f('0x1e'),_0x4ecfc2+'-'+_0x1c6237+'/'+_0x59f18a)['json'](_0x21dd33);}return null;};}function patchUpdates(_0x3287b1){return function(_0x4d1c45){try{jsonpatch[_0x493f('0x1f')](_0x4d1c45,_0x3287b1,!![]);}catch(_0x50b9d6){return BPromise[_0x493f('0x20')](_0x50b9d6);}return _0x4d1c45[_0x493f('0x21')]();};}function saveUpdates(_0x2e209c,_0x27e467){return function(_0x20dc4f){if(_0x20dc4f){return _0x20dc4f[_0x493f('0x22')](_0x2e209c)[_0x493f('0x23')](function(_0x588ce5){return _0x588ce5;});}return null;};}function removeEntity(_0x24dcfd,_0x50952e){return function(_0x3674d5){if(_0x3674d5){return _0x3674d5[_0x493f('0x24')]()[_0x493f('0x23')](function(){_0x24dcfd[_0x493f('0x17')](0xcc)[_0x493f('0x25')]();});}};}function handleEntityNotFound(_0xe38ab7,_0x1b0827){return function(_0x583c57){if(!_0x583c57){_0xe38ab7[_0x493f('0x16')](0x194);}return _0x583c57;};}function handleError(_0x40eb1f,_0x106bfa){_0x106bfa=_0x106bfa||0x1f4;return function(_0x2e1c63){logger[_0x493f('0x26')](_0x2e1c63[_0x493f('0x27')]);if(_0x2e1c63[_0x493f('0x28')]){delete _0x2e1c63[_0x493f('0x28')];}_0x40eb1f['status'](_0x106bfa)[_0x493f('0x29')](_0x2e1c63);};}exports[_0x493f('0x2a')]=function(_0x2e43ea,_0x503d0f){var _0x24f3b2={},_0x15e0df={},_0x1e7373={'count':0x0,'rows':[]};var _0x1e2acd=_[_0x493f('0x2b')](db[_0x493f('0x2c')][_0x493f('0x2d')],function(_0x115653){return{'name':_0x115653[_0x493f('0x2e')],'type':_0x115653[_0x493f('0x2f')][_0x493f('0x30')]};});_0x15e0df[_0x493f('0x31')]=_[_0x493f('0x2b')](_0x1e2acd,_0x493f('0x28'));_0x15e0df[_0x493f('0x32')]=_[_0x493f('0x33')](_0x2e43ea[_0x493f('0x32')]);_0x15e0df[_0x493f('0x34')]=_[_0x493f('0x35')](_0x15e0df[_0x493f('0x31')],_0x15e0df[_0x493f('0x32')]);_0x24f3b2['attributes']=_[_0x493f('0x35')](_0x15e0df[_0x493f('0x31')],qs['fields'](_0x2e43ea[_0x493f('0x32')][_0x493f('0x36')]));_0x24f3b2[_0x493f('0x37')]=_0x24f3b2['attributes'][_0x493f('0x38')]?_0x24f3b2[_0x493f('0x37')]:_0x15e0df[_0x493f('0x31')];if(!_0x2e43ea[_0x493f('0x32')]['hasOwnProperty'](_0x493f('0x39'))){_0x24f3b2[_0x493f('0x1c')]=qs[_0x493f('0x1c')](_0x2e43ea[_0x493f('0x32')][_0x493f('0x1c')]);_0x24f3b2['offset']=qs['offset'](_0x2e43ea['query']['offset']);}_0x24f3b2[_0x493f('0x3a')]=qs[_0x493f('0x3b')](_0x2e43ea[_0x493f('0x32')][_0x493f('0x3b')]);_0x24f3b2[_0x493f('0x3c')]=qs['filters'](_[_0x493f('0x3d')](_0x2e43ea[_0x493f('0x32')],_0x15e0df[_0x493f('0x34')]),_0x1e2acd);if(_0x2e43ea[_0x493f('0x32')][_0x493f('0x3e')]){_0x24f3b2['where']=_[_0x493f('0x3f')](_0x24f3b2[_0x493f('0x3c')],{'$or':_[_0x493f('0x2b')](_0x1e2acd,function(_0x259659){if(_0x259659['type']!==_0x493f('0x40')){var _0x26fc11={};_0x26fc11[_0x259659['name']]={'$like':'%'+_0x2e43ea[_0x493f('0x32')][_0x493f('0x3e')]+'%'};return _0x26fc11;}})});}_0x24f3b2=_[_0x493f('0x3f')]({},_0x24f3b2,_0x2e43ea['options']);var _0x2c5ede={'where':_0x24f3b2['where']};return db['OpenchannelTransferReport'][_0x493f('0x1b')](_0x2c5ede)[_0x493f('0x23')](function(_0x2434d4){_0x1e7373[_0x493f('0x1b')]=_0x2434d4;if(_0x2e43ea[_0x493f('0x32')][_0x493f('0x41')]){_0x24f3b2[_0x493f('0x42')]=[{'all':!![]}];}return db[_0x493f('0x2c')]['findAll'](_0x24f3b2);})['then'](function(_0x35da64){_0x1e7373[_0x493f('0x43')]=_0x35da64;return _0x1e7373;})[_0x493f('0x23')](respondWithFilteredResult(_0x503d0f,_0x24f3b2))[_0x493f('0x44')](handleError(_0x503d0f,null));};exports[_0x493f('0x45')]=function(_0x51de80,_0x5a7c02){var _0x20ac8c={'raw':!![],'where':{'id':_0x51de80[_0x493f('0x46')]['id']}},_0x275fa0={};_0x275fa0['model']=_[_0x493f('0x33')](db[_0x493f('0x2c')][_0x493f('0x2d')]);_0x275fa0[_0x493f('0x32')]=_[_0x493f('0x33')](_0x51de80[_0x493f('0x32')]);_0x275fa0[_0x493f('0x34')]=_[_0x493f('0x35')](_0x275fa0[_0x493f('0x31')],_0x275fa0[_0x493f('0x32')]);_0x20ac8c[_0x493f('0x37')]=_[_0x493f('0x35')](_0x275fa0[_0x493f('0x31')],qs[_0x493f('0x36')](_0x51de80[_0x493f('0x32')]['fields']));_0x20ac8c[_0x493f('0x37')]=_0x20ac8c[_0x493f('0x37')]['length']?_0x20ac8c['attributes']:_0x275fa0[_0x493f('0x31')];if(_0x51de80['query'][_0x493f('0x41')]){_0x20ac8c[_0x493f('0x42')]=[{'all':!![]}];}_0x20ac8c=_[_0x493f('0x3f')]({},_0x20ac8c,_0x51de80['options']);return db[_0x493f('0x2c')][_0x493f('0x47')](_0x20ac8c)[_0x493f('0x23')](handleEntityNotFound(_0x5a7c02,null))[_0x493f('0x23')](respondWithResult(_0x5a7c02,null))[_0x493f('0x44')](handleError(_0x5a7c02,null));};exports[_0x493f('0x48')]=function(_0x4ff974,_0x43c772){return db[_0x493f('0x2c')][_0x493f('0x48')](_0x4ff974['body'],{})[_0x493f('0x23')](respondWithResult(_0x43c772,0xc9))[_0x493f('0x44')](handleError(_0x43c772,null));};exports[_0x493f('0x22')]=function(_0x756765,_0x452e1d){if(_0x756765[_0x493f('0x49')]['id']){delete _0x756765[_0x493f('0x49')]['id'];}return db[_0x493f('0x2c')][_0x493f('0x47')]({'where':{'id':_0x756765['params']['id']}})[_0x493f('0x23')](handleEntityNotFound(_0x452e1d,null))['then'](saveUpdates(_0x756765['body'],null))[_0x493f('0x23')](respondWithResult(_0x452e1d,null))[_0x493f('0x44')](handleError(_0x452e1d,null));};exports[_0x493f('0x24')]=function(_0x5ce1e3,_0x1f242b){return db[_0x493f('0x2c')][_0x493f('0x47')]({'where':{'id':_0x5ce1e3[_0x493f('0x46')]['id']}})[_0x493f('0x23')](handleEntityNotFound(_0x1f242b,null))['then'](removeEntity(_0x1f242b,null))[_0x493f('0x44')](handleError(_0x1f242b,null));};exports['describe']=function(_0x8a457b,_0x31b4aa){return db[_0x493f('0x2c')]['describe']()['then'](respondWithResult(_0x31b4aa,null))[_0x493f('0x44')](handleError(_0x31b4aa,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index d532615..d49f295 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 _0x1664=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','uniqueid'];(function(_0x1fb620,_0x471543){var _0x3142cd=function(_0x4594cd){while(--_0x4594cd){_0x1fb620['push'](_0x1fb620['shift']());}};_0x3142cd(++_0x471543);}(_0x1664,0x145));var _0x4166=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x1664[_0x4ae6ef];return _0x3cbb4e;};'use strict';var _=require(_0x4166('0x0'));var util=require(_0x4166('0x1'));var logger=require(_0x4166('0x2'))(_0x4166('0x3'));var moment=require(_0x4166('0x4'));var BPromise=require(_0x4166('0x5'));var rp=require(_0x4166('0x6'));var fs=require('fs');var path=require(_0x4166('0x7'));var rimraf=require(_0x4166('0x8'));var config=require('../../config/environment');var attributes=require(_0x4166('0x9'));module['exports']=function(_0x12de5b,_0x5ce8ad){return _0x12de5b[_0x4166('0xa')](_0x4166('0xb'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x4166('0xc'),'fields':[_0x4166('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf275=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define'];(function(_0x53aaf8,_0x863bcb){var _0x1fedb1=function(_0x5696f4){while(--_0x5696f4){_0x53aaf8['push'](_0x53aaf8['shift']());}};_0x1fedb1(++_0x863bcb);}(_0xf275,0x1bd));var _0x5f27=function(_0x4cf6b5,_0x544a4a){_0x4cf6b5=_0x4cf6b5-0x0;var _0xb458a4=_0xf275[_0x4cf6b5];return _0xb458a4;};'use strict';var _=require(_0x5f27('0x0'));var util=require('util');var logger=require(_0x5f27('0x1'))(_0x5f27('0x2'));var moment=require(_0x5f27('0x3'));var BPromise=require('bluebird');var rp=require(_0x5f27('0x4'));var fs=require('fs');var path=require(_0x5f27('0x5'));var rimraf=require(_0x5f27('0x6'));var config=require(_0x5f27('0x7'));var attributes=require(_0x5f27('0x8'));module['exports']=function(_0x296602,_0x3ac826){return _0x296602[_0x5f27('0x9')](_0x5f27('0xa'),attributes,{'tableName':_0x5f27('0xb'),'paranoid':![],'indexes':[{'name':_0x5f27('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 4016bfa..e814449 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 _0xf9d5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','stringify','error','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis'];(function(_0x3e91c3,_0x36abf9){var _0x129346=function(_0x3e031c){while(--_0x3e031c){_0x3e91c3['push'](_0x3e91c3['shift']());}};_0x129346(++_0x36abf9);}(_0xf9d5,0x122));var _0x5f9d=function(_0x50df1f,_0x45b8b1){_0x50df1f=_0x50df1f-0x0;var _0x5180e3=_0xf9d5[_0x50df1f];return _0x5180e3;};'use strict';var _=require('lodash');var util=require(_0x5f9d('0x0'));var moment=require(_0x5f9d('0x1'));var BPromise=require('bluebird');var rs=require(_0x5f9d('0x2'));var fs=require('fs');var Redis=require(_0x5f9d('0x3'));var db=require(_0x5f9d('0x4'))['db'];var utils=require(_0x5f9d('0x5'));var logger=require(_0x5f9d('0x6'))(_0x5f9d('0x7'));var config=require(_0x5f9d('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5f9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24999e,_0x38fb6b,_0x4fb9f7){return new BPromise(function(_0x3420b2,_0x23e865){return client[_0x5f9d('0xa')](_0x24999e,_0x4fb9f7)[_0x5f9d('0xb')](function(_0xcc3772){logger[_0x5f9d('0xc')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x5f9d('0xd'));logger[_0x5f9d('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x38fb6b,'request\x20sent',JSON[_0x5f9d('0xf')](_0xcc3772));if(_0xcc3772[_0x5f9d('0x10')]){if(_0xcc3772[_0x5f9d('0x10')]['code']===0x1f4){logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772[_0x5f9d('0x10')][_0x5f9d('0x12')]);return _0x23e865(_0xcc3772['error'][_0x5f9d('0x12')]);}logger[_0x5f9d('0x10')](_0x5f9d('0x11'),_0x38fb6b,_0xcc3772['error'][_0x5f9d('0x12')]);return _0x3420b2(_0xcc3772[_0x5f9d('0x10')]['message']);}else{logger['info'](_0x5f9d('0x11'),_0x38fb6b,_0x5f9d('0xd'));_0x3420b2(_0xcc3772[_0x5f9d('0x13')][_0x5f9d('0x12')]);}})[_0x5f9d('0x14')](function(_0x47f480){logger['error']('OpenchannelTransferReport,\x20%s,\x20%s',_0x38fb6b,_0x47f480);_0x23e865(_0x47f480);});});} \ No newline at end of file +var _0xf1e1=['error','code','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4fcc4a,_0x4f8ebe){var _0x219ec3=function(_0x32bbd3){while(--_0x32bbd3){_0x4fcc4a['push'](_0x4fcc4a['shift']());}};_0x219ec3(++_0x4f8ebe);}(_0xf1e1,0x102));var _0x1f1e=function(_0x3c22e0,_0x1dc6ea){_0x3c22e0=_0x3c22e0-0x0;var _0x215811=_0xf1e1[_0x3c22e0];return _0x215811;};'use strict';var _=require(_0x1f1e('0x0'));var util=require('util');var moment=require(_0x1f1e('0x1'));var BPromise=require('bluebird');var rs=require(_0x1f1e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f1e('0x3'))['db'];var utils=require(_0x1f1e('0x4'));var logger=require(_0x1f1e('0x5'))(_0x1f1e('0x6'));var config=require(_0x1f1e('0x7'));var jayson=require(_0x1f1e('0x8'));var client=jayson[_0x1f1e('0x9')][_0x1f1e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1db643,_0x38585e,_0x46e32b){return new BPromise(function(_0x3699d2,_0x6ab45b){return client[_0x1f1e('0xb')](_0x1db643,_0x46e32b)['then'](function(_0x44e626){logger[_0x1f1e('0xc')](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));logger[_0x1f1e('0xf')](_0x1f1e('0x10'),_0x38585e,_0x1f1e('0xe'),JSON[_0x1f1e('0x11')](_0x44e626));if(_0x44e626[_0x1f1e('0x12')]){if(_0x44e626['error'][_0x1f1e('0x13')]===0x1f4){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);return _0x6ab45b(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}logger['error'](_0x1f1e('0xd'),_0x38585e,_0x44e626[_0x1f1e('0x12')]['message']);return _0x3699d2(_0x44e626[_0x1f1e('0x12')][_0x1f1e('0x14')]);}else{logger['info'](_0x1f1e('0xd'),_0x38585e,_0x1f1e('0xe'));_0x3699d2(_0x44e626[_0x1f1e('0x15')][_0x1f1e('0x14')]);}})[_0x1f1e('0x16')](function(_0x3f978f){logger[_0x1f1e('0x12')](_0x1f1e('0xd'),_0x38585e,_0x3f978f);_0x6ab45b(_0x3f978f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index e6fe919..396f5f3 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 _0x4815=['../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x349b5c,_0x55e5fa){var _0x3efcac=function(_0x27832d){while(--_0x27832d){_0x349b5c['push'](_0x349b5c['shift']());}};_0x3efcac(++_0x55e5fa);}(_0x4815,0x8a));var _0x5481=function(_0x4afafa,_0x203dc5){_0x4afafa=_0x4afafa-0x0;var _0x4dab93=_0x4815[_0x4afafa];return _0x4dab93;};'use strict';var multer=require(_0x5481('0x0'));var util=require(_0x5481('0x1'));var path=require(_0x5481('0x2'));var timeout=require(_0x5481('0x3'));var express=require(_0x5481('0x4'));var router=express[_0x5481('0x5')]();var fs_extra=require(_0x5481('0x6'));var auth=require(_0x5481('0x7'));var interaction=require(_0x5481('0x8'));var config=require(_0x5481('0x9'));var controller=require(_0x5481('0xa'));router[_0x5481('0xb')]('/',auth[_0x5481('0xc')](),controller[_0x5481('0xd')]);router['get'](_0x5481('0xe'),auth[_0x5481('0xc')](),controller['show']);router['post']('/',auth[_0x5481('0xc')](),controller[_0x5481('0xf')]);router[_0x5481('0x10')](_0x5481('0xe'),auth[_0x5481('0xc')](),controller[_0x5481('0x11')]);router[_0x5481('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x5481('0x13')]);module[_0x5481('0x14')]=router; \ No newline at end of file +var _0x0f6f=['isAuthenticated','index','/:id','show','post','create','update','delete','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0x2110d4,_0x20b1d5){var _0x2bcdf6=function(_0x1e9204){while(--_0x1e9204){_0x2110d4['push'](_0x2110d4['shift']());}};_0x2bcdf6(++_0x20b1d5);}(_0x0f6f,0x1c2));var _0xf0f6=function(_0x49ed67,_0x290989){_0x49ed67=_0x49ed67-0x0;var _0x1523d5=_0x0f6f[_0x49ed67];return _0x1523d5;};'use strict';var multer=require(_0xf0f6('0x0'));var util=require(_0xf0f6('0x1'));var path=require('path');var timeout=require(_0xf0f6('0x2'));var express=require(_0xf0f6('0x3'));var router=express[_0xf0f6('0x4')]();var fs_extra=require(_0xf0f6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf0f6('0x6'));var config=require(_0xf0f6('0x7'));var controller=require('./pause.controller');router[_0xf0f6('0x8')]('/',auth[_0xf0f6('0x9')](),controller[_0xf0f6('0xa')]);router['get'](_0xf0f6('0xb'),auth['isAuthenticated'](),controller[_0xf0f6('0xc')]);router[_0xf0f6('0xd')]('/',auth['isAuthenticated'](),controller[_0xf0f6('0xe')]);router['put'](_0xf0f6('0xb'),auth[_0xf0f6('0x9')](),controller[_0xf0f6('0xf')]);router[_0xf0f6('0x10')](_0xf0f6('0xb'),auth[_0xf0f6('0x9')](),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 80645af..4280d0d 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 _0x1032=['name','sequelize','STRING'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x1032,0x94));var _0x2103=function(_0x2256d2,_0x5c0398){_0x2256d2=_0x2256d2-0x0;var _0x9415fa=_0x1032[_0x2256d2];return _0x9415fa;};'use strict';var Sequelize=require(_0x2103('0x0'));module['exports']={'name':{'type':Sequelize[_0x2103('0x1')],'unique':_0x2103('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x2103('0x1')]}}; \ No newline at end of file +var _0x7d43=['STRING','name','sequelize','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7d43,0x15a));var _0x37d4=function(_0x2b65df,_0x2c029c){_0x2b65df=_0x2b65df-0x0;var _0xd6c56=_0x7d43[_0x2b65df];return _0xd6c56;};'use strict';var Sequelize=require(_0x37d4('0x0'));module[_0x37d4('0x1')]={'name':{'type':Sequelize[_0x37d4('0x2')],'unique':_0x37d4('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x37d4('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 1d2bc79..9150453 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 _0x3390=['request-promise','mustache','sox','to-csv','ejs','lodash','squel','crypto','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','options','include','findAll','catch','show','params','keys','includeAll','merge','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir'];(function(_0x3aaf97,_0x4fa2e8){var _0xeba75e=function(_0xf7f986){while(--_0xf7f986){_0x3aaf97['push'](_0x3aaf97['shift']());}};_0xeba75e(++_0x4fa2e8);}(_0x3390,0x175));var _0x0339=function(_0x55275a,_0x5c769b){_0x55275a=_0x55275a-0x0;var _0x45860a=_0x3390[_0x55275a];return _0x45860a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0339('0x0'));var zipdir=require(_0x0339('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0339('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0339('0x3'));var util=require('util');var path=require('path');var sox=require(_0x0339('0x4'));var csv=require(_0x0339('0x5'));var ejs=require(_0x0339('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0339('0x7'));var squel=require(_0x0339('0x8'));var crypto=require(_0x0339('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0339('0xa'));var toCsv=require(_0x0339('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0339('0xb'));var qs=require(_0x0339('0xc'));var as=require(_0x0339('0xd'));var hardwareService=require(_0x0339('0xe'));var logger=require(_0x0339('0xf'))(_0x0339('0x10'));var utils=require('../../config/utils');var config=require(_0x0339('0x11'));var licenseUtil=require(_0x0339('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e96c5,_0x4a3bc8){_0x4a3bc8=_0x4a3bc8||0xcc;return function(_0x14efb){if(_0x14efb){return _0x2e96c5[_0x0339('0x13')](_0x4a3bc8);}return _0x2e96c5['status'](_0x4a3bc8)['end']();};}function respondWithResult(_0x5cd124,_0x4de60c){_0x4de60c=_0x4de60c||0xc8;return function(_0x1b3002){if(_0x1b3002){return _0x5cd124[_0x0339('0x14')](_0x4de60c)[_0x0339('0x15')](_0x1b3002);}};}function respondWithFilteredResult(_0x568724,_0x436195){return function(_0x4785f3){if(_0x4785f3){var _0x276048=typeof _0x436195[_0x0339('0x16')]===_0x0339('0x17')&&typeof _0x436195[_0x0339('0x18')]===_0x0339('0x17');var _0x2ab91e=_0x4785f3[_0x0339('0x19')];var _0x1d4da0=_0x276048?0x0:_0x436195[_0x0339('0x16')];var _0x3a9669=_0x276048?_0x4785f3[_0x0339('0x19')]:_0x436195[_0x0339('0x16')]+_0x436195['limit'];var _0x16fbac;if(_0x3a9669>=_0x2ab91e){_0x3a9669=_0x2ab91e;_0x16fbac=0xc8;}else{_0x16fbac=0xce;}_0x568724['status'](_0x16fbac);return _0x568724['set'](_0x0339('0x1a'),_0x1d4da0+'-'+_0x3a9669+'/'+_0x2ab91e)[_0x0339('0x15')](_0x4785f3);}return null;};}function patchUpdates(_0x5575d0){return function(_0x3cbf33){try{jsonpatch[_0x0339('0x1b')](_0x3cbf33,_0x5575d0,!![]);}catch(_0x981f4d){return BPromise['reject'](_0x981f4d);}return _0x3cbf33[_0x0339('0x1c')]();};}function saveUpdates(_0x300756,_0x308a21){return function(_0x5bcdfb){if(_0x5bcdfb){return _0x5bcdfb[_0x0339('0x1d')](_0x300756)[_0x0339('0x1e')](function(_0x2d9992){return _0x2d9992;});}return null;};}function removeEntity(_0x115643,_0x19d262){return function(_0x4ceb06){if(_0x4ceb06){return _0x4ceb06[_0x0339('0x1f')]()[_0x0339('0x1e')](function(){var _0x247e31=_0x4ceb06[_0x0339('0x20')]({'plain':!![]});var _0x147f61=_0x0339('0x21');return db[_0x0339('0x22')][_0x0339('0x1f')]({'where':{'type':_0x147f61,'resourceId':_0x247e31['id']}})[_0x0339('0x1e')](function(){return _0x4ceb06;});})[_0x0339('0x1e')](function(){_0x115643[_0x0339('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfef446,_0x14cb31){return function(_0x115b8c){if(!_0x115b8c){_0xfef446[_0x0339('0x13')](0x194);}return _0x115b8c;};}function handleError(_0x3c7054,_0x30e7e2){_0x30e7e2=_0x30e7e2||0x1f4;return function(_0xcc3ba1){logger[_0x0339('0x23')](_0xcc3ba1[_0x0339('0x24')]);if(_0xcc3ba1[_0x0339('0x25')]){delete _0xcc3ba1[_0x0339('0x25')];}_0x3c7054[_0x0339('0x14')](_0x30e7e2)[_0x0339('0x26')](_0xcc3ba1);};}exports['index']=function(_0x2ee6e5,_0x24c445){var _0x3a3cdc={},_0x4904b4={},_0x2a8d82={'count':0x0,'rows':[]};var _0x1845cd=_[_0x0339('0x27')](db[_0x0339('0x28')][_0x0339('0x29')],function(_0x363159){return{'name':_0x363159[_0x0339('0x2a')],'type':_0x363159[_0x0339('0x2b')]['key']};});_0x4904b4[_0x0339('0x2c')]=_['map'](_0x1845cd,_0x0339('0x25'));_0x4904b4[_0x0339('0x2d')]=_['keys'](_0x2ee6e5[_0x0339('0x2d')]);_0x4904b4[_0x0339('0x2e')]=_[_0x0339('0x2f')](_0x4904b4[_0x0339('0x2c')],_0x4904b4[_0x0339('0x2d')]);_0x3a3cdc[_0x0339('0x30')]=_['intersection'](_0x4904b4[_0x0339('0x2c')],qs['fields'](_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x31')]));_0x3a3cdc['attributes']=_0x3a3cdc[_0x0339('0x30')][_0x0339('0x32')]?_0x3a3cdc['attributes']:_0x4904b4[_0x0339('0x2c')];if(!_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x33')](_0x0339('0x34'))){_0x3a3cdc[_0x0339('0x18')]=qs[_0x0339('0x18')](_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x18')]);_0x3a3cdc['offset']=qs['offset'](_0x2ee6e5['query'][_0x0339('0x16')]);}_0x3a3cdc['order']=qs[_0x0339('0x35')](_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x35')]);_0x3a3cdc[_0x0339('0x36')]=qs[_0x0339('0x2e')](_['pick'](_0x2ee6e5[_0x0339('0x2d')],_0x4904b4[_0x0339('0x2e')]),_0x1845cd);if(_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x37')]){_0x3a3cdc[_0x0339('0x36')]=_['merge'](_0x3a3cdc[_0x0339('0x36')],{'$or':_[_0x0339('0x27')](_0x1845cd,function(_0x3ecd76){if(_0x3ecd76[_0x0339('0x2b')]!==_0x0339('0x38')){var _0x3be031={};_0x3be031[_0x3ecd76['name']]={'$like':'%'+_0x2ee6e5[_0x0339('0x2d')][_0x0339('0x37')]+'%'};return _0x3be031;}})});}_0x3a3cdc=_['merge']({},_0x3a3cdc,_0x2ee6e5[_0x0339('0x39')]);var _0x417fc0={'where':_0x3a3cdc[_0x0339('0x36')]};return db[_0x0339('0x28')][_0x0339('0x19')](_0x417fc0)[_0x0339('0x1e')](function(_0x24a564){_0x2a8d82[_0x0339('0x19')]=_0x24a564;if(_0x2ee6e5[_0x0339('0x2d')]['includeAll']){_0x3a3cdc[_0x0339('0x3a')]=[{'all':!![]}];}return db[_0x0339('0x28')][_0x0339('0x3b')](_0x3a3cdc);})['then'](function(_0x11d238){_0x2a8d82['rows']=_0x11d238;return _0x2a8d82;})[_0x0339('0x1e')](respondWithFilteredResult(_0x24c445,_0x3a3cdc))[_0x0339('0x3c')](handleError(_0x24c445,null));};exports[_0x0339('0x3d')]=function(_0x49b543,_0x2e7e4e){var _0x1d6667={'raw':!![],'where':{'id':_0x49b543[_0x0339('0x3e')]['id']}},_0x1a9cd7={};_0x1a9cd7['model']=_['keys'](db[_0x0339('0x28')][_0x0339('0x29')]);_0x1a9cd7[_0x0339('0x2d')]=_[_0x0339('0x3f')](_0x49b543[_0x0339('0x2d')]);_0x1a9cd7[_0x0339('0x2e')]=_['intersection'](_0x1a9cd7[_0x0339('0x2c')],_0x1a9cd7[_0x0339('0x2d')]);_0x1d6667[_0x0339('0x30')]=_[_0x0339('0x2f')](_0x1a9cd7[_0x0339('0x2c')],qs[_0x0339('0x31')](_0x49b543[_0x0339('0x2d')]['fields']));_0x1d6667[_0x0339('0x30')]=_0x1d6667['attributes'][_0x0339('0x32')]?_0x1d6667['attributes']:_0x1a9cd7[_0x0339('0x2c')];if(_0x49b543[_0x0339('0x2d')][_0x0339('0x40')]){_0x1d6667['include']=[{'all':!![]}];}_0x1d6667=_[_0x0339('0x41')]({},_0x1d6667,_0x49b543[_0x0339('0x39')]);return db[_0x0339('0x28')]['find'](_0x1d6667)[_0x0339('0x1e')](handleEntityNotFound(_0x2e7e4e,null))[_0x0339('0x1e')](respondWithResult(_0x2e7e4e,null))[_0x0339('0x3c')](handleError(_0x2e7e4e,null));};exports[_0x0339('0x42')]=function(_0x396dea,_0x53b1c4){return db[_0x0339('0x28')][_0x0339('0x42')](_0x396dea[_0x0339('0x43')],{})['then'](function(_0x2d9d44){var _0x3e269c=_0x396dea[_0x0339('0x44')][_0x0339('0x20')]({'plain':!![]});if(!_0x3e269c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e269c[_0x0339('0x45')]===_0x0339('0x44')){var _0x1defdc=_0x2d9d44[_0x0339('0x20')]({'plain':!![]});var _0x461c36=_0x0339('0x21');return db[_0x0339('0x46')][_0x0339('0x47')]({'where':{'name':_0x461c36,'userProfileId':_0x3e269c[_0x0339('0x48')]},'raw':!![]})[_0x0339('0x1e')](function(_0x67325d){if(_0x67325d&&_0x67325d[_0x0339('0x49')]===0x0){return db[_0x0339('0x22')][_0x0339('0x42')]({'name':_0x1defdc['name'],'resourceId':_0x1defdc['id'],'type':_0x67325d[_0x0339('0x25')],'sectionId':_0x67325d['id']},{})[_0x0339('0x1e')](function(){return _0x2d9d44;});}else{return _0x2d9d44;}})[_0x0339('0x3c')](function(_0x14a468){logger[_0x0339('0x23')](_0x0339('0x4a'),_0x14a468);throw _0x14a468;});}return _0x2d9d44;})[_0x0339('0x1e')](respondWithResult(_0x53b1c4,0xc9))['catch'](handleError(_0x53b1c4,null));};exports[_0x0339('0x1d')]=function(_0x31fbab,_0x3aab65){if(_0x31fbab['body']['id']){delete _0x31fbab[_0x0339('0x43')]['id'];}return db[_0x0339('0x28')]['find']({'where':{'id':_0x31fbab[_0x0339('0x3e')]['id']}})[_0x0339('0x1e')](handleEntityNotFound(_0x3aab65,null))[_0x0339('0x1e')](saveUpdates(_0x31fbab[_0x0339('0x43')],null))[_0x0339('0x1e')](respondWithResult(_0x3aab65,null))[_0x0339('0x3c')](handleError(_0x3aab65,null));};exports['destroy']=function(_0x4c8b3b,_0x282f06){return db[_0x0339('0x28')][_0x0339('0x47')]({'where':{'id':_0x4c8b3b[_0x0339('0x3e')]['id']}})[_0x0339('0x1e')](handleEntityNotFound(_0x282f06,null))[_0x0339('0x1e')](removeEntity(_0x282f06,null))['catch'](handleError(_0x282f06,null));}; \ No newline at end of file +var _0x57c3=['pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy','get','Pauses','UserProfileResource','error','stack','name','send','map','Pause','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x57c3,0x17d));var _0x357c=function(_0x5b2bd7,_0x34bc30){_0x5b2bd7=_0x5b2bd7-0x0;var _0xfc8ea1=_0x57c3[_0x5b2bd7];return _0xfc8ea1;};'use strict';var emlformat=require(_0x357c('0x0'));var rimraf=require(_0x357c('0x1'));var zipdir=require(_0x357c('0x2'));var jsonpatch=require(_0x357c('0x3'));var rp=require(_0x357c('0x4'));var moment=require(_0x357c('0x5'));var BPromise=require(_0x357c('0x6'));var Mustache=require(_0x357c('0x7'));var util=require(_0x357c('0x8'));var path=require('path');var sox=require(_0x357c('0x9'));var csv=require(_0x357c('0xa'));var ejs=require(_0x357c('0xb'));var fs=require('fs');var fs_extra=require(_0x357c('0xc'));var _=require(_0x357c('0xd'));var squel=require(_0x357c('0xe'));var crypto=require(_0x357c('0xf'));var jsforce=require(_0x357c('0x10'));var deskjs=require(_0x357c('0x11'));var toCsv=require(_0x357c('0xa'));var querystring=require('querystring');var Papa=require(_0x357c('0x12'));var Redis=require(_0x357c('0x13'));var authService=require(_0x357c('0x14'));var qs=require(_0x357c('0x15'));var as=require(_0x357c('0x16'));var hardwareService=require(_0x357c('0x17'));var logger=require(_0x357c('0x18'))(_0x357c('0x19'));var utils=require(_0x357c('0x1a'));var config=require(_0x357c('0x1b'));var licenseUtil=require(_0x357c('0x1c'));var db=require(_0x357c('0x1d'))['db'];function respondWithStatusCode(_0x551bbc,_0x2959fb){_0x2959fb=_0x2959fb||0xcc;return function(_0x3646ec){if(_0x3646ec){return _0x551bbc[_0x357c('0x1e')](_0x2959fb);}return _0x551bbc[_0x357c('0x1f')](_0x2959fb)[_0x357c('0x20')]();};}function respondWithResult(_0x17eb17,_0x50775f){_0x50775f=_0x50775f||0xc8;return function(_0x7990a6){if(_0x7990a6){return _0x17eb17[_0x357c('0x1f')](_0x50775f)[_0x357c('0x21')](_0x7990a6);}};}function respondWithFilteredResult(_0x381b0d,_0x2c66c6){return function(_0x4564ff){if(_0x4564ff){var _0x4fb07b=typeof _0x2c66c6['offset']===_0x357c('0x22')&&typeof _0x2c66c6[_0x357c('0x23')]===_0x357c('0x22');var _0x49c8bc=_0x4564ff[_0x357c('0x24')];var _0xbfc2bf=_0x4fb07b?0x0:_0x2c66c6['offset'];var _0x3ffc5d=_0x4fb07b?_0x4564ff[_0x357c('0x24')]:_0x2c66c6[_0x357c('0x25')]+_0x2c66c6[_0x357c('0x23')];var _0x5859e3;if(_0x3ffc5d>=_0x49c8bc){_0x3ffc5d=_0x49c8bc;_0x5859e3=0xc8;}else{_0x5859e3=0xce;}_0x381b0d[_0x357c('0x1f')](_0x5859e3);return _0x381b0d['set'](_0x357c('0x26'),_0xbfc2bf+'-'+_0x3ffc5d+'/'+_0x49c8bc)[_0x357c('0x21')](_0x4564ff);}return null;};}function patchUpdates(_0x1ec619){return function(_0x3c5921){try{jsonpatch[_0x357c('0x27')](_0x3c5921,_0x1ec619,!![]);}catch(_0xffa91a){return BPromise[_0x357c('0x28')](_0xffa91a);}return _0x3c5921[_0x357c('0x29')]();};}function saveUpdates(_0x113cfd,_0x590365){return function(_0x22d74b){if(_0x22d74b){return _0x22d74b[_0x357c('0x2a')](_0x113cfd)[_0x357c('0x2b')](function(_0x1d8bd6){return _0x1d8bd6;});}return null;};}function removeEntity(_0x3db9b6,_0x27e85d){return function(_0x26ebb4){if(_0x26ebb4){return _0x26ebb4[_0x357c('0x2c')]()[_0x357c('0x2b')](function(){var _0x149225=_0x26ebb4[_0x357c('0x2d')]({'plain':!![]});var _0x83405e=_0x357c('0x2e');return db[_0x357c('0x2f')]['destroy']({'where':{'type':_0x83405e,'resourceId':_0x149225['id']}})['then'](function(){return _0x26ebb4;});})[_0x357c('0x2b')](function(){_0x3db9b6[_0x357c('0x1f')](0xcc)[_0x357c('0x20')]();});}};}function handleEntityNotFound(_0x1a2e28,_0x267fe8){return function(_0xa55a8b){if(!_0xa55a8b){_0x1a2e28[_0x357c('0x1e')](0x194);}return _0xa55a8b;};}function handleError(_0xcac490,_0x4b926f){_0x4b926f=_0x4b926f||0x1f4;return function(_0x387c09){logger[_0x357c('0x30')](_0x387c09[_0x357c('0x31')]);if(_0x387c09[_0x357c('0x32')]){delete _0x387c09[_0x357c('0x32')];}_0xcac490[_0x357c('0x1f')](_0x4b926f)[_0x357c('0x33')](_0x387c09);};}exports['index']=function(_0x2dbfef,_0x72c5fa){var _0x47a456={},_0x3dcc8d={},_0x1464be={'count':0x0,'rows':[]};var _0x1cabf6=_[_0x357c('0x34')](db[_0x357c('0x35')][_0x357c('0x36')],function(_0x42bbdc){return{'name':_0x42bbdc[_0x357c('0x37')],'type':_0x42bbdc[_0x357c('0x38')][_0x357c('0x39')]};});_0x3dcc8d['model']=_[_0x357c('0x34')](_0x1cabf6,_0x357c('0x32'));_0x3dcc8d[_0x357c('0x3a')]=_['keys'](_0x2dbfef[_0x357c('0x3a')]);_0x3dcc8d[_0x357c('0x3b')]=_[_0x357c('0x3c')](_0x3dcc8d[_0x357c('0x3d')],_0x3dcc8d[_0x357c('0x3a')]);_0x47a456['attributes']=_[_0x357c('0x3c')](_0x3dcc8d[_0x357c('0x3d')],qs[_0x357c('0x3e')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x3e')]));_0x47a456[_0x357c('0x3f')]=_0x47a456[_0x357c('0x3f')][_0x357c('0x40')]?_0x47a456[_0x357c('0x3f')]:_0x3dcc8d['model'];if(!_0x2dbfef[_0x357c('0x3a')]['hasOwnProperty'](_0x357c('0x41'))){_0x47a456[_0x357c('0x23')]=qs[_0x357c('0x23')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x23')]);_0x47a456[_0x357c('0x25')]=qs[_0x357c('0x25')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x25')]);}_0x47a456[_0x357c('0x42')]=qs[_0x357c('0x43')](_0x2dbfef[_0x357c('0x3a')][_0x357c('0x43')]);_0x47a456[_0x357c('0x44')]=qs[_0x357c('0x3b')](_[_0x357c('0x45')](_0x2dbfef[_0x357c('0x3a')],_0x3dcc8d[_0x357c('0x3b')]),_0x1cabf6);if(_0x2dbfef[_0x357c('0x3a')][_0x357c('0x46')]){_0x47a456[_0x357c('0x44')]=_[_0x357c('0x47')](_0x47a456[_0x357c('0x44')],{'$or':_[_0x357c('0x34')](_0x1cabf6,function(_0x86f9e6){if(_0x86f9e6[_0x357c('0x38')]!==_0x357c('0x48')){var _0x2a3f80={};_0x2a3f80[_0x86f9e6[_0x357c('0x32')]]={'$like':'%'+_0x2dbfef[_0x357c('0x3a')]['filter']+'%'};return _0x2a3f80;}})});}_0x47a456=_['merge']({},_0x47a456,_0x2dbfef[_0x357c('0x49')]);var _0x32b685={'where':_0x47a456[_0x357c('0x44')]};return db[_0x357c('0x35')][_0x357c('0x24')](_0x32b685)[_0x357c('0x2b')](function(_0x93b6f8){_0x1464be[_0x357c('0x24')]=_0x93b6f8;if(_0x2dbfef[_0x357c('0x3a')][_0x357c('0x4a')]){_0x47a456[_0x357c('0x4b')]=[{'all':!![]}];}return db[_0x357c('0x35')][_0x357c('0x4c')](_0x47a456);})[_0x357c('0x2b')](function(_0x160d91){_0x1464be[_0x357c('0x4d')]=_0x160d91;return _0x1464be;})[_0x357c('0x2b')](respondWithFilteredResult(_0x72c5fa,_0x47a456))[_0x357c('0x4e')](handleError(_0x72c5fa,null));};exports[_0x357c('0x4f')]=function(_0x37d2b6,_0x55e99e){var _0x4cc319={'raw':!![],'where':{'id':_0x37d2b6[_0x357c('0x50')]['id']}},_0x32cae7={};_0x32cae7[_0x357c('0x3d')]=_['keys'](db['Pause'][_0x357c('0x36')]);_0x32cae7[_0x357c('0x3a')]=_['keys'](_0x37d2b6[_0x357c('0x3a')]);_0x32cae7[_0x357c('0x3b')]=_['intersection'](_0x32cae7[_0x357c('0x3d')],_0x32cae7[_0x357c('0x3a')]);_0x4cc319['attributes']=_['intersection'](_0x32cae7[_0x357c('0x3d')],qs['fields'](_0x37d2b6[_0x357c('0x3a')][_0x357c('0x3e')]));_0x4cc319['attributes']=_0x4cc319[_0x357c('0x3f')][_0x357c('0x40')]?_0x4cc319[_0x357c('0x3f')]:_0x32cae7['model'];if(_0x37d2b6[_0x357c('0x3a')]['includeAll']){_0x4cc319['include']=[{'all':!![]}];}_0x4cc319=_[_0x357c('0x47')]({},_0x4cc319,_0x37d2b6[_0x357c('0x49')]);return db[_0x357c('0x35')][_0x357c('0x51')](_0x4cc319)[_0x357c('0x2b')](handleEntityNotFound(_0x55e99e,null))['then'](respondWithResult(_0x55e99e,null))['catch'](handleError(_0x55e99e,null));};exports[_0x357c('0x52')]=function(_0x5e1c10,_0x406b25){return db[_0x357c('0x35')][_0x357c('0x52')](_0x5e1c10[_0x357c('0x53')],{})[_0x357c('0x2b')](function(_0x3ba432){var _0x23bb22=_0x5e1c10[_0x357c('0x54')][_0x357c('0x2d')]({'plain':!![]});if(!_0x23bb22)throw new Error(_0x357c('0x55'));if(_0x23bb22[_0x357c('0x56')]===_0x357c('0x54')){var _0x4ef8be=_0x3ba432[_0x357c('0x2d')]({'plain':!![]});var _0x1a2cf8=_0x357c('0x2e');return db[_0x357c('0x57')]['find']({'where':{'name':_0x1a2cf8,'userProfileId':_0x23bb22[_0x357c('0x58')]},'raw':!![]})[_0x357c('0x2b')](function(_0x407fb4){if(_0x407fb4&&_0x407fb4[_0x357c('0x59')]===0x0){return db['UserProfileResource'][_0x357c('0x52')]({'name':_0x4ef8be[_0x357c('0x32')],'resourceId':_0x4ef8be['id'],'type':_0x407fb4[_0x357c('0x32')],'sectionId':_0x407fb4['id']},{})[_0x357c('0x2b')](function(){return _0x3ba432;});}else{return _0x3ba432;}})[_0x357c('0x4e')](function(_0xc01700){logger[_0x357c('0x30')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc01700);throw _0xc01700;});}return _0x3ba432;})[_0x357c('0x2b')](respondWithResult(_0x406b25,0xc9))[_0x357c('0x4e')](handleError(_0x406b25,null));};exports[_0x357c('0x2a')]=function(_0x478630,_0x1a9621){if(_0x478630['body']['id']){delete _0x478630['body']['id'];}return db[_0x357c('0x35')][_0x357c('0x51')]({'where':{'id':_0x478630[_0x357c('0x50')]['id']}})[_0x357c('0x2b')](handleEntityNotFound(_0x1a9621,null))[_0x357c('0x2b')](saveUpdates(_0x478630[_0x357c('0x53')],null))[_0x357c('0x2b')](respondWithResult(_0x1a9621,null))[_0x357c('0x4e')](handleError(_0x1a9621,null));};exports[_0x357c('0x2c')]=function(_0x9b8e4e,_0x318719){return db[_0x357c('0x35')]['find']({'where':{'id':_0x9b8e4e[_0x357c('0x50')]['id']}})[_0x357c('0x2b')](handleEntityNotFound(_0x318719,null))['then'](removeEntity(_0x318719,null))[_0x357c('0x4e')](handleError(_0x318719,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 823bbfe..f3aac14 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 _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x1cd5b1,_0x58dd23){_0x1cd5b1=_0x1cd5b1-0x0;var _0x25b4c7=_0x7fbe[_0x1cd5b1];return _0x25b4c7;};'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 +var _0xe14b=['bluebird','path','./pause.attributes','exports','define','Pause','tools_pauses','lodash','util','moment'];(function(_0x3e1c04,_0x38885e){var _0x451afd=function(_0x5bf98a){while(--_0x5bf98a){_0x3e1c04['push'](_0x3e1c04['shift']());}};_0x451afd(++_0x38885e);}(_0xe14b,0x93));var _0xbe14=function(_0x45b2b5,_0x273192){_0x45b2b5=_0x45b2b5-0x0;var _0x1fd982=_0xe14b[_0x45b2b5];return _0x1fd982;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/pause/pause.rpc.js b/server/api/pause/pause.rpc.js index 1d0d52e..e6d31b8 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(_0x3960aa,_0x42b864){var _0x57da0f=function(_0x348661){while(--_0x348661){_0x3960aa['push'](_0x3960aa['shift']());}};_0x57da0f(++_0x42b864);}(_0x7a54,0x106));var _0x47a5=function(_0x559f57,_0x29591f){_0x559f57=_0x559f57-0x0;var _0x4f6332=_0x7a54[_0x559f57];return _0x4f6332;};'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(_0x53aa6d,_0x2d2714){var _0x2ce081=function(_0x1618e6){while(--_0x1618e6){_0x53aa6d['push'](_0x53aa6d['shift']());}};_0x2ce081(++_0x2d2714);}(_0x7a54,0x106));var _0x47a5=function(_0x37d9a3,_0x5e8641){_0x37d9a3=_0x37d9a3-0x0;var _0x5b4dd3=_0x7a54[_0x37d9a3];return _0x5b4dd3;};'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 def0029..0d0051a 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 _0x222f=['index','webhookGet','isAuthenticated','show','/:id/download','download','join','server/files/plugins','originalname','replace','format','extname','now','post','single','file','upload','/webhook','webhookPost','put','/:id','update','delete','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0xe3e0af,_0x4564ed){var _0x4828e9=function(_0x55c7a7){while(--_0x55c7a7){_0xe3e0af['push'](_0xe3e0af['shift']());}};_0x4828e9(++_0x4564ed);}(_0x222f,0x1a4));var _0xf222=function(_0x4d8dc3,_0x585fd1){_0x4d8dc3=_0x4d8dc3-0x0;var _0x9b03d9=_0x222f[_0x4d8dc3];return _0x9b03d9;};'use strict';var multer=require(_0xf222('0x0'));var util=require(_0xf222('0x1'));var path=require(_0xf222('0x2'));var timeout=require(_0xf222('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf222('0x4'));var auth=require(_0xf222('0x5'));var interaction=require(_0xf222('0x6'));var config=require(_0xf222('0x7'));var controller=require('./plugin.controller');router[_0xf222('0x8')]('/',auth['isAuthenticated'](),controller[_0xf222('0x9')]);router[_0xf222('0x8')]('/webhook',controller[_0xf222('0xa')]);router[_0xf222('0x8')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0xc')]);router[_0xf222('0x8')](_0xf222('0xd'),auth[_0xf222('0xb')](),controller[_0xf222('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2e29ad,_0x405080,_0x226dbd){_0x226dbd(null,path[_0xf222('0xf')](config['root'],_0xf222('0x10')));},'filename':function(_0x2850c7,_0x2a6965,_0x3d3d29){_0x2a6965[_0xf222('0x11')]=_0x2a6965[_0xf222('0x11')][_0xf222('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3d3d29(null,util[_0xf222('0x13')]('%s-%s%s',path['basename'](_0x2a6965[_0xf222('0x11')],path[_0xf222('0x14')](_0x2a6965['originalname'])),Date[_0xf222('0x15')](),path[_0xf222('0x14')](_0x2a6965[_0xf222('0x11')])));}})});router[_0xf222('0x16')]('/',upload[_0xf222('0x17')](_0xf222('0x18')),controller[_0xf222('0x19')]);router['post'](_0xf222('0x1a'),controller[_0xf222('0x1b')]);router[_0xf222('0x1c')](_0xf222('0x1d'),auth[_0xf222('0xb')](),controller[_0xf222('0x1e')]);router[_0xf222('0x1f')]('/:id',auth[_0xf222('0xb')](),controller[_0xf222('0x1f')]);module[_0xf222('0x20')]=router; \ No newline at end of file +var _0x8d0e=['basename','extname','now','post','file','upload','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','index','get','/webhook','webhookGet','/:id','isAuthenticated','show','/:id/download','download','join','root','server/files/plugins','originalname','replace'];(function(_0x213e2d,_0x47b0c2){var _0x468668=function(_0x5b760c){while(--_0x5b760c){_0x213e2d['push'](_0x213e2d['shift']());}};_0x468668(++_0x47b0c2);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x27822c,_0x11f904){_0x27822c=_0x27822c-0x0;var _0x314cce=_0x8d0e[_0x27822c];return _0x314cce;};'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']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),controller[_0xe8d0('0xd')]);router[_0xe8d0('0xb')](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x10')]);router['get'](_0xe8d0('0x11'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x580aab,_0x42e0c2,_0x25e6b8){_0x25e6b8(null,path[_0xe8d0('0x13')](config[_0xe8d0('0x14')],_0xe8d0('0x15')));},'filename':function(_0x41de69,_0x5934b2,_0x38fac0){_0x5934b2[_0xe8d0('0x16')]=_0x5934b2['originalname'][_0xe8d0('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x38fac0(null,util['format']('%s-%s%s',path[_0xe8d0('0x18')](_0x5934b2[_0xe8d0('0x16')],path[_0xe8d0('0x19')](_0x5934b2[_0xe8d0('0x16')])),Date[_0xe8d0('0x1a')](),path[_0xe8d0('0x19')](_0x5934b2['originalname'])));}})});router[_0xe8d0('0x1b')]('/',upload['single'](_0xe8d0('0x1c')),controller[_0xe8d0('0x1d')]);router[_0xe8d0('0x1b')]('/webhook',controller['webhookPost']);router['put'](_0xe8d0('0xe'),auth[_0xe8d0('0xf')](),controller[_0xe8d0('0x1e')]);router[_0xe8d0('0x1f')](_0xe8d0('0xe'),auth['isAuthenticated'](),controller[_0xe8d0('0x1f')]);module[_0xe8d0('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 f917bf9..c430d95 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 _0x4971=['sequelize','STRING','ENUM','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x2da61e,_0x8bf68f){var _0x5b9c75=function(_0x51a89e){while(--_0x51a89e){_0x2da61e['push'](_0x2da61e['shift']());}};_0x5b9c75(++_0x8bf68f);}(_0x4971,0x82));var _0x1497=function(_0xef4ef0,_0x3c72f9){_0xef4ef0=_0xef4ef0-0x0;var _0x39b60b=_0x4971[_0xef4ef0];return _0x39b60b;};'use strict';var Sequelize=require(_0x1497('0x0'));module['exports']={'name':{'type':Sequelize[_0x1497('0x1')]},'type':{'type':Sequelize[_0x1497('0x2')](_0x1497('0x3'),_0x1497('0x4'))},'description':{'type':Sequelize[_0x1497('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x1497('0x1')],'comment':_0x1497('0x6')},'active':{'type':Sequelize[_0x1497('0x7')],'defaultValue':0x0,'comment':_0x1497('0x8')},'sidebar':{'type':Sequelize[_0x1497('0x2')]('adminOnly',_0x1497('0x9'),_0x1497('0xa'),_0x1497('0xb')),'defaultValue':_0x1497('0xa'),'comment':_0x1497('0xc')},'icon':{'type':Sequelize[_0x1497('0x1')]},'adminUrl':{'type':Sequelize[_0x1497('0x1')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x1497('0x1')]}}; \ No newline at end of file +var _0x0185=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x27650e,_0x278f7a){var _0x28fe08=function(_0x476eee){while(--_0x476eee){_0x27650e['push'](_0x27650e['shift']());}};_0x28fe08(++_0x278f7a);}(_0x0185,0x164));var _0x5018=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x0185[_0x3c4737];return _0x2bb926;};'use strict';var Sequelize=require(_0x5018('0x0'));module[_0x5018('0x1')]={'name':{'type':Sequelize[_0x5018('0x2')]},'type':{'type':Sequelize[_0x5018('0x3')](_0x5018('0x4'),_0x5018('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x5018('0x2')],'comment':_0x5018('0x6')},'active':{'type':Sequelize[_0x5018('0x7')],'defaultValue':0x0,'comment':_0x5018('0x8')},'sidebar':{'type':Sequelize[_0x5018('0x3')](_0x5018('0x9'),_0x5018('0xa'),_0x5018('0xb'),_0x5018('0xc')),'defaultValue':'always','comment':_0x5018('0xd')},'icon':{'type':Sequelize[_0x5018('0x2')]},'adminUrl':{'type':Sequelize[_0x5018('0x2')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize[_0x5018('0x2')]},'scriptPath':{'type':Sequelize[_0x5018('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index e76ff9e..b022618 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 _0xf97b=['lodash','crypto','jsforce','desk.js','papaparse','archiver','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','end','json','offset','undefined','limit','status','set','Content-Range','apply','reject','update','destroy','then','error','stack','send','index','map','Plugin','rawAttributes','fieldName','type','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','include','findAll','rows','params','keys','length','includeAll','options','find','catch','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','pipe','glob','**/*','root','dirname','node_modules/**/*','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','Download\x20completed','info','Temporary\x20file\x20removed','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','parameters','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','html','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','role','userProfileId','get','UserProfileSection','Plugins','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','encoding','method','headers','content-length','content-type','endsWith','statusCode','webhookPost','%s%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra'];(function(_0xd964c6,_0x28b99f){var _0x4393a4=function(_0x67455b){while(--_0x67455b){_0xd964c6['push'](_0xd964c6['shift']());}};_0x4393a4(++_0x28b99f);}(_0xf97b,0x14f));var _0xbf97=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf97b[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbf97('0x0'));var zipdir=require(_0xbf97('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbf97('0x2'));var moment=require(_0xbf97('0x3'));var BPromise=require(_0xbf97('0x4'));var Mustache=require(_0xbf97('0x5'));var util=require(_0xbf97('0x6'));var path=require(_0xbf97('0x7'));var sox=require(_0xbf97('0x8'));var csv=require('to-csv');var ejs=require(_0xbf97('0x9'));var fs=require('fs');var fs_extra=require(_0xbf97('0xa'));var _=require(_0xbf97('0xb'));var squel=require('squel');var crypto=require(_0xbf97('0xc'));var jsforce=require(_0xbf97('0xd'));var deskjs=require(_0xbf97('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbf97('0xf'));var extract=require('extract-zip');var rimraf=require(_0xbf97('0x0'));var archiver=require(_0xbf97('0x10'));var Redis=require(_0xbf97('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbf97('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbf97('0x13'));var logger=require(_0xbf97('0x14'))(_0xbf97('0x15'));var utils=require(_0xbf97('0x16'));var config=require(_0xbf97('0x17'));var licenseUtil=require(_0xbf97('0x18'));var db=require(_0xbf97('0x19'))['db'];config[_0xbf97('0x1a')]=_[_0xbf97('0x1b')](config[_0xbf97('0x1a')],{'host':_0xbf97('0x1c'),'port':0x18eb});var socket=require(_0xbf97('0x1d'))(new Redis(config['redis']));require(_0xbf97('0x1e'))[_0xbf97('0x1f')](socket);function respondWithStatusCode(_0x5b1dee,_0x1c116a){_0x1c116a=_0x1c116a||0xcc;return function(_0xafbf1f){if(_0xafbf1f){return _0x5b1dee[_0xbf97('0x20')](_0x1c116a);}return _0x5b1dee['status'](_0x1c116a)[_0xbf97('0x21')]();};}function respondWithResult(_0x37b0fb,_0x1e5de1){_0x1e5de1=_0x1e5de1||0xc8;return function(_0x380729){if(_0x380729){return _0x37b0fb['status'](_0x1e5de1)[_0xbf97('0x22')](_0x380729);}};}function respondWithFilteredResult(_0x14fe5e,_0xa9c5d5){return function(_0x156ea1){if(_0x156ea1){var _0x4fc1d5=typeof _0xa9c5d5[_0xbf97('0x23')]===_0xbf97('0x24')&&typeof _0xa9c5d5['limit']===_0xbf97('0x24');var _0x122b42=_0x156ea1['count'];var _0x2ade79=_0x4fc1d5?0x0:_0xa9c5d5[_0xbf97('0x23')];var _0xd2edd2=_0x4fc1d5?_0x156ea1['count']:_0xa9c5d5['offset']+_0xa9c5d5[_0xbf97('0x25')];var _0x3d709f;if(_0xd2edd2>=_0x122b42){_0xd2edd2=_0x122b42;_0x3d709f=0xc8;}else{_0x3d709f=0xce;}_0x14fe5e[_0xbf97('0x26')](_0x3d709f);return _0x14fe5e[_0xbf97('0x27')](_0xbf97('0x28'),_0x2ade79+'-'+_0xd2edd2+'/'+_0x122b42)['json'](_0x156ea1);}return null;};}function patchUpdates(_0x325e87){return function(_0x23af98){try{jsonpatch[_0xbf97('0x29')](_0x23af98,_0x325e87,!![]);}catch(_0x474cd8){return BPromise[_0xbf97('0x2a')](_0x474cd8);}return _0x23af98['save']();};}function saveUpdates(_0x2235ff,_0x130efd){return function(_0x3510c2){if(_0x3510c2){return _0x3510c2[_0xbf97('0x2b')](_0x2235ff)['then'](function(_0x23d7be){return _0x23d7be;});}return null;};}function removeEntity(_0x1fd2e0,_0x4003a3){return function(_0x31c4d2){if(_0x31c4d2){return _0x31c4d2[_0xbf97('0x2c')]()['then'](function(){var _0x208288=_0x31c4d2['get']({'plain':!![]});var _0x180f40='Plugins';return db['UserProfileResource'][_0xbf97('0x2c')]({'where':{'type':_0x180f40,'resourceId':_0x208288['id']}})[_0xbf97('0x2d')](function(){return _0x31c4d2;});})['then'](function(){_0x1fd2e0[_0xbf97('0x26')](0xcc)[_0xbf97('0x21')]();});}};}function handleEntityNotFound(_0x5b12df,_0x320467){return function(_0x1e8164){if(!_0x1e8164){_0x5b12df[_0xbf97('0x20')](0x194);}return _0x1e8164;};}function handleError(_0x3e7da1,_0x3c2392){_0x3c2392=_0x3c2392||0x1f4;return function(_0x1834ae){logger[_0xbf97('0x2e')](_0x1834ae[_0xbf97('0x2f')]);if(_0x1834ae['name']){delete _0x1834ae['name'];}_0x3e7da1['status'](_0x3c2392)[_0xbf97('0x30')](_0x1834ae);};}exports[_0xbf97('0x31')]=function(_0x5ad552,_0x1b8252){var _0x1e83db={},_0x29a5c4={},_0x2e9b76={'count':0x0,'rows':[]};var _0x34945d=_[_0xbf97('0x32')](db[_0xbf97('0x33')][_0xbf97('0x34')],function(_0x13bb41){return{'name':_0x13bb41[_0xbf97('0x35')],'type':_0x13bb41[_0xbf97('0x36')]['key']};});_0x29a5c4[_0xbf97('0x37')]=_[_0xbf97('0x32')](_0x34945d,_0xbf97('0x38'));_0x29a5c4[_0xbf97('0x39')]=_['keys'](_0x5ad552[_0xbf97('0x39')]);_0x29a5c4[_0xbf97('0x3a')]=_[_0xbf97('0x3b')](_0x29a5c4[_0xbf97('0x37')],_0x29a5c4[_0xbf97('0x39')]);_0x1e83db[_0xbf97('0x3c')]=_[_0xbf97('0x3b')](_0x29a5c4['model'],qs[_0xbf97('0x3d')](_0x5ad552['query'][_0xbf97('0x3d')]));_0x1e83db[_0xbf97('0x3c')]=_0x1e83db[_0xbf97('0x3c')]['length']?_0x1e83db[_0xbf97('0x3c')]:_0x29a5c4[_0xbf97('0x37')];if(!_0x5ad552[_0xbf97('0x39')][_0xbf97('0x3e')]('nolimit')){_0x1e83db[_0xbf97('0x25')]=qs[_0xbf97('0x25')](_0x5ad552[_0xbf97('0x39')][_0xbf97('0x25')]);_0x1e83db[_0xbf97('0x23')]=qs[_0xbf97('0x23')](_0x5ad552[_0xbf97('0x39')]['offset']);}_0x1e83db[_0xbf97('0x3f')]=qs[_0xbf97('0x40')](_0x5ad552[_0xbf97('0x39')][_0xbf97('0x40')]);_0x1e83db[_0xbf97('0x41')]=qs[_0xbf97('0x3a')](_[_0xbf97('0x42')](_0x5ad552[_0xbf97('0x39')],_0x29a5c4[_0xbf97('0x3a')]),_0x34945d);if(_0x5ad552[_0xbf97('0x39')][_0xbf97('0x43')]){_0x1e83db['where']=_[_0xbf97('0x44')](_0x1e83db[_0xbf97('0x41')],{'$or':_[_0xbf97('0x32')](_0x34945d,function(_0x5df7c9){if(_0x5df7c9[_0xbf97('0x36')]!==_0xbf97('0x45')){var _0x370496={};_0x370496[_0x5df7c9[_0xbf97('0x38')]]={'$like':'%'+_0x5ad552[_0xbf97('0x39')][_0xbf97('0x43')]+'%'};return _0x370496;}})});}_0x1e83db=_[_0xbf97('0x44')]({},_0x1e83db,_0x5ad552['options']);var _0x357336={'where':_0x1e83db[_0xbf97('0x41')]};return db[_0xbf97('0x33')][_0xbf97('0x46')](_0x357336)['then'](function(_0x35aae1){_0x2e9b76[_0xbf97('0x46')]=_0x35aae1;if(_0x5ad552[_0xbf97('0x39')]['includeAll']){_0x1e83db[_0xbf97('0x47')]=[{'all':!![]}];}return db['Plugin'][_0xbf97('0x48')](_0x1e83db);})[_0xbf97('0x2d')](function(_0x1fa84a){_0x2e9b76[_0xbf97('0x49')]=_0x1fa84a;return _0x2e9b76;})[_0xbf97('0x2d')](respondWithFilteredResult(_0x1b8252,_0x1e83db))['catch'](handleError(_0x1b8252,null));};exports['show']=function(_0x59e9e6,_0xa7d88b){var _0x2d7633={'raw':!![],'where':{'id':_0x59e9e6[_0xbf97('0x4a')]['id']}},_0x4e5dfc={};_0x4e5dfc[_0xbf97('0x37')]=_[_0xbf97('0x4b')](db[_0xbf97('0x33')]['rawAttributes']);_0x4e5dfc[_0xbf97('0x39')]=_[_0xbf97('0x4b')](_0x59e9e6[_0xbf97('0x39')]);_0x4e5dfc['filters']=_[_0xbf97('0x3b')](_0x4e5dfc[_0xbf97('0x37')],_0x4e5dfc[_0xbf97('0x39')]);_0x2d7633['attributes']=_[_0xbf97('0x3b')](_0x4e5dfc[_0xbf97('0x37')],qs[_0xbf97('0x3d')](_0x59e9e6[_0xbf97('0x39')][_0xbf97('0x3d')]));_0x2d7633[_0xbf97('0x3c')]=_0x2d7633[_0xbf97('0x3c')][_0xbf97('0x4c')]?_0x2d7633['attributes']:_0x4e5dfc[_0xbf97('0x37')];if(_0x59e9e6[_0xbf97('0x39')][_0xbf97('0x4d')]){_0x2d7633[_0xbf97('0x47')]=[{'all':!![]}];}_0x2d7633=_[_0xbf97('0x44')]({},_0x2d7633,_0x59e9e6[_0xbf97('0x4e')]);return db[_0xbf97('0x33')][_0xbf97('0x4f')](_0x2d7633)[_0xbf97('0x2d')](handleEntityNotFound(_0xa7d88b,null))[_0xbf97('0x2d')](respondWithResult(_0xa7d88b,null))[_0xbf97('0x50')](handleError(_0xa7d88b,null));};exports['download']=function(_0x16990e,_0x4587c6,_0x990ec1){return db['Plugin'][_0xbf97('0x4f')]({'where':{'id':_0x16990e[_0xbf97('0x4a')]['id']},'attributes':['name','path'],'raw':!![]})[_0xbf97('0x2d')](handleEntityNotFound(_0x4587c6,null))['then'](function(_0x466237){if(_0x466237){var _0x5f4320=path[_0xbf97('0x51')](config['root'],_0xbf97('0x52'),util[_0xbf97('0x53')](_0xbf97('0x54'),path[_0xbf97('0x55')](_0x466237['path'])));var _0x58c96a=fs[_0xbf97('0x56')](_0x5f4320);var _0x27941c=archiver(_0xbf97('0x57'),{'zlib':{'level':0x9}});_0x27941c['on'](_0xbf97('0x58'),function(_0x451c39){if(_0x451c39[_0xbf97('0x59')]===_0xbf97('0x5a')){logger[_0xbf97('0x2e')](_0x451c39);}else{throw new db['Sequelize'][(_0xbf97('0x5b'))](_0xbf97('0x5c'));}});_0x27941c['on'](_0xbf97('0x2e'),function(_0x3e262a){throw new db[(_0xbf97('0x5d'))][(_0xbf97('0x5b'))](_0xbf97('0x5c'));});_0x27941c[_0xbf97('0x5e')](_0x58c96a);_0x27941c[_0xbf97('0x5f')](_0xbf97('0x60'),{'cwd':path[_0xbf97('0x51')](config[_0xbf97('0x61')],_0xbf97('0x52'),path[_0xbf97('0x62')](_0x466237[_0xbf97('0x7')])),'ignore':[path[_0xbf97('0x51')](path[_0xbf97('0x55')](_0x466237['path']),_0xbf97('0x63')),path[_0xbf97('0x51')](path[_0xbf97('0x55')](_0x466237[_0xbf97('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x58c96a['on'](_0xbf97('0x64'),function(){if(!fs[_0xbf97('0x65')](_0x5f4320)){throw new db['Sequelize']['Error']('Plugin\x20not\x20found');}return _0x4587c6['download'](_0x5f4320,util[_0xbf97('0x53')](_0xbf97('0x54'),path[_0xbf97('0x55')](_0x466237['path'])),function(_0x40a443){if(_0x40a443){throw new db[(_0xbf97('0x5d'))][(_0xbf97('0x5b'))](_0xbf97('0x66'));}fs[_0xbf97('0x67')](_0x5f4320);logger['info'](_0xbf97('0x68'));logger[_0xbf97('0x69')](_0xbf97('0x6a'));});});}return null;})[_0xbf97('0x50')](handleError(_0x4587c6,null));};exports['upload']=function(_0x5a2c2c,_0x5184d4,_0x3b49ca){var _0x344af9=path[_0xbf97('0x55')](_0x5a2c2c[_0xbf97('0x6b')][_0xbf97('0x6c')],path[_0xbf97('0x6d')](_0x5a2c2c[_0xbf97('0x6b')][_0xbf97('0x6c')]));var _0x4da671=path[_0xbf97('0x51')](config['root'],'server/files/plugins',_0x5a2c2c[_0xbf97('0x6b')][_0xbf97('0x6c')]);var _0x522b7c=path['join'](config[_0xbf97('0x61')],_0xbf97('0x52'),_0x344af9);logger['info'](_0xbf97('0x6e'),_0x4da671);logger[_0xbf97('0x69')](_0xbf97('0x6f'),_0x522b7c);try{fs[_0xbf97('0x70')](_0x4da671,parseInt(_0xbf97('0x71'),0x8));extract(_0x4da671,{'dir':_0x522b7c},function(_0x164e3e){if(_0x164e3e){logger[_0xbf97('0x2e')](_0x164e3e);handleError(_0x164e3e,!![]);};var _0x870f19=fs[_0xbf97('0x72')](_0x522b7c);if(_0x870f19[_0xbf97('0x4c')]>0x1){removeReferences(_0x4da671,_0x522b7c);logger[_0xbf97('0x2e')]('Invalid\x20plugin\x20structure');return _0x3b49ca(new Error(_0xbf97('0x73')));}var _0x51d1e6=fs[_0xbf97('0x74')](path[_0xbf97('0x51')](_0x522b7c,_0x870f19[0x0]));if(_0x51d1e6['isFile']()){removeReferences(_0x4da671,_0x522b7c);logger[_0xbf97('0x2e')](_0xbf97('0x73'));return _0x3b49ca(new Error(_0xbf97('0x73')));}if(_0x51d1e6[_0xbf97('0x75')]()){var _0x212bcc=fs[_0xbf97('0x72')](path[_0xbf97('0x51')](_0x522b7c,_0x870f19[0x0]));if(_0x212bcc[_0xbf97('0x4c')]===0x0){removeReferences(_0x4da671,_0x522b7c);logger[_0xbf97('0x2e')](_0xbf97('0x73'));return _0x3b49ca(new Error('Invalid\x20plugin\x20structure'));}var _0x47e77e=_0x212bcc[_0xbf97('0x76')](function(_0x26c007){return _0x26c007===_0xbf97('0x77');});if(!_0x47e77e){return _0x3b49ca(new Error(_0xbf97('0x78')));}var _0x194c26=fs['readFileSync'](path['join'](_0x522b7c,_0x870f19[0x0],_0xbf97('0x77')));var _0x2a8674=JSON[_0xbf97('0x79')](_0x194c26);if('undefined'==typeof _0x2a8674[_0xbf97('0x38')]){return _0x3b49ca(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x36')]){return _0x3b49ca(new Error(_0xbf97('0x7a')));}if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7b')]){return _0x3b49ca(new Error(_0xbf97('0x7c')));}if(_0xbf97('0x24')==typeof _0x2a8674['parameters']){return _0x3b49ca(new Error(_0xbf97('0x7d')));}if(_0x2a8674[_0xbf97('0x36')]==='html'){if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')]){return _0x3b49ca(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x80')]&&_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x81')]){return _0x3b49ca(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x2a8674[_0xbf97('0x36')]===_0xbf97('0x82')){if(_0xbf97('0x24')==typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x83')]){return _0x3b49ca(new Error(_0xbf97('0x84')));}if(_0xbf97('0x24')==typeof _0x2a8674['parameters'][_0xbf97('0x85')]){return _0x3b49ca(new Error(_0xbf97('0x86')));}}else{return _0x3b49ca(new Error(_0xbf97('0x87')));}var _0x438e37=_0x2a8674[_0xbf97('0x38')];var _0x4eddd8=_0x2a8674[_0xbf97('0x88')];var _0x34e89e=_0x2a8674[_0xbf97('0x36')];var _0x2a04a6=_0x2a8674[_0xbf97('0x89')]?_0x2a8674[_0xbf97('0x89')]:_0xbf97('0x8a');var _0x26925e=_0x2a8674['icon']?_0x2a8674[_0xbf97('0x8b')]:'icon-apps';var _0x355632='';var _0xd7cde7='';var _0x3aae99='';var _0x47af7c='';var _0x2bec17=_0x2a8674[_0xbf97('0x7b')];if(_0x34e89e===_0xbf97('0x8c')){if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x80')]){var _0x23f067=_0x2a8674['parameters'][_0xbf97('0x7f')][_0xbf97('0x80')];if(!/^(f|ht)tps?:\/\//i[_0xbf97('0x8d')](_0x23f067)){_0x355632=path['join'](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x23f067);}else{_0x355632=_0x23f067;}}else{logger[_0xbf97('0x69')](_0xbf97('0x8f'));}if(_0xbf97('0x24')!=typeof _0x2a8674['parameters']['views']['agent']){var _0x3fc0fb=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x81')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3fc0fb)){_0xd7cde7=path[_0xbf97('0x51')](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x3fc0fb);}else{_0xd7cde7=_0x3fc0fb;}}else{logger[_0xbf97('0x69')](_0xbf97('0x90'));}}else if(_0x34e89e==='script'){_0x3aae99=_0x2a8674[_0xbf97('0x7e')]['scriptName'];_0x47af7c=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x85')];if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')]['views']){if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x80')]){var _0x23f067=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xbf97('0x8d')](_0x23f067)){_0x355632=path['join'](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x23f067);}else{_0x355632=_0x23f067;}}if(_0xbf97('0x24')!=typeof _0x2a8674[_0xbf97('0x7e')]['views']['agent']){var _0x3fc0fb=_0x2a8674[_0xbf97('0x7e')][_0xbf97('0x7f')][_0xbf97('0x81')];if(!/^(f|ht)tps?:\/\//i[_0xbf97('0x8d')](_0x3fc0fb)){_0xd7cde7=path[_0xbf97('0x51')](_0xbf97('0x8e'),_0x344af9,_0x870f19[0x0],_0x3fc0fb);}else{_0xd7cde7=_0x3fc0fb;}}}}var _0x38898e={'name':_0x438e37,'description':_0x4eddd8,'path':path[_0xbf97('0x51')](_0x344af9,_0x870f19[0x0]),'type':_0x34e89e,'sidebar':_0x2a04a6,'icon':_0x26925e,'adminUrl':_0x355632,'agentUrl':_0xd7cde7,'scriptName':_0x3aae99,'scriptPath':_0x47af7c,'version':_0x2bec17};removeReferences(_0x4da671,null);return db[_0xbf97('0x33')]['create'](_0x38898e)[_0xbf97('0x2d')](function(_0x183b52){var _0x4b06cb={'role':_0x5a2c2c[_0xbf97('0x91')][_0xbf97('0x92')],'userProfileId':_0x5a2c2c[_0xbf97('0x91')][_0xbf97('0x93')]};if(!_0x4b06cb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4b06cb['role']==='user'){var _0x175cef=_0x183b52[_0xbf97('0x94')]({'plain':!![]});return db[_0xbf97('0x95')]['find']({'where':{'name':_0xbf97('0x96'),'userProfileId':_0x4b06cb[_0xbf97('0x93')]},'raw':!![]})[_0xbf97('0x2d')](function(_0x337cb3){if(_0x337cb3&&_0x337cb3[_0xbf97('0x97')]===0x0){return db[_0xbf97('0x98')][_0xbf97('0x99')]({'name':_0x175cef[_0xbf97('0x38')],'resourceId':_0x175cef['id'],'type':_0x337cb3['name'],'sectionId':_0x337cb3['id']},{})[_0xbf97('0x2d')](function(){return _0x183b52;});}else{return _0x183b52;}})[_0xbf97('0x50')](function(_0x2430aa){logger[_0xbf97('0x2e')](_0xbf97('0x9a'),_0x2430aa);throw _0x2430aa;});}return _0x183b52;})['then'](respondWithResult(_0x5184d4,null))[_0xbf97('0x50')](handleError(_0x5184d4,null));}});}catch(_0x37002b){_0x5184d4[_0xbf97('0x26')](0x1f4)['send'](_0x37002b);}};function removeReferences(_0x3259f5,_0x139cb3){try{if(_0x3259f5){fs[_0xbf97('0x67')](_0x3259f5);logger[_0xbf97('0x69')](_0xbf97('0x9b'));}if(_0x139cb3){rimraf(_0x139cb3,function(){});logger[_0xbf97('0x69')](_0xbf97('0x9c'));}}catch(_0x341a77){logger[_0xbf97('0x2e')](_0x341a77);}}exports['update']=function(_0x5444a5,_0x10e3db,_0x58f9fc){return db[_0xbf97('0x33')][_0xbf97('0x4f')]({'where':{'id':_0x5444a5[_0xbf97('0x4a')]['id']}})[_0xbf97('0x2d')](handleEntityNotFound(_0x10e3db,null))['then'](saveUpdates(_0x5444a5[_0xbf97('0x91')],null))[_0xbf97('0x2d')](respondWithResult(_0x10e3db,null))[_0xbf97('0x50')](handleError(_0x10e3db,null));};exports['delete']=function(_0x510ce4,_0x1866e4,_0x134870){return db[_0xbf97('0x33')][_0xbf97('0x4f')]({'where':{'id':_0x510ce4['params']['id']}})[_0xbf97('0x2d')](function(_0x238fce){if(_0x238fce){return _0x238fce[_0xbf97('0x2c')]();}})[_0xbf97('0x2d')](function(_0x3c6582){rimraf(path['join'](config['root'],'server/files/plugins',path[_0xbf97('0x62')](_0x3c6582['path'])),function(){});return _0x3c6582;})['then'](handleEntityNotFound(_0x1866e4,null))['then'](respondWithStatusCode(_0x1866e4,null))[_0xbf97('0x50')](handleError(_0x1866e4,null));};exports[_0xbf97('0x9d')]=function(_0x5e38aa,_0x43cefe,_0x338600){return BPromise[_0xbf97('0x9e')]()[_0xbf97('0x2d')](function(){if(!_0x5e38aa['query'][_0xbf97('0x7')]){throw new Error(_0xbf97('0x9f'));}if(!_0x5e38aa['query']['port']){throw new Error(_0xbf97('0xa0'));}var _0x25a8af=_0x5e38aa['query'][_0xbf97('0xa1')]?_0x5e38aa['query'][_0xbf97('0xa1')]+':'+_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa2')]:_0xbf97('0xa3')+_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa2')];var _0x322f9b=_0x5e38aa[_0xbf97('0x39')][_0xbf97('0x22')]?_0x5e38aa['query'][_0xbf97('0x22')]:!![];var _0x568be5=_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa4')]?_0x5e38aa[_0xbf97('0x39')][_0xbf97('0xa4')]:null;var _0x250591={'method':_0x5e38aa[_0xbf97('0xa5')],'uri':util[_0xbf97('0x53')]('%s%s',_0x25a8af,_0x5e38aa[_0xbf97('0x39')]['path']),'json':_0x322f9b,'resolveWithFullResponse':!![],'encoding':_0x568be5,'qs':_0x5e38aa[_0xbf97('0x39')]};if(_0x5e38aa[_0xbf97('0xa6')]){_0x250591[_0xbf97('0xa6')]=_0x5e38aa['headers'];if(_0x250591[_0xbf97('0xa6')][_0xbf97('0xa7')]){delete _0x250591[_0xbf97('0xa6')][_0xbf97('0xa7')];}}if(_0x250591[_0xbf97('0xa6')]['content-type']){delete _0x250591[_0xbf97('0xa6')][_0xbf97('0xa8')];}return rp(_0x250591);})[_0xbf97('0x2d')](function(_0x47d780){if(_0x47d780){_0x43cefe[_0xbf97('0x27')](_0x47d780[_0xbf97('0xa6')]);logger['info'](_0x47d780[_0xbf97('0x91')]);if(_[_0xbf97('0xa9')](_0x5e38aa[_0xbf97('0x39')]['path'],'download')&&_0x47d780[_0xbf97('0xaa')]==0x1f4){return _0x43cefe[_0xbf97('0x20')](_0x47d780[_0xbf97('0xaa')]);}else{return _0x43cefe[_0xbf97('0x26')](_0x47d780['statusCode'])[_0xbf97('0x30')](_0x47d780[_0xbf97('0x91')]);}}else{return _0x43cefe[_0xbf97('0x20')](0xc8);}})['catch'](handleError(_0x43cefe,null));};exports[_0xbf97('0xab')]=function(_0x2878da,_0x49ffe3,_0x47cf6b){return BPromise[_0xbf97('0x9e')]()['then'](function(){if(!_0x2878da[_0xbf97('0x39')]['path']){throw new Error(_0xbf97('0x9f'));}if(!_0x2878da['query'][_0xbf97('0xa2')]){throw new Error(_0xbf97('0xa0'));}var _0x133930=_0x2878da['query'][_0xbf97('0xa1')]?_0x2878da[_0xbf97('0x39')]['hostname']+':'+_0x2878da[_0xbf97('0x39')]['port']:'http://localhost:'+_0x2878da['query']['port'];var _0x284f34=_0x2878da[_0xbf97('0x39')][_0xbf97('0x22')]?_0x2878da[_0xbf97('0x39')][_0xbf97('0x22')]:!![];var _0x44a22f=_0x2878da[_0xbf97('0x39')][_0xbf97('0xa4')]?_0x2878da['query'][_0xbf97('0xa4')]:null;var _0x4a031c={'method':_0x2878da[_0xbf97('0xa5')],'uri':util['format'](_0xbf97('0xac'),_0x133930,_0x2878da['query'][_0xbf97('0x7')]),'json':_0x284f34,'resolveWithFullResponse':!![],'encoding':_0x44a22f,'body':_0x2878da['body']};if(_0x2878da[_0xbf97('0xa6')]){_0x4a031c[_0xbf97('0xa6')]=_0x2878da[_0xbf97('0xa6')];if(_0x4a031c['headers'][_0xbf97('0xa7')]){delete _0x4a031c['headers'][_0xbf97('0xa7')];}}if(_0x4a031c[_0xbf97('0xa6')][_0xbf97('0xa8')]){delete _0x4a031c[_0xbf97('0xa6')][_0xbf97('0xa8')];}return rp(_0x4a031c);})[_0xbf97('0x2d')](function(_0x194bd2){if(_0x194bd2){_0x49ffe3[_0xbf97('0x27')](_0x194bd2[_0xbf97('0xa6')]);logger[_0xbf97('0x69')](_0x194bd2['body']);return _0x49ffe3[_0xbf97('0x26')](_0x194bd2[_0xbf97('0xaa')])['send'](_0x194bd2[_0xbf97('0x91')]);}else{return _0x49ffe3[_0xbf97('0x20')](0xc8);}})[_0xbf97('0x50')](handleError(_0x49ffe3,null));}; \ No newline at end of file +var _0x099b=['filter','options','includeAll','findAll','catch','show','params','find','download','join','root','server/files/plugins','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','dirname','attachments/**/*','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','chmodSync','0777','readdirSync','error','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','parameters','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','script','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','webhookGet','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','format','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','port','%s%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','extract-zip','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','get','Plugins','UserProfileResource','stack','name','send','index','Plugin','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL'];(function(_0x26da89,_0x264785){var _0xc95b7b=function(_0x230e5b){while(--_0x230e5b){_0x26da89['push'](_0x26da89['shift']());}};_0xc95b7b(++_0x264785);}(_0x099b,0x116));var _0xb099=function(_0x1829d3,_0x24f67f){_0x1829d3=_0x1829d3-0x0;var _0x1b146e=_0x099b[_0x1829d3];return _0x1b146e;};'use strict';var emlformat=require(_0xb099('0x0'));var rimraf=require(_0xb099('0x1'));var zipdir=require(_0xb099('0x2'));var jsonpatch=require(_0xb099('0x3'));var rp=require(_0xb099('0x4'));var moment=require(_0xb099('0x5'));var BPromise=require(_0xb099('0x6'));var Mustache=require(_0xb099('0x7'));var util=require(_0xb099('0x8'));var path=require(_0xb099('0x9'));var sox=require('sox');var csv=require(_0xb099('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb099('0xb'));var _=require(_0xb099('0xc'));var squel=require(_0xb099('0xd'));var crypto=require(_0xb099('0xe'));var jsforce=require(_0xb099('0xf'));var deskjs=require(_0xb099('0x10'));var toCsv=require(_0xb099('0xa'));var querystring=require('querystring');var Papa=require(_0xb099('0x11'));var extract=require(_0xb099('0x12'));var rimraf=require(_0xb099('0x1'));var archiver=require(_0xb099('0x13'));var Redis=require('ioredis');var authService=require(_0xb099('0x14'));var qs=require(_0xb099('0x15'));var as=require(_0xb099('0x16'));var hardwareService=require(_0xb099('0x17'));var logger=require(_0xb099('0x18'))(_0xb099('0x19'));var utils=require(_0xb099('0x1a'));var config=require('../../config/environment');var licenseUtil=require(_0xb099('0x1b'));var db=require(_0xb099('0x1c'))['db'];config[_0xb099('0x1d')]=_[_0xb099('0x1e')](config[_0xb099('0x1d')],{'host':_0xb099('0x1f'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb099('0x1d')]));require(_0xb099('0x20'))[_0xb099('0x21')](socket);function respondWithStatusCode(_0x58a6d5,_0x17d53f){_0x17d53f=_0x17d53f||0xcc;return function(_0x432ce7){if(_0x432ce7){return _0x58a6d5[_0xb099('0x22')](_0x17d53f);}return _0x58a6d5[_0xb099('0x23')](_0x17d53f)[_0xb099('0x24')]();};}function respondWithResult(_0x9f0e13,_0x2a8a4d){_0x2a8a4d=_0x2a8a4d||0xc8;return function(_0x22d4f4){if(_0x22d4f4){return _0x9f0e13['status'](_0x2a8a4d)[_0xb099('0x25')](_0x22d4f4);}};}function respondWithFilteredResult(_0x1c41f5,_0x23f077){return function(_0x19fbb4){if(_0x19fbb4){var _0x245afc=typeof _0x23f077[_0xb099('0x26')]===_0xb099('0x27')&&typeof _0x23f077[_0xb099('0x28')]==='undefined';var _0x4821ae=_0x19fbb4[_0xb099('0x29')];var _0x52848b=_0x245afc?0x0:_0x23f077['offset'];var _0x4293eb=_0x245afc?_0x19fbb4[_0xb099('0x29')]:_0x23f077[_0xb099('0x26')]+_0x23f077[_0xb099('0x28')];var _0x321062;if(_0x4293eb>=_0x4821ae){_0x4293eb=_0x4821ae;_0x321062=0xc8;}else{_0x321062=0xce;}_0x1c41f5[_0xb099('0x23')](_0x321062);return _0x1c41f5[_0xb099('0x2a')](_0xb099('0x2b'),_0x52848b+'-'+_0x4293eb+'/'+_0x4821ae)['json'](_0x19fbb4);}return null;};}function patchUpdates(_0xfeabc6){return function(_0x50acac){try{jsonpatch[_0xb099('0x2c')](_0x50acac,_0xfeabc6,!![]);}catch(_0x5e2a27){return BPromise[_0xb099('0x2d')](_0x5e2a27);}return _0x50acac['save']();};}function saveUpdates(_0x5cfd66,_0x4b414c){return function(_0x10f7af){if(_0x10f7af){return _0x10f7af['update'](_0x5cfd66)[_0xb099('0x2e')](function(_0xab61c9){return _0xab61c9;});}return null;};}function removeEntity(_0x246dea,_0x389f94){return function(_0x2a39d4){if(_0x2a39d4){return _0x2a39d4[_0xb099('0x2f')]()['then'](function(){var _0x297ff1=_0x2a39d4[_0xb099('0x30')]({'plain':!![]});var _0x213309=_0xb099('0x31');return db[_0xb099('0x32')]['destroy']({'where':{'type':_0x213309,'resourceId':_0x297ff1['id']}})[_0xb099('0x2e')](function(){return _0x2a39d4;});})[_0xb099('0x2e')](function(){_0x246dea[_0xb099('0x23')](0xcc)[_0xb099('0x24')]();});}};}function handleEntityNotFound(_0x487de6,_0x233420){return function(_0x48913b){if(!_0x48913b){_0x487de6[_0xb099('0x22')](0x194);}return _0x48913b;};}function handleError(_0x3ccd42,_0x1ca4b9){_0x1ca4b9=_0x1ca4b9||0x1f4;return function(_0xeebb87){logger['error'](_0xeebb87[_0xb099('0x33')]);if(_0xeebb87[_0xb099('0x34')]){delete _0xeebb87['name'];}_0x3ccd42[_0xb099('0x23')](_0x1ca4b9)[_0xb099('0x35')](_0xeebb87);};}exports[_0xb099('0x36')]=function(_0x44950f,_0x5a78e6){var _0x2a1a05={},_0x4f1e47={},_0x3a9caf={'count':0x0,'rows':[]};var _0x32b3cc=_['map'](db[_0xb099('0x37')]['rawAttributes'],function(_0x3de397){return{'name':_0x3de397[_0xb099('0x38')],'type':_0x3de397[_0xb099('0x39')][_0xb099('0x3a')]};});_0x4f1e47[_0xb099('0x3b')]=_[_0xb099('0x3c')](_0x32b3cc,_0xb099('0x34'));_0x4f1e47['query']=_[_0xb099('0x3d')](_0x44950f[_0xb099('0x3e')]);_0x4f1e47[_0xb099('0x3f')]=_[_0xb099('0x40')](_0x4f1e47[_0xb099('0x3b')],_0x4f1e47[_0xb099('0x3e')]);_0x2a1a05['attributes']=_['intersection'](_0x4f1e47[_0xb099('0x3b')],qs[_0xb099('0x41')](_0x44950f[_0xb099('0x3e')][_0xb099('0x41')]));_0x2a1a05[_0xb099('0x42')]=_0x2a1a05[_0xb099('0x42')][_0xb099('0x43')]?_0x2a1a05[_0xb099('0x42')]:_0x4f1e47[_0xb099('0x3b')];if(!_0x44950f['query'][_0xb099('0x44')](_0xb099('0x45'))){_0x2a1a05['limit']=qs['limit'](_0x44950f[_0xb099('0x3e')]['limit']);_0x2a1a05[_0xb099('0x26')]=qs[_0xb099('0x26')](_0x44950f['query'][_0xb099('0x26')]);}_0x2a1a05[_0xb099('0x46')]=qs[_0xb099('0x47')](_0x44950f[_0xb099('0x3e')]['sort']);_0x2a1a05['where']=qs[_0xb099('0x3f')](_[_0xb099('0x48')](_0x44950f[_0xb099('0x3e')],_0x4f1e47[_0xb099('0x3f')]),_0x32b3cc);if(_0x44950f['query']['filter']){_0x2a1a05[_0xb099('0x49')]=_[_0xb099('0x4a')](_0x2a1a05[_0xb099('0x49')],{'$or':_['map'](_0x32b3cc,function(_0x85280f){if(_0x85280f['type']!==_0xb099('0x4b')){var _0x1f0e7a={};_0x1f0e7a[_0x85280f[_0xb099('0x34')]]={'$like':'%'+_0x44950f[_0xb099('0x3e')][_0xb099('0x4c')]+'%'};return _0x1f0e7a;}})});}_0x2a1a05=_[_0xb099('0x4a')]({},_0x2a1a05,_0x44950f[_0xb099('0x4d')]);var _0x22ec3d={'where':_0x2a1a05[_0xb099('0x49')]};return db[_0xb099('0x37')][_0xb099('0x29')](_0x22ec3d)['then'](function(_0x114681){_0x3a9caf[_0xb099('0x29')]=_0x114681;if(_0x44950f[_0xb099('0x3e')][_0xb099('0x4e')]){_0x2a1a05['include']=[{'all':!![]}];}return db[_0xb099('0x37')][_0xb099('0x4f')](_0x2a1a05);})[_0xb099('0x2e')](function(_0x421959){_0x3a9caf['rows']=_0x421959;return _0x3a9caf;})[_0xb099('0x2e')](respondWithFilteredResult(_0x5a78e6,_0x2a1a05))[_0xb099('0x50')](handleError(_0x5a78e6,null));};exports[_0xb099('0x51')]=function(_0x2ae61c,_0x33b50e){var _0x45e105={'raw':!![],'where':{'id':_0x2ae61c[_0xb099('0x52')]['id']}},_0x2e482e={};_0x2e482e[_0xb099('0x3b')]=_[_0xb099('0x3d')](db[_0xb099('0x37')]['rawAttributes']);_0x2e482e[_0xb099('0x3e')]=_[_0xb099('0x3d')](_0x2ae61c[_0xb099('0x3e')]);_0x2e482e['filters']=_[_0xb099('0x40')](_0x2e482e[_0xb099('0x3b')],_0x2e482e[_0xb099('0x3e')]);_0x45e105[_0xb099('0x42')]=_[_0xb099('0x40')](_0x2e482e['model'],qs[_0xb099('0x41')](_0x2ae61c[_0xb099('0x3e')][_0xb099('0x41')]));_0x45e105[_0xb099('0x42')]=_0x45e105[_0xb099('0x42')][_0xb099('0x43')]?_0x45e105['attributes']:_0x2e482e[_0xb099('0x3b')];if(_0x2ae61c[_0xb099('0x3e')][_0xb099('0x4e')]){_0x45e105['include']=[{'all':!![]}];}_0x45e105=_['merge']({},_0x45e105,_0x2ae61c[_0xb099('0x4d')]);return db[_0xb099('0x37')][_0xb099('0x53')](_0x45e105)[_0xb099('0x2e')](handleEntityNotFound(_0x33b50e,null))['then'](respondWithResult(_0x33b50e,null))['catch'](handleError(_0x33b50e,null));};exports[_0xb099('0x54')]=function(_0x229c7a,_0x240cc1,_0xf7568b){return db['Plugin']['find']({'where':{'id':_0x229c7a[_0xb099('0x52')]['id']},'attributes':[_0xb099('0x34'),_0xb099('0x9')],'raw':!![]})[_0xb099('0x2e')](handleEntityNotFound(_0x240cc1,null))[_0xb099('0x2e')](function(_0x562cc8){if(_0x562cc8){var _0x531697=path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),util['format'](_0xb099('0x58'),path[_0xb099('0x59')](_0x562cc8[_0xb099('0x9')])));var _0x37ad3f=fs[_0xb099('0x5a')](_0x531697);var _0x31d301=archiver(_0xb099('0x5b'),{'zlib':{'level':0x9}});_0x31d301['on'](_0xb099('0x5c'),function(_0x4553de){if(_0x4553de[_0xb099('0x5d')]===_0xb099('0x5e')){logger['error'](_0x4553de);}else{throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x31d301['on']('error',function(_0x1d3186){throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))](_0xb099('0x61'));});_0x31d301[_0xb099('0x62')](_0x37ad3f);_0x31d301['glob'](_0xb099('0x63'),{'cwd':path['join'](config[_0xb099('0x56')],'server/files/plugins',path[_0xb099('0x64')](_0x562cc8[_0xb099('0x9')])),'ignore':[path[_0xb099('0x55')](path[_0xb099('0x59')](_0x562cc8['path']),'node_modules/**/*'),path[_0xb099('0x55')](path[_0xb099('0x59')](_0x562cc8[_0xb099('0x9')]),_0xb099('0x65'))],'nodir':!![]})['finalize']();_0x37ad3f['on']('close',function(){if(!fs[_0xb099('0x66')](_0x531697)){throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))](_0xb099('0x67'));}return _0x240cc1[_0xb099('0x54')](_0x531697,util['format'](_0xb099('0x58'),path['basename'](_0x562cc8['path'])),function(_0x451071){if(_0x451071){throw new db[(_0xb099('0x5f'))][(_0xb099('0x60'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs[_0xb099('0x68')](_0x531697);logger[_0xb099('0x69')](_0xb099('0x6a'));logger['info'](_0xb099('0x6b'));});});}return null;})['catch'](handleError(_0x240cc1,null));};exports[_0xb099('0x6c')]=function(_0x3d6f4c,_0x58165a,_0x1f5abf){var _0x5007e0=path[_0xb099('0x59')](_0x3d6f4c[_0xb099('0x6d')][_0xb099('0x6e')],path[_0xb099('0x6f')](_0x3d6f4c[_0xb099('0x6d')][_0xb099('0x6e')]));var _0x10fa63=path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),_0x3d6f4c[_0xb099('0x6d')][_0xb099('0x6e')]);var _0x1b3b0b=path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),_0x5007e0);logger[_0xb099('0x69')](_0xb099('0x70'),_0x10fa63);logger[_0xb099('0x69')](_0xb099('0x71'),_0x1b3b0b);try{fs[_0xb099('0x72')](_0x10fa63,parseInt(_0xb099('0x73'),0x8));extract(_0x10fa63,{'dir':_0x1b3b0b},function(_0x2cecd2){if(_0x2cecd2){logger['error'](_0x2cecd2);handleError(_0x2cecd2,!![]);};var _0x47aff8=fs[_0xb099('0x74')](_0x1b3b0b);if(_0x47aff8[_0xb099('0x43')]>0x1){removeReferences(_0x10fa63,_0x1b3b0b);logger[_0xb099('0x75')](_0xb099('0x76'));return _0x1f5abf(new Error(_0xb099('0x76')));}var _0x13af27=fs['lstatSync'](path[_0xb099('0x55')](_0x1b3b0b,_0x47aff8[0x0]));if(_0x13af27[_0xb099('0x77')]()){removeReferences(_0x10fa63,_0x1b3b0b);logger[_0xb099('0x75')](_0xb099('0x76'));return _0x1f5abf(new Error('Invalid\x20plugin\x20structure'));}if(_0x13af27[_0xb099('0x78')]()){var _0x1f0367=fs[_0xb099('0x74')](path[_0xb099('0x55')](_0x1b3b0b,_0x47aff8[0x0]));if(_0x1f0367[_0xb099('0x43')]===0x0){removeReferences(_0x10fa63,_0x1b3b0b);logger['error'](_0xb099('0x76'));return _0x1f5abf(new Error(_0xb099('0x76')));}var _0x522689=_0x1f0367[_0xb099('0x79')](function(_0x3e1c7b){return _0x3e1c7b===_0xb099('0x7a');});if(!_0x522689){return _0x1f5abf(new Error(_0xb099('0x7b')));}var _0x456302=fs[_0xb099('0x7c')](path[_0xb099('0x55')](_0x1b3b0b,_0x47aff8[0x0],'manifest.json'));var _0x56c11f=JSON[_0xb099('0x7d')](_0x456302);if(_0xb099('0x27')==typeof _0x56c11f[_0xb099('0x34')]){return _0x1f5abf(new Error(_0xb099('0x7e')));}if('undefined'==typeof _0x56c11f[_0xb099('0x39')]){return _0x1f5abf(new Error(_0xb099('0x7f')));}if('undefined'==typeof _0x56c11f[_0xb099('0x80')]){return _0x1f5abf(new Error(_0xb099('0x81')));}if(_0xb099('0x27')==typeof _0x56c11f['parameters']){return _0x1f5abf(new Error(_0xb099('0x82')));}if(_0x56c11f[_0xb099('0x39')]===_0xb099('0x83')){if(_0xb099('0x27')==typeof _0x56c11f['parameters'][_0xb099('0x84')]){return _0x1f5abf(new Error(_0xb099('0x85')));}if('undefined'==typeof _0x56c11f[_0xb099('0x86')]['views'][_0xb099('0x87')]&&_0xb099('0x27')==typeof _0x56c11f[_0xb099('0x86')][_0xb099('0x84')][_0xb099('0x88')]){return _0x1f5abf(new Error(_0xb099('0x89')));}}else if(_0x56c11f[_0xb099('0x39')]===_0xb099('0x8a')){if(_0xb099('0x27')==typeof _0x56c11f['parameters'][_0xb099('0x8b')]){return _0x1f5abf(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if('undefined'==typeof _0x56c11f['parameters'][_0xb099('0x8c')]){return _0x1f5abf(new Error(_0xb099('0x8d')));}}else{return _0x1f5abf(new Error(_0xb099('0x8e')));}var _0x4fc3a4=_0x56c11f[_0xb099('0x34')];var _0x1e0919=_0x56c11f[_0xb099('0x8f')];var _0x1fe9e4=_0x56c11f[_0xb099('0x39')];var _0x1bf749=_0x56c11f[_0xb099('0x90')]?_0x56c11f[_0xb099('0x90')]:'always';var _0x316172=_0x56c11f[_0xb099('0x91')]?_0x56c11f[_0xb099('0x91')]:_0xb099('0x92');var _0x29d8a0='';var _0x1e2a1c='';var _0x53542d='';var _0x3a272a='';var _0x452a0f=_0x56c11f[_0xb099('0x80')];if(_0x1fe9e4===_0xb099('0x83')){if(_0xb099('0x27')!=typeof _0x56c11f['parameters'][_0xb099('0x84')][_0xb099('0x87')]){var _0x177794=_0x56c11f[_0xb099('0x86')]['views'][_0xb099('0x87')];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x177794)){_0x29d8a0=path['join'](_0xb099('0x94'),_0x5007e0,_0x47aff8[0x0],_0x177794);}else{_0x29d8a0=_0x177794;}}else{logger[_0xb099('0x69')](_0xb099('0x95'));}if('undefined'!=typeof _0x56c11f[_0xb099('0x86')]['views'][_0xb099('0x88')]){var _0x36e5fb=_0x56c11f[_0xb099('0x86')][_0xb099('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x36e5fb)){_0x1e2a1c=path[_0xb099('0x55')](_0xb099('0x94'),_0x5007e0,_0x47aff8[0x0],_0x36e5fb);}else{_0x1e2a1c=_0x36e5fb;}}else{logger[_0xb099('0x69')](_0xb099('0x96'));}}else if(_0x1fe9e4===_0xb099('0x8a')){_0x53542d=_0x56c11f['parameters'][_0xb099('0x8b')];_0x3a272a=_0x56c11f['parameters'][_0xb099('0x8c')];if(_0xb099('0x27')!=typeof _0x56c11f[_0xb099('0x86')][_0xb099('0x84')]){if(_0xb099('0x27')!=typeof _0x56c11f['parameters'][_0xb099('0x84')][_0xb099('0x87')]){var _0x177794=_0x56c11f['parameters']['views']['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x177794)){_0x29d8a0=path[_0xb099('0x55')]('plugins',_0x5007e0,_0x47aff8[0x0],_0x177794);}else{_0x29d8a0=_0x177794;}}if(_0xb099('0x27')!=typeof _0x56c11f[_0xb099('0x86')][_0xb099('0x84')][_0xb099('0x88')]){var _0x36e5fb=_0x56c11f[_0xb099('0x86')][_0xb099('0x84')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0xb099('0x93')](_0x36e5fb)){_0x1e2a1c=path['join']('plugins',_0x5007e0,_0x47aff8[0x0],_0x36e5fb);}else{_0x1e2a1c=_0x36e5fb;}}}}var _0x82e920={'name':_0x4fc3a4,'description':_0x1e0919,'path':path['join'](_0x5007e0,_0x47aff8[0x0]),'type':_0x1fe9e4,'sidebar':_0x1bf749,'icon':_0x316172,'adminUrl':_0x29d8a0,'agentUrl':_0x1e2a1c,'scriptName':_0x53542d,'scriptPath':_0x3a272a,'version':_0x452a0f};removeReferences(_0x10fa63,null);return db[_0xb099('0x37')]['create'](_0x82e920)[_0xb099('0x2e')](function(_0x5bb8f0){var _0x424b30={'role':_0x3d6f4c[_0xb099('0x97')]['role'],'userProfileId':_0x3d6f4c[_0xb099('0x97')][_0xb099('0x98')]};if(!_0x424b30)throw new Error(_0xb099('0x99'));if(_0x424b30['role']===_0xb099('0x9a')){var _0xcf787b=_0x5bb8f0[_0xb099('0x30')]({'plain':!![]});return db['UserProfileSection'][_0xb099('0x53')]({'where':{'name':'Plugins','userProfileId':_0x424b30[_0xb099('0x98')]},'raw':!![]})[_0xb099('0x2e')](function(_0x584548){if(_0x584548&&_0x584548['autoAssociation']===0x0){return db['UserProfileResource'][_0xb099('0x9b')]({'name':_0xcf787b[_0xb099('0x34')],'resourceId':_0xcf787b['id'],'type':_0x584548['name'],'sectionId':_0x584548['id']},{})[_0xb099('0x2e')](function(){return _0x5bb8f0;});}else{return _0x5bb8f0;}})[_0xb099('0x50')](function(_0x30df1d){logger[_0xb099('0x75')](_0xb099('0x9c'),_0x30df1d);throw _0x30df1d;});}return _0x5bb8f0;})[_0xb099('0x2e')](respondWithResult(_0x58165a,null))[_0xb099('0x50')](handleError(_0x58165a,null));}});}catch(_0x3a20b3){_0x58165a['status'](0x1f4)[_0xb099('0x35')](_0x3a20b3);}};function removeReferences(_0x30c6fe,_0x47f70e){try{if(_0x30c6fe){fs[_0xb099('0x68')](_0x30c6fe);logger[_0xb099('0x69')](_0xb099('0x9d'));}if(_0x47f70e){rimraf(_0x47f70e,function(){});logger[_0xb099('0x69')](_0xb099('0x9e'));}}catch(_0x23d11e){logger[_0xb099('0x75')](_0x23d11e);}}exports[_0xb099('0x9f')]=function(_0x25bb0f,_0x2ead90,_0x51514c){return db['Plugin'][_0xb099('0x53')]({'where':{'id':_0x25bb0f[_0xb099('0x52')]['id']}})[_0xb099('0x2e')](handleEntityNotFound(_0x2ead90,null))[_0xb099('0x2e')](saveUpdates(_0x25bb0f[_0xb099('0x97')],null))['then'](respondWithResult(_0x2ead90,null))[_0xb099('0x50')](handleError(_0x2ead90,null));};exports['delete']=function(_0x2c9ff5,_0x14068a,_0x126771){return db[_0xb099('0x37')][_0xb099('0x53')]({'where':{'id':_0x2c9ff5[_0xb099('0x52')]['id']}})[_0xb099('0x2e')](function(_0x17cffa){if(_0x17cffa){return _0x17cffa[_0xb099('0x2f')]();}})['then'](function(_0x174eff){rimraf(path[_0xb099('0x55')](config[_0xb099('0x56')],_0xb099('0x57'),path[_0xb099('0x64')](_0x174eff['path'])),function(){});return _0x174eff;})[_0xb099('0x2e')](handleEntityNotFound(_0x14068a,null))[_0xb099('0x2e')](respondWithStatusCode(_0x14068a,null))['catch'](handleError(_0x14068a,null));};exports[_0xb099('0xa0')]=function(_0xe502dd,_0x59b11e,_0x471791){return BPromise['resolve']()[_0xb099('0x2e')](function(){if(!_0xe502dd[_0xb099('0x3e')][_0xb099('0x9')]){throw new Error(_0xb099('0xa1'));}if(!_0xe502dd[_0xb099('0x3e')]['port']){throw new Error(_0xb099('0xa2'));}var _0x4ddbb4=_0xe502dd[_0xb099('0x3e')][_0xb099('0xa3')]?_0xe502dd[_0xb099('0x3e')][_0xb099('0xa3')]+':'+_0xe502dd[_0xb099('0x3e')]['port']:_0xb099('0xa4')+_0xe502dd[_0xb099('0x3e')]['port'];var _0x502c4f=_0xe502dd[_0xb099('0x3e')][_0xb099('0x25')]?_0xe502dd[_0xb099('0x3e')][_0xb099('0x25')]:!![];var _0x13a3f9=_0xe502dd[_0xb099('0x3e')][_0xb099('0xa5')]?_0xe502dd[_0xb099('0x3e')][_0xb099('0xa5')]:null;var _0x3b83de={'method':_0xe502dd[_0xb099('0xa6')],'uri':util[_0xb099('0xa7')]('%s%s',_0x4ddbb4,_0xe502dd[_0xb099('0x3e')]['path']),'json':_0x502c4f,'resolveWithFullResponse':!![],'encoding':_0x13a3f9,'qs':_0xe502dd['query']};if(_0xe502dd[_0xb099('0xa8')]){_0x3b83de[_0xb099('0xa8')]=_0xe502dd[_0xb099('0xa8')];if(_0x3b83de[_0xb099('0xa8')][_0xb099('0xa9')]){delete _0x3b83de[_0xb099('0xa8')][_0xb099('0xa9')];}}if(_0x3b83de['headers']['content-type']){delete _0x3b83de[_0xb099('0xa8')][_0xb099('0xaa')];}return rp(_0x3b83de);})[_0xb099('0x2e')](function(_0x1243b5){if(_0x1243b5){_0x59b11e[_0xb099('0x2a')](_0x1243b5[_0xb099('0xa8')]);logger[_0xb099('0x69')](_0x1243b5[_0xb099('0x97')]);if(_[_0xb099('0xab')](_0xe502dd[_0xb099('0x3e')][_0xb099('0x9')],_0xb099('0x54'))&&_0x1243b5[_0xb099('0xac')]==0x1f4){return _0x59b11e['sendStatus'](_0x1243b5[_0xb099('0xac')]);}else{return _0x59b11e[_0xb099('0x23')](_0x1243b5[_0xb099('0xac')])['send'](_0x1243b5[_0xb099('0x97')]);}}else{return _0x59b11e['sendStatus'](0xc8);}})['catch'](handleError(_0x59b11e,null));};exports[_0xb099('0xad')]=function(_0x12aacd,_0xeea725,_0x503de1){return BPromise[_0xb099('0xae')]()[_0xb099('0x2e')](function(){if(!_0x12aacd['query'][_0xb099('0x9')]){throw new Error(_0xb099('0xa1'));}if(!_0x12aacd[_0xb099('0x3e')][_0xb099('0xaf')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x42507d=_0x12aacd[_0xb099('0x3e')][_0xb099('0xa3')]?_0x12aacd[_0xb099('0x3e')][_0xb099('0xa3')]+':'+_0x12aacd[_0xb099('0x3e')][_0xb099('0xaf')]:_0xb099('0xa4')+_0x12aacd[_0xb099('0x3e')][_0xb099('0xaf')];var _0x51c540=_0x12aacd[_0xb099('0x3e')][_0xb099('0x25')]?_0x12aacd[_0xb099('0x3e')][_0xb099('0x25')]:!![];var _0x322a82=_0x12aacd[_0xb099('0x3e')][_0xb099('0xa5')]?_0x12aacd[_0xb099('0x3e')][_0xb099('0xa5')]:null;var _0x21ad15={'method':_0x12aacd[_0xb099('0xa6')],'uri':util['format'](_0xb099('0xb0'),_0x42507d,_0x12aacd['query'][_0xb099('0x9')]),'json':_0x51c540,'resolveWithFullResponse':!![],'encoding':_0x322a82,'body':_0x12aacd['body']};if(_0x12aacd[_0xb099('0xa8')]){_0x21ad15[_0xb099('0xa8')]=_0x12aacd[_0xb099('0xa8')];if(_0x21ad15[_0xb099('0xa8')][_0xb099('0xa9')]){delete _0x21ad15[_0xb099('0xa8')][_0xb099('0xa9')];}}if(_0x21ad15['headers'][_0xb099('0xaa')]){delete _0x21ad15['headers'][_0xb099('0xaa')];}return rp(_0x21ad15);})[_0xb099('0x2e')](function(_0x550465){if(_0x550465){_0xeea725[_0xb099('0x2a')](_0x550465[_0xb099('0xa8')]);logger[_0xb099('0x69')](_0x550465[_0xb099('0x97')]);return _0xeea725[_0xb099('0x23')](_0x550465[_0xb099('0xac')])[_0xb099('0x35')](_0x550465['body']);}else{return _0xeea725[_0xb099('0x22')](0xc8);}})[_0xb099('0x50')](handleError(_0xeea725,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 4e25843..b81aed0 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 _0xaee6=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x211087,_0x354fdd){var _0x2a581f=function(_0x2928fe){while(--_0x2928fe){_0x211087['push'](_0x211087['shift']());}};_0x2a581f(++_0x354fdd);}(_0xaee6,0x187));var _0x6aee=function(_0x682e55,_0xf2bb47){_0x682e55=_0x682e55-0x0;var _0x2ee3b0=_0xaee6[_0x682e55];return _0x2ee3b0;};'use strict';var EventEmitter=require(_0x6aee('0x0'));var Plugin=require(_0x6aee('0x1'))['db'][_0x6aee('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x6aee('0x3')](0x0);var events={'afterCreate':_0x6aee('0x4'),'afterUpdate':_0x6aee('0x5'),'afterDestroy':'remove'};function emitEvent(_0x46980d){return function(_0x3f11af,_0x1e23ba,_0x5e83b4){PluginEvents[_0x6aee('0x6')](_0x46980d+':'+_0x3f11af['id'],_0x3f11af);PluginEvents[_0x6aee('0x6')](_0x46980d,_0x3f11af);_0x5e83b4(null);};}for(var e in events){if(events[_0x6aee('0x7')](e)){var event=events[e];Plugin[_0x6aee('0x8')](e,emitEvent(event));}}module[_0x6aee('0x9')]=PluginEvents; \ No newline at end of file +var _0x5785=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x53fe97,_0x544271){var _0x5c49a2=function(_0x3fa2b4){while(--_0x3fa2b4){_0x53fe97['push'](_0x53fe97['shift']());}};_0x5c49a2(++_0x544271);}(_0x5785,0x119));var _0x5578=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x5785[_0x9cd4c3];return _0x4c9025;};'use strict';var EventEmitter=require(_0x5578('0x0'));var Plugin=require(_0x5578('0x1'))['db'][_0x5578('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x5578('0x3')](0x0);var events={'afterCreate':_0x5578('0x4'),'afterUpdate':'update','afterDestroy':_0x5578('0x5')};function emitEvent(_0x2a3b8a){return function(_0x1af5f6,_0x8c7841,_0x3112c5){PluginEvents[_0x5578('0x6')](_0x2a3b8a+':'+_0x1af5f6['id'],_0x1af5f6);PluginEvents[_0x5578('0x6')](_0x2a3b8a,_0x1af5f6);_0x3112c5(null);};}for(var e in events){if(events[_0x5578('0x7')](e)){var event=events[e];Plugin[_0x5578('0x8')](e,emitEvent(event));}}module[_0x5578('0x9')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 37c44cf..a067a5f 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 _0x942a=['bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','api','moment'];(function(_0x268a71,_0x320096){var _0xd456b3=function(_0x200e01){while(--_0x200e01){_0x268a71['push'](_0x268a71['shift']());}};_0xd456b3(++_0x320096);}(_0x942a,0x175));var _0xa942=function(_0x44ae0b,_0x3e9865){_0x44ae0b=_0x44ae0b-0x0;var _0x69232a=_0x942a[_0x44ae0b];return _0x69232a;};'use strict';var _=require(_0xa942('0x0'));var util=require('util');var logger=require(_0xa942('0x1'))(_0xa942('0x2'));var moment=require(_0xa942('0x3'));var BPromise=require(_0xa942('0x4'));var rp=require(_0xa942('0x5'));var fs=require('fs');var path=require(_0xa942('0x6'));var rimraf=require(_0xa942('0x7'));var config=require(_0xa942('0x8'));var attributes=require(_0xa942('0x9'));module['exports']=function(_0xf71030,_0x1ee3c3){return _0xf71030[_0xa942('0xa')](_0xa942('0xb'),attributes,{'tableName':_0xa942('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x07bd=['define','Plugin','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports'];(function(_0x52c6eb,_0x186bc9){var _0x16559d=function(_0x3f4c1b){while(--_0x3f4c1b){_0x52c6eb['push'](_0x52c6eb['shift']());}};_0x16559d(++_0x186bc9);}(_0x07bd,0x13a));var _0xd07b=function(_0x2c75e8,_0x2f2e7e){_0x2c75e8=_0x2c75e8-0x0;var _0x5e6112=_0x07bd[_0x2c75e8];return _0x5e6112;};'use strict';var _=require(_0xd07b('0x0'));var util=require(_0xd07b('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xd07b('0x2'));var BPromise=require(_0xd07b('0x3'));var rp=require(_0xd07b('0x4'));var fs=require('fs');var path=require(_0xd07b('0x5'));var rimraf=require(_0xd07b('0x6'));var config=require(_0xd07b('0x7'));var attributes=require(_0xd07b('0x8'));module[_0xd07b('0x9')]=function(_0x439e2c,_0x328944){return _0x439e2c[_0xd07b('0xa')](_0xd07b('0xb'),attributes,{'tableName':'plugins','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 fecb199..fcf4fac 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 _0x4c73=['info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Plugin','create','body','options','raw','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','register','request','then'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x4c73,0x14c));var _0x34c7=function(_0x167f48,_0x343696){_0x167f48=_0x167f48-0x0;var _0x5b36fb=_0x4c73[_0x167f48];return _0x5b36fb;};'use strict';var _=require(_0x34c7('0x0'));var util=require(_0x34c7('0x1'));var moment=require(_0x34c7('0x2'));var BPromise=require(_0x34c7('0x3'));var rs=require(_0x34c7('0x4'));var fs=require('fs');var Redis=require(_0x34c7('0x5'));var db=require(_0x34c7('0x6'))['db'];var utils=require(_0x34c7('0x7'));var logger=require('../../config/logger')(_0x34c7('0x8'));var config=require(_0x34c7('0x9'));var jayson=require(_0x34c7('0xa'));var client=jayson[_0x34c7('0xb')][_0x34c7('0xc')]({'port':0x232a});config[_0x34c7('0xd')]=_['defaults'](config[_0x34c7('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x34c7('0xe'))(new Redis(config[_0x34c7('0xd')]));require('./plugin.socket')[_0x34c7('0xf')](socket);function respondWithRpcPromise(_0x56a95b,_0x3d0adc,_0x11ed76){return new BPromise(function(_0x3e3d3c,_0x45f3db){return client[_0x34c7('0x10')](_0x56a95b,_0x11ed76)[_0x34c7('0x11')](function(_0x31e24f){logger[_0x34c7('0x12')](_0x34c7('0x13'),_0x3d0adc,_0x34c7('0x14'));logger[_0x34c7('0x15')](_0x34c7('0x16'),_0x3d0adc,_0x34c7('0x14'),JSON[_0x34c7('0x17')](_0x31e24f));if(_0x31e24f[_0x34c7('0x18')]){if(_0x31e24f[_0x34c7('0x18')][_0x34c7('0x19')]===0x1f4){logger[_0x34c7('0x18')]('Plugin,\x20%s,\x20%s',_0x3d0adc,_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);return _0x45f3db(_0x31e24f['error'][_0x34c7('0x1a')]);}logger[_0x34c7('0x18')](_0x34c7('0x13'),_0x3d0adc,_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);return _0x3e3d3c(_0x31e24f[_0x34c7('0x18')][_0x34c7('0x1a')]);}else{logger[_0x34c7('0x12')](_0x34c7('0x13'),_0x3d0adc,_0x34c7('0x14'));_0x3e3d3c(_0x31e24f[_0x34c7('0x1b')][_0x34c7('0x1a')]);}})[_0x34c7('0x1c')](function(_0x484405){logger[_0x34c7('0x18')]('Plugin,\x20%s,\x20%s',_0x3d0adc,_0x484405);_0x45f3db(_0x484405);});});}exports['CreatePlugin']=function(_0x548e71){var _0x3e6af1=this;return new Promise(function(_0x5ae135,_0x3bee56){return db[_0x34c7('0x1d')][_0x34c7('0x1e')](_0x548e71[_0x34c7('0x1f')],{'raw':_0x548e71[_0x34c7('0x20')]?_0x548e71[_0x34c7('0x20')][_0x34c7('0x21')]===undefined?!![]:![]:!![]})['then'](function(_0x1e576b){logger[_0x34c7('0x12')](_0x34c7('0x22'),_0x548e71);logger['debug'](_0x34c7('0x22'),_0x548e71,JSON[_0x34c7('0x17')](_0x1e576b));_0x5ae135(_0x1e576b);})[_0x34c7('0x1c')](function(_0x111844){logger[_0x34c7('0x18')](_0x34c7('0x22'),_0x111844[_0x34c7('0x1a')],_0x548e71);_0x3bee56(_0x3e6af1[_0x34c7('0x18')](0x1f4,_0x111844[_0x34c7('0x1a')]));});});}; \ No newline at end of file +var _0x304d=['catch','body','options','raw','debug','CreatePlugin','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./plugin.socket','request','then','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result'];(function(_0x4fbb15,_0x21be0c){var _0x436338=function(_0x3b5a05){while(--_0x3b5a05){_0x4fbb15['push'](_0x4fbb15['shift']());}};_0x436338(++_0x21be0c);}(_0x304d,0xd2));var _0xd304=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x304d[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xd304('0x0'));var util=require(_0xd304('0x1'));var moment=require(_0xd304('0x2'));var BPromise=require(_0xd304('0x3'));var rs=require(_0xd304('0x4'));var fs=require('fs');var Redis=require(_0xd304('0x5'));var db=require(_0xd304('0x6'))['db'];var utils=require(_0xd304('0x7'));var logger=require(_0xd304('0x8'))(_0xd304('0x9'));var config=require('../../config/environment');var jayson=require(_0xd304('0xa'));var client=jayson[_0xd304('0xb')][_0xd304('0xc')]({'port':0x232a});config[_0xd304('0xd')]=_[_0xd304('0xe')](config[_0xd304('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xd304('0xf'))(new Redis(config[_0xd304('0xd')]));require(_0xd304('0x10'))['register'](socket);function respondWithRpcPromise(_0x3ee45a,_0x138c80,_0x51cf18){return new BPromise(function(_0x49d25c,_0x21cef3){return client[_0xd304('0x11')](_0x3ee45a,_0x51cf18)[_0xd304('0x12')](function(_0x2ab6f5){logger['info'](_0xd304('0x13'),_0x138c80,_0xd304('0x14'));logger['debug'](_0xd304('0x15'),_0x138c80,_0xd304('0x14'),JSON[_0xd304('0x16')](_0x2ab6f5));if(_0x2ab6f5[_0xd304('0x17')]){if(_0x2ab6f5['error'][_0xd304('0x18')]===0x1f4){logger[_0xd304('0x17')](_0xd304('0x13'),_0x138c80,_0x2ab6f5['error'][_0xd304('0x19')]);return _0x21cef3(_0x2ab6f5[_0xd304('0x17')][_0xd304('0x19')]);}logger[_0xd304('0x17')]('Plugin,\x20%s,\x20%s',_0x138c80,_0x2ab6f5[_0xd304('0x17')][_0xd304('0x19')]);return _0x49d25c(_0x2ab6f5[_0xd304('0x17')]['message']);}else{logger[_0xd304('0x1a')]('Plugin,\x20%s,\x20%s',_0x138c80,_0xd304('0x14'));_0x49d25c(_0x2ab6f5[_0xd304('0x1b')][_0xd304('0x19')]);}})[_0xd304('0x1c')](function(_0x3f91d1){logger[_0xd304('0x17')](_0xd304('0x13'),_0x138c80,_0x3f91d1);_0x21cef3(_0x3f91d1);});});}exports['CreatePlugin']=function(_0x2911ff){var _0x2641c2=this;return new Promise(function(_0x3c2660,_0x49ea93){return db['Plugin']['create'](_0x2911ff[_0xd304('0x1d')],{'raw':_0x2911ff[_0xd304('0x1e')]?_0x2911ff[_0xd304('0x1e')][_0xd304('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x417ae3){logger['info']('CreatePlugin',_0x2911ff);logger[_0xd304('0x20')](_0xd304('0x21'),_0x2911ff,JSON[_0xd304('0x16')](_0x417ae3));_0x3c2660(_0x417ae3);})[_0xd304('0x1c')](function(_0xf91ce0){logger[_0xd304('0x17')](_0xd304('0x21'),_0xf91ce0['message'],_0x2911ff);_0x49ea93(_0x2641c2[_0xd304('0x17')](0x1f4,_0xf91ce0[_0xd304('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index fea9f68..927cdc3 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 _0x6474=['update','emit','length','plugin:','save','remove'];(function(_0x30fec7,_0x43f441){var _0x462f4a=function(_0x465871){while(--_0x465871){_0x30fec7['push'](_0x30fec7['shift']());}};_0x462f4a(++_0x43f441);}(_0x6474,0x1b4));var _0x4647=function(_0x1bd020,_0x33223a){_0x1bd020=_0x1bd020-0x0;var _0x39ccc9=_0x6474[_0x1bd020];return _0x39ccc9;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x4647('0x0'),_0x4647('0x1'),_0x4647('0x2')];function createListener(_0x58ace7,_0x4fd9ef){return function(_0x267890){_0x4fd9ef[_0x4647('0x3')](_0x58ace7,_0x267890);};}function removeListener(_0x11678c,_0x3daab6){return function(){PluginEvents['removeListener'](_0x11678c,_0x3daab6);};}exports['register']=function(_0x390e5c){for(var _0x341233=0x0,_0x42a459=events[_0x4647('0x4')];_0x341233<_0x42a459;_0x341233++){var _0x1e2609=events[_0x341233];var _0x5abaf5=createListener(_0x4647('0x5')+_0x1e2609,_0x390e5c);PluginEvents['on'](_0x1e2609,_0x5abaf5);}}; \ No newline at end of file +var _0xe39c=['register','length','plugin:','./plugin.events','save','update','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xe39c,0x143));var _0xce39=function(_0x1d647d,_0x197452){_0x1d647d=_0x1d647d-0x0;var _0x4454d4=_0xe39c[_0x1d647d];return _0x4454d4;};'use strict';var PluginEvents=require(_0xce39('0x0'));var events=[_0xce39('0x1'),'remove',_0xce39('0x2')];function createListener(_0x3c9fd2,_0x16e83b){return function(_0x1161e8){_0x16e83b[_0xce39('0x3')](_0x3c9fd2,_0x1161e8);};}function removeListener(_0x4851cb,_0x2e9358){return function(){PluginEvents[_0xce39('0x4')](_0x4851cb,_0x2e9358);};}exports[_0xce39('0x5')]=function(_0x201fba){for(var _0x119794=0x0,_0x15c1ef=events[_0xce39('0x6')];_0x119794<_0x15c1ef;_0x119794++){var _0x4d59f6=events[_0x119794];var _0x2f818c=createListener(_0xce39('0x7')+_0x4d59f6,_0x201fba);PluginEvents['on'](_0x4d59f6,_0x2f818c);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index faf3bfe..c74c24f 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(_0x665daa,_0x2913ac){var _0x38c00e=function(_0x471cc0){while(--_0x471cc0){_0x665daa['push'](_0x665daa['shift']());}};_0x38c00e(++_0x2913ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x4a68dd,_0x110bc5){var _0x266bf9=function(_0x369ce5){while(--_0x369ce5){_0x4a68dd['push'](_0x4a68dd['shift']());}};_0x266bf9(++_0x110bc5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'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 d38ebdd..cedac95 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 _0xe13a=['exec','bluebird','sendStatus','json','error','stack','name','status','npm\x20install','info','index','reject','express','length','catch','show','describe','params','then','body','script','join','../../files/plugins','chdir','dirname','start','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','send','destroy','delete','Unknown\x20id','../../config/pm2','../../config/logger','api','path'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0xe13a,0x178));var _0xae13=function(_0x23a389,_0x51a803){_0x23a389=_0x23a389-0x0;var _0x4d1035=_0xe13a[_0x23a389];return _0x4d1035;};'use strict';var _=require('lodash');var pm2=require(_0xae13('0x0'));var logger=require(_0xae13('0x1'))(_0xae13('0x2'));var path=require(_0xae13('0x3'));var exec=require('child_process')[_0xae13('0x4')];var BPromise=require(_0xae13('0x5'));function handleEntityNotFound(_0x3ebbfe,_0x10abd7){return function(_0x28a89a){if(!_0x28a89a){_0x3ebbfe[_0xae13('0x6')](0x194);;}return _0x28a89a;};}function respondWithResult(_0x412a07,_0x3379ed){_0x3379ed=_0x3379ed||0xc8;return function(_0x341ba4){if(_0x341ba4){return _0x412a07['status'](_0x3379ed)[_0xae13('0x7')](_0x341ba4);}return null;};}function handleError(_0x2b2e1f,_0x27fefd){_0x27fefd=_0x27fefd||0x1f4;return function(_0x2a793f){logger[_0xae13('0x8')](_0x2a793f[_0xae13('0x9')]);if(_0x2a793f[_0xae13('0xa')]){delete _0x2a793f[_0xae13('0xa')];}_0x2b2e1f[_0xae13('0xb')](_0x27fefd)['send'](_0x2a793f);};}function execChildProcess(){return new BPromise(function(_0x404b0e,_0x83de98){exec(_0xae13('0xc'),function(_0x3a6d41,_0x14df2d,_0x3006f0){logger[_0xae13('0xd')](_0x14df2d);logger['info'](_0x3006f0);if(_0x3a6d41){logger[_0xae13('0x8')](_0x3a6d41);return _0x83de98(_0x3a6d41);}return _0x404b0e(_0x14df2d);});});}exports[_0xae13('0xe')]=function(_0x5c61bb,_0x589803){return pm2['list']()['then'](function(_0x52484b){if(_0x52484b){var _0x26ff3e=_[_0xae13('0xf')](_0x52484b,function(_0x44e141){return _0x44e141[_0xae13('0xa')]===_0xae13('0x10')||_0x44e141[_0xae13('0xa')]==='motion2';});return{'rows':_0x26ff3e,'count':_0x26ff3e[_0xae13('0x11')]};}return null;})['then'](respondWithResult(_0x589803,null))[_0xae13('0x12')](handleError(_0x589803,null));};exports[_0xae13('0x13')]=function(_0x207363,_0x118e52){return pm2[_0xae13('0x14')](_0x207363[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x118e52,null))[_0xae13('0x16')](handleEntityNotFound(_0x118e52,null))[_0xae13('0x12')](handleError(_0x118e52,null));};exports['create']=function(_0x4462a5,_0x50eb6c){if(_0x4462a5[_0xae13('0x17')][_0xae13('0xa')]&&_0x4462a5['body'][_0xae13('0x18')]){var _0x39d41c=path[_0xae13('0x19')](__dirname,_0xae13('0x1a'),_0x4462a5[_0xae13('0x17')][_0xae13('0x18')]);var _0x54b3b4=process['cwd']();process[_0xae13('0x1b')](path[_0xae13('0x1c')](_0x39d41c));return execChildProcess()['then'](function(_0x168b92){process['chdir'](_0x54b3b4);return pm2[_0xae13('0x1d')]({'name':_0x4462a5[_0xae13('0x17')][_0xae13('0xa')],'script':_0x39d41c});})['then'](function(_0x57124a){pm2['dump']();return _0x57124a[0x0];})[_0xae13('0x16')](respondWithResult(_0x50eb6c,0xc9))[_0xae13('0x12')](handleError(_0x50eb6c,null));}else{return _0x50eb6c[_0xae13('0xb')](0x1f4)['send']({'message':_0xae13('0x1e')});}};exports['update']=function(_0x3d0d60,_0x5de054){if(_0x3d0d60[_0xae13('0x17')]['id']){delete _0x3d0d60[_0xae13('0x17')]['id'];}var _0x526e4e={'online':_0xae13('0x1f'),'stopped':_0xae13('0x20')};if(_0x526e4e[_0xae13('0x21')](_0x3d0d60[_0xae13('0x17')]['status'])){return pm2[_0x526e4e[_0x3d0d60[_0xae13('0x17')][_0xae13('0xb')]]](_0x3d0d60[_0xae13('0x15')]['id'])[_0xae13('0x16')](respondWithResult(_0x5de054,0xc8))[_0xae13('0x12')](handleError(_0x5de054,null));}else{return _0x5de054[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':'Unknown\x20status'});}};exports[_0xae13('0x23')]=function(_0x591f94,_0xf6289c){if(_0x591f94[_0xae13('0x17')]['id']){delete _0x591f94[_0xae13('0x17')]['id'];}if(_0x591f94[_0xae13('0x15')]['id']){return pm2[_0xae13('0x24')](_0x591f94[_0xae13('0x15')]['id'])[_0xae13('0x16')](function(_0x48f0f6){pm2['dump']();return _0x48f0f6[0x0];})[_0xae13('0x16')](respondWithResult(_0xf6289c,null))[_0xae13('0x12')](handleError(_0xf6289c,null));}else{return _0xf6289c[_0xae13('0xb')](0x1f4)[_0xae13('0x22')]({'message':_0xae13('0x25')});}}; \ No newline at end of file +var _0x9bde=['describe','params','body','script','join','../../files/plugins','chdir','start','dump','Missing\x20name\x20and/or\x20path','restart','stop','hasOwnProperty','Unknown\x20status','delete','../../config/pm2','api','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','list','reject','express','motion2','then','catch','show'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x9bde,0xe1));var _0xe9bd=function(_0x583c32,_0x35d3d4){_0x583c32=_0x583c32-0x0;var _0x8086fe=_0x9bde[_0x583c32];return _0x8086fe;};'use strict';var _=require('lodash');var pm2=require(_0xe9bd('0x0'));var logger=require('../../config/logger')(_0xe9bd('0x1'));var path=require('path');var exec=require(_0xe9bd('0x2'))[_0xe9bd('0x3')];var BPromise=require(_0xe9bd('0x4'));function handleEntityNotFound(_0x1c1b34,_0x10822d){return function(_0x1a4d14){if(!_0x1a4d14){_0x1c1b34[_0xe9bd('0x5')](0x194);;}return _0x1a4d14;};}function respondWithResult(_0x4fd7b8,_0x4763e9){_0x4763e9=_0x4763e9||0xc8;return function(_0x5f18fe){if(_0x5f18fe){return _0x4fd7b8[_0xe9bd('0x6')](_0x4763e9)[_0xe9bd('0x7')](_0x5f18fe);}return null;};}function handleError(_0x2d5c75,_0x3ef9e3){_0x3ef9e3=_0x3ef9e3||0x1f4;return function(_0x29bc2b){logger[_0xe9bd('0x8')](_0x29bc2b[_0xe9bd('0x9')]);if(_0x29bc2b[_0xe9bd('0xa')]){delete _0x29bc2b['name'];}_0x2d5c75['status'](_0x3ef9e3)[_0xe9bd('0xb')](_0x29bc2b);};}function execChildProcess(){return new BPromise(function(_0x145521,_0x2601ac){exec('npm\x20install',function(_0x12c96e,_0x9eca50,_0x3339f9){logger[_0xe9bd('0xc')](_0x9eca50);logger['info'](_0x3339f9);if(_0x12c96e){logger[_0xe9bd('0x8')](_0x12c96e);return _0x2601ac(_0x12c96e);}return _0x145521(_0x9eca50);});});}exports['index']=function(_0x220d07,_0x429e88){return pm2[_0xe9bd('0xd')]()['then'](function(_0x47ba5e){if(_0x47ba5e){var _0x46a95e=_[_0xe9bd('0xe')](_0x47ba5e,function(_0x3a9e5f){return _0x3a9e5f[_0xe9bd('0xa')]===_0xe9bd('0xf')||_0x3a9e5f[_0xe9bd('0xa')]===_0xe9bd('0x10');});return{'rows':_0x46a95e,'count':_0x46a95e['length']};}return null;})[_0xe9bd('0x11')](respondWithResult(_0x429e88,null))[_0xe9bd('0x12')](handleError(_0x429e88,null));};exports[_0xe9bd('0x13')]=function(_0x494b27,_0x36f03d){return pm2[_0xe9bd('0x14')](_0x494b27[_0xe9bd('0x15')]['id'])[_0xe9bd('0x11')](respondWithResult(_0x36f03d,null))['then'](handleEntityNotFound(_0x36f03d,null))[_0xe9bd('0x12')](handleError(_0x36f03d,null));};exports['create']=function(_0xc6b661,_0x55b869){if(_0xc6b661[_0xe9bd('0x16')][_0xe9bd('0xa')]&&_0xc6b661[_0xe9bd('0x16')][_0xe9bd('0x17')]){var _0x1acb82=path[_0xe9bd('0x18')](__dirname,_0xe9bd('0x19'),_0xc6b661['body'][_0xe9bd('0x17')]);var _0x28cd17=process['cwd']();process[_0xe9bd('0x1a')](path['dirname'](_0x1acb82));return execChildProcess()[_0xe9bd('0x11')](function(_0x1b9cc9){process[_0xe9bd('0x1a')](_0x28cd17);return pm2[_0xe9bd('0x1b')]({'name':_0xc6b661['body'][_0xe9bd('0xa')],'script':_0x1acb82});})[_0xe9bd('0x11')](function(_0x2c9a57){pm2[_0xe9bd('0x1c')]();return _0x2c9a57[0x0];})[_0xe9bd('0x11')](respondWithResult(_0x55b869,0xc9))[_0xe9bd('0x12')](handleError(_0x55b869,null));}else{return _0x55b869[_0xe9bd('0x6')](0x1f4)[_0xe9bd('0xb')]({'message':_0xe9bd('0x1d')});}};exports['update']=function(_0x3c211a,_0x38fdfa){if(_0x3c211a['body']['id']){delete _0x3c211a[_0xe9bd('0x16')]['id'];}var _0xc25248={'online':_0xe9bd('0x1e'),'stopped':_0xe9bd('0x1f')};if(_0xc25248[_0xe9bd('0x20')](_0x3c211a[_0xe9bd('0x16')]['status'])){return pm2[_0xc25248[_0x3c211a['body'][_0xe9bd('0x6')]]](_0x3c211a['params']['id'])[_0xe9bd('0x11')](respondWithResult(_0x38fdfa,0xc8))[_0xe9bd('0x12')](handleError(_0x38fdfa,null));}else{return _0x38fdfa[_0xe9bd('0x6')](0x1f4)[_0xe9bd('0xb')]({'message':_0xe9bd('0x21')});}};exports['destroy']=function(_0x4b7bc2,_0x7f2c5){if(_0x4b7bc2[_0xe9bd('0x16')]['id']){delete _0x4b7bc2[_0xe9bd('0x16')]['id'];}if(_0x4b7bc2[_0xe9bd('0x15')]['id']){return pm2[_0xe9bd('0x22')](_0x4b7bc2[_0xe9bd('0x15')]['id'])[_0xe9bd('0x11')](function(_0x66213a){pm2[_0xe9bd('0x1c')]();return _0x66213a[0x0];})['then'](respondWithResult(_0x7f2c5,null))[_0xe9bd('0x12')](handleError(_0x7f2c5,null));}else{return _0x7f2c5[_0xe9bd('0x6')](0x1f4)[_0xe9bd('0xb')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index e6858b5..dd84ec0 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 _0xa761=['getQueues','exports','express','../../components/auth/service','./realtime.controller','get','isAuthenticated','getAgents','/queues'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xa761,0x89));var _0x1a76=function(_0x522ecd,_0x1c3573){_0x522ecd=_0x522ecd-0x0;var _0x2e4126=_0xa761[_0x522ecd];return _0x2e4126;};'use strict';var express=require(_0x1a76('0x0'));var router=express['Router']();var auth=require(_0x1a76('0x1'));var controller=require(_0x1a76('0x2'));router[_0x1a76('0x3')]('/agents',auth[_0x1a76('0x4')](),controller[_0x1a76('0x5')]);router[_0x1a76('0x3')](_0x1a76('0x6'),auth[_0x1a76('0x4')](),controller[_0x1a76('0x7')]);module[_0x1a76('0x8')]=router; \ No newline at end of file +var _0xc61f=['isAuthenticated','getAgents','/queues','Router','../../components/auth/service','get','/agents'];(function(_0x25405c,_0x399183){var _0x6fdbf4=function(_0x4dcc28){while(--_0x4dcc28){_0x25405c['push'](_0x25405c['shift']());}};_0x6fdbf4(++_0x399183);}(_0xc61f,0x6c));var _0xfc61=function(_0x9974f1,_0xcb4a90){_0x9974f1=_0x9974f1-0x0;var _0x159360=_0xc61f[_0x9974f1];return _0x159360;};'use strict';var express=require('express');var router=express[_0xfc61('0x0')]();var auth=require(_0xfc61('0x1'));var controller=require('./realtime.controller');router[_0xfc61('0x2')](_0xfc61('0x3'),auth[_0xfc61('0x4')](),controller[_0xfc61('0x5')]);router[_0xfc61('0x2')](_0xfc61('0x6'),auth[_0xfc61('0x4')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 933a60c..02bf7b3 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 _0x86ab=['raw','sequelize','literal','FIELD(id,','forEach','push','Pause','where','merge','user','Agents','online','extraQueryConditions','assign','getResources','findAndCountAll','find','filterAgentAttributes','globalStatus','getAgentStatus','includes','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','startCase','Queue','fields','name','outbound','dialActive','dialMethod','join','userProfileId','QueueCampaigns','Queues','filter','UserProfile','getRealtimeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','APIBadRequestError','../../errors/api','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','validateSortParameter','getUpdatedSortOptions','order','then','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions'];(function(_0x28ea3b,_0x13d7a1){var _0x5ac766=function(_0x1ea77b){while(--_0x1ea77b){_0x28ea3b['push'](_0x28ea3b['shift']());}};_0x5ac766(++_0x13d7a1);}(_0x86ab,0x140));var _0xb86a=function(_0x704d5d,_0xf94e89){_0x704d5d=_0x704d5d-0x0;var _0x1020ee=_0x86ab[_0x704d5d];return _0x1020ee;};'use strict';var _=require(_0xb86a('0x0'));var util=require('util');var rta=require(_0xb86a('0x1'));var rtq=require(_0xb86a('0x2'));var qs=require(_0xb86a('0x3'));var utils=require(_0xb86a('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require('../../errors/api')[_0xb86a('0x5')];var APIHandleError=require(_0xb86a('0x6'))[_0xb86a('0x7')];function respondWithFilteredResult(_0x2a6335,_0x336e69){return function(_0x49b89d){if(_0x49b89d){var _0x4e8159=typeof _0x336e69[_0xb86a('0x8')]===_0xb86a('0x9')&&typeof _0x336e69[_0xb86a('0xa')]===_0xb86a('0x9');var _0x15bb84=_0x49b89d[_0xb86a('0xb')];var _0x3f2439=_0x4e8159?0x0:_0x336e69['offset'];var _0x530efd=_0x4e8159?_0x49b89d[_0xb86a('0xb')]:_0x336e69[_0xb86a('0x8')]+_0x336e69[_0xb86a('0xa')];var _0x5235c2;if(_0x530efd>=_0x15bb84){_0x530efd=_0x15bb84;_0x5235c2=0xc8;}else{_0x5235c2=0xce;}_0x2a6335[_0xb86a('0xc')](_0x5235c2);return _0x2a6335[_0xb86a('0xd')](_0xb86a('0xe'),_0x3f2439+'-'+_0x530efd+'/'+_0x15bb84)[_0xb86a('0xf')](_0x49b89d);}return null;};}exports[_0xb86a('0x10')]=function(_0x167f10,_0x244367){var _0x2f0ae3={'count':0x0,'rows':[]};var _0x51ef57={};var _0x2a32e2;var _0x5acead=utils[_0xb86a('0x11')]();var _0x573fe0;var _0x16567d;var _0x3a3885=_0x167f10['query']['globalQueueFilter'];var _0x41a02d=_0x167f10[_0xb86a('0x12')]['globalStatusFilter'];var _0x675589=_0x167f10[_0xb86a('0x12')][_0xb86a('0x13')];var _0x1f49b5=_0x41a02d===_0xb86a('0x14')||_0x41a02d===_0xb86a('0x15')?!![]:![];var _0x3cc71d=[];var _0x5dca65;var _0x5b2dee;Promise[_0xb86a('0x16')]()['then'](function(){if(_0x167f10['query'][_0xb86a('0x17')]){if(!utils[_0xb86a('0x18')](_0x167f10[_0xb86a('0x12')]['channel'])){throw new APIBadRequestError(util[_0xb86a('0x19')](_0xb86a('0x1a'),_0x167f10[_0xb86a('0x12')][_0xb86a('0x17')]));}_0x2a32e2=_0x167f10[_0xb86a('0x12')]['channel'][_0xb86a('0x1b')]();}if(!_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]||!_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]['includes']('globalStatus')){_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]=rta[_0xb86a('0x1d')](_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]);return;}var _0x25ddc4=rta[_0xb86a('0x1e')](_0x167f10['query'][_0xb86a('0x1c')]);_0x167f10[_0xb86a('0x12')][_0xb86a('0x1c')]=_0x25ddc4['fields']['join'](',');_0x5dca65=_0x25ddc4[_0xb86a('0x1f')];})[_0xb86a('0x20')](function(){if(!_0x3a3885){return[];}return rta[_0xb86a('0x21')](_0x3a3885,_0x2a32e2);})['then'](function(_0x2d0de8){_0x3cc71d=_0x2d0de8;return rta[_0xb86a('0x22')]();})[_0xb86a('0x20')](function(_0x3abd9c){_0x16567d=_0x3abd9c[_0xb86a('0x23')];if((!_0x41a02d||_0x1f49b5)&&!_0x5dca65){return _0x3cc71d;}if(_0x5dca65&&!_0x41a02d){return rta[_0xb86a('0x24')](_0x16567d,_0x3cc71d,_0x5dca65);}else{return rta[_0xb86a('0x25')](_0x16567d,_0x3cc71d,_0x41a02d);}})[_0xb86a('0x20')](function(_0x4606e8){_0x3cc71d=_0x4606e8;var _0x16420c=![];if(_0x3cc71d[_0xb86a('0x26')]===0x0){if(_0x3a3885||_0x41a02d){_0x16420c=!![];}if(_0x1f49b5){_0x16420c=![];}}if(_0x16420c){return _0x2f0ae3;}var _0x41ca36=_[_0xb86a('0x27')](db[_0xb86a('0x28')][_0xb86a('0x29')],function(_0x4b5744){return{'name':_0x4b5744[_0xb86a('0x2a')],'type':_0x4b5744[_0xb86a('0x2b')][_0xb86a('0x2c')]};});_0x167f10[_0xb86a('0x12')][_0xb86a('0x2d')]=_0xb86a('0x2e');_0x51ef57=qs[_0xb86a('0x2f')](_0x41ca36,_0x167f10);_0x51ef57[_0xb86a('0x30')]=!![];var _0x20022f=[];if(_0x3cc71d[_0xb86a('0x26')]>0x0){_0x20022f['push']({'id':{'$in':_0x3cc71d}});if(_0x5dca65&&!_0x41a02d){_0x5b2dee=[db[_0xb86a('0x31')][_0xb86a('0x32')](_0xb86a('0x33')+_0x3cc71d+')')];_0x51ef57[_0xb86a('0x1f')]=_0x5b2dee;}}if(_0x1f49b5){_0x5acead[_0xb86a('0x34')](function(_0x21b5c8){var _0x458319=!![];if(_0x41a02d==='*pause'&&_0x2a32e2!==_0x21b5c8){_0x458319=![];}_0x20022f[_0xb86a('0x35')]({[_0x21b5c8+_0xb86a('0x36')]:_0x458319});});if(_0x675589){_0x20022f['push']({'pauseType':_0x675589});}}else if(_0x41a02d){_0x5acead[_0xb86a('0x34')](function(_0x18cf82){_0x20022f[_0xb86a('0x35')]({[_0x18cf82+_0xb86a('0x36')]:![]});});}_0x51ef57[_0xb86a('0x37')]=_[_0xb86a('0x38')](_0x51ef57[_0xb86a('0x37')],{'$and':_0x20022f});if(_0x167f10[_0xb86a('0x39')][_0xb86a('0x2d')]===_0xb86a('0x39')){var _0x5b2816={'params':{'id':_0x167f10[_0xb86a('0x39')]['userProfileId']},'query':{'section':_0xb86a('0x3a'),'role':_0xb86a('0x2e'),'raw':!![],'ids':_0x3cc71d,'customSorting':_0x5b2dee}};if(_0x167f10[_0xb86a('0x12')][_0xb86a('0x3b')]){_0x5b2816[_0xb86a('0x12')][_0xb86a('0x3b')]=!![];}if(_0x1f49b5){_0x5b2816['query'][_0xb86a('0x3c')]=_0x20022f;}_0x5b2816[_0xb86a('0x12')]=Object[_0xb86a('0x3d')](_0x5b2816[_0xb86a('0x12')],_['omit'](_0x167f10[_0xb86a('0x12')],'id'));return db['UserProfile'][_0xb86a('0x3e')](_0x5b2816);}return db[_0xb86a('0x28')][_0xb86a('0x3f')](_0x51ef57);})[_0xb86a('0x20')](function(_0x3382c6){_0x2f0ae3['count']=_0x3382c6['count'];_0x573fe0=_0x3382c6[_0xb86a('0x23')];return _0x573fe0[_0xb86a('0x27')](function(_0x2c4a8d){var _0x2cbd75=_[_0xb86a('0x40')](_0x16567d,['id',_0x2c4a8d['id']]);if(_0x2cbd75){var _0x3beeea=rta[_0xb86a('0x41')](_0x2cbd75);_['merge'](_0x2c4a8d,_0x3beeea);}_0x2c4a8d[_0xb86a('0x42')]=rta[_0xb86a('0x43')](_0x2c4a8d);if(_0x2c4a8d[_0xb86a('0x42')][_0xb86a('0x44')](_0xb86a('0x14'))){_0x5acead[_0xb86a('0x34')](function(_0x2feafa){if(_0x2c4a8d[_0x2feafa+_0xb86a('0x36')]){if(_0x2feafa===_0xb86a('0x45')){if(_0x2c4a8d[_0xb86a('0x46')]!==_0xb86a('0x47')){_0x2c4a8d[_0xb86a('0x46')]=_0xb86a('0x14');}}else{_0x2c4a8d[_0x2feafa+_0xb86a('0x48')]=_0xb86a('0x14');}}});}return _0x2c4a8d;});})[_0xb86a('0x20')](function(_0x423180){if(!_0x5dca65||_0x5b2dee){return _0x423180;}return rta[_0xb86a('0x49')](_0x423180,_0x5dca65);})[_0xb86a('0x20')](function(_0x3f7117){var _0x3bd6d0=rta[_0xb86a('0x4a')]();_0x2f0ae3[_0xb86a('0x23')]=_0x3f7117[_0xb86a('0x27')](function(_0x152627){return _[_0xb86a('0x4b')](_0x152627,_0x3bd6d0);});return _0x2f0ae3;})['then'](respondWithFilteredResult(_0x244367,_0x51ef57))[_0xb86a('0x4c')](APIHandleError(_0x244367));};exports[_0xb86a('0x4d')]=function(_0x2bf30f,_0x1c21f6){var _0x1c9c0f={'count':0x0,'rows':[]};var _0x2ee837={};var _0x333712;var _0x37eac3;var _0x1a5181;Promise[_0xb86a('0x16')]()[_0xb86a('0x20')](function(){if(_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x17')]){if(!utils[_0xb86a('0x18')](_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x17')])){throw new APIBadRequestError(util['format'](_0xb86a('0x1a'),_0x2bf30f['query'][_0xb86a('0x17')]));}_0x333712=_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x17')][_0xb86a('0x1b')]();}var _0x293a72=_[_0xb86a('0x4e')](_0x333712)+_0xb86a('0x4f');var _0x270f56=_[_0xb86a('0x27')](db[_0x293a72][_0xb86a('0x29')],function(_0x4f94cb){return{'name':_0x4f94cb[_0xb86a('0x2a')],'type':_0x4f94cb[_0xb86a('0x2b')]['key']};});if(!_0x2bf30f['query'][_0xb86a('0x50')]){var _0x175f35=['id',_0xb86a('0x51')];if(_0x333712===_0xb86a('0x45')){_0x175f35[_0xb86a('0x35')](_0xb86a('0x2b'));if(_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x2b')]===_0xb86a('0x52')){_0x175f35[_0xb86a('0x35')]([_0xb86a('0x53'),_0xb86a('0x54')]);}}_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x50')]=_0x175f35[_0xb86a('0x55')](',');}_0x2ee837=qs[_0xb86a('0x2f')](_0x270f56,_0x2bf30f);if(_0x2bf30f['user'][_0xb86a('0x2d')]===_0xb86a('0x39')){var _0x202a2b={'params':{'id':_0x2bf30f['user'][_0xb86a('0x56')]},'query':{'section':_0x333712===_0xb86a('0x45')&&_0x2bf30f['query'][_0xb86a('0x2b')]==='outbound'?_0xb86a('0x57'):_[_0xb86a('0x4e')](_0x333712)+_0xb86a('0x58'),'type':_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x2b')],'nolimit':!![],'sort':'name','filter':_0x2bf30f[_0xb86a('0x12')][_0xb86a('0x59')]}};_0x202a2b[_0xb86a('0x12')]=Object[_0xb86a('0x3d')](_0x202a2b[_0xb86a('0x12')],_0x2bf30f[_0xb86a('0x12')]);delete _0x202a2b['query']['id'];return db[_0xb86a('0x5a')][_0xb86a('0x3e')](_0x202a2b);}return db[_0x293a72]['findAndCountAll'](_0x2ee837);})[_0xb86a('0x20')](function(_0x492cac){_0x1c9c0f['count']=_0x492cac[_0xb86a('0xb')];_0x37eac3=_0x492cac[_0xb86a('0x23')];return rtq[_0xb86a('0x5b')](_0x2bf30f,_0x333712);})[_0xb86a('0x20')](function(_0x4cd0bf){_0x1a5181=_0x4cd0bf[_0xb86a('0x23')];return rtq['initializeQueues'](_0x37eac3,_0x1a5181,_0x333712,_0x2bf30f[_0xb86a('0x12')]['type']);})[_0xb86a('0x20')](function(_0x21c905){_0x1c9c0f[_0xb86a('0x23')]=_0x21c905;return _0x1c9c0f;})[_0xb86a('0x20')](respondWithFilteredResult(_0x1c21f6,_0x2ee837))[_0xb86a('0x4c')](APIHandleError(_0x1c21f6));}; \ No newline at end of file +var _0x425e=['getOptions','raw','length','push','sequelize','FIELD(id,','forEach','Pause','merge','where','user','userProfileId','Agents','agent','online','assign','omit','getResources','findAndCountAll','rows','map','filterAgentAttributes','getAgentStatus','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','type','voice','outbound','dialActive','dialMethod','Queues','name','UserProfile','getRealtimeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count','status','Content-Range','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','channel','isValidChannel','format','toLowerCase','sort','includes','globalStatus','validateSortParameter','fields','join','order','then','getAgentIdsByQueues','getRealtimeAgents','getSortedAgentsIdsByStatus','User','rawAttributes','fieldName','key','role'];(function(_0x4ae2e6,_0x4580d6){var _0x2e359f=function(_0x1dc083){while(--_0x1dc083){_0x4ae2e6['push'](_0x4ae2e6['shift']());}};_0x2e359f(++_0x4580d6);}(_0x425e,0x17a));var _0xe425=function(_0x454c5d,_0x3b249c){_0x454c5d=_0x454c5d-0x0;var _0xa1d8b0=_0x425e[_0x454c5d];return _0xa1d8b0;};'use strict';var _=require(_0xe425('0x0'));var util=require(_0xe425('0x1'));var rta=require(_0xe425('0x2'));var rtq=require(_0xe425('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0xe425('0x4'))['db'];var APIBadRequestError=require(_0xe425('0x5'))[_0xe425('0x6')];var APIHandleError=require(_0xe425('0x5'))['handleError'];function respondWithFilteredResult(_0x3e2c39,_0x16b0e2){return function(_0x3c571e){if(_0x3c571e){var _0xec607a=typeof _0x16b0e2[_0xe425('0x7')]===_0xe425('0x8')&&typeof _0x16b0e2[_0xe425('0x9')]===_0xe425('0x8');var _0x393b77=_0x3c571e[_0xe425('0xa')];var _0x57b5fa=_0xec607a?0x0:_0x16b0e2[_0xe425('0x7')];var _0x57c883=_0xec607a?_0x3c571e[_0xe425('0xa')]:_0x16b0e2[_0xe425('0x7')]+_0x16b0e2[_0xe425('0x9')];var _0x442e5c;if(_0x57c883>=_0x393b77){_0x57c883=_0x393b77;_0x442e5c=0xc8;}else{_0x442e5c=0xce;}_0x3e2c39[_0xe425('0xb')](_0x442e5c);return _0x3e2c39['set'](_0xe425('0xc'),_0x57b5fa+'-'+_0x57c883+'/'+_0x393b77)['json'](_0x3c571e);}return null;};}exports[_0xe425('0xd')]=function(_0x752486,_0x5eb715){var _0x3f7978={'count':0x0,'rows':[]};var _0x3777a1={};var _0x31d6a2;var _0x28ff89=utils[_0xe425('0xe')]();var _0x39b590;var _0x298eb1;var _0x24d9b5=_0x752486[_0xe425('0xf')][_0xe425('0x10')];var _0x5867dc=_0x752486[_0xe425('0xf')][_0xe425('0x11')];var _0x570e18=_0x752486[_0xe425('0xf')][_0xe425('0x12')];var _0x586a6d=_0x5867dc===_0xe425('0x13')||_0x5867dc===_0xe425('0x14')?!![]:![];var _0x43be69=[];var _0x279f79;var _0x11ec55;Promise[_0xe425('0x15')]()['then'](function(){if(_0x752486[_0xe425('0xf')][_0xe425('0x16')]){if(!utils[_0xe425('0x17')](_0x752486[_0xe425('0xf')][_0xe425('0x16')])){throw new APIBadRequestError(util[_0xe425('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x752486['query'][_0xe425('0x16')]));}_0x31d6a2=_0x752486['query'][_0xe425('0x16')][_0xe425('0x19')]();}if(!_0x752486[_0xe425('0xf')][_0xe425('0x1a')]||!_0x752486['query']['sort'][_0xe425('0x1b')](_0xe425('0x1c'))){_0x752486[_0xe425('0xf')][_0xe425('0x1a')]=rta[_0xe425('0x1d')](_0x752486['query'][_0xe425('0x1a')]);return;}var _0x275558=rta['getUpdatedSortOptions'](_0x752486[_0xe425('0xf')][_0xe425('0x1a')]);_0x752486['query']['sort']=_0x275558[_0xe425('0x1e')][_0xe425('0x1f')](',');_0x279f79=_0x275558[_0xe425('0x20')];})[_0xe425('0x21')](function(){if(!_0x24d9b5){return[];}return rta[_0xe425('0x22')](_0x24d9b5,_0x31d6a2);})[_0xe425('0x21')](function(_0x357414){_0x43be69=_0x357414;return rta[_0xe425('0x23')]();})['then'](function(_0x2da0f1){_0x298eb1=_0x2da0f1['rows'];if((!_0x5867dc||_0x586a6d)&&!_0x279f79){return _0x43be69;}if(_0x279f79&&!_0x5867dc){return rta[_0xe425('0x24')](_0x298eb1,_0x43be69,_0x279f79);}else{return rta['getAgentIdsByStatus'](_0x298eb1,_0x43be69,_0x5867dc);}})[_0xe425('0x21')](function(_0xb3f6ea){_0x43be69=_0xb3f6ea;var _0x2dbf8e=![];if(_0x43be69['length']===0x0){if(_0x24d9b5||_0x5867dc){_0x2dbf8e=!![];}if(_0x586a6d){_0x2dbf8e=![];}}if(_0x2dbf8e){return _0x3f7978;}var _0xf47b22=_['map'](db[_0xe425('0x25')][_0xe425('0x26')],function(_0x1e78b0){return{'name':_0x1e78b0[_0xe425('0x27')],'type':_0x1e78b0['type'][_0xe425('0x28')]};});_0x752486[_0xe425('0xf')][_0xe425('0x29')]='agent';_0x3777a1=qs[_0xe425('0x2a')](_0xf47b22,_0x752486);_0x3777a1[_0xe425('0x2b')]=!![];var _0x27fe64=[];if(_0x43be69[_0xe425('0x2c')]>0x0){_0x27fe64[_0xe425('0x2d')]({'id':{'$in':_0x43be69}});if(_0x279f79&&!_0x5867dc){_0x11ec55=[db[_0xe425('0x2e')]['literal'](_0xe425('0x2f')+_0x43be69+')')];_0x3777a1['order']=_0x11ec55;}}if(_0x586a6d){_0x28ff89[_0xe425('0x30')](function(_0x1e68e5){var _0x58d720=!![];if(_0x5867dc===_0xe425('0x14')&&_0x31d6a2!==_0x1e68e5){_0x58d720=![];}_0x27fe64[_0xe425('0x2d')]({[_0x1e68e5+'Pause']:_0x58d720});});if(_0x570e18){_0x27fe64[_0xe425('0x2d')]({'pauseType':_0x570e18});}}else if(_0x5867dc){_0x28ff89[_0xe425('0x30')](function(_0x4f9978){_0x27fe64[_0xe425('0x2d')]({[_0x4f9978+_0xe425('0x31')]:![]});});}_0x3777a1['where']=_[_0xe425('0x32')](_0x3777a1[_0xe425('0x33')],{'$and':_0x27fe64});if(_0x752486['user'][_0xe425('0x29')]===_0xe425('0x34')){var _0x752424={'params':{'id':_0x752486[_0xe425('0x34')][_0xe425('0x35')]},'query':{'section':_0xe425('0x36'),'role':_0xe425('0x37'),'raw':!![],'ids':_0x43be69,'customSorting':_0x11ec55}};if(_0x752486[_0xe425('0xf')]['online']){_0x752424[_0xe425('0xf')][_0xe425('0x38')]=!![];}if(_0x586a6d){_0x752424[_0xe425('0xf')]['extraQueryConditions']=_0x27fe64;}_0x752424['query']=Object[_0xe425('0x39')](_0x752424[_0xe425('0xf')],_[_0xe425('0x3a')](_0x752486[_0xe425('0xf')],'id'));return db['UserProfile'][_0xe425('0x3b')](_0x752424);}return db[_0xe425('0x25')][_0xe425('0x3c')](_0x3777a1);})[_0xe425('0x21')](function(_0x3cc82c){_0x3f7978['count']=_0x3cc82c[_0xe425('0xa')];_0x39b590=_0x3cc82c[_0xe425('0x3d')];return _0x39b590[_0xe425('0x3e')](function(_0x576bd0){var _0x198463=_['find'](_0x298eb1,['id',_0x576bd0['id']]);if(_0x198463){var _0x39baf8=rta[_0xe425('0x3f')](_0x198463);_[_0xe425('0x32')](_0x576bd0,_0x39baf8);}_0x576bd0['globalStatus']=rta[_0xe425('0x40')](_0x576bd0);if(_0x576bd0['globalStatus']['includes'](_0xe425('0x13'))){_0x28ff89[_0xe425('0x30')](function(_0x373f97){if(_0x576bd0[_0x373f97+_0xe425('0x31')]){if(_0x373f97==='voice'){if(_0x576bd0[_0xe425('0x41')]!==_0xe425('0x42')){_0x576bd0[_0xe425('0x41')]=_0xe425('0x13');}}else{_0x576bd0[_0x373f97+_0xe425('0x43')]='pause';}}});}return _0x576bd0;});})[_0xe425('0x21')](function(_0xec1fa2){if(!_0x279f79||_0x11ec55){return _0xec1fa2;}return rta[_0xe425('0x44')](_0xec1fa2,_0x279f79);})[_0xe425('0x21')](function(_0x531e79){var _0x4974c4=rta[_0xe425('0x45')]();_0x3f7978[_0xe425('0x3d')]=_0x531e79[_0xe425('0x3e')](function(_0x3f6b2b){return _[_0xe425('0x46')](_0x3f6b2b,_0x4974c4);});return _0x3f7978;})[_0xe425('0x21')](respondWithFilteredResult(_0x5eb715,_0x3777a1))[_0xe425('0x47')](APIHandleError(_0x5eb715));};exports[_0xe425('0x48')]=function(_0x671649,_0x1f782a){var _0x4e5a94={'count':0x0,'rows':[]};var _0x3470b1={};var _0x5977b1;var _0x39eb1f;var _0x588675;Promise[_0xe425('0x15')]()[_0xe425('0x21')](function(){if(_0x671649['query']['channel']){if(!utils[_0xe425('0x17')](_0x671649[_0xe425('0xf')]['channel'])){throw new APIBadRequestError(util[_0xe425('0x18')](_0xe425('0x49'),_0x671649[_0xe425('0xf')][_0xe425('0x16')]));}_0x5977b1=_0x671649[_0xe425('0xf')]['channel']['toLowerCase']();}var _0x53dcc1=_[_0xe425('0x4a')](_0x5977b1)+'Queue';var _0x3809dc=_[_0xe425('0x3e')](db[_0x53dcc1][_0xe425('0x26')],function(_0x199f66){return{'name':_0x199f66[_0xe425('0x27')],'type':_0x199f66[_0xe425('0x4b')][_0xe425('0x28')]};});if(!_0x671649[_0xe425('0xf')][_0xe425('0x1e')]){var _0x230b4f=['id','name'];if(_0x5977b1===_0xe425('0x4c')){_0x230b4f[_0xe425('0x2d')](_0xe425('0x4b'));if(_0x671649['query']['type']===_0xe425('0x4d')){_0x230b4f[_0xe425('0x2d')]([_0xe425('0x4e'),_0xe425('0x4f')]);}}_0x671649['query']['fields']=_0x230b4f['join'](',');}_0x3470b1=qs[_0xe425('0x2a')](_0x3809dc,_0x671649);if(_0x671649[_0xe425('0x34')][_0xe425('0x29')]==='user'){var _0x37d04b={'params':{'id':_0x671649[_0xe425('0x34')]['userProfileId']},'query':{'section':_0x5977b1===_0xe425('0x4c')&&_0x671649[_0xe425('0xf')][_0xe425('0x4b')]===_0xe425('0x4d')?'QueueCampaigns':_[_0xe425('0x4a')](_0x5977b1)+_0xe425('0x50'),'type':_0x671649[_0xe425('0xf')][_0xe425('0x4b')],'nolimit':!![],'sort':_0xe425('0x51'),'filter':_0x671649['query']['filter']}};_0x37d04b['query']=Object[_0xe425('0x39')](_0x37d04b[_0xe425('0xf')],_0x671649[_0xe425('0xf')]);delete _0x37d04b[_0xe425('0xf')]['id'];return db[_0xe425('0x52')]['getResources'](_0x37d04b);}return db[_0x53dcc1][_0xe425('0x3c')](_0x3470b1);})[_0xe425('0x21')](function(_0x4f4445){_0x4e5a94[_0xe425('0xa')]=_0x4f4445[_0xe425('0xa')];_0x39eb1f=_0x4f4445[_0xe425('0x3d')];return rtq[_0xe425('0x53')](_0x671649,_0x5977b1);})[_0xe425('0x21')](function(_0x5089f7){_0x588675=_0x5089f7[_0xe425('0x3d')];return rtq['initializeQueues'](_0x39eb1f,_0x588675,_0x5977b1,_0x671649[_0xe425('0xf')]['type']);})[_0xe425('0x21')](function(_0x1725d8){_0x4e5a94[_0xe425('0x3d')]=_0x1725d8;return _0x4e5a94;})[_0xe425('0x21')](respondWithFilteredResult(_0x1f782a,_0x3470b1))[_0xe425('0x47')](APIHandleError(_0x1f782a));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 540eccd..59cce62 100644 --- a/server/api/reportAgentPreview/index.js +++ b/server/api/reportAgentPreview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x29d7d4,_0x27da9e){var _0x4196d1=function(_0x3190ab){while(--_0x3190ab){_0x29d7d4['push'](_0x29d7d4['shift']());}};_0x4196d1(++_0x27da9e);}(_0xedd9,0xfc));var _0x9edd=function(_0x18d5bf,_0x13c110){_0x18d5bf=_0x18d5bf-0x0;var _0x29ac4b=_0xedd9[_0x18d5bf];return _0x29ac4b;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x427935,_0x71fb83){var _0x5a8288=function(_0x90a524){while(--_0x90a524){_0x427935['push'](_0x427935['shift']());}};_0x5a8288(++_0x71fb83);}(_0xedd9,0xfc));var _0x9edd=function(_0x2d0ef5,_0x5621a4){_0x2d0ef5=_0x2d0ef5-0x0;var _0x550979=_0xedd9[_0x2d0ef5];return _0x550979;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 897f8b5..ffae9ea 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 _0xc962=['INTEGER','sequelize','DATE','STRING'];(function(_0x340673,_0x57da0d){var _0x4c5db1=function(_0x57965c){while(--_0x57965c){_0x340673['push'](_0x340673['shift']());}};_0x4c5db1(++_0x57da0d);}(_0xc962,0x6d));var _0x2c96=function(_0x4546d7,_0x2b13f4){_0x4546d7=_0x4546d7-0x0;var _0xff48a=_0xc962[_0x4546d7];return _0xff48a;};'use strict';var Sequelize=require(_0x2c96('0x0'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x2c96('0x1')]},'uniqueid':{'type':Sequelize[_0x2c96('0x2')]},'starttime':{'type':Sequelize[_0x2c96('0x1')]},'responsetime':{'type':Sequelize[_0x2c96('0x1')]},'ringtime':{'type':Sequelize[_0x2c96('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x2c96('0x2')]},'campaigntype':{'type':Sequelize[_0x2c96('0x2')]},'membername':{'type':Sequelize[_0x2c96('0x2')]}}; \ No newline at end of file +var _0x2484=['INTEGER','sequelize','exports','STRING','DATE'];(function(_0x27f903,_0x3212c1){var _0x371513=function(_0x2be072){while(--_0x2be072){_0x27f903['push'](_0x27f903['shift']());}};_0x371513(++_0x3212c1);}(_0x2484,0x178));var _0x4248=function(_0x5e7ee9,_0x4dbc4b){_0x5e7ee9=_0x5e7ee9-0x0;var _0xadb900=_0x2484[_0x5e7ee9];return _0xadb900;};'use strict';var Sequelize=require(_0x4248('0x0'));module[_0x4248('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x4248('0x2')]},'scheduledat':{'type':Sequelize[_0x4248('0x3')]},'uniqueid':{'type':Sequelize[_0x4248('0x2')]},'starttime':{'type':Sequelize[_0x4248('0x3')]},'responsetime':{'type':Sequelize[_0x4248('0x3')]},'ringtime':{'type':Sequelize[_0x4248('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x4248('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4248('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index d4cfebd..a29dacd 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 _0x5a94=['path','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x1912b7,_0x2554e4){var _0x5b1789=function(_0x40a915){while(--_0x40a915){_0x1912b7['push'](_0x1912b7['shift']());}};_0x5b1789(++_0x2554e4);}(_0x5a94,0xc2));var _0x45a9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x5a94[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0x45a9('0x0'));var util=require(_0x45a9('0x1'));var logger=require(_0x45a9('0x2'))(_0x45a9('0x3'));var moment=require(_0x45a9('0x4'));var BPromise=require('bluebird');var rp=require(_0x45a9('0x5'));var fs=require('fs');var path=require(_0x45a9('0x6'));var rimraf=require('rimraf');var config=require(_0x45a9('0x7'));var attributes=require('./reportAgentPreview.attributes');module[_0x45a9('0x8')]=function(_0xe37f2a,_0x5e2fdf){return _0xe37f2a[_0x45a9('0x9')]('ReportAgentPreview',attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e61=['exports','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x8e61,0xcf));var _0x18e6=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x8e61[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x18e6('0x0'));var util=require('util');var logger=require(_0x18e6('0x1'))(_0x18e6('0x2'));var moment=require(_0x18e6('0x3'));var BPromise=require(_0x18e6('0x4'));var rp=require(_0x18e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x18e6('0x6'));var config=require(_0x18e6('0x7'));var attributes=require(_0x18e6('0x8'));module[_0x18e6('0x9')]=function(_0x3ed092,_0x1bdd65){return _0x3ed092['define'](_0x18e6('0xa'),attributes,{'tableName':_0x18e6('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 1bae6b1..82f0392 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 _0x47ca=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','ReportAgentPreview,\x20%s,\x20%s','result','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','info','stringify','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x47ca,0xff));var _0xa47c=function(_0x29a2ce,_0x5d6558){_0x29a2ce=_0x29a2ce-0x0;var _0x2fa9ea=_0x47ca[_0x29a2ce];return _0x2fa9ea;};'use strict';var _=require(_0xa47c('0x0'));var util=require(_0xa47c('0x1'));var moment=require(_0xa47c('0x2'));var BPromise=require(_0xa47c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa47c('0x4'));var db=require(_0xa47c('0x5'))['db'];var utils=require(_0xa47c('0x6'));var logger=require(_0xa47c('0x7'))(_0xa47c('0x8'));var config=require(_0xa47c('0x9'));var jayson=require(_0xa47c('0xa'));var client=jayson[_0xa47c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc7159e,_0x437e37,_0x206972){return new BPromise(function(_0x28a9d0,_0x3c1eb9){return client[_0xa47c('0xc')](_0xc7159e,_0x206972)[_0xa47c('0xd')](function(_0xd6dbb2){logger['info']('ReportAgentPreview,\x20%s,\x20%s',_0x437e37,_0xa47c('0xe'));logger['debug'](_0xa47c('0xf'),_0x437e37,_0xa47c('0xe'),JSON['stringify'](_0xd6dbb2));if(_0xd6dbb2[_0xa47c('0x10')]){if(_0xd6dbb2[_0xa47c('0x10')][_0xa47c('0x11')]===0x1f4){logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0x437e37,_0xd6dbb2['error'][_0xa47c('0x12')]);return _0x3c1eb9(_0xd6dbb2['error'][_0xa47c('0x12')]);}logger[_0xa47c('0x10')](_0xa47c('0x13'),_0x437e37,_0xd6dbb2[_0xa47c('0x10')][_0xa47c('0x12')]);return _0x28a9d0(_0xd6dbb2[_0xa47c('0x10')]['message']);}else{logger['info'](_0xa47c('0x13'),_0x437e37,_0xa47c('0xe'));_0x28a9d0(_0xd6dbb2[_0xa47c('0x14')][_0xa47c('0x12')]);}})['catch'](function(_0x348f7d){logger[_0xa47c('0x10')](_0xa47c('0x13'),_0x437e37,_0x348f7d);_0x3c1eb9(_0x348f7d);});});}exports[_0xa47c('0x15')]=function(_0x5a1789){var _0x14a9d8=this;return new Promise(function(_0x1eb669,_0x1c45f6){return db[_0xa47c('0x16')][_0xa47c('0x17')](_0x5a1789[_0xa47c('0x18')],{'raw':_0x5a1789['options']?_0x5a1789[_0xa47c('0x19')][_0xa47c('0x1a')]===undefined?!![]:![]:!![]})[_0xa47c('0xd')](function(_0x49d877){logger[_0xa47c('0x1b')](_0xa47c('0x15'),_0x5a1789);logger['debug'](_0xa47c('0x15'),_0x5a1789,JSON[_0xa47c('0x1c')](_0x49d877));_0x1eb669(_0x49d877);})[_0xa47c('0x1d')](function(_0x2bb8d9){logger[_0xa47c('0x10')](_0xa47c('0x15'),_0x2bb8d9[_0xa47c('0x12')],_0x5a1789);_0x1c45f6(_0x14a9d8[_0xa47c('0x10')](0x1f4,_0x2bb8d9[_0xa47c('0x12')]));});});}; \ No newline at end of file +var _0x30b9=['create','body','options','raw','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview'];(function(_0x237e36,_0x30d6ae){var _0xf89afa=function(_0x28b30a){while(--_0x28b30a){_0x237e36['push'](_0x237e36['shift']());}};_0xf89afa(++_0x30d6ae);}(_0x30b9,0x79));var _0x930b=function(_0x1c9256,_0x266ae0){_0x1c9256=_0x1c9256-0x0;var _0x3ef89b=_0x30b9[_0x1c9256];return _0x3ef89b;};'use strict';var _=require(_0x930b('0x0'));var util=require('util');var moment=require(_0x930b('0x1'));var BPromise=require(_0x930b('0x2'));var rs=require(_0x930b('0x3'));var fs=require('fs');var Redis=require(_0x930b('0x4'));var db=require(_0x930b('0x5'))['db'];var utils=require(_0x930b('0x6'));var logger=require('../../config/logger')(_0x930b('0x7'));var config=require(_0x930b('0x8'));var jayson=require(_0x930b('0x9'));var client=jayson['client'][_0x930b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d8080,_0x1827f1,_0x19047e){return new BPromise(function(_0x418454,_0x24bbc7){return client[_0x930b('0xb')](_0x3d8080,_0x19047e)['then'](function(_0x3706f3){logger[_0x930b('0xc')](_0x930b('0xd'),_0x1827f1,_0x930b('0xe'));logger[_0x930b('0xf')](_0x930b('0x10'),_0x1827f1,_0x930b('0xe'),JSON[_0x930b('0x11')](_0x3706f3));if(_0x3706f3[_0x930b('0x12')]){if(_0x3706f3[_0x930b('0x12')][_0x930b('0x13')]===0x1f4){logger[_0x930b('0x12')](_0x930b('0xd'),_0x1827f1,_0x3706f3[_0x930b('0x12')]['message']);return _0x24bbc7(_0x3706f3[_0x930b('0x12')][_0x930b('0x14')]);}logger[_0x930b('0x12')](_0x930b('0xd'),_0x1827f1,_0x3706f3[_0x930b('0x12')][_0x930b('0x14')]);return _0x418454(_0x3706f3[_0x930b('0x12')]['message']);}else{logger['info'](_0x930b('0xd'),_0x1827f1,_0x930b('0xe'));_0x418454(_0x3706f3[_0x930b('0x15')]['message']);}})[_0x930b('0x16')](function(_0x22bbda){logger['error'](_0x930b('0xd'),_0x1827f1,_0x22bbda);_0x24bbc7(_0x22bbda);});});}exports[_0x930b('0x17')]=function(_0x12eff3){var _0x5d179e=this;return new Promise(function(_0x1fd62e,_0x4823c7){return db['ReportAgentPreview'][_0x930b('0x18')](_0x12eff3[_0x930b('0x19')],{'raw':_0x12eff3['options']?_0x12eff3[_0x930b('0x1a')][_0x930b('0x1b')]===undefined?!![]:![]:!![]})[_0x930b('0x1c')](function(_0x1cda17){logger[_0x930b('0xc')]('CreateReportAgentPreview',_0x12eff3);logger[_0x930b('0xf')](_0x930b('0x17'),_0x12eff3,JSON['stringify'](_0x1cda17));_0x1fd62e(_0x1cda17);})[_0x930b('0x16')](function(_0x232019){logger[_0x930b('0x12')](_0x930b('0x17'),_0x232019['message'],_0x12eff3);_0x4823c7(_0x5d179e[_0x930b('0x12')](0x1f4,_0x232019[_0x930b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 9c4f8a6..8760667 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 _0xd696=['chatQueues','/mail/queues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','exports','multer','util','path','express','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','voiceQueues','/chat/queues'];(function(_0x27cae4,_0x1fe454){var _0x468f66=function(_0x299ed4){while(--_0x299ed4){_0x27cae4['push'](_0x27cae4['shift']());}};_0x468f66(++_0x1fe454);}(_0xd696,0xea));var _0x6d69=function(_0x8980,_0x3e943b){_0x8980=_0x8980-0x0;var _0x3491a6=_0xd696[_0x8980];return _0x3491a6;};'use strict';var multer=require(_0x6d69('0x0'));var util=require(_0x6d69('0x1'));var path=require(_0x6d69('0x2'));var express=require(_0x6d69('0x3'));var router=express['Router']();var auth=require(_0x6d69('0x4'));var controller=require(_0x6d69('0x5'));router[_0x6d69('0x6')](_0x6d69('0x7'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x9')]);router['get'](_0x6d69('0xa'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router[_0x6d69('0x6')](_0x6d69('0xb'),auth[_0x6d69('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x6d69('0x6')](_0x6d69('0xc'),auth[_0x6d69('0x8')](),controller[_0x6d69('0xd')]);router[_0x6d69('0x6')](_0x6d69('0xe'),auth[_0x6d69('0x8')](),controller[_0x6d69('0xf')]);router['get'](_0x6d69('0x10'),auth[_0x6d69('0x8')](),controller['mailQueues']);router[_0x6d69('0x6')]('/mail/accounts',auth['isAuthenticated'](),controller[_0x6d69('0x11')]);router['get'](_0x6d69('0x12'),auth['isAuthenticated'](),controller[_0x6d69('0x13')]);router[_0x6d69('0x6')](_0x6d69('0x14'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x15')]);router['get'](_0x6d69('0x16'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x17')]);router['get']('/fax/queues',auth['isAuthenticated'](),controller[_0x6d69('0x18')]);router['get'](_0x6d69('0x19'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x1a')]);router['get'](_0x6d69('0x1b'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x1c')]);router['get'](_0x6d69('0x1d'),auth['isAuthenticated'](),controller[_0x6d69('0x1e')]);router['get'](_0x6d69('0x1f'),auth[_0x6d69('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x6d69('0x6')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0x6d69('0x8')](),controller[_0x6d69('0x20')]);router['get'](_0x6d69('0x21'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x6d69('0x22')](_0x6d69('0x21'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x23')]);router[_0x6d69('0x6')](_0x6d69('0x24'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x25')]);router[_0x6d69('0x6')](_0x6d69('0x26'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x27')]);router[_0x6d69('0x6')](_0x6d69('0x28'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x29')]);router[_0x6d69('0x22')](_0x6d69('0x2a'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x2b')]);router[_0x6d69('0x6')]('/telephones',auth[_0x6d69('0x8')](),controller[_0x6d69('0x2c')]);router[_0x6d69('0x6')](_0x6d69('0x2d'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x2e')]);router[_0x6d69('0x6')](_0x6d69('0x2f'),auth[_0x6d69('0x8')](),controller['campaigns']);router['get'](_0x6d69('0x30'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x31')]);router[_0x6d69('0x6')](_0x6d69('0x32'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x33')]);router[_0x6d69('0x6')](_0x6d69('0x34'),auth['isAuthenticated'](),controller[_0x6d69('0x35')]);router[_0x6d69('0x6')](_0x6d69('0x36'),auth['isAuthenticated'](),controller[_0x6d69('0x37')]);router[_0x6d69('0x6')]('/openchannel/queues/:id/waitinginteractions',auth[_0x6d69('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x6d69('0x6')]('/sms/queues/waitinginteractions',auth[_0x6d69('0x8')](),controller[_0x6d69('0x38')]);router['get']('/whatsapp/queues/waitinginteractions',auth[_0x6d69('0x8')](),controller[_0x6d69('0x39')]);router['get']('/fax/queues/waitinginteractions',auth[_0x6d69('0x8')](),controller[_0x6d69('0x3a')]);router[_0x6d69('0x3b')]('/mail/queues/:id/notify',auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x3d')));router['get'](_0x6d69('0x3e'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3f')]);router[_0x6d69('0x3b')](_0x6d69('0x40'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x41')));router['get'](_0x6d69('0x42'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x43')]);router[_0x6d69('0x3b')](_0x6d69('0x44'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x45')));router[_0x6d69('0x6')](_0x6d69('0x46'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x47')]);router[_0x6d69('0x3b')]('/openchannel/queues/:id/notify',auth[_0x6d69('0x8')](),controller['queueNotify']('openchannel'));router['get'](_0x6d69('0x48'),auth['isAuthenticated'](),controller[_0x6d69('0x49')]);router[_0x6d69('0x3b')](_0x6d69('0x4a'),auth['isAuthenticated'](),controller['queueNotify'](_0x6d69('0x4b')));router[_0x6d69('0x3b')](_0x6d69('0x4c'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x3c')](_0x6d69('0x4d')));router[_0x6d69('0x6')](_0x6d69('0x4e'),auth[_0x6d69('0x8')](),controller['showSmsQueues']);router[_0x6d69('0x6')](_0x6d69('0x4f'),auth[_0x6d69('0x8')](),controller[_0x6d69('0x50')]);router[_0x6d69('0x3b')]('/agents/:id/notify',auth[_0x6d69('0x8')](),controller[_0x6d69('0x51')]);module[_0x6d69('0x52')]=router; \ No newline at end of file +var _0xc160=['/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','showVoiceQueues','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','telephones','/trunks','trunks','/campaigns','/fax/accounts','/chat/queues/waitinginteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','/mail/queues/:id','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','showFaxQueues','post','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','util','path','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','/whatsapp/queues','whatsappQueues','faxQueues'];(function(_0xcc10aa,_0x10907c){var _0x3350f7=function(_0x26f5c1){while(--_0x26f5c1){_0xcc10aa['push'](_0xcc10aa['shift']());}};_0x3350f7(++_0x10907c);}(_0xc160,0xd5));var _0x0c16=function(_0x257017,_0x330627){_0x257017=_0x257017-0x0;var _0x38536d=_0xc160[_0x257017];return _0x38536d;};'use strict';var multer=require(_0x0c16('0x0'));var util=require(_0x0c16('0x1'));var path=require(_0x0c16('0x2'));var express=require('express');var router=express[_0x0c16('0x3')]();var auth=require(_0x0c16('0x4'));var controller=require(_0x0c16('0x5'));router[_0x0c16('0x6')](_0x0c16('0x7'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x9')]);router[_0x0c16('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x0c16('0x8')](),controller[_0x0c16('0xa')]);router[_0x0c16('0x6')](_0x0c16('0xb'),auth[_0x0c16('0x8')](),controller[_0x0c16('0xc')]);router[_0x0c16('0x6')](_0x0c16('0xd'),auth[_0x0c16('0x8')](),controller[_0x0c16('0xe')]);router[_0x0c16('0x6')]('/chat/queues',auth[_0x0c16('0x8')](),controller[_0x0c16('0xf')]);router['get'](_0x0c16('0x10'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x11')]);router[_0x0c16('0x6')](_0x0c16('0x12'),auth['isAuthenticated'](),controller[_0x0c16('0x13')]);router[_0x0c16('0x6')](_0x0c16('0x14'),auth[_0x0c16('0x8')](),controller['openchannelQueues']);router[_0x0c16('0x6')]('/sms/queues',auth[_0x0c16('0x8')](),controller['smsQueues']);router[_0x0c16('0x6')](_0x0c16('0x15'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x16')]);router[_0x0c16('0x6')]('/fax/queues',auth[_0x0c16('0x8')](),controller[_0x0c16('0x17')]);router[_0x0c16('0x6')](_0x0c16('0x18'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x19')]);router[_0x0c16('0x6')](_0x0c16('0x1a'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x1b')]);router[_0x0c16('0x6')](_0x0c16('0x1c'),auth[_0x0c16('0x8')](),controller['voiceQueuesChannel']);router[_0x0c16('0x6')](_0x0c16('0x1d'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x1e')]);router[_0x0c16('0x6')](_0x0c16('0x1f'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x20')]);router[_0x0c16('0x6')]('/voice/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x21')]);router[_0x0c16('0x22')](_0x0c16('0x23'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x24')]);router[_0x0c16('0x6')](_0x0c16('0x25'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x26')]);router['get'](_0x0c16('0x27'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x28')]);router[_0x0c16('0x6')](_0x0c16('0x29'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x2a')]);router[_0x0c16('0x22')]('/agents/:id/capacity',auth[_0x0c16('0x8')](),controller[_0x0c16('0x2b')]);router[_0x0c16('0x6')]('/telephones',auth[_0x0c16('0x8')](),controller[_0x0c16('0x2c')]);router[_0x0c16('0x6')](_0x0c16('0x2d'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x2e')]);router[_0x0c16('0x6')](_0x0c16('0x2f'),auth['isAuthenticated'](),controller['campaigns']);router[_0x0c16('0x6')](_0x0c16('0x30'),auth[_0x0c16('0x8')](),controller['faxAccounts']);router[_0x0c16('0x6')](_0x0c16('0x31'),auth[_0x0c16('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x32'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x33')]);router[_0x0c16('0x6')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x34'),auth['isAuthenticated'](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x35'),auth[_0x0c16('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x0c16('0x6')](_0x0c16('0x36'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x37')]);router['get']('/fax/queues/waitinginteractions',auth[_0x0c16('0x8')](),controller[_0x0c16('0x38')]);router['post']('/mail/queues/:id/notify',auth[_0x0c16('0x8')](),controller['queueNotify']('mail'));router[_0x0c16('0x6')](_0x0c16('0x39'),auth[_0x0c16('0x8')](),controller['showMailQueues']);router['post'](_0x0c16('0x3a'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x3c')));router['get'](_0x0c16('0x3d'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3e')]);router['post'](_0x0c16('0x3f'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x40')));router[_0x0c16('0x6')]('/fax/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x41')]);router[_0x0c16('0x42')](_0x0c16('0x43'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x44')));router[_0x0c16('0x6')](_0x0c16('0x45'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x46')]);router['post'](_0x0c16('0x47'),auth[_0x0c16('0x8')](),controller[_0x0c16('0x3b')](_0x0c16('0x48')));router[_0x0c16('0x42')](_0x0c16('0x49'),auth[_0x0c16('0x8')](),controller['queueNotify'](_0x0c16('0x4a')));router[_0x0c16('0x6')]('/sms/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x4b')]);router[_0x0c16('0x6')]('/whatsapp/queues/:id',auth[_0x0c16('0x8')](),controller[_0x0c16('0x4c')]);router[_0x0c16('0x42')](_0x0c16('0x4d'),auth['isAuthenticated'](),controller[_0x0c16('0x4e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 45fefbe..4f22b2b 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(_0x199934,_0x4530da){var _0x25ae46=function(_0x36f9a1){while(--_0x36f9a1){_0x199934['push'](_0x199934['shift']());}};_0x25ae46(++_0x4530da);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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 _0xa9e0=['mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','filter','map','queue_id','uniq','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','queueNotify','chat','Website','Account','findOne','\x20Queue\x20not\x20found','Message','Interaction','\x20Message\x20not\x20found','MessageId','InteractionId','From','QueueId','create','Start','queue','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','messageId','update','bluebird','moment','lodash','../../config/logger','jayson/promise','client','http','then','error','code','catch','status','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','showVoiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','Agents','agentCapacity','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','INTERACTION','interface','SIP/%s','agent','internal','AgentCapacity','telephones','Telephones','Trunks','campaigns','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var BPromise=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0a9e('0x3'))('api');var jayson=require(_0x0a9e('0x4'));var amiClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232a});var mailClient=jayson[_0x0a9e('0x5')][_0x0a9e('0x6')]({'port':0x232b});var routingClient=jayson['client'][_0x0a9e('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){var _0x56465b=_0x5f41ea?_0x5f41ea:amiClient;return _0x56465b['request'](_0x441e3a,_0x2cc193)[_0x0a9e('0x7')](function(_0xf81284){if(_0xf81284[_0x0a9e('0x8')]){if(_0xf81284[_0x0a9e('0x8')][_0x0a9e('0x9')]===0x1f4){return _0xe42b77(_0xf81284[_0x0a9e('0x8')]['message']);}return _0x503809(_0xf81284['error']['message']);}else{_0x503809(_0xf81284['result']);}})[_0x0a9e('0xa')](function(_0x36471c){_0xe42b77(_0x36471c);});});}function respondWithResult(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xc8;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0xb')](_0x26d672)['json'](_0x32d742);}return _0xd5b662[_0x0a9e('0xc')](0x194);};}function handleError(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0x1f4;return function(_0x281129){logger[_0x0a9e('0x8')](_0x281129[_0x0a9e('0xd')]);if(_0x281129['name']){delete _0x281129[_0x0a9e('0xe')];}_0x239b12['status'](_0x2b4227)[_0x0a9e('0xf')](_0x281129);};}function findById(_0x519dfd){return function(_0x16033c){if(!_[_0x0a9e('0x10')](_0x519dfd)&&!_['isNil'](_0x16033c)&&!_[_0x0a9e('0x10')](_0x16033c['rows'])){return _[_0x0a9e('0x11')](_0x16033c[_0x0a9e('0x12')],function(_0x106033){return _0x106033['id']==_0x519dfd;});}return null;};}exports[_0x0a9e('0x13')]=function(_0x31b1ca,_0x2eb11f){return respondWithRpcPromise(_0x0a9e('0x14'),_0x31b1ca[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x2eb11f,null))[_0x0a9e('0xa')](handleError(_0x2eb11f,null));};exports[_0x0a9e('0x16')]=function(_0x105080,_0x4bb1e3){return respondWithRpcPromise(_0x0a9e('0x17'),_[_0x0a9e('0x18')](_0x105080['query'],_0x105080[_0x0a9e('0x19')]))['then'](respondWithResult(_0x4bb1e3,null))['catch'](handleError(_0x4bb1e3,null));};exports[_0x0a9e('0x1a')]=function(_0x432e56,_0x38e7c4){return respondWithRpcPromise(_0x0a9e('0x1b'),_['merge'](_0x432e56[_0x0a9e('0x15')],_0x432e56[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x38e7c4,null))[_0x0a9e('0xa')](handleError(_0x38e7c4,null));};exports[_0x0a9e('0x1c')]=function(_0x42ac8f,_0x16b1ca){return respondWithRpcPromise('VoiceQueues',_0x42ac8f['query'])[_0x0a9e('0x7')](respondWithResult(_0x16b1ca,null))[_0x0a9e('0xa')](handleError(_0x16b1ca,null));};exports[_0x0a9e('0x1d')]=function(_0x33161b,_0x526cf3){return respondWithRpcPromise(_0x0a9e('0x1e'),_0x33161b['query'])[_0x0a9e('0x7')](findById(_0x33161b['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x526cf3,null))[_0x0a9e('0xa')](handleError(_0x526cf3,null));};exports[_0x0a9e('0x1f')]=function(_0x14433c,_0x140511){return respondWithRpcPromise(_0x0a9e('0x20'),_[_0x0a9e('0x18')](_0x14433c[_0x0a9e('0x21')],_0x14433c['params']))[_0x0a9e('0x7')](respondWithResult(_0x140511,null))[_0x0a9e('0xa')](handleError(_0x140511,null));};exports[_0x0a9e('0x22')]=function(_0x2ec755,_0x5c877d){return respondWithRpcPromise(_0x0a9e('0x23'),_[_0x0a9e('0x18')](_0x2ec755[_0x0a9e('0x15')],_0x2ec755[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x5c877d,null))[_0x0a9e('0xa')](handleError(_0x5c877d,null));};exports[_0x0a9e('0x24')]=function(_0x2e8759,_0x1dbde2){return respondWithRpcPromise('VoiceQueuesChannels',_0x2e8759[_0x0a9e('0x15')])['then'](respondWithResult(_0x1dbde2,null))[_0x0a9e('0xa')](handleError(_0x1dbde2,null));};exports[_0x0a9e('0x25')]=function(_0x1122db,_0x33bdb7){return respondWithRpcPromise(_0x0a9e('0x26'),_['merge'](_0x1122db[_0x0a9e('0x15')],_0x1122db[_0x0a9e('0x19')]))[_0x0a9e('0x7')](respondWithResult(_0x33bdb7,null))[_0x0a9e('0xa')](handleError(_0x33bdb7,null));};exports[_0x0a9e('0x27')]=function(_0x409319,_0x332d35){return respondWithRpcPromise(_0x0a9e('0x28'),_['merge'](_0x409319[_0x0a9e('0x15')],_0x409319['params']))[_0x0a9e('0x7')](respondWithResult(_0x332d35,null))[_0x0a9e('0xa')](handleError(_0x332d35,null));};exports[_0x0a9e('0x29')]=function(_0x3f3d41,_0x567193){return respondWithRpcPromise(_0x0a9e('0x2a'),_[_0x0a9e('0x18')](_0x3f3d41[_0x0a9e('0x15')],_0x3f3d41[_0x0a9e('0x19')]))['then'](respondWithResult(_0x567193,null))['catch'](handleError(_0x567193,null));};exports[_0x0a9e('0x2b')]=function(_0x5640eb,_0x24936a){return respondWithRpcPromise(_0x0a9e('0x2c'),_0x5640eb[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x24936a,null))['catch'](handleError(_0x24936a,null));};exports[_0x0a9e('0x2d')]=function(_0x3bfce8,_0x3cae){return respondWithRpcPromise('OutboundChannels',_0x3bfce8[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x3cae,null))[_0x0a9e('0xa')](handleError(_0x3cae,null));};exports['agents']=function(_0x546ef8,_0x11b61d){var _0x40d766;return respondWithRpcPromise('Agents',_0x546ef8[_0x0a9e('0x15')])[_0x0a9e('0x7')](function(_0x2e1b3a){_0x40d766=_0x2e1b3a;return respondWithRpcPromise(_0x0a9e('0x2e'),_0x546ef8['query'],routingClient);})['then'](function(_0x15e37d){return _[_0x0a9e('0x18')]({},_0x15e37d,_0x40d766);})['then'](respondWithResult(_0x11b61d,null))[_0x0a9e('0xa')](handleError(_0x11b61d,null));};exports[_0x0a9e('0x2f')]=function(_0x1459bb,_0x5b4f5e){if(_0x1459bb[_0x0a9e('0x21')]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]&&_0x1459bb[_0x0a9e('0x31')]&&_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0xe')]){for(var _0x2881b3 in _0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')]){if(_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x0a9e('0x32')](_0x2881b3)){db[_0x0a9e('0x33')][_0x0a9e('0x34')]({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':'INTERACTION','exitAt':null,'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]&&_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')]?{'$notIn':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3]}:{'$ne':null}}})[_0x0a9e('0x7')](function(_0x432fcc){var _0x25c6e6=moment()[_0x0a9e('0x36')](_0x0a9e('0x37'));for(var _0x5026aa=0x0,_0x117c99=_0x432fcc[_0x0a9e('0x35')];_0x5026aa<_0x117c99;_0x5026aa+=0x1){_0x432fcc[_0x5026aa][_0x0a9e('0x38')]({'exitAt':_0x25c6e6});}});for(var _0xfbd5ad=0x0;_0xfbd5ad<_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0x0a9e('0x35')];_0xfbd5ad+=0x1){db[_0x0a9e('0x33')]['findOrCreate']({'where':{'channel':_0x2881b3,'membername':_0x1459bb[_0x0a9e('0x31')]['name'],'type':_0x0a9e('0x39'),'uniqueid':_0x1459bb[_0x0a9e('0x21')][_0x0a9e('0x30')][_0x2881b3][_0xfbd5ad],'exitAt':null},'defaults':{'channel':_0x2881b3,'membername':_0x1459bb['user'][_0x0a9e('0xe')],'interface':_[_0x0a9e('0x10')](_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')])?util[_0x0a9e('0x36')](_0x0a9e('0x3b'),_0x1459bb[_0x0a9e('0x31')]['name']):_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3a')],'type':_0x0a9e('0x39'),'enterAt':moment()[_0x0a9e('0x36')](_0x0a9e('0x37')),'role':_0x0a9e('0x3c'),'internal':_0x1459bb[_0x0a9e('0x31')][_0x0a9e('0x3d')],'uniqueid':_0x1459bb[_0x0a9e('0x21')]['interaction'][_0x2881b3][_0xfbd5ad]}});}}}}return respondWithRpcPromise(_0x0a9e('0x3e'),{'id':_0x1459bb[_0x0a9e('0x19')]['id'],'capacity':_0x1459bb['body']['capacity']},routingClient)['then'](respondWithResult(_0x5b4f5e,null))[_0x0a9e('0xa')](handleError(_0x5b4f5e,null));};exports[_0x0a9e('0x3f')]=function(_0x37edaa,_0x11545a){return respondWithRpcPromise(_0x0a9e('0x40'),_0x37edaa[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x11545a,null))[_0x0a9e('0xa')](handleError(_0x11545a,null));};exports['trunks']=function(_0x4b1b9f,_0x53975a){return respondWithRpcPromise(_0x0a9e('0x41'),_0x4b1b9f[_0x0a9e('0x15')])[_0x0a9e('0x7')](respondWithResult(_0x53975a,null))['catch'](handleError(_0x53975a,null));};exports[_0x0a9e('0x42')]=function(_0x161aa7,_0x53d113){return respondWithRpcPromise('Campaigns',_0x161aa7[_0x0a9e('0x15')])['then'](respondWithResult(_0x53d113,null))[_0x0a9e('0xa')](handleError(_0x53d113,null));};exports['chatQueues']=function(_0x2e5e62,_0x3c20b2){return respondWithRpcPromise(_0x0a9e('0x43'),_0x2e5e62['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x3c20b2,null))[_0x0a9e('0xa')](handleError(_0x3c20b2,null));};exports['showChatQueues']=function(_0x50f687,_0x128aa6){return respondWithRpcPromise(_0x0a9e('0x43'),_0x50f687['query'],routingClient)[_0x0a9e('0x7')](findById(_0x50f687['params']['id']))[_0x0a9e('0x7')](respondWithResult(_0x128aa6,null))['catch'](handleError(_0x128aa6,null));};exports[_0x0a9e('0x44')]=function(_0x4a6deb,_0x5da27d){return respondWithRpcPromise('MailQueues',_0x4a6deb[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x5da27d,null))[_0x0a9e('0xa')](handleError(_0x5da27d,null));};exports[_0x0a9e('0x45')]=function(_0x3cfd00,_0x19b4df){return respondWithRpcPromise(_0x0a9e('0x46'),_0x3cfd00[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x3cfd00[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x19b4df,null))[_0x0a9e('0xa')](handleError(_0x19b4df,null));};exports[_0x0a9e('0x47')]=function(_0x2642bb,_0x30c491){return respondWithRpcPromise(_0x0a9e('0x48'),_0x2642bb[_0x0a9e('0x15')],mailClient)['then'](respondWithResult(_0x30c491,null))[_0x0a9e('0xa')](handleError(_0x30c491,null));};exports[_0x0a9e('0x49')]=function(_0x5239ef,_0x3649cc){return respondWithRpcPromise('OpenchannelQueues',_0x5239ef[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x3649cc,null))['catch'](handleError(_0x3649cc,null));};exports['showOpenchannelQueues']=function(_0x273cb5,_0x49d231){return respondWithRpcPromise(_0x0a9e('0x4a'),_0x273cb5[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x273cb5[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x49d231,null))[_0x0a9e('0xa')](handleError(_0x49d231,null));};exports['smsQueues']=function(_0x1627a7,_0x5854cc){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x1627a7[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5854cc,null))['catch'](handleError(_0x5854cc,null));};exports[_0x0a9e('0x4c')]=function(_0x156f1c,_0x119677){return respondWithRpcPromise(_0x0a9e('0x4b'),_0x156f1c['query'],routingClient)[_0x0a9e('0x7')](findById(_0x156f1c[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x119677,null))[_0x0a9e('0xa')](handleError(_0x119677,null));};exports[_0x0a9e('0x4d')]=function(_0x88dcbf,_0x409b29){return respondWithRpcPromise(_0x0a9e('0x4e'),_0x88dcbf['query'],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x409b29,null))[_0x0a9e('0xa')](handleError(_0x409b29,null));};exports[_0x0a9e('0x4f')]=function(_0x47bb43,_0x3528b7){return respondWithRpcPromise('WhatsappQueues',_0x47bb43['query'],routingClient)[_0x0a9e('0x7')](findById(_0x47bb43[_0x0a9e('0x19')]['id']))[_0x0a9e('0x7')](respondWithResult(_0x3528b7,null))[_0x0a9e('0xa')](handleError(_0x3528b7,null));};exports[_0x0a9e('0x50')]=function(_0xc8c264,_0x387489){return respondWithRpcPromise(_0x0a9e('0x51'),_0xc8c264[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x387489,null))[_0x0a9e('0xa')](handleError(_0x387489,null));};exports[_0x0a9e('0x52')]=function(_0x2bbb86,_0x2b8192){return respondWithRpcPromise(_0x0a9e('0x51'),_0x2bbb86[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](findById(_0x2bbb86[_0x0a9e('0x19')]['id']))['then'](respondWithResult(_0x2b8192,null))[_0x0a9e('0xa')](handleError(_0x2b8192,null));};exports[_0x0a9e('0x53')]=function(_0x243d12,_0x4edbb0){return respondWithRpcPromise(_0x0a9e('0x54'),_0x243d12[_0x0a9e('0x15')])['then'](respondWithResult(_0x4edbb0,null))[_0x0a9e('0xa')](handleError(_0x4edbb0,null));};exports[_0x0a9e('0x55')]=function(_0x3ef315,_0x427946){return respondWithRpcPromise(_0x0a9e('0x56'),_0x3ef315['query'],routingClient)['then'](respondWithResult(_0x427946,null))['catch'](handleError(_0x427946,null));};exports[_0x0a9e('0x57')]=function(_0x18bf5d,_0x1104ad){return respondWithRpcPromise(_0x0a9e('0x58'),_0x18bf5d[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x1104ad,null))[_0x0a9e('0xa')](handleError(_0x1104ad,null));};exports[_0x0a9e('0x59')]=function(_0x5512d1,_0x235f8f){return respondWithRpcPromise(_0x0a9e('0x5a'),_0x5512d1[_0x0a9e('0x15')],routingClient)['then'](respondWithResult(_0x235f8f,null))[_0x0a9e('0xa')](handleError(_0x235f8f,null));};exports['openchannelQueuesIdWaitingInteractions']=function(_0x4437ff,_0x44351d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x4437ff[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](function(_0x2cc7a7){if(_0x4437ff[_0x0a9e('0x15')]['type']!==undefined){var _0x1d442c=_(_0x2cc7a7[_0x0a9e('0x12')])[_0x0a9e('0x5b')]([_0x4437ff[_0x0a9e('0x15')]['type'],_0x4437ff[_0x0a9e('0x19')]['id']])[_0x0a9e('0x5c')](_0x0a9e('0x5d'))[_0x0a9e('0x5e')]()['value']();return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x30a4c7){return _0x1d442c[_0x0a9e('0x5f')](_0x30a4c7[_0x0a9e('0x5d')])>-0x1;});}else{return _0x2cc7a7[_0x0a9e('0x12')][_0x0a9e('0x5b')](function(_0x3df0e3){return _0x3df0e3[_0x0a9e('0x5d')]===parseInt(_0x4437ff[_0x0a9e('0x19')]['id']);});}})[_0x0a9e('0x7')](respondWithResult(_0x44351d,null))[_0x0a9e('0xa')](handleError(_0x44351d,null));};exports[_0x0a9e('0x60')]=function(_0xe0749e,_0x5b35db){return respondWithRpcPromise(_0x0a9e('0x61'),_0xe0749e[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x5b35db,null))['catch'](handleError(_0x5b35db,null));};exports[_0x0a9e('0x62')]=function(_0x33dda0,_0x8cea96){return respondWithRpcPromise(_0x0a9e('0x63'),_0x33dda0['query'],routingClient)['then'](respondWithResult(_0x8cea96,null))[_0x0a9e('0xa')](handleError(_0x8cea96,null));};exports[_0x0a9e('0x64')]=function(_0x4c54fa,_0x45108c){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x4c54fa[_0x0a9e('0x15')],routingClient)[_0x0a9e('0x7')](respondWithResult(_0x45108c,null))['catch'](handleError(_0x45108c,null));};exports[_0x0a9e('0x65')]=function(_0x41cf12){return function(_0x2d2286,_0x42b959){var _0x3755fe,_0x1f42a0;var _0x444f1f=_['capitalize'](_0x41cf12);var _0x2973d3=_0x41cf12===_0x0a9e('0x66')?_0x0a9e('0x67'):_0x0a9e('0x68');return db[_0x444f1f+'Queue'][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2d2286[_0x0a9e('0x19')]['id']}})['then'](function(_0x1d6834){if(_['isNil'](_0x1d6834)){throw new Error(_0x444f1f+_0x0a9e('0x6a'));}_0x3755fe=_0x1d6834;return db[_0x444f1f+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2d2286[_0x0a9e('0x21')]['messageId']},'include':[{'model':db[_0x444f1f+'Interaction'],'as':_0x0a9e('0x6c')},{'model':db[_0x444f1f+_0x2973d3],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x5ac73d){if(_[_0x0a9e('0x10')](_0x5ac73d)){throw new Error(_0x444f1f+_0x0a9e('0x6d'));}_0x1f42a0=_0x5ac73d;return _0x5ac73d['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0xf0a802={'uniqueid':_0x41cf12+'.'+_0x1f42a0['id']+'.'+_0x1f42a0['Interaction']['id'],'FromUserId':_0x2d2286['user']['id'],'type':'queue'};_0xf0a802[_0x444f1f+_0x0a9e('0x6e')]=_0x1f42a0['id'];_0xf0a802[_0x444f1f+_0x0a9e('0x6f')]=_0x1f42a0[_0x0a9e('0x6c')]['id'];_0xf0a802[_0x0a9e('0x70')+_0x444f1f+_0x2973d3+'Id']=_0x1f42a0[_0x0a9e('0x68')]['id'];_0xf0a802['To'+_0x444f1f+_0x0a9e('0x71')]=_0x3755fe['id'];return db[_0x444f1f+'TransferReport'][_0x0a9e('0x72')](_0xf0a802);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x41cf12,'interaction':_0x1f42a0[_0x0a9e('0x6c')],'message':_0x1f42a0,'account':_0x1f42a0[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x74'),'appdata':_0x3755fe['name']+','+(_0x1f42a0[_0x0a9e('0x68')][_0x0a9e('0x75')]||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x42b959,null))[_0x0a9e('0xa')](handleError(_0x42b959,null));};};exports[_0x0a9e('0x77')]=function(_0x2a563d,_0x22063c){var _0x255e49,_0x1910bf;if(_[_0x0a9e('0x10')](_0x2a563d[_0x0a9e('0x21')]['channel'])){throw new Error(_0x0a9e('0x78'));}var _0x3325c5=_0x2a563d['body'][_0x0a9e('0x79')];var _0x982340=_[_0x0a9e('0x7a')](_0x3325c5);var _0x5a26c8=_0x3325c5===_0x0a9e('0x66')?'Website':_0x0a9e('0x68');return db[_0x0a9e('0x7b')][_0x0a9e('0x69')]({'raw':!![],'where':{'id':_0x2a563d[_0x0a9e('0x19')]['id'],'role':_0x0a9e('0x3c')}})[_0x0a9e('0x7')](function(_0x16a039){if(_[_0x0a9e('0x10')](_0x16a039)){throw new Error('Agent\x20not\x20found');}_0x255e49=_0x16a039;return db[_0x982340+_0x0a9e('0x6b')][_0x0a9e('0x69')]({'where':{'id':_0x2a563d[_0x0a9e('0x21')][_0x0a9e('0x7c')]},'include':[{'model':db[_0x982340+_0x0a9e('0x6c')],'as':_0x0a9e('0x6c')},{'model':db[_0x982340+_0x5a26c8],'as':_0x0a9e('0x68')}]});})[_0x0a9e('0x7')](function(_0x1808ba){if(_[_0x0a9e('0x10')](_0x1808ba)){throw new Error(_0x982340+_0x0a9e('0x6d'));}_0x1910bf=_0x1808ba;return _0x1808ba[_0x0a9e('0x7d')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0a9e('0x7')](function(){var _0x4989f9={'uniqueid':_0x3325c5+'.'+_0x1910bf['id']+'.'+_0x1910bf[_0x0a9e('0x6c')]['id'],'FromUserId':_0x2a563d[_0x0a9e('0x31')]['id'],'type':_0x0a9e('0x3c'),'ToUserId':_0x255e49['id']};_0x4989f9[_0x982340+_0x0a9e('0x6e')]=_0x1910bf['id'];_0x4989f9[_0x982340+_0x0a9e('0x6f')]=_0x1910bf['Interaction']['id'];_0x4989f9[_0x0a9e('0x70')+_0x982340+_0x5a26c8+'Id']=_0x1910bf[_0x0a9e('0x68')]['id'];return db[_0x982340+'TransferReport'][_0x0a9e('0x72')](_0x4989f9);})['then'](function(){return respondWithRpcPromise(_0x0a9e('0x73'),{'channel':_0x3325c5,'interaction':_0x1910bf[_0x0a9e('0x6c')],'message':_0x1910bf,'account':_0x1910bf[_0x0a9e('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0x0a9e('0x3c'),'appdata':_0x255e49['name']+','+(_0x1910bf[_0x0a9e('0x68')]['agentTransferTimeout']||0x12c),'interval':_0x0a9e('0x76')}],'transfer':!![]},routingClient);})[_0x0a9e('0x7')](respondWithResult(_0x22063c,null))['catch'](handleError(_0x22063c,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 3ea4b55..76fc428 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 _0xecc2=['/:id/run','run','create','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3ba347,_0x461aa0){var _0x3295e7=function(_0x4bb537){while(--_0x4bb537){_0x3ba347['push'](_0x3ba347['shift']());}};_0x3295e7(++_0x461aa0);}(_0xecc2,0xcf));var _0x2ecc=function(_0x524f0e,_0x2e6801){_0x524f0e=_0x524f0e-0x0;var _0x630076=_0xecc2[_0x524f0e];return _0x630076;};'use strict';var multer=require('multer');var util=require(_0x2ecc('0x0'));var path=require(_0x2ecc('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2ecc('0x2')]();var fs_extra=require(_0x2ecc('0x3'));var auth=require(_0x2ecc('0x4'));var interaction=require(_0x2ecc('0x5'));var config=require(_0x2ecc('0x6'));var controller=require(_0x2ecc('0x7'));router[_0x2ecc('0x8')]('/',auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xa')]);router[_0x2ecc('0x8')](_0x2ecc('0xb'),auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xc')]);router[_0x2ecc('0x8')](_0x2ecc('0xd'),auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xe')]);router['post']('/',auth[_0x2ecc('0x9')](),controller[_0x2ecc('0xf')]);router[_0x2ecc('0x10')](_0x2ecc('0xb'),auth[_0x2ecc('0x9')](),controller[_0x2ecc('0x11')]);router[_0x2ecc('0x12')](_0x2ecc('0xb'),auth[_0x2ecc('0x9')](),controller['destroy']);module[_0x2ecc('0x13')]=router; \ No newline at end of file +var _0xda18=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','update','delete','destroy'];(function(_0x4db810,_0x1d17b5){var _0x5bdc23=function(_0x365416){while(--_0x365416){_0x4db810['push'](_0x4db810['shift']());}};_0x5bdc23(++_0x1d17b5);}(_0xda18,0x7f));var _0x8da1=function(_0x11a3f5,_0x56ceff){_0x11a3f5=_0x11a3f5-0x0;var _0x39333a=_0xda18[_0x11a3f5];return _0x39333a;};'use strict';var multer=require(_0x8da1('0x0'));var util=require(_0x8da1('0x1'));var path=require(_0x8da1('0x2'));var timeout=require(_0x8da1('0x3'));var express=require(_0x8da1('0x4'));var router=express[_0x8da1('0x5')]();var fs_extra=require(_0x8da1('0x6'));var auth=require(_0x8da1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8da1('0x8'));var controller=require('./schedule.controller');router[_0x8da1('0x9')]('/',auth[_0x8da1('0xa')](),controller[_0x8da1('0xb')]);router[_0x8da1('0x9')](_0x8da1('0xc'),auth['isAuthenticated'](),controller[_0x8da1('0xd')]);router[_0x8da1('0x9')]('/:id/run',auth['isAuthenticated'](),controller['run']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x8da1('0xc'),auth['isAuthenticated'](),controller[_0x8da1('0xe')]);router[_0x8da1('0xf')](_0x8da1('0xc'),auth[_0x8da1('0xa')](),controller[_0x8da1('0x10')]);module[_0x8da1('0x11')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 57dbc68..1c06078 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 _0x2a2d=['BOOLEAN','TEXT','sequelize','exports','STRING','0\x200\x20*\x20*\x20*','DATE','ENUM','years','quarters','months','weeks','days','hours','csv','pdf','xlsx','default','custom'];(function(_0x54d41f,_0x7dd88a){var _0x523ed6=function(_0x2a1b9c){while(--_0x2a1b9c){_0x54d41f['push'](_0x54d41f['shift']());}};_0x523ed6(++_0x7dd88a);}(_0x2a2d,0x74));var _0xd2a2=function(_0x3e80e5,_0x5ba461){_0x3e80e5=_0x3e80e5-0x0;var _0x43a128=_0x2a2d[_0x3e80e5];return _0x43a128;};'use strict';var Sequelize=require(_0xd2a2('0x0'));module[_0xd2a2('0x1')]={'name':{'type':Sequelize[_0xd2a2('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd2a2('0x2')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xd2a2('0x2')],'allowNull':![],'defaultValue':_0xd2a2('0x3')},'startAt':{'type':Sequelize[_0xd2a2('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xd2a2('0x5')](_0xd2a2('0x6'),_0xd2a2('0x7'),_0xd2a2('0x8'),_0xd2a2('0x9'),_0xd2a2('0xa'),_0xd2a2('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xd2a2('0xa')},'output':{'type':Sequelize[_0xd2a2('0x5')](_0xd2a2('0xc'),_0xd2a2('0xd'),_0xd2a2('0xe')),'allowNull':![],'defaultValue':_0xd2a2('0xc')},'type':{'type':Sequelize[_0xd2a2('0x5')]('custom',_0xd2a2('0xf')),'allowNull':![],'defaultValue':_0xd2a2('0x10')},'sendMail':{'type':Sequelize[_0xd2a2('0x11')],'defaultValue':![]},'email':{'type':Sequelize[_0xd2a2('0x2')]},'cc':{'type':Sequelize[_0xd2a2('0x12')]},'bcc':{'type':Sequelize[_0xd2a2('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xd2a2('0x11')],'defaultValue':!![]}}; \ No newline at end of file +var _0xba80=['STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','years','quarters','months','weeks','days','hours','ENUM','csv','pdf','xlsx','custom','default','TEXT','sequelize'];(function(_0x1ba7ea,_0x833388){var _0x37a816=function(_0x129e3f){while(--_0x129e3f){_0x1ba7ea['push'](_0x1ba7ea['shift']());}};_0x37a816(++_0x833388);}(_0xba80,0xa1));var _0x0ba8=function(_0x6d18be,_0x2cdf00){_0x6d18be=_0x6d18be-0x0;var _0x24931a=_0xba80[_0x6d18be];return _0x24931a;};'use strict';var Sequelize=require(_0x0ba8('0x0'));module['exports']={'name':{'type':Sequelize[_0x0ba8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0ba8('0x1')]},'active':{'type':Sequelize[_0x0ba8('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x0ba8('0x1')],'allowNull':![],'defaultValue':_0x0ba8('0x3')},'startAt':{'type':Sequelize[_0x0ba8('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0x0ba8('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize['ENUM'](_0x0ba8('0x5'),_0x0ba8('0x6'),_0x0ba8('0x7'),_0x0ba8('0x8'),_0x0ba8('0x9'),_0x0ba8('0xa'),'minutes'),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0x0ba8('0xb')](_0x0ba8('0xc'),_0x0ba8('0xd'),_0x0ba8('0xe')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x0ba8('0xb')](_0x0ba8('0xf'),_0x0ba8('0x10')),'allowNull':![],'defaultValue':_0x0ba8('0xf')},'sendMail':{'type':Sequelize[_0x0ba8('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x0ba8('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x0ba8('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x0ba8('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index c8f5637..081b4a9 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 _0x9359=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','Schedule','findAll','rows','catch','params','includeAll','find','create','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','run','../../config/schedule','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis'];(function(_0x5224b4,_0x4b3811){var _0x544f3b=function(_0x3e5d89){while(--_0x3e5d89){_0x5224b4['push'](_0x5224b4['shift']());}};_0x544f3b(++_0x4b3811);}(_0x9359,0xe7));var _0x9935=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x9359[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x9935('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9935('0x1'));var jsonpatch=require(_0x9935('0x2'));var rp=require(_0x9935('0x3'));var moment=require(_0x9935('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9935('0x5'));var util=require('util');var path=require(_0x9935('0x6'));var sox=require('sox');var csv=require(_0x9935('0x7'));var ejs=require(_0x9935('0x8'));var fs=require('fs');var fs_extra=require(_0x9935('0x9'));var _=require(_0x9935('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9935('0xb'));var deskjs=require(_0x9935('0xc'));var toCsv=require(_0x9935('0x7'));var querystring=require('querystring');var Papa=require(_0x9935('0xd'));var Redis=require(_0x9935('0xe'));var authService=require(_0x9935('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x9935('0x10'));var hardwareService=require(_0x9935('0x11'));var logger=require(_0x9935('0x12'))(_0x9935('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9935('0x14'));var db=require(_0x9935('0x15'))['db'];function respondWithStatusCode(_0xb9a73b,_0x3ee375){_0x3ee375=_0x3ee375||0xcc;return function(_0x54a23f){if(_0x54a23f){return _0xb9a73b['sendStatus'](_0x3ee375);}return _0xb9a73b[_0x9935('0x16')](_0x3ee375)[_0x9935('0x17')]();};}function respondWithResult(_0x589712,_0x56eeb1){_0x56eeb1=_0x56eeb1||0xc8;return function(_0x3da725){if(_0x3da725){return _0x589712[_0x9935('0x16')](_0x56eeb1)[_0x9935('0x18')](_0x3da725);}};}function respondWithFilteredResult(_0x3c8782,_0x53827e){return function(_0x3bd9b7){if(_0x3bd9b7){var _0x351116=typeof _0x53827e[_0x9935('0x19')]===_0x9935('0x1a')&&typeof _0x53827e[_0x9935('0x1b')]===_0x9935('0x1a');var _0x221cc2=_0x3bd9b7['count'];var _0x4306ae=_0x351116?0x0:_0x53827e['offset'];var _0x447af1=_0x351116?_0x3bd9b7[_0x9935('0x1c')]:_0x53827e[_0x9935('0x19')]+_0x53827e[_0x9935('0x1b')];var _0x39f1fb;if(_0x447af1>=_0x221cc2){_0x447af1=_0x221cc2;_0x39f1fb=0xc8;}else{_0x39f1fb=0xce;}_0x3c8782['status'](_0x39f1fb);return _0x3c8782[_0x9935('0x1d')](_0x9935('0x1e'),_0x4306ae+'-'+_0x447af1+'/'+_0x221cc2)[_0x9935('0x18')](_0x3bd9b7);}return null;};}function patchUpdates(_0x151566){return function(_0x58af2a){try{jsonpatch[_0x9935('0x1f')](_0x58af2a,_0x151566,!![]);}catch(_0x3e98d7){return BPromise['reject'](_0x3e98d7);}return _0x58af2a['save']();};}function saveUpdates(_0x552b52,_0x2d9f14){return function(_0xe54db4){if(_0xe54db4){return _0xe54db4['update'](_0x552b52)[_0x9935('0x20')](function(_0x5da7df){return _0x5da7df;});}return null;};}function removeEntity(_0x3e6d02,_0x2c6eb2){return function(_0x54b78d){if(_0x54b78d){return _0x54b78d['destroy']()[_0x9935('0x20')](function(){var _0x3159a1=_0x54b78d[_0x9935('0x21')]({'plain':!![]});var _0x170cb7=_0x9935('0x22');return db[_0x9935('0x23')][_0x9935('0x24')]({'where':{'type':_0x170cb7,'resourceId':_0x3159a1['id']}})[_0x9935('0x20')](function(){return _0x54b78d;});})[_0x9935('0x20')](function(){_0x3e6d02[_0x9935('0x16')](0xcc)[_0x9935('0x17')]();});}};}function handleEntityNotFound(_0x129af7,_0x31dbcd){return function(_0x1aa711){if(!_0x1aa711){_0x129af7[_0x9935('0x25')](0x194);}return _0x1aa711;};}function handleError(_0x1a2792,_0x2cc383){_0x2cc383=_0x2cc383||0x1f4;return function(_0x12572d){logger[_0x9935('0x26')](_0x12572d[_0x9935('0x27')]);if(_0x12572d[_0x9935('0x28')]){delete _0x12572d[_0x9935('0x28')];}_0x1a2792[_0x9935('0x16')](_0x2cc383)[_0x9935('0x29')](_0x12572d);};}exports[_0x9935('0x2a')]=function(_0x957291,_0xb723d4){var _0x2c2424={},_0x429364={},_0x5a9906={'count':0x0,'rows':[]};var _0x4ca045=_[_0x9935('0x2b')](db['Schedule'][_0x9935('0x2c')],function(_0xb2b3d0){return{'name':_0xb2b3d0[_0x9935('0x2d')],'type':_0xb2b3d0[_0x9935('0x2e')][_0x9935('0x2f')]};});_0x429364['model']=_[_0x9935('0x2b')](_0x4ca045,'name');_0x429364[_0x9935('0x30')]=_['keys'](_0x957291[_0x9935('0x30')]);_0x429364[_0x9935('0x31')]=_[_0x9935('0x32')](_0x429364['model'],_0x429364[_0x9935('0x30')]);_0x2c2424[_0x9935('0x33')]=_[_0x9935('0x32')](_0x429364[_0x9935('0x34')],qs[_0x9935('0x35')](_0x957291[_0x9935('0x30')][_0x9935('0x35')]));_0x2c2424[_0x9935('0x33')]=_0x2c2424['attributes'][_0x9935('0x36')]?_0x2c2424['attributes']:_0x429364[_0x9935('0x34')];if(!_0x957291[_0x9935('0x30')][_0x9935('0x37')](_0x9935('0x38'))){_0x2c2424[_0x9935('0x1b')]=qs[_0x9935('0x1b')](_0x957291['query']['limit']);_0x2c2424[_0x9935('0x19')]=qs['offset'](_0x957291[_0x9935('0x30')][_0x9935('0x19')]);}_0x2c2424[_0x9935('0x39')]=qs['sort'](_0x957291['query'][_0x9935('0x3a')]);_0x2c2424[_0x9935('0x3b')]=qs[_0x9935('0x31')](_[_0x9935('0x3c')](_0x957291[_0x9935('0x30')],_0x429364[_0x9935('0x31')]),_0x4ca045);if(_0x957291['query']['filter']){_0x2c2424[_0x9935('0x3b')]=_['merge'](_0x2c2424['where'],{'$or':_[_0x9935('0x2b')](_0x4ca045,function(_0x4e940e){if(_0x4e940e['type']!=='VIRTUAL'){var _0x58005c={};_0x58005c[_0x4e940e[_0x9935('0x28')]]={'$like':'%'+_0x957291[_0x9935('0x30')][_0x9935('0x3d')]+'%'};return _0x58005c;}})});}_0x2c2424=_[_0x9935('0x3e')]({},_0x2c2424,_0x957291[_0x9935('0x3f')]);var _0x3a39c9={'where':_0x2c2424[_0x9935('0x3b')]};return db[_0x9935('0x40')]['count'](_0x3a39c9)['then'](function(_0x3d6957){_0x5a9906[_0x9935('0x1c')]=_0x3d6957;if(_0x957291[_0x9935('0x30')]['includeAll']){_0x2c2424['include']=[{'all':!![]}];}return db[_0x9935('0x40')][_0x9935('0x41')](_0x2c2424);})['then'](function(_0x189112){_0x5a9906[_0x9935('0x42')]=_0x189112;return _0x5a9906;})[_0x9935('0x20')](respondWithFilteredResult(_0xb723d4,_0x2c2424))[_0x9935('0x43')](handleError(_0xb723d4,null));};exports['show']=function(_0x1870a3,_0x14b68c){var _0x1dd943={'raw':![],'where':{'id':_0x1870a3[_0x9935('0x44')]['id']}},_0x497c48={};_0x497c48['model']=_['keys'](db['Schedule'][_0x9935('0x2c')]);_0x497c48[_0x9935('0x30')]=_['keys'](_0x1870a3[_0x9935('0x30')]);_0x497c48[_0x9935('0x31')]=_[_0x9935('0x32')](_0x497c48[_0x9935('0x34')],_0x497c48[_0x9935('0x30')]);_0x1dd943['attributes']=_[_0x9935('0x32')](_0x497c48[_0x9935('0x34')],qs['fields'](_0x1870a3[_0x9935('0x30')][_0x9935('0x35')]));_0x1dd943[_0x9935('0x33')]=_0x1dd943[_0x9935('0x33')][_0x9935('0x36')]?_0x1dd943['attributes']:_0x497c48[_0x9935('0x34')];if(_0x1870a3[_0x9935('0x30')][_0x9935('0x45')]){_0x1dd943['include']=[{'all':!![]}];}_0x1dd943=_[_0x9935('0x3e')]({},_0x1dd943,_0x1870a3[_0x9935('0x3f')]);return db[_0x9935('0x40')][_0x9935('0x46')](_0x1dd943)[_0x9935('0x20')](handleEntityNotFound(_0x14b68c,null))[_0x9935('0x20')](respondWithResult(_0x14b68c,null))[_0x9935('0x43')](handleError(_0x14b68c,null));};exports[_0x9935('0x47')]=function(_0x3c5005,_0x4d64ee){return db[_0x9935('0x40')][_0x9935('0x47')](_0x3c5005['body'],{})[_0x9935('0x20')](function(_0xed91c8){var _0x58bfc6=_0x3c5005[_0x9935('0x48')][_0x9935('0x21')]({'plain':!![]});if(!_0x58bfc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x58bfc6[_0x9935('0x49')]==='user'){var _0x54f523=_0xed91c8['get']({'plain':!![]});var _0x9db330=_0x9935('0x22');return db[_0x9935('0x4a')][_0x9935('0x46')]({'where':{'name':_0x9db330,'userProfileId':_0x58bfc6[_0x9935('0x4b')]},'raw':!![]})['then'](function(_0x3f229e){if(_0x3f229e&&_0x3f229e[_0x9935('0x4c')]===0x0){return db[_0x9935('0x23')][_0x9935('0x47')]({'name':_0x54f523[_0x9935('0x28')],'resourceId':_0x54f523['id'],'type':_0x3f229e['name'],'sectionId':_0x3f229e['id']},{})[_0x9935('0x20')](function(){return _0xed91c8;});}else{return _0xed91c8;}})['catch'](function(_0x40af11){logger[_0x9935('0x26')](_0x9935('0x4d'),_0x40af11);throw _0x40af11;});}return _0xed91c8;})[_0x9935('0x20')](respondWithResult(_0x4d64ee,0xc9))[_0x9935('0x43')](handleError(_0x4d64ee,null));};exports[_0x9935('0x4e')]=function(_0x224896,_0x44254d){if(_0x224896[_0x9935('0x4f')]['id']){delete _0x224896['body']['id'];}return db[_0x9935('0x40')][_0x9935('0x46')]({'where':{'id':_0x224896[_0x9935('0x44')]['id']}})[_0x9935('0x20')](handleEntityNotFound(_0x44254d,null))[_0x9935('0x20')](saveUpdates(_0x224896[_0x9935('0x4f')],null))[_0x9935('0x20')](respondWithResult(_0x44254d,null))['catch'](handleError(_0x44254d,null));};exports[_0x9935('0x24')]=function(_0x10a863,_0x55b4aa){return db[_0x9935('0x40')][_0x9935('0x46')]({'where':{'id':_0x10a863[_0x9935('0x44')]['id']}})[_0x9935('0x20')](handleEntityNotFound(_0x55b4aa,null))[_0x9935('0x20')](removeEntity(_0x55b4aa,null))['catch'](handleError(_0x55b4aa,null));};exports[_0x9935('0x50')]=function(_0x45cb7c,_0x3c022c,_0x66f104){var _0x3a6d59=require(_0x9935('0x51'));return db[_0x9935('0x40')][_0x9935('0x46')]({'where':{'id':_0x45cb7c[_0x9935('0x44')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x3c022c,null))[_0x9935('0x20')](function(){_0x3a6d59[_0x9935('0x50')](_0x45cb7c[_0x9935('0x44')]['id']);})[_0x9935('0x20')](respondWithStatusCode(_0x3c022c,null))[_0x9935('0x43')](handleError(_0x3c022c,null));}; \ No newline at end of file +var _0x09e3=['map','Schedule','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','rows','show','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','update','run','../../config/schedule','eml-format','rimraf','fast-json-patch','bluebird','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Scheduler','error','stack','name','send','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09e3,0xd6));var _0x309e=function(_0x176f07,_0xf62723){_0x176f07=_0x176f07-0x0;var _0x56847f=_0x09e3[_0x176f07];return _0x56847f;};'use strict';var emlformat=require(_0x309e('0x0'));var rimraf=require(_0x309e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x309e('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x309e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x309e('0x4'));var sox=require('sox');var csv=require(_0x309e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x309e('0x6'));var squel=require('squel');var crypto=require(_0x309e('0x7'));var jsforce=require(_0x309e('0x8'));var deskjs=require(_0x309e('0x9'));var toCsv=require(_0x309e('0x5'));var querystring=require(_0x309e('0xa'));var Papa=require(_0x309e('0xb'));var Redis=require(_0x309e('0xc'));var authService=require(_0x309e('0xd'));var qs=require(_0x309e('0xe'));var as=require(_0x309e('0xf'));var hardwareService=require(_0x309e('0x10'));var logger=require(_0x309e('0x11'))(_0x309e('0x12'));var utils=require(_0x309e('0x13'));var config=require(_0x309e('0x14'));var licenseUtil=require(_0x309e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3aede3,_0x4a81d6){_0x4a81d6=_0x4a81d6||0xcc;return function(_0x566483){if(_0x566483){return _0x3aede3[_0x309e('0x16')](_0x4a81d6);}return _0x3aede3[_0x309e('0x17')](_0x4a81d6)[_0x309e('0x18')]();};}function respondWithResult(_0x5992a9,_0x3afdf4){_0x3afdf4=_0x3afdf4||0xc8;return function(_0x3f82a6){if(_0x3f82a6){return _0x5992a9[_0x309e('0x17')](_0x3afdf4)[_0x309e('0x19')](_0x3f82a6);}};}function respondWithFilteredResult(_0x175cc5,_0x233225){return function(_0x534312){if(_0x534312){var _0x12cdb1=typeof _0x233225[_0x309e('0x1a')]===_0x309e('0x1b')&&typeof _0x233225[_0x309e('0x1c')]===_0x309e('0x1b');var _0x4748b3=_0x534312['count'];var _0x2dc333=_0x12cdb1?0x0:_0x233225[_0x309e('0x1a')];var _0x59aeb4=_0x12cdb1?_0x534312[_0x309e('0x1d')]:_0x233225[_0x309e('0x1a')]+_0x233225['limit'];var _0x5a9368;if(_0x59aeb4>=_0x4748b3){_0x59aeb4=_0x4748b3;_0x5a9368=0xc8;}else{_0x5a9368=0xce;}_0x175cc5[_0x309e('0x17')](_0x5a9368);return _0x175cc5[_0x309e('0x1e')](_0x309e('0x1f'),_0x2dc333+'-'+_0x59aeb4+'/'+_0x4748b3)[_0x309e('0x19')](_0x534312);}return null;};}function patchUpdates(_0x76d2fb){return function(_0xd28fc5){try{jsonpatch[_0x309e('0x20')](_0xd28fc5,_0x76d2fb,!![]);}catch(_0x4d8a80){return BPromise[_0x309e('0x21')](_0x4d8a80);}return _0xd28fc5[_0x309e('0x22')]();};}function saveUpdates(_0x3f8625,_0x47ef65){return function(_0x20f857){if(_0x20f857){return _0x20f857['update'](_0x3f8625)[_0x309e('0x23')](function(_0x4073f4){return _0x4073f4;});}return null;};}function removeEntity(_0x55cdfd,_0x2723c1){return function(_0x6b1043){if(_0x6b1043){return _0x6b1043[_0x309e('0x24')]()[_0x309e('0x23')](function(){var _0x472a17=_0x6b1043[_0x309e('0x25')]({'plain':!![]});var _0x59e5db=_0x309e('0x26');return db['UserProfileResource'][_0x309e('0x24')]({'where':{'type':_0x59e5db,'resourceId':_0x472a17['id']}})[_0x309e('0x23')](function(){return _0x6b1043;});})[_0x309e('0x23')](function(){_0x55cdfd[_0x309e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4402bd,_0x5116be){return function(_0x1ea5ee){if(!_0x1ea5ee){_0x4402bd[_0x309e('0x16')](0x194);}return _0x1ea5ee;};}function handleError(_0x537a7c,_0x5ec14b){_0x5ec14b=_0x5ec14b||0x1f4;return function(_0x14232a){logger[_0x309e('0x27')](_0x14232a[_0x309e('0x28')]);if(_0x14232a[_0x309e('0x29')]){delete _0x14232a['name'];}_0x537a7c[_0x309e('0x17')](_0x5ec14b)[_0x309e('0x2a')](_0x14232a);};}exports[_0x309e('0x2b')]=function(_0xf0e07c,_0x143742){var _0x3ecf9d={},_0x1776f4={},_0x8538af={'count':0x0,'rows':[]};var _0x368c41=_[_0x309e('0x2c')](db[_0x309e('0x2d')][_0x309e('0x2e')],function(_0x3a3602){return{'name':_0x3a3602[_0x309e('0x2f')],'type':_0x3a3602[_0x309e('0x30')][_0x309e('0x31')]};});_0x1776f4[_0x309e('0x32')]=_[_0x309e('0x2c')](_0x368c41,_0x309e('0x29'));_0x1776f4['query']=_[_0x309e('0x33')](_0xf0e07c[_0x309e('0x34')]);_0x1776f4[_0x309e('0x35')]=_[_0x309e('0x36')](_0x1776f4[_0x309e('0x32')],_0x1776f4['query']);_0x3ecf9d['attributes']=_[_0x309e('0x36')](_0x1776f4['model'],qs[_0x309e('0x37')](_0xf0e07c[_0x309e('0x34')][_0x309e('0x37')]));_0x3ecf9d[_0x309e('0x38')]=_0x3ecf9d['attributes'][_0x309e('0x39')]?_0x3ecf9d[_0x309e('0x38')]:_0x1776f4[_0x309e('0x32')];if(!_0xf0e07c[_0x309e('0x34')][_0x309e('0x3a')](_0x309e('0x3b'))){_0x3ecf9d[_0x309e('0x1c')]=qs[_0x309e('0x1c')](_0xf0e07c[_0x309e('0x34')][_0x309e('0x1c')]);_0x3ecf9d[_0x309e('0x1a')]=qs['offset'](_0xf0e07c[_0x309e('0x34')][_0x309e('0x1a')]);}_0x3ecf9d[_0x309e('0x3c')]=qs[_0x309e('0x3d')](_0xf0e07c[_0x309e('0x34')][_0x309e('0x3d')]);_0x3ecf9d[_0x309e('0x3e')]=qs[_0x309e('0x35')](_[_0x309e('0x3f')](_0xf0e07c[_0x309e('0x34')],_0x1776f4[_0x309e('0x35')]),_0x368c41);if(_0xf0e07c[_0x309e('0x34')][_0x309e('0x40')]){_0x3ecf9d[_0x309e('0x3e')]=_[_0x309e('0x41')](_0x3ecf9d[_0x309e('0x3e')],{'$or':_[_0x309e('0x2c')](_0x368c41,function(_0xbe7877){if(_0xbe7877[_0x309e('0x30')]!==_0x309e('0x42')){var _0xa73bc3={};_0xa73bc3[_0xbe7877[_0x309e('0x29')]]={'$like':'%'+_0xf0e07c['query'][_0x309e('0x40')]+'%'};return _0xa73bc3;}})});}_0x3ecf9d=_[_0x309e('0x41')]({},_0x3ecf9d,_0xf0e07c[_0x309e('0x43')]);var _0x5ce669={'where':_0x3ecf9d['where']};return db[_0x309e('0x2d')][_0x309e('0x1d')](_0x5ce669)[_0x309e('0x23')](function(_0xabc744){_0x8538af['count']=_0xabc744;if(_0xf0e07c['query']['includeAll']){_0x3ecf9d[_0x309e('0x44')]=[{'all':!![]}];}return db[_0x309e('0x2d')]['findAll'](_0x3ecf9d);})[_0x309e('0x23')](function(_0x312a19){_0x8538af[_0x309e('0x45')]=_0x312a19;return _0x8538af;})['then'](respondWithFilteredResult(_0x143742,_0x3ecf9d))['catch'](handleError(_0x143742,null));};exports[_0x309e('0x46')]=function(_0xc0b965,_0x5089ab){var _0x54a65e={'raw':![],'where':{'id':_0xc0b965[_0x309e('0x47')]['id']}},_0x519e71={};_0x519e71[_0x309e('0x32')]=_[_0x309e('0x33')](db[_0x309e('0x2d')][_0x309e('0x2e')]);_0x519e71[_0x309e('0x34')]=_[_0x309e('0x33')](_0xc0b965[_0x309e('0x34')]);_0x519e71[_0x309e('0x35')]=_[_0x309e('0x36')](_0x519e71[_0x309e('0x32')],_0x519e71[_0x309e('0x34')]);_0x54a65e[_0x309e('0x38')]=_['intersection'](_0x519e71[_0x309e('0x32')],qs[_0x309e('0x37')](_0xc0b965[_0x309e('0x34')][_0x309e('0x37')]));_0x54a65e[_0x309e('0x38')]=_0x54a65e[_0x309e('0x38')][_0x309e('0x39')]?_0x54a65e['attributes']:_0x519e71['model'];if(_0xc0b965[_0x309e('0x34')]['includeAll']){_0x54a65e[_0x309e('0x44')]=[{'all':!![]}];}_0x54a65e=_[_0x309e('0x41')]({},_0x54a65e,_0xc0b965['options']);return db[_0x309e('0x2d')][_0x309e('0x48')](_0x54a65e)[_0x309e('0x23')](handleEntityNotFound(_0x5089ab,null))[_0x309e('0x23')](respondWithResult(_0x5089ab,null))[_0x309e('0x49')](handleError(_0x5089ab,null));};exports[_0x309e('0x4a')]=function(_0x18fa32,_0x9bf320){return db[_0x309e('0x2d')][_0x309e('0x4a')](_0x18fa32[_0x309e('0x4b')],{})['then'](function(_0x139df1){var _0x2d9408=_0x18fa32['user'][_0x309e('0x25')]({'plain':!![]});if(!_0x2d9408)throw new Error(_0x309e('0x4c'));if(_0x2d9408[_0x309e('0x4d')]===_0x309e('0x4e')){var _0x14199c=_0x139df1[_0x309e('0x25')]({'plain':!![]});var _0xe581c8=_0x309e('0x26');return db[_0x309e('0x4f')]['find']({'where':{'name':_0xe581c8,'userProfileId':_0x2d9408[_0x309e('0x50')]},'raw':!![]})[_0x309e('0x23')](function(_0x2a0b06){if(_0x2a0b06&&_0x2a0b06[_0x309e('0x51')]===0x0){return db['UserProfileResource']['create']({'name':_0x14199c[_0x309e('0x29')],'resourceId':_0x14199c['id'],'type':_0x2a0b06[_0x309e('0x29')],'sectionId':_0x2a0b06['id']},{})[_0x309e('0x23')](function(){return _0x139df1;});}else{return _0x139df1;}})[_0x309e('0x49')](function(_0x1bb09b){logger[_0x309e('0x27')](_0x309e('0x52'),_0x1bb09b);throw _0x1bb09b;});}return _0x139df1;})[_0x309e('0x23')](respondWithResult(_0x9bf320,0xc9))[_0x309e('0x49')](handleError(_0x9bf320,null));};exports[_0x309e('0x53')]=function(_0x12635e,_0x3cfefd){if(_0x12635e['body']['id']){delete _0x12635e[_0x309e('0x4b')]['id'];}return db['Schedule'][_0x309e('0x48')]({'where':{'id':_0x12635e['params']['id']}})[_0x309e('0x23')](handleEntityNotFound(_0x3cfefd,null))[_0x309e('0x23')](saveUpdates(_0x12635e[_0x309e('0x4b')],null))[_0x309e('0x23')](respondWithResult(_0x3cfefd,null))[_0x309e('0x49')](handleError(_0x3cfefd,null));};exports[_0x309e('0x24')]=function(_0x103896,_0x71eb6d){return db['Schedule'][_0x309e('0x48')]({'where':{'id':_0x103896[_0x309e('0x47')]['id']}})[_0x309e('0x23')](handleEntityNotFound(_0x71eb6d,null))['then'](removeEntity(_0x71eb6d,null))[_0x309e('0x49')](handleError(_0x71eb6d,null));};exports[_0x309e('0x54')]=function(_0x5301aa,_0x5ae8a5,_0x408ba8){var _0x57fe1b=require(_0x309e('0x55'));return db['Schedule'][_0x309e('0x48')]({'where':{'id':_0x5301aa[_0x309e('0x47')]['id']},'raw':!![]})[_0x309e('0x23')](handleEntityNotFound(_0x5ae8a5,null))['then'](function(){_0x57fe1b['run'](_0x5301aa[_0x309e('0x47')]['id']);})['then'](respondWithStatusCode(_0x5ae8a5,null))[_0x309e('0x49')](handleError(_0x5ae8a5,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index eab3fc9..c6d1845 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 _0x9564=['tools_schedules','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Schedule'];(function(_0x361c94,_0xab75f9){var _0x271657=function(_0x1aaebc){while(--_0x1aaebc){_0x361c94['push'](_0x361c94['shift']());}};_0x271657(++_0xab75f9);}(_0x9564,0x12a));var _0x4956=function(_0x549996,_0xd04634){_0x549996=_0x549996-0x0;var _0x4de5d1=_0x9564[_0x549996];return _0x4de5d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4956('0x0'))(_0x4956('0x1'));var moment=require(_0x4956('0x2'));var BPromise=require('bluebird');var rp=require(_0x4956('0x3'));var fs=require('fs');var path=require(_0x4956('0x4'));var rimraf=require(_0x4956('0x5'));var config=require(_0x4956('0x6'));var attributes=require('./schedule.attributes');module[_0x4956('0x7')]=function(_0x4d4cd6,_0x5f5521){return _0x4d4cd6[_0x4956('0x8')](_0x4956('0x9'),attributes,{'tableName':_0x4956('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8375=['request-promise','path','../../config/environment','./schedule.attributes','exports','define','Schedule','lodash','util','../../config/logger','api','bluebird'];(function(_0x3f3d28,_0x474b43){var _0x472743=function(_0x259b28){while(--_0x259b28){_0x3f3d28['push'](_0x3f3d28['shift']());}};_0x472743(++_0x474b43);}(_0x8375,0x97));var _0x5837=function(_0x5ee28e,_0x204ac2){_0x5ee28e=_0x5ee28e-0x0;var _0x3bf895=_0x8375[_0x5ee28e];return _0x3bf895;};'use strict';var _=require(_0x5837('0x0'));var util=require(_0x5837('0x1'));var logger=require(_0x5837('0x2'))(_0x5837('0x3'));var moment=require('moment');var BPromise=require(_0x5837('0x4'));var rp=require(_0x5837('0x5'));var fs=require('fs');var path=require(_0x5837('0x6'));var rimraf=require('rimraf');var config=require(_0x5837('0x7'));var attributes=require(_0x5837('0x8'));module[_0x5837('0x9')]=function(_0x104119,_0x480461){return _0x104119[_0x5837('0xa')](_0x5837('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 12f1254..6b388fb 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 _0xe39f=['result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3f993a,_0x8786d2){var _0x4869b8=function(_0x7bd94c){while(--_0x7bd94c){_0x3f993a['push'](_0x3f993a['shift']());}};_0x4869b8(++_0x8786d2);}(_0xe39f,0xaa));var _0xfe39=function(_0x1df79c,_0x5ad8fd){_0x1df79c=_0x1df79c-0x0;var _0x2f23e4=_0xe39f[_0x1df79c];return _0x2f23e4;};'use strict';var _=require('lodash');var util=require(_0xfe39('0x0'));var moment=require('moment');var BPromise=require(_0xfe39('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe39('0x2'));var db=require(_0xfe39('0x3'))['db'];var utils=require(_0xfe39('0x4'));var logger=require(_0xfe39('0x5'))(_0xfe39('0x6'));var config=require(_0xfe39('0x7'));var jayson=require(_0xfe39('0x8'));var client=jayson[_0xfe39('0x9')][_0xfe39('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a1023,_0x1c4ae3,_0x4b81da){return new BPromise(function(_0x57a5cc,_0xf43026){return client['request'](_0x5a1023,_0x4b81da)['then'](function(_0x911ad6){logger[_0xfe39('0xb')](_0xfe39('0xc'),_0x1c4ae3,_0xfe39('0xd'));logger['debug'](_0xfe39('0xe'),_0x1c4ae3,'request\x20sent',JSON[_0xfe39('0xf')](_0x911ad6));if(_0x911ad6[_0xfe39('0x10')]){if(_0x911ad6[_0xfe39('0x10')][_0xfe39('0x11')]===0x1f4){logger[_0xfe39('0x10')]('Schedule,\x20%s,\x20%s',_0x1c4ae3,_0x911ad6[_0xfe39('0x10')][_0xfe39('0x12')]);return _0xf43026(_0x911ad6[_0xfe39('0x10')]['message']);}logger[_0xfe39('0x10')](_0xfe39('0xc'),_0x1c4ae3,_0x911ad6[_0xfe39('0x10')][_0xfe39('0x12')]);return _0x57a5cc(_0x911ad6['error'][_0xfe39('0x12')]);}else{logger[_0xfe39('0xb')]('Schedule,\x20%s,\x20%s',_0x1c4ae3,_0xfe39('0xd'));_0x57a5cc(_0x911ad6[_0xfe39('0x13')][_0xfe39('0x12')]);}})[_0xfe39('0x14')](function(_0x37d4d2){logger[_0xfe39('0x10')](_0xfe39('0xc'),_0x1c4ae3,_0x37d4d2);_0xf43026(_0x37d4d2);});});} \ No newline at end of file +var _0x204b=['code','Schedule,\x20%s,\x20%s','message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','error'];(function(_0x1dc15f,_0x3ce560){var _0x5c3da7=function(_0x2bf2e2){while(--_0x2bf2e2){_0x1dc15f['push'](_0x1dc15f['shift']());}};_0x5c3da7(++_0x3ce560);}(_0x204b,0x76));var _0xb204=function(_0x3c8e9a,_0x384306){_0x3c8e9a=_0x3c8e9a-0x0;var _0x2d4c57=_0x204b[_0x3c8e9a];return _0x2d4c57;};'use strict';var _=require(_0xb204('0x0'));var util=require(_0xb204('0x1'));var moment=require(_0xb204('0x2'));var BPromise=require(_0xb204('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb204('0x4'));var db=require(_0xb204('0x5'))['db'];var utils=require(_0xb204('0x6'));var logger=require(_0xb204('0x7'))(_0xb204('0x8'));var config=require(_0xb204('0x9'));var jayson=require(_0xb204('0xa'));var client=jayson[_0xb204('0xb')][_0xb204('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x361924,_0x107c65,_0x2ea49d){return new BPromise(function(_0x737253,_0x15305c){return client[_0xb204('0xd')](_0x361924,_0x2ea49d)[_0xb204('0xe')](function(_0xaea478){logger[_0xb204('0xf')]('Schedule,\x20%s,\x20%s',_0x107c65,_0xb204('0x10'));logger[_0xb204('0x11')](_0xb204('0x12'),_0x107c65,_0xb204('0x10'),JSON['stringify'](_0xaea478));if(_0xaea478[_0xb204('0x13')]){if(_0xaea478[_0xb204('0x13')][_0xb204('0x14')]===0x1f4){logger[_0xb204('0x13')](_0xb204('0x15'),_0x107c65,_0xaea478[_0xb204('0x13')][_0xb204('0x16')]);return _0x15305c(_0xaea478[_0xb204('0x13')][_0xb204('0x16')]);}logger[_0xb204('0x13')]('Schedule,\x20%s,\x20%s',_0x107c65,_0xaea478['error'][_0xb204('0x16')]);return _0x737253(_0xaea478[_0xb204('0x13')]['message']);}else{logger[_0xb204('0xf')](_0xb204('0x15'),_0x107c65,_0xb204('0x10'));_0x737253(_0xaea478['result'][_0xb204('0x16')]);}})['catch'](function(_0x5e9e09){logger[_0xb204('0x13')]('Schedule,\x20%s,\x20%s',_0x107c65,_0x5e9e09);_0x15305c(_0x5e9e09);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 69193f6..485d051 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 _0x2a45=['/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d0307,_0x14ee85){var _0x1eb11e=function(_0x362c45){while(--_0x362c45){_0x2d0307['push'](_0x2d0307['shift']());}};_0x1eb11e(++_0x14ee85);}(_0x2a45,0xb8));var _0x52a4=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0x2a45[_0x209941];return _0x1e8729;};'use strict';var multer=require(_0x52a4('0x0'));var util=require(_0x52a4('0x1'));var path=require(_0x52a4('0x2'));var timeout=require(_0x52a4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x52a4('0x4'));var auth=require(_0x52a4('0x5'));var interaction=require(_0x52a4('0x6'));var config=require(_0x52a4('0x7'));var controller=require(_0x52a4('0x8'));router[_0x52a4('0x9')]('/',auth[_0x52a4('0xa')](),controller[_0x52a4('0xb')]);router['get'](_0x52a4('0xc'),auth[_0x52a4('0xa')](),controller[_0x52a4('0xd')]);router['get'](_0x52a4('0xe'),auth[_0x52a4('0xa')](),controller[_0x52a4('0xf')]);router['get']('/:id/download',auth[_0x52a4('0xa')](),controller['download']);router[_0x52a4('0x10')]('/',auth[_0x52a4('0xa')](),controller[_0x52a4('0x11')]);router[_0x52a4('0x12')](_0x52a4('0xe'),auth[_0x52a4('0xa')](),controller['update']);router[_0x52a4('0x13')]('/:id',auth[_0x52a4('0xa')](),controller[_0x52a4('0x14')]);module[_0x52a4('0x15')]=router; \ No newline at end of file +var _0xd381=['create','update','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','isAuthenticated','index','get','/describe','describe','/:id','show','/:id/download','post'];(function(_0x4b731e,_0x4a48bc){var _0x26ca45=function(_0x2217b9){while(--_0x2217b9){_0x4b731e['push'](_0x4b731e['shift']());}};_0x26ca45(++_0x4a48bc);}(_0xd381,0x165));var _0x1d38=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xd381[_0x49b207];return _0x2dc8fa;};'use strict';var multer=require('multer');var util=require(_0x1d38('0x0'));var path=require('path');var timeout=require(_0x1d38('0x1'));var express=require(_0x1d38('0x2'));var router=express[_0x1d38('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1d38('0x4'));var interaction=require(_0x1d38('0x5'));var config=require(_0x1d38('0x6'));var controller=require(_0x1d38('0x7'));router['get']('/',auth[_0x1d38('0x8')](),controller[_0x1d38('0x9')]);router[_0x1d38('0xa')](_0x1d38('0xb'),auth[_0x1d38('0x8')](),controller[_0x1d38('0xc')]);router['get'](_0x1d38('0xd'),auth[_0x1d38('0x8')](),controller[_0x1d38('0xe')]);router['get'](_0x1d38('0xf'),auth[_0x1d38('0x8')](),controller['download']);router[_0x1d38('0x10')]('/',auth['isAuthenticated'](),controller[_0x1d38('0x11')]);router['put'](_0x1d38('0xd'),auth['isAuthenticated'](),controller[_0x1d38('0x12')]);router[_0x1d38('0x13')](_0x1d38('0xd'),auth['isAuthenticated'](),controller[_0x1d38('0x14')]);module[_0x1d38('0x15')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 54e29c0..5c2af53 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 _0x5a13=['path','../../config/environment','exports','VIRTUAL','getDataValue','extname','value','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','moment'];(function(_0x3d5983,_0x4b2df8){var _0x5cd144=function(_0x714e3b){while(--_0x714e3b){_0x3d5983['push'](_0x3d5983['shift']());}};_0x5cd144(++_0x4b2df8);}(_0x5a13,0x92));var _0x35a1=function(_0xb1aad7,_0x1116fe){_0xb1aad7=_0xb1aad7-0x0;var _0x5bcc11=_0x5a13[_0xb1aad7];return _0x5bcc11;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x35a1('0x0'));var path=require(_0x35a1('0x1'));var config=require(_0x35a1('0x2'));module[_0x35a1('0x3')]={'format':{'type':Sequelize[_0x35a1('0x4')],'get':function(){return this[_0x35a1('0x5')]('value')?path[_0x35a1('0x6')](this['getDataValue'](_0x35a1('0x7'))):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x4222a1){var _0x3bd7c9=_0x4222a1[_0x35a1('0x8')](/\\/g,'/');this[_0x35a1('0x9')](_0x35a1('0x7'),_0x3bd7c9);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x35a1('0xa')],'set':function(_0x469d94){this[_0x35a1('0x9')](_0x35a1('0xb'),moment()[_0x35a1('0xc')](_0x469d94,'ms'));this[_0x35a1('0x9')](_0x35a1('0xd'),moment());this[_0x35a1('0x9')](_0x35a1('0xe'),_0x469d94);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35a1('0x5')](_0x35a1('0xb')))[_0x35a1('0xf')](_0x35a1('0x10'))[_0x35a1('0x11')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35a1('0x5')]('closedAt'))[_0x35a1('0xf')](_0x35a1('0x10'))['toString']();}},'createdAt':{'type':Sequelize[_0x35a1('0x12')],'get':function(){return moment(this[_0x35a1('0x5')](_0x35a1('0x13')))[_0x35a1('0xf')]('MM-DD-YYYY\x20HH:mm')[_0x35a1('0x11')]();}},'updatedAt':{'type':Sequelize[_0x35a1('0x12')],'get':function(){return moment(this[_0x35a1('0x5')](_0x35a1('0x14')))['format'](_0x35a1('0x10'))[_0x35a1('0x11')]();}}}; \ No newline at end of file +var _0xf3e2=['closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','createdAt','toString','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','startedAt','subtract'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xf3e2,0x168));var _0x2f3e=function(_0x9b5bb2,_0x5db315){_0x9b5bb2=_0x9b5bb2-0x0;var _0x2e1e92=_0xf3e2[_0x9b5bb2];return _0x2e1e92;};'use strict';var Sequelize=require(_0x2f3e('0x0'));var moment=require(_0x2f3e('0x1'));var path=require(_0x2f3e('0x2'));var config=require(_0x2f3e('0x3'));module[_0x2f3e('0x4')]={'format':{'type':Sequelize[_0x2f3e('0x5')],'get':function(){return this[_0x2f3e('0x6')](_0x2f3e('0x7'))?path['extname'](this[_0x2f3e('0x6')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0x2f3e('0x8')]},'channel':{'type':Sequelize[_0x2f3e('0x8')]},'value':{'type':Sequelize[_0x2f3e('0x8')],'set':function(_0x392f91){var _0x3b556b=_0x392f91[_0x2f3e('0x9')](/\\/g,'/');this[_0x2f3e('0xa')](_0x2f3e('0x7'),_0x3b556b);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x2f3e('0xb')],'set':function(_0x4d7f7d){this[_0x2f3e('0xa')](_0x2f3e('0xc'),moment()[_0x2f3e('0xd')](_0x4d7f7d,'ms'));this[_0x2f3e('0xa')](_0x2f3e('0xe'),moment());this[_0x2f3e('0xa')](_0x2f3e('0xf'),_0x4d7f7d);}},'startedAt':{'type':Sequelize[_0x2f3e('0x10')],'get':function(){return moment(this[_0x2f3e('0x6')](_0x2f3e('0xc')))[_0x2f3e('0x11')](_0x2f3e('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0x2f3e('0x10')],'get':function(){return moment(this['getDataValue'](_0x2f3e('0xe')))[_0x2f3e('0x11')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0x2f3e('0x10')],'get':function(){return moment(this[_0x2f3e('0x6')](_0x2f3e('0x13')))[_0x2f3e('0x11')](_0x2f3e('0x12'))[_0x2f3e('0x14')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x2f3e('0x6')](_0x2f3e('0x15')))[_0x2f3e('0x11')](_0x2f3e('0x12'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 5503b73..14e7dd9 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(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0xae24,0x182));var _0x4ae2=function(_0x80fb29,_0x170f94){_0x80fb29=_0x80fb29-0x0;var _0x10e099=_0xae24[_0x80fb29];return _0x10e099;};'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 _0x7bae=['zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','Content-Range','apply','save','update','then','error','stack','name','index','map','ScreenRecording','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','type','VIRTUAL','filter','includeAll','findAll','rows','catch','params','options','find','create','body','duration','createdAt','value','describe','download','../../components/encryptor','uniqueid','join','root','format','%s.cypher','existsSync','secrets','recording','server/files/screen_recordings','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','send','destroy','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione'];(function(_0x470f63,_0x48d80b){var _0x4f09e2=function(_0x3aa3a4){while(--_0x3aa3a4){_0x470f63['push'](_0x470f63['shift']());}};_0x4f09e2(++_0x48d80b);}(_0x7bae,0x13b));var _0xe7ba=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7bae[_0x4baae2];return _0x1a2285;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe7ba('0x0'));var jsonpatch=require(_0xe7ba('0x1'));var rp=require('request-promise');var moment=require(_0xe7ba('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xe7ba('0x3'));var util=require(_0xe7ba('0x4'));var path=require(_0xe7ba('0x5'));var sox=require(_0xe7ba('0x6'));var csv=require(_0xe7ba('0x7'));var ejs=require(_0xe7ba('0x8'));var fs=require('fs');var fs_extra=require(_0xe7ba('0x9'));var _=require(_0xe7ba('0xa'));var squel=require(_0xe7ba('0xb'));var crypto=require(_0xe7ba('0xc'));var jsforce=require(_0xe7ba('0xd'));var deskjs=require(_0xe7ba('0xe'));var toCsv=require(_0xe7ba('0x7'));var querystring=require(_0xe7ba('0xf'));var Papa=require('papaparse');var Redis=require(_0xe7ba('0x10'));var authService=require(_0xe7ba('0x11'));var qs=require(_0xe7ba('0x12'));var as=require(_0xe7ba('0x13'));var hardwareService=require(_0xe7ba('0x14'));var logger=require(_0xe7ba('0x15'))(_0xe7ba('0x16'));var utils=require(_0xe7ba('0x17'));var config=require(_0xe7ba('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe7ba('0x19'))['db'];function respondWithStatusCode(_0x588c8b,_0x602b1){_0x602b1=_0x602b1||0xcc;return function(_0x45229c){if(_0x45229c){return _0x588c8b[_0xe7ba('0x1a')](_0x602b1);}return _0x588c8b[_0xe7ba('0x1b')](_0x602b1)[_0xe7ba('0x1c')]();};}function respondWithResult(_0x41369f,_0x561dbb){_0x561dbb=_0x561dbb||0xc8;return function(_0x561c48){if(_0x561c48){return _0x41369f[_0xe7ba('0x1b')](_0x561dbb)[_0xe7ba('0x1d')](_0x561c48);}};}function respondWithFilteredResult(_0x359f6f,_0x5d1d03){return function(_0x4390e3){if(_0x4390e3){var _0x4b20fd=typeof _0x5d1d03['offset']==='undefined'&&typeof _0x5d1d03[_0xe7ba('0x1e')]==='undefined';var _0x41a773=_0x4390e3['count'];var _0x4e3021=_0x4b20fd?0x0:_0x5d1d03['offset'];var _0x3f326a=_0x4b20fd?_0x4390e3[_0xe7ba('0x1f')]:_0x5d1d03[_0xe7ba('0x20')]+_0x5d1d03[_0xe7ba('0x1e')];var _0x1c8b5b;if(_0x3f326a>=_0x41a773){_0x3f326a=_0x41a773;_0x1c8b5b=0xc8;}else{_0x1c8b5b=0xce;}_0x359f6f['status'](_0x1c8b5b);return _0x359f6f[_0xe7ba('0x21')](_0xe7ba('0x22'),_0x4e3021+'-'+_0x3f326a+'/'+_0x41a773)[_0xe7ba('0x1d')](_0x4390e3);}return null;};}function patchUpdates(_0x136ec6){return function(_0x4aaf35){try{jsonpatch[_0xe7ba('0x23')](_0x4aaf35,_0x136ec6,!![]);}catch(_0x2936b7){return BPromise['reject'](_0x2936b7);}return _0x4aaf35[_0xe7ba('0x24')]();};}function saveUpdates(_0x4514e8,_0x27c882){return function(_0x7ab9e4){if(_0x7ab9e4){return _0x7ab9e4[_0xe7ba('0x25')](_0x4514e8)[_0xe7ba('0x26')](function(_0x293b14){return _0x293b14;});}return null;};}function removeEntity(_0x2b29f0,_0x41cbd9){return function(_0xa72f1c){if(_0xa72f1c){return _0xa72f1c['destroy']()['then'](function(){_0x2b29f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4363a8,_0x576513){return function(_0x4ecc0d){if(!_0x4ecc0d){_0x4363a8['sendStatus'](0x194);}return _0x4ecc0d;};}function handleError(_0x255def,_0x32cc00){_0x32cc00=_0x32cc00||0x1f4;return function(_0xe32862){logger[_0xe7ba('0x27')](_0xe32862[_0xe7ba('0x28')]);if(_0xe32862[_0xe7ba('0x29')]){delete _0xe32862[_0xe7ba('0x29')];}_0x255def[_0xe7ba('0x1b')](_0x32cc00)['send'](_0xe32862);};}exports[_0xe7ba('0x2a')]=function(_0x48c869,_0x102925){var _0x92fe7={},_0x369451={},_0x4bf5f9={'count':0x0,'rows':[]};var _0x587c7d=_[_0xe7ba('0x2b')](db[_0xe7ba('0x2c')][_0xe7ba('0x2d')],function(_0x20b6cd){return{'name':_0x20b6cd[_0xe7ba('0x2e')],'type':_0x20b6cd['type'][_0xe7ba('0x2f')]};});_0x369451[_0xe7ba('0x30')]=_['differenceBy'](_[_0xe7ba('0x2b')](_0x587c7d,'name'),['format']);_0x369451[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x48c869[_0xe7ba('0x31')]);_0x369451['filters']=_[_0xe7ba('0x33')](_0x369451['model'],_0x369451[_0xe7ba('0x31')]);_0x92fe7[_0xe7ba('0x34')]=_[_0xe7ba('0x33')](_0x369451[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x48c869['query'][_0xe7ba('0x35')]));_0x92fe7[_0xe7ba('0x34')]=_0x92fe7['attributes'][_0xe7ba('0x36')]?_0x92fe7[_0xe7ba('0x34')]:_0x369451[_0xe7ba('0x30')];if(!_0x48c869['query'][_0xe7ba('0x37')](_0xe7ba('0x38'))){_0x92fe7['limit']=qs[_0xe7ba('0x1e')](_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x1e')]);_0x92fe7['offset']=qs[_0xe7ba('0x20')](_0x48c869[_0xe7ba('0x31')]['offset']);}_0x92fe7[_0xe7ba('0x39')]=qs[_0xe7ba('0x3a')](_0x48c869[_0xe7ba('0x31')]['sort']);_0x92fe7['where']=qs[_0xe7ba('0x3b')](_[_0xe7ba('0x3c')](_0x48c869[_0xe7ba('0x31')],_0x369451[_0xe7ba('0x3b')]),_0x587c7d);if(_0x48c869[_0xe7ba('0x31')]['filter']){_0x92fe7[_0xe7ba('0x3d')]=_[_0xe7ba('0x3e')](_0x92fe7[_0xe7ba('0x3d')],{'$or':_[_0xe7ba('0x2b')](_0x587c7d,function(_0x5e9619){if(_0x5e9619[_0xe7ba('0x3f')]!==_0xe7ba('0x40')){var _0x46e31a={};_0x46e31a[_0x5e9619[_0xe7ba('0x29')]]={'$like':'%'+_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x41')]+'%'};return _0x46e31a;}})});}_0x92fe7=_[_0xe7ba('0x3e')]({},_0x92fe7,_0x48c869['options']);var _0x3429fa={'where':_0x92fe7[_0xe7ba('0x3d')]};return db[_0xe7ba('0x2c')][_0xe7ba('0x1f')](_0x3429fa)[_0xe7ba('0x26')](function(_0x3b3abe){_0x4bf5f9[_0xe7ba('0x1f')]=_0x3b3abe;if(_0x48c869[_0xe7ba('0x31')][_0xe7ba('0x42')]){_0x92fe7['include']=[{'all':!![]}];}return db[_0xe7ba('0x2c')][_0xe7ba('0x43')](_0x92fe7);})['then'](function(_0x5dae52){_0x4bf5f9[_0xe7ba('0x44')]=_0x5dae52;return _0x4bf5f9;})[_0xe7ba('0x26')](respondWithFilteredResult(_0x102925,_0x92fe7))[_0xe7ba('0x45')](handleError(_0x102925,null));};exports['show']=function(_0x249e1d,_0x82246e){var _0x3569b6={'raw':![],'where':{'id':_0x249e1d[_0xe7ba('0x46')]['id']}},_0x12770d={};_0x12770d['model']=_[_0xe7ba('0x32')](db['ScreenRecording'][_0xe7ba('0x2d')]);_0x12770d[_0xe7ba('0x31')]=_[_0xe7ba('0x32')](_0x249e1d[_0xe7ba('0x31')]);_0x12770d[_0xe7ba('0x3b')]=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],_0x12770d[_0xe7ba('0x31')]);_0x3569b6['attributes']=_[_0xe7ba('0x33')](_0x12770d[_0xe7ba('0x30')],qs[_0xe7ba('0x35')](_0x249e1d[_0xe7ba('0x31')][_0xe7ba('0x35')]));_0x3569b6[_0xe7ba('0x34')]=_0x3569b6[_0xe7ba('0x34')][_0xe7ba('0x36')]?_0x3569b6[_0xe7ba('0x34')]:_0x12770d[_0xe7ba('0x30')];if(_0x249e1d['query'][_0xe7ba('0x42')]){_0x3569b6['include']=[{'all':!![]}];}_0x3569b6=_[_0xe7ba('0x3e')]({},_0x3569b6,_0x249e1d[_0xe7ba('0x47')]);return db[_0xe7ba('0x2c')][_0xe7ba('0x48')](_0x3569b6)[_0xe7ba('0x26')](handleEntityNotFound(_0x82246e,null))[_0xe7ba('0x26')](respondWithResult(_0x82246e,null))['catch'](handleError(_0x82246e,null));};exports[_0xe7ba('0x49')]=function(_0x1cc668,_0x3f17ed){return db[_0xe7ba('0x2c')][_0xe7ba('0x49')](_0x1cc668[_0xe7ba('0x4a')],{})[_0xe7ba('0x26')](respondWithResult(_0x3f17ed,0xc9))[_0xe7ba('0x45')](handleError(_0x3f17ed,null));};exports[_0xe7ba('0x25')]=function(_0x1189bd,_0xbe2a32){if(_0x1189bd['body']['id']){delete _0x1189bd[_0xe7ba('0x4a')]['id'];}delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4b')];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4c')];delete _0x1189bd[_0xe7ba('0x4a')]['closedAt'];delete _0x1189bd[_0xe7ba('0x4a')][_0xe7ba('0x4d')];return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x1189bd[_0xe7ba('0x46')]['id']}})[_0xe7ba('0x26')](handleEntityNotFound(_0xbe2a32,null))[_0xe7ba('0x26')](saveUpdates(_0x1189bd['body'],null))['then'](respondWithResult(_0xbe2a32,null))[_0xe7ba('0x45')](handleError(_0xbe2a32,null));};exports[_0xe7ba('0x4e')]=function(_0x285743,_0x5af106){return db[_0xe7ba('0x2c')][_0xe7ba('0x4e')]()[_0xe7ba('0x26')](respondWithResult(_0x5af106,null))[_0xe7ba('0x45')](handleError(_0x5af106,null));};exports[_0xe7ba('0x4f')]=function(_0x6b6f1,_0xf3a41f,_0x5e6612){var _0x2a6fdd=require(_0xe7ba('0x50'));var _0x316b51=![];var _0x5863c8={};if(_0x6b6f1[_0xe7ba('0x31')][_0xe7ba('0x3f')]&&_0x6b6f1['query'][_0xe7ba('0x3f')]===_0xe7ba('0x51')){_0x5863c8['uniqueid']=_0x6b6f1[_0xe7ba('0x46')]['id'];}else{_0x5863c8['id']=_0x6b6f1['params']['id'];}return db[_0xe7ba('0x2c')][_0xe7ba('0x48')]({'where':_0x5863c8,'attributes':['id',_0xe7ba('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0xf3a41f,null))[_0xe7ba('0x26')](function(_0x1128be){if(_0x1128be){var _0x314549=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],'server/files/screen_recordings',_0x1128be[_0xe7ba('0x4d')]);var _0x455e50=util[_0xe7ba('0x54')](_0xe7ba('0x55'),_0x314549);if(fs[_0xe7ba('0x56')](_0x455e50)){_0x316b51=!![];return _0x2a6fdd['decryptFile'](_0x455e50,_0x314549,config[_0xe7ba('0x57')][_0xe7ba('0x58')])[_0xe7ba('0x26')](function(){return _0x1128be;});}return _0x1128be;}})[_0xe7ba('0x26')](function(_0x57b23e){if(_0x57b23e){var _0x3e31c1=path[_0xe7ba('0x52')](config[_0xe7ba('0x53')],_0xe7ba('0x59'),_0x57b23e[_0xe7ba('0x4d')]);if(!fs[_0xe7ba('0x56')](_0x3e31c1)){throw new db['Sequelize'][(_0xe7ba('0x5a'))](_0xe7ba('0x5b'));}if(_0x57b23e[_0xe7ba('0x5c')]){return _0xf3a41f['download'](_0x3e31c1,_0x57b23e[_0xe7ba('0x5c')]+path[_0xe7ba('0x5d')](_0x3e31c1),function(){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}else{return _0xf3a41f[_0xe7ba('0x4f')](_0x3e31c1,function(_0x45fb0f){if(_0x316b51){fs[_0xe7ba('0x5e')](_0x3e31c1);}});}}})[_0xe7ba('0x45')](function(_0x3351d5){if(_0x3351d5[_0xe7ba('0x5f')]===_0xe7ba('0x5b')){_0xf3a41f[_0xe7ba('0x1b')](0x194)[_0xe7ba('0x60')]('Not\x20found');}else{return handleError(_0xf3a41f,null);}});};exports[_0xe7ba('0x61')]=function(_0x384cea,_0x357af4){return db['ScreenRecording'][_0xe7ba('0x48')]({'where':{'id':_0x384cea['params']['id']}})[_0xe7ba('0x26')](function(_0x194dff){if(_[_0xe7ba('0x62')](_0x194dff)){throw new ReferenceError('Entity\x20not\x20found');}return _0x194dff;})['then'](function(_0x46d06e){var _0x2812af=path[_0xe7ba('0x52')](config['root'],_0xe7ba('0x59'),_0x46d06e[_0xe7ba('0x4d')]);logger[_0xe7ba('0x63')](_0xe7ba('0x64'),_0x2812af);if(!_[_0xe7ba('0x62')](_0x46d06e['value'])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xe7ba('0x66')](_0x2812af);}_0x2812af=_0x2812af+_0xe7ba('0x67');if(!_[_0xe7ba('0x62')](_0x46d06e[_0xe7ba('0x4d')])&&fs[_0xe7ba('0x56')](_0x2812af)){logger[_0xe7ba('0x63')](_0xe7ba('0x65')+_0x2812af+_0xe7ba('0x68'));fs[_0xe7ba('0x66')](_0x2812af);}return _0x46d06e;})[_0xe7ba('0x26')](function(_0x5a5394){if(!_0x5a5394)throw new InternalError();return _0x5a5394[_0xe7ba('0x61')]();})[_0xe7ba('0x26')](function(){_0x357af4[_0xe7ba('0x1b')](0xcc)[_0xe7ba('0x1c')]();})['catch'](handleError(_0x357af4,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 90a7131..7b6ce71 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 _0xbd58=['exports','define','ScreenRecording','screen_recordings','interactionid','../../config/logger','bluebird','path','rimraf','../../config/environment','./screenRecording.attributes'];(function(_0x21968e,_0x56c1c4){var _0x30ebc8=function(_0x5a2352){while(--_0x5a2352){_0x21968e['push'](_0x21968e['shift']());}};_0x30ebc8(++_0x56c1c4);}(_0xbd58,0x19c));var _0x8bd5=function(_0x161cd6,_0x56da19){_0x161cd6=_0x161cd6-0x0;var _0x5a75db=_0xbd58[_0x161cd6];return _0x5a75db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8bd5('0x0'))('api');var moment=require('moment');var BPromise=require(_0x8bd5('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bd5('0x2'));var rimraf=require(_0x8bd5('0x3'));var config=require(_0x8bd5('0x4'));var attributes=require(_0x8bd5('0x5'));module[_0x8bd5('0x6')]=function(_0x2577db,_0xf0825d){return _0x2577db[_0x8bd5('0x7')](_0x8bd5('0x8'),attributes,{'tableName':_0x8bd5('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x8bd5('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x54e1=['exports','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','bluebird','request-promise','path','./screenRecording.attributes'];(function(_0x2f45ea,_0x15c656){var _0x485a84=function(_0x4a1fe3){while(--_0x4a1fe3){_0x2f45ea['push'](_0x2f45ea['shift']());}};_0x485a84(++_0x15c656);}(_0x54e1,0x17a));var _0x154e=function(_0x454e8f,_0xc51eda){_0x454e8f=_0x454e8f-0x0;var _0x3f678c=_0x54e1[_0x454e8f];return _0x3f678c;};'use strict';var _=require('lodash');var util=require(_0x154e('0x0'));var logger=require(_0x154e('0x1'))(_0x154e('0x2'));var moment=require('moment');var BPromise=require(_0x154e('0x3'));var rp=require(_0x154e('0x4'));var fs=require('fs');var path=require(_0x154e('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x154e('0x6'));module[_0x154e('0x7')]=function(_0x282b7b,_0x3a0739){return _0x282b7b['define'](_0x154e('0x8'),attributes,{'tableName':_0x154e('0x9'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x154e('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index a5572b6..b2d2025 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 _0x786c=['code','ScreenRecording,\x20%s,\x20%s','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request\x20sent','stringify','error'];(function(_0x47888a,_0x7d2f3a){var _0x2b15a4=function(_0x12a3e9){while(--_0x12a3e9){_0x47888a['push'](_0x47888a['shift']());}};_0x2b15a4(++_0x7d2f3a);}(_0x786c,0x159));var _0xc786=function(_0x594ac1,_0x5a95aa){_0x594ac1=_0x594ac1-0x0;var _0x42744e=_0x786c[_0x594ac1];return _0x42744e;};'use strict';var _=require(_0xc786('0x0'));var util=require(_0xc786('0x1'));var moment=require(_0xc786('0x2'));var BPromise=require(_0xc786('0x3'));var rs=require(_0xc786('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc786('0x5'))['db'];var utils=require(_0xc786('0x6'));var logger=require(_0xc786('0x7'))(_0xc786('0x8'));var config=require(_0xc786('0x9'));var jayson=require(_0xc786('0xa'));var client=jayson['client'][_0xc786('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b9357,_0xe43e67,_0x58878b){return new BPromise(function(_0x259a3c,_0x182cec){return client['request'](_0x4b9357,_0x58878b)['then'](function(_0x59878b){logger['info']('ScreenRecording,\x20%s,\x20%s',_0xe43e67,'request\x20sent');logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0xe43e67,_0xc786('0xc'),JSON[_0xc786('0xd')](_0x59878b));if(_0x59878b[_0xc786('0xe')]){if(_0x59878b[_0xc786('0xe')][_0xc786('0xf')]===0x1f4){logger['error'](_0xc786('0x10'),_0xe43e67,_0x59878b[_0xc786('0xe')][_0xc786('0x11')]);return _0x182cec(_0x59878b[_0xc786('0xe')]['message']);}logger[_0xc786('0xe')](_0xc786('0x10'),_0xe43e67,_0x59878b[_0xc786('0xe')][_0xc786('0x11')]);return _0x259a3c(_0x59878b[_0xc786('0xe')]['message']);}else{logger[_0xc786('0x12')](_0xc786('0x10'),_0xe43e67,'request\x20sent');_0x259a3c(_0x59878b['result'][_0xc786('0x11')]);}})[_0xc786('0x13')](function(_0x3c701b){logger[_0xc786('0xe')](_0xc786('0x10'),_0xe43e67,_0x3c701b);_0x182cec(_0x3c701b);});});} \ No newline at end of file +var _0x17fe=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0x17fe,0x131));var _0xe17f=function(_0x10166e,_0x4d595d){_0x10166e=_0x10166e-0x0;var _0xe53d72=_0x17fe[_0x10166e];return _0xe53d72;};'use strict';var _=require('lodash');var util=require(_0xe17f('0x0'));var moment=require(_0xe17f('0x1'));var BPromise=require(_0xe17f('0x2'));var rs=require(_0xe17f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe17f('0x4'))['db'];var utils=require(_0xe17f('0x5'));var logger=require(_0xe17f('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe17f('0x7'));var client=jayson[_0xe17f('0x8')][_0xe17f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x46937d,_0x1aaa8d,_0x63424e){return new BPromise(function(_0x5217a6,_0x3da15f){return client[_0xe17f('0xa')](_0x46937d,_0x63424e)[_0xe17f('0xb')](function(_0x5cfdfb){logger[_0xe17f('0xc')](_0xe17f('0xd'),_0x1aaa8d,'request\x20sent');logger[_0xe17f('0xe')](_0xe17f('0xf'),_0x1aaa8d,_0xe17f('0x10'),JSON[_0xe17f('0x11')](_0x5cfdfb));if(_0x5cfdfb[_0xe17f('0x12')]){if(_0x5cfdfb[_0xe17f('0x12')]['code']===0x1f4){logger[_0xe17f('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x1aaa8d,_0x5cfdfb[_0xe17f('0x12')][_0xe17f('0x13')]);return _0x3da15f(_0x5cfdfb[_0xe17f('0x12')][_0xe17f('0x13')]);}logger[_0xe17f('0x12')](_0xe17f('0xd'),_0x1aaa8d,_0x5cfdfb[_0xe17f('0x12')]['message']);return _0x5217a6(_0x5cfdfb['error']['message']);}else{logger[_0xe17f('0xc')](_0xe17f('0xd'),_0x1aaa8d,_0xe17f('0x10'));_0x5217a6(_0x5cfdfb[_0xe17f('0x14')][_0xe17f('0x13')]);}})[_0xe17f('0x15')](function(_0xdd094){logger[_0xe17f('0x12')]('ScreenRecording,\x20%s,\x20%s',_0x1aaa8d,_0xdd094);_0x3da15f(_0xdd094);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 6bbc4ea..728fa9f 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 _0x98ec=['addPreferred','favicon','/:id/favicon','addFavicon','put','isAuthenticated','update','exports','multer','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','/now','getDate','/:id','show','/:id/logo','getLogo','getLogoLogin','/:id/preferred','diskStorage','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','addLogo','root','/:id/logo_login','addLogoLogin','file'];(function(_0xdd5da0,_0x37f7b0){var _0x66fdd8=function(_0x4ea342){while(--_0x4ea342){_0xdd5da0['push'](_0xdd5da0['shift']());}};_0x66fdd8(++_0x37f7b0);}(_0x98ec,0x112));var _0xc98e=function(_0x1b8a39,_0xbbb945){_0x1b8a39=_0x1b8a39-0x0;var _0x45bd44=_0x98ec[_0x1b8a39];return _0x45bd44;};'use strict';var multer=require(_0xc98e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc98e('0x1'));var express=require('express');var router=express[_0xc98e('0x2')]();var fs_extra=require(_0xc98e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc98e('0x4'));var config=require(_0xc98e('0x5'));var controller=require('./setting.controller');router[_0xc98e('0x6')]('/',auth['isAuthenticated'](),controller[_0xc98e('0x7')]);router[_0xc98e('0x6')](_0xc98e('0x8'),controller[_0xc98e('0x9')]);router[_0xc98e('0x6')](_0xc98e('0xa'),controller[_0xc98e('0xb')]);router[_0xc98e('0x6')](_0xc98e('0xc'),controller[_0xc98e('0xd')]);router[_0xc98e('0x6')]('/:id/logo_login',controller[_0xc98e('0xe')]);router[_0xc98e('0x6')]('/:id/gdpr',controller['gdpr']);router['get'](_0xc98e('0xf'),controller['getPreferred']);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x276db0,_0x503cad,_0x584401){_0x584401(null,path[_0xc98e('0x11')](config['root'],_0xc98e('0x12')));},'filename':function(_0x11d575,_0x40eaaa,_0x191d9b){_0x191d9b(null,util[_0xc98e('0x13')](_0xc98e('0x14'),'logo',path[_0xc98e('0x15')](_0x40eaaa[_0xc98e('0x16')])));}})});router[_0xc98e('0x17')]('/:id/logo',upload[_0xc98e('0x18')]('file'),controller[_0xc98e('0x19')]);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x395235,_0x22034a,_0x41493b){_0x41493b(null,path[_0xc98e('0x11')](config[_0xc98e('0x1a')],_0xc98e('0x12')));},'filename':function(_0x2c5636,_0x34d20b,_0x49e4ae){_0x49e4ae(null,util['format']('%s%s','logologin',path[_0xc98e('0x15')](_0x34d20b[_0xc98e('0x16')])));}})});router[_0xc98e('0x17')](_0xc98e('0x1b'),upload['single']('file'),controller[_0xc98e('0x1c')]);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x143eec,_0x13b558,_0x7c616c){_0x7c616c(null,path['join'](config['root'],_0xc98e('0x12')));},'filename':function(_0x570f13,_0x3609d2,_0x49c8fd){_0x49c8fd(null,util[_0xc98e('0x13')](_0xc98e('0x14'),'preferred',path[_0xc98e('0x15')](_0x3609d2['originalname'])));}})});router['post']('/:id/preferred',upload['single'](_0xc98e('0x1d')),controller[_0xc98e('0x1e')]);var upload=multer({'storage':multer[_0xc98e('0x10')]({'destination':function(_0x15399a,_0x491649,_0x52677d){_0x52677d(null,path[_0xc98e('0x11')](config[_0xc98e('0x1a')],'server/files/images/logos/'));},'filename':function(_0x45a496,_0x163b81,_0x23d7d8){_0x23d7d8(null,util[_0xc98e('0x13')]('%s%s',_0xc98e('0x1f'),path[_0xc98e('0x15')](_0x163b81['originalname'])));}})});router[_0xc98e('0x17')](_0xc98e('0x20'),upload[_0xc98e('0x18')](_0xc98e('0x1d')),controller[_0xc98e('0x21')]);router[_0xc98e('0x22')](_0xc98e('0xa'),auth[_0xc98e('0x23')](),controller[_0xc98e('0x24')]);module[_0xc98e('0x25')]=router; \ No newline at end of file +var _0x42db=['single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','favicon','put','update','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now','getDate','/:id','getLogo','/:id/logo_login','getLogoLogin','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','/:id/logo'];(function(_0x50db57,_0x2273c3){var _0x50f054=function(_0x231e4c){while(--_0x231e4c){_0x50db57['push'](_0x50db57['shift']());}};_0x50f054(++_0x2273c3);}(_0x42db,0x129));var _0xb42d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x42db[_0x20a584];return _0x4b41a8;};'use strict';var multer=require('multer');var util=require(_0xb42d('0x0'));var path=require('path');var timeout=require(_0xb42d('0x1'));var express=require(_0xb42d('0x2'));var router=express['Router']();var fs_extra=require(_0xb42d('0x3'));var auth=require(_0xb42d('0x4'));var interaction=require(_0xb42d('0x5'));var config=require(_0xb42d('0x6'));var controller=require(_0xb42d('0x7'));router['get']('/',auth[_0xb42d('0x8')](),controller[_0xb42d('0x9')]);router[_0xb42d('0xa')](_0xb42d('0xb'),controller[_0xb42d('0xc')]);router[_0xb42d('0xa')](_0xb42d('0xd'),controller['show']);router[_0xb42d('0xa')]('/:id/logo',controller[_0xb42d('0xe')]);router[_0xb42d('0xa')](_0xb42d('0xf'),controller[_0xb42d('0x10')]);router['get']('/:id/gdpr',controller['gdpr']);router[_0xb42d('0xa')](_0xb42d('0x11'),controller[_0xb42d('0x12')]);router[_0xb42d('0xa')](_0xb42d('0x13'),controller['getFavicon']);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0xdaa562,_0x5a93fe,_0x1a5fc1){_0x1a5fc1(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],_0xb42d('0x17')));},'filename':function(_0x5252a1,_0xc68689,_0x474fe1){_0x474fe1(null,util[_0xb42d('0x18')](_0xb42d('0x19'),_0xb42d('0x1a'),path[_0xb42d('0x1b')](_0xc68689[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')](_0xb42d('0x1e'),upload[_0xb42d('0x1f')](_0xb42d('0x20')),controller[_0xb42d('0x21')]);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0x1aaed8,_0x16fcd8,_0x47f15e){_0x47f15e(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],_0xb42d('0x17')));},'filename':function(_0x56deb5,_0x47284e,_0x52c6aa){_0x52c6aa(null,util['format'](_0xb42d('0x19'),_0xb42d('0x22'),path[_0xb42d('0x1b')](_0x47284e[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')](_0xb42d('0xf'),upload['single'](_0xb42d('0x20')),controller[_0xb42d('0x23')]);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0x15119f,_0x1d4c2f,_0x2e5a52){_0x2e5a52(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],'server/files/images/logos/'));},'filename':function(_0x141000,_0x16ad18,_0x321c29){_0x321c29(null,util[_0xb42d('0x18')]('%s%s',_0xb42d('0x24'),path[_0xb42d('0x1b')](_0x16ad18[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')]('/:id/preferred',upload['single'](_0xb42d('0x20')),controller[_0xb42d('0x25')]);var upload=multer({'storage':multer[_0xb42d('0x14')]({'destination':function(_0x2394f4,_0x9a3a3f,_0x84c5ca){_0x84c5ca(null,path[_0xb42d('0x15')](config[_0xb42d('0x16')],_0xb42d('0x17')));},'filename':function(_0x27cd6a,_0x3b3145,_0x7a6ff7){_0x7a6ff7(null,util[_0xb42d('0x18')](_0xb42d('0x19'),_0xb42d('0x26'),path[_0xb42d('0x1b')](_0x3b3145[_0xb42d('0x1c')])));}})});router[_0xb42d('0x1d')](_0xb42d('0x13'),upload[_0xb42d('0x1f')](_0xb42d('0x20')),controller['addFavicon']);router[_0xb42d('0x27')](_0xb42d('0xd'),auth[_0xb42d('0x8')](),controller[_0xb42d('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 78f1b31..ba238cf 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 _0x567d=['https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','STRING','BOOLEAN'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x567d,0xf3));var _0xd567=function(_0xf4d9d,_0x31e068){_0xf4d9d=_0xf4d9d-0x0;var _0x35d1e0=_0x567d[_0xf4d9d];return _0x35d1e0;};'use strict';var Sequelize=require(_0xd567('0x0'));module[_0xd567('0x1')]={'min_internal':{'type':Sequelize[_0xd567('0x2')](0xb),'unique':_0xd567('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xd567('0x2')](0xb),'unique':_0xd567('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xd567('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xd567('0x5')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xd567('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xd567('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xd567('0x5')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xd567('0x5')]},'turnpassword':{'type':Sequelize[_0xd567('0x5')]},'pageTitle':{'type':Sequelize[_0xd567('0x5')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xd567('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xd567('0x7')},'enableEmailPreview':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xd567('0x5')],'defaultValue':_0xd567('0x8')},'chatTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xd567('0x5')]},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xd567('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xd567('0x5')]},'defaultFavicon':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xd567('0x2')]},'sentimentRegion':{'type':Sequelize[_0xd567('0x5')]},'language':{'type':Sequelize[_0xd567('0x5')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xd567('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xd567('0x2')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xd567('0x2')](0x2)[_0xd567('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xd567('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xd567('0x2')](0x2)[_0xd567('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xd567('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize['INTEGER'],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xd567('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xc611=['STRING','BOOLEAN','alternate','UNSIGNED','INTEGER','min_internal','min_mailbox'];(function(_0x834bb6,_0x1c5e35){var _0xa35d00=function(_0x14aeb3){while(--_0x14aeb3){_0x834bb6['push'](_0x834bb6['shift']());}};_0xa35d00(++_0x1c5e35);}(_0xc611,0x97));var _0x1c61=function(_0x7622c8,_0x1370aa){_0x7622c8=_0x7622c8-0x0;var _0xc26521=_0xc611[_0x7622c8];return _0xc26521;};'use strict';var Sequelize=require('sequelize');module['exports']={'min_internal':{'type':Sequelize[_0x1c61('0x0')](0xb),'unique':_0x1c61('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x1c61('0x0')](0xb),'unique':_0x1c61('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x1c61('0x0')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x1c61('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x1c61('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x1c61('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x1c61('0x3')]},'turnaddr':{'type':Sequelize[_0x1c61('0x3')]},'turnusername':{'type':Sequelize[_0x1c61('0x3')]},'turnpassword':{'type':Sequelize[_0x1c61('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x1c61('0x0')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x1c61('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x1c61('0x5')},'chatTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x1c61('0x3')]},'defaultPreferred':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x1c61('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x1c61('0x3')]},'defaultFavicon':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x1c61('0x0')]},'transcribeRegion':{'type':Sequelize[_0x1c61('0x3')]},'sentiment':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x1c61('0x0')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x1c61('0x3')]},'bucket':{'type':Sequelize[_0x1c61('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x1c61('0x0')](0x2)[_0x1c61('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0x1c61('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x1c61('0x0')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x1c61('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x1c61('0x0')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x1c61('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 9d1fe9e..522fbc7 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 _0xe062=['util','path','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','json','apply','update','destroy','name','Setting','type','key','query','keys','intersection','attributes','fields','length','model','hasOwnProperty','sort','where','filters','merge','filter','includeAll','findAll','rows','show','rawAttributes','include','options','body','file','filename','logo','find','params','getLogo','server/files/images/logos','getLicense','loginLogo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','root','join','toLower','upperFirst','ValidationError','\x20not\x20found','download','getLogoLogin','defaultPreferred','default_loginLogo.svg','default','Sequelize','gdpr','default_preferred.png','custom','addFavicon','default_favicon.ico','getDate','now','utcOffset','send','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0x1f7e36,_0x4680ab){var _0x1a71f3=function(_0x69b7bc){while(--_0x69b7bc){_0x1f7e36['push'](_0x1f7e36['shift']());}};_0x1a71f3(++_0x4680ab);}(_0xe062,0xd5));var _0x2e06=function(_0x511451,_0x423f1c){_0x511451=_0x511451-0x0;var _0x16da1d=_0xe062[_0x511451];return _0x16da1d;};'use strict';var emlformat=require(_0x2e06('0x0'));var rimraf=require(_0x2e06('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2e06('0x2'));var rp=require(_0x2e06('0x3'));var moment=require(_0x2e06('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x2e06('0x5'));var path=require(_0x2e06('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x2e06('0x7'));var fs=require('fs');var fs_extra=require(_0x2e06('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x2e06('0x9'));var jsforce=require(_0x2e06('0xa'));var deskjs=require(_0x2e06('0xb'));var toCsv=require(_0x2e06('0xc'));var querystring=require(_0x2e06('0xd'));var Papa=require(_0x2e06('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2e06('0xf'));var as=require(_0x2e06('0x10'));var hardwareService=require(_0x2e06('0x11'));var logger=require('../../config/logger')(_0x2e06('0x12'));var utils=require(_0x2e06('0x13'));var config=require(_0x2e06('0x14'));var licenseUtil=require(_0x2e06('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0x2e06('0x16'));var client=jayson[_0x2e06('0x17')]['http']({'port':0x232a});function respondWithRpcPromise(_0xd781db,_0x12fbe2,_0x56f769,_0x745e06){return new BPromise(function(_0x2a3a2a,_0x9a3ab4){var _0x25909a=_0x745e06||client;return _0x25909a[_0x2e06('0x18')](_0xd781db,_0x56f769)[_0x2e06('0x19')](function(_0x5e4795){logger[_0x2e06('0x1a')](_0x2e06('0x1b'),_0x12fbe2,_0x2e06('0x1c'));logger[_0x2e06('0x1d')](_0x2e06('0x1e'),_0x12fbe2,_0x2e06('0x1c'),JSON[_0x2e06('0x1f')](_0x5e4795));if(_0x5e4795[_0x2e06('0x20')]){if(_0x5e4795[_0x2e06('0x20')]['code']===0x1f4){logger[_0x2e06('0x20')](_0x2e06('0x1b'),_0x12fbe2,_0x5e4795['error'][_0x2e06('0x21')]);return _0x9a3ab4(_0x5e4795[_0x2e06('0x20')][_0x2e06('0x21')]);}logger[_0x2e06('0x20')](_0x2e06('0x1b'),_0x12fbe2,_0x5e4795[_0x2e06('0x20')][_0x2e06('0x21')]);return _0x2a3a2a(_0x5e4795[_0x2e06('0x20')][_0x2e06('0x21')]);}else{logger[_0x2e06('0x1a')](_0x2e06('0x1b'),_0x12fbe2,_0x2e06('0x1c'));_0x2a3a2a(_0x5e4795[_0x2e06('0x22')][_0x2e06('0x21')]);}})[_0x2e06('0x23')](function(_0x38b5db){logger[_0x2e06('0x20')](_0x2e06('0x1b'),_0x12fbe2,_0x38b5db);_0x9a3ab4(_0x38b5db);});});}function respondWithStatusCode(_0x4963eb,_0x21eea1){_0x21eea1=_0x21eea1||0xcc;return function(_0x1c1e6f){if(_0x1c1e6f){return _0x4963eb[_0x2e06('0x24')](_0x21eea1);}return _0x4963eb[_0x2e06('0x25')](_0x21eea1)[_0x2e06('0x26')]();};}function respondWithResult(_0x10deac,_0x73d502){_0x73d502=_0x73d502||0xc8;return function(_0x1ed50e){if(_0x1ed50e){return _0x10deac[_0x2e06('0x25')](_0x73d502)['json'](_0x1ed50e);}};}function respondWithFilteredResult(_0x43e830,_0x123daf){return function(_0xdcb6f8){if(_0xdcb6f8){var _0x3d1011=typeof _0x123daf[_0x2e06('0x27')]==='undefined'&&typeof _0x123daf[_0x2e06('0x28')]==='undefined';var _0x1ed86f=_0xdcb6f8[_0x2e06('0x29')];var _0x577278=_0x3d1011?0x0:_0x123daf[_0x2e06('0x27')];var _0x18f703=_0x3d1011?_0xdcb6f8[_0x2e06('0x29')]:_0x123daf['offset']+_0x123daf['limit'];var _0x2cb75f;if(_0x18f703>=_0x1ed86f){_0x18f703=_0x1ed86f;_0x2cb75f=0xc8;}else{_0x2cb75f=0xce;}_0x43e830[_0x2e06('0x25')](_0x2cb75f);return _0x43e830[_0x2e06('0x2a')](_0x2e06('0x2b'),_0x577278+'-'+_0x18f703+'/'+_0x1ed86f)[_0x2e06('0x2c')](_0xdcb6f8);}return null;};}function patchUpdates(_0x63e387){return function(_0x25b1f2){try{jsonpatch[_0x2e06('0x2d')](_0x25b1f2,_0x63e387,!![]);}catch(_0x18aab8){return BPromise['reject'](_0x18aab8);}return _0x25b1f2['save']();};}function saveUpdates(_0x4dfc10,_0x4a265b){return function(_0x40a4a7){if(_0x40a4a7){return _0x40a4a7[_0x2e06('0x2e')](_0x4dfc10)['then'](function(_0x321e27){return _0x321e27;});}return null;};}function removeEntity(_0x4274e7,_0x2c3777){return function(_0x4f8579){if(_0x4f8579){return _0x4f8579[_0x2e06('0x2f')]()[_0x2e06('0x19')](function(){_0x4274e7['status'](0xcc)[_0x2e06('0x26')]();});}};}function handleEntityNotFound(_0x13acb4,_0x177d3c){return function(_0x2d1e03){if(!_0x2d1e03){_0x13acb4['sendStatus'](0x194);}return _0x2d1e03;};}function handleError(_0x3c0cee,_0x11a55f){_0x11a55f=_0x11a55f||0x1f4;return function(_0x2fd67c){logger[_0x2e06('0x20')](_0x2fd67c['stack']);if(_0x2fd67c[_0x2e06('0x30')]){delete _0x2fd67c[_0x2e06('0x30')];}_0x3c0cee['status'](_0x11a55f)['send'](_0x2fd67c);};}exports['index']=function(_0x2ada2b,_0x5a83ea){var _0x5a0f36={},_0x370235={},_0x1b28c6={'count':0x0,'rows':[]};var _0x37ce38=_['map'](db[_0x2e06('0x31')]['rawAttributes'],function(_0x6d6c9f){return{'name':_0x6d6c9f['fieldName'],'type':_0x6d6c9f[_0x2e06('0x32')][_0x2e06('0x33')]};});_0x370235['model']=_['map'](_0x37ce38,_0x2e06('0x30'));_0x370235[_0x2e06('0x34')]=_[_0x2e06('0x35')](_0x2ada2b[_0x2e06('0x34')]);_0x370235['filters']=_[_0x2e06('0x36')](_0x370235['model'],_0x370235['query']);_0x5a0f36[_0x2e06('0x37')]=_['intersection'](_0x370235['model'],qs[_0x2e06('0x38')](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x38')]));_0x5a0f36[_0x2e06('0x37')]=_0x5a0f36[_0x2e06('0x37')][_0x2e06('0x39')]?_0x5a0f36[_0x2e06('0x37')]:_0x370235[_0x2e06('0x3a')];if(!_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x3b')]('nolimit')){_0x5a0f36[_0x2e06('0x28')]=qs[_0x2e06('0x28')](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x28')]);_0x5a0f36[_0x2e06('0x27')]=qs['offset'](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x27')]);}_0x5a0f36['order']=qs['sort'](_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x3c')]);_0x5a0f36[_0x2e06('0x3d')]=qs[_0x2e06('0x3e')](_['pick'](_0x2ada2b[_0x2e06('0x34')],_0x370235['filters']),_0x37ce38);if(_0x2ada2b[_0x2e06('0x34')]['filter']){_0x5a0f36[_0x2e06('0x3d')]=_[_0x2e06('0x3f')](_0x5a0f36[_0x2e06('0x3d')],{'$or':_['map'](_0x37ce38,function(_0x208ef5){if(_0x208ef5[_0x2e06('0x32')]!=='VIRTUAL'){var _0x2452da={};_0x2452da[_0x208ef5[_0x2e06('0x30')]]={'$like':'%'+_0x2ada2b[_0x2e06('0x34')][_0x2e06('0x40')]+'%'};return _0x2452da;}})});}_0x5a0f36=_[_0x2e06('0x3f')]({},_0x5a0f36,_0x2ada2b['options']);var _0xbb7917={'where':_0x5a0f36[_0x2e06('0x3d')]};return db[_0x2e06('0x31')]['count'](_0xbb7917)[_0x2e06('0x19')](function(_0x48e446){_0x1b28c6[_0x2e06('0x29')]=_0x48e446;if(_0x2ada2b['query'][_0x2e06('0x41')]){_0x5a0f36['include']=[{'all':!![]}];}return db[_0x2e06('0x31')][_0x2e06('0x42')](_0x5a0f36);})['then'](function(_0x111509){_0x1b28c6[_0x2e06('0x43')]=_0x111509;return _0x1b28c6;})[_0x2e06('0x19')](respondWithFilteredResult(_0x5a83ea,_0x5a0f36))[_0x2e06('0x23')](handleError(_0x5a83ea,null));};exports[_0x2e06('0x44')]=function(_0x5a749a,_0x2dcdaa){var _0x508fff={'raw':![],'where':{'id':_0x5a749a['params']['id']}},_0x1de5dd={};_0x1de5dd[_0x2e06('0x3a')]=_[_0x2e06('0x35')](db[_0x2e06('0x31')][_0x2e06('0x45')]);_0x1de5dd['query']=_[_0x2e06('0x35')](_0x5a749a[_0x2e06('0x34')]);_0x1de5dd['filters']=_['intersection'](_0x1de5dd[_0x2e06('0x3a')],_0x1de5dd['query']);_0x508fff[_0x2e06('0x37')]=_[_0x2e06('0x36')](_0x1de5dd['model'],qs[_0x2e06('0x38')](_0x5a749a[_0x2e06('0x34')][_0x2e06('0x38')]));_0x508fff[_0x2e06('0x37')]=_0x508fff[_0x2e06('0x37')]['length']?_0x508fff['attributes']:_0x1de5dd[_0x2e06('0x3a')];if(_0x5a749a[_0x2e06('0x34')][_0x2e06('0x41')]){_0x508fff[_0x2e06('0x46')]=[{'all':!![]}];}_0x508fff=_['merge']({},_0x508fff,_0x5a749a[_0x2e06('0x47')]);return db[_0x2e06('0x31')]['find'](_0x508fff)[_0x2e06('0x19')](handleEntityNotFound(_0x2dcdaa,null))[_0x2e06('0x19')](respondWithResult(_0x2dcdaa,null))['catch'](handleError(_0x2dcdaa,null));};exports['update']=function(_0x342446,_0x2b242b){if(_0x342446[_0x2e06('0x48')]['id']){delete _0x342446[_0x2e06('0x48')]['id'];}return db[_0x2e06('0x31')]['find']({'where':{'id':_0x342446['params']['id']}})['then'](handleEntityNotFound(_0x2b242b,null))[_0x2e06('0x19')](saveUpdates(_0x342446[_0x2e06('0x48')],null))[_0x2e06('0x19')](respondWithResult(_0x2b242b,null))[_0x2e06('0x23')](handleError(_0x2b242b,null));};exports['addLogo']=function(_0x4abc51,_0x56757f,_0xfe7903){if(_0x4abc51[_0x2e06('0x49')]&&_0x4abc51['file'][_0x2e06('0x4a')]){_0x4abc51['body'][_0x2e06('0x4b')]=_0x4abc51[_0x2e06('0x49')][_0x2e06('0x4a')];}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x4abc51[_0x2e06('0x4d')]['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0x56757f,null))[_0x2e06('0x19')](saveUpdates(_0x4abc51['body'],null))[_0x2e06('0x19')](respondWithResult(_0x56757f,null))[_0x2e06('0x23')](handleError(_0x56757f,null));};exports['addLogoLogin']=function(_0x44ae67,_0x52448a,_0xb25fec){if(_0x44ae67[_0x2e06('0x49')]&&_0x44ae67[_0x2e06('0x49')][_0x2e06('0x4a')]){_0x44ae67[_0x2e06('0x48')]['loginLogo']=_0x44ae67['file'][_0x2e06('0x4a')];}return db['Setting'][_0x2e06('0x4c')]({'where':{'id':_0x44ae67[_0x2e06('0x4d')]['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0x52448a,null))['then'](saveUpdates(_0x44ae67['body'],null))['then'](respondWithResult(_0x52448a,null))['catch'](handleError(_0x52448a,null));};var utilLicense=require(_0x2e06('0x15'));exports[_0x2e06('0x4e')]=function(_0x240a00,_0x4e155f,_0xdcc1fa){var _0x56fcc0=_0x2e06('0x4f');var _0x1c278e={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x520231){if(_0x520231){_0x1c278e=_0x520231;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x240a00[_0x2e06('0x4d')]['id']},'attributes':[_0x2e06('0x4b'),_0x2e06('0x51'),_0x2e06('0x52'),_0x2e06('0x53'),_0x2e06('0x54'),_0x2e06('0x55'),'defaultPreferred',_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x4e155f,null))['then'](function(_0x3c17d5){if(_0x3c17d5){var _0x2cac99=_0x3c17d5[_0x2e06('0x4b')]&&fs[_0x2e06('0x57')](path['join'](config[_0x2e06('0x58')],_0x56fcc0,_['toLower'](_0x3c17d5[_0x2e06('0x4b')])))?path[_0x2e06('0x59')](config['root'],_0x56fcc0,_[_0x2e06('0x5a')](_0x3c17d5[_0x2e06('0x4b')])):path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x56fcc0,_['toLower']('default_logo.svg'));var _0x3fb063='default'+_[_0x2e06('0x5b')](_0x2e06('0x4b'));if(_0x3c17d5[_0x3fb063]||!_0x1c278e['custom']){_0x2cac99=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x56fcc0,_['toLower']('default_logo.svg'));}if(!fs[_0x2e06('0x57')](_0x2cac99)){throw new db['Sequelize'][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x4b'))+_0x2e06('0x5d'));}return _0x4e155f[_0x2e06('0x5e')](_0x2cac99);}})[_0x2e06('0x23')](handleError(_0x4e155f,null));};var utilLicense=require(_0x2e06('0x15'));exports[_0x2e06('0x5f')]=function(_0x11d138,_0x46e269,_0x2dd1f2){var _0x1d7e5c=_0x2e06('0x4f');var _0x58acbc={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x28304a){if(_0x28304a){_0x58acbc=_0x28304a;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x11d138[_0x2e06('0x4d')]['id']},'attributes':['logo','loginLogo','preferred','favicon',_0x2e06('0x54'),_0x2e06('0x55'),_0x2e06('0x60'),_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x46e269,null))[_0x2e06('0x19')](function(_0x198a86){if(_0x198a86){var _0x4198d0=_0x198a86[_0x2e06('0x51')]&&fs[_0x2e06('0x57')](path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_['toLower'](_0x198a86[_0x2e06('0x51')])))?path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_[_0x2e06('0x5a')](_0x198a86[_0x2e06('0x51')])):path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_[_0x2e06('0x5a')](_0x2e06('0x61')));var _0x3aef3f=_0x2e06('0x62')+_[_0x2e06('0x5b')](_0x2e06('0x51'));if(_0x198a86[_0x3aef3f]||!_0x58acbc['custom']){_0x4198d0=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x1d7e5c,_[_0x2e06('0x5a')](_0x2e06('0x61')));}if(!fs[_0x2e06('0x57')](_0x4198d0)){throw new db[(_0x2e06('0x63'))][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x51'))+'\x20not\x20found');}return _0x46e269['download'](_0x4198d0);}})['catch'](handleError(_0x46e269,null));};exports[_0x2e06('0x64')]=function(_0x23dc3b,_0x23edfb){return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x23dc3b['params']['id']},'attributes':['securePassword']})[_0x2e06('0x19')](respondWithResult(_0x23edfb,null))['catch'](handleError(_0x23edfb,null));};exports['addPreferred']=function(_0x429ab2,_0x23c9c1,_0x48901d){if(_0x429ab2[_0x2e06('0x49')]&&_0x429ab2['file'][_0x2e06('0x4a')]){_0x429ab2[_0x2e06('0x48')][_0x2e06('0x52')]=_0x429ab2[_0x2e06('0x49')]['filename'];}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x429ab2[_0x2e06('0x4d')]['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0x23c9c1,null))['then'](saveUpdates(_0x429ab2[_0x2e06('0x48')],null))['then'](respondWithResult(_0x23c9c1,null))['catch'](handleError(_0x23c9c1,null));};var utilLicense=require(_0x2e06('0x15'));exports['getPreferred']=function(_0x5ac6c1,_0x1a7bc2,_0x216e2e){var _0x764ba0=_0x2e06('0x4f');var _0x5606d3={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x346cda){if(_0x346cda){_0x5606d3=_0x346cda;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x5ac6c1[_0x2e06('0x4d')]['id']},'attributes':[_0x2e06('0x4b'),_0x2e06('0x51'),_0x2e06('0x52'),_0x2e06('0x53'),_0x2e06('0x54'),_0x2e06('0x55'),_0x2e06('0x60'),_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x1a7bc2,null))[_0x2e06('0x19')](function(_0x2d3a6b){if(_0x2d3a6b){var _0x41d705=_0x2d3a6b[_0x2e06('0x52')]&&fs[_0x2e06('0x57')](path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x764ba0,_['toLower'](_0x2d3a6b[_0x2e06('0x52')])))?path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x764ba0,_['toLower'](_0x2d3a6b[_0x2e06('0x52')])):path['join'](config['root'],_0x764ba0,_[_0x2e06('0x5a')](_0x2e06('0x65')));var _0x5a0d9d=_0x2e06('0x62')+_[_0x2e06('0x5b')](_0x2e06('0x52'));if(_0x2d3a6b[_0x5a0d9d]||!_0x5606d3[_0x2e06('0x66')]||!_0x5606d3['preferred']){_0x41d705=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x764ba0,_[_0x2e06('0x5a')](_0x2e06('0x65')));}if(!fs[_0x2e06('0x57')](_0x41d705)){throw new db['Sequelize'][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x52'))+_0x2e06('0x5d'));}return _0x1a7bc2[_0x2e06('0x5e')](_0x41d705);}})[_0x2e06('0x23')](handleError(_0x1a7bc2,null));};exports[_0x2e06('0x67')]=function(_0x136bd0,_0xd49423,_0x2de795){if(_0x136bd0['file']&&_0x136bd0[_0x2e06('0x49')][_0x2e06('0x4a')]){_0x136bd0[_0x2e06('0x48')][_0x2e06('0x53')]=_0x136bd0[_0x2e06('0x49')]['filename'];}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x136bd0['params']['id']}})[_0x2e06('0x19')](handleEntityNotFound(_0xd49423,null))[_0x2e06('0x19')](saveUpdates(_0x136bd0[_0x2e06('0x48')],null))['then'](respondWithResult(_0xd49423,null))[_0x2e06('0x23')](handleError(_0xd49423,null));};var utilLicense=require(_0x2e06('0x15'));exports['getFavicon']=function(_0x433701,_0x121ec4,_0x1e1b80){var _0x4c3605=_0x2e06('0x4f');var _0x15f0b5={'custom':![]};return utilLicense[_0x2e06('0x50')]()[_0x2e06('0x19')](function(_0x535aca){if(_0x535aca){_0x15f0b5=_0x535aca;}return db[_0x2e06('0x31')][_0x2e06('0x4c')]({'where':{'id':_0x433701[_0x2e06('0x4d')]['id']},'attributes':[_0x2e06('0x4b'),_0x2e06('0x51'),_0x2e06('0x52'),_0x2e06('0x53'),_0x2e06('0x54'),_0x2e06('0x55'),_0x2e06('0x60'),_0x2e06('0x56')],'raw':!![]});})[_0x2e06('0x19')](handleEntityNotFound(_0x121ec4,null))[_0x2e06('0x19')](function(_0x5f0c4a){if(_0x5f0c4a){var _0x2b513e=_0x5f0c4a['favicon']&&fs['existsSync'](path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_[_0x2e06('0x5a')](_0x5f0c4a[_0x2e06('0x53')])))?path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_[_0x2e06('0x5a')](_0x5f0c4a[_0x2e06('0x53')])):path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_[_0x2e06('0x5a')]('default_favicon.ico'));var _0x8947a4=_0x2e06('0x62')+_[_0x2e06('0x5b')](_0x2e06('0x53'));if(_0x5f0c4a[_0x8947a4]||!_0x15f0b5['custom']){_0x2b513e=path[_0x2e06('0x59')](config[_0x2e06('0x58')],_0x4c3605,_['toLower'](_0x2e06('0x68')));}if(!fs[_0x2e06('0x57')](_0x2b513e)){throw new db['Sequelize'][(_0x2e06('0x5c'))](_[_0x2e06('0x5b')](_0x2e06('0x53'))+_0x2e06('0x5d'));}return _0x121ec4[_0x2e06('0x5e')](_0x2b513e);}})['catch'](handleError(_0x121ec4,null));};exports[_0x2e06('0x69')]=function(_0x321528,_0x90ce4){var _0xb7ba5={'offset':moment()['utcOffset']()};_0xb7ba5[_0x2e06('0x6a')]=moment()[_0x2e06('0x6b')](_0xb7ba5[_0x2e06('0x27')])['format']('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x90ce4[_0x2e06('0x25')](0xc8)[_0x2e06('0x6c')](_0xb7ba5);}; \ No newline at end of file +var _0x65f4=['include','findAll','rows','catch','show','params','fields','length','find','file','filename','body','logo','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLogo','defaultLoginLogo','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','defaultPreferred','default_loginLogo.svg','securePassword','addPreferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','squel','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','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','reject','save','update','destroy','stack','name','index','map','Setting','rawAttributes','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll'];(function(_0x51f366,_0x327d59){var _0x2995e2=function(_0x28466c){while(--_0x28466c){_0x51f366['push'](_0x51f366['shift']());}};_0x2995e2(++_0x327d59);}(_0x65f4,0x19a));var _0x465f=function(_0x18763f,_0x3ac650){_0x18763f=_0x18763f-0x0;var _0x313844=_0x65f4[_0x18763f];return _0x313844;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x465f('0x0'));var jsonpatch=require(_0x465f('0x1'));var rp=require(_0x465f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x465f('0x3'));var util=require(_0x465f('0x4'));var path=require(_0x465f('0x5'));var sox=require('sox');var csv=require(_0x465f('0x6'));var ejs=require(_0x465f('0x7'));var fs=require('fs');var fs_extra=require(_0x465f('0x8'));var _=require('lodash');var squel=require(_0x465f('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x465f('0xa'));var toCsv=require(_0x465f('0x6'));var querystring=require(_0x465f('0xb'));var Papa=require(_0x465f('0xc'));var Redis=require(_0x465f('0xd'));var authService=require(_0x465f('0xe'));var qs=require(_0x465f('0xf'));var as=require(_0x465f('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x465f('0x11'))(_0x465f('0x12'));var utils=require(_0x465f('0x13'));var config=require(_0x465f('0x14'));var licenseUtil=require(_0x465f('0x15'));var db=require(_0x465f('0x16'))['db'];var jayson=require(_0x465f('0x17'));var client=jayson[_0x465f('0x18')][_0x465f('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5937e6,_0x530842,_0x2784b8,_0x2558a0){return new BPromise(function(_0x2cb09c,_0x3a6c49){var _0x532e49=_0x2558a0||client;return _0x532e49[_0x465f('0x1a')](_0x5937e6,_0x2784b8)[_0x465f('0x1b')](function(_0x52f29d){logger['info'](_0x465f('0x1c'),_0x530842,_0x465f('0x1d'));logger[_0x465f('0x1e')](_0x465f('0x1f'),_0x530842,_0x465f('0x1d'),JSON['stringify'](_0x52f29d));if(_0x52f29d[_0x465f('0x20')]){if(_0x52f29d[_0x465f('0x20')][_0x465f('0x21')]===0x1f4){logger['error'](_0x465f('0x1c'),_0x530842,_0x52f29d[_0x465f('0x20')]['message']);return _0x3a6c49(_0x52f29d[_0x465f('0x20')]['message']);}logger[_0x465f('0x20')](_0x465f('0x1c'),_0x530842,_0x52f29d[_0x465f('0x20')][_0x465f('0x22')]);return _0x2cb09c(_0x52f29d[_0x465f('0x20')][_0x465f('0x22')]);}else{logger[_0x465f('0x23')](_0x465f('0x1c'),_0x530842,_0x465f('0x1d'));_0x2cb09c(_0x52f29d[_0x465f('0x24')][_0x465f('0x22')]);}})['catch'](function(_0x41e279){logger[_0x465f('0x20')](_0x465f('0x1c'),_0x530842,_0x41e279);_0x3a6c49(_0x41e279);});});}function respondWithStatusCode(_0x317aed,_0x1d6677){_0x1d6677=_0x1d6677||0xcc;return function(_0x2566e3){if(_0x2566e3){return _0x317aed[_0x465f('0x25')](_0x1d6677);}return _0x317aed[_0x465f('0x26')](_0x1d6677)[_0x465f('0x27')]();};}function respondWithResult(_0xbea909,_0x59ace5){_0x59ace5=_0x59ace5||0xc8;return function(_0x186fff){if(_0x186fff){return _0xbea909[_0x465f('0x26')](_0x59ace5)['json'](_0x186fff);}};}function respondWithFilteredResult(_0x5a9fc3,_0xc45dc){return function(_0x3cd248){if(_0x3cd248){var _0x2fc986=typeof _0xc45dc[_0x465f('0x28')]===_0x465f('0x29')&&typeof _0xc45dc[_0x465f('0x2a')]===_0x465f('0x29');var _0x9d9ca9=_0x3cd248[_0x465f('0x2b')];var _0x190506=_0x2fc986?0x0:_0xc45dc['offset'];var _0x222240=_0x2fc986?_0x3cd248[_0x465f('0x2b')]:_0xc45dc['offset']+_0xc45dc[_0x465f('0x2a')];var _0x4a6301;if(_0x222240>=_0x9d9ca9){_0x222240=_0x9d9ca9;_0x4a6301=0xc8;}else{_0x4a6301=0xce;}_0x5a9fc3[_0x465f('0x26')](_0x4a6301);return _0x5a9fc3['set'](_0x465f('0x2c'),_0x190506+'-'+_0x222240+'/'+_0x9d9ca9)[_0x465f('0x2d')](_0x3cd248);}return null;};}function patchUpdates(_0x1817d0){return function(_0x25d2d7){try{jsonpatch['apply'](_0x25d2d7,_0x1817d0,!![]);}catch(_0x462462){return BPromise[_0x465f('0x2e')](_0x462462);}return _0x25d2d7[_0x465f('0x2f')]();};}function saveUpdates(_0x597afd,_0x156eb2){return function(_0x44884b){if(_0x44884b){return _0x44884b[_0x465f('0x30')](_0x597afd)['then'](function(_0x268ed3){return _0x268ed3;});}return null;};}function removeEntity(_0x3225b7,_0xfdb59c){return function(_0x4138ed){if(_0x4138ed){return _0x4138ed[_0x465f('0x31')]()['then'](function(){_0x3225b7['status'](0xcc)[_0x465f('0x27')]();});}};}function handleEntityNotFound(_0xb9c552,_0x425369){return function(_0x5230ae){if(!_0x5230ae){_0xb9c552[_0x465f('0x25')](0x194);}return _0x5230ae;};}function handleError(_0x587181,_0x11d55c){_0x11d55c=_0x11d55c||0x1f4;return function(_0x61835b){logger[_0x465f('0x20')](_0x61835b[_0x465f('0x32')]);if(_0x61835b[_0x465f('0x33')]){delete _0x61835b[_0x465f('0x33')];}_0x587181['status'](_0x11d55c)['send'](_0x61835b);};}exports[_0x465f('0x34')]=function(_0x11c472,_0x2e27f7){var _0x41c75c={},_0xf8b1c6={},_0x544f9d={'count':0x0,'rows':[]};var _0x3c40e2=_[_0x465f('0x35')](db[_0x465f('0x36')][_0x465f('0x37')],function(_0x486dfd){return{'name':_0x486dfd['fieldName'],'type':_0x486dfd[_0x465f('0x38')]['key']};});_0xf8b1c6[_0x465f('0x39')]=_[_0x465f('0x35')](_0x3c40e2,_0x465f('0x33'));_0xf8b1c6[_0x465f('0x3a')]=_[_0x465f('0x3b')](_0x11c472['query']);_0xf8b1c6[_0x465f('0x3c')]=_[_0x465f('0x3d')](_0xf8b1c6[_0x465f('0x39')],_0xf8b1c6[_0x465f('0x3a')]);_0x41c75c['attributes']=_[_0x465f('0x3d')](_0xf8b1c6[_0x465f('0x39')],qs['fields'](_0x11c472[_0x465f('0x3a')]['fields']));_0x41c75c[_0x465f('0x3e')]=_0x41c75c['attributes']['length']?_0x41c75c[_0x465f('0x3e')]:_0xf8b1c6[_0x465f('0x39')];if(!_0x11c472[_0x465f('0x3a')][_0x465f('0x3f')](_0x465f('0x40'))){_0x41c75c['limit']=qs[_0x465f('0x2a')](_0x11c472[_0x465f('0x3a')][_0x465f('0x2a')]);_0x41c75c[_0x465f('0x28')]=qs[_0x465f('0x28')](_0x11c472[_0x465f('0x3a')][_0x465f('0x28')]);}_0x41c75c[_0x465f('0x41')]=qs[_0x465f('0x42')](_0x11c472['query'][_0x465f('0x42')]);_0x41c75c[_0x465f('0x43')]=qs[_0x465f('0x3c')](_[_0x465f('0x44')](_0x11c472[_0x465f('0x3a')],_0xf8b1c6[_0x465f('0x3c')]),_0x3c40e2);if(_0x11c472[_0x465f('0x3a')][_0x465f('0x45')]){_0x41c75c[_0x465f('0x43')]=_[_0x465f('0x46')](_0x41c75c[_0x465f('0x43')],{'$or':_[_0x465f('0x35')](_0x3c40e2,function(_0x3d2a5f){if(_0x3d2a5f[_0x465f('0x38')]!==_0x465f('0x47')){var _0x2c6245={};_0x2c6245[_0x3d2a5f[_0x465f('0x33')]]={'$like':'%'+_0x11c472[_0x465f('0x3a')][_0x465f('0x45')]+'%'};return _0x2c6245;}})});}_0x41c75c=_[_0x465f('0x46')]({},_0x41c75c,_0x11c472[_0x465f('0x48')]);var _0x468936={'where':_0x41c75c[_0x465f('0x43')]};return db[_0x465f('0x36')][_0x465f('0x2b')](_0x468936)[_0x465f('0x1b')](function(_0x4aaebb){_0x544f9d[_0x465f('0x2b')]=_0x4aaebb;if(_0x11c472[_0x465f('0x3a')][_0x465f('0x49')]){_0x41c75c[_0x465f('0x4a')]=[{'all':!![]}];}return db[_0x465f('0x36')][_0x465f('0x4b')](_0x41c75c);})[_0x465f('0x1b')](function(_0x22d8b6){_0x544f9d[_0x465f('0x4c')]=_0x22d8b6;return _0x544f9d;})[_0x465f('0x1b')](respondWithFilteredResult(_0x2e27f7,_0x41c75c))[_0x465f('0x4d')](handleError(_0x2e27f7,null));};exports[_0x465f('0x4e')]=function(_0x4d7197,_0x325a26){var _0x1b8c02={'raw':![],'where':{'id':_0x4d7197[_0x465f('0x4f')]['id']}},_0x1d7cc0={};_0x1d7cc0[_0x465f('0x39')]=_[_0x465f('0x3b')](db[_0x465f('0x36')][_0x465f('0x37')]);_0x1d7cc0[_0x465f('0x3a')]=_[_0x465f('0x3b')](_0x4d7197[_0x465f('0x3a')]);_0x1d7cc0[_0x465f('0x3c')]=_[_0x465f('0x3d')](_0x1d7cc0[_0x465f('0x39')],_0x1d7cc0[_0x465f('0x3a')]);_0x1b8c02[_0x465f('0x3e')]=_['intersection'](_0x1d7cc0['model'],qs[_0x465f('0x50')](_0x4d7197[_0x465f('0x3a')]['fields']));_0x1b8c02['attributes']=_0x1b8c02[_0x465f('0x3e')][_0x465f('0x51')]?_0x1b8c02[_0x465f('0x3e')]:_0x1d7cc0['model'];if(_0x4d7197[_0x465f('0x3a')][_0x465f('0x49')]){_0x1b8c02[_0x465f('0x4a')]=[{'all':!![]}];}_0x1b8c02=_[_0x465f('0x46')]({},_0x1b8c02,_0x4d7197[_0x465f('0x48')]);return db[_0x465f('0x36')][_0x465f('0x52')](_0x1b8c02)[_0x465f('0x1b')](handleEntityNotFound(_0x325a26,null))['then'](respondWithResult(_0x325a26,null))[_0x465f('0x4d')](handleError(_0x325a26,null));};exports[_0x465f('0x30')]=function(_0x3f17e4,_0x425894){if(_0x3f17e4['body']['id']){delete _0x3f17e4['body']['id'];}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x3f17e4[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x425894,null))[_0x465f('0x1b')](saveUpdates(_0x3f17e4['body'],null))[_0x465f('0x1b')](respondWithResult(_0x425894,null))[_0x465f('0x4d')](handleError(_0x425894,null));};exports['addLogo']=function(_0x218ad5,_0x15e947,_0x3f8400){if(_0x218ad5['file']&&_0x218ad5[_0x465f('0x53')][_0x465f('0x54')]){_0x218ad5[_0x465f('0x55')][_0x465f('0x56')]=_0x218ad5[_0x465f('0x53')]['filename'];}return db[_0x465f('0x36')]['find']({'where':{'id':_0x218ad5[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x15e947,null))[_0x465f('0x1b')](saveUpdates(_0x218ad5[_0x465f('0x55')],null))['then'](respondWithResult(_0x15e947,null))[_0x465f('0x4d')](handleError(_0x15e947,null));};exports[_0x465f('0x57')]=function(_0x57b211,_0x199cbd,_0xa314ef){if(_0x57b211[_0x465f('0x53')]&&_0x57b211[_0x465f('0x53')][_0x465f('0x54')]){_0x57b211[_0x465f('0x55')][_0x465f('0x58')]=_0x57b211[_0x465f('0x53')]['filename'];}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x57b211[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x199cbd,null))[_0x465f('0x1b')](saveUpdates(_0x57b211[_0x465f('0x55')],null))[_0x465f('0x1b')](respondWithResult(_0x199cbd,null))[_0x465f('0x4d')](handleError(_0x199cbd,null));};var utilLicense=require(_0x465f('0x15'));exports[_0x465f('0x59')]=function(_0x29e461,_0x25e2e6,_0x2508be){var _0xbd97a=_0x465f('0x5a');var _0x1a7ae7={'custom':![]};return utilLicense[_0x465f('0x5b')]()[_0x465f('0x1b')](function(_0x103322){if(_0x103322){_0x1a7ae7=_0x103322;}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x29e461[_0x465f('0x4f')]['id']},'attributes':['logo','loginLogo',_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),'defaultPreferred',_0x465f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x25e2e6,null))['then'](function(_0x4593fc){if(_0x4593fc){var _0x832ba3=_0x4593fc[_0x465f('0x56')]&&fs[_0x465f('0x61')](path[_0x465f('0x62')](config[_0x465f('0x63')],_0xbd97a,_[_0x465f('0x64')](_0x4593fc[_0x465f('0x56')])))?path[_0x465f('0x62')](config['root'],_0xbd97a,_['toLower'](_0x4593fc[_0x465f('0x56')])):path[_0x465f('0x62')](config[_0x465f('0x63')],_0xbd97a,_[_0x465f('0x64')](_0x465f('0x65')));var _0x796cd1=_0x465f('0x66')+_[_0x465f('0x67')](_0x465f('0x56'));if(_0x4593fc[_0x796cd1]||!_0x1a7ae7[_0x465f('0x68')]){_0x832ba3=path[_0x465f('0x62')](config[_0x465f('0x63')],_0xbd97a,_[_0x465f('0x64')]('default_logo.svg'));}if(!fs[_0x465f('0x61')](_0x832ba3)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')](_0x465f('0x56'))+_0x465f('0x6b'));}return _0x25e2e6[_0x465f('0x6c')](_0x832ba3);}})['catch'](handleError(_0x25e2e6,null));};var utilLicense=require('../../config/license/util');exports['getLogoLogin']=function(_0x15b80c,_0x44527d,_0x4346cb){var _0x1c2c22=_0x465f('0x5a');var _0x5d51c2={'custom':![]};return utilLicense[_0x465f('0x5b')]()['then'](function(_0x1a5272){if(_0x1a5272){_0x5d51c2=_0x1a5272;}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x15b80c[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x56'),_0x465f('0x58'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),_0x465f('0x6d'),'defaultFavicon'],'raw':!![]});})[_0x465f('0x1b')](handleEntityNotFound(_0x44527d,null))['then'](function(_0x24f6a9){if(_0x24f6a9){var _0x12ebbf=_0x24f6a9[_0x465f('0x58')]&&fs[_0x465f('0x61')](path['join'](config[_0x465f('0x63')],_0x1c2c22,_[_0x465f('0x64')](_0x24f6a9['loginLogo'])))?path[_0x465f('0x62')](config[_0x465f('0x63')],_0x1c2c22,_['toLower'](_0x24f6a9[_0x465f('0x58')])):path[_0x465f('0x62')](config[_0x465f('0x63')],_0x1c2c22,_[_0x465f('0x64')]('default_loginLogo.svg'));var _0x203540=_0x465f('0x66')+_[_0x465f('0x67')](_0x465f('0x58'));if(_0x24f6a9[_0x203540]||!_0x5d51c2['custom']){_0x12ebbf=path[_0x465f('0x62')](config[_0x465f('0x63')],_0x1c2c22,_[_0x465f('0x64')](_0x465f('0x6e')));}if(!fs[_0x465f('0x61')](_0x12ebbf)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')](_0x465f('0x58'))+'\x20not\x20found');}return _0x44527d[_0x465f('0x6c')](_0x12ebbf);}})[_0x465f('0x4d')](handleError(_0x44527d,null));};exports['gdpr']=function(_0x29341e,_0x459984){return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x29341e[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x6f')]})[_0x465f('0x1b')](respondWithResult(_0x459984,null))[_0x465f('0x4d')](handleError(_0x459984,null));};exports[_0x465f('0x70')]=function(_0x77615e,_0x3c3bdf,_0x3f9b86){if(_0x77615e['file']&&_0x77615e[_0x465f('0x53')][_0x465f('0x54')]){_0x77615e[_0x465f('0x55')][_0x465f('0x5c')]=_0x77615e[_0x465f('0x53')][_0x465f('0x54')];}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x77615e[_0x465f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x3c3bdf,null))['then'](saveUpdates(_0x77615e[_0x465f('0x55')],null))[_0x465f('0x1b')](respondWithResult(_0x3c3bdf,null))[_0x465f('0x4d')](handleError(_0x3c3bdf,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x2c4aed,_0x3d2a11,_0x5d5c64){var _0x177547=_0x465f('0x5a');var _0x4dd4af={'custom':![]};return utilLicense['getLicense']()[_0x465f('0x1b')](function(_0x493d59){if(_0x493d59){_0x4dd4af=_0x493d59;}return db['Setting'][_0x465f('0x52')]({'where':{'id':_0x2c4aed[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x56'),_0x465f('0x58'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),_0x465f('0x5f'),_0x465f('0x6d'),_0x465f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x3d2a11,null))['then'](function(_0x3dd93a){if(_0x3dd93a){var _0x156548=_0x3dd93a[_0x465f('0x5c')]&&fs[_0x465f('0x61')](path[_0x465f('0x62')](config[_0x465f('0x63')],_0x177547,_[_0x465f('0x64')](_0x3dd93a['preferred'])))?path['join'](config[_0x465f('0x63')],_0x177547,_[_0x465f('0x64')](_0x3dd93a[_0x465f('0x5c')])):path[_0x465f('0x62')](config['root'],_0x177547,_[_0x465f('0x64')]('default_preferred.png'));var _0x5bd0cc='default'+_['upperFirst']('preferred');if(_0x3dd93a[_0x5bd0cc]||!_0x4dd4af['custom']||!_0x4dd4af[_0x465f('0x5c')]){_0x156548=path[_0x465f('0x62')](config[_0x465f('0x63')],_0x177547,_[_0x465f('0x64')](_0x465f('0x71')));}if(!fs['existsSync'](_0x156548)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')]('preferred')+_0x465f('0x6b'));}return _0x3d2a11[_0x465f('0x6c')](_0x156548);}})['catch'](handleError(_0x3d2a11,null));};exports[_0x465f('0x72')]=function(_0x4f2319,_0x32a41d,_0x3db863){if(_0x4f2319['file']&&_0x4f2319['file'][_0x465f('0x54')]){_0x4f2319['body'][_0x465f('0x5d')]=_0x4f2319[_0x465f('0x53')][_0x465f('0x54')];}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x4f2319[_0x465f('0x4f')]['id']}})[_0x465f('0x1b')](handleEntityNotFound(_0x32a41d,null))['then'](saveUpdates(_0x4f2319[_0x465f('0x55')],null))['then'](respondWithResult(_0x32a41d,null))[_0x465f('0x4d')](handleError(_0x32a41d,null));};var utilLicense=require('../../config/license/util');exports[_0x465f('0x73')]=function(_0x3e21fe,_0x229964,_0x148212){var _0x4650b6=_0x465f('0x5a');var _0x4ca969={'custom':![]};return utilLicense[_0x465f('0x5b')]()[_0x465f('0x1b')](function(_0x1ad76e){if(_0x1ad76e){_0x4ca969=_0x1ad76e;}return db[_0x465f('0x36')][_0x465f('0x52')]({'where':{'id':_0x3e21fe[_0x465f('0x4f')]['id']},'attributes':[_0x465f('0x56'),_0x465f('0x58'),_0x465f('0x5c'),_0x465f('0x5d'),_0x465f('0x5e'),'defaultLoginLogo','defaultPreferred',_0x465f('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x229964,null))[_0x465f('0x1b')](function(_0x5cc1f2){if(_0x5cc1f2){var _0x19c155=_0x5cc1f2['favicon']&&fs[_0x465f('0x61')](path[_0x465f('0x62')](config[_0x465f('0x63')],_0x4650b6,_[_0x465f('0x64')](_0x5cc1f2[_0x465f('0x5d')])))?path[_0x465f('0x62')](config['root'],_0x4650b6,_['toLower'](_0x5cc1f2[_0x465f('0x5d')])):path[_0x465f('0x62')](config['root'],_0x4650b6,_[_0x465f('0x64')](_0x465f('0x74')));var _0xbf71ed=_0x465f('0x66')+_[_0x465f('0x67')](_0x465f('0x5d'));if(_0x5cc1f2[_0xbf71ed]||!_0x4ca969[_0x465f('0x68')]){_0x19c155=path['join'](config['root'],_0x4650b6,_[_0x465f('0x64')]('default_favicon.ico'));}if(!fs[_0x465f('0x61')](_0x19c155)){throw new db[(_0x465f('0x69'))][(_0x465f('0x6a'))](_[_0x465f('0x67')](_0x465f('0x5d'))+_0x465f('0x6b'));}return _0x229964[_0x465f('0x6c')](_0x19c155);}})[_0x465f('0x4d')](handleError(_0x229964,null));};exports['getDate']=function(_0x2b81f0,_0x42cd76){var _0x5df896={'offset':moment()[_0x465f('0x75')]()};_0x5df896['now']=moment()[_0x465f('0x75')](_0x5df896['offset'])[_0x465f('0x76')](_0x465f('0x77'));return _0x42cd76[_0x465f('0x26')](0xc8)[_0x465f('0x78')](_0x5df896);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 353ec00..a6adfe3 100644 --- a/server/api/setting/setting.model.js +++ b/server/api/setting/setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x16c467,_0x53d6fa){var _0x22db4f=function(_0x498d3f){while(--_0x498d3f){_0x16c467['push'](_0x16c467['shift']());}};_0x22db4f(++_0x53d6fa);}(_0x3e74,0x175));var _0x43e7=function(_0x1f1f30,_0x4b3040){_0x1f1f30=_0x1f1f30-0x0;var _0x27442f=_0x3e74[_0x1f1f30];return _0x27442f;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3e74=['exports','Setting','settings','lodash','../../config/logger','api','moment','path','../../config/environment','./setting.attributes'];(function(_0x48c615,_0x4cc757){var _0x3d9e22=function(_0x1ee9f2){while(--_0x1ee9f2){_0x48c615['push'](_0x48c615['shift']());}};_0x3d9e22(++_0x4cc757);}(_0x3e74,0x175));var _0x43e7=function(_0x4312c7,_0xfdabe4){_0x4312c7=_0x4312c7-0x0;var _0x55f757=_0x3e74[_0x4312c7];return _0x55f757;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var logger=require(_0x43e7('0x1'))(_0x43e7('0x2'));var moment=require(_0x43e7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x43e7('0x4'));var rimraf=require('rimraf');var config=require(_0x43e7('0x5'));var attributes=require(_0x43e7('0x6'));module[_0x43e7('0x7')]=function(_0x1c503b,_0xc98b9c){return _0x1c503b['define'](_0x43e7('0x8'),attributes,{'tableName':_0x43e7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index c0be38f..6478077 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 _0x541b=['find','options','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSetting'];(function(_0x42dcf2,_0x1a30d0){var _0x591566=function(_0x235c7c){while(--_0x235c7c){_0x42dcf2['push'](_0x42dcf2['shift']());}};_0x591566(++_0x1a30d0);}(_0x541b,0xce));var _0xb541=function(_0x1ff085,_0xa5d361){_0x1ff085=_0x1ff085-0x0;var _0x229856=_0x541b[_0x1ff085];return _0x229856;};'use strict';var _=require(_0xb541('0x0'));var util=require(_0xb541('0x1'));var moment=require(_0xb541('0x2'));var BPromise=require(_0xb541('0x3'));var rs=require(_0xb541('0x4'));var fs=require('fs');var Redis=require(_0xb541('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb541('0x6'));var logger=require('../../config/logger')(_0xb541('0x7'));var config=require(_0xb541('0x8'));var jayson=require(_0xb541('0x9'));var client=jayson[_0xb541('0xa')][_0xb541('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4d9f28,_0x2ed1cf,_0x1d3775){return new BPromise(function(_0xb3190a,_0x2b8d19){return client[_0xb541('0xc')](_0x4d9f28,_0x1d3775)['then'](function(_0x381f42){logger[_0xb541('0xd')](_0xb541('0xe'),_0x2ed1cf,_0xb541('0xf'));logger[_0xb541('0x10')](_0xb541('0x11'),_0x2ed1cf,_0xb541('0xf'),JSON[_0xb541('0x12')](_0x381f42));if(_0x381f42[_0xb541('0x13')]){if(_0x381f42['error'][_0xb541('0x14')]===0x1f4){logger[_0xb541('0x13')](_0xb541('0xe'),_0x2ed1cf,_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);return _0x2b8d19(_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);}logger['error'](_0xb541('0xe'),_0x2ed1cf,_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);return _0xb3190a(_0x381f42[_0xb541('0x13')][_0xb541('0x15')]);}else{logger[_0xb541('0xd')](_0xb541('0xe'),_0x2ed1cf,_0xb541('0xf'));_0xb3190a(_0x381f42[_0xb541('0x16')][_0xb541('0x15')]);}})[_0xb541('0x17')](function(_0x3bfe44){logger[_0xb541('0x13')]('Setting,\x20%s,\x20%s',_0x2ed1cf,_0x3bfe44);_0x2b8d19(_0x3bfe44);});});}exports[_0xb541('0x18')]=function(_0x1494a2){var _0x2f64b2=this;return new Promise(function(_0x1734e2,_0x1615b6){return db['Setting'][_0xb541('0x19')]({'raw':_0x1494a2[_0xb541('0x1a')]?_0x1494a2[_0xb541('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1494a2[_0xb541('0x1a')]?_0x1494a2[_0xb541('0x1a')][_0xb541('0x1b')]||null:null,'attributes':_0x1494a2['options']?_0x1494a2[_0xb541('0x1a')][_0xb541('0x1c')]||null:null,'include':_0x1494a2[_0xb541('0x1a')]?_0x1494a2['options'][_0xb541('0x1d')]?_[_0xb541('0x1e')](_0x1494a2[_0xb541('0x1a')]['include'],function(_0x31a82e){return{'model':db[_0x31a82e[_0xb541('0x1f')]],'as':_0x31a82e['as'],'attributes':_0x31a82e[_0xb541('0x1c')],'include':_0x31a82e[_0xb541('0x1d')]?_['map'](_0x31a82e['include'],function(_0x1b1aec){return{'model':db[_0x1b1aec[_0xb541('0x1f')]],'as':_0x1b1aec['as'],'attributes':_0x1b1aec['attributes'],'include':_0x1b1aec[_0xb541('0x1d')]?_['map'](_0x1b1aec[_0xb541('0x1d')],function(_0x15096a){return{'model':db[_0x15096a[_0xb541('0x1f')]],'as':_0x15096a['as'],'attributes':_0x15096a['attributes']};}):[]};}):[]};}):[]:[]})[_0xb541('0x20')](function(_0xb461a9){logger[_0xb541('0xd')](_0xb541('0x18'),_0x1494a2);logger[_0xb541('0x10')](_0xb541('0x18'),_0x1494a2,JSON['stringify'](_0xb461a9));_0x1734e2(_0xb461a9);})[_0xb541('0x17')](function(_0x476484){logger[_0xb541('0x13')]('ShowSetting',_0x476484['message'],_0x1494a2);_0x1615b6(_0x2f64b2[_0xb541('0x13')](0x1f4,_0x476484[_0xb541('0x15')]));});});}; \ No newline at end of file +var _0x7082=['rpc','../../config/environment','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSetting','Setting','find','options','raw','attributes','include','map','model','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x142890,_0x4e431a){var _0x33d7e6=function(_0x5d0162){while(--_0x5d0162){_0x142890['push'](_0x142890['shift']());}};_0x33d7e6(++_0x4e431a);}(_0x7082,0x14e));var _0x2708=function(_0x11d541,_0xc8fe9){_0x11d541=_0x11d541-0x0;var _0x3e612a=_0x7082[_0x11d541];return _0x3e612a;};'use strict';var _=require(_0x2708('0x0'));var util=require(_0x2708('0x1'));var moment=require(_0x2708('0x2'));var BPromise=require(_0x2708('0x3'));var rs=require(_0x2708('0x4'));var fs=require('fs');var Redis=require(_0x2708('0x5'));var db=require(_0x2708('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2708('0x7'));var config=require(_0x2708('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2708('0x9')][_0x2708('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ba834,_0x31defe,_0x20cb41){return new BPromise(function(_0x149f56,_0x385973){return client[_0x2708('0xb')](_0x3ba834,_0x20cb41)[_0x2708('0xc')](function(_0x14d2cd){logger[_0x2708('0xd')](_0x2708('0xe'),_0x31defe,_0x2708('0xf'));logger[_0x2708('0x10')](_0x2708('0x11'),_0x31defe,_0x2708('0xf'),JSON[_0x2708('0x12')](_0x14d2cd));if(_0x14d2cd[_0x2708('0x13')]){if(_0x14d2cd[_0x2708('0x13')]['code']===0x1f4){logger[_0x2708('0x13')](_0x2708('0xe'),_0x31defe,_0x14d2cd['error']['message']);return _0x385973(_0x14d2cd['error'][_0x2708('0x14')]);}logger[_0x2708('0x13')](_0x2708('0xe'),_0x31defe,_0x14d2cd[_0x2708('0x13')][_0x2708('0x14')]);return _0x149f56(_0x14d2cd[_0x2708('0x13')][_0x2708('0x14')]);}else{logger[_0x2708('0xd')](_0x2708('0xe'),_0x31defe,_0x2708('0xf'));_0x149f56(_0x14d2cd['result']['message']);}})[_0x2708('0x15')](function(_0x40a27d){logger[_0x2708('0x13')](_0x2708('0xe'),_0x31defe,_0x40a27d);_0x385973(_0x40a27d);});});}exports[_0x2708('0x16')]=function(_0x153756){var _0x1a29d9=this;return new Promise(function(_0x1b305d,_0x30bbda){return db[_0x2708('0x17')][_0x2708('0x18')]({'raw':_0x153756[_0x2708('0x19')]?_0x153756[_0x2708('0x19')][_0x2708('0x1a')]===undefined?!![]:![]:!![],'where':_0x153756[_0x2708('0x19')]?_0x153756['options']['where']||null:null,'attributes':_0x153756['options']?_0x153756[_0x2708('0x19')][_0x2708('0x1b')]||null:null,'include':_0x153756[_0x2708('0x19')]?_0x153756[_0x2708('0x19')][_0x2708('0x1c')]?_[_0x2708('0x1d')](_0x153756[_0x2708('0x19')][_0x2708('0x1c')],function(_0x5064e3){return{'model':db[_0x5064e3[_0x2708('0x1e')]],'as':_0x5064e3['as'],'attributes':_0x5064e3[_0x2708('0x1b')],'include':_0x5064e3[_0x2708('0x1c')]?_['map'](_0x5064e3[_0x2708('0x1c')],function(_0x28479a){return{'model':db[_0x28479a[_0x2708('0x1e')]],'as':_0x28479a['as'],'attributes':_0x28479a[_0x2708('0x1b')],'include':_0x28479a[_0x2708('0x1c')]?_[_0x2708('0x1d')](_0x28479a[_0x2708('0x1c')],function(_0x2b9c32){return{'model':db[_0x2b9c32['model']],'as':_0x2b9c32['as'],'attributes':_0x2b9c32[_0x2708('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2708('0xc')](function(_0x4a9a00){logger['info'](_0x2708('0x16'),_0x153756);logger['debug']('ShowSetting',_0x153756,JSON[_0x2708('0x12')](_0x4a9a00));_0x1b305d(_0x4a9a00);})[_0x2708('0x15')](function(_0x10cd0b){logger[_0x2708('0x13')]('ShowSetting',_0x10cd0b['message'],_0x153756);_0x30bbda(_0x1a29d9['error'](0x1f4,_0x10cd0b[_0x2708('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 9664f65..c3810f1 100644 --- a/server/api/smsAccount/index.js +++ b/server/api/smsAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x49f13f,_0x4d335f){var _0x235aa0=function(_0x19f4b6){while(--_0x19f4b6){_0x49f13f['push'](_0x49f13f['shift']());}};_0x235aa0(++_0x4d335f);}(_0x7a54,0x106));var _0x47a5=function(_0x3dac0f,_0x45393a){_0x3dac0f=_0x3dac0f-0x0;var _0x302790=_0x7a54[_0x3dac0f];return _0x302790;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x1d4275,_0x275f37){var _0xa30808=function(_0x405f11){while(--_0x405f11){_0x1d4275['push'](_0x1d4275['shift']());}};_0xa30808(++_0x275f37);}(_0x7a54,0x106));var _0x47a5=function(_0x44e3f8,_0x159e28){_0x44e3f8=_0x44e3f8-0x0;var _0x5a5ce0=_0x7a54[_0x44e3f8];return _0x5a5ce0;};'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 8dca515..c29f899 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 _0xcad4=['twilio','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','STRING','generate'];(function(_0x346610,_0x33bf69){var _0x55f160=function(_0x42bf5a){while(--_0x42bf5a){_0x346610['push'](_0x346610['shift']());}};_0x55f160(++_0x33bf69);}(_0xcad4,0x75));var _0x4cad=function(_0x3a7458,_0x131630){_0x3a7458=_0x3a7458-0x0;var _0x2778c5=_0xcad4[_0x3a7458];return _0x2778c5;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x4cad('0x0'));module['exports']={'name':{'type':Sequelize[_0x4cad('0x1')],'unique':'name','allowNull':![]},'key':{'type':Sequelize[_0x4cad('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x4cad('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x4cad('0x1')],'defaultValue':function(){return rs[_0x4cad('0x2')]();}},'phone':{'type':Sequelize[_0x4cad('0x1')]},'type':{'type':Sequelize['ENUM'](_0x4cad('0x3'),'skebby','connectel',_0x4cad('0x4'),_0x4cad('0x5'),_0x4cad('0x6'),_0x4cad('0x7'),_0x4cad('0x8'),'infobip',_0x4cad('0x9'))},'accountSid':{'type':Sequelize[_0x4cad('0x1')]},'authId':{'type':Sequelize[_0x4cad('0x1')]},'authToken':{'type':Sequelize[_0x4cad('0x1')]},'smsMethod':{'type':Sequelize[_0x4cad('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x4cad('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize[_0x4cad('0x1')]},'applicationId':{'type':Sequelize[_0x4cad('0x1')]},'accountId':{'type':Sequelize[_0x4cad('0x1')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x4cad('0x1')]},'notificationTemplate':{'type':Sequelize[_0x4cad('0xb')],'defaultValue':function(){return _0x4cad('0xc');}},'notificationSound':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4cad('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4cad('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4cad('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4cad('0x1')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4cad('0xe')],'comment':_0x4cad('0xf')},'mandatoryDisposition':{'type':Sequelize[_0x4cad('0xd')],'defaultValue':![],'comment':_0x4cad('0x10'),'set':function(_0x5d9e87){if(!_0x5d9e87)this['setDataValue'](_0x4cad('0x11'),null);this[_0x4cad('0x12')](_0x4cad('0x13'),_0x5d9e87);}}}; \ No newline at end of file +var _0x8e22=['intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','skebby','connectel','clicksend','plivo','bandwidth','csc','infobip'];(function(_0x2f7c1e,_0x56bc3c){var _0x23e97d=function(_0x3553b5){while(--_0x3553b5){_0x2f7c1e['push'](_0x2f7c1e['shift']());}};_0x23e97d(++_0x56bc3c);}(_0x8e22,0x76));var _0x28e2=function(_0x42d1f8,_0x22e529){_0x42d1f8=_0x42d1f8-0x0;var _0x40d234=_0x8e22[_0x42d1f8];return _0x40d234;};'use strict';var Sequelize=require(_0x28e2('0x0'));var rs=require(_0x28e2('0x1'));module[_0x28e2('0x2')]={'name':{'type':Sequelize[_0x28e2('0x3')],'unique':_0x28e2('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x28e2('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x28e2('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x28e2('0x3')],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x28e2('0x3')]},'type':{'type':Sequelize[_0x28e2('0x5')](_0x28e2('0x6'),_0x28e2('0x7'),_0x28e2('0x8'),_0x28e2('0x9'),_0x28e2('0xa'),'clickatell',_0x28e2('0xb'),_0x28e2('0xc'),_0x28e2('0xd'),_0x28e2('0xe'))},'accountSid':{'type':Sequelize[_0x28e2('0x3')]},'authId':{'type':Sequelize[_0x28e2('0x3')]},'authToken':{'type':Sequelize[_0x28e2('0x3')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x28e2('0x3')]},'password':{'type':Sequelize[_0x28e2('0x3')]},'apiKey':{'type':Sequelize[_0x28e2('0x3')]},'applicationId':{'type':Sequelize[_0x28e2('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x28e2('0x3')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x28e2('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x28e2('0xf');}},'notificationSound':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x28e2('0x11')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x28e2('0x11')],'comment':_0x28e2('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x28e2('0x10')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x56fec7){if(!_0x56fec7)this[_0x28e2('0x13')](_0x28e2('0x14'),null);this[_0x28e2('0x13')](_0x28e2('0x15'),_0x56fec7);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index b908043..acb00ca 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 _0xa18e=['../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','update','destroy','SmsAccounts','stack','name','index','Pause','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','SmsAccount','findAll','rows','catch','params','mandatoryDispositionPause','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','getDispositions','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','notify','SmsApplication','Applications','applications','orderBy','priority','asc','account','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','connectel','infobip','results','csc','segmentedMessage','clickatell','replyMessageId','intelepeer','isNil','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','Contacts','updatedAt','DESC','list','contact','SmsInteraction','interaction','created','autoclose','push','close','unmanaged','SmsMessage','AttachmentId','UserId','User','agent','*,*,*,*','queueId','SmsQueue','unshift','queue','Start','startRouting','receiveMessage','entity\x20found','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','finally','send','getApplications','Contact','Owner','fullname','Tags','color','tag','CmList','List','out','Messages','dataValues','debug','requestid','statusInt','clicksend','message_id','status_code','groupName','DELIVERED','bandwidth','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','received\x20delivery\x20report\x20from','message-id','state','addAgents','omit','removeAgents','isArray','emit','userSmsAccount:remove','getAgents','eml-format','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa18e,0xcd));var _0xea18=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xa18e[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0xea18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea18('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xea18('0x2'));var moment=require(_0xea18('0x3'));var BPromise=require(_0xea18('0x4'));var Mustache=require('mustache');var util=require(_0xea18('0x5'));var path=require(_0xea18('0x6'));var sox=require(_0xea18('0x7'));var csv=require(_0xea18('0x8'));var ejs=require(_0xea18('0x9'));var fs=require('fs');var fs_extra=require(_0xea18('0xa'));var _=require('lodash');var squel=require(_0xea18('0xb'));var crypto=require(_0xea18('0xc'));var jsforce=require(_0xea18('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xea18('0x8'));var querystring=require(_0xea18('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xea18('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xea18('0x10'));var hardwareService=require(_0xea18('0x11'));var logger=require(_0xea18('0x12'))(_0xea18('0x13'));var utils=require(_0xea18('0x14'));var config=require(_0xea18('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xea18('0x16'))['db'];config['redis']=_[_0xea18('0x17')](config[_0xea18('0x18')],{'host':_0xea18('0x19'),'port':0x18eb});var socket=require(_0xea18('0x1a'))(new Redis(config[_0xea18('0x18')]));require(_0xea18('0x1b'))[_0xea18('0x1c')](socket);var jayson=require(_0xea18('0x1d'));var client=jayson[_0xea18('0x1e')][_0xea18('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x569d5d,_0x4616c0,_0x72f50,_0x9b6e10){return new BPromise(function(_0x32e2cc,_0x185b1d){var _0x25b5ab=_0x9b6e10||client;return _0x25b5ab['request'](_0x569d5d,_0x72f50)[_0xea18('0x20')](function(_0x3e82e9){logger[_0xea18('0x21')](_0xea18('0x22'),_0x4616c0,_0xea18('0x23'));logger['debug'](_0xea18('0x24'),_0x4616c0,_0xea18('0x23'),JSON[_0xea18('0x25')](_0x3e82e9));if(_0x3e82e9[_0xea18('0x26')]){if(_0x3e82e9[_0xea18('0x26')][_0xea18('0x27')]===0x1f4){logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s',_0x4616c0,_0x3e82e9[_0xea18('0x26')][_0xea18('0x28')]);return _0x185b1d(_0x3e82e9[_0xea18('0x26')][_0xea18('0x28')]);}logger[_0xea18('0x26')](_0xea18('0x22'),_0x4616c0,_0x3e82e9[_0xea18('0x26')]['message']);return _0x32e2cc(_0x3e82e9[_0xea18('0x26')]['message']);}else{logger[_0xea18('0x21')](_0xea18('0x22'),_0x4616c0,_0xea18('0x23'));_0x32e2cc(_0x3e82e9[_0xea18('0x29')][_0xea18('0x28')]);}})['catch'](function(_0x37de8c){logger[_0xea18('0x26')](_0xea18('0x22'),_0x4616c0,_0x37de8c);_0x185b1d(_0x37de8c);});});}function respondWithStatusCode(_0x1cfa8b,_0x377c35){_0x377c35=_0x377c35||0xcc;return function(_0x116e69){if(_0x116e69){return _0x1cfa8b[_0xea18('0x2a')](_0x377c35);}return _0x1cfa8b[_0xea18('0x2b')](_0x377c35)[_0xea18('0x2c')]();};}function respondWithResult(_0x286da6,_0x214e68){_0x214e68=_0x214e68||0xc8;return function(_0x2df66e){if(_0x2df66e){return _0x286da6[_0xea18('0x2b')](_0x214e68)['json'](_0x2df66e);}};}function respondWithFilteredResult(_0x41a9bc,_0x466cc9){return function(_0x509901){if(_0x509901){var _0x1d51e6=typeof _0x466cc9[_0xea18('0x2d')]===_0xea18('0x2e')&&typeof _0x466cc9['limit']===_0xea18('0x2e');var _0x524a21=_0x509901[_0xea18('0x2f')];var _0x598765=_0x1d51e6?0x0:_0x466cc9[_0xea18('0x2d')];var _0x2f9a31=_0x1d51e6?_0x509901[_0xea18('0x2f')]:_0x466cc9[_0xea18('0x2d')]+_0x466cc9[_0xea18('0x30')];var _0x449013;if(_0x2f9a31>=_0x524a21){_0x2f9a31=_0x524a21;_0x449013=0xc8;}else{_0x449013=0xce;}_0x41a9bc[_0xea18('0x2b')](_0x449013);return _0x41a9bc[_0xea18('0x31')](_0xea18('0x32'),_0x598765+'-'+_0x2f9a31+'/'+_0x524a21)[_0xea18('0x33')](_0x509901);}return null;};}function patchUpdates(_0x36089a){return function(_0x587e8b){try{jsonpatch[_0xea18('0x34')](_0x587e8b,_0x36089a,!![]);}catch(_0x310863){return BPromise[_0xea18('0x35')](_0x310863);}return _0x587e8b[_0xea18('0x36')]();};}function saveUpdates(_0x2ad722,_0x4be2e2){return function(_0x3f3e4e){if(_0x3f3e4e){return _0x3f3e4e[_0xea18('0x37')](_0x2ad722)[_0xea18('0x20')](function(_0x442ef0){return _0x442ef0;});}return null;};}function removeEntity(_0x1ea79c,_0x9c8b90){return function(_0x49c341){if(_0x49c341){return _0x49c341[_0xea18('0x38')]()[_0xea18('0x20')](function(){var _0x437882=_0x49c341['get']({'plain':!![]});var _0x23015d=_0xea18('0x39');return db['UserProfileResource'][_0xea18('0x38')]({'where':{'type':_0x23015d,'resourceId':_0x437882['id']}})[_0xea18('0x20')](function(){return _0x49c341;});})[_0xea18('0x20')](function(){_0x1ea79c['status'](0xcc)[_0xea18('0x2c')]();});}};}function handleEntityNotFound(_0x1c7c1f,_0x1caefd){return function(_0x3e5568){if(!_0x3e5568){_0x1c7c1f[_0xea18('0x2a')](0x194);}return _0x3e5568;};}function handleError(_0x1fc166,_0x23ad80){_0x23ad80=_0x23ad80||0x1f4;return function(_0x14d7dd){logger['error'](_0x14d7dd[_0xea18('0x3a')]);if(_0x14d7dd[_0xea18('0x3b')]){delete _0x14d7dd[_0xea18('0x3b')];}_0x1fc166['status'](_0x23ad80)['send'](_0x14d7dd);};}exports[_0xea18('0x3c')]=function(_0x29b792,_0x1992cc){var _0x47abc9={'include':[{'model':db[_0xea18('0x3d')],'as':'mandatoryDispositionPause'}]},_0x18f0a5={},_0x1f0d1f={'count':0x0,'rows':[]};var _0x488abc=_[_0xea18('0x3e')](db['SmsAccount'][_0xea18('0x3f')],function(_0x533649){return{'name':_0x533649[_0xea18('0x40')],'type':_0x533649[_0xea18('0x41')][_0xea18('0x42')]};});_0x18f0a5[_0xea18('0x43')]=_[_0xea18('0x3e')](_0x488abc,'name');_0x18f0a5['query']=_[_0xea18('0x44')](_0x29b792[_0xea18('0x45')]);_0x18f0a5[_0xea18('0x46')]=_['intersection'](_0x18f0a5[_0xea18('0x43')],_0x18f0a5[_0xea18('0x45')]);_0x47abc9['attributes']=_[_0xea18('0x47')](_0x18f0a5[_0xea18('0x43')],qs[_0xea18('0x48')](_0x29b792[_0xea18('0x45')][_0xea18('0x48')]));_0x47abc9[_0xea18('0x49')]=_0x47abc9[_0xea18('0x49')][_0xea18('0x4a')]?_0x47abc9['attributes']:_0x18f0a5['model'];if(!_0x29b792[_0xea18('0x45')][_0xea18('0x4b')](_0xea18('0x4c'))){_0x47abc9['limit']=qs[_0xea18('0x30')](_0x29b792[_0xea18('0x45')][_0xea18('0x30')]);_0x47abc9[_0xea18('0x2d')]=qs[_0xea18('0x2d')](_0x29b792[_0xea18('0x45')][_0xea18('0x2d')]);}_0x47abc9[_0xea18('0x4d')]=qs['sort'](_0x29b792[_0xea18('0x45')][_0xea18('0x4e')]);_0x47abc9[_0xea18('0x4f')]=qs[_0xea18('0x46')](_['pick'](_0x29b792[_0xea18('0x45')],_0x18f0a5[_0xea18('0x46')]),_0x488abc);if(_0x29b792[_0xea18('0x45')][_0xea18('0x50')]){_0x47abc9['where']=_[_0xea18('0x51')](_0x47abc9[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x488abc,function(_0x356eb4){if(_0x356eb4['type']!==_0xea18('0x52')){var _0x470974={};_0x470974[_0x356eb4['name']]={'$like':'%'+_0x29b792['query'][_0xea18('0x50')]+'%'};return _0x470974;}})});}_0x47abc9=_[_0xea18('0x51')]({},_0x47abc9,_0x29b792[_0xea18('0x53')]);var _0x412e28={'where':_0x47abc9['where']};return db['SmsAccount'][_0xea18('0x2f')](_0x412e28)[_0xea18('0x20')](function(_0x38f8ab){_0x1f0d1f[_0xea18('0x2f')]=_0x38f8ab;if(_0x29b792['query'][_0xea18('0x54')]){_0x47abc9[_0xea18('0x55')]=[{'all':!![]}];}return db[_0xea18('0x56')][_0xea18('0x57')](_0x47abc9);})[_0xea18('0x20')](function(_0x38c7b6){_0x1f0d1f[_0xea18('0x58')]=_0x38c7b6;return _0x1f0d1f;})[_0xea18('0x20')](respondWithFilteredResult(_0x1992cc,_0x47abc9))[_0xea18('0x59')](handleError(_0x1992cc,null));};exports['show']=function(_0x5e4293,_0x29c6c9){var _0x4db4b6={'raw':![],'where':{'id':_0x5e4293[_0xea18('0x5a')]['id']},'include':[{'model':db['Pause'],'as':_0xea18('0x5b')}]},_0x4368ff={};_0x4368ff[_0xea18('0x43')]=_[_0xea18('0x44')](db['SmsAccount'][_0xea18('0x3f')]);_0x4368ff[_0xea18('0x45')]=_[_0xea18('0x44')](_0x5e4293[_0xea18('0x45')]);_0x4368ff['filters']=_[_0xea18('0x47')](_0x4368ff[_0xea18('0x43')],_0x4368ff[_0xea18('0x45')]);_0x4db4b6['attributes']=_['intersection'](_0x4368ff['model'],qs[_0xea18('0x48')](_0x5e4293[_0xea18('0x45')][_0xea18('0x48')]));_0x4db4b6[_0xea18('0x49')]=_0x4db4b6[_0xea18('0x49')][_0xea18('0x4a')]?_0x4db4b6[_0xea18('0x49')]:_0x4368ff[_0xea18('0x43')];if(_0x5e4293[_0xea18('0x45')][_0xea18('0x54')]){_0x4db4b6['include']=[{'all':!![]}];}_0x4db4b6=_['merge']({},_0x4db4b6,_0x5e4293[_0xea18('0x53')]);return db['SmsAccount'][_0xea18('0x5c')](_0x4db4b6)[_0xea18('0x20')](handleEntityNotFound(_0x29c6c9,null))[_0xea18('0x20')](respondWithResult(_0x29c6c9,null))[_0xea18('0x59')](handleError(_0x29c6c9,null));};exports[_0xea18('0x5d')]=function(_0x414bf2,_0x57b89b){return db['SmsAccount'][_0xea18('0x5d')](_0x414bf2['body'],{})[_0xea18('0x20')](function(_0x2a37db){var _0xb386cf=_0x414bf2[_0xea18('0x5e')][_0xea18('0x5f')]({'plain':!![]});if(!_0xb386cf)throw new Error(_0xea18('0x60'));if(_0xb386cf['role']==='user'){var _0x5c905f=_0x2a37db['get']({'plain':!![]});var _0x586fff=_0xea18('0x39');return db[_0xea18('0x61')]['find']({'where':{'name':_0x586fff,'userProfileId':_0xb386cf[_0xea18('0x62')]},'raw':!![]})['then'](function(_0x5507a3){if(_0x5507a3&&_0x5507a3[_0xea18('0x63')]===0x0){return db[_0xea18('0x64')][_0xea18('0x5d')]({'name':_0x5c905f[_0xea18('0x3b')],'resourceId':_0x5c905f['id'],'type':_0x5507a3[_0xea18('0x3b')],'sectionId':_0x5507a3['id']},{})[_0xea18('0x20')](function(){return _0x2a37db;});}else{return _0x2a37db;}})['catch'](function(_0x12b299){logger[_0xea18('0x26')](_0xea18('0x65'),_0x12b299);throw _0x12b299;});}return _0x2a37db;})[_0xea18('0x20')](respondWithResult(_0x57b89b,0xc9))[_0xea18('0x59')](handleError(_0x57b89b,null));};exports[_0xea18('0x37')]=function(_0x1d625c,_0x1fd40c){if(_0x1d625c[_0xea18('0x66')]['id']){delete _0x1d625c[_0xea18('0x66')]['id'];}return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x1d625c[_0xea18('0x5a')]['id']},'include':[{'model':db[_0xea18('0x3d')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1fd40c,null))[_0xea18('0x20')](saveUpdates(_0x1d625c['body'],null))[_0xea18('0x20')](respondWithResult(_0x1fd40c,null))[_0xea18('0x59')](handleError(_0x1fd40c,null));};exports[_0xea18('0x38')]=function(_0x584ad9,_0x2c8efa){return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x584ad9[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x2c8efa,null))[_0xea18('0x20')](removeEntity(_0x2c8efa,null))['catch'](handleError(_0x2c8efa,null));};exports[_0xea18('0x67')]=function(_0x158e25,_0x2bf95b){return db[_0xea18('0x56')][_0xea18('0x67')]()[_0xea18('0x20')](respondWithResult(_0x2bf95b,null))['catch'](handleError(_0x2bf95b,null));};exports['addDisposition']=function(_0x5168c5,_0x2df508,_0x416547){if(_0x5168c5[_0xea18('0x66')]['id']){delete _0x5168c5['body']['id'];}return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x5168c5[_0xea18('0x5a')]['id']}})['then'](handleEntityNotFound(_0x2df508,null))['then'](function(_0x302b1f){if(_0x302b1f){_0x5168c5[_0xea18('0x66')][_0xea18('0x68')]=_0x302b1f['id'];return db[_0xea18('0x69')][_0xea18('0x5d')](_0x5168c5[_0xea18('0x66')]);}})[_0xea18('0x20')](respondWithResult(_0x2df508,null))[_0xea18('0x59')](handleError(_0x2df508,null));};exports[_0xea18('0x6a')]=function(_0x54416a,_0x4f051a,_0x7f233f){var _0x4bb5ad={'raw':![],'where':{}};var _0x2d61c1={};var _0x47e2af={'count':0x0,'rows':[]};return db[_0xea18('0x56')]['findOne']({'where':{'id':_0x54416a[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x4f051a,null))[_0xea18('0x20')](function(_0x777708){if(_0x777708){_0x2d61c1[_0xea18('0x43')]=_[_0xea18('0x44')](db['Disposition'][_0xea18('0x3f')]);_0x2d61c1['query']=_[_0xea18('0x44')](_0x54416a[_0xea18('0x45')]);_0x2d61c1[_0xea18('0x46')]=_[_0xea18('0x47')](_0x2d61c1[_0xea18('0x43')],_0x2d61c1['query']);_0x4bb5ad[_0xea18('0x49')]=_[_0xea18('0x47')](_0x2d61c1[_0xea18('0x43')],qs[_0xea18('0x48')](_0x54416a[_0xea18('0x45')][_0xea18('0x48')]));_0x4bb5ad['attributes']=_0x4bb5ad[_0xea18('0x49')][_0xea18('0x4a')]?_0x4bb5ad['attributes']:_0x2d61c1[_0xea18('0x43')];if(!_0x54416a[_0xea18('0x45')]['hasOwnProperty']('nolimit')){_0x4bb5ad[_0xea18('0x30')]=qs[_0xea18('0x30')](_0x54416a[_0xea18('0x45')][_0xea18('0x30')]);_0x4bb5ad[_0xea18('0x2d')]=qs[_0xea18('0x2d')](_0x54416a[_0xea18('0x45')][_0xea18('0x2d')]);}_0x4bb5ad[_0xea18('0x4d')]=qs['sort'](_0x54416a[_0xea18('0x45')]['sort']);_0x4bb5ad[_0xea18('0x4f')]=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x54416a[_0xea18('0x45')],_0x2d61c1['filters']));_0x4bb5ad['where']['SmsAccountId']=_0x777708['id'];if(_0x54416a[_0xea18('0x45')]['filter']){_0x4bb5ad[_0xea18('0x4f')]=_[_0xea18('0x51')](_0x4bb5ad[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x4bb5ad[_0xea18('0x49')],function(_0x25976f){var _0x112c0b={};_0x112c0b[_0x25976f]={'$like':'%'+_0x54416a['query']['filter']+'%'};return _0x112c0b;})});}_0x4bb5ad=_[_0xea18('0x51')]({},_0x4bb5ad,_0x54416a[_0xea18('0x53')]);return db[_0xea18('0x69')]['count']({'where':_0x4bb5ad[_0xea18('0x4f')]})[_0xea18('0x20')](function(_0x57c8d4){_0x47e2af['count']=_0x57c8d4;if(_0x54416a[_0xea18('0x45')][_0xea18('0x54')]){_0x4bb5ad[_0xea18('0x55')]=[{'all':!![]}];}return db[_0xea18('0x69')]['findAll'](_0x4bb5ad);})[_0xea18('0x20')](function(_0x1552a1){_0x47e2af[_0xea18('0x58')]=_0x1552a1;return _0x47e2af;});}})['then'](respondWithFilteredResult(_0x4f051a,_0x4bb5ad))['catch'](handleError(_0x4f051a,null));};exports[_0xea18('0x6c')]=function(_0x1c8d80,_0x146ea1,_0x6bd0a8){return db['SmsAccount'][_0xea18('0x5c')]({'where':{'id':_0x1c8d80[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x146ea1,null))['then'](function(_0x393af9){if(_0x393af9){return _0x393af9[_0xea18('0x6c')](_0x1c8d80[_0xea18('0x45')][_0xea18('0x6d')]);}})[_0xea18('0x20')](respondWithStatusCode(_0x146ea1,null))[_0xea18('0x59')](handleError(_0x146ea1,null));};exports[_0xea18('0x6e')]=function(_0x22b016,_0x7a6b87,_0x4502e8){if(_0x22b016['body']['id']){delete _0x22b016['body']['id'];}return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x22b016[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x7a6b87,null))[_0xea18('0x20')](function(_0x51de7c){if(_0x51de7c){_0x22b016['body'][_0xea18('0x68')]=_0x51de7c['id'];return db[_0xea18('0x6f')]['create'](_0x22b016['body']);}})[_0xea18('0x20')](respondWithResult(_0x7a6b87,null))['catch'](handleError(_0x7a6b87,null));};exports[_0xea18('0x70')]=function(_0x75810f,_0x56f3d8,_0x142107){var _0x284892={'raw':![],'where':{}};var _0x422a31={};var _0x17da2f={'count':0x0,'rows':[]};return db[_0xea18('0x56')][_0xea18('0x71')]({'where':{'id':_0x75810f[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x56f3d8,null))['then'](function(_0x526e50){if(_0x526e50){_0x422a31[_0xea18('0x43')]=_['keys'](db[_0xea18('0x6f')][_0xea18('0x3f')]);_0x422a31[_0xea18('0x45')]=_[_0xea18('0x44')](_0x75810f[_0xea18('0x45')]);_0x422a31[_0xea18('0x46')]=_[_0xea18('0x47')](_0x422a31[_0xea18('0x43')],_0x422a31[_0xea18('0x45')]);_0x284892['attributes']=_['intersection'](_0x422a31[_0xea18('0x43')],qs['fields'](_0x75810f[_0xea18('0x45')][_0xea18('0x48')]));_0x284892[_0xea18('0x49')]=_0x284892[_0xea18('0x49')][_0xea18('0x4a')]?_0x284892[_0xea18('0x49')]:_0x422a31[_0xea18('0x43')];if(!_0x75810f[_0xea18('0x45')][_0xea18('0x4b')]('nolimit')){_0x284892[_0xea18('0x30')]=qs['limit'](_0x75810f[_0xea18('0x45')]['limit']);_0x284892[_0xea18('0x2d')]=qs['offset'](_0x75810f[_0xea18('0x45')]['offset']);}_0x284892['order']=qs['sort'](_0x75810f[_0xea18('0x45')][_0xea18('0x4e')]);_0x284892['where']=qs[_0xea18('0x46')](_['pick'](_0x75810f[_0xea18('0x45')],_0x422a31['filters']));_0x284892['where'][_0xea18('0x68')]=_0x526e50['id'];if(_0x75810f[_0xea18('0x45')][_0xea18('0x50')]){_0x284892[_0xea18('0x4f')]=_[_0xea18('0x51')](_0x284892['where'],{'$or':_['map'](_0x284892[_0xea18('0x49')],function(_0x282652){var _0x2bd9e4={};_0x2bd9e4[_0x282652]={'$like':'%'+_0x75810f[_0xea18('0x45')]['filter']+'%'};return _0x2bd9e4;})});}_0x284892=_[_0xea18('0x51')]({},_0x284892,_0x75810f[_0xea18('0x53')]);return db['CannedAnswer'][_0xea18('0x2f')]({'where':_0x284892[_0xea18('0x4f')]})[_0xea18('0x20')](function(_0x5bb284){_0x17da2f[_0xea18('0x2f')]=_0x5bb284;if(_0x75810f['query'][_0xea18('0x54')]){_0x284892[_0xea18('0x55')]=[{'all':!![]}];}return db[_0xea18('0x6f')]['findAll'](_0x284892);})['then'](function(_0x3d12f5){_0x17da2f[_0xea18('0x58')]=_0x3d12f5;return _0x17da2f;});}})['then'](respondWithFilteredResult(_0x56f3d8,_0x284892))[_0xea18('0x59')](handleError(_0x56f3d8,null));};exports[_0xea18('0x72')]=function(_0x675709,_0x7c46be,_0x17e9e8){return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x675709[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x7c46be,null))['then'](function(_0x1feea5){if(_0x1feea5){return _0x1feea5['removeAnswers'](_0x675709[_0xea18('0x45')][_0xea18('0x6d')]);}})[_0xea18('0x20')](respondWithStatusCode(_0x7c46be,null))[_0xea18('0x59')](handleError(_0x7c46be,null));};exports[_0xea18('0x73')]=function(_0x551c2a,_0x6a3f0b,_0x11ed24){var _0xb37e7={'channel':'sms'};var _0x2fd15a=[];var _0x1c7e4b=[];var _0x2b2ece={};return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x551c2a[_0xea18('0x5a')]['id']},'include':[{'model':db[_0xea18('0x74')],'as':_0xea18('0x75')}]})['then'](handleEntityNotFound(_0x6a3f0b,null))[_0xea18('0x20')](function(_0x458cb6){_0xb37e7['account']=_0x458cb6;_0xb37e7[_0xea18('0x76')]=_[_0xea18('0x77')](_0x458cb6[_0xea18('0x75')],[_0xea18('0x78')],[_0xea18('0x79')]);if(_0xb37e7['account'][_0xea18('0x75')]){delete _0xb37e7[_0xea18('0x7a')]['Applications'];}return db[_0xea18('0x7b')][_0xea18('0x67')]();})[_0xea18('0x20')](function(_0x2c3634){if(!_0x2c3634){throw new db['Sequelize'][(_0xea18('0x7c'))](_0xea18('0x7d'));}_0x2fd15a=_[_0xea18('0x7e')](_['keys'](_0x2c3634),[_0xea18('0x7f'),'updatedAt']);_0x1c7e4b=_['difference'](_[_0xea18('0x44')](_0x2c3634),[_0xea18('0x7f'),'updatedAt',_0xea18('0x80'),_0xea18('0x81')]);_0xb37e7[_0xea18('0x66')]={'mapKey':_0xea18('0x82')};if(_0xb37e7[_0xea18('0x7a')][_0xea18('0x41')]){switch(_0xb37e7[_0xea18('0x7a')][_0xea18('0x41')]){case _0xea18('0x83'):_0xb37e7['body'][_0xea18('0x84')]=_0x551c2a['body'][_0xea18('0x85')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x86')];_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')]['MessageSid'];break;case _0xea18('0x88'):_0xb37e7['body'][_0xea18('0x84')]='+'+_0x551c2a['body'][_0xea18('0x89')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x8a')];break;case _0xea18('0x8b'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x84')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a['body'][_0xea18('0x28')];break;case'clicksend':_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x84')];_0xb37e7['body'][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x66')];_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a['body']['message_id'];break;case'plivo':_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x85')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a['body']['Text'];_0xb37e7['body'][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')]['MessageUUID'];break;case _0xea18('0x8c'):_0xb37e7[_0xea18('0x66')]['from']='+'+_0x551c2a[_0xea18('0x66')][_0xea18('0x8d')][0x0][_0xea18('0x84')];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a['body']['results'][0x0][_0xea18('0x8a')];_0xb37e7['body'][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x8d')][0x0][_0xea18('0x87')];break;case _0xea18('0x8e'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')]['originatingAddress'];_0xb37e7['body']['body']=_0x551c2a[_0xea18('0x66')][_0xea18('0x8f')][_0xea18('0x28')];break;case _0xea18('0x90'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')]['fromNumber'];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x8a')];_0xb37e7['body'][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x91')];break;case'bandwidth':_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')][0x0]['message']['id'];_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')][0x0][_0xea18('0x28')]['from'];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][0x0]['message'][_0xea18('0x8a')];break;case _0xea18('0x92'):_0xb37e7[_0xea18('0x66')][_0xea18('0x84')]=_0x551c2a[_0xea18('0x66')]['from'];_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]=_0x551c2a[_0xea18('0x66')][_0xea18('0x28')];_0xb37e7[_0xea18('0x66')][_0xea18('0x87')]=_0x551c2a[_0xea18('0x66')]['refid'];break;}}if(_0xb37e7['body']['id']){delete _0xb37e7[_0xea18('0x66')]['id'];}if(_[_0xea18('0x93')](_0xb37e7['body'][_0xea18('0x84')])){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x95'));}if(_[_0xea18('0x93')](_0xb37e7[_0xea18('0x66')][_0xea18('0x66')])||_0xb37e7[_0xea18('0x66')][_0xea18('0x66')]===''){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x96'));}if(_[_0xea18('0x93')](_0xb37e7[_0xea18('0x66')]['mapKey'])){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x97')+_0x1c7e4b);}if(!_[_0xea18('0x98')](_0x1c7e4b,_0xb37e7[_0xea18('0x66')][_0xea18('0x99')])){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))](_0xea18('0x9a')+_0x1c7e4b);}_0x2b2ece[_0xb37e7[_0xea18('0x66')]['mapKey']]=_0xb37e7[_0xea18('0x66')][_0xea18('0x84')];return db['CmList'][_0xea18('0x5c')]({'where':{'id':_0xb37e7[_0xea18('0x7a')]['ListId']},'include':[{'model':db[_0xea18('0x7b')],'as':_0xea18('0x9b'),'where':_0x2b2ece,'limit':0x1,'order':[[_0xea18('0x9c'),_0xea18('0x9d')]]}]});})[_0xea18('0x20')](handleEntityNotFound(_0x6a3f0b,null))[_0xea18('0x20')](function(_0x48442d){if(_0x48442d){_0xb37e7[_0xea18('0x9e')]=_['omit'](_0x48442d,[_0xea18('0x9b')]);if(_0x48442d['Contacts']['length']){return _0x48442d[_0xea18('0x9b')][0x0];}var _0x34f2e5=_[_0xea18('0x17')](_0xb37e7[_0xea18('0x66')],{'firstName':_0xb37e7[_0xea18('0x66')]['from'],'ListId':_0x48442d['id']});_0x34f2e5[_0xb37e7[_0xea18('0x66')][_0xea18('0x99')]]=_0xb37e7[_0xea18('0x66')][_0xea18('0x84')];return db[_0xea18('0x7b')][_0xea18('0x5d')](_0x34f2e5,{'fields':_0x2fd15a,'raw':!![]});}})[_0xea18('0x20')](handleEntityNotFound(_0x6a3f0b,null))[_0xea18('0x20')](function(_0x19404a){if(_0x19404a){_0xb37e7[_0xea18('0x9f')]=_0x19404a;var _0x4e66de={'ContactId':_0x19404a['id'],'phone':_0xb37e7['body'][_0xea18('0x84')],'SmsAccountId':_0x551c2a[_0xea18('0x5a')]['id']};var _0x334c6e={'ContactId':_0x19404a['id'],'SmsAccountId':_0x551c2a['params']['id'],'closed':![]};return db[_0xea18('0xa0')][_0xea18('0x5c')]({'where':_0x334c6e})[_0xea18('0x20')](function(_0x3c691c){if(_0x3c691c){return[_0x3c691c,![]];}return db['SmsInteraction']['create'](_0x4e66de)[_0xea18('0x20')](function(_0x5cb9bc){return[_0x5cb9bc,!![]];});});}})['spread'](function(_0x3c871d,_0x387485){_0xb37e7['interaction']=_0x3c871d['get']({'plain':!![]});_0xb37e7[_0xea18('0xa1')][_0xea18('0xa2')]=![];if(_0x387485){if(_0xb37e7[_0xea18('0x7a')][_0xea18('0xa3')]){_0xb37e7[_0xea18('0x76')][_0xea18('0xa4')]({'id':0x0,'priority':_0xb37e7['applications'][_0xea18('0x4a')]+0x1,'app':_0xea18('0xa5'),'appdata':_0xea18('0xa6'),'interval':'*,*,*,*'});}_0xb37e7[_0xea18('0xa1')]['created']=!![];}return db[_0xea18('0xa7')][_0xea18('0x5d')]({'phone':_0xb37e7[_0xea18('0x66')][_0xea18('0x84')],'messageId':_0xb37e7[_0xea18('0x66')][_0xea18('0x87')],'body':_0xb37e7[_0xea18('0x66')][_0xea18('0x66')],'SmsAccountId':_0x551c2a[_0xea18('0x5a')]['id'],'SmsInteractionId':_0x3c871d['id'],'direction':'in','ContactId':_0x3c871d['ContactId'],'AttachmentId':_0xb37e7[_0xea18('0x66')][_0xea18('0xa8')]});})[_0xea18('0x20')](function(_0x11c66a){_0xb37e7[_0xea18('0x28')]=_0x11c66a;if(!_0xb37e7['interaction'][_0xea18('0xa9')])return;return db[_0xea18('0xaa')][_0xea18('0x5c')]({'attributes':['id',_0xea18('0x3b')],'where':{'id':_0xb37e7[_0xea18('0xa1')]['UserId']}});})[_0xea18('0x20')](function(_0x2ec477){if(_0x2ec477){_0xb37e7[_0xea18('0x76')]['unshift']({'id':0x0,'priority':0x0,'app':_0xea18('0xab'),'appdata':_0x2ec477['name']+','+(_0xb37e7[_0xea18('0x7a')]['waitForTheAssignedAgent']||0xa),'interval':_0xea18('0xac')});}if(!_0xb37e7['interaction'][_0xea18('0xad')])return;return db[_0xea18('0xae')][_0xea18('0x5c')]({'attributes':['id',_0xea18('0x3b')],'where':{'id':_0xb37e7[_0xea18('0xa1')][_0xea18('0xad')]}});})[_0xea18('0x20')](function(_0x379b5d){if(_0x379b5d){_0xb37e7[_0xea18('0x76')][_0xea18('0xaf')]({'id':0x0,'priority':0x1,'app':_0xea18('0xb0'),'appdata':_0x379b5d[_0xea18('0x3b')]+','+(_0xb37e7[_0xea18('0x7a')]['waitForTheAssignedQueue']||0x12c),'interval':_0xea18('0xac')});}return respondWithRpcPromise(_0xea18('0xb1'),_0xea18('0xb2'),_0xb37e7);})[_0xea18('0x20')](function(_0x269cd8){if(_0x269cd8){var _0x2e3849=0xc8;var _0x262e90=_0xea18('0xb3');logger[_0xea18('0x21')](_0xea18('0x24'),_0x262e90,_0x2e3849,_0xea18('0xb4'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x262e90,_0x2e3849,'entity\x20found',JSON['stringify'](_0x269cd8));if(_0xb37e7[_0xea18('0x7a')][_0xea18('0x41')]===_0xea18('0x83')){return _0x6a3f0b[_0xea18('0x2b')](_0x2e3849)[_0xea18('0x31')]('Content-Type',_0xea18('0xb5'))['send'](_0xea18('0xb6'));}else{return _0x6a3f0b['status'](_0x2e3849)[_0xea18('0x33')](_0x269cd8);}}})['catch'](handleError(_0x6a3f0b,null));};exports[_0xea18('0xb7')]=function(_0x4cfab3,_0x52f449){var _0xb531ac=_0x4cfab3['params']['id'];var _0x2281d7=_0x4cfab3['body'];var _0x3116a7=0xc8;var _0x2beff2=null;return db[_0xea18('0xb8')][_0xea18('0xb9')]({'isolationLevel':db[_0xea18('0xb8')]['Transaction'][_0xea18('0xba')]['READ_COMMITTED']},function(_0x2b6cee){return db['SmsAccount'][_0xea18('0x71')]({'where':{'id':_0xb531ac},'transaction':_0x2b6cee})[_0xea18('0x20')](function(_0x5c46b1){if(_0x5c46b1){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0xb531ac},'transaction':_0x2b6cee})[_0xea18('0x20')](function(){var _0xc60f0d=_[_0xea18('0x3e')](_0x2281d7,function(_0x4b9ac2){_0x4b9ac2[_0xea18('0x68')]=_0xb531ac;return _0x4b9ac2;});return db[_0xea18('0x74')]['bulkCreate'](_0xc60f0d,{'transaction':_0x2b6cee});});}else{_0x3116a7=0x194;_0x2beff2=[];}});})[_0xea18('0x20')](function(){if(_0x3116a7!==0x194){return db[_0xea18('0x74')]['findAndCountAll']({'where':{'SmsAccountId':_0xb531ac},'order':_0xea18('0x78')})['then'](function(_0x54c0ae){_0x2beff2=_0x54c0ae;});}})[_0xea18('0x59')](function(_0x442441){_0x3116a7=0x1f4;logger[_0xea18('0x26')](_0x442441[_0xea18('0x3a')]);if(_0x442441[_0xea18('0x3b')]){delete _0x442441[_0xea18('0x3b')];}_0x2beff2=_0x442441;})[_0xea18('0xbb')](function(){if(_0x2beff2===null){_0x52f449[_0xea18('0x2a')](_0x3116a7);}else{if(_0x3116a7===0x1f4){_0x52f449[_0xea18('0x2b')](_0x3116a7)[_0xea18('0xbc')](_0x2beff2);}else{_0x52f449[_0xea18('0x2b')](_0x3116a7)[_0xea18('0x33')](_0x2beff2);}}});};exports[_0xea18('0xbd')]=function(_0x438d6d,_0x3a8a2b,_0x4497cb){var _0x50136d={};var _0x18aa56={};var _0x2ed32b;var _0x35777b;return db[_0xea18('0x56')]['findOne']({'where':{'id':_0x438d6d[_0xea18('0x5a')]['id']}})['then'](handleEntityNotFound(_0x3a8a2b,null))[_0xea18('0x20')](function(_0x465899){if(_0x465899){_0x2ed32b=_0x465899;_0x18aa56[_0xea18('0x43')]=_[_0xea18('0x44')](db['SmsApplication']['rawAttributes']);_0x18aa56[_0xea18('0x45')]=_['keys'](_0x438d6d['query']);_0x18aa56[_0xea18('0x46')]=_[_0xea18('0x47')](_0x18aa56[_0xea18('0x43')],_0x18aa56[_0xea18('0x45')]);_0x50136d[_0xea18('0x49')]=_[_0xea18('0x47')](_0x18aa56['model'],qs[_0xea18('0x48')](_0x438d6d[_0xea18('0x45')][_0xea18('0x48')]));_0x50136d[_0xea18('0x49')]=_0x50136d[_0xea18('0x49')][_0xea18('0x4a')]?_0x50136d['attributes']:_0x18aa56['model'];_0x50136d[_0xea18('0x4d')]=qs['sort'](_0x438d6d[_0xea18('0x45')][_0xea18('0x4e')]);_0x50136d[_0xea18('0x4f')]=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x438d6d['query'],_0x18aa56[_0xea18('0x46')]));if(_0x438d6d[_0xea18('0x45')][_0xea18('0x50')]){_0x50136d[_0xea18('0x4f')]=_[_0xea18('0x51')](_0x50136d[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x50136d[_0xea18('0x49')],function(_0x31f568){var _0x50a8ff={};_0x50a8ff[_0x31f568]={'$like':'%'+_0x438d6d[_0xea18('0x45')][_0xea18('0x50')]+'%'};return _0x50a8ff;})});}_0x50136d=_[_0xea18('0x51')]({},_0x50136d,_0x438d6d['options']);return _0x2ed32b[_0xea18('0xbd')](_0x50136d);}})['then'](function(_0x3cea1f){if(_0x3cea1f){_0x35777b=_0x3cea1f[_0xea18('0x4a')];if(!_0x438d6d['query'][_0xea18('0x4b')](_0xea18('0x4c'))){_0x50136d[_0xea18('0x30')]=qs['limit'](_0x438d6d[_0xea18('0x45')][_0xea18('0x30')]);_0x50136d['offset']=qs[_0xea18('0x2d')](_0x438d6d[_0xea18('0x45')]['offset']);}return _0x2ed32b[_0xea18('0xbd')](_0x50136d);}})[_0xea18('0x20')](function(_0x4cb137){if(_0x4cb137){return _0x4cb137?{'count':_0x35777b,'rows':_0x4cb137}:null;}})[_0xea18('0x20')](respondWithResult(_0x3a8a2b,null))[_0xea18('0x59')](handleError(_0x3a8a2b,null));};exports['getInteractions']=function(_0x85338c,_0x5eb6d0,_0x416d64){var _0x261933={'raw':![],'where':{}};var _0x54aa89={};var _0x5b0616={'count':0x0,'rows':[]};return db['SmsAccount'][_0xea18('0x71')]({'where':{'id':_0x85338c['params']['id']}})['then'](handleEntityNotFound(_0x5eb6d0,null))[_0xea18('0x20')](function(_0x5d87ac){if(_0x5d87ac){_0x54aa89[_0xea18('0x43')]=_[_0xea18('0x44')](db[_0xea18('0xa0')][_0xea18('0x3f')]);_0x54aa89[_0xea18('0x45')]=_[_0xea18('0x44')](_0x85338c[_0xea18('0x45')]);_0x54aa89[_0xea18('0x46')]=_[_0xea18('0x47')](_0x54aa89['model'],_0x54aa89[_0xea18('0x45')]);_0x261933['attributes']=_[_0xea18('0x47')](_0x54aa89[_0xea18('0x43')],qs[_0xea18('0x48')](_0x85338c[_0xea18('0x45')][_0xea18('0x48')]));_0x261933[_0xea18('0x49')]=_0x261933['attributes'][_0xea18('0x4a')]?_0x261933['attributes']:_0x54aa89[_0xea18('0x43')];if(!_0x85338c[_0xea18('0x45')]['hasOwnProperty'](_0xea18('0x4c'))){_0x261933['limit']=qs[_0xea18('0x30')](_0x85338c[_0xea18('0x45')][_0xea18('0x30')]);_0x261933[_0xea18('0x2d')]=qs[_0xea18('0x2d')](_0x85338c[_0xea18('0x45')][_0xea18('0x2d')]);}_0x261933[_0xea18('0x4d')]=qs[_0xea18('0x4e')](_0x85338c['query'][_0xea18('0x4e')]);_0x261933[_0xea18('0x4f')]=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x85338c[_0xea18('0x45')],_0x54aa89[_0xea18('0x46')]));_0x261933[_0xea18('0x4f')][_0xea18('0x68')]=_0x5d87ac['id'];if(_0x85338c[_0xea18('0x45')][_0xea18('0x50')]){_0x261933['where']=_[_0xea18('0x51')](_0x261933['where'],{'$or':_[_0xea18('0x3e')](_0x261933[_0xea18('0x49')],function(_0x453b8f){var _0x399f48={};_0x399f48[_0x453b8f]={'$like':'%'+_0x85338c[_0xea18('0x45')][_0xea18('0x50')]+'%'};return _0x399f48;})});}_0x261933=_[_0xea18('0x51')]({},_0x261933,_0x85338c[_0xea18('0x53')]);return db[_0xea18('0xa0')][_0xea18('0x2f')]({'where':_0x261933[_0xea18('0x4f')]})['then'](function(_0x516244){_0x5b0616[_0xea18('0x2f')]=_0x516244;if(_0x85338c[_0xea18('0x45')]['includeAll']){_0x261933[_0xea18('0x55')]=[{'model':db[_0xea18('0x7b')],'as':_0xea18('0xbe'),'required':![]},{'model':db['User'],'as':_0xea18('0xbf'),'attributes':['name',_0xea18('0xc0'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xea18('0xc1'),'attributes':['id',_0xea18('0x3b'),_0xea18('0xc2')],'where':_0x85338c[_0xea18('0x45')][_0xea18('0xc3')]?{'id':_0x85338c['query'][_0xea18('0xc3')]}:undefined,'required':_0x85338c['query'][_0xea18('0xc3')]?!![]:![]}];}return db[_0xea18('0xa0')]['findAll'](_0x261933);})[_0xea18('0x20')](function(_0xca3f71){_0x5b0616[_0xea18('0x58')]=_0xca3f71;return _0x5b0616;});}})[_0xea18('0x20')](respondWithFilteredResult(_0x5eb6d0,_0x261933))[_0xea18('0x59')](handleError(_0x5eb6d0,null));};exports[_0xea18('0xbc')]=function(_0x32d6c1,_0x4936b6,_0xe34e7){var _0x44abe5,_0x4971e1,_0x37ab56;if(_['isNil'](_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')])||_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')]===''){throw new db[(_0xea18('0x94'))][(_0xea18('0x7c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xea18('0x93')](_0x32d6c1[_0xea18('0x66')]['to'])){throw new db['Sequelize'][(_0xea18('0x7c'))]('to\x20is\x20mandatory');}_0x44abe5=_0x32d6c1[_0xea18('0x66')]['to'];return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x32d6c1['params']['id']},'include':[{'model':db[_0xea18('0xc4')],'as':_0xea18('0xc5'),'include':[{'model':db['CmContact'],'as':_0xea18('0x9b'),'where':{'mobile':_0x44abe5},'limit':0x1,'order':[[_0xea18('0x9c'),_0xea18('0x9d')]]}]}]})['then'](handleEntityNotFound(_0x4936b6,null))[_0xea18('0x20')](function(_0x1c6b85){if(_0x1c6b85&&_0x1c6b85['List']){_0x4971e1=_0x1c6b85[_0xea18('0x5f')]({'plain':!![]});if(_0x4971e1[_0xea18('0xc5')]&&_0x4971e1[_0xea18('0xc5')][_0xea18('0x9b')][_0xea18('0x4a')]){return _0x4971e1['List']['Contacts'][0x0];}return db[_0xea18('0x7b')][_0xea18('0x5d')](_['defaults'](_0x32d6c1[_0xea18('0x66')],{'firstName':_0x44abe5,'mobile':_0x44abe5,'phone':_0x44abe5,'ListId':_0x4971e1['ListId']}));}})[_0xea18('0x20')](handleEntityNotFound(_0x4936b6,null))['then'](function(_0x2ca124){if(_0x2ca124){_0x37ab56=_0x2ca124;return db[_0xea18('0xa0')][_0xea18('0x5c')]({'where':{'ContactId':_0x37ab56['id'],'closed':![],'SmsAccountId':_0x4971e1['id']}})[_0xea18('0x20')](function(_0x5095a5){if(_0x5095a5){return[_0x5095a5,![]];}return db[_0xea18('0xa0')]['create']({'UserId':_0x32d6c1[_0xea18('0x5e')]['id'],'ContactId':_0x37ab56['id'],'SmsAccountId':_0x4971e1['id'],'phone':_0x44abe5,'firstMsgDirection':_0xea18('0xc6'),'Messages':[_[_0xea18('0x51')](_0x32d6c1[_0xea18('0x66')],{'read':![],'body':_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')],'phone':_0x44abe5,'SmsAccountId':_0x4971e1['id'],'UserId':_0x32d6c1['user']['id'],'ContactId':_0x37ab56['id']})]},{'include':[{'model':db[_0xea18('0xa7')],'as':_0xea18('0xc7')}]})[_0xea18('0x20')](function(_0x248ae7){return[_0x248ae7,!![]];});});}})['spread'](function(_0x33d8a0,_0x495f8a){if(_0x495f8a){return _0x33d8a0;}return db['SmsMessage'][_0xea18('0x5d')](_[_0xea18('0x51')](_0x32d6c1[_0xea18('0x66')],{'read':![],'body':_0x32d6c1[_0xea18('0x66')][_0xea18('0x66')],'phone':_0x44abe5,'SmsAccountId':_0x4971e1['id'],'SmsInteractionId':_0x33d8a0['id'],'UserId':_0x32d6c1['user']['id'],'ContactId':_0x37ab56['id']}))[_0xea18('0x20')](function(_0x312912){_0x33d8a0['dataValues'][_0xea18('0xc7')]=[];_0x33d8a0[_0xea18('0xc8')]['Messages']['push'](_0x312912['dataValues']);return _0x33d8a0;});})['then'](respondWithResult(_0x4936b6,null))['catch'](handleError(_0x4936b6,null));};exports[_0xea18('0x2b')]=function(_0x16e0f6,_0xc46a,_0x5abf4b){if(_0x16e0f6['body']['id']){delete _0x16e0f6[_0xea18('0x66')]['id'];}var _0x43666c,_0x24ea1e,_0x3fef54;return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x16e0f6[_0xea18('0x5a')]['id']}})['then'](handleEntityNotFound(_0xc46a,null))[_0xea18('0x20')](function(_0x531bec){if(_0x531bec){_0x3fef54=_0x531bec;logger[_0xea18('0xc9')](_0xea18('0x24'),'status','received\x20delivery\x20report\x20from',_0x531bec['type'],util['inspect'](_0x16e0f6['body'],{'showHidden':![],'depth':null}));switch(_0x531bec[_0xea18('0x41')]){case _0xea18('0x88'):if(_0x16e0f6[_0xea18('0x66')]['skebby_dispatch_id']&&_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')];return db['SmsMessage'][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')]['skebby_dispatch_id']}});}break;case _0xea18('0x8b'):if(_0x16e0f6[_0xea18('0x66')][_0xea18('0xca')]&&_0x16e0f6['body'][_0xea18('0xcb')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0xcb')];return db['SmsMessage'][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')][_0xea18('0xca')]}});}break;case _0xea18('0xcc'):if(_0x16e0f6[_0xea18('0x66')][_0xea18('0xcd')]&&_0x16e0f6[_0xea18('0x66')][_0xea18('0xce')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')]['status_code'];return db[_0xea18('0xa7')][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')][_0xea18('0xcd')]}});}break;case _0xea18('0x8c'):var _0x2e42ff=_0x16e0f6[_0xea18('0x66')][_0xea18('0x8d')][0x0];if(_0x2e42ff[_0xea18('0x87')]&&_0x2e42ff[_0xea18('0x2b')][_0xea18('0xcf')]===_0xea18('0xd0')){_0x24ea1e=_0x2e42ff[_0xea18('0x2b')][_0xea18('0xcf')];return db[_0xea18('0xa7')][_0xea18('0x5c')]({'where':{'messageId':_0x2e42ff[_0xea18('0x87')]}});}break;case _0xea18('0x90'):if(_0x16e0f6[_0xea18('0x66')][_0xea18('0x87')]&&_0x16e0f6[_0xea18('0x66')]['status']){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x16e0f6[_0xea18('0x66')]['messageId']}});}break;case _0xea18('0xd1'):if(_0x16e0f6['body'][0x0][_0xea18('0x28')]['id']){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][0x0][_0xea18('0x41')];return db['SmsMessage'][_0xea18('0x5c')]({'where':{'messageId':_0x16e0f6[_0xea18('0x66')][0x0]['message']['id']}});}break;case _0xea18('0x92'):if(_0x16e0f6[_0xea18('0x66')]['redif']&&_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')]){_0x24ea1e=_0x16e0f6[_0xea18('0x66')][_0xea18('0x2b')];return db['SmsMessage']['find']({'where':{'messageId':_0x16e0f6[_0xea18('0x66')]['redif']}});}break;}}})[_0xea18('0x20')](handleEntityNotFound(_0xc46a,null))[_0xea18('0x20')](function(_0x4ddda0){if(_0x4ddda0){_0x43666c=_0x4ddda0;switch(_0x3fef54['type']){case _0xea18('0x88'):if(_0x24ea1e===_0xea18('0xd0')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0x88'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0x8b'):if(_0x24ea1e==='1'){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0x88'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x16e0f6['body']['error_code']&&_0x24ea1e>=0xc8&&_0x24ea1e<=0xce){return _0x43666c['update']({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0xcc'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0x8c'):var _0x40453b=_0x16e0f6['body'][_0xea18('0x8d')][0x0];if(_0x40453b[_0xea18('0x2b')][_0xea18('0xcf')]===_0xea18('0xd0')){return _0x43666c['update']({'read':!![]});}else{logger[_0xea18('0x26')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0x8c'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0x24ea1e==_0xea18('0xd3')||_0x24ea1e==_0xea18('0xd4')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea18('0x2b'),_0xea18('0x90'),util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0xd1'):if(_0x24ea1e==_0xea18('0xd5')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger['error'](_0xea18('0x24'),_0xea18('0x2b'),'bandwidth',util[_0xea18('0xd2')](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;case _0xea18('0x92'):if(_0x24ea1e===_0xea18('0xd6')||_0x24ea1e===_0xea18('0xd7')){return _0x43666c[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea18('0x2b'),'intelepeer',util['inspect'](_0x16e0f6[_0xea18('0x66')],{'showHidden':![],'depth':null}));}break;}return _0x43666c;}})[_0xea18('0x20')](respondWithResult(_0xc46a,null))[_0xea18('0x59')](handleError(_0xc46a,null));};exports[_0xea18('0xd8')]=function(_0x16ac03,_0x14474e,_0xdd7c97){var _0x1ff9f6,_0x400309,_0x35e43d;return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x16ac03[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x14474e,null))[_0xea18('0x20')](function(_0x34f059){if(_0x34f059){_0x35e43d=_0x34f059;logger[_0xea18('0xc9')](_0xea18('0x24'),_0xea18('0x2b'),_0xea18('0xd9'),_0x34f059[_0xea18('0x41')],util[_0xea18('0xd2')](_0x16ac03['query'],{'showHidden':![],'depth':null}));switch(_0x34f059[_0xea18('0x41')]){case _0xea18('0x8e'):if(_0x16ac03[_0xea18('0x45')][_0xea18('0xda')]&&_0x16ac03[_0xea18('0x45')]['state']){_0x400309=_0x16ac03[_0xea18('0x45')][_0xea18('0xdb')];return db[_0xea18('0xa7')]['find']({'where':{'messageId':_0x16ac03[_0xea18('0x45')][_0xea18('0xda')]}});}break;}}})[_0xea18('0x20')](handleEntityNotFound(_0x14474e,null))[_0xea18('0x20')](function(_0x330895){if(_0x330895){_0x1ff9f6=_0x330895;switch(_0x35e43d[_0xea18('0x41')]){case _0xea18('0x8e'):if(_0x400309==='2'||_0x400309==='6'){return _0x1ff9f6[_0xea18('0x37')]({'read':!![]});}else{logger[_0xea18('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xea18('0x2b'),'csc',util[_0xea18('0xd2')](_0x16ac03[_0xea18('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x1ff9f6;}})[_0xea18('0x20')](respondWithResult(_0x14474e,null))['catch'](handleError(_0x14474e,null));};exports[_0xea18('0xdc')]=function(_0x4b8e3d,_0x4854e5,_0x130715){return db['SmsAccount']['find']({'where':{'id':_0x4b8e3d[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x4854e5,null))[_0xea18('0x20')](function(_0x2ba6af){if(_0x2ba6af){return _0x2ba6af['addAgents'](_0x4b8e3d[_0xea18('0x66')][_0xea18('0x6d')],_[_0xea18('0xdd')](_0x4b8e3d[_0xea18('0x66')],[_0xea18('0x6d'),'id'])||{})['spread'](function(_0x4a15fa){for(var _0x4a960b=0x0;_0x4a960b<_0x4b8e3d[_0xea18('0x66')][_0xea18('0x6d')]['length'];_0x4a960b+=0x1){socket['emit']('userSmsAccount:save',{'UserId':Number(_0x4b8e3d['body']['ids'][_0x4a960b]),'SmsAccountId':Number(_0x4b8e3d['params']['id'])});}return _0x4a15fa;});}})[_0xea18('0x20')](respondWithResult(_0x4854e5,null))[_0xea18('0x59')](handleError(_0x4854e5,null));};exports['removeAgents']=function(_0x12851d,_0x175d02,_0x521700){return db[_0xea18('0x56')][_0xea18('0x5c')]({'where':{'id':_0x12851d[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x175d02,null))[_0xea18('0x20')](function(_0xd6c1d9){if(_0xd6c1d9){return _0xd6c1d9[_0xea18('0xde')](_0x12851d[_0xea18('0x45')][_0xea18('0x6d')])[_0xea18('0x20')](function(){if(_[_0xea18('0xdf')](_0x12851d[_0xea18('0x45')][_0xea18('0x6d')])){for(var _0xc90ae8=0x0;_0xc90ae8<_0x12851d[_0xea18('0x45')][_0xea18('0x6d')][_0xea18('0x4a')];_0xc90ae8+=0x1){socket[_0xea18('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x12851d['query']['ids'][_0xc90ae8]),'SmsAccountId':Number(_0x12851d[_0xea18('0x5a')]['id'])});}}else{socket[_0xea18('0xe0')](_0xea18('0xe1'),{'UserId':Number(_0x12851d[_0xea18('0x45')][_0xea18('0x6d')]),'SmsAccountId':Number(_0x12851d['params']['id'])});}});}})[_0xea18('0x20')](respondWithStatusCode(_0x175d02,null))[_0xea18('0x59')](handleError(_0x175d02,null));};exports['getAgents']=function(_0x2c2cdd,_0x244872,_0x73a320){var _0x6212c0={};var _0x761d5a={};var _0x365a69;var _0x36c0a4;return db[_0xea18('0x56')][_0xea18('0x71')]({'where':{'id':_0x2c2cdd[_0xea18('0x5a')]['id']}})[_0xea18('0x20')](handleEntityNotFound(_0x244872,null))[_0xea18('0x20')](function(_0x2f5c13){if(_0x2f5c13){_0x365a69=_0x2f5c13;_0x761d5a['model']=_[_0xea18('0x44')](db[_0xea18('0xaa')][_0xea18('0x3f')]);_0x761d5a[_0xea18('0x45')]=_['keys'](_0x2c2cdd[_0xea18('0x45')]);_0x761d5a[_0xea18('0x46')]=_[_0xea18('0x47')](_0x761d5a[_0xea18('0x43')],_0x761d5a['query']);_0x6212c0[_0xea18('0x49')]=_[_0xea18('0x47')](_0x761d5a['model'],qs[_0xea18('0x48')](_0x2c2cdd[_0xea18('0x45')][_0xea18('0x48')]));_0x6212c0[_0xea18('0x49')]=_0x6212c0['attributes'][_0xea18('0x4a')]?_0x6212c0[_0xea18('0x49')]:_0x761d5a[_0xea18('0x43')];_0x6212c0[_0xea18('0x4d')]=qs[_0xea18('0x4e')](_0x2c2cdd[_0xea18('0x45')][_0xea18('0x4e')]);_0x6212c0['where']=qs[_0xea18('0x46')](_[_0xea18('0x6b')](_0x2c2cdd[_0xea18('0x45')],_0x761d5a[_0xea18('0x46')]));if(_0x2c2cdd[_0xea18('0x45')][_0xea18('0x50')]){_0x6212c0[_0xea18('0x4f')]=_['merge'](_0x6212c0[_0xea18('0x4f')],{'$or':_[_0xea18('0x3e')](_0x6212c0[_0xea18('0x49')],function(_0x501441){var _0x287066={};_0x287066[_0x501441]={'$like':'%'+_0x2c2cdd[_0xea18('0x45')][_0xea18('0x50')]+'%'};return _0x287066;})});}_0x6212c0=_[_0xea18('0x51')]({},_0x6212c0,_0x2c2cdd[_0xea18('0x53')]);return _0x365a69[_0xea18('0xe2')](_0x6212c0);}})[_0xea18('0x20')](function(_0x1efc55){if(_0x1efc55){_0x36c0a4=_0x1efc55[_0xea18('0x4a')];if(!_0x2c2cdd[_0xea18('0x45')][_0xea18('0x4b')]('nolimit')){_0x6212c0[_0xea18('0x30')]=qs[_0xea18('0x30')](_0x2c2cdd[_0xea18('0x45')]['limit']);_0x6212c0['offset']=qs[_0xea18('0x2d')](_0x2c2cdd['query'][_0xea18('0x2d')]);}return _0x365a69['getAgents'](_0x6212c0);}})['then'](function(_0x4ab962){if(_0x4ab962){return _0x4ab962?{'count':_0x36c0a4,'rows':_0x4ab962}:null;}})[_0xea18('0x20')](respondWithResult(_0x244872,null))[_0xea18('0x59')](handleError(_0x244872,null));}; \ No newline at end of file +var _0x384f=['destroy','get','SmsAccounts','stack','name','send','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','merge','VIRTUAL','filter','where','includeAll','findAll','rows','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileResource','params','describe','addDisposition','SmsAccountId','getDispositions','Disposition','order','options','include','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','SmsApplication','account','orderBy','Applications','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','From','Body','MessageSid','text','connectel','messageId','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','list','omit','contact','SmsInteraction','spread','interaction','created','applications','push','close','unmanaged','*,*,*,*','SmsMessage','ContactId','User','UserId','agent','waitForTheAssignedAgent','SmsQueue','queueId','queue','waitForTheAssignedQueue','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','set','\x0a','json','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Owner','fullname','Tag','Tags','color','tag','List','out','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','status_code','groupName','redif','skebby','error_code','clicksend','DELIVERED','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update'];(function(_0x2427e8,_0x4f7a0c){var _0x4a5c34=function(_0xdb17ab){while(--_0xdb17ab){_0x2427e8['push'](_0x2427e8['shift']());}};_0x4a5c34(++_0x4f7a0c);}(_0x384f,0xb1));var _0xf384=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x384f[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xf384('0x0'));var rimraf=require(_0xf384('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf384('0x2'));var rp=require(_0xf384('0x3'));var moment=require('moment');var BPromise=require(_0xf384('0x4'));var Mustache=require(_0xf384('0x5'));var util=require(_0xf384('0x6'));var path=require(_0xf384('0x7'));var sox=require('sox');var csv=require(_0xf384('0x8'));var ejs=require(_0xf384('0x9'));var fs=require('fs');var fs_extra=require(_0xf384('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf384('0xb'));var jsforce=require(_0xf384('0xc'));var deskjs=require(_0xf384('0xd'));var toCsv=require(_0xf384('0x8'));var querystring=require('querystring');var Papa=require(_0xf384('0xe'));var Redis=require(_0xf384('0xf'));var authService=require(_0xf384('0x10'));var qs=require(_0xf384('0x11'));var as=require(_0xf384('0x12'));var hardwareService=require(_0xf384('0x13'));var logger=require(_0xf384('0x14'))(_0xf384('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf384('0x16'));var db=require('../../mysqldb')['db'];config[_0xf384('0x17')]=_[_0xf384('0x18')](config['redis'],{'host':_0xf384('0x19'),'port':0x18eb});var socket=require(_0xf384('0x1a'))(new Redis(config['redis']));require(_0xf384('0x1b'))[_0xf384('0x1c')](socket);var jayson=require(_0xf384('0x1d'));var client=jayson[_0xf384('0x1e')][_0xf384('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x374413,_0xd06948,_0x121e64,_0x3c8c66){return new BPromise(function(_0x253707,_0x1a6083){var _0x2fe346=_0x3c8c66||client;return _0x2fe346[_0xf384('0x20')](_0x374413,_0x121e64)[_0xf384('0x21')](function(_0x3875f6){logger[_0xf384('0x22')](_0xf384('0x23'),_0xd06948,_0xf384('0x24'));logger[_0xf384('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xd06948,_0xf384('0x24'),JSON['stringify'](_0x3875f6));if(_0x3875f6[_0xf384('0x26')]){if(_0x3875f6[_0xf384('0x26')][_0xf384('0x27')]===0x1f4){logger[_0xf384('0x26')](_0xf384('0x23'),_0xd06948,_0x3875f6[_0xf384('0x26')][_0xf384('0x28')]);return _0x1a6083(_0x3875f6[_0xf384('0x26')]['message']);}logger['error'](_0xf384('0x23'),_0xd06948,_0x3875f6[_0xf384('0x26')][_0xf384('0x28')]);return _0x253707(_0x3875f6[_0xf384('0x26')][_0xf384('0x28')]);}else{logger[_0xf384('0x22')]('SmsAccount,\x20%s,\x20%s',_0xd06948,_0xf384('0x24'));_0x253707(_0x3875f6[_0xf384('0x29')][_0xf384('0x28')]);}})[_0xf384('0x2a')](function(_0xd8daff){logger[_0xf384('0x26')]('SmsAccount,\x20%s,\x20%s',_0xd06948,_0xd8daff);_0x1a6083(_0xd8daff);});});}function respondWithStatusCode(_0xcef116,_0x3a802a){_0x3a802a=_0x3a802a||0xcc;return function(_0xff543e){if(_0xff543e){return _0xcef116[_0xf384('0x2b')](_0x3a802a);}return _0xcef116[_0xf384('0x2c')](_0x3a802a)[_0xf384('0x2d')]();};}function respondWithResult(_0x2720e1,_0x4bab68){_0x4bab68=_0x4bab68||0xc8;return function(_0x1df5d4){if(_0x1df5d4){return _0x2720e1['status'](_0x4bab68)['json'](_0x1df5d4);}};}function respondWithFilteredResult(_0x520e7d,_0x3fae86){return function(_0x9a25fc){if(_0x9a25fc){var _0x2b140d=typeof _0x3fae86[_0xf384('0x2e')]===_0xf384('0x2f')&&typeof _0x3fae86[_0xf384('0x30')]===_0xf384('0x2f');var _0x4d12cc=_0x9a25fc[_0xf384('0x31')];var _0x2a1792=_0x2b140d?0x0:_0x3fae86[_0xf384('0x2e')];var _0x1a8033=_0x2b140d?_0x9a25fc[_0xf384('0x31')]:_0x3fae86[_0xf384('0x2e')]+_0x3fae86[_0xf384('0x30')];var _0x524086;if(_0x1a8033>=_0x4d12cc){_0x1a8033=_0x4d12cc;_0x524086=0xc8;}else{_0x524086=0xce;}_0x520e7d[_0xf384('0x2c')](_0x524086);return _0x520e7d['set'](_0xf384('0x32'),_0x2a1792+'-'+_0x1a8033+'/'+_0x4d12cc)['json'](_0x9a25fc);}return null;};}function patchUpdates(_0x49af7d){return function(_0x2332fb){try{jsonpatch[_0xf384('0x33')](_0x2332fb,_0x49af7d,!![]);}catch(_0x417d3d){return BPromise[_0xf384('0x34')](_0x417d3d);}return _0x2332fb[_0xf384('0x35')]();};}function saveUpdates(_0x1adc68,_0x54ecaa){return function(_0x34e489){if(_0x34e489){return _0x34e489[_0xf384('0x36')](_0x1adc68)[_0xf384('0x21')](function(_0x3cf1e2){return _0x3cf1e2;});}return null;};}function removeEntity(_0x2182e2,_0x30b9de){return function(_0x1e83a5){if(_0x1e83a5){return _0x1e83a5[_0xf384('0x37')]()[_0xf384('0x21')](function(){var _0x18d914=_0x1e83a5[_0xf384('0x38')]({'plain':!![]});var _0x56ae2d=_0xf384('0x39');return db['UserProfileResource'][_0xf384('0x37')]({'where':{'type':_0x56ae2d,'resourceId':_0x18d914['id']}})[_0xf384('0x21')](function(){return _0x1e83a5;});})['then'](function(){_0x2182e2[_0xf384('0x2c')](0xcc)[_0xf384('0x2d')]();});}};}function handleEntityNotFound(_0x1f3408,_0x86205b){return function(_0x2214d6){if(!_0x2214d6){_0x1f3408[_0xf384('0x2b')](0x194);}return _0x2214d6;};}function handleError(_0x255512,_0x4f5126){_0x4f5126=_0x4f5126||0x1f4;return function(_0x222f91){logger[_0xf384('0x26')](_0x222f91[_0xf384('0x3a')]);if(_0x222f91[_0xf384('0x3b')]){delete _0x222f91[_0xf384('0x3b')];}_0x255512[_0xf384('0x2c')](_0x4f5126)[_0xf384('0x3c')](_0x222f91);};}exports['index']=function(_0x427646,_0x50461b){var _0x226ec8={'include':[{'model':db[_0xf384('0x3d')],'as':_0xf384('0x3e')}]},_0x5017d7={},_0x36a647={'count':0x0,'rows':[]};var _0x502d98=_[_0xf384('0x3f')](db[_0xf384('0x40')][_0xf384('0x41')],function(_0x1e89ce){return{'name':_0x1e89ce[_0xf384('0x42')],'type':_0x1e89ce[_0xf384('0x43')][_0xf384('0x44')]};});_0x5017d7['model']=_['map'](_0x502d98,_0xf384('0x3b'));_0x5017d7[_0xf384('0x45')]=_[_0xf384('0x46')](_0x427646[_0xf384('0x45')]);_0x5017d7[_0xf384('0x47')]=_[_0xf384('0x48')](_0x5017d7[_0xf384('0x49')],_0x5017d7[_0xf384('0x45')]);_0x226ec8[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x5017d7['model'],qs[_0xf384('0x4b')](_0x427646[_0xf384('0x45')][_0xf384('0x4b')]));_0x226ec8[_0xf384('0x4a')]=_0x226ec8[_0xf384('0x4a')]['length']?_0x226ec8['attributes']:_0x5017d7[_0xf384('0x49')];if(!_0x427646[_0xf384('0x45')][_0xf384('0x4c')](_0xf384('0x4d'))){_0x226ec8['limit']=qs['limit'](_0x427646[_0xf384('0x45')][_0xf384('0x30')]);_0x226ec8['offset']=qs[_0xf384('0x2e')](_0x427646[_0xf384('0x45')]['offset']);}_0x226ec8['order']=qs['sort'](_0x427646[_0xf384('0x45')][_0xf384('0x4e')]);_0x226ec8['where']=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x427646['query'],_0x5017d7[_0xf384('0x47')]),_0x502d98);if(_0x427646[_0xf384('0x45')]['filter']){_0x226ec8['where']=_[_0xf384('0x50')](_0x226ec8['where'],{'$or':_[_0xf384('0x3f')](_0x502d98,function(_0xfff8f8){if(_0xfff8f8[_0xf384('0x43')]!==_0xf384('0x51')){var _0x1e0f77={};_0x1e0f77[_0xfff8f8[_0xf384('0x3b')]]={'$like':'%'+_0x427646['query'][_0xf384('0x52')]+'%'};return _0x1e0f77;}})});}_0x226ec8=_[_0xf384('0x50')]({},_0x226ec8,_0x427646['options']);var _0x3cec5c={'where':_0x226ec8[_0xf384('0x53')]};return db[_0xf384('0x40')][_0xf384('0x31')](_0x3cec5c)[_0xf384('0x21')](function(_0x4d8da8){_0x36a647[_0xf384('0x31')]=_0x4d8da8;if(_0x427646[_0xf384('0x45')][_0xf384('0x54')]){_0x226ec8['include']=[{'all':!![]}];}return db[_0xf384('0x40')][_0xf384('0x55')](_0x226ec8);})[_0xf384('0x21')](function(_0x3d8100){_0x36a647[_0xf384('0x56')]=_0x3d8100;return _0x36a647;})[_0xf384('0x21')](respondWithFilteredResult(_0x50461b,_0x226ec8))[_0xf384('0x2a')](handleError(_0x50461b,null));};exports['show']=function(_0x146c60,_0x542123){var _0x46dc50={'raw':![],'where':{'id':_0x146c60['params']['id']},'include':[{'model':db['Pause'],'as':_0xf384('0x3e')}]},_0x386395={};_0x386395[_0xf384('0x49')]=_[_0xf384('0x46')](db[_0xf384('0x40')][_0xf384('0x41')]);_0x386395[_0xf384('0x45')]=_['keys'](_0x146c60['query']);_0x386395[_0xf384('0x47')]=_[_0xf384('0x48')](_0x386395[_0xf384('0x49')],_0x386395['query']);_0x46dc50[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x386395['model'],qs[_0xf384('0x4b')](_0x146c60[_0xf384('0x45')][_0xf384('0x4b')]));_0x46dc50[_0xf384('0x4a')]=_0x46dc50[_0xf384('0x4a')][_0xf384('0x57')]?_0x46dc50[_0xf384('0x4a')]:_0x386395[_0xf384('0x49')];if(_0x146c60[_0xf384('0x45')]['includeAll']){_0x46dc50['include']=[{'all':!![]}];}_0x46dc50=_[_0xf384('0x50')]({},_0x46dc50,_0x146c60['options']);return db['SmsAccount'][_0xf384('0x58')](_0x46dc50)[_0xf384('0x21')](handleEntityNotFound(_0x542123,null))['then'](respondWithResult(_0x542123,null))['catch'](handleError(_0x542123,null));};exports[_0xf384('0x59')]=function(_0x390f53,_0x436023){return db[_0xf384('0x40')][_0xf384('0x59')](_0x390f53[_0xf384('0x5a')],{})[_0xf384('0x21')](function(_0x56e4de){var _0x438805=_0x390f53[_0xf384('0x5b')]['get']({'plain':!![]});if(!_0x438805)throw new Error(_0xf384('0x5c'));if(_0x438805['role']===_0xf384('0x5b')){var _0x3cf1d9=_0x56e4de[_0xf384('0x38')]({'plain':!![]});var _0x483021=_0xf384('0x39');return db['UserProfileSection'][_0xf384('0x58')]({'where':{'name':_0x483021,'userProfileId':_0x438805['userProfileId']},'raw':!![]})[_0xf384('0x21')](function(_0x357c4e){if(_0x357c4e&&_0x357c4e['autoAssociation']===0x0){return db[_0xf384('0x5d')]['create']({'name':_0x3cf1d9[_0xf384('0x3b')],'resourceId':_0x3cf1d9['id'],'type':_0x357c4e[_0xf384('0x3b')],'sectionId':_0x357c4e['id']},{})[_0xf384('0x21')](function(){return _0x56e4de;});}else{return _0x56e4de;}})[_0xf384('0x2a')](function(_0x140acf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x140acf);throw _0x140acf;});}return _0x56e4de;})[_0xf384('0x21')](respondWithResult(_0x436023,0xc9))[_0xf384('0x2a')](handleError(_0x436023,null));};exports[_0xf384('0x36')]=function(_0xa560e1,_0x2cec35){if(_0xa560e1[_0xf384('0x5a')]['id']){delete _0xa560e1['body']['id'];}return db['SmsAccount'][_0xf384('0x58')]({'where':{'id':_0xa560e1[_0xf384('0x5e')]['id']},'include':[{'model':db[_0xf384('0x3d')],'as':_0xf384('0x3e')}]})[_0xf384('0x21')](handleEntityNotFound(_0x2cec35,null))['then'](saveUpdates(_0xa560e1['body'],null))[_0xf384('0x21')](respondWithResult(_0x2cec35,null))[_0xf384('0x2a')](handleError(_0x2cec35,null));};exports[_0xf384('0x37')]=function(_0x1c3979,_0x3dff7d){return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x1c3979[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x3dff7d,null))['then'](removeEntity(_0x3dff7d,null))[_0xf384('0x2a')](handleError(_0x3dff7d,null));};exports[_0xf384('0x5f')]=function(_0x140183,_0x3301f7){return db[_0xf384('0x40')][_0xf384('0x5f')]()[_0xf384('0x21')](respondWithResult(_0x3301f7,null))[_0xf384('0x2a')](handleError(_0x3301f7,null));};exports[_0xf384('0x60')]=function(_0x5bce18,_0x1c44bc,_0x5a6dc8){if(_0x5bce18[_0xf384('0x5a')]['id']){delete _0x5bce18[_0xf384('0x5a')]['id'];}return db['SmsAccount'][_0xf384('0x58')]({'where':{'id':_0x5bce18[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x1c44bc,null))['then'](function(_0x56620c){if(_0x56620c){_0x5bce18[_0xf384('0x5a')][_0xf384('0x61')]=_0x56620c['id'];return db['Disposition']['create'](_0x5bce18[_0xf384('0x5a')]);}})[_0xf384('0x21')](respondWithResult(_0x1c44bc,null))[_0xf384('0x2a')](handleError(_0x1c44bc,null));};exports[_0xf384('0x62')]=function(_0x103e8e,_0x4cc4f9,_0x587f25){var _0x5525c4={'raw':![],'where':{}};var _0x309b61={};var _0x1119e9={'count':0x0,'rows':[]};return db[_0xf384('0x40')]['findOne']({'where':{'id':_0x103e8e[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4cc4f9,null))[_0xf384('0x21')](function(_0x37c2fa){if(_0x37c2fa){_0x309b61[_0xf384('0x49')]=_[_0xf384('0x46')](db[_0xf384('0x63')][_0xf384('0x41')]);_0x309b61[_0xf384('0x45')]=_['keys'](_0x103e8e['query']);_0x309b61[_0xf384('0x47')]=_[_0xf384('0x48')](_0x309b61[_0xf384('0x49')],_0x309b61[_0xf384('0x45')]);_0x5525c4[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x309b61['model'],qs[_0xf384('0x4b')](_0x103e8e[_0xf384('0x45')][_0xf384('0x4b')]));_0x5525c4[_0xf384('0x4a')]=_0x5525c4[_0xf384('0x4a')][_0xf384('0x57')]?_0x5525c4[_0xf384('0x4a')]:_0x309b61[_0xf384('0x49')];if(!_0x103e8e[_0xf384('0x45')][_0xf384('0x4c')]('nolimit')){_0x5525c4[_0xf384('0x30')]=qs[_0xf384('0x30')](_0x103e8e[_0xf384('0x45')][_0xf384('0x30')]);_0x5525c4['offset']=qs[_0xf384('0x2e')](_0x103e8e[_0xf384('0x45')]['offset']);}_0x5525c4[_0xf384('0x64')]=qs[_0xf384('0x4e')](_0x103e8e['query']['sort']);_0x5525c4[_0xf384('0x53')]=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x103e8e[_0xf384('0x45')],_0x309b61[_0xf384('0x47')]));_0x5525c4[_0xf384('0x53')][_0xf384('0x61')]=_0x37c2fa['id'];if(_0x103e8e[_0xf384('0x45')][_0xf384('0x52')]){_0x5525c4[_0xf384('0x53')]=_[_0xf384('0x50')](_0x5525c4[_0xf384('0x53')],{'$or':_['map'](_0x5525c4['attributes'],function(_0x7ce195){var _0x112e86={};_0x112e86[_0x7ce195]={'$like':'%'+_0x103e8e[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x112e86;})});}_0x5525c4=_[_0xf384('0x50')]({},_0x5525c4,_0x103e8e[_0xf384('0x65')]);return db[_0xf384('0x63')][_0xf384('0x31')]({'where':_0x5525c4['where']})[_0xf384('0x21')](function(_0x1883cd){_0x1119e9['count']=_0x1883cd;if(_0x103e8e[_0xf384('0x45')][_0xf384('0x54')]){_0x5525c4[_0xf384('0x66')]=[{'all':!![]}];}return db[_0xf384('0x63')]['findAll'](_0x5525c4);})['then'](function(_0x16311a){_0x1119e9['rows']=_0x16311a;return _0x1119e9;});}})[_0xf384('0x21')](respondWithFilteredResult(_0x4cc4f9,_0x5525c4))[_0xf384('0x2a')](handleError(_0x4cc4f9,null));};exports['removeDispositions']=function(_0xa6bd6e,_0xa9032f,_0x567f93){return db[_0xf384('0x40')]['find']({'where':{'id':_0xa6bd6e[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0xa9032f,null))[_0xf384('0x21')](function(_0x5e2266){if(_0x5e2266){return _0x5e2266[_0xf384('0x67')](_0xa6bd6e['query'][_0xf384('0x68')]);}})[_0xf384('0x21')](respondWithStatusCode(_0xa9032f,null))[_0xf384('0x2a')](handleError(_0xa9032f,null));};exports[_0xf384('0x69')]=function(_0x1e57a0,_0x403cfe,_0x364525){if(_0x1e57a0[_0xf384('0x5a')]['id']){delete _0x1e57a0['body']['id'];}return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x1e57a0[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x403cfe,null))[_0xf384('0x21')](function(_0x1b8cac){if(_0x1b8cac){_0x1e57a0[_0xf384('0x5a')][_0xf384('0x61')]=_0x1b8cac['id'];return db['CannedAnswer']['create'](_0x1e57a0['body']);}})['then'](respondWithResult(_0x403cfe,null))['catch'](handleError(_0x403cfe,null));};exports[_0xf384('0x6a')]=function(_0x26bd9d,_0x36f96d,_0x5c109a){var _0x45a19e={'raw':![],'where':{}};var _0x356235={};var _0x24393c={'count':0x0,'rows':[]};return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x26bd9d[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x36f96d,null))[_0xf384('0x21')](function(_0x186524){if(_0x186524){_0x356235['model']=_['keys'](db[_0xf384('0x6c')][_0xf384('0x41')]);_0x356235[_0xf384('0x45')]=_[_0xf384('0x46')](_0x26bd9d['query']);_0x356235[_0xf384('0x47')]=_[_0xf384('0x48')](_0x356235[_0xf384('0x49')],_0x356235[_0xf384('0x45')]);_0x45a19e[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x356235[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x26bd9d['query'][_0xf384('0x4b')]));_0x45a19e[_0xf384('0x4a')]=_0x45a19e[_0xf384('0x4a')][_0xf384('0x57')]?_0x45a19e['attributes']:_0x356235[_0xf384('0x49')];if(!_0x26bd9d['query'][_0xf384('0x4c')](_0xf384('0x4d'))){_0x45a19e['limit']=qs[_0xf384('0x30')](_0x26bd9d[_0xf384('0x45')]['limit']);_0x45a19e['offset']=qs[_0xf384('0x2e')](_0x26bd9d['query']['offset']);}_0x45a19e[_0xf384('0x64')]=qs[_0xf384('0x4e')](_0x26bd9d['query'][_0xf384('0x4e')]);_0x45a19e[_0xf384('0x53')]=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x26bd9d[_0xf384('0x45')],_0x356235['filters']));_0x45a19e['where']['SmsAccountId']=_0x186524['id'];if(_0x26bd9d[_0xf384('0x45')]['filter']){_0x45a19e[_0xf384('0x53')]=_[_0xf384('0x50')](_0x45a19e['where'],{'$or':_[_0xf384('0x3f')](_0x45a19e[_0xf384('0x4a')],function(_0x1579a7){var _0x120a4e={};_0x120a4e[_0x1579a7]={'$like':'%'+_0x26bd9d[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x120a4e;})});}_0x45a19e=_[_0xf384('0x50')]({},_0x45a19e,_0x26bd9d[_0xf384('0x65')]);return db[_0xf384('0x6c')][_0xf384('0x31')]({'where':_0x45a19e[_0xf384('0x53')]})[_0xf384('0x21')](function(_0x35a1e0){_0x24393c[_0xf384('0x31')]=_0x35a1e0;if(_0x26bd9d[_0xf384('0x45')][_0xf384('0x54')]){_0x45a19e['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xf384('0x55')](_0x45a19e);})[_0xf384('0x21')](function(_0x377cc0){_0x24393c[_0xf384('0x56')]=_0x377cc0;return _0x24393c;});}})[_0xf384('0x21')](respondWithFilteredResult(_0x36f96d,_0x45a19e))[_0xf384('0x2a')](handleError(_0x36f96d,null));};exports[_0xf384('0x6d')]=function(_0x4dbb17,_0x3499ac,_0x12ba04){return db[_0xf384('0x40')]['find']({'where':{'id':_0x4dbb17[_0xf384('0x5e')]['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x3499ac,null))['then'](function(_0x20e927){if(_0x20e927){return _0x20e927[_0xf384('0x6d')](_0x4dbb17[_0xf384('0x45')][_0xf384('0x68')]);}})[_0xf384('0x21')](respondWithStatusCode(_0x3499ac,null))[_0xf384('0x2a')](handleError(_0x3499ac,null));};exports[_0xf384('0x6e')]=function(_0x8e720a,_0x11a36d,_0x16dd82){var _0xfa32f4={'channel':'sms'};var _0x125d95=[];var _0x215642=[];var _0x1c2d87={};return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x8e720a[_0xf384('0x5e')]['id']},'include':[{'model':db[_0xf384('0x6f')],'as':'Applications'}]})['then'](handleEntityNotFound(_0x11a36d,null))[_0xf384('0x21')](function(_0x34b0cf){_0xfa32f4[_0xf384('0x70')]=_0x34b0cf;_0xfa32f4['applications']=_[_0xf384('0x71')](_0x34b0cf[_0xf384('0x72')],[_0xf384('0x73')],[_0xf384('0x74')]);if(_0xfa32f4['account'][_0xf384('0x72')]){delete _0xfa32f4[_0xf384('0x70')]['Applications'];}return db[_0xf384('0x75')][_0xf384('0x5f')]();})[_0xf384('0x21')](function(_0x3304f4){if(!_0x3304f4){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x78'));}_0x125d95=_[_0xf384('0x79')](_[_0xf384('0x46')](_0x3304f4),[_0xf384('0x7a'),_0xf384('0x7b')]);_0x215642=_[_0xf384('0x79')](_[_0xf384('0x46')](_0x3304f4),[_0xf384('0x7a'),_0xf384('0x7b'),'CompanyId','ListId']);_0xfa32f4[_0xf384('0x5a')]={'mapKey':_0xf384('0x7c')};if(_0xfa32f4[_0xf384('0x70')][_0xf384('0x43')]){switch(_0xfa32f4['account'][_0xf384('0x43')]){case _0xf384('0x7d'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7f')];_0xfa32f4['body'][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x80')];_0xfa32f4[_0xf384('0x5a')]['messageId']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x81')];break;case'skebby':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]='+'+_0x8e720a[_0xf384('0x5a')]['sender'];_0xfa32f4['body']['body']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x82')];break;case _0xf384('0x83'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7e')];_0xfa32f4['body'][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')]['message'];break;case'clicksend':_0xfa32f4['body'][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7e')];_0xfa32f4['body']['body']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x5a')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a['body'][_0xf384('0x85')];break;case'plivo':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x7f')];_0xfa32f4[_0xf384('0x5a')]['body']=_0x8e720a['body'][_0xf384('0x86')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x87')];break;case _0xf384('0x88'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]='+'+_0x8e720a['body'][_0xf384('0x89')][0x0][_0xf384('0x7e')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a['body'][_0xf384('0x89')][0x0][_0xf384('0x82')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a['body'][_0xf384('0x89')][0x0]['messageId'];break;case _0xf384('0x8a'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x8b')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')][_0xf384('0x8c')]['message'];break;case _0xf384('0x8d'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')]=_0x8e720a['body'][_0xf384('0x8e')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')]['text'];_0xfa32f4[_0xf384('0x5a')]['messageId']=_0x8e720a['body'][_0xf384('0x8f')];break;case _0xf384('0x90'):_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')]=_0x8e720a[_0xf384('0x5a')][0x0]['message']['id'];_0xfa32f4['body'][_0xf384('0x7e')]=_0x8e720a['body'][0x0][_0xf384('0x28')][_0xf384('0x7e')];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')][0x0][_0xf384('0x28')][_0xf384('0x82')];break;case _0xf384('0x91'):_0xfa32f4[_0xf384('0x5a')]['from']=_0x8e720a[_0xf384('0x5a')]['from'];_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]=_0x8e720a[_0xf384('0x5a')]['message'];_0xfa32f4[_0xf384('0x5a')]['messageId']=_0x8e720a[_0xf384('0x5a')][_0xf384('0x92')];break;}}if(_0xfa32f4[_0xf384('0x5a')]['id']){delete _0xfa32f4[_0xf384('0x5a')]['id'];}if(_[_0xf384('0x93')](_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))]('from\x20is\x20mandatory');}if(_[_0xf384('0x93')](_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')])||_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')]===''){throw new db['Sequelize']['ValidationError'](_0xf384('0x94'));}if(_[_0xf384('0x93')](_0xfa32f4['body']['mapKey'])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x95')+_0x215642);}if(!_[_0xf384('0x96')](_0x215642,_0xfa32f4[_0xf384('0x5a')][_0xf384('0x97')])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x98')+_0x215642);}_0x1c2d87[_0xfa32f4['body'][_0xf384('0x97')]]=_0xfa32f4[_0xf384('0x5a')]['from'];return db[_0xf384('0x99')]['find']({'where':{'id':_0xfa32f4[_0xf384('0x70')][_0xf384('0x9a')]},'include':[{'model':db[_0xf384('0x75')],'as':_0xf384('0x9b'),'where':_0x1c2d87,'limit':0x1,'order':[[_0xf384('0x7b'),_0xf384('0x9c')]]}]});})[_0xf384('0x21')](handleEntityNotFound(_0x11a36d,null))[_0xf384('0x21')](function(_0x2db34a){if(_0x2db34a){_0xfa32f4[_0xf384('0x9d')]=_[_0xf384('0x9e')](_0x2db34a,['Contacts']);if(_0x2db34a[_0xf384('0x9b')][_0xf384('0x57')]){return _0x2db34a[_0xf384('0x9b')][0x0];}var _0xe63a8d=_[_0xf384('0x18')](_0xfa32f4[_0xf384('0x5a')],{'firstName':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')],'ListId':_0x2db34a['id']});_0xe63a8d[_0xfa32f4[_0xf384('0x5a')][_0xf384('0x97')]]=_0xfa32f4['body'][_0xf384('0x7e')];return db[_0xf384('0x75')]['create'](_0xe63a8d,{'fields':_0x125d95,'raw':!![]});}})['then'](handleEntityNotFound(_0x11a36d,null))[_0xf384('0x21')](function(_0x3a005f){if(_0x3a005f){_0xfa32f4[_0xf384('0x9f')]=_0x3a005f;var _0x13de4f={'ContactId':_0x3a005f['id'],'phone':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x7e')],'SmsAccountId':_0x8e720a['params']['id']};var _0x34449d={'ContactId':_0x3a005f['id'],'SmsAccountId':_0x8e720a[_0xf384('0x5e')]['id'],'closed':![]};return db[_0xf384('0xa0')]['find']({'where':_0x34449d})[_0xf384('0x21')](function(_0x41778f){if(_0x41778f){return[_0x41778f,![]];}return db[_0xf384('0xa0')]['create'](_0x13de4f)[_0xf384('0x21')](function(_0x340913){return[_0x340913,!![]];});});}})[_0xf384('0xa1')](function(_0x3577ef,_0xcc5541){_0xfa32f4['interaction']=_0x3577ef[_0xf384('0x38')]({'plain':!![]});_0xfa32f4[_0xf384('0xa2')][_0xf384('0xa3')]=![];if(_0xcc5541){if(_0xfa32f4[_0xf384('0x70')]['autoclose']){_0xfa32f4[_0xf384('0xa4')][_0xf384('0xa5')]({'id':0x0,'priority':_0xfa32f4[_0xf384('0xa4')][_0xf384('0x57')]+0x1,'app':_0xf384('0xa6'),'appdata':_0xf384('0xa7'),'interval':_0xf384('0xa8')});}_0xfa32f4['interaction'][_0xf384('0xa3')]=!![];}return db[_0xf384('0xa9')]['create']({'phone':_0xfa32f4[_0xf384('0x5a')]['from'],'messageId':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x84')],'body':_0xfa32f4[_0xf384('0x5a')][_0xf384('0x5a')],'SmsAccountId':_0x8e720a[_0xf384('0x5e')]['id'],'SmsInteractionId':_0x3577ef['id'],'direction':'in','ContactId':_0x3577ef[_0xf384('0xaa')],'AttachmentId':_0xfa32f4['body']['AttachmentId']});})[_0xf384('0x21')](function(_0x149e00){_0xfa32f4[_0xf384('0x28')]=_0x149e00;if(!_0xfa32f4['interaction']['UserId'])return;return db[_0xf384('0xab')][_0xf384('0x58')]({'attributes':['id',_0xf384('0x3b')],'where':{'id':_0xfa32f4[_0xf384('0xa2')][_0xf384('0xac')]}});})[_0xf384('0x21')](function(_0x3b9885){if(_0x3b9885){_0xfa32f4[_0xf384('0xa4')]['unshift']({'id':0x0,'priority':0x0,'app':_0xf384('0xad'),'appdata':_0x3b9885[_0xf384('0x3b')]+','+(_0xfa32f4[_0xf384('0x70')][_0xf384('0xae')]||0xa),'interval':_0xf384('0xa8')});}if(!_0xfa32f4[_0xf384('0xa2')]['queueId'])return;return db[_0xf384('0xaf')]['find']({'attributes':['id','name'],'where':{'id':_0xfa32f4[_0xf384('0xa2')][_0xf384('0xb0')]}});})[_0xf384('0x21')](function(_0x511775){if(_0x511775){_0xfa32f4[_0xf384('0xa4')]['unshift']({'id':0x0,'priority':0x1,'app':_0xf384('0xb1'),'appdata':_0x511775[_0xf384('0x3b')]+','+(_0xfa32f4[_0xf384('0x70')][_0xf384('0xb2')]||0x12c),'interval':_0xf384('0xa8')});}return respondWithRpcPromise('Start',_0xf384('0xb3'),_0xfa32f4);})[_0xf384('0x21')](function(_0x5bcae2){if(_0x5bcae2){var _0xbb02cd=0xc8;var _0xf0a033=_0xf384('0xb4');logger[_0xf384('0x22')](_0xf384('0xb5'),_0xf0a033,_0xbb02cd,_0xf384('0xb6'));logger[_0xf384('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0xf0a033,_0xbb02cd,_0xf384('0xb6'),JSON[_0xf384('0xb7')](_0x5bcae2));if(_0xfa32f4[_0xf384('0x70')][_0xf384('0x43')]===_0xf384('0x7d')){return _0x11a36d[_0xf384('0x2c')](_0xbb02cd)[_0xf384('0xb8')]('Content-Type','text/xml')[_0xf384('0x3c')](_0xf384('0xb9'));}else{return _0x11a36d[_0xf384('0x2c')](_0xbb02cd)[_0xf384('0xba')](_0x5bcae2);}}})[_0xf384('0x2a')](handleError(_0x11a36d,null));};exports[_0xf384('0xbb')]=function(_0x2f7e22,_0x3dec3e){var _0x200de8=_0x2f7e22[_0xf384('0x5e')]['id'];var _0xc6ba1f=_0x2f7e22[_0xf384('0x5a')];var _0x1ec342=0xc8;var _0x3e26fb=null;return db[_0xf384('0xbc')][_0xf384('0xbd')]({'isolationLevel':db['sequelize'][_0xf384('0xbe')][_0xf384('0xbf')][_0xf384('0xc0')]},function(_0x370aa4){return db['SmsAccount'][_0xf384('0x6b')]({'where':{'id':_0x200de8},'transaction':_0x370aa4})[_0xf384('0x21')](function(_0x150bcf){if(_0x150bcf){return db['SmsApplication']['destroy']({'where':{'SmsAccountId':_0x200de8},'transaction':_0x370aa4})[_0xf384('0x21')](function(){var _0x357c3b=_['map'](_0xc6ba1f,function(_0x506da5){_0x506da5['SmsAccountId']=_0x200de8;return _0x506da5;});return db[_0xf384('0x6f')][_0xf384('0xc1')](_0x357c3b,{'transaction':_0x370aa4});});}else{_0x1ec342=0x194;_0x3e26fb=[];}});})[_0xf384('0x21')](function(){if(_0x1ec342!==0x194){return db[_0xf384('0x6f')][_0xf384('0xc2')]({'where':{'SmsAccountId':_0x200de8},'order':_0xf384('0x73')})[_0xf384('0x21')](function(_0x2bffd5){_0x3e26fb=_0x2bffd5;});}})[_0xf384('0x2a')](function(_0x99b15f){_0x1ec342=0x1f4;logger[_0xf384('0x26')](_0x99b15f[_0xf384('0x3a')]);if(_0x99b15f['name']){delete _0x99b15f[_0xf384('0x3b')];}_0x3e26fb=_0x99b15f;})[_0xf384('0xc3')](function(){if(_0x3e26fb===null){_0x3dec3e[_0xf384('0x2b')](_0x1ec342);}else{if(_0x1ec342===0x1f4){_0x3dec3e['status'](_0x1ec342)[_0xf384('0x3c')](_0x3e26fb);}else{_0x3dec3e[_0xf384('0x2c')](_0x1ec342)[_0xf384('0xba')](_0x3e26fb);}}});};exports['getApplications']=function(_0x24b0a3,_0x17ffa1,_0x5ee1c9){var _0x3930f7={};var _0x149197={};var _0x4ae467;var _0x17e3f3;return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x24b0a3['params']['id']}})['then'](handleEntityNotFound(_0x17ffa1,null))[_0xf384('0x21')](function(_0x155351){if(_0x155351){_0x4ae467=_0x155351;_0x149197[_0xf384('0x49')]=_[_0xf384('0x46')](db['SmsApplication'][_0xf384('0x41')]);_0x149197[_0xf384('0x45')]=_[_0xf384('0x46')](_0x24b0a3[_0xf384('0x45')]);_0x149197[_0xf384('0x47')]=_['intersection'](_0x149197[_0xf384('0x49')],_0x149197[_0xf384('0x45')]);_0x3930f7[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x149197[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x24b0a3['query'][_0xf384('0x4b')]));_0x3930f7[_0xf384('0x4a')]=_0x3930f7[_0xf384('0x4a')][_0xf384('0x57')]?_0x3930f7['attributes']:_0x149197[_0xf384('0x49')];_0x3930f7[_0xf384('0x64')]=qs['sort'](_0x24b0a3[_0xf384('0x45')][_0xf384('0x4e')]);_0x3930f7['where']=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x24b0a3[_0xf384('0x45')],_0x149197[_0xf384('0x47')]));if(_0x24b0a3[_0xf384('0x45')][_0xf384('0x52')]){_0x3930f7[_0xf384('0x53')]=_[_0xf384('0x50')](_0x3930f7[_0xf384('0x53')],{'$or':_['map'](_0x3930f7['attributes'],function(_0x237588){var _0x3ba75d={};_0x3ba75d[_0x237588]={'$like':'%'+_0x24b0a3[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x3ba75d;})});}_0x3930f7=_[_0xf384('0x50')]({},_0x3930f7,_0x24b0a3[_0xf384('0x65')]);return _0x4ae467[_0xf384('0xc4')](_0x3930f7);}})[_0xf384('0x21')](function(_0x3dc055){if(_0x3dc055){_0x17e3f3=_0x3dc055['length'];if(!_0x24b0a3['query']['hasOwnProperty'](_0xf384('0x4d'))){_0x3930f7[_0xf384('0x30')]=qs['limit'](_0x24b0a3[_0xf384('0x45')][_0xf384('0x30')]);_0x3930f7[_0xf384('0x2e')]=qs['offset'](_0x24b0a3['query']['offset']);}return _0x4ae467[_0xf384('0xc4')](_0x3930f7);}})[_0xf384('0x21')](function(_0x44b2d5){if(_0x44b2d5){return _0x44b2d5?{'count':_0x17e3f3,'rows':_0x44b2d5}:null;}})['then'](respondWithResult(_0x17ffa1,null))['catch'](handleError(_0x17ffa1,null));};exports[_0xf384('0xc5')]=function(_0x1bc779,_0x1130db,_0x279caf){var _0x3eba98={'raw':![],'where':{}};var _0x2f0a52={};var _0x55b6aa={'count':0x0,'rows':[]};return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x1bc779['params']['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x1130db,null))[_0xf384('0x21')](function(_0x4b78ba){if(_0x4b78ba){_0x2f0a52['model']=_[_0xf384('0x46')](db[_0xf384('0xa0')]['rawAttributes']);_0x2f0a52['query']=_[_0xf384('0x46')](_0x1bc779[_0xf384('0x45')]);_0x2f0a52['filters']=_[_0xf384('0x48')](_0x2f0a52[_0xf384('0x49')],_0x2f0a52[_0xf384('0x45')]);_0x3eba98[_0xf384('0x4a')]=_[_0xf384('0x48')](_0x2f0a52[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x1bc779['query'][_0xf384('0x4b')]));_0x3eba98[_0xf384('0x4a')]=_0x3eba98[_0xf384('0x4a')][_0xf384('0x57')]?_0x3eba98['attributes']:_0x2f0a52['model'];if(!_0x1bc779[_0xf384('0x45')][_0xf384('0x4c')](_0xf384('0x4d'))){_0x3eba98['limit']=qs[_0xf384('0x30')](_0x1bc779[_0xf384('0x45')][_0xf384('0x30')]);_0x3eba98[_0xf384('0x2e')]=qs[_0xf384('0x2e')](_0x1bc779[_0xf384('0x45')][_0xf384('0x2e')]);}_0x3eba98['order']=qs[_0xf384('0x4e')](_0x1bc779['query'][_0xf384('0x4e')]);_0x3eba98[_0xf384('0x53')]=qs[_0xf384('0x47')](_['pick'](_0x1bc779[_0xf384('0x45')],_0x2f0a52['filters']));_0x3eba98[_0xf384('0x53')][_0xf384('0x61')]=_0x4b78ba['id'];if(_0x1bc779[_0xf384('0x45')]['filter']){_0x3eba98[_0xf384('0x53')]=_[_0xf384('0x50')](_0x3eba98['where'],{'$or':_[_0xf384('0x3f')](_0x3eba98[_0xf384('0x4a')],function(_0x1dafc6){var _0x520b37={};_0x520b37[_0x1dafc6]={'$like':'%'+_0x1bc779[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x520b37;})});}_0x3eba98=_['merge']({},_0x3eba98,_0x1bc779['options']);return db[_0xf384('0xa0')]['count']({'where':_0x3eba98['where']})[_0xf384('0x21')](function(_0xcd6dcd){_0x55b6aa[_0xf384('0x31')]=_0xcd6dcd;if(_0x1bc779['query'][_0xf384('0x54')]){_0x3eba98[_0xf384('0x66')]=[{'model':db[_0xf384('0x75')],'as':'Contact','required':![]},{'model':db[_0xf384('0xab')],'as':_0xf384('0xc6'),'attributes':[_0xf384('0x3b'),_0xf384('0xc7'),'internal'],'required':![]},{'model':db[_0xf384('0xc8')],'as':_0xf384('0xc9'),'attributes':['id',_0xf384('0x3b'),_0xf384('0xca')],'where':_0x1bc779[_0xf384('0x45')][_0xf384('0xcb')]?{'id':_0x1bc779[_0xf384('0x45')]['tag']}:undefined,'required':_0x1bc779['query']['tag']?!![]:![]}];}return db[_0xf384('0xa0')][_0xf384('0x55')](_0x3eba98);})[_0xf384('0x21')](function(_0x56de21){_0x55b6aa[_0xf384('0x56')]=_0x56de21;return _0x55b6aa;});}})[_0xf384('0x21')](respondWithFilteredResult(_0x1130db,_0x3eba98))[_0xf384('0x2a')](handleError(_0x1130db,null));};exports[_0xf384('0x3c')]=function(_0x1df6db,_0x2ea33b,_0x588108){var _0x1628a4,_0x2ed4ae,_0xbd948;if(_[_0xf384('0x93')](_0x1df6db[_0xf384('0x5a')][_0xf384('0x5a')])||_0x1df6db[_0xf384('0x5a')][_0xf384('0x5a')]===''){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))](_0xf384('0x94'));}if(_['isNil'](_0x1df6db['body']['to'])){throw new db[(_0xf384('0x76'))][(_0xf384('0x77'))]('to\x20is\x20mandatory');}_0x1628a4=_0x1df6db[_0xf384('0x5a')]['to'];return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x1df6db[_0xf384('0x5e')]['id']},'include':[{'model':db[_0xf384('0x99')],'as':_0xf384('0xcc'),'include':[{'model':db['CmContact'],'as':_0xf384('0x9b'),'where':{'mobile':_0x1628a4},'limit':0x1,'order':[[_0xf384('0x7b'),_0xf384('0x9c')]]}]}]})['then'](handleEntityNotFound(_0x2ea33b,null))['then'](function(_0x1d1d3f){if(_0x1d1d3f&&_0x1d1d3f[_0xf384('0xcc')]){_0x2ed4ae=_0x1d1d3f['get']({'plain':!![]});if(_0x2ed4ae[_0xf384('0xcc')]&&_0x2ed4ae['List'][_0xf384('0x9b')]['length']){return _0x2ed4ae['List'][_0xf384('0x9b')][0x0];}return db[_0xf384('0x75')][_0xf384('0x59')](_['defaults'](_0x1df6db[_0xf384('0x5a')],{'firstName':_0x1628a4,'mobile':_0x1628a4,'phone':_0x1628a4,'ListId':_0x2ed4ae[_0xf384('0x9a')]}));}})[_0xf384('0x21')](handleEntityNotFound(_0x2ea33b,null))[_0xf384('0x21')](function(_0x50bbed){if(_0x50bbed){_0xbd948=_0x50bbed;return db[_0xf384('0xa0')][_0xf384('0x58')]({'where':{'ContactId':_0xbd948['id'],'closed':![],'SmsAccountId':_0x2ed4ae['id']}})['then'](function(_0x12e9a7){if(_0x12e9a7){return[_0x12e9a7,![]];}return db[_0xf384('0xa0')][_0xf384('0x59')]({'UserId':_0x1df6db[_0xf384('0x5b')]['id'],'ContactId':_0xbd948['id'],'SmsAccountId':_0x2ed4ae['id'],'phone':_0x1628a4,'firstMsgDirection':_0xf384('0xcd'),'Messages':[_[_0xf384('0x50')](_0x1df6db[_0xf384('0x5a')],{'read':![],'body':_0x1df6db['body']['body'],'phone':_0x1628a4,'SmsAccountId':_0x2ed4ae['id'],'UserId':_0x1df6db[_0xf384('0x5b')]['id'],'ContactId':_0xbd948['id']})]},{'include':[{'model':db[_0xf384('0xa9')],'as':_0xf384('0xce')}]})[_0xf384('0x21')](function(_0x25a50d){return[_0x25a50d,!![]];});});}})[_0xf384('0xa1')](function(_0x5294d4,_0x4d6c2a){if(_0x4d6c2a){return _0x5294d4;}return db[_0xf384('0xa9')][_0xf384('0x59')](_['merge'](_0x1df6db[_0xf384('0x5a')],{'read':![],'body':_0x1df6db[_0xf384('0x5a')][_0xf384('0x5a')],'phone':_0x1628a4,'SmsAccountId':_0x2ed4ae['id'],'SmsInteractionId':_0x5294d4['id'],'UserId':_0x1df6db[_0xf384('0x5b')]['id'],'ContactId':_0xbd948['id']}))[_0xf384('0x21')](function(_0x24fc83){_0x5294d4['dataValues'][_0xf384('0xce')]=[];_0x5294d4[_0xf384('0xcf')]['Messages'][_0xf384('0xa5')](_0x24fc83[_0xf384('0xcf')]);return _0x5294d4;});})[_0xf384('0x21')](respondWithResult(_0x2ea33b,null))[_0xf384('0x2a')](handleError(_0x2ea33b,null));};exports[_0xf384('0x2c')]=function(_0x4d5c78,_0x2ab160,_0x34ada3){if(_0x4d5c78['body']['id']){delete _0x4d5c78[_0xf384('0x5a')]['id'];}var _0x14bef5,_0x58510c,_0x2ce598;return db[_0xf384('0x40')]['find']({'where':{'id':_0x4d5c78['params']['id']}})['then'](handleEntityNotFound(_0x2ab160,null))[_0xf384('0x21')](function(_0x13540d){if(_0x13540d){_0x2ce598=_0x13540d;logger[_0xf384('0x25')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0xd0'),_0x13540d[_0xf384('0x43')],util[_0xf384('0xd1')](_0x4d5c78['body'],{'showHidden':![],'depth':null}));switch(_0x13540d[_0xf384('0x43')]){case'skebby':if(_0x4d5c78[_0xf384('0x5a')]['skebby_dispatch_id']&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')];return db[_0xf384('0xa9')]['find']({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd2')]}});}break;case _0xf384('0x83'):if(_0x4d5c78[_0xf384('0x5a')]['requestid']&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd3')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd3')];return db['SmsMessage'][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd4')]}});}break;case'clicksend':if(_0x4d5c78['body'][_0xf384('0x85')]&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd5')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd5')];return db['SmsMessage'][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78['body'][_0xf384('0x85')]}});}break;case _0xf384('0x88'):var _0x5e5117=_0x4d5c78['body'][_0xf384('0x89')][0x0];if(_0x5e5117[_0xf384('0x84')]&&_0x5e5117['status'][_0xf384('0xd6')]==='DELIVERED'){_0x58510c=_0x5e5117[_0xf384('0x2c')]['groupName'];return db[_0xf384('0xa9')][_0xf384('0x58')]({'where':{'messageId':_0x5e5117[_0xf384('0x84')]}});}break;case'clickatell':if(_0x4d5c78[_0xf384('0x5a')][_0xf384('0x84')]&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')];return db[_0xf384('0xa9')]['find']({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0x84')]}});}break;case _0xf384('0x90'):if(_0x4d5c78[_0xf384('0x5a')][0x0]['message']['id']){_0x58510c=_0x4d5c78[_0xf384('0x5a')][0x0][_0xf384('0x43')];return db[_0xf384('0xa9')][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][0x0][_0xf384('0x28')]['id']}});}break;case _0xf384('0x91'):if(_0x4d5c78[_0xf384('0x5a')]['redif']&&_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')]){_0x58510c=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x2c')];return db['SmsMessage'][_0xf384('0x58')]({'where':{'messageId':_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd7')]}});}break;}}})['then'](handleEntityNotFound(_0x2ab160,null))['then'](function(_0x47a2bb){if(_0x47a2bb){_0x14bef5=_0x47a2bb;switch(_0x2ce598[_0xf384('0x43')]){case _0xf384('0xd8'):if(_0x58510c==='DELIVERED'){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0xd8'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x83'):if(_0x58510c==='1'){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),'status',_0xf384('0xd8'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x4d5c78[_0xf384('0x5a')][_0xf384('0xd9')]&&_0x58510c>=0xc8&&_0x58510c<=0xce){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),'status',_0xf384('0xda'),util['inspect'](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x88'):var _0x280570=_0x4d5c78[_0xf384('0x5a')][_0xf384('0x89')][0x0];if(_0x280570['status'][_0xf384('0xd6')]===_0xf384('0xdb')){return _0x14bef5['update']({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),_0xf384('0x2c'),'infobip',util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x8d'):if(_0x58510c=='DELIVERED_TO_GATEWAY'||_0x58510c=='RECEIVED_BY_RECIPIENT'){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','clickatell',util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x90'):if(_0x58510c=='message-delivered'){return _0x14bef5['update']({'read':!![]});}else{logger[_0xf384('0x26')](_0xf384('0xb5'),_0xf384('0x2c'),_0xf384('0x90'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;case _0xf384('0x91'):if(_0x58510c===_0xf384('0xdc')||_0x58510c===_0xf384('0xdd')){return _0x14bef5[_0xf384('0x36')]({'read':!![]});}else{logger[_0xf384('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0x91'),util[_0xf384('0xd1')](_0x4d5c78[_0xf384('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x14bef5;}})[_0xf384('0x21')](respondWithResult(_0x2ab160,null))[_0xf384('0x2a')](handleError(_0x2ab160,null));};exports[_0xf384('0xde')]=function(_0x33c9b8,_0x550e55,_0x4dba45){var _0x239a46,_0x2ab884,_0x5884ef;return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x33c9b8[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x550e55,null))['then'](function(_0x427101){if(_0x427101){_0x5884ef=_0x427101;logger[_0xf384('0x25')](_0xf384('0xb5'),_0xf384('0x2c'),'received\x20delivery\x20report\x20from',_0x427101['type'],util['inspect'](_0x33c9b8[_0xf384('0x45')],{'showHidden':![],'depth':null}));switch(_0x427101[_0xf384('0x43')]){case _0xf384('0x8a'):if(_0x33c9b8[_0xf384('0x45')][_0xf384('0xdf')]&&_0x33c9b8[_0xf384('0x45')][_0xf384('0xe0')]){_0x2ab884=_0x33c9b8[_0xf384('0x45')][_0xf384('0xe0')];return db[_0xf384('0xa9')]['find']({'where':{'messageId':_0x33c9b8[_0xf384('0x45')][_0xf384('0xdf')]}});}break;}}})['then'](handleEntityNotFound(_0x550e55,null))[_0xf384('0x21')](function(_0x4557dc){if(_0x4557dc){_0x239a46=_0x4557dc;switch(_0x5884ef[_0xf384('0x43')]){case'csc':if(_0x2ab884==='2'||_0x2ab884==='6'){return _0x239a46['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xf384('0x2c'),_0xf384('0x8a'),util[_0xf384('0xd1')](_0x33c9b8[_0xf384('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x239a46;}})['then'](respondWithResult(_0x550e55,null))[_0xf384('0x2a')](handleError(_0x550e55,null));};exports[_0xf384('0xe1')]=function(_0x577413,_0x38b10a,_0x5415d9){return db['SmsAccount']['find']({'where':{'id':_0x577413['params']['id']}})[_0xf384('0x21')](handleEntityNotFound(_0x38b10a,null))[_0xf384('0x21')](function(_0x4a0010){if(_0x4a0010){return _0x4a0010[_0xf384('0xe1')](_0x577413[_0xf384('0x5a')][_0xf384('0x68')],_[_0xf384('0x9e')](_0x577413[_0xf384('0x5a')],[_0xf384('0x68'),'id'])||{})[_0xf384('0xa1')](function(_0x2c2a2f){for(var _0x134b4f=0x0;_0x134b4f<_0x577413[_0xf384('0x5a')][_0xf384('0x68')][_0xf384('0x57')];_0x134b4f+=0x1){socket[_0xf384('0xe2')](_0xf384('0xe3'),{'UserId':Number(_0x577413[_0xf384('0x5a')][_0xf384('0x68')][_0x134b4f]),'SmsAccountId':Number(_0x577413['params']['id'])});}return _0x2c2a2f;});}})[_0xf384('0x21')](respondWithResult(_0x38b10a,null))[_0xf384('0x2a')](handleError(_0x38b10a,null));};exports[_0xf384('0xe4')]=function(_0x4b7e61,_0x1a81cc,_0x1070c0){return db[_0xf384('0x40')][_0xf384('0x58')]({'where':{'id':_0x4b7e61[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x1a81cc,null))[_0xf384('0x21')](function(_0x3de270){if(_0x3de270){return _0x3de270['removeAgents'](_0x4b7e61['query'][_0xf384('0x68')])[_0xf384('0x21')](function(){if(_[_0xf384('0xe5')](_0x4b7e61[_0xf384('0x45')]['ids'])){for(var _0x50acc7=0x0;_0x50acc7<_0x4b7e61[_0xf384('0x45')][_0xf384('0x68')][_0xf384('0x57')];_0x50acc7+=0x1){socket[_0xf384('0xe2')]('userSmsAccount:remove',{'UserId':Number(_0x4b7e61[_0xf384('0x45')][_0xf384('0x68')][_0x50acc7]),'SmsAccountId':Number(_0x4b7e61['params']['id'])});}}else{socket[_0xf384('0xe2')](_0xf384('0xe6'),{'UserId':Number(_0x4b7e61[_0xf384('0x45')][_0xf384('0x68')]),'SmsAccountId':Number(_0x4b7e61[_0xf384('0x5e')]['id'])});}});}})[_0xf384('0x21')](respondWithStatusCode(_0x1a81cc,null))[_0xf384('0x2a')](handleError(_0x1a81cc,null));};exports['getAgents']=function(_0x5bc344,_0x205c4a,_0x2742a0){var _0x4f2808={};var _0x41a26c={};var _0x55abaa;var _0x921067;return db[_0xf384('0x40')][_0xf384('0x6b')]({'where':{'id':_0x5bc344[_0xf384('0x5e')]['id']}})['then'](handleEntityNotFound(_0x205c4a,null))[_0xf384('0x21')](function(_0x2e5267){if(_0x2e5267){_0x55abaa=_0x2e5267;_0x41a26c[_0xf384('0x49')]=_[_0xf384('0x46')](db[_0xf384('0xab')][_0xf384('0x41')]);_0x41a26c[_0xf384('0x45')]=_[_0xf384('0x46')](_0x5bc344[_0xf384('0x45')]);_0x41a26c['filters']=_[_0xf384('0x48')](_0x41a26c['model'],_0x41a26c[_0xf384('0x45')]);_0x4f2808[_0xf384('0x4a')]=_['intersection'](_0x41a26c[_0xf384('0x49')],qs[_0xf384('0x4b')](_0x5bc344['query']['fields']));_0x4f2808[_0xf384('0x4a')]=_0x4f2808['attributes'][_0xf384('0x57')]?_0x4f2808[_0xf384('0x4a')]:_0x41a26c[_0xf384('0x49')];_0x4f2808[_0xf384('0x64')]=qs[_0xf384('0x4e')](_0x5bc344[_0xf384('0x45')]['sort']);_0x4f2808[_0xf384('0x53')]=qs[_0xf384('0x47')](_[_0xf384('0x4f')](_0x5bc344[_0xf384('0x45')],_0x41a26c[_0xf384('0x47')]));if(_0x5bc344['query']['filter']){_0x4f2808[_0xf384('0x53')]=_[_0xf384('0x50')](_0x4f2808[_0xf384('0x53')],{'$or':_[_0xf384('0x3f')](_0x4f2808[_0xf384('0x4a')],function(_0x56df9b){var _0x5d8539={};_0x5d8539[_0x56df9b]={'$like':'%'+_0x5bc344[_0xf384('0x45')][_0xf384('0x52')]+'%'};return _0x5d8539;})});}_0x4f2808=_['merge']({},_0x4f2808,_0x5bc344[_0xf384('0x65')]);return _0x55abaa[_0xf384('0xe7')](_0x4f2808);}})['then'](function(_0x30040f){if(_0x30040f){_0x921067=_0x30040f[_0xf384('0x57')];if(!_0x5bc344[_0xf384('0x45')][_0xf384('0x4c')]('nolimit')){_0x4f2808['limit']=qs[_0xf384('0x30')](_0x5bc344[_0xf384('0x45')][_0xf384('0x30')]);_0x4f2808[_0xf384('0x2e')]=qs['offset'](_0x5bc344[_0xf384('0x45')][_0xf384('0x2e')]);}return _0x55abaa[_0xf384('0xe7')](_0x4f2808);}})['then'](function(_0x12d4f4){if(_0x12d4f4){return _0x12d4f4?{'count':_0x921067,'rows':_0x12d4f4}:null;}})['then'](respondWithResult(_0x205c4a,null))[_0xf384('0x2a')](handleError(_0x205c4a,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 063e2ce..ffaba69 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 _0x1750=['hook','../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x11a4ef,_0x5790ce){var _0x311fcb=function(_0x4629d1){while(--_0x4629d1){_0x11a4ef['push'](_0x11a4ef['shift']());}};_0x311fcb(++_0x5790ce);}(_0x1750,0x71));var _0x0175=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0x1750[_0x5d4607];return _0x5e4a86;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x0175('0x0'))['db'][_0x0175('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0175('0x2')](0x0);var events={'afterCreate':_0x0175('0x3'),'afterUpdate':_0x0175('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2e3695){return function(_0x210131,_0x283026,_0x2295fa){SmsAccountEvents[_0x0175('0x5')](_0x2e3695+':'+_0x210131['id'],_0x210131);SmsAccountEvents['emit'](_0x2e3695,_0x210131);_0x2295fa(null);};}for(var e in events){if(events[_0x0175('0x6')](e)){var event=events[e];SmsAccount[_0x0175('0x7')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file +var _0xa00b=['hook','exports','events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','hasOwnProperty'];(function(_0x14b667,_0x395c9f){var _0xd1d6c0=function(_0x1d700d){while(--_0x1d700d){_0x14b667['push'](_0x14b667['shift']());}};_0xd1d6c0(++_0x395c9f);}(_0xa00b,0x1f1));var _0xba00=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa00b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xba00('0x0'));var SmsAccount=require(_0xba00('0x1'))['db'][_0xba00('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xba00('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xba00('0x4'),'afterDestroy':_0xba00('0x5')};function emitEvent(_0x5de27f){return function(_0xa17fc9,_0x266e5f,_0x418b3b){SmsAccountEvents['emit'](_0x5de27f+':'+_0xa17fc9['id'],_0xa17fc9);SmsAccountEvents['emit'](_0x5de27f,_0xa17fc9);_0x418b3b(null);};}for(var e in events){if(events[_0xba00('0x6')](e)){var event=events[e];SmsAccount[_0xba00('0x7')](e,emitEvent(event));}}module[_0xba00('0x8')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index 21f7042..56b15aa 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 _0x6353=['./smsAccount.attributes','exports','sms_accounts','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment'];(function(_0x2d42d5,_0x91a418){var _0x1ad892=function(_0x3cd393){while(--_0x3cd393){_0x2d42d5['push'](_0x2d42d5['shift']());}};_0x1ad892(++_0x91a418);}(_0x6353,0xc9));var _0x3635=function(_0x433ae0,_0x209a59){_0x433ae0=_0x433ae0-0x0;var _0x7b57dc=_0x6353[_0x433ae0];return _0x7b57dc;};'use strict';var _=require(_0x3635('0x0'));var util=require(_0x3635('0x1'));var logger=require(_0x3635('0x2'))(_0x3635('0x3'));var moment=require(_0x3635('0x4'));var BPromise=require('bluebird');var rp=require(_0x3635('0x5'));var fs=require('fs');var path=require(_0x3635('0x6'));var rimraf=require('rimraf');var config=require(_0x3635('0x7'));var attributes=require(_0x3635('0x8'));module[_0x3635('0x9')]=function(_0x52d770,_0x5738e2){return _0x52d770['define']('SmsAccount',attributes,{'tableName':_0x3635('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2c8b=['../../config/logger','moment','exports','define','SmsAccount','util'];(function(_0x3f967a,_0x2c8f5d){var _0x312a83=function(_0x4a7e4e){while(--_0x4a7e4e){_0x3f967a['push'](_0x3f967a['shift']());}};_0x312a83(++_0x2c8f5d);}(_0x2c8b,0x83));var _0xb2c8=function(_0x27b0db,_0x3ebc39){_0x27b0db=_0x27b0db-0x0;var _0x711728=_0x2c8b[_0x27b0db];return _0x711728;};'use strict';var _=require('lodash');var util=require(_0xb2c8('0x0'));var logger=require(_0xb2c8('0x1'))('api');var moment=require(_0xb2c8('0x2'));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('./smsAccount.attributes');module[_0xb2c8('0x3')]=function(_0x40948a,_0x1f7eef){return _0x40948a[_0xb2c8('0x4')](_0xb2c8('0x5'),attributes,{'tableName':'sms_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index b00e031..5c4bcb0 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 _0x4cb5=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x5633a1,_0x48990f){var _0x45af69=function(_0xcfb22){while(--_0xcfb22){_0x5633a1['push'](_0x5633a1['shift']());}};_0x45af69(++_0x48990f);}(_0x4cb5,0xc5));var _0x54cb=function(_0x2df387,_0x1d3ea1){_0x2df387=_0x2df387-0x0;var _0x3b1708=_0x4cb5[_0x2df387];return _0x3b1708;};'use strict';var _=require(_0x54cb('0x0'));var util=require('util');var moment=require(_0x54cb('0x1'));var BPromise=require(_0x54cb('0x2'));var rs=require(_0x54cb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x54cb('0x4'))(_0x54cb('0x5'));var config=require(_0x54cb('0x6'));var jayson=require(_0x54cb('0x7'));var client=jayson[_0x54cb('0x8')]['http']({'port':0x232a});config[_0x54cb('0x9')]=_[_0x54cb('0xa')](config[_0x54cb('0x9')],{'host':_0x54cb('0xb'),'port':0x18eb});var socket=require(_0x54cb('0xc'))(new Redis(config[_0x54cb('0x9')]));require(_0x54cb('0xd'))['register'](socket);function respondWithRpcPromise(_0x5581f9,_0xdda621,_0x3fd27b){return new BPromise(function(_0x3c8df8,_0x2f75a8){return client[_0x54cb('0xe')](_0x5581f9,_0x3fd27b)[_0x54cb('0xf')](function(_0x58629a){logger[_0x54cb('0x10')](_0x54cb('0x11'),_0xdda621,_0x54cb('0x12'));logger['debug'](_0x54cb('0x13'),_0xdda621,_0x54cb('0x12'),JSON[_0x54cb('0x14')](_0x58629a));if(_0x58629a[_0x54cb('0x15')]){if(_0x58629a[_0x54cb('0x15')][_0x54cb('0x16')]===0x1f4){logger[_0x54cb('0x15')](_0x54cb('0x11'),_0xdda621,_0x58629a[_0x54cb('0x15')][_0x54cb('0x17')]);return _0x2f75a8(_0x58629a[_0x54cb('0x15')]['message']);}logger[_0x54cb('0x15')](_0x54cb('0x11'),_0xdda621,_0x58629a[_0x54cb('0x15')][_0x54cb('0x17')]);return _0x3c8df8(_0x58629a[_0x54cb('0x15')][_0x54cb('0x17')]);}else{logger[_0x54cb('0x10')](_0x54cb('0x11'),_0xdda621,_0x54cb('0x12'));_0x3c8df8(_0x58629a[_0x54cb('0x18')][_0x54cb('0x17')]);}})[_0x54cb('0x19')](function(_0x2a269b){logger[_0x54cb('0x15')](_0x54cb('0x11'),_0xdda621,_0x2a269b);_0x2f75a8(_0x2a269b);});});}exports[_0x54cb('0x1a')]=function(_0x5a51ba){var _0x2ccf14=this;return new Promise(function(_0x48c252,_0x4ad40f){return db[_0x54cb('0x1b')][_0x54cb('0x1c')]({'raw':_0x5a51ba[_0x54cb('0x1d')]?_0x5a51ba['options']['raw']===undefined?!![]:![]:!![],'where':_0x5a51ba['options']?_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x1e')]||null:null,'attributes':_0x5a51ba[_0x54cb('0x1d')]?_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x1f')]||null:null,'include':_0x5a51ba[_0x54cb('0x1d')]?_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x20')]?_['map'](_0x5a51ba[_0x54cb('0x1d')][_0x54cb('0x20')],function(_0x4df284){return{'model':db[_0x4df284['model']],'as':_0x4df284['as'],'attributes':_0x4df284[_0x54cb('0x1f')],'include':_0x4df284[_0x54cb('0x20')]?_[_0x54cb('0x21')](_0x4df284[_0x54cb('0x20')],function(_0x45281d){return{'model':db[_0x45281d['model']],'as':_0x45281d['as'],'attributes':_0x45281d[_0x54cb('0x1f')],'include':_0x45281d[_0x54cb('0x20')]?_['map'](_0x45281d['include'],function(_0x577d8e){return{'model':db[_0x577d8e[_0x54cb('0x22')]],'as':_0x577d8e['as'],'attributes':_0x577d8e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5464d7){logger['info'](_0x54cb('0x1a'),_0x5a51ba);logger[_0x54cb('0x23')](_0x54cb('0x1a'),_0x5a51ba,JSON[_0x54cb('0x14')](_0x5464d7));_0x48c252(_0x5464d7);})[_0x54cb('0x19')](function(_0x13fb0e){logger[_0x54cb('0x15')](_0x54cb('0x1a'),_0x13fb0e[_0x54cb('0x17')],_0x5a51ba);_0x4ad40f(_0x2ccf14[_0x54cb('0x15')](0x1f4,_0x13fb0e[_0x54cb('0x17')]));});});}; \ No newline at end of file +var _0x39b5=['catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','jayson/promise','client','http','redis','defaults','localhost','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','stringify'];(function(_0x25eaee,_0x1e6191){var _0xdca794=function(_0x3669ad){while(--_0x3669ad){_0x25eaee['push'](_0x25eaee['shift']());}};_0xdca794(++_0x1e6191);}(_0x39b5,0x169));var _0x539b=function(_0x2532a6,_0x25e8e9){_0x2532a6=_0x2532a6-0x0;var _0x1d6b92=_0x39b5[_0x2532a6];return _0x1d6b92;};'use strict';var _=require(_0x539b('0x0'));var util=require(_0x539b('0x1'));var moment=require(_0x539b('0x2'));var BPromise=require(_0x539b('0x3'));var rs=require(_0x539b('0x4'));var fs=require('fs');var Redis=require(_0x539b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x539b('0x6'));var config=require('../../config/environment');var jayson=require(_0x539b('0x7'));var client=jayson[_0x539b('0x8')][_0x539b('0x9')]({'port':0x232a});config[_0x539b('0xa')]=_[_0x539b('0xb')](config[_0x539b('0xa')],{'host':_0x539b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x539b('0xa')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x9ad19d,_0x383ce7,_0xacb14c){return new BPromise(function(_0x56885d,_0x410d83){return client[_0x539b('0xd')](_0x9ad19d,_0xacb14c)[_0x539b('0xe')](function(_0x1d7f4a){logger[_0x539b('0xf')](_0x539b('0x10'),_0x383ce7,_0x539b('0x11'));logger[_0x539b('0x12')](_0x539b('0x13'),_0x383ce7,_0x539b('0x11'),JSON['stringify'](_0x1d7f4a));if(_0x1d7f4a['error']){if(_0x1d7f4a['error'][_0x539b('0x14')]===0x1f4){logger['error'](_0x539b('0x10'),_0x383ce7,_0x1d7f4a['error']['message']);return _0x410d83(_0x1d7f4a[_0x539b('0x15')][_0x539b('0x16')]);}logger['error'](_0x539b('0x10'),_0x383ce7,_0x1d7f4a['error'][_0x539b('0x16')]);return _0x56885d(_0x1d7f4a[_0x539b('0x15')][_0x539b('0x16')]);}else{logger[_0x539b('0xf')](_0x539b('0x10'),_0x383ce7,_0x539b('0x11'));_0x56885d(_0x1d7f4a[_0x539b('0x17')][_0x539b('0x16')]);}})['catch'](function(_0x2c7640){logger['error'](_0x539b('0x10'),_0x383ce7,_0x2c7640);_0x410d83(_0x2c7640);});});}exports[_0x539b('0x18')]=function(_0x894cf4){var _0x1013fc=this;return new Promise(function(_0xe273c4,_0x2604bc){return db[_0x539b('0x19')][_0x539b('0x1a')]({'raw':_0x894cf4[_0x539b('0x1b')]?_0x894cf4[_0x539b('0x1b')][_0x539b('0x1c')]===undefined?!![]:![]:!![],'where':_0x894cf4['options']?_0x894cf4[_0x539b('0x1b')][_0x539b('0x1d')]||null:null,'attributes':_0x894cf4[_0x539b('0x1b')]?_0x894cf4['options'][_0x539b('0x1e')]||null:null,'include':_0x894cf4[_0x539b('0x1b')]?_0x894cf4[_0x539b('0x1b')][_0x539b('0x1f')]?_[_0x539b('0x20')](_0x894cf4[_0x539b('0x1b')][_0x539b('0x1f')],function(_0x1d8c5a){return{'model':db[_0x1d8c5a[_0x539b('0x21')]],'as':_0x1d8c5a['as'],'attributes':_0x1d8c5a['attributes'],'include':_0x1d8c5a['include']?_[_0x539b('0x20')](_0x1d8c5a['include'],function(_0x16f178){return{'model':db[_0x16f178[_0x539b('0x21')]],'as':_0x16f178['as'],'attributes':_0x16f178[_0x539b('0x1e')],'include':_0x16f178['include']?_[_0x539b('0x20')](_0x16f178[_0x539b('0x1f')],function(_0x1330e3){return{'model':db[_0x1330e3[_0x539b('0x21')]],'as':_0x1330e3['as'],'attributes':_0x1330e3[_0x539b('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x17b750){logger[_0x539b('0xf')](_0x539b('0x18'),_0x894cf4);logger['debug'](_0x539b('0x18'),_0x894cf4,JSON[_0x539b('0x22')](_0x17b750));_0xe273c4(_0x17b750);})[_0x539b('0x23')](function(_0x954422){logger['error'](_0x539b('0x18'),_0x954422[_0x539b('0x16')],_0x894cf4);_0x2604bc(_0x1013fc[_0x539b('0x15')](0x1f4,_0x954422[_0x539b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index ce7b765..149cd1f 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(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 1265c78..4352a72 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 _0x55ca=['update','delete','/:id','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','show','create'];(function(_0x3ad00a,_0x59ca09){var _0x115213=function(_0x362552){while(--_0x362552){_0x3ad00a['push'](_0x3ad00a['shift']());}};_0x115213(++_0x59ca09);}(_0x55ca,0x126));var _0xa55c=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0x55ca[_0x3b6652];return _0x14d39f;};'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 +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3eb4ae,_0x493c5b){var _0x1aa0d4=function(_0x194a3b){while(--_0x194a3b){_0x3eb4ae['push'](_0x3eb4ae['shift']());}};_0x1aa0d4(++_0x493c5b);}(_0x3e74,0x175));var _0x43e7=function(_0x4c7992,_0xf01c4f){_0x4c7992=_0x4c7992-0x0;var _0x3b0e68=_0x3e74[_0x4c7992];return _0x3b0e68;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index b7278f0..cb82ada 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 _0xf16c=['TEXT','*,*,*,*','sequelize','INTEGER','STRING','noop'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xf16c,0xfe));var _0xcf16=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf16c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xcf16('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcf16('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xcf16('0x2')],'allowNull':![],'defaultValue':_0xcf16('0x3')},'appdata':{'type':Sequelize[_0xcf16('0x4')]()},'description':{'type':Sequelize[_0xcf16('0x2')]},'interval':{'type':Sequelize[_0xcf16('0x2')],'defaultValue':_0xcf16('0x5')}}; \ No newline at end of file +var _0x5807=['exports','INTEGER','STRING','sequelize'];(function(_0x3d9dc2,_0x4d0f69){var _0x9f75a0=function(_0x23d927){while(--_0x23d927){_0x3d9dc2['push'](_0x3d9dc2['shift']());}};_0x9f75a0(++_0x4d0f69);}(_0x5807,0x1a3));var _0x7580=function(_0xc55d64,_0x133f2d){_0xc55d64=_0xc55d64-0x0;var _0x4194f6=_0x5807[_0xc55d64];return _0x4194f6;};'use strict';var Sequelize=require(_0x7580('0x0'));module[_0x7580('0x1')]={'priority':{'type':Sequelize[_0x7580('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7580('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7580('0x3')]},'interval':{'type':Sequelize[_0x7580('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 12394a2..fba2216 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 _0x4bb4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','SmsApplication','rawAttributes','fieldName','type','key','map','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','show','include','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x1100b9,_0x25ff23){var _0x1097f4=function(_0x265da4){while(--_0x265da4){_0x1100b9['push'](_0x1100b9['shift']());}};_0x1097f4(++_0x25ff23);}(_0x4bb4,0x1b9));var _0x44bb=function(_0xd66aa5,_0x1828d0){_0xd66aa5=_0xd66aa5-0x0;var _0x17cbc7=_0x4bb4[_0xd66aa5];return _0x17cbc7;};'use strict';var emlformat=require(_0x44bb('0x0'));var rimraf=require(_0x44bb('0x1'));var zipdir=require(_0x44bb('0x2'));var jsonpatch=require(_0x44bb('0x3'));var rp=require(_0x44bb('0x4'));var moment=require(_0x44bb('0x5'));var BPromise=require(_0x44bb('0x6'));var Mustache=require(_0x44bb('0x7'));var util=require(_0x44bb('0x8'));var path=require(_0x44bb('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x44bb('0xa'));var _=require(_0x44bb('0xb'));var squel=require(_0x44bb('0xc'));var crypto=require(_0x44bb('0xd'));var jsforce=require(_0x44bb('0xe'));var deskjs=require(_0x44bb('0xf'));var toCsv=require('to-csv');var querystring=require(_0x44bb('0x10'));var Papa=require(_0x44bb('0x11'));var Redis=require(_0x44bb('0x12'));var authService=require(_0x44bb('0x13'));var qs=require(_0x44bb('0x14'));var as=require(_0x44bb('0x15'));var hardwareService=require(_0x44bb('0x16'));var logger=require(_0x44bb('0x17'))(_0x44bb('0x18'));var utils=require(_0x44bb('0x19'));var config=require(_0x44bb('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x44bb('0x1b'))['db'];function respondWithStatusCode(_0x5c7a04,_0x5b8339){_0x5b8339=_0x5b8339||0xcc;return function(_0x46d6cf){if(_0x46d6cf){return _0x5c7a04[_0x44bb('0x1c')](_0x5b8339);}return _0x5c7a04[_0x44bb('0x1d')](_0x5b8339)[_0x44bb('0x1e')]();};}function respondWithResult(_0x3f088a,_0x24d731){_0x24d731=_0x24d731||0xc8;return function(_0xb78dcb){if(_0xb78dcb){return _0x3f088a[_0x44bb('0x1d')](_0x24d731)[_0x44bb('0x1f')](_0xb78dcb);}};}function respondWithFilteredResult(_0x41c015,_0x2827f3){return function(_0x4464d4){if(_0x4464d4){var _0x5d83ce=typeof _0x2827f3[_0x44bb('0x20')]===_0x44bb('0x21')&&typeof _0x2827f3['limit']===_0x44bb('0x21');var _0xb9ab2c=_0x4464d4[_0x44bb('0x22')];var _0x21fd2e=_0x5d83ce?0x0:_0x2827f3[_0x44bb('0x20')];var _0x40e508=_0x5d83ce?_0x4464d4[_0x44bb('0x22')]:_0x2827f3['offset']+_0x2827f3[_0x44bb('0x23')];var _0x40f7c9;if(_0x40e508>=_0xb9ab2c){_0x40e508=_0xb9ab2c;_0x40f7c9=0xc8;}else{_0x40f7c9=0xce;}_0x41c015[_0x44bb('0x1d')](_0x40f7c9);return _0x41c015['set'](_0x44bb('0x24'),_0x21fd2e+'-'+_0x40e508+'/'+_0xb9ab2c)['json'](_0x4464d4);}return null;};}function patchUpdates(_0x3b8810){return function(_0x35f719){try{jsonpatch[_0x44bb('0x25')](_0x35f719,_0x3b8810,!![]);}catch(_0x2d7b6c){return BPromise[_0x44bb('0x26')](_0x2d7b6c);}return _0x35f719[_0x44bb('0x27')]();};}function saveUpdates(_0x51118b,_0x488a3f){return function(_0x1f11a8){if(_0x1f11a8){return _0x1f11a8[_0x44bb('0x28')](_0x51118b)[_0x44bb('0x29')](function(_0x366a4b){return _0x366a4b;});}return null;};}function removeEntity(_0x416e4a,_0x258cf9){return function(_0x47301a){if(_0x47301a){return _0x47301a[_0x44bb('0x2a')]()['then'](function(){_0x416e4a[_0x44bb('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b8ca5,_0x479aa0){return function(_0xc6d33d){if(!_0xc6d33d){_0x1b8ca5['sendStatus'](0x194);}return _0xc6d33d;};}function handleError(_0x5904ac,_0x9b6d22){_0x9b6d22=_0x9b6d22||0x1f4;return function(_0x1b387d){logger['error'](_0x1b387d[_0x44bb('0x2b')]);if(_0x1b387d[_0x44bb('0x2c')]){delete _0x1b387d[_0x44bb('0x2c')];}_0x5904ac[_0x44bb('0x1d')](_0x9b6d22)['send'](_0x1b387d);};}exports[_0x44bb('0x2d')]=function(_0x20f85c,_0x4ca1ab){var _0x2553b9={},_0xdfc035={},_0x54efc4={'count':0x0,'rows':[]};var _0x4279a7=_['map'](db[_0x44bb('0x2e')][_0x44bb('0x2f')],function(_0x7ee819){return{'name':_0x7ee819[_0x44bb('0x30')],'type':_0x7ee819[_0x44bb('0x31')][_0x44bb('0x32')]};});_0xdfc035['model']=_[_0x44bb('0x33')](_0x4279a7,'name');_0xdfc035[_0x44bb('0x34')]=_[_0x44bb('0x35')](_0x20f85c['query']);_0xdfc035['filters']=_[_0x44bb('0x36')](_0xdfc035[_0x44bb('0x37')],_0xdfc035[_0x44bb('0x34')]);_0x2553b9['attributes']=_[_0x44bb('0x36')](_0xdfc035[_0x44bb('0x37')],qs[_0x44bb('0x38')](_0x20f85c[_0x44bb('0x34')][_0x44bb('0x38')]));_0x2553b9[_0x44bb('0x39')]=_0x2553b9['attributes'][_0x44bb('0x3a')]?_0x2553b9[_0x44bb('0x39')]:_0xdfc035[_0x44bb('0x37')];if(!_0x20f85c[_0x44bb('0x34')][_0x44bb('0x3b')](_0x44bb('0x3c'))){_0x2553b9['limit']=qs[_0x44bb('0x23')](_0x20f85c['query'][_0x44bb('0x23')]);_0x2553b9[_0x44bb('0x20')]=qs[_0x44bb('0x20')](_0x20f85c['query'][_0x44bb('0x20')]);}_0x2553b9['order']=qs[_0x44bb('0x3d')](_0x20f85c[_0x44bb('0x34')][_0x44bb('0x3d')]);_0x2553b9[_0x44bb('0x3e')]=qs[_0x44bb('0x3f')](_[_0x44bb('0x40')](_0x20f85c['query'],_0xdfc035[_0x44bb('0x3f')]),_0x4279a7);if(_0x20f85c[_0x44bb('0x34')]['filter']){_0x2553b9[_0x44bb('0x3e')]=_[_0x44bb('0x41')](_0x2553b9[_0x44bb('0x3e')],{'$or':_[_0x44bb('0x33')](_0x4279a7,function(_0xc29dcb){if(_0xc29dcb[_0x44bb('0x31')]!==_0x44bb('0x42')){var _0x3cbfe7={};_0x3cbfe7[_0xc29dcb[_0x44bb('0x2c')]]={'$like':'%'+_0x20f85c[_0x44bb('0x34')][_0x44bb('0x43')]+'%'};return _0x3cbfe7;}})});}_0x2553b9=_[_0x44bb('0x41')]({},_0x2553b9,_0x20f85c[_0x44bb('0x44')]);var _0x18c461={'where':_0x2553b9['where']};return db[_0x44bb('0x2e')][_0x44bb('0x22')](_0x18c461)[_0x44bb('0x29')](function(_0x40096f){_0x54efc4[_0x44bb('0x22')]=_0x40096f;if(_0x20f85c[_0x44bb('0x34')][_0x44bb('0x45')]){_0x2553b9['include']=[{'all':!![]}];}return db[_0x44bb('0x2e')][_0x44bb('0x46')](_0x2553b9);})[_0x44bb('0x29')](function(_0x30171e){_0x54efc4['rows']=_0x30171e;return _0x54efc4;})[_0x44bb('0x29')](respondWithFilteredResult(_0x4ca1ab,_0x2553b9))['catch'](handleError(_0x4ca1ab,null));};exports[_0x44bb('0x47')]=function(_0xeccc49,_0x1d8bcc){var _0x1dad62={'raw':!![],'where':{'id':_0xeccc49['params']['id']}},_0x39c0d7={};_0x39c0d7['model']=_[_0x44bb('0x35')](db['SmsApplication'][_0x44bb('0x2f')]);_0x39c0d7[_0x44bb('0x34')]=_[_0x44bb('0x35')](_0xeccc49['query']);_0x39c0d7['filters']=_[_0x44bb('0x36')](_0x39c0d7['model'],_0x39c0d7[_0x44bb('0x34')]);_0x1dad62[_0x44bb('0x39')]=_[_0x44bb('0x36')](_0x39c0d7['model'],qs[_0x44bb('0x38')](_0xeccc49[_0x44bb('0x34')][_0x44bb('0x38')]));_0x1dad62['attributes']=_0x1dad62[_0x44bb('0x39')]['length']?_0x1dad62[_0x44bb('0x39')]:_0x39c0d7[_0x44bb('0x37')];if(_0xeccc49[_0x44bb('0x34')][_0x44bb('0x45')]){_0x1dad62[_0x44bb('0x48')]=[{'all':!![]}];}_0x1dad62=_[_0x44bb('0x41')]({},_0x1dad62,_0xeccc49[_0x44bb('0x44')]);return db['SmsApplication']['find'](_0x1dad62)[_0x44bb('0x29')](handleEntityNotFound(_0x1d8bcc,null))[_0x44bb('0x29')](respondWithResult(_0x1d8bcc,null))[_0x44bb('0x49')](handleError(_0x1d8bcc,null));};exports[_0x44bb('0x4a')]=function(_0x1938ca,_0x49b633){return db['SmsApplication'][_0x44bb('0x4a')](_0x1938ca[_0x44bb('0x4b')],{})[_0x44bb('0x29')](respondWithResult(_0x49b633,0xc9))['catch'](handleError(_0x49b633,null));};exports[_0x44bb('0x28')]=function(_0x1e680b,_0x1b80b3){if(_0x1e680b[_0x44bb('0x4b')]['id']){delete _0x1e680b[_0x44bb('0x4b')]['id'];}return db[_0x44bb('0x2e')]['find']({'where':{'id':_0x1e680b[_0x44bb('0x4c')]['id']}})[_0x44bb('0x29')](handleEntityNotFound(_0x1b80b3,null))[_0x44bb('0x29')](saveUpdates(_0x1e680b[_0x44bb('0x4b')],null))[_0x44bb('0x29')](respondWithResult(_0x1b80b3,null))[_0x44bb('0x49')](handleError(_0x1b80b3,null));};exports['destroy']=function(_0x1c9ad3,_0x173f3){return db[_0x44bb('0x2e')]['find']({'where':{'id':_0x1c9ad3[_0x44bb('0x4c')]['id']}})['then'](handleEntityNotFound(_0x173f3,null))[_0x44bb('0x29')](removeEntity(_0x173f3,null))[_0x44bb('0x49')](handleError(_0x173f3,null));}; \ No newline at end of file +var _0x24bd=['apply','reject','save','then','destroy','error','stack','name','map','SmsApplication','rawAttributes','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','create','body','update','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x24bd,0xb9));var _0xd24b=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x24bd[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require(_0xd24b('0x0'));var rimraf=require(_0xd24b('0x1'));var zipdir=require(_0xd24b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd24b('0x3'));var moment=require(_0xd24b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd24b('0x5'));var util=require(_0xd24b('0x6'));var path=require(_0xd24b('0x7'));var sox=require(_0xd24b('0x8'));var csv=require('to-csv');var ejs=require(_0xd24b('0x9'));var fs=require('fs');var fs_extra=require(_0xd24b('0xa'));var _=require(_0xd24b('0xb'));var squel=require('squel');var crypto=require(_0xd24b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd24b('0xd'));var toCsv=require(_0xd24b('0xe'));var querystring=require(_0xd24b('0xf'));var Papa=require('papaparse');var Redis=require(_0xd24b('0x10'));var authService=require(_0xd24b('0x11'));var qs=require(_0xd24b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd24b('0x13'));var logger=require('../../config/logger')(_0xd24b('0x14'));var utils=require(_0xd24b('0x15'));var config=require(_0xd24b('0x16'));var licenseUtil=require(_0xd24b('0x17'));var db=require(_0xd24b('0x18'))['db'];function respondWithStatusCode(_0x44ad26,_0x5aabe3){_0x5aabe3=_0x5aabe3||0xcc;return function(_0x20264c){if(_0x20264c){return _0x44ad26[_0xd24b('0x19')](_0x5aabe3);}return _0x44ad26['status'](_0x5aabe3)[_0xd24b('0x1a')]();};}function respondWithResult(_0x54f891,_0x4adb42){_0x4adb42=_0x4adb42||0xc8;return function(_0x4a2bf6){if(_0x4a2bf6){return _0x54f891[_0xd24b('0x1b')](_0x4adb42)[_0xd24b('0x1c')](_0x4a2bf6);}};}function respondWithFilteredResult(_0xcec7a7,_0x1e609b){return function(_0x3b13da){if(_0x3b13da){var _0x1540f7=typeof _0x1e609b[_0xd24b('0x1d')]===_0xd24b('0x1e')&&typeof _0x1e609b[_0xd24b('0x1f')]===_0xd24b('0x1e');var _0x53fc71=_0x3b13da['count'];var _0x2032e1=_0x1540f7?0x0:_0x1e609b[_0xd24b('0x1d')];var _0x183b8c=_0x1540f7?_0x3b13da[_0xd24b('0x20')]:_0x1e609b[_0xd24b('0x1d')]+_0x1e609b['limit'];var _0x52d067;if(_0x183b8c>=_0x53fc71){_0x183b8c=_0x53fc71;_0x52d067=0xc8;}else{_0x52d067=0xce;}_0xcec7a7[_0xd24b('0x1b')](_0x52d067);return _0xcec7a7['set'](_0xd24b('0x21'),_0x2032e1+'-'+_0x183b8c+'/'+_0x53fc71)[_0xd24b('0x1c')](_0x3b13da);}return null;};}function patchUpdates(_0x4a68a7){return function(_0xdf13dd){try{jsonpatch[_0xd24b('0x22')](_0xdf13dd,_0x4a68a7,!![]);}catch(_0x208ba4){return BPromise[_0xd24b('0x23')](_0x208ba4);}return _0xdf13dd[_0xd24b('0x24')]();};}function saveUpdates(_0x11009d,_0x28b9e4){return function(_0x54b541){if(_0x54b541){return _0x54b541['update'](_0x11009d)[_0xd24b('0x25')](function(_0x53cfb3){return _0x53cfb3;});}return null;};}function removeEntity(_0x3ac6d1,_0x5a7abb){return function(_0x56db55){if(_0x56db55){return _0x56db55[_0xd24b('0x26')]()[_0xd24b('0x25')](function(){_0x3ac6d1[_0xd24b('0x1b')](0xcc)[_0xd24b('0x1a')]();});}};}function handleEntityNotFound(_0x5f0346,_0x189696){return function(_0x37afb0){if(!_0x37afb0){_0x5f0346[_0xd24b('0x19')](0x194);}return _0x37afb0;};}function handleError(_0x59cac0,_0x35f8bb){_0x35f8bb=_0x35f8bb||0x1f4;return function(_0x42bf51){logger[_0xd24b('0x27')](_0x42bf51[_0xd24b('0x28')]);if(_0x42bf51[_0xd24b('0x29')]){delete _0x42bf51[_0xd24b('0x29')];}_0x59cac0[_0xd24b('0x1b')](_0x35f8bb)['send'](_0x42bf51);};}exports['index']=function(_0x11ca72,_0xfb1871){var _0x1477d2={},_0x31ed84={},_0x20a0dc={'count':0x0,'rows':[]};var _0x5b25ee=_[_0xd24b('0x2a')](db[_0xd24b('0x2b')][_0xd24b('0x2c')],function(_0x417709){return{'name':_0x417709['fieldName'],'type':_0x417709['type']['key']};});_0x31ed84[_0xd24b('0x2d')]=_[_0xd24b('0x2a')](_0x5b25ee,_0xd24b('0x29'));_0x31ed84[_0xd24b('0x2e')]=_[_0xd24b('0x2f')](_0x11ca72[_0xd24b('0x2e')]);_0x31ed84['filters']=_[_0xd24b('0x30')](_0x31ed84[_0xd24b('0x2d')],_0x31ed84[_0xd24b('0x2e')]);_0x1477d2[_0xd24b('0x31')]=_[_0xd24b('0x30')](_0x31ed84[_0xd24b('0x2d')],qs[_0xd24b('0x32')](_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x32')]));_0x1477d2[_0xd24b('0x31')]=_0x1477d2[_0xd24b('0x31')][_0xd24b('0x33')]?_0x1477d2[_0xd24b('0x31')]:_0x31ed84[_0xd24b('0x2d')];if(!_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x34')](_0xd24b('0x35'))){_0x1477d2[_0xd24b('0x1f')]=qs[_0xd24b('0x1f')](_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x1f')]);_0x1477d2[_0xd24b('0x1d')]=qs[_0xd24b('0x1d')](_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x1d')]);}_0x1477d2[_0xd24b('0x36')]=qs[_0xd24b('0x37')](_0x11ca72['query']['sort']);_0x1477d2[_0xd24b('0x38')]=qs[_0xd24b('0x39')](_['pick'](_0x11ca72[_0xd24b('0x2e')],_0x31ed84['filters']),_0x5b25ee);if(_0x11ca72['query'][_0xd24b('0x3a')]){_0x1477d2[_0xd24b('0x38')]=_[_0xd24b('0x3b')](_0x1477d2[_0xd24b('0x38')],{'$or':_[_0xd24b('0x2a')](_0x5b25ee,function(_0x35af5f){if(_0x35af5f[_0xd24b('0x3c')]!==_0xd24b('0x3d')){var _0x3db554={};_0x3db554[_0x35af5f[_0xd24b('0x29')]]={'$like':'%'+_0x11ca72[_0xd24b('0x2e')][_0xd24b('0x3a')]+'%'};return _0x3db554;}})});}_0x1477d2=_['merge']({},_0x1477d2,_0x11ca72[_0xd24b('0x3e')]);var _0x2c551d={'where':_0x1477d2[_0xd24b('0x38')]};return db[_0xd24b('0x2b')]['count'](_0x2c551d)[_0xd24b('0x25')](function(_0x5f56f7){_0x20a0dc[_0xd24b('0x20')]=_0x5f56f7;if(_0x11ca72[_0xd24b('0x2e')]['includeAll']){_0x1477d2['include']=[{'all':!![]}];}return db[_0xd24b('0x2b')][_0xd24b('0x3f')](_0x1477d2);})[_0xd24b('0x25')](function(_0x5d0200){_0x20a0dc[_0xd24b('0x40')]=_0x5d0200;return _0x20a0dc;})[_0xd24b('0x25')](respondWithFilteredResult(_0xfb1871,_0x1477d2))[_0xd24b('0x41')](handleError(_0xfb1871,null));};exports['show']=function(_0x1e4417,_0x267804){var _0x3eec53={'raw':!![],'where':{'id':_0x1e4417[_0xd24b('0x42')]['id']}},_0x42ec23={};_0x42ec23[_0xd24b('0x2d')]=_[_0xd24b('0x2f')](db[_0xd24b('0x2b')][_0xd24b('0x2c')]);_0x42ec23[_0xd24b('0x2e')]=_[_0xd24b('0x2f')](_0x1e4417[_0xd24b('0x2e')]);_0x42ec23[_0xd24b('0x39')]=_[_0xd24b('0x30')](_0x42ec23[_0xd24b('0x2d')],_0x42ec23[_0xd24b('0x2e')]);_0x3eec53[_0xd24b('0x31')]=_[_0xd24b('0x30')](_0x42ec23[_0xd24b('0x2d')],qs[_0xd24b('0x32')](_0x1e4417[_0xd24b('0x2e')][_0xd24b('0x32')]));_0x3eec53[_0xd24b('0x31')]=_0x3eec53[_0xd24b('0x31')][_0xd24b('0x33')]?_0x3eec53[_0xd24b('0x31')]:_0x42ec23[_0xd24b('0x2d')];if(_0x1e4417['query'][_0xd24b('0x43')]){_0x3eec53[_0xd24b('0x44')]=[{'all':!![]}];}_0x3eec53=_['merge']({},_0x3eec53,_0x1e4417[_0xd24b('0x3e')]);return db['SmsApplication']['find'](_0x3eec53)[_0xd24b('0x25')](handleEntityNotFound(_0x267804,null))['then'](respondWithResult(_0x267804,null))['catch'](handleError(_0x267804,null));};exports[_0xd24b('0x45')]=function(_0x22347d,_0x10d823){return db[_0xd24b('0x2b')]['create'](_0x22347d[_0xd24b('0x46')],{})[_0xd24b('0x25')](respondWithResult(_0x10d823,0xc9))[_0xd24b('0x41')](handleError(_0x10d823,null));};exports[_0xd24b('0x47')]=function(_0x41bed0,_0x22d671){if(_0x41bed0[_0xd24b('0x46')]['id']){delete _0x41bed0[_0xd24b('0x46')]['id'];}return db['SmsApplication'][_0xd24b('0x48')]({'where':{'id':_0x41bed0[_0xd24b('0x42')]['id']}})[_0xd24b('0x25')](handleEntityNotFound(_0x22d671,null))[_0xd24b('0x25')](saveUpdates(_0x41bed0[_0xd24b('0x46')],null))[_0xd24b('0x25')](respondWithResult(_0x22d671,null))[_0xd24b('0x41')](handleError(_0x22d671,null));};exports[_0xd24b('0x26')]=function(_0x55d0a4,_0x464fa0){return db['SmsApplication'][_0xd24b('0x48')]({'where':{'id':_0x55d0a4['params']['id']}})['then'](handleEntityNotFound(_0x464fa0,null))[_0xd24b('0x25')](removeEntity(_0x464fa0,null))[_0xd24b('0x41')](handleError(_0x464fa0,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index ed52d14..e38760b 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 _0xde5f=['utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','./smsApplication.attributes','exports','SmsApplication','sms_applications','utf8mb4'];(function(_0x451d47,_0x3db835){var _0x1a4219=function(_0x3a160d){while(--_0x3a160d){_0x451d47['push'](_0x451d47['shift']());}};_0x1a4219(++_0x3db835);}(_0xde5f,0x83));var _0xfde5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xde5f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfde5('0x0'));var util=require('util');var logger=require(_0xfde5('0x1'))('api');var moment=require(_0xfde5('0x2'));var BPromise=require(_0xfde5('0x3'));var rp=require(_0xfde5('0x4'));var fs=require('fs');var path=require(_0xfde5('0x5'));var rimraf=require(_0xfde5('0x6'));var config=require('../../config/environment');var attributes=require(_0xfde5('0x7'));module[_0xfde5('0x8')]=function(_0x4f3b89,_0x55746b){return _0x4f3b89['define'](_0xfde5('0x9'),attributes,{'tableName':_0xfde5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfde5('0xb'),'collate':_0xfde5('0xc')});}; \ No newline at end of file +var _0x58a2=['sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports'];(function(_0x530159,_0x774c9d){var _0x17c43f=function(_0x4dd669){while(--_0x4dd669){_0x530159['push'](_0x530159['shift']());}};_0x17c43f(++_0x774c9d);}(_0x58a2,0x10b));var _0x258a=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0x58a2[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x258a('0x0'));var util=require('util');var logger=require(_0x258a('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x258a('0x2'));var fs=require('fs');var path=require(_0x258a('0x3'));var rimraf=require(_0x258a('0x4'));var config=require(_0x258a('0x5'));var attributes=require(_0x258a('0x6'));module[_0x258a('0x7')]=function(_0x4412f9,_0x53746b){return _0x4412f9['define']('SmsApplication',attributes,{'tableName':_0x258a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x258a('0x9'),'collate':_0x258a('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 0c67ae3..e25672b 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 _0x7e27=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','SmsApplication,\x20%s,\x20%s','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x5b6b28,_0xb71cf){var _0x441405=function(_0x9bbb88){while(--_0x9bbb88){_0x5b6b28['push'](_0x5b6b28['shift']());}};_0x441405(++_0xb71cf);}(_0x7e27,0xdd));var _0x77e2=function(_0x4624c7,_0xe2d475){_0x4624c7=_0x4624c7-0x0;var _0x182f49=_0x7e27[_0x4624c7];return _0x182f49;};'use strict';var _=require(_0x77e2('0x0'));var util=require(_0x77e2('0x1'));var moment=require('moment');var BPromise=require(_0x77e2('0x2'));var rs=require(_0x77e2('0x3'));var fs=require('fs');var Redis=require(_0x77e2('0x4'));var db=require(_0x77e2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77e2('0x6'))(_0x77e2('0x7'));var config=require(_0x77e2('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x77e2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101e56,_0x137a61,_0x502153){return new BPromise(function(_0x3c2b3f,_0x2cdfa3){return client[_0x77e2('0xa')](_0x101e56,_0x502153)[_0x77e2('0xb')](function(_0x3802ce){logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x137a61,'request\x20sent');logger['debug'](_0x77e2('0xe'),_0x137a61,'request\x20sent',JSON[_0x77e2('0xf')](_0x3802ce));if(_0x3802ce[_0x77e2('0x10')]){if(_0x3802ce['error']['code']===0x1f4){logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x3802ce['error'][_0x77e2('0x11')]);return _0x2cdfa3(_0x3802ce['error']['message']);}logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x3802ce[_0x77e2('0x10')][_0x77e2('0x11')]);return _0x3c2b3f(_0x3802ce[_0x77e2('0x10')]['message']);}else{logger[_0x77e2('0xc')](_0x77e2('0xd'),_0x137a61,'request\x20sent');_0x3c2b3f(_0x3802ce[_0x77e2('0x12')][_0x77e2('0x11')]);}})[_0x77e2('0x13')](function(_0x1352c1){logger[_0x77e2('0x10')](_0x77e2('0xd'),_0x137a61,_0x1352c1);_0x2cdfa3(_0x1352c1);});});} \ No newline at end of file +var _0x7d06=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x7d06,0x158));var _0x67d0=function(_0x2b60eb,_0x48074c){_0x2b60eb=_0x2b60eb-0x0;var _0x56aa21=_0x7d06[_0x2b60eb];return _0x56aa21;};'use strict';var _=require(_0x67d0('0x0'));var util=require(_0x67d0('0x1'));var moment=require(_0x67d0('0x2'));var BPromise=require(_0x67d0('0x3'));var rs=require(_0x67d0('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x67d0('0x5'))['db'];var utils=require(_0x67d0('0x6'));var logger=require(_0x67d0('0x7'))('rpc');var config=require(_0x67d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x67d0('0x9')][_0x67d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x367f1d,_0xe4789b,_0x3c9976){return new BPromise(function(_0x481a08,_0x358986){return client['request'](_0x367f1d,_0x3c9976)[_0x67d0('0xb')](function(_0x5916d0){logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));logger[_0x67d0('0xf')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0xe4789b,_0x67d0('0xe'),JSON['stringify'](_0x5916d0));if(_0x5916d0['error']){if(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x11')]===0x1f4){logger['error'](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')]['message']);return _0x358986(_0x5916d0[_0x67d0('0x10')]['message']);}logger[_0x67d0('0x10')](_0x67d0('0xd'),_0xe4789b,_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);return _0x481a08(_0x5916d0[_0x67d0('0x10')][_0x67d0('0x12')]);}else{logger[_0x67d0('0xc')](_0x67d0('0xd'),_0xe4789b,_0x67d0('0xe'));_0x481a08(_0x5916d0[_0x67d0('0x13')]['message']);}})[_0x67d0('0x14')](function(_0xa1b889){logger['error'](_0x67d0('0xd'),_0xe4789b,_0xa1b889);_0x358986(_0xa1b889);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index d6e700e..fe2e125 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 _0xb688=['destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','sms'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xb688,0xcf));var _0x8b68=function(_0x322944,_0x282203){_0x322944=_0x322944-0x0;var _0xc8374c=_0xb688[_0x322944];return _0xc8374c;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var fs_extra=require(_0x8b68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x8b68('0x6'));var config=require(_0x8b68('0x7'));var controller=require(_0x8b68('0x8'));router[_0x8b68('0x9')]('/',auth['isAuthenticated'](),controller[_0x8b68('0xa')]);router['get'](_0x8b68('0xb'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xd')]);router[_0x8b68('0x9')](_0x8b68('0xe'),auth[_0x8b68('0xc')](),controller[_0x8b68('0xf')]);router[_0x8b68('0x9')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x11')]);router[_0x8b68('0x9')](_0x8b68('0x12'),auth['isAuthenticated'](),controller[_0x8b68('0x13')]);router[_0x8b68('0x14')]('/',auth[_0x8b68('0xc')](),controller[_0x8b68('0x15')]);router[_0x8b68('0x14')](_0x8b68('0x10'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x16')]);router[_0x8b68('0x14')]('/:id/tags',auth[_0x8b68('0xc')](),interaction['tracked']('sms',_0x8b68('0x17')),controller[_0x8b68('0x18')]);router[_0x8b68('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x8b68('0x1a')]('sms',_0x8b68('0x1b')),controller[_0x8b68('0x1c')]);router[_0x8b68('0x1d')](_0x8b68('0xe'),auth['isAuthenticated'](),interaction[_0x8b68('0x1a')](_0x8b68('0x1e'),'smsinteraction:destroy'),controller[_0x8b68('0x1f')]);router[_0x8b68('0x1d')](_0x8b68('0x20'),auth[_0x8b68('0xc')](),controller[_0x8b68('0x21')]);module['exports']=router; \ No newline at end of file +var _0xb03e=['exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags','addTags','smsinteraction:update','update','delete','smsinteraction:destroy','destroy','removeTags'];(function(_0x96cc19,_0x3246a9){var _0x23d336=function(_0x2274bc){while(--_0x2274bc){_0x96cc19['push'](_0x96cc19['shift']());}};_0x23d336(++_0x3246a9);}(_0xb03e,0x1eb));var _0xeb03=function(_0x22ff2e,_0x4076a0){_0x22ff2e=_0x22ff2e-0x0;var _0x42e1a2=_0xb03e[_0x22ff2e];return _0x42e1a2;};'use strict';var multer=require('multer');var util=require(_0xeb03('0x0'));var path=require(_0xeb03('0x1'));var timeout=require(_0xeb03('0x2'));var express=require(_0xeb03('0x3'));var router=express[_0xeb03('0x4')]();var fs_extra=require(_0xeb03('0x5'));var auth=require(_0xeb03('0x6'));var interaction=require(_0xeb03('0x7'));var config=require(_0xeb03('0x8'));var controller=require(_0xeb03('0x9'));router[_0xeb03('0xa')]('/',auth[_0xeb03('0xb')](),controller['index']);router[_0xeb03('0xa')](_0xeb03('0xc'),auth[_0xeb03('0xb')](),controller[_0xeb03('0xd')]);router[_0xeb03('0xa')](_0xeb03('0xe'),auth['isAuthenticated'](),controller[_0xeb03('0xf')]);router[_0xeb03('0xa')](_0xeb03('0x10'),auth['isAuthenticated'](),controller[_0xeb03('0x11')]);router['get'](_0xeb03('0x12'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x13')]);router[_0xeb03('0x14')]('/',auth[_0xeb03('0xb')](),controller[_0xeb03('0x15')]);router[_0xeb03('0x14')](_0xeb03('0x10'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x16')]);router[_0xeb03('0x14')](_0xeb03('0x17'),auth['isAuthenticated'](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1a')),controller[_0xeb03('0x1b')]);router['put'](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')]('sms',_0xeb03('0x1c')),controller[_0xeb03('0x1d')]);router[_0xeb03('0x1e')](_0xeb03('0xe'),auth[_0xeb03('0xb')](),interaction[_0xeb03('0x18')](_0xeb03('0x19'),_0xeb03('0x1f')),controller[_0xeb03('0x20')]);router[_0xeb03('0x1e')](_0xeb03('0x17'),auth[_0xeb03('0xb')](),controller[_0xeb03('0x21')]);module[_0xeb03('0x22')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 3838257..36a911d 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 _0x6d5e=['DATE','ENUM','out','sequelize','moment','exports','BOOLEAN','STRING'];(function(_0x11b664,_0x5ed6d7){var _0x419ea6=function(_0x2f90bb){while(--_0x2f90bb){_0x11b664['push'](_0x11b664['shift']());}};_0x419ea6(++_0x5ed6d7);}(_0x6d5e,0x103));var _0xe6d5=function(_0x55845f,_0xa3e48b){_0x55845f=_0x55845f-0x0;var _0xa10fa6=_0x6d5e[_0x55845f];return _0xa10fa6;};'use strict';var Sequelize=require(_0xe6d5('0x0'));var moment=require(_0xe6d5('0x1'));module[_0xe6d5('0x2')]={'closed':{'type':Sequelize[_0xe6d5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xe6d5('0x4')]},'secondDisposition':{'type':Sequelize[_0xe6d5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe6d5('0x4')]},'note':{'type':Sequelize[_0xe6d5('0x4')]},'phone':{'type':Sequelize[_0xe6d5('0x4')]},'read1stAt':{'type':Sequelize[_0xe6d5('0x5')]},'firstMsgDirection':{'type':Sequelize[_0xe6d5('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe6d5('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xe6d5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6739=['STRING','ENUM','out','sequelize','moment','exports','BOOLEAN','DATE'];(function(_0x479d34,_0x4ed609){var _0x42a5cd=function(_0x25edb9){while(--_0x25edb9){_0x479d34['push'](_0x479d34['shift']());}};_0x42a5cd(++_0x4ed609);}(_0x6739,0xd3));var _0x9673=function(_0x1a51aa,_0x344705){_0x1a51aa=_0x1a51aa-0x0;var _0x28c6e8=_0x6739[_0x1a51aa];return _0x28c6e8;};'use strict';var Sequelize=require(_0x9673('0x0'));var moment=require(_0x9673('0x1'));module[_0x9673('0x2')]={'closed':{'type':Sequelize[_0x9673('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9673('0x4')]},'disposition':{'type':Sequelize[_0x9673('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9673('0x5')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9673('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9673('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x9673('0x6')]('in',_0x9673('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 2d02fa2..ec545b1 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 _0x80ce=['createPdfFromHTML','log','err','unlinkSync','bluebird','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','./smsInteraction.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','sendStatus','error','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','sms','user','catch','show','params','model','keys','query','intersection','fields','attributes','length','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','sort','pick','where','filter','$gte','split','findAll','rows','setTags','spread','Tag','color','smsInteractionTags:save','removeTags','download','toString','root','files','tmp','format','transcript-%d-%s.zip','join','User','push','CmContact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','fullname','get','mkdirSync','Sms','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','out','System','Contact','read','renderFile','server','downloadInteraction.ejs','transcript-','.pdf'];(function(_0x342981,_0xffb36b){var _0x321b9b=function(_0x189149){while(--_0x189149){_0x342981['push'](_0x342981['shift']());}};_0x321b9b(++_0xffb36b);}(_0x80ce,0x7d));var _0xe80c=function(_0x23263c,_0x39c3bf){_0x23263c=_0x23263c-0x0;var _0x4952aa=_0x80ce[_0x23263c];return _0x4952aa;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xe80c('0x0'));var util=require(_0xe80c('0x1'));var path=require(_0xe80c('0x2'));var ejs=require(_0xe80c('0x3'));var fs=require('fs');var _=require(_0xe80c('0x4'));var Redis=require(_0xe80c('0x5'));var interaction=require(_0xe80c('0x6'));var qs=require(_0xe80c('0x7'));var pdf=require(_0xe80c('0x8'));var logger=require(_0xe80c('0x9'))(_0xe80c('0xa'));var config=require(_0xe80c('0xb'));var db=require(_0xe80c('0xc'))['db'];config['redis']=_['defaults'](config[_0xe80c('0xd')],{'host':_0xe80c('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe80c('0xd')]));require(_0xe80c('0xf'))[_0xe80c('0x10')](socket);function respondWithStatusCode(_0xb0e4f6,_0x23552e){_0x23552e=_0x23552e||0xcc;return function(_0x235156){if(_0x235156){return _0xb0e4f6['sendStatus'](_0x23552e);}return _0xb0e4f6[_0xe80c('0x11')](_0x23552e)[_0xe80c('0x12')]();};}function respondWithResult(_0x59aca3,_0x4f7a7f){_0x4f7a7f=_0x4f7a7f||0xc8;return function(_0x5a8754){if(_0x5a8754){return _0x59aca3['status'](_0x4f7a7f)[_0xe80c('0x13')](_0x5a8754);}};}function respondWithFilteredResult(_0x1f8ea2,_0x2e619d){return function(_0x29c9e8){if(_0x29c9e8){var _0x2246f1=typeof _0x2e619d[_0xe80c('0x14')]===_0xe80c('0x15')&&typeof _0x2e619d[_0xe80c('0x16')]==='undefined';var _0x237665=_0x29c9e8[_0xe80c('0x17')];var _0x4e9612=_0x2246f1?0x0:_0x2e619d[_0xe80c('0x14')];var _0x53b0cb=_0x2246f1?_0x29c9e8[_0xe80c('0x17')]:_0x2e619d[_0xe80c('0x14')]+_0x2e619d[_0xe80c('0x16')];var _0x4d91a3;if(_0x53b0cb>=_0x237665){_0x53b0cb=_0x237665;_0x4d91a3=0xc8;}else{_0x4d91a3=0xce;}_0x1f8ea2[_0xe80c('0x11')](_0x4d91a3);return _0x1f8ea2['set'](_0xe80c('0x18'),_0x4e9612+'-'+_0x53b0cb+'/'+_0x237665)['json'](_0x29c9e8);}return null;};}function saveUpdates(_0x2a9bd0){return function(_0x9a6912){if(_0x9a6912){return _0x9a6912[_0xe80c('0x19')](_0x2a9bd0)[_0xe80c('0x1a')](function(_0x40617a){return _0x40617a;});}return null;};}function removeEntity(_0x220a1d){return function(_0x2cc1c8){if(_0x2cc1c8){return _0x2cc1c8[_0xe80c('0x1b')]()[_0xe80c('0x1a')](function(){_0x220a1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f9363){return function(_0x1aff0e){if(!_0x1aff0e){_0x1f9363[_0xe80c('0x1c')](0x194);}return _0x1aff0e;};}function handleError(_0x31878d,_0x24b63c){_0x24b63c=_0x24b63c||0x1f4;return function(_0x31db11){logger[_0xe80c('0x1d')](_0x31db11['stack']);if(_0x31db11[_0xe80c('0x1e')]){delete _0x31db11[_0xe80c('0x1e')];}_0x31878d[_0xe80c('0x11')](_0x24b63c)[_0xe80c('0x1f')](_0x31db11);};}exports[_0xe80c('0x20')]=function(_0x35ec8a,_0x2bbbf3){var _0x30d37b={};var _0x2221f4=_[_0xe80c('0x21')](db[_0xe80c('0x22')][_0xe80c('0x23')],function(_0x1ce71d){return{'name':_0x1ce71d[_0xe80c('0x24')],'type':_0x1ce71d[_0xe80c('0x25')]['key']};});_0x30d37b=qs['getOptions'](_0x2221f4,_0x35ec8a);return interaction['findAll'](_0xe80c('0x26'),_0x35ec8a['query'],_0x35ec8a[_0xe80c('0x27')],_0x30d37b,_0x2221f4)[_0xe80c('0x1a')](respondWithFilteredResult(_0x2bbbf3,_0x30d37b))[_0xe80c('0x28')](handleError(_0x2bbbf3,null));};exports[_0xe80c('0x29')]=function(_0x68b8db,_0xca0868){var _0x488186={'raw':![],'where':{'id':_0x68b8db[_0xe80c('0x2a')]['id']}},_0x342665={};_0x342665[_0xe80c('0x2b')]=_[_0xe80c('0x2c')](db[_0xe80c('0x22')][_0xe80c('0x23')]);_0x342665[_0xe80c('0x2d')]=_[_0xe80c('0x2c')](_0x68b8db[_0xe80c('0x2d')]);_0x342665['filters']=_[_0xe80c('0x2e')](_0x342665[_0xe80c('0x2b')],_0x342665[_0xe80c('0x2d')]);_0x488186['attributes']=_[_0xe80c('0x2e')](_0x342665[_0xe80c('0x2b')],qs['fields'](_0x68b8db['query'][_0xe80c('0x2f')]));_0x488186[_0xe80c('0x30')]=_0x488186[_0xe80c('0x30')][_0xe80c('0x31')]?_0x488186['attributes']:_0x342665[_0xe80c('0x2b')];if(_0x68b8db['query'][_0xe80c('0x32')]){_0x488186[_0xe80c('0x33')]=[{'all':!![]}];}_0x488186=_[_0xe80c('0x34')]({},_0x488186,_0x68b8db[_0xe80c('0x35')]);return db['SmsInteraction'][_0xe80c('0x36')](_0x488186)[_0xe80c('0x1a')](handleEntityNotFound(_0xca0868,null))[_0xe80c('0x1a')](respondWithResult(_0xca0868,null))['catch'](handleError(_0xca0868,null));};exports[_0xe80c('0x37')]=function(_0x4258d4,_0x23b9f6){return db[_0xe80c('0x22')]['create'](_0x4258d4[_0xe80c('0x38')],{})[_0xe80c('0x1a')](respondWithResult(_0x23b9f6,0xc9))[_0xe80c('0x28')](handleError(_0x23b9f6,null));};exports[_0xe80c('0x19')]=function(_0x417d46,_0x4c6174){if(_0x417d46['body']['id']){delete _0x417d46['body']['id'];}return db['SmsInteraction'][_0xe80c('0x36')]({'where':{'id':_0x417d46[_0xe80c('0x2a')]['id']}})[_0xe80c('0x1a')](handleEntityNotFound(_0x4c6174,null))['then'](saveUpdates(_0x417d46['body'],null))[_0xe80c('0x1a')](respondWithResult(_0x4c6174,null))[_0xe80c('0x28')](handleError(_0x4c6174,null));};exports[_0xe80c('0x1b')]=function(_0xd09abb,_0xf88620){return db[_0xe80c('0x22')]['find']({'where':{'id':_0xd09abb[_0xe80c('0x2a')]['id']}})[_0xe80c('0x1a')](handleEntityNotFound(_0xf88620,null))[_0xe80c('0x1a')](removeEntity(_0xf88620,null))[_0xe80c('0x28')](handleError(_0xf88620,null));};exports[_0xe80c('0x39')]=function(_0x5abe23,_0x36e133){return db[_0xe80c('0x22')]['describe']()[_0xe80c('0x1a')](respondWithResult(_0x36e133,null))[_0xe80c('0x28')](handleError(_0x36e133,null));};exports[_0xe80c('0x3a')]=function(_0x21ef02,_0xe48a0b){return db[_0xe80c('0x3b')][_0xe80c('0x36')]({'where':{'id':_0x21ef02[_0xe80c('0x2a')]['id']}})[_0xe80c('0x1a')](handleEntityNotFound(_0xe48a0b,null))[_0xe80c('0x1a')](function(_0x33e8c1){if(_0x33e8c1){return _0x33e8c1[_0xe80c('0x3a')](_0x21ef02[_0xe80c('0x38')]['ids'],_[_0xe80c('0x3c')](_0x21ef02[_0xe80c('0x38')],[_0xe80c('0x3d'),'id'])||{});}})[_0xe80c('0x1a')](respondWithResult(_0xe48a0b,null))['catch'](handleError(_0xe48a0b,null));};exports[_0xe80c('0x3e')]=function(_0x5ac377,_0x174043){var _0x57dd2d={'raw':![],'where':{}};var _0x57eb04={};var _0x475a5e={'count':0x0,'rows':[]};return db['SmsInteraction'][_0xe80c('0x3f')]({'where':{'id':_0x5ac377[_0xe80c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x174043,null))[_0xe80c('0x1a')](function(_0xd7cd34){if(_0xd7cd34){_0x57eb04[_0xe80c('0x2b')]=_['keys'](db[_0xe80c('0x3b')]['rawAttributes']);_0x57eb04[_0xe80c('0x2d')]=_[_0xe80c('0x2c')](_0x5ac377[_0xe80c('0x2d')]);_0x57eb04[_0xe80c('0x40')]=_[_0xe80c('0x2e')](_0x57eb04[_0xe80c('0x2b')],_0x57eb04['query']);_0x57dd2d[_0xe80c('0x30')]=_['intersection'](_0x57eb04[_0xe80c('0x2b')],qs['fields'](_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x2f')]));_0x57dd2d[_0xe80c('0x30')]=_0x57dd2d[_0xe80c('0x30')][_0xe80c('0x31')]?_0x57dd2d['attributes']:_0x57eb04[_0xe80c('0x2b')];if(!_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x41')](_0xe80c('0x42'))){_0x57dd2d[_0xe80c('0x16')]=qs[_0xe80c('0x16')](_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x16')]);_0x57dd2d[_0xe80c('0x14')]=qs[_0xe80c('0x14')](_0x5ac377[_0xe80c('0x2d')]['offset']);}_0x57dd2d['order']=qs[_0xe80c('0x43')](_0x5ac377[_0xe80c('0x2d')]['sort']);_0x57dd2d['where']=qs[_0xe80c('0x40')](_[_0xe80c('0x44')](_0x5ac377['query'],_0x57eb04[_0xe80c('0x40')]));_0x57dd2d[_0xe80c('0x45')]['SmsInteractionId']=_0xd7cd34['id'];if(_0x5ac377['query'][_0xe80c('0x46')]){_0x57dd2d['where']=_['merge'](_0x57dd2d[_0xe80c('0x45')],{'$or':_[_0xe80c('0x21')](_0x57dd2d[_0xe80c('0x30')],function(_0x19f67e){var _0x1be5ff={};_0x1be5ff[_0x19f67e]={'$like':'%'+_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x46')]+'%'};return _0x1be5ff;})});}if(_0x5ac377[_0xe80c('0x2d')]['$gte']){var _0x50c212=_0x5ac377[_0xe80c('0x2d')][_0xe80c('0x47')][_0xe80c('0x48')](',');var _0x369b0c={};_0x369b0c[_0x50c212[0x0]]={'$gte':moment(_0x50c212[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x57dd2d['where']=_[_0xe80c('0x34')](_0x57dd2d[_0xe80c('0x45')],_0x369b0c);}_0x57dd2d=_[_0xe80c('0x34')]({},_0x57dd2d,_0x5ac377[_0xe80c('0x35')]);return db[_0xe80c('0x3b')]['count']({'where':_0x57dd2d[_0xe80c('0x45')]})['then'](function(_0x44f044){_0x475a5e[_0xe80c('0x17')]=_0x44f044;if(_0x5ac377[_0xe80c('0x2d')]['includeAll']){_0x57dd2d[_0xe80c('0x33')]=[{'all':!![]}];}return db[_0xe80c('0x3b')][_0xe80c('0x49')](_0x57dd2d);})[_0xe80c('0x1a')](function(_0x4a630a){_0x475a5e[_0xe80c('0x4a')]=_0x4a630a;return _0x475a5e;});}})[_0xe80c('0x1a')](respondWithFilteredResult(_0x174043,_0x57dd2d))[_0xe80c('0x28')](handleError(_0x174043,null));};exports['addTags']=function(_0x342552,_0x287cb0){return db[_0xe80c('0x22')][_0xe80c('0x36')]({'where':{'id':_0x342552['params']['id']}})['then'](handleEntityNotFound(_0x287cb0,null))[_0xe80c('0x1a')](function(_0x51998d){if(_0x51998d){return _0x51998d[_0xe80c('0x4b')](_0x342552[_0xe80c('0x38')][_0xe80c('0x3d')],_['omit'](_0x342552['body'],[_0xe80c('0x3d'),'id'])||{})[_0xe80c('0x4c')](function(){return db[_0xe80c('0x4d')][_0xe80c('0x49')]({'attributes':['id',_0xe80c('0x1e'),_0xe80c('0x4e')],'where':{'id':_0x342552['body']['ids']}});})[_0xe80c('0x1a')](function(_0x1091a8){socket['emit'](_0xe80c('0x4f'),{'id':Number(_0x342552[_0xe80c('0x2a')]['id']),'tags':_0x1091a8||[]});return{'id':Number(_0x342552['params']['id']),'tags':_0x1091a8||[]};});}})['then'](respondWithResult(_0x287cb0,null))['catch'](handleError(_0x287cb0,null));};exports['removeTags']=function(_0x3d93fd,_0x516960){return db[_0xe80c('0x22')]['find']({'where':{'id':_0x3d93fd[_0xe80c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x516960,null))[_0xe80c('0x1a')](function(_0x39de5d){if(_0x39de5d){return _0x39de5d[_0xe80c('0x50')](_0x3d93fd[_0xe80c('0x2d')]['ids']);}})[_0xe80c('0x1a')](respondWithStatusCode(_0x516960,null))[_0xe80c('0x28')](handleError(_0x516960,null));};exports[_0xe80c('0x51')]=function(_0x538b9a,_0x625a68){var _0x12e238=moment()['unix']()[_0xe80c('0x52')]();var _0x4f67a8=path['join'](config[_0xe80c('0x53')],'server',_0xe80c('0x54'),_0xe80c('0x55'));var _0x12339f=path['join'](_0x4f67a8,_0x12e238);var _0x495bfd=util[_0xe80c('0x56')](_0xe80c('0x57'),_0x538b9a[_0xe80c('0x2a')]['id'],_0x12e238);var _0x47005a=path[_0xe80c('0x58')](_0x4f67a8,_0x495bfd);var _0x184385=[];_0x184385['push']({'model':db[_0xe80c('0x59')],'as':'User','attributes':['id','fullname'],'raw':!![]});_0x184385[_0xe80c('0x5a')]({'model':db[_0xe80c('0x5b')],'as':'Contact','attributes':['id',_0xe80c('0x5c'),_0xe80c('0x5d')],'raw':!![]});var _0x518ed0=[{'model':db[_0xe80c('0x3b')],'as':_0xe80c('0x5e'),'attributes':['id','body','createdAt',_0xe80c('0x5f'),_0xe80c('0x60'),'read'],'include':_0x184385}];_0x518ed0[_0xe80c('0x5a')]({'model':db[_0xe80c('0x61')],'as':_0xe80c('0x62'),'attributes':['id','name']});_0x518ed0[_0xe80c('0x5a')]({'model':db[_0xe80c('0x59')],'as':_0xe80c('0x63'),'attributes':['id',_0xe80c('0x64')]});return db[_0xe80c('0x22')][_0xe80c('0x36')]({'where':{'id':_0x538b9a[_0xe80c('0x2a')]['id']},'include':_0x518ed0})[_0xe80c('0x1a')](handleEntityNotFound(_0x625a68,null))[_0xe80c('0x1a')](function(_0x5ed004){if(_0x5ed004){var _0x2dd127=_0x5ed004[_0xe80c('0x65')]({'plain':!![]});fs[_0xe80c('0x66')](_0x12339f);var _0xf86aee={'channel':_0xe80c('0x67'),'account':_0x2dd127['Account'][_0xe80c('0x1e')],'agent':_0x2dd127[_0xe80c('0x63')]?_0x2dd127['Owner'][_0xe80c('0x64')]:_0xe80c('0x68'),'createdAt':moment(_0x2dd127['createdAt'])[_0xe80c('0x56')](_0xe80c('0x69'))[_0xe80c('0x52')](),'closedAt':_0x2dd127[_0xe80c('0x6a')]?moment(_0x2dd127[_0xe80c('0x6b')])[_0xe80c('0x56')](_0xe80c('0x69'))[_0xe80c('0x52')]():'','disposition':_0x2dd127['disposition'],'messages':_(_0x2dd127[_0xe80c('0x5e')])[_0xe80c('0x46')]({'secret':![]})[_0xe80c('0x21')](function(_0x19d10c){return{'date':moment(_0x19d10c['createdAt'])['format'](_0xe80c('0x69'))[_0xe80c('0x52')](),'sender':_0x19d10c['direction']===_0xe80c('0x6c')?_0x19d10c[_0xe80c('0x59')]?_0x19d10c['User']['fullname']:_0xe80c('0x6d'):_0x19d10c['Contact'][_0xe80c('0x5c')]+(_0x19d10c['Contact'][_0xe80c('0x5d')]?'\x20'+_0x19d10c[_0xe80c('0x6e')][_0xe80c('0x5d')]:''),'body':_0x19d10c[_0xe80c('0x38')],'direction':_0x19d10c['direction']==='out'?'A':'C','secret':_0x19d10c['secret'],'read':_0x19d10c[_0xe80c('0x6f')]};})['value']()};return ejs[_0xe80c('0x70')](path[_0xe80c('0x58')](config[_0xe80c('0x53')],_0xe80c('0x71'),'views',_0xe80c('0x72')),{'interaction':_0xf86aee})[_0xe80c('0x1a')](function(_0x16a240){var _0x3d790d=path[_0xe80c('0x58')](_0x12339f,_0xe80c('0x73')+_0x2dd127['id']+'-'+_0x12e238+_0xe80c('0x74'));var _0x36bd0f={'path':_0x3d790d,'channel':_0xe80c('0x67'),'interactionId':_0x2dd127['id']};return pdf[_0xe80c('0x75')](_0x16a240,_0x36bd0f);})[_0xe80c('0x1a')](function(){return new BPromise(function(_0x1a9251,_0x18a8c2){zipdir(_0x12339f,{'saveTo':_0x47005a},function(_0x5e8112,_0x1e0fc0){if(_0x5e8112)return _0x18a8c2(_0x5e8112);return _0x1a9251(_0x1e0fc0);});})[_0xe80c('0x1a')](function(){return new BPromise(function(_0x3170a2,_0x393f3c){rimraf(_0x12339f,function(_0x551fad){if(_0x551fad)_0x393f3c(_0x551fad);return _0x3170a2();});});})[_0xe80c('0x1a')](function(){return _0x625a68['download'](_0x47005a,_0x495bfd,function(_0x40471e){if(_0x40471e){console[_0xe80c('0x76')](_0xe80c('0x77'),_0x40471e);}else{fs[_0xe80c('0x78')](_0x47005a);}});});});}else{return _0x625a68['sendStatus'](0xc8);}})[_0xe80c('0x28')](handleError(_0x625a68,null));}; \ No newline at end of file +var _0x39d4=['count','json','update','destroy','then','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','keys','filters','attributes','model','fields','length','includeAll','merge','options','find','create','body','params','describe','addMessage','ids','omit','getMessages','findOne','intersection','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','SmsMessage','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','unix','toString','join','root','server','files','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret','push','SmsAccount','Account','Owner','fullname','get','Sms','N.A.','closed','closedAt','disposition','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','download','log','err','unlinkSync','bluebird','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0x39d4,0x1dc));var _0x439d=function(_0x1a463d,_0x30ea3b){_0x1a463d=_0x1a463d-0x0;var _0x43eec8=_0x39d4[_0x1a463d];return _0x43eec8;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0x439d('0x0'));var util=require('util');var path=require(_0x439d('0x1'));var ejs=require(_0x439d('0x2'));var fs=require('fs');var _=require(_0x439d('0x3'));var Redis=require('ioredis');var interaction=require(_0x439d('0x4'));var qs=require(_0x439d('0x5'));var pdf=require(_0x439d('0x6'));var logger=require(_0x439d('0x7'))('api');var config=require(_0x439d('0x8'));var db=require(_0x439d('0x9'))['db'];config[_0x439d('0xa')]=_[_0x439d('0xb')](config[_0x439d('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x439d('0xc'))(new Redis(config[_0x439d('0xa')]));require('./smsInteraction.socket')[_0x439d('0xd')](socket);function respondWithStatusCode(_0x5aca7c,_0x297144){_0x297144=_0x297144||0xcc;return function(_0x46bf1e){if(_0x46bf1e){return _0x5aca7c[_0x439d('0xe')](_0x297144);}return _0x5aca7c[_0x439d('0xf')](_0x297144)[_0x439d('0x10')]();};}function respondWithResult(_0x519c04,_0x110482){_0x110482=_0x110482||0xc8;return function(_0x3dace7){if(_0x3dace7){return _0x519c04[_0x439d('0xf')](_0x110482)['json'](_0x3dace7);}};}function respondWithFilteredResult(_0x27af43,_0x242c42){return function(_0x4ef1aa){if(_0x4ef1aa){var _0x4a76be=typeof _0x242c42[_0x439d('0x11')]===_0x439d('0x12')&&typeof _0x242c42[_0x439d('0x13')]===_0x439d('0x12');var _0x361ece=_0x4ef1aa[_0x439d('0x14')];var _0x4a474e=_0x4a76be?0x0:_0x242c42[_0x439d('0x11')];var _0x1bd746=_0x4a76be?_0x4ef1aa[_0x439d('0x14')]:_0x242c42[_0x439d('0x11')]+_0x242c42[_0x439d('0x13')];var _0x1e5149;if(_0x1bd746>=_0x361ece){_0x1bd746=_0x361ece;_0x1e5149=0xc8;}else{_0x1e5149=0xce;}_0x27af43[_0x439d('0xf')](_0x1e5149);return _0x27af43['set']('Content-Range',_0x4a474e+'-'+_0x1bd746+'/'+_0x361ece)[_0x439d('0x15')](_0x4ef1aa);}return null;};}function saveUpdates(_0x19a02a){return function(_0x1a2937){if(_0x1a2937){return _0x1a2937[_0x439d('0x16')](_0x19a02a)['then'](function(_0x1f316d){return _0x1f316d;});}return null;};}function removeEntity(_0x26cef4){return function(_0x2e7247){if(_0x2e7247){return _0x2e7247[_0x439d('0x17')]()[_0x439d('0x18')](function(){_0x26cef4[_0x439d('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5068af){return function(_0x5d5f4b){if(!_0x5d5f4b){_0x5068af[_0x439d('0xe')](0x194);}return _0x5d5f4b;};}function handleError(_0xe66000,_0x34d5ff){_0x34d5ff=_0x34d5ff||0x1f4;return function(_0x1713d){logger[_0x439d('0x19')](_0x1713d[_0x439d('0x1a')]);if(_0x1713d[_0x439d('0x1b')]){delete _0x1713d[_0x439d('0x1b')];}_0xe66000[_0x439d('0xf')](_0x34d5ff)[_0x439d('0x1c')](_0x1713d);};}exports[_0x439d('0x1d')]=function(_0x1c5de0,_0x29dad2){var _0x5874a2={};var _0x286753=_[_0x439d('0x1e')](db[_0x439d('0x1f')][_0x439d('0x20')],function(_0x31c956){return{'name':_0x31c956[_0x439d('0x21')],'type':_0x31c956[_0x439d('0x22')][_0x439d('0x23')]};});_0x5874a2=qs[_0x439d('0x24')](_0x286753,_0x1c5de0);return interaction[_0x439d('0x25')](_0x439d('0x26'),_0x1c5de0[_0x439d('0x27')],_0x1c5de0[_0x439d('0x28')],_0x5874a2,_0x286753)[_0x439d('0x18')](respondWithFilteredResult(_0x29dad2,_0x5874a2))[_0x439d('0x29')](handleError(_0x29dad2,null));};exports['show']=function(_0x254014,_0x12e2e0){var _0x33b7f6={'raw':![],'where':{'id':_0x254014['params']['id']}},_0x11c89f={};_0x11c89f['model']=_[_0x439d('0x2a')](db[_0x439d('0x1f')][_0x439d('0x20')]);_0x11c89f[_0x439d('0x27')]=_[_0x439d('0x2a')](_0x254014['query']);_0x11c89f[_0x439d('0x2b')]=_['intersection'](_0x11c89f['model'],_0x11c89f[_0x439d('0x27')]);_0x33b7f6[_0x439d('0x2c')]=_['intersection'](_0x11c89f[_0x439d('0x2d')],qs[_0x439d('0x2e')](_0x254014['query']['fields']));_0x33b7f6[_0x439d('0x2c')]=_0x33b7f6[_0x439d('0x2c')][_0x439d('0x2f')]?_0x33b7f6[_0x439d('0x2c')]:_0x11c89f[_0x439d('0x2d')];if(_0x254014[_0x439d('0x27')][_0x439d('0x30')]){_0x33b7f6['include']=[{'all':!![]}];}_0x33b7f6=_[_0x439d('0x31')]({},_0x33b7f6,_0x254014[_0x439d('0x32')]);return db[_0x439d('0x1f')][_0x439d('0x33')](_0x33b7f6)[_0x439d('0x18')](handleEntityNotFound(_0x12e2e0,null))[_0x439d('0x18')](respondWithResult(_0x12e2e0,null))[_0x439d('0x29')](handleError(_0x12e2e0,null));};exports[_0x439d('0x34')]=function(_0x2bb89d,_0x5b0913){return db[_0x439d('0x1f')][_0x439d('0x34')](_0x2bb89d[_0x439d('0x35')],{})[_0x439d('0x18')](respondWithResult(_0x5b0913,0xc9))[_0x439d('0x29')](handleError(_0x5b0913,null));};exports[_0x439d('0x16')]=function(_0x4c4b55,_0x494643){if(_0x4c4b55[_0x439d('0x35')]['id']){delete _0x4c4b55[_0x439d('0x35')]['id'];}return db[_0x439d('0x1f')]['find']({'where':{'id':_0x4c4b55[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x494643,null))[_0x439d('0x18')](saveUpdates(_0x4c4b55['body'],null))[_0x439d('0x18')](respondWithResult(_0x494643,null))[_0x439d('0x29')](handleError(_0x494643,null));};exports[_0x439d('0x17')]=function(_0x271a40,_0x109866){return db['SmsInteraction'][_0x439d('0x33')]({'where':{'id':_0x271a40[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x109866,null))[_0x439d('0x18')](removeEntity(_0x109866,null))[_0x439d('0x29')](handleError(_0x109866,null));};exports[_0x439d('0x37')]=function(_0x2fd898,_0x5c7269){return db[_0x439d('0x1f')][_0x439d('0x37')]()[_0x439d('0x18')](respondWithResult(_0x5c7269,null))[_0x439d('0x29')](handleError(_0x5c7269,null));};exports[_0x439d('0x38')]=function(_0x2d36e9,_0x41e36a){return db['SmsMessage'][_0x439d('0x33')]({'where':{'id':_0x2d36e9['params']['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x41e36a,null))['then'](function(_0x173e14){if(_0x173e14){return _0x173e14[_0x439d('0x38')](_0x2d36e9[_0x439d('0x35')][_0x439d('0x39')],_[_0x439d('0x3a')](_0x2d36e9[_0x439d('0x35')],['ids','id'])||{});}})['then'](respondWithResult(_0x41e36a,null))[_0x439d('0x29')](handleError(_0x41e36a,null));};exports[_0x439d('0x3b')]=function(_0x59a54d,_0x3023e1){var _0x2bd93c={'raw':![],'where':{}};var _0x3e7fbc={};var _0x5be114={'count':0x0,'rows':[]};return db[_0x439d('0x1f')][_0x439d('0x3c')]({'where':{'id':_0x59a54d[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x3023e1,null))[_0x439d('0x18')](function(_0x5db2d3){if(_0x5db2d3){_0x3e7fbc[_0x439d('0x2d')]=_[_0x439d('0x2a')](db['SmsMessage'][_0x439d('0x20')]);_0x3e7fbc[_0x439d('0x27')]=_[_0x439d('0x2a')](_0x59a54d['query']);_0x3e7fbc['filters']=_[_0x439d('0x3d')](_0x3e7fbc[_0x439d('0x2d')],_0x3e7fbc[_0x439d('0x27')]);_0x2bd93c[_0x439d('0x2c')]=_[_0x439d('0x3d')](_0x3e7fbc[_0x439d('0x2d')],qs[_0x439d('0x2e')](_0x59a54d[_0x439d('0x27')][_0x439d('0x2e')]));_0x2bd93c['attributes']=_0x2bd93c[_0x439d('0x2c')]['length']?_0x2bd93c[_0x439d('0x2c')]:_0x3e7fbc[_0x439d('0x2d')];if(!_0x59a54d[_0x439d('0x27')][_0x439d('0x3e')](_0x439d('0x3f'))){_0x2bd93c[_0x439d('0x13')]=qs['limit'](_0x59a54d['query'][_0x439d('0x13')]);_0x2bd93c[_0x439d('0x11')]=qs[_0x439d('0x11')](_0x59a54d[_0x439d('0x27')][_0x439d('0x11')]);}_0x2bd93c[_0x439d('0x40')]=qs['sort'](_0x59a54d[_0x439d('0x27')][_0x439d('0x41')]);_0x2bd93c[_0x439d('0x42')]=qs[_0x439d('0x2b')](_[_0x439d('0x43')](_0x59a54d[_0x439d('0x27')],_0x3e7fbc[_0x439d('0x2b')]));_0x2bd93c[_0x439d('0x42')][_0x439d('0x44')]=_0x5db2d3['id'];if(_0x59a54d['query'][_0x439d('0x45')]){_0x2bd93c['where']=_[_0x439d('0x31')](_0x2bd93c[_0x439d('0x42')],{'$or':_[_0x439d('0x1e')](_0x2bd93c['attributes'],function(_0x10f009){var _0x9b30e2={};_0x9b30e2[_0x10f009]={'$like':'%'+_0x59a54d[_0x439d('0x27')][_0x439d('0x45')]+'%'};return _0x9b30e2;})});}if(_0x59a54d[_0x439d('0x27')][_0x439d('0x46')]){var _0x10f68c=_0x59a54d[_0x439d('0x27')][_0x439d('0x46')][_0x439d('0x47')](',');var _0x5d54b2={};_0x5d54b2[_0x10f68c[0x0]]={'$gte':moment(_0x10f68c[0x1])[_0x439d('0x48')](_0x439d('0x49'))};_0x2bd93c[_0x439d('0x42')]=_['merge'](_0x2bd93c['where'],_0x5d54b2);}_0x2bd93c=_[_0x439d('0x31')]({},_0x2bd93c,_0x59a54d['options']);return db['SmsMessage'][_0x439d('0x14')]({'where':_0x2bd93c[_0x439d('0x42')]})[_0x439d('0x18')](function(_0x2f315f){_0x5be114[_0x439d('0x14')]=_0x2f315f;if(_0x59a54d[_0x439d('0x27')][_0x439d('0x30')]){_0x2bd93c[_0x439d('0x4a')]=[{'all':!![]}];}return db[_0x439d('0x4b')][_0x439d('0x25')](_0x2bd93c);})[_0x439d('0x18')](function(_0x2a7566){_0x5be114['rows']=_0x2a7566;return _0x5be114;});}})['then'](respondWithFilteredResult(_0x3023e1,_0x2bd93c))[_0x439d('0x29')](handleError(_0x3023e1,null));};exports[_0x439d('0x4c')]=function(_0x4c5c7e,_0x4f6bf5){return db[_0x439d('0x1f')][_0x439d('0x33')]({'where':{'id':_0x4c5c7e[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x4f6bf5,null))['then'](function(_0x4db888){if(_0x4db888){return _0x4db888[_0x439d('0x4d')](_0x4c5c7e[_0x439d('0x35')][_0x439d('0x39')],_[_0x439d('0x3a')](_0x4c5c7e[_0x439d('0x35')],[_0x439d('0x39'),'id'])||{})[_0x439d('0x4e')](function(){return db[_0x439d('0x4f')][_0x439d('0x25')]({'attributes':['id',_0x439d('0x1b'),_0x439d('0x50')],'where':{'id':_0x4c5c7e[_0x439d('0x35')][_0x439d('0x39')]}});})['then'](function(_0x33affa){socket[_0x439d('0x51')](_0x439d('0x52'),{'id':Number(_0x4c5c7e[_0x439d('0x36')]['id']),'tags':_0x33affa||[]});return{'id':Number(_0x4c5c7e['params']['id']),'tags':_0x33affa||[]};});}})[_0x439d('0x18')](respondWithResult(_0x4f6bf5,null))[_0x439d('0x29')](handleError(_0x4f6bf5,null));};exports[_0x439d('0x53')]=function(_0xff83b2,_0x80b11){return db['SmsInteraction']['find']({'where':{'id':_0xff83b2[_0x439d('0x36')]['id']}})[_0x439d('0x18')](handleEntityNotFound(_0x80b11,null))[_0x439d('0x18')](function(_0x331b18){if(_0x331b18){return _0x331b18['removeTags'](_0xff83b2[_0x439d('0x27')][_0x439d('0x39')]);}})[_0x439d('0x18')](respondWithStatusCode(_0x80b11,null))[_0x439d('0x29')](handleError(_0x80b11,null));};exports['download']=function(_0x5df129,_0x5c7c3d){var _0x1100b9=moment()[_0x439d('0x54')]()[_0x439d('0x55')]();var _0x1ff2e9=path[_0x439d('0x56')](config[_0x439d('0x57')],_0x439d('0x58'),_0x439d('0x59'),'tmp');var _0x24cd94=path[_0x439d('0x56')](_0x1ff2e9,_0x1100b9);var _0x1e8b1d=util[_0x439d('0x48')](_0x439d('0x5a'),_0x5df129[_0x439d('0x36')]['id'],_0x1100b9);var _0x15e381=path['join'](_0x1ff2e9,_0x1e8b1d);var _0xfc138=[];_0xfc138['push']({'model':db[_0x439d('0x5b')],'as':_0x439d('0x5b'),'attributes':['id','fullname'],'raw':!![]});_0xfc138['push']({'model':db[_0x439d('0x5c')],'as':_0x439d('0x5d'),'attributes':['id',_0x439d('0x5e'),_0x439d('0x5f')],'raw':!![]});var _0xf60019=[{'model':db[_0x439d('0x4b')],'as':_0x439d('0x60'),'attributes':['id',_0x439d('0x35'),_0x439d('0x61'),_0x439d('0x62'),_0x439d('0x63'),'read'],'include':_0xfc138}];_0xf60019[_0x439d('0x64')]({'model':db[_0x439d('0x65')],'as':_0x439d('0x66'),'attributes':['id',_0x439d('0x1b')]});_0xf60019[_0x439d('0x64')]({'model':db[_0x439d('0x5b')],'as':_0x439d('0x67'),'attributes':['id',_0x439d('0x68')]});return db[_0x439d('0x1f')][_0x439d('0x33')]({'where':{'id':_0x5df129['params']['id']},'include':_0xf60019})[_0x439d('0x18')](handleEntityNotFound(_0x5c7c3d,null))['then'](function(_0x118086){if(_0x118086){var _0x23f26e=_0x118086[_0x439d('0x69')]({'plain':!![]});fs['mkdirSync'](_0x24cd94);var _0xbbd92={'channel':_0x439d('0x6a'),'account':_0x23f26e[_0x439d('0x66')][_0x439d('0x1b')],'agent':_0x23f26e[_0x439d('0x67')]?_0x23f26e[_0x439d('0x67')][_0x439d('0x68')]:_0x439d('0x6b'),'createdAt':moment(_0x23f26e[_0x439d('0x61')])[_0x439d('0x48')](_0x439d('0x49'))[_0x439d('0x55')](),'closedAt':_0x23f26e[_0x439d('0x6c')]?moment(_0x23f26e[_0x439d('0x6d')])['format'](_0x439d('0x49'))[_0x439d('0x55')]():'','disposition':_0x23f26e[_0x439d('0x6e')],'messages':_(_0x23f26e[_0x439d('0x60')])[_0x439d('0x45')]({'secret':![]})['map'](function(_0x2fa3cf){return{'date':moment(_0x2fa3cf[_0x439d('0x61')])['format'](_0x439d('0x49'))[_0x439d('0x55')](),'sender':_0x2fa3cf[_0x439d('0x62')]===_0x439d('0x6f')?_0x2fa3cf[_0x439d('0x5b')]?_0x2fa3cf[_0x439d('0x5b')][_0x439d('0x68')]:_0x439d('0x70'):_0x2fa3cf[_0x439d('0x5d')]['firstName']+(_0x2fa3cf[_0x439d('0x5d')][_0x439d('0x5f')]?'\x20'+_0x2fa3cf[_0x439d('0x5d')][_0x439d('0x5f')]:''),'body':_0x2fa3cf[_0x439d('0x35')],'direction':_0x2fa3cf['direction']===_0x439d('0x6f')?'A':'C','secret':_0x2fa3cf[_0x439d('0x63')],'read':_0x2fa3cf[_0x439d('0x71')]};})[_0x439d('0x72')]()};return ejs[_0x439d('0x73')](path[_0x439d('0x56')](config[_0x439d('0x57')],_0x439d('0x58'),_0x439d('0x74'),_0x439d('0x75')),{'interaction':_0xbbd92})[_0x439d('0x18')](function(_0x5aeda0){var _0x1aacd9=path['join'](_0x24cd94,_0x439d('0x76')+_0x23f26e['id']+'-'+_0x1100b9+'.pdf');var _0x1bb4c9={'path':_0x1aacd9,'channel':_0x439d('0x6a'),'interactionId':_0x23f26e['id']};return pdf[_0x439d('0x77')](_0x5aeda0,_0x1bb4c9);})['then'](function(){return new BPromise(function(_0x138138,_0x5558e1){zipdir(_0x24cd94,{'saveTo':_0x15e381},function(_0x424054,_0x5e6f71){if(_0x424054)return _0x5558e1(_0x424054);return _0x138138(_0x5e6f71);});})['then'](function(){return new BPromise(function(_0x33a43c,_0x22585e){rimraf(_0x24cd94,function(_0x257c98){if(_0x257c98)_0x22585e(_0x257c98);return _0x33a43c();});});})['then'](function(){return _0x5c7c3d[_0x439d('0x78')](_0x15e381,_0x1e8b1d,function(_0x61327){if(_0x61327){console[_0x439d('0x79')](_0x439d('0x7a'),_0x61327);}else{fs[_0x439d('0x7b')](_0x15e381);}});});});}else{return _0x5c7c3d[_0x439d('0xe')](0xc8);}})[_0x439d('0x29')](handleError(_0x5c7c3d,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 672a6f4..477d05d 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 _0x7d25=['SmsMessage','setMaxListeners','save','update','then','setDataValue','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','SmsInteraction'];(function(_0x2d28be,_0x339c94){var _0x235041=function(_0x4ccc39){while(--_0x4ccc39){_0x2d28be['push'](_0x2d28be['shift']());}};_0x235041(++_0x339c94);}(_0x7d25,0x8a));var _0x57d2=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x7d25[_0x307d86];return _0x361745;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0x57d2('0x0'))['db'][_0x57d2('0x1')];var SmsMessage=require(_0x57d2('0x0'))['db'][_0x57d2('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x57d2('0x3')](0x0);var events={'afterCreate':_0x57d2('0x4'),'afterUpdate':_0x57d2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5337ca){return function(_0x52a4f4,_0x5dea84,_0x3c5511){_0x52a4f4['getUsers']({'attributes':['id'],'raw':!![]})[_0x57d2('0x6')](function(_0x263d35){_0x52a4f4[_0x57d2('0x7')]('Users',_0x263d35['map'](function(_0xeb8b91){return{'id':_0xeb8b91['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x52a4f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x57d2('0x6')](function(_0x5153c2){_0x52a4f4[_0x57d2('0x7')]('unreadMessages',_0x5153c2[_0x57d2('0x8')]);SmsInteractionEvents[_0x57d2('0x9')](_0x5337ca+':'+_0x52a4f4['id'],_0x52a4f4);SmsInteractionEvents[_0x57d2('0x9')](_0x5337ca,_0x52a4f4);_0x3c5511(null);})[_0x57d2('0xa')](_0x3c5511(null));};}for(var e in events){if(events[_0x57d2('0xb')](e)){var event=events[e];SmsInteraction[_0x57d2('0xc')](e,emitEvent(event));}}module[_0x57d2('0xd')]=SmsInteractionEvents; \ No newline at end of file +var _0x5464=['SmsMessage','save','remove','setDataValue','Users','map','findAll','then','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction'];(function(_0x341b9f,_0x3e2e42){var _0x3edf48=function(_0x490591){while(--_0x490591){_0x341b9f['push'](_0x341b9f['shift']());}};_0x3edf48(++_0x3e2e42);}(_0x5464,0x15d));var _0x4546=function(_0xa08ad6,_0xd503c6){_0xa08ad6=_0xa08ad6-0x0;var _0x240e2f=_0x5464[_0xa08ad6];return _0x240e2f;};'use strict';var EventEmitter=require(_0x4546('0x0'));var SmsInteraction=require(_0x4546('0x1'))['db'][_0x4546('0x2')];var SmsMessage=require('../../mysqldb')['db'][_0x4546('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x4546('0x4'),'afterUpdate':'update','afterDestroy':_0x4546('0x5')};function emitEvent(_0x396a1d){return function(_0xcc9def,_0x2b1a9b,_0x54228a){_0xcc9def['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x224c7c){_0xcc9def[_0x4546('0x6')](_0x4546('0x7'),_0x224c7c[_0x4546('0x8')](function(_0x2f0376){return{'id':_0x2f0376['id']};}));return SmsMessage[_0x4546('0x9')]({'where':{'SmsInteractionId':_0xcc9def['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4546('0xa')](function(_0x430b2e){_0xcc9def[_0x4546('0x6')]('unreadMessages',_0x430b2e[_0x4546('0xb')]);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d+':'+_0xcc9def['id'],_0xcc9def);SmsInteractionEvents[_0x4546('0xc')](_0x396a1d,_0xcc9def);_0x54228a(null);})['catch'](_0x54228a(null));};}for(var e in events){if(events[_0x4546('0xd')](e)){var event=events[e];SmsInteraction[_0x4546('0xe')](e,emitEvent(event));}}module[_0x4546('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 4839eb7..80edb13 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 _0x5444=['../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x321ddc,_0x58f72a){var _0x277f53=function(_0x3ebc0e){while(--_0x3ebc0e){_0x321ddc['push'](_0x321ddc['shift']());}};_0x277f53(++_0x58f72a);}(_0x5444,0x180));var _0x4544=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5444[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4544('0x0'));var util=require(_0x4544('0x1'));var logger=require(_0x4544('0x2'))('api');var moment=require(_0x4544('0x3'));var BPromise=require('bluebird');var rp=require(_0x4544('0x4'));var fs=require('fs');var path=require(_0x4544('0x5'));var rimraf=require(_0x4544('0x6'));var config=require(_0x4544('0x7'));var attributes=require(_0x4544('0x8'));module[_0x4544('0x9')]=function(_0x202774,_0xed5916){return _0x202774[_0x4544('0xa')]('SmsInteraction',attributes,{'tableName':_0x4544('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x57cf99,_0x1afb09,_0x5c9a92){if(_0x57cf99[_0x4544('0xc')](_0x4544('0xd'))){_0x57cf99[_0x4544('0xe')]=moment()[_0x4544('0xf')](_0x4544('0x10'));}_0x5c9a92(null,_0x57cf99);}}});}; \ No newline at end of file +var _0x8228=['./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8228,0x127));var _0x8822=function(_0x3f5fae,_0x185b5a){_0x3f5fae=_0x3f5fae-0x0;var _0x195ba3=_0x8228[_0x3f5fae];return _0x195ba3;};'use strict';var _=require(_0x8822('0x0'));var util=require('util');var logger=require(_0x8822('0x1'))(_0x8822('0x2'));var moment=require(_0x8822('0x3'));var BPromise=require(_0x8822('0x4'));var rp=require(_0x8822('0x5'));var fs=require('fs');var path=require(_0x8822('0x6'));var rimraf=require(_0x8822('0x7'));var config=require(_0x8822('0x8'));var attributes=require(_0x8822('0x9'));module[_0x8822('0xa')]=function(_0x4e7598,_0x339bbf){return _0x4e7598[_0x8822('0xb')](_0x8822('0xc'),attributes,{'tableName':_0x8822('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b0e37,_0x4dbdbc,_0x14d3ae){if(_0x3b0e37[_0x8822('0xe')](_0x8822('0xf'))){_0x3b0e37[_0x8822('0x10')]=moment()[_0x8822('0x11')](_0x8822('0x12'));}_0x14d3ae(null,_0x3b0e37);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index bfc1e65..0f899cd 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 _0x705b=['SmsInteraction,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','options','raw','where','limit','AddTagsToSmsInteraction','find','addTags','body','omit','ids','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','request','then','info'];(function(_0x13d2d5,_0x39e8be){var _0x53ffcc=function(_0x438e70){while(--_0x438e70){_0x13d2d5['push'](_0x13d2d5['shift']());}};_0x53ffcc(++_0x39e8be);}(_0x705b,0xe4));var _0xb705=function(_0x135a36,_0x2fcf5f){_0x135a36=_0x135a36-0x0;var _0x3571d3=_0x705b[_0x135a36];return _0x3571d3;};'use strict';var _=require(_0xb705('0x0'));var util=require(_0xb705('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb705('0x2'));var db=require(_0xb705('0x3'))['db'];var utils=require(_0xb705('0x4'));var logger=require(_0xb705('0x5'))('rpc');var config=require(_0xb705('0x6'));var jayson=require(_0xb705('0x7'));var client=jayson[_0xb705('0x8')][_0xb705('0x9')]({'port':0x232a});config[_0xb705('0xa')]=_[_0xb705('0xb')](config[_0xb705('0xa')],{'host':_0xb705('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb705('0xa')]));require(_0xb705('0xd'))[_0xb705('0xe')](socket);function respondWithRpcPromise(_0x5a4515,_0x4162bf,_0xf6e9a8){return new BPromise(function(_0x35727f,_0x1651fe){return client[_0xb705('0xf')](_0x5a4515,_0xf6e9a8)[_0xb705('0x10')](function(_0x504121){logger[_0xb705('0x11')](_0xb705('0x12'),_0x4162bf,'request\x20sent');logger[_0xb705('0x13')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x4162bf,_0xb705('0x14'),JSON[_0xb705('0x15')](_0x504121));if(_0x504121[_0xb705('0x16')]){if(_0x504121[_0xb705('0x16')][_0xb705('0x17')]===0x1f4){logger[_0xb705('0x16')](_0xb705('0x12'),_0x4162bf,_0x504121[_0xb705('0x16')][_0xb705('0x18')]);return _0x1651fe(_0x504121['error'][_0xb705('0x18')]);}logger['error'](_0xb705('0x12'),_0x4162bf,_0x504121[_0xb705('0x16')][_0xb705('0x18')]);return _0x35727f(_0x504121['error'][_0xb705('0x18')]);}else{logger[_0xb705('0x11')](_0xb705('0x12'),_0x4162bf,_0xb705('0x14'));_0x35727f(_0x504121[_0xb705('0x19')][_0xb705('0x18')]);}})[_0xb705('0x1a')](function(_0x152307){logger[_0xb705('0x16')](_0xb705('0x12'),_0x4162bf,_0x152307);_0x1651fe(_0x152307);});});}exports[_0xb705('0x1b')]=function(_0x4e3350){var _0x1da946=this;return new Promise(function(_0x17d37f,_0x121189){return db[_0xb705('0x1c')][_0xb705('0x1d')](_0x4e3350['body'],{'raw':_0x4e3350[_0xb705('0x1e')]?_0x4e3350[_0xb705('0x1e')][_0xb705('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e3350[_0xb705('0x1e')]?_0x4e3350[_0xb705('0x1e')][_0xb705('0x20')]||null:null,'attributes':_0x4e3350['options']?_0x4e3350[_0xb705('0x1e')]['attributes']||null:null,'limit':_0x4e3350['options']?_0x4e3350[_0xb705('0x1e')][_0xb705('0x21')]||null:null})[_0xb705('0x10')](function(_0x3f8f43){logger[_0xb705('0x11')](_0xb705('0x1b'),_0x4e3350);logger[_0xb705('0x13')](_0xb705('0x1b'),_0x4e3350,JSON[_0xb705('0x15')](_0x3f8f43));_0x17d37f(_0x3f8f43);})[_0xb705('0x1a')](function(_0x14353){logger['error'](_0xb705('0x1b'),_0x14353[_0xb705('0x18')],_0x4e3350);_0x121189(_0x1da946[_0xb705('0x16')](0x1f4,_0x14353[_0xb705('0x18')]));});});};exports[_0xb705('0x22')]=function(_0x37dc92){return new Promise(function(_0xc3279f,_0x250b03){return db[_0xb705('0x1c')][_0xb705('0x23')]({'where':_0x37dc92['options']?_0x37dc92[_0xb705('0x1e')][_0xb705('0x20')]||null:null})[_0xb705('0x10')](function(_0xf5f2be){if(_0xf5f2be){return _0xf5f2be[_0xb705('0x24')](_0x37dc92[_0xb705('0x25')]['ids'],_[_0xb705('0x26')](_0x37dc92[_0xb705('0x25')],[_0xb705('0x27'),'id'])||{});}})['spread'](function(_0x343cbc){logger[_0xb705('0x11')]('AddTags',_0x37dc92);logger['debug'](_0xb705('0x28'),_0x37dc92,JSON['stringify'](_0x343cbc));_0xc3279f(_0x343cbc);})['catch'](function(_0x1cb6be){logger[_0xb705('0x16')](_0xb705('0x28'),_0x1cb6be[_0xb705('0x18')],_0x37dc92);_0x250b03(_this['error'](0x1f4,_0x1cb6be['message']));});});}; \ No newline at end of file +var _0x6507=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','socket.io-emitter','register','request','then','info','SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','update','body','options','raw','where','UpdateSmsInteraction','SmsInteraction','omit','ids','spread','AddTags','stringify','util'];(function(_0x3a51d1,_0x148afb){var _0x3c16cf=function(_0x1020c4){while(--_0x1020c4){_0x3a51d1['push'](_0x3a51d1['shift']());}};_0x3c16cf(++_0x148afb);}(_0x6507,0x1bb));var _0x7650=function(_0x3b4359,_0x2a9330){_0x3b4359=_0x3b4359-0x0;var _0x1c16fd=_0x6507[_0x3b4359];return _0x1c16fd;};'use strict';var _=require('lodash');var util=require(_0x7650('0x0'));var moment=require(_0x7650('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7650('0x2'));var db=require(_0x7650('0x3'))['db'];var utils=require(_0x7650('0x4'));var logger=require(_0x7650('0x5'))(_0x7650('0x6'));var config=require('../../config/environment');var jayson=require(_0x7650('0x7'));var client=jayson[_0x7650('0x8')]['http']({'port':0x232a});config[_0x7650('0x9')]=_[_0x7650('0xa')](config[_0x7650('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x7650('0xb'))(new Redis(config[_0x7650('0x9')]));require('./smsInteraction.socket')[_0x7650('0xc')](socket);function respondWithRpcPromise(_0x3d78cc,_0x339468,_0x34219b){return new BPromise(function(_0x1e35c9,_0x19fbe3){return client[_0x7650('0xd')](_0x3d78cc,_0x34219b)[_0x7650('0xe')](function(_0x42bce3){logger[_0x7650('0xf')](_0x7650('0x10'),_0x339468,'request\x20sent');logger[_0x7650('0x11')](_0x7650('0x12'),_0x339468,_0x7650('0x13'),JSON['stringify'](_0x42bce3));if(_0x42bce3[_0x7650('0x14')]){if(_0x42bce3[_0x7650('0x14')][_0x7650('0x15')]===0x1f4){logger[_0x7650('0x14')](_0x7650('0x10'),_0x339468,_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);return _0x19fbe3(_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);}logger[_0x7650('0x14')](_0x7650('0x10'),_0x339468,_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);return _0x1e35c9(_0x42bce3[_0x7650('0x14')][_0x7650('0x16')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x339468,_0x7650('0x13'));_0x1e35c9(_0x42bce3[_0x7650('0x17')][_0x7650('0x16')]);}})[_0x7650('0x18')](function(_0x27fb73){logger[_0x7650('0x14')](_0x7650('0x10'),_0x339468,_0x27fb73);_0x19fbe3(_0x27fb73);});});}exports['UpdateSmsInteraction']=function(_0x3455a4){var _0x2e1d0a=this;return new Promise(function(_0x79d9be,_0x138c57){return db['SmsInteraction'][_0x7650('0x19')](_0x3455a4[_0x7650('0x1a')],{'raw':_0x3455a4['options']?_0x3455a4[_0x7650('0x1b')][_0x7650('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3455a4['options']?_0x3455a4[_0x7650('0x1b')][_0x7650('0x1d')]||null:null,'attributes':_0x3455a4[_0x7650('0x1b')]?_0x3455a4[_0x7650('0x1b')]['attributes']||null:null,'limit':_0x3455a4['options']?_0x3455a4[_0x7650('0x1b')]['limit']||null:null})[_0x7650('0xe')](function(_0x413da5){logger[_0x7650('0xf')](_0x7650('0x1e'),_0x3455a4);logger[_0x7650('0x11')]('UpdateSmsInteraction',_0x3455a4,JSON['stringify'](_0x413da5));_0x79d9be(_0x413da5);})[_0x7650('0x18')](function(_0x52ffa3){logger['error']('UpdateSmsInteraction',_0x52ffa3['message'],_0x3455a4);_0x138c57(_0x2e1d0a[_0x7650('0x14')](0x1f4,_0x52ffa3['message']));});});};exports['AddTagsToSmsInteraction']=function(_0x4f8a56){return new Promise(function(_0xee500c,_0xcbfce5){return db[_0x7650('0x1f')]['find']({'where':_0x4f8a56[_0x7650('0x1b')]?_0x4f8a56['options'][_0x7650('0x1d')]||null:null})[_0x7650('0xe')](function(_0x38dc4d){if(_0x38dc4d){return _0x38dc4d['addTags'](_0x4f8a56[_0x7650('0x1a')]['ids'],_[_0x7650('0x20')](_0x4f8a56[_0x7650('0x1a')],[_0x7650('0x21'),'id'])||{});}})[_0x7650('0x22')](function(_0x1265c8){logger[_0x7650('0xf')](_0x7650('0x23'),_0x4f8a56);logger[_0x7650('0x11')](_0x7650('0x23'),_0x4f8a56,JSON[_0x7650('0x24')](_0x1265c8));_0xee500c(_0x1265c8);})[_0x7650('0x18')](function(_0x55d989){logger[_0x7650('0x14')]('AddTags',_0x55d989['message'],_0x4f8a56);_0xcbfce5(_this[_0x7650('0x14')](0x1f4,_0x55d989[_0x7650('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 0700506..bb3cf87 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 _0x00ad=['remove','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x502ad7,_0x39a859){var _0x1e97f0=function(_0x2e41de){while(--_0x2e41de){_0x502ad7['push'](_0x502ad7['shift']());}};_0x1e97f0(++_0x39a859);}(_0x00ad,0x1cd));var _0xd00a=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x00ad[_0xf0bcac];return _0x4e4c65;};'use strict';var SmsInteractionEvents=require(_0xd00a('0x0'));var events=['save',_0xd00a('0x1'),'update'];function createListener(_0x46cd7c,_0x52f12d){return function(_0x543bc6){_0x52f12d['emit'](_0x46cd7c,_0x543bc6);};}function removeListener(_0x140b0a,_0x24960f){return function(){SmsInteractionEvents[_0xd00a('0x2')](_0x140b0a,_0x24960f);};}exports[_0xd00a('0x3')]=function(_0x3885d7){for(var _0x44abaf=0x0,_0x2ae048=events[_0xd00a('0x4')];_0x44abaf<_0x2ae048;_0x44abaf++){var _0x5888b4=events[_0x44abaf];var _0x56cc40=createListener(_0xd00a('0x5')+_0x5888b4,_0x3885d7);SmsInteractionEvents['on'](_0x5888b4,_0x56cc40);}}; \ No newline at end of file +var _0x35ba=['update','emit','removeListener','length','smsInteraction:','./smsInteraction.events','save','remove'];(function(_0x33d366,_0x12d5a2){var _0x501c15=function(_0x19fc7e){while(--_0x19fc7e){_0x33d366['push'](_0x33d366['shift']());}};_0x501c15(++_0x12d5a2);}(_0x35ba,0x1a5));var _0xa35b=function(_0x5f2098,_0x47308b){_0x5f2098=_0x5f2098-0x0;var _0x18af32=_0x35ba[_0x5f2098];return _0x18af32;};'use strict';var SmsInteractionEvents=require(_0xa35b('0x0'));var events=[_0xa35b('0x1'),_0xa35b('0x2'),_0xa35b('0x3')];function createListener(_0xb248a6,_0x338b99){return function(_0x2f20b4){_0x338b99[_0xa35b('0x4')](_0xb248a6,_0x2f20b4);};}function removeListener(_0x14f9f0,_0x349269){return function(){SmsInteractionEvents[_0xa35b('0x5')](_0x14f9f0,_0x349269);};}exports['register']=function(_0x1d4427){for(var _0x2fc4e6=0x0,_0x1da39b=events[_0xa35b('0x6')];_0x2fc4e6<_0x1da39b;_0x2fc4e6++){var _0x5c54b3=events[_0x2fc4e6];var _0x7da553=createListener(_0xa35b('0x7')+_0x5c54b3,_0x1d4427);SmsInteractionEvents['on'](_0x5c54b3,_0x7da553);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index a155888..e21788a 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 _0xfc9a=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','post','tracked','sms','/:id/status','status','put','/:id','update'];(function(_0x16f2a5,_0x43f763){var _0x523572=function(_0x2444f3){while(--_0x2444f3){_0x16f2a5['push'](_0x16f2a5['shift']());}};_0x523572(++_0x43f763);}(_0xfc9a,0x83));var _0xafc9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xfc9a[_0x432682];return _0x463d05;};'use strict';var multer=require(_0xafc9('0x0'));var util=require(_0xafc9('0x1'));var path=require(_0xafc9('0x2'));var timeout=require(_0xafc9('0x3'));var express=require(_0xafc9('0x4'));var router=express[_0xafc9('0x5')]();var fs_extra=require(_0xafc9('0x6'));var auth=require(_0xafc9('0x7'));var interaction=require(_0xafc9('0x8'));var config=require(_0xafc9('0x9'));var controller=require(_0xafc9('0xa'));router[_0xafc9('0xb')]('/',auth[_0xafc9('0xc')](),controller[_0xafc9('0xd')]);router['get'](_0xafc9('0xe'),auth[_0xafc9('0xc')](),controller[_0xafc9('0xf')]);router['get']('/:id',auth[_0xafc9('0xc')](),controller['show']);router[_0xafc9('0x10')]('/',auth[_0xafc9('0xc')](),interaction[_0xafc9('0x11')](_0xafc9('0x12'),'smsmessage:create'),controller['create']);router[_0xafc9('0x10')](_0xafc9('0x13'),controller[_0xafc9('0x14')]);router[_0xafc9('0x15')](_0xafc9('0x16'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x17')]);router['put'](_0xafc9('0x18'),auth['isAuthenticated'](),controller[_0xafc9('0x19')]);router['put'](_0xafc9('0x1a'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x1b')]);router[_0xafc9('0x1c')](_0xafc9('0x16'),auth[_0xafc9('0xc')](),controller[_0xafc9('0x1d')]);module[_0xafc9('0x1e')]=router; \ No newline at end of file +var _0x8357=['index','describe','/:id','isAuthenticated','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get'];(function(_0x2bb3f6,_0x25fde0){var _0x62b339=function(_0x53e014){while(--_0x53e014){_0x2bb3f6['push'](_0x2bb3f6['shift']());}};_0x62b339(++_0x25fde0);}(_0x8357,0x1e4));var _0x7835=function(_0x55dc46,_0x164e64){_0x55dc46=_0x55dc46-0x0;var _0x286fc7=_0x8357[_0x55dc46];return _0x286fc7;};'use strict';var multer=require(_0x7835('0x0'));var util=require(_0x7835('0x1'));var path=require(_0x7835('0x2'));var timeout=require('connect-timeout');var express=require(_0x7835('0x3'));var router=express[_0x7835('0x4')]();var fs_extra=require(_0x7835('0x5'));var auth=require(_0x7835('0x6'));var interaction=require(_0x7835('0x7'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router[_0x7835('0x8')]('/',auth['isAuthenticated'](),controller[_0x7835('0x9')]);router[_0x7835('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x7835('0xa')]);router['get'](_0x7835('0xb'),auth[_0x7835('0xc')](),controller[_0x7835('0xd')]);router[_0x7835('0xe')]('/',auth['isAuthenticated'](),interaction[_0x7835('0xf')](_0x7835('0x10'),_0x7835('0x11')),controller[_0x7835('0x12')]);router[_0x7835('0xe')](_0x7835('0x13'),controller[_0x7835('0x14')]);router['put'](_0x7835('0xb'),auth[_0x7835('0xc')](),controller[_0x7835('0x15')]);router[_0x7835('0x16')](_0x7835('0x17'),auth[_0x7835('0xc')](),controller[_0x7835('0x18')]);router[_0x7835('0x16')](_0x7835('0x19'),auth[_0x7835('0xc')](),controller[_0x7835('0x1a')]);router[_0x7835('0x1b')](_0x7835('0xb'),auth[_0x7835('0xc')](),controller['destroy']);module[_0x7835('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 54fa058..f212bff 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 _0x5ad6=['TEXT','sequelize','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0xa7dd48,_0x5e2890){var _0x22265a=function(_0x5ba345){while(--_0x5ba345){_0xa7dd48['push'](_0xa7dd48['shift']());}};_0x22265a(++_0x5e2890);}(_0x5ad6,0xfd));var _0x65ad=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x5ad6[_0x4e0b8c];return _0x633ecc;};'use strict';var Sequelize=require(_0x65ad('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x65ad('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0x65ad('0x2')]('in',_0x65ad('0x3')),'defaultValue':_0x65ad('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x65ad('0x4')](0xbe)},'phone':{'type':Sequelize[_0x65ad('0x4')]},'readAt':{'type':Sequelize[_0x65ad('0x5')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x65ad('0x6')]}}; \ No newline at end of file +var _0xd134=['ENUM','out','STRING','DATE','BOOLEAN','TEXT','sequelize','exports','medium'];(function(_0x11061c,_0x1fc7cf){var _0x42e965=function(_0x31caf9){while(--_0x31caf9){_0x11061c['push'](_0x11061c['shift']());}};_0x42e965(++_0x1fc7cf);}(_0xd134,0x1b6));var _0x4d13=function(_0x1b6186,_0x1ec7f2){_0x1b6186=_0x1b6186-0x0;var _0x186121=_0xd134[_0x1b6186];return _0x186121;};'use strict';var Sequelize=require(_0x4d13('0x0'));module[_0x4d13('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4d13('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x4d13('0x3')]('in',_0x4d13('0x4')),'defaultValue':_0x4d13('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x4d13('0x5')](0xbe)},'phone':{'type':Sequelize[_0x4d13('0x5')]},'readAt':{'type':Sequelize[_0x4d13('0x6')]},'secret':{'type':Sequelize[_0x4d13('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x4d13('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index afae3fa..594418a 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 _0x13ff=['groupName','DELIVERED','util','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','json','limit','undefined','count','offset','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','create','body','update','find','params','describe','accept','sms','acceptMessage','reject','UserId','user','agent','SmsInteraction','interaction','get','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','contact','fullname','internal','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','indexOf','delivered','infobip'];(function(_0x282f96,_0x2be4be){var _0x12d02b=function(_0x51cc9d){while(--_0x51cc9d){_0x282f96['push'](_0x282f96['shift']());}};_0x12d02b(++_0x2be4be);}(_0x13ff,0xe6));var _0xf13f=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x13ff[_0x2b10c6];return _0x3789d2;};'use strict';var util=require(_0xf13f('0x0'));var _=require('lodash');var Redis=require(_0xf13f('0x1'));var interactionService=require(_0xf13f('0x2'));var qs=require(_0xf13f('0x3'));var logger=require(_0xf13f('0x4'))(_0xf13f('0x5'));var config=require(_0xf13f('0x6'));var db=require(_0xf13f('0x7'))['db'];config['redis']=_['defaults'](config[_0xf13f('0x8')],{'host':_0xf13f('0x9'),'port':0x18eb});var socket=require(_0xf13f('0xa'))(new Redis(config[_0xf13f('0x8')]));require('./smsMessage.socket')[_0xf13f('0xb')](socket);var jayson=require(_0xf13f('0xc'));var client=jayson[_0xf13f('0xd')][_0xf13f('0xe')]({'port':0x232c});var client9002=jayson['client'][_0xf13f('0xe')]({'port':0x232a});var interaction_log=require('../../config/logger')(_0xf13f('0xf'));function respondWithRpcPromise(_0x596562,_0x53eb30,_0x3a6851,_0x3df8c3){return new Promise(function(_0x3a0039,_0xf109fa){var _0x23159a=_0x3df8c3||client;return _0x23159a[_0xf13f('0x10')](_0x596562,_0x3a6851)[_0xf13f('0x11')](function(_0xdff879){logger[_0xf13f('0x12')](_0xf13f('0x13'),_0x53eb30,'request\x20sent');logger[_0xf13f('0x14')](_0xf13f('0x15'),_0x53eb30,_0xf13f('0x16'),JSON[_0xf13f('0x17')](_0xdff879));if(_0xdff879[_0xf13f('0x18')]){if(_0xdff879[_0xf13f('0x18')][_0xf13f('0x19')]===0x1f4){logger[_0xf13f('0x18')](_0xf13f('0x13'),_0x53eb30,_0xdff879[_0xf13f('0x18')]['message']);return _0xf109fa(_0xdff879[_0xf13f('0x18')][_0xf13f('0x1a')]);}logger[_0xf13f('0x18')](_0xf13f('0x13'),_0x53eb30,_0xdff879['error'][_0xf13f('0x1a')]);return _0x3a0039(_0xdff879[_0xf13f('0x18')][_0xf13f('0x1a')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x53eb30,'request\x20sent');_0x3a0039(_0xdff879['result'][_0xf13f('0x1a')]);}})[_0xf13f('0x1b')](function(_0x22eec3){logger[_0xf13f('0x18')](_0xf13f('0x13'),_0x53eb30,_0x22eec3);_0xf109fa(_0x22eec3);});});}function respondWithResult(_0x1b09fb,_0x58293e){_0x58293e=_0x58293e||0xc8;return function(_0x446631){if(_0x446631){return _0x1b09fb[_0xf13f('0x1c')](_0x58293e)[_0xf13f('0x1d')](_0x446631);}};}function respondWithFilteredResult(_0x4c6fdc,_0xddbffa){return function(_0x474341){if(_0x474341){var _0x66c556=typeof _0xddbffa['offset']==='undefined'&&typeof _0xddbffa[_0xf13f('0x1e')]===_0xf13f('0x1f');var _0x6078b=_0x474341[_0xf13f('0x20')];var _0x5e6d96=_0x66c556?0x0:_0xddbffa[_0xf13f('0x21')];var _0x503fff=_0x66c556?_0x474341['count']:_0xddbffa[_0xf13f('0x21')]+_0xddbffa[_0xf13f('0x1e')];var _0x185bfc;if(_0x503fff>=_0x6078b){_0x503fff=_0x6078b;_0x185bfc=0xc8;}else{_0x185bfc=0xce;}_0x4c6fdc[_0xf13f('0x1c')](_0x185bfc);return _0x4c6fdc['set']('Content-Range',_0x5e6d96+'-'+_0x503fff+'/'+_0x6078b)[_0xf13f('0x1d')](_0x474341);}return null;};}function saveUpdates(_0x86d615){return function(_0x561587){if(_0x561587){return _0x561587['update'](_0x86d615)[_0xf13f('0x11')](function(_0x4d5187){return _0x4d5187;});}return null;};}function removeEntity(_0x12296a){return function(_0x2b5ee9){if(_0x2b5ee9){return _0x2b5ee9[_0xf13f('0x22')]()[_0xf13f('0x11')](function(){_0x12296a[_0xf13f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x47b864){return function(_0x2e7388){if(!_0x2e7388){_0x47b864['sendStatus'](0x194);}return _0x2e7388;};}function handleError(_0x1d307f,_0x190435){_0x190435=_0x190435||0x1f4;return function(_0x1f3508){logger[_0xf13f('0x18')](_0x1f3508[_0xf13f('0x23')]);if(_0x1f3508[_0xf13f('0x24')]){delete _0x1f3508[_0xf13f('0x24')];}_0x1d307f['status'](_0x190435)[_0xf13f('0x25')](_0x1f3508);};}exports[_0xf13f('0x26')]=function(_0x373dc6,_0x4d36ac){var _0x489e9f={},_0x42607b={},_0xa0836e={'count':0x0,'rows':[]};var _0x10cece=_[_0xf13f('0x27')](db[_0xf13f('0x28')][_0xf13f('0x29')],function(_0x30b9f0){return{'name':_0x30b9f0[_0xf13f('0x2a')],'type':_0x30b9f0['type'][_0xf13f('0x2b')]};});_0x42607b['model']=_['map'](_0x10cece,_0xf13f('0x24'));_0x42607b[_0xf13f('0x2c')]=_[_0xf13f('0x2d')](_0x373dc6[_0xf13f('0x2c')]);_0x42607b[_0xf13f('0x2e')]=_[_0xf13f('0x2f')](_0x42607b[_0xf13f('0x30')],_0x42607b[_0xf13f('0x2c')]);_0x489e9f[_0xf13f('0x31')]=_['intersection'](_0x42607b[_0xf13f('0x30')],qs[_0xf13f('0x32')](_0x373dc6[_0xf13f('0x2c')][_0xf13f('0x32')]));_0x489e9f[_0xf13f('0x31')]=_0x489e9f[_0xf13f('0x31')][_0xf13f('0x33')]?_0x489e9f[_0xf13f('0x31')]:_0x42607b[_0xf13f('0x30')];if(!_0x373dc6['query'][_0xf13f('0x34')](_0xf13f('0x35'))){_0x489e9f['limit']=qs['limit'](_0x373dc6[_0xf13f('0x2c')]['limit']);_0x489e9f[_0xf13f('0x21')]=qs[_0xf13f('0x21')](_0x373dc6[_0xf13f('0x2c')][_0xf13f('0x21')]);}_0x489e9f[_0xf13f('0x36')]=qs[_0xf13f('0x37')](_0x373dc6[_0xf13f('0x2c')]['sort']);_0x489e9f[_0xf13f('0x38')]=qs[_0xf13f('0x2e')](_[_0xf13f('0x39')](_0x373dc6['query'],_0x42607b[_0xf13f('0x2e')]),_0x10cece);if(_0x373dc6['query'][_0xf13f('0x3a')]){_0x489e9f[_0xf13f('0x38')]=_[_0xf13f('0x3b')](_0x489e9f[_0xf13f('0x38')],{'$or':_[_0xf13f('0x27')](_0x10cece,function(_0x38ca30){if(_0x38ca30[_0xf13f('0x3c')]!==_0xf13f('0x3d')){var _0x38402e={};_0x38402e[_0x38ca30[_0xf13f('0x24')]]={'$like':'%'+_0x373dc6[_0xf13f('0x2c')]['filter']+'%'};return _0x38402e;}})});}_0x489e9f=_['merge']({},_0x489e9f,_0x373dc6[_0xf13f('0x3e')]);var _0x144b9e={'where':_0x489e9f[_0xf13f('0x38')]};return db['SmsMessage'][_0xf13f('0x20')](_0x144b9e)[_0xf13f('0x11')](function(_0xbf3635){_0xa0836e['count']=_0xbf3635;if(_0x373dc6[_0xf13f('0x2c')][_0xf13f('0x3f')]){_0x489e9f[_0xf13f('0x40')]=[{'all':!![]}];}return db[_0xf13f('0x28')][_0xf13f('0x41')](_0x489e9f);})[_0xf13f('0x11')](function(_0x5da0de){_0xa0836e['rows']=_0x5da0de;return _0xa0836e;})[_0xf13f('0x11')](respondWithFilteredResult(_0x4d36ac,_0x489e9f))['catch'](handleError(_0x4d36ac,null));};exports['show']=function(_0x4104ed,_0x355271){var _0x2b6b1f={'raw':!![],'where':{'id':_0x4104ed['params']['id']}},_0x360a01={};_0x360a01['model']=_['keys'](db[_0xf13f('0x28')][_0xf13f('0x29')]);_0x360a01['query']=_[_0xf13f('0x2d')](_0x4104ed['query']);_0x360a01[_0xf13f('0x2e')]=_[_0xf13f('0x2f')](_0x360a01[_0xf13f('0x30')],_0x360a01['query']);_0x2b6b1f['attributes']=_['intersection'](_0x360a01[_0xf13f('0x30')],qs[_0xf13f('0x32')](_0x4104ed[_0xf13f('0x2c')]['fields']));_0x2b6b1f[_0xf13f('0x31')]=_0x2b6b1f[_0xf13f('0x31')][_0xf13f('0x33')]?_0x2b6b1f['attributes']:_0x360a01[_0xf13f('0x30')];if(_0x4104ed['query'][_0xf13f('0x3f')]){_0x2b6b1f['include']=[{'all':!![]}];}_0x2b6b1f=_['merge']({},_0x2b6b1f,_0x4104ed[_0xf13f('0x3e')]);return db[_0xf13f('0x28')]['find'](_0x2b6b1f)[_0xf13f('0x11')](handleEntityNotFound(_0x355271,null))['then'](respondWithResult(_0x355271,null))[_0xf13f('0x1b')](handleError(_0x355271,null));};exports[_0xf13f('0x42')]=function(_0x5ed791,_0x24b0d8){return db[_0xf13f('0x28')][_0xf13f('0x42')](_0x5ed791[_0xf13f('0x43')],{})[_0xf13f('0x11')](respondWithResult(_0x24b0d8,0xc9))['catch'](handleError(_0x24b0d8,null));};exports[_0xf13f('0x44')]=function(_0x5425a9,_0x96672a){if(_0x5425a9[_0xf13f('0x43')]['id']){delete _0x5425a9[_0xf13f('0x43')]['id'];}return db[_0xf13f('0x28')][_0xf13f('0x45')]({'where':{'id':_0x5425a9['params']['id']}})[_0xf13f('0x11')](handleEntityNotFound(_0x96672a,null))[_0xf13f('0x11')](saveUpdates(_0x5425a9['body'],null))[_0xf13f('0x11')](respondWithResult(_0x96672a,null))['catch'](handleError(_0x96672a,null));};exports[_0xf13f('0x22')]=function(_0x2aa59b,_0x1c6861){return db[_0xf13f('0x28')]['find']({'where':{'id':_0x2aa59b[_0xf13f('0x46')]['id']}})[_0xf13f('0x11')](handleEntityNotFound(_0x1c6861,null))[_0xf13f('0x11')](removeEntity(_0x1c6861,null))[_0xf13f('0x1b')](handleError(_0x1c6861,null));};exports[_0xf13f('0x47')]=function(_0x2638f1,_0x3091c2){return db[_0xf13f('0x28')][_0xf13f('0x47')]()[_0xf13f('0x11')](respondWithResult(_0x3091c2,null))[_0xf13f('0x1b')](handleError(_0x3091c2,null));};exports[_0xf13f('0x48')]=function(_0x5c0b54,_0x57a2cf){var _0x295d87=_0xf13f('0x49');return interactionService[_0xf13f('0x4a')](_0x5c0b54,_0x295d87)[_0xf13f('0x11')](respondWithResult(_0x57a2cf,null))['catch'](handleError(_0x57a2cf,null));};exports[_0xf13f('0x4b')]=function(_0x117697,_0x364976){var _0x521037={'agent':{},'channel':_0xf13f('0x49')};if(_0x117697['body']['id']){delete _0x117697[_0xf13f('0x43')]['id'];}_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')]=_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')]||_0x117697[_0xf13f('0x4d')]['id'];_0x521037[_0xf13f('0x4e')]['id']=_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')];return db[_0xf13f('0x28')][_0xf13f('0x45')]({'where':{'id':_0x117697[_0xf13f('0x46')]['id'],'UserId':null}})[_0xf13f('0x11')](handleEntityNotFound(_0x364976,null))['then'](function(_0x4f99e5){if(_0x4f99e5){_0x521037[_0xf13f('0x1a')]=_0x4f99e5['get']({'plain':!![]});return db[_0xf13f('0x4f')][_0xf13f('0x45')]({'where':{'id':_0x4f99e5['SmsInteractionId']}});}return null;})[_0xf13f('0x11')](handleEntityNotFound(_0x364976,null))[_0xf13f('0x11')](function(_0x3dae0b){if(_0x3dae0b){_0x521037[_0xf13f('0x50')]=_0x3dae0b[_0xf13f('0x51')]({'plain':!![]});interaction_log['info'](_0xf13f('0x52'),_0x117697[_0xf13f('0x4d')]['id'],_0x117697['user'][_0xf13f('0x24')],_0x117697[_0xf13f('0x4d')]['role'],_0x521037[_0xf13f('0x50')]['id'],_0x117697[_0xf13f('0x43')]?JSON[_0xf13f('0x17')](_0x117697[_0xf13f('0x43')]):_0xf13f('0x53'));return respondWithRpcPromise(_0xf13f('0x54'),_0xf13f('0x55'),_0x521037);}return null;})['then'](function(_0xd2f90e){var _0x4a8876=_0xf13f('0x56')+_0xd2f90e[_0xf13f('0x1a')][_0xf13f('0x57')];return db[_0xf13f('0x58')][_0xf13f('0x2c')](_0x4a8876,{'type':db[_0xf13f('0x59')][_0xf13f('0x5a')]['SELECT'],'raw':!![]})[_0xf13f('0x11')](function(_0x1187d6){return _0x1187d6;});})[_0xf13f('0x11')](function(_0x40b698){if(_0x40b698){_0x521037[_0xf13f('0x1a')][_0xf13f('0x5b')]=_0x40b698[0x0];if(!_0x117697[_0xf13f('0x43')][_0xf13f('0x4c')])return;return db['User'][_0xf13f('0x45')]({'where':{'id':_0x117697[_0xf13f('0x43')]['UserId'],'role':_0xf13f('0x4e')},'attributes':['id','name',_0xf13f('0x5c'),'email',_0xf13f('0x5d')],'raw':!![]});}return null;})['then'](function(_0x1c8aee){if(!_0x1c8aee)return null;_0x521037[_0xf13f('0x1a')][_0xf13f('0x4e')]=_0x1c8aee;return _0x521037;})[_0xf13f('0x11')](function(_0x2cd778){if(_0x2cd778){_0x2cd778['message']['interface']=util[_0xf13f('0x5e')](_0xf13f('0x5f'),_0x117697['user'][_0xf13f('0x24')]);_0x2cd778[_0xf13f('0x1a')]['channel']=_0x521037[_0xf13f('0x60')];_0x2cd778[_0xf13f('0x1a')][_0xf13f('0x61')]=_0x521037[_0xf13f('0x60')];_0x2cd778[_0xf13f('0x1a')]['event']=_0xf13f('0x4b');respondWithRpcPromise(_0xf13f('0x62'),_0xf13f('0x62'),{'event':_0xf13f('0x63'),'message':_0x2cd778[_0xf13f('0x1a')]},client9002);return _0x521037;}return null;})[_0xf13f('0x11')](respondWithResult(_0x364976,null))[_0xf13f('0x1b')](handleError(_0x364976,null));};exports[_0xf13f('0x1c')]=function(_0x24de21,_0x1c6d52){if(_0x24de21[_0xf13f('0x43')]['id']){delete _0x24de21[_0xf13f('0x43')]['id'];}var _0x580bff;return db['SmsMessage'][_0xf13f('0x45')]({'where':{'id':_0x24de21['params']['id']}})[_0xf13f('0x11')](handleEntityNotFound(_0x1c6d52,null))['then'](function(_0x5d8e13){if(_0x5d8e13){_0x580bff=_0x5d8e13;return db[_0xf13f('0x64')]['find']({'where':{'id':_0x5d8e13[_0xf13f('0x65')]}});}})['then'](handleEntityNotFound(_0x1c6d52,null))[_0xf13f('0x11')](function(_0x4ea6f8){if(_0x4ea6f8){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xf13f('0x66'),_0x4ea6f8[_0xf13f('0x3c')],util[_0xf13f('0x67')](_0x24de21[_0xf13f('0x43')],{'showHidden':![],'depth':null}));switch(_0x4ea6f8[_0xf13f('0x3c')]){case'twilio':if(_0x24de21[_0xf13f('0x43')]['MessageSid']&&_0x24de21[_0xf13f('0x43')][_0xf13f('0x68')]===_0x580bff[_0xf13f('0x69')]){return _0x580bff[_0xf13f('0x44')]({'read':!![]});}else{logger[_0xf13f('0x18')](_0xf13f('0x6a'),_0xf13f('0x1c'),'twilio',util[_0xf13f('0x67')](_0x24de21['body'],{'showHidden':![],'depth':null}));}break;case _0xf13f('0x6b'):if(_0x24de21[_0xf13f('0x43')][_0xf13f('0x6c')]&&_0x24de21[_0xf13f('0x43')][_0xf13f('0x6c')]===_0x580bff['messageId']&&_[_0xf13f('0x6d')](['sent',_0xf13f('0x6e')],_0x24de21[_0xf13f('0x43')]['Status'])>=0x0){return _0x580bff[_0xf13f('0x44')]({'read':!![]});}else{logger['error'](_0xf13f('0x6a'),'status','plivio',util[_0xf13f('0x67')](_0x24de21['body'],{'showHidden':![],'depth':null}));}break;case _0xf13f('0x6f'):var _0x4fd9e3=_0x24de21[_0xf13f('0x43')]['results'][0x0];if(_0x4fd9e3[_0xf13f('0x1c')][_0xf13f('0x70')]===_0xf13f('0x71')){return _0x580bff[_0xf13f('0x44')]({'read':!![]});}else{logger[_0xf13f('0x18')](_0xf13f('0x6a'),'status',_0xf13f('0x6f'),util[_0xf13f('0x67')](_0x24de21['body'],{'showHidden':![],'depth':null}));}break;}return _0x580bff;}})[_0xf13f('0x11')](respondWithResult(_0x1c6d52,null))['catch'](handleError(_0x1c6d52,null));}; \ No newline at end of file +var _0xd2c7=['SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','format','SIP/%s','channel','motionChannel','EventManager','rejectmessage','SmsAccount','SmsAccountId','debug','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','plivio','infobip','results','groupName','lodash','../../components/interaction/service','api','../../config/environment','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','../../config/logger','sms-interactions','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','error','code','message','catch','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','end','sendStatus','stack','map','SmsMessage','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','name','options','includeAll','include','findAll','rows','show','params','keys','find','body','describe','accept','sms','reject','UserId','agent','get','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','stringify','null','rejectMessage'];(function(_0x31ab90,_0x145a96){var _0x2d6123=function(_0x2bf73f){while(--_0x2bf73f){_0x31ab90['push'](_0x31ab90['shift']());}};_0x2d6123(++_0x145a96);}(_0xd2c7,0x1e5));var _0x7d2c=function(_0x51f9a1,_0x181d54){_0x51f9a1=_0x51f9a1-0x0;var _0x14b1d3=_0xd2c7[_0x51f9a1];return _0x14b1d3;};'use strict';var util=require('util');var _=require(_0x7d2c('0x0'));var Redis=require('ioredis');var interactionService=require(_0x7d2c('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x7d2c('0x2'));var config=require(_0x7d2c('0x3'));var db=require('../../mysqldb')['db'];config[_0x7d2c('0x4')]=_['defaults'](config[_0x7d2c('0x4')],{'host':_0x7d2c('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d2c('0x4')]));require(_0x7d2c('0x6'))[_0x7d2c('0x7')](socket);var jayson=require(_0x7d2c('0x8'));var client=jayson[_0x7d2c('0x9')][_0x7d2c('0xa')]({'port':0x232c});var client9002=jayson['client'][_0x7d2c('0xa')]({'port':0x232a});var interaction_log=require(_0x7d2c('0xb'))(_0x7d2c('0xc'));function respondWithRpcPromise(_0x2f0e78,_0xc1fc71,_0x5414db,_0x3427d0){return new Promise(function(_0x4d7de8,_0x18b01a){var _0x50741a=_0x3427d0||client;return _0x50741a[_0x7d2c('0xd')](_0x2f0e78,_0x5414db)[_0x7d2c('0xe')](function(_0x3cd94a){logger[_0x7d2c('0xf')](_0x7d2c('0x10'),_0xc1fc71,'request\x20sent');logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xc1fc71,_0x7d2c('0x11'),JSON['stringify'](_0x3cd94a));if(_0x3cd94a[_0x7d2c('0x12')]){if(_0x3cd94a[_0x7d2c('0x12')][_0x7d2c('0x13')]===0x1f4){logger['error'](_0x7d2c('0x10'),_0xc1fc71,_0x3cd94a['error'][_0x7d2c('0x14')]);return _0x18b01a(_0x3cd94a['error'][_0x7d2c('0x14')]);}logger['error'](_0x7d2c('0x10'),_0xc1fc71,_0x3cd94a[_0x7d2c('0x12')][_0x7d2c('0x14')]);return _0x4d7de8(_0x3cd94a[_0x7d2c('0x12')][_0x7d2c('0x14')]);}else{logger[_0x7d2c('0xf')]('SmsMessage,\x20%s,\x20%s',_0xc1fc71,_0x7d2c('0x11'));_0x4d7de8(_0x3cd94a['result'][_0x7d2c('0x14')]);}})[_0x7d2c('0x15')](function(_0x5aab39){logger[_0x7d2c('0x12')](_0x7d2c('0x10'),_0xc1fc71,_0x5aab39);_0x18b01a(_0x5aab39);});});}function respondWithResult(_0x1a485d,_0x39d1cf){_0x39d1cf=_0x39d1cf||0xc8;return function(_0x200e09){if(_0x200e09){return _0x1a485d[_0x7d2c('0x16')](_0x39d1cf)[_0x7d2c('0x17')](_0x200e09);}};}function respondWithFilteredResult(_0x34606c,_0x53a2a6){return function(_0x529302){if(_0x529302){var _0x5e2c3a=typeof _0x53a2a6[_0x7d2c('0x18')]===_0x7d2c('0x19')&&typeof _0x53a2a6[_0x7d2c('0x1a')]===_0x7d2c('0x19');var _0x13c343=_0x529302[_0x7d2c('0x1b')];var _0x1655fd=_0x5e2c3a?0x0:_0x53a2a6[_0x7d2c('0x18')];var _0x434b1d=_0x5e2c3a?_0x529302['count']:_0x53a2a6['offset']+_0x53a2a6[_0x7d2c('0x1a')];var _0x525c2a;if(_0x434b1d>=_0x13c343){_0x434b1d=_0x13c343;_0x525c2a=0xc8;}else{_0x525c2a=0xce;}_0x34606c[_0x7d2c('0x16')](_0x525c2a);return _0x34606c[_0x7d2c('0x1c')](_0x7d2c('0x1d'),_0x1655fd+'-'+_0x434b1d+'/'+_0x13c343)['json'](_0x529302);}return null;};}function saveUpdates(_0x3aee36){return function(_0x526bd5){if(_0x526bd5){return _0x526bd5[_0x7d2c('0x1e')](_0x3aee36)[_0x7d2c('0xe')](function(_0x4a690e){return _0x4a690e;});}return null;};}function removeEntity(_0x4e4027){return function(_0xd89f31){if(_0xd89f31){return _0xd89f31[_0x7d2c('0x1f')]()['then'](function(){_0x4e4027['status'](0xcc)[_0x7d2c('0x20')]();});}};}function handleEntityNotFound(_0x5a0160){return function(_0x8101b9){if(!_0x8101b9){_0x5a0160[_0x7d2c('0x21')](0x194);}return _0x8101b9;};}function handleError(_0x2e75e5,_0x2fd96a){_0x2fd96a=_0x2fd96a||0x1f4;return function(_0xce4f7c){logger[_0x7d2c('0x12')](_0xce4f7c[_0x7d2c('0x22')]);if(_0xce4f7c['name']){delete _0xce4f7c['name'];}_0x2e75e5[_0x7d2c('0x16')](_0x2fd96a)['send'](_0xce4f7c);};}exports['index']=function(_0x2b39a4,_0x47783d){var _0x5935ea={},_0x3a4e31={},_0x25cc7b={'count':0x0,'rows':[]};var _0x3c19c0=_[_0x7d2c('0x23')](db[_0x7d2c('0x24')]['rawAttributes'],function(_0xe3c7ee){return{'name':_0xe3c7ee[_0x7d2c('0x25')],'type':_0xe3c7ee[_0x7d2c('0x26')][_0x7d2c('0x27')]};});_0x3a4e31['model']=_[_0x7d2c('0x23')](_0x3c19c0,'name');_0x3a4e31[_0x7d2c('0x28')]=_['keys'](_0x2b39a4[_0x7d2c('0x28')]);_0x3a4e31[_0x7d2c('0x29')]=_['intersection'](_0x3a4e31[_0x7d2c('0x2a')],_0x3a4e31['query']);_0x5935ea[_0x7d2c('0x2b')]=_[_0x7d2c('0x2c')](_0x3a4e31[_0x7d2c('0x2a')],qs[_0x7d2c('0x2d')](_0x2b39a4[_0x7d2c('0x28')]['fields']));_0x5935ea[_0x7d2c('0x2b')]=_0x5935ea['attributes'][_0x7d2c('0x2e')]?_0x5935ea[_0x7d2c('0x2b')]:_0x3a4e31[_0x7d2c('0x2a')];if(!_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x2f')](_0x7d2c('0x30'))){_0x5935ea[_0x7d2c('0x1a')]=qs[_0x7d2c('0x1a')](_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x1a')]);_0x5935ea[_0x7d2c('0x18')]=qs[_0x7d2c('0x18')](_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x18')]);}_0x5935ea[_0x7d2c('0x31')]=qs[_0x7d2c('0x32')](_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x32')]);_0x5935ea[_0x7d2c('0x33')]=qs[_0x7d2c('0x29')](_[_0x7d2c('0x34')](_0x2b39a4[_0x7d2c('0x28')],_0x3a4e31[_0x7d2c('0x29')]),_0x3c19c0);if(_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x35')]){_0x5935ea[_0x7d2c('0x33')]=_[_0x7d2c('0x36')](_0x5935ea[_0x7d2c('0x33')],{'$or':_[_0x7d2c('0x23')](_0x3c19c0,function(_0x5b8280){if(_0x5b8280['type']!==_0x7d2c('0x37')){var _0x601d53={};_0x601d53[_0x5b8280[_0x7d2c('0x38')]]={'$like':'%'+_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x35')]+'%'};return _0x601d53;}})});}_0x5935ea=_[_0x7d2c('0x36')]({},_0x5935ea,_0x2b39a4[_0x7d2c('0x39')]);var _0xe3c4de={'where':_0x5935ea[_0x7d2c('0x33')]};return db[_0x7d2c('0x24')]['count'](_0xe3c4de)[_0x7d2c('0xe')](function(_0x4ad14b){_0x25cc7b[_0x7d2c('0x1b')]=_0x4ad14b;if(_0x2b39a4[_0x7d2c('0x28')][_0x7d2c('0x3a')]){_0x5935ea[_0x7d2c('0x3b')]=[{'all':!![]}];}return db['SmsMessage'][_0x7d2c('0x3c')](_0x5935ea);})[_0x7d2c('0xe')](function(_0x1c1f2a){_0x25cc7b[_0x7d2c('0x3d')]=_0x1c1f2a;return _0x25cc7b;})[_0x7d2c('0xe')](respondWithFilteredResult(_0x47783d,_0x5935ea))[_0x7d2c('0x15')](handleError(_0x47783d,null));};exports[_0x7d2c('0x3e')]=function(_0x2bf8ef,_0x134ad3){var _0x501f15={'raw':!![],'where':{'id':_0x2bf8ef[_0x7d2c('0x3f')]['id']}},_0x49f27f={};_0x49f27f['model']=_[_0x7d2c('0x40')](db[_0x7d2c('0x24')]['rawAttributes']);_0x49f27f[_0x7d2c('0x28')]=_[_0x7d2c('0x40')](_0x2bf8ef['query']);_0x49f27f[_0x7d2c('0x29')]=_[_0x7d2c('0x2c')](_0x49f27f[_0x7d2c('0x2a')],_0x49f27f['query']);_0x501f15['attributes']=_['intersection'](_0x49f27f[_0x7d2c('0x2a')],qs[_0x7d2c('0x2d')](_0x2bf8ef[_0x7d2c('0x28')][_0x7d2c('0x2d')]));_0x501f15[_0x7d2c('0x2b')]=_0x501f15[_0x7d2c('0x2b')][_0x7d2c('0x2e')]?_0x501f15[_0x7d2c('0x2b')]:_0x49f27f[_0x7d2c('0x2a')];if(_0x2bf8ef['query'][_0x7d2c('0x3a')]){_0x501f15[_0x7d2c('0x3b')]=[{'all':!![]}];}_0x501f15=_[_0x7d2c('0x36')]({},_0x501f15,_0x2bf8ef['options']);return db[_0x7d2c('0x24')][_0x7d2c('0x41')](_0x501f15)[_0x7d2c('0xe')](handleEntityNotFound(_0x134ad3,null))[_0x7d2c('0xe')](respondWithResult(_0x134ad3,null))['catch'](handleError(_0x134ad3,null));};exports['create']=function(_0xe3c641,_0x232642){return db[_0x7d2c('0x24')]['create'](_0xe3c641[_0x7d2c('0x42')],{})[_0x7d2c('0xe')](respondWithResult(_0x232642,0xc9))[_0x7d2c('0x15')](handleError(_0x232642,null));};exports[_0x7d2c('0x1e')]=function(_0x108325,_0x22c088){if(_0x108325[_0x7d2c('0x42')]['id']){delete _0x108325[_0x7d2c('0x42')]['id'];}return db[_0x7d2c('0x24')][_0x7d2c('0x41')]({'where':{'id':_0x108325[_0x7d2c('0x3f')]['id']}})[_0x7d2c('0xe')](handleEntityNotFound(_0x22c088,null))[_0x7d2c('0xe')](saveUpdates(_0x108325[_0x7d2c('0x42')],null))['then'](respondWithResult(_0x22c088,null))[_0x7d2c('0x15')](handleError(_0x22c088,null));};exports[_0x7d2c('0x1f')]=function(_0xd1550d,_0x528797){return db[_0x7d2c('0x24')][_0x7d2c('0x41')]({'where':{'id':_0xd1550d['params']['id']}})[_0x7d2c('0xe')](handleEntityNotFound(_0x528797,null))[_0x7d2c('0xe')](removeEntity(_0x528797,null))[_0x7d2c('0x15')](handleError(_0x528797,null));};exports[_0x7d2c('0x43')]=function(_0x3f6bb6,_0x2a613e){return db[_0x7d2c('0x24')]['describe']()['then'](respondWithResult(_0x2a613e,null))['catch'](handleError(_0x2a613e,null));};exports[_0x7d2c('0x44')]=function(_0x2daca6,_0x2a0866){var _0x31027d=_0x7d2c('0x45');return interactionService['acceptMessage'](_0x2daca6,_0x31027d)[_0x7d2c('0xe')](respondWithResult(_0x2a0866,null))['catch'](handleError(_0x2a0866,null));};exports[_0x7d2c('0x46')]=function(_0x7ba8a3,_0x494fae){var _0x3301fc={'agent':{},'channel':_0x7d2c('0x45')};if(_0x7ba8a3[_0x7d2c('0x42')]['id']){delete _0x7ba8a3['body']['id'];}_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')]=_0x7ba8a3['body']['UserId']||_0x7ba8a3['user']['id'];_0x3301fc[_0x7d2c('0x48')]['id']=_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')];return db[_0x7d2c('0x24')]['find']({'where':{'id':_0x7ba8a3[_0x7d2c('0x3f')]['id'],'UserId':null}})[_0x7d2c('0xe')](handleEntityNotFound(_0x494fae,null))[_0x7d2c('0xe')](function(_0x344a8b){if(_0x344a8b){_0x3301fc[_0x7d2c('0x14')]=_0x344a8b[_0x7d2c('0x49')]({'plain':!![]});return db[_0x7d2c('0x4a')][_0x7d2c('0x41')]({'where':{'id':_0x344a8b['SmsInteractionId']}});}return null;})[_0x7d2c('0xe')](handleEntityNotFound(_0x494fae,null))[_0x7d2c('0xe')](function(_0x2c0dd2){if(_0x2c0dd2){_0x3301fc['interaction']=_0x2c0dd2[_0x7d2c('0x49')]({'plain':!![]});interaction_log['info'](_0x7d2c('0x4b'),_0x7ba8a3[_0x7d2c('0x4c')]['id'],_0x7ba8a3['user']['name'],_0x7ba8a3[_0x7d2c('0x4c')]['role'],_0x3301fc['interaction']['id'],_0x7ba8a3['body']?JSON[_0x7d2c('0x4d')](_0x7ba8a3[_0x7d2c('0x42')]):_0x7d2c('0x4e'));return respondWithRpcPromise('RejectMessage',_0x7d2c('0x4f'),_0x3301fc);}return null;})['then'](function(_0x22d2b3){var _0xcde4b5=_0x7d2c('0x50')+_0x22d2b3[_0x7d2c('0x14')][_0x7d2c('0x51')];return db[_0x7d2c('0x52')]['query'](_0xcde4b5,{'type':db[_0x7d2c('0x53')][_0x7d2c('0x54')][_0x7d2c('0x55')],'raw':!![]})[_0x7d2c('0xe')](function(_0x296765){return _0x296765;});})['then'](function(_0x1a2546){if(_0x1a2546){_0x3301fc[_0x7d2c('0x14')][_0x7d2c('0x56')]=_0x1a2546[0x0];if(!_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')])return;return db[_0x7d2c('0x57')][_0x7d2c('0x41')]({'where':{'id':_0x7ba8a3[_0x7d2c('0x42')][_0x7d2c('0x47')],'role':'agent'},'attributes':['id','name',_0x7d2c('0x58'),_0x7d2c('0x59'),_0x7d2c('0x5a')],'raw':!![]});}return null;})['then'](function(_0x198326){if(!_0x198326)return null;_0x3301fc[_0x7d2c('0x14')][_0x7d2c('0x48')]=_0x198326;return _0x3301fc;})[_0x7d2c('0xe')](function(_0x26ada3){if(_0x26ada3){_0x26ada3[_0x7d2c('0x14')]['interface']=util[_0x7d2c('0x5b')](_0x7d2c('0x5c'),_0x7ba8a3[_0x7d2c('0x4c')][_0x7d2c('0x38')]);_0x26ada3['message'][_0x7d2c('0x5d')]=_0x3301fc['channel'];_0x26ada3[_0x7d2c('0x14')][_0x7d2c('0x5e')]=_0x3301fc[_0x7d2c('0x5d')];_0x26ada3[_0x7d2c('0x14')]['event']=_0x7d2c('0x46');respondWithRpcPromise(_0x7d2c('0x5f'),'EventManager',{'event':_0x7d2c('0x60'),'message':_0x26ada3[_0x7d2c('0x14')]},client9002);return _0x3301fc;}return null;})[_0x7d2c('0xe')](respondWithResult(_0x494fae,null))[_0x7d2c('0x15')](handleError(_0x494fae,null));};exports[_0x7d2c('0x16')]=function(_0x594925,_0x495859){if(_0x594925[_0x7d2c('0x42')]['id']){delete _0x594925['body']['id'];}var _0x480c36;return db[_0x7d2c('0x24')]['find']({'where':{'id':_0x594925[_0x7d2c('0x3f')]['id']}})['then'](handleEntityNotFound(_0x495859,null))[_0x7d2c('0xe')](function(_0x26a934){if(_0x26a934){_0x480c36=_0x26a934;return db[_0x7d2c('0x61')][_0x7d2c('0x41')]({'where':{'id':_0x26a934[_0x7d2c('0x62')]}});}})[_0x7d2c('0xe')](handleEntityNotFound(_0x495859,null))[_0x7d2c('0xe')](function(_0x2da7b2){if(_0x2da7b2){logger[_0x7d2c('0x63')](_0x7d2c('0x64'),'status',_0x7d2c('0x65'),_0x2da7b2[_0x7d2c('0x26')],util[_0x7d2c('0x66')](_0x594925[_0x7d2c('0x42')],{'showHidden':![],'depth':null}));switch(_0x2da7b2['type']){case _0x7d2c('0x67'):if(_0x594925[_0x7d2c('0x42')][_0x7d2c('0x68')]&&_0x594925[_0x7d2c('0x42')][_0x7d2c('0x68')]===_0x480c36[_0x7d2c('0x69')]){return _0x480c36[_0x7d2c('0x1e')]({'read':!![]});}else{logger[_0x7d2c('0x12')](_0x7d2c('0x6a'),_0x7d2c('0x16'),_0x7d2c('0x67'),util['inspect'](_0x594925['body'],{'showHidden':![],'depth':null}));}break;case _0x7d2c('0x6b'):if(_0x594925[_0x7d2c('0x42')]['MessageUUID']&&_0x594925[_0x7d2c('0x42')][_0x7d2c('0x6c')]===_0x480c36[_0x7d2c('0x69')]&&_['indexOf'](['sent','delivered'],_0x594925[_0x7d2c('0x42')]['Status'])>=0x0){return _0x480c36[_0x7d2c('0x1e')]({'read':!![]});}else{logger[_0x7d2c('0x12')](_0x7d2c('0x6a'),'status',_0x7d2c('0x6d'),util['inspect'](_0x594925[_0x7d2c('0x42')],{'showHidden':![],'depth':null}));}break;case _0x7d2c('0x6e'):var _0x60247c=_0x594925[_0x7d2c('0x42')][_0x7d2c('0x6f')][0x0];if(_0x60247c[_0x7d2c('0x16')][_0x7d2c('0x70')]==='DELIVERED'){return _0x480c36[_0x7d2c('0x1e')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','infobip',util[_0x7d2c('0x66')](_0x594925[_0x7d2c('0x42')],{'showHidden':![],'depth':null}));}break;}return _0x480c36;}})['then'](respondWithResult(_0x495859,null))[_0x7d2c('0x15')](handleError(_0x495859,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 7f44c6e..133682b 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 _0x228e=['hook','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x1473b0,_0x18cdcf){var _0x1b901d=function(_0x19c3bf){while(--_0x19c3bf){_0x1473b0['push'](_0x1473b0['shift']());}};_0x1b901d(++_0x18cdcf);}(_0x228e,0x64));var _0xe228=function(_0xafc1cf,_0x1eac9f){_0xafc1cf=_0xafc1cf-0x0;var _0x3dfe53=_0x228e[_0xafc1cf];return _0x3dfe53;};'use strict';var EventEmitter=require(_0xe228('0x0'));var SmsMessage=require(_0xe228('0x1'))['db'][_0xe228('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xe228('0x3')](0x0);var events={'afterCreate':_0xe228('0x4'),'afterUpdate':_0xe228('0x5'),'afterDestroy':'remove'};function emitEvent(_0x36b0d7){return function(_0x2271a8,_0x1aac24,_0x3e5b93){SmsMessageEvents['emit'](_0x36b0d7+':'+_0x2271a8['id'],_0x2271a8);SmsMessageEvents[_0xe228('0x6')](_0x36b0d7,_0x2271a8);_0x3e5b93(null);};}for(var e in events){if(events[_0xe228('0x7')](e)){var event=events[e];SmsMessage[_0xe228('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file +var _0x59ab=['SmsMessage','setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0xd20f56,_0x4289bf){var _0x366917=function(_0x46b37c){while(--_0x46b37c){_0xd20f56['push'](_0xd20f56['shift']());}};_0x366917(++_0x4289bf);}(_0x59ab,0x16f));var _0xb59a=function(_0x57ae68,_0x1edcf3){_0x57ae68=_0x57ae68-0x0;var _0x45f81b=_0x59ab[_0x57ae68];return _0x45f81b;};'use strict';var EventEmitter=require(_0xb59a('0x0'));var SmsMessage=require(_0xb59a('0x1'))['db'][_0xb59a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xb59a('0x3')](0x0);var events={'afterCreate':_0xb59a('0x4'),'afterUpdate':_0xb59a('0x5'),'afterDestroy':_0xb59a('0x6')};function emitEvent(_0x2c4fb6){return function(_0x319aac,_0x4b37b5,_0x58b4d6){SmsMessageEvents['emit'](_0x2c4fb6+':'+_0x319aac['id'],_0x319aac);SmsMessageEvents[_0xb59a('0x7')](_0x2c4fb6,_0x319aac);_0x58b4d6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0xb59a('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 f67f6e8..c0d9a34 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 _0xabd6=['catch','error','find','then','type','twilio','accountSid','authToken','phone','messages','create','remote','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','sms','POST','user_key','session_key','internal_order_id','deliveryReport','read','skebby','Missing\x20parameters:\x20username,\x20password','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','Missing\x20parameters:\x20authToken','clicksend','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','/api/sms/messages/','%s:%s','base64','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','keys','createHash','md5','digest','hex','signature=','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','intelepeer','application/json','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','refid','status','Token\x20not\x20received','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','isNil','findOne','SmsInteractionId','update','createdAt'];(function(_0x2f37e0,_0x393ef9){var _0x43ccce=function(_0x318b51){while(--_0x318b51){_0x2f37e0['push'](_0x2f37e0['shift']());}};_0x43ccce(++_0x393ef9);}(_0xabd6,0x155));var _0x6abd=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xabd6[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x6abd('0x0'));var util=require(_0x6abd('0x1'));var logger=require(_0x6abd('0x2'))(_0x6abd('0x3'));var moment=require(_0x6abd('0x4'));var BPromise=require(_0x6abd('0x5'));var rp=require(_0x6abd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6abd('0x7'));var config=require('../../config/environment');var attributes=require(_0x6abd('0x8'));module[_0x6abd('0x9')]=function(_0x37b7e0,_0x3b1c7c){return _0x37b7e0[_0x6abd('0xa')](_0x6abd('0xb'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x6abd('0xc'),'fields':['messageId']},{'name':_0x6abd('0xd'),'fields':[_0x6abd('0xe')],'type':_0x6abd('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x39dd88,_0x228a14,_0xbd446){var _0x4cb8de=_0x37b7e0[_0x6abd('0x10')];var _0x2fe6ac=_0x39dd88[_0x6abd('0x11')]({'plain':!![]});if(_0x2fe6ac[_0x6abd('0x12')][_0x6abd('0x13')]()==='in'||_0x2fe6ac[_0x6abd('0x12')]['toLowerCase']()===_0x6abd('0x14')&&!_0x2fe6ac[_0x6abd('0x15')]&&!_['isNil'](_0x2fe6ac[_0x6abd('0x16')])&&!_[_0x6abd('0x17')](_0x2fe6ac['SmsInteractionId'])){_0x4cb8de['SmsInteraction'][_0x6abd('0x18')]({'where':{'id':_0x2fe6ac[_0x6abd('0x19')]}})['then'](function(_0x3df45c){if(_0x3df45c){_0x3df45c[_0x6abd('0x1a')]({'lastMsgAt':_0x2fe6ac[_0x6abd('0x1b')],'lastMsgDirection':_0x2fe6ac[_0x6abd('0x12')][_0x6abd('0x13')]()});}})[_0x6abd('0x1c')](function(_0x585186){console[_0x6abd('0x1d')](_0x585186);});}if(_0x2fe6ac[_0x6abd('0x12')]===_0x6abd('0x14')&&!_0x2fe6ac[_0x6abd('0x15')]){var _0x3f41f9;_0x4cb8de['SmsAccount'][_0x6abd('0x1e')]({'where':{'id':_0x2fe6ac['SmsAccountId']},'raw':!![]})[_0x6abd('0x1f')](function(_0xc28daa){_0x3f41f9=_0xc28daa;if(_0x3f41f9&&_0x3f41f9['type']){switch(_0x3f41f9[_0x6abd('0x20')]){case _0x6abd('0x21'):var _0x2995=require(_0x6abd('0x21'));if(_0x3f41f9[_0x6abd('0x22')]&&_0x3f41f9[_0x6abd('0x23')]&&_0x3f41f9[_0x6abd('0x24')]){var _0x263e26=new _0x2995(_0x3f41f9[_0x6abd('0x22')],_0x3f41f9['authToken']);_0x263e26[_0x6abd('0x25')][_0x6abd('0x26')]({'body':_0x2fe6ac[_0x6abd('0xe')],'to':_0x2fe6ac['phone'],'from':_0x3f41f9[_0x6abd('0x24')],'statusCallback':_0x3f41f9[_0x6abd('0x27')]+'/api/sms/messages/'+_0x2fe6ac['id']+_0x6abd('0x28')+_0x3f41f9[_0x6abd('0x29')]})[_0x6abd('0x1f')](function(_0x1bf86d){if(_0x1bf86d[_0x6abd('0x2a')]){return _0x39dd88[_0x6abd('0x1a')]({'messageId':_0x1bf86d[_0x6abd('0x2a')]});}})[_0x6abd('0x1c')](function(_0x1729dc){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),'twilio',util[_0x6abd('0x2d')](_0x1729dc,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),'twilio',_0x6abd('0x2e'));}break;case'skebby':var _0x1a2f61=_0x6abd('0x2f');if(_0x3f41f9[_0x6abd('0x30')]&&_0x3f41f9[_0x6abd('0x31')]){var _0x292153={'recipient':[_0x2fe6ac[_0x6abd('0x24')]],'message':_0x2fe6ac[_0x6abd('0xe')],'message_type':_0x3f41f9[_0x6abd('0x32')]};if(_0x3f41f9[_0x6abd('0x32')]&&_0x3f41f9[_0x6abd('0x32')]!=='SI'){_0x292153['sender']=_0x3f41f9[_0x6abd('0x24')];}var _0x25fb43={'url':_0x1a2f61+_0x6abd('0x33')+_0x3f41f9['username']+_0x6abd('0x34')+_0x3f41f9[_0x6abd('0x31')],'method':_0x6abd('0x35')};rp(_0x25fb43)['then'](function(_0x1ee773){var _0x1e8ad4=_0x1ee773['split'](';');var _0x315865={'user_key':_0x1e8ad4[0x0],'session_key':_0x1e8ad4[0x1]};_0x25fb43={'url':_0x1a2f61+_0x6abd('0x36'),'method':_0x6abd('0x37'),'headers':{'user_key':_0x315865[_0x6abd('0x38')],'Session_key':_0x315865[_0x6abd('0x39')]},'json':!![],'body':_0x292153};return rp(_0x25fb43);})[_0x6abd('0x1f')](function(_0x4c2fa1){if(_0x4c2fa1['total_sent']>=0x1){var _0x1add52={'messageId':_0x4c2fa1[_0x6abd('0x3a')]};if(_0x3f41f9['smsMethod']!=='GP'||!_0x3f41f9[_0x6abd('0x3b')]){_0x1add52[_0x6abd('0x3c')]=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x1add52);}else{return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate','skebby',util['inspect'](_0x4c2fa1,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x1d34f1){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x3d'),util['inspect'](_0x1d34f1,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x3d'),_0x6abd('0x3e'));}break;case'connectel':if(_0x3f41f9['authToken']){var _0x319709={'recipient':_0x2fe6ac[_0x6abd('0x24')],'message':_0x2fe6ac[_0x6abd('0xe')],'sender':_0x3f41f9['senderString']||_0x3f41f9[_0x6abd('0x24')],'authorization':_0x3f41f9[_0x6abd('0x23')]};var _0x228a14={'method':_0x6abd('0x37'),'uri':_0x6abd('0x3f'),'body':_0x319709,'json':!![]};rp(_0x228a14)[_0x6abd('0x1f')](function(_0x1902f9){var _0xb4f815={'messageId':_0x1902f9[_0x6abd('0x40')]};if(!_0x3f41f9['deliveryReport']){_0xb4f815[_0x6abd('0x3c')]=!![];}return _0x39dd88[_0x6abd('0x1a')](_0xb4f815);})['catch'](function(_0x2e66c9){logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),'connectel',util[_0x6abd('0x2d')](_0x2e66c9,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x41'),_0x6abd('0x42'));}break;case _0x6abd('0x43'):if(_0x3f41f9[_0x6abd('0x30')]&&_0x3f41f9[_0x6abd('0x31')]){var _0x319709={'messages':[{'source':'xCALLY\x20Motion','to':_0x2fe6ac[_0x6abd('0x24')],'body':_0x2fe6ac[_0x6abd('0xe')],'from':_0x3f41f9[_0x6abd('0x44')]||_0x3f41f9[_0x6abd('0x24')]}]};var _0x2d4f1b=util[_0x6abd('0x45')]('%s:%s',_0x3f41f9[_0x6abd('0x30')],_0x3f41f9['password']);var _0x228a14={'method':_0x6abd('0x37'),'uri':_0x6abd('0x46'),'body':_0x319709,'headers':{'Authorization':util[_0x6abd('0x45')](_0x6abd('0x47'),new Buffer(_0x2d4f1b)[_0x6abd('0x48')]('base64'))},'json':!![]};rp(_0x228a14)[_0x6abd('0x1f')](function(_0x395294){if(_0x395294[_0x6abd('0x49')]>=0xc8&&_0x395294['http_code']<=0xce){if(_0x395294['data']&&_0x395294[_0x6abd('0x4a')][_0x6abd('0x4b')]>0x0){var _0x3de6b5=_[_0x6abd('0x4c')](_0x395294[_0x6abd('0x4a')][_0x6abd('0x25')]);var _0x45f84b={'messageId':_0x3de6b5[_0x6abd('0x4d')]};if(!_0x3f41f9[_0x6abd('0x3b')]){_0x45f84b['read']=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x45f84b);}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x4e'),util[_0x6abd('0x2d')](_0x395294,{'showHidden':![],'depth':null}));}}else{logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),'clickSend',util[_0x6abd('0x2d')](_0x395294,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x128ccb){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x4e'),util[_0x6abd('0x2d')](_0x128ccb,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x4e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x6abd('0x4f'):if(_0x3f41f9[_0x6abd('0x50')]&&_0x3f41f9[_0x6abd('0x23')]){var _0x319709={'dst':_0x2fe6ac[_0x6abd('0x24')],'text':_0x2fe6ac[_0x6abd('0xe')],'src':_0x3f41f9[_0x6abd('0x44')]||_0x3f41f9[_0x6abd('0x24')],'url':_0x3f41f9['remote']+_0x6abd('0x51')+_0x2fe6ac['id']+_0x6abd('0x28')+_0x3f41f9[_0x6abd('0x29')]};var _0x2d4f1b=util[_0x6abd('0x45')](_0x6abd('0x52'),_0x3f41f9['authId'],_0x3f41f9[_0x6abd('0x23')]);var _0x228a14={'method':_0x6abd('0x37'),'uri':util[_0x6abd('0x45')]('https://api.plivo.com/v1/Account/%s/Message/',_0x3f41f9[_0x6abd('0x50')]),'body':_0x319709,'headers':{'Authorization':util['format'](_0x6abd('0x47'),new Buffer(_0x2d4f1b)[_0x6abd('0x48')](_0x6abd('0x53')))},'json':!![]};rp(_0x228a14)['then'](function(_0x2ec93a){var _0x145951={'messageId':_0x2ec93a[_0x6abd('0x54')][0x0]};return _0x39dd88[_0x6abd('0x1a')](_0x145951);})['catch'](function(_0x26d586){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x4f'),util['inspect'](_0x26d586,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),'plivo',_0x6abd('0x55'));}break;case _0x6abd('0x56'):if(_0x3f41f9['username']&&_0x3f41f9['password']){if(_0x3f41f9[_0x6abd('0x57')]){var _0x20c8da={'method':'POST','uri':_0x3f41f9[_0x6abd('0x57')]+_0x6abd('0x58'),'body':{'username':_0x3f41f9[_0x6abd('0x30')],'password':_0x3f41f9[_0x6abd('0x31')]},'json':!![]};return rp(_0x20c8da)[_0x6abd('0x1f')](function(_0x35e485){var _0x21c74c={'method':'POST','uri':_0x3f41f9['baseUrl']+'/sms/2/text/advanced','body':{'messages':[{'from':_0x3f41f9['phone'],'destinations':[{'to':_0x2fe6ac[_0x6abd('0x24')]}],'text':_0x2fe6ac[_0x6abd('0xe')],'notifyUrl':_0x3f41f9[_0x6abd('0x27')]+_0x6abd('0x51')+_0x2fe6ac['id']+'/status?token='+_0x3f41f9['token'],'notifyContentType':'application/json','callbackData':_0x3f41f9['phone']+';'+_0x2fe6ac[_0x6abd('0xe')]}]},'headers':{'Authorization':_0x6abd('0x59')+_0x35e485[_0x6abd('0x29')]},'json':!![]};return rp(_0x21c74c)[_0x6abd('0x1f')](function(_0x15e73f){if(_0x15e73f[_0x6abd('0x25')]){var _0x582ff0={'messageId':_0x15e73f['messages'][0x0]['messageId']};if(!_0x3f41f9[_0x6abd('0x3b')]){_0x582ff0[_0x6abd('0x3c')]=!![];}return _0x39dd88['update'](_0x582ff0);}else{return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),util['inspect'](_0x15e73f,{'showHidden':![],'depth':null}));}});})[_0x6abd('0x1c')](function(_0x215926){return logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),util['inspect'](_0x215926,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),_0x6abd('0x5a'));}}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x56'),_0x6abd('0x3e'));}break;case _0x6abd('0x5b'):var _0x460dc1=require(_0x6abd('0x5c'));if(_0x3f41f9[_0x6abd('0x5d')]){var _0x25f732={};_0x25f732[_0x6abd('0x5e')]=_0x3f41f9[_0x6abd('0x30')];_0x25f732[_0x6abd('0x24')]=_0x2fe6ac[_0x6abd('0x24')];_0x25f732[_0x6abd('0x5f')]=_0x3f41f9[_0x6abd('0x24')];_0x25f732[_0x6abd('0x60')]=_0x2fe6ac['body'];_0x25f732['timestamp']=+new Date();var _0x6b6525='';var _0x15210c='';var _0x36ab08=Object[_0x6abd('0x61')](_0x25f732);_0x36ab08['sort']();for(var _0x4c8879=0x0;_0x4c8879<_0x36ab08['length'];_0x4c8879++){if(_0x6b6525!=''){_0x6b6525+='&';}_0x6b6525+=_0x36ab08[_0x4c8879]+'='+encodeURIComponent(_0x25f732[_0x36ab08[_0x4c8879]]);_0x15210c+=_0x25f732[_0x36ab08[_0x4c8879]];}_0x15210c+=_0x3f41f9[_0x6abd('0x5d')];_0x15210c=_0x460dc1[_0x6abd('0x62')](_0x6abd('0x63'))[_0x6abd('0x1a')](_0x15210c)[_0x6abd('0x64')](_0x6abd('0x65'));if(_0x6b6525!==''){_0x6b6525+='&';}_0x6b6525+=_0x6abd('0x66')+_0x15210c;var _0x25fb43={'method':'GET','uri':_0x3f41f9['baseUrl']+'/external/get/send.php?'+_0x6b6525,'json':!![]};return rp(_0x25fb43)[_0x6abd('0x1f')](function(_0x4090a1){var _0x3763cd=Object[_0x6abd('0x61')](_0x4090a1);if(_0x4090a1[_0x3763cd[0x0]][_0x6abd('0x1d')]&&parseInt(_0x4090a1[_0x3763cd[0x0]][_0x6abd('0x1d')])===0x0){var _0x4dabd0={'messageId':_0x4090a1[_0x3763cd[0x0]][_0x6abd('0x67')]};if(!_0x3f41f9['deliveryReport']){_0x4dabd0[_0x6abd('0x3c')]=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x4dabd0);}else{return logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','csc',util[_0x6abd('0x2d')](_0x4090a1['error'],{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x1df422){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x5b'),util['inspect'](_0x1df422,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0x6abd('0x68'):if(_0x3f41f9[_0x6abd('0x5d')]){var _0xa0f4a0={'method':_0x6abd('0x37'),'uri':_0x6abd('0x69'),'headers':{'Authorization':_0x3f41f9['apiKey']},'body':{'content':_0x2fe6ac['body'],'to':[_0x2fe6ac[_0x6abd('0x24')]],'from':_0x3f41f9[_0x6abd('0x24')],'binary':![],'clientMessageId':_0x6abd('0x6a'),'charset':_0x6abd('0x6b')},'json':!![]};rp(_0xa0f4a0)[_0x6abd('0x1f')](function(_0x491d54){if(!_0x491d54[_0x6abd('0x1d')]){var _0x76fa73={'messageId':_0x491d54[_0x6abd('0x25')][0x0][_0x6abd('0x6c')]};if(!_0x3f41f9[_0x6abd('0x3b')]){_0x76fa73['read']=!![];}return _0x39dd88[_0x6abd('0x1a')](_0x76fa73);}else{return logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),_0x6abd('0x68'),util[_0x6abd('0x2d')](_0x491d54[_0x6abd('0x1d')],{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x461ada){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x68'),util[_0x6abd('0x2d')](_0x461ada,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x68'),_0x6abd('0x6d'));}break;case _0x6abd('0x6e'):if(_0x3f41f9[_0x6abd('0x30')]&&_0x3f41f9[_0x6abd('0x31')]){var _0x2d4f1b=util[_0x6abd('0x45')](_0x6abd('0x52'),_0x3f41f9[_0x6abd('0x30')],_0x3f41f9[_0x6abd('0x31')]);var _0x228a14={'method':_0x6abd('0x37'),'uri':_0x6abd('0x6f')+_0x3f41f9[_0x6abd('0x70')]+_0x6abd('0x71'),'body':{'to':[_0x2fe6ac[_0x6abd('0x24')]],'text':_0x2fe6ac[_0x6abd('0xe')],'from':_0x3f41f9['phone'],'applicationId':_0x3f41f9['applicationId']},'headers':{'Authorization':util['format'](_0x6abd('0x47'),new Buffer(_0x2d4f1b)[_0x6abd('0x48')]('base64'))},'json':!![]};rp(_0x228a14)['then'](function(_0x36d0d4){if(_0x36d0d4['id']){var _0x19e437={'messageId':_0x36d0d4['id']};return _0x39dd88[_0x6abd('0x1a')](_0x19e437);}else{logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x6abd('0x2c'),_0x6abd('0x6e'),util['inspect'](_0x36d0d4,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x56b5b6){logger[_0x6abd('0x1d')](_0x6abd('0x2b'),'afterCreate',_0x6abd('0x6e'),util[_0x6abd('0x2d')](_0x56b5b6,{'showHidden':![],'depth':null}));});}else{logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x6e'),_0x6abd('0x3e'));}break;case _0x6abd('0x72'):if(_0x3f41f9[_0x6abd('0x5d')]){var _0x42db9e={};var _0x25fb43={'method':_0x6abd('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':'Bearer\x20'+_0x3f41f9[_0x6abd('0x5d')],'Content-Type':_0x6abd('0x73')},'body':{'from':_0x3f41f9[_0x6abd('0x24')],'to':_0x2fe6ac[_0x6abd('0x24')],'text':_0x2fe6ac['body']},'json':!![]};return rp(_0x25fb43)[_0x6abd('0x1f')](function(_0x1877a7){if(_0x1877a7['code']==0xca){_0x42db9e[_0x6abd('0x74')]=_0x1877a7;var _0x2928f7={'method':'POST','uri':_0x6abd('0x75'),'headers':{'Authorization':_0x6abd('0x76')+_0x3f41f9[_0x6abd('0x5d')],'Content-Type':_0x6abd('0x73')},'body':{'refid':_0x42db9e[_0x6abd('0x74')][_0x6abd('0x77')]},'json':!![]};return rp(_0x2928f7)[_0x6abd('0x1f')](function(_0x1133a2){_0x42db9e[_0x6abd('0x78')]=_0x1133a2;var _0x10fce9={'messageId':_0x42db9e[_0x6abd('0x74')][_0x6abd('0x77')],'read':!![]};return _0x39dd88[_0x6abd('0x1a')](_0x10fce9);});}else{return logger[_0x6abd('0x1d')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','intelepeer',util['inspect'](_0x1877a7,{'showHidden':![],'depth':null}));}})[_0x6abd('0x1c')](function(_0x137bdf){return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),'intelepeer',util['inspect'](_0x137bdf,{'showHidden':![],'depth':null}));});}else{return logger[_0x6abd('0x1d')](_0x6abd('0x2b'),_0x6abd('0x2c'),_0x6abd('0x72'),_0x6abd('0x79'));}break;}}})['finally'](function(){_0xbd446();});}else{_0xbd446();}}},'charset':'utf8mb4','collate':_0x6abd('0x7a')});}; \ No newline at end of file +var _0xce6d=['twilio','authToken','phone','accountSid','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','GET','sms','session_key','total_sent','internal_order_id','deliveryReport','read','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','update','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','plivo','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','sender','text','timestamp','keys','sort','length','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','accountId','/messages','applicationId','bandwidth','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','Token\x20not\x20received','finally','utf8mb4','lodash','util','../../config/logger','bluebird','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteractionId','SmsInteraction','findOne','createdAt','catch','error','SmsAccount','find','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xce6d,0x1c9));var _0xdce6=function(_0x59710f,_0x44c7f0){_0x59710f=_0x59710f-0x0;var _0xaae66a=_0xce6d[_0x59710f];return _0xaae66a;};'use strict';var _=require(_0xdce6('0x0'));var util=require(_0xdce6('0x1'));var logger=require(_0xdce6('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdce6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdce6('0x4'));var rimraf=require(_0xdce6('0x5'));var config=require('../../config/environment');var attributes=require(_0xdce6('0x6'));module[_0xdce6('0x7')]=function(_0x14229b,_0xc021dc){return _0x14229b[_0xdce6('0x8')](_0xdce6('0x9'),attributes,{'tableName':_0xdce6('0xa'),'paranoid':![],'indexes':[{'name':_0xdce6('0xb'),'fields':[_0xdce6('0xb')]},{'name':_0xdce6('0xc'),'fields':[_0xdce6('0xd')],'type':_0xdce6('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x35bff3,_0xed80b7,_0x1bcd1c){var _0x3679c7=_0x14229b[_0xdce6('0xf')];var _0x48b910=_0x35bff3[_0xdce6('0x10')]({'plain':!![]});if(_0x48b910[_0xdce6('0x11')][_0xdce6('0x12')]()==='in'||_0x48b910[_0xdce6('0x11')][_0xdce6('0x12')]()===_0xdce6('0x13')&&!_0x48b910[_0xdce6('0x14')]&&!_[_0xdce6('0x15')](_0x48b910['UserId'])&&!_['isNil'](_0x48b910[_0xdce6('0x16')])){_0x3679c7[_0xdce6('0x17')][_0xdce6('0x18')]({'where':{'id':_0x48b910[_0xdce6('0x16')]}})['then'](function(_0x5f4664){if(_0x5f4664){_0x5f4664['update']({'lastMsgAt':_0x48b910[_0xdce6('0x19')],'lastMsgDirection':_0x48b910[_0xdce6('0x11')][_0xdce6('0x12')]()});}})[_0xdce6('0x1a')](function(_0xda8f53){console[_0xdce6('0x1b')](_0xda8f53);});}if(_0x48b910[_0xdce6('0x11')]===_0xdce6('0x13')&&!_0x48b910[_0xdce6('0x14')]){var _0x35a925;_0x3679c7[_0xdce6('0x1c')][_0xdce6('0x1d')]({'where':{'id':_0x48b910['SmsAccountId']},'raw':!![]})[_0xdce6('0x1e')](function(_0x5e646e){_0x35a925=_0x5e646e;if(_0x35a925&&_0x35a925['type']){switch(_0x35a925['type']){case _0xdce6('0x1f'):var _0x47f20e=require(_0xdce6('0x1f'));if(_0x35a925['accountSid']&&_0x35a925[_0xdce6('0x20')]&&_0x35a925[_0xdce6('0x21')]){var _0x4ad2e3=new _0x47f20e(_0x35a925[_0xdce6('0x22')],_0x35a925[_0xdce6('0x20')]);_0x4ad2e3[_0xdce6('0x23')][_0xdce6('0x24')]({'body':_0x48b910['body'],'to':_0x48b910[_0xdce6('0x21')],'from':_0x35a925[_0xdce6('0x21')],'statusCallback':_0x35a925[_0xdce6('0x25')]+_0xdce6('0x26')+_0x48b910['id']+_0xdce6('0x27')+_0x35a925[_0xdce6('0x28')]})[_0xdce6('0x1e')](function(_0x3faa67){if(_0x3faa67[_0xdce6('0x29')]){return _0x35bff3['update']({'messageId':_0x3faa67[_0xdce6('0x29')]});}})['catch'](function(_0x41e82d){logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),'twilio',util[_0xdce6('0x2b')](_0x41e82d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x1f'),_0xdce6('0x2d'));}break;case _0xdce6('0x2e'):var _0x5574fe=_0xdce6('0x2f');if(_0x35a925[_0xdce6('0x30')]&&_0x35a925[_0xdce6('0x31')]){var _0x48b6a6={'recipient':[_0x48b910[_0xdce6('0x21')]],'message':_0x48b910['body'],'message_type':_0x35a925['smsMethod']};if(_0x35a925[_0xdce6('0x32')]&&_0x35a925['smsMethod']!=='SI'){_0x48b6a6['sender']=_0x35a925[_0xdce6('0x21')];}var _0x1349f1={'url':_0x5574fe+_0xdce6('0x33')+_0x35a925[_0xdce6('0x30')]+'&password='+_0x35a925['password'],'method':_0xdce6('0x34')};rp(_0x1349f1)[_0xdce6('0x1e')](function(_0x35d5c1){var _0x463a6d=_0x35d5c1['split'](';');var _0x4b08af={'user_key':_0x463a6d[0x0],'session_key':_0x463a6d[0x1]};_0x1349f1={'url':_0x5574fe+_0xdce6('0x35'),'method':'POST','headers':{'user_key':_0x4b08af['user_key'],'Session_key':_0x4b08af[_0xdce6('0x36')]},'json':!![],'body':_0x48b6a6};return rp(_0x1349f1);})['then'](function(_0x2b20f3){if(_0x2b20f3[_0xdce6('0x37')]>=0x1){var _0x5db718={'messageId':_0x2b20f3[_0xdce6('0x38')]};if(_0x35a925[_0xdce6('0x32')]!=='GP'||!_0x35a925[_0xdce6('0x39')]){_0x5db718[_0xdce6('0x3a')]=!![];}return _0x35bff3['update'](_0x5db718);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0xdce6('0x2b')](_0x2b20f3,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x530303){return logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x2e'),util[_0xdce6('0x2b')](_0x530303,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xdce6('0x2e'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdce6('0x3b'):if(_0x35a925[_0xdce6('0x20')]){var _0x2d7cbb={'recipient':_0x48b910['phone'],'message':_0x48b910[_0xdce6('0xd')],'sender':_0x35a925[_0xdce6('0x3c')]||_0x35a925['phone'],'authorization':_0x35a925[_0xdce6('0x20')]};var _0xed80b7={'method':'POST','uri':_0xdce6('0x3d'),'body':_0x2d7cbb,'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x254236){var _0x2b7f42={'messageId':_0x254236[_0xdce6('0x3e')]};if(!_0x35a925[_0xdce6('0x39')]){_0x2b7f42[_0xdce6('0x3a')]=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x2b7f42);})['catch'](function(_0x3ed1ff){logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'connectel',util[_0xdce6('0x2b')](_0x3ed1ff,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),'afterCreate',_0xdce6('0x3b'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x35a925[_0xdce6('0x30')]&&_0x35a925[_0xdce6('0x31')]){var _0x2d7cbb={'messages':[{'source':_0xdce6('0x40'),'to':_0x48b910[_0xdce6('0x21')],'body':_0x48b910[_0xdce6('0xd')],'from':_0x35a925[_0xdce6('0x3c')]||_0x35a925[_0xdce6('0x21')]}]};var _0x540ffa=util[_0xdce6('0x41')](_0xdce6('0x42'),_0x35a925[_0xdce6('0x30')],_0x35a925[_0xdce6('0x31')]);var _0xed80b7={'method':_0xdce6('0x43'),'uri':_0xdce6('0x44'),'body':_0x2d7cbb,'headers':{'Authorization':util[_0xdce6('0x41')](_0xdce6('0x45'),new Buffer(_0x540ffa)[_0xdce6('0x46')](_0xdce6('0x47')))},'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x4104ff){if(_0x4104ff['http_code']>=0xc8&&_0x4104ff['http_code']<=0xce){if(_0x4104ff[_0xdce6('0x48')]&&_0x4104ff[_0xdce6('0x48')][_0xdce6('0x49')]>0x0){var _0x41960a=_[_0xdce6('0x4a')](_0x4104ff[_0xdce6('0x48')][_0xdce6('0x23')]);var _0x1b115d={'messageId':_0x41960a[_0xdce6('0x4b')]};if(!_0x35a925[_0xdce6('0x39')]){_0x1b115d['read']=!![];}return _0x35bff3['update'](_0x1b115d);}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x4c'),util[_0xdce6('0x2b')](_0x4104ff,{'showHidden':![],'depth':null}));}}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x4c'),util[_0xdce6('0x2b')](_0x4104ff,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x14b8aa){logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),_0xdce6('0x4c'),util[_0xdce6('0x2b')](_0x14b8aa,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x4c'),_0xdce6('0x4d'));}break;case'plivo':if(_0x35a925[_0xdce6('0x4e')]&&_0x35a925[_0xdce6('0x20')]){var _0x2d7cbb={'dst':_0x48b910['phone'],'text':_0x48b910[_0xdce6('0xd')],'src':_0x35a925['senderString']||_0x35a925[_0xdce6('0x21')],'url':_0x35a925[_0xdce6('0x25')]+_0xdce6('0x26')+_0x48b910['id']+_0xdce6('0x27')+_0x35a925[_0xdce6('0x28')]};var _0x540ffa=util[_0xdce6('0x41')]('%s:%s',_0x35a925[_0xdce6('0x4e')],_0x35a925[_0xdce6('0x20')]);var _0xed80b7={'method':_0xdce6('0x43'),'uri':util['format'](_0xdce6('0x4f'),_0x35a925[_0xdce6('0x4e')]),'body':_0x2d7cbb,'headers':{'Authorization':util[_0xdce6('0x41')](_0xdce6('0x45'),new Buffer(_0x540ffa)['toString'](_0xdce6('0x47')))},'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x34cb1f){var _0xbceb0e={'messageId':_0x34cb1f[_0xdce6('0x50')][0x0]};return _0x35bff3[_0xdce6('0x3f')](_0xbceb0e);})['catch'](function(_0x39b69e){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),_0xdce6('0x51'),util['inspect'](_0x39b69e,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'plivo',_0xdce6('0x52'));}break;case'infobip':if(_0x35a925[_0xdce6('0x30')]&&_0x35a925['password']){if(_0x35a925[_0xdce6('0x53')]){var _0x26e76e={'method':'POST','uri':_0x35a925['baseUrl']+_0xdce6('0x54'),'body':{'username':_0x35a925[_0xdce6('0x30')],'password':_0x35a925[_0xdce6('0x31')]},'json':!![]};return rp(_0x26e76e)[_0xdce6('0x1e')](function(_0xa0dff0){var _0x1078a8={'method':_0xdce6('0x43'),'uri':_0x35a925[_0xdce6('0x53')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x35a925[_0xdce6('0x21')],'destinations':[{'to':_0x48b910['phone']}],'text':_0x48b910[_0xdce6('0xd')],'notifyUrl':_0x35a925[_0xdce6('0x25')]+_0xdce6('0x26')+_0x48b910['id']+_0xdce6('0x27')+_0x35a925['token'],'notifyContentType':_0xdce6('0x55'),'callbackData':_0x35a925['phone']+';'+_0x48b910['body']}]},'headers':{'Authorization':_0xdce6('0x56')+_0xa0dff0[_0xdce6('0x28')]},'json':!![]};return rp(_0x1078a8)[_0xdce6('0x1e')](function(_0x12aa76){if(_0x12aa76[_0xdce6('0x23')]){var _0x5da7c7={'messageId':_0x12aa76[_0xdce6('0x23')][0x0][_0xdce6('0xb')]};if(!_0x35a925[_0xdce6('0x39')]){_0x5da7c7[_0xdce6('0x3a')]=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x5da7c7);}else{return logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','infobip',util[_0xdce6('0x2b')](_0x12aa76,{'showHidden':![],'depth':null}));}});})[_0xdce6('0x1a')](function(_0x90d5cf){return logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),'infobip',util[_0xdce6('0x2b')](_0x90d5cf,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),'afterCreate',_0xdce6('0x57'),_0xdce6('0x58'));}}else{logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),'infobip',_0xdce6('0x4d'));}break;case _0xdce6('0x59'):var _0x2c6821=require(_0xdce6('0x5a'));if(_0x35a925[_0xdce6('0x5b')]){var _0x589b2d={};_0x589b2d[_0xdce6('0x5c')]=_0x35a925[_0xdce6('0x30')];_0x589b2d[_0xdce6('0x21')]=_0x48b910[_0xdce6('0x21')];_0x589b2d[_0xdce6('0x5d')]=_0x35a925['phone'];_0x589b2d[_0xdce6('0x5e')]=_0x48b910[_0xdce6('0xd')];_0x589b2d[_0xdce6('0x5f')]=+new Date();var _0x354a81='';var _0x18c4b4='';var _0x5d8d39=Object[_0xdce6('0x60')](_0x589b2d);_0x5d8d39[_0xdce6('0x61')]();for(var _0x4c4a67=0x0;_0x4c4a67<_0x5d8d39[_0xdce6('0x62')];_0x4c4a67++){if(_0x354a81!=''){_0x354a81+='&';}_0x354a81+=_0x5d8d39[_0x4c4a67]+'='+encodeURIComponent(_0x589b2d[_0x5d8d39[_0x4c4a67]]);_0x18c4b4+=_0x589b2d[_0x5d8d39[_0x4c4a67]];}_0x18c4b4+=_0x35a925['apiKey'];_0x18c4b4=_0x2c6821['createHash'](_0xdce6('0x63'))[_0xdce6('0x3f')](_0x18c4b4)[_0xdce6('0x64')](_0xdce6('0x65'));if(_0x354a81!==''){_0x354a81+='&';}_0x354a81+=_0xdce6('0x66')+_0x18c4b4;var _0x1349f1={'method':_0xdce6('0x34'),'uri':_0x35a925[_0xdce6('0x53')]+_0xdce6('0x67')+_0x354a81,'json':!![]};return rp(_0x1349f1)[_0xdce6('0x1e')](function(_0x23dfb6){var _0x53664c=Object['keys'](_0x23dfb6);if(_0x23dfb6[_0x53664c[0x0]][_0xdce6('0x1b')]&&parseInt(_0x23dfb6[_0x53664c[0x0]][_0xdce6('0x1b')])===0x0){var _0x5c4d72={'messageId':_0x23dfb6[_0x53664c[0x0]][_0xdce6('0x68')]};if(!_0x35a925['deliveryReport']){_0x5c4d72['read']=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x5c4d72);}else{return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'csc',util[_0xdce6('0x2b')](_0x23dfb6[_0xdce6('0x1b')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x86e1da){return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'csc',util['inspect'](_0x86e1da,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'csc',_0xdce6('0x69'));}break;case _0xdce6('0x6a'):if(_0x35a925[_0xdce6('0x5b')]){var _0x5c5657={'method':'POST','uri':_0xdce6('0x6b'),'headers':{'Authorization':_0x35a925['apiKey']},'body':{'content':_0x48b910[_0xdce6('0xd')],'to':[_0x48b910[_0xdce6('0x21')]],'from':_0x35a925[_0xdce6('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x5c5657)[_0xdce6('0x1e')](function(_0x3676ea){if(!_0x3676ea[_0xdce6('0x1b')]){var _0x333e1a={'messageId':_0x3676ea[_0xdce6('0x23')][0x0]['apiMessageId']};if(!_0x35a925[_0xdce6('0x39')]){_0x333e1a['read']=!![];}return _0x35bff3[_0xdce6('0x3f')](_0x333e1a);}else{return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x6a'),util['inspect'](_0x3676ea[_0xdce6('0x1b')],{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x279b73){return logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x6a'),util['inspect'](_0x279b73,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x6a'),_0xdce6('0x69'));}break;case'bandwidth':if(_0x35a925[_0xdce6('0x30')]&&_0x35a925[_0xdce6('0x31')]){var _0x540ffa=util['format'](_0xdce6('0x42'),_0x35a925[_0xdce6('0x30')],_0x35a925[_0xdce6('0x31')]);var _0xed80b7={'method':_0xdce6('0x43'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x35a925[_0xdce6('0x6c')]+_0xdce6('0x6d'),'body':{'to':[_0x48b910['phone']],'text':_0x48b910[_0xdce6('0xd')],'from':_0x35a925['phone'],'applicationId':_0x35a925[_0xdce6('0x6e')]},'headers':{'Authorization':util[_0xdce6('0x41')](_0xdce6('0x45'),new Buffer(_0x540ffa)['toString'](_0xdce6('0x47')))},'json':!![]};rp(_0xed80b7)[_0xdce6('0x1e')](function(_0x10c5a5){if(_0x10c5a5['id']){var _0x1d9036={'messageId':_0x10c5a5['id']};return _0x35bff3[_0xdce6('0x3f')](_0x1d9036);}else{logger['error'](_0xdce6('0x2c'),'afterCreate',_0xdce6('0x6f'),util[_0xdce6('0x2b')](_0x10c5a5,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x279bb9){logger[_0xdce6('0x1b')](_0xdce6('0x2c'),'afterCreate','bandwidth',util[_0xdce6('0x2b')](_0x279bb9,{'showHidden':![],'depth':null}));});}else{logger[_0xdce6('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xdce6('0x2a'),_0xdce6('0x6f'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xdce6('0x70'):if(_0x35a925['apiKey']){var _0x291cdb={};var _0x1349f1={'method':_0xdce6('0x43'),'uri':_0xdce6('0x71'),'headers':{'Authorization':_0xdce6('0x72')+_0x35a925[_0xdce6('0x5b')],'Content-Type':_0xdce6('0x55')},'body':{'from':_0x35a925['phone'],'to':_0x48b910[_0xdce6('0x21')],'text':_0x48b910[_0xdce6('0xd')]},'json':!![]};return rp(_0x1349f1)[_0xdce6('0x1e')](function(_0x348721){if(_0x348721[_0xdce6('0x73')]==0xca){_0x291cdb[_0xdce6('0x74')]=_0x348721;var _0x109e58={'method':_0xdce6('0x43'),'uri':_0xdce6('0x75'),'headers':{'Authorization':'Bearer\x20'+_0x35a925['apiKey'],'Content-Type':_0xdce6('0x55')},'body':{'refid':_0x291cdb[_0xdce6('0x74')][_0xdce6('0x76')]},'json':!![]};return rp(_0x109e58)['then'](function(_0x462f46){_0x291cdb['status']=_0x462f46;var _0x2df27b={'messageId':_0x291cdb[_0xdce6('0x74')][_0xdce6('0x76')],'read':!![]};return _0x35bff3[_0xdce6('0x3f')](_0x2df27b);});}else{return logger['error'](_0xdce6('0x2c'),_0xdce6('0x2a'),'intelepeer',util[_0xdce6('0x2b')](_0x348721,{'showHidden':![],'depth':null}));}})[_0xdce6('0x1a')](function(_0x3d35c1){return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),'intelepeer',util[_0xdce6('0x2b')](_0x3d35c1,{'showHidden':![],'depth':null}));});}else{return logger[_0xdce6('0x1b')](_0xdce6('0x2c'),_0xdce6('0x2a'),_0xdce6('0x70'),_0xdce6('0x77'));}break;}}})[_0xdce6('0x78')](function(){_0x1bcd1c();});}else{_0x1bcd1c();}}},'charset':_0xdce6('0x79'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index c3b01f7..ea3f10d 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 _0x9531=['socket.io-emitter','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','message','error','info','result','catch','CreateSmsMessage','SmsMessage','create','body','options','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost'];(function(_0x509935,_0x40eb08){var _0x2dfc11=function(_0x591cc3){while(--_0x591cc3){_0x509935['push'](_0x509935['shift']());}};_0x2dfc11(++_0x40eb08);}(_0x9531,0x1c4));var _0x1953=function(_0x2606b0,_0x270498){_0x2606b0=_0x2606b0-0x0;var _0x4646ae=_0x9531[_0x2606b0];return _0x4646ae;};'use strict';var _=require(_0x1953('0x0'));var util=require(_0x1953('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1953('0x2'));var fs=require('fs');var Redis=require(_0x1953('0x3'));var db=require(_0x1953('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1953('0x5'))(_0x1953('0x6'));var config=require(_0x1953('0x7'));var jayson=require(_0x1953('0x8'));var client=jayson['client'][_0x1953('0x9')]({'port':0x232a});config[_0x1953('0xa')]=_[_0x1953('0xb')](config['redis'],{'host':_0x1953('0xc'),'port':0x18eb});var socket=require(_0x1953('0xd'))(new Redis(config[_0x1953('0xa')]));require('./smsMessage.socket')['register'](socket);function respondWithRpcPromise(_0x29e4b9,_0x5cd94d,_0x27d6ed){return new BPromise(function(_0x2f1544,_0x5364b3){return client[_0x1953('0xe')](_0x29e4b9,_0x27d6ed)[_0x1953('0xf')](function(_0x3632f4){logger['info'](_0x1953('0x10'),_0x5cd94d,_0x1953('0x11'));logger[_0x1953('0x12')](_0x1953('0x13'),_0x5cd94d,_0x1953('0x11'),JSON[_0x1953('0x14')](_0x3632f4));if(_0x3632f4['error']){if(_0x3632f4['error']['code']===0x1f4){logger['error'](_0x1953('0x10'),_0x5cd94d,_0x3632f4['error'][_0x1953('0x15')]);return _0x5364b3(_0x3632f4['error'][_0x1953('0x15')]);}logger[_0x1953('0x16')]('SmsMessage,\x20%s,\x20%s',_0x5cd94d,_0x3632f4[_0x1953('0x16')][_0x1953('0x15')]);return _0x2f1544(_0x3632f4[_0x1953('0x16')][_0x1953('0x15')]);}else{logger[_0x1953('0x17')](_0x1953('0x10'),_0x5cd94d,'request\x20sent');_0x2f1544(_0x3632f4[_0x1953('0x18')][_0x1953('0x15')]);}})[_0x1953('0x19')](function(_0xa7944e){logger[_0x1953('0x16')]('SmsMessage,\x20%s,\x20%s',_0x5cd94d,_0xa7944e);_0x5364b3(_0xa7944e);});});}exports[_0x1953('0x1a')]=function(_0x385822){var _0x19fe1c=this;return new Promise(function(_0x4d52ed,_0x520dae){return db[_0x1953('0x1b')][_0x1953('0x1c')](_0x385822[_0x1953('0x1d')],{'raw':_0x385822[_0x1953('0x1e')]?_0x385822[_0x1953('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x1953('0xf')](function(_0x2e0c09){logger[_0x1953('0x17')](_0x1953('0x1a'),_0x385822);logger[_0x1953('0x12')](_0x1953('0x1a'),_0x385822,JSON['stringify'](_0x2e0c09));_0x4d52ed(_0x2e0c09);})[_0x1953('0x19')](function(_0x3187ed){logger[_0x1953('0x16')](_0x1953('0x1a'),_0x3187ed[_0x1953('0x15')],_0x385822);_0x520dae(_0x19fe1c[_0x1953('0x16')](0x1f4,_0x3187ed[_0x1953('0x15')]));});});}; \ No newline at end of file +var _0x7268=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','lodash','util','moment','bluebird','ioredis'];(function(_0x18e124,_0x5ca114){var _0x2f335a=function(_0x2d752e){while(--_0x2d752e){_0x18e124['push'](_0x18e124['shift']());}};_0x2f335a(++_0x5ca114);}(_0x7268,0x123));var _0x8726=function(_0x3c88cd,_0xe662d6){_0x3c88cd=_0x3c88cd-0x0;var _0x2753f3=_0x7268[_0x3c88cd];return _0x2753f3;};'use strict';var _=require(_0x8726('0x0'));var util=require(_0x8726('0x1'));var moment=require(_0x8726('0x2'));var BPromise=require(_0x8726('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8726('0x4'));var db=require(_0x8726('0x5'))['db'];var utils=require(_0x8726('0x6'));var logger=require(_0x8726('0x7'))(_0x8726('0x8'));var config=require(_0x8726('0x9'));var jayson=require(_0x8726('0xa'));var client=jayson[_0x8726('0xb')][_0x8726('0xc')]({'port':0x232a});config[_0x8726('0xd')]=_[_0x8726('0xe')](config[_0x8726('0xd')],{'host':_0x8726('0xf'),'port':0x18eb});var socket=require(_0x8726('0x10'))(new Redis(config[_0x8726('0xd')]));require(_0x8726('0x11'))[_0x8726('0x12')](socket);function respondWithRpcPromise(_0x4b2296,_0x34350c,_0x5a6383){return new BPromise(function(_0x2fc73a,_0x928262){return client[_0x8726('0x13')](_0x4b2296,_0x5a6383)[_0x8726('0x14')](function(_0xb64fbb){logger['info'](_0x8726('0x15'),_0x34350c,_0x8726('0x16'));logger[_0x8726('0x17')](_0x8726('0x18'),_0x34350c,'request\x20sent',JSON[_0x8726('0x19')](_0xb64fbb));if(_0xb64fbb[_0x8726('0x1a')]){if(_0xb64fbb['error'][_0x8726('0x1b')]===0x1f4){logger[_0x8726('0x1a')](_0x8726('0x15'),_0x34350c,_0xb64fbb[_0x8726('0x1a')][_0x8726('0x1c')]);return _0x928262(_0xb64fbb[_0x8726('0x1a')][_0x8726('0x1c')]);}logger[_0x8726('0x1a')](_0x8726('0x15'),_0x34350c,_0xb64fbb[_0x8726('0x1a')]['message']);return _0x2fc73a(_0xb64fbb[_0x8726('0x1a')]['message']);}else{logger[_0x8726('0x1d')](_0x8726('0x15'),_0x34350c,_0x8726('0x16'));_0x2fc73a(_0xb64fbb[_0x8726('0x1e')][_0x8726('0x1c')]);}})[_0x8726('0x1f')](function(_0x191e56){logger[_0x8726('0x1a')](_0x8726('0x15'),_0x34350c,_0x191e56);_0x928262(_0x191e56);});});}exports[_0x8726('0x20')]=function(_0x2e0a2a){var _0x4c8916=this;return new Promise(function(_0x5aee0e,_0x2ceec2){return db[_0x8726('0x21')][_0x8726('0x22')](_0x2e0a2a['body'],{'raw':_0x2e0a2a[_0x8726('0x23')]?_0x2e0a2a[_0x8726('0x23')][_0x8726('0x24')]===undefined?!![]:![]:!![]})[_0x8726('0x14')](function(_0x2bbaac){logger['info'](_0x8726('0x20'),_0x2e0a2a);logger[_0x8726('0x17')]('CreateSmsMessage',_0x2e0a2a,JSON['stringify'](_0x2bbaac));_0x5aee0e(_0x2bbaac);})[_0x8726('0x1f')](function(_0x3daa3a){logger[_0x8726('0x1a')](_0x8726('0x20'),_0x3daa3a[_0x8726('0x1c')],_0x2e0a2a);_0x2ceec2(_0x4c8916[_0x8726('0x1a')](0x1f4,_0x3daa3a['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index c6d6342..3d290a7 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 _0x534f=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','update'];(function(_0x6993c3,_0x1ec7d2){var _0x40eadc=function(_0x2ca518){while(--_0x2ca518){_0x6993c3['push'](_0x6993c3['shift']());}};_0x40eadc(++_0x1ec7d2);}(_0x534f,0x17e));var _0xf534=function(_0x21f0a9,_0x1c964b){_0x21f0a9=_0x21f0a9-0x0;var _0x463539=_0x534f[_0x21f0a9];return _0x463539;};'use strict';var SmsMessageEvents=require(_0xf534('0x0'));var events=[_0xf534('0x1'),'remove',_0xf534('0x2')];function createListener(_0x3eeaf8,_0xfe44ea){return function(_0x253d69){_0xfe44ea[_0xf534('0x3')](_0x3eeaf8,_0x253d69);};}function removeListener(_0x1b1a0c,_0x5ce975){return function(){SmsMessageEvents[_0xf534('0x4')](_0x1b1a0c,_0x5ce975);};}exports['register']=function(_0xf5097f){for(var _0x2744ee=0x0,_0x2f42ed=events[_0xf534('0x5')];_0x2744ee<_0x2f42ed;_0x2744ee++){var _0x1771c7=events[_0x2744ee];var _0x3df21c=createListener(_0xf534('0x6')+_0x1771c7,_0xf5097f);SmsMessageEvents['on'](_0x1771c7,_0x3df21c);}}; \ No newline at end of file +var _0x638f=['register','length','smsMessage:','./smsMessage.events','save','remove','update','removeListener'];(function(_0x574bbb,_0x54ccef){var _0x4e8cae=function(_0x337ffb){while(--_0x337ffb){_0x574bbb['push'](_0x574bbb['shift']());}};_0x4e8cae(++_0x54ccef);}(_0x638f,0x16b));var _0xf638=function(_0x20db5c,_0x3e2079){_0x20db5c=_0x20db5c-0x0;var _0x299b65=_0x638f[_0x20db5c];return _0x299b65;};'use strict';var SmsMessageEvents=require(_0xf638('0x0'));var events=[_0xf638('0x1'),_0xf638('0x2'),_0xf638('0x3')];function createListener(_0x36fb64,_0x3f62b5){return function(_0x33387a){_0x3f62b5['emit'](_0x36fb64,_0x33387a);};}function removeListener(_0x9c489d,_0x24250d){return function(){SmsMessageEvents[_0xf638('0x4')](_0x9c489d,_0x24250d);};}exports[_0xf638('0x5')]=function(_0x5233df){for(var _0x452767=0x0,_0x60cb7=events[_0xf638('0x6')];_0x452767<_0x60cb7;_0x452767++){var _0x303ade=events[_0x452767];var _0x22c251=createListener(_0xf638('0x7')+_0x303ade,_0x5233df);SmsMessageEvents['on'](_0x303ade,_0x22c251);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index 9398fa6..811dc26 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 _0xfa62=['removeAgents','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','delete','removeTeams'];(function(_0x1628df,_0x4271ac){var _0x5bc36c=function(_0x29f9c2){while(--_0x29f9c2){_0x1628df['push'](_0x1628df['shift']());}};_0x5bc36c(++_0x4271ac);}(_0xfa62,0x1a5));var _0x2fa6=function(_0x3dc653,_0x522183){_0x3dc653=_0x3dc653-0x0;var _0x46bccc=_0xfa62[_0x3dc653];return _0x46bccc;};'use strict';var multer=require(_0x2fa6('0x0'));var util=require(_0x2fa6('0x1'));var path=require(_0x2fa6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2fa6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2fa6('0x4'));var interaction=require(_0x2fa6('0x5'));var config=require(_0x2fa6('0x6'));var controller=require(_0x2fa6('0x7'));router['get']('/',auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x9')]);router[_0x2fa6('0xa')](_0x2fa6('0xb'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0xc')]);router[_0x2fa6('0xa')](_0x2fa6('0xd'),auth[_0x2fa6('0x8')](),controller['show']);router[_0x2fa6('0xa')](_0x2fa6('0xe'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0xf')]);router[_0x2fa6('0xa')]('/:id/teams',auth['isAuthenticated'](),controller[_0x2fa6('0x10')]);router['get'](_0x2fa6('0x11'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x12')]);router[_0x2fa6('0x13')]('/',auth['isAuthenticated'](),controller[_0x2fa6('0x14')]);router[_0x2fa6('0x13')](_0x2fa6('0x15'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x16')]);router[_0x2fa6('0x13')](_0x2fa6('0x11'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x17')]);router[_0x2fa6('0x18')](_0x2fa6('0xd'),auth[_0x2fa6('0x8')](),controller['update']);router[_0x2fa6('0x19')](_0x2fa6('0xd'),auth[_0x2fa6('0x8')](),controller['destroy']);router[_0x2fa6('0x19')]('/:id/teams',auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x1a')]);router[_0x2fa6('0x19')](_0x2fa6('0x11'),auth[_0x2fa6('0x8')](),controller[_0x2fa6('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x8571=['delete','removeTeams','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','put','update'];(function(_0x419ada,_0x31d2df){var _0x1e98da=function(_0x2c652c){while(--_0x2c652c){_0x419ada['push'](_0x419ada['shift']());}};_0x1e98da(++_0x31d2df);}(_0x8571,0x1e9));var _0x1857=function(_0x4f0ce6,_0x4b050b){_0x4f0ce6=_0x4f0ce6-0x0;var _0x3dbaab=_0x8571[_0x4f0ce6];return _0x3dbaab;};'use strict';var multer=require(_0x1857('0x0'));var util=require('util');var path=require(_0x1857('0x1'));var timeout=require('connect-timeout');var express=require(_0x1857('0x2'));var router=express['Router']();var fs_extra=require(_0x1857('0x3'));var auth=require(_0x1857('0x4'));var interaction=require(_0x1857('0x5'));var config=require(_0x1857('0x6'));var controller=require('./smsQueue.controller');router[_0x1857('0x7')]('/',auth['isAuthenticated'](),controller[_0x1857('0x8')]);router[_0x1857('0x7')](_0x1857('0x9'),auth[_0x1857('0xa')](),controller['describe']);router[_0x1857('0x7')](_0x1857('0xb'),auth[_0x1857('0xa')](),controller[_0x1857('0xc')]);router[_0x1857('0x7')](_0x1857('0xd'),auth['isAuthenticated'](),controller[_0x1857('0xe')]);router[_0x1857('0x7')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1857('0xf')]);router[_0x1857('0x7')](_0x1857('0x10'),auth[_0x1857('0xa')](),controller[_0x1857('0x11')]);router[_0x1857('0x12')]('/',auth[_0x1857('0xa')](),controller['create']);router['post'](_0x1857('0x13'),auth[_0x1857('0xa')](),controller[_0x1857('0x14')]);router['post'](_0x1857('0x10'),auth[_0x1857('0xa')](),controller[_0x1857('0x15')]);router[_0x1857('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x1857('0x17')]);router[_0x1857('0x18')](_0x1857('0xb'),auth[_0x1857('0xa')](),controller['destroy']);router[_0x1857('0x18')](_0x1857('0x13'),auth[_0x1857('0xa')](),controller[_0x1857('0x19')]);router[_0x1857('0x18')](_0x1857('0x10'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1857('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ff102b5..7fa7dd4 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 _0x2411=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x178c03,_0x31c7b2){var _0x13e510=function(_0x2f551a){while(--_0x2f551a){_0x178c03['push'](_0x178c03['shift']());}};_0x13e510(++_0x31c7b2);}(_0x2411,0x9a));var _0x1241=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0x2411[_0x589aee];return _0x2f5ed4;};'use strict';var Sequelize=require('sequelize');module[_0x1241('0x0')]={'name':{'type':Sequelize[_0x1241('0x1')],'unique':_0x1241('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1241('0x1')]},'timeout':{'type':Sequelize[_0x1241('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1241('0x4')](_0x1241('0x5'),_0x1241('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x0615=['name','INTEGER','ENUM','beepall','roundrobin','exports','STRING'];(function(_0x56d727,_0x32ce0d){var _0x160b5c=function(_0xddd682){while(--_0xddd682){_0x56d727['push'](_0x56d727['shift']());}};_0x160b5c(++_0x32ce0d);}(_0x0615,0xde));var _0x5061=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x0615[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x5061('0x0')]={'name':{'type':Sequelize[_0x5061('0x1')],'unique':_0x5061('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5061('0x1')]},'timeout':{'type':Sequelize[_0x5061('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5061('0x4')]('rrmemory',_0x5061('0x5'),_0x5061('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6566080..ede45e6 100644 --- a/server/api/smsQueue/smsQueue.controller.js +++ b/server/api/smsQueue/smsQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x3f59b1,_0x25cdbe){var _0x11d2e8=function(_0x37b3fc){while(--_0x37b3fc){_0x3f59b1['push'](_0x3f59b1['shift']());}};_0x11d2e8(++_0x25cdbe);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2ae8b5,_0x2a2cb6){_0x2ae8b5=_0x2ae8b5-0x0;var _0x29def1=_0x5f2f[_0x2ae8b5];return _0x29def1;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file +var _0x5f2f=['redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','map','SmsQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','show','params','model','keys','query','filters','intersection','attributes','fields','includeAll','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','addTeams','ids','User','Agents','online','voicePause','interface','flatMap','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','field','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','sequelize','transaction','isEmpty','removeAgents','addAgents','omit','spread','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x239dc7,_0x10df14){var _0x1ee670=function(_0x58a16b){while(--_0x58a16b){_0x239dc7['push'](_0x239dc7['shift']());}};_0x1ee670(++_0x10df14);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3b301e,_0x388e77){_0x3b301e=_0x3b301e-0x0;var _0x47ac39=_0x5f2f[_0x3b301e];return _0x47ac39;};'use strict';var BPromise=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var _=require(_0xf5f2('0x2'));var squel=require(_0xf5f2('0x3'));var Redis=require(_0xf5f2('0x4'));var qs=require(_0xf5f2('0x5'));var logger=require(_0xf5f2('0x6'))(_0xf5f2('0x7'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xf5f2('0x8')]=_[_0xf5f2('0x9')](config[_0xf5f2('0x8')],{'host':_0xf5f2('0xa'),'port':0x18eb});var socket=require(_0xf5f2('0xb'))(new Redis(config[_0xf5f2('0x8')]));require('./smsQueue.socket')[_0xf5f2('0xc')](socket);function respondWithStatusCode(_0x46cd9c,_0x2ec345){_0x2ec345=_0x2ec345||0xcc;return function(_0x56a69f){if(_0x56a69f){return _0x46cd9c[_0xf5f2('0xd')](_0x2ec345);}return _0x46cd9c[_0xf5f2('0xe')](_0x2ec345)[_0xf5f2('0xf')]();};}function respondWithResult(_0x4e0e6b,_0x977a59){_0x977a59=_0x977a59||0xc8;return function(_0x4ebbbe){if(_0x4ebbbe){return _0x4e0e6b['status'](_0x977a59)[_0xf5f2('0x10')](_0x4ebbbe);}};}function respondWithFilteredResult(_0x151aba,_0x4b78cd){return function(_0x336f6b){if(_0x336f6b){var _0x14b51f=typeof _0x4b78cd[_0xf5f2('0x11')]===_0xf5f2('0x12')&&typeof _0x4b78cd[_0xf5f2('0x13')]===_0xf5f2('0x12');var _0x5c01b8=_0x336f6b[_0xf5f2('0x14')];var _0xea612c=_0x14b51f?0x0:_0x4b78cd[_0xf5f2('0x11')];var _0x1c1a5c=_0x14b51f?_0x336f6b[_0xf5f2('0x14')]:_0x4b78cd['offset']+_0x4b78cd[_0xf5f2('0x13')];var _0x286197;if(_0x1c1a5c>=_0x5c01b8){_0x1c1a5c=_0x5c01b8;_0x286197=0xc8;}else{_0x286197=0xce;}_0x151aba[_0xf5f2('0xe')](_0x286197);return _0x151aba[_0xf5f2('0x15')](_0xf5f2('0x16'),_0xea612c+'-'+_0x1c1a5c+'/'+_0x5c01b8)[_0xf5f2('0x10')](_0x336f6b);}return null;};}function saveUpdates(_0xdb61b3){return function(_0x395a5a){if(_0x395a5a){return _0x395a5a[_0xf5f2('0x17')](_0xdb61b3)[_0xf5f2('0x18')](function(_0x20fccd){return _0x20fccd;});}return null;};}function removeEntity(_0x28e097){return function(_0x4ff59b){if(_0x4ff59b){return _0x4ff59b[_0xf5f2('0x19')]()[_0xf5f2('0x18')](function(){var _0x626999=_0x4ff59b[_0xf5f2('0x1a')]({'plain':!![]});var _0x56acc5=_0xf5f2('0x1b');return db[_0xf5f2('0x1c')]['destroy']({'where':{'type':_0x56acc5,'resourceId':_0x626999['id']}})['then'](function(){return _0x4ff59b;});})[_0xf5f2('0x18')](function(){_0x28e097[_0xf5f2('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45b74f){return function(_0x170042){if(!_0x170042){_0x45b74f[_0xf5f2('0xd')](0x194);}return _0x170042;};}function handleError(_0x39c024,_0x36f1cb){_0x36f1cb=_0x36f1cb||0x1f4;return function(_0x4c691a){logger[_0xf5f2('0x1d')](_0x4c691a[_0xf5f2('0x1e')]);if(_0x4c691a[_0xf5f2('0x1f')]){delete _0x4c691a[_0xf5f2('0x1f')];}_0x39c024[_0xf5f2('0xe')](_0x36f1cb)['send'](_0x4c691a);};}exports['index']=function(_0x5f1124,_0x3f79d5){var _0x13da6f={};var _0x1a5bb3={'count':0x0,'rows':[]};var _0xf6c58d=_[_0xf5f2('0x20')](db[_0xf5f2('0x21')][_0xf5f2('0x22')],function(_0x294414){return{'name':_0x294414['fieldName'],'type':_0x294414[_0xf5f2('0x23')][_0xf5f2('0x24')]};});_0x13da6f=qs[_0xf5f2('0x25')](_0xf6c58d,_0x5f1124);var _0x31bfcb={'where':_0x13da6f[_0xf5f2('0x26')]};return db[_0xf5f2('0x21')]['count'](_0x31bfcb)['then'](function(_0x22c826){_0x1a5bb3[_0xf5f2('0x14')]=_0x22c826;_0x13da6f[_0xf5f2('0x27')]=qs['include'](_0x5f1124['query']);return db[_0xf5f2('0x21')][_0xf5f2('0x28')](_0x13da6f);})[_0xf5f2('0x18')](function(_0x153924){_0x1a5bb3[_0xf5f2('0x29')]=_0x153924;return _0x1a5bb3;})['then'](respondWithFilteredResult(_0x3f79d5,_0x13da6f))['catch'](handleError(_0x3f79d5,null));};exports[_0xf5f2('0x2a')]=function(_0x4e19cb,_0xb744b9){var _0x58a4df={'raw':!![],'where':{'id':_0x4e19cb[_0xf5f2('0x2b')]['id']}},_0x45b643={};_0x45b643[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x21')][_0xf5f2('0x22')]);_0x45b643[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x4e19cb['query']);_0x45b643[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],_0x45b643[_0xf5f2('0x2e')]);_0x58a4df[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x45b643[_0xf5f2('0x2c')],qs['fields'](_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x58a4df['attributes']=_0x58a4df[_0xf5f2('0x31')]['length']?_0x58a4df[_0xf5f2('0x31')]:_0x45b643[_0xf5f2('0x2c')];if(_0x4e19cb[_0xf5f2('0x2e')][_0xf5f2('0x33')]){_0x58a4df['include']=[{'all':!![]}];}_0x58a4df=_['merge']({},_0x58a4df,_0x4e19cb[_0xf5f2('0x34')]);return db[_0xf5f2('0x21')][_0xf5f2('0x35')](_0x58a4df)['then'](handleEntityNotFound(_0xb744b9,null))[_0xf5f2('0x18')](respondWithResult(_0xb744b9,null))['catch'](handleError(_0xb744b9,null));};exports[_0xf5f2('0x36')]=function(_0x566c47,_0x46f464){return db[_0xf5f2('0x21')]['create'](_0x566c47[_0xf5f2('0x37')],{})[_0xf5f2('0x18')](function(_0x5a4441){var _0x35f738=_0x566c47['user']['get']({'plain':!![]});if(!_0x35f738)throw new Error(_0xf5f2('0x38'));if(_0x35f738[_0xf5f2('0x39')]===_0xf5f2('0x3a')){var _0x2d4400=_0x5a4441[_0xf5f2('0x1a')]({'plain':!![]});var _0xe62b57=_0xf5f2('0x1b');return db['UserProfileSection'][_0xf5f2('0x35')]({'where':{'name':_0xe62b57,'userProfileId':_0x35f738[_0xf5f2('0x3b')]},'raw':!![]})['then'](function(_0xc6a1ae){if(_0xc6a1ae&&_0xc6a1ae[_0xf5f2('0x3c')]===0x0){return db[_0xf5f2('0x1c')][_0xf5f2('0x36')]({'name':_0x2d4400[_0xf5f2('0x1f')],'resourceId':_0x2d4400['id'],'type':_0xc6a1ae[_0xf5f2('0x1f')],'sectionId':_0xc6a1ae['id']},{})[_0xf5f2('0x18')](function(){return _0x5a4441;});}else{return _0x5a4441;}})[_0xf5f2('0x3d')](function(_0x574f24){logger[_0xf5f2('0x1d')](_0xf5f2('0x3e'),_0x574f24);throw _0x574f24;});}return _0x5a4441;})[_0xf5f2('0x18')](respondWithResult(_0x46f464,0xc9))['catch'](handleError(_0x46f464,null));};exports['update']=function(_0x59eb00,_0x76d21b){if(_0x59eb00[_0xf5f2('0x37')]['id']){delete _0x59eb00['body']['id'];}return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x59eb00[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x76d21b,null))[_0xf5f2('0x18')](saveUpdates(_0x59eb00[_0xf5f2('0x37')],null))[_0xf5f2('0x18')](respondWithResult(_0x76d21b,null))[_0xf5f2('0x3d')](handleError(_0x76d21b,null));};exports[_0xf5f2('0x19')]=function(_0x106062,_0x444317){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x106062[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x444317,null))[_0xf5f2('0x18')](removeEntity(_0x444317,null))['catch'](handleError(_0x444317,null));};exports[_0xf5f2('0x3f')]=function(_0xc04f44,_0x218def){return db[_0xf5f2('0x21')][_0xf5f2('0x3f')]()[_0xf5f2('0x18')](respondWithResult(_0x218def,null))['catch'](handleError(_0x218def,null));};exports[_0xf5f2('0x40')]=function(_0x2e7193,_0x1c1497){var _0x29b108={'raw':!![],'where':{}},_0x12124d={},_0x10753a;return db[_0xf5f2('0x21')][_0xf5f2('0x41')]({'where':{'id':_0x2e7193['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x1c1497,null))[_0xf5f2('0x18')](function(_0x45db9a){if(_0x45db9a){_0x10753a=_0x45db9a['get']({'plain':!![]});_0x12124d[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x42')]['rawAttributes']);_0x12124d['query']=_[_0xf5f2('0x2d')](_0x2e7193[_0xf5f2('0x2e')]);_0x12124d['filters']=_[_0xf5f2('0x30')](_0x12124d['model'],_0x12124d[_0xf5f2('0x2e')]);_0x29b108['attributes']=_[_0xf5f2('0x30')](_0x12124d['model'],qs[_0xf5f2('0x32')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x29b108[_0xf5f2('0x31')]=_0x29b108['attributes'][_0xf5f2('0x43')]?_0x29b108[_0xf5f2('0x31')]:_0x12124d['model'];if(!_0x2e7193['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x29b108['limit']=qs[_0xf5f2('0x13')](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x29b108[_0xf5f2('0x11')]=qs['offset'](_0x2e7193['query'][_0xf5f2('0x11')]);}_0x29b108[_0xf5f2('0x46')]=qs['sort'](_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x29b108[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2e7193[_0xf5f2('0x2e')],_0x12124d[_0xf5f2('0x2f')]));_0x29b108['where']['SmsQueueId']=_0x45db9a['id'];if(_0x2e7193[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x29b108[_0xf5f2('0x26')]=_[_0xf5f2('0x4a')](_0x29b108[_0xf5f2('0x26')],{'$or':_['map'](_0x29b108[_0xf5f2('0x31')],function(_0x20ba91){var _0x18b124={};_0x18b124[_0x20ba91]={'$like':'%'+_0x2e7193['query'][_0xf5f2('0x49')]+'%'};return _0x18b124;})});}_0x29b108=_['merge']({},_0x29b108,_0x2e7193[_0xf5f2('0x34')]);return db[_0xf5f2('0x42')][_0xf5f2('0x28')](_0x29b108);}})[_0xf5f2('0x18')](function(_0x4afa4d){if(_0x4afa4d){return db['User'][_0xf5f2('0x4b')]({'where':{'id':_['map'](_0x4afa4d,_0xf5f2('0x4c')),'role':_0xf5f2('0x4d')},'attributes':['id','name',_0xf5f2('0x4e'),_0xf5f2('0x4f'),_0xf5f2('0x50')]});}})['then'](function(_0x397b99){if(_0x397b99){return{'count':_0x397b99[_0xf5f2('0x14')],'rows':_[_0xf5f2('0x20')](_0x397b99[_0xf5f2('0x29')],function(_0x51fa7e){return{'membername':_0x51fa7e[_0xf5f2('0x1f')],'UserId':_0x51fa7e['id'],'queue_name':_0x10753a['name'],'SmsQueueId':_0x10753a['id'],'interface':util[_0xf5f2('0x51')](_0xf5f2('0x52'),_0xf5f2('0x53'),_0x51fa7e[_0xf5f2('0x1f')]),'penalty':0x0,'paused':_0x51fa7e[_0xf5f2('0x4e')],'createdAt':_0x51fa7e['createdAt'],'updatedAt':_0x51fa7e[_0xf5f2('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf5f2('0x18')](respondWithFilteredResult(_0x1c1497,_0x29b108))[_0xf5f2('0x3d')](handleError(_0x1c1497,null));};exports[_0xf5f2('0x54')]=function(_0x2c5733,_0x5359b5){var _0x31e16b={};var _0x5ee6bc={};var _0x4c96ee;var _0xd4f6ef;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x2c5733[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5359b5,null))[_0xf5f2('0x18')](function(_0x5767fc){if(_0x5767fc){_0x4c96ee=_0x5767fc;_0x5ee6bc[_0xf5f2('0x2c')]=_[_0xf5f2('0x2d')](db[_0xf5f2('0x55')][_0xf5f2('0x22')]);_0x5ee6bc[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x2c5733[_0xf5f2('0x2e')]);_0x5ee6bc['filters']=_[_0xf5f2('0x30')](_0x5ee6bc[_0xf5f2('0x2c')],_0x5ee6bc[_0xf5f2('0x2e')]);_0x31e16b[_0xf5f2('0x31')]=_['intersection'](_0x5ee6bc[_0xf5f2('0x2c')],qs['fields'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x31e16b['attributes']=_0x31e16b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x31e16b[_0xf5f2('0x31')]:_0x5ee6bc[_0xf5f2('0x2c')];_0x31e16b[_0xf5f2('0x46')]=qs['sort'](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x31e16b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_[_0xf5f2('0x48')](_0x2c5733[_0xf5f2('0x2e')],_0x5ee6bc['filters']));if(_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x31e16b['where']=_[_0xf5f2('0x4a')](_0x31e16b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x31e16b['attributes'],function(_0x551cc9){var _0x4f3df6={};_0x4f3df6[_0x551cc9]={'$like':'%'+_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x49')]+'%'};return _0x4f3df6;})});}_0x31e16b=_[_0xf5f2('0x4a')]({},_0x31e16b,_0x2c5733[_0xf5f2('0x34')]);return _0x4c96ee[_0xf5f2('0x54')](_0x31e16b);}})['then'](function(_0x278b76){if(_0x278b76){_0xd4f6ef=_0x278b76[_0xf5f2('0x43')];if(!_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x31e16b[_0xf5f2('0x13')]=qs[_0xf5f2('0x13')](_0x2c5733[_0xf5f2('0x2e')][_0xf5f2('0x13')]);_0x31e16b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x2c5733['query']['offset']);}return _0x4c96ee['getTeams'](_0x31e16b);}})[_0xf5f2('0x18')](function(_0xafba8e){if(_0xafba8e){return _0xafba8e?{'count':_0xd4f6ef,'rows':_0xafba8e}:null;}})[_0xf5f2('0x18')](respondWithResult(_0x5359b5,null))[_0xf5f2('0x3d')](handleError(_0x5359b5,null));};exports[_0xf5f2('0x56')]=function(_0x5c6959,_0x9d943f){var _0x43c732=_0x5c6959[_0xf5f2('0x37')][_0xf5f2('0x57')];return db[_0xf5f2('0x55')]['findAll']({'where':{'id':_0x43c732},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':_0xf5f2('0x59'),'attributes':['id','name',_0xf5f2('0x5a'),_0xf5f2('0x5b'),_0xf5f2('0x5c')],'raw':!![]}]})[_0xf5f2('0x18')](function(_0x588434){if(_0x588434){var _0x40b36e=_[_0xf5f2('0x5d')](_0x588434,function(_0x19602d){var _0x2adeb4=_0x19602d[_0xf5f2('0x1a')]({'plain':!![]});return _0x2adeb4['Agents'];});return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x5c6959[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0xe3ea1e){return db['sequelize']['transaction'](function(_0x16048e){return _0xe3ea1e['addTeams'](_0x43c732,{'transaction':_0x16048e})['then'](function(){return BPromise['each'](_0x40b36e,function(_0x57cb18){return db[_0xf5f2('0x42')][_0xf5f2('0x5e')]({'where':{'UserId':_0x57cb18['id'],'SmsQueueId':_0x5c6959[_0xf5f2('0x2b')]['id']},'transaction':_0x16048e});});})[_0xf5f2('0x18')](function(){_0x40b36e[_0xf5f2('0x5f')](function(_0x9f941e){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':_0x9f941e['id'],'SmsQueueId':_0xe3ea1e['id']});});});});});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x9d943f,null))[_0xf5f2('0x3d')](handleError(_0x9d943f,null));};exports[_0xf5f2('0x62')]=function(_0x2afeac,_0x1ba503){return db[_0xf5f2('0x55')][_0xf5f2('0x28')]({'where':{'id':_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')]},'attributes':['id'],'include':[{'model':db[_0xf5f2('0x58')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xf5f2('0x18')](handleEntityNotFound(_0x1ba503,null))[_0xf5f2('0x18')](function(_0x21043b){var _0x2811ad=_[_0xf5f2('0x20')](_0x21043b,'id');var _0x308220=[];var _0x16491c=[];var _0xcf48eb=squel['select']();_0xcf48eb[_0xf5f2('0x63')]('tq.TeamId')['from']('team_has_sms_queues','tq')['join']('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xf5f2('0x26')](_0xf5f2('0x64'),_0x2afeac[_0xf5f2('0x2b')]['id']);for(var _0x375bc9=0x0;_0x375bc9<_0x21043b[_0xf5f2('0x43')];_0x375bc9+=0x1){let _0x3cf857=_0x21043b[_0x375bc9];for(var _0x5dc63f=0x0;_0x5dc63f<_0x3cf857['Agents'][_0xf5f2('0x43')];_0x5dc63f+=0x1){let _0x578a22=_0x3cf857[_0xf5f2('0x59')][_0x5dc63f];var _0x186fdd=_0xcf48eb['clone']();_0x186fdd['where'](_0xf5f2('0x65'),_0x578a22['id']);_0x16491c[_0xf5f2('0x66')](db['sequelize'][_0xf5f2('0x2e')](_0x186fdd[_0xf5f2('0x67')](),{'type':db['sequelize'][_0xf5f2('0x68')][_0xf5f2('0x69')]})[_0xf5f2('0x18')](function(_0x4c1678){if(_0x4c1678[_0xf5f2('0x43')]===0x1){return _0x578a22['id'];}else{var _0xc28adc=_[_0xf5f2('0x6a')](_[_0xf5f2('0x20')](_0x4c1678,_0xf5f2('0x6b')),function(_0x3e0288){return _[_0xf5f2('0x6c')](_0x2811ad,_0x3e0288);});if(_0xc28adc){return _0x578a22['id'];}}}));}}return BPromise[_0xf5f2('0x6d')](_0x16491c)[_0xf5f2('0x18')](function(_0x3a6f60){_0x308220=_(_0x308220)[_0xf5f2('0x6e')](_0x3a6f60)[_0xf5f2('0x6f')]()[_0xf5f2('0x70')]();return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2afeac[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](function(_0x29a9d4){return db[_0xf5f2('0x71')][_0xf5f2('0x72')](function(_0x800f42){return _0x29a9d4['removeTeams'](_0x2afeac[_0xf5f2('0x2e')][_0xf5f2('0x57')],{'transaction':_0x800f42})['then'](function(){if(!_[_0xf5f2('0x73')](_0x308220)){return _0x29a9d4[_0xf5f2('0x74')](_0x308220,{'transaction':_0x800f42});}})['then'](function(){_0x308220[_0xf5f2('0x5f')](function(_0x2f54eb){socket[_0xf5f2('0x60')]('userSmsQueue:remove',{'UserId':_0x2f54eb,'SmsQueueId':_0x29a9d4['id']});});});});});});})['then'](respondWithStatusCode(_0x1ba503,null))[_0xf5f2('0x3d')](handleError(_0x1ba503,null));};exports[_0xf5f2('0x75')]=function(_0x213ade,_0x5ba275){return db['SmsQueue'][_0xf5f2('0x35')]({'where':{'id':_0x213ade[_0xf5f2('0x2b')]['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5ba275,null))['then'](function(_0x4cde64){if(_0x4cde64){return _0x4cde64['addAgents'](_0x213ade['body']['ids'],_[_0xf5f2('0x76')](_0x213ade['body'],[_0xf5f2('0x57'),'id'])||{})[_0xf5f2('0x77')](function(_0xec3c35){for(var _0x43a167=0x0;_0x43a167<_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0xf5f2('0x43')];_0x43a167+=0x1){socket[_0xf5f2('0x60')](_0xf5f2('0x61'),{'UserId':Number(_0x213ade[_0xf5f2('0x37')][_0xf5f2('0x57')][_0x43a167]),'SmsQueueId':Number(_0x213ade[_0xf5f2('0x2b')]['id'])});}return _0xec3c35;});}})[_0xf5f2('0x18')](respondWithResult(_0x5ba275,null))['catch'](handleError(_0x5ba275,null));};exports[_0xf5f2('0x74')]=function(_0x2a4fed,_0x5783e2){return db[_0xf5f2('0x21')][_0xf5f2('0x35')]({'where':{'id':_0x2a4fed['params']['id']}})[_0xf5f2('0x18')](handleEntityNotFound(_0x5783e2,null))[_0xf5f2('0x18')](function(_0x281f61){if(_0x281f61){return _0x281f61['removeAgents'](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])['then'](function(){if(_[_0xf5f2('0x78')](_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')])){for(var _0x517aa8=0x0;_0x517aa8<_0x2a4fed[_0xf5f2('0x2e')]['ids'][_0xf5f2('0x43')];_0x517aa8+=0x1){socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed[_0xf5f2('0x2e')][_0xf5f2('0x57')][_0x517aa8]),'SmsQueueId':Number(_0x2a4fed[_0xf5f2('0x2b')]['id'])});}}else{socket['emit'](_0xf5f2('0x79'),{'UserId':Number(_0x2a4fed['query']['ids']),'SmsQueueId':Number(_0x2a4fed['params']['id'])});}});}})[_0xf5f2('0x18')](respondWithStatusCode(_0x5783e2,null))[_0xf5f2('0x3d')](handleError(_0x5783e2,null));};exports['getAgents']=function(_0x3c8a1b,_0x15025d){var _0x35790b={};var _0x3962b2={};var _0x28873e;var _0x1fc5ae;return db['SmsQueue'][_0xf5f2('0x41')]({'where':{'id':_0x3c8a1b[_0xf5f2('0x2b')]['id']}})['then'](handleEntityNotFound(_0x15025d,null))[_0xf5f2('0x18')](function(_0x19cbff){if(_0x19cbff){_0x28873e=_0x19cbff;_0x3962b2['model']=_[_0xf5f2('0x2d')](db[_0xf5f2('0x58')][_0xf5f2('0x22')]);_0x3962b2[_0xf5f2('0x2e')]=_[_0xf5f2('0x2d')](_0x3c8a1b[_0xf5f2('0x2e')]);_0x3962b2['filters']=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],_0x3962b2[_0xf5f2('0x2e')]);_0x35790b[_0xf5f2('0x31')]=_[_0xf5f2('0x30')](_0x3962b2[_0xf5f2('0x2c')],qs[_0xf5f2('0x32')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x32')]));_0x35790b['attributes']=_0x35790b[_0xf5f2('0x31')][_0xf5f2('0x43')]?_0x35790b[_0xf5f2('0x31')]:_0x3962b2[_0xf5f2('0x2c')];_0x35790b[_0xf5f2('0x46')]=qs[_0xf5f2('0x47')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x47')]);_0x35790b[_0xf5f2('0x26')]=qs[_0xf5f2('0x2f')](_['pick'](_0x3c8a1b['query'],_0x3962b2[_0xf5f2('0x2f')]));if(_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x49')]){_0x35790b[_0xf5f2('0x26')]=_['merge'](_0x35790b[_0xf5f2('0x26')],{'$or':_[_0xf5f2('0x20')](_0x35790b[_0xf5f2('0x31')],function(_0x3d7f53){var _0x456a1e={};_0x456a1e[_0x3d7f53]={'$like':'%'+_0x3c8a1b['query'][_0xf5f2('0x49')]+'%'};return _0x456a1e;})});}_0x35790b=_[_0xf5f2('0x4a')]({},_0x35790b,_0x3c8a1b['options']);return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})[_0xf5f2('0x18')](function(_0x2563fa){if(_0x2563fa){_0x1fc5ae=_0x2563fa[_0xf5f2('0x43')];if(!_0x3c8a1b['query'][_0xf5f2('0x44')](_0xf5f2('0x45'))){_0x35790b[_0xf5f2('0x13')]=qs['limit'](_0x3c8a1b['query'][_0xf5f2('0x13')]);_0x35790b[_0xf5f2('0x11')]=qs[_0xf5f2('0x11')](_0x3c8a1b[_0xf5f2('0x2e')][_0xf5f2('0x11')]);}return _0x28873e[_0xf5f2('0x7a')](_0x35790b);}})['then'](function(_0x39dee8){if(_0x39dee8){return _0x39dee8?{'count':_0x1fc5ae,'rows':_0x39dee8}:null;}})['then'](respondWithResult(_0x15025d,null))[_0xf5f2('0x3d')](handleError(_0x15025d,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index ce93ba6..11a1c85 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 _0x013c=['save','update','emit','hook','exports','SmsQueue'];(function(_0x358c86,_0x38a8a2){var _0x52edc5=function(_0x560096){while(--_0x560096){_0x358c86['push'](_0x358c86['shift']());}};_0x52edc5(++_0x38a8a2);}(_0x013c,0x143));var _0xc013=function(_0xa3c06b,_0x490f99){_0xa3c06b=_0xa3c06b-0x0;var _0x33aa1d=_0x013c[_0xa3c06b];return _0x33aa1d;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0xc013('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc013('0x1'),'afterUpdate':_0xc013('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2ea05a){return function(_0x1b834d,_0x3a57cc,_0xc011d5){SmsQueueEvents[_0xc013('0x3')](_0x2ea05a+':'+_0x1b834d['id'],_0x1b834d);SmsQueueEvents[_0xc013('0x3')](_0x2ea05a,_0x1b834d);_0xc011d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc013('0x4')](e,emitEvent(event));}}module[_0xc013('0x5')]=SmsQueueEvents; \ No newline at end of file +var _0x5e62=['emit','exports','SmsQueue','save','remove'];(function(_0x4f5887,_0x282239){var _0x228b54=function(_0xe3c271){while(--_0xe3c271){_0x4f5887['push'](_0x4f5887['shift']());}};_0x228b54(++_0x282239);}(_0x5e62,0x1ec));var _0x25e6=function(_0x3826ad,_0x49a30d){_0x3826ad=_0x3826ad-0x0;var _0x17b900=_0x5e62[_0x3826ad];return _0x17b900;};'use strict';var EventEmitter=require('events');var SmsQueue=require('../../mysqldb')['db'][_0x25e6('0x0')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25e6('0x1'),'afterUpdate':'update','afterDestroy':_0x25e6('0x2')};function emitEvent(_0x38e190){return function(_0x1b4716,_0x6c818f,_0x555922){SmsQueueEvents[_0x25e6('0x3')](_0x38e190+':'+_0x1b4716['id'],_0x1b4716);SmsQueueEvents[_0x25e6('0x3')](_0x38e190,_0x1b4716);_0x555922(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x25e6('0x4')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 18a2a61..2cdba97 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 _0x655d=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x655d,0x15e));var _0xd655=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x655d[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0xd655('0x0'));var util=require(_0xd655('0x1'));var logger=require(_0xd655('0x2'))(_0xd655('0x3'));var moment=require(_0xd655('0x4'));var BPromise=require('bluebird');var rp=require(_0xd655('0x5'));var fs=require('fs');var path=require(_0xd655('0x6'));var rimraf=require(_0xd655('0x7'));var config=require(_0xd655('0x8'));var attributes=require(_0xd655('0x9'));module[_0xd655('0xa')]=function(_0x5b4c30,_0x420de5){return _0x5b4c30[_0xd655('0xb')](_0xd655('0xc'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2498=['path','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2e5f01,_0x2e05d9){var _0x1e94f3=function(_0x524d59){while(--_0x524d59){_0x2e5f01['push'](_0x2e5f01['shift']());}};_0x1e94f3(++_0x2e05d9);}(_0x2498,0x132));var _0x8249=function(_0x1afcb2,_0x4045cd){_0x1afcb2=_0x1afcb2-0x0;var _0x11cb27=_0x2498[_0x1afcb2];return _0x11cb27;};'use strict';var _=require('lodash');var util=require(_0x8249('0x0'));var logger=require(_0x8249('0x1'))(_0x8249('0x2'));var moment=require(_0x8249('0x3'));var BPromise=require(_0x8249('0x4'));var rp=require(_0x8249('0x5'));var fs=require('fs');var path=require(_0x8249('0x6'));var rimraf=require('rimraf');var config=require(_0x8249('0x7'));var attributes=require(_0x8249('0x8'));module[_0x8249('0x9')]=function(_0x4b4cc8,_0xa90be8){return _0x4b4cc8[_0x8249('0xa')](_0x8249('0xb'),attributes,{'tableName':_0x8249('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.rpc.js b/server/api/smsQueue/smsQueue.rpc.js index f5844e8..178e024 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 _0x4b79=['then','SmsQueue,\x20%s,\x20%s','request\x20sent','code','error','message','result','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','info','debug','ShowSmsQueue','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','request'];(function(_0x4c075b,_0x56c2e7){var _0x228448=function(_0x37c25c){while(--_0x37c25c){_0x4c075b['push'](_0x4c075b['shift']());}};_0x228448(++_0x56c2e7);}(_0x4b79,0xb7));var _0x94b7=function(_0x256b62,_0x215512){_0x256b62=_0x256b62-0x0;var _0x1babfd=_0x4b79[_0x256b62];return _0x1babfd;};'use strict';var _=require(_0x94b7('0x0'));var util=require(_0x94b7('0x1'));var moment=require(_0x94b7('0x2'));var BPromise=require('bluebird');var rs=require(_0x94b7('0x3'));var fs=require('fs');var Redis=require(_0x94b7('0x4'));var db=require(_0x94b7('0x5'))['db'];var utils=require(_0x94b7('0x6'));var logger=require(_0x94b7('0x7'))(_0x94b7('0x8'));var config=require(_0x94b7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x94b7('0xa')]['http']({'port':0x232a});config[_0x94b7('0xb')]=_[_0x94b7('0xc')](config[_0x94b7('0xb')],{'host':_0x94b7('0xd'),'port':0x18eb});var socket=require(_0x94b7('0xe'))(new Redis(config['redis']));require(_0x94b7('0xf'))['register'](socket);function respondWithRpcPromise(_0x495566,_0x40cf16,_0x4dee95){return new BPromise(function(_0x581e59,_0x1ddb0a){return client[_0x94b7('0x10')](_0x495566,_0x4dee95)[_0x94b7('0x11')](function(_0x4ab65c){logger['info'](_0x94b7('0x12'),_0x40cf16,_0x94b7('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x40cf16,_0x94b7('0x13'),JSON['stringify'](_0x4ab65c));if(_0x4ab65c['error']){if(_0x4ab65c['error'][_0x94b7('0x14')]===0x1f4){logger[_0x94b7('0x15')](_0x94b7('0x12'),_0x40cf16,_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);return _0x1ddb0a(_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);}logger[_0x94b7('0x15')](_0x94b7('0x12'),_0x40cf16,_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);return _0x581e59(_0x4ab65c[_0x94b7('0x15')][_0x94b7('0x16')]);}else{logger['info'](_0x94b7('0x12'),_0x40cf16,'request\x20sent');_0x581e59(_0x4ab65c[_0x94b7('0x17')][_0x94b7('0x16')]);}})['catch'](function(_0x43859d){logger[_0x94b7('0x15')](_0x94b7('0x12'),_0x40cf16,_0x43859d);_0x1ddb0a(_0x43859d);});});}exports[_0x94b7('0x18')]=function(_0x433331){var _0x1293af=this;return new Promise(function(_0x227ec2,_0x6c68f9){return db[_0x94b7('0x19')][_0x94b7('0x1a')]({'raw':_0x433331['options']?_0x433331[_0x94b7('0x1b')][_0x94b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x433331[_0x94b7('0x1b')]?_0x433331[_0x94b7('0x1b')][_0x94b7('0x1d')]||null:null,'attributes':_0x433331[_0x94b7('0x1b')]?_0x433331[_0x94b7('0x1b')][_0x94b7('0x1e')]||null:null,'limit':_0x433331['options']?_0x433331['options'][_0x94b7('0x1f')]||null:null,'include':_0x433331[_0x94b7('0x1b')]?_0x433331['options'][_0x94b7('0x20')]?_[_0x94b7('0x21')](_0x433331['options'][_0x94b7('0x20')],function(_0x28984d){return{'model':db[_0x28984d['model']],'as':_0x28984d['as'],'attributes':_0x28984d[_0x94b7('0x1e')],'include':_0x28984d[_0x94b7('0x20')]?_['map'](_0x28984d['include'],function(_0x57f891){return{'model':db[_0x57f891['model']],'as':_0x57f891['as'],'attributes':_0x57f891[_0x94b7('0x1e')],'include':_0x57f891[_0x94b7('0x20')]?_['map'](_0x57f891[_0x94b7('0x20')],function(_0x42e6a0){return{'model':db[_0x42e6a0[_0x94b7('0x22')]],'as':_0x42e6a0['as'],'attributes':_0x42e6a0[_0x94b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x94b7('0x11')](function(_0x4af4ab){logger[_0x94b7('0x23')](_0x94b7('0x18'),_0x433331);logger[_0x94b7('0x24')](_0x94b7('0x18'),_0x433331,JSON['stringify'](_0x4af4ab));_0x227ec2(_0x4af4ab);})['catch'](function(_0x2870c9){logger[_0x94b7('0x15')]('GetSmsQueue',_0x2870c9['message'],_0x433331);_0x6c68f9(_0x1293af[_0x94b7('0x15')](0x1f4,_0x2870c9[_0x94b7('0x16')]));});});};exports['ShowSmsQueue']=function(_0x4d6e63){var _0x64600a=this;return new Promise(function(_0x3d0850,_0x4a6064){return db[_0x94b7('0x19')]['find']({'raw':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x1c')]===undefined?!![]:![]:!![],'where':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x1d')]||null:null,'attributes':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x1e')]||null:null,'include':_0x4d6e63[_0x94b7('0x1b')]?_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x20')]?_[_0x94b7('0x21')](_0x4d6e63[_0x94b7('0x1b')][_0x94b7('0x20')],function(_0x367169){return{'model':db[_0x367169[_0x94b7('0x22')]],'as':_0x367169['as'],'attributes':_0x367169[_0x94b7('0x1e')],'include':_0x367169[_0x94b7('0x20')]?_['map'](_0x367169['include'],function(_0x270090){return{'model':db[_0x270090['model']],'as':_0x270090['as'],'attributes':_0x270090[_0x94b7('0x1e')],'include':_0x270090[_0x94b7('0x20')]?_[_0x94b7('0x21')](_0x270090['include'],function(_0x2b1e51){return{'model':db[_0x2b1e51['model']],'as':_0x2b1e51['as'],'attributes':_0x2b1e51[_0x94b7('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x94b7('0x11')](function(_0x1cd291){logger['info'](_0x94b7('0x25'),_0x4d6e63);logger[_0x94b7('0x24')]('ShowSmsQueue',_0x4d6e63,JSON[_0x94b7('0x26')](_0x1cd291));_0x3d0850(_0x1cd291);})[_0x94b7('0x27')](function(_0x39df81){logger[_0x94b7('0x15')](_0x94b7('0x25'),_0x39df81['message'],_0x4d6e63);_0x4a6064(_0x64600a[_0x94b7('0x15')](0x1f4,_0x39df81['message']));});});}; \ No newline at end of file +var _0xc98f=['client','redis','defaults','./smsQueue.socket','register','request','then','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetSmsQueue','SmsQueue','options','where','include','map','model','attributes','info','ShowSmsQueue','find','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0xc98f,0x81));var _0xfc98=function(_0x82d35a,_0x3e4858){_0x82d35a=_0x82d35a-0x0;var _0x54b078=_0xc98f[_0x82d35a];return _0x54b078;};'use strict';var _=require('lodash');var util=require(_0xfc98('0x0'));var moment=require(_0xfc98('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc98('0x2'));var db=require(_0xfc98('0x3'))['db'];var utils=require(_0xfc98('0x4'));var logger=require(_0xfc98('0x5'))('rpc');var config=require(_0xfc98('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfc98('0x7')]['http']({'port':0x232a});config[_0xfc98('0x8')]=_[_0xfc98('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc98('0x8')]));require(_0xfc98('0xa'))[_0xfc98('0xb')](socket);function respondWithRpcPromise(_0x16a89b,_0x1bd6d8,_0x224189){return new BPromise(function(_0x261c41,_0x45a3dc){return client[_0xfc98('0xc')](_0x16a89b,_0x224189)[_0xfc98('0xd')](function(_0x55fda4){logger['info'](_0xfc98('0xe'),_0x1bd6d8,_0xfc98('0xf'));logger[_0xfc98('0x10')](_0xfc98('0x11'),_0x1bd6d8,'request\x20sent',JSON[_0xfc98('0x12')](_0x55fda4));if(_0x55fda4[_0xfc98('0x13')]){if(_0x55fda4[_0xfc98('0x13')][_0xfc98('0x14')]===0x1f4){logger[_0xfc98('0x13')]('SmsQueue,\x20%s,\x20%s',_0x1bd6d8,_0x55fda4[_0xfc98('0x13')][_0xfc98('0x15')]);return _0x45a3dc(_0x55fda4[_0xfc98('0x13')][_0xfc98('0x15')]);}logger[_0xfc98('0x13')]('SmsQueue,\x20%s,\x20%s',_0x1bd6d8,_0x55fda4[_0xfc98('0x13')][_0xfc98('0x15')]);return _0x261c41(_0x55fda4[_0xfc98('0x13')]['message']);}else{logger['info'](_0xfc98('0xe'),_0x1bd6d8,'request\x20sent');_0x261c41(_0x55fda4[_0xfc98('0x16')][_0xfc98('0x15')]);}})['catch'](function(_0x178ffb){logger[_0xfc98('0x13')](_0xfc98('0xe'),_0x1bd6d8,_0x178ffb);_0x45a3dc(_0x178ffb);});});}exports[_0xfc98('0x17')]=function(_0x2905ea){var _0x3ab0bb=this;return new Promise(function(_0x4ebac9,_0x9df101){return db[_0xfc98('0x18')]['findAll']({'raw':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')][_0xfc98('0x1a')]||null:null,'attributes':_0x2905ea['options']?_0x2905ea[_0xfc98('0x19')]['attributes']||null:null,'limit':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')]['limit']||null:null,'include':_0x2905ea[_0xfc98('0x19')]?_0x2905ea[_0xfc98('0x19')][_0xfc98('0x1b')]?_[_0xfc98('0x1c')](_0x2905ea[_0xfc98('0x19')]['include'],function(_0x25414a){return{'model':db[_0x25414a[_0xfc98('0x1d')]],'as':_0x25414a['as'],'attributes':_0x25414a[_0xfc98('0x1e')],'include':_0x25414a[_0xfc98('0x1b')]?_[_0xfc98('0x1c')](_0x25414a[_0xfc98('0x1b')],function(_0x3cc05a){return{'model':db[_0x3cc05a[_0xfc98('0x1d')]],'as':_0x3cc05a['as'],'attributes':_0x3cc05a[_0xfc98('0x1e')],'include':_0x3cc05a['include']?_[_0xfc98('0x1c')](_0x3cc05a[_0xfc98('0x1b')],function(_0x641b66){return{'model':db[_0x641b66[_0xfc98('0x1d')]],'as':_0x641b66['as'],'attributes':_0x641b66[_0xfc98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc98('0xd')](function(_0x4cfa4f){logger[_0xfc98('0x1f')](_0xfc98('0x17'),_0x2905ea);logger['debug']('GetSmsQueue',_0x2905ea,JSON[_0xfc98('0x12')](_0x4cfa4f));_0x4ebac9(_0x4cfa4f);})['catch'](function(_0x25340d){logger[_0xfc98('0x13')](_0xfc98('0x17'),_0x25340d[_0xfc98('0x15')],_0x2905ea);_0x9df101(_0x3ab0bb['error'](0x1f4,_0x25340d[_0xfc98('0x15')]));});});};exports[_0xfc98('0x20')]=function(_0x47395c){var _0x13f52a=this;return new Promise(function(_0x527c08,_0xce667){return db['SmsQueue'][_0xfc98('0x21')]({'raw':_0x47395c[_0xfc98('0x19')]?_0x47395c['options']['raw']===undefined?!![]:![]:!![],'where':_0x47395c[_0xfc98('0x19')]?_0x47395c[_0xfc98('0x19')][_0xfc98('0x1a')]||null:null,'attributes':_0x47395c[_0xfc98('0x19')]?_0x47395c[_0xfc98('0x19')][_0xfc98('0x1e')]||null:null,'include':_0x47395c['options']?_0x47395c['options'][_0xfc98('0x1b')]?_[_0xfc98('0x1c')](_0x47395c[_0xfc98('0x19')][_0xfc98('0x1b')],function(_0x5ab76b){return{'model':db[_0x5ab76b[_0xfc98('0x1d')]],'as':_0x5ab76b['as'],'attributes':_0x5ab76b[_0xfc98('0x1e')],'include':_0x5ab76b[_0xfc98('0x1b')]?_['map'](_0x5ab76b[_0xfc98('0x1b')],function(_0x2b93d0){return{'model':db[_0x2b93d0['model']],'as':_0x2b93d0['as'],'attributes':_0x2b93d0[_0xfc98('0x1e')],'include':_0x2b93d0['include']?_['map'](_0x2b93d0[_0xfc98('0x1b')],function(_0x36e586){return{'model':db[_0x36e586[_0xfc98('0x1d')]],'as':_0x36e586['as'],'attributes':_0x36e586[_0xfc98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xfc98('0xd')](function(_0x4dbadd){logger[_0xfc98('0x1f')]('ShowSmsQueue',_0x47395c);logger[_0xfc98('0x10')](_0xfc98('0x20'),_0x47395c,JSON[_0xfc98('0x12')](_0x4dbadd));_0x527c08(_0x4dbadd);})['catch'](function(_0x4ef434){logger[_0xfc98('0x13')](_0xfc98('0x20'),_0x4ef434[_0xfc98('0x15')],_0x47395c);_0xce667(_0x13f52a[_0xfc98('0x13')](0x1f4,_0x4ef434[_0xfc98('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index c59bdc9..33d840a 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 _0x249e=['removeListener','register','remove','update','emit'];(function(_0x35cf4c,_0x3e8879){var _0x13c701=function(_0x57fe6f){while(--_0x57fe6f){_0x35cf4c['push'](_0x35cf4c['shift']());}};_0x13c701(++_0x3e8879);}(_0x249e,0x129));var _0xe249=function(_0x121738,_0x1dfb89){_0x121738=_0x121738-0x0;var _0x164a3c=_0x249e[_0x121738];return _0x164a3c;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xe249('0x0'),_0xe249('0x1')];function createListener(_0x32d6b5,_0x1c214c){return function(_0x214a21){_0x1c214c[_0xe249('0x2')](_0x32d6b5,_0x214a21);};}function removeListener(_0x39c53d,_0x4c0ccb){return function(){SmsQueueEvents[_0xe249('0x3')](_0x39c53d,_0x4c0ccb);};}exports[_0xe249('0x4')]=function(_0x28a534){for(var _0x16dab5=0x0,_0x5d6f07=events['length'];_0x16dab5<_0x5d6f07;_0x16dab5++){var _0x1b6121=events[_0x16dab5];var _0x41c585=createListener('smsQueue:'+_0x1b6121,_0x28a534);SmsQueueEvents['on'](_0x1b6121,_0x41c585);}}; \ No newline at end of file +var _0x9d0a=['save','remove','emit','removeListener','register','smsQueue:'];(function(_0x431537,_0xb9bb6c){var _0x3a60cd=function(_0x5c9087){while(--_0x5c9087){_0x431537['push'](_0x431537['shift']());}};_0x3a60cd(++_0xb9bb6c);}(_0x9d0a,0xde));var _0xa9d0=function(_0x3944b3,_0xf05375){_0x3944b3=_0x3944b3-0x0;var _0xbf7a53=_0x9d0a[_0x3944b3];return _0xbf7a53;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=[_0xa9d0('0x0'),_0xa9d0('0x1'),'update'];function createListener(_0x3217f3,_0x292587){return function(_0x16d744){_0x292587[_0xa9d0('0x2')](_0x3217f3,_0x16d744);};}function removeListener(_0x569642,_0x3d39e3){return function(){SmsQueueEvents[_0xa9d0('0x3')](_0x569642,_0x3d39e3);};}exports[_0xa9d0('0x4')]=function(_0x451eac){for(var _0x45f9aa=0x0,_0x48e3e3=events['length'];_0x45f9aa<_0x48e3e3;_0x45f9aa++){var _0x13e849=events[_0x45f9aa];var _0x50d5ba=createListener(_0xa9d0('0x5')+_0x13e849,_0x451eac);SmsQueueEvents['on'](_0x13e849,_0x50d5ba);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 53c8335..e34807e 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 _0x1c3a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','multer','util','path'];(function(_0x40514c,_0x387dc3){var _0x48f285=function(_0x8145ee){while(--_0x8145ee){_0x40514c['push'](_0x40514c['shift']());}};_0x48f285(++_0x387dc3);}(_0x1c3a,0x9d));var _0xa1c3=function(_0x2e75c8,_0x43557b){_0x2e75c8=_0x2e75c8-0x0;var _0x4ebdd0=_0x1c3a[_0x2e75c8];return _0x4ebdd0;};'use strict';var multer=require(_0xa1c3('0x0'));var util=require(_0xa1c3('0x1'));var path=require(_0xa1c3('0x2'));var timeout=require('connect-timeout');var express=require(_0xa1c3('0x3'));var router=express[_0xa1c3('0x4')]();var fs_extra=require(_0xa1c3('0x5'));var auth=require(_0xa1c3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xa1c3('0x7'));var controller=require('./smsQueueReport.controller');router[_0xa1c3('0x8')]('/',auth['isAuthenticated'](),controller[_0xa1c3('0x9')]);router[_0xa1c3('0x8')](_0xa1c3('0xa'),auth[_0xa1c3('0xb')](),controller[_0xa1c3('0xc')]);router[_0xa1c3('0x8')](_0xa1c3('0xd'),auth['isAuthenticated'](),controller[_0xa1c3('0xe')]);router[_0xa1c3('0xf')]('/',auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x10')]);router[_0xa1c3('0x11')](_0xa1c3('0xd'),auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x12')]);router['delete']('/:id',auth[_0xa1c3('0xb')](),controller[_0xa1c3('0x13')]);module['exports']=router; \ No newline at end of file +var _0xba2d=['../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','index','/:id','show','post','put','delete','destroy','exports','util','../../components/auth/service'];(function(_0x133106,_0x156b40){var _0x5ddfac=function(_0x4765c3){while(--_0x4765c3){_0x133106['push'](_0x133106['shift']());}};_0x5ddfac(++_0x156b40);}(_0xba2d,0xa3));var _0xdba2=function(_0x10403d,_0x3a7685){_0x10403d=_0x10403d-0x0;var _0x2c6d9d=_0xba2d[_0x10403d];return _0x2c6d9d;};'use strict';var multer=require('multer');var util=require(_0xdba2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xdba2('0x1'));var interaction=require(_0xdba2('0x2'));var config=require(_0xdba2('0x3'));var controller=require(_0xdba2('0x4'));router[_0xdba2('0x5')]('/',auth[_0xdba2('0x6')](),controller[_0xdba2('0x7')]);router[_0xdba2('0x5')]('/describe',auth[_0xdba2('0x6')](),controller['describe']);router[_0xdba2('0x5')](_0xdba2('0x8'),auth[_0xdba2('0x6')](),controller[_0xdba2('0x9')]);router[_0xdba2('0xa')]('/',auth[_0xdba2('0x6')](),controller['create']);router[_0xdba2('0xb')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xdba2('0xc')](_0xdba2('0x8'),auth[_0xdba2('0x6')](),controller[_0xdba2('0xd')]);module[_0xdba2('0xe')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 6668367..b347b6f 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 _0x7cd3=['DATE','moment','sequelize','exports','STRING'];(function(_0x4c062d,_0x13d802){var _0x30dcff=function(_0x5c9b13){while(--_0x5c9b13){_0x4c062d['push'](_0x4c062d['shift']());}};_0x30dcff(++_0x13d802);}(_0x7cd3,0xab));var _0x37cd=function(_0x5818c5,_0x51bb8c){_0x5818c5=_0x5818c5-0x0;var _0x36acd9=_0x7cd3[_0x5818c5];return _0x36acd9;};'use strict';var moment=require(_0x37cd('0x0'));var Sequelize=require(_0x37cd('0x1'));module[_0x37cd('0x2')]={'uniqueid':{'type':Sequelize[_0x37cd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x37cd('0x3')]},'joinAt':{'type':Sequelize[_0x37cd('0x4')]},'leaveAt':{'type':Sequelize[_0x37cd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x37cd('0x4')]},'reason':{'type':Sequelize[_0x37cd('0x3')]}}; \ No newline at end of file +var _0xdf3b=['DATE','sequelize','STRING'];(function(_0x34668e,_0xcc9efb){var _0x1a9f0f=function(_0x119838){while(--_0x119838){_0x34668e['push'](_0x34668e['shift']());}};_0x1a9f0f(++_0xcc9efb);}(_0xdf3b,0x172));var _0xbdf3=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0xdf3b[_0xbc1a4b];return _0x108b87;};'use strict';var moment=require('moment');var Sequelize=require(_0xbdf3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xbdf3('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0xbdf3('0x1')]},'joinAt':{'type':Sequelize[_0xbdf3('0x2')]},'leaveAt':{'type':Sequelize[_0xbdf3('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xbdf3('0x2')]},'reason':{'type':Sequelize[_0xbdf3('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index 0b9a065..b8d5f94 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 _0xc9be=['ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','SmsQueueReport','count','includeAll','findAll','catch','show','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring'];(function(_0x28391c,_0x3b889c){var _0x54ac4b=function(_0x49d1c7){while(--_0x49d1c7){_0x28391c['push'](_0x28391c['shift']());}};_0x54ac4b(++_0x3b889c);}(_0xc9be,0x87));var _0xec9b=function(_0x43b278,_0x4708e3){_0x43b278=_0x43b278-0x0;var _0x370c2d=_0xc9be[_0x43b278];return _0x370c2d;};'use strict';var emlformat=require(_0xec9b('0x0'));var rimraf=require(_0xec9b('0x1'));var zipdir=require(_0xec9b('0x2'));var jsonpatch=require(_0xec9b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xec9b('0x4'));var Mustache=require(_0xec9b('0x5'));var util=require(_0xec9b('0x6'));var path=require(_0xec9b('0x7'));var sox=require(_0xec9b('0x8'));var csv=require(_0xec9b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec9b('0xa'));var _=require(_0xec9b('0xb'));var squel=require('squel');var crypto=require(_0xec9b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xec9b('0xd'));var toCsv=require(_0xec9b('0x9'));var querystring=require(_0xec9b('0xe'));var Papa=require('papaparse');var Redis=require(_0xec9b('0xf'));var authService=require(_0xec9b('0x10'));var qs=require(_0xec9b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec9b('0x12'));var logger=require(_0xec9b('0x13'))('api');var utils=require(_0xec9b('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xec9b('0x15'));var db=require(_0xec9b('0x16'))['db'];function respondWithStatusCode(_0x307f1e,_0x1dd955){_0x1dd955=_0x1dd955||0xcc;return function(_0x50fed3){if(_0x50fed3){return _0x307f1e[_0xec9b('0x17')](_0x1dd955);}return _0x307f1e[_0xec9b('0x18')](_0x1dd955)[_0xec9b('0x19')]();};}function respondWithResult(_0x56c16a,_0x383419){_0x383419=_0x383419||0xc8;return function(_0x1f72bb){if(_0x1f72bb){return _0x56c16a[_0xec9b('0x18')](_0x383419)[_0xec9b('0x1a')](_0x1f72bb);}};}function respondWithFilteredResult(_0x108450,_0x4fa09a){return function(_0x2fd4f2){if(_0x2fd4f2){var _0x1a0aff=typeof _0x4fa09a['offset']==='undefined'&&typeof _0x4fa09a['limit']===_0xec9b('0x1b');var _0x347e7a=_0x2fd4f2['count'];var _0x5e19a9=_0x1a0aff?0x0:_0x4fa09a[_0xec9b('0x1c')];var _0x7ae3e9=_0x1a0aff?_0x2fd4f2['count']:_0x4fa09a[_0xec9b('0x1c')]+_0x4fa09a[_0xec9b('0x1d')];var _0x2b5e47;if(_0x7ae3e9>=_0x347e7a){_0x7ae3e9=_0x347e7a;_0x2b5e47=0xc8;}else{_0x2b5e47=0xce;}_0x108450['status'](_0x2b5e47);return _0x108450[_0xec9b('0x1e')](_0xec9b('0x1f'),_0x5e19a9+'-'+_0x7ae3e9+'/'+_0x347e7a)[_0xec9b('0x1a')](_0x2fd4f2);}return null;};}function patchUpdates(_0x24cc76){return function(_0x380efd){try{jsonpatch[_0xec9b('0x20')](_0x380efd,_0x24cc76,!![]);}catch(_0x33f4db){return BPromise[_0xec9b('0x21')](_0x33f4db);}return _0x380efd[_0xec9b('0x22')]();};}function saveUpdates(_0x136458,_0x2a173e){return function(_0x3d666f){if(_0x3d666f){return _0x3d666f[_0xec9b('0x23')](_0x136458)['then'](function(_0x25ba5a){return _0x25ba5a;});}return null;};}function removeEntity(_0x2a4d96,_0x2dd362){return function(_0x32f295){if(_0x32f295){return _0x32f295[_0xec9b('0x24')]()[_0xec9b('0x25')](function(){_0x2a4d96[_0xec9b('0x18')](0xcc)[_0xec9b('0x19')]();});}};}function handleEntityNotFound(_0x467e1d,_0x3d2ea7){return function(_0x27d670){if(!_0x27d670){_0x467e1d[_0xec9b('0x17')](0x194);}return _0x27d670;};}function handleError(_0x8375d6,_0x4a4019){_0x4a4019=_0x4a4019||0x1f4;return function(_0x451bed){logger[_0xec9b('0x26')](_0x451bed[_0xec9b('0x27')]);if(_0x451bed[_0xec9b('0x28')]){delete _0x451bed[_0xec9b('0x28')];}_0x8375d6[_0xec9b('0x18')](_0x4a4019)[_0xec9b('0x29')](_0x451bed);};}exports[_0xec9b('0x2a')]=function(_0x11777a,_0x175f5e){var _0x571709={},_0x9609d8={},_0x6190f7={'count':0x0,'rows':[]};var _0x201240=_[_0xec9b('0x2b')](db['SmsQueueReport'][_0xec9b('0x2c')],function(_0x809c11){return{'name':_0x809c11[_0xec9b('0x2d')],'type':_0x809c11[_0xec9b('0x2e')][_0xec9b('0x2f')]};});_0x9609d8[_0xec9b('0x30')]=_['map'](_0x201240,_0xec9b('0x28'));_0x9609d8[_0xec9b('0x31')]=_[_0xec9b('0x32')](_0x11777a[_0xec9b('0x31')]);_0x9609d8[_0xec9b('0x33')]=_['intersection'](_0x9609d8[_0xec9b('0x30')],_0x9609d8['query']);_0x571709[_0xec9b('0x34')]=_[_0xec9b('0x35')](_0x9609d8[_0xec9b('0x30')],qs['fields'](_0x11777a[_0xec9b('0x31')][_0xec9b('0x36')]));_0x571709[_0xec9b('0x34')]=_0x571709[_0xec9b('0x34')][_0xec9b('0x37')]?_0x571709[_0xec9b('0x34')]:_0x9609d8[_0xec9b('0x30')];if(!_0x11777a[_0xec9b('0x31')][_0xec9b('0x38')](_0xec9b('0x39'))){_0x571709[_0xec9b('0x1d')]=qs[_0xec9b('0x1d')](_0x11777a[_0xec9b('0x31')][_0xec9b('0x1d')]);_0x571709[_0xec9b('0x1c')]=qs[_0xec9b('0x1c')](_0x11777a[_0xec9b('0x31')][_0xec9b('0x1c')]);}_0x571709['order']=qs['sort'](_0x11777a['query'][_0xec9b('0x3a')]);_0x571709['where']=qs[_0xec9b('0x33')](_[_0xec9b('0x3b')](_0x11777a[_0xec9b('0x31')],_0x9609d8[_0xec9b('0x33')]),_0x201240);if(_0x11777a[_0xec9b('0x31')][_0xec9b('0x3c')]){_0x571709[_0xec9b('0x3d')]=_[_0xec9b('0x3e')](_0x571709[_0xec9b('0x3d')],{'$or':_['map'](_0x201240,function(_0x5479cb){if(_0x5479cb[_0xec9b('0x2e')]!==_0xec9b('0x3f')){var _0x24767e={};_0x24767e[_0x5479cb['name']]={'$like':'%'+_0x11777a[_0xec9b('0x31')][_0xec9b('0x3c')]+'%'};return _0x24767e;}})});}_0x571709=_[_0xec9b('0x3e')]({},_0x571709,_0x11777a['options']);var _0x2f5d08={'where':_0x571709[_0xec9b('0x3d')]};return db[_0xec9b('0x40')][_0xec9b('0x41')](_0x2f5d08)['then'](function(_0x212774){_0x6190f7['count']=_0x212774;if(_0x11777a[_0xec9b('0x31')][_0xec9b('0x42')]){_0x571709['include']=[{'all':!![]}];}return db[_0xec9b('0x40')][_0xec9b('0x43')](_0x571709);})[_0xec9b('0x25')](function(_0x65d678){_0x6190f7['rows']=_0x65d678;return _0x6190f7;})[_0xec9b('0x25')](respondWithFilteredResult(_0x175f5e,_0x571709))[_0xec9b('0x44')](handleError(_0x175f5e,null));};exports[_0xec9b('0x45')]=function(_0x2d861e,_0x2a9ef3){var _0x518622={'raw':!![],'where':{'id':_0x2d861e['params']['id']}},_0x2e28fa={};_0x2e28fa[_0xec9b('0x30')]=_['keys'](db['SmsQueueReport']['rawAttributes']);_0x2e28fa[_0xec9b('0x31')]=_[_0xec9b('0x32')](_0x2d861e[_0xec9b('0x31')]);_0x2e28fa[_0xec9b('0x33')]=_[_0xec9b('0x35')](_0x2e28fa['model'],_0x2e28fa['query']);_0x518622[_0xec9b('0x34')]=_[_0xec9b('0x35')](_0x2e28fa['model'],qs[_0xec9b('0x36')](_0x2d861e[_0xec9b('0x31')][_0xec9b('0x36')]));_0x518622[_0xec9b('0x34')]=_0x518622['attributes'][_0xec9b('0x37')]?_0x518622[_0xec9b('0x34')]:_0x2e28fa['model'];if(_0x2d861e[_0xec9b('0x31')]['includeAll']){_0x518622['include']=[{'all':!![]}];}_0x518622=_[_0xec9b('0x3e')]({},_0x518622,_0x2d861e[_0xec9b('0x46')]);return db['SmsQueueReport'][_0xec9b('0x47')](_0x518622)[_0xec9b('0x25')](handleEntityNotFound(_0x2a9ef3,null))[_0xec9b('0x25')](respondWithResult(_0x2a9ef3,null))[_0xec9b('0x44')](handleError(_0x2a9ef3,null));};exports[_0xec9b('0x48')]=function(_0x32406e,_0x6a13d2){return db['SmsQueueReport'][_0xec9b('0x48')](_0x32406e['body'],{})[_0xec9b('0x25')](respondWithResult(_0x6a13d2,0xc9))[_0xec9b('0x44')](handleError(_0x6a13d2,null));};exports[_0xec9b('0x23')]=function(_0x2f6dbc,_0x2137f5){if(_0x2f6dbc['body']['id']){delete _0x2f6dbc[_0xec9b('0x49')]['id'];}return db[_0xec9b('0x40')][_0xec9b('0x47')]({'where':{'id':_0x2f6dbc['params']['id']}})[_0xec9b('0x25')](handleEntityNotFound(_0x2137f5,null))['then'](saveUpdates(_0x2f6dbc[_0xec9b('0x49')],null))['then'](respondWithResult(_0x2137f5,null))['catch'](handleError(_0x2137f5,null));};exports['destroy']=function(_0x1141e3,_0x502540){return db[_0xec9b('0x40')][_0xec9b('0x47')]({'where':{'id':_0x1141e3['params']['id']}})[_0xec9b('0x25')](handleEntityNotFound(_0x502540,null))[_0xec9b('0x25')](removeEntity(_0x502540,null))[_0xec9b('0x44')](handleError(_0x502540,null));};exports[_0xec9b('0x4a')]=function(_0x30eec6,_0x2d3fa1){return db[_0xec9b('0x40')][_0xec9b('0x4a')]()[_0xec9b('0x25')](respondWithResult(_0x2d3fa1,null))[_0xec9b('0x44')](handleError(_0x2d3fa1,null));}; \ No newline at end of file +var _0x4514=['../../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','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','pick','where','merge','VIRTUAL','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils'];(function(_0x2c09c5,_0x4c1ae3){var _0x4cc01d=function(_0x32bca0){while(--_0x32bca0){_0x2c09c5['push'](_0x2c09c5['shift']());}};_0x4cc01d(++_0x4c1ae3);}(_0x4514,0x1a8));var _0x4451=function(_0x408a02,_0x478ca0){_0x408a02=_0x408a02-0x0;var _0x579bce=_0x4514[_0x408a02];return _0x579bce;};'use strict';var emlformat=require(_0x4451('0x0'));var rimraf=require(_0x4451('0x1'));var zipdir=require(_0x4451('0x2'));var jsonpatch=require(_0x4451('0x3'));var rp=require(_0x4451('0x4'));var moment=require('moment');var BPromise=require(_0x4451('0x5'));var Mustache=require('mustache');var util=require(_0x4451('0x6'));var path=require(_0x4451('0x7'));var sox=require(_0x4451('0x8'));var csv=require(_0x4451('0x9'));var ejs=require(_0x4451('0xa'));var fs=require('fs');var fs_extra=require(_0x4451('0xb'));var _=require(_0x4451('0xc'));var squel=require('squel');var crypto=require(_0x4451('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4451('0xe'));var toCsv=require(_0x4451('0x9'));var querystring=require('querystring');var Papa=require(_0x4451('0xf'));var Redis=require(_0x4451('0x10'));var authService=require(_0x4451('0x11'));var qs=require(_0x4451('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4451('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x4451('0x14'));var db=require(_0x4451('0x15'))['db'];function respondWithStatusCode(_0x304ccc,_0x258466){_0x258466=_0x258466||0xcc;return function(_0x6e7a47){if(_0x6e7a47){return _0x304ccc[_0x4451('0x16')](_0x258466);}return _0x304ccc[_0x4451('0x17')](_0x258466)[_0x4451('0x18')]();};}function respondWithResult(_0x4dd8cc,_0x1ed4a5){_0x1ed4a5=_0x1ed4a5||0xc8;return function(_0x2868fb){if(_0x2868fb){return _0x4dd8cc[_0x4451('0x17')](_0x1ed4a5)[_0x4451('0x19')](_0x2868fb);}};}function respondWithFilteredResult(_0x51168b,_0x21a56c){return function(_0x3944bf){if(_0x3944bf){var _0x1a83e3=typeof _0x21a56c[_0x4451('0x1a')]===_0x4451('0x1b')&&typeof _0x21a56c['limit']===_0x4451('0x1b');var _0x48bbde=_0x3944bf['count'];var _0xb21d46=_0x1a83e3?0x0:_0x21a56c['offset'];var _0x534567=_0x1a83e3?_0x3944bf[_0x4451('0x1c')]:_0x21a56c[_0x4451('0x1a')]+_0x21a56c[_0x4451('0x1d')];var _0x4b00b4;if(_0x534567>=_0x48bbde){_0x534567=_0x48bbde;_0x4b00b4=0xc8;}else{_0x4b00b4=0xce;}_0x51168b[_0x4451('0x17')](_0x4b00b4);return _0x51168b[_0x4451('0x1e')](_0x4451('0x1f'),_0xb21d46+'-'+_0x534567+'/'+_0x48bbde)['json'](_0x3944bf);}return null;};}function patchUpdates(_0x4086b6){return function(_0x119578){try{jsonpatch[_0x4451('0x20')](_0x119578,_0x4086b6,!![]);}catch(_0x31dc5c){return BPromise[_0x4451('0x21')](_0x31dc5c);}return _0x119578[_0x4451('0x22')]();};}function saveUpdates(_0x1e83ea,_0x5c50f0){return function(_0x367da3){if(_0x367da3){return _0x367da3[_0x4451('0x23')](_0x1e83ea)[_0x4451('0x24')](function(_0x229d50){return _0x229d50;});}return null;};}function removeEntity(_0xd97006,_0x9693b4){return function(_0xf078c5){if(_0xf078c5){return _0xf078c5[_0x4451('0x25')]()[_0x4451('0x24')](function(){_0xd97006[_0x4451('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3cd171,_0x5696d5){return function(_0x48b96a){if(!_0x48b96a){_0x3cd171[_0x4451('0x16')](0x194);}return _0x48b96a;};}function handleError(_0x517cce,_0x23601f){_0x23601f=_0x23601f||0x1f4;return function(_0x21a17d){logger[_0x4451('0x26')](_0x21a17d[_0x4451('0x27')]);if(_0x21a17d[_0x4451('0x28')]){delete _0x21a17d['name'];}_0x517cce[_0x4451('0x17')](_0x23601f)[_0x4451('0x29')](_0x21a17d);};}exports[_0x4451('0x2a')]=function(_0x24c67f,_0x4b8cd6){var _0x48476d={},_0x209e7d={},_0x281d77={'count':0x0,'rows':[]};var _0x489c11=_[_0x4451('0x2b')](db['SmsQueueReport'][_0x4451('0x2c')],function(_0x4709a3){return{'name':_0x4709a3[_0x4451('0x2d')],'type':_0x4709a3[_0x4451('0x2e')][_0x4451('0x2f')]};});_0x209e7d[_0x4451('0x30')]=_['map'](_0x489c11,_0x4451('0x28'));_0x209e7d[_0x4451('0x31')]=_[_0x4451('0x32')](_0x24c67f['query']);_0x209e7d[_0x4451('0x33')]=_[_0x4451('0x34')](_0x209e7d[_0x4451('0x30')],_0x209e7d[_0x4451('0x31')]);_0x48476d['attributes']=_[_0x4451('0x34')](_0x209e7d[_0x4451('0x30')],qs[_0x4451('0x35')](_0x24c67f[_0x4451('0x31')]['fields']));_0x48476d[_0x4451('0x36')]=_0x48476d[_0x4451('0x36')][_0x4451('0x37')]?_0x48476d[_0x4451('0x36')]:_0x209e7d[_0x4451('0x30')];if(!_0x24c67f[_0x4451('0x31')]['hasOwnProperty'](_0x4451('0x38'))){_0x48476d['limit']=qs[_0x4451('0x1d')](_0x24c67f[_0x4451('0x31')]['limit']);_0x48476d[_0x4451('0x1a')]=qs[_0x4451('0x1a')](_0x24c67f[_0x4451('0x31')][_0x4451('0x1a')]);}_0x48476d['order']=qs['sort'](_0x24c67f[_0x4451('0x31')]['sort']);_0x48476d['where']=qs[_0x4451('0x33')](_[_0x4451('0x39')](_0x24c67f['query'],_0x209e7d[_0x4451('0x33')]),_0x489c11);if(_0x24c67f[_0x4451('0x31')]['filter']){_0x48476d[_0x4451('0x3a')]=_[_0x4451('0x3b')](_0x48476d[_0x4451('0x3a')],{'$or':_['map'](_0x489c11,function(_0x2cfeb9){if(_0x2cfeb9[_0x4451('0x2e')]!==_0x4451('0x3c')){var _0x3f33a7={};_0x3f33a7[_0x2cfeb9[_0x4451('0x28')]]={'$like':'%'+_0x24c67f[_0x4451('0x31')]['filter']+'%'};return _0x3f33a7;}})});}_0x48476d=_[_0x4451('0x3b')]({},_0x48476d,_0x24c67f['options']);var _0x2658d7={'where':_0x48476d['where']};return db[_0x4451('0x3d')][_0x4451('0x1c')](_0x2658d7)[_0x4451('0x24')](function(_0xa9f9){_0x281d77[_0x4451('0x1c')]=_0xa9f9;if(_0x24c67f[_0x4451('0x31')][_0x4451('0x3e')]){_0x48476d[_0x4451('0x3f')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x4451('0x40')](_0x48476d);})['then'](function(_0x417791){_0x281d77[_0x4451('0x41')]=_0x417791;return _0x281d77;})[_0x4451('0x24')](respondWithFilteredResult(_0x4b8cd6,_0x48476d))[_0x4451('0x42')](handleError(_0x4b8cd6,null));};exports[_0x4451('0x43')]=function(_0x29c5ec,_0x23c077){var _0x12d010={'raw':!![],'where':{'id':_0x29c5ec[_0x4451('0x44')]['id']}},_0x109587={};_0x109587['model']=_[_0x4451('0x32')](db[_0x4451('0x3d')][_0x4451('0x2c')]);_0x109587[_0x4451('0x31')]=_[_0x4451('0x32')](_0x29c5ec[_0x4451('0x31')]);_0x109587[_0x4451('0x33')]=_[_0x4451('0x34')](_0x109587[_0x4451('0x30')],_0x109587[_0x4451('0x31')]);_0x12d010[_0x4451('0x36')]=_[_0x4451('0x34')](_0x109587[_0x4451('0x30')],qs[_0x4451('0x35')](_0x29c5ec[_0x4451('0x31')][_0x4451('0x35')]));_0x12d010[_0x4451('0x36')]=_0x12d010['attributes']['length']?_0x12d010[_0x4451('0x36')]:_0x109587[_0x4451('0x30')];if(_0x29c5ec[_0x4451('0x31')][_0x4451('0x3e')]){_0x12d010[_0x4451('0x3f')]=[{'all':!![]}];}_0x12d010=_[_0x4451('0x3b')]({},_0x12d010,_0x29c5ec[_0x4451('0x45')]);return db[_0x4451('0x3d')][_0x4451('0x46')](_0x12d010)['then'](handleEntityNotFound(_0x23c077,null))[_0x4451('0x24')](respondWithResult(_0x23c077,null))[_0x4451('0x42')](handleError(_0x23c077,null));};exports[_0x4451('0x47')]=function(_0x46d516,_0x7a25fd){return db['SmsQueueReport'][_0x4451('0x47')](_0x46d516[_0x4451('0x48')],{})[_0x4451('0x24')](respondWithResult(_0x7a25fd,0xc9))['catch'](handleError(_0x7a25fd,null));};exports['update']=function(_0xca66f3,_0x469922){if(_0xca66f3[_0x4451('0x48')]['id']){delete _0xca66f3[_0x4451('0x48')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0xca66f3[_0x4451('0x44')]['id']}})[_0x4451('0x24')](handleEntityNotFound(_0x469922,null))['then'](saveUpdates(_0xca66f3[_0x4451('0x48')],null))[_0x4451('0x24')](respondWithResult(_0x469922,null))[_0x4451('0x42')](handleError(_0x469922,null));};exports[_0x4451('0x25')]=function(_0x870349,_0x4f5337){return db[_0x4451('0x3d')][_0x4451('0x46')]({'where':{'id':_0x870349[_0x4451('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f5337,null))['then'](removeEntity(_0x4f5337,null))[_0x4451('0x42')](handleError(_0x4f5337,null));};exports[_0x4451('0x49')]=function(_0x41d452,_0x1b80d2){return db[_0x4451('0x3d')][_0x4451('0x49')]()[_0x4451('0x24')](respondWithResult(_0x1b80d2,null))[_0x4451('0x42')](handleError(_0x1b80d2,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 26d6ddf..ceeeb0d 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x4a5b23,_0x322ee8){var _0x5e01bc=function(_0xd0ba5d){while(--_0xd0ba5d){_0x4a5b23['push'](_0x4a5b23['shift']());}};_0x5e01bc(++_0x322ee8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['define','SmsQueueReport','uniqueid','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'report_sms_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0a9e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 48745d7..63e3067 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 _0x558d=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','CreateSmsQueueReport','SmsQueueReport','create','body','raw','stringify','catch','UpdateSmsQueueReport','update','options','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x58f57f,_0x23028c){var _0x318b7f=function(_0x1f239b){while(--_0x1f239b){_0x58f57f['push'](_0x58f57f['shift']());}};_0x318b7f(++_0x23028c);}(_0x558d,0x1b6));var _0xd558=function(_0x1d128e,_0x2c87de){_0x1d128e=_0x1d128e-0x0;var _0x3d5236=_0x558d[_0x1d128e];return _0x3d5236;};'use strict';var _=require(_0xd558('0x0'));var util=require(_0xd558('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd558('0x2'));var fs=require('fs');var Redis=require(_0xd558('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd558('0x4'));var logger=require(_0xd558('0x5'))(_0xd558('0x6'));var config=require(_0xd558('0x7'));var jayson=require(_0xd558('0x8'));var client=jayson[_0xd558('0x9')][_0xd558('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8f1f40,_0x2be49d,_0x1cd4ae){return new BPromise(function(_0x1ba5c2,_0x18b318){return client[_0xd558('0xb')](_0x8f1f40,_0x1cd4ae)[_0xd558('0xc')](function(_0x25d280){logger[_0xd558('0xd')](_0xd558('0xe'),_0x2be49d,_0xd558('0xf'));logger[_0xd558('0x10')](_0xd558('0x11'),_0x2be49d,_0xd558('0xf'),JSON['stringify'](_0x25d280));if(_0x25d280[_0xd558('0x12')]){if(_0x25d280[_0xd558('0x12')][_0xd558('0x13')]===0x1f4){logger[_0xd558('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x2be49d,_0x25d280['error']['message']);return _0x18b318(_0x25d280[_0xd558('0x12')]['message']);}logger['error'](_0xd558('0xe'),_0x2be49d,_0x25d280[_0xd558('0x12')]['message']);return _0x1ba5c2(_0x25d280[_0xd558('0x12')]['message']);}else{logger[_0xd558('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0x2be49d,_0xd558('0xf'));_0x1ba5c2(_0x25d280['result'][_0xd558('0x14')]);}})['catch'](function(_0x2ea3ee){logger[_0xd558('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x2be49d,_0x2ea3ee);_0x18b318(_0x2ea3ee);});});}exports[_0xd558('0x15')]=function(_0x525f6c){var _0x2bbccc=this;return new Promise(function(_0x2b23d0,_0x24b472){return db[_0xd558('0x16')][_0xd558('0x17')](_0x525f6c[_0xd558('0x18')],{'raw':_0x525f6c['options']?_0x525f6c['options'][_0xd558('0x19')]===undefined?!![]:![]:!![]})[_0xd558('0xc')](function(_0xa78fd2){logger[_0xd558('0xd')](_0xd558('0x15'),_0x525f6c);logger[_0xd558('0x10')]('CreateSmsQueueReport',_0x525f6c,JSON[_0xd558('0x1a')](_0xa78fd2));_0x2b23d0(_0xa78fd2);})[_0xd558('0x1b')](function(_0xc15eea){logger[_0xd558('0x12')](_0xd558('0x15'),_0xc15eea[_0xd558('0x14')],_0x525f6c);_0x24b472(_0x2bbccc['error'](0x1f4,_0xc15eea[_0xd558('0x14')]));});});};exports[_0xd558('0x1c')]=function(_0x2b9e12){var _0x520192=this;return new Promise(function(_0x59aac6,_0x21e7b4){return db['SmsQueueReport'][_0xd558('0x1d')](_0x2b9e12[_0xd558('0x18')],{'raw':_0x2b9e12[_0xd558('0x1e')]?_0x2b9e12[_0xd558('0x1e')][_0xd558('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b9e12['options']?_0x2b9e12['options'][_0xd558('0x1f')]||null:null,'attributes':_0x2b9e12['options']?_0x2b9e12['options'][_0xd558('0x20')]||null:null,'limit':_0x2b9e12['options']?_0x2b9e12['options'][_0xd558('0x21')]||null:null})['then'](function(_0x5c0127){logger[_0xd558('0xd')](_0xd558('0x1c'),_0x2b9e12);logger[_0xd558('0x10')](_0xd558('0x1c'),_0x2b9e12,JSON[_0xd558('0x1a')](_0x5c0127));_0x59aac6(_0x5c0127);})[_0xd558('0x1b')](function(_0x5e44eb){logger[_0xd558('0x12')]('UpdateSmsQueueReport',_0x5e44eb[_0xd558('0x14')],_0x2b9e12);_0x21e7b4(_0x520192['error'](0x1f4,_0x5e44eb[_0xd558('0x14')]));});});}; \ No newline at end of file +var _0x03e3=['http','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','UpdateSmsQueueReport','update','body','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x5cbf3a,_0x31b32b){var _0x360805=function(_0x13b23a){while(--_0x13b23a){_0x5cbf3a['push'](_0x5cbf3a['shift']());}};_0x360805(++_0x31b32b);}(_0x03e3,0xee));var _0x303e=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x03e3[_0x279d37];return _0x530173;};'use strict';var _=require(_0x303e('0x0'));var util=require('util');var moment=require(_0x303e('0x1'));var BPromise=require(_0x303e('0x2'));var rs=require(_0x303e('0x3'));var fs=require('fs');var Redis=require(_0x303e('0x4'));var db=require(_0x303e('0x5'))['db'];var utils=require(_0x303e('0x6'));var logger=require(_0x303e('0x7'))('rpc');var config=require(_0x303e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x303e('0x9')][_0x303e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x292c5f,_0x82b6fa,_0x229e40){return new BPromise(function(_0x48819e,_0xba13b5){return client['request'](_0x292c5f,_0x229e40)[_0x303e('0xb')](function(_0x573e9e){logger[_0x303e('0xc')](_0x303e('0xd'),_0x82b6fa,_0x303e('0xe'));logger[_0x303e('0xf')]('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x82b6fa,_0x303e('0xe'),JSON[_0x303e('0x10')](_0x573e9e));if(_0x573e9e[_0x303e('0x11')]){if(_0x573e9e[_0x303e('0x11')][_0x303e('0x12')]===0x1f4){logger[_0x303e('0x11')](_0x303e('0xd'),_0x82b6fa,_0x573e9e[_0x303e('0x11')][_0x303e('0x13')]);return _0xba13b5(_0x573e9e['error'][_0x303e('0x13')]);}logger[_0x303e('0x11')](_0x303e('0xd'),_0x82b6fa,_0x573e9e[_0x303e('0x11')][_0x303e('0x13')]);return _0x48819e(_0x573e9e['error'][_0x303e('0x13')]);}else{logger[_0x303e('0xc')]('SmsQueueReport,\x20%s,\x20%s',_0x82b6fa,_0x303e('0xe'));_0x48819e(_0x573e9e[_0x303e('0x14')][_0x303e('0x13')]);}})[_0x303e('0x15')](function(_0x4d9d46){logger[_0x303e('0x11')](_0x303e('0xd'),_0x82b6fa,_0x4d9d46);_0xba13b5(_0x4d9d46);});});}exports[_0x303e('0x16')]=function(_0x3e1f43){var _0x3199db=this;return new Promise(function(_0x3d2ff3,_0x545235){return db[_0x303e('0x17')][_0x303e('0x18')](_0x3e1f43['body'],{'raw':_0x3e1f43['options']?_0x3e1f43[_0x303e('0x19')][_0x303e('0x1a')]===undefined?!![]:![]:!![]})[_0x303e('0xb')](function(_0x12bc88){logger['info'](_0x303e('0x16'),_0x3e1f43);logger[_0x303e('0xf')](_0x303e('0x16'),_0x3e1f43,JSON[_0x303e('0x10')](_0x12bc88));_0x3d2ff3(_0x12bc88);})[_0x303e('0x15')](function(_0x49195a){logger[_0x303e('0x11')](_0x303e('0x16'),_0x49195a[_0x303e('0x13')],_0x3e1f43);_0x545235(_0x3199db[_0x303e('0x11')](0x1f4,_0x49195a['message']));});});};exports[_0x303e('0x1b')]=function(_0x275d36){var _0x50965c=this;return new Promise(function(_0x53aca9,_0x2e1316){return db[_0x303e('0x17')][_0x303e('0x1c')](_0x275d36[_0x303e('0x1d')],{'raw':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')][_0x303e('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')][_0x303e('0x1e')]||null:null,'attributes':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')]['attributes']||null:null,'limit':_0x275d36[_0x303e('0x19')]?_0x275d36[_0x303e('0x19')]['limit']||null:null})['then'](function(_0x19b1ea){logger[_0x303e('0xc')]('UpdateSmsQueueReport',_0x275d36);logger[_0x303e('0xf')](_0x303e('0x1b'),_0x275d36,JSON[_0x303e('0x10')](_0x19b1ea));_0x53aca9(_0x19b1ea);})[_0x303e('0x15')](function(_0x43d4ee){logger['error'](_0x303e('0x1b'),_0x43d4ee[_0x303e('0x13')],_0x275d36);_0x2e1316(_0x50965c[_0x303e('0x11')](0x1f4,_0x43d4ee['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 4b0ee10..0209dc3 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 _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0x21ce44,_0x551287){var _0x4c0df3=function(_0x3c3960){while(--_0x3c3960){_0x21ce44['push'](_0x21ce44['shift']());}};_0x4c0df3(++_0x551287);}(_0x5636,0x102));var _0x6563=function(_0x3fed2,_0x4bd01e){_0x3fed2=_0x3fed2-0x0;var _0x2dfe1e=_0x5636[_0x3fed2];return _0x2dfe1e;};'use strict';var multer=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6563('0x2')]();var fs_extra=require(_0x6563('0x3'));var auth=require(_0x6563('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6563('0x5'));var controller=require(_0x6563('0x6'));router[_0x6563('0x7')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('0x12')]=router; \ No newline at end of file +var _0x8d0e=['/describe','isAuthenticated','describe','/:id','post','create','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','index','get'];(function(_0x5411cb,_0x1cd69d){var _0x32727a=function(_0x22a762){while(--_0x22a762){_0x5411cb['push'](_0x5411cb['shift']());}};_0x32727a(++_0x1cd69d);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x294abb,_0x5ac422){_0x294abb=_0x294abb-0x0;var _0x1ea75a=_0x8d0e[_0x294abb];return _0x1ea75a;};'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']('/',auth['isAuthenticated'](),controller[_0xe8d0('0xa')]);router[_0xe8d0('0xb')](_0xe8d0('0xc'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0xe')]);router[_0xe8d0('0xb')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller['show']);router[_0xe8d0('0x10')]('/',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x11')]);router['put']('/:id',auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x12')]);router[_0xe8d0('0x13')](_0xe8d0('0xf'),auth[_0xe8d0('0xd')](),controller[_0xe8d0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 17ebf6b..bf23a4f 100644 --- a/server/api/smsTransferReport/smsTransferReport.attributes.js +++ b/server/api/smsTransferReport/smsTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0x9c44,0x178));var _0x49c4=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x9c44[_0x50a0c2];return _0x5ebadd;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x456d08,_0x3c6888){var _0xc05953=function(_0x47389e){while(--_0x47389e){_0x456d08['push'](_0x456d08['shift']());}};_0xc05953(++_0x3c6888);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf3cd[_0x2b5eae];return _0x5f3ac9;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 599c60b..c361887 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 _0x984d=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','end','error','stack','name','send','map','SmsTransferReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','length','include','find','create','body','update','params','destroy','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js'];(function(_0x4c9f6a,_0xcb2cb2){var _0x5df5b9=function(_0x303cf2){while(--_0x303cf2){_0x4c9f6a['push'](_0x4c9f6a['shift']());}};_0x5df5b9(++_0xcb2cb2);}(_0x984d,0x11a));var _0xd984=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x984d[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xd984('0x0'));var rimraf=require(_0xd984('0x1'));var zipdir=require(_0xd984('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd984('0x3'));var moment=require('moment');var BPromise=require(_0xd984('0x4'));var Mustache=require(_0xd984('0x5'));var util=require(_0xd984('0x6'));var path=require('path');var sox=require(_0xd984('0x7'));var csv=require(_0xd984('0x8'));var ejs=require(_0xd984('0x9'));var fs=require('fs');var fs_extra=require(_0xd984('0xa'));var _=require(_0xd984('0xb'));var squel=require(_0xd984('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd984('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd984('0xe'));var as=require(_0xd984('0xf'));var hardwareService=require(_0xd984('0x10'));var logger=require('../../config/logger')(_0xd984('0x11'));var utils=require('../../config/utils');var config=require(_0xd984('0x12'));var licenseUtil=require(_0xd984('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x80b6b3,_0x1dcf0f){_0x1dcf0f=_0x1dcf0f||0xcc;return function(_0x20f7a0){if(_0x20f7a0){return _0x80b6b3[_0xd984('0x14')](_0x1dcf0f);}return _0x80b6b3[_0xd984('0x15')](_0x1dcf0f)['end']();};}function respondWithResult(_0xa6443b,_0x372145){_0x372145=_0x372145||0xc8;return function(_0x26a966){if(_0x26a966){return _0xa6443b[_0xd984('0x15')](_0x372145)[_0xd984('0x16')](_0x26a966);}};}function respondWithFilteredResult(_0x5e3863,_0x3b2da7){return function(_0x450e21){if(_0x450e21){var _0x378fc9=typeof _0x3b2da7[_0xd984('0x17')]===_0xd984('0x18')&&typeof _0x3b2da7[_0xd984('0x19')]==='undefined';var _0xb379ce=_0x450e21[_0xd984('0x1a')];var _0x295326=_0x378fc9?0x0:_0x3b2da7[_0xd984('0x17')];var _0x1ba13f=_0x378fc9?_0x450e21[_0xd984('0x1a')]:_0x3b2da7[_0xd984('0x17')]+_0x3b2da7[_0xd984('0x19')];var _0x4b2005;if(_0x1ba13f>=_0xb379ce){_0x1ba13f=_0xb379ce;_0x4b2005=0xc8;}else{_0x4b2005=0xce;}_0x5e3863[_0xd984('0x15')](_0x4b2005);return _0x5e3863[_0xd984('0x1b')](_0xd984('0x1c'),_0x295326+'-'+_0x1ba13f+'/'+_0xb379ce)['json'](_0x450e21);}return null;};}function patchUpdates(_0x3beaae){return function(_0x546b8a){try{jsonpatch[_0xd984('0x1d')](_0x546b8a,_0x3beaae,!![]);}catch(_0x51c03e){return BPromise[_0xd984('0x1e')](_0x51c03e);}return _0x546b8a[_0xd984('0x1f')]();};}function saveUpdates(_0xd8c5c,_0x2c13a3){return function(_0x2e3564){if(_0x2e3564){return _0x2e3564['update'](_0xd8c5c)[_0xd984('0x20')](function(_0x5615d0){return _0x5615d0;});}return null;};}function removeEntity(_0x27bbf8,_0x2c5bdb){return function(_0x58367a){if(_0x58367a){return _0x58367a['destroy']()[_0xd984('0x20')](function(){_0x27bbf8[_0xd984('0x15')](0xcc)[_0xd984('0x21')]();});}};}function handleEntityNotFound(_0x739e3b,_0x5afbdb){return function(_0x3882f9){if(!_0x3882f9){_0x739e3b['sendStatus'](0x194);}return _0x3882f9;};}function handleError(_0x16b25b,_0x5d1c9b){_0x5d1c9b=_0x5d1c9b||0x1f4;return function(_0x1fc67f){logger[_0xd984('0x22')](_0x1fc67f[_0xd984('0x23')]);if(_0x1fc67f['name']){delete _0x1fc67f[_0xd984('0x24')];}_0x16b25b['status'](_0x5d1c9b)[_0xd984('0x25')](_0x1fc67f);};}exports['index']=function(_0x5902c7,_0x53c080){var _0x2e04af={},_0x3fc40b={},_0x451739={'count':0x0,'rows':[]};var _0x3afa19=_[_0xd984('0x26')](db[_0xd984('0x27')][_0xd984('0x28')],function(_0x5e9112){return{'name':_0x5e9112[_0xd984('0x29')],'type':_0x5e9112[_0xd984('0x2a')][_0xd984('0x2b')]};});_0x3fc40b['model']=_[_0xd984('0x26')](_0x3afa19,_0xd984('0x24'));_0x3fc40b[_0xd984('0x2c')]=_[_0xd984('0x2d')](_0x5902c7['query']);_0x3fc40b[_0xd984('0x2e')]=_[_0xd984('0x2f')](_0x3fc40b['model'],_0x3fc40b[_0xd984('0x2c')]);_0x2e04af[_0xd984('0x30')]=_[_0xd984('0x2f')](_0x3fc40b['model'],qs[_0xd984('0x31')](_0x5902c7[_0xd984('0x2c')]['fields']));_0x2e04af['attributes']=_0x2e04af[_0xd984('0x30')]['length']?_0x2e04af[_0xd984('0x30')]:_0x3fc40b[_0xd984('0x32')];if(!_0x5902c7['query'][_0xd984('0x33')](_0xd984('0x34'))){_0x2e04af[_0xd984('0x19')]=qs[_0xd984('0x19')](_0x5902c7[_0xd984('0x2c')][_0xd984('0x19')]);_0x2e04af[_0xd984('0x17')]=qs['offset'](_0x5902c7[_0xd984('0x2c')][_0xd984('0x17')]);}_0x2e04af[_0xd984('0x35')]=qs['sort'](_0x5902c7[_0xd984('0x2c')][_0xd984('0x36')]);_0x2e04af[_0xd984('0x37')]=qs[_0xd984('0x2e')](_[_0xd984('0x38')](_0x5902c7[_0xd984('0x2c')],_0x3fc40b[_0xd984('0x2e')]),_0x3afa19);if(_0x5902c7[_0xd984('0x2c')]['filter']){_0x2e04af[_0xd984('0x37')]=_[_0xd984('0x39')](_0x2e04af[_0xd984('0x37')],{'$or':_['map'](_0x3afa19,function(_0x215612){if(_0x215612[_0xd984('0x2a')]!==_0xd984('0x3a')){var _0x34582e={};_0x34582e[_0x215612[_0xd984('0x24')]]={'$like':'%'+_0x5902c7[_0xd984('0x2c')]['filter']+'%'};return _0x34582e;}})});}_0x2e04af=_[_0xd984('0x39')]({},_0x2e04af,_0x5902c7[_0xd984('0x3b')]);var _0x488376={'where':_0x2e04af[_0xd984('0x37')]};return db['SmsTransferReport'][_0xd984('0x1a')](_0x488376)[_0xd984('0x20')](function(_0x29eeeb){_0x451739[_0xd984('0x1a')]=_0x29eeeb;if(_0x5902c7[_0xd984('0x2c')][_0xd984('0x3c')]){_0x2e04af['include']=[{'all':!![]}];}return db[_0xd984('0x27')][_0xd984('0x3d')](_0x2e04af);})[_0xd984('0x20')](function(_0x1978fa){_0x451739[_0xd984('0x3e')]=_0x1978fa;return _0x451739;})[_0xd984('0x20')](respondWithFilteredResult(_0x53c080,_0x2e04af))[_0xd984('0x3f')](handleError(_0x53c080,null));};exports[_0xd984('0x40')]=function(_0x39d65b,_0x1ad0a6){var _0x29c297={'raw':!![],'where':{'id':_0x39d65b['params']['id']}},_0x6f41ab={};_0x6f41ab[_0xd984('0x32')]=_[_0xd984('0x2d')](db['SmsTransferReport'][_0xd984('0x28')]);_0x6f41ab[_0xd984('0x2c')]=_[_0xd984('0x2d')](_0x39d65b[_0xd984('0x2c')]);_0x6f41ab[_0xd984('0x2e')]=_[_0xd984('0x2f')](_0x6f41ab[_0xd984('0x32')],_0x6f41ab[_0xd984('0x2c')]);_0x29c297[_0xd984('0x30')]=_[_0xd984('0x2f')](_0x6f41ab[_0xd984('0x32')],qs[_0xd984('0x31')](_0x39d65b['query'][_0xd984('0x31')]));_0x29c297[_0xd984('0x30')]=_0x29c297[_0xd984('0x30')][_0xd984('0x41')]?_0x29c297[_0xd984('0x30')]:_0x6f41ab[_0xd984('0x32')];if(_0x39d65b[_0xd984('0x2c')][_0xd984('0x3c')]){_0x29c297[_0xd984('0x42')]=[{'all':!![]}];}_0x29c297=_[_0xd984('0x39')]({},_0x29c297,_0x39d65b[_0xd984('0x3b')]);return db[_0xd984('0x27')][_0xd984('0x43')](_0x29c297)['then'](handleEntityNotFound(_0x1ad0a6,null))[_0xd984('0x20')](respondWithResult(_0x1ad0a6,null))['catch'](handleError(_0x1ad0a6,null));};exports[_0xd984('0x44')]=function(_0x42864e,_0x561cf5){return db[_0xd984('0x27')][_0xd984('0x44')](_0x42864e[_0xd984('0x45')],{})[_0xd984('0x20')](respondWithResult(_0x561cf5,0xc9))[_0xd984('0x3f')](handleError(_0x561cf5,null));};exports[_0xd984('0x46')]=function(_0x32be02,_0x3bcae0){if(_0x32be02[_0xd984('0x45')]['id']){delete _0x32be02[_0xd984('0x45')]['id'];}return db[_0xd984('0x27')][_0xd984('0x43')]({'where':{'id':_0x32be02[_0xd984('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bcae0,null))[_0xd984('0x20')](saveUpdates(_0x32be02['body'],null))['then'](respondWithResult(_0x3bcae0,null))['catch'](handleError(_0x3bcae0,null));};exports[_0xd984('0x48')]=function(_0x3721e8,_0x5f0156){return db[_0xd984('0x27')]['find']({'where':{'id':_0x3721e8[_0xd984('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f0156,null))[_0xd984('0x20')](removeEntity(_0x5f0156,null))[_0xd984('0x3f')](handleError(_0x5f0156,null));};exports[_0xd984('0x49')]=function(_0x4151cd,_0x37d3bd){return db['SmsTransferReport'][_0xd984('0x49')]()['then'](respondWithResult(_0x37d3bd,null))['catch'](handleError(_0x37d3bd,null));}; \ No newline at end of file +var _0x6614=['zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','count','offset','Content-Range','json','reject','save','update','then','destroy','end','error','stack','name','send','index','SmsTransferReport','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','limit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','show','rawAttributes','include','find','catch','create','body','params','describe','eml-format','rimraf'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0x6614,0xe8));var _0x4661=function(_0x1b999f,_0xada878){_0x1b999f=_0x1b999f-0x0;var _0x51d27a=_0x6614[_0x1b999f];return _0x51d27a;};'use strict';var emlformat=require(_0x4661('0x0'));var rimraf=require(_0x4661('0x1'));var zipdir=require(_0x4661('0x2'));var jsonpatch=require(_0x4661('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x4661('0x4'));var util=require(_0x4661('0x5'));var path=require(_0x4661('0x6'));var sox=require(_0x4661('0x7'));var csv=require(_0x4661('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4661('0x9'));var _=require(_0x4661('0xa'));var squel=require(_0x4661('0xb'));var crypto=require(_0x4661('0xc'));var jsforce=require(_0x4661('0xd'));var deskjs=require(_0x4661('0xe'));var toCsv=require(_0x4661('0x8'));var querystring=require('querystring');var Papa=require(_0x4661('0xf'));var Redis=require(_0x4661('0x10'));var authService=require(_0x4661('0x11'));var qs=require(_0x4661('0x12'));var as=require(_0x4661('0x13'));var hardwareService=require(_0x4661('0x14'));var logger=require(_0x4661('0x15'))(_0x4661('0x16'));var utils=require(_0x4661('0x17'));var config=require(_0x4661('0x18'));var licenseUtil=require(_0x4661('0x19'));var db=require(_0x4661('0x1a'))['db'];function respondWithStatusCode(_0x2e2153,_0xef67b3){_0xef67b3=_0xef67b3||0xcc;return function(_0x2f885a){if(_0x2f885a){return _0x2e2153[_0x4661('0x1b')](_0xef67b3);}return _0x2e2153[_0x4661('0x1c')](_0xef67b3)['end']();};}function respondWithResult(_0x468109,_0x1889ec){_0x1889ec=_0x1889ec||0xc8;return function(_0x4df427){if(_0x4df427){return _0x468109[_0x4661('0x1c')](_0x1889ec)['json'](_0x4df427);}};}function respondWithFilteredResult(_0x4d6175,_0x356b15){return function(_0x38a981){if(_0x38a981){var _0x382232=typeof _0x356b15['offset']===_0x4661('0x1d')&&typeof _0x356b15['limit']===_0x4661('0x1d');var _0x4a5a0e=_0x38a981[_0x4661('0x1e')];var _0x7c9313=_0x382232?0x0:_0x356b15[_0x4661('0x1f')];var _0xfc394=_0x382232?_0x38a981[_0x4661('0x1e')]:_0x356b15[_0x4661('0x1f')]+_0x356b15['limit'];var _0x510442;if(_0xfc394>=_0x4a5a0e){_0xfc394=_0x4a5a0e;_0x510442=0xc8;}else{_0x510442=0xce;}_0x4d6175[_0x4661('0x1c')](_0x510442);return _0x4d6175['set'](_0x4661('0x20'),_0x7c9313+'-'+_0xfc394+'/'+_0x4a5a0e)[_0x4661('0x21')](_0x38a981);}return null;};}function patchUpdates(_0x15da8a){return function(_0x4b95b0){try{jsonpatch['apply'](_0x4b95b0,_0x15da8a,!![]);}catch(_0x52f780){return BPromise[_0x4661('0x22')](_0x52f780);}return _0x4b95b0[_0x4661('0x23')]();};}function saveUpdates(_0x2c8d51,_0x4092bb){return function(_0x5cbc42){if(_0x5cbc42){return _0x5cbc42[_0x4661('0x24')](_0x2c8d51)[_0x4661('0x25')](function(_0x18cd84){return _0x18cd84;});}return null;};}function removeEntity(_0x1c10f6,_0x2ac5d2){return function(_0x2811a1){if(_0x2811a1){return _0x2811a1[_0x4661('0x26')]()[_0x4661('0x25')](function(){_0x1c10f6['status'](0xcc)[_0x4661('0x27')]();});}};}function handleEntityNotFound(_0x1c1b3c,_0x2e7453){return function(_0x488ef9){if(!_0x488ef9){_0x1c1b3c[_0x4661('0x1b')](0x194);}return _0x488ef9;};}function handleError(_0x2178db,_0x3823c5){_0x3823c5=_0x3823c5||0x1f4;return function(_0x281c0d){logger[_0x4661('0x28')](_0x281c0d[_0x4661('0x29')]);if(_0x281c0d[_0x4661('0x2a')]){delete _0x281c0d[_0x4661('0x2a')];}_0x2178db[_0x4661('0x1c')](_0x3823c5)[_0x4661('0x2b')](_0x281c0d);};}exports[_0x4661('0x2c')]=function(_0xb82f79,_0x4a2d34){var _0x51f055={},_0x38749a={},_0x5c05f5={'count':0x0,'rows':[]};var _0x386010=_['map'](db[_0x4661('0x2d')]['rawAttributes'],function(_0x5943ae){return{'name':_0x5943ae[_0x4661('0x2e')],'type':_0x5943ae['type']['key']};});_0x38749a[_0x4661('0x2f')]=_[_0x4661('0x30')](_0x386010,_0x4661('0x2a'));_0x38749a[_0x4661('0x31')]=_[_0x4661('0x32')](_0xb82f79['query']);_0x38749a[_0x4661('0x33')]=_['intersection'](_0x38749a[_0x4661('0x2f')],_0x38749a[_0x4661('0x31')]);_0x51f055[_0x4661('0x34')]=_[_0x4661('0x35')](_0x38749a[_0x4661('0x2f')],qs[_0x4661('0x36')](_0xb82f79[_0x4661('0x31')][_0x4661('0x36')]));_0x51f055['attributes']=_0x51f055['attributes'][_0x4661('0x37')]?_0x51f055[_0x4661('0x34')]:_0x38749a[_0x4661('0x2f')];if(!_0xb82f79[_0x4661('0x31')][_0x4661('0x38')]('nolimit')){_0x51f055[_0x4661('0x39')]=qs[_0x4661('0x39')](_0xb82f79[_0x4661('0x31')]['limit']);_0x51f055['offset']=qs[_0x4661('0x1f')](_0xb82f79[_0x4661('0x31')][_0x4661('0x1f')]);}_0x51f055['order']=qs[_0x4661('0x3a')](_0xb82f79[_0x4661('0x31')][_0x4661('0x3a')]);_0x51f055[_0x4661('0x3b')]=qs[_0x4661('0x33')](_[_0x4661('0x3c')](_0xb82f79[_0x4661('0x31')],_0x38749a['filters']),_0x386010);if(_0xb82f79[_0x4661('0x31')]['filter']){_0x51f055[_0x4661('0x3b')]=_[_0x4661('0x3d')](_0x51f055[_0x4661('0x3b')],{'$or':_[_0x4661('0x30')](_0x386010,function(_0x4e5bce){if(_0x4e5bce[_0x4661('0x3e')]!==_0x4661('0x3f')){var _0x566d64={};_0x566d64[_0x4e5bce['name']]={'$like':'%'+_0xb82f79[_0x4661('0x31')][_0x4661('0x40')]+'%'};return _0x566d64;}})});}_0x51f055=_[_0x4661('0x3d')]({},_0x51f055,_0xb82f79[_0x4661('0x41')]);var _0x485b9b={'where':_0x51f055[_0x4661('0x3b')]};return db['SmsTransferReport'][_0x4661('0x1e')](_0x485b9b)[_0x4661('0x25')](function(_0x480e4c){_0x5c05f5['count']=_0x480e4c;if(_0xb82f79[_0x4661('0x31')][_0x4661('0x42')]){_0x51f055['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x4661('0x43')](_0x51f055);})[_0x4661('0x25')](function(_0x2ec71d){_0x5c05f5[_0x4661('0x44')]=_0x2ec71d;return _0x5c05f5;})[_0x4661('0x25')](respondWithFilteredResult(_0x4a2d34,_0x51f055))['catch'](handleError(_0x4a2d34,null));};exports[_0x4661('0x45')]=function(_0x57d411,_0x1ac80f){var _0x35cb71={'raw':!![],'where':{'id':_0x57d411['params']['id']}},_0x12577a={};_0x12577a[_0x4661('0x2f')]=_[_0x4661('0x32')](db[_0x4661('0x2d')][_0x4661('0x46')]);_0x12577a[_0x4661('0x31')]=_[_0x4661('0x32')](_0x57d411[_0x4661('0x31')]);_0x12577a[_0x4661('0x33')]=_[_0x4661('0x35')](_0x12577a[_0x4661('0x2f')],_0x12577a[_0x4661('0x31')]);_0x35cb71[_0x4661('0x34')]=_[_0x4661('0x35')](_0x12577a[_0x4661('0x2f')],qs[_0x4661('0x36')](_0x57d411[_0x4661('0x31')]['fields']));_0x35cb71[_0x4661('0x34')]=_0x35cb71[_0x4661('0x34')][_0x4661('0x37')]?_0x35cb71['attributes']:_0x12577a[_0x4661('0x2f')];if(_0x57d411[_0x4661('0x31')][_0x4661('0x42')]){_0x35cb71[_0x4661('0x47')]=[{'all':!![]}];}_0x35cb71=_['merge']({},_0x35cb71,_0x57d411['options']);return db['SmsTransferReport'][_0x4661('0x48')](_0x35cb71)[_0x4661('0x25')](handleEntityNotFound(_0x1ac80f,null))['then'](respondWithResult(_0x1ac80f,null))[_0x4661('0x49')](handleError(_0x1ac80f,null));};exports[_0x4661('0x4a')]=function(_0x466712,_0x5dbc3b){return db[_0x4661('0x2d')][_0x4661('0x4a')](_0x466712[_0x4661('0x4b')],{})[_0x4661('0x25')](respondWithResult(_0x5dbc3b,0xc9))['catch'](handleError(_0x5dbc3b,null));};exports[_0x4661('0x24')]=function(_0x21cfef,_0x419c95){if(_0x21cfef[_0x4661('0x4b')]['id']){delete _0x21cfef[_0x4661('0x4b')]['id'];}return db[_0x4661('0x2d')][_0x4661('0x48')]({'where':{'id':_0x21cfef[_0x4661('0x4c')]['id']}})['then'](handleEntityNotFound(_0x419c95,null))['then'](saveUpdates(_0x21cfef[_0x4661('0x4b')],null))[_0x4661('0x25')](respondWithResult(_0x419c95,null))['catch'](handleError(_0x419c95,null));};exports[_0x4661('0x26')]=function(_0x5eb396,_0x3cfa92){return db[_0x4661('0x2d')][_0x4661('0x48')]({'where':{'id':_0x5eb396['params']['id']}})[_0x4661('0x25')](handleEntityNotFound(_0x3cfa92,null))[_0x4661('0x25')](removeEntity(_0x3cfa92,null))['catch'](handleError(_0x3cfa92,null));};exports[_0x4661('0x4d')]=function(_0x1d8226,_0x7eab9f){return db[_0x4661('0x2d')]['describe']()[_0x4661('0x25')](respondWithResult(_0x7eab9f,null))[_0x4661('0x49')](handleError(_0x7eab9f,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 41b9c90..d7a3cf3 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 _0x1e14=['util','../../config/logger','api','path','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x246119,_0x30a4f3){var _0x59c74f=function(_0x313fb5){while(--_0x313fb5){_0x246119['push'](_0x246119['shift']());}};_0x59c74f(++_0x30a4f3);}(_0x1e14,0xef));var _0x41e1=function(_0xb545cd,_0x27f4bb){_0xb545cd=_0xb545cd-0x0;var _0x181cb2=_0x1e14[_0xb545cd];return _0x181cb2;};'use strict';var _=require(_0x41e1('0x0'));var util=require(_0x41e1('0x1'));var logger=require(_0x41e1('0x2'))(_0x41e1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x41e1('0x4'));var rimraf=require('rimraf');var config=require(_0x41e1('0x5'));var attributes=require(_0x41e1('0x6'));module[_0x41e1('0x7')]=function(_0xd3a2bf,_0x362862){return _0xd3a2bf[_0x41e1('0x8')](_0x41e1('0x9'),attributes,{'tableName':_0x41e1('0xa'),'paranoid':![],'indexes':[{'name':_0x41e1('0xb'),'fields':[_0x41e1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf6c6=['define','SmsTransferReport','report_sms_transfer','uniqueid','util','api','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xb20b1d,_0x528253){var _0x245ced=function(_0x4c8bc0){while(--_0x4c8bc0){_0xb20b1d['push'](_0xb20b1d['shift']());}};_0x245ced(++_0x528253);}(_0xf6c6,0x154));var _0x6f6c=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0xf6c6[_0x11c573];return _0x6b72de;};'use strict';var _=require('lodash');var util=require(_0x6f6c('0x0'));var logger=require('../../config/logger')(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));var BPromise=require(_0x6f6c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f6c('0x4'));var rimraf=require(_0x6f6c('0x5'));var config=require(_0x6f6c('0x6'));var attributes=require('./smsTransferReport.attributes');module[_0x6f6c('0x7')]=function(_0x475482,_0x2b259e){return _0x475482[_0x6f6c('0x8')](_0x6f6c('0x9'),attributes,{'tableName':_0x6f6c('0xa'),'paranoid':![],'indexes':[{'name':_0x6f6c('0xb'),'fields':[_0x6f6c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 0604e79..8e91256 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 _0xf452=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x414748,_0x27070f){var _0x1c88ab=function(_0x518027){while(--_0x518027){_0x414748['push'](_0x414748['shift']());}};_0x1c88ab(++_0x27070f);}(_0xf452,0x13b));var _0x2f45=function(_0x434c47,_0xc9f7da){_0x434c47=_0x434c47-0x0;var _0x2c4e9b=_0xf452[_0x434c47];return _0x2c4e9b;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var moment=require('moment');var BPromise=require(_0x2f45('0x2'));var rs=require(_0x2f45('0x3'));var fs=require('fs');var Redis=require(_0x2f45('0x4'));var db=require(_0x2f45('0x5'))['db'];var utils=require(_0x2f45('0x6'));var logger=require(_0x2f45('0x7'))(_0x2f45('0x8'));var config=require(_0x2f45('0x9'));var jayson=require(_0x2f45('0xa'));var client=jayson[_0x2f45('0xb')][_0x2f45('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f0a92,_0x1b3c99,_0xc30636){return new BPromise(function(_0xf12ae7,_0x20a6ad){return client[_0x2f45('0xd')](_0x3f0a92,_0xc30636)[_0x2f45('0xe')](function(_0x2e5e29){logger[_0x2f45('0xf')](_0x2f45('0x10'),_0x1b3c99,_0x2f45('0x11'));logger['debug']('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1b3c99,_0x2f45('0x11'),JSON[_0x2f45('0x12')](_0x2e5e29));if(_0x2e5e29[_0x2f45('0x13')]){if(_0x2e5e29[_0x2f45('0x13')][_0x2f45('0x14')]===0x1f4){logger['error'](_0x2f45('0x10'),_0x1b3c99,_0x2e5e29['error'][_0x2f45('0x15')]);return _0x20a6ad(_0x2e5e29[_0x2f45('0x13')]['message']);}logger[_0x2f45('0x13')](_0x2f45('0x10'),_0x1b3c99,_0x2e5e29[_0x2f45('0x13')]['message']);return _0xf12ae7(_0x2e5e29[_0x2f45('0x13')]['message']);}else{logger[_0x2f45('0xf')](_0x2f45('0x10'),_0x1b3c99,'request\x20sent');_0xf12ae7(_0x2e5e29[_0x2f45('0x16')][_0x2f45('0x15')]);}})[_0x2f45('0x17')](function(_0x5694ee){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x1b3c99,_0x5694ee);_0x20a6ad(_0x5694ee);});});} \ No newline at end of file +var _0x34e7=['SmsTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1ef909,_0x3cd0a8){var _0x369bc0=function(_0x482192){while(--_0x482192){_0x1ef909['push'](_0x1ef909['shift']());}};_0x369bc0(++_0x3cd0a8);}(_0x34e7,0x164));var _0x734e=function(_0x2be67f,_0x238c6d){_0x2be67f=_0x2be67f-0x0;var _0x1d94b4=_0x34e7[_0x2be67f];return _0x1d94b4;};'use strict';var _=require(_0x734e('0x0'));var util=require(_0x734e('0x1'));var moment=require(_0x734e('0x2'));var BPromise=require(_0x734e('0x3'));var rs=require(_0x734e('0x4'));var fs=require('fs');var Redis=require(_0x734e('0x5'));var db=require(_0x734e('0x6'))['db'];var utils=require(_0x734e('0x7'));var logger=require(_0x734e('0x8'))(_0x734e('0x9'));var config=require(_0x734e('0xa'));var jayson=require(_0x734e('0xb'));var client=jayson[_0x734e('0xc')][_0x734e('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4f49aa,_0x2cf8f9,_0x1b11da){return new BPromise(function(_0x444194,_0x4df479){return client[_0x734e('0xe')](_0x4f49aa,_0x1b11da)['then'](function(_0x1ce121){logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,_0x734e('0x11'));logger[_0x734e('0x12')](_0x734e('0x13'),_0x2cf8f9,'request\x20sent',JSON['stringify'](_0x1ce121));if(_0x1ce121[_0x734e('0x14')]){if(_0x1ce121[_0x734e('0x14')][_0x734e('0x15')]===0x1f4){logger[_0x734e('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x4df479(_0x1ce121['error'][_0x734e('0x16')]);}logger[_0x734e('0x14')](_0x734e('0x10'),_0x2cf8f9,_0x1ce121[_0x734e('0x14')][_0x734e('0x16')]);return _0x444194(_0x1ce121['error'][_0x734e('0x16')]);}else{logger[_0x734e('0xf')](_0x734e('0x10'),_0x2cf8f9,'request\x20sent');_0x444194(_0x1ce121[_0x734e('0x17')]['message']);}})[_0x734e('0x18')](function(_0x3aa65b){logger['error'](_0x734e('0x10'),_0x2cf8f9,_0x3aa65b);_0x4df479(_0x3aa65b);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 9072f3e..48984bf 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 _0xfd57=['file','put','/:id','isAuthenticated','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./sound.controller','index','get','show','download','join','root','originalname','format','%s-%s%s','basename','extname','now','post','single'];(function(_0x396951,_0x2d4c70){var _0x103efd=function(_0x942bb6){while(--_0x942bb6){_0x396951['push'](_0x396951['shift']());}};_0x103efd(++_0x2d4c70);}(_0xfd57,0x12f));var _0x7fd5=function(_0x17ddf1,_0x55c8b0){_0x17ddf1=_0x17ddf1-0x0;var _0x5ab4c9=_0xfd57[_0x17ddf1];return _0x5ab4c9;};'use strict';var multer=require('multer');var util=require(_0x7fd5('0x0'));var path=require(_0x7fd5('0x1'));var timeout=require(_0x7fd5('0x2'));var express=require('express');var router=express[_0x7fd5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7fd5('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7fd5('0x5'));var controller=require(_0x7fd5('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x7fd5('0x7')]);router[_0x7fd5('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x7fd5('0x9')]);router[_0x7fd5('0x8')]('/:id/download',auth['isAuthenticated'](),controller[_0x7fd5('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2d4bd2,_0xab0978,_0x16a0ed){_0x16a0ed(null,path[_0x7fd5('0xb')](config[_0x7fd5('0xc')],'server/files/sounds/original/'));},'filename':function(_0x1904a8,_0x2b5184,_0x1d935f){_0x2b5184[_0x7fd5('0xd')]=_0x2b5184[_0x7fd5('0xd')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1d935f(null,util[_0x7fd5('0xe')](_0x7fd5('0xf'),path[_0x7fd5('0x10')](_0x2b5184['originalname'],path[_0x7fd5('0x11')](_0x2b5184['originalname'])),Date[_0x7fd5('0x12')](),path['extname'](_0x2b5184[_0x7fd5('0xd')])));}})});router[_0x7fd5('0x13')]('/',upload[_0x7fd5('0x14')](_0x7fd5('0x15')),controller['create']);router[_0x7fd5('0x16')](_0x7fd5('0x17'),auth[_0x7fd5('0x18')](),controller['update']);router[_0x7fd5('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x7fd5('0x19')]);module[_0x7fd5('0x1a')]=router; \ No newline at end of file +var _0xf9cc=['util','path','Router','fs-extra','get','isAuthenticated','index','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','%s-%s%s','basename','extname','now','post','file','put','delete','exports','multer'];(function(_0x17d9a0,_0x56dd58){var _0x490120=function(_0x18dd7b){while(--_0x18dd7b){_0x17d9a0['push'](_0x17d9a0['shift']());}};_0x490120(++_0x56dd58);}(_0xf9cc,0xcf));var _0xcf9c=function(_0x340781,_0x32b659){_0x340781=_0x340781-0x0;var _0x1a6ab9=_0xf9cc[_0x340781];return _0x1a6ab9;};'use strict';var multer=require(_0xcf9c('0x0'));var util=require(_0xcf9c('0x1'));var path=require(_0xcf9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf9c('0x3')]();var fs_extra=require(_0xcf9c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xcf9c('0x5')]('/',auth[_0xcf9c('0x6')](),controller[_0xcf9c('0x7')]);router[_0xcf9c('0x5')](_0xcf9c('0x8'),auth[_0xcf9c('0x6')](),controller['show']);router[_0xcf9c('0x5')](_0xcf9c('0x9'),auth[_0xcf9c('0x6')](),controller[_0xcf9c('0xa')]);var upload=multer({'storage':multer[_0xcf9c('0xb')]({'destination':function(_0x29be9e,_0x36b142,_0x57fb41){_0x57fb41(null,path[_0xcf9c('0xc')](config[_0xcf9c('0xd')],_0xcf9c('0xe')));},'filename':function(_0x278439,_0x389946,_0x4cf645){_0x389946[_0xcf9c('0xf')]=_0x389946['originalname'][_0xcf9c('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4cf645(null,util['format'](_0xcf9c('0x11'),path[_0xcf9c('0x12')](_0x389946[_0xcf9c('0xf')],path[_0xcf9c('0x13')](_0x389946['originalname'])),Date[_0xcf9c('0x14')](),path['extname'](_0x389946[_0xcf9c('0xf')])));}})});router[_0xcf9c('0x15')]('/',upload['single'](_0xcf9c('0x16')),controller['create']);router[_0xcf9c('0x17')](_0xcf9c('0x8'),auth[_0xcf9c('0x6')](),controller['update']);router[_0xcf9c('0x18')]('/:id',auth[_0xcf9c('0x6')](),controller['delete']);module[_0xcf9c('0x19')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a5416ff..853c487 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 _0x6711=['INTEGER','FLOAT','sequelize','exports','name','STRING','BIGINT'];(function(_0xcd2dad,_0x12e3db){var _0x3677bd=function(_0x5d5195){while(--_0x5d5195){_0xcd2dad['push'](_0xcd2dad['shift']());}};_0x3677bd(++_0x12e3db);}(_0x6711,0x6b));var _0x1671=function(_0x549928,_0x363b7a){_0x549928=_0x549928-0x0;var _0x941e27=_0x6711[_0x549928];return _0x941e27;};'use strict';var Sequelize=require(_0x1671('0x0'));module[_0x1671('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1671('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x1671('0x3')]},'original_format':{'type':Sequelize[_0x1671('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0x1671('0x4')]},'original_channelCount':{'type':Sequelize[_0x1671('0x5')]},'original_bitRate':{'type':Sequelize[_0x1671('0x4')]},'original_sampleRate':{'type':Sequelize[_0x1671('0x5')]},'converted_format':{'type':Sequelize[_0x1671('0x3')]},'converted_duration':{'type':Sequelize[_0x1671('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x1671('0x5')]}}; \ No newline at end of file +var _0x9ae4=['name','STRING','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x33578f,_0x530bb5){var _0x41b2f3=function(_0x137db0){while(--_0x137db0){_0x33578f['push'](_0x33578f['shift']());}};_0x41b2f3(++_0x530bb5);}(_0x9ae4,0x194));var _0x49ae=function(_0x475640,_0x1fa709){_0x475640=_0x475640-0x0;var _0x4e1eb7=_0x9ae4[_0x475640];return _0x4e1eb7;};'use strict';var Sequelize=require(_0x49ae('0x0'));module[_0x49ae('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x49ae('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0x49ae('0x3')]},'display_name':{'type':Sequelize[_0x49ae('0x3')],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x49ae('0x3')]},'original_duration':{'type':Sequelize[_0x49ae('0x4')]},'original_sampleCount':{'type':Sequelize[_0x49ae('0x5')]},'original_channelCount':{'type':Sequelize[_0x49ae('0x6')]},'original_bitRate':{'type':Sequelize[_0x49ae('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x49ae('0x3')]},'converted_duration':{'type':Sequelize[_0x49ae('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x49ae('0x5')]},'converted_channelCount':{'type':Sequelize[_0x49ae('0x6')]},'converted_bitRate':{'type':Sequelize[_0x49ae('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x49ae('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 21f5a1d..5ab5391 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 _0x6af1=['end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','then','destroy','get','Sounds','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','Sound','find','download','existsSync','join','root','server/files/sounds/converted','save_name','converted_format','Sequelize','ValidationError','format','%s.%s','basename','file','originalname','extname','filename','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','info','chmodSync','0777','transcode','unlinkSync','src','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleRate','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','original_format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x51a3a9,_0x282180){var _0x5d1cfd=function(_0x292a6){while(--_0x292a6){_0x51a3a9['push'](_0x51a3a9['shift']());}};_0x5d1cfd(++_0x282180);}(_0x6af1,0x1c6));var _0x16af=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6af1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x16af('0x0'));var zipdir=require(_0x16af('0x1'));var jsonpatch=require(_0x16af('0x2'));var rp=require(_0x16af('0x3'));var moment=require('moment');var BPromise=require(_0x16af('0x4'));var Mustache=require(_0x16af('0x5'));var util=require(_0x16af('0x6'));var path=require(_0x16af('0x7'));var sox=require(_0x16af('0x8'));var csv=require(_0x16af('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16af('0xa'));var _=require('lodash');var squel=require(_0x16af('0xb'));var crypto=require(_0x16af('0xc'));var jsforce=require(_0x16af('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x16af('0x9'));var querystring=require(_0x16af('0xe'));var Papa=require(_0x16af('0xf'));var Redis=require('ioredis');var authService=require(_0x16af('0x10'));var qs=require(_0x16af('0x11'));var as=require(_0x16af('0x12'));var hardwareService=require(_0x16af('0x13'));var logger=require(_0x16af('0x14'))(_0x16af('0x15'));var utils=require(_0x16af('0x16'));var config=require(_0x16af('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x173d51,_0x18c017){_0x18c017=_0x18c017||0xcc;return function(_0x2aa157){if(_0x2aa157){return _0x173d51[_0x16af('0x18')](_0x18c017);}return _0x173d51[_0x16af('0x19')](_0x18c017)[_0x16af('0x1a')]();};}function respondWithResult(_0xb22db4,_0x37d339){_0x37d339=_0x37d339||0xc8;return function(_0x15b0ec){if(_0x15b0ec){return _0xb22db4[_0x16af('0x19')](_0x37d339)['json'](_0x15b0ec);}};}function respondWithFilteredResult(_0x1c4fb9,_0x411ff7){return function(_0x409cb3){if(_0x409cb3){var _0x444905=typeof _0x411ff7['offset']===_0x16af('0x1b')&&typeof _0x411ff7[_0x16af('0x1c')]==='undefined';var _0x352e0c=_0x409cb3[_0x16af('0x1d')];var _0x291cb0=_0x444905?0x0:_0x411ff7[_0x16af('0x1e')];var _0x77f13d=_0x444905?_0x409cb3[_0x16af('0x1d')]:_0x411ff7[_0x16af('0x1e')]+_0x411ff7[_0x16af('0x1c')];var _0x281848;if(_0x77f13d>=_0x352e0c){_0x77f13d=_0x352e0c;_0x281848=0xc8;}else{_0x281848=0xce;}_0x1c4fb9[_0x16af('0x19')](_0x281848);return _0x1c4fb9[_0x16af('0x1f')](_0x16af('0x20'),_0x291cb0+'-'+_0x77f13d+'/'+_0x352e0c)[_0x16af('0x21')](_0x409cb3);}return null;};}function patchUpdates(_0x11f111){return function(_0x4a88ef){try{jsonpatch[_0x16af('0x22')](_0x4a88ef,_0x11f111,!![]);}catch(_0x59d9d5){return BPromise[_0x16af('0x23')](_0x59d9d5);}return _0x4a88ef[_0x16af('0x24')]();};}function saveUpdates(_0x2938bb,_0x575025){return function(_0x5bdbc7){if(_0x5bdbc7){return _0x5bdbc7['update'](_0x2938bb)[_0x16af('0x25')](function(_0x30c44e){return _0x30c44e;});}return null;};}function removeEntity(_0x460583,_0x4b30ef){return function(_0x4f95a8){if(_0x4f95a8){return _0x4f95a8[_0x16af('0x26')]()[_0x16af('0x25')](function(){var _0x3ced79=_0x4f95a8[_0x16af('0x27')]({'plain':!![]});var _0x2cb50b=_0x16af('0x28');return db['UserProfileResource'][_0x16af('0x26')]({'where':{'type':_0x2cb50b,'resourceId':_0x3ced79['id']}})[_0x16af('0x25')](function(){return _0x4f95a8;});})['then'](function(){_0x460583[_0x16af('0x19')](0xcc)[_0x16af('0x1a')]();});}};}function handleEntityNotFound(_0x373e10,_0x6ada2f){return function(_0xb00539){if(!_0xb00539){_0x373e10[_0x16af('0x18')](0x194);}return _0xb00539;};}function handleError(_0x1b9ad8,_0x1de183){_0x1de183=_0x1de183||0x1f4;return function(_0x59a418){logger[_0x16af('0x29')](_0x59a418['stack']);if(_0x59a418[_0x16af('0x2a')]){delete _0x59a418[_0x16af('0x2a')];}_0x1b9ad8[_0x16af('0x19')](_0x1de183)[_0x16af('0x2b')](_0x59a418);};}exports[_0x16af('0x2c')]=function(_0x248a0e,_0x452c21){var _0x4ca86b={},_0x598b52={},_0x148abd={'count':0x0,'rows':[]};var _0x10f4ec=_[_0x16af('0x2d')](db['Sound'][_0x16af('0x2e')],function(_0x1dbb02){return{'name':_0x1dbb02[_0x16af('0x2f')],'type':_0x1dbb02[_0x16af('0x30')][_0x16af('0x31')]};});_0x598b52[_0x16af('0x32')]=_[_0x16af('0x2d')](_0x10f4ec,_0x16af('0x2a'));_0x598b52['query']=_['keys'](_0x248a0e[_0x16af('0x33')]);_0x598b52[_0x16af('0x34')]=_[_0x16af('0x35')](_0x598b52[_0x16af('0x32')],_0x598b52[_0x16af('0x33')]);_0x4ca86b[_0x16af('0x36')]=_[_0x16af('0x35')](_0x598b52[_0x16af('0x32')],qs[_0x16af('0x37')](_0x248a0e[_0x16af('0x33')][_0x16af('0x37')]));_0x4ca86b[_0x16af('0x36')]=_0x4ca86b[_0x16af('0x36')][_0x16af('0x38')]?_0x4ca86b[_0x16af('0x36')]:_0x598b52[_0x16af('0x32')];if(!_0x248a0e[_0x16af('0x33')][_0x16af('0x39')](_0x16af('0x3a'))){_0x4ca86b['limit']=qs[_0x16af('0x1c')](_0x248a0e[_0x16af('0x33')][_0x16af('0x1c')]);_0x4ca86b[_0x16af('0x1e')]=qs['offset'](_0x248a0e[_0x16af('0x33')][_0x16af('0x1e')]);}_0x4ca86b[_0x16af('0x3b')]=qs[_0x16af('0x3c')](_0x248a0e[_0x16af('0x33')][_0x16af('0x3c')]);_0x4ca86b['where']=qs[_0x16af('0x34')](_[_0x16af('0x3d')](_0x248a0e['query'],_0x598b52[_0x16af('0x34')]),_0x10f4ec);if(_0x248a0e[_0x16af('0x33')]['filter']){_0x4ca86b[_0x16af('0x3e')]=_[_0x16af('0x3f')](_0x4ca86b[_0x16af('0x3e')],{'$or':_['map'](_0x10f4ec,function(_0x50f403){if(_0x50f403['type']!==_0x16af('0x40')){var _0x6c6dc3={};_0x6c6dc3[_0x50f403[_0x16af('0x2a')]]={'$like':'%'+_0x248a0e[_0x16af('0x33')]['filter']+'%'};return _0x6c6dc3;}})});}_0x4ca86b=_[_0x16af('0x3f')]({},_0x4ca86b,_0x248a0e[_0x16af('0x41')]);var _0x972c2a={'where':_0x4ca86b[_0x16af('0x3e')]};return db['Sound'][_0x16af('0x1d')](_0x972c2a)[_0x16af('0x25')](function(_0x3272f6){_0x148abd[_0x16af('0x1d')]=_0x3272f6;if(_0x248a0e[_0x16af('0x33')][_0x16af('0x42')]){_0x4ca86b[_0x16af('0x43')]=[{'all':!![]}];}return db['Sound'][_0x16af('0x44')](_0x4ca86b);})[_0x16af('0x25')](function(_0x85d775){_0x148abd[_0x16af('0x45')]=_0x85d775;return _0x148abd;})[_0x16af('0x25')](respondWithFilteredResult(_0x452c21,_0x4ca86b))[_0x16af('0x46')](handleError(_0x452c21,null));};exports['show']=function(_0x137b2a,_0x320aee){var _0x3d2631={'raw':!![],'where':{'id':_0x137b2a[_0x16af('0x47')]['id']}},_0x24c778={};_0x24c778['model']=_[_0x16af('0x48')](db['Sound'][_0x16af('0x2e')]);_0x24c778[_0x16af('0x33')]=_[_0x16af('0x48')](_0x137b2a[_0x16af('0x33')]);_0x24c778['filters']=_[_0x16af('0x35')](_0x24c778[_0x16af('0x32')],_0x24c778[_0x16af('0x33')]);_0x3d2631['attributes']=_[_0x16af('0x35')](_0x24c778[_0x16af('0x32')],qs['fields'](_0x137b2a[_0x16af('0x33')][_0x16af('0x37')]));_0x3d2631[_0x16af('0x36')]=_0x3d2631[_0x16af('0x36')][_0x16af('0x38')]?_0x3d2631[_0x16af('0x36')]:_0x24c778[_0x16af('0x32')];if(_0x137b2a[_0x16af('0x33')][_0x16af('0x42')]){_0x3d2631[_0x16af('0x43')]=[{'all':!![]}];}_0x3d2631=_[_0x16af('0x3f')]({},_0x3d2631,_0x137b2a[_0x16af('0x41')]);return db[_0x16af('0x49')][_0x16af('0x4a')](_0x3d2631)[_0x16af('0x25')](handleEntityNotFound(_0x320aee,null))[_0x16af('0x25')](respondWithResult(_0x320aee,null))[_0x16af('0x46')](handleError(_0x320aee,null));};exports[_0x16af('0x4b')]=function(_0x45ff38,_0x27df02,_0x5ee890){return db[_0x16af('0x49')][_0x16af('0x4a')]({'where':{'id':_0x45ff38[_0x16af('0x47')]['id']},'attributes':[_0x16af('0x2a'),'save_name','converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x27df02,null))['then'](function(_0x4b31e9){if(_0x4b31e9){if(!fs[_0x16af('0x4c')](path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x4f'),_0x4b31e9[_0x16af('0x50')]+'.'+_0x4b31e9[_0x16af('0x51')]))){throw new db[(_0x16af('0x52'))][(_0x16af('0x53'))]('Sound\x20not\x20found');}return _0x27df02['download'](path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x4f'),util[_0x16af('0x54')](_0x16af('0x55'),_0x4b31e9[_0x16af('0x50')],_0x4b31e9[_0x16af('0x51')])),util[_0x16af('0x54')](_0x16af('0x55'),_0x4b31e9['name'],_0x4b31e9[_0x16af('0x51')]));}return null;})[_0x16af('0x46')](handleError(_0x27df02,null));};exports['create']=function(_0x20db89,_0x5088f5,_0x32d2dc){var _0x110f1f={'name':path[_0x16af('0x56')](_0x20db89[_0x16af('0x57')][_0x16af('0x58')],path[_0x16af('0x59')](_0x20db89[_0x16af('0x57')][_0x16af('0x58')])),'save_name':path[_0x16af('0x56')](_0x20db89['file'][_0x16af('0x5a')],path[_0x16af('0x59')](_0x20db89[_0x16af('0x57')][_0x16af('0x5a')])),'original_format':path[_0x16af('0x59')](_0x20db89['file'][_0x16af('0x58')])['substring'](0x1),'converted_format':'wav'};var _0x188bf1=path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x5b'),_0x20db89['file'][_0x16af('0x5a')]);var _0x50a61b=path['join'](config['root'],'server/files/sounds/converted',util[_0x16af('0x54')]('%s.%s',path['basename'](_0x20db89[_0x16af('0x57')][_0x16af('0x5a')],path[_0x16af('0x59')](_0x20db89['file'][_0x16af('0x5a')])),_0x110f1f['converted_format']));logger['info'](_0x16af('0x5c'),_0x188bf1);logger[_0x16af('0x5d')]('Sound\x20upload\x20destination:\x20%s',_0x50a61b);try{fs[_0x16af('0x5e')](_0x188bf1,parseInt(_0x16af('0x5f'),0x8));var _0x230b94=sox[_0x16af('0x60')](_0x188bf1,_0x50a61b,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x230b94['on'](_0x16af('0x29'),function(_0x13e6f2){fs[_0x16af('0x61')](_0x188bf1);_0x5088f5[_0x16af('0x19')](0x1f4)[_0x16af('0x2b')](_0x13e6f2);});_0x230b94['on'](_0x16af('0x62'),function(_0xc1c525){_0x110f1f['original_duration']=isNaN(_0xc1c525[_0x16af('0x63')])?null:_0xc1c525[_0x16af('0x63')]*0x3e8;_0x110f1f['original_sampleCount']=isNaN(_0xc1c525[_0x16af('0x64')])?null:_0xc1c525[_0x16af('0x64')];_0x110f1f[_0x16af('0x65')]=isNaN(_0xc1c525['channelCount'])?null:_0xc1c525[_0x16af('0x66')];_0x110f1f[_0x16af('0x67')]=isNaN(_0xc1c525[_0x16af('0x68')])?null:_0xc1c525[_0x16af('0x68')];_0x110f1f[_0x16af('0x69')]=isNaN(_0xc1c525[_0x16af('0x6a')])?null:_0xc1c525[_0x16af('0x6a')];});_0x230b94['on'](_0x16af('0x6b'),function(_0x1eec50){_0x110f1f[_0x16af('0x6c')]=isNaN(_0x1eec50[_0x16af('0x63')])?null:_0x1eec50['duration']*0x3e8;_0x110f1f['converted_sampleCount']=isNaN(_0x1eec50['sampleCount'])?null:_0x1eec50[_0x16af('0x64')];_0x110f1f['converted_channelCount']=isNaN(_0x1eec50[_0x16af('0x66')])?null:_0x1eec50[_0x16af('0x66')];_0x110f1f['converted_bitRate']=isNaN(_0x1eec50[_0x16af('0x68')])?null:_0x1eec50[_0x16af('0x68')];_0x110f1f[_0x16af('0x6d')]=isNaN(_0x1eec50[_0x16af('0x6a')])?null:_0x1eec50[_0x16af('0x6a')];});_0x230b94['on'](_0x16af('0x1a'),function(){fs[_0x16af('0x5e')](_0x50a61b,parseInt('0777',0x8));return db[_0x16af('0x49')][_0x16af('0x6e')](_0x110f1f)['then'](function(_0x34aaa2){var _0x4cb562={'role':_0x20db89[_0x16af('0x6f')][_0x16af('0x70')],'userProfileId':_0x20db89[_0x16af('0x6f')][_0x16af('0x71')]};if(!_0x4cb562)throw new Error(_0x16af('0x72'));if(_0x4cb562['role']==='user'){var _0x3bbbe1=_0x34aaa2[_0x16af('0x27')]({'plain':!![]});return db[_0x16af('0x73')][_0x16af('0x4a')]({'where':{'name':_0x16af('0x28'),'userProfileId':_0x4cb562[_0x16af('0x71')]},'raw':!![]})[_0x16af('0x25')](function(_0x5cc476){if(_0x5cc476&&_0x5cc476['autoAssociation']===0x0){return db[_0x16af('0x74')][_0x16af('0x6e')]({'name':_0x3bbbe1[_0x16af('0x2a')],'resourceId':_0x3bbbe1['id'],'type':_0x5cc476[_0x16af('0x2a')],'sectionId':_0x5cc476['id']},{})[_0x16af('0x25')](function(){return _0x34aaa2;});}else{return _0x34aaa2;}})[_0x16af('0x46')](function(_0x59f1d8){logger['error'](_0x16af('0x75'),_0x59f1d8);throw _0x59f1d8;});}return _0x34aaa2;})[_0x16af('0x25')](respondWithResult(_0x5088f5,null))['catch'](handleError(_0x5088f5,null));});_0x230b94['start']();}catch(_0x489a99){_0x5088f5[_0x16af('0x19')](0x1f4)[_0x16af('0x2b')](_0x489a99);}};exports['update']=function(_0x37664c,_0xc26243,_0xf1e6d6){return db[_0x16af('0x49')][_0x16af('0x4a')]({'where':{'id':_0x37664c[_0x16af('0x47')]['id']}})[_0x16af('0x25')](handleEntityNotFound(_0xc26243,null))[_0x16af('0x25')](saveUpdates(_[_0x16af('0x3d')](_0x37664c[_0x16af('0x6f')],[_0x16af('0x2a'),_0x16af('0x76')]),null))[_0x16af('0x25')](respondWithResult(_0xc26243,null))[_0x16af('0x46')](handleError(_0xc26243,null));};exports['delete']=function(_0x11b9a5,_0x344029,_0x5a12c6){return db[_0x16af('0x49')]['find']({'where':{'id':_0x11b9a5[_0x16af('0x47')]['id']}})[_0x16af('0x25')](function(_0x3db77a){if(_0x3db77a){return _0x3db77a['destroy']();}})[_0x16af('0x25')](function(_0x47b606){var _0x246893=path[_0x16af('0x4d')](config[_0x16af('0x4e')],_0x16af('0x5b'),util['format'](_0x16af('0x55'),_0x47b606['save_name'],_0x47b606[_0x16af('0x77')]));var _0x115099=path['join'](config[_0x16af('0x4e')],'server/files/sounds/converted',util[_0x16af('0x54')](_0x16af('0x55'),_0x47b606['save_name'],_0x47b606['converted_format']));fs['unlinkSync'](_0x246893);fs[_0x16af('0x61')](_0x115099);return _0x47b606;})[_0x16af('0x25')](function(_0x11992b){if(_0x11992b){return _0x344029[_0x16af('0x19')](0xcc)[_0x16af('0x1a')]();}})[_0x16af('0x25')](handleEntityNotFound(_0x344029,null))[_0x16af('0x46')](handleError(_0x344029,null));}; \ No newline at end of file +var _0xc259=['%s.%s','create','basename','file','originalname','filename','extname','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','wav','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','save','update','then','destroy','get','Sounds','UserProfileResource','end','sendStatus','error','name','map','Sound','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','merge','where','filter','options','includeAll','include','rows','catch','show','params','keys','download','find','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','Sequelize','Sound\x20not\x20found','format'];(function(_0x581e75,_0x55908d){var _0x2baedc=function(_0x409ac0){while(--_0x409ac0){_0x581e75['push'](_0x581e75['shift']());}};_0x2baedc(++_0x55908d);}(_0xc259,0x19e));var _0x9c25=function(_0x45e829,_0xbe0176){_0x45e829=_0x45e829-0x0;var _0x557688=_0xc259[_0x45e829];return _0x557688;};'use strict';var emlformat=require(_0x9c25('0x0'));var rimraf=require(_0x9c25('0x1'));var zipdir=require(_0x9c25('0x2'));var jsonpatch=require(_0x9c25('0x3'));var rp=require(_0x9c25('0x4'));var moment=require(_0x9c25('0x5'));var BPromise=require(_0x9c25('0x6'));var Mustache=require('mustache');var util=require(_0x9c25('0x7'));var path=require('path');var sox=require(_0x9c25('0x8'));var csv=require(_0x9c25('0x9'));var ejs=require(_0x9c25('0xa'));var fs=require('fs');var fs_extra=require(_0x9c25('0xb'));var _=require(_0x9c25('0xc'));var squel=require(_0x9c25('0xd'));var crypto=require(_0x9c25('0xe'));var jsforce=require(_0x9c25('0xf'));var deskjs=require(_0x9c25('0x10'));var toCsv=require(_0x9c25('0x9'));var querystring=require(_0x9c25('0x11'));var Papa=require('papaparse');var Redis=require(_0x9c25('0x12'));var authService=require(_0x9c25('0x13'));var qs=require(_0x9c25('0x14'));var as=require(_0x9c25('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9c25('0x16'))(_0x9c25('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9c25('0x18'));var db=require(_0x9c25('0x19'))['db'];function respondWithStatusCode(_0x407757,_0x2b9c2e){_0x2b9c2e=_0x2b9c2e||0xcc;return function(_0x1225fc){if(_0x1225fc){return _0x407757['sendStatus'](_0x2b9c2e);}return _0x407757[_0x9c25('0x1a')](_0x2b9c2e)['end']();};}function respondWithResult(_0x195e29,_0xc74fca){_0xc74fca=_0xc74fca||0xc8;return function(_0x241809){if(_0x241809){return _0x195e29[_0x9c25('0x1a')](_0xc74fca)[_0x9c25('0x1b')](_0x241809);}};}function respondWithFilteredResult(_0x57e495,_0x43ad20){return function(_0x39bdae){if(_0x39bdae){var _0x4bf482=typeof _0x43ad20[_0x9c25('0x1c')]==='undefined'&&typeof _0x43ad20[_0x9c25('0x1d')]===_0x9c25('0x1e');var _0x12775c=_0x39bdae[_0x9c25('0x1f')];var _0x2e9139=_0x4bf482?0x0:_0x43ad20[_0x9c25('0x1c')];var _0x52fce5=_0x4bf482?_0x39bdae[_0x9c25('0x1f')]:_0x43ad20['offset']+_0x43ad20[_0x9c25('0x1d')];var _0x29eac9;if(_0x52fce5>=_0x12775c){_0x52fce5=_0x12775c;_0x29eac9=0xc8;}else{_0x29eac9=0xce;}_0x57e495[_0x9c25('0x1a')](_0x29eac9);return _0x57e495[_0x9c25('0x20')]('Content-Range',_0x2e9139+'-'+_0x52fce5+'/'+_0x12775c)[_0x9c25('0x1b')](_0x39bdae);}return null;};}function patchUpdates(_0x2d5d7e){return function(_0x30cfb3){try{jsonpatch['apply'](_0x30cfb3,_0x2d5d7e,!![]);}catch(_0x25a25c){return BPromise['reject'](_0x25a25c);}return _0x30cfb3[_0x9c25('0x21')]();};}function saveUpdates(_0x272ce4,_0x54b8d5){return function(_0x54a000){if(_0x54a000){return _0x54a000[_0x9c25('0x22')](_0x272ce4)[_0x9c25('0x23')](function(_0x10706b){return _0x10706b;});}return null;};}function removeEntity(_0x4194ee,_0x139445){return function(_0x35689a){if(_0x35689a){return _0x35689a[_0x9c25('0x24')]()[_0x9c25('0x23')](function(){var _0x5a7d42=_0x35689a[_0x9c25('0x25')]({'plain':!![]});var _0x78a6=_0x9c25('0x26');return db[_0x9c25('0x27')][_0x9c25('0x24')]({'where':{'type':_0x78a6,'resourceId':_0x5a7d42['id']}})[_0x9c25('0x23')](function(){return _0x35689a;});})[_0x9c25('0x23')](function(){_0x4194ee['status'](0xcc)[_0x9c25('0x28')]();});}};}function handleEntityNotFound(_0xbfddd5,_0xcbfca1){return function(_0x1eea48){if(!_0x1eea48){_0xbfddd5[_0x9c25('0x29')](0x194);}return _0x1eea48;};}function handleError(_0x2f192e,_0x5175c8){_0x5175c8=_0x5175c8||0x1f4;return function(_0x6f841b){logger[_0x9c25('0x2a')](_0x6f841b['stack']);if(_0x6f841b[_0x9c25('0x2b')]){delete _0x6f841b[_0x9c25('0x2b')];}_0x2f192e[_0x9c25('0x1a')](_0x5175c8)['send'](_0x6f841b);};}exports['index']=function(_0x25b247,_0x9b0b31){var _0x13a54b={},_0x53ad0f={},_0x52acd2={'count':0x0,'rows':[]};var _0x4ab23a=_[_0x9c25('0x2c')](db[_0x9c25('0x2d')][_0x9c25('0x2e')],function(_0x52045){return{'name':_0x52045['fieldName'],'type':_0x52045[_0x9c25('0x2f')][_0x9c25('0x30')]};});_0x53ad0f[_0x9c25('0x31')]=_[_0x9c25('0x2c')](_0x4ab23a,_0x9c25('0x2b'));_0x53ad0f[_0x9c25('0x32')]=_['keys'](_0x25b247[_0x9c25('0x32')]);_0x53ad0f[_0x9c25('0x33')]=_['intersection'](_0x53ad0f['model'],_0x53ad0f[_0x9c25('0x32')]);_0x13a54b[_0x9c25('0x34')]=_[_0x9c25('0x35')](_0x53ad0f[_0x9c25('0x31')],qs[_0x9c25('0x36')](_0x25b247[_0x9c25('0x32')][_0x9c25('0x36')]));_0x13a54b[_0x9c25('0x34')]=_0x13a54b['attributes'][_0x9c25('0x37')]?_0x13a54b[_0x9c25('0x34')]:_0x53ad0f['model'];if(!_0x25b247['query']['hasOwnProperty'](_0x9c25('0x38'))){_0x13a54b['limit']=qs[_0x9c25('0x1d')](_0x25b247[_0x9c25('0x32')][_0x9c25('0x1d')]);_0x13a54b[_0x9c25('0x1c')]=qs[_0x9c25('0x1c')](_0x25b247[_0x9c25('0x32')][_0x9c25('0x1c')]);}_0x13a54b[_0x9c25('0x39')]=qs[_0x9c25('0x3a')](_0x25b247['query'][_0x9c25('0x3a')]);_0x13a54b['where']=qs[_0x9c25('0x33')](_[_0x9c25('0x3b')](_0x25b247[_0x9c25('0x32')],_0x53ad0f[_0x9c25('0x33')]),_0x4ab23a);if(_0x25b247[_0x9c25('0x32')]['filter']){_0x13a54b['where']=_[_0x9c25('0x3c')](_0x13a54b[_0x9c25('0x3d')],{'$or':_[_0x9c25('0x2c')](_0x4ab23a,function(_0x5df461){if(_0x5df461[_0x9c25('0x2f')]!=='VIRTUAL'){var _0x327ac6={};_0x327ac6[_0x5df461[_0x9c25('0x2b')]]={'$like':'%'+_0x25b247[_0x9c25('0x32')][_0x9c25('0x3e')]+'%'};return _0x327ac6;}})});}_0x13a54b=_[_0x9c25('0x3c')]({},_0x13a54b,_0x25b247[_0x9c25('0x3f')]);var _0x354476={'where':_0x13a54b[_0x9c25('0x3d')]};return db[_0x9c25('0x2d')][_0x9c25('0x1f')](_0x354476)[_0x9c25('0x23')](function(_0x47dd14){_0x52acd2[_0x9c25('0x1f')]=_0x47dd14;if(_0x25b247[_0x9c25('0x32')][_0x9c25('0x40')]){_0x13a54b[_0x9c25('0x41')]=[{'all':!![]}];}return db[_0x9c25('0x2d')]['findAll'](_0x13a54b);})[_0x9c25('0x23')](function(_0x3566a4){_0x52acd2[_0x9c25('0x42')]=_0x3566a4;return _0x52acd2;})[_0x9c25('0x23')](respondWithFilteredResult(_0x9b0b31,_0x13a54b))[_0x9c25('0x43')](handleError(_0x9b0b31,null));};exports[_0x9c25('0x44')]=function(_0xa6be65,_0x2a1190){var _0x451364={'raw':!![],'where':{'id':_0xa6be65[_0x9c25('0x45')]['id']}},_0x23c6fa={};_0x23c6fa['model']=_[_0x9c25('0x46')](db[_0x9c25('0x2d')][_0x9c25('0x2e')]);_0x23c6fa[_0x9c25('0x32')]=_['keys'](_0xa6be65[_0x9c25('0x32')]);_0x23c6fa[_0x9c25('0x33')]=_['intersection'](_0x23c6fa['model'],_0x23c6fa[_0x9c25('0x32')]);_0x451364[_0x9c25('0x34')]=_['intersection'](_0x23c6fa[_0x9c25('0x31')],qs[_0x9c25('0x36')](_0xa6be65[_0x9c25('0x32')][_0x9c25('0x36')]));_0x451364['attributes']=_0x451364['attributes'][_0x9c25('0x37')]?_0x451364[_0x9c25('0x34')]:_0x23c6fa[_0x9c25('0x31')];if(_0xa6be65[_0x9c25('0x32')][_0x9c25('0x40')]){_0x451364[_0x9c25('0x41')]=[{'all':!![]}];}_0x451364=_[_0x9c25('0x3c')]({},_0x451364,_0xa6be65[_0x9c25('0x3f')]);return db[_0x9c25('0x2d')]['find'](_0x451364)['then'](handleEntityNotFound(_0x2a1190,null))[_0x9c25('0x23')](respondWithResult(_0x2a1190,null))['catch'](handleError(_0x2a1190,null));};exports[_0x9c25('0x47')]=function(_0x3c823d,_0x23928a,_0x45d8d9){return db[_0x9c25('0x2d')][_0x9c25('0x48')]({'where':{'id':_0x3c823d[_0x9c25('0x45')]['id']},'attributes':[_0x9c25('0x2b'),_0x9c25('0x49'),_0x9c25('0x4a')],'raw':!![]})[_0x9c25('0x23')](handleEntityNotFound(_0x23928a,null))[_0x9c25('0x23')](function(_0x5999ef){if(_0x5999ef){if(!fs[_0x9c25('0x4b')](path[_0x9c25('0x4c')](config[_0x9c25('0x4d')],_0x9c25('0x4e'),_0x5999ef[_0x9c25('0x49')]+'.'+_0x5999ef[_0x9c25('0x4a')]))){throw new db[(_0x9c25('0x4f'))]['ValidationError'](_0x9c25('0x50'));}return _0x23928a[_0x9c25('0x47')](path[_0x9c25('0x4c')](config['root'],'server/files/sounds/converted',util[_0x9c25('0x51')](_0x9c25('0x52'),_0x5999ef[_0x9c25('0x49')],_0x5999ef[_0x9c25('0x4a')])),util[_0x9c25('0x51')]('%s.%s',_0x5999ef[_0x9c25('0x2b')],_0x5999ef[_0x9c25('0x4a')]));}return null;})[_0x9c25('0x43')](handleError(_0x23928a,null));};exports[_0x9c25('0x53')]=function(_0x82ed67,_0x50d10c,_0x373b74){var _0x374367={'name':path[_0x9c25('0x54')](_0x82ed67[_0x9c25('0x55')]['originalname'],path['extname'](_0x82ed67[_0x9c25('0x55')][_0x9c25('0x56')])),'save_name':path['basename'](_0x82ed67['file'][_0x9c25('0x57')],path['extname'](_0x82ed67[_0x9c25('0x55')]['filename'])),'original_format':path[_0x9c25('0x58')](_0x82ed67[_0x9c25('0x55')][_0x9c25('0x56')])[_0x9c25('0x59')](0x1),'converted_format':'wav'};var _0x6b6c71=path[_0x9c25('0x4c')](config[_0x9c25('0x4d')],_0x9c25('0x5a'),_0x82ed67[_0x9c25('0x55')][_0x9c25('0x57')]);var _0x2eeb10=path['join'](config[_0x9c25('0x4d')],_0x9c25('0x4e'),util[_0x9c25('0x51')](_0x9c25('0x52'),path[_0x9c25('0x54')](_0x82ed67['file'][_0x9c25('0x57')],path[_0x9c25('0x58')](_0x82ed67['file'][_0x9c25('0x57')])),_0x374367[_0x9c25('0x4a')]));logger[_0x9c25('0x5b')]('Sound\x20upload\x20filepath:\x20%s',_0x6b6c71);logger[_0x9c25('0x5b')](_0x9c25('0x5c'),_0x2eeb10);try{fs[_0x9c25('0x5d')](_0x6b6c71,parseInt(_0x9c25('0x5e'),0x8));var _0x3c6f2a=sox[_0x9c25('0x5f')](_0x6b6c71,_0x2eeb10,{'sampleRate':0x1f40,'format':_0x9c25('0x60'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3c6f2a['on'](_0x9c25('0x2a'),function(_0x30978a){fs[_0x9c25('0x61')](_0x6b6c71);_0x50d10c[_0x9c25('0x1a')](0x1f4)['send'](_0x30978a);});_0x3c6f2a['on']('src',function(_0x933107){_0x374367[_0x9c25('0x62')]=isNaN(_0x933107[_0x9c25('0x63')])?null:_0x933107['duration']*0x3e8;_0x374367[_0x9c25('0x64')]=isNaN(_0x933107[_0x9c25('0x65')])?null:_0x933107[_0x9c25('0x65')];_0x374367[_0x9c25('0x66')]=isNaN(_0x933107[_0x9c25('0x67')])?null:_0x933107[_0x9c25('0x67')];_0x374367['original_bitRate']=isNaN(_0x933107[_0x9c25('0x68')])?null:_0x933107['bitRate'];_0x374367[_0x9c25('0x69')]=isNaN(_0x933107[_0x9c25('0x6a')])?null:_0x933107[_0x9c25('0x6a')];});_0x3c6f2a['on'](_0x9c25('0x6b'),function(_0x1df61e){_0x374367[_0x9c25('0x6c')]=isNaN(_0x1df61e[_0x9c25('0x63')])?null:_0x1df61e[_0x9c25('0x63')]*0x3e8;_0x374367[_0x9c25('0x6d')]=isNaN(_0x1df61e[_0x9c25('0x65')])?null:_0x1df61e[_0x9c25('0x65')];_0x374367[_0x9c25('0x6e')]=isNaN(_0x1df61e[_0x9c25('0x67')])?null:_0x1df61e[_0x9c25('0x67')];_0x374367[_0x9c25('0x6f')]=isNaN(_0x1df61e['bitRate'])?null:_0x1df61e[_0x9c25('0x68')];_0x374367['converted_sampleRate']=isNaN(_0x1df61e[_0x9c25('0x6a')])?null:_0x1df61e[_0x9c25('0x6a')];});_0x3c6f2a['on']('end',function(){fs['chmodSync'](_0x2eeb10,parseInt(_0x9c25('0x5e'),0x8));return db[_0x9c25('0x2d')]['create'](_0x374367)[_0x9c25('0x23')](function(_0x471cc2){var _0x398739={'role':_0x82ed67[_0x9c25('0x70')][_0x9c25('0x71')],'userProfileId':_0x82ed67[_0x9c25('0x70')][_0x9c25('0x72')]};if(!_0x398739)throw new Error(_0x9c25('0x73'));if(_0x398739[_0x9c25('0x71')]===_0x9c25('0x74')){var _0xecdf5e=_0x471cc2[_0x9c25('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x9c25('0x48')]({'where':{'name':_0x9c25('0x26'),'userProfileId':_0x398739['userProfileId']},'raw':!![]})['then'](function(_0xded341){if(_0xded341&&_0xded341[_0x9c25('0x75')]===0x0){return db['UserProfileResource'][_0x9c25('0x53')]({'name':_0xecdf5e[_0x9c25('0x2b')],'resourceId':_0xecdf5e['id'],'type':_0xded341['name'],'sectionId':_0xded341['id']},{})['then'](function(){return _0x471cc2;});}else{return _0x471cc2;}})[_0x9c25('0x43')](function(_0x5969c2){logger['error'](_0x9c25('0x76'),_0x5969c2);throw _0x5969c2;});}return _0x471cc2;})[_0x9c25('0x23')](respondWithResult(_0x50d10c,null))[_0x9c25('0x43')](handleError(_0x50d10c,null));});_0x3c6f2a[_0x9c25('0x77')]();}catch(_0x2e0e84){_0x50d10c[_0x9c25('0x1a')](0x1f4)[_0x9c25('0x78')](_0x2e0e84);}};exports[_0x9c25('0x22')]=function(_0x4f8241,_0x27d8a6,_0x94dfc7){return db[_0x9c25('0x2d')][_0x9c25('0x48')]({'where':{'id':_0x4f8241[_0x9c25('0x45')]['id']}})[_0x9c25('0x23')](handleEntityNotFound(_0x27d8a6,null))[_0x9c25('0x23')](saveUpdates(_[_0x9c25('0x3b')](_0x4f8241[_0x9c25('0x70')],[_0x9c25('0x2b'),_0x9c25('0x79')]),null))[_0x9c25('0x23')](respondWithResult(_0x27d8a6,null))[_0x9c25('0x43')](handleError(_0x27d8a6,null));};exports[_0x9c25('0x7a')]=function(_0x20ddec,_0x1b3bba,_0x115db1){return db[_0x9c25('0x2d')]['find']({'where':{'id':_0x20ddec[_0x9c25('0x45')]['id']}})[_0x9c25('0x23')](function(_0x44006f){if(_0x44006f){return _0x44006f[_0x9c25('0x24')]();}})[_0x9c25('0x23')](function(_0x3887db){var _0x3af5ab=path['join'](config[_0x9c25('0x4d')],_0x9c25('0x5a'),util[_0x9c25('0x51')](_0x9c25('0x52'),_0x3887db[_0x9c25('0x49')],_0x3887db[_0x9c25('0x7b')]));var _0x20ba4c=path['join'](config['root'],_0x9c25('0x4e'),util[_0x9c25('0x51')](_0x9c25('0x52'),_0x3887db['save_name'],_0x3887db[_0x9c25('0x4a')]));fs[_0x9c25('0x61')](_0x3af5ab);fs[_0x9c25('0x61')](_0x20ba4c);return _0x3887db;})['then'](function(_0x2ec1a2){if(_0x2ec1a2){return _0x1b3bba[_0x9c25('0x1a')](0xcc)[_0x9c25('0x28')]();}})[_0x9c25('0x23')](handleEntityNotFound(_0x1b3bba,null))['catch'](handleError(_0x1b3bba,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index fce74cb..d169e10 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 _0x029d=['util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./sound.attributes','exports','define','Sound','lodash'];(function(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0x029d,0xe6));var _0xd029=function(_0x167117,_0x2dee70){_0x167117=_0x167117-0x0;var _0x387b70=_0x029d[_0x167117];return _0x387b70;};'use strict';var _=require(_0xd029('0x0'));var util=require(_0xd029('0x1'));var logger=require(_0xd029('0x2'))('api');var moment=require(_0xd029('0x3'));var BPromise=require('bluebird');var rp=require(_0xd029('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd029('0x5'));var config=require(_0xd029('0x6'));var attributes=require(_0xd029('0x7'));module[_0xd029('0x8')]=function(_0x536b6c,_0x4ed002){return _0x536b6c[_0xd029('0x9')](_0xd029('0xa'),attributes,{'tableName':'tools_sounds','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x99d5=['util','../../config/logger','api','path','rimraf','./sound.attributes','exports','Sound','tools_sounds','lodash'];(function(_0x25e39e,_0x5f270d){var _0xdc664e=function(_0x1edf77){while(--_0x1edf77){_0x25e39e['push'](_0x25e39e['shift']());}};_0xdc664e(++_0x5f270d);}(_0x99d5,0x77));var _0x599d=function(_0x5ebe4b,_0x856beb){_0x5ebe4b=_0x5ebe4b-0x0;var _0x3330f7=_0x99d5[_0x5ebe4b];return _0x3330f7;};'use strict';var _=require(_0x599d('0x0'));var util=require(_0x599d('0x1'));var logger=require(_0x599d('0x2'))(_0x599d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x599d('0x4'));var rimraf=require(_0x599d('0x5'));var config=require('../../config/environment');var attributes=require(_0x599d('0x6'));module[_0x599d('0x7')]=function(_0x3657da,_0x461982){return _0x3657da['define'](_0x599d('0x8'),attributes,{'tableName':_0x599d('0x9'),'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 b463809..63fc2e6 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 _0x3b9a=['code','Sound,\x20%s,\x20%s','message','info','result','catch','ShowSound','find','raw','options','where','attributes','include','model','map','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','stringify','error'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x3b9a,0xaa));var _0xa3b9=function(_0x35e284,_0x3488ea){_0x35e284=_0x35e284-0x0;var _0x57eafc=_0x3b9a[_0x35e284];return _0x57eafc;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa3b9('0x0'));var BPromise=require(_0xa3b9('0x1'));var rs=require(_0xa3b9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa3b9('0x3'))['db'];var utils=require(_0xa3b9('0x4'));var logger=require(_0xa3b9('0x5'))(_0xa3b9('0x6'));var config=require(_0xa3b9('0x7'));var jayson=require(_0xa3b9('0x8'));var client=jayson[_0xa3b9('0x9')][_0xa3b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x409b79,_0x25a391,_0xaf7ef8){return new BPromise(function(_0x8630d0,_0x980501){return client['request'](_0x409b79,_0xaf7ef8)[_0xa3b9('0xb')](function(_0x2c6ec9){logger['info']('Sound,\x20%s,\x20%s',_0x25a391,_0xa3b9('0xc'));logger[_0xa3b9('0xd')]('Sound,\x20%s,\x20%s,\x20%s',_0x25a391,_0xa3b9('0xc'),JSON[_0xa3b9('0xe')](_0x2c6ec9));if(_0x2c6ec9[_0xa3b9('0xf')]){if(_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x10')]===0x1f4){logger[_0xa3b9('0xf')](_0xa3b9('0x11'),_0x25a391,_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x12')]);return _0x980501(_0x2c6ec9['error'][_0xa3b9('0x12')]);}logger[_0xa3b9('0xf')](_0xa3b9('0x11'),_0x25a391,_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x12')]);return _0x8630d0(_0x2c6ec9[_0xa3b9('0xf')][_0xa3b9('0x12')]);}else{logger[_0xa3b9('0x13')]('Sound,\x20%s,\x20%s',_0x25a391,_0xa3b9('0xc'));_0x8630d0(_0x2c6ec9[_0xa3b9('0x14')][_0xa3b9('0x12')]);}})[_0xa3b9('0x15')](function(_0x36ee77){logger[_0xa3b9('0xf')](_0xa3b9('0x11'),_0x25a391,_0x36ee77);_0x980501(_0x36ee77);});});}exports[_0xa3b9('0x16')]=function(_0x36885a){var _0x148c89=this;return new Promise(function(_0x411c2a,_0x4b7e94){return db['Sound'][_0xa3b9('0x17')]({'raw':_0x36885a['options']?_0x36885a['options'][_0xa3b9('0x18')]===undefined?!![]:![]:!![],'where':_0x36885a['options']?_0x36885a[_0xa3b9('0x19')][_0xa3b9('0x1a')]||null:null,'attributes':_0x36885a['options']?_0x36885a[_0xa3b9('0x19')][_0xa3b9('0x1b')]||null:null,'include':_0x36885a[_0xa3b9('0x19')]?_0x36885a[_0xa3b9('0x19')]['include']?_['map'](_0x36885a[_0xa3b9('0x19')][_0xa3b9('0x1c')],function(_0xc63d43){return{'model':db[_0xc63d43[_0xa3b9('0x1d')]],'as':_0xc63d43['as'],'attributes':_0xc63d43[_0xa3b9('0x1b')],'include':_0xc63d43[_0xa3b9('0x1c')]?_[_0xa3b9('0x1e')](_0xc63d43[_0xa3b9('0x1c')],function(_0x5b9c27){return{'model':db[_0x5b9c27[_0xa3b9('0x1d')]],'as':_0x5b9c27['as'],'attributes':_0x5b9c27['attributes'],'include':_0x5b9c27['include']?_['map'](_0x5b9c27['include'],function(_0x536927){return{'model':db[_0x536927[_0xa3b9('0x1d')]],'as':_0x536927['as'],'attributes':_0x536927[_0xa3b9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa3b9('0xb')](function(_0x85acdd){logger[_0xa3b9('0x13')](_0xa3b9('0x16'),_0x36885a);logger['debug'](_0xa3b9('0x16'),_0x36885a,JSON[_0xa3b9('0xe')](_0x85acdd));_0x411c2a(_0x85acdd);})[_0xa3b9('0x15')](function(_0x2cdce5){logger[_0xa3b9('0xf')]('ShowSound',_0x2cdce5['message'],_0x36885a);_0x4b7e94(_0x148c89[_0xa3b9('0xf')](0x1f4,_0x2cdce5[_0xa3b9('0x12')]));});});}; \ No newline at end of file +var _0xb688=['where','include','map','model','attributes','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','ShowSound','Sound','options','raw'];(function(_0x1a3389,_0x1f99f5){var _0x1df75a=function(_0x18b632){while(--_0x18b632){_0x1a3389['push'](_0x1a3389['shift']());}};_0x1df75a(++_0x1f99f5);}(_0xb688,0x1d7));var _0x8b68=function(_0x296cca,_0x2725e5){_0x296cca=_0x296cca-0x0;var _0x2da598=_0xb688[_0x296cca];return _0x2da598;};'use strict';var _=require(_0x8b68('0x0'));var util=require(_0x8b68('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8b68('0x2'));var fs=require('fs');var Redis=require(_0x8b68('0x3'));var db=require(_0x8b68('0x4'))['db'];var utils=require(_0x8b68('0x5'));var logger=require(_0x8b68('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8b68('0x7'));var client=jayson[_0x8b68('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ebfc0,_0x5dc390,_0x43b2d8){return new BPromise(function(_0x39a0b8,_0x31b7e9){return client[_0x8b68('0x9')](_0x5ebfc0,_0x43b2d8)[_0x8b68('0xa')](function(_0x3c07f4){logger[_0x8b68('0xb')](_0x8b68('0xc'),_0x5dc390,'request\x20sent');logger[_0x8b68('0xd')](_0x8b68('0xe'),_0x5dc390,_0x8b68('0xf'),JSON[_0x8b68('0x10')](_0x3c07f4));if(_0x3c07f4[_0x8b68('0x11')]){if(_0x3c07f4[_0x8b68('0x11')][_0x8b68('0x12')]===0x1f4){logger[_0x8b68('0x11')](_0x8b68('0xc'),_0x5dc390,_0x3c07f4[_0x8b68('0x11')][_0x8b68('0x13')]);return _0x31b7e9(_0x3c07f4['error'][_0x8b68('0x13')]);}logger[_0x8b68('0x11')]('Sound,\x20%s,\x20%s',_0x5dc390,_0x3c07f4['error']['message']);return _0x39a0b8(_0x3c07f4[_0x8b68('0x11')][_0x8b68('0x13')]);}else{logger[_0x8b68('0xb')]('Sound,\x20%s,\x20%s',_0x5dc390,'request\x20sent');_0x39a0b8(_0x3c07f4[_0x8b68('0x14')][_0x8b68('0x13')]);}})['catch'](function(_0x1fd2b4){logger[_0x8b68('0x11')](_0x8b68('0xc'),_0x5dc390,_0x1fd2b4);_0x31b7e9(_0x1fd2b4);});});}exports[_0x8b68('0x15')]=function(_0x2d54ef){var _0x137f99=this;return new Promise(function(_0x1c48fb,_0x228d7c){return db[_0x8b68('0x16')]['find']({'raw':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')][_0x8b68('0x18')]===undefined?!![]:![]:!![],'where':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')][_0x8b68('0x19')]||null:null,'attributes':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')]['attributes']||null:null,'include':_0x2d54ef[_0x8b68('0x17')]?_0x2d54ef[_0x8b68('0x17')][_0x8b68('0x1a')]?_[_0x8b68('0x1b')](_0x2d54ef[_0x8b68('0x17')]['include'],function(_0x57558f){return{'model':db[_0x57558f[_0x8b68('0x1c')]],'as':_0x57558f['as'],'attributes':_0x57558f['attributes'],'include':_0x57558f[_0x8b68('0x1a')]?_['map'](_0x57558f[_0x8b68('0x1a')],function(_0x34b87b){return{'model':db[_0x34b87b[_0x8b68('0x1c')]],'as':_0x34b87b['as'],'attributes':_0x34b87b['attributes'],'include':_0x34b87b[_0x8b68('0x1a')]?_[_0x8b68('0x1b')](_0x34b87b[_0x8b68('0x1a')],function(_0x18848e){return{'model':db[_0x18848e[_0x8b68('0x1c')]],'as':_0x18848e['as'],'attributes':_0x18848e[_0x8b68('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x8b68('0xa')](function(_0x3d3ef4){logger[_0x8b68('0xb')]('ShowSound',_0x2d54ef);logger[_0x8b68('0xd')](_0x8b68('0x15'),_0x2d54ef,JSON[_0x8b68('0x10')](_0x3d3ef4));_0x1c48fb(_0x3d3ef4);})[_0x8b68('0x1e')](function(_0x22c9fa){logger[_0x8b68('0x11')](_0x8b68('0x15'),_0x22c9fa[_0x8b68('0x13')],_0x2d54ef);_0x228d7c(_0x137f99['error'](0x1f4,_0x22c9fa[_0x8b68('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cf65cdc..c43731a 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 _0xda3f=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','util','path','fs-extra','../../components/interaction/service'];(function(_0xb1ee6d,_0x427b4c){var _0x559dde=function(_0x359e7a){while(--_0x359e7a){_0xb1ee6d['push'](_0xb1ee6d['shift']());}};_0x559dde(++_0x427b4c);}(_0xda3f,0xec));var _0xfda3=function(_0xeeb588,_0x7151a7){_0xeeb588=_0xeeb588-0x0;var _0x1835e7=_0xda3f[_0xeeb588];return _0x1835e7;};'use strict';var multer=require('multer');var util=require(_0xfda3('0x0'));var path=require(_0xfda3('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xfda3('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xfda3('0x3'));var config=require(_0xfda3('0x4'));var controller=require('./squareMessage.controller');router[_0xfda3('0x5')]('/',auth[_0xfda3('0x6')](),controller['index']);router['get'](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0x8')]);router[_0xfda3('0x9')]('/',auth[_0xfda3('0x6')](),controller[_0xfda3('0xa')]);router[_0xfda3('0xb')](_0xfda3('0x7'),auth[_0xfda3('0x6')](),controller[_0xfda3('0xc')]);router[_0xfda3('0xd')](_0xfda3('0x7'),auth['isAuthenticated'](),controller[_0xfda3('0xe')]);module[_0xfda3('0xf')]=router; \ No newline at end of file +var _0xac4a=['express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','isAuthenticated','get','show','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cd2a9,_0x9d7a8d){var _0x1544ad=function(_0x22acdc){while(--_0x22acdc){_0x5cd2a9['push'](_0x5cd2a9['shift']());}};_0x1544ad(++_0x9d7a8d);}(_0xac4a,0x13f));var _0xaac4=function(_0x507af6,_0x31f5b6){_0x507af6=_0x507af6-0x0;var _0x33637a=_0xac4a[_0x507af6];return _0x33637a;};'use strict';var multer=require(_0xaac4('0x0'));var util=require(_0xaac4('0x1'));var path=require(_0xaac4('0x2'));var timeout=require(_0xaac4('0x3'));var express=require(_0xaac4('0x4'));var router=express[_0xaac4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaac4('0x6'));var config=require(_0xaac4('0x7'));var controller=require(_0xaac4('0x8'));router['get']('/',auth[_0xaac4('0x9')](),controller['index']);router[_0xaac4('0xa')]('/:id',auth[_0xaac4('0x9')](),controller[_0xaac4('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xaac4('0xc')]);router['put'](_0xaac4('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xaac4('0xe')](_0xaac4('0xd'),auth[_0xaac4('0x9')](),controller[_0xaac4('0xf')]);module[_0xaac4('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index a4931fc..a4911dd 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 _0xc8e9=['medium','ENUM','out','sequelize','exports','STRING'];(function(_0x39fe14,_0x5bd555){var _0x36b4df=function(_0x4bd719){while(--_0x4bd719){_0x39fe14['push'](_0x39fe14['shift']());}};_0x36b4df(++_0x5bd555);}(_0xc8e9,0xe1));var _0x9c8e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc8e9[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x9c8e('0x0'));module[_0x9c8e('0x1')]={'uniqueid':{'type':Sequelize[_0x9c8e('0x2')]},'body':{'type':Sequelize['TEXT'](_0x9c8e('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x9c8e('0x4')]('in',_0x9c8e('0x5')),'defaultValue':_0x9c8e('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x9c8e('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xfd01=['sequelize','exports','STRING','medium','ENUM','out'];(function(_0x478cae,_0x3ac14b){var _0x47b631=function(_0x5af508){while(--_0x5af508){_0x478cae['push'](_0x478cae['shift']());}};_0x47b631(++_0x3ac14b);}(_0xfd01,0x1bc));var _0x1fd0=function(_0x3728b4,_0x1a38da){_0x3728b4=_0x3728b4-0x0;var _0x26dc9b=_0xfd01[_0x3728b4];return _0x26dc9b;};'use strict';var Sequelize=require(_0x1fd0('0x0'));module[_0x1fd0('0x1')]={'uniqueid':{'type':Sequelize[_0x1fd0('0x2')]},'body':{'type':Sequelize['TEXT'](_0x1fd0('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x1fd0('0x4')]('in',_0x1fd0('0x5')),'defaultValue':_0x1fd0('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x1fd0('0x2')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index bba26fb..2825aad 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 _0xe24e=['count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SquareMessage','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x4cdf5b,_0x2411df){var _0x14042f=function(_0x4330c3){while(--_0x4330c3){_0x4cdf5b['push'](_0x4cdf5b['shift']());}};_0x14042f(++_0x2411df);}(_0xe24e,0x15f));var _0xee24=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xe24e[_0x500419];return _0x241c1a;};'use strict';var emlformat=require(_0xee24('0x0'));var rimraf=require(_0xee24('0x1'));var zipdir=require(_0xee24('0x2'));var jsonpatch=require(_0xee24('0x3'));var rp=require(_0xee24('0x4'));var moment=require(_0xee24('0x5'));var BPromise=require(_0xee24('0x6'));var Mustache=require('mustache');var util=require(_0xee24('0x7'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xee24('0x8'));var fs=require('fs');var fs_extra=require(_0xee24('0x9'));var _=require(_0xee24('0xa'));var squel=require(_0xee24('0xb'));var crypto=require(_0xee24('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xee24('0xd'));var toCsv=require(_0xee24('0xe'));var querystring=require(_0xee24('0xf'));var Papa=require(_0xee24('0x10'));var Redis=require(_0xee24('0x11'));var authService=require(_0xee24('0x12'));var qs=require(_0xee24('0x13'));var as=require(_0xee24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xee24('0x15'))(_0xee24('0x16'));var utils=require(_0xee24('0x17'));var config=require(_0xee24('0x18'));var licenseUtil=require(_0xee24('0x19'));var db=require(_0xee24('0x1a'))['db'];function respondWithStatusCode(_0x7a2c92,_0x3a3289){_0x3a3289=_0x3a3289||0xcc;return function(_0x5b143f){if(_0x5b143f){return _0x7a2c92[_0xee24('0x1b')](_0x3a3289);}return _0x7a2c92[_0xee24('0x1c')](_0x3a3289)[_0xee24('0x1d')]();};}function respondWithResult(_0x20a438,_0x3d6824){_0x3d6824=_0x3d6824||0xc8;return function(_0x35611a){if(_0x35611a){return _0x20a438[_0xee24('0x1c')](_0x3d6824)[_0xee24('0x1e')](_0x35611a);}};}function respondWithFilteredResult(_0xe7780d,_0x2b8fe5){return function(_0x177564){if(_0x177564){var _0x42db45=typeof _0x2b8fe5[_0xee24('0x1f')]===_0xee24('0x20')&&typeof _0x2b8fe5[_0xee24('0x21')]==='undefined';var _0x49972a=_0x177564[_0xee24('0x22')];var _0x1e0609=_0x42db45?0x0:_0x2b8fe5[_0xee24('0x1f')];var _0x13b287=_0x42db45?_0x177564[_0xee24('0x22')]:_0x2b8fe5[_0xee24('0x1f')]+_0x2b8fe5[_0xee24('0x21')];var _0x110be5;if(_0x13b287>=_0x49972a){_0x13b287=_0x49972a;_0x110be5=0xc8;}else{_0x110be5=0xce;}_0xe7780d[_0xee24('0x1c')](_0x110be5);return _0xe7780d[_0xee24('0x23')](_0xee24('0x24'),_0x1e0609+'-'+_0x13b287+'/'+_0x49972a)[_0xee24('0x1e')](_0x177564);}return null;};}function patchUpdates(_0x3ec49f){return function(_0x2d961e){try{jsonpatch[_0xee24('0x25')](_0x2d961e,_0x3ec49f,!![]);}catch(_0x15c5ff){return BPromise[_0xee24('0x26')](_0x15c5ff);}return _0x2d961e[_0xee24('0x27')]();};}function saveUpdates(_0x443592,_0x14064c){return function(_0x29fcdf){if(_0x29fcdf){return _0x29fcdf[_0xee24('0x28')](_0x443592)[_0xee24('0x29')](function(_0x19ea1e){return _0x19ea1e;});}return null;};}function removeEntity(_0x677ce6,_0x19f587){return function(_0x41fad2){if(_0x41fad2){return _0x41fad2[_0xee24('0x2a')]()[_0xee24('0x29')](function(){_0x677ce6[_0xee24('0x1c')](0xcc)[_0xee24('0x1d')]();});}};}function handleEntityNotFound(_0x41f580,_0x30bd69){return function(_0x15c02f){if(!_0x15c02f){_0x41f580[_0xee24('0x1b')](0x194);}return _0x15c02f;};}function handleError(_0x7884aa,_0x471aa2){_0x471aa2=_0x471aa2||0x1f4;return function(_0x3c1083){logger[_0xee24('0x2b')](_0x3c1083['stack']);if(_0x3c1083[_0xee24('0x2c')]){delete _0x3c1083[_0xee24('0x2c')];}_0x7884aa[_0xee24('0x1c')](_0x471aa2)[_0xee24('0x2d')](_0x3c1083);};}exports[_0xee24('0x2e')]=function(_0x3d4964,_0x36e17a){var _0x6ccc9e={},_0x1b6811={},_0x5d468d={'count':0x0,'rows':[]};var _0x36a543=_[_0xee24('0x2f')](db[_0xee24('0x30')]['rawAttributes'],function(_0x3ebb7d){return{'name':_0x3ebb7d['fieldName'],'type':_0x3ebb7d[_0xee24('0x31')][_0xee24('0x32')]};});_0x1b6811[_0xee24('0x33')]=_[_0xee24('0x2f')](_0x36a543,_0xee24('0x2c'));_0x1b6811[_0xee24('0x34')]=_[_0xee24('0x35')](_0x3d4964[_0xee24('0x34')]);_0x1b6811[_0xee24('0x36')]=_[_0xee24('0x37')](_0x1b6811[_0xee24('0x33')],_0x1b6811['query']);_0x6ccc9e[_0xee24('0x38')]=_[_0xee24('0x37')](_0x1b6811[_0xee24('0x33')],qs['fields'](_0x3d4964[_0xee24('0x34')][_0xee24('0x39')]));_0x6ccc9e['attributes']=_0x6ccc9e[_0xee24('0x38')][_0xee24('0x3a')]?_0x6ccc9e['attributes']:_0x1b6811[_0xee24('0x33')];if(!_0x3d4964['query'][_0xee24('0x3b')]('nolimit')){_0x6ccc9e[_0xee24('0x21')]=qs[_0xee24('0x21')](_0x3d4964[_0xee24('0x34')][_0xee24('0x21')]);_0x6ccc9e[_0xee24('0x1f')]=qs[_0xee24('0x1f')](_0x3d4964['query'][_0xee24('0x1f')]);}_0x6ccc9e[_0xee24('0x3c')]=qs[_0xee24('0x3d')](_0x3d4964['query']['sort']);_0x6ccc9e[_0xee24('0x3e')]=qs['filters'](_['pick'](_0x3d4964['query'],_0x1b6811['filters']),_0x36a543);if(_0x3d4964[_0xee24('0x34')][_0xee24('0x3f')]){_0x6ccc9e[_0xee24('0x3e')]=_['merge'](_0x6ccc9e[_0xee24('0x3e')],{'$or':_[_0xee24('0x2f')](_0x36a543,function(_0x43e9ea){if(_0x43e9ea['type']!==_0xee24('0x40')){var _0x2d1975={};_0x2d1975[_0x43e9ea['name']]={'$like':'%'+_0x3d4964[_0xee24('0x34')][_0xee24('0x3f')]+'%'};return _0x2d1975;}})});}_0x6ccc9e=_[_0xee24('0x41')]({},_0x6ccc9e,_0x3d4964['options']);var _0x268ba3={'where':_0x6ccc9e[_0xee24('0x3e')]};return db[_0xee24('0x30')]['count'](_0x268ba3)['then'](function(_0x5b7f62){_0x5d468d[_0xee24('0x22')]=_0x5b7f62;if(_0x3d4964[_0xee24('0x34')][_0xee24('0x42')]){_0x6ccc9e[_0xee24('0x43')]=[{'all':!![]}];}return db['SquareMessage'][_0xee24('0x44')](_0x6ccc9e);})[_0xee24('0x29')](function(_0x2c063c){_0x5d468d[_0xee24('0x45')]=_0x2c063c;return _0x5d468d;})[_0xee24('0x29')](respondWithFilteredResult(_0x36e17a,_0x6ccc9e))[_0xee24('0x46')](handleError(_0x36e17a,null));};exports[_0xee24('0x47')]=function(_0x290eaf,_0x232aed){var _0x4b0e0a={'raw':!![],'where':{'id':_0x290eaf[_0xee24('0x48')]['id']}},_0x200415={};_0x200415['model']=_[_0xee24('0x35')](db[_0xee24('0x30')]['rawAttributes']);_0x200415[_0xee24('0x34')]=_[_0xee24('0x35')](_0x290eaf[_0xee24('0x34')]);_0x200415[_0xee24('0x36')]=_[_0xee24('0x37')](_0x200415[_0xee24('0x33')],_0x200415['query']);_0x4b0e0a['attributes']=_[_0xee24('0x37')](_0x200415[_0xee24('0x33')],qs[_0xee24('0x39')](_0x290eaf[_0xee24('0x34')][_0xee24('0x39')]));_0x4b0e0a[_0xee24('0x38')]=_0x4b0e0a['attributes']['length']?_0x4b0e0a[_0xee24('0x38')]:_0x200415[_0xee24('0x33')];if(_0x290eaf[_0xee24('0x34')][_0xee24('0x42')]){_0x4b0e0a[_0xee24('0x43')]=[{'all':!![]}];}_0x4b0e0a=_['merge']({},_0x4b0e0a,_0x290eaf[_0xee24('0x49')]);return db[_0xee24('0x30')][_0xee24('0x4a')](_0x4b0e0a)[_0xee24('0x29')](handleEntityNotFound(_0x232aed,null))[_0xee24('0x29')](respondWithResult(_0x232aed,null))[_0xee24('0x46')](handleError(_0x232aed,null));};exports[_0xee24('0x4b')]=function(_0xa101d8,_0xc2e74f){return db[_0xee24('0x30')]['create'](_0xa101d8['body'],{})['then'](respondWithResult(_0xc2e74f,0xc9))['catch'](handleError(_0xc2e74f,null));};exports[_0xee24('0x28')]=function(_0x4dc9ed,_0x50069a){if(_0x4dc9ed['body']['id']){delete _0x4dc9ed[_0xee24('0x4c')]['id'];}return db['SquareMessage'][_0xee24('0x4a')]({'where':{'id':_0x4dc9ed['params']['id']}})['then'](handleEntityNotFound(_0x50069a,null))[_0xee24('0x29')](saveUpdates(_0x4dc9ed[_0xee24('0x4c')],null))[_0xee24('0x29')](respondWithResult(_0x50069a,null))[_0xee24('0x46')](handleError(_0x50069a,null));};exports[_0xee24('0x2a')]=function(_0x3b5294,_0x413007){return db[_0xee24('0x30')][_0xee24('0x4a')]({'where':{'id':_0x3b5294[_0xee24('0x48')]['id']}})[_0xee24('0x29')](handleEntityNotFound(_0x413007,null))[_0xee24('0x29')](removeEntity(_0x413007,null))[_0xee24('0x46')](handleError(_0x413007,null));}; \ No newline at end of file +var _0x6c79=['rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','filter','type','merge','options','includeAll','include','findAll','rows','show','keys','create','body','catch','find','params','destroy','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','sendStatus','error','name','send','index','map','SquareMessage'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x6c79,0x184));var _0x96c7=function(_0x51e496,_0xcd0e4b){_0x51e496=_0x51e496-0x0;var _0x19cb20=_0x6c79[_0x51e496];return _0x19cb20;};'use strict';var emlformat=require(_0x96c7('0x0'));var rimraf=require(_0x96c7('0x1'));var zipdir=require(_0x96c7('0x2'));var jsonpatch=require(_0x96c7('0x3'));var rp=require(_0x96c7('0x4'));var moment=require('moment');var BPromise=require(_0x96c7('0x5'));var Mustache=require('mustache');var util=require(_0x96c7('0x6'));var path=require(_0x96c7('0x7'));var sox=require(_0x96c7('0x8'));var csv=require(_0x96c7('0x9'));var ejs=require(_0x96c7('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96c7('0xb'));var squel=require(_0x96c7('0xc'));var crypto=require(_0x96c7('0xd'));var jsforce=require(_0x96c7('0xe'));var deskjs=require(_0x96c7('0xf'));var toCsv=require('to-csv');var querystring=require(_0x96c7('0x10'));var Papa=require(_0x96c7('0x11'));var Redis=require(_0x96c7('0x12'));var authService=require(_0x96c7('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96c7('0x14'));var logger=require(_0x96c7('0x15'))('api');var utils=require(_0x96c7('0x16'));var config=require(_0x96c7('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x96c7('0x18'))['db'];function respondWithStatusCode(_0x434b36,_0x5f4bf5){_0x5f4bf5=_0x5f4bf5||0xcc;return function(_0x35d77d){if(_0x35d77d){return _0x434b36['sendStatus'](_0x5f4bf5);}return _0x434b36[_0x96c7('0x19')](_0x5f4bf5)[_0x96c7('0x1a')]();};}function respondWithResult(_0x185b2e,_0x29ebe3){_0x29ebe3=_0x29ebe3||0xc8;return function(_0x260b9a){if(_0x260b9a){return _0x185b2e['status'](_0x29ebe3)[_0x96c7('0x1b')](_0x260b9a);}};}function respondWithFilteredResult(_0x4c4727,_0x5e30be){return function(_0x547d0a){if(_0x547d0a){var _0x530b5c=typeof _0x5e30be['offset']==='undefined'&&typeof _0x5e30be[_0x96c7('0x1c')]===_0x96c7('0x1d');var _0x139fd1=_0x547d0a[_0x96c7('0x1e')];var _0x2255d7=_0x530b5c?0x0:_0x5e30be[_0x96c7('0x1f')];var _0x29104d=_0x530b5c?_0x547d0a[_0x96c7('0x1e')]:_0x5e30be[_0x96c7('0x1f')]+_0x5e30be[_0x96c7('0x1c')];var _0x45a25f;if(_0x29104d>=_0x139fd1){_0x29104d=_0x139fd1;_0x45a25f=0xc8;}else{_0x45a25f=0xce;}_0x4c4727[_0x96c7('0x19')](_0x45a25f);return _0x4c4727['set'](_0x96c7('0x20'),_0x2255d7+'-'+_0x29104d+'/'+_0x139fd1)[_0x96c7('0x1b')](_0x547d0a);}return null;};}function patchUpdates(_0x2527ca){return function(_0xb78ee9){try{jsonpatch['apply'](_0xb78ee9,_0x2527ca,!![]);}catch(_0x23a000){return BPromise[_0x96c7('0x21')](_0x23a000);}return _0xb78ee9[_0x96c7('0x22')]();};}function saveUpdates(_0x1342b7,_0x466151){return function(_0x145c1a){if(_0x145c1a){return _0x145c1a[_0x96c7('0x23')](_0x1342b7)[_0x96c7('0x24')](function(_0x92884e){return _0x92884e;});}return null;};}function removeEntity(_0x70e67f,_0x6aec95){return function(_0x46eac5){if(_0x46eac5){return _0x46eac5['destroy']()['then'](function(){_0x70e67f['status'](0xcc)[_0x96c7('0x1a')]();});}};}function handleEntityNotFound(_0x2a70c1,_0x269b98){return function(_0x5cd090){if(!_0x5cd090){_0x2a70c1[_0x96c7('0x25')](0x194);}return _0x5cd090;};}function handleError(_0x341bcc,_0x2f9cec){_0x2f9cec=_0x2f9cec||0x1f4;return function(_0x5c7a40){logger[_0x96c7('0x26')](_0x5c7a40['stack']);if(_0x5c7a40[_0x96c7('0x27')]){delete _0x5c7a40[_0x96c7('0x27')];}_0x341bcc[_0x96c7('0x19')](_0x2f9cec)[_0x96c7('0x28')](_0x5c7a40);};}exports[_0x96c7('0x29')]=function(_0x54806d,_0x3a333f){var _0x225087={},_0x5c2c9e={},_0x543aa4={'count':0x0,'rows':[]};var _0xb4195d=_[_0x96c7('0x2a')](db[_0x96c7('0x2b')][_0x96c7('0x2c')],function(_0x116935){return{'name':_0x116935[_0x96c7('0x2d')],'type':_0x116935['type']['key']};});_0x5c2c9e[_0x96c7('0x2e')]=_['map'](_0xb4195d,_0x96c7('0x27'));_0x5c2c9e[_0x96c7('0x2f')]=_['keys'](_0x54806d[_0x96c7('0x2f')]);_0x5c2c9e[_0x96c7('0x30')]=_[_0x96c7('0x31')](_0x5c2c9e[_0x96c7('0x2e')],_0x5c2c9e[_0x96c7('0x2f')]);_0x225087['attributes']=_[_0x96c7('0x31')](_0x5c2c9e['model'],qs[_0x96c7('0x32')](_0x54806d['query']['fields']));_0x225087[_0x96c7('0x33')]=_0x225087[_0x96c7('0x33')][_0x96c7('0x34')]?_0x225087[_0x96c7('0x33')]:_0x5c2c9e[_0x96c7('0x2e')];if(!_0x54806d[_0x96c7('0x2f')]['hasOwnProperty'](_0x96c7('0x35'))){_0x225087['limit']=qs[_0x96c7('0x1c')](_0x54806d[_0x96c7('0x2f')][_0x96c7('0x1c')]);_0x225087[_0x96c7('0x1f')]=qs[_0x96c7('0x1f')](_0x54806d[_0x96c7('0x2f')][_0x96c7('0x1f')]);}_0x225087[_0x96c7('0x36')]=qs['sort'](_0x54806d[_0x96c7('0x2f')]['sort']);_0x225087[_0x96c7('0x37')]=qs[_0x96c7('0x30')](_['pick'](_0x54806d['query'],_0x5c2c9e[_0x96c7('0x30')]),_0xb4195d);if(_0x54806d['query'][_0x96c7('0x38')]){_0x225087['where']=_['merge'](_0x225087['where'],{'$or':_[_0x96c7('0x2a')](_0xb4195d,function(_0x4c28f9){if(_0x4c28f9[_0x96c7('0x39')]!=='VIRTUAL'){var _0xd7bcdf={};_0xd7bcdf[_0x4c28f9['name']]={'$like':'%'+_0x54806d[_0x96c7('0x2f')][_0x96c7('0x38')]+'%'};return _0xd7bcdf;}})});}_0x225087=_[_0x96c7('0x3a')]({},_0x225087,_0x54806d[_0x96c7('0x3b')]);var _0x2c8916={'where':_0x225087[_0x96c7('0x37')]};return db[_0x96c7('0x2b')][_0x96c7('0x1e')](_0x2c8916)[_0x96c7('0x24')](function(_0x5dede1){_0x543aa4[_0x96c7('0x1e')]=_0x5dede1;if(_0x54806d['query'][_0x96c7('0x3c')]){_0x225087[_0x96c7('0x3d')]=[{'all':!![]}];}return db['SquareMessage'][_0x96c7('0x3e')](_0x225087);})[_0x96c7('0x24')](function(_0x5ca7c1){_0x543aa4[_0x96c7('0x3f')]=_0x5ca7c1;return _0x543aa4;})[_0x96c7('0x24')](respondWithFilteredResult(_0x3a333f,_0x225087))['catch'](handleError(_0x3a333f,null));};exports[_0x96c7('0x40')]=function(_0x12108f,_0x1690c4){var _0x53cb0f={'raw':!![],'where':{'id':_0x12108f['params']['id']}},_0x13235e={};_0x13235e['model']=_['keys'](db['SquareMessage'][_0x96c7('0x2c')]);_0x13235e[_0x96c7('0x2f')]=_[_0x96c7('0x41')](_0x12108f['query']);_0x13235e[_0x96c7('0x30')]=_[_0x96c7('0x31')](_0x13235e['model'],_0x13235e[_0x96c7('0x2f')]);_0x53cb0f[_0x96c7('0x33')]=_['intersection'](_0x13235e[_0x96c7('0x2e')],qs[_0x96c7('0x32')](_0x12108f[_0x96c7('0x2f')][_0x96c7('0x32')]));_0x53cb0f[_0x96c7('0x33')]=_0x53cb0f[_0x96c7('0x33')][_0x96c7('0x34')]?_0x53cb0f[_0x96c7('0x33')]:_0x13235e['model'];if(_0x12108f[_0x96c7('0x2f')][_0x96c7('0x3c')]){_0x53cb0f[_0x96c7('0x3d')]=[{'all':!![]}];}_0x53cb0f=_[_0x96c7('0x3a')]({},_0x53cb0f,_0x12108f['options']);return db[_0x96c7('0x2b')]['find'](_0x53cb0f)['then'](handleEntityNotFound(_0x1690c4,null))[_0x96c7('0x24')](respondWithResult(_0x1690c4,null))['catch'](handleError(_0x1690c4,null));};exports['create']=function(_0x3e411b,_0x1d3bcb){return db[_0x96c7('0x2b')][_0x96c7('0x42')](_0x3e411b[_0x96c7('0x43')],{})['then'](respondWithResult(_0x1d3bcb,0xc9))[_0x96c7('0x44')](handleError(_0x1d3bcb,null));};exports[_0x96c7('0x23')]=function(_0x152978,_0xb2e976){if(_0x152978[_0x96c7('0x43')]['id']){delete _0x152978[_0x96c7('0x43')]['id'];}return db[_0x96c7('0x2b')][_0x96c7('0x45')]({'where':{'id':_0x152978[_0x96c7('0x46')]['id']}})[_0x96c7('0x24')](handleEntityNotFound(_0xb2e976,null))[_0x96c7('0x24')](saveUpdates(_0x152978[_0x96c7('0x43')],null))['then'](respondWithResult(_0xb2e976,null))[_0x96c7('0x44')](handleError(_0xb2e976,null));};exports[_0x96c7('0x47')]=function(_0x175150,_0x2b89b8){return db[_0x96c7('0x2b')][_0x96c7('0x45')]({'where':{'id':_0x175150['params']['id']}})[_0x96c7('0x24')](handleEntityNotFound(_0x2b89b8,null))[_0x96c7('0x24')](removeEntity(_0x2b89b8,null))[_0x96c7('0x44')](handleError(_0x2b89b8,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6b37389..7637c2f 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 _0x49ce=['define','square_messages','lodash','util','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x519228,_0x2bcbc2){var _0xc3c605=function(_0x4d3811){while(--_0x4d3811){_0x519228['push'](_0x519228['shift']());}};_0xc3c605(++_0x2bcbc2);}(_0x49ce,0x86));var _0xe49c=function(_0x113696,_0x1843cc){_0x113696=_0x113696-0x0;var _0x1fb234=_0x49ce[_0x113696];return _0x1fb234;};'use strict';var _=require(_0xe49c('0x0'));var util=require(_0xe49c('0x1'));var logger=require(_0xe49c('0x2'))('api');var moment=require(_0xe49c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe49c('0x4'));var fs=require('fs');var path=require(_0xe49c('0x5'));var rimraf=require(_0xe49c('0x6'));var config=require(_0xe49c('0x7'));var attributes=require('./squareMessage.attributes');module[_0xe49c('0x8')]=function(_0x29781d,_0x579927){return _0x29781d[_0xe49c('0x9')]('SquareMessage',attributes,{'tableName':_0xe49c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x83de=['define','SquareMessage','square_messages','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./squareMessage.attributes','exports'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83de,0xff));var _0xe83d=function(_0x38aa80,_0x3a9d57){_0x38aa80=_0x38aa80-0x0;var _0x134b7f=_0x83de[_0x38aa80];return _0x134b7f;};'use strict';var _=require(_0xe83d('0x0'));var util=require('util');var logger=require(_0xe83d('0x1'))('api');var moment=require('moment');var BPromise=require(_0xe83d('0x2'));var rp=require(_0xe83d('0x3'));var fs=require('fs');var path=require(_0xe83d('0x4'));var rimraf=require(_0xe83d('0x5'));var config=require(_0xe83d('0x6'));var attributes=require(_0xe83d('0x7'));module[_0xe83d('0x8')]=function(_0x2bf182,_0x192e29){return _0x2bf182[_0xe83d('0x9')](_0xe83d('0xa'),attributes,{'tableName':_0xe83d('0xb'),'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 277eae4..f5243a3 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 _0xe08d=['client','http','then','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateSquareMessage','SquareMessage','create','body','options','raw','info','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x226494,_0xc4b645){var _0x27b950=function(_0x3e6acf){while(--_0x3e6acf){_0x226494['push'](_0x226494['shift']());}};_0x27b950(++_0xc4b645);}(_0xe08d,0x6d));var _0xde08=function(_0x2289b7,_0x48633b){_0x2289b7=_0x2289b7-0x0;var _0x1f5857=_0xe08d[_0x2289b7];return _0x1f5857;};'use strict';var _=require(_0xde08('0x0'));var util=require(_0xde08('0x1'));var moment=require(_0xde08('0x2'));var BPromise=require(_0xde08('0x3'));var rs=require(_0xde08('0x4'));var fs=require('fs');var Redis=require(_0xde08('0x5'));var db=require(_0xde08('0x6'))['db'];var utils=require(_0xde08('0x7'));var logger=require('../../config/logger')(_0xde08('0x8'));var config=require(_0xde08('0x9'));var jayson=require(_0xde08('0xa'));var client=jayson[_0xde08('0xb')][_0xde08('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3cca75,_0x569cc9,_0x2f3a1d){return new BPromise(function(_0x10c7a0,_0x2ff259){return client['request'](_0x3cca75,_0x2f3a1d)[_0xde08('0xd')](function(_0xb37d3c){logger['info'](_0xde08('0xe'),_0x569cc9,_0xde08('0xf'));logger[_0xde08('0x10')](_0xde08('0x11'),_0x569cc9,_0xde08('0xf'),JSON['stringify'](_0xb37d3c));if(_0xb37d3c[_0xde08('0x12')]){if(_0xb37d3c[_0xde08('0x12')][_0xde08('0x13')]===0x1f4){logger[_0xde08('0x12')](_0xde08('0xe'),_0x569cc9,_0xb37d3c['error']['message']);return _0x2ff259(_0xb37d3c[_0xde08('0x12')]['message']);}logger[_0xde08('0x12')](_0xde08('0xe'),_0x569cc9,_0xb37d3c[_0xde08('0x12')][_0xde08('0x14')]);return _0x10c7a0(_0xb37d3c[_0xde08('0x12')][_0xde08('0x14')]);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x569cc9,'request\x20sent');_0x10c7a0(_0xb37d3c['result'][_0xde08('0x14')]);}})[_0xde08('0x15')](function(_0x1f8b34){logger[_0xde08('0x12')](_0xde08('0xe'),_0x569cc9,_0x1f8b34);_0x2ff259(_0x1f8b34);});});}exports[_0xde08('0x16')]=function(_0x58e9e2){var _0x4f41f8=this;return new Promise(function(_0x291c2a,_0x5bfd1a){return db[_0xde08('0x17')][_0xde08('0x18')](_0x58e9e2[_0xde08('0x19')],{'raw':_0x58e9e2[_0xde08('0x1a')]?_0x58e9e2[_0xde08('0x1a')][_0xde08('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2b6994){logger[_0xde08('0x1c')]('CreateSquareMessage',_0x58e9e2);logger[_0xde08('0x10')](_0xde08('0x16'),_0x58e9e2,JSON[_0xde08('0x1d')](_0x2b6994));_0x291c2a(_0x2b6994);})[_0xde08('0x15')](function(_0x1fd0b3){logger['error'](_0xde08('0x16'),_0x1fd0b3[_0xde08('0x14')],_0x58e9e2);_0x5bfd1a(_0x4f41f8[_0xde08('0x12')](0x1f4,_0x1fd0b3[_0xde08('0x14')]));});});}; \ No newline at end of file +var _0x6326=['CreateSquareMessage','SquareMessage','create','body','options','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0x473f42,_0x2bf168){var _0x489f33=function(_0x4f2bfb){while(--_0x4f2bfb){_0x473f42['push'](_0x473f42['shift']());}};_0x489f33(++_0x2bf168);}(_0x6326,0x1cd));var _0x6632=function(_0xa059ea,_0x5cb91e){_0xa059ea=_0xa059ea-0x0;var _0x156a4c=_0x6326[_0xa059ea];return _0x156a4c;};'use strict';var _=require(_0x6632('0x0'));var util=require('util');var moment=require(_0x6632('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6632('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6632('0x3'))(_0x6632('0x4'));var config=require(_0x6632('0x5'));var jayson=require(_0x6632('0x6'));var client=jayson[_0x6632('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1ae2c6,_0x33c18d,_0x342ce6){return new BPromise(function(_0x4fa720,_0x14409a){return client['request'](_0x1ae2c6,_0x342ce6)[_0x6632('0x8')](function(_0x4e1403){logger[_0x6632('0x9')](_0x6632('0xa'),_0x33c18d,_0x6632('0xb'));logger[_0x6632('0xc')](_0x6632('0xd'),_0x33c18d,'request\x20sent',JSON[_0x6632('0xe')](_0x4e1403));if(_0x4e1403[_0x6632('0xf')]){if(_0x4e1403[_0x6632('0xf')][_0x6632('0x10')]===0x1f4){logger[_0x6632('0xf')]('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x4e1403[_0x6632('0xf')]['message']);return _0x14409a(_0x4e1403[_0x6632('0xf')][_0x6632('0x11')]);}logger[_0x6632('0xf')]('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x4e1403[_0x6632('0xf')][_0x6632('0x11')]);return _0x4fa720(_0x4e1403[_0x6632('0xf')]['message']);}else{logger['info']('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x6632('0xb'));_0x4fa720(_0x4e1403['result'][_0x6632('0x11')]);}})[_0x6632('0x12')](function(_0x5afb8c){logger['error']('SquareMessage,\x20%s,\x20%s',_0x33c18d,_0x5afb8c);_0x14409a(_0x5afb8c);});});}exports[_0x6632('0x13')]=function(_0xba152a){var _0x386f3f=this;return new Promise(function(_0x3fd21b,_0x56360c){return db[_0x6632('0x14')][_0x6632('0x15')](_0xba152a[_0x6632('0x16')],{'raw':_0xba152a[_0x6632('0x17')]?_0xba152a[_0x6632('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x6632('0x8')](function(_0x488507){logger[_0x6632('0x9')]('CreateSquareMessage',_0xba152a);logger['debug']('CreateSquareMessage',_0xba152a,JSON[_0x6632('0xe')](_0x488507));_0x3fd21b(_0x488507);})['catch'](function(_0x4d4b82){logger['error'](_0x6632('0x13'),_0x4d4b82[_0x6632('0x11')],_0xba152a);_0x56360c(_0x386f3f[_0x6632('0xf')](0x1f4,_0x4d4b82[_0x6632('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 01f388e..4e52a20 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 _0xc86a=['test','post','create','put','update','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s'];(function(_0x139928,_0x41ed69){var _0x16ef95=function(_0x12e1cf){while(--_0x12e1cf){_0x139928['push'](_0x139928['shift']());}};_0x16ef95(++_0x41ed69);}(_0xc86a,0x11e));var _0xac86=function(_0x2b737c,_0x274adf){_0x2b737c=_0x2b737c-0x0;var _0x466ed5=_0xc86a[_0x2b737c];return _0x466ed5;};'use strict';var multer=require(_0xac86('0x0'));var util=require('util');var path=require(_0xac86('0x1'));var timeout=require(_0xac86('0x2'));var express=require(_0xac86('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xac86('0x4'));var interaction=require(_0xac86('0x5'));var config=require(_0xac86('0x6'));var controller=require('./squareOdbc.controller');router[_0xac86('0x7')]('/',auth[_0xac86('0x8')](),controller[_0xac86('0x9')]);router[_0xac86('0x7')](_0xac86('0xa'),auth['isAuthenticated'](),controller[_0xac86('0xb')]);router[_0xac86('0x7')](_0xac86('0xc'),auth[_0xac86('0x8')](),timeout(_0xac86('0xd')),controller[_0xac86('0xe')]);router[_0xac86('0xf')]('/',auth[_0xac86('0x8')](),controller[_0xac86('0x10')]);router[_0xac86('0x11')](_0xac86('0xa'),auth[_0xac86('0x8')](),controller[_0xac86('0x12')]);router['delete']('/:id',auth[_0xac86('0x8')](),controller['destroy']);module[_0xac86('0x13')]=router; \ No newline at end of file +var _0xe115=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/test','15s','create','put','update'];(function(_0x434b4c,_0x2f9dcc){var _0x2d0187=function(_0x18a955){while(--_0x18a955){_0x434b4c['push'](_0x434b4c['shift']());}};_0x2d0187(++_0x2f9dcc);}(_0xe115,0xeb));var _0x5e11=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xe115[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x5e11('0x0'));var util=require(_0x5e11('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x5e11('0x2'));var router=express[_0x5e11('0x3')]();var fs_extra=require(_0x5e11('0x4'));var auth=require(_0x5e11('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5e11('0x6'));var controller=require('./squareOdbc.controller');router[_0x5e11('0x7')]('/',auth[_0x5e11('0x8')](),controller[_0x5e11('0x9')]);router[_0x5e11('0x7')](_0x5e11('0xa'),auth[_0x5e11('0x8')](),controller[_0x5e11('0xb')]);router[_0x5e11('0x7')](_0x5e11('0xc'),auth['isAuthenticated'](),timeout(_0x5e11('0xd')),controller['test']);router['post']('/',auth[_0x5e11('0x8')](),controller[_0x5e11('0xe')]);router[_0x5e11('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x5e11('0x10')]);router['delete']('/:id',auth[_0x5e11('0x8')](),controller['destroy']);module[_0x5e11('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 0724048..e4a9d2b 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 _0x573c=['name','sequelize','exports','STRING'];(function(_0x330141,_0x1dd290){var _0x1b68a2=function(_0x4e7f3c){while(--_0x4e7f3c){_0x330141['push'](_0x330141['shift']());}};_0x1b68a2(++_0x1dd290);}(_0x573c,0xa1));var _0xc573=function(_0x2a9749,_0x10b5b7){_0x2a9749=_0x2a9749-0x0;var _0x53ad53=_0x573c[_0x2a9749];return _0x53ad53;};'use strict';var Sequelize=require(_0xc573('0x0'));module[_0xc573('0x1')]={'name':{'type':Sequelize[_0xc573('0x2')],'unique':_0xc573('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0xc573('0x2')]},'description':{'type':Sequelize[_0xc573('0x2')]}}; \ No newline at end of file +var _0x079f=['name','sequelize','exports','STRING'];(function(_0x40dfad,_0x1fbaa7){var _0x4c6b8d=function(_0x3c3ee6){while(--_0x3c3ee6){_0x40dfad['push'](_0x40dfad['shift']());}};_0x4c6b8d(++_0x1fbaa7);}(_0x079f,0x8d));var _0xf079=function(_0x95a91a,_0x3599a7){_0x95a91a=_0x95a91a-0x0;var _0x5b0453=_0x079f[_0x95a91a];return _0x5b0453;};'use strict';var Sequelize=require(_0xf079('0x0'));module[_0xf079('0x1')]={'name':{'type':Sequelize[_0xf079('0x2')],'unique':_0xf079('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf079('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3a3f73d..c63ac29 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 _0xebcc=['fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','ODBC','sendStatus','error','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','get','role','user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir'];(function(_0x2da765,_0x4ff68a){var _0x4ba661=function(_0x202217){while(--_0x202217){_0x2da765['push'](_0x2da765['shift']());}};_0x4ba661(++_0x4ff68a);}(_0xebcc,0x161));var _0xcebc=function(_0x2b12a8,_0x52f321){_0x2b12a8=_0x2b12a8-0x0;var _0xd38ecc=_0xebcc[_0x2b12a8];return _0xd38ecc;};'use strict';var emlformat=require(_0xcebc('0x0'));var rimraf=require(_0xcebc('0x1'));var zipdir=require(_0xcebc('0x2'));var jsonpatch=require(_0xcebc('0x3'));var rp=require(_0xcebc('0x4'));var moment=require(_0xcebc('0x5'));var BPromise=require(_0xcebc('0x6'));var Mustache=require(_0xcebc('0x7'));var util=require('util');var path=require('path');var sox=require(_0xcebc('0x8'));var csv=require('to-csv');var ejs=require(_0xcebc('0x9'));var fs=require('fs');var fs_extra=require(_0xcebc('0xa'));var _=require(_0xcebc('0xb'));var squel=require(_0xcebc('0xc'));var crypto=require(_0xcebc('0xd'));var jsforce=require(_0xcebc('0xe'));var deskjs=require(_0xcebc('0xf'));var toCsv=require(_0xcebc('0x10'));var querystring=require('querystring');var Papa=require(_0xcebc('0x11'));var Redis=require(_0xcebc('0x12'));var authService=require(_0xcebc('0x13'));var qs=require(_0xcebc('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcebc('0x15'));var logger=require(_0xcebc('0x16'))(_0xcebc('0x17'));var utils=require('../../config/utils');var config=require(_0xcebc('0x18'));var licenseUtil=require(_0xcebc('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc110b5,_0x4f15ca){_0x4f15ca=_0x4f15ca||0xcc;return function(_0x2d20a2){if(_0x2d20a2){return _0xc110b5['sendStatus'](_0x4f15ca);}return _0xc110b5[_0xcebc('0x1a')](_0x4f15ca)[_0xcebc('0x1b')]();};}function respondWithResult(_0x3b3d3a,_0x2db149){_0x2db149=_0x2db149||0xc8;return function(_0x2efce4){if(_0x2efce4){return _0x3b3d3a[_0xcebc('0x1a')](_0x2db149)[_0xcebc('0x1c')](_0x2efce4);}};}function respondWithFilteredResult(_0x259403,_0x545279){return function(_0x5a7627){if(_0x5a7627){var _0x24e388=typeof _0x545279[_0xcebc('0x1d')]===_0xcebc('0x1e')&&typeof _0x545279[_0xcebc('0x1f')]==='undefined';var _0x4278db=_0x5a7627[_0xcebc('0x20')];var _0xce210a=_0x24e388?0x0:_0x545279[_0xcebc('0x1d')];var _0x588c72=_0x24e388?_0x5a7627['count']:_0x545279[_0xcebc('0x1d')]+_0x545279[_0xcebc('0x1f')];var _0x29d258;if(_0x588c72>=_0x4278db){_0x588c72=_0x4278db;_0x29d258=0xc8;}else{_0x29d258=0xce;}_0x259403[_0xcebc('0x1a')](_0x29d258);return _0x259403[_0xcebc('0x21')]('Content-Range',_0xce210a+'-'+_0x588c72+'/'+_0x4278db)[_0xcebc('0x1c')](_0x5a7627);}return null;};}function patchUpdates(_0x51b09b){return function(_0x5eb895){try{jsonpatch[_0xcebc('0x22')](_0x5eb895,_0x51b09b,!![]);}catch(_0x44893b){return BPromise[_0xcebc('0x23')](_0x44893b);}return _0x5eb895[_0xcebc('0x24')]();};}function saveUpdates(_0x5280f0,_0x47a1e9){return function(_0x59478c){if(_0x59478c){return _0x59478c[_0xcebc('0x25')](_0x5280f0)[_0xcebc('0x26')](function(_0x4106bc){return _0x4106bc;});}return null;};}function removeEntity(_0x48ff8e,_0x3c1820){return function(_0x616cc2){if(_0x616cc2){return _0x616cc2[_0xcebc('0x27')]()[_0xcebc('0x26')](function(){var _0x3dc5e0=_0x616cc2['get']({'plain':!![]});var _0x165223=_0xcebc('0x28');return db['UserProfileResource'][_0xcebc('0x27')]({'where':{'type':_0x165223,'resourceId':_0x3dc5e0['id']}})[_0xcebc('0x26')](function(){return _0x616cc2;});})[_0xcebc('0x26')](function(){_0x48ff8e['status'](0xcc)[_0xcebc('0x1b')]();});}};}function handleEntityNotFound(_0x4567d0,_0x1319e5){return function(_0x55f81b){if(!_0x55f81b){_0x4567d0[_0xcebc('0x29')](0x194);}return _0x55f81b;};}function handleError(_0x3bc289,_0x505aee){_0x505aee=_0x505aee||0x1f4;return function(_0x146ecb){logger[_0xcebc('0x2a')](_0x146ecb[_0xcebc('0x2b')]);if(_0x146ecb[_0xcebc('0x2c')]){delete _0x146ecb['name'];}_0x3bc289['status'](_0x505aee)[_0xcebc('0x2d')](_0x146ecb);};}exports[_0xcebc('0x2e')]=function(_0x148f72,_0x204f27){var _0x2bc808={},_0x5bdd5a={},_0x596852={'count':0x0,'rows':[]};var _0x35fe50=_[_0xcebc('0x2f')](db[_0xcebc('0x30')][_0xcebc('0x31')],function(_0x3c48c0){return{'name':_0x3c48c0[_0xcebc('0x32')],'type':_0x3c48c0[_0xcebc('0x33')]['key']};});_0x5bdd5a[_0xcebc('0x34')]=_[_0xcebc('0x2f')](_0x35fe50,_0xcebc('0x2c'));_0x5bdd5a[_0xcebc('0x35')]=_['keys'](_0x148f72[_0xcebc('0x35')]);_0x5bdd5a[_0xcebc('0x36')]=_[_0xcebc('0x37')](_0x5bdd5a[_0xcebc('0x34')],_0x5bdd5a[_0xcebc('0x35')]);_0x2bc808[_0xcebc('0x38')]=_['intersection'](_0x5bdd5a[_0xcebc('0x34')],qs[_0xcebc('0x39')](_0x148f72[_0xcebc('0x35')][_0xcebc('0x39')]));_0x2bc808[_0xcebc('0x38')]=_0x2bc808[_0xcebc('0x38')][_0xcebc('0x3a')]?_0x2bc808['attributes']:_0x5bdd5a[_0xcebc('0x34')];if(!_0x148f72['query'][_0xcebc('0x3b')]('nolimit')){_0x2bc808[_0xcebc('0x1f')]=qs[_0xcebc('0x1f')](_0x148f72['query'][_0xcebc('0x1f')]);_0x2bc808['offset']=qs[_0xcebc('0x1d')](_0x148f72[_0xcebc('0x35')][_0xcebc('0x1d')]);}_0x2bc808[_0xcebc('0x3c')]=qs[_0xcebc('0x3d')](_0x148f72[_0xcebc('0x35')]['sort']);_0x2bc808[_0xcebc('0x3e')]=qs[_0xcebc('0x36')](_[_0xcebc('0x3f')](_0x148f72[_0xcebc('0x35')],_0x5bdd5a[_0xcebc('0x36')]),_0x35fe50);if(_0x148f72['query']['filter']){_0x2bc808[_0xcebc('0x3e')]=_['merge'](_0x2bc808[_0xcebc('0x3e')],{'$or':_['map'](_0x35fe50,function(_0x208757){if(_0x208757[_0xcebc('0x33')]!=='VIRTUAL'){var _0x380a81={};_0x380a81[_0x208757['name']]={'$like':'%'+_0x148f72[_0xcebc('0x35')][_0xcebc('0x40')]+'%'};return _0x380a81;}})});}_0x2bc808=_[_0xcebc('0x41')]({},_0x2bc808,_0x148f72['options']);var _0x26c6e9={'where':_0x2bc808[_0xcebc('0x3e')]};return db[_0xcebc('0x30')][_0xcebc('0x20')](_0x26c6e9)[_0xcebc('0x26')](function(_0x54c071){_0x596852[_0xcebc('0x20')]=_0x54c071;if(_0x148f72[_0xcebc('0x35')][_0xcebc('0x42')]){_0x2bc808[_0xcebc('0x43')]=[{'all':!![]}];}return db[_0xcebc('0x30')]['findAll'](_0x2bc808);})['then'](function(_0x54595d){_0x596852[_0xcebc('0x44')]=_0x54595d;return _0x596852;})[_0xcebc('0x26')](respondWithFilteredResult(_0x204f27,_0x2bc808))[_0xcebc('0x45')](handleError(_0x204f27,null));};exports[_0xcebc('0x46')]=function(_0x33569b,_0x4cba64){var _0x511ad2={'raw':!![],'where':{'id':_0x33569b[_0xcebc('0x47')]['id']}},_0x421de1={};_0x421de1['model']=_[_0xcebc('0x48')](db[_0xcebc('0x30')]['rawAttributes']);_0x421de1[_0xcebc('0x35')]=_[_0xcebc('0x48')](_0x33569b[_0xcebc('0x35')]);_0x421de1['filters']=_[_0xcebc('0x37')](_0x421de1[_0xcebc('0x34')],_0x421de1[_0xcebc('0x35')]);_0x511ad2[_0xcebc('0x38')]=_[_0xcebc('0x37')](_0x421de1[_0xcebc('0x34')],qs[_0xcebc('0x39')](_0x33569b[_0xcebc('0x35')][_0xcebc('0x39')]));_0x511ad2[_0xcebc('0x38')]=_0x511ad2[_0xcebc('0x38')]['length']?_0x511ad2[_0xcebc('0x38')]:_0x421de1[_0xcebc('0x34')];if(_0x33569b[_0xcebc('0x35')]['includeAll']){_0x511ad2[_0xcebc('0x43')]=[{'all':!![]}];}_0x511ad2=_[_0xcebc('0x41')]({},_0x511ad2,_0x33569b[_0xcebc('0x49')]);return db[_0xcebc('0x30')][_0xcebc('0x4a')](_0x511ad2)[_0xcebc('0x26')](handleEntityNotFound(_0x4cba64,null))[_0xcebc('0x26')](respondWithResult(_0x4cba64,null))[_0xcebc('0x45')](handleError(_0x4cba64,null));};exports[_0xcebc('0x4b')]=function(_0x16d74e,_0x16f611){return db[_0xcebc('0x30')][_0xcebc('0x4b')](_0x16d74e[_0xcebc('0x4c')],{})[_0xcebc('0x26')](function(_0x126bcf){var _0x496a46=_0x16d74e['user'][_0xcebc('0x4d')]({'plain':!![]});if(!_0x496a46)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x496a46[_0xcebc('0x4e')]===_0xcebc('0x4f')){var _0x372c55=_0x126bcf[_0xcebc('0x4d')]({'plain':!![]});var _0x50885f='ODBC';return db['UserProfileSection'][_0xcebc('0x4a')]({'where':{'name':_0x50885f,'userProfileId':_0x496a46[_0xcebc('0x50')]},'raw':!![]})[_0xcebc('0x26')](function(_0x1ab293){if(_0x1ab293&&_0x1ab293[_0xcebc('0x51')]===0x0){return db[_0xcebc('0x52')][_0xcebc('0x4b')]({'name':_0x372c55[_0xcebc('0x2c')],'resourceId':_0x372c55['id'],'type':_0x1ab293['name'],'sectionId':_0x1ab293['id']},{})[_0xcebc('0x26')](function(){return _0x126bcf;});}else{return _0x126bcf;}})[_0xcebc('0x45')](function(_0xb191ff){logger[_0xcebc('0x2a')](_0xcebc('0x53'),_0xb191ff);throw _0xb191ff;});}return _0x126bcf;})[_0xcebc('0x26')](respondWithResult(_0x16f611,0xc9))['catch'](handleError(_0x16f611,null));};exports[_0xcebc('0x25')]=function(_0x51da65,_0x244f25){if(_0x51da65[_0xcebc('0x4c')]['id']){delete _0x51da65[_0xcebc('0x4c')]['id'];}return db[_0xcebc('0x30')][_0xcebc('0x4a')]({'where':{'id':_0x51da65[_0xcebc('0x47')]['id']}})[_0xcebc('0x26')](handleEntityNotFound(_0x244f25,null))[_0xcebc('0x26')](saveUpdates(_0x51da65[_0xcebc('0x4c')],null))[_0xcebc('0x26')](respondWithResult(_0x244f25,null))[_0xcebc('0x45')](handleError(_0x244f25,null));};exports[_0xcebc('0x27')]=function(_0x3847ee,_0x52ff13){return db[_0xcebc('0x30')][_0xcebc('0x4a')]({'where':{'id':_0x3847ee[_0xcebc('0x47')]['id']}})['then'](handleEntityNotFound(_0x52ff13,null))['then'](removeEntity(_0x52ff13,null))[_0xcebc('0x45')](handleError(_0x52ff13,null));};exports[_0xcebc('0x54')]=function(_0x19b905,_0x633050,_0x161d12){var _0x4076df;return db[_0xcebc('0x30')]['find']({'where':{'id':_0x19b905[_0xcebc('0x47')]['id']},'attributes':['id',_0xcebc('0x55')]})[_0xcebc('0x26')](handleEntityNotFound(_0x633050,null))[_0xcebc('0x26')](function(_0x3d98a5){if(_0x3d98a5){var _0x4cc7b1=require(_0xcebc('0x56'))();_0x4cc7b1[_0xcebc('0x57')](_0x3d98a5[_0xcebc('0x55')]);_0x4cc7b1[_0xcebc('0x58')]();return _0x3d98a5;}})[_0xcebc('0x26')](respondWithResult(_0x633050,null))[_0xcebc('0x45')](handleError(_0x633050,null));}; \ No newline at end of file +var _0xa385=['findAll','rows','catch','show','params','includeAll','include','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','ODBC','error','stack','name','index','SquareOdbc','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','VIRTUAL','filter','options'];(function(_0x351fb7,_0x98949e){var _0x433ac8=function(_0x230ac9){while(--_0x230ac9){_0x351fb7['push'](_0x351fb7['shift']());}};_0x433ac8(++_0x98949e);}(_0xa385,0x11c));var _0x5a38=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xa385[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x5a38('0x0'));var rimraf=require(_0x5a38('0x1'));var zipdir=require(_0x5a38('0x2'));var jsonpatch=require(_0x5a38('0x3'));var rp=require(_0x5a38('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5a38('0x5'));var util=require('util');var path=require(_0x5a38('0x6'));var sox=require(_0x5a38('0x7'));var csv=require(_0x5a38('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5a38('0x9'));var squel=require(_0x5a38('0xa'));var crypto=require(_0x5a38('0xb'));var jsforce=require(_0x5a38('0xc'));var deskjs=require(_0x5a38('0xd'));var toCsv=require(_0x5a38('0x8'));var querystring=require(_0x5a38('0xe'));var Papa=require(_0x5a38('0xf'));var Redis=require(_0x5a38('0x10'));var authService=require(_0x5a38('0x11'));var qs=require(_0x5a38('0x12'));var as=require(_0x5a38('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5a38('0x14'));var utils=require('../../config/utils');var config=require(_0x5a38('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5a38('0x16'))['db'];function respondWithStatusCode(_0x47f804,_0x9be52b){_0x9be52b=_0x9be52b||0xcc;return function(_0x530550){if(_0x530550){return _0x47f804[_0x5a38('0x17')](_0x9be52b);}return _0x47f804[_0x5a38('0x18')](_0x9be52b)[_0x5a38('0x19')]();};}function respondWithResult(_0x413836,_0x1d3c4a){_0x1d3c4a=_0x1d3c4a||0xc8;return function(_0x36a6e0){if(_0x36a6e0){return _0x413836[_0x5a38('0x18')](_0x1d3c4a)[_0x5a38('0x1a')](_0x36a6e0);}};}function respondWithFilteredResult(_0xd8b1b2,_0x598f59){return function(_0x5e343d){if(_0x5e343d){var _0x35bb1d=typeof _0x598f59[_0x5a38('0x1b')]===_0x5a38('0x1c')&&typeof _0x598f59[_0x5a38('0x1d')]===_0x5a38('0x1c');var _0x4e6e55=_0x5e343d[_0x5a38('0x1e')];var _0x2bc69d=_0x35bb1d?0x0:_0x598f59[_0x5a38('0x1b')];var _0x46071f=_0x35bb1d?_0x5e343d[_0x5a38('0x1e')]:_0x598f59['offset']+_0x598f59[_0x5a38('0x1d')];var _0x2f82ae;if(_0x46071f>=_0x4e6e55){_0x46071f=_0x4e6e55;_0x2f82ae=0xc8;}else{_0x2f82ae=0xce;}_0xd8b1b2['status'](_0x2f82ae);return _0xd8b1b2['set'](_0x5a38('0x1f'),_0x2bc69d+'-'+_0x46071f+'/'+_0x4e6e55)['json'](_0x5e343d);}return null;};}function patchUpdates(_0xbbb36c){return function(_0x24b237){try{jsonpatch['apply'](_0x24b237,_0xbbb36c,!![]);}catch(_0x2f5320){return BPromise[_0x5a38('0x20')](_0x2f5320);}return _0x24b237[_0x5a38('0x21')]();};}function saveUpdates(_0x1bad9b,_0x28e234){return function(_0x283660){if(_0x283660){return _0x283660[_0x5a38('0x22')](_0x1bad9b)['then'](function(_0x2f4c42){return _0x2f4c42;});}return null;};}function removeEntity(_0x204928,_0x4eae7a){return function(_0x5061aa){if(_0x5061aa){return _0x5061aa[_0x5a38('0x23')]()[_0x5a38('0x24')](function(){var _0x5df4aa=_0x5061aa['get']({'plain':!![]});var _0x3399a5=_0x5a38('0x25');return db['UserProfileResource'][_0x5a38('0x23')]({'where':{'type':_0x3399a5,'resourceId':_0x5df4aa['id']}})[_0x5a38('0x24')](function(){return _0x5061aa;});})[_0x5a38('0x24')](function(){_0x204928['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xc1f6bf,_0x56ed1f){return function(_0xf6fdcb){if(!_0xf6fdcb){_0xc1f6bf[_0x5a38('0x17')](0x194);}return _0xf6fdcb;};}function handleError(_0x280ab2,_0x40f604){_0x40f604=_0x40f604||0x1f4;return function(_0x396bc7){logger[_0x5a38('0x26')](_0x396bc7[_0x5a38('0x27')]);if(_0x396bc7[_0x5a38('0x28')]){delete _0x396bc7['name'];}_0x280ab2['status'](_0x40f604)['send'](_0x396bc7);};}exports[_0x5a38('0x29')]=function(_0x327680,_0x2d5392){var _0x2e3699={},_0x2ac7b6={},_0x16912f={'count':0x0,'rows':[]};var _0x2ea459=_['map'](db[_0x5a38('0x2a')]['rawAttributes'],function(_0xf3de5b){return{'name':_0xf3de5b[_0x5a38('0x2b')],'type':_0xf3de5b['type'][_0x5a38('0x2c')]};});_0x2ac7b6[_0x5a38('0x2d')]=_['map'](_0x2ea459,_0x5a38('0x28'));_0x2ac7b6[_0x5a38('0x2e')]=_[_0x5a38('0x2f')](_0x327680[_0x5a38('0x2e')]);_0x2ac7b6[_0x5a38('0x30')]=_[_0x5a38('0x31')](_0x2ac7b6[_0x5a38('0x2d')],_0x2ac7b6[_0x5a38('0x2e')]);_0x2e3699[_0x5a38('0x32')]=_[_0x5a38('0x31')](_0x2ac7b6[_0x5a38('0x2d')],qs[_0x5a38('0x33')](_0x327680[_0x5a38('0x2e')][_0x5a38('0x33')]));_0x2e3699[_0x5a38('0x32')]=_0x2e3699[_0x5a38('0x32')][_0x5a38('0x34')]?_0x2e3699['attributes']:_0x2ac7b6[_0x5a38('0x2d')];if(!_0x327680['query'][_0x5a38('0x35')](_0x5a38('0x36'))){_0x2e3699[_0x5a38('0x1d')]=qs[_0x5a38('0x1d')](_0x327680[_0x5a38('0x2e')][_0x5a38('0x1d')]);_0x2e3699[_0x5a38('0x1b')]=qs[_0x5a38('0x1b')](_0x327680['query'][_0x5a38('0x1b')]);}_0x2e3699[_0x5a38('0x37')]=qs[_0x5a38('0x38')](_0x327680[_0x5a38('0x2e')][_0x5a38('0x38')]);_0x2e3699['where']=qs[_0x5a38('0x30')](_[_0x5a38('0x39')](_0x327680[_0x5a38('0x2e')],_0x2ac7b6['filters']),_0x2ea459);if(_0x327680[_0x5a38('0x2e')]['filter']){_0x2e3699[_0x5a38('0x3a')]=_[_0x5a38('0x3b')](_0x2e3699['where'],{'$or':_[_0x5a38('0x3c')](_0x2ea459,function(_0x51fedc){if(_0x51fedc['type']!==_0x5a38('0x3d')){var _0x3e0f4e={};_0x3e0f4e[_0x51fedc[_0x5a38('0x28')]]={'$like':'%'+_0x327680[_0x5a38('0x2e')][_0x5a38('0x3e')]+'%'};return _0x3e0f4e;}})});}_0x2e3699=_[_0x5a38('0x3b')]({},_0x2e3699,_0x327680[_0x5a38('0x3f')]);var _0x57a115={'where':_0x2e3699['where']};return db['SquareOdbc'][_0x5a38('0x1e')](_0x57a115)[_0x5a38('0x24')](function(_0x4489b8){_0x16912f[_0x5a38('0x1e')]=_0x4489b8;if(_0x327680['query']['includeAll']){_0x2e3699['include']=[{'all':!![]}];}return db[_0x5a38('0x2a')][_0x5a38('0x40')](_0x2e3699);})[_0x5a38('0x24')](function(_0x30268d){_0x16912f[_0x5a38('0x41')]=_0x30268d;return _0x16912f;})[_0x5a38('0x24')](respondWithFilteredResult(_0x2d5392,_0x2e3699))[_0x5a38('0x42')](handleError(_0x2d5392,null));};exports[_0x5a38('0x43')]=function(_0x3c412a,_0xd5659c){var _0x101910={'raw':!![],'where':{'id':_0x3c412a[_0x5a38('0x44')]['id']}},_0x19861c={};_0x19861c[_0x5a38('0x2d')]=_[_0x5a38('0x2f')](db[_0x5a38('0x2a')]['rawAttributes']);_0x19861c['query']=_[_0x5a38('0x2f')](_0x3c412a[_0x5a38('0x2e')]);_0x19861c[_0x5a38('0x30')]=_['intersection'](_0x19861c[_0x5a38('0x2d')],_0x19861c[_0x5a38('0x2e')]);_0x101910[_0x5a38('0x32')]=_['intersection'](_0x19861c[_0x5a38('0x2d')],qs[_0x5a38('0x33')](_0x3c412a[_0x5a38('0x2e')]['fields']));_0x101910[_0x5a38('0x32')]=_0x101910[_0x5a38('0x32')][_0x5a38('0x34')]?_0x101910[_0x5a38('0x32')]:_0x19861c['model'];if(_0x3c412a['query'][_0x5a38('0x45')]){_0x101910[_0x5a38('0x46')]=[{'all':!![]}];}_0x101910=_[_0x5a38('0x3b')]({},_0x101910,_0x3c412a['options']);return db[_0x5a38('0x2a')]['find'](_0x101910)[_0x5a38('0x24')](handleEntityNotFound(_0xd5659c,null))['then'](respondWithResult(_0xd5659c,null))['catch'](handleError(_0xd5659c,null));};exports['create']=function(_0x355b24,_0x5c2a2a){return db[_0x5a38('0x2a')][_0x5a38('0x47')](_0x355b24[_0x5a38('0x48')],{})['then'](function(_0x38a76b){var _0x4e4146=_0x355b24[_0x5a38('0x49')][_0x5a38('0x4a')]({'plain':!![]});if(!_0x4e4146)throw new Error(_0x5a38('0x4b'));if(_0x4e4146[_0x5a38('0x4c')]===_0x5a38('0x49')){var _0x359694=_0x38a76b['get']({'plain':!![]});var _0x4a9045=_0x5a38('0x25');return db[_0x5a38('0x4d')][_0x5a38('0x4e')]({'where':{'name':_0x4a9045,'userProfileId':_0x4e4146[_0x5a38('0x4f')]},'raw':!![]})[_0x5a38('0x24')](function(_0x4254fd){if(_0x4254fd&&_0x4254fd[_0x5a38('0x50')]===0x0){return db['UserProfileResource'][_0x5a38('0x47')]({'name':_0x359694[_0x5a38('0x28')],'resourceId':_0x359694['id'],'type':_0x4254fd[_0x5a38('0x28')],'sectionId':_0x4254fd['id']},{})['then'](function(){return _0x38a76b;});}else{return _0x38a76b;}})[_0x5a38('0x42')](function(_0x3a445f){logger[_0x5a38('0x26')](_0x5a38('0x51'),_0x3a445f);throw _0x3a445f;});}return _0x38a76b;})[_0x5a38('0x24')](respondWithResult(_0x5c2a2a,0xc9))[_0x5a38('0x42')](handleError(_0x5c2a2a,null));};exports[_0x5a38('0x22')]=function(_0x33a76d,_0x46a690){if(_0x33a76d['body']['id']){delete _0x33a76d[_0x5a38('0x48')]['id'];}return db[_0x5a38('0x2a')][_0x5a38('0x4e')]({'where':{'id':_0x33a76d['params']['id']}})[_0x5a38('0x24')](handleEntityNotFound(_0x46a690,null))[_0x5a38('0x24')](saveUpdates(_0x33a76d[_0x5a38('0x48')],null))['then'](respondWithResult(_0x46a690,null))[_0x5a38('0x42')](handleError(_0x46a690,null));};exports['destroy']=function(_0x5bf9df,_0x42bb30){return db['SquareOdbc']['find']({'where':{'id':_0x5bf9df['params']['id']}})[_0x5a38('0x24')](handleEntityNotFound(_0x42bb30,null))['then'](removeEntity(_0x42bb30,null))[_0x5a38('0x42')](handleError(_0x42bb30,null));};exports[_0x5a38('0x52')]=function(_0xe65808,_0x268cc2,_0x289738){var _0x44d12b;return db['SquareOdbc']['find']({'where':{'id':_0xe65808['params']['id']},'attributes':['id',_0x5a38('0x53')]})[_0x5a38('0x24')](handleEntityNotFound(_0x268cc2,null))['then'](function(_0x4cc984){if(_0x4cc984){var _0x1027a0=require(_0x5a38('0x54'))();_0x1027a0[_0x5a38('0x55')](_0x4cc984[_0x5a38('0x53')]);_0x1027a0[_0x5a38('0x56')]();return _0x4cc984;}})['then'](respondWithResult(_0x268cc2,null))[_0x5a38('0x42')](handleError(_0x268cc2,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 5d9f2ab..bf26594 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 _0xafe6=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc'];(function(_0x3d34fc,_0x19448a){var _0x35a98c=function(_0x34b179){while(--_0x34b179){_0x3d34fc['push'](_0x3d34fc['shift']());}};_0x35a98c(++_0x19448a);}(_0xafe6,0x1e1));var _0x6afe=function(_0x35186c,_0x1eb946){_0x35186c=_0x35186c-0x0;var _0xd11ecb=_0xafe6[_0x35186c];return _0xd11ecb;};'use strict';var _=require(_0x6afe('0x0'));var util=require(_0x6afe('0x1'));var logger=require(_0x6afe('0x2'))('api');var moment=require(_0x6afe('0x3'));var BPromise=require(_0x6afe('0x4'));var rp=require(_0x6afe('0x5'));var fs=require('fs');var path=require(_0x6afe('0x6'));var rimraf=require(_0x6afe('0x7'));var config=require(_0x6afe('0x8'));var attributes=require(_0x6afe('0x9'));module[_0x6afe('0xa')]=function(_0x3ad20b,_0x11c32b){return _0x3ad20b[_0x6afe('0xb')](_0x6afe('0xc'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb440=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc','square_odbc','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb440,0x1e0));var _0x0b44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb440[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0b44('0x0'));var util=require(_0x0b44('0x1'));var logger=require(_0x0b44('0x2'))(_0x0b44('0x3'));var moment=require(_0x0b44('0x4'));var BPromise=require(_0x0b44('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b44('0x6'));var rimraf=require(_0x0b44('0x7'));var config=require(_0x0b44('0x8'));var attributes=require(_0x0b44('0x9'));module[_0x0b44('0xa')]=function(_0x112203,_0x20f513){return _0x112203['define'](_0x0b44('0xb'),attributes,{'tableName':_0x0b44('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 21f67eb..683e110 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 _0xbe96=['request\x20sent','error','message','info','result','catch','SquareOdbc','options','raw','where','include','attributes','model','map','ShowSquareOdbc','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','SquareOdbc,\x20%s,\x20%s','debug'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xbe96,0x100));var _0x6be9=function(_0x4d9de3,_0x2c2856){_0x4d9de3=_0x4d9de3-0x0;var _0x6521db=_0xbe96[_0x4d9de3];return _0x6521db;};'use strict';var _=require(_0x6be9('0x0'));var util=require(_0x6be9('0x1'));var moment=require(_0x6be9('0x2'));var BPromise=require('bluebird');var rs=require(_0x6be9('0x3'));var fs=require('fs');var Redis=require(_0x6be9('0x4'));var db=require(_0x6be9('0x5'))['db'];var utils=require(_0x6be9('0x6'));var logger=require(_0x6be9('0x7'))(_0x6be9('0x8'));var config=require(_0x6be9('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xeadccb,_0x458b0e,_0x342373){return new BPromise(function(_0x417253,_0x191db2){return client[_0x6be9('0xa')](_0xeadccb,_0x342373)[_0x6be9('0xb')](function(_0xbcdece){logger['info'](_0x6be9('0xc'),_0x458b0e,'request\x20sent');logger[_0x6be9('0xd')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x458b0e,_0x6be9('0xe'),JSON['stringify'](_0xbcdece));if(_0xbcdece[_0x6be9('0xf')]){if(_0xbcdece[_0x6be9('0xf')]['code']===0x1f4){logger[_0x6be9('0xf')](_0x6be9('0xc'),_0x458b0e,_0xbcdece[_0x6be9('0xf')][_0x6be9('0x10')]);return _0x191db2(_0xbcdece[_0x6be9('0xf')]['message']);}logger[_0x6be9('0xf')](_0x6be9('0xc'),_0x458b0e,_0xbcdece[_0x6be9('0xf')][_0x6be9('0x10')]);return _0x417253(_0xbcdece[_0x6be9('0xf')][_0x6be9('0x10')]);}else{logger[_0x6be9('0x11')](_0x6be9('0xc'),_0x458b0e,_0x6be9('0xe'));_0x417253(_0xbcdece[_0x6be9('0x12')]['message']);}})[_0x6be9('0x13')](function(_0x194c6b){logger[_0x6be9('0xf')](_0x6be9('0xc'),_0x458b0e,_0x194c6b);_0x191db2(_0x194c6b);});});}exports['ShowSquareOdbc']=function(_0x42383c){var _0x3fc3f6=this;return new Promise(function(_0x3615ad,_0x589c60){return db[_0x6be9('0x14')]['find']({'raw':_0x42383c[_0x6be9('0x15')]?_0x42383c[_0x6be9('0x15')][_0x6be9('0x16')]===undefined?!![]:![]:!![],'where':_0x42383c['options']?_0x42383c[_0x6be9('0x15')][_0x6be9('0x17')]||null:null,'attributes':_0x42383c[_0x6be9('0x15')]?_0x42383c[_0x6be9('0x15')]['attributes']||null:null,'include':_0x42383c[_0x6be9('0x15')]?_0x42383c[_0x6be9('0x15')][_0x6be9('0x18')]?_['map'](_0x42383c['options']['include'],function(_0x3bc9a6){return{'model':db[_0x3bc9a6['model']],'as':_0x3bc9a6['as'],'attributes':_0x3bc9a6[_0x6be9('0x19')],'include':_0x3bc9a6['include']?_['map'](_0x3bc9a6[_0x6be9('0x18')],function(_0x4b3897){return{'model':db[_0x4b3897[_0x6be9('0x1a')]],'as':_0x4b3897['as'],'attributes':_0x4b3897[_0x6be9('0x19')],'include':_0x4b3897[_0x6be9('0x18')]?_[_0x6be9('0x1b')](_0x4b3897['include'],function(_0x3c682d){return{'model':db[_0x3c682d[_0x6be9('0x1a')]],'as':_0x3c682d['as'],'attributes':_0x3c682d[_0x6be9('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6be9('0xb')](function(_0x2ec943){logger[_0x6be9('0x11')](_0x6be9('0x1c'),_0x42383c);logger['debug'](_0x6be9('0x1c'),_0x42383c,JSON[_0x6be9('0x1d')](_0x2ec943));_0x3615ad(_0x2ec943);})[_0x6be9('0x13')](function(_0x470ca1){logger[_0x6be9('0xf')](_0x6be9('0x1c'),_0x470ca1['message'],_0x42383c);_0x589c60(_0x3fc3f6[_0x6be9('0xf')](0x1f4,_0x470ca1['message']));});});}; \ No newline at end of file +var _0xc822=['include','map','model','debug','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowSquareOdbc','SquareOdbc','find','options','where','attributes'];(function(_0x15102e,_0x3539b1){var _0x1fcfc2=function(_0x5296f3){while(--_0x5296f3){_0x15102e['push'](_0x15102e['shift']());}};_0x1fcfc2(++_0x3539b1);}(_0xc822,0xc8));var _0x2c82=function(_0x4cee4b,_0x1dfff3){_0x4cee4b=_0x4cee4b-0x0;var _0x4d891d=_0xc822[_0x4cee4b];return _0x4d891d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2c82('0x0'));var BPromise=require(_0x2c82('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2c82('0x2'));var db=require(_0x2c82('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c82('0x4'));var config=require('../../config/environment');var jayson=require(_0x2c82('0x5'));var client=jayson[_0x2c82('0x6')][_0x2c82('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x10b0ac,_0x1a2a71,_0x3c3c33){return new BPromise(function(_0x4250bf,_0x5a6ecc){return client[_0x2c82('0x8')](_0x10b0ac,_0x3c3c33)[_0x2c82('0x9')](function(_0x221ef9){logger[_0x2c82('0xa')](_0x2c82('0xb'),_0x1a2a71,'request\x20sent');logger['debug'](_0x2c82('0xc'),_0x1a2a71,_0x2c82('0xd'),JSON[_0x2c82('0xe')](_0x221ef9));if(_0x221ef9[_0x2c82('0xf')]){if(_0x221ef9[_0x2c82('0xf')]['code']===0x1f4){logger[_0x2c82('0xf')](_0x2c82('0xb'),_0x1a2a71,_0x221ef9[_0x2c82('0xf')][_0x2c82('0x10')]);return _0x5a6ecc(_0x221ef9['error'][_0x2c82('0x10')]);}logger[_0x2c82('0xf')](_0x2c82('0xb'),_0x1a2a71,_0x221ef9[_0x2c82('0xf')][_0x2c82('0x10')]);return _0x4250bf(_0x221ef9[_0x2c82('0xf')][_0x2c82('0x10')]);}else{logger[_0x2c82('0xa')](_0x2c82('0xb'),_0x1a2a71,_0x2c82('0xd'));_0x4250bf(_0x221ef9[_0x2c82('0x11')]['message']);}})['catch'](function(_0x8ae836){logger[_0x2c82('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x1a2a71,_0x8ae836);_0x5a6ecc(_0x8ae836);});});}exports[_0x2c82('0x12')]=function(_0x44f4ca){var _0x463d34=this;return new Promise(function(_0x45da4e,_0x3ee30d){return db[_0x2c82('0x13')][_0x2c82('0x14')]({'raw':_0x44f4ca[_0x2c82('0x15')]?_0x44f4ca['options']['raw']===undefined?!![]:![]:!![],'where':_0x44f4ca['options']?_0x44f4ca['options'][_0x2c82('0x16')]||null:null,'attributes':_0x44f4ca['options']?_0x44f4ca['options'][_0x2c82('0x17')]||null:null,'include':_0x44f4ca[_0x2c82('0x15')]?_0x44f4ca[_0x2c82('0x15')][_0x2c82('0x18')]?_[_0x2c82('0x19')](_0x44f4ca[_0x2c82('0x15')][_0x2c82('0x18')],function(_0x5d1849){return{'model':db[_0x5d1849[_0x2c82('0x1a')]],'as':_0x5d1849['as'],'attributes':_0x5d1849[_0x2c82('0x17')],'include':_0x5d1849[_0x2c82('0x18')]?_[_0x2c82('0x19')](_0x5d1849[_0x2c82('0x18')],function(_0x22c062){return{'model':db[_0x22c062[_0x2c82('0x1a')]],'as':_0x22c062['as'],'attributes':_0x22c062['attributes'],'include':_0x22c062[_0x2c82('0x18')]?_[_0x2c82('0x19')](_0x22c062[_0x2c82('0x18')],function(_0x5951c8){return{'model':db[_0x5951c8[_0x2c82('0x1a')]],'as':_0x5951c8['as'],'attributes':_0x5951c8[_0x2c82('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5f0709){logger[_0x2c82('0xa')](_0x2c82('0x12'),_0x44f4ca);logger[_0x2c82('0x1b')]('ShowSquareOdbc',_0x44f4ca,JSON[_0x2c82('0xe')](_0x5f0709));_0x45da4e(_0x5f0709);})['catch'](function(_0x43348f){logger[_0x2c82('0xf')](_0x2c82('0x12'),_0x43348f[_0x2c82('0x10')],_0x44f4ca);_0x3ee30d(_0x463d34[_0x2c82('0xf')](0x1f4,_0x43348f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4038f74..89f0f5b 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 _0x85aa=['fs-extra','../../config/environment','./squareProject.controller','get','index','post','isAuthenticated','put','update','delete','util','connect-timeout','Router'];(function(_0x55cc1f,_0x2b9320){var _0xa828ba=function(_0x303c1d){while(--_0x303c1d){_0x55cc1f['push'](_0x55cc1f['shift']());}};_0xa828ba(++_0x2b9320);}(_0x85aa,0x183));var _0xa85a=function(_0x942a1b,_0x5edb0c){_0x942a1b=_0x942a1b-0x0;var _0x5dd4c6=_0x85aa[_0x942a1b];return _0x5dd4c6;};'use strict';var multer=require('multer');var util=require(_0xa85a('0x0'));var path=require('path');var timeout=require(_0xa85a('0x1'));var express=require('express');var router=express[_0xa85a('0x2')]();var fs_extra=require(_0xa85a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa85a('0x4'));var controller=require(_0xa85a('0x5'));router[_0xa85a('0x6')]('/',auth['isAuthenticated'](),controller[_0xa85a('0x7')]);router[_0xa85a('0x6')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xa85a('0x8')]('/',auth[_0xa85a('0x9')](),controller['create']);router[_0xa85a('0xa')]('/:id',auth[_0xa85a('0x9')](),controller[_0xa85a('0xb')]);router[_0xa85a('0xc')]('/:id',auth[_0xa85a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2fe4=['util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x2fe4,0x120));var _0x42fe=function(_0x56c6b1,_0x4db891){_0x56c6b1=_0x56c6b1-0x0;var _0x527771=_0x2fe4[_0x56c6b1];return _0x527771;};'use strict';var multer=require('multer');var util=require(_0x42fe('0x0'));var path=require('path');var timeout=require(_0x42fe('0x1'));var express=require('express');var router=express[_0x42fe('0x2')]();var fs_extra=require(_0x42fe('0x3'));var auth=require(_0x42fe('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x42fe('0x5'));var controller=require(_0x42fe('0x6'));router[_0x42fe('0x7')]('/',auth[_0x42fe('0x8')](),controller[_0x42fe('0x9')]);router['get'](_0x42fe('0xa'),auth[_0x42fe('0x8')](),controller[_0x42fe('0xb')]);router[_0x42fe('0xc')]('/',auth[_0x42fe('0x8')](),controller['create']);router['put'](_0x42fe('0xa'),auth['isAuthenticated'](),controller[_0x42fe('0xd')]);router[_0x42fe('0xe')](_0x42fe('0xa'),auth[_0x42fe('0x8')](),controller[_0x42fe('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index d23ec51..a3a7637 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 _0xfc8f=['preproduction','toString','production','utf8','sequelize','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x5b9bec,_0xe50f7a){var _0xddbbc5=function(_0x162a45){while(--_0x162a45){_0x5b9bec['push'](_0x5b9bec['shift']());}};_0xddbbc5(++_0xe50f7a);}(_0xfc8f,0xa0));var _0xffc8=function(_0x43deea,_0x46e407){_0x43deea=_0x43deea-0x0;var _0x400e5d=_0xfc8f[_0x43deea];return _0x400e5d;};'use strict';var Sequelize=require(_0xffc8('0x0'));module[_0xffc8('0x1')]={'name':{'type':Sequelize[_0xffc8('0x2')],'unique':_0xffc8('0x3'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xffc8('0x4')]},'preproduction':{'type':Sequelize[_0xffc8('0x5')](_0xffc8('0x6')),'get':function(){if(this[_0xffc8('0x7')](_0xffc8('0x8'))){return this[_0xffc8('0x7')]('preproduction')[_0xffc8('0x9')]('utf8');}}},'production':{'type':Sequelize['BLOB'](_0xffc8('0x6')),'get':function(){if(this[_0xffc8('0x7')](_0xffc8('0xa'))){return this[_0xffc8('0x7')]('production')[_0xffc8('0x9')](_0xffc8('0xb'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0x0c1a=['getDataValue','DATE','sequelize','exports','STRING','name','TEXT','long','preproduction','toString','utf8','production'];(function(_0x21108b,_0x368dbc){var _0x525f48=function(_0x3d2881){while(--_0x3d2881){_0x21108b['push'](_0x21108b['shift']());}};_0x525f48(++_0x368dbc);}(_0x0c1a,0x1d6));var _0xa0c1=function(_0x578f1f,_0x5a3c84){_0x578f1f=_0x578f1f-0x0;var _0x31d75e=_0x0c1a[_0x578f1f];return _0x31d75e;};'use strict';var Sequelize=require(_0xa0c1('0x0'));module[_0xa0c1('0x1')]={'name':{'type':Sequelize[_0xa0c1('0x2')],'unique':_0xa0c1('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xa0c1('0x2')]},'notes':{'type':Sequelize[_0xa0c1('0x4')]},'preproduction':{'type':Sequelize['BLOB'](_0xa0c1('0x5')),'get':function(){if(this['getDataValue'](_0xa0c1('0x6'))){return this['getDataValue']('preproduction')[_0xa0c1('0x7')](_0xa0c1('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this['getDataValue'](_0xa0c1('0x9'))){return this[_0xa0c1('0xa')](_0xa0c1('0x9'))['toString'](_0xa0c1('0x8'));}}},'savedAt':{'type':Sequelize[_0xa0c1('0xb')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index eae2608..b81593f 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 _0x99b9=['agi','stringify','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','keys','includeAll','include','SquareProject','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','SquareProjects','UserProfileResource','publish'];(function(_0x4bcc35,_0x9ae5cc){var _0x260585=function(_0x354959){while(--_0x354959){_0x4bcc35['push'](_0x4bcc35['shift']());}};_0x260585(++_0x9ae5cc);}(_0x99b9,0x10b));var _0x999b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x99b9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x999b('0x0'));var Redis=require(_0x999b('0x1'));var qs=require(_0x999b('0x2'));var logger=require(_0x999b('0x3'))(_0x999b('0x4'));var config=require('../../config/environment');var db=require(_0x999b('0x5'))['db'];config[_0x999b('0x6')]=_[_0x999b('0x7')](config[_0x999b('0x6')],{'host':_0x999b('0x8'),'port':0x18eb});var socket=require(_0x999b('0x9'))(new Redis(config['redis']));require('./squareProject.socket')[_0x999b('0xa')](socket);function respondWithResult(_0x32d960,_0x1c3760){_0x1c3760=_0x1c3760||0xc8;return function(_0x437056){if(_0x437056){return _0x32d960[_0x999b('0xb')](_0x1c3760)['json'](_0x437056);}};}function respondWithFilteredResult(_0x199658,_0x28e39f){return function(_0x22966c){if(_0x22966c){var _0xc1e596=typeof _0x28e39f[_0x999b('0xc')]===_0x999b('0xd')&&typeof _0x28e39f[_0x999b('0xe')]===_0x999b('0xd');var _0x389f7e=_0x22966c[_0x999b('0xf')];var _0x253c35=_0xc1e596?0x0:_0x28e39f['offset'];var _0x5e2969=_0xc1e596?_0x22966c['count']:_0x28e39f[_0x999b('0xc')]+_0x28e39f['limit'];var _0x2a4fef;if(_0x5e2969>=_0x389f7e){_0x5e2969=_0x389f7e;_0x2a4fef=0xc8;}else{_0x2a4fef=0xce;}_0x199658[_0x999b('0xb')](_0x2a4fef);return _0x199658[_0x999b('0x10')](_0x999b('0x11'),_0x253c35+'-'+_0x5e2969+'/'+_0x389f7e)['json'](_0x22966c);}return null;};}function saveUpdates(_0x1be812){return function(_0x4d563c){if(_0x4d563c){return _0x4d563c[_0x999b('0x12')](_0x1be812)['then'](function(_0x4857f4){return _0x4857f4;});}return null;};}function removeEntity(_0x733454){return function(_0x3da052){if(_0x3da052){return _0x3da052[_0x999b('0x13')]()[_0x999b('0x14')](function(){var _0x4cfcb6=_0x3da052[_0x999b('0x15')]({'plain':!![]});var _0x35d825=_0x999b('0x16');return db[_0x999b('0x17')]['destroy']({'where':{'type':_0x35d825,'resourceId':_0x4cfcb6['id']}})[_0x999b('0x14')](function(){return _0x3da052;});})['then'](function(){var _0x1ddf72=new Redis(config['redis']);_0x1ddf72[_0x999b('0x18')](_0x999b('0x19'),JSON[_0x999b('0x1a')]({'id':_0x3da052['id'],'deleted':!![]}));})['then'](function(){_0x733454['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x341314){return function(_0x145536){if(!_0x145536){_0x341314[_0x999b('0x1b')](0x194);}return _0x145536;};}function handleError(_0x4c4b96,_0x5c55a6){_0x5c55a6=_0x5c55a6||0x1f4;return function(_0x531b8b){logger[_0x999b('0x1c')](_0x531b8b[_0x999b('0x1d')]);if(_0x531b8b[_0x999b('0x1e')]){delete _0x531b8b[_0x999b('0x1e')];}_0x4c4b96[_0x999b('0xb')](_0x5c55a6)[_0x999b('0x1f')](_0x531b8b);};}exports[_0x999b('0x20')]=function(_0xf6514d,_0x5f0897){var _0x2af927={},_0x194e85={},_0x5090cf={'count':0x0,'rows':[]};var _0x26acb3=_[_0x999b('0x21')](db['SquareProject'][_0x999b('0x22')],function(_0x50b271){return{'name':_0x50b271[_0x999b('0x23')],'type':_0x50b271[_0x999b('0x24')][_0x999b('0x25')]};});_0x194e85[_0x999b('0x26')]=_[_0x999b('0x21')](_0x26acb3,'name');_0x194e85[_0x999b('0x27')]=_['keys'](_0xf6514d[_0x999b('0x27')]);_0x194e85[_0x999b('0x28')]=_[_0x999b('0x29')](_0x194e85['model'],_0x194e85[_0x999b('0x27')]);_0x2af927[_0x999b('0x2a')]=_['intersection'](_0x194e85[_0x999b('0x26')],qs[_0x999b('0x2b')](_0xf6514d[_0x999b('0x27')]['fields']));_0x2af927[_0x999b('0x2a')]=_0x2af927['attributes'][_0x999b('0x2c')]?_0x2af927[_0x999b('0x2a')]:_0x194e85[_0x999b('0x26')];if(!_0xf6514d[_0x999b('0x27')][_0x999b('0x2d')](_0x999b('0x2e'))){_0x2af927[_0x999b('0xe')]=qs[_0x999b('0xe')](_0xf6514d['query'][_0x999b('0xe')]);_0x2af927[_0x999b('0xc')]=qs[_0x999b('0xc')](_0xf6514d['query'][_0x999b('0xc')]);}_0x2af927[_0x999b('0x2f')]=qs['sort'](_0xf6514d['query'][_0x999b('0x30')]);_0x2af927[_0x999b('0x31')]=qs[_0x999b('0x28')](_[_0x999b('0x32')](_0xf6514d[_0x999b('0x27')],_0x194e85['filters']),_0x26acb3);if(_0xf6514d[_0x999b('0x27')][_0x999b('0x33')]){_0x2af927[_0x999b('0x31')]=_[_0x999b('0x34')](_0x2af927[_0x999b('0x31')],{'$or':_[_0x999b('0x21')](_0x26acb3,function(_0x2c8747){if(_0x2c8747[_0x999b('0x24')]!==_0x999b('0x35')){var _0x39a223={};_0x39a223[_0x2c8747['name']]={'$like':'%'+_0xf6514d['query'][_0x999b('0x33')]+'%'};return _0x39a223;}})});}_0x2af927=_[_0x999b('0x34')]({},_0x2af927,_0xf6514d[_0x999b('0x36')]);var _0x49f30d={'where':_0x2af927[_0x999b('0x31')]};return db['SquareProject']['count'](_0x49f30d)[_0x999b('0x14')](function(_0x8d9fca){_0x5090cf[_0x999b('0xf')]=_0x8d9fca;if(_0xf6514d['query']['includeAll']){_0x2af927['include']=[{'all':!![]}];}return db['SquareProject'][_0x999b('0x37')](_0x2af927);})[_0x999b('0x14')](function(_0x14923f){_0x5090cf['rows']=_0x14923f;return _0x5090cf;})['then'](respondWithFilteredResult(_0x5f0897,_0x2af927))[_0x999b('0x38')](handleError(_0x5f0897,null));};exports[_0x999b('0x39')]=function(_0x49a958,_0x2d6b28){var _0x143cde={'raw':![],'where':{'id':_0x49a958[_0x999b('0x3a')]['id']}},_0x3e195f={};_0x3e195f[_0x999b('0x26')]=_[_0x999b('0x3b')](db['SquareProject'][_0x999b('0x22')]);_0x3e195f[_0x999b('0x27')]=_[_0x999b('0x3b')](_0x49a958[_0x999b('0x27')]);_0x3e195f[_0x999b('0x28')]=_[_0x999b('0x29')](_0x3e195f[_0x999b('0x26')],_0x3e195f['query']);_0x143cde['attributes']=_[_0x999b('0x29')](_0x3e195f['model'],qs[_0x999b('0x2b')](_0x49a958[_0x999b('0x27')][_0x999b('0x2b')]));_0x143cde['attributes']=_0x143cde[_0x999b('0x2a')][_0x999b('0x2c')]?_0x143cde['attributes']:_0x3e195f['model'];if(_0x49a958[_0x999b('0x27')][_0x999b('0x3c')]){_0x143cde[_0x999b('0x3d')]=[{'all':!![]}];}_0x143cde=_[_0x999b('0x34')]({},_0x143cde,_0x49a958[_0x999b('0x36')]);return db[_0x999b('0x3e')][_0x999b('0x3f')](_0x143cde)[_0x999b('0x14')](handleEntityNotFound(_0x2d6b28,null))[_0x999b('0x14')](respondWithResult(_0x2d6b28,null))[_0x999b('0x38')](handleError(_0x2d6b28,null));};exports[_0x999b('0x40')]=function(_0x4a9197,_0x5a27e3){return db['SquareProject']['create'](_0x4a9197[_0x999b('0x41')],{})['then'](function(_0x1a8f75){var _0x1e49ab=_0x4a9197[_0x999b('0x42')][_0x999b('0x15')]({'plain':!![]});if(!_0x1e49ab)throw new Error(_0x999b('0x43'));if(_0x1e49ab[_0x999b('0x44')]===_0x999b('0x42')){var _0x58e593=_0x1a8f75[_0x999b('0x15')]({'plain':!![]});var _0x56e2f1='SquareProjects';return db['UserProfileSection']['find']({'where':{'name':_0x56e2f1,'userProfileId':_0x1e49ab[_0x999b('0x45')]},'raw':!![]})['then'](function(_0x456502){if(_0x456502&&_0x456502[_0x999b('0x46')]===0x0){return db['UserProfileResource'][_0x999b('0x40')]({'name':_0x58e593[_0x999b('0x1e')],'resourceId':_0x58e593['id'],'type':_0x456502[_0x999b('0x1e')],'sectionId':_0x456502['id']},{})[_0x999b('0x14')](function(){return _0x1a8f75;});}else{return _0x1a8f75;}})[_0x999b('0x38')](function(_0xa76410){logger['error'](_0x999b('0x47'),_0xa76410);throw _0xa76410;});}return _0x1a8f75;})[_0x999b('0x14')](respondWithResult(_0x5a27e3,0xc9))[_0x999b('0x38')](handleError(_0x5a27e3,null));};exports[_0x999b('0x12')]=function(_0x407e12,_0x4f8111){if(_0x407e12['body']['id']){delete _0x407e12[_0x999b('0x41')]['id'];}return db['SquareProject'][_0x999b('0x3f')]({'where':{'id':_0x407e12[_0x999b('0x3a')]['id']}})['then'](handleEntityNotFound(_0x4f8111,null))[_0x999b('0x14')](saveUpdates(_0x407e12['body'],null))[_0x999b('0x14')](function(_0x5068e8){if(!_0x5068e8)return;var _0x5aa95f=_0x5068e8[_0x999b('0x15')]({'plain':!![]});return _0x5aa95f;})[_0x999b('0x14')](function(_0x5d5ade){var _0x4afb2a=new Redis(config[_0x999b('0x6')]);_0x4afb2a[_0x999b('0x18')]('agi',JSON[_0x999b('0x1a')](_[_0x999b('0x32')](_0x5d5ade,['id','name',_0x999b('0x48')])));return _0x5d5ade;})[_0x999b('0x14')](respondWithResult(_0x4f8111,null))['catch'](handleError(_0x4f8111,null));};exports['destroy']=function(_0x2004f1,_0x5bf570){return db[_0x999b('0x3e')]['find']({'where':{'id':_0x2004f1['params']['id']}})[_0x999b('0x14')](handleEntityNotFound(_0x5bf570,null))[_0x999b('0x14')](removeEntity(_0x5bf570,null))[_0x999b('0x38')](handleError(_0x5bf570,null));}; \ No newline at end of file +var _0xfd42=['rawAttributes','fieldName','type','key','model','name','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','options','SquareProject','include','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','SquareProjects','UserProfileSection','userProfileId','autoAssociation','body','pick','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','status','offset','undefined','limit','count','set','json','update','then','UserProfileResource','destroy','publish','agi','stringify','end','error','stack','send','index','map'];(function(_0x16d039,_0x3721b4){var _0x53295b=function(_0x21f881){while(--_0x21f881){_0x16d039['push'](_0x16d039['shift']());}};_0x53295b(++_0x3721b4);}(_0xfd42,0xfe));var _0x2fd4=function(_0x2158cd,_0xc096f4){_0x2158cd=_0x2158cd-0x0;var _0x206889=_0xfd42[_0x2158cd];return _0x206889;};'use strict';var _=require('lodash');var Redis=require(_0x2fd4('0x0'));var qs=require(_0x2fd4('0x1'));var logger=require(_0x2fd4('0x2'))(_0x2fd4('0x3'));var config=require(_0x2fd4('0x4'));var db=require(_0x2fd4('0x5'))['db'];config[_0x2fd4('0x6')]=_['defaults'](config[_0x2fd4('0x6')],{'host':_0x2fd4('0x7'),'port':0x18eb});var socket=require(_0x2fd4('0x8'))(new Redis(config[_0x2fd4('0x6')]));require('./squareProject.socket')[_0x2fd4('0x9')](socket);function respondWithResult(_0x283fc9,_0x509189){_0x509189=_0x509189||0xc8;return function(_0x5bbc76){if(_0x5bbc76){return _0x283fc9[_0x2fd4('0xa')](_0x509189)['json'](_0x5bbc76);}};}function respondWithFilteredResult(_0x5c13a8,_0x50c34f){return function(_0x3ed407){if(_0x3ed407){var _0x23affd=typeof _0x50c34f[_0x2fd4('0xb')]===_0x2fd4('0xc')&&typeof _0x50c34f[_0x2fd4('0xd')]===_0x2fd4('0xc');var _0x37844b=_0x3ed407[_0x2fd4('0xe')];var _0x18fd56=_0x23affd?0x0:_0x50c34f[_0x2fd4('0xb')];var _0x32007b=_0x23affd?_0x3ed407[_0x2fd4('0xe')]:_0x50c34f[_0x2fd4('0xb')]+_0x50c34f[_0x2fd4('0xd')];var _0x40022f;if(_0x32007b>=_0x37844b){_0x32007b=_0x37844b;_0x40022f=0xc8;}else{_0x40022f=0xce;}_0x5c13a8[_0x2fd4('0xa')](_0x40022f);return _0x5c13a8[_0x2fd4('0xf')]('Content-Range',_0x18fd56+'-'+_0x32007b+'/'+_0x37844b)[_0x2fd4('0x10')](_0x3ed407);}return null;};}function saveUpdates(_0x2a8b92){return function(_0x45149d){if(_0x45149d){return _0x45149d[_0x2fd4('0x11')](_0x2a8b92)[_0x2fd4('0x12')](function(_0xd05502){return _0xd05502;});}return null;};}function removeEntity(_0x55853b){return function(_0x4e4894){if(_0x4e4894){return _0x4e4894['destroy']()[_0x2fd4('0x12')](function(){var _0x1109ed=_0x4e4894['get']({'plain':!![]});var _0x580442='SquareProjects';return db[_0x2fd4('0x13')][_0x2fd4('0x14')]({'where':{'type':_0x580442,'resourceId':_0x1109ed['id']}})[_0x2fd4('0x12')](function(){return _0x4e4894;});})[_0x2fd4('0x12')](function(){var _0x4a5a96=new Redis(config['redis']);_0x4a5a96[_0x2fd4('0x15')](_0x2fd4('0x16'),JSON[_0x2fd4('0x17')]({'id':_0x4e4894['id'],'deleted':!![]}));})[_0x2fd4('0x12')](function(){_0x55853b[_0x2fd4('0xa')](0xcc)[_0x2fd4('0x18')]();});}};}function handleEntityNotFound(_0x195725){return function(_0x71b220){if(!_0x71b220){_0x195725['sendStatus'](0x194);}return _0x71b220;};}function handleError(_0x3ee3fd,_0x15eef1){_0x15eef1=_0x15eef1||0x1f4;return function(_0x1379f1){logger[_0x2fd4('0x19')](_0x1379f1[_0x2fd4('0x1a')]);if(_0x1379f1['name']){delete _0x1379f1['name'];}_0x3ee3fd[_0x2fd4('0xa')](_0x15eef1)[_0x2fd4('0x1b')](_0x1379f1);};}exports[_0x2fd4('0x1c')]=function(_0x20e0fb,_0x16de8d){var _0x75a6a5={},_0x37245b={},_0x47bb3c={'count':0x0,'rows':[]};var _0x239793=_[_0x2fd4('0x1d')](db['SquareProject'][_0x2fd4('0x1e')],function(_0x550f8c){return{'name':_0x550f8c[_0x2fd4('0x1f')],'type':_0x550f8c[_0x2fd4('0x20')][_0x2fd4('0x21')]};});_0x37245b[_0x2fd4('0x22')]=_[_0x2fd4('0x1d')](_0x239793,_0x2fd4('0x23'));_0x37245b[_0x2fd4('0x24')]=_[_0x2fd4('0x25')](_0x20e0fb[_0x2fd4('0x24')]);_0x37245b[_0x2fd4('0x26')]=_[_0x2fd4('0x27')](_0x37245b[_0x2fd4('0x22')],_0x37245b[_0x2fd4('0x24')]);_0x75a6a5[_0x2fd4('0x28')]=_['intersection'](_0x37245b[_0x2fd4('0x22')],qs[_0x2fd4('0x29')](_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x29')]));_0x75a6a5['attributes']=_0x75a6a5['attributes']['length']?_0x75a6a5[_0x2fd4('0x28')]:_0x37245b['model'];if(!_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x2a')](_0x2fd4('0x2b'))){_0x75a6a5[_0x2fd4('0xd')]=qs[_0x2fd4('0xd')](_0x20e0fb[_0x2fd4('0x24')]['limit']);_0x75a6a5[_0x2fd4('0xb')]=qs[_0x2fd4('0xb')](_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0xb')]);}_0x75a6a5[_0x2fd4('0x2c')]=qs[_0x2fd4('0x2d')](_0x20e0fb[_0x2fd4('0x24')]['sort']);_0x75a6a5['where']=qs[_0x2fd4('0x26')](_['pick'](_0x20e0fb[_0x2fd4('0x24')],_0x37245b[_0x2fd4('0x26')]),_0x239793);if(_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x2e')]){_0x75a6a5['where']=_['merge'](_0x75a6a5[_0x2fd4('0x2f')],{'$or':_['map'](_0x239793,function(_0x5c0cdf){if(_0x5c0cdf[_0x2fd4('0x20')]!==_0x2fd4('0x30')){var _0x439677={};_0x439677[_0x5c0cdf['name']]={'$like':'%'+_0x20e0fb[_0x2fd4('0x24')][_0x2fd4('0x2e')]+'%'};return _0x439677;}})});}_0x75a6a5=_[_0x2fd4('0x31')]({},_0x75a6a5,_0x20e0fb[_0x2fd4('0x32')]);var _0x20a9c5={'where':_0x75a6a5['where']};return db[_0x2fd4('0x33')][_0x2fd4('0xe')](_0x20a9c5)['then'](function(_0x15c92e){_0x47bb3c[_0x2fd4('0xe')]=_0x15c92e;if(_0x20e0fb[_0x2fd4('0x24')]['includeAll']){_0x75a6a5[_0x2fd4('0x34')]=[{'all':!![]}];}return db[_0x2fd4('0x33')]['findAll'](_0x75a6a5);})[_0x2fd4('0x12')](function(_0x3ad7c6){_0x47bb3c[_0x2fd4('0x35')]=_0x3ad7c6;return _0x47bb3c;})[_0x2fd4('0x12')](respondWithFilteredResult(_0x16de8d,_0x75a6a5))[_0x2fd4('0x36')](handleError(_0x16de8d,null));};exports[_0x2fd4('0x37')]=function(_0x3896ef,_0x17f8f7){var _0x38e149={'raw':![],'where':{'id':_0x3896ef[_0x2fd4('0x38')]['id']}},_0x3fc94e={};_0x3fc94e[_0x2fd4('0x22')]=_['keys'](db[_0x2fd4('0x33')][_0x2fd4('0x1e')]);_0x3fc94e[_0x2fd4('0x24')]=_[_0x2fd4('0x25')](_0x3896ef[_0x2fd4('0x24')]);_0x3fc94e[_0x2fd4('0x26')]=_[_0x2fd4('0x27')](_0x3fc94e[_0x2fd4('0x22')],_0x3fc94e['query']);_0x38e149[_0x2fd4('0x28')]=_[_0x2fd4('0x27')](_0x3fc94e['model'],qs[_0x2fd4('0x29')](_0x3896ef[_0x2fd4('0x24')][_0x2fd4('0x29')]));_0x38e149[_0x2fd4('0x28')]=_0x38e149['attributes'][_0x2fd4('0x39')]?_0x38e149[_0x2fd4('0x28')]:_0x3fc94e[_0x2fd4('0x22')];if(_0x3896ef[_0x2fd4('0x24')]['includeAll']){_0x38e149[_0x2fd4('0x34')]=[{'all':!![]}];}_0x38e149=_['merge']({},_0x38e149,_0x3896ef['options']);return db['SquareProject'][_0x2fd4('0x3a')](_0x38e149)[_0x2fd4('0x12')](handleEntityNotFound(_0x17f8f7,null))[_0x2fd4('0x12')](respondWithResult(_0x17f8f7,null))[_0x2fd4('0x36')](handleError(_0x17f8f7,null));};exports['create']=function(_0x36f180,_0x2f2099){return db[_0x2fd4('0x33')][_0x2fd4('0x3b')](_0x36f180['body'],{})['then'](function(_0x34478c){var _0x49990a=_0x36f180[_0x2fd4('0x3c')]['get']({'plain':!![]});if(!_0x49990a)throw new Error(_0x2fd4('0x3d'));if(_0x49990a[_0x2fd4('0x3e')]===_0x2fd4('0x3c')){var _0x5061d0=_0x34478c[_0x2fd4('0x3f')]({'plain':!![]});var _0x36b58b=_0x2fd4('0x40');return db[_0x2fd4('0x41')][_0x2fd4('0x3a')]({'where':{'name':_0x36b58b,'userProfileId':_0x49990a[_0x2fd4('0x42')]},'raw':!![]})['then'](function(_0x2c15ff){if(_0x2c15ff&&_0x2c15ff[_0x2fd4('0x43')]===0x0){return db[_0x2fd4('0x13')]['create']({'name':_0x5061d0[_0x2fd4('0x23')],'resourceId':_0x5061d0['id'],'type':_0x2c15ff[_0x2fd4('0x23')],'sectionId':_0x2c15ff['id']},{})[_0x2fd4('0x12')](function(){return _0x34478c;});}else{return _0x34478c;}})[_0x2fd4('0x36')](function(_0x53ef03){logger[_0x2fd4('0x19')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x53ef03);throw _0x53ef03;});}return _0x34478c;})[_0x2fd4('0x12')](respondWithResult(_0x2f2099,0xc9))[_0x2fd4('0x36')](handleError(_0x2f2099,null));};exports[_0x2fd4('0x11')]=function(_0x2db2bf,_0x386f04){if(_0x2db2bf[_0x2fd4('0x44')]['id']){delete _0x2db2bf[_0x2fd4('0x44')]['id'];}return db['SquareProject']['find']({'where':{'id':_0x2db2bf[_0x2fd4('0x38')]['id']}})[_0x2fd4('0x12')](handleEntityNotFound(_0x386f04,null))[_0x2fd4('0x12')](saveUpdates(_0x2db2bf[_0x2fd4('0x44')],null))['then'](function(_0x419613){if(!_0x419613)return;var _0x366f30=_0x419613[_0x2fd4('0x3f')]({'plain':!![]});return _0x366f30;})[_0x2fd4('0x12')](function(_0x179ec8){var _0x236375=new Redis(config['redis']);_0x236375['publish'](_0x2fd4('0x16'),JSON[_0x2fd4('0x17')](_[_0x2fd4('0x45')](_0x179ec8,['id',_0x2fd4('0x23'),_0x2fd4('0x46')])));return _0x179ec8;})['then'](respondWithResult(_0x386f04,null))['catch'](handleError(_0x386f04,null));};exports[_0x2fd4('0x14')]=function(_0x153670,_0x55b912){return db['SquareProject']['find']({'where':{'id':_0x153670[_0x2fd4('0x38')]['id']}})[_0x2fd4('0x12')](handleEntityNotFound(_0x55b912,null))['then'](removeEntity(_0x55b912,null))[_0x2fd4('0x36')](handleError(_0x55b912,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 1435eb0..c4c8fae 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 _0x3ae7=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x51fc7,_0x2489c1){var _0x2d30bc=function(_0x4b3548){while(--_0x4b3548){_0x51fc7['push'](_0x51fc7['shift']());}};_0x2d30bc(++_0x2489c1);}(_0x3ae7,0x10f));var _0x73ae=function(_0x399bed,_0x52118a){_0x399bed=_0x399bed-0x0;var _0xb09571=_0x3ae7[_0x399bed];return _0xb09571;};'use strict';var EventEmitter=require(_0x73ae('0x0'));var SquareProject=require('../../mysqldb')['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x73ae('0x1')](0x0);var events={'afterCreate':_0x73ae('0x2'),'afterUpdate':_0x73ae('0x3'),'afterDestroy':_0x73ae('0x4')};function emitEvent(_0x17f984){return function(_0x14f6ed,_0x3ef367,_0x14c42b){SquareProjectEvents[_0x73ae('0x5')](_0x17f984+':'+_0x14f6ed['id'],_0x14f6ed);SquareProjectEvents[_0x73ae('0x5')](_0x17f984,_0x14f6ed);_0x14c42b(null);};}for(var e in events){if(events[_0x73ae('0x6')](e)){var event=events[e];SquareProject[_0x73ae('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x646a=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x328d5b,_0x39c179){var _0x307fae=function(_0x49e93c){while(--_0x49e93c){_0x328d5b['push'](_0x328d5b['shift']());}};_0x307fae(++_0x39c179);}(_0x646a,0x117));var _0xa646=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x646a[_0x1da527];return _0x40fc7c;};'use strict';var EventEmitter=require(_0xa646('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa646('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa646('0x2')](0x0);var events={'afterCreate':_0xa646('0x3'),'afterUpdate':_0xa646('0x4'),'afterDestroy':_0xa646('0x5')};function emitEvent(_0x233682){return function(_0x3a5c44,_0x111627,_0x2fb3e7){SquareProjectEvents[_0xa646('0x6')](_0x233682+':'+_0x3a5c44['id'],_0x3a5c44);SquareProjectEvents[_0xa646('0x6')](_0x233682,_0x3a5c44);_0x2fb3e7(null);};}for(var e in events){if(events[_0xa646('0x7')](e)){var event=events[e];SquareProject[_0xa646('0x8')](e,emitEvent(event));}}module[_0xa646('0x9')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d97ef82..e64479a 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 _0xb39c=['SquareProject','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','util','../../config/logger','api','request-promise','path','rimraf','./squareProject.attributes','exports','define'];(function(_0x4bb903,_0x6aca73){var _0x409d5f=function(_0x55e0de){while(--_0x55e0de){_0x4bb903['push'](_0x4bb903['shift']());}};_0x409d5f(++_0x6aca73);}(_0xb39c,0x127));var _0xcb39=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb39c[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0xcb39('0x0'));var logger=require(_0xcb39('0x1'))(_0xcb39('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcb39('0x3'));var fs=require('fs');var path=require(_0xcb39('0x4'));var rimraf=require(_0xcb39('0x5'));var config=require('../../config/environment');var attributes=require(_0xcb39('0x6'));module[_0xcb39('0x7')]=function(_0x2477f9,_0x3f244c){return _0x2477f9[_0xcb39('0x8')](_0xcb39('0x9'),attributes,{'tableName':_0xcb39('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2383bf,_0x538a60,_0x3cdd7e){if(_0x2383bf['changed'](_0xcb39('0xb'))){_0x2383bf[_0xcb39('0xc')]=moment()[_0xcb39('0xd')](_0xcb39('0xe'));}if(_0x2383bf[_0xcb39('0xf')]('production')){_0x2383bf['publishedAt']=moment()[_0xcb39('0xd')](_0xcb39('0xe'));}_0x3cdd7e(null,_0x2383bf);}}});}; \ No newline at end of file +var _0x344e=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','savedAt','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x344e,0x64));var _0xe344=function(_0x5344db,_0x112b8a){_0x5344db=_0x5344db-0x0;var _0xe38f4f=_0x344e[_0x5344db];return _0xe38f4f;};'use strict';var _=require(_0xe344('0x0'));var util=require(_0xe344('0x1'));var logger=require(_0xe344('0x2'))(_0xe344('0x3'));var moment=require(_0xe344('0x4'));var BPromise=require(_0xe344('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe344('0x6'));var rimraf=require(_0xe344('0x7'));var config=require(_0xe344('0x8'));var attributes=require(_0xe344('0x9'));module[_0xe344('0xa')]=function(_0x5b6a7b,_0xffc80f){return _0x5b6a7b['define'](_0xe344('0xb'),attributes,{'tableName':_0xe344('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2ff35c,_0xa4af0f,_0x5c6541){if(_0x2ff35c[_0xe344('0xd')]('preproduction')){_0x2ff35c[_0xe344('0xe')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2ff35c[_0xe344('0xd')]('production')){_0x2ff35c[_0xe344('0xf')]=moment()['format'](_0xe344('0x10'));}_0x5c6541(null,_0x2ff35c);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 29c5e4f..2750f60 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 _0xf8fa=['SquareProject','options','raw','where','limit','include','map','model','attributes','info','debug','stringify','catch','error','message','find','ShowSquareProject','lodash','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','register','GetSquareProjects'];(function(_0xb3b452,_0x582e8e){var _0x238983=function(_0x3bc866){while(--_0x3bc866){_0xb3b452['push'](_0xb3b452['shift']());}};_0x238983(++_0x582e8e);}(_0xf8fa,0x170));var _0xaf8f=function(_0x209e98,_0x39cac6){_0x209e98=_0x209e98-0x0;var _0x3825a0=_0xf8fa[_0x209e98];return _0x3825a0;};'use strict';var _=require(_0xaf8f('0x0'));var Redis=require(_0xaf8f('0x1'));var db=require(_0xaf8f('0x2'))['db'];var logger=require(_0xaf8f('0x3'))('rpc');var config=require(_0xaf8f('0x4'));config[_0xaf8f('0x5')]=_[_0xaf8f('0x6')](config[_0xaf8f('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0xaf8f('0x7'))(new Redis(config[_0xaf8f('0x5')]));require('./squareProject.socket')[_0xaf8f('0x8')](socket);exports[_0xaf8f('0x9')]=function(_0x3c87a7){var _0x34ae1d=this;return new Promise(function(_0x3ac4d8,_0x57f776){return db[_0xaf8f('0xa')]['findAll']({'raw':_0x3c87a7['options']?_0x3c87a7[_0xaf8f('0xb')][_0xaf8f('0xc')]===undefined?!![]:![]:!![],'where':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7[_0xaf8f('0xb')][_0xaf8f('0xd')]||null:null,'attributes':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7['options']['attributes']||null:null,'limit':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7['options'][_0xaf8f('0xe')]||null:null,'include':_0x3c87a7[_0xaf8f('0xb')]?_0x3c87a7['options'][_0xaf8f('0xf')]?_[_0xaf8f('0x10')](_0x3c87a7[_0xaf8f('0xb')]['include'],function(_0x30e1bc){return{'model':db[_0x30e1bc[_0xaf8f('0x11')]],'as':_0x30e1bc['as'],'attributes':_0x30e1bc[_0xaf8f('0x12')],'include':_0x30e1bc['include']?_[_0xaf8f('0x10')](_0x30e1bc[_0xaf8f('0xf')],function(_0x226716){return{'model':db[_0x226716[_0xaf8f('0x11')]],'as':_0x226716['as'],'attributes':_0x226716[_0xaf8f('0x12')],'include':_0x226716[_0xaf8f('0xf')]?_[_0xaf8f('0x10')](_0x226716[_0xaf8f('0xf')],function(_0x16c8d5){return{'model':db[_0x16c8d5[_0xaf8f('0x11')]],'as':_0x16c8d5['as'],'attributes':_0x16c8d5[_0xaf8f('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x81693c){logger[_0xaf8f('0x13')](_0xaf8f('0x9'),_0x3c87a7);logger[_0xaf8f('0x14')]('GetSquareProjects',_0x3c87a7,JSON[_0xaf8f('0x15')](_0x81693c));_0x3ac4d8(_0x81693c);})[_0xaf8f('0x16')](function(_0x14caca){logger[_0xaf8f('0x17')]('GetSquareProjects',_0x14caca[_0xaf8f('0x18')],_0x3c87a7);_0x57f776(_0x34ae1d['error'](0x1f4,_0x14caca[_0xaf8f('0x18')]));});});};exports['ShowSquareProject']=function(_0x26932b){var _0x108c77=this;return new Promise(function(_0x6b1837,_0x159790){return db[_0xaf8f('0xa')][_0xaf8f('0x19')]({'raw':_0x26932b['options']?_0x26932b[_0xaf8f('0xb')][_0xaf8f('0xc')]===undefined?!![]:![]:!![],'where':_0x26932b[_0xaf8f('0xb')]?_0x26932b[_0xaf8f('0xb')]['where']||null:null,'attributes':_0x26932b[_0xaf8f('0xb')]?_0x26932b['options']['attributes']||null:null,'include':_0x26932b['options']?_0x26932b[_0xaf8f('0xb')][_0xaf8f('0xf')]?_[_0xaf8f('0x10')](_0x26932b[_0xaf8f('0xb')][_0xaf8f('0xf')],function(_0x17e71c){return{'model':db[_0x17e71c['model']],'as':_0x17e71c['as'],'attributes':_0x17e71c[_0xaf8f('0x12')],'include':_0x17e71c[_0xaf8f('0xf')]?_['map'](_0x17e71c['include'],function(_0xd17178){return{'model':db[_0xd17178['model']],'as':_0xd17178['as'],'attributes':_0xd17178[_0xaf8f('0x12')],'include':_0xd17178[_0xaf8f('0xf')]?_['map'](_0xd17178[_0xaf8f('0xf')],function(_0x353c33){return{'model':db[_0x353c33[_0xaf8f('0x11')]],'as':_0x353c33['as'],'attributes':_0x353c33[_0xaf8f('0x12')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37b501){logger[_0xaf8f('0x13')]('ShowSquareProject',_0x26932b);logger[_0xaf8f('0x14')]('ShowSquareProject',_0x26932b,JSON[_0xaf8f('0x15')](_0x37b501));_0x6b1837(_0x37b501);})[_0xaf8f('0x16')](function(_0x49d268){logger[_0xaf8f('0x17')](_0xaf8f('0x1a'),_0x49d268[_0xaf8f('0x18')],_0x26932b);_0x159790(_0x108c77[_0xaf8f('0x17')](0x1f4,_0x49d268['message']));});});}; \ No newline at end of file +var _0xa343=['./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','error','message','ShowSquareProject','find','stringify','catch','lodash','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa343,0x70));var _0x3a34=function(_0x190d7b,_0x548785){_0x190d7b=_0x190d7b-0x0;var _0x33370b=_0xa343[_0x190d7b];return _0x33370b;};'use strict';var _=require(_0x3a34('0x0'));var Redis=require(_0x3a34('0x1'));var db=require(_0x3a34('0x2'))['db'];var logger=require('../../config/logger')('rpc');var config=require(_0x3a34('0x3'));config['redis']=_[_0x3a34('0x4')](config[_0x3a34('0x5')],{'host':_0x3a34('0x6'),'port':0x18eb});var socket=require(_0x3a34('0x7'))(new Redis(config['redis']));require(_0x3a34('0x8'))[_0x3a34('0x9')](socket);exports[_0x3a34('0xa')]=function(_0x4bcf6e){var _0x8cb380=this;return new Promise(function(_0x167e86,_0x58fea6){return db[_0x3a34('0xb')][_0x3a34('0xc')]({'raw':_0x4bcf6e[_0x3a34('0xd')]?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0xe')]===undefined?!![]:![]:!![],'where':_0x4bcf6e['options']?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0xf')]||null:null,'attributes':_0x4bcf6e[_0x3a34('0xd')]?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x10')]||null:null,'limit':_0x4bcf6e[_0x3a34('0xd')]?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x11')]||null:null,'include':_0x4bcf6e['options']?_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x4bcf6e[_0x3a34('0xd')][_0x3a34('0x12')],function(_0x3ab532){return{'model':db[_0x3ab532[_0x3a34('0x14')]],'as':_0x3ab532['as'],'attributes':_0x3ab532['attributes'],'include':_0x3ab532[_0x3a34('0x12')]?_['map'](_0x3ab532[_0x3a34('0x12')],function(_0x429480){return{'model':db[_0x429480[_0x3a34('0x14')]],'as':_0x429480['as'],'attributes':_0x429480['attributes'],'include':_0x429480['include']?_[_0x3a34('0x13')](_0x429480['include'],function(_0x5ab61e){return{'model':db[_0x5ab61e[_0x3a34('0x14')]],'as':_0x5ab61e['as'],'attributes':_0x5ab61e[_0x3a34('0x10')]};}):[]};}):[]};}):[]:[]})[_0x3a34('0x15')](function(_0x523d72){logger[_0x3a34('0x16')](_0x3a34('0xa'),_0x4bcf6e);logger[_0x3a34('0x17')](_0x3a34('0xa'),_0x4bcf6e,JSON['stringify'](_0x523d72));_0x167e86(_0x523d72);})['catch'](function(_0x4ccb26){logger[_0x3a34('0x18')]('GetSquareProjects',_0x4ccb26[_0x3a34('0x19')],_0x4bcf6e);_0x58fea6(_0x8cb380['error'](0x1f4,_0x4ccb26[_0x3a34('0x19')]));});});};exports[_0x3a34('0x1a')]=function(_0x5948d7){var _0xa784db=this;return new Promise(function(_0x1a9339,_0x42f635){return db[_0x3a34('0xb')][_0x3a34('0x1b')]({'raw':_0x5948d7[_0x3a34('0xd')]?_0x5948d7[_0x3a34('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x5948d7[_0x3a34('0xd')]?_0x5948d7['options'][_0x3a34('0xf')]||null:null,'attributes':_0x5948d7[_0x3a34('0xd')]?_0x5948d7[_0x3a34('0xd')][_0x3a34('0x10')]||null:null,'include':_0x5948d7['options']?_0x5948d7[_0x3a34('0xd')][_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x5948d7[_0x3a34('0xd')][_0x3a34('0x12')],function(_0x10f63c){return{'model':db[_0x10f63c[_0x3a34('0x14')]],'as':_0x10f63c['as'],'attributes':_0x10f63c[_0x3a34('0x10')],'include':_0x10f63c[_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x10f63c[_0x3a34('0x12')],function(_0x30df5d){return{'model':db[_0x30df5d[_0x3a34('0x14')]],'as':_0x30df5d['as'],'attributes':_0x30df5d[_0x3a34('0x10')],'include':_0x30df5d[_0x3a34('0x12')]?_[_0x3a34('0x13')](_0x30df5d[_0x3a34('0x12')],function(_0x3a60f2){return{'model':db[_0x3a60f2[_0x3a34('0x14')]],'as':_0x3a60f2['as'],'attributes':_0x3a60f2['attributes']};}):[]};}):[]};}):[]:[]})[_0x3a34('0x15')](function(_0x221c52){logger['info'](_0x3a34('0x1a'),_0x5948d7);logger['debug'](_0x3a34('0x1a'),_0x5948d7,JSON[_0x3a34('0x1c')](_0x221c52));_0x1a9339(_0x221c52);})[_0x3a34('0x1d')](function(_0x3f73c9){logger['error'](_0x3a34('0x1a'),_0x3f73c9[_0x3a34('0x19')],_0x5948d7);_0x42f635(_0xa784db['error'](0x1f4,_0x3f73c9[_0x3a34('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 82c99ec..5095104 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 _0xea3f=['remove','emit','removeListener','register','./squareProject.events'];(function(_0x47ae01,_0x2dd0b0){var _0x15b3b7=function(_0x540ebc){while(--_0x540ebc){_0x47ae01['push'](_0x47ae01['shift']());}};_0x15b3b7(++_0x2dd0b0);}(_0xea3f,0x9f));var _0xfea3=function(_0x14102c,_0x1cb214){_0x14102c=_0x14102c-0x0;var _0x13297b=_0xea3f[_0x14102c];return _0x13297b;};'use strict';var SquareProjectEvents=require(_0xfea3('0x0'));var events=['save',_0xfea3('0x1'),'update'];function createListener(_0x49485e,_0x12ceb1){return function(_0x3d757c){_0x12ceb1[_0xfea3('0x2')](_0x49485e,_0x3d757c);};}function removeListener(_0x7927c9,_0xea7b70){return function(){SquareProjectEvents[_0xfea3('0x3')](_0x7927c9,_0xea7b70);};}exports[_0xfea3('0x4')]=function(_0x31e2e9){for(var _0x1ed663=0x0,_0xf977a0=events['length'];_0x1ed663<_0xf977a0;_0x1ed663++){var _0xf2c9b3=events[_0x1ed663];var _0x418c28=createListener('squareProject:'+_0xf2c9b3,_0x31e2e9);SquareProjectEvents['on'](_0xf2c9b3,_0x418c28);}}; \ No newline at end of file +var _0x5f37=['update','emit','removeListener','register','length','squareProject:','./squareProject.events'];(function(_0x39aab2,_0x514502){var _0x3c4a01=function(_0x3da93e){while(--_0x3da93e){_0x39aab2['push'](_0x39aab2['shift']());}};_0x3c4a01(++_0x514502);}(_0x5f37,0x11e));var _0x75f3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x5f37[_0x2641f9];return _0x585741;};'use strict';var SquareProjectEvents=require(_0x75f3('0x0'));var events=['save','remove',_0x75f3('0x1')];function createListener(_0xe446c7,_0x5da882){return function(_0x2880fd){_0x5da882[_0x75f3('0x2')](_0xe446c7,_0x2880fd);};}function removeListener(_0x1199b6,_0x1e8527){return function(){SquareProjectEvents[_0x75f3('0x3')](_0x1199b6,_0x1e8527);};}exports[_0x75f3('0x4')]=function(_0x221abb){for(var _0x3b7626=0x0,_0x3c69ac=events[_0x75f3('0x5')];_0x3b7626<_0x3c69ac;_0x3b7626++){var _0x346134=events[_0x3b7626];var _0x4889a5=createListener(_0x75f3('0x6')+_0x346134,_0x221abb);SquareProjectEvents['on'](_0x346134,_0x4889a5);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f6c2569..1a45a05 100644 --- a/server/api/squareRecording/index.js +++ b/server/api/squareRecording/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','download','post','create','put','delete','exports'];(function(_0x443cdc,_0x1d1da7){var _0x13bd4b=function(_0x1f9a1b){while(--_0x1f9a1b){_0x443cdc['push'](_0x443cdc['shift']());}};_0x13bd4b(++_0x1d1da7);}(_0x326f,0xd1));var _0xf326=function(_0x5907be,_0x2b9df1){_0x5907be=_0x5907be-0x0;var _0x3c4f26=_0x326f[_0x5907be];return _0x3c4f26;};'use strict';var multer=require(_0xf326('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf326('0x1'));var express=require(_0xf326('0x2'));var router=express[_0xf326('0x3')]();var fs_extra=require(_0xf326('0x4'));var auth=require(_0xf326('0x5'));var interaction=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var controller=require(_0xf326('0x8'));router[_0xf326('0x9')]('/',auth[_0xf326('0xa')](),controller['index']);router[_0xf326('0x9')](_0xf326('0xb'),auth[_0xf326('0xa')](),controller[_0xf326('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0xf326('0xd')]);router[_0xf326('0xe')]('/',auth[_0xf326('0xa')](),controller[_0xf326('0xf')]);router[_0xf326('0x10')]('/:id',auth[_0xf326('0xa')](),controller['update']);router[_0xf326('0x11')]('/:id',auth[_0xf326('0xa')](),controller['destroy']);module[_0xf326('0x12')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x3a26e3,_0x440198){var _0xc5c3c3=function(_0x23d25f){while(--_0x23d25f){_0x3a26e3['push'](_0x3a26e3['shift']());}};_0xc5c3c3(++_0x440198);}(_0x4975,0x86));var _0x5497=function(_0x281b07,_0x35d046){_0x281b07=_0x281b07-0x0;var _0x5ed14c=_0x4975[_0x281b07];return _0x5ed14c;};'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('0xc'),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/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 9fc559e..b42420d 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 _0x5d17=['getDataValue','savePath','substring','sequelize','exports','STRING','VIRTUAL'];(function(_0x2824e8,_0x40b6d5){var _0x20ea22=function(_0x25bc34){while(--_0x25bc34){_0x2824e8['push'](_0x2824e8['shift']());}};_0x20ea22(++_0x40b6d5);}(_0x5d17,0x114));var _0x75d1=function(_0x38045f,_0x551f77){_0x38045f=_0x38045f-0x0;var _0xfd4f8c=_0x5d17[_0x38045f];return _0xfd4f8c;};'use strict';var Sequelize=require(_0x75d1('0x0'));module[_0x75d1('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x75d1('0x2')]},'context':{'type':Sequelize[_0x75d1('0x2')]},'extension':{'type':Sequelize[_0x75d1('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x75d1('0x2')]},'dnid':{'type':Sequelize[_0x75d1('0x2')]},'projectName':{'type':Sequelize[_0x75d1('0x2')]},'saveName':{'type':Sequelize[_0x75d1('0x2')]},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x75d1('0x2')]},'format':{'type':Sequelize[_0x75d1('0x3')],'get':function(){var _0x5c957a='';var _0x1ee61b=this[_0x75d1('0x4')](_0x75d1('0x5'));if(_0x1ee61b){_0x5c957a=_0x1ee61b[_0x75d1('0x6')](_0x1ee61b['lastIndexOf']('.'));}return _0x5c957a;}}}; \ No newline at end of file +var _0x6aa7=['VIRTUAL','savePath','substring','lastIndexOf','sequelize','STRING'];(function(_0x11539d,_0x2b3499){var _0x43e15e=function(_0x369799){while(--_0x369799){_0x11539d['push'](_0x11539d['shift']());}};_0x43e15e(++_0x2b3499);}(_0x6aa7,0x178));var _0x76aa=function(_0x2ec7d6,_0x366964){_0x2ec7d6=_0x2ec7d6-0x0;var _0x2469e8=_0x6aa7[_0x2ec7d6];return _0x2469e8;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'callerid':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'dnid':{'type':Sequelize[_0x76aa('0x1')]},'projectName':{'type':Sequelize['STRING']},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize[_0x76aa('0x1')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x76aa('0x2')],'get':function(){var _0x36d12b='';var _0xa9b695=this['getDataValue'](_0x76aa('0x3'));if(_0xa9b695){_0x36d12b=_0xa9b695[_0x76aa('0x4')](_0xa9b695[_0x76aa('0x5')]('.'));}return _0x36d12b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index f3460a0..2866ea7 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 _0x8eaf=['length','find','body','params','../../components/encryptor','uniqueid','savePath','filename','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','rows','catch'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x8eaf,0x1e5));var _0xf8ea=function(_0x5199af,_0x1eb67c){_0x5199af=_0x5199af-0x0;var _0x381974=_0x8eaf[_0x5199af];return _0x381974;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf8ea('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf8ea('0x1'));var rp=require(_0xf8ea('0x2'));var moment=require(_0xf8ea('0x3'));var BPromise=require(_0xf8ea('0x4'));var Mustache=require(_0xf8ea('0x5'));var util=require(_0xf8ea('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xf8ea('0x7'));var ejs=require(_0xf8ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf8ea('0x9'));var _=require(_0xf8ea('0xa'));var squel=require(_0xf8ea('0xb'));var crypto=require(_0xf8ea('0xc'));var jsforce=require(_0xf8ea('0xd'));var deskjs=require(_0xf8ea('0xe'));var toCsv=require(_0xf8ea('0x7'));var querystring=require('querystring');var Papa=require(_0xf8ea('0xf'));var Redis=require('ioredis');var authService=require(_0xf8ea('0x10'));var qs=require(_0xf8ea('0x11'));var as=require(_0xf8ea('0x12'));var hardwareService=require(_0xf8ea('0x13'));var logger=require(_0xf8ea('0x14'))(_0xf8ea('0x15'));var utils=require(_0xf8ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf8ea('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d4c8e,_0x1e20d1){_0x1e20d1=_0x1e20d1||0xcc;return function(_0x18777c){if(_0x18777c){return _0x4d4c8e['sendStatus'](_0x1e20d1);}return _0x4d4c8e[_0xf8ea('0x18')](_0x1e20d1)[_0xf8ea('0x19')]();};}function respondWithResult(_0x4d1303,_0x11a005){_0x11a005=_0x11a005||0xc8;return function(_0x12246d){if(_0x12246d){return _0x4d1303[_0xf8ea('0x18')](_0x11a005)[_0xf8ea('0x1a')](_0x12246d);}};}function respondWithFilteredResult(_0x4d42a8,_0x310099){return function(_0x186d74){if(_0x186d74){var _0x13a3c4=typeof _0x310099[_0xf8ea('0x1b')]==='undefined'&&typeof _0x310099[_0xf8ea('0x1c')]==='undefined';var _0x16c60f=_0x186d74[_0xf8ea('0x1d')];var _0x3db3f8=_0x13a3c4?0x0:_0x310099['offset'];var _0x2cc549=_0x13a3c4?_0x186d74[_0xf8ea('0x1d')]:_0x310099[_0xf8ea('0x1b')]+_0x310099[_0xf8ea('0x1c')];var _0x13224a;if(_0x2cc549>=_0x16c60f){_0x2cc549=_0x16c60f;_0x13224a=0xc8;}else{_0x13224a=0xce;}_0x4d42a8[_0xf8ea('0x18')](_0x13224a);return _0x4d42a8[_0xf8ea('0x1e')](_0xf8ea('0x1f'),_0x3db3f8+'-'+_0x2cc549+'/'+_0x16c60f)['json'](_0x186d74);}return null;};}function patchUpdates(_0x221363){return function(_0x1f5137){try{jsonpatch[_0xf8ea('0x20')](_0x1f5137,_0x221363,!![]);}catch(_0xccfd33){return BPromise[_0xf8ea('0x21')](_0xccfd33);}return _0x1f5137[_0xf8ea('0x22')]();};}function saveUpdates(_0x28bb62,_0x2704eb){return function(_0x4f74a1){if(_0x4f74a1){return _0x4f74a1[_0xf8ea('0x23')](_0x28bb62)[_0xf8ea('0x24')](function(_0x2af3ce){return _0x2af3ce;});}return null;};}function removeEntity(_0x3d4fa5,_0x3a49eb){return function(_0x403c07){if(_0x403c07){return _0x403c07[_0xf8ea('0x25')]()[_0xf8ea('0x24')](function(){_0x3d4fa5[_0xf8ea('0x18')](0xcc)[_0xf8ea('0x19')]();});}};}function handleEntityNotFound(_0x2e60c0,_0x358993){return function(_0x4cd726){if(!_0x4cd726){_0x2e60c0['sendStatus'](0x194);}return _0x4cd726;};}function handleError(_0x19e7fe,_0x1ca1cd){_0x1ca1cd=_0x1ca1cd||0x1f4;return function(_0x2fa656){logger[_0xf8ea('0x26')](_0x2fa656['stack']);if(_0x2fa656['name']){delete _0x2fa656[_0xf8ea('0x27')];}_0x19e7fe[_0xf8ea('0x18')](_0x1ca1cd)[_0xf8ea('0x28')](_0x2fa656);};}exports['index']=function(_0x47767b,_0x26c6a3){var _0x4102fa={},_0x446619={},_0x19dfab={'count':0x0,'rows':[]};var _0x4faa21=_['map'](db[_0xf8ea('0x29')][_0xf8ea('0x2a')],function(_0x337681){return{'name':_0x337681[_0xf8ea('0x2b')],'type':_0x337681[_0xf8ea('0x2c')][_0xf8ea('0x2d')]};});_0x446619['model']=_['map'](_0x4faa21,'name');_0x446619[_0xf8ea('0x2e')]=_[_0xf8ea('0x2f')](_0x47767b['query']);_0x446619[_0xf8ea('0x30')]=_[_0xf8ea('0x31')](_0x446619['model'],_0x446619[_0xf8ea('0x2e')]);_0x4102fa[_0xf8ea('0x32')]=_[_0xf8ea('0x31')](_0x446619[_0xf8ea('0x33')],qs[_0xf8ea('0x34')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x34')]));_0x4102fa[_0xf8ea('0x32')]=_0x4102fa[_0xf8ea('0x32')]['length']?_0x4102fa[_0xf8ea('0x32')]:_0x446619[_0xf8ea('0x33')];if(!_0x47767b[_0xf8ea('0x2e')]['hasOwnProperty'](_0xf8ea('0x35'))){_0x4102fa[_0xf8ea('0x1c')]=qs[_0xf8ea('0x1c')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x1c')]);_0x4102fa[_0xf8ea('0x1b')]=qs[_0xf8ea('0x1b')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x1b')]);}_0x4102fa[_0xf8ea('0x36')]=qs[_0xf8ea('0x37')](_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x37')]);_0x4102fa[_0xf8ea('0x38')]=qs['filters'](_[_0xf8ea('0x39')](_0x47767b[_0xf8ea('0x2e')],_0x446619['filters']),_0x4faa21);if(_0x47767b['query'][_0xf8ea('0x3a')]){_0x4102fa[_0xf8ea('0x38')]=_['merge'](_0x4102fa['where'],{'$or':_[_0xf8ea('0x3b')](_0x4faa21,function(_0x5192b0){if(_0x5192b0['type']!==_0xf8ea('0x3c')){var _0x2842f5={};_0x2842f5[_0x5192b0[_0xf8ea('0x27')]]={'$like':'%'+_0x47767b['query'][_0xf8ea('0x3a')]+'%'};return _0x2842f5;}})});}_0x4102fa=_[_0xf8ea('0x3d')]({},_0x4102fa,_0x47767b[_0xf8ea('0x3e')]);var _0x30faee={'where':_0x4102fa['where']};return db[_0xf8ea('0x29')][_0xf8ea('0x1d')](_0x30faee)[_0xf8ea('0x24')](function(_0x481fb6){_0x19dfab[_0xf8ea('0x1d')]=_0x481fb6;if(_0x47767b[_0xf8ea('0x2e')][_0xf8ea('0x3f')]){_0x4102fa[_0xf8ea('0x40')]=[{'all':!![]}];}return db[_0xf8ea('0x29')]['findAll'](_0x4102fa);})[_0xf8ea('0x24')](function(_0x26970a){_0x19dfab[_0xf8ea('0x41')]=_0x26970a;return _0x19dfab;})[_0xf8ea('0x24')](respondWithFilteredResult(_0x26c6a3,_0x4102fa))[_0xf8ea('0x42')](handleError(_0x26c6a3,null));};exports['show']=function(_0x5ba6f2,_0x4cc289){var _0x549b94={'raw':!![],'where':{'id':_0x5ba6f2['params']['id']}},_0x55eb0c={};_0x55eb0c[_0xf8ea('0x33')]=_['keys'](db[_0xf8ea('0x29')][_0xf8ea('0x2a')]);_0x55eb0c[_0xf8ea('0x2e')]=_[_0xf8ea('0x2f')](_0x5ba6f2['query']);_0x55eb0c[_0xf8ea('0x30')]=_[_0xf8ea('0x31')](_0x55eb0c[_0xf8ea('0x33')],_0x55eb0c['query']);_0x549b94[_0xf8ea('0x32')]=_[_0xf8ea('0x31')](_0x55eb0c[_0xf8ea('0x33')],qs['fields'](_0x5ba6f2[_0xf8ea('0x2e')][_0xf8ea('0x34')]));_0x549b94['attributes']=_0x549b94[_0xf8ea('0x32')][_0xf8ea('0x43')]?_0x549b94[_0xf8ea('0x32')]:_0x55eb0c['model'];if(_0x5ba6f2['query'][_0xf8ea('0x3f')]){_0x549b94[_0xf8ea('0x40')]=[{'all':!![]}];}_0x549b94=_['merge']({},_0x549b94,_0x5ba6f2[_0xf8ea('0x3e')]);return db[_0xf8ea('0x29')][_0xf8ea('0x44')](_0x549b94)['then'](handleEntityNotFound(_0x4cc289,null))[_0xf8ea('0x24')](respondWithResult(_0x4cc289,null))['catch'](handleError(_0x4cc289,null));};exports['create']=function(_0x5c42b2,_0x2b8776){return db[_0xf8ea('0x29')]['create'](_0x5c42b2[_0xf8ea('0x45')],{})[_0xf8ea('0x24')](respondWithResult(_0x2b8776,0xc9))[_0xf8ea('0x42')](handleError(_0x2b8776,null));};exports[_0xf8ea('0x23')]=function(_0x4e3f27,_0x6481cc){if(_0x4e3f27[_0xf8ea('0x45')]['id']){delete _0x4e3f27[_0xf8ea('0x45')]['id'];}return db['SquareRecording'][_0xf8ea('0x44')]({'where':{'id':_0x4e3f27[_0xf8ea('0x46')]['id']}})['then'](handleEntityNotFound(_0x6481cc,null))[_0xf8ea('0x24')](saveUpdates(_0x4e3f27['body'],null))[_0xf8ea('0x24')](respondWithResult(_0x6481cc,null))[_0xf8ea('0x42')](handleError(_0x6481cc,null));};exports['download']=function(_0x101344,_0x102e7c,_0x4d4023){var _0x3b2ebe=require(_0xf8ea('0x47'));var _0x5845f8=![];var _0x5e1ba5={};if(_0x101344[_0xf8ea('0x2e')][_0xf8ea('0x2c')]&&_0x101344[_0xf8ea('0x2e')][_0xf8ea('0x2c')]===_0xf8ea('0x48')){_0x5e1ba5[_0xf8ea('0x48')]=_0x101344[_0xf8ea('0x46')]['id'];}else{_0x5e1ba5['id']=_0x101344[_0xf8ea('0x46')]['id'];}return db[_0xf8ea('0x29')][_0xf8ea('0x44')]({'where':_0x5e1ba5,'attributes':['id',_0xf8ea('0x49'),_0xf8ea('0x4a')],'raw':!![]})[_0xf8ea('0x24')](handleEntityNotFound(_0x102e7c,null))[_0xf8ea('0x24')](function(_0x27f670){if(_0x27f670){var _0x3aff0d=_0x27f670[_0xf8ea('0x49')];var _0x552466=util['format']('%s.cypher',_0x3aff0d);if(fs[_0xf8ea('0x4b')](_0x552466)){_0x5845f8=!![];return _0x3b2ebe[_0xf8ea('0x4c')](_0x552466,_0x3aff0d,config[_0xf8ea('0x4d')][_0xf8ea('0x4e')])[_0xf8ea('0x24')](function(){return _0x27f670;});}return _0x27f670;}})[_0xf8ea('0x24')](function(_0x1e6ed4){if(_0x1e6ed4){var _0x4efe84=_0x1e6ed4['savePath'];if(!fs[_0xf8ea('0x4b')](_0x4efe84)){throw new db[(_0xf8ea('0x4f'))][(_0xf8ea('0x50'))](_0xf8ea('0x51'));}if(_0x1e6ed4[_0xf8ea('0x4a')]){return _0x102e7c[_0xf8ea('0x52')](_0x4efe84,_0x1e6ed4[_0xf8ea('0x4a')]+path[_0xf8ea('0x53')](_0x4efe84),function(){if(_0x5845f8){fs[_0xf8ea('0x54')](_0x4efe84);}});}else{return _0x102e7c[_0xf8ea('0x52')](_0x4efe84,function(_0x313fe8){if(_0x5845f8){fs[_0xf8ea('0x54')](_0x4efe84);}});}}})['catch'](function(_0x465d90){if(_0x465d90['message']===_0xf8ea('0x51')){_0x102e7c['status'](0x194)['send']('Not\x20found');}else{return handleError(_0x102e7c,null);}});};exports[_0xf8ea('0x25')]=function(_0x3e83ce,_0x353027){return db[_0xf8ea('0x29')][_0xf8ea('0x44')]({'where':{'id':_0x3e83ce['params']['id']}})[_0xf8ea('0x24')](function(_0x298bcf){if(_[_0xf8ea('0x55')](_0x298bcf)){throw new ReferenceError(_0xf8ea('0x56'));}return _0x298bcf;})[_0xf8ea('0x24')](function(_0x4c0dce){var _0x34b0eb=_0x4c0dce[_0xf8ea('0x49')];logger[_0xf8ea('0x57')](_0xf8ea('0x58'),_0x34b0eb);if(!_['isNil'](_0x4c0dce[_0xf8ea('0x49')])&&fs[_0xf8ea('0x4b')](_0x34b0eb)){logger[_0xf8ea('0x57')](_0xf8ea('0x59')+_0x34b0eb+_0xf8ea('0x5a'));fs[_0xf8ea('0x5b')](_0x34b0eb);}_0x34b0eb=_0x34b0eb+'.cypher';if(!_[_0xf8ea('0x55')](_0x4c0dce['savePath'])&&fs[_0xf8ea('0x4b')](_0x34b0eb)){logger['info'](_0xf8ea('0x59')+_0x34b0eb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xf8ea('0x5b')](_0x34b0eb);}return _0x4c0dce;})[_0xf8ea('0x24')](function(_0x4a5db9){if(!_0x4a5db9)throw new InternalError();return _0x4a5db9[_0xf8ea('0x25')]();})[_0xf8ea('0x24')](function(){_0x353027[_0xf8ea('0x18')](0xcc)[_0xf8ea('0x19')]();})[_0xf8ea('0x42')](handleError(_0x353027,null));}; \ No newline at end of file +var _0x9919=['rows','catch','params','rawAttributes','include','options','create','body','find','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets','recording','ValidationError','extname','unlink','message','Not\x20found','Entity\x20not\x20found','info','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','status','offset','undefined','limit','set','json','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','merge','filter','SquareRecording','count','includeAll','findAll'];(function(_0x4d6463,_0x50d8c6){var _0x2d3deb=function(_0x55eae5){while(--_0x55eae5){_0x4d6463['push'](_0x4d6463['shift']());}};_0x2d3deb(++_0x50d8c6);}(_0x9919,0x193));var _0x9991=function(_0x4fd75e,_0x219e4a){_0x4fd75e=_0x4fd75e-0x0;var _0x5b6338=_0x9919[_0x4fd75e];return _0x5b6338;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9991('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9991('0x1'));var moment=require(_0x9991('0x2'));var BPromise=require(_0x9991('0x3'));var Mustache=require('mustache');var util=require(_0x9991('0x4'));var path=require(_0x9991('0x5'));var sox=require(_0x9991('0x6'));var csv=require(_0x9991('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9991('0x8'));var squel=require(_0x9991('0x9'));var crypto=require(_0x9991('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9991('0xb'));var toCsv=require('to-csv');var querystring=require(_0x9991('0xc'));var Papa=require(_0x9991('0xd'));var Redis=require(_0x9991('0xe'));var authService=require(_0x9991('0xf'));var qs=require(_0x9991('0x10'));var as=require(_0x9991('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9991('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9991('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c9165,_0x16116e){_0x16116e=_0x16116e||0xcc;return function(_0x4e211a){if(_0x4e211a){return _0x4c9165['sendStatus'](_0x16116e);}return _0x4c9165[_0x9991('0x14')](_0x16116e)['end']();};}function respondWithResult(_0xc6f062,_0x3b1d0d){_0x3b1d0d=_0x3b1d0d||0xc8;return function(_0x24bf16){if(_0x24bf16){return _0xc6f062[_0x9991('0x14')](_0x3b1d0d)['json'](_0x24bf16);}};}function respondWithFilteredResult(_0x3f2207,_0x625ba){return function(_0x3f9ff6){if(_0x3f9ff6){var _0x1464b2=typeof _0x625ba[_0x9991('0x15')]===_0x9991('0x16')&&typeof _0x625ba[_0x9991('0x17')]===_0x9991('0x16');var _0x461ec6=_0x3f9ff6['count'];var _0x261cc5=_0x1464b2?0x0:_0x625ba['offset'];var _0x346d2d=_0x1464b2?_0x3f9ff6['count']:_0x625ba[_0x9991('0x15')]+_0x625ba['limit'];var _0x2c0b39;if(_0x346d2d>=_0x461ec6){_0x346d2d=_0x461ec6;_0x2c0b39=0xc8;}else{_0x2c0b39=0xce;}_0x3f2207['status'](_0x2c0b39);return _0x3f2207[_0x9991('0x18')]('Content-Range',_0x261cc5+'-'+_0x346d2d+'/'+_0x461ec6)[_0x9991('0x19')](_0x3f9ff6);}return null;};}function patchUpdates(_0x439ed3){return function(_0x992d1c){try{jsonpatch[_0x9991('0x1a')](_0x992d1c,_0x439ed3,!![]);}catch(_0x4cd8ce){return BPromise[_0x9991('0x1b')](_0x4cd8ce);}return _0x992d1c[_0x9991('0x1c')]();};}function saveUpdates(_0x5eb59c,_0x512098){return function(_0x15bc1b){if(_0x15bc1b){return _0x15bc1b[_0x9991('0x1d')](_0x5eb59c)[_0x9991('0x1e')](function(_0x534c11){return _0x534c11;});}return null;};}function removeEntity(_0x35052e,_0x19fe17){return function(_0x17ce11){if(_0x17ce11){return _0x17ce11[_0x9991('0x1f')]()[_0x9991('0x1e')](function(){_0x35052e[_0x9991('0x14')](0xcc)[_0x9991('0x20')]();});}};}function handleEntityNotFound(_0x375661,_0x2e23f1){return function(_0x417c2f){if(!_0x417c2f){_0x375661[_0x9991('0x21')](0x194);}return _0x417c2f;};}function handleError(_0x45258b,_0x1e40ab){_0x1e40ab=_0x1e40ab||0x1f4;return function(_0x39b481){logger[_0x9991('0x22')](_0x39b481[_0x9991('0x23')]);if(_0x39b481[_0x9991('0x24')]){delete _0x39b481['name'];}_0x45258b[_0x9991('0x14')](_0x1e40ab)[_0x9991('0x25')](_0x39b481);};}exports[_0x9991('0x26')]=function(_0x435ce9,_0x2c52ae){var _0x833b5b={},_0x53870a={},_0x6f8936={'count':0x0,'rows':[]};var _0x17c6ba=_[_0x9991('0x27')](db['SquareRecording']['rawAttributes'],function(_0x261a6c){return{'name':_0x261a6c[_0x9991('0x28')],'type':_0x261a6c[_0x9991('0x29')][_0x9991('0x2a')]};});_0x53870a[_0x9991('0x2b')]=_[_0x9991('0x27')](_0x17c6ba,'name');_0x53870a[_0x9991('0x2c')]=_[_0x9991('0x2d')](_0x435ce9['query']);_0x53870a['filters']=_[_0x9991('0x2e')](_0x53870a[_0x9991('0x2b')],_0x53870a[_0x9991('0x2c')]);_0x833b5b[_0x9991('0x2f')]=_[_0x9991('0x2e')](_0x53870a[_0x9991('0x2b')],qs[_0x9991('0x30')](_0x435ce9[_0x9991('0x2c')]['fields']));_0x833b5b[_0x9991('0x2f')]=_0x833b5b['attributes'][_0x9991('0x31')]?_0x833b5b[_0x9991('0x2f')]:_0x53870a[_0x9991('0x2b')];if(!_0x435ce9[_0x9991('0x2c')]['hasOwnProperty'](_0x9991('0x32'))){_0x833b5b[_0x9991('0x17')]=qs[_0x9991('0x17')](_0x435ce9[_0x9991('0x2c')][_0x9991('0x17')]);_0x833b5b[_0x9991('0x15')]=qs[_0x9991('0x15')](_0x435ce9[_0x9991('0x2c')][_0x9991('0x15')]);}_0x833b5b[_0x9991('0x33')]=qs['sort'](_0x435ce9[_0x9991('0x2c')][_0x9991('0x34')]);_0x833b5b[_0x9991('0x35')]=qs[_0x9991('0x36')](_[_0x9991('0x37')](_0x435ce9[_0x9991('0x2c')],_0x53870a[_0x9991('0x36')]),_0x17c6ba);if(_0x435ce9[_0x9991('0x2c')]['filter']){_0x833b5b[_0x9991('0x35')]=_[_0x9991('0x38')](_0x833b5b[_0x9991('0x35')],{'$or':_[_0x9991('0x27')](_0x17c6ba,function(_0x24f0ae){if(_0x24f0ae[_0x9991('0x29')]!=='VIRTUAL'){var _0x18e90b={};_0x18e90b[_0x24f0ae[_0x9991('0x24')]]={'$like':'%'+_0x435ce9[_0x9991('0x2c')][_0x9991('0x39')]+'%'};return _0x18e90b;}})});}_0x833b5b=_['merge']({},_0x833b5b,_0x435ce9['options']);var _0x4cc3bc={'where':_0x833b5b[_0x9991('0x35')]};return db[_0x9991('0x3a')][_0x9991('0x3b')](_0x4cc3bc)[_0x9991('0x1e')](function(_0x50020d){_0x6f8936[_0x9991('0x3b')]=_0x50020d;if(_0x435ce9[_0x9991('0x2c')][_0x9991('0x3c')]){_0x833b5b['include']=[{'all':!![]}];}return db['SquareRecording'][_0x9991('0x3d')](_0x833b5b);})[_0x9991('0x1e')](function(_0x14cb8a){_0x6f8936[_0x9991('0x3e')]=_0x14cb8a;return _0x6f8936;})[_0x9991('0x1e')](respondWithFilteredResult(_0x2c52ae,_0x833b5b))[_0x9991('0x3f')](handleError(_0x2c52ae,null));};exports['show']=function(_0x500b28,_0x769c89){var _0x28ec08={'raw':!![],'where':{'id':_0x500b28[_0x9991('0x40')]['id']}},_0x4ec788={};_0x4ec788[_0x9991('0x2b')]=_[_0x9991('0x2d')](db[_0x9991('0x3a')][_0x9991('0x41')]);_0x4ec788[_0x9991('0x2c')]=_['keys'](_0x500b28[_0x9991('0x2c')]);_0x4ec788[_0x9991('0x36')]=_[_0x9991('0x2e')](_0x4ec788['model'],_0x4ec788['query']);_0x28ec08[_0x9991('0x2f')]=_['intersection'](_0x4ec788['model'],qs['fields'](_0x500b28[_0x9991('0x2c')][_0x9991('0x30')]));_0x28ec08[_0x9991('0x2f')]=_0x28ec08[_0x9991('0x2f')][_0x9991('0x31')]?_0x28ec08['attributes']:_0x4ec788[_0x9991('0x2b')];if(_0x500b28['query'][_0x9991('0x3c')]){_0x28ec08[_0x9991('0x42')]=[{'all':!![]}];}_0x28ec08=_[_0x9991('0x38')]({},_0x28ec08,_0x500b28[_0x9991('0x43')]);return db[_0x9991('0x3a')]['find'](_0x28ec08)[_0x9991('0x1e')](handleEntityNotFound(_0x769c89,null))[_0x9991('0x1e')](respondWithResult(_0x769c89,null))['catch'](handleError(_0x769c89,null));};exports[_0x9991('0x44')]=function(_0x4d096d,_0x1f5815){return db['SquareRecording']['create'](_0x4d096d[_0x9991('0x45')],{})[_0x9991('0x1e')](respondWithResult(_0x1f5815,0xc9))[_0x9991('0x3f')](handleError(_0x1f5815,null));};exports[_0x9991('0x1d')]=function(_0x4232c8,_0x3e4f91){if(_0x4232c8[_0x9991('0x45')]['id']){delete _0x4232c8[_0x9991('0x45')]['id'];}return db[_0x9991('0x3a')][_0x9991('0x46')]({'where':{'id':_0x4232c8[_0x9991('0x40')]['id']}})[_0x9991('0x1e')](handleEntityNotFound(_0x3e4f91,null))[_0x9991('0x1e')](saveUpdates(_0x4232c8['body'],null))[_0x9991('0x1e')](respondWithResult(_0x3e4f91,null))['catch'](handleError(_0x3e4f91,null));};exports[_0x9991('0x47')]=function(_0x2361e1,_0x44e848,_0x2feac3){var _0x4c60d9=require(_0x9991('0x48'));var _0x47ac4e=![];var _0x333929={};if(_0x2361e1[_0x9991('0x2c')][_0x9991('0x29')]&&_0x2361e1[_0x9991('0x2c')][_0x9991('0x29')]===_0x9991('0x49')){_0x333929[_0x9991('0x49')]=_0x2361e1[_0x9991('0x40')]['id'];}else{_0x333929['id']=_0x2361e1['params']['id'];}return db[_0x9991('0x3a')][_0x9991('0x46')]({'where':_0x333929,'attributes':['id',_0x9991('0x4a'),_0x9991('0x4b')],'raw':!![]})[_0x9991('0x1e')](handleEntityNotFound(_0x44e848,null))[_0x9991('0x1e')](function(_0xd118fa){if(_0xd118fa){var _0x4cc60d=_0xd118fa[_0x9991('0x4a')];var _0x16a3b6=util[_0x9991('0x4c')](_0x9991('0x4d'),_0x4cc60d);if(fs[_0x9991('0x4e')](_0x16a3b6)){_0x47ac4e=!![];return _0x4c60d9[_0x9991('0x4f')](_0x16a3b6,_0x4cc60d,config[_0x9991('0x50')][_0x9991('0x51')])['then'](function(){return _0xd118fa;});}return _0xd118fa;}})[_0x9991('0x1e')](function(_0x3d529e){if(_0x3d529e){var _0x3f1bb4=_0x3d529e['savePath'];if(!fs[_0x9991('0x4e')](_0x3f1bb4)){throw new db['Sequelize'][(_0x9991('0x52'))]('SquareRecording\x20not\x20found');}if(_0x3d529e[_0x9991('0x4b')]){return _0x44e848[_0x9991('0x47')](_0x3f1bb4,_0x3d529e[_0x9991('0x4b')]+path[_0x9991('0x53')](_0x3f1bb4),function(){if(_0x47ac4e){fs[_0x9991('0x54')](_0x3f1bb4);}});}else{return _0x44e848[_0x9991('0x47')](_0x3f1bb4,function(_0x4e6960){if(_0x47ac4e){fs['unlink'](_0x3f1bb4);}});}}})[_0x9991('0x3f')](function(_0x55292e){if(_0x55292e[_0x9991('0x55')]==='SquareRecording\x20not\x20found'){_0x44e848[_0x9991('0x14')](0x194)[_0x9991('0x25')](_0x9991('0x56'));}else{return handleError(_0x44e848,null);}});};exports[_0x9991('0x1f')]=function(_0x33747e,_0x5f42dd){return db['SquareRecording'][_0x9991('0x46')]({'where':{'id':_0x33747e[_0x9991('0x40')]['id']}})['then'](function(_0x371739){if(_['isNil'](_0x371739)){throw new ReferenceError(_0x9991('0x57'));}return _0x371739;})['then'](function(_0x40cda5){var _0x53697e=_0x40cda5[_0x9991('0x4a')];logger[_0x9991('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x53697e);if(!_[_0x9991('0x59')](_0x40cda5['savePath'])&&fs[_0x9991('0x4e')](_0x53697e)){logger['info']('File:\x20\x22'+_0x53697e+_0x9991('0x5a'));fs[_0x9991('0x5b')](_0x53697e);}_0x53697e=_0x53697e+_0x9991('0x5c');if(!_[_0x9991('0x59')](_0x40cda5['savePath'])&&fs[_0x9991('0x4e')](_0x53697e)){logger['info']('File:\x20\x22'+_0x53697e+_0x9991('0x5a'));fs[_0x9991('0x5b')](_0x53697e);}return _0x40cda5;})[_0x9991('0x1e')](function(_0x24bb74){if(!_0x24bb74)throw new InternalError();return _0x24bb74[_0x9991('0x1f')]();})[_0x9991('0x1e')](function(){_0x5f42dd['status'](0xcc)[_0x9991('0x20')]();})['catch'](handleError(_0x5f42dd,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 3b274e6..a3d65b5 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 _0x1574=['../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0xe0d6d,_0x365162){var _0x162274=function(_0x1f9c89){while(--_0x1f9c89){_0xe0d6d['push'](_0xe0d6d['shift']());}};_0x162274(++_0x365162);}(_0x1574,0x148));var _0x4157=function(_0x22d618,_0x5411c4){_0x22d618=_0x22d618-0x0;var _0xd264e4=_0x1574[_0x22d618];return _0xd264e4;};'use strict';var _=require(_0x4157('0x0'));var util=require(_0x4157('0x1'));var logger=require(_0x4157('0x2'))(_0x4157('0x3'));var moment=require('moment');var BPromise=require(_0x4157('0x4'));var rp=require(_0x4157('0x5'));var fs=require('fs');var path=require(_0x4157('0x6'));var rimraf=require(_0x4157('0x7'));var config=require(_0x4157('0x8'));var attributes=require(_0x4157('0x9'));module[_0x4157('0xa')]=function(_0x43c6dc,_0xbd0cf7){return _0x43c6dc[_0x4157('0xb')](_0x4157('0xc'),attributes,{'tableName':_0x4157('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6829=['path','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','util','bluebird','request-promise'];(function(_0x3b18bb,_0x496cbf){var _0x566885=function(_0x3c85f3){while(--_0x3c85f3){_0x3b18bb['push'](_0x3b18bb['shift']());}};_0x566885(++_0x496cbf);}(_0x6829,0x14c));var _0x9682=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x6829[_0x126558];return _0x1f6d14;};'use strict';var _=require(_0x9682('0x0'));var util=require(_0x9682('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x9682('0x2'));var rp=require(_0x9682('0x3'));var fs=require('fs');var path=require(_0x9682('0x4'));var rimraf=require(_0x9682('0x5'));var config=require(_0x9682('0x6'));var attributes=require(_0x9682('0x7'));module[_0x9682('0x8')]=function(_0x1e6fe8,_0x19b909){return _0x1e6fe8[_0x9682('0x9')](_0x9682('0xa'),attributes,{'tableName':_0x9682('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 7972f1f..10230af 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 _0xbfc1=['CreateSquareRecording','SquareRecording','create','body','options','raw','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x5c08cb,_0x456960){var _0x147907=function(_0x1da1be){while(--_0x1da1be){_0x5c08cb['push'](_0x5c08cb['shift']());}};_0x147907(++_0x456960);}(_0xbfc1,0x1f4));var _0x1bfc=function(_0x2d5c70,_0x270f45){_0x2d5c70=_0x2d5c70-0x0;var _0x24ecfb=_0xbfc1[_0x2d5c70];return _0x24ecfb;};'use strict';var _=require(_0x1bfc('0x0'));var util=require('util');var moment=require(_0x1bfc('0x1'));var BPromise=require(_0x1bfc('0x2'));var rs=require(_0x1bfc('0x3'));var fs=require('fs');var Redis=require(_0x1bfc('0x4'));var db=require(_0x1bfc('0x5'))['db'];var utils=require(_0x1bfc('0x6'));var logger=require(_0x1bfc('0x7'))('rpc');var config=require(_0x1bfc('0x8'));var jayson=require(_0x1bfc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x68f64d,_0x27a1bb,_0x2ab271){return new BPromise(function(_0x1e267c,_0x17f2e2){return client[_0x1bfc('0xa')](_0x68f64d,_0x2ab271)[_0x1bfc('0xb')](function(_0x10bf73){logger[_0x1bfc('0xc')](_0x1bfc('0xd'),_0x27a1bb,_0x1bfc('0xe'));logger[_0x1bfc('0xf')](_0x1bfc('0x10'),_0x27a1bb,_0x1bfc('0xe'),JSON[_0x1bfc('0x11')](_0x10bf73));if(_0x10bf73[_0x1bfc('0x12')]){if(_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x13')]===0x1f4){logger[_0x1bfc('0x12')](_0x1bfc('0xd'),_0x27a1bb,_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x14')]);return _0x17f2e2(_0x10bf73['error'][_0x1bfc('0x14')]);}logger[_0x1bfc('0x12')](_0x1bfc('0xd'),_0x27a1bb,_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x14')]);return _0x1e267c(_0x10bf73[_0x1bfc('0x12')][_0x1bfc('0x14')]);}else{logger['info'](_0x1bfc('0xd'),_0x27a1bb,_0x1bfc('0xe'));_0x1e267c(_0x10bf73[_0x1bfc('0x15')][_0x1bfc('0x14')]);}})['catch'](function(_0x4a0ef3){logger[_0x1bfc('0x12')](_0x1bfc('0xd'),_0x27a1bb,_0x4a0ef3);_0x17f2e2(_0x4a0ef3);});});}exports[_0x1bfc('0x16')]=function(_0x4a71a2){var _0x39ca6c=this;return new Promise(function(_0x467e05,_0x5d8e80){return db[_0x1bfc('0x17')][_0x1bfc('0x18')](_0x4a71a2[_0x1bfc('0x19')],{'raw':_0x4a71a2[_0x1bfc('0x1a')]?_0x4a71a2[_0x1bfc('0x1a')][_0x1bfc('0x1b')]===undefined?!![]:![]:!![]})[_0x1bfc('0xb')](function(_0x176c71){logger[_0x1bfc('0xc')]('CreateSquareRecording',_0x4a71a2);logger[_0x1bfc('0xf')]('CreateSquareRecording',_0x4a71a2,JSON[_0x1bfc('0x11')](_0x176c71));_0x467e05(_0x176c71);})[_0x1bfc('0x1c')](function(_0x73035){logger[_0x1bfc('0x12')](_0x1bfc('0x16'),_0x73035[_0x1bfc('0x14')],_0x4a71a2);_0x5d8e80(_0x39ca6c[_0x1bfc('0x12')](0x1f4,_0x73035['message']));});});}; \ No newline at end of file +var _0x80bd=['request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message','result','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info'];(function(_0x5454e1,_0x2a14f3){var _0xa31794=function(_0x5710a6){while(--_0x5710a6){_0x5454e1['push'](_0x5454e1['shift']());}};_0xa31794(++_0x2a14f3);}(_0x80bd,0x1bf));var _0xd80b=function(_0x38135c,_0x788456){_0x38135c=_0x38135c-0x0;var _0x1275b6=_0x80bd[_0x38135c];return _0x1275b6;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd80b('0x0'));var BPromise=require(_0xd80b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd80b('0x2'));var db=require(_0xd80b('0x3'))['db'];var utils=require(_0xd80b('0x4'));var logger=require(_0xd80b('0x5'))('rpc');var config=require(_0xd80b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xd80b('0x7')][_0xd80b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c4bef,_0x1e05c9,_0x44dbce){return new BPromise(function(_0x121021,_0x311536){return client[_0xd80b('0x9')](_0x1c4bef,_0x44dbce)[_0xd80b('0xa')](function(_0x3a590c){logger[_0xd80b('0xb')]('SquareRecording,\x20%s,\x20%s',_0x1e05c9,_0xd80b('0xc'));logger['debug'](_0xd80b('0xd'),_0x1e05c9,_0xd80b('0xc'),JSON[_0xd80b('0xe')](_0x3a590c));if(_0x3a590c['error']){if(_0x3a590c[_0xd80b('0xf')][_0xd80b('0x10')]===0x1f4){logger[_0xd80b('0xf')](_0xd80b('0x11'),_0x1e05c9,_0x3a590c[_0xd80b('0xf')][_0xd80b('0x12')]);return _0x311536(_0x3a590c[_0xd80b('0xf')]['message']);}logger[_0xd80b('0xf')](_0xd80b('0x11'),_0x1e05c9,_0x3a590c[_0xd80b('0xf')][_0xd80b('0x12')]);return _0x121021(_0x3a590c[_0xd80b('0xf')]['message']);}else{logger[_0xd80b('0xb')]('SquareRecording,\x20%s,\x20%s',_0x1e05c9,_0xd80b('0xc'));_0x121021(_0x3a590c[_0xd80b('0x13')]['message']);}})[_0xd80b('0x14')](function(_0x4de50a){logger[_0xd80b('0xf')](_0xd80b('0x11'),_0x1e05c9,_0x4de50a);_0x311536(_0x4de50a);});});}exports['CreateSquareRecording']=function(_0x5a7322){var _0x149676=this;return new Promise(function(_0x220a1b,_0x3240e0){return db[_0xd80b('0x15')][_0xd80b('0x16')](_0x5a7322[_0xd80b('0x17')],{'raw':_0x5a7322[_0xd80b('0x18')]?_0x5a7322[_0xd80b('0x18')][_0xd80b('0x19')]===undefined?!![]:![]:!![]})[_0xd80b('0xa')](function(_0x24f3c9){logger[_0xd80b('0xb')]('CreateSquareRecording',_0x5a7322);logger['debug'](_0xd80b('0x1a'),_0x5a7322,JSON[_0xd80b('0xe')](_0x24f3c9));_0x220a1b(_0x24f3c9);})['catch'](function(_0x38c946){logger['error'](_0xd80b('0x1a'),_0x38c946['message'],_0x5a7322);_0x3240e0(_0x149676[_0xd80b('0xf')](0x1f4,_0x38c946[_0xd80b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index fdb9f45..900c580 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_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['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _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(_0x46457e,_0x411685){var _0x838de8=function(_0x4b56d1){while(--_0x4b56d1){_0x46457e['push'](_0x46457e['shift']());}};_0x838de8(++_0x411685);}(_0xe706,0xa3));var _0x6e70=function(_0x524021,_0x25d5ea){_0x524021=_0x524021-0x0;var _0x269c3e=_0xe706[_0x524021];return _0x269c3e;};'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 51d69bb..c74970e 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 _0xb4a5=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xb4a5,0x127));var _0x5b4a=function(_0x42babf,_0x2b9b48){_0x42babf=_0x42babf-0x0;var _0x5e592c=_0xb4a5[_0x42babf];return _0x5e592c;};'use strict';var Sequelize=require(_0x5b4a('0x0'));module[_0x5b4a('0x1')]={'network':{'type':Sequelize[_0x5b4a('0x2')]},'network_script':{'type':Sequelize[_0x5b4a('0x2')]},'request':{'type':Sequelize[_0x5b4a('0x2')]},'channel':{'type':Sequelize[_0x5b4a('0x2')]},'language':{'type':Sequelize[_0x5b4a('0x2')]},'type':{'type':Sequelize[_0x5b4a('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x5b4a('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5b4a('0x2')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x5b4a('0x2')]},'callington':{'type':Sequelize[_0x5b4a('0x2')]},'callingtns':{'type':Sequelize[_0x5b4a('0x2')]},'dnid':{'type':Sequelize[_0x5b4a('0x2')]},'rdnis':{'type':Sequelize[_0x5b4a('0x2')]},'context':{'type':Sequelize[_0x5b4a('0x2')]},'extension':{'type':Sequelize[_0x5b4a('0x2')]},'priority':{'type':Sequelize[_0x5b4a('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x5b4a('0x2')]},'threadid':{'type':Sequelize[_0x5b4a('0x2')]},'project_name':{'type':Sequelize[_0x5b4a('0x2')]},'joinAt':{'type':Sequelize[_0x5b4a('0x3')]},'leaveAt':{'type':Sequelize[_0x5b4a('0x3')]},'bot':{'type':Sequelize[_0x5b4a('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x16c1=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x2d5e73,_0x5af37d){var _0x46bfe5=function(_0x28a4c8){while(--_0x28a4c8){_0x2d5e73['push'](_0x2d5e73['shift']());}};_0x46bfe5(++_0x5af37d);}(_0x16c1,0x195));var _0x116c=function(_0x58d63c,_0x34c6a4){_0x58d63c=_0x58d63c-0x0;var _0x18e6e4=_0x16c1[_0x58d63c];return _0x18e6e4;};'use strict';var Sequelize=require(_0x116c('0x0'));module[_0x116c('0x1')]={'network':{'type':Sequelize['STRING']},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x116c('0x2')]},'language':{'type':Sequelize[_0x116c('0x2')]},'type':{'type':Sequelize[_0x116c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x116c('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x116c('0x2')]},'callingpres':{'type':Sequelize[_0x116c('0x2')]},'callingani2':{'type':Sequelize[_0x116c('0x2')]},'callington':{'type':Sequelize[_0x116c('0x2')]},'callingtns':{'type':Sequelize[_0x116c('0x2')]},'dnid':{'type':Sequelize[_0x116c('0x2')]},'rdnis':{'type':Sequelize[_0x116c('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x116c('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x116c('0x2')]},'accountcode':{'type':Sequelize[_0x116c('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x116c('0x3')]},'leaveAt':{'type':Sequelize[_0x116c('0x3')]},'bot':{'type':Sequelize[_0x116c('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 7b59900..b1d669e 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 _0x1497=['intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','include','findAll','rows','show','params','includeAll','options','find','catch','create','body','update','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','limit','undefined','count','status','set','Content-Range','json','reject','save','then','destroy','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','keys','filters','attributes'];(function(_0x4b5ab2,_0x12080b){var _0x478f48=function(_0x3b0296){while(--_0x3b0296){_0x4b5ab2['push'](_0x4b5ab2['shift']());}};_0x478f48(++_0x12080b);}(_0x1497,0x19e));var _0x7149=function(_0x5827a2,_0x1c931f){_0x5827a2=_0x5827a2-0x0;var _0x6b8862=_0x1497[_0x5827a2];return _0x6b8862;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7149('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7149('0x1'));var moment=require(_0x7149('0x2'));var BPromise=require(_0x7149('0x3'));var Mustache=require(_0x7149('0x4'));var util=require(_0x7149('0x5'));var path=require(_0x7149('0x6'));var sox=require('sox');var csv=require(_0x7149('0x7'));var ejs=require(_0x7149('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7149('0x9'));var squel=require(_0x7149('0xa'));var crypto=require(_0x7149('0xb'));var jsforce=require(_0x7149('0xc'));var deskjs=require(_0x7149('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7149('0xe'));var Papa=require('papaparse');var Redis=require(_0x7149('0xf'));var authService=require(_0x7149('0x10'));var qs=require(_0x7149('0x11'));var as=require(_0x7149('0x12'));var hardwareService=require(_0x7149('0x13'));var logger=require(_0x7149('0x14'))(_0x7149('0x15'));var utils=require(_0x7149('0x16'));var config=require(_0x7149('0x17'));var licenseUtil=require(_0x7149('0x18'));var db=require(_0x7149('0x19'))['db'];function respondWithStatusCode(_0x3fa14a,_0x34d716){_0x34d716=_0x34d716||0xcc;return function(_0x36a541){if(_0x36a541){return _0x3fa14a[_0x7149('0x1a')](_0x34d716);}return _0x3fa14a['status'](_0x34d716)[_0x7149('0x1b')]();};}function respondWithResult(_0x4efd67,_0x2c37d1){_0x2c37d1=_0x2c37d1||0xc8;return function(_0x1fb38d){if(_0x1fb38d){return _0x4efd67['status'](_0x2c37d1)['json'](_0x1fb38d);}};}function respondWithFilteredResult(_0x156f8a,_0x123e2a){return function(_0x28b09f){if(_0x28b09f){var _0x8a24b9=typeof _0x123e2a[_0x7149('0x1c')]==='undefined'&&typeof _0x123e2a[_0x7149('0x1d')]===_0x7149('0x1e');var _0xa1019f=_0x28b09f[_0x7149('0x1f')];var _0x3b0185=_0x8a24b9?0x0:_0x123e2a[_0x7149('0x1c')];var _0x288887=_0x8a24b9?_0x28b09f['count']:_0x123e2a[_0x7149('0x1c')]+_0x123e2a[_0x7149('0x1d')];var _0x1e9af7;if(_0x288887>=_0xa1019f){_0x288887=_0xa1019f;_0x1e9af7=0xc8;}else{_0x1e9af7=0xce;}_0x156f8a[_0x7149('0x20')](_0x1e9af7);return _0x156f8a[_0x7149('0x21')](_0x7149('0x22'),_0x3b0185+'-'+_0x288887+'/'+_0xa1019f)[_0x7149('0x23')](_0x28b09f);}return null;};}function patchUpdates(_0x1bf76a){return function(_0x1ec9c8){try{jsonpatch['apply'](_0x1ec9c8,_0x1bf76a,!![]);}catch(_0x4f5b5e){return BPromise[_0x7149('0x24')](_0x4f5b5e);}return _0x1ec9c8[_0x7149('0x25')]();};}function saveUpdates(_0x260a04,_0x1ca7c7){return function(_0x32e617){if(_0x32e617){return _0x32e617['update'](_0x260a04)[_0x7149('0x26')](function(_0x4f2adf){return _0x4f2adf;});}return null;};}function removeEntity(_0x7505dd,_0xd41390){return function(_0x40d16d){if(_0x40d16d){return _0x40d16d[_0x7149('0x27')]()[_0x7149('0x26')](function(){_0x7505dd['status'](0xcc)[_0x7149('0x1b')]();});}};}function handleEntityNotFound(_0x8fda17,_0x54af50){return function(_0x2afdfd){if(!_0x2afdfd){_0x8fda17[_0x7149('0x1a')](0x194);}return _0x2afdfd;};}function handleError(_0x2731f6,_0x2c37e4){_0x2c37e4=_0x2c37e4||0x1f4;return function(_0x4184fc){logger[_0x7149('0x28')](_0x4184fc[_0x7149('0x29')]);if(_0x4184fc[_0x7149('0x2a')]){delete _0x4184fc['name'];}_0x2731f6[_0x7149('0x20')](_0x2c37e4)['send'](_0x4184fc);};}exports[_0x7149('0x2b')]=function(_0x2085eb,_0x696b7f){var _0x2a16bc={},_0x282a59={},_0x14455b={'count':0x0,'rows':[]};var _0x57a0ea=_[_0x7149('0x2c')](db[_0x7149('0x2d')][_0x7149('0x2e')],function(_0x4d0c80){return{'name':_0x4d0c80[_0x7149('0x2f')],'type':_0x4d0c80['type'][_0x7149('0x30')]};});_0x282a59[_0x7149('0x31')]=_['map'](_0x57a0ea,_0x7149('0x2a'));_0x282a59[_0x7149('0x32')]=_[_0x7149('0x33')](_0x2085eb[_0x7149('0x32')]);_0x282a59[_0x7149('0x34')]=_['intersection'](_0x282a59[_0x7149('0x31')],_0x282a59[_0x7149('0x32')]);_0x2a16bc[_0x7149('0x35')]=_[_0x7149('0x36')](_0x282a59[_0x7149('0x31')],qs[_0x7149('0x37')](_0x2085eb[_0x7149('0x32')]['fields']));_0x2a16bc[_0x7149('0x35')]=_0x2a16bc[_0x7149('0x35')][_0x7149('0x38')]?_0x2a16bc[_0x7149('0x35')]:_0x282a59[_0x7149('0x31')];if(!_0x2085eb[_0x7149('0x32')][_0x7149('0x39')](_0x7149('0x3a'))){_0x2a16bc[_0x7149('0x1d')]=qs['limit'](_0x2085eb['query']['limit']);_0x2a16bc['offset']=qs['offset'](_0x2085eb['query']['offset']);}_0x2a16bc['order']=qs[_0x7149('0x3b')](_0x2085eb['query'][_0x7149('0x3b')]);_0x2a16bc[_0x7149('0x3c')]=qs[_0x7149('0x34')](_[_0x7149('0x3d')](_0x2085eb[_0x7149('0x32')],_0x282a59[_0x7149('0x34')]),_0x57a0ea);if(_0x2085eb['query'][_0x7149('0x3e')]){_0x2a16bc[_0x7149('0x3c')]=_[_0x7149('0x3f')](_0x2a16bc[_0x7149('0x3c')],{'$or':_[_0x7149('0x2c')](_0x57a0ea,function(_0x9898eb){if(_0x9898eb[_0x7149('0x40')]!=='VIRTUAL'){var _0x2ad957={};_0x2ad957[_0x9898eb[_0x7149('0x2a')]]={'$like':'%'+_0x2085eb[_0x7149('0x32')]['filter']+'%'};return _0x2ad957;}})});}_0x2a16bc=_[_0x7149('0x3f')]({},_0x2a16bc,_0x2085eb['options']);var _0x294873={'where':_0x2a16bc[_0x7149('0x3c')]};return db[_0x7149('0x2d')][_0x7149('0x1f')](_0x294873)[_0x7149('0x26')](function(_0x1c3a00){_0x14455b['count']=_0x1c3a00;if(_0x2085eb[_0x7149('0x32')]['includeAll']){_0x2a16bc[_0x7149('0x41')]=[{'all':!![]}];}return db[_0x7149('0x2d')][_0x7149('0x42')](_0x2a16bc);})[_0x7149('0x26')](function(_0x255724){_0x14455b[_0x7149('0x43')]=_0x255724;return _0x14455b;})[_0x7149('0x26')](respondWithFilteredResult(_0x696b7f,_0x2a16bc))['catch'](handleError(_0x696b7f,null));};exports[_0x7149('0x44')]=function(_0x15eb79,_0x40fa08){var _0x33845f={'raw':!![],'where':{'id':_0x15eb79[_0x7149('0x45')]['id']}},_0x3cd945={};_0x3cd945[_0x7149('0x31')]=_[_0x7149('0x33')](db[_0x7149('0x2d')][_0x7149('0x2e')]);_0x3cd945['query']=_['keys'](_0x15eb79[_0x7149('0x32')]);_0x3cd945['filters']=_[_0x7149('0x36')](_0x3cd945[_0x7149('0x31')],_0x3cd945[_0x7149('0x32')]);_0x33845f['attributes']=_[_0x7149('0x36')](_0x3cd945[_0x7149('0x31')],qs[_0x7149('0x37')](_0x15eb79[_0x7149('0x32')][_0x7149('0x37')]));_0x33845f[_0x7149('0x35')]=_0x33845f[_0x7149('0x35')][_0x7149('0x38')]?_0x33845f['attributes']:_0x3cd945[_0x7149('0x31')];if(_0x15eb79[_0x7149('0x32')][_0x7149('0x46')]){_0x33845f[_0x7149('0x41')]=[{'all':!![]}];}_0x33845f=_['merge']({},_0x33845f,_0x15eb79[_0x7149('0x47')]);return db[_0x7149('0x2d')][_0x7149('0x48')](_0x33845f)[_0x7149('0x26')](handleEntityNotFound(_0x40fa08,null))['then'](respondWithResult(_0x40fa08,null))[_0x7149('0x49')](handleError(_0x40fa08,null));};exports[_0x7149('0x4a')]=function(_0x2671dd,_0x2d783b){return db[_0x7149('0x2d')][_0x7149('0x4a')](_0x2671dd[_0x7149('0x4b')],{})[_0x7149('0x26')](respondWithResult(_0x2d783b,0xc9))[_0x7149('0x49')](handleError(_0x2d783b,null));};exports[_0x7149('0x4c')]=function(_0x5b0151,_0x151658){if(_0x5b0151[_0x7149('0x4b')]['id']){delete _0x5b0151[_0x7149('0x4b')]['id'];}return db[_0x7149('0x2d')]['find']({'where':{'id':_0x5b0151[_0x7149('0x45')]['id']}})['then'](handleEntityNotFound(_0x151658,null))['then'](saveUpdates(_0x5b0151[_0x7149('0x4b')],null))[_0x7149('0x26')](respondWithResult(_0x151658,null))[_0x7149('0x49')](handleError(_0x151658,null));};exports[_0x7149('0x27')]=function(_0x3c5979,_0x4daafe){return db[_0x7149('0x2d')][_0x7149('0x48')]({'where':{'id':_0x3c5979[_0x7149('0x45')]['id']}})[_0x7149('0x26')](handleEntityNotFound(_0x4daafe,null))[_0x7149('0x26')](removeEntity(_0x4daafe,null))[_0x7149('0x49')](handleError(_0x4daafe,null));};exports[_0x7149('0x4d')]=function(_0x371f22,_0x301b8b){return db[_0x7149('0x2d')]['describe']()[_0x7149('0x26')](respondWithResult(_0x301b8b,null))[_0x7149('0x49')](handleError(_0x301b8b,null));}; \ No newline at end of file +var _0x2409=['length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','SquareReport','include','findAll','catch','show','params','fields','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes'];(function(_0x12312e,_0x2a7080){var _0x2cbcd1=function(_0x1c1c69){while(--_0x1c1c69){_0x12312e['push'](_0x12312e['shift']());}};_0x2cbcd1(++_0x2a7080);}(_0x2409,0x69));var _0x9240=function(_0x3356ad,_0x3df2c0){_0x3356ad=_0x3356ad-0x0;var _0x3cecec=_0x2409[_0x3356ad];return _0x3cecec;};'use strict';var emlformat=require(_0x9240('0x0'));var rimraf=require(_0x9240('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9240('0x2'));var rp=require('request-promise');var moment=require(_0x9240('0x3'));var BPromise=require(_0x9240('0x4'));var Mustache=require(_0x9240('0x5'));var util=require(_0x9240('0x6'));var path=require('path');var sox=require(_0x9240('0x7'));var csv=require(_0x9240('0x8'));var ejs=require(_0x9240('0x9'));var fs=require('fs');var fs_extra=require(_0x9240('0xa'));var _=require(_0x9240('0xb'));var squel=require(_0x9240('0xc'));var crypto=require(_0x9240('0xd'));var jsforce=require(_0x9240('0xe'));var deskjs=require(_0x9240('0xf'));var toCsv=require(_0x9240('0x8'));var querystring=require('querystring');var Papa=require(_0x9240('0x10'));var Redis=require(_0x9240('0x11'));var authService=require(_0x9240('0x12'));var qs=require(_0x9240('0x13'));var as=require(_0x9240('0x14'));var hardwareService=require(_0x9240('0x15'));var logger=require(_0x9240('0x16'))('api');var utils=require(_0x9240('0x17'));var config=require(_0x9240('0x18'));var licenseUtil=require(_0x9240('0x19'));var db=require(_0x9240('0x1a'))['db'];function respondWithStatusCode(_0x2ae49d,_0x11aaf3){_0x11aaf3=_0x11aaf3||0xcc;return function(_0x3a457a){if(_0x3a457a){return _0x2ae49d[_0x9240('0x1b')](_0x11aaf3);}return _0x2ae49d[_0x9240('0x1c')](_0x11aaf3)[_0x9240('0x1d')]();};}function respondWithResult(_0x181dd1,_0x247a0f){_0x247a0f=_0x247a0f||0xc8;return function(_0x460f3d){if(_0x460f3d){return _0x181dd1['status'](_0x247a0f)[_0x9240('0x1e')](_0x460f3d);}};}function respondWithFilteredResult(_0x3463fa,_0x110bdc){return function(_0x1b0a92){if(_0x1b0a92){var _0x1a7860=typeof _0x110bdc['offset']===_0x9240('0x1f')&&typeof _0x110bdc['limit']===_0x9240('0x1f');var _0x2b71a4=_0x1b0a92['count'];var _0x24d00d=_0x1a7860?0x0:_0x110bdc['offset'];var _0x2101f1=_0x1a7860?_0x1b0a92[_0x9240('0x20')]:_0x110bdc[_0x9240('0x21')]+_0x110bdc[_0x9240('0x22')];var _0x47bdf4;if(_0x2101f1>=_0x2b71a4){_0x2101f1=_0x2b71a4;_0x47bdf4=0xc8;}else{_0x47bdf4=0xce;}_0x3463fa[_0x9240('0x1c')](_0x47bdf4);return _0x3463fa[_0x9240('0x23')](_0x9240('0x24'),_0x24d00d+'-'+_0x2101f1+'/'+_0x2b71a4)[_0x9240('0x1e')](_0x1b0a92);}return null;};}function patchUpdates(_0x388446){return function(_0x212765){try{jsonpatch[_0x9240('0x25')](_0x212765,_0x388446,!![]);}catch(_0xd2dd13){return BPromise[_0x9240('0x26')](_0xd2dd13);}return _0x212765[_0x9240('0x27')]();};}function saveUpdates(_0x48b6dc,_0x293cda){return function(_0x105878){if(_0x105878){return _0x105878[_0x9240('0x28')](_0x48b6dc)[_0x9240('0x29')](function(_0x58276c){return _0x58276c;});}return null;};}function removeEntity(_0x45c6c7,_0x105c27){return function(_0x56d664){if(_0x56d664){return _0x56d664[_0x9240('0x2a')]()['then'](function(){_0x45c6c7[_0x9240('0x1c')](0xcc)[_0x9240('0x1d')]();});}};}function handleEntityNotFound(_0x354c3e,_0x37e3d3){return function(_0x3c747d){if(!_0x3c747d){_0x354c3e[_0x9240('0x1b')](0x194);}return _0x3c747d;};}function handleError(_0x1eca55,_0x2746b6){_0x2746b6=_0x2746b6||0x1f4;return function(_0xc70dfc){logger[_0x9240('0x2b')](_0xc70dfc[_0x9240('0x2c')]);if(_0xc70dfc[_0x9240('0x2d')]){delete _0xc70dfc['name'];}_0x1eca55[_0x9240('0x1c')](_0x2746b6)['send'](_0xc70dfc);};}exports[_0x9240('0x2e')]=function(_0x422f2f,_0x1156e9){var _0xe8e2c4={},_0x235c1d={},_0x369da0={'count':0x0,'rows':[]};var _0x4ab6c0=_[_0x9240('0x2f')](db['SquareReport'][_0x9240('0x30')],function(_0x1cde2e){return{'name':_0x1cde2e[_0x9240('0x31')],'type':_0x1cde2e[_0x9240('0x32')][_0x9240('0x33')]};});_0x235c1d[_0x9240('0x34')]=_[_0x9240('0x2f')](_0x4ab6c0,_0x9240('0x2d'));_0x235c1d[_0x9240('0x35')]=_[_0x9240('0x36')](_0x422f2f[_0x9240('0x35')]);_0x235c1d['filters']=_[_0x9240('0x37')](_0x235c1d[_0x9240('0x34')],_0x235c1d[_0x9240('0x35')]);_0xe8e2c4['attributes']=_['intersection'](_0x235c1d['model'],qs['fields'](_0x422f2f['query']['fields']));_0xe8e2c4[_0x9240('0x38')]=_0xe8e2c4[_0x9240('0x38')][_0x9240('0x39')]?_0xe8e2c4[_0x9240('0x38')]:_0x235c1d[_0x9240('0x34')];if(!_0x422f2f[_0x9240('0x35')][_0x9240('0x3a')](_0x9240('0x3b'))){_0xe8e2c4[_0x9240('0x22')]=qs[_0x9240('0x22')](_0x422f2f['query'][_0x9240('0x22')]);_0xe8e2c4[_0x9240('0x21')]=qs[_0x9240('0x21')](_0x422f2f['query'][_0x9240('0x21')]);}_0xe8e2c4[_0x9240('0x3c')]=qs['sort'](_0x422f2f[_0x9240('0x35')][_0x9240('0x3d')]);_0xe8e2c4['where']=qs['filters'](_[_0x9240('0x3e')](_0x422f2f[_0x9240('0x35')],_0x235c1d[_0x9240('0x3f')]),_0x4ab6c0);if(_0x422f2f[_0x9240('0x35')][_0x9240('0x40')]){_0xe8e2c4[_0x9240('0x41')]=_[_0x9240('0x42')](_0xe8e2c4[_0x9240('0x41')],{'$or':_[_0x9240('0x2f')](_0x4ab6c0,function(_0x295145){if(_0x295145['type']!==_0x9240('0x43')){var _0x2207ff={};_0x2207ff[_0x295145[_0x9240('0x2d')]]={'$like':'%'+_0x422f2f['query'][_0x9240('0x40')]+'%'};return _0x2207ff;}})});}_0xe8e2c4=_[_0x9240('0x42')]({},_0xe8e2c4,_0x422f2f[_0x9240('0x44')]);var _0x36fb14={'where':_0xe8e2c4[_0x9240('0x41')]};return db[_0x9240('0x45')][_0x9240('0x20')](_0x36fb14)['then'](function(_0x2dfd4e){_0x369da0[_0x9240('0x20')]=_0x2dfd4e;if(_0x422f2f[_0x9240('0x35')]['includeAll']){_0xe8e2c4[_0x9240('0x46')]=[{'all':!![]}];}return db['SquareReport'][_0x9240('0x47')](_0xe8e2c4);})[_0x9240('0x29')](function(_0x3de2b4){_0x369da0['rows']=_0x3de2b4;return _0x369da0;})['then'](respondWithFilteredResult(_0x1156e9,_0xe8e2c4))[_0x9240('0x48')](handleError(_0x1156e9,null));};exports[_0x9240('0x49')]=function(_0x2512a3,_0x299a0f){var _0x5c9e8f={'raw':!![],'where':{'id':_0x2512a3[_0x9240('0x4a')]['id']}},_0x23a96d={};_0x23a96d[_0x9240('0x34')]=_['keys'](db[_0x9240('0x45')][_0x9240('0x30')]);_0x23a96d['query']=_['keys'](_0x2512a3['query']);_0x23a96d[_0x9240('0x3f')]=_[_0x9240('0x37')](_0x23a96d[_0x9240('0x34')],_0x23a96d[_0x9240('0x35')]);_0x5c9e8f[_0x9240('0x38')]=_[_0x9240('0x37')](_0x23a96d[_0x9240('0x34')],qs[_0x9240('0x4b')](_0x2512a3[_0x9240('0x35')]['fields']));_0x5c9e8f[_0x9240('0x38')]=_0x5c9e8f[_0x9240('0x38')][_0x9240('0x39')]?_0x5c9e8f['attributes']:_0x23a96d[_0x9240('0x34')];if(_0x2512a3[_0x9240('0x35')][_0x9240('0x4c')]){_0x5c9e8f['include']=[{'all':!![]}];}_0x5c9e8f=_[_0x9240('0x42')]({},_0x5c9e8f,_0x2512a3[_0x9240('0x44')]);return db[_0x9240('0x45')][_0x9240('0x4d')](_0x5c9e8f)[_0x9240('0x29')](handleEntityNotFound(_0x299a0f,null))[_0x9240('0x29')](respondWithResult(_0x299a0f,null))['catch'](handleError(_0x299a0f,null));};exports[_0x9240('0x4e')]=function(_0xf0ecba,_0x5118d9){return db[_0x9240('0x45')][_0x9240('0x4e')](_0xf0ecba[_0x9240('0x4f')],{})[_0x9240('0x29')](respondWithResult(_0x5118d9,0xc9))[_0x9240('0x48')](handleError(_0x5118d9,null));};exports['update']=function(_0x509b88,_0x20cbb9){if(_0x509b88[_0x9240('0x4f')]['id']){delete _0x509b88[_0x9240('0x4f')]['id'];}return db['SquareReport']['find']({'where':{'id':_0x509b88[_0x9240('0x4a')]['id']}})[_0x9240('0x29')](handleEntityNotFound(_0x20cbb9,null))[_0x9240('0x29')](saveUpdates(_0x509b88[_0x9240('0x4f')],null))[_0x9240('0x29')](respondWithResult(_0x20cbb9,null))[_0x9240('0x48')](handleError(_0x20cbb9,null));};exports[_0x9240('0x2a')]=function(_0x69a380,_0x182fec){return db[_0x9240('0x45')][_0x9240('0x4d')]({'where':{'id':_0x69a380[_0x9240('0x4a')]['id']}})[_0x9240('0x29')](handleEntityNotFound(_0x182fec,null))[_0x9240('0x29')](removeEntity(_0x182fec,null))[_0x9240('0x48')](handleError(_0x182fec,null));};exports[_0x9240('0x50')]=function(_0xa602f6,_0x2c44d1){return db['SquareReport'][_0x9240('0x50')]()[_0x9240('0x29')](respondWithResult(_0x2c44d1,null))['catch'](handleError(_0x2c44d1,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 7592eb9..d1ddcdf 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 _0xd9da=['uniqueid','project_name','leaveAt','lodash','../../config/logger','api','request-promise','path','rimraf','exports','define','SquareReport','report_square','uid_pname'];(function(_0x5b80fb,_0x232d60){var _0x2d29a5=function(_0x50bad3){while(--_0x50bad3){_0x5b80fb['push'](_0x5b80fb['shift']());}};_0x2d29a5(++_0x232d60);}(_0xd9da,0x11b));var _0xad9d=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd9da[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0xad9d('0x0'));var util=require('util');var logger=require(_0xad9d('0x1'))(_0xad9d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xad9d('0x3'));var fs=require('fs');var path=require(_0xad9d('0x4'));var rimraf=require(_0xad9d('0x5'));var config=require('../../config/environment');var attributes=require('./squareReport.attributes');module[_0xad9d('0x6')]=function(_0x3b1454,_0x261b71){return _0x3b1454[_0xad9d('0x7')](_0xad9d('0x8'),attributes,{'tableName':_0xad9d('0x9'),'paranoid':![],'indexes':[{'name':_0xad9d('0xa'),'fields':[_0xad9d('0xb'),_0xad9d('0xc')]},{'name':_0xad9d('0xd'),'fields':[_0xad9d('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7d51=['uid_pname','leaveAt','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x3c414c,_0x399dbb){var _0x4f3062=function(_0x1b71cc){while(--_0x1b71cc){_0x3c414c['push'](_0x3c414c['shift']());}};_0x4f3062(++_0x399dbb);}(_0x7d51,0x14c));var _0x17d5=function(_0x443989,_0x14b1b5){_0x443989=_0x443989-0x0;var _0x479edd=_0x7d51[_0x443989];return _0x479edd;};'use strict';var _=require(_0x17d5('0x0'));var util=require(_0x17d5('0x1'));var logger=require(_0x17d5('0x2'))('api');var moment=require(_0x17d5('0x3'));var BPromise=require(_0x17d5('0x4'));var rp=require(_0x17d5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17d5('0x6'));var config=require(_0x17d5('0x7'));var attributes=require(_0x17d5('0x8'));module[_0x17d5('0x9')]=function(_0x45b0eb,_0xa43308){return _0x45b0eb[_0x17d5('0xa')](_0x17d5('0xb'),attributes,{'tableName':_0x17d5('0xc'),'paranoid':![],'indexes':[{'name':_0x17d5('0xd'),'fields':['uniqueid','project_name']},{'name':_0x17d5('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4e4ea22..cb92dbd 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 _0x03ca=['message','catch','CreateSquareReport','SquareReport','create','body','options','update','where','attributes','UpdateSquareReport','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareReport,\x20%s,\x20%s'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0x03ca,0x1db));var _0xa03c=function(_0x4a85f0,_0x574958){_0x4a85f0=_0x4a85f0-0x0;var _0x16cdb5=_0x03ca[_0x4a85f0];return _0x16cdb5;};'use strict';var _=require('lodash');var util=require(_0xa03c('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa03c('0x1'));var fs=require('fs');var Redis=require(_0xa03c('0x2'));var db=require(_0xa03c('0x3'))['db'];var utils=require(_0xa03c('0x4'));var logger=require('../../config/logger')(_0xa03c('0x5'));var config=require(_0xa03c('0x6'));var jayson=require(_0xa03c('0x7'));var client=jayson[_0xa03c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x373383,_0x54439a,_0x4c3f1c){return new BPromise(function(_0x4423ca,_0x4a8341){return client['request'](_0x373383,_0x4c3f1c)[_0xa03c('0x9')](function(_0x1166b5){logger[_0xa03c('0xa')]('SquareReport,\x20%s,\x20%s',_0x54439a,_0xa03c('0xb'));logger[_0xa03c('0xc')](_0xa03c('0xd'),_0x54439a,_0xa03c('0xb'),JSON[_0xa03c('0xe')](_0x1166b5));if(_0x1166b5['error']){if(_0x1166b5[_0xa03c('0xf')][_0xa03c('0x10')]===0x1f4){logger[_0xa03c('0xf')](_0xa03c('0x11'),_0x54439a,_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);return _0x4a8341(_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);}logger[_0xa03c('0xf')](_0xa03c('0x11'),_0x54439a,_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);return _0x4423ca(_0x1166b5[_0xa03c('0xf')][_0xa03c('0x12')]);}else{logger[_0xa03c('0xa')](_0xa03c('0x11'),_0x54439a,_0xa03c('0xb'));_0x4423ca(_0x1166b5['result'][_0xa03c('0x12')]);}})[_0xa03c('0x13')](function(_0x57f085){logger[_0xa03c('0xf')](_0xa03c('0x11'),_0x54439a,_0x57f085);_0x4a8341(_0x57f085);});});}exports[_0xa03c('0x14')]=function(_0x5eabaa){var _0x5d5b9a=this;return new Promise(function(_0x5db67a,_0x42854a){return db[_0xa03c('0x15')][_0xa03c('0x16')](_0x5eabaa[_0xa03c('0x17')],{'raw':_0x5eabaa['options']?_0x5eabaa[_0xa03c('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xa03c('0x9')](function(_0x368e12){logger[_0xa03c('0xa')](_0xa03c('0x14'),_0x5eabaa);logger['debug'](_0xa03c('0x14'),_0x5eabaa,JSON[_0xa03c('0xe')](_0x368e12));_0x5db67a(_0x368e12);})['catch'](function(_0x4a67cb){logger[_0xa03c('0xf')](_0xa03c('0x14'),_0x4a67cb[_0xa03c('0x12')],_0x5eabaa);_0x42854a(_0x5d5b9a[_0xa03c('0xf')](0x1f4,_0x4a67cb[_0xa03c('0x12')]));});});};exports['UpdateSquareReport']=function(_0x5888f5){var _0x244737=this;return new Promise(function(_0x3f82d7,_0x5f0232){return db[_0xa03c('0x15')][_0xa03c('0x19')](_0x5888f5[_0xa03c('0x17')],{'raw':_0x5888f5['options']?_0x5888f5[_0xa03c('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5888f5['options']?_0x5888f5['options'][_0xa03c('0x1a')]||null:null,'attributes':_0x5888f5[_0xa03c('0x18')]?_0x5888f5['options'][_0xa03c('0x1b')]||null:null,'limit':_0x5888f5[_0xa03c('0x18')]?_0x5888f5[_0xa03c('0x18')]['limit']||null:null})[_0xa03c('0x9')](function(_0x2e5195){logger[_0xa03c('0xa')]('UpdateSquareReport',_0x5888f5);logger[_0xa03c('0xc')](_0xa03c('0x1c'),_0x5888f5,JSON[_0xa03c('0xe')](_0x2e5195));_0x3f82d7(_0x2e5195);})[_0xa03c('0x13')](function(_0x213e32){logger[_0xa03c('0xf')](_0xa03c('0x1c'),_0x213e32['message'],_0x5888f5);_0x5f0232(_0x244737[_0xa03c('0xf')](0x1f4,_0x213e32['message']));});});}; \ No newline at end of file +var _0x4cce=['info','SquareReport,\x20%s,\x20%s','request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','SquareReport','body','options','raw','CreateSquareReport','debug','UpdateSquareReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x45cbf3,_0x55fdc1){var _0x73323b=function(_0x502d20){while(--_0x502d20){_0x45cbf3['push'](_0x45cbf3['shift']());}};_0x73323b(++_0x55fdc1);}(_0x4cce,0xd9));var _0xe4cc=function(_0x504612,_0x150527){_0x504612=_0x504612-0x0;var _0x409bbe=_0x4cce[_0x504612];return _0x409bbe;};'use strict';var _=require('lodash');var util=require(_0xe4cc('0x0'));var moment=require(_0xe4cc('0x1'));var BPromise=require(_0xe4cc('0x2'));var rs=require(_0xe4cc('0x3'));var fs=require('fs');var Redis=require(_0xe4cc('0x4'));var db=require(_0xe4cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe4cc('0x6'))(_0xe4cc('0x7'));var config=require(_0xe4cc('0x8'));var jayson=require(_0xe4cc('0x9'));var client=jayson[_0xe4cc('0xa')][_0xe4cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f4b37,_0x3b866c,_0x5853c0){return new BPromise(function(_0x4d4b3b,_0x47fbff){return client[_0xe4cc('0xc')](_0x1f4b37,_0x5853c0)[_0xe4cc('0xd')](function(_0x1a41f8){logger[_0xe4cc('0xe')](_0xe4cc('0xf'),_0x3b866c,_0xe4cc('0x10'));logger['debug'](_0xe4cc('0x11'),_0x3b866c,_0xe4cc('0x10'),JSON[_0xe4cc('0x12')](_0x1a41f8));if(_0x1a41f8[_0xe4cc('0x13')]){if(_0x1a41f8['error']['code']===0x1f4){logger[_0xe4cc('0x13')](_0xe4cc('0xf'),_0x3b866c,_0x1a41f8[_0xe4cc('0x13')][_0xe4cc('0x14')]);return _0x47fbff(_0x1a41f8[_0xe4cc('0x13')]['message']);}logger['error'](_0xe4cc('0xf'),_0x3b866c,_0x1a41f8[_0xe4cc('0x13')]['message']);return _0x4d4b3b(_0x1a41f8['error'][_0xe4cc('0x14')]);}else{logger[_0xe4cc('0xe')](_0xe4cc('0xf'),_0x3b866c,_0xe4cc('0x10'));_0x4d4b3b(_0x1a41f8[_0xe4cc('0x15')]['message']);}})[_0xe4cc('0x16')](function(_0xe25d52){logger['error'](_0xe4cc('0xf'),_0x3b866c,_0xe25d52);_0x47fbff(_0xe25d52);});});}exports['CreateSquareReport']=function(_0xa9fd6e){var _0x3946b4=this;return new Promise(function(_0x597931,_0xd2291d){return db[_0xe4cc('0x17')]['create'](_0xa9fd6e[_0xe4cc('0x18')],{'raw':_0xa9fd6e[_0xe4cc('0x19')]?_0xa9fd6e[_0xe4cc('0x19')][_0xe4cc('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x2ec7f7){logger[_0xe4cc('0xe')](_0xe4cc('0x1b'),_0xa9fd6e);logger[_0xe4cc('0x1c')](_0xe4cc('0x1b'),_0xa9fd6e,JSON[_0xe4cc('0x12')](_0x2ec7f7));_0x597931(_0x2ec7f7);})['catch'](function(_0x1b4620){logger[_0xe4cc('0x13')](_0xe4cc('0x1b'),_0x1b4620[_0xe4cc('0x14')],_0xa9fd6e);_0xd2291d(_0x3946b4[_0xe4cc('0x13')](0x1f4,_0x1b4620[_0xe4cc('0x14')]));});});};exports[_0xe4cc('0x1d')]=function(_0x5c12fb){var _0x458bdf=this;return new Promise(function(_0x1b3704,_0x1d47e8){return db[_0xe4cc('0x17')]['update'](_0x5c12fb['body'],{'raw':_0x5c12fb['options']?_0x5c12fb[_0xe4cc('0x19')][_0xe4cc('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c12fb[_0xe4cc('0x19')]?_0x5c12fb[_0xe4cc('0x19')][_0xe4cc('0x1e')]||null:null,'attributes':_0x5c12fb['options']?_0x5c12fb[_0xe4cc('0x19')][_0xe4cc('0x1f')]||null:null,'limit':_0x5c12fb['options']?_0x5c12fb['options'][_0xe4cc('0x20')]||null:null})[_0xe4cc('0xd')](function(_0x3f8b8e){logger[_0xe4cc('0xe')](_0xe4cc('0x1d'),_0x5c12fb);logger[_0xe4cc('0x1c')](_0xe4cc('0x1d'),_0x5c12fb,JSON[_0xe4cc('0x12')](_0x3f8b8e));_0x1b3704(_0x3f8b8e);})[_0xe4cc('0x16')](function(_0x278176){logger[_0xe4cc('0x13')](_0xe4cc('0x1d'),_0x278176[_0xe4cc('0x14')],_0x5c12fb);_0x1d47e8(_0x458bdf['error'](0x1f4,_0x278176[_0xe4cc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 389ad7c..6b254c0 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 _0x9d01=['util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x8276f2,_0x4024aa){var _0x3c5da0=function(_0x499443){while(--_0x499443){_0x8276f2['push'](_0x8276f2['shift']());}};_0x3c5da0(++_0x4024aa);}(_0x9d01,0xe4));var _0x19d0=function(_0x282a1e,_0x4dd4db){_0x282a1e=_0x282a1e-0x0;var _0x460b6c=_0x9d01[_0x282a1e];return _0x460b6c;};'use strict';var multer=require('multer');var util=require(_0x19d0('0x0'));var path=require('path');var timeout=require(_0x19d0('0x1'));var express=require(_0x19d0('0x2'));var router=express[_0x19d0('0x3')]();var fs_extra=require(_0x19d0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x19d0('0x5'));var config=require(_0x19d0('0x6'));var controller=require('./squareReportDetail.controller');router[_0x19d0('0x7')]('/',auth['isAuthenticated'](),controller[_0x19d0('0x8')]);router['get']('/describe',auth[_0x19d0('0x9')](),controller[_0x19d0('0xa')]);router[_0x19d0('0x7')](_0x19d0('0xb'),auth[_0x19d0('0x9')](),controller['show']);router[_0x19d0('0xc')]('/',auth[_0x19d0('0x9')](),controller[_0x19d0('0xd')]);router[_0x19d0('0xe')](_0x19d0('0xb'),auth['isAuthenticated'](),controller[_0x19d0('0xf')]);router[_0x19d0('0x10')](_0x19d0('0xb'),auth['isAuthenticated'](),controller[_0x19d0('0x11')]);module[_0x19d0('0x12')]=router; \ No newline at end of file +var _0x7f35=['../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x49b28d,_0x1711e1){var _0x5ce585=function(_0x2b2064){while(--_0x2b2064){_0x49b28d['push'](_0x49b28d['shift']());}};_0x5ce585(++_0x1711e1);}(_0x7f35,0x1b1));var _0x57f3=function(_0x23ffe1,_0x395388){_0x23ffe1=_0x23ffe1-0x0;var _0x55e0da=_0x7f35[_0x23ffe1];return _0x55e0da;};'use strict';var multer=require(_0x57f3('0x0'));var util=require(_0x57f3('0x1'));var path=require(_0x57f3('0x2'));var timeout=require(_0x57f3('0x3'));var express=require(_0x57f3('0x4'));var router=express[_0x57f3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x57f3('0x6'));var interaction=require(_0x57f3('0x7'));var config=require(_0x57f3('0x8'));var controller=require('./squareReportDetail.controller');router['get']('/',auth[_0x57f3('0x9')](),controller[_0x57f3('0xa')]);router[_0x57f3('0xb')](_0x57f3('0xc'),auth[_0x57f3('0x9')](),controller[_0x57f3('0xd')]);router['get'](_0x57f3('0xe'),auth[_0x57f3('0x9')](),controller[_0x57f3('0xf')]);router[_0x57f3('0x10')]('/',auth[_0x57f3('0x9')](),controller[_0x57f3('0x11')]);router['put'](_0x57f3('0xe'),auth[_0x57f3('0x9')](),controller[_0x57f3('0x12')]);router[_0x57f3('0x13')](_0x57f3('0xe'),auth[_0x57f3('0x9')](),controller['destroy']);module[_0x57f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index c9a1891..edfaff8 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 _0x6b9b=['sequelize','exports','STRING'];(function(_0x1936cc,_0x81e11){var _0x5d227a=function(_0x11eb8b){while(--_0x11eb8b){_0x1936cc['push'](_0x1936cc['shift']());}};_0x5d227a(++_0x81e11);}(_0x6b9b,0x156));var _0xb6b9=function(_0xaaddf6,_0x57eb6f){_0xaaddf6=_0xaaddf6-0x0;var _0xed0b7f=_0x6b9b[_0xaaddf6];return _0xed0b7f;};'use strict';var Sequelize=require(_0xb6b9('0x0'));module[_0xb6b9('0x1')]={'uniqueid':{'type':Sequelize[_0xb6b9('0x2')]},'node':{'type':Sequelize[_0xb6b9('0x2')]},'application':{'type':Sequelize[_0xb6b9('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xb6b9('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0c0c=['STRING','exports'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x0c0c,0x159));var _0xc0c0=function(_0x25044f,_0x2fbc22){_0x25044f=_0x25044f-0x0;var _0x464afe=_0x0c0c[_0x25044f];return _0x464afe;};'use strict';var Sequelize=require('sequelize');module[_0xc0c0('0x0')]={'uniqueid':{'type':Sequelize[_0xc0c0('0x1')]},'node':{'type':Sequelize[_0xc0c0('0x1')]},'application':{'type':Sequelize[_0xc0c0('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xc0c0('0x1')]},'callerid':{'type':Sequelize[_0xc0c0('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index aa9d30e..e24fdca 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 _0x1409=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','SquareDetailsReport','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','show','params','find','create','body','describe'];(function(_0x556720,_0x13ded5){var _0x11a0ea=function(_0x5812fc){while(--_0x5812fc){_0x556720['push'](_0x556720['shift']());}};_0x11a0ea(++_0x13ded5);}(_0x1409,0x1e6));var _0x9140=function(_0x392a4e,_0x29d79c){_0x392a4e=_0x392a4e-0x0;var _0x1b9e27=_0x1409[_0x392a4e];return _0x1b9e27;};'use strict';var emlformat=require(_0x9140('0x0'));var rimraf=require(_0x9140('0x1'));var zipdir=require(_0x9140('0x2'));var jsonpatch=require(_0x9140('0x3'));var rp=require(_0x9140('0x4'));var moment=require(_0x9140('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9140('0x6'));var path=require(_0x9140('0x7'));var sox=require('sox');var csv=require(_0x9140('0x8'));var ejs=require(_0x9140('0x9'));var fs=require('fs');var fs_extra=require(_0x9140('0xa'));var _=require(_0x9140('0xb'));var squel=require(_0x9140('0xc'));var crypto=require(_0x9140('0xd'));var jsforce=require(_0x9140('0xe'));var deskjs=require(_0x9140('0xf'));var toCsv=require(_0x9140('0x8'));var querystring=require(_0x9140('0x10'));var Papa=require(_0x9140('0x11'));var Redis=require(_0x9140('0x12'));var authService=require(_0x9140('0x13'));var qs=require(_0x9140('0x14'));var as=require(_0x9140('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9140('0x16'))(_0x9140('0x17'));var utils=require(_0x9140('0x18'));var config=require(_0x9140('0x19'));var licenseUtil=require(_0x9140('0x1a'));var db=require(_0x9140('0x1b'))['db'];function respondWithStatusCode(_0xc363ce,_0x57466b){_0x57466b=_0x57466b||0xcc;return function(_0x2a9961){if(_0x2a9961){return _0xc363ce[_0x9140('0x1c')](_0x57466b);}return _0xc363ce[_0x9140('0x1d')](_0x57466b)[_0x9140('0x1e')]();};}function respondWithResult(_0x2ffe69,_0x1aed0f){_0x1aed0f=_0x1aed0f||0xc8;return function(_0x4811fd){if(_0x4811fd){return _0x2ffe69[_0x9140('0x1d')](_0x1aed0f)[_0x9140('0x1f')](_0x4811fd);}};}function respondWithFilteredResult(_0x590ea8,_0x450417){return function(_0x4f8291){if(_0x4f8291){var _0xe07181=typeof _0x450417[_0x9140('0x20')]===_0x9140('0x21')&&typeof _0x450417[_0x9140('0x22')]===_0x9140('0x21');var _0x7489e2=_0x4f8291[_0x9140('0x23')];var _0x30452c=_0xe07181?0x0:_0x450417[_0x9140('0x20')];var _0x8bb9ac=_0xe07181?_0x4f8291['count']:_0x450417[_0x9140('0x20')]+_0x450417['limit'];var _0x54618a;if(_0x8bb9ac>=_0x7489e2){_0x8bb9ac=_0x7489e2;_0x54618a=0xc8;}else{_0x54618a=0xce;}_0x590ea8['status'](_0x54618a);return _0x590ea8[_0x9140('0x24')](_0x9140('0x25'),_0x30452c+'-'+_0x8bb9ac+'/'+_0x7489e2)[_0x9140('0x1f')](_0x4f8291);}return null;};}function patchUpdates(_0x59eb2a){return function(_0x72f6e4){try{jsonpatch[_0x9140('0x26')](_0x72f6e4,_0x59eb2a,!![]);}catch(_0x5bd69e){return BPromise[_0x9140('0x27')](_0x5bd69e);}return _0x72f6e4[_0x9140('0x28')]();};}function saveUpdates(_0x35efdd,_0xb1a08e){return function(_0x17a29c){if(_0x17a29c){return _0x17a29c[_0x9140('0x29')](_0x35efdd)[_0x9140('0x2a')](function(_0x5ec67e){return _0x5ec67e;});}return null;};}function removeEntity(_0x4ec0e8,_0x500c38){return function(_0x14e2ec){if(_0x14e2ec){return _0x14e2ec[_0x9140('0x2b')]()[_0x9140('0x2a')](function(){_0x4ec0e8['status'](0xcc)[_0x9140('0x1e')]();});}};}function handleEntityNotFound(_0x3797df,_0x3c3831){return function(_0x11d8e7){if(!_0x11d8e7){_0x3797df[_0x9140('0x1c')](0x194);}return _0x11d8e7;};}function handleError(_0x476e03,_0x526ad4){_0x526ad4=_0x526ad4||0x1f4;return function(_0x34624c){logger[_0x9140('0x2c')](_0x34624c[_0x9140('0x2d')]);if(_0x34624c[_0x9140('0x2e')]){delete _0x34624c[_0x9140('0x2e')];}_0x476e03['status'](_0x526ad4)[_0x9140('0x2f')](_0x34624c);};}exports[_0x9140('0x30')]=function(_0x58384a,_0x1293b5){var _0x1527be={},_0x2f5be4={},_0x106a87={'count':0x0,'rows':[]};var _0xe8cf34=_['map'](db[_0x9140('0x31')][_0x9140('0x32')],function(_0x5a2bdb){return{'name':_0x5a2bdb[_0x9140('0x33')],'type':_0x5a2bdb[_0x9140('0x34')]['key']};});_0x2f5be4[_0x9140('0x35')]=_[_0x9140('0x36')](_0xe8cf34,'name');_0x2f5be4['query']=_['keys'](_0x58384a[_0x9140('0x37')]);_0x2f5be4[_0x9140('0x38')]=_[_0x9140('0x39')](_0x2f5be4[_0x9140('0x35')],_0x2f5be4[_0x9140('0x37')]);_0x1527be[_0x9140('0x3a')]=_[_0x9140('0x39')](_0x2f5be4[_0x9140('0x35')],qs['fields'](_0x58384a['query'][_0x9140('0x3b')]));_0x1527be[_0x9140('0x3a')]=_0x1527be[_0x9140('0x3a')][_0x9140('0x3c')]?_0x1527be[_0x9140('0x3a')]:_0x2f5be4['model'];if(!_0x58384a[_0x9140('0x37')][_0x9140('0x3d')](_0x9140('0x3e'))){_0x1527be[_0x9140('0x22')]=qs['limit'](_0x58384a[_0x9140('0x37')][_0x9140('0x22')]);_0x1527be[_0x9140('0x20')]=qs[_0x9140('0x20')](_0x58384a[_0x9140('0x37')][_0x9140('0x20')]);}_0x1527be[_0x9140('0x3f')]=qs[_0x9140('0x40')](_0x58384a[_0x9140('0x37')]['sort']);_0x1527be[_0x9140('0x41')]=qs['filters'](_[_0x9140('0x42')](_0x58384a[_0x9140('0x37')],_0x2f5be4[_0x9140('0x38')]),_0xe8cf34);if(_0x58384a[_0x9140('0x37')][_0x9140('0x43')]){_0x1527be[_0x9140('0x41')]=_['merge'](_0x1527be[_0x9140('0x41')],{'$or':_[_0x9140('0x36')](_0xe8cf34,function(_0xcb299e){if(_0xcb299e[_0x9140('0x34')]!==_0x9140('0x44')){var _0x211c0e={};_0x211c0e[_0xcb299e[_0x9140('0x2e')]]={'$like':'%'+_0x58384a[_0x9140('0x37')][_0x9140('0x43')]+'%'};return _0x211c0e;}})});}_0x1527be=_[_0x9140('0x45')]({},_0x1527be,_0x58384a[_0x9140('0x46')]);var _0xed7044={'where':_0x1527be['where']};return db['SquareDetailsReport'][_0x9140('0x23')](_0xed7044)[_0x9140('0x2a')](function(_0x2ae285){_0x106a87[_0x9140('0x23')]=_0x2ae285;if(_0x58384a[_0x9140('0x37')][_0x9140('0x47')]){_0x1527be[_0x9140('0x48')]=[{'all':!![]}];}return db[_0x9140('0x31')][_0x9140('0x49')](_0x1527be);})[_0x9140('0x2a')](function(_0x17207a){_0x106a87['rows']=_0x17207a;return _0x106a87;})['then'](respondWithFilteredResult(_0x1293b5,_0x1527be))[_0x9140('0x4a')](handleError(_0x1293b5,null));};exports[_0x9140('0x4b')]=function(_0x2578fd,_0x4147fc){var _0x4055f2={'raw':!![],'where':{'id':_0x2578fd[_0x9140('0x4c')]['id']}},_0x57d33f={};_0x57d33f[_0x9140('0x35')]=_['keys'](db['SquareDetailsReport'][_0x9140('0x32')]);_0x57d33f[_0x9140('0x37')]=_['keys'](_0x2578fd[_0x9140('0x37')]);_0x57d33f[_0x9140('0x38')]=_['intersection'](_0x57d33f[_0x9140('0x35')],_0x57d33f['query']);_0x4055f2[_0x9140('0x3a')]=_['intersection'](_0x57d33f[_0x9140('0x35')],qs[_0x9140('0x3b')](_0x2578fd['query'][_0x9140('0x3b')]));_0x4055f2[_0x9140('0x3a')]=_0x4055f2[_0x9140('0x3a')][_0x9140('0x3c')]?_0x4055f2[_0x9140('0x3a')]:_0x57d33f[_0x9140('0x35')];if(_0x2578fd[_0x9140('0x37')]['includeAll']){_0x4055f2[_0x9140('0x48')]=[{'all':!![]}];}_0x4055f2=_['merge']({},_0x4055f2,_0x2578fd['options']);return db[_0x9140('0x31')][_0x9140('0x4d')](_0x4055f2)[_0x9140('0x2a')](handleEntityNotFound(_0x4147fc,null))[_0x9140('0x2a')](respondWithResult(_0x4147fc,null))[_0x9140('0x4a')](handleError(_0x4147fc,null));};exports['create']=function(_0x47292e,_0x5029e5){return db[_0x9140('0x31')][_0x9140('0x4e')](_0x47292e[_0x9140('0x4f')],{})[_0x9140('0x2a')](respondWithResult(_0x5029e5,0xc9))['catch'](handleError(_0x5029e5,null));};exports['update']=function(_0x346900,_0x9606e4){if(_0x346900[_0x9140('0x4f')]['id']){delete _0x346900[_0x9140('0x4f')]['id'];}return db['SquareDetailsReport'][_0x9140('0x4d')]({'where':{'id':_0x346900['params']['id']}})[_0x9140('0x2a')](handleEntityNotFound(_0x9606e4,null))['then'](saveUpdates(_0x346900[_0x9140('0x4f')],null))[_0x9140('0x2a')](respondWithResult(_0x9606e4,null))[_0x9140('0x4a')](handleError(_0x9606e4,null));};exports[_0x9140('0x2b')]=function(_0x52d5b7,_0xa8ef8b){return db[_0x9140('0x31')]['find']({'where':{'id':_0x52d5b7[_0x9140('0x4c')]['id']}})[_0x9140('0x2a')](handleEntityNotFound(_0xa8ef8b,null))[_0x9140('0x2a')](removeEntity(_0xa8ef8b,null))['catch'](handleError(_0xa8ef8b,null));};exports[_0x9140('0x50')]=function(_0x48a316,_0x1be9ed){return db[_0x9140('0x31')][_0x9140('0x50')]()[_0x9140('0x2a')](respondWithResult(_0x1be9ed,null))[_0x9140('0x4a')](handleError(_0x1be9ed,null));}; \ No newline at end of file +var _0x12b5=['util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','SquareDetailsReport','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x40f9a0,_0x3458cc){var _0x3e3144=function(_0x1f8fce){while(--_0x1f8fce){_0x40f9a0['push'](_0x40f9a0['shift']());}};_0x3e3144(++_0x3458cc);}(_0x12b5,0x129));var _0x512b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x12b5[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x512b('0x0'));var rimraf=require(_0x512b('0x1'));var zipdir=require(_0x512b('0x2'));var jsonpatch=require(_0x512b('0x3'));var rp=require(_0x512b('0x4'));var moment=require(_0x512b('0x5'));var BPromise=require(_0x512b('0x6'));var Mustache=require('mustache');var util=require(_0x512b('0x7'));var path=require(_0x512b('0x8'));var sox=require(_0x512b('0x9'));var csv=require(_0x512b('0xa'));var ejs=require(_0x512b('0xb'));var fs=require('fs');var fs_extra=require(_0x512b('0xc'));var _=require(_0x512b('0xd'));var squel=require(_0x512b('0xe'));var crypto=require(_0x512b('0xf'));var jsforce=require(_0x512b('0x10'));var deskjs=require(_0x512b('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x512b('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x512b('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x512b('0x14'))(_0x512b('0x15'));var utils=require(_0x512b('0x16'));var config=require(_0x512b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x512b('0x18'))['db'];function respondWithStatusCode(_0x1004eb,_0x4d3413){_0x4d3413=_0x4d3413||0xcc;return function(_0x1664c8){if(_0x1664c8){return _0x1004eb[_0x512b('0x19')](_0x4d3413);}return _0x1004eb[_0x512b('0x1a')](_0x4d3413)[_0x512b('0x1b')]();};}function respondWithResult(_0x57c36d,_0x31a170){_0x31a170=_0x31a170||0xc8;return function(_0x3f2c51){if(_0x3f2c51){return _0x57c36d['status'](_0x31a170)[_0x512b('0x1c')](_0x3f2c51);}};}function respondWithFilteredResult(_0x1f0bd1,_0x46b0ee){return function(_0x2a364b){if(_0x2a364b){var _0x2a1dfc=typeof _0x46b0ee[_0x512b('0x1d')]===_0x512b('0x1e')&&typeof _0x46b0ee[_0x512b('0x1f')]==='undefined';var _0x41e2e9=_0x2a364b[_0x512b('0x20')];var _0x76247e=_0x2a1dfc?0x0:_0x46b0ee[_0x512b('0x1d')];var _0x2528de=_0x2a1dfc?_0x2a364b['count']:_0x46b0ee[_0x512b('0x1d')]+_0x46b0ee[_0x512b('0x1f')];var _0x2a541f;if(_0x2528de>=_0x41e2e9){_0x2528de=_0x41e2e9;_0x2a541f=0xc8;}else{_0x2a541f=0xce;}_0x1f0bd1['status'](_0x2a541f);return _0x1f0bd1[_0x512b('0x21')](_0x512b('0x22'),_0x76247e+'-'+_0x2528de+'/'+_0x41e2e9)[_0x512b('0x1c')](_0x2a364b);}return null;};}function patchUpdates(_0x5168ee){return function(_0x1879bb){try{jsonpatch[_0x512b('0x23')](_0x1879bb,_0x5168ee,!![]);}catch(_0x4d8a80){return BPromise['reject'](_0x4d8a80);}return _0x1879bb[_0x512b('0x24')]();};}function saveUpdates(_0x3ad3f2,_0xc2fd8a){return function(_0x35105b){if(_0x35105b){return _0x35105b[_0x512b('0x25')](_0x3ad3f2)[_0x512b('0x26')](function(_0x14ee5a){return _0x14ee5a;});}return null;};}function removeEntity(_0x263482,_0x4dda1c){return function(_0x15f994){if(_0x15f994){return _0x15f994[_0x512b('0x27')]()[_0x512b('0x26')](function(){_0x263482[_0x512b('0x1a')](0xcc)[_0x512b('0x1b')]();});}};}function handleEntityNotFound(_0x227b7,_0x302f3d){return function(_0x418ed4){if(!_0x418ed4){_0x227b7[_0x512b('0x19')](0x194);}return _0x418ed4;};}function handleError(_0x2cea62,_0x151074){_0x151074=_0x151074||0x1f4;return function(_0x3c4890){logger[_0x512b('0x28')](_0x3c4890['stack']);if(_0x3c4890[_0x512b('0x29')]){delete _0x3c4890[_0x512b('0x29')];}_0x2cea62[_0x512b('0x1a')](_0x151074)[_0x512b('0x2a')](_0x3c4890);};}exports[_0x512b('0x2b')]=function(_0x225aba,_0x787333){var _0x466f1a={},_0x41f7ab={},_0x336151={'count':0x0,'rows':[]};var _0x86a6f0=_[_0x512b('0x2c')](db['SquareDetailsReport'][_0x512b('0x2d')],function(_0x4467cf){return{'name':_0x4467cf[_0x512b('0x2e')],'type':_0x4467cf[_0x512b('0x2f')]['key']};});_0x41f7ab['model']=_[_0x512b('0x2c')](_0x86a6f0,_0x512b('0x29'));_0x41f7ab[_0x512b('0x30')]=_[_0x512b('0x31')](_0x225aba[_0x512b('0x30')]);_0x41f7ab[_0x512b('0x32')]=_[_0x512b('0x33')](_0x41f7ab[_0x512b('0x34')],_0x41f7ab[_0x512b('0x30')]);_0x466f1a[_0x512b('0x35')]=_['intersection'](_0x41f7ab[_0x512b('0x34')],qs[_0x512b('0x36')](_0x225aba[_0x512b('0x30')][_0x512b('0x36')]));_0x466f1a[_0x512b('0x35')]=_0x466f1a['attributes'][_0x512b('0x37')]?_0x466f1a[_0x512b('0x35')]:_0x41f7ab['model'];if(!_0x225aba[_0x512b('0x30')][_0x512b('0x38')](_0x512b('0x39'))){_0x466f1a[_0x512b('0x1f')]=qs[_0x512b('0x1f')](_0x225aba[_0x512b('0x30')][_0x512b('0x1f')]);_0x466f1a[_0x512b('0x1d')]=qs[_0x512b('0x1d')](_0x225aba[_0x512b('0x30')][_0x512b('0x1d')]);}_0x466f1a[_0x512b('0x3a')]=qs[_0x512b('0x3b')](_0x225aba['query']['sort']);_0x466f1a['where']=qs['filters'](_[_0x512b('0x3c')](_0x225aba['query'],_0x41f7ab[_0x512b('0x32')]),_0x86a6f0);if(_0x225aba['query'][_0x512b('0x3d')]){_0x466f1a[_0x512b('0x3e')]=_[_0x512b('0x3f')](_0x466f1a[_0x512b('0x3e')],{'$or':_[_0x512b('0x2c')](_0x86a6f0,function(_0x5e0d4f){if(_0x5e0d4f[_0x512b('0x2f')]!=='VIRTUAL'){var _0x4b1662={};_0x4b1662[_0x5e0d4f[_0x512b('0x29')]]={'$like':'%'+_0x225aba[_0x512b('0x30')][_0x512b('0x3d')]+'%'};return _0x4b1662;}})});}_0x466f1a=_[_0x512b('0x3f')]({},_0x466f1a,_0x225aba[_0x512b('0x40')]);var _0x3458db={'where':_0x466f1a[_0x512b('0x3e')]};return db['SquareDetailsReport'][_0x512b('0x20')](_0x3458db)[_0x512b('0x26')](function(_0x737786){_0x336151[_0x512b('0x20')]=_0x737786;if(_0x225aba[_0x512b('0x30')][_0x512b('0x41')]){_0x466f1a[_0x512b('0x42')]=[{'all':!![]}];}return db[_0x512b('0x43')][_0x512b('0x44')](_0x466f1a);})[_0x512b('0x26')](function(_0xaf8317){_0x336151[_0x512b('0x45')]=_0xaf8317;return _0x336151;})[_0x512b('0x26')](respondWithFilteredResult(_0x787333,_0x466f1a))[_0x512b('0x46')](handleError(_0x787333,null));};exports['show']=function(_0x528bc3,_0x24d17e){var _0x478709={'raw':!![],'where':{'id':_0x528bc3[_0x512b('0x47')]['id']}},_0x599103={};_0x599103['model']=_[_0x512b('0x31')](db[_0x512b('0x43')]['rawAttributes']);_0x599103[_0x512b('0x30')]=_['keys'](_0x528bc3[_0x512b('0x30')]);_0x599103['filters']=_[_0x512b('0x33')](_0x599103[_0x512b('0x34')],_0x599103['query']);_0x478709['attributes']=_[_0x512b('0x33')](_0x599103['model'],qs[_0x512b('0x36')](_0x528bc3[_0x512b('0x30')][_0x512b('0x36')]));_0x478709['attributes']=_0x478709[_0x512b('0x35')]['length']?_0x478709[_0x512b('0x35')]:_0x599103[_0x512b('0x34')];if(_0x528bc3[_0x512b('0x30')][_0x512b('0x41')]){_0x478709[_0x512b('0x42')]=[{'all':!![]}];}_0x478709=_['merge']({},_0x478709,_0x528bc3[_0x512b('0x40')]);return db['SquareDetailsReport'][_0x512b('0x48')](_0x478709)[_0x512b('0x26')](handleEntityNotFound(_0x24d17e,null))[_0x512b('0x26')](respondWithResult(_0x24d17e,null))[_0x512b('0x46')](handleError(_0x24d17e,null));};exports['create']=function(_0x28784d,_0x97f5f2){return db[_0x512b('0x43')][_0x512b('0x49')](_0x28784d[_0x512b('0x4a')],{})[_0x512b('0x26')](respondWithResult(_0x97f5f2,0xc9))[_0x512b('0x46')](handleError(_0x97f5f2,null));};exports[_0x512b('0x25')]=function(_0x3e1fe1,_0x11a190){if(_0x3e1fe1[_0x512b('0x4a')]['id']){delete _0x3e1fe1[_0x512b('0x4a')]['id'];}return db[_0x512b('0x43')][_0x512b('0x48')]({'where':{'id':_0x3e1fe1[_0x512b('0x47')]['id']}})[_0x512b('0x26')](handleEntityNotFound(_0x11a190,null))['then'](saveUpdates(_0x3e1fe1[_0x512b('0x4a')],null))[_0x512b('0x26')](respondWithResult(_0x11a190,null))[_0x512b('0x46')](handleError(_0x11a190,null));};exports[_0x512b('0x27')]=function(_0x34146a,_0x538e01){return db['SquareDetailsReport'][_0x512b('0x48')]({'where':{'id':_0x34146a[_0x512b('0x47')]['id']}})[_0x512b('0x26')](handleEntityNotFound(_0x538e01,null))[_0x512b('0x26')](removeEntity(_0x538e01,null))[_0x512b('0x46')](handleError(_0x538e01,null));};exports[_0x512b('0x4b')]=function(_0x4a7c97,_0x145e12){return db[_0x512b('0x43')][_0x512b('0x4b')]()[_0x512b('0x26')](respondWithResult(_0x145e12,null))[_0x512b('0x46')](handleError(_0x145e12,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index a98a282..0651f8b 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 _0x253d=['report_square_details','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./squareReportDetail.attributes','define','SquareDetailsReport'];(function(_0x2136a6,_0x35af63){var _0x55b948=function(_0x288a75){while(--_0x288a75){_0x2136a6['push'](_0x2136a6['shift']());}};_0x55b948(++_0x35af63);}(_0x253d,0x112));var _0xd253=function(_0x599e89,_0xe66eb1){_0x599e89=_0x599e89-0x0;var _0x2f74d6=_0x253d[_0x599e89];return _0x2f74d6;};'use strict';var _=require(_0xd253('0x0'));var util=require(_0xd253('0x1'));var logger=require(_0xd253('0x2'))(_0xd253('0x3'));var moment=require(_0xd253('0x4'));var BPromise=require(_0xd253('0x5'));var rp=require(_0xd253('0x6'));var fs=require('fs');var path=require(_0xd253('0x7'));var rimraf=require(_0xd253('0x8'));var config=require('../../config/environment');var attributes=require(_0xd253('0x9'));module['exports']=function(_0x4209b0,_0x22da63){return _0x4209b0[_0xd253('0xa')](_0xd253('0xb'),attributes,{'tableName':_0xd253('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9af=['request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xa9af,0xcb));var _0xfa9a=function(_0x35f9d4,_0x5dea15){_0x35f9d4=_0x35f9d4-0x0;var _0xfbbb29=_0xa9af[_0x35f9d4];return _0xfbbb29;};'use strict';var _=require(_0xfa9a('0x0'));var util=require(_0xfa9a('0x1'));var logger=require(_0xfa9a('0x2'))(_0xfa9a('0x3'));var moment=require('moment');var BPromise=require(_0xfa9a('0x4'));var rp=require(_0xfa9a('0x5'));var fs=require('fs');var path=require(_0xfa9a('0x6'));var rimraf=require(_0xfa9a('0x7'));var config=require(_0xfa9a('0x8'));var attributes=require(_0xfa9a('0x9'));module['exports']=function(_0x217b82,_0x172488){return _0x217b82[_0xfa9a('0xa')](_0xfa9a('0xb'),attributes,{'tableName':_0xfa9a('0xc'),'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 120ae76..4f7eaaa 100644 --- a/server/api/squareReportDetail/squareReportDetail.rpc.js +++ b/server/api/squareReportDetail/squareReportDetail.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbbbc=['options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','error','message','result','catch','CreateSquareDetailsReport','create','body'];(function(_0x23ce16,_0x42bb0b){var _0x3ae29e=function(_0x3bb262){while(--_0x3bb262){_0x23ce16['push'](_0x23ce16['shift']());}};_0x3ae29e(++_0x42bb0b);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x19f5ad,_0xb7bc88){_0x19f5ad=_0x19f5ad-0x0;var _0x3c1507=_0xbbbc[_0x19f5ad];return _0x3c1507;};'use strict';var _=require(_0xcbbb('0x0'));var util=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));var BPromise=require(_0xcbbb('0x3'));var rs=require(_0xcbbb('0x4'));var fs=require('fs');var Redis=require(_0xcbbb('0x5'));var db=require(_0xcbbb('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xcbbb('0x7'))(_0xcbbb('0x8'));var config=require(_0xcbbb('0x9'));var jayson=require(_0xcbbb('0xa'));var client=jayson[_0xcbbb('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x388197,_0x1796b4,_0x32ec9c){return new BPromise(function(_0x6f4fd8,_0x356249){return client[_0xcbbb('0xc')](_0x388197,_0x32ec9c)[_0xcbbb('0xd')](function(_0x4ec90a){logger[_0xcbbb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,'request\x20sent');logger[_0xcbbb('0xf')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'),JSON['stringify'](_0x4ec90a));if(_0x4ec90a[_0xcbbb('0x11')]){if(_0x4ec90a[_0xcbbb('0x11')]['code']===0x1f4){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')]['message']);return _0x356249(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);return _0x6f4fd8(_0x4ec90a[_0xcbbb('0x11')][_0xcbbb('0x12')]);}else{logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0xcbbb('0x10'));_0x6f4fd8(_0x4ec90a[_0xcbbb('0x13')][_0xcbbb('0x12')]);}})[_0xcbbb('0x14')](function(_0x5e25ca){logger[_0xcbbb('0x11')]('SquareDetailsReport,\x20%s,\x20%s',_0x1796b4,_0x5e25ca);_0x356249(_0x5e25ca);});});}exports[_0xcbbb('0x15')]=function(_0x3436af){var _0x3572bb=this;return new Promise(function(_0x5052df,_0x57c5e9){return db['SquareDetailsReport'][_0xcbbb('0x16')](_0x3436af[_0xcbbb('0x17')],{'raw':_0x3436af[_0xcbbb('0x18')]?_0x3436af[_0xcbbb('0x18')][_0xcbbb('0x19')]===undefined?!![]:![]:!![]})[_0xcbbb('0xd')](function(_0x45de5f){logger[_0xcbbb('0xe')](_0xcbbb('0x15'),_0x3436af);logger[_0xcbbb('0xf')]('CreateSquareDetailsReport',_0x3436af,JSON[_0xcbbb('0x1a')](_0x45de5f));_0x5052df(_0x45de5f);})[_0xcbbb('0x14')](function(_0x159c62){logger[_0xcbbb('0x11')](_0xcbbb('0x15'),_0x159c62[_0xcbbb('0x12')],_0x3436af);_0x57c5e9(_0x3572bb[_0xcbbb('0x11')](0x1f4,_0x159c62[_0xcbbb('0x12')]));});});}; \ No newline at end of file +var _0x3f8c=['code','message','result','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','catch','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x12bd1e,_0x17a330){var _0x5caaeb=function(_0x172ae2){while(--_0x172ae2){_0x12bd1e['push'](_0x12bd1e['shift']());}};_0x5caaeb(++_0x17a330);}(_0x3f8c,0x104));var _0xc3f8=function(_0x5d15e9,_0x4b08be){_0x5d15e9=_0x5d15e9-0x0;var _0x43ef90=_0x3f8c[_0x5d15e9];return _0x43ef90;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x44c25d,_0x2bbaa5,_0x15512a){return new BPromise(function(_0x51093a,_0x28397e){return client[_0xc3f8('0x7')](_0x44c25d,_0x15512a)[_0xc3f8('0x8')](function(_0x3c340c){logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));logger['debug'](_0xc3f8('0xc'),_0x2bbaa5,_0xc3f8('0xb'),JSON[_0xc3f8('0xd')](_0x3c340c));if(_0x3c340c[_0xc3f8('0xe')]){if(_0x3c340c['error'][_0xc3f8('0xf')]===0x1f4){logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')]['message']);return _0x28397e(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}logger[_0xc3f8('0xe')](_0xc3f8('0xa'),_0x2bbaa5,_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);return _0x51093a(_0x3c340c[_0xc3f8('0xe')][_0xc3f8('0x10')]);}else{logger[_0xc3f8('0x9')](_0xc3f8('0xa'),_0x2bbaa5,_0xc3f8('0xb'));_0x51093a(_0x3c340c[_0xc3f8('0x11')][_0xc3f8('0x10')]);}})['catch'](function(_0x14b3ed){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2bbaa5,_0x14b3ed);_0x28397e(_0x14b3ed);});});}exports[_0xc3f8('0x12')]=function(_0x2e7c0f){var _0x35500f=this;return new Promise(function(_0xb4ab67,_0x47a185){return db[_0xc3f8('0x13')][_0xc3f8('0x14')](_0x2e7c0f['body'],{'raw':_0x2e7c0f[_0xc3f8('0x15')]?_0x2e7c0f['options'][_0xc3f8('0x16')]===undefined?!![]:![]:!![]})[_0xc3f8('0x8')](function(_0x3b2e98){logger['info']('CreateSquareDetailsReport',_0x2e7c0f);logger[_0xc3f8('0x17')](_0xc3f8('0x12'),_0x2e7c0f,JSON[_0xc3f8('0xd')](_0x3b2e98));_0xb4ab67(_0x3b2e98);})[_0xc3f8('0x18')](function(_0x6522e9){logger[_0xc3f8('0xe')](_0xc3f8('0x12'),_0x6522e9[_0xc3f8('0x10')],_0x2e7c0f);_0x47a185(_0x35500f['error'](0x1f4,_0x6522e9['message']));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 323b77f..86583a6 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 _0x7f3c=['./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express'];(function(_0x2853d9,_0x2c00e5){var _0x82a50a=function(_0xdcb37b){while(--_0xdcb37b){_0x2853d9['push'](_0x2853d9['shift']());}};_0x82a50a(++_0x2c00e5);}(_0x7f3c,0x16f));var _0xc7f3=function(_0x16ecad,_0x205047){_0x16ecad=_0x16ecad-0x0;var _0x313ff7=_0x7f3c[_0x16ecad];return _0x313ff7;};'use strict';var express=require(_0xc7f3('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xc7f3('0x1'));router[_0xc7f3('0x2')]('/',auth['isAuthenticated'](),controller[_0xc7f3('0x3')]);router[_0xc7f3('0x2')](_0xc7f3('0x4'),auth[_0xc7f3('0x5')](),controller[_0xc7f3('0x6')]);module[_0xc7f3('0x7')]=router; \ No newline at end of file +var _0x51b8=['get','killProcess','exports','express','Router','../../components/auth/service','./system.controller','isAuthenticated'];(function(_0x5d8018,_0x588592){var _0x151ac4=function(_0x548679){while(--_0x548679){_0x5d8018['push'](_0x5d8018['shift']());}};_0x151ac4(++_0x588592);}(_0x51b8,0x1eb));var _0x851b=function(_0xe9d604,_0x573d49){_0xe9d604=_0xe9d604-0x0;var _0x2d6709=_0x51b8[_0xe9d604];return _0x2d6709;};'use strict';var express=require(_0x851b('0x0'));var router=express[_0x851b('0x1')]();var auth=require(_0x851b('0x2'));var controller=require(_0x851b('0x3'));router['get']('/',auth[_0x851b('0x4')](),controller['index']);router[_0x851b('0x5')]('/process/:pid/kill',auth[_0x851b('0x4')](),controller[_0x851b('0x6')]);module[_0x851b('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index f886465..c895127 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 _0x643d=['send','index','getAllData','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','status'];(function(_0x36d1f1,_0x1410f3){var _0x8f4c70=function(_0x59ab3f){while(--_0x59ab3f){_0x36d1f1['push'](_0x36d1f1['shift']());}};_0x8f4c70(++_0x1410f3);}(_0x643d,0xdd));var _0xd643=function(_0x4ae5b9,_0x4a42d2){_0x4ae5b9=_0x4ae5b9-0x0;var _0x3f94f4=_0x643d[_0x4ae5b9];return _0x3f94f4;};'use strict';var info=require(_0xd643('0x0'));var exec=require(_0xd643('0x1'))[_0xd643('0x2')];var logger=require(_0xd643('0x3'))('api');var util=require(_0xd643('0x4'));var BPromise=require(_0xd643('0x5'));var _=require(_0xd643('0x6'));function handleError(_0x3e5803,_0xa8e2b4,_0x19c328){_0xa8e2b4=_0xa8e2b4||0x1f4;return function(_0x42ee63){logger[_0xd643('0x7')](_0xd643('0x8'),_0x19c328,_0xa8e2b4,util[_0xd643('0x9')](_0x42ee63,{'showHidden':![],'depth':null}));delete _0x42ee63['name'];_0x3e5803[_0xd643('0xa')](_0xa8e2b4)[_0xd643('0xb')](_0x42ee63);};}exports[_0xd643('0xc')]=function(_0x571435,_0x2529e8){return info[_0xd643('0xd')]()[_0xd643('0xe')](function(_0x47e793){return _0x2529e8[_0xd643('0xa')](0xc8)[_0xd643('0xf')](_0x47e793);})[_0xd643('0x10')](function(_0x1e5614){return _0x2529e8[_0xd643('0xa')](0x1f4)['json'](_0x1e5614);});};exports[_0xd643('0x11')]=function(_0x3679aa,_0x2b8094){var _0x286086=[_0xd643('0x12')];return new BPromise(function(_0x35d857,_0x26fcb1){return exec(util[_0xd643('0x13')](_0xd643('0x14'),_0x3679aa['params'][_0xd643('0x15')]),function(_0x419e33,_0x3c1314,_0xdd433e){if(_0x419e33){return _0x26fcb1(_0x419e33);}return _0x35d857(_0x3c1314);});})[_0xd643('0xe')](function(_0x2aa5d4){var _0x5c6d3b=![];var _0x5993d=_0x2aa5d4[_0xd643('0x16')](/\n/);for(var _0x55bab7=0x0,_0x3060bf=_0x286086[_0xd643('0x17')];_0x55bab7<_0x3060bf,_0x5c6d3b===![];_0x55bab7+=0x1){if(_0x2aa5d4[_0xd643('0x18')](_0x286086[_0x55bab7])>=0x0){_0x5c6d3b=!![];}}if(!_0x5c6d3b){throw new Error(util['format'](_0xd643('0x19'),_0x3679aa[_0xd643('0x1a')][_0xd643('0x15')]));}process['kill'](_0x3679aa['params'][_0xd643('0x15')],_0xd643('0x1b'));return _0x2b8094[_0xd643('0xa')](0xc8)['json']({'message':util['format'](_0xd643('0x1c'),_0x3679aa[_0xd643('0x1a')]['pid'])});})['catch'](handleError(_0x2b8094,null,'killProcess'));}; \ No newline at end of file +var _0x575c=['name','status','send','index','then','json','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','killProcess','systeminformation','child_process','api','util','lodash','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0x575c,0x96));var _0xc575=function(_0x2c62c9,_0x2293bc){_0x2c62c9=_0x2c62c9-0x0;var _0x1c6cbe=_0x575c[_0x2c62c9];return _0x1c6cbe;};'use strict';var info=require(_0xc575('0x0'));var exec=require(_0xc575('0x1'))['exec'];var logger=require('../../config/logger')(_0xc575('0x2'));var util=require(_0xc575('0x3'));var BPromise=require('bluebird');var _=require(_0xc575('0x4'));function handleError(_0x18599d,_0x5b2a9d,_0x54f76a){_0x5b2a9d=_0x5b2a9d||0x1f4;return function(_0x3b1e61){logger['error'](_0xc575('0x5'),_0x54f76a,_0x5b2a9d,util['inspect'](_0x3b1e61,{'showHidden':![],'depth':null}));delete _0x3b1e61[_0xc575('0x6')];_0x18599d[_0xc575('0x7')](_0x5b2a9d)[_0xc575('0x8')](_0x3b1e61);};}exports[_0xc575('0x9')]=function(_0xb55f4,_0x533883){return info['getAllData']()[_0xc575('0xa')](function(_0x4edf68){return _0x533883[_0xc575('0x7')](0xc8)[_0xc575('0xb')](_0x4edf68);})['catch'](function(_0x361a1b){return _0x533883[_0xc575('0x7')](0x1f4)[_0xc575('0xb')](_0x361a1b);});};exports['killProcess']=function(_0x11820,_0x23e5b8){var _0x5eb967=[_0xc575('0xc')];return new BPromise(function(_0x58da00,_0x505119){return exec(util[_0xc575('0xd')](_0xc575('0xe'),_0x11820[_0xc575('0xf')][_0xc575('0x10')]),function(_0x33302c,_0x3dbf0e,_0x5ee113){if(_0x33302c){return _0x505119(_0x33302c);}return _0x58da00(_0x3dbf0e);});})[_0xc575('0xa')](function(_0x26350a){var _0x2f6400=![];var _0x1487d7=_0x26350a[_0xc575('0x11')](/\n/);for(var _0x128bdf=0x0,_0x19c2cf=_0x5eb967[_0xc575('0x12')];_0x128bdf<_0x19c2cf,_0x2f6400===![];_0x128bdf+=0x1){if(_0x26350a[_0xc575('0x13')](_0x5eb967[_0x128bdf])>=0x0){_0x2f6400=!![];}}if(!_0x2f6400){throw new Error(util[_0xc575('0xd')](_0xc575('0x14'),_0x11820[_0xc575('0xf')]['pid']));}process[_0xc575('0x15')](_0x11820[_0xc575('0xf')][_0xc575('0x10')],_0xc575('0x16'));return _0x23e5b8[_0xc575('0x7')](0xc8)[_0xc575('0xb')]({'message':util[_0xc575('0xd')](_0xc575('0x17'),_0x11820[_0xc575('0xf')]['pid'])});})[_0xc575('0x18')](handleError(_0x23e5b8,null,_0xc575('0x19')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ac04eee..1447ea8 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 _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','./tag.controller','get','isAuthenticated','index'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x17ba,0xab));var _0xa17b=function(_0x532fc1,_0x44cb4d){_0x532fc1=_0x532fc1-0x0;var _0xdfd673=_0x17ba[_0x532fc1];return _0xdfd673;};'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 +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x2bf352,_0x31598f){var _0x5e1bbf=function(_0x20c4a0){while(--_0x20c4a0){_0x2bf352['push'](_0x2bf352['shift']());}};_0x5e1bbf(++_0x31598f);}(_0x70e0,0x17b));var _0x070e=function(_0x5c9118,_0x32594f){_0x5c9118=_0x5c9118-0x0;var _0x10082d=_0x70e0[_0x5c9118];return _0x10082d;};'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'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('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 0a633c8..1955ba9 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 _0x9158=['sequelize','exports','STRING'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0x9158,0x16e));var _0x8915=function(_0x5d89e1,_0xb2638f){_0x5d89e1=_0x5d89e1-0x0;var _0x3da607=_0x9158[_0x5d89e1];return _0x3da607;};'use strict';var Sequelize=require(_0x8915('0x0'));module[_0x8915('0x1')]={'name':{'type':Sequelize[_0x8915('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x8915('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x8915('0x2')]}}; \ No newline at end of file +var _0xd8d7=['sequelize','exports','STRING','name'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xd8d7,0x1d4));var _0x7d8d=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xd8d7[_0x2763f2];return _0x3ef471;};'use strict';var Sequelize=require(_0x7d8d('0x0'));module[_0x7d8d('0x1')]={'name':{'type':Sequelize[_0x7d8d('0x2')],'unique':_0x7d8d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x7d8d('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index f0753ae..9261090 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 _0x3dec=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','include','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x275f4a,_0x2077d4){var _0x4b4a21=function(_0x391bab){while(--_0x391bab){_0x275f4a['push'](_0x275f4a['shift']());}};_0x4b4a21(++_0x2077d4);}(_0x3dec,0x8e));var _0xc3de=function(_0x594ff5,_0x47aa57){_0x594ff5=_0x594ff5-0x0;var _0x5042d6=_0x3dec[_0x594ff5];return _0x5042d6;};'use strict';var emlformat=require(_0xc3de('0x0'));var rimraf=require(_0xc3de('0x1'));var zipdir=require(_0xc3de('0x2'));var jsonpatch=require(_0xc3de('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc3de('0x4'));var Mustache=require(_0xc3de('0x5'));var util=require('util');var path=require(_0xc3de('0x6'));var sox=require(_0xc3de('0x7'));var csv=require(_0xc3de('0x8'));var ejs=require(_0xc3de('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc3de('0xa'));var squel=require(_0xc3de('0xb'));var crypto=require(_0xc3de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc3de('0xd'));var toCsv=require(_0xc3de('0x8'));var querystring=require(_0xc3de('0xe'));var Papa=require(_0xc3de('0xf'));var Redis=require(_0xc3de('0x10'));var authService=require(_0xc3de('0x11'));var qs=require(_0xc3de('0x12'));var as=require(_0xc3de('0x13'));var hardwareService=require(_0xc3de('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xc3de('0x15'));var config=require(_0xc3de('0x16'));var licenseUtil=require(_0xc3de('0x17'));var db=require(_0xc3de('0x18'))['db'];function respondWithStatusCode(_0x2f1946,_0x9866f){_0x9866f=_0x9866f||0xcc;return function(_0x45e280){if(_0x45e280){return _0x2f1946[_0xc3de('0x19')](_0x9866f);}return _0x2f1946[_0xc3de('0x1a')](_0x9866f)[_0xc3de('0x1b')]();};}function respondWithResult(_0x2f6403,_0x56da8e){_0x56da8e=_0x56da8e||0xc8;return function(_0x188379){if(_0x188379){return _0x2f6403['status'](_0x56da8e)[_0xc3de('0x1c')](_0x188379);}};}function respondWithFilteredResult(_0xf5e410,_0x4cdaf1){return function(_0x109bda){if(_0x109bda){var _0x1d9a0f=typeof _0x4cdaf1[_0xc3de('0x1d')]===_0xc3de('0x1e')&&typeof _0x4cdaf1[_0xc3de('0x1f')]===_0xc3de('0x1e');var _0x460a22=_0x109bda[_0xc3de('0x20')];var _0x4fa055=_0x1d9a0f?0x0:_0x4cdaf1['offset'];var _0x3950c1=_0x1d9a0f?_0x109bda[_0xc3de('0x20')]:_0x4cdaf1[_0xc3de('0x1d')]+_0x4cdaf1[_0xc3de('0x1f')];var _0x2966d9;if(_0x3950c1>=_0x460a22){_0x3950c1=_0x460a22;_0x2966d9=0xc8;}else{_0x2966d9=0xce;}_0xf5e410[_0xc3de('0x1a')](_0x2966d9);return _0xf5e410[_0xc3de('0x21')](_0xc3de('0x22'),_0x4fa055+'-'+_0x3950c1+'/'+_0x460a22)[_0xc3de('0x1c')](_0x109bda);}return null;};}function patchUpdates(_0xc0fae8){return function(_0x28f875){try{jsonpatch[_0xc3de('0x23')](_0x28f875,_0xc0fae8,!![]);}catch(_0x5382ee){return BPromise[_0xc3de('0x24')](_0x5382ee);}return _0x28f875[_0xc3de('0x25')]();};}function saveUpdates(_0x37b63c,_0x42561b){return function(_0x40eab7){if(_0x40eab7){return _0x40eab7[_0xc3de('0x26')](_0x37b63c)[_0xc3de('0x27')](function(_0x1c1684){return _0x1c1684;});}return null;};}function removeEntity(_0x2a737f,_0x234c6e){return function(_0x58f71a){if(_0x58f71a){return _0x58f71a[_0xc3de('0x28')]()[_0xc3de('0x27')](function(){var _0x7abed0=_0x58f71a[_0xc3de('0x29')]({'plain':!![]});var _0xf8c8d8=_0xc3de('0x2a');return db[_0xc3de('0x2b')][_0xc3de('0x28')]({'where':{'type':_0xf8c8d8,'resourceId':_0x7abed0['id']}})[_0xc3de('0x27')](function(){return _0x58f71a;});})[_0xc3de('0x27')](function(){_0x2a737f[_0xc3de('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a41fc,_0x3c0509){return function(_0x5e9106){if(!_0x5e9106){_0x5a41fc[_0xc3de('0x19')](0x194);}return _0x5e9106;};}function handleError(_0x579b56,_0x2f89b8){_0x2f89b8=_0x2f89b8||0x1f4;return function(_0x5ece11){logger[_0xc3de('0x2c')](_0x5ece11['stack']);if(_0x5ece11[_0xc3de('0x2d')]){delete _0x5ece11[_0xc3de('0x2d')];}_0x579b56[_0xc3de('0x1a')](_0x2f89b8)[_0xc3de('0x2e')](_0x5ece11);};}exports[_0xc3de('0x2f')]=function(_0x34bc75,_0x2e01f2){var _0x26dbb6={},_0x27d976={},_0x4bfab5={'count':0x0,'rows':[]};var _0x4f6f94=_[_0xc3de('0x30')](db[_0xc3de('0x31')][_0xc3de('0x32')],function(_0x2f4fdd){return{'name':_0x2f4fdd[_0xc3de('0x33')],'type':_0x2f4fdd[_0xc3de('0x34')][_0xc3de('0x35')]};});_0x27d976[_0xc3de('0x36')]=_['map'](_0x4f6f94,_0xc3de('0x2d'));_0x27d976[_0xc3de('0x37')]=_[_0xc3de('0x38')](_0x34bc75[_0xc3de('0x37')]);_0x27d976[_0xc3de('0x39')]=_[_0xc3de('0x3a')](_0x27d976['model'],_0x27d976[_0xc3de('0x37')]);_0x26dbb6[_0xc3de('0x3b')]=_[_0xc3de('0x3a')](_0x27d976['model'],qs[_0xc3de('0x3c')](_0x34bc75[_0xc3de('0x37')][_0xc3de('0x3c')]));_0x26dbb6[_0xc3de('0x3b')]=_0x26dbb6[_0xc3de('0x3b')][_0xc3de('0x3d')]?_0x26dbb6[_0xc3de('0x3b')]:_0x27d976[_0xc3de('0x36')];if(!_0x34bc75[_0xc3de('0x37')][_0xc3de('0x3e')](_0xc3de('0x3f'))){_0x26dbb6['limit']=qs[_0xc3de('0x1f')](_0x34bc75[_0xc3de('0x37')][_0xc3de('0x1f')]);_0x26dbb6[_0xc3de('0x1d')]=qs['offset'](_0x34bc75['query']['offset']);}_0x26dbb6['order']=qs[_0xc3de('0x40')](_0x34bc75[_0xc3de('0x37')][_0xc3de('0x40')]);_0x26dbb6['where']=qs['filters'](_[_0xc3de('0x41')](_0x34bc75[_0xc3de('0x37')],_0x27d976[_0xc3de('0x39')]),_0x4f6f94);if(_0x34bc75['query'][_0xc3de('0x42')]){_0x26dbb6[_0xc3de('0x43')]=_[_0xc3de('0x44')](_0x26dbb6['where'],{'$or':_['map'](_0x4f6f94,function(_0xc98d89){if(_0xc98d89[_0xc3de('0x34')]!=='VIRTUAL'){var _0x52401b={};_0x52401b[_0xc98d89['name']]={'$like':'%'+_0x34bc75[_0xc3de('0x37')]['filter']+'%'};return _0x52401b;}})});}_0x26dbb6=_[_0xc3de('0x44')]({},_0x26dbb6,_0x34bc75[_0xc3de('0x45')]);var _0x461651={'where':_0x26dbb6[_0xc3de('0x43')]};return db['Tag'][_0xc3de('0x20')](_0x461651)[_0xc3de('0x27')](function(_0x1cc5be){_0x4bfab5[_0xc3de('0x20')]=_0x1cc5be;if(_0x34bc75[_0xc3de('0x37')][_0xc3de('0x46')]){_0x26dbb6['include']=[{'all':!![]}];}return db[_0xc3de('0x31')]['findAll'](_0x26dbb6);})[_0xc3de('0x27')](function(_0x40f775){_0x4bfab5[_0xc3de('0x47')]=_0x40f775;return _0x4bfab5;})[_0xc3de('0x27')](respondWithFilteredResult(_0x2e01f2,_0x26dbb6))[_0xc3de('0x48')](handleError(_0x2e01f2,null));};exports[_0xc3de('0x49')]=function(_0x47f6b9,_0x131ebc){var _0x524302={'raw':!![],'where':{'id':_0x47f6b9['params']['id']}},_0x1ed18f={};_0x1ed18f['model']=_['keys'](db[_0xc3de('0x31')][_0xc3de('0x32')]);_0x1ed18f['query']=_[_0xc3de('0x38')](_0x47f6b9['query']);_0x1ed18f[_0xc3de('0x39')]=_['intersection'](_0x1ed18f[_0xc3de('0x36')],_0x1ed18f[_0xc3de('0x37')]);_0x524302[_0xc3de('0x3b')]=_['intersection'](_0x1ed18f['model'],qs[_0xc3de('0x3c')](_0x47f6b9['query']['fields']));_0x524302[_0xc3de('0x3b')]=_0x524302['attributes']['length']?_0x524302[_0xc3de('0x3b')]:_0x1ed18f[_0xc3de('0x36')];if(_0x47f6b9[_0xc3de('0x37')]['includeAll']){_0x524302[_0xc3de('0x4a')]=[{'all':!![]}];}_0x524302=_[_0xc3de('0x44')]({},_0x524302,_0x47f6b9[_0xc3de('0x45')]);return db['Tag'][_0xc3de('0x4b')](_0x524302)[_0xc3de('0x27')](handleEntityNotFound(_0x131ebc,null))[_0xc3de('0x27')](respondWithResult(_0x131ebc,null))[_0xc3de('0x48')](handleError(_0x131ebc,null));};exports[_0xc3de('0x4c')]=function(_0xf634c3,_0x2a31ec){return db['Tag']['create'](_0xf634c3[_0xc3de('0x4d')],{})[_0xc3de('0x27')](function(_0x285910){var _0x1bf3f6=_0xf634c3[_0xc3de('0x4e')]['get']({'plain':!![]});if(!_0x1bf3f6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bf3f6[_0xc3de('0x4f')]===_0xc3de('0x4e')){var _0x3b162c=_0x285910['get']({'plain':!![]});var _0x5f0c09=_0xc3de('0x2a');return db[_0xc3de('0x50')][_0xc3de('0x4b')]({'where':{'name':_0x5f0c09,'userProfileId':_0x1bf3f6[_0xc3de('0x51')]},'raw':!![]})['then'](function(_0x5cb8ec){if(_0x5cb8ec&&_0x5cb8ec[_0xc3de('0x52')]===0x0){return db['UserProfileResource'][_0xc3de('0x4c')]({'name':_0x3b162c[_0xc3de('0x2d')],'resourceId':_0x3b162c['id'],'type':_0x5cb8ec[_0xc3de('0x2d')],'sectionId':_0x5cb8ec['id']},{})['then'](function(){return _0x285910;});}else{return _0x285910;}})[_0xc3de('0x48')](function(_0x2855db){logger[_0xc3de('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2855db);throw _0x2855db;});}return _0x285910;})['then'](respondWithResult(_0x2a31ec,0xc9))['catch'](handleError(_0x2a31ec,null));};exports[_0xc3de('0x26')]=function(_0x180204,_0x131ffb){if(_0x180204[_0xc3de('0x4d')]['id']){delete _0x180204[_0xc3de('0x4d')]['id'];}return db[_0xc3de('0x31')][_0xc3de('0x4b')]({'where':{'id':_0x180204[_0xc3de('0x53')]['id']}})['then'](handleEntityNotFound(_0x131ffb,null))[_0xc3de('0x27')](saveUpdates(_0x180204['body'],null))[_0xc3de('0x27')](respondWithResult(_0x131ffb,null))['catch'](handleError(_0x131ffb,null));};exports[_0xc3de('0x28')]=function(_0x397c05,_0x5f2195){return db[_0xc3de('0x31')][_0xc3de('0x4b')]({'where':{'id':_0x397c05[_0xc3de('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f2195,null))[_0xc3de('0x27')](removeEntity(_0x5f2195,null))[_0xc3de('0x48')](handleError(_0x5f2195,null));};exports[_0xc3de('0x54')]=function(_0xc6546b,_0x4a4e2e){return db['Tag']['describe']()['then'](respondWithResult(_0x4a4e2e,null))['catch'](handleError(_0x4a4e2e,null));}; \ No newline at end of file +var _0xdd03=['querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','then','destroy','get','UserProfileResource','error','stack','send','index','map','Tag','key','model','name','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','merge','type','options','includeAll','findAll','rows','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv'];(function(_0x5cda3e,_0x216c8c){var _0x32e52c=function(_0x16a3b5){while(--_0x16a3b5){_0x5cda3e['push'](_0x5cda3e['shift']());}};_0x32e52c(++_0x216c8c);}(_0xdd03,0xe5));var _0x3dd0=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xdd03[_0x3bf83f];return _0x22c4a9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3dd0('0x0'));var rp=require(_0x3dd0('0x1'));var moment=require(_0x3dd0('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x3dd0('0x3'));var util=require(_0x3dd0('0x4'));var path=require('path');var sox=require(_0x3dd0('0x5'));var csv=require('to-csv');var ejs=require(_0x3dd0('0x6'));var fs=require('fs');var fs_extra=require(_0x3dd0('0x7'));var _=require(_0x3dd0('0x8'));var squel=require(_0x3dd0('0x9'));var crypto=require(_0x3dd0('0xa'));var jsforce=require(_0x3dd0('0xb'));var deskjs=require(_0x3dd0('0xc'));var toCsv=require(_0x3dd0('0xd'));var querystring=require(_0x3dd0('0xe'));var Papa=require('papaparse');var Redis=require(_0x3dd0('0xf'));var authService=require(_0x3dd0('0x10'));var qs=require(_0x3dd0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3dd0('0x12'));var logger=require(_0x3dd0('0x13'))(_0x3dd0('0x14'));var utils=require(_0x3dd0('0x15'));var config=require(_0x3dd0('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50d20b,_0x1a8bb7){_0x1a8bb7=_0x1a8bb7||0xcc;return function(_0x52f757){if(_0x52f757){return _0x50d20b[_0x3dd0('0x17')](_0x1a8bb7);}return _0x50d20b['status'](_0x1a8bb7)[_0x3dd0('0x18')]();};}function respondWithResult(_0x1dee9e,_0x2f3174){_0x2f3174=_0x2f3174||0xc8;return function(_0x526eeb){if(_0x526eeb){return _0x1dee9e[_0x3dd0('0x19')](_0x2f3174)[_0x3dd0('0x1a')](_0x526eeb);}};}function respondWithFilteredResult(_0x25f612,_0x176526){return function(_0x2b57f0){if(_0x2b57f0){var _0x75c5a8=typeof _0x176526[_0x3dd0('0x1b')]===_0x3dd0('0x1c')&&typeof _0x176526[_0x3dd0('0x1d')]===_0x3dd0('0x1c');var _0x247bc3=_0x2b57f0[_0x3dd0('0x1e')];var _0x328903=_0x75c5a8?0x0:_0x176526[_0x3dd0('0x1b')];var _0x59c882=_0x75c5a8?_0x2b57f0[_0x3dd0('0x1e')]:_0x176526[_0x3dd0('0x1b')]+_0x176526[_0x3dd0('0x1d')];var _0x173679;if(_0x59c882>=_0x247bc3){_0x59c882=_0x247bc3;_0x173679=0xc8;}else{_0x173679=0xce;}_0x25f612[_0x3dd0('0x19')](_0x173679);return _0x25f612[_0x3dd0('0x1f')]('Content-Range',_0x328903+'-'+_0x59c882+'/'+_0x247bc3)[_0x3dd0('0x1a')](_0x2b57f0);}return null;};}function patchUpdates(_0x20ab25){return function(_0x33df87){try{jsonpatch['apply'](_0x33df87,_0x20ab25,!![]);}catch(_0x2afc66){return BPromise['reject'](_0x2afc66);}return _0x33df87[_0x3dd0('0x20')]();};}function saveUpdates(_0x57ffeb,_0x5237da){return function(_0x38d262){if(_0x38d262){return _0x38d262[_0x3dd0('0x21')](_0x57ffeb)[_0x3dd0('0x22')](function(_0x4f7aa8){return _0x4f7aa8;});}return null;};}function removeEntity(_0x144b66,_0x1ea8ab){return function(_0x3b4156){if(_0x3b4156){return _0x3b4156[_0x3dd0('0x23')]()[_0x3dd0('0x22')](function(){var _0x2423fd=_0x3b4156[_0x3dd0('0x24')]({'plain':!![]});var _0x50a0d9='Tags';return db[_0x3dd0('0x25')]['destroy']({'where':{'type':_0x50a0d9,'resourceId':_0x2423fd['id']}})[_0x3dd0('0x22')](function(){return _0x3b4156;});})['then'](function(){_0x144b66[_0x3dd0('0x19')](0xcc)[_0x3dd0('0x18')]();});}};}function handleEntityNotFound(_0x51adf1,_0x28e96e){return function(_0x5e0d5d){if(!_0x5e0d5d){_0x51adf1[_0x3dd0('0x17')](0x194);}return _0x5e0d5d;};}function handleError(_0x201bee,_0x4f01eb){_0x4f01eb=_0x4f01eb||0x1f4;return function(_0x48c06a){logger[_0x3dd0('0x26')](_0x48c06a[_0x3dd0('0x27')]);if(_0x48c06a['name']){delete _0x48c06a['name'];}_0x201bee[_0x3dd0('0x19')](_0x4f01eb)[_0x3dd0('0x28')](_0x48c06a);};}exports[_0x3dd0('0x29')]=function(_0x3f7b62,_0x881acd){var _0x201599={},_0x4682d9={},_0x2ea22f={'count':0x0,'rows':[]};var _0x19b2ac=_[_0x3dd0('0x2a')](db[_0x3dd0('0x2b')]['rawAttributes'],function(_0x3f176a){return{'name':_0x3f176a['fieldName'],'type':_0x3f176a['type'][_0x3dd0('0x2c')]};});_0x4682d9[_0x3dd0('0x2d')]=_[_0x3dd0('0x2a')](_0x19b2ac,_0x3dd0('0x2e'));_0x4682d9[_0x3dd0('0x2f')]=_[_0x3dd0('0x30')](_0x3f7b62[_0x3dd0('0x2f')]);_0x4682d9[_0x3dd0('0x31')]=_['intersection'](_0x4682d9[_0x3dd0('0x2d')],_0x4682d9[_0x3dd0('0x2f')]);_0x201599[_0x3dd0('0x32')]=_[_0x3dd0('0x33')](_0x4682d9[_0x3dd0('0x2d')],qs[_0x3dd0('0x34')](_0x3f7b62[_0x3dd0('0x2f')]['fields']));_0x201599['attributes']=_0x201599['attributes'][_0x3dd0('0x35')]?_0x201599[_0x3dd0('0x32')]:_0x4682d9[_0x3dd0('0x2d')];if(!_0x3f7b62['query']['hasOwnProperty'](_0x3dd0('0x36'))){_0x201599[_0x3dd0('0x1d')]=qs[_0x3dd0('0x1d')](_0x3f7b62[_0x3dd0('0x2f')]['limit']);_0x201599[_0x3dd0('0x1b')]=qs[_0x3dd0('0x1b')](_0x3f7b62['query'][_0x3dd0('0x1b')]);}_0x201599['order']=qs['sort'](_0x3f7b62[_0x3dd0('0x2f')][_0x3dd0('0x37')]);_0x201599[_0x3dd0('0x38')]=qs[_0x3dd0('0x31')](_[_0x3dd0('0x39')](_0x3f7b62[_0x3dd0('0x2f')],_0x4682d9[_0x3dd0('0x31')]),_0x19b2ac);if(_0x3f7b62[_0x3dd0('0x2f')][_0x3dd0('0x3a')]){_0x201599['where']=_[_0x3dd0('0x3b')](_0x201599[_0x3dd0('0x38')],{'$or':_['map'](_0x19b2ac,function(_0x17da16){if(_0x17da16[_0x3dd0('0x3c')]!=='VIRTUAL'){var _0x54ada9={};_0x54ada9[_0x17da16[_0x3dd0('0x2e')]]={'$like':'%'+_0x3f7b62['query'][_0x3dd0('0x3a')]+'%'};return _0x54ada9;}})});}_0x201599=_['merge']({},_0x201599,_0x3f7b62[_0x3dd0('0x3d')]);var _0x497589={'where':_0x201599[_0x3dd0('0x38')]};return db[_0x3dd0('0x2b')][_0x3dd0('0x1e')](_0x497589)[_0x3dd0('0x22')](function(_0x197c95){_0x2ea22f['count']=_0x197c95;if(_0x3f7b62['query'][_0x3dd0('0x3e')]){_0x201599['include']=[{'all':!![]}];}return db['Tag'][_0x3dd0('0x3f')](_0x201599);})[_0x3dd0('0x22')](function(_0xd6ef58){_0x2ea22f[_0x3dd0('0x40')]=_0xd6ef58;return _0x2ea22f;})['then'](respondWithFilteredResult(_0x881acd,_0x201599))['catch'](handleError(_0x881acd,null));};exports[_0x3dd0('0x41')]=function(_0x34ba66,_0xad4eb1){var _0x3fdf54={'raw':!![],'where':{'id':_0x34ba66['params']['id']}},_0x3a96db={};_0x3a96db[_0x3dd0('0x2d')]=_['keys'](db[_0x3dd0('0x2b')][_0x3dd0('0x42')]);_0x3a96db['query']=_[_0x3dd0('0x30')](_0x34ba66[_0x3dd0('0x2f')]);_0x3a96db[_0x3dd0('0x31')]=_[_0x3dd0('0x33')](_0x3a96db[_0x3dd0('0x2d')],_0x3a96db[_0x3dd0('0x2f')]);_0x3fdf54[_0x3dd0('0x32')]=_[_0x3dd0('0x33')](_0x3a96db[_0x3dd0('0x2d')],qs[_0x3dd0('0x34')](_0x34ba66[_0x3dd0('0x2f')][_0x3dd0('0x34')]));_0x3fdf54['attributes']=_0x3fdf54[_0x3dd0('0x32')][_0x3dd0('0x35')]?_0x3fdf54[_0x3dd0('0x32')]:_0x3a96db[_0x3dd0('0x2d')];if(_0x34ba66[_0x3dd0('0x2f')][_0x3dd0('0x3e')]){_0x3fdf54['include']=[{'all':!![]}];}_0x3fdf54=_[_0x3dd0('0x3b')]({},_0x3fdf54,_0x34ba66[_0x3dd0('0x3d')]);return db[_0x3dd0('0x2b')][_0x3dd0('0x43')](_0x3fdf54)[_0x3dd0('0x22')](handleEntityNotFound(_0xad4eb1,null))['then'](respondWithResult(_0xad4eb1,null))['catch'](handleError(_0xad4eb1,null));};exports[_0x3dd0('0x44')]=function(_0x2b6361,_0x312c8b){return db['Tag'][_0x3dd0('0x44')](_0x2b6361[_0x3dd0('0x45')],{})[_0x3dd0('0x22')](function(_0x76e263){var _0x2bd6e2=_0x2b6361[_0x3dd0('0x46')][_0x3dd0('0x24')]({'plain':!![]});if(!_0x2bd6e2)throw new Error(_0x3dd0('0x47'));if(_0x2bd6e2[_0x3dd0('0x48')]===_0x3dd0('0x46')){var _0x35d6ac=_0x76e263['get']({'plain':!![]});var _0x339f5f=_0x3dd0('0x49');return db[_0x3dd0('0x4a')][_0x3dd0('0x43')]({'where':{'name':_0x339f5f,'userProfileId':_0x2bd6e2[_0x3dd0('0x4b')]},'raw':!![]})[_0x3dd0('0x22')](function(_0x176a01){if(_0x176a01&&_0x176a01[_0x3dd0('0x4c')]===0x0){return db[_0x3dd0('0x25')][_0x3dd0('0x44')]({'name':_0x35d6ac[_0x3dd0('0x2e')],'resourceId':_0x35d6ac['id'],'type':_0x176a01[_0x3dd0('0x2e')],'sectionId':_0x176a01['id']},{})['then'](function(){return _0x76e263;});}else{return _0x76e263;}})[_0x3dd0('0x4d')](function(_0x1b8db7){logger[_0x3dd0('0x26')](_0x3dd0('0x4e'),_0x1b8db7);throw _0x1b8db7;});}return _0x76e263;})['then'](respondWithResult(_0x312c8b,0xc9))['catch'](handleError(_0x312c8b,null));};exports['update']=function(_0x11011f,_0x19e82c){if(_0x11011f[_0x3dd0('0x45')]['id']){delete _0x11011f[_0x3dd0('0x45')]['id'];}return db[_0x3dd0('0x2b')][_0x3dd0('0x43')]({'where':{'id':_0x11011f['params']['id']}})[_0x3dd0('0x22')](handleEntityNotFound(_0x19e82c,null))['then'](saveUpdates(_0x11011f[_0x3dd0('0x45')],null))['then'](respondWithResult(_0x19e82c,null))[_0x3dd0('0x4d')](handleError(_0x19e82c,null));};exports[_0x3dd0('0x23')]=function(_0x158f59,_0x5c49f5){return db[_0x3dd0('0x2b')][_0x3dd0('0x43')]({'where':{'id':_0x158f59[_0x3dd0('0x4f')]['id']}})['then'](handleEntityNotFound(_0x5c49f5,null))['then'](removeEntity(_0x5c49f5,null))['catch'](handleError(_0x5c49f5,null));};exports[_0x3dd0('0x50')]=function(_0x11d6e6,_0x3cbc1a){return db[_0x3dd0('0x2b')]['describe']()['then'](respondWithResult(_0x3cbc1a,null))[_0x3dd0('0x4d')](handleError(_0x3cbc1a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 38cd8fb..fb46003 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 _0xeb40=['../../config/environment','./tag.attributes','define','tools_tags','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x475bd7,_0x33aad9){var _0x27c23a=function(_0x1b31a5){while(--_0x1b31a5){_0x475bd7['push'](_0x475bd7['shift']());}};_0x27c23a(++_0x33aad9);}(_0xeb40,0x176));var _0x0eb4=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xeb40[_0x45d3f0];return _0x314b79;};'use strict';var _=require(_0x0eb4('0x0'));var util=require('util');var logger=require(_0x0eb4('0x1'))(_0x0eb4('0x2'));var moment=require(_0x0eb4('0x3'));var BPromise=require(_0x0eb4('0x4'));var rp=require(_0x0eb4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0eb4('0x6'));var attributes=require(_0x0eb4('0x7'));module['exports']=function(_0x3950f5,_0x35cbd4){return _0x3950f5[_0x0eb4('0x8')]('Tag',attributes,{'tableName':_0x0eb4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x20cb=['api','moment','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','util','../../config/logger'];(function(_0x2bfe47,_0x2dfbdd){var _0x526029=function(_0x28ccf3){while(--_0x28ccf3){_0x2bfe47['push'](_0x2bfe47['shift']());}};_0x526029(++_0x2dfbdd);}(_0x20cb,0x12a));var _0xb20c=function(_0xe7514c,_0x44f623){_0xe7514c=_0xe7514c-0x0;var _0x54c7bb=_0x20cb[_0xe7514c];return _0x54c7bb;};'use strict';var _=require('lodash');var util=require(_0xb20c('0x0'));var logger=require(_0xb20c('0x1'))(_0xb20c('0x2'));var moment=require(_0xb20c('0x3'));var BPromise=require('bluebird');var rp=require(_0xb20c('0x4'));var fs=require('fs');var path=require(_0xb20c('0x5'));var rimraf=require(_0xb20c('0x6'));var config=require(_0xb20c('0x7'));var attributes=require(_0xb20c('0x8'));module[_0xb20c('0x9')]=function(_0x1a6d94,_0x49b697){return _0x1a6d94['define'](_0xb20c('0xa'),attributes,{'tableName':_0xb20c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 4fe37e4..e9ef183 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 _0xf021=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','then','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Tag,\x20%s,\x20%s','result','catch'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xf021,0x18f));var _0x1f02=function(_0xb98e6e,_0xe56cbc){_0xb98e6e=_0xb98e6e-0x0;var _0x26751c=_0xf021[_0xb98e6e];return _0x26751c;};'use strict';var _=require(_0x1f02('0x0'));var util=require(_0x1f02('0x1'));var moment=require(_0x1f02('0x2'));var BPromise=require(_0x1f02('0x3'));var rs=require(_0x1f02('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1f02('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1f02('0x6'))(_0x1f02('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1f02('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x383d0b,_0x257d6a,_0x2a6c50){return new BPromise(function(_0x4193d2,_0x1f1cec){return client['request'](_0x383d0b,_0x2a6c50)[_0x1f02('0x9')](function(_0x5dc295){logger['info']('Tag,\x20%s,\x20%s',_0x257d6a,_0x1f02('0xa'));logger[_0x1f02('0xb')](_0x1f02('0xc'),_0x257d6a,_0x1f02('0xa'),JSON[_0x1f02('0xd')](_0x5dc295));if(_0x5dc295['error']){if(_0x5dc295[_0x1f02('0xe')][_0x1f02('0xf')]===0x1f4){logger[_0x1f02('0xe')]('Tag,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x1f1cec(_0x5dc295[_0x1f02('0xe')]['message']);}logger['error']('Tag,\x20%s,\x20%s',_0x257d6a,_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);return _0x4193d2(_0x5dc295[_0x1f02('0xe')][_0x1f02('0x10')]);}else{logger[_0x1f02('0x11')](_0x1f02('0x12'),_0x257d6a,_0x1f02('0xa'));_0x4193d2(_0x5dc295[_0x1f02('0x13')]['message']);}})[_0x1f02('0x14')](function(_0x5cca16){logger['error']('Tag,\x20%s,\x20%s',_0x257d6a,_0x5cca16);_0x1f1cec(_0x5cca16);});});} \ No newline at end of file +var _0xe5d5=['request\x20sent','result','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x1b4c04,_0x8d961d){var _0x374f5d=function(_0x11dc31){while(--_0x11dc31){_0x1b4c04['push'](_0x1b4c04['shift']());}};_0x374f5d(++_0x8d961d);}(_0xe5d5,0x156));var _0x5e5d=function(_0x54a94f,_0x2d2876){_0x54a94f=_0x54a94f-0x0;var _0x4a098c=_0xe5d5[_0x54a94f];return _0x4a098c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5e5d('0x0'));var BPromise=require('bluebird');var rs=require(_0x5e5d('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5e5d('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5e5d('0x3'))(_0x5e5d('0x4'));var config=require(_0x5e5d('0x5'));var jayson=require(_0x5e5d('0x6'));var client=jayson[_0x5e5d('0x7')][_0x5e5d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3200d5,_0xab446c,_0x23de8d){return new BPromise(function(_0x131a59,_0x11973c){return client[_0x5e5d('0x9')](_0x3200d5,_0x23de8d)[_0x5e5d('0xa')](function(_0x5d3a3b){logger['info'](_0x5e5d('0xb'),_0xab446c,'request\x20sent');logger[_0x5e5d('0xc')](_0x5e5d('0xd'),_0xab446c,'request\x20sent',JSON[_0x5e5d('0xe')](_0x5d3a3b));if(_0x5d3a3b[_0x5e5d('0xf')]){if(_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x10')]===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x11973c(_0x5d3a3b['error'][_0x5e5d('0x11')]);}logger[_0x5e5d('0xf')]('Tag,\x20%s,\x20%s',_0xab446c,_0x5d3a3b[_0x5e5d('0xf')][_0x5e5d('0x11')]);return _0x131a59(_0x5d3a3b['error']['message']);}else{logger['info'](_0x5e5d('0xb'),_0xab446c,_0x5e5d('0x12'));_0x131a59(_0x5d3a3b[_0x5e5d('0x13')][_0x5e5d('0x11')]);}})['catch'](function(_0x132532){logger[_0x5e5d('0xf')](_0x5e5d('0xb'),_0xab446c,_0x132532);_0x11973c(_0x132532);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index adc0fa3..880fc6e 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xa9e0[_0x4baae2];return _0x1a2285;};'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(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 a40b016..f9cba25 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 _0xbaf0=['name','exports','STRING'];(function(_0x4fa166,_0x58b7fb){var _0x5dd974=function(_0x342886){while(--_0x342886){_0x4fa166['push'](_0x4fa166['shift']());}};_0x5dd974(++_0x58b7fb);}(_0xbaf0,0x12a));var _0x0baf=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xbaf0[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0xaa8a12,_0x4b02fa){var _0xe8546e=function(_0x4b90bd){while(--_0x4b90bd){_0xaa8a12['push'](_0xaa8a12['shift']());}};_0xe8546e(++_0x4b02fa);}(_0x2032,0xd9));var _0x2203=function(_0x3d4007,_0x95eb6a){_0x3d4007=_0x3d4007-0x0;var _0x23d47c=_0x2032[_0x3d4007];return _0x23d47c;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index c8e5c2b..64a7d08 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 _0x74d0=['addQueues','add','ids','addAgents','isArray','Voice','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','transaction','through','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','emit','Queue:save','User','voicePause','interface','UserVoiceQueueRt','isNil','format','SIP/%s','all','UserVoicePrefix','upsert','spread','removeAgents','getAgents','pick','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','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','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','map','Team','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Teams','body','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserFaxQueue','OpenchannelQueueId','UserOpenchannelQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queues'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0x74d0,0x1eb));var _0x074d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x74d0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x074d('0x0'));var rimraf=require(_0x074d('0x1'));var zipdir=require(_0x074d('0x2'));var jsonpatch=require(_0x074d('0x3'));var rp=require('request-promise');var moment=require(_0x074d('0x4'));var BPromise=require(_0x074d('0x5'));var Mustache=require(_0x074d('0x6'));var util=require(_0x074d('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x074d('0x8'));var ejs=require(_0x074d('0x9'));var fs=require('fs');var fs_extra=require(_0x074d('0xa'));var _=require('lodash');var squel=require(_0x074d('0xb'));var crypto=require(_0x074d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x074d('0xd'));var toCsv=require(_0x074d('0x8'));var querystring=require(_0x074d('0xe'));var Papa=require(_0x074d('0xf'));var Redis=require(_0x074d('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x074d('0x11'));var as=require(_0x074d('0x12'));var hardwareService=require(_0x074d('0x13'));var logger=require(_0x074d('0x14'))(_0x074d('0x15'));var utils=require(_0x074d('0x16'));var config=require(_0x074d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x074d('0x18')]=_['defaults'](config[_0x074d('0x18')],{'host':_0x074d('0x19'),'port':0x18eb});var socket=require(_0x074d('0x1a'))(new Redis(config[_0x074d('0x18')]));require(_0x074d('0x1b'))[_0x074d('0x1c')](socket);function respondWithStatusCode(_0x4ca2d0,_0x109c32){_0x109c32=_0x109c32||0xcc;return function(_0x3209c3){if(_0x3209c3){return _0x4ca2d0[_0x074d('0x1d')](_0x109c32);}return _0x4ca2d0[_0x074d('0x1e')](_0x109c32)[_0x074d('0x1f')]();};}function respondWithResult(_0x24e03d,_0x30d37a){_0x30d37a=_0x30d37a||0xc8;return function(_0x441d26){if(_0x441d26){return _0x24e03d[_0x074d('0x1e')](_0x30d37a)['json'](_0x441d26);}};}function respondWithFilteredResult(_0x3185fa,_0x157e81){return function(_0x1ad740){if(_0x1ad740){var _0x20c6e4=typeof _0x157e81['offset']===_0x074d('0x20')&&typeof _0x157e81[_0x074d('0x21')]==='undefined';var _0x8b77ef=_0x1ad740[_0x074d('0x22')];var _0x3bf674=_0x20c6e4?0x0:_0x157e81['offset'];var _0x28eb80=_0x20c6e4?_0x1ad740[_0x074d('0x22')]:_0x157e81['offset']+_0x157e81[_0x074d('0x21')];var _0x34e353;if(_0x28eb80>=_0x8b77ef){_0x28eb80=_0x8b77ef;_0x34e353=0xc8;}else{_0x34e353=0xce;}_0x3185fa['status'](_0x34e353);return _0x3185fa[_0x074d('0x23')](_0x074d('0x24'),_0x3bf674+'-'+_0x28eb80+'/'+_0x8b77ef)[_0x074d('0x25')](_0x1ad740);}return null;};}function patchUpdates(_0x20ec87){return function(_0x31d1e0){try{jsonpatch[_0x074d('0x26')](_0x31d1e0,_0x20ec87,!![]);}catch(_0x59ce78){return BPromise[_0x074d('0x27')](_0x59ce78);}return _0x31d1e0[_0x074d('0x28')]();};}function saveUpdates(_0x15f7b3,_0x4883f3){return function(_0xe43ec1){if(_0xe43ec1){return _0xe43ec1[_0x074d('0x29')](_0x15f7b3)[_0x074d('0x2a')](function(_0x20c707){return _0x20c707;});}return null;};}function handleEntityNotFound(_0x5b6285,_0x5bf584){return function(_0x10ef76){if(!_0x10ef76){_0x5b6285['sendStatus'](0x194);}return _0x10ef76;};}function handleError(_0x56f13d,_0x305199){_0x305199=_0x305199||0x1f4;return function(_0x2555da){logger[_0x074d('0x2b')](_0x2555da[_0x074d('0x2c')]);if(_0x2555da['name']){delete _0x2555da[_0x074d('0x2d')];}_0x56f13d['status'](_0x305199)[_0x074d('0x2e')](_0x2555da);};}exports['index']=function(_0x3fc0ed,_0x312a9f){var _0x110adc={},_0x41da54={},_0x382088={'count':0x0,'rows':[]};var _0x4be06f=_[_0x074d('0x2f')](db[_0x074d('0x30')][_0x074d('0x31')],function(_0x3e3102){return{'name':_0x3e3102[_0x074d('0x32')],'type':_0x3e3102['type']['key']};});_0x41da54['model']=_[_0x074d('0x2f')](_0x4be06f,_0x074d('0x2d'));_0x41da54[_0x074d('0x33')]=_[_0x074d('0x34')](_0x3fc0ed[_0x074d('0x33')]);_0x41da54[_0x074d('0x35')]=_[_0x074d('0x36')](_0x41da54[_0x074d('0x37')],_0x41da54[_0x074d('0x33')]);_0x110adc[_0x074d('0x38')]=_['intersection'](_0x41da54[_0x074d('0x37')],qs[_0x074d('0x39')](_0x3fc0ed[_0x074d('0x33')][_0x074d('0x39')]));_0x110adc[_0x074d('0x38')]=_0x110adc[_0x074d('0x38')][_0x074d('0x3a')]?_0x110adc['attributes']:_0x41da54[_0x074d('0x37')];if(!_0x3fc0ed[_0x074d('0x33')][_0x074d('0x3b')](_0x074d('0x3c'))){_0x110adc[_0x074d('0x21')]=qs['limit'](_0x3fc0ed[_0x074d('0x33')][_0x074d('0x21')]);_0x110adc[_0x074d('0x3d')]=qs[_0x074d('0x3d')](_0x3fc0ed[_0x074d('0x33')]['offset']);}_0x110adc[_0x074d('0x3e')]=qs['sort'](_0x3fc0ed[_0x074d('0x33')][_0x074d('0x3f')]);_0x110adc[_0x074d('0x40')]=qs[_0x074d('0x35')](_['pick'](_0x3fc0ed[_0x074d('0x33')],_0x41da54[_0x074d('0x35')]),_0x4be06f);if(_0x3fc0ed[_0x074d('0x33')][_0x074d('0x41')]){_0x110adc[_0x074d('0x40')]=_['merge'](_0x110adc[_0x074d('0x40')],{'$or':_['map'](_0x4be06f,function(_0x5b8ec6){if(_0x5b8ec6[_0x074d('0x42')]!==_0x074d('0x43')){var _0x536c18={};_0x536c18[_0x5b8ec6[_0x074d('0x2d')]]={'$like':'%'+_0x3fc0ed[_0x074d('0x33')][_0x074d('0x41')]+'%'};return _0x536c18;}})});}_0x110adc=_[_0x074d('0x44')]({},_0x110adc,_0x3fc0ed[_0x074d('0x45')]);var _0xe0cd51={'where':_0x110adc[_0x074d('0x40')]};return db[_0x074d('0x30')]['count'](_0xe0cd51)[_0x074d('0x2a')](function(_0x5e7076){_0x382088[_0x074d('0x22')]=_0x5e7076;if(_0x3fc0ed['query'][_0x074d('0x46')]){_0x110adc[_0x074d('0x47')]=[{'all':!![]}];}return db[_0x074d('0x30')][_0x074d('0x48')](_0x110adc);})[_0x074d('0x2a')](function(_0x225beb){_0x382088[_0x074d('0x49')]=_0x225beb;return _0x382088;})[_0x074d('0x2a')](respondWithFilteredResult(_0x312a9f,_0x110adc))[_0x074d('0x4a')](handleError(_0x312a9f,null));};exports[_0x074d('0x4b')]=function(_0x177676,_0x4ce801){var _0x3329bd={'raw':![],'where':{'id':_0x177676[_0x074d('0x4c')]['id']}},_0x46673a={};_0x46673a[_0x074d('0x37')]=_[_0x074d('0x34')](db[_0x074d('0x30')][_0x074d('0x31')]);_0x46673a['query']=_['keys'](_0x177676[_0x074d('0x33')]);_0x46673a[_0x074d('0x35')]=_[_0x074d('0x36')](_0x46673a[_0x074d('0x37')],_0x46673a[_0x074d('0x33')]);_0x3329bd['attributes']=_['intersection'](_0x46673a[_0x074d('0x37')],qs[_0x074d('0x39')](_0x177676[_0x074d('0x33')][_0x074d('0x39')]));_0x3329bd[_0x074d('0x38')]=_0x3329bd[_0x074d('0x38')]['length']?_0x3329bd['attributes']:_0x46673a[_0x074d('0x37')];if(_0x177676[_0x074d('0x33')][_0x074d('0x46')]){_0x3329bd['include']=[{'all':!![]}];}_0x3329bd=_[_0x074d('0x44')]({},_0x3329bd,_0x177676[_0x074d('0x45')]);return db[_0x074d('0x30')][_0x074d('0x4d')](_0x3329bd)[_0x074d('0x2a')](handleEntityNotFound(_0x4ce801,null))[_0x074d('0x2a')](respondWithResult(_0x4ce801,null))[_0x074d('0x4a')](handleError(_0x4ce801,null));};exports['create']=function(_0x21b23a,_0x468994){return db[_0x074d('0x30')][_0x074d('0x4e')](_0x21b23a['body'],{})[_0x074d('0x2a')](function(_0x4c8e8a){var _0x332bc2=_0x21b23a[_0x074d('0x4f')]['get']({'plain':!![]});if(!_0x332bc2)throw new Error(_0x074d('0x50'));if(_0x332bc2[_0x074d('0x51')]==='user'){var _0x5174b2=_0x4c8e8a[_0x074d('0x52')]({'plain':!![]});var _0x1ccb94=_0x074d('0x53');return db['UserProfileSection'][_0x074d('0x4d')]({'where':{'name':_0x1ccb94,'userProfileId':_0x332bc2['userProfileId']},'raw':!![]})[_0x074d('0x2a')](function(_0x36d8a7){if(_0x36d8a7&&_0x36d8a7['autoAssociation']===0x0){return db['UserProfileResource'][_0x074d('0x4e')]({'name':_0x5174b2[_0x074d('0x2d')],'resourceId':_0x5174b2['id'],'type':_0x36d8a7[_0x074d('0x2d')],'sectionId':_0x36d8a7['id']},{})[_0x074d('0x2a')](function(){return _0x4c8e8a;});}else{return _0x4c8e8a;}})[_0x074d('0x4a')](function(_0x3f0001){logger[_0x074d('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3f0001);throw _0x3f0001;});}return _0x4c8e8a;})[_0x074d('0x2a')](respondWithResult(_0x468994,0xc9))[_0x074d('0x4a')](handleError(_0x468994,null));};exports[_0x074d('0x29')]=function(_0x45909c,_0x300c31){if(_0x45909c[_0x074d('0x54')]['id']){delete _0x45909c['body']['id'];}return db[_0x074d('0x30')][_0x074d('0x4d')]({'where':{'id':_0x45909c[_0x074d('0x4c')]['id']}})['then'](handleEntityNotFound(_0x300c31,null))[_0x074d('0x2a')](saveUpdates(_0x45909c[_0x074d('0x54')],null))['then'](respondWithResult(_0x300c31,null))[_0x074d('0x4a')](handleError(_0x300c31,null));};exports[_0x074d('0x55')]=function(_0x72e9ec,_0x5093a4){var _0x3ed980=_0x72e9ec['params']['id'];var _0x126348=[];return db[_0x074d('0x56')]['transaction'](function(_0x25835a){var _0xb05b0=_0x074d('0x57')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0xb05b0,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a})[_0x074d('0x2a')](function(_0x3de980){_0x126348=_[_0x074d('0x2f')](_0x3de980,function(_0x400b80){return Number(_0x400b80[_0x074d('0x5b')]);});})[_0x074d('0x2a')](function(){var _0x196d3c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x196d3c,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x44b08e){var _0x19ae52=_['map'](_0x44b08e,function(_0x1cabc6){return Number(_0x1cabc6[_0x074d('0x5c')]);});return db['UserVoiceQueue'][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'VoiceQueueId':{'$in':_0x19ae52}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x334c35=_0x074d('0x5d')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x334c35,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x190af1){var _0x4de918=_['map'](_0x190af1,function(_0x1db590){return Number(_0x1db590['MailQueueId']);});return db[_0x074d('0x5e')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'MailQueueId':{'$in':_0x4de918}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x3b425e=_0x074d('0x5f')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x3b425e,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})['then'](function(_0x63fb11){var _0x822049=_[_0x074d('0x2f')](_0x63fb11,function(_0x4cf98b){return Number(_0x4cf98b[_0x074d('0x60')]);});return db[_0x074d('0x61')]['destroy']({'where':{'UserId':{'$in':_0x126348},'SmsQueueId':{'$in':_0x822049}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x16b72c=_0x074d('0x62')+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0x16b72c,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})['then'](function(_0xd4150){var _0x50cc35=_[_0x074d('0x2f')](_0xd4150,function(_0xbc9b19){return Number(_0xbc9b19[_0x074d('0x63')]);});return db['UserChatQueue'][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'ChatQueueId':{'$in':_0x50cc35}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x157fdc='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db[_0x074d('0x56')]['query'](_0x157fdc,{'type':db[_0x074d('0x58')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x25835a});})['then'](function(_0x5e93fb){var _0x21af8b=_['map'](_0x5e93fb,function(_0x1a3724){return Number(_0x1a3724['FaxQueueId']);});return db[_0x074d('0x64')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'FaxQueueId':{'$in':_0x21af8b}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0xecd57e='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db[_0x074d('0x56')][_0x074d('0x33')](_0xecd57e,{'type':db[_0x074d('0x58')][_0x074d('0x59')][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x1a1e49){var _0x52c080=_[_0x074d('0x2f')](_0x1a1e49,function(_0x37ea35){return Number(_0x37ea35[_0x074d('0x65')]);});return db[_0x074d('0x66')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'OpenchannelQueueId':{'$in':_0x52c080}},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){var _0x3e56b8='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x3ed980;return db['sequelize'][_0x074d('0x33')](_0x3e56b8,{'type':db['Sequelize']['QueryTypes'][_0x074d('0x5a')],'raw':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x24337b){var _0x13b83b=_[_0x074d('0x2f')](_0x24337b,function(_0x282894){return Number(_0x282894[_0x074d('0x67')]);});return db[_0x074d('0x68')][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'WhatsappQueueId':{'$in':_0x13b83b}},'transaction':_0x25835a});})['then'](function(){return db[_0x074d('0x69')]['find']({'where':{'TeamId':_0x3ed980}});})[_0x074d('0x2a')](function(_0x3ae5b9){if(_0x3ae5b9===null){return;}return db['UserVoicePrefix'][_0x074d('0x55')]({'where':{'UserId':{'$in':_0x126348},'VoicePrefixId':_0x3ae5b9[_0x074d('0x6a')]},'transaction':_0x25835a});})[_0x074d('0x2a')](function(){return db[_0x074d('0x30')][_0x074d('0x55')]({'where':{'id':_0x3ed980},'cascade':!![],'transaction':_0x25835a});})[_0x074d('0x2a')](function(_0x180b53){if(_0x180b53===0x0){_0x5093a4[_0x074d('0x1d')](0x194);}else{return db[_0x074d('0x6b')]['destroy']({'where':{'type':_0x074d('0x53'),'resourceId':_0x3ed980},'cascade':!![],'transaction':_0x25835a})[_0x074d('0x2a')](function(){_0x5093a4['status'](0xcc)[_0x074d('0x1f')]();});}})[_0x074d('0x4a')](function(_0x29987c){_0x5093a4['status'](0x1f4)[_0x074d('0x2e')](_0x29987c);});});};exports[_0x074d('0x6c')]=function(_0x1e690a,_0x2de0a1,_0xbfa81){return db[_0x074d('0x30')][_0x074d('0x6d')]({'where':{'id':_0x1e690a['params']['id']}})[_0x074d('0x2a')](handleEntityNotFound(_0x2de0a1,null))[_0x074d('0x2a')](function(_0x18a92e){if(!_0x1e690a['query'][_0x074d('0x6e')]||!utils[_0x074d('0x6f')](_0x1e690a['query'][_0x074d('0x6e')])){throw new db[(_0x074d('0x58'))][(_0x074d('0x70'))](_0x074d('0x71'));}var _0x8a77e5={};var _0x29b82d={};_0x29b82d[_0x074d('0x37')]=_[_0x074d('0x34')](db[_[_0x074d('0x72')](_0x1e690a[_0x074d('0x33')]['channel']['toLowerCase']())+'Queue'][_0x074d('0x31')]);_0x29b82d[_0x074d('0x33')]=_['keys'](_0x1e690a[_0x074d('0x33')]);_0x29b82d['filters']=_[_0x074d('0x36')](_0x29b82d[_0x074d('0x37')],_0x29b82d['query']);_0x8a77e5['attributes']=_['intersection'](_0x29b82d[_0x074d('0x37')],qs[_0x074d('0x39')](_0x1e690a[_0x074d('0x33')][_0x074d('0x39')]));_0x8a77e5[_0x074d('0x38')]=_0x8a77e5['attributes'][_0x074d('0x3a')]?_0x8a77e5[_0x074d('0x38')]:_0x29b82d[_0x074d('0x37')];_0x8a77e5[_0x074d('0x21')]=qs['limit'](_0x1e690a[_0x074d('0x33')][_0x074d('0x21')]);_0x8a77e5[_0x074d('0x3d')]=qs[_0x074d('0x3d')](_0x1e690a[_0x074d('0x33')][_0x074d('0x3d')]);_0x8a77e5[_0x074d('0x3e')]=qs[_0x074d('0x3f')](_0x1e690a[_0x074d('0x33')][_0x074d('0x3f')]);_0x8a77e5['where']=qs['filters'](_['pick'](_0x1e690a[_0x074d('0x33')],_0x29b82d[_0x074d('0x35')]));_0x8a77e5=_['merge']({},_0x8a77e5,_0x1e690a[_0x074d('0x45')]);return _0x18a92e['get'+_[_0x074d('0x72')](_0x1e690a[_0x074d('0x33')]['channel'][_0x074d('0x73')]())+_0x074d('0x74')](_0x8a77e5);})[_0x074d('0x2a')](respondWithResult(_0x2de0a1,null))[_0x074d('0x4a')](handleError(_0x2de0a1,null));};exports[_0x074d('0x75')]=function(_0xa8e08f,_0x48a82e,_0x199089){return db['Team'][_0x074d('0x6d')]({'where':{'id':_0xa8e08f[_0x074d('0x4c')]['id']}})['then'](function(_0x1f957b){if(_0x1f957b){if(!_0xa8e08f[_0x074d('0x54')][_0x074d('0x6e')]||!utils['isValidChannel'](_0xa8e08f[_0x074d('0x54')][_0x074d('0x6e')])){throw new db[(_0x074d('0x58'))][(_0x074d('0x70'))](_0x074d('0x71'));}return _0x1f957b[_0x074d('0x76')+_['capitalize'](_0xa8e08f['body']['channel']['toLowerCase']())+_0x074d('0x74')](_0xa8e08f[_0x074d('0x54')][_0x074d('0x77')]);}return null;})[_0x074d('0x2a')](handleEntityNotFound(_0x48a82e,null))[_0x074d('0x2a')](respondWithStatusCode(_0x48a82e,null))[_0x074d('0x4a')](handleError(_0x48a82e,null));};exports['removeQueues']=function(_0x56e820,_0x1372f7,_0x336694){return db[_0x074d('0x30')][_0x074d('0x6d')]({'where':{'id':_0x56e820[_0x074d('0x4c')]['id']}})['then'](function(_0x4e2aed){if(_0x4e2aed){if(!_0x56e820[_0x074d('0x33')][_0x074d('0x6e')]||!utils[_0x074d('0x6f')](_0x56e820['query'][_0x074d('0x6e')])){throw new db[(_0x074d('0x58'))]['ValidationError'](_0x074d('0x71'));}return _0x4e2aed['remove'+_[_0x074d('0x72')](_0x56e820[_0x074d('0x33')][_0x074d('0x6e')][_0x074d('0x73')]())+_0x074d('0x74')](_0x56e820[_0x074d('0x33')][_0x074d('0x77')]);}return null;})['then'](handleEntityNotFound(_0x1372f7,null))[_0x074d('0x2a')](respondWithStatusCode(_0x1372f7,null))[_0x074d('0x4a')](handleError(_0x1372f7,null));};exports[_0x074d('0x78')]=function(_0x2bf9ef,_0x2a35df){var _0x351db2=_[_0x074d('0x79')](_0x2bf9ef[_0x074d('0x54')][_0x074d('0x77')])?_0x2bf9ef[_0x074d('0x54')]['ids']:[_0x2bf9ef[_0x074d('0x54')][_0x074d('0x77')]];var _0x17b8ff=_0x2bf9ef[_0x074d('0x4c')]['id'];return db[_0x074d('0x30')][_0x074d('0x4d')]({'where':{'id':_0x17b8ff}})[_0x074d('0x2a')](handleEntityNotFound(_0x2a35df,null))[_0x074d('0x2a')](function(_0x651496){if(_0x651496){var _0x56a1bc=[_0x074d('0x7a'),_0x074d('0x7b'),_0x074d('0x7c'),_0x074d('0x7d'),_0x074d('0x7e'),_0x074d('0x7f'),_0x074d('0x80')];return db[_0x074d('0x56')][_0x074d('0x81')](function(_0x2a84af){var _0x589997=_['map'](_0x56a1bc,function(_0x2528af){var _0x565a2b={'attributes':['id','name']};if(_0x2528af===_0x074d('0x7a')){_0x565a2b[_0x074d('0x82')]={'attributes':[_0x074d('0x83')]};}return _0x651496[_0x074d('0x52')+_0x2528af+_0x074d('0x74')](_0x565a2b)[_0x074d('0x2a')](function(_0x1b1044){var _0x288b76=_[_0x074d('0x2f')](_0x1b1044,function(_0x33644b){var _0x3a529f=_[_0x074d('0x2f')](_0x351db2,function(_0x3012ad){var _0xc2e911={'where':{'UserId':_0x3012ad,[_0x2528af+_0x074d('0x84')]:_0x33644b['id']},'transaction':_0x2a84af};if(_0x2528af===_0x074d('0x7a')){_0xc2e911[_0x074d('0x85')]={'penalty':_0x33644b[_0x074d('0x86')]['penalty']};}return db['User'+_0x2528af+'Queue'][_0x074d('0x87')](_0xc2e911)['then'](function(){socket[_0x074d('0x88')](_0x074d('0x4f')+_0x2528af+_0x074d('0x89'),{'UserId':_0x3012ad,[_0x2528af+'QueueId']:_0x33644b['id']});if(_0x2528af!=='Voice'){return;}return db[_0x074d('0x8a')][_0x074d('0x48')]({'where':{'id':_0x351db2,'online':0x1},'attributes':['id',_0x074d('0x2d'),'online',_0x074d('0x8b'),_0x074d('0x8c')],'raw':!![]})['then'](function(_0x354896){var _0x3d2d24=_[_0x074d('0x2f')](_0x354896,function(_0x27434f){return db[_0x074d('0x8d')]['upsert']({'membername':_0x27434f['name'],'UserId':_0x27434f['id'],'queue_name':_0x33644b[_0x074d('0x2d')],'VoiceQueueId':_0x33644b['id'],'interface':_[_0x074d('0x8e')](_0x27434f['interface'])?util[_0x074d('0x8f')](_0x074d('0x90'),_0x27434f['name']):_0x27434f[_0x074d('0x8c')],'paused':_0x27434f[_0x074d('0x8b')]||![],'penalty':_0x33644b[_0x074d('0x86')][_0x074d('0x83')]},{'transaction':_0x2a84af});});return Promise[_0x074d('0x91')](_0x3d2d24);});});});return Promise[_0x074d('0x91')](_0x3a529f);});return Promise[_0x074d('0x91')](_0x288b76);})[_0x074d('0x2a')](function(){return db[_0x074d('0x69')][_0x074d('0x6d')]({'where':{'teamId':_0x17b8ff}})[_0x074d('0x2a')](function(_0x273f51){if(_0x273f51){var _0x4b68b8=_[_0x074d('0x2f')](_0x351db2,function(_0x58a9f6){db[_0x074d('0x92')][_0x074d('0x93')]({'UserId':_0x58a9f6,'VoicePrefixId':_0x273f51[_0x074d('0x6a')]});});return Promise[_0x074d('0x91')](_0x4b68b8);}});});});return Promise[_0x074d('0x91')](_0x589997)[_0x074d('0x2a')](function(){return _0x651496[_0x074d('0x78')](_0x351db2,{'transaction':_0x2a84af})[_0x074d('0x94')](function(_0x367cfc){return _0x367cfc;});});});}})[_0x074d('0x2a')](respondWithResult(_0x2a35df,null))[_0x074d('0x4a')](handleError(_0x2a35df,null));};exports[_0x074d('0x95')]=function(_0x45bce5,_0x5668a4){var _0x176c4f=_[_0x074d('0x79')](_0x45bce5[_0x074d('0x33')][_0x074d('0x77')])?_0x45bce5[_0x074d('0x33')]['ids']:[_0x45bce5['query']['ids']];var _0x976f83=_0x45bce5[_0x074d('0x4c')]['id'];return db[_0x074d('0x30')]['find']({'where':{'id':_0x976f83}})[_0x074d('0x2a')](handleEntityNotFound(_0x5668a4,null))[_0x074d('0x2a')](function(_0x24b8d1){if(_0x24b8d1){var _0x2885c0=['Voice',_0x074d('0x7b'),_0x074d('0x7c'),_0x074d('0x7d'),_0x074d('0x7e'),'Openchannel',_0x074d('0x80')];return db[_0x074d('0x56')][_0x074d('0x81')](function(_0x1b6c53){var _0x4c6ce3=_[_0x074d('0x2f')](_0x2885c0,function(_0x3fff2a){var _0x17329d={'attributes':['id',_0x074d('0x2d')]};return _0x24b8d1[_0x074d('0x52')+_0x3fff2a+_0x074d('0x74')](_0x17329d)['then'](function(_0x1b639a){var _0xc47e25=_[_0x074d('0x2f')](_0x1b639a,function(_0x50063f){return _0x50063f[_0x074d('0x95')](_0x176c4f,{'transaction':_0x1b6c53})[_0x074d('0x2a')](function(){var _0x408f6=_[_0x074d('0x2f')](_0x176c4f,function(_0x33e61c){socket[_0x074d('0x88')](_0x074d('0x4f')+_0x3fff2a+'Queue:remove',{'UserId':Number(_0x33e61c),[_0x3fff2a+_0x074d('0x84')]:_0x50063f['id']});if(_0x3fff2a!==_0x074d('0x7a')){return;}return db['UserVoiceQueueRt'][_0x074d('0x55')]({'where':{'VoiceQueueId':_0x50063f['id'],'UserId':_0x33e61c},'transaction':_0x1b6c53});});return Promise[_0x074d('0x91')](_0x408f6);});});return Promise['all'](_0xc47e25);});});return Promise['all'](_0x4c6ce3)[_0x074d('0x2a')](function(){return _0x24b8d1[_0x074d('0x95')](_0x176c4f,{'transaction':_0x1b6c53});})[_0x074d('0x2a')](function(){return db[_0x074d('0x69')][_0x074d('0x6d')]({'where':{'teamId':_0x976f83}})[_0x074d('0x2a')](function(_0x4deabc){if(_0x4deabc){var _0x14ca0f=_[_0x074d('0x2f')](_0x176c4f,function(_0x2758ae){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x2758ae,'VoicePrefixId':_0x4deabc[_0x074d('0x6a')]}});});return Promise['all'](_0x14ca0f);}});});});}})[_0x074d('0x2a')](respondWithStatusCode(_0x5668a4,null))[_0x074d('0x4a')](handleError(_0x5668a4,null));};exports[_0x074d('0x96')]=function(_0x4f06bb,_0x795255,_0x53e25b){var _0x1affc7={};var _0x120ef5={};var _0x1937b1;var _0x37aa3e;return db['Team'][_0x074d('0x6d')]({'where':{'id':_0x4f06bb['params']['id']}})[_0x074d('0x2a')](handleEntityNotFound(_0x795255,null))['then'](function(_0x159ec6){if(_0x159ec6){_0x1937b1=_0x159ec6;_0x120ef5[_0x074d('0x37')]=_[_0x074d('0x34')](db[_0x074d('0x8a')][_0x074d('0x31')]);_0x120ef5[_0x074d('0x33')]=_[_0x074d('0x34')](_0x4f06bb[_0x074d('0x33')]);_0x120ef5[_0x074d('0x35')]=_[_0x074d('0x36')](_0x120ef5[_0x074d('0x37')],_0x120ef5[_0x074d('0x33')]);_0x1affc7[_0x074d('0x38')]=_['intersection'](_0x120ef5['model'],qs[_0x074d('0x39')](_0x4f06bb['query']['fields']));_0x1affc7['attributes']=_0x1affc7[_0x074d('0x38')][_0x074d('0x3a')]?_0x1affc7[_0x074d('0x38')]:_0x120ef5[_0x074d('0x37')];_0x1affc7[_0x074d('0x3e')]=qs[_0x074d('0x3f')](_0x4f06bb['query'][_0x074d('0x3f')]);_0x1affc7[_0x074d('0x40')]=qs['filters'](_[_0x074d('0x97')](_0x4f06bb['query'],_0x120ef5[_0x074d('0x35')]));if(_0x4f06bb['query']['filter']){_0x1affc7[_0x074d('0x40')]=_[_0x074d('0x44')](_0x1affc7[_0x074d('0x40')],{'$or':_['map'](_0x1affc7['attributes'],function(_0x3897f4){var _0x9008b2={};_0x9008b2[_0x3897f4]={'$like':'%'+_0x4f06bb['query'][_0x074d('0x41')]+'%'};return _0x9008b2;})});}_0x1affc7=_['merge']({},_0x1affc7,_0x4f06bb[_0x074d('0x45')]);return _0x1937b1[_0x074d('0x96')](_0x1affc7);}})['then'](function(_0x22cfaa){if(_0x22cfaa){_0x37aa3e=_0x22cfaa[_0x074d('0x3a')];if(!_0x4f06bb[_0x074d('0x33')][_0x074d('0x3b')]('nolimit')){_0x1affc7[_0x074d('0x21')]=qs[_0x074d('0x21')](_0x4f06bb[_0x074d('0x33')]['limit']);_0x1affc7[_0x074d('0x3d')]=qs['offset'](_0x4f06bb['query'][_0x074d('0x3d')]);}return _0x1937b1[_0x074d('0x96')](_0x1affc7);}})[_0x074d('0x2a')](function(_0x2344d6){if(_0x2344d6){return _0x2344d6?{'count':_0x37aa3e,'rows':_0x2344d6}:null;}})['then'](respondWithResult(_0x795255,null))[_0x074d('0x4a')](handleError(_0x795255,null));}; \ No newline at end of file +var _0x0464=['Sms','Fax','Whatsapp','Queue:remove','UserVoiceQueueRt','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','name','send','index','map','Team','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','merge','where','filter','options','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','Teams','userProfileId','autoAssociation','UserProfileResource','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','SELECT','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','UserSmsQueue','ChatQueueId','UserChatQueue','SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','UserVoicePrefix','VoicePrefixId','getQueues','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','order','sort','pick','toLowerCase','addQueues','add','Queues','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Openchannel','transaction','through','penalty','defaults','User','Queue','emit','Queue:save','QueueId','online','voicePause','interface','upsert','isNil','format','SIP/%s','TeamVoiceQueue','all','TeamVoicePrefix','spread','removeAgents','isArray'];(function(_0x28d225,_0x43be18){var _0x1f79e1=function(_0x362c23){while(--_0x362c23){_0x28d225['push'](_0x28d225['shift']());}};_0x1f79e1(++_0x43be18);}(_0x0464,0xa7));var _0x4046=function(_0x9e2cfe,_0x57d5b9){_0x9e2cfe=_0x9e2cfe-0x0;var _0x1f2d2b=_0x0464[_0x9e2cfe];return _0x1f2d2b;};'use strict';var emlformat=require(_0x4046('0x0'));var rimraf=require(_0x4046('0x1'));var zipdir=require(_0x4046('0x2'));var jsonpatch=require(_0x4046('0x3'));var rp=require(_0x4046('0x4'));var moment=require(_0x4046('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4046('0x6'));var util=require('util');var path=require(_0x4046('0x7'));var sox=require(_0x4046('0x8'));var csv=require(_0x4046('0x9'));var ejs=require(_0x4046('0xa'));var fs=require('fs');var fs_extra=require(_0x4046('0xb'));var _=require('lodash');var squel=require(_0x4046('0xc'));var crypto=require(_0x4046('0xd'));var jsforce=require(_0x4046('0xe'));var deskjs=require(_0x4046('0xf'));var toCsv=require(_0x4046('0x9'));var querystring=require(_0x4046('0x10'));var Papa=require(_0x4046('0x11'));var Redis=require(_0x4046('0x12'));var authService=require(_0x4046('0x13'));var qs=require(_0x4046('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4046('0x15'))(_0x4046('0x16'));var utils=require(_0x4046('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x4046('0x18'))['db'];config[_0x4046('0x19')]=_['defaults'](config[_0x4046('0x19')],{'host':_0x4046('0x1a'),'port':0x18eb});var socket=require(_0x4046('0x1b'))(new Redis(config[_0x4046('0x19')]));require(_0x4046('0x1c'))[_0x4046('0x1d')](socket);function respondWithStatusCode(_0x5963fe,_0x24ee18){_0x24ee18=_0x24ee18||0xcc;return function(_0x46540d){if(_0x46540d){return _0x5963fe[_0x4046('0x1e')](_0x24ee18);}return _0x5963fe[_0x4046('0x1f')](_0x24ee18)[_0x4046('0x20')]();};}function respondWithResult(_0x308c86,_0x19b362){_0x19b362=_0x19b362||0xc8;return function(_0x4cd925){if(_0x4cd925){return _0x308c86[_0x4046('0x1f')](_0x19b362)[_0x4046('0x21')](_0x4cd925);}};}function respondWithFilteredResult(_0x53f6aa,_0x1c0b11){return function(_0x194e3c){if(_0x194e3c){var _0x21d9bc=typeof _0x1c0b11[_0x4046('0x22')]===_0x4046('0x23')&&typeof _0x1c0b11[_0x4046('0x24')]==='undefined';var _0x176362=_0x194e3c[_0x4046('0x25')];var _0x551632=_0x21d9bc?0x0:_0x1c0b11[_0x4046('0x22')];var _0x3a2ea7=_0x21d9bc?_0x194e3c['count']:_0x1c0b11[_0x4046('0x22')]+_0x1c0b11['limit'];var _0x53c888;if(_0x3a2ea7>=_0x176362){_0x3a2ea7=_0x176362;_0x53c888=0xc8;}else{_0x53c888=0xce;}_0x53f6aa[_0x4046('0x1f')](_0x53c888);return _0x53f6aa[_0x4046('0x26')](_0x4046('0x27'),_0x551632+'-'+_0x3a2ea7+'/'+_0x176362)[_0x4046('0x21')](_0x194e3c);}return null;};}function patchUpdates(_0x256a87){return function(_0x16f968){try{jsonpatch[_0x4046('0x28')](_0x16f968,_0x256a87,!![]);}catch(_0x1ef6ef){return BPromise[_0x4046('0x29')](_0x1ef6ef);}return _0x16f968[_0x4046('0x2a')]();};}function saveUpdates(_0x428817,_0x478f55){return function(_0x5bca6b){if(_0x5bca6b){return _0x5bca6b['update'](_0x428817)[_0x4046('0x2b')](function(_0x51b525){return _0x51b525;});}return null;};}function handleEntityNotFound(_0x1a4326,_0x9e76e3){return function(_0x15c259){if(!_0x15c259){_0x1a4326[_0x4046('0x1e')](0x194);}return _0x15c259;};}function handleError(_0x43f69a,_0x18be24){_0x18be24=_0x18be24||0x1f4;return function(_0x1bed2e){logger[_0x4046('0x2c')](_0x1bed2e['stack']);if(_0x1bed2e[_0x4046('0x2d')]){delete _0x1bed2e[_0x4046('0x2d')];}_0x43f69a['status'](_0x18be24)[_0x4046('0x2e')](_0x1bed2e);};}exports[_0x4046('0x2f')]=function(_0x4c8b4c,_0x384929){var _0x50a4f8={},_0x1d663a={},_0x2a3ce5={'count':0x0,'rows':[]};var _0x34aaf9=_[_0x4046('0x30')](db[_0x4046('0x31')][_0x4046('0x32')],function(_0xe1e369){return{'name':_0xe1e369['fieldName'],'type':_0xe1e369[_0x4046('0x33')][_0x4046('0x34')]};});_0x1d663a[_0x4046('0x35')]=_['map'](_0x34aaf9,_0x4046('0x2d'));_0x1d663a[_0x4046('0x36')]=_['keys'](_0x4c8b4c['query']);_0x1d663a[_0x4046('0x37')]=_['intersection'](_0x1d663a[_0x4046('0x35')],_0x1d663a[_0x4046('0x36')]);_0x50a4f8[_0x4046('0x38')]=_[_0x4046('0x39')](_0x1d663a[_0x4046('0x35')],qs[_0x4046('0x3a')](_0x4c8b4c['query'][_0x4046('0x3a')]));_0x50a4f8['attributes']=_0x50a4f8[_0x4046('0x38')][_0x4046('0x3b')]?_0x50a4f8['attributes']:_0x1d663a[_0x4046('0x35')];if(!_0x4c8b4c[_0x4046('0x36')][_0x4046('0x3c')](_0x4046('0x3d'))){_0x50a4f8[_0x4046('0x24')]=qs[_0x4046('0x24')](_0x4c8b4c[_0x4046('0x36')][_0x4046('0x24')]);_0x50a4f8[_0x4046('0x22')]=qs[_0x4046('0x22')](_0x4c8b4c[_0x4046('0x36')][_0x4046('0x22')]);}_0x50a4f8['order']=qs['sort'](_0x4c8b4c[_0x4046('0x36')]['sort']);_0x50a4f8['where']=qs[_0x4046('0x37')](_['pick'](_0x4c8b4c[_0x4046('0x36')],_0x1d663a[_0x4046('0x37')]),_0x34aaf9);if(_0x4c8b4c[_0x4046('0x36')]['filter']){_0x50a4f8['where']=_[_0x4046('0x3e')](_0x50a4f8[_0x4046('0x3f')],{'$or':_[_0x4046('0x30')](_0x34aaf9,function(_0x4ab8d6){if(_0x4ab8d6[_0x4046('0x33')]!=='VIRTUAL'){var _0x4893f3={};_0x4893f3[_0x4ab8d6[_0x4046('0x2d')]]={'$like':'%'+_0x4c8b4c['query'][_0x4046('0x40')]+'%'};return _0x4893f3;}})});}_0x50a4f8=_[_0x4046('0x3e')]({},_0x50a4f8,_0x4c8b4c[_0x4046('0x41')]);var _0x2a2fc5={'where':_0x50a4f8['where']};return db['Team'][_0x4046('0x25')](_0x2a2fc5)[_0x4046('0x2b')](function(_0x217e32){_0x2a3ce5[_0x4046('0x25')]=_0x217e32;if(_0x4c8b4c[_0x4046('0x36')][_0x4046('0x42')]){_0x50a4f8['include']=[{'all':!![]}];}return db['Team'][_0x4046('0x43')](_0x50a4f8);})[_0x4046('0x2b')](function(_0x34f8b0){_0x2a3ce5[_0x4046('0x44')]=_0x34f8b0;return _0x2a3ce5;})['then'](respondWithFilteredResult(_0x384929,_0x50a4f8))['catch'](handleError(_0x384929,null));};exports[_0x4046('0x45')]=function(_0xf7fb37,_0x27e4a3){var _0x284236={'raw':![],'where':{'id':_0xf7fb37[_0x4046('0x46')]['id']}},_0x5416f9={};_0x5416f9['model']=_[_0x4046('0x47')](db['Team'][_0x4046('0x32')]);_0x5416f9[_0x4046('0x36')]=_['keys'](_0xf7fb37['query']);_0x5416f9[_0x4046('0x37')]=_[_0x4046('0x39')](_0x5416f9[_0x4046('0x35')],_0x5416f9['query']);_0x284236[_0x4046('0x38')]=_['intersection'](_0x5416f9[_0x4046('0x35')],qs[_0x4046('0x3a')](_0xf7fb37[_0x4046('0x36')][_0x4046('0x3a')]));_0x284236[_0x4046('0x38')]=_0x284236[_0x4046('0x38')][_0x4046('0x3b')]?_0x284236['attributes']:_0x5416f9['model'];if(_0xf7fb37[_0x4046('0x36')][_0x4046('0x42')]){_0x284236[_0x4046('0x48')]=[{'all':!![]}];}_0x284236=_[_0x4046('0x3e')]({},_0x284236,_0xf7fb37['options']);return db[_0x4046('0x31')][_0x4046('0x49')](_0x284236)['then'](handleEntityNotFound(_0x27e4a3,null))['then'](respondWithResult(_0x27e4a3,null))[_0x4046('0x4a')](handleError(_0x27e4a3,null));};exports['create']=function(_0x5984c1,_0x472738){return db[_0x4046('0x31')][_0x4046('0x4b')](_0x5984c1[_0x4046('0x4c')],{})[_0x4046('0x2b')](function(_0x56adfe){var _0x5a92d9=_0x5984c1[_0x4046('0x4d')]['get']({'plain':!![]});if(!_0x5a92d9)throw new Error(_0x4046('0x4e'));if(_0x5a92d9['role']===_0x4046('0x4d')){var _0x1ae1ad=_0x56adfe[_0x4046('0x4f')]({'plain':!![]});var _0x36d165=_0x4046('0x50');return db['UserProfileSection']['find']({'where':{'name':_0x36d165,'userProfileId':_0x5a92d9[_0x4046('0x51')]},'raw':!![]})['then'](function(_0x46f74f){if(_0x46f74f&&_0x46f74f[_0x4046('0x52')]===0x0){return db[_0x4046('0x53')][_0x4046('0x4b')]({'name':_0x1ae1ad[_0x4046('0x2d')],'resourceId':_0x1ae1ad['id'],'type':_0x46f74f[_0x4046('0x2d')],'sectionId':_0x46f74f['id']},{})['then'](function(){return _0x56adfe;});}else{return _0x56adfe;}})[_0x4046('0x4a')](function(_0x555d57){logger[_0x4046('0x2c')](_0x4046('0x54'),_0x555d57);throw _0x555d57;});}return _0x56adfe;})[_0x4046('0x2b')](respondWithResult(_0x472738,0xc9))['catch'](handleError(_0x472738,null));};exports[_0x4046('0x55')]=function(_0x27afa4,_0x302e19){if(_0x27afa4['body']['id']){delete _0x27afa4[_0x4046('0x4c')]['id'];}return db[_0x4046('0x31')][_0x4046('0x49')]({'where':{'id':_0x27afa4[_0x4046('0x46')]['id']}})[_0x4046('0x2b')](handleEntityNotFound(_0x302e19,null))[_0x4046('0x2b')](saveUpdates(_0x27afa4[_0x4046('0x4c')],null))[_0x4046('0x2b')](respondWithResult(_0x302e19,null))[_0x4046('0x4a')](handleError(_0x302e19,null));};exports[_0x4046('0x56')]=function(_0x2a796d,_0x5e9a2b){var _0x4c6162=_0x2a796d[_0x4046('0x46')]['id'];var _0x26f6ad=[];return db[_0x4046('0x57')]['transaction'](function(_0x3ca96f){var _0x340744=_0x4046('0x58')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x340744,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f})[_0x4046('0x2b')](function(_0x5751c9){_0x26f6ad=_[_0x4046('0x30')](_0x5751c9,function(_0x24e005){return Number(_0x24e005[_0x4046('0x5c')]);});})['then'](function(){var _0x4bd2c4=_0x4046('0x5d')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x4bd2c4,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x5b2c81){var _0xa0d415=_['map'](_0x5b2c81,function(_0x38e3d8){return Number(_0x38e3d8[_0x4046('0x5e')]);});return db[_0x4046('0x5f')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'VoiceQueueId':{'$in':_0xa0d415}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x438755=_0x4046('0x60')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x438755,{'type':db[_0x4046('0x59')]['QueryTypes'][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x2f2c0){var _0x3c98d4=_[_0x4046('0x30')](_0x2f2c0,function(_0x303b71){return Number(_0x303b71[_0x4046('0x61')]);});return db[_0x4046('0x62')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'MailQueueId':{'$in':_0x3c98d4}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x31b753=_0x4046('0x63')+_0x4c6162;return db[_0x4046('0x57')][_0x4046('0x36')](_0x31b753,{'type':db[_0x4046('0x59')]['QueryTypes'][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})['then'](function(_0x4a4acd){var _0x5dc1dd=_[_0x4046('0x30')](_0x4a4acd,function(_0x58f505){return Number(_0x58f505['SmsQueueId']);});return db[_0x4046('0x64')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'SmsQueueId':{'$in':_0x5dc1dd}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x88aeee='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4c6162;return db[_0x4046('0x57')]['query'](_0x88aeee,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x2afb44){var _0x340389=_['map'](_0x2afb44,function(_0x5494de){return Number(_0x5494de[_0x4046('0x65')]);});return db[_0x4046('0x66')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'ChatQueueId':{'$in':_0x340389}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x3aa7f4=_0x4046('0x67')+_0x4c6162;return db['sequelize'][_0x4046('0x36')](_0x3aa7f4,{'type':db[_0x4046('0x59')][_0x4046('0x5a')]['SELECT'],'raw':!![],'transaction':_0x3ca96f});})['then'](function(_0x5d86ae){var _0x139a76=_[_0x4046('0x30')](_0x5d86ae,function(_0x15acdc){return Number(_0x15acdc[_0x4046('0x68')]);});return db[_0x4046('0x69')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'FaxQueueId':{'$in':_0x139a76}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x4dd68d=_0x4046('0x6a')+_0x4c6162;return db['sequelize'][_0x4046('0x36')](_0x4dd68d,{'type':db[_0x4046('0x59')][_0x4046('0x5a')][_0x4046('0x5b')],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x5598e7){var _0x4e2378=_[_0x4046('0x30')](_0x5598e7,function(_0x37ea9b){return Number(_0x37ea9b[_0x4046('0x6b')]);});return db[_0x4046('0x6c')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'OpenchannelQueueId':{'$in':_0x4e2378}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){var _0x5913a0='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0x4c6162;return db['sequelize'][_0x4046('0x36')](_0x5913a0,{'type':db['Sequelize'][_0x4046('0x5a')]['SELECT'],'raw':!![],'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(_0x221365){var _0x18a31f=_['map'](_0x221365,function(_0x3c8b0f){return Number(_0x3c8b0f['WhatsappQueueId']);});return db['UserWhatsappQueue'][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'WhatsappQueueId':{'$in':_0x18a31f}},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){return db['TeamVoicePrefix']['find']({'where':{'TeamId':_0x4c6162}});})[_0x4046('0x2b')](function(_0x3b59e5){if(_0x3b59e5===null){return;}return db[_0x4046('0x6d')][_0x4046('0x56')]({'where':{'UserId':{'$in':_0x26f6ad},'VoicePrefixId':_0x3b59e5[_0x4046('0x6e')]},'transaction':_0x3ca96f});})[_0x4046('0x2b')](function(){return db[_0x4046('0x31')][_0x4046('0x56')]({'where':{'id':_0x4c6162},'cascade':!![],'transaction':_0x3ca96f});})['then'](function(_0x593024){if(_0x593024===0x0){_0x5e9a2b['sendStatus'](0x194);}else{return db[_0x4046('0x53')][_0x4046('0x56')]({'where':{'type':'Teams','resourceId':_0x4c6162},'cascade':!![],'transaction':_0x3ca96f})[_0x4046('0x2b')](function(){_0x5e9a2b[_0x4046('0x1f')](0xcc)[_0x4046('0x20')]();});}})['catch'](function(_0x2f80fc){_0x5e9a2b['status'](0x1f4)[_0x4046('0x2e')](_0x2f80fc);});});};exports[_0x4046('0x6f')]=function(_0x309a91,_0x24505,_0x210b81){return db['Team'][_0x4046('0x70')]({'where':{'id':_0x309a91['params']['id']}})[_0x4046('0x2b')](handleEntityNotFound(_0x24505,null))[_0x4046('0x2b')](function(_0x56bc77){if(!_0x309a91[_0x4046('0x36')][_0x4046('0x71')]||!utils[_0x4046('0x72')](_0x309a91['query'][_0x4046('0x71')])){throw new db[(_0x4046('0x59'))][(_0x4046('0x73'))](_0x4046('0x74'));}var _0xbb9b93={};var _0xb9bf33={};_0xb9bf33[_0x4046('0x35')]=_['keys'](db[_[_0x4046('0x75')](_0x309a91[_0x4046('0x36')][_0x4046('0x71')]['toLowerCase']())+'Queue'][_0x4046('0x32')]);_0xb9bf33[_0x4046('0x36')]=_[_0x4046('0x47')](_0x309a91[_0x4046('0x36')]);_0xb9bf33[_0x4046('0x37')]=_[_0x4046('0x39')](_0xb9bf33['model'],_0xb9bf33[_0x4046('0x36')]);_0xbb9b93[_0x4046('0x38')]=_[_0x4046('0x39')](_0xb9bf33[_0x4046('0x35')],qs[_0x4046('0x3a')](_0x309a91[_0x4046('0x36')][_0x4046('0x3a')]));_0xbb9b93[_0x4046('0x38')]=_0xbb9b93[_0x4046('0x38')][_0x4046('0x3b')]?_0xbb9b93[_0x4046('0x38')]:_0xb9bf33[_0x4046('0x35')];_0xbb9b93['limit']=qs['limit'](_0x309a91[_0x4046('0x36')][_0x4046('0x24')]);_0xbb9b93[_0x4046('0x22')]=qs[_0x4046('0x22')](_0x309a91['query'][_0x4046('0x22')]);_0xbb9b93[_0x4046('0x76')]=qs[_0x4046('0x77')](_0x309a91[_0x4046('0x36')]['sort']);_0xbb9b93[_0x4046('0x3f')]=qs[_0x4046('0x37')](_[_0x4046('0x78')](_0x309a91['query'],_0xb9bf33[_0x4046('0x37')]));_0xbb9b93=_[_0x4046('0x3e')]({},_0xbb9b93,_0x309a91[_0x4046('0x41')]);return _0x56bc77[_0x4046('0x4f')+_[_0x4046('0x75')](_0x309a91[_0x4046('0x36')]['channel'][_0x4046('0x79')]())+'Queues'](_0xbb9b93);})[_0x4046('0x2b')](respondWithResult(_0x24505,null))[_0x4046('0x4a')](handleError(_0x24505,null));};exports[_0x4046('0x7a')]=function(_0x5a279e,_0x46d23e,_0x28552f){return db[_0x4046('0x31')][_0x4046('0x70')]({'where':{'id':_0x5a279e[_0x4046('0x46')]['id']}})[_0x4046('0x2b')](function(_0x3cf5b9){if(_0x3cf5b9){if(!_0x5a279e[_0x4046('0x4c')][_0x4046('0x71')]||!utils[_0x4046('0x72')](_0x5a279e[_0x4046('0x4c')][_0x4046('0x71')])){throw new db[(_0x4046('0x59'))][(_0x4046('0x73'))]('Unknown\x20channel');}return _0x3cf5b9[_0x4046('0x7b')+_[_0x4046('0x75')](_0x5a279e['body']['channel'][_0x4046('0x79')]())+_0x4046('0x7c')](_0x5a279e[_0x4046('0x4c')][_0x4046('0x7d')]);}return null;})[_0x4046('0x2b')](handleEntityNotFound(_0x46d23e,null))[_0x4046('0x2b')](respondWithStatusCode(_0x46d23e,null))[_0x4046('0x4a')](handleError(_0x46d23e,null));};exports[_0x4046('0x7e')]=function(_0x4abd2c,_0x5e2035,_0x4ebe28){return db[_0x4046('0x31')][_0x4046('0x70')]({'where':{'id':_0x4abd2c[_0x4046('0x46')]['id']}})[_0x4046('0x2b')](function(_0x1e5c4a){if(_0x1e5c4a){if(!_0x4abd2c['query'][_0x4046('0x71')]||!utils[_0x4046('0x72')](_0x4abd2c['query']['channel'])){throw new db[(_0x4046('0x59'))][(_0x4046('0x73'))](_0x4046('0x74'));}return _0x1e5c4a[_0x4046('0x7f')+_['capitalize'](_0x4abd2c[_0x4046('0x36')][_0x4046('0x71')][_0x4046('0x79')]())+'Queues'](_0x4abd2c[_0x4046('0x36')][_0x4046('0x7d')]);}return null;})[_0x4046('0x2b')](handleEntityNotFound(_0x5e2035,null))[_0x4046('0x2b')](respondWithStatusCode(_0x5e2035,null))[_0x4046('0x4a')](handleError(_0x5e2035,null));};exports[_0x4046('0x80')]=function(_0x278f4d,_0x19741d){var _0x1dc94b=_['isArray'](_0x278f4d['body']['ids'])?_0x278f4d[_0x4046('0x4c')][_0x4046('0x7d')]:[_0x278f4d[_0x4046('0x4c')][_0x4046('0x7d')]];var _0x4177ea=_0x278f4d['params']['id'];return db[_0x4046('0x31')][_0x4046('0x49')]({'where':{'id':_0x4177ea}})[_0x4046('0x2b')](handleEntityNotFound(_0x19741d,null))[_0x4046('0x2b')](function(_0x213d73){if(_0x213d73){var _0x381509=[_0x4046('0x81'),_0x4046('0x82'),_0x4046('0x83'),'Sms','Fax',_0x4046('0x84'),'Whatsapp'];return db[_0x4046('0x57')][_0x4046('0x85')](function(_0x1cf94f){var _0x2f3916=_['map'](_0x381509,function(_0x1b9718){var _0x5ac9d8={'attributes':['id',_0x4046('0x2d')]};if(_0x1b9718===_0x4046('0x81')){_0x5ac9d8[_0x4046('0x86')]={'attributes':[_0x4046('0x87')]};}return _0x213d73[_0x4046('0x4f')+_0x1b9718+_0x4046('0x7c')](_0x5ac9d8)[_0x4046('0x2b')](function(_0x474b62){var _0x319e3b=_[_0x4046('0x30')](_0x474b62,function(_0x482400){var _0x4e1718=_[_0x4046('0x30')](_0x1dc94b,function(_0x396c1f){var _0x434bbc={'where':{'UserId':_0x396c1f,[_0x1b9718+'QueueId']:_0x482400['id']},'transaction':_0x1cf94f};if(_0x1b9718===_0x4046('0x81')){_0x434bbc[_0x4046('0x88')]={'penalty':_0x482400['TeamVoiceQueue'][_0x4046('0x87')]};}return db[_0x4046('0x89')+_0x1b9718+_0x4046('0x8a')]['findOrCreate'](_0x434bbc)['then'](function(){socket[_0x4046('0x8b')](_0x4046('0x4d')+_0x1b9718+_0x4046('0x8c'),{'UserId':_0x396c1f,[_0x1b9718+_0x4046('0x8d')]:_0x482400['id']});if(_0x1b9718!==_0x4046('0x81')){return;}return db[_0x4046('0x89')][_0x4046('0x43')]({'where':{'id':_0x1dc94b,'online':0x1},'attributes':['id',_0x4046('0x2d'),_0x4046('0x8e'),_0x4046('0x8f'),_0x4046('0x90')],'raw':!![]})['then'](function(_0x6bb5c5){var _0x512884=_[_0x4046('0x30')](_0x6bb5c5,function(_0x2d5499){return db['UserVoiceQueueRt'][_0x4046('0x91')]({'membername':_0x2d5499[_0x4046('0x2d')],'UserId':_0x2d5499['id'],'queue_name':_0x482400['name'],'VoiceQueueId':_0x482400['id'],'interface':_[_0x4046('0x92')](_0x2d5499[_0x4046('0x90')])?util[_0x4046('0x93')](_0x4046('0x94'),_0x2d5499[_0x4046('0x2d')]):_0x2d5499['interface'],'paused':_0x2d5499[_0x4046('0x8f')]||![],'penalty':_0x482400[_0x4046('0x95')]['penalty']},{'transaction':_0x1cf94f});});return Promise[_0x4046('0x96')](_0x512884);});});});return Promise[_0x4046('0x96')](_0x4e1718);});return Promise[_0x4046('0x96')](_0x319e3b);})[_0x4046('0x2b')](function(){return db[_0x4046('0x97')][_0x4046('0x70')]({'where':{'teamId':_0x4177ea}})[_0x4046('0x2b')](function(_0x5dd456){if(_0x5dd456){var _0x1cd02b=_[_0x4046('0x30')](_0x1dc94b,function(_0x2feb16){db['UserVoicePrefix'][_0x4046('0x91')]({'UserId':_0x2feb16,'VoicePrefixId':_0x5dd456[_0x4046('0x6e')]});});return Promise[_0x4046('0x96')](_0x1cd02b);}});});});return Promise[_0x4046('0x96')](_0x2f3916)['then'](function(){return _0x213d73['addAgents'](_0x1dc94b,{'transaction':_0x1cf94f})[_0x4046('0x98')](function(_0x1bbe1d){return _0x1bbe1d;});});});}})[_0x4046('0x2b')](respondWithResult(_0x19741d,null))[_0x4046('0x4a')](handleError(_0x19741d,null));};exports[_0x4046('0x99')]=function(_0x5ec768,_0x44cd3a){var _0x2abccc=_[_0x4046('0x9a')](_0x5ec768[_0x4046('0x36')][_0x4046('0x7d')])?_0x5ec768[_0x4046('0x36')]['ids']:[_0x5ec768[_0x4046('0x36')][_0x4046('0x7d')]];var _0x569f46=_0x5ec768[_0x4046('0x46')]['id'];return db[_0x4046('0x31')]['find']({'where':{'id':_0x569f46}})['then'](handleEntityNotFound(_0x44cd3a,null))[_0x4046('0x2b')](function(_0x4d83f3){if(_0x4d83f3){var _0x350a66=[_0x4046('0x81'),'Chat','Mail',_0x4046('0x9b'),_0x4046('0x9c'),_0x4046('0x84'),_0x4046('0x9d')];return db[_0x4046('0x57')][_0x4046('0x85')](function(_0x8f39ee){var _0x567eba=_[_0x4046('0x30')](_0x350a66,function(_0x34def5){var _0x3a9a1c={'attributes':['id',_0x4046('0x2d')]};return _0x4d83f3[_0x4046('0x4f')+_0x34def5+_0x4046('0x7c')](_0x3a9a1c)[_0x4046('0x2b')](function(_0x10404f){var _0xfaec3a=_[_0x4046('0x30')](_0x10404f,function(_0x1f009b){return _0x1f009b['removeAgents'](_0x2abccc,{'transaction':_0x8f39ee})[_0x4046('0x2b')](function(){var _0x2ccd64=_[_0x4046('0x30')](_0x2abccc,function(_0x175730){socket[_0x4046('0x8b')](_0x4046('0x4d')+_0x34def5+_0x4046('0x9e'),{'UserId':Number(_0x175730),[_0x34def5+'QueueId']:_0x1f009b['id']});if(_0x34def5!=='Voice'){return;}return db[_0x4046('0x9f')][_0x4046('0x56')]({'where':{'VoiceQueueId':_0x1f009b['id'],'UserId':_0x175730},'transaction':_0x8f39ee});});return Promise[_0x4046('0x96')](_0x2ccd64);});});return Promise[_0x4046('0x96')](_0xfaec3a);});});return Promise['all'](_0x567eba)[_0x4046('0x2b')](function(){return _0x4d83f3[_0x4046('0x99')](_0x2abccc,{'transaction':_0x8f39ee});})[_0x4046('0x2b')](function(){return db[_0x4046('0x97')][_0x4046('0x70')]({'where':{'teamId':_0x569f46}})['then'](function(_0x80c777){if(_0x80c777){var _0x2f04df=_[_0x4046('0x30')](_0x2abccc,function(_0x10f767){db[_0x4046('0x6d')][_0x4046('0x56')]({'where':{'UserId':_0x10f767,'VoicePrefixId':_0x80c777[_0x4046('0x6e')]}});});return Promise[_0x4046('0x96')](_0x2f04df);}});});});}})[_0x4046('0x2b')](respondWithStatusCode(_0x44cd3a,null))[_0x4046('0x4a')](handleError(_0x44cd3a,null));};exports[_0x4046('0xa0')]=function(_0x37ff16,_0x42d1c1,_0x55e17f){var _0x4902a6={};var _0x46f3e1={};var _0x4c976c;var _0x3ba3fb;return db['Team'][_0x4046('0x70')]({'where':{'id':_0x37ff16[_0x4046('0x46')]['id']}})['then'](handleEntityNotFound(_0x42d1c1,null))[_0x4046('0x2b')](function(_0x29e8f1){if(_0x29e8f1){_0x4c976c=_0x29e8f1;_0x46f3e1[_0x4046('0x35')]=_[_0x4046('0x47')](db[_0x4046('0x89')]['rawAttributes']);_0x46f3e1['query']=_['keys'](_0x37ff16[_0x4046('0x36')]);_0x46f3e1[_0x4046('0x37')]=_[_0x4046('0x39')](_0x46f3e1[_0x4046('0x35')],_0x46f3e1[_0x4046('0x36')]);_0x4902a6[_0x4046('0x38')]=_[_0x4046('0x39')](_0x46f3e1[_0x4046('0x35')],qs['fields'](_0x37ff16['query'][_0x4046('0x3a')]));_0x4902a6[_0x4046('0x38')]=_0x4902a6[_0x4046('0x38')][_0x4046('0x3b')]?_0x4902a6['attributes']:_0x46f3e1['model'];_0x4902a6[_0x4046('0x76')]=qs[_0x4046('0x77')](_0x37ff16[_0x4046('0x36')][_0x4046('0x77')]);_0x4902a6[_0x4046('0x3f')]=qs[_0x4046('0x37')](_['pick'](_0x37ff16[_0x4046('0x36')],_0x46f3e1[_0x4046('0x37')]));if(_0x37ff16[_0x4046('0x36')][_0x4046('0x40')]){_0x4902a6[_0x4046('0x3f')]=_['merge'](_0x4902a6['where'],{'$or':_[_0x4046('0x30')](_0x4902a6[_0x4046('0x38')],function(_0x2ab051){var _0x3aff21={};_0x3aff21[_0x2ab051]={'$like':'%'+_0x37ff16[_0x4046('0x36')][_0x4046('0x40')]+'%'};return _0x3aff21;})});}_0x4902a6=_[_0x4046('0x3e')]({},_0x4902a6,_0x37ff16[_0x4046('0x41')]);return _0x4c976c[_0x4046('0xa0')](_0x4902a6);}})[_0x4046('0x2b')](function(_0x3466d6){if(_0x3466d6){_0x3ba3fb=_0x3466d6[_0x4046('0x3b')];if(!_0x37ff16['query'][_0x4046('0x3c')](_0x4046('0x3d'))){_0x4902a6[_0x4046('0x24')]=qs['limit'](_0x37ff16[_0x4046('0x36')][_0x4046('0x24')]);_0x4902a6['offset']=qs[_0x4046('0x22')](_0x37ff16[_0x4046('0x36')][_0x4046('0x22')]);}return _0x4c976c[_0x4046('0xa0')](_0x4902a6);}})['then'](function(_0x5bbb6e){if(_0x5bbb6e){return _0x5bbb6e?{'count':_0x3ba3fb,'rows':_0x5bbb6e}:null;}})[_0x4046('0x2b')](respondWithResult(_0x42d1c1,null))[_0x4046('0x4a')](handleError(_0x42d1c1,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 433830a..df37165 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 _0x9cc8=['emit','hasOwnProperty','hook','exports','events','Team','save','update','remove'];(function(_0x1dae99,_0x4207dc){var _0x1cda0c=function(_0x50d809){while(--_0x50d809){_0x1dae99['push'](_0x1dae99['shift']());}};_0x1cda0c(++_0x4207dc);}(_0x9cc8,0x163));var _0x89cc=function(_0x1042e8,_0x4c744c){_0x1042e8=_0x1042e8-0x0;var _0x33c1a4=_0x9cc8[_0x1042e8];return _0x33c1a4;};'use strict';var EventEmitter=require(_0x89cc('0x0'));var Team=require('../../mysqldb')['db'][_0x89cc('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x89cc('0x2'),'afterUpdate':_0x89cc('0x3'),'afterDestroy':_0x89cc('0x4')};function emitEvent(_0x38dd49){return function(_0x1c9d45,_0x4df11e,_0x121d0d){TeamEvents[_0x89cc('0x5')](_0x38dd49+':'+_0x1c9d45['id'],_0x1c9d45);TeamEvents[_0x89cc('0x5')](_0x38dd49,_0x1c9d45);_0x121d0d(null);};}for(var e in events){if(events[_0x89cc('0x6')](e)){var event=events[e];Team[_0x89cc('0x7')](e,emitEvent(event));}}module[_0x89cc('0x8')]=TeamEvents; \ No newline at end of file +var _0xc9ca=['Team','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xc9ca,0x116));var _0xac9c=function(_0x7b173,_0x539d7f){_0x7b173=_0x7b173-0x0;var _0x1c598c=_0xc9ca[_0x7b173];return _0x1c598c;};'use strict';var EventEmitter=require(_0xac9c('0x0'));var Team=require(_0xac9c('0x1'))['db'][_0xac9c('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0xac9c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac9c('0x4'),'afterDestroy':_0xac9c('0x5')};function emitEvent(_0x41e9de){return function(_0x343a27,_0x326cf8,_0x1e7862){TeamEvents[_0xac9c('0x6')](_0x41e9de+':'+_0x343a27['id'],_0x343a27);TeamEvents[_0xac9c('0x6')](_0x41e9de,_0x343a27);_0x1e7862(null);};}for(var e in events){if(events[_0xac9c('0x7')](e)){var event=events[e];Team[_0xac9c('0x8')](e,emitEvent(event));}}module[_0xac9c('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 2660aec..8f974a3 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 _0x030c=['Fax','Sms','Voice','Whatsapp','resolve','map','all','lodash','./team.attributes','get','Queues','then','setDataValue','catch','define','Team','teams','Chat'];(function(_0x2b5c3a,_0x3ad701){var _0x42b9a3=function(_0x42f1c3){while(--_0x42f1c3){_0x2b5c3a['push'](_0x2b5c3a['shift']());}};_0x42b9a3(++_0x3ad701);}(_0x030c,0x85));var _0xc030=function(_0xc38772,_0x43a24a){_0xc38772=_0xc38772-0x0;var _0x38a0cb=_0x030c[_0xc38772];return _0x38a0cb;};'use strict';var _=require(_0xc030('0x0'));var attributes=require(_0xc030('0x1'));function getQueuesByChannel(_0x2481ab,_0x40e000){var _0x1e5939=_0xc030('0x2')+_0x40e000+_0xc030('0x3');return _0x2481ab[_0x1e5939]()[_0xc030('0x4')](function(_0x4cad74){return _['map'](_0x4cad74,function(_0x2282c3){_0x2282c3[_0xc030('0x5')]('channel',_0x40e000);return _0x2282c3;});})[_0xc030('0x6')](function(_0x1b1dcc){throw _0x1b1dcc;});}module['exports']=function(_0x241fc2){return _0x241fc2[_0xc030('0x7')](_0xc030('0x8'),attributes,{'tableName':_0xc030('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x49e8e9=this;var _0x2d9835=[_0xc030('0xa'),_0xc030('0xb'),'Mail','Openchannel',_0xc030('0xc'),_0xc030('0xd'),_0xc030('0xe')];return Promise[_0xc030('0xf')]()[_0xc030('0x4')](function(){var _0x533f76=_[_0xc030('0x10')](_0x2d9835,function(_0x485bc2){return getQueuesByChannel(_0x49e8e9,_0x485bc2);});return Promise[_0xc030('0x11')](_0x533f76);})[_0xc030('0x6')](function(_0x44c52f){throw _0x44c52f;});}}});}; \ No newline at end of file +var _0x3888=['Fax','Mail','Openchannel','Sms','Voice','all','get','then','map','catch','exports','teams','Chat'];(function(_0x525da4,_0x1c9133){var _0x588c1c=function(_0x2b180d){while(--_0x2b180d){_0x525da4['push'](_0x525da4['shift']());}};_0x588c1c(++_0x1c9133);}(_0x3888,0x1e7));var _0x8388=function(_0x19a46d,_0x4a66f8){_0x19a46d=_0x19a46d-0x0;var _0x43402e=_0x3888[_0x19a46d];return _0x43402e;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x4b2245,_0x7739b6){var _0x2c862b=_0x8388('0x0')+_0x7739b6+'Queues';return _0x4b2245[_0x2c862b]()[_0x8388('0x1')](function(_0x19505f){return _[_0x8388('0x2')](_0x19505f,function(_0x284cb3){_0x284cb3['setDataValue']('channel',_0x7739b6);return _0x284cb3;});})[_0x8388('0x3')](function(_0x268542){throw _0x268542;});}module[_0x8388('0x4')]=function(_0x5cb719){return _0x5cb719['define']('Team',attributes,{'tableName':_0x8388('0x5'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x29dd3f=this;var _0x4f8f31=[_0x8388('0x6'),_0x8388('0x7'),_0x8388('0x8'),_0x8388('0x9'),_0x8388('0xa'),_0x8388('0xb'),'Whatsapp'];return Promise['resolve']()[_0x8388('0x1')](function(){var _0x469ab2=_[_0x8388('0x2')](_0x4f8f31,function(_0x1bc625){return getQueuesByChannel(_0x29dd3f,_0x1bc625);});return Promise[_0x8388('0xc')](_0x469ab2);})[_0x8388('0x3')](function(_0x35088c){throw _0x35088c;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index f045087..4c2b066 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 _0xbc29=['socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','redis'];(function(_0x3a038b,_0x472807){var _0x331b5e=function(_0x47e383){while(--_0x47e383){_0x3a038b['push'](_0x3a038b['shift']());}};_0x331b5e(++_0x472807);}(_0xbc29,0xad));var _0x9bc2=function(_0x3759ba,_0x3b32da){_0x3759ba=_0x3759ba-0x0;var _0x45eec5=_0xbc29[_0x3759ba];return _0x45eec5;};'use strict';var _=require('lodash');var util=require(_0x9bc2('0x0'));var moment=require(_0x9bc2('0x1'));var BPromise=require(_0x9bc2('0x2'));var rs=require(_0x9bc2('0x3'));var fs=require('fs');var Redis=require(_0x9bc2('0x4'));var db=require(_0x9bc2('0x5'))['db'];var utils=require(_0x9bc2('0x6'));var logger=require('../../config/logger')(_0x9bc2('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x9bc2('0x8')][_0x9bc2('0x9')]({'port':0x232a});config[_0x9bc2('0xa')]=_['defaults'](config[_0x9bc2('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x9bc2('0xb'))(new Redis(config[_0x9bc2('0xa')]));require('./team.socket')[_0x9bc2('0xc')](socket);function respondWithRpcPromise(_0x1d6a4a,_0xae8e71,_0x464603){return new BPromise(function(_0x103bf8,_0x427ddb){return client[_0x9bc2('0xd')](_0x1d6a4a,_0x464603)[_0x9bc2('0xe')](function(_0x496bc9){logger[_0x9bc2('0xf')](_0x9bc2('0x10'),_0xae8e71,_0x9bc2('0x11'));logger['debug'](_0x9bc2('0x12'),_0xae8e71,_0x9bc2('0x11'),JSON[_0x9bc2('0x13')](_0x496bc9));if(_0x496bc9[_0x9bc2('0x14')]){if(_0x496bc9['error']['code']===0x1f4){logger[_0x9bc2('0x14')](_0x9bc2('0x10'),_0xae8e71,_0x496bc9[_0x9bc2('0x14')][_0x9bc2('0x15')]);return _0x427ddb(_0x496bc9['error'][_0x9bc2('0x15')]);}logger[_0x9bc2('0x14')](_0x9bc2('0x10'),_0xae8e71,_0x496bc9[_0x9bc2('0x14')]['message']);return _0x103bf8(_0x496bc9[_0x9bc2('0x14')][_0x9bc2('0x15')]);}else{logger[_0x9bc2('0xf')]('Team,\x20%s,\x20%s',_0xae8e71,_0x9bc2('0x11'));_0x103bf8(_0x496bc9[_0x9bc2('0x16')][_0x9bc2('0x15')]);}})['catch'](function(_0x15cd42){logger[_0x9bc2('0x14')](_0x9bc2('0x10'),_0xae8e71,_0x15cd42);_0x427ddb(_0x15cd42);});});} \ No newline at end of file +var _0x8c7b=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','Team,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c7b,0xb6));var _0xb8c7=function(_0x561f60,_0x598be3){_0x561f60=_0x561f60-0x0;var _0x35194e=_0x8c7b[_0x561f60];return _0x35194e;};'use strict';var _=require(_0xb8c7('0x0'));var util=require(_0xb8c7('0x1'));var moment=require('moment');var BPromise=require(_0xb8c7('0x2'));var rs=require(_0xb8c7('0x3'));var fs=require('fs');var Redis=require(_0xb8c7('0x4'));var db=require(_0xb8c7('0x5'))['db'];var utils=require(_0xb8c7('0x6'));var logger=require(_0xb8c7('0x7'))(_0xb8c7('0x8'));var config=require(_0xb8c7('0x9'));var jayson=require(_0xb8c7('0xa'));var client=jayson[_0xb8c7('0xb')][_0xb8c7('0xc')]({'port':0x232a});config[_0xb8c7('0xd')]=_[_0xb8c7('0xe')](config['redis'],{'host':_0xb8c7('0xf'),'port':0x18eb});var socket=require(_0xb8c7('0x10'))(new Redis(config[_0xb8c7('0xd')]));require(_0xb8c7('0x11'))['register'](socket);function respondWithRpcPromise(_0x30f7e5,_0x542b86,_0x188a2e){return new BPromise(function(_0xdab8df,_0xa5851d){return client['request'](_0x30f7e5,_0x188a2e)['then'](function(_0x2df93c){logger['info'](_0xb8c7('0x12'),_0x542b86,_0xb8c7('0x13'));logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x542b86,_0xb8c7('0x13'),JSON['stringify'](_0x2df93c));if(_0x2df93c[_0xb8c7('0x14')]){if(_0x2df93c['error'][_0xb8c7('0x15')]===0x1f4){logger['error'](_0xb8c7('0x12'),_0x542b86,_0x2df93c['error'][_0xb8c7('0x16')]);return _0xa5851d(_0x2df93c[_0xb8c7('0x14')][_0xb8c7('0x16')]);}logger[_0xb8c7('0x14')](_0xb8c7('0x12'),_0x542b86,_0x2df93c['error'][_0xb8c7('0x16')]);return _0xdab8df(_0x2df93c[_0xb8c7('0x14')][_0xb8c7('0x16')]);}else{logger['info'](_0xb8c7('0x12'),_0x542b86,_0xb8c7('0x13'));_0xdab8df(_0x2df93c[_0xb8c7('0x17')][_0xb8c7('0x16')]);}})['catch'](function(_0x50fc12){logger[_0xb8c7('0x14')]('Team,\x20%s,\x20%s',_0x542b86,_0x50fc12);_0xa5851d(_0x50fc12);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 5992749..d68ba86 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 _0x22fb=['save','remove','emit','removeListener','register','length','team:','./team.events'];(function(_0x24c135,_0xdb4450){var _0x290c66=function(_0x537cf8){while(--_0x537cf8){_0x24c135['push'](_0x24c135['shift']());}};_0x290c66(++_0xdb4450);}(_0x22fb,0x18f));var _0xb22f=function(_0x3f6913,_0x335b4a){_0x3f6913=_0x3f6913-0x0;var _0x4486f3=_0x22fb[_0x3f6913];return _0x4486f3;};'use strict';var TeamEvents=require(_0xb22f('0x0'));var events=[_0xb22f('0x1'),_0xb22f('0x2'),'update'];function createListener(_0x2b5587,_0x3ba8e1){return function(_0x51a5b6){_0x3ba8e1[_0xb22f('0x3')](_0x2b5587,_0x51a5b6);};}function removeListener(_0x1936df,_0x16a46e){return function(){TeamEvents[_0xb22f('0x4')](_0x1936df,_0x16a46e);};}exports[_0xb22f('0x5')]=function(_0x179f8a){for(var _0x3485cd=0x0,_0x5bf93a=events[_0xb22f('0x6')];_0x3485cd<_0x5bf93a;_0x3485cd++){var _0x5e1f1b=events[_0x3485cd];var _0x5465c5=createListener(_0xb22f('0x7')+_0x5e1f1b,_0x179f8a);TeamEvents['on'](_0x5e1f1b,_0x5465c5);}}; \ No newline at end of file +var _0xe9ff=['length','team:','update','emit','removeListener','register'];(function(_0x230a05,_0x551883){var _0x235b93=function(_0x538ff0){while(--_0x538ff0){_0x230a05['push'](_0x230a05['shift']());}};_0x235b93(++_0x551883);}(_0xe9ff,0x17c));var _0xfe9f=function(_0x5aaf23,_0x311f9c){_0x5aaf23=_0x5aaf23-0x0;var _0x4d6d3f=_0xe9ff[_0x5aaf23];return _0x4d6d3f;};'use strict';var TeamEvents=require('./team.events');var events=['save','remove',_0xfe9f('0x0')];function createListener(_0x5d9f8c,_0x3bd6ea){return function(_0xfb3bf3){_0x3bd6ea[_0xfe9f('0x1')](_0x5d9f8c,_0xfb3bf3);};}function removeListener(_0x15cd60,_0x4226ce){return function(){TeamEvents[_0xfe9f('0x2')](_0x15cd60,_0x4226ce);};}exports[_0xfe9f('0x3')]=function(_0x5f9833){for(var _0xe96c92=0x0,_0x53767c=events[_0xfe9f('0x4')];_0xe96c92<_0x53767c;_0xe96c92++){var _0x4e4857=events[_0xe96c92];var _0x4a837d=createListener(_0xfe9f('0x5')+_0x4e4857,_0x5f9833);TeamEvents['on'](_0x4e4857,_0x4a837d);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 469381e..16dd6fd 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 _0xea67=['INTEGER','sequelize','exports'];(function(_0x116aef,_0x1033b2){var _0x17d01c=function(_0x169e42){while(--_0x169e42){_0x116aef['push'](_0x116aef['shift']());}};_0x17d01c(++_0x1033b2);}(_0xea67,0x172));var _0x7ea6=function(_0x11f0a6,_0x1ce59d){_0x11f0a6=_0x11f0a6-0x0;var _0xa5ab4b=_0xea67[_0x11f0a6];return _0xa5ab4b;};'use strict';var Sequelize=require(_0x7ea6('0x0'));module[_0x7ea6('0x1')]={'TeamId':{'type':Sequelize[_0x7ea6('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x7ea6('0x2')]}}; \ No newline at end of file +var _0x41bb=['exports','INTEGER','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x41bb,0xc5));var _0xb41b=function(_0x8e440d,_0x30602c){_0x8e440d=_0x8e440d-0x0;var _0x37d5ec=_0x41bb[_0x8e440d];return _0x37d5ec;};'use strict';var Sequelize=require(_0xb41b('0x0'));module[_0xb41b('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xb41b('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 0359e8d..2b4bba4 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 _0x24cf=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','TeamVoicePrefix','../../config/logger'];(function(_0x36fc47,_0x354b21){var _0x1867fc=function(_0x566509){while(--_0x566509){_0x36fc47['push'](_0x36fc47['shift']());}};_0x1867fc(++_0x354b21);}(_0x24cf,0x1d5));var _0xf24c=function(_0x29178e,_0x5c15fd){_0x29178e=_0x29178e-0x0;var _0x1744d0=_0x24cf[_0x29178e];return _0x1744d0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf24c('0x0'))(_0xf24c('0x1'));var moment=require(_0xf24c('0x2'));var BPromise=require(_0xf24c('0x3'));var rp=require(_0xf24c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf24c('0x5'));var config=require(_0xf24c('0x6'));var attributes=require(_0xf24c('0x7'));module[_0xf24c('0x8')]=function(_0x5c4ebc,_0x4983e2){return _0x5c4ebc['define'](_0xf24c('0x9'),attributes,{'tableName':'team_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x138d=['api','moment','bluebird','request-promise','path','rimraf','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util'];(function(_0x15def9,_0x33453b){var _0x613ec4=function(_0x5ab902){while(--_0x5ab902){_0x15def9['push'](_0x15def9['shift']());}};_0x613ec4(++_0x33453b);}(_0x138d,0x1ab));var _0xd138=function(_0x21090b,_0x39dd3b){_0x21090b=_0x21090b-0x0;var _0x3c68d7=_0x138d[_0x21090b];return _0x3c68d7;};'use strict';var _=require(_0xd138('0x0'));var util=require(_0xd138('0x1'));var logger=require('../../config/logger')(_0xd138('0x2'));var moment=require(_0xd138('0x3'));var BPromise=require(_0xd138('0x4'));var rp=require(_0xd138('0x5'));var fs=require('fs');var path=require(_0xd138('0x6'));var rimraf=require(_0xd138('0x7'));var config=require('../../config/environment');var attributes=require(_0xd138('0x8'));module[_0xd138('0x9')]=function(_0x343962,_0x54f02e){return _0x343962[_0xd138('0xa')](_0xd138('0xb'),attributes,{'tableName':_0xd138('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index c608973..cd8bf40 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30f2cc,_0x275d9b){var _0x208f56=function(_0x56adc0){while(--_0x56adc0){_0x30f2cc['push'](_0x30f2cc['shift']());}};_0x208f56(++_0x275d9b);}(_0xe706,0xa3));var _0x6e70=function(_0x450b2a,_0x174591){_0x450b2a=_0x450b2a-0x0;var _0x37a7ff=_0xe706[_0x450b2a];return _0x37a7ff;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x24ec6f,_0x1de736){var _0x2b3d05=function(_0x1d5215){while(--_0x1d5215){_0x24ec6f['push'](_0x24ec6f['shift']());}};_0x2b3d05(++_0x1de736);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));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 1a83b65..c99eaa0 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 _0x16dc=['exports'];(function(_0x17f5b1,_0x46ae49){var _0x4c139c=function(_0x421703){while(--_0x421703){_0x17f5b1['push'](_0x17f5b1['shift']());}};_0x4c139c(++_0x46ae49);}(_0x16dc,0xe3));var _0xc16d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x16dc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc16d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x072d=['sequelize','INTEGER'];(function(_0x382782,_0x152ce1){var _0x1a1313=function(_0x229ef7){while(--_0x229ef7){_0x382782['push'](_0x382782['shift']());}};_0x1a1313(++_0x152ce1);}(_0x072d,0x1d0));var _0xd072=function(_0x555725,_0x533bfe){_0x555725=_0x555725-0x0;var _0x50df8d=_0x072d[_0x555725];return _0x50df8d;};'use strict';var Sequelize=require(_0xd072('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd072('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 23b98e5..570f2af 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 _0x2a3a=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x97ab47,_0x5cdab2){var _0x2d291f=function(_0x14f4fd){while(--_0x14f4fd){_0x97ab47['push'](_0x97ab47['shift']());}};_0x2d291f(++_0x5cdab2);}(_0x2a3a,0x1bf));var _0xa2a3=function(_0x524190,_0x468d06){_0x524190=_0x524190-0x0;var _0x898064=_0x2a3a[_0x524190];return _0x898064;};'use strict';var _=require(_0xa2a3('0x0'));var util=require(_0xa2a3('0x1'));var logger=require(_0xa2a3('0x2'))(_0xa2a3('0x3'));var moment=require(_0xa2a3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa2a3('0x5'));var rimraf=require(_0xa2a3('0x6'));var config=require(_0xa2a3('0x7'));var attributes=require(_0xa2a3('0x8'));module[_0xa2a3('0x9')]=function(_0xf652d7,_0x186655){return _0xf652d7['define'](_0xa2a3('0xa'),attributes,{'tableName':_0xa2a3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['team_has_voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes'];(function(_0x45d1fa,_0x2ff76f){var _0x380621=function(_0x1fd143){while(--_0x1fd143){_0x45d1fa['push'](_0x45d1fa['shift']());}};_0x380621(++_0x2ff76f);}(_0x70e0,0x17b));var _0x070e=function(_0x3a3560,_0xe08396){_0x3a3560=_0x3a3560-0x0;var _0x53e6a3=_0x70e0[_0x3a3560];return _0x53e6a3;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('TeamVoiceQueue',attributes,{'tableName':_0x070e('0x8'),'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 ca5257d..af6130c 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 _0x7072=['../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7072,0x8e));var _0x2707=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7072[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2707('0x3'));var db=require(_0x2707('0x4'))['db'];var utils=require(_0x2707('0x5'));var logger=require('../../config/logger')(_0x2707('0x6'));var config=require(_0x2707('0x7'));var jayson=require(_0x2707('0x8'));var client=jayson[_0x2707('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54facf,_0x155b7f,_0x431013){return new BPromise(function(_0x27cca2,_0x475b50){return client[_0x2707('0xa')](_0x54facf,_0x431013)[_0x2707('0xb')](function(_0x853f7f){logger[_0x2707('0xc')](_0x2707('0xd'),_0x155b7f,_0x2707('0xe'));logger[_0x2707('0xf')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x155b7f,'request\x20sent',JSON['stringify'](_0x853f7f));if(_0x853f7f[_0x2707('0x10')]){if(_0x853f7f[_0x2707('0x10')][_0x2707('0x11')]===0x1f4){logger[_0x2707('0x10')](_0x2707('0xd'),_0x155b7f,_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);return _0x475b50(_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);}logger[_0x2707('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x155b7f,_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);return _0x27cca2(_0x853f7f[_0x2707('0x10')][_0x2707('0x12')]);}else{logger[_0x2707('0xc')](_0x2707('0xd'),_0x155b7f,_0x2707('0xe'));_0x27cca2(_0x853f7f[_0x2707('0x13')]['message']);}})[_0x2707('0x14')](function(_0x363809){logger[_0x2707('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x155b7f,_0x363809);_0x475b50(_0x363809);});});} \ No newline at end of file +var _0xec6b=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','request'];(function(_0x4e9de8,_0x4d17cf){var _0x4fdc06=function(_0x4dd45f){while(--_0x4dd45f){_0x4e9de8['push'](_0x4e9de8['shift']());}};_0x4fdc06(++_0x4d17cf);}(_0xec6b,0x129));var _0xbec6=function(_0x477710,_0x16174a){_0x477710=_0x477710-0x0;var _0x2e8240=_0xec6b[_0x477710];return _0x2e8240;};'use strict';var _=require(_0xbec6('0x0'));var util=require(_0xbec6('0x1'));var moment=require('moment');var BPromise=require(_0xbec6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbec6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbec6('0x4'));var logger=require(_0xbec6('0x5'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x51c972,_0x6d3729,_0x5df981){return new BPromise(function(_0x58edd9,_0x3a0c1c){return client[_0xbec6('0x6')](_0x51c972,_0x5df981)[_0xbec6('0x7')](function(_0x3fff36){logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,_0xbec6('0xa'));logger[_0xbec6('0xb')](_0xbec6('0xc'),_0x6d3729,_0xbec6('0xa'),JSON[_0xbec6('0xd')](_0x3fff36));if(_0x3fff36[_0xbec6('0xe')]){if(_0x3fff36['error'][_0xbec6('0xf')]===0x1f4){logger['error'](_0xbec6('0x9'),_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x3a0c1c(_0x3fff36[_0xbec6('0xe')]['message']);}logger[_0xbec6('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x6d3729,_0x3fff36[_0xbec6('0xe')]['message']);return _0x58edd9(_0x3fff36[_0xbec6('0xe')][_0xbec6('0x10')]);}else{logger[_0xbec6('0x8')](_0xbec6('0x9'),_0x6d3729,'request\x20sent');_0x58edd9(_0x3fff36[_0xbec6('0x11')]['message']);}})[_0xbec6('0x12')](function(_0x20924c){logger[_0xbec6('0xe')](_0xbec6('0x9'),_0x6d3729,_0x20924c);_0x3a0c1c(_0x20924c);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 847df79..bc253b8 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 _0x68fd=['index','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated'];(function(_0x55fb6b,_0x9eb0e0){var _0x42ba9f=function(_0x33472f){while(--_0x33472f){_0x55fb6b['push'](_0x55fb6b['shift']());}};_0x42ba9f(++_0x9eb0e0);}(_0x68fd,0x1e9));var _0xd68f=function(_0x342168,_0x39482e){_0x342168=_0x342168-0x0;var _0x121e6e=_0x68fd[_0x342168];return _0x121e6e;};'use strict';var multer=require(_0xd68f('0x0'));var util=require('util');var path=require(_0xd68f('0x1'));var timeout=require(_0xd68f('0x2'));var express=require('express');var router=express[_0xd68f('0x3')]();var fs_extra=require(_0xd68f('0x4'));var auth=require(_0xd68f('0x5'));var interaction=require(_0xd68f('0x6'));var config=require(_0xd68f('0x7'));var controller=require(_0xd68f('0x8'));router[_0xd68f('0x9')]('/',auth[_0xd68f('0xa')](),controller[_0xd68f('0xb')]);router['get'](_0xd68f('0xc'),auth[_0xd68f('0xa')](),controller[_0xd68f('0xd')]);router[_0xd68f('0xe')]('/',auth[_0xd68f('0xa')](),controller[_0xd68f('0xf')]);router[_0xd68f('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xd68f('0x11')]);router['delete'](_0xd68f('0xc'),auth[_0xd68f('0xa')](),controller[_0xd68f('0x12')]);module[_0xd68f('0x13')]=router; \ No newline at end of file +var _0xd959=['put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x3a3340,_0x16867e){var _0x16b573=function(_0x236632){while(--_0x236632){_0x3a3340['push'](_0x3a3340['shift']());}};_0x16b573(++_0x16867e);}(_0xd959,0x94));var _0x9d95=function(_0x3d278f,_0x5db7ba){_0x3d278f=_0x3d278f-0x0;var _0x33261a=_0xd959[_0x3d278f];return _0x33261a;};'use strict';var multer=require(_0x9d95('0x0'));var util=require(_0x9d95('0x1'));var path=require(_0x9d95('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d95('0x3'));var router=express[_0x9d95('0x4')]();var fs_extra=require(_0x9d95('0x5'));var auth=require(_0x9d95('0x6'));var interaction=require(_0x9d95('0x7'));var config=require('../../config/environment');var controller=require(_0x9d95('0x8'));router[_0x9d95('0x9')]('/',auth[_0x9d95('0xa')](),controller[_0x9d95('0xb')]);router['get'](_0x9d95('0xc'),auth[_0x9d95('0xa')](),controller[_0x9d95('0xd')]);router['post']('/',auth[_0x9d95('0xa')](),controller['create']);router[_0x9d95('0xe')](_0x9d95('0xc'),auth[_0x9d95('0xa')](),controller[_0x9d95('0xf')]);router[_0x9d95('0x10')]('/:id',auth[_0x9d95('0xa')](),controller[_0x9d95('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 0a53241..63e28cd 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 _0xcd64=['sequelize','exports','TEXT'];(function(_0x18be96,_0x15e628){var _0x4b9baa=function(_0x2791b9){while(--_0x2791b9){_0x18be96['push'](_0x18be96['shift']());}};_0x4b9baa(++_0x15e628);}(_0xcd64,0x99));var _0x4cd6=function(_0x185938,_0x56eb82){_0x185938=_0x185938-0x0;var _0x268108=_0xcd64[_0x185938];return _0x268108;};'use strict';var Sequelize=require(_0x4cd6('0x0'));module[_0x4cd6('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x4cd6('0x2')]}}; \ No newline at end of file +var _0x1275=['exports','STRING','TEXT','sequelize'];(function(_0x23f687,_0x2f63a7){var _0x5f4aa2=function(_0x2b6689){while(--_0x2b6689){_0x23f687['push'](_0x23f687['shift']());}};_0x5f4aa2(++_0x2f63a7);}(_0x1275,0x107));var _0x5127=function(_0x4e54ab,_0x1f12ef){_0x4e54ab=_0x4e54ab-0x0;var _0x344b55=_0x1275[_0x4e54ab];return _0x344b55;};'use strict';var Sequelize=require(_0x5127('0x0'));module[_0x5127('0x1')]={'name':{'type':Sequelize[_0x5127('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x5127('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 00cd880..249fcb3 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 _0xc8ca=['path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','get','Templates','UserProfileResource','error','name','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','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','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc8ca,0x13d));var _0xac8c=function(_0x6f128b,_0x59ccd4){_0x6f128b=_0x6f128b-0x0;var _0xd8045=_0xc8ca[_0x6f128b];return _0xd8045;};'use strict';var emlformat=require(_0xac8c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac8c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xac8c('0x2'));var moment=require(_0xac8c('0x3'));var BPromise=require(_0xac8c('0x4'));var Mustache=require(_0xac8c('0x5'));var util=require(_0xac8c('0x6'));var path=require(_0xac8c('0x7'));var sox=require('sox');var csv=require(_0xac8c('0x8'));var ejs=require(_0xac8c('0x9'));var fs=require('fs');var fs_extra=require(_0xac8c('0xa'));var _=require(_0xac8c('0xb'));var squel=require(_0xac8c('0xc'));var crypto=require(_0xac8c('0xd'));var jsforce=require(_0xac8c('0xe'));var deskjs=require(_0xac8c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xac8c('0x10'));var Papa=require(_0xac8c('0x11'));var Redis=require('ioredis');var authService=require(_0xac8c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xac8c('0x13'));var hardwareService=require(_0xac8c('0x14'));var logger=require(_0xac8c('0x15'))(_0xac8c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xac8c('0x17'))['db'];function respondWithStatusCode(_0xa16866,_0x2daf17){_0x2daf17=_0x2daf17||0xcc;return function(_0x308cf0){if(_0x308cf0){return _0xa16866[_0xac8c('0x18')](_0x2daf17);}return _0xa16866[_0xac8c('0x19')](_0x2daf17)['end']();};}function respondWithResult(_0xf49fb9,_0x3e45d4){_0x3e45d4=_0x3e45d4||0xc8;return function(_0x51bbea){if(_0x51bbea){return _0xf49fb9[_0xac8c('0x19')](_0x3e45d4)[_0xac8c('0x1a')](_0x51bbea);}};}function respondWithFilteredResult(_0xd21033,_0x165d3b){return function(_0x548684){if(_0x548684){var _0x4e5ab4=typeof _0x165d3b[_0xac8c('0x1b')]==='undefined'&&typeof _0x165d3b[_0xac8c('0x1c')]===_0xac8c('0x1d');var _0x495dcc=_0x548684[_0xac8c('0x1e')];var _0x1060da=_0x4e5ab4?0x0:_0x165d3b[_0xac8c('0x1b')];var _0x45d5bd=_0x4e5ab4?_0x548684[_0xac8c('0x1e')]:_0x165d3b[_0xac8c('0x1b')]+_0x165d3b[_0xac8c('0x1c')];var _0x2f4ba7;if(_0x45d5bd>=_0x495dcc){_0x45d5bd=_0x495dcc;_0x2f4ba7=0xc8;}else{_0x2f4ba7=0xce;}_0xd21033['status'](_0x2f4ba7);return _0xd21033[_0xac8c('0x1f')](_0xac8c('0x20'),_0x1060da+'-'+_0x45d5bd+'/'+_0x495dcc)[_0xac8c('0x1a')](_0x548684);}return null;};}function patchUpdates(_0x2367e0){return function(_0x1ad29b){try{jsonpatch[_0xac8c('0x21')](_0x1ad29b,_0x2367e0,!![]);}catch(_0x1198e1){return BPromise[_0xac8c('0x22')](_0x1198e1);}return _0x1ad29b['save']();};}function saveUpdates(_0x7d6b6b,_0x4ac441){return function(_0x5c4e94){if(_0x5c4e94){return _0x5c4e94[_0xac8c('0x23')](_0x7d6b6b)[_0xac8c('0x24')](function(_0x1039c4){return _0x1039c4;});}return null;};}function removeEntity(_0x59724d,_0x4b1c95){return function(_0x3bb547){if(_0x3bb547){return _0x3bb547[_0xac8c('0x25')]()[_0xac8c('0x24')](function(){var _0x2bc452=_0x3bb547[_0xac8c('0x26')]({'plain':!![]});var _0x55cc65=_0xac8c('0x27');return db[_0xac8c('0x28')][_0xac8c('0x25')]({'where':{'type':_0x55cc65,'resourceId':_0x2bc452['id']}})[_0xac8c('0x24')](function(){return _0x3bb547;});})[_0xac8c('0x24')](function(){_0x59724d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1580b6,_0x2ecc6b){return function(_0x3c3776){if(!_0x3c3776){_0x1580b6['sendStatus'](0x194);}return _0x3c3776;};}function handleError(_0x487567,_0x33ffa1){_0x33ffa1=_0x33ffa1||0x1f4;return function(_0x268351){logger[_0xac8c('0x29')](_0x268351['stack']);if(_0x268351[_0xac8c('0x2a')]){delete _0x268351[_0xac8c('0x2a')];}_0x487567[_0xac8c('0x19')](_0x33ffa1)['send'](_0x268351);};}exports['index']=function(_0x211559,_0x4fa612){var _0x3c7a87={},_0x4dd7e4={},_0x3a7ae4={'count':0x0,'rows':[]};var _0x537148=_[_0xac8c('0x2b')](db[_0xac8c('0x2c')][_0xac8c('0x2d')],function(_0xb39554){return{'name':_0xb39554[_0xac8c('0x2e')],'type':_0xb39554[_0xac8c('0x2f')][_0xac8c('0x30')]};});_0x4dd7e4['model']=_[_0xac8c('0x2b')](_0x537148,'name');_0x4dd7e4[_0xac8c('0x31')]=_[_0xac8c('0x32')](_0x211559[_0xac8c('0x31')]);_0x4dd7e4[_0xac8c('0x33')]=_[_0xac8c('0x34')](_0x4dd7e4[_0xac8c('0x35')],_0x4dd7e4[_0xac8c('0x31')]);_0x3c7a87[_0xac8c('0x36')]=_[_0xac8c('0x34')](_0x4dd7e4[_0xac8c('0x35')],qs['fields'](_0x211559[_0xac8c('0x31')][_0xac8c('0x37')]));_0x3c7a87[_0xac8c('0x36')]=_0x3c7a87[_0xac8c('0x36')]['length']?_0x3c7a87['attributes']:_0x4dd7e4[_0xac8c('0x35')];if(!_0x211559[_0xac8c('0x31')]['hasOwnProperty'](_0xac8c('0x38'))){_0x3c7a87[_0xac8c('0x1c')]=qs[_0xac8c('0x1c')](_0x211559['query'][_0xac8c('0x1c')]);_0x3c7a87[_0xac8c('0x1b')]=qs[_0xac8c('0x1b')](_0x211559[_0xac8c('0x31')][_0xac8c('0x1b')]);}_0x3c7a87[_0xac8c('0x39')]=qs[_0xac8c('0x3a')](_0x211559[_0xac8c('0x31')][_0xac8c('0x3a')]);_0x3c7a87[_0xac8c('0x3b')]=qs[_0xac8c('0x33')](_[_0xac8c('0x3c')](_0x211559[_0xac8c('0x31')],_0x4dd7e4[_0xac8c('0x33')]),_0x537148);if(_0x211559['query']['filter']){_0x3c7a87[_0xac8c('0x3b')]=_[_0xac8c('0x3d')](_0x3c7a87[_0xac8c('0x3b')],{'$or':_[_0xac8c('0x2b')](_0x537148,function(_0x338bd0){if(_0x338bd0['type']!==_0xac8c('0x3e')){var _0x10ce35={};_0x10ce35[_0x338bd0[_0xac8c('0x2a')]]={'$like':'%'+_0x211559[_0xac8c('0x31')][_0xac8c('0x3f')]+'%'};return _0x10ce35;}})});}_0x3c7a87=_[_0xac8c('0x3d')]({},_0x3c7a87,_0x211559[_0xac8c('0x40')]);var _0x380139={'where':_0x3c7a87[_0xac8c('0x3b')]};return db[_0xac8c('0x2c')][_0xac8c('0x1e')](_0x380139)[_0xac8c('0x24')](function(_0x48fe30){_0x3a7ae4['count']=_0x48fe30;if(_0x211559[_0xac8c('0x31')][_0xac8c('0x41')]){_0x3c7a87[_0xac8c('0x42')]=[{'all':!![]}];}return db['Template'][_0xac8c('0x43')](_0x3c7a87);})[_0xac8c('0x24')](function(_0x4f1670){_0x3a7ae4[_0xac8c('0x44')]=_0x4f1670;return _0x3a7ae4;})['then'](respondWithFilteredResult(_0x4fa612,_0x3c7a87))[_0xac8c('0x45')](handleError(_0x4fa612,null));};exports[_0xac8c('0x46')]=function(_0x24d402,_0x4835fc){var _0xb86596={'raw':!![],'where':{'id':_0x24d402[_0xac8c('0x47')]['id']}},_0x166e5d={};_0x166e5d[_0xac8c('0x35')]=_[_0xac8c('0x32')](db['Template'][_0xac8c('0x2d')]);_0x166e5d[_0xac8c('0x31')]=_[_0xac8c('0x32')](_0x24d402['query']);_0x166e5d[_0xac8c('0x33')]=_['intersection'](_0x166e5d[_0xac8c('0x35')],_0x166e5d[_0xac8c('0x31')]);_0xb86596[_0xac8c('0x36')]=_[_0xac8c('0x34')](_0x166e5d['model'],qs['fields'](_0x24d402[_0xac8c('0x31')][_0xac8c('0x37')]));_0xb86596['attributes']=_0xb86596[_0xac8c('0x36')]['length']?_0xb86596['attributes']:_0x166e5d[_0xac8c('0x35')];if(_0x24d402['query'][_0xac8c('0x41')]){_0xb86596[_0xac8c('0x42')]=[{'all':!![]}];}_0xb86596=_[_0xac8c('0x3d')]({},_0xb86596,_0x24d402[_0xac8c('0x40')]);return db[_0xac8c('0x2c')][_0xac8c('0x48')](_0xb86596)['then'](handleEntityNotFound(_0x4835fc,null))[_0xac8c('0x24')](respondWithResult(_0x4835fc,null))[_0xac8c('0x45')](handleError(_0x4835fc,null));};exports['create']=function(_0x557c3f,_0x4ebb87){return db['Template'][_0xac8c('0x49')](_0x557c3f[_0xac8c('0x4a')],{})['then'](function(_0x1b0396){var _0x9b1a59=_0x557c3f[_0xac8c('0x4b')][_0xac8c('0x26')]({'plain':!![]});if(!_0x9b1a59)throw new Error(_0xac8c('0x4c'));if(_0x9b1a59[_0xac8c('0x4d')]===_0xac8c('0x4b')){var _0x4273a9=_0x1b0396[_0xac8c('0x26')]({'plain':!![]});var _0x3659c4=_0xac8c('0x27');return db[_0xac8c('0x4e')][_0xac8c('0x48')]({'where':{'name':_0x3659c4,'userProfileId':_0x9b1a59['userProfileId']},'raw':!![]})[_0xac8c('0x24')](function(_0x40a79e){if(_0x40a79e&&_0x40a79e[_0xac8c('0x4f')]===0x0){return db[_0xac8c('0x28')][_0xac8c('0x49')]({'name':_0x4273a9[_0xac8c('0x2a')],'resourceId':_0x4273a9['id'],'type':_0x40a79e[_0xac8c('0x2a')],'sectionId':_0x40a79e['id']},{})['then'](function(){return _0x1b0396;});}else{return _0x1b0396;}})[_0xac8c('0x45')](function(_0x18b92c){logger[_0xac8c('0x29')](_0xac8c('0x50'),_0x18b92c);throw _0x18b92c;});}return _0x1b0396;})[_0xac8c('0x24')](respondWithResult(_0x4ebb87,0xc9))['catch'](handleError(_0x4ebb87,null));};exports[_0xac8c('0x23')]=function(_0x1fc9b6,_0x3bc5d5){if(_0x1fc9b6['body']['id']){delete _0x1fc9b6['body']['id'];}return db[_0xac8c('0x2c')][_0xac8c('0x48')]({'where':{'id':_0x1fc9b6['params']['id']}})[_0xac8c('0x24')](handleEntityNotFound(_0x3bc5d5,null))[_0xac8c('0x24')](saveUpdates(_0x1fc9b6[_0xac8c('0x4a')],null))[_0xac8c('0x24')](respondWithResult(_0x3bc5d5,null))[_0xac8c('0x45')](handleError(_0x3bc5d5,null));};exports['destroy']=function(_0xc89ee8,_0x231ce0){return db[_0xac8c('0x2c')][_0xac8c('0x48')]({'where':{'id':_0xc89ee8[_0xac8c('0x47')]['id']}})[_0xac8c('0x24')](handleEntityNotFound(_0x231ce0,null))[_0xac8c('0x24')](removeEntity(_0x231ce0,null))['catch'](handleError(_0x231ce0,null));}; \ No newline at end of file +var _0x3c5e=['../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','get','Templates','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','key','keys','intersection','query','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','Template','findAll','rows','catch','show','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0x9647da,_0x1f7117){var _0x25c414=function(_0x260ce6){while(--_0x260ce6){_0x9647da['push'](_0x9647da['shift']());}};_0x25c414(++_0x1f7117);}(_0x3c5e,0x91));var _0xe3c5=function(_0x2699ed,_0x5043c9){_0x2699ed=_0x2699ed-0x0;var _0x5d4179=_0x3c5e[_0x2699ed];return _0x5d4179;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe3c5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe3c5('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xe3c5('0x2'));var util=require(_0xe3c5('0x3'));var path=require('path');var sox=require(_0xe3c5('0x4'));var csv=require('to-csv');var ejs=require(_0xe3c5('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe3c5('0x6'));var squel=require(_0xe3c5('0x7'));var crypto=require(_0xe3c5('0x8'));var jsforce=require(_0xe3c5('0x9'));var deskjs=require(_0xe3c5('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe3c5('0xb'));var Redis=require(_0xe3c5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0xe3c5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe3c5('0xe'));var logger=require('../../config/logger')(_0xe3c5('0xf'));var utils=require(_0xe3c5('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xe3c5('0x11'));var db=require(_0xe3c5('0x12'))['db'];function respondWithStatusCode(_0x344b30,_0x5ec895){_0x5ec895=_0x5ec895||0xcc;return function(_0x195d75){if(_0x195d75){return _0x344b30[_0xe3c5('0x13')](_0x5ec895);}return _0x344b30[_0xe3c5('0x14')](_0x5ec895)['end']();};}function respondWithResult(_0x3a6191,_0x4e0371){_0x4e0371=_0x4e0371||0xc8;return function(_0x5388e5){if(_0x5388e5){return _0x3a6191[_0xe3c5('0x14')](_0x4e0371)[_0xe3c5('0x15')](_0x5388e5);}};}function respondWithFilteredResult(_0x49dc2e,_0x10eeea){return function(_0x496c9a){if(_0x496c9a){var _0xf69d16=typeof _0x10eeea[_0xe3c5('0x16')]==='undefined'&&typeof _0x10eeea['limit']===_0xe3c5('0x17');var _0x131134=_0x496c9a[_0xe3c5('0x18')];var _0xe66274=_0xf69d16?0x0:_0x10eeea[_0xe3c5('0x16')];var _0x51d724=_0xf69d16?_0x496c9a[_0xe3c5('0x18')]:_0x10eeea['offset']+_0x10eeea[_0xe3c5('0x19')];var _0x35fd0d;if(_0x51d724>=_0x131134){_0x51d724=_0x131134;_0x35fd0d=0xc8;}else{_0x35fd0d=0xce;}_0x49dc2e['status'](_0x35fd0d);return _0x49dc2e[_0xe3c5('0x1a')](_0xe3c5('0x1b'),_0xe66274+'-'+_0x51d724+'/'+_0x131134)['json'](_0x496c9a);}return null;};}function patchUpdates(_0x1023b2){return function(_0xb8096e){try{jsonpatch['apply'](_0xb8096e,_0x1023b2,!![]);}catch(_0x615d71){return BPromise[_0xe3c5('0x1c')](_0x615d71);}return _0xb8096e['save']();};}function saveUpdates(_0x2c1f41,_0x43006d){return function(_0x10b29b){if(_0x10b29b){return _0x10b29b[_0xe3c5('0x1d')](_0x2c1f41)[_0xe3c5('0x1e')](function(_0x361c78){return _0x361c78;});}return null;};}function removeEntity(_0x4a238a,_0x3fc587){return function(_0x255501){if(_0x255501){return _0x255501[_0xe3c5('0x1f')]()[_0xe3c5('0x1e')](function(){var _0x98545=_0x255501[_0xe3c5('0x20')]({'plain':!![]});var _0x5687e9=_0xe3c5('0x21');return db[_0xe3c5('0x22')][_0xe3c5('0x1f')]({'where':{'type':_0x5687e9,'resourceId':_0x98545['id']}})[_0xe3c5('0x1e')](function(){return _0x255501;});})['then'](function(){_0x4a238a[_0xe3c5('0x14')](0xcc)[_0xe3c5('0x23')]();});}};}function handleEntityNotFound(_0x4f77e3,_0x4a83c0){return function(_0x1a2ef5){if(!_0x1a2ef5){_0x4f77e3['sendStatus'](0x194);}return _0x1a2ef5;};}function handleError(_0x1b91ac,_0x5b7336){_0x5b7336=_0x5b7336||0x1f4;return function(_0x54f3f3){logger['error'](_0x54f3f3['stack']);if(_0x54f3f3[_0xe3c5('0x24')]){delete _0x54f3f3[_0xe3c5('0x24')];}_0x1b91ac[_0xe3c5('0x14')](_0x5b7336)[_0xe3c5('0x25')](_0x54f3f3);};}exports[_0xe3c5('0x26')]=function(_0x5e4029,_0x2cc380){var _0x3f5dee={},_0x58df90={},_0x42832a={'count':0x0,'rows':[]};var _0x166ef1=_[_0xe3c5('0x27')](db['Template'][_0xe3c5('0x28')],function(_0x1e1b2d){return{'name':_0x1e1b2d[_0xe3c5('0x29')],'type':_0x1e1b2d['type'][_0xe3c5('0x2a')]};});_0x58df90['model']=_[_0xe3c5('0x27')](_0x166ef1,'name');_0x58df90['query']=_[_0xe3c5('0x2b')](_0x5e4029['query']);_0x58df90['filters']=_[_0xe3c5('0x2c')](_0x58df90['model'],_0x58df90[_0xe3c5('0x2d')]);_0x3f5dee[_0xe3c5('0x2e')]=_[_0xe3c5('0x2c')](_0x58df90[_0xe3c5('0x2f')],qs[_0xe3c5('0x30')](_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x30')]));_0x3f5dee[_0xe3c5('0x2e')]=_0x3f5dee[_0xe3c5('0x2e')][_0xe3c5('0x31')]?_0x3f5dee[_0xe3c5('0x2e')]:_0x58df90[_0xe3c5('0x2f')];if(!_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x32')](_0xe3c5('0x33'))){_0x3f5dee[_0xe3c5('0x19')]=qs[_0xe3c5('0x19')](_0x5e4029[_0xe3c5('0x2d')]['limit']);_0x3f5dee[_0xe3c5('0x16')]=qs['offset'](_0x5e4029[_0xe3c5('0x2d')]['offset']);}_0x3f5dee[_0xe3c5('0x34')]=qs[_0xe3c5('0x35')](_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x35')]);_0x3f5dee[_0xe3c5('0x36')]=qs[_0xe3c5('0x37')](_[_0xe3c5('0x38')](_0x5e4029[_0xe3c5('0x2d')],_0x58df90[_0xe3c5('0x37')]),_0x166ef1);if(_0x5e4029[_0xe3c5('0x2d')]['filter']){_0x3f5dee[_0xe3c5('0x36')]=_[_0xe3c5('0x39')](_0x3f5dee[_0xe3c5('0x36')],{'$or':_[_0xe3c5('0x27')](_0x166ef1,function(_0x26648e){if(_0x26648e[_0xe3c5('0x3a')]!==_0xe3c5('0x3b')){var _0x357037={};_0x357037[_0x26648e[_0xe3c5('0x24')]]={'$like':'%'+_0x5e4029[_0xe3c5('0x2d')][_0xe3c5('0x3c')]+'%'};return _0x357037;}})});}_0x3f5dee=_[_0xe3c5('0x39')]({},_0x3f5dee,_0x5e4029[_0xe3c5('0x3d')]);var _0x26b789={'where':_0x3f5dee[_0xe3c5('0x36')]};return db[_0xe3c5('0x3e')][_0xe3c5('0x18')](_0x26b789)[_0xe3c5('0x1e')](function(_0x3ad226){_0x42832a[_0xe3c5('0x18')]=_0x3ad226;if(_0x5e4029[_0xe3c5('0x2d')]['includeAll']){_0x3f5dee['include']=[{'all':!![]}];}return db[_0xe3c5('0x3e')][_0xe3c5('0x3f')](_0x3f5dee);})[_0xe3c5('0x1e')](function(_0x5ef6b2){_0x42832a[_0xe3c5('0x40')]=_0x5ef6b2;return _0x42832a;})['then'](respondWithFilteredResult(_0x2cc380,_0x3f5dee))[_0xe3c5('0x41')](handleError(_0x2cc380,null));};exports[_0xe3c5('0x42')]=function(_0x14a44f,_0x32a995){var _0x5c99f6={'raw':!![],'where':{'id':_0x14a44f[_0xe3c5('0x43')]['id']}},_0x56f03f={};_0x56f03f[_0xe3c5('0x2f')]=_[_0xe3c5('0x2b')](db[_0xe3c5('0x3e')]['rawAttributes']);_0x56f03f[_0xe3c5('0x2d')]=_['keys'](_0x14a44f[_0xe3c5('0x2d')]);_0x56f03f[_0xe3c5('0x37')]=_[_0xe3c5('0x2c')](_0x56f03f['model'],_0x56f03f[_0xe3c5('0x2d')]);_0x5c99f6[_0xe3c5('0x2e')]=_[_0xe3c5('0x2c')](_0x56f03f['model'],qs[_0xe3c5('0x30')](_0x14a44f[_0xe3c5('0x2d')]['fields']));_0x5c99f6[_0xe3c5('0x2e')]=_0x5c99f6['attributes']['length']?_0x5c99f6[_0xe3c5('0x2e')]:_0x56f03f[_0xe3c5('0x2f')];if(_0x14a44f[_0xe3c5('0x2d')][_0xe3c5('0x44')]){_0x5c99f6[_0xe3c5('0x45')]=[{'all':!![]}];}_0x5c99f6=_['merge']({},_0x5c99f6,_0x14a44f[_0xe3c5('0x3d')]);return db['Template']['find'](_0x5c99f6)[_0xe3c5('0x1e')](handleEntityNotFound(_0x32a995,null))[_0xe3c5('0x1e')](respondWithResult(_0x32a995,null))['catch'](handleError(_0x32a995,null));};exports[_0xe3c5('0x46')]=function(_0xb58def,_0xaff2df){return db[_0xe3c5('0x3e')]['create'](_0xb58def[_0xe3c5('0x47')],{})[_0xe3c5('0x1e')](function(_0x47d8fe){var _0x3e40f2=_0xb58def[_0xe3c5('0x48')][_0xe3c5('0x20')]({'plain':!![]});if(!_0x3e40f2)throw new Error(_0xe3c5('0x49'));if(_0x3e40f2[_0xe3c5('0x4a')]===_0xe3c5('0x48')){var _0x576d4a=_0x47d8fe[_0xe3c5('0x20')]({'plain':!![]});var _0x177ee8=_0xe3c5('0x21');return db[_0xe3c5('0x4b')][_0xe3c5('0x4c')]({'where':{'name':_0x177ee8,'userProfileId':_0x3e40f2['userProfileId']},'raw':!![]})[_0xe3c5('0x1e')](function(_0x449d30){if(_0x449d30&&_0x449d30['autoAssociation']===0x0){return db['UserProfileResource'][_0xe3c5('0x46')]({'name':_0x576d4a[_0xe3c5('0x24')],'resourceId':_0x576d4a['id'],'type':_0x449d30['name'],'sectionId':_0x449d30['id']},{})[_0xe3c5('0x1e')](function(){return _0x47d8fe;});}else{return _0x47d8fe;}})[_0xe3c5('0x41')](function(_0x551e00){logger[_0xe3c5('0x4d')](_0xe3c5('0x4e'),_0x551e00);throw _0x551e00;});}return _0x47d8fe;})['then'](respondWithResult(_0xaff2df,0xc9))[_0xe3c5('0x41')](handleError(_0xaff2df,null));};exports[_0xe3c5('0x1d')]=function(_0x14148e,_0x375738){if(_0x14148e[_0xe3c5('0x47')]['id']){delete _0x14148e[_0xe3c5('0x47')]['id'];}return db['Template'][_0xe3c5('0x4c')]({'where':{'id':_0x14148e[_0xe3c5('0x43')]['id']}})[_0xe3c5('0x1e')](handleEntityNotFound(_0x375738,null))['then'](saveUpdates(_0x14148e['body'],null))[_0xe3c5('0x1e')](respondWithResult(_0x375738,null))[_0xe3c5('0x41')](handleError(_0x375738,null));};exports['destroy']=function(_0x49a7ee,_0x50a298){return db[_0xe3c5('0x3e')][_0xe3c5('0x4c')]({'where':{'id':_0x49a7ee[_0xe3c5('0x43')]['id']}})[_0xe3c5('0x1e')](handleEntityNotFound(_0x50a298,null))[_0xe3c5('0x1e')](removeEntity(_0x50a298,null))[_0xe3c5('0x41')](handleError(_0x50a298,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index f666d51..5c6e293 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 _0x5175=['./template.attributes','exports','Template','tools_templates','lodash','util','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x12a2a6,_0x374ff1){var _0x1754ae=function(_0x49d787){while(--_0x49d787){_0x12a2a6['push'](_0x12a2a6['shift']());}};_0x1754ae(++_0x374ff1);}(_0x5175,0xe0));var _0x5517=function(_0x2ee935,_0x1f940c){_0x2ee935=_0x2ee935-0x0;var _0x3c960e=_0x5175[_0x2ee935];return _0x3c960e;};'use strict';var _=require(_0x5517('0x0'));var util=require(_0x5517('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5517('0x2'));var BPromise=require(_0x5517('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5517('0x4'));var rimraf=require(_0x5517('0x5'));var config=require(_0x5517('0x6'));var attributes=require(_0x5517('0x7'));module[_0x5517('0x8')]=function(_0x3cbee8,_0x1611db){return _0x3cbee8['define'](_0x5517('0x9'),attributes,{'tableName':_0x5517('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedfa=['path','rimraf','./template.attributes','define','tools_templates','util','api','bluebird','request-promise'];(function(_0x1a8f8d,_0x422e91){var _0x35bbc1=function(_0x148343){while(--_0x148343){_0x1a8f8d['push'](_0x1a8f8d['shift']());}};_0x35bbc1(++_0x422e91);}(_0xedfa,0xdd));var _0xaedf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xedfa[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xaedf('0x0'));var logger=require('../../config/logger')(_0xaedf('0x1'));var moment=require('moment');var BPromise=require(_0xaedf('0x2'));var rp=require(_0xaedf('0x3'));var fs=require('fs');var path=require(_0xaedf('0x4'));var rimraf=require(_0xaedf('0x5'));var config=require('../../config/environment');var attributes=require(_0xaedf('0x6'));module['exports']=function(_0x19d0f4,_0x2926c9){return _0x19d0f4[_0xaedf('0x7')]('Template',attributes,{'tableName':_0xaedf('0x8'),'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 8562357..24c406c 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 _0xf693=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetTemplate','Template','options','raw','where','attributes','limit','include','map','model','then'];(function(_0x4e0878,_0x5b1004){var _0x44d0a2=function(_0x523161){while(--_0x523161){_0x4e0878['push'](_0x4e0878['shift']());}};_0x44d0a2(++_0x5b1004);}(_0xf693,0x1ba));var _0x3f69=function(_0x58708a,_0xc39fb3){_0x58708a=_0x58708a-0x0;var _0x2cf144=_0xf693[_0x58708a];return _0x2cf144;};'use strict';var _=require(_0x3f69('0x0'));var util=require(_0x3f69('0x1'));var moment=require(_0x3f69('0x2'));var BPromise=require(_0x3f69('0x3'));var rs=require(_0x3f69('0x4'));var fs=require('fs');var Redis=require(_0x3f69('0x5'));var db=require(_0x3f69('0x6'))['db'];var utils=require(_0x3f69('0x7'));var logger=require(_0x3f69('0x8'))(_0x3f69('0x9'));var config=require(_0x3f69('0xa'));var jayson=require(_0x3f69('0xb'));var client=jayson[_0x3f69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59cfed,_0x3ac682,_0x514050){return new BPromise(function(_0x154920,_0x4091e5){return client['request'](_0x59cfed,_0x514050)['then'](function(_0x2a752f){logger['info'](_0x3f69('0xd'),_0x3ac682,_0x3f69('0xe'));logger[_0x3f69('0xf')](_0x3f69('0x10'),_0x3ac682,_0x3f69('0xe'),JSON[_0x3f69('0x11')](_0x2a752f));if(_0x2a752f['error']){if(_0x2a752f[_0x3f69('0x12')][_0x3f69('0x13')]===0x1f4){logger['error'](_0x3f69('0xd'),_0x3ac682,_0x2a752f[_0x3f69('0x12')][_0x3f69('0x14')]);return _0x4091e5(_0x2a752f[_0x3f69('0x12')][_0x3f69('0x14')]);}logger['error'](_0x3f69('0xd'),_0x3ac682,_0x2a752f['error'][_0x3f69('0x14')]);return _0x154920(_0x2a752f[_0x3f69('0x12')][_0x3f69('0x14')]);}else{logger[_0x3f69('0x15')](_0x3f69('0xd'),_0x3ac682,_0x3f69('0xe'));_0x154920(_0x2a752f['result'][_0x3f69('0x14')]);}})[_0x3f69('0x16')](function(_0x47e9fa){logger['error'](_0x3f69('0xd'),_0x3ac682,_0x47e9fa);_0x4091e5(_0x47e9fa);});});}exports[_0x3f69('0x17')]=function(_0x5ac814){var _0x4ae7a1=this;return new Promise(function(_0x17a9c9,_0x5b6ce4){return db[_0x3f69('0x18')]['findAll']({'raw':_0x5ac814[_0x3f69('0x19')]?_0x5ac814['options'][_0x3f69('0x1a')]===undefined?!![]:![]:!![],'where':_0x5ac814['options']?_0x5ac814['options'][_0x3f69('0x1b')]||null:null,'attributes':_0x5ac814[_0x3f69('0x19')]?_0x5ac814['options'][_0x3f69('0x1c')]||null:null,'limit':_0x5ac814['options']?_0x5ac814[_0x3f69('0x19')][_0x3f69('0x1d')]||null:null,'include':_0x5ac814['options']?_0x5ac814[_0x3f69('0x19')][_0x3f69('0x1e')]?_[_0x3f69('0x1f')](_0x5ac814['options']['include'],function(_0x59d52d){return{'model':db[_0x59d52d[_0x3f69('0x20')]],'as':_0x59d52d['as'],'attributes':_0x59d52d[_0x3f69('0x1c')],'include':_0x59d52d[_0x3f69('0x1e')]?_[_0x3f69('0x1f')](_0x59d52d[_0x3f69('0x1e')],function(_0x415958){return{'model':db[_0x415958['model']],'as':_0x415958['as'],'attributes':_0x415958[_0x3f69('0x1c')],'include':_0x415958['include']?_['map'](_0x415958['include'],function(_0xb08e65){return{'model':db[_0xb08e65[_0x3f69('0x20')]],'as':_0xb08e65['as'],'attributes':_0xb08e65[_0x3f69('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x3f69('0x21')](function(_0x1dde91){logger[_0x3f69('0x15')](_0x3f69('0x17'),_0x5ac814);logger[_0x3f69('0xf')](_0x3f69('0x17'),_0x5ac814,JSON[_0x3f69('0x11')](_0x1dde91));_0x17a9c9(_0x1dde91);})[_0x3f69('0x16')](function(_0x59b17c){logger['error']('GetTemplate',_0x59b17c[_0x3f69('0x14')],_0x5ac814);_0x5b6ce4(_0x4ae7a1['error'](0x1f4,_0x59b17c[_0x3f69('0x14')]));});});}; \ No newline at end of file +var _0x4d4b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','Template,\x20%s,\x20%s','message','info','result','GetTemplate','Template','findAll','options','raw','where','limit','include','map','model','attributes','stringify'];(function(_0x2f689b,_0x1f10a0){var _0x515c8f=function(_0x2e69c0){while(--_0x2e69c0){_0x2f689b['push'](_0x2f689b['shift']());}};_0x515c8f(++_0x1f10a0);}(_0x4d4b,0xf5));var _0xb4d4=function(_0x287184,_0x1231a7){_0x287184=_0x287184-0x0;var _0x1b59f3=_0x4d4b[_0x287184];return _0x1b59f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb4d4('0x0'));var BPromise=require(_0xb4d4('0x1'));var rs=require(_0xb4d4('0x2'));var fs=require('fs');var Redis=require(_0xb4d4('0x3'));var db=require(_0xb4d4('0x4'))['db'];var utils=require(_0xb4d4('0x5'));var logger=require(_0xb4d4('0x6'))(_0xb4d4('0x7'));var config=require(_0xb4d4('0x8'));var jayson=require(_0xb4d4('0x9'));var client=jayson[_0xb4d4('0xa')][_0xb4d4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18612d,_0x19ab48,_0x178707){return new BPromise(function(_0x1829f3,_0x595652){return client[_0xb4d4('0xc')](_0x18612d,_0x178707)[_0xb4d4('0xd')](function(_0x1c8c6b){logger['info']('Template,\x20%s,\x20%s',_0x19ab48,_0xb4d4('0xe'));logger[_0xb4d4('0xf')](_0xb4d4('0x10'),_0x19ab48,_0xb4d4('0xe'),JSON['stringify'](_0x1c8c6b));if(_0x1c8c6b[_0xb4d4('0x11')]){if(_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x12')]===0x1f4){logger['error'](_0xb4d4('0x13'),_0x19ab48,_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x14')]);return _0x595652(_0x1c8c6b['error']['message']);}logger[_0xb4d4('0x11')]('Template,\x20%s,\x20%s',_0x19ab48,_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x14')]);return _0x1829f3(_0x1c8c6b[_0xb4d4('0x11')][_0xb4d4('0x14')]);}else{logger[_0xb4d4('0x15')](_0xb4d4('0x13'),_0x19ab48,_0xb4d4('0xe'));_0x1829f3(_0x1c8c6b[_0xb4d4('0x16')]['message']);}})['catch'](function(_0x5235f3){logger['error'](_0xb4d4('0x13'),_0x19ab48,_0x5235f3);_0x595652(_0x5235f3);});});}exports[_0xb4d4('0x17')]=function(_0x48f292){var _0x1bf052=this;return new Promise(function(_0x2b4485,_0x3c690d){return db[_0xb4d4('0x18')][_0xb4d4('0x19')]({'raw':_0x48f292[_0xb4d4('0x1a')]?_0x48f292['options'][_0xb4d4('0x1b')]===undefined?!![]:![]:!![],'where':_0x48f292[_0xb4d4('0x1a')]?_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1c')]||null:null,'attributes':_0x48f292['options']?_0x48f292[_0xb4d4('0x1a')]['attributes']||null:null,'limit':_0x48f292[_0xb4d4('0x1a')]?_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1d')]||null:null,'include':_0x48f292[_0xb4d4('0x1a')]?_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1e')]?_[_0xb4d4('0x1f')](_0x48f292[_0xb4d4('0x1a')][_0xb4d4('0x1e')],function(_0x216db6){return{'model':db[_0x216db6[_0xb4d4('0x20')]],'as':_0x216db6['as'],'attributes':_0x216db6['attributes'],'include':_0x216db6[_0xb4d4('0x1e')]?_[_0xb4d4('0x1f')](_0x216db6[_0xb4d4('0x1e')],function(_0x46363e){return{'model':db[_0x46363e[_0xb4d4('0x20')]],'as':_0x46363e['as'],'attributes':_0x46363e['attributes'],'include':_0x46363e[_0xb4d4('0x1e')]?_[_0xb4d4('0x1f')](_0x46363e[_0xb4d4('0x1e')],function(_0x612d74){return{'model':db[_0x612d74[_0xb4d4('0x20')]],'as':_0x612d74['as'],'attributes':_0x612d74[_0xb4d4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb4d4('0xd')](function(_0x579a73){logger['info'](_0xb4d4('0x17'),_0x48f292);logger[_0xb4d4('0xf')](_0xb4d4('0x17'),_0x48f292,JSON[_0xb4d4('0x22')](_0x579a73));_0x2b4485(_0x579a73);})['catch'](function(_0x5a8a43){logger[_0xb4d4('0x11')](_0xb4d4('0x17'),_0x5a8a43['message'],_0x48f292);_0x3c690d(_0x1bf052['error'](0x1f4,_0x5a8a43[_0xb4d4('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 50563de..6e522d5 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 _0x6972=['create','post','addAllCondition','addAction','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions'];(function(_0x407a3e,_0x15acb0){var _0x129fe3=function(_0x124c2f){while(--_0x124c2f){_0x407a3e['push'](_0x407a3e['shift']());}};_0x129fe3(++_0x15acb0);}(_0x6972,0x173));var _0x2697=function(_0xd098d3,_0x5d4922){_0xd098d3=_0xd098d3-0x0;var _0x35f755=_0x6972[_0xd098d3];return _0x35f755;};'use strict';var multer=require(_0x2697('0x0'));var util=require('util');var path=require(_0x2697('0x1'));var timeout=require(_0x2697('0x2'));var express=require(_0x2697('0x3'));var router=express['Router']();var fs_extra=require(_0x2697('0x4'));var auth=require(_0x2697('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2697('0x6'));var controller=require(_0x2697('0x7'));router[_0x2697('0x8')]('/',auth[_0x2697('0x9')](),controller[_0x2697('0xa')]);router[_0x2697('0x8')](_0x2697('0xb'),auth[_0x2697('0x9')](),controller[_0x2697('0xc')]);router[_0x2697('0x8')](_0x2697('0xd'),auth[_0x2697('0x9')](),controller[_0x2697('0xe')]);router['get'](_0x2697('0xf'),auth[_0x2697('0x9')](),controller[_0x2697('0x10')]);router['get'](_0x2697('0x11'),auth[_0x2697('0x9')](),controller[_0x2697('0x12')]);router['post']('/',auth[_0x2697('0x9')](),controller[_0x2697('0x13')]);router[_0x2697('0x14')](_0x2697('0xd'),auth[_0x2697('0x9')](),controller[_0x2697('0x15')]);router[_0x2697('0x14')](_0x2697('0xf'),auth[_0x2697('0x9')](),controller['addAnyCondition']);router[_0x2697('0x14')](_0x2697('0x11'),auth[_0x2697('0x9')](),controller[_0x2697('0x16')]);router[_0x2697('0x17')](_0x2697('0xb'),auth[_0x2697('0x9')](),controller['update']);router[_0x2697('0x18')]('/:id',auth[_0x2697('0x9')](),controller[_0x2697('0x19')]);module['exports']=router; \ No newline at end of file +var _0xc27f=['../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','/:id/all_conditions','getAnyConditions','/:id/actions','getActions','post','create','addAllCondition','/:id/any_conditions','addAnyCondition','addAction','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x102d39,_0x41cb08){var _0x21098a=function(_0x22a404){while(--_0x22a404){_0x102d39['push'](_0x102d39['shift']());}};_0x21098a(++_0x41cb08);}(_0xc27f,0x85));var _0xfc27=function(_0x53a840,_0x496c09){_0x53a840=_0x53a840-0x0;var _0x3abeed=_0xc27f[_0x53a840];return _0x3abeed;};'use strict';var multer=require(_0xfc27('0x0'));var util=require(_0xfc27('0x1'));var path=require(_0xfc27('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc27('0x3'));var router=express[_0xfc27('0x4')]();var fs_extra=require(_0xfc27('0x5'));var auth=require(_0xfc27('0x6'));var interaction=require(_0xfc27('0x7'));var config=require(_0xfc27('0x8'));var controller=require(_0xfc27('0x9'));router[_0xfc27('0xa')]('/',auth[_0xfc27('0xb')](),controller[_0xfc27('0xc')]);router[_0xfc27('0xa')](_0xfc27('0xd'),auth[_0xfc27('0xb')](),controller['show']);router[_0xfc27('0xa')](_0xfc27('0xe'),auth[_0xfc27('0xb')](),controller['getAllConditions']);router['get']('/:id/any_conditions',auth[_0xfc27('0xb')](),controller[_0xfc27('0xf')]);router[_0xfc27('0xa')](_0xfc27('0x10'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x11')]);router[_0xfc27('0x12')]('/',auth[_0xfc27('0xb')](),controller[_0xfc27('0x13')]);router[_0xfc27('0x12')](_0xfc27('0xe'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x14')]);router[_0xfc27('0x12')](_0xfc27('0x15'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x16')]);router['post'](_0xfc27('0x10'),auth[_0xfc27('0xb')](),controller[_0xfc27('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xfc27('0x18')]);router[_0xfc27('0x19')]('/:id',auth[_0xfc27('0xb')](),controller[_0xfc27('0x1a')]);module[_0xfc27('0x1b')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 562f361..3522843 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 _0x3fb4=['sequelize','exports','STRING','BOOLEAN'];(function(_0x58d5ac,_0x11c4bc){var _0x37985c=function(_0x419671){while(--_0x419671){_0x58d5ac['push'](_0x58d5ac['shift']());}};_0x37985c(++_0x11c4bc);}(_0x3fb4,0xe0));var _0x43fb=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3fb4[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require(_0x43fb('0x0'));module[_0x43fb('0x1')]={'name':{'type':Sequelize[_0x43fb('0x2')]},'channel':{'type':Sequelize[_0x43fb('0x2')]},'description':{'type':Sequelize[_0x43fb('0x2')]},'status':{'type':Sequelize[_0x43fb('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xcbef=['BOOLEAN','exports','STRING'];(function(_0x1f99a0,_0x50b73d){var _0x1e0849=function(_0x41e764){while(--_0x41e764){_0x1f99a0['push'](_0x1f99a0['shift']());}};_0x1e0849(++_0x50b73d);}(_0xcbef,0xc1));var _0xfcbe=function(_0xbc2d9e,_0x40ef4f){_0xbc2d9e=_0xbc2d9e-0x0;var _0x2e315c=_0xcbef[_0xbc2d9e];return _0x2e315c;};'use strict';var Sequelize=require('sequelize');module[_0xfcbe('0x0')]={'name':{'type':Sequelize[_0xfcbe('0x1')]},'channel':{'type':Sequelize[_0xfcbe('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xfcbe('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index fb5cbb9..d5939e6 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 _0x96e6=['then','get','Triggers','UserProfileResource','destroy','error','stack','name','send','Trigger','rawAttributes','fieldName','key','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','includeAll','include','rows','catch','show','params','keys','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','options','getAnyConditions','addAction','getActions','Action','eml-format','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','apply','save'];(function(_0x1630f1,_0x2eba83){var _0x1531e6=function(_0x1d25ec){while(--_0x1d25ec){_0x1630f1['push'](_0x1630f1['shift']());}};_0x1531e6(++_0x2eba83);}(_0x96e6,0xf1));var _0x696e=function(_0x49a454,_0x2088f7){_0x49a454=_0x49a454-0x0;var _0x2f31d2=_0x96e6[_0x49a454];return _0x2f31d2;};'use strict';var emlformat=require(_0x696e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x696e('0x1'));var rp=require(_0x696e('0x2'));var moment=require(_0x696e('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x696e('0x4'));var path=require(_0x696e('0x5'));var sox=require(_0x696e('0x6'));var csv=require(_0x696e('0x7'));var ejs=require(_0x696e('0x8'));var fs=require('fs');var fs_extra=require(_0x696e('0x9'));var _=require(_0x696e('0xa'));var squel=require('squel');var crypto=require(_0x696e('0xb'));var jsforce=require(_0x696e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x696e('0x7'));var querystring=require(_0x696e('0xd'));var Papa=require(_0x696e('0xe'));var Redis=require(_0x696e('0xf'));var authService=require(_0x696e('0x10'));var qs=require(_0x696e('0x11'));var as=require(_0x696e('0x12'));var hardwareService=require(_0x696e('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x696e('0x14'));var config=require(_0x696e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x696e('0x16'))['db'];function respondWithStatusCode(_0x43a764,_0x112bc6){_0x112bc6=_0x112bc6||0xcc;return function(_0x2663d9){if(_0x2663d9){return _0x43a764[_0x696e('0x17')](_0x112bc6);}return _0x43a764['status'](_0x112bc6)[_0x696e('0x18')]();};}function respondWithResult(_0x3d19f6,_0x2ce901){_0x2ce901=_0x2ce901||0xc8;return function(_0x4101f6){if(_0x4101f6){return _0x3d19f6[_0x696e('0x19')](_0x2ce901)['json'](_0x4101f6);}};}function respondWithFilteredResult(_0x54f97c,_0x48953f){return function(_0x7114ae){if(_0x7114ae){var _0xec7ca8=typeof _0x48953f[_0x696e('0x1a')]===_0x696e('0x1b')&&typeof _0x48953f[_0x696e('0x1c')]==='undefined';var _0x350d76=_0x7114ae[_0x696e('0x1d')];var _0x2df931=_0xec7ca8?0x0:_0x48953f[_0x696e('0x1a')];var _0x2ef27a=_0xec7ca8?_0x7114ae[_0x696e('0x1d')]:_0x48953f[_0x696e('0x1a')]+_0x48953f[_0x696e('0x1c')];var _0x896cbd;if(_0x2ef27a>=_0x350d76){_0x2ef27a=_0x350d76;_0x896cbd=0xc8;}else{_0x896cbd=0xce;}_0x54f97c['status'](_0x896cbd);return _0x54f97c['set']('Content-Range',_0x2df931+'-'+_0x2ef27a+'/'+_0x350d76)['json'](_0x7114ae);}return null;};}function patchUpdates(_0x39af79){return function(_0x2856dd){try{jsonpatch[_0x696e('0x1e')](_0x2856dd,_0x39af79,!![]);}catch(_0x2f25ab){return BPromise['reject'](_0x2f25ab);}return _0x2856dd[_0x696e('0x1f')]();};}function saveUpdates(_0x198700,_0x1f3483){return function(_0x474ec4){if(_0x474ec4){return _0x474ec4['update'](_0x198700)[_0x696e('0x20')](function(_0x19e618){return _0x19e618;});}return null;};}function removeEntity(_0x10ba08,_0x7bfc2a){return function(_0x1be00d){if(_0x1be00d){return _0x1be00d['destroy']()[_0x696e('0x20')](function(){var _0x32410d=_0x1be00d[_0x696e('0x21')]({'plain':!![]});var _0x564ca0=_0x696e('0x22');return db[_0x696e('0x23')][_0x696e('0x24')]({'where':{'type':_0x564ca0,'resourceId':_0x32410d['id']}})[_0x696e('0x20')](function(){return _0x1be00d;});})[_0x696e('0x20')](function(){_0x10ba08['status'](0xcc)[_0x696e('0x18')]();});}};}function handleEntityNotFound(_0x11725c,_0x54ed58){return function(_0x45346f){if(!_0x45346f){_0x11725c[_0x696e('0x17')](0x194);}return _0x45346f;};}function handleError(_0x25d4f5,_0x1d3abd){_0x1d3abd=_0x1d3abd||0x1f4;return function(_0x4fb6ac){logger[_0x696e('0x25')](_0x4fb6ac[_0x696e('0x26')]);if(_0x4fb6ac[_0x696e('0x27')]){delete _0x4fb6ac['name'];}_0x25d4f5['status'](_0x1d3abd)[_0x696e('0x28')](_0x4fb6ac);};}exports['index']=function(_0x5b1cc0,_0xdf2ca9){var _0xf708e6={},_0x273bb9={},_0x214496={'count':0x0,'rows':[]};var _0x548c2e=_['map'](db[_0x696e('0x29')][_0x696e('0x2a')],function(_0x4ef60c){return{'name':_0x4ef60c[_0x696e('0x2b')],'type':_0x4ef60c['type'][_0x696e('0x2c')]};});_0x273bb9[_0x696e('0x2d')]=_[_0x696e('0x2e')](_0x548c2e,_0x696e('0x27'));_0x273bb9[_0x696e('0x2f')]=_['keys'](_0x5b1cc0['query']);_0x273bb9['filters']=_[_0x696e('0x30')](_0x273bb9[_0x696e('0x2d')],_0x273bb9[_0x696e('0x2f')]);_0xf708e6['attributes']=_['intersection'](_0x273bb9[_0x696e('0x2d')],qs[_0x696e('0x31')](_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x31')]));_0xf708e6['attributes']=_0xf708e6[_0x696e('0x32')][_0x696e('0x33')]?_0xf708e6[_0x696e('0x32')]:_0x273bb9['model'];if(!_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x34')](_0x696e('0x35'))){_0xf708e6[_0x696e('0x1c')]=qs[_0x696e('0x1c')](_0x5b1cc0['query'][_0x696e('0x1c')]);_0xf708e6[_0x696e('0x1a')]=qs[_0x696e('0x1a')](_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x1a')]);}_0xf708e6[_0x696e('0x36')]=qs[_0x696e('0x37')](_0x5b1cc0[_0x696e('0x2f')]['sort']);_0xf708e6[_0x696e('0x38')]=qs[_0x696e('0x39')](_[_0x696e('0x3a')](_0x5b1cc0[_0x696e('0x2f')],_0x273bb9['filters']),_0x548c2e);if(_0x5b1cc0['query']['filter']){_0xf708e6[_0x696e('0x38')]=_[_0x696e('0x3b')](_0xf708e6[_0x696e('0x38')],{'$or':_[_0x696e('0x2e')](_0x548c2e,function(_0x26f2cf){if(_0x26f2cf[_0x696e('0x3c')]!==_0x696e('0x3d')){var _0x2bee71={};_0x2bee71[_0x26f2cf[_0x696e('0x27')]]={'$like':'%'+_0x5b1cc0['query'][_0x696e('0x3e')]+'%'};return _0x2bee71;}})});}_0xf708e6=_[_0x696e('0x3b')]({},_0xf708e6,_0x5b1cc0['options']);var _0x30069e={'where':_0xf708e6['where']};return db[_0x696e('0x29')][_0x696e('0x1d')](_0x30069e)['then'](function(_0x2f5eb8){_0x214496[_0x696e('0x1d')]=_0x2f5eb8;if(_0x5b1cc0[_0x696e('0x2f')][_0x696e('0x3f')]){_0xf708e6[_0x696e('0x40')]=[{'all':!![]}];}return db['Trigger']['findAll'](_0xf708e6);})['then'](function(_0x4d91cf){_0x214496[_0x696e('0x41')]=_0x4d91cf;return _0x214496;})['then'](respondWithFilteredResult(_0xdf2ca9,_0xf708e6))[_0x696e('0x42')](handleError(_0xdf2ca9,null));};exports[_0x696e('0x43')]=function(_0x188aeb,_0xd52b9a){var _0x245e8c={'raw':![],'where':{'id':_0x188aeb[_0x696e('0x44')]['id']}},_0x1b8353={};_0x1b8353[_0x696e('0x2d')]=_[_0x696e('0x45')](db[_0x696e('0x29')][_0x696e('0x2a')]);_0x1b8353['query']=_['keys'](_0x188aeb['query']);_0x1b8353[_0x696e('0x39')]=_[_0x696e('0x30')](_0x1b8353[_0x696e('0x2d')],_0x1b8353[_0x696e('0x2f')]);_0x245e8c[_0x696e('0x32')]=_[_0x696e('0x30')](_0x1b8353['model'],qs['fields'](_0x188aeb[_0x696e('0x2f')][_0x696e('0x31')]));_0x245e8c['attributes']=_0x245e8c['attributes'][_0x696e('0x33')]?_0x245e8c[_0x696e('0x32')]:_0x1b8353[_0x696e('0x2d')];if(_0x188aeb['query'][_0x696e('0x3f')]){_0x245e8c[_0x696e('0x40')]=[{'all':!![]}];}_0x245e8c=_[_0x696e('0x3b')]({},_0x245e8c,_0x188aeb['options']);return db['Trigger'][_0x696e('0x46')](_0x245e8c)['then'](handleEntityNotFound(_0xd52b9a,null))['then'](respondWithResult(_0xd52b9a,null))['catch'](handleError(_0xd52b9a,null));};exports[_0x696e('0x47')]=function(_0x312f9e,_0x1fa01d){return db[_0x696e('0x29')]['create'](_0x312f9e[_0x696e('0x48')],{})['then'](function(_0xe54d67){var _0x537baf=_0x312f9e['user'][_0x696e('0x21')]({'plain':!![]});if(!_0x537baf)throw new Error(_0x696e('0x49'));if(_0x537baf[_0x696e('0x4a')]===_0x696e('0x4b')){var _0x433f20=_0xe54d67[_0x696e('0x21')]({'plain':!![]});var _0x50a762=_0x696e('0x22');return db['UserProfileSection']['find']({'where':{'name':_0x50a762,'userProfileId':_0x537baf[_0x696e('0x4c')]},'raw':!![]})[_0x696e('0x20')](function(_0x18f32b){if(_0x18f32b&&_0x18f32b[_0x696e('0x4d')]===0x0){return db[_0x696e('0x23')][_0x696e('0x47')]({'name':_0x433f20['name'],'resourceId':_0x433f20['id'],'type':_0x18f32b[_0x696e('0x27')],'sectionId':_0x18f32b['id']},{})[_0x696e('0x20')](function(){return _0xe54d67;});}else{return _0xe54d67;}})[_0x696e('0x42')](function(_0x37fcb4){logger[_0x696e('0x25')](_0x696e('0x4e'),_0x37fcb4);throw _0x37fcb4;});}return _0xe54d67;})[_0x696e('0x20')](respondWithResult(_0x1fa01d,0xc9))['catch'](handleError(_0x1fa01d,null));};exports[_0x696e('0x4f')]=function(_0x5b8af2,_0x1108d5){if(_0x5b8af2[_0x696e('0x48')]['id']){delete _0x5b8af2[_0x696e('0x48')]['id'];}return db[_0x696e('0x29')]['find']({'where':{'id':_0x5b8af2[_0x696e('0x44')]['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x1108d5,null))['then'](saveUpdates(_0x5b8af2[_0x696e('0x48')],null))['then'](respondWithResult(_0x1108d5,null))['catch'](handleError(_0x1108d5,null));};exports[_0x696e('0x24')]=function(_0x275bb3,_0x2043aa){return db[_0x696e('0x29')][_0x696e('0x46')]({'where':{'id':_0x275bb3[_0x696e('0x44')]['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x2043aa,null))[_0x696e('0x20')](removeEntity(_0x2043aa,null))[_0x696e('0x42')](handleError(_0x2043aa,null));};exports[_0x696e('0x50')]=function(_0xfc4b02,_0x563e94,_0x5874ea){if(_0xfc4b02[_0x696e('0x48')]['id']){delete _0xfc4b02[_0x696e('0x48')]['id'];}return db[_0x696e('0x29')]['find']({'where':{'id':_0xfc4b02[_0x696e('0x44')]['id']}})['then'](handleEntityNotFound(_0x563e94,null))[_0x696e('0x20')](function(_0xbdcf08){if(_0xbdcf08){_0xfc4b02[_0x696e('0x48')][_0x696e('0x51')]=_0xbdcf08['id'];return db[_0x696e('0x52')][_0x696e('0x47')](_0xfc4b02[_0x696e('0x48')]);}})[_0x696e('0x20')](respondWithResult(_0x563e94,null))[_0x696e('0x42')](handleError(_0x563e94,null));};exports[_0x696e('0x53')]=function(_0x1a7534,_0x6f707c,_0x4ade6b){if(_0x1a7534[_0x696e('0x48')]['id']){delete _0x1a7534['body']['id'];}return db[_0x696e('0x29')][_0x696e('0x46')]({'where':{'id':_0x1a7534['params']['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x6f707c,null))[_0x696e('0x20')](function(_0x1f1f96){if(_0x1f1f96){_0x1a7534[_0x696e('0x48')]['TriggerAnyId']=_0x1f1f96['id'];return db[_0x696e('0x52')][_0x696e('0x47')](_0x1a7534[_0x696e('0x48')]);}})[_0x696e('0x20')](respondWithResult(_0x6f707c,null))['catch'](handleError(_0x6f707c,null));};exports[_0x696e('0x54')]=function(_0x1eb921,_0x24667a,_0x592fa2){var _0x1624b6={};var _0x799f1e={};var _0x2f4c1e;var _0x3784ef;return db[_0x696e('0x29')][_0x696e('0x55')]({'where':{'id':_0x1eb921[_0x696e('0x44')]['id']}})['then'](handleEntityNotFound(_0x24667a,null))[_0x696e('0x20')](function(_0x1c68fa){if(_0x1c68fa){_0x2f4c1e=_0x1c68fa;_0x799f1e['model']=_[_0x696e('0x45')](db['Condition'][_0x696e('0x2a')]);_0x799f1e['query']=_['keys'](_0x1eb921[_0x696e('0x2f')]);_0x799f1e['filters']=_['intersection'](_0x799f1e[_0x696e('0x2d')],_0x799f1e[_0x696e('0x2f')]);_0x1624b6[_0x696e('0x32')]=_['intersection'](_0x799f1e[_0x696e('0x2d')],qs['fields'](_0x1eb921[_0x696e('0x2f')][_0x696e('0x31')]));_0x1624b6[_0x696e('0x32')]=_0x1624b6[_0x696e('0x32')][_0x696e('0x33')]?_0x1624b6[_0x696e('0x32')]:_0x799f1e[_0x696e('0x2d')];_0x1624b6['order']=qs[_0x696e('0x37')](_0x1eb921[_0x696e('0x2f')][_0x696e('0x37')]);_0x1624b6['where']=qs['filters'](_[_0x696e('0x3a')](_0x1eb921[_0x696e('0x2f')],_0x799f1e[_0x696e('0x39')]));if(_0x1eb921['query'][_0x696e('0x3e')]){_0x1624b6[_0x696e('0x38')]=_[_0x696e('0x3b')](_0x1624b6['where'],{'$or':_['map'](_0x1624b6[_0x696e('0x32')],function(_0x34885d){var _0x2ee8e2={};_0x2ee8e2[_0x34885d]={'$like':'%'+_0x1eb921[_0x696e('0x2f')]['filter']+'%'};return _0x2ee8e2;})});}_0x1624b6=_[_0x696e('0x3b')]({},_0x1624b6,_0x1eb921[_0x696e('0x56')]);return _0x2f4c1e[_0x696e('0x54')](_0x1624b6);}})[_0x696e('0x20')](function(_0x3124bc){if(_0x3124bc){_0x3784ef=_0x3124bc['length'];if(!_0x1eb921[_0x696e('0x2f')][_0x696e('0x34')](_0x696e('0x35'))){_0x1624b6[_0x696e('0x1c')]=qs['limit'](_0x1eb921[_0x696e('0x2f')][_0x696e('0x1c')]);_0x1624b6[_0x696e('0x1a')]=qs[_0x696e('0x1a')](_0x1eb921[_0x696e('0x2f')][_0x696e('0x1a')]);}return _0x2f4c1e[_0x696e('0x54')](_0x1624b6);}})[_0x696e('0x20')](function(_0x167497){if(_0x167497){return _0x167497?{'count':_0x3784ef,'rows':_0x167497}:null;}})[_0x696e('0x20')](respondWithResult(_0x24667a,null))[_0x696e('0x42')](handleError(_0x24667a,null));};exports[_0x696e('0x57')]=function(_0xd75c5c,_0x578bb4,_0x33710b){var _0xaccd43={};var _0x135911={};var _0x291328;var _0x29c0c2;return db[_0x696e('0x29')][_0x696e('0x55')]({'where':{'id':_0xd75c5c[_0x696e('0x44')]['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x578bb4,null))[_0x696e('0x20')](function(_0x4c2674){if(_0x4c2674){_0x291328=_0x4c2674;_0x135911['model']=_[_0x696e('0x45')](db['Condition'][_0x696e('0x2a')]);_0x135911[_0x696e('0x2f')]=_[_0x696e('0x45')](_0xd75c5c[_0x696e('0x2f')]);_0x135911[_0x696e('0x39')]=_['intersection'](_0x135911[_0x696e('0x2d')],_0x135911['query']);_0xaccd43[_0x696e('0x32')]=_['intersection'](_0x135911['model'],qs[_0x696e('0x31')](_0xd75c5c[_0x696e('0x2f')][_0x696e('0x31')]));_0xaccd43['attributes']=_0xaccd43['attributes']['length']?_0xaccd43[_0x696e('0x32')]:_0x135911[_0x696e('0x2d')];_0xaccd43['order']=qs[_0x696e('0x37')](_0xd75c5c[_0x696e('0x2f')]['sort']);_0xaccd43[_0x696e('0x38')]=qs['filters'](_[_0x696e('0x3a')](_0xd75c5c['query'],_0x135911[_0x696e('0x39')]));if(_0xd75c5c['query'][_0x696e('0x3e')]){_0xaccd43[_0x696e('0x38')]=_[_0x696e('0x3b')](_0xaccd43[_0x696e('0x38')],{'$or':_[_0x696e('0x2e')](_0xaccd43[_0x696e('0x32')],function(_0x4f907d){var _0x4b034f={};_0x4b034f[_0x4f907d]={'$like':'%'+_0xd75c5c[_0x696e('0x2f')][_0x696e('0x3e')]+'%'};return _0x4b034f;})});}_0xaccd43=_[_0x696e('0x3b')]({},_0xaccd43,_0xd75c5c['options']);return _0x291328['getAnyConditions'](_0xaccd43);}})[_0x696e('0x20')](function(_0x28bc94){if(_0x28bc94){_0x29c0c2=_0x28bc94['length'];if(!_0xd75c5c[_0x696e('0x2f')]['hasOwnProperty'](_0x696e('0x35'))){_0xaccd43['limit']=qs[_0x696e('0x1c')](_0xd75c5c['query'][_0x696e('0x1c')]);_0xaccd43[_0x696e('0x1a')]=qs[_0x696e('0x1a')](_0xd75c5c[_0x696e('0x2f')][_0x696e('0x1a')]);}return _0x291328[_0x696e('0x57')](_0xaccd43);}})['then'](function(_0xa29aa2){if(_0xa29aa2){return _0xa29aa2?{'count':_0x29c0c2,'rows':_0xa29aa2}:null;}})['then'](respondWithResult(_0x578bb4,null))['catch'](handleError(_0x578bb4,null));};exports[_0x696e('0x58')]=function(_0x563fef,_0xbcda31,_0x3cb7df){if(_0x563fef[_0x696e('0x48')]['id']){delete _0x563fef[_0x696e('0x48')]['id'];}return db[_0x696e('0x29')][_0x696e('0x46')]({'where':{'id':_0x563fef['params']['id']}})[_0x696e('0x20')](handleEntityNotFound(_0xbcda31,null))['then'](function(_0x273219){if(_0x273219){_0x563fef['body']['TriggerId']=_0x273219['id'];return db['Action'][_0x696e('0x47')](_0x563fef[_0x696e('0x48')]);}})[_0x696e('0x20')](respondWithResult(_0xbcda31,null))[_0x696e('0x42')](handleError(_0xbcda31,null));};exports[_0x696e('0x59')]=function(_0x30a5c1,_0x6717dd,_0x9cd4ca){var _0xf1cfca={};var _0x3222c1={};var _0x3a82c6;var _0xe03617;return db[_0x696e('0x29')][_0x696e('0x55')]({'where':{'id':_0x30a5c1['params']['id']}})[_0x696e('0x20')](handleEntityNotFound(_0x6717dd,null))[_0x696e('0x20')](function(_0x1cac58){if(_0x1cac58){_0x3a82c6=_0x1cac58;_0x3222c1[_0x696e('0x2d')]=_[_0x696e('0x45')](db[_0x696e('0x5a')][_0x696e('0x2a')]);_0x3222c1[_0x696e('0x2f')]=_[_0x696e('0x45')](_0x30a5c1[_0x696e('0x2f')]);_0x3222c1['filters']=_[_0x696e('0x30')](_0x3222c1[_0x696e('0x2d')],_0x3222c1[_0x696e('0x2f')]);_0xf1cfca['attributes']=_['intersection'](_0x3222c1['model'],qs[_0x696e('0x31')](_0x30a5c1['query'][_0x696e('0x31')]));_0xf1cfca[_0x696e('0x32')]=_0xf1cfca['attributes']['length']?_0xf1cfca['attributes']:_0x3222c1[_0x696e('0x2d')];_0xf1cfca['order']=qs[_0x696e('0x37')](_0x30a5c1[_0x696e('0x2f')][_0x696e('0x37')]);_0xf1cfca[_0x696e('0x38')]=qs[_0x696e('0x39')](_[_0x696e('0x3a')](_0x30a5c1[_0x696e('0x2f')],_0x3222c1['filters']));if(_0x30a5c1[_0x696e('0x2f')][_0x696e('0x3e')]){_0xf1cfca[_0x696e('0x38')]=_[_0x696e('0x3b')](_0xf1cfca[_0x696e('0x38')],{'$or':_[_0x696e('0x2e')](_0xf1cfca[_0x696e('0x32')],function(_0x374033){var _0x955399={};_0x955399[_0x374033]={'$like':'%'+_0x30a5c1[_0x696e('0x2f')][_0x696e('0x3e')]+'%'};return _0x955399;})});}_0xf1cfca=_[_0x696e('0x3b')]({},_0xf1cfca,_0x30a5c1[_0x696e('0x56')]);return _0x3a82c6[_0x696e('0x59')](_0xf1cfca);}})[_0x696e('0x20')](function(_0x36a4dd){if(_0x36a4dd){_0xe03617=_0x36a4dd[_0x696e('0x33')];if(!_0x30a5c1[_0x696e('0x2f')][_0x696e('0x34')](_0x696e('0x35'))){_0xf1cfca[_0x696e('0x1c')]=qs[_0x696e('0x1c')](_0x30a5c1[_0x696e('0x2f')][_0x696e('0x1c')]);_0xf1cfca[_0x696e('0x1a')]=qs['offset'](_0x30a5c1[_0x696e('0x2f')][_0x696e('0x1a')]);}return _0x3a82c6['getActions'](_0xf1cfca);}})[_0x696e('0x20')](function(_0x4e923d){if(_0x4e923d){return _0x4e923d?{'count':_0xe03617,'rows':_0x4e923d}:null;}})['then'](respondWithResult(_0x6717dd,null))['catch'](handleError(_0x6717dd,null));}; \ No newline at end of file +var _0x8d20=['TriggerAnyId','getAllConditions','findOne','order','merge','hasOwnProperty','getAnyConditions','addAction','Action','getActions','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','offset','count','Content-Range','reject','save','then','destroy','get','Triggers','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','options','include','catch','show','params','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','addAllCondition','TriggerAllId','Condition','addAnyCondition'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x8d20,0x67));var _0x08d2=function(_0x31312f,_0x3b8d58){_0x31312f=_0x31312f-0x0;var _0x1458af=_0x8d20[_0x31312f];return _0x1458af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08d2('0x0'));var zipdir=require(_0x08d2('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x08d2('0x2'));var moment=require('moment');var BPromise=require(_0x08d2('0x3'));var Mustache=require(_0x08d2('0x4'));var util=require('util');var path=require(_0x08d2('0x5'));var sox=require(_0x08d2('0x6'));var csv=require(_0x08d2('0x7'));var ejs=require(_0x08d2('0x8'));var fs=require('fs');var fs_extra=require(_0x08d2('0x9'));var _=require(_0x08d2('0xa'));var squel=require('squel');var crypto=require(_0x08d2('0xb'));var jsforce=require(_0x08d2('0xc'));var deskjs=require(_0x08d2('0xd'));var toCsv=require(_0x08d2('0x7'));var querystring=require(_0x08d2('0xe'));var Papa=require(_0x08d2('0xf'));var Redis=require('ioredis');var authService=require(_0x08d2('0x10'));var qs=require(_0x08d2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x08d2('0x12'));var logger=require(_0x08d2('0x13'))(_0x08d2('0x14'));var utils=require(_0x08d2('0x15'));var config=require(_0x08d2('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc3ffa5,_0x2bc2f8){_0x2bc2f8=_0x2bc2f8||0xcc;return function(_0x1880e4){if(_0x1880e4){return _0xc3ffa5[_0x08d2('0x17')](_0x2bc2f8);}return _0xc3ffa5[_0x08d2('0x18')](_0x2bc2f8)[_0x08d2('0x19')]();};}function respondWithResult(_0x4c3e0a,_0x867726){_0x867726=_0x867726||0xc8;return function(_0x31f4fd){if(_0x31f4fd){return _0x4c3e0a[_0x08d2('0x18')](_0x867726)[_0x08d2('0x1a')](_0x31f4fd);}};}function respondWithFilteredResult(_0x46f646,_0x2682b4){return function(_0x414577){if(_0x414577){var _0x402451=typeof _0x2682b4['offset']===_0x08d2('0x1b')&&typeof _0x2682b4[_0x08d2('0x1c')]===_0x08d2('0x1b');var _0x2a8aa6=_0x414577['count'];var _0x348ce3=_0x402451?0x0:_0x2682b4[_0x08d2('0x1d')];var _0x1b709e=_0x402451?_0x414577[_0x08d2('0x1e')]:_0x2682b4[_0x08d2('0x1d')]+_0x2682b4[_0x08d2('0x1c')];var _0x2b28b5;if(_0x1b709e>=_0x2a8aa6){_0x1b709e=_0x2a8aa6;_0x2b28b5=0xc8;}else{_0x2b28b5=0xce;}_0x46f646[_0x08d2('0x18')](_0x2b28b5);return _0x46f646['set'](_0x08d2('0x1f'),_0x348ce3+'-'+_0x1b709e+'/'+_0x2a8aa6)['json'](_0x414577);}return null;};}function patchUpdates(_0x4e1ad2){return function(_0x582c3e){try{jsonpatch['apply'](_0x582c3e,_0x4e1ad2,!![]);}catch(_0x38e813){return BPromise[_0x08d2('0x20')](_0x38e813);}return _0x582c3e[_0x08d2('0x21')]();};}function saveUpdates(_0x4707e1,_0x180c81){return function(_0x13b500){if(_0x13b500){return _0x13b500['update'](_0x4707e1)[_0x08d2('0x22')](function(_0x5622de){return _0x5622de;});}return null;};}function removeEntity(_0x3cfcaa,_0x4535b0){return function(_0x5a353b){if(_0x5a353b){return _0x5a353b[_0x08d2('0x23')]()[_0x08d2('0x22')](function(){var _0x426ac8=_0x5a353b[_0x08d2('0x24')]({'plain':!![]});var _0x51c494=_0x08d2('0x25');return db[_0x08d2('0x26')]['destroy']({'where':{'type':_0x51c494,'resourceId':_0x426ac8['id']}})[_0x08d2('0x22')](function(){return _0x5a353b;});})[_0x08d2('0x22')](function(){_0x3cfcaa[_0x08d2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14a583,_0x45f1b2){return function(_0x53162d){if(!_0x53162d){_0x14a583[_0x08d2('0x17')](0x194);}return _0x53162d;};}function handleError(_0x1d65f7,_0x4886f7){_0x4886f7=_0x4886f7||0x1f4;return function(_0x4a9f1a){logger['error'](_0x4a9f1a[_0x08d2('0x27')]);if(_0x4a9f1a[_0x08d2('0x28')]){delete _0x4a9f1a[_0x08d2('0x28')];}_0x1d65f7[_0x08d2('0x18')](_0x4886f7)[_0x08d2('0x29')](_0x4a9f1a);};}exports[_0x08d2('0x2a')]=function(_0x4907ec,_0x207573){var _0x1af464={},_0x694fc6={},_0x1bb209={'count':0x0,'rows':[]};var _0x3d7fbf=_[_0x08d2('0x2b')](db[_0x08d2('0x2c')][_0x08d2('0x2d')],function(_0x567a6c){return{'name':_0x567a6c[_0x08d2('0x2e')],'type':_0x567a6c[_0x08d2('0x2f')]['key']};});_0x694fc6['model']=_[_0x08d2('0x2b')](_0x3d7fbf,_0x08d2('0x28'));_0x694fc6['query']=_[_0x08d2('0x30')](_0x4907ec[_0x08d2('0x31')]);_0x694fc6[_0x08d2('0x32')]=_['intersection'](_0x694fc6[_0x08d2('0x33')],_0x694fc6[_0x08d2('0x31')]);_0x1af464[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0x694fc6[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x4907ec[_0x08d2('0x31')][_0x08d2('0x36')]));_0x1af464[_0x08d2('0x34')]=_0x1af464['attributes'][_0x08d2('0x37')]?_0x1af464[_0x08d2('0x34')]:_0x694fc6['model'];if(!_0x4907ec[_0x08d2('0x31')]['hasOwnProperty'](_0x08d2('0x38'))){_0x1af464[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x4907ec['query'][_0x08d2('0x1c')]);_0x1af464[_0x08d2('0x1d')]=qs[_0x08d2('0x1d')](_0x4907ec['query'][_0x08d2('0x1d')]);}_0x1af464['order']=qs[_0x08d2('0x39')](_0x4907ec[_0x08d2('0x31')][_0x08d2('0x39')]);_0x1af464[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x4907ec[_0x08d2('0x31')],_0x694fc6[_0x08d2('0x32')]),_0x3d7fbf);if(_0x4907ec[_0x08d2('0x31')][_0x08d2('0x3c')]){_0x1af464[_0x08d2('0x3a')]=_['merge'](_0x1af464[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2b')](_0x3d7fbf,function(_0x36f0c9){if(_0x36f0c9[_0x08d2('0x2f')]!==_0x08d2('0x3d')){var _0x5f3e74={};_0x5f3e74[_0x36f0c9[_0x08d2('0x28')]]={'$like':'%'+_0x4907ec[_0x08d2('0x31')]['filter']+'%'};return _0x5f3e74;}})});}_0x1af464=_['merge']({},_0x1af464,_0x4907ec[_0x08d2('0x3e')]);var _0x263862={'where':_0x1af464['where']};return db[_0x08d2('0x2c')]['count'](_0x263862)[_0x08d2('0x22')](function(_0x48771f){_0x1bb209[_0x08d2('0x1e')]=_0x48771f;if(_0x4907ec[_0x08d2('0x31')]['includeAll']){_0x1af464[_0x08d2('0x3f')]=[{'all':!![]}];}return db[_0x08d2('0x2c')]['findAll'](_0x1af464);})['then'](function(_0x18a910){_0x1bb209['rows']=_0x18a910;return _0x1bb209;})[_0x08d2('0x22')](respondWithFilteredResult(_0x207573,_0x1af464))[_0x08d2('0x40')](handleError(_0x207573,null));};exports[_0x08d2('0x41')]=function(_0x3984ae,_0x16770e){var _0x3ecef3={'raw':![],'where':{'id':_0x3984ae[_0x08d2('0x42')]['id']}},_0x32547b={};_0x32547b['model']=_[_0x08d2('0x30')](db[_0x08d2('0x2c')]['rawAttributes']);_0x32547b[_0x08d2('0x31')]=_[_0x08d2('0x30')](_0x3984ae['query']);_0x32547b[_0x08d2('0x32')]=_['intersection'](_0x32547b['model'],_0x32547b[_0x08d2('0x31')]);_0x3ecef3[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0x32547b[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x3984ae[_0x08d2('0x31')][_0x08d2('0x36')]));_0x3ecef3[_0x08d2('0x34')]=_0x3ecef3[_0x08d2('0x34')][_0x08d2('0x37')]?_0x3ecef3[_0x08d2('0x34')]:_0x32547b[_0x08d2('0x33')];if(_0x3984ae[_0x08d2('0x31')][_0x08d2('0x43')]){_0x3ecef3['include']=[{'all':!![]}];}_0x3ecef3=_['merge']({},_0x3ecef3,_0x3984ae['options']);return db[_0x08d2('0x2c')]['find'](_0x3ecef3)[_0x08d2('0x22')](handleEntityNotFound(_0x16770e,null))[_0x08d2('0x22')](respondWithResult(_0x16770e,null))[_0x08d2('0x40')](handleError(_0x16770e,null));};exports[_0x08d2('0x44')]=function(_0x419c44,_0x2dd783){return db['Trigger'][_0x08d2('0x44')](_0x419c44[_0x08d2('0x45')],{})[_0x08d2('0x22')](function(_0x39e305){var _0x5d81ed=_0x419c44['user'][_0x08d2('0x24')]({'plain':!![]});if(!_0x5d81ed)throw new Error(_0x08d2('0x46'));if(_0x5d81ed[_0x08d2('0x47')]===_0x08d2('0x48')){var _0x22da5c=_0x39e305['get']({'plain':!![]});var _0x3fb0c4=_0x08d2('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x3fb0c4,'userProfileId':_0x5d81ed[_0x08d2('0x49')]},'raw':!![]})[_0x08d2('0x22')](function(_0x2de158){if(_0x2de158&&_0x2de158[_0x08d2('0x4a')]===0x0){return db[_0x08d2('0x26')]['create']({'name':_0x22da5c[_0x08d2('0x28')],'resourceId':_0x22da5c['id'],'type':_0x2de158[_0x08d2('0x28')],'sectionId':_0x2de158['id']},{})[_0x08d2('0x22')](function(){return _0x39e305;});}else{return _0x39e305;}})[_0x08d2('0x40')](function(_0x385e9c){logger[_0x08d2('0x4b')](_0x08d2('0x4c'),_0x385e9c);throw _0x385e9c;});}return _0x39e305;})['then'](respondWithResult(_0x2dd783,0xc9))[_0x08d2('0x40')](handleError(_0x2dd783,null));};exports[_0x08d2('0x4d')]=function(_0x51d5e5,_0xd51932){if(_0x51d5e5['body']['id']){delete _0x51d5e5[_0x08d2('0x45')]['id'];}return db['Trigger'][_0x08d2('0x4e')]({'where':{'id':_0x51d5e5['params']['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0xd51932,null))[_0x08d2('0x22')](saveUpdates(_0x51d5e5[_0x08d2('0x45')],null))[_0x08d2('0x22')](respondWithResult(_0xd51932,null))[_0x08d2('0x40')](handleError(_0xd51932,null));};exports[_0x08d2('0x23')]=function(_0x4b0f1c,_0x42b7ba){return db[_0x08d2('0x2c')]['find']({'where':{'id':_0x4b0f1c[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x42b7ba,null))[_0x08d2('0x22')](removeEntity(_0x42b7ba,null))[_0x08d2('0x40')](handleError(_0x42b7ba,null));};exports[_0x08d2('0x4f')]=function(_0x571673,_0x119cdb,_0x90ddd5){if(_0x571673[_0x08d2('0x45')]['id']){delete _0x571673[_0x08d2('0x45')]['id'];}return db[_0x08d2('0x2c')]['find']({'where':{'id':_0x571673[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x119cdb,null))['then'](function(_0x40e1c1){if(_0x40e1c1){_0x571673[_0x08d2('0x45')][_0x08d2('0x50')]=_0x40e1c1['id'];return db[_0x08d2('0x51')][_0x08d2('0x44')](_0x571673[_0x08d2('0x45')]);}})[_0x08d2('0x22')](respondWithResult(_0x119cdb,null))[_0x08d2('0x40')](handleError(_0x119cdb,null));};exports[_0x08d2('0x52')]=function(_0x612003,_0x16c7ee,_0x51c74a){if(_0x612003[_0x08d2('0x45')]['id']){delete _0x612003[_0x08d2('0x45')]['id'];}return db[_0x08d2('0x2c')][_0x08d2('0x4e')]({'where':{'id':_0x612003[_0x08d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x16c7ee,null))[_0x08d2('0x22')](function(_0x1e84d4){if(_0x1e84d4){_0x612003[_0x08d2('0x45')][_0x08d2('0x53')]=_0x1e84d4['id'];return db[_0x08d2('0x51')][_0x08d2('0x44')](_0x612003[_0x08d2('0x45')]);}})[_0x08d2('0x22')](respondWithResult(_0x16c7ee,null))[_0x08d2('0x40')](handleError(_0x16c7ee,null));};exports[_0x08d2('0x54')]=function(_0x567d77,_0x33f617,_0x226aa1){var _0x10ee97={};var _0x3dc173={};var _0xd18268;var _0x21b66b;return db['Trigger'][_0x08d2('0x55')]({'where':{'id':_0x567d77[_0x08d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x33f617,null))[_0x08d2('0x22')](function(_0x5f3c0a){if(_0x5f3c0a){_0xd18268=_0x5f3c0a;_0x3dc173['model']=_[_0x08d2('0x30')](db[_0x08d2('0x51')][_0x08d2('0x2d')]);_0x3dc173[_0x08d2('0x31')]=_[_0x08d2('0x30')](_0x567d77[_0x08d2('0x31')]);_0x3dc173[_0x08d2('0x32')]=_[_0x08d2('0x35')](_0x3dc173[_0x08d2('0x33')],_0x3dc173[_0x08d2('0x31')]);_0x10ee97[_0x08d2('0x34')]=_['intersection'](_0x3dc173[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x567d77[_0x08d2('0x31')][_0x08d2('0x36')]));_0x10ee97[_0x08d2('0x34')]=_0x10ee97[_0x08d2('0x34')][_0x08d2('0x37')]?_0x10ee97['attributes']:_0x3dc173[_0x08d2('0x33')];_0x10ee97[_0x08d2('0x56')]=qs['sort'](_0x567d77[_0x08d2('0x31')][_0x08d2('0x39')]);_0x10ee97[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x567d77[_0x08d2('0x31')],_0x3dc173['filters']));if(_0x567d77[_0x08d2('0x31')][_0x08d2('0x3c')]){_0x10ee97[_0x08d2('0x3a')]=_[_0x08d2('0x57')](_0x10ee97[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2b')](_0x10ee97[_0x08d2('0x34')],function(_0x24b08c){var _0x28210c={};_0x28210c[_0x24b08c]={'$like':'%'+_0x567d77[_0x08d2('0x31')][_0x08d2('0x3c')]+'%'};return _0x28210c;})});}_0x10ee97=_[_0x08d2('0x57')]({},_0x10ee97,_0x567d77[_0x08d2('0x3e')]);return _0xd18268['getAllConditions'](_0x10ee97);}})[_0x08d2('0x22')](function(_0x1a7540){if(_0x1a7540){_0x21b66b=_0x1a7540['length'];if(!_0x567d77[_0x08d2('0x31')][_0x08d2('0x58')](_0x08d2('0x38'))){_0x10ee97[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x567d77[_0x08d2('0x31')][_0x08d2('0x1c')]);_0x10ee97['offset']=qs[_0x08d2('0x1d')](_0x567d77[_0x08d2('0x31')][_0x08d2('0x1d')]);}return _0xd18268[_0x08d2('0x54')](_0x10ee97);}})[_0x08d2('0x22')](function(_0x25ae67){if(_0x25ae67){return _0x25ae67?{'count':_0x21b66b,'rows':_0x25ae67}:null;}})[_0x08d2('0x22')](respondWithResult(_0x33f617,null))['catch'](handleError(_0x33f617,null));};exports[_0x08d2('0x59')]=function(_0x47ca42,_0x139a6b,_0x5d7b31){var _0x3d31b1={};var _0x39d3c3={};var _0x2c78ba;var _0x3f4d76;return db[_0x08d2('0x2c')]['findOne']({'where':{'id':_0x47ca42[_0x08d2('0x42')]['id']}})['then'](handleEntityNotFound(_0x139a6b,null))[_0x08d2('0x22')](function(_0x2d0588){if(_0x2d0588){_0x2c78ba=_0x2d0588;_0x39d3c3[_0x08d2('0x33')]=_[_0x08d2('0x30')](db[_0x08d2('0x51')]['rawAttributes']);_0x39d3c3[_0x08d2('0x31')]=_[_0x08d2('0x30')](_0x47ca42[_0x08d2('0x31')]);_0x39d3c3[_0x08d2('0x32')]=_[_0x08d2('0x35')](_0x39d3c3[_0x08d2('0x33')],_0x39d3c3[_0x08d2('0x31')]);_0x3d31b1[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0x39d3c3[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x47ca42[_0x08d2('0x31')][_0x08d2('0x36')]));_0x3d31b1['attributes']=_0x3d31b1[_0x08d2('0x34')][_0x08d2('0x37')]?_0x3d31b1['attributes']:_0x39d3c3[_0x08d2('0x33')];_0x3d31b1['order']=qs[_0x08d2('0x39')](_0x47ca42[_0x08d2('0x31')][_0x08d2('0x39')]);_0x3d31b1[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x47ca42[_0x08d2('0x31')],_0x39d3c3['filters']));if(_0x47ca42[_0x08d2('0x31')][_0x08d2('0x3c')]){_0x3d31b1[_0x08d2('0x3a')]=_[_0x08d2('0x57')](_0x3d31b1['where'],{'$or':_[_0x08d2('0x2b')](_0x3d31b1[_0x08d2('0x34')],function(_0x4874bf){var _0x2ebe49={};_0x2ebe49[_0x4874bf]={'$like':'%'+_0x47ca42[_0x08d2('0x31')][_0x08d2('0x3c')]+'%'};return _0x2ebe49;})});}_0x3d31b1=_[_0x08d2('0x57')]({},_0x3d31b1,_0x47ca42['options']);return _0x2c78ba['getAnyConditions'](_0x3d31b1);}})[_0x08d2('0x22')](function(_0x295545){if(_0x295545){_0x3f4d76=_0x295545[_0x08d2('0x37')];if(!_0x47ca42['query']['hasOwnProperty'](_0x08d2('0x38'))){_0x3d31b1['limit']=qs[_0x08d2('0x1c')](_0x47ca42[_0x08d2('0x31')]['limit']);_0x3d31b1[_0x08d2('0x1d')]=qs['offset'](_0x47ca42[_0x08d2('0x31')][_0x08d2('0x1d')]);}return _0x2c78ba[_0x08d2('0x59')](_0x3d31b1);}})['then'](function(_0x474f5d){if(_0x474f5d){return _0x474f5d?{'count':_0x3f4d76,'rows':_0x474f5d}:null;}})[_0x08d2('0x22')](respondWithResult(_0x139a6b,null))[_0x08d2('0x40')](handleError(_0x139a6b,null));};exports[_0x08d2('0x5a')]=function(_0x8281f0,_0x1be192,_0x417db5){if(_0x8281f0['body']['id']){delete _0x8281f0[_0x08d2('0x45')]['id'];}return db[_0x08d2('0x2c')][_0x08d2('0x4e')]({'where':{'id':_0x8281f0[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x1be192,null))[_0x08d2('0x22')](function(_0x58fae8){if(_0x58fae8){_0x8281f0['body']['TriggerId']=_0x58fae8['id'];return db[_0x08d2('0x5b')][_0x08d2('0x44')](_0x8281f0['body']);}})[_0x08d2('0x22')](respondWithResult(_0x1be192,null))['catch'](handleError(_0x1be192,null));};exports['getActions']=function(_0x5959c4,_0x23d68a,_0x565892){var _0x391d3c={};var _0xaed431={};var _0x22c8f9;var _0x2d0c91;return db[_0x08d2('0x2c')][_0x08d2('0x55')]({'where':{'id':_0x5959c4[_0x08d2('0x42')]['id']}})[_0x08d2('0x22')](handleEntityNotFound(_0x23d68a,null))[_0x08d2('0x22')](function(_0x1025a8){if(_0x1025a8){_0x22c8f9=_0x1025a8;_0xaed431[_0x08d2('0x33')]=_[_0x08d2('0x30')](db[_0x08d2('0x5b')][_0x08d2('0x2d')]);_0xaed431['query']=_[_0x08d2('0x30')](_0x5959c4[_0x08d2('0x31')]);_0xaed431['filters']=_[_0x08d2('0x35')](_0xaed431[_0x08d2('0x33')],_0xaed431['query']);_0x391d3c[_0x08d2('0x34')]=_[_0x08d2('0x35')](_0xaed431[_0x08d2('0x33')],qs[_0x08d2('0x36')](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x36')]));_0x391d3c[_0x08d2('0x34')]=_0x391d3c[_0x08d2('0x34')]['length']?_0x391d3c[_0x08d2('0x34')]:_0xaed431[_0x08d2('0x33')];_0x391d3c['order']=qs['sort'](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x39')]);_0x391d3c[_0x08d2('0x3a')]=qs[_0x08d2('0x32')](_[_0x08d2('0x3b')](_0x5959c4[_0x08d2('0x31')],_0xaed431[_0x08d2('0x32')]));if(_0x5959c4['query'][_0x08d2('0x3c')]){_0x391d3c['where']=_[_0x08d2('0x57')](_0x391d3c[_0x08d2('0x3a')],{'$or':_[_0x08d2('0x2b')](_0x391d3c[_0x08d2('0x34')],function(_0x59da48){var _0x1bccfd={};_0x1bccfd[_0x59da48]={'$like':'%'+_0x5959c4[_0x08d2('0x31')]['filter']+'%'};return _0x1bccfd;})});}_0x391d3c=_[_0x08d2('0x57')]({},_0x391d3c,_0x5959c4['options']);return _0x22c8f9[_0x08d2('0x5c')](_0x391d3c);}})[_0x08d2('0x22')](function(_0x28a6ca){if(_0x28a6ca){_0x2d0c91=_0x28a6ca[_0x08d2('0x37')];if(!_0x5959c4[_0x08d2('0x31')][_0x08d2('0x58')]('nolimit')){_0x391d3c[_0x08d2('0x1c')]=qs[_0x08d2('0x1c')](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x1c')]);_0x391d3c[_0x08d2('0x1d')]=qs[_0x08d2('0x1d')](_0x5959c4[_0x08d2('0x31')][_0x08d2('0x1d')]);}return _0x22c8f9['getActions'](_0x391d3c);}})[_0x08d2('0x22')](function(_0x54fc90){if(_0x54fc90){return _0x54fc90?{'count':_0x2d0c91,'rows':_0x54fc90}:null;}})[_0x08d2('0x22')](respondWithResult(_0x23d68a,null))['catch'](handleError(_0x23d68a,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index de01a8a..c34e030 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 _0x45ea=['./trigger.attributes','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xaa7f3f,_0x3b18f8){var _0x3733ba=function(_0x1256c1){while(--_0x1256c1){_0xaa7f3f['push'](_0xaa7f3f['shift']());}};_0x3733ba(++_0x3b18f8);}(_0x45ea,0x1f0));var _0xa45e=function(_0x3aea81,_0x9751c0){_0x3aea81=_0x3aea81-0x0;var _0x5d2956=_0x45ea[_0x3aea81];return _0x5d2956;};'use strict';var _=require(_0xa45e('0x0'));var util=require(_0xa45e('0x1'));var logger=require(_0xa45e('0x2'))(_0xa45e('0x3'));var moment=require(_0xa45e('0x4'));var BPromise=require(_0xa45e('0x5'));var rp=require(_0xa45e('0x6'));var fs=require('fs');var path=require(_0xa45e('0x7'));var rimraf=require(_0xa45e('0x8'));var config=require(_0xa45e('0x9'));var attributes=require(_0xa45e('0xa'));module['exports']=function(_0x418a41,_0x3ee60d){return _0x418a41['define']('Trigger',attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x202c=['moment','bluebird','path','rimraf','../../config/environment','./trigger.attributes','Trigger','lodash','api'];(function(_0xbe38bd,_0x7a72f7){var _0x4a9f41=function(_0x57ab9a){while(--_0x57ab9a){_0xbe38bd['push'](_0xbe38bd['shift']());}};_0x4a9f41(++_0x7a72f7);}(_0x202c,0x178));var _0xc202=function(_0x282477,_0x3363c7){_0x282477=_0x282477-0x0;var _0x1cdbad=_0x202c[_0x282477];return _0x1cdbad;};'use strict';var _=require(_0xc202('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc202('0x1'));var moment=require(_0xc202('0x2'));var BPromise=require(_0xc202('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc202('0x4'));var rimraf=require(_0xc202('0x5'));var config=require(_0xc202('0x6'));var attributes=require(_0xc202('0x7'));module['exports']=function(_0x28e51c,_0x68d363){return _0x28e51c['define'](_0xc202('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index f153708..39ea026 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 _0xe507=['message','result','GetTrigger','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','catch','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x130d82,_0x25f49b){var _0x112070=function(_0x5795ee){while(--_0x5795ee){_0x130d82['push'](_0x130d82['shift']());}};_0x112070(++_0x25f49b);}(_0xe507,0xe7));var _0x7e50=function(_0x168478,_0x323a27){_0x168478=_0x168478-0x0;var _0x29c2f8=_0xe507[_0x168478];return _0x29c2f8;};'use strict';var _=require(_0x7e50('0x0'));var util=require('util');var moment=require(_0x7e50('0x1'));var BPromise=require(_0x7e50('0x2'));var rs=require(_0x7e50('0x3'));var fs=require('fs');var Redis=require(_0x7e50('0x4'));var db=require(_0x7e50('0x5'))['db'];var utils=require(_0x7e50('0x6'));var logger=require(_0x7e50('0x7'))(_0x7e50('0x8'));var config=require(_0x7e50('0x9'));var jayson=require(_0x7e50('0xa'));var client=jayson[_0x7e50('0xb')][_0x7e50('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a1def,_0x2105f4,_0x7a3f4e){return new BPromise(function(_0x34ee8c,_0x5ee1b1){return client['request'](_0x5a1def,_0x7a3f4e)[_0x7e50('0xd')](function(_0x5ef2a2){logger[_0x7e50('0xe')](_0x7e50('0xf'),_0x2105f4,_0x7e50('0x10'));logger[_0x7e50('0x11')](_0x7e50('0x12'),_0x2105f4,_0x7e50('0x10'),JSON[_0x7e50('0x13')](_0x5ef2a2));if(_0x5ef2a2['error']){if(_0x5ef2a2[_0x7e50('0x14')]['code']===0x1f4){logger['error'](_0x7e50('0xf'),_0x2105f4,_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);return _0x5ee1b1(_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);}logger[_0x7e50('0x14')](_0x7e50('0xf'),_0x2105f4,_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);return _0x34ee8c(_0x5ef2a2[_0x7e50('0x14')][_0x7e50('0x15')]);}else{logger[_0x7e50('0xe')](_0x7e50('0xf'),_0x2105f4,_0x7e50('0x10'));_0x34ee8c(_0x5ef2a2[_0x7e50('0x16')][_0x7e50('0x15')]);}})['catch'](function(_0x46580d){logger['error'](_0x7e50('0xf'),_0x2105f4,_0x46580d);_0x5ee1b1(_0x46580d);});});}exports[_0x7e50('0x17')]=function(_0x37daaa){var _0x147197=this;return new Promise(function(_0x1f0711,_0x1bd9f6){return db[_0x7e50('0x18')][_0x7e50('0x19')]({'raw':_0x37daaa[_0x7e50('0x1a')]?_0x37daaa[_0x7e50('0x1a')][_0x7e50('0x1b')]===undefined?!![]:![]:!![],'where':_0x37daaa[_0x7e50('0x1a')]?_0x37daaa[_0x7e50('0x1a')][_0x7e50('0x1c')]||null:null,'attributes':_0x37daaa['options']?_0x37daaa[_0x7e50('0x1a')][_0x7e50('0x1d')]||null:null,'limit':_0x37daaa['options']?_0x37daaa['options'][_0x7e50('0x1e')]||null:null,'include':_0x37daaa[_0x7e50('0x1a')]?_0x37daaa[_0x7e50('0x1a')]['include']?_[_0x7e50('0x1f')](_0x37daaa[_0x7e50('0x1a')]['include'],function(_0x307f69){return{'model':db[_0x307f69['model']],'as':_0x307f69['as'],'attributes':_0x307f69['attributes'],'include':_0x307f69[_0x7e50('0x20')]?_['map'](_0x307f69['include'],function(_0x373db2){return{'model':db[_0x373db2[_0x7e50('0x21')]],'as':_0x373db2['as'],'attributes':_0x373db2[_0x7e50('0x1d')],'include':_0x373db2[_0x7e50('0x20')]?_[_0x7e50('0x1f')](_0x373db2[_0x7e50('0x20')],function(_0x185caf){return{'model':db[_0x185caf[_0x7e50('0x21')]],'as':_0x185caf['as'],'attributes':_0x185caf[_0x7e50('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39b77e){logger['info']('GetTrigger',_0x37daaa);logger['debug'](_0x7e50('0x17'),_0x37daaa,JSON[_0x7e50('0x13')](_0x39b77e));_0x1f0711(_0x39b77e);})[_0x7e50('0x22')](function(_0x71af51){logger[_0x7e50('0x14')](_0x7e50('0x17'),_0x71af51[_0x7e50('0x15')],_0x37daaa);_0x1bd9f6(_0x147197['error'](0x1f4,_0x71af51[_0x7e50('0x15')]));});});};exports['ShowTrigger']=function(_0x170a8b){var _0x3212e6=this;return new Promise(function(_0x3c8322,_0x125742){return db[_0x7e50('0x18')]['find']({'raw':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b[_0x7e50('0x1a')][_0x7e50('0x1b')]===undefined?!![]:![]:!![],'where':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b[_0x7e50('0x1a')][_0x7e50('0x1c')]||null:null,'attributes':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b['options']['attributes']||null:null,'include':_0x170a8b[_0x7e50('0x1a')]?_0x170a8b['options'][_0x7e50('0x20')]?_[_0x7e50('0x1f')](_0x170a8b[_0x7e50('0x1a')][_0x7e50('0x20')],function(_0x4b0519){return{'model':db[_0x4b0519[_0x7e50('0x21')]],'as':_0x4b0519['as'],'attributes':_0x4b0519[_0x7e50('0x1d')],'include':_0x4b0519[_0x7e50('0x20')]?_['map'](_0x4b0519['include'],function(_0xa1ac94){return{'model':db[_0xa1ac94[_0x7e50('0x21')]],'as':_0xa1ac94['as'],'attributes':_0xa1ac94[_0x7e50('0x1d')],'include':_0xa1ac94[_0x7e50('0x20')]?_[_0x7e50('0x1f')](_0xa1ac94[_0x7e50('0x20')],function(_0x8de204){return{'model':db[_0x8de204[_0x7e50('0x21')]],'as':_0x8de204['as'],'attributes':_0x8de204[_0x7e50('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53a4d8){logger[_0x7e50('0xe')](_0x7e50('0x23'),_0x170a8b);logger[_0x7e50('0x11')](_0x7e50('0x23'),_0x170a8b,JSON['stringify'](_0x53a4d8));_0x3c8322(_0x53a4d8);})[_0x7e50('0x22')](function(_0x4cd447){logger[_0x7e50('0x14')](_0x7e50('0x23'),_0x4cd447['message'],_0x170a8b);_0x125742(_0x3212e6[_0x7e50('0x14')](0x1f4,_0x4cd447[_0x7e50('0x15')]));});});}; \ No newline at end of file +var _0x896f=['model','map','then','ShowTrigger','where','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','Trigger,\x20%s,\x20%s','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','result','catch','GetTrigger','Trigger','findAll','options','raw','attributes','limit','include'];(function(_0xba144b,_0x62e472){var _0x43b7f1=function(_0x28485b){while(--_0x28485b){_0xba144b['push'](_0xba144b['shift']());}};_0x43b7f1(++_0x62e472);}(_0x896f,0x1d3));var _0xf896=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x896f[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require(_0xf896('0x0'));var util=require(_0xf896('0x1'));var moment=require('moment');var BPromise=require(_0xf896('0x2'));var rs=require(_0xf896('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf896('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf896('0x5'))(_0xf896('0x6'));var config=require('../../config/environment');var jayson=require(_0xf896('0x7'));var client=jayson[_0xf896('0x8')][_0xf896('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5577de,_0x23396f,_0x2c0f9e){return new BPromise(function(_0x2f2f5e,_0x2ace85){return client['request'](_0x5577de,_0x2c0f9e)['then'](function(_0x57d7ea){logger['info'](_0xf896('0xa'),_0x23396f,'request\x20sent');logger[_0xf896('0xb')](_0xf896('0xc'),_0x23396f,'request\x20sent',JSON[_0xf896('0xd')](_0x57d7ea));if(_0x57d7ea[_0xf896('0xe')]){if(_0x57d7ea[_0xf896('0xe')]['code']===0x1f4){logger[_0xf896('0xe')](_0xf896('0xa'),_0x23396f,_0x57d7ea['error'][_0xf896('0xf')]);return _0x2ace85(_0x57d7ea['error'][_0xf896('0xf')]);}logger[_0xf896('0xe')]('Trigger,\x20%s,\x20%s',_0x23396f,_0x57d7ea[_0xf896('0xe')][_0xf896('0xf')]);return _0x2f2f5e(_0x57d7ea['error']['message']);}else{logger[_0xf896('0x10')](_0xf896('0xa'),_0x23396f,_0xf896('0x11'));_0x2f2f5e(_0x57d7ea[_0xf896('0x12')][_0xf896('0xf')]);}})[_0xf896('0x13')](function(_0x3c87c){logger[_0xf896('0xe')](_0xf896('0xa'),_0x23396f,_0x3c87c);_0x2ace85(_0x3c87c);});});}exports[_0xf896('0x14')]=function(_0x423a80){var _0x28ea16=this;return new Promise(function(_0x38c424,_0x32322b){return db[_0xf896('0x15')][_0xf896('0x16')]({'raw':_0x423a80['options']?_0x423a80[_0xf896('0x17')][_0xf896('0x18')]===undefined?!![]:![]:!![],'where':_0x423a80[_0xf896('0x17')]?_0x423a80['options']['where']||null:null,'attributes':_0x423a80['options']?_0x423a80[_0xf896('0x17')][_0xf896('0x19')]||null:null,'limit':_0x423a80[_0xf896('0x17')]?_0x423a80[_0xf896('0x17')][_0xf896('0x1a')]||null:null,'include':_0x423a80[_0xf896('0x17')]?_0x423a80[_0xf896('0x17')][_0xf896('0x1b')]?_['map'](_0x423a80[_0xf896('0x17')][_0xf896('0x1b')],function(_0x6e69dc){return{'model':db[_0x6e69dc[_0xf896('0x1c')]],'as':_0x6e69dc['as'],'attributes':_0x6e69dc[_0xf896('0x19')],'include':_0x6e69dc[_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x6e69dc['include'],function(_0x3f62bb){return{'model':db[_0x3f62bb[_0xf896('0x1c')]],'as':_0x3f62bb['as'],'attributes':_0x3f62bb[_0xf896('0x19')],'include':_0x3f62bb[_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x3f62bb['include'],function(_0xd4d54c){return{'model':db[_0xd4d54c['model']],'as':_0xd4d54c['as'],'attributes':_0xd4d54c[_0xf896('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf896('0x1e')](function(_0x3e884b){logger[_0xf896('0x10')](_0xf896('0x14'),_0x423a80);logger[_0xf896('0xb')](_0xf896('0x14'),_0x423a80,JSON[_0xf896('0xd')](_0x3e884b));_0x38c424(_0x3e884b);})[_0xf896('0x13')](function(_0x22fb11){logger[_0xf896('0xe')](_0xf896('0x14'),_0x22fb11[_0xf896('0xf')],_0x423a80);_0x32322b(_0x28ea16[_0xf896('0xe')](0x1f4,_0x22fb11['message']));});});};exports[_0xf896('0x1f')]=function(_0x1958fd){var _0x357bfc=this;return new Promise(function(_0x1d7fe1,_0xc371d5){return db[_0xf896('0x15')]['find']({'raw':_0x1958fd[_0xf896('0x17')]?_0x1958fd[_0xf896('0x17')][_0xf896('0x18')]===undefined?!![]:![]:!![],'where':_0x1958fd['options']?_0x1958fd['options'][_0xf896('0x20')]||null:null,'attributes':_0x1958fd[_0xf896('0x17')]?_0x1958fd[_0xf896('0x17')][_0xf896('0x19')]||null:null,'include':_0x1958fd[_0xf896('0x17')]?_0x1958fd[_0xf896('0x17')][_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x1958fd[_0xf896('0x17')][_0xf896('0x1b')],function(_0x1de0c0){return{'model':db[_0x1de0c0['model']],'as':_0x1de0c0['as'],'attributes':_0x1de0c0[_0xf896('0x19')],'include':_0x1de0c0[_0xf896('0x1b')]?_[_0xf896('0x1d')](_0x1de0c0[_0xf896('0x1b')],function(_0x45dfa6){return{'model':db[_0x45dfa6[_0xf896('0x1c')]],'as':_0x45dfa6['as'],'attributes':_0x45dfa6[_0xf896('0x19')],'include':_0x45dfa6['include']?_['map'](_0x45dfa6['include'],function(_0x2be11e){return{'model':db[_0x2be11e['model']],'as':_0x2be11e['as'],'attributes':_0x2be11e[_0xf896('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf896('0x1e')](function(_0x10accc){logger['info']('ShowTrigger',_0x1958fd);logger[_0xf896('0xb')](_0xf896('0x1f'),_0x1958fd,JSON['stringify'](_0x10accc));_0x1d7fe1(_0x10accc);})[_0xf896('0x13')](function(_0x22ca7){logger['error'](_0xf896('0x1f'),_0x22ca7[_0xf896('0xf')],_0x1958fd);_0xc371d5(_0x357bfc[_0xf896('0xe')](0x1f4,_0x22ca7[_0xf896('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index a8214bd..f11984b 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 _0x800e=['index','/:id','show','/:id/clone','clone','post','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x800e,0x16a));var _0xe800=function(_0x179e11,_0xf65436){_0x179e11=_0x179e11-0x0;var _0x549f04=_0x800e[_0x179e11];return _0x549f04;};'use strict';var multer=require('multer');var util=require(_0xe800('0x0'));var path=require(_0xe800('0x1'));var timeout=require(_0xe800('0x2'));var express=require(_0xe800('0x3'));var router=express[_0xe800('0x4')]();var fs_extra=require(_0xe800('0x5'));var auth=require(_0xe800('0x6'));var interaction=require(_0xe800('0x7'));var config=require(_0xe800('0x8'));var controller=require(_0xe800('0x9'));router[_0xe800('0xa')]('/',auth[_0xe800('0xb')](),controller[_0xe800('0xc')]);router[_0xe800('0xa')](_0xe800('0xd'),auth['isAuthenticated'](),controller[_0xe800('0xe')]);router['post'](_0xe800('0xf'),auth['isAuthenticated'](),controller[_0xe800('0x10')]);router[_0xe800('0x11')]('/',auth[_0xe800('0xb')](),controller['create']);router['put'](_0xe800('0xd'),auth[_0xe800('0xb')](),controller[_0xe800('0x12')]);router[_0xe800('0x13')](_0xe800('0xd'),auth['isAuthenticated'](),controller[_0xe800('0x14')]);module[_0xe800('0x15')]=router; \ No newline at end of file +var _0xd69c=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','post','/:id/clone','clone','create','update','delete','/:id','destroy','util','path','connect-timeout'];(function(_0x40de3b,_0x55f385){var _0x344610=function(_0x5ee1fa){while(--_0x5ee1fa){_0x40de3b['push'](_0x40de3b['shift']());}};_0x344610(++_0x55f385);}(_0xd69c,0x107));var _0xcd69=function(_0x281178,_0x3ef44f){_0x281178=_0x281178-0x0;var _0x2f9ac4=_0xd69c[_0x281178];return _0x2f9ac4;};'use strict';var multer=require('multer');var util=require(_0xcd69('0x0'));var path=require(_0xcd69('0x1'));var timeout=require(_0xcd69('0x2'));var express=require(_0xcd69('0x3'));var router=express[_0xcd69('0x4')]();var fs_extra=require(_0xcd69('0x5'));var auth=require(_0xcd69('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xcd69('0x7'));var controller=require(_0xcd69('0x8'));router[_0xcd69('0x9')]('/',auth[_0xcd69('0xa')](),controller['index']);router[_0xcd69('0x9')]('/:id',auth[_0xcd69('0xa')](),controller['show']);router[_0xcd69('0xb')](_0xcd69('0xc'),auth[_0xcd69('0xa')](),controller[_0xcd69('0xd')]);router['post']('/',auth[_0xcd69('0xa')](),controller[_0xcd69('0xe')]);router['put']('/:id',auth[_0xcd69('0xa')](),controller[_0xcd69('0xf')]);router[_0xcd69('0x10')](_0xcd69('0x11'),auth['isAuthenticated'](),controller[_0xcd69('0x12')]);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 38ae92a..7c36933 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 _0xa944=['transport','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB','udp','setDataValue','join'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa944,0x123));var _0x4a94=function(_0x524a62,_0x2f6a71){_0x524a62=_0x524a62-0x0;var _0x26e211=_0xa944[_0x524a62];return _0x26e211;};'use strict';var Sequelize=require(_0x4a94('0x0'));module[_0x4a94('0x1')]={'name':{'type':Sequelize[_0x4a94('0x2')],'allowNull':![],'unique':_0x4a94('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x5'),_0x4a94('0x6'),_0x4a94('0x7')),'allowNull':![],'defaultValue':_0x4a94('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x4a94('0x8')},'callingpres':{'type':Sequelize[_0x4a94('0x4')]('ALLOWED_NOT_SCREENED',_0x4a94('0x9'),'ALLOWED_FAILED_SCREEN',_0x4a94('0xa'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN',_0x4a94('0xb'))},'deny':{'type':Sequelize[_0x4a94('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x4a94('0x2')]},'md5secret':{'type':Sequelize[_0x4a94('0x2')]},'remotesecret':{'type':Sequelize[_0x4a94('0x2')]},'transport':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0xc'),'set':function(_0x570bf1){this[_0x4a94('0xd')]('transport',_0x570bf1?_0x570bf1[_0x4a94('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4a94('0xf'))?this[_0x4a94('0x10')](_0x4a94('0xf'))[_0x4a94('0x11')](','):null;},'comment':_0x4a94('0x12')},'dtmfmode':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x13'),_0x4a94('0x14'),_0x4a94('0x15'),_0x4a94('0x16'),'auto'),'defaultValue':_0x4a94('0x13')},'directmedia':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no','nonat',_0x4a94('0x18'),_0x4a94('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x4a94('0x4')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x4a94('0x2')]},'directmediadeny':{'type':Sequelize[_0x4a94('0x2')]},'nat':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x1a'),'set':function(_0x371fc7){this[_0x4a94('0xd')](_0x4a94('0x1b'),_0x371fc7?_0x371fc7['join'](','):null);},'get':function(){return this[_0x4a94('0x10')](_0x4a94('0x1b'))?this['getDataValue'](_0x4a94('0x1b'))[_0x4a94('0x11')](','):null;},'comment':_0x4a94('0x1c')},'callgroup':{'type':Sequelize[_0x4a94('0x2')]},'namedcallgroup':{'type':Sequelize[_0x4a94('0x2')]},'pickupgroup':{'type':Sequelize[_0x4a94('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x4a94('0x2')]},'language':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x4a94('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x1d')},'allow':{'type':Sequelize[_0x4a94('0x2')],'allowNull':![],'defaultValue':_0x4a94('0x1e'),'set':function(_0x56ff7c){this[_0x4a94('0xd')](_0x4a94('0x1f'),_0x56ff7c?_0x56ff7c[_0x4a94('0xe')](';'):_0x4a94('0x1e'));},'get':function(){return this[_0x4a94('0x10')](_0x4a94('0x1f'))?this[_0x4a94('0x10')]('allow')[_0x4a94('0x11')](';'):null;},'comment':_0x4a94('0x20')},'autoframing':{'type':Sequelize['ENUM']('yes','no')},'insecure':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x21'),'set':function(_0x2b5542){this['setDataValue'](_0x4a94('0x22'),_0x2b5542?_0x2b5542[_0x4a94('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x4a94('0x22'))?this[_0x4a94('0x10')](_0x4a94('0x22'))[_0x4a94('0x11')](','):null;},'comment':_0x4a94('0x23')},'trustrpid':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x4a94('0x4')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no',_0x4a94('0x24'))},'promiscredir':{'type':Sequelize[_0x4a94('0x4')]('yes','no')},'useclientcode':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'accountcode':{'type':Sequelize[_0x4a94('0x25')](0xb)},'setvar':{'type':Sequelize[_0x4a94('0x2')]},'callerid':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x26')},'amaflags':{'type':Sequelize[_0x4a94('0x2')]},'callcounter':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0x4a94('0x25')](0xb)},'allowoverlap':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x4a94('0x2')]},'template':{'type':Sequelize[_0x4a94('0x2')]},'videosupport':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x4a94('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x4a94('0x4')]('yes','no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x4a94('0x4')]('accept','refuse','originate')},'session_expires':{'type':Sequelize[_0x4a94('0x25')](0xb)},'session_minse':{'type':Sequelize[_0x4a94('0x25')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0x4a94('0x27'),'uas'),'defaultValue':_0x4a94('0x28')},'t38pt_usertpsource':{'type':Sequelize[_0x4a94('0x2')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x4a94('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no'),'defaultValue':_0x4a94('0x17')},'keepalive':{'type':Sequelize[_0x4a94('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x4a94('0x2')]},'defaultuser':{'type':Sequelize[_0x4a94('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x4a94('0x25')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no',_0x4a94('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x4a94('0x2')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x4a94('0x25')](0xb)},'timerb':{'type':Sequelize[_0x4a94('0x25')](0xb)},'qualifyfreq':{'type':Sequelize[_0x4a94('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x4a94('0x2')]},'contactdeny':{'type':Sequelize[_0x4a94('0x2')]},'contactacl':{'type':Sequelize[_0x4a94('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x4a94('0x2')]},'use_q850_reason':{'type':Sequelize[_0x4a94('0x2')]},'maxforwards':{'type':Sequelize[_0x4a94('0x25')](0xb)},'encryption':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'force_avp':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'icesupport':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x4a94('0x4')]('yes','no',_0x4a94('0x2a'),_0x4a94('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x4a94('0x25')](0xb)},'dtlscertfile':{'type':Sequelize[_0x4a94('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x4a94('0x2')]},'dtlscafile':{'type':Sequelize[_0x4a94('0x2')]},'dtlscapath':{'type':Sequelize[_0x4a94('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0x4a94('0x2c'),_0x4a94('0x2d'),_0x4a94('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x4a94('0x2')]},'usereqphone':{'type':Sequelize[_0x4a94('0x4')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x4a94('0x2')]},'recordofffeature':{'type':Sequelize[_0x4a94('0x2')]},'call_limit':{'type':Sequelize[_0x4a94('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x4a94('0x17'),'no')},'subscribemwi':{'type':Sequelize[_0x4a94('0x4')](_0x4a94('0x17'),'no')},'vmexten':{'type':Sequelize[_0x4a94('0x2')]},'mohinterpret':{'type':Sequelize[_0x4a94('0x2')]},'mohsuggest':{'type':Sequelize[_0x4a94('0x2')]},'parkinglot':{'type':Sequelize[_0x4a94('0x2')]},'description':{'type':Sequelize[_0x4a94('0x2')]},'host':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':_0x4a94('0x2f')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0x4a94('0x30'),_0x4a94('0x18'),_0x4a94('0x31')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x4a94('0x2')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x4a94('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x4a94('0x2')],'defaultValue':'no'}}; \ No newline at end of file +var _0x2db9=['transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','outgoing','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','\x22\x22\x20<>','always','refuse','originate','uas','pai','fingerprint','certificate','passive','actpass','dynamic','nonat','update','BOOLEAN','sequelize','STRING','name','friend','user','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp'];(function(_0x38953b,_0x5b1078){var _0x1445f2=function(_0x22d728){while(--_0x22d728){_0x38953b['push'](_0x38953b['shift']());}};_0x1445f2(++_0x5b1078);}(_0x2db9,0x11f));var _0x92db=function(_0x78c6ae,_0xdf8c05){_0x78c6ae=_0x78c6ae-0x0;var _0x3d65bd=_0x2db9[_0x78c6ae];return _0x3d65bd;};'use strict';var Sequelize=require(_0x92db('0x0'));module['exports']={'name':{'type':Sequelize[_0x92db('0x1')],'allowNull':![],'unique':_0x92db('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x92db('0x3'),_0x92db('0x4'),'peer'),'allowNull':![],'defaultValue':_0x92db('0x3')},'context':{'type':Sequelize[_0x92db('0x1')],'allowNull':![],'defaultValue':'from-voip-provider'},'callingpres':{'type':Sequelize[_0x92db('0x5')]('ALLOWED_NOT_SCREENED',_0x92db('0x6'),'ALLOWED_FAILED_SCREEN',_0x92db('0x7'),_0x92db('0x8'),_0x92db('0x9'),_0x92db('0xa'),_0x92db('0xb'))},'deny':{'type':Sequelize[_0x92db('0x1')]},'permit':{'type':Sequelize[_0x92db('0x1')]},'secret':{'type':Sequelize[_0x92db('0x1')]},'md5secret':{'type':Sequelize[_0x92db('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0xc'),'set':function(_0x5dc302){this['setDataValue'](_0x92db('0xd'),_0x5dc302?_0x5dc302[_0x92db('0xe')](','):null);},'get':function(){return this[_0x92db('0xf')](_0x92db('0xd'))?this[_0x92db('0xf')](_0x92db('0xd'))[_0x92db('0x10')](','):null;},'comment':_0x92db('0x11')},'dtmfmode':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x12'),_0x92db('0x13'),_0x92db('0x14'),_0x92db('0x15'),_0x92db('0x16')),'defaultValue':_0x92db('0x12')},'directmedia':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no','nonat','update',_0x92db('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x92db('0x1')]},'nat':{'type':Sequelize['STRING'],'defaultValue':_0x92db('0x19'),'set':function(_0x540aca){this[_0x92db('0x1a')](_0x92db('0x1b'),_0x540aca?_0x540aca[_0x92db('0xe')](','):null);},'get':function(){return this['getDataValue'](_0x92db('0x1b'))?this[_0x92db('0xf')](_0x92db('0x1b'))['split'](','):null;},'comment':_0x92db('0x1c')},'callgroup':{'type':Sequelize[_0x92db('0x1')]},'namedcallgroup':{'type':Sequelize[_0x92db('0x1')]},'pickupgroup':{'type':Sequelize[_0x92db('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x92db('0x1')]},'language':{'type':Sequelize[_0x92db('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0x1d')},'allow':{'type':Sequelize[_0x92db('0x1')],'allowNull':![],'defaultValue':_0x92db('0x1e'),'set':function(_0x54f4ec){this[_0x92db('0x1a')]('allow',_0x54f4ec?_0x54f4ec[_0x92db('0xe')](';'):_0x92db('0x1e'));},'get':function(){return this[_0x92db('0xf')](_0x92db('0x1f'))?this[_0x92db('0xf')](_0x92db('0x1f'))[_0x92db('0x10')](';'):null;},'comment':_0x92db('0x20')},'autoframing':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'insecure':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0x21'),'set':function(_0x2badbc){this['setDataValue'](_0x92db('0x22'),_0x2badbc?_0x2badbc[_0x92db('0xe')](','):null);},'get':function(){return this[_0x92db('0xf')]('insecure')?this['getDataValue'](_0x92db('0x22'))[_0x92db('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x92db('0x5')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x92db('0x5')]('yes','no','never')},'promiscredir':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'useclientcode':{'type':Sequelize['ENUM'](_0x92db('0x17'),'no')},'accountcode':{'type':Sequelize[_0x92db('0x23')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x92db('0x1')],'defaultValue':_0x92db('0x24')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x92db('0x5')]('yes','no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'allowsubscribe':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'allowtransfer':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'ignoresdpversion':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'subscribecontext':{'type':Sequelize[_0x92db('0x1')]},'template':{'type':Sequelize[_0x92db('0x1')]},'videosupport':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no',_0x92db('0x25')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x92db('0x23')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'mailbox':{'type':Sequelize[_0x92db('0x1')]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x92db('0x26'),_0x92db('0x27'))},'session_expires':{'type':Sequelize[_0x92db('0x23')](0xb)},'session_minse':{'type':Sequelize[_0x92db('0x23')](0xb)},'session_refresher':{'type':Sequelize[_0x92db('0x5')]('uac',_0x92db('0x28')),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x92db('0x1')]},'regexten':{'type':Sequelize[_0x92db('0x1')]},'fromdomain':{'type':Sequelize[_0x92db('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x92db('0x23')](0x5)},'qualify':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':_0x92db('0x17')},'keepalive':{'type':Sequelize[_0x92db('0x23')](0xb)},'defaultip':{'type':Sequelize[_0x92db('0x1')]},'defaultuser':{'type':Sequelize[_0x92db('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x92db('0x23')](0xb)},'sendrpid':{'type':Sequelize[_0x92db('0x5')]('yes','no',_0x92db('0x29')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x92db('0x1')]},'callbackextension':{'type':Sequelize[_0x92db('0x1')]},'timert1':{'type':Sequelize[_0x92db('0x23')](0xb)},'timerb':{'type':Sequelize[_0x92db('0x23')](0xb)},'qualifyfreq':{'type':Sequelize[_0x92db('0x23')](0xb)},'contactpermit':{'type':Sequelize[_0x92db('0x1')]},'contactdeny':{'type':Sequelize[_0x92db('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x92db('0x1')]},'use_q850_reason':{'type':Sequelize[_0x92db('0x1')]},'maxforwards':{'type':Sequelize[_0x92db('0x23')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x92db('0x17'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'force_avp':{'type':Sequelize[_0x92db('0x5')]('yes','no')},'icesupport':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'dtlsenable':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'dtlsverify':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no',_0x92db('0x2a'),_0x92db('0x2b'))},'dtlsrekey':{'type':Sequelize[_0x92db('0x23')](0xb)},'dtlscertfile':{'type':Sequelize[_0x92db('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x92db('0x1')]},'dtlscipher':{'type':Sequelize[_0x92db('0x1')]},'dtlscafile':{'type':Sequelize[_0x92db('0x1')]},'dtlscapath':{'type':Sequelize[_0x92db('0x1')]},'dtlssetup':{'type':Sequelize[_0x92db('0x5')]('active',_0x92db('0x2c'),_0x92db('0x2d')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x92db('0x1')]},'usereqphone':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x92db('0x1')]},'recordofffeature':{'type':Sequelize[_0x92db('0x1')]},'call_limit':{'type':Sequelize[_0x92db('0x23')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM']('yes','no')},'subscribemwi':{'type':Sequelize[_0x92db('0x5')](_0x92db('0x17'),'no')},'vmexten':{'type':Sequelize[_0x92db('0x1')]},'mohinterpret':{'type':Sequelize[_0x92db('0x1')]},'mohsuggest':{'type':Sequelize[_0x92db('0x1')]},'parkinglot':{'type':Sequelize[_0x92db('0x1')]},'description':{'type':Sequelize[_0x92db('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x92db('0x2e')},'canreinvite':{'type':Sequelize['ENUM'](_0x92db('0x17'),'no',_0x92db('0x2f'),_0x92db('0x30'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x92db('0x1')]},'active':{'type':Sequelize[_0x92db('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x92db('0x1')],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index 4c8f560..71f418d 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 _0x00bb=['includeAll','findAll','rows','params','find','clone','rawAttributes','include','omit','createdAt','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','jayson/promise','client','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','Trunk,\x20%s,\x20%s','result','catch','sendStatus','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','Trunks','UserProfileResource','status','stack','name','index','map','Trunk','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options'];(function(_0x2fe58e,_0x422dfc){var _0x29dc09=function(_0x19cf93){while(--_0x19cf93){_0x2fe58e['push'](_0x2fe58e['shift']());}};_0x29dc09(++_0x422dfc);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x00bb[_0x1ac595];return _0x455fff;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];var jayson=require(_0xb00b('0x15'));var client=jayson[_0xb00b('0x16')][_0xb00b('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xef5d52,_0x1f1c1d,_0x4ada81,_0x218de2){return new BPromise(function(_0xb0d42e,_0x482fe6){var _0x88d95e=_0x218de2||client;return _0x88d95e[_0xb00b('0x18')](_0xef5d52,_0x4ada81)['then'](function(_0x5da36b){logger[_0xb00b('0x19')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,'request\x20sent');logger[_0xb00b('0x1a')](_0xb00b('0x1b'),_0x1f1c1d,_0xb00b('0x1c'),JSON[_0xb00b('0x1d')](_0x5da36b));if(_0x5da36b['error']){if(_0x5da36b[_0xb00b('0x1e')]['code']===0x1f4){logger[_0xb00b('0x1e')]('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0x482fe6(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}logger['error']('Trunk,\x20%s,\x20%s',_0x1f1c1d,_0x5da36b[_0xb00b('0x1e')]['message']);return _0xb0d42e(_0x5da36b[_0xb00b('0x1e')][_0xb00b('0x1f')]);}else{logger[_0xb00b('0x19')](_0xb00b('0x20'),_0x1f1c1d,'request\x20sent');_0xb0d42e(_0x5da36b[_0xb00b('0x21')]['message']);}})[_0xb00b('0x22')](function(_0x121ec7){logger['error'](_0xb00b('0x20'),_0x1f1c1d,_0x121ec7);_0x482fe6(_0x121ec7);});});}function respondWithStatusCode(_0x2896d1,_0x520444){_0x520444=_0x520444||0xcc;return function(_0x3ab3cc){if(_0x3ab3cc){return _0x2896d1[_0xb00b('0x23')](_0x520444);}return _0x2896d1['status'](_0x520444)[_0xb00b('0x24')]();};}function respondWithResult(_0x243fdb,_0x3c9500){_0x3c9500=_0x3c9500||0xc8;return function(_0x8caadf){if(_0x8caadf){return _0x243fdb['status'](_0x3c9500)['json'](_0x8caadf);}};}function respondWithFilteredResult(_0x3785e9,_0x490380){return function(_0x550587){if(_0x550587){var _0x4a635e=typeof _0x490380[_0xb00b('0x25')]===_0xb00b('0x26')&&typeof _0x490380[_0xb00b('0x27')]===_0xb00b('0x26');var _0x1f14fa=_0x550587[_0xb00b('0x28')];var _0x15d3b9=_0x4a635e?0x0:_0x490380['offset'];var _0x22c22d=_0x4a635e?_0x550587['count']:_0x490380[_0xb00b('0x25')]+_0x490380[_0xb00b('0x27')];var _0x5424ca;if(_0x22c22d>=_0x1f14fa){_0x22c22d=_0x1f14fa;_0x5424ca=0xc8;}else{_0x5424ca=0xce;}_0x3785e9['status'](_0x5424ca);return _0x3785e9[_0xb00b('0x29')](_0xb00b('0x2a'),_0x15d3b9+'-'+_0x22c22d+'/'+_0x1f14fa)[_0xb00b('0x2b')](_0x550587);}return null;};}function patchUpdates(_0x183233){return function(_0x303625){try{jsonpatch[_0xb00b('0x2c')](_0x303625,_0x183233,!![]);}catch(_0x2e160a){return BPromise[_0xb00b('0x2d')](_0x2e160a);}return _0x303625[_0xb00b('0x2e')]();};}function saveUpdates(_0x54e247,_0x2b5f41){return function(_0x44918d){if(_0x44918d){return _0x44918d['update'](_0x54e247)[_0xb00b('0x2f')](function(_0x2f3b37){return _0x2f3b37;});}return null;};}function removeEntity(_0x5a5e5a,_0x456241){return function(_0x4d2ee5){if(_0x4d2ee5){return _0x4d2ee5[_0xb00b('0x30')]()[_0xb00b('0x2f')](function(){var _0x322879=_0x4d2ee5[_0xb00b('0x31')]({'plain':!![]});var _0x338864=_0xb00b('0x32');return db[_0xb00b('0x33')]['destroy']({'where':{'type':_0x338864,'resourceId':_0x322879['id']}})['then'](function(){return _0x4d2ee5;});})['then'](function(){_0x5a5e5a[_0xb00b('0x34')](0xcc)[_0xb00b('0x24')]();});}};}function handleEntityNotFound(_0x45dcda,_0x2589cb){return function(_0x5cfa60){if(!_0x5cfa60){_0x45dcda[_0xb00b('0x23')](0x194);}return _0x5cfa60;};}function handleError(_0x266f8e,_0x341f46){_0x341f46=_0x341f46||0x1f4;return function(_0x1c7a9f){logger[_0xb00b('0x1e')](_0x1c7a9f[_0xb00b('0x35')]);if(_0x1c7a9f[_0xb00b('0x36')]){delete _0x1c7a9f[_0xb00b('0x36')];}_0x266f8e['status'](_0x341f46)['send'](_0x1c7a9f);};}exports[_0xb00b('0x37')]=function(_0x56022e,_0x1c8258){var _0x1c5400={},_0x29579b={},_0x45ca74={'count':0x0,'rows':[]};var _0x37c017=_[_0xb00b('0x38')](db[_0xb00b('0x39')]['rawAttributes'],function(_0x35f1ca){return{'name':_0x35f1ca[_0xb00b('0x3a')],'type':_0x35f1ca[_0xb00b('0x3b')][_0xb00b('0x3c')]};});_0x29579b[_0xb00b('0x3d')]=_[_0xb00b('0x38')](_0x37c017,'name');_0x29579b[_0xb00b('0x3e')]=_[_0xb00b('0x3f')](_0x56022e['query']);_0x29579b[_0xb00b('0x40')]=_[_0xb00b('0x41')](_0x29579b[_0xb00b('0x3d')],_0x29579b[_0xb00b('0x3e')]);_0x1c5400[_0xb00b('0x42')]=_['intersection'](_0x29579b[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x1c5400['attributes']=_0x1c5400['attributes'][_0xb00b('0x44')]?_0x1c5400[_0xb00b('0x42')]:_0x29579b[_0xb00b('0x3d')];if(!_0x56022e[_0xb00b('0x3e')][_0xb00b('0x45')](_0xb00b('0x46'))){_0x1c5400[_0xb00b('0x27')]=qs['limit'](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x27')]);_0x1c5400[_0xb00b('0x25')]=qs[_0xb00b('0x25')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x25')]);}_0x1c5400[_0xb00b('0x47')]=qs[_0xb00b('0x48')](_0x56022e[_0xb00b('0x3e')][_0xb00b('0x48')]);_0x1c5400[_0xb00b('0x49')]=qs[_0xb00b('0x40')](_['pick'](_0x56022e[_0xb00b('0x3e')],_0x29579b[_0xb00b('0x40')]),_0x37c017);if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4a')]){_0x1c5400[_0xb00b('0x49')]=_[_0xb00b('0x4b')](_0x1c5400[_0xb00b('0x49')],{'$or':_[_0xb00b('0x38')](_0x37c017,function(_0x10ba60){if(_0x10ba60[_0xb00b('0x3b')]!==_0xb00b('0x4c')){var _0x3b3031={};_0x3b3031[_0x10ba60['name']]={'$like':'%'+_0x56022e['query']['filter']+'%'};return _0x3b3031;}})});}_0x1c5400=_[_0xb00b('0x4b')]({},_0x1c5400,_0x56022e[_0xb00b('0x4d')]);var _0x481154={'where':_0x1c5400[_0xb00b('0x49')]};return db[_0xb00b('0x39')][_0xb00b('0x28')](_0x481154)[_0xb00b('0x2f')](function(_0x4b62b3){_0x45ca74['count']=_0x4b62b3;if(_0x56022e[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x1c5400['include']=[{'all':!![]}];}return db['Trunk'][_0xb00b('0x4f')](_0x1c5400);})[_0xb00b('0x2f')](function(_0x4e0be4){_0x45ca74[_0xb00b('0x50')]=_0x4e0be4;return _0x45ca74;})['then'](respondWithFilteredResult(_0x1c8258,_0x1c5400))['catch'](handleError(_0x1c8258,null));};exports['show']=function(_0x465d90,_0x481515){var _0x1f7b86={'raw':![],'where':{'id':_0x465d90[_0xb00b('0x51')]['id']}},_0x3178aa={};_0x3178aa[_0xb00b('0x3d')]=_[_0xb00b('0x3f')](db[_0xb00b('0x39')]['rawAttributes']);_0x3178aa['query']=_[_0xb00b('0x3f')](_0x465d90[_0xb00b('0x3e')]);_0x3178aa['filters']=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],_0x3178aa['query']);_0x1f7b86[_0xb00b('0x42')]=_[_0xb00b('0x41')](_0x3178aa[_0xb00b('0x3d')],qs['fields'](_0x465d90['query'][_0xb00b('0x43')]));_0x1f7b86[_0xb00b('0x42')]=_0x1f7b86[_0xb00b('0x42')][_0xb00b('0x44')]?_0x1f7b86['attributes']:_0x3178aa[_0xb00b('0x3d')];if(_0x465d90[_0xb00b('0x3e')]['includeAll']){_0x1f7b86['include']=[{'all':!![]}];}_0x1f7b86=_[_0xb00b('0x4b')]({},_0x1f7b86,_0x465d90['options']);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x1f7b86)[_0xb00b('0x2f')](handleEntityNotFound(_0x481515,null))[_0xb00b('0x2f')](respondWithResult(_0x481515,null))[_0xb00b('0x22')](handleError(_0x481515,null));};exports[_0xb00b('0x53')]=function(_0x5a3b85,_0x5d52a5){var _0x51c9e3={'where':{'id':_0x5a3b85[_0xb00b('0x51')]['id']}},_0x37d4d2={};_0x37d4d2[_0xb00b('0x3d')]=_['keys'](db[_0xb00b('0x39')][_0xb00b('0x54')]);_0x51c9e3[_0xb00b('0x42')]=_['intersection'](_0x37d4d2[_0xb00b('0x3d')],qs[_0xb00b('0x43')](_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x43')]));_0x51c9e3[_0xb00b('0x42')]=_0x51c9e3[_0xb00b('0x42')][_0xb00b('0x44')]?_0x51c9e3[_0xb00b('0x42')]:_0x37d4d2['model'];if(_0x5a3b85[_0xb00b('0x3e')][_0xb00b('0x4e')]){_0x51c9e3[_0xb00b('0x55')]=[{'all':!![]}];}_0x51c9e3=_['merge']({},_0x51c9e3,_0x5a3b85[_0xb00b('0x4d')]);return db[_0xb00b('0x39')][_0xb00b('0x52')](_0x51c9e3)[_0xb00b('0x2f')](handleEntityNotFound(_0x5d52a5,null))[_0xb00b('0x2f')](function(_0x4bfe0b){if(_0x4bfe0b){var _0xfd4ecc=_0x4bfe0b[_0xb00b('0x31')]({'plain':!![]});_0xfd4ecc=qs[_0xb00b('0x56')](_0xfd4ecc,['id',_0xb00b('0x57'),'updatedAt']);_0x5a3b85[_0xb00b('0x58')]=_[_0xb00b('0x56')](_0x5a3b85[_0xb00b('0x58')],['id',_0xb00b('0x57'),_0xb00b('0x59')]);return db[_0xb00b('0x39')][_0xb00b('0x5a')](_['merge'](_0xfd4ecc,_0x5a3b85[_0xb00b('0x58')]),{'include':_0x5a3b85['query'][_0xb00b('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x3b3272){var _0x530d4a=_0x5a3b85[_0xb00b('0x5b')]['get']({'plain':!![]});if(!_0x530d4a)throw new Error(_0xb00b('0x5c'));if(_0x530d4a[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x4d1cec=_0x3b3272['get']({'plain':!![]});var _0x4f7a59=_0xb00b('0x32');return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0x4f7a59,'userProfileId':_0x530d4a['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37ae88){if(_0x37ae88&&_0x37ae88[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x4d1cec['name'],'resourceId':_0x4d1cec['id'],'type':_0x37ae88[_0xb00b('0x36')],'sectionId':_0x37ae88['id']},{})[_0xb00b('0x2f')](function(){return _0x3b3272;});}else{return _0x3b3272;}})['catch'](function(_0xe1316d){logger[_0xb00b('0x1e')](_0xb00b('0x60'),_0xe1316d);throw _0xe1316d;});}return _0x3b3272;});}})['then'](respondWithResult(_0x5d52a5,0xc9))['catch'](handleError(_0x5d52a5,null));};exports[_0xb00b('0x5a')]=function(_0x188da7,_0x23762e,_0x49f0a2){var _0x5aac5f;return db['Trunk']['create'](_0x188da7[_0xb00b('0x58')],{'raw':!![]})['then'](function(_0x2434a0){_0x5aac5f=_0x2434a0;return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x1e7f3a){var _0x2d21ec=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0x3d4482=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config[_0xb00b('0x65')],_0xb00b('0x66')),'utf8');var _0x27b3ae=ejs[_0xb00b('0x67')](_0x2d21ec,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x27b3ae);if(_0x5aac5f[_0xb00b('0x6a')]){var _0x432b68=ejs[_0xb00b('0x67')](_0x3d4482,{'trunks':_0x1e7f3a||[]});fs[_0xb00b('0x68')]('/etc/asterisk/sip_xcally_registers.conf',_0x432b68);}})[_0xb00b('0x2f')](function(){return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x5a'),{'module':_0xb00b('0x6c')});})[_0xb00b('0x2f')](function(){var _0xfb2b68=_0x188da7[_0xb00b('0x5b')][_0xb00b('0x31')]({'plain':!![]});if(!_0xfb2b68)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfb2b68[_0xb00b('0x5d')]===_0xb00b('0x5b')){var _0x7803a0=_0x5aac5f[_0xb00b('0x31')]({'plain':!![]});return db[_0xb00b('0x5e')][_0xb00b('0x52')]({'where':{'name':_0xb00b('0x32'),'userProfileId':_0xfb2b68['userProfileId']},'raw':!![]})[_0xb00b('0x2f')](function(_0x37a4c0){if(_0x37a4c0&&_0x37a4c0[_0xb00b('0x5f')]===0x0){return db[_0xb00b('0x33')][_0xb00b('0x5a')]({'name':_0x7803a0[_0xb00b('0x36')],'resourceId':_0x7803a0['id'],'type':_0x37a4c0['name'],'sectionId':_0x37a4c0['id']},{})[_0xb00b('0x2f')](function(){return _0x5aac5f;});}else{return _0x5aac5f;}})['catch'](function(_0x135cbf){logger['error'](_0xb00b('0x60'),_0x135cbf);throw _0x135cbf;});}return _0x5aac5f;})[_0xb00b('0x2f')](respondWithResult(_0x23762e,0xc9))[_0xb00b('0x22')](handleError(_0x23762e,null));};exports['update']=function(_0x5287cc,_0x9ad1c6,_0x3c4850){var _0x33a483;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0x5287cc[_0xb00b('0x51')]['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x9ad1c6,null))[_0xb00b('0x2f')](saveUpdates(_0x5287cc[_0xb00b('0x58')],null))[_0xb00b('0x2f')](function(_0x257430){if(_0x257430){_0x33a483=_0x257430;return db[_0xb00b('0x39')][_0xb00b('0x4f')]({'raw':!![]});}})[_0xb00b('0x2f')](function(_0x4eb17d){if(_0x4eb17d){var _0x59503c=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],'server/files/templates/trunk.ejs'),_0xb00b('0x64'));var _0x391e98=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],_0xb00b('0x66')),_0xb00b('0x64'));var _0x45c9cd=ejs[_0xb00b('0x67')](_0x59503c,{'trunks':_0x4eb17d||[]});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x45c9cd);var _0x4a9125=ejs[_0xb00b('0x67')](_0x391e98,{'trunks':_0x4eb17d||[]});fs['writeFileSync'](_0xb00b('0x6d'),_0x4a9125);return respondWithRpcPromise(_0xb00b('0x6b'),'update',{'module':_0xb00b('0x6c')});}return null;})[_0xb00b('0x2f')](function(_0xe80a21){if(_0xe80a21){return _0x33a483;}})[_0xb00b('0x2f')](respondWithResult(_0x9ad1c6,null))[_0xb00b('0x22')](handleError(_0x9ad1c6,null));};exports[_0xb00b('0x30')]=function(_0xc41c1f,_0x2423b2,_0x36ba5c){var _0x383d16;return db[_0xb00b('0x39')][_0xb00b('0x52')]({'where':{'id':_0xc41c1f['params']['id']}})[_0xb00b('0x2f')](handleEntityNotFound(_0x2423b2,null))[_0xb00b('0x2f')](removeEntity(_0x2423b2,null))[_0xb00b('0x2f')](function(){return db[_0xb00b('0x39')]['findAll']({'raw':!![]});})[_0xb00b('0x2f')](function(_0x17503d){var _0x32508b=fs[_0xb00b('0x61')](path[_0xb00b('0x62')](config['root'],_0xb00b('0x63')),_0xb00b('0x64'));var _0xa4fe1e=fs[_0xb00b('0x61')](path['join'](config[_0xb00b('0x65')],'server/files/templates/registry.ejs'),_0xb00b('0x64'));var _0x202d5f=ejs[_0xb00b('0x67')](_0x32508b,{'trunks':_0x17503d});var _0x165442=ejs[_0xb00b('0x67')](_0xa4fe1e,{'trunks':_0x17503d});fs[_0xb00b('0x68')](_0xb00b('0x69'),_0x202d5f);fs[_0xb00b('0x68')](_0xb00b('0x6d'),_0x165442);return respondWithRpcPromise(_0xb00b('0x6b'),_0xb00b('0x30'),{'module':'chan_sip.so'});})[_0xb00b('0x22')](handleError(_0x2423b2,null));}; \ No newline at end of file +var _0xe5b3=['then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Trunk,\x20%s,\x20%s','request\x20sent','result','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','clone','find','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','server/files/templates/registry.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','/etc/asterisk/sip_xcally_registers.conf','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xe5b3,0x133));var _0x3e5b=function(_0x3904e9,_0x1c0782){_0x3904e9=_0x3904e9-0x0;var _0x1ba0e0=_0xe5b3[_0x3904e9];return _0x1ba0e0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3e5b('0x0'));var zipdir=require(_0x3e5b('0x1'));var jsonpatch=require(_0x3e5b('0x2'));var rp=require(_0x3e5b('0x3'));var moment=require(_0x3e5b('0x4'));var BPromise=require(_0x3e5b('0x5'));var Mustache=require(_0x3e5b('0x6'));var util=require(_0x3e5b('0x7'));var path=require(_0x3e5b('0x8'));var sox=require(_0x3e5b('0x9'));var csv=require(_0x3e5b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e5b('0xb'));var _=require(_0x3e5b('0xc'));var squel=require('squel');var crypto=require(_0x3e5b('0xd'));var jsforce=require(_0x3e5b('0xe'));var deskjs=require(_0x3e5b('0xf'));var toCsv=require(_0x3e5b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3e5b('0x10'));var authService=require(_0x3e5b('0x11'));var qs=require(_0x3e5b('0x12'));var as=require(_0x3e5b('0x13'));var hardwareService=require(_0x3e5b('0x14'));var logger=require('../../config/logger')(_0x3e5b('0x15'));var utils=require('../../config/utils');var config=require(_0x3e5b('0x16'));var licenseUtil=require(_0x3e5b('0x17'));var db=require(_0x3e5b('0x18'))['db'];var jayson=require(_0x3e5b('0x19'));var client=jayson[_0x3e5b('0x1a')][_0x3e5b('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x405e70,_0x560010,_0x39a2a1,_0x5f2f9c){return new BPromise(function(_0x51a188,_0x4d71a3){var _0x3754e3=_0x5f2f9c||client;return _0x3754e3[_0x3e5b('0x1c')](_0x405e70,_0x39a2a1)[_0x3e5b('0x1d')](function(_0x4fb471){logger[_0x3e5b('0x1e')]('Trunk,\x20%s,\x20%s',_0x560010,'request\x20sent');logger[_0x3e5b('0x1f')](_0x3e5b('0x20'),_0x560010,'request\x20sent',JSON[_0x3e5b('0x21')](_0x4fb471));if(_0x4fb471[_0x3e5b('0x22')]){if(_0x4fb471['error'][_0x3e5b('0x23')]===0x1f4){logger[_0x3e5b('0x22')]('Trunk,\x20%s,\x20%s',_0x560010,_0x4fb471['error'][_0x3e5b('0x24')]);return _0x4d71a3(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);return _0x51a188(_0x4fb471[_0x3e5b('0x22')][_0x3e5b('0x24')]);}else{logger[_0x3e5b('0x1e')](_0x3e5b('0x25'),_0x560010,_0x3e5b('0x26'));_0x51a188(_0x4fb471[_0x3e5b('0x27')][_0x3e5b('0x24')]);}})['catch'](function(_0x433f9c){logger[_0x3e5b('0x22')](_0x3e5b('0x25'),_0x560010,_0x433f9c);_0x4d71a3(_0x433f9c);});});}function respondWithStatusCode(_0x150674,_0x50039b){_0x50039b=_0x50039b||0xcc;return function(_0x1eb80f){if(_0x1eb80f){return _0x150674['sendStatus'](_0x50039b);}return _0x150674[_0x3e5b('0x28')](_0x50039b)[_0x3e5b('0x29')]();};}function respondWithResult(_0x4d5e61,_0x41b684){_0x41b684=_0x41b684||0xc8;return function(_0x2f6368){if(_0x2f6368){return _0x4d5e61[_0x3e5b('0x28')](_0x41b684)[_0x3e5b('0x2a')](_0x2f6368);}};}function respondWithFilteredResult(_0x3bb749,_0x26c7f2){return function(_0x160e87){if(_0x160e87){var _0x2ddf57=typeof _0x26c7f2['offset']===_0x3e5b('0x2b')&&typeof _0x26c7f2['limit']===_0x3e5b('0x2b');var _0x4fd64b=_0x160e87[_0x3e5b('0x2c')];var _0x1f6473=_0x2ddf57?0x0:_0x26c7f2[_0x3e5b('0x2d')];var _0x475b39=_0x2ddf57?_0x160e87[_0x3e5b('0x2c')]:_0x26c7f2[_0x3e5b('0x2d')]+_0x26c7f2[_0x3e5b('0x2e')];var _0x9c2123;if(_0x475b39>=_0x4fd64b){_0x475b39=_0x4fd64b;_0x9c2123=0xc8;}else{_0x9c2123=0xce;}_0x3bb749[_0x3e5b('0x28')](_0x9c2123);return _0x3bb749[_0x3e5b('0x2f')](_0x3e5b('0x30'),_0x1f6473+'-'+_0x475b39+'/'+_0x4fd64b)['json'](_0x160e87);}return null;};}function patchUpdates(_0x21bc10){return function(_0x1882aa){try{jsonpatch[_0x3e5b('0x31')](_0x1882aa,_0x21bc10,!![]);}catch(_0x2a14eb){return BPromise[_0x3e5b('0x32')](_0x2a14eb);}return _0x1882aa[_0x3e5b('0x33')]();};}function saveUpdates(_0x345927,_0x4c4e01){return function(_0x33f089){if(_0x33f089){return _0x33f089['update'](_0x345927)['then'](function(_0x32c6b0){return _0x32c6b0;});}return null;};}function removeEntity(_0x78d68a,_0x51ea0d){return function(_0x40e37d){if(_0x40e37d){return _0x40e37d[_0x3e5b('0x34')]()[_0x3e5b('0x1d')](function(){var _0x33e356=_0x40e37d[_0x3e5b('0x35')]({'plain':!![]});var _0x26f842=_0x3e5b('0x36');return db[_0x3e5b('0x37')][_0x3e5b('0x34')]({'where':{'type':_0x26f842,'resourceId':_0x33e356['id']}})[_0x3e5b('0x1d')](function(){return _0x40e37d;});})[_0x3e5b('0x1d')](function(){_0x78d68a[_0x3e5b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x141b7e,_0xec45c5){return function(_0x53caa2){if(!_0x53caa2){_0x141b7e['sendStatus'](0x194);}return _0x53caa2;};}function handleError(_0x471196,_0x56d7ef){_0x56d7ef=_0x56d7ef||0x1f4;return function(_0x2939da){logger[_0x3e5b('0x22')](_0x2939da[_0x3e5b('0x38')]);if(_0x2939da[_0x3e5b('0x39')]){delete _0x2939da['name'];}_0x471196[_0x3e5b('0x28')](_0x56d7ef)['send'](_0x2939da);};}exports[_0x3e5b('0x3a')]=function(_0x5ec841,_0x47f7c8){var _0x48f414={},_0x10c202={},_0x174ebf={'count':0x0,'rows':[]};var _0x2eaa30=_[_0x3e5b('0x3b')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')],function(_0x5466ac){return{'name':_0x5466ac['fieldName'],'type':_0x5466ac['type']['key']};});_0x10c202['model']=_['map'](_0x2eaa30,'name');_0x10c202[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x5ec841[_0x3e5b('0x3e')]);_0x10c202[_0x3e5b('0x40')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],_0x10c202[_0x3e5b('0x3e')]);_0x48f414[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x10c202[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x5ec841['query'][_0x3e5b('0x44')]));_0x48f414[_0x3e5b('0x43')]=_0x48f414[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x48f414[_0x3e5b('0x43')]:_0x10c202[_0x3e5b('0x42')];if(!_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x46')](_0x3e5b('0x47'))){_0x48f414[_0x3e5b('0x2e')]=qs[_0x3e5b('0x2e')](_0x5ec841['query']['limit']);_0x48f414['offset']=qs['offset'](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x2d')]);}_0x48f414[_0x3e5b('0x48')]=qs[_0x3e5b('0x49')](_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x49')]);_0x48f414[_0x3e5b('0x4a')]=qs[_0x3e5b('0x40')](_[_0x3e5b('0x4b')](_0x5ec841[_0x3e5b('0x3e')],_0x10c202['filters']),_0x2eaa30);if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x4c')]){_0x48f414[_0x3e5b('0x4a')]=_[_0x3e5b('0x4d')](_0x48f414[_0x3e5b('0x4a')],{'$or':_['map'](_0x2eaa30,function(_0x588ee7){if(_0x588ee7['type']!==_0x3e5b('0x4e')){var _0x20af6a={};_0x20af6a[_0x588ee7[_0x3e5b('0x39')]]={'$like':'%'+_0x5ec841['query']['filter']+'%'};return _0x20af6a;}})});}_0x48f414=_[_0x3e5b('0x4d')]({},_0x48f414,_0x5ec841[_0x3e5b('0x4f')]);var _0x123947={'where':_0x48f414['where']};return db['Trunk'][_0x3e5b('0x2c')](_0x123947)['then'](function(_0x14b62a){_0x174ebf[_0x3e5b('0x2c')]=_0x14b62a;if(_0x5ec841[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x48f414[_0x3e5b('0x51')]=[{'all':!![]}];}return db[_0x3e5b('0x3c')][_0x3e5b('0x52')](_0x48f414);})[_0x3e5b('0x1d')](function(_0x339852){_0x174ebf['rows']=_0x339852;return _0x174ebf;})[_0x3e5b('0x1d')](respondWithFilteredResult(_0x47f7c8,_0x48f414))['catch'](handleError(_0x47f7c8,null));};exports[_0x3e5b('0x53')]=function(_0x2e7047,_0x26e11e){var _0x3d51fa={'raw':![],'where':{'id':_0x2e7047[_0x3e5b('0x54')]['id']}},_0x291e4d={};_0x291e4d[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x291e4d[_0x3e5b('0x3e')]=_[_0x3e5b('0x3f')](_0x2e7047[_0x3e5b('0x3e')]);_0x291e4d['filters']=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],_0x291e4d[_0x3e5b('0x3e')]);_0x3d51fa[_0x3e5b('0x43')]=_[_0x3e5b('0x41')](_0x291e4d[_0x3e5b('0x42')],qs['fields'](_0x2e7047[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x3d51fa[_0x3e5b('0x43')]=_0x3d51fa[_0x3e5b('0x43')][_0x3e5b('0x45')]?_0x3d51fa[_0x3e5b('0x43')]:_0x291e4d[_0x3e5b('0x42')];if(_0x2e7047[_0x3e5b('0x3e')]['includeAll']){_0x3d51fa[_0x3e5b('0x51')]=[{'all':!![]}];}_0x3d51fa=_['merge']({},_0x3d51fa,_0x2e7047['options']);return db[_0x3e5b('0x3c')]['find'](_0x3d51fa)[_0x3e5b('0x1d')](handleEntityNotFound(_0x26e11e,null))[_0x3e5b('0x1d')](respondWithResult(_0x26e11e,null))[_0x3e5b('0x55')](handleError(_0x26e11e,null));};exports[_0x3e5b('0x56')]=function(_0x4a492b,_0x5ddeee){var _0x545712={'where':{'id':_0x4a492b[_0x3e5b('0x54')]['id']}},_0x581b94={};_0x581b94[_0x3e5b('0x42')]=_[_0x3e5b('0x3f')](db[_0x3e5b('0x3c')][_0x3e5b('0x3d')]);_0x545712['attributes']=_['intersection'](_0x581b94[_0x3e5b('0x42')],qs[_0x3e5b('0x44')](_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x44')]));_0x545712[_0x3e5b('0x43')]=_0x545712['attributes']['length']?_0x545712['attributes']:_0x581b94['model'];if(_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]){_0x545712[_0x3e5b('0x51')]=[{'all':!![]}];}_0x545712=_[_0x3e5b('0x4d')]({},_0x545712,_0x4a492b[_0x3e5b('0x4f')]);return db[_0x3e5b('0x3c')][_0x3e5b('0x57')](_0x545712)[_0x3e5b('0x1d')](handleEntityNotFound(_0x5ddeee,null))['then'](function(_0x285db6){if(_0x285db6){var _0x29897b=_0x285db6[_0x3e5b('0x35')]({'plain':!![]});_0x29897b=qs[_0x3e5b('0x58')](_0x29897b,['id',_0x3e5b('0x59'),'updatedAt']);_0x4a492b[_0x3e5b('0x5a')]=_['omit'](_0x4a492b[_0x3e5b('0x5a')],['id',_0x3e5b('0x59'),'updatedAt']);return db['Trunk']['create'](_[_0x3e5b('0x4d')](_0x29897b,_0x4a492b['body']),{'include':_0x4a492b[_0x3e5b('0x3e')][_0x3e5b('0x50')]?[{'all':!![]}]:undefined})[_0x3e5b('0x1d')](function(_0x40197c){var _0x14f187=_0x4a492b['user']['get']({'plain':!![]});if(!_0x14f187)throw new Error(_0x3e5b('0x5b'));if(_0x14f187[_0x3e5b('0x5c')]===_0x3e5b('0x5d')){var _0x4dfb45=_0x40197c[_0x3e5b('0x35')]({'plain':!![]});var _0x3c5293=_0x3e5b('0x36');return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3c5293,'userProfileId':_0x14f187[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x4a1ce3){if(_0x4a1ce3&&_0x4a1ce3[_0x3e5b('0x60')]===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x4dfb45[_0x3e5b('0x39')],'resourceId':_0x4dfb45['id'],'type':_0x4a1ce3[_0x3e5b('0x39')],'sectionId':_0x4a1ce3['id']},{})[_0x3e5b('0x1d')](function(){return _0x40197c;});}else{return _0x40197c;}})[_0x3e5b('0x55')](function(_0x2411c3){logger[_0x3e5b('0x22')](_0x3e5b('0x62'),_0x2411c3);throw _0x2411c3;});}return _0x40197c;});}})['then'](respondWithResult(_0x5ddeee,0xc9))[_0x3e5b('0x55')](handleError(_0x5ddeee,null));};exports[_0x3e5b('0x61')]=function(_0x5af305,_0x177144,_0x31ef31){var _0x561c78;return db['Trunk']['create'](_0x5af305[_0x3e5b('0x5a')],{'raw':!![]})[_0x3e5b('0x1d')](function(_0x498e6d){_0x561c78=_0x498e6d;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});})['then'](function(_0x3d3bf2){var _0x17f60f=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0x410c7a=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x40103e=ejs[_0x3e5b('0x69')](_0x17f60f,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x40103e);if(_0x561c78['registry']){var _0x590f0c=ejs[_0x3e5b('0x69')](_0x410c7a,{'trunks':_0x3d3bf2||[]});fs[_0x3e5b('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x590f0c);}})[_0x3e5b('0x1d')](function(){return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x61'),{'module':_0x3e5b('0x6d')});})[_0x3e5b('0x1d')](function(){var _0x9deb09=_0x5af305[_0x3e5b('0x5d')]['get']({'plain':!![]});if(!_0x9deb09)throw new Error(_0x3e5b('0x5b'));if(_0x9deb09[_0x3e5b('0x5c')]==='user'){var _0x577747=_0x561c78['get']({'plain':!![]});return db[_0x3e5b('0x5e')][_0x3e5b('0x57')]({'where':{'name':_0x3e5b('0x36'),'userProfileId':_0x9deb09[_0x3e5b('0x5f')]},'raw':!![]})[_0x3e5b('0x1d')](function(_0x1ba550){if(_0x1ba550&&_0x1ba550['autoAssociation']===0x0){return db[_0x3e5b('0x37')][_0x3e5b('0x61')]({'name':_0x577747['name'],'resourceId':_0x577747['id'],'type':_0x1ba550[_0x3e5b('0x39')],'sectionId':_0x1ba550['id']},{})['then'](function(){return _0x561c78;});}else{return _0x561c78;}})['catch'](function(_0x211e73){logger[_0x3e5b('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x211e73);throw _0x211e73;});}return _0x561c78;})[_0x3e5b('0x1d')](respondWithResult(_0x177144,0xc9))[_0x3e5b('0x55')](handleError(_0x177144,null));};exports['update']=function(_0x2e36af,_0x185640,_0x14baa9){var _0x1425eb;return db[_0x3e5b('0x3c')][_0x3e5b('0x57')]({'where':{'id':_0x2e36af['params']['id']}})['then'](handleEntityNotFound(_0x185640,null))[_0x3e5b('0x1d')](saveUpdates(_0x2e36af['body'],null))['then'](function(_0x25d3d8){if(_0x25d3d8){_0x1425eb=_0x25d3d8;return db[_0x3e5b('0x3c')][_0x3e5b('0x52')]({'raw':!![]});}})['then'](function(_0x2e5fa3){if(_0x2e5fa3){var _0x4b8d19=fs[_0x3e5b('0x63')](path['join'](config[_0x3e5b('0x65')],_0x3e5b('0x66')),_0x3e5b('0x67'));var _0xdf2677=fs['readFileSync'](path[_0x3e5b('0x64')](config['root'],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x58ccf3=ejs[_0x3e5b('0x69')](_0x4b8d19,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x58ccf3);var _0x5ad011=ejs[_0x3e5b('0x69')](_0xdf2677,{'trunks':_0x2e5fa3||[]});fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5ad011);return respondWithRpcPromise('Reload',_0x3e5b('0x6f'),{'module':_0x3e5b('0x6d')});}return null;})['then'](function(_0xd9d941){if(_0xd9d941){return _0x1425eb;}})[_0x3e5b('0x1d')](respondWithResult(_0x185640,null))[_0x3e5b('0x55')](handleError(_0x185640,null));};exports['destroy']=function(_0x3b3306,_0x30e079,_0x352f7e){var _0x1d7c05;return db['Trunk'][_0x3e5b('0x57')]({'where':{'id':_0x3b3306['params']['id']}})[_0x3e5b('0x1d')](handleEntityNotFound(_0x30e079,null))['then'](removeEntity(_0x30e079,null))[_0x3e5b('0x1d')](function(){return db[_0x3e5b('0x3c')]['findAll']({'raw':!![]});})[_0x3e5b('0x1d')](function(_0x2299b9){var _0x56ff9d=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x66')),'utf8');var _0x53328b=fs[_0x3e5b('0x63')](path[_0x3e5b('0x64')](config[_0x3e5b('0x65')],_0x3e5b('0x68')),_0x3e5b('0x67'));var _0x3d1193=ejs['render'](_0x56ff9d,{'trunks':_0x2299b9});var _0x5d6aae=ejs[_0x3e5b('0x69')](_0x53328b,{'trunks':_0x2299b9});fs[_0x3e5b('0x6a')](_0x3e5b('0x6b'),_0x3d1193);fs[_0x3e5b('0x6a')](_0x3e5b('0x6e'),_0x5d6aae);return respondWithRpcPromise(_0x3e5b('0x6c'),_0x3e5b('0x34'),{'module':_0x3e5b('0x6d')});})['catch'](handleError(_0x30e079,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 1a78686..37361e6 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 _0x7df4=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','Trunk'];(function(_0x41c2f2,_0x22d465){var _0x59cf5f=function(_0x457ec7){while(--_0x457ec7){_0x41c2f2['push'](_0x41c2f2['shift']());}};_0x59cf5f(++_0x22d465);}(_0x7df4,0x90));var _0x47df=function(_0x1c7e82,_0x103104){_0x1c7e82=_0x1c7e82-0x0;var _0x5bec25=_0x7df4[_0x1c7e82];return _0x5bec25;};'use strict';var _=require(_0x47df('0x0'));var util=require(_0x47df('0x1'));var logger=require(_0x47df('0x2'))(_0x47df('0x3'));var moment=require(_0x47df('0x4'));var BPromise=require(_0x47df('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47df('0x6'));var rimraf=require(_0x47df('0x7'));var config=require(_0x47df('0x8'));var attributes=require('./trunk.attributes');module[_0x47df('0x9')]=function(_0xe3ebd8,_0x55a4ec){return _0xe3ebd8[_0x47df('0xa')](_0x47df('0xb'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x740d=['../../config/environment','exports','define','Trunk','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x1afadf,_0x357131){var _0x3a3b4a=function(_0x224753){while(--_0x224753){_0x1afadf['push'](_0x1afadf['shift']());}};_0x3a3b4a(++_0x357131);}(_0x740d,0x101));var _0xd740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x740d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd740('0x0'));var util=require('util');var logger=require(_0xd740('0x1'))(_0xd740('0x2'));var moment=require(_0xd740('0x3'));var BPromise=require(_0xd740('0x4'));var rp=require(_0xd740('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd740('0x6'));var config=require(_0xd740('0x7'));var attributes=require('./trunk.attributes');module[_0xd740('0x8')]=function(_0x395053,_0x392b8f){return _0x395053[_0xd740('0x9')](_0xd740('0xa'),attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index f673fa9..9d4a398 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 _0xfa48=['code','message','result','catch','options','raw','where','limit','include','model','attributes','map','then','GetTrunk','ShowTrunk','Trunk','find','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x2b550c,_0x1acc94){var _0x2e63e4=function(_0x13c7c3){while(--_0x13c7c3){_0x2b550c['push'](_0x2b550c['shift']());}};_0x2e63e4(++_0x1acc94);}(_0xfa48,0x1a9));var _0x8fa4=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xfa48[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0x8fa4('0x0'));var util=require('util');var moment=require(_0x8fa4('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fa4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fa4('0x3'))['db'];var utils=require(_0x8fa4('0x4'));var logger=require(_0x8fa4('0x5'))(_0x8fa4('0x6'));var config=require(_0x8fa4('0x7'));var jayson=require(_0x8fa4('0x8'));var client=jayson['client'][_0x8fa4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe88a2,_0x227094,_0x73963d){return new BPromise(function(_0x5cd3cf,_0x3a2c40){return client[_0x8fa4('0xa')](_0xe88a2,_0x73963d)['then'](function(_0x26372e){logger[_0x8fa4('0xb')](_0x8fa4('0xc'),_0x227094,_0x8fa4('0xd'));logger[_0x8fa4('0xe')]('Trunk,\x20%s,\x20%s,\x20%s',_0x227094,_0x8fa4('0xd'),JSON[_0x8fa4('0xf')](_0x26372e));if(_0x26372e[_0x8fa4('0x10')]){if(_0x26372e['error'][_0x8fa4('0x11')]===0x1f4){logger[_0x8fa4('0x10')](_0x8fa4('0xc'),_0x227094,_0x26372e[_0x8fa4('0x10')][_0x8fa4('0x12')]);return _0x3a2c40(_0x26372e[_0x8fa4('0x10')][_0x8fa4('0x12')]);}logger[_0x8fa4('0x10')](_0x8fa4('0xc'),_0x227094,_0x26372e['error'][_0x8fa4('0x12')]);return _0x5cd3cf(_0x26372e[_0x8fa4('0x10')]['message']);}else{logger['info'](_0x8fa4('0xc'),_0x227094,_0x8fa4('0xd'));_0x5cd3cf(_0x26372e[_0x8fa4('0x13')][_0x8fa4('0x12')]);}})[_0x8fa4('0x14')](function(_0x4f745a){logger[_0x8fa4('0x10')]('Trunk,\x20%s,\x20%s',_0x227094,_0x4f745a);_0x3a2c40(_0x4f745a);});});}exports['GetTrunk']=function(_0x2d7a7a){var _0x2a213e=this;return new Promise(function(_0x821f28,_0x10cc52){return db['Trunk']['findAll']({'raw':_0x2d7a7a[_0x8fa4('0x15')]?_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x16')]===undefined?!![]:![]:!![],'where':_0x2d7a7a[_0x8fa4('0x15')]?_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x17')]||null:null,'attributes':_0x2d7a7a[_0x8fa4('0x15')]?_0x2d7a7a['options']['attributes']||null:null,'limit':_0x2d7a7a['options']?_0x2d7a7a['options'][_0x8fa4('0x18')]||null:null,'include':_0x2d7a7a['options']?_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x19')]?_['map'](_0x2d7a7a[_0x8fa4('0x15')][_0x8fa4('0x19')],function(_0x43dbea){return{'model':db[_0x43dbea[_0x8fa4('0x1a')]],'as':_0x43dbea['as'],'attributes':_0x43dbea[_0x8fa4('0x1b')],'include':_0x43dbea[_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x43dbea[_0x8fa4('0x19')],function(_0x200e21){return{'model':db[_0x200e21[_0x8fa4('0x1a')]],'as':_0x200e21['as'],'attributes':_0x200e21['attributes'],'include':_0x200e21[_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x200e21[_0x8fa4('0x19')],function(_0x5b2443){return{'model':db[_0x5b2443['model']],'as':_0x5b2443['as'],'attributes':_0x5b2443[_0x8fa4('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8fa4('0x1d')](function(_0x553909){logger[_0x8fa4('0xb')](_0x8fa4('0x1e'),_0x2d7a7a);logger[_0x8fa4('0xe')](_0x8fa4('0x1e'),_0x2d7a7a,JSON[_0x8fa4('0xf')](_0x553909));_0x821f28(_0x553909);})[_0x8fa4('0x14')](function(_0x2c540e){logger['error'](_0x8fa4('0x1e'),_0x2c540e[_0x8fa4('0x12')],_0x2d7a7a);_0x10cc52(_0x2a213e[_0x8fa4('0x10')](0x1f4,_0x2c540e['message']));});});};exports[_0x8fa4('0x1f')]=function(_0x467a5a){var _0x446e37=this;return new Promise(function(_0x2232c9,_0x584818){return db[_0x8fa4('0x20')][_0x8fa4('0x21')]({'raw':_0x467a5a[_0x8fa4('0x15')]?_0x467a5a[_0x8fa4('0x15')][_0x8fa4('0x16')]===undefined?!![]:![]:!![],'where':_0x467a5a[_0x8fa4('0x15')]?_0x467a5a[_0x8fa4('0x15')][_0x8fa4('0x17')]||null:null,'attributes':_0x467a5a[_0x8fa4('0x15')]?_0x467a5a['options']['attributes']||null:null,'include':_0x467a5a['options']?_0x467a5a[_0x8fa4('0x15')][_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x467a5a['options'][_0x8fa4('0x19')],function(_0x462e29){return{'model':db[_0x462e29[_0x8fa4('0x1a')]],'as':_0x462e29['as'],'attributes':_0x462e29[_0x8fa4('0x1b')],'include':_0x462e29[_0x8fa4('0x19')]?_[_0x8fa4('0x1c')](_0x462e29[_0x8fa4('0x19')],function(_0x53bd0a){return{'model':db[_0x53bd0a[_0x8fa4('0x1a')]],'as':_0x53bd0a['as'],'attributes':_0x53bd0a[_0x8fa4('0x1b')],'include':_0x53bd0a['include']?_[_0x8fa4('0x1c')](_0x53bd0a[_0x8fa4('0x19')],function(_0x25ec26){return{'model':db[_0x25ec26[_0x8fa4('0x1a')]],'as':_0x25ec26['as'],'attributes':_0x25ec26['attributes']};}):[]};}):[]};}):[]:[]})[_0x8fa4('0x1d')](function(_0x7eaa98){logger[_0x8fa4('0xb')](_0x8fa4('0x1f'),_0x467a5a);logger[_0x8fa4('0xe')](_0x8fa4('0x1f'),_0x467a5a,JSON[_0x8fa4('0xf')](_0x7eaa98));_0x2232c9(_0x7eaa98);})[_0x8fa4('0x14')](function(_0xb04948){logger[_0x8fa4('0x10')](_0x8fa4('0x1f'),_0xb04948[_0x8fa4('0x12')],_0x467a5a);_0x584818(_0x446e37['error'](0x1f4,_0xb04948[_0x8fa4('0x12')]));});});}; \ No newline at end of file +var _0xf774=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetTrunk','Trunk','findAll','options','raw','where','attributes','include','model','map','ShowTrunk','lodash'];(function(_0x8ef800,_0x270234){var _0x3386f6=function(_0x141f30){while(--_0x141f30){_0x8ef800['push'](_0x8ef800['shift']());}};_0x3386f6(++_0x270234);}(_0xf774,0xae));var _0x4f77=function(_0xcaf098,_0x9f56c5){_0xcaf098=_0xcaf098-0x0;var _0x7cc5b4=_0xf774[_0xcaf098];return _0x7cc5b4;};'use strict';var _=require(_0x4f77('0x0'));var util=require('util');var moment=require(_0x4f77('0x1'));var BPromise=require(_0x4f77('0x2'));var rs=require(_0x4f77('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f77('0x4'))['db'];var utils=require(_0x4f77('0x5'));var logger=require(_0x4f77('0x6'))(_0x4f77('0x7'));var config=require(_0x4f77('0x8'));var jayson=require(_0x4f77('0x9'));var client=jayson[_0x4f77('0xa')][_0x4f77('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12e180,_0x4daa2a,_0x452882){return new BPromise(function(_0x12e994,_0xdb92c5){return client[_0x4f77('0xc')](_0x12e180,_0x452882)[_0x4f77('0xd')](function(_0x4706d8){logger[_0x4f77('0xe')](_0x4f77('0xf'),_0x4daa2a,'request\x20sent');logger[_0x4f77('0x10')](_0x4f77('0x11'),_0x4daa2a,'request\x20sent',JSON[_0x4f77('0x12')](_0x4706d8));if(_0x4706d8[_0x4f77('0x13')]){if(_0x4706d8['error'][_0x4f77('0x14')]===0x1f4){logger[_0x4f77('0x13')]('Trunk,\x20%s,\x20%s',_0x4daa2a,_0x4706d8['error'][_0x4f77('0x15')]);return _0xdb92c5(_0x4706d8[_0x4f77('0x13')][_0x4f77('0x15')]);}logger[_0x4f77('0x13')](_0x4f77('0xf'),_0x4daa2a,_0x4706d8[_0x4f77('0x13')][_0x4f77('0x15')]);return _0x12e994(_0x4706d8['error'][_0x4f77('0x15')]);}else{logger[_0x4f77('0xe')](_0x4f77('0xf'),_0x4daa2a,_0x4f77('0x16'));_0x12e994(_0x4706d8['result'][_0x4f77('0x15')]);}})[_0x4f77('0x17')](function(_0xf3e2a){logger[_0x4f77('0x13')](_0x4f77('0xf'),_0x4daa2a,_0xf3e2a);_0xdb92c5(_0xf3e2a);});});}exports[_0x4f77('0x18')]=function(_0x5e0689){var _0x22cc59=this;return new Promise(function(_0x45f2b6,_0x4b19fe){return db[_0x4f77('0x19')][_0x4f77('0x1a')]({'raw':_0x5e0689['options']?_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689['options'][_0x4f77('0x1d')]||null:null,'attributes':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1e')]||null:null,'limit':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689[_0x4f77('0x1b')]['limit']||null:null,'include':_0x5e0689[_0x4f77('0x1b')]?_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1f')]?_['map'](_0x5e0689[_0x4f77('0x1b')][_0x4f77('0x1f')],function(_0x2a803c){return{'model':db[_0x2a803c[_0x4f77('0x20')]],'as':_0x2a803c['as'],'attributes':_0x2a803c['attributes'],'include':_0x2a803c['include']?_[_0x4f77('0x21')](_0x2a803c[_0x4f77('0x1f')],function(_0x2056e2){return{'model':db[_0x2056e2[_0x4f77('0x20')]],'as':_0x2056e2['as'],'attributes':_0x2056e2[_0x4f77('0x1e')],'include':_0x2056e2[_0x4f77('0x1f')]?_[_0x4f77('0x21')](_0x2056e2[_0x4f77('0x1f')],function(_0x237e2e){return{'model':db[_0x237e2e[_0x4f77('0x20')]],'as':_0x237e2e['as'],'attributes':_0x237e2e[_0x4f77('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f77('0xd')](function(_0x3e5f8d){logger[_0x4f77('0xe')]('GetTrunk',_0x5e0689);logger[_0x4f77('0x10')](_0x4f77('0x18'),_0x5e0689,JSON[_0x4f77('0x12')](_0x3e5f8d));_0x45f2b6(_0x3e5f8d);})[_0x4f77('0x17')](function(_0x4528fe){logger[_0x4f77('0x13')](_0x4f77('0x18'),_0x4528fe[_0x4f77('0x15')],_0x5e0689);_0x4b19fe(_0x22cc59[_0x4f77('0x13')](0x1f4,_0x4528fe[_0x4f77('0x15')]));});});};exports[_0x4f77('0x22')]=function(_0x4b3687){var _0x22d28a=this;return new Promise(function(_0x1ff18b,_0x47ea06){return db['Trunk']['find']({'raw':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687[_0x4f77('0x1b')][_0x4f77('0x1c')]===undefined?!![]:![]:!![],'where':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687[_0x4f77('0x1b')][_0x4f77('0x1d')]||null:null,'attributes':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687[_0x4f77('0x1b')]['attributes']||null:null,'include':_0x4b3687[_0x4f77('0x1b')]?_0x4b3687['options']['include']?_[_0x4f77('0x21')](_0x4b3687[_0x4f77('0x1b')][_0x4f77('0x1f')],function(_0x191299){return{'model':db[_0x191299[_0x4f77('0x20')]],'as':_0x191299['as'],'attributes':_0x191299['attributes'],'include':_0x191299['include']?_[_0x4f77('0x21')](_0x191299[_0x4f77('0x1f')],function(_0x8631f4){return{'model':db[_0x8631f4['model']],'as':_0x8631f4['as'],'attributes':_0x8631f4[_0x4f77('0x1e')],'include':_0x8631f4[_0x4f77('0x1f')]?_[_0x4f77('0x21')](_0x8631f4['include'],function(_0x291221){return{'model':db[_0x291221[_0x4f77('0x20')]],'as':_0x291221['as'],'attributes':_0x291221[_0x4f77('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4f77('0xd')](function(_0x1b6021){logger[_0x4f77('0xe')]('ShowTrunk',_0x4b3687);logger[_0x4f77('0x10')]('ShowTrunk',_0x4b3687,JSON[_0x4f77('0x12')](_0x1b6021));_0x1ff18b(_0x1b6021);})[_0x4f77('0x17')](function(_0x31dc14){logger[_0x4f77('0x13')](_0x4f77('0x22'),_0x31dc14[_0x4f77('0x15')],_0x4b3687);_0x47ea06(_0x22d28a[_0x4f77('0x13')](0x1f4,_0x31dc14['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e5be572..f619a19 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 _0x364b=['express','Router','../../components/auth/service','put','/:id'];(function(_0x3da8b7,_0x5cefcb){var _0x305992=function(_0x321d6f){while(--_0x321d6f){_0x3da8b7['push'](_0x3da8b7['shift']());}};_0x305992(++_0x5cefcb);}(_0x364b,0x113));var _0xb364=function(_0x387ca0,_0x5c9b88){_0x387ca0=_0x387ca0-0x0;var _0x3257d3=_0x364b[_0x387ca0];return _0x3257d3;};'use strict';var express=require(_0xb364('0x0'));var router=express[_0xb364('0x1')]();var auth=require(_0xb364('0x2'));var controller=require('./user-setting.controller');router[_0xb364('0x3')](_0xb364('0x4'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0xa1e1=['isAuthenticated','update','exports','express','Router','../../components/auth/service','/:id'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xa1e1,0xb2));var _0x1a1e=function(_0x598dea,_0x1ecb54){_0x598dea=_0x598dea-0x0;var _0x34f50c=_0xa1e1[_0x598dea];return _0x34f50c;};'use strict';var express=require(_0x1a1e('0x0'));var router=express[_0x1a1e('0x1')]();var auth=require(_0x1a1e('0x2'));var controller=require('./user-setting.controller');router['put'](_0x1a1e('0x3'),auth[_0x1a1e('0x4')](),controller[_0x1a1e('0x5')]);module[_0x1a1e('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 834b4f4..9aa18a7 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 _0xfdd3=['debug','exports','BOOLEAN','TEXT','DATE','INTEGER','sequelize','error','warning','info'];(function(_0x3e7d62,_0x597c90){var _0x14d3ae=function(_0x7c6006){while(--_0x7c6006){_0x3e7d62['push'](_0x3e7d62['shift']());}};_0x14d3ae(++_0x597c90);}(_0xfdd3,0x92));var _0x3fdd=function(_0x404c8b,_0x26969d){_0x404c8b=_0x404c8b-0x0;var _0x1e4dd0=_0xfdd3[_0x404c8b];return _0x1e4dd0;};'use strict';var Sequelize=require(_0x3fdd('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3fdd('0x1'),_0x3fdd('0x2'),_0x3fdd('0x3'),_0x3fdd('0x4')];module[_0x3fdd('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3fdd('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3fdd('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3fdd('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3fdd('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3fdd('0x9')],'unique':'UserId'}}; \ No newline at end of file +var _0x7389=['sequelize','error','warning','info','debug','exports','TEXT','DATE','INTEGER','UserId'];(function(_0xec7a27,_0x47c037){var _0x85982a=function(_0x7cc5){while(--_0x7cc5){_0xec7a27['push'](_0xec7a27['shift']());}};_0x85982a(++_0x47c037);}(_0x7389,0xaa));var _0x9738=function(_0x291cd4,_0x3d1d11){_0x291cd4=_0x291cd4-0x0;var _0x43daac=_0x7389[_0x291cd4];return _0x43daac;};'use strict';var Sequelize=require(_0x9738('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x9738('0x1'),_0x9738('0x2'),_0x9738('0x3'),_0x9738('0x4')];module[_0x9738('0x5')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x9738('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x9738('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x9738('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x9738('0x8')],'unique':_0x9738('0x9')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index a57499f..403050c 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 _0xe1dc=['params','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','socket.io-emitter','./user-setting.socket','defaults','redis','localhost','json','update','then','sendStatus','error','stack','name','user','admin','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','find'];(function(_0x5d68ba,_0x33be44){var _0x17cee3=function(_0x14e9ed){while(--_0x14e9ed){_0x5d68ba['push'](_0x5d68ba['shift']());}};_0x17cee3(++_0x33be44);}(_0xe1dc,0x8a));var _0xce1d=function(_0x2ec55e,_0x525043){_0x2ec55e=_0x2ec55e-0x0;var _0x1225cb=_0xe1dc[_0x2ec55e];return _0x1225cb;};'use strict';var _=require(_0xce1d('0x0'));var Redis=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var config=require(_0xce1d('0x4'));var db=require(_0xce1d('0x5'))['db'];var socket=require(_0xce1d('0x6'))(new Redis(config['redis']));require(_0xce1d('0x7'))['register'](socket);config['redis']=_[_0xce1d('0x8')](config[_0xce1d('0x9')],{'host':_0xce1d('0xa'),'port':0x18eb});function respondWithResult(_0x110cc2,_0x2a91e2){_0x2a91e2=_0x2a91e2||0xc8;return function(_0x62d18b){if(_0x62d18b){return _0x110cc2['status'](_0x2a91e2)[_0xce1d('0xb')](_0x62d18b);}};}function saveUpdates(_0x7f91e1){return function(_0x54eec8){if(_0x54eec8){return _0x54eec8[_0xce1d('0xc')](_0x7f91e1)[_0xce1d('0xd')](function(_0x326c07){return _0x326c07;});}return null;};}function handleEntityNotFound(_0x1a5a48){return function(_0x134417){if(!_0x134417){_0x1a5a48[_0xce1d('0xe')](0x194);}return _0x134417;};}function handleError(_0xcb8b27,_0x3d3286){_0x3d3286=_0x3d3286||0x1f4;return function(_0x4b4ddc){logger[_0xce1d('0xf')](_0x4b4ddc[_0xce1d('0x10')]);if(_0x4b4ddc['name']){delete _0x4b4ddc[_0xce1d('0x11')];}_0xcb8b27['status'](_0x3d3286)['send'](_0x4b4ddc);};}exports['update']=function(_0x378ee5,_0x48d0fe){if(_0x378ee5[_0xce1d('0x12')]['role']!==_0xce1d('0x13'))throw new Error(_0xce1d('0x14'));if(isNaN(Number(_0x378ee5['params']['id'])))throw new Error(_0xce1d('0x15'));return db[_0xce1d('0x16')][_0xce1d('0x17')]({'where':{'id':_0x378ee5[_0xce1d('0x18')]['id']}})[_0xce1d('0xd')](handleEntityNotFound(_0x48d0fe,null))[_0xce1d('0xd')](saveUpdates(_0x378ee5[_0xce1d('0x19')],null))['then'](respondWithResult(_0x48d0fe,null))[_0xce1d('0x1a')](handleError(_0x48d0fe,null));}; \ No newline at end of file +var _0x70e0=['ioredis','../../config/logger','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','status','json','update','then','sendStatus','error','stack','name','send','Unauthorized','params','find','catch','lodash'];(function(_0x3ee672,_0x353727){var _0x277f57=function(_0x19ab2c){while(--_0x19ab2c){_0x3ee672['push'](_0x3ee672['shift']());}};_0x277f57(++_0x353727);}(_0x70e0,0x17b));var _0x070e=function(_0x3e3060,_0x44238e){_0x3e3060=_0x3e3060-0x0;var _0x24ed39=_0x70e0[_0x3e3060];return _0x24ed39;};'use strict';var _=require(_0x070e('0x0'));var Redis=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var config=require('../../config/environment');var db=require(_0x070e('0x3'))['db'];var socket=require(_0x070e('0x4'))(new Redis(config[_0x070e('0x5')]));require(_0x070e('0x6'))['register'](socket);config[_0x070e('0x5')]=_['defaults'](config[_0x070e('0x5')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x56e420,_0x5032e5){_0x5032e5=_0x5032e5||0xc8;return function(_0x35ab0c){if(_0x35ab0c){return _0x56e420[_0x070e('0x7')](_0x5032e5)[_0x070e('0x8')](_0x35ab0c);}};}function saveUpdates(_0x2611e6){return function(_0x111743){if(_0x111743){return _0x111743[_0x070e('0x9')](_0x2611e6)[_0x070e('0xa')](function(_0x4e99e6){return _0x4e99e6;});}return null;};}function handleEntityNotFound(_0x49b2fb){return function(_0x50f4eb){if(!_0x50f4eb){_0x49b2fb[_0x070e('0xb')](0x194);}return _0x50f4eb;};}function handleError(_0x12bb37,_0xb8d819){_0xb8d819=_0xb8d819||0x1f4;return function(_0xa927a2){logger[_0x070e('0xc')](_0xa927a2[_0x070e('0xd')]);if(_0xa927a2[_0x070e('0xe')]){delete _0xa927a2[_0x070e('0xe')];}_0x12bb37[_0x070e('0x7')](_0xb8d819)[_0x070e('0xf')](_0xa927a2);};}exports['update']=function(_0x5dca0f,_0x24baba){if(_0x5dca0f['user']['role']!=='admin')throw new Error(_0x070e('0x10'));if(isNaN(Number(_0x5dca0f[_0x070e('0x11')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db['UserSetting'][_0x070e('0x12')]({'where':{'id':_0x5dca0f[_0x070e('0x11')]['id']}})[_0x070e('0xa')](handleEntityNotFound(_0x24baba,null))[_0x070e('0xa')](saveUpdates(_0x5dca0f['body'],null))['then'](respondWithResult(_0x24baba,null))[_0x070e('0x13')](handleError(_0x24baba,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 b97d83f..5f3ecfc 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 _0x727d=['emit','hasOwnProperty','hook','events','../../mysqldb','UserSetting','save','update','remove'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x727d,0x1e9));var _0xd727=function(_0x28b077,_0xe071ed){_0x28b077=_0x28b077-0x0;var _0x43b3d3=_0x727d[_0x28b077];return _0x43b3d3;};'use strict';var EventEmitter=require(_0xd727('0x0'));var UserSetting=require(_0xd727('0x1'))['db'][_0xd727('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd727('0x3'),'afterUpdate':_0xd727('0x4'),'afterDestroy':_0xd727('0x5')};function emitEvent(_0x2829f4){return function(_0x39a222,_0x2ddb96,_0x13f294){UserSettingEvents[_0xd727('0x6')](_0x2829f4+':'+_0x39a222['id'],_0x39a222);UserSettingEvents['emit'](_0x2829f4,_0x39a222);_0x13f294(null);};}for(var e in events){if(events[_0xd727('0x7')](e)){var event=events[e];UserSetting[_0xd727('0x8')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x061e=['../../mysqldb','UserSetting','setMaxListeners','save','hook','events'];(function(_0x23e073,_0x514e51){var _0x2cc915=function(_0x48baa2){while(--_0x48baa2){_0x23e073['push'](_0x23e073['shift']());}};_0x2cc915(++_0x514e51);}(_0x061e,0xc5));var _0xe061=function(_0x1f0fbb,_0x4ff5c0){_0x1f0fbb=_0x1f0fbb-0x0;var _0x44b0bd=_0x061e[_0x1f0fbb];return _0x44b0bd;};'use strict';var EventEmitter=require(_0xe061('0x0'));var UserSetting=require(_0xe061('0x1'))['db'][_0xe061('0x2')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xe061('0x3')](0x0);var events={'afterCreate':_0xe061('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f7727){return function(_0x36f2d0,_0x5eec38,_0x5db778){UserSettingEvents['emit'](_0x2f7727+':'+_0x36f2d0['id'],_0x36f2d0);UserSettingEvents['emit'](_0x2f7727,_0x36f2d0);_0x5db778(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0xe061('0x5')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index f48a67b..329fc19 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 _0xad95=['./user-setting.attributes','exports','user_settings','clientSideLoggingEnabledSince'];(function(_0x15fd58,_0x1ffc80){var _0x335768=function(_0x38b9fc){while(--_0x38b9fc){_0x15fd58['push'](_0x15fd58['shift']());}};_0x335768(++_0x1ffc80);}(_0xad95,0x70));var _0x5ad9=function(_0x1d2244,_0x1b3ba5){_0x1d2244=_0x1d2244-0x0;var _0x2b9ac3=_0xad95[_0x1d2244];return _0x2b9ac3;};'use strict';var attributes=require(_0x5ad9('0x0'));module[_0x5ad9('0x1')]=function(_0x1fe578){return _0x1fe578['define']('UserSetting',attributes,{'tableName':_0x5ad9('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x235c61){if(!_0x235c61['clientSideLoggingEnabled'])_0x235c61['clientSideLoggingEnabledSince']=null;else if(_0x235c61[_0x5ad9('0x3')]===null)_0x235c61['clientSideLoggingEnabledSince']=new Date();}}});}; \ No newline at end of file +var _0xefe2=['UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x4503f6,_0x3babaf){var _0x2277d1=function(_0x1c005a){while(--_0x1c005a){_0x4503f6['push'](_0x4503f6['shift']());}};_0x2277d1(++_0x3babaf);}(_0xefe2,0xd9));var _0x2efe=function(_0x2f5100,_0x565cbe){_0x2f5100=_0x2f5100-0x0;var _0x40c4bc=_0xefe2[_0x2f5100];return _0x40c4bc;};'use strict';var attributes=require(_0x2efe('0x0'));module[_0x2efe('0x1')]=function(_0x521ca2){return _0x521ca2[_0x2efe('0x2')](_0x2efe('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x166a8e){if(!_0x166a8e['clientSideLoggingEnabled'])_0x166a8e[_0x2efe('0x4')]=null;else if(_0x166a8e[_0x2efe('0x4')]===null)_0x166a8e[_0x2efe('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index d4d78a8..117d713 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 _0xd270=['length','./user-setting.events','remove','emit','user-setting:update:user-','UserId','register'];(function(_0x19d355,_0x4d73a6){var _0x591ab6=function(_0x6cfbc2){while(--_0x6cfbc2){_0x19d355['push'](_0x19d355['shift']());}};_0x591ab6(++_0x4d73a6);}(_0xd270,0xf6));var _0x0d27=function(_0x445798,_0x1e5b29){_0x445798=_0x445798-0x0;var _0x463b5b=_0xd270[_0x445798];return _0x463b5b;};'use strict';var UserSettingEvents=require(_0x0d27('0x0'));var events=['save',_0x0d27('0x1'),'update'];function createListener(_0x48026b,_0x5b9ad2){return function(_0x5a1ba1){_0x5b9ad2[_0x0d27('0x2')](_0x48026b,_0x5a1ba1);if(_0x48026b==='user-setting:update'){_0x5b9ad2[_0x0d27('0x2')](_0x0d27('0x3')+_0x5a1ba1[_0x0d27('0x4')],_0x5a1ba1);}};}exports[_0x0d27('0x5')]=function(_0x354bdb){for(var _0x4e651e=0x0,_0x1bc20f=events[_0x0d27('0x6')];_0x4e651e<_0x1bc20f;_0x4e651e++){var _0x5e5b66=events[_0x4e651e];var _0x326d9d=createListener('user-setting:'+_0x5e5b66,_0x354bdb);UserSettingEvents['on'](_0x5e5b66,_0x326d9d);}}; \ No newline at end of file +var _0x9e8e=['UserId','register','user-setting:','./user-setting.events','save','remove','update','user-setting:update','emit','user-setting:update:user-'];(function(_0x3273ed,_0x45f1b0){var _0x63512b=function(_0x324527){while(--_0x324527){_0x3273ed['push'](_0x3273ed['shift']());}};_0x63512b(++_0x45f1b0);}(_0x9e8e,0x16b));var _0xe9e8=function(_0x5da2d1,_0x4bd038){_0x5da2d1=_0x5da2d1-0x0;var _0x19654c=_0x9e8e[_0x5da2d1];return _0x19654c;};'use strict';var UserSettingEvents=require(_0xe9e8('0x0'));var events=[_0xe9e8('0x1'),_0xe9e8('0x2'),_0xe9e8('0x3')];function createListener(_0xc54954,_0x28485b){return function(_0x1e865a){_0x28485b['emit'](_0xc54954,_0x1e865a);if(_0xc54954===_0xe9e8('0x4')){_0x28485b[_0xe9e8('0x5')](_0xe9e8('0x6')+_0x1e865a[_0xe9e8('0x7')],_0x1e865a);}};}exports[_0xe9e8('0x8')]=function(_0x3338f3){for(var _0x28593e=0x0,_0x33b93c=events['length'];_0x28593e<_0x33b93c;_0x28593e++){var _0x1d5975=events[_0x28593e];var _0x37c151=createListener(_0xe9e8('0x9')+_0x1d5975,_0x3338f3);UserSettingEvents['on'](_0x1d5975,_0x37c151);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 2bd35c5..8ab4f41 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 _0x9a18=['/:id/unpause','unpause','/:id/teams','addTeams','/:id/chat_interactions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts','addChatWebsites','/:id/api_key','createApiKey','/:id','update','put','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeSmsAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/whoami','whoami','getPresence','/:id/avatar','getAvatar','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getLists','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','getScheduledCalls','post','addContacts','/create_many','bulkCreate','diskStorage','server/files/images/','format','originalname','single','file','addAvatar','/:id/login','login','logout','/:id/pause','pause'];(function(_0x2ce515,_0x3dcb43){var _0x19f78b=function(_0x19e86d){while(--_0x19e86d){_0x2ce515['push'](_0x2ce515['shift']());}};_0x19f78b(++_0x3dcb43);}(_0x9a18,0xfa));var _0x89a1=function(_0x79e614,_0x30c7ea){_0x79e614=_0x79e614-0x0;var _0x27e2f3=_0x9a18[_0x79e614];return _0x27e2f3;};'use strict';var multer=require(_0x89a1('0x0'));var util=require(_0x89a1('0x1'));var path=require(_0x89a1('0x2'));var timeout=require(_0x89a1('0x3'));var express=require(_0x89a1('0x4'));var router=express['Router']();var fs_extra=require(_0x89a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x89a1('0x6'));var config=require(_0x89a1('0x7'));var controller=require('./user.controller');router[_0x89a1('0x8')]('/',auth[_0x89a1('0x9')](),controller[_0x89a1('0xa')]);router[_0x89a1('0x8')](_0x89a1('0xb'),auth[_0x89a1('0x9')](),controller['describe']);router[_0x89a1('0x8')](_0x89a1('0xc'),auth[_0x89a1('0x9')](),controller[_0x89a1('0xd')]);router['get']('/presence',auth[_0x89a1('0x9')](),controller[_0x89a1('0xe')]);router[_0x89a1('0x8')]('/:id',auth[_0x89a1('0x9')](),controller['show']);router[_0x89a1('0x8')](_0x89a1('0xf'),controller[_0x89a1('0x10')]);router['get']('/:id/open_tabs',auth[_0x89a1('0x9')](),controller[_0x89a1('0x11')]);router[_0x89a1('0x8')](_0x89a1('0x12'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x13')]);router[_0x89a1('0x8')](_0x89a1('0x14'),auth[_0x89a1('0x9')](),controller['getQueues']);router[_0x89a1('0x8')](_0x89a1('0x15'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x16')]);router['get'](_0x89a1('0x17'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x18')]);router[_0x89a1('0x8')](_0x89a1('0x19'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x1a')]);router[_0x89a1('0x8')](_0x89a1('0x1b'),auth['isAuthenticated'](),controller['getScreenRecordings']);router[_0x89a1('0x8')](_0x89a1('0x1c'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x1d')]);router[_0x89a1('0x8')](_0x89a1('0x1e'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x1f')]);router['get'](_0x89a1('0x20'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0x89a1('0x8')](_0x89a1('0x21'),auth['isAuthenticated'](),controller[_0x89a1('0x22')]);router['get'](_0x89a1('0x23'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x24')]);router[_0x89a1('0x8')](_0x89a1('0x25'),auth[_0x89a1('0x9')](),controller['getWhatsappInteractions']);router[_0x89a1('0x8')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router['get']('/:id/lists',auth[_0x89a1('0x9')](),controller[_0x89a1('0x26')]);router[_0x89a1('0x8')]('/:id/agents',auth['isAuthenticated'](),controller['getAgents']);router[_0x89a1('0x8')]('/:id/prefixes',auth[_0x89a1('0x9')](),controller[_0x89a1('0x27')]);router[_0x89a1('0x8')](_0x89a1('0x28'),auth['isAuthenticated'](),controller[_0x89a1('0x29')]);router[_0x89a1('0x8')](_0x89a1('0x2a'),auth[_0x89a1('0x9')](),controller['getMailAccounts']);router['get'](_0x89a1('0x2b'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x2c')]);router['get'](_0x89a1('0x2d'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x2e')]);router[_0x89a1('0x8')](_0x89a1('0x2f'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x30')]);router[_0x89a1('0x8')](_0x89a1('0x31'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x32')]);router[_0x89a1('0x8')]('/:id/scheduled_calls',auth[_0x89a1('0x9')](),controller[_0x89a1('0x33')]);router['get']('/:id/api_key',auth[_0x89a1('0x9')](),controller['getApiKey']);router[_0x89a1('0x34')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x89a1('0x35')]);router[_0x89a1('0x34')]('/',auth[_0x89a1('0x9')](),controller['create']);router[_0x89a1('0x34')](_0x89a1('0x36'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x37')]);router[_0x89a1('0x34')](_0x89a1('0x14'),auth[_0x89a1('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0x89a1('0x38')]({'destination':function(_0x2cb315,_0x3f1e5e,_0x1911f0){_0x1911f0(null,path['join'](config['root'],_0x89a1('0x39')));},'filename':function(_0x2db036,_0x2a3d0e,_0x43f670){_0x43f670(null,util[_0x89a1('0x3a')]('%s-%s',Date['now'](),_0x2a3d0e[_0x89a1('0x3b')]));}})});router[_0x89a1('0x34')](_0x89a1('0xf'),upload[_0x89a1('0x3c')](_0x89a1('0x3d')),controller[_0x89a1('0x3e')]);router[_0x89a1('0x34')](_0x89a1('0x3f'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x40')]);router['post']('/:id/logout',auth['isAuthenticated'](),controller[_0x89a1('0x41')]);router[_0x89a1('0x34')](_0x89a1('0x42'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x43')]);router[_0x89a1('0x34')](_0x89a1('0x44'),auth['isAuthenticated'](),controller[_0x89a1('0x45')]);router[_0x89a1('0x34')](_0x89a1('0x46'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x47')]);router['post'](_0x89a1('0x48'),auth[_0x89a1('0x9')](),controller['addChatInteractions']);router[_0x89a1('0x34')](_0x89a1('0x49'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x4a')]);router[_0x89a1('0x34')](_0x89a1('0x4b'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x4c')]);router[_0x89a1('0x34')]('/:id/sms_interactions',auth[_0x89a1('0x9')](),controller[_0x89a1('0x4d')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x89a1('0x4e')]);router['post']('/:id/whatsapp_interactions',auth[_0x89a1('0x9')](),controller[_0x89a1('0x4f')]);router[_0x89a1('0x34')](_0x89a1('0x28'),auth['isAuthenticated'](),controller[_0x89a1('0x50')]);router[_0x89a1('0x34')](_0x89a1('0x2a'),auth['isAuthenticated'](),controller['addMailAccounts']);router[_0x89a1('0x34')](_0x89a1('0x2b'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x51')]);router[_0x89a1('0x34')]('/:id/sms_accounts',auth[_0x89a1('0x9')](),controller[_0x89a1('0x52')]);router[_0x89a1('0x34')](_0x89a1('0x2f'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x53')]);router[_0x89a1('0x34')](_0x89a1('0x31'),auth[_0x89a1('0x9')](),controller['addWhatsappAccounts']);router[_0x89a1('0x34')](_0x89a1('0x54'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x55')]);router['put'](_0x89a1('0x56'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x57')]);router[_0x89a1('0x58')](_0x89a1('0x59'),auth[_0x89a1('0x9')](),controller['changePassword']);router[_0x89a1('0x5a')](_0x89a1('0x14'),auth['isAuthenticated'](),controller[_0x89a1('0x5b')]);router[_0x89a1('0x5a')]('/:id/teams',auth[_0x89a1('0x9')](),controller[_0x89a1('0x5c')]);router['delete'](_0x89a1('0x56'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x5d')]);router['delete'](_0x89a1('0x48'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x5e')]);router['delete'](_0x89a1('0x49'),auth[_0x89a1('0x9')](),controller['removeMailInteractions']);router[_0x89a1('0x5a')](_0x89a1('0x4b'),auth[_0x89a1('0x9')](),controller['removeFaxInteractions']);router['delete'](_0x89a1('0x5f'),auth['isAuthenticated'](),controller[_0x89a1('0x60')]);router[_0x89a1('0x5a')](_0x89a1('0x61'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x62')]);router[_0x89a1('0x5a')](_0x89a1('0x63'),auth['isAuthenticated'](),controller[_0x89a1('0x64')]);router[_0x89a1('0x5a')](_0x89a1('0x28'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x89a1('0x5a')](_0x89a1('0x2a'),auth['isAuthenticated'](),controller['removeMailAccounts']);router[_0x89a1('0x5a')](_0x89a1('0x2b'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router['delete'](_0x89a1('0x2d'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x65')]);router[_0x89a1('0x5a')]('/:id/chat_websites',auth[_0x89a1('0x9')](),controller['removeChatWebsites']);router[_0x89a1('0x5a')](_0x89a1('0x31'),auth[_0x89a1('0x9')](),controller['removeWhatsappAccounts']);router['delete'](_0x89a1('0x54'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x66')]);router[_0x89a1('0x34')](_0x89a1('0x67'),auth[_0x89a1('0x9')](),controller[_0x89a1('0x68')]);module[_0x89a1('0x69')]=router; \ No newline at end of file +var _0xaa56=['removeTeams','destroy','removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeFaxAccounts','removeMailAccounts','removeWhatsappAccounts','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','util','path','express','Router','../../components/auth/service','./user.controller','get','isAuthenticated','index','describe','whoami','/presence','getPresence','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','/:id/lists','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','post','addContacts','create','/create_many','join','root','server/files/images/','format','%s-%s','now','originalname','single','/:id/login','logout','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','addSmsInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','addWhatsappAccounts','createApiKey','put','delete','removeQueues'];(function(_0x3c700f,_0x48b424){var _0x95ee6c=function(_0x24d818){while(--_0x24d818){_0x3c700f['push'](_0x3c700f['shift']());}};_0x95ee6c(++_0x48b424);}(_0xaa56,0x1ac));var _0x6aa5=function(_0x194696,_0x550819){_0x194696=_0x194696-0x0;var _0x5410cf=_0xaa56[_0x194696];return _0x5410cf;};'use strict';var multer=require('multer');var util=require(_0x6aa5('0x0'));var path=require(_0x6aa5('0x1'));var timeout=require('connect-timeout');var express=require(_0x6aa5('0x2'));var router=express[_0x6aa5('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x6aa5('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x6aa5('0x5'));router[_0x6aa5('0x6')]('/',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x6aa5('0x9')]);router[_0x6aa5('0x6')]('/whoami',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0xa')]);router[_0x6aa5('0x6')](_0x6aa5('0xb'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0xc')]);router[_0x6aa5('0x6')](_0x6aa5('0xd'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0xe')]);router[_0x6aa5('0x6')]('/:id/avatar',controller[_0x6aa5('0xf')]);router[_0x6aa5('0x6')](_0x6aa5('0x10'),auth['isAuthenticated'](),controller[_0x6aa5('0x11')]);router[_0x6aa5('0x6')](_0x6aa5('0x12'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x13')]);router[_0x6aa5('0x6')](_0x6aa5('0x14'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x15')]);router['get'](_0x6aa5('0x16'),auth['isAuthenticated'](),controller[_0x6aa5('0x17')]);router[_0x6aa5('0x6')]('/:id/groups',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x18')]);router['get'](_0x6aa5('0x19'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x1a')]);router[_0x6aa5('0x6')](_0x6aa5('0x1b'),auth['isAuthenticated'](),controller[_0x6aa5('0x1c')]);router[_0x6aa5('0x6')](_0x6aa5('0x1d'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x1e')]);router[_0x6aa5('0x6')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x6aa5('0x6')]('/:id/mail/interactions',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x1f')]);router['get'](_0x6aa5('0x20'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x21')]);router[_0x6aa5('0x6')]('/:id/fax/interactions',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x22')]);router[_0x6aa5('0x6')](_0x6aa5('0x23'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x24')]);router[_0x6aa5('0x6')](_0x6aa5('0x25'),auth['isAuthenticated'](),controller['getTeams']);router[_0x6aa5('0x6')](_0x6aa5('0x26'),auth['isAuthenticated'](),controller['getLists']);router[_0x6aa5('0x6')]('/:id/agents',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x27')]);router[_0x6aa5('0x6')]('/:id/prefixes',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x28')]);router['get'](_0x6aa5('0x29'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x2a')]);router[_0x6aa5('0x6')](_0x6aa5('0x2b'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x2c')]);router[_0x6aa5('0x6')](_0x6aa5('0x2d'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x2e')]);router[_0x6aa5('0x6')](_0x6aa5('0x2f'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x30')]);router[_0x6aa5('0x6')](_0x6aa5('0x31'),auth['isAuthenticated'](),controller[_0x6aa5('0x32')]);router['get'](_0x6aa5('0x33'),auth[_0x6aa5('0x7')](),controller['getWhatsappAccounts']);router[_0x6aa5('0x6')](_0x6aa5('0x34'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x35')]);router[_0x6aa5('0x6')](_0x6aa5('0x36'),auth['isAuthenticated'](),controller['getApiKey']);router[_0x6aa5('0x37')](_0x6aa5('0x12'),auth['isAuthenticated'](),controller[_0x6aa5('0x38')]);router[_0x6aa5('0x37')]('/',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x39')]);router[_0x6aa5('0x37')](_0x6aa5('0x3a'),auth['isAuthenticated'](),controller['bulkCreate']);router[_0x6aa5('0x37')](_0x6aa5('0x14'),auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d8494,_0x3dbafe,_0x2ed47f){_0x2ed47f(null,path[_0x6aa5('0x3b')](config[_0x6aa5('0x3c')],_0x6aa5('0x3d')));},'filename':function(_0x127e2f,_0x40f811,_0x2bc7cf){_0x2bc7cf(null,util[_0x6aa5('0x3e')](_0x6aa5('0x3f'),Date[_0x6aa5('0x40')](),_0x40f811[_0x6aa5('0x41')]));}})});router[_0x6aa5('0x37')]('/:id/avatar',upload[_0x6aa5('0x42')]('file'),controller['addAvatar']);router[_0x6aa5('0x37')](_0x6aa5('0x43'),auth['isAuthenticated'](),controller['login']);router['post']('/:id/logout',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x44')]);router[_0x6aa5('0x37')]('/:id/pause',auth[_0x6aa5('0x7')](),controller['pause']);router[_0x6aa5('0x37')](_0x6aa5('0x45'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x46')]);router[_0x6aa5('0x37')](_0x6aa5('0x25'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x47')]);router[_0x6aa5('0x37')](_0x6aa5('0x48'),auth['isAuthenticated'](),controller[_0x6aa5('0x49')]);router[_0x6aa5('0x37')](_0x6aa5('0x4a'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x4b')]);router[_0x6aa5('0x37')](_0x6aa5('0x4c'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x4d')]);router[_0x6aa5('0x37')]('/:id/sms_interactions',auth['isAuthenticated'](),controller[_0x6aa5('0x4e')]);router[_0x6aa5('0x37')]('/:id/openchannel_interactions',auth[_0x6aa5('0x7')](),controller['addOpenchannelInteractions']);router['post']('/:id/whatsapp_interactions',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x4f')]);router[_0x6aa5('0x37')](_0x6aa5('0x29'),auth[_0x6aa5('0x7')](),controller['addFaxAccounts']);router[_0x6aa5('0x37')]('/:id/mail_accounts',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x50')]);router[_0x6aa5('0x37')](_0x6aa5('0x2d'),auth[_0x6aa5('0x7')](),controller['addOpenchannelAccounts']);router[_0x6aa5('0x37')](_0x6aa5('0x2f'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x51')]);router['post'](_0x6aa5('0x31'),auth[_0x6aa5('0x7')](),controller['addChatWebsites']);router[_0x6aa5('0x37')](_0x6aa5('0x33'),auth['isAuthenticated'](),controller[_0x6aa5('0x52')]);router[_0x6aa5('0x37')](_0x6aa5('0x36'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x53')]);router['put'](_0x6aa5('0xd'),auth[_0x6aa5('0x7')](),controller['update']);router[_0x6aa5('0x54')]('/:id/password',auth[_0x6aa5('0x7')](),controller['changePassword']);router[_0x6aa5('0x55')](_0x6aa5('0x14'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x56')]);router[_0x6aa5('0x55')](_0x6aa5('0x25'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x57')]);router[_0x6aa5('0x55')](_0x6aa5('0xd'),auth['isAuthenticated'](),controller[_0x6aa5('0x58')]);router[_0x6aa5('0x55')](_0x6aa5('0x48'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x59')]);router[_0x6aa5('0x55')]('/:id/mail_interactions',auth[_0x6aa5('0x7')](),controller['removeMailInteractions']);router[_0x6aa5('0x55')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0x6aa5('0x5a')]);router[_0x6aa5('0x55')](_0x6aa5('0x5b'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x5c')]);router['delete'](_0x6aa5('0x5d'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x5e')]);router[_0x6aa5('0x55')](_0x6aa5('0x5f'),auth[_0x6aa5('0x7')](),controller['removeWhatsappInteractions']);router[_0x6aa5('0x55')](_0x6aa5('0x29'),auth['isAuthenticated'](),controller[_0x6aa5('0x60')]);router[_0x6aa5('0x55')](_0x6aa5('0x2b'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x61')]);router[_0x6aa5('0x55')](_0x6aa5('0x2d'),auth[_0x6aa5('0x7')](),controller['removeOpenchannelAccounts']);router[_0x6aa5('0x55')](_0x6aa5('0x2f'),auth[_0x6aa5('0x7')](),controller['removeSmsAccounts']);router[_0x6aa5('0x55')]('/:id/chat_websites',auth[_0x6aa5('0x7')](),controller['removeChatWebsites']);router[_0x6aa5('0x55')](_0x6aa5('0x33'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x62')]);router['delete']('/:id/api_key',auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x63')]);router[_0x6aa5('0x37')](_0x6aa5('0x64'),auth[_0x6aa5('0x7')](),controller[_0x6aa5('0x65')]);module[_0x6aa5('0x66')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 03ef484..cb07a0e 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 _0x9cba=['The\x20name\x20of\x20the\x20user','fullname','callerid','getDataValue','email','toLowerCase','ENUM','user','agent','telephone','internal','accountcode','format','\x22%s\x22\x20<%s>','BOOLEAN','DATE','DEFAULT\x20PAUSE','INTEGER','dynamic','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','always','accept','refuse','originate','uas','fingerprint','certificate','active','passive','actpass','update,nonat','TEXT','showWebBar','get','isArray','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','wss','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','sequelize','util','exports','STRING','name','setDataValue','defaultuser'];(function(_0x544419,_0x539c34){var _0x6eadc9=function(_0xcdf22a){while(--_0xcdf22a){_0x544419['push'](_0x544419['shift']());}};_0x6eadc9(++_0x539c34);}(_0x9cba,0x17d));var _0xa9cb=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x9cba[_0x3ab51d];return _0x29a04e;};'use strict';var Sequelize=require(_0xa9cb('0x0'));var moment=require('moment');var util=require(_0xa9cb('0x1'));var _=require('lodash');module[_0xa9cb('0x2')]={'name':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':![],'unique':_0xa9cb('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x294f9b){this[_0xa9cb('0x5')]('name',_0x294f9b);this[_0xa9cb('0x5')](_0xa9cb('0x6'),_0x294f9b);},'comment':_0xa9cb('0x7')},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x215470){this[_0xa9cb('0x5')](_0xa9cb('0x8'),_0x215470);this[_0xa9cb('0x5')](_0xa9cb('0x9'),util['format']('\x22%s\x22\x20<%s>',_0x215470,this[_0xa9cb('0xa')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':![],'unique':_0xa9cb('0xb'),'validate':{'isEmail':!![]},'set':function(_0x4d4bed){if(_0x4d4bed){this[_0xa9cb('0x5')](_0xa9cb('0xb'),_0x4d4bed[_0xa9cb('0xc')]());}}},'role':{'type':Sequelize[_0xa9cb('0xd')]('admin',_0xa9cb('0xe'),_0xa9cb('0xf'),_0xa9cb('0x10')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xa9cb('0x11'),'set':function(_0x57b0ba){this['setDataValue']('internal',_0x57b0ba);this[_0xa9cb('0x5')](_0xa9cb('0x12'),_0x57b0ba);this[_0xa9cb('0x5')](_0xa9cb('0x9'),util[_0xa9cb('0x13')](_0xa9cb('0x14'),this[_0xa9cb('0xa')](_0xa9cb('0x8')),_0x57b0ba));}},'salt':{'type':Sequelize[_0xa9cb('0x3')]},'phone':{'type':Sequelize[_0xa9cb('0x3')]},'mobile':{'type':Sequelize[_0xa9cb('0x3')]},'address':{'type':Sequelize[_0xa9cb('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xa9cb('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa9cb('0x3')]},'online':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa9cb('0x16')]},'voicePause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':_0xa9cb('0x17')},'lastPauseAt':{'type':Sequelize[_0xa9cb('0x16')]},'chatCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa9cb('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'host':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':_0xa9cb('0x19')},'ipaddr':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xa9cb('0x18')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xa9cb('0x1a'),_0xa9cb('0xe'),_0xa9cb('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':_0xa9cb('0x1c')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xa9cb('0x1d'),_0xa9cb('0x1e'),_0xa9cb('0x1f'),_0xa9cb('0x20'),_0xa9cb('0x21'),_0xa9cb('0x22'),_0xa9cb('0x23')),'allowNull':!![]},'deny':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xa9cb('0x24'),'set':function(_0x2bcd1c){this[_0xa9cb('0x5')](_0xa9cb('0x25'),_0x2bcd1c?_0x2bcd1c[_0xa9cb('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xa9cb('0x25'))?this['getDataValue']('transport')['split'](','):null;},'comment':_0xa9cb('0x27')},'dtmfmode':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x28'),_0xa9cb('0x29'),_0xa9cb('0x2a'),_0xa9cb('0x2b'),_0xa9cb('0x2c')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no',_0xa9cb('0x2e'),_0xa9cb('0x2f'),_0xa9cb('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':_0xa9cb('0x31'),'set':function(_0x378ccd){this[_0xa9cb('0x5')]('nat',_0x378ccd?_0x378ccd[_0xa9cb('0x26')](','):null);},'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x32'))?this[_0xa9cb('0xa')](_0xa9cb('0x32'))[_0xa9cb('0x33')](','):null;},'comment':_0xa9cb('0x34')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa9cb('0x3')]},'pickupgroup':{'type':Sequelize[_0xa9cb('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xa9cb('0x3')]},'language':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa9cb('0x3')]},'disallow':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':![],'defaultValue':_0xa9cb('0x35')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa9cb('0x36'),'set':function(_0x1a4ec1){this[_0xa9cb('0x5')](_0xa9cb('0x37'),_0x1a4ec1?_0x1a4ec1[_0xa9cb('0x26')](';'):_0xa9cb('0x36'));},'get':function(){return this['getDataValue']('allow')?this[_0xa9cb('0xa')](_0xa9cb('0x37'))[_0xa9cb('0x33')](';'):null;},'comment':_0xa9cb('0x38')},'autoframing':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'set':function(_0x3967ed){this['setDataValue'](_0xa9cb('0x39'),_0x3967ed?_0x3967ed[_0xa9cb('0x26')](','):null);},'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x39'))?this[_0xa9cb('0xa')](_0xa9cb('0x39'))[_0xa9cb('0x33')](','):null;},'comment':_0xa9cb('0x3a')},'trustrpid':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no',_0xa9cb('0x3b')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xa9cb('0xd')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xa9cb('0x2d')},'busylevel':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no',_0xa9cb('0x3c')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x3d'),_0xa9cb('0x3e'),_0xa9cb('0x3f')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'allowNull':!![],'defaultValue':_0xa9cb('0x40')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xa9cb('0x2d')},'keepalive':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no',_0xa9cb('0x41'),_0xa9cb('0x42')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa9cb('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x43'),_0xa9cb('0x44'),_0xa9cb('0x45')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa9cb('0xd')](_0xa9cb('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa9cb('0xd')]('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no',_0xa9cb('0x2e'),_0xa9cb('0x2f'),_0xa9cb('0x46')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize['STRING']},'resetPasswordExpires':{'type':Sequelize[_0xa9cb('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa9cb('0x47')]},'showWebBar':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0,'set':function(_0x48a95a){this[_0xa9cb('0x5')](_0xa9cb('0x48'),_0x48a95a);var _0x55cdcd=this[_0xa9cb('0x49')]({'plain':!![]});switch(_0x48a95a){case 0x0:case 0x1:var _0x3189e8=_0x55cdcd['transport']?_[_0xa9cb('0x4a')](_0x55cdcd['transport'])?_0x55cdcd[_0xa9cb('0x25')][_0xa9cb('0x26')]():_0x55cdcd[_0xa9cb('0x25')]:_0xa9cb('0x24');if(_0x3189e8==='wss'){_0x3189e8=_0xa9cb('0x24');}this[_0xa9cb('0x5')](_0xa9cb('0x25'),_0x3189e8);this[_0xa9cb('0x5')](_0xa9cb('0x4b'),'no');this[_0xa9cb('0x5')](_0xa9cb('0x4c'),null);this[_0xa9cb('0x5')](_0xa9cb('0x4d'),null);this[_0xa9cb('0x5')](_0xa9cb('0x4e'),null);this[_0xa9cb('0x5')]('dtlsenable',null);this[_0xa9cb('0x5')](_0xa9cb('0x4f'),null);this[_0xa9cb('0x5')](_0xa9cb('0x50'),null);this[_0xa9cb('0x5')]('dtlscertfile',null);this['setDataValue'](_0xa9cb('0x51'),null);this[_0xa9cb('0x5')](_0xa9cb('0x52'),'no');break;case 0x2:this[_0xa9cb('0x5')]('transport',_0xa9cb('0x53'));this[_0xa9cb('0x5')](_0xa9cb('0x4b'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x4c'),'yes');this[_0xa9cb('0x5')](_0xa9cb('0x4d'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x4e'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x54'),_0xa9cb('0x2d'));this[_0xa9cb('0x5')](_0xa9cb('0x4f'),'no');this['setDataValue'](_0xa9cb('0x50'),'actpass');this['setDataValue'](_0xa9cb('0x55'),_0x55cdcd['dtlscertfile']||_0xa9cb('0x56'));this[_0xa9cb('0x5')](_0xa9cb('0x51'),_0x55cdcd[_0xa9cb('0x51')]||'/etc/pki/tls/private/motion.key');this[_0xa9cb('0x5')](_0xa9cb('0x52'),_0xa9cb('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xa9cb('0x47')],'set':function(_0x27c748){this[_0xa9cb('0x5')]('permissions',_0x27c748?_0x27c748['join'](','):[]);},'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x57'))?_[_0xa9cb('0x58')](this[_0xa9cb('0xa')](_0xa9cb('0x57'))[_0xa9cb('0x33')](','),function(_0x422fc3){return parseInt(_0x422fc3,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarUnconditional':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xa9cb('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa9cb('0x3')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa9cb('0x59')],'get':function(){return this[_0xa9cb('0xa')](_0xa9cb('0x5a'))?this[_0xa9cb('0xa')](_0xa9cb('0x5a')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa9cb('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa9cb('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![],'set':function(_0x4ce898){if(typeof _0x4ce898===_0xa9cb('0x5b')){var _0x14abf4=_0x4ce898==='1'?!![]:_0x4ce898==='0'?![]:_0x4ce898===_0xa9cb('0x5c')?!![]:_0x4ce898===_0xa9cb('0x5d')?![]:![];this[_0xa9cb('0x5')](_0xa9cb('0x5e'),_0x14abf4);}else{this[_0xa9cb('0x5')]('screenrecording',_0x4ce898);}}},'blocked':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![],'set':function(_0x5c2fe0){this[_0xa9cb('0x5')](_0xa9cb('0x5f'),_0x5c2fe0);if(_0x5c2fe0===!![]){this['setDataValue']('blockedAt',moment());this['setDataValue']('loginAttempts',0x0);}else{this[_0xa9cb('0x5')](_0xa9cb('0x60'),null);}}},'blockedAt':{'type':Sequelize[_0xa9cb('0x16')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xa9cb('0x15')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa9cb('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd1cc=['getDataValue','internal','email','toLowerCase','ENUM','user','agent','telephone','INTEGER','accountcode','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','join','split','rfc2833','info','shortinfo','auto','nonat','outgoing','yes','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\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','certificate','active','actpass','showWebBar','get','isArray','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlscertfile','rtcp_mux','transport','wss','encryption','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','UNSIGNED','sequelize','moment','util','lodash','exports','STRING','setDataValue','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','format','\x22%s\x22\x20<%s>'];(function(_0x2d24ab,_0x431d00){var _0x22bc9f=function(_0x3b5d19){while(--_0x3b5d19){_0x2d24ab['push'](_0x2d24ab['shift']());}};_0x22bc9f(++_0x431d00);}(_0xd1cc,0x1ba));var _0xcd1c=function(_0x5a5035,_0x55a45c){_0x5a5035=_0x5a5035-0x0;var _0x55b8d2=_0xd1cc[_0x5a5035];return _0x55b8d2;};'use strict';var Sequelize=require(_0xcd1c('0x0'));var moment=require(_0xcd1c('0x1'));var util=require(_0xcd1c('0x2'));var _=require(_0xcd1c('0x3'));module[_0xcd1c('0x4')]={'name':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x160194){this[_0xcd1c('0x6')](_0xcd1c('0x7'),_0x160194);this['setDataValue'](_0xcd1c('0x8'),_0x160194);},'comment':_0xcd1c('0x9')},'fullname':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'set':function(_0x3ee824){this[_0xcd1c('0x6')](_0xcd1c('0xa'),_0x3ee824);this['setDataValue']('callerid',util[_0xcd1c('0xb')](_0xcd1c('0xc'),_0x3ee824,this[_0xcd1c('0xd')](_0xcd1c('0xe'))));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0x172360){if(_0x172360){this[_0xcd1c('0x6')](_0xcd1c('0xf'),_0x172360[_0xcd1c('0x10')]());}}},'role':{'type':Sequelize[_0xcd1c('0x11')]('admin',_0xcd1c('0x12'),_0xcd1c('0x13'),_0xcd1c('0x14')),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize['STRING'],'defaultValue':'local'},'internal':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':![],'unique':_0xcd1c('0xe'),'set':function(_0x472a45){this['setDataValue']('internal',_0x472a45);this[_0xcd1c('0x6')](_0xcd1c('0x16'),_0x472a45);this[_0xcd1c('0x6')]('callerid',util[_0xcd1c('0xb')]('\x22%s\x22\x20<%s>',this[_0xcd1c('0xd')]('fullname'),_0x472a45));}},'salt':{'type':Sequelize[_0xcd1c('0x5')]},'phone':{'type':Sequelize[_0xcd1c('0x5')]},'mobile':{'type':Sequelize[_0xcd1c('0x5')]},'address':{'type':Sequelize[_0xcd1c('0x5')]},'zipcode':{'type':Sequelize[_0xcd1c('0x5')]},'userpic':{'type':Sequelize[_0xcd1c('0x5')]},'city':{'type':Sequelize[_0xcd1c('0x5')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xcd1c('0x18')]},'voicePause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':_0xcd1c('0x19')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xcd1c('0x15')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xcd1c('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcd1c('0x1a')},'ipaddr':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'port':{'type':Sequelize[_0xcd1c('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize['STRING'],'allowNull':!![]},'regserver':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x1b'),_0xcd1c('0x12'),_0xcd1c('0x1c')),'allowNull':!![],'defaultValue':_0xcd1c('0x1b')},'context':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![],'defaultValue':_0xcd1c('0x1d')},'callingpres':{'type':Sequelize['ENUM'](_0xcd1c('0x1e'),'ALLOWED_PASSED_SCREEN',_0xcd1c('0x1f'),_0xcd1c('0x20'),_0xcd1c('0x21'),_0xcd1c('0x22'),_0xcd1c('0x23'),_0xcd1c('0x24')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![],'defaultValue':_0xcd1c('0x25'),'set':function(_0x24d05a){this[_0xcd1c('0x6')]('transport',_0x24d05a?_0x24d05a[_0xcd1c('0x26')](','):null);},'get':function(){return this[_0xcd1c('0xd')]('transport')?this['getDataValue']('transport')[_0xcd1c('0x27')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x28'),_0xcd1c('0x29'),_0xcd1c('0x2a'),'inband',_0xcd1c('0x2b')),'allowNull':!![],'defaultValue':_0xcd1c('0x28')},'directmedia':{'type':Sequelize[_0xcd1c('0x11')]('yes','no',_0xcd1c('0x2c'),'update',_0xcd1c('0x2d')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x5c9b99){this['setDataValue'](_0xcd1c('0x2f'),_0x5c9b99?_0x5c9b99['join'](','):null);},'get':function(){return this[_0xcd1c('0xd')]('nat')?this[_0xcd1c('0xd')]('nat')[_0xcd1c('0x27')](','):null;},'comment':_0xcd1c('0x30')},'callgroup':{'type':Sequelize[_0xcd1c('0x5')]},'namedcallgroup':{'type':Sequelize[_0xcd1c('0x5')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xcd1c('0x5')]},'language':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':![],'defaultValue':_0xcd1c('0x31'),'set':function(_0x175cd0){this['setDataValue'](_0xcd1c('0x32'),_0x175cd0?_0x175cd0[_0xcd1c('0x26')](';'):_0xcd1c('0x31'));},'get':function(){return this[_0xcd1c('0xd')](_0xcd1c('0x32'))?this[_0xcd1c('0xd')](_0xcd1c('0x32'))[_0xcd1c('0x27')](';'):null;},'comment':_0xcd1c('0x33')},'autoframing':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![],'set':function(_0x284a84){this[_0xcd1c('0x6')](_0xcd1c('0x34'),_0x284a84?_0x284a84[_0xcd1c('0x26')](','):null);},'get':function(){return this['getDataValue'](_0xcd1c('0x34'))?this[_0xcd1c('0xd')](_0xcd1c('0x34'))[_0xcd1c('0x27')](','):null;},'comment':_0xcd1c('0x35')},'trustrpid':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no',_0xcd1c('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xcd1c('0x37')},'amaflags':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':_0xcd1c('0x2e')},'busylevel':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xcd1c('0x11')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'template':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xcd1c('0x11')]('yes','no',_0xcd1c('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0xcd1c('0x39'),_0xcd1c('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x3b'),_0xcd1c('0x3c')),'allowNull':!![],'defaultValue':_0xcd1c('0x3c')},'t38pt_usertpsource':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':_0xcd1c('0x2e')},'keepalive':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xcd1c('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xcd1c('0x11')]('yes','no','fingerprint',_0xcd1c('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x3e'),'passive',_0xcd1c('0x3f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xcd1c('0x11')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize['STRING'],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM']('yes','no','nonat','update','update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xcd1c('0x5')]},'resetPasswordExpires':{'type':Sequelize[_0xcd1c('0x18')]},'passwordResetAt':{'type':Sequelize[_0xcd1c('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0,'set':function(_0x2f1107){this[_0xcd1c('0x6')](_0xcd1c('0x40'),_0x2f1107);var _0x415cd8=this[_0xcd1c('0x41')]({'plain':!![]});switch(_0x2f1107){case 0x0:case 0x1:var _0x3fa8fc=_0x415cd8['transport']?_[_0xcd1c('0x42')](_0x415cd8['transport'])?_0x415cd8['transport']['join']():_0x415cd8['transport']:'udp';if(_0x3fa8fc==='wss'){_0x3fa8fc=_0xcd1c('0x25');}this[_0xcd1c('0x6')]('transport',_0x3fa8fc);this['setDataValue']('encryption','no');this[_0xcd1c('0x6')](_0xcd1c('0x43'),null);this['setDataValue'](_0xcd1c('0x44'),null);this[_0xcd1c('0x6')](_0xcd1c('0x45'),null);this[_0xcd1c('0x6')]('dtlsenable',null);this[_0xcd1c('0x6')](_0xcd1c('0x46'),null);this['setDataValue'](_0xcd1c('0x47'),null);this[_0xcd1c('0x6')](_0xcd1c('0x48'),null);this[_0xcd1c('0x6')]('dtlsprivatekey',null);this[_0xcd1c('0x6')](_0xcd1c('0x49'),'no');break;case 0x2:this[_0xcd1c('0x6')](_0xcd1c('0x4a'),_0xcd1c('0x4b'));this[_0xcd1c('0x6')](_0xcd1c('0x4c'),_0xcd1c('0x2e'));this[_0xcd1c('0x6')](_0xcd1c('0x43'),_0xcd1c('0x2e'));this[_0xcd1c('0x6')](_0xcd1c('0x44'),_0xcd1c('0x2e'));this['setDataValue'](_0xcd1c('0x45'),'yes');this[_0xcd1c('0x6')]('dtlsenable',_0xcd1c('0x2e'));this[_0xcd1c('0x6')](_0xcd1c('0x46'),'no');this['setDataValue'](_0xcd1c('0x47'),'actpass');this['setDataValue'](_0xcd1c('0x48'),_0x415cd8[_0xcd1c('0x48')]||_0xcd1c('0x4d'));this[_0xcd1c('0x6')]('dtlsprivatekey',_0x415cd8[_0xcd1c('0x4e')]||_0xcd1c('0x4f'));this[_0xcd1c('0x6')](_0xcd1c('0x49'),_0xcd1c('0x2e'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x357a0d){this['setDataValue']('permissions',_0x357a0d?_0x357a0d[_0xcd1c('0x26')](','):[]);},'get':function(){return this['getDataValue'](_0xcd1c('0x50'))?_[_0xcd1c('0x51')](this[_0xcd1c('0xd')](_0xcd1c('0x50'))[_0xcd1c('0x27')](','),function(_0x2132eb){return parseInt(_0x2132eb,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xcd1c('0x5')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xcd1c('0x5')]},'phoneBarBusyNumber':{'type':Sequelize[_0xcd1c('0x5')]},'phoneBarUnconditional':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xcd1c('0x11')](_0xcd1c('0x2e'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xcd1c('0x52')],'get':function(){return this['getDataValue'](_0xcd1c('0x53'))?this[_0xcd1c('0xd')](_0xcd1c('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xcd1c('0x5')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xcd1c('0x5')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![],'set':function(_0x24d624){if(typeof _0x24d624===_0xcd1c('0x54')){var _0x3c75bd=_0x24d624==='1'?!![]:_0x24d624==='0'?![]:_0x24d624===_0xcd1c('0x55')?!![]:_0x24d624===_0xcd1c('0x56')?![]:![];this['setDataValue'](_0xcd1c('0x57'),_0x3c75bd);}else{this[_0xcd1c('0x6')](_0xcd1c('0x57'),_0x24d624);}}},'blocked':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![],'set':function(_0x3e524d){this[_0xcd1c('0x6')](_0xcd1c('0x58'),_0x3e524d);if(_0x3e524d===!![]){this[_0xcd1c('0x6')](_0xcd1c('0x59'),moment());this[_0xcd1c('0x6')]('loginAttempts',0x0);}else{this[_0xcd1c('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xcd1c('0x15')](0x5)[_0xcd1c('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xcd1c('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xcd1c('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 5aa3f07..ca83a4a 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 _0x071a=['internal','Setting','securePassword','validatePasswordPattern','password','max','isNil','min_internal','QueryTypes','SELECT','length','from','mailbox','VoiceMail','fullname','permissions','101','102','103','113','110','104','106','107','108','109','100','111','114','115','create','Unauthorized','user','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','userProfileId','UserProfileSection','Telephones','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','map','findAll','isEmpty','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','loginInPause','interface','Unknown\x20channel','add','toLowerCase','penalty','spread','capitalize','Queue:save','voice','online','format','voicePause','UserVoiceQueueRt','upsert','removeQueues','isValidChannel','remove','Queues','isArray','Queue:remove','addAvatar','userpic','file','filename','getAvatar','root','existsSync','server/files/images/','download','ChatOpenTabs','CHAT','createdAt','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SMS','WhatsappOpenTabs','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','List','color','tag','Queue','keys','intersection','model','fields','sort','filters','pick','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','order','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','OpenchannelInteraction','getOpenchannelInteractions','getMailInteractions','UserId','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','LOCAL/%s@from-sip/n','SIP/%s','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','remoteAddress','socket','sequelize','transaction','commit','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','bulkCreate','getChannels','forEach','LOGIN','device','PAUSE','LOGININPAUSE','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','logout','MemberReport','QueuePause','pause','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','pauseType','getTeams','Team','addTeams','getAssociatedQueues','flattenDeep','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','resolve','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','QueueId','getLists','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','FaxAccount','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','OpenchannelAccount','getOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','removeChatWebsites','getWhatsappAccounts','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','$and','$or','$gt','$gte','$lt','$lte','$ne','$not','$between','$notBetween','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','lastName','phone','CmContact','VoiceQueue','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','token','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getPresence','idle','unknown','ringing','queues','inbound','flatten','toString','lower','col','asc','desc','substring','uniqBy','getRealtimeAgents','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','select','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','messengerSoundNotification','enabled','moment','util','path','squel','ioredis','jayson/promise','../../components/auth/service','../../components/contacts','../../components/realtime/agents','../../config/utils','../../config/environment','../../config/license/util','APINotFoundError','APIForbiddenrror','../../mysqldb','./user.socket','redis','localhost','client','http','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','then','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','User,\x20%s,\x20%s','result','catch','agent','emit','destroy','get','role','admin','Users','Agents','telephone','filter','ignore','value','includes','find','name','UserProfileResource','stack','send','User','rawAttributes','type','key','salt','previousPasswords','resetPasswordToken','resetPasswordExpires','index','where','query','includeAll','include','true','UserSetting','attributes','push','openTabs','rows','chat','dataValues','sms','fax','mail','openchannel','whatsapp','show','params','getOptions','userSetting','merge','options','all','update','body','describe','addContacts','ids','omit'];(function(_0xbad509,_0x1eca2a){var _0x31ecb8=function(_0x1a84db){while(--_0x1a84db){_0xbad509['push'](_0xbad509['shift']());}};_0x31ecb8(++_0x1eca2a);}(_0x071a,0x130));var _0xa071=function(_0x50b750,_0xe5817b){_0x50b750=_0x50b750-0x0;var _0x1b60a8=_0x071a[_0x50b750];return _0x1b60a8;};'use strict';var moment=require(_0xa071('0x0'));var util=require(_0xa071('0x1'));var path=require(_0xa071('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa071('0x3'));var Redis=require(_0xa071('0x4'));var jayson=require(_0xa071('0x5'));var authService=require(_0xa071('0x6'));var contacts=require(_0xa071('0x7'));var qs=require('../../components/parsers/qs');var rta=require(_0xa071('0x8'));var logger=require('../../config/logger')('api');var utils=require(_0xa071('0x9'));var config=require(_0xa071('0xa'));var licenseUtil=require(_0xa071('0xb'));var APIBadRequestError=require('../../errors/api')['APIBadRequestError'];var APINotFoundError=require('../../errors/api')[_0xa071('0xc')];var APIForbiddenError=require('../../errors/api')[_0xa071('0xd')];var APIHandleError=require('../../errors/api')['handleError'];var db=require(_0xa071('0xe'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa071('0xf'))['register'](socket);config['redis']=_['defaults'](config[_0xa071('0x10')],{'host':_0xa071('0x11'),'port':0x18eb});var amiClient=jayson[_0xa071('0x12')][_0xa071('0x13')]({'port':0x232a});var values;function respondWithStatusCode(_0x151649,_0x52deb0){_0x52deb0=_0x52deb0||0xcc;return function(_0x2ae417){if(_0x2ae417){return _0x151649[_0xa071('0x14')](_0x52deb0);}return _0x151649[_0xa071('0x15')](_0x52deb0)[_0xa071('0x16')]();};}function respondWithResult(_0x4021c6,_0x3bc4be){_0x3bc4be=_0x3bc4be||0xc8;return function(_0x57b873){if(_0x57b873){return _0x4021c6[_0xa071('0x15')](_0x3bc4be)[_0xa071('0x17')](_0x57b873);}};}function respondWithFilteredResult(_0x11748e,_0xd34e51){return function(_0x1e1875){if(_0x1e1875){var _0x452722=typeof _0xd34e51[_0xa071('0x18')]===_0xa071('0x19')&&typeof _0xd34e51[_0xa071('0x1a')]===_0xa071('0x19');var _0x36e01b=_0x1e1875['count'];var _0x52c0b4=_0x452722?0x0:_0xd34e51[_0xa071('0x18')];var _0x2031a3=_0x452722?_0x1e1875[_0xa071('0x1b')]:_0xd34e51[_0xa071('0x18')]+_0xd34e51['limit'];var _0x18b98f;if(_0x2031a3>=_0x36e01b){_0x2031a3=_0x36e01b;_0x18b98f=0xc8;}else{_0x18b98f=0xce;}_0x11748e['status'](_0x18b98f);return _0x11748e['set'](_0xa071('0x1c'),_0x52c0b4+'-'+_0x2031a3+'/'+_0x36e01b)[_0xa071('0x17')](_0x1e1875);}return null;};}function respondWithRpcPromise(_0x1c5f11,_0x1a5aff,_0x89fa44,_0x1ea10e){return new Promise(function(_0x433dc2,_0x151463){var _0x4a58bb=_0x1ea10e||amiClient;return _0x4a58bb['request'](_0x1c5f11,_0x89fa44)[_0xa071('0x1d')](function(_0x123201){logger['info']('User,\x20%s,\x20%s',_0x1a5aff,'request\x20sent');logger[_0xa071('0x1e')](_0xa071('0x1f'),_0x1a5aff,_0xa071('0x20'),JSON[_0xa071('0x21')](_0x123201));if(_0x123201[_0xa071('0x22')]){if(_0x123201[_0xa071('0x22')][_0xa071('0x23')]===0x1f4){logger['error']('User,\x20%s,\x20%s',_0x1a5aff,_0x123201[_0xa071('0x22')][_0xa071('0x24')]);return _0x151463(_0x123201[_0xa071('0x22')][_0xa071('0x24')]);}logger['error'](_0xa071('0x25'),_0x1a5aff,_0x123201[_0xa071('0x22')][_0xa071('0x24')]);return _0x433dc2(_0x123201[_0xa071('0x22')][_0xa071('0x24')]);}else{logger['info'](_0xa071('0x25'),_0x1a5aff,_0xa071('0x20'));_0x433dc2(_0x123201[_0xa071('0x26')][_0xa071('0x24')]);}})[_0xa071('0x27')](function(_0x3a2e57){logger[_0xa071('0x22')](_0xa071('0x25'),_0x1a5aff,_0x3a2e57);_0x151463(_0x3a2e57);});});}function saveUpdates(_0x245d55){return function(_0x408c59){if(_0x408c59){return _0x408c59['update'](_0x245d55)[_0xa071('0x1d')](function(_0x4cb6fb){if(_0x4cb6fb['role']===_0xa071('0x28')){socket[_0xa071('0x29')]('userNotification:recalc:'+_0x4cb6fb['id'],_0x4cb6fb);}return _0x4cb6fb;});}return null;};}function removeEntity(_0x5d6b36,_0x33e5d4){return function(_0x3c9840){if(_0x3c9840){return _0x3c9840[_0xa071('0x2a')]({'transaction':_0x33e5d4})[_0xa071('0x1d')](function(){var _0x47c869=_0x3c9840[_0xa071('0x2b')]({'plain':!![]});if(_0x47c869[_0xa071('0x2c')]===_0xa071('0x2d'))return;var _0x2b6e1b=[{'name':_0xa071('0x2e'),'value':'user','ignore':!![]},{'name':_0xa071('0x2f'),'value':'agent','ignore':![]},{'name':'Telephones','value':_0xa071('0x30'),'ignore':![]}];var _0x157811=_(_0x2b6e1b)[_0xa071('0x31')](_0xa071('0x32'))['map'](_0xa071('0x33'))['value']();if(_[_0xa071('0x34')](_0x157811,_0x47c869['role'])){return;}var _0x101dac=_[_0xa071('0x35')](_0x2b6e1b,[_0xa071('0x33'),_0x47c869[_0xa071('0x2c')]])[_0xa071('0x36')];return db[_0xa071('0x37')][_0xa071('0x2a')]({'where':{'type':_0x101dac,'resourceId':_0x47c869['id']},'transaction':_0x33e5d4})[_0xa071('0x1d')](function(){return _0x3c9840;});})[_0xa071('0x1d')](function(){_0x5d6b36['status'](0xcc)[_0xa071('0x16')]();});}};}function handleEntityNotFound(_0x2de264){return function(_0x9a65e0){if(!_0x9a65e0){_0x2de264[_0xa071('0x14')](0x194);}return _0x9a65e0;};}function handleError(_0x47d4a5,_0x5bd1f3){_0x5bd1f3=_0x5bd1f3||0x1f4;return function(_0x1fa0be){logger[_0xa071('0x22')](_0x1fa0be[_0xa071('0x38')]);if(_0x1fa0be[_0xa071('0x36')]){delete _0x1fa0be['name'];}_0x47d4a5[_0xa071('0x15')](_0x5bd1f3)[_0xa071('0x39')](_0x1fa0be);};}function getUserAttributes(){return _(db[_0xa071('0x3a')][_0xa071('0x3b')])['map'](function(_0x2f4ffe){return{'name':_0x2f4ffe['fieldName'],'type':_0x2f4ffe[_0xa071('0x3c')][_0xa071('0x3d')]};})[_0xa071('0x31')](function(_0x20893f){return!['password',_0xa071('0x3e'),_0xa071('0x3f'),_0xa071('0x40'),_0xa071('0x41'),'md5secret'][_0xa071('0x34')](_0x20893f['name']);})[_0xa071('0x33')]();}exports[_0xa071('0x42')]=function(_0x3ca1ab,_0x445e87){var _0x4d1226={},_0x30de10={'count':0x0,'rows':[]};var _0x559536=getUserAttributes();_0x4d1226=qs['getOptions'](_0x559536,_0x3ca1ab);var _0x192da3={'where':_0x4d1226[_0xa071('0x43')]};return db[_0xa071('0x3a')][_0xa071('0x1b')](_0x192da3)['then'](function(_0xfaa76f){_0x30de10[_0xa071('0x1b')]=_0xfaa76f;if(_0x3ca1ab[_0xa071('0x44')][_0xa071('0x45')]){_0x4d1226[_0xa071('0x46')]=[{'all':!![]}];}if(_0x3ca1ab['query']['userSetting']===_0xa071('0x47')){_0x4d1226[_0xa071('0x46')]=[{'model':db[_0xa071('0x48')],'as':'userSetting'}];}if(!_['includes'](_0x4d1226['attributes'],'id')){_0x4d1226[_0xa071('0x49')][_0xa071('0x4a')]('id');}return db[_0xa071('0x3a')]['findAll'](_0x4d1226);})[_0xa071('0x1d')](function(_0x4dfda){_0x30de10['rows']=_0x4dfda;if(_0x3ca1ab[_0xa071('0x44')][_0xa071('0x4b')]==='true'){var _0x52bc35=[];for(var _0x445a00=0x0;_0x445a00<_0x30de10[_0xa071('0x4c')]['length'];_0x445a00++){_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4d'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4f'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35['push'](get_open_tabs(_0xa071('0x50'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x51'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x52'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));_0x52bc35[_0xa071('0x4a')](get_open_tabs(_0xa071('0x53'),_0x30de10['rows'][_0x445a00][_0xa071('0x4e')]));}return Promise['all'](_0x52bc35)[_0xa071('0x1d')](function(){return _0x30de10;});}else{return _0x30de10;}})[_0xa071('0x1d')](respondWithFilteredResult(_0x445e87,_0x4d1226))[_0xa071('0x27')](handleError(_0x445e87,null));};exports[_0xa071('0x54')]=function(_0x500c61,_0x4b9dc4){var _0x12b889=getUserAttributes();_0x500c61[_0xa071('0x44')]['id']=_0x500c61[_0xa071('0x55')]['id'];var _0x3209cb=qs[_0xa071('0x56')](_0x12b889,_0x500c61);if(_0x500c61[_0xa071('0x44')][_0xa071('0x45')]){_0x3209cb[_0xa071('0x46')]=[{'all':!![]}];}if(_0x500c61[_0xa071('0x44')][_0xa071('0x57')]===_0xa071('0x47')){_0x3209cb[_0xa071('0x46')]=[{'model':db[_0xa071('0x48')],'as':_0xa071('0x57')}];}_0x3209cb=_[_0xa071('0x58')]({},_0x3209cb,_0x500c61[_0xa071('0x59')]);if(!_[_0xa071('0x34')](_0x3209cb[_0xa071('0x49')],'id')){_0x3209cb[_0xa071('0x49')][_0xa071('0x4a')]('id');}return db[_0xa071('0x3a')][_0xa071('0x35')](_0x3209cb)[_0xa071('0x1d')](handleEntityNotFound(_0x4b9dc4,null))[_0xa071('0x1d')](function(_0x3b74a1){var _0x1dbfb8=[];values=_0x3b74a1;if(_0x500c61['query'][_0xa071('0x4b')]===_0xa071('0x47')){_0x1dbfb8['push'](get_open_tabs(_0xa071('0x4d'),_0x3b74a1['dataValues']));_0x1dbfb8[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4f'),_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8[_0xa071('0x4a')](get_open_tabs(_0xa071('0x52'),_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8['push'](get_open_tabs('whatsapp',_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8[_0xa071('0x4a')](get_open_tabs(_0xa071('0x50'),_0x3b74a1[_0xa071('0x4e')]));_0x1dbfb8['push'](get_open_tabs('mail',_0x3b74a1[_0xa071('0x4e')]));return Promise[_0xa071('0x5a')](_0x1dbfb8);}else{return values;}})[_0xa071('0x1d')](function(){return values;})[_0xa071('0x1d')](respondWithResult(_0x4b9dc4,null))[_0xa071('0x27')](handleError(_0x4b9dc4,null));};exports[_0xa071('0x5b')]=function(_0x3832b5,_0x41cf1e){if(_0x3832b5[_0xa071('0x5c')]['id']){delete _0x3832b5[_0xa071('0x5c')]['id'];}delete _0x3832b5[_0xa071('0x5c')][_0xa071('0x2c')];return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x3832b5[_0xa071('0x55')]['id']}})['then'](handleEntityNotFound(_0x41cf1e,null))['then'](saveUpdates(_0x3832b5[_0xa071('0x5c')],null))[_0xa071('0x1d')](respondWithResult(_0x41cf1e,null))[_0xa071('0x27')](handleError(_0x41cf1e,null));};exports[_0xa071('0x5d')]=function(_0x1f1b78,_0x386c80){return db[_0xa071('0x3a')][_0xa071('0x5d')]()[_0xa071('0x1d')](respondWithResult(_0x386c80,null))[_0xa071('0x27')](handleError(_0x386c80,null));};exports[_0xa071('0x5e')]=function(_0x3cfd15,_0x4161e1){return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x3cfd15[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x4161e1,null))[_0xa071('0x1d')](function(_0x51c179){if(_0x51c179){return _0x51c179['addContacts'](_0x3cfd15[_0xa071('0x5c')][_0xa071('0x5f')],_[_0xa071('0x60')](_0x3cfd15['body'],[_0xa071('0x5f'),'id'])||{});}})[_0xa071('0x1d')](respondWithResult(_0x4161e1,null))[_0xa071('0x27')](handleError(_0x4161e1,null));};function validateUser(_0x203fcd){return new Promise(function(_0x59273a,_0x2880ac){if(_0x203fcd[_0xa071('0x61')])return _0x59273a(_0x203fcd);return db[_0xa071('0x62')]['findById'](0x1)[_0xa071('0x1d')](function(_0x3b2b93){if(_0x3b2b93[_0xa071('0x63')])authService[_0xa071('0x64')](_0x203fcd[_0xa071('0x65')]);db[_0xa071('0x3a')][_0xa071('0x66')](_0xa071('0x61'))['then'](function(_0x2fd8ef){if(_[_0xa071('0x67')](_0x2fd8ef)){_0x203fcd[_0xa071('0x61')]=_0x3b2b93[_0xa071('0x68')]||0x1;return;}if(_['isNil'](_0x3b2b93[_0xa071('0x68')])||_0x3b2b93[_0xa071('0x68')]===_0x2fd8ef){_0x203fcd[_0xa071('0x61')]=_0x2fd8ef+0x1;return;}if(_0x3b2b93[_0xa071('0x68')]>_0x2fd8ef){_0x203fcd[_0xa071('0x61')]=_0x3b2b93['min_internal'];return;}return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db['sequelize'][_0xa071('0x69')][_0xa071('0x6a')]})[_0xa071('0x1d')](function(_0x3ce83b){if(_0x3ce83b&&_0x3ce83b[_0xa071('0x6b')]){for(var _0x205173=0x0,_0x3b3508=_0x3ce83b[_0xa071('0x6b')];_0x205173<_0x3b3508&&_[_0xa071('0x67')](_0x203fcd[_0xa071('0x61')]);_0x205173++){if(_0x3b2b93[_0xa071('0x68')]<=_0x3ce83b[_0x205173][_0xa071('0x6c')]){_0x203fcd[_0xa071('0x61')]=_0x3ce83b[_0x205173]['from'];}else if(_0x3b2b93['min_internal']>_0x3ce83b[_0x205173][_0xa071('0x6c')]&&_0x3b2b93['min_internal']<=_0x3ce83b[_0x205173]['to']){_0x203fcd[_0xa071('0x61')]=_0x3b2b93[_0xa071('0x68')];}}}if(_[_0xa071('0x67')](_0x203fcd[_0xa071('0x61')])){_0x203fcd['internal']=_0x2fd8ef+0x1;}return _0x59273a(_0x203fcd);});});})['catch'](function(_0x346248){_0x2880ac(_0x346248);});});}function updateUser(_0x299cd9){return new Promise(function(_0x3a5e64,_0x1c8773){try{if(_0x299cd9['voicemail']){_0x299cd9[_0xa071('0x6d')]=_0x299cd9['internal'];_0x299cd9[_0xa071('0x6e')]={'mailbox':_0x299cd9[_0xa071('0x61')],'password':_0x299cd9[_0xa071('0x65')],'fullname':_0x299cd9[_0xa071('0x6f')],'email':_0x299cd9['email']};}if(_0x299cd9['role']===_0xa071('0x28')){if(!_0x299cd9['permissions'])_0x299cd9[_0xa071('0x70')]=[_0xa071('0x71'),_0xa071('0x72'),_0xa071('0x73'),_0xa071('0x74'),_0xa071('0x75'),_0xa071('0x76'),'105',_0xa071('0x77'),_0xa071('0x78'),_0xa071('0x79'),_0xa071('0x7a'),_0xa071('0x7b'),_0xa071('0x7c'),_0xa071('0x7d'),_0xa071('0x7e')];}_0x3a5e64(_0x299cd9);}catch(_0x1ce5bf){_0x1c8773(_0x1ce5bf);}});}exports[_0xa071('0x7f')]=function(_0x2730a4,_0x21327c){if(_0x2730a4['user'][_0xa071('0x2c')]===_0xa071('0x28'))throw new Error(_0xa071('0x80'));if(_0x2730a4[_0xa071('0x5c')][_0xa071('0x2c')]==='user'&&_0x2730a4[_0xa071('0x81')][_0xa071('0x2c')]!==_0xa071('0x2d')){throw new Error(_0xa071('0x82'));}if(_0x2730a4[_0xa071('0x5c')][_0xa071('0x2c')]===_0xa071('0x2d')&&_0x2730a4[_0xa071('0x81')][_0xa071('0x2c')]!==_0xa071('0x2d')){throw new Error(_0xa071('0x83'));}return licenseUtil[_0xa071('0x84')]([_0x2730a4[_0xa071('0x5c')]])['then'](function(){return validateUser(_0x2730a4[_0xa071('0x5c')]);})['then'](function(_0x1eb5b1){return updateUser(_0x1eb5b1)['then'](function(_0x190ca9){if(_0x190ca9[_0xa071('0x2c')]===_0xa071('0x2d')){_0x190ca9['settingsEnabled']=_0x2730a4['user']['settingsEnabled'];delete _0x190ca9[_0xa071('0x85')];}return _0x190ca9;});})['then'](function(_0x14da39){return db['User'][_0xa071('0x7f')](_0x14da39,{'include':[{'model':db[_0xa071('0x6e')],'as':_0xa071('0x6e')}]});})[_0xa071('0x1d')](function(_0x55eda2){if(_0x2730a4[_0xa071('0x5c')][_0xa071('0x2c')]===_0xa071('0x81'))return _0x55eda2;if(_0x2730a4[_0xa071('0x81')]['role']!==_0xa071('0x81'))return _0x55eda2;return db[_0xa071('0x86')][_0xa071('0x35')]({'where':{'name':_0x55eda2[_0xa071('0x2c')]===_0xa071('0x28')?'Agents':_0xa071('0x87'),'userProfileId':_0x2730a4[_0xa071('0x81')][_0xa071('0x85')]},'raw':!![]})['then'](function(_0x57e4db){if(!_0x57e4db||_0x57e4db[_0xa071('0x88')]!=0x0)return _0x55eda2;return db['UserProfileResource']['create']({'name':_0x55eda2[_0xa071('0x36')],'resourceId':_0x55eda2['id'],'type':_0x57e4db[_0xa071('0x36')],'sectionId':_0x57e4db['id']},{})[_0xa071('0x1d')](function(){return _0x55eda2;});})[_0xa071('0x27')](function(_0x5f427e){logger['error'](_0xa071('0x89'),_0x5f427e);throw _0x5f427e;});})[_0xa071('0x1d')](respondWithResult(_0x21327c,0xc9))[_0xa071('0x27')](handleError(_0x21327c,null));};exports['bulkCreate']=function(_0x44e706,_0x23f61d){var _0x213908=_0x44e706['body'];var _0x958e3b=[];if(_0x44e706[_0xa071('0x81')][_0xa071('0x2c')]===_0xa071('0x28'))throw new Error('Unauthorized');if(_[_0xa071('0x8a')](_0x213908,[_0xa071('0x2c'),_0xa071('0x81')])&&_0x44e706[_0xa071('0x81')][_0xa071('0x2c')]!==_0xa071('0x2d')){throw new Error(_0xa071('0x82'));}if(_[_0xa071('0x8a')](_0x213908,[_0xa071('0x2c'),'admin'])&&_0x44e706[_0xa071('0x81')][_0xa071('0x2c')]!=='admin'){throw new Error(_0xa071('0x8b'));}return licenseUtil[_0xa071('0x84')](_0x213908)[_0xa071('0x1d')](function(){return validateUser(_0x213908[0x0]);})[_0xa071('0x1d')](function(){for(var _0x11baf4=0x1;_0x11baf4<_0x213908[_0xa071('0x6b')];_0x11baf4++){var _0x27a943=_0x213908[_0x11baf4-0x1][_0xa071('0x61')];if(!_0x213908[_0x11baf4][_0xa071('0x61')])_0x213908[_0x11baf4][_0xa071('0x61')]=_0x27a943+0x1;_0x958e3b[_0xa071('0x4a')](validateUser(_0x213908[_0x11baf4]));}return Promise[_0xa071('0x5a')](_0x958e3b);})[_0xa071('0x1d')](function(){_0x958e3b=[];for(var _0x1eb91f=0x0;_0x1eb91f<_0x213908[_0xa071('0x6b')];_0x1eb91f++){_0x958e3b['push'](updateUser(_0x213908[_0x1eb91f]));}return Promise['all'](_0x958e3b);})[_0xa071('0x1d')](function(){_0x958e3b=_0x213908[_0xa071('0x8c')](function(_0x5f2f82){return db[_0xa071('0x3a')][_0xa071('0x7f')](_0x5f2f82,{'include':[{'model':db['VoiceMail'],'as':_0xa071('0x6e')}]})[_0xa071('0x1d')](function(_0x8edda9){_0x5f2f82['id']=_0x8edda9['id'];return _0x5f2f82;});});return Promise[_0xa071('0x5a')](_0x958e3b);})[_0xa071('0x1d')](function(_0x30442b){if(_0x44e706[_0xa071('0x5c')][_0xa071('0x2c')]===_0xa071('0x81'))return _0x30442b;if(_0x44e706['user'][_0xa071('0x2c')]!==_0xa071('0x81'))return _0x30442b;var _0x44ed26=_[_0xa071('0x8a')](_0x30442b,function(_0x28e978){return _0x28e978['role']===_0xa071('0x28')||_0x28e978[_0xa071('0x2c')]===_0xa071('0x30');});if(!_0x44ed26)return _0x30442b;return db[_0xa071('0x86')][_0xa071('0x8d')]({'where':{'name':{'$or':[_0xa071('0x2f'),_0xa071('0x87')]},'userProfileId':_0x44e706[_0xa071('0x81')][_0xa071('0x85')]},'raw':!![]})[_0xa071('0x1d')](function(_0x2d273a){if(_[_0xa071('0x8e')](_0x2d273a)||!_[_0xa071('0x8a')](_0x2d273a,['autoAssociation',0x0]))return _0x30442b;_0x958e3b=[];var _0x2f0dcc=_(_0x2d273a)[_0xa071('0x8c')](function(_0x13f790){if(_0x13f790[_0xa071('0x88')]===0x1)return;return _0x13f790[_0xa071('0x36')]==='Agents'?_0xa071('0x28'):_0xa071('0x30');})[_0xa071('0x8f')]()['value']();for(var _0x147f28=0x0;_0x147f28<_0x30442b['length'];_0x147f28++){if(!_[_0xa071('0x34')](_0x2f0dcc,_0x30442b[_0x147f28][_0xa071('0x2c')]))return;var _0x185892=_0x30442b[_0x147f28][_0xa071('0x2c')]===_0xa071('0x28')?_0xa071('0x2f'):'Telephones';_0x958e3b[_0xa071('0x4a')](db[_0xa071('0x37')][_0xa071('0x7f')]({'name':_0x30442b[_0x147f28]['name'],'resourceId':_0x30442b[_0x147f28]['id'],'type':_0x185892,'sectionId':_[_0xa071('0x35')](_0x2d273a,[_0xa071('0x36'),_0x185892])['id']},{}));}return Promise[_0xa071('0x5a')](_0x958e3b);});})['then'](respondWithResult(_0x23f61d,0xc9))[_0xa071('0x27')](handleError(_0x23f61d,null));};exports[_0xa071('0x90')]=function(_0x468a1a,_0x2c7bf6){if(_0x468a1a[_0xa071('0x5c')]['id']){delete _0x468a1a[_0xa071('0x5c')]['id'];}return db['User'][_0xa071('0x35')]({'where':{'id':_0x468a1a[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](function(_0xcc593e){if(!_0xcc593e)return null;if(_0xcc593e['id']===_0x468a1a[_0xa071('0x81')]['id']){if(!_0x468a1a[_0xa071('0x5c')][_0xa071('0x91')]||!_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0x95'));}if(!_0xcc593e['authenticate'](_0x468a1a[_0xa071('0x5c')]['oldPassword'])){throw new db['Sequelize']['ValidationError'](_0xa071('0x96'));}if(_0x468a1a[_0xa071('0x5c')][_0xa071('0x91')]===_0x468a1a['body']['newPassword']){throw new db['Sequelize'][(_0xa071('0x94'))](_0xa071('0x97'));}}else if(_0x468a1a[_0xa071('0x81')][_0xa071('0x2c')]==='admin'){if(!_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]){throw new db[(_0xa071('0x93'))]['ValidationError'](_0xa071('0x98'));}}else if(_0x468a1a[_0xa071('0x81')][_0xa071('0x2c')]==='user'){if(!_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]){throw new db['Sequelize'][(_0xa071('0x94'))](_0xa071('0x98'));}if(_0xcc593e['role']!==_0xa071('0x28')){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0x80'));}}else{throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))]('Unauthorized');}return _0xcc593e;})[_0xa071('0x1d')](handleEntityNotFound(_0x2c7bf6,null))[_0xa071('0x1d')](function(_0x475a1a){return db[_0xa071('0x62')][_0xa071('0x99')]({'attributes':['id',_0xa071('0x63'),_0xa071('0x9a'),_0xa071('0x9b')]})[_0xa071('0x1d')](function(_0x502736){if(_0x502736[_0xa071('0x63')])authService[_0xa071('0x64')](_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')]);if(!_0x502736[_0xa071('0x9a')]||!_0x475a1a[_0xa071('0x3f')])return _0x475a1a;authService[_0xa071('0x9c')](_0x468a1a[_0xa071('0x5c')]['newPassword'],_0x475a1a[_0xa071('0x3f')],_0x502736[_0xa071('0x9b')]);return _0x475a1a;})['then'](saveUpdates({'password':_0x468a1a[_0xa071('0x5c')][_0xa071('0x92')],'passwordResetAt':_0x468a1a[_0xa071('0x81')]['id']==_0x468a1a[_0xa071('0x55')]['id']?moment():null,'previousPasswords':authService[_0xa071('0x9d')](_0x468a1a['body'][_0xa071('0x92')],_0x475a1a[_0xa071('0x3f')])},null));})[_0xa071('0x1d')](respondWithResult(_0x2c7bf6,null))[_0xa071('0x27')](handleError(_0x2c7bf6,null));};exports[_0xa071('0x9e')]=function(_0x1198db,_0x5c2f75){var _0x139491=_0x1198db['body'][_0xa071('0x9f')];return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x1198db['params']['id']},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c'),'online',_0xa071('0xa0'),'voicePause',_0xa071('0xa1')]})['then'](handleEntityNotFound(_0x5c2f75,null))[_0xa071('0x1d')](function(_0x58a4dd){if(_0x58a4dd){if(!utils['isValidChannel'](_0x139491)){throw new db['Sequelize'][(_0xa071('0x94'))](_0xa071('0xa2'));}return _0x58a4dd[_0xa071('0xa3')+_['capitalize'](_0x139491[_0xa071('0xa4')]())+'Queues'](_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')],{'penalty':_0x1198db[_0xa071('0x5c')][_0xa071('0xa5')]||0x0})[_0xa071('0xa6')](function(_0x24ff27){for(var _0x262313=0x0;_0x262313<_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')][_0xa071('0x6b')];_0x262313+=0x1){var _0x52437b={'UserId':Number(_0x1198db[_0xa071('0x55')]['id'])};_0x52437b[_[_0xa071('0xa7')](_0x139491[_0xa071('0xa4')]())+'QueueId']=Number(_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')][_0x262313]);socket[_0xa071('0x29')]('user'+_[_0xa071('0xa7')](_0x139491['toLowerCase']())+_0xa071('0xa8'),_0x52437b);}return _0x24ff27;})[_0xa071('0x1d')](function(){if(_0x139491===_0xa071('0xa9')){return db['VoiceQueue'][_0xa071('0x8d')]({'where':{'id':_0x1198db[_0xa071('0x5c')][_0xa071('0x5f')]||[]},'raw':!![],'attributes':['id',_0xa071('0x36')]});}})[_0xa071('0x1d')](function(_0x274bc){var _0x5eeed7=_0x58a4dd[_0xa071('0x2b')]({'plain':!![]});var _0x4b8b4e=[];if(_0x139491===_0xa071('0xa9')&&_0x5eeed7[_0xa071('0x2c')]===_0xa071('0x28')&&_0x5eeed7[_0xa071('0xaa')]){for(let _0x20aaa7=0x0;_0x20aaa7<_0x274bc[_0xa071('0x6b')];_0x20aaa7+=0x1){_0x4b8b4e[_0xa071('0x4a')]({'membername':_0x5eeed7[_0xa071('0x36')],'UserId':_0x5eeed7['id'],'queue_name':_0x274bc[_0x20aaa7][_0xa071('0x36')],'VoiceQueueId':_0x274bc[_0x20aaa7]['id'],'interface':_['isNil'](_0x5eeed7[_0xa071('0xa1')])?util[_0xa071('0xab')]('SIP/%s',_0x5eeed7['name']):_0x5eeed7[_0xa071('0xa1')],'paused':_0x5eeed7[_0xa071('0xac')]||![],'penalty':_0x1198db[_0xa071('0x5c')][_0xa071('0xa5')]||0x0});}return Promise['all'](_0x4b8b4e[_0xa071('0x8c')](function(_0x15286f){return db[_0xa071('0xad')][_0xa071('0xae')](_0x15286f);}));}return _0x58a4dd;});}})[_0xa071('0x1d')](respondWithStatusCode(_0x5c2f75,null))['catch'](handleError(_0x5c2f75,null));};exports[_0xa071('0xaf')]=function(_0x26d5b1,_0x545fd5){var _0x265a9a,_0x2a1e4e;return db['User'][_0xa071('0x35')]({'where':{'id':_0x26d5b1[_0xa071('0x55')]['id']},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c')]})[_0xa071('0x1d')](handleEntityNotFound(_0x545fd5,null))[_0xa071('0x1d')](function(_0x1b7709){if(_0x1b7709){_0x265a9a=_0x1b7709;if(!_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')]||!utils[_0xa071('0xb0')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')])){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0xa2'));}return _0x1b7709[_0xa071('0xb1')+_['capitalize'](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+_0xa071('0xb2')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')]);}})[_0xa071('0x1d')](function(_0x14b0a0){if(_[_0xa071('0xb3')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')])){for(var _0x5702ec=0x0;_0x5702ec<_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')][_0xa071('0x6b')];_0x5702ec+=0x1){_0x2a1e4e={'UserId':Number(_0x26d5b1[_0xa071('0x55')]['id'])};_0x2a1e4e[_[_0xa071('0xa7')](_0x26d5b1['query'][_0xa071('0x9f')][_0xa071('0xa4')]())+'QueueId']=Number(_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')][_0x5702ec]);socket[_0xa071('0x29')](_0xa071('0x81')+_[_0xa071('0xa7')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+_0xa071('0xb4'),_0x2a1e4e);}}else{_0x2a1e4e={'UserId':Number(_0x26d5b1[_0xa071('0x55')]['id'])};_0x2a1e4e[_[_0xa071('0xa7')](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+'QueueId']=Number(_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')]);socket[_0xa071('0x29')]('user'+_['capitalize'](_0x26d5b1[_0xa071('0x44')][_0xa071('0x9f')][_0xa071('0xa4')]())+_0xa071('0xb4'),_0x2a1e4e);}return _0x14b0a0;})[_0xa071('0x1d')](function(){if(_0x26d5b1[_0xa071('0x44')]['channel']===_0xa071('0xa9')){return db[_0xa071('0xad')]['destroy']({'where':{'UserId':_0x26d5b1['params']['id'],'VoiceQueueId':_0x26d5b1[_0xa071('0x44')][_0xa071('0x5f')]},'individualHooks':!![]})[_0xa071('0x1d')](function(){return _0x265a9a;});}return _0x265a9a;})[_0xa071('0x1d')](respondWithStatusCode(_0x545fd5,null))[_0xa071('0x27')](handleError(_0x545fd5,null));};exports[_0xa071('0xb5')]=function(_0x3b0e39,_0x27336f){_0x3b0e39[_0xa071('0x5c')][_0xa071('0xb6')]=_0x3b0e39[_0xa071('0xb7')][_0xa071('0xb8')];return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x3b0e39[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x27336f,null))[_0xa071('0x1d')](saveUpdates(_0x3b0e39[_0xa071('0x5c')],null))[_0xa071('0x1d')](respondWithResult(_0x27336f,null))[_0xa071('0x27')](handleError(_0x27336f,null));};exports[_0xa071('0xb9')]=function(_0x534333,_0x2245fa){var _0x18c69b=path['join'](config[_0xa071('0xba')],'server/files/images/logos/default_profile.png');return db['User'][_0xa071('0x35')]({'where':{'id':_0x534333[_0xa071('0x55')]['id']},'attributes':['id',_0xa071('0xb6')],'raw':!![]})['then'](handleEntityNotFound(_0x2245fa,null))[_0xa071('0x1d')](function(_0x2c7564){if(_0x2c7564){if(_['isNil'](_0x2c7564[_0xa071('0xb6')])){return _0x2245fa['download'](_0x18c69b);}else{if(!fs[_0xa071('0xbb')](path['join'](config[_0xa071('0xba')],_0xa071('0xbc'),_0x2c7564[_0xa071('0xb6')]))){return _0x2245fa['download'](_0x18c69b);}return _0x2245fa[_0xa071('0xbd')](path['join'](config['root'],_0xa071('0xbc'),_0x2c7564[_0xa071('0xb6')]));}}})[_0xa071('0x27')](handleError(_0x2245fa,null));};exports['getOpenTabs']=function(_0x510390,_0x14d037){return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x510390[_0xa071('0x55')]['id']},'attributes':['id']})[_0xa071('0x1d')](handleEntityNotFound(_0x14d037,null))[_0xa071('0x1d')](function(_0x115658){var _0x23c0f5=[];values=_0x115658[_0xa071('0x4e')];_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4d'),_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x4f'),_0x115658['dataValues']));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x52'),_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x53'),_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs('fax',_0x115658[_0xa071('0x4e')]));_0x23c0f5[_0xa071('0x4a')](get_open_tabs(_0xa071('0x51'),_0x115658[_0xa071('0x4e')]));return Promise[_0xa071('0x5a')](_0x23c0f5);})[_0xa071('0x1d')](function(_0x5317a4){if(_0x5317a4){var _0x4a9225=_[_0xa071('0x8c')](values[_0xa071('0xbe')],function(_0x26e93c){return{'channel':_0xa071('0xbf'),'id':_0x26e93c['id'],'createdAt':_0x26e93c['createdAt']};});var _0x2a1d77=_[_0xa071('0x8c')](values['FaxOpenTabs'],function(_0x1ff00d){return{'channel':'FAX','id':_0x1ff00d['id'],'createdAt':_0x1ff00d[_0xa071('0xc0')]};});var _0x396d7e=_[_0xa071('0x8c')](values[_0xa071('0xc1')],function(_0x23708c){return{'channel':_0xa071('0xc2'),'id':_0x23708c['id'],'createdAt':_0x23708c['createdAt']};});var _0x49cbbe=_[_0xa071('0x8c')](values[_0xa071('0xc3')],function(_0x5ab20e){return{'channel':_0xa071('0xc4'),'id':_0x5ab20e['id'],'createdAt':_0x5ab20e[_0xa071('0xc0')]};});var _0x5131b5=_[_0xa071('0x8c')](values['SmsOpenTabs'],function(_0x9fbec3){return{'channel':_0xa071('0xc5'),'id':_0x9fbec3['id'],'createdAt':_0x9fbec3[_0xa071('0xc0')]};});var _0x35365e=_[_0xa071('0x8c')](values[_0xa071('0xc6')],function(_0x45ce04){return{'channel':'WHATSAPP','id':_0x45ce04['id'],'createdAt':_0x45ce04['createdAt']};});var _0x3bcfe9=_[_0xa071('0xc7')](_0x4a9225,_0x2a1d77,_0x396d7e,_0x49cbbe,_0x5131b5,_0x35365e);var _0x531c7e={'count':_0x3bcfe9[_0xa071('0x6b')],'rows':_0x3bcfe9};return _0x531c7e;}else return null;})[_0xa071('0x1d')](respondWithResult(_0x14d037,null))[_0xa071('0x27')](handleError(_0x14d037,null));};exports[_0xa071('0xc8')]=function(_0x444a4b,_0x2a1e81){var _0xa7267b={};return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x444a4b[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](function(_0x3a26dc){if(!_0x3a26dc){throw new APINotFoundError(util[_0xa071('0xab')](_0xa071('0xc9'),_0x444a4b[_0xa071('0x55')]['id']));}return contacts[_0xa071('0x5d')]();})[_0xa071('0x1d')](function(_0x16c45d){_0x444a4b[_0xa071('0x44')][_0xa071('0x3a')]=_0x444a4b[_0xa071('0x55')]['id'];_0xa7267b=qs[_0xa071('0x56')](_0x16c45d,_0x444a4b);if(_0x444a4b['query'][_0xa071('0xca')](_0xa071('0x45'))){_0xa7267b['include']=[{'model':db[_0xa071('0xcb')],'as':_0xa071('0xcc'),'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xa071('0x36'),_0xa071('0xcd')],'where':_0x444a4b[_0xa071('0x44')][_0xa071('0xce')]?{'id':_0x444a4b[_0xa071('0x44')][_0xa071('0xce')]}:undefined,'required':_0x444a4b[_0xa071('0x44')]['tag']?!![]:![]}];}return contacts['findAll'](_0x444a4b['query'],_0x444a4b[_0xa071('0x81')],_0xa7267b,_0x16c45d);})[_0xa071('0x1d')](respondWithFilteredResult(_0x2a1e81,_0xa7267b))[_0xa071('0x27')](APIHandleError(_0x2a1e81));};exports['getQueues']=function(_0x16e0dd,_0xfe37e9){var _0x2f7921;var _0x37f058={};var _0x2cd85b;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x16e0dd[_0xa071('0x55')]['id']},'attributes':['id','name',_0xa071('0x2c')]})['then'](handleEntityNotFound(_0xfe37e9,null))['then'](function(_0x18bd32){if(!utils['isValidChannel'](_0x16e0dd['query'][_0xa071('0x9f')])){throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))]('Unknown\x20channel');}_0x2f7921=_0x18bd32;var _0x10f178={};_0x10f178['model']=_['keys'](db[_[_0xa071('0xa7')](_0x16e0dd[_0xa071('0x44')][_0xa071('0x9f')])+_0xa071('0xcf')][_0xa071('0x3b')]);_0x10f178['query']=_[_0xa071('0xd0')](_0x16e0dd[_0xa071('0x44')]);_0x10f178['filters']=_[_0xa071('0xd1')](_0x10f178[_0xa071('0xd2')],_0x10f178[_0xa071('0x44')]);_0x37f058[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x10f178['model'],qs[_0xa071('0xd3')](_0x16e0dd['query'][_0xa071('0xd3')]));_0x37f058[_0xa071('0x49')]=_0x37f058[_0xa071('0x49')][_0xa071('0x6b')]?_0x37f058['attributes']:_0x10f178[_0xa071('0xd2')];_0x37f058['order']=qs[_0xa071('0xd4')](_0x16e0dd['query'][_0xa071('0xd4')]);_0x37f058[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x16e0dd[_0xa071('0x44')],_0x10f178['filters']));if(_0x16e0dd['query'][_0xa071('0x31')]){_0x37f058[_0xa071('0x43')]=_[_0xa071('0x58')](_0x37f058[_0xa071('0x43')],{'$or':_['map'](_0x37f058[_0xa071('0x49')],function(_0x128f0f){var _0x549ad8={};_0x549ad8[_0x128f0f]={'$like':'%'+_0x16e0dd['query']['filter']+'%'};return _0x549ad8;})});}_0x37f058=_[_0xa071('0x58')]({},_0x37f058,_0x16e0dd[_0xa071('0x59')]);switch(_0x2f7921[_0xa071('0x2c')]){case _0xa071('0x2d'):return db[_['capitalize'](_0x16e0dd['query'][_0xa071('0x9f')])+'Queue'][_0xa071('0x8d')](_0x37f058);case _0xa071('0x81'):case _0xa071('0x28'):return _0x2f7921[_0xa071('0x2b')+_[_0xa071('0xa7')](_0x16e0dd['query'][_0xa071('0x9f')])+_0xa071('0xb2')](_0x37f058);default:throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0xd7'));}})[_0xa071('0x1d')](function(_0x3f5173){_0x2cd85b=_0x3f5173[_0xa071('0x6b')];if(!_0x16e0dd[_0xa071('0x44')][_0xa071('0xca')]('nolimit')){_0x37f058['limit']=qs[_0xa071('0x1a')](_0x16e0dd['query']['limit']);_0x37f058['offset']=qs['offset'](_0x16e0dd[_0xa071('0x44')]['offset']);}switch(_0x2f7921[_0xa071('0x2c')]){case _0xa071('0x2d'):return db[_[_0xa071('0xa7')](_0x16e0dd[_0xa071('0x44')]['channel'])+'Queue']['findAll'](_0x37f058);case _0xa071('0x81'):case _0xa071('0x28'):return _0x2f7921[_0xa071('0x2b')+_[_0xa071('0xa7')](_0x16e0dd['query'][_0xa071('0x9f')])+_0xa071('0xb2')](_0x37f058);}})[_0xa071('0x1d')](function(_0x2dc169){return{'count':_0x2cd85b,'rows':_0x2dc169};})[_0xa071('0x1d')](respondWithResult(_0xfe37e9,null))[_0xa071('0x27')](handleError(_0xfe37e9,null));};exports[_0xa071('0xd8')]=function(_0x282da3,_0x2c9221){var _0x48fe3a={};var _0x1a8c0d={};var _0x45cdf8;var _0xdf7bff;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x282da3[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x2c9221,null))[_0xa071('0x1d')](function(_0x107d91){if(_0x107d91){_0x45cdf8=_0x107d91;_0x1a8c0d[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xad')]['rawAttributes']);_0x1a8c0d[_0xa071('0x44')]=_['keys'](_0x282da3[_0xa071('0x44')]);_0x1a8c0d['filters']=_[_0xa071('0xd1')](_0x1a8c0d[_0xa071('0xd2')],_0x1a8c0d['query']);_0x48fe3a['attributes']=_[_0xa071('0xd1')](_0x1a8c0d[_0xa071('0xd2')],qs['fields'](_0x282da3[_0xa071('0x44')]['fields']));_0x48fe3a['attributes']=_0x48fe3a['attributes'][_0xa071('0x6b')]?_0x48fe3a[_0xa071('0x49')]:_0x1a8c0d[_0xa071('0xd2')];_0x48fe3a['order']=qs[_0xa071('0xd4')](_0x282da3[_0xa071('0x44')][_0xa071('0xd4')]);_0x48fe3a[_0xa071('0x43')]=qs['filters'](_[_0xa071('0xd6')](_0x282da3[_0xa071('0x44')],_0x1a8c0d[_0xa071('0xd5')]));if(_0x282da3[_0xa071('0x44')][_0xa071('0x31')]){_0x48fe3a[_0xa071('0x43')]=_['merge'](_0x48fe3a[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x48fe3a[_0xa071('0x49')],function(_0x310da4){var _0x168354={};_0x168354[_0x310da4]={'$like':'%'+_0x282da3[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x168354;})});}_0x48fe3a=_[_0xa071('0x58')]({},_0x48fe3a,_0x282da3['options']);return _0x45cdf8[_0xa071('0xd8')](_0x48fe3a);}})[_0xa071('0x1d')](function(_0x53216f){if(_0x53216f){_0xdf7bff=_0x53216f[_0xa071('0x6b')];if(!_0x282da3['query'][_0xa071('0xca')](_0xa071('0xd9'))){_0x48fe3a[_0xa071('0x1a')]=qs['limit'](_0x282da3['query'][_0xa071('0x1a')]);_0x48fe3a[_0xa071('0x18')]=qs['offset'](_0x282da3[_0xa071('0x44')][_0xa071('0x18')]);}return _0x45cdf8[_0xa071('0xd8')](_0x48fe3a);}})[_0xa071('0x1d')](function(_0x178f53){if(_0x178f53){return _0x178f53?{'count':_0xdf7bff,'rows':_0x178f53}:null;}})['then'](respondWithResult(_0x2c9221,null))[_0xa071('0x27')](handleError(_0x2c9221,null));};exports[_0xa071('0xda')]=function(_0x3b7c80,_0x3cdac4){var _0x53b1fe={};var _0x5ce98c={};var _0x2b8406;var _0x3d5102;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x3b7c80[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x3cdac4,null))['then'](function(_0x269056){if(_0x269056){_0x2b8406=_0x269056;_0x5ce98c[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xdb')]['rawAttributes']);_0x5ce98c[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x3b7c80[_0xa071('0x44')]);_0x5ce98c[_0xa071('0xd5')]=_['intersection'](_0x5ce98c[_0xa071('0xd2')],_0x5ce98c['query']);_0x53b1fe['attributes']=_[_0xa071('0xd1')](_0x5ce98c[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x3b7c80['query'][_0xa071('0xd3')]));_0x53b1fe[_0xa071('0x49')]=_0x53b1fe[_0xa071('0x49')][_0xa071('0x6b')]?_0x53b1fe[_0xa071('0x49')]:_0x5ce98c[_0xa071('0xd2')];_0x53b1fe['order']=qs[_0xa071('0xd4')](_0x3b7c80['query'][_0xa071('0xd4')]);_0x53b1fe[_0xa071('0x43')]=qs['filters'](_[_0xa071('0xd6')](_0x3b7c80['query'],_0x5ce98c[_0xa071('0xd5')]));if(_0x3b7c80[_0xa071('0x44')][_0xa071('0x31')]){_0x53b1fe['where']=_['merge'](_0x53b1fe[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x53b1fe[_0xa071('0x49')],function(_0x52fa54){var _0x4339d9={};_0x4339d9[_0x52fa54]={'$like':'%'+_0x3b7c80[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x4339d9;})});}_0x53b1fe=_['merge']({},_0x53b1fe,_0x3b7c80[_0xa071('0x59')]);return _0x2b8406['getGroups'](_0x53b1fe);}})[_0xa071('0x1d')](function(_0x172973){if(_0x172973){_0x3d5102=_0x172973[_0xa071('0x6b')];if(!_0x3b7c80[_0xa071('0x44')][_0xa071('0xca')](_0xa071('0xd9'))){_0x53b1fe[_0xa071('0x1a')]=qs['limit'](_0x3b7c80[_0xa071('0x44')]['limit']);_0x53b1fe['offset']=qs['offset'](_0x3b7c80[_0xa071('0x44')][_0xa071('0x18')]);}return _0x2b8406[_0xa071('0xda')](_0x53b1fe);}})['then'](function(_0x4d7cb6){if(_0x4d7cb6){return _0x4d7cb6?{'count':_0x3d5102,'rows':_0x4d7cb6}:null;}})['then'](respondWithResult(_0x3cdac4,null))[_0xa071('0x27')](handleError(_0x3cdac4,null));};exports[_0xa071('0xdc')]=function(_0x23b602,_0x3478f8){var _0x26df99={'raw':!![],'where':{}};var _0x357dda={};var _0x2245a1={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x23b602[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x3478f8,null))[_0xa071('0x1d')](function(_0xf05164){if(_0xf05164){_0x357dda['model']=_[_0xa071('0xd0')](db[_0xa071('0xdd')][_0xa071('0x3b')]);_0x357dda[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x23b602[_0xa071('0x44')]);_0x357dda['filters']=_[_0xa071('0xd1')](_0x357dda[_0xa071('0xd2')],_0x357dda[_0xa071('0x44')]);_0x26df99[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x357dda[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x23b602[_0xa071('0x44')]['fields']));_0x26df99[_0xa071('0x49')]=_0x26df99[_0xa071('0x49')][_0xa071('0x6b')]?_0x26df99['attributes']:_0x357dda[_0xa071('0xd2')];if(!_0x23b602['query']['hasOwnProperty'](_0xa071('0xd9'))){_0x26df99[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x23b602[_0xa071('0x44')][_0xa071('0x1a')]);_0x26df99[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x23b602[_0xa071('0x44')][_0xa071('0x18')]);}_0x26df99[_0xa071('0xde')]=qs['sort'](_0x23b602['query'][_0xa071('0xd4')]);_0x26df99['where']=qs['filters'](_[_0xa071('0xd6')](_0x23b602[_0xa071('0x44')],_0x357dda[_0xa071('0xd5')]));_0x26df99[_0xa071('0x43')]['UserId']=_0xf05164['id'];if(_0x23b602[_0xa071('0x44')][_0xa071('0x31')]){_0x26df99[_0xa071('0x43')]=_['merge'](_0x26df99[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x26df99[_0xa071('0x49')],function(_0x3a4b2e){var _0x381f3d={};_0x381f3d[_0x3a4b2e]={'$like':'%'+_0x23b602[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x381f3d;})});}_0x26df99=_[_0xa071('0x58')]({},_0x26df99,_0x23b602[_0xa071('0x59')]);return db['VoiceRecording']['count']({'where':_0x26df99[_0xa071('0x43')]})['then'](function(_0x4b1ad7){_0x2245a1[_0xa071('0x1b')]=_0x4b1ad7;if(_0x23b602['query'][_0xa071('0x45')]){_0x26df99['include']=[{'all':!![]}];}return db[_0xa071('0xdd')]['findAll'](_0x26df99);})[_0xa071('0x1d')](function(_0xe03510){_0x2245a1['rows']=_0xe03510;return _0x2245a1;});}})['then'](respondWithFilteredResult(_0x3478f8,_0x26df99))[_0xa071('0x27')](handleError(_0x3478f8,null));};exports[_0xa071('0xdf')]=function(_0x25b167,_0x2dcd87){var _0x55413f={'raw':!![],'where':{}};var _0x5b339f={};var _0x887bcb={'count':0x0,'rows':[]};return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x25b167[_0xa071('0x55')]['id']}})['then'](handleEntityNotFound(_0x2dcd87,null))[_0xa071('0x1d')](function(_0x571842){if(_0x571842){_0x5b339f[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xe0')]['rawAttributes']);_0x5b339f[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x25b167['query']);_0x5b339f[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x5b339f[_0xa071('0xd2')],_0x5b339f['query']);_0x55413f[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x5b339f[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x25b167[_0xa071('0x44')][_0xa071('0xd3')]));_0x55413f[_0xa071('0x49')]=_0x55413f[_0xa071('0x49')]['length']?_0x55413f[_0xa071('0x49')]:_0x5b339f[_0xa071('0xd2')];if(!_0x25b167[_0xa071('0x44')]['hasOwnProperty']('nolimit')){_0x55413f[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x25b167[_0xa071('0x44')]['limit']);_0x55413f[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x25b167['query'][_0xa071('0x18')]);}_0x55413f['order']=qs['sort'](_0x25b167[_0xa071('0x44')][_0xa071('0xd4')]);_0x55413f[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x25b167[_0xa071('0x44')],_0x5b339f[_0xa071('0xd5')]));_0x55413f[_0xa071('0x43')]['UserId']=_0x571842['id'];if(_0x25b167[_0xa071('0x44')][_0xa071('0x31')]){_0x55413f[_0xa071('0x43')]=_['merge'](_0x55413f[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x55413f[_0xa071('0x49')],function(_0x59d871){var _0x162ddd={};_0x162ddd[_0x59d871]={'$like':'%'+_0x25b167[_0xa071('0x44')]['filter']+'%'};return _0x162ddd;})});}_0x55413f=_[_0xa071('0x58')]({},_0x55413f,_0x25b167[_0xa071('0x59')]);return db[_0xa071('0xe0')][_0xa071('0x1b')]({'where':_0x55413f[_0xa071('0x43')]})[_0xa071('0x1d')](function(_0xef6adc){_0x887bcb[_0xa071('0x1b')]=_0xef6adc;if(_0x25b167[_0xa071('0x44')][_0xa071('0x45')]){_0x55413f[_0xa071('0x46')]=[{'all':!![]}];}return db[_0xa071('0xe0')][_0xa071('0x8d')](_0x55413f);})['then'](function(_0x29796d){_0x887bcb[_0xa071('0x4c')]=_0x29796d;return _0x887bcb;});}})['then'](respondWithFilteredResult(_0x2dcd87,_0x55413f))[_0xa071('0x27')](handleError(_0x2dcd87,null));};exports[_0xa071('0xe1')]=function(_0xee433b,_0x140209){var _0x139237={};var _0x3b8edf={};var _0x4bbb31;var _0x4b1605;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0xee433b['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x140209,null))[_0xa071('0x1d')](function(_0x26ae89){if(_0x26ae89){_0x4bbb31=_0x26ae89;_0x3b8edf['model']=_[_0xa071('0xd0')](db[_0xa071('0xe2')][_0xa071('0x3b')]);_0x3b8edf[_0xa071('0x44')]=_[_0xa071('0xd0')](_0xee433b[_0xa071('0x44')]);_0x3b8edf[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x3b8edf[_0xa071('0xd2')],_0x3b8edf[_0xa071('0x44')]);_0x139237[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x3b8edf[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0xee433b[_0xa071('0x44')][_0xa071('0xd3')]));_0x139237[_0xa071('0x49')]=_0x139237[_0xa071('0x49')][_0xa071('0x6b')]?_0x139237[_0xa071('0x49')]:_0x3b8edf[_0xa071('0xd2')];_0x139237[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0xee433b[_0xa071('0x44')][_0xa071('0xd4')]);_0x139237['where']=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0xee433b['query'],_0x3b8edf['filters']));if(_0xee433b[_0xa071('0x44')][_0xa071('0x31')]){_0x139237[_0xa071('0x43')]=_['merge'](_0x139237['where'],{'$or':_[_0xa071('0x8c')](_0x139237[_0xa071('0x49')],function(_0x8415e){var _0x56cc32={};_0x56cc32[_0x8415e]={'$like':'%'+_0xee433b[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x56cc32;})});}_0x139237=_[_0xa071('0x58')]({},_0x139237,_0xee433b[_0xa071('0x59')]);return _0x4bbb31[_0xa071('0xe1')](_0x139237);}})[_0xa071('0x1d')](function(_0x47010e){if(_0x47010e){_0x4b1605=_0x47010e[_0xa071('0x6b')];if(!_0xee433b[_0xa071('0x44')][_0xa071('0xca')](_0xa071('0xd9'))){_0x139237['limit']=qs[_0xa071('0x1a')](_0xee433b['query'][_0xa071('0x1a')]);_0x139237[_0xa071('0x18')]=qs['offset'](_0xee433b[_0xa071('0x44')][_0xa071('0x18')]);}return _0x4bbb31[_0xa071('0xe1')](_0x139237);}})['then'](function(_0x42fcf9){if(_0x42fcf9){return _0x42fcf9?{'count':_0x4b1605,'rows':_0x42fcf9}:null;}})[_0xa071('0x1d')](respondWithResult(_0x140209,null))[_0xa071('0x27')](handleError(_0x140209,null));};exports['getOpenchannelInteractions']=function(_0x17e31,_0x2814db){var _0x50141b={};var _0x560918={};var _0xf149ad;var _0x4321a1;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x17e31[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x2814db,null))[_0xa071('0x1d')](function(_0xee2dc6){if(_0xee2dc6){_0xf149ad=_0xee2dc6;_0x560918[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xe3')]['rawAttributes']);_0x560918[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x17e31[_0xa071('0x44')]);_0x560918['filters']=_[_0xa071('0xd1')](_0x560918[_0xa071('0xd2')],_0x560918[_0xa071('0x44')]);_0x50141b[_0xa071('0x49')]=_['intersection'](_0x560918[_0xa071('0xd2')],qs['fields'](_0x17e31[_0xa071('0x44')]['fields']));_0x50141b['attributes']=_0x50141b[_0xa071('0x49')]['length']?_0x50141b[_0xa071('0x49')]:_0x560918[_0xa071('0xd2')];_0x50141b[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x17e31[_0xa071('0x44')][_0xa071('0xd4')]);_0x50141b[_0xa071('0x43')]=qs[_0xa071('0xd5')](_['pick'](_0x17e31['query'],_0x560918['filters']));if(_0x17e31['query'][_0xa071('0x31')]){_0x50141b['where']=_[_0xa071('0x58')](_0x50141b[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x50141b[_0xa071('0x49')],function(_0x1bf357){var _0x1d8513={};_0x1d8513[_0x1bf357]={'$like':'%'+_0x17e31[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x1d8513;})});}_0x50141b=_[_0xa071('0x58')]({},_0x50141b,_0x17e31[_0xa071('0x59')]);return _0xf149ad[_0xa071('0xe4')](_0x50141b);}})[_0xa071('0x1d')](function(_0x1c3996){if(_0x1c3996){_0x4321a1=_0x1c3996[_0xa071('0x6b')];if(!_0x17e31[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x50141b[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x17e31[_0xa071('0x44')][_0xa071('0x1a')]);_0x50141b[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x17e31[_0xa071('0x44')]['offset']);}return _0xf149ad['getOpenchannelInteractions'](_0x50141b);}})[_0xa071('0x1d')](function(_0x16a244){if(_0x16a244){return _0x16a244?{'count':_0x4321a1,'rows':_0x16a244}:null;}})[_0xa071('0x1d')](respondWithResult(_0x2814db,null))[_0xa071('0x27')](handleError(_0x2814db,null));};exports[_0xa071('0xe5')]=function(_0x492650,_0x5b204d){var _0x5a13a4={'raw':!![],'where':{}};var _0x19e7f2={};var _0x3fe224={'count':0x0,'rows':[]};return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x492650[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x5b204d,null))[_0xa071('0x1d')](function(_0x2cd708){if(_0x2cd708){_0x19e7f2['model']=_[_0xa071('0xd0')](db['MailInteraction'][_0xa071('0x3b')]);_0x19e7f2[_0xa071('0x44')]=_['keys'](_0x492650['query']);_0x19e7f2[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x19e7f2[_0xa071('0xd2')],_0x19e7f2['query']);_0x5a13a4[_0xa071('0x49')]=_['intersection'](_0x19e7f2[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x492650[_0xa071('0x44')][_0xa071('0xd3')]));_0x5a13a4[_0xa071('0x49')]=_0x5a13a4[_0xa071('0x49')][_0xa071('0x6b')]?_0x5a13a4[_0xa071('0x49')]:_0x19e7f2[_0xa071('0xd2')];if(!_0x492650[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x5a13a4[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x492650[_0xa071('0x44')][_0xa071('0x1a')]);_0x5a13a4[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x492650[_0xa071('0x44')][_0xa071('0x18')]);}_0x5a13a4[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x492650[_0xa071('0x44')][_0xa071('0xd4')]);_0x5a13a4[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x492650[_0xa071('0x44')],_0x19e7f2[_0xa071('0xd5')]));_0x5a13a4[_0xa071('0x43')][_0xa071('0xe6')]=_0x2cd708['id'];if(_0x492650['query'][_0xa071('0x31')]){_0x5a13a4[_0xa071('0x43')]=_[_0xa071('0x58')](_0x5a13a4[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x5a13a4[_0xa071('0x49')],function(_0x5f545d){var _0x524006={};_0x524006[_0x5f545d]={'$like':'%'+_0x492650['query'][_0xa071('0x31')]+'%'};return _0x524006;})});}_0x5a13a4=_[_0xa071('0x58')]({},_0x5a13a4,_0x492650[_0xa071('0x59')]);return db['MailInteraction']['count']({'where':_0x5a13a4[_0xa071('0x43')]})['then'](function(_0x3dfa7a){_0x3fe224[_0xa071('0x1b')]=_0x3dfa7a;if(_0x492650[_0xa071('0x44')]['includeAll']){_0x5a13a4[_0xa071('0x46')]=[{'all':!![]}];}return db[_0xa071('0xe7')]['findAll'](_0x5a13a4);})[_0xa071('0x1d')](function(_0x456865){_0x3fe224[_0xa071('0x4c')]=_0x456865;return _0x3fe224;});}})[_0xa071('0x1d')](respondWithFilteredResult(_0x5b204d,_0x5a13a4))[_0xa071('0x27')](handleError(_0x5b204d,null));};exports[_0xa071('0xe8')]=function(_0x4e2c77,_0x1a91b3){var _0x576812={};var _0x14784f={};var _0x3cc9cc;var _0x518bf3;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x4e2c77['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x1a91b3,null))[_0xa071('0x1d')](function(_0x9fba3){if(_0x9fba3){_0x3cc9cc=_0x9fba3;_0x14784f[_0xa071('0xd2')]=_['keys'](db[_0xa071('0xe9')][_0xa071('0x3b')]);_0x14784f[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x4e2c77['query']);_0x14784f[_0xa071('0xd5')]=_['intersection'](_0x14784f['model'],_0x14784f[_0xa071('0x44')]);_0x576812['attributes']=_[_0xa071('0xd1')](_0x14784f['model'],qs[_0xa071('0xd3')](_0x4e2c77[_0xa071('0x44')]['fields']));_0x576812['attributes']=_0x576812[_0xa071('0x49')][_0xa071('0x6b')]?_0x576812['attributes']:_0x14784f[_0xa071('0xd2')];_0x576812[_0xa071('0xde')]=qs['sort'](_0x4e2c77[_0xa071('0x44')]['sort']);_0x576812[_0xa071('0x43')]=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x4e2c77[_0xa071('0x44')],_0x14784f[_0xa071('0xd5')]));if(_0x4e2c77[_0xa071('0x44')]['filter']){_0x576812[_0xa071('0x43')]=_[_0xa071('0x58')](_0x576812[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x576812[_0xa071('0x49')],function(_0xa0fa5){var _0x2d1aff={};_0x2d1aff[_0xa0fa5]={'$like':'%'+_0x4e2c77[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x2d1aff;})});}_0x576812=_['merge']({},_0x576812,_0x4e2c77[_0xa071('0x59')]);return _0x3cc9cc[_0xa071('0xe8')](_0x576812);}})[_0xa071('0x1d')](function(_0x439878){if(_0x439878){_0x518bf3=_0x439878[_0xa071('0x6b')];if(!_0x4e2c77[_0xa071('0x44')][_0xa071('0xca')]('nolimit')){_0x576812[_0xa071('0x1a')]=qs['limit'](_0x4e2c77[_0xa071('0x44')][_0xa071('0x1a')]);_0x576812[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x4e2c77[_0xa071('0x44')][_0xa071('0x18')]);}return _0x3cc9cc['getSmsInteractions'](_0x576812);}})[_0xa071('0x1d')](function(_0x1a07f0){if(_0x1a07f0){return _0x1a07f0?{'count':_0x518bf3,'rows':_0x1a07f0}:null;}})[_0xa071('0x1d')](respondWithResult(_0x1a91b3,null))[_0xa071('0x27')](handleError(_0x1a91b3,null));};exports[_0xa071('0xea')]=function(_0x19e329,_0x19fb31){var _0xa8cb2c={};var _0x473b2e={};var _0x54ca1c;var _0x4c3c99;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x19e329['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x19fb31,null))['then'](function(_0x1d5dff){if(_0x1d5dff){_0x54ca1c=_0x1d5dff;_0x473b2e[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xeb')][_0xa071('0x3b')]);_0x473b2e['query']=_[_0xa071('0xd0')](_0x19e329[_0xa071('0x44')]);_0x473b2e['filters']=_[_0xa071('0xd1')](_0x473b2e[_0xa071('0xd2')],_0x473b2e[_0xa071('0x44')]);_0xa8cb2c[_0xa071('0x49')]=_['intersection'](_0x473b2e[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0x19e329['query'][_0xa071('0xd3')]));_0xa8cb2c[_0xa071('0x49')]=_0xa8cb2c[_0xa071('0x49')][_0xa071('0x6b')]?_0xa8cb2c[_0xa071('0x49')]:_0x473b2e['model'];_0xa8cb2c['order']=qs[_0xa071('0xd4')](_0x19e329[_0xa071('0x44')]['sort']);_0xa8cb2c['where']=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x19e329['query'],_0x473b2e[_0xa071('0xd5')]));if(_0x19e329['query'][_0xa071('0x31')]){_0xa8cb2c[_0xa071('0x43')]=_['merge'](_0xa8cb2c['where'],{'$or':_['map'](_0xa8cb2c['attributes'],function(_0x4836fa){var _0x5280eb={};_0x5280eb[_0x4836fa]={'$like':'%'+_0x19e329[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x5280eb;})});}_0xa8cb2c=_[_0xa071('0x58')]({},_0xa8cb2c,_0x19e329['options']);return _0x54ca1c[_0xa071('0xea')](_0xa8cb2c);}})[_0xa071('0x1d')](function(_0x275b78){if(_0x275b78){_0x4c3c99=_0x275b78[_0xa071('0x6b')];if(!_0x19e329[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0xa8cb2c[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0x19e329[_0xa071('0x44')][_0xa071('0x1a')]);_0xa8cb2c[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x19e329['query'][_0xa071('0x18')]);}return _0x54ca1c[_0xa071('0xea')](_0xa8cb2c);}})[_0xa071('0x1d')](function(_0x2721a5){if(_0x2721a5){return _0x2721a5?{'count':_0x4c3c99,'rows':_0x2721a5}:null;}})[_0xa071('0x1d')](respondWithResult(_0x19fb31,null))['catch'](handleError(_0x19fb31,null));};exports[_0xa071('0xec')]=function(_0x58c283,_0x4a567a){var _0x231425={};var _0x5cd777={};var _0x44f40d;var _0x43abd1;return db['User'][_0xa071('0x99')]({'where':{'id':_0x58c283[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x4a567a,null))[_0xa071('0x1d')](function(_0x587c31){if(_0x587c31){_0x44f40d=_0x587c31;_0x5cd777[_0xa071('0xd2')]=_[_0xa071('0xd0')](db[_0xa071('0xed')][_0xa071('0x3b')]);_0x5cd777[_0xa071('0x44')]=_['keys'](_0x58c283[_0xa071('0x44')]);_0x5cd777[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x5cd777[_0xa071('0xd2')],_0x5cd777[_0xa071('0x44')]);_0x231425[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x5cd777['model'],qs['fields'](_0x58c283[_0xa071('0x44')][_0xa071('0xd3')]));_0x231425[_0xa071('0x49')]=_0x231425[_0xa071('0x49')][_0xa071('0x6b')]?_0x231425['attributes']:_0x5cd777[_0xa071('0xd2')];_0x231425[_0xa071('0xde')]=qs['sort'](_0x58c283['query'][_0xa071('0xd4')]);_0x231425['where']=qs[_0xa071('0xd5')](_[_0xa071('0xd6')](_0x58c283[_0xa071('0x44')],_0x5cd777[_0xa071('0xd5')]));if(_0x58c283[_0xa071('0x44')][_0xa071('0x31')]){_0x231425['where']=_[_0xa071('0x58')](_0x231425['where'],{'$or':_[_0xa071('0x8c')](_0x231425[_0xa071('0x49')],function(_0x25422f){var _0x1c15a5={};_0x1c15a5[_0x25422f]={'$like':'%'+_0x58c283[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x1c15a5;})});}_0x231425=_['merge']({},_0x231425,_0x58c283['options']);return _0x44f40d[_0xa071('0xec')](_0x231425);}})[_0xa071('0x1d')](function(_0x20ac14){if(_0x20ac14){_0x43abd1=_0x20ac14['length'];if(!_0x58c283[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x231425['limit']=qs[_0xa071('0x1a')](_0x58c283[_0xa071('0x44')]['limit']);_0x231425[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x58c283[_0xa071('0x44')][_0xa071('0x18')]);}return _0x44f40d[_0xa071('0xec')](_0x231425);}})['then'](function(_0x2bfc00){if(_0x2bfc00){return _0x2bfc00?{'count':_0x43abd1,'rows':_0x2bfc00}:null;}})[_0xa071('0x1d')](respondWithResult(_0x4a567a,null))['catch'](handleError(_0x4a567a,null));};exports[_0xa071('0xee')]=function(_0x2664e2,_0x2ed8ae,_0x5cb6e0){var _0x506d87;var _0x4a63de;var _0x381835;var _0x241d70=!_[_0xa071('0x67')](_0x2664e2['params']['id'])?_0x2664e2['params']['id']:!_['isNil'](_0x2664e2[_0xa071('0x81')]['id'])?_0x2664e2[_0xa071('0x81')]['id']:null;return db['User'][_0xa071('0x35')]({'where':{'id':_0x241d70,'role':{'$or':[_0xa071('0x2d'),_0xa071('0x81'),'agent']}},'attributes':['id',_0xa071('0x36'),'phone',_0xa071('0xef'),_0xa071('0x2c'),_0xa071('0x61'),_0xa071('0xa0')]})['then'](function(_0x3129bf){if(_0x3129bf){if(_0x3129bf['role']===_0xa071('0x28')){_0x506d87=_0x3129bf;if(_0x2664e2[_0xa071('0x5c')][_0xa071('0xa1')]){_0x381835=util[_0xa071('0xab')](_0xa071('0xf0'),_0x506d87[_0x2664e2['body'][_0xa071('0xa1')]]);}else if(_0x2664e2[_0xa071('0x5c')]['intrf']){_0x381835=util[_0xa071('0xab')](_0xa071('0xf1'),_0x2664e2['body'][_0xa071('0xf2')]);}else{_0x381835=util[_0xa071('0xab')]('SIP/%s',_0x506d87[_0xa071('0x36')]);}socket['to'](util['format'](_0xa071('0xf3'),_0x506d87[_0xa071('0x36')]))[_0xa071('0x29')](_0xa071('0xf4'),{'user':{'id':_0x506d87['id'],'name':_0x506d87['name']},'ip':_0x2664e2[_0xa071('0xf5')][_0xa071('0xf6')]||_0x2664e2[_0xa071('0xf7')][_0xa071('0xf8')]||_0x2664e2[_0xa071('0xf9')][_0xa071('0xf8')]||_0x2664e2[_0xa071('0xf7')][_0xa071('0xf9')][_0xa071('0xf8')]});return new Promise(function(_0x4ca9d7,_0x307840){db[_0xa071('0xfa')][_0xa071('0xfb')]()[_0xa071('0x1d')](_0x3d4c06=>{db[_0xa071('0xad')][_0xa071('0x2a')]({'where':{'membername':_0x506d87['name']},'individualHooks':!![]},{'transaction':_0x3d4c06})[_0xa071('0x1d')](function(){return _0x3d4c06[_0xa071('0xfc')]();})['then'](_0x4ca9d7)[_0xa071('0x27')](_0x307840);});});}}else{throw new db[(_0xa071('0x93'))][(_0xa071('0x94'))](_0xa071('0xfd'));}})[_0xa071('0x1d')](function(){if(_0x506d87){return _0x506d87[_0xa071('0xfe')]({'raw':!![]});}})['then'](function(_0x595493){if(_0x506d87){if(_0x595493){_0x4a63de=_0x595493;if(_0x4a63de[_0xa071('0x6b')]){var _0x3f371e=_0x4a63de[_0xa071('0x8c')](function(_0x240817){return{'membername':_0x506d87[_0xa071('0x36')],'UserId':_0x506d87['id'],'queue_name':_0x240817[_0xa071('0x36')],'VoiceQueueId':_0x240817['id'],'interface':_0x381835,'paused':_0x506d87[_0xa071('0xa0')]||![],'penalty':_0x240817[_0xa071('0xff')]||0x0};});return db[_0xa071('0xad')][_0xa071('0x100')](_0x3f371e);}}}})[_0xa071('0x1d')](function(){if(_0x506d87){return db['MemberReport'][_0xa071('0x8d')]({'where':{'membername':_0x506d87[_0xa071('0x36')],'exitAt':null}});}})['then'](function(_0x304a24){if(_0x506d87){var _0x5ca310=[];_0x304a24['forEach'](function(_0x2c8bd9){_0x5ca310[_0xa071('0x4a')](_0x2c8bd9[_0xa071('0x5b')]({'exitAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x5ca310);}})[_0xa071('0x1d')](function(){if(_0x506d87){var _0x309b18=[];var _0x2190ca=[];var _0x2320bb=utils[_0xa071('0x101')]();var _0x31cd98={'membername':_0x506d87[_0xa071('0x36')],'interface':_0x381835,'enterAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x506d87[_0xa071('0x2c')],'internal':_0x506d87[_0xa071('0x61')]};_0x2320bb[_0xa071('0x102')](function(_0x1aba9d){_0x309b18[_0xa071('0x4a')](_[_0xa071('0x58')]({'channel':_0x1aba9d,'type':_0xa071('0x103'),'data1':_0x2664e2[_0xa071('0x5c')][_0xa071('0x104')],'data2':_0x381835},_0x31cd98));if(_0x506d87[_0xa071('0xa0')]){_0x2190ca[_0xa071('0x4a')](_[_0xa071('0x58')]({'channel':_0x1aba9d,'type':_0xa071('0x105'),'data1':_0xa071('0x106')},_0x31cd98));}});return db['MemberReport'][_0xa071('0x100')](_0x309b18[_0xa071('0xc7')](_0x2190ca),{'individualHooks':!![]});}})['then'](function(){if(_0x506d87){return _0x506d87[_0xa071('0x5b')]({'online':!![],'lastLoginAt':moment()['format'](_0xa071('0x107')),'voicePause':_0x506d87['loginInPause']||![],'mailPause':_0x506d87[_0xa071('0xa0')]||![],'chatPause':_0x506d87[_0xa071('0xa0')]||![],'faxPause':_0x506d87[_0xa071('0xa0')]||![],'smsPause':_0x506d87[_0xa071('0xa0')]||![],'openchannelPause':_0x506d87[_0xa071('0xa0')]||![],'whatsappPause':_0x506d87[_0xa071('0xa0')]||![],'pauseType':_0x506d87[_0xa071('0xa0')]?_0xa071('0x106'):null,'interface':_0x381835,'lastPauseAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xa071('0x1d')](function(_0x481b9a){if(_0x2664e2[_0xa071('0x108')]){return _0x5cb6e0();}else{return Promise['resolve'](_0x481b9a)[_0xa071('0x1d')](respondWithResult(_0x2ed8ae,null));}})[_0xa071('0x27')](handleError(_0x2ed8ae,null));};exports[_0xa071('0x109')]=function(_0x353f72,_0x410c2a){var _0x5b49f5;return db[_0xa071('0x3a')][_0xa071('0x35')]({'where':{'id':_0x353f72[_0xa071('0x55')]['id'],'role':_0xa071('0x28')},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c')]})[_0xa071('0x1d')](handleEntityNotFound(_0x410c2a,null))[_0xa071('0x1d')](function(_0x8c9e8d){if(_0x8c9e8d){_0x5b49f5=_0x8c9e8d;return db[_0xa071('0xad')][_0xa071('0x2a')]({'where':{'membername':_0x5b49f5[_0xa071('0x36')]},'individualHooks':!![]});}})[_0xa071('0x1d')](function(){return db[_0xa071('0x10a')][_0xa071('0x8d')]({'where':{'membername':_0x5b49f5['name'],'exitAt':null}});})[_0xa071('0x1d')](function(_0x5de4e6){var _0x5cfd3c=[];_0x5de4e6[_0xa071('0x102')](function(_0x133133){_0x5cfd3c[_0xa071('0x4a')](_0x133133[_0xa071('0x5b')]({'exitAt':moment()[_0xa071('0xab')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xa071('0x5a')](_0x5cfd3c);})['then'](function(){return _0x5b49f5['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa071('0x1d')](respondWithResult(_0x410c2a,null))[_0xa071('0x27')](handleError(_0x410c2a,null));};exports['pause']=function(_0x37b479,_0x817010){var _0x51ebff;return db[_0xa071('0xad')][_0xa071('0x5b')]({'paused':0x1},{'where':{'UserId':_0x37b479['params']['id']},'individualHooks':!![]})[_0xa071('0x1d')](function(){return db['User'][_0xa071('0x35')]({'where':{'id':_0x37b479[_0xa071('0x55')]['id'],'role':'agent'},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c'),_0xa071('0x61'),_0xa071('0xa1'),'online']});})[_0xa071('0x1d')](handleEntityNotFound(_0x817010,null))[_0xa071('0x1d')](function(_0x43cd7f){if(_0x43cd7f){_0x51ebff=_0x43cd7f;return respondWithRpcPromise(_0xa071('0x10b'),_0xa071('0x10c'),{'id':_0x51ebff['id'],'name':_0x51ebff[_0xa071('0x36')],'pause':!![]});}})[_0xa071('0x1d')](function(){if(_0x51ebff){return db[_0xa071('0x10a')]['findAll']({'where':{'membername':_0x51ebff['name'],'type':_0xa071('0x105'),'exitAt':null}});}})['then'](function(_0x553056){if(_0x553056['length']){var _0x4d137d=moment()[_0xa071('0xab')](_0xa071('0x107'));for(var _0x29f5ee=0x0,_0x4363c8=_0x553056[_0xa071('0x6b')];_0x29f5ee<_0x4363c8;_0x29f5ee++){_0x553056[_0x29f5ee]['updateAttributes']({'exitAt':_0x4d137d});}}})[_0xa071('0x1d')](function(){var _0x450820=[];var _0x2be67e=utils[_0xa071('0x101')]();_0x2be67e[_0xa071('0x102')](function(_0xafba0f){_0x450820[_0xa071('0x4a')]({'channel':_0xafba0f,'membername':_0x51ebff[_0xa071('0x36')],'interface':_[_0xa071('0x67')](_0x51ebff['interface'])?util['format'](_0xa071('0xf1'),_0x51ebff[_0xa071('0x36')]):_0x51ebff['interface'],'type':_0xa071('0x105'),'enterAt':moment()['format'](_0xa071('0x107')),'data1':_0x37b479[_0xa071('0x5c')][_0xa071('0x3c')]||_0xa071('0x10d'),'role':_0x51ebff[_0xa071('0x2c')],'internal':_0x51ebff[_0xa071('0x61')]});});return db[_0xa071('0x10a')][_0xa071('0x100')](_0x450820,{'individualHooks':!![]});})[_0xa071('0x1d')](function(){return _0x51ebff[_0xa071('0x5b')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x37b479['body'][_0xa071('0x3c')]||_0xa071('0x10d'),'lastPauseAt':moment()[_0xa071('0xab')](_0xa071('0x107'))});})['then'](respondWithResult(_0x817010,null))['catch'](handleError(_0x817010,null));};exports[_0xa071('0x10e')]=function(_0x7ed9cd,_0x25f143){if(_0x7ed9cd[_0xa071('0x5c')][_0xa071('0x9f')]&&!utils['isValidChannel'](_0x7ed9cd[_0xa071('0x5c')][_0xa071('0x9f')])){throw new APIBadRequestError(util[_0xa071('0xab')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x7ed9cd[_0xa071('0x5c')][_0xa071('0x9f')]));}return db['User'][_0xa071('0x35')]({'where':{'id':_0x7ed9cd[_0xa071('0x55')]['id']},'attributes':['id',_0xa071('0x36'),_0xa071('0x2c'),_0xa071('0x61'),'interface',_0xa071('0xaa'),'voicePause',_0xa071('0x10f'),_0xa071('0x110'),_0xa071('0x111'),_0xa071('0x112'),_0xa071('0x113'),'whatsappPause',_0xa071('0x114'),'lastPauseAt']})[_0xa071('0x1d')](function(_0x2aad1e){if(!_0x2aad1e){throw new APINotFoundError(util[_0xa071('0xab')](_0xa071('0xc9'),_0x7ed9cd[_0xa071('0x55')]['id']));}return _0x2aad1e['unpause'](_0x7ed9cd['body'][_0xa071('0x9f')]);})[_0xa071('0x1d')](respondWithResult(_0x25f143,null))['catch'](APIHandleError(_0x25f143));};exports[_0xa071('0x115')]=function(_0xfd7dcf,_0x1fcd1a){var _0x1f4602={};var _0x125842={};var _0x55ad15;var _0x44d55a;return db['User'][_0xa071('0x99')]({'where':{'id':_0xfd7dcf[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x1fcd1a,null))[_0xa071('0x1d')](function(_0x139069){if(_0x139069){_0x55ad15=_0x139069;_0x125842['model']=_['keys'](db[_0xa071('0x116')]['rawAttributes']);_0x125842[_0xa071('0x44')]=_[_0xa071('0xd0')](_0xfd7dcf[_0xa071('0x44')]);_0x125842[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x125842[_0xa071('0xd2')],_0x125842[_0xa071('0x44')]);_0x1f4602['attributes']=_[_0xa071('0xd1')](_0x125842[_0xa071('0xd2')],qs[_0xa071('0xd3')](_0xfd7dcf['query'][_0xa071('0xd3')]));_0x1f4602[_0xa071('0x49')]=_0x1f4602[_0xa071('0x49')][_0xa071('0x6b')]?_0x1f4602[_0xa071('0x49')]:_0x125842[_0xa071('0xd2')];_0x1f4602['order']=qs[_0xa071('0xd4')](_0xfd7dcf['query']['sort']);_0x1f4602[_0xa071('0x43')]=qs['filters'](_[_0xa071('0xd6')](_0xfd7dcf['query'],_0x125842[_0xa071('0xd5')]));if(_0xfd7dcf[_0xa071('0x44')][_0xa071('0x31')]){_0x1f4602['where']=_[_0xa071('0x58')](_0x1f4602[_0xa071('0x43')],{'$or':_[_0xa071('0x8c')](_0x1f4602[_0xa071('0x49')],function(_0xc48b69){var _0x3c40d5={};_0x3c40d5[_0xc48b69]={'$like':'%'+_0xfd7dcf[_0xa071('0x44')]['filter']+'%'};return _0x3c40d5;})});}_0x1f4602=_['merge']({},_0x1f4602,_0xfd7dcf[_0xa071('0x59')]);return _0x55ad15[_0xa071('0x115')](_0x1f4602);}})[_0xa071('0x1d')](function(_0x300f3b){if(_0x300f3b){_0x44d55a=_0x300f3b[_0xa071('0x6b')];if(!_0xfd7dcf[_0xa071('0x44')]['hasOwnProperty'](_0xa071('0xd9'))){_0x1f4602[_0xa071('0x1a')]=qs[_0xa071('0x1a')](_0xfd7dcf['query'][_0xa071('0x1a')]);_0x1f4602[_0xa071('0x18')]=qs[_0xa071('0x18')](_0xfd7dcf[_0xa071('0x44')]['offset']);}return _0x55ad15[_0xa071('0x115')](_0x1f4602);}})['then'](function(_0x4ab971){if(_0x4ab971){return _0x4ab971?{'count':_0x44d55a,'rows':_0x4ab971}:null;}})[_0xa071('0x1d')](respondWithResult(_0x1fcd1a,null))[_0xa071('0x27')](handleError(_0x1fcd1a,null));};exports['addTeams']=function(_0x73df80,_0x397af7){var _0x5430b3=_0x73df80[_0xa071('0x55')]['id'];var _0x5e2fb5=_0x73df80[_0xa071('0x5c')]?_0x73df80[_0xa071('0x5c')][_0xa071('0x5f')]:null;var _0x828212=[];return Promise['resolve']()[_0xa071('0x1d')](function(){if(!_0x5e2fb5)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})['then'](function(){return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x5430b3}});})[_0xa071('0x1d')](function(_0xd3961d){if(!_0xd3961d)throw new APINotFoundError(util[_0xa071('0xab')](_0xa071('0xc9'),_0x73df80[_0xa071('0x55')]['id']));return db['sequelize']['transaction'](function(_0x6ae3f7){return _0xd3961d[_0xa071('0x117')](_0x5e2fb5,{'transaction':_0x6ae3f7})['then'](function(){return db[_0xa071('0x116')][_0xa071('0x8d')]({'where':{'id':{'$in':_0x5e2fb5}}});})[_0xa071('0x1d')](function(_0xb07362){var _0x166a71=_[_0xa071('0x8c')](_0xb07362,function(_0x2486a9){return _0x2486a9[_0xa071('0x118')]();});return Promise['all'](_0x166a71);})[_0xa071('0x1d')](function(_0x296306){_0x828212=_[_0xa071('0x119')](_0x296306);var _0x7801ef=_[_0xa071('0x8c')](_0x828212,function(_0x4c8f14){return _0x4c8f14['addAgent'](_0xd3961d['id'],{'transaction':_0x6ae3f7});});return Promise[_0xa071('0x5a')](_0x7801ef);})[_0xa071('0x1d')](function(){if(!_0xd3961d[_0xa071('0xaa')])return;var _0x888e89=_[_0xa071('0x31')](_0x828212,function(_0x5abff8){return _0x5abff8[_0xa071('0x11a')]('channel')===_0xa071('0x11b');});var _0x214027=_[_0xa071('0x8c')](_0x888e89,function(_0x40e850){return db[_0xa071('0xad')][_0xa071('0xae')]({'membername':_0xd3961d['name'],'UserId':_0xd3961d['id'],'queue_name':_0x40e850[_0xa071('0x36')],'VoiceQueueId':_0x40e850['id'],'interface':_[_0xa071('0x67')](_0xd3961d[_0xa071('0xa1')])?util[_0xa071('0xab')](_0xa071('0xf1'),_0xd3961d[_0xa071('0x36')]):_0xd3961d[_0xa071('0xa1')],'paused':_0xd3961d[_0xa071('0xac')]||![],'penalty':_0xd3961d[_0xa071('0xa5')]},{'transaction':_0x6ae3f7});});return Promise[_0xa071('0x5a')](_0x214027);})[_0xa071('0x1d')](function(){return db[_0xa071('0x11c')][_0xa071('0x8d')]({'where':{'teamId':{'$in':_0x5e2fb5}}});})['then'](function(_0x32ce37){var _0x457dd7=_[_0xa071('0x8c')](_0x32ce37,function(_0x4db00a){return db[_0xa071('0x11d')][_0xa071('0x7f')]({'UserId':_0xd3961d['id'],'VoicePrefixId':_0x4db00a[_0xa071('0x11e')]},{'transaction':_0x6ae3f7});});return Promise[_0xa071('0x5a')](_0x457dd7);});});})[_0xa071('0x1d')](function(){for(var _0x5538de=0x0;_0x5538de<_0x828212[_0xa071('0x6b')];_0x5538de++){var _0x3f2f08=_0x828212[_0x5538de][_0xa071('0x11a')]('channel');var _0x5bbf01=_0x3f2f08+'QueueId';socket[_0xa071('0x29')](_0xa071('0x81')+_0x3f2f08+'Queue:save',{'UserId':_0x5430b3,['queueField']:_0x828212[_0x5538de]['id']});}})[_0xa071('0x1d')](respondWithStatusCode(_0x397af7,null))[_0xa071('0x27')](APIHandleError(_0x397af7));};exports[_0xa071('0x11f')]=function(_0xff4f1b,_0x24e46f){var _0x55707d=_0xff4f1b[_0xa071('0x55')]['id'];var _0x50fd65=null;if(_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')]){_0x50fd65=_[_0xa071('0xb3')](_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')])?_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')]:[_0xff4f1b[_0xa071('0x44')][_0xa071('0x5f')]];}var _0xd4ac2a=[];return Promise[_0xa071('0x120')]()['then'](function(){if(!_0x50fd65)throw new APIBadRequestError(_0xa071('0x121'));})[_0xa071('0x1d')](function(){return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x55707d}});})['then'](function(_0x2de13a){if(!_0x2de13a)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xff4f1b[_0xa071('0x55')]['id']));return db['sequelize'][_0xa071('0xfb')](function(_0xdfbd1f){return _0x2de13a['removeTeams'](_0x50fd65,{'transaction':_0xdfbd1f})[_0xa071('0x1d')](function(){return db['Team'][_0xa071('0x8d')]({'where':{'id':{'$in':_0x50fd65}}});})[_0xa071('0x1d')](function(_0x4370b3){var _0x5ce446=_[_0xa071('0x8c')](_0x4370b3,function(_0x57ef39){return _0x57ef39['getAssociatedQueues']();});return Promise[_0xa071('0x5a')](_0x5ce446);})[_0xa071('0x1d')](function(_0x209af3){_0xd4ac2a=_[_0xa071('0x119')](_0x209af3);var _0x46361c=_['map'](_0xd4ac2a,function(_0x497faf){return _0x497faf[_0xa071('0x122')](_0x2de13a['id'],{'transaction':_0xdfbd1f});});return Promise[_0xa071('0x5a')](_0x46361c);})[_0xa071('0x1d')](function(){if(!_0x2de13a[_0xa071('0xaa')])return;var _0x50fe5b=_['filter'](_0xd4ac2a,function(_0x2d678c){return _0x2d678c[_0xa071('0x11a')]('channel')===_0xa071('0x11b');});var _0x58cdb7=_['map'](_0x50fe5b,function(_0x37023c){return db[_0xa071('0xad')][_0xa071('0x2a')]({'where':{'VoiceQueueId':_0x37023c['id'],'UserId':_0x2de13a['id']},'transaction':_0xdfbd1f});});return Promise[_0xa071('0x5a')](_0x58cdb7);})[_0xa071('0x1d')](function(){return db['TeamVoicePrefix'][_0xa071('0x8d')]({'where':{'teamId':{'$in':_0x50fd65}}});})[_0xa071('0x1d')](function(_0x2a92cc){var _0x314acf=_[_0xa071('0x8c')](_0x2a92cc,function(_0x284c48){return db['UserVoicePrefix'][_0xa071('0x2a')]({'where':{'UserId':_0x2de13a['id'],'VoicePrefixId':_0x284c48[_0xa071('0x11e')]}},{'transaction':_0xdfbd1f});});return Promise[_0xa071('0x5a')](_0x314acf);});});})[_0xa071('0x1d')](function(){for(var _0x280dc0=0x0;_0x280dc0<_0xd4ac2a[_0xa071('0x6b')];_0x280dc0++){var _0x1d3747=_0xd4ac2a[_0x280dc0][_0xa071('0x11a')]('channel');var _0x59c914=_0x1d3747+_0xa071('0x123');socket[_0xa071('0x29')]('user'+_0x1d3747+_0xa071('0xb4'),{'UserId':_0x55707d,['queueField']:_0xd4ac2a[_0x280dc0]['id']});}})[_0xa071('0x1d')](respondWithStatusCode(_0x24e46f,null))['catch'](APIHandleError(_0x24e46f));};exports['getLists']=function(_0x49ce15,_0x182ef4){var _0x2fa309={};var _0x2c144d={};var _0x50e78c;var _0x101f10;return db[_0xa071('0x3a')][_0xa071('0x99')]({'where':{'id':_0x49ce15[_0xa071('0x55')]['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x182ef4,null))[_0xa071('0x1d')](function(_0x22f6ce){if(_0x22f6ce){_0x50e78c=_0x22f6ce;_0x2c144d[_0xa071('0xd2')]=_[_0xa071('0xd0')](db['CmList'][_0xa071('0x3b')]);_0x2c144d['query']=_[_0xa071('0xd0')](_0x49ce15[_0xa071('0x44')]);_0x2c144d[_0xa071('0xd5')]=_[_0xa071('0xd1')](_0x2c144d[_0xa071('0xd2')],_0x2c144d[_0xa071('0x44')]);_0x2fa309['attributes']=_['intersection'](_0x2c144d[_0xa071('0xd2')],qs['fields'](_0x49ce15[_0xa071('0x44')][_0xa071('0xd3')]));_0x2fa309[_0xa071('0x49')]=_0x2fa309[_0xa071('0x49')][_0xa071('0x6b')]?_0x2fa309[_0xa071('0x49')]:_0x2c144d[_0xa071('0xd2')];_0x2fa309[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x49ce15['query'][_0xa071('0xd4')]);_0x2fa309[_0xa071('0x43')]=qs['filters'](_['pick'](_0x49ce15[_0xa071('0x44')],_0x2c144d['filters']));if(_0x49ce15['query']['filter']){_0x2fa309[_0xa071('0x43')]=_[_0xa071('0x58')](_0x2fa309['where'],{'$or':_[_0xa071('0x8c')](_0x2fa309[_0xa071('0x49')],function(_0xf6d19b){var _0x293a94={};_0x293a94[_0xf6d19b]={'$like':'%'+_0x49ce15[_0xa071('0x44')][_0xa071('0x31')]+'%'};return _0x293a94;})});}_0x2fa309=_['merge']({},_0x2fa309,_0x49ce15[_0xa071('0x59')]);return _0x50e78c[_0xa071('0x124')](_0x2fa309);}})[_0xa071('0x1d')](function(_0x26095a){if(_0x26095a){_0x101f10=_0x26095a[_0xa071('0x6b')];if(!_0x49ce15[_0xa071('0x44')][_0xa071('0xca')](_0xa071('0xd9'))){_0x2fa309['limit']=qs[_0xa071('0x1a')](_0x49ce15['query']['limit']);_0x2fa309[_0xa071('0x18')]=qs[_0xa071('0x18')](_0x49ce15[_0xa071('0x44')][_0xa071('0x18')]);}return _0x50e78c[_0xa071('0x124')](_0x2fa309);}})[_0xa071('0x1d')](function(_0xa36b44){if(_0xa36b44){return _0xa36b44?{'count':_0x101f10,'rows':_0xa36b44}:null;}})[_0xa071('0x1d')](respondWithResult(_0x182ef4,null))[_0xa071('0x27')](handleError(_0x182ef4,null));};exports['getAgents']=function(_0x40aa04,_0x3a95bc){var _0x3d4d62={};var _0x4a3871={};var _0x5f57a9;return db[_0xa071('0x3a')]['findOne']({'where':{'id':_0x40aa04['params']['id']}})[_0xa071('0x1d')](handleEntityNotFound(_0x3a95bc,null))[_0xa071('0x1d')](function(_0x245207){if(_0x245207){_0x5f57a9=_0x245207;_0x4a3871[_0xa071('0xd2')]=_['keys'](db[_0xa071('0x3a')][_0xa071('0x3b')]);_0x4a3871[_0xa071('0x44')]=_[_0xa071('0xd0')](_0x40aa04[_0xa071('0x44')]);_0x4a3871['filters']=_[_0xa071('0xd1')](_0x4a3871[_0xa071('0xd2')],_0x4a3871[_0xa071('0x44')]);_0x3d4d62[_0xa071('0x49')]=_[_0xa071('0xd1')](_0x4a3871['model'],qs[_0xa071('0xd3')](_0x40aa04[_0xa071('0x44')][_0xa071('0xd3')]));_0x3d4d62[_0xa071('0x49')]=_0x3d4d62[_0xa071('0x49')][_0xa071('0x6b')]?_0x3d4d62[_0xa071('0x49')]:_0x4a3871[_0xa071('0xd2')];_0x3d4d62[_0xa071('0xde')]=qs[_0xa071('0xd4')](_0x40aa04[_0xa071('0x44')][_0xa071('0xd4')]);_0x3d4d62['where']=qs['filters'](_[_0xa071('0xd6')](_0x40aa04[_0xa071('0x44')],_0x4a3871['filters']));if(_0x40aa04[_0xa071('0x44')][_0xa071('0x31')]){_0x3d4d62[_0xa071('0x43')]=_[_0xa071('0x58')](_0x3d4d62['where'],{'$or':_[_0xa071('0x8c')](_0x3d4d62[_0xa071('0x49')],function(_0x2a6b04){var _0x160c63={};_0x160c63[_0x2a6b04]={'$like':'%'+_0x40aa04[_0xa071('0x44')]['filter']+'%'};return _0x160c63;})});}_0x3d4d62['model']=db['User'];_0x3d4d62['as']=_0xa071('0x2f');_0x3d4d62=_['merge']({},_0x3d4d62,_0x40aa04[_0xa071('0x59')]);return _0x5f57a9[_0xa071('0xfe')]({'include':[_0x3d4d62]});}})[_0xa071('0x1d')](function(_0xb9aecb){if(_0xb9aecb){var _0x5ce752={},_0x2ab4f0=[];for(var _0x1d35d3=0x0;_0x1d35d3<_0xb9aecb[_0xa071('0x6b')];_0x1d35d3+=0x1){for(var _0x2bd851=0x0,_0x2f03a3;_0x2bd851<_0xb9aecb[_0x1d35d3][_0xa071('0x2f')]['length'];_0x2bd851+=0x1){_0x2f03a3=_0xb9aecb[_0x1d35d3]['Agents'][_0x2bd851][_0xa071('0x2b')]({'plain':!![]});_0x5ce752[_0x2f03a3['id']]=_0x2f03a3;}}_0x5ce752=_[_0xa071('0x125')](_0x5ce752);for(var _0x85c77c=qs[_0xa071('0x18')](_0x40aa04[_0xa071('0x44')][_0xa071('0x18')]);_0x85c77c<_0x5ce752[_0xa071('0x6b')]&&_0x2ab4f0['length']=_0x274e48){_0x299c98=_0x274e48;_0xea2678=0xc8;}else{_0xea2678=0xce;}_0x4490de[_0xd736('0x12')](_0xea2678);return _0x4490de['set'](_0xd736('0x18'),_0x25ce08+'-'+_0x299c98+'/'+_0x274e48)[_0xd736('0x19')](_0xd3bb21);}return null;};}function respondWithRpcPromise(_0x41d943,_0xbbae00,_0x3bd7e0,_0x3aa56f){return new Promise(function(_0x20b12e,_0x16e6b9){var _0x5a9953=_0x3aa56f||amiClient;return _0x5a9953[_0xd736('0x1a')](_0x41d943,_0x3bd7e0)[_0xd736('0x1b')](function(_0x5b313c){logger['info'](_0xd736('0x1c'),_0xbbae00,_0xd736('0x1d'));logger[_0xd736('0x1e')](_0xd736('0x1f'),_0xbbae00,'request\x20sent',JSON[_0xd736('0x20')](_0x5b313c));if(_0x5b313c[_0xd736('0x21')]){if(_0x5b313c[_0xd736('0x21')][_0xd736('0x22')]===0x1f4){logger['error'](_0xd736('0x1c'),_0xbbae00,_0x5b313c['error'][_0xd736('0x23')]);return _0x16e6b9(_0x5b313c['error'][_0xd736('0x23')]);}logger[_0xd736('0x21')](_0xd736('0x1c'),_0xbbae00,_0x5b313c['error'][_0xd736('0x23')]);return _0x20b12e(_0x5b313c[_0xd736('0x21')][_0xd736('0x23')]);}else{logger['info'](_0xd736('0x1c'),_0xbbae00,_0xd736('0x1d'));_0x20b12e(_0x5b313c[_0xd736('0x24')]['message']);}})[_0xd736('0x25')](function(_0x3c7057){logger[_0xd736('0x21')](_0xd736('0x1c'),_0xbbae00,_0x3c7057);_0x16e6b9(_0x3c7057);});});}function saveUpdates(_0x33c572){return function(_0x55b24d){if(_0x55b24d){return _0x55b24d[_0xd736('0x26')](_0x33c572)[_0xd736('0x1b')](function(_0x11c109){if(_0x11c109[_0xd736('0x27')]===_0xd736('0x28')){socket['emit'](_0xd736('0x29')+_0x11c109['id'],_0x11c109);}return _0x11c109;});}return null;};}function removeEntity(_0x489e79,_0x487748){return function(_0x585562){if(_0x585562){return _0x585562[_0xd736('0x2a')]({'transaction':_0x487748})[_0xd736('0x1b')](function(){var _0x17cfd9=_0x585562['get']({'plain':!![]});if(_0x17cfd9[_0xd736('0x27')]===_0xd736('0x2b'))return;var _0x18c440=[{'name':_0xd736('0x2c'),'value':_0xd736('0x2d'),'ignore':!![]},{'name':_0xd736('0x2e'),'value':_0xd736('0x28'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x450c52=_(_0x18c440)[_0xd736('0x2f')](_0xd736('0x30'))['map'](_0xd736('0x31'))[_0xd736('0x31')]();if(_['includes'](_0x450c52,_0x17cfd9[_0xd736('0x27')])){return;}var _0x3a99a2=_[_0xd736('0x32')](_0x18c440,[_0xd736('0x31'),_0x17cfd9['role']])[_0xd736('0x33')];return db['UserProfileResource'][_0xd736('0x2a')]({'where':{'type':_0x3a99a2,'resourceId':_0x17cfd9['id']},'transaction':_0x487748})[_0xd736('0x1b')](function(){return _0x585562;});})['then'](function(){_0x489e79['status'](0xcc)[_0xd736('0x13')]();});}};}function handleEntityNotFound(_0x561d55){return function(_0x5b988d){if(!_0x5b988d){_0x561d55['sendStatus'](0x194);}return _0x5b988d;};}function handleError(_0x4382b6,_0x225322){_0x225322=_0x225322||0x1f4;return function(_0x1419ae){logger[_0xd736('0x21')](_0x1419ae[_0xd736('0x34')]);if(_0x1419ae[_0xd736('0x33')]){delete _0x1419ae[_0xd736('0x33')];}_0x4382b6[_0xd736('0x12')](_0x225322)[_0xd736('0x35')](_0x1419ae);};}function getUserAttributes(){return _(db[_0xd736('0x36')]['rawAttributes'])[_0xd736('0x37')](function(_0xb0a552){return{'name':_0xb0a552[_0xd736('0x38')],'type':_0xb0a552[_0xd736('0x39')]['key']};})[_0xd736('0x2f')](function(_0x542c45){return![_0xd736('0x3a'),_0xd736('0x3b'),'previousPasswords',_0xd736('0x3c'),_0xd736('0x3d'),'md5secret']['includes'](_0x542c45[_0xd736('0x33')]);})[_0xd736('0x31')]();}exports[_0xd736('0x3e')]=function(_0xb360da,_0x5a36ae){var _0x539552={},_0x46491c={'count':0x0,'rows':[]};var _0x55dd80=getUserAttributes();_0x539552=qs[_0xd736('0x3f')](_0x55dd80,_0xb360da);var _0x81e5fd={'where':_0x539552[_0xd736('0x40')]};return db['User']['count'](_0x81e5fd)[_0xd736('0x1b')](function(_0x2e3a2c){_0x46491c[_0xd736('0x16')]=_0x2e3a2c;if(_0xb360da['query'][_0xd736('0x41')]){_0x539552['include']=[{'all':!![]}];}if(_0xb360da[_0xd736('0x42')][_0xd736('0x43')]==='true'){_0x539552[_0xd736('0x44')]=[{'model':db[_0xd736('0x45')],'as':_0xd736('0x43')}];}if(!_[_0xd736('0x46')](_0x539552[_0xd736('0x47')],'id')){_0x539552['attributes'][_0xd736('0x48')]('id');}return db[_0xd736('0x36')][_0xd736('0x49')](_0x539552);})['then'](function(_0x2583bc){_0x46491c[_0xd736('0x4a')]=_0x2583bc;if(_0xb360da[_0xd736('0x42')]['openTabs']===_0xd736('0x4b')){var _0x3e3bc9=[];for(var _0x41db2c=0x0;_0x41db2c<_0x46491c[_0xd736('0x4a')][_0xd736('0x4c')];_0x41db2c++){_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x4d'),_0x46491c[_0xd736('0x4a')][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x4f'),_0x46491c['rows'][_0x41db2c]['dataValues']));_0x3e3bc9[_0xd736('0x48')](get_open_tabs('fax',_0x46491c[_0xd736('0x4a')][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x50'),_0x46491c[_0xd736('0x4a')][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x51'),_0x46491c['rows'][_0x41db2c][_0xd736('0x4e')]));_0x3e3bc9[_0xd736('0x48')](get_open_tabs(_0xd736('0x52'),_0x46491c['rows'][_0x41db2c][_0xd736('0x4e')]));}return Promise[_0xd736('0x53')](_0x3e3bc9)[_0xd736('0x1b')](function(){return _0x46491c;});}else{return _0x46491c;}})[_0xd736('0x1b')](respondWithFilteredResult(_0x5a36ae,_0x539552))[_0xd736('0x25')](handleError(_0x5a36ae,null));};exports[_0xd736('0x54')]=function(_0x36afda,_0x5e303b){var _0x2ca81b=getUserAttributes();_0x36afda[_0xd736('0x42')]['id']=_0x36afda[_0xd736('0x55')]['id'];var _0x3a4b8d=qs[_0xd736('0x3f')](_0x2ca81b,_0x36afda);if(_0x36afda[_0xd736('0x42')][_0xd736('0x41')]){_0x3a4b8d[_0xd736('0x44')]=[{'all':!![]}];}if(_0x36afda[_0xd736('0x42')][_0xd736('0x43')]==='true'){_0x3a4b8d[_0xd736('0x44')]=[{'model':db[_0xd736('0x45')],'as':_0xd736('0x43')}];}_0x3a4b8d=_[_0xd736('0x56')]({},_0x3a4b8d,_0x36afda[_0xd736('0x57')]);if(!_[_0xd736('0x46')](_0x3a4b8d[_0xd736('0x47')],'id')){_0x3a4b8d['attributes'][_0xd736('0x48')]('id');}return db[_0xd736('0x36')]['find'](_0x3a4b8d)[_0xd736('0x1b')](handleEntityNotFound(_0x5e303b,null))['then'](function(_0x3300ce){var _0x324516=[];values=_0x3300ce;if(_0x36afda[_0xd736('0x42')]['openTabs']===_0xd736('0x4b')){_0x324516[_0xd736('0x48')](get_open_tabs(_0xd736('0x4d'),_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs('sms',_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs('openchannel',_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs('whatsapp',_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs(_0xd736('0x58'),_0x3300ce[_0xd736('0x4e')]));_0x324516[_0xd736('0x48')](get_open_tabs(_0xd736('0x50'),_0x3300ce[_0xd736('0x4e')]));return Promise[_0xd736('0x53')](_0x324516);}else{return values;}})[_0xd736('0x1b')](function(){return values;})[_0xd736('0x1b')](respondWithResult(_0x5e303b,null))['catch'](handleError(_0x5e303b,null));};exports[_0xd736('0x26')]=function(_0xcdb170,_0x2ab415){if(_0xcdb170[_0xd736('0x59')]['id']){delete _0xcdb170[_0xd736('0x59')]['id'];}delete _0xcdb170[_0xd736('0x59')]['role'];return db[_0xd736('0x36')][_0xd736('0x32')]({'where':{'id':_0xcdb170[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x2ab415,null))[_0xd736('0x1b')](saveUpdates(_0xcdb170[_0xd736('0x59')],null))[_0xd736('0x1b')](respondWithResult(_0x2ab415,null))[_0xd736('0x25')](handleError(_0x2ab415,null));};exports['describe']=function(_0xa3c017,_0x799ba){return db[_0xd736('0x36')][_0xd736('0x5a')]()[_0xd736('0x1b')](respondWithResult(_0x799ba,null))[_0xd736('0x25')](handleError(_0x799ba,null));};exports['addContacts']=function(_0x217513,_0x3256ea){return db[_0xd736('0x36')]['find']({'where':{'id':_0x217513[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x3256ea,null))[_0xd736('0x1b')](function(_0x36f393){if(_0x36f393){return _0x36f393[_0xd736('0x5b')](_0x217513[_0xd736('0x59')][_0xd736('0x5c')],_[_0xd736('0x5d')](_0x217513[_0xd736('0x59')],[_0xd736('0x5c'),'id'])||{});}})[_0xd736('0x1b')](respondWithResult(_0x3256ea,null))[_0xd736('0x25')](handleError(_0x3256ea,null));};function validateUser(_0x3ee138){return new Promise(function(_0x419975,_0x1d8e77){if(_0x3ee138[_0xd736('0x5e')])return _0x419975(_0x3ee138);return db[_0xd736('0x5f')][_0xd736('0x60')](0x1)[_0xd736('0x1b')](function(_0x5ab022){if(_0x5ab022[_0xd736('0x61')])authService[_0xd736('0x62')](_0x3ee138[_0xd736('0x3a')]);db[_0xd736('0x36')][_0xd736('0x63')](_0xd736('0x5e'))[_0xd736('0x1b')](function(_0x41ac1a){if(_[_0xd736('0x64')](_0x41ac1a)){_0x3ee138[_0xd736('0x5e')]=_0x5ab022[_0xd736('0x65')]||0x1;return;}if(_[_0xd736('0x64')](_0x5ab022[_0xd736('0x65')])||_0x5ab022[_0xd736('0x65')]===_0x41ac1a){_0x3ee138[_0xd736('0x5e')]=_0x41ac1a+0x1;return;}if(_0x5ab022[_0xd736('0x65')]>_0x41ac1a){_0x3ee138[_0xd736('0x5e')]=_0x5ab022[_0xd736('0x65')];return;}return db[_0xd736('0x66')][_0xd736('0x42')](_0xd736('0x67'),{'type':db[_0xd736('0x66')]['QueryTypes'][_0xd736('0x68')]})['then'](function(_0x464fe5){if(_0x464fe5&&_0x464fe5[_0xd736('0x4c')]){for(var _0x30fbf3=0x0,_0x23e298=_0x464fe5[_0xd736('0x4c')];_0x30fbf3<_0x23e298&&_[_0xd736('0x64')](_0x3ee138[_0xd736('0x5e')]);_0x30fbf3++){if(_0x5ab022[_0xd736('0x65')]<=_0x464fe5[_0x30fbf3][_0xd736('0x69')]){_0x3ee138[_0xd736('0x5e')]=_0x464fe5[_0x30fbf3][_0xd736('0x69')];}else if(_0x5ab022[_0xd736('0x65')]>_0x464fe5[_0x30fbf3][_0xd736('0x69')]&&_0x5ab022[_0xd736('0x65')]<=_0x464fe5[_0x30fbf3]['to']){_0x3ee138[_0xd736('0x5e')]=_0x5ab022['min_internal'];}}}if(_[_0xd736('0x64')](_0x3ee138[_0xd736('0x5e')])){_0x3ee138[_0xd736('0x5e')]=_0x41ac1a+0x1;}return _0x419975(_0x3ee138);});});})[_0xd736('0x25')](function(_0x5e794f){_0x1d8e77(_0x5e794f);});});}function updateUser(_0x1daf37){return new Promise(function(_0x2f830b,_0x590ee1){try{if(_0x1daf37[_0xd736('0x6a')]){_0x1daf37['mailbox']=_0x1daf37[_0xd736('0x5e')];_0x1daf37[_0xd736('0x6b')]={'mailbox':_0x1daf37['internal'],'password':_0x1daf37[_0xd736('0x3a')],'fullname':_0x1daf37[_0xd736('0x6c')],'email':_0x1daf37['email']};}if(_0x1daf37['role']===_0xd736('0x28')){if(!_0x1daf37['permissions'])_0x1daf37[_0xd736('0x6d')]=[_0xd736('0x6e'),_0xd736('0x6f'),'103',_0xd736('0x70'),_0xd736('0x71'),_0xd736('0x72'),_0xd736('0x73'),_0xd736('0x74'),_0xd736('0x75'),_0xd736('0x76'),'109',_0xd736('0x77'),_0xd736('0x78'),_0xd736('0x79'),_0xd736('0x7a')];}_0x2f830b(_0x1daf37);}catch(_0x4eea69){_0x590ee1(_0x4eea69);}});}exports[_0xd736('0x7b')]=function(_0x14a719,_0x3ecc00){if(_0x14a719[_0xd736('0x2d')]['role']==='agent')throw new Error(_0xd736('0x7c'));if(_0x14a719[_0xd736('0x59')][_0xd736('0x27')]===_0xd736('0x2d')&&_0x14a719[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2b')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x14a719[_0xd736('0x59')]['role']===_0xd736('0x2b')&&_0x14a719[_0xd736('0x2d')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil['checkUserLimits']([_0x14a719['body']])[_0xd736('0x1b')](function(){return validateUser(_0x14a719['body']);})[_0xd736('0x1b')](function(_0x2c5889){return updateUser(_0x2c5889)[_0xd736('0x1b')](function(_0x240ab9){if(_0x240ab9['role']==='admin'){_0x240ab9['settingsEnabled']=_0x14a719[_0xd736('0x2d')]['settingsEnabled'];delete _0x240ab9[_0xd736('0x7d')];}return _0x240ab9;});})[_0xd736('0x1b')](function(_0x2c6f98){return db[_0xd736('0x36')][_0xd736('0x7b')](_0x2c6f98,{'include':[{'model':db[_0xd736('0x6b')],'as':_0xd736('0x6b')}]});})['then'](function(_0x30c997){if(_0x14a719['body'][_0xd736('0x27')]===_0xd736('0x2d'))return _0x30c997;if(_0x14a719[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2d'))return _0x30c997;return db[_0xd736('0x7e')]['find']({'where':{'name':_0x30c997[_0xd736('0x27')]===_0xd736('0x28')?_0xd736('0x2e'):_0xd736('0x7f'),'userProfileId':_0x14a719[_0xd736('0x2d')][_0xd736('0x7d')]},'raw':!![]})[_0xd736('0x1b')](function(_0x4e6199){if(!_0x4e6199||_0x4e6199[_0xd736('0x80')]!=0x0)return _0x30c997;return db[_0xd736('0x81')][_0xd736('0x7b')]({'name':_0x30c997[_0xd736('0x33')],'resourceId':_0x30c997['id'],'type':_0x4e6199['name'],'sectionId':_0x4e6199['id']},{})[_0xd736('0x1b')](function(){return _0x30c997;});})[_0xd736('0x25')](function(_0x297f22){logger[_0xd736('0x21')](_0xd736('0x82'),_0x297f22);throw _0x297f22;});})[_0xd736('0x1b')](respondWithResult(_0x3ecc00,0xc9))['catch'](handleError(_0x3ecc00,null));};exports[_0xd736('0x83')]=function(_0x1b0791,_0x2e9bac){var _0x1c1db5=_0x1b0791[_0xd736('0x59')];var _0x16d33d=[];if(_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]===_0xd736('0x28'))throw new Error(_0xd736('0x7c'));if(_[_0xd736('0x84')](_0x1c1db5,['role','user'])&&_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2b')){throw new Error(_0xd736('0x85'));}if(_['some'](_0x1c1db5,['role','admin'])&&_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]!=='admin'){throw new Error(_0xd736('0x86'));}return licenseUtil['checkUserLimits'](_0x1c1db5)['then'](function(){return validateUser(_0x1c1db5[0x0]);})['then'](function(){for(var _0x1e995f=0x1;_0x1e995f<_0x1c1db5[_0xd736('0x4c')];_0x1e995f++){var _0x39bf9a=_0x1c1db5[_0x1e995f-0x1][_0xd736('0x5e')];if(!_0x1c1db5[_0x1e995f]['internal'])_0x1c1db5[_0x1e995f]['internal']=_0x39bf9a+0x1;_0x16d33d['push'](validateUser(_0x1c1db5[_0x1e995f]));}return Promise['all'](_0x16d33d);})[_0xd736('0x1b')](function(){_0x16d33d=[];for(var _0x1434c7=0x0;_0x1434c7<_0x1c1db5[_0xd736('0x4c')];_0x1434c7++){_0x16d33d[_0xd736('0x48')](updateUser(_0x1c1db5[_0x1434c7]));}return Promise['all'](_0x16d33d);})[_0xd736('0x1b')](function(){_0x16d33d=_0x1c1db5[_0xd736('0x37')](function(_0xb3b8f5){return db[_0xd736('0x36')][_0xd736('0x7b')](_0xb3b8f5,{'include':[{'model':db[_0xd736('0x6b')],'as':'VoiceMail'}]})[_0xd736('0x1b')](function(_0x121884){_0xb3b8f5['id']=_0x121884['id'];return _0xb3b8f5;});});return Promise['all'](_0x16d33d);})[_0xd736('0x1b')](function(_0x2ad132){if(_0x1b0791[_0xd736('0x59')][_0xd736('0x27')]===_0xd736('0x2d'))return _0x2ad132;if(_0x1b0791[_0xd736('0x2d')][_0xd736('0x27')]!==_0xd736('0x2d'))return _0x2ad132;var _0x5230c2=_[_0xd736('0x84')](_0x2ad132,function(_0x310900){return _0x310900[_0xd736('0x27')]==='agent'||_0x310900[_0xd736('0x27')]===_0xd736('0x87');});if(!_0x5230c2)return _0x2ad132;return db[_0xd736('0x7e')][_0xd736('0x49')]({'where':{'name':{'$or':[_0xd736('0x2e'),_0xd736('0x7f')]},'userProfileId':_0x1b0791['user']['userProfileId']},'raw':!![]})['then'](function(_0x29024c){if(_[_0xd736('0x88')](_0x29024c)||!_['some'](_0x29024c,[_0xd736('0x80'),0x0]))return _0x2ad132;_0x16d33d=[];var _0x48bfab=_(_0x29024c)['map'](function(_0x427936){if(_0x427936[_0xd736('0x80')]===0x1)return;return _0x427936[_0xd736('0x33')]===_0xd736('0x2e')?_0xd736('0x28'):_0xd736('0x87');})[_0xd736('0x89')]()[_0xd736('0x31')]();for(var _0x153a0a=0x0;_0x153a0a<_0x2ad132[_0xd736('0x4c')];_0x153a0a++){if(!_['includes'](_0x48bfab,_0x2ad132[_0x153a0a][_0xd736('0x27')]))return;var _0x7bd4d9=_0x2ad132[_0x153a0a][_0xd736('0x27')]===_0xd736('0x28')?_0xd736('0x2e'):'Telephones';_0x16d33d[_0xd736('0x48')](db[_0xd736('0x81')][_0xd736('0x7b')]({'name':_0x2ad132[_0x153a0a][_0xd736('0x33')],'resourceId':_0x2ad132[_0x153a0a]['id'],'type':_0x7bd4d9,'sectionId':_[_0xd736('0x32')](_0x29024c,[_0xd736('0x33'),_0x7bd4d9])['id']},{}));}return Promise[_0xd736('0x53')](_0x16d33d);});})[_0xd736('0x1b')](respondWithResult(_0x2e9bac,0xc9))['catch'](handleError(_0x2e9bac,null));};exports[_0xd736('0x8a')]=function(_0x30f4b1,_0x1951cb){if(_0x30f4b1['body']['id']){delete _0x30f4b1[_0xd736('0x59')]['id'];}return db[_0xd736('0x36')]['find']({'where':{'id':_0x30f4b1[_0xd736('0x55')]['id']}})['then'](function(_0x5d4d09){if(!_0x5d4d09)return null;if(_0x5d4d09['id']===_0x30f4b1[_0xd736('0x2d')]['id']){if(!_0x30f4b1[_0xd736('0x59')]['oldPassword']||!_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')]){throw new db[(_0xd736('0x8c'))]['ValidationError'](_0xd736('0x8d'));}if(!_0x5d4d09[_0xd736('0x8e')](_0x30f4b1['body']['oldPassword'])){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))]('Wrong\x20credentials');}if(_0x30f4b1[_0xd736('0x59')][_0xd736('0x90')]===_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')]){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x91'));}}else if(_0x30f4b1[_0xd736('0x2d')]['role']==='admin'){if(!_0x30f4b1[_0xd736('0x59')]['newPassword']){throw new db[(_0xd736('0x8c'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x30f4b1[_0xd736('0x2d')][_0xd736('0x27')]===_0xd736('0x2d')){if(!_0x30f4b1['body'][_0xd736('0x8b')]){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x92'));}if(_0x5d4d09[_0xd736('0x27')]!=='agent'){throw new db[(_0xd736('0x8c'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0xd736('0x8f'))](_0xd736('0x7c'));}return _0x5d4d09;})[_0xd736('0x1b')](handleEntityNotFound(_0x1951cb,null))[_0xd736('0x1b')](function(_0x9cc63d){return db[_0xd736('0x5f')][_0xd736('0x93')]({'attributes':['id',_0xd736('0x61'),'enforcePasswordHistory','passwordHistoryLimit']})[_0xd736('0x1b')](function(_0x3c26bb){if(_0x3c26bb[_0xd736('0x61')])authService[_0xd736('0x62')](_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')]);if(!_0x3c26bb[_0xd736('0x94')]||!_0x9cc63d[_0xd736('0x95')])return _0x9cc63d;authService[_0xd736('0x96')](_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')],_0x9cc63d['previousPasswords'],_0x3c26bb[_0xd736('0x97')]);return _0x9cc63d;})[_0xd736('0x1b')](saveUpdates({'password':_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')],'passwordResetAt':_0x30f4b1[_0xd736('0x2d')]['id']==_0x30f4b1[_0xd736('0x55')]['id']?moment():null,'previousPasswords':authService[_0xd736('0x98')](_0x30f4b1[_0xd736('0x59')][_0xd736('0x8b')],_0x9cc63d[_0xd736('0x95')])},null));})[_0xd736('0x1b')](respondWithResult(_0x1951cb,null))[_0xd736('0x25')](handleError(_0x1951cb,null));};exports['addQueues']=function(_0x36f782,_0x48226b){var _0xb10025=_0x36f782[_0xd736('0x59')][_0xd736('0x99')];return db['User'][_0xd736('0x32')]({'where':{'id':_0x36f782[_0xd736('0x55')]['id']},'attributes':['id','name',_0xd736('0x27'),_0xd736('0x9a'),'loginInPause',_0xd736('0x9b'),'interface']})['then'](handleEntityNotFound(_0x48226b,null))[_0xd736('0x1b')](function(_0x534653){if(_0x534653){if(!utils[_0xd736('0x9c')](_0xb10025)){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x9d'));}return _0x534653[_0xd736('0x9e')+_[_0xd736('0x9f')](_0xb10025[_0xd736('0xa0')]())+_0xd736('0xa1')](_0x36f782[_0xd736('0x59')][_0xd736('0x5c')],{'penalty':_0x36f782[_0xd736('0x59')][_0xd736('0xa2')]||0x0})[_0xd736('0xa3')](function(_0x1f1ba2){for(var _0x596269=0x0;_0x596269<_0x36f782['body']['ids'][_0xd736('0x4c')];_0x596269+=0x1){var _0x490280={'UserId':Number(_0x36f782[_0xd736('0x55')]['id'])};_0x490280[_[_0xd736('0x9f')](_0xb10025['toLowerCase']())+_0xd736('0xa4')]=Number(_0x36f782[_0xd736('0x59')]['ids'][_0x596269]);socket[_0xd736('0xa5')](_0xd736('0x2d')+_['capitalize'](_0xb10025['toLowerCase']())+_0xd736('0xa6'),_0x490280);}return _0x1f1ba2;})[_0xd736('0x1b')](function(){if(_0xb10025===_0xd736('0xa7')){return db['VoiceQueue'][_0xd736('0x49')]({'where':{'id':_0x36f782['body'][_0xd736('0x5c')]||[]},'raw':!![],'attributes':['id',_0xd736('0x33')]});}})['then'](function(_0x42626e){var _0x3120ad=_0x534653['get']({'plain':!![]});var _0x3a9798=[];if(_0xb10025==='voice'&&_0x3120ad[_0xd736('0x27')]===_0xd736('0x28')&&_0x3120ad['online']){for(let _0x124d51=0x0;_0x124d51<_0x42626e[_0xd736('0x4c')];_0x124d51+=0x1){_0x3a9798[_0xd736('0x48')]({'membername':_0x3120ad[_0xd736('0x33')],'UserId':_0x3120ad['id'],'queue_name':_0x42626e[_0x124d51][_0xd736('0x33')],'VoiceQueueId':_0x42626e[_0x124d51]['id'],'interface':_[_0xd736('0x64')](_0x3120ad[_0xd736('0xa8')])?util[_0xd736('0xa9')]('SIP/%s',_0x3120ad[_0xd736('0x33')]):_0x3120ad['interface'],'paused':_0x3120ad[_0xd736('0x9b')]||![],'penalty':_0x36f782['body'][_0xd736('0xa2')]||0x0});}return Promise[_0xd736('0x53')](_0x3a9798[_0xd736('0x37')](function(_0x538dcb){return db[_0xd736('0xaa')]['upsert'](_0x538dcb);}));}return _0x534653;});}})[_0xd736('0x1b')](respondWithStatusCode(_0x48226b,null))[_0xd736('0x25')](handleError(_0x48226b,null));};exports[_0xd736('0xab')]=function(_0x471c48,_0x4e492e){var _0x3b3b44,_0x56f35b;return db['User'][_0xd736('0x32')]({'where':{'id':_0x471c48[_0xd736('0x55')]['id']},'attributes':['id','name',_0xd736('0x27')]})[_0xd736('0x1b')](handleEntityNotFound(_0x4e492e,null))[_0xd736('0x1b')](function(_0xd1d7a0){if(_0xd1d7a0){_0x3b3b44=_0xd1d7a0;if(!_0x471c48[_0xd736('0x42')][_0xd736('0x99')]||!utils[_0xd736('0x9c')](_0x471c48[_0xd736('0x42')][_0xd736('0x99')])){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x9d'));}return _0xd1d7a0[_0xd736('0xac')+_[_0xd736('0x9f')](_0x471c48[_0xd736('0x42')]['channel'][_0xd736('0xa0')]())+_0xd736('0xa1')](_0x471c48['query']['ids']);}})['then'](function(_0x4c994a){if(_['isArray'](_0x471c48[_0xd736('0x42')][_0xd736('0x5c')])){for(var _0x3c112f=0x0;_0x3c112f<_0x471c48['query'][_0xd736('0x5c')][_0xd736('0x4c')];_0x3c112f+=0x1){_0x56f35b={'UserId':Number(_0x471c48[_0xd736('0x55')]['id'])};_0x56f35b[_['capitalize'](_0x471c48[_0xd736('0x42')][_0xd736('0x99')][_0xd736('0xa0')]())+_0xd736('0xa4')]=Number(_0x471c48[_0xd736('0x42')][_0xd736('0x5c')][_0x3c112f]);socket[_0xd736('0xa5')]('user'+_[_0xd736('0x9f')](_0x471c48[_0xd736('0x42')][_0xd736('0x99')][_0xd736('0xa0')]())+_0xd736('0xad'),_0x56f35b);}}else{_0x56f35b={'UserId':Number(_0x471c48[_0xd736('0x55')]['id'])};_0x56f35b[_['capitalize'](_0x471c48[_0xd736('0x42')][_0xd736('0x99')][_0xd736('0xa0')]())+_0xd736('0xa4')]=Number(_0x471c48[_0xd736('0x42')][_0xd736('0x5c')]);socket['emit'](_0xd736('0x2d')+_[_0xd736('0x9f')](_0x471c48[_0xd736('0x42')]['channel'][_0xd736('0xa0')]())+_0xd736('0xad'),_0x56f35b);}return _0x4c994a;})['then'](function(){if(_0x471c48[_0xd736('0x42')]['channel']===_0xd736('0xa7')){return db['UserVoiceQueueRt'][_0xd736('0x2a')]({'where':{'UserId':_0x471c48[_0xd736('0x55')]['id'],'VoiceQueueId':_0x471c48[_0xd736('0x42')][_0xd736('0x5c')]},'individualHooks':!![]})[_0xd736('0x1b')](function(){return _0x3b3b44;});}return _0x3b3b44;})[_0xd736('0x1b')](respondWithStatusCode(_0x4e492e,null))[_0xd736('0x25')](handleError(_0x4e492e,null));};exports[_0xd736('0xae')]=function(_0xe7790d,_0x2f2eb3){_0xe7790d[_0xd736('0x59')][_0xd736('0xaf')]=_0xe7790d['file'][_0xd736('0xb0')];return db[_0xd736('0x36')]['find']({'where':{'id':_0xe7790d[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x2f2eb3,null))[_0xd736('0x1b')](saveUpdates(_0xe7790d['body'],null))[_0xd736('0x1b')](respondWithResult(_0x2f2eb3,null))['catch'](handleError(_0x2f2eb3,null));};exports[_0xd736('0xb1')]=function(_0x4a6239,_0x209920){var _0x52fac5=path[_0xd736('0xb2')](config[_0xd736('0xb3')],'server/files/images/logos/default_profile.png');return db[_0xd736('0x36')]['find']({'where':{'id':_0x4a6239[_0xd736('0x55')]['id']},'attributes':['id',_0xd736('0xaf')],'raw':!![]})[_0xd736('0x1b')](handleEntityNotFound(_0x209920,null))['then'](function(_0x36e1dd){if(_0x36e1dd){if(_['isNil'](_0x36e1dd['userpic'])){return _0x209920[_0xd736('0xb4')](_0x52fac5);}else{if(!fs[_0xd736('0xb5')](path[_0xd736('0xb2')](config[_0xd736('0xb3')],_0xd736('0xb6'),_0x36e1dd[_0xd736('0xaf')]))){return _0x209920[_0xd736('0xb4')](_0x52fac5);}return _0x209920[_0xd736('0xb4')](path[_0xd736('0xb2')](config[_0xd736('0xb3')],_0xd736('0xb6'),_0x36e1dd[_0xd736('0xaf')]));}}})[_0xd736('0x25')](handleError(_0x209920,null));};exports[_0xd736('0xb7')]=function(_0x5c0cdd,_0x42db94){return db[_0xd736('0x36')][_0xd736('0x32')]({'where':{'id':_0x5c0cdd['params']['id']},'attributes':['id']})[_0xd736('0x1b')](handleEntityNotFound(_0x42db94,null))[_0xd736('0x1b')](function(_0x5cb86b){var _0x487aec=[];values=_0x5cb86b[_0xd736('0x4e')];_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x4d'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x4f'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x51'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x52'),_0x5cb86b[_0xd736('0x4e')]));_0x487aec['push'](get_open_tabs(_0xd736('0x58'),_0x5cb86b['dataValues']));_0x487aec[_0xd736('0x48')](get_open_tabs(_0xd736('0x50'),_0x5cb86b[_0xd736('0x4e')]));return Promise[_0xd736('0x53')](_0x487aec);})[_0xd736('0x1b')](function(_0x2db99f){if(_0x2db99f){var _0x5626d3=_[_0xd736('0x37')](values[_0xd736('0xb8')],function(_0x473a1d){return{'channel':_0xd736('0xb9'),'id':_0x473a1d['id'],'createdAt':_0x473a1d[_0xd736('0xba')]};});var _0x166cb9=_[_0xd736('0x37')](values[_0xd736('0xbb')],function(_0x49bb13){return{'channel':_0xd736('0xbc'),'id':_0x49bb13['id'],'createdAt':_0x49bb13['createdAt']};});var _0x5800d5=_[_0xd736('0x37')](values[_0xd736('0xbd')],function(_0x251242){return{'channel':_0xd736('0xbe'),'id':_0x251242['id'],'createdAt':_0x251242[_0xd736('0xba')]};});var _0x45e48d=_[_0xd736('0x37')](values[_0xd736('0xbf')],function(_0x504bb4){return{'channel':_0xd736('0xc0'),'id':_0x504bb4['id'],'createdAt':_0x504bb4[_0xd736('0xba')]};});var _0x11ae61=_[_0xd736('0x37')](values[_0xd736('0xc1')],function(_0x404cb8){return{'channel':_0xd736('0xc2'),'id':_0x404cb8['id'],'createdAt':_0x404cb8[_0xd736('0xba')]};});var _0x4985c6=_['map'](values[_0xd736('0xc3')],function(_0xd3c68f){return{'channel':_0xd736('0xc4'),'id':_0xd3c68f['id'],'createdAt':_0xd3c68f['createdAt']};});var _0x1a78ef=_[_0xd736('0xc5')](_0x5626d3,_0x166cb9,_0x5800d5,_0x45e48d,_0x11ae61,_0x4985c6);var _0x15cfad={'count':_0x1a78ef[_0xd736('0x4c')],'rows':_0x1a78ef};return _0x15cfad;}else return null;})[_0xd736('0x1b')](respondWithResult(_0x42db94,null))[_0xd736('0x25')](handleError(_0x42db94,null));};exports['getContacts']=function(_0x1cb80a,_0x162304){var _0x56b333={};return db['User'][_0xd736('0x93')]({'where':{'id':_0x1cb80a['params']['id']}})['then'](function(_0x4920de){if(!_0x4920de){throw new APINotFoundError(util[_0xd736('0xa9')](_0xd736('0xc6'),_0x1cb80a[_0xd736('0x55')]['id']));}return contacts['describe']();})[_0xd736('0x1b')](function(_0x42ade5){_0x1cb80a[_0xd736('0x42')]['User']=_0x1cb80a['params']['id'];_0x56b333=qs[_0xd736('0x3f')](_0x42ade5,_0x1cb80a);if(_0x1cb80a[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0x41'))){_0x56b333[_0xd736('0x44')]=[{'model':db[_0xd736('0xc8')],'as':'List','required':![]},{'model':db[_0xd736('0xc9')],'as':_0xd736('0xca'),'attributes':['id',_0xd736('0x33'),'color'],'where':_0x1cb80a[_0xd736('0x42')][_0xd736('0xcb')]?{'id':_0x1cb80a[_0xd736('0x42')][_0xd736('0xcb')]}:undefined,'required':_0x1cb80a[_0xd736('0x42')][_0xd736('0xcb')]?!![]:![]}];}return contacts[_0xd736('0x49')](_0x1cb80a[_0xd736('0x42')],_0x1cb80a[_0xd736('0x2d')],_0x56b333,_0x42ade5);})['then'](respondWithFilteredResult(_0x162304,_0x56b333))[_0xd736('0x25')](APIHandleError(_0x162304));};exports['getQueues']=function(_0x492d7e,_0xd46925){var _0x1415ea;var _0x2d8863={};var _0x46c2b1;return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x492d7e['params']['id']},'attributes':['id','name',_0xd736('0x27')]})['then'](handleEntityNotFound(_0xd46925,null))['then'](function(_0x49bfd1){if(!utils[_0xd736('0x9c')](_0x492d7e[_0xd736('0x42')][_0xd736('0x99')])){throw new db[(_0xd736('0x8c'))][(_0xd736('0x8f'))](_0xd736('0x9d'));}_0x1415ea=_0x49bfd1;var _0x4788d4={};_0x4788d4[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_[_0xd736('0x9f')](_0x492d7e['query'][_0xd736('0x99')])+_0xd736('0xce')][_0xd736('0xcf')]);_0x4788d4['query']=_['keys'](_0x492d7e[_0xd736('0x42')]);_0x4788d4[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x4788d4[_0xd736('0xcc')],_0x4788d4[_0xd736('0x42')]);_0x2d8863['attributes']=_[_0xd736('0xd1')](_0x4788d4[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x492d7e[_0xd736('0x42')]['fields']));_0x2d8863[_0xd736('0x47')]=_0x2d8863[_0xd736('0x47')][_0xd736('0x4c')]?_0x2d8863[_0xd736('0x47')]:_0x4788d4[_0xd736('0xcc')];_0x2d8863['order']=qs['sort'](_0x492d7e[_0xd736('0x42')][_0xd736('0xd3')]);_0x2d8863['where']=qs[_0xd736('0xd0')](_['pick'](_0x492d7e[_0xd736('0x42')],_0x4788d4[_0xd736('0xd0')]));if(_0x492d7e[_0xd736('0x42')][_0xd736('0x2f')]){_0x2d8863[_0xd736('0x40')]=_[_0xd736('0x56')](_0x2d8863[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x2d8863[_0xd736('0x47')],function(_0x934cb7){var _0x20dbcf={};_0x20dbcf[_0x934cb7]={'$like':'%'+_0x492d7e[_0xd736('0x42')]['filter']+'%'};return _0x20dbcf;})});}_0x2d8863=_['merge']({},_0x2d8863,_0x492d7e[_0xd736('0x57')]);switch(_0x1415ea[_0xd736('0x27')]){case _0xd736('0x2b'):return db[_[_0xd736('0x9f')](_0x492d7e[_0xd736('0x42')][_0xd736('0x99')])+_0xd736('0xce')]['findAll'](_0x2d8863);case'user':case'agent':return _0x1415ea[_0xd736('0xd4')+_[_0xd736('0x9f')](_0x492d7e[_0xd736('0x42')][_0xd736('0x99')])+_0xd736('0xa1')](_0x2d8863);default:throw new db['Sequelize'][(_0xd736('0x8f'))](_0xd736('0xd5'));}})[_0xd736('0x1b')](function(_0x8f30a){_0x46c2b1=_0x8f30a['length'];if(!_0x492d7e['query'][_0xd736('0xc7')]('nolimit')){_0x2d8863['limit']=qs[_0xd736('0x17')](_0x492d7e['query'][_0xd736('0x17')]);_0x2d8863[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x492d7e[_0xd736('0x42')][_0xd736('0x14')]);}switch(_0x1415ea[_0xd736('0x27')]){case'admin':return db[_[_0xd736('0x9f')](_0x492d7e['query'][_0xd736('0x99')])+_0xd736('0xce')][_0xd736('0x49')](_0x2d8863);case _0xd736('0x2d'):case _0xd736('0x28'):return _0x1415ea[_0xd736('0xd4')+_[_0xd736('0x9f')](_0x492d7e[_0xd736('0x42')]['channel'])+_0xd736('0xa1')](_0x2d8863);}})[_0xd736('0x1b')](function(_0x3b8ed0){return{'count':_0x46c2b1,'rows':_0x3b8ed0};})[_0xd736('0x1b')](respondWithResult(_0xd46925,null))[_0xd736('0x25')](handleError(_0xd46925,null));};exports[_0xd736('0xd6')]=function(_0x2b4162,_0x5a791a){var _0x1ac2c2={};var _0x159abf={};var _0x4d2bf0;var _0x1fcd9a;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x2b4162[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x5a791a,null))[_0xd736('0x1b')](function(_0x599333){if(_0x599333){_0x4d2bf0=_0x599333;_0x159abf[_0xd736('0xcc')]=_['keys'](db[_0xd736('0xaa')]['rawAttributes']);_0x159abf[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x2b4162['query']);_0x159abf[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x159abf[_0xd736('0xcc')],_0x159abf[_0xd736('0x42')]);_0x1ac2c2['attributes']=_[_0xd736('0xd1')](_0x159abf[_0xd736('0xcc')],qs['fields'](_0x2b4162[_0xd736('0x42')][_0xd736('0xd2')]));_0x1ac2c2['attributes']=_0x1ac2c2[_0xd736('0x47')][_0xd736('0x4c')]?_0x1ac2c2[_0xd736('0x47')]:_0x159abf['model'];_0x1ac2c2[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x2b4162['query'][_0xd736('0xd3')]);_0x1ac2c2[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x2b4162[_0xd736('0x42')],_0x159abf[_0xd736('0xd0')]));if(_0x2b4162[_0xd736('0x42')][_0xd736('0x2f')]){_0x1ac2c2['where']=_['merge'](_0x1ac2c2[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x1ac2c2[_0xd736('0x47')],function(_0xf1a203){var _0x50d69c={};_0x50d69c[_0xf1a203]={'$like':'%'+_0x2b4162['query'][_0xd736('0x2f')]+'%'};return _0x50d69c;})});}_0x1ac2c2=_[_0xd736('0x56')]({},_0x1ac2c2,_0x2b4162[_0xd736('0x57')]);return _0x4d2bf0[_0xd736('0xd6')](_0x1ac2c2);}})[_0xd736('0x1b')](function(_0x2fbe66){if(_0x2fbe66){_0x1fcd9a=_0x2fbe66[_0xd736('0x4c')];if(!_0x2b4162[_0xd736('0x42')][_0xd736('0xc7')]('nolimit')){_0x1ac2c2[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x2b4162[_0xd736('0x42')][_0xd736('0x17')]);_0x1ac2c2[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x2b4162['query'][_0xd736('0x14')]);}return _0x4d2bf0['getVoiceQueuesRt'](_0x1ac2c2);}})[_0xd736('0x1b')](function(_0x320726){if(_0x320726){return _0x320726?{'count':_0x1fcd9a,'rows':_0x320726}:null;}})[_0xd736('0x1b')](respondWithResult(_0x5a791a,null))[_0xd736('0x25')](handleError(_0x5a791a,null));};exports[_0xd736('0xd9')]=function(_0x1ac4d5,_0x303063){var _0x1f3663={};var _0x84987={};var _0x4911f8;var _0x3c2223;return db['User'][_0xd736('0x93')]({'where':{'id':_0x1ac4d5[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x303063,null))[_0xd736('0x1b')](function(_0x44d28c){if(_0x44d28c){_0x4911f8=_0x44d28c;_0x84987[_0xd736('0xcc')]=_[_0xd736('0xcd')](db['ChatGroup'][_0xd736('0xcf')]);_0x84987[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x1ac4d5['query']);_0x84987[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x84987['model'],_0x84987[_0xd736('0x42')]);_0x1f3663['attributes']=_[_0xd736('0xd1')](_0x84987[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x1ac4d5[_0xd736('0x42')][_0xd736('0xd2')]));_0x1f3663[_0xd736('0x47')]=_0x1f3663['attributes'][_0xd736('0x4c')]?_0x1f3663[_0xd736('0x47')]:_0x84987[_0xd736('0xcc')];_0x1f3663[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x1ac4d5[_0xd736('0x42')]['sort']);_0x1f3663['where']=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x1ac4d5[_0xd736('0x42')],_0x84987[_0xd736('0xd0')]));if(_0x1ac4d5[_0xd736('0x42')]['filter']){_0x1f3663[_0xd736('0x40')]=_[_0xd736('0x56')](_0x1f3663[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x1f3663['attributes'],function(_0x45d93b){var _0xee9880={};_0xee9880[_0x45d93b]={'$like':'%'+_0x1ac4d5[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0xee9880;})});}_0x1f3663=_['merge']({},_0x1f3663,_0x1ac4d5[_0xd736('0x57')]);return _0x4911f8[_0xd736('0xd9')](_0x1f3663);}})[_0xd736('0x1b')](function(_0x416194){if(_0x416194){_0x3c2223=_0x416194[_0xd736('0x4c')];if(!_0x1ac4d5[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0x1f3663[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x1ac4d5[_0xd736('0x42')]['limit']);_0x1f3663['offset']=qs[_0xd736('0x14')](_0x1ac4d5[_0xd736('0x42')][_0xd736('0x14')]);}return _0x4911f8[_0xd736('0xd9')](_0x1f3663);}})[_0xd736('0x1b')](function(_0x57085c){if(_0x57085c){return _0x57085c?{'count':_0x3c2223,'rows':_0x57085c}:null;}})[_0xd736('0x1b')](respondWithResult(_0x303063,null))['catch'](handleError(_0x303063,null));};exports[_0xd736('0xdb')]=function(_0x5378d3,_0x345025){var _0xdf9fca={'raw':!![],'where':{}};var _0x17c49d={};var _0x42bf2b={'count':0x0,'rows':[]};return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x5378d3[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x345025,null))[_0xd736('0x1b')](function(_0x32446d){if(_0x32446d){_0x17c49d['model']=_[_0xd736('0xcd')](db[_0xd736('0xdc')][_0xd736('0xcf')]);_0x17c49d['query']=_[_0xd736('0xcd')](_0x5378d3[_0xd736('0x42')]);_0x17c49d[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x17c49d[_0xd736('0xcc')],_0x17c49d[_0xd736('0x42')]);_0xdf9fca[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x17c49d[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x5378d3[_0xd736('0x42')][_0xd736('0xd2')]));_0xdf9fca[_0xd736('0x47')]=_0xdf9fca[_0xd736('0x47')][_0xd736('0x4c')]?_0xdf9fca[_0xd736('0x47')]:_0x17c49d[_0xd736('0xcc')];if(!_0x5378d3['query'][_0xd736('0xc7')]('nolimit')){_0xdf9fca['limit']=qs['limit'](_0x5378d3[_0xd736('0x42')][_0xd736('0x17')]);_0xdf9fca[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x5378d3[_0xd736('0x42')][_0xd736('0x14')]);}_0xdf9fca[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x5378d3['query'][_0xd736('0xd3')]);_0xdf9fca[_0xd736('0x40')]=qs[_0xd736('0xd0')](_['pick'](_0x5378d3[_0xd736('0x42')],_0x17c49d[_0xd736('0xd0')]));_0xdf9fca[_0xd736('0x40')]['UserId']=_0x32446d['id'];if(_0x5378d3[_0xd736('0x42')][_0xd736('0x2f')]){_0xdf9fca[_0xd736('0x40')]=_['merge'](_0xdf9fca['where'],{'$or':_['map'](_0xdf9fca[_0xd736('0x47')],function(_0x346564){var _0x4fc2ab={};_0x4fc2ab[_0x346564]={'$like':'%'+_0x5378d3[_0xd736('0x42')]['filter']+'%'};return _0x4fc2ab;})});}_0xdf9fca=_[_0xd736('0x56')]({},_0xdf9fca,_0x5378d3[_0xd736('0x57')]);return db[_0xd736('0xdc')][_0xd736('0x16')]({'where':_0xdf9fca[_0xd736('0x40')]})[_0xd736('0x1b')](function(_0x37b929){_0x42bf2b[_0xd736('0x16')]=_0x37b929;if(_0x5378d3[_0xd736('0x42')][_0xd736('0x41')]){_0xdf9fca[_0xd736('0x44')]=[{'all':!![]}];}return db[_0xd736('0xdc')]['findAll'](_0xdf9fca);})['then'](function(_0x56eb27){_0x42bf2b[_0xd736('0x4a')]=_0x56eb27;return _0x42bf2b;});}})['then'](respondWithFilteredResult(_0x345025,_0xdf9fca))[_0xd736('0x25')](handleError(_0x345025,null));};exports['getScreenRecordings']=function(_0x568545,_0x259ca8){var _0x43afee={'raw':!![],'where':{}};var _0xe43949={};var _0x4eeab0={'count':0x0,'rows':[]};return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x568545['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x259ca8,null))[_0xd736('0x1b')](function(_0x164b58){if(_0x164b58){_0xe43949[_0xd736('0xcc')]=_['keys'](db['ScreenRecording'][_0xd736('0xcf')]);_0xe43949[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x568545[_0xd736('0x42')]);_0xe43949[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0xe43949[_0xd736('0xcc')],_0xe43949[_0xd736('0x42')]);_0x43afee[_0xd736('0x47')]=_[_0xd736('0xd1')](_0xe43949[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x568545['query'][_0xd736('0xd2')]));_0x43afee[_0xd736('0x47')]=_0x43afee['attributes'][_0xd736('0x4c')]?_0x43afee['attributes']:_0xe43949['model'];if(!_0x568545[_0xd736('0x42')]['hasOwnProperty'](_0xd736('0xda'))){_0x43afee['limit']=qs[_0xd736('0x17')](_0x568545['query'][_0xd736('0x17')]);_0x43afee[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x568545['query'][_0xd736('0x14')]);}_0x43afee['order']=qs[_0xd736('0xd3')](_0x568545[_0xd736('0x42')]['sort']);_0x43afee[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x568545[_0xd736('0x42')],_0xe43949[_0xd736('0xd0')]));_0x43afee['where']['UserId']=_0x164b58['id'];if(_0x568545[_0xd736('0x42')][_0xd736('0x2f')]){_0x43afee[_0xd736('0x40')]=_['merge'](_0x43afee['where'],{'$or':_[_0xd736('0x37')](_0x43afee['attributes'],function(_0x59ace6){var _0x17d5f8={};_0x17d5f8[_0x59ace6]={'$like':'%'+_0x568545['query']['filter']+'%'};return _0x17d5f8;})});}_0x43afee=_[_0xd736('0x56')]({},_0x43afee,_0x568545[_0xd736('0x57')]);return db[_0xd736('0xdd')][_0xd736('0x16')]({'where':_0x43afee['where']})['then'](function(_0x7e9c2e){_0x4eeab0[_0xd736('0x16')]=_0x7e9c2e;if(_0x568545[_0xd736('0x42')]['includeAll']){_0x43afee[_0xd736('0x44')]=[{'all':!![]}];}return db[_0xd736('0xdd')][_0xd736('0x49')](_0x43afee);})[_0xd736('0x1b')](function(_0x193e6a){_0x4eeab0[_0xd736('0x4a')]=_0x193e6a;return _0x4eeab0;});}})['then'](respondWithFilteredResult(_0x259ca8,_0x43afee))[_0xd736('0x25')](handleError(_0x259ca8,null));};exports[_0xd736('0xde')]=function(_0xd7c9b,_0x374924){var _0x1dc143={};var _0x58c39a={};var _0x168bce;var _0x2f9429;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0xd7c9b[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x374924,null))[_0xd736('0x1b')](function(_0x3b24d9){if(_0x3b24d9){_0x168bce=_0x3b24d9;_0x58c39a['model']=_[_0xd736('0xcd')](db[_0xd736('0xdf')]['rawAttributes']);_0x58c39a[_0xd736('0x42')]=_[_0xd736('0xcd')](_0xd7c9b[_0xd736('0x42')]);_0x58c39a['filters']=_[_0xd736('0xd1')](_0x58c39a[_0xd736('0xcc')],_0x58c39a['query']);_0x1dc143[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x58c39a[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0xd7c9b[_0xd736('0x42')][_0xd736('0xd2')]));_0x1dc143[_0xd736('0x47')]=_0x1dc143[_0xd736('0x47')][_0xd736('0x4c')]?_0x1dc143[_0xd736('0x47')]:_0x58c39a['model'];_0x1dc143['order']=qs[_0xd736('0xd3')](_0xd7c9b[_0xd736('0x42')]['sort']);_0x1dc143['where']=qs['filters'](_[_0xd736('0xd8')](_0xd7c9b['query'],_0x58c39a['filters']));if(_0xd7c9b['query'][_0xd736('0x2f')]){_0x1dc143[_0xd736('0x40')]=_['merge'](_0x1dc143[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x1dc143['attributes'],function(_0xc3ac4b){var _0x2826d4={};_0x2826d4[_0xc3ac4b]={'$like':'%'+_0xd7c9b[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x2826d4;})});}_0x1dc143=_[_0xd736('0x56')]({},_0x1dc143,_0xd7c9b[_0xd736('0x57')]);return _0x168bce['getChatInteractions'](_0x1dc143);}})[_0xd736('0x1b')](function(_0x39d855){if(_0x39d855){_0x2f9429=_0x39d855[_0xd736('0x4c')];if(!_0xd7c9b[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0x1dc143[_0xd736('0x17')]=qs[_0xd736('0x17')](_0xd7c9b['query'][_0xd736('0x17')]);_0x1dc143[_0xd736('0x14')]=qs['offset'](_0xd7c9b['query']['offset']);}return _0x168bce[_0xd736('0xde')](_0x1dc143);}})['then'](function(_0x7f389d){if(_0x7f389d){return _0x7f389d?{'count':_0x2f9429,'rows':_0x7f389d}:null;}})['then'](respondWithResult(_0x374924,null))[_0xd736('0x25')](handleError(_0x374924,null));};exports[_0xd736('0xe0')]=function(_0x21ae54,_0x3adc61){var _0x2783ac={};var _0x4fca45={};var _0x1f0489;var _0x3ddc8a;return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x21ae54['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x3adc61,null))[_0xd736('0x1b')](function(_0x45d380){if(_0x45d380){_0x1f0489=_0x45d380;_0x4fca45[_0xd736('0xcc')]=_['keys'](db[_0xd736('0xe1')][_0xd736('0xcf')]);_0x4fca45[_0xd736('0x42')]=_['keys'](_0x21ae54['query']);_0x4fca45[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x4fca45['model'],_0x4fca45[_0xd736('0x42')]);_0x2783ac[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x4fca45['model'],qs['fields'](_0x21ae54[_0xd736('0x42')][_0xd736('0xd2')]));_0x2783ac['attributes']=_0x2783ac[_0xd736('0x47')][_0xd736('0x4c')]?_0x2783ac[_0xd736('0x47')]:_0x4fca45['model'];_0x2783ac[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x21ae54[_0xd736('0x42')]['sort']);_0x2783ac[_0xd736('0x40')]=qs[_0xd736('0xd0')](_['pick'](_0x21ae54[_0xd736('0x42')],_0x4fca45[_0xd736('0xd0')]));if(_0x21ae54[_0xd736('0x42')][_0xd736('0x2f')]){_0x2783ac[_0xd736('0x40')]=_[_0xd736('0x56')](_0x2783ac[_0xd736('0x40')],{'$or':_['map'](_0x2783ac[_0xd736('0x47')],function(_0xe073a7){var _0xb65098={};_0xb65098[_0xe073a7]={'$like':'%'+_0x21ae54[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0xb65098;})});}_0x2783ac=_['merge']({},_0x2783ac,_0x21ae54[_0xd736('0x57')]);return _0x1f0489[_0xd736('0xe0')](_0x2783ac);}})[_0xd736('0x1b')](function(_0x2a87ee){if(_0x2a87ee){_0x3ddc8a=_0x2a87ee[_0xd736('0x4c')];if(!_0x21ae54['query'][_0xd736('0xc7')]('nolimit')){_0x2783ac[_0xd736('0x17')]=qs['limit'](_0x21ae54[_0xd736('0x42')][_0xd736('0x17')]);_0x2783ac[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x21ae54[_0xd736('0x42')][_0xd736('0x14')]);}return _0x1f0489[_0xd736('0xe0')](_0x2783ac);}})[_0xd736('0x1b')](function(_0x268920){if(_0x268920){return _0x268920?{'count':_0x3ddc8a,'rows':_0x268920}:null;}})['then'](respondWithResult(_0x3adc61,null))[_0xd736('0x25')](handleError(_0x3adc61,null));};exports['getMailInteractions']=function(_0x11f9bd,_0x55bda0){var _0x53880b={'raw':!![],'where':{}};var _0x238068={};var _0x1de9d={'count':0x0,'rows':[]};return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x11f9bd['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x55bda0,null))[_0xd736('0x1b')](function(_0x5dbc22){if(_0x5dbc22){_0x238068[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe2')][_0xd736('0xcf')]);_0x238068[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x11f9bd[_0xd736('0x42')]);_0x238068['filters']=_[_0xd736('0xd1')](_0x238068['model'],_0x238068[_0xd736('0x42')]);_0x53880b['attributes']=_[_0xd736('0xd1')](_0x238068[_0xd736('0xcc')],qs['fields'](_0x11f9bd[_0xd736('0x42')][_0xd736('0xd2')]));_0x53880b[_0xd736('0x47')]=_0x53880b[_0xd736('0x47')][_0xd736('0x4c')]?_0x53880b[_0xd736('0x47')]:_0x238068[_0xd736('0xcc')];if(!_0x11f9bd['query'][_0xd736('0xc7')](_0xd736('0xda'))){_0x53880b[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x11f9bd[_0xd736('0x42')][_0xd736('0x17')]);_0x53880b[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x11f9bd[_0xd736('0x42')]['offset']);}_0x53880b[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x11f9bd[_0xd736('0x42')][_0xd736('0xd3')]);_0x53880b[_0xd736('0x40')]=qs['filters'](_['pick'](_0x11f9bd[_0xd736('0x42')],_0x238068['filters']));_0x53880b['where'][_0xd736('0xe3')]=_0x5dbc22['id'];if(_0x11f9bd[_0xd736('0x42')][_0xd736('0x2f')]){_0x53880b[_0xd736('0x40')]=_[_0xd736('0x56')](_0x53880b['where'],{'$or':_[_0xd736('0x37')](_0x53880b[_0xd736('0x47')],function(_0x50212f){var _0x189cd6={};_0x189cd6[_0x50212f]={'$like':'%'+_0x11f9bd['query']['filter']+'%'};return _0x189cd6;})});}_0x53880b=_['merge']({},_0x53880b,_0x11f9bd[_0xd736('0x57')]);return db['MailInteraction'][_0xd736('0x16')]({'where':_0x53880b[_0xd736('0x40')]})[_0xd736('0x1b')](function(_0x137dc7){_0x1de9d[_0xd736('0x16')]=_0x137dc7;if(_0x11f9bd[_0xd736('0x42')]['includeAll']){_0x53880b[_0xd736('0x44')]=[{'all':!![]}];}return db['MailInteraction'][_0xd736('0x49')](_0x53880b);})[_0xd736('0x1b')](function(_0xb8d031){_0x1de9d['rows']=_0xb8d031;return _0x1de9d;});}})[_0xd736('0x1b')](respondWithFilteredResult(_0x55bda0,_0x53880b))[_0xd736('0x25')](handleError(_0x55bda0,null));};exports['getSmsInteractions']=function(_0x466084,_0x1be356){var _0x40e7fe={};var _0x343df7={};var _0x59eab8;var _0x376865;return db['User'][_0xd736('0x93')]({'where':{'id':_0x466084['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x1be356,null))[_0xd736('0x1b')](function(_0x5da004){if(_0x5da004){_0x59eab8=_0x5da004;_0x343df7[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe4')][_0xd736('0xcf')]);_0x343df7[_0xd736('0x42')]=_['keys'](_0x466084[_0xd736('0x42')]);_0x343df7['filters']=_[_0xd736('0xd1')](_0x343df7[_0xd736('0xcc')],_0x343df7[_0xd736('0x42')]);_0x40e7fe['attributes']=_[_0xd736('0xd1')](_0x343df7[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x466084[_0xd736('0x42')]['fields']));_0x40e7fe[_0xd736('0x47')]=_0x40e7fe[_0xd736('0x47')]['length']?_0x40e7fe[_0xd736('0x47')]:_0x343df7['model'];_0x40e7fe[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x466084[_0xd736('0x42')][_0xd736('0xd3')]);_0x40e7fe['where']=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x466084[_0xd736('0x42')],_0x343df7[_0xd736('0xd0')]));if(_0x466084[_0xd736('0x42')][_0xd736('0x2f')]){_0x40e7fe[_0xd736('0x40')]=_[_0xd736('0x56')](_0x40e7fe[_0xd736('0x40')],{'$or':_['map'](_0x40e7fe[_0xd736('0x47')],function(_0x30c22b){var _0x2fb4c4={};_0x2fb4c4[_0x30c22b]={'$like':'%'+_0x466084[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x2fb4c4;})});}_0x40e7fe=_[_0xd736('0x56')]({},_0x40e7fe,_0x466084[_0xd736('0x57')]);return _0x59eab8[_0xd736('0xe5')](_0x40e7fe);}})['then'](function(_0x25a38b){if(_0x25a38b){_0x376865=_0x25a38b[_0xd736('0x4c')];if(!_0x466084[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0x40e7fe[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x466084[_0xd736('0x42')][_0xd736('0x17')]);_0x40e7fe[_0xd736('0x14')]=qs[_0xd736('0x14')](_0x466084['query'][_0xd736('0x14')]);}return _0x59eab8['getSmsInteractions'](_0x40e7fe);}})['then'](function(_0x56d564){if(_0x56d564){return _0x56d564?{'count':_0x376865,'rows':_0x56d564}:null;}})[_0xd736('0x1b')](respondWithResult(_0x1be356,null))['catch'](handleError(_0x1be356,null));};exports['getFaxInteractions']=function(_0x4586d7,_0x5c48b6){var _0x147ca6={};var _0x4a004b={};var _0x483024;var _0x2771ee;return db[_0xd736('0x36')]['findOne']({'where':{'id':_0x4586d7[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x5c48b6,null))['then'](function(_0x7eb515){if(_0x7eb515){_0x483024=_0x7eb515;_0x4a004b[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe6')][_0xd736('0xcf')]);_0x4a004b[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x4586d7[_0xd736('0x42')]);_0x4a004b['filters']=_[_0xd736('0xd1')](_0x4a004b[_0xd736('0xcc')],_0x4a004b['query']);_0x147ca6[_0xd736('0x47')]=_['intersection'](_0x4a004b[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x4586d7['query']['fields']));_0x147ca6[_0xd736('0x47')]=_0x147ca6['attributes'][_0xd736('0x4c')]?_0x147ca6[_0xd736('0x47')]:_0x4a004b['model'];_0x147ca6[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x4586d7['query']['sort']);_0x147ca6[_0xd736('0x40')]=qs['filters'](_[_0xd736('0xd8')](_0x4586d7[_0xd736('0x42')],_0x4a004b[_0xd736('0xd0')]));if(_0x4586d7['query'][_0xd736('0x2f')]){_0x147ca6['where']=_[_0xd736('0x56')](_0x147ca6[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x147ca6[_0xd736('0x47')],function(_0x14fe62){var _0x5338f9={};_0x5338f9[_0x14fe62]={'$like':'%'+_0x4586d7[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x5338f9;})});}_0x147ca6=_[_0xd736('0x56')]({},_0x147ca6,_0x4586d7[_0xd736('0x57')]);return _0x483024[_0xd736('0xe7')](_0x147ca6);}})['then'](function(_0x456369){if(_0x456369){_0x2771ee=_0x456369[_0xd736('0x4c')];if(!_0x4586d7['query'][_0xd736('0xc7')]('nolimit')){_0x147ca6['limit']=qs[_0xd736('0x17')](_0x4586d7[_0xd736('0x42')][_0xd736('0x17')]);_0x147ca6['offset']=qs[_0xd736('0x14')](_0x4586d7['query']['offset']);}return _0x483024[_0xd736('0xe7')](_0x147ca6);}})[_0xd736('0x1b')](function(_0x1bab59){if(_0x1bab59){return _0x1bab59?{'count':_0x2771ee,'rows':_0x1bab59}:null;}})[_0xd736('0x1b')](respondWithResult(_0x5c48b6,null))[_0xd736('0x25')](handleError(_0x5c48b6,null));};exports[_0xd736('0xe8')]=function(_0x3f08b4,_0x7321f9){var _0xb29c9b={};var _0x50729d={};var _0x59987e;var _0x2f2fe4;return db['User'][_0xd736('0x93')]({'where':{'id':_0x3f08b4[_0xd736('0x55')]['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x7321f9,null))['then'](function(_0x5917f1){if(_0x5917f1){_0x59987e=_0x5917f1;_0x50729d[_0xd736('0xcc')]=_[_0xd736('0xcd')](db[_0xd736('0xe9')]['rawAttributes']);_0x50729d[_0xd736('0x42')]=_['keys'](_0x3f08b4[_0xd736('0x42')]);_0x50729d[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x50729d['model'],_0x50729d['query']);_0xb29c9b[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x50729d[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x3f08b4['query'][_0xd736('0xd2')]));_0xb29c9b[_0xd736('0x47')]=_0xb29c9b[_0xd736('0x47')][_0xd736('0x4c')]?_0xb29c9b[_0xd736('0x47')]:_0x50729d['model'];_0xb29c9b[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x3f08b4[_0xd736('0x42')]['sort']);_0xb29c9b[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x3f08b4['query'],_0x50729d[_0xd736('0xd0')]));if(_0x3f08b4[_0xd736('0x42')][_0xd736('0x2f')]){_0xb29c9b['where']=_[_0xd736('0x56')](_0xb29c9b[_0xd736('0x40')],{'$or':_['map'](_0xb29c9b[_0xd736('0x47')],function(_0x13ef72){var _0x500a90={};_0x500a90[_0x13ef72]={'$like':'%'+_0x3f08b4[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x500a90;})});}_0xb29c9b=_['merge']({},_0xb29c9b,_0x3f08b4['options']);return _0x59987e[_0xd736('0xe8')](_0xb29c9b);}})[_0xd736('0x1b')](function(_0x5d0c33){if(_0x5d0c33){_0x2f2fe4=_0x5d0c33[_0xd736('0x4c')];if(!_0x3f08b4[_0xd736('0x42')][_0xd736('0xc7')](_0xd736('0xda'))){_0xb29c9b[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x3f08b4[_0xd736('0x42')]['limit']);_0xb29c9b['offset']=qs['offset'](_0x3f08b4[_0xd736('0x42')][_0xd736('0x14')]);}return _0x59987e[_0xd736('0xe8')](_0xb29c9b);}})[_0xd736('0x1b')](function(_0x2f0faf){if(_0x2f0faf){return _0x2f0faf?{'count':_0x2f2fe4,'rows':_0x2f0faf}:null;}})[_0xd736('0x1b')](respondWithResult(_0x7321f9,null))[_0xd736('0x25')](handleError(_0x7321f9,null));};exports[_0xd736('0xea')]=function(_0x5db368,_0x3f132d,_0x579a48){var _0x427ab1;var _0x248828;var _0x57503e;var _0x3ef070=!_[_0xd736('0x64')](_0x5db368[_0xd736('0x55')]['id'])?_0x5db368[_0xd736('0x55')]['id']:!_[_0xd736('0x64')](_0x5db368[_0xd736('0x2d')]['id'])?_0x5db368[_0xd736('0x2d')]['id']:null;return db[_0xd736('0x36')][_0xd736('0x32')]({'where':{'id':_0x3ef070,'role':{'$or':['admin',_0xd736('0x2d'),_0xd736('0x28')]}},'attributes':['id',_0xd736('0x33'),_0xd736('0xeb'),_0xd736('0xec'),_0xd736('0x27'),_0xd736('0x5e'),_0xd736('0xed')]})[_0xd736('0x1b')](function(_0xfe4ec8){if(_0xfe4ec8){if(_0xfe4ec8[_0xd736('0x27')]===_0xd736('0x28')){_0x427ab1=_0xfe4ec8;if(_0x5db368['body'][_0xd736('0xa8')]){_0x57503e=util[_0xd736('0xa9')](_0xd736('0xee'),_0x427ab1[_0x5db368[_0xd736('0x59')][_0xd736('0xa8')]]);}else if(_0x5db368[_0xd736('0x59')][_0xd736('0xef')]){_0x57503e=util['format'](_0xd736('0xf0'),_0x5db368['body'][_0xd736('0xef')]);}else{_0x57503e=util[_0xd736('0xa9')](_0xd736('0xf0'),_0x427ab1[_0xd736('0x33')]);}socket['to'](util[_0xd736('0xa9')](_0xd736('0xf1'),_0x427ab1['name']))[_0xd736('0xa5')](_0xd736('0xf2'),{'user':{'id':_0x427ab1['id'],'name':_0x427ab1[_0xd736('0x33')]},'ip':_0x5db368[_0xd736('0xf3')][_0xd736('0xf4')]||_0x5db368['connection'][_0xd736('0xf5')]||_0x5db368[_0xd736('0xf6')][_0xd736('0xf5')]||_0x5db368[_0xd736('0xf7')][_0xd736('0xf6')]['remoteAddress']});return new Promise(function(_0x3ae0cd,_0x298ce1){db[_0xd736('0x66')]['transaction']()[_0xd736('0x1b')](_0x4b87a1=>{db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x427ab1[_0xd736('0x33')]},'individualHooks':!![]},{'transaction':_0x4b87a1})[_0xd736('0x1b')](function(){return _0x4b87a1[_0xd736('0xf8')]();})[_0xd736('0x1b')](_0x3ae0cd)['catch'](_0x298ce1);});});}}else{throw new db[(_0xd736('0x8c'))]['ValidationError'](_0xd736('0xf9'));}})[_0xd736('0x1b')](function(){if(_0x427ab1){return _0x427ab1['getVoiceQueues']({'raw':!![]});}})[_0xd736('0x1b')](function(_0x5b8b11){if(_0x427ab1){if(_0x5b8b11){_0x248828=_0x5b8b11;if(_0x248828[_0xd736('0x4c')]){var _0x288a10=_0x248828[_0xd736('0x37')](function(_0x343a71){return{'membername':_0x427ab1['name'],'UserId':_0x427ab1['id'],'queue_name':_0x343a71['name'],'VoiceQueueId':_0x343a71['id'],'interface':_0x57503e,'paused':_0x427ab1['loginInPause']||![],'penalty':_0x343a71[_0xd736('0xfa')]||0x0};});return db['UserVoiceQueueRt'][_0xd736('0x83')](_0x288a10);}}}})[_0xd736('0x1b')](function(){if(_0x427ab1){return db[_0xd736('0xfb')]['findAll']({'where':{'membername':_0x427ab1['name'],'exitAt':null}});}})[_0xd736('0x1b')](function(_0x2a41cd){if(_0x427ab1){var _0x38452d=[];_0x2a41cd[_0xd736('0xfc')](function(_0x10a581){_0x38452d['push'](_0x10a581['update']({'exitAt':moment()[_0xd736('0xa9')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xd736('0x53')](_0x38452d);}})[_0xd736('0x1b')](function(){if(_0x427ab1){var _0x484514=[];var _0x823445=[];var _0xa1e0d8=utils['getChannels']();var _0x20498e={'membername':_0x427ab1[_0xd736('0x33')],'interface':_0x57503e,'enterAt':moment()[_0xd736('0xa9')](_0xd736('0xfd')),'role':_0x427ab1[_0xd736('0x27')],'internal':_0x427ab1['internal']};_0xa1e0d8[_0xd736('0xfc')](function(_0x649016){_0x484514['push'](_[_0xd736('0x56')]({'channel':_0x649016,'type':_0xd736('0xfe'),'data1':_0x5db368[_0xd736('0x59')][_0xd736('0xff')],'data2':_0x57503e},_0x20498e));if(_0x427ab1[_0xd736('0xed')]){_0x823445[_0xd736('0x48')](_[_0xd736('0x56')]({'channel':_0x649016,'type':'PAUSE','data1':'LOGININPAUSE'},_0x20498e));}});return db[_0xd736('0xfb')][_0xd736('0x83')](_0x484514[_0xd736('0xc5')](_0x823445),{'individualHooks':!![]});}})[_0xd736('0x1b')](function(){if(_0x427ab1){return _0x427ab1[_0xd736('0x26')]({'online':!![],'lastLoginAt':moment()[_0xd736('0xa9')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x427ab1[_0xd736('0xed')]||![],'mailPause':_0x427ab1['loginInPause']||![],'chatPause':_0x427ab1[_0xd736('0xed')]||![],'faxPause':_0x427ab1[_0xd736('0xed')]||![],'smsPause':_0x427ab1[_0xd736('0xed')]||![],'openchannelPause':_0x427ab1['loginInPause']||![],'whatsappPause':_0x427ab1['loginInPause']||![],'pauseType':_0x427ab1[_0xd736('0xed')]?_0xd736('0x100'):null,'interface':_0x57503e,'lastPauseAt':moment()[_0xd736('0xa9')](_0xd736('0xfd'))});}})[_0xd736('0x1b')](function(_0x3bb29c){if(_0x5db368['isMiddleware']){return _0x579a48();}else{return Promise['resolve'](_0x3bb29c)[_0xd736('0x1b')](respondWithResult(_0x3f132d,null));}})[_0xd736('0x25')](handleError(_0x3f132d,null));};exports[_0xd736('0x101')]=function(_0x392277,_0x25a657){var _0x1b3680;return db['User'][_0xd736('0x32')]({'where':{'id':_0x392277[_0xd736('0x55')]['id'],'role':_0xd736('0x28')},'attributes':['id',_0xd736('0x33'),_0xd736('0x27')]})['then'](handleEntityNotFound(_0x25a657,null))[_0xd736('0x1b')](function(_0x219894){if(_0x219894){_0x1b3680=_0x219894;return db[_0xd736('0xaa')][_0xd736('0x2a')]({'where':{'membername':_0x1b3680[_0xd736('0x33')]},'individualHooks':!![]});}})['then'](function(){return db[_0xd736('0xfb')][_0xd736('0x49')]({'where':{'membername':_0x1b3680['name'],'exitAt':null}});})[_0xd736('0x1b')](function(_0x30a187){var _0x1346fb=[];_0x30a187[_0xd736('0xfc')](function(_0x15e79b){_0x1346fb[_0xd736('0x48')](_0x15e79b[_0xd736('0x26')]({'exitAt':moment()['format'](_0xd736('0xfd'))}));});return Promise[_0xd736('0x53')](_0x1346fb);})['then'](function(){return _0x1b3680[_0xd736('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x25a657,null))[_0xd736('0x25')](handleError(_0x25a657,null));};exports[_0xd736('0x102')]=function(_0x47f9f3,_0x3bce06){var _0xf50421;return db[_0xd736('0xaa')][_0xd736('0x26')]({'paused':0x1},{'where':{'UserId':_0x47f9f3[_0xd736('0x55')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xd736('0x36')]['find']({'where':{'id':_0x47f9f3[_0xd736('0x55')]['id'],'role':_0xd736('0x28')},'attributes':['id','name','role',_0xd736('0x5e'),_0xd736('0xa8'),_0xd736('0x9a')]});})[_0xd736('0x1b')](handleEntityNotFound(_0x3bce06,null))[_0xd736('0x1b')](function(_0x440c7d){if(_0x440c7d){_0xf50421=_0x440c7d;return respondWithRpcPromise(_0xd736('0x103'),_0xd736('0x102'),{'id':_0xf50421['id'],'name':_0xf50421[_0xd736('0x33')],'pause':!![]});}})['then'](function(){if(_0xf50421){return db[_0xd736('0xfb')][_0xd736('0x49')]({'where':{'membername':_0xf50421[_0xd736('0x33')],'type':'PAUSE','exitAt':null}});}})[_0xd736('0x1b')](function(_0x165264){if(_0x165264[_0xd736('0x4c')]){var _0x49010d=moment()[_0xd736('0xa9')](_0xd736('0xfd'));for(var _0x36daa6=0x0,_0x50a6bc=_0x165264[_0xd736('0x4c')];_0x36daa6<_0x50a6bc;_0x36daa6++){_0x165264[_0x36daa6]['updateAttributes']({'exitAt':_0x49010d});}}})[_0xd736('0x1b')](function(){var _0x4ee142=[];var _0x21f22e=utils[_0xd736('0x104')]();_0x21f22e[_0xd736('0xfc')](function(_0x5c1e7e){_0x4ee142[_0xd736('0x48')]({'channel':_0x5c1e7e,'membername':_0xf50421['name'],'interface':_[_0xd736('0x64')](_0xf50421[_0xd736('0xa8')])?util[_0xd736('0xa9')](_0xd736('0xf0'),_0xf50421[_0xd736('0x33')]):_0xf50421[_0xd736('0xa8')],'type':_0xd736('0x105'),'enterAt':moment()[_0xd736('0xa9')](_0xd736('0xfd')),'data1':_0x47f9f3['body'][_0xd736('0x39')]||_0xd736('0x106'),'role':_0xf50421[_0xd736('0x27')],'internal':_0xf50421['internal']});});return db[_0xd736('0xfb')]['bulkCreate'](_0x4ee142,{'individualHooks':!![]});})['then'](function(){return _0xf50421[_0xd736('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x47f9f3['body'][_0xd736('0x39')]||_0xd736('0x106'),'lastPauseAt':moment()[_0xd736('0xa9')](_0xd736('0xfd'))});})[_0xd736('0x1b')](respondWithResult(_0x3bce06,null))[_0xd736('0x25')](handleError(_0x3bce06,null));};exports[_0xd736('0x107')]=function(_0xef0ecd,_0x4dd7a4){if(_0xef0ecd[_0xd736('0x59')][_0xd736('0x99')]&&!utils[_0xd736('0x9c')](_0xef0ecd['body'][_0xd736('0x99')])){throw new APIBadRequestError(util[_0xd736('0xa9')](_0xd736('0x108'),_0xef0ecd[_0xd736('0x59')][_0xd736('0x99')]));}return db[_0xd736('0x36')]['find']({'where':{'id':_0xef0ecd[_0xd736('0x55')]['id']},'attributes':['id',_0xd736('0x33'),_0xd736('0x27'),_0xd736('0x5e'),_0xd736('0xa8'),_0xd736('0x9a'),_0xd736('0x9b'),_0xd736('0x109'),_0xd736('0x10a'),_0xd736('0x10b'),_0xd736('0x10c'),_0xd736('0x10d'),_0xd736('0x10e'),_0xd736('0x10f'),_0xd736('0x110')]})[_0xd736('0x1b')](function(_0x3c456a){if(!_0x3c456a){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0xef0ecd[_0xd736('0x55')]['id']));}return _0x3c456a[_0xd736('0x107')](_0xef0ecd[_0xd736('0x59')][_0xd736('0x99')]);})['then'](respondWithResult(_0x4dd7a4,null))[_0xd736('0x25')](APIHandleError(_0x4dd7a4));};exports['getTeams']=function(_0x503253,_0x455779){var _0x2d812c={};var _0x1cbbfe={};var _0x42a2c9;var _0x560151;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x503253[_0xd736('0x55')]['id']}})['then'](handleEntityNotFound(_0x455779,null))[_0xd736('0x1b')](function(_0x110cf2){if(_0x110cf2){_0x42a2c9=_0x110cf2;_0x1cbbfe['model']=_[_0xd736('0xcd')](db[_0xd736('0x111')][_0xd736('0xcf')]);_0x1cbbfe[_0xd736('0x42')]=_[_0xd736('0xcd')](_0x503253[_0xd736('0x42')]);_0x1cbbfe[_0xd736('0xd0')]=_[_0xd736('0xd1')](_0x1cbbfe['model'],_0x1cbbfe['query']);_0x2d812c[_0xd736('0x47')]=_[_0xd736('0xd1')](_0x1cbbfe[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x503253[_0xd736('0x42')][_0xd736('0xd2')]));_0x2d812c[_0xd736('0x47')]=_0x2d812c[_0xd736('0x47')][_0xd736('0x4c')]?_0x2d812c[_0xd736('0x47')]:_0x1cbbfe['model'];_0x2d812c[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x503253[_0xd736('0x42')][_0xd736('0xd3')]);_0x2d812c['where']=qs['filters'](_[_0xd736('0xd8')](_0x503253['query'],_0x1cbbfe['filters']));if(_0x503253[_0xd736('0x42')][_0xd736('0x2f')]){_0x2d812c[_0xd736('0x40')]=_[_0xd736('0x56')](_0x2d812c[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x2d812c[_0xd736('0x47')],function(_0x149fa0){var _0x10ce5f={};_0x10ce5f[_0x149fa0]={'$like':'%'+_0x503253['query'][_0xd736('0x2f')]+'%'};return _0x10ce5f;})});}_0x2d812c=_[_0xd736('0x56')]({},_0x2d812c,_0x503253[_0xd736('0x57')]);return _0x42a2c9['getTeams'](_0x2d812c);}})[_0xd736('0x1b')](function(_0x142e88){if(_0x142e88){_0x560151=_0x142e88[_0xd736('0x4c')];if(!_0x503253['query'][_0xd736('0xc7')](_0xd736('0xda'))){_0x2d812c[_0xd736('0x17')]=qs[_0xd736('0x17')](_0x503253[_0xd736('0x42')][_0xd736('0x17')]);_0x2d812c[_0xd736('0x14')]=qs['offset'](_0x503253[_0xd736('0x42')][_0xd736('0x14')]);}return _0x42a2c9['getTeams'](_0x2d812c);}})[_0xd736('0x1b')](function(_0x3120ef){if(_0x3120ef){return _0x3120ef?{'count':_0x560151,'rows':_0x3120ef}:null;}})['then'](respondWithResult(_0x455779,null))[_0xd736('0x25')](handleError(_0x455779,null));};exports[_0xd736('0x112')]=function(_0x4388dc,_0xa5e31d){var _0x3c07ed=_0x4388dc[_0xd736('0x55')]['id'];var _0x2e7c86=_0x4388dc[_0xd736('0x59')]?_0x4388dc['body'][_0xd736('0x5c')]:null;var _0xbd18e6=[];return Promise[_0xd736('0x113')]()[_0xd736('0x1b')](function(){if(!_0x2e7c86)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd736('0x1b')](function(){return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x3c07ed}});})['then'](function(_0x1fabb5){if(!_0x1fabb5)throw new APINotFoundError(util[_0xd736('0xa9')](_0xd736('0xc6'),_0x4388dc[_0xd736('0x55')]['id']));return db[_0xd736('0x66')][_0xd736('0x114')](function(_0x40d0cc){return _0x1fabb5['addTeams'](_0x2e7c86,{'transaction':_0x40d0cc})['then'](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x2e7c86}}});})[_0xd736('0x1b')](function(_0x4b6896){var _0x29d0c2=_[_0xd736('0x37')](_0x4b6896,function(_0x27cb99){return _0x27cb99[_0xd736('0x115')]();});return Promise[_0xd736('0x53')](_0x29d0c2);})['then'](function(_0x400068){_0xbd18e6=_['flattenDeep'](_0x400068);var _0x190894=_['map'](_0xbd18e6,function(_0x3dbaac){return _0x3dbaac[_0xd736('0x116')](_0x1fabb5['id'],{'transaction':_0x40d0cc});});return Promise[_0xd736('0x53')](_0x190894);})['then'](function(){if(!_0x1fabb5[_0xd736('0x9a')])return;var _0x32f32c=_['filter'](_0xbd18e6,function(_0x1c2d13){return _0x1c2d13[_0xd736('0x117')](_0xd736('0x99'))===_0xd736('0x118');});var _0x2b16ba=_['map'](_0x32f32c,function(_0x55e7a7){return db[_0xd736('0xaa')][_0xd736('0x119')]({'membername':_0x1fabb5[_0xd736('0x33')],'UserId':_0x1fabb5['id'],'queue_name':_0x55e7a7[_0xd736('0x33')],'VoiceQueueId':_0x55e7a7['id'],'interface':_[_0xd736('0x64')](_0x1fabb5[_0xd736('0xa8')])?util['format'](_0xd736('0xf0'),_0x1fabb5[_0xd736('0x33')]):_0x1fabb5[_0xd736('0xa8')],'paused':_0x1fabb5[_0xd736('0x9b')]||![],'penalty':_0x1fabb5[_0xd736('0xa2')]},{'transaction':_0x40d0cc});});return Promise['all'](_0x2b16ba);})['then'](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x2e7c86}}});})[_0xd736('0x1b')](function(_0x25edce){var _0x606a4a=_[_0xd736('0x37')](_0x25edce,function(_0xf5d3a8){return db[_0xd736('0x11a')][_0xd736('0x7b')]({'UserId':_0x1fabb5['id'],'VoicePrefixId':_0xf5d3a8['VoicePrefixId']},{'transaction':_0x40d0cc});});return Promise['all'](_0x606a4a);});});})[_0xd736('0x1b')](function(){for(var _0x2a750a=0x0;_0x2a750a<_0xbd18e6[_0xd736('0x4c')];_0x2a750a++){var _0xf1cc61=_0xbd18e6[_0x2a750a]['getDataValue'](_0xd736('0x99'));var _0x4d0a48=_0xf1cc61+_0xd736('0xa4');socket['emit'](_0xd736('0x2d')+_0xf1cc61+_0xd736('0xa6'),{'UserId':_0x3c07ed,['queueField']:_0xbd18e6[_0x2a750a]['id']});}})[_0xd736('0x1b')](respondWithStatusCode(_0xa5e31d,null))['catch'](APIHandleError(_0xa5e31d));};exports[_0xd736('0x11b')]=function(_0x579f12,_0x310d08){var _0x991094=_0x579f12[_0xd736('0x55')]['id'];var _0xf484b2=null;if(_0x579f12[_0xd736('0x42')][_0xd736('0x5c')]){_0xf484b2=_[_0xd736('0x11c')](_0x579f12[_0xd736('0x42')][_0xd736('0x5c')])?_0x579f12[_0xd736('0x42')]['ids']:[_0x579f12[_0xd736('0x42')][_0xd736('0x5c')]];}var _0x46e84a=[];return Promise[_0xd736('0x113')]()['then'](function(){if(!_0xf484b2)throw new APIBadRequestError('Query\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0xd736('0x1b')](function(){return db['User'][_0xd736('0x93')]({'where':{'id':_0x991094}});})['then'](function(_0x4c645e){if(!_0x4c645e)throw new APINotFoundError(util['format'](_0xd736('0xc6'),_0x579f12[_0xd736('0x55')]['id']));return db[_0xd736('0x66')][_0xd736('0x114')](function(_0x1b8e50){return _0x4c645e[_0xd736('0x11b')](_0xf484b2,{'transaction':_0x1b8e50})['then'](function(){return db[_0xd736('0x111')][_0xd736('0x49')]({'where':{'id':{'$in':_0xf484b2}}});})[_0xd736('0x1b')](function(_0x514c99){var _0x387466=_['map'](_0x514c99,function(_0x1af0ce){return _0x1af0ce['getAssociatedQueues']();});return Promise[_0xd736('0x53')](_0x387466);})[_0xd736('0x1b')](function(_0x728faa){_0x46e84a=_[_0xd736('0x11d')](_0x728faa);var _0x4a7ecb=_['map'](_0x46e84a,function(_0x37eb94){return _0x37eb94[_0xd736('0x11e')](_0x4c645e['id'],{'transaction':_0x1b8e50});});return Promise[_0xd736('0x53')](_0x4a7ecb);})[_0xd736('0x1b')](function(){if(!_0x4c645e[_0xd736('0x9a')])return;var _0x3dfdab=_[_0xd736('0x2f')](_0x46e84a,function(_0x5bb74d){return _0x5bb74d['getDataValue'](_0xd736('0x99'))==='Voice';});var _0x207f3b=_[_0xd736('0x37')](_0x3dfdab,function(_0x3a62ed){return db['UserVoiceQueueRt'][_0xd736('0x2a')]({'where':{'VoiceQueueId':_0x3a62ed['id'],'UserId':_0x4c645e['id']},'transaction':_0x1b8e50});});return Promise[_0xd736('0x53')](_0x207f3b);})['then'](function(){return db[_0xd736('0x11f')]['findAll']({'where':{'teamId':{'$in':_0xf484b2}}});})[_0xd736('0x1b')](function(_0x4861c1){var _0x1ad5ae=_[_0xd736('0x37')](_0x4861c1,function(_0x20d53e){return db[_0xd736('0x11a')][_0xd736('0x2a')]({'where':{'UserId':_0x4c645e['id'],'VoicePrefixId':_0x20d53e[_0xd736('0x120')]}},{'transaction':_0x1b8e50});});return Promise[_0xd736('0x53')](_0x1ad5ae);});});})[_0xd736('0x1b')](function(){for(var _0x3792f8=0x0;_0x3792f8<_0x46e84a[_0xd736('0x4c')];_0x3792f8++){var _0xa015c7=_0x46e84a[_0x3792f8]['getDataValue'](_0xd736('0x99'));var _0x15fc10=_0xa015c7+'QueueId';socket['emit']('user'+_0xa015c7+_0xd736('0xad'),{'UserId':_0x991094,['queueField']:_0x46e84a[_0x3792f8]['id']});}})[_0xd736('0x1b')](respondWithStatusCode(_0x310d08,null))[_0xd736('0x25')](APIHandleError(_0x310d08));};exports[_0xd736('0x121')]=function(_0x1704bd,_0x59c952){var _0x932f3c={};var _0x5521dc={};var _0x4be697;var _0x100c01;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x1704bd['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x59c952,null))[_0xd736('0x1b')](function(_0x1a5b34){if(_0x1a5b34){_0x4be697=_0x1a5b34;_0x5521dc[_0xd736('0xcc')]=_[_0xd736('0xcd')](db['CmList'][_0xd736('0xcf')]);_0x5521dc['query']=_[_0xd736('0xcd')](_0x1704bd['query']);_0x5521dc['filters']=_['intersection'](_0x5521dc[_0xd736('0xcc')],_0x5521dc[_0xd736('0x42')]);_0x932f3c['attributes']=_[_0xd736('0xd1')](_0x5521dc[_0xd736('0xcc')],qs['fields'](_0x1704bd[_0xd736('0x42')][_0xd736('0xd2')]));_0x932f3c['attributes']=_0x932f3c['attributes'][_0xd736('0x4c')]?_0x932f3c['attributes']:_0x5521dc[_0xd736('0xcc')];_0x932f3c['order']=qs['sort'](_0x1704bd[_0xd736('0x42')]['sort']);_0x932f3c[_0xd736('0x40')]=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x1704bd[_0xd736('0x42')],_0x5521dc[_0xd736('0xd0')]));if(_0x1704bd[_0xd736('0x42')]['filter']){_0x932f3c[_0xd736('0x40')]=_[_0xd736('0x56')](_0x932f3c[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x932f3c[_0xd736('0x47')],function(_0x3eb929){var _0x509fe8={};_0x509fe8[_0x3eb929]={'$like':'%'+_0x1704bd['query'][_0xd736('0x2f')]+'%'};return _0x509fe8;})});}_0x932f3c=_[_0xd736('0x56')]({},_0x932f3c,_0x1704bd[_0xd736('0x57')]);return _0x4be697[_0xd736('0x121')](_0x932f3c);}})[_0xd736('0x1b')](function(_0x2b698e){if(_0x2b698e){_0x100c01=_0x2b698e[_0xd736('0x4c')];if(!_0x1704bd[_0xd736('0x42')]['hasOwnProperty'](_0xd736('0xda'))){_0x932f3c[_0xd736('0x17')]=qs['limit'](_0x1704bd[_0xd736('0x42')][_0xd736('0x17')]);_0x932f3c['offset']=qs[_0xd736('0x14')](_0x1704bd[_0xd736('0x42')]['offset']);}return _0x4be697[_0xd736('0x121')](_0x932f3c);}})['then'](function(_0x3ad132){if(_0x3ad132){return _0x3ad132?{'count':_0x100c01,'rows':_0x3ad132}:null;}})['then'](respondWithResult(_0x59c952,null))[_0xd736('0x25')](handleError(_0x59c952,null));};exports[_0xd736('0x122')]=function(_0x4208bb,_0x1639f9){var _0x31076d={};var _0x5d7def={};var _0x40ae7a;return db[_0xd736('0x36')][_0xd736('0x93')]({'where':{'id':_0x4208bb['params']['id']}})[_0xd736('0x1b')](handleEntityNotFound(_0x1639f9,null))[_0xd736('0x1b')](function(_0x5be96f){if(_0x5be96f){_0x40ae7a=_0x5be96f;_0x5d7def['model']=_[_0xd736('0xcd')](db[_0xd736('0x36')]['rawAttributes']);_0x5d7def['query']=_[_0xd736('0xcd')](_0x4208bb[_0xd736('0x42')]);_0x5d7def[_0xd736('0xd0')]=_['intersection'](_0x5d7def[_0xd736('0xcc')],_0x5d7def['query']);_0x31076d['attributes']=_[_0xd736('0xd1')](_0x5d7def[_0xd736('0xcc')],qs[_0xd736('0xd2')](_0x4208bb['query'][_0xd736('0xd2')]));_0x31076d[_0xd736('0x47')]=_0x31076d[_0xd736('0x47')][_0xd736('0x4c')]?_0x31076d[_0xd736('0x47')]:_0x5d7def['model'];_0x31076d[_0xd736('0xd7')]=qs[_0xd736('0xd3')](_0x4208bb['query'][_0xd736('0xd3')]);_0x31076d['where']=qs[_0xd736('0xd0')](_[_0xd736('0xd8')](_0x4208bb[_0xd736('0x42')],_0x5d7def[_0xd736('0xd0')]));if(_0x4208bb[_0xd736('0x42')][_0xd736('0x2f')]){_0x31076d[_0xd736('0x40')]=_[_0xd736('0x56')](_0x31076d[_0xd736('0x40')],{'$or':_[_0xd736('0x37')](_0x31076d[_0xd736('0x47')],function(_0x17b79e){var _0x50f84f={};_0x50f84f[_0x17b79e]={'$like':'%'+_0x4208bb[_0xd736('0x42')][_0xd736('0x2f')]+'%'};return _0x50f84f;})});}_0x31076d[_0xd736('0xcc')]=db['User'];_0x31076d['as']=_0xd736('0x2e');_0x31076d=_['merge']({},_0x31076d,_0x4208bb['options']);return _0x40ae7a[_0xd736('0x123')]({'include':[_0x31076d]});}})[_0xd736('0x1b')](function(_0x4f44fa){if(_0x4f44fa){var _0x547e8a={},_0x14d409=[];for(var _0x942491=0x0;_0x942491<_0x4f44fa['length'];_0x942491+=0x1){for(var _0x1b08d6=0x0,_0x5d2dab;_0x1b08d6<_0x4f44fa[_0x942491][_0xd736('0x2e')][_0xd736('0x4c')];_0x1b08d6+=0x1){_0x5d2dab=_0x4f44fa[_0x942491][_0xd736('0x2e')][_0x1b08d6][_0xd736('0xd4')]({'plain':!![]});_0x547e8a[_0x5d2dab['id']]=_0x5d2dab;}}_0x547e8a=_[_0xd736('0x124')](_0x547e8a);for(var _0x5d4d74=qs['offset'](_0x4208bb[_0xd736('0x42')][_0xd736('0x14')]);_0x5d4d74<_0x547e8a['length']&&_0x14d409[_0xd736('0x4c')]=_0x2b1771[_0x44c5('0x4e')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x44c5('0x16')](function(){if(_0x21b1be){return db[_0x44c5('0x26')][_0x44c5('0x44')]({'where':{'membername':_0x21b1be['name']},'individualHooks':!![]});}})[_0x44c5('0x16')](function(){if(_0x21b1be){return _0x21b1be[_0x44c5('0x4f')]({'raw':!![]});}})[_0x44c5('0x16')](function(_0x2695cd){if(_0x21b1be){if(_0x2695cd){var _0x3ea16d=[];_0x262754=_0x2695cd;if(_0x262754[_0x44c5('0x2a')]){for(var _0x56496b=0x0;_0x56496b<_0x262754['length'];_0x56496b++){_0x3ea16d['push'](db[_0x44c5('0x26')]['upsert']({'membername':_0x21b1be['name'],'UserId':_0x21b1be['id'],'queue_name':_0x262754[_0x56496b]['name'],'VoiceQueueId':_0x262754[_0x56496b]['id'],'interface':_0x58cc65,'paused':_0x21b1be['loginInPause']||![],'penalty':_0x262754[_0x56496b][_0x44c5('0x50')]||0x0}));}return BPromise[_0x44c5('0x46')](_0x3ea16d);}}}})[_0x44c5('0x16')](function(){if(_0x21b1be){return db[_0x44c5('0x27')][_0x44c5('0x51')]({'where':{'membername':_0x21b1be['name'],'exitAt':null}});}})[_0x44c5('0x16')](function(_0x45b781){if(_0x21b1be){if(_0x45b781&&_0x45b781[_0x44c5('0x2a')]){var _0x4c4471=[];_0x45b781[_0x44c5('0x45')](function(_0x9821d9){_0x4c4471['push'](_0x9821d9[_0x44c5('0x33')]({'exitAt':moment()[_0x44c5('0x24')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise['all'](_0x4c4471);}}})[_0x44c5('0x16')](function(){if(_0x21b1be){var _0x5db9b6=[];var _0xd48f56=[];var _0x1764e9=utils['getChannels']();var _0x2fd8b2={'membername':_0x21b1be[_0x44c5('0x20')],'interface':_0x58cc65,'enterAt':moment()[_0x44c5('0x24')](_0x44c5('0x29')),'role':_0x21b1be[_0x44c5('0x21')],'internal':_0x21b1be[_0x44c5('0x22')]};_0x1764e9['forEach'](function(_0x3fcd46){_0x5db9b6[_0x44c5('0x2d')](_[_0x44c5('0x52')]({'channel':_0x3fcd46,'type':'LOGIN','data1':_0x44c5('0x53'),'data2':_0x58cc65},_0x2fd8b2));if(_0x21b1be[_0x44c5('0x4a')]){_0xd48f56['push'](_['merge']({'channel':_0x3fcd46,'type':'PAUSE','data1':_0x44c5('0x54')},_0x2fd8b2));}});return db[_0x44c5('0x27')][_0x44c5('0x32')](_0x5db9b6[_0x44c5('0x55')](_0xd48f56),{'individualHooks':!![]});}})[_0x44c5('0x16')](function(){if(_0x21b1be){return _0x21b1be[_0x44c5('0x33')]({'online':!![],'lastLoginAt':moment()[_0x44c5('0x24')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x21b1be[_0x44c5('0x4a')]||![],'mailPause':_0x21b1be[_0x44c5('0x4a')]||![],'chatPause':_0x21b1be[_0x44c5('0x4a')]||![],'faxPause':_0x21b1be[_0x44c5('0x4a')]||![],'smsPause':_0x21b1be[_0x44c5('0x4a')]||![],'openchannelPause':_0x21b1be[_0x44c5('0x4a')]||![],'pauseType':_0x21b1be[_0x44c5('0x4a')]?_0x44c5('0x54'):null,'lastPauseAt':moment()[_0x44c5('0x24')](_0x44c5('0x29')),'interface':_0x58cc65});}})[_0x44c5('0x16')](function(_0x3532b2){_0x4cbb8a(_0x3532b2);})[_0x44c5('0x1e')](function(_0x3916ee){_0x5ea150(_0xed73a0[_0x44c5('0x1a')](0x1f4,_0x3916ee[_0x44c5('0x1b')]));});});}; \ No newline at end of file +var _0xd411=['message','find','raw','then','ShowUser','stringify','PauseUser','name','role','internal','User\x20with\x20id\x20%s\x20not\x20found','params','update','MemberReport','PAUSE','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','forEach','push','isNil','interface','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','UnpauseUser','resolve','channel','Channel\x20parameter\x20%s\x20is\x20invalid','findOne','online','voicePause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','unpause','LogoutUser','UserVoiceQueueRt','destroy','all','mobile','phone','loginInPause','SIP/%s','count','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','redis','localhost','socket.io-emitter','./user.socket','register','GetUser','User','findAll','options','where','limit','include','map','attributes','model','info','catch','error'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd411,0xf5));var _0x1d41=function(_0x277c10,_0x1325e6){_0x277c10=_0x277c10-0x0;var _0x416c3c=_0xd411[_0x277c10];return _0x416c3c;};'use strict';var _=require(_0x1d41('0x0'));var util=require(_0x1d41('0x1'));var moment=require(_0x1d41('0x2'));var BPromise=require('bluebird');var Redis=require(_0x1d41('0x3'));var db=require(_0x1d41('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1d41('0x5'))(_0x1d41('0x6'));var config=require('../../config/environment');config[_0x1d41('0x7')]=_['defaults'](config[_0x1d41('0x7')],{'host':_0x1d41('0x8'),'port':0x18eb});var socket=require(_0x1d41('0x9'))(new Redis(config['redis']));require(_0x1d41('0xa'))[_0x1d41('0xb')](socket);exports[_0x1d41('0xc')]=function(_0x326a7a){var _0x342d5a=this;return new Promise(function(_0x69bcef,_0x21c450){return db[_0x1d41('0xd')][_0x1d41('0xe')]({'raw':_0x326a7a['options']?_0x326a7a['options']['raw']===undefined?!![]:![]:!![],'where':_0x326a7a[_0x1d41('0xf')]?_0x326a7a[_0x1d41('0xf')][_0x1d41('0x10')]||null:null,'attributes':_0x326a7a[_0x1d41('0xf')]?_0x326a7a[_0x1d41('0xf')]['attributes']||null:null,'limit':_0x326a7a[_0x1d41('0xf')]?_0x326a7a[_0x1d41('0xf')][_0x1d41('0x11')]||null:null,'include':_0x326a7a[_0x1d41('0xf')]?_0x326a7a[_0x1d41('0xf')][_0x1d41('0x12')]?_[_0x1d41('0x13')](_0x326a7a[_0x1d41('0xf')][_0x1d41('0x12')],function(_0x3da521){return{'model':db[_0x3da521['model']],'as':_0x3da521['as'],'attributes':_0x3da521[_0x1d41('0x14')],'include':_0x3da521[_0x1d41('0x12')]?_['map'](_0x3da521['include'],function(_0x4ba84b){return{'model':db[_0x4ba84b[_0x1d41('0x15')]],'as':_0x4ba84b['as'],'attributes':_0x4ba84b['attributes'],'include':_0x4ba84b[_0x1d41('0x12')]?_[_0x1d41('0x13')](_0x4ba84b['include'],function(_0x2bb68e){return{'model':db[_0x2bb68e['model']],'as':_0x2bb68e['as'],'attributes':_0x2bb68e[_0x1d41('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ac816){logger[_0x1d41('0x16')]('GetUser',_0x326a7a);logger['debug'](_0x1d41('0xc'),_0x326a7a,JSON['stringify'](_0x3ac816));_0x69bcef(_0x3ac816);})[_0x1d41('0x17')](function(_0x52cdfc){logger[_0x1d41('0x18')](_0x1d41('0xc'),_0x52cdfc[_0x1d41('0x19')],_0x326a7a);_0x21c450(_0x342d5a[_0x1d41('0x18')](0x1f4,_0x52cdfc[_0x1d41('0x19')]));});});};exports['ShowUser']=function(_0x531e09){var _0x909b0d=this;return new Promise(function(_0x484060,_0x1e2cdb){return db['User'][_0x1d41('0x1a')]({'raw':_0x531e09['options']?_0x531e09[_0x1d41('0xf')][_0x1d41('0x1b')]===undefined?!![]:![]:!![],'where':_0x531e09[_0x1d41('0xf')]?_0x531e09['options'][_0x1d41('0x10')]||null:null,'attributes':_0x531e09['options']?_0x531e09[_0x1d41('0xf')][_0x1d41('0x14')]||null:null,'include':_0x531e09['options']?_0x531e09[_0x1d41('0xf')]['include']?_[_0x1d41('0x13')](_0x531e09['options']['include'],function(_0x385000){return{'model':db[_0x385000[_0x1d41('0x15')]],'as':_0x385000['as'],'attributes':_0x385000[_0x1d41('0x14')],'include':_0x385000[_0x1d41('0x12')]?_[_0x1d41('0x13')](_0x385000[_0x1d41('0x12')],function(_0x227168){return{'model':db[_0x227168[_0x1d41('0x15')]],'as':_0x227168['as'],'attributes':_0x227168['attributes'],'include':_0x227168[_0x1d41('0x12')]?_[_0x1d41('0x13')](_0x227168[_0x1d41('0x12')],function(_0x1e4b14){return{'model':db[_0x1e4b14[_0x1d41('0x15')]],'as':_0x1e4b14['as'],'attributes':_0x1e4b14[_0x1d41('0x14')]};}):[]};}):[]};}):[]:[]})[_0x1d41('0x1c')](function(_0x9e77bb){logger[_0x1d41('0x16')](_0x1d41('0x1d'),_0x531e09);logger['debug'](_0x1d41('0x1d'),_0x531e09,JSON[_0x1d41('0x1e')](_0x9e77bb));_0x484060(_0x9e77bb);})[_0x1d41('0x17')](function(_0x37fe19){logger[_0x1d41('0x18')](_0x1d41('0x1d'),_0x37fe19[_0x1d41('0x19')],_0x531e09);_0x1e2cdb(_0x909b0d[_0x1d41('0x18')](0x1f4,_0x37fe19[_0x1d41('0x19')]));});});};exports[_0x1d41('0x1f')]=function(_0x47458f){var _0x3c917d;return db[_0x1d41('0xd')][_0x1d41('0x1a')]({'where':_0x47458f[_0x1d41('0xf')][_0x1d41('0x10')]||{},'attributes':['id',_0x1d41('0x20'),_0x1d41('0x21'),_0x1d41('0x22'),'interface']})['then'](function(_0xfafc4c){if(!_0xfafc4c){throw new Error(util['format'](_0x1d41('0x23'),_0x47458f[_0x1d41('0x24')]['id']));}_0x3c917d=_0xfafc4c;return db['UserVoiceQueueRt'][_0x1d41('0x25')]({'paused':0x1},{'where':{'UserId':_0x3c917d['id']},'individualHooks':!![]});})[_0x1d41('0x1c')](function(){return db[_0x1d41('0x26')][_0x1d41('0xe')]({'where':{'membername':_0x3c917d['name'],'type':_0x1d41('0x27'),'exitAt':null}});})[_0x1d41('0x1c')](function(_0x594dae){if(_0x594dae&&_0x594dae[_0x1d41('0x28')]){var _0x3fe28b=moment()[_0x1d41('0x29')](_0x1d41('0x2a'));for(var _0x4d5be9=0x0,_0x42a18e=_0x594dae[_0x1d41('0x28')];_0x4d5be9<_0x42a18e;_0x4d5be9++){_0x594dae[_0x4d5be9][_0x1d41('0x2b')]({'exitAt':_0x3fe28b});}}})['then'](function(){var _0x382149=[];var _0x453247=utils[_0x1d41('0x2c')]();_0x453247[_0x1d41('0x2d')](function(_0x46b9b3){_0x382149[_0x1d41('0x2e')]({'channel':_0x46b9b3,'membername':_0x3c917d[_0x1d41('0x20')],'interface':_[_0x1d41('0x2f')](_0x3c917d[_0x1d41('0x30')])?util[_0x1d41('0x29')]('SIP/%s',_0x3c917d['name']):_0x3c917d[_0x1d41('0x30')],'type':_0x1d41('0x27'),'enterAt':moment()[_0x1d41('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x47458f[_0x1d41('0x31')][_0x1d41('0x32')]||_0x1d41('0x33'),'role':_0x3c917d[_0x1d41('0x21')],'internal':_0x3c917d['internal'],'uniqueid':_0x47458f[_0x1d41('0x31')][_0x1d41('0x34')]||null});});return db[_0x1d41('0x26')][_0x1d41('0x35')](_0x382149,{'individualHooks':!![]});})[_0x1d41('0x1c')](function(){return _0x3c917d[_0x1d41('0x25')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x47458f[_0x1d41('0x31')]['type']||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a'))});})[_0x1d41('0x17')](function(_0x1d9eff){throw _0x1d9eff;});};exports[_0x1d41('0x36')]=function(_0x5ef75f){return Promise[_0x1d41('0x37')]()[_0x1d41('0x1c')](function(){if(_0x5ef75f['body'][_0x1d41('0x38')]&&!utils['isValidChannel'](_0x5ef75f[_0x1d41('0x31')][_0x1d41('0x38')])){throw new Error(util[_0x1d41('0x29')](_0x1d41('0x39'),_0x5ef75f[_0x1d41('0x31')][_0x1d41('0x38')]));}return db['User'][_0x1d41('0x3a')]({'where':_0x5ef75f[_0x1d41('0xf')]['where']||{},'attributes':['id',_0x1d41('0x20'),_0x1d41('0x21'),'internal','interface',_0x1d41('0x3b'),_0x1d41('0x3c'),'mailPause',_0x1d41('0x3d'),_0x1d41('0x3e'),_0x1d41('0x3f'),'smsPause',_0x1d41('0x40'),_0x1d41('0x41'),_0x1d41('0x42')]});})['then'](function(_0x4f2777){if(!_0x4f2777){throw new Error(util[_0x1d41('0x29')](_0x1d41('0x23'),_0x5ef75f[_0x1d41('0x24')]['id']));}return _0x4f2777[_0x1d41('0x43')](_0x5ef75f[_0x1d41('0x31')][_0x1d41('0x38')],'system');})['catch'](function(_0x3b486e){throw _0x3b486e;});};exports[_0x1d41('0x44')]=function(_0x3b2dc7){var _0x4a3117=this;return new Promise(function(_0x39d960,_0xc39ad6){var _0x2a35a8;return db[_0x1d41('0xd')]['findOne']({'where':_0x3b2dc7[_0x1d41('0xf')][_0x1d41('0x10')]||{},'attributes':['id',_0x1d41('0x20')]})[_0x1d41('0x1c')](function(_0x5dbb5e){if(_0x5dbb5e){_0x2a35a8=_0x5dbb5e;return db[_0x1d41('0x45')][_0x1d41('0x46')]({'where':{'membername':_0x2a35a8['name']},'individualHooks':!![]});}})[_0x1d41('0x1c')](function(){if(_0x2a35a8){return db[_0x1d41('0x26')]['findAll']({'where':{'membername':_0x2a35a8['name'],'exitAt':null}});}})[_0x1d41('0x1c')](function(_0x30c90a){if(_0x2a35a8){if(_0x30c90a&&_0x30c90a[_0x1d41('0x28')]){var _0x2fb381=[];_0x30c90a[_0x1d41('0x2d')](function(_0x32a184){_0x2fb381[_0x1d41('0x2e')](_0x32a184[_0x1d41('0x25')]({'exitAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a'))}));});return BPromise[_0x1d41('0x47')](_0x2fb381);}}})['then'](function(){if(_0x2a35a8){return _0x2a35a8[_0x1d41('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x1d41('0x1c')](function(_0x150d99){_0x39d960(_0x150d99);})[_0x1d41('0x17')](function(_0x44e34d){_0xc39ad6(_0x4a3117[_0x1d41('0x18')](0x1f4,_0x44e34d[_0x1d41('0x19')]));});});};exports['LoginUser']=function(_0x4ad585){var _0x25b17e=this;return new Promise(function(_0x4e62a3,_0x1ff4d9){var _0x558e45;var _0x6114a6;var _0x9c033a;var _0x4ab927;return db[_0x1d41('0xd')][_0x1d41('0x3a')]({'where':_0x4ad585[_0x1d41('0xf')][_0x1d41('0x10')]||{},'attributes':['id',_0x1d41('0x20'),_0x1d41('0x21'),_0x1d41('0x48'),_0x1d41('0x49'),_0x1d41('0x22'),_0x1d41('0x4a'),_0x1d41('0x30')]})['then'](function(_0x2f59d9){if(_0x2f59d9){_0x558e45=_0x2f59d9;_0x4ab927=_0x4ad585[_0x1d41('0x31')][_0x1d41('0x30')]?_0x4ad585[_0x1d41('0x31')][_0x1d41('0x30')]:util[_0x1d41('0x29')](_0x1d41('0x4b'),_0x558e45[_0x1d41('0x20')]);return db[_0x1d41('0xd')][_0x1d41('0x4c')]({'where':{'role':_0x1d41('0x4d'),'online':!![],'id':{'$ne':_0x558e45['id']}}});}})[_0x1d41('0x1c')](function(_0x21a239){if(_0x21a239){_0x9c033a=_0x21a239;return require(_0x1d41('0x4e'))[_0x1d41('0x4f')]();}})[_0x1d41('0x1c')](function(_0x3dda73){if(_0x3dda73&&_0x3dda73[_0x1d41('0x50')]&&_0x9c033a>=_0x3dda73[_0x1d41('0x50')]){throw new Error(_0x1d41('0x51'));}})[_0x1d41('0x1c')](function(){if(_0x558e45){return db[_0x1d41('0x45')]['destroy']({'where':{'membername':_0x558e45['name']},'individualHooks':!![]});}})[_0x1d41('0x1c')](function(){if(_0x558e45){return _0x558e45[_0x1d41('0x52')]({'raw':!![]});}})[_0x1d41('0x1c')](function(_0x303338){if(_0x558e45){if(_0x303338){var _0x34bf35=[];_0x6114a6=_0x303338;if(_0x6114a6[_0x1d41('0x28')]){for(var _0x4b08ae=0x0;_0x4b08ae<_0x6114a6['length'];_0x4b08ae++){_0x34bf35[_0x1d41('0x2e')](db[_0x1d41('0x45')][_0x1d41('0x53')]({'membername':_0x558e45[_0x1d41('0x20')],'UserId':_0x558e45['id'],'queue_name':_0x6114a6[_0x4b08ae][_0x1d41('0x20')],'VoiceQueueId':_0x6114a6[_0x4b08ae]['id'],'interface':_0x4ab927,'paused':_0x558e45[_0x1d41('0x4a')]||![],'penalty':_0x6114a6[_0x4b08ae][_0x1d41('0x54')]||0x0}));}return BPromise[_0x1d41('0x47')](_0x34bf35);}}}})[_0x1d41('0x1c')](function(){if(_0x558e45){return db['MemberReport'][_0x1d41('0xe')]({'where':{'membername':_0x558e45[_0x1d41('0x20')],'exitAt':null}});}})[_0x1d41('0x1c')](function(_0x19c64f){if(_0x558e45){if(_0x19c64f&&_0x19c64f[_0x1d41('0x28')]){var _0x19d50b=[];_0x19c64f['forEach'](function(_0x500577){_0x19d50b['push'](_0x500577[_0x1d41('0x25')]({'exitAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a'))}));});return BPromise[_0x1d41('0x47')](_0x19d50b);}}})['then'](function(){if(_0x558e45){var _0x3e28ec=[];var _0x2f8c5d=[];var _0x1a0ef7=utils['getChannels']();var _0x550a34={'membername':_0x558e45['name'],'interface':_0x4ab927,'enterAt':moment()[_0x1d41('0x29')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0x558e45['role'],'internal':_0x558e45[_0x1d41('0x22')]};_0x1a0ef7[_0x1d41('0x2d')](function(_0x43a172){_0x3e28ec['push'](_[_0x1d41('0x55')]({'channel':_0x43a172,'type':_0x1d41('0x56'),'data1':_0x1d41('0x57'),'data2':_0x4ab927},_0x550a34));if(_0x558e45[_0x1d41('0x4a')]){_0x2f8c5d[_0x1d41('0x2e')](_[_0x1d41('0x55')]({'channel':_0x43a172,'type':_0x1d41('0x27'),'data1':_0x1d41('0x58')},_0x550a34));}});return db[_0x1d41('0x26')][_0x1d41('0x35')](_0x3e28ec[_0x1d41('0x59')](_0x2f8c5d),{'individualHooks':!![]});}})[_0x1d41('0x1c')](function(){if(_0x558e45){return _0x558e45[_0x1d41('0x25')]({'online':!![],'lastLoginAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a')),'voicePause':_0x558e45['loginInPause']||![],'mailPause':_0x558e45[_0x1d41('0x4a')]||![],'chatPause':_0x558e45['loginInPause']||![],'faxPause':_0x558e45[_0x1d41('0x4a')]||![],'smsPause':_0x558e45[_0x1d41('0x4a')]||![],'openchannelPause':_0x558e45[_0x1d41('0x4a')]||![],'pauseType':_0x558e45[_0x1d41('0x4a')]?_0x1d41('0x58'):null,'lastPauseAt':moment()[_0x1d41('0x29')](_0x1d41('0x2a')),'interface':_0x4ab927});}})[_0x1d41('0x1c')](function(_0x3bb73d){_0x4e62a3(_0x3bb73d);})[_0x1d41('0x17')](function(_0x2e0828){_0x1ff4d9(_0x25b17e['error'](0x1f4,_0x2e0828[_0x1d41('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 1b6bfa5..e8f15ff 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 _0x1fd7=['emit','removeListener','register','length','user:','./user.events','save','remove'];(function(_0x3cd9d4,_0x45f7b9){var _0x3b515a=function(_0x2d70c8){while(--_0x2d70c8){_0x3cd9d4['push'](_0x3cd9d4['shift']());}};_0x3b515a(++_0x45f7b9);}(_0x1fd7,0xfd));var _0x71fd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1fd7[_0x3dd15e];return _0x231fd0;};'use strict';var UserEvents=require(_0x71fd('0x0'));var events=[_0x71fd('0x1'),_0x71fd('0x2'),'update'];function createListener(_0x1f2c3a,_0x1e0210){return function(_0x144755){_0x1e0210[_0x71fd('0x3')](_0x1f2c3a,_0x144755);};}function removeListener(_0x3b5ccb,_0x4ac480){return function(){UserEvents[_0x71fd('0x4')](_0x3b5ccb,_0x4ac480);};}exports[_0x71fd('0x5')]=function(_0x5a7491){for(var _0x4436d5=0x0,_0xc1c72d=events[_0x71fd('0x6')];_0x4436d5<_0xc1c72d;_0x4436d5++){var _0x3a72c2=events[_0x4436d5];var _0x28eb41=createListener(_0x71fd('0x7')+_0x3a72c2,_0x5a7491);UserEvents['on'](_0x3a72c2,_0x28eb41);}}; \ No newline at end of file +var _0xb9e7=['emit','removeListener','length','user:','./user.events','save','remove'];(function(_0x3adb44,_0x209d29){var _0x5328bf=function(_0x5cb877){while(--_0x5cb877){_0x3adb44['push'](_0x3adb44['shift']());}};_0x5328bf(++_0x209d29);}(_0xb9e7,0x193));var _0x7b9e=function(_0x2ecc65,_0xd75c48){_0x2ecc65=_0x2ecc65-0x0;var _0x103cc3=_0xb9e7[_0x2ecc65];return _0x103cc3;};'use strict';var UserEvents=require(_0x7b9e('0x0'));var events=[_0x7b9e('0x1'),_0x7b9e('0x2'),'update'];function createListener(_0x56674b,_0x527e6d){return function(_0x23e00f){_0x527e6d[_0x7b9e('0x3')](_0x56674b,_0x23e00f);};}function removeListener(_0x5121e3,_0x3df849){return function(){UserEvents[_0x7b9e('0x4')](_0x5121e3,_0x3df849);};}exports['register']=function(_0x5c70d7){for(var _0x5ceb81=0x0,_0x2d792f=events[_0x7b9e('0x5')];_0x5ceb81<_0x2d792f;_0x5ceb81++){var _0xf66339=events[_0x5ceb81];var _0x12302b=createListener(_0x7b9e('0x6')+_0xf66339,_0x5c70d7);UserEvents['on'](_0xf66339,_0x12302b);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index b206713..9654c7e 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(_0x1884b2,_0x3a2ace){var _0x34ddb7=function(_0x3160cf){while(--_0x3160cf){_0x1884b2['push'](_0x1884b2['shift']());}};_0x34ddb7(++_0x3a2ace);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x269c90,_0xd91b24){var _0x52c634=function(_0x5bcf40){while(--_0x5bcf40){_0x269c90['push'](_0x269c90['shift']());}};_0x52c634(++_0xd91b24);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xcb91[_0x599e60];return _0x468e19;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index bf43e53..29f1ae0 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 _0x676a=['INTEGER','exports'];(function(_0x2a381f,_0x5ac78b){var _0xbb80ac=function(_0x5aa22f){while(--_0x5aa22f){_0x2a381f['push'](_0x2a381f['shift']());}};_0xbb80ac(++_0x5ac78b);}(_0x676a,0x14f));var _0xa676=function(_0x57b236,_0x30614e){_0x57b236=_0x57b236-0x0;var _0x4feb29=_0x676a[_0x57b236];return _0x4feb29;};'use strict';var Sequelize=require('sequelize');module[_0xa676('0x0')]={'penalty':{'type':Sequelize[_0xa676('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x134d=['sequelize','INTEGER'];(function(_0x26daa0,_0x271f23){var _0x115b24=function(_0x42d5ac){while(--_0x42d5ac){_0x26daa0['push'](_0x26daa0['shift']());}};_0x115b24(++_0x271f23);}(_0x134d,0xfc));var _0xd134=function(_0x48eccc,_0x43cb41){_0x48eccc=_0x48eccc-0x0;var _0x5507be=_0x134d[_0x48eccc];return _0x5507be;};'use strict';var Sequelize=require(_0xd134('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd134('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 865674b..615ed6c 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 _0xb394=['UserChatQueue','user_has_chat_queues','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports','define'];(function(_0x3782f6,_0x5eded2){var _0xf58702=function(_0x3c0d22){while(--_0x3c0d22){_0x3782f6['push'](_0x3782f6['shift']());}};_0xf58702(++_0x5eded2);}(_0xb394,0x1a6));var _0x4b39=function(_0x15d6b6,_0x141d63){_0x15d6b6=_0x15d6b6-0x0;var _0xf3c727=_0xb394[_0x15d6b6];return _0xf3c727;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b39('0x0'))(_0x4b39('0x1'));var moment=require(_0x4b39('0x2'));var BPromise=require('bluebird');var rp=require(_0x4b39('0x3'));var fs=require('fs');var path=require(_0x4b39('0x4'));var rimraf=require(_0x4b39('0x5'));var config=require(_0x4b39('0x6'));var attributes=require(_0x4b39('0x7'));module[_0x4b39('0x8')]=function(_0x393e15,_0x56dbdf){return _0x393e15[_0x4b39('0x9')](_0x4b39('0xa'),attributes,{'tableName':_0x4b39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf1cb=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','UserChatQueue','lodash','util'];(function(_0x1168a1,_0xa0d8c9){var _0xcc5ad8=function(_0x217dc3){while(--_0x217dc3){_0x1168a1['push'](_0x1168a1['shift']());}};_0xcc5ad8(++_0xa0d8c9);}(_0xf1cb,0x1c0));var _0xbf1c=function(_0xf8b949,_0x38e38f){_0xf8b949=_0xf8b949-0x0;var _0xb009aa=_0xf1cb[_0xf8b949];return _0xb009aa;};'use strict';var _=require(_0xbf1c('0x0'));var util=require(_0xbf1c('0x1'));var logger=require(_0xbf1c('0x2'))(_0xbf1c('0x3'));var moment=require(_0xbf1c('0x4'));var BPromise=require(_0xbf1c('0x5'));var rp=require(_0xbf1c('0x6'));var fs=require('fs');var path=require(_0xbf1c('0x7'));var rimraf=require('rimraf');var config=require(_0xbf1c('0x8'));var attributes=require('./userChatQueue.attributes');module['exports']=function(_0x2106b1,_0x3e5cab){return _0x2106b1['define'](_0xbf1c('0x9'),attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index dde20f7..fa400ec 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 _0x4d22=['../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x12cac1,_0x3b514c){var _0xa55f9f=function(_0x5b3abb){while(--_0x5b3abb){_0x12cac1['push'](_0x12cac1['shift']());}};_0xa55f9f(++_0x3b514c);}(_0x4d22,0xa1));var _0x24d2=function(_0x4157b9,_0x147461){_0x4157b9=_0x4157b9-0x0;var _0x457d88=_0x4d22[_0x4157b9];return _0x457d88;};'use strict';var _=require('lodash');var util=require(_0x24d2('0x0'));var moment=require(_0x24d2('0x1'));var BPromise=require(_0x24d2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x24d2('0x3'));var db=require(_0x24d2('0x4'))['db'];var utils=require(_0x24d2('0x5'));var logger=require('../../config/logger')(_0x24d2('0x6'));var config=require(_0x24d2('0x7'));var jayson=require(_0x24d2('0x8'));var client=jayson[_0x24d2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x17889f,_0x3565cc,_0x43b53a){return new BPromise(function(_0x9a75a8,_0x26ff09){return client[_0x24d2('0xa')](_0x17889f,_0x43b53a)[_0x24d2('0xb')](function(_0x4efc8f){logger['info'](_0x24d2('0xc'),_0x3565cc,_0x24d2('0xd'));logger[_0x24d2('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3565cc,_0x24d2('0xd'),JSON[_0x24d2('0xf')](_0x4efc8f));if(_0x4efc8f[_0x24d2('0x10')]){if(_0x4efc8f[_0x24d2('0x10')]['code']===0x1f4){logger[_0x24d2('0x10')](_0x24d2('0xc'),_0x3565cc,_0x4efc8f[_0x24d2('0x10')][_0x24d2('0x11')]);return _0x26ff09(_0x4efc8f[_0x24d2('0x10')]['message']);}logger[_0x24d2('0x10')](_0x24d2('0xc'),_0x3565cc,_0x4efc8f['error'][_0x24d2('0x11')]);return _0x9a75a8(_0x4efc8f[_0x24d2('0x10')][_0x24d2('0x11')]);}else{logger[_0x24d2('0x12')](_0x24d2('0xc'),_0x3565cc,_0x24d2('0xd'));_0x9a75a8(_0x4efc8f[_0x24d2('0x13')]['message']);}})[_0x24d2('0x14')](function(_0xe844b6){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x3565cc,_0xe844b6);_0x26ff09(_0xe844b6);});});} \ No newline at end of file +var _0x6051=['rpc','../../config/environment','client','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2b00f8,_0x4874c9){var _0x4df6ee=function(_0x4f25a4){while(--_0x4f25a4){_0x2b00f8['push'](_0x2b00f8['shift']());}};_0x4df6ee(++_0x4874c9);}(_0x6051,0x1b0));var _0x1605=function(_0x16dced,_0x2f8d60){_0x16dced=_0x16dced-0x0;var _0x40e9d7=_0x6051[_0x16dced];return _0x40e9d7;};'use strict';var _=require(_0x1605('0x0'));var util=require(_0x1605('0x1'));var moment=require(_0x1605('0x2'));var BPromise=require(_0x1605('0x3'));var rs=require(_0x1605('0x4'));var fs=require('fs');var Redis=require(_0x1605('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1605('0x6'));var logger=require(_0x1605('0x7'))(_0x1605('0x8'));var config=require(_0x1605('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x1605('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1eee84,_0x515b79,_0x53e609){return new BPromise(function(_0x218dd7,_0x2ee84b){return client['request'](_0x1eee84,_0x53e609)[_0x1605('0xb')](function(_0x33fd1b){logger[_0x1605('0xc')](_0x1605('0xd'),_0x515b79,_0x1605('0xe'));logger[_0x1605('0xf')](_0x1605('0x10'),_0x515b79,_0x1605('0xe'),JSON[_0x1605('0x11')](_0x33fd1b));if(_0x33fd1b['error']){if(_0x33fd1b['error'][_0x1605('0x12')]===0x1f4){logger[_0x1605('0x13')](_0x1605('0xd'),_0x515b79,_0x33fd1b[_0x1605('0x13')][_0x1605('0x14')]);return _0x2ee84b(_0x33fd1b[_0x1605('0x13')][_0x1605('0x14')]);}logger[_0x1605('0x13')](_0x1605('0xd'),_0x515b79,_0x33fd1b['error']['message']);return _0x218dd7(_0x33fd1b[_0x1605('0x13')]['message']);}else{logger[_0x1605('0xc')](_0x1605('0xd'),_0x515b79,_0x1605('0xe'));_0x218dd7(_0x33fd1b[_0x1605('0x15')][_0x1605('0x14')]);}})['catch'](function(_0x1a042b){logger[_0x1605('0x13')](_0x1605('0xd'),_0x515b79,_0x1a042b);_0x2ee84b(_0x1a042b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 68f3126..6427fc9 100644 --- a/server/api/userFaxQueue/index.js +++ b/server/api/userFaxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x487dfd,_0x448170){var _0x17723c=function(_0xa8b613){while(--_0xa8b613){_0x487dfd['push'](_0x487dfd['shift']());}};_0x17723c(++_0x448170);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3e446d,_0x2e3494){var _0x90cac7=function(_0x40b3a9){while(--_0x40b3a9){_0x3e446d['push'](_0x3e446d['shift']());}};_0x90cac7(++_0x2e3494);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index c4b8c57..bb73a87 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 _0xa6a4=['exports','INTEGER','sequelize'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa6a4,0x6e));var _0x4a6a=function(_0x41c3b7,_0x1b21ff){_0x41c3b7=_0x41c3b7-0x0;var _0x1d4414=_0xa6a4[_0x41c3b7];return _0x1d4414;};'use strict';var Sequelize=require(_0x4a6a('0x0'));module[_0x4a6a('0x1')]={'penalty':{'type':Sequelize[_0x4a6a('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8cab=['STRING','exports','INTEGER'];(function(_0x57e7d0,_0x37a0d2){var _0x7c49fe=function(_0x404b36){while(--_0x404b36){_0x57e7d0['push'](_0x57e7d0['shift']());}};_0x7c49fe(++_0x37a0d2);}(_0x8cab,0x85));var _0xb8ca=function(_0x5e4e7b,_0x37f3db){_0x5e4e7b=_0x5e4e7b-0x0;var _0x324eb2=_0x8cab[_0x5e4e7b];return _0x324eb2;};'use strict';var Sequelize=require('sequelize');module[_0xb8ca('0x0')]={'penalty':{'type':Sequelize[_0xb8ca('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xb8ca('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xb8ca('0x2')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index d346a86..d6a568f 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 _0x4a0c=['user_has_fax_queues','lodash','../../config/logger','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x316670,_0x56566d){var _0x206584=function(_0x1e9e70){while(--_0x1e9e70){_0x316670['push'](_0x316670['shift']());}};_0x206584(++_0x56566d);}(_0x4a0c,0x137));var _0xc4a0=function(_0x56ae0d,_0x316d24){_0x56ae0d=_0x56ae0d-0x0;var _0x17824f=_0x4a0c[_0x56ae0d];return _0x17824f;};'use strict';var _=require(_0xc4a0('0x0'));var util=require('util');var logger=require(_0xc4a0('0x1'))(_0xc4a0('0x2'));var moment=require(_0xc4a0('0x3'));var BPromise=require(_0xc4a0('0x4'));var rp=require(_0xc4a0('0x5'));var fs=require('fs');var path=require(_0xc4a0('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xc4a0('0x7')]=function(_0x597e66,_0x5de17d){return _0x597e66[_0xc4a0('0x8')]('UserFaxQueue',attributes,{'tableName':_0xc4a0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7963=['../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7963,0x14a));var _0x3796=function(_0x10d0f0,_0x1eba3d){_0x10d0f0=_0x10d0f0-0x0;var _0x93e308=_0x7963[_0x10d0f0];return _0x93e308;};'use strict';var _=require('lodash');var util=require(_0x3796('0x0'));var logger=require(_0x3796('0x1'))(_0x3796('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3796('0x3'));var fs=require('fs');var path=require(_0x3796('0x4'));var rimraf=require(_0x3796('0x5'));var config=require(_0x3796('0x6'));var attributes=require(_0x3796('0x7'));module[_0x3796('0x8')]=function(_0x458c07,_0xb535c7){return _0x458c07[_0x3796('0x9')](_0x3796('0xa'),attributes,{'tableName':_0x3796('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 7a4a165..1ac3098 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 _0xd02e=['UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x168563,_0x280a82){var _0x2f8614=function(_0x5af816){while(--_0x5af816){_0x168563['push'](_0x168563['shift']());}};_0x2f8614(++_0x280a82);}(_0xd02e,0x125));var _0xed02=function(_0x28b8e9,_0x5e8608){_0x28b8e9=_0x28b8e9-0x0;var _0x41daec=_0xd02e[_0x28b8e9];return _0x41daec;};'use strict';var _=require(_0xed02('0x0'));var util=require(_0xed02('0x1'));var moment=require('moment');var BPromise=require(_0xed02('0x2'));var rs=require(_0xed02('0x3'));var fs=require('fs');var Redis=require(_0xed02('0x4'));var db=require(_0xed02('0x5'))['db'];var utils=require(_0xed02('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xed02('0x7')][_0xed02('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc917ed,_0x433edf,_0x118939){return new BPromise(function(_0x4dd389,_0x368684){return client[_0xed02('0x9')](_0xc917ed,_0x118939)[_0xed02('0xa')](function(_0x4af399){logger[_0xed02('0xb')](_0xed02('0xc'),_0x433edf,_0xed02('0xd'));logger[_0xed02('0xe')](_0xed02('0xf'),_0x433edf,'request\x20sent',JSON[_0xed02('0x10')](_0x4af399));if(_0x4af399[_0xed02('0x11')]){if(_0x4af399[_0xed02('0x11')][_0xed02('0x12')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x433edf,_0x4af399[_0xed02('0x11')][_0xed02('0x13')]);return _0x368684(_0x4af399['error'][_0xed02('0x13')]);}logger[_0xed02('0x11')](_0xed02('0xc'),_0x433edf,_0x4af399[_0xed02('0x11')][_0xed02('0x13')]);return _0x4dd389(_0x4af399[_0xed02('0x11')][_0xed02('0x13')]);}else{logger[_0xed02('0xb')](_0xed02('0xc'),_0x433edf,_0xed02('0xd'));_0x4dd389(_0x4af399[_0xed02('0x14')]['message']);}})[_0xed02('0x15')](function(_0x4bea06){logger[_0xed02('0x11')](_0xed02('0xc'),_0x433edf,_0x4bea06);_0x368684(_0x4bea06);});});} \ No newline at end of file +var _0x4e00=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird'];(function(_0x388e72,_0x3ea102){var _0x3dc3ae=function(_0x97c695){while(--_0x97c695){_0x388e72['push'](_0x388e72['shift']());}};_0x3dc3ae(++_0x3ea102);}(_0x4e00,0x104));var _0x04e0=function(_0x2a54d4,_0x32722a){_0x2a54d4=_0x2a54d4-0x0;var _0x1db786=_0x4e00[_0x2a54d4];return _0x1db786;};'use strict';var _=require(_0x04e0('0x0'));var util=require(_0x04e0('0x1'));var moment=require(_0x04e0('0x2'));var BPromise=require(_0x04e0('0x3'));var rs=require(_0x04e0('0x4'));var fs=require('fs');var Redis=require(_0x04e0('0x5'));var db=require(_0x04e0('0x6'))['db'];var utils=require(_0x04e0('0x7'));var logger=require(_0x04e0('0x8'))('rpc');var config=require(_0x04e0('0x9'));var jayson=require(_0x04e0('0xa'));var client=jayson[_0x04e0('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ae1d,_0x5e26c6,_0x135a38){return new BPromise(function(_0x4c8a59,_0x5c89a4){return client['request'](_0x24ae1d,_0x135a38)[_0x04e0('0xc')](function(_0x45f485){logger[_0x04e0('0xd')](_0x04e0('0xe'),_0x5e26c6,_0x04e0('0xf'));logger[_0x04e0('0x10')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5e26c6,_0x04e0('0xf'),JSON[_0x04e0('0x11')](_0x45f485));if(_0x45f485[_0x04e0('0x12')]){if(_0x45f485['error'][_0x04e0('0x13')]===0x1f4){logger[_0x04e0('0x12')](_0x04e0('0xe'),_0x5e26c6,_0x45f485['error'][_0x04e0('0x14')]);return _0x5c89a4(_0x45f485[_0x04e0('0x12')]['message']);}logger[_0x04e0('0x12')](_0x04e0('0xe'),_0x5e26c6,_0x45f485[_0x04e0('0x12')][_0x04e0('0x14')]);return _0x4c8a59(_0x45f485[_0x04e0('0x12')][_0x04e0('0x14')]);}else{logger['info'](_0x04e0('0xe'),_0x5e26c6,'request\x20sent');_0x4c8a59(_0x45f485['result']['message']);}})[_0x04e0('0x15')](function(_0x4c5201){logger[_0x04e0('0x12')](_0x04e0('0xe'),_0x5e26c6,_0x4c5201);_0x5c89a4(_0x4c5201);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 54dd00e..d47514e 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(_0x4217f6,_0x8a27e5){var _0x29053f=function(_0x28d022){while(--_0x28d022){_0x4217f6['push'](_0x4217f6['shift']());}};_0x29053f(++_0x8a27e5);}(_0xedd9,0xfc));var _0x9edd=function(_0x39418d,_0x27ee49){_0x39418d=_0x39418d-0x0;var _0x221357=_0xedd9[_0x39418d];return _0x221357;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x15c23e,_0x162305){var _0x4ed7d1=function(_0x3d65e7){while(--_0x3d65e7){_0x15c23e['push'](_0x15c23e['shift']());}};_0x4ed7d1(++_0x162305);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index ddcf8fc..c1d1c31 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 _0x8970=['sequelize','exports','INTEGER'];(function(_0x51da74,_0xed04){var _0x58cbd7=function(_0x3de772){while(--_0x3de772){_0x51da74['push'](_0x51da74['shift']());}};_0x58cbd7(++_0xed04);}(_0x8970,0x12f));var _0x0897=function(_0x375ffd,_0x216e84){_0x375ffd=_0x375ffd-0x0;var _0x265c11=_0x8970[_0x375ffd];return _0x265c11;};'use strict';var Sequelize=require(_0x0897('0x0'));module[_0x0897('0x1')]={'penalty':{'type':Sequelize[_0x0897('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xac85=['INTEGER','exports'];(function(_0xe9bde6,_0x4fd817){var _0x4104fb=function(_0x557f04){while(--_0x557f04){_0xe9bde6['push'](_0xe9bde6['shift']());}};_0x4104fb(++_0x4fd817);}(_0xac85,0x77));var _0x5ac8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xac85[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x5ac8('0x0')]={'penalty':{'type':Sequelize[_0x5ac8('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index d065f89..a2b5126 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 _0x30e9=['rimraf','../../config/environment','./userMailQueue.attributes','exports','UserMailQueue','lodash','util','moment','request-promise'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x30e9,0x15b));var _0x930e=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x30e9[_0x164eca];return _0x2ce562;};'use strict';var _=require(_0x930e('0x0'));var util=require(_0x930e('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x930e('0x2'));var BPromise=require('bluebird');var rp=require(_0x930e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x930e('0x4'));var config=require(_0x930e('0x5'));var attributes=require(_0x930e('0x6'));module[_0x930e('0x7')]=function(_0xe627de,_0x55d68f){return _0xe627de['define'](_0x930e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa6f1=['UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./userMailQueue.attributes','exports','define'];(function(_0x397741,_0x291896){var _0x3a81c3=function(_0x195c72){while(--_0x195c72){_0x397741['push'](_0x397741['shift']());}};_0x3a81c3(++_0x291896);}(_0xa6f1,0x113));var _0x1a6f=function(_0x503ec3,_0x5f851e){_0x503ec3=_0x503ec3-0x0;var _0x4ce7cf=_0xa6f1[_0x503ec3];return _0x4ce7cf;};'use strict';var _=require(_0x1a6f('0x0'));var util=require(_0x1a6f('0x1'));var logger=require(_0x1a6f('0x2'))(_0x1a6f('0x3'));var moment=require(_0x1a6f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x1a6f('0x5'));var rimraf=require(_0x1a6f('0x6'));var config=require(_0x1a6f('0x7'));var attributes=require(_0x1a6f('0x8'));module[_0x1a6f('0x9')]=function(_0x44a5df,_0x5bffa1){return _0x44a5df[_0x1a6f('0xa')](_0x1a6f('0xb'),attributes,{'tableName':_0x1a6f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 3827b47..d52cefe 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x373dce,_0x4e3b8c){var _0x1cc73f=function(_0xb1672c){while(--_0xb1672c){_0x373dce['push'](_0x373dce['shift']());}};_0x1cc73f(++_0x4e3b8c);}(_0x34e8,0x12c));var _0x834e=function(_0x46dfcd,_0x2172b6){_0x46dfcd=_0x46dfcd-0x0;var _0x2e7114=_0x34e8[_0x46dfcd];return _0x2e7114;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('UserMailQueue,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1cb9,0x14e));var _0x91cb=function(_0x30017d,_0x29cfca){_0x30017d=_0x30017d-0x0;var _0x17f95e=_0x1cb9[_0x30017d];return _0x17f95e;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('UserMailQueue,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 6f13705..e807f8c 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 _0x51f6=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','isAuthenticated','sendUserNotification','exports','multer','util','path','connect-timeout','express'];(function(_0x5dbe03,_0x2941ff){var _0x8f51a9=function(_0x9fc00e){while(--_0x9fc00e){_0x5dbe03['push'](_0x5dbe03['shift']());}};_0x8f51a9(++_0x2941ff);}(_0x51f6,0x7d));var _0x651f=function(_0x55d7ce,_0x282867){_0x55d7ce=_0x55d7ce-0x0;var _0x3e050c=_0x51f6[_0x55d7ce];return _0x3e050c;};'use strict';var multer=require(_0x651f('0x0'));var util=require(_0x651f('0x1'));var path=require(_0x651f('0x2'));var timeout=require(_0x651f('0x3'));var express=require(_0x651f('0x4'));var router=express[_0x651f('0x5')]();var fs_extra=require(_0x651f('0x6'));var auth=require(_0x651f('0x7'));var interaction=require(_0x651f('0x8'));var config=require('../../config/environment');var controller=require(_0x651f('0x9'));router['post']('/',auth[_0x651f('0xa')](),controller[_0x651f('0xb')]);module[_0x651f('0xc')]=router; \ No newline at end of file +var _0xb045=['post','isAuthenticated','sendUserNotification','exports','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0x57d7df,_0x25730a){var _0x3e125b=function(_0x5a29a9){while(--_0x5a29a9){_0x57d7df['push'](_0x57d7df['shift']());}};_0x3e125b(++_0x25730a);}(_0xb045,0x1f3));var _0x5b04=function(_0x722103,_0x5732f3){_0x722103=_0x722103-0x0;var _0x3e2435=_0xb045[_0x722103];return _0x3e2435;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x5b04('0x0'));var express=require('express');var router=express[_0x5b04('0x1')]();var fs_extra=require(_0x5b04('0x2'));var auth=require(_0x5b04('0x3'));var interaction=require(_0x5b04('0x4'));var config=require(_0x5b04('0x5'));var controller=require(_0x5b04('0x6'));router[_0x5b04('0x7')]('/',auth[_0x5b04('0x8')](),controller[_0x5b04('0x9')]);module[_0x5b04('0xa')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index 2ff2a27..53f6779 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 _0xf33b=['TEXT','BOOLEAN','sequelize'];(function(_0x578b2e,_0x148b70){var _0xac2b58=function(_0x5362af){while(--_0x5362af){_0x578b2e['push'](_0x578b2e['shift']());}};_0xac2b58(++_0x148b70);}(_0xf33b,0x146));var _0xbf33=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0xf33b[_0x31cb5f];return _0x586042;};'use strict';var Sequelize=require(_0xbf33('0x0'));module['exports']={'body':{'type':Sequelize[_0xbf33('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0xbf33('0x2')]}}; \ No newline at end of file +var _0xec04=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x4dfe51,_0x1b4fc9){var _0x3a0881=function(_0x557818){while(--_0x557818){_0x4dfe51['push'](_0x4dfe51['shift']());}};_0x3a0881(++_0x1b4fc9);}(_0xec04,0x19a));var _0x4ec0=function(_0x1ba6c6,_0xeb171a){_0x1ba6c6=_0x1ba6c6-0x0;var _0x5a6ba4=_0xec04[_0x1ba6c6];return _0x5a6ba4;};'use strict';var Sequelize=require(_0x4ec0('0x0'));module[_0x4ec0('0x1')]={'body':{'type':Sequelize[_0x4ec0('0x2')]},'senderName':{'type':Sequelize[_0x4ec0('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x4ec0('0x3')]},'beep':{'type':Sequelize[_0x4ec0('0x4')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index fde93d8..7c82dff 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 _0x2519=['destroy','error','stack','name','sendUserNotification','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','smsqueue','voicequeue','whatsappqueue','includes','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','isEmpty','recipientsDescription','beep','recipientsId','sequelize','transaction','UserNotification','create','forEach','recipient','userNotification:send','catch','text','Template','findOne','html','User','union','ids','queue','Queue','push','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./userNotification.socket','register','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','then'];(function(_0x271276,_0x122b24){var _0x5c5ca0=function(_0x2eec27){while(--_0x2eec27){_0x271276['push'](_0x271276['shift']());}};_0x5c5ca0(++_0x122b24);}(_0x2519,0x19f));var _0x9251=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2519[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x9251('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9251('0x1'));var jsonpatch=require(_0x9251('0x2'));var rp=require(_0x9251('0x3'));var moment=require(_0x9251('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9251('0x5'));var path=require('path');var sox=require(_0x9251('0x6'));var csv=require('to-csv');var ejs=require(_0x9251('0x7'));var fs=require('fs');var fs_extra=require(_0x9251('0x8'));var _=require(_0x9251('0x9'));var squel=require(_0x9251('0xa'));var crypto=require(_0x9251('0xb'));var jsforce=require(_0x9251('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x9251('0xd'));var querystring=require(_0x9251('0xe'));var Papa=require('papaparse');var Redis=require(_0x9251('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9251('0x10'));var as=require(_0x9251('0x11'));var hardwareService=require(_0x9251('0x12'));var logger=require('../../config/logger')(_0x9251('0x13'));var utils=require(_0x9251('0x14'));var config=require(_0x9251('0x15'));var licenseUtil=require(_0x9251('0x16'));var db=require(_0x9251('0x17'))['db'];config['redis']=_[_0x9251('0x18')](config[_0x9251('0x19')],{'host':_0x9251('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9251('0x19')]));require(_0x9251('0x1b'))[_0x9251('0x1c')](socket);function respondWithStatusCode(_0x10e08,_0x4f1c7e){_0x4f1c7e=_0x4f1c7e||0xcc;return function(_0x5c4b9b){if(_0x5c4b9b){return _0x10e08[_0x9251('0x1d')](_0x4f1c7e);}return _0x10e08[_0x9251('0x1e')](_0x4f1c7e)[_0x9251('0x1f')]();};}function respondWithResult(_0x2e8629,_0x48033e){_0x48033e=_0x48033e||0xc8;return function(_0x4089d7){if(_0x4089d7){return _0x2e8629[_0x9251('0x1e')](_0x48033e)['json'](_0x4089d7);}};}function respondWithFilteredResult(_0x1a2b24,_0x2aed71){return function(_0x345b51){if(_0x345b51){var _0x324492=typeof _0x2aed71[_0x9251('0x20')]===_0x9251('0x21')&&typeof _0x2aed71[_0x9251('0x22')]===_0x9251('0x21');var _0x534931=_0x345b51[_0x9251('0x23')];var _0x49193a=_0x324492?0x0:_0x2aed71[_0x9251('0x20')];var _0x12408f=_0x324492?_0x345b51[_0x9251('0x23')]:_0x2aed71[_0x9251('0x20')]+_0x2aed71[_0x9251('0x22')];var _0xfa6148;if(_0x12408f>=_0x534931){_0x12408f=_0x534931;_0xfa6148=0xc8;}else{_0xfa6148=0xce;}_0x1a2b24['status'](_0xfa6148);return _0x1a2b24['set'](_0x9251('0x24'),_0x49193a+'-'+_0x12408f+'/'+_0x534931)['json'](_0x345b51);}return null;};}function patchUpdates(_0x3dedec){return function(_0x2bde77){try{jsonpatch[_0x9251('0x25')](_0x2bde77,_0x3dedec,!![]);}catch(_0x2cdcc4){return BPromise['reject'](_0x2cdcc4);}return _0x2bde77[_0x9251('0x26')]();};}function saveUpdates(_0x41d9bc,_0x2098d1){return function(_0x4dda62){if(_0x4dda62){return _0x4dda62['update'](_0x41d9bc)[_0x9251('0x27')](function(_0x48fc9b){return _0x48fc9b;});}return null;};}function removeEntity(_0x4fed51,_0x433ad7){return function(_0x1a193b){if(_0x1a193b){return _0x1a193b[_0x9251('0x28')]()['then'](function(){_0x4fed51[_0x9251('0x1e')](0xcc)[_0x9251('0x1f')]();});}};}function handleEntityNotFound(_0x18e478,_0x6a82be){return function(_0x1d0b76){if(!_0x1d0b76){_0x18e478[_0x9251('0x1d')](0x194);}return _0x1d0b76;};}function handleError(_0x48bec3,_0x7efde){_0x7efde=_0x7efde||0x1f4;return function(_0x58f5c2){logger[_0x9251('0x29')](_0x58f5c2[_0x9251('0x2a')]);if(_0x58f5c2[_0x9251('0x2b')]){delete _0x58f5c2[_0x9251('0x2b')];}_0x48bec3[_0x9251('0x1e')](_0x7efde)['send'](_0x58f5c2);};}exports[_0x9251('0x2c')]=function(_0x2f21cf,_0x21f45c,_0x4cff8f){if(!_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')]('text')&&!_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')](_0x9251('0x2f'))){throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))](_0x9251('0x32'));}else{if(_0x2f21cf['body'][_0x9251('0x2e')](_0x9251('0x2f'))&&!_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')](_0x9251('0x33'))){throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))](_0x9251('0x34'));}if(!_0x2f21cf[_0x9251('0x2d')]['hasOwnProperty'](_0x9251('0x35'))){throw new db[(_0x9251('0x30'))]['ValidationError'](_0x9251('0x36'));}else{try{var _0x5a2152=JSON[_0x9251('0x37')](_0x2f21cf[_0x9251('0x2d')]['recipients']);}catch(_0x245093){logger[_0x9251('0x29')](_0x245093);throw new db[(_0x9251('0x30'))]['ValidationError'](_0x9251('0x38'));}var _0x11c4d1=[_0x9251('0x39'),'faxqueue','mailqueue','openchannelqueue',_0x9251('0x3a'),_0x9251('0x3b'),_0x9251('0x3c'),'team','user'];if(_['some'](_0x5a2152,function(_0x2e6c5c){return!_[_0x9251('0x3d')](_0x11c4d1,_0x2e6c5c[_0x9251('0x3e')][_0x9251('0x3f')]());})){throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))](_0x9251('0x40'));}}}var _0x8c8dd4={};_0x8c8dd4[_0x9251('0x41')]=_0x2f21cf[_0x9251('0x2d')][_0x9251('0x2e')](_0x9251('0x41'))?_0x2f21cf[_0x9251('0x2d')][_0x9251('0x41')]:_0x2f21cf[_0x9251('0x42')]['fullname'];_0x8c8dd4['recipientsDescription']=_[_0x9251('0x43')](_0x2f21cf['body'][_0x9251('0x44')])?null:_0x2f21cf[_0x9251('0x2d')]['recipientsDescription'];_0x8c8dd4[_0x9251('0x45')]=_0x2f21cf[_0x9251('0x2d')]['beep']||![];_0x8c8dd4['SenderId']=_0x2f21cf['user']['id'];return getContent(_0x2f21cf[_0x9251('0x2d')])['then'](function(_0x4596f0){_0x8c8dd4[_0x9251('0x2d')]=_0x4596f0;return getRecipients(_0x5a2152);})['then'](function(_0x354477){_0x8c8dd4[_0x9251('0x46')]=_['sortBy'](_0x354477)['join'](',');return db[_0x9251('0x47')][_0x9251('0x48')](function(_0x24235a){return db[_0x9251('0x49')][_0x9251('0x4a')](_0x8c8dd4,{'raw':!![],'transaction':_0x24235a})['then'](function(_0x3aaedf){var _0x9d08e7={'sender':_0x8c8dd4[_0x9251('0x41')],'description':_0x8c8dd4[_0x9251('0x44')],'content':_0x8c8dd4[_0x9251('0x2d')],'beep':_0x8c8dd4[_0x9251('0x45')]};_0x354477[_0x9251('0x4b')](function(_0x1c5759){_0x9d08e7[_0x9251('0x4c')]=_0x1c5759;socket['emit'](_0x9251('0x4d'),_0x9d08e7);});return _0x3aaedf;});});})[_0x9251('0x27')](respondWithResult(_0x21f45c,0xc9))[_0x9251('0x4e')](handleError(_0x21f45c,null));};function getContent(_0x32c152){return new BPromise(function(_0x464cf3,_0x428a79){if(_0x32c152[_0x9251('0x4f')]){_0x464cf3(_0x32c152[_0x9251('0x4f')]);return;}return db[_0x9251('0x50')][_0x9251('0x51')]({'attributes':[_0x9251('0x52')],'where':{'id':_0x32c152[_0x9251('0x2f')]},'raw':!![]})[_0x9251('0x27')](function(_0x565e74){if(!_0x565e74)throw new db[(_0x9251('0x30'))][(_0x9251('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x2f420e=Mustache['render'](_0x565e74[_0x9251('0x52')],_0x32c152['view']);_0x464cf3(_0x2f420e);})['catch'](function(_0x4ccc8a){_0x428a79(_0x4ccc8a);});});}function getRecipients(_0x3411ae){return new BPromise(function(_0x5edc90,_0x30f8c0){var _0x3b63ee=[];var _0x3ac4eb=[];_0x3411ae[_0x9251('0x4b')](function(_0x10b9bf){var _0x3f1dda=_['startCase'](_0x10b9bf[_0x9251('0x3e')][_0x9251('0x3f')]());if(_0x3f1dda===_0x9251('0x53')){_0x3b63ee=_[_0x9251('0x54')](_0x3b63ee,_0x10b9bf[_0x9251('0x55')]);}else{if(_['includes'](_0x3f1dda,_0x9251('0x56')))_0x3f1dda=_0x3f1dda['replace'](_0x9251('0x56'),_0x9251('0x57'));_0x10b9bf[_0x9251('0x55')][_0x9251('0x4b')](function(_0x35ad14){_0x3ac4eb[_0x9251('0x58')](getAgents(_0x3f1dda,_0x35ad14));});}});return BPromise['all'](_0x3ac4eb)[_0x9251('0x27')](function(_0x1f8ebc){_0x3b63ee=_[_0x9251('0x54')](_0x3b63ee,_['flatten'](_0x1f8ebc));_0x5edc90(_0x3b63ee);})[_0x9251('0x4e')](function(_0x58a265){_0x30f8c0(_0x58a265);});});}function getAgents(_0x229e22,_0x457f4d){return new BPromise(function(_0x2c5511,_0x3ed2bc){return db[_0x229e22][_0x9251('0x51')]({'where':{'id':_0x457f4d}})[_0x9251('0x27')](function(_0x4d50ea){return _0x4d50ea[_0x9251('0x59')]({'attributes':['id'],'raw':!![]})[_0x9251('0x27')](function(_0x336817){var _0x436e55=_[_0x9251('0x5a')](_0x336817,'id');_0x2c5511(_0x436e55);});})[_0x9251('0x4e')](function(_0x11cb83){_0x3ed2bc(_0x11cb83);});});} \ No newline at end of file +var _0x7d24=['SenderId','join','sequelize','UserNotification','forEach','recipient','userNotification:send','catch','Template','html','User','union','ids','includes','queue','replace','Queue','push','flatten','findOne','getAgents','map','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','then','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','team','user','some','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','isEmpty','beep'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x7d24,0x13c));var _0x47d2=function(_0x45d628,_0x1190fb){_0x45d628=_0x45d628-0x0;var _0x3675ad=_0x7d24[_0x45d628];return _0x3675ad;};'use strict';var emlformat=require(_0x47d2('0x0'));var rimraf=require(_0x47d2('0x1'));var zipdir=require(_0x47d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47d2('0x3'));var moment=require(_0x47d2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47d2('0x5'));var util=require(_0x47d2('0x6'));var path=require(_0x47d2('0x7'));var sox=require(_0x47d2('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47d2('0x9'));var _=require(_0x47d2('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x47d2('0xb'));var deskjs=require(_0x47d2('0xc'));var toCsv=require(_0x47d2('0xd'));var querystring=require(_0x47d2('0xe'));var Papa=require(_0x47d2('0xf'));var Redis=require(_0x47d2('0x10'));var authService=require(_0x47d2('0x11'));var qs=require(_0x47d2('0x12'));var as=require(_0x47d2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x47d2('0x14'))(_0x47d2('0x15'));var utils=require(_0x47d2('0x16'));var config=require(_0x47d2('0x17'));var licenseUtil=require(_0x47d2('0x18'));var db=require(_0x47d2('0x19'))['db'];config['redis']=_[_0x47d2('0x1a')](config['redis'],{'host':_0x47d2('0x1b'),'port':0x18eb});var socket=require(_0x47d2('0x1c'))(new Redis(config['redis']));require(_0x47d2('0x1d'))[_0x47d2('0x1e')](socket);function respondWithStatusCode(_0x521397,_0x404c50){_0x404c50=_0x404c50||0xcc;return function(_0x9048bd){if(_0x9048bd){return _0x521397[_0x47d2('0x1f')](_0x404c50);}return _0x521397[_0x47d2('0x20')](_0x404c50)[_0x47d2('0x21')]();};}function respondWithResult(_0x185eec,_0xc022bd){_0xc022bd=_0xc022bd||0xc8;return function(_0x29adb2){if(_0x29adb2){return _0x185eec[_0x47d2('0x20')](_0xc022bd)[_0x47d2('0x22')](_0x29adb2);}};}function respondWithFilteredResult(_0x5030d7,_0x2b67b6){return function(_0x297d26){if(_0x297d26){var _0x2aabc6=typeof _0x2b67b6['offset']===_0x47d2('0x23')&&typeof _0x2b67b6[_0x47d2('0x24')]===_0x47d2('0x23');var _0x2d7262=_0x297d26[_0x47d2('0x25')];var _0x31dd7b=_0x2aabc6?0x0:_0x2b67b6[_0x47d2('0x26')];var _0x56ca08=_0x2aabc6?_0x297d26[_0x47d2('0x25')]:_0x2b67b6[_0x47d2('0x26')]+_0x2b67b6[_0x47d2('0x24')];var _0x5f5888;if(_0x56ca08>=_0x2d7262){_0x56ca08=_0x2d7262;_0x5f5888=0xc8;}else{_0x5f5888=0xce;}_0x5030d7[_0x47d2('0x20')](_0x5f5888);return _0x5030d7[_0x47d2('0x27')]('Content-Range',_0x31dd7b+'-'+_0x56ca08+'/'+_0x2d7262)[_0x47d2('0x22')](_0x297d26);}return null;};}function patchUpdates(_0x2f1a97){return function(_0x5a5d9b){try{jsonpatch[_0x47d2('0x28')](_0x5a5d9b,_0x2f1a97,!![]);}catch(_0x208e3e){return BPromise['reject'](_0x208e3e);}return _0x5a5d9b['save']();};}function saveUpdates(_0x2ca25f,_0x1e2a51){return function(_0xc779f){if(_0xc779f){return _0xc779f['update'](_0x2ca25f)[_0x47d2('0x29')](function(_0x4f06e3){return _0x4f06e3;});}return null;};}function removeEntity(_0x37e2c5,_0x28c38e){return function(_0x3a9935){if(_0x3a9935){return _0x3a9935['destroy']()[_0x47d2('0x29')](function(){_0x37e2c5[_0x47d2('0x20')](0xcc)[_0x47d2('0x21')]();});}};}function handleEntityNotFound(_0x49c89e,_0x441c61){return function(_0x550d54){if(!_0x550d54){_0x49c89e['sendStatus'](0x194);}return _0x550d54;};}function handleError(_0x1bebeb,_0x488108){_0x488108=_0x488108||0x1f4;return function(_0xfd78b4){logger[_0x47d2('0x2a')](_0xfd78b4[_0x47d2('0x2b')]);if(_0xfd78b4[_0x47d2('0x2c')]){delete _0xfd78b4[_0x47d2('0x2c')];}_0x1bebeb[_0x47d2('0x20')](_0x488108)[_0x47d2('0x2d')](_0xfd78b4);};}exports[_0x47d2('0x2e')]=function(_0x1f31e5,_0x98e970,_0x571e29){if(!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x31'))&&!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x32'))){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x35'));}else{if(_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x32'))&&!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x36'))){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x37'));}if(!_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x30')](_0x47d2('0x38'))){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x39'));}else{try{var _0x502728=JSON[_0x47d2('0x3a')](_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x38')]);}catch(_0x497966){logger[_0x47d2('0x2a')](_0x497966);throw new db['Sequelize'][(_0x47d2('0x34'))](_0x47d2('0x3b'));}var _0x463628=[_0x47d2('0x3c'),_0x47d2('0x3d'),_0x47d2('0x3e'),_0x47d2('0x3f'),_0x47d2('0x40'),_0x47d2('0x41'),'whatsappqueue',_0x47d2('0x42'),_0x47d2('0x43')];if(_[_0x47d2('0x44')](_0x502728,function(_0xa547c5){return!_['includes'](_0x463628,_0xa547c5['model'][_0x47d2('0x45')]());})){throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))](_0x47d2('0x46'));}}}var _0x4fc103={};_0x4fc103[_0x47d2('0x47')]=_0x1f31e5['body'][_0x47d2('0x30')](_0x47d2('0x47'))?_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x47')]:_0x1f31e5[_0x47d2('0x43')][_0x47d2('0x48')];_0x4fc103[_0x47d2('0x49')]=_[_0x47d2('0x4a')](_0x1f31e5['body'][_0x47d2('0x49')])?null:_0x1f31e5['body'][_0x47d2('0x49')];_0x4fc103['beep']=_0x1f31e5[_0x47d2('0x2f')][_0x47d2('0x4b')]||![];_0x4fc103[_0x47d2('0x4c')]=_0x1f31e5[_0x47d2('0x43')]['id'];return getContent(_0x1f31e5[_0x47d2('0x2f')])[_0x47d2('0x29')](function(_0x5c1d3e){_0x4fc103['body']=_0x5c1d3e;return getRecipients(_0x502728);})['then'](function(_0x49980b){_0x4fc103['recipientsId']=_['sortBy'](_0x49980b)[_0x47d2('0x4d')](',');return db[_0x47d2('0x4e')]['transaction'](function(_0x339fad){return db[_0x47d2('0x4f')]['create'](_0x4fc103,{'raw':!![],'transaction':_0x339fad})[_0x47d2('0x29')](function(_0x233c65){var _0x42c75d={'sender':_0x4fc103['senderName'],'description':_0x4fc103['recipientsDescription'],'content':_0x4fc103[_0x47d2('0x2f')],'beep':_0x4fc103[_0x47d2('0x4b')]};_0x49980b[_0x47d2('0x50')](function(_0x320bc9){_0x42c75d[_0x47d2('0x51')]=_0x320bc9;socket['emit'](_0x47d2('0x52'),_0x42c75d);});return _0x233c65;});});})['then'](respondWithResult(_0x98e970,0xc9))[_0x47d2('0x53')](handleError(_0x98e970,null));};function getContent(_0x5246f9){return new BPromise(function(_0x47142e,_0x30a8f2){if(_0x5246f9['text']){_0x47142e(_0x5246f9['text']);return;}return db[_0x47d2('0x54')]['findOne']({'attributes':[_0x47d2('0x55')],'where':{'id':_0x5246f9['TemplateId']},'raw':!![]})['then'](function(_0x11eeb1){if(!_0x11eeb1)throw new db[(_0x47d2('0x33'))][(_0x47d2('0x34'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x1e35ab=Mustache['render'](_0x11eeb1[_0x47d2('0x55')],_0x5246f9[_0x47d2('0x36')]);_0x47142e(_0x1e35ab);})[_0x47d2('0x53')](function(_0xf1b3a9){_0x30a8f2(_0xf1b3a9);});});}function getRecipients(_0x4b7133){return new BPromise(function(_0x265743,_0x52bd13){var _0xfbcb9c=[];var _0x1a6550=[];_0x4b7133['forEach'](function(_0x3022c7){var _0x309b61=_['startCase'](_0x3022c7['model']['toLowerCase']());if(_0x309b61===_0x47d2('0x56')){_0xfbcb9c=_[_0x47d2('0x57')](_0xfbcb9c,_0x3022c7[_0x47d2('0x58')]);}else{if(_[_0x47d2('0x59')](_0x309b61,_0x47d2('0x5a')))_0x309b61=_0x309b61[_0x47d2('0x5b')](_0x47d2('0x5a'),_0x47d2('0x5c'));_0x3022c7[_0x47d2('0x58')]['forEach'](function(_0x4fb9e5){_0x1a6550[_0x47d2('0x5d')](getAgents(_0x309b61,_0x4fb9e5));});}});return BPromise['all'](_0x1a6550)[_0x47d2('0x29')](function(_0x59b1fd){_0xfbcb9c=_['union'](_0xfbcb9c,_[_0x47d2('0x5e')](_0x59b1fd));_0x265743(_0xfbcb9c);})[_0x47d2('0x53')](function(_0x99c42){_0x52bd13(_0x99c42);});});}function getAgents(_0x20885a,_0x5154ca){return new BPromise(function(_0x18003e,_0x4fd124){return db[_0x20885a][_0x47d2('0x5f')]({'where':{'id':_0x5154ca}})[_0x47d2('0x29')](function(_0x6e076f){return _0x6e076f[_0x47d2('0x60')]({'attributes':['id'],'raw':!![]})['then'](function(_0x5dc7eb){var _0x5e4e1a=_[_0x47d2('0x61')](_0x5dc7eb,'id');_0x18003e(_0x5e4e1a);});})[_0x47d2('0x53')](function(_0x41fbf7){_0x4fd124(_0x41fbf7);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8e3b34e..7908d2d 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 _0x638b=['hook','exports','events','../../mysqldb','UserNotification','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x5391e2,_0x204d77){var _0x442935=function(_0x5a5a2c){while(--_0x5a5a2c){_0x5391e2['push'](_0x5391e2['shift']());}};_0x442935(++_0x204d77);}(_0x638b,0x1af));var _0xb638=function(_0x1895de,_0x3f70a3){_0x1895de=_0x1895de-0x0;var _0x473709=_0x638b[_0x1895de];return _0x473709;};'use strict';var EventEmitter=require(_0xb638('0x0'));var UserNotification=require(_0xb638('0x1'))['db'][_0xb638('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xb638('0x3')](0x0);var events={'afterCreate':_0xb638('0x4'),'afterUpdate':_0xb638('0x5'),'afterDestroy':_0xb638('0x6')};function emitEvent(_0xe91dbc){return function(_0xd6b527,_0x4bc29c,_0x106d3d){UserNotificationEvents[_0xb638('0x7')](_0xe91dbc+':'+_0xd6b527['id'],_0xd6b527);UserNotificationEvents[_0xb638('0x7')](_0xe91dbc,_0xd6b527);_0x106d3d(null);};}for(var e in events){if(events[_0xb638('0x8')](e)){var event=events[e];UserNotification[_0xb638('0x9')](e,emitEvent(event));}}module[_0xb638('0xa')]=UserNotificationEvents; \ No newline at end of file +var _0xae39=['events','setMaxListeners','save','update','remove','emit','exports'];(function(_0x5180c4,_0x13db52){var _0x4224e7=function(_0x220a73){while(--_0x220a73){_0x5180c4['push'](_0x5180c4['shift']());}};_0x4224e7(++_0x13db52);}(_0xae39,0x11f));var _0x9ae3=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xae39[_0x3ab51d];return _0x29a04e;};'use strict';var EventEmitter=require(_0x9ae3('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9ae3('0x1')](0x0);var events={'afterCreate':_0x9ae3('0x2'),'afterUpdate':_0x9ae3('0x3'),'afterDestroy':_0x9ae3('0x4')};function emitEvent(_0x4ff065){return function(_0x4c8613,_0x1e2970,_0x34f39a){UserNotificationEvents[_0x9ae3('0x5')](_0x4ff065+':'+_0x4c8613['id'],_0x4c8613);UserNotificationEvents['emit'](_0x4ff065,_0x4c8613);_0x34f39a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x9ae3('0x6')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 09464e3..546f6c8 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 _0x339d=['api','path','rimraf','../../config/environment','define','userNotifications','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x2e8dcc,_0x3f24bc){var _0x5eda2d=function(_0x1f2d45){while(--_0x1f2d45){_0x2e8dcc['push'](_0x2e8dcc['shift']());}};_0x5eda2d(++_0x3f24bc);}(_0x339d,0xb2));var _0xd339=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x339d[_0x2642cb];return _0xe6e41;};'use strict';var _=require('lodash');var util=require(_0xd339('0x0'));var logger=require(_0xd339('0x1'))(_0xd339('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd339('0x3'));var rimraf=require(_0xd339('0x4'));var config=require(_0xd339('0x5'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x2d2da0,_0x4db33a){return _0x2d2da0[_0xd339('0x6')]('UserNotification',attributes,{'tableName':_0xd339('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xd339('0x8')});}; \ No newline at end of file +var _0x7505=['./userNotification.attributes','define','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0xaafbda,_0x40f594){var _0x2b9272=function(_0x27190e){while(--_0x27190e){_0xaafbda['push'](_0xaafbda['shift']());}};_0x2b9272(++_0x40f594);}(_0x7505,0x1cc));var _0x5750=function(_0x1624af,_0x41a9f8){_0x1624af=_0x1624af-0x0;var _0x4ec86c=_0x7505[_0x1624af];return _0x4ec86c;};'use strict';var _=require(_0x5750('0x0'));var util=require(_0x5750('0x1'));var logger=require(_0x5750('0x2'))('api');var moment=require(_0x5750('0x3'));var BPromise=require(_0x5750('0x4'));var rp=require(_0x5750('0x5'));var fs=require('fs');var path=require(_0x5750('0x6'));var rimraf=require(_0x5750('0x7'));var config=require('../../config/environment');var attributes=require(_0x5750('0x8'));module['exports']=function(_0x142c53,_0x4fa0d8){return _0x142c53[_0x5750('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5750('0xa'),'collate':_0x5750('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 59ee9c9..42e0d3f 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 _0x78b1=['defaults','redis','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','debug','request\x20sent','error','message','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client','http'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x78b1,0xb4));var _0x178b=function(_0x2bdd00,_0x138793){_0x2bdd00=_0x2bdd00-0x0;var _0x7c5e30=_0x78b1[_0x2bdd00];return _0x7c5e30;};'use strict';var _=require('lodash');var util=require(_0x178b('0x0'));var moment=require(_0x178b('0x1'));var BPromise=require(_0x178b('0x2'));var rs=require(_0x178b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x178b('0x4'))['db'];var utils=require(_0x178b('0x5'));var logger=require(_0x178b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x178b('0x7')][_0x178b('0x8')]({'port':0x232a});config['redis']=_[_0x178b('0x9')](config[_0x178b('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x178b('0xb'))[_0x178b('0xc')](socket);function respondWithRpcPromise(_0x50ec1c,_0x290642,_0x412b75){return new BPromise(function(_0x4bb5ed,_0x3f6618){return client['request'](_0x50ec1c,_0x412b75)[_0x178b('0xd')](function(_0x47da9b){logger[_0x178b('0xe')](_0x178b('0xf'),_0x290642,'request\x20sent');logger[_0x178b('0x10')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x290642,_0x178b('0x11'),JSON['stringify'](_0x47da9b));if(_0x47da9b['error']){if(_0x47da9b['error']['code']===0x1f4){logger[_0x178b('0x12')](_0x178b('0xf'),_0x290642,_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);return _0x3f6618(_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0x290642,_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);return _0x4bb5ed(_0x47da9b[_0x178b('0x12')][_0x178b('0x13')]);}else{logger[_0x178b('0xe')](_0x178b('0xf'),_0x290642,_0x178b('0x11'));_0x4bb5ed(_0x47da9b['result']['message']);}})[_0x178b('0x14')](function(_0x1792af){logger[_0x178b('0x12')](_0x178b('0xf'),_0x290642,_0x1792af);_0x3f6618(_0x1792af);});});} \ No newline at end of file +var _0xd76d=['stringify','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','localhost','./userNotification.socket','register','request','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd76d,0x10b));var _0xdd76=function(_0x238bce,_0x1fa37a){_0x238bce=_0x238bce-0x0;var _0x127fc9=_0xd76d[_0x238bce];return _0x127fc9;};'use strict';var _=require(_0xdd76('0x0'));var util=require('util');var moment=require(_0xdd76('0x1'));var BPromise=require('bluebird');var rs=require(_0xdd76('0x2'));var fs=require('fs');var Redis=require(_0xdd76('0x3'));var db=require(_0xdd76('0x4'))['db'];var utils=require(_0xdd76('0x5'));var logger=require(_0xdd76('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xdd76('0x7'));var client=jayson[_0xdd76('0x8')][_0xdd76('0x9')]({'port':0x232a});config[_0xdd76('0xa')]=_['defaults'](config[_0xdd76('0xa')],{'host':_0xdd76('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdd76('0xa')]));require(_0xdd76('0xc'))[_0xdd76('0xd')](socket);function respondWithRpcPromise(_0xae8291,_0x5e74e,_0x95e83e){return new BPromise(function(_0x10e5d5,_0xaba20e){return client[_0xdd76('0xe')](_0xae8291,_0x95e83e)['then'](function(_0x3e7aa9){logger['info'](_0xdd76('0xf'),_0x5e74e,_0xdd76('0x10'));logger[_0xdd76('0x11')](_0xdd76('0x12'),_0x5e74e,_0xdd76('0x10'),JSON[_0xdd76('0x13')](_0x3e7aa9));if(_0x3e7aa9[_0xdd76('0x14')]){if(_0x3e7aa9[_0xdd76('0x14')][_0xdd76('0x15')]===0x1f4){logger[_0xdd76('0x14')]('UserNotification,\x20%s,\x20%s',_0x5e74e,_0x3e7aa9[_0xdd76('0x14')]['message']);return _0xaba20e(_0x3e7aa9[_0xdd76('0x14')][_0xdd76('0x16')]);}logger['error'](_0xdd76('0xf'),_0x5e74e,_0x3e7aa9[_0xdd76('0x14')][_0xdd76('0x16')]);return _0x10e5d5(_0x3e7aa9[_0xdd76('0x14')]['message']);}else{logger[_0xdd76('0x17')]('UserNotification,\x20%s,\x20%s',_0x5e74e,'request\x20sent');_0x10e5d5(_0x3e7aa9[_0xdd76('0x18')][_0xdd76('0x16')]);}})[_0xdd76('0x19')](function(_0x503b4a){logger[_0xdd76('0x14')](_0xdd76('0xf'),_0x5e74e,_0x503b4a);_0xaba20e(_0x503b4a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 4f52e0c..d3da5cc 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 _0x25b2=['userNotification:','./userNotification.events','save','remove','update','emit','register','length'];(function(_0x196e1b,_0x55fa06){var _0x5e1f18=function(_0x3bdb41){while(--_0x3bdb41){_0x196e1b['push'](_0x196e1b['shift']());}};_0x5e1f18(++_0x55fa06);}(_0x25b2,0x181));var _0x225b=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x25b2[_0x5bd426];return _0x23a7eb;};'use strict';var UserNotificationEvents=require(_0x225b('0x0'));var events=[_0x225b('0x1'),_0x225b('0x2'),_0x225b('0x3')];function createListener(_0x6fc29f,_0x99f5c){return function(_0x5b3a94){_0x99f5c[_0x225b('0x4')](_0x6fc29f,_0x5b3a94);};}function removeListener(_0xc19086,_0x2f2669){return function(){UserNotificationEvents['removeListener'](_0xc19086,_0x2f2669);};}exports[_0x225b('0x5')]=function(_0x53731e){for(var _0x8f3906=0x0,_0x4bb7e0=events[_0x225b('0x6')];_0x8f3906<_0x4bb7e0;_0x8f3906++){var _0x11c170=events[_0x8f3906];var _0xeea9bd=createListener(_0x225b('0x7')+_0x11c170,_0x53731e);UserNotificationEvents['on'](_0x11c170,_0xeea9bd);}}; \ No newline at end of file +var _0xca60=['update','removeListener','register','userNotification:','save','remove'];(function(_0x5ecadc,_0x1cf9f1){var _0x565037=function(_0x22908b){while(--_0x22908b){_0x5ecadc['push'](_0x5ecadc['shift']());}};_0x565037(++_0x1cf9f1);}(_0xca60,0x9a));var _0x0ca6=function(_0x9faff7,_0x59a564){_0x9faff7=_0x9faff7-0x0;var _0x4f8043=_0xca60[_0x9faff7];return _0x4f8043;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x0ca6('0x0'),_0x0ca6('0x1'),_0x0ca6('0x2')];function createListener(_0x4ec679,_0x4341f6){return function(_0x4fdd5b){_0x4341f6['emit'](_0x4ec679,_0x4fdd5b);};}function removeListener(_0x527b8f,_0x1f0265){return function(){UserNotificationEvents[_0x0ca6('0x3')](_0x527b8f,_0x1f0265);};}exports[_0x0ca6('0x4')]=function(_0xdf7a02){for(var _0x5349ff=0x0,_0x2b51c5=events['length'];_0x5349ff<_0x2b51c5;_0x5349ff++){var _0x5256a0=events[_0x5349ff];var _0x2e7e35=createListener(_0x0ca6('0x5')+_0x5256a0,_0xdf7a02);UserNotificationEvents['on'](_0x5256a0,_0x2e7e35);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index f368ad4..d627bcc 100644 --- a/server/api/userOpenchannelQueue/index.js +++ b/server/api/userOpenchannelQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x3600a0,_0x5995bd){var _0x38801b=function(_0x328fbf){while(--_0x328fbf){_0x3600a0['push'](_0x3600a0['shift']());}};_0x38801b(++_0x5995bd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xcb91[_0x8af54b];return _0x27d8f0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x32d22f,_0x229e5b){var _0x36a423=function(_0x5f34b2){while(--_0x5f34b2){_0x32d22f['push'](_0x32d22f['shift']());}};_0x36a423(++_0x229e5b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fefeb05..9659e0f 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 _0x1f7f=['INTEGER','sequelize','exports'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0x1f7f,0x1f3));var _0xf1f7=function(_0x128a40,_0x546c18){_0x128a40=_0x128a40-0x0;var _0x1359d4=_0x1f7f[_0x128a40];return _0x1359d4;};'use strict';var Sequelize=require(_0xf1f7('0x0'));module[_0xf1f7('0x1')]={'penalty':{'type':Sequelize[_0xf1f7('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x35b6=['INTEGER','sequelize','exports'];(function(_0x239904,_0x4b11e2){var _0x259609=function(_0x41d52a){while(--_0x41d52a){_0x239904['push'](_0x239904['shift']());}};_0x259609(++_0x4b11e2);}(_0x35b6,0x8e));var _0x635b=function(_0xcf51b5,_0x5a9110){_0xcf51b5=_0xcf51b5-0x0;var _0x4ecec6=_0x35b6[_0xcf51b5];return _0x4ecec6;};'use strict';var Sequelize=require(_0x635b('0x0'));module[_0x635b('0x1')]={'penalty':{'type':Sequelize[_0x635b('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 4eb970e..d384d7a 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 _0x2772=['./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','../../config/logger','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x2772,0xff));var _0x2277=function(_0x8f5d0d,_0x24301d){_0x8f5d0d=_0x8f5d0d-0x0;var _0x456e49=_0x2772[_0x8f5d0d];return _0x456e49;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2277('0x0'))('api');var moment=require('moment');var BPromise=require(_0x2277('0x1'));var rp=require(_0x2277('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2277('0x3'));var config=require(_0x2277('0x4'));var attributes=require(_0x2277('0x5'));module[_0x2277('0x6')]=function(_0x47b127,_0xded2b9){return _0x47b127[_0x2277('0x7')](_0x2277('0x8'),attributes,{'tableName':_0x2277('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9920=['util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','user_has_openchannel_queues','lodash'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x9920,0xa4));var _0x0992=function(_0x328001,_0x315934){_0x328001=_0x328001-0x0;var _0x19f57a=_0x9920[_0x328001];return _0x19f57a;};'use strict';var _=require(_0x0992('0x0'));var util=require(_0x0992('0x1'));var logger=require('../../config/logger')(_0x0992('0x2'));var moment=require(_0x0992('0x3'));var BPromise=require(_0x0992('0x4'));var rp=require(_0x0992('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0992('0x6'));var config=require(_0x0992('0x7'));var attributes=require(_0x0992('0x8'));module['exports']=function(_0x19e104,_0x21a387){return _0x19e104[_0x0992('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x0992('0xa'),'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 db6d741..e6ee89f 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 _0xd8e8=['info','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','UserOpenchannelQueue,\x20%s,\x20%s','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','then'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xd8e8,0xac));var _0x8d8e=function(_0x1b400d,_0x4c6a82){_0x1b400d=_0x1b400d-0x0;var _0x2cb49c=_0xd8e8[_0x1b400d];return _0x2cb49c;};'use strict';var _=require(_0x8d8e('0x0'));var util=require(_0x8d8e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8d8e('0x2'));var fs=require('fs');var Redis=require(_0x8d8e('0x3'));var db=require(_0x8d8e('0x4'))['db'];var utils=require(_0x8d8e('0x5'));var logger=require(_0x8d8e('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x579ae7,_0x290371,_0x3820a1){return new BPromise(function(_0xa3ce01,_0x47aa7b){return client['request'](_0x579ae7,_0x3820a1)[_0x8d8e('0x7')](function(_0x131909){logger[_0x8d8e('0x8')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,'request\x20sent');logger['debug'](_0x8d8e('0x9'),_0x290371,_0x8d8e('0xa'),JSON[_0x8d8e('0xb')](_0x131909));if(_0x131909[_0x8d8e('0xc')]){if(_0x131909[_0x8d8e('0xc')][_0x8d8e('0xd')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,_0x131909[_0x8d8e('0xc')]['message']);return _0x47aa7b(_0x131909[_0x8d8e('0xc')][_0x8d8e('0xe')]);}logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,_0x131909[_0x8d8e('0xc')][_0x8d8e('0xe')]);return _0xa3ce01(_0x131909['error']['message']);}else{logger[_0x8d8e('0x8')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x290371,_0x8d8e('0xa'));_0xa3ce01(_0x131909[_0x8d8e('0xf')][_0x8d8e('0xe')]);}})[_0x8d8e('0x10')](function(_0x2e99e4){logger[_0x8d8e('0xc')](_0x8d8e('0x11'),_0x290371,_0x2e99e4);_0x47aa7b(_0x2e99e4);});});} \ No newline at end of file +var _0xfa8f=['code','message','result','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xfa8f,0x8f));var _0xffa8=function(_0x5a602d,_0x4ee8e8){_0x5a602d=_0x5a602d-0x0;var _0x3e7029=_0xfa8f[_0x5a602d];return _0x3e7029;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffa8('0x0'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffa8('0x1'))['db'];var utils=require(_0xffa8('0x2'));var logger=require(_0xffa8('0x3'))(_0xffa8('0x4'));var config=require(_0xffa8('0x5'));var jayson=require(_0xffa8('0x6'));var client=jayson[_0xffa8('0x7')][_0xffa8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x349d2c,_0x9d6018,_0x45c4c1){return new BPromise(function(_0x4c0d2c,_0x33a12d){return client[_0xffa8('0x9')](_0x349d2c,_0x45c4c1)[_0xffa8('0xa')](function(_0x42049e){logger[_0xffa8('0xb')](_0xffa8('0xc'),_0x9d6018,_0xffa8('0xd'));logger['debug'](_0xffa8('0xe'),_0x9d6018,_0xffa8('0xd'),JSON[_0xffa8('0xf')](_0x42049e));if(_0x42049e['error']){if(_0x42049e[_0xffa8('0x10')][_0xffa8('0x11')]===0x1f4){logger[_0xffa8('0x10')](_0xffa8('0xc'),_0x9d6018,_0x42049e[_0xffa8('0x10')][_0xffa8('0x12')]);return _0x33a12d(_0x42049e[_0xffa8('0x10')]['message']);}logger[_0xffa8('0x10')](_0xffa8('0xc'),_0x9d6018,_0x42049e['error'][_0xffa8('0x12')]);return _0x4c0d2c(_0x42049e[_0xffa8('0x10')][_0xffa8('0x12')]);}else{logger[_0xffa8('0xb')](_0xffa8('0xc'),_0x9d6018,_0xffa8('0xd'));_0x4c0d2c(_0x42049e[_0xffa8('0x13')]['message']);}})['catch'](function(_0x9256cd){logger[_0xffa8('0x10')](_0xffa8('0xc'),_0x9d6018,_0x9256cd);_0x33a12d(_0x9256cd);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index b870bee..3a2ab71 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 _0x2a0a=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','/:id','show','getSections','/:id/resources','getResources','post','addSections','addResources','put','update','delete','destroy','removeSections','removeResources','exports','multer','util','connect-timeout'];(function(_0x84261a,_0x315d87){var _0x4b9d50=function(_0x590a5a){while(--_0x590a5a){_0x84261a['push'](_0x84261a['shift']());}};_0x4b9d50(++_0x315d87);}(_0x2a0a,0x1a1));var _0xa2a0=function(_0xec7b4d,_0x271d0e){_0xec7b4d=_0xec7b4d-0x0;var _0x318962=_0x2a0a[_0xec7b4d];return _0x318962;};'use strict';var multer=require(_0xa2a0('0x0'));var util=require(_0xa2a0('0x1'));var path=require('path');var timeout=require(_0xa2a0('0x2'));var express=require(_0xa2a0('0x3'));var router=express[_0xa2a0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xa2a0('0x5'));var interaction=require(_0xa2a0('0x6'));var config=require(_0xa2a0('0x7'));var controller=require(_0xa2a0('0x8'));router[_0xa2a0('0x9')]('/',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xb')]);router[_0xa2a0('0x9')](_0xa2a0('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa2a0('0xd'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xe')]);router[_0xa2a0('0x9')]('/:id/sections',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0xf')]);router[_0xa2a0('0x9')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x11')]);router[_0xa2a0('0x12')]('/',auth[_0xa2a0('0xa')](),controller['create']);router[_0xa2a0('0x12')]('/:id/clone',auth[_0xa2a0('0xa')](),controller['clone']);router[_0xa2a0('0x12')]('/:id/sections',auth['isAuthenticated'](),controller[_0xa2a0('0x13')]);router[_0xa2a0('0x12')]('/:id/resources',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x14')]);router[_0xa2a0('0x15')](_0xa2a0('0xd'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x16')]);router[_0xa2a0('0x17')](_0xa2a0('0xd'),auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x18')]);router['delete']('/:id/sections',auth[_0xa2a0('0xa')](),controller[_0xa2a0('0x19')]);router[_0xa2a0('0x17')](_0xa2a0('0x10'),auth['isAuthenticated'](),controller[_0xa2a0('0x1a')]);module[_0xa2a0('0x1b')]=router; \ No newline at end of file +var _0x2467=['create','clone','addResources','put','update','delete','removeSections','removeResources','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post'];(function(_0xdc6530,_0x97e5f3){var _0x2c70ad=function(_0x589d2c){while(--_0x589d2c){_0xdc6530['push'](_0xdc6530['shift']());}};_0x2c70ad(++_0x97e5f3);}(_0x2467,0xfc));var _0x7246=function(_0x1e9084,_0x107b43){_0x1e9084=_0x1e9084-0x0;var _0x1fb6bb=_0x2467[_0x1e9084];return _0x1fb6bb;};'use strict';var multer=require(_0x7246('0x0'));var util=require('util');var path=require(_0x7246('0x1'));var timeout=require('connect-timeout');var express=require(_0x7246('0x2'));var router=express[_0x7246('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7246('0x4'));var interaction=require(_0x7246('0x5'));var config=require(_0x7246('0x6'));var controller=require('./userProfile.controller');router[_0x7246('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7246('0x7')](_0x7246('0x8'),auth[_0x7246('0x9')](),controller[_0x7246('0xa')]);router['get'](_0x7246('0xb'),auth[_0x7246('0x9')](),controller[_0x7246('0xc')]);router['get'](_0x7246('0xd'),auth[_0x7246('0x9')](),controller[_0x7246('0xe')]);router['get'](_0x7246('0xf'),auth[_0x7246('0x9')](),controller[_0x7246('0x10')]);router[_0x7246('0x11')]('/',auth[_0x7246('0x9')](),controller[_0x7246('0x12')]);router['post']('/:id/clone',auth[_0x7246('0x9')](),controller[_0x7246('0x13')]);router[_0x7246('0x11')](_0x7246('0xd'),auth[_0x7246('0x9')](),controller['addSections']);router[_0x7246('0x11')](_0x7246('0xf'),auth[_0x7246('0x9')](),controller[_0x7246('0x14')]);router[_0x7246('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x7246('0x16')]);router['delete']('/:id',auth[_0x7246('0x9')](),controller['destroy']);router[_0x7246('0x17')](_0x7246('0xd'),auth[_0x7246('0x9')](),controller[_0x7246('0x18')]);router['delete'](_0x7246('0xf'),auth[_0x7246('0x9')](),controller[_0x7246('0x19')]);module[_0x7246('0x1a')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 8c8f238..11812c9 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 _0xf9f1=['join','getDataValue','BOOLEAN','sequelize','name','STRING','setDataValue','crudPermissions'];(function(_0x68ee8b,_0x3cc6c5){var _0x5148f7=function(_0x5dcbd5){while(--_0x5dcbd5){_0x68ee8b['push'](_0x68ee8b['shift']());}};_0x5148f7(++_0x3cc6c5);}(_0xf9f1,0x6b));var _0x1f9f=function(_0x1509f4,_0x26dee3){_0x1509f4=_0x1509f4-0x0;var _0x24ee67=_0xf9f1[_0x1509f4];return _0x24ee67;};'use strict';var Sequelize=require(_0x1f9f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x1f9f('0x1')},'crudPermissions':{'type':Sequelize[_0x1f9f('0x2')],'set':function(_0x33047b){this[_0x1f9f('0x3')](_0x1f9f('0x4'),_0x33047b?_0x33047b[_0x1f9f('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x1f9f('0x4'))?this[_0x1f9f('0x6')]('crudPermissions')['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x1f9f('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1f9f('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0x07d4=['crudPermissions','getDataValue','split','BOOLEAN','exports','name','STRING','setDataValue'];(function(_0x1e500e,_0x2c9d74){var _0x10dc5e=function(_0x354423){while(--_0x354423){_0x1e500e['push'](_0x1e500e['shift']());}};_0x10dc5e(++_0x2c9d74);}(_0x07d4,0x1e4));var _0x407d=function(_0x1a8d2a,_0xdbe9b8){_0x1a8d2a=_0x1a8d2a-0x0;var _0x1cf709=_0x07d4[_0x1a8d2a];return _0x1cf709;};'use strict';var Sequelize=require('sequelize');module[_0x407d('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x407d('0x1')},'crudPermissions':{'type':Sequelize[_0x407d('0x2')],'set':function(_0x3e1fe0){this[_0x407d('0x3')](_0x407d('0x4'),_0x3e1fe0?_0x3e1fe0['join'](''):[]);},'get':function(){return this['getDataValue'](_0x407d('0x4'))?this[_0x407d('0x5')](_0x407d('0x4'))[_0x407d('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x407d('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x407d('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x407d('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 3ff1c10..e29d9f7 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 _0xf997=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','findAll','rows','catch','show','params','options','create','body','clone','omit','updatedAt','crudPermissions','createdAt','sequelize','transaction','get','UserProfileSection','autoAssociation','sectionId','Resources','find','destroy','describe','addSections','userProfileId','each','UserProfileResource','getSections','enabled','includes','subsections','concat','push','findOne','forEach','Plugin','bulkCreate','removeResources','ids','getResources','section','Missing\x20section\x20parameter','nolimit','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','./userProfile.socket','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','update','then','error','stack','send','index','map','UserProfile','rawAttributes','fieldName','type','key','model','name'];(function(_0x1e4e65,_0x3d9c6b){var _0x35402f=function(_0x4ec406){while(--_0x4ec406){_0x1e4e65['push'](_0x1e4e65['shift']());}};_0x35402f(++_0x3d9c6b);}(_0xf997,0xa9));var _0x7f99=function(_0x5b5399,_0x5ec522){_0x5b5399=_0x5b5399-0x0;var _0xc6ebef=_0xf997[_0x5b5399];return _0xc6ebef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7f99('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f99('0x1'));var rp=require(_0x7f99('0x2'));var moment=require(_0x7f99('0x3'));var BPromise=require(_0x7f99('0x4'));var Mustache=require(_0x7f99('0x5'));var util=require(_0x7f99('0x6'));var path=require(_0x7f99('0x7'));var sox=require(_0x7f99('0x8'));var csv=require(_0x7f99('0x9'));var ejs=require(_0x7f99('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7f99('0xb'));var squel=require(_0x7f99('0xc'));var crypto=require('crypto');var jsforce=require(_0x7f99('0xd'));var deskjs=require(_0x7f99('0xe'));var toCsv=require(_0x7f99('0x9'));var querystring=require(_0x7f99('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f99('0x10'));var authService=require(_0x7f99('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7f99('0x12'));var hardwareService=require(_0x7f99('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7f99('0x14'));var config=require(_0x7f99('0x15'));var licenseUtil=require(_0x7f99('0x16'));var db=require('../../mysqldb')['db'];config[_0x7f99('0x17')]=_[_0x7f99('0x18')](config[_0x7f99('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f99('0x17')]));require(_0x7f99('0x19'))['register'](socket);function respondWithStatusCode(_0x3312a2,_0x283dd1){_0x283dd1=_0x283dd1||0xcc;return function(_0x35bda9){if(_0x35bda9){return _0x3312a2['sendStatus'](_0x283dd1);}return _0x3312a2[_0x7f99('0x1a')](_0x283dd1)[_0x7f99('0x1b')]();};}function respondWithResult(_0x376b19,_0x413291){_0x413291=_0x413291||0xc8;return function(_0x17fe39){if(_0x17fe39){return _0x376b19[_0x7f99('0x1a')](_0x413291)[_0x7f99('0x1c')](_0x17fe39);}};}function respondWithFilteredResult(_0x84e125,_0x3d45a8){return function(_0xdc5342){if(_0xdc5342){var _0x1fb3a6=typeof _0x3d45a8['offset']===_0x7f99('0x1d')&&typeof _0x3d45a8[_0x7f99('0x1e')]===_0x7f99('0x1d');var _0x192f7f=_0xdc5342['count'];var _0x4a49b7=_0x1fb3a6?0x0:_0x3d45a8[_0x7f99('0x1f')];var _0x5db301=_0x1fb3a6?_0xdc5342[_0x7f99('0x20')]:_0x3d45a8[_0x7f99('0x1f')]+_0x3d45a8[_0x7f99('0x1e')];var _0x5ce8ea;if(_0x5db301>=_0x192f7f){_0x5db301=_0x192f7f;_0x5ce8ea=0xc8;}else{_0x5ce8ea=0xce;}_0x84e125[_0x7f99('0x1a')](_0x5ce8ea);return _0x84e125[_0x7f99('0x21')](_0x7f99('0x22'),_0x4a49b7+'-'+_0x5db301+'/'+_0x192f7f)[_0x7f99('0x1c')](_0xdc5342);}return null;};}function patchUpdates(_0x322d24){return function(_0x5c79ce){try{jsonpatch['apply'](_0x5c79ce,_0x322d24,!![]);}catch(_0x5c943e){return BPromise[_0x7f99('0x23')](_0x5c943e);}return _0x5c79ce[_0x7f99('0x24')]();};}function saveUpdates(_0x164312,_0x238a2a){return function(_0x2b74cc){if(_0x2b74cc){return _0x2b74cc[_0x7f99('0x25')](_0x164312)[_0x7f99('0x26')](function(_0x1b2fe1){return _0x1b2fe1;});}return null;};}function removeEntity(_0x4f5f76,_0x18ee1e){return function(_0x2d4763){if(_0x2d4763){return _0x2d4763['destroy']()[_0x7f99('0x26')](function(){_0x4f5f76['status'](0xcc)[_0x7f99('0x1b')]();});}};}function handleEntityNotFound(_0x3dd3e6,_0x5b4a84){return function(_0x2dd100){if(!_0x2dd100){_0x3dd3e6['sendStatus'](0x194);}return _0x2dd100;};}function handleError(_0x1cca02,_0x356931){_0x356931=_0x356931||0x1f4;return function(_0x205efb){logger[_0x7f99('0x27')](_0x205efb[_0x7f99('0x28')]);if(_0x205efb['name']){delete _0x205efb['name'];}_0x1cca02[_0x7f99('0x1a')](_0x356931)[_0x7f99('0x29')](_0x205efb);};}exports[_0x7f99('0x2a')]=function(_0x1b91dd,_0xb1d480){var _0x5e21e1={},_0xe74e59={},_0x15fcaa={'count':0x0,'rows':[]};var _0x4058c9=_[_0x7f99('0x2b')](db[_0x7f99('0x2c')][_0x7f99('0x2d')],function(_0x35949e){return{'name':_0x35949e[_0x7f99('0x2e')],'type':_0x35949e[_0x7f99('0x2f')][_0x7f99('0x30')]};});_0xe74e59[_0x7f99('0x31')]=_[_0x7f99('0x2b')](_0x4058c9,_0x7f99('0x32'));_0xe74e59[_0x7f99('0x33')]=_[_0x7f99('0x34')](_0x1b91dd['query']);_0xe74e59[_0x7f99('0x35')]=_[_0x7f99('0x36')](_0xe74e59[_0x7f99('0x31')],_0xe74e59[_0x7f99('0x33')]);_0x5e21e1[_0x7f99('0x37')]=_[_0x7f99('0x36')](_0xe74e59[_0x7f99('0x31')],qs[_0x7f99('0x38')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x38')]));_0x5e21e1[_0x7f99('0x37')]=_0x5e21e1[_0x7f99('0x37')][_0x7f99('0x39')]?_0x5e21e1[_0x7f99('0x37')]:_0xe74e59[_0x7f99('0x31')];if(!_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3a')]('nolimit')){_0x5e21e1['limit']=qs[_0x7f99('0x1e')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x1e')]);_0x5e21e1[_0x7f99('0x1f')]=qs[_0x7f99('0x1f')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x1f')]);}_0x5e21e1[_0x7f99('0x3b')]=qs[_0x7f99('0x3c')](_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3c')]);_0x5e21e1[_0x7f99('0x3d')]=qs['filters'](_['pick'](_0x1b91dd['query'],_0xe74e59[_0x7f99('0x35')]),_0x4058c9);if(_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3e')]){_0x5e21e1[_0x7f99('0x3d')]=_[_0x7f99('0x3f')](_0x5e21e1[_0x7f99('0x3d')],{'$or':_[_0x7f99('0x2b')](_0x4058c9,function(_0x36b7fc){if(_0x36b7fc[_0x7f99('0x2f')]!=='VIRTUAL'){var _0x457373={};_0x457373[_0x36b7fc[_0x7f99('0x32')]]={'$like':'%'+_0x1b91dd[_0x7f99('0x33')][_0x7f99('0x3e')]+'%'};return _0x457373;}})});}_0x5e21e1=_[_0x7f99('0x3f')]({},_0x5e21e1,_0x1b91dd['options']);var _0x4463e2={'where':_0x5e21e1[_0x7f99('0x3d')]};return db[_0x7f99('0x2c')][_0x7f99('0x20')](_0x4463e2)['then'](function(_0x18ae9e){_0x15fcaa[_0x7f99('0x20')]=_0x18ae9e;if(_0x1b91dd['query'][_0x7f99('0x40')]){_0x5e21e1[_0x7f99('0x41')]=[{'all':!![]}];}return db['UserProfile'][_0x7f99('0x42')](_0x5e21e1);})['then'](function(_0x983a6e){_0x15fcaa[_0x7f99('0x43')]=_0x983a6e;return _0x15fcaa;})['then'](respondWithFilteredResult(_0xb1d480,_0x5e21e1))[_0x7f99('0x44')](handleError(_0xb1d480,null));};exports[_0x7f99('0x45')]=function(_0x2cca4d,_0x1dffd1){var _0x5b2f45={'raw':![],'where':{'id':_0x2cca4d[_0x7f99('0x46')]['id']}},_0xf404e4={};_0xf404e4['model']=_['keys'](db[_0x7f99('0x2c')][_0x7f99('0x2d')]);_0xf404e4['query']=_[_0x7f99('0x34')](_0x2cca4d[_0x7f99('0x33')]);_0xf404e4[_0x7f99('0x35')]=_[_0x7f99('0x36')](_0xf404e4[_0x7f99('0x31')],_0xf404e4[_0x7f99('0x33')]);_0x5b2f45['attributes']=_['intersection'](_0xf404e4[_0x7f99('0x31')],qs[_0x7f99('0x38')](_0x2cca4d[_0x7f99('0x33')][_0x7f99('0x38')]));_0x5b2f45[_0x7f99('0x37')]=_0x5b2f45[_0x7f99('0x37')]['length']?_0x5b2f45[_0x7f99('0x37')]:_0xf404e4[_0x7f99('0x31')];if(_0x2cca4d['query'][_0x7f99('0x40')]){_0x5b2f45[_0x7f99('0x41')]=[{'all':!![]}];}_0x5b2f45=_[_0x7f99('0x3f')]({},_0x5b2f45,_0x2cca4d[_0x7f99('0x47')]);return db['UserProfile']['find'](_0x5b2f45)['then'](handleEntityNotFound(_0x1dffd1,null))[_0x7f99('0x26')](respondWithResult(_0x1dffd1,null))[_0x7f99('0x44')](handleError(_0x1dffd1,null));};exports['create']=function(_0x2b28be,_0x559143){return db['UserProfile'][_0x7f99('0x48')](_0x2b28be[_0x7f99('0x49')],{})[_0x7f99('0x26')](respondWithResult(_0x559143,0xc9))[_0x7f99('0x44')](handleError(_0x559143,null));};exports[_0x7f99('0x4a')]=function(_0x1c6b96,_0x15e82f){var _0x42c50b={'where':{'id':_0x1c6b96[_0x7f99('0x46')]['id']}},_0x1045ef={};_0x1045ef[_0x7f99('0x31')]=_[_0x7f99('0x34')](db[_0x7f99('0x2c')][_0x7f99('0x2d')]);_0x42c50b[_0x7f99('0x37')]=_[_0x7f99('0x36')](_0x1045ef[_0x7f99('0x31')],qs[_0x7f99('0x38')](_0x1c6b96[_0x7f99('0x33')][_0x7f99('0x38')]));_0x42c50b['attributes']=_0x42c50b[_0x7f99('0x37')][_0x7f99('0x39')]?_0x42c50b[_0x7f99('0x37')]:_0x1045ef[_0x7f99('0x31')];if(_0x1c6b96['query'][_0x7f99('0x40')]){_0x42c50b[_0x7f99('0x41')]=[{'all':!![]}];}_0x42c50b=_[_0x7f99('0x3f')]({},_0x42c50b,_0x1c6b96[_0x7f99('0x47')]);return db[_0x7f99('0x2c')]['find'](_0x42c50b)[_0x7f99('0x26')](handleEntityNotFound(_0x15e82f,null))[_0x7f99('0x26')](function(_0x21a717){if(_0x21a717){var _0x33e017=_0x21a717['get']({'plain':!![]});_0x33e017=qs[_0x7f99('0x4b')](_0x33e017,['id','createdAt',_0x7f99('0x4c'),_0x7f99('0x4d')]);_0x1c6b96['body']=_[_0x7f99('0x4b')](_0x1c6b96['body'],['id',_0x7f99('0x4e'),_0x7f99('0x4c')]);return db[_0x7f99('0x4f')][_0x7f99('0x50')](function(_0x4561ed){return db[_0x7f99('0x2c')][_0x7f99('0x48')](_[_0x7f99('0x3f')](_0x33e017,_0x1c6b96[_0x7f99('0x49')]),{'include':_0x1c6b96['query'][_0x7f99('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x4561ed})[_0x7f99('0x26')](function(_0x276a6f){var _0x1aec82=_0x276a6f[_0x7f99('0x51')]({'plain':!![]});return db[_0x7f99('0x52')][_0x7f99('0x42')]({'where':{'userProfileId':_0x1c6b96[_0x7f99('0x46')]['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x18d0c6){if(_0x18d0c6){return BPromise['each'](_0x18d0c6,function(_0x1c3a80){return new BPromise(function(_0x1f85d7,_0x529b1a){if(_0x1c3a80[_0x7f99('0x53')]===null||_0x1c3a80['autoAssociation']===0x1)_0x1f85d7(null);return db['UserProfileResource'][_0x7f99('0x42')]({'where':{'sectionId':_0x1c3a80['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x129bb4){var _0x55eeab=_[_0x7f99('0x2b')](_0x129bb4,function(_0x57728a){return qs[_0x7f99('0x4b')](_0x57728a,['id',_0x7f99('0x4e'),_0x7f99('0x4c'),_0x7f99('0x54')]);});_0x1f85d7(_0x55eeab);})[_0x7f99('0x44')](function(_0x142a34){_0x529b1a(_0x142a34);});})[_0x7f99('0x26')](function(_0x140380){var _0x559f72=qs[_0x7f99('0x4b')](_0x1c3a80,['id',_0x7f99('0x4e'),_0x7f99('0x4c')]);_0x559f72['userProfileId']=_0x1aec82['id'];if(_0x140380)_0x559f72[_0x7f99('0x55')]=_0x140380;return _0x559f72;})[_0x7f99('0x26')](function(_0x19cf1d){return db['UserProfileSection'][_0x7f99('0x48')](_0x19cf1d,{'include':[{'model':db['UserProfileResource'],'as':'Resources'}],'raw':!![],'transaction':_0x4561ed});});})['then'](function(){return _0x1aec82;});}});});});}})[_0x7f99('0x26')](respondWithResult(_0x15e82f,0xc9))[_0x7f99('0x44')](handleError(_0x15e82f,null));};exports[_0x7f99('0x25')]=function(_0x36c6cc,_0x4f8d77){if(_0x36c6cc[_0x7f99('0x49')]['id']){delete _0x36c6cc[_0x7f99('0x49')]['id'];}return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x36c6cc[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x4f8d77,null))[_0x7f99('0x26')](saveUpdates(_0x36c6cc[_0x7f99('0x49')],null))[_0x7f99('0x26')](respondWithResult(_0x4f8d77,null))[_0x7f99('0x44')](handleError(_0x4f8d77,null));};exports[_0x7f99('0x57')]=function(_0x528bf6,_0x4ad7e1){return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x528bf6[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x4ad7e1,null))[_0x7f99('0x26')](removeEntity(_0x4ad7e1,null))['catch'](handleError(_0x4ad7e1,null));};exports[_0x7f99('0x58')]=function(_0x55ce42,_0x2f2fa2){return db[_0x7f99('0x2c')][_0x7f99('0x58')]()[_0x7f99('0x26')](respondWithResult(_0x2f2fa2,null))['catch'](handleError(_0x2f2fa2,null));};exports[_0x7f99('0x59')]=function(_0x3887c3,_0x2419bd){var _0x2143b0=_0x3887c3[_0x7f99('0x49')];return db['UserProfile'][_0x7f99('0x56')]({'where':{'id':_0x3887c3[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x2419bd,null))['then'](function(_0x4ba050){if(_0x4ba050){return db[_0x7f99('0x4f')]['transaction'](function(_0x520990){return db[_0x7f99('0x52')]['destroy']({'where':{'userProfileId':_0x3887c3[_0x7f99('0x46')]['id'],'sectionId':_[_0x7f99('0x2b')](_0x2143b0,function(_0x43512c){return _0x43512c[_0x7f99('0x54')];})},'transaction':_0x520990})[_0x7f99('0x26')](function(){var _0x2083b4=_[_0x7f99('0x2b')](_0x2143b0,function(_0x127668){_0x127668[_0x7f99('0x5a')]=_0x3887c3[_0x7f99('0x46')]['id'];return _0x127668;});var _0x231e04=[];return BPromise[_0x7f99('0x5b')](_0x2083b4,function(_0x54c122){return db[_0x7f99('0x52')][_0x7f99('0x48')](_0x54c122,{'include':[{'model':db[_0x7f99('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x520990})[_0x7f99('0x26')](function(_0x239305){_0x231e04['push'](_0x239305[_0x7f99('0x51')]({'plain':!![]}));});})[_0x7f99('0x26')](function(){return _0x231e04;});});});}})[_0x7f99('0x26')](function(_0x25c849){return _0x25c849;})[_0x7f99('0x26')](respondWithResult(_0x2419bd,null))[_0x7f99('0x44')](handleError(_0x2419bd,null));};exports['removeSections']=function(_0x333500,_0x548f4f){var _0x2ff64e;return db[_0x7f99('0x2c')]['find']({'where':{'id':_0x333500[_0x7f99('0x46')]['id']},'attributes':['id',_0x7f99('0x32')]})[_0x7f99('0x26')](handleEntityNotFound(_0x548f4f,null))[_0x7f99('0x26')](function(_0xecd7f4){if(_0xecd7f4){_0x2ff64e=_0xecd7f4;return db[_0x7f99('0x52')]['destroy']({'where':{'userProfileId':_0x333500['params']['id'],'sectionId':_0x333500[_0x7f99('0x33')]['ids']}});}})['then'](function(){return _0x2ff64e;})['then'](respondWithStatusCode(_0x548f4f,null))[_0x7f99('0x44')](handleError(_0x548f4f,null));};exports[_0x7f99('0x5d')]=function(_0x5abe0f,_0x46f9a5){var _0x487db3=[];var _0x309332=[];return db[_0x7f99('0x52')][_0x7f99('0x42')]({'where':{'userProfileId':_0x5abe0f['params']['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x1f329b){_0x487db3=_[_0x7f99('0x3e')](_0x1f329b,function(_0x4eddb1){return _0x4eddb1[_0x7f99('0x5e')]===0x1||_[_0x7f99('0x5f')]([0x3eb,0x709],_0x4eddb1[_0x7f99('0x54')]);});if(!_['isEmpty'](_0x487db3)){return _[_0x7f99('0x2b')](_0x487db3,function(_0xe35277){return _0xe35277['sectionId'];});}else{return;}})[_0x7f99('0x26')](function(_0x4c0ad7){if(_0x4c0ad7)_0x309332=_0x4c0ad7;if(_[_0x7f99('0x5f')](_0x309332,0x64)){var _0x4213a5=_[_0x7f99('0x56')](_0x487db3,{'sectionId':0x64});return hasDefaultDashboard(_0x4213a5)[_0x7f99('0x26')](function(_0x5902d9){return _[_0x7f99('0x2b')](_0x487db3,function(_0x4090ae){if(_0x4090ae[_0x7f99('0x54')]===0x64){_0x4090ae['subsections']=_0x5902d9;}return _0x4090ae;});});}else{return;}})[_0x7f99('0x26')](function(_0x5ebb67){if(_0x5ebb67)_0x487db3=_0x5ebb67;if(_['includes'](_0x309332,0x3eb)){var _0x4a8818=_[_0x7f99('0x56')](_0x487db3,{'sectionId':0x3eb});return getCustomDashboards(_0x4a8818)['then'](function(_0x2cdb0c){return _[_0x7f99('0x2b')](_0x487db3,function(_0x10f7fc){if(_0x4a8818[_0x7f99('0x5e')]){if(_0x10f7fc[_0x7f99('0x54')]===0x3eb){_0x10f7fc[_0x7f99('0x60')]=_0x2cdb0c;}}else{if(_0x10f7fc[_0x7f99('0x54')]===0x64){if(!_0x10f7fc['subsections']){_0x10f7fc['subsections']=[];}_0x10f7fc[_0x7f99('0x60')]=_0x10f7fc['subsections'][_0x7f99('0x61')](_0x2cdb0c);}}return _0x10f7fc;});});}else{return;}})[_0x7f99('0x26')](function(_0x41c122){if(_0x41c122)_0x487db3=_0x41c122;if(_[_0x7f99('0x5f')](_0x309332,0x709)){var _0x519edc=_['find'](_0x487db3,{'sectionId':0x709});return getPlugins(_0x519edc)[_0x7f99('0x26')](function(_0x3270cb){if(_0x519edc[_0x7f99('0x5e')]){return _[_0x7f99('0x2b')](_0x487db3,function(_0x252dba){if(_0x252dba[_0x7f99('0x54')]===0x709){_0x252dba['subsections']=_0x3270cb;}return _0x252dba;});}else{var _0x2faaff={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3270cb};var _0x83f988=_[_0x7f99('0x2b')](_0x487db3);_0x83f988[_0x7f99('0x62')](_0x2faaff);return _0x83f988;}});}else{return;}})[_0x7f99('0x26')](function(_0x4a9476){if(_0x4a9476)_0x487db3=_0x4a9476;return _[_0x7f99('0x3e')](_0x487db3,[_0x7f99('0x5e'),0x1]);})['then'](respondWithResult(_0x46f9a5,null))[_0x7f99('0x44')](handleError(_0x46f9a5,null));};function hasDefaultDashboard(_0x201818){var _0x29ecb4=[0x65];return new BPromise(function(_0x66749d,_0x38c534){try{if(_0x201818[_0x7f99('0x53')]){_0x66749d(_0x29ecb4);}else{return db[_0x7f99('0x5c')][_0x7f99('0x63')]({'where':{'sectionId':_0x201818['id']},'raw':!![]})[_0x7f99('0x26')](function(_0x3886c4){_0x3886c4?_0x66749d(_0x29ecb4):_0x66749d();});}}catch(_0xc9ae52){_0x38c534(_0xc9ae52);}});}function getCustomDashboards(_0x430795){var _0x4ceaff=[];return new BPromise(function(_0x450dbc,_0x30c374){try{if(_0x430795['autoAssociation']){return db['Dashboard'][_0x7f99('0x42')]({'raw':!![]})[_0x7f99('0x26')](function(_0x51499a){_0x51499a[_0x7f99('0x64')](function(_0x467a41){_0x4ceaff['push'](_0x467a41['id']+0x1869f);});_0x450dbc(_0x4ceaff);});}else{return db[_0x7f99('0x5c')][_0x7f99('0x42')]({'where':{'sectionId':_0x430795['id']},'raw':!![]})[_0x7f99('0x26')](function(_0xce6087){_0xce6087[_0x7f99('0x64')](function(_0x53637f){_0x4ceaff[_0x7f99('0x62')](_0x53637f['resourceId']+0x1869f);});_0x450dbc(_0x4ceaff);});}}catch(_0x5d47d0){_0x30c374(_0x5d47d0);}});}function getPlugins(_0x2147f1){var _0x1d2e38=[];return new BPromise(function(_0x394715,_0x4490fc){try{if(_0x2147f1['autoAssociation']){return db[_0x7f99('0x65')]['findAll']({'raw':!![]})[_0x7f99('0x26')](function(_0x3eea34){_0x3eea34[_0x7f99('0x64')](function(_0x17819b){_0x1d2e38[_0x7f99('0x62')](_0x17819b['id']+0x15b38);});_0x394715(_0x1d2e38);});}else{return db[_0x7f99('0x5c')][_0x7f99('0x42')]({'where':{'sectionId':_0x2147f1['id']},'raw':!![]})['then'](function(_0x44db09){_0x44db09['forEach'](function(_0xc2c076){_0x1d2e38[_0x7f99('0x62')](_0xc2c076['resourceId']+0x15b38);});_0x394715(_0x1d2e38);});}}catch(_0x49de01){_0x4490fc(_0x49de01);}});}exports['addResources']=function(_0x3e646f,_0x1bfebf){return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x3e646f[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](handleEntityNotFound(_0x1bfebf,null))[_0x7f99('0x26')](function(_0xc96f18){if(_0xc96f18){return db['sequelize'][_0x7f99('0x50')](function(_0x1bb12e){return db[_0x7f99('0x52')]['findAll']({'where':{'userProfileId':_0x3e646f[_0x7f99('0x46')]['id']},'attributes':['id'],'raw':!![]})[_0x7f99('0x26')](function(_0x406466){if(_0x406466){return db[_0x7f99('0x52')][_0x7f99('0x57')]({'where':{'userProfileId':_0x3e646f[_0x7f99('0x46')]['id'],'id':_['map'](_0x406466,function(_0x281a17){return _0x281a17['id'];})},'transaction':_0x1bb12e});}})['then'](function(_0x1af5f6){var _0x32dd23=_[_0x7f99('0x2b')](_0x3e646f['body'],function(_0x43dda8){_0x43dda8[_0x7f99('0x5a')]=_0x3e646f[_0x7f99('0x46')]['id'];return _0x43dda8;});return db[_0x7f99('0x52')][_0x7f99('0x66')](_0x32dd23,{'raw':!![],'transaction':_0x1bb12e});})[_0x7f99('0x26')](function(_0x389130){var _0x522a6b=_[_0x7f99('0x3e')](_['map'](_0x389130,function(_0xcccf25){return _0xcccf25[_0x7f99('0x51')]({'plain':!![]});}),{'includeAll':![]});if(_0x522a6b){return db['UserProfileSection'][_0x7f99('0x42')]({'where':{'userProfileId':_0x3e646f[_0x7f99('0x46')]['id'],'sectionId':_[_0x7f99('0x2b')](_0x522a6b,function(_0x320199){return _0x320199['sectionId'];})},'attributes':['id',_0x7f99('0x54')],'raw':!![]})[_0x7f99('0x26')](function(_0xfa803){var _0x25f3a7=_[_0x7f99('0x2b')](_0x3e646f[_0x7f99('0x49')],function(_0x20656d){_0x20656d[_0x7f99('0x5a')]=_0x3e646f[_0x7f99('0x46')]['id'];return _0x20656d;});return db[_0x7f99('0x5c')][_0x7f99('0x66')](_0x25f3a7,{'raw':!![],'transaction':_0x1bb12e});});}})[_0x7f99('0x44')](handleError(_0x1bfebf,null));});}})[_0x7f99('0x26')](function(_0x150f53){var _0x2cabe7=_[_0x7f99('0x2b')](_0x150f53,function(_0x5b83da){return _0x5b83da[_0x7f99('0x51')]({'plain':!![]});});})['then'](respondWithResult(_0x1bfebf,null))['catch'](handleError(_0x1bfebf,null));};exports[_0x7f99('0x67')]=function(_0x2c47fb,_0x5ec3df,_0x1ea747){return db['UserProfile'][_0x7f99('0x56')]({'where':{'id':_0x2c47fb[_0x7f99('0x46')]['id']}})['then'](handleEntityNotFound(_0x5ec3df,null))[_0x7f99('0x26')](function(_0x510d3c){if(_0x510d3c){return _0x510d3c[_0x7f99('0x67')](_0x2c47fb[_0x7f99('0x33')][_0x7f99('0x68')]);}})['then'](respondWithStatusCode(_0x5ec3df,null))[_0x7f99('0x44')](handleError(_0x5ec3df,null));};exports[_0x7f99('0x69')]=function(_0x7af538,_0x4b5b33){var _0xe98158={};if(!_0x7af538['query'][_0x7f99('0x6a')])throw new Error(_0x7f99('0x6b'));if(!_0x7af538[_0x7f99('0x33')][_0x7f99('0x3a')](_0x7f99('0x6c'))){_0xe98158[_0x7f99('0x1e')]=qs[_0x7f99('0x1e')](_0x7af538['query']['limit']);_0xe98158['offset']=qs[_0x7f99('0x1f')](_0x7af538[_0x7f99('0x33')][_0x7f99('0x1f')]);}return db[_0x7f99('0x2c')][_0x7f99('0x56')]({'where':{'id':_0x7af538[_0x7f99('0x46')]['id']}})[_0x7f99('0x26')](function(_0x5edd65){if(!_0x5edd65)throw new Error(_0x7f99('0x6d')+_0x7af538[_0x7f99('0x46')]['id']);return db['UserProfile']['getResources'](_0x7af538);})[_0x7f99('0x26')](respondWithFilteredResult(_0x4b5b33,_0xe98158))[_0x7f99('0x44')](handleError(_0x4b5b33,null));}; \ No newline at end of file +var _0x252f=['enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','bulkCreate','removeResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','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','../../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','./userProfile.socket','register','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','UserProfile','rawAttributes','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','filter','where','VIRTUAL','merge','count','include','findAll','rows','catch','show','keys','includeAll','options','find','create','body','clone','params','get','omit','createdAt','updatedAt','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','UserProfileResource','describe','addSections','push','removeSections','ids','getSections'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0x252f,0x1e2));var _0xf252=function(_0x22c597,_0x1b85f5){_0x22c597=_0x22c597-0x0;var _0x42ded4=_0x252f[_0x22c597];return _0x42ded4;};'use strict';var emlformat=require(_0xf252('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf252('0x1'));var jsonpatch=require(_0xf252('0x2'));var rp=require(_0xf252('0x3'));var moment=require(_0xf252('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf252('0x5'));var util=require(_0xf252('0x6'));var path=require(_0xf252('0x7'));var sox=require(_0xf252('0x8'));var csv=require(_0xf252('0x9'));var ejs=require(_0xf252('0xa'));var fs=require('fs');var fs_extra=require(_0xf252('0xb'));var _=require(_0xf252('0xc'));var squel=require(_0xf252('0xd'));var crypto=require(_0xf252('0xe'));var jsforce=require(_0xf252('0xf'));var deskjs=require(_0xf252('0x10'));var toCsv=require('to-csv');var querystring=require(_0xf252('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf252('0x12'));var qs=require(_0xf252('0x13'));var as=require(_0xf252('0x14'));var hardwareService=require(_0xf252('0x15'));var logger=require(_0xf252('0x16'))(_0xf252('0x17'));var utils=require(_0xf252('0x18'));var config=require(_0xf252('0x19'));var licenseUtil=require(_0xf252('0x1a'));var db=require(_0xf252('0x1b'))['db'];config[_0xf252('0x1c')]=_[_0xf252('0x1d')](config[_0xf252('0x1c')],{'host':_0xf252('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf252('0x1c')]));require(_0xf252('0x1f'))[_0xf252('0x20')](socket);function respondWithStatusCode(_0x3345ce,_0x11b919){_0x11b919=_0x11b919||0xcc;return function(_0x25e48e){if(_0x25e48e){return _0x3345ce['sendStatus'](_0x11b919);}return _0x3345ce[_0xf252('0x21')](_0x11b919)['end']();};}function respondWithResult(_0x400ed8,_0x3b7efd){_0x3b7efd=_0x3b7efd||0xc8;return function(_0x19c993){if(_0x19c993){return _0x400ed8[_0xf252('0x21')](_0x3b7efd)[_0xf252('0x22')](_0x19c993);}};}function respondWithFilteredResult(_0x2f2be4,_0x54703b){return function(_0x34848b){if(_0x34848b){var _0x283ed7=typeof _0x54703b[_0xf252('0x23')]===_0xf252('0x24')&&typeof _0x54703b['limit']===_0xf252('0x24');var _0x5cea3d=_0x34848b['count'];var _0x565f23=_0x283ed7?0x0:_0x54703b[_0xf252('0x23')];var _0xa4ca7a=_0x283ed7?_0x34848b['count']:_0x54703b[_0xf252('0x23')]+_0x54703b[_0xf252('0x25')];var _0x3e0a48;if(_0xa4ca7a>=_0x5cea3d){_0xa4ca7a=_0x5cea3d;_0x3e0a48=0xc8;}else{_0x3e0a48=0xce;}_0x2f2be4['status'](_0x3e0a48);return _0x2f2be4[_0xf252('0x26')](_0xf252('0x27'),_0x565f23+'-'+_0xa4ca7a+'/'+_0x5cea3d)[_0xf252('0x22')](_0x34848b);}return null;};}function patchUpdates(_0x38136a){return function(_0x1674ce){try{jsonpatch[_0xf252('0x28')](_0x1674ce,_0x38136a,!![]);}catch(_0x5844e5){return BPromise[_0xf252('0x29')](_0x5844e5);}return _0x1674ce[_0xf252('0x2a')]();};}function saveUpdates(_0x51bd5e,_0x2a5c03){return function(_0x258cdb){if(_0x258cdb){return _0x258cdb[_0xf252('0x2b')](_0x51bd5e)[_0xf252('0x2c')](function(_0x4518c4){return _0x4518c4;});}return null;};}function removeEntity(_0x343a2a,_0x1a0bbf){return function(_0x336395){if(_0x336395){return _0x336395[_0xf252('0x2d')]()[_0xf252('0x2c')](function(){_0x343a2a[_0xf252('0x21')](0xcc)[_0xf252('0x2e')]();});}};}function handleEntityNotFound(_0x5cb67c,_0x45d2df){return function(_0x27accd){if(!_0x27accd){_0x5cb67c[_0xf252('0x2f')](0x194);}return _0x27accd;};}function handleError(_0x52a725,_0x54350d){_0x54350d=_0x54350d||0x1f4;return function(_0x2691ea){logger['error'](_0x2691ea[_0xf252('0x30')]);if(_0x2691ea[_0xf252('0x31')]){delete _0x2691ea['name'];}_0x52a725[_0xf252('0x21')](_0x54350d)[_0xf252('0x32')](_0x2691ea);};}exports[_0xf252('0x33')]=function(_0x11f018,_0x22f1e1){var _0x10c623={},_0x37b999={},_0x24d9d6={'count':0x0,'rows':[]};var _0x5bcb88=_[_0xf252('0x34')](db[_0xf252('0x35')][_0xf252('0x36')],function(_0x557b1c){return{'name':_0x557b1c['fieldName'],'type':_0x557b1c['type']['key']};});_0x37b999[_0xf252('0x37')]=_[_0xf252('0x34')](_0x5bcb88,_0xf252('0x31'));_0x37b999[_0xf252('0x38')]=_['keys'](_0x11f018[_0xf252('0x38')]);_0x37b999['filters']=_[_0xf252('0x39')](_0x37b999[_0xf252('0x37')],_0x37b999[_0xf252('0x38')]);_0x10c623[_0xf252('0x3a')]=_[_0xf252('0x39')](_0x37b999[_0xf252('0x37')],qs[_0xf252('0x3b')](_0x11f018[_0xf252('0x38')][_0xf252('0x3b')]));_0x10c623['attributes']=_0x10c623[_0xf252('0x3a')][_0xf252('0x3c')]?_0x10c623[_0xf252('0x3a')]:_0x37b999[_0xf252('0x37')];if(!_0x11f018['query'][_0xf252('0x3d')](_0xf252('0x3e'))){_0x10c623['limit']=qs['limit'](_0x11f018[_0xf252('0x38')][_0xf252('0x25')]);_0x10c623[_0xf252('0x23')]=qs[_0xf252('0x23')](_0x11f018[_0xf252('0x38')][_0xf252('0x23')]);}_0x10c623[_0xf252('0x3f')]=qs['sort'](_0x11f018['query']['sort']);_0x10c623['where']=qs[_0xf252('0x40')](_[_0xf252('0x41')](_0x11f018[_0xf252('0x38')],_0x37b999['filters']),_0x5bcb88);if(_0x11f018[_0xf252('0x38')][_0xf252('0x42')]){_0x10c623[_0xf252('0x43')]=_['merge'](_0x10c623[_0xf252('0x43')],{'$or':_[_0xf252('0x34')](_0x5bcb88,function(_0x21a438){if(_0x21a438['type']!==_0xf252('0x44')){var _0x508321={};_0x508321[_0x21a438['name']]={'$like':'%'+_0x11f018[_0xf252('0x38')][_0xf252('0x42')]+'%'};return _0x508321;}})});}_0x10c623=_[_0xf252('0x45')]({},_0x10c623,_0x11f018['options']);var _0x4790a5={'where':_0x10c623[_0xf252('0x43')]};return db['UserProfile'][_0xf252('0x46')](_0x4790a5)['then'](function(_0x52cadd){_0x24d9d6[_0xf252('0x46')]=_0x52cadd;if(_0x11f018[_0xf252('0x38')]['includeAll']){_0x10c623[_0xf252('0x47')]=[{'all':!![]}];}return db[_0xf252('0x35')][_0xf252('0x48')](_0x10c623);})[_0xf252('0x2c')](function(_0x41707a){_0x24d9d6[_0xf252('0x49')]=_0x41707a;return _0x24d9d6;})['then'](respondWithFilteredResult(_0x22f1e1,_0x10c623))[_0xf252('0x4a')](handleError(_0x22f1e1,null));};exports[_0xf252('0x4b')]=function(_0x3b80d5,_0x5cc0f4){var _0x2d5df3={'raw':![],'where':{'id':_0x3b80d5['params']['id']}},_0x4e12b9={};_0x4e12b9['model']=_[_0xf252('0x4c')](db['UserProfile'][_0xf252('0x36')]);_0x4e12b9['query']=_[_0xf252('0x4c')](_0x3b80d5['query']);_0x4e12b9[_0xf252('0x40')]=_[_0xf252('0x39')](_0x4e12b9[_0xf252('0x37')],_0x4e12b9['query']);_0x2d5df3[_0xf252('0x3a')]=_['intersection'](_0x4e12b9[_0xf252('0x37')],qs[_0xf252('0x3b')](_0x3b80d5[_0xf252('0x38')][_0xf252('0x3b')]));_0x2d5df3[_0xf252('0x3a')]=_0x2d5df3[_0xf252('0x3a')]['length']?_0x2d5df3['attributes']:_0x4e12b9[_0xf252('0x37')];if(_0x3b80d5[_0xf252('0x38')][_0xf252('0x4d')]){_0x2d5df3['include']=[{'all':!![]}];}_0x2d5df3=_[_0xf252('0x45')]({},_0x2d5df3,_0x3b80d5[_0xf252('0x4e')]);return db[_0xf252('0x35')][_0xf252('0x4f')](_0x2d5df3)[_0xf252('0x2c')](handleEntityNotFound(_0x5cc0f4,null))[_0xf252('0x2c')](respondWithResult(_0x5cc0f4,null))[_0xf252('0x4a')](handleError(_0x5cc0f4,null));};exports[_0xf252('0x50')]=function(_0xebd415,_0x5103f7){return db[_0xf252('0x35')][_0xf252('0x50')](_0xebd415[_0xf252('0x51')],{})[_0xf252('0x2c')](respondWithResult(_0x5103f7,0xc9))[_0xf252('0x4a')](handleError(_0x5103f7,null));};exports[_0xf252('0x52')]=function(_0x138176,_0x173422){var _0x2bfd98={'where':{'id':_0x138176[_0xf252('0x53')]['id']}},_0x19f95f={};_0x19f95f[_0xf252('0x37')]=_['keys'](db['UserProfile'][_0xf252('0x36')]);_0x2bfd98[_0xf252('0x3a')]=_[_0xf252('0x39')](_0x19f95f[_0xf252('0x37')],qs[_0xf252('0x3b')](_0x138176[_0xf252('0x38')][_0xf252('0x3b')]));_0x2bfd98[_0xf252('0x3a')]=_0x2bfd98['attributes'][_0xf252('0x3c')]?_0x2bfd98[_0xf252('0x3a')]:_0x19f95f[_0xf252('0x37')];if(_0x138176[_0xf252('0x38')][_0xf252('0x4d')]){_0x2bfd98[_0xf252('0x47')]=[{'all':!![]}];}_0x2bfd98=_[_0xf252('0x45')]({},_0x2bfd98,_0x138176[_0xf252('0x4e')]);return db[_0xf252('0x35')][_0xf252('0x4f')](_0x2bfd98)['then'](handleEntityNotFound(_0x173422,null))[_0xf252('0x2c')](function(_0x3c2ab3){if(_0x3c2ab3){var _0x59518e=_0x3c2ab3[_0xf252('0x54')]({'plain':!![]});_0x59518e=qs[_0xf252('0x55')](_0x59518e,['id',_0xf252('0x56'),_0xf252('0x57'),'crudPermissions']);_0x138176['body']=_['omit'](_0x138176[_0xf252('0x51')],['id',_0xf252('0x56'),_0xf252('0x57')]);return db[_0xf252('0x58')][_0xf252('0x59')](function(_0x261d0d){return db[_0xf252('0x35')]['create'](_['merge'](_0x59518e,_0x138176[_0xf252('0x51')]),{'include':_0x138176['query'][_0xf252('0x4d')]?[{'all':!![]}]:undefined,'transaction':_0x261d0d})[_0xf252('0x2c')](function(_0x103de6){var _0x12dbf5=_0x103de6['get']({'plain':!![]});return db[_0xf252('0x5a')][_0xf252('0x48')]({'where':{'userProfileId':_0x138176[_0xf252('0x53')]['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x475d0c){if(_0x475d0c){return BPromise[_0xf252('0x5b')](_0x475d0c,function(_0x50442d){return new BPromise(function(_0x5b32ea,_0x1a420d){if(_0x50442d['autoAssociation']===null||_0x50442d[_0xf252('0x5c')]===0x1)_0x5b32ea(null);return db['UserProfileResource'][_0xf252('0x48')]({'where':{'sectionId':_0x50442d['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x4cd33e){var _0x2f7753=_['map'](_0x4cd33e,function(_0x3e7d9d){return qs[_0xf252('0x55')](_0x3e7d9d,['id','createdAt',_0xf252('0x57'),_0xf252('0x5d')]);});_0x5b32ea(_0x2f7753);})[_0xf252('0x4a')](function(_0x48bc7e){_0x1a420d(_0x48bc7e);});})[_0xf252('0x2c')](function(_0x2c9844){var _0x2741d8=qs['omit'](_0x50442d,['id',_0xf252('0x56'),_0xf252('0x57')]);_0x2741d8[_0xf252('0x5e')]=_0x12dbf5['id'];if(_0x2c9844)_0x2741d8[_0xf252('0x5f')]=_0x2c9844;return _0x2741d8;})[_0xf252('0x2c')](function(_0x2c5080){return db[_0xf252('0x5a')][_0xf252('0x50')](_0x2c5080,{'include':[{'model':db[_0xf252('0x60')],'as':_0xf252('0x5f')}],'raw':!![],'transaction':_0x261d0d});});})[_0xf252('0x2c')](function(){return _0x12dbf5;});}});});});}})[_0xf252('0x2c')](respondWithResult(_0x173422,0xc9))[_0xf252('0x4a')](handleError(_0x173422,null));};exports[_0xf252('0x2b')]=function(_0x2a078a,_0xdfe025){if(_0x2a078a[_0xf252('0x51')]['id']){delete _0x2a078a[_0xf252('0x51')]['id'];}return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x2a078a[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0xdfe025,null))['then'](saveUpdates(_0x2a078a[_0xf252('0x51')],null))[_0xf252('0x2c')](respondWithResult(_0xdfe025,null))['catch'](handleError(_0xdfe025,null));};exports[_0xf252('0x2d')]=function(_0xa648ba,_0x5d6bc5){return db[_0xf252('0x35')]['find']({'where':{'id':_0xa648ba[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x5d6bc5,null))[_0xf252('0x2c')](removeEntity(_0x5d6bc5,null))[_0xf252('0x4a')](handleError(_0x5d6bc5,null));};exports[_0xf252('0x61')]=function(_0x428dd6,_0x1f60c1){return db[_0xf252('0x35')]['describe']()[_0xf252('0x2c')](respondWithResult(_0x1f60c1,null))[_0xf252('0x4a')](handleError(_0x1f60c1,null));};exports[_0xf252('0x62')]=function(_0x1d060a,_0x442729){var _0xa2d70a=_0x1d060a[_0xf252('0x51')];return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x1d060a['params']['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x442729,null))[_0xf252('0x2c')](function(_0x15807e){if(_0x15807e){return db['sequelize'][_0xf252('0x59')](function(_0x50de5a){return db[_0xf252('0x5a')][_0xf252('0x2d')]({'where':{'userProfileId':_0x1d060a[_0xf252('0x53')]['id'],'sectionId':_[_0xf252('0x34')](_0xa2d70a,function(_0x2e7b02){return _0x2e7b02[_0xf252('0x5d')];})},'transaction':_0x50de5a})[_0xf252('0x2c')](function(){var _0x1cccbd=_['map'](_0xa2d70a,function(_0x3c8323){_0x3c8323[_0xf252('0x5e')]=_0x1d060a['params']['id'];return _0x3c8323;});var _0x47f2c7=[];return BPromise[_0xf252('0x5b')](_0x1cccbd,function(_0x45a750){return db[_0xf252('0x5a')][_0xf252('0x50')](_0x45a750,{'include':[{'model':db[_0xf252('0x60')],'as':'Resources'}],'raw':!![],'transaction':_0x50de5a})[_0xf252('0x2c')](function(_0x4f2ebb){_0x47f2c7[_0xf252('0x63')](_0x4f2ebb[_0xf252('0x54')]({'plain':!![]}));});})['then'](function(){return _0x47f2c7;});});});}})[_0xf252('0x2c')](function(_0x4bf930){return _0x4bf930;})['then'](respondWithResult(_0x442729,null))[_0xf252('0x4a')](handleError(_0x442729,null));};exports[_0xf252('0x64')]=function(_0x1bdc1e,_0x148d57){var _0x510ace;return db['UserProfile'][_0xf252('0x4f')]({'where':{'id':_0x1bdc1e['params']['id']},'attributes':['id',_0xf252('0x31')]})[_0xf252('0x2c')](handleEntityNotFound(_0x148d57,null))['then'](function(_0x10ab03){if(_0x10ab03){_0x510ace=_0x10ab03;return db[_0xf252('0x5a')][_0xf252('0x2d')]({'where':{'userProfileId':_0x1bdc1e[_0xf252('0x53')]['id'],'sectionId':_0x1bdc1e['query'][_0xf252('0x65')]}});}})['then'](function(){return _0x510ace;})[_0xf252('0x2c')](respondWithStatusCode(_0x148d57,null))[_0xf252('0x4a')](handleError(_0x148d57,null));};exports[_0xf252('0x66')]=function(_0x3191c5,_0x8a006f){var _0x51e6cc=[];var _0xeaca36=[];return db['UserProfileSection'][_0xf252('0x48')]({'where':{'userProfileId':_0x3191c5[_0xf252('0x53')]['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x4c96be){_0x51e6cc=_[_0xf252('0x42')](_0x4c96be,function(_0x348ed6){return _0x348ed6[_0xf252('0x67')]===0x1||_[_0xf252('0x68')]([0x3eb,0x709],_0x348ed6['sectionId']);});if(!_[_0xf252('0x69')](_0x51e6cc)){return _[_0xf252('0x34')](_0x51e6cc,function(_0x6167cb){return _0x6167cb[_0xf252('0x5d')];});}else{return;}})[_0xf252('0x2c')](function(_0x115811){if(_0x115811)_0xeaca36=_0x115811;if(_['includes'](_0xeaca36,0x64)){var _0x37dac5=_[_0xf252('0x4f')](_0x51e6cc,{'sectionId':0x64});return hasDefaultDashboard(_0x37dac5)[_0xf252('0x2c')](function(_0x1fea3d){return _[_0xf252('0x34')](_0x51e6cc,function(_0x5c6b2b){if(_0x5c6b2b[_0xf252('0x5d')]===0x64){_0x5c6b2b['subsections']=_0x1fea3d;}return _0x5c6b2b;});});}else{return;}})[_0xf252('0x2c')](function(_0x2d43cb){if(_0x2d43cb)_0x51e6cc=_0x2d43cb;if(_[_0xf252('0x68')](_0xeaca36,0x3eb)){var _0x23000e=_[_0xf252('0x4f')](_0x51e6cc,{'sectionId':0x3eb});return getCustomDashboards(_0x23000e)[_0xf252('0x2c')](function(_0x4882c7){return _[_0xf252('0x34')](_0x51e6cc,function(_0x114374){if(_0x23000e['enabled']){if(_0x114374[_0xf252('0x5d')]===0x3eb){_0x114374[_0xf252('0x6a')]=_0x4882c7;}}else{if(_0x114374[_0xf252('0x5d')]===0x64){if(!_0x114374[_0xf252('0x6a')]){_0x114374['subsections']=[];}_0x114374[_0xf252('0x6a')]=_0x114374[_0xf252('0x6a')][_0xf252('0x6b')](_0x4882c7);}}return _0x114374;});});}else{return;}})[_0xf252('0x2c')](function(_0x22c3a8){if(_0x22c3a8)_0x51e6cc=_0x22c3a8;if(_['includes'](_0xeaca36,0x709)){var _0x357a8a=_[_0xf252('0x4f')](_0x51e6cc,{'sectionId':0x709});return getPlugins(_0x357a8a)['then'](function(_0x30425e){if(_0x357a8a[_0xf252('0x67')]){return _[_0xf252('0x34')](_0x51e6cc,function(_0x2fc33b){if(_0x2fc33b[_0xf252('0x5d')]===0x709){_0x2fc33b[_0xf252('0x6a')]=_0x30425e;}return _0x2fc33b;});}else{var _0x20c90b={'sectionId':0x76c,'enabled':0x1,'subsections':_0x30425e};var _0x301497=_[_0xf252('0x34')](_0x51e6cc);_0x301497['push'](_0x20c90b);return _0x301497;}});}else{return;}})[_0xf252('0x2c')](function(_0x1638af){if(_0x1638af)_0x51e6cc=_0x1638af;return _['filter'](_0x51e6cc,[_0xf252('0x67'),0x1]);})[_0xf252('0x2c')](respondWithResult(_0x8a006f,null))[_0xf252('0x4a')](handleError(_0x8a006f,null));};function hasDefaultDashboard(_0x4569d0){var _0xe9f759=[0x65];return new BPromise(function(_0x6decf9,_0x20f0ad){try{if(_0x4569d0[_0xf252('0x5c')]){_0x6decf9(_0xe9f759);}else{return db['UserProfileResource'][_0xf252('0x6c')]({'where':{'sectionId':_0x4569d0['id']},'raw':!![]})['then'](function(_0x54756e){_0x54756e?_0x6decf9(_0xe9f759):_0x6decf9();});}}catch(_0x46f493){_0x20f0ad(_0x46f493);}});}function getCustomDashboards(_0x510543){var _0x1238f5=[];return new BPromise(function(_0x5e5cde,_0x179647){try{if(_0x510543[_0xf252('0x5c')]){return db[_0xf252('0x6d')][_0xf252('0x48')]({'raw':!![]})[_0xf252('0x2c')](function(_0x4ddf82){_0x4ddf82[_0xf252('0x6e')](function(_0x778d7b){_0x1238f5[_0xf252('0x63')](_0x778d7b['id']+0x1869f);});_0x5e5cde(_0x1238f5);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x510543['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x2c2f36){_0x2c2f36[_0xf252('0x6e')](function(_0x559019){_0x1238f5[_0xf252('0x63')](_0x559019[_0xf252('0x6f')]+0x1869f);});_0x5e5cde(_0x1238f5);});}}catch(_0x57fd97){_0x179647(_0x57fd97);}});}function getPlugins(_0x57da34){var _0x9c2ae=[];return new BPromise(function(_0x590b06,_0x137355){try{if(_0x57da34['autoAssociation']){return db['Plugin'][_0xf252('0x48')]({'raw':!![]})[_0xf252('0x2c')](function(_0x31ad7d){_0x31ad7d['forEach'](function(_0x15c68b){_0x9c2ae['push'](_0x15c68b['id']+0x15b38);});_0x590b06(_0x9c2ae);});}else{return db[_0xf252('0x60')]['findAll']({'where':{'sectionId':_0x57da34['id']},'raw':!![]})[_0xf252('0x2c')](function(_0x3bed83){_0x3bed83[_0xf252('0x6e')](function(_0x812767){_0x9c2ae[_0xf252('0x63')](_0x812767[_0xf252('0x6f')]+0x15b38);});_0x590b06(_0x9c2ae);});}}catch(_0x5e6c4f){_0x137355(_0x5e6c4f);}});}exports['addResources']=function(_0x798b04,_0x38d5bf){return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x798b04['params']['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x38d5bf,null))[_0xf252('0x2c')](function(_0x4627f7){if(_0x4627f7){return db[_0xf252('0x58')][_0xf252('0x59')](function(_0xa9bba3){return db['UserProfileSection'][_0xf252('0x48')]({'where':{'userProfileId':_0x798b04[_0xf252('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0xf252('0x2c')](function(_0x17eead){if(_0x17eead){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x798b04['params']['id'],'id':_[_0xf252('0x34')](_0x17eead,function(_0x438400){return _0x438400['id'];})},'transaction':_0xa9bba3});}})[_0xf252('0x2c')](function(_0x550033){var _0x519fac=_[_0xf252('0x34')](_0x798b04['body'],function(_0xb74841){_0xb74841[_0xf252('0x5e')]=_0x798b04['params']['id'];return _0xb74841;});return db['UserProfileSection'][_0xf252('0x70')](_0x519fac,{'raw':!![],'transaction':_0xa9bba3});})[_0xf252('0x2c')](function(_0x16f24e){var _0x5a149f=_[_0xf252('0x42')](_[_0xf252('0x34')](_0x16f24e,function(_0x1bd764){return _0x1bd764[_0xf252('0x54')]({'plain':!![]});}),{'includeAll':![]});if(_0x5a149f){return db[_0xf252('0x5a')][_0xf252('0x48')]({'where':{'userProfileId':_0x798b04[_0xf252('0x53')]['id'],'sectionId':_[_0xf252('0x34')](_0x5a149f,function(_0x48b103){return _0x48b103['sectionId'];})},'attributes':['id',_0xf252('0x5d')],'raw':!![]})['then'](function(_0x147c61){var _0x35c480=_[_0xf252('0x34')](_0x798b04[_0xf252('0x51')],function(_0x3bd2a5){_0x3bd2a5['userProfileId']=_0x798b04[_0xf252('0x53')]['id'];return _0x3bd2a5;});return db[_0xf252('0x60')][_0xf252('0x70')](_0x35c480,{'raw':!![],'transaction':_0xa9bba3});});}})[_0xf252('0x4a')](handleError(_0x38d5bf,null));});}})[_0xf252('0x2c')](function(_0x1d235b){var _0x1e57a9=_[_0xf252('0x34')](_0x1d235b,function(_0x4a2311){return _0x4a2311[_0xf252('0x54')]({'plain':!![]});});})[_0xf252('0x2c')](respondWithResult(_0x38d5bf,null))[_0xf252('0x4a')](handleError(_0x38d5bf,null));};exports[_0xf252('0x71')]=function(_0x1d3259,_0x294f08,_0x371c73){return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x1d3259[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](handleEntityNotFound(_0x294f08,null))['then'](function(_0x2a4a75){if(_0x2a4a75){return _0x2a4a75[_0xf252('0x71')](_0x1d3259[_0xf252('0x38')][_0xf252('0x65')]);}})[_0xf252('0x2c')](respondWithStatusCode(_0x294f08,null))[_0xf252('0x4a')](handleError(_0x294f08,null));};exports['getResources']=function(_0x43a0d3,_0x332f7d){var _0xda39ca={};if(!_0x43a0d3[_0xf252('0x38')][_0xf252('0x72')])throw new Error(_0xf252('0x73'));if(!_0x43a0d3[_0xf252('0x38')]['hasOwnProperty'](_0xf252('0x3e'))){_0xda39ca[_0xf252('0x25')]=qs[_0xf252('0x25')](_0x43a0d3[_0xf252('0x38')][_0xf252('0x25')]);_0xda39ca[_0xf252('0x23')]=qs[_0xf252('0x23')](_0x43a0d3[_0xf252('0x38')][_0xf252('0x23')]);}return db[_0xf252('0x35')][_0xf252('0x4f')]({'where':{'id':_0x43a0d3[_0xf252('0x53')]['id']}})[_0xf252('0x2c')](function(_0x5cabec){if(!_0x5cabec)throw new Error(_0xf252('0x74')+_0x43a0d3[_0xf252('0x53')]['id']);return db['UserProfile']['getResources'](_0x43a0d3);})[_0xf252('0x2c')](respondWithFilteredResult(_0x332f7d,_0xda39ca))[_0xf252('0x4a')](handleError(_0x332f7d,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 3360c69..4cd082f 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 _0x8506=['update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x4e500e,_0x362f46){var _0x18a3ea=function(_0x3746b8){while(--_0x3746b8){_0x4e500e['push'](_0x4e500e['shift']());}};_0x18a3ea(++_0x362f46);}(_0x8506,0xe8));var _0x6850=function(_0x2d186a,_0x16d77f){_0x2d186a=_0x2d186a-0x0;var _0x11f173=_0x8506[_0x2d186a];return _0x11f173;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x6850('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x6850('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6850('0x2'),'afterDestroy':'remove'};function emitEvent(_0x2e0f9d){return function(_0x204a8a,_0x321eff,_0x5e9ff2){UserProfileEvents[_0x6850('0x3')](_0x2e0f9d+':'+_0x204a8a['id'],_0x204a8a);UserProfileEvents[_0x6850('0x3')](_0x2e0f9d,_0x204a8a);_0x5e9ff2(null);};}for(var e in events){if(events[_0x6850('0x4')](e)){var event=events[e];UserProfile[_0x6850('0x5')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x1b9b=['exports','events','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3688d5,_0x51d2b7){var _0x3013c4=function(_0x5b3b4c){while(--_0x5b3b4c){_0x3688d5['push'](_0x3688d5['shift']());}};_0x3013c4(++_0x51d2b7);}(_0x1b9b,0x89));var _0xb1b9=function(_0x1bc4bc,_0x35ca01){_0x1bc4bc=_0x1bc4bc-0x0;var _0x1f976e=_0x1b9b[_0x1bc4bc];return _0x1f976e;};'use strict';var EventEmitter=require(_0xb1b9('0x0'));var UserProfile=require('../../mysqldb')['db'][_0xb1b9('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xb1b9('0x2')](0x0);var events={'afterCreate':_0xb1b9('0x3'),'afterUpdate':_0xb1b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x38f77a){return function(_0x411464,_0x597f8f,_0x5c24be){UserProfileEvents['emit'](_0x38f77a+':'+_0x411464['id'],_0x411464);UserProfileEvents[_0xb1b9('0x5')](_0x38f77a,_0x411464);_0x5c24be(null);};}for(var e in events){if(events[_0xb1b9('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xb1b9('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 755dc26..64ec339 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 _0xadcd=['length','push','UserProfileSection','find','params','all','ignore','union','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','pick','merge','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','forEach','default','custom','CustomReports','count','rows','ids','customSorting','extraQueryConditions','Tags','color','tag','ThroughTags','chat','dataValues','sms','fax','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareProjects','JscriptyProject','contacts','CmContact','parentSections','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','internalroutes','outboundroutes','VoiceExtension','contexts','voicemails','voicerecordings','Agents','membername','agent','User','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceChanSpy','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Telephones','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','Template','triggers','Trunk','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','InteractionId','_interactions','where','sequelize','toString','user_profiles','../../components/parsers/qs','query','raw','section','Invalid\x20section\x20\x27','isEmpty'];(function(_0x4c401b,_0x2c165f){var _0x12201b=function(_0x27ca7b){while(--_0x27ca7b){_0x4c401b['push'](_0x4c401b['shift']());}};_0x12201b(++_0x2c165f);}(_0xadcd,0xeb));var _0xdadc=function(_0x589527,_0x10ac3f){_0x589527=_0x589527-0x0;var _0x5537a1=_0xadcd[_0x589527];return _0x5537a1;};'use strict';var _=require('lodash');var attributes=require(_0xdadc('0x0'));var squel=require(_0xdadc('0x1'));module[_0xdadc('0x2')]=function(_0x43fb58){var _0x513985=_0x43fb58[_0xdadc('0x3')];function _0x4ff842(_0x2bdf2c,_0x36331f){return new Promise(function(_0x17d41b,_0x4f44d1){if(!_0x36331f)return _0x17d41b(null);var _0x36087f=_0x36331f['filter']?{[_0x36331f[_0xdadc('0x4')][_0xdadc('0x5')]]:_0x36331f['filter'][_0xdadc('0x6')]}:undefined;return _0x513985[_0x2bdf2c][_0xdadc('0x7')]({'where':_0x36087f,'raw':!![]})[_0xdadc('0x8')](function(_0x31a842){_0x36331f[_0xdadc('0x9')]=_[_0xdadc('0xa')](_0x31a842,'id');_0x17d41b(_0x36331f);})['catch'](function(_0x5e39b9){_0x4f44d1(_0x5e39b9);});});}function _0x57cc66(_0x20a9c1,_0x5a4911){return new Promise(function(_0x59a86b,_0x16dab3){var _0x398cba=_0x20a9c1[_0xdadc('0x4')]?{[_0x20a9c1['filter'][_0xdadc('0x5')]]:_0x20a9c1['filter'][_0xdadc('0x6')]}:undefined;return _0x513985[_0x20a9c1['model']]['findAll']({'where':_0x398cba,'raw':!![]})['then'](function(_0x540bcf){_0x5a4911[_0xdadc('0x9')]=_[_0xdadc('0xa')](_0x540bcf,function(_0x286acd){return _0x286acd[_0xdadc('0xb')];});_0x59a86b(_0x5a4911);})['catch'](function(_0x11cc6b){_0x16dab3(_0x11cc6b);});});}function _0x1c480f(_0xf183c9,_0x23d58d,_0x3811d0){if(!_0x23d58d)return Promise['resolve'](null);return new Promise(function(_0xebfac8,_0x593f30){return _0x513985[_0xdadc('0xc')]['findAll']({'where':{'sectionId':_0x23d58d['id']},'raw':!![]})[_0xdadc('0x8')](function(_0x4310bd){if(_0xf183c9[_0xdadc('0x5')]&&_0xf183c9[_0xdadc('0x5')]!=='id'){_0x23d58d[_0xdadc('0x9')]=_[_0xdadc('0xa')](_0x4310bd,function(_0x36bf0a){return _0x36bf0a[_0xf183c9[_0xdadc('0x5')]];});}else{if(_0x3811d0===_0xdadc('0xd')){_0x23d58d['associatedResources']=_[_0xdadc('0xa')](_0x4310bd,function(_0x4f364e){return{'id':_0x4f364e[_0xdadc('0xe')],'type':_0x4f364e[_0xdadc('0xf')]};});}else{_0x23d58d[_0xdadc('0x9')]=_['map'](_0x4310bd,function(_0x16e477){return _0x16e477['resourceId'];});}}_0xebfac8(_0x23d58d);})[_0xdadc('0x10')](function(_0xe645bc){_0x593f30(_0xe645bc);});});}function _0x12ba82(_0xf32be0,_0x22aac6){var _0x1c37aa={'parentSections':[]};switch(_0xf32be0['toLowerCase']()){case _0xdadc('0x11'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x13');break;case _0xdadc('0x14'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x15');break;case _0xdadc('0x16'):_0x1c37aa[_0xdadc('0x12')]='SquareRecording';_0x1c37aa['parentSections']=[{'name':_0xdadc('0x17'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x18');break;case _0xdadc('0x19'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x1a');_0x1c37aa[_0xdadc('0x1b')]=[{'name':_0xdadc('0x1c'),'field':'id','foreignKey':'ListId'}];break;case _0xdadc('0x1d'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x1e');break;case _0xdadc('0x1f'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x20');break;case _0xdadc('0x21'):_0x1c37aa['childModel']=_0xdadc('0x22');break;case _0xdadc('0x23'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x24');break;case'chatwebsites':_0x1c37aa['childModel']=_0xdadc('0x25');break;case'faxqueues':_0x1c37aa['childModel']=_0xdadc('0x26');break;case _0xdadc('0x27'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x28');break;case _0xdadc('0x29'):case _0xdadc('0x2a'):case _0xdadc('0x2b'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x2c');break;case _0xdadc('0x2d'):_0x1c37aa['childModel']='VoiceContext';break;case _0xdadc('0x2e'):_0x1c37aa[_0xdadc('0x12')]='VoiceMail';break;case _0xdadc('0x2f'):_0x1c37aa[_0xdadc('0x12')]='VoiceRecording';_0x1c37aa[_0xdadc('0x1b')]=[{'name':_0xdadc('0x30'),'field':'name','foreignKey':_0xdadc('0x31'),'model':'User','filter':{'field':'role','value':[_0xdadc('0x32')]}},{'name':'Telephones','field':'name','foreignKey':_0xdadc('0x31'),'model':_0xdadc('0x33'),'filter':{'field':_0xdadc('0x34'),'value':[_0xdadc('0x35')]}},{'name':_0xdadc('0x36'),'field':'name','foreignKey':_0xdadc('0x37'),'model':_0xdadc('0x38'),'filter':{'field':_0xdadc('0xf'),'value':[_0xdadc('0x39')]}},{'name':_0xdadc('0x3a'),'field':_0xdadc('0xb'),'foreignKey':_0xdadc('0x37'),'model':_0xdadc('0x38'),'filter':{'field':_0xdadc('0xf'),'value':['outbound']}}];break;case _0xdadc('0x3b'):_0x1c37aa[_0xdadc('0x12')]='VoiceMusicOnHold';break;case'chanspies':_0x1c37aa['childModel']=_0xdadc('0x3c');break;case'voiceprefixes':_0x1c37aa[_0xdadc('0x12')]='VoicePrefix';break;case'ivrcampaigns':_0x1c37aa['childModel']=_0xdadc('0x3d');break;case _0xdadc('0x3e'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x3f');break;case _0xdadc('0x40'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x41');break;case _0xdadc('0x42'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x43');break;case _0xdadc('0x44'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x45');break;case'openchannelaccounts':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x46');break;case _0xdadc('0x47'):_0x1c37aa['childModel']=_0xdadc('0x48');break;case _0xdadc('0x49'):_0x1c37aa[_0xdadc('0x12')]='SmsAccount';break;case _0xdadc('0x4a'):_0x1c37aa['childModel']=_0xdadc('0x4b');break;case _0xdadc('0x4c'):_0x1c37aa[_0xdadc('0x12')]='WhatsappAccount';break;case _0xdadc('0x4d'):_0x1c37aa['childModel']=_0xdadc('0x4e');break;case _0xdadc('0x4f'):case _0xdadc('0x50'):_0x1c37aa[_0xdadc('0x12')]='VoiceQueue';if(_0x22aac6){_0x1c37aa['parentSections']=[{'name':_0xdadc('0x36')},{'name':_0xdadc('0x3a')}];}break;case _0xdadc('0x51'):case _0xdadc('0x52'):case _0xdadc('0x53'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x33');if(_0x22aac6){_0x1c37aa[_0xdadc('0x1b')]=[{'name':_0xdadc('0x54'),'filter':{'field':'role','value':[_0xdadc('0x55'),_0xdadc('0x56')]},'ignore':!![]},{'name':_0xdadc('0x30')},{'name':_0xdadc('0x57')}];}break;case _0xdadc('0x58'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x59');break;case _0xdadc('0x5a'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x5b');break;case _0xdadc('0x5c'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x5d');break;case _0xdadc('0x5e'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x5f');break;case'deskaccounts':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x60');break;case _0xdadc('0x61'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x62');break;case _0xdadc('0x63'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x33');break;case _0xdadc('0x64'):_0x1c37aa['childModel']='CannedAnswer';break;case _0xdadc('0x65'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x66');break;case _0xdadc('0x67'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x68');break;case'intervals':_0x1c37aa['childModel']=_0xdadc('0x69');break;case _0xdadc('0x6a'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x6b');break;case _0xdadc('0x6c'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x6d');break;case _0xdadc('0x6e'):_0x1c37aa['childModel']=_0xdadc('0x6f');break;case _0xdadc('0x70'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x71');break;case'templates':_0x1c37aa['childModel']=_0xdadc('0x72');break;case _0xdadc('0x73'):_0x1c37aa[_0xdadc('0x12')]='Trigger';break;case'trunks':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x74');break;case'variables':_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x75');break;case _0xdadc('0x76'):_0x1c37aa[_0xdadc('0x12')]='Plugin';break;case _0xdadc('0x77'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0xd');_0x1c37aa['parentSections']=[{'name':_0xdadc('0x78'),'field':'id','foreignKey':_0xdadc('0x79')}];break;case _0xdadc('0x7a'):_0x1c37aa[_0xdadc('0x12')]=_0xdadc('0x7b');break;}return _0x1c37aa;}function _0x406352(_0x25ae09,_0x5417c3){var _0x4d123a=_0x25ae09[_0xdadc('0x7c')](0x0)[_0xdadc('0x7d')]()+_0x25ae09[_0xdadc('0x7e')](0x1);var _0x133e6e={'type':_0x513985[_0xdadc('0x7f')]['QueryTypes'][_0xdadc('0x80')],'raw':!![]};return new Promise(function(_0x4b6109,_0x5672f8){var _0x34d4a6=squel['select']()[_0xdadc('0x5')]('ui.'+_0x4d123a+_0xdadc('0x81'),'id')[_0xdadc('0x5')]('ui.createdAt')['from']('user_has_'+_0x25ae09+_0xdadc('0x82'),'ui')[_0xdadc('0x83')]('ui.UserId\x20=\x20?',_0x5417c3['id']);return _0x513985[_0xdadc('0x84')]['query'](_0x34d4a6[_0xdadc('0x85')](),_0x133e6e)[_0xdadc('0x8')](function(_0x3c2781){_0x5417c3[_0x4d123a+'OpenTabs']=_0x3c2781;_0x4b6109(_0x3c2781);})[_0xdadc('0x10')](function(_0x3d1d97){_0x5672f8(_0x3d1d97);});});}return _0x43fb58['define']('UserProfile',attributes,{'tableName':_0xdadc('0x86'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x287866){var _0x4a2c82=require(_0xdadc('0x87'));var _0x38bdee={'raw':_0x287866[_0xdadc('0x88')][_0xdadc('0x89')],'where':{}};var _0x17ef9c={};var _0xbb1c30={'count':0x0,'rows':[]};var _0x4593f9=_0x287866[_0xdadc('0x88')][_0xdadc('0x8a')];var _0x51269b=_0x287866['query']['mergeResources']||![];var _0x2def15=_0x12ba82(_0x4593f9,_0x51269b);if(!_0x2def15[_0xdadc('0x12')])throw new Error(_0xdadc('0x8b')+_0x4593f9+'\x27');var _0x85afae=[{'name':_0x4593f9}];if(!_[_0xdadc('0x8c')](_0x2def15['parentSections']))_0x85afae=_0x2def15['parentSections'];var _0x3387b8=[];for(var _0x55c7a3=0x0;_0x55c7a3<_0x85afae[_0xdadc('0x8d')];_0x55c7a3++){_0x3387b8[_0xdadc('0x8e')](_0x513985[_0xdadc('0x8f')][_0xdadc('0x90')]({'where':{'userProfileId':_0x287866[_0xdadc('0x91')]['id'],'name':_0x85afae[_0x55c7a3][_0xdadc('0xb')]},'raw':!![]}));}return Promise[_0xdadc('0x92')](_0x3387b8)[_0xdadc('0x8')](function(_0x4e0ab9){var _0x425e06=_[_0xdadc('0x4')](_0x4e0ab9,function(_0x38852d){return _0x38852d?_0x38852d:undefined;});var _0xba7567=_[_0xdadc('0x4')](_0x85afae,[_0xdadc('0x93'),!![]]);var _0x1e7c08=_[_0xdadc('0x8c')](_0x425e06)&&_[_0xdadc('0x8c')](_0xba7567)?null:_[_0xdadc('0x94')](_0xba7567,_0x425e06);if(!_0x1e7c08)return null;var _0x40d7dd=[];for(var _0xceac87=0x0;_0xceac87<_0x1e7c08[_0xdadc('0x8d')];_0xceac87++){var _0x558aa2=_[_0xdadc('0x90')](_0x85afae,function(_0x69e206){return _0x1e7c08[_0xceac87]?_0x69e206['name']===_0x1e7c08[_0xceac87][_0xdadc('0xb')]:null;});if(_0x558aa2){if(_0x1e7c08[_0xceac87][_0xdadc('0x93')]){_0x40d7dd[_0xdadc('0x8e')](_0x4ff842(_0x2def15[_0xdadc('0x12')],_0x1e7c08[_0xceac87]));}else{if(!_0x1e7c08[_0xceac87]['autoAssociation']){_0x40d7dd[_0xdadc('0x8e')](_0x1c480f(_0x558aa2,_0x1e7c08[_0xceac87],_0x2def15[_0xdadc('0x12')]));}else{if(_0x558aa2[_0xdadc('0x95')]){_0x40d7dd[_0xdadc('0x8e')](_0x57cc66(_0x558aa2,_0x1e7c08[_0xceac87]));}}}}}return Promise[_0xdadc('0x92')](_0x40d7dd);})[_0xdadc('0x8')](function(_0x4073c7){var _0x46e7f8=_0x4073c7;var _0x57e2f7=null;if(_0x46e7f8){_0x57e2f7=_0x46e7f8['length']===0x1?_0x46e7f8[0x0]:null;}if(!_0x57e2f7&&!_0x46e7f8)return _0xbb1c30;var _0x36b2a9=_0x513985[_0x2def15[_0xdadc('0x12')]][_0xdadc('0x96')];_0x17ef9c[_0xdadc('0x95')]=_[_0xdadc('0x97')](_0x36b2a9);_0x17ef9c[_0xdadc('0x88')]=_[_0xdadc('0x97')](_0x287866[_0xdadc('0x88')]);_0x17ef9c[_0xdadc('0x98')]=_[_0xdadc('0x99')](_0x17ef9c[_0xdadc('0x95')],_0x17ef9c[_0xdadc('0x88')]);_0x38bdee[_0xdadc('0x9a')]=_['intersection'](_0x17ef9c[_0xdadc('0x95')],_0x4a2c82[_0xdadc('0x9b')](_0x287866[_0xdadc('0x88')][_0xdadc('0x9b')]));_0x38bdee[_0xdadc('0x9a')]=_0x38bdee[_0xdadc('0x9a')][_0xdadc('0x8d')]?_0x38bdee[_0xdadc('0x9a')]:_0x17ef9c[_0xdadc('0x95')];if(!_0x287866[_0xdadc('0x88')][_0xdadc('0x9c')](_0xdadc('0x9d'))){_0x38bdee[_0xdadc('0x9e')]=_0x4a2c82[_0xdadc('0x9e')](_0x287866[_0xdadc('0x88')][_0xdadc('0x9e')]);_0x38bdee[_0xdadc('0x9f')]=_0x4a2c82['offset'](_0x287866[_0xdadc('0x88')]['offset']);}_0x38bdee['order']=_0x4a2c82['sort'](_0x287866['query'][_0xdadc('0xa0')]);_0x38bdee['where']=_0x4a2c82[_0xdadc('0x98')](_[_0xdadc('0xa1')](_0x287866['query'],_0x17ef9c[_0xdadc('0x98')]));if(_0x287866['query'][_0xdadc('0x4')]){_0x38bdee['where']=_[_0xdadc('0xa2')](_0x38bdee[_0xdadc('0x83')],{'$or':_[_0xdadc('0xa')](_0x36b2a9,function(_0x383679){if(_0x383679['type']['key']!==_0xdadc('0xa3')){var _0x1fc89f={};_0x1fc89f[_0x383679['field']]={'$like':'%'+_0x287866[_0xdadc('0x88')][_0xdadc('0x4')]+'%'};return _0x1fc89f;}})});}var _0x53dbba=[];var _0x239b6d=null;var _0x4378bc={};if(_0x57e2f7){_0x239b6d=_['find'](_0x85afae,[_0xdadc('0xb'),_0x57e2f7['name']]);if(_0x239b6d[_0xdadc('0x5')]){_0x4378bc={};if(_0x2def15[_0xdadc('0x12')]===_0xdadc('0xd')){_0x4378bc[_0x239b6d[_0xdadc('0xa4')]]=_[_0xdadc('0xa')](_0x57e2f7[_0xdadc('0x9')],'id');}else{_0x4378bc[_0x239b6d[_0xdadc('0xa4')]]=_0x57e2f7[_0xdadc('0x9')];}_0x53dbba['push'](_0x4378bc);}else{_0x38bdee[_0xdadc('0x83')]['id']=_0x57e2f7[_0xdadc('0x9')];}}else{for(var _0xe22525=0x0;_0xe22525<_0x46e7f8[_0xdadc('0x8d')];_0xe22525++){_0x239b6d=_[_0xdadc('0x90')](_0x85afae,['name',_0x46e7f8[_0xe22525]['name']]);if(_0x239b6d[_0xdadc('0x5')]){_0x4378bc={};_0x4378bc[_0x239b6d['foreignKey']]=_0x46e7f8[_0xe22525]['associatedResources'];_0x53dbba[_0xdadc('0x8e')](_0x4378bc);}else{if(!_0x38bdee[_0xdadc('0x83')]['id'])_0x38bdee[_0xdadc('0x83')]['id']=[];_0x46e7f8[_0xe22525][_0xdadc('0x9')]['forEach'](function(_0x5c4a0c){_0x38bdee['where']['id'][_0xdadc('0x8e')](_0x5c4a0c);});}}}if(!_[_0xdadc('0x8c')](_0x53dbba)){_0x38bdee['where']=_[_0xdadc('0xa2')](_0x38bdee[_0xdadc('0x83')],{'$and':{'$or':_0x53dbba}});}_0x38bdee=_[_0xdadc('0xa2')]({},_0x38bdee,_0x287866[_0xdadc('0xa5')]);if(_0x57e2f7&&!_0x57e2f7[_0xdadc('0xa6')]&&_0x2def15['childModel']===_0xdadc('0xd')){if(_0x287866['query'][_0xdadc('0xa7')]){_0x38bdee[_0xdadc('0xa8')]=[{'all':!![]}];}return _0x513985[_0x2def15['childModel']]['findAll'](_0x38bdee)[_0xdadc('0x8')](function(_0x4b5766){var _0xcb2191=[];_0x4b5766[_0xdadc('0xa9')](function(_0x884473){var _0x2e1e9e;switch(_0x884473['reportType']){case _0xdadc('0xaa'):_0x2e1e9e=_['find'](_0x57e2f7[_0xdadc('0x9')],function(_0x4056a8){return _0x4056a8['id']===_0x884473[_0xdadc('0x79')]&&_0x4056a8[_0xdadc('0xf')]==='DefaultReports';});break;case _0xdadc('0xab'):_0x2e1e9e=_[_0xdadc('0x90')](_0x57e2f7['associatedResources'],function(_0x38624f){return _0x38624f['id']===_0x884473[_0xdadc('0x79')]&&_0x38624f[_0xdadc('0xf')]===_0xdadc('0xac');});break;}if(_0x2e1e9e)_0xcb2191[_0xdadc('0x8e')](_0x884473);});_0xbb1c30[_0xdadc('0xad')]=_0xcb2191[_0xdadc('0x8d')];_0xbb1c30[_0xdadc('0xae')]=_0xcb2191;return _0xbb1c30;});}else{if(!_[_0xdadc('0x8c')](_0x287866['query'][_0xdadc('0xaf')])){_0x38bdee[_0xdadc('0x83')]['id']=_0x38bdee['where']['id']?_['intersection'](_0x38bdee[_0xdadc('0x83')]['id'],_0x287866[_0xdadc('0x88')][_0xdadc('0xaf')]):_0x287866[_0xdadc('0x88')]['ids'];if(_0x287866[_0xdadc('0x88')][_0xdadc('0xb0')]){_0x38bdee['order']=_0x287866[_0xdadc('0x88')]['customSorting'];}}if(_0x287866[_0xdadc('0x88')][_0xdadc('0xb1')]){_0x38bdee['where']=_[_0xdadc('0xa2')](_0x38bdee[_0xdadc('0x83')],{'$and':_0x287866['query']['extraQueryConditions']});}return _0x513985[_0x2def15[_0xdadc('0x12')]]['count']({'where':_0x38bdee[_0xdadc('0x83')]})[_0xdadc('0x8')](function(_0x2c1098){_0xbb1c30['count']=_0x2c1098;if(_0x287866['query'][_0xdadc('0xa7')]){if(_0x2def15[_0xdadc('0x12')]===_0xdadc('0x1a')){_0x38bdee[_0xdadc('0xa8')]=[{'model':_0x513985['Tag'],'as':_0xdadc('0xb2'),'attributes':['id',_0xdadc('0xb'),_0xdadc('0xb3')],'required':_0x287866[_0xdadc('0x88')][_0xdadc('0xb4')]?!![]:![]},{'model':_0x513985[_0xdadc('0x71')],'as':_0xdadc('0xb5'),'attributes':['id',_0xdadc('0xb'),'color'],'through':_0x287866[_0xdadc('0x88')]['tag']?{'attributes':[],'where':{'TagId':_0x287866[_0xdadc('0x88')]['tag']||undefined}}:{},'required':_0x287866[_0xdadc('0x88')][_0xdadc('0xb4')]?!![]:![]}];}else{_0x38bdee['include']=[{'all':!![]}];}}return _0x513985[_0x2def15[_0xdadc('0x12')]][_0xdadc('0x7')](_0x38bdee);})[_0xdadc('0x8')](function(_0x4e170f){_0xbb1c30['rows']=_0x4e170f;if(_0x4593f9===_0xdadc('0x30')&&_0x287866[_0xdadc('0x88')]['openTabs']==='true'){var _0x345ea7=[];for(var _0x2aee43=0x0;_0x2aee43<_0xbb1c30[_0xdadc('0xae')]['length'];_0x2aee43++){_0x345ea7[_0xdadc('0x8e')](_0x406352(_0xdadc('0xb6'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7[_0xdadc('0x8e')](_0x406352(_0xdadc('0xb8'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7['push'](_0x406352(_0xdadc('0xb9'),_0xbb1c30['rows'][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7[_0xdadc('0x8e')](_0x406352(_0xdadc('0xba'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7['push'](_0x406352(_0xdadc('0xbb'),_0xbb1c30[_0xdadc('0xae')][_0x2aee43][_0xdadc('0xb7')]));_0x345ea7[_0xdadc('0x8e')](_0x406352('whatsapp',_0xbb1c30['rows'][_0x2aee43][_0xdadc('0xb7')]));}return Promise[_0xdadc('0x92')](_0x345ea7)[_0xdadc('0x8')](function(){return _0xbb1c30;});}return _0xbb1c30;});}});}}});}; \ No newline at end of file +var _0xfd3a=['intersection','fields','attributes','nolimit','limit','offset','sort','pick','where','merge','key','VIRTUAL','foreignKey','forEach','include','DefaultReports','CustomReports','count','rows','ids','customSorting','order','extraQueryConditions','includeAll','color','tag','openTabs','true','dataValues','sms','fax','openchannel','whatsapp','lodash','exports','models','filter','field','map','model','findAll','then','associatedResources','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','type','catch','toLowerCase','SquareProject','odbc','childModel','SquareOdbc','SquareRecording','parentSections','SquareProjects','name','projectName','projects','JscriptyProject','contacts','Lists','ListId','CmList','CmCompany','CmCustomField','chatqueues','chatwebsites','ChatWebsite','faxqueues','FaxQueue','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','membername','User','role','agent','Telephones','telephone','VoiceQueues','inbound','outbound','musiconholds','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','WhatsappQueue','WhatsappAccount','teams','Team','queuecampaigns','VoiceQueue','QueueCampaigns','users','agents','telephones','Users','admin','user','ZendeskAccount','salesforceaccounts','SalesforceAccount','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','Dashboard','Interval','pauses','Pause','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','variables','Variable','plugins','Plugin','extractedreports','reportId','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','from','_interactions','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','raw','section','mergeResources','isEmpty','length','push','UserProfileSection','params','all','union','find','ignore','autoAssociation','rawAttributes','keys','filters'];(function(_0x22a58e,_0x55b7c2){var _0x3d522d=function(_0x3b9006){while(--_0x3b9006){_0x22a58e['push'](_0x22a58e['shift']());}};_0x3d522d(++_0x55b7c2);}(_0xfd3a,0xd7));var _0xafd3=function(_0x59dec,_0x4b079e){_0x59dec=_0x59dec-0x0;var _0x5e668f=_0xfd3a[_0x59dec];return _0x5e668f;};'use strict';var _=require(_0xafd3('0x0'));var attributes=require('./userProfile.attributes');var squel=require('squel');module[_0xafd3('0x1')]=function(_0xa5a0ff){var _0x35c2e6=_0xa5a0ff[_0xafd3('0x2')];function _0x379f9a(_0x355934,_0xdb35e5){return new Promise(function(_0x5ddba6,_0x2e068a){if(!_0xdb35e5)return _0x5ddba6(null);var _0xdd0ae5=_0xdb35e5[_0xafd3('0x3')]?{[_0xdb35e5[_0xafd3('0x3')][_0xafd3('0x4')]]:_0xdb35e5[_0xafd3('0x3')]['value']}:undefined;return _0x35c2e6[_0x355934]['findAll']({'where':_0xdd0ae5,'raw':!![]})['then'](function(_0x5702cc){_0xdb35e5['associatedResources']=_[_0xafd3('0x5')](_0x5702cc,'id');_0x5ddba6(_0xdb35e5);})['catch'](function(_0x4874db){_0x2e068a(_0x4874db);});});}function _0x315d54(_0x7b99d0,_0x57edac){return new Promise(function(_0x80c832,_0x3fa2ee){var _0xa27877=_0x7b99d0[_0xafd3('0x3')]?{[_0x7b99d0[_0xafd3('0x3')][_0xafd3('0x4')]]:_0x7b99d0['filter']['value']}:undefined;return _0x35c2e6[_0x7b99d0[_0xafd3('0x6')]][_0xafd3('0x7')]({'where':_0xa27877,'raw':!![]})[_0xafd3('0x8')](function(_0x3cf7c4){_0x57edac[_0xafd3('0x9')]=_[_0xafd3('0x5')](_0x3cf7c4,function(_0x1b1b06){return _0x1b1b06['name'];});_0x80c832(_0x57edac);})['catch'](function(_0x25780e){_0x3fa2ee(_0x25780e);});});}function _0x254dad(_0x7d3828,_0x265359,_0x48c3b8){if(!_0x265359)return Promise[_0xafd3('0xa')](null);return new Promise(function(_0x247e8b,_0x1c974a){return _0x35c2e6[_0xafd3('0xb')]['findAll']({'where':{'sectionId':_0x265359['id']},'raw':!![]})['then'](function(_0x4e1194){if(_0x7d3828[_0xafd3('0x4')]&&_0x7d3828[_0xafd3('0x4')]!=='id'){_0x265359[_0xafd3('0x9')]=_[_0xafd3('0x5')](_0x4e1194,function(_0x4514fc){return _0x4514fc[_0x7d3828[_0xafd3('0x4')]];});}else{if(_0x48c3b8===_0xafd3('0xc')){_0x265359[_0xafd3('0x9')]=_[_0xafd3('0x5')](_0x4e1194,function(_0x44d7e1){return{'id':_0x44d7e1[_0xafd3('0xd')],'type':_0x44d7e1[_0xafd3('0xe')]};});}else{_0x265359['associatedResources']=_[_0xafd3('0x5')](_0x4e1194,function(_0x25bbfa){return _0x25bbfa[_0xafd3('0xd')];});}}_0x247e8b(_0x265359);})[_0xafd3('0xf')](function(_0x197397){_0x1c974a(_0x197397);});});}function _0x47e5e1(_0x2c2674,_0x34de1b){var _0x4b21ac={'parentSections':[]};switch(_0x2c2674[_0xafd3('0x10')]()){case'squareprojects':_0x4b21ac['childModel']=_0xafd3('0x11');break;case _0xafd3('0x12'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x14');break;case'squarerecordings':_0x4b21ac['childModel']=_0xafd3('0x15');_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x17'),'field':_0xafd3('0x18'),'foreignKey':_0xafd3('0x19')}];break;case _0xafd3('0x1a'):_0x4b21ac['childModel']=_0xafd3('0x1b');break;case _0xafd3('0x1c'):_0x4b21ac['childModel']='CmContact';_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x1d'),'field':'id','foreignKey':_0xafd3('0x1e')}];break;case'lists':_0x4b21ac['childModel']=_0xafd3('0x1f');break;case'companies':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x20');break;case'globalcustomfields':_0x4b21ac['childModel']=_0xafd3('0x21');break;case _0xafd3('0x22'):_0x4b21ac[_0xafd3('0x13')]='ChatQueue';break;case _0xafd3('0x23'):_0x4b21ac['childModel']=_0xafd3('0x24');break;case _0xafd3('0x25'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x26');break;case'faxaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x27');break;case'inboundroutes':case _0xafd3('0x28'):case'outboundroutes':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x29');break;case _0xafd3('0x2a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x2b');break;case _0xafd3('0x2c'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x2d');break;case'voicerecordings':_0x4b21ac[_0xafd3('0x13')]='VoiceRecording';_0x4b21ac['parentSections']=[{'name':'Agents','field':_0xafd3('0x18'),'foreignKey':_0xafd3('0x2e'),'model':_0xafd3('0x2f'),'filter':{'field':_0xafd3('0x30'),'value':[_0xafd3('0x31')]}},{'name':_0xafd3('0x32'),'field':'name','foreignKey':'membername','model':_0xafd3('0x2f'),'filter':{'field':_0xafd3('0x30'),'value':[_0xafd3('0x33')]}},{'name':_0xafd3('0x34'),'field':_0xafd3('0x18'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':'type','value':[_0xafd3('0x35')]}},{'name':'QueueCampaigns','field':_0xafd3('0x18'),'foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0xafd3('0xe'),'value':[_0xafd3('0x36')]}}];break;case _0xafd3('0x37'):_0x4b21ac[_0xafd3('0x13')]='VoiceMusicOnHold';break;case _0xafd3('0x38'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x39');break;case _0xafd3('0x3a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x3b');break;case _0xafd3('0x3c'):_0x4b21ac['childModel']='Campaign';break;case'mailqueues':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x3d');break;case _0xafd3('0x3e'):_0x4b21ac['childModel']=_0xafd3('0x3f');break;case _0xafd3('0x40'):_0x4b21ac['childModel']=_0xafd3('0x41');break;case'openchannelqueues':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x42');break;case'openchannelaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x43');break;case _0xafd3('0x44'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x45');break;case _0xafd3('0x46'):_0x4b21ac[_0xafd3('0x13')]='SmsAccount';break;case'whatsappqueues':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x47');break;case'whatsappaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x48');break;case _0xafd3('0x49'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x4a');break;case'voicequeues':case _0xafd3('0x4b'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x4c');if(_0x34de1b){_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x34')},{'name':_0xafd3('0x4d')}];}break;case _0xafd3('0x4e'):case _0xafd3('0x4f'):case _0xafd3('0x50'):_0x4b21ac[_0xafd3('0x13')]='User';if(_0x34de1b){_0x4b21ac[_0xafd3('0x16')]=[{'name':_0xafd3('0x51'),'filter':{'field':'role','value':[_0xafd3('0x52'),_0xafd3('0x53')]},'ignore':!![]},{'name':'Agents'},{'name':'Telephones'}];}break;case'zendeskaccounts':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x54');break;case _0xafd3('0x55'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x56');break;case'freshdeskaccounts':_0x4b21ac['childModel']=_0xafd3('0x57');break;case _0xafd3('0x58'):_0x4b21ac['childModel']=_0xafd3('0x59');break;case _0xafd3('0x5a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x5b');break;case'zohoaccounts':_0x4b21ac['childModel']='ZohoAccount';break;case _0xafd3('0x5c'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x2f');break;case _0xafd3('0x5d'):_0x4b21ac['childModel']=_0xafd3('0x5e');break;case'dispositions':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x5f');break;case'customdashboards':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x60');break;case'intervals':_0x4b21ac['childModel']=_0xafd3('0x61');break;case _0xafd3('0x62'):_0x4b21ac['childModel']=_0xafd3('0x63');break;case'scheduler':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x64');break;case _0xafd3('0x65'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x66');break;case _0xafd3('0x67'):_0x4b21ac['childModel']=_0xafd3('0x68');break;case _0xafd3('0x69'):_0x4b21ac['childModel']='Template';break;case _0xafd3('0x6a'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x6b');break;case _0xafd3('0x6c'):_0x4b21ac['childModel']=_0xafd3('0x6d');break;case _0xafd3('0x6e'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x6f');break;case _0xafd3('0x70'):_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x71');break;case _0xafd3('0x72'):_0x4b21ac[_0xafd3('0x13')]='AnalyticExtractedReport';_0x4b21ac[_0xafd3('0x16')]=[{'name':'Reports','field':'id','foreignKey':_0xafd3('0x73')}];break;case'metrics':_0x4b21ac[_0xafd3('0x13')]=_0xafd3('0x74');break;}return _0x4b21ac;}function _0x1a93f5(_0x31a28d,_0x1fa558){var _0x234cf5=_0x31a28d[_0xafd3('0x75')](0x0)[_0xafd3('0x76')]()+_0x31a28d['slice'](0x1);var _0x2a787c={'type':_0x35c2e6[_0xafd3('0x77')][_0xafd3('0x78')][_0xafd3('0x79')],'raw':!![]};return new Promise(function(_0x43fe30,_0x3a9a56){var _0x5ba083=squel[_0xafd3('0x7a')]()[_0xafd3('0x4')]('ui.'+_0x234cf5+'InteractionId','id')[_0xafd3('0x4')]('ui.createdAt')[_0xafd3('0x7b')]('user_has_'+_0x31a28d+_0xafd3('0x7c'),'ui')['where']('ui.UserId\x20=\x20?',_0x1fa558['id']);return _0x35c2e6[_0xafd3('0x7d')]['query'](_0x5ba083[_0xafd3('0x7e')](),_0x2a787c)[_0xafd3('0x8')](function(_0x38ce00){_0x1fa558[_0x234cf5+_0xafd3('0x7f')]=_0x38ce00;_0x43fe30(_0x38ce00);})['catch'](function(_0x43ebd3){_0x3a9a56(_0x43ebd3);});});}return _0xa5a0ff[_0xafd3('0x80')](_0xafd3('0x81'),attributes,{'tableName':_0xafd3('0x82'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x197a9b){var _0x57cbc7=require(_0xafd3('0x83'));var _0x11b270={'raw':_0x197a9b[_0xafd3('0x84')][_0xafd3('0x85')],'where':{}};var _0x224c2c={};var _0x7aa7ce={'count':0x0,'rows':[]};var _0x444447=_0x197a9b[_0xafd3('0x84')][_0xafd3('0x86')];var _0x4f1e6f=_0x197a9b[_0xafd3('0x84')][_0xafd3('0x87')]||![];var _0x44392d=_0x47e5e1(_0x444447,_0x4f1e6f);if(!_0x44392d[_0xafd3('0x13')])throw new Error('Invalid\x20section\x20\x27'+_0x444447+'\x27');var _0x18465d=[{'name':_0x444447}];if(!_[_0xafd3('0x88')](_0x44392d['parentSections']))_0x18465d=_0x44392d[_0xafd3('0x16')];var _0x101767=[];for(var _0x5c3acc=0x0;_0x5c3acc<_0x18465d[_0xafd3('0x89')];_0x5c3acc++){_0x101767[_0xafd3('0x8a')](_0x35c2e6[_0xafd3('0x8b')]['find']({'where':{'userProfileId':_0x197a9b[_0xafd3('0x8c')]['id'],'name':_0x18465d[_0x5c3acc][_0xafd3('0x18')]},'raw':!![]}));}return Promise[_0xafd3('0x8d')](_0x101767)[_0xafd3('0x8')](function(_0x56b2c3){var _0x3b8652=_['filter'](_0x56b2c3,function(_0x5738fd){return _0x5738fd?_0x5738fd:undefined;});var _0x11d790=_[_0xafd3('0x3')](_0x18465d,['ignore',!![]]);var _0x336938=_[_0xafd3('0x88')](_0x3b8652)&&_['isEmpty'](_0x11d790)?null:_[_0xafd3('0x8e')](_0x11d790,_0x3b8652);if(!_0x336938)return null;var _0x4a10d0=[];for(var _0x3be5a0=0x0;_0x3be5a0<_0x336938['length'];_0x3be5a0++){var _0x473bc0=_[_0xafd3('0x8f')](_0x18465d,function(_0x20331b){return _0x336938[_0x3be5a0]?_0x20331b[_0xafd3('0x18')]===_0x336938[_0x3be5a0][_0xafd3('0x18')]:null;});if(_0x473bc0){if(_0x336938[_0x3be5a0][_0xafd3('0x90')]){_0x4a10d0[_0xafd3('0x8a')](_0x379f9a(_0x44392d[_0xafd3('0x13')],_0x336938[_0x3be5a0]));}else{if(!_0x336938[_0x3be5a0][_0xafd3('0x91')]){_0x4a10d0[_0xafd3('0x8a')](_0x254dad(_0x473bc0,_0x336938[_0x3be5a0],_0x44392d[_0xafd3('0x13')]));}else{if(_0x473bc0['model']){_0x4a10d0[_0xafd3('0x8a')](_0x315d54(_0x473bc0,_0x336938[_0x3be5a0]));}}}}}return Promise[_0xafd3('0x8d')](_0x4a10d0);})[_0xafd3('0x8')](function(_0x1a6919){var _0x24334f=_0x1a6919;var _0x2875d1=null;if(_0x24334f){_0x2875d1=_0x24334f[_0xafd3('0x89')]===0x1?_0x24334f[0x0]:null;}if(!_0x2875d1&&!_0x24334f)return _0x7aa7ce;var _0x4a4d8f=_0x35c2e6[_0x44392d[_0xafd3('0x13')]][_0xafd3('0x92')];_0x224c2c[_0xafd3('0x6')]=_[_0xafd3('0x93')](_0x4a4d8f);_0x224c2c[_0xafd3('0x84')]=_[_0xafd3('0x93')](_0x197a9b[_0xafd3('0x84')]);_0x224c2c[_0xafd3('0x94')]=_[_0xafd3('0x95')](_0x224c2c[_0xafd3('0x6')],_0x224c2c[_0xafd3('0x84')]);_0x11b270['attributes']=_[_0xafd3('0x95')](_0x224c2c[_0xafd3('0x6')],_0x57cbc7['fields'](_0x197a9b['query'][_0xafd3('0x96')]));_0x11b270['attributes']=_0x11b270['attributes']['length']?_0x11b270[_0xafd3('0x97')]:_0x224c2c[_0xafd3('0x6')];if(!_0x197a9b['query']['hasOwnProperty'](_0xafd3('0x98'))){_0x11b270[_0xafd3('0x99')]=_0x57cbc7[_0xafd3('0x99')](_0x197a9b[_0xafd3('0x84')][_0xafd3('0x99')]);_0x11b270[_0xafd3('0x9a')]=_0x57cbc7[_0xafd3('0x9a')](_0x197a9b[_0xafd3('0x84')]['offset']);}_0x11b270['order']=_0x57cbc7['sort'](_0x197a9b[_0xafd3('0x84')][_0xafd3('0x9b')]);_0x11b270['where']=_0x57cbc7['filters'](_[_0xafd3('0x9c')](_0x197a9b[_0xafd3('0x84')],_0x224c2c[_0xafd3('0x94')]));if(_0x197a9b[_0xafd3('0x84')]['filter']){_0x11b270[_0xafd3('0x9d')]=_[_0xafd3('0x9e')](_0x11b270[_0xafd3('0x9d')],{'$or':_[_0xafd3('0x5')](_0x4a4d8f,function(_0x518a1b){if(_0x518a1b['type'][_0xafd3('0x9f')]!==_0xafd3('0xa0')){var _0x4b672c={};_0x4b672c[_0x518a1b[_0xafd3('0x4')]]={'$like':'%'+_0x197a9b[_0xafd3('0x84')][_0xafd3('0x3')]+'%'};return _0x4b672c;}})});}var _0x4d7c21=[];var _0x3f9302=null;var _0x41c119={};if(_0x2875d1){_0x3f9302=_[_0xafd3('0x8f')](_0x18465d,[_0xafd3('0x18'),_0x2875d1[_0xafd3('0x18')]]);if(_0x3f9302[_0xafd3('0x4')]){_0x41c119={};if(_0x44392d[_0xafd3('0x13')]===_0xafd3('0xc')){_0x41c119[_0x3f9302[_0xafd3('0xa1')]]=_['map'](_0x2875d1['associatedResources'],'id');}else{_0x41c119[_0x3f9302['foreignKey']]=_0x2875d1['associatedResources'];}_0x4d7c21['push'](_0x41c119);}else{_0x11b270[_0xafd3('0x9d')]['id']=_0x2875d1[_0xafd3('0x9')];}}else{for(var _0x2fc430=0x0;_0x2fc430<_0x24334f[_0xafd3('0x89')];_0x2fc430++){_0x3f9302=_[_0xafd3('0x8f')](_0x18465d,['name',_0x24334f[_0x2fc430]['name']]);if(_0x3f9302[_0xafd3('0x4')]){_0x41c119={};_0x41c119[_0x3f9302[_0xafd3('0xa1')]]=_0x24334f[_0x2fc430][_0xafd3('0x9')];_0x4d7c21[_0xafd3('0x8a')](_0x41c119);}else{if(!_0x11b270['where']['id'])_0x11b270[_0xafd3('0x9d')]['id']=[];_0x24334f[_0x2fc430][_0xafd3('0x9')][_0xafd3('0xa2')](function(_0xc45166){_0x11b270[_0xafd3('0x9d')]['id'][_0xafd3('0x8a')](_0xc45166);});}}}if(!_[_0xafd3('0x88')](_0x4d7c21)){_0x11b270[_0xafd3('0x9d')]=_['merge'](_0x11b270[_0xafd3('0x9d')],{'$and':{'$or':_0x4d7c21}});}_0x11b270=_['merge']({},_0x11b270,_0x197a9b['options']);if(_0x2875d1&&!_0x2875d1[_0xafd3('0x91')]&&_0x44392d['childModel']===_0xafd3('0xc')){if(_0x197a9b[_0xafd3('0x84')]['includeAll']){_0x11b270[_0xafd3('0xa3')]=[{'all':!![]}];}return _0x35c2e6[_0x44392d[_0xafd3('0x13')]]['findAll'](_0x11b270)[_0xafd3('0x8')](function(_0x46868e){var _0x3e03e0=[];_0x46868e[_0xafd3('0xa2')](function(_0x122237){var _0x478d7d;switch(_0x122237['reportType']){case'default':_0x478d7d=_['find'](_0x2875d1['associatedResources'],function(_0x14958b){return _0x14958b['id']===_0x122237[_0xafd3('0x73')]&&_0x14958b['type']===_0xafd3('0xa4');});break;case'custom':_0x478d7d=_[_0xafd3('0x8f')](_0x2875d1[_0xafd3('0x9')],function(_0x23c80c){return _0x23c80c['id']===_0x122237['reportId']&&_0x23c80c['type']===_0xafd3('0xa5');});break;}if(_0x478d7d)_0x3e03e0['push'](_0x122237);});_0x7aa7ce[_0xafd3('0xa6')]=_0x3e03e0[_0xafd3('0x89')];_0x7aa7ce[_0xafd3('0xa7')]=_0x3e03e0;return _0x7aa7ce;});}else{if(!_[_0xafd3('0x88')](_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa8')])){_0x11b270['where']['id']=_0x11b270[_0xafd3('0x9d')]['id']?_['intersection'](_0x11b270[_0xafd3('0x9d')]['id'],_0x197a9b['query'][_0xafd3('0xa8')]):_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa8')];if(_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa9')]){_0x11b270[_0xafd3('0xaa')]=_0x197a9b[_0xafd3('0x84')][_0xafd3('0xa9')];}}if(_0x197a9b[_0xafd3('0x84')]['extraQueryConditions']){_0x11b270[_0xafd3('0x9d')]=_['merge'](_0x11b270[_0xafd3('0x9d')],{'$and':_0x197a9b[_0xafd3('0x84')][_0xafd3('0xab')]});}return _0x35c2e6[_0x44392d['childModel']][_0xafd3('0xa6')]({'where':_0x11b270[_0xafd3('0x9d')]})['then'](function(_0x435879){_0x7aa7ce[_0xafd3('0xa6')]=_0x435879;if(_0x197a9b['query'][_0xafd3('0xac')]){if(_0x44392d['childModel']==='CmContact'){_0x11b270[_0xafd3('0xa3')]=[{'model':_0x35c2e6[_0xafd3('0x68')],'as':'Tags','attributes':['id',_0xafd3('0x18'),_0xafd3('0xad')],'required':_0x197a9b[_0xafd3('0x84')]['tag']?!![]:![]},{'model':_0x35c2e6[_0xafd3('0x68')],'as':'ThroughTags','attributes':['id',_0xafd3('0x18'),_0xafd3('0xad')],'through':_0x197a9b['query'][_0xafd3('0xae')]?{'attributes':[],'where':{'TagId':_0x197a9b[_0xafd3('0x84')][_0xafd3('0xae')]||undefined}}:{},'required':_0x197a9b[_0xafd3('0x84')][_0xafd3('0xae')]?!![]:![]}];}else{_0x11b270[_0xafd3('0xa3')]=[{'all':!![]}];}}return _0x35c2e6[_0x44392d[_0xafd3('0x13')]]['findAll'](_0x11b270);})[_0xafd3('0x8')](function(_0x441b48){_0x7aa7ce[_0xafd3('0xa7')]=_0x441b48;if(_0x444447==='Agents'&&_0x197a9b[_0xafd3('0x84')][_0xafd3('0xaf')]===_0xafd3('0xb0')){var _0x38432d=[];for(var _0x37b401=0x0;_0x37b401<_0x7aa7ce[_0xafd3('0xa7')][_0xafd3('0x89')];_0x37b401++){_0x38432d[_0xafd3('0x8a')](_0x1a93f5('chat',_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d[_0xafd3('0x8a')](_0x1a93f5(_0xafd3('0xb2'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d['push'](_0x1a93f5(_0xafd3('0xb3'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401]['dataValues']));_0x38432d[_0xafd3('0x8a')](_0x1a93f5('mail',_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d[_0xafd3('0x8a')](_0x1a93f5(_0xafd3('0xb4'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));_0x38432d[_0xafd3('0x8a')](_0x1a93f5(_0xafd3('0xb5'),_0x7aa7ce[_0xafd3('0xa7')][_0x37b401][_0xafd3('0xb1')]));}return Promise['all'](_0x38432d)['then'](function(){return _0x7aa7ce;});}return _0x7aa7ce;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index c5cee37..de29e73 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 _0x20de=['UserProfile,\x20%s,\x20%s','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./userProfile.socket','then','info'];(function(_0x57bf95,_0x131d28){var _0x4580a2=function(_0x100c01){while(--_0x100c01){_0x57bf95['push'](_0x57bf95['shift']());}};_0x4580a2(++_0x131d28);}(_0x20de,0x134));var _0xe20d=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x20de[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var moment=require(_0xe20d('0x1'));var BPromise=require(_0xe20d('0x2'));var rs=require(_0xe20d('0x3'));var fs=require('fs');var Redis=require(_0xe20d('0x4'));var db=require(_0xe20d('0x5'))['db'];var utils=require(_0xe20d('0x6'));var logger=require(_0xe20d('0x7'))(_0xe20d('0x8'));var config=require(_0xe20d('0x9'));var jayson=require(_0xe20d('0xa'));var client=jayson[_0xe20d('0xb')]['http']({'port':0x232a});config[_0xe20d('0xc')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe20d('0xd'))(new Redis(config[_0xe20d('0xc')]));require(_0xe20d('0xe'))['register'](socket);function respondWithRpcPromise(_0x288d35,_0x2df52b,_0x5b40ad){return new BPromise(function(_0x339764,_0x337c85){return client['request'](_0x288d35,_0x5b40ad)[_0xe20d('0xf')](function(_0x21763b){logger[_0xe20d('0x10')](_0xe20d('0x11'),_0x2df52b,'request\x20sent');logger['debug'](_0xe20d('0x12'),_0x2df52b,_0xe20d('0x13'),JSON[_0xe20d('0x14')](_0x21763b));if(_0x21763b[_0xe20d('0x15')]){if(_0x21763b[_0xe20d('0x15')][_0xe20d('0x16')]===0x1f4){logger[_0xe20d('0x15')](_0xe20d('0x11'),_0x2df52b,_0x21763b[_0xe20d('0x15')]['message']);return _0x337c85(_0x21763b[_0xe20d('0x15')]['message']);}logger[_0xe20d('0x15')](_0xe20d('0x11'),_0x2df52b,_0x21763b[_0xe20d('0x15')]['message']);return _0x339764(_0x21763b[_0xe20d('0x15')]['message']);}else{logger[_0xe20d('0x10')](_0xe20d('0x11'),_0x2df52b,_0xe20d('0x13'));_0x339764(_0x21763b['result'][_0xe20d('0x17')]);}})[_0xe20d('0x18')](function(_0xd96fa7){logger[_0xe20d('0x15')]('UserProfile,\x20%s,\x20%s',_0x2df52b,_0xd96fa7);_0x337c85(_0xd96fa7);});});} \ No newline at end of file +var _0x6691=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','request','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x139a3c,_0x4fc883){var _0x2b375b=function(_0x525dbf){while(--_0x525dbf){_0x139a3c['push'](_0x139a3c['shift']());}};_0x2b375b(++_0x4fc883);}(_0x6691,0x12d));var _0x1669=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6691[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x1669('0x0'));var util=require(_0x1669('0x1'));var moment=require(_0x1669('0x2'));var BPromise=require(_0x1669('0x3'));var rs=require(_0x1669('0x4'));var fs=require('fs');var Redis=require(_0x1669('0x5'));var db=require(_0x1669('0x6'))['db'];var utils=require(_0x1669('0x7'));var logger=require(_0x1669('0x8'))(_0x1669('0x9'));var config=require('../../config/environment');var jayson=require(_0x1669('0xa'));var client=jayson[_0x1669('0xb')][_0x1669('0xc')]({'port':0x232a});config[_0x1669('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1669('0xe'))(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x56e0ee,_0x52b44f,_0x408538){return new BPromise(function(_0x93d633,_0xdf793d){return client[_0x1669('0xf')](_0x56e0ee,_0x408538)[_0x1669('0x10')](function(_0x3d6f5e){logger[_0x1669('0x11')](_0x1669('0x12'),_0x52b44f,_0x1669('0x13'));logger[_0x1669('0x14')](_0x1669('0x15'),_0x52b44f,_0x1669('0x13'),JSON[_0x1669('0x16')](_0x3d6f5e));if(_0x3d6f5e[_0x1669('0x17')]){if(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x18')]===0x1f4){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0xdf793d(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}logger[_0x1669('0x17')]('UserProfile,\x20%s,\x20%s',_0x52b44f,_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);return _0x93d633(_0x3d6f5e[_0x1669('0x17')][_0x1669('0x19')]);}else{logger[_0x1669('0x11')]('UserProfile,\x20%s,\x20%s',_0x52b44f,'request\x20sent');_0x93d633(_0x3d6f5e[_0x1669('0x1a')][_0x1669('0x19')]);}})[_0x1669('0x1b')](function(_0x4fcf1c){logger[_0x1669('0x17')](_0x1669('0x12'),_0x52b44f,_0x4fcf1c);_0xdf793d(_0x4fcf1c);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e3f3c68..6b839ce 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 _0x1889=['save','update','emit','removeListener','userProfile:'];(function(_0x5be892,_0x68238a){var _0x53fc35=function(_0x8626ac){while(--_0x8626ac){_0x5be892['push'](_0x5be892['shift']());}};_0x53fc35(++_0x68238a);}(_0x1889,0x9b));var _0x9188=function(_0x19e8f0,_0x396f49){_0x19e8f0=_0x19e8f0-0x0;var _0x49c691=_0x1889[_0x19e8f0];return _0x49c691;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x9188('0x0'),'remove',_0x9188('0x1')];function createListener(_0x137190,_0x34ca1b){return function(_0x13d4be){_0x34ca1b[_0x9188('0x2')](_0x137190,_0x13d4be);};}function removeListener(_0x1ddcbc,_0x2ae9cd){return function(){UserProfileEvents[_0x9188('0x3')](_0x1ddcbc,_0x2ae9cd);};}exports['register']=function(_0x384e8e){for(var _0x580844=0x0,_0x8a6ddc=events['length'];_0x580844<_0x8a6ddc;_0x580844++){var _0x45f0a6=events[_0x580844];var _0x4e2607=createListener(_0x9188('0x4')+_0x45f0a6,_0x384e8e);UserProfileEvents['on'](_0x45f0a6,_0x4e2607);}}; \ No newline at end of file +var _0x6c93=['update','emit','removeListener','length','userProfile:','save','remove'];(function(_0x356571,_0x6679fb){var _0x4de016=function(_0x527b64){while(--_0x527b64){_0x356571['push'](_0x356571['shift']());}};_0x4de016(++_0x6679fb);}(_0x6c93,0x1be));var _0x36c9=function(_0x2096b2,_0x53c8bd){_0x2096b2=_0x2096b2-0x0;var _0x540b16=_0x6c93[_0x2096b2];return _0x540b16;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0x36c9('0x0'),_0x36c9('0x1'),_0x36c9('0x2')];function createListener(_0x27b0f6,_0x296922){return function(_0xfd6801){_0x296922[_0x36c9('0x3')](_0x27b0f6,_0xfd6801);};}function removeListener(_0xeee836,_0x37ba7c){return function(){UserProfileEvents[_0x36c9('0x4')](_0xeee836,_0x37ba7c);};}exports['register']=function(_0x487d8a){for(var _0x36fabb=0x0,_0x3ea4bd=events[_0x36c9('0x5')];_0x36fabb<_0x3ea4bd;_0x36fabb++){var _0x48a7bb=events[_0x36fabb];var _0x3c09e3=createListener(_0x36c9('0x6')+_0x48a7bb,_0x487d8a);UserProfileEvents['on'](_0x48a7bb,_0x3c09e3);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 0f67859..c2c802b 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 _0x5ff4=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../config/environment','./userProfileResource.controller','isAuthenticated','index','/describe','/:id','put','update'];(function(_0x17edf8,_0x3bef12){var _0x1bedb5=function(_0x50ff17){while(--_0x50ff17){_0x17edf8['push'](_0x17edf8['shift']());}};_0x1bedb5(++_0x3bef12);}(_0x5ff4,0x172));var _0x45ff=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x5ff4[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0x45ff('0x0'));var util=require(_0x45ff('0x1'));var path=require(_0x45ff('0x2'));var timeout=require(_0x45ff('0x3'));var express=require('express');var router=express[_0x45ff('0x4')]();var fs_extra=require(_0x45ff('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x45ff('0x6'));var controller=require(_0x45ff('0x7'));router['get']('/',auth[_0x45ff('0x8')](),controller[_0x45ff('0x9')]);router['get'](_0x45ff('0xa'),auth[_0x45ff('0x8')](),controller['describe']);router['get'](_0x45ff('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x45ff('0xc')]('/:id',auth[_0x45ff('0x8')](),controller[_0x45ff('0xd')]);router[_0x45ff('0xe')]('/:id',auth[_0x45ff('0x8')](),controller['destroy']);module[_0x45ff('0xf')]=router; \ No newline at end of file +var _0xb1b6=['/:id','show','post','create','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','get','index','/describe','isAuthenticated','describe'];(function(_0x365342,_0x422f85){var _0x8519d7=function(_0x25e14b){while(--_0x25e14b){_0x365342['push'](_0x365342['shift']());}};_0x8519d7(++_0x422f85);}(_0xb1b6,0x1c0));var _0x6b1b=function(_0xc9dde2,_0x64c991){_0xc9dde2=_0xc9dde2-0x0;var _0x2cfe65=_0xb1b6[_0xc9dde2];return _0x2cfe65;};'use strict';var multer=require(_0x6b1b('0x0'));var util=require(_0x6b1b('0x1'));var path=require('path');var timeout=require(_0x6b1b('0x2'));var express=require(_0x6b1b('0x3'));var router=express[_0x6b1b('0x4')]();var fs_extra=require(_0x6b1b('0x5'));var auth=require(_0x6b1b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b1b('0x7'));var controller=require(_0x6b1b('0x8'));router[_0x6b1b('0x9')]('/',auth['isAuthenticated'](),controller[_0x6b1b('0xa')]);router[_0x6b1b('0x9')](_0x6b1b('0xb'),auth[_0x6b1b('0xc')](),controller[_0x6b1b('0xd')]);router[_0x6b1b('0x9')](_0x6b1b('0xe'),auth['isAuthenticated'](),controller[_0x6b1b('0xf')]);router[_0x6b1b('0x10')]('/',auth[_0x6b1b('0xc')](),controller[_0x6b1b('0x11')]);router['put']('/:id',auth[_0x6b1b('0xc')](),controller[_0x6b1b('0x12')]);router[_0x6b1b('0x13')]('/:id',auth[_0x6b1b('0xc')](),controller[_0x6b1b('0x14')]);module[_0x6b1b('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index fc0d93a..e0980ed 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 _0x21cb=['INTEGER','exports','STRING'];(function(_0x2dc343,_0xf015a2){var _0x51eac5=function(_0x1adfef){while(--_0x1adfef){_0x2dc343['push'](_0x2dc343['shift']());}};_0x51eac5(++_0xf015a2);}(_0x21cb,0xf7));var _0xb21c=function(_0x2fd674,_0x538865){_0x2fd674=_0x2fd674-0x0;var _0x47e641=_0x21cb[_0x2fd674];return _0x47e641;};'use strict';var Sequelize=require('sequelize');module[_0xb21c('0x0')]={'name':{'type':Sequelize[_0xb21c('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb21c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb21c('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1111=['sequelize','exports','STRING'];(function(_0x3d01a7,_0x48890f){var _0x20fd1f=function(_0x500e0b){while(--_0x500e0b){_0x3d01a7['push'](_0x3d01a7['shift']());}};_0x20fd1f(++_0x48890f);}(_0x1111,0x1c5));var _0x1111=function(_0x1f9bd4,_0x24363c){_0x1f9bd4=_0x1f9bd4-0x0;var _0x50a9e5=_0x1111[_0x1f9bd4];return _0x50a9e5;};'use strict';var Sequelize=require(_0x1111('0x0'));module[_0x1111('0x1')]={'name':{'type':Sequelize[_0x1111('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x1111('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 3662147..77cdf2a 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 _0x9582=['fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','offset','count','set','json','reject','save','update','then','destroy','error','name','send','index','map','UserProfileResource','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir'];(function(_0x8ab8b1,_0xaa46df){var _0x420c6f=function(_0x410c2a){while(--_0x410c2a){_0x8ab8b1['push'](_0x8ab8b1['shift']());}};_0x420c6f(++_0xaa46df);}(_0x9582,0x95));var _0x2958=function(_0x747068,_0x338623){_0x747068=_0x747068-0x0;var _0x26d792=_0x9582[_0x747068];return _0x26d792;};'use strict';var emlformat=require(_0x2958('0x0'));var rimraf=require(_0x2958('0x1'));var zipdir=require(_0x2958('0x2'));var jsonpatch=require(_0x2958('0x3'));var rp=require(_0x2958('0x4'));var moment=require(_0x2958('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2958('0x6'));var util=require(_0x2958('0x7'));var path=require(_0x2958('0x8'));var sox=require(_0x2958('0x9'));var csv=require(_0x2958('0xa'));var ejs=require(_0x2958('0xb'));var fs=require('fs');var fs_extra=require(_0x2958('0xc'));var _=require(_0x2958('0xd'));var squel=require(_0x2958('0xe'));var crypto=require(_0x2958('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2958('0xa'));var querystring=require('querystring');var Papa=require(_0x2958('0x10'));var Redis=require('ioredis');var authService=require(_0x2958('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2958('0x12'));var hardwareService=require(_0x2958('0x13'));var logger=require(_0x2958('0x14'))(_0x2958('0x15'));var utils=require(_0x2958('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x2958('0x17'));var db=require(_0x2958('0x18'))['db'];function respondWithStatusCode(_0x33a13a,_0x20e06a){_0x20e06a=_0x20e06a||0xcc;return function(_0x47067d){if(_0x47067d){return _0x33a13a[_0x2958('0x19')](_0x20e06a);}return _0x33a13a[_0x2958('0x1a')](_0x20e06a)[_0x2958('0x1b')]();};}function respondWithResult(_0x5bd520,_0x42e976){_0x42e976=_0x42e976||0xc8;return function(_0x2e12d4){if(_0x2e12d4){return _0x5bd520['status'](_0x42e976)['json'](_0x2e12d4);}};}function respondWithFilteredResult(_0x21ed6c,_0x38e724){return function(_0x5f06b1){if(_0x5f06b1){var _0x3bef50=typeof _0x38e724['offset']==='undefined'&&typeof _0x38e724[_0x2958('0x1c')]===_0x2958('0x1d');var _0x55e261=_0x5f06b1['count'];var _0x28a92c=_0x3bef50?0x0:_0x38e724[_0x2958('0x1e')];var _0x310d07=_0x3bef50?_0x5f06b1[_0x2958('0x1f')]:_0x38e724[_0x2958('0x1e')]+_0x38e724['limit'];var _0x19a614;if(_0x310d07>=_0x55e261){_0x310d07=_0x55e261;_0x19a614=0xc8;}else{_0x19a614=0xce;}_0x21ed6c[_0x2958('0x1a')](_0x19a614);return _0x21ed6c[_0x2958('0x20')]('Content-Range',_0x28a92c+'-'+_0x310d07+'/'+_0x55e261)[_0x2958('0x21')](_0x5f06b1);}return null;};}function patchUpdates(_0x53b100){return function(_0x1da684){try{jsonpatch['apply'](_0x1da684,_0x53b100,!![]);}catch(_0x5eaf36){return BPromise[_0x2958('0x22')](_0x5eaf36);}return _0x1da684[_0x2958('0x23')]();};}function saveUpdates(_0x2a02a4,_0x26c5a5){return function(_0x2202f8){if(_0x2202f8){return _0x2202f8[_0x2958('0x24')](_0x2a02a4)[_0x2958('0x25')](function(_0x2b9818){return _0x2b9818;});}return null;};}function removeEntity(_0x330763,_0x2aa514){return function(_0xaf5547){if(_0xaf5547){return _0xaf5547[_0x2958('0x26')]()[_0x2958('0x25')](function(){_0x330763[_0x2958('0x1a')](0xcc)[_0x2958('0x1b')]();});}};}function handleEntityNotFound(_0x4f811a,_0x574df5){return function(_0x3c1155){if(!_0x3c1155){_0x4f811a[_0x2958('0x19')](0x194);}return _0x3c1155;};}function handleError(_0x28c1f5,_0x43cf73){_0x43cf73=_0x43cf73||0x1f4;return function(_0x52bd32){logger[_0x2958('0x27')](_0x52bd32['stack']);if(_0x52bd32[_0x2958('0x28')]){delete _0x52bd32[_0x2958('0x28')];}_0x28c1f5[_0x2958('0x1a')](_0x43cf73)[_0x2958('0x29')](_0x52bd32);};}exports[_0x2958('0x2a')]=function(_0x36e2a5,_0x153958){var _0x5d1dfc={},_0x21b919={},_0x5053d0={'count':0x0,'rows':[]};var _0x48650d=_[_0x2958('0x2b')](db[_0x2958('0x2c')][_0x2958('0x2d')],function(_0x34e56e){return{'name':_0x34e56e[_0x2958('0x2e')],'type':_0x34e56e[_0x2958('0x2f')][_0x2958('0x30')]};});_0x21b919[_0x2958('0x31')]=_['map'](_0x48650d,_0x2958('0x28'));_0x21b919[_0x2958('0x32')]=_['keys'](_0x36e2a5[_0x2958('0x32')]);_0x21b919['filters']=_[_0x2958('0x33')](_0x21b919['model'],_0x21b919[_0x2958('0x32')]);_0x5d1dfc['attributes']=_[_0x2958('0x33')](_0x21b919[_0x2958('0x31')],qs[_0x2958('0x34')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x34')]));_0x5d1dfc[_0x2958('0x35')]=_0x5d1dfc[_0x2958('0x35')][_0x2958('0x36')]?_0x5d1dfc[_0x2958('0x35')]:_0x21b919['model'];if(!_0x36e2a5[_0x2958('0x32')]['hasOwnProperty'](_0x2958('0x37'))){_0x5d1dfc['limit']=qs[_0x2958('0x1c')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1c')]);_0x5d1dfc[_0x2958('0x1e')]=qs[_0x2958('0x1e')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x1e')]);}_0x5d1dfc[_0x2958('0x38')]=qs[_0x2958('0x39')](_0x36e2a5[_0x2958('0x32')][_0x2958('0x39')]);_0x5d1dfc[_0x2958('0x3a')]=qs[_0x2958('0x3b')](_['pick'](_0x36e2a5[_0x2958('0x32')],_0x21b919[_0x2958('0x3b')]),_0x48650d);if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]){_0x5d1dfc['where']=_[_0x2958('0x3d')](_0x5d1dfc[_0x2958('0x3a')],{'$or':_[_0x2958('0x2b')](_0x48650d,function(_0x3f7e27){if(_0x3f7e27[_0x2958('0x2f')]!==_0x2958('0x3e')){var _0x1ed89b={};_0x1ed89b[_0x3f7e27[_0x2958('0x28')]]={'$like':'%'+_0x36e2a5[_0x2958('0x32')][_0x2958('0x3c')]+'%'};return _0x1ed89b;}})});}_0x5d1dfc=_[_0x2958('0x3d')]({},_0x5d1dfc,_0x36e2a5[_0x2958('0x3f')]);var _0x319243={'where':_0x5d1dfc['where']};return db[_0x2958('0x2c')][_0x2958('0x1f')](_0x319243)['then'](function(_0x4fe061){_0x5053d0[_0x2958('0x1f')]=_0x4fe061;if(_0x36e2a5[_0x2958('0x32')][_0x2958('0x40')]){_0x5d1dfc[_0x2958('0x41')]=[{'all':!![]}];}return db[_0x2958('0x2c')][_0x2958('0x42')](_0x5d1dfc);})[_0x2958('0x25')](function(_0x13be6d){_0x5053d0[_0x2958('0x43')]=_0x13be6d;return _0x5053d0;})[_0x2958('0x25')](respondWithFilteredResult(_0x153958,_0x5d1dfc))[_0x2958('0x44')](handleError(_0x153958,null));};exports[_0x2958('0x45')]=function(_0xe33c56,_0x5a58ea){var _0x645b66={'raw':![],'where':{'id':_0xe33c56[_0x2958('0x46')]['id']}},_0x112256={};_0x112256[_0x2958('0x31')]=_['keys'](db[_0x2958('0x2c')]['rawAttributes']);_0x112256['query']=_[_0x2958('0x47')](_0xe33c56[_0x2958('0x32')]);_0x112256[_0x2958('0x3b')]=_[_0x2958('0x33')](_0x112256[_0x2958('0x31')],_0x112256[_0x2958('0x32')]);_0x645b66['attributes']=_[_0x2958('0x33')](_0x112256['model'],qs['fields'](_0xe33c56[_0x2958('0x32')]['fields']));_0x645b66[_0x2958('0x35')]=_0x645b66[_0x2958('0x35')][_0x2958('0x36')]?_0x645b66[_0x2958('0x35')]:_0x112256[_0x2958('0x31')];if(_0xe33c56[_0x2958('0x32')][_0x2958('0x40')]){_0x645b66[_0x2958('0x41')]=[{'all':!![]}];}_0x645b66=_['merge']({},_0x645b66,_0xe33c56[_0x2958('0x3f')]);return db[_0x2958('0x2c')][_0x2958('0x48')](_0x645b66)[_0x2958('0x25')](handleEntityNotFound(_0x5a58ea,null))['then'](respondWithResult(_0x5a58ea,null))[_0x2958('0x44')](handleError(_0x5a58ea,null));};exports[_0x2958('0x49')]=function(_0x4a51b1,_0x1b6829){return db[_0x2958('0x2c')][_0x2958('0x49')](_0x4a51b1[_0x2958('0x4a')],{})[_0x2958('0x25')](respondWithResult(_0x1b6829,0xc9))[_0x2958('0x44')](handleError(_0x1b6829,null));};exports['update']=function(_0x1fff2a,_0x38b551){if(_0x1fff2a[_0x2958('0x4a')]['id']){delete _0x1fff2a[_0x2958('0x4a')]['id'];}return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x1fff2a[_0x2958('0x46')]['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x38b551,null))[_0x2958('0x25')](saveUpdates(_0x1fff2a[_0x2958('0x4a')],null))[_0x2958('0x25')](respondWithResult(_0x38b551,null))[_0x2958('0x44')](handleError(_0x38b551,null));};exports[_0x2958('0x26')]=function(_0x3f7bc1,_0x1bb780){return db[_0x2958('0x2c')][_0x2958('0x48')]({'where':{'id':_0x3f7bc1['params']['id']}})[_0x2958('0x25')](handleEntityNotFound(_0x1bb780,null))['then'](removeEntity(_0x1bb780,null))[_0x2958('0x44')](handleError(_0x1bb780,null));};exports[_0x2958('0x4b')]=function(_0x1db8b1,_0x534677){return db['UserProfileResource'][_0x2958('0x4b')]()[_0x2958('0x25')](respondWithResult(_0x534677,null))[_0x2958('0x44')](handleError(_0x534677,null));}; \ No newline at end of file +var _0xacf4=['findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','UserProfileResource','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include'];(function(_0xa45395,_0x5579e6){var _0x3c83d2=function(_0x5d013c){while(--_0x5d013c){_0xa45395['push'](_0xa45395['shift']());}};_0x3c83d2(++_0x5579e6);}(_0xacf4,0xe7));var _0x4acf=function(_0x4c79aa,_0x456fcd){_0x4c79aa=_0x4c79aa-0x0;var _0x28e73a=_0xacf4[_0x4c79aa];return _0x28e73a;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['UserProfileResource'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['UserProfileResource']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));};exports[_0x4acf('0x48')]=function(_0x2b62bc,_0x113425){return db[_0x4acf('0x29')]['describe']()[_0x4acf('0x21')](respondWithResult(_0x113425,null))[_0x4acf('0x3f')](handleError(_0x113425,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index ccb9f2e..15791f4 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 _0xd057=['moment','bluebird','request-promise','path','./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api'];(function(_0x50844c,_0x543358){var _0x298920=function(_0x948e81){while(--_0x948e81){_0x50844c['push'](_0x50844c['shift']());}};_0x298920(++_0x543358);}(_0xd057,0x19c));var _0x7d05=function(_0x913fe8,_0x3ae0fd){_0x913fe8=_0x913fe8-0x0;var _0x1426c0=_0xd057[_0x913fe8];return _0x1426c0;};'use strict';var _=require(_0x7d05('0x0'));var util=require(_0x7d05('0x1'));var logger=require(_0x7d05('0x2'))(_0x7d05('0x3'));var moment=require(_0x7d05('0x4'));var BPromise=require(_0x7d05('0x5'));var rp=require(_0x7d05('0x6'));var fs=require('fs');var path=require(_0x7d05('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7d05('0x8'));module[_0x7d05('0x9')]=function(_0x43ee13,_0x30236f){return _0x43ee13[_0x7d05('0xa')](_0x7d05('0xb'),attributes,{'tableName':_0x7d05('0xc'),'paranoid':![],'indexes':[{'name':_0x7d05('0xd'),'fields':[_0x7d05('0xe'),_0x7d05('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ddf=['sectionId','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','resourceId'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x7ddf,0x8d));var _0xf7dd=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x7ddf[_0x5783f4];return _0x28e380;};'use strict';var _=require('lodash');var util=require(_0xf7dd('0x0'));var logger=require(_0xf7dd('0x1'))(_0xf7dd('0x2'));var moment=require(_0xf7dd('0x3'));var BPromise=require(_0xf7dd('0x4'));var rp=require(_0xf7dd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf7dd('0x6'));var config=require(_0xf7dd('0x7'));var attributes=require(_0xf7dd('0x8'));module[_0xf7dd('0x9')]=function(_0x180d32,_0x1f3674){return _0x180d32[_0xf7dd('0xa')]('UserProfileResource',attributes,{'tableName':_0xf7dd('0xb'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xf7dd('0xc'),_0xf7dd('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 11202dc..bbc4622 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 _0x4697=['catch','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x4401fa,_0x42210b){var _0x4b1ac6=function(_0xec09ed){while(--_0xec09ed){_0x4401fa['push'](_0x4401fa['shift']());}};_0x4b1ac6(++_0x42210b);}(_0x4697,0x155));var _0x7469=function(_0x21a231,_0x99bca7){_0x21a231=_0x21a231-0x0;var _0x2efe47=_0x4697[_0x21a231];return _0x2efe47;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x7469('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7469('0x1'));var db=require(_0x7469('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x7469('0x3'))(_0x7469('0x4'));var config=require(_0x7469('0x5'));var jayson=require(_0x7469('0x6'));var client=jayson[_0x7469('0x7')][_0x7469('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x275f63,_0x59a664,_0x560da2){return new BPromise(function(_0x364045,_0x2b7e3b){return client[_0x7469('0x9')](_0x275f63,_0x560da2)[_0x7469('0xa')](function(_0x5ed1a3){logger[_0x7469('0xb')](_0x7469('0xc'),_0x59a664,_0x7469('0xd'));logger[_0x7469('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x59a664,_0x7469('0xd'),JSON[_0x7469('0xf')](_0x5ed1a3));if(_0x5ed1a3[_0x7469('0x10')]){if(_0x5ed1a3[_0x7469('0x10')]['code']===0x1f4){logger[_0x7469('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x59a664,_0x5ed1a3[_0x7469('0x10')][_0x7469('0x11')]);return _0x2b7e3b(_0x5ed1a3[_0x7469('0x10')][_0x7469('0x11')]);}logger[_0x7469('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x59a664,_0x5ed1a3[_0x7469('0x10')][_0x7469('0x11')]);return _0x364045(_0x5ed1a3['error'][_0x7469('0x11')]);}else{logger[_0x7469('0xb')](_0x7469('0xc'),_0x59a664,_0x7469('0xd'));_0x364045(_0x5ed1a3[_0x7469('0x12')][_0x7469('0x11')]);}})[_0x7469('0x13')](function(_0x337c5c){logger[_0x7469('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x59a664,_0x337c5c);_0x2b7e3b(_0x337c5c);});});} \ No newline at end of file +var _0x9afd=['UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent'];(function(_0x363473,_0x29eb80){var _0x135458=function(_0x4bf521){while(--_0x4bf521){_0x363473['push'](_0x363473['shift']());}};_0x135458(++_0x29eb80);}(_0x9afd,0xf9));var _0xd9af=function(_0x274638,_0x578968){_0x274638=_0x274638-0x0;var _0x5755df=_0x9afd[_0x274638];return _0x5755df;};'use strict';var _=require('lodash');var util=require(_0xd9af('0x0'));var moment=require(_0xd9af('0x1'));var BPromise=require(_0xd9af('0x2'));var rs=require(_0xd9af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9af('0x4'))['db'];var utils=require(_0xd9af('0x5'));var logger=require('../../config/logger')(_0xd9af('0x6'));var config=require(_0xd9af('0x7'));var jayson=require(_0xd9af('0x8'));var client=jayson['client'][_0xd9af('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe00116,_0x323c46,_0x4f22bc){return new BPromise(function(_0x100a70,_0x1f1d8b){return client[_0xd9af('0xa')](_0xe00116,_0x4f22bc)[_0xd9af('0xb')](function(_0x123a64){logger[_0xd9af('0xc')](_0xd9af('0xd'),_0x323c46,_0xd9af('0xe'));logger['debug'](_0xd9af('0xf'),_0x323c46,_0xd9af('0xe'),JSON[_0xd9af('0x10')](_0x123a64));if(_0x123a64['error']){if(_0x123a64['error'][_0xd9af('0x11')]===0x1f4){logger['error'](_0xd9af('0xd'),_0x323c46,_0x123a64[_0xd9af('0x12')][_0xd9af('0x13')]);return _0x1f1d8b(_0x123a64[_0xd9af('0x12')][_0xd9af('0x13')]);}logger[_0xd9af('0x12')](_0xd9af('0xd'),_0x323c46,_0x123a64['error'][_0xd9af('0x13')]);return _0x100a70(_0x123a64['error'][_0xd9af('0x13')]);}else{logger['info'](_0xd9af('0xd'),_0x323c46,_0xd9af('0xe'));_0x100a70(_0x123a64[_0xd9af('0x14')]['message']);}})[_0xd9af('0x15')](function(_0x409a69){logger[_0xd9af('0x12')](_0xd9af('0xd'),_0x323c46,_0x409a69);_0x1f1d8b(_0x409a69);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index bce439a..f4d0d4e 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 _0x7d04=['path','connect-timeout','Router','fs-extra','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','update','delete','exports','multer','util'];(function(_0x4e0e9b,_0x45999e){var _0x4790b2=function(_0x3e2419){while(--_0x3e2419){_0x4e0e9b['push'](_0x4e0e9b['shift']());}};_0x4790b2(++_0x45999e);}(_0x7d04,0x18a));var _0x47d0=function(_0x34a181,_0x27163b){_0x34a181=_0x34a181-0x0;var _0x44820f=_0x7d04[_0x34a181];return _0x44820f;};'use strict';var multer=require(_0x47d0('0x0'));var util=require(_0x47d0('0x1'));var path=require(_0x47d0('0x2'));var timeout=require(_0x47d0('0x3'));var express=require('express');var router=express[_0x47d0('0x4')]();var fs_extra=require(_0x47d0('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x47d0('0x6'));var controller=require('./userProfileSection.controller');router['get']('/',auth[_0x47d0('0x7')](),controller[_0x47d0('0x8')]);router[_0x47d0('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x47d0('0xa')]);router['get'](_0x47d0('0xb'),auth['isAuthenticated'](),controller[_0x47d0('0xc')]);router[_0x47d0('0xd')]('/',auth['isAuthenticated'](),controller[_0x47d0('0xe')]);router['put'](_0x47d0('0xb'),auth[_0x47d0('0x7')](),controller[_0x47d0('0xf')]);router[_0x47d0('0x10')](_0x47d0('0xb'),auth[_0x47d0('0x7')](),controller['destroy']);module[_0x47d0('0x11')]=router; \ No newline at end of file +var _0xe248=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','delete','destroy','multer','connect-timeout','express'];(function(_0x2181fc,_0x7283aa){var _0x315da1=function(_0x1df7ca){while(--_0x1df7ca){_0x2181fc['push'](_0x2181fc['shift']());}};_0x315da1(++_0x7283aa);}(_0xe248,0x18c));var _0x8e24=function(_0x325052,_0x54d125){_0x325052=_0x325052-0x0;var _0x1add5b=_0xe248[_0x325052];return _0x1add5b;};'use strict';var multer=require(_0x8e24('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8e24('0x1'));var express=require(_0x8e24('0x2'));var router=express[_0x8e24('0x3')]();var fs_extra=require(_0x8e24('0x4'));var auth=require(_0x8e24('0x5'));var interaction=require(_0x8e24('0x6'));var config=require('../../config/environment');var controller=require(_0x8e24('0x7'));router[_0x8e24('0x8')]('/',auth[_0x8e24('0x9')](),controller[_0x8e24('0xa')]);router[_0x8e24('0x8')]('/describe',auth[_0x8e24('0x9')](),controller[_0x8e24('0xb')]);router[_0x8e24('0x8')](_0x8e24('0xc'),auth[_0x8e24('0x9')](),controller[_0x8e24('0xd')]);router['post']('/',auth[_0x8e24('0x9')](),controller[_0x8e24('0xe')]);router[_0x8e24('0xf')]('/:id',auth[_0x8e24('0x9')](),controller[_0x8e24('0x10')]);router[_0x8e24('0x11')](_0x8e24('0xc'),auth[_0x8e24('0x9')](),controller[_0x8e24('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 5a11a79..4132253 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 _0xc900=['join','getDataValue','split','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x31cb5f,_0x2df766){var _0x586042=function(_0x53c807){while(--_0x53c807){_0x31cb5f['push'](_0x31cb5f['shift']());}};_0x586042(++_0x2df766);}(_0xc900,0xb3));var _0x0c90=function(_0x53db6a,_0xc3fece){_0x53db6a=_0x53db6a-0x0;var _0x383bce=_0xc900[_0x53db6a];return _0x383bce;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0c90('0x0')],'allowNull':![]},'category':{'type':Sequelize[_0x0c90('0x0')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x0c90('0x1')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0c90('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0c90('0x0')],'set':function(_0x492f22){this[_0x0c90('0x3')](_0x0c90('0x4'),_0x492f22?_0x492f22[_0x0c90('0x5')](''):[]);},'get':function(){return this[_0x0c90('0x6')](_0x0c90('0x4'))?this[_0x0c90('0x6')]('crudPermissions')[_0x0c90('0x7')](''):[];}}}; \ No newline at end of file +var _0x9c00=['STRING','setDataValue','crudPermissions','join','getDataValue','split','sequelize','exports','INTEGER','BOOLEAN'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x9c00,0x1a0));var _0x09c0=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0x9c00[_0x7880d2];return _0x35ebbe;};'use strict';var Sequelize=require(_0x09c0('0x0'));module[_0x09c0('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x09c0('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x09c0('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x09c0('0x4')],'set':function(_0x2c702c){this[_0x09c0('0x5')](_0x09c0('0x6'),_0x2c702c?_0x2c702c[_0x09c0('0x7')](''):[]);},'get':function(){return this['getDataValue']('crudPermissions')?this[_0x09c0('0x8')](_0x09c0('0x6'))[_0x09c0('0x9')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 674aace..89bb02e 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 _0xfcbe=['zip-dir','fast-json-patch','bluebird','util','path','to-csv','lodash','squel','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','limit','undefined','count','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','UserProfileSection','params','keys','find','catch','create','body','destroy','describe','eml-format'];(function(_0x5cc1a8,_0x2d43ad){var _0x354cb5=function(_0x10df93){while(--_0x10df93){_0x5cc1a8['push'](_0x5cc1a8['shift']());}};_0x354cb5(++_0x2d43ad);}(_0xfcbe,0x1af));var _0xefcb=function(_0xe477a0,_0x39023b){_0xe477a0=_0xe477a0-0x0;var _0x2a8eeb=_0xfcbe[_0xe477a0];return _0x2a8eeb;};'use strict';var emlformat=require(_0xefcb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xefcb('0x1'));var jsonpatch=require(_0xefcb('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xefcb('0x3'));var Mustache=require('mustache');var util=require(_0xefcb('0x4'));var path=require(_0xefcb('0x5'));var sox=require('sox');var csv=require(_0xefcb('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefcb('0x7'));var squel=require(_0xefcb('0x8'));var crypto=require('crypto');var jsforce=require(_0xefcb('0x9'));var deskjs=require(_0xefcb('0xa'));var toCsv=require(_0xefcb('0x6'));var querystring=require(_0xefcb('0xb'));var Papa=require('papaparse');var Redis=require(_0xefcb('0xc'));var authService=require(_0xefcb('0xd'));var qs=require(_0xefcb('0xe'));var as=require(_0xefcb('0xf'));var hardwareService=require(_0xefcb('0x10'));var logger=require('../../config/logger')(_0xefcb('0x11'));var utils=require(_0xefcb('0x12'));var config=require(_0xefcb('0x13'));var licenseUtil=require(_0xefcb('0x14'));var db=require(_0xefcb('0x15'))['db'];function respondWithStatusCode(_0x42612d,_0x593b0a){_0x593b0a=_0x593b0a||0xcc;return function(_0x5ce70d){if(_0x5ce70d){return _0x42612d['sendStatus'](_0x593b0a);}return _0x42612d[_0xefcb('0x16')](_0x593b0a)[_0xefcb('0x17')]();};}function respondWithResult(_0x375cbc,_0x184ab3){_0x184ab3=_0x184ab3||0xc8;return function(_0x1087a0){if(_0x1087a0){return _0x375cbc[_0xefcb('0x16')](_0x184ab3)[_0xefcb('0x18')](_0x1087a0);}};}function respondWithFilteredResult(_0x2d461c,_0x3f98c3){return function(_0x154a44){if(_0x154a44){var _0x5afb59=typeof _0x3f98c3[_0xefcb('0x19')]==='undefined'&&typeof _0x3f98c3[_0xefcb('0x1a')]===_0xefcb('0x1b');var _0xf4ab7b=_0x154a44[_0xefcb('0x1c')];var _0x181f2e=_0x5afb59?0x0:_0x3f98c3[_0xefcb('0x19')];var _0x58f498=_0x5afb59?_0x154a44[_0xefcb('0x1c')]:_0x3f98c3[_0xefcb('0x19')]+_0x3f98c3['limit'];var _0x138292;if(_0x58f498>=_0xf4ab7b){_0x58f498=_0xf4ab7b;_0x138292=0xc8;}else{_0x138292=0xce;}_0x2d461c[_0xefcb('0x16')](_0x138292);return _0x2d461c['set'](_0xefcb('0x1d'),_0x181f2e+'-'+_0x58f498+'/'+_0xf4ab7b)[_0xefcb('0x18')](_0x154a44);}return null;};}function patchUpdates(_0x31d1d1){return function(_0x5c39e9){try{jsonpatch[_0xefcb('0x1e')](_0x5c39e9,_0x31d1d1,!![]);}catch(_0x5632a1){return BPromise[_0xefcb('0x1f')](_0x5632a1);}return _0x5c39e9[_0xefcb('0x20')]();};}function saveUpdates(_0x2d765d,_0x2da338){return function(_0x3cd509){if(_0x3cd509){return _0x3cd509[_0xefcb('0x21')](_0x2d765d)[_0xefcb('0x22')](function(_0x24889b){return _0x24889b;});}return null;};}function removeEntity(_0x4b5bb9,_0x1162d4){return function(_0x2bc818){if(_0x2bc818){return _0x2bc818['destroy']()[_0xefcb('0x22')](function(){_0x4b5bb9[_0xefcb('0x16')](0xcc)[_0xefcb('0x17')]();});}};}function handleEntityNotFound(_0x2779e4,_0xbc6e95){return function(_0x5b5f2a){if(!_0x5b5f2a){_0x2779e4[_0xefcb('0x23')](0x194);}return _0x5b5f2a;};}function handleError(_0x388010,_0x2b4c27){_0x2b4c27=_0x2b4c27||0x1f4;return function(_0x88b3cf){logger[_0xefcb('0x24')](_0x88b3cf[_0xefcb('0x25')]);if(_0x88b3cf[_0xefcb('0x26')]){delete _0x88b3cf['name'];}_0x388010[_0xefcb('0x16')](_0x2b4c27)[_0xefcb('0x27')](_0x88b3cf);};}exports[_0xefcb('0x28')]=function(_0x2c5e96,_0x50be15){var _0x44dc5c={},_0x305559={},_0x54ddf5={'count':0x0,'rows':[]};var _0x5ca58a=_[_0xefcb('0x29')](db['UserProfileSection'][_0xefcb('0x2a')],function(_0xe3ee41){return{'name':_0xe3ee41[_0xefcb('0x2b')],'type':_0xe3ee41['type']['key']};});_0x305559[_0xefcb('0x2c')]=_[_0xefcb('0x29')](_0x5ca58a,_0xefcb('0x26'));_0x305559[_0xefcb('0x2d')]=_['keys'](_0x2c5e96[_0xefcb('0x2d')]);_0x305559[_0xefcb('0x2e')]=_[_0xefcb('0x2f')](_0x305559[_0xefcb('0x2c')],_0x305559[_0xefcb('0x2d')]);_0x44dc5c[_0xefcb('0x30')]=_[_0xefcb('0x2f')](_0x305559[_0xefcb('0x2c')],qs[_0xefcb('0x31')](_0x2c5e96['query']['fields']));_0x44dc5c[_0xefcb('0x30')]=_0x44dc5c[_0xefcb('0x30')][_0xefcb('0x32')]?_0x44dc5c[_0xefcb('0x30')]:_0x305559[_0xefcb('0x2c')];if(!_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x33')](_0xefcb('0x34'))){_0x44dc5c[_0xefcb('0x1a')]=qs[_0xefcb('0x1a')](_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x1a')]);_0x44dc5c['offset']=qs[_0xefcb('0x19')](_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x19')]);}_0x44dc5c[_0xefcb('0x35')]=qs['sort'](_0x2c5e96['query'][_0xefcb('0x36')]);_0x44dc5c[_0xefcb('0x37')]=qs['filters'](_[_0xefcb('0x38')](_0x2c5e96[_0xefcb('0x2d')],_0x305559[_0xefcb('0x2e')]),_0x5ca58a);if(_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x39')]){_0x44dc5c[_0xefcb('0x37')]=_[_0xefcb('0x3a')](_0x44dc5c[_0xefcb('0x37')],{'$or':_['map'](_0x5ca58a,function(_0xb60fda){if(_0xb60fda[_0xefcb('0x3b')]!==_0xefcb('0x3c')){var _0xd89b93={};_0xd89b93[_0xb60fda[_0xefcb('0x26')]]={'$like':'%'+_0x2c5e96[_0xefcb('0x2d')][_0xefcb('0x39')]+'%'};return _0xd89b93;}})});}_0x44dc5c=_[_0xefcb('0x3a')]({},_0x44dc5c,_0x2c5e96[_0xefcb('0x3d')]);var _0x5792a5={'where':_0x44dc5c['where']};return db['UserProfileSection'][_0xefcb('0x1c')](_0x5792a5)['then'](function(_0x26fe25){_0x54ddf5[_0xefcb('0x1c')]=_0x26fe25;if(_0x2c5e96['query'][_0xefcb('0x3e')]){_0x44dc5c['include']=[{'all':!![]}];}return db[_0xefcb('0x3f')]['findAll'](_0x44dc5c);})[_0xefcb('0x22')](function(_0x3bf6c5){_0x54ddf5['rows']=_0x3bf6c5;return _0x54ddf5;})[_0xefcb('0x22')](respondWithFilteredResult(_0x50be15,_0x44dc5c))['catch'](handleError(_0x50be15,null));};exports['show']=function(_0x20d828,_0x2c1f54){var _0xd96898={'raw':![],'where':{'id':_0x20d828[_0xefcb('0x40')]['id']}},_0x41704b={};_0x41704b[_0xefcb('0x2c')]=_['keys'](db[_0xefcb('0x3f')][_0xefcb('0x2a')]);_0x41704b[_0xefcb('0x2d')]=_[_0xefcb('0x41')](_0x20d828[_0xefcb('0x2d')]);_0x41704b['filters']=_[_0xefcb('0x2f')](_0x41704b[_0xefcb('0x2c')],_0x41704b[_0xefcb('0x2d')]);_0xd96898['attributes']=_[_0xefcb('0x2f')](_0x41704b[_0xefcb('0x2c')],qs[_0xefcb('0x31')](_0x20d828[_0xefcb('0x2d')][_0xefcb('0x31')]));_0xd96898[_0xefcb('0x30')]=_0xd96898[_0xefcb('0x30')][_0xefcb('0x32')]?_0xd96898[_0xefcb('0x30')]:_0x41704b[_0xefcb('0x2c')];if(_0x20d828[_0xefcb('0x2d')]['includeAll']){_0xd96898['include']=[{'all':!![]}];}_0xd96898=_[_0xefcb('0x3a')]({},_0xd96898,_0x20d828[_0xefcb('0x3d')]);return db['UserProfileSection'][_0xefcb('0x42')](_0xd96898)[_0xefcb('0x22')](handleEntityNotFound(_0x2c1f54,null))['then'](respondWithResult(_0x2c1f54,null))[_0xefcb('0x43')](handleError(_0x2c1f54,null));};exports[_0xefcb('0x44')]=function(_0x5e3837,_0x4b5141){return db[_0xefcb('0x3f')][_0xefcb('0x44')](_0x5e3837['body'],{})[_0xefcb('0x22')](respondWithResult(_0x4b5141,0xc9))[_0xefcb('0x43')](handleError(_0x4b5141,null));};exports['update']=function(_0x54bd67,_0x3e01c8){if(_0x54bd67[_0xefcb('0x45')]['id']){delete _0x54bd67['body']['id'];}return db[_0xefcb('0x3f')][_0xefcb('0x42')]({'where':{'id':_0x54bd67[_0xefcb('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e01c8,null))['then'](saveUpdates(_0x54bd67[_0xefcb('0x45')],null))[_0xefcb('0x22')](respondWithResult(_0x3e01c8,null))[_0xefcb('0x43')](handleError(_0x3e01c8,null));};exports[_0xefcb('0x46')]=function(_0x3ea0b6,_0x36c1d8){return db['UserProfileSection'][_0xefcb('0x42')]({'where':{'id':_0x3ea0b6['params']['id']}})[_0xefcb('0x22')](handleEntityNotFound(_0x36c1d8,null))[_0xefcb('0x22')](removeEntity(_0x36c1d8,null))[_0xefcb('0x43')](handleError(_0x36c1d8,null));};exports[_0xefcb('0x47')]=function(_0x44c0b1,_0x355467){return db[_0xefcb('0x3f')][_0xefcb('0x47')]()['then'](respondWithResult(_0x355467,null))['catch'](handleError(_0x355467,null));}; \ No newline at end of file +var _0xb5ee=['Content-Range','json','save','update','then','destroy','error','name','send','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','params','include','options','create','body','find','describe','eml-format','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','offset','undefined','limit','count','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5ee,0x199));var _0xeb5e=function(_0x3dc538,_0x4f7702){_0x3dc538=_0x3dc538-0x0;var _0x72c2fd=_0xb5ee[_0x3dc538];return _0x72c2fd;};'use strict';var emlformat=require(_0xeb5e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xeb5e('0x1'));var BPromise=require(_0xeb5e('0x2'));var Mustache=require(_0xeb5e('0x3'));var util=require(_0xeb5e('0x4'));var path=require(_0xeb5e('0x5'));var sox=require(_0xeb5e('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeb5e('0x7'));var _=require(_0xeb5e('0x8'));var squel=require('squel');var crypto=require(_0xeb5e('0x9'));var jsforce=require(_0xeb5e('0xa'));var deskjs=require(_0xeb5e('0xb'));var toCsv=require(_0xeb5e('0xc'));var querystring=require(_0xeb5e('0xd'));var Papa=require('papaparse');var Redis=require(_0xeb5e('0xe'));var authService=require(_0xeb5e('0xf'));var qs=require(_0xeb5e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb5e('0x11'));var logger=require(_0xeb5e('0x12'))(_0xeb5e('0x13'));var utils=require(_0xeb5e('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xeb5e('0x15'));var db=require(_0xeb5e('0x16'))['db'];function respondWithStatusCode(_0xb7cdb5,_0x321111){_0x321111=_0x321111||0xcc;return function(_0x46ca77){if(_0x46ca77){return _0xb7cdb5['sendStatus'](_0x321111);}return _0xb7cdb5['status'](_0x321111)[_0xeb5e('0x17')]();};}function respondWithResult(_0x43d348,_0x29c844){_0x29c844=_0x29c844||0xc8;return function(_0x1ccb58){if(_0x1ccb58){return _0x43d348['status'](_0x29c844)['json'](_0x1ccb58);}};}function respondWithFilteredResult(_0x502c03,_0x497364){return function(_0x5e9e1d){if(_0x5e9e1d){var _0x23f2f=typeof _0x497364[_0xeb5e('0x18')]===_0xeb5e('0x19')&&typeof _0x497364[_0xeb5e('0x1a')]==='undefined';var _0x5b3a82=_0x5e9e1d[_0xeb5e('0x1b')];var _0x117a2a=_0x23f2f?0x0:_0x497364[_0xeb5e('0x18')];var _0x4c7dc3=_0x23f2f?_0x5e9e1d['count']:_0x497364['offset']+_0x497364[_0xeb5e('0x1a')];var _0x548fdc;if(_0x4c7dc3>=_0x5b3a82){_0x4c7dc3=_0x5b3a82;_0x548fdc=0xc8;}else{_0x548fdc=0xce;}_0x502c03[_0xeb5e('0x1c')](_0x548fdc);return _0x502c03['set'](_0xeb5e('0x1d'),_0x117a2a+'-'+_0x4c7dc3+'/'+_0x5b3a82)[_0xeb5e('0x1e')](_0x5e9e1d);}return null;};}function patchUpdates(_0x53c1d6){return function(_0x2bb5f5){try{jsonpatch['apply'](_0x2bb5f5,_0x53c1d6,!![]);}catch(_0x1f0670){return BPromise['reject'](_0x1f0670);}return _0x2bb5f5[_0xeb5e('0x1f')]();};}function saveUpdates(_0xbb5beb,_0x4e729d){return function(_0x5992aa){if(_0x5992aa){return _0x5992aa[_0xeb5e('0x20')](_0xbb5beb)[_0xeb5e('0x21')](function(_0x242d53){return _0x242d53;});}return null;};}function removeEntity(_0x3d5945,_0x1019e1){return function(_0x2bba33){if(_0x2bba33){return _0x2bba33[_0xeb5e('0x22')]()[_0xeb5e('0x21')](function(){_0x3d5945['status'](0xcc)[_0xeb5e('0x17')]();});}};}function handleEntityNotFound(_0x56becd,_0x3f1e69){return function(_0x354a41){if(!_0x354a41){_0x56becd['sendStatus'](0x194);}return _0x354a41;};}function handleError(_0x66f5f9,_0x5f5d1b){_0x5f5d1b=_0x5f5d1b||0x1f4;return function(_0x40647f){logger[_0xeb5e('0x23')](_0x40647f['stack']);if(_0x40647f[_0xeb5e('0x24')]){delete _0x40647f[_0xeb5e('0x24')];}_0x66f5f9[_0xeb5e('0x1c')](_0x5f5d1b)[_0xeb5e('0x25')](_0x40647f);};}exports[_0xeb5e('0x26')]=function(_0x3b8dba,_0x575011){var _0x3c86f1={},_0x21dcab={},_0x527900={'count':0x0,'rows':[]};var _0x10c563=_[_0xeb5e('0x27')](db[_0xeb5e('0x28')][_0xeb5e('0x29')],function(_0x3f609c){return{'name':_0x3f609c[_0xeb5e('0x2a')],'type':_0x3f609c[_0xeb5e('0x2b')][_0xeb5e('0x2c')]};});_0x21dcab[_0xeb5e('0x2d')]=_[_0xeb5e('0x27')](_0x10c563,_0xeb5e('0x24'));_0x21dcab['query']=_[_0xeb5e('0x2e')](_0x3b8dba[_0xeb5e('0x2f')]);_0x21dcab[_0xeb5e('0x30')]=_[_0xeb5e('0x31')](_0x21dcab[_0xeb5e('0x2d')],_0x21dcab['query']);_0x3c86f1[_0xeb5e('0x32')]=_[_0xeb5e('0x31')](_0x21dcab['model'],qs[_0xeb5e('0x33')](_0x3b8dba[_0xeb5e('0x2f')]['fields']));_0x3c86f1[_0xeb5e('0x32')]=_0x3c86f1[_0xeb5e('0x32')][_0xeb5e('0x34')]?_0x3c86f1[_0xeb5e('0x32')]:_0x21dcab[_0xeb5e('0x2d')];if(!_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x35')](_0xeb5e('0x36'))){_0x3c86f1[_0xeb5e('0x1a')]=qs[_0xeb5e('0x1a')](_0x3b8dba['query']['limit']);_0x3c86f1[_0xeb5e('0x18')]=qs[_0xeb5e('0x18')](_0x3b8dba[_0xeb5e('0x2f')]['offset']);}_0x3c86f1[_0xeb5e('0x37')]=qs[_0xeb5e('0x38')](_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x38')]);_0x3c86f1[_0xeb5e('0x39')]=qs['filters'](_[_0xeb5e('0x3a')](_0x3b8dba[_0xeb5e('0x2f')],_0x21dcab[_0xeb5e('0x30')]),_0x10c563);if(_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x3b')]){_0x3c86f1['where']=_['merge'](_0x3c86f1[_0xeb5e('0x39')],{'$or':_[_0xeb5e('0x27')](_0x10c563,function(_0x4450ee){if(_0x4450ee['type']!==_0xeb5e('0x3c')){var _0x11ca66={};_0x11ca66[_0x4450ee[_0xeb5e('0x24')]]={'$like':'%'+_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x3b')]+'%'};return _0x11ca66;}})});}_0x3c86f1=_[_0xeb5e('0x3d')]({},_0x3c86f1,_0x3b8dba['options']);var _0x3cca81={'where':_0x3c86f1[_0xeb5e('0x39')]};return db[_0xeb5e('0x28')][_0xeb5e('0x1b')](_0x3cca81)[_0xeb5e('0x21')](function(_0x538e5a){_0x527900[_0xeb5e('0x1b')]=_0x538e5a;if(_0x3b8dba[_0xeb5e('0x2f')][_0xeb5e('0x3e')]){_0x3c86f1['include']=[{'all':!![]}];}return db[_0xeb5e('0x28')][_0xeb5e('0x3f')](_0x3c86f1);})[_0xeb5e('0x21')](function(_0x5865b5){_0x527900[_0xeb5e('0x40')]=_0x5865b5;return _0x527900;})[_0xeb5e('0x21')](respondWithFilteredResult(_0x575011,_0x3c86f1))[_0xeb5e('0x41')](handleError(_0x575011,null));};exports['show']=function(_0x3ebcf3,_0x6ebc8d){var _0x5d5668={'raw':![],'where':{'id':_0x3ebcf3[_0xeb5e('0x42')]['id']}},_0x88de26={};_0x88de26[_0xeb5e('0x2d')]=_[_0xeb5e('0x2e')](db['UserProfileSection'][_0xeb5e('0x29')]);_0x88de26[_0xeb5e('0x2f')]=_[_0xeb5e('0x2e')](_0x3ebcf3[_0xeb5e('0x2f')]);_0x88de26['filters']=_[_0xeb5e('0x31')](_0x88de26[_0xeb5e('0x2d')],_0x88de26[_0xeb5e('0x2f')]);_0x5d5668[_0xeb5e('0x32')]=_['intersection'](_0x88de26[_0xeb5e('0x2d')],qs[_0xeb5e('0x33')](_0x3ebcf3[_0xeb5e('0x2f')][_0xeb5e('0x33')]));_0x5d5668['attributes']=_0x5d5668[_0xeb5e('0x32')][_0xeb5e('0x34')]?_0x5d5668[_0xeb5e('0x32')]:_0x88de26['model'];if(_0x3ebcf3['query']['includeAll']){_0x5d5668[_0xeb5e('0x43')]=[{'all':!![]}];}_0x5d5668=_[_0xeb5e('0x3d')]({},_0x5d5668,_0x3ebcf3[_0xeb5e('0x44')]);return db[_0xeb5e('0x28')]['find'](_0x5d5668)[_0xeb5e('0x21')](handleEntityNotFound(_0x6ebc8d,null))['then'](respondWithResult(_0x6ebc8d,null))[_0xeb5e('0x41')](handleError(_0x6ebc8d,null));};exports[_0xeb5e('0x45')]=function(_0x2b343e,_0x5d9ca0){return db[_0xeb5e('0x28')]['create'](_0x2b343e[_0xeb5e('0x46')],{})[_0xeb5e('0x21')](respondWithResult(_0x5d9ca0,0xc9))[_0xeb5e('0x41')](handleError(_0x5d9ca0,null));};exports[_0xeb5e('0x20')]=function(_0x36a48c,_0x405689){if(_0x36a48c[_0xeb5e('0x46')]['id']){delete _0x36a48c['body']['id'];}return db[_0xeb5e('0x28')][_0xeb5e('0x47')]({'where':{'id':_0x36a48c[_0xeb5e('0x42')]['id']}})[_0xeb5e('0x21')](handleEntityNotFound(_0x405689,null))['then'](saveUpdates(_0x36a48c[_0xeb5e('0x46')],null))[_0xeb5e('0x21')](respondWithResult(_0x405689,null))[_0xeb5e('0x41')](handleError(_0x405689,null));};exports[_0xeb5e('0x22')]=function(_0x57782b,_0x11fa56){return db[_0xeb5e('0x28')][_0xeb5e('0x47')]({'where':{'id':_0x57782b[_0xeb5e('0x42')]['id']}})[_0xeb5e('0x21')](handleEntityNotFound(_0x11fa56,null))[_0xeb5e('0x21')](removeEntity(_0x11fa56,null))[_0xeb5e('0x41')](handleError(_0x11fa56,null));};exports[_0xeb5e('0x48')]=function(_0x17a887,_0x54c1df){return db[_0xeb5e('0x28')][_0xeb5e('0x48')]()[_0xeb5e('0x21')](respondWithResult(_0x54c1df,null))[_0xeb5e('0x41')](handleError(_0x54c1df,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index db759ba..2114a15 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 _0xaa11=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x16e57d,_0x2cb7ba){var _0x40239c=function(_0x3cc8f0){while(--_0x3cc8f0){_0x16e57d['push'](_0x16e57d['shift']());}};_0x40239c(++_0x2cb7ba);}(_0xaa11,0x78));var _0x1aa1=function(_0x40ff3b,_0x238af7){_0x40ff3b=_0x40ff3b-0x0;var _0x3ccf4f=_0xaa11[_0x40ff3b];return _0x3ccf4f;};'use strict';var _=require(_0x1aa1('0x0'));var util=require(_0x1aa1('0x1'));var logger=require(_0x1aa1('0x2'))(_0x1aa1('0x3'));var moment=require(_0x1aa1('0x4'));var BPromise=require(_0x1aa1('0x5'));var rp=require(_0x1aa1('0x6'));var fs=require('fs');var path=require(_0x1aa1('0x7'));var rimraf=require('rimraf');var config=require(_0x1aa1('0x8'));var attributes=require('./userProfileSection.attributes');module[_0x1aa1('0x9')]=function(_0x37ef0e,_0x502e0b){return _0x37ef0e['define'](_0x1aa1('0xa'),attributes,{'tableName':_0x1aa1('0xb'),'paranoid':![],'indexes':[{'name':_0x1aa1('0xc'),'fields':[_0x1aa1('0xd'),_0x1aa1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7cf=['api','bluebird','request-promise','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','userProfileId','../../config/logger'];(function(_0x1c55d6,_0x590163){var _0x16bdb3=function(_0x3c5069){while(--_0x3c5069){_0x1c55d6['push'](_0x1c55d6['shift']());}};_0x16bdb3(++_0x590163);}(_0xd7cf,0x12b));var _0xfd7c=function(_0x328b40,_0x370642){_0x328b40=_0x328b40-0x0;var _0x556a56=_0xd7cf[_0x328b40];return _0x556a56;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfd7c('0x0'))(_0xfd7c('0x1'));var moment=require('moment');var BPromise=require(_0xfd7c('0x2'));var rp=require(_0xfd7c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xfd7c('0x4'));var attributes=require(_0xfd7c('0x5'));module[_0xfd7c('0x6')]=function(_0x12063a,_0x5c946b){return _0x12063a[_0xfd7c('0x7')](_0xfd7c('0x8'),attributes,{'tableName':_0xfd7c('0x9'),'paranoid':![],'indexes':[{'name':_0xfd7c('0xa'),'fields':['sectionId',_0xfd7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index b72f630..56fe131 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 _0x76a8=['code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x76a8,0x1e7));var _0x876a=function(_0x55857a,_0x391123){_0x55857a=_0x55857a-0x0;var _0x38b322=_0x76a8[_0x55857a];return _0x38b322;};'use strict';var _=require(_0x876a('0x0'));var util=require(_0x876a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x876a('0x2'));var fs=require('fs');var Redis=require(_0x876a('0x3'));var db=require(_0x876a('0x4'))['db'];var utils=require(_0x876a('0x5'));var logger=require(_0x876a('0x6'))(_0x876a('0x7'));var config=require(_0x876a('0x8'));var jayson=require(_0x876a('0x9'));var client=jayson['client'][_0x876a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3981fa,_0x44ddfe,_0x5898f0){return new BPromise(function(_0x2681ef,_0x19a160){return client[_0x876a('0xb')](_0x3981fa,_0x5898f0)[_0x876a('0xc')](function(_0x1d98d5){logger[_0x876a('0xd')](_0x876a('0xe'),_0x44ddfe,_0x876a('0xf'));logger[_0x876a('0x10')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x44ddfe,_0x876a('0xf'),JSON[_0x876a('0x11')](_0x1d98d5));if(_0x1d98d5[_0x876a('0x12')]){if(_0x1d98d5[_0x876a('0x12')][_0x876a('0x13')]===0x1f4){logger[_0x876a('0x12')]('UserProfileSection,\x20%s,\x20%s',_0x44ddfe,_0x1d98d5[_0x876a('0x12')][_0x876a('0x14')]);return _0x19a160(_0x1d98d5[_0x876a('0x12')][_0x876a('0x14')]);}logger[_0x876a('0x12')](_0x876a('0xe'),_0x44ddfe,_0x1d98d5['error'][_0x876a('0x14')]);return _0x2681ef(_0x1d98d5[_0x876a('0x12')][_0x876a('0x14')]);}else{logger[_0x876a('0xd')](_0x876a('0xe'),_0x44ddfe,_0x876a('0xf'));_0x2681ef(_0x1d98d5[_0x876a('0x15')][_0x876a('0x14')]);}})['catch'](function(_0x1e17f2){logger['error'](_0x876a('0xe'),_0x44ddfe,_0x1e17f2);_0x19a160(_0x1e17f2);});});} \ No newline at end of file +var _0x50e5=['jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x52e140,_0x274e0e){var _0x26c1aa=function(_0x50a8cb){while(--_0x50a8cb){_0x52e140['push'](_0x52e140['shift']());}};_0x26c1aa(++_0x274e0e);}(_0x50e5,0x66));var _0x550e=function(_0x448393,_0x4d03b1){_0x448393=_0x448393-0x0;var _0xe08eb6=_0x50e5[_0x448393];return _0xe08eb6;};'use strict';var _=require('lodash');var util=require(_0x550e('0x0'));var moment=require(_0x550e('0x1'));var BPromise=require(_0x550e('0x2'));var rs=require(_0x550e('0x3'));var fs=require('fs');var Redis=require(_0x550e('0x4'));var db=require(_0x550e('0x5'))['db'];var utils=require(_0x550e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x550e('0x7'));var jayson=require(_0x550e('0x8'));var client=jayson[_0x550e('0x9')][_0x550e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x39c14a,_0x518407,_0x323f6b){return new BPromise(function(_0x335dfd,_0x1d3e85){return client[_0x550e('0xb')](_0x39c14a,_0x323f6b)[_0x550e('0xc')](function(_0x397398){logger['info'](_0x550e('0xd'),_0x518407,_0x550e('0xe'));logger[_0x550e('0xf')](_0x550e('0x10'),_0x518407,'request\x20sent',JSON['stringify'](_0x397398));if(_0x397398[_0x550e('0x11')]){if(_0x397398[_0x550e('0x11')][_0x550e('0x12')]===0x1f4){logger[_0x550e('0x11')]('UserProfileSection,\x20%s,\x20%s',_0x518407,_0x397398[_0x550e('0x11')][_0x550e('0x13')]);return _0x1d3e85(_0x397398['error'][_0x550e('0x13')]);}logger[_0x550e('0x11')](_0x550e('0xd'),_0x518407,_0x397398[_0x550e('0x11')][_0x550e('0x13')]);return _0x335dfd(_0x397398[_0x550e('0x11')]['message']);}else{logger[_0x550e('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x518407,_0x550e('0xe'));_0x335dfd(_0x397398[_0x550e('0x15')][_0x550e('0x13')]);}})['catch'](function(_0xd9e8fe){logger[_0x550e('0x11')](_0x550e('0xd'),_0x518407,_0xd9e8fe);_0x1d3e85(_0xd9e8fe);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 19c9c10..b90de33 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x5bf7c2,_0x1a5b0e){var _0x54284d=function(_0x4941f1){while(--_0x4941f1){_0x5bf7c2['push'](_0x5bf7c2['shift']());}};_0x54284d(++_0x1a5b0e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0xcb91[_0x3de873];return _0x380b8c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x550d8f,_0x13a896){var _0x3b6492=function(_0xa66451){while(--_0xa66451){_0x550d8f['push'](_0x550d8f['shift']());}};_0x3b6492(++_0x13a896);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index f57da1d..fe5348d 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 _0xd2fc=['exports'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xd2fc,0xda));var _0xcd2f=function(_0xb2789c,_0x3d2166){_0xb2789c=_0xb2789c-0x0;var _0xa1322f=_0xd2fc[_0xb2789c];return _0xa1322f;};'use strict';var Sequelize=require('sequelize');module[_0xcd2f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x6324=['INTEGER','sequelize'];(function(_0xf31eca,_0x3fbeec){var _0x1b82a3=function(_0x52af39){while(--_0x52af39){_0xf31eca['push'](_0xf31eca['shift']());}};_0x1b82a3(++_0x3fbeec);}(_0x6324,0x13b));var _0x4632=function(_0x3c9e74,_0x4334c5){_0x3c9e74=_0x3c9e74-0x0;var _0x4fea21=_0x6324[_0x3c9e74];return _0x4fea21;};'use strict';var Sequelize=require(_0x4632('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x4632('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index 376d33f..adc62dd 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 _0x964b=['util','api','moment','bluebird','rimraf','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash'];(function(_0x57b236,_0x30614e){var _0x4feb29=function(_0x26d3e6){while(--_0x26d3e6){_0x57b236['push'](_0x57b236['shift']());}};_0x4feb29(++_0x30614e);}(_0x964b,0x112));var _0xb964=function(_0x2c375b,_0xbb7ecf){_0x2c375b=_0x2c375b-0x0;var _0x3c2cd9=_0x964b[_0x2c375b];return _0x3c2cd9;};'use strict';var _=require(_0xb964('0x0'));var util=require(_0xb964('0x1'));var logger=require('../../config/logger')(_0xb964('0x2'));var moment=require(_0xb964('0x3'));var BPromise=require(_0xb964('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb964('0x5'));var config=require('../../config/environment');var attributes=require(_0xb964('0x6'));module[_0xb964('0x7')]=function(_0xba9f19,_0x11a0c1){return _0xba9f19[_0xb964('0x8')](_0xb964('0x9'),attributes,{'tableName':_0xb964('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x444e=['moment','request-promise','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','../../config/logger'];(function(_0x470b0a,_0x2889d6){var _0x4463f6=function(_0x2b5f0e){while(--_0x2b5f0e){_0x470b0a['push'](_0x470b0a['shift']());}};_0x4463f6(++_0x2889d6);}(_0x444e,0xe8));var _0xe444=function(_0xfac0f8,_0x2f8d2e){_0xfac0f8=_0xfac0f8-0x0;var _0x4703d3=_0x444e[_0xfac0f8];return _0x4703d3;};'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 010b3a4..2824456 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 _0xcbed=['catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result'];(function(_0x534bbd,_0x1e7685){var _0x3873c6=function(_0x36c5e7){while(--_0x36c5e7){_0x534bbd['push'](_0x534bbd['shift']());}};_0x3873c6(++_0x1e7685);}(_0xcbed,0x1a5));var _0xdcbe=function(_0x312eff,_0x501165){_0x312eff=_0x312eff-0x0;var _0x5182c0=_0xcbed[_0x312eff];return _0x5182c0;};'use strict';var _=require(_0xdcbe('0x0'));var util=require(_0xdcbe('0x1'));var moment=require('moment');var BPromise=require(_0xdcbe('0x2'));var rs=require(_0xdcbe('0x3'));var fs=require('fs');var Redis=require(_0xdcbe('0x4'));var db=require(_0xdcbe('0x5'))['db'];var utils=require(_0xdcbe('0x6'));var logger=require('../../config/logger')(_0xdcbe('0x7'));var config=require('../../config/environment');var jayson=require(_0xdcbe('0x8'));var client=jayson[_0xdcbe('0x9')][_0xdcbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19c950,_0x8bd768,_0x4696ac){return new BPromise(function(_0x211e12,_0x261c7e){return client['request'](_0x19c950,_0x4696ac)[_0xdcbe('0xb')](function(_0x46dbfd){logger['info'](_0xdcbe('0xc'),_0x8bd768,_0xdcbe('0xd'));logger[_0xdcbe('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x8bd768,_0xdcbe('0xd'),JSON['stringify'](_0x46dbfd));if(_0x46dbfd[_0xdcbe('0xf')]){if(_0x46dbfd['error'][_0xdcbe('0x10')]===0x1f4){logger[_0xdcbe('0xf')](_0xdcbe('0xc'),_0x8bd768,_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);return _0x261c7e(_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);}logger['error'](_0xdcbe('0xc'),_0x8bd768,_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);return _0x211e12(_0x46dbfd[_0xdcbe('0xf')][_0xdcbe('0x11')]);}else{logger[_0xdcbe('0x12')](_0xdcbe('0xc'),_0x8bd768,_0xdcbe('0xd'));_0x211e12(_0x46dbfd[_0xdcbe('0x13')][_0xdcbe('0x11')]);}})[_0xdcbe('0x14')](function(_0x3422f6){logger[_0xdcbe('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x8bd768,_0x3422f6);_0x261c7e(_0x3422f6);});});} \ No newline at end of file +var _0x2c30=['rpc','../../config/environment','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x104a6a,_0x12e2c9){var _0xf7e3c0=function(_0x5c75e1){while(--_0x5c75e1){_0x104a6a['push'](_0x104a6a['shift']());}};_0xf7e3c0(++_0x12e2c9);}(_0x2c30,0x12f));var _0x02c3=function(_0x3b3672,_0x36c56b){_0x3b3672=_0x3b3672-0x0;var _0x3eee38=_0x2c30[_0x3b3672];return _0x3eee38;};'use strict';var _=require(_0x02c3('0x0'));var util=require(_0x02c3('0x1'));var moment=require(_0x02c3('0x2'));var BPromise=require(_0x02c3('0x3'));var rs=require(_0x02c3('0x4'));var fs=require('fs');var Redis=require(_0x02c3('0x5'));var db=require(_0x02c3('0x6'))['db'];var utils=require(_0x02c3('0x7'));var logger=require(_0x02c3('0x8'))(_0x02c3('0x9'));var config=require(_0x02c3('0xa'));var jayson=require(_0x02c3('0xb'));var client=jayson['client'][_0x02c3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x8cb87e,_0x143d4c,_0x15318f){return new BPromise(function(_0xbf8909,_0x1a72ba){return client[_0x02c3('0xd')](_0x8cb87e,_0x15318f)[_0x02c3('0xe')](function(_0x1ce9bd){logger[_0x02c3('0xf')](_0x02c3('0x10'),_0x143d4c,_0x02c3('0x11'));logger[_0x02c3('0x12')](_0x02c3('0x13'),_0x143d4c,_0x02c3('0x11'),JSON[_0x02c3('0x14')](_0x1ce9bd));if(_0x1ce9bd[_0x02c3('0x15')]){if(_0x1ce9bd['error']['code']===0x1f4){logger[_0x02c3('0x15')](_0x02c3('0x10'),_0x143d4c,_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);return _0x1a72ba(_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);}logger['error'](_0x02c3('0x10'),_0x143d4c,_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);return _0xbf8909(_0x1ce9bd[_0x02c3('0x15')][_0x02c3('0x16')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x143d4c,_0x02c3('0x11'));_0xbf8909(_0x1ce9bd['result'][_0x02c3('0x16')]);}})[_0x02c3('0x17')](function(_0x4627cc){logger[_0x02c3('0x15')](_0x02c3('0x10'),_0x143d4c,_0x4627cc);_0x1a72ba(_0x4627cc);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 2019f06..f4db9bf 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 _0xdfd3=['exports','INTEGER','sequelize'];(function(_0x32d87b,_0x461f9e){var _0x4a2de7=function(_0x4f9a99){while(--_0x4f9a99){_0x32d87b['push'](_0x32d87b['shift']());}};_0x4a2de7(++_0x461f9e);}(_0xdfd3,0x17f));var _0x3dfd=function(_0x1eb5da,_0x1974ec){_0x1eb5da=_0x1eb5da-0x0;var _0x579a2f=_0xdfd3[_0x1eb5da];return _0x579a2f;};'use strict';var Sequelize=require(_0x3dfd('0x0'));module[_0x3dfd('0x1')]={'UserId':{'type':Sequelize[_0x3dfd('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x3dfd('0x2')]}}; \ No newline at end of file +var _0x58aa=['sequelize'];(function(_0x587d73,_0x3566bf){var _0x3aaf5b=function(_0x45b214){while(--_0x45b214){_0x587d73['push'](_0x587d73['shift']());}};_0x3aaf5b(++_0x3566bf);}(_0x58aa,0x17e));var _0xa58a=function(_0x1d1ca6,_0x4d94fc){_0x1d1ca6=_0x1d1ca6-0x0;var _0x3c0755=_0x58aa[_0x1d1ca6];return _0x3c0755;};'use strict';var Sequelize=require(_0xa58a('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 0aacd41..bcc6c99 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(_0x2e42c8,_0x2a8fc1){var _0x200fdc=function(_0x4b09db){while(--_0x4b09db){_0x2e42c8['push'](_0x2e42c8['shift']());}};_0x200fdc(++_0x2a8fc1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x43027b,_0x364b6b){var _0x2aba3b=function(_0x31b737){while(--_0x31b737){_0x43027b['push'](_0x43027b['shift']());}};_0x2aba3b(++_0x364b6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xa9e0[_0x110c3d];return _0x226d67;};'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 b200740..9ca21a2 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(_0x34f255,_0x12fef3){var _0x5cb7a2=function(_0x29105d){while(--_0x29105d){_0x34f255['push'](_0x34f255['shift']());}};_0x5cb7a2(++_0x12fef3);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xcb91[_0x53abe5];return _0xc1c37e;};'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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e4d99,_0x2ef5e9){var _0x1d9c27=function(_0x4cff85){while(--_0x4cff85){_0x5e4d99['push'](_0x5e4d99['shift']());}};_0x1d9c27(++_0x2ef5e9);}(_0x70e0,0x17b));var _0x070e=function(_0x4c1928,_0x40e0a0){_0x4c1928=_0x4c1928-0x0;var _0x227eb4=_0x70e0[_0x4c1928];return _0x227eb4;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 72f6245..67615ee 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 _0x1d13=['INTEGER','exports'];(function(_0x4cec96,_0xb2cc2f){var _0x48ffff=function(_0xf66217){while(--_0xf66217){_0x4cec96['push'](_0x4cec96['shift']());}};_0x48ffff(++_0xb2cc2f);}(_0x1d13,0x1d5));var _0x31d1=function(_0x3b8073,_0x33f9b7){_0x3b8073=_0x3b8073-0x0;var _0x3490be=_0x1d13[_0x3b8073];return _0x3490be;};'use strict';var Sequelize=require('sequelize');module[_0x31d1('0x0')]={'penalty':{'type':Sequelize[_0x31d1('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe10c=['sequelize','exports'];(function(_0x389832,_0x10a4a9){var _0x59429e=function(_0x5f3562){while(--_0x5f3562){_0x389832['push'](_0x389832['shift']());}};_0x59429e(++_0x10a4a9);}(_0xe10c,0x1f0));var _0xce10=function(_0x4aa474,_0x4885e3){_0x4aa474=_0x4aa474-0x0;var _0xd8af71=_0xe10c[_0x4aa474];return _0xd8af71;};'use strict';var Sequelize=require(_0xce10('0x0'));module[_0xce10('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index d3e60ca..566408c 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 _0x1b56=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','path','./userVoiceQueue.attributes','exports','define'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0x1b56,0x7a));var _0x61b5=function(_0x393d69,_0x3a8c83){_0x393d69=_0x393d69-0x0;var _0x3cee37=_0x1b56[_0x393d69];return _0x3cee37;};'use strict';var _=require(_0x61b5('0x0'));var util=require(_0x61b5('0x1'));var logger=require(_0x61b5('0x2'))(_0x61b5('0x3'));var moment=require(_0x61b5('0x4'));var BPromise=require(_0x61b5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61b5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x61b5('0x7'));module[_0x61b5('0x8')]=function(_0x253d8c,_0x35a1ba){return _0x253d8c[_0x61b5('0x9')]('UserVoiceQueue',attributes,{'tableName':_0x61b5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbc1b=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x34aec4,_0x3801da){var _0x51e1a7=function(_0x24e87f){while(--_0x24e87f){_0x34aec4['push'](_0x34aec4['shift']());}};_0x51e1a7(++_0x3801da);}(_0xbc1b,0xb6));var _0xbbc1=function(_0x18f64a,_0x1c8248){_0x18f64a=_0x18f64a-0x0;var _0x44687f=_0xbc1b[_0x18f64a];return _0x44687f;};'use strict';var _=require(_0xbbc1('0x0'));var util=require(_0xbbc1('0x1'));var logger=require(_0xbbc1('0x2'))(_0xbbc1('0x3'));var moment=require('moment');var BPromise=require(_0xbbc1('0x4'));var rp=require(_0xbbc1('0x5'));var fs=require('fs');var path=require(_0xbbc1('0x6'));var rimraf=require(_0xbbc1('0x7'));var config=require(_0xbbc1('0x8'));var attributes=require(_0xbbc1('0x9'));module[_0xbbc1('0xa')]=function(_0x45ab76,_0x3c39ab){return _0x45ab76[_0xbbc1('0xb')](_0xbbc1('0xc'),attributes,{'tableName':_0xbbc1('0xd'),'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 6595213..f3b7e54 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 _0xf629=['UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x449957,_0x430ace){var _0x3fecd5=function(_0x5988c5){while(--_0x5988c5){_0x449957['push'](_0x449957['shift']());}};_0x3fecd5(++_0x430ace);}(_0xf629,0xf4));var _0x9f62=function(_0x448163,_0x54930d){_0x448163=_0x448163-0x0;var _0x2dcb26=_0xf629[_0x448163];return _0x2dcb26;};'use strict';var _=require(_0x9f62('0x0'));var util=require(_0x9f62('0x1'));var moment=require(_0x9f62('0x2'));var BPromise=require(_0x9f62('0x3'));var rs=require(_0x9f62('0x4'));var fs=require('fs');var Redis=require(_0x9f62('0x5'));var db=require(_0x9f62('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9f62('0x7'))(_0x9f62('0x8'));var config=require(_0x9f62('0x9'));var jayson=require(_0x9f62('0xa'));var client=jayson[_0x9f62('0xb')][_0x9f62('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xa9e1f5,_0x4def39,_0x5029ba){return new BPromise(function(_0x54f599,_0x48a5b1){return client[_0x9f62('0xd')](_0xa9e1f5,_0x5029ba)[_0x9f62('0xe')](function(_0x26d31f){logger[_0x9f62('0xf')](_0x9f62('0x10'),_0x4def39,'request\x20sent');logger[_0x9f62('0x11')](_0x9f62('0x12'),_0x4def39,'request\x20sent',JSON[_0x9f62('0x13')](_0x26d31f));if(_0x26d31f[_0x9f62('0x14')]){if(_0x26d31f['error'][_0x9f62('0x15')]===0x1f4){logger[_0x9f62('0x14')](_0x9f62('0x10'),_0x4def39,_0x26d31f[_0x9f62('0x14')][_0x9f62('0x16')]);return _0x48a5b1(_0x26d31f[_0x9f62('0x14')][_0x9f62('0x16')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x4def39,_0x26d31f['error'][_0x9f62('0x16')]);return _0x54f599(_0x26d31f[_0x9f62('0x14')][_0x9f62('0x16')]);}else{logger[_0x9f62('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x4def39,_0x9f62('0x17'));_0x54f599(_0x26d31f[_0x9f62('0x18')][_0x9f62('0x16')]);}})[_0x9f62('0x19')](function(_0x1b4320){logger[_0x9f62('0x14')](_0x9f62('0x10'),_0x4def39,_0x1b4320);_0x48a5b1(_0x1b4320);});});} \ No newline at end of file +var _0xb21a=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','UserVoiceQueue,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x4ffb89,_0x17f6ee){var _0x433ad9=function(_0x18d01f){while(--_0x18d01f){_0x4ffb89['push'](_0x4ffb89['shift']());}};_0x433ad9(++_0x17f6ee);}(_0xb21a,0xed));var _0xab21=function(_0x39461d,_0x24b3f7){_0x39461d=_0x39461d-0x0;var _0x5976f8=_0xb21a[_0x39461d];return _0x5976f8;};'use strict';var _=require(_0xab21('0x0'));var util=require(_0xab21('0x1'));var moment=require(_0xab21('0x2'));var BPromise=require(_0xab21('0x3'));var rs=require(_0xab21('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xab21('0x6'))(_0xab21('0x7'));var config=require('../../config/environment');var jayson=require(_0xab21('0x8'));var client=jayson[_0xab21('0x9')][_0xab21('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x596030,_0x589f0d,_0x3d7208){return new BPromise(function(_0x396e79,_0x23606d){return client[_0xab21('0xb')](_0x596030,_0x3d7208)[_0xab21('0xc')](function(_0x85e31){logger[_0xab21('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x589f0d,_0xab21('0xe'));logger[_0xab21('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x589f0d,_0xab21('0xe'),JSON[_0xab21('0x10')](_0x85e31));if(_0x85e31['error']){if(_0x85e31[_0xab21('0x11')][_0xab21('0x12')]===0x1f4){logger[_0xab21('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x589f0d,_0x85e31['error'][_0xab21('0x13')]);return _0x23606d(_0x85e31[_0xab21('0x11')][_0xab21('0x13')]);}logger['error'](_0xab21('0x14'),_0x589f0d,_0x85e31[_0xab21('0x11')][_0xab21('0x13')]);return _0x396e79(_0x85e31[_0xab21('0x11')]['message']);}else{logger[_0xab21('0xd')](_0xab21('0x14'),_0x589f0d,_0xab21('0xe'));_0x396e79(_0x85e31['result']['message']);}})[_0xab21('0x15')](function(_0x4aa39c){logger[_0xab21('0x11')](_0xab21('0x14'),_0x589f0d,_0x4aa39c);_0x23606d(_0x4aa39c);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 43df749..f8fda90 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4ae9e8,_0x2fcf6e){var _0x267052=function(_0x2100da){while(--_0x2100da){_0x4ae9e8['push'](_0x4ae9e8['shift']());}};_0x267052(++_0x2fcf6e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x245afe,_0x319cde){_0x245afe=_0x245afe-0x0;var _0x4eefde=_0xcb91[_0x245afe];return _0x4eefde;};'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(_0x39384e,_0x2dfc4e){var _0x484390=function(_0x1db602){while(--_0x1db602){_0x39384e['push'](_0x39384e['shift']());}};_0x484390(++_0x2dfc4e);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x42e4d7,_0x4bd202){_0x42e4d7=_0x42e4d7-0x0;var _0x346cd8=_0xcb91[_0x42e4d7];return _0x346cd8;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 8bf488f..ed5c118 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 _0x4b5f=['STRING','Required\x20by\x20Asterisk','queue_interface','sequelize','exports','INTEGER'];(function(_0xfcd650,_0x2126f6){var _0x30cf33=function(_0x21581b){while(--_0x21581b){_0xfcd650['push'](_0xfcd650['shift']());}};_0x30cf33(++_0x2126f6);}(_0x4b5f,0x81));var _0xf4b5=function(_0x16bfae,_0x36ed25){_0x16bfae=_0x16bfae-0x0;var _0x3870f5=_0x4b5f[_0x16bfae];return _0x3870f5;};'use strict';var Sequelize=require(_0xf4b5('0x0'));module[_0xf4b5('0x1')]={'uniqueid':{'type':Sequelize[_0xf4b5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'comment':_0xf4b5('0x4')},'UserId':{'type':Sequelize[_0xf4b5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'unique':_0xf4b5('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xf4b5('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xf4b5('0x3')],'allowNull':![],'unique':_0xf4b5('0x5'),'comment':_0xf4b5('0x4')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0xf4b5('0x4')},'paused':{'type':Sequelize[_0xf4b5('0x2')](0xb),'defaultValue':0x0,'comment':_0xf4b5('0x4')}}; \ No newline at end of file +var _0x169c=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x567ea1,_0x3cb026){var _0x20964d=function(_0x2a7102){while(--_0x2a7102){_0x567ea1['push'](_0x567ea1['shift']());}};_0x20964d(++_0x3cb026);}(_0x169c,0xe3));var _0xc169=function(_0x2678d6,_0x4e2001){_0x2678d6=_0x2678d6-0x0;var _0x475503=_0x169c[_0x2678d6];return _0x475503;};'use strict';var Sequelize=require(_0xc169('0x0'));module[_0xc169('0x1')]={'uniqueid':{'type':Sequelize[_0xc169('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xc169('0x3')},'membername':{'type':Sequelize[_0xc169('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xc169('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc169('0x5'),'comment':_0xc169('0x3')},'VoiceQueueId':{'type':Sequelize[_0xc169('0x2')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc169('0x5'),'comment':_0xc169('0x3')},'penalty':{'type':Sequelize[_0xc169('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xc169('0x2')](0xb),'defaultValue':0x0,'comment':_0xc169('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 66599b2..0730335 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 _0x92ca=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save'];(function(_0x56392b,_0x2a70ea){var _0x1a14dc=function(_0x19ff0d){while(--_0x19ff0d){_0x56392b['push'](_0x56392b['shift']());}};_0x1a14dc(++_0x2a70ea);}(_0x92ca,0x92));var _0xa92c=function(_0x163157,_0x59eea5){_0x163157=_0x163157-0x0;var _0x3db535=_0x92ca[_0x163157];return _0x3db535;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xa92c('0x0'))['db'][_0xa92c('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xa92c('0x2')](0x0);var events={'afterCreate':_0xa92c('0x3'),'afterUpdate':_0xa92c('0x4'),'afterDestroy':_0xa92c('0x5')};function emitEvent(_0x175e79){return function(_0xd20bab,_0x33a7c7,_0x4d90c0){UserVoiceQueueRtEvents[_0xa92c('0x6')](_0x175e79+':'+_0xd20bab['id'],_0xd20bab);UserVoiceQueueRtEvents[_0xa92c('0x6')](_0x175e79,_0xd20bab);_0x4d90c0(null);};}for(var e in events){if(events[_0xa92c('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0xa92c('0x8')](e,emitEvent(event));}}module[_0xa92c('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x0c41=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x5053ac,_0x792c41){var _0x23112e=function(_0x3dda9c){while(--_0x3dda9c){_0x5053ac['push'](_0x5053ac['shift']());}};_0x23112e(++_0x792c41);}(_0x0c41,0xbf));var _0x10c4=function(_0x33349d,_0x657447){_0x33349d=_0x33349d-0x0;var _0x1dfd22=_0x0c41[_0x33349d];return _0x1dfd22;};'use strict';var EventEmitter=require(_0x10c4('0x0'));var UserVoiceQueueRt=require(_0x10c4('0x1'))['db']['UserVoiceQueueRt'];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x10c4('0x2')](0x0);var events={'afterCreate':_0x10c4('0x3'),'afterUpdate':_0x10c4('0x4'),'afterDestroy':_0x10c4('0x5')};function emitEvent(_0xe2ff8d){return function(_0x13a34b,_0x25c990,_0x318e3e){UserVoiceQueueRtEvents['emit'](_0xe2ff8d+':'+_0x13a34b['id'],_0x13a34b);UserVoiceQueueRtEvents[_0x10c4('0x6')](_0xe2ff8d,_0x13a34b);_0x318e3e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x10c4('0x7')](e,emitEvent(event));}}module[_0x10c4('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 6f2f080..46f3bc5 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 _0x4160=['lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x54181a,_0x22d7c5){var _0x4bce5d=function(_0x35755d){while(--_0x35755d){_0x54181a['push'](_0x54181a['shift']());}};_0x4bce5d(++_0x22d7c5);}(_0x4160,0xe4));var _0x0416=function(_0x51ad8d,_0x39a2c1){_0x51ad8d=_0x51ad8d-0x0;var _0x543b3a=_0x4160[_0x51ad8d];return _0x543b3a;};'use strict';var _=require(_0x0416('0x0'));var util=require(_0x0416('0x1'));var logger=require(_0x0416('0x2'))(_0x0416('0x3'));var moment=require(_0x0416('0x4'));var BPromise=require(_0x0416('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0416('0x6'));var rimraf=require('rimraf');var config=require(_0x0416('0x7'));var attributes=require(_0x0416('0x8'));module[_0x0416('0x9')]=function(_0x54cac3,_0x6e46fc){return _0x54cac3['define'](_0x0416('0xa'),attributes,{'tableName':_0x0416('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x833c=['define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x833c,0x1e3));var _0xc833=function(_0x321ce5,_0x44ae68){_0x321ce5=_0x321ce5-0x0;var _0x20e647=_0x833c[_0x321ce5];return _0x20e647;};'use strict';var _=require(_0xc833('0x0'));var util=require(_0xc833('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc833('0x2'));var rimraf=require(_0xc833('0x3'));var config=require(_0xc833('0x4'));var attributes=require(_0xc833('0x5'));module[_0xc833('0x6')]=function(_0x350979,_0x42b932){return _0x350979[_0xc833('0x7')](_0xc833('0x8'),attributes,{'tableName':_0xc833('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 46051e8..ed5032f 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 _0x2e56=['where','sequelize','literal','outboundQueuePauses','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./userVoiceQueueRt.socket','register','request','info','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','options','raw'];(function(_0x29e205,_0x4e527f){var _0x59a933=function(_0x1be21a){while(--_0x1be21a){_0x29e205['push'](_0x29e205['shift']());}};_0x59a933(++_0x4e527f);}(_0x2e56,0xb4));var _0x62e5=function(_0x5c2c72,_0x22cf09){_0x5c2c72=_0x5c2c72-0x0;var _0x11c44c=_0x2e56[_0x5c2c72];return _0x11c44c;};'use strict';var _=require(_0x62e5('0x0'));var util=require(_0x62e5('0x1'));var moment=require(_0x62e5('0x2'));var BPromise=require(_0x62e5('0x3'));var rs=require(_0x62e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x62e5('0x5'))['db'];var utils=require(_0x62e5('0x6'));var logger=require('../../config/logger')(_0x62e5('0x7'));var config=require(_0x62e5('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x62e5('0x9')]['http']({'port':0x232a});config['redis']=_[_0x62e5('0xa')](config['redis'],{'host':_0x62e5('0xb'),'port':0x18eb});var socket=require(_0x62e5('0xc'))(new Redis(config[_0x62e5('0xd')]));require(_0x62e5('0xe'))[_0x62e5('0xf')](socket);function respondWithRpcPromise(_0x593a12,_0x446926,_0x4c89d3){return new BPromise(function(_0x33743b,_0x330e9f){return client[_0x62e5('0x10')](_0x593a12,_0x4c89d3)['then'](function(_0x52ce1d){logger[_0x62e5('0x11')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x446926,'request\x20sent');logger[_0x62e5('0x12')](_0x62e5('0x13'),_0x446926,_0x62e5('0x14'),JSON['stringify'](_0x52ce1d));if(_0x52ce1d[_0x62e5('0x15')]){if(_0x52ce1d[_0x62e5('0x15')][_0x62e5('0x16')]===0x1f4){logger['error'](_0x62e5('0x17'),_0x446926,_0x52ce1d[_0x62e5('0x15')]['message']);return _0x330e9f(_0x52ce1d[_0x62e5('0x15')][_0x62e5('0x18')]);}logger[_0x62e5('0x15')](_0x62e5('0x17'),_0x446926,_0x52ce1d['error']['message']);return _0x33743b(_0x52ce1d[_0x62e5('0x15')][_0x62e5('0x18')]);}else{logger[_0x62e5('0x11')](_0x62e5('0x17'),_0x446926,'request\x20sent');_0x33743b(_0x52ce1d['result'][_0x62e5('0x18')]);}})[_0x62e5('0x19')](function(_0x19b587){logger[_0x62e5('0x15')](_0x62e5('0x17'),_0x446926,_0x19b587);_0x330e9f(_0x19b587);});});}exports[_0x62e5('0x1a')]=function(_0x44c5bf){var _0x5eddb7=this;return new Promise(function(_0x5fc1fa,_0x446914){return db[_0x62e5('0x1b')]['findAll']({'raw':_0x44c5bf['options']?_0x44c5bf[_0x62e5('0x1c')][_0x62e5('0x1d')]===undefined?!![]:![]:!![],'where':_0x44c5bf[_0x62e5('0x1c')]?_0x44c5bf[_0x62e5('0x1c')][_0x62e5('0x1e')]||null:null,'attributes':[[db[_0x62e5('0x1f')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x62e5('0x1f')][_0x62e5('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x62e5('0x21')]]})['then'](function(_0x22b8d7){logger[_0x62e5('0x11')]('GetVoiceQueueRtPauses',_0x44c5bf);logger[_0x62e5('0x12')](_0x62e5('0x1a'),_0x44c5bf,JSON[_0x62e5('0x22')](_0x22b8d7));_0x5fc1fa(_0x22b8d7);})[_0x62e5('0x19')](function(_0x123cc6){logger[_0x62e5('0x15')](_0x62e5('0x1a'),_0x123cc6[_0x62e5('0x18')],_0x44c5bf);_0x446914(_0x5eddb7[_0x62e5('0x15')](0x1f4,_0x123cc6[_0x62e5('0x18')]));});});}; \ No newline at end of file +var _0xad80=['findAll','options','raw','where','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x4c9ca9,_0x39df16){var _0x204104=function(_0x4dd761){while(--_0x4dd761){_0x4c9ca9['push'](_0x4c9ca9['shift']());}};_0x204104(++_0x39df16);}(_0xad80,0x1eb));var _0x0ad8=function(_0x24c0db,_0x25e2ce){_0x24c0db=_0x24c0db-0x0;var _0x1441bf=_0xad80[_0x24c0db];return _0x1441bf;};'use strict';var _=require(_0x0ad8('0x0'));var util=require(_0x0ad8('0x1'));var moment=require(_0x0ad8('0x2'));var BPromise=require(_0x0ad8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ad8('0x4'));var db=require(_0x0ad8('0x5'))['db'];var utils=require(_0x0ad8('0x6'));var logger=require(_0x0ad8('0x7'))(_0x0ad8('0x8'));var config=require(_0x0ad8('0x9'));var jayson=require(_0x0ad8('0xa'));var client=jayson[_0x0ad8('0xb')][_0x0ad8('0xc')]({'port':0x232a});config[_0x0ad8('0xd')]=_[_0x0ad8('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0ad8('0xf'))(new Redis(config[_0x0ad8('0xd')]));require('./userVoiceQueueRt.socket')[_0x0ad8('0x10')](socket);function respondWithRpcPromise(_0x425a89,_0x1ce99e,_0x501854){return new BPromise(function(_0x2e00d2,_0x3016ec){return client[_0x0ad8('0x11')](_0x425a89,_0x501854)['then'](function(_0x409412){logger[_0x0ad8('0x12')](_0x0ad8('0x13'),_0x1ce99e,_0x0ad8('0x14'));logger['debug'](_0x0ad8('0x15'),_0x1ce99e,_0x0ad8('0x14'),JSON[_0x0ad8('0x16')](_0x409412));if(_0x409412['error']){if(_0x409412[_0x0ad8('0x17')][_0x0ad8('0x18')]===0x1f4){logger[_0x0ad8('0x17')](_0x0ad8('0x13'),_0x1ce99e,_0x409412[_0x0ad8('0x17')]['message']);return _0x3016ec(_0x409412[_0x0ad8('0x17')][_0x0ad8('0x19')]);}logger[_0x0ad8('0x17')](_0x0ad8('0x13'),_0x1ce99e,_0x409412[_0x0ad8('0x17')][_0x0ad8('0x19')]);return _0x2e00d2(_0x409412[_0x0ad8('0x17')][_0x0ad8('0x19')]);}else{logger[_0x0ad8('0x12')](_0x0ad8('0x13'),_0x1ce99e,_0x0ad8('0x14'));_0x2e00d2(_0x409412[_0x0ad8('0x1a')][_0x0ad8('0x19')]);}})[_0x0ad8('0x1b')](function(_0x2c58d4){logger[_0x0ad8('0x17')](_0x0ad8('0x13'),_0x1ce99e,_0x2c58d4);_0x3016ec(_0x2c58d4);});});}exports[_0x0ad8('0x1c')]=function(_0x44a8cd){var _0x5eb370=this;return new Promise(function(_0x29d68b,_0x273c60){return db['UserVoiceQueueRt'][_0x0ad8('0x1d')]({'raw':_0x44a8cd[_0x0ad8('0x1e')]?_0x44a8cd[_0x0ad8('0x1e')][_0x0ad8('0x1f')]===undefined?!![]:![]:!![],'where':_0x44a8cd['options']?_0x44a8cd[_0x0ad8('0x1e')][_0x0ad8('0x20')]||null:null,'attributes':[[db['sequelize']['fn'](_0x0ad8('0x21'),db[_0x0ad8('0x22')]['fn']('IF',db[_0x0ad8('0x22')][_0x0ad8('0x23')](_0x0ad8('0x24')))),_0x0ad8('0x25')]]})[_0x0ad8('0x26')](function(_0x48959c){logger[_0x0ad8('0x12')]('GetVoiceQueueRtPauses',_0x44a8cd);logger[_0x0ad8('0x27')]('GetVoiceQueueRtPauses',_0x44a8cd,JSON[_0x0ad8('0x16')](_0x48959c));_0x29d68b(_0x48959c);})[_0x0ad8('0x1b')](function(_0x31b542){logger['error'](_0x0ad8('0x1c'),_0x31b542[_0x0ad8('0x19')],_0x44a8cd);_0x273c60(_0x5eb370[_0x0ad8('0x17')](0x1f4,_0x31b542[_0x0ad8('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8a18500..5e40a85 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 _0xfd87=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','length','userVoiceQueueRt:'];(function(_0x4d1ee9,_0x394a78){var _0x9a5456=function(_0x224f3b){while(--_0x224f3b){_0x4d1ee9['push'](_0x4d1ee9['shift']());}};_0x9a5456(++_0x394a78);}(_0xfd87,0x80));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var UserVoiceQueueRtEvents=require(_0x7fd8('0x0'));var events=[_0x7fd8('0x1'),_0x7fd8('0x2'),_0x7fd8('0x3')];function createListener(_0x11b128,_0x15d25f){return function(_0x2631d9){_0x15d25f[_0x7fd8('0x4')](_0x11b128,_0x2631d9);};}function removeListener(_0x4429f2,_0x43b442){return function(){UserVoiceQueueRtEvents[_0x7fd8('0x5')](_0x4429f2,_0x43b442);};}exports['register']=function(_0x1395b6){for(var _0x10a778=0x0,_0x55681d=events[_0x7fd8('0x6')];_0x10a778<_0x55681d;_0x10a778++){var _0x6eaf96=events[_0x10a778];var _0x2e2d74=createListener(_0x7fd8('0x7')+_0x6eaf96,_0x1395b6);UserVoiceQueueRtEvents['on'](_0x6eaf96,_0x2e2d74);}}; \ No newline at end of file +var _0xf483=['length','userVoiceQueueRt:','save','update','emit'];(function(_0x6d512f,_0x23a59a){var _0x130df8=function(_0x22ce27){while(--_0x22ce27){_0x6d512f['push'](_0x6d512f['shift']());}};_0x130df8(++_0x23a59a);}(_0xf483,0xf2));var _0x3f48=function(_0x313be9,_0x1de21d){_0x313be9=_0x313be9-0x0;var _0x2ebcd2=_0xf483[_0x313be9];return _0x2ebcd2;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x3f48('0x0'),'remove',_0x3f48('0x1')];function createListener(_0x1a8c22,_0x2f4d00){return function(_0x413bf0){_0x2f4d00[_0x3f48('0x2')](_0x1a8c22,_0x413bf0);};}function removeListener(_0x312d9c,_0x5deb61){return function(){UserVoiceQueueRtEvents['removeListener'](_0x312d9c,_0x5deb61);};}exports['register']=function(_0x1a3447){for(var _0x16905e=0x0,_0x524a4f=events[_0x3f48('0x3')];_0x16905e<_0x524a4f;_0x16905e++){var _0x2f1ca5=events[_0x16905e];var _0x1746fd=createListener(_0x3f48('0x4')+_0x2f1ca5,_0x1a3447);UserVoiceQueueRtEvents['on'](_0x2f1ca5,_0x1746fd);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 37e6974..3d35998 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(_0x273f77,_0xe5b0cb){var _0x71e147=function(_0x564056){while(--_0x564056){_0x273f77['push'](_0x273f77['shift']());}};_0x71e147(++_0xe5b0cb);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2891f5,_0x2c38dc){var _0xe2c890=function(_0x58074c){while(--_0x58074c){_0x2891f5['push'](_0x2891f5['shift']());}};_0xe2c890(++_0x2c38dc);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 65e8be4..9384977 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 _0x4371=['sequelize','exports'];(function(_0x159706,_0x57132e){var _0x1ed0a9=function(_0x588cd1){while(--_0x588cd1){_0x159706['push'](_0x159706['shift']());}};_0x1ed0a9(++_0x57132e);}(_0x4371,0x8a));var _0x1437=function(_0x4faa06,_0x2cd369){_0x4faa06=_0x4faa06-0x0;var _0x5b808a=_0x4371[_0x4faa06];return _0x5b808a;};'use strict';var Sequelize=require(_0x1437('0x0'));module[_0x1437('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x345d=['INTEGER','sequelize'];(function(_0x802939,_0x4c49bc){var _0x269d03=function(_0xe41661){while(--_0xe41661){_0x802939['push'](_0x802939['shift']());}};_0x269d03(++_0x4c49bc);}(_0x345d,0x16f));var _0xd345=function(_0x230fd5,_0x4ae28c){_0x230fd5=_0x230fd5-0x0;var _0x3e2017=_0x345d[_0x230fd5];return _0x3e2017;};'use strict';var Sequelize=require(_0xd345('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xd345('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 8b49341..3fe8c5b 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 _0x56c1=['request-promise','rimraf','../../config/environment','exports','UserWhatsappQueue','user_has_whatsapp_queues','lodash','../../config/logger','api','moment','bluebird'];(function(_0x475aa9,_0x439aab){var _0x360bbc=function(_0x331a22){while(--_0x331a22){_0x475aa9['push'](_0x475aa9['shift']());}};_0x360bbc(++_0x439aab);}(_0x56c1,0x1ea));var _0x156c=function(_0x11ee3c,_0x51803c){_0x11ee3c=_0x11ee3c-0x0;var _0x10488e=_0x56c1[_0x11ee3c];return _0x10488e;};'use strict';var _=require(_0x156c('0x0'));var util=require('util');var logger=require(_0x156c('0x1'))(_0x156c('0x2'));var moment=require(_0x156c('0x3'));var BPromise=require(_0x156c('0x4'));var rp=require(_0x156c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x156c('0x6'));var config=require(_0x156c('0x7'));var attributes=require('./userWhatsappQueue.attributes');module[_0x156c('0x8')]=function(_0x235546,_0x52fa7a){return _0x235546['define'](_0x156c('0x9'),attributes,{'tableName':_0x156c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x018a=['../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2e5d57,_0x45a777){var _0x584d7c=function(_0x1ff0b6){while(--_0x1ff0b6){_0x2e5d57['push'](_0x2e5d57['shift']());}};_0x584d7c(++_0x45a777);}(_0x018a,0xbb));var _0xa018=function(_0x18b73e,_0x39b3f2){_0x18b73e=_0x18b73e-0x0;var _0x25fa91=_0x018a[_0x18b73e];return _0x25fa91;};'use strict';var _=require(_0xa018('0x0'));var util=require(_0xa018('0x1'));var logger=require('../../config/logger')(_0xa018('0x2'));var moment=require(_0xa018('0x3'));var BPromise=require(_0xa018('0x4'));var rp=require(_0xa018('0x5'));var fs=require('fs');var path=require(_0xa018('0x6'));var rimraf=require(_0xa018('0x7'));var config=require(_0xa018('0x8'));var attributes=require(_0xa018('0x9'));module[_0xa018('0xa')]=function(_0x5d666e,_0x21c29f){return _0x5d666e[_0xa018('0xb')]('UserWhatsappQueue',attributes,{'tableName':_0xa018('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 c6bbee5..5f23b25 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 _0x6b55=['result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x14f5ed,_0x3fd34d){var _0x49f682=function(_0x42f660){while(--_0x42f660){_0x14f5ed['push'](_0x14f5ed['shift']());}};_0x49f682(++_0x3fd34d);}(_0x6b55,0xb6));var _0x56b5=function(_0x4e690c,_0x5cac7d){_0x4e690c=_0x4e690c-0x0;var _0x16779e=_0x6b55[_0x4e690c];return _0x16779e;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x56b5('0x0'));var BPromise=require(_0x56b5('0x1'));var rs=require(_0x56b5('0x2'));var fs=require('fs');var Redis=require(_0x56b5('0x3'));var db=require(_0x56b5('0x4'))['db'];var utils=require(_0x56b5('0x5'));var logger=require('../../config/logger')(_0x56b5('0x6'));var config=require(_0x56b5('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x56b5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a4389,_0x4b9f38,_0x12f1e9){return new BPromise(function(_0x3754f7,_0x42e588){return client['request'](_0x4a4389,_0x12f1e9)['then'](function(_0x3756c4){logger['info'](_0x56b5('0x9'),_0x4b9f38,_0x56b5('0xa'));logger[_0x56b5('0xb')](_0x56b5('0xc'),_0x4b9f38,_0x56b5('0xa'),JSON[_0x56b5('0xd')](_0x3756c4));if(_0x3756c4['error']){if(_0x3756c4[_0x56b5('0xe')][_0x56b5('0xf')]===0x1f4){logger[_0x56b5('0xe')]('UserWhatsappQueue,\x20%s,\x20%s',_0x4b9f38,_0x3756c4['error'][_0x56b5('0x10')]);return _0x42e588(_0x3756c4[_0x56b5('0xe')]['message']);}logger['error'](_0x56b5('0x9'),_0x4b9f38,_0x3756c4[_0x56b5('0xe')]['message']);return _0x3754f7(_0x3756c4['error']['message']);}else{logger[_0x56b5('0x11')](_0x56b5('0x9'),_0x4b9f38,'request\x20sent');_0x3754f7(_0x3756c4[_0x56b5('0x12')][_0x56b5('0x10')]);}})[_0x56b5('0x13')](function(_0x359fe0){logger[_0x56b5('0xe')](_0x56b5('0x9'),_0x4b9f38,_0x359fe0);_0x42e588(_0x359fe0);});});} \ No newline at end of file +var _0x1a4b=['debug','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x38797a,_0x3dade2){var _0x289ca6=function(_0x3d28d9){while(--_0x3d28d9){_0x38797a['push'](_0x38797a['shift']());}};_0x289ca6(++_0x3dade2);}(_0x1a4b,0x1d1));var _0xb1a4=function(_0x3ebbea,_0x1a5fe6){_0x3ebbea=_0x3ebbea-0x0;var _0x4102a5=_0x1a4b[_0x3ebbea];return _0x4102a5;};'use strict';var _=require(_0xb1a4('0x0'));var util=require(_0xb1a4('0x1'));var moment=require('moment');var BPromise=require(_0xb1a4('0x2'));var rs=require(_0xb1a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb1a4('0x4'))['db'];var utils=require(_0xb1a4('0x5'));var logger=require(_0xb1a4('0x6'))(_0xb1a4('0x7'));var config=require('../../config/environment');var jayson=require(_0xb1a4('0x8'));var client=jayson[_0xb1a4('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x25a2ee,_0x1540fd,_0x1dca32){return new BPromise(function(_0x5e73a4,_0x125e19){return client[_0xb1a4('0xa')](_0x25a2ee,_0x1dca32)[_0xb1a4('0xb')](function(_0x2395f5){logger[_0xb1a4('0xc')](_0xb1a4('0xd'),_0x1540fd,_0xb1a4('0xe'));logger[_0xb1a4('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x1540fd,_0xb1a4('0xe'),JSON['stringify'](_0x2395f5));if(_0x2395f5[_0xb1a4('0x10')]){if(_0x2395f5[_0xb1a4('0x10')][_0xb1a4('0x11')]===0x1f4){logger['error'](_0xb1a4('0xd'),_0x1540fd,_0x2395f5[_0xb1a4('0x10')]['message']);return _0x125e19(_0x2395f5[_0xb1a4('0x10')]['message']);}logger[_0xb1a4('0x10')](_0xb1a4('0xd'),_0x1540fd,_0x2395f5[_0xb1a4('0x10')][_0xb1a4('0x12')]);return _0x5e73a4(_0x2395f5[_0xb1a4('0x10')][_0xb1a4('0x12')]);}else{logger['info'](_0xb1a4('0xd'),_0x1540fd,_0xb1a4('0xe'));_0x5e73a4(_0x2395f5[_0xb1a4('0x13')][_0xb1a4('0x12')]);}})['catch'](function(_0x2a91ae){logger[_0xb1a4('0x10')](_0xb1a4('0xd'),_0x1540fd,_0x2a91ae);_0x125e19(_0x2a91ae);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 6e5d836..32708f2 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 _0x0eaa=['update','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','index','isAuthenticated','show','create','put','/:id'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0eaa,0x1c5));var _0xa0ea=function(_0x3ba689,_0x4d91cc){_0x3ba689=_0x3ba689-0x0;var _0x7d1610=_0x0eaa[_0x3ba689];return _0x7d1610;};'use strict';var multer=require(_0xa0ea('0x0'));var util=require(_0xa0ea('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xa0ea('0x2'));var router=express[_0xa0ea('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa0ea('0x4'));var interaction=require(_0xa0ea('0x5'));var config=require(_0xa0ea('0x6'));var controller=require(_0xa0ea('0x7'));router[_0xa0ea('0x8')]('/',auth['isAuthenticated'](),controller[_0xa0ea('0x9')]);router['get']('/:id',auth[_0xa0ea('0xa')](),controller[_0xa0ea('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa0ea('0xc')]);router[_0xa0ea('0xd')](_0xa0ea('0xe'),auth[_0xa0ea('0xa')](),controller[_0xa0ea('0xf')]);router['delete'](_0xa0ea('0xe'),auth[_0xa0ea('0xa')](),controller[_0xa0ea('0x10')]);module[_0xa0ea('0x11')]=router; \ No newline at end of file +var _0x79a8=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','create','update','multer'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x79a8,0x1d0));var _0x879a=function(_0x4ed7,_0x14f3ba){_0x4ed7=_0x4ed7-0x0;var _0x584b32=_0x79a8[_0x4ed7];return _0x584b32;};'use strict';var multer=require(_0x879a('0x0'));var util=require('util');var path=require(_0x879a('0x1'));var timeout=require(_0x879a('0x2'));var express=require(_0x879a('0x3'));var router=express['Router']();var fs_extra=require(_0x879a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x879a('0x5'));var config=require(_0x879a('0x6'));var controller=require(_0x879a('0x7'));router[_0x879a('0x8')]('/',auth[_0x879a('0x9')](),controller[_0x879a('0xa')]);router[_0x879a('0x8')](_0x879a('0xb'),auth['isAuthenticated'](),controller[_0x879a('0xc')]);router['post']('/',auth[_0x879a('0x9')](),controller[_0x879a('0xd')]);router['put'](_0x879a('0xb'),auth[_0x879a('0x9')](),controller[_0x879a('0xe')]);router['delete'](_0x879a('0xb'),auth[_0x879a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 710ebc4..cb3ee2d 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 _0x4764=['exports','STRING','name','sequelize'];(function(_0x406ba7,_0x26e941){var _0x5e4c79=function(_0x4c4f6a){while(--_0x4c4f6a){_0x406ba7['push'](_0x406ba7['shift']());}};_0x5e4c79(++_0x26e941);}(_0x4764,0x14f));var _0x4476=function(_0x697334,_0x4f4abd){_0x697334=_0x697334-0x0;var _0x53f900=_0x4764[_0x697334];return _0x53f900;};'use strict';var Sequelize=require(_0x4476('0x0'));module[_0x4476('0x1')]={'name':{'type':Sequelize[_0x4476('0x2')],'unique':_0x4476('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb079=['name','exports','STRING'];(function(_0x3bf97c,_0x4b2d2b){var _0x5c49bb=function(_0x49a20a){while(--_0x49a20a){_0x3bf97c['push'](_0x3bf97c['shift']());}};_0x5c49bb(++_0x4b2d2b);}(_0xb079,0x1c9));var _0x9b07=function(_0x117233,_0xb87fa){_0x117233=_0x117233-0x0;var _0x272e2f=_0xb079[_0x117233];return _0x272e2f;};'use strict';var Sequelize=require('sequelize');module[_0x9b07('0x0')]={'name':{'type':Sequelize[_0x9b07('0x1')],'unique':_0x9b07('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9b07('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index fdfad3e..8454ec0 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 _0x4589=['keys','include','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','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','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','Variables','UserProfileResource','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','Variable','findAll','rows','catch','show','params'];(function(_0x514038,_0x450ef3){var _0x589720=function(_0x1a356f){while(--_0x1a356f){_0x514038['push'](_0x514038['shift']());}};_0x589720(++_0x450ef3);}(_0x4589,0x16b));var _0x9458=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4589[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0x9458('0x0'));var rimraf=require(_0x9458('0x1'));var zipdir=require(_0x9458('0x2'));var jsonpatch=require(_0x9458('0x3'));var rp=require(_0x9458('0x4'));var moment=require(_0x9458('0x5'));var BPromise=require(_0x9458('0x6'));var Mustache=require(_0x9458('0x7'));var util=require('util');var path=require(_0x9458('0x8'));var sox=require(_0x9458('0x9'));var csv=require(_0x9458('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9458('0xb'));var squel=require(_0x9458('0xc'));var crypto=require(_0x9458('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9458('0xe'));var toCsv=require('to-csv');var querystring=require(_0x9458('0xf'));var Papa=require(_0x9458('0x10'));var Redis=require(_0x9458('0x11'));var authService=require(_0x9458('0x12'));var qs=require(_0x9458('0x13'));var as=require(_0x9458('0x14'));var hardwareService=require(_0x9458('0x15'));var logger=require(_0x9458('0x16'))(_0x9458('0x17'));var utils=require(_0x9458('0x18'));var config=require(_0x9458('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x9458('0x1a'))['db'];function respondWithStatusCode(_0xc6f4c9,_0xb54c20){_0xb54c20=_0xb54c20||0xcc;return function(_0x2a087c){if(_0x2a087c){return _0xc6f4c9[_0x9458('0x1b')](_0xb54c20);}return _0xc6f4c9[_0x9458('0x1c')](_0xb54c20)[_0x9458('0x1d')]();};}function respondWithResult(_0x4dc3dc,_0xe608ab){_0xe608ab=_0xe608ab||0xc8;return function(_0x52aeec){if(_0x52aeec){return _0x4dc3dc['status'](_0xe608ab)[_0x9458('0x1e')](_0x52aeec);}};}function respondWithFilteredResult(_0x5d5002,_0x441d0e){return function(_0xbd5cdd){if(_0xbd5cdd){var _0x496481=typeof _0x441d0e[_0x9458('0x1f')]==='undefined'&&typeof _0x441d0e['limit']==='undefined';var _0x849d12=_0xbd5cdd[_0x9458('0x20')];var _0x27706b=_0x496481?0x0:_0x441d0e[_0x9458('0x1f')];var _0x5c426b=_0x496481?_0xbd5cdd[_0x9458('0x20')]:_0x441d0e[_0x9458('0x1f')]+_0x441d0e[_0x9458('0x21')];var _0x4b507f;if(_0x5c426b>=_0x849d12){_0x5c426b=_0x849d12;_0x4b507f=0xc8;}else{_0x4b507f=0xce;}_0x5d5002['status'](_0x4b507f);return _0x5d5002[_0x9458('0x22')](_0x9458('0x23'),_0x27706b+'-'+_0x5c426b+'/'+_0x849d12)[_0x9458('0x1e')](_0xbd5cdd);}return null;};}function patchUpdates(_0x42049c){return function(_0x1e3bf0){try{jsonpatch[_0x9458('0x24')](_0x1e3bf0,_0x42049c,!![]);}catch(_0x4cd32b){return BPromise[_0x9458('0x25')](_0x4cd32b);}return _0x1e3bf0['save']();};}function saveUpdates(_0x105784,_0x52c426){return function(_0x39fecb){if(_0x39fecb){return _0x39fecb[_0x9458('0x26')](_0x105784)['then'](function(_0x46e686){return _0x46e686;});}return null;};}function removeEntity(_0x245d5c,_0x4ae3d5){return function(_0x1d175a){if(_0x1d175a){return _0x1d175a['destroy']()['then'](function(){var _0x4b56d3=_0x1d175a['get']({'plain':!![]});var _0x41dac8=_0x9458('0x27');return db[_0x9458('0x28')][_0x9458('0x29')]({'where':{'type':_0x41dac8,'resourceId':_0x4b56d3['id']}})['then'](function(){return _0x1d175a;});})[_0x9458('0x2a')](function(){_0x245d5c['status'](0xcc)[_0x9458('0x1d')]();});}};}function handleEntityNotFound(_0x38b8ff,_0x34bd26){return function(_0x51d666){if(!_0x51d666){_0x38b8ff['sendStatus'](0x194);}return _0x51d666;};}function handleError(_0x3670c3,_0x54b65a){_0x54b65a=_0x54b65a||0x1f4;return function(_0x36e4a6){logger[_0x9458('0x2b')](_0x36e4a6[_0x9458('0x2c')]);if(_0x36e4a6[_0x9458('0x2d')]){delete _0x36e4a6[_0x9458('0x2d')];}_0x3670c3['status'](_0x54b65a)[_0x9458('0x2e')](_0x36e4a6);};}exports[_0x9458('0x2f')]=function(_0x575f18,_0x91201b){var _0x5a12f5={},_0x287a7b={},_0x320051={'count':0x0,'rows':[]};var _0xefd7e3=_[_0x9458('0x30')](db['Variable'][_0x9458('0x31')],function(_0x1a183f){return{'name':_0x1a183f[_0x9458('0x32')],'type':_0x1a183f[_0x9458('0x33')][_0x9458('0x34')]};});_0x287a7b[_0x9458('0x35')]=_[_0x9458('0x30')](_0xefd7e3,_0x9458('0x2d'));_0x287a7b[_0x9458('0x36')]=_['keys'](_0x575f18[_0x9458('0x36')]);_0x287a7b[_0x9458('0x37')]=_['intersection'](_0x287a7b[_0x9458('0x35')],_0x287a7b['query']);_0x5a12f5[_0x9458('0x38')]=_[_0x9458('0x39')](_0x287a7b[_0x9458('0x35')],qs[_0x9458('0x3a')](_0x575f18[_0x9458('0x36')][_0x9458('0x3a')]));_0x5a12f5['attributes']=_0x5a12f5[_0x9458('0x38')][_0x9458('0x3b')]?_0x5a12f5[_0x9458('0x38')]:_0x287a7b[_0x9458('0x35')];if(!_0x575f18[_0x9458('0x36')][_0x9458('0x3c')](_0x9458('0x3d'))){_0x5a12f5[_0x9458('0x21')]=qs[_0x9458('0x21')](_0x575f18[_0x9458('0x36')][_0x9458('0x21')]);_0x5a12f5[_0x9458('0x1f')]=qs[_0x9458('0x1f')](_0x575f18[_0x9458('0x36')]['offset']);}_0x5a12f5[_0x9458('0x3e')]=qs[_0x9458('0x3f')](_0x575f18[_0x9458('0x36')]['sort']);_0x5a12f5['where']=qs[_0x9458('0x37')](_[_0x9458('0x40')](_0x575f18[_0x9458('0x36')],_0x287a7b[_0x9458('0x37')]),_0xefd7e3);if(_0x575f18['query'][_0x9458('0x41')]){_0x5a12f5[_0x9458('0x42')]=_[_0x9458('0x43')](_0x5a12f5[_0x9458('0x42')],{'$or':_[_0x9458('0x30')](_0xefd7e3,function(_0x5f1b7a){if(_0x5f1b7a[_0x9458('0x33')]!==_0x9458('0x44')){var _0x5d48e0={};_0x5d48e0[_0x5f1b7a['name']]={'$like':'%'+_0x575f18[_0x9458('0x36')][_0x9458('0x41')]+'%'};return _0x5d48e0;}})});}_0x5a12f5=_[_0x9458('0x43')]({},_0x5a12f5,_0x575f18[_0x9458('0x45')]);var _0x363953={'where':_0x5a12f5[_0x9458('0x42')]};return db['Variable']['count'](_0x363953)[_0x9458('0x2a')](function(_0xb12347){_0x320051[_0x9458('0x20')]=_0xb12347;if(_0x575f18[_0x9458('0x36')][_0x9458('0x46')]){_0x5a12f5['include']=[{'all':!![]}];}return db[_0x9458('0x47')][_0x9458('0x48')](_0x5a12f5);})['then'](function(_0x164ac2){_0x320051[_0x9458('0x49')]=_0x164ac2;return _0x320051;})['then'](respondWithFilteredResult(_0x91201b,_0x5a12f5))[_0x9458('0x4a')](handleError(_0x91201b,null));};exports[_0x9458('0x4b')]=function(_0x2a3866,_0x41e4fb){var _0x334bcd={'raw':!![],'where':{'id':_0x2a3866[_0x9458('0x4c')]['id']}},_0x406956={};_0x406956[_0x9458('0x35')]=_[_0x9458('0x4d')](db['Variable'][_0x9458('0x31')]);_0x406956['query']=_[_0x9458('0x4d')](_0x2a3866[_0x9458('0x36')]);_0x406956['filters']=_[_0x9458('0x39')](_0x406956[_0x9458('0x35')],_0x406956['query']);_0x334bcd[_0x9458('0x38')]=_['intersection'](_0x406956['model'],qs['fields'](_0x2a3866[_0x9458('0x36')]['fields']));_0x334bcd['attributes']=_0x334bcd[_0x9458('0x38')][_0x9458('0x3b')]?_0x334bcd[_0x9458('0x38')]:_0x406956[_0x9458('0x35')];if(_0x2a3866['query'][_0x9458('0x46')]){_0x334bcd[_0x9458('0x4e')]=[{'all':!![]}];}_0x334bcd=_[_0x9458('0x43')]({},_0x334bcd,_0x2a3866['options']);return db['Variable'][_0x9458('0x4f')](_0x334bcd)[_0x9458('0x2a')](handleEntityNotFound(_0x41e4fb,null))['then'](respondWithResult(_0x41e4fb,null))[_0x9458('0x4a')](handleError(_0x41e4fb,null));};exports['create']=function(_0x5ac5f8,_0x48f610){return db['Variable'][_0x9458('0x50')](_0x5ac5f8[_0x9458('0x51')],{})[_0x9458('0x2a')](function(_0x243d5a){var _0x57e864=_0x5ac5f8['user'][_0x9458('0x52')]({'plain':!![]});if(!_0x57e864)throw new Error(_0x9458('0x53'));if(_0x57e864['role']==='user'){var _0x4ce80f=_0x243d5a['get']({'plain':!![]});var _0x24a9c4='Variables';return db[_0x9458('0x54')][_0x9458('0x4f')]({'where':{'name':_0x24a9c4,'userProfileId':_0x57e864[_0x9458('0x55')]},'raw':!![]})[_0x9458('0x2a')](function(_0x63b86f){if(_0x63b86f&&_0x63b86f[_0x9458('0x56')]===0x0){return db[_0x9458('0x28')]['create']({'name':_0x4ce80f[_0x9458('0x2d')],'resourceId':_0x4ce80f['id'],'type':_0x63b86f[_0x9458('0x2d')],'sectionId':_0x63b86f['id']},{})[_0x9458('0x2a')](function(){return _0x243d5a;});}else{return _0x243d5a;}})[_0x9458('0x4a')](function(_0x1f7103){logger[_0x9458('0x2b')](_0x9458('0x57'),_0x1f7103);throw _0x1f7103;});}return _0x243d5a;})['then'](respondWithResult(_0x48f610,0xc9))[_0x9458('0x4a')](handleError(_0x48f610,null));};exports[_0x9458('0x26')]=function(_0x32235e,_0x3898a7){if(_0x32235e[_0x9458('0x51')]['id']){delete _0x32235e[_0x9458('0x51')]['id'];}return db['Variable'][_0x9458('0x4f')]({'where':{'id':_0x32235e[_0x9458('0x4c')]['id']}})['then'](handleEntityNotFound(_0x3898a7,null))['then'](saveUpdates(_0x32235e[_0x9458('0x51')],null))[_0x9458('0x2a')](respondWithResult(_0x3898a7,null))[_0x9458('0x4a')](handleError(_0x3898a7,null));};exports[_0x9458('0x29')]=function(_0x370e87,_0x299142){return db[_0x9458('0x47')][_0x9458('0x4f')]({'where':{'id':_0x370e87[_0x9458('0x4c')]['id']}})[_0x9458('0x2a')](handleEntityNotFound(_0x299142,null))[_0x9458('0x2a')](removeEntity(_0x299142,null))['catch'](handleError(_0x299142,null));}; \ No newline at end of file +var _0xa45c=['squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save','update','then','get','Variables','UserProfileResource','destroy','error','stack','name','index','Variable','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','catch','show','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x2bdaf6,_0x5a48fe){var _0x33c743=function(_0x26e380){while(--_0x26e380){_0x2bdaf6['push'](_0x2bdaf6['shift']());}};_0x33c743(++_0x5a48fe);}(_0xa45c,0x1da));var _0xca45=function(_0x5bed4a,_0x568638){_0x5bed4a=_0x5bed4a-0x0;var _0x280d15=_0xa45c[_0x5bed4a];return _0x280d15;};'use strict';var emlformat=require(_0xca45('0x0'));var rimraf=require(_0xca45('0x1'));var zipdir=require(_0xca45('0x2'));var jsonpatch=require(_0xca45('0x3'));var rp=require(_0xca45('0x4'));var moment=require('moment');var BPromise=require(_0xca45('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xca45('0x6'));var sox=require(_0xca45('0x7'));var csv=require(_0xca45('0x8'));var ejs=require(_0xca45('0x9'));var fs=require('fs');var fs_extra=require(_0xca45('0xa'));var _=require(_0xca45('0xb'));var squel=require(_0xca45('0xc'));var crypto=require(_0xca45('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xca45('0xe'));var Redis=require(_0xca45('0xf'));var authService=require(_0xca45('0x10'));var qs=require(_0xca45('0x11'));var as=require(_0xca45('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xca45('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xca45('0x14'))['db'];function respondWithStatusCode(_0x93e2e1,_0x57414b){_0x57414b=_0x57414b||0xcc;return function(_0x17bd34){if(_0x17bd34){return _0x93e2e1[_0xca45('0x15')](_0x57414b);}return _0x93e2e1['status'](_0x57414b)[_0xca45('0x16')]();};}function respondWithResult(_0x1c0b60,_0x569bed){_0x569bed=_0x569bed||0xc8;return function(_0x43aa37){if(_0x43aa37){return _0x1c0b60[_0xca45('0x17')](_0x569bed)[_0xca45('0x18')](_0x43aa37);}};}function respondWithFilteredResult(_0xeffc90,_0x589b97){return function(_0x46db54){if(_0x46db54){var _0x528a0c=typeof _0x589b97[_0xca45('0x19')]===_0xca45('0x1a')&&typeof _0x589b97[_0xca45('0x1b')]===_0xca45('0x1a');var _0x5375b3=_0x46db54[_0xca45('0x1c')];var _0x13aa16=_0x528a0c?0x0:_0x589b97[_0xca45('0x19')];var _0x1d999d=_0x528a0c?_0x46db54[_0xca45('0x1c')]:_0x589b97[_0xca45('0x19')]+_0x589b97[_0xca45('0x1b')];var _0x582ea2;if(_0x1d999d>=_0x5375b3){_0x1d999d=_0x5375b3;_0x582ea2=0xc8;}else{_0x582ea2=0xce;}_0xeffc90[_0xca45('0x17')](_0x582ea2);return _0xeffc90[_0xca45('0x1d')]('Content-Range',_0x13aa16+'-'+_0x1d999d+'/'+_0x5375b3)[_0xca45('0x18')](_0x46db54);}return null;};}function patchUpdates(_0x23f503){return function(_0x1f65bb){try{jsonpatch['apply'](_0x1f65bb,_0x23f503,!![]);}catch(_0x50790c){return BPromise[_0xca45('0x1e')](_0x50790c);}return _0x1f65bb[_0xca45('0x1f')]();};}function saveUpdates(_0x449306,_0x3c1842){return function(_0x4bf727){if(_0x4bf727){return _0x4bf727[_0xca45('0x20')](_0x449306)[_0xca45('0x21')](function(_0x55a0f5){return _0x55a0f5;});}return null;};}function removeEntity(_0x3b0957,_0x57a752){return function(_0x434515){if(_0x434515){return _0x434515['destroy']()['then'](function(){var _0x5560ca=_0x434515[_0xca45('0x22')]({'plain':!![]});var _0x41b885=_0xca45('0x23');return db[_0xca45('0x24')][_0xca45('0x25')]({'where':{'type':_0x41b885,'resourceId':_0x5560ca['id']}})[_0xca45('0x21')](function(){return _0x434515;});})[_0xca45('0x21')](function(){_0x3b0957['status'](0xcc)[_0xca45('0x16')]();});}};}function handleEntityNotFound(_0x28e73e,_0x2d7ccb){return function(_0x3a92bb){if(!_0x3a92bb){_0x28e73e[_0xca45('0x15')](0x194);}return _0x3a92bb;};}function handleError(_0x2d57f1,_0x1c3e27){_0x1c3e27=_0x1c3e27||0x1f4;return function(_0x31c9e7){logger[_0xca45('0x26')](_0x31c9e7[_0xca45('0x27')]);if(_0x31c9e7[_0xca45('0x28')]){delete _0x31c9e7[_0xca45('0x28')];}_0x2d57f1[_0xca45('0x17')](_0x1c3e27)['send'](_0x31c9e7);};}exports[_0xca45('0x29')]=function(_0x4c3939,_0x5beff2){var _0x514c55={},_0xe91a80={},_0x5ed454={'count':0x0,'rows':[]};var _0x38e20b=_['map'](db[_0xca45('0x2a')][_0xca45('0x2b')],function(_0x23e867){return{'name':_0x23e867[_0xca45('0x2c')],'type':_0x23e867['type'][_0xca45('0x2d')]};});_0xe91a80[_0xca45('0x2e')]=_[_0xca45('0x2f')](_0x38e20b,_0xca45('0x28'));_0xe91a80['query']=_[_0xca45('0x30')](_0x4c3939[_0xca45('0x31')]);_0xe91a80[_0xca45('0x32')]=_[_0xca45('0x33')](_0xe91a80[_0xca45('0x2e')],_0xe91a80[_0xca45('0x31')]);_0x514c55['attributes']=_[_0xca45('0x33')](_0xe91a80[_0xca45('0x2e')],qs[_0xca45('0x34')](_0x4c3939['query'][_0xca45('0x34')]));_0x514c55[_0xca45('0x35')]=_0x514c55[_0xca45('0x35')][_0xca45('0x36')]?_0x514c55[_0xca45('0x35')]:_0xe91a80[_0xca45('0x2e')];if(!_0x4c3939[_0xca45('0x31')][_0xca45('0x37')](_0xca45('0x38'))){_0x514c55['limit']=qs[_0xca45('0x1b')](_0x4c3939[_0xca45('0x31')][_0xca45('0x1b')]);_0x514c55[_0xca45('0x19')]=qs[_0xca45('0x19')](_0x4c3939[_0xca45('0x31')][_0xca45('0x19')]);}_0x514c55[_0xca45('0x39')]=qs['sort'](_0x4c3939['query'][_0xca45('0x3a')]);_0x514c55[_0xca45('0x3b')]=qs[_0xca45('0x32')](_[_0xca45('0x3c')](_0x4c3939[_0xca45('0x31')],_0xe91a80[_0xca45('0x32')]),_0x38e20b);if(_0x4c3939['query'][_0xca45('0x3d')]){_0x514c55[_0xca45('0x3b')]=_[_0xca45('0x3e')](_0x514c55[_0xca45('0x3b')],{'$or':_[_0xca45('0x2f')](_0x38e20b,function(_0x316c32){if(_0x316c32[_0xca45('0x3f')]!==_0xca45('0x40')){var _0xa10d19={};_0xa10d19[_0x316c32[_0xca45('0x28')]]={'$like':'%'+_0x4c3939['query'][_0xca45('0x3d')]+'%'};return _0xa10d19;}})});}_0x514c55=_[_0xca45('0x3e')]({},_0x514c55,_0x4c3939[_0xca45('0x41')]);var _0x2cede3={'where':_0x514c55['where']};return db[_0xca45('0x2a')]['count'](_0x2cede3)[_0xca45('0x21')](function(_0x4d15e2){_0x5ed454[_0xca45('0x1c')]=_0x4d15e2;if(_0x4c3939['query'][_0xca45('0x42')]){_0x514c55['include']=[{'all':!![]}];}return db[_0xca45('0x2a')][_0xca45('0x43')](_0x514c55);})[_0xca45('0x21')](function(_0x2c12f9){_0x5ed454['rows']=_0x2c12f9;return _0x5ed454;})['then'](respondWithFilteredResult(_0x5beff2,_0x514c55))[_0xca45('0x44')](handleError(_0x5beff2,null));};exports[_0xca45('0x45')]=function(_0x44ae5e,_0x390e0d){var _0x2a7f01={'raw':!![],'where':{'id':_0x44ae5e['params']['id']}},_0x147e7a={};_0x147e7a[_0xca45('0x2e')]=_[_0xca45('0x30')](db['Variable'][_0xca45('0x2b')]);_0x147e7a[_0xca45('0x31')]=_[_0xca45('0x30')](_0x44ae5e[_0xca45('0x31')]);_0x147e7a['filters']=_[_0xca45('0x33')](_0x147e7a['model'],_0x147e7a[_0xca45('0x31')]);_0x2a7f01[_0xca45('0x35')]=_[_0xca45('0x33')](_0x147e7a[_0xca45('0x2e')],qs[_0xca45('0x34')](_0x44ae5e['query'][_0xca45('0x34')]));_0x2a7f01['attributes']=_0x2a7f01[_0xca45('0x35')][_0xca45('0x36')]?_0x2a7f01[_0xca45('0x35')]:_0x147e7a[_0xca45('0x2e')];if(_0x44ae5e[_0xca45('0x31')][_0xca45('0x42')]){_0x2a7f01[_0xca45('0x46')]=[{'all':!![]}];}_0x2a7f01=_['merge']({},_0x2a7f01,_0x44ae5e['options']);return db[_0xca45('0x2a')][_0xca45('0x47')](_0x2a7f01)[_0xca45('0x21')](handleEntityNotFound(_0x390e0d,null))[_0xca45('0x21')](respondWithResult(_0x390e0d,null))[_0xca45('0x44')](handleError(_0x390e0d,null));};exports[_0xca45('0x48')]=function(_0x111406,_0x1e4107){return db[_0xca45('0x2a')]['create'](_0x111406[_0xca45('0x49')],{})[_0xca45('0x21')](function(_0x5d365f){var _0xe34772=_0x111406[_0xca45('0x4a')][_0xca45('0x22')]({'plain':!![]});if(!_0xe34772)throw new Error(_0xca45('0x4b'));if(_0xe34772[_0xca45('0x4c')]===_0xca45('0x4a')){var _0x3dd04b=_0x5d365f[_0xca45('0x22')]({'plain':!![]});var _0x3c0d61='Variables';return db[_0xca45('0x4d')][_0xca45('0x47')]({'where':{'name':_0x3c0d61,'userProfileId':_0xe34772['userProfileId']},'raw':!![]})[_0xca45('0x21')](function(_0x1a2df6){if(_0x1a2df6&&_0x1a2df6[_0xca45('0x4e')]===0x0){return db['UserProfileResource'][_0xca45('0x48')]({'name':_0x3dd04b[_0xca45('0x28')],'resourceId':_0x3dd04b['id'],'type':_0x1a2df6[_0xca45('0x28')],'sectionId':_0x1a2df6['id']},{})[_0xca45('0x21')](function(){return _0x5d365f;});}else{return _0x5d365f;}})[_0xca45('0x44')](function(_0x3be2f5){logger[_0xca45('0x26')](_0xca45('0x4f'),_0x3be2f5);throw _0x3be2f5;});}return _0x5d365f;})[_0xca45('0x21')](respondWithResult(_0x1e4107,0xc9))[_0xca45('0x44')](handleError(_0x1e4107,null));};exports['update']=function(_0x4d20,_0x24483a){if(_0x4d20[_0xca45('0x49')]['id']){delete _0x4d20[_0xca45('0x49')]['id'];}return db[_0xca45('0x2a')]['find']({'where':{'id':_0x4d20[_0xca45('0x50')]['id']}})[_0xca45('0x21')](handleEntityNotFound(_0x24483a,null))[_0xca45('0x21')](saveUpdates(_0x4d20[_0xca45('0x49')],null))[_0xca45('0x21')](respondWithResult(_0x24483a,null))[_0xca45('0x44')](handleError(_0x24483a,null));};exports[_0xca45('0x25')]=function(_0x4a1d7b,_0xadf64c){return db[_0xca45('0x2a')][_0xca45('0x47')]({'where':{'id':_0x4a1d7b[_0xca45('0x50')]['id']}})[_0xca45('0x21')](handleEntityNotFound(_0xadf64c,null))['then'](removeEntity(_0xadf64c,null))[_0xca45('0x44')](handleError(_0xadf64c,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 900310d..0d10971 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 _0x5e94=['util','../../config/logger','api','moment','request-promise','rimraf','./variable.attributes','exports','define','Variable','tools_variables','lodash'];(function(_0xeb762a,_0x5b2851){var _0x21db58=function(_0x189618){while(--_0x189618){_0xeb762a['push'](_0xeb762a['shift']());}};_0x21db58(++_0x5b2851);}(_0x5e94,0xa7));var _0x45e9=function(_0x3f1579,_0x174d65){_0x3f1579=_0x3f1579-0x0;var _0x126a3b=_0x5e94[_0x3f1579];return _0x126a3b;};'use strict';var _=require(_0x45e9('0x0'));var util=require(_0x45e9('0x1'));var logger=require(_0x45e9('0x2'))(_0x45e9('0x3'));var moment=require(_0x45e9('0x4'));var BPromise=require('bluebird');var rp=require(_0x45e9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x45e9('0x6'));var config=require('../../config/environment');var attributes=require(_0x45e9('0x7'));module[_0x45e9('0x8')]=function(_0x138450,_0x223982){return _0x138450[_0x45e9('0x9')](_0x45e9('0xa'),attributes,{'tableName':_0x45e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf0b=['util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','Variable','lodash'];(function(_0x106be3,_0x254a6f){var _0x5d9705=function(_0x1cc554){while(--_0x1cc554){_0x106be3['push'](_0x106be3['shift']());}};_0x5d9705(++_0x254a6f);}(_0xcf0b,0xe6));var _0xbcf0=function(_0x241424,_0x25eb5d){_0x241424=_0x241424-0x0;var _0x3da798=_0xcf0b[_0x241424];return _0x3da798;};'use strict';var _=require(_0xbcf0('0x0'));var util=require(_0xbcf0('0x1'));var logger=require(_0xbcf0('0x2'))(_0xbcf0('0x3'));var moment=require(_0xbcf0('0x4'));var BPromise=require(_0xbcf0('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbcf0('0x6'));var rimraf=require('rimraf');var config=require(_0xbcf0('0x7'));var attributes=require('./variable.attributes');module[_0xbcf0('0x8')]=function(_0xa4d8a6,_0x399b18){return _0xa4d8a6[_0xbcf0('0x9')](_0xbcf0('0xa'),attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/variable/variable.rpc.js b/server/api/variable/variable.rpc.js index 738db40..47d570a 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x50ad95,_0x530cfe){var _0xfc94ee=function(_0x1e7720){while(--_0x1e7720){_0x50ad95['push'](_0x50ad95['shift']());}};_0xfc94ee(++_0x530cfe);}(_0x5fc3,0xa8));var _0x35fc=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x5fc3[_0x21549c];return _0x426cbd;};'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')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\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']('Variable,\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);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0x9957=['stringify','error','code','message','result','catch','ShowVariable','find','raw','options','where','attributes','include','map','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s'];(function(_0x873bc5,_0x4d6c7f){var _0x38e2fa=function(_0x5ae572){while(--_0x5ae572){_0x873bc5['push'](_0x873bc5['shift']());}};_0x38e2fa(++_0x4d6c7f);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Variable,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Variable'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')]['include'],function(_0x32a09a){return{'model':db[_0x32a09a[_0x7995('0x20')]],'as':_0x32a09a['as'],'attributes':_0x32a09a[_0x7995('0x1d')],'include':_0x32a09a[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x32a09a[_0x7995('0x1e')],function(_0x475351){return{'model':db[_0x475351[_0x7995('0x20')]],'as':_0x475351['as'],'attributes':_0x475351['attributes'],'include':_0x475351[_0x7995('0x1e')]?_[_0x7995('0x1f')](_0x475351[_0x7995('0x1e')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x20')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x47625f){logger['info'](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')](_0x7995('0x18'),_0x291317,JSON[_0x7995('0x12')](_0x47625f));_0x37a7d4(_0x47625f);})[_0x7995('0x17')](function(_0x4b6f99){logger[_0x7995('0x13')]('ShowVariable',_0x4b6f99[_0x7995('0x15')],_0x291317);_0x4faa60(_0x1e1415[_0x7995('0x13')](0x1f4,_0x4b6f99[_0x7995('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index db45a9c..764f2fa 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 _0x1bb2=['restart','/migrations','migrations','exports','express','Router','./version.controller','index','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull'];(function(_0x6523a0,_0x4f2762){var _0x513b80=function(_0x45bf03){while(--_0x45bf03){_0x6523a0['push'](_0x6523a0['shift']());}};_0x513b80(++_0x4f2762);}(_0x1bb2,0x1be));var _0x21bb=function(_0x4a791e,_0x3f294c){_0x4a791e=_0x4a791e-0x0;var _0x2bb81a=_0x1bb2[_0x4a791e];return _0x2bb81a;};'use strict';var express=require(_0x21bb('0x0'));var router=express[_0x21bb('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x21bb('0x2'));router['get']('/',controller[_0x21bb('0x3')]);router[_0x21bb('0x4')](_0x21bb('0x5'),auth[_0x21bb('0x6')](),auth[_0x21bb('0x7')](),controller[_0x21bb('0x8')]);router['get'](_0x21bb('0x9'),auth[_0x21bb('0x6')](),auth[_0x21bb('0x7')](),controller[_0x21bb('0xa')]);router[_0x21bb('0x4')](_0x21bb('0xb'),auth[_0x21bb('0x6')](),auth[_0x21bb('0x7')](),controller[_0x21bb('0xc')]);router['get']('/restart',auth['isAuthenticated'](),controller[_0x21bb('0xd')]);router[_0x21bb('0x4')](_0x21bb('0xe'),controller[_0x21bb('0xf')]);module[_0x21bb('0x10')]=router; \ No newline at end of file +var _0x93ab=['fetch','/reset','isAuthenticated','reset','/pull','pull','/restart','/migrations','migrations','exports','express','Router','./version.controller','get','index','canUpdate'];(function(_0x37dbcf,_0x491470){var _0x36c3f0=function(_0x49a9a4){while(--_0x49a9a4){_0x37dbcf['push'](_0x37dbcf['shift']());}};_0x36c3f0(++_0x491470);}(_0x93ab,0x9a));var _0xb93a=function(_0x2f6233,_0x90172){_0x2f6233=_0x2f6233-0x0;var _0x1c9c36=_0x93ab[_0x2f6233];return _0x1c9c36;};'use strict';var express=require(_0xb93a('0x0'));var router=express[_0xb93a('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xb93a('0x2'));router[_0xb93a('0x3')]('/',controller[_0xb93a('0x4')]);router[_0xb93a('0x3')]('/fetch',auth['isAuthenticated'](),auth[_0xb93a('0x5')](),controller[_0xb93a('0x6')]);router[_0xb93a('0x3')](_0xb93a('0x7'),auth[_0xb93a('0x8')](),auth[_0xb93a('0x5')](),controller[_0xb93a('0x9')]);router[_0xb93a('0x3')](_0xb93a('0xa'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0xb93a('0xb')]);router[_0xb93a('0x3')](_0xb93a('0xc'),auth[_0xb93a('0x8')](),controller['restart']);router[_0xb93a('0x3')](_0xb93a('0xd'),controller[_0xb93a('0xe')]);module[_0xb93a('0xf')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index aedfed5..109610e 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 _0xc874=['query','latest','tags','2.0.0','json','status','fetch','origin','master','error','info','git\x20fetch\x20origin\x20master','reset','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','length','replace','.js','exports','push','sequelize','Migration','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','server','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','pkginfo','compare-versions','child_process','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','simple-git','root','index','version'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc874,0x1a3));var _0x4c87=function(_0x6d6a66,_0x2924af){_0x6d6a66=_0x6d6a66-0x0;var _0x11eb6e=_0xc874[_0x6d6a66];return _0x11eb6e;};'use strict';var Umzug=require(_0x4c87('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x4c87('0x1'));var pkginfo=require(_0x4c87('0x2'))(module,'version');var compareVersions=require(_0x4c87('0x3'));var exec=require(_0x4c87('0x4'))['exec'];var db=require(_0x4c87('0x5'))['db'];var config=require(_0x4c87('0x6'));var pm2=require(_0x4c87('0x7'));var logger=require(_0x4c87('0x8'))('update');var git=require(_0x4c87('0x9'))(config[_0x4c87('0xa')]);exports[_0x4c87('0xb')]=function(_0x166917,_0x4d393c){var _0x2cd1f7={'current':module['exports'][_0x4c87('0xc')],'phonebar':0x2};if(_0x166917[_0x4c87('0xd')]&&_0x166917[_0x4c87('0xd')][_0x4c87('0xe')]){return git['fetch']()[_0x4c87('0xf')](function(_0x4a9a32,_0x855189){_0x2cd1f7[_0x4c87('0xe')]=(_0x4a9a32?module['exports'][_0x4c87('0xc')]:_0x855189['latest'])||_0x4c87('0x10');return _0x4d393c['status'](0xc8)[_0x4c87('0x11')](_0x2cd1f7);});}else{return _0x4d393c[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')](_0x2cd1f7);}};exports[_0x4c87('0x13')]=function(_0x3036af,_0xfba3b1){return git['fetch']([_0x4c87('0x14'),_0x4c87('0x15')],function(_0x2d7d13){if(_0x2d7d13){logger[_0x4c87('0x16')](_0x2d7d13);return _0xfba3b1[_0x4c87('0x12')](0x1f4)['json'](_0x2d7d13);}logger[_0x4c87('0x17')]('git\x20fetch');return _0xfba3b1[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':_0x4c87('0x18')});});};exports[_0x4c87('0x19')]=function(_0x158394,_0x5ecccc){return git[_0x4c87('0x19')](['--hard',_0x4c87('0x1a')],function(_0x184b98){if(_0x184b98){logger[_0x4c87('0x16')](_0x184b98);return _0x5ecccc[_0x4c87('0x12')](0x1f4)[_0x4c87('0x11')](_0x184b98);}logger[_0x4c87('0x17')](_0x4c87('0x1b'));return _0x5ecccc[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0x4c87('0x1c')]=function(_0x2f138b,_0x525803){exec('npm\x20install\x20--production',function(_0x2145f3,_0x52e8d1,_0x87a385){logger[_0x4c87('0x17')](_0x52e8d1);logger[_0x4c87('0x17')](_0x87a385);if(_0x2145f3){logger[_0x4c87('0x16')](_0x2145f3);return _0x525803[_0x4c87('0x12')](0x1f4)['json'](_0x2145f3);}return _0x525803[_0x4c87('0x12')](0xc8)['json']({'output':_0x52e8d1});});};exports[_0x4c87('0x1d')]=function(_0x1a6ee0,_0x576165){return pm2[_0x4c87('0x1d')](_0x4c87('0x1e'))[_0x4c87('0x1f')](function(_0x33bd26){logger[_0x4c87('0x17')](_0x4c87('0x20'),_0x33bd26);return _0x576165[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':_0x4c87('0x21')});})[_0x4c87('0x22')](function(_0x17bcf0){logger[_0x4c87('0x16')](_0x17bcf0);return _0x576165[_0x4c87('0x12')](0x1f4)['json'](_0x17bcf0);});};exports[_0x4c87('0x23')]=function(_0x58ed96,_0x77496f){var _0x50bb60=fs[_0x4c87('0x24')](path[_0x4c87('0x25')](config[_0x4c87('0xa')],'server',_0x4c87('0x23')));var _0x476dee=[];for(var _0x59e9c3=0x0;_0x59e9c3<_0x50bb60[_0x4c87('0x26')];_0x59e9c3++){var _0x302337=_0x50bb60[_0x59e9c3][_0x4c87('0x27')](_0x4c87('0x28'),'');if(compareVersions(module[_0x4c87('0x29')]['version'],_0x302337)===-0x1){_0x476dee[_0x4c87('0x2a')](_0x302337);}}if(_0x476dee[_0x4c87('0x26')]){var _0x3cf027=_0x476dee['sort'](compareVersions);var _0x243c8a=new Umzug({'storage':_0x4c87('0x2b'),'storageOptions':{'model':db[_0x4c87('0x2c')],'modelName':'Migration','columnName':_0x4c87('0xc')},'migrations':{'params':[db['sequelize'][_0x4c87('0x2d')](),db['sequelize']['constructor'],function(){throw new Error(_0x4c87('0x2e'));}],'path':path[_0x4c87('0x25')](config[_0x4c87('0xa')],_0x4c87('0x2f'),_0x4c87('0x23')),'pattern':/\.js$/}});_0x243c8a['up']({'migrations':_[_0x4c87('0x30')](_0x3cf027,function(_0x5ac7ef){return _0x5ac7ef+_0x4c87('0x28');})})['then'](function(){return _0x77496f[_0x4c87('0x12')](0xc8)['json']({'output':_0x4c87('0x31')+module['exports'][_0x4c87('0xc')]+_0x4c87('0x32')+_[_0x4c87('0x33')](_0x3cf027),'migrations':_[_0x4c87('0x25')](_0x3cf027)});})[_0x4c87('0x22')](function(_0x1ac02d){if(_0x1ac02d instanceof db[_0x4c87('0x2b')][_0x4c87('0x34')]){return _0x77496f[_0x4c87('0x12')](0xc8)[_0x4c87('0x11')]({'output':_0x4c87('0x35')});}else{return _0x77496f[_0x4c87('0x12')](0x1f4)['json'](_0x1ac02d);}});}else{return _0x77496f['status'](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0xb15e=['push','sort','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.','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','update','simple-git','exports','version','query','latest','fetch','tags','status','json','origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','info','pm2\x20restart\x20motion\x20%s','catch','migrations','readdirSync','join','root','server','replace'];(function(_0x5b8199,_0x29cabb){var _0x19071a=function(_0x4a789c){while(--_0x4a789c){_0x5b8199['push'](_0x5b8199['shift']());}};_0x19071a(++_0x29cabb);}(_0xb15e,0x7b));var _0xeb15=function(_0x3e61a5,_0x5e922d){_0x3e61a5=_0x3e61a5-0x0;var _0x44db12=_0xb15e[_0x3e61a5];return _0x44db12;};'use strict';var Umzug=require(_0xeb15('0x0'));var path=require(_0xeb15('0x1'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0xeb15('0x2'))(module,'version');var compareVersions=require(_0xeb15('0x3'));var exec=require(_0xeb15('0x4'))[_0xeb15('0x5')];var db=require(_0xeb15('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0xeb15('0x7'));var logger=require(_0xeb15('0x8'))(_0xeb15('0x9'));var git=require(_0xeb15('0xa'))(config['root']);exports['index']=function(_0x54b770,_0x451f5c){var _0x1449a3={'current':module[_0xeb15('0xb')][_0xeb15('0xc')],'phonebar':0x2};if(_0x54b770[_0xeb15('0xd')]&&_0x54b770[_0xeb15('0xd')][_0xeb15('0xe')]){return git[_0xeb15('0xf')]()[_0xeb15('0x10')](function(_0x55cf3c,_0x40b665){_0x1449a3[_0xeb15('0xe')]=(_0x55cf3c?module[_0xeb15('0xb')]['version']:_0x40b665['latest'])||'2.0.0';return _0x451f5c[_0xeb15('0x11')](0xc8)['json'](_0x1449a3);});}else{return _0x451f5c['status'](0xc8)[_0xeb15('0x12')](_0x1449a3);}};exports['fetch']=function(_0x38a40f,_0xd3a096){return git[_0xeb15('0xf')]([_0xeb15('0x13'),_0xeb15('0x14')],function(_0x19754c){if(_0x19754c){logger[_0xeb15('0x15')](_0x19754c);return _0xd3a096[_0xeb15('0x11')](0x1f4)['json'](_0x19754c);}logger['info']('git\x20fetch');return _0xd3a096['status'](0xc8)[_0xeb15('0x12')]({'output':_0xeb15('0x16')});});};exports[_0xeb15('0x17')]=function(_0xdea086,_0x1ea0e7){return git[_0xeb15('0x17')]([_0xeb15('0x18'),_0xeb15('0x19')],function(_0x343aa1){if(_0x343aa1){logger['error'](_0x343aa1);return _0x1ea0e7['status'](0x1f4)[_0xeb15('0x12')](_0x343aa1);}logger['info'](_0xeb15('0x1a'));return _0x1ea0e7[_0xeb15('0x11')](0xc8)['json']({'output':_0xeb15('0x1b')});});};exports[_0xeb15('0x1c')]=function(_0x6e74e6,_0x3b7387){exec(_0xeb15('0x1d'),function(_0x321e0c,_0x19ea72,_0x56e87d){logger['info'](_0x19ea72);logger['info'](_0x56e87d);if(_0x321e0c){logger[_0xeb15('0x15')](_0x321e0c);return _0x3b7387[_0xeb15('0x11')](0x1f4)[_0xeb15('0x12')](_0x321e0c);}return _0x3b7387[_0xeb15('0x11')](0xc8)[_0xeb15('0x12')]({'output':_0x19ea72});});};exports[_0xeb15('0x1e')]=function(_0x1933e7,_0x46d7ff){return pm2[_0xeb15('0x1e')](_0xeb15('0x1f'))[_0xeb15('0x20')](function(_0x378234){logger[_0xeb15('0x21')](_0xeb15('0x22'),_0x378234);return _0x46d7ff['status'](0xc8)[_0xeb15('0x12')]({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xeb15('0x23')](function(_0x337724){logger[_0xeb15('0x15')](_0x337724);return _0x46d7ff[_0xeb15('0x11')](0x1f4)['json'](_0x337724);});};exports[_0xeb15('0x24')]=function(_0x50d3ee,_0x1bf899){var _0x4c1990=fs[_0xeb15('0x25')](path[_0xeb15('0x26')](config[_0xeb15('0x27')],_0xeb15('0x28'),'migrations'));var _0x267082=[];for(var _0x40de9c=0x0;_0x40de9c<_0x4c1990['length'];_0x40de9c++){var _0x3e87f7=_0x4c1990[_0x40de9c][_0xeb15('0x29')]('.js','');if(compareVersions(module[_0xeb15('0xb')][_0xeb15('0xc')],_0x3e87f7)===-0x1){_0x267082[_0xeb15('0x2a')](_0x3e87f7);}}if(_0x267082['length']){var _0x11bedf=_0x267082[_0xeb15('0x2b')](compareVersions);var _0x345788=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xeb15('0x2c')],'modelName':'Migration','columnName':_0xeb15('0xc')},'migrations':{'params':[db[_0xeb15('0x2d')][_0xeb15('0x2e')](),db[_0xeb15('0x2d')][_0xeb15('0x2f')],function(){throw new Error(_0xeb15('0x30'));}],'path':path['join'](config[_0xeb15('0x27')],_0xeb15('0x28'),'migrations'),'pattern':/\.js$/}});_0x345788['up']({'migrations':_[_0xeb15('0x31')](_0x11bedf,function(_0x111b55){return _0x111b55+_0xeb15('0x32');})})[_0xeb15('0x20')](function(){return _0x1bf899['status'](0xc8)[_0xeb15('0x12')]({'output':_0xeb15('0x33')+module[_0xeb15('0xb')][_0xeb15('0xc')]+'\x20to\x20'+_[_0xeb15('0x34')](_0x11bedf),'migrations':_[_0xeb15('0x26')](_0x11bedf)});})[_0xeb15('0x23')](function(_0x48810d){if(_0x48810d instanceof db['sequelize'][_0xeb15('0x35')]){return _0x1bf899['status'](0xc8)[_0xeb15('0x12')]({'output':_0xeb15('0x36')});}else{return _0x1bf899['status'](0x1f4)[_0xeb15('0x12')](_0x48810d);}});}else{return _0x1bf899[_0xeb15('0x11')](0xc8)['json']({'output':_0xeb15('0x36')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 0f40bf4..02351a0 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 _0x5d30=['fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','create','put','/:id','delete','destroy','exports','multer','util','path','express'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x5d30,0x164));var _0x05d3=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x5d30[_0x3e112d];return _0x531c31;};'use strict';var multer=require(_0x05d3('0x0'));var util=require(_0x05d3('0x1'));var path=require(_0x05d3('0x2'));var timeout=require('connect-timeout');var express=require(_0x05d3('0x3'));var router=express['Router']();var fs_extra=require(_0x05d3('0x4'));var auth=require(_0x05d3('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router[_0x05d3('0x6')]('/',auth[_0x05d3('0x7')](),controller[_0x05d3('0x8')]);router['get'](_0x05d3('0x9'),auth['isAuthenticated'](),controller[_0x05d3('0xa')]);router[_0x05d3('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x05d3('0xb')]);router['post']('/',auth[_0x05d3('0x7')](),controller[_0x05d3('0xc')]);router[_0x05d3('0xd')](_0x05d3('0xe'),auth[_0x05d3('0x7')](),controller['update']);router[_0x05d3('0xf')](_0x05d3('0xe'),auth[_0x05d3('0x7')](),controller[_0x05d3('0x10')]);module[_0x05d3('0x11')]=router; \ No newline at end of file +var _0xa37e=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','/describe','describe','get','/:id','show','post','put'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0xa37e,0x168));var _0xea37=function(_0x1afcf3,_0x195c95){_0x1afcf3=_0x1afcf3-0x0;var _0x21e192=_0xa37e[_0x1afcf3];return _0x21e192;};'use strict';var multer=require(_0xea37('0x0'));var util=require(_0xea37('0x1'));var path=require(_0xea37('0x2'));var timeout=require(_0xea37('0x3'));var express=require(_0xea37('0x4'));var router=express[_0xea37('0x5')]();var fs_extra=require(_0xea37('0x6'));var auth=require(_0xea37('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xea37('0x8'));var controller=require(_0xea37('0x9'));router['get']('/',auth[_0xea37('0xa')](),controller['index']);router['get'](_0xea37('0xb'),auth[_0xea37('0xa')](),controller[_0xea37('0xc')]);router[_0xea37('0xd')](_0xea37('0xe'),auth[_0xea37('0xa')](),controller[_0xea37('0xf')]);router[_0xea37('0x10')]('/',auth[_0xea37('0xa')](),controller['create']);router[_0xea37('0x11')](_0xea37('0xe'),auth[_0xea37('0xa')](),controller[_0xea37('0x12')]);router[_0xea37('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xea37('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index eee63c5..9993166 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 _0x5eb8=['FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN','INTEGER'];(function(_0x2dbb3e,_0x2686b5){var _0x211782=function(_0x1c7ed2){while(--_0x1c7ed2){_0x2dbb3e['push'](_0x2dbb3e['shift']());}};_0x211782(++_0x2686b5);}(_0x5eb8,0xb0));var _0x85eb=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0x5eb8[_0x36c6eb];return _0x30675b;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x85eb('0x0')]},'uniqueid':{'type':Sequelize[_0x85eb('0x0')]},'calleridnum':{'type':Sequelize[_0x85eb('0x0')]},'calleridname':{'type':Sequelize[_0x85eb('0x0')]},'queue':{'type':Sequelize[_0x85eb('0x0')]},'interface':{'type':Sequelize[_0x85eb('0x0')]},'membername':{'type':Sequelize[_0x85eb('0x0')]},'agentcalledAt':{'type':Sequelize[_0x85eb('0x1')]},'agentconnectAt':{'type':Sequelize[_0x85eb('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x85eb('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x85eb('0x1')]},'agentdumpAt':{'type':Sequelize[_0x85eb('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x85eb('0x0')]},'lastevent':{'type':Sequelize[_0x85eb('0x0')]},'channel':{'type':Sequelize[_0x85eb('0x0')]},'channelstate':{'type':Sequelize[_0x85eb('0x3')]},'channelstatedesc':{'type':Sequelize[_0x85eb('0x0')]},'connectedlinenum':{'type':Sequelize[_0x85eb('0x0')]},'connectedlinename':{'type':Sequelize[_0x85eb('0x0')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x85eb('0x0')]},'context':{'type':Sequelize[_0x85eb('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x85eb('0x0')]},'destchannel':{'type':Sequelize[_0x85eb('0x0')]},'destchannelstate':{'type':Sequelize[_0x85eb('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x85eb('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x85eb('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x85eb('0x0')]},'destaccountcode':{'type':Sequelize[_0x85eb('0x0')]},'destcontext':{'type':Sequelize[_0x85eb('0x0')]},'destexten':{'type':Sequelize[_0x85eb('0x0')]},'destpriority':{'type':Sequelize[_0x85eb('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x85eb('0x0')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x85eb('0x2')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x85eb('0x0')],'comment':_0x85eb('0x4')},'transferexten':{'type':Sequelize[_0x85eb('0x0')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xba37=['BOOLEAN','INTEGER','sequelize','STRING','DATE'];(function(_0x363ef8,_0x4ecb1a){var _0x148822=function(_0x232634){while(--_0x232634){_0x363ef8['push'](_0x363ef8['shift']());}};_0x148822(++_0x4ecb1a);}(_0xba37,0xb6));var _0x7ba3=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0xba37[_0x42bdad];return _0x122626;};'use strict';var Sequelize=require(_0x7ba3('0x0'));module['exports']={'type':{'type':Sequelize[_0x7ba3('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x7ba3('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7ba3('0x1')]},'interface':{'type':Sequelize[_0x7ba3('0x1')]},'membername':{'type':Sequelize[_0x7ba3('0x1')]},'agentcalledAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentconnectAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x7ba3('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x7ba3('0x4')]},'agentacw':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x7ba3('0x4')]},'reason':{'type':Sequelize[_0x7ba3('0x1')]},'lastevent':{'type':Sequelize[_0x7ba3('0x1')]},'channel':{'type':Sequelize[_0x7ba3('0x1')]},'channelstate':{'type':Sequelize[_0x7ba3('0x4')]},'channelstatedesc':{'type':Sequelize[_0x7ba3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x7ba3('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7ba3('0x1')]},'accountcode':{'type':Sequelize[_0x7ba3('0x1')]},'context':{'type':Sequelize[_0x7ba3('0x1')]},'exten':{'type':Sequelize[_0x7ba3('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7ba3('0x1')]},'destchannelstate':{'type':Sequelize[_0x7ba3('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x7ba3('0x1')]},'destcalleridnum':{'type':Sequelize[_0x7ba3('0x1')]},'destcalleridname':{'type':Sequelize[_0x7ba3('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x7ba3('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x7ba3('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x7ba3('0x1')]},'destcontext':{'type':Sequelize[_0x7ba3('0x1')]},'destexten':{'type':Sequelize[_0x7ba3('0x1')]},'destpriority':{'type':Sequelize[_0x7ba3('0x1')]},'destuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x7ba3('0x1')]},'transfer':{'type':Sequelize[_0x7ba3('0x3')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x7ba3('0x1')]},'transferuniqueid':{'type':Sequelize[_0x7ba3('0x1')]},'agententerreason':{'type':Sequelize[_0x7ba3('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 80422f8..42bdb44 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(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'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(_0x4fbfd9,_0x3ab91a){var _0x31dc94=function(_0x11e53b){while(--_0x11e53b){_0x4fbfd9['push'](_0x4fbfd9['shift']());}};_0x31dc94(++_0x3ab91a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'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 d4f0787..953eeef 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 _0x423b=['uniqueid','destuniqueid','util','api','bluebird','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport'];(function(_0x570663,_0x1fce2b){var _0x12924a=function(_0x1863cc){while(--_0x1863cc){_0x570663['push'](_0x570663['shift']());}};_0x12924a(++_0x1fce2b);}(_0x423b,0x12b));var _0xb423=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x423b[_0x2070da];return _0x4f9fe1;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var logger=require('../../config/logger')(_0xb423('0x1'));var moment=require('moment');var BPromise=require(_0xb423('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb423('0x3'));var attributes=require(_0xb423('0x4'));module['exports']=function(_0x1be92e,_0x3e6b18){return _0x1be92e[_0xb423('0x5')](_0xb423('0x6'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0xb423('0x7'),_0xb423('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64f5=['path','../../config/environment','./voiceAgentReport.attributes','exports','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','moment','request-promise'];(function(_0x3c2863,_0x1b2cee){var _0x2c3d27=function(_0x4f831b){while(--_0x4f831b){_0x3c2863['push'](_0x3c2863['shift']());}};_0x2c3d27(++_0x1b2cee);}(_0x64f5,0x17e));var _0x564f=function(_0x390368,_0x4af971){_0x390368=_0x390368-0x0;var _0x4da309=_0x64f5[_0x390368];return _0x4da309;};'use strict';var _=require(_0x564f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x564f('0x1'));var BPromise=require('bluebird');var rp=require(_0x564f('0x2'));var fs=require('fs');var path=require(_0x564f('0x3'));var rimraf=require('rimraf');var config=require(_0x564f('0x4'));var attributes=require(_0x564f('0x5'));module[_0x564f('0x6')]=function(_0x72b009,_0x4bbedf){return _0x72b009['define'](_0x564f('0x7'),attributes,{'tableName':_0x564f('0x8'),'paranoid':![],'indexes':[{'fields':[_0x564f('0x9'),_0x564f('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index c7b0573..edbec87 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 _0x3e3e=['raw','debug','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','attributes','limit','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','create','options'];(function(_0x5c546d,_0x59822a){var _0x29a8ac=function(_0x1ecf33){while(--_0x1ecf33){_0x5c546d['push'](_0x5c546d['shift']());}};_0x29a8ac(++_0x59822a);}(_0x3e3e,0x1d1));var _0xe3e3=function(_0x3e170f,_0x320373){_0x3e170f=_0x3e170f-0x0;var _0x52e004=_0x3e3e[_0x3e170f];return _0x52e004;};'use strict';var _=require(_0xe3e3('0x0'));var util=require('util');var moment=require(_0xe3e3('0x1'));var BPromise=require(_0xe3e3('0x2'));var rs=require(_0xe3e3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe3e3('0x4'))['db'];var utils=require(_0xe3e3('0x5'));var logger=require(_0xe3e3('0x6'))('rpc');var config=require(_0xe3e3('0x7'));var jayson=require(_0xe3e3('0x8'));var client=jayson[_0xe3e3('0x9')][_0xe3e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x310239,_0x407370,_0x2f8585){return new BPromise(function(_0x2e10bb,_0x3afb39){return client[_0xe3e3('0xb')](_0x310239,_0x2f8585)[_0xe3e3('0xc')](function(_0x50f280){logger[_0xe3e3('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x407370,_0xe3e3('0xe'));logger['debug'](_0xe3e3('0xf'),_0x407370,_0xe3e3('0xe'),JSON[_0xe3e3('0x10')](_0x50f280));if(_0x50f280[_0xe3e3('0x11')]){if(_0x50f280['error'][_0xe3e3('0x12')]===0x1f4){logger['error'](_0xe3e3('0x13'),_0x407370,_0x50f280['error'][_0xe3e3('0x14')]);return _0x3afb39(_0x50f280['error']['message']);}logger['error'](_0xe3e3('0x13'),_0x407370,_0x50f280[_0xe3e3('0x11')]['message']);return _0x2e10bb(_0x50f280[_0xe3e3('0x11')][_0xe3e3('0x14')]);}else{logger[_0xe3e3('0xd')](_0xe3e3('0x13'),_0x407370,_0xe3e3('0xe'));_0x2e10bb(_0x50f280[_0xe3e3('0x15')][_0xe3e3('0x14')]);}})['catch'](function(_0x551bbf){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x407370,_0x551bbf);_0x3afb39(_0x551bbf);});});}exports[_0xe3e3('0x16')]=function(_0x2ffe9f){var _0x9512ff=this;return new Promise(function(_0x3735e7,_0x2efce0){return db['VoiceAgentReport'][_0xe3e3('0x17')](_0x2ffe9f['body'],{'raw':_0x2ffe9f[_0xe3e3('0x18')]?_0x2ffe9f[_0xe3e3('0x18')][_0xe3e3('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3426ef){logger['info'](_0xe3e3('0x16'),_0x2ffe9f);logger[_0xe3e3('0x1a')](_0xe3e3('0x16'),_0x2ffe9f,JSON[_0xe3e3('0x10')](_0x3426ef));_0x3735e7(_0x3426ef);})['catch'](function(_0x4d7443){logger[_0xe3e3('0x11')]('CreateVoiceAgentReport',_0x4d7443[_0xe3e3('0x14')],_0x2ffe9f);_0x2efce0(_0x9512ff[_0xe3e3('0x11')](0x1f4,_0x4d7443['message']));});});};exports[_0xe3e3('0x1b')]=function(_0x1de02a){var _0xbafa0f=this;return new Promise(function(_0xe3eda4,_0x4720af){return db[_0xe3e3('0x1c')][_0xe3e3('0x1d')](_0x1de02a[_0xe3e3('0x1e')],{'raw':_0x1de02a[_0xe3e3('0x18')]?_0x1de02a['options'][_0xe3e3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1de02a[_0xe3e3('0x18')]?_0x1de02a[_0xe3e3('0x18')][_0xe3e3('0x1f')]||null:null,'attributes':_0x1de02a[_0xe3e3('0x18')]?_0x1de02a[_0xe3e3('0x18')][_0xe3e3('0x20')]||null:null,'limit':_0x1de02a['options']?_0x1de02a[_0xe3e3('0x18')][_0xe3e3('0x21')]||null:null})['then'](function(_0x4c8905){logger[_0xe3e3('0xd')](_0xe3e3('0x1b'),_0x1de02a);logger[_0xe3e3('0x1a')](_0xe3e3('0x1b'),_0x1de02a,JSON[_0xe3e3('0x10')](_0x4c8905));_0xe3eda4(_0x4c8905);})[_0xe3e3('0x22')](function(_0x197539){logger[_0xe3e3('0x11')](_0xe3e3('0x1b'),_0x197539[_0xe3e3('0x14')],_0x1de02a);_0x4720af(_0xbafa0f[_0xe3e3('0x11')](0x1f4,_0x197539[_0xe3e3('0x14')]));});});}; \ No newline at end of file +var _0x215c=['body','where','attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','options','raw','catch','UpdateVoiceAgentReport','update'];(function(_0x2ebebf,_0x372642){var _0x397306=function(_0x44f5a6){while(--_0x44f5a6){_0x2ebebf['push'](_0x2ebebf['shift']());}};_0x397306(++_0x372642);}(_0x215c,0xdd));var _0xc215=function(_0x2ad131,_0x19dbdc){_0x2ad131=_0x2ad131-0x0;var _0x5415ae=_0x215c[_0x2ad131];return _0x5415ae;};'use strict';var _=require(_0xc215('0x0'));var util=require(_0xc215('0x1'));var moment=require(_0xc215('0x2'));var BPromise=require('bluebird');var rs=require(_0xc215('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xc215('0x4'));var logger=require(_0xc215('0x5'))(_0xc215('0x6'));var config=require(_0xc215('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc215('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5215f0,_0x197fce,_0x199549){return new BPromise(function(_0x58e26a,_0x45b418){return client['request'](_0x5215f0,_0x199549)[_0xc215('0x9')](function(_0xad90cd){logger[_0xc215('0xa')](_0xc215('0xb'),_0x197fce,_0xc215('0xc'));logger[_0xc215('0xd')](_0xc215('0xe'),_0x197fce,_0xc215('0xc'),JSON[_0xc215('0xf')](_0xad90cd));if(_0xad90cd[_0xc215('0x10')]){if(_0xad90cd[_0xc215('0x10')][_0xc215('0x11')]===0x1f4){logger[_0xc215('0x10')]('VoiceAgentReport,\x20%s,\x20%s',_0x197fce,_0xad90cd[_0xc215('0x10')][_0xc215('0x12')]);return _0x45b418(_0xad90cd[_0xc215('0x10')][_0xc215('0x12')]);}logger['error'](_0xc215('0xb'),_0x197fce,_0xad90cd[_0xc215('0x10')][_0xc215('0x12')]);return _0x58e26a(_0xad90cd[_0xc215('0x10')]['message']);}else{logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x197fce,_0xc215('0xc'));_0x58e26a(_0xad90cd[_0xc215('0x13')][_0xc215('0x12')]);}})['catch'](function(_0x15c3f6){logger['error'](_0xc215('0xb'),_0x197fce,_0x15c3f6);_0x45b418(_0x15c3f6);});});}exports[_0xc215('0x14')]=function(_0xf9daa6){var _0x121a8f=this;return new Promise(function(_0x5df34f,_0x45877b){return db[_0xc215('0x15')]['create'](_0xf9daa6['body'],{'raw':_0xf9daa6[_0xc215('0x16')]?_0xf9daa6[_0xc215('0x16')][_0xc215('0x17')]===undefined?!![]:![]:!![]})[_0xc215('0x9')](function(_0x57f1dd){logger[_0xc215('0xa')](_0xc215('0x14'),_0xf9daa6);logger[_0xc215('0xd')]('CreateVoiceAgentReport',_0xf9daa6,JSON[_0xc215('0xf')](_0x57f1dd));_0x5df34f(_0x57f1dd);})[_0xc215('0x18')](function(_0x4ccc6c){logger['error'](_0xc215('0x14'),_0x4ccc6c[_0xc215('0x12')],_0xf9daa6);_0x45877b(_0x121a8f[_0xc215('0x10')](0x1f4,_0x4ccc6c[_0xc215('0x12')]));});});};exports[_0xc215('0x19')]=function(_0x141627){var _0x38af1e=this;return new Promise(function(_0x3a6f6f,_0x308269){return db[_0xc215('0x15')][_0xc215('0x1a')](_0x141627[_0xc215('0x1b')],{'raw':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')][_0xc215('0x1c')]||null:null,'attributes':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')][_0xc215('0x1d')]||null:null,'limit':_0x141627[_0xc215('0x16')]?_0x141627[_0xc215('0x16')][_0xc215('0x1e')]||null:null})[_0xc215('0x9')](function(_0x4533a4){logger[_0xc215('0xa')]('UpdateVoiceAgentReport',_0x141627);logger[_0xc215('0xd')](_0xc215('0x19'),_0x141627,JSON['stringify'](_0x4533a4));_0x3a6f6f(_0x4533a4);})[_0xc215('0x18')](function(_0x2da801){logger[_0xc215('0x10')](_0xc215('0x19'),_0x2da801[_0xc215('0x12')],_0x141627);_0x308269(_0x38af1e['error'](0x1f4,_0x2da801['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 4140460..3af8163 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 _0xbabc=['post','create','/:id','update','put','/with-retry/:id','updateWithRetry','destroy','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbabc,0x118));var _0xcbab=function(_0x28e19,_0x5bbd36){_0x28e19=_0x28e19-0x0;var _0x21a7d8=_0xbabc[_0x28e19];return _0x21a7d8;};'use strict';var express=require('express');var router=express[_0xcbab('0x0')]();var auth=require(_0xcbab('0x1'));var controller=require(_0xcbab('0x2'));router[_0xcbab('0x3')]('/',auth[_0xcbab('0x4')](),controller[_0xcbab('0x5')]);router[_0xcbab('0x3')](_0xcbab('0x6'),auth[_0xcbab('0x4')](),controller[_0xcbab('0x7')]);router[_0xcbab('0x3')]('/:id',auth[_0xcbab('0x4')](),controller[_0xcbab('0x8')]);router[_0xcbab('0x9')]('/',auth[_0xcbab('0x4')](),controller[_0xcbab('0xa')]);router['put'](_0xcbab('0xb'),auth[_0xcbab('0x4')](),controller[_0xcbab('0xc')]);router[_0xcbab('0xd')](_0xcbab('0xe'),auth[_0xcbab('0x4')](),controller[_0xcbab('0xf')]);router['delete'](_0xcbab('0xb'),auth[_0xcbab('0x4')](),controller[_0xcbab('0x10')]);module['exports']=router; \ No newline at end of file +var _0x38d5=['express','Router','../../components/auth/service','get','/describe','isAuthenticated','/:id','show','create','put','update','/with-retry/:id','delete','exports'];(function(_0x45aca6,_0x4b87ec){var _0x193635=function(_0x512686){while(--_0x512686){_0x45aca6['push'](_0x45aca6['shift']());}};_0x193635(++_0x4b87ec);}(_0x38d5,0xee));var _0x538d=function(_0x1b1f5b,_0x549bd4){_0x1b1f5b=_0x1b1f5b-0x0;var _0x43d1d7=_0x38d5[_0x1b1f5b];return _0x43d1d7;};'use strict';var express=require(_0x538d('0x0'));var router=express[_0x538d('0x1')]();var auth=require(_0x538d('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x538d('0x3')](_0x538d('0x4'),auth[_0x538d('0x5')](),controller['describe']);router['get'](_0x538d('0x6'),auth['isAuthenticated'](),controller[_0x538d('0x7')]);router['post']('/',auth[_0x538d('0x5')](),controller[_0x538d('0x8')]);router[_0x538d('0x9')](_0x538d('0x6'),auth[_0x538d('0x5')](),controller[_0x538d('0xa')]);router[_0x538d('0x9')](_0x538d('0xb'),auth[_0x538d('0x5')](),controller['updateWithRetry']);router[_0x538d('0xc')](_0x538d('0x6'),auth[_0x538d('0x5')](),controller['destroy']);module[_0x538d('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 96d94a5..e20419a 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 _0x38fe=['sequelize','exports','STRING','ENUM','internal','inbound-fax','outbound-fax','dialer','DATE','INTEGER'];(function(_0x5e36d1,_0x471178){var _0x950b9e=function(_0x1872f3){while(--_0x1872f3){_0x5e36d1['push'](_0x5e36d1['shift']());}};_0x950b9e(++_0x471178);}(_0x38fe,0xfa));var _0xe38f=function(_0x446020,_0x18507e){_0x446020=_0x446020-0x0;var _0x342763=_0x38fe[_0x446020];return _0x342763;};'use strict';var Sequelize=require(_0xe38f('0x0'));module[_0xe38f('0x1')]={'uniqueid':{'type':Sequelize[_0xe38f('0x2')]},'type':{'type':Sequelize[_0xe38f('0x3')]('inbound',_0xe38f('0x4'),'outbound',_0xe38f('0x5'),_0xe38f('0x6'),_0xe38f('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xe38f('0x2')]},'source':{'type':Sequelize[_0xe38f('0x2')]},'destination':{'type':Sequelize[_0xe38f('0x2')]},'destinationcontext':{'type':Sequelize[_0xe38f('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xe38f('0x2')]},'destinationchannel':{'type':Sequelize[_0xe38f('0x2')]},'lastapplication':{'type':Sequelize[_0xe38f('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xe38f('0x8')]},'systemanswertime':{'type':Sequelize[_0xe38f('0x8')]},'answertime':{'type':Sequelize[_0xe38f('0x8')]},'endtime':{'type':Sequelize[_0xe38f('0x8')]},'duration':{'type':Sequelize[_0xe38f('0x9')]},'billableseconds':{'type':Sequelize[_0xe38f('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xe38f('0x2')]},'amaflags':{'type':Sequelize[_0xe38f('0x2')]},'userfield':{'type':Sequelize[_0xe38f('0x2')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xe38f('0x2')]},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0xe38f('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x8e6d=['DATE','INTEGER','sequelize','exports','STRING','ENUM','inbound','internal','outbound','inbound-fax','outbound-fax','TEXT'];(function(_0xf5952d,_0x319ef0){var _0xb2680e=function(_0x3d8deb){while(--_0x3d8deb){_0xf5952d['push'](_0xf5952d['shift']());}};_0xb2680e(++_0x319ef0);}(_0x8e6d,0x92));var _0xd8e6=function(_0x79f843,_0x3bf4e2){_0x79f843=_0x79f843-0x0;var _0x5b389c=_0x8e6d[_0x79f843];return _0x5b389c;};'use strict';var Sequelize=require(_0xd8e6('0x0'));module[_0xd8e6('0x1')]={'uniqueid':{'type':Sequelize[_0xd8e6('0x2')]},'type':{'type':Sequelize[_0xd8e6('0x3')](_0xd8e6('0x4'),_0xd8e6('0x5'),_0xd8e6('0x6'),_0xd8e6('0x7'),_0xd8e6('0x8'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xd8e6('0x2')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xd8e6('0x2')]},'destinationcontext':{'type':Sequelize[_0xd8e6('0x2')]},'callerid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xd8e6('0x2')]},'destinationchannel':{'type':Sequelize[_0xd8e6('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xd8e6('0x9')]},'starttime':{'type':Sequelize['DATE']},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xd8e6('0xa')]},'endtime':{'type':Sequelize[_0xd8e6('0xa')]},'duration':{'type':Sequelize[_0xd8e6('0xb')]},'billableseconds':{'type':Sequelize[_0xd8e6('0xb')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xd8e6('0x2')]},'userfield':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize[_0xd8e6('0x2')]},'userSecondDisposition':{'type':Sequelize[_0xd8e6('0x2')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xd8e6('0xb')]},'sipcallid':{'type':Sequelize[_0xd8e6('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 62ae865..8d17e5b 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 _0xe451=['intersection','fields','length','hasOwnProperty','limit','sort','pick','where','map','VIRTUAL','filter','merge','options','VoiceCallReport','fullname','User','rows','show','params','keys','includeAll','find','catch','create','body','describe','uniqueid','updateWithRetry','../../config/logger','status','offset','undefined','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','index','fieldName','key','query','filters','model','attributes'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xe451,0xec));var _0x1e45=function(_0x2ba26a,_0x326fa1){_0x2ba26a=_0x2ba26a-0x0;var _0x3d2460=_0xe451[_0x2ba26a];return _0x3d2460;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x1e45('0x0'))('api');var db=require('../../mysqldb')['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x88df84,_0x363caa){_0x363caa=_0x363caa||0xc8;return function(_0x1f9061){if(_0x1f9061){return _0x88df84[_0x1e45('0x1')](_0x363caa)['json'](_0x1f9061);}};}function respondWithFilteredResult(_0x1d0d45,_0x1a163c){return function(_0x115f88){if(_0x115f88){var _0x563405=typeof _0x1a163c[_0x1e45('0x2')]===_0x1e45('0x3')&&typeof _0x1a163c['limit']==='undefined';var _0x144168=_0x115f88[_0x1e45('0x4')];var _0xde48d9=_0x563405?0x0:_0x1a163c['offset'];var _0x22dbf8=_0x563405?_0x115f88[_0x1e45('0x4')]:_0x1a163c[_0x1e45('0x2')]+_0x1a163c['limit'];var _0x5d25e1;if(_0x22dbf8>=_0x144168){_0x22dbf8=_0x144168;_0x5d25e1=0xc8;}else{_0x5d25e1=0xce;}_0x1d0d45[_0x1e45('0x1')](_0x5d25e1);return _0x1d0d45[_0x1e45('0x5')](_0x1e45('0x6'),_0xde48d9+'-'+_0x22dbf8+'/'+_0x144168)[_0x1e45('0x7')](_0x115f88);}return null;};}function saveUpdates(_0x4f23c5){return function(_0x16cafc){if(_0x16cafc){return _0x16cafc[_0x1e45('0x8')](_0x4f23c5)[_0x1e45('0x9')](function(_0x549c21){return _0x549c21;});}return null;};}function removeEntity(_0x2bee5d){return function(_0x4657c2){if(_0x4657c2){return _0x4657c2[_0x1e45('0xa')]()[_0x1e45('0x9')](function(){_0x2bee5d['status'](0xcc)[_0x1e45('0xb')]();});}};}function handleEntityNotFound(_0x53d31b){return function(_0xf66042){if(!_0xf66042){_0x53d31b[_0x1e45('0xc')](0x194);}return _0xf66042;};}function handleError(_0x4e1400,_0xfdeae3){_0xfdeae3=_0xfdeae3||0x1f4;return function(_0x258249){logger[_0x1e45('0xd')](_0x258249[_0x1e45('0xe')]);if(_0x258249[_0x1e45('0xf')]){delete _0x258249[_0x1e45('0xf')];}_0x4e1400[_0x1e45('0x1')](_0xfdeae3)[_0x1e45('0x10')](_0x258249);};}exports[_0x1e45('0x11')]=function(_0x5d24a7,_0x359dc6){var _0x50a16f={},_0x5129aa={},_0x17c63a={'count':0x0,'rows':[]};var _0x598df4=_['map'](db['VoiceCallReport']['rawAttributes'],function(_0x207335){return{'name':_0x207335[_0x1e45('0x12')],'type':_0x207335['type'][_0x1e45('0x13')]};});_0x5129aa['model']=_['map'](_0x598df4,_0x1e45('0xf'));_0x5129aa['query']=_['keys'](_0x5d24a7[_0x1e45('0x14')]);_0x5129aa[_0x1e45('0x15')]=_['intersection'](_0x5129aa[_0x1e45('0x16')],_0x5129aa[_0x1e45('0x14')]);_0x50a16f[_0x1e45('0x17')]=_[_0x1e45('0x18')](_0x5129aa[_0x1e45('0x16')],qs[_0x1e45('0x19')](_0x5d24a7[_0x1e45('0x14')]['fields']));_0x50a16f[_0x1e45('0x17')]=_0x50a16f[_0x1e45('0x17')][_0x1e45('0x1a')]?_0x50a16f[_0x1e45('0x17')]:_0x5129aa[_0x1e45('0x16')];if(!_0x5d24a7[_0x1e45('0x14')][_0x1e45('0x1b')]('nolimit')){_0x50a16f[_0x1e45('0x1c')]=qs[_0x1e45('0x1c')](_0x5d24a7[_0x1e45('0x14')][_0x1e45('0x1c')]);_0x50a16f['offset']=qs[_0x1e45('0x2')](_0x5d24a7[_0x1e45('0x14')][_0x1e45('0x2')]);}_0x50a16f['order']=qs[_0x1e45('0x1d')](_0x5d24a7['query'][_0x1e45('0x1d')]);_0x50a16f['where']=qs['filters'](_[_0x1e45('0x1e')](_0x5d24a7[_0x1e45('0x14')],_0x5129aa[_0x1e45('0x15')]),_0x598df4);if(_0x5d24a7[_0x1e45('0x14')]['filter']){_0x50a16f[_0x1e45('0x1f')]=_['merge'](_0x50a16f[_0x1e45('0x1f')],{'$or':_[_0x1e45('0x20')](_0x598df4,function(_0x4199a7){if(_0x4199a7['type']!==_0x1e45('0x21')){var _0x435fc2={};_0x435fc2[_0x4199a7[_0x1e45('0xf')]]={'$like':'%'+_0x5d24a7['query'][_0x1e45('0x22')]+'%'};return _0x435fc2;}})});}_0x50a16f=_[_0x1e45('0x23')]({},_0x50a16f,_0x5d24a7[_0x1e45('0x24')]);var _0x7e3795={'where':_0x50a16f['where']};return db[_0x1e45('0x25')][_0x1e45('0x4')](_0x7e3795)[_0x1e45('0x9')](function(_0x141842){_0x17c63a[_0x1e45('0x4')]=_0x141842;if(_0x5d24a7['query']['includeAll']){_0x50a16f['include']=[{'attributes':['id','name',_0x1e45('0x26'),'alias'],'model':db[_0x1e45('0x27')],'as':_0x1e45('0x27')}];}return db['VoiceCallReport']['findAll'](_0x50a16f);})[_0x1e45('0x9')](function(_0x5d9dbe){_0x17c63a[_0x1e45('0x28')]=_0x5d9dbe;return _0x17c63a;})[_0x1e45('0x9')](respondWithFilteredResult(_0x359dc6,_0x50a16f))['catch'](handleError(_0x359dc6,null));};exports[_0x1e45('0x29')]=function(_0x26eef5,_0x3bf799){var _0x2acc3a={'raw':!![],'where':{'id':_0x26eef5[_0x1e45('0x2a')]['id']}},_0x5751e5={};_0x5751e5[_0x1e45('0x16')]=_[_0x1e45('0x2b')](db['VoiceCallReport']['rawAttributes']);_0x5751e5[_0x1e45('0x14')]=_['keys'](_0x26eef5['query']);_0x5751e5[_0x1e45('0x15')]=_['intersection'](_0x5751e5['model'],_0x5751e5[_0x1e45('0x14')]);_0x2acc3a[_0x1e45('0x17')]=_[_0x1e45('0x18')](_0x5751e5[_0x1e45('0x16')],qs[_0x1e45('0x19')](_0x26eef5[_0x1e45('0x14')][_0x1e45('0x19')]));_0x2acc3a[_0x1e45('0x17')]=_0x2acc3a[_0x1e45('0x17')]['length']?_0x2acc3a[_0x1e45('0x17')]:_0x5751e5[_0x1e45('0x16')];if(_0x26eef5[_0x1e45('0x14')][_0x1e45('0x2c')]){_0x2acc3a['include']=[{'all':!![]}];}_0x2acc3a=_[_0x1e45('0x23')]({},_0x2acc3a,_0x26eef5[_0x1e45('0x24')]);return db[_0x1e45('0x25')][_0x1e45('0x2d')](_0x2acc3a)['then'](handleEntityNotFound(_0x3bf799,null))[_0x1e45('0x9')](respondWithResult(_0x3bf799,null))[_0x1e45('0x2e')](handleError(_0x3bf799,null));};exports[_0x1e45('0x2f')]=function(_0x393a50,_0x522b40){return db[_0x1e45('0x25')][_0x1e45('0x2f')](_0x393a50[_0x1e45('0x30')],{})[_0x1e45('0x9')](respondWithResult(_0x522b40,0xc9))[_0x1e45('0x2e')](handleError(_0x522b40,null));};exports[_0x1e45('0xa')]=function(_0x4996fd,_0x2a976e){return db['VoiceCallReport'][_0x1e45('0x2d')]({'where':{'id':_0x4996fd[_0x1e45('0x2a')]['id']}})[_0x1e45('0x9')](handleEntityNotFound(_0x2a976e,null))[_0x1e45('0x9')](removeEntity(_0x2a976e,null))[_0x1e45('0x2e')](handleError(_0x2a976e,null));};exports[_0x1e45('0x31')]=function(_0x5f1853,_0x2e231f){return db[_0x1e45('0x25')][_0x1e45('0x31')]()['then'](respondWithResult(_0x2e231f,null))[_0x1e45('0x2e')](handleError(_0x2e231f,null));};function findForUpdate(_0x2cf050){return db[_0x1e45('0x25')]['find']({'where':{'uniqueid':_0x2cf050['params']['id'],'UserId':{'$or':[null,_0x2cf050['user']['id']]}}});}exports[_0x1e45('0x8')]=function(_0x3830ac,_0x229ef9){if(_0x3830ac[_0x1e45('0x30')]['uniqueid']){delete _0x3830ac[_0x1e45('0x30')][_0x1e45('0x32')];}return findForUpdate(_0x3830ac)[_0x1e45('0x9')](handleEntityNotFound(_0x229ef9,null))[_0x1e45('0x9')](saveUpdates(_0x3830ac[_0x1e45('0x30')],null))['then'](respondWithResult(_0x229ef9,null))[_0x1e45('0x2e')](handleError(_0x229ef9,null));};exports[_0x1e45('0x33')]=function(_0x3436c1,_0x4c4899,_0x26306a){if(_0x3436c1['body'][_0x1e45('0x32')]){delete _0x3436c1[_0x1e45('0x30')][_0x1e45('0x32')];}promiseRetry(function(_0x2d535d){return findForUpdate(_0x3436c1)[_0x1e45('0x9')](function(_0x41e088){if(_0x41e088!==null){return _0x41e088;}else{_0x2d535d(new Error('No\x20such\x20report'));}});},{'retries':0x4,'minTimeout':0xfa})[_0x1e45('0x9')](function(_0x1e0d84){if(!_0x1e0d84){return new Promise(function(_0x57435b){_0x57435b(handleEntityNotFound(_0x4c4899)());});}else{return _0x1e0d84[_0x1e45('0x8')](_0x3436c1['body'])[_0x1e45('0x9')](function(_0x3e6845){return respondWithResult(_0x4c4899)(_0x3e6845);});}},function(){handleEntityNotFound(_0x4c4899)();});}; \ No newline at end of file +var _0xd1f8=['show','params','keys','rawAttributes','options','find','catch','create','describe','update','body','uniqueid','No\x20such\x20report','lodash','../../components/parsers/qs','../../config/logger','api','promise-retry','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','intersection','model','attributes','fields','length','nolimit','sort','where','filters','pick','merge','filter','includeAll','include','User','findAll'];(function(_0x586f40,_0x4cb712){var _0xedde8d=function(_0x2e5cba){while(--_0x2e5cba){_0x586f40['push'](_0x586f40['shift']());}};_0xedde8d(++_0x4cb712);}(_0xd1f8,0x18e));var _0x8d1f=function(_0x2bf888,_0x374f0b){_0x2bf888=_0x2bf888-0x0;var _0x3038d6=_0xd1f8[_0x2bf888];return _0x3038d6;};'use strict';var _=require(_0x8d1f('0x0'));var qs=require(_0x8d1f('0x1'));var logger=require(_0x8d1f('0x2'))(_0x8d1f('0x3'));var db=require('../../mysqldb')['db'];const promiseRetry=require(_0x8d1f('0x4'));function respondWithResult(_0x53ae86,_0x1a317b){_0x1a317b=_0x1a317b||0xc8;return function(_0x4f68b2){if(_0x4f68b2){return _0x53ae86[_0x8d1f('0x5')](_0x1a317b)['json'](_0x4f68b2);}};}function respondWithFilteredResult(_0x3c0543,_0x26d2de){return function(_0x5a17b0){if(_0x5a17b0){var _0x8bd2b8=typeof _0x26d2de[_0x8d1f('0x6')]===_0x8d1f('0x7')&&typeof _0x26d2de[_0x8d1f('0x8')]===_0x8d1f('0x7');var _0x5950c6=_0x5a17b0[_0x8d1f('0x9')];var _0x426673=_0x8bd2b8?0x0:_0x26d2de['offset'];var _0x3044e7=_0x8bd2b8?_0x5a17b0[_0x8d1f('0x9')]:_0x26d2de[_0x8d1f('0x6')]+_0x26d2de[_0x8d1f('0x8')];var _0x10891a;if(_0x3044e7>=_0x5950c6){_0x3044e7=_0x5950c6;_0x10891a=0xc8;}else{_0x10891a=0xce;}_0x3c0543['status'](_0x10891a);return _0x3c0543['set'](_0x8d1f('0xa'),_0x426673+'-'+_0x3044e7+'/'+_0x5950c6)['json'](_0x5a17b0);}return null;};}function saveUpdates(_0x236eaf){return function(_0x38e8bb){if(_0x38e8bb){return _0x38e8bb['update'](_0x236eaf)[_0x8d1f('0xb')](function(_0x2052f6){return _0x2052f6;});}return null;};}function removeEntity(_0x50ccc){return function(_0x5e0805){if(_0x5e0805){return _0x5e0805[_0x8d1f('0xc')]()[_0x8d1f('0xb')](function(){_0x50ccc[_0x8d1f('0x5')](0xcc)[_0x8d1f('0xd')]();});}};}function handleEntityNotFound(_0x63f46a){return function(_0x3ea57a){if(!_0x3ea57a){_0x63f46a[_0x8d1f('0xe')](0x194);}return _0x3ea57a;};}function handleError(_0x1af7e2,_0x2463c9){_0x2463c9=_0x2463c9||0x1f4;return function(_0x2422d0){logger[_0x8d1f('0xf')](_0x2422d0[_0x8d1f('0x10')]);if(_0x2422d0[_0x8d1f('0x11')]){delete _0x2422d0[_0x8d1f('0x11')];}_0x1af7e2[_0x8d1f('0x5')](_0x2463c9)[_0x8d1f('0x12')](_0x2422d0);};}exports[_0x8d1f('0x13')]=function(_0x495655,_0x4c39d9){var _0x1f921a={},_0x44b02e={},_0x1cb538={'count':0x0,'rows':[]};var _0x11948d=_[_0x8d1f('0x14')](db[_0x8d1f('0x15')]['rawAttributes'],function(_0x194fe0){return{'name':_0x194fe0[_0x8d1f('0x16')],'type':_0x194fe0[_0x8d1f('0x17')][_0x8d1f('0x18')]};});_0x44b02e['model']=_['map'](_0x11948d,_0x8d1f('0x11'));_0x44b02e[_0x8d1f('0x19')]=_['keys'](_0x495655[_0x8d1f('0x19')]);_0x44b02e['filters']=_[_0x8d1f('0x1a')](_0x44b02e[_0x8d1f('0x1b')],_0x44b02e[_0x8d1f('0x19')]);_0x1f921a[_0x8d1f('0x1c')]=_[_0x8d1f('0x1a')](_0x44b02e[_0x8d1f('0x1b')],qs[_0x8d1f('0x1d')](_0x495655[_0x8d1f('0x19')][_0x8d1f('0x1d')]));_0x1f921a['attributes']=_0x1f921a[_0x8d1f('0x1c')][_0x8d1f('0x1e')]?_0x1f921a['attributes']:_0x44b02e[_0x8d1f('0x1b')];if(!_0x495655[_0x8d1f('0x19')]['hasOwnProperty'](_0x8d1f('0x1f'))){_0x1f921a[_0x8d1f('0x8')]=qs[_0x8d1f('0x8')](_0x495655['query'][_0x8d1f('0x8')]);_0x1f921a[_0x8d1f('0x6')]=qs[_0x8d1f('0x6')](_0x495655['query'][_0x8d1f('0x6')]);}_0x1f921a['order']=qs['sort'](_0x495655[_0x8d1f('0x19')][_0x8d1f('0x20')]);_0x1f921a[_0x8d1f('0x21')]=qs[_0x8d1f('0x22')](_[_0x8d1f('0x23')](_0x495655[_0x8d1f('0x19')],_0x44b02e[_0x8d1f('0x22')]),_0x11948d);if(_0x495655[_0x8d1f('0x19')]['filter']){_0x1f921a[_0x8d1f('0x21')]=_[_0x8d1f('0x24')](_0x1f921a[_0x8d1f('0x21')],{'$or':_[_0x8d1f('0x14')](_0x11948d,function(_0x1b8af6){if(_0x1b8af6[_0x8d1f('0x17')]!=='VIRTUAL'){var _0x340e44={};_0x340e44[_0x1b8af6[_0x8d1f('0x11')]]={'$like':'%'+_0x495655['query'][_0x8d1f('0x25')]+'%'};return _0x340e44;}})});}_0x1f921a=_[_0x8d1f('0x24')]({},_0x1f921a,_0x495655['options']);var _0x4c33e8={'where':_0x1f921a['where']};return db[_0x8d1f('0x15')][_0x8d1f('0x9')](_0x4c33e8)[_0x8d1f('0xb')](function(_0x24d865){_0x1cb538[_0x8d1f('0x9')]=_0x24d865;if(_0x495655[_0x8d1f('0x19')][_0x8d1f('0x26')]){_0x1f921a[_0x8d1f('0x27')]=[{'attributes':['id','name','fullname','alias'],'model':db[_0x8d1f('0x28')],'as':_0x8d1f('0x28')}];}return db[_0x8d1f('0x15')][_0x8d1f('0x29')](_0x1f921a);})[_0x8d1f('0xb')](function(_0x15e37f){_0x1cb538['rows']=_0x15e37f;return _0x1cb538;})[_0x8d1f('0xb')](respondWithFilteredResult(_0x4c39d9,_0x1f921a))['catch'](handleError(_0x4c39d9,null));};exports[_0x8d1f('0x2a')]=function(_0x256cd0,_0x508fd0){var _0x5cc82d={'raw':!![],'where':{'id':_0x256cd0[_0x8d1f('0x2b')]['id']}},_0x35c5ca={};_0x35c5ca[_0x8d1f('0x1b')]=_[_0x8d1f('0x2c')](db[_0x8d1f('0x15')][_0x8d1f('0x2d')]);_0x35c5ca['query']=_[_0x8d1f('0x2c')](_0x256cd0[_0x8d1f('0x19')]);_0x35c5ca[_0x8d1f('0x22')]=_[_0x8d1f('0x1a')](_0x35c5ca[_0x8d1f('0x1b')],_0x35c5ca[_0x8d1f('0x19')]);_0x5cc82d[_0x8d1f('0x1c')]=_[_0x8d1f('0x1a')](_0x35c5ca[_0x8d1f('0x1b')],qs[_0x8d1f('0x1d')](_0x256cd0[_0x8d1f('0x19')]['fields']));_0x5cc82d[_0x8d1f('0x1c')]=_0x5cc82d[_0x8d1f('0x1c')][_0x8d1f('0x1e')]?_0x5cc82d['attributes']:_0x35c5ca['model'];if(_0x256cd0['query'][_0x8d1f('0x26')]){_0x5cc82d[_0x8d1f('0x27')]=[{'all':!![]}];}_0x5cc82d=_['merge']({},_0x5cc82d,_0x256cd0[_0x8d1f('0x2e')]);return db[_0x8d1f('0x15')][_0x8d1f('0x2f')](_0x5cc82d)[_0x8d1f('0xb')](handleEntityNotFound(_0x508fd0,null))[_0x8d1f('0xb')](respondWithResult(_0x508fd0,null))[_0x8d1f('0x30')](handleError(_0x508fd0,null));};exports[_0x8d1f('0x31')]=function(_0x279e9a,_0x1b8186){return db[_0x8d1f('0x15')][_0x8d1f('0x31')](_0x279e9a['body'],{})[_0x8d1f('0xb')](respondWithResult(_0x1b8186,0xc9))[_0x8d1f('0x30')](handleError(_0x1b8186,null));};exports['destroy']=function(_0x5bf711,_0x396165){return db[_0x8d1f('0x15')][_0x8d1f('0x2f')]({'where':{'id':_0x5bf711['params']['id']}})['then'](handleEntityNotFound(_0x396165,null))['then'](removeEntity(_0x396165,null))['catch'](handleError(_0x396165,null));};exports[_0x8d1f('0x32')]=function(_0x42eee4,_0x581805){return db[_0x8d1f('0x15')]['describe']()['then'](respondWithResult(_0x581805,null))['catch'](handleError(_0x581805,null));};function findForUpdate(_0x295c93){return db[_0x8d1f('0x15')][_0x8d1f('0x2f')]({'where':{'uniqueid':_0x295c93[_0x8d1f('0x2b')]['id'],'UserId':{'$or':[null,_0x295c93['user']['id']]}}});}exports[_0x8d1f('0x33')]=function(_0x546efc,_0x48f639){if(_0x546efc[_0x8d1f('0x34')][_0x8d1f('0x35')]){delete _0x546efc[_0x8d1f('0x34')][_0x8d1f('0x35')];}return findForUpdate(_0x546efc)[_0x8d1f('0xb')](handleEntityNotFound(_0x48f639,null))[_0x8d1f('0xb')](saveUpdates(_0x546efc[_0x8d1f('0x34')],null))[_0x8d1f('0xb')](respondWithResult(_0x48f639,null))[_0x8d1f('0x30')](handleError(_0x48f639,null));};exports['updateWithRetry']=function(_0x8d0dba,_0x31e68d,_0x11cb18){if(_0x8d0dba[_0x8d1f('0x34')][_0x8d1f('0x35')]){delete _0x8d0dba[_0x8d1f('0x34')][_0x8d1f('0x35')];}promiseRetry(function(_0x1d5cce){return findForUpdate(_0x8d0dba)[_0x8d1f('0xb')](function(_0x1c8558){if(_0x1c8558!==null){return _0x1c8558;}else{_0x1d5cce(new Error(_0x8d1f('0x36')));}});},{'retries':0x4,'minTimeout':0xfa})[_0x8d1f('0xb')](function(_0x4027d6){if(!_0x4027d6){return new Promise(function(_0x28114d){_0x28114d(handleEntityNotFound(_0x31e68d)());});}else{return _0x4027d6[_0x8d1f('0x33')](_0x8d0dba[_0x8d1f('0x34')])['then'](function(_0x21a44a){return respondWithResult(_0x31e68d)(_0x21a44a);});}},function(){handleEntityNotFound(_0x31e68d)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1540d7a..3054842 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 _0x32c0=['../../config/environment','exports','define','report_call','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x45769d,_0x45b17b){var _0x5dd379=function(_0x33ab93){while(--_0x33ab93){_0x45769d['push'](_0x45769d['shift']());}};_0x5dd379(++_0x45b17b);}(_0x32c0,0x1f3));var _0x032c=function(_0x355b22,_0x337339){_0x355b22=_0x355b22-0x0;var _0x5039c2=_0x32c0[_0x355b22];return _0x5039c2;};'use strict';var _=require(_0x032c('0x0'));var util=require(_0x032c('0x1'));var logger=require('../../config/logger')(_0x032c('0x2'));var moment=require(_0x032c('0x3'));var BPromise=require('bluebird');var rp=require(_0x032c('0x4'));var fs=require('fs');var path=require(_0x032c('0x5'));var rimraf=require(_0x032c('0x6'));var config=require(_0x032c('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x032c('0x8')]=function(_0x282c50,_0x2d5376){return _0x282c50[_0x032c('0x9')]('VoiceCallReport',attributes,{'tableName':_0x032c('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xad63=['path','../../config/environment','exports','report_call','uniqueid','lodash','util','../../config/logger','moment'];(function(_0xd1cf76,_0x1e667d){var _0x580cbf=function(_0x51dc24){while(--_0x51dc24){_0xd1cf76['push'](_0xd1cf76['shift']());}};_0x580cbf(++_0x1e667d);}(_0xad63,0xf8));var _0x3ad6=function(_0xdbe5a0,_0x123d8b){_0xdbe5a0=_0xdbe5a0-0x0;var _0x2463cc=_0xad63[_0xdbe5a0];return _0x2463cc;};'use strict';var _=require(_0x3ad6('0x0'));var util=require(_0x3ad6('0x1'));var logger=require(_0x3ad6('0x2'))('api');var moment=require(_0x3ad6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3ad6('0x4'));var rimraf=require('rimraf');var config=require(_0x3ad6('0x5'));var attributes=require('./voiceCallReport.attributes');module[_0x3ad6('0x6')]=function(_0x1b973a,_0x3d31aa){return _0x1b973a['define']('VoiceCallReport',attributes,{'tableName':_0x3ad6('0x7'),'paranoid':![],'indexes':[{'fields':[_0x3ad6('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index c8ba2fe..150dbe8 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 _0xd513=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceCallReport','findAll','options','raw','attributes','include','map','model','VoiceCallReport','create','body','CreateVoiceCallReport','debug','UpdateVoiceCallReport','update','where','limit','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0xe84a95,_0x3debeb){var _0x9e5d75=function(_0x72ddb3){while(--_0x72ddb3){_0xe84a95['push'](_0xe84a95['shift']());}};_0x9e5d75(++_0x3debeb);}(_0xd513,0x93));var _0x3d51=function(_0x1f15e2,_0x3d06cb){_0x1f15e2=_0x1f15e2-0x0;var _0xe04b9a=_0xd513[_0x1f15e2];return _0xe04b9a;};'use strict';var _=require('lodash');var util=require(_0x3d51('0x0'));var moment=require('moment');var BPromise=require(_0x3d51('0x1'));var rs=require(_0x3d51('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d51('0x3'))['db'];var utils=require(_0x3d51('0x4'));var logger=require(_0x3d51('0x5'))(_0x3d51('0x6'));var config=require(_0x3d51('0x7'));var jayson=require(_0x3d51('0x8'));var client=jayson[_0x3d51('0x9')][_0x3d51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbc8386,_0x57e69d,_0x7c6087){return new BPromise(function(_0x4a949a,_0x267240){return client[_0x3d51('0xb')](_0xbc8386,_0x7c6087)[_0x3d51('0xc')](function(_0x2f941f){logger[_0x3d51('0xd')](_0x3d51('0xe'),_0x57e69d,'request\x20sent');logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x57e69d,_0x3d51('0xf'),JSON[_0x3d51('0x10')](_0x2f941f));if(_0x2f941f['error']){if(_0x2f941f[_0x3d51('0x11')]['code']===0x1f4){logger[_0x3d51('0x11')](_0x3d51('0xe'),_0x57e69d,_0x2f941f[_0x3d51('0x11')][_0x3d51('0x12')]);return _0x267240(_0x2f941f[_0x3d51('0x11')]['message']);}logger[_0x3d51('0x11')](_0x3d51('0xe'),_0x57e69d,_0x2f941f[_0x3d51('0x11')]['message']);return _0x4a949a(_0x2f941f[_0x3d51('0x11')][_0x3d51('0x12')]);}else{logger[_0x3d51('0xd')](_0x3d51('0xe'),_0x57e69d,'request\x20sent');_0x4a949a(_0x2f941f[_0x3d51('0x13')][_0x3d51('0x12')]);}})[_0x3d51('0x14')](function(_0x2d95ee){logger[_0x3d51('0x11')](_0x3d51('0xe'),_0x57e69d,_0x2d95ee);_0x267240(_0x2d95ee);});});}exports[_0x3d51('0x15')]=function(_0x4db3e9){var _0x290533=this;return new Promise(function(_0x1ccb8b,_0xc130d7){return db['VoiceCallReport'][_0x3d51('0x16')]({'raw':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9[_0x3d51('0x17')][_0x3d51('0x18')]===undefined?!![]:![]:!![],'where':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9[_0x3d51('0x17')]['where']||null:null,'attributes':_0x4db3e9['options']?_0x4db3e9[_0x3d51('0x17')][_0x3d51('0x19')]||null:null,'limit':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9[_0x3d51('0x17')]['limit']||null:null,'include':_0x4db3e9[_0x3d51('0x17')]?_0x4db3e9['options'][_0x3d51('0x1a')]?_[_0x3d51('0x1b')](_0x4db3e9[_0x3d51('0x17')]['include'],function(_0x33bdea){return{'model':db[_0x33bdea['model']],'as':_0x33bdea['as'],'attributes':_0x33bdea['attributes'],'include':_0x33bdea[_0x3d51('0x1a')]?_[_0x3d51('0x1b')](_0x33bdea[_0x3d51('0x1a')],function(_0x4bd828){return{'model':db[_0x4bd828[_0x3d51('0x1c')]],'as':_0x4bd828['as'],'attributes':_0x4bd828[_0x3d51('0x19')],'include':_0x4bd828['include']?_[_0x3d51('0x1b')](_0x4bd828[_0x3d51('0x1a')],function(_0x1c06dd){return{'model':db[_0x1c06dd[_0x3d51('0x1c')]],'as':_0x1c06dd['as'],'attributes':_0x1c06dd[_0x3d51('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3d51('0xc')](function(_0x1437af){logger['info'](_0x3d51('0x15'),_0x4db3e9);logger['debug']('GetVoiceCallReport',_0x4db3e9,JSON[_0x3d51('0x10')](_0x1437af));_0x1ccb8b(_0x1437af);})[_0x3d51('0x14')](function(_0x3f6f42){logger[_0x3d51('0x11')](_0x3d51('0x15'),_0x3f6f42[_0x3d51('0x12')],_0x4db3e9);_0xc130d7(_0x290533['error'](0x1f4,_0x3f6f42[_0x3d51('0x12')]));});});};exports['CreateVoiceCallReport']=function(_0x3797d5){var _0x1535c4=this;return new Promise(function(_0x10f2d5,_0x3cf84b){return db[_0x3d51('0x1d')][_0x3d51('0x1e')](_0x3797d5[_0x3d51('0x1f')],{'raw':_0x3797d5[_0x3d51('0x17')]?_0x3797d5[_0x3d51('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3d51('0xc')](function(_0x17896a){logger[_0x3d51('0xd')](_0x3d51('0x20'),_0x3797d5);logger[_0x3d51('0x21')](_0x3d51('0x20'),_0x3797d5,JSON['stringify'](_0x17896a));_0x10f2d5(_0x17896a);})[_0x3d51('0x14')](function(_0x47041d){logger[_0x3d51('0x11')](_0x3d51('0x20'),_0x47041d[_0x3d51('0x12')],_0x3797d5);_0x3cf84b(_0x1535c4[_0x3d51('0x11')](0x1f4,_0x47041d[_0x3d51('0x12')]));});});};exports[_0x3d51('0x22')]=function(_0x1eee2d){var _0x43e4ec=this;return new Promise(function(_0x7d8110,_0x44a907){return db[_0x3d51('0x1d')][_0x3d51('0x23')](_0x1eee2d[_0x3d51('0x1f')],{'raw':_0x1eee2d[_0x3d51('0x17')]?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1eee2d['options']?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x24')]||null:null,'attributes':_0x1eee2d[_0x3d51('0x17')]?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x19')]||null:null,'limit':_0x1eee2d['options']?_0x1eee2d[_0x3d51('0x17')][_0x3d51('0x25')]||null:null})['then'](function(_0x17a2ed){logger[_0x3d51('0xd')](_0x3d51('0x22'),_0x1eee2d);logger[_0x3d51('0x21')]('UpdateVoiceCallReport',_0x1eee2d,JSON['stringify'](_0x17a2ed));_0x7d8110(_0x17a2ed);})['catch'](function(_0x541776){logger[_0x3d51('0x11')](_0x3d51('0x22'),_0x541776[_0x3d51('0x12')],_0x1eee2d);_0x44a907(_0x43e4ec[_0x3d51('0x11')](0x1f4,_0x541776[_0x3d51('0x12')]));});});}; \ No newline at end of file +var _0x0bc7=['UpdateVoiceCallReport','update','limit','util','moment','randomstring','ioredis','rpc','jayson/promise','client','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','stringify','catch','CreateVoiceCallReport','body'];(function(_0x51c726,_0x332b95){var _0x23fe86=function(_0x3145c8){while(--_0x3145c8){_0x51c726['push'](_0x51c726['shift']());}};_0x23fe86(++_0x332b95);}(_0x0bc7,0x1f2));var _0x70bc=function(_0x1bbff1,_0x542087){_0x1bbff1=_0x1bbff1-0x0;var _0x557ab6=_0x0bc7[_0x1bbff1];return _0x557ab6;};'use strict';var _=require('lodash');var util=require(_0x70bc('0x0'));var moment=require(_0x70bc('0x1'));var BPromise=require('bluebird');var rs=require(_0x70bc('0x2'));var fs=require('fs');var Redis=require(_0x70bc('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x70bc('0x4'));var config=require('../../config/environment');var jayson=require(_0x70bc('0x5'));var client=jayson[_0x70bc('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b9fb0,_0x27c56f,_0x40bf4b){return new BPromise(function(_0x1bb851,_0x32676f){return client[_0x70bc('0x7')](_0x2b9fb0,_0x40bf4b)[_0x70bc('0x8')](function(_0x71c1ea){logger[_0x70bc('0x9')](_0x70bc('0xa'),_0x27c56f,_0x70bc('0xb'));logger[_0x70bc('0xc')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x27c56f,_0x70bc('0xb'),JSON['stringify'](_0x71c1ea));if(_0x71c1ea[_0x70bc('0xd')]){if(_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xe')]===0x1f4){logger[_0x70bc('0xd')](_0x70bc('0xa'),_0x27c56f,_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xf')]);return _0x32676f(_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xf')]);}logger[_0x70bc('0xd')](_0x70bc('0xa'),_0x27c56f,_0x71c1ea[_0x70bc('0xd')][_0x70bc('0xf')]);return _0x1bb851(_0x71c1ea['error'][_0x70bc('0xf')]);}else{logger['info'](_0x70bc('0xa'),_0x27c56f,_0x70bc('0xb'));_0x1bb851(_0x71c1ea['result'][_0x70bc('0xf')]);}})['catch'](function(_0x4efea9){logger[_0x70bc('0xd')](_0x70bc('0xa'),_0x27c56f,_0x4efea9);_0x32676f(_0x4efea9);});});}exports[_0x70bc('0x10')]=function(_0x1dd491){var _0x1146f2=this;return new Promise(function(_0x3dd4e0,_0x48afb3){return db[_0x70bc('0x11')][_0x70bc('0x12')]({'raw':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')][_0x70bc('0x14')]===undefined?!![]:![]:!![],'where':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')][_0x70bc('0x15')]||null:null,'attributes':_0x1dd491[_0x70bc('0x13')]?_0x1dd491['options'][_0x70bc('0x16')]||null:null,'limit':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')]['limit']||null:null,'include':_0x1dd491[_0x70bc('0x13')]?_0x1dd491[_0x70bc('0x13')][_0x70bc('0x17')]?_[_0x70bc('0x18')](_0x1dd491[_0x70bc('0x13')][_0x70bc('0x17')],function(_0x17d0b2){return{'model':db[_0x17d0b2['model']],'as':_0x17d0b2['as'],'attributes':_0x17d0b2['attributes'],'include':_0x17d0b2[_0x70bc('0x17')]?_['map'](_0x17d0b2['include'],function(_0x2111ae){return{'model':db[_0x2111ae[_0x70bc('0x19')]],'as':_0x2111ae['as'],'attributes':_0x2111ae[_0x70bc('0x16')],'include':_0x2111ae['include']?_[_0x70bc('0x18')](_0x2111ae[_0x70bc('0x17')],function(_0x24c62b){return{'model':db[_0x24c62b[_0x70bc('0x19')]],'as':_0x24c62b['as'],'attributes':_0x24c62b[_0x70bc('0x16')]};}):[]};}):[]};}):[]:[]})[_0x70bc('0x8')](function(_0x5c3997){logger[_0x70bc('0x9')]('GetVoiceCallReport',_0x1dd491);logger[_0x70bc('0xc')](_0x70bc('0x10'),_0x1dd491,JSON[_0x70bc('0x1a')](_0x5c3997));_0x3dd4e0(_0x5c3997);})[_0x70bc('0x1b')](function(_0x17f636){logger['error']('GetVoiceCallReport',_0x17f636[_0x70bc('0xf')],_0x1dd491);_0x48afb3(_0x1146f2['error'](0x1f4,_0x17f636[_0x70bc('0xf')]));});});};exports[_0x70bc('0x1c')]=function(_0x57ec58){var _0x5a6549=this;return new Promise(function(_0x5f00f5,_0x174f03){return db[_0x70bc('0x11')]['create'](_0x57ec58[_0x70bc('0x1d')],{'raw':_0x57ec58['options']?_0x57ec58[_0x70bc('0x13')][_0x70bc('0x14')]===undefined?!![]:![]:!![]})[_0x70bc('0x8')](function(_0x1c24bd){logger['info'](_0x70bc('0x1c'),_0x57ec58);logger['debug'](_0x70bc('0x1c'),_0x57ec58,JSON['stringify'](_0x1c24bd));_0x5f00f5(_0x1c24bd);})[_0x70bc('0x1b')](function(_0x56b4b6){logger[_0x70bc('0xd')](_0x70bc('0x1c'),_0x56b4b6[_0x70bc('0xf')],_0x57ec58);_0x174f03(_0x5a6549[_0x70bc('0xd')](0x1f4,_0x56b4b6[_0x70bc('0xf')]));});});};exports[_0x70bc('0x1e')]=function(_0x28f802){var _0x3125c8=this;return new Promise(function(_0x343ec3,_0x842aa9){return db[_0x70bc('0x11')][_0x70bc('0x1f')](_0x28f802[_0x70bc('0x1d')],{'raw':_0x28f802['options']?_0x28f802[_0x70bc('0x13')][_0x70bc('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28f802[_0x70bc('0x13')]?_0x28f802[_0x70bc('0x13')][_0x70bc('0x15')]||null:null,'attributes':_0x28f802[_0x70bc('0x13')]?_0x28f802[_0x70bc('0x13')][_0x70bc('0x16')]||null:null,'limit':_0x28f802['options']?_0x28f802[_0x70bc('0x13')][_0x70bc('0x20')]||null:null})['then'](function(_0x4379f4){logger[_0x70bc('0x9')](_0x70bc('0x1e'),_0x28f802);logger[_0x70bc('0xc')](_0x70bc('0x1e'),_0x28f802,JSON[_0x70bc('0x1a')](_0x4379f4));_0x343ec3(_0x4379f4);})['catch'](function(_0xa33510){logger[_0x70bc('0xd')](_0x70bc('0x1e'),_0xa33510[_0x70bc('0xf')],_0x28f802);_0x842aa9(_0x3125c8[_0x70bc('0xd')](0x1f4,_0xa33510[_0x70bc('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 586ac0f..9f1dd13 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 _0xc565=['connect-timeout','express','Router','fs-extra','../../components/auth/service','get','/:id','isAuthenticated','show','post','put','update','exports','multer','util','path'];(function(_0x568471,_0x4f1f18){var _0x5ee339=function(_0x1ffc18){while(--_0x1ffc18){_0x568471['push'](_0x568471['shift']());}};_0x5ee339(++_0x4f1f18);}(_0xc565,0x14d));var _0x5c56=function(_0x586998,_0x306581){_0x586998=_0x586998-0x0;var _0x3d9891=_0xc565[_0x586998];return _0x3d9891;};'use strict';var multer=require(_0x5c56('0x0'));var util=require(_0x5c56('0x1'));var path=require(_0x5c56('0x2'));var timeout=require(_0x5c56('0x3'));var express=require(_0x5c56('0x4'));var router=express[_0x5c56('0x5')]();var fs_extra=require(_0x5c56('0x6'));var auth=require(_0x5c56('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x5c56('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5c56('0x8')](_0x5c56('0x9'),auth[_0x5c56('0xa')](),controller[_0x5c56('0xb')]);router[_0x5c56('0xc')]('/',auth[_0x5c56('0xa')](),controller['create']);router[_0x5c56('0xd')](_0x5c56('0x9'),auth[_0x5c56('0xa')](),controller[_0x5c56('0xe')]);router['delete'](_0x5c56('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0x5c56('0xf')]=router; \ No newline at end of file +var _0x6d62=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','create','delete','multer','path'];(function(_0x3459d9,_0x49fa44){var _0x572281=function(_0x5242c1){while(--_0x5242c1){_0x3459d9['push'](_0x3459d9['shift']());}};_0x572281(++_0x49fa44);}(_0x6d62,0x85));var _0x26d6=function(_0x11dc39,_0x491115){_0x11dc39=_0x11dc39-0x0;var _0x457277=_0x6d62[_0x11dc39];return _0x457277;};'use strict';var multer=require(_0x26d6('0x0'));var util=require('util');var path=require(_0x26d6('0x1'));var timeout=require(_0x26d6('0x2'));var express=require(_0x26d6('0x3'));var router=express[_0x26d6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x26d6('0x5'));var interaction=require(_0x26d6('0x6'));var config=require(_0x26d6('0x7'));var controller=require(_0x26d6('0x8'));router[_0x26d6('0x9')]('/',auth[_0x26d6('0xa')](),controller[_0x26d6('0xb')]);router['get'](_0x26d6('0xc'),auth[_0x26d6('0xa')](),controller['show']);router['post']('/',auth[_0x26d6('0xa')](),controller[_0x26d6('0xd')]);router['put'](_0x26d6('0xc'),auth[_0x26d6('0xa')](),controller['update']);router[_0x26d6('0xe')](_0x26d6('0xc'),auth[_0x26d6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7b3787c..bceec49 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 _0x0327=['join','getDataValue','split','BOOLEAN','exports','STRING','setDataValue','options'];(function(_0x153d11,_0x3cff42){var _0x5e074f=function(_0x3a256e){while(--_0x3a256e){_0x153d11['push'](_0x153d11['shift']());}};_0x5e074f(++_0x3cff42);}(_0x0327,0x134));var _0x7032=function(_0x500e16,_0x30ec9a){_0x500e16=_0x500e16-0x0;var _0x54f1d1=_0x0327[_0x500e16];return _0x54f1d1;};'use strict';var Sequelize=require('sequelize');module[_0x7032('0x0')]={'name':{'type':Sequelize[_0x7032('0x1')]},'prefix':{'type':Sequelize[_0x7032('0x1')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x7032('0x1')],'set':function(_0x366434){this[_0x7032('0x2')](_0x7032('0x3'),_0x366434?_0x366434[_0x7032('0x4')](''):[]);},'get':function(){return this[_0x7032('0x5')](_0x7032('0x3'))?this['getDataValue'](_0x7032('0x3'))[_0x7032('0x6')](''):[];}},'auth':{'type':Sequelize[_0x7032('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0x7032('0x1')]},'record':{'type':Sequelize[_0x7032('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x7032('0x1')]},'description':{'type':Sequelize[_0x7032('0x1')]}}; \ No newline at end of file +var _0x9668=['split','BOOLEAN','exports','STRING','name','setDataValue','options','join','getDataValue'];(function(_0x27af74,_0x138538){var _0x22f288=function(_0x4699f5){while(--_0x4699f5){_0x27af74['push'](_0x27af74['shift']());}};_0x22f288(++_0x138538);}(_0x9668,0x185));var _0x8966=function(_0x23cc28,_0x357303){_0x23cc28=_0x23cc28-0x0;var _0x31402c=_0x9668[_0x23cc28];return _0x31402c;};'use strict';var Sequelize=require('sequelize');module[_0x8966('0x0')]={'name':{'type':Sequelize[_0x8966('0x1')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x8966('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8966('0x1')],'set':function(_0x3ea1a3){this[_0x8966('0x3')](_0x8966('0x4'),_0x3ea1a3?_0x3ea1a3[_0x8966('0x5')](''):[]);},'get':function(){return this[_0x8966('0x6')](_0x8966('0x4'))?this[_0x8966('0x6')](_0x8966('0x4'))[_0x8966('0x7')](''):[];}},'auth':{'type':Sequelize[_0x8966('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x8966('0x1')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8966('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 5425771..a644e34 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 _0xbb95=['set','Content-Range','apply','save','then','destroy','get','ChanSpies','UserProfileResource','end','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','type','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','options','includeAll','findAll','catch','show','params','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','request-promise','moment','mustache','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/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status'];(function(_0x37af9b,_0x366df3){var _0x3d2a7a=function(_0x42de65){while(--_0x42de65){_0x37af9b['push'](_0x37af9b['shift']());}};_0x3d2a7a(++_0x366df3);}(_0xbb95,0x7f));var _0x5bb9=function(_0x569372,_0x28c66d){_0x569372=_0x569372-0x0;var _0x51c7b3=_0xbb95[_0x569372];return _0x51c7b3;};'use strict';var emlformat=require(_0x5bb9('0x0'));var rimraf=require(_0x5bb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x5bb9('0x2'));var moment=require(_0x5bb9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5bb9('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x5bb9('0x5'));var ejs=require(_0x5bb9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bb9('0x7'));var squel=require(_0x5bb9('0x8'));var crypto=require(_0x5bb9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x5bb9('0xa'));var toCsv=require(_0x5bb9('0x5'));var querystring=require(_0x5bb9('0xb'));var Papa=require(_0x5bb9('0xc'));var Redis=require(_0x5bb9('0xd'));var authService=require(_0x5bb9('0xe'));var qs=require(_0x5bb9('0xf'));var as=require(_0x5bb9('0x10'));var hardwareService=require(_0x5bb9('0x11'));var logger=require(_0x5bb9('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x5bb9('0x13'));var licenseUtil=require(_0x5bb9('0x14'));var db=require(_0x5bb9('0x15'))['db'];function respondWithStatusCode(_0x1ce0d4,_0x2b75af){_0x2b75af=_0x2b75af||0xcc;return function(_0x159e47){if(_0x159e47){return _0x1ce0d4[_0x5bb9('0x16')](_0x2b75af);}return _0x1ce0d4['status'](_0x2b75af)['end']();};}function respondWithResult(_0x41eb45,_0x407a7b){_0x407a7b=_0x407a7b||0xc8;return function(_0x1ebea3){if(_0x1ebea3){return _0x41eb45['status'](_0x407a7b)[_0x5bb9('0x17')](_0x1ebea3);}};}function respondWithFilteredResult(_0x1a382f,_0x582492){return function(_0x1ae28a){if(_0x1ae28a){var _0x29b45c=typeof _0x582492[_0x5bb9('0x18')]===_0x5bb9('0x19')&&typeof _0x582492[_0x5bb9('0x1a')]===_0x5bb9('0x19');var _0x3b9f3c=_0x1ae28a['count'];var _0x16b7ab=_0x29b45c?0x0:_0x582492['offset'];var _0xecb76c=_0x29b45c?_0x1ae28a[_0x5bb9('0x1b')]:_0x582492[_0x5bb9('0x18')]+_0x582492['limit'];var _0x35ccab;if(_0xecb76c>=_0x3b9f3c){_0xecb76c=_0x3b9f3c;_0x35ccab=0xc8;}else{_0x35ccab=0xce;}_0x1a382f[_0x5bb9('0x1c')](_0x35ccab);return _0x1a382f[_0x5bb9('0x1d')](_0x5bb9('0x1e'),_0x16b7ab+'-'+_0xecb76c+'/'+_0x3b9f3c)[_0x5bb9('0x17')](_0x1ae28a);}return null;};}function patchUpdates(_0x2c9b5e){return function(_0x419f27){try{jsonpatch[_0x5bb9('0x1f')](_0x419f27,_0x2c9b5e,!![]);}catch(_0xda0a2e){return BPromise['reject'](_0xda0a2e);}return _0x419f27[_0x5bb9('0x20')]();};}function saveUpdates(_0x51fa3a,_0x1949c1){return function(_0x2d8d84){if(_0x2d8d84){return _0x2d8d84['update'](_0x51fa3a)[_0x5bb9('0x21')](function(_0x46da2e){return _0x46da2e;});}return null;};}function removeEntity(_0x4cd950,_0x1fb206){return function(_0x48c553){if(_0x48c553){return _0x48c553[_0x5bb9('0x22')]()['then'](function(){var _0x4909ea=_0x48c553[_0x5bb9('0x23')]({'plain':!![]});var _0x13a50d=_0x5bb9('0x24');return db[_0x5bb9('0x25')][_0x5bb9('0x22')]({'where':{'type':_0x13a50d,'resourceId':_0x4909ea['id']}})[_0x5bb9('0x21')](function(){return _0x48c553;});})[_0x5bb9('0x21')](function(){_0x4cd950['status'](0xcc)[_0x5bb9('0x26')]();});}};}function handleEntityNotFound(_0x362410,_0x478843){return function(_0x1e9450){if(!_0x1e9450){_0x362410[_0x5bb9('0x16')](0x194);}return _0x1e9450;};}function handleError(_0x91cce7,_0x5287d5){_0x5287d5=_0x5287d5||0x1f4;return function(_0x5b14e5){logger[_0x5bb9('0x27')](_0x5b14e5[_0x5bb9('0x28')]);if(_0x5b14e5['name']){delete _0x5b14e5[_0x5bb9('0x29')];}_0x91cce7[_0x5bb9('0x1c')](_0x5287d5)[_0x5bb9('0x2a')](_0x5b14e5);};}exports[_0x5bb9('0x2b')]=function(_0x4d9902,_0x508842){var _0x5e477f={},_0x56b8b4={},_0x5340e2={'count':0x0,'rows':[]};var _0xdfb304=_[_0x5bb9('0x2c')](db[_0x5bb9('0x2d')][_0x5bb9('0x2e')],function(_0x52124b){return{'name':_0x52124b[_0x5bb9('0x2f')],'type':_0x52124b[_0x5bb9('0x30')]['key']};});_0x56b8b4[_0x5bb9('0x31')]=_['map'](_0xdfb304,'name');_0x56b8b4[_0x5bb9('0x32')]=_[_0x5bb9('0x33')](_0x4d9902['query']);_0x56b8b4['filters']=_['intersection'](_0x56b8b4[_0x5bb9('0x31')],_0x56b8b4[_0x5bb9('0x32')]);_0x5e477f[_0x5bb9('0x34')]=_[_0x5bb9('0x35')](_0x56b8b4[_0x5bb9('0x31')],qs['fields'](_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x36')]));_0x5e477f['attributes']=_0x5e477f['attributes']['length']?_0x5e477f['attributes']:_0x56b8b4[_0x5bb9('0x31')];if(!_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x37')](_0x5bb9('0x38'))){_0x5e477f['limit']=qs[_0x5bb9('0x1a')](_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x1a')]);_0x5e477f[_0x5bb9('0x18')]=qs['offset'](_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x18')]);}_0x5e477f[_0x5bb9('0x39')]=qs[_0x5bb9('0x3a')](_0x4d9902[_0x5bb9('0x32')]['sort']);_0x5e477f[_0x5bb9('0x3b')]=qs['filters'](_[_0x5bb9('0x3c')](_0x4d9902[_0x5bb9('0x32')],_0x56b8b4[_0x5bb9('0x3d')]),_0xdfb304);if(_0x4d9902['query']['filter']){_0x5e477f[_0x5bb9('0x3b')]=_['merge'](_0x5e477f[_0x5bb9('0x3b')],{'$or':_[_0x5bb9('0x2c')](_0xdfb304,function(_0x59eb50){if(_0x59eb50[_0x5bb9('0x30')]!=='VIRTUAL'){var _0x197c89={};_0x197c89[_0x59eb50[_0x5bb9('0x29')]]={'$like':'%'+_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x3e')]+'%'};return _0x197c89;}})});}_0x5e477f=_['merge']({},_0x5e477f,_0x4d9902[_0x5bb9('0x3f')]);var _0x57f373={'where':_0x5e477f[_0x5bb9('0x3b')]};return db[_0x5bb9('0x2d')][_0x5bb9('0x1b')](_0x57f373)['then'](function(_0x29f2f1){_0x5340e2[_0x5bb9('0x1b')]=_0x29f2f1;if(_0x4d9902[_0x5bb9('0x32')][_0x5bb9('0x40')]){_0x5e477f['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x5bb9('0x41')](_0x5e477f);})[_0x5bb9('0x21')](function(_0x1c2a90){_0x5340e2['rows']=_0x1c2a90;return _0x5340e2;})[_0x5bb9('0x21')](respondWithFilteredResult(_0x508842,_0x5e477f))[_0x5bb9('0x42')](handleError(_0x508842,null));};exports[_0x5bb9('0x43')]=function(_0x1a5eaf,_0x256e06){var _0x2eff61={'raw':![],'where':{'id':_0x1a5eaf[_0x5bb9('0x44')]['id']}},_0x518e26={};_0x518e26[_0x5bb9('0x31')]=_['keys'](db[_0x5bb9('0x2d')]['rawAttributes']);_0x518e26[_0x5bb9('0x32')]=_[_0x5bb9('0x33')](_0x1a5eaf[_0x5bb9('0x32')]);_0x518e26[_0x5bb9('0x3d')]=_[_0x5bb9('0x35')](_0x518e26[_0x5bb9('0x31')],_0x518e26[_0x5bb9('0x32')]);_0x2eff61[_0x5bb9('0x34')]=_[_0x5bb9('0x35')](_0x518e26[_0x5bb9('0x31')],qs[_0x5bb9('0x36')](_0x1a5eaf[_0x5bb9('0x32')][_0x5bb9('0x36')]));_0x2eff61['attributes']=_0x2eff61['attributes'][_0x5bb9('0x45')]?_0x2eff61[_0x5bb9('0x34')]:_0x518e26['model'];if(_0x1a5eaf[_0x5bb9('0x32')][_0x5bb9('0x40')]){_0x2eff61['include']=[{'all':!![]}];}_0x2eff61=_[_0x5bb9('0x46')]({},_0x2eff61,_0x1a5eaf['options']);return db[_0x5bb9('0x2d')]['find'](_0x2eff61)[_0x5bb9('0x21')](handleEntityNotFound(_0x256e06,null))['then'](respondWithResult(_0x256e06,null))['catch'](handleError(_0x256e06,null));};exports[_0x5bb9('0x47')]=function(_0x2790f2,_0x262403){return db[_0x5bb9('0x2d')]['create'](_0x2790f2[_0x5bb9('0x48')],{})['then'](function(_0x2c1158){var _0x5ba5df=_0x2790f2[_0x5bb9('0x49')][_0x5bb9('0x23')]({'plain':!![]});if(!_0x5ba5df)throw new Error(_0x5bb9('0x4a'));if(_0x5ba5df['role']===_0x5bb9('0x49')){var _0x1053d1=_0x2c1158[_0x5bb9('0x23')]({'plain':!![]});var _0x174b0c=_0x5bb9('0x24');return db['UserProfileSection']['find']({'where':{'name':_0x174b0c,'userProfileId':_0x5ba5df[_0x5bb9('0x4b')]},'raw':!![]})[_0x5bb9('0x21')](function(_0xa569ab){if(_0xa569ab&&_0xa569ab['autoAssociation']===0x0){return db[_0x5bb9('0x25')][_0x5bb9('0x47')]({'name':_0x1053d1[_0x5bb9('0x29')],'resourceId':_0x1053d1['id'],'type':_0xa569ab[_0x5bb9('0x29')],'sectionId':_0xa569ab['id']},{})[_0x5bb9('0x21')](function(){return _0x2c1158;});}else{return _0x2c1158;}})[_0x5bb9('0x42')](function(_0x436096){logger['error'](_0x5bb9('0x4c'),_0x436096);throw _0x436096;});}return _0x2c1158;})['then'](respondWithResult(_0x262403,0xc9))[_0x5bb9('0x42')](handleError(_0x262403,null));};exports['update']=function(_0x49d1be,_0x58a56c){if(_0x49d1be[_0x5bb9('0x48')]['id']){delete _0x49d1be['body']['id'];}return db['VoiceChanSpy'][_0x5bb9('0x4d')]({'where':{'id':_0x49d1be[_0x5bb9('0x44')]['id']}})['then'](handleEntityNotFound(_0x58a56c,null))['then'](saveUpdates(_0x49d1be[_0x5bb9('0x48')],null))[_0x5bb9('0x21')](respondWithResult(_0x58a56c,null))[_0x5bb9('0x42')](handleError(_0x58a56c,null));};exports[_0x5bb9('0x22')]=function(_0x5c750d,_0x57b13d){return db['VoiceChanSpy'][_0x5bb9('0x4d')]({'where':{'id':_0x5c750d[_0x5bb9('0x44')]['id']}})[_0x5bb9('0x21')](handleEntityNotFound(_0x57b13d,null))['then'](removeEntity(_0x57b13d,null))['catch'](handleError(_0x57b13d,null));}; \ No newline at end of file +var _0x8d53=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','params','destroy','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','update','then','get','ChanSpies','UserProfileResource','error','stack','send','index','VoiceChanSpy','rawAttributes','fieldName','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0xa601a2,_0x47718e){var _0x54af8a=function(_0x20521c){while(--_0x20521c){_0xa601a2['push'](_0xa601a2['shift']());}};_0x54af8a(++_0x47718e);}(_0x8d53,0x1c2));var _0x38d5=function(_0x58803c,_0x4a34df){_0x58803c=_0x58803c-0x0;var _0xf95b9b=_0x8d53[_0x58803c];return _0xf95b9b;};'use strict';var emlformat=require(_0x38d5('0x0'));var rimraf=require(_0x38d5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x38d5('0x2'));var rp=require(_0x38d5('0x3'));var moment=require(_0x38d5('0x4'));var BPromise=require(_0x38d5('0x5'));var Mustache=require(_0x38d5('0x6'));var util=require(_0x38d5('0x7'));var path=require(_0x38d5('0x8'));var sox=require(_0x38d5('0x9'));var csv=require('to-csv');var ejs=require(_0x38d5('0xa'));var fs=require('fs');var fs_extra=require(_0x38d5('0xb'));var _=require(_0x38d5('0xc'));var squel=require('squel');var crypto=require(_0x38d5('0xd'));var jsforce=require(_0x38d5('0xe'));var deskjs=require(_0x38d5('0xf'));var toCsv=require(_0x38d5('0x10'));var querystring=require(_0x38d5('0x11'));var Papa=require('papaparse');var Redis=require(_0x38d5('0x12'));var authService=require(_0x38d5('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x38d5('0x14'));var hardwareService=require(_0x38d5('0x15'));var logger=require(_0x38d5('0x16'))(_0x38d5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x38d5('0x18'));var db=require(_0x38d5('0x19'))['db'];function respondWithStatusCode(_0x53c236,_0x421410){_0x421410=_0x421410||0xcc;return function(_0x4dbccf){if(_0x4dbccf){return _0x53c236[_0x38d5('0x1a')](_0x421410);}return _0x53c236[_0x38d5('0x1b')](_0x421410)[_0x38d5('0x1c')]();};}function respondWithResult(_0x413055,_0x217a90){_0x217a90=_0x217a90||0xc8;return function(_0x3115b5){if(_0x3115b5){return _0x413055['status'](_0x217a90)[_0x38d5('0x1d')](_0x3115b5);}};}function respondWithFilteredResult(_0x4c8f0f,_0xa455d1){return function(_0x53e995){if(_0x53e995){var _0x44cfa8=typeof _0xa455d1[_0x38d5('0x1e')]===_0x38d5('0x1f')&&typeof _0xa455d1['limit']===_0x38d5('0x1f');var _0x2a2b7d=_0x53e995[_0x38d5('0x20')];var _0xdc1374=_0x44cfa8?0x0:_0xa455d1[_0x38d5('0x1e')];var _0x380904=_0x44cfa8?_0x53e995['count']:_0xa455d1[_0x38d5('0x1e')]+_0xa455d1['limit'];var _0x55c0e1;if(_0x380904>=_0x2a2b7d){_0x380904=_0x2a2b7d;_0x55c0e1=0xc8;}else{_0x55c0e1=0xce;}_0x4c8f0f['status'](_0x55c0e1);return _0x4c8f0f[_0x38d5('0x21')](_0x38d5('0x22'),_0xdc1374+'-'+_0x380904+'/'+_0x2a2b7d)[_0x38d5('0x1d')](_0x53e995);}return null;};}function patchUpdates(_0x4c7ce3){return function(_0x48eb53){try{jsonpatch[_0x38d5('0x23')](_0x48eb53,_0x4c7ce3,!![]);}catch(_0x1c5289){return BPromise[_0x38d5('0x24')](_0x1c5289);}return _0x48eb53['save']();};}function saveUpdates(_0x3eb7d1,_0x58d42a){return function(_0x83a6be){if(_0x83a6be){return _0x83a6be[_0x38d5('0x25')](_0x3eb7d1)['then'](function(_0x567ef9){return _0x567ef9;});}return null;};}function removeEntity(_0x34d764,_0x4e1b5f){return function(_0x3d1c85){if(_0x3d1c85){return _0x3d1c85['destroy']()[_0x38d5('0x26')](function(){var _0x469c70=_0x3d1c85[_0x38d5('0x27')]({'plain':!![]});var _0x5b9552=_0x38d5('0x28');return db[_0x38d5('0x29')]['destroy']({'where':{'type':_0x5b9552,'resourceId':_0x469c70['id']}})[_0x38d5('0x26')](function(){return _0x3d1c85;});})[_0x38d5('0x26')](function(){_0x34d764[_0x38d5('0x1b')](0xcc)[_0x38d5('0x1c')]();});}};}function handleEntityNotFound(_0x3d8d86,_0x295591){return function(_0xbe992b){if(!_0xbe992b){_0x3d8d86[_0x38d5('0x1a')](0x194);}return _0xbe992b;};}function handleError(_0x1aed23,_0x2b4349){_0x2b4349=_0x2b4349||0x1f4;return function(_0x33d883){logger[_0x38d5('0x2a')](_0x33d883[_0x38d5('0x2b')]);if(_0x33d883['name']){delete _0x33d883['name'];}_0x1aed23['status'](_0x2b4349)[_0x38d5('0x2c')](_0x33d883);};}exports[_0x38d5('0x2d')]=function(_0x4ff0d4,_0x2f44be){var _0x21f708={},_0x2f18e4={},_0x1ad9ad={'count':0x0,'rows':[]};var _0x448e1b=_['map'](db[_0x38d5('0x2e')][_0x38d5('0x2f')],function(_0x37eb5c){return{'name':_0x37eb5c[_0x38d5('0x30')],'type':_0x37eb5c['type'][_0x38d5('0x31')]};});_0x2f18e4['model']=_[_0x38d5('0x32')](_0x448e1b,'name');_0x2f18e4[_0x38d5('0x33')]=_[_0x38d5('0x34')](_0x4ff0d4['query']);_0x2f18e4[_0x38d5('0x35')]=_[_0x38d5('0x36')](_0x2f18e4[_0x38d5('0x37')],_0x2f18e4['query']);_0x21f708[_0x38d5('0x38')]=_['intersection'](_0x2f18e4[_0x38d5('0x37')],qs[_0x38d5('0x39')](_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x39')]));_0x21f708['attributes']=_0x21f708[_0x38d5('0x38')][_0x38d5('0x3a')]?_0x21f708['attributes']:_0x2f18e4[_0x38d5('0x37')];if(!_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x3b')](_0x38d5('0x3c'))){_0x21f708[_0x38d5('0x3d')]=qs[_0x38d5('0x3d')](_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x3d')]);_0x21f708['offset']=qs[_0x38d5('0x1e')](_0x4ff0d4['query'][_0x38d5('0x1e')]);}_0x21f708[_0x38d5('0x3e')]=qs[_0x38d5('0x3f')](_0x4ff0d4['query']['sort']);_0x21f708[_0x38d5('0x40')]=qs[_0x38d5('0x35')](_[_0x38d5('0x41')](_0x4ff0d4['query'],_0x2f18e4['filters']),_0x448e1b);if(_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x42')]){_0x21f708[_0x38d5('0x40')]=_[_0x38d5('0x43')](_0x21f708['where'],{'$or':_[_0x38d5('0x32')](_0x448e1b,function(_0x36f391){if(_0x36f391[_0x38d5('0x44')]!==_0x38d5('0x45')){var _0x5c45da={};_0x5c45da[_0x36f391['name']]={'$like':'%'+_0x4ff0d4['query'][_0x38d5('0x42')]+'%'};return _0x5c45da;}})});}_0x21f708=_[_0x38d5('0x43')]({},_0x21f708,_0x4ff0d4[_0x38d5('0x46')]);var _0x19f46f={'where':_0x21f708[_0x38d5('0x40')]};return db[_0x38d5('0x2e')]['count'](_0x19f46f)[_0x38d5('0x26')](function(_0x2d8122){_0x1ad9ad[_0x38d5('0x20')]=_0x2d8122;if(_0x4ff0d4[_0x38d5('0x33')][_0x38d5('0x47')]){_0x21f708[_0x38d5('0x48')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x38d5('0x49')](_0x21f708);})[_0x38d5('0x26')](function(_0x48612c){_0x1ad9ad[_0x38d5('0x4a')]=_0x48612c;return _0x1ad9ad;})[_0x38d5('0x26')](respondWithFilteredResult(_0x2f44be,_0x21f708))[_0x38d5('0x4b')](handleError(_0x2f44be,null));};exports[_0x38d5('0x4c')]=function(_0xdfb5fb,_0x22dbf6){var _0x886d40={'raw':![],'where':{'id':_0xdfb5fb['params']['id']}},_0x26d79a={};_0x26d79a[_0x38d5('0x37')]=_['keys'](db['VoiceChanSpy'][_0x38d5('0x2f')]);_0x26d79a['query']=_['keys'](_0xdfb5fb['query']);_0x26d79a['filters']=_['intersection'](_0x26d79a['model'],_0x26d79a['query']);_0x886d40['attributes']=_[_0x38d5('0x36')](_0x26d79a[_0x38d5('0x37')],qs[_0x38d5('0x39')](_0xdfb5fb[_0x38d5('0x33')][_0x38d5('0x39')]));_0x886d40[_0x38d5('0x38')]=_0x886d40[_0x38d5('0x38')][_0x38d5('0x3a')]?_0x886d40[_0x38d5('0x38')]:_0x26d79a[_0x38d5('0x37')];if(_0xdfb5fb[_0x38d5('0x33')][_0x38d5('0x47')]){_0x886d40[_0x38d5('0x48')]=[{'all':!![]}];}_0x886d40=_[_0x38d5('0x43')]({},_0x886d40,_0xdfb5fb[_0x38d5('0x46')]);return db[_0x38d5('0x2e')][_0x38d5('0x4d')](_0x886d40)[_0x38d5('0x26')](handleEntityNotFound(_0x22dbf6,null))[_0x38d5('0x26')](respondWithResult(_0x22dbf6,null))['catch'](handleError(_0x22dbf6,null));};exports['create']=function(_0x4bdd78,_0x91cd1d){return db[_0x38d5('0x2e')][_0x38d5('0x4e')](_0x4bdd78[_0x38d5('0x4f')],{})[_0x38d5('0x26')](function(_0xe1cce1){var _0x83ccd6=_0x4bdd78[_0x38d5('0x50')][_0x38d5('0x27')]({'plain':!![]});if(!_0x83ccd6)throw new Error(_0x38d5('0x51'));if(_0x83ccd6[_0x38d5('0x52')]===_0x38d5('0x50')){var _0x2810c4=_0xe1cce1[_0x38d5('0x27')]({'plain':!![]});var _0x584829=_0x38d5('0x28');return db[_0x38d5('0x53')][_0x38d5('0x4d')]({'where':{'name':_0x584829,'userProfileId':_0x83ccd6[_0x38d5('0x54')]},'raw':!![]})['then'](function(_0x2140fe){if(_0x2140fe&&_0x2140fe['autoAssociation']===0x0){return db['UserProfileResource'][_0x38d5('0x4e')]({'name':_0x2810c4[_0x38d5('0x55')],'resourceId':_0x2810c4['id'],'type':_0x2140fe[_0x38d5('0x55')],'sectionId':_0x2140fe['id']},{})[_0x38d5('0x26')](function(){return _0xe1cce1;});}else{return _0xe1cce1;}})[_0x38d5('0x4b')](function(_0x50f422){logger[_0x38d5('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x50f422);throw _0x50f422;});}return _0xe1cce1;})[_0x38d5('0x26')](respondWithResult(_0x91cd1d,0xc9))[_0x38d5('0x4b')](handleError(_0x91cd1d,null));};exports['update']=function(_0x544f9c,_0x522d13){if(_0x544f9c[_0x38d5('0x4f')]['id']){delete _0x544f9c['body']['id'];}return db[_0x38d5('0x2e')][_0x38d5('0x4d')]({'where':{'id':_0x544f9c[_0x38d5('0x56')]['id']}})[_0x38d5('0x26')](handleEntityNotFound(_0x522d13,null))[_0x38d5('0x26')](saveUpdates(_0x544f9c[_0x38d5('0x4f')],null))[_0x38d5('0x26')](respondWithResult(_0x522d13,null))[_0x38d5('0x4b')](handleError(_0x522d13,null));};exports[_0x38d5('0x57')]=function(_0x53cea9,_0x303dd8){return db['VoiceChanSpy'][_0x38d5('0x4d')]({'where':{'id':_0x53cea9[_0x38d5('0x56')]['id']}})['then'](handleEntityNotFound(_0x303dd8,null))['then'](removeEntity(_0x303dd8,null))[_0x38d5('0x4b')](handleError(_0x303dd8,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 2fe814d..0e5a436 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 _0xed4e=['Set','merge','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','join','record','StopMixMonitor','length','concat','internal','name','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','destroy','bulkCreate','lodash','./voiceChanSpy.attributes','context','from-sip','format','%s%s','prefix','system','push'];(function(_0x3c8c38,_0x277bc6){var _0x1edcab=function(_0x90dee3){while(--_0x90dee3){_0x3c8c38['push'](_0x3c8c38['shift']());}};_0x1edcab(++_0x277bc6);}(_0xed4e,0x1b3));var _0xeed4=function(_0x4e1657,_0x30c205){_0x4e1657=_0x4e1657-0x0;var _0x5eb21a=_0xed4e[_0x4e1657];return _0x5eb21a;};'use strict';var _=require(_0xeed4('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0xeed4('0x1'));var getUserApplications=function(_0x4d13cb,_0x48d51f,_0x5902fe){var _0x2f32be=0x1;var _0x3599d3=[];var _0x699fbb={'context':_0x48d51f[_0xeed4('0x2')]||_0xeed4('0x3'),'exten':util[_0xeed4('0x4')](_0xeed4('0x5'),_0x4d13cb[_0xeed4('0x6')],_0x5902fe),'type':_0xeed4('0x7'),'isApp':![],'ChanSpyId':_0x4d13cb['id'],'UserId':_0x48d51f['id']};_0x3599d3[_0xeed4('0x8')](_['merge']({'app':_0xeed4('0x9'),'appdata':util[_0xeed4('0x4')]('CDR(type)=%s','chanspy'),'priority':_0x2f32be++},_0x699fbb));if(_0x4d13cb['record']){_0x3599d3['push'](_[_0xeed4('0xa')]({'app':'MixMonitor','appdata':util[_0xeed4('0x4')](_0xeed4('0xb'),_0x4d13cb[_0xeed4('0xc')]),'priority':_0x2f32be++},_0x699fbb));}if(_0x4d13cb[_0xeed4('0xd')]){_0x3599d3[_0xeed4('0x8')](_[_0xeed4('0xa')]({'app':_0xeed4('0xe'),'appdata':_0x4d13cb[_0xeed4('0xf')],'priority':_0x2f32be++},_0x699fbb));}_0x3599d3[_0xeed4('0x8')](_[_0xeed4('0xa')]({'app':_0xeed4('0x10'),'appdata':util[_0xeed4('0x4')](_0xeed4('0x11'),_0x48d51f['name'],_0x4d13cb[_0xeed4('0x12')]?_0x4d13cb[_0xeed4('0x12')][_0xeed4('0x13')](''):''),'priority':_0x2f32be++},_0x699fbb));if(_0x4d13cb[_0xeed4('0x14')]){_0x3599d3[_0xeed4('0x8')](_['merge']({'app':_0xeed4('0x15'),'priority':_0x2f32be++},_0x699fbb));}return _0x3599d3;};var getChanSpyApplications=function(_0x149c7c,_0x174f93){var _0xbfc710=[];for(var _0x36b153=0x0,_0x2b8c16=0x1;_0x36b153<_0x174f93[_0xeed4('0x16')];_0x36b153++,_0x2b8c16=0x1){_0xbfc710=_0xbfc710[_0xeed4('0x17')](getUserApplications(_0x149c7c,_0x174f93[_0x36b153],_0x174f93[_0x36b153][_0xeed4('0x18')]));if(_0x174f93[_0x36b153][_0xeed4('0x18')]!=_0x174f93[_0x36b153][_0xeed4('0x19')]){_0xbfc710=_0xbfc710[_0xeed4('0x17')](getUserApplications(_0x149c7c,_0x174f93[_0x36b153],_0x174f93[_0x36b153][_0xeed4('0x19')]));}}return _0xbfc710;};var getChanSpyPromise=function(_0xeaa3ae,_0x182167){return new BPromise(function(_0xa14065,_0xd2cbbc){return _0xeaa3ae['User']['findAll']({'attributes':['id',_0xeed4('0x19'),'internal'],'where':{'role':_0xeed4('0x1a'),'chanspy':!![]},'raw':!![]})[_0xeed4('0x1b')](function(_0x37dc77){if(_0x37dc77){return _0xa14065(getChanSpyApplications(_0x182167,_0x37dc77));}return _0xa14065([]);})[_0xeed4('0x1c')](function(_0x33f012){_0xd2cbbc(_0x33f012);});});};module[_0xeed4('0x1d')]=function(_0x4c9497,_0x840572){var _0x10998a=_0x4c9497[_0xeed4('0x1e')];return _0x4c9497[_0xeed4('0x1f')](_0xeed4('0x20'),attributes,{'tableName':_0xeed4('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x58ff97,_0x318a8c,_0x2f803b){return getChanSpyPromise(_0x10998a,_0x58ff97)[_0xeed4('0x1b')](function(_0x3da535){if(_0x3da535&&_0x3da535[_0xeed4('0x16')]){return _0x10998a[_0xeed4('0x22')]['bulkCreate'](_0x3da535);}})[_0xeed4('0x1b')](function(){_0x2f803b();})[_0xeed4('0x1c')](function(_0x406185){_0x2f803b(_0x406185);});},'afterUpdate':function(_0x31a5bd,_0x20333d,_0x8925d6){return _0x10998a[_0xeed4('0x22')][_0xeed4('0x23')]({'where':{'ChanSpyId':_0x31a5bd['id']}})['then'](function(){return getChanSpyPromise(_0x10998a,_0x31a5bd);})[_0xeed4('0x1b')](function(_0xa30160){if(_0xa30160&&_0xa30160['length']){return _0x10998a[_0xeed4('0x22')][_0xeed4('0x24')](_0xa30160);}})[_0xeed4('0x1b')](function(){_0x8925d6();})[_0xeed4('0x1c')](function(_0xc940ae){_0x8925d6(_0xc940ae);});},'afterDestroy':function(_0x179d67,_0x1b99f3,_0x314dd0){return _0x10998a[_0xeed4('0x22')]['destroy']({'where':{'ChanSpyId':_0x179d67['id']}})[_0xeed4('0x1b')](function(){_0x314dd0();})[_0xeed4('0x1c')](function(_0x62f2bb){_0x314dd0(_0x62f2bb);});}}});}; \ No newline at end of file +var _0x71d0=['internal','name','findAll','agent','catch','models','define','VoiceChanSpy','voice_chanspy','bulkCreate','then','VoiceExtension','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip','format','%s%s','push','Set','CDR(type)=%s','chanspy','record','merge','recordingFormat','auth','Authenticate','password','ChanSpy','options','join','StopMixMonitor','length','concat'];(function(_0x191b56,_0xfd47a6){var _0x21362a=function(_0x260cc7){while(--_0x260cc7){_0x191b56['push'](_0x191b56['shift']());}};_0x21362a(++_0xfd47a6);}(_0x71d0,0x1a4));var _0x071d=function(_0x4a4d71,_0x1d4d72){_0x4a4d71=_0x4a4d71-0x0;var _0x2f1f18=_0x71d0[_0x4a4d71];return _0x2f1f18;};'use strict';var _=require(_0x071d('0x0'));var util=require(_0x071d('0x1'));var BPromise=require(_0x071d('0x2'));var attributes=require(_0x071d('0x3'));var getUserApplications=function(_0x497afb,_0x4ffa27,_0x337cc7){var _0x8c1d18=0x1;var _0x57803a=[];var _0x5e2653={'context':_0x4ffa27[_0x071d('0x4')]||_0x071d('0x5'),'exten':util[_0x071d('0x6')](_0x071d('0x7'),_0x497afb['prefix'],_0x337cc7),'type':'system','isApp':![],'ChanSpyId':_0x497afb['id'],'UserId':_0x4ffa27['id']};_0x57803a[_0x071d('0x8')](_['merge']({'app':_0x071d('0x9'),'appdata':util['format'](_0x071d('0xa'),_0x071d('0xb')),'priority':_0x8c1d18++},_0x5e2653));if(_0x497afb[_0x071d('0xc')]){_0x57803a[_0x071d('0x8')](_[_0x071d('0xd')]({'app':'MixMonitor','appdata':util[_0x071d('0x6')]('${UNIQUEID}.%s,a',_0x497afb[_0x071d('0xe')]),'priority':_0x8c1d18++},_0x5e2653));}if(_0x497afb[_0x071d('0xf')]){_0x57803a[_0x071d('0x8')](_[_0x071d('0xd')]({'app':_0x071d('0x10'),'appdata':_0x497afb[_0x071d('0x11')],'priority':_0x8c1d18++},_0x5e2653));}_0x57803a['push'](_[_0x071d('0xd')]({'app':_0x071d('0x12'),'appdata':util[_0x071d('0x6')]('SIP/%s,%s',_0x4ffa27['name'],_0x497afb[_0x071d('0x13')]?_0x497afb[_0x071d('0x13')][_0x071d('0x14')](''):''),'priority':_0x8c1d18++},_0x5e2653));if(_0x497afb[_0x071d('0xc')]){_0x57803a[_0x071d('0x8')](_[_0x071d('0xd')]({'app':_0x071d('0x15'),'priority':_0x8c1d18++},_0x5e2653));}return _0x57803a;};var getChanSpyApplications=function(_0x3ed177,_0x340281){var _0x2fe427=[];for(var _0x2d10fb=0x0,_0xce8357=0x1;_0x2d10fb<_0x340281[_0x071d('0x16')];_0x2d10fb++,_0xce8357=0x1){_0x2fe427=_0x2fe427[_0x071d('0x17')](getUserApplications(_0x3ed177,_0x340281[_0x2d10fb],_0x340281[_0x2d10fb][_0x071d('0x18')]));if(_0x340281[_0x2d10fb]['internal']!=_0x340281[_0x2d10fb][_0x071d('0x19')]){_0x2fe427=_0x2fe427['concat'](getUserApplications(_0x3ed177,_0x340281[_0x2d10fb],_0x340281[_0x2d10fb]['name']));}}return _0x2fe427;};var getChanSpyPromise=function(_0xc5e580,_0x1b6966){return new BPromise(function(_0xda9680,_0x2fe1a9){return _0xc5e580['User'][_0x071d('0x1a')]({'attributes':['id','name',_0x071d('0x18')],'where':{'role':_0x071d('0x1b'),'chanspy':!![]},'raw':!![]})['then'](function(_0x3718bb){if(_0x3718bb){return _0xda9680(getChanSpyApplications(_0x1b6966,_0x3718bb));}return _0xda9680([]);})[_0x071d('0x1c')](function(_0x152ba6){_0x2fe1a9(_0x152ba6);});});};module['exports']=function(_0x40b5e3,_0xe0d280){var _0x335a3f=_0x40b5e3[_0x071d('0x1d')];return _0x40b5e3[_0x071d('0x1e')](_0x071d('0x1f'),attributes,{'tableName':_0x071d('0x20'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5d6125,_0x210659,_0x49d72a){return getChanSpyPromise(_0x335a3f,_0x5d6125)['then'](function(_0x438ade){if(_0x438ade&&_0x438ade[_0x071d('0x16')]){return _0x335a3f['VoiceExtension'][_0x071d('0x21')](_0x438ade);}})[_0x071d('0x22')](function(){_0x49d72a();})[_0x071d('0x1c')](function(_0x53c885){_0x49d72a(_0x53c885);});},'afterUpdate':function(_0x4d0a15,_0x29ef17,_0x255131){return _0x335a3f[_0x071d('0x23')][_0x071d('0x24')]({'where':{'ChanSpyId':_0x4d0a15['id']}})[_0x071d('0x22')](function(){return getChanSpyPromise(_0x335a3f,_0x4d0a15);})[_0x071d('0x22')](function(_0x1b91ca){if(_0x1b91ca&&_0x1b91ca['length']){return _0x335a3f[_0x071d('0x23')][_0x071d('0x21')](_0x1b91ca);}})[_0x071d('0x22')](function(){_0x255131();})[_0x071d('0x1c')](function(_0x6251fb){_0x255131(_0x6251fb);});},'afterDestroy':function(_0x38fd53,_0x4f3a3a,_0x500149){return _0x335a3f[_0x071d('0x23')]['destroy']({'where':{'ChanSpyId':_0x38fd53['id']}})[_0x071d('0x22')](function(){_0x500149();})[_0x071d('0x1c')](function(_0x314d21){_0x500149(_0x314d21);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index b6ad03d..9f5d531 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 _0x16d2=['../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x16d2,0x123));var _0x216d=function(_0x168389,_0x19b2fe){_0x168389=_0x168389-0x0;var _0x4a264d=_0x16d2[_0x168389];return _0x4a264d;};'use strict';var _=require(_0x216d('0x0'));var util=require(_0x216d('0x1'));var moment=require(_0x216d('0x2'));var BPromise=require(_0x216d('0x3'));var rs=require(_0x216d('0x4'));var fs=require('fs');var Redis=require(_0x216d('0x5'));var db=require(_0x216d('0x6'))['db'];var utils=require(_0x216d('0x7'));var logger=require(_0x216d('0x8'))('rpc');var config=require(_0x216d('0x9'));var jayson=require(_0x216d('0xa'));var client=jayson[_0x216d('0xb')][_0x216d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1dd8e2,_0x24c831,_0x3e0ada){return new BPromise(function(_0x28da14,_0x57accc){return client[_0x216d('0xd')](_0x1dd8e2,_0x3e0ada)[_0x216d('0xe')](function(_0x35abcf){logger[_0x216d('0xf')](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));logger['debug'](_0x216d('0x12'),_0x24c831,'request\x20sent',JSON[_0x216d('0x13')](_0x35abcf));if(_0x35abcf[_0x216d('0x14')]){if(_0x35abcf[_0x216d('0x14')][_0x216d('0x15')]===0x1f4){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x35abcf['error'][_0x216d('0x16')]);return _0x57accc(_0x35abcf['error'][_0x216d('0x16')]);}logger[_0x216d('0x14')]('VoiceChanSpy,\x20%s,\x20%s',_0x24c831,_0x35abcf[_0x216d('0x14')][_0x216d('0x16')]);return _0x28da14(_0x35abcf['error'][_0x216d('0x16')]);}else{logger['info'](_0x216d('0x10'),_0x24c831,_0x216d('0x11'));_0x28da14(_0x35abcf[_0x216d('0x17')][_0x216d('0x16')]);}})[_0x216d('0x18')](function(_0x304dfa){logger[_0x216d('0x14')](_0x216d('0x10'),_0x24c831,_0x304dfa);_0x57accc(_0x304dfa);});});} \ No newline at end of file +var _0x1ba2=['message','info','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x1ba2,0xb4));var _0x21ba=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1ba2[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x21ba('0x0'));var util=require('util');var moment=require(_0x21ba('0x1'));var BPromise=require('bluebird');var rs=require(_0x21ba('0x2'));var fs=require('fs');var Redis=require(_0x21ba('0x3'));var db=require(_0x21ba('0x4'))['db'];var utils=require(_0x21ba('0x5'));var logger=require(_0x21ba('0x6'))('rpc');var config=require(_0x21ba('0x7'));var jayson=require(_0x21ba('0x8'));var client=jayson['client'][_0x21ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53b3e0,_0x44eb71,_0x23c3b7){return new BPromise(function(_0x5c50aa,_0x17755a){return client['request'](_0x53b3e0,_0x23c3b7)[_0x21ba('0xa')](function(_0x261a15){logger['info'](_0x21ba('0xb'),_0x44eb71,_0x21ba('0xc'));logger[_0x21ba('0xd')](_0x21ba('0xe'),_0x44eb71,_0x21ba('0xc'),JSON[_0x21ba('0xf')](_0x261a15));if(_0x261a15[_0x21ba('0x10')]){if(_0x261a15[_0x21ba('0x10')][_0x21ba('0x11')]===0x1f4){logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15[_0x21ba('0x10')]['message']);return _0x17755a(_0x261a15['error'][_0x21ba('0x12')]);}logger[_0x21ba('0x10')](_0x21ba('0xb'),_0x44eb71,_0x261a15['error']['message']);return _0x5c50aa(_0x261a15[_0x21ba('0x10')]['message']);}else{logger[_0x21ba('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x44eb71,_0x21ba('0xc'));_0x5c50aa(_0x261a15[_0x21ba('0x14')][_0x21ba('0x12')]);}})[_0x21ba('0x15')](function(_0x10b9e6){logger['error'](_0x21ba('0xb'),_0x44eb71,_0x10b9e6);_0x17755a(_0x10b9e6);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 9809ab6..f19a516 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 _0xb4a9=['show','post','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceContext.controller','index','get','/:id','isAuthenticated'];(function(_0x4e0d45,_0x55f937){var _0xb25758=function(_0x18d517){while(--_0x18d517){_0x4e0d45['push'](_0x4e0d45['shift']());}};_0xb25758(++_0x55f937);}(_0xb4a9,0x1a7));var _0x9b4a=function(_0x16a620,_0x30a33b){_0x16a620=_0x16a620-0x0;var _0x251797=_0xb4a9[_0x16a620];return _0x251797;};'use strict';var multer=require(_0x9b4a('0x0'));var util=require(_0x9b4a('0x1'));var path=require(_0x9b4a('0x2'));var timeout=require(_0x9b4a('0x3'));var express=require(_0x9b4a('0x4'));var router=express[_0x9b4a('0x5')]();var fs_extra=require(_0x9b4a('0x6'));var auth=require(_0x9b4a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x9b4a('0x8'));var controller=require(_0x9b4a('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b4a('0xa')]);router[_0x9b4a('0xb')](_0x9b4a('0xc'),auth[_0x9b4a('0xd')](),controller[_0x9b4a('0xe')]);router[_0x9b4a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x9b4a('0xc'),auth['isAuthenticated'](),controller[_0x9b4a('0x10')]);router[_0x9b4a('0x11')]('/:id',auth[_0x9b4a('0xd')](),controller[_0x9b4a('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8ec1=['exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy'];(function(_0x1c7579,_0x857b0c){var _0x4773aa=function(_0x33525e){while(--_0x33525e){_0x1c7579['push'](_0x1c7579['shift']());}};_0x4773aa(++_0x857b0c);}(_0x8ec1,0x79));var _0x18ec=function(_0x4528cf,_0x3b1892){_0x4528cf=_0x4528cf-0x0;var _0x4bca53=_0x8ec1[_0x4528cf];return _0x4bca53;};'use strict';var multer=require(_0x18ec('0x0'));var util=require('util');var path=require(_0x18ec('0x1'));var timeout=require(_0x18ec('0x2'));var express=require(_0x18ec('0x3'));var router=express['Router']();var fs_extra=require(_0x18ec('0x4'));var auth=require(_0x18ec('0x5'));var interaction=require(_0x18ec('0x6'));var config=require(_0x18ec('0x7'));var controller=require('./voiceContext.controller');router[_0x18ec('0x8')]('/',auth['isAuthenticated'](),controller[_0x18ec('0x9')]);router[_0x18ec('0x8')](_0x18ec('0xa'),auth[_0x18ec('0xb')](),controller[_0x18ec('0xc')]);router[_0x18ec('0xd')]('/',auth[_0x18ec('0xb')](),controller[_0x18ec('0xe')]);router[_0x18ec('0xf')](_0x18ec('0xa'),auth['isAuthenticated'](),controller[_0x18ec('0x10')]);router[_0x18ec('0x11')](_0x18ec('0xa'),auth['isAuthenticated'](),controller[_0x18ec('0x12')]);module[_0x18ec('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 a775cbf..21168d6 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 _0xf78d=['sequelize','exports','STRING','name','BOOLEAN'];(function(_0x1deb03,_0xd05ad8){var _0x189fe7=function(_0x321225){while(--_0x321225){_0x1deb03['push'](_0x1deb03['shift']());}};_0x189fe7(++_0xd05ad8);}(_0xf78d,0xdc));var _0xdf78=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf78d[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xdf78('0x0'));module[_0xdf78('0x1')]={'name':{'type':Sequelize[_0xdf78('0x2')],'unique':_0xdf78('0x3')},'description':{'type':Sequelize[_0xdf78('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xdf78('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x896e=['BOOLEAN','sequelize','exports','STRING'];(function(_0x4fb224,_0x5f382e){var _0x4b92d8=function(_0x478f54){while(--_0x478f54){_0x4fb224['push'](_0x4fb224['shift']());}};_0x4b92d8(++_0x5f382e);}(_0x896e,0x181));var _0xe896=function(_0x25a079,_0xe698ab){_0x25a079=_0x25a079-0x0;var _0x107706=_0x896e[_0x25a079];return _0x107706;};'use strict';var Sequelize=require(_0xe896('0x0'));module[_0xe896('0x1')]={'name':{'type':Sequelize[_0xe896('0x2')],'unique':'name'},'description':{'type':Sequelize[_0xe896('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xe896('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 08db90a..5c143a4 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 _0x4785=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','utf8','render','Reload','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','set','Content-Range','save','update','destroy','get','Contexts','stack','name','index','VoiceContext','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','show','params','create','readFileSync','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','chan_sip.so','user','role','UserProfileSection','find'];(function(_0x1031c7,_0x4d9887){var _0x6758e3=function(_0x5dc3a7){while(--_0x5dc3a7){_0x1031c7['push'](_0x1031c7['shift']());}};_0x6758e3(++_0x4d9887);}(_0x4785,0x1a8));var _0x5478=function(_0x5a6744,_0x144876){_0x5a6744=_0x5a6744-0x0;var _0xff7177=_0x4785[_0x5a6744];return _0xff7177;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5478('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5478('0x1'));var rp=require(_0x5478('0x2'));var moment=require(_0x5478('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5478('0x4'));var util=require(_0x5478('0x5'));var path=require('path');var sox=require(_0x5478('0x6'));var csv=require(_0x5478('0x7'));var ejs=require(_0x5478('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5478('0x9'));var crypto=require(_0x5478('0xa'));var jsforce=require(_0x5478('0xb'));var deskjs=require(_0x5478('0xc'));var toCsv=require(_0x5478('0x7'));var querystring=require(_0x5478('0xd'));var Papa=require(_0x5478('0xe'));var Redis=require(_0x5478('0xf'));var authService=require(_0x5478('0x10'));var qs=require(_0x5478('0x11'));var as=require(_0x5478('0x12'));var hardwareService=require(_0x5478('0x13'));var logger=require(_0x5478('0x14'))('api');var utils=require(_0x5478('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5478('0x16'));var db=require('../../mysqldb')['db'];var jayson=require(_0x5478('0x17'));var client=jayson[_0x5478('0x18')][_0x5478('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x5750a7,_0x58ed32,_0x5b1bf5,_0x5872c4){return new BPromise(function(_0x6d73b5,_0x43b7ad){var _0x11272c=_0x5872c4||client;return _0x11272c[_0x5478('0x1a')](_0x5750a7,_0x5b1bf5)[_0x5478('0x1b')](function(_0x42da1c){logger[_0x5478('0x1c')](_0x5478('0x1d'),_0x58ed32,'request\x20sent');logger[_0x5478('0x1e')](_0x5478('0x1f'),_0x58ed32,_0x5478('0x20'),JSON[_0x5478('0x21')](_0x42da1c));if(_0x42da1c[_0x5478('0x22')]){if(_0x42da1c[_0x5478('0x22')][_0x5478('0x23')]===0x1f4){logger[_0x5478('0x22')](_0x5478('0x1d'),_0x58ed32,_0x42da1c['error'][_0x5478('0x24')]);return _0x43b7ad(_0x42da1c[_0x5478('0x22')][_0x5478('0x24')]);}logger[_0x5478('0x22')](_0x5478('0x1d'),_0x58ed32,_0x42da1c[_0x5478('0x22')][_0x5478('0x24')]);return _0x6d73b5(_0x42da1c[_0x5478('0x22')][_0x5478('0x24')]);}else{logger[_0x5478('0x1c')](_0x5478('0x1d'),_0x58ed32,_0x5478('0x20'));_0x6d73b5(_0x42da1c[_0x5478('0x25')][_0x5478('0x24')]);}})[_0x5478('0x26')](function(_0x2e0b76){logger['error'](_0x5478('0x1d'),_0x58ed32,_0x2e0b76);_0x43b7ad(_0x2e0b76);});});}function respondWithStatusCode(_0x4959a3,_0x17c20e){_0x17c20e=_0x17c20e||0xcc;return function(_0x119e7b){if(_0x119e7b){return _0x4959a3[_0x5478('0x27')](_0x17c20e);}return _0x4959a3[_0x5478('0x28')](_0x17c20e)[_0x5478('0x29')]();};}function respondWithResult(_0xe2ca7,_0x32bcf2){_0x32bcf2=_0x32bcf2||0xc8;return function(_0x4dde48){if(_0x4dde48){return _0xe2ca7[_0x5478('0x28')](_0x32bcf2)[_0x5478('0x2a')](_0x4dde48);}};}function respondWithFilteredResult(_0x17ebba,_0x15ba5b){return function(_0x234745){if(_0x234745){var _0x4845b5=typeof _0x15ba5b['offset']==='undefined'&&typeof _0x15ba5b[_0x5478('0x2b')]===_0x5478('0x2c');var _0x24adad=_0x234745['count'];var _0x210115=_0x4845b5?0x0:_0x15ba5b[_0x5478('0x2d')];var _0xe5dd94=_0x4845b5?_0x234745['count']:_0x15ba5b[_0x5478('0x2d')]+_0x15ba5b['limit'];var _0x3703c2;if(_0xe5dd94>=_0x24adad){_0xe5dd94=_0x24adad;_0x3703c2=0xc8;}else{_0x3703c2=0xce;}_0x17ebba[_0x5478('0x28')](_0x3703c2);return _0x17ebba[_0x5478('0x2e')](_0x5478('0x2f'),_0x210115+'-'+_0xe5dd94+'/'+_0x24adad)[_0x5478('0x2a')](_0x234745);}return null;};}function patchUpdates(_0x3c0be8){return function(_0x27b180){try{jsonpatch['apply'](_0x27b180,_0x3c0be8,!![]);}catch(_0x64b281){return BPromise['reject'](_0x64b281);}return _0x27b180[_0x5478('0x30')]();};}function saveUpdates(_0xdfc524,_0x43e530){return function(_0x544f87){if(_0x544f87){return _0x544f87[_0x5478('0x31')](_0xdfc524)['then'](function(_0x3978a2){return _0x3978a2;});}return null;};}function removeEntity(_0x358282,_0x43a249){return function(_0x2c16cb){if(_0x2c16cb){return _0x2c16cb[_0x5478('0x32')]()[_0x5478('0x1b')](function(){var _0x49fe03=_0x2c16cb[_0x5478('0x33')]({'plain':!![]});var _0x35e387=_0x5478('0x34');return db['UserProfileResource'][_0x5478('0x32')]({'where':{'type':_0x35e387,'resourceId':_0x49fe03['id']}})[_0x5478('0x1b')](function(){return _0x2c16cb;});})[_0x5478('0x1b')](function(){_0x358282[_0x5478('0x28')](0xcc)[_0x5478('0x29')]();});}};}function handleEntityNotFound(_0x3fac47,_0x4c9686){return function(_0x2ccd54){if(!_0x2ccd54){_0x3fac47[_0x5478('0x27')](0x194);}return _0x2ccd54;};}function handleError(_0x55ff7b,_0x4d886a){_0x4d886a=_0x4d886a||0x1f4;return function(_0x438bac){logger[_0x5478('0x22')](_0x438bac[_0x5478('0x35')]);if(_0x438bac[_0x5478('0x36')]){delete _0x438bac[_0x5478('0x36')];}_0x55ff7b[_0x5478('0x28')](_0x4d886a)['send'](_0x438bac);};}exports[_0x5478('0x37')]=function(_0x173a35,_0x52d1c1){var _0x57b4ad={},_0x34a0d8={},_0x503629={'count':0x0,'rows':[]};var _0x879147=_['map'](db[_0x5478('0x38')][_0x5478('0x39')],function(_0x33c4e4){return{'name':_0x33c4e4[_0x5478('0x3a')],'type':_0x33c4e4[_0x5478('0x3b')][_0x5478('0x3c')]};});_0x34a0d8[_0x5478('0x3d')]=_[_0x5478('0x3e')](_0x879147,_0x5478('0x36'));_0x34a0d8['query']=_[_0x5478('0x3f')](_0x173a35[_0x5478('0x40')]);_0x34a0d8[_0x5478('0x41')]=_[_0x5478('0x42')](_0x34a0d8['model'],_0x34a0d8[_0x5478('0x40')]);_0x57b4ad[_0x5478('0x43')]=_['intersection'](_0x34a0d8[_0x5478('0x3d')],qs[_0x5478('0x44')](_0x173a35[_0x5478('0x40')][_0x5478('0x44')]));_0x57b4ad[_0x5478('0x43')]=_0x57b4ad[_0x5478('0x43')][_0x5478('0x45')]?_0x57b4ad[_0x5478('0x43')]:_0x34a0d8[_0x5478('0x3d')];if(!_0x173a35['query']['hasOwnProperty'](_0x5478('0x46'))){_0x57b4ad[_0x5478('0x2b')]=qs[_0x5478('0x2b')](_0x173a35['query']['limit']);_0x57b4ad[_0x5478('0x2d')]=qs['offset'](_0x173a35[_0x5478('0x40')][_0x5478('0x2d')]);}_0x57b4ad[_0x5478('0x47')]=qs[_0x5478('0x48')](_0x173a35[_0x5478('0x40')][_0x5478('0x48')]);_0x57b4ad[_0x5478('0x49')]=qs[_0x5478('0x41')](_[_0x5478('0x4a')](_0x173a35[_0x5478('0x40')],_0x34a0d8[_0x5478('0x41')]),_0x879147);if(_0x173a35[_0x5478('0x40')][_0x5478('0x4b')]){_0x57b4ad['where']=_[_0x5478('0x4c')](_0x57b4ad['where'],{'$or':_[_0x5478('0x3e')](_0x879147,function(_0x1f23d8){if(_0x1f23d8[_0x5478('0x3b')]!==_0x5478('0x4d')){var _0x308bea={};_0x308bea[_0x1f23d8[_0x5478('0x36')]]={'$like':'%'+_0x173a35['query'][_0x5478('0x4b')]+'%'};return _0x308bea;}})});}_0x57b4ad=_[_0x5478('0x4c')]({},_0x57b4ad,_0x173a35[_0x5478('0x4e')]);var _0x399f0d={'where':_0x57b4ad[_0x5478('0x49')]};return db[_0x5478('0x38')]['count'](_0x399f0d)[_0x5478('0x1b')](function(_0x2336a){_0x503629[_0x5478('0x4f')]=_0x2336a;if(_0x173a35[_0x5478('0x40')]['includeAll']){_0x57b4ad[_0x5478('0x50')]=[{'all':!![]}];}return db[_0x5478('0x38')][_0x5478('0x51')](_0x57b4ad);})[_0x5478('0x1b')](function(_0x21d575){_0x503629[_0x5478('0x52')]=_0x21d575;return _0x503629;})[_0x5478('0x1b')](respondWithFilteredResult(_0x52d1c1,_0x57b4ad))['catch'](handleError(_0x52d1c1,null));};exports[_0x5478('0x53')]=function(_0x2f8617,_0x17202f){var _0x7248e8={'raw':![],'where':{'id':_0x2f8617[_0x5478('0x54')]['id']}},_0x43330a={};_0x43330a[_0x5478('0x3d')]=_[_0x5478('0x3f')](db[_0x5478('0x38')]['rawAttributes']);_0x43330a[_0x5478('0x40')]=_[_0x5478('0x3f')](_0x2f8617[_0x5478('0x40')]);_0x43330a[_0x5478('0x41')]=_[_0x5478('0x42')](_0x43330a[_0x5478('0x3d')],_0x43330a[_0x5478('0x40')]);_0x7248e8['attributes']=_[_0x5478('0x42')](_0x43330a['model'],qs['fields'](_0x2f8617['query'][_0x5478('0x44')]));_0x7248e8['attributes']=_0x7248e8[_0x5478('0x43')][_0x5478('0x45')]?_0x7248e8[_0x5478('0x43')]:_0x43330a[_0x5478('0x3d')];if(_0x2f8617[_0x5478('0x40')]['includeAll']){_0x7248e8['include']=[{'all':!![]}];}_0x7248e8=_[_0x5478('0x4c')]({},_0x7248e8,_0x2f8617['options']);return db[_0x5478('0x38')]['find'](_0x7248e8)['then'](handleEntityNotFound(_0x17202f,null))[_0x5478('0x1b')](respondWithResult(_0x17202f,null))[_0x5478('0x26')](handleError(_0x17202f,null));};exports[_0x5478('0x55')]=function(_0x339f80,_0x24ec76,_0x58653f){var _0x2d073b;return db[_0x5478('0x38')][_0x5478('0x55')](_0x339f80['body'],{'raw':!![]})['then'](function(_0x31cf12){_0x2d073b=_0x31cf12;return db[_0x5478('0x38')][_0x5478('0x51')]({'raw':!![]});})[_0x5478('0x1b')](function(_0x2156cb){var _0x317817=fs[_0x5478('0x56')](path['join'](config[_0x5478('0x57')],_0x5478('0x58')),'utf8');var _0x43bbb5=ejs['render'](_0x317817,{'contexts':_0x2156cb||[]});fs[_0x5478('0x59')](_0x5478('0x5a'),_0x43bbb5);})[_0x5478('0x1b')](function(){return respondWithRpcPromise('Reload',_0x5478('0x55'),{'module':_0x5478('0x5b')});})['then'](function(){var _0x38a66d=_0x339f80[_0x5478('0x5c')][_0x5478('0x33')]({'plain':!![]});if(!_0x38a66d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38a66d[_0x5478('0x5d')]===_0x5478('0x5c')){var _0x16fe7b=_0x2d073b[_0x5478('0x33')]({'plain':!![]});return db[_0x5478('0x5e')][_0x5478('0x5f')]({'where':{'name':_0x5478('0x34'),'userProfileId':_0x38a66d[_0x5478('0x60')]},'raw':!![]})[_0x5478('0x1b')](function(_0x48a79d){if(_0x48a79d&&_0x48a79d[_0x5478('0x61')]===0x0){return db[_0x5478('0x62')][_0x5478('0x55')]({'name':_0x16fe7b[_0x5478('0x36')],'resourceId':_0x16fe7b['id'],'type':_0x48a79d['name'],'sectionId':_0x48a79d['id']},{})['then'](function(){return _0x2d073b;});}else{return _0x2d073b;}})[_0x5478('0x26')](function(_0x3b6053){logger[_0x5478('0x22')](_0x5478('0x63'),_0x3b6053);throw _0x3b6053;});}return _0x2d073b;})[_0x5478('0x1b')](respondWithResult(_0x24ec76,0xc9))[_0x5478('0x26')](handleError(_0x24ec76,null));};exports[_0x5478('0x31')]=function(_0x3c9bf1,_0x318325,_0x64436f){var _0xd19097;return db[_0x5478('0x38')][_0x5478('0x5f')]({'where':{'id':_0x3c9bf1[_0x5478('0x54')]['id']}})[_0x5478('0x1b')](handleEntityNotFound(_0x318325,null))[_0x5478('0x1b')](saveUpdates(_0x3c9bf1['body'],null))[_0x5478('0x1b')](function(_0x5d5f54){if(_0x5d5f54){_0xd19097=_0x5d5f54;return db[_0x5478('0x38')][_0x5478('0x51')]({'raw':!![]});}})[_0x5478('0x1b')](function(_0x2f7691){var _0x553ea3=fs['readFileSync'](path[_0x5478('0x64')](config[_0x5478('0x57')],_0x5478('0x58')),_0x5478('0x65'));var _0x4a4bc4=ejs[_0x5478('0x66')](_0x553ea3,{'contexts':_0x2f7691||[]});fs[_0x5478('0x59')](_0x5478('0x5a'),_0x4a4bc4);})[_0x5478('0x1b')](function(){return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});})[_0x5478('0x1b')](function(){return _0xd19097;})[_0x5478('0x1b')](respondWithResult(_0x318325,null))[_0x5478('0x26')](handleError(_0x318325,null));};exports['destroy']=function(_0x33df0a,_0x48ecee,_0xa21f43){var _0x53232c;return db[_0x5478('0x38')][_0x5478('0x5f')]({'where':{'id':_0x33df0a[_0x5478('0x54')]['id']}})[_0x5478('0x1b')](handleEntityNotFound(_0x48ecee,null))['then'](removeEntity(_0x48ecee,null))[_0x5478('0x1b')](function(){return db[_0x5478('0x38')][_0x5478('0x51')]({'raw':!![]});})[_0x5478('0x1b')](function(_0x362e04){var _0x1dc338=fs[_0x5478('0x56')](path['join'](config[_0x5478('0x57')],'server/files/templates/context.ejs'),'utf8');var _0x53e7e9=ejs[_0x5478('0x66')](_0x1dc338,{'contexts':_0x362e04});fs[_0x5478('0x59')](_0x5478('0x5a'),_0x53e7e9);return respondWithRpcPromise(_0x5478('0x67'),'destroy',{'module':'chan_sip.so'});})['catch'](handleError(_0x48ecee,null));}; \ No newline at end of file +var _0x7f08=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','save','update','get','Contexts','UserProfileResource','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','VoiceContext','includeAll','include','findAll','rows','show','create','body','readFileSync','join','server/files/templates/context.ejs','utf8','render','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','params','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','root'];(function(_0x37346b,_0x21b8b4){var _0x3ed354=function(_0x10194f){while(--_0x10194f){_0x37346b['push'](_0x37346b['shift']());}};_0x3ed354(++_0x21b8b4);}(_0x7f08,0x68));var _0x87f0=function(_0x3d84b2,_0x566767){_0x3d84b2=_0x3d84b2-0x0;var _0x4e6b72=_0x7f08[_0x3d84b2];return _0x4e6b72;};'use strict';var emlformat=require(_0x87f0('0x0'));var rimraf=require(_0x87f0('0x1'));var zipdir=require(_0x87f0('0x2'));var jsonpatch=require(_0x87f0('0x3'));var rp=require(_0x87f0('0x4'));var moment=require(_0x87f0('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x87f0('0x6'));var sox=require(_0x87f0('0x7'));var csv=require(_0x87f0('0x8'));var ejs=require(_0x87f0('0x9'));var fs=require('fs');var fs_extra=require(_0x87f0('0xa'));var _=require(_0x87f0('0xb'));var squel=require(_0x87f0('0xc'));var crypto=require(_0x87f0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x87f0('0xe'));var toCsv=require(_0x87f0('0x8'));var querystring=require(_0x87f0('0xf'));var Papa=require(_0x87f0('0x10'));var Redis=require(_0x87f0('0x11'));var authService=require(_0x87f0('0x12'));var qs=require(_0x87f0('0x13'));var as=require(_0x87f0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x87f0('0x15'))(_0x87f0('0x16'));var utils=require(_0x87f0('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x87f0('0x18'))['db'];var jayson=require(_0x87f0('0x19'));var client=jayson['client'][_0x87f0('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x255335,_0x40fa5c,_0x498250,_0x49751d){return new BPromise(function(_0x436343,_0x469079){var _0x4cfbf0=_0x49751d||client;return _0x4cfbf0['request'](_0x255335,_0x498250)[_0x87f0('0x1b')](function(_0x27394c){logger[_0x87f0('0x1c')](_0x87f0('0x1d'),_0x40fa5c,_0x87f0('0x1e'));logger[_0x87f0('0x1f')](_0x87f0('0x20'),_0x40fa5c,_0x87f0('0x1e'),JSON[_0x87f0('0x21')](_0x27394c));if(_0x27394c[_0x87f0('0x22')]){if(_0x27394c[_0x87f0('0x22')][_0x87f0('0x23')]===0x1f4){logger[_0x87f0('0x22')](_0x87f0('0x1d'),_0x40fa5c,_0x27394c[_0x87f0('0x22')]['message']);return _0x469079(_0x27394c[_0x87f0('0x22')][_0x87f0('0x24')]);}logger[_0x87f0('0x22')](_0x87f0('0x1d'),_0x40fa5c,_0x27394c[_0x87f0('0x22')][_0x87f0('0x24')]);return _0x436343(_0x27394c[_0x87f0('0x22')]['message']);}else{logger[_0x87f0('0x1c')]('VoiceContext,\x20%s,\x20%s',_0x40fa5c,_0x87f0('0x1e'));_0x436343(_0x27394c[_0x87f0('0x25')]['message']);}})[_0x87f0('0x26')](function(_0x33f0f6){logger[_0x87f0('0x22')](_0x87f0('0x1d'),_0x40fa5c,_0x33f0f6);_0x469079(_0x33f0f6);});});}function respondWithStatusCode(_0x3003e8,_0x186cad){_0x186cad=_0x186cad||0xcc;return function(_0x31ef1f){if(_0x31ef1f){return _0x3003e8[_0x87f0('0x27')](_0x186cad);}return _0x3003e8['status'](_0x186cad)[_0x87f0('0x28')]();};}function respondWithResult(_0x321c6c,_0x56c26f){_0x56c26f=_0x56c26f||0xc8;return function(_0x1da3a3){if(_0x1da3a3){return _0x321c6c[_0x87f0('0x29')](_0x56c26f)[_0x87f0('0x2a')](_0x1da3a3);}};}function respondWithFilteredResult(_0x17c1aa,_0x1ba52d){return function(_0x1bf105){if(_0x1bf105){var _0x3fb4db=typeof _0x1ba52d[_0x87f0('0x2b')]===_0x87f0('0x2c')&&typeof _0x1ba52d[_0x87f0('0x2d')]===_0x87f0('0x2c');var _0x162e67=_0x1bf105[_0x87f0('0x2e')];var _0x1b71af=_0x3fb4db?0x0:_0x1ba52d[_0x87f0('0x2b')];var _0x24dcb0=_0x3fb4db?_0x1bf105[_0x87f0('0x2e')]:_0x1ba52d[_0x87f0('0x2b')]+_0x1ba52d[_0x87f0('0x2d')];var _0x409b94;if(_0x24dcb0>=_0x162e67){_0x24dcb0=_0x162e67;_0x409b94=0xc8;}else{_0x409b94=0xce;}_0x17c1aa[_0x87f0('0x29')](_0x409b94);return _0x17c1aa[_0x87f0('0x2f')]('Content-Range',_0x1b71af+'-'+_0x24dcb0+'/'+_0x162e67)[_0x87f0('0x2a')](_0x1bf105);}return null;};}function patchUpdates(_0x25a18a){return function(_0x49408d){try{jsonpatch['apply'](_0x49408d,_0x25a18a,!![]);}catch(_0x4aebcc){return BPromise['reject'](_0x4aebcc);}return _0x49408d[_0x87f0('0x30')]();};}function saveUpdates(_0x2d8f49,_0x4c4386){return function(_0x70d774){if(_0x70d774){return _0x70d774[_0x87f0('0x31')](_0x2d8f49)[_0x87f0('0x1b')](function(_0x3dbdd3){return _0x3dbdd3;});}return null;};}function removeEntity(_0x323f84,_0x53793a){return function(_0x34da31){if(_0x34da31){return _0x34da31['destroy']()['then'](function(){var _0x5420f3=_0x34da31[_0x87f0('0x32')]({'plain':!![]});var _0xd05b58=_0x87f0('0x33');return db[_0x87f0('0x34')][_0x87f0('0x35')]({'where':{'type':_0xd05b58,'resourceId':_0x5420f3['id']}})[_0x87f0('0x1b')](function(){return _0x34da31;});})['then'](function(){_0x323f84[_0x87f0('0x29')](0xcc)[_0x87f0('0x28')]();});}};}function handleEntityNotFound(_0x356835,_0x5a833c){return function(_0xc80b96){if(!_0xc80b96){_0x356835[_0x87f0('0x27')](0x194);}return _0xc80b96;};}function handleError(_0x54b6bc,_0x54576e){_0x54576e=_0x54576e||0x1f4;return function(_0x16425d){logger[_0x87f0('0x22')](_0x16425d[_0x87f0('0x36')]);if(_0x16425d['name']){delete _0x16425d[_0x87f0('0x37')];}_0x54b6bc[_0x87f0('0x29')](_0x54576e)[_0x87f0('0x38')](_0x16425d);};}exports[_0x87f0('0x39')]=function(_0x6dadc1,_0xf99c91){var _0x252821={},_0x12077f={},_0x4de9cd={'count':0x0,'rows':[]};var _0x535a08=_[_0x87f0('0x3a')](db['VoiceContext'][_0x87f0('0x3b')],function(_0xbd2eb9){return{'name':_0xbd2eb9[_0x87f0('0x3c')],'type':_0xbd2eb9['type'][_0x87f0('0x3d')]};});_0x12077f[_0x87f0('0x3e')]=_[_0x87f0('0x3a')](_0x535a08,_0x87f0('0x37'));_0x12077f[_0x87f0('0x3f')]=_[_0x87f0('0x40')](_0x6dadc1['query']);_0x12077f['filters']=_[_0x87f0('0x41')](_0x12077f['model'],_0x12077f[_0x87f0('0x3f')]);_0x252821[_0x87f0('0x42')]=_['intersection'](_0x12077f[_0x87f0('0x3e')],qs[_0x87f0('0x43')](_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x43')]));_0x252821[_0x87f0('0x42')]=_0x252821[_0x87f0('0x42')][_0x87f0('0x44')]?_0x252821[_0x87f0('0x42')]:_0x12077f[_0x87f0('0x3e')];if(!_0x6dadc1[_0x87f0('0x3f')]['hasOwnProperty']('nolimit')){_0x252821[_0x87f0('0x2d')]=qs[_0x87f0('0x2d')](_0x6dadc1['query'][_0x87f0('0x2d')]);_0x252821[_0x87f0('0x2b')]=qs[_0x87f0('0x2b')](_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x2b')]);}_0x252821[_0x87f0('0x45')]=qs[_0x87f0('0x46')](_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x46')]);_0x252821['where']=qs[_0x87f0('0x47')](_[_0x87f0('0x48')](_0x6dadc1[_0x87f0('0x3f')],_0x12077f[_0x87f0('0x47')]),_0x535a08);if(_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x49')]){_0x252821[_0x87f0('0x4a')]=_[_0x87f0('0x4b')](_0x252821[_0x87f0('0x4a')],{'$or':_[_0x87f0('0x3a')](_0x535a08,function(_0x420a55){if(_0x420a55[_0x87f0('0x4c')]!==_0x87f0('0x4d')){var _0x2de940={};_0x2de940[_0x420a55[_0x87f0('0x37')]]={'$like':'%'+_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x49')]+'%'};return _0x2de940;}})});}_0x252821=_[_0x87f0('0x4b')]({},_0x252821,_0x6dadc1[_0x87f0('0x4e')]);var _0x8ed07c={'where':_0x252821[_0x87f0('0x4a')]};return db[_0x87f0('0x4f')][_0x87f0('0x2e')](_0x8ed07c)[_0x87f0('0x1b')](function(_0x266e5e){_0x4de9cd[_0x87f0('0x2e')]=_0x266e5e;if(_0x6dadc1[_0x87f0('0x3f')][_0x87f0('0x50')]){_0x252821[_0x87f0('0x51')]=[{'all':!![]}];}return db[_0x87f0('0x4f')][_0x87f0('0x52')](_0x252821);})['then'](function(_0x59998b){_0x4de9cd[_0x87f0('0x53')]=_0x59998b;return _0x4de9cd;})[_0x87f0('0x1b')](respondWithFilteredResult(_0xf99c91,_0x252821))['catch'](handleError(_0xf99c91,null));};exports[_0x87f0('0x54')]=function(_0x47d44b,_0x5c2b81){var _0x32e7cb={'raw':![],'where':{'id':_0x47d44b['params']['id']}},_0x50c0f4={};_0x50c0f4['model']=_['keys'](db[_0x87f0('0x4f')]['rawAttributes']);_0x50c0f4[_0x87f0('0x3f')]=_[_0x87f0('0x40')](_0x47d44b['query']);_0x50c0f4[_0x87f0('0x47')]=_['intersection'](_0x50c0f4['model'],_0x50c0f4[_0x87f0('0x3f')]);_0x32e7cb[_0x87f0('0x42')]=_[_0x87f0('0x41')](_0x50c0f4[_0x87f0('0x3e')],qs[_0x87f0('0x43')](_0x47d44b['query']['fields']));_0x32e7cb[_0x87f0('0x42')]=_0x32e7cb[_0x87f0('0x42')][_0x87f0('0x44')]?_0x32e7cb['attributes']:_0x50c0f4[_0x87f0('0x3e')];if(_0x47d44b[_0x87f0('0x3f')][_0x87f0('0x50')]){_0x32e7cb[_0x87f0('0x51')]=[{'all':!![]}];}_0x32e7cb=_[_0x87f0('0x4b')]({},_0x32e7cb,_0x47d44b['options']);return db[_0x87f0('0x4f')]['find'](_0x32e7cb)[_0x87f0('0x1b')](handleEntityNotFound(_0x5c2b81,null))[_0x87f0('0x1b')](respondWithResult(_0x5c2b81,null))[_0x87f0('0x26')](handleError(_0x5c2b81,null));};exports[_0x87f0('0x55')]=function(_0x29720d,_0x55fb79,_0xd5acc7){var _0x2a8bc3;return db[_0x87f0('0x4f')][_0x87f0('0x55')](_0x29720d[_0x87f0('0x56')],{'raw':!![]})[_0x87f0('0x1b')](function(_0x3764ff){_0x2a8bc3=_0x3764ff;return db[_0x87f0('0x4f')][_0x87f0('0x52')]({'raw':!![]});})[_0x87f0('0x1b')](function(_0xdc3e49){var _0xefeedb=fs[_0x87f0('0x57')](path[_0x87f0('0x58')](config['root'],_0x87f0('0x59')),_0x87f0('0x5a'));var _0x488b33=ejs[_0x87f0('0x5b')](_0xefeedb,{'contexts':_0xdc3e49||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x488b33);})['then'](function(){return respondWithRpcPromise(_0x87f0('0x5c'),'create',{'module':_0x87f0('0x5d')});})[_0x87f0('0x1b')](function(){var _0x2516d7=_0x29720d[_0x87f0('0x5e')][_0x87f0('0x32')]({'plain':!![]});if(!_0x2516d7)throw new Error(_0x87f0('0x5f'));if(_0x2516d7[_0x87f0('0x60')]==='user'){var _0x49bd48=_0x2a8bc3[_0x87f0('0x32')]({'plain':!![]});return db[_0x87f0('0x61')][_0x87f0('0x62')]({'where':{'name':_0x87f0('0x33'),'userProfileId':_0x2516d7['userProfileId']},'raw':!![]})['then'](function(_0x20fe62){if(_0x20fe62&&_0x20fe62[_0x87f0('0x63')]===0x0){return db[_0x87f0('0x34')][_0x87f0('0x55')]({'name':_0x49bd48[_0x87f0('0x37')],'resourceId':_0x49bd48['id'],'type':_0x20fe62[_0x87f0('0x37')],'sectionId':_0x20fe62['id']},{})[_0x87f0('0x1b')](function(){return _0x2a8bc3;});}else{return _0x2a8bc3;}})[_0x87f0('0x26')](function(_0x3cb914){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3cb914);throw _0x3cb914;});}return _0x2a8bc3;})['then'](respondWithResult(_0x55fb79,0xc9))[_0x87f0('0x26')](handleError(_0x55fb79,null));};exports['update']=function(_0x3b3e1f,_0x5095b7,_0x41eb5c){var _0x1d5a24;return db[_0x87f0('0x4f')]['find']({'where':{'id':_0x3b3e1f[_0x87f0('0x64')]['id']}})[_0x87f0('0x1b')](handleEntityNotFound(_0x5095b7,null))[_0x87f0('0x1b')](saveUpdates(_0x3b3e1f['body'],null))[_0x87f0('0x1b')](function(_0x55c32c){if(_0x55c32c){_0x1d5a24=_0x55c32c;return db[_0x87f0('0x4f')]['findAll']({'raw':!![]});}})[_0x87f0('0x1b')](function(_0x15ac94){var _0x107066=fs[_0x87f0('0x57')](path[_0x87f0('0x58')](config['root'],_0x87f0('0x59')),_0x87f0('0x5a'));var _0x5eecd0=ejs[_0x87f0('0x5b')](_0x107066,{'contexts':_0x15ac94||[]});fs[_0x87f0('0x65')](_0x87f0('0x66'),_0x5eecd0);})[_0x87f0('0x1b')](function(){return respondWithRpcPromise(_0x87f0('0x5c'),_0x87f0('0x31'),{'module':_0x87f0('0x5d')});})[_0x87f0('0x1b')](function(){return _0x1d5a24;})[_0x87f0('0x1b')](respondWithResult(_0x5095b7,null))[_0x87f0('0x26')](handleError(_0x5095b7,null));};exports[_0x87f0('0x35')]=function(_0x4c8fcb,_0x114871,_0x320d8e){var _0xdc9874;return db[_0x87f0('0x4f')][_0x87f0('0x62')]({'where':{'id':_0x4c8fcb['params']['id']}})[_0x87f0('0x1b')](handleEntityNotFound(_0x114871,null))[_0x87f0('0x1b')](removeEntity(_0x114871,null))['then'](function(){return db[_0x87f0('0x4f')]['findAll']({'raw':!![]});})[_0x87f0('0x1b')](function(_0x2f93ce){var _0x520907=fs[_0x87f0('0x57')](path[_0x87f0('0x58')](config[_0x87f0('0x67')],_0x87f0('0x59')),_0x87f0('0x5a'));var _0x54347c=ejs[_0x87f0('0x5b')](_0x520907,{'contexts':_0x2f93ce});fs[_0x87f0('0x65')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x54347c);return respondWithRpcPromise(_0x87f0('0x5c'),_0x87f0('0x35'),{'module':_0x87f0('0x5d')});})[_0x87f0('0x26')](handleError(_0x114871,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d3a981d..d283f01 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 _0xa24e=['voice_contexts','moment','request-promise','rimraf','define'];(function(_0x20e8f1,_0x5b60a4){var _0x4926e9=function(_0x15d171){while(--_0x15d171){_0x20e8f1['push'](_0x20e8f1['shift']());}};_0x4926e9(++_0x5b60a4);}(_0xa24e,0x14b));var _0xea24=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0xa24e[_0x124298];return _0x35ac24;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xea24('0x0'));var BPromise=require('bluebird');var rp=require(_0xea24('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea24('0x2'));var config=require('../../config/environment');var attributes=require('./voiceContext.attributes');module['exports']=function(_0x1b4afe,_0x3e38c7){return _0x1b4afe[_0xea24('0x3')]('VoiceContext',attributes,{'tableName':_0xea24('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x09f1=['VoiceContext','voice_contexts','lodash','util','moment','bluebird','request-promise','path','rimraf','./voiceContext.attributes'];(function(_0x5a7d41,_0x4447e2){var _0x98d8fa=function(_0x2ce1cf){while(--_0x2ce1cf){_0x5a7d41['push'](_0x5a7d41['shift']());}};_0x98d8fa(++_0x4447e2);}(_0x09f1,0x138));var _0x109f=function(_0x3095b3,_0x41a0c7){_0x3095b3=_0x3095b3-0x0;var _0x262e46=_0x09f1[_0x3095b3];return _0x262e46;};'use strict';var _=require(_0x109f('0x0'));var util=require(_0x109f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x109f('0x2'));var BPromise=require(_0x109f('0x3'));var rp=require(_0x109f('0x4'));var fs=require('fs');var path=require(_0x109f('0x5'));var rimraf=require(_0x109f('0x6'));var config=require('../../config/environment');var attributes=require(_0x109f('0x7'));module['exports']=function(_0x25c358,_0x30ee50){return _0x25c358['define'](_0x109f('0x8'),attributes,{'tableName':_0x109f('0x9'),'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 ef2a5a5..09de546 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 _0x4178=['http','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x432f9e,_0x35d0d8){var _0x2f0d10=function(_0x45e3d0){while(--_0x45e3d0){_0x432f9e['push'](_0x432f9e['shift']());}};_0x2f0d10(++_0x35d0d8);}(_0x4178,0x7f));var _0x8417=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x4178[_0x68c979];return _0x4f0001;};'use strict';var _=require('lodash');var util=require(_0x8417('0x0'));var moment=require(_0x8417('0x1'));var BPromise=require(_0x8417('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8417('0x3'));var db=require(_0x8417('0x4'))['db'];var utils=require(_0x8417('0x5'));var logger=require(_0x8417('0x6'))(_0x8417('0x7'));var config=require(_0x8417('0x8'));var jayson=require(_0x8417('0x9'));var client=jayson[_0x8417('0xa')][_0x8417('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca2a5,_0x3981be,_0x5f0140){return new BPromise(function(_0x3ab6f5,_0x14b485){return client['request'](_0x2ca2a5,_0x5f0140)[_0x8417('0xc')](function(_0x2abab1){logger[_0x8417('0xd')](_0x8417('0xe'),_0x3981be,_0x8417('0xf'));logger[_0x8417('0x10')](_0x8417('0x11'),_0x3981be,'request\x20sent',JSON[_0x8417('0x12')](_0x2abab1));if(_0x2abab1[_0x8417('0x13')]){if(_0x2abab1[_0x8417('0x13')][_0x8417('0x14')]===0x1f4){logger['error'](_0x8417('0xe'),_0x3981be,_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);return _0x14b485(_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);}logger['error'](_0x8417('0xe'),_0x3981be,_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);return _0x3ab6f5(_0x2abab1[_0x8417('0x13')][_0x8417('0x15')]);}else{logger[_0x8417('0xd')](_0x8417('0xe'),_0x3981be,'request\x20sent');_0x3ab6f5(_0x2abab1[_0x8417('0x16')][_0x8417('0x15')]);}})['catch'](function(_0xfb0896){logger[_0x8417('0x13')](_0x8417('0xe'),_0x3981be,_0xfb0896);_0x14b485(_0xfb0896);});});} \ No newline at end of file +var _0x184d=['stringify','error','message','result','catch','util','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x2c7ff5,_0x504abe){var _0x42fef4=function(_0x117eec){while(--_0x117eec){_0x2c7ff5['push'](_0x2c7ff5['shift']());}};_0x42fef4(++_0x504abe);}(_0x184d,0x1d0));var _0xd184=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x184d[_0x19b3f9];return _0x18c3f6;};'use strict';var _=require('lodash');var util=require(_0xd184('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd184('0x1'))['db'];var utils=require(_0xd184('0x2'));var logger=require(_0xd184('0x3'))(_0xd184('0x4'));var config=require(_0xd184('0x5'));var jayson=require(_0xd184('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x49f8e8,_0x1d8044,_0x4449a5){return new BPromise(function(_0x5b9977,_0x28a01a){return client['request'](_0x49f8e8,_0x4449a5)['then'](function(_0x197d02){logger[_0xd184('0x7')](_0xd184('0x8'),_0x1d8044,_0xd184('0x9'));logger[_0xd184('0xa')](_0xd184('0xb'),_0x1d8044,'request\x20sent',JSON[_0xd184('0xc')](_0x197d02));if(_0x197d02[_0xd184('0xd')]){if(_0x197d02[_0xd184('0xd')]['code']===0x1f4){logger[_0xd184('0xd')]('VoiceContext,\x20%s,\x20%s',_0x1d8044,_0x197d02[_0xd184('0xd')][_0xd184('0xe')]);return _0x28a01a(_0x197d02[_0xd184('0xd')][_0xd184('0xe')]);}logger[_0xd184('0xd')](_0xd184('0x8'),_0x1d8044,_0x197d02['error'][_0xd184('0xe')]);return _0x5b9977(_0x197d02[_0xd184('0xd')][_0xd184('0xe')]);}else{logger[_0xd184('0x7')](_0xd184('0x8'),_0x1d8044,_0xd184('0x9'));_0x5b9977(_0x197d02[_0xd184('0xf')][_0xd184('0xe')]);}})[_0xd184('0x10')](function(_0xf68691){logger['error']('VoiceContext,\x20%s,\x20%s',_0x1d8044,_0xf68691);_0x28a01a(_0xf68691);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 7b3f650..1488172 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 _0xf9a2=['update','destroy','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','put'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xf9a2,0x124));var _0x2f9a=function(_0x4e1119,_0x3c8b3a){_0x4e1119=_0x4e1119-0x0;var _0x3943c6=_0xf9a2[_0x4e1119];return _0x3943c6;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2f9a('0x0'));var express=require(_0x2f9a('0x1'));var router=express[_0x2f9a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2f9a('0x3'));var interaction=require(_0x2f9a('0x4'));var config=require(_0x2f9a('0x5'));var controller=require('./voiceDialReport.controller');router['get']('/',auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x7')]);router[_0x2f9a('0x8')]('/describe',auth[_0x2f9a('0x6')](),controller[_0x2f9a('0x9')]);router['get'](_0x2f9a('0xa'),auth['isAuthenticated'](),controller[_0x2f9a('0xb')]);router[_0x2f9a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2f9a('0xd')](_0x2f9a('0xa'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0xe')]);router['delete'](_0x2f9a('0xa'),auth[_0x2f9a('0x6')](),controller[_0x2f9a('0xf')]);module[_0x2f9a('0x10')]=router; \ No newline at end of file +var _0xcf1c=['express','Router','fs-extra','./voiceDialReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','connect-timeout'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xcf1c,0x18d));var _0xccf1=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xcf1c[_0x17730a];return _0x485db1;};'use strict';var multer=require(_0xccf1('0x0'));var util=require(_0xccf1('0x1'));var path=require('path');var timeout=require(_0xccf1('0x2'));var express=require(_0xccf1('0x3'));var router=express[_0xccf1('0x4')]();var fs_extra=require(_0xccf1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xccf1('0x6'));router['get']('/',auth[_0xccf1('0x7')](),controller[_0xccf1('0x8')]);router[_0xccf1('0x9')](_0xccf1('0xa'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xb')]);router[_0xccf1('0x9')](_0xccf1('0xc'),auth[_0xccf1('0x7')](),controller[_0xccf1('0xd')]);router[_0xccf1('0xe')]('/',auth[_0xccf1('0x7')](),controller[_0xccf1('0xf')]);router[_0xccf1('0x10')](_0xccf1('0xc'),auth[_0xccf1('0x7')](),controller[_0xccf1('0x11')]);router['delete']('/:id',auth[_0xccf1('0x7')](),controller[_0xccf1('0x12')]);module[_0xccf1('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index bd81a4d..43892ed 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 _0x84ab=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x4c5a24,_0x5ef60c){var _0x4b067e=function(_0x33c0da){while(--_0x33c0da){_0x4c5a24['push'](_0x4c5a24['shift']());}};_0x4b067e(++_0x5ef60c);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x84ab[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require(_0xb84a('0x0'));module[_0xb84a('0x1')]={'privilege':{'type':Sequelize[_0xb84a('0x2')]},'channel':{'type':Sequelize[_0xb84a('0x2')]},'channelstate':{'type':Sequelize[_0xb84a('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb84a('0x2')]},'calleridname':{'type':Sequelize[_0xb84a('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'language':{'type':Sequelize[_0xb84a('0x2')]},'accountcode':{'type':Sequelize[_0xb84a('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xb84a('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xb84a('0x2')]},'destchannelstate':{'type':Sequelize[_0xb84a('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb84a('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb84a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb84a('0x2')]},'destlanguage':{'type':Sequelize[_0xb84a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb84a('0x3')]},'destuniqueid':{'type':Sequelize[_0xb84a('0x2')]},'destlinkedid':{'type':Sequelize[_0xb84a('0x2')]},'dialstring':{'type':Sequelize[_0xb84a('0x2')]},'dialstatus':{'type':Sequelize[_0xb84a('0x2')]},'starttime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xb84a('0x4')]},'endtime':{'type':Sequelize[_0xb84a('0x4')]},'lastevent':{'type':Sequelize[_0xb84a('0x2')],'comment':_0xb84a('0x5')},'routeId':{'type':Sequelize[_0xb84a('0x3')]},'duration':{'type':Sequelize[_0xb84a('0x3')]},'holdtime':{'type':Sequelize[_0xb84a('0x3')]},'billableseconds':{'type':Sequelize[_0xb84a('0x3')]}}; \ No newline at end of file +var _0x81bd=['exports','STRING','INTEGER','DATE','sequelize'];(function(_0x46efe8,_0x162b4f){var _0x29f07e=function(_0xb45054){while(--_0xb45054){_0x46efe8['push'](_0x46efe8['shift']());}};_0x29f07e(++_0x162b4f);}(_0x81bd,0x7c));var _0xd81b=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x81bd[_0x166953];return _0x4a8baf;};'use strict';var Sequelize=require(_0xd81b('0x0'));module[_0xd81b('0x1')]={'privilege':{'type':Sequelize[_0xd81b('0x2')]},'channel':{'type':Sequelize[_0xd81b('0x2')]},'channelstate':{'type':Sequelize[_0xd81b('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'calleridnum':{'type':Sequelize[_0xd81b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'connectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'language':{'type':Sequelize[_0xd81b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xd81b('0x2')]},'exten':{'type':Sequelize[_0xd81b('0x2')]},'priority':{'type':Sequelize[_0xd81b('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd81b('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd81b('0x2')]},'destcalleridname':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd81b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd81b('0x2')]},'destlanguage':{'type':Sequelize[_0xd81b('0x2')]},'destaccountcode':{'type':Sequelize[_0xd81b('0x2')]},'destcontext':{'type':Sequelize[_0xd81b('0x2')]},'destexten':{'type':Sequelize[_0xd81b('0x2')]},'destpriority':{'type':Sequelize[_0xd81b('0x3')]},'destuniqueid':{'type':Sequelize[_0xd81b('0x2')]},'destlinkedid':{'type':Sequelize[_0xd81b('0x2')]},'dialstring':{'type':Sequelize[_0xd81b('0x2')]},'dialstatus':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd81b('0x4')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xd81b('0x4')]},'lastevent':{'type':Sequelize[_0xd81b('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0xd81b('0x3')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0xd81b('0x3')]},'billableseconds':{'type':Sequelize[_0xd81b('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index ead171d..2b034cd 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 _0x01b3=['nolimit','order','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','intersection','attributes','includeAll','find','create','body','update','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','stack','name','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','keys','filters','query','fields','length','hasOwnProperty'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x01b3,0xf0));var _0x301b=function(_0x29a91c,_0x5ac2c5){_0x29a91c=_0x29a91c-0x0;var _0x2ab4ff=_0x01b3[_0x29a91c];return _0x2ab4ff;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x301b('0x0'));var zipdir=require(_0x301b('0x1'));var jsonpatch=require(_0x301b('0x2'));var rp=require(_0x301b('0x3'));var moment=require(_0x301b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x301b('0x5'));var util=require(_0x301b('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x301b('0x7'));var ejs=require(_0x301b('0x8'));var fs=require('fs');var fs_extra=require(_0x301b('0x9'));var _=require(_0x301b('0xa'));var squel=require('squel');var crypto=require(_0x301b('0xb'));var jsforce=require(_0x301b('0xc'));var deskjs=require(_0x301b('0xd'));var toCsv=require('to-csv');var querystring=require(_0x301b('0xe'));var Papa=require(_0x301b('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x301b('0x10'));var as=require(_0x301b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x301b('0x12'));var utils=require(_0x301b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x301b('0x14'));var db=require(_0x301b('0x15'))['db'];function respondWithStatusCode(_0x198ab3,_0x222558){_0x222558=_0x222558||0xcc;return function(_0x184f07){if(_0x184f07){return _0x198ab3[_0x301b('0x16')](_0x222558);}return _0x198ab3[_0x301b('0x17')](_0x222558)[_0x301b('0x18')]();};}function respondWithResult(_0x45d37d,_0x170bde){_0x170bde=_0x170bde||0xc8;return function(_0x1389ba){if(_0x1389ba){return _0x45d37d[_0x301b('0x17')](_0x170bde)[_0x301b('0x19')](_0x1389ba);}};}function respondWithFilteredResult(_0x55ab95,_0x1cbbdc){return function(_0x24b32d){if(_0x24b32d){var _0x30ebff=typeof _0x1cbbdc['offset']===_0x301b('0x1a')&&typeof _0x1cbbdc[_0x301b('0x1b')]===_0x301b('0x1a');var _0x134ab1=_0x24b32d[_0x301b('0x1c')];var _0x5435c4=_0x30ebff?0x0:_0x1cbbdc[_0x301b('0x1d')];var _0x442e5c=_0x30ebff?_0x24b32d[_0x301b('0x1c')]:_0x1cbbdc['offset']+_0x1cbbdc[_0x301b('0x1b')];var _0x48f513;if(_0x442e5c>=_0x134ab1){_0x442e5c=_0x134ab1;_0x48f513=0xc8;}else{_0x48f513=0xce;}_0x55ab95[_0x301b('0x17')](_0x48f513);return _0x55ab95[_0x301b('0x1e')](_0x301b('0x1f'),_0x5435c4+'-'+_0x442e5c+'/'+_0x134ab1)[_0x301b('0x19')](_0x24b32d);}return null;};}function patchUpdates(_0x56aef0){return function(_0x27490b){try{jsonpatch[_0x301b('0x20')](_0x27490b,_0x56aef0,!![]);}catch(_0x219f56){return BPromise[_0x301b('0x21')](_0x219f56);}return _0x27490b[_0x301b('0x22')]();};}function saveUpdates(_0x6c5c82,_0x365ff9){return function(_0x246620){if(_0x246620){return _0x246620['update'](_0x6c5c82)[_0x301b('0x23')](function(_0xff2ef5){return _0xff2ef5;});}return null;};}function removeEntity(_0x5ebe29,_0x5ba0d1){return function(_0x356e04){if(_0x356e04){return _0x356e04[_0x301b('0x24')]()[_0x301b('0x23')](function(){_0x5ebe29['status'](0xcc)[_0x301b('0x18')]();});}};}function handleEntityNotFound(_0x2805ec,_0x53dd13){return function(_0x2a7370){if(!_0x2a7370){_0x2805ec[_0x301b('0x16')](0x194);}return _0x2a7370;};}function handleError(_0x4a2c46,_0x4d3709){_0x4d3709=_0x4d3709||0x1f4;return function(_0x2588e9){logger['error'](_0x2588e9[_0x301b('0x25')]);if(_0x2588e9[_0x301b('0x26')]){delete _0x2588e9['name'];}_0x4a2c46['status'](_0x4d3709)['send'](_0x2588e9);};}exports['index']=function(_0x4010f8,_0x4f719c){var _0xe58b73={},_0x5742c2={},_0x5d31f2={'count':0x0,'rows':[]};var _0x1cc400=_[_0x301b('0x27')](db[_0x301b('0x28')][_0x301b('0x29')],function(_0x5f315a){return{'name':_0x5f315a[_0x301b('0x2a')],'type':_0x5f315a[_0x301b('0x2b')][_0x301b('0x2c')]};});_0x5742c2[_0x301b('0x2d')]=_[_0x301b('0x27')](_0x1cc400,_0x301b('0x26'));_0x5742c2['query']=_[_0x301b('0x2e')](_0x4010f8['query']);_0x5742c2[_0x301b('0x2f')]=_['intersection'](_0x5742c2[_0x301b('0x2d')],_0x5742c2[_0x301b('0x30')]);_0xe58b73['attributes']=_['intersection'](_0x5742c2['model'],qs[_0x301b('0x31')](_0x4010f8[_0x301b('0x30')][_0x301b('0x31')]));_0xe58b73['attributes']=_0xe58b73['attributes'][_0x301b('0x32')]?_0xe58b73['attributes']:_0x5742c2[_0x301b('0x2d')];if(!_0x4010f8[_0x301b('0x30')][_0x301b('0x33')](_0x301b('0x34'))){_0xe58b73[_0x301b('0x1b')]=qs['limit'](_0x4010f8['query'][_0x301b('0x1b')]);_0xe58b73[_0x301b('0x1d')]=qs[_0x301b('0x1d')](_0x4010f8['query'][_0x301b('0x1d')]);}_0xe58b73[_0x301b('0x35')]=qs['sort'](_0x4010f8[_0x301b('0x30')]['sort']);_0xe58b73[_0x301b('0x36')]=qs['filters'](_['pick'](_0x4010f8[_0x301b('0x30')],_0x5742c2['filters']),_0x1cc400);if(_0x4010f8[_0x301b('0x30')][_0x301b('0x37')]){_0xe58b73[_0x301b('0x36')]=_[_0x301b('0x38')](_0xe58b73[_0x301b('0x36')],{'$or':_[_0x301b('0x27')](_0x1cc400,function(_0x572ec2){if(_0x572ec2[_0x301b('0x2b')]!==_0x301b('0x39')){var _0x16c6ff={};_0x16c6ff[_0x572ec2['name']]={'$like':'%'+_0x4010f8[_0x301b('0x30')][_0x301b('0x37')]+'%'};return _0x16c6ff;}})});}_0xe58b73=_[_0x301b('0x38')]({},_0xe58b73,_0x4010f8[_0x301b('0x3a')]);var _0x56f967={'where':_0xe58b73[_0x301b('0x36')]};return db[_0x301b('0x28')]['count'](_0x56f967)[_0x301b('0x23')](function(_0x37a4af){_0x5d31f2[_0x301b('0x1c')]=_0x37a4af;if(_0x4010f8[_0x301b('0x30')]['includeAll']){_0xe58b73[_0x301b('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport'][_0x301b('0x3c')](_0xe58b73);})['then'](function(_0x1bf40c){_0x5d31f2[_0x301b('0x3d')]=_0x1bf40c;return _0x5d31f2;})[_0x301b('0x23')](respondWithFilteredResult(_0x4f719c,_0xe58b73))[_0x301b('0x3e')](handleError(_0x4f719c,null));};exports[_0x301b('0x3f')]=function(_0xb283e8,_0xa715ae){var _0x82248c={'raw':!![],'where':{'id':_0xb283e8['params']['id']}},_0x27faf8={};_0x27faf8[_0x301b('0x2d')]=_[_0x301b('0x2e')](db['VoiceDialReport']['rawAttributes']);_0x27faf8[_0x301b('0x30')]=_['keys'](_0xb283e8[_0x301b('0x30')]);_0x27faf8[_0x301b('0x2f')]=_[_0x301b('0x40')](_0x27faf8['model'],_0x27faf8[_0x301b('0x30')]);_0x82248c[_0x301b('0x41')]=_[_0x301b('0x40')](_0x27faf8[_0x301b('0x2d')],qs['fields'](_0xb283e8[_0x301b('0x30')][_0x301b('0x31')]));_0x82248c[_0x301b('0x41')]=_0x82248c[_0x301b('0x41')][_0x301b('0x32')]?_0x82248c['attributes']:_0x27faf8[_0x301b('0x2d')];if(_0xb283e8[_0x301b('0x30')][_0x301b('0x42')]){_0x82248c[_0x301b('0x3b')]=[{'all':!![]}];}_0x82248c=_[_0x301b('0x38')]({},_0x82248c,_0xb283e8['options']);return db['VoiceDialReport'][_0x301b('0x43')](_0x82248c)[_0x301b('0x23')](handleEntityNotFound(_0xa715ae,null))[_0x301b('0x23')](respondWithResult(_0xa715ae,null))[_0x301b('0x3e')](handleError(_0xa715ae,null));};exports[_0x301b('0x44')]=function(_0x10a7af,_0xf82de1){return db[_0x301b('0x28')]['create'](_0x10a7af[_0x301b('0x45')],{})[_0x301b('0x23')](respondWithResult(_0xf82de1,0xc9))[_0x301b('0x3e')](handleError(_0xf82de1,null));};exports[_0x301b('0x46')]=function(_0x273ad0,_0x3ce225){if(_0x273ad0[_0x301b('0x45')]['id']){delete _0x273ad0[_0x301b('0x45')]['id'];}return db['VoiceDialReport'][_0x301b('0x43')]({'where':{'id':_0x273ad0['params']['id']}})[_0x301b('0x23')](handleEntityNotFound(_0x3ce225,null))[_0x301b('0x23')](saveUpdates(_0x273ad0[_0x301b('0x45')],null))[_0x301b('0x23')](respondWithResult(_0x3ce225,null))['catch'](handleError(_0x3ce225,null));};exports['destroy']=function(_0x555be2,_0x4d1ea9){return db[_0x301b('0x28')][_0x301b('0x43')]({'where':{'id':_0x555be2[_0x301b('0x47')]['id']}})['then'](handleEntityNotFound(_0x4d1ea9,null))[_0x301b('0x23')](removeEntity(_0x4d1ea9,null))['catch'](handleError(_0x4d1ea9,null));};exports[_0x301b('0x48')]=function(_0x52ce04,_0x576381){return db[_0x301b('0x28')][_0x301b('0x48')]()['then'](respondWithResult(_0x576381,null))[_0x301b('0x3e')](handleError(_0x576381,null));}; \ No newline at end of file +var _0x4bf6=['json','offset','undefined','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','limit','order','sort','where','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x2910da,_0xf00c37){var _0x5453c5=function(_0x2713a7){while(--_0x2713a7){_0x2910da['push'](_0x2910da['shift']());}};_0x5453c5(++_0xf00c37);}(_0x4bf6,0x1a8));var _0x64bf=function(_0xe90f41,_0x1c97a5){_0xe90f41=_0xe90f41-0x0;var _0x26cf7f=_0x4bf6[_0xe90f41];return _0x26cf7f;};'use strict';var emlformat=require(_0x64bf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x64bf('0x1'));var jsonpatch=require(_0x64bf('0x2'));var rp=require(_0x64bf('0x3'));var moment=require('moment');var BPromise=require(_0x64bf('0x4'));var Mustache=require(_0x64bf('0x5'));var util=require('util');var path=require(_0x64bf('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x64bf('0x7'));var _=require(_0x64bf('0x8'));var squel=require(_0x64bf('0x9'));var crypto=require(_0x64bf('0xa'));var jsforce=require(_0x64bf('0xb'));var deskjs=require(_0x64bf('0xc'));var toCsv=require('to-csv');var querystring=require(_0x64bf('0xd'));var Papa=require('papaparse');var Redis=require(_0x64bf('0xe'));var authService=require(_0x64bf('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x64bf('0x10'));var hardwareService=require(_0x64bf('0x11'));var logger=require('../../config/logger')(_0x64bf('0x12'));var utils=require(_0x64bf('0x13'));var config=require(_0x64bf('0x14'));var licenseUtil=require(_0x64bf('0x15'));var db=require(_0x64bf('0x16'))['db'];function respondWithStatusCode(_0x484847,_0x4ee4cc){_0x4ee4cc=_0x4ee4cc||0xcc;return function(_0x5ed1d7){if(_0x5ed1d7){return _0x484847[_0x64bf('0x17')](_0x4ee4cc);}return _0x484847[_0x64bf('0x18')](_0x4ee4cc)[_0x64bf('0x19')]();};}function respondWithResult(_0x521699,_0x119077){_0x119077=_0x119077||0xc8;return function(_0x2388f6){if(_0x2388f6){return _0x521699[_0x64bf('0x18')](_0x119077)[_0x64bf('0x1a')](_0x2388f6);}};}function respondWithFilteredResult(_0x4812a1,_0xbef71b){return function(_0x4a0920){if(_0x4a0920){var _0x163697=typeof _0xbef71b[_0x64bf('0x1b')]===_0x64bf('0x1c')&&typeof _0xbef71b['limit']==='undefined';var _0x575399=_0x4a0920['count'];var _0x2a9c31=_0x163697?0x0:_0xbef71b['offset'];var _0x109367=_0x163697?_0x4a0920['count']:_0xbef71b[_0x64bf('0x1b')]+_0xbef71b['limit'];var _0x3699c5;if(_0x109367>=_0x575399){_0x109367=_0x575399;_0x3699c5=0xc8;}else{_0x3699c5=0xce;}_0x4812a1[_0x64bf('0x18')](_0x3699c5);return _0x4812a1['set'](_0x64bf('0x1d'),_0x2a9c31+'-'+_0x109367+'/'+_0x575399)[_0x64bf('0x1a')](_0x4a0920);}return null;};}function patchUpdates(_0x5f5610){return function(_0x369fea){try{jsonpatch[_0x64bf('0x1e')](_0x369fea,_0x5f5610,!![]);}catch(_0x25590f){return BPromise[_0x64bf('0x1f')](_0x25590f);}return _0x369fea[_0x64bf('0x20')]();};}function saveUpdates(_0x503d54,_0x38d5fb){return function(_0x36327a){if(_0x36327a){return _0x36327a[_0x64bf('0x21')](_0x503d54)[_0x64bf('0x22')](function(_0x104498){return _0x104498;});}return null;};}function removeEntity(_0x5c46a3,_0x3b3bc9){return function(_0x1de2d2){if(_0x1de2d2){return _0x1de2d2[_0x64bf('0x23')]()[_0x64bf('0x22')](function(){_0x5c46a3[_0x64bf('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15dd0d,_0x4fc75d){return function(_0x5bf225){if(!_0x5bf225){_0x15dd0d[_0x64bf('0x17')](0x194);}return _0x5bf225;};}function handleError(_0x70719d,_0x5a753f){_0x5a753f=_0x5a753f||0x1f4;return function(_0x4aa69f){logger[_0x64bf('0x24')](_0x4aa69f[_0x64bf('0x25')]);if(_0x4aa69f[_0x64bf('0x26')]){delete _0x4aa69f[_0x64bf('0x26')];}_0x70719d[_0x64bf('0x18')](_0x5a753f)[_0x64bf('0x27')](_0x4aa69f);};}exports[_0x64bf('0x28')]=function(_0x7fc87b,_0x34121c){var _0x282da3={},_0x230e6d={},_0x251fb1={'count':0x0,'rows':[]};var _0x36e102=_[_0x64bf('0x29')](db[_0x64bf('0x2a')][_0x64bf('0x2b')],function(_0x546327){return{'name':_0x546327['fieldName'],'type':_0x546327[_0x64bf('0x2c')][_0x64bf('0x2d')]};});_0x230e6d[_0x64bf('0x2e')]=_['map'](_0x36e102,_0x64bf('0x26'));_0x230e6d[_0x64bf('0x2f')]=_[_0x64bf('0x30')](_0x7fc87b[_0x64bf('0x2f')]);_0x230e6d[_0x64bf('0x31')]=_['intersection'](_0x230e6d[_0x64bf('0x2e')],_0x230e6d[_0x64bf('0x2f')]);_0x282da3[_0x64bf('0x32')]=_[_0x64bf('0x33')](_0x230e6d[_0x64bf('0x2e')],qs[_0x64bf('0x34')](_0x7fc87b[_0x64bf('0x2f')]['fields']));_0x282da3[_0x64bf('0x32')]=_0x282da3['attributes'][_0x64bf('0x35')]?_0x282da3[_0x64bf('0x32')]:_0x230e6d[_0x64bf('0x2e')];if(!_0x7fc87b[_0x64bf('0x2f')]['hasOwnProperty'](_0x64bf('0x36'))){_0x282da3['limit']=qs[_0x64bf('0x37')](_0x7fc87b[_0x64bf('0x2f')][_0x64bf('0x37')]);_0x282da3[_0x64bf('0x1b')]=qs[_0x64bf('0x1b')](_0x7fc87b[_0x64bf('0x2f')][_0x64bf('0x1b')]);}_0x282da3[_0x64bf('0x38')]=qs[_0x64bf('0x39')](_0x7fc87b['query'][_0x64bf('0x39')]);_0x282da3['where']=qs[_0x64bf('0x31')](_['pick'](_0x7fc87b[_0x64bf('0x2f')],_0x230e6d[_0x64bf('0x31')]),_0x36e102);if(_0x7fc87b[_0x64bf('0x2f')]['filter']){_0x282da3[_0x64bf('0x3a')]=_[_0x64bf('0x3b')](_0x282da3[_0x64bf('0x3a')],{'$or':_[_0x64bf('0x29')](_0x36e102,function(_0x53df0d){if(_0x53df0d[_0x64bf('0x2c')]!==_0x64bf('0x3c')){var _0x10ac09={};_0x10ac09[_0x53df0d['name']]={'$like':'%'+_0x7fc87b[_0x64bf('0x2f')][_0x64bf('0x3d')]+'%'};return _0x10ac09;}})});}_0x282da3=_[_0x64bf('0x3b')]({},_0x282da3,_0x7fc87b[_0x64bf('0x3e')]);var _0x268f79={'where':_0x282da3[_0x64bf('0x3a')]};return db[_0x64bf('0x2a')][_0x64bf('0x3f')](_0x268f79)[_0x64bf('0x22')](function(_0x24f422){_0x251fb1[_0x64bf('0x3f')]=_0x24f422;if(_0x7fc87b['query'][_0x64bf('0x40')]){_0x282da3[_0x64bf('0x41')]=[{'all':!![]}];}return db[_0x64bf('0x2a')][_0x64bf('0x42')](_0x282da3);})['then'](function(_0x4e522e){_0x251fb1[_0x64bf('0x43')]=_0x4e522e;return _0x251fb1;})[_0x64bf('0x22')](respondWithFilteredResult(_0x34121c,_0x282da3))[_0x64bf('0x44')](handleError(_0x34121c,null));};exports[_0x64bf('0x45')]=function(_0xffff49,_0x202b21){var _0x3ea9d3={'raw':!![],'where':{'id':_0xffff49[_0x64bf('0x46')]['id']}},_0x414608={};_0x414608[_0x64bf('0x2e')]=_['keys'](db[_0x64bf('0x2a')][_0x64bf('0x2b')]);_0x414608[_0x64bf('0x2f')]=_['keys'](_0xffff49['query']);_0x414608['filters']=_[_0x64bf('0x33')](_0x414608[_0x64bf('0x2e')],_0x414608[_0x64bf('0x2f')]);_0x3ea9d3['attributes']=_[_0x64bf('0x33')](_0x414608['model'],qs[_0x64bf('0x34')](_0xffff49[_0x64bf('0x2f')][_0x64bf('0x34')]));_0x3ea9d3[_0x64bf('0x32')]=_0x3ea9d3['attributes'][_0x64bf('0x35')]?_0x3ea9d3['attributes']:_0x414608[_0x64bf('0x2e')];if(_0xffff49[_0x64bf('0x2f')]['includeAll']){_0x3ea9d3[_0x64bf('0x41')]=[{'all':!![]}];}_0x3ea9d3=_['merge']({},_0x3ea9d3,_0xffff49[_0x64bf('0x3e')]);return db['VoiceDialReport'][_0x64bf('0x47')](_0x3ea9d3)[_0x64bf('0x22')](handleEntityNotFound(_0x202b21,null))['then'](respondWithResult(_0x202b21,null))[_0x64bf('0x44')](handleError(_0x202b21,null));};exports[_0x64bf('0x48')]=function(_0x20c63d,_0x2d648e){return db[_0x64bf('0x2a')][_0x64bf('0x48')](_0x20c63d[_0x64bf('0x49')],{})[_0x64bf('0x22')](respondWithResult(_0x2d648e,0xc9))[_0x64bf('0x44')](handleError(_0x2d648e,null));};exports[_0x64bf('0x21')]=function(_0x4fc463,_0x3864c5){if(_0x4fc463[_0x64bf('0x49')]['id']){delete _0x4fc463[_0x64bf('0x49')]['id'];}return db['VoiceDialReport']['find']({'where':{'id':_0x4fc463[_0x64bf('0x46')]['id']}})[_0x64bf('0x22')](handleEntityNotFound(_0x3864c5,null))['then'](saveUpdates(_0x4fc463[_0x64bf('0x49')],null))[_0x64bf('0x22')](respondWithResult(_0x3864c5,null))['catch'](handleError(_0x3864c5,null));};exports['destroy']=function(_0x370642,_0x3e8147){return db[_0x64bf('0x2a')]['find']({'where':{'id':_0x370642['params']['id']}})[_0x64bf('0x22')](handleEntityNotFound(_0x3e8147,null))['then'](removeEntity(_0x3e8147,null))[_0x64bf('0x44')](handleError(_0x3e8147,null));};exports[_0x64bf('0x4a')]=function(_0x26cf60,_0x5b59b7){return db[_0x64bf('0x2a')][_0x64bf('0x4a')]()[_0x64bf('0x22')](respondWithResult(_0x5b59b7,null))[_0x64bf('0x44')](handleError(_0x5b59b7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index d299b12..da315a8 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 _0xb708=['lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','report_dial','uniqueid'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0xb708,0xe7));var _0x8b70=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xb708[_0xbe200f];return _0x192597;};'use strict';var _=require(_0x8b70('0x0'));var util=require('util');var logger=require(_0x8b70('0x1'))('api');var moment=require(_0x8b70('0x2'));var BPromise=require(_0x8b70('0x3'));var rp=require(_0x8b70('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b70('0x5'));var config=require(_0x8b70('0x6'));var attributes=require(_0x8b70('0x7'));module['exports']=function(_0x2e991c,_0x3a63fb){return _0x2e991c['define'](_0x8b70('0x8'),attributes,{'tableName':_0x8b70('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8b70('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2b99=['VoiceDialReport','report_dial','uniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./voiceDialReport.attributes','define'];(function(_0x5145fd,_0x8f267b){var _0x276aab=function(_0x35077d){while(--_0x35077d){_0x5145fd['push'](_0x5145fd['shift']());}};_0x276aab(++_0x8f267b);}(_0x2b99,0x1b3));var _0x92b9=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x2b99[_0x24f31b];return _0x488401;};'use strict';var _=require(_0x92b9('0x0'));var util=require(_0x92b9('0x1'));var logger=require(_0x92b9('0x2'))('api');var moment=require(_0x92b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x92b9('0x4'));var fs=require('fs');var path=require(_0x92b9('0x5'));var rimraf=require('rimraf');var config=require(_0x92b9('0x6'));var attributes=require(_0x92b9('0x7'));module['exports']=function(_0xe4a56e,_0x1cce13){return _0xe4a56e[_0x92b9('0x8')](_0x92b9('0x9'),attributes,{'tableName':_0x92b9('0xa'),'paranoid':![],'indexes':[{'fields':[_0x92b9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0a133b0..c95e5c8 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 _0x2a9f=['catch','CreateVoiceDialReport','VoiceDialReport','create','body','options','raw','UpdateVoiceDialReport','update','where','attributes','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x2a9f,0x10b));var _0xf2a9=function(_0x70fe73,_0x435a10){_0x70fe73=_0x70fe73-0x0;var _0x3af159=_0x2a9f[_0x70fe73];return _0x3af159;};'use strict';var _=require(_0xf2a9('0x0'));var util=require(_0xf2a9('0x1'));var moment=require(_0xf2a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xf2a9('0x3'));var fs=require('fs');var Redis=require(_0xf2a9('0x4'));var db=require(_0xf2a9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf2a9('0x6'))('rpc');var config=require(_0xf2a9('0x7'));var jayson=require(_0xf2a9('0x8'));var client=jayson[_0xf2a9('0x9')][_0xf2a9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e3015,_0x575859,_0x24594e){return new BPromise(function(_0x2afce1,_0x1dbcea){return client[_0xf2a9('0xb')](_0x5e3015,_0x24594e)[_0xf2a9('0xc')](function(_0xe95baa){logger[_0xf2a9('0xd')](_0xf2a9('0xe'),_0x575859,_0xf2a9('0xf'));logger[_0xf2a9('0x10')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x575859,_0xf2a9('0xf'),JSON[_0xf2a9('0x11')](_0xe95baa));if(_0xe95baa['error']){if(_0xe95baa[_0xf2a9('0x12')]['code']===0x1f4){logger[_0xf2a9('0x12')](_0xf2a9('0xe'),_0x575859,_0xe95baa[_0xf2a9('0x12')][_0xf2a9('0x13')]);return _0x1dbcea(_0xe95baa[_0xf2a9('0x12')][_0xf2a9('0x13')]);}logger[_0xf2a9('0x12')](_0xf2a9('0xe'),_0x575859,_0xe95baa[_0xf2a9('0x12')]['message']);return _0x2afce1(_0xe95baa[_0xf2a9('0x12')]['message']);}else{logger[_0xf2a9('0xd')](_0xf2a9('0xe'),_0x575859,'request\x20sent');_0x2afce1(_0xe95baa[_0xf2a9('0x14')][_0xf2a9('0x13')]);}})[_0xf2a9('0x15')](function(_0x37a369){logger[_0xf2a9('0x12')](_0xf2a9('0xe'),_0x575859,_0x37a369);_0x1dbcea(_0x37a369);});});}exports[_0xf2a9('0x16')]=function(_0x75d315){var _0x3ff2f1=this;return new Promise(function(_0x3b29a2,_0x514678){return db[_0xf2a9('0x17')][_0xf2a9('0x18')](_0x75d315[_0xf2a9('0x19')],{'raw':_0x75d315[_0xf2a9('0x1a')]?_0x75d315['options'][_0xf2a9('0x1b')]===undefined?!![]:![]:!![]})[_0xf2a9('0xc')](function(_0x2b5f5c){logger['info'](_0xf2a9('0x16'),_0x75d315);logger[_0xf2a9('0x10')](_0xf2a9('0x16'),_0x75d315,JSON['stringify'](_0x2b5f5c));_0x3b29a2(_0x2b5f5c);})[_0xf2a9('0x15')](function(_0x5689ff){logger[_0xf2a9('0x12')](_0xf2a9('0x16'),_0x5689ff[_0xf2a9('0x13')],_0x75d315);_0x514678(_0x3ff2f1['error'](0x1f4,_0x5689ff[_0xf2a9('0x13')]));});});};exports[_0xf2a9('0x1c')]=function(_0x34b35b){var _0x29beca=this;return new Promise(function(_0x4cfb52,_0x211c95){return db[_0xf2a9('0x17')][_0xf2a9('0x1d')](_0x34b35b['body'],{'raw':_0x34b35b[_0xf2a9('0x1a')]?_0x34b35b[_0xf2a9('0x1a')][_0xf2a9('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34b35b[_0xf2a9('0x1a')]?_0x34b35b[_0xf2a9('0x1a')][_0xf2a9('0x1e')]||null:null,'attributes':_0x34b35b['options']?_0x34b35b[_0xf2a9('0x1a')][_0xf2a9('0x1f')]||null:null,'limit':_0x34b35b[_0xf2a9('0x1a')]?_0x34b35b[_0xf2a9('0x1a')]['limit']||null:null})['then'](function(_0x20c02c){logger[_0xf2a9('0xd')]('UpdateVoiceDialReport',_0x34b35b);logger[_0xf2a9('0x10')](_0xf2a9('0x1c'),_0x34b35b,JSON['stringify'](_0x20c02c));_0x4cfb52(_0x20c02c);})['catch'](function(_0x24ab50){logger[_0xf2a9('0x12')]('UpdateVoiceDialReport',_0x24ab50[_0xf2a9('0x13')],_0x34b35b);_0x211c95(_0x29beca[_0xf2a9('0x12')](0x1f4,_0x24ab50[_0xf2a9('0x13')]));});});}; \ No newline at end of file +var _0x0046=['body','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','update','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','VoiceDialReport','create'];(function(_0x1d8fa1,_0x18d00f){var _0x528467=function(_0x259e18){while(--_0x259e18){_0x1d8fa1['push'](_0x1d8fa1['shift']());}};_0x528467(++_0x18d00f);}(_0x0046,0x91));var _0x6004=function(_0x22c83b,_0x1d01b7){_0x22c83b=_0x22c83b-0x0;var _0x2fe73d=_0x0046[_0x22c83b];return _0x2fe73d;};'use strict';var _=require(_0x6004('0x0'));var util=require(_0x6004('0x1'));var moment=require(_0x6004('0x2'));var BPromise=require(_0x6004('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6004('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6004('0x5'));var logger=require('../../config/logger')(_0x6004('0x6'));var config=require(_0x6004('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6004('0x8')][_0x6004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e8b13,_0x495ed7,_0x1f18e6){return new BPromise(function(_0x38865f,_0x577527){return client[_0x6004('0xa')](_0x3e8b13,_0x1f18e6)[_0x6004('0xb')](function(_0x59736b){logger[_0x6004('0xc')](_0x6004('0xd'),_0x495ed7,'request\x20sent');logger[_0x6004('0xe')](_0x6004('0xf'),_0x495ed7,'request\x20sent',JSON[_0x6004('0x10')](_0x59736b));if(_0x59736b[_0x6004('0x11')]){if(_0x59736b[_0x6004('0x11')][_0x6004('0x12')]===0x1f4){logger[_0x6004('0x11')](_0x6004('0xd'),_0x495ed7,_0x59736b[_0x6004('0x11')][_0x6004('0x13')]);return _0x577527(_0x59736b[_0x6004('0x11')]['message']);}logger[_0x6004('0x11')](_0x6004('0xd'),_0x495ed7,_0x59736b[_0x6004('0x11')][_0x6004('0x13')]);return _0x38865f(_0x59736b['error'][_0x6004('0x13')]);}else{logger[_0x6004('0xc')](_0x6004('0xd'),_0x495ed7,_0x6004('0x14'));_0x38865f(_0x59736b[_0x6004('0x15')][_0x6004('0x13')]);}})[_0x6004('0x16')](function(_0x1f6dff){logger[_0x6004('0x11')](_0x6004('0xd'),_0x495ed7,_0x1f6dff);_0x577527(_0x1f6dff);});});}exports['CreateVoiceDialReport']=function(_0x36e383){var _0x5d4770=this;return new Promise(function(_0x30d83b,_0x1a9b29){return db[_0x6004('0x17')][_0x6004('0x18')](_0x36e383[_0x6004('0x19')],{'raw':_0x36e383['options']?_0x36e383[_0x6004('0x1a')][_0x6004('0x1b')]===undefined?!![]:![]:!![]})[_0x6004('0xb')](function(_0x2405ea){logger[_0x6004('0xc')](_0x6004('0x1c'),_0x36e383);logger['debug'](_0x6004('0x1c'),_0x36e383,JSON[_0x6004('0x10')](_0x2405ea));_0x30d83b(_0x2405ea);})[_0x6004('0x16')](function(_0x1d0e5c){logger[_0x6004('0x11')](_0x6004('0x1c'),_0x1d0e5c['message'],_0x36e383);_0x1a9b29(_0x5d4770[_0x6004('0x11')](0x1f4,_0x1d0e5c[_0x6004('0x13')]));});});};exports[_0x6004('0x1d')]=function(_0x398d87){var _0x2a9243=this;return new Promise(function(_0x5515c6,_0x19fe1b){return db[_0x6004('0x17')][_0x6004('0x1e')](_0x398d87[_0x6004('0x19')],{'raw':_0x398d87[_0x6004('0x1a')]?_0x398d87[_0x6004('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x398d87[_0x6004('0x1a')]?_0x398d87['options'][_0x6004('0x1f')]||null:null,'attributes':_0x398d87['options']?_0x398d87[_0x6004('0x1a')][_0x6004('0x20')]||null:null,'limit':_0x398d87[_0x6004('0x1a')]?_0x398d87['options'][_0x6004('0x21')]||null:null})[_0x6004('0xb')](function(_0x47af73){logger[_0x6004('0xc')](_0x6004('0x1d'),_0x398d87);logger[_0x6004('0xe')]('UpdateVoiceDialReport',_0x398d87,JSON[_0x6004('0x10')](_0x47af73));_0x5515c6(_0x47af73);})[_0x6004('0x16')](function(_0x19b648){logger[_0x6004('0x11')](_0x6004('0x1d'),_0x19b648[_0x6004('0x13')],_0x398d87);_0x19fe1b(_0x2a9243[_0x6004('0x11')](0x1f4,_0x19b648[_0x6004('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index a13b795..7cb5db6 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 _0x4292=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x12b004,_0x1b2926){var _0x5366f7=function(_0x3b078a){while(--_0x3b078a){_0x12b004['push'](_0x12b004['shift']());}};_0x5366f7(++_0x1b2926);}(_0x4292,0xcc));var _0x2429=function(_0x3495e7,_0x2f6a1f){_0x3495e7=_0x3495e7-0x0;var _0x5cbb6f=_0x4292[_0x3495e7];return _0x5cbb6f;};'use strict';var multer=require(_0x2429('0x0'));var util=require(_0x2429('0x1'));var path=require(_0x2429('0x2'));var timeout=require('connect-timeout');var express=require(_0x2429('0x3'));var router=express[_0x2429('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x2429('0x5'));var interaction=require(_0x2429('0x6'));var config=require(_0x2429('0x7'));var controller=require(_0x2429('0x8'));router[_0x2429('0x9')]('/',auth[_0x2429('0xa')](),controller[_0x2429('0xb')]);router['get'](_0x2429('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2429('0xd')]('/',auth[_0x2429('0xa')](),controller[_0x2429('0xe')]);router[_0x2429('0xd')](_0x2429('0xf'),auth['isAuthenticated'](),controller[_0x2429('0x10')]);router['put'](_0x2429('0xc'),auth[_0x2429('0xa')](),controller[_0x2429('0x11')]);router[_0x2429('0x12')](_0x2429('0xc'),auth['isAuthenticated'](),controller[_0x2429('0x13')]);module[_0x2429('0x14')]=router; \ No newline at end of file +var _0x08dd=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','create','/:id/applications','addApplications','put','update','destroy','exports','multer','util','connect-timeout','express'];(function(_0x3037d2,_0x70eac9){var _0x2b770c=function(_0x59972d){while(--_0x59972d){_0x3037d2['push'](_0x3037d2['shift']());}};_0x2b770c(++_0x70eac9);}(_0x08dd,0x1b1));var _0xd08d=function(_0x442b4e,_0x5e4c18){_0x442b4e=_0x442b4e-0x0;var _0x3e1ae4=_0x08dd[_0x442b4e];return _0x3e1ae4;};'use strict';var multer=require(_0xd08d('0x0'));var util=require(_0xd08d('0x1'));var path=require('path');var timeout=require(_0xd08d('0x2'));var express=require(_0xd08d('0x3'));var router=express[_0xd08d('0x4')]();var fs_extra=require(_0xd08d('0x5'));var auth=require(_0xd08d('0x6'));var interaction=require(_0xd08d('0x7'));var config=require('../../config/environment');var controller=require('./voiceExtension.controller');router[_0xd08d('0x8')]('/',auth[_0xd08d('0x9')](),controller[_0xd08d('0xa')]);router[_0xd08d('0x8')](_0xd08d('0xb'),auth[_0xd08d('0x9')](),controller['show']);router['post']('/',auth[_0xd08d('0x9')](),controller[_0xd08d('0xc')]);router['post'](_0xd08d('0xd'),auth[_0xd08d('0x9')](),controller[_0xd08d('0xe')]);router[_0xd08d('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xd08d('0x10')]);router['delete']('/:id',auth[_0xd08d('0x9')](),controller[_0xd08d('0x11')]);module[_0xd08d('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index e618926..384a372 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 _0x70e0=['INTEGER','wav','VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound-fax','outbound-fax','system','any','*,*,*,*','BOOLEAN'];(function(_0x5eaa0b,_0x433b2f){var _0x28b295=function(_0x5e4f6d){while(--_0x5e4f6d){_0x5eaa0b['push'](_0x5eaa0b['shift']());}};_0x28b295(++_0x433b2f);}(_0x70e0,0x17b));var _0x070e=function(_0x23f1be,_0x124ddd){_0x23f1be=_0x23f1be-0x0;var _0x8fee8e=_0x70e0[_0x23f1be];return _0x8fee8e;};'use strict';var Sequelize=require(_0x070e('0x0'));module[_0x070e('0x1')]={'context':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x070e('0x3')},'priority':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x070e('0x3')},'tag':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x070e('0x4')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x070e('0x5')]('inbound','outbound','internal',_0x070e('0x6'),_0x070e('0x7'),_0x070e('0x8'),_0x070e('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x070e('0x2')]},'interval':{'type':Sequelize[_0x070e('0x2')],'allowNull':![],'defaultValue':_0x070e('0xa')},'IntervalId':{'type':Sequelize['INTEGER']},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x070e('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x070e('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x070e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x070e('0xc')]},'recordingFormat':{'type':Sequelize[_0x070e('0x2')],'defaultValue':_0x070e('0xd')},'answer':{'type':Sequelize[_0x070e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x070e('0xe')],'get':function(){return this[_0x070e('0xf')](_0x070e('0x10'));}}}; \ No newline at end of file +var _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x4dd26d,_0xedc830){var _0x593d9e=function(_0x41d9db){while(--_0x41d9db){_0x4dd26d['push'](_0x4dd26d['shift']());}};_0x593d9e(++_0xedc830);}(_0xb7e7,0x121));var _0x7b7e=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xb7e7[_0x24259d];return _0x5a701;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 94adcb0..a36eafd 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 _0xb2d5=['merge','VIRTUAL','options','include','findAll','rows','catch','show','params','create','startsWith','exten','body','concat','user','role','InboundRoutes','inbound','UserProfileSection','autoAssociation','update','context','recordingFormat','mandatoryDisposition','alias','sequelize','transaction','Transaction','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./voiceExtension.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','then','get','OutboundRoutes','outbound','InternalRoutes','internal','filter','map','value','type','find','name','UserProfileResource','destroy','sendStatus','error','stack','send','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','where'];(function(_0x1b35a3,_0x29c081){var _0x5f4dbd=function(_0x1b1aaa){while(--_0x1b1aaa){_0x1b35a3['push'](_0x1b35a3['shift']());}};_0x5f4dbd(++_0x29c081);}(_0xb2d5,0x1f0));var _0x5b2d=function(_0x37c3a3,_0x1cbefb){_0x37c3a3=_0x37c3a3-0x0;var _0x3da024=_0xb2d5[_0x37c3a3];return _0x3da024;};'use strict';var _=require(_0x5b2d('0x0'));var Redis=require('ioredis');var qs=require(_0x5b2d('0x1'));var logger=require(_0x5b2d('0x2'))(_0x5b2d('0x3'));var config=require(_0x5b2d('0x4'));var db=require(_0x5b2d('0x5'))['db'];config['redis']=_[_0x5b2d('0x6')](config['redis'],{'host':_0x5b2d('0x7'),'port':0x18eb});var socket=require(_0x5b2d('0x8'))(new Redis(config[_0x5b2d('0x9')]));require(_0x5b2d('0xa'))[_0x5b2d('0xb')](socket);function respondWithStatusCode(_0x489b6c,_0x3ae99b){_0x3ae99b=_0x3ae99b||0xcc;return function(_0x4f5f8a){if(_0x4f5f8a){return _0x489b6c['sendStatus'](_0x3ae99b);}return _0x489b6c[_0x5b2d('0xc')](_0x3ae99b)[_0x5b2d('0xd')]();};}function respondWithResult(_0x1c9102,_0x5a1f0b){_0x5a1f0b=_0x5a1f0b||0xc8;return function(_0x56aae7){if(_0x56aae7){return _0x1c9102[_0x5b2d('0xc')](_0x5a1f0b)[_0x5b2d('0xe')](_0x56aae7);}};}function respondWithFilteredResult(_0x5a1594,_0x3f1ddd){return function(_0x5e7ce7){if(_0x5e7ce7){var _0x8a1c33=typeof _0x3f1ddd[_0x5b2d('0xf')]===_0x5b2d('0x10')&&typeof _0x3f1ddd['limit']===_0x5b2d('0x10');var _0x5e701e=_0x5e7ce7[_0x5b2d('0x11')];var _0x343f7c=_0x8a1c33?0x0:_0x3f1ddd[_0x5b2d('0xf')];var _0x560484=_0x8a1c33?_0x5e7ce7['count']:_0x3f1ddd[_0x5b2d('0xf')]+_0x3f1ddd[_0x5b2d('0x12')];var _0x23df47;if(_0x560484>=_0x5e701e){_0x560484=_0x5e701e;_0x23df47=0xc8;}else{_0x23df47=0xce;}_0x5a1594[_0x5b2d('0xc')](_0x23df47);return _0x5a1594[_0x5b2d('0x13')](_0x5b2d('0x14'),_0x343f7c+'-'+_0x560484+'/'+_0x5e701e)['json'](_0x5e7ce7);}return null;};}function removeEntity(_0xb556b6){return function(_0x17bc13){if(_0x17bc13){return _0x17bc13['destroy']()[_0x5b2d('0x15')](function(){var _0xec209=_0x17bc13[_0x5b2d('0x16')]({'plain':!![]});var _0xa2eb48=[{'name':'InboundRoutes','value':'inbound','ignore':![]},{'name':_0x5b2d('0x17'),'value':_0x5b2d('0x18'),'ignore':![]},{'name':_0x5b2d('0x19'),'value':_0x5b2d('0x1a'),'ignore':![]}];var _0x2c59a0=_(_0xa2eb48)[_0x5b2d('0x1b')]('ignore')[_0x5b2d('0x1c')](_0x5b2d('0x1d'))[_0x5b2d('0x1d')]();if(_['includes'](_0x2c59a0,_0xec209[_0x5b2d('0x1e')])){return;}var _0x4bd8e4=_[_0x5b2d('0x1f')](_0xa2eb48,[_0x5b2d('0x1d'),_0xec209[_0x5b2d('0x1e')]])[_0x5b2d('0x20')];return db[_0x5b2d('0x21')][_0x5b2d('0x22')]({'where':{'type':_0x4bd8e4,'resourceId':_0xec209['id']}})[_0x5b2d('0x15')](function(){return _0x17bc13;});})[_0x5b2d('0x15')](function(){_0xb556b6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3dbeb1){return function(_0x5a46d8){if(!_0x5a46d8){_0x3dbeb1[_0x5b2d('0x23')](0x194);}return _0x5a46d8;};}function handleError(_0x57172a,_0x344848){_0x344848=_0x344848||0x1f4;return function(_0xfd9e51){logger[_0x5b2d('0x24')](_0xfd9e51[_0x5b2d('0x25')]);if(_0xfd9e51['name']){delete _0xfd9e51[_0x5b2d('0x20')];}_0x57172a['status'](_0x344848)[_0x5b2d('0x26')](_0xfd9e51);};}exports['index']=function(_0x503043,_0x5ee0b2){var _0x396f80={},_0xaf0a17={},_0x4f9cc9={'count':0x0,'rows':[]};var _0x28e52d=_[_0x5b2d('0x1c')](db[_0x5b2d('0x27')][_0x5b2d('0x28')],function(_0x42a04e){return{'name':_0x42a04e[_0x5b2d('0x29')],'type':_0x42a04e[_0x5b2d('0x1e')][_0x5b2d('0x2a')]};});_0xaf0a17[_0x5b2d('0x2b')]=_[_0x5b2d('0x1c')](_0x28e52d,'name');_0xaf0a17[_0x5b2d('0x2c')]=_[_0x5b2d('0x2d')](_0x503043[_0x5b2d('0x2c')]);_0xaf0a17['filters']=_['intersection'](_0xaf0a17[_0x5b2d('0x2b')],_0xaf0a17[_0x5b2d('0x2c')]);_0x396f80[_0x5b2d('0x2e')]=_[_0x5b2d('0x2f')](_0xaf0a17[_0x5b2d('0x2b')],qs[_0x5b2d('0x30')](_0x503043[_0x5b2d('0x2c')][_0x5b2d('0x30')]));_0x396f80[_0x5b2d('0x2e')]=_0x396f80['attributes'][_0x5b2d('0x31')]?_0x396f80[_0x5b2d('0x2e')]:_0xaf0a17[_0x5b2d('0x2b')];if(!_0x503043[_0x5b2d('0x2c')]['hasOwnProperty'](_0x5b2d('0x32'))){_0x396f80[_0x5b2d('0x12')]=qs[_0x5b2d('0x12')](_0x503043[_0x5b2d('0x2c')][_0x5b2d('0x12')]);_0x396f80[_0x5b2d('0xf')]=qs['offset'](_0x503043[_0x5b2d('0x2c')][_0x5b2d('0xf')]);}_0x396f80[_0x5b2d('0x33')]=qs[_0x5b2d('0x34')](_0x503043[_0x5b2d('0x2c')]['sort']);_0x396f80['where']=qs[_0x5b2d('0x35')](_[_0x5b2d('0x36')](_0x503043['query'],_0xaf0a17['filters']),_0x28e52d);if(_0x503043[_0x5b2d('0x2c')][_0x5b2d('0x1b')]){_0x396f80[_0x5b2d('0x37')]=_[_0x5b2d('0x38')](_0x396f80['where'],{'$or':_[_0x5b2d('0x1c')](_0x28e52d,function(_0x3f4b41){if(_0x3f4b41[_0x5b2d('0x1e')]!==_0x5b2d('0x39')){var _0x20473f={};_0x20473f[_0x3f4b41[_0x5b2d('0x20')]]={'$like':'%'+_0x503043[_0x5b2d('0x2c')]['filter']+'%'};return _0x20473f;}})});}_0x396f80=_['merge']({},_0x396f80,_0x503043[_0x5b2d('0x3a')]);var _0x1d7ccc={'where':_0x396f80['where']};return db[_0x5b2d('0x27')][_0x5b2d('0x11')](_0x1d7ccc)['then'](function(_0x578bb6){_0x4f9cc9[_0x5b2d('0x11')]=_0x578bb6;if(_0x503043['query']['includeAll']){_0x396f80[_0x5b2d('0x3b')]=[{'all':!![]}];}return db['VoiceExtension'][_0x5b2d('0x3c')](_0x396f80);})[_0x5b2d('0x15')](function(_0x1ef120){_0x4f9cc9[_0x5b2d('0x3d')]=_0x1ef120;return _0x4f9cc9;})[_0x5b2d('0x15')](respondWithFilteredResult(_0x5ee0b2,_0x396f80))[_0x5b2d('0x3e')](handleError(_0x5ee0b2,null));};exports[_0x5b2d('0x3f')]=function(_0x3b4e12,_0x2b217b){var _0x537245={'raw':![],'where':{'id':_0x3b4e12[_0x5b2d('0x40')]['id']}},_0x4218e3={};_0x4218e3[_0x5b2d('0x2b')]=_[_0x5b2d('0x2d')](db[_0x5b2d('0x27')][_0x5b2d('0x28')]);_0x4218e3[_0x5b2d('0x2c')]=_[_0x5b2d('0x2d')](_0x3b4e12[_0x5b2d('0x2c')]);_0x4218e3['filters']=_[_0x5b2d('0x2f')](_0x4218e3[_0x5b2d('0x2b')],_0x4218e3[_0x5b2d('0x2c')]);_0x537245[_0x5b2d('0x2e')]=_['intersection'](_0x4218e3[_0x5b2d('0x2b')],qs[_0x5b2d('0x30')](_0x3b4e12[_0x5b2d('0x2c')][_0x5b2d('0x30')]));_0x537245[_0x5b2d('0x2e')]=_0x537245[_0x5b2d('0x2e')][_0x5b2d('0x31')]?_0x537245[_0x5b2d('0x2e')]:_0x4218e3[_0x5b2d('0x2b')];if(_0x3b4e12[_0x5b2d('0x2c')]['includeAll']){_0x537245[_0x5b2d('0x3b')]=[{'all':!![]}];}_0x537245=_[_0x5b2d('0x38')]({},_0x537245,_0x3b4e12[_0x5b2d('0x3a')]);return db[_0x5b2d('0x27')]['find'](_0x537245)['then'](handleEntityNotFound(_0x2b217b,null))['then'](respondWithResult(_0x2b217b,null))[_0x5b2d('0x3e')](handleError(_0x2b217b,null));};exports['destroy']=function(_0x1bab71,_0x59d7a7){return db[_0x5b2d('0x27')][_0x5b2d('0x1f')]({'where':{'id':_0x1bab71['params']['id']}})[_0x5b2d('0x15')](handleEntityNotFound(_0x59d7a7,null))[_0x5b2d('0x15')](removeEntity(_0x59d7a7,null))[_0x5b2d('0x3e')](handleError(_0x59d7a7,null));};exports[_0x5b2d('0x41')]=function(_0x118774,_0x380996){if(_0x118774['body'][_0x5b2d('0x1e')]===_0x5b2d('0x18')&&!_[_0x5b2d('0x42')](_0x118774['body'][_0x5b2d('0x43')],'_')){_0x118774[_0x5b2d('0x44')][_0x5b2d('0x43')]='_'[_0x5b2d('0x45')](_0x118774['body'][_0x5b2d('0x43')]);}return db[_0x5b2d('0x27')][_0x5b2d('0x41')](_0x118774[_0x5b2d('0x44')],{'raw':![]})[_0x5b2d('0x15')](function(_0x3b5056){var _0x63c28b=_0x118774[_0x5b2d('0x46')][_0x5b2d('0x16')]({'plain':!![]});if(!_0x63c28b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x63c28b[_0x5b2d('0x47')]===_0x5b2d('0x46')){var _0x58410c=_0x3b5056[_0x5b2d('0x16')]({'plain':!![]});var _0xde6909=[{'name':_0x5b2d('0x48'),'value':_0x5b2d('0x49')},{'name':_0x5b2d('0x17'),'value':_0x5b2d('0x18')},{'name':_0x5b2d('0x19'),'value':_0x5b2d('0x1a')}];var _0x2081fe=_['find'](_0xde6909,[_0x5b2d('0x1d'),_0x58410c[_0x5b2d('0x1e')]])[_0x5b2d('0x20')];return db[_0x5b2d('0x4a')][_0x5b2d('0x1f')]({'where':{'name':_0x2081fe,'userProfileId':_0x63c28b['userProfileId']},'raw':!![]})[_0x5b2d('0x15')](function(_0x367ec9){if(_0x367ec9&&_0x367ec9[_0x5b2d('0x4b')]===0x0){return db[_0x5b2d('0x21')][_0x5b2d('0x41')]({'name':_0x58410c[_0x5b2d('0x20')],'resourceId':_0x58410c['id'],'type':_0x367ec9[_0x5b2d('0x20')],'sectionId':_0x367ec9['id']},{})[_0x5b2d('0x15')](function(){return _0x3b5056;});}else{return _0x3b5056;}})[_0x5b2d('0x3e')](function(_0x3b84b5){logger[_0x5b2d('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3b84b5);throw _0x3b84b5;});}return _0x3b5056;})['then'](respondWithResult(_0x380996,0xc9))[_0x5b2d('0x3e')](handleError(_0x380996,null));};exports[_0x5b2d('0x4c')]=function(_0x513ac9,_0x20f986){if(_0x513ac9['body']['id']){delete _0x513ac9[_0x5b2d('0x44')]['id'];}return db[_0x5b2d('0x27')][_0x5b2d('0x1f')]({'where':{'id':_0x513ac9['params']['id']}})[_0x5b2d('0x15')](handleEntityNotFound(_0x20f986,null))['then'](function(_0x390d6e){if(_0x390d6e){return db['VoiceExtension'][_0x5b2d('0x4c')](_[_0x5b2d('0x36')](_0x513ac9[_0x5b2d('0x44')],[_0x5b2d('0x43'),_0x5b2d('0x4d'),'description',_0x5b2d('0x4e'),'cutdigits',_0x5b2d('0x4f'),_0x5b2d('0x50')]),{'where':{'context':_0x390d6e[_0x5b2d('0x4d')],'exten':_0x390d6e[_0x5b2d('0x43')]},'individualHooks':!![]})[_0x5b2d('0x15')](function(_0x27b863){return _0x27b863;});}return null;})['then'](respondWithStatusCode(_0x20f986,null))['catch'](handleError(_0x20f986,null));};exports['addApplications']=function(_0xf15bf8,_0x45a593){var _0x114727=_0xf15bf8[_0x5b2d('0x40')]['id'];var _0x3aa3f3=_0xf15bf8[_0x5b2d('0x44')];var _0x480b87=0xc8;var _0x2bb8b2=null;return db[_0x5b2d('0x51')][_0x5b2d('0x52')]({'isolationLevel':db[_0x5b2d('0x51')][_0x5b2d('0x53')]['ISOLATION_LEVELS'][_0x5b2d('0x54')]},function(_0x4727c0){return db[_0x5b2d('0x27')]['findOne']({'where':{'id':_0x114727},'transaction':_0x4727c0})[_0x5b2d('0x15')](function(_0xcfd2d4){if(_0xcfd2d4){return db[_0x5b2d('0x27')]['destroy']({'where':{'VoiceExtensionId':_0x114727},'transaction':_0x4727c0})[_0x5b2d('0x15')](function(){var _0x4fcd4f=_['map'](_0x3aa3f3,function(_0x376544){_0x376544[_0x5b2d('0x55')]=_0x114727;_0x376544[_0x5b2d('0x56')]=!![];return _0x376544;});return _0xcfd2d4[_0x5b2d('0x57')](_0x4fcd4f);})[_0x5b2d('0x15')](function(_0x383c01){return db['VoiceExtension'][_0x5b2d('0x58')](_0x383c01,{'transaction':_0x4727c0});});}else{_0x480b87=0x194;_0x2bb8b2=[];}});})[_0x5b2d('0x15')](function(){if(_0x480b87!==0x194){return db[_0x5b2d('0x27')][_0x5b2d('0x59')]({'where':{'isApp':!![],'VoiceExtensionId':_0x114727},'order':_0x5b2d('0x5a')})[_0x5b2d('0x15')](function(_0x548479){_0x2bb8b2=_0x548479;});}})['catch'](function(_0x5177e0){_0x480b87=0x1f4;logger[_0x5b2d('0x24')](_0x5177e0['stack']);if(_0x5177e0['name']){delete _0x5177e0['name'];}_0x2bb8b2=_0x5177e0;})[_0x5b2d('0x5b')](function(){if(_0x2bb8b2===null){_0x45a593['sendStatus'](_0x480b87);}else{if(_0x480b87===0x1f4){_0x45a593['status'](_0x480b87)['send'](_0x2bb8b2);}else{_0x45a593[_0x5b2d('0xc')](_0x480b87)[_0x5b2d('0xe')](_0x2bb8b2);}}});}; \ No newline at end of file +var _0x0d98=['model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','VoiceExtension','includeAll','include','findAll','rows','catch','show','options','params','create','body','startsWith','exten','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','OutboundRoutes','find','UserProfileSection','userProfileId','autoAssociation','context','description','recordingFormat','cutdigits','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','findOne','VoiceExtensionId','isApp','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','lodash','../../config/logger','api','redis','defaults','localhost','register','sendStatus','status','end','json','offset','undefined','limit','count','destroy','then','get','InboundRoutes','inbound','outbound','InternalRoutes','internal','filter','map','value','includes','type','name','UserProfileResource','error','stack','send','index','rawAttributes','key','query','keys','filters','intersection'];(function(_0xdbf581,_0x5847d5){var _0x79e2ee=function(_0x57c5ba){while(--_0x57c5ba){_0xdbf581['push'](_0xdbf581['shift']());}};_0x79e2ee(++_0x5847d5);}(_0x0d98,0x8c));var _0x80d9=function(_0x45bb40,_0xcf43b4){_0x45bb40=_0x45bb40-0x0;var _0xdaa2e7=_0x0d98[_0x45bb40];return _0xdaa2e7;};'use strict';var _=require(_0x80d9('0x0'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x80d9('0x1'))(_0x80d9('0x2'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x80d9('0x3')]=_[_0x80d9('0x4')](config[_0x80d9('0x3')],{'host':_0x80d9('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x80d9('0x3')]));require('./voiceExtension.socket')[_0x80d9('0x6')](socket);function respondWithStatusCode(_0x23da24,_0x7e76f5){_0x7e76f5=_0x7e76f5||0xcc;return function(_0x4abc85){if(_0x4abc85){return _0x23da24[_0x80d9('0x7')](_0x7e76f5);}return _0x23da24[_0x80d9('0x8')](_0x7e76f5)[_0x80d9('0x9')]();};}function respondWithResult(_0x426a07,_0x514a41){_0x514a41=_0x514a41||0xc8;return function(_0x3fa0fb){if(_0x3fa0fb){return _0x426a07[_0x80d9('0x8')](_0x514a41)[_0x80d9('0xa')](_0x3fa0fb);}};}function respondWithFilteredResult(_0x48ae88,_0x57abc7){return function(_0x4274c9){if(_0x4274c9){var _0x5a47d4=typeof _0x57abc7[_0x80d9('0xb')]===_0x80d9('0xc')&&typeof _0x57abc7[_0x80d9('0xd')]===_0x80d9('0xc');var _0x43b218=_0x4274c9['count'];var _0x2245b3=_0x5a47d4?0x0:_0x57abc7['offset'];var _0x560d81=_0x5a47d4?_0x4274c9[_0x80d9('0xe')]:_0x57abc7[_0x80d9('0xb')]+_0x57abc7[_0x80d9('0xd')];var _0x43e4f7;if(_0x560d81>=_0x43b218){_0x560d81=_0x43b218;_0x43e4f7=0xc8;}else{_0x43e4f7=0xce;}_0x48ae88[_0x80d9('0x8')](_0x43e4f7);return _0x48ae88['set']('Content-Range',_0x2245b3+'-'+_0x560d81+'/'+_0x43b218)[_0x80d9('0xa')](_0x4274c9);}return null;};}function removeEntity(_0x17e3d8){return function(_0x590bb1){if(_0x590bb1){return _0x590bb1[_0x80d9('0xf')]()[_0x80d9('0x10')](function(){var _0x56fa41=_0x590bb1[_0x80d9('0x11')]({'plain':!![]});var _0x22329a=[{'name':_0x80d9('0x12'),'value':_0x80d9('0x13'),'ignore':![]},{'name':'OutboundRoutes','value':_0x80d9('0x14'),'ignore':![]},{'name':_0x80d9('0x15'),'value':_0x80d9('0x16'),'ignore':![]}];var _0x57aed5=_(_0x22329a)[_0x80d9('0x17')]('ignore')[_0x80d9('0x18')](_0x80d9('0x19'))[_0x80d9('0x19')]();if(_[_0x80d9('0x1a')](_0x57aed5,_0x56fa41[_0x80d9('0x1b')])){return;}var _0x4376c7=_['find'](_0x22329a,['value',_0x56fa41[_0x80d9('0x1b')]])[_0x80d9('0x1c')];return db[_0x80d9('0x1d')][_0x80d9('0xf')]({'where':{'type':_0x4376c7,'resourceId':_0x56fa41['id']}})[_0x80d9('0x10')](function(){return _0x590bb1;});})[_0x80d9('0x10')](function(){_0x17e3d8[_0x80d9('0x8')](0xcc)[_0x80d9('0x9')]();});}};}function handleEntityNotFound(_0x5904d5){return function(_0x8ef55e){if(!_0x8ef55e){_0x5904d5[_0x80d9('0x7')](0x194);}return _0x8ef55e;};}function handleError(_0x2083f3,_0x573970){_0x573970=_0x573970||0x1f4;return function(_0x29f810){logger[_0x80d9('0x1e')](_0x29f810[_0x80d9('0x1f')]);if(_0x29f810['name']){delete _0x29f810[_0x80d9('0x1c')];}_0x2083f3[_0x80d9('0x8')](_0x573970)[_0x80d9('0x20')](_0x29f810);};}exports[_0x80d9('0x21')]=function(_0x6c8b60,_0x183ab9){var _0x2b7b6e={},_0x2b091a={},_0x3c6df2={'count':0x0,'rows':[]};var _0x49dce4=_['map'](db['VoiceExtension'][_0x80d9('0x22')],function(_0x25c3a6){return{'name':_0x25c3a6['fieldName'],'type':_0x25c3a6[_0x80d9('0x1b')][_0x80d9('0x23')]};});_0x2b091a['model']=_['map'](_0x49dce4,_0x80d9('0x1c'));_0x2b091a[_0x80d9('0x24')]=_[_0x80d9('0x25')](_0x6c8b60[_0x80d9('0x24')]);_0x2b091a[_0x80d9('0x26')]=_[_0x80d9('0x27')](_0x2b091a[_0x80d9('0x28')],_0x2b091a[_0x80d9('0x24')]);_0x2b7b6e[_0x80d9('0x29')]=_[_0x80d9('0x27')](_0x2b091a[_0x80d9('0x28')],qs[_0x80d9('0x2a')](_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x2a')]));_0x2b7b6e[_0x80d9('0x29')]=_0x2b7b6e['attributes'][_0x80d9('0x2b')]?_0x2b7b6e['attributes']:_0x2b091a['model'];if(!_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x2c')](_0x80d9('0x2d'))){_0x2b7b6e[_0x80d9('0xd')]=qs[_0x80d9('0xd')](_0x6c8b60['query'][_0x80d9('0xd')]);_0x2b7b6e[_0x80d9('0xb')]=qs[_0x80d9('0xb')](_0x6c8b60['query'][_0x80d9('0xb')]);}_0x2b7b6e[_0x80d9('0x2e')]=qs[_0x80d9('0x2f')](_0x6c8b60[_0x80d9('0x24')]['sort']);_0x2b7b6e['where']=qs[_0x80d9('0x26')](_[_0x80d9('0x30')](_0x6c8b60[_0x80d9('0x24')],_0x2b091a[_0x80d9('0x26')]),_0x49dce4);if(_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x17')]){_0x2b7b6e[_0x80d9('0x31')]=_[_0x80d9('0x32')](_0x2b7b6e[_0x80d9('0x31')],{'$or':_[_0x80d9('0x18')](_0x49dce4,function(_0x5192d9){if(_0x5192d9[_0x80d9('0x1b')]!==_0x80d9('0x33')){var _0x472977={};_0x472977[_0x5192d9[_0x80d9('0x1c')]]={'$like':'%'+_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x17')]+'%'};return _0x472977;}})});}_0x2b7b6e=_[_0x80d9('0x32')]({},_0x2b7b6e,_0x6c8b60['options']);var _0x2621f={'where':_0x2b7b6e[_0x80d9('0x31')]};return db[_0x80d9('0x34')][_0x80d9('0xe')](_0x2621f)[_0x80d9('0x10')](function(_0x1ab522){_0x3c6df2['count']=_0x1ab522;if(_0x6c8b60[_0x80d9('0x24')][_0x80d9('0x35')]){_0x2b7b6e[_0x80d9('0x36')]=[{'all':!![]}];}return db[_0x80d9('0x34')][_0x80d9('0x37')](_0x2b7b6e);})[_0x80d9('0x10')](function(_0x5bca4a){_0x3c6df2[_0x80d9('0x38')]=_0x5bca4a;return _0x3c6df2;})[_0x80d9('0x10')](respondWithFilteredResult(_0x183ab9,_0x2b7b6e))[_0x80d9('0x39')](handleError(_0x183ab9,null));};exports[_0x80d9('0x3a')]=function(_0x25e755,_0xe6e57f){var _0x274169={'raw':![],'where':{'id':_0x25e755['params']['id']}},_0x3dca39={};_0x3dca39[_0x80d9('0x28')]=_[_0x80d9('0x25')](db[_0x80d9('0x34')][_0x80d9('0x22')]);_0x3dca39['query']=_['keys'](_0x25e755[_0x80d9('0x24')]);_0x3dca39[_0x80d9('0x26')]=_['intersection'](_0x3dca39[_0x80d9('0x28')],_0x3dca39[_0x80d9('0x24')]);_0x274169[_0x80d9('0x29')]=_[_0x80d9('0x27')](_0x3dca39[_0x80d9('0x28')],qs[_0x80d9('0x2a')](_0x25e755['query'][_0x80d9('0x2a')]));_0x274169[_0x80d9('0x29')]=_0x274169[_0x80d9('0x29')]['length']?_0x274169['attributes']:_0x3dca39['model'];if(_0x25e755[_0x80d9('0x24')]['includeAll']){_0x274169[_0x80d9('0x36')]=[{'all':!![]}];}_0x274169=_[_0x80d9('0x32')]({},_0x274169,_0x25e755[_0x80d9('0x3b')]);return db[_0x80d9('0x34')]['find'](_0x274169)[_0x80d9('0x10')](handleEntityNotFound(_0xe6e57f,null))[_0x80d9('0x10')](respondWithResult(_0xe6e57f,null))[_0x80d9('0x39')](handleError(_0xe6e57f,null));};exports[_0x80d9('0xf')]=function(_0x2b8604,_0x38f73a){return db[_0x80d9('0x34')]['find']({'where':{'id':_0x2b8604[_0x80d9('0x3c')]['id']}})[_0x80d9('0x10')](handleEntityNotFound(_0x38f73a,null))[_0x80d9('0x10')](removeEntity(_0x38f73a,null))[_0x80d9('0x39')](handleError(_0x38f73a,null));};exports[_0x80d9('0x3d')]=function(_0x473e2b,_0x5c371c){if(_0x473e2b[_0x80d9('0x3e')][_0x80d9('0x1b')]==='outbound'&&!_[_0x80d9('0x3f')](_0x473e2b[_0x80d9('0x3e')]['exten'],'_')){_0x473e2b['body'][_0x80d9('0x40')]='_'[_0x80d9('0x41')](_0x473e2b[_0x80d9('0x3e')]['exten']);}return db[_0x80d9('0x34')][_0x80d9('0x3d')](_0x473e2b['body'],{'raw':![]})['then'](function(_0x170d41){var _0x2b676e=_0x473e2b['user'][_0x80d9('0x11')]({'plain':!![]});if(!_0x2b676e)throw new Error(_0x80d9('0x42'));if(_0x2b676e[_0x80d9('0x43')]===_0x80d9('0x44')){var _0x4f020d=_0x170d41[_0x80d9('0x11')]({'plain':!![]});var _0x389f21=[{'name':'InboundRoutes','value':_0x80d9('0x13')},{'name':_0x80d9('0x45'),'value':_0x80d9('0x14')},{'name':_0x80d9('0x15'),'value':_0x80d9('0x16')}];var _0x2e53b8=_[_0x80d9('0x46')](_0x389f21,[_0x80d9('0x19'),_0x4f020d['type']])[_0x80d9('0x1c')];return db[_0x80d9('0x47')]['find']({'where':{'name':_0x2e53b8,'userProfileId':_0x2b676e[_0x80d9('0x48')]},'raw':!![]})[_0x80d9('0x10')](function(_0x506b2c){if(_0x506b2c&&_0x506b2c[_0x80d9('0x49')]===0x0){return db[_0x80d9('0x1d')]['create']({'name':_0x4f020d[_0x80d9('0x1c')],'resourceId':_0x4f020d['id'],'type':_0x506b2c[_0x80d9('0x1c')],'sectionId':_0x506b2c['id']},{})[_0x80d9('0x10')](function(){return _0x170d41;});}else{return _0x170d41;}})[_0x80d9('0x39')](function(_0x22381c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22381c);throw _0x22381c;});}return _0x170d41;})[_0x80d9('0x10')](respondWithResult(_0x5c371c,0xc9))[_0x80d9('0x39')](handleError(_0x5c371c,null));};exports['update']=function(_0x1572e9,_0x3e5870){if(_0x1572e9[_0x80d9('0x3e')]['id']){delete _0x1572e9[_0x80d9('0x3e')]['id'];}return db['VoiceExtension'][_0x80d9('0x46')]({'where':{'id':_0x1572e9[_0x80d9('0x3c')]['id']}})[_0x80d9('0x10')](handleEntityNotFound(_0x3e5870,null))[_0x80d9('0x10')](function(_0xdcb5a8){if(_0xdcb5a8){return db[_0x80d9('0x34')]['update'](_[_0x80d9('0x30')](_0x1572e9[_0x80d9('0x3e')],['exten',_0x80d9('0x4a'),_0x80d9('0x4b'),_0x80d9('0x4c'),_0x80d9('0x4d'),'mandatoryDisposition','alias']),{'where':{'context':_0xdcb5a8[_0x80d9('0x4a')],'exten':_0xdcb5a8[_0x80d9('0x40')]},'individualHooks':!![]})[_0x80d9('0x10')](function(_0x210d8f){return _0x210d8f;});}return null;})[_0x80d9('0x10')](respondWithStatusCode(_0x3e5870,null))[_0x80d9('0x39')](handleError(_0x3e5870,null));};exports[_0x80d9('0x4e')]=function(_0xda252,_0x457179){var _0x81269d=_0xda252['params']['id'];var _0x4a40a7=_0xda252['body'];var _0x2ba641=0xc8;var _0x5bd256=null;return db[_0x80d9('0x4f')][_0x80d9('0x50')]({'isolationLevel':db[_0x80d9('0x4f')][_0x80d9('0x51')][_0x80d9('0x52')]['READ_COMMITTED']},function(_0x2bf8a4){return db['VoiceExtension'][_0x80d9('0x53')]({'where':{'id':_0x81269d},'transaction':_0x2bf8a4})['then'](function(_0x4f48fc){if(_0x4f48fc){return db[_0x80d9('0x34')][_0x80d9('0xf')]({'where':{'VoiceExtensionId':_0x81269d},'transaction':_0x2bf8a4})[_0x80d9('0x10')](function(){var _0x398114=_[_0x80d9('0x18')](_0x4a40a7,function(_0x142744){_0x142744[_0x80d9('0x54')]=_0x81269d;_0x142744[_0x80d9('0x55')]=!![];return _0x142744;});return _0x4f48fc[_0x80d9('0x56')](_0x398114);})[_0x80d9('0x10')](function(_0x4e06c1){return db[_0x80d9('0x34')][_0x80d9('0x57')](_0x4e06c1,{'transaction':_0x2bf8a4});});}else{_0x2ba641=0x194;_0x5bd256=[];}});})[_0x80d9('0x10')](function(){if(_0x2ba641!==0x194){return db[_0x80d9('0x34')][_0x80d9('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x81269d},'order':_0x80d9('0x59')})[_0x80d9('0x10')](function(_0x3a7163){_0x5bd256=_0x3a7163;});}})[_0x80d9('0x39')](function(_0x37be6c){_0x2ba641=0x1f4;logger[_0x80d9('0x1e')](_0x37be6c['stack']);if(_0x37be6c[_0x80d9('0x1c')]){delete _0x37be6c[_0x80d9('0x1c')];}_0x5bd256=_0x37be6c;})['finally'](function(){if(_0x5bd256===null){_0x457179[_0x80d9('0x7')](_0x2ba641);}else{if(_0x2ba641===0x1f4){_0x457179['status'](_0x2ba641)[_0x80d9('0x20')](_0x5bd256);}else{_0x457179[_0x80d9('0x8')](_0x2ba641)[_0x80d9('0xa')](_0x5bd256);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 5a5c173..5aad572 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 _0x5032=['save','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x5032,0x1cd));var _0x2503=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5032[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x2503('0x0'));var VoiceExtension=require(_0x2503('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x2503('0x2')](0x0);var events={'afterCreate':_0x2503('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3562da){return function(_0x1ede21,_0xe704c,_0x54b48b){VoiceExtensionEvents[_0x2503('0x4')](_0x3562da+':'+_0x1ede21['id'],_0x1ede21);VoiceExtensionEvents[_0x2503('0x4')](_0x3562da,_0x1ede21);_0x54b48b(null);};}for(var e in events){if(events[_0x2503('0x5')](e)){var event=events[e];VoiceExtension[_0x2503('0x6')](e,emitEvent(event));}}module[_0x2503('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0x49f6=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','emit'];(function(_0x59f1e6,_0xda13c5){var _0x2aada5=function(_0x5bf12c){while(--_0x5bf12c){_0x59f1e6['push'](_0x59f1e6['shift']());}};_0x2aada5(++_0xda13c5);}(_0x49f6,0x13e));var _0x649f=function(_0x2399ec,_0x45e036){_0x2399ec=_0x2399ec-0x0;var _0x21307a=_0x49f6[_0x2399ec];return _0x21307a;};'use strict';var EventEmitter=require(_0x649f('0x0'));var VoiceExtension=require(_0x649f('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x649f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x84c93f){return function(_0x2e4f96,_0x1abb7b,_0x3a75e0){VoiceExtensionEvents['emit'](_0x84c93f+':'+_0x2e4f96['id'],_0x2e4f96);VoiceExtensionEvents[_0x649f('0x3')](_0x84c93f,_0x2e4f96);_0x3a75e0(null);};}for(var e in events){if(events[_0x649f('0x4')](e)){var event=events[e];VoiceExtension[_0x649f('0x5')](e,emitEvent(event));}}module[_0x649f('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index a598097..af663f0 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 _0x3c86=['inbound','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','options','url','length','name','trunk','split','phone','param','prefix','${EXTEN:','join','U(xcally-mixmonitor-context)','isEmpty','findAll','interval','IntervalId','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','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},','outboundDial','appdata','agi','priority','last','voice_extensions','get','then','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0x3c86,0x123));var _0x63c8=function(_0x4425de,_0xf6c0f7){_0x4425de=_0x4425de-0x0;var _0x1b2a60=_0x3c86[_0x4425de];return _0x1b2a60;};'use strict';var _=require(_0x63c8('0x0'));var attributes=require(_0x63c8('0x1'));module[_0x63c8('0x2')]=function(_0x2191ad){var _0x4259d3=_0x2191ad[_0x63c8('0x3')];function _0x344362(_0x496b47){var _0x16f663=0x2;var _0x200ad1=[{'type':_0x496b47[_0x63c8('0x4')],'app':_0x63c8('0x5'),'appdata':_0x63c8('0x6')+_0x496b47[_0x63c8('0x4')],'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']}];if(_0x496b47[_0x63c8('0x4')]===_0x63c8('0x9')){_0x200ad1[_0x63c8('0xa')]({'type':_0x63c8('0x9'),'app':_0x63c8('0x5'),'appdata':'CDR(routeid)='+_0x496b47['id'],'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']});}_0x200ad1[_0x63c8('0xa')]({'type':_0x496b47['type'],'app':'Set','appdata':_0x63c8('0xb'),'context':_0x496b47['context'],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']},{'type':_0x496b47['type'],'app':_0x63c8('0x5'),'appdata':_0x63c8('0xc'),'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47[_0x63c8('0x8')],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']},{'type':_0x496b47[_0x63c8('0x4')],'app':_0x63c8('0x5'),'appdata':_0x63c8('0xd'),'context':_0x496b47[_0x63c8('0x7')],'exten':_0x496b47['exten'],'priority':_0x16f663++,'VoiceExtensionId':_0x496b47['id']});return _0x200ad1;}function _0x58f7b2(_0x1200af){var _0x2d72d5=0x2;var _0x5d8126=[{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0xf'),'context':_0x1200af['context'],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0x10')+(_0x1200af[_0x63c8('0x11')]?'${EXTEN:'+_0x1200af[_0x63c8('0x11')]+'}':_0x63c8('0x12')),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':'CDR(routeid)='+_0x1200af['id'],'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':'outbound','app':_0x63c8('0x13'),'appdata':_0x63c8('0x14')+(_0x2d72d5+0x2)+'):Goto('+(_0x2d72d5+0x1)+')','context':_0x1200af['context'],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':_0x63c8('0x5'),'appdata':_0x1200af[_0x63c8('0x11')]?'CDR(prefix)=${EXTEN:0:'+_0x1200af[_0x63c8('0x11')]+'}':'CDR(prefix)=noprefix','context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':'outbound','app':_0x63c8('0x5'),'appdata':_0x63c8('0xb'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0xc'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':_0x63c8('0x5'),'appdata':_0x63c8('0xd'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':'Set','appdata':_0x63c8('0x15')+_0x1200af['id'],'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']}];if(_0x1200af[_0x63c8('0x16')](_0x63c8('0x17'))&&_0x1200af[_0x63c8('0x17')]!==_0x63c8('0x18')){_0x5d8126[_0x63c8('0xa')]({'type':'outbound','app':'Set','appdata':_0x63c8('0x19'),'context':_0x1200af[_0x63c8('0x7')],'exten':_0x1200af[_0x63c8('0x8')],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']},{'type':_0x63c8('0xe'),'app':_0x63c8('0x5'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x1200af['recordingFormat']||_0x63c8('0x1a'),'context':_0x1200af['context'],'exten':_0x1200af['exten'],'priority':_0x2d72d5++,'VoiceExtensionId':_0x1200af['id']});}return _0x5d8126;}function _0x5edc68(_0x5ed26f,_0x147261){var _0x2b2744=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':_0x63c8('0x1b'),'param':0x2},{'name':_0x63c8('0x1c'),'param':0x3}];var _0x4af451={};var _0x40b08b=_0x147261['split'](',');var _0x2b3d2b=[];for(var _0x24a752=0x0;_0x24a752<_0x2b2744[_0x63c8('0x1d')];_0x24a752++){switch(_0x2b2744[_0x24a752][_0x63c8('0x1e')]){case _0x63c8('0x1f'):_0x4af451[_0x63c8('0x1f')]=_0x40b08b[_0x2b2744[_0x24a752]['param']][_0x63c8('0x20')]('/')[0x1];_0x4af451[_0x63c8('0x21')]=_0x40b08b[_0x2b2744[_0x24a752][_0x63c8('0x22')]][_0x63c8('0x20')]('/')[0x2];_0x4af451[_0x63c8('0x23')]=_0x4af451[_0x63c8('0x21')]?_0x4af451['phone'][_0x63c8('0x20')]('$')[0x0]:undefined;_0x4af451[_0x63c8('0x21')]=_0x5ed26f[_0x63c8('0x11')]?(_0x4af451[_0x63c8('0x23')]||'')+_0x63c8('0x24')+_0x5ed26f[_0x63c8('0x11')]+'}':(_0x4af451['prefix']||'')+_0x63c8('0x12');_0x2b3d2b[_0x2b2744[_0x24a752][_0x63c8('0x22')]]=['SIP',_0x4af451['trunk'],_0x4af451['phone']][_0x63c8('0x25')]('/');break;case _0x63c8('0x1b'):_0x4af451[_0x63c8('0x1b')]=_0x40b08b[_0x2b2744[_0x24a752]['param']];if(_0x5ed26f[_0x63c8('0x17')]!==_0x63c8('0x18')){if(_0x4af451['options']['indexOf'](_0x63c8('0x26'))<0x0){_0x4af451[_0x63c8('0x1b')]+=_0x63c8('0x26');}}else{_0x4af451[_0x63c8('0x1b')]=_0x4af451[_0x63c8('0x1b')]['replace'](_0x63c8('0x26'),'');}_0x2b3d2b[_0x2b2744[_0x24a752][_0x63c8('0x22')]]=_0x4af451[_0x63c8('0x1b')];break;default:_0x2b3d2b[_0x2b2744[_0x24a752][_0x63c8('0x22')]]=_0x40b08b[_0x2b2744[_0x24a752][_0x63c8('0x22')]];}}return _0x2b3d2b[_0x63c8('0x25')](',');}function _0x511d81(_0x1a04a7,_0x27aa90,_0x57447b){return new Promise(function(_0x426114,_0x2e770d){var _0x2a5dd7=[];if(_[_0x63c8('0x27')](_0x27aa90))return _0x426114(_0x2a5dd7);_0x4259d3['Interval'][_0x63c8('0x28')]({'attributes':['id',_0x63c8('0x29'),_0x63c8('0x2a')],'raw':!![]})['then'](function(_0x276420){for(var _0x33937e=0x0,_0x2263c9=0x0;_0x33937e<_0x27aa90['length'];_0x33937e++,_0x2263c9=0x0){var _0x21d520=_0x27aa90[_0x33937e];var _0x1d1f86=[];var _0x47ba28=[];delete _0x21d520['id'];if(_0x21d520[_0x63c8('0x29')]!==_0x63c8('0x2b')){_0x21d520[_0x63c8('0x2c')]=[_0x21d520[_0x63c8('0x29')]];}else{_0x21d520[_0x63c8('0x2c')]=_0x21d520[_0x63c8('0x2a')]?_[_0x63c8('0x2d')](_[_0x63c8('0x2e')](_0x276420,{'IntervalId':_0x21d520[_0x63c8('0x2a')]}),_0x63c8('0x29')):[];}_0x21d520[_0x63c8('0x7')]=_0x1a04a7[_0x63c8('0x7')];_0x21d520[_0x63c8('0x8')]=_0x1a04a7[_0x63c8('0x8')];if(_0x21d520[_0x63c8('0x4')])_0x21d520['type']=_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')]();if(_0x1a04a7['type']===_0x63c8('0xe')){if(_0x21d520[_0x63c8('0x16')](_0x63c8('0x30'))&&_0x21d520[_0x63c8('0x30')]&&_0x21d520[_0x63c8('0x30')]!=='--'){_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520['type']['toLowerCase'](),'app':_0x63c8('0x5'),'appdata':_0x63c8('0x31')+_0x21d520[_0x63c8('0x30')],'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x13'),'appdata':_0x63c8('0x32')+(_0x21d520['callerID']?_0x63c8('0x33')+_0x21d520[_0x63c8('0x34')]+')':_0x63c8('0x35')),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7['exten'],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}else{if(_0x21d520[_0x63c8('0x16')]('answer')){if([_0x63c8('0x36'),_0x63c8('0x37')][_0x63c8('0x38')](_0x21d520['app'][_0x63c8('0x2f')]())&&_0x21d520[_0x63c8('0x39')]!==_0x63c8('0x3a')){if(_0x21d520['answer']){_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x13'),'appdata':_0x63c8('0x3b'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520[_0x63c8('0x2c')]['length']+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x5'),'appdata':_0x63c8('0x3c'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}else{_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':'ExecIf','appdata':_0x63c8('0x3d'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7['exten'],'priority':_0x21d520['intervals']['length']+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520[_0x63c8('0x4')][_0x63c8('0x2f')](),'app':_0x63c8('0x5'),'appdata':_0x63c8('0x3e'),'context':_0x1a04a7[_0x63c8('0x7')],'exten':_0x1a04a7['exten'],'priority':_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}}}}for(var _0x28faf3=0x0;_0x28faf3<_0x21d520['intervals'][_0x63c8('0x1d')];_0x28faf3++){var _0xfeb76e=_0x57447b+_0x21d520['intervals'][_0x63c8('0x1d')];var _0xbfcdb1=_0x28faf3===_0x21d520[_0x63c8('0x2c')][_0x63c8('0x1d')]-0x1?_0x57447b+_0x1d1f86[_0x63c8('0x1d')]+_0x47ba28[_0x63c8('0x1d')]+0x2:_0x57447b+_0x28faf3+0x1;_0x1d1f86[_0x63c8('0x3f')](_0x28faf3,0x0,{'type':_0x1a04a7[_0x63c8('0x4')],'app':_0x63c8('0x40'),'appdata':_0x21d520['intervals'][_0x28faf3]+'?'+_0x1a04a7[_0x63c8('0x7')]+',${EXTEN},'+_0xfeb76e+':'+_0x1a04a7[_0x63c8('0x7')]+_0x63c8('0x41')+_0xbfcdb1,'exten':_0x1a04a7[_0x63c8('0x8')],'context':_0x1a04a7[_0x63c8('0x7')],'priority':_0x57447b+_0x28faf3,'VoiceExtensionId':_0x1a04a7['id']});}if(_0x21d520[_0x63c8('0x39')]===_0x63c8('0x42')){_0x21d520['appdata']=_0x5edc68(_0x1a04a7,_0x21d520[_0x63c8('0x43')]);}if(_0x21d520[_0x63c8('0x39')]===_0x63c8('0x44')){_0x1d1f86[_0x63c8('0xa')]({'type':_0x21d520['type'][_0x63c8('0x2f')](),'app':_0x63c8('0x5'),'appdata':'XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','context':_0x1a04a7['context'],'exten':_0x1a04a7[_0x63c8('0x8')],'priority':_0x21d520['intervals'][_0x63c8('0x1d')]+_0x57447b+_0x2263c9++,'VoiceExtensionId':_0x1a04a7['id']});}_0x21d520[_0x63c8('0x45')]=_0x1d1f86[_0x63c8('0x1d')]?_[_0x63c8('0x46')](_0x1d1f86)[_0x63c8('0x45')]+0x1:_0x57447b;_0x2a5dd7=_['concat'](_0x2a5dd7,_0x1d1f86,[_0x21d520],_0x47ba28);_0x57447b=_[_0x63c8('0x46')](_0x2a5dd7)[_0x63c8('0x45')]+0x1;}return _0x426114(_0x2a5dd7);})['catch'](function(_0x1af083){_0x2e770d(_0x1af083);});});}return _0x2191ad['define']('VoiceExtension',attributes,{'tableName':_0x63c8('0x47'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xbe0ec1){var _0x2919ef=this[_0x63c8('0x48')]({'plain':!![]});var _0x2c9634=_0x2919ef[_0x63c8('0x4')]==='outbound'?_0x58f7b2(_0x2919ef):_0x344362(_0x2919ef);return _0x511d81(_0x2919ef,_0xbe0ec1,_[_0x63c8('0x46')](_0x2c9634)[_0x63c8('0x45')]+0x1)[_0x63c8('0x49')](function(_0x19c4a1){var _0xc5e9ca=_['concat'](_0x2c9634,_0x19c4a1);_0xc5e9ca[_0x63c8('0xa')]({'type':_0x2919ef[_0x63c8('0x4')],'app':_0x63c8('0x4a'),'exten':_0x2919ef['exten'],'context':_0x2919ef[_0x63c8('0x7')],'priority':_[_0x63c8('0x46')](_0xc5e9ca)[_0x63c8('0x45')]+0x1,'VoiceExtensionId':_0x2919ef['id']});return _0xc5e9ca;});}}});}; \ No newline at end of file +var _0x26cd=['toLowerCase','tag','CDR(tag)=','ExecIf','callerID','NoOp(No\x20number\x20available)','answer','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','concat','catch','define','VoiceExtension','priority','Hangup','lodash','./voiceExtension.attributes','type','Set','CDR(type)=','context','exten','inbound','push','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','cutdigits','${EXTEN:','CDR(routeid)=','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','trunk','timeout','options','url','split','length','param','phone','prefix','SIP','none','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','interval','then','*,*,*,*','intervals','IntervalId','map','filter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x26cd,0x14d));var _0xd26c=function(_0x1ae441,_0x5160e2){_0x1ae441=_0x1ae441-0x0;var _0x47b62c=_0x26cd[_0x1ae441];return _0x47b62c;};'use strict';var _=require(_0xd26c('0x0'));var attributes=require(_0xd26c('0x1'));module['exports']=function(_0x45f7cb){var _0x519085=_0x45f7cb['models'];function _0x508185(_0x316695){var _0xae8917=0x2;var _0x5445d5=[{'type':_0x316695[_0xd26c('0x2')],'app':_0xd26c('0x3'),'appdata':_0xd26c('0x4')+_0x316695[_0xd26c('0x2')],'context':_0x316695[_0xd26c('0x5')],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']}];if(_0x316695[_0xd26c('0x2')]===_0xd26c('0x7')){_0x5445d5[_0xd26c('0x8')]({'type':'inbound','app':_0xd26c('0x3'),'appdata':'CDR(routeid)='+_0x316695['id'],'context':_0x316695[_0xd26c('0x5')],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']});}_0x5445d5[_0xd26c('0x8')]({'type':_0x316695['type'],'app':_0xd26c('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x316695[_0xd26c('0x5')],'exten':_0x316695['exten'],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']},{'type':_0x316695['type'],'app':'Set','appdata':_0xd26c('0x9'),'context':_0x316695['context'],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']},{'type':_0x316695[_0xd26c('0x2')],'app':_0xd26c('0x3'),'appdata':_0xd26c('0xa'),'context':_0x316695['context'],'exten':_0x316695[_0xd26c('0x6')],'priority':_0xae8917++,'VoiceExtensionId':_0x316695['id']});return _0x5445d5;}function _0x42aaa5(_0x39dcf8){var _0x516612=0x2;var _0x547b00=[{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0xc'),'context':_0x39dcf8['context'],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':'CDR(destination)='+(_0x39dcf8[_0xd26c('0xd')]?_0xd26c('0xe')+_0x39dcf8[_0xd26c('0xd')]+'}':'${EXTEN}'),'context':_0x39dcf8['context'],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':'outbound','app':_0xd26c('0x3'),'appdata':_0xd26c('0xf')+_0x39dcf8['id'],'context':_0x39dcf8['context'],'exten':_0x39dcf8['exten'],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':'ExecIf','appdata':_0xd26c('0x10')+(_0x516612+0x2)+_0xd26c('0x11')+(_0x516612+0x1)+')','context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':'Set','appdata':_0x39dcf8[_0xd26c('0xd')]?'CDR(prefix)=${EXTEN:0:'+_0x39dcf8[_0xd26c('0xd')]+'}':_0xd26c('0x12'),'context':_0x39dcf8['context'],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x13'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8['exten'],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':'outbound','app':'Set','appdata':_0xd26c('0x9'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0xa'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8['exten'],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x14')+_0x39dcf8['id'],'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']}];if(_0x39dcf8[_0xd26c('0x15')]('recordingFormat')&&_0x39dcf8[_0xd26c('0x16')]!=='none'){_0x547b00[_0xd26c('0x8')]({'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x17'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']},{'type':_0xd26c('0xb'),'app':_0xd26c('0x3'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x39dcf8[_0xd26c('0x16')]||_0xd26c('0x18'),'context':_0x39dcf8[_0xd26c('0x5')],'exten':_0x39dcf8[_0xd26c('0x6')],'priority':_0x516612++,'VoiceExtensionId':_0x39dcf8['id']});}return _0x547b00;}function _0x8c74f6(_0x23073d,_0x257243){var _0x4b61e0=[{'name':_0xd26c('0x19'),'param':0x0},{'name':_0xd26c('0x1a'),'param':0x1},{'name':_0xd26c('0x1b'),'param':0x2},{'name':_0xd26c('0x1c'),'param':0x3}];var _0x343722={};var _0x2e7ea2=_0x257243[_0xd26c('0x1d')](',');var _0x55287f=[];for(var _0x2b6361=0x0;_0x2b6361<_0x4b61e0[_0xd26c('0x1e')];_0x2b6361++){switch(_0x4b61e0[_0x2b6361]['name']){case _0xd26c('0x19'):_0x343722[_0xd26c('0x19')]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]][_0xd26c('0x1d')]('/')[0x1];_0x343722[_0xd26c('0x20')]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]][_0xd26c('0x1d')]('/')[0x2];_0x343722[_0xd26c('0x21')]=_0x343722['phone']?_0x343722[_0xd26c('0x20')][_0xd26c('0x1d')]('$')[0x0]:undefined;_0x343722[_0xd26c('0x20')]=_0x23073d[_0xd26c('0xd')]?(_0x343722[_0xd26c('0x21')]||'')+'${EXTEN:'+_0x23073d[_0xd26c('0xd')]+'}':(_0x343722['prefix']||'')+'${EXTEN}';_0x55287f[_0x4b61e0[_0x2b6361]['param']]=[_0xd26c('0x22'),_0x343722[_0xd26c('0x19')],_0x343722[_0xd26c('0x20')]]['join']('/');break;case _0xd26c('0x1b'):_0x343722[_0xd26c('0x1b')]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]];if(_0x23073d[_0xd26c('0x16')]!==_0xd26c('0x23')){if(_0x343722['options'][_0xd26c('0x24')](_0xd26c('0x25'))<0x0){_0x343722[_0xd26c('0x1b')]+='U(xcally-mixmonitor-context)';}}else{_0x343722[_0xd26c('0x1b')]=_0x343722[_0xd26c('0x1b')][_0xd26c('0x26')](_0xd26c('0x25'),'');}_0x55287f[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]]=_0x343722[_0xd26c('0x1b')];break;default:_0x55287f[_0x4b61e0[_0x2b6361]['param']]=_0x2e7ea2[_0x4b61e0[_0x2b6361][_0xd26c('0x1f')]];}}return _0x55287f['join'](',');}function _0x1012b8(_0x43d314,_0x26d3b5,_0x440077){return new Promise(function(_0x434cfa,_0x12452b){var _0x9a7d77=[];if(_[_0xd26c('0x27')](_0x26d3b5))return _0x434cfa(_0x9a7d77);_0x519085['Interval']['findAll']({'attributes':['id',_0xd26c('0x28'),'IntervalId'],'raw':!![]})[_0xd26c('0x29')](function(_0x552ed4){for(var _0x48e5e3=0x0,_0x3290b5=0x0;_0x48e5e3<_0x26d3b5[_0xd26c('0x1e')];_0x48e5e3++,_0x3290b5=0x0){var _0x42ad62=_0x26d3b5[_0x48e5e3];var _0x24191b=[];var _0x15a1d8=[];delete _0x42ad62['id'];if(_0x42ad62['interval']!==_0xd26c('0x2a')){_0x42ad62[_0xd26c('0x2b')]=[_0x42ad62[_0xd26c('0x28')]];}else{_0x42ad62[_0xd26c('0x2b')]=_0x42ad62[_0xd26c('0x2c')]?_[_0xd26c('0x2d')](_[_0xd26c('0x2e')](_0x552ed4,{'IntervalId':_0x42ad62[_0xd26c('0x2c')]}),_0xd26c('0x28')):[];}_0x42ad62['context']=_0x43d314[_0xd26c('0x5')];_0x42ad62[_0xd26c('0x6')]=_0x43d314['exten'];if(_0x42ad62[_0xd26c('0x2')])_0x42ad62['type']=_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')]();if(_0x43d314['type']===_0xd26c('0xb')){if(_0x42ad62[_0xd26c('0x15')](_0xd26c('0x30'))&&_0x42ad62['tag']&&_0x42ad62[_0xd26c('0x30')]!=='--'){_0x24191b['push']({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x3'),'appdata':_0xd26c('0x31')+_0x42ad62[_0xd26c('0x30')],'context':_0x43d314['context'],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}_0x24191b['push']({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x42ad62[_0xd26c('0x33')]?'Set(CALLERID(all)='+_0x42ad62[_0xd26c('0x33')]+')':_0xd26c('0x34')),'context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}else{if(_0x42ad62[_0xd26c('0x15')](_0xd26c('0x35'))){if(['queue',_0xd26c('0x36')][_0xd26c('0x37')](_0x42ad62[_0xd26c('0x38')][_0xd26c('0x2f')]())&&_0x42ad62[_0xd26c('0x39')]!==_0xd26c('0x3a')){if(_0x42ad62['answer']){_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62['type'][_0xd26c('0x2f')](),'app':'ExecIf','appdata':_0xd26c('0x3b'),'context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62['intervals'][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':'Set','appdata':_0xd26c('0x3c'),'context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62['intervals'][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}else{_0x24191b['push']({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x32'),'appdata':_0xd26c('0x3d'),'context':_0x43d314['context'],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':_0xd26c('0x3'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x43d314[_0xd26c('0x5')],'exten':_0x43d314['exten'],'priority':_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}}}}for(var _0x5cffbe=0x0;_0x5cffbe<_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')];_0x5cffbe++){var _0x3f6cf6=_0x440077+_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')];var _0x4bd784=_0x5cffbe===_0x42ad62[_0xd26c('0x2b')][_0xd26c('0x1e')]-0x1?_0x440077+_0x24191b[_0xd26c('0x1e')]+_0x15a1d8[_0xd26c('0x1e')]+0x2:_0x440077+_0x5cffbe+0x1;_0x24191b[_0xd26c('0x3e')](_0x5cffbe,0x0,{'type':_0x43d314[_0xd26c('0x2')],'app':_0xd26c('0x3f'),'appdata':_0x42ad62[_0xd26c('0x2b')][_0x5cffbe]+'?'+_0x43d314[_0xd26c('0x5')]+_0xd26c('0x40')+_0x3f6cf6+':'+_0x43d314[_0xd26c('0x5')]+_0xd26c('0x40')+_0x4bd784,'exten':_0x43d314['exten'],'context':_0x43d314[_0xd26c('0x5')],'priority':_0x440077+_0x5cffbe,'VoiceExtensionId':_0x43d314['id']});}if(_0x42ad62[_0xd26c('0x39')]===_0xd26c('0x41')){_0x42ad62[_0xd26c('0x42')]=_0x8c74f6(_0x43d314,_0x42ad62[_0xd26c('0x42')]);}if(_0x42ad62[_0xd26c('0x39')]===_0xd26c('0x43')){_0x24191b[_0xd26c('0x8')]({'type':_0x42ad62[_0xd26c('0x2')][_0xd26c('0x2f')](),'app':'Set','appdata':_0xd26c('0x44'),'context':_0x43d314['context'],'exten':_0x43d314[_0xd26c('0x6')],'priority':_0x42ad62[_0xd26c('0x2b')]['length']+_0x440077+_0x3290b5++,'VoiceExtensionId':_0x43d314['id']});}_0x42ad62['priority']=_0x24191b['length']?_[_0xd26c('0x45')](_0x24191b)['priority']+0x1:_0x440077;_0x9a7d77=_[_0xd26c('0x46')](_0x9a7d77,_0x24191b,[_0x42ad62],_0x15a1d8);_0x440077=_[_0xd26c('0x45')](_0x9a7d77)['priority']+0x1;}return _0x434cfa(_0x9a7d77);})[_0xd26c('0x47')](function(_0x56de14){_0x12452b(_0x56de14);});});}return _0x45f7cb[_0xd26c('0x48')](_0xd26c('0x49'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x38aecf){var _0x3ca7bc=this['get']({'plain':!![]});var _0x591c80=_0x3ca7bc[_0xd26c('0x2')]===_0xd26c('0xb')?_0x42aaa5(_0x3ca7bc):_0x508185(_0x3ca7bc);return _0x1012b8(_0x3ca7bc,_0x38aecf,_[_0xd26c('0x45')](_0x591c80)[_0xd26c('0x4a')]+0x1)['then'](function(_0x5d07ac){var _0x553a5e=_[_0xd26c('0x46')](_0x591c80,_0x5d07ac);_0x553a5e['push']({'type':_0x3ca7bc['type'],'app':_0xd26c('0x4b'),'exten':_0x3ca7bc['exten'],'context':_0x3ca7bc[_0xd26c('0x5')],'priority':_['last'](_0x553a5e)[_0xd26c('0x4a')]+0x1,'VoiceExtensionId':_0x3ca7bc['id']});return _0x553a5e;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7ec720a..48cbfda 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 _0x158f=['request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','then','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register'];(function(_0x27e0ad,_0xd9977d){var _0x4dd2a0=function(_0x40b6c0){while(--_0x40b6c0){_0x27e0ad['push'](_0x27e0ad['shift']());}};_0x4dd2a0(++_0xd9977d);}(_0x158f,0x137));var _0xf158=function(_0x3d09b0,_0x466d6a){_0x3d09b0=_0x3d09b0-0x0;var _0x95e533=_0x158f[_0x3d09b0];return _0x95e533;};'use strict';var _=require('lodash');var util=require(_0xf158('0x0'));var moment=require(_0xf158('0x1'));var BPromise=require(_0xf158('0x2'));var rs=require(_0xf158('0x3'));var fs=require('fs');var Redis=require(_0xf158('0x4'));var db=require(_0xf158('0x5'))['db'];var utils=require(_0xf158('0x6'));var logger=require('../../config/logger')(_0xf158('0x7'));var config=require('../../config/environment');var jayson=require(_0xf158('0x8'));var client=jayson[_0xf158('0x9')][_0xf158('0xa')]({'port':0x232a});config[_0xf158('0xb')]=_[_0xf158('0xc')](config[_0xf158('0xb')],{'host':_0xf158('0xd'),'port':0x18eb});var socket=require(_0xf158('0xe'))(new Redis(config[_0xf158('0xb')]));require(_0xf158('0xf'))[_0xf158('0x10')](socket);function respondWithRpcPromise(_0x1482d6,_0x5c232c,_0x151786){return new BPromise(function(_0x421b24,_0xda1214){return client[_0xf158('0x11')](_0x1482d6,_0x151786)['then'](function(_0x2fb3cd){logger[_0xf158('0x12')](_0xf158('0x13'),_0x5c232c,_0xf158('0x14'));logger[_0xf158('0x15')](_0xf158('0x16'),_0x5c232c,_0xf158('0x14'),JSON['stringify'](_0x2fb3cd));if(_0x2fb3cd[_0xf158('0x17')]){if(_0x2fb3cd['error'][_0xf158('0x18')]===0x1f4){logger[_0xf158('0x17')](_0xf158('0x13'),_0x5c232c,_0x2fb3cd[_0xf158('0x17')][_0xf158('0x19')]);return _0xda1214(_0x2fb3cd['error'][_0xf158('0x19')]);}logger[_0xf158('0x17')](_0xf158('0x13'),_0x5c232c,_0x2fb3cd['error'][_0xf158('0x19')]);return _0x421b24(_0x2fb3cd[_0xf158('0x17')]['message']);}else{logger['info'](_0xf158('0x13'),_0x5c232c,_0xf158('0x14'));_0x421b24(_0x2fb3cd[_0xf158('0x1a')]['message']);}})[_0xf158('0x1b')](function(_0x4d2a1d){logger['error'](_0xf158('0x13'),_0x5c232c,_0x4d2a1d);_0xda1214(_0x4d2a1d);});});}exports[_0xf158('0x1c')]=function(_0x499841){var _0xe22c06=this;return new Promise(function(_0x4edaee,_0xbf88c9){return db[_0xf158('0x1d')][_0xf158('0x1e')]({'raw':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x20')]===undefined?!![]:![]:!![],'where':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x21')]||null:null,'attributes':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x22')]||null:null,'limit':_0x499841[_0xf158('0x1f')]?_0x499841[_0xf158('0x1f')][_0xf158('0x23')]||null:null,'include':_0x499841[_0xf158('0x1f')]?_0x499841['options'][_0xf158('0x24')]?_['map'](_0x499841['options'][_0xf158('0x24')],function(_0xebaaa3){return{'model':db[_0xebaaa3['model']],'as':_0xebaaa3['as'],'attributes':_0xebaaa3[_0xf158('0x22')],'include':_0xebaaa3[_0xf158('0x24')]?_[_0xf158('0x25')](_0xebaaa3[_0xf158('0x24')],function(_0x438bb4){return{'model':db[_0x438bb4[_0xf158('0x26')]],'as':_0x438bb4['as'],'attributes':_0x438bb4[_0xf158('0x22')],'include':_0x438bb4['include']?_[_0xf158('0x25')](_0x438bb4[_0xf158('0x24')],function(_0x4aa0a0){return{'model':db[_0x4aa0a0[_0xf158('0x26')]],'as':_0x4aa0a0['as'],'attributes':_0x4aa0a0[_0xf158('0x22')]};}):[]};}):[]};}):[]:[]})[_0xf158('0x27')](function(_0x4d860c){logger[_0xf158('0x12')](_0xf158('0x1c'),_0x499841);logger[_0xf158('0x15')](_0xf158('0x1c'),_0x499841,JSON[_0xf158('0x28')](_0x4d860c));_0x4edaee(_0x4d860c);})['catch'](function(_0x25ba0e){logger[_0xf158('0x17')](_0xf158('0x1c'),_0x25ba0e[_0xf158('0x19')],_0x499841);_0xbf88c9(_0xe22c06['error'](0x1f4,_0x25ba0e[_0xf158('0x19')]));});});}; \ No newline at end of file +var _0x07e8=['redis','defaults','localhost','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','options','raw','where','limit','include','model','attributes','map','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x4f710c,_0x368203){var _0x1a323d=function(_0x15c791){while(--_0x15c791){_0x4f710c['push'](_0x4f710c['shift']());}};_0x1a323d(++_0x368203);}(_0x07e8,0x10f));var _0x807e=function(_0x511b40,_0x4789d6){_0x511b40=_0x511b40-0x0;var _0x380d26=_0x07e8[_0x511b40];return _0x380d26;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});config[_0x807e('0x9')]=_[_0x807e('0xa')](config[_0x807e('0x9')],{'host':_0x807e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x807e('0x9')]));require(_0x807e('0xc'))[_0x807e('0xd')](socket);function respondWithRpcPromise(_0x3c6c7a,_0x1c2fdd,_0x45e953){return new BPromise(function(_0x382931,_0x2f44db){return client[_0x807e('0xe')](_0x3c6c7a,_0x45e953)[_0x807e('0xf')](function(_0x2ca6f0){logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,_0x807e('0x12'));logger['debug'](_0x807e('0x13'),_0x1c2fdd,_0x807e('0x12'),JSON[_0x807e('0x14')](_0x2ca6f0));if(_0x2ca6f0[_0x807e('0x15')]){if(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x16')]===0x1f4){logger[_0x807e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0['error'][_0x807e('0x17')]);return _0x2f44db(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}logger[_0x807e('0x15')]('VoiceExtension,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);return _0x382931(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}else{logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,'request\x20sent');_0x382931(_0x2ca6f0[_0x807e('0x18')]['message']);}})[_0x807e('0x19')](function(_0x328290){logger[_0x807e('0x15')](_0x807e('0x11'),_0x1c2fdd,_0x328290);_0x2f44db(_0x328290);});});}exports[_0x807e('0x1a')]=function(_0xad3e35){var _0x1e39ef=this;return new Promise(function(_0x40abbe,_0x3da4d6){return db['VoiceExtension']['findAll']({'raw':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1c')]===undefined?!![]:![]:!![],'where':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1d')]||null:null,'attributes':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')]['attributes']||null:null,'limit':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1e')]||null:null,'include':_0xad3e35[_0x807e('0x1b')]?_0xad3e35[_0x807e('0x1b')][_0x807e('0x1f')]?_['map'](_0xad3e35[_0x807e('0x1b')]['include'],function(_0x33ba88){return{'model':db[_0x33ba88[_0x807e('0x20')]],'as':_0x33ba88['as'],'attributes':_0x33ba88[_0x807e('0x21')],'include':_0x33ba88['include']?_[_0x807e('0x22')](_0x33ba88[_0x807e('0x1f')],function(_0x16530c){return{'model':db[_0x16530c[_0x807e('0x20')]],'as':_0x16530c['as'],'attributes':_0x16530c[_0x807e('0x21')],'include':_0x16530c[_0x807e('0x1f')]?_['map'](_0x16530c[_0x807e('0x1f')],function(_0x5211ce){return{'model':db[_0x5211ce[_0x807e('0x20')]],'as':_0x5211ce['as'],'attributes':_0x5211ce[_0x807e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x807e('0xf')](function(_0x546a04){logger[_0x807e('0x10')](_0x807e('0x1a'),_0xad3e35);logger['debug'](_0x807e('0x1a'),_0xad3e35,JSON[_0x807e('0x14')](_0x546a04));_0x40abbe(_0x546a04);})['catch'](function(_0x344eec){logger[_0x807e('0x15')](_0x807e('0x1a'),_0x344eec[_0x807e('0x17')],_0xad3e35);_0x3da4d6(_0x1e39ef[_0x807e('0x15')](0x1f4,_0x344eec[_0x807e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 04ec1ff..9bd69cb 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 _0x814b=['removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove','update','emit'];(function(_0x102f97,_0x5bda2f){var _0xd22058=function(_0x2ccc1f){while(--_0x2ccc1f){_0x102f97['push'](_0x102f97['shift']());}};_0xd22058(++_0x5bda2f);}(_0x814b,0x1a2));var _0xb814=function(_0x2850c0,_0x1363a7){_0x2850c0=_0x2850c0-0x0;var _0x21e830=_0x814b[_0x2850c0];return _0x21e830;};'use strict';var VoiceExtensionEvents=require(_0xb814('0x0'));var events=[_0xb814('0x1'),_0xb814('0x2'),_0xb814('0x3')];function createListener(_0xfbb64b,_0x477725){return function(_0x4a98af){_0x477725[_0xb814('0x4')](_0xfbb64b,_0x4a98af);};}function removeListener(_0x3e1e9,_0x258866){return function(){VoiceExtensionEvents[_0xb814('0x5')](_0x3e1e9,_0x258866);};}exports[_0xb814('0x6')]=function(_0x322a70){for(var _0x53e507=0x0,_0x3b0829=events[_0xb814('0x7')];_0x53e507<_0x3b0829;_0x53e507++){var _0x5c8539=events[_0x53e507];var _0x271af9=createListener(_0xb814('0x8')+_0x5c8539,_0x322a70);VoiceExtensionEvents['on'](_0x5c8539,_0x271af9);}}; \ No newline at end of file +var _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x19fc9f,_0x42bd9e){var _0x55dad9=function(_0x4013bb){while(--_0x4013bb){_0x19fc9f['push'](_0x19fc9f['shift']());}};_0x55dad9(++_0x42bd9e);}(_0xf494,0x1c6));var _0x4f49=function(_0x1134a0,_0x45ff2d){_0x1134a0=_0x1134a0-0x0;var _0xc025e5=_0xf494[_0x1134a0];return _0xc025e5;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index e568487..d713548 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 _0x1261=['isAuthenticated','show','/:id/messages','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','index','get'];(function(_0x5a0d9f,_0x3509db){var _0x277ad4=function(_0x5ddb61){while(--_0x5ddb61){_0x5a0d9f['push'](_0x5a0d9f['shift']());}};_0x277ad4(++_0x3509db);}(_0x1261,0x144));var _0x1126=function(_0x4bae1a,_0x5b0916){_0x4bae1a=_0x4bae1a-0x0;var _0x27f6d2=_0x1261[_0x4bae1a];return _0x27f6d2;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var fs_extra=require(_0x1126('0x5'));var auth=require(_0x1126('0x6'));var interaction=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var controller=require(_0x1126('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x1126('0xa')]);router[_0x1126('0xb')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0xd')]);router[_0x1126('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['getMessages']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x4137=['getMessages','post','create','put','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','index','/:id','isAuthenticated','/:id/messages'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x4137,0xf8));var _0x7413=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x4137[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var path=require(_0x7413('0x2'));var timeout=require(_0x7413('0x3'));var express=require(_0x7413('0x4'));var router=express[_0x7413('0x5')]();var fs_extra=require(_0x7413('0x6'));var auth=require(_0x7413('0x7'));var interaction=require(_0x7413('0x8'));var config=require(_0x7413('0x9'));var controller=require(_0x7413('0xa'));router[_0x7413('0xb')]('/',auth['isAuthenticated'](),controller[_0x7413('0xc')]);router[_0x7413('0xb')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['show']);router[_0x7413('0xb')](_0x7413('0xf'),auth['isAuthenticated'](),controller[_0x7413('0x10')]);router[_0x7413('0x11')]('/',auth['isAuthenticated'](),controller[_0x7413('0x12')]);router[_0x7413('0x13')](_0x7413('0xd'),auth[_0x7413('0xe')](),controller[_0x7413('0x14')]);router['delete'](_0x7413('0xd'),auth[_0x7413('0xe')](),controller['destroy']);module[_0x7413('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 3b9899f..c9e0228 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 _0x0a6c=['TIMESTAMP','INTEGER','VIRTUAL','fullname','\x20-\x20','getDataValue','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','central','ENUM','yes','TINYINT(4)'];(function(_0x31a16a,_0x1d60e3){var _0x21c892=function(_0x5b25f6){while(--_0x5b25f6){_0x31a16a['push'](_0x31a16a['shift']());}};_0x21c892(++_0x1d60e3);}(_0x0a6c,0x17d));var _0xc0a6=function(_0x161872,_0x2d84b2){_0x161872=_0x161872-0x0;var _0x6473df=_0x0a6c[_0x161872];return _0x6473df;};'use strict';var Sequelize=require(_0xc0a6('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xc0a6('0x1')],'defaultValue':_0xc0a6('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc0a6('0x1')],'defaultValue':'','allowNull':![],'unique':_0xc0a6('0x3')},'password':{'type':Sequelize[_0xc0a6('0x1')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xc0a6('0x1')],'validate':{'isEmail':!![]},'set':function(_0x165f53){this['setDataValue'](_0xc0a6('0x4'),typeof _0x165f53===_0xc0a6('0x5')&&_0x165f53['trim']()?_0x165f53['trim']():null);}},'pager':{'type':Sequelize[_0xc0a6('0x1')]},'tz':{'type':Sequelize[_0xc0a6('0x1')],'defaultValue':_0xc0a6('0x6')},'attach':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':_0xc0a6('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':_0xc0a6('0x8'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xc0a6('0x1')]},'review':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc0a6('0x9'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':_0xc0a6('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0xc0a6('0x7')](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xc0a6('0x8'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc0a6('0x7')]('yes','no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xc0a6('0xa')},'emailsubject':{'type':Sequelize[_0xc0a6('0x1')]},'emailbody':{'type':Sequelize[_0xc0a6('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xc0a6('0xb')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc0a6('0xc')],'get':function(){return this['getDataValue'](_0xc0a6('0xd'))+_0xc0a6('0xe')+this[_0xc0a6('0xf')](_0xc0a6('0x10'));}}}; \ No newline at end of file +var _0x53ba=['getDataValue','fullname','sequelize','exports','STRING','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x53ba,0x134));var _0xa53b=function(_0x54c0a4,_0x151d9f){_0x54c0a4=_0x54c0a4-0x0;var _0x2c9abe=_0x53ba[_0x54c0a4];return _0x2c9abe;};'use strict';var Sequelize=require(_0xa53b('0x0'));module[_0xa53b('0x1')]={'customer_id':{'type':Sequelize[_0xa53b('0x2')]},'context':{'type':Sequelize[_0xa53b('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xa53b('0x2')],'defaultValue':'','allowNull':![],'unique':_0xa53b('0x3')},'password':{'type':Sequelize[_0xa53b('0x2')]},'fullname':{'type':Sequelize[_0xa53b('0x2')]},'email':{'type':Sequelize[_0xa53b('0x2')],'validate':{'isEmail':!![]},'set':function(_0x27c9c5){this[_0xa53b('0x4')](_0xa53b('0x5'),typeof _0x27c9c5===_0xa53b('0x6')&&_0x27c9c5[_0xa53b('0x7')]()?_0x27c9c5[_0xa53b('0x7')]():null);}},'pager':{'type':Sequelize[_0xa53b('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0xa53b('0x8')},'attach':{'type':Sequelize[_0xa53b('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':_0xa53b('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xa53b('0x2')]},'callback':{'type':Sequelize[_0xa53b('0x2')]},'review':{'type':Sequelize['ENUM'](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xa53b('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':_0xa53b('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xa53b('0x9')](_0xa53b('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0xa53b('0xc')},'emailsubject':{'type':Sequelize[_0xa53b('0x2')]},'emailbody':{'type':Sequelize[_0xa53b('0x2')]},'maxsecs':{'type':Sequelize[_0xa53b('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xa53b('0xe')],'get':function(){return this[_0xa53b('0xf')](_0xa53b('0x10'))+'\x20-\x20'+this[_0xa53b('0xf')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 030410f..5ca629b 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 _0x282b=['json','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','error','stack','name','send','map','rawAttributes','fieldName','key','query','keys','filters','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','merge','options','VoiceMail','includeAll','include','findAll','catch','show','intersection','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','params','getMessages','findOne','VoiceMailMessage','pick','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x282b,0xec));var _0xb282=function(_0x5c2d1b,_0x1bd47d){_0x5c2d1b=_0x5c2d1b-0x0;var _0x1a7d56=_0x282b[_0x5c2d1b];return _0x1a7d56;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){var _0x5e828e=_0x360f15[_0xb282('0x25')]({'plain':!![]});var _0x114f77=_0xb282('0x26');return db[_0xb282('0x27')][_0xb282('0x24')]({'where':{'type':_0x114f77,'resourceId':_0x5e828e['id']}})[_0xb282('0x23')](function(){return _0x360f15;});})['then'](function(){_0x56645f[_0xb282('0x18')](0xcc)[_0xb282('0x28')]();});}};}function handleEntityNotFound(_0x50bd73,_0x22d895){return function(_0x38a1f8){if(!_0x38a1f8){_0x50bd73[_0xb282('0x17')](0x194);}return _0x38a1f8;};}function handleError(_0x280940,_0x59644e){_0x59644e=_0x59644e||0x1f4;return function(_0x1520b1){logger[_0xb282('0x29')](_0x1520b1[_0xb282('0x2a')]);if(_0x1520b1[_0xb282('0x2b')]){delete _0x1520b1[_0xb282('0x2b')];}_0x280940[_0xb282('0x18')](_0x59644e)[_0xb282('0x2c')](_0x1520b1);};}exports['index']=function(_0x1b15b5,_0x1e2861){var _0x3eb294={},_0xd8780b={},_0x42ef75={'count':0x0,'rows':[]};var _0x5f3ddf=_[_0xb282('0x2d')](db['VoiceMail'][_0xb282('0x2e')],function(_0x1bf721){return{'name':_0x1bf721[_0xb282('0x2f')],'type':_0x1bf721['type'][_0xb282('0x30')]};});_0xd8780b['model']=_[_0xb282('0x2d')](_0x5f3ddf,_0xb282('0x2b'));_0xd8780b[_0xb282('0x31')]=_[_0xb282('0x32')](_0x1b15b5[_0xb282('0x31')]);_0xd8780b[_0xb282('0x33')]=_['intersection'](_0xd8780b[_0xb282('0x34')],_0xd8780b[_0xb282('0x31')]);_0x3eb294['attributes']=_['intersection'](_0xd8780b[_0xb282('0x34')],qs[_0xb282('0x35')](_0x1b15b5[_0xb282('0x31')]['fields']));_0x3eb294['attributes']=_0x3eb294['attributes'][_0xb282('0x36')]?_0x3eb294[_0xb282('0x37')]:_0xd8780b[_0xb282('0x34')];if(!_0x1b15b5[_0xb282('0x31')][_0xb282('0x38')](_0xb282('0x39'))){_0x3eb294[_0xb282('0x1b')]=qs['limit'](_0x1b15b5[_0xb282('0x31')]['limit']);_0x3eb294[_0xb282('0x19')]=qs[_0xb282('0x19')](_0x1b15b5[_0xb282('0x31')]['offset']);}_0x3eb294[_0xb282('0x3a')]=qs['sort'](_0x1b15b5[_0xb282('0x31')][_0xb282('0x3b')]);_0x3eb294[_0xb282('0x3c')]=qs[_0xb282('0x33')](_['pick'](_0x1b15b5['query'],_0xd8780b[_0xb282('0x33')]),_0x5f3ddf);if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]){_0x3eb294[_0xb282('0x3c')]=_['merge'](_0x3eb294[_0xb282('0x3c')],{'$or':_['map'](_0x5f3ddf,function(_0x475895){if(_0x475895[_0xb282('0x3e')]!=='VIRTUAL'){var _0x41f2c4={};_0x41f2c4[_0x475895[_0xb282('0x2b')]]={'$like':'%'+_0x1b15b5[_0xb282('0x31')][_0xb282('0x3d')]+'%'};return _0x41f2c4;}})});}_0x3eb294=_[_0xb282('0x3f')]({},_0x3eb294,_0x1b15b5[_0xb282('0x40')]);var _0x43e87e={'where':_0x3eb294[_0xb282('0x3c')]};return db[_0xb282('0x41')][_0xb282('0x1c')](_0x43e87e)[_0xb282('0x23')](function(_0x91fe43){_0x42ef75[_0xb282('0x1c')]=_0x91fe43;if(_0x1b15b5[_0xb282('0x31')][_0xb282('0x42')]){_0x3eb294[_0xb282('0x43')]=[{'all':!![]}];}return db[_0xb282('0x41')][_0xb282('0x44')](_0x3eb294);})['then'](function(_0x310ad1){_0x42ef75['rows']=_0x310ad1;return _0x42ef75;})[_0xb282('0x23')](respondWithFilteredResult(_0x1e2861,_0x3eb294))[_0xb282('0x45')](handleError(_0x1e2861,null));};exports[_0xb282('0x46')]=function(_0x2f2ce8,_0x197472){var _0x3ddf56={'raw':!![],'where':{'id':_0x2f2ce8['params']['id']}},_0x5a6c0d={};_0x5a6c0d[_0xb282('0x34')]=_['keys'](db[_0xb282('0x41')][_0xb282('0x2e')]);_0x5a6c0d['query']=_[_0xb282('0x32')](_0x2f2ce8[_0xb282('0x31')]);_0x5a6c0d[_0xb282('0x33')]=_['intersection'](_0x5a6c0d['model'],_0x5a6c0d[_0xb282('0x31')]);_0x3ddf56['attributes']=_[_0xb282('0x47')](_0x5a6c0d[_0xb282('0x34')],qs[_0xb282('0x35')](_0x2f2ce8[_0xb282('0x31')][_0xb282('0x35')]));_0x3ddf56[_0xb282('0x37')]=_0x3ddf56['attributes'][_0xb282('0x36')]?_0x3ddf56[_0xb282('0x37')]:_0x5a6c0d[_0xb282('0x34')];if(_0x2f2ce8['query'][_0xb282('0x42')]){_0x3ddf56['include']=[{'all':!![]}];}_0x3ddf56=_[_0xb282('0x3f')]({},_0x3ddf56,_0x2f2ce8['options']);return db[_0xb282('0x41')]['find'](_0x3ddf56)['then'](handleEntityNotFound(_0x197472,null))['then'](respondWithResult(_0x197472,null))[_0xb282('0x45')](handleError(_0x197472,null));};exports[_0xb282('0x48')]=function(_0x42d99f,_0x7a5aa4){return db['VoiceMail']['create'](_0x42d99f['body'],{})[_0xb282('0x23')](function(_0x255ad5){var _0x3bed8d=_0x42d99f[_0xb282('0x49')]['get']({'plain':!![]});if(!_0x3bed8d)throw new Error(_0xb282('0x4a'));if(_0x3bed8d[_0xb282('0x4b')]==='user'){var _0x33bded=_0x255ad5[_0xb282('0x25')]({'plain':!![]});var _0x16f66b=_0xb282('0x26');return db[_0xb282('0x4c')]['find']({'where':{'name':_0x16f66b,'userProfileId':_0x3bed8d[_0xb282('0x4d')]},'raw':!![]})[_0xb282('0x23')](function(_0x465209){if(_0x465209&&_0x465209[_0xb282('0x4e')]===0x0){return db[_0xb282('0x27')][_0xb282('0x48')]({'name':_0x33bded['name'],'resourceId':_0x33bded['id'],'type':_0x465209[_0xb282('0x2b')],'sectionId':_0x465209['id']},{})['then'](function(){return _0x255ad5;});}else{return _0x255ad5;}})[_0xb282('0x45')](function(_0x1e6ade){logger['error'](_0xb282('0x4f'),_0x1e6ade);throw _0x1e6ade;});}return _0x255ad5;})[_0xb282('0x23')](respondWithResult(_0x7a5aa4,0xc9))[_0xb282('0x45')](handleError(_0x7a5aa4,null));};exports['update']=function(_0x51cbb0,_0x1028b9){if(_0x51cbb0[_0xb282('0x50')]['id']){delete _0x51cbb0[_0xb282('0x50')]['id'];}return db['VoiceMail'][_0xb282('0x51')]({'where':{'id':_0x51cbb0['params']['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x1028b9,null))[_0xb282('0x23')](saveUpdates(_0x51cbb0['body'],null))[_0xb282('0x23')](respondWithResult(_0x1028b9,null))['catch'](handleError(_0x1028b9,null));};exports[_0xb282('0x24')]=function(_0x34b31a,_0x2e6eaa){return db[_0xb282('0x41')][_0xb282('0x51')]({'where':{'id':_0x34b31a[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x2e6eaa,null))[_0xb282('0x23')](removeEntity(_0x2e6eaa,null))['catch'](handleError(_0x2e6eaa,null));};exports[_0xb282('0x53')]=function(_0x34baf2,_0x53d50a,_0x597793){return db[_0xb282('0x41')][_0xb282('0x54')]({'where':{'id':_0x34baf2[_0xb282('0x52')]['id']}})['then'](handleEntityNotFound(_0x53d50a,null))['then'](function(_0x40ae87){var _0x2dbbc4;var _0x3716b0={},_0x5d6a78={};_0x5d6a78[_0xb282('0x34')]=_['keys'](db[_0xb282('0x55')][_0xb282('0x2e')]);_0x5d6a78[_0xb282('0x31')]=_[_0xb282('0x32')](_0x34baf2[_0xb282('0x31')]);_0x5d6a78[_0xb282('0x33')]=_[_0xb282('0x47')](_0x5d6a78['model'],_0x5d6a78[_0xb282('0x31')]);_0x3716b0[_0xb282('0x37')]=_[_0xb282('0x47')](_0x5d6a78['model'],qs['fields'](_0x34baf2[_0xb282('0x31')][_0xb282('0x35')]));_0x3716b0[_0xb282('0x37')]=_0x3716b0['attributes']['length']?_0x3716b0[_0xb282('0x37')]:_0x5d6a78[_0xb282('0x34')];if(!_0x34baf2['query'][_0xb282('0x38')](_0xb282('0x39'))){_0x3716b0[_0xb282('0x1b')]=qs['limit'](_0x34baf2[_0xb282('0x31')][_0xb282('0x1b')]);_0x3716b0['offset']=qs[_0xb282('0x19')](_0x34baf2[_0xb282('0x31')][_0xb282('0x19')]);}_0x3716b0[_0xb282('0x3a')]=qs['sort'](_0x34baf2['query'][_0xb282('0x3b')]);_0x3716b0[_0xb282('0x3c')]=qs['filters'](_[_0xb282('0x56')](_0x34baf2[_0xb282('0x31')],_0x5d6a78[_0xb282('0x33')]));if(_0x34baf2[_0xb282('0x31')][_0xb282('0x3d')]){_0x3716b0[_0xb282('0x3c')]=_[_0xb282('0x3f')](_0x3716b0[_0xb282('0x3c')],{'$or':_['map'](_0x3716b0[_0xb282('0x37')],function(_0xb22721){var _0x18f33d={};_0x18f33d[_0xb22721]={'$like':'%'+_0x34baf2['query'][_0xb282('0x3d')]+'%'};return _0x18f33d;})});}_0x3716b0[_0xb282('0x3c')]=_['merge'](_0x3716b0['where'],{'mailboxuser':_0x40ae87[_0xb282('0x57')]});_0x3716b0=_[_0xb282('0x3f')]({},_0x3716b0,_0x34baf2[_0xb282('0x40')]);return db[_0xb282('0x55')][_0xb282('0x58')](_0x3716b0)[_0xb282('0x23')](respondWithFilteredResult(_0x53d50a,_0x3716b0));})[_0xb282('0x45')](handleError(_0x53d50a,null));}; \ No newline at end of file +var _0xd87e=['autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','getMessages','findOne','VoiceMailMessage','hasOwnProperty','sort','mailbox','findAndCountAll','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','then','destroy','get','Voicemails','UserProfileResource','error','name','map','VoiceMail','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId'];(function(_0x31ea9d,_0x475ab0){var _0x22a4ae=function(_0x48fb68){while(--_0x48fb68){_0x31ea9d['push'](_0x31ea9d['shift']());}};_0x22a4ae(++_0x475ab0);}(_0xd87e,0x1bf));var _0xed87=function(_0x41b29e,_0x34b288){_0x41b29e=_0x41b29e-0x0;var _0xacd517=_0xd87e[_0x41b29e];return _0xacd517;};'use strict';var emlformat=require(_0xed87('0x0'));var rimraf=require(_0xed87('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xed87('0x2'));var rp=require(_0xed87('0x3'));var moment=require(_0xed87('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xed87('0x5'));var util=require('util');var path=require(_0xed87('0x6'));var sox=require(_0xed87('0x7'));var csv=require('to-csv');var ejs=require(_0xed87('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xed87('0x9'));var crypto=require(_0xed87('0xa'));var jsforce=require(_0xed87('0xb'));var deskjs=require(_0xed87('0xc'));var toCsv=require('to-csv');var querystring=require(_0xed87('0xd'));var Papa=require(_0xed87('0xe'));var Redis=require(_0xed87('0xf'));var authService=require(_0xed87('0x10'));var qs=require(_0xed87('0x11'));var as=require(_0xed87('0x12'));var hardwareService=require(_0xed87('0x13'));var logger=require('../../config/logger')(_0xed87('0x14'));var utils=require(_0xed87('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xed87('0x16'));var db=require(_0xed87('0x17'))['db'];function respondWithStatusCode(_0x5e912e,_0x4ffc2d){_0x4ffc2d=_0x4ffc2d||0xcc;return function(_0x466f35){if(_0x466f35){return _0x5e912e[_0xed87('0x18')](_0x4ffc2d);}return _0x5e912e[_0xed87('0x19')](_0x4ffc2d)[_0xed87('0x1a')]();};}function respondWithResult(_0x16bfd6,_0x3865c5){_0x3865c5=_0x3865c5||0xc8;return function(_0x52dfe8){if(_0x52dfe8){return _0x16bfd6[_0xed87('0x19')](_0x3865c5)[_0xed87('0x1b')](_0x52dfe8);}};}function respondWithFilteredResult(_0x1722a6,_0x1e9a3d){return function(_0x2f2fd3){if(_0x2f2fd3){var _0xd34e0e=typeof _0x1e9a3d[_0xed87('0x1c')]===_0xed87('0x1d')&&typeof _0x1e9a3d[_0xed87('0x1e')]==='undefined';var _0x3db5ea=_0x2f2fd3[_0xed87('0x1f')];var _0x2c386a=_0xd34e0e?0x0:_0x1e9a3d[_0xed87('0x1c')];var _0x5f4076=_0xd34e0e?_0x2f2fd3[_0xed87('0x1f')]:_0x1e9a3d[_0xed87('0x1c')]+_0x1e9a3d[_0xed87('0x1e')];var _0x3f9e08;if(_0x5f4076>=_0x3db5ea){_0x5f4076=_0x3db5ea;_0x3f9e08=0xc8;}else{_0x3f9e08=0xce;}_0x1722a6[_0xed87('0x19')](_0x3f9e08);return _0x1722a6[_0xed87('0x20')](_0xed87('0x21'),_0x2c386a+'-'+_0x5f4076+'/'+_0x3db5ea)[_0xed87('0x1b')](_0x2f2fd3);}return null;};}function patchUpdates(_0x3b7981){return function(_0x52e81c){try{jsonpatch['apply'](_0x52e81c,_0x3b7981,!![]);}catch(_0x5db546){return BPromise['reject'](_0x5db546);}return _0x52e81c[_0xed87('0x22')]();};}function saveUpdates(_0x5d3ec8,_0x4191a7){return function(_0x2b0b98){if(_0x2b0b98){return _0x2b0b98['update'](_0x5d3ec8)[_0xed87('0x23')](function(_0x505733){return _0x505733;});}return null;};}function removeEntity(_0x3d1641,_0x24962e){return function(_0x27799a){if(_0x27799a){return _0x27799a[_0xed87('0x24')]()[_0xed87('0x23')](function(){var _0x5d15b3=_0x27799a[_0xed87('0x25')]({'plain':!![]});var _0x3c22b7=_0xed87('0x26');return db[_0xed87('0x27')][_0xed87('0x24')]({'where':{'type':_0x3c22b7,'resourceId':_0x5d15b3['id']}})[_0xed87('0x23')](function(){return _0x27799a;});})[_0xed87('0x23')](function(){_0x3d1641[_0xed87('0x19')](0xcc)[_0xed87('0x1a')]();});}};}function handleEntityNotFound(_0x38f5c,_0x469181){return function(_0x341a35){if(!_0x341a35){_0x38f5c[_0xed87('0x18')](0x194);}return _0x341a35;};}function handleError(_0x2b86e2,_0x4dfaf2){_0x4dfaf2=_0x4dfaf2||0x1f4;return function(_0xb32b1c){logger[_0xed87('0x28')](_0xb32b1c['stack']);if(_0xb32b1c[_0xed87('0x29')]){delete _0xb32b1c[_0xed87('0x29')];}_0x2b86e2[_0xed87('0x19')](_0x4dfaf2)['send'](_0xb32b1c);};}exports['index']=function(_0xd0efba,_0x428b75){var _0x21ab8a={},_0x549a19={},_0x37d45a={'count':0x0,'rows':[]};var _0x3b87e3=_[_0xed87('0x2a')](db[_0xed87('0x2b')][_0xed87('0x2c')],function(_0x46b9f9){return{'name':_0x46b9f9[_0xed87('0x2d')],'type':_0x46b9f9[_0xed87('0x2e')][_0xed87('0x2f')]};});_0x549a19['model']=_[_0xed87('0x2a')](_0x3b87e3,_0xed87('0x29'));_0x549a19['query']=_[_0xed87('0x30')](_0xd0efba['query']);_0x549a19[_0xed87('0x31')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],_0x549a19[_0xed87('0x34')]);_0x21ab8a[_0xed87('0x35')]=_[_0xed87('0x32')](_0x549a19[_0xed87('0x33')],qs[_0xed87('0x36')](_0xd0efba[_0xed87('0x34')][_0xed87('0x36')]));_0x21ab8a[_0xed87('0x35')]=_0x21ab8a['attributes'][_0xed87('0x37')]?_0x21ab8a[_0xed87('0x35')]:_0x549a19['model'];if(!_0xd0efba[_0xed87('0x34')]['hasOwnProperty'](_0xed87('0x38'))){_0x21ab8a[_0xed87('0x1e')]=qs['limit'](_0xd0efba[_0xed87('0x34')][_0xed87('0x1e')]);_0x21ab8a[_0xed87('0x1c')]=qs[_0xed87('0x1c')](_0xd0efba[_0xed87('0x34')]['offset']);}_0x21ab8a[_0xed87('0x39')]=qs['sort'](_0xd0efba[_0xed87('0x34')]['sort']);_0x21ab8a[_0xed87('0x3a')]=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0xd0efba[_0xed87('0x34')],_0x549a19[_0xed87('0x31')]),_0x3b87e3);if(_0xd0efba[_0xed87('0x34')][_0xed87('0x3c')]){_0x21ab8a[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0x21ab8a['where'],{'$or':_['map'](_0x3b87e3,function(_0xa6714a){if(_0xa6714a[_0xed87('0x2e')]!==_0xed87('0x3e')){var _0x325112={};_0x325112[_0xa6714a[_0xed87('0x29')]]={'$like':'%'+_0xd0efba[_0xed87('0x34')]['filter']+'%'};return _0x325112;}})});}_0x21ab8a=_[_0xed87('0x3d')]({},_0x21ab8a,_0xd0efba[_0xed87('0x3f')]);var _0x1c49b0={'where':_0x21ab8a['where']};return db[_0xed87('0x2b')][_0xed87('0x1f')](_0x1c49b0)[_0xed87('0x23')](function(_0x1b0092){_0x37d45a[_0xed87('0x1f')]=_0x1b0092;if(_0xd0efba[_0xed87('0x34')][_0xed87('0x40')]){_0x21ab8a[_0xed87('0x41')]=[{'all':!![]}];}return db[_0xed87('0x2b')][_0xed87('0x42')](_0x21ab8a);})['then'](function(_0x7e6cbb){_0x37d45a[_0xed87('0x43')]=_0x7e6cbb;return _0x37d45a;})[_0xed87('0x23')](respondWithFilteredResult(_0x428b75,_0x21ab8a))['catch'](handleError(_0x428b75,null));};exports['show']=function(_0xa31eec,_0x7aa7fa){var _0x40cd98={'raw':!![],'where':{'id':_0xa31eec['params']['id']}},_0x41a658={};_0x41a658[_0xed87('0x33')]=_[_0xed87('0x30')](db['VoiceMail'][_0xed87('0x2c')]);_0x41a658[_0xed87('0x34')]=_[_0xed87('0x30')](_0xa31eec[_0xed87('0x34')]);_0x41a658[_0xed87('0x31')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],_0x41a658[_0xed87('0x34')]);_0x40cd98[_0xed87('0x35')]=_[_0xed87('0x32')](_0x41a658[_0xed87('0x33')],qs['fields'](_0xa31eec[_0xed87('0x34')][_0xed87('0x36')]));_0x40cd98[_0xed87('0x35')]=_0x40cd98[_0xed87('0x35')][_0xed87('0x37')]?_0x40cd98[_0xed87('0x35')]:_0x41a658[_0xed87('0x33')];if(_0xa31eec[_0xed87('0x34')][_0xed87('0x40')]){_0x40cd98[_0xed87('0x41')]=[{'all':!![]}];}_0x40cd98=_[_0xed87('0x3d')]({},_0x40cd98,_0xa31eec[_0xed87('0x3f')]);return db[_0xed87('0x2b')][_0xed87('0x44')](_0x40cd98)[_0xed87('0x23')](handleEntityNotFound(_0x7aa7fa,null))[_0xed87('0x23')](respondWithResult(_0x7aa7fa,null))[_0xed87('0x45')](handleError(_0x7aa7fa,null));};exports['create']=function(_0x2c7bef,_0x1a68a7){return db[_0xed87('0x2b')]['create'](_0x2c7bef[_0xed87('0x46')],{})[_0xed87('0x23')](function(_0x54bc95){var _0x33e736=_0x2c7bef[_0xed87('0x47')][_0xed87('0x25')]({'plain':!![]});if(!_0x33e736)throw new Error(_0xed87('0x48'));if(_0x33e736['role']===_0xed87('0x47')){var _0x436e15=_0x54bc95[_0xed87('0x25')]({'plain':!![]});var _0x272a07=_0xed87('0x26');return db[_0xed87('0x49')][_0xed87('0x44')]({'where':{'name':_0x272a07,'userProfileId':_0x33e736[_0xed87('0x4a')]},'raw':!![]})[_0xed87('0x23')](function(_0x251d4e){if(_0x251d4e&&_0x251d4e[_0xed87('0x4b')]===0x0){return db[_0xed87('0x27')][_0xed87('0x4c')]({'name':_0x436e15['name'],'resourceId':_0x436e15['id'],'type':_0x251d4e[_0xed87('0x29')],'sectionId':_0x251d4e['id']},{})['then'](function(){return _0x54bc95;});}else{return _0x54bc95;}})[_0xed87('0x45')](function(_0x329973){logger[_0xed87('0x28')](_0xed87('0x4d'),_0x329973);throw _0x329973;});}return _0x54bc95;})[_0xed87('0x23')](respondWithResult(_0x1a68a7,0xc9))[_0xed87('0x45')](handleError(_0x1a68a7,null));};exports[_0xed87('0x4e')]=function(_0xccdbb6,_0x3b413d){if(_0xccdbb6[_0xed87('0x46')]['id']){delete _0xccdbb6['body']['id'];}return db[_0xed87('0x2b')][_0xed87('0x44')]({'where':{'id':_0xccdbb6[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x3b413d,null))[_0xed87('0x23')](saveUpdates(_0xccdbb6[_0xed87('0x46')],null))[_0xed87('0x23')](respondWithResult(_0x3b413d,null))[_0xed87('0x45')](handleError(_0x3b413d,null));};exports[_0xed87('0x24')]=function(_0x367ff4,_0x32db1f){return db['VoiceMail']['find']({'where':{'id':_0x367ff4[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x32db1f,null))[_0xed87('0x23')](removeEntity(_0x32db1f,null))[_0xed87('0x45')](handleError(_0x32db1f,null));};exports[_0xed87('0x50')]=function(_0x4dd840,_0x7e6738,_0x1ddd72){return db[_0xed87('0x2b')][_0xed87('0x51')]({'where':{'id':_0x4dd840[_0xed87('0x4f')]['id']}})[_0xed87('0x23')](handleEntityNotFound(_0x7e6738,null))[_0xed87('0x23')](function(_0x1391a2){var _0x2ffffa;var _0xf4ec55={},_0x3feebb={};_0x3feebb[_0xed87('0x33')]=_[_0xed87('0x30')](db[_0xed87('0x52')]['rawAttributes']);_0x3feebb[_0xed87('0x34')]=_[_0xed87('0x30')](_0x4dd840[_0xed87('0x34')]);_0x3feebb[_0xed87('0x31')]=_[_0xed87('0x32')](_0x3feebb[_0xed87('0x33')],_0x3feebb[_0xed87('0x34')]);_0xf4ec55[_0xed87('0x35')]=_['intersection'](_0x3feebb[_0xed87('0x33')],qs[_0xed87('0x36')](_0x4dd840[_0xed87('0x34')][_0xed87('0x36')]));_0xf4ec55[_0xed87('0x35')]=_0xf4ec55[_0xed87('0x35')]['length']?_0xf4ec55['attributes']:_0x3feebb[_0xed87('0x33')];if(!_0x4dd840[_0xed87('0x34')][_0xed87('0x53')](_0xed87('0x38'))){_0xf4ec55[_0xed87('0x1e')]=qs[_0xed87('0x1e')](_0x4dd840[_0xed87('0x34')][_0xed87('0x1e')]);_0xf4ec55['offset']=qs[_0xed87('0x1c')](_0x4dd840['query'][_0xed87('0x1c')]);}_0xf4ec55[_0xed87('0x39')]=qs['sort'](_0x4dd840[_0xed87('0x34')][_0xed87('0x54')]);_0xf4ec55['where']=qs[_0xed87('0x31')](_[_0xed87('0x3b')](_0x4dd840[_0xed87('0x34')],_0x3feebb[_0xed87('0x31')]));if(_0x4dd840[_0xed87('0x34')]['filter']){_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'$or':_[_0xed87('0x2a')](_0xf4ec55['attributes'],function(_0x58279a){var _0x3a6ab6={};_0x3a6ab6[_0x58279a]={'$like':'%'+_0x4dd840[_0xed87('0x34')]['filter']+'%'};return _0x3a6ab6;})});}_0xf4ec55[_0xed87('0x3a')]=_[_0xed87('0x3d')](_0xf4ec55[_0xed87('0x3a')],{'mailboxuser':_0x1391a2[_0xed87('0x55')]});_0xf4ec55=_[_0xed87('0x3d')]({},_0xf4ec55,_0x4dd840[_0xed87('0x3f')]);return db[_0xed87('0x52')][_0xed87('0x56')](_0xf4ec55)[_0xed87('0x23')](respondWithFilteredResult(_0x7e6738,_0xf4ec55));})[_0xed87('0x45')](handleError(_0x7e6738,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index b2c3fab..5444755 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 _0xc7f2=['api','moment','bluebird','request-promise','../../config/environment','./voiceMail.attributes','exports','VoiceMail','mailbox','context','lodash','util','../../config/logger'];(function(_0x12e1dd,_0x299547){var _0x4aa850=function(_0x1f541f){while(--_0x1f541f){_0x12e1dd['push'](_0x12e1dd['shift']());}};_0x4aa850(++_0x299547);}(_0xc7f2,0xda));var _0x2c7f=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0xc7f2[_0x1db251];return _0x56685a;};'use strict';var _=require(_0x2c7f('0x0'));var util=require(_0x2c7f('0x1'));var logger=require(_0x2c7f('0x2'))(_0x2c7f('0x3'));var moment=require(_0x2c7f('0x4'));var BPromise=require(_0x2c7f('0x5'));var rp=require(_0x2c7f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2c7f('0x7'));var attributes=require(_0x2c7f('0x8'));module[_0x2c7f('0x9')]=function(_0x432bae,_0x3772fb){return _0x432bae['define'](_0x2c7f('0xa'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x2c7f('0xb'),_0x2c7f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff48=['exports','define','VoiceMail','voice_voicemail','mailbox_context','mailbox','context','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x16f7c3,_0x7cc6bd){var _0x259a52=function(_0x5d494a){while(--_0x5d494a){_0x16f7c3['push'](_0x16f7c3['shift']());}};_0x259a52(++_0x7cc6bd);}(_0xff48,0x167));var _0x8ff4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xff48[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x8ff4('0x0'));var util=require(_0x8ff4('0x1'));var logger=require(_0x8ff4('0x2'))(_0x8ff4('0x3'));var moment=require(_0x8ff4('0x4'));var BPromise=require(_0x8ff4('0x5'));var rp=require(_0x8ff4('0x6'));var fs=require('fs');var path=require(_0x8ff4('0x7'));var rimraf=require(_0x8ff4('0x8'));var config=require('../../config/environment');var attributes=require('./voiceMail.attributes');module[_0x8ff4('0x9')]=function(_0x56918a,_0x25fcc4){return _0x56918a[_0x8ff4('0xa')](_0x8ff4('0xb'),attributes,{'tableName':_0x8ff4('0xc'),'paranoid':![],'indexes':[{'name':_0x8ff4('0xd'),'fields':[_0x8ff4('0xe'),_0x8ff4('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index fbafd8d..2dfe6e7 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 _0x1dc6=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','randomstring','ioredis'];(function(_0x3ca4e7,_0x126d77){var _0x585ea=function(_0x6fdaf1){while(--_0x6fdaf1){_0x3ca4e7['push'](_0x3ca4e7['shift']());}};_0x585ea(++_0x126d77);}(_0x1dc6,0xf3));var _0x61dc=function(_0x3db625,_0x3afd9c){_0x3db625=_0x3db625-0x0;var _0x358bd6=_0x1dc6[_0x3db625];return _0x358bd6;};'use strict';var _=require(_0x61dc('0x0'));var util=require(_0x61dc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x61dc('0x2'));var fs=require('fs');var Redis=require(_0x61dc('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x61dc('0x4'));var logger=require(_0x61dc('0x5'))('rpc');var config=require(_0x61dc('0x6'));var jayson=require(_0x61dc('0x7'));var client=jayson['client'][_0x61dc('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a317c,_0x57ba27,_0x4ccb1){return new BPromise(function(_0x1ef24e,_0x5be69b){return client[_0x61dc('0x9')](_0x4a317c,_0x4ccb1)[_0x61dc('0xa')](function(_0xc6135){logger[_0x61dc('0xb')](_0x61dc('0xc'),_0x57ba27,_0x61dc('0xd'));logger[_0x61dc('0xe')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x57ba27,'request\x20sent',JSON[_0x61dc('0xf')](_0xc6135));if(_0xc6135['error']){if(_0xc6135[_0x61dc('0x10')]['code']===0x1f4){logger[_0x61dc('0x10')](_0x61dc('0xc'),_0x57ba27,_0xc6135['error'][_0x61dc('0x11')]);return _0x5be69b(_0xc6135[_0x61dc('0x10')]['message']);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x57ba27,_0xc6135[_0x61dc('0x10')][_0x61dc('0x11')]);return _0x1ef24e(_0xc6135['error']['message']);}else{logger[_0x61dc('0xb')](_0x61dc('0xc'),_0x57ba27,_0x61dc('0xd'));_0x1ef24e(_0xc6135[_0x61dc('0x12')][_0x61dc('0x11')]);}})['catch'](function(_0x243952){logger['error'](_0x61dc('0xc'),_0x57ba27,_0x243952);_0x5be69b(_0x243952);});});} \ No newline at end of file +var _0x5cdc=['request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3bcbe2,_0x42bf6c){var _0x102cd0=function(_0x3b1d93){while(--_0x3b1d93){_0x3bcbe2['push'](_0x3bcbe2['shift']());}};_0x102cd0(++_0x42bf6c);}(_0x5cdc,0x154));var _0xc5cd=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0x5cdc[_0x420513];return _0x1b44ec;};'use strict';var _=require(_0xc5cd('0x0'));var util=require(_0xc5cd('0x1'));var moment=require(_0xc5cd('0x2'));var BPromise=require(_0xc5cd('0x3'));var rs=require(_0xc5cd('0x4'));var fs=require('fs');var Redis=require(_0xc5cd('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc5cd('0x6'))(_0xc5cd('0x7'));var config=require(_0xc5cd('0x8'));var jayson=require(_0xc5cd('0x9'));var client=jayson[_0xc5cd('0xa')][_0xc5cd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21e8ef,_0x4faebd,_0x6caf41){return new BPromise(function(_0x54f6ce,_0xee4933){return client[_0xc5cd('0xc')](_0x21e8ef,_0x6caf41)['then'](function(_0x38eb6b){logger[_0xc5cd('0xd')](_0xc5cd('0xe'),_0x4faebd,_0xc5cd('0xf'));logger['debug'](_0xc5cd('0x10'),_0x4faebd,'request\x20sent',JSON[_0xc5cd('0x11')](_0x38eb6b));if(_0x38eb6b[_0xc5cd('0x12')]){if(_0x38eb6b[_0xc5cd('0x12')]['code']===0x1f4){logger[_0xc5cd('0x12')](_0xc5cd('0xe'),_0x4faebd,_0x38eb6b[_0xc5cd('0x12')]['message']);return _0xee4933(_0x38eb6b[_0xc5cd('0x12')][_0xc5cd('0x13')]);}logger['error'](_0xc5cd('0xe'),_0x4faebd,_0x38eb6b[_0xc5cd('0x12')][_0xc5cd('0x13')]);return _0x54f6ce(_0x38eb6b[_0xc5cd('0x12')]['message']);}else{logger['info'](_0xc5cd('0xe'),_0x4faebd,_0xc5cd('0xf'));_0x54f6ce(_0x38eb6b[_0xc5cd('0x14')][_0xc5cd('0x13')]);}})[_0xc5cd('0x15')](function(_0x5b0f2b){logger['error'](_0xc5cd('0xe'),_0x4faebd,_0x5b0f2b);_0xee4933(_0x5b0f2b);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 0a1b3b3..c396cc5 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 _0xcc30=['get','index','/:id','isAuthenticated','/:id/download','download','post','create','put','update','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0xcc30,0x172));var _0x0cc3=function(_0x591e16,_0x5aefc1){_0x591e16=_0x591e16-0x0;var _0x543b35=_0xcc30[_0x591e16];return _0x543b35;};'use strict';var multer=require(_0x0cc3('0x0'));var util=require(_0x0cc3('0x1'));var path=require(_0x0cc3('0x2'));var timeout=require(_0x0cc3('0x3'));var express=require('express');var router=express[_0x0cc3('0x4')]();var fs_extra=require(_0x0cc3('0x5'));var auth=require(_0x0cc3('0x6'));var interaction=require(_0x0cc3('0x7'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x0cc3('0x8')]('/',auth['isAuthenticated'](),controller[_0x0cc3('0x9')]);router[_0x0cc3('0x8')](_0x0cc3('0xa'),auth[_0x0cc3('0xb')](),controller['show']);router['get'](_0x0cc3('0xc'),auth[_0x0cc3('0xb')](),controller[_0x0cc3('0xd')]);router[_0x0cc3('0xe')]('/',auth['isAuthenticated'](),controller[_0x0cc3('0xf')]);router[_0x0cc3('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x0cc3('0x11')]);router['delete'](_0x0cc3('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xed5e=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/download','/:id','update'];(function(_0x5e4476,_0x456500){var _0x374cb8=function(_0x4a1625){while(--_0x4a1625){_0x5e4476['push'](_0x5e4476['shift']());}};_0x374cb8(++_0x456500);}(_0xed5e,0x8f));var _0xeed5=function(_0x16dacd,_0x4d8722){_0x16dacd=_0x16dacd-0x0;var _0x1f8166=_0xed5e[_0x16dacd];return _0x1f8166;};'use strict';var multer=require(_0xeed5('0x0'));var util=require(_0xeed5('0x1'));var path=require(_0xeed5('0x2'));var timeout=require(_0xeed5('0x3'));var express=require(_0xeed5('0x4'));var router=express[_0xeed5('0x5')]();var fs_extra=require(_0xeed5('0x6'));var auth=require(_0xeed5('0x7'));var interaction=require(_0xeed5('0x8'));var config=require(_0xeed5('0x9'));var controller=require('./voiceMailMessage.controller');router[_0xeed5('0xa')]('/',auth[_0xeed5('0xb')](),controller[_0xeed5('0xc')]);router[_0xeed5('0xa')]('/:id',auth[_0xeed5('0xb')](),controller[_0xeed5('0xd')]);router['get'](_0xeed5('0xe'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xeed5('0xb')](),controller['create']);router['put'](_0xeed5('0xf'),auth[_0xeed5('0xb')](),controller[_0xeed5('0x10')]);router[_0xeed5('0x11')](_0xeed5('0xf'),auth[_0xeed5('0xb')](),controller[_0xeed5('0x12')]);module[_0xeed5('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 3d6002a..8516ef6 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 _0xec0f=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x4596a4,_0x1a0515){var _0x4c2894=function(_0x398cfc){while(--_0x398cfc){_0x4596a4['push'](_0x4596a4['shift']());}};_0x4c2894(++_0x1a0515);}(_0xec0f,0x80));var _0xfec0=function(_0x5d32ba,_0x26d47e){_0x5d32ba=_0x5d32ba-0x0;var _0x5e7be6=_0xec0f[_0x5d32ba];return _0x5e7be6;};'use strict';var Sequelize=require(_0xfec0('0x0'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5d13f1){return this[_0xfec0('0x1')]('id');}},'msgnum':{'type':Sequelize[_0xfec0('0x2')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xfec0('0x4')](_0xfec0('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xfec0('0x3')],'defaultValue':''},'stamp':{'type':_0xfec0('0x6'),'defaultValue':Sequelize[_0xfec0('0x7')](_0xfec0('0x8'))}}; \ No newline at end of file +var _0x30e1=['literal','sequelize','exports','getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x36f47c,_0x38ef4d){var _0x296c55=function(_0x403eec){while(--_0x403eec){_0x36f47c['push'](_0x36f47c['shift']());}};_0x296c55(++_0x38ef4d);}(_0x30e1,0x160));var _0x130e=function(_0x1793de,_0x4d7233){_0x1793de=_0x1793de-0x0;var _0x4f0309=_0x30e1[_0x1793de];return _0x4f0309;};'use strict';var Sequelize=require(_0x130e('0x0'));module[_0x130e('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x53bf00){return this[_0x130e('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x130e('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize['STRING'],'defaultValue':''},'context':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x130e('0x5')](_0x130e('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x130e('0x4')],'defaultValue':''},'stamp':{'type':_0x130e('0x7'),'defaultValue':Sequelize[_0x130e('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index b0baa8e..77c469e 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 _0xd1ea=['filters','intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','type','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','download','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','send','recording','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','save','update','then','destroy','stack','name','map','VoiceMailMessage','rawAttributes','model','differenceBy','query','keys'];(function(_0x568286,_0x1230df){var _0x3638f3=function(_0x20d354){while(--_0x20d354){_0x568286['push'](_0x568286['shift']());}};_0x3638f3(++_0x1230df);}(_0xd1ea,0x164));var _0xad1e=function(_0x248be1,_0x456ccd){_0x248be1=_0x248be1-0x0;var _0x1bdbde=_0xd1ea[_0x248be1];return _0x1bdbde;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad1e('0x0'));var rp=require(_0xad1e('0x1'));var moment=require(_0xad1e('0x2'));var BPromise=require(_0xad1e('0x3'));var Mustache=require(_0xad1e('0x4'));var util=require(_0xad1e('0x5'));var path=require(_0xad1e('0x6'));var sox=require(_0xad1e('0x7'));var csv=require(_0xad1e('0x8'));var ejs=require(_0xad1e('0x9'));var fs=require('fs');var fs_extra=require(_0xad1e('0xa'));var _=require(_0xad1e('0xb'));var squel=require(_0xad1e('0xc'));var crypto=require(_0xad1e('0xd'));var jsforce=require(_0xad1e('0xe'));var deskjs=require(_0xad1e('0xf'));var toCsv=require(_0xad1e('0x8'));var querystring=require('querystring');var Papa=require(_0xad1e('0x10'));var Redis=require(_0xad1e('0x11'));var authService=require(_0xad1e('0x12'));var qs=require(_0xad1e('0x13'));var as=require(_0xad1e('0x14'));var hardwareService=require(_0xad1e('0x15'));var logger=require(_0xad1e('0x16'))(_0xad1e('0x17'));var utils=require(_0xad1e('0x18'));var config=require(_0xad1e('0x19'));var licenseUtil=require(_0xad1e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5afd9b,_0x89e7b7){_0x89e7b7=_0x89e7b7||0xcc;return function(_0x4c700c){if(_0x4c700c){return _0x5afd9b[_0xad1e('0x1b')](_0x89e7b7);}return _0x5afd9b['status'](_0x89e7b7)[_0xad1e('0x1c')]();};}function respondWithResult(_0x482c1d,_0x167f8a){_0x167f8a=_0x167f8a||0xc8;return function(_0x2230ce){if(_0x2230ce){return _0x482c1d[_0xad1e('0x1d')](_0x167f8a)[_0xad1e('0x1e')](_0x2230ce);}};}function respondWithFilteredResult(_0x53456c,_0x211642){return function(_0x5935fc){if(_0x5935fc){var _0x2049d3=typeof _0x211642[_0xad1e('0x1f')]===_0xad1e('0x20')&&typeof _0x211642['limit']==='undefined';var _0x22f27b=_0x5935fc['count'];var _0x12f86e=_0x2049d3?0x0:_0x211642['offset'];var _0x3c6ec6=_0x2049d3?_0x5935fc['count']:_0x211642['offset']+_0x211642[_0xad1e('0x21')];var _0x3303b3;if(_0x3c6ec6>=_0x22f27b){_0x3c6ec6=_0x22f27b;_0x3303b3=0xc8;}else{_0x3303b3=0xce;}_0x53456c[_0xad1e('0x1d')](_0x3303b3);return _0x53456c[_0xad1e('0x22')](_0xad1e('0x23'),_0x12f86e+'-'+_0x3c6ec6+'/'+_0x22f27b)[_0xad1e('0x1e')](_0x5935fc);}return null;};}function patchUpdates(_0x5152c5){return function(_0x1a85bd){try{jsonpatch['apply'](_0x1a85bd,_0x5152c5,!![]);}catch(_0x15ce11){return BPromise['reject'](_0x15ce11);}return _0x1a85bd[_0xad1e('0x24')]();};}function saveUpdates(_0x1954e6,_0xa7f833){return function(_0x2930f6){if(_0x2930f6){return _0x2930f6[_0xad1e('0x25')](_0x1954e6)[_0xad1e('0x26')](function(_0x26f8c1){return _0x26f8c1;});}return null;};}function removeEntity(_0x44298f,_0x7663f4){return function(_0x1f9e8f){if(_0x1f9e8f){return _0x1f9e8f[_0xad1e('0x27')]()[_0xad1e('0x26')](function(){_0x44298f[_0xad1e('0x1d')](0xcc)[_0xad1e('0x1c')]();});}};}function handleEntityNotFound(_0x1c7257,_0x4169c5){return function(_0x1c5e69){if(!_0x1c5e69){_0x1c7257[_0xad1e('0x1b')](0x194);}return _0x1c5e69;};}function handleError(_0x44a247,_0x16b41){_0x16b41=_0x16b41||0x1f4;return function(_0x17a706){logger['error'](_0x17a706[_0xad1e('0x28')]);if(_0x17a706['name']){delete _0x17a706[_0xad1e('0x29')];}_0x44a247[_0xad1e('0x1d')](_0x16b41)['send'](_0x17a706);};}exports['index']=function(_0x3c355a,_0x5e005f){var _0x6e5c71={},_0x2b1fab={},_0x1219c2={'count':0x0,'rows':[]};var _0x38cb75=_[_0xad1e('0x2a')](db[_0xad1e('0x2b')][_0xad1e('0x2c')],function(_0x4c96f2){return{'name':_0x4c96f2['fieldName'],'type':_0x4c96f2['type']['key']};});_0x2b1fab[_0xad1e('0x2d')]=_[_0xad1e('0x2e')](_['map'](_0x38cb75,'name'),['name']);_0x2b1fab[_0xad1e('0x2f')]=_[_0xad1e('0x30')](_0x3c355a[_0xad1e('0x2f')]);_0x2b1fab[_0xad1e('0x31')]=_[_0xad1e('0x32')](_0x2b1fab[_0xad1e('0x2d')],_0x2b1fab[_0xad1e('0x2f')]);_0x6e5c71[_0xad1e('0x33')]=_[_0xad1e('0x32')](_0x2b1fab[_0xad1e('0x2d')],qs['fields'](_0x3c355a['query'][_0xad1e('0x34')]));_0x6e5c71['attributes']=_0x6e5c71[_0xad1e('0x33')][_0xad1e('0x35')]?_0x6e5c71['attributes']:_0x2b1fab[_0xad1e('0x2d')];if(!_0x3c355a[_0xad1e('0x2f')]['hasOwnProperty'](_0xad1e('0x36'))){_0x6e5c71['limit']=qs['limit'](_0x3c355a['query'][_0xad1e('0x21')]);_0x6e5c71[_0xad1e('0x1f')]=qs[_0xad1e('0x1f')](_0x3c355a['query'][_0xad1e('0x1f')]);}_0x6e5c71[_0xad1e('0x37')]=qs[_0xad1e('0x38')](_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x38')]);_0x6e5c71['where']=qs[_0xad1e('0x31')](_['pick'](_0x3c355a[_0xad1e('0x2f')],_0x2b1fab[_0xad1e('0x31')]),_0x38cb75);if(_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x39')]){_0x6e5c71[_0xad1e('0x3a')]=_[_0xad1e('0x3b')](_0x6e5c71[_0xad1e('0x3a')],{'$or':_[_0xad1e('0x2a')](_0x38cb75,function(_0x506d9c){if(_0x506d9c[_0xad1e('0x3c')]!=='VIRTUAL'){var _0x452033={};_0x452033[_0x506d9c[_0xad1e('0x29')]]={'$like':'%'+_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x39')]+'%'};return _0x452033;}})});}_0x6e5c71=_['merge']({},_0x6e5c71,_0x3c355a[_0xad1e('0x3d')]);var _0x3ef7d5={'where':_0x6e5c71[_0xad1e('0x3a')]};return db[_0xad1e('0x2b')]['count'](_0x3ef7d5)[_0xad1e('0x26')](function(_0x5ed87d){_0x1219c2[_0xad1e('0x3e')]=_0x5ed87d;if(_0x3c355a[_0xad1e('0x2f')][_0xad1e('0x3f')]){_0x6e5c71[_0xad1e('0x40')]=[{'all':!![]}];}return db[_0xad1e('0x2b')][_0xad1e('0x41')](_0x6e5c71);})['then'](function(_0x54a5a9){_0x1219c2[_0xad1e('0x42')]=_0x54a5a9;return _0x1219c2;})[_0xad1e('0x26')](respondWithFilteredResult(_0x5e005f,_0x6e5c71))[_0xad1e('0x43')](handleError(_0x5e005f,null));};exports['show']=function(_0x2c9f3d,_0x55ee9e){var _0x3bc7b6={'raw':!![],'where':{'id':_0x2c9f3d[_0xad1e('0x44')]['id']}},_0x2ce7ca={};_0x2ce7ca[_0xad1e('0x2d')]=_[_0xad1e('0x30')](db['VoiceMailMessage'][_0xad1e('0x2c')]);_0x2ce7ca[_0xad1e('0x2f')]=_[_0xad1e('0x30')](_0x2c9f3d['query']);_0x2ce7ca[_0xad1e('0x31')]=_[_0xad1e('0x32')](_0x2ce7ca[_0xad1e('0x2d')],_0x2ce7ca[_0xad1e('0x2f')]);_0x3bc7b6['attributes']=_[_0xad1e('0x32')](_0x2ce7ca[_0xad1e('0x2d')],qs['fields'](_0x2c9f3d[_0xad1e('0x2f')]['fields']));_0x3bc7b6[_0xad1e('0x33')]=_0x3bc7b6[_0xad1e('0x33')][_0xad1e('0x35')]?_0x3bc7b6[_0xad1e('0x33')]:_0x2ce7ca[_0xad1e('0x2d')];if(_0x2c9f3d[_0xad1e('0x2f')][_0xad1e('0x3f')]){_0x3bc7b6[_0xad1e('0x40')]=[{'all':!![]}];}_0x3bc7b6=_[_0xad1e('0x3b')]({},_0x3bc7b6,_0x2c9f3d[_0xad1e('0x3d')]);return db[_0xad1e('0x2b')][_0xad1e('0x45')](_0x3bc7b6)['then'](handleEntityNotFound(_0x55ee9e,null))[_0xad1e('0x26')](respondWithResult(_0x55ee9e,null))[_0xad1e('0x43')](handleError(_0x55ee9e,null));};exports['create']=function(_0x4e9ed1,_0x5c6010){return db[_0xad1e('0x2b')][_0xad1e('0x46')](_0x4e9ed1[_0xad1e('0x47')],{})['then'](respondWithResult(_0x5c6010,0xc9))[_0xad1e('0x43')](handleError(_0x5c6010,null));};exports['update']=function(_0x365c66,_0x1129b2){if(_0x365c66[_0xad1e('0x47')]['id']){delete _0x365c66['body']['id'];}return db[_0xad1e('0x2b')][_0xad1e('0x45')]({'where':{'id':_0x365c66[_0xad1e('0x44')]['id']}})[_0xad1e('0x26')](handleEntityNotFound(_0x1129b2,null))[_0xad1e('0x26')](saveUpdates(_0x365c66[_0xad1e('0x47')],null))['then'](respondWithResult(_0x1129b2,null))[_0xad1e('0x43')](handleError(_0x1129b2,null));};exports['destroy']=function(_0x5045d7,_0x12c39f){return db[_0xad1e('0x2b')][_0xad1e('0x45')]({'where':{'id':_0x5045d7[_0xad1e('0x44')]['id']}})[_0xad1e('0x26')](handleEntityNotFound(_0x12c39f,null))[_0xad1e('0x26')](removeEntity(_0x12c39f,null))[_0xad1e('0x43')](handleError(_0x12c39f,null));};exports[_0xad1e('0x48')]=function(_0x157efb,_0x19a1ae,_0x3f7cf1){return db[_0xad1e('0x2b')][_0xad1e('0x45')]({'where':{'id':_0x157efb[_0xad1e('0x44')]['id']},'attributes':['id','recording',_0xad1e('0x49')]})['then'](handleEntityNotFound(_0x19a1ae,null))[_0xad1e('0x26')](function(_0x4dc496){if(_0x4dc496){if(!_0x4dc496['recording']){throw new db[(_0xad1e('0x4a'))][(_0xad1e('0x4b'))](_0xad1e('0x4c'));}var _0x55455d={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x4dc496[_0xad1e('0x49')]){_0x55455d[_0xad1e('0x4d')]=_0xad1e('0x4e')+_0x4dc496[_0xad1e('0x49')]+'.wav\x22';}_0x19a1ae[_0xad1e('0x22')](_0x55455d);return _0x19a1ae[_0xad1e('0x4f')](new Buffer(_0x4dc496[_0xad1e('0x50')]));}})[_0xad1e('0x43')](handleError(_0x19a1ae,null));}; \ No newline at end of file +var _0x6de1=['map','VoiceMailMessage','rawAttributes','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','download','msg_id','recording','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','count','status','set','reject','save','update','then','destroy','error','stack','name','send','index'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x6de1,0xd4));var _0x16de=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x6de1[_0x212a37];return _0x5d0bf9;};'use strict';var emlformat=require(_0x16de('0x0'));var rimraf=require(_0x16de('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x16de('0x2'));var rp=require(_0x16de('0x3'));var moment=require(_0x16de('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x16de('0x5'));var util=require(_0x16de('0x6'));var path=require(_0x16de('0x7'));var sox=require(_0x16de('0x8'));var csv=require(_0x16de('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x16de('0xa'));var _=require(_0x16de('0xb'));var squel=require(_0x16de('0xc'));var crypto=require(_0x16de('0xd'));var jsforce=require(_0x16de('0xe'));var deskjs=require(_0x16de('0xf'));var toCsv=require(_0x16de('0x9'));var querystring=require('querystring');var Papa=require(_0x16de('0x10'));var Redis=require(_0x16de('0x11'));var authService=require(_0x16de('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x16de('0x13'));var logger=require(_0x16de('0x14'))(_0x16de('0x15'));var utils=require(_0x16de('0x16'));var config=require(_0x16de('0x17'));var licenseUtil=require(_0x16de('0x18'));var db=require(_0x16de('0x19'))['db'];function respondWithStatusCode(_0x2f0d12,_0x2ae853){_0x2ae853=_0x2ae853||0xcc;return function(_0x2f6c3c){if(_0x2f6c3c){return _0x2f0d12[_0x16de('0x1a')](_0x2ae853);}return _0x2f0d12['status'](_0x2ae853)[_0x16de('0x1b')]();};}function respondWithResult(_0x262086,_0x5eede8){_0x5eede8=_0x5eede8||0xc8;return function(_0x1f5da6){if(_0x1f5da6){return _0x262086['status'](_0x5eede8)[_0x16de('0x1c')](_0x1f5da6);}};}function respondWithFilteredResult(_0x304f4e,_0x2e15c3){return function(_0x2048f3){if(_0x2048f3){var _0x11c058=typeof _0x2e15c3[_0x16de('0x1d')]==='undefined'&&typeof _0x2e15c3['limit']==='undefined';var _0x430724=_0x2048f3[_0x16de('0x1e')];var _0x111e35=_0x11c058?0x0:_0x2e15c3[_0x16de('0x1d')];var _0x2f67a4=_0x11c058?_0x2048f3[_0x16de('0x1e')]:_0x2e15c3[_0x16de('0x1d')]+_0x2e15c3['limit'];var _0x2aaaaf;if(_0x2f67a4>=_0x430724){_0x2f67a4=_0x430724;_0x2aaaaf=0xc8;}else{_0x2aaaaf=0xce;}_0x304f4e[_0x16de('0x1f')](_0x2aaaaf);return _0x304f4e[_0x16de('0x20')]('Content-Range',_0x111e35+'-'+_0x2f67a4+'/'+_0x430724)[_0x16de('0x1c')](_0x2048f3);}return null;};}function patchUpdates(_0x2536e5){return function(_0xb690dc){try{jsonpatch['apply'](_0xb690dc,_0x2536e5,!![]);}catch(_0x51e3df){return BPromise[_0x16de('0x21')](_0x51e3df);}return _0xb690dc[_0x16de('0x22')]();};}function saveUpdates(_0x569b55,_0x2da1d9){return function(_0x11b8f2){if(_0x11b8f2){return _0x11b8f2[_0x16de('0x23')](_0x569b55)[_0x16de('0x24')](function(_0x53fd69){return _0x53fd69;});}return null;};}function removeEntity(_0x5c8fd4,_0x5c5109){return function(_0x3a93f6){if(_0x3a93f6){return _0x3a93f6[_0x16de('0x25')]()['then'](function(){_0x5c8fd4['status'](0xcc)[_0x16de('0x1b')]();});}};}function handleEntityNotFound(_0x116cfa,_0x1ffe79){return function(_0x4e6370){if(!_0x4e6370){_0x116cfa['sendStatus'](0x194);}return _0x4e6370;};}function handleError(_0x219419,_0x2abdc5){_0x2abdc5=_0x2abdc5||0x1f4;return function(_0xa0128d){logger[_0x16de('0x26')](_0xa0128d[_0x16de('0x27')]);if(_0xa0128d[_0x16de('0x28')]){delete _0xa0128d[_0x16de('0x28')];}_0x219419[_0x16de('0x1f')](_0x2abdc5)[_0x16de('0x29')](_0xa0128d);};}exports[_0x16de('0x2a')]=function(_0x173407,_0x55663b){var _0x4f1549={},_0x41a8dd={},_0x35b038={'count':0x0,'rows':[]};var _0x302730=_[_0x16de('0x2b')](db[_0x16de('0x2c')][_0x16de('0x2d')],function(_0x2c335c){return{'name':_0x2c335c['fieldName'],'type':_0x2c335c['type'][_0x16de('0x2e')]};});_0x41a8dd[_0x16de('0x2f')]=_[_0x16de('0x30')](_[_0x16de('0x2b')](_0x302730,_0x16de('0x28')),[_0x16de('0x28')]);_0x41a8dd[_0x16de('0x31')]=_[_0x16de('0x32')](_0x173407[_0x16de('0x31')]);_0x41a8dd[_0x16de('0x33')]=_[_0x16de('0x34')](_0x41a8dd[_0x16de('0x2f')],_0x41a8dd[_0x16de('0x31')]);_0x4f1549[_0x16de('0x35')]=_['intersection'](_0x41a8dd['model'],qs[_0x16de('0x36')](_0x173407[_0x16de('0x31')]['fields']));_0x4f1549[_0x16de('0x35')]=_0x4f1549[_0x16de('0x35')][_0x16de('0x37')]?_0x4f1549[_0x16de('0x35')]:_0x41a8dd[_0x16de('0x2f')];if(!_0x173407[_0x16de('0x31')][_0x16de('0x38')](_0x16de('0x39'))){_0x4f1549[_0x16de('0x3a')]=qs['limit'](_0x173407[_0x16de('0x31')][_0x16de('0x3a')]);_0x4f1549['offset']=qs[_0x16de('0x1d')](_0x173407[_0x16de('0x31')][_0x16de('0x1d')]);}_0x4f1549[_0x16de('0x3b')]=qs[_0x16de('0x3c')](_0x173407[_0x16de('0x31')][_0x16de('0x3c')]);_0x4f1549[_0x16de('0x3d')]=qs[_0x16de('0x33')](_[_0x16de('0x3e')](_0x173407['query'],_0x41a8dd[_0x16de('0x33')]),_0x302730);if(_0x173407[_0x16de('0x31')][_0x16de('0x3f')]){_0x4f1549[_0x16de('0x3d')]=_[_0x16de('0x40')](_0x4f1549[_0x16de('0x3d')],{'$or':_[_0x16de('0x2b')](_0x302730,function(_0x500c80){if(_0x500c80[_0x16de('0x41')]!==_0x16de('0x42')){var _0x483ec2={};_0x483ec2[_0x500c80[_0x16de('0x28')]]={'$like':'%'+_0x173407[_0x16de('0x31')][_0x16de('0x3f')]+'%'};return _0x483ec2;}})});}_0x4f1549=_[_0x16de('0x40')]({},_0x4f1549,_0x173407[_0x16de('0x43')]);var _0x3720db={'where':_0x4f1549[_0x16de('0x3d')]};return db[_0x16de('0x2c')][_0x16de('0x1e')](_0x3720db)[_0x16de('0x24')](function(_0x37806d){_0x35b038[_0x16de('0x1e')]=_0x37806d;if(_0x173407[_0x16de('0x31')][_0x16de('0x44')]){_0x4f1549['include']=[{'all':!![]}];}return db[_0x16de('0x2c')][_0x16de('0x45')](_0x4f1549);})[_0x16de('0x24')](function(_0x168194){_0x35b038[_0x16de('0x46')]=_0x168194;return _0x35b038;})[_0x16de('0x24')](respondWithFilteredResult(_0x55663b,_0x4f1549))[_0x16de('0x47')](handleError(_0x55663b,null));};exports[_0x16de('0x48')]=function(_0x53dae1,_0x3783ff){var _0x221b4d={'raw':!![],'where':{'id':_0x53dae1[_0x16de('0x49')]['id']}},_0x2acc52={};_0x2acc52[_0x16de('0x2f')]=_[_0x16de('0x32')](db['VoiceMailMessage'][_0x16de('0x2d')]);_0x2acc52[_0x16de('0x31')]=_[_0x16de('0x32')](_0x53dae1[_0x16de('0x31')]);_0x2acc52[_0x16de('0x33')]=_[_0x16de('0x34')](_0x2acc52[_0x16de('0x2f')],_0x2acc52['query']);_0x221b4d['attributes']=_[_0x16de('0x34')](_0x2acc52[_0x16de('0x2f')],qs['fields'](_0x53dae1['query']['fields']));_0x221b4d[_0x16de('0x35')]=_0x221b4d[_0x16de('0x35')]['length']?_0x221b4d['attributes']:_0x2acc52[_0x16de('0x2f')];if(_0x53dae1[_0x16de('0x31')][_0x16de('0x44')]){_0x221b4d[_0x16de('0x4a')]=[{'all':!![]}];}_0x221b4d=_[_0x16de('0x40')]({},_0x221b4d,_0x53dae1[_0x16de('0x43')]);return db[_0x16de('0x2c')][_0x16de('0x4b')](_0x221b4d)['then'](handleEntityNotFound(_0x3783ff,null))[_0x16de('0x24')](respondWithResult(_0x3783ff,null))[_0x16de('0x47')](handleError(_0x3783ff,null));};exports[_0x16de('0x4c')]=function(_0x32be2e,_0x41c32f){return db[_0x16de('0x2c')][_0x16de('0x4c')](_0x32be2e['body'],{})[_0x16de('0x24')](respondWithResult(_0x41c32f,0xc9))[_0x16de('0x47')](handleError(_0x41c32f,null));};exports[_0x16de('0x23')]=function(_0x591ef0,_0x4102e0){if(_0x591ef0[_0x16de('0x4d')]['id']){delete _0x591ef0[_0x16de('0x4d')]['id'];}return db[_0x16de('0x2c')]['find']({'where':{'id':_0x591ef0[_0x16de('0x49')]['id']}})['then'](handleEntityNotFound(_0x4102e0,null))[_0x16de('0x24')](saveUpdates(_0x591ef0[_0x16de('0x4d')],null))['then'](respondWithResult(_0x4102e0,null))[_0x16de('0x47')](handleError(_0x4102e0,null));};exports[_0x16de('0x25')]=function(_0x14e668,_0x58e6e7){return db[_0x16de('0x2c')][_0x16de('0x4b')]({'where':{'id':_0x14e668[_0x16de('0x49')]['id']}})[_0x16de('0x24')](handleEntityNotFound(_0x58e6e7,null))['then'](removeEntity(_0x58e6e7,null))[_0x16de('0x47')](handleError(_0x58e6e7,null));};exports[_0x16de('0x4e')]=function(_0x3d6e43,_0x36938e,_0x13e79a){return db[_0x16de('0x2c')][_0x16de('0x4b')]({'where':{'id':_0x3d6e43[_0x16de('0x49')]['id']},'attributes':['id','recording',_0x16de('0x4f')]})[_0x16de('0x24')](handleEntityNotFound(_0x36938e,null))['then'](function(_0x5c5050){if(_0x5c5050){if(!_0x5c5050[_0x16de('0x50')]){throw new db['Sequelize'][(_0x16de('0x51'))](_0x16de('0x52'));}var _0x4e0e00={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5c5050[_0x16de('0x4f')]){_0x4e0e00[_0x16de('0x53')]=_0x16de('0x54')+_0x5c5050[_0x16de('0x4f')]+'.wav\x22';}_0x36938e[_0x16de('0x20')](_0x4e0e00);return _0x36938e[_0x16de('0x29')](new Buffer(_0x5c5050[_0x16de('0x50')]));}})[_0x16de('0x47')](handleError(_0x36938e,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 8de7d75..ae73916 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 _0xd827=['./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x57ebed,_0xfac0ac){var _0x3a0874=function(_0x271491){while(--_0x271491){_0x57ebed['push'](_0x57ebed['shift']());}};_0x3a0874(++_0xfac0ac);}(_0xd827,0x76));var _0x7d82=function(_0x25d6ce,_0x30d64a){_0x25d6ce=_0x25d6ce-0x0;var _0x1aef15=_0xd827[_0x25d6ce];return _0x1aef15;};'use strict';var _=require(_0x7d82('0x0'));var util=require(_0x7d82('0x1'));var logger=require('../../config/logger')(_0x7d82('0x2'));var moment=require(_0x7d82('0x3'));var BPromise=require(_0x7d82('0x4'));var rp=require(_0x7d82('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7d82('0x6'));var config=require(_0x7d82('0x7'));var attributes=require(_0x7d82('0x8'));module[_0x7d82('0x9')]=function(_0x1c955d,_0x2c5d91){return _0x1c955d[_0x7d82('0xa')](_0x7d82('0xb'),attributes,{'tableName':_0x7d82('0xc'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x7d82('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x5da6=['request-promise','rimraf','../../config/environment','./voiceMailMessage.attributes','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment'];(function(_0x35ed1a,_0x57d996){var _0x12f640=function(_0xb1fef2){while(--_0xb1fef2){_0x35ed1a['push'](_0x35ed1a['shift']());}};_0x12f640(++_0x57d996);}(_0x5da6,0x124));var _0x65da=function(_0x5d1696,_0x1a2f5b){_0x5d1696=_0x5d1696-0x0;var _0x49d673=_0x5da6[_0x5d1696];return _0x49d673;};'use strict';var _=require(_0x65da('0x0'));var util=require(_0x65da('0x1'));var logger=require(_0x65da('0x2'))(_0x65da('0x3'));var moment=require(_0x65da('0x4'));var BPromise=require('bluebird');var rp=require(_0x65da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x65da('0x6'));var config=require(_0x65da('0x7'));var attributes=require(_0x65da('0x8'));module['exports']=function(_0x77ba9c,_0x19e757){return _0x77ba9c['define']('VoiceMailMessage',attributes,{'tableName':_0x65da('0x9'),'paranoid':![],'indexes':[{'name':_0x65da('0xa'),'fields':[_0x65da('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d9f5894..0cbd4ff 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 _0x1be2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceMailMessage,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x33dad6,_0x708206){var _0x240c8c=function(_0x5caf57){while(--_0x5caf57){_0x33dad6['push'](_0x33dad6['shift']());}};_0x240c8c(++_0x708206);}(_0x1be2,0x12a));var _0x21be=function(_0x301c11,_0x43f7ef){_0x301c11=_0x301c11-0x0;var _0x22994b=_0x1be2[_0x301c11];return _0x22994b;};'use strict';var _=require(_0x21be('0x0'));var util=require(_0x21be('0x1'));var moment=require('moment');var BPromise=require(_0x21be('0x2'));var rs=require(_0x21be('0x3'));var fs=require('fs');var Redis=require(_0x21be('0x4'));var db=require(_0x21be('0x5'))['db'];var utils=require(_0x21be('0x6'));var logger=require(_0x21be('0x7'))(_0x21be('0x8'));var config=require(_0x21be('0x9'));var jayson=require(_0x21be('0xa'));var client=jayson[_0x21be('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x426463,_0x2f8a72,_0x138bda){return new BPromise(function(_0x2d86bf,_0x49b453){return client[_0x21be('0xc')](_0x426463,_0x138bda)[_0x21be('0xd')](function(_0x5a94ae){logger[_0x21be('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f8a72,_0x21be('0xf'));logger[_0x21be('0x10')](_0x21be('0x11'),_0x2f8a72,_0x21be('0xf'),JSON[_0x21be('0x12')](_0x5a94ae));if(_0x5a94ae[_0x21be('0x13')]){if(_0x5a94ae[_0x21be('0x13')][_0x21be('0x14')]===0x1f4){logger[_0x21be('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x2f8a72,_0x5a94ae['error'][_0x21be('0x15')]);return _0x49b453(_0x5a94ae[_0x21be('0x13')][_0x21be('0x15')]);}logger[_0x21be('0x13')](_0x21be('0x16'),_0x2f8a72,_0x5a94ae[_0x21be('0x13')][_0x21be('0x15')]);return _0x2d86bf(_0x5a94ae[_0x21be('0x13')][_0x21be('0x15')]);}else{logger[_0x21be('0xe')](_0x21be('0x16'),_0x2f8a72,_0x21be('0xf'));_0x2d86bf(_0x5a94ae[_0x21be('0x17')][_0x21be('0x15')]);}})[_0x21be('0x18')](function(_0x465ccf){logger[_0x21be('0x13')](_0x21be('0x16'),_0x2f8a72,_0x465ccf);_0x49b453(_0x465ccf);});});} \ No newline at end of file +var _0x8b69=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3c0583,_0x406a6d){var _0x2ec458=function(_0x574725){while(--_0x574725){_0x3c0583['push'](_0x3c0583['shift']());}};_0x2ec458(++_0x406a6d);}(_0x8b69,0x1e6));var _0x98b6=function(_0x22cebb,_0x3265e2){_0x22cebb=_0x22cebb-0x0;var _0x32f4cd=_0x8b69[_0x22cebb];return _0x32f4cd;};'use strict';var _=require('lodash');var util=require(_0x98b6('0x0'));var moment=require(_0x98b6('0x1'));var BPromise=require(_0x98b6('0x2'));var rs=require(_0x98b6('0x3'));var fs=require('fs');var Redis=require(_0x98b6('0x4'));var db=require(_0x98b6('0x5'))['db'];var utils=require(_0x98b6('0x6'));var logger=require(_0x98b6('0x7'))('rpc');var config=require(_0x98b6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x98b6('0x9')][_0x98b6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fcddc,_0x4946f1,_0x3c5509){return new BPromise(function(_0x31055a,_0x27e8c8){return client[_0x98b6('0xb')](_0x3fcddc,_0x3c5509)[_0x98b6('0xc')](function(_0x44316e){logger[_0x98b6('0xd')](_0x98b6('0xe'),_0x4946f1,_0x98b6('0xf'));logger['debug']('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x4946f1,_0x98b6('0xf'),JSON[_0x98b6('0x10')](_0x44316e));if(_0x44316e[_0x98b6('0x11')]){if(_0x44316e[_0x98b6('0x11')][_0x98b6('0x12')]===0x1f4){logger[_0x98b6('0x11')](_0x98b6('0xe'),_0x4946f1,_0x44316e[_0x98b6('0x11')][_0x98b6('0x13')]);return _0x27e8c8(_0x44316e[_0x98b6('0x11')][_0x98b6('0x13')]);}logger['error'](_0x98b6('0xe'),_0x4946f1,_0x44316e[_0x98b6('0x11')][_0x98b6('0x13')]);return _0x31055a(_0x44316e[_0x98b6('0x11')]['message']);}else{logger['info'](_0x98b6('0xe'),_0x4946f1,'request\x20sent');_0x31055a(_0x44316e[_0x98b6('0x14')]['message']);}})[_0x98b6('0x15')](function(_0x5704a9){logger['error'](_0x98b6('0xe'),_0x4946f1,_0x5704a9);_0x27e8c8(_0x5704a9);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index f2b65b1..85a4b1a 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 _0xd7a5=['removeSound','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','post','create','addSound','put','delete','destroy','/:id/sounds/:id2'];(function(_0x4bb32f,_0x2217e){var _0x2dd6e6=function(_0x28cd57){while(--_0x28cd57){_0x4bb32f['push'](_0x4bb32f['shift']());}};_0x2dd6e6(++_0x2217e);}(_0xd7a5,0x182));var _0x5d7a=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0xd7a5[_0x386525];return _0x14d015;};'use strict';var multer=require(_0x5d7a('0x0'));var util=require(_0x5d7a('0x1'));var path=require(_0x5d7a('0x2'));var timeout=require(_0x5d7a('0x3'));var express=require(_0x5d7a('0x4'));var router=express[_0x5d7a('0x5')]();var fs_extra=require(_0x5d7a('0x6'));var auth=require(_0x5d7a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5d7a('0x8'));var controller=require('./voiceMusicOnHold.controller');router[_0x5d7a('0x9')]('/',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xb')]);router[_0x5d7a('0x9')](_0x5d7a('0xc'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0xd')]);router['get'](_0x5d7a('0xe'),auth[_0x5d7a('0xa')](),controller['getSounds']);router[_0x5d7a('0xf')]('/',auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x10')]);router[_0x5d7a('0xf')](_0x5d7a('0xe'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x11')]);router[_0x5d7a('0x12')](_0x5d7a('0xc'),auth[_0x5d7a('0xa')](),controller['update']);router[_0x5d7a('0x13')](_0x5d7a('0xc'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x14')]);router[_0x5d7a('0x13')](_0x5d7a('0x15'),auth[_0x5d7a('0xa')](),controller[_0x5d7a('0x16')]);module[_0x5d7a('0x17')]=router; \ No newline at end of file +var _0xfcea=['destroy','/:id/sounds/:id2','removeSound','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMusicOnHold.controller','isAuthenticated','/:id','show','get','/:id/sounds','getSounds','post','addSound','put','update','delete'];(function(_0x28e4ec,_0x22f691){var _0x161a64=function(_0x4214c6){while(--_0x4214c6){_0x28e4ec['push'](_0x28e4ec['shift']());}};_0x161a64(++_0x22f691);}(_0xfcea,0x1b9));var _0xafce=function(_0x2b72fe,_0x5b98b0){_0x2b72fe=_0x2b72fe-0x0;var _0x463d0a=_0xfcea[_0x2b72fe];return _0x463d0a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xafce('0x0'));var timeout=require(_0xafce('0x1'));var express=require(_0xafce('0x2'));var router=express[_0xafce('0x3')]();var fs_extra=require(_0xafce('0x4'));var auth=require(_0xafce('0x5'));var interaction=require(_0xafce('0x6'));var config=require('../../config/environment');var controller=require(_0xafce('0x7'));router['get']('/',auth[_0xafce('0x8')](),controller['index']);router['get'](_0xafce('0x9'),auth[_0xafce('0x8')](),controller[_0xafce('0xa')]);router[_0xafce('0xb')](_0xafce('0xc'),auth[_0xafce('0x8')](),controller[_0xafce('0xd')]);router[_0xafce('0xe')]('/',auth[_0xafce('0x8')](),controller['create']);router['post'](_0xafce('0xc'),auth[_0xafce('0x8')](),controller[_0xafce('0xf')]);router[_0xafce('0x10')](_0xafce('0x9'),auth['isAuthenticated'](),controller[_0xafce('0x11')]);router[_0xafce('0x12')](_0xafce('0x9'),auth[_0xafce('0x8')](),controller[_0xafce('0x13')]);router[_0xafce('0x12')](_0xafce('0x14'),auth[_0xafce('0x8')](),controller[_0xafce('0x15')]);module[_0xafce('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index a3e5a3b..6d4b5d7 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 _0x971c=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','exports','STRING','name','ENUM','files','quietmp3nb'];(function(_0x3b34cf,_0x153318){var _0x2c91e1=function(_0x42969b){while(--_0x42969b){_0x3b34cf['push'](_0x3b34cf['shift']());}};_0x2c91e1(++_0x153318);}(_0x971c,0x7e));var _0xc971=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x971c[_0xbca1b1];return _0x4e1686;};'use strict';var Sequelize=require('sequelize');module[_0xc971('0x0')]={'name':{'type':Sequelize[_0xc971('0x1')],'allowNull':![],'unique':_0xc971('0x2')},'mode':{'type':Sequelize[_0xc971('0x3')]('custom',_0xc971('0x4'),'mp3nb',_0xc971('0x5'),_0xc971('0x6'),_0xc971('0x7')),'allowNull':!![],'defaultValue':_0xc971('0x4')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xc971('0x1')],'allowNull':!![]},'digit':{'type':Sequelize[_0xc971('0x1')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc971('0x8')},'format':{'type':Sequelize[_0xc971('0x1')],'allowNull':!![]},'stamp':{'type':_0xc971('0x9')},'defaultEntry':{'type':Sequelize[_0xc971('0xa')],'defaultValue':0x0}}; \ No newline at end of file +var _0x93dd=['exports','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3','TIMESTAMP','BOOLEAN','sequelize'];(function(_0x247b5e,_0x4e0735){var _0x281873=function(_0x36e0ed){while(--_0x36e0ed){_0x247b5e['push'](_0x247b5e['shift']());}};_0x281873(++_0x4e0735);}(_0x93dd,0x173));var _0xd93d=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x93dd[_0xa148b7];return _0x51efd3;};'use strict';var Sequelize=require(_0xd93d('0x0'));module[_0xd93d('0x1')]={'name':{'type':Sequelize[_0xd93d('0x2')],'allowNull':![],'unique':_0xd93d('0x3')},'mode':{'type':Sequelize[_0xd93d('0x4')](_0xd93d('0x5'),_0xd93d('0x6'),'mp3nb',_0xd93d('0x7'),_0xd93d('0x8'),_0xd93d('0x9')),'allowNull':!![],'defaultValue':_0xd93d('0x6')},'directory':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xd93d('0x2')],'allowNull':!![]},'stamp':{'type':_0xd93d('0xa')},'defaultEntry':{'type':Sequelize[_0xd93d('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index a11eb1b..99cb6a7 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 _0x44eb=['../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','get','MusicOnHolds','UserProfileResource','stack','name','send','index','map','VoiceMusicOnHold','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','update','body','create','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','forEach','unlinkSync','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','Sequelize','removeSound','id2','ValidationError','getSounds','order','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x44eb,0x1bd));var _0xb44e=function(_0x2ddf0c,_0x134849){_0x2ddf0c=_0x2ddf0c-0x0;var _0x1cb3d2=_0x44eb[_0x2ddf0c];return _0x1cb3d2;};'use strict';var emlformat=require(_0xb44e('0x0'));var rimraf=require(_0xb44e('0x1'));var zipdir=require(_0xb44e('0x2'));var jsonpatch=require(_0xb44e('0x3'));var rp=require(_0xb44e('0x4'));var moment=require(_0xb44e('0x5'));var BPromise=require(_0xb44e('0x6'));var Mustache=require(_0xb44e('0x7'));var util=require(_0xb44e('0x8'));var path=require(_0xb44e('0x9'));var sox=require('sox');var csv=require(_0xb44e('0xa'));var ejs=require(_0xb44e('0xb'));var fs=require('fs');var fs_extra=require(_0xb44e('0xc'));var _=require(_0xb44e('0xd'));var squel=require(_0xb44e('0xe'));var crypto=require(_0xb44e('0xf'));var jsforce=require(_0xb44e('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xb44e('0xa'));var querystring=require(_0xb44e('0x11'));var Papa=require('papaparse');var Redis=require(_0xb44e('0x12'));var authService=require(_0xb44e('0x13'));var qs=require(_0xb44e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb44e('0x15'));var utils=require('../../config/utils');var config=require(_0xb44e('0x16'));var licenseUtil=require(_0xb44e('0x17'));var db=require(_0xb44e('0x18'))['db'];function respondWithStatusCode(_0x36b437,_0x518eb0){_0x518eb0=_0x518eb0||0xcc;return function(_0x32a18c){if(_0x32a18c){return _0x36b437[_0xb44e('0x19')](_0x518eb0);}return _0x36b437[_0xb44e('0x1a')](_0x518eb0)[_0xb44e('0x1b')]();};}function respondWithResult(_0x335d7c,_0x589140){_0x589140=_0x589140||0xc8;return function(_0x354ac2){if(_0x354ac2){return _0x335d7c[_0xb44e('0x1a')](_0x589140)[_0xb44e('0x1c')](_0x354ac2);}};}function respondWithFilteredResult(_0x53129d,_0xac8c2b){return function(_0xb22e11){if(_0xb22e11){var _0x7e022b=typeof _0xac8c2b[_0xb44e('0x1d')]===_0xb44e('0x1e')&&typeof _0xac8c2b['limit']===_0xb44e('0x1e');var _0x3cafff=_0xb22e11[_0xb44e('0x1f')];var _0x1d83d4=_0x7e022b?0x0:_0xac8c2b['offset'];var _0x410ba5=_0x7e022b?_0xb22e11[_0xb44e('0x1f')]:_0xac8c2b[_0xb44e('0x1d')]+_0xac8c2b[_0xb44e('0x20')];var _0x3cb6d6;if(_0x410ba5>=_0x3cafff){_0x410ba5=_0x3cafff;_0x3cb6d6=0xc8;}else{_0x3cb6d6=0xce;}_0x53129d[_0xb44e('0x1a')](_0x3cb6d6);return _0x53129d[_0xb44e('0x21')](_0xb44e('0x22'),_0x1d83d4+'-'+_0x410ba5+'/'+_0x3cafff)[_0xb44e('0x1c')](_0xb22e11);}return null;};}function patchUpdates(_0x40f58c){return function(_0x1cbdd2){try{jsonpatch[_0xb44e('0x23')](_0x1cbdd2,_0x40f58c,!![]);}catch(_0x247ca1){return BPromise[_0xb44e('0x24')](_0x247ca1);}return _0x1cbdd2['save']();};}function saveUpdates(_0x5b5d30,_0x279967){return function(_0x2859ca){if(_0x2859ca){return _0x2859ca['update'](_0x5b5d30)[_0xb44e('0x25')](function(_0x2c453c){return _0x2c453c;});}return null;};}function removeEntity(_0x3a2609,_0x51ec43){return function(_0x4f9161){if(_0x4f9161){return _0x4f9161[_0xb44e('0x26')]()[_0xb44e('0x25')](function(){var _0x5df69e=_0x4f9161[_0xb44e('0x27')]({'plain':!![]});var _0x42b20c=_0xb44e('0x28');return db[_0xb44e('0x29')]['destroy']({'where':{'type':_0x42b20c,'resourceId':_0x5df69e['id']}})[_0xb44e('0x25')](function(){return _0x4f9161;});})['then'](function(){_0x3a2609[_0xb44e('0x1a')](0xcc)[_0xb44e('0x1b')]();});}};}function handleEntityNotFound(_0x3c2a0a,_0x27c36b){return function(_0x33d404){if(!_0x33d404){_0x3c2a0a['sendStatus'](0x194);}return _0x33d404;};}function handleError(_0x14296a,_0x1ec934){_0x1ec934=_0x1ec934||0x1f4;return function(_0x23805d){logger['error'](_0x23805d[_0xb44e('0x2a')]);if(_0x23805d[_0xb44e('0x2b')]){delete _0x23805d[_0xb44e('0x2b')];}_0x14296a['status'](_0x1ec934)[_0xb44e('0x2c')](_0x23805d);};}exports[_0xb44e('0x2d')]=function(_0x4d17b3,_0x5ddf00){var _0x255f07={},_0x223b08={},_0x58c039={'count':0x0,'rows':[]};var _0x5ddcd2=_[_0xb44e('0x2e')](db[_0xb44e('0x2f')]['rawAttributes'],function(_0x5ead30){return{'name':_0x5ead30[_0xb44e('0x30')],'type':_0x5ead30[_0xb44e('0x31')][_0xb44e('0x32')]};});_0x223b08[_0xb44e('0x33')]=_[_0xb44e('0x2e')](_0x5ddcd2,'name');_0x223b08['query']=_[_0xb44e('0x34')](_0x4d17b3[_0xb44e('0x35')]);_0x223b08[_0xb44e('0x36')]=_[_0xb44e('0x37')](_0x223b08['model'],_0x223b08[_0xb44e('0x35')]);_0x255f07[_0xb44e('0x38')]=_[_0xb44e('0x37')](_0x223b08[_0xb44e('0x33')],qs[_0xb44e('0x39')](_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x39')]));_0x255f07[_0xb44e('0x38')]=_0x255f07[_0xb44e('0x38')][_0xb44e('0x3a')]?_0x255f07[_0xb44e('0x38')]:_0x223b08[_0xb44e('0x33')];if(!_0x4d17b3['query'][_0xb44e('0x3b')](_0xb44e('0x3c'))){_0x255f07[_0xb44e('0x20')]=qs[_0xb44e('0x20')](_0x4d17b3[_0xb44e('0x35')]['limit']);_0x255f07[_0xb44e('0x1d')]=qs['offset'](_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x1d')]);}_0x255f07['order']=qs['sort'](_0x4d17b3[_0xb44e('0x35')]['sort']);delete _0x4d17b3[_0xb44e('0x35')][_0xb44e('0x3d')];_0x255f07[_0xb44e('0x3e')]=qs[_0xb44e('0x36')](_[_0xb44e('0x3f')](_0x4d17b3[_0xb44e('0x35')],_0x223b08['filters']),_0x5ddcd2);if(_0x4d17b3['query']['filter']){_0x255f07[_0xb44e('0x3e')]=_['merge'](_0x255f07[_0xb44e('0x3e')],{'$or':_[_0xb44e('0x2e')](_0x5ddcd2,function(_0x258d2e){if(_0x258d2e[_0xb44e('0x31')]!==_0xb44e('0x40')){var _0x7fedeb={};_0x7fedeb[_0x258d2e[_0xb44e('0x2b')]]={'$like':'%'+_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x41')]+'%'};return _0x7fedeb;}})});}_0x255f07=_[_0xb44e('0x42')]({},_0x255f07,_0x4d17b3[_0xb44e('0x43')]);var _0x5d66db={'where':_0x255f07[_0xb44e('0x3e')]};return db[_0xb44e('0x2f')][_0xb44e('0x1f')](_0x5d66db)[_0xb44e('0x25')](function(_0xcf3506){_0x58c039[_0xb44e('0x1f')]=_0xcf3506;if(_0x4d17b3[_0xb44e('0x35')][_0xb44e('0x44')]){_0x255f07['include']=[{'all':!![]}];}return db[_0xb44e('0x2f')][_0xb44e('0x45')](_0x255f07);})[_0xb44e('0x25')](function(_0x36b0ac){_0x58c039[_0xb44e('0x46')]=_0x36b0ac;return _0x58c039;})[_0xb44e('0x25')](respondWithFilteredResult(_0x5ddf00,_0x255f07))[_0xb44e('0x47')](handleError(_0x5ddf00,null));};exports[_0xb44e('0x48')]=function(_0x3c6b69,_0xa20e52){var _0x4bcee0={'raw':![],'where':{'id':_0x3c6b69[_0xb44e('0x49')]['id']}},_0x4afdee={};_0x4afdee[_0xb44e('0x33')]=_[_0xb44e('0x34')](db[_0xb44e('0x2f')][_0xb44e('0x4a')]);_0x4afdee[_0xb44e('0x35')]=_[_0xb44e('0x34')](_0x3c6b69['query']);_0x4afdee[_0xb44e('0x36')]=_[_0xb44e('0x37')](_0x4afdee[_0xb44e('0x33')],_0x4afdee[_0xb44e('0x35')]);_0x4bcee0[_0xb44e('0x38')]=_[_0xb44e('0x37')](_0x4afdee[_0xb44e('0x33')],qs['fields'](_0x3c6b69[_0xb44e('0x35')][_0xb44e('0x39')]));_0x4bcee0[_0xb44e('0x38')]=_0x4bcee0[_0xb44e('0x38')]['length']?_0x4bcee0[_0xb44e('0x38')]:_0x4afdee['model'];if(_0x3c6b69[_0xb44e('0x35')][_0xb44e('0x44')]){_0x4bcee0[_0xb44e('0x4b')]=[{'all':!![]}];}_0x4bcee0=_['merge']({},_0x4bcee0,_0x3c6b69[_0xb44e('0x43')]);return db['VoiceMusicOnHold'][_0xb44e('0x4c')](_0x4bcee0)[_0xb44e('0x25')](handleEntityNotFound(_0xa20e52,null))['then'](respondWithResult(_0xa20e52,null))[_0xb44e('0x47')](handleError(_0xa20e52,null));};exports[_0xb44e('0x4d')]=function(_0x45d412,_0x5a2552){if(_0x45d412['body']['id']){delete _0x45d412[_0xb44e('0x4e')]['id'];}return db[_0xb44e('0x2f')]['find']({'where':{'id':_0x45d412[_0xb44e('0x49')]['id']}})['then'](handleEntityNotFound(_0x5a2552,null))[_0xb44e('0x25')](saveUpdates(_0x45d412[_0xb44e('0x4e')],null))[_0xb44e('0x25')](respondWithResult(_0x5a2552,null))[_0xb44e('0x47')](handleError(_0x5a2552,null));};exports[_0xb44e('0x4f')]=function(_0x8ad304,_0x119076,_0x49de0a){return db['sequelize'][_0xb44e('0x50')](function(_0x1a5ddd){if(_0x8ad304['body'][_0xb44e('0x51')]===_0xb44e('0x52')){_0x8ad304[_0xb44e('0x4e')][_0xb44e('0x53')]=path[_0xb44e('0x54')](config[_0xb44e('0x55')],_0xb44e('0x56'),_0x8ad304[_0xb44e('0x4e')][_0xb44e('0x2b')]);}return db[_0xb44e('0x2f')][_0xb44e('0x4f')](_0x8ad304[_0xb44e('0x4e')],{'transaction':_0x1a5ddd})['then'](function(_0x29b811){if(_0x8ad304[_0xb44e('0x4e')][_0xb44e('0x51')]===_0xb44e('0x52')){fs[_0xb44e('0x57')](_0x29b811[_0xb44e('0x53')],parseInt('0777',0x8));}var _0x30a64a=_0x8ad304['user']['get']({'plain':!![]});if(!_0x30a64a)throw new Error(_0xb44e('0x58'));if(_0x30a64a[_0xb44e('0x59')]===_0xb44e('0x5a')){var _0x1272ae=_0x29b811[_0xb44e('0x27')]({'plain':!![]});return db[_0xb44e('0x5b')][_0xb44e('0x4c')]({'where':{'name':_0xb44e('0x28'),'userProfileId':_0x30a64a['userProfileId']},'raw':!![]})[_0xb44e('0x25')](function(_0x32848c){if(_0x32848c&&_0x32848c['autoAssociation']===0x0){return db[_0xb44e('0x29')][_0xb44e('0x4f')]({'name':_0x1272ae[_0xb44e('0x2b')],'resourceId':_0x1272ae['id'],'type':_0x32848c[_0xb44e('0x2b')],'sectionId':_0x32848c['id']},{})[_0xb44e('0x25')](function(){return _0x29b811;});}else{return _0x29b811;}})[_0xb44e('0x47')](function(_0x466e1a){logger[_0xb44e('0x5c')](_0xb44e('0x5d'),_0x466e1a);});}return _0x29b811;});})['then'](respondWithResult(_0x119076,0xc9))[_0xb44e('0x47')](handleError(_0x119076,null));};exports[_0xb44e('0x26')]=function(_0xf0b91d,_0x5349b6,_0x1cc359){var _0x149be2;return db[_0xb44e('0x2f')]['find']({'where':{'id':_0xf0b91d[_0xb44e('0x49')]['id']}})[_0xb44e('0x25')](function(_0xfaabee){if(_0xfaabee){return db[_0xb44e('0x5e')]['transaction'](function(_0x20a604){return _0xfaabee[_0xb44e('0x26')]({'transaction':_0x20a604,'raw':!![]})[_0xb44e('0x25')](function(_0x57c1b4){if(_0x57c1b4['directory']){fs['readdirSync'](_0x57c1b4[_0xb44e('0x53')])[_0xb44e('0x5f')](function(_0x107742){fs[_0xb44e('0x60')](path['join'](_0x57c1b4[_0xb44e('0x53')],_0x107742));});fs['rmdirSync'](_0x57c1b4['directory']);}return _0x57c1b4;});})[_0xb44e('0x47')](function(_0x17cd44){throw new db['Sequelize']['ValidationError'](_0x17cd44[_0xb44e('0x61')]);});}})[_0xb44e('0x25')](handleEntityNotFound(_0x5349b6,null))[_0xb44e('0x25')](removeEntity(_0x5349b6,null))['catch'](handleError(_0x5349b6,null));};exports[_0xb44e('0x62')]=function(_0x45be3f,_0x269563,_0x196d73){return db[_0xb44e('0x5e')][_0xb44e('0x50')](function(_0x333cf0){var _0x224dd5;return db[_0xb44e('0x2f')][_0xb44e('0x4c')]({'where':{'id':_0x45be3f[_0xb44e('0x49')]['id']}})[_0xb44e('0x25')](function(_0x15c62f){if(_0x15c62f){_0x224dd5=_0x15c62f;return _0x15c62f[_0xb44e('0x62')](_0x45be3f[_0xb44e('0x4e')]['id'],{'transaction':_0x333cf0});}})[_0xb44e('0x25')](function(_0x132431){if(_0x132431){return db[_0xb44e('0x63')][_0xb44e('0x64')]({'where':{'id':_0x45be3f[_0xb44e('0x4e')]['id']},'attributes':['id','name',_0xb44e('0x65'),_0xb44e('0x66'),_0xb44e('0x67')],'raw':!![]});}})['then'](function(_0x5d90ae){if(_0x5d90ae){var _0x147b9b=path[_0xb44e('0x54')](config[_0xb44e('0x55')],_0xb44e('0x68'),util[_0xb44e('0x69')](_0xb44e('0x6a'),path[_0xb44e('0x6b')](_0x5d90ae[_0xb44e('0x65')],path[_0xb44e('0x6c')](_0x5d90ae[_0xb44e('0x65')])),_0x5d90ae[_0xb44e('0x66')]));var _0x923506=path['join'](config[_0xb44e('0x55')],_0xb44e('0x56'),_0x224dd5['name'],util[_0xb44e('0x69')](_0xb44e('0x6a'),_0x5d90ae['name'],_0x5d90ae['converted_format']));fs[_0xb44e('0x6d')](_0x147b9b,_0x923506);return _0x5d90ae;}})[_0xb44e('0x47')](function(_0x295991){throw new db[(_0xb44e('0x6e'))]['ValidationError'](_0x295991[_0xb44e('0x61')]);});})[_0xb44e('0x25')](handleEntityNotFound(_0x269563,null))[_0xb44e('0x25')](respondWithResult(_0x269563,0xc9))['catch'](handleError(_0x269563,null));};exports[_0xb44e('0x6f')]=function(_0x19cda9,_0x1e8735,_0x3057c8){return db[_0xb44e('0x5e')][_0xb44e('0x50')](function(_0x247b1a){var _0x550f9b;return db[_0xb44e('0x2f')]['findOne']({'where':{'id':_0x19cda9['params']['id']}})[_0xb44e('0x25')](handleEntityNotFound(_0x1e8735,null))[_0xb44e('0x25')](function(_0x37807b){if(_0x37807b){_0x550f9b=_0x37807b;return _0x37807b[_0xb44e('0x6f')](_0x19cda9['params'][_0xb44e('0x70')]);}})['then'](function(_0xcf78ca){if(_0xcf78ca){return db[_0xb44e('0x63')][_0xb44e('0x64')]({'where':{'id':_0x19cda9['params'][_0xb44e('0x70')]},'attributes':['id',_0xb44e('0x2b'),'save_name','converted_format',_0xb44e('0x67')],'raw':!![]});}})[_0xb44e('0x25')](function(_0x5bd484){if(_0x5bd484){fs[_0xb44e('0x60')](path['join'](_0x550f9b[_0xb44e('0x53')],util[_0xb44e('0x69')](_0xb44e('0x6a'),_0x5bd484[_0xb44e('0x2b')],_0x5bd484[_0xb44e('0x66')])));return _0x5bd484;}})[_0xb44e('0x47')](function(_0x299b8c){throw new db[(_0xb44e('0x6e'))][(_0xb44e('0x71'))](_0x299b8c[_0xb44e('0x61')]);});})['then'](handleEntityNotFound(_0x1e8735,null))['then'](respondWithStatusCode(_0x1e8735,0xcc))['catch'](handleError(_0x1e8735,null));};exports[_0xb44e('0x72')]=function(_0x54c4e1,_0x31728c,_0x355167){var _0x1c2db0={};var _0x564e06={};var _0x230a93;var _0x2a4c90;return db[_0xb44e('0x2f')][_0xb44e('0x64')]({'where':{'id':_0x54c4e1[_0xb44e('0x49')]['id']}})[_0xb44e('0x25')](handleEntityNotFound(_0x31728c,null))[_0xb44e('0x25')](function(_0x4fccca){if(_0x4fccca){_0x230a93=_0x4fccca;_0x564e06[_0xb44e('0x33')]=_[_0xb44e('0x34')](db['Sound'][_0xb44e('0x4a')]);_0x564e06[_0xb44e('0x35')]=_[_0xb44e('0x34')](_0x54c4e1[_0xb44e('0x35')]);_0x564e06[_0xb44e('0x36')]=_[_0xb44e('0x37')](_0x564e06[_0xb44e('0x33')],_0x564e06[_0xb44e('0x35')]);_0x1c2db0[_0xb44e('0x38')]=_[_0xb44e('0x37')](_0x564e06[_0xb44e('0x33')],qs[_0xb44e('0x39')](_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x39')]));_0x1c2db0[_0xb44e('0x38')]=_0x1c2db0[_0xb44e('0x38')][_0xb44e('0x3a')]?_0x1c2db0[_0xb44e('0x38')]:_0x564e06['model'];_0x1c2db0[_0xb44e('0x73')]=qs[_0xb44e('0x3d')](_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x3d')]);_0x1c2db0[_0xb44e('0x3e')]=qs['filters'](_['pick'](_0x54c4e1[_0xb44e('0x35')],_0x564e06[_0xb44e('0x36')]));if(_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x41')]){_0x1c2db0[_0xb44e('0x3e')]=_[_0xb44e('0x42')](_0x1c2db0['where'],{'$or':_[_0xb44e('0x2e')](_0x1c2db0[_0xb44e('0x38')],function(_0x41aace){var _0x5c57a7={};_0x5c57a7[_0x41aace]={'$like':'%'+_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x41')]+'%'};return _0x5c57a7;})});}_0x1c2db0=_[_0xb44e('0x42')]({},_0x1c2db0,_0x54c4e1[_0xb44e('0x43')]);return _0x230a93['getSounds'](_0x1c2db0);}})[_0xb44e('0x25')](function(_0x3f5007){if(_0x3f5007){_0x2a4c90=_0x3f5007[_0xb44e('0x3a')];if(!_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x3b')](_0xb44e('0x3c'))){_0x1c2db0[_0xb44e('0x20')]=qs[_0xb44e('0x20')](_0x54c4e1[_0xb44e('0x35')]['limit']);_0x1c2db0['offset']=qs[_0xb44e('0x1d')](_0x54c4e1[_0xb44e('0x35')][_0xb44e('0x1d')]);}return _0x230a93[_0xb44e('0x72')](_0x1c2db0);}})['then'](function(_0x254d0d){if(_0x254d0d){return _0x254d0d?{'count':_0x2a4c90,'rows':_0x254d0d}:null;}})[_0xb44e('0x25')](respondWithResult(_0x31728c,null))['catch'](handleError(_0x31728c,null));}; \ No newline at end of file +var _0x2f91=['id2','unlinkSync','order','getSounds','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','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','end','json','undefined','count','offset','limit','status','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','where','filter','merge','options','includeAll','rows','catch','show','params','include','find','update','body','create','sequelize','transaction','mode','files','join','root','server/files/moh','mkdirSync','directory','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MusicOnHolds','userProfileId','UserProfileResource','error','forEach','rmdirSync','Sequelize','message','addSound','Sound','findOne','save_name','converted_format','createdAt','server/files/sounds/converted','format','%s.%s','basename','symlinkSync','ValidationError','removeSound'];(function(_0x2e7d64,_0x22215c){var _0x4626b1=function(_0x5c827e){while(--_0x5c827e){_0x2e7d64['push'](_0x2e7d64['shift']());}};_0x4626b1(++_0x22215c);}(_0x2f91,0x1cd));var _0x12f9=function(_0x1c92e7,_0xee3ba3){_0x1c92e7=_0x1c92e7-0x0;var _0x3be7e7=_0x2f91[_0x1c92e7];return _0x3be7e7;};'use strict';var emlformat=require(_0x12f9('0x0'));var rimraf=require(_0x12f9('0x1'));var zipdir=require(_0x12f9('0x2'));var jsonpatch=require(_0x12f9('0x3'));var rp=require('request-promise');var moment=require(_0x12f9('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x12f9('0x5'));var util=require(_0x12f9('0x6'));var path=require(_0x12f9('0x7'));var sox=require(_0x12f9('0x8'));var csv=require(_0x12f9('0x9'));var ejs=require(_0x12f9('0xa'));var fs=require('fs');var fs_extra=require(_0x12f9('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x12f9('0xc'));var jsforce=require(_0x12f9('0xd'));var deskjs=require(_0x12f9('0xe'));var toCsv=require(_0x12f9('0x9'));var querystring=require('querystring');var Papa=require(_0x12f9('0xf'));var Redis=require(_0x12f9('0x10'));var authService=require(_0x12f9('0x11'));var qs=require(_0x12f9('0x12'));var as=require(_0x12f9('0x13'));var hardwareService=require(_0x12f9('0x14'));var logger=require(_0x12f9('0x15'))(_0x12f9('0x16'));var utils=require(_0x12f9('0x17'));var config=require(_0x12f9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x12f9('0x19'))['db'];function respondWithStatusCode(_0x54a6d6,_0x1a1ad3){_0x1a1ad3=_0x1a1ad3||0xcc;return function(_0x3ad1c7){if(_0x3ad1c7){return _0x54a6d6['sendStatus'](_0x1a1ad3);}return _0x54a6d6['status'](_0x1a1ad3)[_0x12f9('0x1a')]();};}function respondWithResult(_0x29f525,_0x20a64c){_0x20a64c=_0x20a64c||0xc8;return function(_0x3125c6){if(_0x3125c6){return _0x29f525['status'](_0x20a64c)[_0x12f9('0x1b')](_0x3125c6);}};}function respondWithFilteredResult(_0x3f6414,_0x5637bc){return function(_0x54ea06){if(_0x54ea06){var _0x4aaf10=typeof _0x5637bc['offset']===_0x12f9('0x1c')&&typeof _0x5637bc['limit']===_0x12f9('0x1c');var _0x44d6f2=_0x54ea06[_0x12f9('0x1d')];var _0x58720f=_0x4aaf10?0x0:_0x5637bc[_0x12f9('0x1e')];var _0x1fe55f=_0x4aaf10?_0x54ea06[_0x12f9('0x1d')]:_0x5637bc[_0x12f9('0x1e')]+_0x5637bc[_0x12f9('0x1f')];var _0xcfd869;if(_0x1fe55f>=_0x44d6f2){_0x1fe55f=_0x44d6f2;_0xcfd869=0xc8;}else{_0xcfd869=0xce;}_0x3f6414[_0x12f9('0x20')](_0xcfd869);return _0x3f6414[_0x12f9('0x21')](_0x12f9('0x22'),_0x58720f+'-'+_0x1fe55f+'/'+_0x44d6f2)[_0x12f9('0x1b')](_0x54ea06);}return null;};}function patchUpdates(_0x52814b){return function(_0x3c89a6){try{jsonpatch[_0x12f9('0x23')](_0x3c89a6,_0x52814b,!![]);}catch(_0xdf8d11){return BPromise['reject'](_0xdf8d11);}return _0x3c89a6['save']();};}function saveUpdates(_0x4572c9,_0x1f4c6b){return function(_0x331ae0){if(_0x331ae0){return _0x331ae0['update'](_0x4572c9)[_0x12f9('0x24')](function(_0x5926db){return _0x5926db;});}return null;};}function removeEntity(_0x69645f,_0x1a6a5b){return function(_0x20e286){if(_0x20e286){return _0x20e286[_0x12f9('0x25')]()['then'](function(){var _0x79b14e=_0x20e286['get']({'plain':!![]});var _0xad7cc4='MusicOnHolds';return db['UserProfileResource']['destroy']({'where':{'type':_0xad7cc4,'resourceId':_0x79b14e['id']}})[_0x12f9('0x24')](function(){return _0x20e286;});})['then'](function(){_0x69645f[_0x12f9('0x20')](0xcc)[_0x12f9('0x1a')]();});}};}function handleEntityNotFound(_0x4100b8,_0x2df43e){return function(_0x345d9e){if(!_0x345d9e){_0x4100b8[_0x12f9('0x26')](0x194);}return _0x345d9e;};}function handleError(_0x547ac1,_0x4799ee){_0x4799ee=_0x4799ee||0x1f4;return function(_0x830a6c){logger['error'](_0x830a6c[_0x12f9('0x27')]);if(_0x830a6c[_0x12f9('0x28')]){delete _0x830a6c[_0x12f9('0x28')];}_0x547ac1[_0x12f9('0x20')](_0x4799ee)[_0x12f9('0x29')](_0x830a6c);};}exports[_0x12f9('0x2a')]=function(_0x210ac0,_0x5e0f21){var _0x3cf425={},_0xcfa81b={},_0x1efbdc={'count':0x0,'rows':[]};var _0x2d2612=_[_0x12f9('0x2b')](db[_0x12f9('0x2c')][_0x12f9('0x2d')],function(_0x115596){return{'name':_0x115596[_0x12f9('0x2e')],'type':_0x115596[_0x12f9('0x2f')][_0x12f9('0x30')]};});_0xcfa81b[_0x12f9('0x31')]=_[_0x12f9('0x2b')](_0x2d2612,_0x12f9('0x28'));_0xcfa81b[_0x12f9('0x32')]=_[_0x12f9('0x33')](_0x210ac0[_0x12f9('0x32')]);_0xcfa81b[_0x12f9('0x34')]=_[_0x12f9('0x35')](_0xcfa81b['model'],_0xcfa81b[_0x12f9('0x32')]);_0x3cf425[_0x12f9('0x36')]=_[_0x12f9('0x35')](_0xcfa81b[_0x12f9('0x31')],qs['fields'](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x37')]));_0x3cf425[_0x12f9('0x36')]=_0x3cf425[_0x12f9('0x36')][_0x12f9('0x38')]?_0x3cf425[_0x12f9('0x36')]:_0xcfa81b[_0x12f9('0x31')];if(!_0x210ac0[_0x12f9('0x32')]['hasOwnProperty'](_0x12f9('0x39'))){_0x3cf425[_0x12f9('0x1f')]=qs['limit'](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x1f')]);_0x3cf425['offset']=qs[_0x12f9('0x1e')](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x1e')]);}_0x3cf425['order']=qs['sort'](_0x210ac0[_0x12f9('0x32')][_0x12f9('0x3a')]);delete _0x210ac0[_0x12f9('0x32')][_0x12f9('0x3a')];_0x3cf425['where']=qs[_0x12f9('0x34')](_[_0x12f9('0x3b')](_0x210ac0[_0x12f9('0x32')],_0xcfa81b['filters']),_0x2d2612);if(_0x210ac0[_0x12f9('0x32')]['filter']){_0x3cf425[_0x12f9('0x3c')]=_['merge'](_0x3cf425[_0x12f9('0x3c')],{'$or':_['map'](_0x2d2612,function(_0x177266){if(_0x177266[_0x12f9('0x2f')]!=='VIRTUAL'){var _0x327ff1={};_0x327ff1[_0x177266[_0x12f9('0x28')]]={'$like':'%'+_0x210ac0['query'][_0x12f9('0x3d')]+'%'};return _0x327ff1;}})});}_0x3cf425=_[_0x12f9('0x3e')]({},_0x3cf425,_0x210ac0[_0x12f9('0x3f')]);var _0xdf2ce7={'where':_0x3cf425[_0x12f9('0x3c')]};return db[_0x12f9('0x2c')][_0x12f9('0x1d')](_0xdf2ce7)[_0x12f9('0x24')](function(_0x331664){_0x1efbdc[_0x12f9('0x1d')]=_0x331664;if(_0x210ac0[_0x12f9('0x32')][_0x12f9('0x40')]){_0x3cf425['include']=[{'all':!![]}];}return db[_0x12f9('0x2c')]['findAll'](_0x3cf425);})[_0x12f9('0x24')](function(_0x1ca190){_0x1efbdc[_0x12f9('0x41')]=_0x1ca190;return _0x1efbdc;})[_0x12f9('0x24')](respondWithFilteredResult(_0x5e0f21,_0x3cf425))[_0x12f9('0x42')](handleError(_0x5e0f21,null));};exports[_0x12f9('0x43')]=function(_0x320f3e,_0x3ff715){var _0x305ccd={'raw':![],'where':{'id':_0x320f3e[_0x12f9('0x44')]['id']}},_0x242478={};_0x242478[_0x12f9('0x31')]=_['keys'](db[_0x12f9('0x2c')]['rawAttributes']);_0x242478[_0x12f9('0x32')]=_['keys'](_0x320f3e[_0x12f9('0x32')]);_0x242478['filters']=_['intersection'](_0x242478[_0x12f9('0x31')],_0x242478['query']);_0x305ccd[_0x12f9('0x36')]=_['intersection'](_0x242478[_0x12f9('0x31')],qs['fields'](_0x320f3e[_0x12f9('0x32')]['fields']));_0x305ccd[_0x12f9('0x36')]=_0x305ccd[_0x12f9('0x36')][_0x12f9('0x38')]?_0x305ccd['attributes']:_0x242478['model'];if(_0x320f3e[_0x12f9('0x32')][_0x12f9('0x40')]){_0x305ccd[_0x12f9('0x45')]=[{'all':!![]}];}_0x305ccd=_['merge']({},_0x305ccd,_0x320f3e[_0x12f9('0x3f')]);return db['VoiceMusicOnHold'][_0x12f9('0x46')](_0x305ccd)['then'](handleEntityNotFound(_0x3ff715,null))['then'](respondWithResult(_0x3ff715,null))['catch'](handleError(_0x3ff715,null));};exports[_0x12f9('0x47')]=function(_0x1b39d3,_0x2b0ae0){if(_0x1b39d3[_0x12f9('0x48')]['id']){delete _0x1b39d3[_0x12f9('0x48')]['id'];}return db[_0x12f9('0x2c')][_0x12f9('0x46')]({'where':{'id':_0x1b39d3[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](handleEntityNotFound(_0x2b0ae0,null))['then'](saveUpdates(_0x1b39d3[_0x12f9('0x48')],null))[_0x12f9('0x24')](respondWithResult(_0x2b0ae0,null))[_0x12f9('0x42')](handleError(_0x2b0ae0,null));};exports[_0x12f9('0x49')]=function(_0x4418f0,_0x46a216,_0x3660da){return db[_0x12f9('0x4a')][_0x12f9('0x4b')](function(_0x15372f){if(_0x4418f0[_0x12f9('0x48')][_0x12f9('0x4c')]===_0x12f9('0x4d')){_0x4418f0[_0x12f9('0x48')]['directory']=path[_0x12f9('0x4e')](config[_0x12f9('0x4f')],_0x12f9('0x50'),_0x4418f0[_0x12f9('0x48')][_0x12f9('0x28')]);}return db['VoiceMusicOnHold'][_0x12f9('0x49')](_0x4418f0[_0x12f9('0x48')],{'transaction':_0x15372f})[_0x12f9('0x24')](function(_0x1edd87){if(_0x4418f0[_0x12f9('0x48')]['mode']===_0x12f9('0x4d')){fs[_0x12f9('0x51')](_0x1edd87[_0x12f9('0x52')],parseInt('0777',0x8));}var _0x2290d8=_0x4418f0[_0x12f9('0x53')][_0x12f9('0x54')]({'plain':!![]});if(!_0x2290d8)throw new Error(_0x12f9('0x55'));if(_0x2290d8[_0x12f9('0x56')]===_0x12f9('0x53')){var _0x23bf47=_0x1edd87['get']({'plain':!![]});return db[_0x12f9('0x57')][_0x12f9('0x46')]({'where':{'name':_0x12f9('0x58'),'userProfileId':_0x2290d8[_0x12f9('0x59')]},'raw':!![]})[_0x12f9('0x24')](function(_0x564c5e){if(_0x564c5e&&_0x564c5e['autoAssociation']===0x0){return db[_0x12f9('0x5a')][_0x12f9('0x49')]({'name':_0x23bf47['name'],'resourceId':_0x23bf47['id'],'type':_0x564c5e['name'],'sectionId':_0x564c5e['id']},{})['then'](function(){return _0x1edd87;});}else{return _0x1edd87;}})['catch'](function(_0x4f145a){logger[_0x12f9('0x5b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f145a);});}return _0x1edd87;});})['then'](respondWithResult(_0x46a216,0xc9))['catch'](handleError(_0x46a216,null));};exports[_0x12f9('0x25')]=function(_0x33bf2f,_0x33fcaa,_0x200a3a){var _0x543c31;return db[_0x12f9('0x2c')][_0x12f9('0x46')]({'where':{'id':_0x33bf2f[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](function(_0x16c596){if(_0x16c596){return db[_0x12f9('0x4a')][_0x12f9('0x4b')](function(_0x47e400){return _0x16c596['destroy']({'transaction':_0x47e400,'raw':!![]})[_0x12f9('0x24')](function(_0x2f1c4b){if(_0x2f1c4b['directory']){fs['readdirSync'](_0x2f1c4b[_0x12f9('0x52')])[_0x12f9('0x5c')](function(_0xccf890){fs['unlinkSync'](path[_0x12f9('0x4e')](_0x2f1c4b[_0x12f9('0x52')],_0xccf890));});fs[_0x12f9('0x5d')](_0x2f1c4b[_0x12f9('0x52')]);}return _0x2f1c4b;});})['catch'](function(_0x4043c1){throw new db[(_0x12f9('0x5e'))]['ValidationError'](_0x4043c1[_0x12f9('0x5f')]);});}})[_0x12f9('0x24')](handleEntityNotFound(_0x33fcaa,null))[_0x12f9('0x24')](removeEntity(_0x33fcaa,null))[_0x12f9('0x42')](handleError(_0x33fcaa,null));};exports['addSound']=function(_0x17f5bf,_0x523530,_0x1ca2e5){return db[_0x12f9('0x4a')][_0x12f9('0x4b')](function(_0x15d7b0){var _0x14a0e4;return db['VoiceMusicOnHold'][_0x12f9('0x46')]({'where':{'id':_0x17f5bf['params']['id']}})[_0x12f9('0x24')](function(_0x45c6fb){if(_0x45c6fb){_0x14a0e4=_0x45c6fb;return _0x45c6fb[_0x12f9('0x60')](_0x17f5bf[_0x12f9('0x48')]['id'],{'transaction':_0x15d7b0});}})[_0x12f9('0x24')](function(_0x242a9f){if(_0x242a9f){return db[_0x12f9('0x61')][_0x12f9('0x62')]({'where':{'id':_0x17f5bf['body']['id']},'attributes':['id',_0x12f9('0x28'),_0x12f9('0x63'),_0x12f9('0x64'),_0x12f9('0x65')],'raw':!![]});}})[_0x12f9('0x24')](function(_0x5da3e7){if(_0x5da3e7){var _0x34544a=path[_0x12f9('0x4e')](config[_0x12f9('0x4f')],_0x12f9('0x66'),util[_0x12f9('0x67')](_0x12f9('0x68'),path[_0x12f9('0x69')](_0x5da3e7[_0x12f9('0x63')],path['extname'](_0x5da3e7[_0x12f9('0x63')])),_0x5da3e7[_0x12f9('0x64')]));var _0x3a9b04=path[_0x12f9('0x4e')](config[_0x12f9('0x4f')],_0x12f9('0x50'),_0x14a0e4[_0x12f9('0x28')],util[_0x12f9('0x67')](_0x12f9('0x68'),_0x5da3e7['name'],_0x5da3e7[_0x12f9('0x64')]));fs[_0x12f9('0x6a')](_0x34544a,_0x3a9b04);return _0x5da3e7;}})[_0x12f9('0x42')](function(_0x556091){throw new db[(_0x12f9('0x5e'))][(_0x12f9('0x6b'))](_0x556091[_0x12f9('0x5f')]);});})[_0x12f9('0x24')](handleEntityNotFound(_0x523530,null))[_0x12f9('0x24')](respondWithResult(_0x523530,0xc9))[_0x12f9('0x42')](handleError(_0x523530,null));};exports[_0x12f9('0x6c')]=function(_0x50c79f,_0x54bfca,_0x327502){return db['sequelize']['transaction'](function(_0x44c81c){var _0x66fdad;return db[_0x12f9('0x2c')][_0x12f9('0x62')]({'where':{'id':_0x50c79f[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](handleEntityNotFound(_0x54bfca,null))['then'](function(_0xd68ae4){if(_0xd68ae4){_0x66fdad=_0xd68ae4;return _0xd68ae4[_0x12f9('0x6c')](_0x50c79f[_0x12f9('0x44')][_0x12f9('0x6d')]);}})['then'](function(_0x30f056){if(_0x30f056){return db[_0x12f9('0x61')][_0x12f9('0x62')]({'where':{'id':_0x50c79f[_0x12f9('0x44')][_0x12f9('0x6d')]},'attributes':['id',_0x12f9('0x28'),'save_name',_0x12f9('0x64'),_0x12f9('0x65')],'raw':!![]});}})[_0x12f9('0x24')](function(_0x1bf324){if(_0x1bf324){fs[_0x12f9('0x6e')](path[_0x12f9('0x4e')](_0x66fdad[_0x12f9('0x52')],util[_0x12f9('0x67')](_0x12f9('0x68'),_0x1bf324[_0x12f9('0x28')],_0x1bf324[_0x12f9('0x64')])));return _0x1bf324;}})[_0x12f9('0x42')](function(_0x584bab){throw new db['Sequelize'][(_0x12f9('0x6b'))](_0x584bab['message']);});})[_0x12f9('0x24')](handleEntityNotFound(_0x54bfca,null))[_0x12f9('0x24')](respondWithStatusCode(_0x54bfca,0xcc))[_0x12f9('0x42')](handleError(_0x54bfca,null));};exports['getSounds']=function(_0x9a8f14,_0x1aabbc,_0x510e01){var _0x298668={};var _0x1969ef={};var _0x4c2630;var _0xa036ae;return db[_0x12f9('0x2c')][_0x12f9('0x62')]({'where':{'id':_0x9a8f14[_0x12f9('0x44')]['id']}})[_0x12f9('0x24')](handleEntityNotFound(_0x1aabbc,null))[_0x12f9('0x24')](function(_0x525945){if(_0x525945){_0x4c2630=_0x525945;_0x1969ef[_0x12f9('0x31')]=_['keys'](db['Sound']['rawAttributes']);_0x1969ef[_0x12f9('0x32')]=_[_0x12f9('0x33')](_0x9a8f14[_0x12f9('0x32')]);_0x1969ef['filters']=_[_0x12f9('0x35')](_0x1969ef[_0x12f9('0x31')],_0x1969ef['query']);_0x298668[_0x12f9('0x36')]=_[_0x12f9('0x35')](_0x1969ef[_0x12f9('0x31')],qs[_0x12f9('0x37')](_0x9a8f14['query']['fields']));_0x298668[_0x12f9('0x36')]=_0x298668[_0x12f9('0x36')][_0x12f9('0x38')]?_0x298668[_0x12f9('0x36')]:_0x1969ef[_0x12f9('0x31')];_0x298668[_0x12f9('0x6f')]=qs[_0x12f9('0x3a')](_0x9a8f14[_0x12f9('0x32')]['sort']);_0x298668['where']=qs['filters'](_[_0x12f9('0x3b')](_0x9a8f14[_0x12f9('0x32')],_0x1969ef[_0x12f9('0x34')]));if(_0x9a8f14[_0x12f9('0x32')][_0x12f9('0x3d')]){_0x298668[_0x12f9('0x3c')]=_['merge'](_0x298668[_0x12f9('0x3c')],{'$or':_['map'](_0x298668['attributes'],function(_0x54707b){var _0x41580e={};_0x41580e[_0x54707b]={'$like':'%'+_0x9a8f14[_0x12f9('0x32')][_0x12f9('0x3d')]+'%'};return _0x41580e;})});}_0x298668=_[_0x12f9('0x3e')]({},_0x298668,_0x9a8f14['options']);return _0x4c2630[_0x12f9('0x70')](_0x298668);}})[_0x12f9('0x24')](function(_0x1cd197){if(_0x1cd197){_0xa036ae=_0x1cd197[_0x12f9('0x38')];if(!_0x9a8f14['query'][_0x12f9('0x71')](_0x12f9('0x39'))){_0x298668[_0x12f9('0x1f')]=qs[_0x12f9('0x1f')](_0x9a8f14[_0x12f9('0x32')][_0x12f9('0x1f')]);_0x298668[_0x12f9('0x1e')]=qs[_0x12f9('0x1e')](_0x9a8f14[_0x12f9('0x32')]['offset']);}return _0x4c2630[_0x12f9('0x70')](_0x298668);}})[_0x12f9('0x24')](function(_0x1ffb5f){if(_0x1ffb5f){return _0x1ffb5f?{'count':_0xa036ae,'rows':_0x1ffb5f}:null;}})[_0x12f9('0x24')](respondWithResult(_0x1aabbc,null))[_0x12f9('0x42')](handleError(_0x1aabbc,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index a8346a2..c4b0850 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 _0xe73a=['exports','VoiceMusicOnHold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./voiceMusicOnHold.attributes'];(function(_0x146e40,_0x24db42){var _0x4b0ba6=function(_0xc1229b){while(--_0xc1229b){_0x146e40['push'](_0x146e40['shift']());}};_0x4b0ba6(++_0x24db42);}(_0xe73a,0x12b));var _0xae73=function(_0x40dd56,_0x726ca5){_0x40dd56=_0x40dd56-0x0;var _0x4f850f=_0xe73a[_0x40dd56];return _0x4f850f;};'use strict';var _=require(_0xae73('0x0'));var util=require(_0xae73('0x1'));var logger=require(_0xae73('0x2'))(_0xae73('0x3'));var moment=require(_0xae73('0x4'));var BPromise=require(_0xae73('0x5'));var rp=require(_0xae73('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xae73('0x7'));var config=require('../../config/environment');var attributes=require(_0xae73('0x8'));module[_0xae73('0x9')]=function(_0x41c95f,_0x1fcd00){return _0x41c95f['define'](_0xae73('0xa'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x881e=['moment','bluebird','request-promise','path','rimraf','exports','define','VoiceMusicOnHold','voice_musiconhold','lodash','api'];(function(_0x5e2886,_0x1fa7f3){var _0x319399=function(_0x182039){while(--_0x182039){_0x5e2886['push'](_0x5e2886['shift']());}};_0x319399(++_0x1fa7f3);}(_0x881e,0xa3));var _0xe881=function(_0x23225e,_0x41939c){_0x23225e=_0x23225e-0x0;var _0x76b8d3=_0x881e[_0x23225e];return _0x76b8d3;};'use strict';var _=require(_0xe881('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe881('0x1'));var moment=require(_0xe881('0x2'));var BPromise=require(_0xe881('0x3'));var rp=require(_0xe881('0x4'));var fs=require('fs');var path=require(_0xe881('0x5'));var rimraf=require(_0xe881('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0xe881('0x7')]=function(_0x4dce2c,_0x337eb8){return _0x4dce2c[_0xe881('0x8')](_0xe881('0x9'),attributes,{'tableName':_0xe881('0xa'),'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 4a9b590..23a6eab 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 _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x52c0b3,_0x294511){var _0x5d3408=function(_0x38ceb8){while(--_0x38ceb8){_0x52c0b3['push'](_0x52c0b3['shift']());}};_0x5d3408(++_0x294511);}(_0x34e8,0x12c));var _0x834e=function(_0x45d5a8,_0x1dfd1e){_0x45d5a8=_0x45d5a8-0x0;var _0x57733d=_0x34e8[_0x45d5a8];return _0x57733d;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var moment=require(_0x834e('0x2'));var BPromise=require(_0x834e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x834e('0x4'));var db=require(_0x834e('0x5'))['db'];var utils=require(_0x834e('0x6'));var logger=require(_0x834e('0x7'))(_0x834e('0x8'));var config=require(_0x834e('0x9'));var jayson=require(_0x834e('0xa'));var client=jayson['client'][_0x834e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52056d,_0x3e16d2,_0x3cc2e3){return new BPromise(function(_0x3a3ef6,_0x2e69e2){return client[_0x834e('0xc')](_0x52056d,_0x3cc2e3)[_0x834e('0xd')](function(_0x363786){logger[_0x834e('0xe')](_0x834e('0xf'),_0x3e16d2,_0x834e('0x10'));logger[_0x834e('0x11')](_0x834e('0x12'),_0x3e16d2,_0x834e('0x10'),JSON[_0x834e('0x13')](_0x363786));if(_0x363786[_0x834e('0x14')]){if(_0x363786[_0x834e('0x14')][_0x834e('0x15')]===0x1f4){logger['error'](_0x834e('0xf'),_0x3e16d2,_0x363786[_0x834e('0x14')]['message']);return _0x2e69e2(_0x363786[_0x834e('0x14')][_0x834e('0x16')]);}logger[_0x834e('0x14')](_0x834e('0xf'),_0x3e16d2,_0x363786['error'][_0x834e('0x16')]);return _0x3a3ef6(_0x363786[_0x834e('0x14')]['message']);}else{logger[_0x834e('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file +var _0x0713=['VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x261404,_0x484b0b){var _0x2e765e=function(_0x27c907){while(--_0x27c907){_0x261404['push'](_0x261404['shift']());}};_0x2e765e(++_0x484b0b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 083e3b3..6001b28 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 _0xea31=['removeAgents','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','show','/:id/users','getAgents','/:id/teams','getTeams','post','put','update','delete'];(function(_0x245c4f,_0x34b70f){var _0x3157a1=function(_0x18bfc7){while(--_0x18bfc7){_0x245c4f['push'](_0x245c4f['shift']());}};_0x3157a1(++_0x34b70f);}(_0xea31,0x6b));var _0x1ea3=function(_0x414aa8,_0x5e47c7){_0x414aa8=_0x414aa8-0x0;var _0x3a3465=_0xea31[_0x414aa8];return _0x3a3465;};'use strict';var multer=require(_0x1ea3('0x0'));var util=require('util');var path=require(_0x1ea3('0x1'));var timeout=require(_0x1ea3('0x2'));var express=require(_0x1ea3('0x3'));var router=express[_0x1ea3('0x4')]();var fs_extra=require(_0x1ea3('0x5'));var auth=require(_0x1ea3('0x6'));var interaction=require(_0x1ea3('0x7'));var config=require('../../config/environment');var controller=require(_0x1ea3('0x8'));router[_0x1ea3('0x9')]('/',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xb')]);router[_0x1ea3('0x9')]('/describe',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xc')]);router[_0x1ea3('0x9')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0xe')]);router['get'](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x10')]);router[_0x1ea3('0x9')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x12')]);router['post']('/',auth[_0x1ea3('0xa')](),controller['create']);router[_0x1ea3('0x13')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller['addAgents']);router[_0x1ea3('0x13')](_0x1ea3('0x11'),auth[_0x1ea3('0xa')](),controller['addTeams']);router[_0x1ea3('0x14')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x15')]);router[_0x1ea3('0x16')](_0x1ea3('0xd'),auth[_0x1ea3('0xa')](),controller['destroy']);router[_0x1ea3('0x16')](_0x1ea3('0xf'),auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x17')]);router[_0x1ea3('0x16')]('/:id/teams',auth[_0x1ea3('0xa')](),controller[_0x1ea3('0x18')]);module[_0x1ea3('0x19')]=router; \ No newline at end of file +var _0x55ca=['addTeams','put','update','destroy','delete','removeAgents','removeTeams','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','/:id/users','getAgents','/:id/teams','getTeams','post','create'];(function(_0x259c99,_0x28fc7b){var _0x589fef=function(_0x3fd915){while(--_0x3fd915){_0x259c99['push'](_0x259c99['shift']());}};_0x589fef(++_0x28fc7b);}(_0x55ca,0x126));var _0xa55c=function(_0x4ede04,_0x58132b){_0x4ede04=_0x4ede04-0x0;var _0x49ccfc=_0x55ca[_0x4ede04];return _0x49ccfc;};'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')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router['post']('/:id/users',auth[_0xa55c('0x8')](),controller['addAgents']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x12')]);router[_0xa55c('0x13')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);router[_0xa55c('0x16')](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x17')]);router[_0xa55c('0x16')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 03bd5c8..5230d25 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 _0x1867=['name','VIRTUAL','system-','sequelize','exports','STRING'];(function(_0x1a5c37,_0x3ae3fa){var _0x37a7a3=function(_0xa55b92){while(--_0xa55b92){_0x1a5c37['push'](_0x1a5c37['shift']());}};_0x37a7a3(++_0x3ae3fa);}(_0x1867,0x10b));var _0x7186=function(_0x4f216c,_0x90d479){_0x4f216c=_0x4f216c-0x0;var _0x32eca8=_0x1867[_0x4f216c];return _0x32eca8;};'use strict';var Sequelize=require(_0x7186('0x0'));module[_0x7186('0x1')]={'name':{'type':Sequelize[_0x7186('0x2')],'allowNull':![],'unique':_0x7186('0x3')},'prefix':{'type':Sequelize[_0x7186('0x4')],'get':function(_0x4f505d){return _0x7186('0x5')+this['getDataValue']('name')+'-';}},'description':{'type':Sequelize[_0x7186('0x2')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xeb17=['getDataValue','sequelize','STRING','name','VIRTUAL','system-'];(function(_0x4a2217,_0x9c653a){var _0x24cb1c=function(_0x35155e){while(--_0x35155e){_0x4a2217['push'](_0x4a2217['shift']());}};_0x24cb1c(++_0x9c653a);}(_0xeb17,0x73));var _0x7eb1=function(_0x145abc,_0x5a6073){_0x145abc=_0x145abc-0x0;var _0x3b031a=_0xeb17[_0x145abc];return _0x3b031a;};'use strict';var Sequelize=require(_0x7eb1('0x0'));module['exports']={'name':{'type':Sequelize[_0x7eb1('0x1')],'allowNull':![],'unique':_0x7eb1('0x2')},'prefix':{'type':Sequelize[_0x7eb1('0x3')],'get':function(_0x413acd){return _0x7eb1('0x4')+this[_0x7eb1('0x5')](_0x7eb1('0x2'))+'-';}},'description':{'type':Sequelize[_0x7eb1('0x1')]},'callerIdAll':{'type':Sequelize[_0x7eb1('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index f6e7922..302fd2f 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 _0x4888=['send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','describe','create','sequelize','transaction','body','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtension','bulkCreate','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','update','system-','addAgents','ids','omit','emit','removeAgents','isArray','userVoicePrefix:remove','findOne','User','getAgents','getTeams','addTeams','Team','Agents','online','voicePause','interface','each','upsert','findOrCreate','forEach','userVoicePrefix:save','removeTeams','select','field','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','toString','SELECT','every','compact','value','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name'];(function(_0x114bf1,_0x16ac4a){var _0x58072f=function(_0x377d8a){while(--_0x377d8a){_0x114bf1['push'](_0x114bf1['shift']());}};_0x58072f(++_0x16ac4a);}(_0x4888,0x198));var _0x8488=function(_0x22431e,_0x5af0a3){_0x22431e=_0x22431e-0x0;var _0xd978e9=_0x4888[_0x22431e];return _0xd978e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8488('0x0'));var zipdir=require(_0x8488('0x1'));var jsonpatch=require(_0x8488('0x2'));var rp=require(_0x8488('0x3'));var moment=require(_0x8488('0x4'));var BPromise=require(_0x8488('0x5'));var Mustache=require(_0x8488('0x6'));var util=require('util');var path=require(_0x8488('0x7'));var sox=require(_0x8488('0x8'));var csv=require(_0x8488('0x9'));var ejs=require(_0x8488('0xa'));var fs=require('fs');var fs_extra=require(_0x8488('0xb'));var _=require(_0x8488('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8488('0x9'));var querystring=require(_0x8488('0xd'));var Papa=require('papaparse');var Redis=require(_0x8488('0xe'));var authService=require(_0x8488('0xf'));var qs=require(_0x8488('0x10'));var as=require(_0x8488('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8488('0x12'))(_0x8488('0x13'));var utils=require(_0x8488('0x14'));var config=require(_0x8488('0x15'));var licenseUtil=require(_0x8488('0x16'));var db=require('../../mysqldb')['db'];config[_0x8488('0x17')]=_[_0x8488('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8488('0x19'))(new Redis(config['redis']));require(_0x8488('0x1a'))['register'](socket);function respondWithStatusCode(_0x5161a3,_0x24d0a0){_0x24d0a0=_0x24d0a0||0xcc;return function(_0x3635da){if(_0x3635da){return _0x5161a3[_0x8488('0x1b')](_0x24d0a0);}return _0x5161a3[_0x8488('0x1c')](_0x24d0a0)[_0x8488('0x1d')]();};}function respondWithResult(_0x8d3b3d,_0x165139){_0x165139=_0x165139||0xc8;return function(_0x4e44af){if(_0x4e44af){return _0x8d3b3d[_0x8488('0x1c')](_0x165139)[_0x8488('0x1e')](_0x4e44af);}};}function respondWithFilteredResult(_0x3edfe4,_0x37361d){return function(_0x60ae2f){if(_0x60ae2f){var _0x39775f=typeof _0x37361d[_0x8488('0x1f')]===_0x8488('0x20')&&typeof _0x37361d[_0x8488('0x21')]===_0x8488('0x20');var _0x10bfd6=_0x60ae2f[_0x8488('0x22')];var _0x3dd93e=_0x39775f?0x0:_0x37361d['offset'];var _0x4a1b45=_0x39775f?_0x60ae2f[_0x8488('0x22')]:_0x37361d[_0x8488('0x1f')]+_0x37361d[_0x8488('0x21')];var _0x3c9fc2;if(_0x4a1b45>=_0x10bfd6){_0x4a1b45=_0x10bfd6;_0x3c9fc2=0xc8;}else{_0x3c9fc2=0xce;}_0x3edfe4[_0x8488('0x1c')](_0x3c9fc2);return _0x3edfe4[_0x8488('0x23')](_0x8488('0x24'),_0x3dd93e+'-'+_0x4a1b45+'/'+_0x10bfd6)[_0x8488('0x1e')](_0x60ae2f);}return null;};}function patchUpdates(_0x39dd43){return function(_0x5123d0){try{jsonpatch[_0x8488('0x25')](_0x5123d0,_0x39dd43,!![]);}catch(_0x4e07e1){return BPromise[_0x8488('0x26')](_0x4e07e1);}return _0x5123d0[_0x8488('0x27')]();};}function saveUpdates(_0x290b33,_0x54ecda){return function(_0x577234){if(_0x577234){return _0x577234['update'](_0x290b33)['then'](function(_0x472624){return _0x472624;});}return null;};}function removeEntity(_0x51fe30,_0x58057a){return function(_0x26bdbb){if(_0x26bdbb){return _0x26bdbb[_0x8488('0x28')]()[_0x8488('0x29')](function(){var _0x6ebee0=_0x26bdbb[_0x8488('0x2a')]({'plain':!![]});var _0x503b83=_0x8488('0x2b');return db[_0x8488('0x2c')][_0x8488('0x28')]({'where':{'type':_0x503b83,'resourceId':_0x6ebee0['id']}})[_0x8488('0x29')](function(){return _0x26bdbb;});})[_0x8488('0x29')](function(){_0x51fe30[_0x8488('0x1c')](0xcc)[_0x8488('0x1d')]();});}};}function handleEntityNotFound(_0x296b6c,_0x368f9c){return function(_0x1d9317){if(!_0x1d9317){_0x296b6c[_0x8488('0x1b')](0x194);}return _0x1d9317;};}function handleError(_0x58d0cc,_0x57ce3c){_0x57ce3c=_0x57ce3c||0x1f4;return function(_0x4e3fe2){logger[_0x8488('0x2d')](_0x4e3fe2[_0x8488('0x2e')]);if(_0x4e3fe2[_0x8488('0x2f')]){delete _0x4e3fe2[_0x8488('0x2f')];}_0x58d0cc[_0x8488('0x1c')](_0x57ce3c)[_0x8488('0x30')](_0x4e3fe2);};}exports['index']=function(_0x2292e0,_0x14f378){var _0x208753={},_0x3649f7={},_0x18eb27={'count':0x0,'rows':[]};var _0x501981=_[_0x8488('0x31')](db[_0x8488('0x32')]['rawAttributes'],function(_0x1b0637){return{'name':_0x1b0637[_0x8488('0x33')],'type':_0x1b0637[_0x8488('0x34')][_0x8488('0x35')]};});_0x3649f7[_0x8488('0x36')]=_['map'](_0x501981,_0x8488('0x2f'));_0x3649f7[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2292e0['query']);_0x3649f7[_0x8488('0x39')]=_['intersection'](_0x3649f7[_0x8488('0x36')],_0x3649f7[_0x8488('0x37')]);_0x208753[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x3649f7['model'],qs[_0x8488('0x3c')](_0x2292e0[_0x8488('0x37')][_0x8488('0x3c')]));_0x208753['attributes']=_0x208753[_0x8488('0x3a')][_0x8488('0x3d')]?_0x208753[_0x8488('0x3a')]:_0x3649f7[_0x8488('0x36')];if(!_0x2292e0[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x208753[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2292e0[_0x8488('0x37')][_0x8488('0x21')]);_0x208753['offset']=qs['offset'](_0x2292e0[_0x8488('0x37')][_0x8488('0x1f')]);}_0x208753[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2292e0[_0x8488('0x37')][_0x8488('0x41')]);_0x208753[_0x8488('0x42')]=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x2292e0['query'],_0x3649f7[_0x8488('0x39')]),_0x501981);if(_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]){_0x208753['where']=_[_0x8488('0x45')](_0x208753[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x501981,function(_0x28bc84){if(_0x28bc84[_0x8488('0x34')]!==_0x8488('0x46')){var _0x1aac4b={};_0x1aac4b[_0x28bc84['name']]={'$like':'%'+_0x2292e0[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x1aac4b;}})});}_0x208753=_[_0x8488('0x45')]({},_0x208753,_0x2292e0['options']);var _0x3649ae={'where':_0x208753['where']};return db[_0x8488('0x32')][_0x8488('0x22')](_0x3649ae)['then'](function(_0x22a3f3){_0x18eb27[_0x8488('0x22')]=_0x22a3f3;if(_0x2292e0[_0x8488('0x37')][_0x8488('0x47')]){_0x208753[_0x8488('0x48')]=[{'all':!![]}];}return db['VoicePrefix'][_0x8488('0x49')](_0x208753);})['then'](function(_0x3440ae){_0x18eb27[_0x8488('0x4a')]=_0x3440ae;return _0x18eb27;})[_0x8488('0x29')](respondWithFilteredResult(_0x14f378,_0x208753))[_0x8488('0x4b')](handleError(_0x14f378,null));};exports[_0x8488('0x4c')]=function(_0x3dd1cb,_0x1ae9af){var _0x192617={'raw':![],'where':{'id':_0x3dd1cb[_0x8488('0x4d')]['id']}},_0xfe2e8f={};_0xfe2e8f[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x32')][_0x8488('0x4e')]);_0xfe2e8f[_0x8488('0x37')]=_[_0x8488('0x38')](_0x3dd1cb[_0x8488('0x37')]);_0xfe2e8f['filters']=_[_0x8488('0x3b')](_0xfe2e8f[_0x8488('0x36')],_0xfe2e8f[_0x8488('0x37')]);_0x192617[_0x8488('0x3a')]=_['intersection'](_0xfe2e8f[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x3dd1cb[_0x8488('0x37')][_0x8488('0x3c')]));_0x192617['attributes']=_0x192617[_0x8488('0x3a')][_0x8488('0x3d')]?_0x192617[_0x8488('0x3a')]:_0xfe2e8f[_0x8488('0x36')];if(_0x3dd1cb[_0x8488('0x37')][_0x8488('0x47')]){_0x192617[_0x8488('0x48')]=[{'all':!![]}];}_0x192617=_[_0x8488('0x45')]({},_0x192617,_0x3dd1cb[_0x8488('0x4f')]);return db[_0x8488('0x32')][_0x8488('0x50')](_0x192617)[_0x8488('0x29')](handleEntityNotFound(_0x1ae9af,null))[_0x8488('0x29')](respondWithResult(_0x1ae9af,null))['catch'](handleError(_0x1ae9af,null));};exports['destroy']=function(_0x8267e1,_0x1a66ff){return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x8267e1[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x1a66ff,null))[_0x8488('0x29')](removeEntity(_0x1a66ff,null))[_0x8488('0x4b')](handleError(_0x1a66ff,null));};exports[_0x8488('0x51')]=function(_0x481975,_0x474a0b){return db[_0x8488('0x32')]['describe']()[_0x8488('0x29')](respondWithResult(_0x474a0b,null))[_0x8488('0x4b')](handleError(_0x474a0b,null));};exports[_0x8488('0x52')]=function(_0x1ff9c5,_0x4f80fb){var _0x198328;return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x5c55bf){return db[_0x8488('0x32')][_0x8488('0x52')](_0x1ff9c5[_0x8488('0x55')],{'transaction':_0x5c55bf})[_0x8488('0x29')](function(_0x48caa1){_0x198328=_0x48caa1[_0x8488('0x2a')]({'plain':!![]});return db['VoiceExtension']['find']({'where':{'id':_0x198328[_0x8488('0x56')]},'raw':!![]})['then'](function(_0x3453c7){return createVoicePrefixExtensions(_0x198328,_0x3453c7,_0x5c55bf);});});})[_0x8488('0x29')](function(){var _0x417afa=_0x1ff9c5[_0x8488('0x57')][_0x8488('0x2a')]({'plain':!![]});if(!_0x417afa)throw new Error(_0x8488('0x58'));if(_0x417afa['role']===_0x8488('0x57')){var _0x693741=_0x198328;return db[_0x8488('0x59')][_0x8488('0x50')]({'where':{'name':_0x8488('0x2b'),'userProfileId':_0x417afa['userProfileId']},'raw':!![]})[_0x8488('0x29')](function(_0x5a04d7){if(_0x5a04d7&&_0x5a04d7[_0x8488('0x5a')]===0x0){return db[_0x8488('0x2c')]['create']({'name':_0x693741[_0x8488('0x2f')],'resourceId':_0x693741['id'],'type':_0x5a04d7[_0x8488('0x2f')],'sectionId':_0x5a04d7['id']},{})[_0x8488('0x29')](function(){return _0x198328;});}else{return _0x198328;}})[_0x8488('0x4b')](function(_0x4041e5){logger[_0x8488('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4041e5);throw _0x4041e5;});}return _0x198328;})[_0x8488('0x29')](respondWithResult(_0x4f80fb,null))['catch'](handleError(_0x4f80fb,null));};function Extension(_0x31dcc6,_0x3fa6e2,_0x3c06a4,_0x3fa288){this[_0x8488('0x5b')]=_0x8488('0x5c');this['exten']=_0x31dcc6;this[_0x8488('0x5d')]=_0x3c06a4;this['type']=_0x8488('0x5e');this[_0x8488('0x5f')]=_0x8488('0x60');this[_0x8488('0x61')]=_0x3fa6e2;this[_0x8488('0x62')]=_0x3fa288;}function createVoicePrefixExtensions(_0x24ba2d,_0x4facfb,_0x5755af){return new BPromise(function(_0x5c8310,_0x28ddb0){var _0x1988cf=new Extension(formatPrefixName(_0x24ba2d[_0x8488('0x63')]),0x1,_0x8488('0x64'),_0x8488('0x65'));_0x1988cf[_0x8488('0x66')]=_0x24ba2d['id'];return db[_0x8488('0x67')][_0x8488('0x52')](_0x1988cf,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0xa90a65){var _0x57fdbb=_0xa90a65[_0x8488('0x2a')]({'plain':!![]});var _0x174c57=_[_0x8488('0x31')](addVoicePrefixExtensions(_0x24ba2d,_0x4facfb),function(_0x4ba14e){_0x4ba14e['VoiceExtensionId']=_0x57fdbb['id'];_0x4ba14e[_0x8488('0x66')]=_0x24ba2d['id'];return _0x4ba14e;});return db[_0x8488('0x67')][_0x8488('0x68')](_0x174c57,{'transaction':_0x5755af})[_0x8488('0x29')](function(_0x52bc90){if(!_0x52bc90){return _0x28ddb0('Extensions\x20creation\x20failed');}else{return _0x5c8310(_0x52bc90);}})[_0x8488('0x4b')](function(_0x26e0cc){return _0x28ddb0(_0x26e0cc);});});;});};function addVoicePrefixExtensions(_0x50897,_0x4856fc){var _0x3c3e89=[];var _0x401f4d=formatPrefixName(_0x50897[_0x8488('0x63')]);_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x2,_0x8488('0x6a'),'CDR(prefix)='+_0x50897[_0x8488('0x2f')]));if(_0x50897[_0x8488('0x6b')]){_0x3c3e89['push'](new Extension(_0x401f4d,0x3,_0x8488('0x6a'),_0x8488('0x6c')+_0x50897['callerIdAll']));}else{_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x3,_0x8488('0x64'),_0x8488('0x6d')));}_0x3c3e89[_0x8488('0x69')](new Extension(_0x401f4d,0x4,_0x8488('0x6e'),_0x4856fc[_0x8488('0x5b')]+','+_0x8488('0x6f')+(0x8+_0x50897['name'][_0x8488('0x3d')])+'}'+','+0x1));return _0x3c3e89;}function formatPrefixName(_0x3b7aa8){var _0x480666='_';for(var _0x49ef10=0x0;_0x49ef10<_0x3b7aa8[_0x8488('0x3d')];_0x49ef10++){if(_0x3b7aa8[_0x8488('0x70')](_0x49ef10)=='-'){_0x480666+=_0x3b7aa8[_0x8488('0x70')](_0x49ef10);}else{_0x480666+='['+_0x3b7aa8['charAt'](_0x49ef10)+']';}}_0x480666+='.';return _0x480666;}exports[_0x8488('0x71')]=function(_0x852e08,_0x56b35a,_0x42b5c5){var _0x59da4a=_0x852e08[_0x8488('0x55')];_0x59da4a[_0x8488('0x63')]=_0x8488('0x72')+_0x59da4a['name']+'-';return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x57955d){return db['VoicePrefix'][_0x8488('0x71')](_0x59da4a,{'where':{'id':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x28')]({'where':{'VoicePrefixId':_0x59da4a['id']},'transaction':_0x57955d})[_0x8488('0x29')](function(){return db[_0x8488('0x67')][_0x8488('0x50')]({'where':{'id':_0x59da4a[_0x8488('0x56')]},'raw':!![]})[_0x8488('0x29')](function(_0x1ff111){return createVoicePrefixExtensions(_0x59da4a,_0x1ff111,_0x57955d);});});});})['then'](function(){return db[_0x8488('0x32')]['findById'](_0x59da4a['id']);})[_0x8488('0x29')](respondWithResult(_0x56b35a,null))[_0x8488('0x4b')](handleError(_0x56b35a,null));};exports[_0x8488('0x73')]=function(_0x3349e3,_0x54283a,_0x1b96c5){return db[_0x8488('0x32')]['find']({'where':{'id':_0x3349e3[_0x8488('0x4d')]['id']}})['then'](handleEntityNotFound(_0x54283a,null))[_0x8488('0x29')](function(_0x15b919){if(_0x15b919){return _0x15b919[_0x8488('0x73')](_0x3349e3[_0x8488('0x55')][_0x8488('0x74')],_[_0x8488('0x75')](_0x3349e3[_0x8488('0x55')],[_0x8488('0x74'),'id'])||{})['spread'](function(_0x1ce726){for(var _0x53d87e=0x0;_0x53d87e<_0x3349e3['body'][_0x8488('0x74')][_0x8488('0x3d')];_0x53d87e+=0x1){socket[_0x8488('0x76')]('userVoicePrefix:save',{'UserId':Number(_0x3349e3['body'][_0x8488('0x74')][_0x53d87e]),'VoicePrefixId':Number(_0x3349e3[_0x8488('0x4d')]['id'])});}return _0x1ce726;});}})['then'](respondWithResult(_0x54283a,null))[_0x8488('0x4b')](handleError(_0x54283a,null));};exports[_0x8488('0x77')]=function(_0x924138,_0x173d35,_0x2a3acf){return db[_0x8488('0x32')]['find']({'where':{'id':_0x924138[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x173d35,null))[_0x8488('0x29')](function(_0x4a2fd9){if(_0x4a2fd9){return _0x4a2fd9[_0x8488('0x77')](_0x924138[_0x8488('0x37')][_0x8488('0x74')])['then'](function(){if(_[_0x8488('0x78')](_0x924138[_0x8488('0x37')]['ids'])){for(var _0x48860c=0x0;_0x48860c<_0x924138[_0x8488('0x37')][_0x8488('0x74')]['length'];_0x48860c+=0x1){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':Number(_0x924138['query']['ids'][_0x48860c]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}}else{socket['emit'](_0x8488('0x79'),{'UserId':Number(_0x924138[_0x8488('0x37')][_0x8488('0x74')]),'VoicePrefixId':Number(_0x924138[_0x8488('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x173d35,null))[_0x8488('0x4b')](handleError(_0x173d35,null));};exports['getAgents']=function(_0x2b2989,_0x4d0d20,_0x2f137a){var _0x1a3a2d={};var _0x267401={};var _0x1e635a;var _0x31ab35;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x2b2989[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x4d0d20,null))[_0x8488('0x29')](function(_0xce1d1a){if(_0xce1d1a){_0x1e635a=_0xce1d1a;_0x267401[_0x8488('0x36')]=_[_0x8488('0x38')](db[_0x8488('0x7b')]['rawAttributes']);_0x267401[_0x8488('0x37')]=_[_0x8488('0x38')](_0x2b2989['query']);_0x267401[_0x8488('0x39')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],_0x267401[_0x8488('0x37')]);_0x1a3a2d[_0x8488('0x3a')]=_[_0x8488('0x3b')](_0x267401[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x2b2989[_0x8488('0x37')][_0x8488('0x3c')]));_0x1a3a2d[_0x8488('0x3a')]=_0x1a3a2d['attributes'][_0x8488('0x3d')]?_0x1a3a2d[_0x8488('0x3a')]:_0x267401['model'];_0x1a3a2d[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x2b2989[_0x8488('0x37')][_0x8488('0x41')]);_0x1a3a2d[_0x8488('0x42')]=qs['filters'](_['pick'](_0x2b2989[_0x8488('0x37')],_0x267401[_0x8488('0x39')]));if(_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]){_0x1a3a2d[_0x8488('0x42')]=_[_0x8488('0x45')](_0x1a3a2d[_0x8488('0x42')],{'$or':_[_0x8488('0x31')](_0x1a3a2d[_0x8488('0x3a')],function(_0x167437){var _0x3152d0={};_0x3152d0[_0x167437]={'$like':'%'+_0x2b2989[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x3152d0;})});}_0x1a3a2d=_[_0x8488('0x45')]({},_0x1a3a2d,_0x2b2989[_0x8488('0x4f')]);return _0x1e635a['getAgents'](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x5d5234){if(_0x5d5234){_0x31ab35=_0x5d5234['length'];if(!_0x2b2989[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x1a3a2d[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x2b2989[_0x8488('0x37')][_0x8488('0x21')]);_0x1a3a2d[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x2b2989[_0x8488('0x37')]['offset']);}return _0x1e635a[_0x8488('0x7c')](_0x1a3a2d);}})[_0x8488('0x29')](function(_0x179637){if(_0x179637){return _0x179637?{'count':_0x31ab35,'rows':_0x179637}:null;}})[_0x8488('0x29')](respondWithResult(_0x4d0d20,null))[_0x8488('0x4b')](handleError(_0x4d0d20,null));};exports[_0x8488('0x7d')]=function(_0x47f7c5,_0x2d7a33,_0x5b0d69){var _0x36f6e4={};var _0x3936b6={};var _0x4be018;var _0x57a4e7;return db[_0x8488('0x32')][_0x8488('0x7a')]({'where':{'id':_0x47f7c5[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](handleEntityNotFound(_0x2d7a33,null))[_0x8488('0x29')](function(_0x5718a7){if(_0x5718a7){_0x4be018=_0x5718a7;_0x3936b6[_0x8488('0x36')]=_[_0x8488('0x38')](db['Team']['rawAttributes']);_0x3936b6[_0x8488('0x37')]=_[_0x8488('0x38')](_0x47f7c5[_0x8488('0x37')]);_0x3936b6['filters']=_['intersection'](_0x3936b6[_0x8488('0x36')],_0x3936b6[_0x8488('0x37')]);_0x36f6e4[_0x8488('0x3a')]=_['intersection'](_0x3936b6[_0x8488('0x36')],qs[_0x8488('0x3c')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x3c')]));_0x36f6e4[_0x8488('0x3a')]=_0x36f6e4[_0x8488('0x3a')][_0x8488('0x3d')]?_0x36f6e4[_0x8488('0x3a')]:_0x3936b6[_0x8488('0x36')];_0x36f6e4[_0x8488('0x40')]=qs[_0x8488('0x41')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x41')]);_0x36f6e4['where']=qs[_0x8488('0x39')](_[_0x8488('0x43')](_0x47f7c5[_0x8488('0x37')],_0x3936b6['filters']));if(_0x47f7c5[_0x8488('0x37')]['filter']){_0x36f6e4[_0x8488('0x42')]=_['merge'](_0x36f6e4['where'],{'$or':_[_0x8488('0x31')](_0x36f6e4['attributes'],function(_0x42f36b){var _0x186e19={};_0x186e19[_0x42f36b]={'$like':'%'+_0x47f7c5[_0x8488('0x37')][_0x8488('0x44')]+'%'};return _0x186e19;})});}_0x36f6e4=_['merge']({},_0x36f6e4,_0x47f7c5[_0x8488('0x4f')]);return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})[_0x8488('0x29')](function(_0x37ca73){if(_0x37ca73){_0x57a4e7=_0x37ca73['length'];if(!_0x47f7c5[_0x8488('0x37')][_0x8488('0x3e')](_0x8488('0x3f'))){_0x36f6e4[_0x8488('0x21')]=qs[_0x8488('0x21')](_0x47f7c5['query']['limit']);_0x36f6e4[_0x8488('0x1f')]=qs[_0x8488('0x1f')](_0x47f7c5[_0x8488('0x37')][_0x8488('0x1f')]);}return _0x4be018[_0x8488('0x7d')](_0x36f6e4);}})['then'](function(_0x4806f8){if(_0x4806f8){return _0x4806f8?{'count':_0x57a4e7,'rows':_0x4806f8}:null;}})['then'](respondWithResult(_0x2d7a33,null))[_0x8488('0x4b')](handleError(_0x2d7a33,null));};exports[_0x8488('0x7e')]=function(_0x2bab71,_0x5dacab,_0x30aab3){var _0x6c2e31=_0x2bab71['body'][_0x8488('0x74')];var _0x20cdc8;return db[_0x8488('0x7f')][_0x8488('0x49')]({'where':{'id':_0x6c2e31},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id',_0x8488('0x2f'),_0x8488('0x81'),_0x8488('0x82'),_0x8488('0x83')],'raw':!![]}]})[_0x8488('0x29')](function(_0x13add2){if(_0x13add2){_0x20cdc8=_0x13add2;var _0xa0c692=_['flatMap'](_0x13add2,function(_0x8fc636){var _0x17c6e1=_0x8fc636['get']({'plain':!![]});return _0x17c6e1['Agents'];});return db['VoicePrefix'][_0x8488('0x50')]({'where':{'id':_0x2bab71[_0x8488('0x4d')]['id']}})[_0x8488('0x29')](function(_0x4ba801){return db[_0x8488('0x53')]['transaction'](function(_0x447535){return _0x4ba801[_0x8488('0x7e')](_0x6c2e31,{'transaction':_0x447535})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0x20cdc8,function(_0x1e45ac){return db['TeamVoicePrefix'][_0x8488('0x85')]({'TeamId':_0x1e45ac['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},{'transaction':_0x447535});});})[_0x8488('0x29')](function(){return BPromise[_0x8488('0x84')](_0xa0c692,function(_0x584f02){return db['UserVoicePrefix'][_0x8488('0x86')]({'where':{'UserId':_0x584f02['id'],'VoicePrefixId':_0x2bab71[_0x8488('0x4d')]['id']},'transaction':_0x447535});});})[_0x8488('0x29')](function(){_0xa0c692[_0x8488('0x87')](function(_0x2f8191){socket[_0x8488('0x76')](_0x8488('0x88'),{'UserId':_0x2f8191['id'],'VoicePrefixId':_0x4ba801['id']});});});});});}})[_0x8488('0x29')](respondWithStatusCode(_0x5dacab,null))[_0x8488('0x4b')](handleError(_0x5dacab,null));};exports[_0x8488('0x89')]=function(_0x1f5a8b,_0x1e7617,_0x315136){return db[_0x8488('0x7f')]['findAll']({'where':{'id':_0x1f5a8b['query'][_0x8488('0x74')]},'attributes':['id'],'include':[{'model':db[_0x8488('0x7b')],'as':_0x8488('0x80'),'attributes':['id'],'raw':!![]}]})[_0x8488('0x29')](handleEntityNotFound(_0x1e7617,null))[_0x8488('0x29')](function(_0x22f2de){var _0x280c77=_[_0x8488('0x31')](_0x22f2de,'id');var _0x2a822b=[];var _0x4d611a=[];var _0x46195e=squel[_0x8488('0x8a')]();_0x46195e[_0x8488('0x8b')]('tq.TeamId')[_0x8488('0x8c')](_0x8488('0x8d'),'tq')[_0x8488('0x8e')](_0x8488('0x8f'),'ut',_0x8488('0x90'))[_0x8488('0x42')](_0x8488('0x91'),_0x1f5a8b[_0x8488('0x4d')]['id']);for(var _0x4a7be5=0x0;_0x4a7be5<_0x22f2de['length'];_0x4a7be5+=0x1){let _0x548a7a=_0x22f2de[_0x4a7be5];for(var _0x215d7e=0x0;_0x215d7e<_0x548a7a[_0x8488('0x80')][_0x8488('0x3d')];_0x215d7e+=0x1){let _0x1865f5=_0x548a7a[_0x8488('0x80')][_0x215d7e];var _0x2966ec=_0x46195e['clone']();_0x2966ec[_0x8488('0x42')]('ut.UserId\x20=\x20?',_0x1865f5['id']);_0x4d611a[_0x8488('0x69')](db[_0x8488('0x53')][_0x8488('0x37')](_0x2966ec[_0x8488('0x92')](),{'type':db[_0x8488('0x53')]['QueryTypes'][_0x8488('0x93')]})[_0x8488('0x29')](function(_0x300294){if(_0x300294[_0x8488('0x3d')]===0x1){return _0x1865f5['id'];}else{var _0x14e4a9=_[_0x8488('0x94')](_[_0x8488('0x31')](_0x300294,'TeamId'),function(_0x36600b){return _['includes'](_0x280c77,_0x36600b);});if(_0x14e4a9){return _0x1865f5['id'];}}}));}}return BPromise['all'](_0x4d611a)[_0x8488('0x29')](function(_0x323343){_0x2a822b=_(_0x2a822b)['union'](_0x323343)[_0x8488('0x95')]()[_0x8488('0x96')]();return db[_0x8488('0x32')][_0x8488('0x50')]({'where':{'id':_0x1f5a8b[_0x8488('0x4d')]['id']}})['then'](function(_0x541b76){return db[_0x8488('0x53')][_0x8488('0x54')](function(_0x3e2f85){return _0x541b76[_0x8488('0x89')](_0x1f5a8b[_0x8488('0x37')]['ids'],{'transaction':_0x3e2f85})['then'](function(){if(!_[_0x8488('0x97')](_0x2a822b)){return _0x541b76[_0x8488('0x77')](_0x2a822b,{'transaction':_0x3e2f85});}})[_0x8488('0x29')](function(){_0x2a822b[_0x8488('0x87')](function(_0x258985){socket[_0x8488('0x76')](_0x8488('0x79'),{'UserId':_0x258985,'VoicePrefixId':_0x541b76['id']});});});});});});})[_0x8488('0x29')](respondWithStatusCode(_0x1e7617,null))[_0x8488('0x4b')](handleError(_0x1e7617,null));}; \ No newline at end of file +var _0xdd4f=['lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','VoicePrefixes','UserProfileResource','destroy','error','stack','name','send','map','VoicePrefix','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','describe','create','transaction','body','VoiceExtension','find','VoiceExtensionId','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','CDR(prefix)=','callerIdAll','push','PREFIX-CALLERIDALL=','No\x20callerid\x20available','charAt','update','system-','sequelize','findById','addAgents','spread','ids','emit','userVoicePrefix:save','removeAgents','isArray','getAgents','findOne','rawAttributes','order','getTeams','Team','nolimit','findAll','User','Agents','online','voicePause','interface','flatMap','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','removeTeams','userVoicePrefix:remove','eml-format','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x5b136e,_0xb0d839){var _0x1dcbaf=function(_0x4d2797){while(--_0x4d2797){_0x5b136e['push'](_0x5b136e['shift']());}};_0x1dcbaf(++_0xb0d839);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1e463c,_0x44cee9){_0x1e463c=_0x1e463c-0x0;var _0x3b84d6=_0xdd4f[_0x1e463c];return _0x3b84d6;};'use strict';var emlformat=require(_0xfdd4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xfdd4('0x1'));var moment=require(_0xfdd4('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xfdd4('0x3'));var util=require(_0xfdd4('0x4'));var path=require(_0xfdd4('0x5'));var sox=require('sox');var csv=require(_0xfdd4('0x6'));var ejs=require(_0xfdd4('0x7'));var fs=require('fs');var fs_extra=require(_0xfdd4('0x8'));var _=require(_0xfdd4('0x9'));var squel=require(_0xfdd4('0xa'));var crypto=require('crypto');var jsforce=require(_0xfdd4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xfdd4('0x6'));var querystring=require(_0xfdd4('0xc'));var Papa=require(_0xfdd4('0xd'));var Redis=require('ioredis');var authService=require(_0xfdd4('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xfdd4('0xf'));var hardwareService=require(_0xfdd4('0x10'));var logger=require(_0xfdd4('0x11'))(_0xfdd4('0x12'));var utils=require(_0xfdd4('0x13'));var config=require(_0xfdd4('0x14'));var licenseUtil=require(_0xfdd4('0x15'));var db=require(_0xfdd4('0x16'))['db'];config[_0xfdd4('0x17')]=_[_0xfdd4('0x18')](config[_0xfdd4('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xfdd4('0x19'))(new Redis(config[_0xfdd4('0x17')]));require(_0xfdd4('0x1a'))['register'](socket);function respondWithStatusCode(_0x1b7da1,_0x4aaeee){_0x4aaeee=_0x4aaeee||0xcc;return function(_0x467824){if(_0x467824){return _0x1b7da1[_0xfdd4('0x1b')](_0x4aaeee);}return _0x1b7da1[_0xfdd4('0x1c')](_0x4aaeee)[_0xfdd4('0x1d')]();};}function respondWithResult(_0x37b05f,_0x52cf2c){_0x52cf2c=_0x52cf2c||0xc8;return function(_0x47ed1d){if(_0x47ed1d){return _0x37b05f['status'](_0x52cf2c)[_0xfdd4('0x1e')](_0x47ed1d);}};}function respondWithFilteredResult(_0x216c7e,_0x2eb174){return function(_0x2ccc88){if(_0x2ccc88){var _0x32b5f7=typeof _0x2eb174[_0xfdd4('0x1f')]===_0xfdd4('0x20')&&typeof _0x2eb174[_0xfdd4('0x21')]===_0xfdd4('0x20');var _0x52ce34=_0x2ccc88[_0xfdd4('0x22')];var _0x3e8eac=_0x32b5f7?0x0:_0x2eb174[_0xfdd4('0x1f')];var _0x36e611=_0x32b5f7?_0x2ccc88[_0xfdd4('0x22')]:_0x2eb174[_0xfdd4('0x1f')]+_0x2eb174[_0xfdd4('0x21')];var _0x34dfa8;if(_0x36e611>=_0x52ce34){_0x36e611=_0x52ce34;_0x34dfa8=0xc8;}else{_0x34dfa8=0xce;}_0x216c7e['status'](_0x34dfa8);return _0x216c7e[_0xfdd4('0x23')](_0xfdd4('0x24'),_0x3e8eac+'-'+_0x36e611+'/'+_0x52ce34)[_0xfdd4('0x1e')](_0x2ccc88);}return null;};}function patchUpdates(_0x16e81b){return function(_0xb7856d){try{jsonpatch[_0xfdd4('0x25')](_0xb7856d,_0x16e81b,!![]);}catch(_0x451767){return BPromise[_0xfdd4('0x26')](_0x451767);}return _0xb7856d['save']();};}function saveUpdates(_0x1e14da,_0x1112e8){return function(_0x4397a3){if(_0x4397a3){return _0x4397a3['update'](_0x1e14da)[_0xfdd4('0x27')](function(_0x39b712){return _0x39b712;});}return null;};}function removeEntity(_0xf9c346,_0x2f8268){return function(_0x1ade42){if(_0x1ade42){return _0x1ade42['destroy']()[_0xfdd4('0x27')](function(){var _0x2c88ad=_0x1ade42[_0xfdd4('0x28')]({'plain':!![]});var _0x31e053=_0xfdd4('0x29');return db[_0xfdd4('0x2a')][_0xfdd4('0x2b')]({'where':{'type':_0x31e053,'resourceId':_0x2c88ad['id']}})[_0xfdd4('0x27')](function(){return _0x1ade42;});})['then'](function(){_0xf9c346[_0xfdd4('0x1c')](0xcc)[_0xfdd4('0x1d')]();});}};}function handleEntityNotFound(_0x385a68,_0xef012e){return function(_0x2207ae){if(!_0x2207ae){_0x385a68['sendStatus'](0x194);}return _0x2207ae;};}function handleError(_0xd127b1,_0x3372d2){_0x3372d2=_0x3372d2||0x1f4;return function(_0xbf38b4){logger[_0xfdd4('0x2c')](_0xbf38b4[_0xfdd4('0x2d')]);if(_0xbf38b4['name']){delete _0xbf38b4[_0xfdd4('0x2e')];}_0xd127b1[_0xfdd4('0x1c')](_0x3372d2)[_0xfdd4('0x2f')](_0xbf38b4);};}exports['index']=function(_0x3fd07a,_0x502776){var _0x2a65c8={},_0x2b22f9={},_0x4aa4f2={'count':0x0,'rows':[]};var _0x50b748=_[_0xfdd4('0x30')](db[_0xfdd4('0x31')]['rawAttributes'],function(_0x557d7b){return{'name':_0x557d7b[_0xfdd4('0x32')],'type':_0x557d7b[_0xfdd4('0x33')][_0xfdd4('0x34')]};});_0x2b22f9[_0xfdd4('0x35')]=_[_0xfdd4('0x30')](_0x50b748,_0xfdd4('0x2e'));_0x2b22f9[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x3fd07a[_0xfdd4('0x36')]);_0x2b22f9[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],_0x2b22f9[_0xfdd4('0x36')]);_0x2a65c8[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x2b22f9[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x2a65c8[_0xfdd4('0x3a')]=_0x2a65c8[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x2a65c8[_0xfdd4('0x3a')]:_0x2b22f9[_0xfdd4('0x35')];if(!_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x2a65c8[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x2a65c8[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x3fd07a['query'][_0xfdd4('0x1f')]);}_0x2a65c8['order']=qs[_0xfdd4('0x3e')](_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x3e')]);_0x2a65c8[_0xfdd4('0x3f')]=qs['filters'](_[_0xfdd4('0x40')](_0x3fd07a[_0xfdd4('0x36')],_0x2b22f9[_0xfdd4('0x38')]),_0x50b748);if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x2a65c8[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x2a65c8[_0xfdd4('0x3f')],{'$or':_[_0xfdd4('0x30')](_0x50b748,function(_0x83673d){if(_0x83673d['type']!==_0xfdd4('0x43')){var _0x2196f={};_0x2196f[_0x83673d[_0xfdd4('0x2e')]]={'$like':'%'+_0x3fd07a[_0xfdd4('0x36')]['filter']+'%'};return _0x2196f;}})});}_0x2a65c8=_[_0xfdd4('0x42')]({},_0x2a65c8,_0x3fd07a[_0xfdd4('0x44')]);var _0x30524f={'where':_0x2a65c8[_0xfdd4('0x3f')]};return db[_0xfdd4('0x31')]['count'](_0x30524f)[_0xfdd4('0x27')](function(_0x23af2a){_0x4aa4f2[_0xfdd4('0x22')]=_0x23af2a;if(_0x3fd07a[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x2a65c8[_0xfdd4('0x46')]=[{'all':!![]}];}return db[_0xfdd4('0x31')]['findAll'](_0x2a65c8);})[_0xfdd4('0x27')](function(_0x586713){_0x4aa4f2[_0xfdd4('0x47')]=_0x586713;return _0x4aa4f2;})[_0xfdd4('0x27')](respondWithFilteredResult(_0x502776,_0x2a65c8))[_0xfdd4('0x48')](handleError(_0x502776,null));};exports[_0xfdd4('0x49')]=function(_0x5367aa,_0x419578){var _0x11e90a={'raw':![],'where':{'id':_0x5367aa[_0xfdd4('0x4a')]['id']}},_0x4d1dfe={};_0x4d1dfe[_0xfdd4('0x35')]=_['keys'](db[_0xfdd4('0x31')]['rawAttributes']);_0x4d1dfe['query']=_['keys'](_0x5367aa[_0xfdd4('0x36')]);_0x4d1dfe[_0xfdd4('0x38')]=_[_0xfdd4('0x39')](_0x4d1dfe['model'],_0x4d1dfe[_0xfdd4('0x36')]);_0x11e90a[_0xfdd4('0x3a')]=_['intersection'](_0x4d1dfe[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x11e90a[_0xfdd4('0x3a')]=_0x11e90a[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x11e90a[_0xfdd4('0x3a')]:_0x4d1dfe[_0xfdd4('0x35')];if(_0x5367aa[_0xfdd4('0x36')][_0xfdd4('0x45')]){_0x11e90a[_0xfdd4('0x46')]=[{'all':!![]}];}_0x11e90a=_[_0xfdd4('0x42')]({},_0x11e90a,_0x5367aa[_0xfdd4('0x44')]);return db['VoicePrefix']['find'](_0x11e90a)[_0xfdd4('0x27')](handleEntityNotFound(_0x419578,null))[_0xfdd4('0x27')](respondWithResult(_0x419578,null))[_0xfdd4('0x48')](handleError(_0x419578,null));};exports[_0xfdd4('0x2b')]=function(_0x507bf5,_0x3c6828){return db[_0xfdd4('0x31')]['find']({'where':{'id':_0x507bf5['params']['id']}})['then'](handleEntityNotFound(_0x3c6828,null))['then'](removeEntity(_0x3c6828,null))['catch'](handleError(_0x3c6828,null));};exports[_0xfdd4('0x4b')]=function(_0x88e9ef,_0x3a4202){return db[_0xfdd4('0x31')][_0xfdd4('0x4b')]()[_0xfdd4('0x27')](respondWithResult(_0x3a4202,null))['catch'](handleError(_0x3a4202,null));};exports[_0xfdd4('0x4c')]=function(_0x1f521a,_0x1dd417){var _0x2355b5;return db['sequelize'][_0xfdd4('0x4d')](function(_0x8aa0ea){return db['VoicePrefix'][_0xfdd4('0x4c')](_0x1f521a[_0xfdd4('0x4e')],{'transaction':_0x8aa0ea})['then'](function(_0x5467d1){_0x2355b5=_0x5467d1[_0xfdd4('0x28')]({'plain':!![]});return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x2355b5[_0xfdd4('0x51')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x1b9979){return createVoicePrefixExtensions(_0x2355b5,_0x1b9979,_0x8aa0ea);});});})[_0xfdd4('0x27')](function(){var _0x3de4fd=_0x1f521a['user'][_0xfdd4('0x28')]({'plain':!![]});if(!_0x3de4fd)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3de4fd['role']===_0xfdd4('0x52')){var _0x1d9a8d=_0x2355b5;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3de4fd[_0xfdd4('0x53')]},'raw':!![]})[_0xfdd4('0x27')](function(_0x4dc113){if(_0x4dc113&&_0x4dc113[_0xfdd4('0x54')]===0x0){return db[_0xfdd4('0x2a')][_0xfdd4('0x4c')]({'name':_0x1d9a8d[_0xfdd4('0x2e')],'resourceId':_0x1d9a8d['id'],'type':_0x4dc113[_0xfdd4('0x2e')],'sectionId':_0x4dc113['id']},{})['then'](function(){return _0x2355b5;});}else{return _0x2355b5;}})['catch'](function(_0x483942){logger['error'](_0xfdd4('0x55'),_0x483942);throw _0x483942;});}return _0x2355b5;})[_0xfdd4('0x27')](respondWithResult(_0x1dd417,null))['catch'](handleError(_0x1dd417,null));};function Extension(_0x1eee3d,_0x2abe50,_0x4d4304,_0x45dcc8){this[_0xfdd4('0x56')]='from-sip';this[_0xfdd4('0x57')]=_0x1eee3d;this[_0xfdd4('0x58')]=_0x4d4304;this[_0xfdd4('0x33')]='system';this[_0xfdd4('0x59')]=_0xfdd4('0x5a');this[_0xfdd4('0x5b')]=_0x2abe50;this[_0xfdd4('0x5c')]=_0x45dcc8;}function createVoicePrefixExtensions(_0x5c7be,_0x562417,_0x2cc3e2){return new BPromise(function(_0x2ee4b6,_0x3be4d5){var _0x202124=new Extension(formatPrefixName(_0x5c7be[_0xfdd4('0x5d')]),0x1,_0xfdd4('0x5e'),_0xfdd4('0x5f'));_0x202124[_0xfdd4('0x60')]=_0x5c7be['id'];return db[_0xfdd4('0x4f')]['create'](_0x202124,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x2799b2){var _0x4483e1=_0x2799b2[_0xfdd4('0x28')]({'plain':!![]});var _0x3096fa=_['map'](addVoicePrefixExtensions(_0x5c7be,_0x562417),function(_0x46e7eb){_0x46e7eb[_0xfdd4('0x51')]=_0x4483e1['id'];_0x46e7eb[_0xfdd4('0x60')]=_0x5c7be['id'];return _0x46e7eb;});return db[_0xfdd4('0x4f')][_0xfdd4('0x61')](_0x3096fa,{'transaction':_0x2cc3e2})[_0xfdd4('0x27')](function(_0x180ad9){if(!_0x180ad9){return _0x3be4d5(_0xfdd4('0x62'));}else{return _0x2ee4b6(_0x180ad9);}})[_0xfdd4('0x48')](function(_0x2a0dd8){return _0x3be4d5(_0x2a0dd8);});});;});};function addVoicePrefixExtensions(_0x2fff30,_0x2792c4){var _0x1205b8=[];var _0x527068=formatPrefixName(_0x2fff30[_0xfdd4('0x5d')]);_0x1205b8['push'](new Extension(_0x527068,0x2,_0xfdd4('0x63'),_0xfdd4('0x64')+_0x2fff30[_0xfdd4('0x2e')]));if(_0x2fff30[_0xfdd4('0x65')]){_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x63'),_0xfdd4('0x67')+_0x2fff30[_0xfdd4('0x65')]));}else{_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x3,_0xfdd4('0x5e'),_0xfdd4('0x68')));}_0x1205b8[_0xfdd4('0x66')](new Extension(_0x527068,0x4,'goto',_0x2792c4['context']+','+'${EXTEN:'+(0x8+_0x2fff30[_0xfdd4('0x2e')][_0xfdd4('0x3c')])+'}'+','+0x1));return _0x1205b8;}function formatPrefixName(_0x4bb18b){var _0x3a367c='_';for(var _0x3f027b=0x0;_0x3f027b<_0x4bb18b[_0xfdd4('0x3c')];_0x3f027b++){if(_0x4bb18b[_0xfdd4('0x69')](_0x3f027b)=='-'){_0x3a367c+=_0x4bb18b[_0xfdd4('0x69')](_0x3f027b);}else{_0x3a367c+='['+_0x4bb18b['charAt'](_0x3f027b)+']';}}_0x3a367c+='.';return _0x3a367c;}exports[_0xfdd4('0x6a')]=function(_0x297432,_0x3958cd,_0x523085){var _0x366f1c=_0x297432['body'];_0x366f1c[_0xfdd4('0x5d')]=_0xfdd4('0x6b')+_0x366f1c[_0xfdd4('0x2e')]+'-';return db[_0xfdd4('0x6c')]['transaction'](function(_0x2351b6){return db[_0xfdd4('0x31')]['update'](_0x366f1c,{'where':{'id':_0x366f1c['id']},'transaction':_0x2351b6})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x2b')]({'where':{'VoicePrefixId':_0x366f1c['id']},'transaction':_0x2351b6})['then'](function(){return db[_0xfdd4('0x4f')][_0xfdd4('0x50')]({'where':{'id':_0x366f1c[_0xfdd4('0x51')]},'raw':!![]})['then'](function(_0x3f4337){return createVoicePrefixExtensions(_0x366f1c,_0x3f4337,_0x2351b6);});});});})[_0xfdd4('0x27')](function(){return db[_0xfdd4('0x31')][_0xfdd4('0x6d')](_0x366f1c['id']);})[_0xfdd4('0x27')](respondWithResult(_0x3958cd,null))[_0xfdd4('0x48')](handleError(_0x3958cd,null));};exports[_0xfdd4('0x6e')]=function(_0x539d3b,_0x147d54,_0x36b615){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x539d3b[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x147d54,null))[_0xfdd4('0x27')](function(_0x4987d6){if(_0x4987d6){return _0x4987d6['addAgents'](_0x539d3b[_0xfdd4('0x4e')]['ids'],_['omit'](_0x539d3b[_0xfdd4('0x4e')],['ids','id'])||{})[_0xfdd4('0x6f')](function(_0x51711a){for(var _0x4576ce=0x0;_0x4576ce<_0x539d3b[_0xfdd4('0x4e')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0x4576ce+=0x1){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':Number(_0x539d3b[_0xfdd4('0x4e')]['ids'][_0x4576ce]),'VoicePrefixId':Number(_0x539d3b['params']['id'])});}return _0x51711a;});}})[_0xfdd4('0x27')](respondWithResult(_0x147d54,null))['catch'](handleError(_0x147d54,null));};exports[_0xfdd4('0x73')]=function(_0x1a82ee,_0x3b205f,_0x1d57f8){return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x1a82ee[_0xfdd4('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3b205f,null))['then'](function(_0x37a342){if(_0x37a342){return _0x37a342[_0xfdd4('0x73')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])[_0xfdd4('0x27')](function(){if(_[_0xfdd4('0x74')](_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')])){for(var _0xf78c69=0x0;_0xf78c69<_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')][_0xfdd4('0x3c')];_0xf78c69+=0x1){socket[_0xfdd4('0x71')]('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee['query'][_0xfdd4('0x70')][_0xf78c69]),'VoicePrefixId':Number(_0x1a82ee[_0xfdd4('0x4a')]['id'])});}}else{socket['emit']('userVoicePrefix:remove',{'UserId':Number(_0x1a82ee[_0xfdd4('0x36')][_0xfdd4('0x70')]),'VoicePrefixId':Number(_0x1a82ee['params']['id'])});}});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x3b205f,null))[_0xfdd4('0x48')](handleError(_0x3b205f,null));};exports[_0xfdd4('0x75')]=function(_0x11db43,_0x5ec62b,_0x25c078){var _0x5d356c={};var _0x3924c7={};var _0x2f65d7;var _0x4783b9;return db[_0xfdd4('0x31')][_0xfdd4('0x76')]({'where':{'id':_0x11db43[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x5ec62b,null))[_0xfdd4('0x27')](function(_0x575bc2){if(_0x575bc2){_0x2f65d7=_0x575bc2;_0x3924c7['model']=_[_0xfdd4('0x37')](db['User'][_0xfdd4('0x77')]);_0x3924c7[_0xfdd4('0x36')]=_[_0xfdd4('0x37')](_0x11db43[_0xfdd4('0x36')]);_0x3924c7[_0xfdd4('0x38')]=_['intersection'](_0x3924c7['model'],_0x3924c7[_0xfdd4('0x36')]);_0x5d356c['attributes']=_[_0xfdd4('0x39')](_0x3924c7['model'],qs[_0xfdd4('0x3b')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3b')]));_0x5d356c[_0xfdd4('0x3a')]=_0x5d356c[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x5d356c[_0xfdd4('0x3a')]:_0x3924c7[_0xfdd4('0x35')];_0x5d356c[_0xfdd4('0x78')]=qs[_0xfdd4('0x3e')](_0x11db43[_0xfdd4('0x36')]['sort']);_0x5d356c[_0xfdd4('0x3f')]=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x11db43[_0xfdd4('0x36')],_0x3924c7[_0xfdd4('0x38')]));if(_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x41')]){_0x5d356c[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x5d356c['where'],{'$or':_['map'](_0x5d356c[_0xfdd4('0x3a')],function(_0x244d6d){var _0x30bd32={};_0x30bd32[_0x244d6d]={'$like':'%'+_0x11db43['query'][_0xfdd4('0x41')]+'%'};return _0x30bd32;})});}_0x5d356c=_[_0xfdd4('0x42')]({},_0x5d356c,_0x11db43[_0xfdd4('0x44')]);return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})['then'](function(_0x5868e6){if(_0x5868e6){_0x4783b9=_0x5868e6[_0xfdd4('0x3c')];if(!_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x3d')]('nolimit')){_0x5d356c[_0xfdd4('0x21')]=qs[_0xfdd4('0x21')](_0x11db43[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x5d356c[_0xfdd4('0x1f')]=qs[_0xfdd4('0x1f')](_0x11db43['query']['offset']);}return _0x2f65d7[_0xfdd4('0x75')](_0x5d356c);}})[_0xfdd4('0x27')](function(_0x6a1410){if(_0x6a1410){return _0x6a1410?{'count':_0x4783b9,'rows':_0x6a1410}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x5ec62b,null))[_0xfdd4('0x48')](handleError(_0x5ec62b,null));};exports[_0xfdd4('0x79')]=function(_0x46edc9,_0x2a4366,_0x5d1a3f){var _0x218d83={};var _0x547c4c={};var _0x464eb0;var _0x1871d6;return db['VoicePrefix'][_0xfdd4('0x76')]({'where':{'id':_0x46edc9[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](handleEntityNotFound(_0x2a4366,null))[_0xfdd4('0x27')](function(_0x3cd7ae){if(_0x3cd7ae){_0x464eb0=_0x3cd7ae;_0x547c4c[_0xfdd4('0x35')]=_[_0xfdd4('0x37')](db[_0xfdd4('0x7a')][_0xfdd4('0x77')]);_0x547c4c['query']=_[_0xfdd4('0x37')](_0x46edc9['query']);_0x547c4c[_0xfdd4('0x38')]=_['intersection'](_0x547c4c['model'],_0x547c4c[_0xfdd4('0x36')]);_0x218d83[_0xfdd4('0x3a')]=_[_0xfdd4('0x39')](_0x547c4c[_0xfdd4('0x35')],qs[_0xfdd4('0x3b')](_0x46edc9['query'][_0xfdd4('0x3b')]));_0x218d83[_0xfdd4('0x3a')]=_0x218d83[_0xfdd4('0x3a')][_0xfdd4('0x3c')]?_0x218d83[_0xfdd4('0x3a')]:_0x547c4c[_0xfdd4('0x35')];_0x218d83['order']=qs[_0xfdd4('0x3e')](_0x46edc9[_0xfdd4('0x36')]['sort']);_0x218d83['where']=qs[_0xfdd4('0x38')](_[_0xfdd4('0x40')](_0x46edc9[_0xfdd4('0x36')],_0x547c4c['filters']));if(_0x46edc9['query'][_0xfdd4('0x41')]){_0x218d83[_0xfdd4('0x3f')]=_[_0xfdd4('0x42')](_0x218d83['where'],{'$or':_['map'](_0x218d83[_0xfdd4('0x3a')],function(_0xd6eb47){var _0x1927ed={};_0x1927ed[_0xd6eb47]={'$like':'%'+_0x46edc9['query'][_0xfdd4('0x41')]+'%'};return _0x1927ed;})});}_0x218d83=_['merge']({},_0x218d83,_0x46edc9[_0xfdd4('0x44')]);return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x4e1dbc){if(_0x4e1dbc){_0x1871d6=_0x4e1dbc[_0xfdd4('0x3c')];if(!_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x3d')](_0xfdd4('0x7b'))){_0x218d83[_0xfdd4('0x21')]=qs['limit'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x21')]);_0x218d83[_0xfdd4('0x1f')]=qs['offset'](_0x46edc9[_0xfdd4('0x36')][_0xfdd4('0x1f')]);}return _0x464eb0[_0xfdd4('0x79')](_0x218d83);}})[_0xfdd4('0x27')](function(_0x56e5d3){if(_0x56e5d3){return _0x56e5d3?{'count':_0x1871d6,'rows':_0x56e5d3}:null;}})[_0xfdd4('0x27')](respondWithResult(_0x2a4366,null))['catch'](handleError(_0x2a4366,null));};exports['addTeams']=function(_0x528004,_0x206a59,_0x545475){var _0x5e5362=_0x528004['body'][_0xfdd4('0x70')];var _0x728e25;return db[_0xfdd4('0x7a')][_0xfdd4('0x7c')]({'where':{'id':_0x5e5362},'attributes':['id'],'include':[{'model':db[_0xfdd4('0x7d')],'as':_0xfdd4('0x7e'),'attributes':['id',_0xfdd4('0x2e'),_0xfdd4('0x7f'),_0xfdd4('0x80'),_0xfdd4('0x81')],'raw':!![]}]})[_0xfdd4('0x27')](function(_0x2911ca){if(_0x2911ca){_0x728e25=_0x2911ca;var _0x31303f=_[_0xfdd4('0x82')](_0x2911ca,function(_0x46b927){var _0x450c67=_0x46b927[_0xfdd4('0x28')]({'plain':!![]});return _0x450c67[_0xfdd4('0x7e')];});return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x528004[_0xfdd4('0x4a')]['id']}})[_0xfdd4('0x27')](function(_0x189baf){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x22f93b){return _0x189baf['addTeams'](_0x5e5362,{'transaction':_0x22f93b})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x728e25,function(_0xaef5e2){return db[_0xfdd4('0x84')][_0xfdd4('0x85')]({'TeamId':_0xaef5e2['id'],'VoicePrefixId':_0x528004['params']['id']},{'transaction':_0x22f93b});});})[_0xfdd4('0x27')](function(){return BPromise[_0xfdd4('0x83')](_0x31303f,function(_0x19b679){return db[_0xfdd4('0x86')][_0xfdd4('0x87')]({'where':{'UserId':_0x19b679['id'],'VoicePrefixId':_0x528004[_0xfdd4('0x4a')]['id']},'transaction':_0x22f93b});});})['then'](function(){_0x31303f[_0xfdd4('0x88')](function(_0x1a9e62){socket[_0xfdd4('0x71')](_0xfdd4('0x72'),{'UserId':_0x1a9e62['id'],'VoicePrefixId':_0x189baf['id']});});});});});}})[_0xfdd4('0x27')](respondWithStatusCode(_0x206a59,null))[_0xfdd4('0x48')](handleError(_0x206a59,null));};exports['removeTeams']=function(_0x2a6a0d,_0x3d82d1,_0x17d272){return db['Team'][_0xfdd4('0x7c')]({'where':{'id':_0x2a6a0d[_0xfdd4('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xfdd4('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xfdd4('0x27')](handleEntityNotFound(_0x3d82d1,null))[_0xfdd4('0x27')](function(_0xd07645){var _0x5a3249=_[_0xfdd4('0x30')](_0xd07645,'id');var _0x5b22b1=[];var _0xc9955e=[];var _0x42204a=squel[_0xfdd4('0x89')]();_0x42204a[_0xfdd4('0x8a')](_0xfdd4('0x8b'))[_0xfdd4('0x8c')](_0xfdd4('0x8d'),'tq')[_0xfdd4('0x8e')](_0xfdd4('0x8f'),'ut',_0xfdd4('0x90'))[_0xfdd4('0x3f')]('VoicePrefixId\x20=\x20?',_0x2a6a0d[_0xfdd4('0x4a')]['id']);for(var _0x42a3dc=0x0;_0x42a3dc<_0xd07645[_0xfdd4('0x3c')];_0x42a3dc+=0x1){let _0x26316c=_0xd07645[_0x42a3dc];for(var _0x1e7bbb=0x0;_0x1e7bbb<_0x26316c[_0xfdd4('0x7e')]['length'];_0x1e7bbb+=0x1){let _0xfd0c1=_0x26316c[_0xfdd4('0x7e')][_0x1e7bbb];var _0x2ae92=_0x42204a[_0xfdd4('0x91')]();_0x2ae92['where'](_0xfdd4('0x92'),_0xfd0c1['id']);_0xc9955e[_0xfdd4('0x66')](db['sequelize'][_0xfdd4('0x36')](_0x2ae92[_0xfdd4('0x93')](),{'type':db[_0xfdd4('0x6c')][_0xfdd4('0x94')][_0xfdd4('0x95')]})[_0xfdd4('0x27')](function(_0x191ab6){if(_0x191ab6[_0xfdd4('0x3c')]===0x1){return _0xfd0c1['id'];}else{var _0x1d460f=_[_0xfdd4('0x96')](_[_0xfdd4('0x30')](_0x191ab6,_0xfdd4('0x97')),function(_0x25c508){return _[_0xfdd4('0x98')](_0x5a3249,_0x25c508);});if(_0x1d460f){return _0xfd0c1['id'];}}}));}}return BPromise['all'](_0xc9955e)[_0xfdd4('0x27')](function(_0x349fc6){_0x5b22b1=_(_0x5b22b1)[_0xfdd4('0x99')](_0x349fc6)[_0xfdd4('0x9a')]()['value']();return db[_0xfdd4('0x31')][_0xfdd4('0x50')]({'where':{'id':_0x2a6a0d['params']['id']}})[_0xfdd4('0x27')](function(_0x401681){return db[_0xfdd4('0x6c')][_0xfdd4('0x4d')](function(_0x5a7c85){return _0x401681[_0xfdd4('0x9b')](_0x2a6a0d['query'][_0xfdd4('0x70')],{'transaction':_0x5a7c85})[_0xfdd4('0x27')](function(){if(!_['isEmpty'](_0x5b22b1)){return _0x401681[_0xfdd4('0x73')](_0x5b22b1,{'transaction':_0x5a7c85});}})['then'](function(){_0x5b22b1['forEach'](function(_0x10a396){socket[_0xfdd4('0x71')](_0xfdd4('0x9c'),{'UserId':_0x10a396,'VoicePrefixId':_0x401681['id']});});});});});});})[_0xfdd4('0x27')](respondWithStatusCode(_0x3d82d1,null))['catch'](handleError(_0x3d82d1,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index e20ddc6..b269216 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 _0x6539=['emit','hasOwnProperty','hook','../../mysqldb','VoicePrefix','save','update','remove'];(function(_0x4f38b2,_0x574021){var _0x40f571=function(_0xee31c1){while(--_0xee31c1){_0x4f38b2['push'](_0x4f38b2['shift']());}};_0x40f571(++_0x574021);}(_0x6539,0x8b));var _0x9653=function(_0x25c659,_0x1d2278){_0x25c659=_0x25c659-0x0;var _0x4cad19=_0x6539[_0x25c659];return _0x4cad19;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x9653('0x0'))['db'][_0x9653('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9653('0x2'),'afterUpdate':_0x9653('0x3'),'afterDestroy':_0x9653('0x4')};function emitEvent(_0x194048){return function(_0x556003,_0x32c519,_0x102708){VoicePrefixEvents[_0x9653('0x5')](_0x194048+':'+_0x556003['id'],_0x556003);VoicePrefixEvents['emit'](_0x194048,_0x556003);_0x102708(null);};}for(var e in events){if(events[_0x9653('0x6')](e)){var event=events[e];VoicePrefix[_0x9653('0x7')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x4eb5=['../../mysqldb','VoicePrefix','setMaxListeners','remove','emit','hook','exports'];(function(_0x4d73bf,_0x49736c){var _0x529da7=function(_0x174a34){while(--_0x174a34){_0x4d73bf['push'](_0x4d73bf['shift']());}};_0x529da7(++_0x49736c);}(_0x4eb5,0x150));var _0x54eb=function(_0x3ad227,_0x5abebe){_0x3ad227=_0x3ad227-0x0;var _0x41d5d5=_0x4eb5[_0x3ad227];return _0x41d5d5;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0x54eb('0x0'))['db'][_0x54eb('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x54eb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x54eb('0x3')};function emitEvent(_0x59e4f4){return function(_0x434466,_0xb67579,_0x37b4b5){VoicePrefixEvents[_0x54eb('0x4')](_0x59e4f4+':'+_0x434466['id'],_0x434466);VoicePrefixEvents['emit'](_0x59e4f4,_0x434466);_0x37b4b5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix[_0x54eb('0x5')](e,emitEvent(event));}}module[_0x54eb('0x6')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 4218c7b..bce4366 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 _0x7710=['bluebird','request-promise','path','rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','api','moment'];(function(_0x118040,_0x57ccc4){var _0x309a92=function(_0x547100){while(--_0x547100){_0x118040['push'](_0x118040['shift']());}};_0x309a92(++_0x57ccc4);}(_0x7710,0x14e));var _0x0771=function(_0x294cca,_0x2d3b8a){_0x294cca=_0x294cca-0x0;var _0x53054b=_0x7710[_0x294cca];return _0x53054b;};'use strict';var _=require(_0x0771('0x0'));var util=require(_0x0771('0x1'));var logger=require('../../config/logger')(_0x0771('0x2'));var moment=require(_0x0771('0x3'));var BPromise=require(_0x0771('0x4'));var rp=require(_0x0771('0x5'));var fs=require('fs');var path=require(_0x0771('0x6'));var rimraf=require(_0x0771('0x7'));var config=require('../../config/environment');var attributes=require(_0x0771('0x8'));module[_0x0771('0x9')]=function(_0x5ca64f,_0x1fa145){return _0x5ca64f[_0x0771('0xa')](_0x0771('0xb'),attributes,{'tableName':_0x0771('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x89fc=['voice_prefixes','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix'];(function(_0x4ac8ef,_0x5c2c6e){var _0x3a9239=function(_0x3d004e){while(--_0x3d004e){_0x4ac8ef['push'](_0x4ac8ef['shift']());}};_0x3a9239(++_0x5c2c6e);}(_0x89fc,0xaa));var _0xc89f=function(_0x50b85,_0x1fa97e){_0x50b85=_0x50b85-0x0;var _0x2a4a75=_0x89fc[_0x50b85];return _0x2a4a75;};'use strict';var _=require(_0xc89f('0x0'));var util=require(_0xc89f('0x1'));var logger=require(_0xc89f('0x2'))(_0xc89f('0x3'));var moment=require(_0xc89f('0x4'));var BPromise=require(_0xc89f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc89f('0x6'));var config=require(_0xc89f('0x7'));var attributes=require(_0xc89f('0x8'));module[_0xc89f('0x9')]=function(_0xedc13d,_0x41ae2f){return _0xedc13d[_0xc89f('0xa')](_0xc89f('0xb'),attributes,{'tableName':_0xc89f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 33b9c57..ba5a3f0 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 _0x4d49=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register'];(function(_0x846ae8,_0x33a70b){var _0x356b00=function(_0xa96f69){while(--_0xa96f69){_0x846ae8['push'](_0x846ae8['shift']());}};_0x356b00(++_0x33a70b);}(_0x4d49,0x141));var _0x94d4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4d49[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x94d4('0x0'));var moment=require('moment');var BPromise=require(_0x94d4('0x1'));var rs=require(_0x94d4('0x2'));var fs=require('fs');var Redis=require(_0x94d4('0x3'));var db=require(_0x94d4('0x4'))['db'];var utils=require(_0x94d4('0x5'));var logger=require(_0x94d4('0x6'))(_0x94d4('0x7'));var config=require(_0x94d4('0x8'));var jayson=require(_0x94d4('0x9'));var client=jayson['client'][_0x94d4('0xa')]({'port':0x232a});config[_0x94d4('0xb')]=_[_0x94d4('0xc')](config[_0x94d4('0xb')],{'host':_0x94d4('0xd'),'port':0x18eb});var socket=require(_0x94d4('0xe'))(new Redis(config['redis']));require(_0x94d4('0xf'))[_0x94d4('0x10')](socket);function respondWithRpcPromise(_0x562265,_0x23ef86,_0x283f63){return new BPromise(function(_0xd7820d,_0x2720dd){return client['request'](_0x562265,_0x283f63)[_0x94d4('0x11')](function(_0xe7f878){logger[_0x94d4('0x12')](_0x94d4('0x13'),_0x23ef86,_0x94d4('0x14'));logger[_0x94d4('0x15')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x23ef86,'request\x20sent',JSON['stringify'](_0xe7f878));if(_0xe7f878[_0x94d4('0x16')]){if(_0xe7f878[_0x94d4('0x16')]['code']===0x1f4){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0x2720dd(_0xe7f878['error'][_0x94d4('0x17')]);}logger['error']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,_0xe7f878['error'][_0x94d4('0x17')]);return _0xd7820d(_0xe7f878[_0x94d4('0x16')][_0x94d4('0x17')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x23ef86,'request\x20sent');_0xd7820d(_0xe7f878[_0x94d4('0x18')][_0x94d4('0x17')]);}})[_0x94d4('0x19')](function(_0x47b760){logger[_0x94d4('0x16')](_0x94d4('0x13'),_0x23ef86,_0x47b760);_0x2720dd(_0x47b760);});});} \ No newline at end of file +var _0xdeb3=['request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xdeb3,0xb7));var _0x3deb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xdeb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x3deb('0x0'));var moment=require(_0x3deb('0x1'));var BPromise=require(_0x3deb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3deb('0x3'))['db'];var utils=require(_0x3deb('0x4'));var logger=require(_0x3deb('0x5'))(_0x3deb('0x6'));var config=require(_0x3deb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3deb('0x8')]['http']({'port':0x232a});config[_0x3deb('0x9')]=_['defaults'](config[_0x3deb('0x9')],{'host':_0x3deb('0xa'),'port':0x18eb});var socket=require(_0x3deb('0xb'))(new Redis(config[_0x3deb('0x9')]));require(_0x3deb('0xc'))[_0x3deb('0xd')](socket);function respondWithRpcPromise(_0x2cd00a,_0x1d628e,_0x36c78a){return new BPromise(function(_0x54b603,_0x5a50f5){return client[_0x3deb('0xe')](_0x2cd00a,_0x36c78a)[_0x3deb('0xf')](function(_0x756238){logger['info'](_0x3deb('0x10'),_0x1d628e,_0x3deb('0x11'));logger[_0x3deb('0x12')](_0x3deb('0x13'),_0x1d628e,'request\x20sent',JSON['stringify'](_0x756238));if(_0x756238['error']){if(_0x756238[_0x3deb('0x14')][_0x3deb('0x15')]===0x1f4){logger[_0x3deb('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x1d628e,_0x756238[_0x3deb('0x14')][_0x3deb('0x16')]);return _0x5a50f5(_0x756238['error'][_0x3deb('0x16')]);}logger[_0x3deb('0x14')]('VoicePrefix,\x20%s,\x20%s',_0x1d628e,_0x756238[_0x3deb('0x14')]['message']);return _0x54b603(_0x756238[_0x3deb('0x14')]['message']);}else{logger['info'](_0x3deb('0x10'),_0x1d628e,_0x3deb('0x11'));_0x54b603(_0x756238[_0x3deb('0x17')][_0x3deb('0x16')]);}})[_0x3deb('0x18')](function(_0x145d16){logger['error'](_0x3deb('0x10'),_0x1d628e,_0x145d16);_0x5a50f5(_0x145d16);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 375f7ae..a9de19b 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 _0xfa12=['register','voicePrefix:','./voicePrefix.events','save','update','removeListener'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xfa12,0x1b2));var _0x2fa1=function(_0x24e11e,_0x198fb8){_0x24e11e=_0x24e11e-0x0;var _0x29899e=_0xfa12[_0x24e11e];return _0x29899e;};'use strict';var VoicePrefixEvents=require(_0x2fa1('0x0'));var events=[_0x2fa1('0x1'),'remove',_0x2fa1('0x2')];function createListener(_0x1d3d90,_0x1abe62){return function(_0x877ea9){_0x1abe62['emit'](_0x1d3d90,_0x877ea9);};}function removeListener(_0x2022bf,_0x358fe1){return function(){VoicePrefixEvents[_0x2fa1('0x3')](_0x2022bf,_0x358fe1);};}exports[_0x2fa1('0x4')]=function(_0x4d61b0){for(var _0x166949=0x0,_0x25b233=events['length'];_0x166949<_0x25b233;_0x166949++){var _0x3449c3=events[_0x166949];var _0x30a897=createListener(_0x2fa1('0x5')+_0x3449c3,_0x4d61b0);VoicePrefixEvents['on'](_0x3449c3,_0x30a897);}}; \ No newline at end of file +var _0x902b=['register','./voicePrefix.events','remove','update','emit'];(function(_0x34069a,_0x133e7b){var _0xddca94=function(_0x15df2a){while(--_0x15df2a){_0x34069a['push'](_0x34069a['shift']());}};_0xddca94(++_0x133e7b);}(_0x902b,0x6a));var _0xb902=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x902b[_0x4b2436];return _0x4f5ab2;};'use strict';var VoicePrefixEvents=require(_0xb902('0x0'));var events=['save',_0xb902('0x1'),_0xb902('0x2')];function createListener(_0x26d7c7,_0x20a412){return function(_0xa2acb9){_0x20a412[_0xb902('0x3')](_0x26d7c7,_0xa2acb9);};}function removeListener(_0x492bd4,_0x1af7b5){return function(){VoicePrefixEvents['removeListener'](_0x492bd4,_0x1af7b5);};}exports[_0xb902('0x4')]=function(_0x5d38bb){for(var _0x157e14=0x0,_0x5e7240=events['length'];_0x157e14<_0x5e7240;_0x157e14++){var _0x5b0b74=events[_0x157e14];var _0x55331d=createListener('voicePrefix:'+_0x5b0b74,_0x5d38bb);VoicePrefixEvents['on'](_0x5b0b74,_0x55331d);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d524c03..36a4b0a 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(_0x479722,_0x231cef){var _0x2310fe=function(_0xd96529){while(--_0xd96529){_0x479722['push'](_0x479722['shift']());}};_0x2310fe(++_0x231cef);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a9e4a,_0x585df1){_0x4a9e4a=_0x4a9e4a-0x0;var _0xaa903e=_0xb10b[_0x4a9e4a];return _0xaa903e;};'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(_0x316d59,_0x46390a){var _0x53770b=function(_0x607d30){while(--_0x607d30){_0x316d59['push'](_0x316d59['shift']());}};_0x53770b(++_0x46390a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0xa9e0[_0x4ea69d];return _0x5318e0;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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 834b204..5f6b1ba 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 _0xe0e9=['progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','ENUM','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','rrordered','setDataValue','strategy','getDataValue','type','dialMethod','preview','booked','includes','INTEGER','yes','once','periodic_announce','split','joinempty','leavewhenempty','join','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign'];(function(_0x6ec690,_0x962c2a){var _0x54dfcc=function(_0x1240c4){while(--_0x1240c4){_0x6ec690['push'](_0x6ec690['shift']());}};_0x54dfcc(++_0x962c2a);}(_0xe0e9,0x1d1));var _0x9e0e=function(_0x3b814e,_0x74a812){_0x3b814e=_0x3b814e-0x0;var _0x42e72a=_0xe0e9[_0x3b814e];return _0x42e72a;};'use strict';var Sequelize=require(_0x9e0e('0x0'));module[_0x9e0e('0x1')]={'name':{'type':Sequelize[_0x9e0e('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x4'),_0x9e0e('0x5')),'allowNull':![],'defaultValue':_0x9e0e('0x4')},'musiconhold':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':_0x9e0e('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize[_0x9e0e('0x3')]('rr',_0x9e0e('0x7'),_0x9e0e('0x8'),_0x9e0e('0x9'),_0x9e0e('0xa'),_0x9e0e('0xb'),_0x9e0e('0xc'),'wrandom',_0x9e0e('0xd')),'allowNull':![],'defaultValue':_0x9e0e('0x7'),'set':function(_0x25aefa){this[_0x9e0e('0xe')](_0x9e0e('0xf'),_0x25aefa?_0x25aefa:'rrmemory');},'get':function(){var _0x258578=this[_0x9e0e('0x10')](_0x9e0e('0x11'));var _0x30618f=this[_0x9e0e('0x10')](_0x9e0e('0x12'));var _0x53e3af=this['getDataValue'](_0x9e0e('0xf'));if(_0x258578==='outbound'){if(_0x30618f===_0x9e0e('0x13')){return null;}if(_0x30618f===_0x9e0e('0x14')&&!['rrmemory','roundrobin'][_0x9e0e('0x15')](_0x53e3af)){this['setDataValue']('strategy',_0x9e0e('0xb'));}}return _0x53e3af;}},'servicelevel':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x9e0e('0x16')](0xb)},'timeout':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x9e0e('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':_0x9e0e('0x17')},'autopause':{'type':Sequelize[_0x9e0e('0x3')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x9e0e('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x9e0e('0x3')]('yes','no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no',_0x9e0e('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x9e0e('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0x9e0e('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x9e0e('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x9e0e('0x2')]},'queue_youarenext':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x9e0e('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x9e0e('0x2')]},'queue_quantity2':{'type':Sequelize[_0x9e0e('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x9e0e('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1997af){this[_0x9e0e('0xe')](_0x9e0e('0x19'),_0x1997af?_0x1997af['join'](','):[]);},'get':function(){return this['getDataValue'](_0x9e0e('0x19'))?this[_0x9e0e('0x10')](_0x9e0e('0x19'))[_0x9e0e('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':'yes','set':function(_0x596e36){this[_0x9e0e('0xe')]('joinempty',_0x596e36?_0x596e36['join'](','):undefined);},'get':function(){return this[_0x9e0e('0x10')]('joinempty')?this[_0x9e0e('0x10')](_0x9e0e('0x1b'))[_0x9e0e('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':'no','set':function(_0x1e73ae){this[_0x9e0e('0xe')](_0x9e0e('0x1c'),_0x1e73ae?_0x1e73ae[_0x9e0e('0x1d')](','):undefined);},'get':function(){return this[_0x9e0e('0x10')]('leavewhenempty')?this[_0x9e0e('0x10')](_0x9e0e('0x1c'))[_0x9e0e('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x9e0e('0x3')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x9e0e('0x2')]},'description':{'type':Sequelize[_0x9e0e('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x54e053){this[_0x9e0e('0xe')]('acw',_0x54e053);if(_0x54e053){if(this[_0x9e0e('0x10')](_0x9e0e('0x1e'))<0x2){this[_0x9e0e('0xe')](_0x9e0e('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x9e0e('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':0x0,'comment':_0x9e0e('0x20')},'dialMethod':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x13'),_0x9e0e('0x21'),_0x9e0e('0x22'),_0x9e0e('0x23'),_0x9e0e('0x14')),'defaultValue':_0x9e0e('0x21'),'comment':_0x9e0e('0x24')},'dialLimitChannel':{'type':Sequelize[_0x9e0e('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x9e0e('0x25')},'dialLimitQueue':{'type':Sequelize[_0x9e0e('0x16')](0x4)[_0x9e0e('0x26')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x9e0e('0x27')](0x2)[_0x9e0e('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x9e0e('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x29'),_0x9e0e('0x2a')),'defaultValue':_0x9e0e('0x2a'),'comment':_0x9e0e('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x9e0e('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0x9e0e('0x16')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x9e0e('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0x9e0e('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x9e0e('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x9e0e('0x26')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x2e')},'dialQueueOptions':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':_0x9e0e('0x2f'),'comment':_0x9e0e('0x30')},'dialQueueTimeout':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x31')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x9e0e('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x35')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x36')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x37')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x9e0e('0x38')},'dialTimezone':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x9e0e('0x39')},'dialPrefix':{'type':Sequelize[_0x9e0e('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x9e0e('0x3')](_0x9e0e('0x3a'),'never',_0x9e0e('0x3b')),'defaultValue':_0x9e0e('0x3a')},'dialAMDActive':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x9e0e('0x16')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x9e0e('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x9e0e('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x9e0e('0x3e')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x9e0e('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e0e('0x3f')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x9e0e('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x9e0e('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x9e0e('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x9e0e('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x9e0e('0x16')](0x9)[_0x9e0e('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x9e0e('0x42')},'dialRecallMeTimeout':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':'#RecallMe\x20Timeout\x20(min:1)'},'dialRecallInQueue':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':0x0,'comment':_0x9e0e('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x9e0e('0x44'),_0x9e0e('0x45')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize[_0x9e0e('0x2')],'comment':_0x9e0e('0x32')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9e0e('0x46')},'dialCutDigit':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x9e0e('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x48')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4a')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4b')},'dialMachineMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x4c')},'dialMachineRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4d')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x9e0e('0x4e')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x9e0e('0x16')](0x5)[_0x9e0e('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x9e0e('0x4f')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9e0e('0x16')],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9e0e('0x1f')],'defaultValue':![],'comment':_0x9e0e('0x50'),'set':function(_0x1ffe3c){if(!_0x1ffe3c)this[_0x9e0e('0xe')](_0x9e0e('0x51'),null);this[_0x9e0e('0xe')](_0x9e0e('0x52'),_0x1ffe3c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x9e0e('0x16')](0x3)[_0x9e0e('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x4374=['#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','DESC','ASC','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','mandatoryDisposition','sequelize','exports','STRING','ENUM','outbound','ringall','leastrecent','random','rrmemory','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','roundrobin','includes','INTEGER','yes','all','once','TEXT','join','periodic_announce','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','power','predictive','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','FLOAT','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence'];(function(_0x281349,_0xa48276){var _0x42b4f3=function(_0x34c59b){while(--_0x34c59b){_0x281349['push'](_0x281349['shift']());}};_0x42b4f3(++_0xa48276);}(_0x4374,0x192));var _0x4437=function(_0x4dec04,_0x210072){_0x4dec04=_0x4dec04-0x0;var _0x226ede=_0x4374[_0x4dec04];return _0x226ede;};'use strict';var Sequelize=require(_0x4437('0x0'));module[_0x4437('0x1')]={'name':{'type':Sequelize[_0x4437('0x2')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4437('0x3')]('inbound',_0x4437('0x4')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':'default'},'announce':{'type':Sequelize[_0x4437('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x4437('0x5'),_0x4437('0x6'),'fewestcalls',_0x4437('0x7'),_0x4437('0x8'),'linear','wrandom',_0x4437('0x9')),'allowNull':![],'defaultValue':'ringall','set':function(_0x11b319){this[_0x4437('0xa')](_0x4437('0xb'),_0x11b319?_0x11b319:'rrmemory');},'get':function(){var _0x525b69=this['getDataValue']('type');var _0x4f422e=this[_0x4437('0xc')](_0x4437('0xd'));var _0x51fefc=this[_0x4437('0xc')](_0x4437('0xb'));if(_0x525b69===_0x4437('0x4')){if(_0x4f422e===_0x4437('0xe')){return null;}if(_0x4f422e===_0x4437('0xf')&&![_0x4437('0x8'),_0x4437('0x10')][_0x4437('0x11')](_0x51fefc)){this[_0x4437('0xa')](_0x4437('0xb'),'rrmemory');}}return _0x51fefc;}},'servicelevel':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x4437('0x12')](0xb)},'timeout':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x4437('0x12')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no',_0x4437('0x14')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4437('0x12')](0xb)},'autopausebusy':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x4437('0x13'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x4437('0x13'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x4437('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x4437('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x4437('0x3')]('yes','no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM'](_0x4437('0x13'),'no',_0x4437('0x15')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x4437('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no')},'announce_position_limit':{'type':Sequelize[_0x4437('0x12')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4437('0x3')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4437('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4437('0x2')]},'queue_youarenext':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4437('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x4437('0x2')]},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize[_0x4437('0x16')],'set':function(_0x51b6aa){this[_0x4437('0xa')]('periodic_announce',_0x51b6aa?_0x51b6aa[_0x4437('0x17')](','):[]);},'get':function(){return this['getDataValue']('periodic_announce')?this['getDataValue'](_0x4437('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0x4437('0x13'),'set':function(_0x304ce9){this[_0x4437('0xa')](_0x4437('0x19'),_0x304ce9?_0x304ce9[_0x4437('0x17')](','):undefined);},'get':function(){return this[_0x4437('0xc')](_0x4437('0x19'))?this['getDataValue']('joinempty')[_0x4437('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x4437('0x2')],'defaultValue':'no','set':function(_0x28f970){this[_0x4437('0xa')]('leavewhenempty',_0x28f970?_0x28f970[_0x4437('0x17')](','):undefined);},'get':function(){return this[_0x4437('0xc')](_0x4437('0x1b'))?this[_0x4437('0xc')](_0x4437('0x1b'))[_0x4437('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x13'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4437('0x2')]},'description':{'type':Sequelize[_0x4437('0x2')]},'acw':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':0x0,'set':function(_0x152212){this[_0x4437('0xa')](_0x4437('0x1d'),_0x152212);if(_0x152212){if(this[_0x4437('0xc')](_0x4437('0x1e'))<0x2){this[_0x4437('0xa')](_0x4437('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4437('0x12')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM'](_0x4437('0xe'),'progressive',_0x4437('0x1f'),_0x4437('0x20'),_0x4437('0xf')),'defaultValue':_0x4437('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x4437('0x12')](0x4)[_0x4437('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4437('0x23')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4437('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0x4437('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x4437('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x26'),_0x4437('0x27')),'defaultValue':_0x4437('0x27'),'comment':_0x4437('0x28')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x4437('0x29')](0x2)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4437('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x4437('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4437('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4437('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0x4437('0x2c')},'dialQueueTimeout':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueProject':{'type':Sequelize[_0x4437('0x2')],'comment':_0x4437('0x2d')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x2e')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x4437('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x32')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4437('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4437('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0x4437('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4437('0x34'),'never',_0x4437('0x35')),'defaultValue':_0x4437('0x34')},'dialAMDActive':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':0x0,'comment':_0x4437('0x36')},'dialAMDInitialSilence':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4437('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4437('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0x4437('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4437('0x12')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4437('0x39')},'dialAMDMinWordLength':{'type':Sequelize[_0x4437('0x12')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4437('0x3a')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x4437('0x3b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4437('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4437('0x3c')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4437('0x12')](0x9)[_0x4437('0x22')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4437('0x3d')},'dialRecallInQueue':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize[_0x4437('0x3')](_0x4437('0x3e'),_0x4437('0x3f')),'defaultValue':'DESC'},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0x4437('0x2d')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4437('0x40')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x41')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x42')},'dialDropMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x43')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x44')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x45')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x46')},'dialMachineMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x47')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x48')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4437('0x49')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4437('0x12')](0x5)[_0x4437('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4437('0x4a')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4437('0x12')],'allowNull':!![],'comment':_0x4437('0x4b')},'mandatoryDisposition':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x5aec89){if(!_0x5aec89)this[_0x4437('0xa')]('mandatoryDispositionPauseId',null);this[_0x4437('0xa')](_0x4437('0x4c'),_0x5aec89);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x4437('0x12')](0x3)[_0x4437('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x4437('0x12')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x4437('0x1c')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 7fc5d2f..39d3253 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 _0x008c=['deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','cm_hopper','onlyIfOpen','into','fromQuery','COALESCE(phone,\x27\x27)','all','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','moment','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','json','offset','undefined','count','set','Content-Range','then','inbound','map','value','includes','type','UserProfileResource','destroy','status','send','index','VoiceQueue','rawAttributes','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys','filters','model','intersection','fields','attributes','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','VoiceQueues','QueueCampaigns','outbound','name','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','body','createdAt','updatedAt','autoAssociation','getHoppers','findOne','CmHopper','length','hasOwnProperty','nolimit','limit','sort','pick','VoiceQueueId','filter','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','teams','Agents','online','voicePause','flatMap','forEach','penalty','sequelize','transaction','each','TeamVoiceQueue','UserVoiceQueue','findOrCreate','upsert','isNil','interface','format','SIP/%s','userVoiceQueue:save','removeTeams','ids','User','select','tq.TeamId','from','team_has_voice_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','union','compact','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','isEmpty','UserVoiceQueueRt','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','phone','scheduledAt','ContactId','ListId','field','CmListId','toString','cm_contacts'];(function(_0xb5ec30,_0x1da318){var _0x22b248=function(_0x4efdeb){while(--_0x4efdeb){_0xb5ec30['push'](_0xb5ec30['shift']());}};_0x22b248(++_0x1da318);}(_0x008c,0x188));var _0xc008=function(_0x2041a4,_0x55946d){_0x2041a4=_0x2041a4-0x0;var _0x5464b8=_0x008c[_0x2041a4];return _0x5464b8;};'use strict';var moment=require(_0xc008('0x0'));var BPromise=require(_0xc008('0x1'));var util=require(_0xc008('0x2'));var _=require(_0xc008('0x3'));var squel=require(_0xc008('0x4'));var Redis=require('ioredis');var qs=require(_0xc008('0x5'));var logger=require(_0xc008('0x6'))(_0xc008('0x7'));var config=require(_0xc008('0x8'));var db=require(_0xc008('0x9'))['db'];config[_0xc008('0xa')]=_[_0xc008('0xb')](config[_0xc008('0xa')],{'host':_0xc008('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc008('0xa')]));require('./voiceQueue.socket')[_0xc008('0xd')](socket);function respondWithStatusCode(_0x5b64f8,_0x52041f){_0x52041f=_0x52041f||0xcc;return function(_0x27830d){if(_0x27830d){return _0x5b64f8[_0xc008('0xe')](_0x52041f);}return _0x5b64f8['status'](_0x52041f)['end']();};}function respondWithResult(_0x543eb8,_0x1eacfa){_0x1eacfa=_0x1eacfa||0xc8;return function(_0xc881aa){if(_0xc881aa){return _0x543eb8['status'](_0x1eacfa)[_0xc008('0xf')](_0xc881aa);}};}function respondWithFilteredResult(_0x332fd4,_0x2ea200){return function(_0x2a5b4e){if(_0x2a5b4e){var _0x9ffa93=typeof _0x2ea200[_0xc008('0x10')]===_0xc008('0x11')&&typeof _0x2ea200['limit']==='undefined';var _0x33f44c=_0x2a5b4e['count'];var _0x25e13f=_0x9ffa93?0x0:_0x2ea200[_0xc008('0x10')];var _0x2073ef=_0x9ffa93?_0x2a5b4e[_0xc008('0x12')]:_0x2ea200[_0xc008('0x10')]+_0x2ea200['limit'];var _0x5e894e;if(_0x2073ef>=_0x33f44c){_0x2073ef=_0x33f44c;_0x5e894e=0xc8;}else{_0x5e894e=0xce;}_0x332fd4['status'](_0x5e894e);return _0x332fd4[_0xc008('0x13')](_0xc008('0x14'),_0x25e13f+'-'+_0x2073ef+'/'+_0x33f44c)[_0xc008('0xf')](_0x2a5b4e);}return null;};}function saveUpdates(_0x3eb12a){return function(_0x4fe771){if(_0x4fe771){return _0x4fe771['update'](_0x3eb12a)['then'](function(_0x5c2668){return _0x5c2668;});}return null;};}function removeEntity(_0x46042b){return function(_0x462af5){if(_0x462af5){return _0x462af5['destroy']()[_0xc008('0x15')](function(){var _0x5906e6=_0x462af5['get']({'plain':!![]});var _0x543e5d=[{'name':'VoiceQueues','value':_0xc008('0x16'),'ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x590a71=_(_0x543e5d)['filter']('ignore')[_0xc008('0x17')](_0xc008('0x18'))[_0xc008('0x18')]();if(_[_0xc008('0x19')](_0x590a71,_0x5906e6[_0xc008('0x1a')])){return;}var _0x110128=_['find'](_0x543e5d,[_0xc008('0x18'),_0x5906e6['type']])['name'];return db[_0xc008('0x1b')][_0xc008('0x1c')]({'where':{'type':_0x110128,'resourceId':_0x5906e6['id']}})[_0xc008('0x15')](function(){return _0x462af5;});})[_0xc008('0x15')](function(){_0x46042b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5de1e9){return function(_0x3f7b07){if(!_0x3f7b07){_0x5de1e9[_0xc008('0xe')](0x194);}return _0x3f7b07;};}function handleError(_0x92c582,_0x2e31c2){_0x2e31c2=_0x2e31c2||0x1f4;return function(_0x5bebd9){logger['error'](_0x5bebd9['stack']);if(_0x5bebd9['name']){delete _0x5bebd9['name'];}_0x92c582[_0xc008('0x1d')](_0x2e31c2)[_0xc008('0x1e')](_0x5bebd9);};}exports[_0xc008('0x1f')]=function(_0x529961,_0x24c14c){var _0x32390d={};var _0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x20')][_0xc008('0x21')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x22')]};});_0x32390d=qs[_0xc008('0x23')](_0x2a7d4f,_0x529961);var _0xf831f2={'where':_0x32390d[_0xc008('0x24')]};return db[_0xc008('0x20')][_0xc008('0x12')](_0xf831f2)[_0xc008('0x15')](function(_0x22d8e8){_0x209591[_0xc008('0x12')]=_0x22d8e8;_0x32390d[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x529961[_0xc008('0x26')]);return db['VoiceQueue'][_0xc008('0x27')](_0x32390d);})[_0xc008('0x15')](function(_0x499754){_0x209591[_0xc008('0x28')]=_0x499754;return _0x209591;})[_0xc008('0x15')](respondWithFilteredResult(_0x24c14c,_0x32390d))[_0xc008('0x29')](handleError(_0x24c14c,null));};exports[_0xc008('0x2a')]=function(_0xd0e05a,_0x3cd878){var _0x7cfbc5={'raw':![],'where':{'id':_0xd0e05a[_0xc008('0x2b')]['id']}},_0x470e79={};_0x470e79['model']=_[_0xc008('0x2c')](db[_0xc008('0x20')][_0xc008('0x21')]);_0x470e79[_0xc008('0x26')]=_[_0xc008('0x2c')](_0xd0e05a[_0xc008('0x26')]);_0x470e79[_0xc008('0x2d')]=_['intersection'](_0x470e79[_0xc008('0x2e')],_0x470e79[_0xc008('0x26')]);_0x7cfbc5['attributes']=_[_0xc008('0x2f')](_0x470e79[_0xc008('0x2e')],qs['fields'](_0xd0e05a[_0xc008('0x26')][_0xc008('0x30')]));_0x7cfbc5[_0xc008('0x31')]=_0x7cfbc5['attributes']['length']?_0x7cfbc5['attributes']:_0x470e79[_0xc008('0x2e')];if(_0xd0e05a['query'][_0xc008('0x32')]){_0x7cfbc5[_0xc008('0x25')]=[{'all':!![]}];}_0x7cfbc5=_[_0xc008('0x33')]({},_0x7cfbc5,_0xd0e05a[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x7cfbc5)[_0xc008('0x15')](handleEntityNotFound(_0x3cd878,null))[_0xc008('0x15')](respondWithResult(_0x3cd878,null))[_0xc008('0x29')](handleError(_0x3cd878,null));};exports[_0xc008('0x36')]=function(_0x3ebb83,_0xdfca2e){return db[_0xc008('0x20')][_0xc008('0x36')](_0x3ebb83['body'],{})[_0xc008('0x15')](function(_0x23c4db){var _0x30b7df=_0x3ebb83[_0xc008('0x37')]['get']({'plain':!![]});if(!_0x30b7df)throw new Error(_0xc008('0x38'));if(_0x30b7df[_0xc008('0x39')]===_0xc008('0x37')){var _0x36e7ae=_0x23c4db[_0xc008('0x3a')]({'plain':!![]});var _0x5706bb=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':_0xc008('0x3c'),'value':_0xc008('0x3d')}];var _0x7279e8=_['find'](_0x5706bb,[_0xc008('0x18'),_0x36e7ae[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')]['find']({'where':{'name':_0x7279e8,'userProfileId':_0x30b7df[_0xc008('0x40')]},'raw':!![]})[_0xc008('0x15')](function(_0x351d5c){if(_0x351d5c&&_0x351d5c['autoAssociation']===0x0){return db[_0xc008('0x1b')]['create']({'name':_0x36e7ae[_0xc008('0x3e')],'resourceId':_0x36e7ae['id'],'type':_0x351d5c['name'],'sectionId':_0x351d5c['id']},{})[_0xc008('0x15')](function(){return _0x23c4db;});}else{return _0x23c4db;}})[_0xc008('0x29')](function(_0x5a5d85){logger[_0xc008('0x41')](_0xc008('0x42'),_0x5a5d85);throw _0x5a5d85;});}return _0x23c4db;})[_0xc008('0x15')](respondWithResult(_0xdfca2e,0xc9))['catch'](handleError(_0xdfca2e,null));};exports[_0xc008('0x43')]=function(_0x2a9b5c,_0x200469){var _0x44fc5d={'where':{'id':_0x2a9b5c[_0xc008('0x2b')]['id']}},_0x347629={};_0x347629['model']=_['keys'](db['VoiceQueue'][_0xc008('0x21')]);_0x44fc5d[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x347629[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x2a9b5c[_0xc008('0x26')][_0xc008('0x30')]));_0x44fc5d[_0xc008('0x31')]=_0x44fc5d['attributes']['length']?_0x44fc5d['attributes']:_0x347629[_0xc008('0x2e')];if(_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]){_0x44fc5d['include']=[{'all':!![]}];}_0x44fc5d=_[_0xc008('0x33')]({},_0x44fc5d,_0x2a9b5c[_0xc008('0x34')]);return db[_0xc008('0x20')][_0xc008('0x35')](_0x44fc5d)[_0xc008('0x15')](handleEntityNotFound(_0x200469,null))[_0xc008('0x15')](function(_0x17ec90){if(_0x17ec90){var _0x405e87=_0x17ec90[_0xc008('0x3a')]({'plain':!![]});_0x405e87=qs[_0xc008('0x44')](_0x405e87,['id','createdAt','updatedAt']);_0x2a9b5c[_0xc008('0x45')]=_['omit'](_0x2a9b5c[_0xc008('0x45')],['id',_0xc008('0x46'),_0xc008('0x47')]);return db['VoiceQueue'][_0xc008('0x36')](_[_0xc008('0x33')](_0x405e87,_0x2a9b5c[_0xc008('0x45')]),{'include':_0x2a9b5c[_0xc008('0x26')][_0xc008('0x32')]?[{'all':!![]}]:undefined})['then'](function(_0x3a7b3b){var _0x27b022=_0x2a9b5c['user'][_0xc008('0x3a')]({'plain':!![]});if(!_0x27b022)throw new Error(_0xc008('0x38'));if(_0x27b022['role']==='user'){var _0x2df905=_0x3a7b3b[_0xc008('0x3a')]({'plain':!![]});var _0x20947b=[{'name':_0xc008('0x3b'),'value':_0xc008('0x16')},{'name':'QueueCampaigns','value':'outbound'}];var _0x34b72a=_['find'](_0x20947b,[_0xc008('0x18'),_0x2df905[_0xc008('0x1a')]])[_0xc008('0x3e')];return db[_0xc008('0x3f')][_0xc008('0x35')]({'where':{'name':_0x34b72a,'userProfileId':_0x27b022[_0xc008('0x40')]},'raw':!![]})['then'](function(_0x2ea742){if(_0x2ea742&&_0x2ea742[_0xc008('0x48')]===0x0){return db[_0xc008('0x1b')][_0xc008('0x36')]({'name':_0x2df905[_0xc008('0x3e')],'resourceId':_0x2df905['id'],'type':_0x2ea742['name'],'sectionId':_0x2ea742['id']},{})[_0xc008('0x15')](function(){return _0x3a7b3b;});}else{return _0x3a7b3b;}})['catch'](function(_0x535e6e){logger['error'](_0xc008('0x42'),_0x535e6e);throw _0x535e6e;});}return _0x3a7b3b;});}})[_0xc008('0x15')](respondWithResult(_0x200469,0xc9))[_0xc008('0x29')](handleError(_0x200469,null));};exports['update']=function(_0x3aeeab,_0x2d8361){if(_0x3aeeab[_0xc008('0x45')]['id']){delete _0x3aeeab['body']['id'];}return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x3aeeab[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2d8361,null))['then'](saveUpdates(_0x3aeeab[_0xc008('0x45')],null))['then'](respondWithResult(_0x2d8361,null))[_0xc008('0x29')](handleError(_0x2d8361,null));};exports[_0xc008('0x1c')]=function(_0x2ae14e,_0x943c91){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2ae14e['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x943c91,null))['then'](removeEntity(_0x943c91,null))['catch'](handleError(_0x943c91,null));};exports[_0xc008('0x49')]=function(_0x30aa1e,_0x56e755){var _0xb1befa={'raw':![],'where':{}};var _0xb8ba7={};var _0x3e373e={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x30aa1e[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x56e755,null))['then'](function(_0x16e052){if(_0x16e052){_0xb8ba7[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x4b')][_0xc008('0x21')]);_0xb8ba7[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x30aa1e[_0xc008('0x26')]);_0xb8ba7[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0xb8ba7[_0xc008('0x2e')],_0xb8ba7[_0xc008('0x26')]);_0xb1befa[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xb8ba7['model'],qs[_0xc008('0x30')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x30')]));_0xb1befa['attributes']=_0xb1befa[_0xc008('0x31')][_0xc008('0x4c')]?_0xb1befa['attributes']:_0xb8ba7['model'];if(!_0x30aa1e[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0xb1befa[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x4f')]);_0xb1befa[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x10')]);}_0xb1befa['order']=qs[_0xc008('0x50')](_0x30aa1e[_0xc008('0x26')][_0xc008('0x50')]);_0xb1befa[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x30aa1e['query'],_0xb8ba7[_0xc008('0x2d')]));_0xb1befa[_0xc008('0x24')][_0xc008('0x52')]=_0x16e052['id'];if(_0x30aa1e['query'][_0xc008('0x53')]){_0xb1befa[_0xc008('0x24')]=_[_0xc008('0x33')](_0xb1befa['where'],{'$or':_[_0xc008('0x17')](_0xb1befa['attributes'],function(_0x50ee03){var _0xee7a85={};_0xee7a85[_0x50ee03]={'$like':'%'+_0x30aa1e[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0xee7a85;})});}_0xb1befa=_[_0xc008('0x33')]({},_0xb1befa,_0x30aa1e['options']);return db[_0xc008('0x4b')][_0xc008('0x12')]({'where':_0xb1befa['where']})[_0xc008('0x15')](function(_0x5233bb){_0x3e373e[_0xc008('0x12')]=_0x5233bb;if(_0x30aa1e['query'][_0xc008('0x32')]){_0xb1befa['include']=[{'all':!![]}];}return db[_0xc008('0x4b')][_0xc008('0x27')](_0xb1befa);})[_0xc008('0x15')](function(_0x47337b){_0x3e373e['rows']=_0x47337b;return _0x3e373e;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x56e755,_0xb1befa))[_0xc008('0x29')](handleError(_0x56e755,null));};exports[_0xc008('0x54')]=function(_0x1d49db,_0x321500){var _0x13ef78={'raw':!![],'where':{}};var _0xd9e3fd={};var _0x3b46e4={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xc008('0x4a')]({'where':{'id':_0x1d49db['params']['id']}})['then'](handleEntityNotFound(_0x321500,null))['then'](function(_0x406ead){if(_0x406ead){_0xd9e3fd[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x55')][_0xc008('0x21')]);_0xd9e3fd[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x1d49db[_0xc008('0x26')]);_0xd9e3fd[_0xc008('0x2d')]=_['intersection'](_0xd9e3fd[_0xc008('0x2e')],_0xd9e3fd[_0xc008('0x26')]);_0x13ef78[_0xc008('0x31')]=_[_0xc008('0x2f')](_0xd9e3fd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1d49db[_0xc008('0x26')][_0xc008('0x30')]));_0x13ef78[_0xc008('0x31')]=_0x13ef78[_0xc008('0x31')][_0xc008('0x4c')]?_0x13ef78[_0xc008('0x31')]:_0xd9e3fd['model'];if(!_0x1d49db['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x13ef78[_0xc008('0x4f')]=qs['limit'](_0x1d49db[_0xc008('0x26')][_0xc008('0x4f')]);_0x13ef78['offset']=qs['offset'](_0x1d49db['query'][_0xc008('0x10')]);}_0x13ef78[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1d49db[_0xc008('0x26')][_0xc008('0x50')]);_0x13ef78[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x1d49db[_0xc008('0x26')],_0xd9e3fd[_0xc008('0x2d')]));_0x13ef78['where']['VoiceQueueId']=_0x406ead['id'];if(_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]){_0x13ef78[_0xc008('0x24')]=_[_0xc008('0x33')](_0x13ef78[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x13ef78['attributes'],function(_0x5794fe){var _0x68372f={};_0x68372f[_0x5794fe]={'$like':'%'+_0x1d49db[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x68372f;})});}_0x13ef78=_['merge']({},_0x13ef78,_0x1d49db['options']);return db['CmHopperHistory']['count']({'where':_0x13ef78['where']})['then'](function(_0x276de2){_0x3b46e4['count']=_0x276de2;if(_0x1d49db[_0xc008('0x26')]['includeAll']){_0x13ef78[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x55')][_0xc008('0x27')](_0x13ef78);})['then'](function(_0x58f348){_0x3b46e4[_0xc008('0x28')]=_0x58f348;return _0x3b46e4;});}})['then'](respondWithFilteredResult(_0x321500,_0x13ef78))[_0xc008('0x29')](handleError(_0x321500,null));};exports[_0xc008('0x57')]=function(_0x544519,_0x7b7246){var _0x4db90b={'raw':!![],'where':{}};var _0x554cf4={};var _0x23bece={'count':0x0,'rows':[]};return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x544519[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x7b7246,null))[_0xc008('0x15')](function(_0x4bd290){if(_0x4bd290){_0x554cf4[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x58')][_0xc008('0x21')]);_0x554cf4[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x544519['query']);_0x554cf4[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],_0x554cf4['query']);_0x4db90b[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x554cf4[_0xc008('0x2e')],qs['fields'](_0x544519['query']['fields']));_0x4db90b[_0xc008('0x31')]=_0x4db90b[_0xc008('0x31')][_0xc008('0x4c')]?_0x4db90b[_0xc008('0x31')]:_0x554cf4[_0xc008('0x2e')];if(!_0x544519[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x4db90b['limit']=qs[_0xc008('0x4f')](_0x544519[_0xc008('0x26')]['limit']);_0x4db90b['offset']=qs[_0xc008('0x10')](_0x544519[_0xc008('0x26')][_0xc008('0x10')]);}_0x4db90b[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x544519['query'][_0xc008('0x50')]);_0x4db90b[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x544519[_0xc008('0x26')],_0x554cf4[_0xc008('0x2d')]));_0x4db90b[_0xc008('0x24')]['VoiceQueueId']=_0x4bd290['id'];if(_0x544519[_0xc008('0x26')][_0xc008('0x53')]){_0x4db90b[_0xc008('0x24')]=_[_0xc008('0x33')](_0x4db90b['where'],{'$or':_[_0xc008('0x17')](_0x4db90b[_0xc008('0x31')],function(_0x57cf19){var _0x555e8a={};_0x555e8a[_0x57cf19]={'$like':'%'+_0x544519[_0xc008('0x26')]['filter']+'%'};return _0x555e8a;})});}_0x4db90b=_[_0xc008('0x33')]({},_0x4db90b,_0x544519[_0xc008('0x34')]);return db['CmHopperFinal'][_0xc008('0x12')]({'where':_0x4db90b[_0xc008('0x24')]})[_0xc008('0x15')](function(_0xbe42a2){_0x23bece[_0xc008('0x12')]=_0xbe42a2;if(_0x544519[_0xc008('0x26')][_0xc008('0x32')]){_0x4db90b[_0xc008('0x25')]=[{'all':!![]}];}return db[_0xc008('0x58')][_0xc008('0x27')](_0x4db90b);})['then'](function(_0x49e6d5){_0x23bece[_0xc008('0x28')]=_0x49e6d5;return _0x23bece;});}})[_0xc008('0x15')](respondWithFilteredResult(_0x7b7246,_0x4db90b))['catch'](handleError(_0x7b7246,null));};exports[_0xc008('0x59')]=function(_0x1bdaa9,_0x698d5c){var _0x5f1e48={'raw':!![],'where':{}};var _0x303cdd={};var _0x38239a={'count':0x0,'rows':[]};return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x1bdaa9[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x698d5c,null))[_0xc008('0x15')](function(_0x5bd010){if(_0x5bd010){_0x303cdd[_0xc008('0x2e')]=_['keys'](db[_0xc008('0x5a')][_0xc008('0x21')]);_0x303cdd[_0xc008('0x26')]=_['keys'](_0x1bdaa9[_0xc008('0x26')]);_0x303cdd[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],_0x303cdd[_0xc008('0x26')]);_0x5f1e48[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x303cdd[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x1bdaa9[_0xc008('0x26')]['fields']));_0x5f1e48[_0xc008('0x31')]=_0x5f1e48[_0xc008('0x31')][_0xc008('0x4c')]?_0x5f1e48[_0xc008('0x31')]:_0x303cdd[_0xc008('0x2e')];if(!_0x1bdaa9['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x5f1e48[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x4f')]);_0x5f1e48[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x10')]);}_0x5f1e48[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x1bdaa9[_0xc008('0x26')][_0xc008('0x50')]);_0x5f1e48[_0xc008('0x24')]=qs['filters'](_['pick'](_0x1bdaa9[_0xc008('0x26')],_0x303cdd[_0xc008('0x2d')]));_0x5f1e48[_0xc008('0x24')][_0xc008('0x52')]=_0x5bd010['id'];if(_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]){_0x5f1e48[_0xc008('0x24')]=_[_0xc008('0x33')](_0x5f1e48[_0xc008('0x24')],{'$or':_['map'](_0x5f1e48[_0xc008('0x31')],function(_0x2bbadf){var _0x54fd75={};_0x54fd75[_0x2bbadf]={'$like':'%'+_0x1bdaa9[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x54fd75;})});}_0x5f1e48=_[_0xc008('0x33')]({},_0x5f1e48,_0x1bdaa9[_0xc008('0x34')]);return db[_0xc008('0x5a')][_0xc008('0x12')]({'where':_0x5f1e48['where']})[_0xc008('0x15')](function(_0x321532){_0x38239a[_0xc008('0x12')]=_0x321532;if(_0x1bdaa9[_0xc008('0x26')]['includeAll']){_0x5f1e48[_0xc008('0x25')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xc008('0x27')](_0x5f1e48);})[_0xc008('0x15')](function(_0x5b47c3){_0x38239a[_0xc008('0x28')]=_0x5b47c3;return _0x38239a;});}})['then'](respondWithFilteredResult(_0x698d5c,_0x5f1e48))[_0xc008('0x29')](handleError(_0x698d5c,null));};exports['getTeams']=function(_0x5b387d,_0x5351f7){var _0x79dfea={};var _0x402b67={};var _0x48f40f;var _0x4fda8;return db[_0xc008('0x20')]['findOne']({'where':{'id':_0x5b387d[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5351f7,null))[_0xc008('0x15')](function(_0x5843ee){if(_0x5843ee){_0x48f40f=_0x5843ee;_0x402b67[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x5b')][_0xc008('0x21')]);_0x402b67[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x5b387d[_0xc008('0x26')]);_0x402b67[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],_0x402b67[_0xc008('0x26')]);_0x79dfea['attributes']=_[_0xc008('0x2f')](_0x402b67[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5b387d['query'][_0xc008('0x30')]));_0x79dfea[_0xc008('0x31')]=_0x79dfea[_0xc008('0x31')]['length']?_0x79dfea[_0xc008('0x31')]:_0x402b67['model'];_0x79dfea[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5b387d[_0xc008('0x26')]['sort']);_0x79dfea[_0xc008('0x24')]=qs[_0xc008('0x2d')](_[_0xc008('0x51')](_0x5b387d[_0xc008('0x26')],_0x402b67[_0xc008('0x2d')]));if(_0x5b387d[_0xc008('0x26')][_0xc008('0x53')]){_0x79dfea['where']=_[_0xc008('0x33')](_0x79dfea[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x79dfea[_0xc008('0x31')],function(_0x5a61d6){var _0x46fba5={};_0x46fba5[_0x5a61d6]={'$like':'%'+_0x5b387d['query'][_0xc008('0x53')]+'%'};return _0x46fba5;})});}_0x79dfea=_[_0xc008('0x33')]({},_0x79dfea,_0x5b387d[_0xc008('0x34')]);return _0x48f40f[_0xc008('0x5c')](_0x79dfea);}})[_0xc008('0x15')](function(_0x9f266e){if(_0x9f266e){_0x4fda8=_0x9f266e[_0xc008('0x4c')];if(!_0x5b387d['query'][_0xc008('0x4d')](_0xc008('0x4e'))){_0x79dfea[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5b387d['query'][_0xc008('0x4f')]);_0x79dfea['offset']=qs[_0xc008('0x10')](_0x5b387d[_0xc008('0x26')][_0xc008('0x10')]);}return _0x48f40f['getTeams'](_0x79dfea);}})['then'](function(_0x39bfc0){if(_0x39bfc0){return _0x39bfc0?{'count':_0x4fda8,'rows':_0x39bfc0}:null;}})['then'](respondWithResult(_0x5351f7,null))[_0xc008('0x29')](handleError(_0x5351f7,null));};exports[_0xc008('0x5d')]=function(_0x1c2e63,_0xaf3bed){var _0x58ae7b=_0x1c2e63[_0xc008('0x45')][_0xc008('0x5e')];var _0x537e5e=_['map'](_0x58ae7b,'id');return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x537e5e},'attributes':['id'],'include':[{'model':db['User'],'as':_0xc008('0x5f'),'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),_0xc008('0x61'),'interface'],'raw':!![]}]})[_0xc008('0x15')](function(_0x3721e8){if(_0x3721e8){var _0xc344a7=_[_0xc008('0x62')](_0x3721e8,function(_0x78b833){var _0x177733=_0x78b833[_0xc008('0x3a')]({'plain':!![]});_0x177733[_0xc008('0x5f')][_0xc008('0x63')](function(_0xa332b1){_0xa332b1[_0xc008('0x64')]=_[_0xc008('0x35')](_0x58ae7b,{'id':_0x177733['id']})[_0xc008('0x64')];});return _0x177733['Agents'];});return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1c2e63[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](function(_0x4447ba){return db[_0xc008('0x65')][_0xc008('0x66')](function(_0xe5d226){return _0x4447ba['addTeams'](_0x537e5e,{'transaction':_0xe5d226})['then'](function(){return BPromise[_0xc008('0x67')](_0x58ae7b,function(_0x3d33ed){return db[_0xc008('0x68')]['upsert']({'TeamId':_0x3d33ed['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id'],'penalty':_0x3d33ed[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_0xc344a7,function(_0x156ec3){return db[_0xc008('0x69')][_0xc008('0x6a')]({'where':{'UserId':_0x156ec3['id'],'VoiceQueueId':_0x1c2e63[_0xc008('0x2b')]['id']},'defaults':{'penalty':_0x156ec3[_0xc008('0x64')]},'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){return BPromise[_0xc008('0x67')](_[_0xc008('0x53')](_0xc344a7,{'online':!![]}),function(_0x4ffaa3){return db['UserVoiceQueueRt'][_0xc008('0x6b')]({'membername':_0x4ffaa3[_0xc008('0x3e')],'UserId':_0x4ffaa3['id'],'queue_name':_0x4447ba['name'],'VoiceQueueId':_0x4447ba['id'],'interface':_[_0xc008('0x6c')](_0x4ffaa3[_0xc008('0x6d')])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0x4ffaa3[_0xc008('0x3e')]):_0x4ffaa3[_0xc008('0x6d')],'paused':_0x4ffaa3[_0xc008('0x61')]||![],'penalty':_0x4ffaa3[_0xc008('0x64')]},{'transaction':_0xe5d226});});})[_0xc008('0x15')](function(){_0xc344a7['forEach'](function(_0x51b305){socket['emit'](_0xc008('0x70'),{'UserId':_0x51b305['id'],'VoiceQueueId':_0x4447ba['id']});});});});});}})['then'](respondWithStatusCode(_0xaf3bed,null))[_0xc008('0x29')](handleError(_0xaf3bed,null));};exports[_0xc008('0x71')]=function(_0x2c6a48,_0x177e8e){return db[_0xc008('0x5b')][_0xc008('0x27')]({'where':{'id':_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')]},'attributes':['id'],'include':[{'model':db[_0xc008('0x73')],'as':_0xc008('0x5f'),'attributes':['id'],'raw':!![]}]})[_0xc008('0x15')](handleEntityNotFound(_0x177e8e,null))[_0xc008('0x15')](function(_0x1fea74){var _0x304083=_[_0xc008('0x17')](_0x1fea74,'id');var _0x473f44=[];var _0x41d1ea=[];var _0x5c2ca1=squel[_0xc008('0x74')]();_0x5c2ca1['field'](_0xc008('0x75'))[_0xc008('0x76')](_0xc008('0x77'),'tq')['join'](_0xc008('0x78'),'ut',_0xc008('0x79'))[_0xc008('0x24')](_0xc008('0x7a'),_0x2c6a48[_0xc008('0x2b')]['id']);for(var _0x377754=0x0;_0x377754<_0x1fea74[_0xc008('0x4c')];_0x377754+=0x1){let _0x57b8da=_0x1fea74[_0x377754];for(var _0x1cad4b=0x0;_0x1cad4b<_0x57b8da[_0xc008('0x5f')][_0xc008('0x4c')];_0x1cad4b+=0x1){let _0xdb4cef=_0x57b8da['Agents'][_0x1cad4b];var _0x555e8c=_0x5c2ca1['clone']();_0x555e8c['where'](_0xc008('0x7b'),_0xdb4cef['id']);_0x41d1ea[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x555e8c['toString'](),{'type':db[_0xc008('0x65')][_0xc008('0x7d')][_0xc008('0x7e')]})['then'](function(_0x438195){if(_0x438195['length']===0x1){return _0xdb4cef['id'];}else{var _0x3d76b7=_['every'](_[_0xc008('0x17')](_0x438195,_0xc008('0x7f')),function(_0x1aaf89){return _[_0xc008('0x19')](_0x304083,_0x1aaf89);});if(_0x3d76b7){return _0xdb4cef['id'];}}}));}}return BPromise['all'](_0x41d1ea)[_0xc008('0x15')](function(_0x19dcb7){_0x473f44=_(_0x473f44)[_0xc008('0x80')](_0x19dcb7)[_0xc008('0x81')]()[_0xc008('0x18')]();return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x2c6a48['params']['id']}})[_0xc008('0x15')](function(_0x30b6af){return db[_0xc008('0x65')]['transaction'](function(_0x5ba04f){return _0x30b6af[_0xc008('0x71')](_0x2c6a48[_0xc008('0x26')][_0xc008('0x72')],{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){if(!_['isEmpty'](_0x473f44)){return _0x30b6af[_0xc008('0x82')](_0x473f44,{'transaction':_0x5ba04f})[_0xc008('0x15')](function(){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x2c6a48['params']['id'],'UserId':_0x473f44},'transaction':_0x5ba04f});});}})[_0xc008('0x15')](function(){_0x473f44['forEach'](function(_0x3744e1){socket['emit'](_0xc008('0x83'),{'UserId':_0x3744e1,'VoiceQueueId':_0x30b6af['id']});});});});});});})[_0xc008('0x15')](respondWithStatusCode(_0x177e8e,null))[_0xc008('0x29')](handleError(_0x177e8e,null));};exports[_0xc008('0x84')]=function(_0x5c24cd,_0x5effd6){var _0x23ba7e,_0x274739;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5c24cd[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x5effd6,null))[_0xc008('0x15')](function(_0x272d98){if(_0x272d98){_0x274739=_0x272d98;return _0x272d98[_0xc008('0x84')](_0x5c24cd[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5c24cd[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{})[_0xc008('0x85')](function(_0x57687f){for(var _0x5ea13a=0x0;_0x5ea13a<_0x5c24cd[_0xc008('0x45')]['ids'][_0xc008('0x4c')];_0x5ea13a+=0x1){socket[_0xc008('0x86')]('userVoiceQueue:save',{'UserId':Number(_0x5c24cd['body'][_0xc008('0x72')][_0x5ea13a]),'VoiceQueueId':Number(_0x5c24cd[_0xc008('0x2b')]['id'])});}return _0x57687f;});}})[_0xc008('0x15')](function(_0x129cbf){_0x23ba7e=_0x129cbf||[];if(_0x274739){return db[_0xc008('0x73')][_0xc008('0x27')]({'where':{'id':_0x5c24cd['body'][_0xc008('0x72')]},'attributes':['id',_0xc008('0x3e'),_0xc008('0x60'),'voicePause',_0xc008('0x6d')],'raw':!![]});}})[_0xc008('0x15')](function(_0xcef0e4){if(!_[_0xc008('0x87')](_0xcef0e4)){var _0x49f92e=[];for(var _0x4ae026=0x0;_0x4ae026<_0xcef0e4[_0xc008('0x4c')];_0x4ae026++){if(_0xcef0e4[_0x4ae026]['online']){_0x49f92e[_0xc008('0x7c')](db[_0xc008('0x88')][_0xc008('0x6b')]({'membername':_0xcef0e4[_0x4ae026][_0xc008('0x3e')],'UserId':_0xcef0e4[_0x4ae026]['id'],'queue_name':_0x274739[_0xc008('0x3e')],'VoiceQueueId':_0x274739['id'],'interface':_['isNil'](_0xcef0e4[_0x4ae026]['interface'])?util[_0xc008('0x6e')](_0xc008('0x6f'),_0xcef0e4[_0x4ae026][_0xc008('0x3e')]):_0xcef0e4[_0x4ae026][_0xc008('0x6d')],'paused':_0xcef0e4[_0x4ae026][_0xc008('0x61')]||![],'penalty':_0x5c24cd[_0xc008('0x45')][_0xc008('0x64')]||0x0}));}}return BPromise['all'](_0x49f92e);}})[_0xc008('0x15')](function(){return _0x23ba7e;})[_0xc008('0x15')](respondWithResult(_0x5effd6,null))[_0xc008('0x29')](handleError(_0x5effd6,null));};exports[_0xc008('0x82')]=function(_0x1afb32,_0x1c2263){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x1afb32[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x1c2263,null))[_0xc008('0x15')](function(_0x328284){if(_0x328284){return _0x328284['removeAgents'](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])['then'](function(){if(_[_0xc008('0x89')](_0x1afb32[_0xc008('0x26')][_0xc008('0x72')])){for(var _0x2598be=0x0;_0x2598be<_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0xc008('0x4c')];_0x2598be+=0x1){socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')][_0x2598be]),'VoiceQueueId':Number(_0x1afb32['params']['id'])});}}else{socket[_0xc008('0x86')](_0xc008('0x83'),{'UserId':Number(_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]),'VoiceQueueId':Number(_0x1afb32[_0xc008('0x2b')]['id'])});}});}})[_0xc008('0x15')](function(_0x12f5d1){return db[_0xc008('0x88')][_0xc008('0x1c')]({'where':{'VoiceQueueId':_0x1afb32[_0xc008('0x2b')]['id'],'UserId':_0x1afb32[_0xc008('0x26')][_0xc008('0x72')]}})[_0xc008('0x15')](function(){return _0x12f5d1;});})[_0xc008('0x15')](respondWithStatusCode(_0x1c2263,null))[_0xc008('0x29')](handleError(_0x1c2263,null));};exports[_0xc008('0x8a')]=function(_0x5c358b,_0x49688b){var _0x51fd86={};var _0x10778f={};var _0x237ffb;var _0x3f80f4;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x5c358b[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x49688b,null))['then'](function(_0x3e7099){if(_0x3e7099){_0x237ffb=_0x3e7099;_0x10778f['model']=_['keys'](db[_0xc008('0x73')][_0xc008('0x21')]);_0x10778f['query']=_[_0xc008('0x2c')](_0x5c358b[_0xc008('0x26')]);_0x10778f[_0xc008('0x2d')]=_['intersection'](_0x10778f[_0xc008('0x2e')],_0x10778f[_0xc008('0x26')]);_0x51fd86[_0xc008('0x31')]=_['intersection'](_0x10778f[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x5c358b[_0xc008('0x26')][_0xc008('0x30')]));_0x51fd86[_0xc008('0x31')]=_0x51fd86[_0xc008('0x31')][_0xc008('0x4c')]?_0x51fd86[_0xc008('0x31')]:_0x10778f['model'];_0x51fd86[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x5c358b[_0xc008('0x26')][_0xc008('0x50')]);_0x51fd86[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x5c358b[_0xc008('0x26')],_0x10778f[_0xc008('0x2d')]));if(_0x5c358b[_0xc008('0x26')][_0xc008('0x53')]){_0x51fd86[_0xc008('0x24')]=_[_0xc008('0x33')](_0x51fd86[_0xc008('0x24')],{'$or':_['map'](_0x51fd86[_0xc008('0x31')],function(_0x231318){var _0x3df369={};_0x3df369[_0x231318]={'$like':'%'+_0x5c358b[_0xc008('0x26')]['filter']+'%'};return _0x3df369;})});}_0x51fd86=_['merge']({},_0x51fd86,_0x5c358b[_0xc008('0x34')]);return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})['then'](function(_0x30e433){if(_0x30e433){_0x3f80f4=_0x30e433[_0xc008('0x4c')];if(!_0x5c358b[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x51fd86[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x5c358b['query']['limit']);_0x51fd86[_0xc008('0x10')]=qs['offset'](_0x5c358b[_0xc008('0x26')][_0xc008('0x10')]);}return _0x237ffb[_0xc008('0x8a')](_0x51fd86);}})[_0xc008('0x15')](function(_0x2ea1db){if(_0x2ea1db){return _0x2ea1db?{'count':_0x3f80f4,'rows':_0x2ea1db}:null;}})[_0xc008('0x15')](respondWithResult(_0x49688b,null))[_0xc008('0x29')](handleError(_0x49688b,null));};exports[_0xc008('0x8b')]=function(_0x367873,_0x356a82){var _0x368c1f={};var _0x4fd0ff={};var _0x22772e;var _0x39fd43;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x367873[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x356a82,null))[_0xc008('0x15')](function(_0x506dc0){if(_0x506dc0){_0x22772e=_0x506dc0;_0x4fd0ff[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x88')]['rawAttributes']);_0x4fd0ff[_0xc008('0x26')]=_[_0xc008('0x2c')](_0x367873[_0xc008('0x26')]);_0x4fd0ff[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],_0x4fd0ff['query']);_0x368c1f['attributes']=_[_0xc008('0x2f')](_0x4fd0ff[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x367873[_0xc008('0x26')][_0xc008('0x30')]));_0x368c1f['attributes']=_0x368c1f[_0xc008('0x31')]['length']?_0x368c1f[_0xc008('0x31')]:_0x4fd0ff[_0xc008('0x2e')];_0x368c1f['order']=qs[_0xc008('0x50')](_0x367873[_0xc008('0x26')][_0xc008('0x50')]);_0x368c1f[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x367873[_0xc008('0x26')],_0x4fd0ff[_0xc008('0x2d')]));if(_0x367873[_0xc008('0x26')][_0xc008('0x53')]){_0x368c1f['where']=_[_0xc008('0x33')](_0x368c1f[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x368c1f['attributes'],function(_0x43f96e){var _0x353cd5={};_0x353cd5[_0x43f96e]={'$like':'%'+_0x367873[_0xc008('0x26')][_0xc008('0x53')]+'%'};return _0x353cd5;})});}_0x368c1f=_['merge']({},_0x368c1f,_0x367873[_0xc008('0x34')]);return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x9afcd6){if(_0x9afcd6){_0x39fd43=_0x9afcd6[_0xc008('0x4c')];if(!_0x367873['query'][_0xc008('0x4d')]('nolimit')){_0x368c1f['limit']=qs[_0xc008('0x4f')](_0x367873['query'][_0xc008('0x4f')]);_0x368c1f[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x367873[_0xc008('0x26')][_0xc008('0x10')]);}return _0x22772e[_0xc008('0x8b')](_0x368c1f);}})[_0xc008('0x15')](function(_0x5e9e9c){return _0x5e9e9c?{'count':_0x39fd43,'rows':_0x5e9e9c}:null;})[_0xc008('0x15')](respondWithResult(_0x356a82,null))[_0xc008('0x29')](handleError(_0x356a82,null));};exports[_0xc008('0x8c')]=function(_0x45fe90,_0xc046ce){var _0x46fc75={};var _0x59b5b9={};var _0x3c3ead;var _0x3c8a79;return db[_0xc008('0x20')][_0xc008('0x4a')]({'where':{'id':_0x45fe90[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0xc046ce,null))[_0xc008('0x15')](function(_0x3aa9b4){if(_0x3aa9b4){_0x3c3ead=_0x3aa9b4;_0x59b5b9['model']=_['keys'](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x59b5b9['query']=_[_0xc008('0x2c')](_0x45fe90['query']);_0x59b5b9[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],_0x59b5b9[_0xc008('0x26')]);_0x46fc75[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x59b5b9[_0xc008('0x2e')],qs['fields'](_0x45fe90[_0xc008('0x26')]['fields']));_0x46fc75[_0xc008('0x31')]=_0x46fc75[_0xc008('0x31')][_0xc008('0x4c')]?_0x46fc75[_0xc008('0x31')]:_0x59b5b9[_0xc008('0x2e')];_0x46fc75[_0xc008('0x56')]=qs[_0xc008('0x50')](_0x45fe90['query'][_0xc008('0x50')]);_0x46fc75[_0xc008('0x24')]=qs['filters'](_[_0xc008('0x51')](_0x45fe90[_0xc008('0x26')],_0x59b5b9[_0xc008('0x2d')]));if(_0x45fe90[_0xc008('0x26')][_0xc008('0x53')]){_0x46fc75[_0xc008('0x24')]=_['merge'](_0x46fc75[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x46fc75[_0xc008('0x31')],function(_0x3e7c19){var _0x47d263={};_0x47d263[_0x3e7c19]={'$like':'%'+_0x45fe90['query']['filter']+'%'};return _0x47d263;})});}_0x46fc75=_[_0xc008('0x33')]({},_0x46fc75,_0x45fe90[_0xc008('0x34')]);return _0x3c3ead['getLists'](_0x46fc75);}})['then'](function(_0x5035ca){if(_0x5035ca){_0x3c8a79=_0x5035ca['length'];if(!_0x45fe90[_0xc008('0x26')][_0xc008('0x4d')]('nolimit')){_0x46fc75[_0xc008('0x4f')]=qs[_0xc008('0x4f')](_0x45fe90[_0xc008('0x26')][_0xc008('0x4f')]);_0x46fc75[_0xc008('0x10')]=qs['offset'](_0x45fe90['query'][_0xc008('0x10')]);}return _0x3c3ead[_0xc008('0x8c')](_0x46fc75);}})[_0xc008('0x15')](function(_0x46f9ab){if(_0x46f9ab){return _0x46f9ab?{'count':_0x3c8a79,'rows':_0x46f9ab}:null;}})[_0xc008('0x15')](respondWithResult(_0xc046ce,null))[_0xc008('0x29')](handleError(_0xc046ce,null));};exports[_0xc008('0x8e')]=function(_0x5645bb,_0x2ebe07){var _0x3d6f0d=moment()[_0xc008('0x6e')](_0xc008('0x8f'));var _0x3be328,_0x3bcf94;return db[_0xc008('0x20')]['find']({'where':{'id':_0x5645bb['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x2ebe07,null))[_0xc008('0x15')](function(_0x11bcba){if(_0x11bcba){_0x3bcf94=_0x11bcba;return _0x11bcba[_0xc008('0x8e')](_0x5645bb[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x5645bb[_0xc008('0x45')],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0xefba5){var _0x202826;_0x3be328=_0xefba5||[];var _0x37e1f2=[];if(_0xefba5){for(var _0x5161f3=0x0;_0x5161f3<_0xefba5['length'];_0x5161f3+=0x1){var _0x43ec81=_0xefba5[_0x5161f3][_0xc008('0x3a')]({'plain':!![]});_0x3bcf94[_0xc008('0x90')]=_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]?_0x5645bb[_0xc008('0x45')][_0xc008('0x90')]:_0x3bcf94['dialCheckDuplicateType'];switch(_0x3bcf94['dialCheckDuplicateType']){case'always':_0x202826=squel[_0xc008('0x91')]()['into']('cm_hopper')['fromQuery']([_0xc008('0x92'),_0xc008('0x93'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','scheduledAt')['field']('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),'VoiceQueueId')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')['field']('\x27'+_0x3d6f0d+'\x27','updatedAt')['from'](_0xc008('0x99'))['where'](_0xc008('0x9a'))[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81['CmListId']['toString']())[_0xc008('0x24')](_0xc008('0x9c'))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()[_0xc008('0x96')](_0xc008('0x9e'))[_0xc008('0x76')](_0xc008('0x9f'))[_0xc008('0x24')](_0xc008('0x7a'),_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')]()))['where'](_0xc008('0x9d'),squel[_0xc008('0x74')]()['field']('COALESCE(phone,\x27\x27)')[_0xc008('0x76')](_0xc008('0xa0'))[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id']['toString']())))['toString']();break;case _0xc008('0xa1'):_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x93'),'ContactId',_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0x92'),_0xc008('0x92'))['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))[_0xc008('0x96')]('id',_0xc008('0x94'))[_0xc008('0x96')](_0x43ec81['CmListId'][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x5645bb[_0xc008('0x2b')]['id'][_0xc008('0x98')](),_0xc008('0x52'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','createdAt')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where'](_0xc008('0x9a'))['where']('ListId\x20=\x20?',_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL')[_0xc008('0x24')](_0xc008('0x9d'),squel['select']()[_0xc008('0x96')](_0xc008('0xa4'))['from']('cm_hopper')[_0xc008('0x24')]('VoiceQueueId\x20=\x20?',_0x5645bb['params']['id'][_0xc008('0x98')]())))['toString']();break;default:_0x202826=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa0'))[_0xc008('0xa3')]([_0xc008('0x92'),'scheduledAt','ContactId',_0xc008('0x95'),'VoiceQueueId',_0xc008('0x46'),'updatedAt'],squel['select']()['field'](_0xc008('0x92'),'phone')[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x93'))['field']('id','ContactId')[_0xc008('0x96')](_0x43ec81[_0xc008('0x97')][_0xc008('0x98')](),_0xc008('0x95'))['field'](_0x5645bb['params']['id'][_0xc008('0x98')](),'VoiceQueueId')['field']('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')['from']('cm_contacts')[_0xc008('0x24')]('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x43ec81[_0xc008('0x97')][_0xc008('0x98')]())[_0xc008('0x24')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x37e1f2[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x202826));}return BPromise[_0xc008('0xa5')](_0x37e1f2);}})[_0xc008('0x15')](function(){var _0x262b79=[];var _0x15c5a2=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xa6'))[_0xc008('0xa3')]([_0xc008('0xa7'),'phone',_0xc008('0xa8'),_0xc008('0x46'),_0xc008('0x47')],squel[_0xc008('0x74')]()['field'](_0xc008('0xa9'))[_0xc008('0x96')](_0xc008('0xaa'))[_0xc008('0x96')](_0xc008('0xab'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27',_0xc008('0x46'))[_0xc008('0x96')]('\x27'+_0x3d6f0d+'\x27','updatedAt')[_0xc008('0x76')](_0xc008('0xac'),'ci')[_0xc008('0xad')](_0xc008('0xa0'),'h',_0xc008('0xae'))[_0xc008('0x24')](_0xc008('0xaf'),_0x3d6f0d)['where'](_0xc008('0xb0'),'PHONE'))[_0xc008('0x98')]();_0x262b79[_0xc008('0x7c')](db[_0xc008('0x65')][_0xc008('0x26')](_0x15c5a2));return BPromise[_0xc008('0xa5')](_0x262b79);})[_0xc008('0x15')](function(){return _0x3be328;})[_0xc008('0x15')](respondWithResult(_0x2ebe07,null))[_0xc008('0x29')](handleError(_0x2ebe07,null));};exports[_0xc008('0xb1')]=function(_0x471780,_0x4fae34){return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x471780[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x4fae34,null))[_0xc008('0x15')](function(_0x1cc6a6){if(_0x1cc6a6){return _0x1cc6a6[_0xc008('0xb1')](_0x471780[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x471618){if(_0x471618){return db[_0xc008('0x4b')][_0xc008('0x1c')]({'where':{'ListId':_0x471780['query'][_0xc008('0x72')],'VoiceQueueId':_0x471780['params']['id']}})[_0xc008('0x15')](function(){return _0x471618;});}})[_0xc008('0x15')](respondWithStatusCode(_0x4fae34,null))[_0xc008('0x29')](handleError(_0x4fae34,null));};exports[_0xc008('0xb2')]=function(_0x370234,_0x3ff7d2){var _0x478794={};var _0x406de6={};var _0x34cbce;var _0x337acd;return db['VoiceQueue']['findOne']({'where':{'id':_0x370234['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3ff7d2,null))[_0xc008('0x15')](function(_0x2ccfcf){if(_0x2ccfcf){_0x34cbce=_0x2ccfcf;_0x406de6[_0xc008('0x2e')]=_[_0xc008('0x2c')](db[_0xc008('0x8d')][_0xc008('0x21')]);_0x406de6['query']=_[_0xc008('0x2c')](_0x370234[_0xc008('0x26')]);_0x406de6[_0xc008('0x2d')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],_0x406de6['query']);_0x478794[_0xc008('0x31')]=_[_0xc008('0x2f')](_0x406de6[_0xc008('0x2e')],qs[_0xc008('0x30')](_0x370234[_0xc008('0x26')][_0xc008('0x30')]));_0x478794[_0xc008('0x31')]=_0x478794[_0xc008('0x31')][_0xc008('0x4c')]?_0x478794[_0xc008('0x31')]:_0x406de6[_0xc008('0x2e')];_0x478794['order']=qs[_0xc008('0x50')](_0x370234['query'][_0xc008('0x50')]);_0x478794[_0xc008('0x24')]=qs[_0xc008('0x2d')](_['pick'](_0x370234[_0xc008('0x26')],_0x406de6['filters']));if(_0x370234[_0xc008('0x26')][_0xc008('0x53')]){_0x478794[_0xc008('0x24')]=_[_0xc008('0x33')](_0x478794[_0xc008('0x24')],{'$or':_[_0xc008('0x17')](_0x478794[_0xc008('0x31')],function(_0x89601c){var _0x22bb2a={};_0x22bb2a[_0x89601c]={'$like':'%'+_0x370234[_0xc008('0x26')]['filter']+'%'};return _0x22bb2a;})});}_0x478794=_[_0xc008('0x33')]({},_0x478794,_0x370234['options']);return _0x34cbce['getBlackLists'](_0x478794);}})[_0xc008('0x15')](function(_0x55ad1f){if(_0x55ad1f){_0x337acd=_0x55ad1f[_0xc008('0x4c')];if(!_0x370234[_0xc008('0x26')][_0xc008('0x4d')](_0xc008('0x4e'))){_0x478794['limit']=qs[_0xc008('0x4f')](_0x370234[_0xc008('0x26')][_0xc008('0x4f')]);_0x478794[_0xc008('0x10')]=qs[_0xc008('0x10')](_0x370234['query'][_0xc008('0x10')]);}return _0x34cbce[_0xc008('0xb2')](_0x478794);}})['then'](function(_0x247e3a){if(_0x247e3a){return _0x247e3a?{'count':_0x337acd,'rows':_0x247e3a}:null;}})[_0xc008('0x15')](respondWithResult(_0x3ff7d2,null))[_0xc008('0x29')](handleError(_0x3ff7d2,null));};exports[_0xc008('0xb3')]=function(_0x252c44,_0x3b46db){var _0x482efd;return db[_0xc008('0x20')][_0xc008('0x35')]({'where':{'id':_0x252c44[_0xc008('0x2b')]['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x3b46db,null))[_0xc008('0x15')](function(_0x2f217e){if(_0x2f217e){return _0x2f217e[_0xc008('0xb3')](_0x252c44[_0xc008('0x45')][_0xc008('0x72')],_[_0xc008('0x44')](_0x252c44['body'],[_0xc008('0x72'),'id'])||{});}return null;})[_0xc008('0x85')](function(_0x298783){var _0xe349bd;_0x482efd=_0x298783||[];var _0x50db48=[];if(_0x298783){for(var _0x384f2f=0x0;_0x384f2f<_0x298783[_0xc008('0x4c')];_0x384f2f+=0x1){var _0x367581=_0x298783[_0x384f2f][_0xc008('0x3a')]({'plain':!![]});_0xe349bd=squel[_0xc008('0x91')]()[_0xc008('0xa2')](_0xc008('0xb4'))[_0xc008('0xa3')]([_0xc008('0x92'),_0xc008('0x94'),_0xc008('0x95'),_0xc008('0x52'),_0xc008('0x46'),_0xc008('0x47')],squel['select']()[_0xc008('0x96')](_0xc008('0x92'),_0xc008('0x92'))[_0xc008('0x96')]('id',_0xc008('0x94'))['field'](_0x367581[_0xc008('0x97')][_0xc008('0x98')](),'ListId')[_0xc008('0x96')](_0x252c44[_0xc008('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('NOW()',_0xc008('0x46'))['field']('NOW()',_0xc008('0x47'))[_0xc008('0x76')](_0xc008('0x99'))['where']('deletedAt\x20IS\x20NULL')[_0xc008('0x24')](_0xc008('0x9b'),_0x367581[_0xc008('0x97')][_0xc008('0x98')]())['where'](_0xc008('0x9c')))[_0xc008('0x98')]();_0x50db48['push'](db[_0xc008('0x65')]['query'](_0xe349bd));}return BPromise['all'](_0x50db48);}})[_0xc008('0x15')](function(){return _0x482efd;})[_0xc008('0x15')](respondWithResult(_0x3b46db,null))['catch'](handleError(_0x3b46db,null));};exports['removeBlackLists']=function(_0x1e3098,_0x9b997d){return db['VoiceQueue'][_0xc008('0x35')]({'where':{'id':_0x1e3098['params']['id']}})[_0xc008('0x15')](handleEntityNotFound(_0x9b997d,null))[_0xc008('0x15')](function(_0x1422ab){if(_0x1422ab){return _0x1422ab[_0xc008('0xb5')](_0x1e3098[_0xc008('0x26')][_0xc008('0x72')]);}})[_0xc008('0x15')](function(_0x41a8a6){if(_0x41a8a6){return db['CmHopperBlack'][_0xc008('0x1c')]({'where':{'ListId':_0x1e3098['query'][_0xc008('0x72')],'VoiceQueueId':_0x1e3098['params']['id']}})['then'](function(){return _0x41a8a6;});}})[_0xc008('0x15')](respondWithStatusCode(_0x9b997d,null))[_0xc008('0x29')](handleError(_0x9b997d,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x118139,_0x7ce965){_0x118139=_0x118139-0x0;var _0x2fece9=_0x4b84[_0x118139];return _0x2fece9;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 7a2b7ee..1ac369e 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 _0xa895=['events','VoiceQueue','setMaxListeners','save','remove','hook','exports'];(function(_0x36ed3c,_0x44a00a){var _0x52a2e0=function(_0x3f7af9){while(--_0x3f7af9){_0x36ed3c['push'](_0x36ed3c['shift']());}};_0x52a2e0(++_0x44a00a);}(_0xa895,0x1ab));var _0x5a89=function(_0x5e17e7,_0x551ed9){_0x5e17e7=_0x5e17e7-0x0;var _0x19a417=_0xa895[_0x5e17e7];return _0x19a417;};'use strict';var EventEmitter=require(_0x5a89('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0x5a89('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x5a89('0x2')](0x0);var events={'afterCreate':_0x5a89('0x3'),'afterUpdate':'update','afterDestroy':_0x5a89('0x4')};function emitEvent(_0x3a96c0){return function(_0x3b9ca2,_0x3500a3,_0x25da68){VoiceQueueEvents['emit'](_0x3a96c0+':'+_0x3b9ca2['id'],_0x3b9ca2);VoiceQueueEvents['emit'](_0x3a96c0,_0x3b9ca2);_0x25da68(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x5a89('0x5')](e,emitEvent(event));}}module[_0x5a89('0x6')]=VoiceQueueEvents; \ No newline at end of file +var _0xc393=['remove','emit','hasOwnProperty','exports','../../mysqldb','setMaxListeners','save','update'];(function(_0xf7f62c,_0x34e3e9){var _0x1fa89e=function(_0x59236c){while(--_0x59236c){_0xf7f62c['push'](_0xf7f62c['shift']());}};_0x1fa89e(++_0x34e3e9);}(_0xc393,0x8c));var _0x3c39=function(_0x5e83ec,_0x5abaaf){_0x5e83ec=_0x5e83ec-0x0;var _0x43c08c=_0xc393[_0x5e83ec];return _0x43c08c;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x3c39('0x0'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x3c39('0x1')](0x0);var events={'afterCreate':_0x3c39('0x2'),'afterUpdate':_0x3c39('0x3'),'afterDestroy':_0x3c39('0x4')};function emitEvent(_0x1ede98){return function(_0x26bbb2,_0x5595a8,_0x4f2fa7){VoiceQueueEvents['emit'](_0x1ede98+':'+_0x26bbb2['id'],_0x26bbb2);VoiceQueueEvents[_0x3c39('0x5')](_0x1ede98,_0x26bbb2);_0x4f2fa7(null);};}for(var e in events){if(events[_0x3c39('0x6')](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x3c39('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 55e65bb..f0cfa04 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x308df0,_0x2a5d0f){var _0x2db98a=function(_0x57063d){while(--_0x57063d){_0x308df0['push'](_0x308df0['shift']());}};_0x2db98a(++_0x2a5d0f);}(_0x34e8,0x12c));var _0x834e=function(_0x21cfba,_0x1aa704){_0x21cfba=_0x21cfba-0x0;var _0x468ab8=_0x34e8[_0x21cfba];return _0x468ab8;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x4c7464,_0x54475d){var _0x1d48f9=function(_0x5d03b6){while(--_0x5d03b6){_0x4c7464['push'](_0x4c7464['shift']());}};_0x1d48f9(++_0x54475d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'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 diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 0d227d8..4b6552a 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 _0xd2a4=['options','raw','where','attributes','limit','include','map','model','then','ShowVoiceQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueue.socket','register','request','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceQueue','VoiceQueue'];(function(_0x172133,_0x10246b){var _0x2460e5=function(_0x3c4918){while(--_0x3c4918){_0x172133['push'](_0x172133['shift']());}};_0x2460e5(++_0x10246b);}(_0xd2a4,0x86));var _0x4d2a=function(_0x52610b,_0x32d0bf){_0x52610b=_0x52610b-0x0;var _0x18ae58=_0xd2a4[_0x52610b];return _0x18ae58;};'use strict';var _=require('lodash');var util=require(_0x4d2a('0x0'));var moment=require('moment');var BPromise=require(_0x4d2a('0x1'));var rs=require(_0x4d2a('0x2'));var fs=require('fs');var Redis=require(_0x4d2a('0x3'));var db=require(_0x4d2a('0x4'))['db'];var utils=require(_0x4d2a('0x5'));var logger=require(_0x4d2a('0x6'))(_0x4d2a('0x7'));var config=require(_0x4d2a('0x8'));var jayson=require(_0x4d2a('0x9'));var client=jayson[_0x4d2a('0xa')][_0x4d2a('0xb')]({'port':0x232a});config[_0x4d2a('0xc')]=_[_0x4d2a('0xd')](config[_0x4d2a('0xc')],{'host':_0x4d2a('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4d2a('0xf'))[_0x4d2a('0x10')](socket);function respondWithRpcPromise(_0x28242a,_0x1881ec,_0x424c33){return new BPromise(function(_0x56dc25,_0x4bea92){return client[_0x4d2a('0x11')](_0x28242a,_0x424c33)['then'](function(_0x3302bf){logger['info'](_0x4d2a('0x12'),_0x1881ec,_0x4d2a('0x13'));logger[_0x4d2a('0x14')](_0x4d2a('0x15'),_0x1881ec,'request\x20sent',JSON[_0x4d2a('0x16')](_0x3302bf));if(_0x3302bf[_0x4d2a('0x17')]){if(_0x3302bf[_0x4d2a('0x17')]['code']===0x1f4){logger[_0x4d2a('0x17')](_0x4d2a('0x12'),_0x1881ec,_0x3302bf['error'][_0x4d2a('0x18')]);return _0x4bea92(_0x3302bf[_0x4d2a('0x17')][_0x4d2a('0x18')]);}logger['error'](_0x4d2a('0x12'),_0x1881ec,_0x3302bf[_0x4d2a('0x17')][_0x4d2a('0x18')]);return _0x56dc25(_0x3302bf['error']['message']);}else{logger[_0x4d2a('0x19')](_0x4d2a('0x12'),_0x1881ec,_0x4d2a('0x13'));_0x56dc25(_0x3302bf[_0x4d2a('0x1a')]['message']);}})[_0x4d2a('0x1b')](function(_0x3d9dab){logger[_0x4d2a('0x17')]('VoiceQueue,\x20%s,\x20%s',_0x1881ec,_0x3d9dab);_0x4bea92(_0x3d9dab);});});}exports[_0x4d2a('0x1c')]=function(_0x840eed){var _0xa27e5f=this;return new Promise(function(_0x124481,_0x41ef36){return db[_0x4d2a('0x1d')]['findAll']({'raw':_0x840eed[_0x4d2a('0x1e')]?_0x840eed[_0x4d2a('0x1e')][_0x4d2a('0x1f')]===undefined?!![]:![]:!![],'where':_0x840eed['options']?_0x840eed['options'][_0x4d2a('0x20')]||null:null,'attributes':_0x840eed[_0x4d2a('0x1e')]?_0x840eed[_0x4d2a('0x1e')][_0x4d2a('0x21')]||null:null,'limit':_0x840eed[_0x4d2a('0x1e')]?_0x840eed['options'][_0x4d2a('0x22')]||null:null,'include':_0x840eed[_0x4d2a('0x1e')]?_0x840eed['options'][_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x840eed[_0x4d2a('0x1e')][_0x4d2a('0x23')],function(_0x171863){return{'model':db[_0x171863[_0x4d2a('0x25')]],'as':_0x171863['as'],'attributes':_0x171863[_0x4d2a('0x21')],'include':_0x171863[_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x171863['include'],function(_0x29ff0e){return{'model':db[_0x29ff0e[_0x4d2a('0x25')]],'as':_0x29ff0e['as'],'attributes':_0x29ff0e[_0x4d2a('0x21')],'include':_0x29ff0e[_0x4d2a('0x23')]?_['map'](_0x29ff0e['include'],function(_0x1e9ac1){return{'model':db[_0x1e9ac1[_0x4d2a('0x25')]],'as':_0x1e9ac1['as'],'attributes':_0x1e9ac1[_0x4d2a('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4d2a('0x26')](function(_0x2bab35){logger[_0x4d2a('0x19')](_0x4d2a('0x1c'),_0x840eed);logger['debug'](_0x4d2a('0x1c'),_0x840eed,JSON[_0x4d2a('0x16')](_0x2bab35));_0x124481(_0x2bab35);})['catch'](function(_0x55a488){logger['error'](_0x4d2a('0x1c'),_0x55a488[_0x4d2a('0x18')],_0x840eed);_0x41ef36(_0xa27e5f['error'](0x1f4,_0x55a488[_0x4d2a('0x18')]));});});};exports[_0x4d2a('0x27')]=function(_0x603b96){var _0x8d8958=this;return new Promise(function(_0x266aa9,_0x5eabf3){return db['VoiceQueue'][_0x4d2a('0x28')]({'raw':_0x603b96[_0x4d2a('0x1e')]?_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x1f')]===undefined?!![]:![]:!![],'where':_0x603b96[_0x4d2a('0x1e')]?_0x603b96['options'][_0x4d2a('0x20')]||null:null,'attributes':_0x603b96[_0x4d2a('0x1e')]?_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x21')]||null:null,'include':_0x603b96[_0x4d2a('0x1e')]?_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x603b96[_0x4d2a('0x1e')][_0x4d2a('0x23')],function(_0x1964c7){return{'model':db[_0x1964c7[_0x4d2a('0x25')]],'as':_0x1964c7['as'],'attributes':_0x1964c7[_0x4d2a('0x21')],'include':_0x1964c7[_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x1964c7[_0x4d2a('0x23')],function(_0x232199){return{'model':db[_0x232199[_0x4d2a('0x25')]],'as':_0x232199['as'],'attributes':_0x232199['attributes'],'include':_0x232199[_0x4d2a('0x23')]?_[_0x4d2a('0x24')](_0x232199[_0x4d2a('0x23')],function(_0x55ff99){return{'model':db[_0x55ff99[_0x4d2a('0x25')]],'as':_0x55ff99['as'],'attributes':_0x55ff99['attributes']};}):[]};}):[]};}):[]:[]})[_0x4d2a('0x26')](function(_0x4bfdd5){logger[_0x4d2a('0x19')](_0x4d2a('0x27'),_0x603b96);logger[_0x4d2a('0x14')]('ShowVoiceQueue',_0x603b96,JSON[_0x4d2a('0x16')](_0x4bfdd5));_0x266aa9(_0x4bfdd5);})['catch'](function(_0x2f7c44){logger[_0x4d2a('0x17')](_0x4d2a('0x27'),_0x2f7c44[_0x4d2a('0x18')],_0x603b96);_0x5eabf3(_0x8d8958[_0x4d2a('0x17')](0x1f4,_0x2f7c44['message']));});});}; \ No newline at end of file +var _0xb643=['request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','message','error','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','include','map','attributes','model','debug','ShowVoiceQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket'];(function(_0x1c8258,_0x508592){var _0x5dae8d=function(_0x51f6c9){while(--_0x51f6c9){_0x1c8258['push'](_0x1c8258['shift']());}};_0x5dae8d(++_0x508592);}(_0xb643,0x1bd));var _0x3b64=function(_0x728761,_0x4132a6){_0x728761=_0x728761-0x0;var _0xe26006=_0xb643[_0x728761];return _0xe26006;};'use strict';var _=require(_0x3b64('0x0'));var util=require(_0x3b64('0x1'));var moment=require('moment');var BPromise=require(_0x3b64('0x2'));var rs=require(_0x3b64('0x3'));var fs=require('fs');var Redis=require(_0x3b64('0x4'));var db=require(_0x3b64('0x5'))['db'];var utils=require(_0x3b64('0x6'));var logger=require(_0x3b64('0x7'))(_0x3b64('0x8'));var config=require(_0x3b64('0x9'));var jayson=require(_0x3b64('0xa'));var client=jayson['client'][_0x3b64('0xb')]({'port':0x232a});config[_0x3b64('0xc')]=_[_0x3b64('0xd')](config[_0x3b64('0xc')],{'host':_0x3b64('0xe'),'port':0x18eb});var socket=require(_0x3b64('0xf'))(new Redis(config['redis']));require(_0x3b64('0x10'))['register'](socket);function respondWithRpcPromise(_0x461fe8,_0x3e90e6,_0x18c9c7){return new BPromise(function(_0xe37d36,_0xb75d03){return client[_0x3b64('0x11')](_0x461fe8,_0x18c9c7)[_0x3b64('0x12')](function(_0x4cad0a){logger[_0x3b64('0x13')](_0x3b64('0x14'),_0x3e90e6,'request\x20sent');logger['debug'](_0x3b64('0x15'),_0x3e90e6,_0x3b64('0x16'),JSON[_0x3b64('0x17')](_0x4cad0a));if(_0x4cad0a['error']){if(_0x4cad0a['error'][_0x3b64('0x18')]===0x1f4){logger['error'](_0x3b64('0x14'),_0x3e90e6,_0x4cad0a['error'][_0x3b64('0x19')]);return _0xb75d03(_0x4cad0a['error'][_0x3b64('0x19')]);}logger[_0x3b64('0x1a')](_0x3b64('0x14'),_0x3e90e6,_0x4cad0a[_0x3b64('0x1a')]['message']);return _0xe37d36(_0x4cad0a[_0x3b64('0x1a')][_0x3b64('0x19')]);}else{logger[_0x3b64('0x13')]('VoiceQueue,\x20%s,\x20%s',_0x3e90e6,_0x3b64('0x16'));_0xe37d36(_0x4cad0a[_0x3b64('0x1b')]['message']);}})[_0x3b64('0x1c')](function(_0x117c10){logger[_0x3b64('0x1a')]('VoiceQueue,\x20%s,\x20%s',_0x3e90e6,_0x117c10);_0xb75d03(_0x117c10);});});}exports[_0x3b64('0x1d')]=function(_0x1330cf){var _0x198aa3=this;return new Promise(function(_0x4a144c,_0x3c0ebd){return db[_0x3b64('0x1e')][_0x3b64('0x1f')]({'raw':_0x1330cf[_0x3b64('0x20')]?_0x1330cf[_0x3b64('0x20')][_0x3b64('0x21')]===undefined?!![]:![]:!![],'where':_0x1330cf[_0x3b64('0x20')]?_0x1330cf['options'][_0x3b64('0x22')]||null:null,'attributes':_0x1330cf['options']?_0x1330cf[_0x3b64('0x20')]['attributes']||null:null,'limit':_0x1330cf['options']?_0x1330cf[_0x3b64('0x20')][_0x3b64('0x23')]||null:null,'include':_0x1330cf[_0x3b64('0x20')]?_0x1330cf['options'][_0x3b64('0x24')]?_[_0x3b64('0x25')](_0x1330cf[_0x3b64('0x20')]['include'],function(_0xdf92da){return{'model':db[_0xdf92da['model']],'as':_0xdf92da['as'],'attributes':_0xdf92da[_0x3b64('0x26')],'include':_0xdf92da[_0x3b64('0x24')]?_[_0x3b64('0x25')](_0xdf92da[_0x3b64('0x24')],function(_0x476d54){return{'model':db[_0x476d54['model']],'as':_0x476d54['as'],'attributes':_0x476d54[_0x3b64('0x26')],'include':_0x476d54[_0x3b64('0x24')]?_['map'](_0x476d54[_0x3b64('0x24')],function(_0x4d25bf){return{'model':db[_0x4d25bf[_0x3b64('0x27')]],'as':_0x4d25bf['as'],'attributes':_0x4d25bf[_0x3b64('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3b64('0x12')](function(_0x42c195){logger[_0x3b64('0x13')](_0x3b64('0x1d'),_0x1330cf);logger[_0x3b64('0x28')]('GetVoiceQueue',_0x1330cf,JSON[_0x3b64('0x17')](_0x42c195));_0x4a144c(_0x42c195);})[_0x3b64('0x1c')](function(_0x19fc07){logger[_0x3b64('0x1a')](_0x3b64('0x1d'),_0x19fc07[_0x3b64('0x19')],_0x1330cf);_0x3c0ebd(_0x198aa3[_0x3b64('0x1a')](0x1f4,_0x19fc07[_0x3b64('0x19')]));});});};exports['ShowVoiceQueue']=function(_0x2cfd49){var _0x1025bc=this;return new Promise(function(_0x52336c,_0x2e97a3){return db[_0x3b64('0x1e')]['find']({'raw':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49['options'][_0x3b64('0x21')]===undefined?!![]:![]:!![],'where':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49[_0x3b64('0x20')][_0x3b64('0x22')]||null:null,'attributes':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49['options'][_0x3b64('0x26')]||null:null,'include':_0x2cfd49[_0x3b64('0x20')]?_0x2cfd49['options']['include']?_['map'](_0x2cfd49[_0x3b64('0x20')]['include'],function(_0x96fbe2){return{'model':db[_0x96fbe2[_0x3b64('0x27')]],'as':_0x96fbe2['as'],'attributes':_0x96fbe2[_0x3b64('0x26')],'include':_0x96fbe2[_0x3b64('0x24')]?_[_0x3b64('0x25')](_0x96fbe2[_0x3b64('0x24')],function(_0x313e63){return{'model':db[_0x313e63[_0x3b64('0x27')]],'as':_0x313e63['as'],'attributes':_0x313e63[_0x3b64('0x26')],'include':_0x313e63[_0x3b64('0x24')]?_[_0x3b64('0x25')](_0x313e63[_0x3b64('0x24')],function(_0x2b548f){return{'model':db[_0x2b548f[_0x3b64('0x27')]],'as':_0x2b548f['as'],'attributes':_0x2b548f[_0x3b64('0x26')]};}):[]};}):[]};}):[]:[]})[_0x3b64('0x12')](function(_0x25a72b){logger[_0x3b64('0x13')](_0x3b64('0x29'),_0x2cfd49);logger[_0x3b64('0x28')](_0x3b64('0x29'),_0x2cfd49,JSON[_0x3b64('0x17')](_0x25a72b));_0x52336c(_0x25a72b);})['catch'](function(_0x46123a){logger[_0x3b64('0x1a')](_0x3b64('0x29'),_0x46123a[_0x3b64('0x19')],_0x2cfd49);_0x2e97a3(_0x1025bc[_0x3b64('0x1a')](0x1f4,_0x46123a[_0x3b64('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index ce07011..4f0a0e3 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 _0x90c9=['./voiceQueue.events','remove','emit','register','length','voiceQueue:'];(function(_0x1e8ac9,_0x1bd0fe){var _0x4c895c=function(_0x3cc2f5){while(--_0x3cc2f5){_0x1e8ac9['push'](_0x1e8ac9['shift']());}};_0x4c895c(++_0x1bd0fe);}(_0x90c9,0x132));var _0x990c=function(_0x3b4455,_0x3e4395){_0x3b4455=_0x3b4455-0x0;var _0x34dd09=_0x90c9[_0x3b4455];return _0x34dd09;};'use strict';var VoiceQueueEvents=require(_0x990c('0x0'));var events=['save',_0x990c('0x1'),'update'];function createListener(_0x1f45b0,_0x29161a){return function(_0x24c8cf){_0x29161a[_0x990c('0x2')](_0x1f45b0,_0x24c8cf);};}function removeListener(_0x3916bc,_0x11da62){return function(){VoiceQueueEvents['removeListener'](_0x3916bc,_0x11da62);};}exports[_0x990c('0x3')]=function(_0x20adb7){for(var _0x3f9b32=0x0,_0x3b3b3b=events[_0x990c('0x4')];_0x3f9b32<_0x3b3b3b;_0x3f9b32++){var _0x197fca=events[_0x3f9b32];var _0x156f3d=createListener(_0x990c('0x5')+_0x197fca,_0x20adb7);VoiceQueueEvents['on'](_0x197fca,_0x156f3d);}}; \ No newline at end of file +var _0x4ce5=['remove','emit','removeListener','register','length','voiceQueue:','save'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x4ce5,0x156));var _0x54ce=function(_0x237303,_0x24caba){_0x237303=_0x237303-0x0;var _0x175af1=_0x4ce5[_0x237303];return _0x175af1;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x54ce('0x0'),_0x54ce('0x1'),'update'];function createListener(_0x59f37e,_0x1abb5e){return function(_0x380104){_0x1abb5e[_0x54ce('0x2')](_0x59f37e,_0x380104);};}function removeListener(_0x3ff2c7,_0x52bf70){return function(){VoiceQueueEvents[_0x54ce('0x3')](_0x3ff2c7,_0x52bf70);};}exports[_0x54ce('0x4')]=function(_0x322a3e){for(var _0x1c0da0=0x0,_0x519db8=events[_0x54ce('0x5')];_0x1c0da0<_0x519db8;_0x1c0da0++){var _0x208ef8=events[_0x1c0da0];var _0x55ee98=createListener(_0x54ce('0x6')+_0x208ef8,_0x322a3e);VoiceQueueEvents['on'](_0x208ef8,_0x55ee98);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 9e5b5cb..167a2f0 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 _0xb115=['Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/index','getVoiceQueuesReport','/:id','show','post','create','update','destroy','multer','util','path','connect-timeout','express'];(function(_0x3dbf57,_0x69ef04){var _0x565737=function(_0x4c37c1){while(--_0x4c37c1){_0x3dbf57['push'](_0x3dbf57['shift']());}};_0x565737(++_0x69ef04);}(_0xb115,0x1c3));var _0x5b11=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0xb115[_0x8c43de];return _0xa6591b;};'use strict';var multer=require(_0x5b11('0x0'));var util=require(_0x5b11('0x1'));var path=require(_0x5b11('0x2'));var timeout=require(_0x5b11('0x3'));var express=require(_0x5b11('0x4'));var router=express[_0x5b11('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x5b11('0x6'));var config=require(_0x5b11('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x5b11('0x8')]('/',auth[_0x5b11('0x9')](),controller[_0x5b11('0xa')]);router[_0x5b11('0x8')]('/describe',auth[_0x5b11('0x9')](),controller['describe']);router['get'](_0x5b11('0xb'),auth[_0x5b11('0x9')](),controller[_0x5b11('0xc')]);router[_0x5b11('0x8')](_0x5b11('0xd'),auth[_0x5b11('0x9')](),controller[_0x5b11('0xe')]);router[_0x5b11('0xf')]('/',auth[_0x5b11('0x9')](),controller[_0x5b11('0x10')]);router['put'](_0x5b11('0xd'),auth[_0x5b11('0x9')](),controller[_0x5b11('0x11')]);router['delete'](_0x5b11('0xd'),auth[_0x5b11('0x9')](),controller[_0x5b11('0x12')]);module['exports']=router; \ No newline at end of file +var _0x9f8b=['./voiceQueueReport.controller','get','isAuthenticated','index','describe','/index','getVoiceQueuesReport','show','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3dab20,_0x38ca19){var _0x30f7da=function(_0x251e65){while(--_0x251e65){_0x3dab20['push'](_0x3dab20['shift']());}};_0x30f7da(++_0x38ca19);}(_0x9f8b,0x1f3));var _0xb9f8=function(_0x46f7f0,_0x4ef418){_0x46f7f0=_0x46f7f0-0x0;var _0x783786=_0x9f8b[_0x46f7f0];return _0x783786;};'use strict';var multer=require(_0xb9f8('0x0'));var util=require(_0xb9f8('0x1'));var path=require('path');var timeout=require(_0xb9f8('0x2'));var express=require(_0xb9f8('0x3'));var router=express[_0xb9f8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb9f8('0x5'));var interaction=require(_0xb9f8('0x6'));var config=require('../../config/environment');var controller=require(_0xb9f8('0x7'));router[_0xb9f8('0x8')]('/',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xa')]);router[_0xb9f8('0x8')]('/describe',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xb')]);router[_0xb9f8('0x8')](_0xb9f8('0xc'),auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xd')]);router[_0xb9f8('0x8')]('/:id',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb9f8('0xf')]);router[_0xb9f8('0x10')]('/:id',auth[_0xb9f8('0x9')](),controller[_0xb9f8('0x11')]);router[_0xb9f8('0x12')](_0xb9f8('0x13'),auth[_0xb9f8('0x9')](),controller[_0xb9f8('0x14')]);module[_0xb9f8('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a2acff9..a6cf090 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 _0x8583=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','getDataValue','queuecallerjoinAt','diff','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0x23129b,_0x2d13ae){var _0x3b2fe9=function(_0x4cd6b7){while(--_0x4cd6b7){_0x23129b['push'](_0x23129b['shift']());}};_0x3b2fe9(++_0x2d13ae);}(_0x8583,0x1f3));var _0x3858=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8583[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x3858('0x0'));var moment=require('moment');module[_0x3858('0x1')]={'type':{'type':Sequelize[_0x3858('0x2')]},'uniqueid':{'type':Sequelize[_0x3858('0x2')]},'calleridnum':{'type':Sequelize[_0x3858('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3858('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x3858('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x3858('0x3')],'set':function(_0x23b5fa){var _0x5d8c86=moment(_0x23b5fa);var _0x198f00=moment(this[_0x3858('0x4')](_0x3858('0x5')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x301ed4=_0x5d8c86[_0x3858('0x6')](_0x198f00,_0x3858('0x7'));this[_0x3858('0x8')](_0x3858('0x9'),_0x23b5fa);this[_0x3858('0x8')](_0x3858('0xa'),_0x301ed4||null);}},'position':{'type':Sequelize[_0x3858('0xb')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x3858('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x3858('0x3')]},'queuecallerexit':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0x3858('0x2')],'comment':_0x3858('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x3858('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3858('0x2')]},'connectedlinename':{'type':Sequelize[_0x3858('0x2')]},'accountcode':{'type':Sequelize[_0x3858('0x2')]},'context':{'type':Sequelize[_0x3858('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3858('0x2')]},'holdtime':{'type':Sequelize[_0x3858('0xb')]},'mohtime':{'type':Sequelize[_0x3858('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x3858('0x2')]},'transfer':{'type':Sequelize[_0x3858('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x3858('0x2')],'comment':_0x3858('0xe')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x3858('0x2')]},'disposition':{'type':Sequelize[_0x3858('0x2')]},'secondDisposition':{'type':Sequelize[_0x3858('0x2')]},'thirdDisposition':{'type':Sequelize[_0x3858('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x3858('0xb')],'defaultValue':0x0},'note':{'type':Sequelize[_0x3858('0x2')]}}; \ No newline at end of file +var _0xb7b7=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','holdtime','INTEGER'];(function(_0xe00bb8,_0x4e5e0a){var _0x5278f4=function(_0x3c2dbf){while(--_0x3c2dbf){_0xe00bb8['push'](_0xe00bb8['shift']());}};_0x5278f4(++_0x4e5e0a);}(_0xb7b7,0x136));var _0x7b7b=function(_0x5b4a16,_0x56e5c7){_0x5b4a16=_0x5b4a16-0x0;var _0x3a2ad0=_0xb7b7[_0x5b4a16];return _0x3a2ad0;};'use strict';var Sequelize=require(_0x7b7b('0x0'));var moment=require('moment');module[_0x7b7b('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x7b7b('0x2')]},'calleridnum':{'type':Sequelize[_0x7b7b('0x2')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7b7b('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x7b7b('0x3')],'set':function(_0x246762){var _0x2329cf=moment(_0x246762);var _0x1c97e0=moment(this['getDataValue']('queuecallerjoinAt'))['format'](_0x7b7b('0x4'));var _0x13fa0a=_0x2329cf[_0x7b7b('0x5')](_0x1c97e0,'seconds');this['setDataValue']('queuecallerleaveAt',_0x246762);this[_0x7b7b('0x6')](_0x7b7b('0x7'),_0x13fa0a||null);}},'position':{'type':Sequelize[_0x7b7b('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x7b7b('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x7b7b('0x3')]},'queuecallerexit':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x7b7b('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x7b7b('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x7b7b('0x8')]},'channel':{'type':Sequelize[_0x7b7b('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7b7b('0x2')]},'connectedlinename':{'type':Sequelize[_0x7b7b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x7b7b('0x2')]},'exten':{'type':Sequelize[_0x7b7b('0x2')]},'priority':{'type':Sequelize[_0x7b7b('0x2')]},'holdtime':{'type':Sequelize[_0x7b7b('0x8')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x7b7b('0x2')]},'transfer':{'type':Sequelize[_0x7b7b('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x7b7b('0xa')},'transferexten':{'type':Sequelize[_0x7b7b('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x7b7b('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x7b7b('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x7b7b('0x8')],'defaultValue':0x0},'note':{'type':Sequelize[_0x7b7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 2d77b9d..f853923 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 _0x5e99=['update','destroy','then','sendStatus','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','describe','hasOwnProperty','order','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./voiceQueueReport.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x3fbf74,_0x45e0ec){var _0x4d32d8=function(_0x47caa6){while(--_0x47caa6){_0x3fbf74['push'](_0x3fbf74['shift']());}};_0x4d32d8(++_0x45e0ec);}(_0x5e99,0x18d));var _0x95e9=function(_0x20919b,_0x32b866){_0x20919b=_0x20919b-0x0;var _0x3b9092=_0x5e99[_0x20919b];return _0x3b9092;};'use strict';var emlformat=require(_0x95e9('0x0'));var rimraf=require(_0x95e9('0x1'));var zipdir=require(_0x95e9('0x2'));var jsonpatch=require(_0x95e9('0x3'));var rp=require('request-promise');var moment=require(_0x95e9('0x4'));var BPromise=require(_0x95e9('0x5'));var Mustache=require(_0x95e9('0x6'));var util=require(_0x95e9('0x7'));var path=require(_0x95e9('0x8'));var sox=require(_0x95e9('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95e9('0xa'));var _=require(_0x95e9('0xb'));var squel=require(_0x95e9('0xc'));var crypto=require(_0x95e9('0xd'));var jsforce=require(_0x95e9('0xe'));var deskjs=require(_0x95e9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x95e9('0x10'));var Papa=require(_0x95e9('0x11'));var Redis=require(_0x95e9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x95e9('0x13'));var as=require(_0x95e9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95e9('0x15'))(_0x95e9('0x16'));var utils=require('../../config/utils');var config=require(_0x95e9('0x17'));var licenseUtil=require(_0x95e9('0x18'));var db=require(_0x95e9('0x19'))['db'];config['redis']=_[_0x95e9('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x95e9('0x1b'))(new Redis(config[_0x95e9('0x1c')]));require(_0x95e9('0x1d'))[_0x95e9('0x1e')](socket);function respondWithStatusCode(_0x2c7595,_0x5f29c4){_0x5f29c4=_0x5f29c4||0xcc;return function(_0x2bb8a1){if(_0x2bb8a1){return _0x2c7595['sendStatus'](_0x5f29c4);}return _0x2c7595[_0x95e9('0x1f')](_0x5f29c4)[_0x95e9('0x20')]();};}function respondWithResult(_0x21b46e,_0x156338){_0x156338=_0x156338||0xc8;return function(_0x6646c){if(_0x6646c){return _0x21b46e[_0x95e9('0x1f')](_0x156338)[_0x95e9('0x21')](_0x6646c);}};}function respondWithFilteredResult(_0x1367d6,_0x20b005){return function(_0x333fa7){if(_0x333fa7){var _0x1b3a3=typeof _0x20b005[_0x95e9('0x22')]===_0x95e9('0x23')&&typeof _0x20b005[_0x95e9('0x24')]===_0x95e9('0x23');var _0x2994e6=_0x333fa7[_0x95e9('0x25')];var _0x2bb0d9=_0x1b3a3?0x0:_0x20b005[_0x95e9('0x22')];var _0x47ee71=_0x1b3a3?_0x333fa7[_0x95e9('0x25')]:_0x20b005[_0x95e9('0x22')]+_0x20b005[_0x95e9('0x24')];var _0x11017e;if(_0x47ee71>=_0x2994e6){_0x47ee71=_0x2994e6;_0x11017e=0xc8;}else{_0x11017e=0xce;}_0x1367d6[_0x95e9('0x1f')](_0x11017e);return _0x1367d6[_0x95e9('0x26')](_0x95e9('0x27'),_0x2bb0d9+'-'+_0x47ee71+'/'+_0x2994e6)[_0x95e9('0x21')](_0x333fa7);}return null;};}function patchUpdates(_0x5cb9f3){return function(_0x281103){try{jsonpatch[_0x95e9('0x28')](_0x281103,_0x5cb9f3,!![]);}catch(_0x54ea3f){return BPromise[_0x95e9('0x29')](_0x54ea3f);}return _0x281103[_0x95e9('0x2a')]();};}function saveUpdates(_0x5172bc,_0x2edf2c){return function(_0x543a6a){if(_0x543a6a){return _0x543a6a[_0x95e9('0x2b')](_0x5172bc)['then'](function(_0x40d824){return _0x40d824;});}return null;};}function removeEntity(_0x2a1bc5,_0x4c79a6){return function(_0x2bd833){if(_0x2bd833){return _0x2bd833[_0x95e9('0x2c')]()[_0x95e9('0x2d')](function(){_0x2a1bc5[_0x95e9('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e0de3,_0x225cc8){return function(_0x4d1c7c){if(!_0x4d1c7c){_0x4e0de3[_0x95e9('0x2e')](0x194);}return _0x4d1c7c;};}function handleError(_0x1004f3,_0x29d053){_0x29d053=_0x29d053||0x1f4;return function(_0x20ca31){logger[_0x95e9('0x2f')](_0x20ca31[_0x95e9('0x30')]);if(_0x20ca31[_0x95e9('0x31')]){delete _0x20ca31[_0x95e9('0x31')];}_0x1004f3[_0x95e9('0x1f')](_0x29d053)[_0x95e9('0x32')](_0x20ca31);};}exports[_0x95e9('0x33')]=function(_0x2016a4,_0x12024e){var _0x9b8502={},_0x1bcb58={},_0x31532a={'count':0x0,'rows':[]};var _0x512dee=_['map'](db[_0x95e9('0x34')][_0x95e9('0x35')],function(_0x57fd0f){return{'name':_0x57fd0f[_0x95e9('0x36')],'type':_0x57fd0f[_0x95e9('0x37')][_0x95e9('0x38')]};});_0x1bcb58[_0x95e9('0x39')]=_[_0x95e9('0x3a')](_0x512dee,_0x95e9('0x31'));_0x1bcb58['query']=_[_0x95e9('0x3b')](_0x2016a4[_0x95e9('0x3c')]);_0x1bcb58[_0x95e9('0x3d')]=_[_0x95e9('0x3e')](_0x1bcb58[_0x95e9('0x39')],_0x1bcb58[_0x95e9('0x3c')]);_0x9b8502[_0x95e9('0x3f')]=_[_0x95e9('0x3e')](_0x1bcb58['model'],qs[_0x95e9('0x40')](_0x2016a4[_0x95e9('0x3c')][_0x95e9('0x40')]));_0x9b8502['attributes']=_0x9b8502[_0x95e9('0x3f')][_0x95e9('0x41')]?_0x9b8502[_0x95e9('0x3f')]:_0x1bcb58[_0x95e9('0x39')];if(!_0x2016a4[_0x95e9('0x3c')]['hasOwnProperty'](_0x95e9('0x42'))){_0x9b8502['limit']=qs['limit'](_0x2016a4[_0x95e9('0x3c')]['limit']);_0x9b8502[_0x95e9('0x22')]=qs['offset'](_0x2016a4[_0x95e9('0x3c')]['offset']);}_0x9b8502['order']=qs[_0x95e9('0x43')](_0x2016a4[_0x95e9('0x3c')]['sort']);_0x9b8502[_0x95e9('0x44')]=qs[_0x95e9('0x3d')](_[_0x95e9('0x45')](_0x2016a4['query'],_0x1bcb58[_0x95e9('0x3d')]),_0x512dee);if(_0x2016a4[_0x95e9('0x3c')][_0x95e9('0x46')]){_0x9b8502['where']=_[_0x95e9('0x47')](_0x9b8502['where'],{'$or':_[_0x95e9('0x3a')](_0x512dee,function(_0x4efd55){if(_0x4efd55[_0x95e9('0x37')]!==_0x95e9('0x48')){var _0x157d7a={};_0x157d7a[_0x4efd55['name']]={'$like':'%'+_0x2016a4[_0x95e9('0x3c')]['filter']+'%'};return _0x157d7a;}})});}_0x9b8502=_[_0x95e9('0x47')]({},_0x9b8502,_0x2016a4[_0x95e9('0x49')]);var _0x1461eb={'where':_0x9b8502[_0x95e9('0x44')]};return db[_0x95e9('0x34')][_0x95e9('0x25')](_0x1461eb)[_0x95e9('0x2d')](function(_0x168ccd){_0x31532a[_0x95e9('0x25')]=_0x168ccd;if(_0x2016a4[_0x95e9('0x3c')][_0x95e9('0x4a')]){_0x9b8502[_0x95e9('0x4b')]=[{'all':!![]}];}return db[_0x95e9('0x34')][_0x95e9('0x4c')](_0x9b8502);})[_0x95e9('0x2d')](function(_0x3a04fd){_0x31532a[_0x95e9('0x4d')]=_0x3a04fd;return _0x31532a;})['then'](respondWithFilteredResult(_0x12024e,_0x9b8502))['catch'](handleError(_0x12024e,null));};exports[_0x95e9('0x4e')]=function(_0x58b2ba,_0xdb5c14){var _0x54b203={'raw':![],'where':{'id':_0x58b2ba[_0x95e9('0x4f')]['id']}},_0x43b7d6={};_0x43b7d6[_0x95e9('0x39')]=_[_0x95e9('0x3b')](db['VoiceQueueReport'][_0x95e9('0x35')]);_0x43b7d6['query']=_[_0x95e9('0x3b')](_0x58b2ba[_0x95e9('0x3c')]);_0x43b7d6[_0x95e9('0x3d')]=_[_0x95e9('0x3e')](_0x43b7d6['model'],_0x43b7d6['query']);_0x54b203[_0x95e9('0x3f')]=_['intersection'](_0x43b7d6[_0x95e9('0x39')],qs['fields'](_0x58b2ba['query'][_0x95e9('0x40')]));_0x54b203[_0x95e9('0x3f')]=_0x54b203[_0x95e9('0x3f')][_0x95e9('0x41')]?_0x54b203[_0x95e9('0x3f')]:_0x43b7d6[_0x95e9('0x39')];if(_0x58b2ba[_0x95e9('0x3c')][_0x95e9('0x4a')]){_0x54b203[_0x95e9('0x4b')]=[{'all':!![]}];}_0x54b203=_[_0x95e9('0x47')]({},_0x54b203,_0x58b2ba[_0x95e9('0x49')]);return db[_0x95e9('0x34')][_0x95e9('0x50')](_0x54b203)[_0x95e9('0x2d')](handleEntityNotFound(_0xdb5c14,null))[_0x95e9('0x2d')](respondWithResult(_0xdb5c14,null))[_0x95e9('0x51')](handleError(_0xdb5c14,null));};exports[_0x95e9('0x52')]=function(_0x110b11,_0x37f426){return db[_0x95e9('0x34')][_0x95e9('0x52')](_0x110b11['body'],{})[_0x95e9('0x2d')](respondWithResult(_0x37f426,0xc9))[_0x95e9('0x51')](handleError(_0x37f426,null));};exports[_0x95e9('0x2b')]=function(_0x339bc4,_0x1d9e69){if(_0x339bc4['body']['id']){delete _0x339bc4[_0x95e9('0x53')]['id'];}return db[_0x95e9('0x34')]['find']({'where':{'id':_0x339bc4['params']['id']}})[_0x95e9('0x2d')](handleEntityNotFound(_0x1d9e69,null))[_0x95e9('0x2d')](saveUpdates(_0x339bc4[_0x95e9('0x53')],null))[_0x95e9('0x2d')](respondWithResult(_0x1d9e69,null))[_0x95e9('0x51')](handleError(_0x1d9e69,null));};exports['destroy']=function(_0x164416,_0xf1ed38){return db['VoiceQueueReport'][_0x95e9('0x50')]({'where':{'id':_0x164416[_0x95e9('0x4f')]['id']}})['then'](handleEntityNotFound(_0xf1ed38,null))[_0x95e9('0x2d')](removeEntity(_0xf1ed38,null))[_0x95e9('0x51')](handleError(_0xf1ed38,null));};exports['describe']=function(_0x4e401a,_0xe4fb9b){return db['VoiceQueueReport'][_0x95e9('0x54')]()[_0x95e9('0x2d')](respondWithResult(_0xe4fb9b,null))[_0x95e9('0x51')](handleError(_0xe4fb9b,null));};exports['getVoiceQueuesReport']=function(_0x323da6,_0x2817f4){var _0x1ad64f={},_0x141bb8={},_0x1a73a5={'count':0x0,'rows':[]};_0x141bb8[_0x95e9('0x39')]=_[_0x95e9('0x3b')](db['VoiceQueueReport'][_0x95e9('0x35')]);_0x141bb8[_0x95e9('0x3c')]=_[_0x95e9('0x3b')](_0x323da6[_0x95e9('0x3c')]);_0x141bb8['filters']=_[_0x95e9('0x3e')](_0x141bb8[_0x95e9('0x39')],_0x141bb8['query']);_0x1ad64f[_0x95e9('0x3f')]=_[_0x95e9('0x3e')](_0x141bb8[_0x95e9('0x39')],qs[_0x95e9('0x40')](_0x323da6[_0x95e9('0x3c')]['fields']));_0x1ad64f['attributes']=_0x1ad64f[_0x95e9('0x3f')][_0x95e9('0x41')]?_0x1ad64f[_0x95e9('0x3f')]:_0x141bb8[_0x95e9('0x39')];if(!_0x323da6['query'][_0x95e9('0x55')](_0x95e9('0x42'))){_0x1ad64f[_0x95e9('0x24')]=qs[_0x95e9('0x24')](_0x323da6[_0x95e9('0x3c')]['limit']);_0x1ad64f['offset']=qs[_0x95e9('0x22')](_0x323da6[_0x95e9('0x3c')][_0x95e9('0x22')]);}_0x1ad64f[_0x95e9('0x56')]=qs[_0x95e9('0x43')](_0x323da6[_0x95e9('0x3c')][_0x95e9('0x43')]);_0x1ad64f[_0x95e9('0x44')]=qs[_0x95e9('0x3d')](_[_0x95e9('0x45')](_0x323da6[_0x95e9('0x3c')],_0x141bb8['filters']));if(_0x323da6[_0x95e9('0x3c')][_0x95e9('0x46')]){_0x1ad64f[_0x95e9('0x44')]=_[_0x95e9('0x47')](_0x1ad64f['where'],{'$or':_[_0x95e9('0x3a')](_0x1ad64f[_0x95e9('0x3f')],function(_0x362da0){var _0x3f33d0={};_0x3f33d0[_0x362da0]={'$like':'%'+_0x323da6[_0x95e9('0x3c')][_0x95e9('0x46')]+'%'};return _0x3f33d0;})});}_0x1ad64f=_[_0x95e9('0x47')]({},_0x1ad64f,_0x323da6[_0x95e9('0x49')]);var _0x3ad1a6={'where':_0x1ad64f['where']};return db[_0x95e9('0x34')]['count'](_0x3ad1a6)[_0x95e9('0x2d')](function(_0x2b4645){_0x1a73a5['count']=_0x2b4645;if(_0x323da6['query'][_0x95e9('0x4a')]){_0x1ad64f[_0x95e9('0x4b')]=[{'all':!![]}];}return db[_0x95e9('0x34')][_0x95e9('0x4c')](_0x1ad64f);})['then'](function(_0x5c9c63){_0x1a73a5[_0x95e9('0x4d')]=_0x5c9c63;return _0x1a73a5;})[_0x95e9('0x2d')](respondWithFilteredResult(_0x2817f4,_0x1ad64f,_0x95e9('0x57')))['catch'](handleError(_0x2817f4,null,'getVoiceQueuesReport'));}; \ No newline at end of file +var _0x3a25=['model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','show','params','rawAttributes','include','options','find','catch','create','body','update','describe','getVoiceQueuesReport','keys','findAll','rows','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','VoiceQueueReport','fieldName','type','key'];(function(_0x2a7528,_0x5c95ce){var _0x1149d6=function(_0x10fa39){while(--_0x10fa39){_0x2a7528['push'](_0x2a7528['shift']());}};_0x1149d6(++_0x5c95ce);}(_0x3a25,0x109));var _0x53a2=function(_0x110c0d,_0x3eb336){_0x110c0d=_0x110c0d-0x0;var _0xa3fa7d=_0x3a25[_0x110c0d];return _0xa3fa7d;};'use strict';var emlformat=require(_0x53a2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x53a2('0x1'));var jsonpatch=require(_0x53a2('0x2'));var rp=require(_0x53a2('0x3'));var moment=require(_0x53a2('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x53a2('0x5'));var util=require(_0x53a2('0x6'));var path=require('path');var sox=require(_0x53a2('0x7'));var csv=require(_0x53a2('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x53a2('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x53a2('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53a2('0x8'));var querystring=require(_0x53a2('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x53a2('0xc'));var as=require(_0x53a2('0xd'));var hardwareService=require(_0x53a2('0xe'));var logger=require(_0x53a2('0xf'))(_0x53a2('0x10'));var utils=require(_0x53a2('0x11'));var config=require(_0x53a2('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x53a2('0x13'))['db'];config[_0x53a2('0x14')]=_[_0x53a2('0x15')](config['redis'],{'host':_0x53a2('0x16'),'port':0x18eb});var socket=require(_0x53a2('0x17'))(new Redis(config[_0x53a2('0x14')]));require('./voiceQueueReport.socket')[_0x53a2('0x18')](socket);function respondWithStatusCode(_0x1203d5,_0x2319a1){_0x2319a1=_0x2319a1||0xcc;return function(_0x47dff9){if(_0x47dff9){return _0x1203d5[_0x53a2('0x19')](_0x2319a1);}return _0x1203d5['status'](_0x2319a1)['end']();};}function respondWithResult(_0x302bc6,_0x2ff605){_0x2ff605=_0x2ff605||0xc8;return function(_0x1f291b){if(_0x1f291b){return _0x302bc6[_0x53a2('0x1a')](_0x2ff605)[_0x53a2('0x1b')](_0x1f291b);}};}function respondWithFilteredResult(_0x335a29,_0x479145){return function(_0x17f8eb){if(_0x17f8eb){var _0x1356af=typeof _0x479145[_0x53a2('0x1c')]==='undefined'&&typeof _0x479145[_0x53a2('0x1d')]===_0x53a2('0x1e');var _0x1bf894=_0x17f8eb[_0x53a2('0x1f')];var _0x54bf17=_0x1356af?0x0:_0x479145['offset'];var _0x3af7e3=_0x1356af?_0x17f8eb['count']:_0x479145[_0x53a2('0x1c')]+_0x479145[_0x53a2('0x1d')];var _0x3e2b07;if(_0x3af7e3>=_0x1bf894){_0x3af7e3=_0x1bf894;_0x3e2b07=0xc8;}else{_0x3e2b07=0xce;}_0x335a29['status'](_0x3e2b07);return _0x335a29['set'](_0x53a2('0x20'),_0x54bf17+'-'+_0x3af7e3+'/'+_0x1bf894)[_0x53a2('0x1b')](_0x17f8eb);}return null;};}function patchUpdates(_0xce3fbf){return function(_0x2287bf){try{jsonpatch[_0x53a2('0x21')](_0x2287bf,_0xce3fbf,!![]);}catch(_0x5024b1){return BPromise[_0x53a2('0x22')](_0x5024b1);}return _0x2287bf['save']();};}function saveUpdates(_0x35cd99,_0x3faed9){return function(_0x5eaf27){if(_0x5eaf27){return _0x5eaf27['update'](_0x35cd99)[_0x53a2('0x23')](function(_0x357492){return _0x357492;});}return null;};}function removeEntity(_0x2bea78,_0x1386af){return function(_0x209cce){if(_0x209cce){return _0x209cce[_0x53a2('0x24')]()[_0x53a2('0x23')](function(){_0x2bea78[_0x53a2('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53c053,_0x507044){return function(_0x386750){if(!_0x386750){_0x53c053['sendStatus'](0x194);}return _0x386750;};}function handleError(_0x5f2348,_0x4eb061){_0x4eb061=_0x4eb061||0x1f4;return function(_0x598bd4){logger[_0x53a2('0x25')](_0x598bd4[_0x53a2('0x26')]);if(_0x598bd4[_0x53a2('0x27')]){delete _0x598bd4['name'];}_0x5f2348[_0x53a2('0x1a')](_0x4eb061)[_0x53a2('0x28')](_0x598bd4);};}exports[_0x53a2('0x29')]=function(_0x5c3674,_0x91f072){var _0x148811={},_0x115e21={},_0x5dad1b={'count':0x0,'rows':[]};var _0x2c0b9f=_[_0x53a2('0x2a')](db[_0x53a2('0x2b')]['rawAttributes'],function(_0x35210a){return{'name':_0x35210a[_0x53a2('0x2c')],'type':_0x35210a[_0x53a2('0x2d')][_0x53a2('0x2e')]};});_0x115e21[_0x53a2('0x2f')]=_[_0x53a2('0x2a')](_0x2c0b9f,_0x53a2('0x27'));_0x115e21[_0x53a2('0x30')]=_['keys'](_0x5c3674[_0x53a2('0x30')]);_0x115e21[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x115e21['model'],_0x115e21[_0x53a2('0x30')]);_0x148811[_0x53a2('0x33')]=_[_0x53a2('0x32')](_0x115e21[_0x53a2('0x2f')],qs[_0x53a2('0x34')](_0x5c3674['query']['fields']));_0x148811[_0x53a2('0x33')]=_0x148811[_0x53a2('0x33')][_0x53a2('0x35')]?_0x148811[_0x53a2('0x33')]:_0x115e21[_0x53a2('0x2f')];if(!_0x5c3674[_0x53a2('0x30')][_0x53a2('0x36')](_0x53a2('0x37'))){_0x148811['limit']=qs['limit'](_0x5c3674[_0x53a2('0x30')]['limit']);_0x148811[_0x53a2('0x1c')]=qs['offset'](_0x5c3674[_0x53a2('0x30')]['offset']);}_0x148811[_0x53a2('0x38')]=qs[_0x53a2('0x39')](_0x5c3674[_0x53a2('0x30')][_0x53a2('0x39')]);_0x148811[_0x53a2('0x3a')]=qs['filters'](_[_0x53a2('0x3b')](_0x5c3674[_0x53a2('0x30')],_0x115e21[_0x53a2('0x31')]),_0x2c0b9f);if(_0x5c3674['query'][_0x53a2('0x3c')]){_0x148811[_0x53a2('0x3a')]=_['merge'](_0x148811[_0x53a2('0x3a')],{'$or':_[_0x53a2('0x2a')](_0x2c0b9f,function(_0x5783bd){if(_0x5783bd[_0x53a2('0x2d')]!=='VIRTUAL'){var _0xcc66e7={};_0xcc66e7[_0x5783bd[_0x53a2('0x27')]]={'$like':'%'+_0x5c3674[_0x53a2('0x30')]['filter']+'%'};return _0xcc66e7;}})});}_0x148811=_[_0x53a2('0x3d')]({},_0x148811,_0x5c3674['options']);var _0x20acd7={'where':_0x148811[_0x53a2('0x3a')]};return db['VoiceQueueReport'][_0x53a2('0x1f')](_0x20acd7)[_0x53a2('0x23')](function(_0x583dbd){_0x5dad1b[_0x53a2('0x1f')]=_0x583dbd;if(_0x5c3674['query'][_0x53a2('0x3e')]){_0x148811['include']=[{'all':!![]}];}return db[_0x53a2('0x2b')]['findAll'](_0x148811);})['then'](function(_0x1fd3c2){_0x5dad1b['rows']=_0x1fd3c2;return _0x5dad1b;})[_0x53a2('0x23')](respondWithFilteredResult(_0x91f072,_0x148811))['catch'](handleError(_0x91f072,null));};exports[_0x53a2('0x3f')]=function(_0x4c5f12,_0xff2c86){var _0x36e0d5={'raw':![],'where':{'id':_0x4c5f12[_0x53a2('0x40')]['id']}},_0x1cc212={};_0x1cc212[_0x53a2('0x2f')]=_['keys'](db[_0x53a2('0x2b')][_0x53a2('0x41')]);_0x1cc212[_0x53a2('0x30')]=_['keys'](_0x4c5f12[_0x53a2('0x30')]);_0x1cc212[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x1cc212[_0x53a2('0x2f')],_0x1cc212[_0x53a2('0x30')]);_0x36e0d5[_0x53a2('0x33')]=_[_0x53a2('0x32')](_0x1cc212[_0x53a2('0x2f')],qs[_0x53a2('0x34')](_0x4c5f12[_0x53a2('0x30')]['fields']));_0x36e0d5[_0x53a2('0x33')]=_0x36e0d5[_0x53a2('0x33')][_0x53a2('0x35')]?_0x36e0d5['attributes']:_0x1cc212[_0x53a2('0x2f')];if(_0x4c5f12[_0x53a2('0x30')][_0x53a2('0x3e')]){_0x36e0d5[_0x53a2('0x42')]=[{'all':!![]}];}_0x36e0d5=_[_0x53a2('0x3d')]({},_0x36e0d5,_0x4c5f12[_0x53a2('0x43')]);return db[_0x53a2('0x2b')][_0x53a2('0x44')](_0x36e0d5)[_0x53a2('0x23')](handleEntityNotFound(_0xff2c86,null))[_0x53a2('0x23')](respondWithResult(_0xff2c86,null))[_0x53a2('0x45')](handleError(_0xff2c86,null));};exports[_0x53a2('0x46')]=function(_0x49e7b6,_0x5745ff){return db[_0x53a2('0x2b')]['create'](_0x49e7b6[_0x53a2('0x47')],{})['then'](respondWithResult(_0x5745ff,0xc9))[_0x53a2('0x45')](handleError(_0x5745ff,null));};exports[_0x53a2('0x48')]=function(_0xba43f1,_0x1bcd5c){if(_0xba43f1['body']['id']){delete _0xba43f1[_0x53a2('0x47')]['id'];}return db[_0x53a2('0x2b')][_0x53a2('0x44')]({'where':{'id':_0xba43f1[_0x53a2('0x40')]['id']}})[_0x53a2('0x23')](handleEntityNotFound(_0x1bcd5c,null))[_0x53a2('0x23')](saveUpdates(_0xba43f1[_0x53a2('0x47')],null))[_0x53a2('0x23')](respondWithResult(_0x1bcd5c,null))[_0x53a2('0x45')](handleError(_0x1bcd5c,null));};exports[_0x53a2('0x24')]=function(_0x3d4639,_0x1461af){return db['VoiceQueueReport'][_0x53a2('0x44')]({'where':{'id':_0x3d4639['params']['id']}})[_0x53a2('0x23')](handleEntityNotFound(_0x1461af,null))['then'](removeEntity(_0x1461af,null))[_0x53a2('0x45')](handleError(_0x1461af,null));};exports[_0x53a2('0x49')]=function(_0x192a49,_0x299a84){return db['VoiceQueueReport'][_0x53a2('0x49')]()['then'](respondWithResult(_0x299a84,null))['catch'](handleError(_0x299a84,null));};exports[_0x53a2('0x4a')]=function(_0x4282a5,_0x203048){var _0x4abc0b={},_0x24d7e6={},_0x6c03a5={'count':0x0,'rows':[]};_0x24d7e6[_0x53a2('0x2f')]=_['keys'](db['VoiceQueueReport'][_0x53a2('0x41')]);_0x24d7e6[_0x53a2('0x30')]=_[_0x53a2('0x4b')](_0x4282a5['query']);_0x24d7e6[_0x53a2('0x31')]=_[_0x53a2('0x32')](_0x24d7e6[_0x53a2('0x2f')],_0x24d7e6[_0x53a2('0x30')]);_0x4abc0b['attributes']=_[_0x53a2('0x32')](_0x24d7e6[_0x53a2('0x2f')],qs[_0x53a2('0x34')](_0x4282a5['query'][_0x53a2('0x34')]));_0x4abc0b['attributes']=_0x4abc0b['attributes'][_0x53a2('0x35')]?_0x4abc0b[_0x53a2('0x33')]:_0x24d7e6[_0x53a2('0x2f')];if(!_0x4282a5[_0x53a2('0x30')][_0x53a2('0x36')](_0x53a2('0x37'))){_0x4abc0b[_0x53a2('0x1d')]=qs['limit'](_0x4282a5[_0x53a2('0x30')][_0x53a2('0x1d')]);_0x4abc0b[_0x53a2('0x1c')]=qs['offset'](_0x4282a5['query'][_0x53a2('0x1c')]);}_0x4abc0b['order']=qs[_0x53a2('0x39')](_0x4282a5[_0x53a2('0x30')][_0x53a2('0x39')]);_0x4abc0b['where']=qs['filters'](_[_0x53a2('0x3b')](_0x4282a5[_0x53a2('0x30')],_0x24d7e6['filters']));if(_0x4282a5[_0x53a2('0x30')][_0x53a2('0x3c')]){_0x4abc0b['where']=_[_0x53a2('0x3d')](_0x4abc0b['where'],{'$or':_[_0x53a2('0x2a')](_0x4abc0b[_0x53a2('0x33')],function(_0x30df21){var _0x2c7f45={};_0x2c7f45[_0x30df21]={'$like':'%'+_0x4282a5['query'][_0x53a2('0x3c')]+'%'};return _0x2c7f45;})});}_0x4abc0b=_[_0x53a2('0x3d')]({},_0x4abc0b,_0x4282a5[_0x53a2('0x43')]);var _0x5449b2={'where':_0x4abc0b[_0x53a2('0x3a')]};return db[_0x53a2('0x2b')]['count'](_0x5449b2)['then'](function(_0x31c8f4){_0x6c03a5['count']=_0x31c8f4;if(_0x4282a5[_0x53a2('0x30')][_0x53a2('0x3e')]){_0x4abc0b[_0x53a2('0x42')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x53a2('0x4c')](_0x4abc0b);})[_0x53a2('0x23')](function(_0x464e2d){_0x6c03a5[_0x53a2('0x4d')]=_0x464e2d;return _0x6c03a5;})[_0x53a2('0x23')](respondWithFilteredResult(_0x203048,_0x4abc0b,_0x53a2('0x4a')))[_0x53a2('0x45')](handleError(_0x203048,null,_0x53a2('0x4a')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 4ccd64e..14f6e9e 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 _0x60ce=['VoiceQueueReport','setMaxListeners','update','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x32a392,_0x116ac6){var _0x2da3a0=function(_0x4f4b39){while(--_0x4f4b39){_0x32a392['push'](_0x32a392['shift']());}};_0x2da3a0(++_0x116ac6);}(_0x60ce,0x8a));var _0xe60c=function(_0x27d86c,_0x1ae7cc){_0x27d86c=_0x27d86c-0x0;var _0x377bb7=_0x60ce[_0x27d86c];return _0x377bb7;};'use strict';var EventEmitter=require(_0xe60c('0x0'));var VoiceQueueReport=require(_0xe60c('0x1'))['db'][_0xe60c('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xe60c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe60c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4c1798){return function(_0x5a9c7b,_0x2fbbd4,_0x3fd600){VoiceQueueReportEvents['emit'](_0x4c1798+':'+_0x5a9c7b['id'],_0x5a9c7b);VoiceQueueReportEvents['emit'](_0x4c1798,_0x5a9c7b);_0x3fd600(null);};}for(var e in events){if(events[_0xe60c('0x5')](e)){var event=events[e];VoiceQueueReport[_0xe60c('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x4a32=['hook','exports','VoiceQueueReport','setMaxListeners','save','update','remove','emit'];(function(_0x49052b,_0x3ba709){var _0x48c045=function(_0x41ac38){while(--_0x41ac38){_0x49052b['push'](_0x49052b['shift']());}};_0x48c045(++_0x3ba709);}(_0x4a32,0x10a));var _0x24a3=function(_0x18655b,_0xbf5752){_0x18655b=_0x18655b-0x0;var _0x56477e=_0x4a32[_0x18655b];return _0x56477e;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0x24a3('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x24a3('0x1')](0x0);var events={'afterCreate':_0x24a3('0x2'),'afterUpdate':_0x24a3('0x3'),'afterDestroy':_0x24a3('0x4')};function emitEvent(_0x477e8e){return function(_0x5d5440,_0x140e4c,_0x568c10){VoiceQueueReportEvents[_0x24a3('0x5')](_0x477e8e+':'+_0x5d5440['id'],_0x5d5440);VoiceQueueReportEvents[_0x24a3('0x5')](_0x477e8e,_0x5d5440);_0x568c10(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x24a3('0x6')](e,emitEvent(event));}}module[_0x24a3('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 9f1fba5..3c1b82c 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 _0x0fa0=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0xfb8cd9,_0x3b7242){var _0x5726a4=function(_0xc2a64){while(--_0xc2a64){_0xfb8cd9['push'](_0xfb8cd9['shift']());}};_0x5726a4(++_0x3b7242);}(_0x0fa0,0x1aa));var _0x00fa=function(_0x216da8,_0x5b611c){_0x216da8=_0x216da8-0x0;var _0x4cf67a=_0x0fa0[_0x216da8];return _0x4cf67a;};'use strict';var _=require(_0x00fa('0x0'));var util=require(_0x00fa('0x1'));var logger=require(_0x00fa('0x2'))(_0x00fa('0x3'));var moment=require('moment');var BPromise=require(_0x00fa('0x4'));var rp=require(_0x00fa('0x5'));var fs=require('fs');var path=require(_0x00fa('0x6'));var rimraf=require(_0x00fa('0x7'));var config=require(_0x00fa('0x8'));var attributes=require(_0x00fa('0x9'));module[_0x00fa('0xa')]=function(_0x360712,_0x15e050){return _0x360712[_0x00fa('0xb')](_0x00fa('0xc'),attributes,{'tableName':_0x00fa('0xd'),'paranoid':![],'indexes':[{'fields':[_0x00fa('0xe')]},{'fields':[_0x00fa('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7cc=['rimraf','../../config/environment','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x1e99d1,_0x38250c){var _0x3ae329=function(_0x2db617){while(--_0x2db617){_0x1e99d1['push'](_0x1e99d1['shift']());}};_0x3ae329(++_0x38250c);}(_0xa7cc,0x1f2));var _0xca7c=function(_0x726624,_0x21f598){_0x726624=_0x726624-0x0;var _0x14fb9f=_0xa7cc[_0x726624];return _0x14fb9f;};'use strict';var _=require('lodash');var util=require(_0xca7c('0x0'));var logger=require(_0xca7c('0x1'))('api');var moment=require(_0xca7c('0x2'));var BPromise=require(_0xca7c('0x3'));var rp=require(_0xca7c('0x4'));var fs=require('fs');var path=require(_0xca7c('0x5'));var rimraf=require(_0xca7c('0x6'));var config=require(_0xca7c('0x7'));var attributes=require('./voiceQueueReport.attributes');module['exports']=function(_0x33f519,_0x2315b4){return _0x33f519['define'](_0xca7c('0x8'),attributes,{'tableName':_0xca7c('0x9'),'paranoid':![],'indexes':[{'fields':[_0xca7c('0xa')]},{'fields':[_0xca7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 533096f..5b8fcda 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 _0xc5c3=['rpc','../../config/environment','redis','localhost','./voiceQueueReport.socket','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x58a418,_0x7f2bfa){var _0x22ddb8=function(_0x37aa77){while(--_0x37aa77){_0x58a418['push'](_0x58a418['shift']());}};_0x22ddb8(++_0x7f2bfa);}(_0xc5c3,0x110));var _0x3c5c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc5c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3c5c('0x0'));var util=require(_0x3c5c('0x1'));var moment=require(_0x3c5c('0x2'));var BPromise=require(_0x3c5c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c5c('0x4'));var db=require(_0x3c5c('0x5'))['db'];var utils=require(_0x3c5c('0x6'));var logger=require(_0x3c5c('0x7'))(_0x3c5c('0x8'));var config=require(_0x3c5c('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x3c5c('0xa')],{'host':_0x3c5c('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3c5c('0xa')]));require(_0x3c5c('0xc'))['register'](socket);function respondWithRpcPromise(_0x139497,_0x41dc16,_0x12e261){return new BPromise(function(_0x109725,_0x4e29f3){return client[_0x3c5c('0xd')](_0x139497,_0x12e261)[_0x3c5c('0xe')](function(_0x5e7ab9){logger[_0x3c5c('0xf')](_0x3c5c('0x10'),_0x41dc16,_0x3c5c('0x11'));logger[_0x3c5c('0x12')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x41dc16,_0x3c5c('0x11'),JSON[_0x3c5c('0x13')](_0x5e7ab9));if(_0x5e7ab9[_0x3c5c('0x14')]){if(_0x5e7ab9[_0x3c5c('0x14')][_0x3c5c('0x15')]===0x1f4){logger[_0x3c5c('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x41dc16,_0x5e7ab9[_0x3c5c('0x14')][_0x3c5c('0x16')]);return _0x4e29f3(_0x5e7ab9['error'][_0x3c5c('0x16')]);}logger[_0x3c5c('0x14')](_0x3c5c('0x10'),_0x41dc16,_0x5e7ab9['error'][_0x3c5c('0x16')]);return _0x109725(_0x5e7ab9['error'][_0x3c5c('0x16')]);}else{logger[_0x3c5c('0xf')](_0x3c5c('0x10'),_0x41dc16,'request\x20sent');_0x109725(_0x5e7ab9[_0x3c5c('0x17')][_0x3c5c('0x16')]);}})['catch'](function(_0x297cb2){logger[_0x3c5c('0x14')](_0x3c5c('0x10'),_0x41dc16,_0x297cb2);_0x4e29f3(_0x297cb2);});});}exports[_0x3c5c('0x18')]=function(_0x282893){var _0x3c50b6=this;return new Promise(function(_0x110e15,_0x5d7941){return db[_0x3c5c('0x19')][_0x3c5c('0x1a')]({'raw':_0x282893['options']?_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x1c')]===undefined?!![]:![]:!![],'where':_0x282893[_0x3c5c('0x1b')]?_0x282893['options'][_0x3c5c('0x1d')]||null:null,'attributes':_0x282893[_0x3c5c('0x1b')]?_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x1e')]||null:null,'limit':_0x282893[_0x3c5c('0x1b')]?_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x1f')]||null:null,'include':_0x282893[_0x3c5c('0x1b')]?_0x282893['options']['include']?_[_0x3c5c('0x20')](_0x282893[_0x3c5c('0x1b')][_0x3c5c('0x21')],function(_0x3252ce){return{'model':db[_0x3252ce[_0x3c5c('0x22')]],'as':_0x3252ce['as'],'attributes':_0x3252ce[_0x3c5c('0x1e')],'include':_0x3252ce[_0x3c5c('0x21')]?_['map'](_0x3252ce[_0x3c5c('0x21')],function(_0x1b9d06){return{'model':db[_0x1b9d06[_0x3c5c('0x22')]],'as':_0x1b9d06['as'],'attributes':_0x1b9d06[_0x3c5c('0x1e')],'include':_0x1b9d06['include']?_['map'](_0x1b9d06[_0x3c5c('0x21')],function(_0xf5cf08){return{'model':db[_0xf5cf08['model']],'as':_0xf5cf08['as'],'attributes':_0xf5cf08['attributes']};}):[]};}):[]};}):[]:[]})[_0x3c5c('0xe')](function(_0x524154){logger[_0x3c5c('0xf')](_0x3c5c('0x18'),_0x282893);logger[_0x3c5c('0x12')](_0x3c5c('0x18'),_0x282893,JSON[_0x3c5c('0x13')](_0x524154));_0x110e15(_0x524154);})[_0x3c5c('0x23')](function(_0x424367){logger[_0x3c5c('0x14')](_0x3c5c('0x18'),_0x424367[_0x3c5c('0x16')],_0x282893);_0x5d7941(_0x3c50b6[_0x3c5c('0x14')](0x1f4,_0x424367[_0x3c5c('0x16')]));});});};exports[_0x3c5c('0x24')]=function(_0x2f0acd){var _0x2a9e15=this;return new Promise(function(_0x5998b2,_0x77903){return db[_0x3c5c('0x19')][_0x3c5c('0x25')](_0x2f0acd[_0x3c5c('0x26')],{'raw':_0x2f0acd['options']?_0x2f0acd[_0x3c5c('0x1b')]['raw']===undefined?!![]:![]:!![]})[_0x3c5c('0xe')](function(_0x2b0ba7){logger['info'](_0x3c5c('0x24'),_0x2f0acd);logger[_0x3c5c('0x12')](_0x3c5c('0x24'),_0x2f0acd,JSON['stringify'](_0x2b0ba7));_0x5998b2(_0x2b0ba7);})[_0x3c5c('0x23')](function(_0x435550){logger[_0x3c5c('0x14')](_0x3c5c('0x24'),_0x435550[_0x3c5c('0x16')],_0x2f0acd);_0x77903(_0x2a9e15[_0x3c5c('0x14')](0x1f4,_0x435550['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x9481de){var _0x2dd95e=this;return new Promise(function(_0x8ba37b,_0x4c414f){return db[_0x3c5c('0x19')]['update'](_0x9481de[_0x3c5c('0x26')],{'raw':_0x9481de[_0x3c5c('0x1b')]?_0x9481de[_0x3c5c('0x1b')][_0x3c5c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9481de[_0x3c5c('0x1b')]?_0x9481de[_0x3c5c('0x1b')][_0x3c5c('0x1d')]||null:null,'attributes':_0x9481de['options']?_0x9481de[_0x3c5c('0x1b')][_0x3c5c('0x1e')]||null:null,'limit':_0x9481de['options']?_0x9481de['options'][_0x3c5c('0x1f')]||null:null})['then'](function(_0x309404){logger[_0x3c5c('0xf')]('UpdateVoiceQueueReport',_0x9481de);logger[_0x3c5c('0x12')](_0x3c5c('0x27'),_0x9481de,JSON['stringify'](_0x309404));_0x8ba37b(_0x309404);})[_0x3c5c('0x23')](function(_0x19a4bb){logger[_0x3c5c('0x14')](_0x3c5c('0x27'),_0x19a4bb[_0x3c5c('0x16')],_0x9481de);_0x4c414f(_0x2dd95e[_0x3c5c('0x14')](0x1f4,_0x19a4bb[_0x3c5c('0x16')]));});});}; \ No newline at end of file +var _0xdb5e=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','VoiceQueueReport','findAll','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','debug','CreateVoiceQueueReport','create','body','raw','stringify','UpdateVoiceQueueReport','update','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceQueueReport.socket'];(function(_0x2a358f,_0x5aa90d){var _0x1341b4=function(_0x3e18f7){while(--_0x3e18f7){_0x2a358f['push'](_0x2a358f['shift']());}};_0x1341b4(++_0x5aa90d);}(_0xdb5e,0x9e));var _0xedb5=function(_0x162434,_0x18cf20){_0x162434=_0x162434-0x0;var _0x8bc76d=_0xdb5e[_0x162434];return _0x8bc76d;};'use strict';var _=require(_0xedb5('0x0'));var util=require(_0xedb5('0x1'));var moment=require(_0xedb5('0x2'));var BPromise=require('bluebird');var rs=require(_0xedb5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedb5('0x4'))['db'];var utils=require(_0xedb5('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xedb5('0x6'));var jayson=require(_0xedb5('0x7'));var client=jayson[_0xedb5('0x8')][_0xedb5('0x9')]({'port':0x232a});config[_0xedb5('0xa')]=_[_0xedb5('0xb')](config[_0xedb5('0xa')],{'host':_0xedb5('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xedb5('0xa')]));require(_0xedb5('0xd'))['register'](socket);function respondWithRpcPromise(_0x18fb94,_0x5a4fac,_0x8291cb){return new BPromise(function(_0x67ba07,_0x222f6d){return client[_0xedb5('0xe')](_0x18fb94,_0x8291cb)[_0xedb5('0xf')](function(_0x4602b5){logger[_0xedb5('0x10')](_0xedb5('0x11'),_0x5a4fac,'request\x20sent');logger['debug'](_0xedb5('0x12'),_0x5a4fac,'request\x20sent',JSON['stringify'](_0x4602b5));if(_0x4602b5[_0xedb5('0x13')]){if(_0x4602b5['error'][_0xedb5('0x14')]===0x1f4){logger[_0xedb5('0x13')](_0xedb5('0x11'),_0x5a4fac,_0x4602b5[_0xedb5('0x13')]['message']);return _0x222f6d(_0x4602b5['error']['message']);}logger['error'](_0xedb5('0x11'),_0x5a4fac,_0x4602b5[_0xedb5('0x13')]['message']);return _0x67ba07(_0x4602b5['error'][_0xedb5('0x15')]);}else{logger[_0xedb5('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a4fac,_0xedb5('0x16'));_0x67ba07(_0x4602b5[_0xedb5('0x17')][_0xedb5('0x15')]);}})[_0xedb5('0x18')](function(_0x10065b){logger[_0xedb5('0x13')]('VoiceQueueReport,\x20%s,\x20%s',_0x5a4fac,_0x10065b);_0x222f6d(_0x10065b);});});}exports['GetVoiceQueueReport']=function(_0x3eca53){var _0x75374c=this;return new Promise(function(_0x34a1e0,_0x547fe8){return db[_0xedb5('0x19')][_0xedb5('0x1a')]({'raw':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53['options']['raw']===undefined?!![]:![]:!![],'where':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1c')]||null:null,'attributes':_0x3eca53['options']?_0x3eca53['options'][_0xedb5('0x1d')]||null:null,'limit':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1e')]||null:null,'include':_0x3eca53[_0xedb5('0x1b')]?_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1f')]?_[_0xedb5('0x20')](_0x3eca53[_0xedb5('0x1b')][_0xedb5('0x1f')],function(_0x274d68){return{'model':db[_0x274d68[_0xedb5('0x21')]],'as':_0x274d68['as'],'attributes':_0x274d68[_0xedb5('0x1d')],'include':_0x274d68[_0xedb5('0x1f')]?_['map'](_0x274d68['include'],function(_0x1f636e){return{'model':db[_0x1f636e[_0xedb5('0x21')]],'as':_0x1f636e['as'],'attributes':_0x1f636e[_0xedb5('0x1d')],'include':_0x1f636e[_0xedb5('0x1f')]?_[_0xedb5('0x20')](_0x1f636e[_0xedb5('0x1f')],function(_0x5aca82){return{'model':db[_0x5aca82[_0xedb5('0x21')]],'as':_0x5aca82['as'],'attributes':_0x5aca82['attributes']};}):[]};}):[]};}):[]:[]})[_0xedb5('0xf')](function(_0x2cb932){logger[_0xedb5('0x10')](_0xedb5('0x22'),_0x3eca53);logger[_0xedb5('0x23')](_0xedb5('0x22'),_0x3eca53,JSON['stringify'](_0x2cb932));_0x34a1e0(_0x2cb932);})[_0xedb5('0x18')](function(_0x348d19){logger['error']('GetVoiceQueueReport',_0x348d19[_0xedb5('0x15')],_0x3eca53);_0x547fe8(_0x75374c[_0xedb5('0x13')](0x1f4,_0x348d19[_0xedb5('0x15')]));});});};exports[_0xedb5('0x24')]=function(_0x4ff3a2){var _0x19b00f=this;return new Promise(function(_0x2a5b8e,_0x2c4109){return db[_0xedb5('0x19')][_0xedb5('0x25')](_0x4ff3a2[_0xedb5('0x26')],{'raw':_0x4ff3a2[_0xedb5('0x1b')]?_0x4ff3a2[_0xedb5('0x1b')][_0xedb5('0x27')]===undefined?!![]:![]:!![]})[_0xedb5('0xf')](function(_0x26c994){logger[_0xedb5('0x10')](_0xedb5('0x24'),_0x4ff3a2);logger[_0xedb5('0x23')](_0xedb5('0x24'),_0x4ff3a2,JSON[_0xedb5('0x28')](_0x26c994));_0x2a5b8e(_0x26c994);})[_0xedb5('0x18')](function(_0x414d04){logger[_0xedb5('0x13')](_0xedb5('0x24'),_0x414d04[_0xedb5('0x15')],_0x4ff3a2);_0x2c4109(_0x19b00f[_0xedb5('0x13')](0x1f4,_0x414d04[_0xedb5('0x15')]));});});};exports[_0xedb5('0x29')]=function(_0x3f5bf9){var _0x141727=this;return new Promise(function(_0x1ee4cc,_0x58e7de){return db[_0xedb5('0x19')][_0xedb5('0x2a')](_0x3f5bf9[_0xedb5('0x26')],{'raw':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')][_0xedb5('0x27')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')]['where']||null:null,'attributes':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')][_0xedb5('0x1d')]||null:null,'limit':_0x3f5bf9[_0xedb5('0x1b')]?_0x3f5bf9[_0xedb5('0x1b')][_0xedb5('0x1e')]||null:null})[_0xedb5('0xf')](function(_0x5915a8){logger[_0xedb5('0x10')](_0xedb5('0x29'),_0x3f5bf9);logger['debug'](_0xedb5('0x29'),_0x3f5bf9,JSON[_0xedb5('0x28')](_0x5915a8));_0x1ee4cc(_0x5915a8);})['catch'](function(_0x530052){logger['error'](_0xedb5('0x29'),_0x530052[_0xedb5('0x15')],_0x3f5bf9);_0x58e7de(_0x141727['error'](0x1f4,_0x530052[_0xedb5('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 1239dc7..7e0be95 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 _0xe4b8=['save','remove','update','removeListener','register','length','./voiceQueueReport.events'];(function(_0x1e7bbc,_0x260210){var _0x257580=function(_0x33c077){while(--_0x33c077){_0x1e7bbc['push'](_0x1e7bbc['shift']());}};_0x257580(++_0x260210);}(_0xe4b8,0x179));var _0x8e4b=function(_0x1203f,_0x554bbc){_0x1203f=_0x1203f-0x0;var _0x365f0a=_0xe4b8[_0x1203f];return _0x365f0a;};'use strict';var VoiceQueueReportEvents=require(_0x8e4b('0x0'));var events=[_0x8e4b('0x1'),_0x8e4b('0x2'),_0x8e4b('0x3')];function createListener(_0x42c835,_0x365269){return function(_0x1161a8){_0x365269['emit'](_0x42c835,_0x1161a8);};}function removeListener(_0x4fa340,_0x35e679){return function(){VoiceQueueReportEvents[_0x8e4b('0x4')](_0x4fa340,_0x35e679);};}exports[_0x8e4b('0x5')]=function(_0x47e630){for(var _0x2796f8=0x0,_0x4d0472=events[_0x8e4b('0x6')];_0x2796f8<_0x4d0472;_0x2796f8++){var _0x5642a3=events[_0x2796f8];var _0x4e0535=createListener('voiceQueueReport:'+_0x5642a3,_0x47e630);VoiceQueueReportEvents['on'](_0x5642a3,_0x4e0535);}}; \ No newline at end of file +var _0x872a=['removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove','update','emit'];(function(_0x1643e3,_0x31d511){var _0x32a2bf=function(_0x2b34da){while(--_0x2b34da){_0x1643e3['push'](_0x1643e3['shift']());}};_0x32a2bf(++_0x31d511);}(_0x872a,0x100));var _0xa872=function(_0x1bfc1f,_0x4d31d8){_0x1bfc1f=_0x1bfc1f-0x0;var _0x387328=_0x872a[_0x1bfc1f];return _0x387328;};'use strict';var VoiceQueueReportEvents=require(_0xa872('0x0'));var events=[_0xa872('0x1'),_0xa872('0x2'),_0xa872('0x3')];function createListener(_0x4a2170,_0x48294d){return function(_0x4c6509){_0x48294d[_0xa872('0x4')](_0x4a2170,_0x4c6509);};}function removeListener(_0x58715a,_0x2854a7){return function(){VoiceQueueReportEvents[_0xa872('0x5')](_0x58715a,_0x2854a7);};}exports[_0xa872('0x6')]=function(_0x1c8d2f){for(var _0x3e3cd4=0x0,_0x4aab9d=events[_0xa872('0x7')];_0x3e3cd4<_0x4aab9d;_0x3e3cd4++){var _0x1b87b7=events[_0x3e3cd4];var _0x1e0c05=createListener(_0xa872('0x8')+_0x1b87b7,_0x1c8d2f);VoiceQueueReportEvents['on'](_0x1b87b7,_0x1e0c05);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 5641fd0..28d8f19 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 _0x7323=['get','isAuthenticated','index','/:id','show','post','put','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','./voiceQueuesLog.controller'];(function(_0x4c8a67,_0x465097){var _0x433cb5=function(_0x11154c){while(--_0x11154c){_0x4c8a67['push'](_0x4c8a67['shift']());}};_0x433cb5(++_0x465097);}(_0x7323,0x171));var _0x3732=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x7323[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x3732('0x0'));var util=require(_0x3732('0x1'));var path=require('path');var timeout=require(_0x3732('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3732('0x3'));var auth=require(_0x3732('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3732('0x5'));router[_0x3732('0x6')]('/',auth[_0x3732('0x7')](),controller[_0x3732('0x8')]);router[_0x3732('0x6')](_0x3732('0x9'),auth[_0x3732('0x7')](),controller[_0x3732('0xa')]);router[_0x3732('0xb')]('/',auth[_0x3732('0x7')](),controller['create']);router[_0x3732('0xc')](_0x3732('0x9'),auth[_0x3732('0x7')](),controller['update']);router['delete'](_0x3732('0x9'),auth['isAuthenticated'](),controller[_0x3732('0xd')]);module[_0x3732('0xe')]=router; \ No newline at end of file +var _0x1a1c=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','index','get','/:id','show','post','isAuthenticated','put','update','delete'];(function(_0x110ea8,_0x5b76b0){var _0x10c4af=function(_0x2a5c76){while(--_0x2a5c76){_0x110ea8['push'](_0x110ea8['shift']());}};_0x10c4af(++_0x5b76b0);}(_0x1a1c,0xfe));var _0xc1a1=function(_0x9482d9,_0x5b2e18){_0x9482d9=_0x9482d9-0x0;var _0xeb58d9=_0x1a1c[_0x9482d9];return _0xeb58d9;};'use strict';var multer=require(_0xc1a1('0x0'));var util=require(_0xc1a1('0x1'));var path=require(_0xc1a1('0x2'));var timeout=require(_0xc1a1('0x3'));var express=require('express');var router=express[_0xc1a1('0x4')]();var fs_extra=require(_0xc1a1('0x5'));var auth=require(_0xc1a1('0x6'));var interaction=require(_0xc1a1('0x7'));var config=require(_0xc1a1('0x8'));var controller=require(_0xc1a1('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0xc1a1('0xa')]);router[_0xc1a1('0xb')](_0xc1a1('0xc'),auth['isAuthenticated'](),controller[_0xc1a1('0xd')]);router[_0xc1a1('0xe')]('/',auth[_0xc1a1('0xf')](),controller['create']);router[_0xc1a1('0x10')](_0xc1a1('0xc'),auth['isAuthenticated'](),controller[_0xc1a1('0x11')]);router[_0xc1a1('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xc1a1('0x13')]);module[_0xc1a1('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 341a4e8..199e45f 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 _0xf2bc=['literal','moment','exports','STRING','DATE'];(function(_0x338442,_0x1974d1){var _0x11179b=function(_0x5bd177){while(--_0x5bd177){_0x338442['push'](_0x338442['shift']());}};_0x11179b(++_0x1974d1);}(_0xf2bc,0x7e));var _0xcf2b=function(_0x3afc4a,_0x5c6476){_0x3afc4a=_0x3afc4a-0x0;var _0x4de50f=_0xf2bc[_0x3afc4a];return _0x4de50f;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xcf2b('0x0'));module[_0xcf2b('0x1')]={'time':{'type':Sequelize[_0xcf2b('0x2')]},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xcf2b('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xcf2b('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xcf2b('0x4')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x390f=['exports','STRING','DATE','literal','sequelize','moment'];(function(_0x8b953b,_0x132acf){var _0x1943d5=function(_0xc250b9){while(--_0xc250b9){_0x8b953b['push'](_0x8b953b['shift']());}};_0x1943d5(++_0x132acf);}(_0x390f,0x148));var _0xf390=function(_0x3c51af,_0x1991ce){_0x3c51af=_0x3c51af-0x0;var _0xeb10d9=_0x390f[_0x3c51af];return _0xeb10d9;};'use strict';var Sequelize=require(_0xf390('0x0'));var moment=require(_0xf390('0x1'));module[_0xf390('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xf390('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xf390('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xf390('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index dd15553..09c14f7 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 _0xe7d0=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','map','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','VoiceQueuesLog','findAll','rows','catch','show','keys','rawAttributes','includeAll','create','body','find','params','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x26ffb1,_0x1adfdc){var _0x24ac6b=function(_0xe1bba){while(--_0xe1bba){_0x26ffb1['push'](_0x26ffb1['shift']());}};_0x24ac6b(++_0x1adfdc);}(_0xe7d0,0x118));var _0x0e7d=function(_0x31f6c9,_0x589c9f){_0x31f6c9=_0x31f6c9-0x0;var _0x354fee=_0xe7d0[_0x31f6c9];return _0x354fee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0e7d('0x0'));var zipdir=require(_0x0e7d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0e7d('0x2'));var moment=require(_0x0e7d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x0e7d('0x4'));var sox=require(_0x0e7d('0x5'));var csv=require(_0x0e7d('0x6'));var ejs=require(_0x0e7d('0x7'));var fs=require('fs');var fs_extra=require(_0x0e7d('0x8'));var _=require('lodash');var squel=require(_0x0e7d('0x9'));var crypto=require(_0x0e7d('0xa'));var jsforce=require(_0x0e7d('0xb'));var deskjs=require(_0x0e7d('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0e7d('0xd'));var Papa=require(_0x0e7d('0xe'));var Redis=require(_0x0e7d('0xf'));var authService=require(_0x0e7d('0x10'));var qs=require(_0x0e7d('0x11'));var as=require(_0x0e7d('0x12'));var hardwareService=require(_0x0e7d('0x13'));var logger=require(_0x0e7d('0x14'))('api');var utils=require(_0x0e7d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0e7d('0x16'));var db=require(_0x0e7d('0x17'))['db'];function respondWithStatusCode(_0x4f4625,_0x395804){_0x395804=_0x395804||0xcc;return function(_0x6b5227){if(_0x6b5227){return _0x4f4625[_0x0e7d('0x18')](_0x395804);}return _0x4f4625['status'](_0x395804)[_0x0e7d('0x19')]();};}function respondWithResult(_0x8db8d5,_0x38319d){_0x38319d=_0x38319d||0xc8;return function(_0x53f7f7){if(_0x53f7f7){return _0x8db8d5[_0x0e7d('0x1a')](_0x38319d)[_0x0e7d('0x1b')](_0x53f7f7);}};}function respondWithFilteredResult(_0x2132f4,_0xbd0bce){return function(_0x3fe081){if(_0x3fe081){var _0x55551a=typeof _0xbd0bce[_0x0e7d('0x1c')]==='undefined'&&typeof _0xbd0bce[_0x0e7d('0x1d')]==='undefined';var _0x5e7a97=_0x3fe081[_0x0e7d('0x1e')];var _0xd9a2aa=_0x55551a?0x0:_0xbd0bce['offset'];var _0x498860=_0x55551a?_0x3fe081['count']:_0xbd0bce[_0x0e7d('0x1c')]+_0xbd0bce[_0x0e7d('0x1d')];var _0x561072;if(_0x498860>=_0x5e7a97){_0x498860=_0x5e7a97;_0x561072=0xc8;}else{_0x561072=0xce;}_0x2132f4[_0x0e7d('0x1a')](_0x561072);return _0x2132f4[_0x0e7d('0x1f')](_0x0e7d('0x20'),_0xd9a2aa+'-'+_0x498860+'/'+_0x5e7a97)[_0x0e7d('0x1b')](_0x3fe081);}return null;};}function patchUpdates(_0xa4a600){return function(_0x40e017){try{jsonpatch[_0x0e7d('0x21')](_0x40e017,_0xa4a600,!![]);}catch(_0x58a6a5){return BPromise[_0x0e7d('0x22')](_0x58a6a5);}return _0x40e017['save']();};}function saveUpdates(_0x168c31,_0x2692a2){return function(_0x5412ef){if(_0x5412ef){return _0x5412ef[_0x0e7d('0x23')](_0x168c31)[_0x0e7d('0x24')](function(_0x1a5736){return _0x1a5736;});}return null;};}function removeEntity(_0x585931,_0x3592ba){return function(_0x4a242f){if(_0x4a242f){return _0x4a242f[_0x0e7d('0x25')]()[_0x0e7d('0x24')](function(){_0x585931['status'](0xcc)[_0x0e7d('0x19')]();});}};}function handleEntityNotFound(_0x66c50,_0x1f8ea7){return function(_0x40ed2c){if(!_0x40ed2c){_0x66c50[_0x0e7d('0x18')](0x194);}return _0x40ed2c;};}function handleError(_0x13ff5b,_0x3e005a){_0x3e005a=_0x3e005a||0x1f4;return function(_0x21fede){logger[_0x0e7d('0x26')](_0x21fede['stack']);if(_0x21fede['name']){delete _0x21fede[_0x0e7d('0x27')];}_0x13ff5b[_0x0e7d('0x1a')](_0x3e005a)[_0x0e7d('0x28')](_0x21fede);};}exports[_0x0e7d('0x29')]=function(_0xc95aa,_0x4e730f){var _0x423eef={},_0x418c92={},_0x1d53d1={'count':0x0,'rows':[]};var _0x275198=_[_0x0e7d('0x2a')](db['VoiceQueuesLog']['rawAttributes'],function(_0x5652c4){return{'name':_0x5652c4['fieldName'],'type':_0x5652c4[_0x0e7d('0x2b')][_0x0e7d('0x2c')]};});_0x418c92[_0x0e7d('0x2d')]=_[_0x0e7d('0x2a')](_0x275198,_0x0e7d('0x27'));_0x418c92[_0x0e7d('0x2e')]=_['keys'](_0xc95aa[_0x0e7d('0x2e')]);_0x418c92[_0x0e7d('0x2f')]=_['intersection'](_0x418c92[_0x0e7d('0x2d')],_0x418c92[_0x0e7d('0x2e')]);_0x423eef[_0x0e7d('0x30')]=_[_0x0e7d('0x31')](_0x418c92['model'],qs[_0x0e7d('0x32')](_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x32')]));_0x423eef['attributes']=_0x423eef['attributes'][_0x0e7d('0x33')]?_0x423eef[_0x0e7d('0x30')]:_0x418c92[_0x0e7d('0x2d')];if(!_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x34')](_0x0e7d('0x35'))){_0x423eef[_0x0e7d('0x1d')]=qs[_0x0e7d('0x1d')](_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x1d')]);_0x423eef['offset']=qs[_0x0e7d('0x1c')](_0xc95aa['query'][_0x0e7d('0x1c')]);}_0x423eef[_0x0e7d('0x36')]=qs[_0x0e7d('0x37')](_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x37')]);_0x423eef[_0x0e7d('0x38')]=qs[_0x0e7d('0x2f')](_['pick'](_0xc95aa[_0x0e7d('0x2e')],_0x418c92[_0x0e7d('0x2f')]),_0x275198);if(_0xc95aa[_0x0e7d('0x2e')][_0x0e7d('0x39')]){_0x423eef['where']=_[_0x0e7d('0x3a')](_0x423eef[_0x0e7d('0x38')],{'$or':_[_0x0e7d('0x2a')](_0x275198,function(_0xba104a){if(_0xba104a[_0x0e7d('0x2b')]!==_0x0e7d('0x3b')){var _0x3590b6={};_0x3590b6[_0xba104a['name']]={'$like':'%'+_0xc95aa['query']['filter']+'%'};return _0x3590b6;}})});}_0x423eef=_[_0x0e7d('0x3a')]({},_0x423eef,_0xc95aa[_0x0e7d('0x3c')]);var _0x235d85={'where':_0x423eef['where']};return db['VoiceQueuesLog'][_0x0e7d('0x1e')](_0x235d85)['then'](function(_0x5b4eec){_0x1d53d1[_0x0e7d('0x1e')]=_0x5b4eec;if(_0xc95aa[_0x0e7d('0x2e')]['includeAll']){_0x423eef[_0x0e7d('0x3d')]=[{'all':!![]}];}return db[_0x0e7d('0x3e')][_0x0e7d('0x3f')](_0x423eef);})[_0x0e7d('0x24')](function(_0x44ad81){_0x1d53d1[_0x0e7d('0x40')]=_0x44ad81;return _0x1d53d1;})[_0x0e7d('0x24')](respondWithFilteredResult(_0x4e730f,_0x423eef))[_0x0e7d('0x41')](handleError(_0x4e730f,null));};exports[_0x0e7d('0x42')]=function(_0x55e099,_0x1634ce){var _0x2e6ad8={'raw':!![],'where':{'id':_0x55e099['params']['id']}},_0x57024f={};_0x57024f['model']=_[_0x0e7d('0x43')](db[_0x0e7d('0x3e')][_0x0e7d('0x44')]);_0x57024f[_0x0e7d('0x2e')]=_[_0x0e7d('0x43')](_0x55e099[_0x0e7d('0x2e')]);_0x57024f[_0x0e7d('0x2f')]=_[_0x0e7d('0x31')](_0x57024f[_0x0e7d('0x2d')],_0x57024f[_0x0e7d('0x2e')]);_0x2e6ad8['attributes']=_[_0x0e7d('0x31')](_0x57024f[_0x0e7d('0x2d')],qs[_0x0e7d('0x32')](_0x55e099[_0x0e7d('0x2e')]['fields']));_0x2e6ad8[_0x0e7d('0x30')]=_0x2e6ad8[_0x0e7d('0x30')][_0x0e7d('0x33')]?_0x2e6ad8[_0x0e7d('0x30')]:_0x57024f[_0x0e7d('0x2d')];if(_0x55e099[_0x0e7d('0x2e')][_0x0e7d('0x45')]){_0x2e6ad8[_0x0e7d('0x3d')]=[{'all':!![]}];}_0x2e6ad8=_['merge']({},_0x2e6ad8,_0x55e099[_0x0e7d('0x3c')]);return db[_0x0e7d('0x3e')]['find'](_0x2e6ad8)['then'](handleEntityNotFound(_0x1634ce,null))[_0x0e7d('0x24')](respondWithResult(_0x1634ce,null))['catch'](handleError(_0x1634ce,null));};exports['create']=function(_0x5a2137,_0xae683a){return db[_0x0e7d('0x3e')][_0x0e7d('0x46')](_0x5a2137['body'],{})[_0x0e7d('0x24')](respondWithResult(_0xae683a,0xc9))[_0x0e7d('0x41')](handleError(_0xae683a,null));};exports['update']=function(_0x348819,_0x701e15){if(_0x348819['body']['id']){delete _0x348819[_0x0e7d('0x47')]['id'];}return db[_0x0e7d('0x3e')][_0x0e7d('0x48')]({'where':{'id':_0x348819[_0x0e7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x701e15,null))[_0x0e7d('0x24')](saveUpdates(_0x348819[_0x0e7d('0x47')],null))[_0x0e7d('0x24')](respondWithResult(_0x701e15,null))[_0x0e7d('0x41')](handleError(_0x701e15,null));};exports[_0x0e7d('0x25')]=function(_0x150fef,_0x4321b3){return db[_0x0e7d('0x3e')][_0x0e7d('0x48')]({'where':{'id':_0x150fef[_0x0e7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x4321b3,null))['then'](removeEntity(_0x4321b3,null))[_0x0e7d('0x41')](handleError(_0x4321b3,null));}; \ No newline at end of file +var _0x754d=['bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','sendStatus','error','stack','name','send','map','VoiceQueuesLog','fieldName','type','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','rows','catch','show','rawAttributes','include','find','create','body','params','destroy','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x754d,0x110));var _0xd754=function(_0x4cb317,_0x32efc7){_0x4cb317=_0x4cb317-0x0;var _0x106329=_0x754d[_0x4cb317];return _0x106329;};'use strict';var emlformat=require(_0xd754('0x0'));var rimraf=require(_0xd754('0x1'));var zipdir=require(_0xd754('0x2'));var jsonpatch=require(_0xd754('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd754('0x4'));var Mustache=require(_0xd754('0x5'));var util=require(_0xd754('0x6'));var path=require('path');var sox=require(_0xd754('0x7'));var csv=require('to-csv');var ejs=require(_0xd754('0x8'));var fs=require('fs');var fs_extra=require(_0xd754('0x9'));var _=require(_0xd754('0xa'));var squel=require(_0xd754('0xb'));var crypto=require(_0xd754('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd754('0xd'));var Papa=require('papaparse');var Redis=require(_0xd754('0xe'));var authService=require(_0xd754('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xd754('0x10'));var licenseUtil=require(_0xd754('0x11'));var db=require(_0xd754('0x12'))['db'];function respondWithStatusCode(_0x234aa0,_0x4d31cb){_0x4d31cb=_0x4d31cb||0xcc;return function(_0x1627ae){if(_0x1627ae){return _0x234aa0['sendStatus'](_0x4d31cb);}return _0x234aa0[_0xd754('0x13')](_0x4d31cb)[_0xd754('0x14')]();};}function respondWithResult(_0x19b1b5,_0x267cb7){_0x267cb7=_0x267cb7||0xc8;return function(_0x583741){if(_0x583741){return _0x19b1b5[_0xd754('0x13')](_0x267cb7)[_0xd754('0x15')](_0x583741);}};}function respondWithFilteredResult(_0x1abde5,_0xc65eac){return function(_0x4a78d9){if(_0x4a78d9){var _0x5cd743=typeof _0xc65eac[_0xd754('0x16')]===_0xd754('0x17')&&typeof _0xc65eac[_0xd754('0x18')]===_0xd754('0x17');var _0x488ed4=_0x4a78d9[_0xd754('0x19')];var _0x3e87ee=_0x5cd743?0x0:_0xc65eac[_0xd754('0x16')];var _0x20d6a0=_0x5cd743?_0x4a78d9[_0xd754('0x19')]:_0xc65eac[_0xd754('0x16')]+_0xc65eac[_0xd754('0x18')];var _0x4ac283;if(_0x20d6a0>=_0x488ed4){_0x20d6a0=_0x488ed4;_0x4ac283=0xc8;}else{_0x4ac283=0xce;}_0x1abde5[_0xd754('0x13')](_0x4ac283);return _0x1abde5[_0xd754('0x1a')](_0xd754('0x1b'),_0x3e87ee+'-'+_0x20d6a0+'/'+_0x488ed4)[_0xd754('0x15')](_0x4a78d9);}return null;};}function patchUpdates(_0x56ce7a){return function(_0x513766){try{jsonpatch['apply'](_0x513766,_0x56ce7a,!![]);}catch(_0x11409a){return BPromise[_0xd754('0x1c')](_0x11409a);}return _0x513766[_0xd754('0x1d')]();};}function saveUpdates(_0x88669b,_0x1e7cf1){return function(_0x594699){if(_0x594699){return _0x594699[_0xd754('0x1e')](_0x88669b)[_0xd754('0x1f')](function(_0x290b37){return _0x290b37;});}return null;};}function removeEntity(_0xa886cb,_0x19b8a6){return function(_0x524aeb){if(_0x524aeb){return _0x524aeb['destroy']()[_0xd754('0x1f')](function(){_0xa886cb[_0xd754('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3611aa,_0x5e6426){return function(_0x29cdfb){if(!_0x29cdfb){_0x3611aa[_0xd754('0x20')](0x194);}return _0x29cdfb;};}function handleError(_0x5015af,_0x2892dd){_0x2892dd=_0x2892dd||0x1f4;return function(_0x1b1dab){logger[_0xd754('0x21')](_0x1b1dab[_0xd754('0x22')]);if(_0x1b1dab[_0xd754('0x23')]){delete _0x1b1dab[_0xd754('0x23')];}_0x5015af[_0xd754('0x13')](_0x2892dd)[_0xd754('0x24')](_0x1b1dab);};}exports['index']=function(_0x28fda4,_0x563fdf){var _0x3df989={},_0x3a15a0={},_0x27a8c2={'count':0x0,'rows':[]};var _0x41c28b=_[_0xd754('0x25')](db[_0xd754('0x26')]['rawAttributes'],function(_0xb66b3c){return{'name':_0xb66b3c[_0xd754('0x27')],'type':_0xb66b3c[_0xd754('0x28')]['key']};});_0x3a15a0[_0xd754('0x29')]=_[_0xd754('0x25')](_0x41c28b,_0xd754('0x23'));_0x3a15a0[_0xd754('0x2a')]=_[_0xd754('0x2b')](_0x28fda4[_0xd754('0x2a')]);_0x3a15a0['filters']=_['intersection'](_0x3a15a0['model'],_0x3a15a0[_0xd754('0x2a')]);_0x3df989[_0xd754('0x2c')]=_[_0xd754('0x2d')](_0x3a15a0[_0xd754('0x29')],qs[_0xd754('0x2e')](_0x28fda4['query'][_0xd754('0x2e')]));_0x3df989[_0xd754('0x2c')]=_0x3df989['attributes'][_0xd754('0x2f')]?_0x3df989[_0xd754('0x2c')]:_0x3a15a0['model'];if(!_0x28fda4[_0xd754('0x2a')][_0xd754('0x30')](_0xd754('0x31'))){_0x3df989[_0xd754('0x18')]=qs[_0xd754('0x18')](_0x28fda4[_0xd754('0x2a')][_0xd754('0x18')]);_0x3df989[_0xd754('0x16')]=qs[_0xd754('0x16')](_0x28fda4[_0xd754('0x2a')][_0xd754('0x16')]);}_0x3df989[_0xd754('0x32')]=qs['sort'](_0x28fda4['query'][_0xd754('0x33')]);_0x3df989[_0xd754('0x34')]=qs[_0xd754('0x35')](_['pick'](_0x28fda4[_0xd754('0x2a')],_0x3a15a0[_0xd754('0x35')]),_0x41c28b);if(_0x28fda4[_0xd754('0x2a')]['filter']){_0x3df989[_0xd754('0x34')]=_[_0xd754('0x36')](_0x3df989['where'],{'$or':_[_0xd754('0x25')](_0x41c28b,function(_0x358828){if(_0x358828[_0xd754('0x28')]!==_0xd754('0x37')){var _0xa26766={};_0xa26766[_0x358828['name']]={'$like':'%'+_0x28fda4['query'][_0xd754('0x38')]+'%'};return _0xa26766;}})});}_0x3df989=_['merge']({},_0x3df989,_0x28fda4[_0xd754('0x39')]);var _0x8f9971={'where':_0x3df989[_0xd754('0x34')]};return db[_0xd754('0x26')][_0xd754('0x19')](_0x8f9971)[_0xd754('0x1f')](function(_0xef2eac){_0x27a8c2[_0xd754('0x19')]=_0xef2eac;if(_0x28fda4[_0xd754('0x2a')][_0xd754('0x3a')]){_0x3df989['include']=[{'all':!![]}];}return db[_0xd754('0x26')]['findAll'](_0x3df989);})[_0xd754('0x1f')](function(_0x551768){_0x27a8c2[_0xd754('0x3b')]=_0x551768;return _0x27a8c2;})[_0xd754('0x1f')](respondWithFilteredResult(_0x563fdf,_0x3df989))[_0xd754('0x3c')](handleError(_0x563fdf,null));};exports[_0xd754('0x3d')]=function(_0x42fb9b,_0x2288bf){var _0x2b6010={'raw':!![],'where':{'id':_0x42fb9b['params']['id']}},_0x59e2f0={};_0x59e2f0['model']=_['keys'](db[_0xd754('0x26')][_0xd754('0x3e')]);_0x59e2f0[_0xd754('0x2a')]=_[_0xd754('0x2b')](_0x42fb9b['query']);_0x59e2f0['filters']=_['intersection'](_0x59e2f0[_0xd754('0x29')],_0x59e2f0[_0xd754('0x2a')]);_0x2b6010['attributes']=_[_0xd754('0x2d')](_0x59e2f0[_0xd754('0x29')],qs[_0xd754('0x2e')](_0x42fb9b[_0xd754('0x2a')][_0xd754('0x2e')]));_0x2b6010[_0xd754('0x2c')]=_0x2b6010[_0xd754('0x2c')][_0xd754('0x2f')]?_0x2b6010[_0xd754('0x2c')]:_0x59e2f0['model'];if(_0x42fb9b[_0xd754('0x2a')][_0xd754('0x3a')]){_0x2b6010[_0xd754('0x3f')]=[{'all':!![]}];}_0x2b6010=_[_0xd754('0x36')]({},_0x2b6010,_0x42fb9b[_0xd754('0x39')]);return db[_0xd754('0x26')][_0xd754('0x40')](_0x2b6010)['then'](handleEntityNotFound(_0x2288bf,null))[_0xd754('0x1f')](respondWithResult(_0x2288bf,null))['catch'](handleError(_0x2288bf,null));};exports[_0xd754('0x41')]=function(_0x1d7b9e,_0x2fb6b5){return db[_0xd754('0x26')][_0xd754('0x41')](_0x1d7b9e[_0xd754('0x42')],{})[_0xd754('0x1f')](respondWithResult(_0x2fb6b5,0xc9))[_0xd754('0x3c')](handleError(_0x2fb6b5,null));};exports[_0xd754('0x1e')]=function(_0x5597e6,_0x1dc1cc){if(_0x5597e6[_0xd754('0x42')]['id']){delete _0x5597e6[_0xd754('0x42')]['id'];}return db[_0xd754('0x26')][_0xd754('0x40')]({'where':{'id':_0x5597e6[_0xd754('0x43')]['id']}})[_0xd754('0x1f')](handleEntityNotFound(_0x1dc1cc,null))[_0xd754('0x1f')](saveUpdates(_0x5597e6['body'],null))[_0xd754('0x1f')](respondWithResult(_0x1dc1cc,null))[_0xd754('0x3c')](handleError(_0x1dc1cc,null));};exports[_0xd754('0x44')]=function(_0x2a59f5,_0x34cfc2){return db[_0xd754('0x26')][_0xd754('0x40')]({'where':{'id':_0x2a59f5[_0xd754('0x43')]['id']}})['then'](handleEntityNotFound(_0x34cfc2,null))['then'](removeEntity(_0x34cfc2,null))[_0xd754('0x3c')](handleError(_0x34cfc2,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index a216b9a..04e7620 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 _0xbdd7=['moment','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','../../config/logger'];(function(_0x116c0e,_0xa5cb87){var _0x3fd46a=function(_0x4134cf){while(--_0x4134cf){_0x116c0e['push'](_0x116c0e['shift']());}};_0x3fd46a(++_0xa5cb87);}(_0xbdd7,0xed));var _0x7bdd=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbdd7[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7bdd('0x0'));var util=require(_0x7bdd('0x1'));var logger=require(_0x7bdd('0x2'))('api');var moment=require(_0x7bdd('0x3'));var BPromise=require('bluebird');var rp=require(_0x7bdd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7bdd('0x5'));var config=require(_0x7bdd('0x6'));var attributes=require(_0x7bdd('0x7'));module[_0x7bdd('0x8')]=function(_0x4f3324,_0x37587c){return _0x4f3324[_0x7bdd('0x9')](_0x7bdd('0xa'),attributes,{'tableName':_0x7bdd('0xb'),'paranoid':![],'indexes':[{'name':_0x7bdd('0xc'),'fields':[_0x7bdd('0xd'),_0x7bdd('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x42cf=['dtm','lodash','util','api','moment','request-promise','rimraf','../../config/environment','define','event_dtm','event'];(function(_0x44e284,_0x5153ae){var _0x1cf8ab=function(_0x24a5aa){while(--_0x24a5aa){_0x44e284['push'](_0x44e284['shift']());}};_0x1cf8ab(++_0x5153ae);}(_0x42cf,0x11f));var _0xf42c=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x42cf[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xf42c('0x0'));var util=require(_0xf42c('0x1'));var logger=require('../../config/logger')(_0xf42c('0x2'));var moment=require(_0xf42c('0x3'));var BPromise=require('bluebird');var rp=require(_0xf42c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf42c('0x5'));var config=require(_0xf42c('0x6'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x1cb366,_0x51292c){return _0x1cb366[_0xf42c('0x7')]('VoiceQueuesLog',attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xf42c('0x8'),'fields':[_0xf42c('0x9'),_0xf42c('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 2cb532d..7e95d13 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 _0x44af=['info','request\x20sent','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1b78e5,_0x361288){var _0x216e16=function(_0x560e31){while(--_0x560e31){_0x1b78e5['push'](_0x1b78e5['shift']());}};_0x216e16(++_0x361288);}(_0x44af,0xc5));var _0xf44a=function(_0x331085,_0x46ef3b){_0x331085=_0x331085-0x0;var _0x1547f4=_0x44af[_0x331085];return _0x1547f4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf44a('0x0'));var BPromise=require(_0xf44a('0x1'));var rs=require(_0xf44a('0x2'));var fs=require('fs');var Redis=require(_0xf44a('0x3'));var db=require(_0xf44a('0x4'))['db'];var utils=require(_0xf44a('0x5'));var logger=require('../../config/logger')(_0xf44a('0x6'));var config=require(_0xf44a('0x7'));var jayson=require(_0xf44a('0x8'));var client=jayson[_0xf44a('0x9')][_0xf44a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x38c550,_0x971b34,_0x2bf323){return new BPromise(function(_0x4117bf,_0x5b249f){return client[_0xf44a('0xb')](_0x38c550,_0x2bf323)[_0xf44a('0xc')](function(_0x3bda51){logger[_0xf44a('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x971b34,_0xf44a('0xe'));logger['debug']('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x971b34,_0xf44a('0xe'),JSON['stringify'](_0x3bda51));if(_0x3bda51[_0xf44a('0xf')]){if(_0x3bda51['error'][_0xf44a('0x10')]===0x1f4){logger[_0xf44a('0xf')](_0xf44a('0x11'),_0x971b34,_0x3bda51[_0xf44a('0xf')][_0xf44a('0x12')]);return _0x5b249f(_0x3bda51['error'][_0xf44a('0x12')]);}logger[_0xf44a('0xf')](_0xf44a('0x11'),_0x971b34,_0x3bda51[_0xf44a('0xf')][_0xf44a('0x12')]);return _0x4117bf(_0x3bda51['error'][_0xf44a('0x12')]);}else{logger[_0xf44a('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x971b34,'request\x20sent');_0x4117bf(_0x3bda51[_0xf44a('0x13')][_0xf44a('0x12')]);}})[_0xf44a('0x14')](function(_0x3f265b){logger[_0xf44a('0xf')](_0xf44a('0x11'),_0x971b34,_0x3f265b);_0x5b249f(_0x3f265b);});});} \ No newline at end of file +var _0x30ec=['http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x56f0ca,_0x22cd77){var _0x5e857d=function(_0x329f14){while(--_0x329f14){_0x56f0ca['push'](_0x56f0ca['shift']());}};_0x5e857d(++_0x22cd77);}(_0x30ec,0x11c));var _0xc30e=function(_0x3aeea1,_0x4cfbb9){_0x3aeea1=_0x3aeea1-0x0;var _0x424cc1=_0x30ec[_0x3aeea1];return _0x424cc1;};'use strict';var _=require(_0xc30e('0x0'));var util=require(_0xc30e('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc30e('0x2'));var fs=require('fs');var Redis=require(_0xc30e('0x3'));var db=require(_0xc30e('0x4'))['db'];var utils=require(_0xc30e('0x5'));var logger=require(_0xc30e('0x6'))(_0xc30e('0x7'));var config=require(_0xc30e('0x8'));var jayson=require(_0xc30e('0x9'));var client=jayson['client'][_0xc30e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59bfbc,_0x2c7197,_0x2af6f1){return new BPromise(function(_0x40b63d,_0x5d1166){return client[_0xc30e('0xb')](_0x59bfbc,_0x2af6f1)[_0xc30e('0xc')](function(_0xb676e1){logger[_0xc30e('0xd')](_0xc30e('0xe'),_0x2c7197,'request\x20sent');logger[_0xc30e('0xf')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x2c7197,_0xc30e('0x10'),JSON['stringify'](_0xb676e1));if(_0xb676e1['error']){if(_0xb676e1[_0xc30e('0x11')][_0xc30e('0x12')]===0x1f4){logger['error'](_0xc30e('0xe'),_0x2c7197,_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);return _0x5d1166(_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);}logger['error'](_0xc30e('0xe'),_0x2c7197,_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);return _0x40b63d(_0xb676e1[_0xc30e('0x11')][_0xc30e('0x13')]);}else{logger[_0xc30e('0xd')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2c7197,_0xc30e('0x10'));_0x40b63d(_0xb676e1[_0xc30e('0x14')][_0xc30e('0x13')]);}})['catch'](function(_0x507ce7){logger[_0xc30e('0x11')](_0xc30e('0xe'),_0x2c7197,_0x507ce7);_0x5d1166(_0x507ce7);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 702878d..cb0bfc1 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 _0x5dfc=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','/:id','update','delete','exports','multer','path','connect-timeout','express','Router'];(function(_0x806301,_0x3e3ad4){var _0x1a8bc5=function(_0x33071f){while(--_0x33071f){_0x806301['push'](_0x806301['shift']());}};_0x1a8bc5(++_0x3e3ad4);}(_0x5dfc,0xdc));var _0xc5df=function(_0x36bfe3,_0x358938){_0x36bfe3=_0x36bfe3-0x0;var _0x9b0436=_0x5dfc[_0x36bfe3];return _0x9b0436;};'use strict';var multer=require(_0xc5df('0x0'));var util=require('util');var path=require(_0xc5df('0x1'));var timeout=require(_0xc5df('0x2'));var express=require(_0xc5df('0x3'));var router=express[_0xc5df('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5df('0x5'));var interaction=require(_0xc5df('0x6'));var config=require(_0xc5df('0x7'));var controller=require(_0xc5df('0x8'));router[_0xc5df('0x9')]('/',auth[_0xc5df('0xa')](),controller[_0xc5df('0xb')]);router[_0xc5df('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xc5df('0xc')]);router[_0xc5df('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xc5df('0xd'),auth['isAuthenticated'](),controller[_0xc5df('0xe')]);router['get'](_0xc5df('0xf'),controller[_0xc5df('0x10')]);router[_0xc5df('0x9')](_0xc5df('0x11'),auth[_0xc5df('0xa')](),controller['downloadTranscribe']);router[_0xc5df('0x12')]('/',auth['isAuthenticated'](),controller[_0xc5df('0x13')]);router[_0xc5df('0x12')]('/:id/transcribe',auth[_0xc5df('0xa')](),controller[_0xc5df('0x14')]);router['put'](_0xc5df('0x15'),auth[_0xc5df('0xa')](),controller[_0xc5df('0x16')]);router[_0xc5df('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc5df('0x18')]=router; \ No newline at end of file +var _0x155e=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','index','/describe','isAuthenticated','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','create','runTranscribe','put','/:id','update','delete','util'];(function(_0x27c48a,_0x130c3e){var _0x146018=function(_0x4fb521){while(--_0x4fb521){_0x27c48a['push'](_0x27c48a['shift']());}};_0x146018(++_0x130c3e);}(_0x155e,0x77));var _0xe155=function(_0x37bb51,_0x2ec7a5){_0x37bb51=_0x37bb51-0x0;var _0x2e19f6=_0x155e[_0x37bb51];return _0x2e19f6;};'use strict';var multer=require('multer');var util=require(_0xe155('0x0'));var path=require('path');var timeout=require(_0xe155('0x1'));var express=require(_0xe155('0x2'));var router=express[_0xe155('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe155('0x4'));var interaction=require(_0xe155('0x5'));var config=require(_0xe155('0x6'));var controller=require(_0xe155('0x7'));router[_0xe155('0x8')]('/',auth['isAuthenticated'](),controller[_0xe155('0x9')]);router[_0xe155('0x8')](_0xe155('0xa'),auth[_0xe155('0xb')](),controller['describe']);router[_0xe155('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xe155('0xc')]);router[_0xe155('0x8')](_0xe155('0xd'),auth['isAuthenticated'](),controller[_0xe155('0xe')]);router[_0xe155('0x8')](_0xe155('0xf'),controller[_0xe155('0x10')]);router[_0xe155('0x8')](_0xe155('0x11'),auth[_0xe155('0xb')](),controller['downloadTranscribe']);router['post']('/',auth[_0xe155('0xb')](),controller[_0xe155('0x12')]);router['post']('/:id/transcribe',auth[_0xe155('0xb')](),controller[_0xe155('0x13')]);router[_0xe155('0x14')](_0xe155('0x15'),auth[_0xe155('0xb')](),controller[_0xe155('0x16')]);router[_0xe155('0x17')](_0xe155('0x15'),auth[_0xe155('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index b2e3e60..6710b98 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(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xa9e0[_0x2a6809];return _0x11c371;};'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 adfd495..8db3151 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 _0x0266=['pick','filter','merge','options','include','findAll','show','params','includeAll','VoiceRecording','find','catch','create','body','download','../../components/encryptor','value','%s.cypher','decryptFile','recording','existsSync','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','sequelize','MD5','col','uniqueid','$and','push','secrets','Sequelize','ValidationError','extname','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','aws-sdk','uuid/v4','../../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','limit','undefined','count','set','apply','reject','save','then','destroy','stack','name','send','map','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x19d1b1,_0x4ac380){var _0x5a8011=function(_0x5ca77a){while(--_0x5ca77a){_0x19d1b1['push'](_0x19d1b1['shift']());}};_0x5a8011(++_0x4ac380);}(_0x0266,0x190));var _0x6026=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x0266[_0x199572];return _0x13cfa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6026('0x0'));var rp=require(_0x6026('0x1'));var moment=require('moment');var BPromise=require(_0x6026('0x2'));var Mustache=require(_0x6026('0x3'));var util=require(_0x6026('0x4'));var path=require(_0x6026('0x5'));var sox=require('sox');var csv=require(_0x6026('0x6'));var ejs=require(_0x6026('0x7'));var fs=require('fs');var fs_extra=require(_0x6026('0x8'));var _=require(_0x6026('0x9'));var squel=require(_0x6026('0xa'));var crypto=require(_0x6026('0xb'));var jsforce=require(_0x6026('0xc'));var deskjs=require(_0x6026('0xd'));var toCsv=require(_0x6026('0x6'));var querystring=require('querystring');var Papa=require(_0x6026('0xe'));var AWS=require(_0x6026('0xf'));var uuidv4=require(_0x6026('0x10'));var Redis=require('ioredis');var authService=require(_0x6026('0x11'));var qs=require(_0x6026('0x12'));var as=require(_0x6026('0x13'));var hardwareService=require(_0x6026('0x14'));var logger=require(_0x6026('0x15'))(_0x6026('0x16'));var utils=require(_0x6026('0x17'));var config=require(_0x6026('0x18'));var licenseUtil=require(_0x6026('0x19'));var db=require(_0x6026('0x1a'))['db'];function respondWithStatusCode(_0x1b64f1,_0x3901a8){_0x3901a8=_0x3901a8||0xcc;return function(_0x45380a){if(_0x45380a){return _0x1b64f1[_0x6026('0x1b')](_0x3901a8);}return _0x1b64f1['status'](_0x3901a8)[_0x6026('0x1c')]();};}function respondWithResult(_0x5ad7ae,_0x13c8d7){_0x13c8d7=_0x13c8d7||0xc8;return function(_0x44424a){if(_0x44424a){return _0x5ad7ae[_0x6026('0x1d')](_0x13c8d7)[_0x6026('0x1e')](_0x44424a);}};}function respondWithFilteredResult(_0x2433ee,_0x3cc9b4){return function(_0x349273){if(_0x349273){var _0x375bb1=typeof _0x3cc9b4[_0x6026('0x1f')]==='undefined'&&typeof _0x3cc9b4[_0x6026('0x20')]===_0x6026('0x21');var _0x1d1885=_0x349273[_0x6026('0x22')];var _0xc00d56=_0x375bb1?0x0:_0x3cc9b4[_0x6026('0x1f')];var _0x2628d2=_0x375bb1?_0x349273[_0x6026('0x22')]:_0x3cc9b4[_0x6026('0x1f')]+_0x3cc9b4[_0x6026('0x20')];var _0x2a8e2d;if(_0x2628d2>=_0x1d1885){_0x2628d2=_0x1d1885;_0x2a8e2d=0xc8;}else{_0x2a8e2d=0xce;}_0x2433ee['status'](_0x2a8e2d);return _0x2433ee[_0x6026('0x23')]('Content-Range',_0xc00d56+'-'+_0x2628d2+'/'+_0x1d1885)[_0x6026('0x1e')](_0x349273);}return null;};}function patchUpdates(_0x40d991){return function(_0x32d378){try{jsonpatch[_0x6026('0x24')](_0x32d378,_0x40d991,!![]);}catch(_0x263899){return BPromise[_0x6026('0x25')](_0x263899);}return _0x32d378[_0x6026('0x26')]();};}function saveUpdates(_0x263647,_0x4d1afb){return function(_0x40fa27){if(_0x40fa27){return _0x40fa27['update'](_0x263647)[_0x6026('0x27')](function(_0x148240){return _0x148240;});}return null;};}function removeEntity(_0x1c4a3a,_0x347cf6){return function(_0x1797fa){if(_0x1797fa){return _0x1797fa[_0x6026('0x28')]()[_0x6026('0x27')](function(){_0x1c4a3a[_0x6026('0x1d')](0xcc)[_0x6026('0x1c')]();});}};}function handleEntityNotFound(_0x1cb261,_0x207bbc){return function(_0x36dd9a){if(!_0x36dd9a){_0x1cb261['sendStatus'](0x194);}return _0x36dd9a;};}function handleError(_0x59fdb5,_0x406c94){_0x406c94=_0x406c94||0x1f4;return function(_0x486f7a){logger['error'](_0x486f7a[_0x6026('0x29')]);if(_0x486f7a[_0x6026('0x2a')]){delete _0x486f7a[_0x6026('0x2a')];}_0x59fdb5[_0x6026('0x1d')](_0x406c94)[_0x6026('0x2b')](_0x486f7a);};}exports['index']=function(_0xa7ba39,_0x56bbb1){var _0x214ef5={},_0x33881a={},_0xb5b347={'count':0x0,'rows':[]};var _0x2edabf=_[_0x6026('0x2c')](db['VoiceRecording']['rawAttributes'],function(_0x13e7a9){return{'name':_0x13e7a9[_0x6026('0x2d')],'type':_0x13e7a9[_0x6026('0x2e')][_0x6026('0x2f')]};});_0x33881a[_0x6026('0x30')]=_['differenceBy'](_['map'](_0x2edabf,_0x6026('0x2a')),[_0x6026('0x31')]);_0x33881a[_0x6026('0x32')]=_[_0x6026('0x33')](_0xa7ba39[_0x6026('0x32')]);_0x33881a[_0x6026('0x34')]=_[_0x6026('0x35')](_0x33881a['model'],_0x33881a[_0x6026('0x32')]);_0x214ef5[_0x6026('0x36')]=_['intersection'](_0x33881a['model'],qs[_0x6026('0x37')](_0xa7ba39[_0x6026('0x32')][_0x6026('0x37')]));_0x214ef5[_0x6026('0x36')]=_0x214ef5['attributes'][_0x6026('0x38')]?_0x214ef5[_0x6026('0x36')]:_0x33881a[_0x6026('0x30')];if(!_0xa7ba39['query'][_0x6026('0x39')](_0x6026('0x3a'))){_0x214ef5[_0x6026('0x20')]=qs['limit'](_0xa7ba39[_0x6026('0x32')][_0x6026('0x20')]);_0x214ef5['offset']=qs[_0x6026('0x1f')](_0xa7ba39[_0x6026('0x32')][_0x6026('0x1f')]);}_0x214ef5[_0x6026('0x3b')]=qs[_0x6026('0x3c')](_0xa7ba39[_0x6026('0x32')][_0x6026('0x3c')]);_0x214ef5[_0x6026('0x3d')]=qs[_0x6026('0x34')](_[_0x6026('0x3e')](_0xa7ba39['query'],_0x33881a[_0x6026('0x34')]),_0x2edabf);if(_0xa7ba39[_0x6026('0x32')][_0x6026('0x3f')]){_0x214ef5[_0x6026('0x3d')]=_[_0x6026('0x40')](_0x214ef5[_0x6026('0x3d')],{'$or':_[_0x6026('0x2c')](_0x2edabf,function(_0x41c561){if(_0x41c561['type']!=='VIRTUAL'){var _0x2fbec4={};_0x2fbec4[_0x41c561['name']]={'$like':'%'+_0xa7ba39['query'][_0x6026('0x3f')]+'%'};return _0x2fbec4;}})});}_0x214ef5=_[_0x6026('0x40')]({},_0x214ef5,_0xa7ba39[_0x6026('0x41')]);var _0x3f08a4={'where':_0x214ef5[_0x6026('0x3d')]};return db['VoiceRecording'][_0x6026('0x22')](_0x3f08a4)[_0x6026('0x27')](function(_0x4249d4){_0xb5b347['count']=_0x4249d4;if(_0xa7ba39[_0x6026('0x32')]['includeAll']){_0x214ef5[_0x6026('0x42')]=[{'all':!![]}];}return db['VoiceRecording'][_0x6026('0x43')](_0x214ef5);})['then'](function(_0x12ae45){_0xb5b347['rows']=_0x12ae45;return _0xb5b347;})[_0x6026('0x27')](respondWithFilteredResult(_0x56bbb1,_0x214ef5))['catch'](handleError(_0x56bbb1,null));};exports[_0x6026('0x44')]=function(_0x17ef0d,_0x4367f9){var _0x377e69={'raw':![],'where':{'id':_0x17ef0d[_0x6026('0x45')]['id']}},_0x3f4da7={};_0x3f4da7[_0x6026('0x30')]=_['keys'](db['VoiceRecording']['rawAttributes']);_0x3f4da7[_0x6026('0x32')]=_['keys'](_0x17ef0d[_0x6026('0x32')]);_0x3f4da7['filters']=_[_0x6026('0x35')](_0x3f4da7['model'],_0x3f4da7[_0x6026('0x32')]);_0x377e69[_0x6026('0x36')]=_[_0x6026('0x35')](_0x3f4da7['model'],qs[_0x6026('0x37')](_0x17ef0d[_0x6026('0x32')][_0x6026('0x37')]));_0x377e69[_0x6026('0x36')]=_0x377e69['attributes']['length']?_0x377e69['attributes']:_0x3f4da7[_0x6026('0x30')];if(_0x17ef0d[_0x6026('0x32')][_0x6026('0x46')]){_0x377e69[_0x6026('0x42')]=[{'all':!![]}];}_0x377e69=_[_0x6026('0x40')]({},_0x377e69,_0x17ef0d['options']);return db[_0x6026('0x47')][_0x6026('0x48')](_0x377e69)['then'](handleEntityNotFound(_0x4367f9,null))[_0x6026('0x27')](respondWithResult(_0x4367f9,null))[_0x6026('0x49')](handleError(_0x4367f9,null));};exports[_0x6026('0x4a')]=function(_0xc6a388,_0x4258d7){return db['VoiceRecording'][_0x6026('0x4a')](_0xc6a388[_0x6026('0x4b')],{})[_0x6026('0x27')](respondWithResult(_0x4258d7,0xc9))[_0x6026('0x49')](handleError(_0x4258d7,null));};exports['update']=function(_0x163ac1,_0x4ec93e){if(_0x163ac1[_0x6026('0x4b')]['id']){delete _0x163ac1[_0x6026('0x4b')]['id'];}return db[_0x6026('0x47')][_0x6026('0x48')]({'where':{'id':_0x163ac1[_0x6026('0x45')]['id']}})['then'](handleEntityNotFound(_0x4ec93e,null))[_0x6026('0x27')](saveUpdates(_0x163ac1[_0x6026('0x4b')],null))[_0x6026('0x27')](respondWithResult(_0x4ec93e,null))[_0x6026('0x49')](handleError(_0x4ec93e,null));};exports['describe']=function(_0x25be4c,_0x20156b){return db['VoiceRecording']['describe']()[_0x6026('0x27')](respondWithResult(_0x20156b,null))[_0x6026('0x49')](handleError(_0x20156b,null));};exports[_0x6026('0x4c')]=function(_0x222978,_0x451931,_0x39dff2){var _0x38cc6d=require(_0x6026('0x4d'));var _0x1c87bc=![];var _0x2a7249={};if(_0x222978[_0x6026('0x32')]['type']&&_0x222978[_0x6026('0x32')]['type']==='uniqueid'){_0x2a7249['uniqueid']=_0x222978['params']['id'];}else{_0x2a7249['id']=_0x222978['params']['id'];}return db[_0x6026('0x47')][_0x6026('0x48')]({'where':_0x2a7249,'attributes':['id',_0x6026('0x4e')],'raw':!![]})[_0x6026('0x27')](handleEntityNotFound(_0x451931,null))['then'](function(_0x2d90b0){if(_0x2d90b0){var _0x2980b4=_0x2d90b0[_0x6026('0x4e')];var _0x15af4c=util['format'](_0x6026('0x4f'),_0x2980b4);if(fs['existsSync'](_0x15af4c)){_0x1c87bc=!![];return _0x38cc6d[_0x6026('0x50')](_0x15af4c,_0x2980b4,config['secrets'][_0x6026('0x51')])[_0x6026('0x27')](function(){return _0x2d90b0;});}return _0x2d90b0;}})['then'](function(_0x2672ac){if(_0x2672ac){var _0x564e6b=_0x2672ac[_0x6026('0x4e')];if(!fs[_0x6026('0x52')](_0x564e6b)){throw new db['Sequelize']['ValidationError'](_0x6026('0x53'));}if(_0x2672ac[_0x6026('0x54')]){return _0x451931[_0x6026('0x4c')](_0x564e6b,_0x2672ac['filename']+path['extname'](_0x564e6b),function(){if(_0x1c87bc){fs[_0x6026('0x55')](_0x564e6b);}});}else{return _0x451931['download'](_0x564e6b,function(_0x538e2c){if(_0x1c87bc){fs[_0x6026('0x55')](_0x564e6b);}});}}})['catch'](function(_0x3bb44d){if(_0x3bb44d[_0x6026('0x56')]===_0x6026('0x53')){_0x451931[_0x6026('0x1d')](0x194)[_0x6026('0x2b')](_0x6026('0x57'));}else{return handleError(_0x451931,null);}});};exports[_0x6026('0x58')]=function(_0x3c6d2b,_0x1a74c3,_0x4c6563){var _0x2bc477=require(_0x6026('0x4d'));var _0x2c15fd=![];var _0xb51bff={'$and':[db[_0x6026('0x59')][_0x6026('0x3d')](db[_0x6026('0x59')]['fn'](_0x6026('0x5a'),db[_0x6026('0x59')][_0x6026('0x5b')](_0x6026('0x5c'))),_0x3c6d2b[_0x6026('0x32')]['token'])]};if(_0x3c6d2b[_0x6026('0x32')][_0x6026('0x2e')]&&_0x3c6d2b[_0x6026('0x32')][_0x6026('0x2e')]===_0x6026('0x5c')){_0xb51bff[_0x6026('0x5d')][_0x6026('0x5e')]({'uniqueid':_0x3c6d2b[_0x6026('0x45')]['id']});}else{_0xb51bff['$and'][_0x6026('0x5e')]({'id':_0x3c6d2b[_0x6026('0x45')]['id']});}return db[_0x6026('0x47')][_0x6026('0x48')]({'where':_0xb51bff,'attributes':['id',_0x6026('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x1a74c3,null))['then'](function(_0x1f54e7){if(_0x1f54e7){var _0x16d9d1=util['format'](_0x6026('0x4f'),_0x1f54e7[_0x6026('0x4e')]);if(fs[_0x6026('0x52')](_0x16d9d1)){_0x2c15fd=!![];return _0x2bc477[_0x6026('0x50')](_0x16d9d1,_0x1f54e7['value'],config[_0x6026('0x5f')][_0x6026('0x51')])[_0x6026('0x27')](function(){return _0x1f54e7;});}return _0x1f54e7;}})[_0x6026('0x27')](function(_0x3e4de2){if(_0x3e4de2){if(!fs['existsSync'](_0x3e4de2[_0x6026('0x4e')])){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x53'));}if(_0x3e4de2[_0x6026('0x54')]){return _0x1a74c3['download'](_0x3e4de2[_0x6026('0x4e')],_0x3e4de2[_0x6026('0x54')]+path[_0x6026('0x62')](_0x3e4de2[_0x6026('0x4e')]),function(){if(_0x2c15fd){fs['unlink'](_0x3e4de2[_0x6026('0x4e')]);}});}else{return _0x1a74c3[_0x6026('0x4c')](_0x3e4de2[_0x6026('0x4e')],function(_0x550c36){if(_0x2c15fd){fs['unlink'](_0x3e4de2[_0x6026('0x4e')]);}});}}})[_0x6026('0x49')](handleError(_0x1a74c3,null));};exports[_0x6026('0x28')]=function(_0x556d63,_0x1ce7a0){return db[_0x6026('0x47')]['find']({'where':{'id':_0x556d63[_0x6026('0x45')]['id']}})[_0x6026('0x27')](function(_0x2dcc8c){if(_[_0x6026('0x63')](_0x2dcc8c)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2dcc8c;})['then'](function(_0x5bb556){var _0x3a3550=_0x5bb556[_0x6026('0x4e')];logger[_0x6026('0x64')]('cancellazione\x20fisica\x20documento\x20%s',_0x3a3550);if(!_[_0x6026('0x63')](_0x5bb556['value'])&&fs[_0x6026('0x52')](_0x3a3550)){logger['info'](_0x6026('0x65')+_0x3a3550+_0x6026('0x66'));fs[_0x6026('0x67')](_0x3a3550);}_0x3a3550=_0x3a3550+_0x6026('0x68');if(!_[_0x6026('0x63')](_0x5bb556[_0x6026('0x4e')])&&fs[_0x6026('0x52')](_0x3a3550)){logger[_0x6026('0x64')](_0x6026('0x65')+_0x3a3550+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6026('0x67')](_0x3a3550);}return _0x5bb556;})[_0x6026('0x27')](function(_0x33c5df){if(!_0x33c5df)throw new InternalError();return _0x33c5df[_0x6026('0x28')]();})['then'](function(){_0x1ce7a0[_0x6026('0x1d')](0xcc)[_0x6026('0x1c')]();})[_0x6026('0x49')](handleError(_0x1ce7a0,null));};function getBucketslist(_0x17eb6c,_0x3d2b1c,_0x1de2e9){return new Promise(function(_0x1b95c6,_0x5e446f){var _0x2ce853=new AWS['S3']({'accessKeyId':_0x3d2b1c,'secretAccessKey':_0x17eb6c,'region':_0x1de2e9});_0x2ce853[_0x6026('0x69')]({},function(_0x2f53ca,_0x185776){if(_0x2f53ca){return _0x5e446f(_0x2f53ca);}else{return _0x1b95c6(_0x185776);}});});}function createBucket(_0x10853a,_0x35b597,_0x1f1dfc,_0x444398){return new Promise(function(_0x372e0d,_0xcad6fd){var _0x5d4cf7=new AWS['S3']({'accessKeyId':_0x35b597,'secretAccessKey':_0x10853a,'region':_0x1f1dfc});_0x5d4cf7['createBucket']({'Bucket':_0x444398},function(_0x54f13c,_0x2fcd00){if(_0x54f13c){return _0xcad6fd(_0x54f13c);}else{return _0x372e0d(_0x2fcd00);}});});}function uploadFile(_0x532a10,_0x4c41e3,_0x3d6a23,_0x2681cb,_0x4823f9,_0x2fa561){return new Promise(function(_0x559f27,_0x2954a4){var _0x2790cd=new AWS['S3']({'accessKeyId':_0x4c41e3,'secretAccessKey':_0x532a10,'region':_0x3d6a23});_0x2790cd[_0x6026('0x6a')]({'Bucket':_0x2681cb,'Key':_0x4823f9,'Body':_0x2fa561},function(_0x2930b5,_0x297d97){if(_0x2930b5){return _0x2954a4(_0x2930b5);}else{return _0x559f27(_0x297d97);}});});}function startTranscribe(_0x1f60b7,_0xe125c8,_0x34087e,_0x34ad0e,_0x13c6d1,_0x11ff99){return new Promise(function(_0xd836d,_0x22549c){var _0x134758=new AWS[(_0x6026('0x6b'))]({'accessKeyId':_0xe125c8,'secretAccessKey':_0x1f60b7,'region':_0x34087e});_0x134758[_0x6026('0x6c')]({'TranscriptionJobName':_0x34ad0e,'LanguageCode':_0x13c6d1,'Media':{'MediaFileUri':_0x11ff99}},function(_0x491711,_0x272ca2){if(_0x491711){return _0x22549c(_0x491711);}else{return _0xd836d(_0x272ca2);}});});}function transcribe(_0xa56b36,_0x153d17,_0x48a3c7,_0x47d2a4,_0x338622,_0x4cda40,_0x51e784){return new Promise(function(_0x1b8e5e,_0x1070dd){var _0x33fdb1={};logger[_0x6026('0x64')](util['format'](_0x6026('0x6d'),_0xa56b36,_0x338622));return uploadFile(_0x153d17,_0x48a3c7,_0x47d2a4,_0x338622,path[_0x6026('0x6e')](_0x4cda40),fs[_0x6026('0x6f')](_0x4cda40))['then'](function(_0xbbd4f5){logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x70'),_0xa56b36,_0x338622,_0xbbd4f5[_0x6026('0x71')]));_0x33fdb1[_0x6026('0x72')]=_0xbbd4f5[_0x6026('0x73')];_0x33fdb1[_0x6026('0x74')]=_0xbbd4f5[_0x6026('0x71')];logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x75'),_0xa56b36));return startTranscribe(_0x153d17,_0x48a3c7,_0x47d2a4,uuidv4(),_0x51e784,_0xbbd4f5[_0x6026('0x71')]);})[_0x6026('0x27')](function(_0x3c7227){logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x76'),_0xa56b36,_0x3c7227[_0x6026('0x77')][_0x6026('0x78')]));_0x33fdb1[_0x6026('0x79')]=_0x3c7227[_0x6026('0x77')]['TranscriptionJobName'];_0x33fdb1[_0x6026('0x7a')]=_0x3c7227['TranscriptionJob'][_0x6026('0x7b')];return _0x1b8e5e(_0x33fdb1);})[_0x6026('0x49')](function(_0x127aaa){return _0x1070dd(_0x127aaa);});});}exports[_0x6026('0x7c')]=function(_0x289787,_0xd0a0d8,_0x3e617a){var _0x473f40;var _0x176502;var _0x3a5fa2;var _0x3f6bc6=require('../../components/encryptor');return db[_0x6026('0x47')][_0x6026('0x7d')]({'where':{'id':_0x289787[_0x6026('0x45')]['id']}})[_0x6026('0x27')](function(_0x16d2e5){if(_0x16d2e5){var _0x109feb=util[_0x6026('0x31')](_0x6026('0x4f'),_0x16d2e5[_0x6026('0x4e')]);if(fs['existsSync'](_0x109feb)){cypher=!![];return _0x3f6bc6[_0x6026('0x50')](_0x109feb,_0x16d2e5[_0x6026('0x4e')],config[_0x6026('0x5f')]['recording'])['then'](function(){return _0x16d2e5;});}return _0x16d2e5;}})['then'](function(_0xb33545){if(!_0xb33545){throw new db['Sequelize'][(_0x6026('0x61'))](_0x6026('0x7e'));}_0x176502=_0xb33545;return db[_0x6026('0x7f')]['findOne']({'where':{'id':0x1}});})[_0x6026('0x27')](handleEntityNotFound(_0xd0a0d8,null))['then'](function(_0x50c9b7){if(_0x50c9b7){_0x473f40=_0x50c9b7;if(!_0x473f40[_0x6026('0x80')]||!_0x473f40[_0x6026('0x81')]||!_0x473f40['transcribeRegion']||!_0x473f40['language']||!_0x473f40['bucket']){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x82'));}if(_0x289787[_0x6026('0x4b')][_0x6026('0x83')]&&(!_0x473f40[_0x6026('0x84')]||!_0x473f40[_0x6026('0x85')]||!_0x473f40['sentimentRegion']||!_0x473f40[_0x6026('0x86')]||!_0x473f40[_0x6026('0x72')])){throw new db['Sequelize']['ValidationError'](_0x6026('0x87'));}return db['CloudProvider'][_0x6026('0x7d')]({'where':{'id':_0x473f40['transcribeAccountId']}});}})[_0x6026('0x27')](function(_0x3b1ef){if(!_0x3b1ef){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x88'));}if(!_0x3b1ef[_0x6026('0x89')]||!_0x3b1ef[_0x6026('0x8a')]){throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x8b'));}_0x3a5fa2=_0x3b1ef;return getBucketslist(_0x3a5fa2[_0x6026('0x89')],_0x3a5fa2[_0x6026('0x8a')],_0x473f40['transcribeRegion']);})['then'](function(_0x2bf86f){if(_0x2bf86f&&_0x2bf86f['Buckets']){var _0x39752b=_['find'](_0x2bf86f[_0x6026('0x8c')],function(_0x5272f7){return _0x5272f7['Name']===_0x473f40[_0x6026('0x72')];});if(!_0x39752b){logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x8d'),_0x289787[_0x6026('0x45')]['id'],_0x473f40[_0x6026('0x72')]));return createBucket(_0x3a5fa2[_0x6026('0x89')],_0x3a5fa2[_0x6026('0x8a')],_0x473f40[_0x6026('0x8e')],_0x473f40['bucket']);}logger[_0x6026('0x64')](util['format'](_0x6026('0x8f'),_0x289787[_0x6026('0x45')]['id'],_0x473f40['bucket']));return;}})['then'](function(_0x51242e){if(_0x176502[_0x6026('0x7a')]===_0x6026('0x90')){return transcribe(_0x289787[_0x6026('0x45')]['id'],_0x3a5fa2['data1'],_0x3a5fa2['data2'],_0x473f40[_0x6026('0x8e')],_0x473f40[_0x6026('0x72')],_0x176502['value'],_0x473f40[_0x6026('0x86')]);}else{logger[_0x6026('0x64')](util[_0x6026('0x31')](_0x6026('0x91'),_0x289787[_0x6026('0x45')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})['then'](function(_0x3100bd){if(_0x3100bd){_0x3100bd[_0x6026('0x92')]=_0x289787[_0x6026('0x4b')]['runSentiment'];return _0x176502['updateAttributes'](_0x3100bd);}})['then'](respondWithResult(_0xd0a0d8,null))[_0x6026('0x49')](handleError(_0xd0a0d8,null));};function writeFile(_0x466bf7,_0x2a8409){return new Promise(function(_0x3a889d,_0x1d4704){fs[_0x6026('0x93')](_0x2a8409,_0x466bf7,function(_0x46f887,_0x4f5d3d){if(_0x46f887){return _0x1d4704(_0x46f887);}else{return _0x3a889d(_0x4f5d3d);}});});}exports[_0x6026('0x94')]=function(_0x2d21ff,_0x3b9b6f,_0x44b54b){return db['VoiceRecording'][_0x6026('0x7d')]({'where':{'id':_0x2d21ff['params']['id']}})[_0x6026('0x27')](handleEntityNotFound(_0x3b9b6f))[_0x6026('0x27')](function(_0x36daa8){if(_0x36daa8&&_0x36daa8[_0x6026('0x95')]){var _0x39e86b=_0x36daa8['fileText'];var _0x25c191=config[_0x6026('0x96')]+_0x6026('0x97')+_0x36daa8['id']+_0x6026('0x98');if(fs[_0x6026('0x52')](_0x25c191)){return _0x25c191;}return writeFile(_0x39e86b,_0x25c191)[_0x6026('0x27')](function(){return _0x25c191;});}else{throw new db[(_0x6026('0x60'))][(_0x6026('0x61'))](_0x6026('0x99'));}})[_0x6026('0x27')](function(_0x14133d){return _0x3b9b6f[_0x6026('0x4c')](_0x14133d);})['catch'](handleError(_0x3b9b6f));}; \ No newline at end of file +var _0x92bf=['Transcribe\x20not\x20configured','runSentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','data2','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','offset','limit','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','filters','length','find','create','body','describe','type','uniqueid','value','decryptFile','secrets','existsSync','Sequelize','VoiceRecording\x20not\x20found','filename','download','extname','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','token','$and','push','%s.cypher','recording','ValidationError','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','File:\x20\x22','end','listBuckets','createBucket','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','language'];(function(_0x580d1b,_0x492f8d){var _0x4c2e49=function(_0x452f8b){while(--_0x452f8b){_0x580d1b['push'](_0x580d1b['shift']());}};_0x4c2e49(++_0x492f8d);}(_0x92bf,0xb0));var _0xf92b=function(_0x1299ee,_0x420b82){_0x1299ee=_0x1299ee-0x0;var _0x38ca62=_0x92bf[_0x1299ee];return _0x38ca62;};'use strict';var emlformat=require(_0xf92b('0x0'));var rimraf=require(_0xf92b('0x1'));var zipdir=require(_0xf92b('0x2'));var jsonpatch=require(_0xf92b('0x3'));var rp=require('request-promise');var moment=require(_0xf92b('0x4'));var BPromise=require(_0xf92b('0x5'));var Mustache=require('mustache');var util=require(_0xf92b('0x6'));var path=require(_0xf92b('0x7'));var sox=require(_0xf92b('0x8'));var csv=require(_0xf92b('0x9'));var ejs=require(_0xf92b('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf92b('0xb'));var deskjs=require(_0xf92b('0xc'));var toCsv=require(_0xf92b('0x9'));var querystring=require(_0xf92b('0xd'));var Papa=require('papaparse');var AWS=require(_0xf92b('0xe'));var uuidv4=require('uuid/v4');var Redis=require(_0xf92b('0xf'));var authService=require(_0xf92b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf92b('0x11'));var hardwareService=require(_0xf92b('0x12'));var logger=require(_0xf92b('0x13'))(_0xf92b('0x14'));var utils=require(_0xf92b('0x15'));var config=require(_0xf92b('0x16'));var licenseUtil=require(_0xf92b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a6771,_0x3d1973){_0x3d1973=_0x3d1973||0xcc;return function(_0x5f4aa6){if(_0x5f4aa6){return _0x1a6771['sendStatus'](_0x3d1973);}return _0x1a6771[_0xf92b('0x18')](_0x3d1973)['end']();};}function respondWithResult(_0x3588cb,_0x868e7a){_0x868e7a=_0x868e7a||0xc8;return function(_0x365a6a){if(_0x365a6a){return _0x3588cb[_0xf92b('0x18')](_0x868e7a)['json'](_0x365a6a);}};}function respondWithFilteredResult(_0x113f28,_0x48b1a2){return function(_0x5de23e){if(_0x5de23e){var _0x105f83=typeof _0x48b1a2[_0xf92b('0x19')]==='undefined'&&typeof _0x48b1a2[_0xf92b('0x1a')]===_0xf92b('0x1b');var _0x1a20a2=_0x5de23e[_0xf92b('0x1c')];var _0x3af3ab=_0x105f83?0x0:_0x48b1a2['offset'];var _0x36ac37=_0x105f83?_0x5de23e[_0xf92b('0x1c')]:_0x48b1a2[_0xf92b('0x19')]+_0x48b1a2[_0xf92b('0x1a')];var _0x3bb464;if(_0x36ac37>=_0x1a20a2){_0x36ac37=_0x1a20a2;_0x3bb464=0xc8;}else{_0x3bb464=0xce;}_0x113f28[_0xf92b('0x18')](_0x3bb464);return _0x113f28[_0xf92b('0x1d')](_0xf92b('0x1e'),_0x3af3ab+'-'+_0x36ac37+'/'+_0x1a20a2)[_0xf92b('0x1f')](_0x5de23e);}return null;};}function patchUpdates(_0x3c0308){return function(_0x459ed8){try{jsonpatch[_0xf92b('0x20')](_0x459ed8,_0x3c0308,!![]);}catch(_0x29f699){return BPromise[_0xf92b('0x21')](_0x29f699);}return _0x459ed8[_0xf92b('0x22')]();};}function saveUpdates(_0x5a3f91,_0xccf1c1){return function(_0x452bb4){if(_0x452bb4){return _0x452bb4[_0xf92b('0x23')](_0x5a3f91)['then'](function(_0x53359a){return _0x53359a;});}return null;};}function removeEntity(_0x229131,_0x572f71){return function(_0x1cdd38){if(_0x1cdd38){return _0x1cdd38[_0xf92b('0x24')]()[_0xf92b('0x25')](function(){_0x229131['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47024f,_0x46be4e){return function(_0x59a064){if(!_0x59a064){_0x47024f[_0xf92b('0x26')](0x194);}return _0x59a064;};}function handleError(_0x57c16c,_0xd2578f){_0xd2578f=_0xd2578f||0x1f4;return function(_0x4e3aa4){logger['error'](_0x4e3aa4[_0xf92b('0x27')]);if(_0x4e3aa4['name']){delete _0x4e3aa4[_0xf92b('0x28')];}_0x57c16c[_0xf92b('0x18')](_0xd2578f)[_0xf92b('0x29')](_0x4e3aa4);};}exports['index']=function(_0x3488a0,_0xf1f836){var _0xd08ae3={},_0x4dcaee={},_0x5851f6={'count':0x0,'rows':[]};var _0x54804e=_[_0xf92b('0x2a')](db['VoiceRecording'][_0xf92b('0x2b')],function(_0x2540f4){return{'name':_0x2540f4[_0xf92b('0x2c')],'type':_0x2540f4['type'][_0xf92b('0x2d')]};});_0x4dcaee[_0xf92b('0x2e')]=_[_0xf92b('0x2f')](_[_0xf92b('0x2a')](_0x54804e,_0xf92b('0x28')),[_0xf92b('0x30')]);_0x4dcaee[_0xf92b('0x31')]=_[_0xf92b('0x32')](_0x3488a0[_0xf92b('0x31')]);_0x4dcaee['filters']=_[_0xf92b('0x33')](_0x4dcaee[_0xf92b('0x2e')],_0x4dcaee['query']);_0xd08ae3[_0xf92b('0x34')]=_['intersection'](_0x4dcaee[_0xf92b('0x2e')],qs[_0xf92b('0x35')](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x35')]));_0xd08ae3['attributes']=_0xd08ae3[_0xf92b('0x34')]['length']?_0xd08ae3[_0xf92b('0x34')]:_0x4dcaee[_0xf92b('0x2e')];if(!_0x3488a0['query'][_0xf92b('0x36')](_0xf92b('0x37'))){_0xd08ae3[_0xf92b('0x1a')]=qs['limit'](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x1a')]);_0xd08ae3[_0xf92b('0x19')]=qs[_0xf92b('0x19')](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x19')]);}_0xd08ae3[_0xf92b('0x38')]=qs[_0xf92b('0x39')](_0x3488a0[_0xf92b('0x31')][_0xf92b('0x39')]);_0xd08ae3[_0xf92b('0x3a')]=qs['filters'](_[_0xf92b('0x3b')](_0x3488a0[_0xf92b('0x31')],_0x4dcaee['filters']),_0x54804e);if(_0x3488a0[_0xf92b('0x31')][_0xf92b('0x3c')]){_0xd08ae3[_0xf92b('0x3a')]=_[_0xf92b('0x3d')](_0xd08ae3[_0xf92b('0x3a')],{'$or':_[_0xf92b('0x2a')](_0x54804e,function(_0x508e12){if(_0x508e12['type']!==_0xf92b('0x3e')){var _0x5dd739={};_0x5dd739[_0x508e12['name']]={'$like':'%'+_0x3488a0[_0xf92b('0x31')]['filter']+'%'};return _0x5dd739;}})});}_0xd08ae3=_[_0xf92b('0x3d')]({},_0xd08ae3,_0x3488a0[_0xf92b('0x3f')]);var _0x24b1cd={'where':_0xd08ae3[_0xf92b('0x3a')]};return db[_0xf92b('0x40')][_0xf92b('0x1c')](_0x24b1cd)[_0xf92b('0x25')](function(_0x432b4c){_0x5851f6[_0xf92b('0x1c')]=_0x432b4c;if(_0x3488a0[_0xf92b('0x31')][_0xf92b('0x41')]){_0xd08ae3[_0xf92b('0x42')]=[{'all':!![]}];}return db[_0xf92b('0x40')][_0xf92b('0x43')](_0xd08ae3);})[_0xf92b('0x25')](function(_0x1c2c54){_0x5851f6[_0xf92b('0x44')]=_0x1c2c54;return _0x5851f6;})[_0xf92b('0x25')](respondWithFilteredResult(_0xf1f836,_0xd08ae3))[_0xf92b('0x45')](handleError(_0xf1f836,null));};exports[_0xf92b('0x46')]=function(_0x977825,_0x284b2f){var _0x1fce00={'raw':![],'where':{'id':_0x977825[_0xf92b('0x47')]['id']}},_0xcba68e={};_0xcba68e[_0xf92b('0x2e')]=_[_0xf92b('0x32')](db['VoiceRecording'][_0xf92b('0x2b')]);_0xcba68e[_0xf92b('0x31')]=_['keys'](_0x977825[_0xf92b('0x31')]);_0xcba68e[_0xf92b('0x48')]=_[_0xf92b('0x33')](_0xcba68e[_0xf92b('0x2e')],_0xcba68e[_0xf92b('0x31')]);_0x1fce00[_0xf92b('0x34')]=_[_0xf92b('0x33')](_0xcba68e[_0xf92b('0x2e')],qs['fields'](_0x977825[_0xf92b('0x31')]['fields']));_0x1fce00['attributes']=_0x1fce00[_0xf92b('0x34')][_0xf92b('0x49')]?_0x1fce00[_0xf92b('0x34')]:_0xcba68e[_0xf92b('0x2e')];if(_0x977825[_0xf92b('0x31')][_0xf92b('0x41')]){_0x1fce00[_0xf92b('0x42')]=[{'all':!![]}];}_0x1fce00=_['merge']({},_0x1fce00,_0x977825['options']);return db[_0xf92b('0x40')][_0xf92b('0x4a')](_0x1fce00)['then'](handleEntityNotFound(_0x284b2f,null))[_0xf92b('0x25')](respondWithResult(_0x284b2f,null))['catch'](handleError(_0x284b2f,null));};exports[_0xf92b('0x4b')]=function(_0x4ec31c,_0x331514){return db[_0xf92b('0x40')][_0xf92b('0x4b')](_0x4ec31c[_0xf92b('0x4c')],{})[_0xf92b('0x25')](respondWithResult(_0x331514,0xc9))['catch'](handleError(_0x331514,null));};exports[_0xf92b('0x23')]=function(_0x2518e3,_0x10ebaa){if(_0x2518e3[_0xf92b('0x4c')]['id']){delete _0x2518e3['body']['id'];}return db[_0xf92b('0x40')][_0xf92b('0x4a')]({'where':{'id':_0x2518e3['params']['id']}})['then'](handleEntityNotFound(_0x10ebaa,null))[_0xf92b('0x25')](saveUpdates(_0x2518e3[_0xf92b('0x4c')],null))[_0xf92b('0x25')](respondWithResult(_0x10ebaa,null))[_0xf92b('0x45')](handleError(_0x10ebaa,null));};exports[_0xf92b('0x4d')]=function(_0xd29b1d,_0x25c1be){return db['VoiceRecording'][_0xf92b('0x4d')]()['then'](respondWithResult(_0x25c1be,null))[_0xf92b('0x45')](handleError(_0x25c1be,null));};exports['download']=function(_0x27f95e,_0x401d2c,_0x2df916){var _0x50eb0b=require('../../components/encryptor');var _0x343e87=![];var _0x25ee20={};if(_0x27f95e[_0xf92b('0x31')][_0xf92b('0x4e')]&&_0x27f95e[_0xf92b('0x31')]['type']===_0xf92b('0x4f')){_0x25ee20['uniqueid']=_0x27f95e[_0xf92b('0x47')]['id'];}else{_0x25ee20['id']=_0x27f95e[_0xf92b('0x47')]['id'];}return db[_0xf92b('0x40')][_0xf92b('0x4a')]({'where':_0x25ee20,'attributes':['id',_0xf92b('0x50')],'raw':!![]})['then'](handleEntityNotFound(_0x401d2c,null))[_0xf92b('0x25')](function(_0x17e232){if(_0x17e232){var _0xeb4a0f=_0x17e232[_0xf92b('0x50')];var _0x4af414=util[_0xf92b('0x30')]('%s.cypher',_0xeb4a0f);if(fs['existsSync'](_0x4af414)){_0x343e87=!![];return _0x50eb0b[_0xf92b('0x51')](_0x4af414,_0xeb4a0f,config[_0xf92b('0x52')]['recording'])['then'](function(){return _0x17e232;});}return _0x17e232;}})['then'](function(_0x4f55bc){if(_0x4f55bc){var _0x389c0a=_0x4f55bc[_0xf92b('0x50')];if(!fs[_0xf92b('0x53')](_0x389c0a)){throw new db[(_0xf92b('0x54'))]['ValidationError'](_0xf92b('0x55'));}if(_0x4f55bc[_0xf92b('0x56')]){return _0x401d2c[_0xf92b('0x57')](_0x389c0a,_0x4f55bc['filename']+path[_0xf92b('0x58')](_0x389c0a),function(){if(_0x343e87){fs['unlink'](_0x389c0a);}});}else{return _0x401d2c[_0xf92b('0x57')](_0x389c0a,function(_0x487ca7){if(_0x343e87){fs[_0xf92b('0x59')](_0x389c0a);}});}}})['catch'](function(_0x3b02b9){if(_0x3b02b9[_0xf92b('0x5a')]===_0xf92b('0x55')){_0x401d2c['status'](0x194)[_0xf92b('0x29')](_0xf92b('0x5b'));}else{return handleError(_0x401d2c,null);}});};exports[_0xf92b('0x5c')]=function(_0x672bce,_0x4d74d8,_0x3a4841){var _0x21cf5e=require(_0xf92b('0x5d'));var _0x353d69=![];var _0x2c0ab0={'$and':[db[_0xf92b('0x5e')][_0xf92b('0x3a')](db[_0xf92b('0x5e')]['fn']('MD5',db['sequelize']['col'](_0xf92b('0x4f'))),_0x672bce[_0xf92b('0x31')][_0xf92b('0x5f')])]};if(_0x672bce[_0xf92b('0x31')][_0xf92b('0x4e')]&&_0x672bce['query']['type']===_0xf92b('0x4f')){_0x2c0ab0[_0xf92b('0x60')][_0xf92b('0x61')]({'uniqueid':_0x672bce[_0xf92b('0x47')]['id']});}else{_0x2c0ab0['$and'][_0xf92b('0x61')]({'id':_0x672bce[_0xf92b('0x47')]['id']});}return db['VoiceRecording'][_0xf92b('0x4a')]({'where':_0x2c0ab0,'attributes':['id','value'],'raw':!![]})[_0xf92b('0x25')](handleEntityNotFound(_0x4d74d8,null))['then'](function(_0x162b0b){if(_0x162b0b){var _0x5ec8c4=util[_0xf92b('0x30')](_0xf92b('0x62'),_0x162b0b[_0xf92b('0x50')]);if(fs[_0xf92b('0x53')](_0x5ec8c4)){_0x353d69=!![];return _0x21cf5e[_0xf92b('0x51')](_0x5ec8c4,_0x162b0b[_0xf92b('0x50')],config['secrets'][_0xf92b('0x63')])[_0xf92b('0x25')](function(){return _0x162b0b;});}return _0x162b0b;}})[_0xf92b('0x25')](function(_0x3bf063){if(_0x3bf063){if(!fs[_0xf92b('0x53')](_0x3bf063['value'])){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x55'));}if(_0x3bf063[_0xf92b('0x56')]){return _0x4d74d8[_0xf92b('0x57')](_0x3bf063['value'],_0x3bf063[_0xf92b('0x56')]+path[_0xf92b('0x58')](_0x3bf063['value']),function(){if(_0x353d69){fs['unlink'](_0x3bf063[_0xf92b('0x50')]);}});}else{return _0x4d74d8[_0xf92b('0x57')](_0x3bf063[_0xf92b('0x50')],function(_0x45f7fa){if(_0x353d69){fs[_0xf92b('0x59')](_0x3bf063[_0xf92b('0x50')]);}});}}})[_0xf92b('0x45')](handleError(_0x4d74d8,null));};exports[_0xf92b('0x24')]=function(_0x192254,_0x46204e){return db[_0xf92b('0x40')][_0xf92b('0x4a')]({'where':{'id':_0x192254[_0xf92b('0x47')]['id']}})[_0xf92b('0x25')](function(_0x36066c){if(_[_0xf92b('0x65')](_0x36066c)){throw new ReferenceError(_0xf92b('0x66'));}return _0x36066c;})[_0xf92b('0x25')](function(_0x33f554){var _0x15db36=_0x33f554['value'];logger['info'](_0xf92b('0x67'),_0x15db36);if(!_[_0xf92b('0x65')](_0x33f554['value'])&&fs[_0xf92b('0x53')](_0x15db36)){logger[_0xf92b('0x68')]('File:\x20\x22'+_0x15db36+_0xf92b('0x69'));fs[_0xf92b('0x6a')](_0x15db36);}_0x15db36=_0x15db36+'.cypher';if(!_[_0xf92b('0x65')](_0x33f554['value'])&&fs[_0xf92b('0x53')](_0x15db36)){logger[_0xf92b('0x68')](_0xf92b('0x6b')+_0x15db36+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x15db36);}return _0x33f554;})[_0xf92b('0x25')](function(_0x10af40){if(!_0x10af40)throw new InternalError();return _0x10af40[_0xf92b('0x24')]();})['then'](function(){_0x46204e[_0xf92b('0x18')](0xcc)[_0xf92b('0x6c')]();})[_0xf92b('0x45')](handleError(_0x46204e,null));};function getBucketslist(_0x4c8ab8,_0x3d2048,_0x2945d6){return new Promise(function(_0x54eb6d,_0x1f76c3){var _0x53bef5=new AWS['S3']({'accessKeyId':_0x3d2048,'secretAccessKey':_0x4c8ab8,'region':_0x2945d6});_0x53bef5[_0xf92b('0x6d')]({},function(_0x2d94c6,_0x5c84f5){if(_0x2d94c6){return _0x1f76c3(_0x2d94c6);}else{return _0x54eb6d(_0x5c84f5);}});});}function createBucket(_0x4aac8b,_0x5c75b5,_0x580bd2,_0x3f58ae){return new Promise(function(_0x44224c,_0x43c5b7){var _0x403d1d=new AWS['S3']({'accessKeyId':_0x5c75b5,'secretAccessKey':_0x4aac8b,'region':_0x580bd2});_0x403d1d[_0xf92b('0x6e')]({'Bucket':_0x3f58ae},function(_0x312b6c,_0x444bd3){if(_0x312b6c){return _0x43c5b7(_0x312b6c);}else{return _0x44224c(_0x444bd3);}});});}function uploadFile(_0x3c1f45,_0x291a3b,_0x5b7350,_0x358613,_0xa9ff5f,_0x368315){return new Promise(function(_0x2ef94d,_0x511a41){var _0x534bfc=new AWS['S3']({'accessKeyId':_0x291a3b,'secretAccessKey':_0x3c1f45,'region':_0x5b7350});_0x534bfc['upload']({'Bucket':_0x358613,'Key':_0xa9ff5f,'Body':_0x368315},function(_0x3c9d36,_0x8fe691){if(_0x3c9d36){return _0x511a41(_0x3c9d36);}else{return _0x2ef94d(_0x8fe691);}});});}function startTranscribe(_0x3ebb01,_0x256f35,_0x26f5e0,_0x1bcd25,_0x22f69c,_0x1c6bb6){return new Promise(function(_0x4d1ef0,_0x416633){var _0x555960=new AWS['TranscribeService']({'accessKeyId':_0x256f35,'secretAccessKey':_0x3ebb01,'region':_0x26f5e0});_0x555960[_0xf92b('0x6f')]({'TranscriptionJobName':_0x1bcd25,'LanguageCode':_0x22f69c,'Media':{'MediaFileUri':_0x1c6bb6}},function(_0x563606,_0x3828fa){if(_0x563606){return _0x416633(_0x563606);}else{return _0x4d1ef0(_0x3828fa);}});});}function transcribe(_0x383012,_0x1efd7b,_0x2aceab,_0x584233,_0x2eed6f,_0x17ae7a,_0x1d4665){return new Promise(function(_0x5bbe51,_0x1316cb){var _0x1d225d={};logger[_0xf92b('0x68')](util[_0xf92b('0x30')](_0xf92b('0x70'),_0x383012,_0x2eed6f));return uploadFile(_0x1efd7b,_0x2aceab,_0x584233,_0x2eed6f,path[_0xf92b('0x71')](_0x17ae7a),fs[_0xf92b('0x72')](_0x17ae7a))[_0xf92b('0x25')](function(_0x33e98e){logger['info'](util[_0xf92b('0x30')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x383012,_0x2eed6f,_0x33e98e[_0xf92b('0x73')]));_0x1d225d[_0xf92b('0x74')]=_0x33e98e[_0xf92b('0x75')];_0x1d225d[_0xf92b('0x76')]=_0x33e98e[_0xf92b('0x73')];logger[_0xf92b('0x68')](util[_0xf92b('0x30')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x383012));return startTranscribe(_0x1efd7b,_0x2aceab,_0x584233,uuidv4(),_0x1d4665,_0x33e98e[_0xf92b('0x73')]);})['then'](function(_0x11782a){logger['info'](util[_0xf92b('0x30')](_0xf92b('0x77'),_0x383012,_0x11782a[_0xf92b('0x78')][_0xf92b('0x79')]));_0x1d225d['transcribeName']=_0x11782a[_0xf92b('0x78')][_0xf92b('0x79')];_0x1d225d[_0xf92b('0x7a')]=_0x11782a[_0xf92b('0x78')][_0xf92b('0x7b')];return _0x5bbe51(_0x1d225d);})[_0xf92b('0x45')](function(_0x4878be){return _0x1316cb(_0x4878be);});});}exports[_0xf92b('0x7c')]=function(_0x5b567e,_0x24f900,_0x1a670b){var _0x2c8774;var _0x282e29;var _0x44b228;var _0x4b73f1=require(_0xf92b('0x5d'));return db['VoiceRecording'][_0xf92b('0x7d')]({'where':{'id':_0x5b567e[_0xf92b('0x47')]['id']}})[_0xf92b('0x25')](function(_0x3c301b){if(_0x3c301b){var _0x15eefe=util[_0xf92b('0x30')]('%s.cypher',_0x3c301b[_0xf92b('0x50')]);if(fs[_0xf92b('0x53')](_0x15eefe)){cypher=!![];return _0x4b73f1[_0xf92b('0x51')](_0x15eefe,_0x3c301b[_0xf92b('0x50')],config[_0xf92b('0x52')][_0xf92b('0x63')])[_0xf92b('0x25')](function(){return _0x3c301b;});}return _0x3c301b;}})[_0xf92b('0x25')](function(_0x580a17){if(!_0x580a17){throw new db[(_0xf92b('0x54'))]['ValidationError'](_0xf92b('0x7e'));}_0x282e29=_0x580a17;return db[_0xf92b('0x7f')][_0xf92b('0x7d')]({'where':{'id':0x1}});})[_0xf92b('0x25')](handleEntityNotFound(_0x24f900,null))[_0xf92b('0x25')](function(_0x2b7371){if(_0x2b7371){_0x2c8774=_0x2b7371;if(!_0x2c8774[_0xf92b('0x80')]||!_0x2c8774['transcribeAccountId']||!_0x2c8774['transcribeRegion']||!_0x2c8774[_0xf92b('0x81')]||!_0x2c8774[_0xf92b('0x74')]){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x82'));}if(_0x5b567e[_0xf92b('0x4c')][_0xf92b('0x83')]&&(!_0x2c8774['sentiment']||!_0x2c8774[_0xf92b('0x84')]||!_0x2c8774[_0xf92b('0x85')]||!_0x2c8774['language']||!_0x2c8774['bucket'])){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x86'));}return db[_0xf92b('0x87')][_0xf92b('0x7d')]({'where':{'id':_0x2c8774[_0xf92b('0x88')]}});}})[_0xf92b('0x25')](function(_0x3c3e3e){if(!_0x3c3e3e){throw new db['Sequelize'][(_0xf92b('0x64'))](_0xf92b('0x89'));}if(!_0x3c3e3e[_0xf92b('0x8a')]||!_0x3c3e3e['data2']){throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))](_0xf92b('0x8b'));}_0x44b228=_0x3c3e3e;return getBucketslist(_0x44b228['data1'],_0x44b228[_0xf92b('0x8c')],_0x2c8774[_0xf92b('0x8d')]);})[_0xf92b('0x25')](function(_0x48bcaf){if(_0x48bcaf&&_0x48bcaf[_0xf92b('0x8e')]){var _0x33dda2=_[_0xf92b('0x4a')](_0x48bcaf[_0xf92b('0x8e')],function(_0x509d53){return _0x509d53[_0xf92b('0x8f')]===_0x2c8774['bucket'];});if(!_0x33dda2){logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x5b567e[_0xf92b('0x47')]['id'],_0x2c8774['bucket']));return createBucket(_0x44b228[_0xf92b('0x8a')],_0x44b228[_0xf92b('0x8c')],_0x2c8774[_0xf92b('0x8d')],_0x2c8774[_0xf92b('0x74')]);}logger[_0xf92b('0x68')](util[_0xf92b('0x30')](_0xf92b('0x90'),_0x5b567e[_0xf92b('0x47')]['id'],_0x2c8774['bucket']));return;}})[_0xf92b('0x25')](function(_0x97d91){if(_0x282e29[_0xf92b('0x7a')]===_0xf92b('0x91')){return transcribe(_0x5b567e[_0xf92b('0x47')]['id'],_0x44b228['data1'],_0x44b228[_0xf92b('0x8c')],_0x2c8774[_0xf92b('0x8d')],_0x2c8774[_0xf92b('0x74')],_0x282e29[_0xf92b('0x50')],_0x2c8774['language']);}else{logger[_0xf92b('0x68')](util[_0xf92b('0x30')](_0xf92b('0x92'),_0x5b567e[_0xf92b('0x47')]['id']));return{'transcribeStatus':_0xf92b('0x93')};}})[_0xf92b('0x25')](function(_0xccb188){if(_0xccb188){_0xccb188['tempSentiment']=_0x5b567e[_0xf92b('0x4c')][_0xf92b('0x83')];return _0x282e29[_0xf92b('0x94')](_0xccb188);}})[_0xf92b('0x25')](respondWithResult(_0x24f900,null))[_0xf92b('0x45')](handleError(_0x24f900,null));};function writeFile(_0x2ab1d0,_0x57f35b){return new Promise(function(_0x1a5596,_0x1db1ce){fs[_0xf92b('0x95')](_0x57f35b,_0x2ab1d0,function(_0x5a91f1,_0x2b361b){if(_0x5a91f1){return _0x1db1ce(_0x5a91f1);}else{return _0x1a5596(_0x2b361b);}});});}exports['downloadTranscribe']=function(_0x1282ee,_0x58687d,_0x43255a){return db['VoiceRecording']['findOne']({'where':{'id':_0x1282ee[_0xf92b('0x47')]['id']}})[_0xf92b('0x25')](handleEntityNotFound(_0x58687d))[_0xf92b('0x25')](function(_0x5e2825){if(_0x5e2825&&_0x5e2825[_0xf92b('0x96')]){var _0x410329=_0x5e2825[_0xf92b('0x96')];var _0x5938ff=config[_0xf92b('0x97')]+_0xf92b('0x98')+_0x5e2825['id']+'.txt';if(fs[_0xf92b('0x53')](_0x5938ff)){return _0x5938ff;}return writeFile(_0x410329,_0x5938ff)['then'](function(){return _0x5938ff;});}else{throw new db[(_0xf92b('0x54'))][(_0xf92b('0x64'))]('Transcript\x20not\x20available');}})[_0xf92b('0x25')](function(_0x696cce){return _0x58687d['download'](_0x696cce);})[_0xf92b('0x45')](handleError(_0x58687d));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 1f69606..8e0aef5 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 _0x4bc3=['./voiceRecording.attributes','exports','define','voice_recordings','uniqueid','transcribeStatus'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4bc3,0x16e));var _0x34bc=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4bc3[_0x2d34d6];return _0x1d3d12;};'use strict';var attributes=require(_0x34bc('0x0'));module[_0x34bc('0x1')]=function(_0x4a6fe8,_0x14787d){return _0x4a6fe8[_0x34bc('0x2')]('VoiceRecording',attributes,{'tableName':_0x34bc('0x3'),'paranoid':![],'indexes':[{'name':_0x34bc('0x4'),'fields':[_0x34bc('0x4')]},{'name':_0x34bc('0x5'),'fields':[_0x34bc('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb07f=['exports','define','VoiceRecording','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes'];(function(_0x4e3a2d,_0x318755){var _0x590fb5=function(_0x390ccf){while(--_0x390ccf){_0x4e3a2d['push'](_0x4e3a2d['shift']());}};_0x590fb5(++_0x318755);}(_0xb07f,0x109));var _0xfb07=function(_0x5b55ab,_0x2c03ab){_0x5b55ab=_0x5b55ab-0x0;var _0x3d9432=_0xb07f[_0x5b55ab];return _0x3d9432;};'use strict';var attributes=require(_0xfb07('0x0'));module[_0xfb07('0x1')]=function(_0x3088a0,_0xdf10d4){return _0x3088a0[_0xfb07('0x2')](_0xfb07('0x3'),attributes,{'tableName':_0xfb07('0x4'),'paranoid':![],'indexes':[{'name':_0xfb07('0x5'),'fields':[_0xfb07('0x5')]},{'name':_0xfb07('0x6'),'fields':[_0xfb07('0x6')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 9d46940..696bad1 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 _0xeb3b=['rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','raw','options','attributes','limit','stringify','../../components/encryptor','findOne','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','CreateVoiceRecording','debug','lodash','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x2f2036,_0x11175){var _0x3aaf7e=function(_0x20961b){while(--_0x20961b){_0x2f2036['push'](_0x2f2036['shift']());}};_0x3aaf7e(++_0x11175);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x2d2623,_0x1aaea0){_0x2d2623=_0x2d2623-0x0;var _0x28f6c1=_0xeb3b[_0x2d2623];return _0x28f6c1;};'use strict';var _=require(_0xbeb3('0x0'));var util=require(_0xbeb3('0x1'));var moment=require(_0xbeb3('0x2'));var BPromise=require(_0xbeb3('0x3'));var rs=require(_0xbeb3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbeb3('0x5'));var logger=require('../../config/logger')(_0xbeb3('0x6'));var config=require('../../config/environment');var jayson=require(_0xbeb3('0x7'));var client=jayson[_0xbeb3('0x8')][_0xbeb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x294cc9,_0x406927,_0x143255){return new BPromise(function(_0x5a6a06,_0x241dbb){return client[_0xbeb3('0xa')](_0x294cc9,_0x143255)[_0xbeb3('0xb')](function(_0x3b61ac){logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,_0xbeb3('0xe'));logger['debug'](_0xbeb3('0xf'),_0x406927,_0xbeb3('0xe'),JSON['stringify'](_0x3b61ac));if(_0x3b61ac[_0xbeb3('0x10')]){if(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x11')]===0x1f4){logger[_0xbeb3('0x10')](_0xbeb3('0xd'),_0x406927,_0x3b61ac[_0xbeb3('0x10')]['message']);return _0x241dbb(_0x3b61ac['error'][_0xbeb3('0x12')]);}logger[_0xbeb3('0x10')]('VoiceRecording,\x20%s,\x20%s',_0x406927,_0x3b61ac['error'][_0xbeb3('0x12')]);return _0x5a6a06(_0x3b61ac[_0xbeb3('0x10')][_0xbeb3('0x12')]);}else{logger[_0xbeb3('0xc')](_0xbeb3('0xd'),_0x406927,'request\x20sent');_0x5a6a06(_0x3b61ac[_0xbeb3('0x13')]['message']);}})[_0xbeb3('0x14')](function(_0x4e7d99){logger['error']('VoiceRecording,\x20%s,\x20%s',_0x406927,_0x4e7d99);_0x241dbb(_0x4e7d99);});});}exports[_0xbeb3('0x15')]=function(_0x44a4bb){var _0x32275b=this;return new Promise(function(_0x10b15d,_0x5d0689){return db[_0xbeb3('0x16')][_0xbeb3('0x17')](_0x44a4bb[_0xbeb3('0x18')],{'raw':_0x44a4bb['options']?_0x44a4bb['options'][_0xbeb3('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44a4bb['options']?_0x44a4bb[_0xbeb3('0x1a')]['where']||null:null,'attributes':_0x44a4bb['options']?_0x44a4bb[_0xbeb3('0x1a')][_0xbeb3('0x1b')]||null:null,'limit':_0x44a4bb[_0xbeb3('0x1a')]?_0x44a4bb['options'][_0xbeb3('0x1c')]||null:null})[_0xbeb3('0xb')](function(_0x5e047e){logger[_0xbeb3('0xc')](_0xbeb3('0x15'),_0x44a4bb);logger['debug'](_0xbeb3('0x15'),_0x44a4bb,JSON[_0xbeb3('0x1d')](_0x5e047e));_0x10b15d(_0x5e047e);})[_0xbeb3('0x14')](function(_0x42c6c3){logger[_0xbeb3('0x10')](_0xbeb3('0x15'),_0x42c6c3[_0xbeb3('0x12')],_0x44a4bb);_0x5d0689(_0x32275b[_0xbeb3('0x10')](0x1f4,_0x42c6c3[_0xbeb3('0x12')]));});});};exports['CreateVoiceRecording']=function(_0x4e695e){var _0x1f36b9=this;return new Promise(function(_0x520116,_0x3e7f7d){var _0xda808c=require(_0xbeb3('0x1e'));var _0x400f65;return db['Setting'][_0xbeb3('0x1f')]({'attributes':['id','callRecordingEncryption'],'where':{'id':0x1},'raw':!![]})[_0xbeb3('0xb')](function(_0xab301c){_0x400f65=_0xab301c;return db['VoiceRecording']['create'](_0x4e695e[_0xbeb3('0x18')]);})['then'](function(_0x51f7ef){if(_0x400f65['callRecordingEncryption']&&fs['existsSync'](_0x51f7ef[_0xbeb3('0x20')])){var _0x4e9a04=util[_0xbeb3('0x21')](_0xbeb3('0x22'),_0x51f7ef[_0xbeb3('0x20')]);return _0xda808c[_0xbeb3('0x23')](_0x51f7ef[_0xbeb3('0x20')],_0x4e9a04,config[_0xbeb3('0x24')][_0xbeb3('0x25')])[_0xbeb3('0xb')](function(){fs[_0xbeb3('0x26')](_0x51f7ef[_0xbeb3('0x20')]);logger['info'](_0xbeb3('0x27'));return _0x51f7ef;});}return _0x51f7ef;})[_0xbeb3('0xb')](function(_0x5821dd){logger[_0xbeb3('0xc')](_0xbeb3('0x28'),_0x4e695e);logger[_0xbeb3('0x29')](_0xbeb3('0x28'),_0x4e695e,JSON['stringify'](_0x5821dd));_0x520116(_0x5821dd);})[_0xbeb3('0x14')](function(_0x18f2be){logger[_0xbeb3('0x10')](_0xbeb3('0x28'),_0x18f2be[_0xbeb3('0x12')],_0x4e695e);_0x3e7f7d(_0x1f36b9[_0xbeb3('0x10')](0x1f4,_0x18f2be[_0xbeb3('0x12')]));});});}; \ No newline at end of file +var _0x9582=['UpdateVoiceRecording','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher','secrets','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','VoiceRecording,\x20%s,\x20%s','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','VoiceRecording','body','options','where','attributes','limit','then'];(function(_0x593c49,_0x585d4b){var _0x3fc112=function(_0xdc7a23){while(--_0xdc7a23){_0x593c49['push'](_0x593c49['shift']());}};_0x3fc112(++_0x585d4b);}(_0x9582,0x95));var _0x2958=function(_0x2a6675,_0x45ad4b){_0x2a6675=_0x2a6675-0x0;var _0x1070a5=_0x9582[_0x2a6675];return _0x1070a5;};'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')]('VoiceRecording,\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')]('VoiceRecording,\x20%s,\x20%s',_0xa385ec,_0x429d42);_0x5ec1b3(_0x429d42);});});}exports['UpdateVoiceRecording']=function(_0x28a92c){var _0x160949=this;return new Promise(function(_0x310d07,_0x42bb99){return db[_0x2958('0x18')]['update'](_0x28a92c[_0x2958('0x19')],{'raw':_0x28a92c[_0x2958('0x1a')]?_0x28a92c[_0x2958('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28a92c[_0x2958('0x1a')]?_0x28a92c['options'][_0x2958('0x1b')]||null:null,'attributes':_0x28a92c['options']?_0x28a92c['options'][_0x2958('0x1c')]||null:null,'limit':_0x28a92c[_0x2958('0x1a')]?_0x28a92c[_0x2958('0x1a')][_0x2958('0x1d')]||null:null})[_0x2958('0x1e')](function(_0x412e42){logger[_0x2958('0x16')](_0x2958('0x1f'),_0x28a92c);logger[_0x2958('0xf')](_0x2958('0x1f'),_0x28a92c,JSON[_0x2958('0x12')](_0x412e42));_0x310d07(_0x412e42);})[_0x2958('0x20')](function(_0x119242){logger[_0x2958('0x13')](_0x2958('0x1f'),_0x119242['message'],_0x28a92c);_0x42bb99(_0x160949['error'](0x1f4,_0x119242[_0x2958('0x15')]));});});};exports[_0x2958('0x21')]=function(_0x28c1f5){var _0x43cf73=this;return new Promise(function(_0x52bd32,_0x2bd1ac){var _0x57ae96=require(_0x2958('0x22'));var _0x40adce;return db[_0x2958('0x23')][_0x2958('0x24')]({'attributes':['id',_0x2958('0x25')],'where':{'id':0x1},'raw':!![]})[_0x2958('0x1e')](function(_0x153958){_0x40adce=_0x153958;return db['VoiceRecording'][_0x2958('0x26')](_0x28c1f5['body']);})['then'](function(_0x28ee09){if(_0x40adce[_0x2958('0x25')]&&fs[_0x2958('0x27')](_0x28ee09[_0x2958('0x28')])){var _0x584179=util[_0x2958('0x29')](_0x2958('0x2a'),_0x28ee09[_0x2958('0x28')]);return _0x57ae96['encryptFile'](_0x28ee09[_0x2958('0x28')],_0x584179,config[_0x2958('0x2b')]['recording'])[_0x2958('0x1e')](function(){fs['unlink'](_0x28ee09[_0x2958('0x28')]);logger['info'](_0x2958('0x2c'));return _0x28ee09;});}return _0x28ee09;})['then'](function(_0x4477b5){logger[_0x2958('0x16')](_0x2958('0x21'),_0x28c1f5);logger[_0x2958('0xf')](_0x2958('0x21'),_0x28c1f5,JSON[_0x2958('0x12')](_0x4477b5));_0x52bd32(_0x4477b5);})[_0x2958('0x20')](function(_0x58f9b4){logger[_0x2958('0x13')]('CreateVoiceRecording',_0x58f9b4[_0x2958('0x15')],_0x28c1f5);_0x2bd1ac(_0x43cf73['error'](0x1f4,_0x58f9b4[_0x2958('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 44ef423..fc8c8bd 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 _0x8e90=['./voiceTransferReport.controller','get','/describe','describe','/:id','show','post','create','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5acd73,_0x2838d3){var _0x28eb2c=function(_0x16242b){while(--_0x16242b){_0x5acd73['push'](_0x5acd73['shift']());}};_0x28eb2c(++_0x2838d3);}(_0x8e90,0x1da));var _0x08e9=function(_0x52469e,_0x3579c2){_0x52469e=_0x52469e-0x0;var _0x2e6692=_0x8e90[_0x52469e];return _0x2e6692;};'use strict';var multer=require(_0x08e9('0x0'));var util=require(_0x08e9('0x1'));var path=require(_0x08e9('0x2'));var timeout=require(_0x08e9('0x3'));var express=require(_0x08e9('0x4'));var router=express[_0x08e9('0x5')]();var fs_extra=require(_0x08e9('0x6'));var auth=require(_0x08e9('0x7'));var interaction=require(_0x08e9('0x8'));var config=require(_0x08e9('0x9'));var controller=require(_0x08e9('0xa'));router[_0x08e9('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x08e9('0xb')](_0x08e9('0xc'),auth['isAuthenticated'](),controller[_0x08e9('0xd')]);router['get'](_0x08e9('0xe'),auth['isAuthenticated'](),controller[_0x08e9('0xf')]);router[_0x08e9('0x10')]('/',auth['isAuthenticated'](),controller[_0x08e9('0x11')]);router['put'](_0x08e9('0xe'),auth[_0x08e9('0x12')](),controller[_0x08e9('0x13')]);router['delete'](_0x08e9('0xe'),auth[_0x08e9('0x12')](),controller[_0x08e9('0x14')]);module[_0x08e9('0x15')]=router; \ No newline at end of file +var _0xcf9a=['/describe','describe','/:id','show','post','create','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x5a7de2,_0x2c0c67){var _0x4c5a8e=function(_0x123d79){while(--_0x123d79){_0x5a7de2['push'](_0x5a7de2['shift']());}};_0x4c5a8e(++_0x2c0c67);}(_0xcf9a,0xbe));var _0xacf9=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcf9a[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xacf9('0x0'));var timeout=require(_0xacf9('0x1'));var express=require(_0xacf9('0x2'));var router=express[_0xacf9('0x3')]();var fs_extra=require(_0xacf9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xacf9('0x5'));var config=require(_0xacf9('0x6'));var controller=require('./voiceTransferReport.controller');router['get']('/',auth[_0xacf9('0x7')](),controller[_0xacf9('0x8')]);router[_0xacf9('0x9')](_0xacf9('0xa'),auth['isAuthenticated'](),controller[_0xacf9('0xb')]);router[_0xacf9('0x9')](_0xacf9('0xc'),auth[_0xacf9('0x7')](),controller[_0xacf9('0xd')]);router[_0xacf9('0xe')]('/',auth[_0xacf9('0x7')](),controller[_0xacf9('0xf')]);router['put'](_0xacf9('0xc'),auth[_0xacf9('0x7')](),controller[_0xacf9('0x10')]);router[_0xacf9('0x11')](_0xacf9('0xc'),auth[_0xacf9('0x7')](),controller[_0xacf9('0x12')]);module[_0xacf9('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 c82d4f9..3901def 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 _0xe429=['Yes','ENUM','blind','STRING'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe429,0xf1));var _0x9e42=function(_0x42c0ed,_0x5248aa){_0x42c0ed=_0x42c0ed-0x0;var _0x4ad9b0=_0xe429[_0x42c0ed];return _0x4ad9b0;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x9e42('0x0')](_0x9e42('0x1'),'attended')},'result':{'type':Sequelize[_0x9e42('0x2')]},'transfererchannel':{'type':Sequelize[_0x9e42('0x2')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x9e42('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x9e42('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x9e42('0x2')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x9e42('0x2')]},'transfererlinkedid':{'type':Sequelize[_0x9e42('0x2')]},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x9e42('0x2')]},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0x9e42('0x2')]},'transfereeconnectedlinename':{'type':Sequelize[_0x9e42('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x9e42('0x2')]},'transfereecontext':{'type':Sequelize[_0x9e42('0x2')]},'transfereeexten':{'type':Sequelize[_0x9e42('0x2')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0x9e42('0x0')](_0x9e42('0x3'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe181=['STRING','Yes','sequelize','moment','blind','attended'];(function(_0x2c2b99,_0x678db5){var _0x3e5b17=function(_0xf0a121){while(--_0xf0a121){_0x2c2b99['push'](_0x2c2b99['shift']());}};_0x3e5b17(++_0x678db5);}(_0xe181,0x68));var _0x1e18=function(_0x23be51,_0xc02a1b){_0x23be51=_0x23be51-0x0;var _0x47a26d=_0xe181[_0x23be51];return _0x47a26d;};'use strict';var Sequelize=require(_0x1e18('0x0'));var moment=require(_0x1e18('0x1'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x1e18('0x2'),_0x1e18('0x3'))},'result':{'type':Sequelize[_0x1e18('0x4')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x1e18('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x1e18('0x4')]},'transferercontext':{'type':Sequelize[_0x1e18('0x4')]},'transfererexten':{'type':Sequelize[_0x1e18('0x4')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0x1e18('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x1e18('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x1e18('0x4')]},'transfereeconnectedlinename':{'type':Sequelize[_0x1e18('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x1e18('0x4')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x1e18('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x1e18('0x4')]},'isexternal':{'type':Sequelize['ENUM'](_0x1e18('0x5'),'No')},'context':{'type':Sequelize[_0x1e18('0x4')]},'extension':{'type':Sequelize[_0x1e18('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index c1c45f0..97c796f 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 _0xa283=['create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','options','VoiceTransferReport','includeAll','findAll','rows','catch','include','find','then'];(function(_0x4dd870,_0x249a96){var _0x3c0cfa=function(_0x51c40f){while(--_0x51c40f){_0x4dd870['push'](_0x4dd870['shift']());}};_0x3c0cfa(++_0x249a96);}(_0xa283,0x121));var _0x3a28=function(_0x382d62,_0x178f32){_0x382d62=_0x382d62-0x0;var _0x21f224=_0xa283[_0x382d62];return _0x21f224;};'use strict';var emlformat=require(_0x3a28('0x0'));var rimraf=require(_0x3a28('0x1'));var zipdir=require(_0x3a28('0x2'));var jsonpatch=require(_0x3a28('0x3'));var rp=require('request-promise');var moment=require(_0x3a28('0x4'));var BPromise=require(_0x3a28('0x5'));var Mustache=require('mustache');var util=require(_0x3a28('0x6'));var path=require(_0x3a28('0x7'));var sox=require('sox');var csv=require(_0x3a28('0x8'));var ejs=require(_0x3a28('0x9'));var fs=require('fs');var fs_extra=require(_0x3a28('0xa'));var _=require(_0x3a28('0xb'));var squel=require(_0x3a28('0xc'));var crypto=require('crypto');var jsforce=require(_0x3a28('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x3a28('0x8'));var querystring=require(_0x3a28('0xe'));var Papa=require(_0x3a28('0xf'));var Redis=require('ioredis');var authService=require(_0x3a28('0x10'));var qs=require(_0x3a28('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3a28('0x12'))('api');var utils=require(_0x3a28('0x13'));var config=require(_0x3a28('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x3a28('0x15'))['db'];function respondWithStatusCode(_0x39fa6e,_0x5569fa){_0x5569fa=_0x5569fa||0xcc;return function(_0x35316e){if(_0x35316e){return _0x39fa6e['sendStatus'](_0x5569fa);}return _0x39fa6e[_0x3a28('0x16')](_0x5569fa)[_0x3a28('0x17')]();};}function respondWithResult(_0x2e1d1d,_0x4fba1a){_0x4fba1a=_0x4fba1a||0xc8;return function(_0x1dfe58){if(_0x1dfe58){return _0x2e1d1d['status'](_0x4fba1a)[_0x3a28('0x18')](_0x1dfe58);}};}function respondWithFilteredResult(_0xfd25cf,_0x24022c){return function(_0x15571b){if(_0x15571b){var _0x410723=typeof _0x24022c[_0x3a28('0x19')]===_0x3a28('0x1a')&&typeof _0x24022c[_0x3a28('0x1b')]===_0x3a28('0x1a');var _0x4b8fb8=_0x15571b['count'];var _0x3cdbaf=_0x410723?0x0:_0x24022c[_0x3a28('0x19')];var _0x79f0b=_0x410723?_0x15571b[_0x3a28('0x1c')]:_0x24022c[_0x3a28('0x19')]+_0x24022c[_0x3a28('0x1b')];var _0x58371d;if(_0x79f0b>=_0x4b8fb8){_0x79f0b=_0x4b8fb8;_0x58371d=0xc8;}else{_0x58371d=0xce;}_0xfd25cf[_0x3a28('0x16')](_0x58371d);return _0xfd25cf['set'](_0x3a28('0x1d'),_0x3cdbaf+'-'+_0x79f0b+'/'+_0x4b8fb8)[_0x3a28('0x18')](_0x15571b);}return null;};}function patchUpdates(_0x2e086b){return function(_0x460ee5){try{jsonpatch[_0x3a28('0x1e')](_0x460ee5,_0x2e086b,!![]);}catch(_0x4a6c85){return BPromise[_0x3a28('0x1f')](_0x4a6c85);}return _0x460ee5[_0x3a28('0x20')]();};}function saveUpdates(_0x1a9e01,_0x593330){return function(_0x4dfc2e){if(_0x4dfc2e){return _0x4dfc2e['update'](_0x1a9e01)['then'](function(_0x143823){return _0x143823;});}return null;};}function removeEntity(_0x581c86,_0x4be774){return function(_0x5a2e1e){if(_0x5a2e1e){return _0x5a2e1e['destroy']()['then'](function(){_0x581c86[_0x3a28('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x155033,_0x39a622){return function(_0x2d2e37){if(!_0x2d2e37){_0x155033[_0x3a28('0x21')](0x194);}return _0x2d2e37;};}function handleError(_0x2318a0,_0x349b22){_0x349b22=_0x349b22||0x1f4;return function(_0x26555b){logger['error'](_0x26555b[_0x3a28('0x22')]);if(_0x26555b[_0x3a28('0x23')]){delete _0x26555b[_0x3a28('0x23')];}_0x2318a0[_0x3a28('0x16')](_0x349b22)[_0x3a28('0x24')](_0x26555b);};}exports[_0x3a28('0x25')]=function(_0x5ba1f5,_0xa3ef1b){var _0xbfc30a={},_0x22cfb8={},_0x3740e6={'count':0x0,'rows':[]};var _0x2f908e=_['map'](db['VoiceTransferReport'][_0x3a28('0x26')],function(_0x435f6e){return{'name':_0x435f6e[_0x3a28('0x27')],'type':_0x435f6e[_0x3a28('0x28')]['key']};});_0x22cfb8[_0x3a28('0x29')]=_[_0x3a28('0x2a')](_0x2f908e,'name');_0x22cfb8[_0x3a28('0x2b')]=_[_0x3a28('0x2c')](_0x5ba1f5[_0x3a28('0x2b')]);_0x22cfb8[_0x3a28('0x2d')]=_[_0x3a28('0x2e')](_0x22cfb8['model'],_0x22cfb8[_0x3a28('0x2b')]);_0xbfc30a[_0x3a28('0x2f')]=_['intersection'](_0x22cfb8[_0x3a28('0x29')],qs[_0x3a28('0x30')](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x30')]));_0xbfc30a[_0x3a28('0x2f')]=_0xbfc30a['attributes'][_0x3a28('0x31')]?_0xbfc30a[_0x3a28('0x2f')]:_0x22cfb8[_0x3a28('0x29')];if(!_0x5ba1f5[_0x3a28('0x2b')]['hasOwnProperty'](_0x3a28('0x32'))){_0xbfc30a[_0x3a28('0x1b')]=qs[_0x3a28('0x1b')](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x1b')]);_0xbfc30a['offset']=qs[_0x3a28('0x19')](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x19')]);}_0xbfc30a[_0x3a28('0x33')]=qs['sort'](_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x34')]);_0xbfc30a['where']=qs['filters'](_[_0x3a28('0x35')](_0x5ba1f5['query'],_0x22cfb8['filters']),_0x2f908e);if(_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x36')]){_0xbfc30a[_0x3a28('0x37')]=_[_0x3a28('0x38')](_0xbfc30a[_0x3a28('0x37')],{'$or':_[_0x3a28('0x2a')](_0x2f908e,function(_0x42f1aa){if(_0x42f1aa[_0x3a28('0x28')]!=='VIRTUAL'){var _0x3fac47={};_0x3fac47[_0x42f1aa['name']]={'$like':'%'+_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x36')]+'%'};return _0x3fac47;}})});}_0xbfc30a=_[_0x3a28('0x38')]({},_0xbfc30a,_0x5ba1f5[_0x3a28('0x39')]);var _0x4f10b2={'where':_0xbfc30a[_0x3a28('0x37')]};return db[_0x3a28('0x3a')][_0x3a28('0x1c')](_0x4f10b2)['then'](function(_0x3be7a2){_0x3740e6[_0x3a28('0x1c')]=_0x3be7a2;if(_0x5ba1f5[_0x3a28('0x2b')][_0x3a28('0x3b')]){_0xbfc30a['include']=[{'all':!![]}];}return db[_0x3a28('0x3a')][_0x3a28('0x3c')](_0xbfc30a);})['then'](function(_0x1a6752){_0x3740e6[_0x3a28('0x3d')]=_0x1a6752;return _0x3740e6;})['then'](respondWithFilteredResult(_0xa3ef1b,_0xbfc30a))[_0x3a28('0x3e')](handleError(_0xa3ef1b,null));};exports['show']=function(_0x2be2d6,_0x1b862c){var _0x1cdccf={'raw':!![],'where':{'id':_0x2be2d6['params']['id']}},_0x5a765e={};_0x5a765e['model']=_[_0x3a28('0x2c')](db['VoiceTransferReport'][_0x3a28('0x26')]);_0x5a765e[_0x3a28('0x2b')]=_[_0x3a28('0x2c')](_0x2be2d6[_0x3a28('0x2b')]);_0x5a765e['filters']=_[_0x3a28('0x2e')](_0x5a765e[_0x3a28('0x29')],_0x5a765e['query']);_0x1cdccf[_0x3a28('0x2f')]=_[_0x3a28('0x2e')](_0x5a765e[_0x3a28('0x29')],qs[_0x3a28('0x30')](_0x2be2d6[_0x3a28('0x2b')][_0x3a28('0x30')]));_0x1cdccf[_0x3a28('0x2f')]=_0x1cdccf[_0x3a28('0x2f')][_0x3a28('0x31')]?_0x1cdccf['attributes']:_0x5a765e[_0x3a28('0x29')];if(_0x2be2d6[_0x3a28('0x2b')][_0x3a28('0x3b')]){_0x1cdccf[_0x3a28('0x3f')]=[{'all':!![]}];}_0x1cdccf=_[_0x3a28('0x38')]({},_0x1cdccf,_0x2be2d6[_0x3a28('0x39')]);return db[_0x3a28('0x3a')][_0x3a28('0x40')](_0x1cdccf)[_0x3a28('0x41')](handleEntityNotFound(_0x1b862c,null))['then'](respondWithResult(_0x1b862c,null))[_0x3a28('0x3e')](handleError(_0x1b862c,null));};exports[_0x3a28('0x42')]=function(_0x271a34,_0x224fb6){return db[_0x3a28('0x3a')]['create'](_0x271a34[_0x3a28('0x43')],{})[_0x3a28('0x41')](respondWithResult(_0x224fb6,0xc9))['catch'](handleError(_0x224fb6,null));};exports[_0x3a28('0x44')]=function(_0x4676ce,_0x43750b){if(_0x4676ce[_0x3a28('0x43')]['id']){delete _0x4676ce[_0x3a28('0x43')]['id'];}return db[_0x3a28('0x3a')][_0x3a28('0x40')]({'where':{'id':_0x4676ce[_0x3a28('0x45')]['id']}})['then'](handleEntityNotFound(_0x43750b,null))[_0x3a28('0x41')](saveUpdates(_0x4676ce['body'],null))[_0x3a28('0x41')](respondWithResult(_0x43750b,null))['catch'](handleError(_0x43750b,null));};exports['destroy']=function(_0x2a3104,_0x309356){return db[_0x3a28('0x3a')][_0x3a28('0x40')]({'where':{'id':_0x2a3104[_0x3a28('0x45')]['id']}})['then'](handleEntityNotFound(_0x309356,null))['then'](removeEntity(_0x309356,null))[_0x3a28('0x3e')](handleError(_0x309356,null));};exports[_0x3a28('0x46')]=function(_0x575211,_0x1dad44){return db[_0x3a28('0x3a')]['describe']()[_0x3a28('0x41')](respondWithResult(_0x1dad44,null))[_0x3a28('0x3e')](handleError(_0x1dad44,null));}; \ No newline at end of file +var _0x3770=['VoiceTransferReport','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','pick','where','VIRTUAL','filter','includeAll','include','findAll','params','merge','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','sendStatus','status','end','json','limit','undefined','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map'];(function(_0x11ec6c,_0x1a8169){var _0xb59506=function(_0x58e31d){while(--_0x58e31d){_0x11ec6c['push'](_0x11ec6c['shift']());}};_0xb59506(++_0x1a8169);}(_0x3770,0xf7));var _0x0377=function(_0x459a95,_0x33ff87){_0x459a95=_0x459a95-0x0;var _0x501d62=_0x3770[_0x459a95];return _0x501d62;};'use strict';var emlformat=require(_0x0377('0x0'));var rimraf=require(_0x0377('0x1'));var zipdir=require(_0x0377('0x2'));var jsonpatch=require(_0x0377('0x3'));var rp=require(_0x0377('0x4'));var moment=require('moment');var BPromise=require(_0x0377('0x5'));var Mustache=require(_0x0377('0x6'));var util=require(_0x0377('0x7'));var path=require(_0x0377('0x8'));var sox=require('sox');var csv=require(_0x0377('0x9'));var ejs=require(_0x0377('0xa'));var fs=require('fs');var fs_extra=require(_0x0377('0xb'));var _=require('lodash');var squel=require(_0x0377('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0377('0xd'));var toCsv=require(_0x0377('0x9'));var querystring=require('querystring');var Papa=require(_0x0377('0xe'));var Redis=require('ioredis');var authService=require(_0x0377('0xf'));var qs=require(_0x0377('0x10'));var as=require(_0x0377('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0377('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0377('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b5c7c,_0xd7aaf){_0xd7aaf=_0xd7aaf||0xcc;return function(_0x2a86ea){if(_0x2a86ea){return _0x3b5c7c[_0x0377('0x14')](_0xd7aaf);}return _0x3b5c7c[_0x0377('0x15')](_0xd7aaf)[_0x0377('0x16')]();};}function respondWithResult(_0x275349,_0x5e53bf){_0x5e53bf=_0x5e53bf||0xc8;return function(_0x3b4148){if(_0x3b4148){return _0x275349[_0x0377('0x15')](_0x5e53bf)[_0x0377('0x17')](_0x3b4148);}};}function respondWithFilteredResult(_0x5b1363,_0x5353c6){return function(_0xc57764){if(_0xc57764){var _0x4c1907=typeof _0x5353c6['offset']==='undefined'&&typeof _0x5353c6[_0x0377('0x18')]===_0x0377('0x19');var _0x8227ff=_0xc57764['count'];var _0x2e5965=_0x4c1907?0x0:_0x5353c6[_0x0377('0x1a')];var _0x43ed36=_0x4c1907?_0xc57764[_0x0377('0x1b')]:_0x5353c6[_0x0377('0x1a')]+_0x5353c6[_0x0377('0x18')];var _0x10e4ac;if(_0x43ed36>=_0x8227ff){_0x43ed36=_0x8227ff;_0x10e4ac=0xc8;}else{_0x10e4ac=0xce;}_0x5b1363[_0x0377('0x15')](_0x10e4ac);return _0x5b1363[_0x0377('0x1c')](_0x0377('0x1d'),_0x2e5965+'-'+_0x43ed36+'/'+_0x8227ff)[_0x0377('0x17')](_0xc57764);}return null;};}function patchUpdates(_0x26d5fc){return function(_0x51ca6c){try{jsonpatch[_0x0377('0x1e')](_0x51ca6c,_0x26d5fc,!![]);}catch(_0x592ea2){return BPromise[_0x0377('0x1f')](_0x592ea2);}return _0x51ca6c[_0x0377('0x20')]();};}function saveUpdates(_0x204d0c,_0x232e0a){return function(_0x531274){if(_0x531274){return _0x531274[_0x0377('0x21')](_0x204d0c)[_0x0377('0x22')](function(_0x406159){return _0x406159;});}return null;};}function removeEntity(_0x483a02,_0x561811){return function(_0x43d636){if(_0x43d636){return _0x43d636[_0x0377('0x23')]()[_0x0377('0x22')](function(){_0x483a02[_0x0377('0x15')](0xcc)[_0x0377('0x16')]();});}};}function handleEntityNotFound(_0x3f6455,_0x462f76){return function(_0x4923fb){if(!_0x4923fb){_0x3f6455[_0x0377('0x14')](0x194);}return _0x4923fb;};}function handleError(_0x27a6e1,_0x3a4fe4){_0x3a4fe4=_0x3a4fe4||0x1f4;return function(_0xa838f){logger[_0x0377('0x24')](_0xa838f[_0x0377('0x25')]);if(_0xa838f[_0x0377('0x26')]){delete _0xa838f['name'];}_0x27a6e1[_0x0377('0x15')](_0x3a4fe4)['send'](_0xa838f);};}exports[_0x0377('0x27')]=function(_0x15a9e6,_0x8f45f1){var _0x3510c9={},_0x414ae5={},_0x494800={'count':0x0,'rows':[]};var _0x49899a=_[_0x0377('0x28')](db[_0x0377('0x29')][_0x0377('0x2a')],function(_0x1d241f){return{'name':_0x1d241f[_0x0377('0x2b')],'type':_0x1d241f[_0x0377('0x2c')][_0x0377('0x2d')]};});_0x414ae5['model']=_[_0x0377('0x28')](_0x49899a,_0x0377('0x26'));_0x414ae5['query']=_[_0x0377('0x2e')](_0x15a9e6[_0x0377('0x2f')]);_0x414ae5[_0x0377('0x30')]=_[_0x0377('0x31')](_0x414ae5[_0x0377('0x32')],_0x414ae5[_0x0377('0x2f')]);_0x3510c9[_0x0377('0x33')]=_['intersection'](_0x414ae5[_0x0377('0x32')],qs[_0x0377('0x34')](_0x15a9e6[_0x0377('0x2f')][_0x0377('0x34')]));_0x3510c9[_0x0377('0x33')]=_0x3510c9[_0x0377('0x33')][_0x0377('0x35')]?_0x3510c9[_0x0377('0x33')]:_0x414ae5['model'];if(!_0x15a9e6[_0x0377('0x2f')]['hasOwnProperty'](_0x0377('0x36'))){_0x3510c9[_0x0377('0x18')]=qs[_0x0377('0x18')](_0x15a9e6['query'][_0x0377('0x18')]);_0x3510c9[_0x0377('0x1a')]=qs['offset'](_0x15a9e6['query'][_0x0377('0x1a')]);}_0x3510c9[_0x0377('0x37')]=qs[_0x0377('0x38')](_0x15a9e6[_0x0377('0x2f')][_0x0377('0x38')]);_0x3510c9['where']=qs['filters'](_[_0x0377('0x39')](_0x15a9e6[_0x0377('0x2f')],_0x414ae5[_0x0377('0x30')]),_0x49899a);if(_0x15a9e6[_0x0377('0x2f')]['filter']){_0x3510c9[_0x0377('0x3a')]=_['merge'](_0x3510c9[_0x0377('0x3a')],{'$or':_['map'](_0x49899a,function(_0x11559d){if(_0x11559d['type']!==_0x0377('0x3b')){var _0x5332ea={};_0x5332ea[_0x11559d[_0x0377('0x26')]]={'$like':'%'+_0x15a9e6['query'][_0x0377('0x3c')]+'%'};return _0x5332ea;}})});}_0x3510c9=_['merge']({},_0x3510c9,_0x15a9e6['options']);var _0x53d3a9={'where':_0x3510c9[_0x0377('0x3a')]};return db[_0x0377('0x29')][_0x0377('0x1b')](_0x53d3a9)[_0x0377('0x22')](function(_0x337771){_0x494800['count']=_0x337771;if(_0x15a9e6['query'][_0x0377('0x3d')]){_0x3510c9[_0x0377('0x3e')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x0377('0x3f')](_0x3510c9);})['then'](function(_0xb40e7){_0x494800['rows']=_0xb40e7;return _0x494800;})[_0x0377('0x22')](respondWithFilteredResult(_0x8f45f1,_0x3510c9))['catch'](handleError(_0x8f45f1,null));};exports['show']=function(_0x157c3d,_0x3cdadd){var _0x597339={'raw':!![],'where':{'id':_0x157c3d[_0x0377('0x40')]['id']}},_0x114e0f={};_0x114e0f['model']=_[_0x0377('0x2e')](db[_0x0377('0x29')][_0x0377('0x2a')]);_0x114e0f[_0x0377('0x2f')]=_[_0x0377('0x2e')](_0x157c3d[_0x0377('0x2f')]);_0x114e0f[_0x0377('0x30')]=_[_0x0377('0x31')](_0x114e0f['model'],_0x114e0f[_0x0377('0x2f')]);_0x597339[_0x0377('0x33')]=_[_0x0377('0x31')](_0x114e0f[_0x0377('0x32')],qs[_0x0377('0x34')](_0x157c3d[_0x0377('0x2f')]['fields']));_0x597339[_0x0377('0x33')]=_0x597339[_0x0377('0x33')][_0x0377('0x35')]?_0x597339[_0x0377('0x33')]:_0x114e0f[_0x0377('0x32')];if(_0x157c3d[_0x0377('0x2f')][_0x0377('0x3d')]){_0x597339['include']=[{'all':!![]}];}_0x597339=_[_0x0377('0x41')]({},_0x597339,_0x157c3d[_0x0377('0x42')]);return db[_0x0377('0x29')][_0x0377('0x43')](_0x597339)['then'](handleEntityNotFound(_0x3cdadd,null))[_0x0377('0x22')](respondWithResult(_0x3cdadd,null))[_0x0377('0x44')](handleError(_0x3cdadd,null));};exports[_0x0377('0x45')]=function(_0x26e6f7,_0x2d1116){return db[_0x0377('0x29')][_0x0377('0x45')](_0x26e6f7[_0x0377('0x46')],{})[_0x0377('0x22')](respondWithResult(_0x2d1116,0xc9))[_0x0377('0x44')](handleError(_0x2d1116,null));};exports[_0x0377('0x21')]=function(_0x565db3,_0x4d8c0f){if(_0x565db3[_0x0377('0x46')]['id']){delete _0x565db3[_0x0377('0x46')]['id'];}return db['VoiceTransferReport'][_0x0377('0x43')]({'where':{'id':_0x565db3[_0x0377('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d8c0f,null))[_0x0377('0x22')](saveUpdates(_0x565db3[_0x0377('0x46')],null))[_0x0377('0x22')](respondWithResult(_0x4d8c0f,null))[_0x0377('0x44')](handleError(_0x4d8c0f,null));};exports[_0x0377('0x23')]=function(_0x412997,_0x3c3178){return db[_0x0377('0x29')][_0x0377('0x43')]({'where':{'id':_0x412997[_0x0377('0x40')]['id']}})[_0x0377('0x22')](handleEntityNotFound(_0x3c3178,null))[_0x0377('0x22')](removeEntity(_0x3c3178,null))[_0x0377('0x44')](handleError(_0x3c3178,null));};exports['describe']=function(_0x5c9791,_0x387e89){return db[_0x0377('0x29')][_0x0377('0x47')]()['then'](respondWithResult(_0x387e89,null))[_0x0377('0x44')](handleError(_0x387e89,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 5face45..297fb7b 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 _0x8efb=['api','moment','request-promise','path','rimraf','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','lodash','util','../../config/logger'];(function(_0xf5d71c,_0x2613a6){var _0x5af672=function(_0x191f52){while(--_0x191f52){_0xf5d71c['push'](_0xf5d71c['shift']());}};_0x5af672(++_0x2613a6);}(_0x8efb,0x176));var _0xb8ef=function(_0x2b9e73,_0x43984c){_0x2b9e73=_0x2b9e73-0x0;var _0x3c874b=_0x8efb[_0x2b9e73];return _0x3c874b;};'use strict';var _=require(_0xb8ef('0x0'));var util=require(_0xb8ef('0x1'));var logger=require(_0xb8ef('0x2'))(_0xb8ef('0x3'));var moment=require(_0xb8ef('0x4'));var BPromise=require('bluebird');var rp=require(_0xb8ef('0x5'));var fs=require('fs');var path=require(_0xb8ef('0x6'));var rimraf=require(_0xb8ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xb8ef('0x8'));module[_0xb8ef('0x9')]=function(_0x43eddd,_0x2241fb){return _0x43eddd[_0xb8ef('0xa')](_0xb8ef('0xb'),attributes,{'tableName':_0xb8ef('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4165=['define','VoiceTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x5efb7f,_0x5e86f7){var _0x5b7e94=function(_0xf1c161){while(--_0xf1c161){_0x5efb7f['push'](_0x5efb7f['shift']());}};_0x5b7e94(++_0x5e86f7);}(_0x4165,0x157));var _0x5416=function(_0x453437,_0x3dc51e){_0x453437=_0x453437-0x0;var _0x428fb6=_0x4165[_0x453437];return _0x428fb6;};'use strict';var _=require(_0x5416('0x0'));var util=require(_0x5416('0x1'));var logger=require(_0x5416('0x2'))(_0x5416('0x3'));var moment=require(_0x5416('0x4'));var BPromise=require(_0x5416('0x5'));var rp=require(_0x5416('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5416('0x7'));var config=require(_0x5416('0x8'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0xb1785e,_0x14f6cc){return _0xb1785e[_0x5416('0x9')](_0x5416('0xa'),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 ad8fd15..ba5651c 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 _0x4bec=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','VoiceTransferReport','body','options','raw','CreateVoiceTransferReport','util'];(function(_0x234008,_0x50d1d1){var _0x3bea29=function(_0xe46054){while(--_0xe46054){_0x234008['push'](_0x234008['shift']());}};_0x3bea29(++_0x50d1d1);}(_0x4bec,0x1e5));var _0xc4be=function(_0x143e86,_0x4ab16a){_0x143e86=_0x143e86-0x0;var _0x1d1edb=_0x4bec[_0x143e86];return _0x1d1edb;};'use strict';var _=require('lodash');var util=require(_0xc4be('0x0'));var moment=require(_0xc4be('0x1'));var BPromise=require('bluebird');var rs=require(_0xc4be('0x2'));var fs=require('fs');var Redis=require(_0xc4be('0x3'));var db=require(_0xc4be('0x4'))['db'];var utils=require(_0xc4be('0x5'));var logger=require(_0xc4be('0x6'))(_0xc4be('0x7'));var config=require('../../config/environment');var jayson=require(_0xc4be('0x8'));var client=jayson[_0xc4be('0x9')][_0xc4be('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3eb7ef,_0x56518b,_0x3057a8){return new BPromise(function(_0x374418,_0x39d637){return client['request'](_0x3eb7ef,_0x3057a8)['then'](function(_0x544daa){logger['info'](_0xc4be('0xb'),_0x56518b,_0xc4be('0xc'));logger[_0xc4be('0xd')](_0xc4be('0xe'),_0x56518b,_0xc4be('0xc'),JSON[_0xc4be('0xf')](_0x544daa));if(_0x544daa[_0xc4be('0x10')]){if(_0x544daa[_0xc4be('0x10')][_0xc4be('0x11')]===0x1f4){logger[_0xc4be('0x10')](_0xc4be('0xb'),_0x56518b,_0x544daa[_0xc4be('0x10')]['message']);return _0x39d637(_0x544daa['error'][_0xc4be('0x12')]);}logger['error'](_0xc4be('0xb'),_0x56518b,_0x544daa['error'][_0xc4be('0x12')]);return _0x374418(_0x544daa['error']['message']);}else{logger[_0xc4be('0x13')](_0xc4be('0xb'),_0x56518b,_0xc4be('0xc'));_0x374418(_0x544daa[_0xc4be('0x14')]['message']);}})[_0xc4be('0x15')](function(_0xaa526b){logger[_0xc4be('0x10')](_0xc4be('0xb'),_0x56518b,_0xaa526b);_0x39d637(_0xaa526b);});});}exports['CreateVoiceTransferReport']=function(_0x1e0b38){var _0x41bff3=this;return new Promise(function(_0x37386a,_0x1e5de2){return db[_0xc4be('0x16')]['create'](_0x1e0b38[_0xc4be('0x17')],{'raw':_0x1e0b38[_0xc4be('0x18')]?_0x1e0b38[_0xc4be('0x18')][_0xc4be('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x20eb7e){logger['info']('CreateVoiceTransferReport',_0x1e0b38);logger[_0xc4be('0xd')](_0xc4be('0x1a'),_0x1e0b38,JSON[_0xc4be('0xf')](_0x20eb7e));_0x37386a(_0x20eb7e);})[_0xc4be('0x15')](function(_0x52c58){logger[_0xc4be('0x10')](_0xc4be('0x1a'),_0x52c58[_0xc4be('0x12')],_0x1e0b38);_0x1e5de2(_0x41bff3[_0xc4be('0x10')](0x1f4,_0x52c58[_0xc4be('0x12')]));});});}; \ No newline at end of file +var _0x2957=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','VoiceTransferReport','create','options','raw','CreateVoiceTransferReport','stringify','catch','util','moment'];(function(_0x2b62f8,_0x30ef35){var _0x26f877=function(_0x77cad4){while(--_0x77cad4){_0x2b62f8['push'](_0x2b62f8['shift']());}};_0x26f877(++_0x30ef35);}(_0x2957,0x116));var _0x7295=function(_0x1da42f,_0x9980b8){_0x1da42f=_0x1da42f-0x0;var _0x2257b5=_0x2957[_0x1da42f];return _0x2257b5;};'use strict';var _=require('lodash');var util=require(_0x7295('0x0'));var moment=require(_0x7295('0x1'));var BPromise=require(_0x7295('0x2'));var rs=require(_0x7295('0x3'));var fs=require('fs');var Redis=require(_0x7295('0x4'));var db=require(_0x7295('0x5'))['db'];var utils=require(_0x7295('0x6'));var logger=require(_0x7295('0x7'))(_0x7295('0x8'));var config=require(_0x7295('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7295('0xa')][_0x7295('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b259c,_0x5753c6,_0x26beac){return new BPromise(function(_0x186da9,_0x328379){return client['request'](_0x3b259c,_0x26beac)[_0x7295('0xc')](function(_0x199ce3){logger[_0x7295('0xd')](_0x7295('0xe'),_0x5753c6,_0x7295('0xf'));logger['debug'](_0x7295('0x10'),_0x5753c6,'request\x20sent',JSON['stringify'](_0x199ce3));if(_0x199ce3[_0x7295('0x11')]){if(_0x199ce3[_0x7295('0x11')][_0x7295('0x12')]===0x1f4){logger['error'](_0x7295('0xe'),_0x5753c6,_0x199ce3[_0x7295('0x11')][_0x7295('0x13')]);return _0x328379(_0x199ce3[_0x7295('0x11')]['message']);}logger[_0x7295('0x11')](_0x7295('0xe'),_0x5753c6,_0x199ce3[_0x7295('0x11')][_0x7295('0x13')]);return _0x186da9(_0x199ce3[_0x7295('0x11')][_0x7295('0x13')]);}else{logger[_0x7295('0xd')](_0x7295('0xe'),_0x5753c6,_0x7295('0xf'));_0x186da9(_0x199ce3[_0x7295('0x14')]['message']);}})['catch'](function(_0x8c0984){logger[_0x7295('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x5753c6,_0x8c0984);_0x328379(_0x8c0984);});});}exports['CreateVoiceTransferReport']=function(_0x5515e9){var _0x40173c=this;return new Promise(function(_0x31d303,_0x17c0b){return db[_0x7295('0x15')][_0x7295('0x16')](_0x5515e9['body'],{'raw':_0x5515e9[_0x7295('0x17')]?_0x5515e9['options'][_0x7295('0x18')]===undefined?!![]:![]:!![]})[_0x7295('0xc')](function(_0xd910d6){logger[_0x7295('0xd')]('CreateVoiceTransferReport',_0x5515e9);logger['debug'](_0x7295('0x19'),_0x5515e9,JSON[_0x7295('0x1a')](_0xd910d6));_0x31d303(_0xd910d6);})[_0x7295('0x1b')](function(_0x4bdd13){logger[_0x7295('0x11')](_0x7295('0x19'),_0x4bdd13[_0x7295('0x13')],_0x5515e9);_0x17c0b(_0x40173c[_0x7295('0x11')](0x1f4,_0x4bdd13['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 74e2c05..012f23a 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 _0xf3cd=['/unhold','unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isWebrtcLicence','originate','isAuthenticated','hangup','/answer','answer'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x21f931,_0x598b2d){_0x21f931=_0x21f931-0x0;var _0x3f083c=_0xf3cd[_0x21f931];return _0x3f083c;};'use strict';var express=require(_0xdf3c('0x0'));var router=express[_0xdf3c('0x1')]();var auth=require(_0xdf3c('0x2'));var controller=require(_0xdf3c('0x3'));router[_0xdf3c('0x4')](_0xdf3c('0x5'),auth['isAuthenticated'](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x7')]);router[_0xdf3c('0x4')]('/hangup',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0x9')]);router[_0xdf3c('0x4')](_0xdf3c('0xa'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xb')]);router['post']('/hold',auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller['hold']);router[_0xdf3c('0x4')](_0xdf3c('0xc'),auth[_0xdf3c('0x8')](),auth[_0xdf3c('0x6')](),controller[_0xdf3c('0xd')]);router[_0xdf3c('0x4')](_0xdf3c('0xe'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0xf')]);router[_0xdf3c('0x4')](_0xdf3c('0x10'),auth[_0xdf3c('0x8')](),auth['isWebrtcLicence'](),controller[_0xdf3c('0x11')]);module[_0xdf3c('0x12')]=router; \ No newline at end of file +var _0xbdb7=['../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','hangup','answer','hold','/unhold','unhold','calls','/transfer','transfer','exports','express','Router'];(function(_0x334d1f,_0x4990a0){var _0x1c3f34=function(_0x33d0f2){while(--_0x33d0f2){_0x334d1f['push'](_0x334d1f['shift']());}};_0x1c3f34(++_0x4990a0);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xbdb7[_0x49052b];return _0x48c045;};'use strict';var express=require(_0x7bdb('0x0'));var router=express[_0x7bdb('0x1')]();var auth=require(_0x7bdb('0x2'));var controller=require(_0x7bdb('0x3'));router[_0x7bdb('0x4')](_0x7bdb('0x5'),auth[_0x7bdb('0x6')](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0x8')]);router['post'](_0x7bdb('0x9'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x7bdb('0xa')]);router[_0x7bdb('0x4')]('/answer',auth['isAuthenticated'](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xb')]);router['post']('/hold',auth[_0x7bdb('0x6')](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xc')]);router[_0x7bdb('0x4')](_0x7bdb('0xd'),auth[_0x7bdb('0x6')](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xe')]);router['post']('/calls',auth['isAuthenticated'](),auth[_0x7bdb('0x7')](),controller[_0x7bdb('0xf')]);router['post'](_0x7bdb('0x10'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x7bdb('0x11')]);module[_0x7bdb('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 5ae21e0..48f7983 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 _0x0711=['client','webbarapi','ioredis','defaults','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','send','name','NotFound','then','error','message','result','catch','User','all','rows','UserId','sessionId','length','originate','originate\x20fired:','body','validate','status','json','userId','callNumber','entityFound:','format','webbar:originate','originate\x20executed!','hangup','user:%s','webbar:hangup','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','hold\x20executed!','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','conference','conference\x20fired:','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','util','bluebird','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0711,0x1e5));var _0x1071=function(_0xa481cf,_0x1da738){_0xa481cf=_0xa481cf-0x0;var _0x5625fc=_0x0711[_0xa481cf];return _0x5625fc;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x1071('0x0'));var db=require(_0x1071('0x1'))['db'];var config=require('../../config/environment');var util=require(_0x1071('0x2'));var BPromise=require(_0x1071('0x3'));var jayson=require(_0x1071('0x4'));var amiClient=jayson[_0x1071('0x5')]['http']({'port':0x232a});var logger=require('../../config/logger')(_0x1071('0x6'));var Redis=require(_0x1071('0x7'));config['redis']=_[_0x1071('0x8')](config[_0x1071('0x9')],{'host':_0x1071('0xa'),'port':0x18eb});var io=require(_0x1071('0xb'))(new Redis(config[_0x1071('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]},'callNumber':{'type':_0x1071('0xe'),'required':[!![],_0x1071('0xf')]},'callerId':{'type':_0x1071('0xe')},'callbackUrl':{'type':_0x1071('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]},'sessionId':{'type':_0x1071('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x1071('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1071('0xd')]},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x1071('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1071('0xc'),'required':[!![],_0x1071('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1071('0xd')]}});function emit(_0x3882d2,_0x26eb97,_0x30342a){logger[_0x1071('0x11')](_0x3882d2,_0x26eb97,JSON[_0x1071('0x12')](_0x30342a));io['to'](_0x3882d2)[_0x1071('0x13')](_0x26eb97,_0x30342a);}function handleError(_0x3cf2c6){return function(_0x9ecde1){console[_0x1071('0x14')]('handleError:',_0x9ecde1,_0x9ecde1 instanceof RangeError);logger['error'](_0x9ecde1['stack']);if(_0x9ecde1 instanceof RangeError){if(_0x9ecde1['name']){delete _0x9ecde1['name'];}_0x3cf2c6['status'](0x194)[_0x1071('0x15')](_0x9ecde1);}else{if(_0x9ecde1[_0x1071('0x16')]){delete _0x9ecde1[_0x1071('0x16')];}_0x3cf2c6['status'](0x1f4)[_0x1071('0x15')](_0x9ecde1);}};}function checkError(){return function(_0x4e3e3f){if(!_0x4e3e3f){throw new RangeError(_0x1071('0x17'));}return _0x4e3e3f;};}function respondWithRpcPromise(_0x4fe87d,_0x231302){return new BPromise(function(_0x2f4ffa,_0xa2571){var _0x41dd3f=amiClient;return _0x41dd3f['request'](_0x4fe87d,_0x231302)[_0x1071('0x18')](function(_0x38a571){if(_0x38a571[_0x1071('0x19')]){if(_0x38a571[_0x1071('0x19')]['code']===0x1f4){return _0xa2571(_0x38a571[_0x1071('0x19')]['message']);}return _0x2f4ffa(_0x38a571[_0x1071('0x19')][_0x1071('0x1a')]);}else{_0x2f4ffa(_0x38a571[_0x1071('0x1b')]);}})[_0x1071('0x1c')](function(_0x5814d7){_0xa2571(_0x5814d7);});});}function getAgent(_0x2425a0){return db[_0x1071('0x1d')]['findOne']({'where':{'id':_0x2425a0,'role':'agent'}})['then'](checkError());}function getAgentCheckSession(_0x2d7750,_0x486865){return new BPromise(function(_0x5e1750,_0x541707){var _0x4cb21d=respondWithRpcPromise('VoiceChannels');var _0x2462ab=getAgent(_0x2d7750);Promise[_0x1071('0x1e')]([_0x4cb21d,_0x2462ab])[_0x1071('0x18')](function(_0x456be9){var _0x57faa5=_0x456be9[0x0];var _0x996eae=_0x456be9[0x1];var _0x2bf46d=_['filter'](_0x57faa5[_0x1071('0x1f')],function(_0x1f266b){return _0x1f266b[_0x1071('0x20')]==_0x996eae['id']&&_0x1f266b[_0x1071('0x21')]==_0x486865;});if(_0x2bf46d[_0x1071('0x22')]==0x1){_0x5e1750(_0x996eae);}else{_0x541707(new RangeError('sessionId\x20'+_0x486865+'\x20not\x20found!'));}});});}exports[_0x1071('0x23')]=function(_0x4cc2fc,_0x2fd7ea){logger['info'](_0x1071('0x24'),_0x4cc2fc[_0x1071('0x25')]);var _0x45c829=originateValidation[_0x1071('0x26')](_0x4cc2fc[_0x1071('0x25')]);if(_0x45c829['length']>0x0){return _0x2fd7ea[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x45c829);}var _0x241cb8=_0x4cc2fc['body'][_0x1071('0x29')];var _0x5c6995=_0x4cc2fc[_0x1071('0x25')][_0x1071('0x2a')];var _0x5e578e=_0x4cc2fc[_0x1071('0x25')]['callerId'];var _0x344fc3=_0x4cc2fc[_0x1071('0x25')]['callbackUrl'];return getAgent(_0x241cb8)[_0x1071('0x18')](function(_0xa83950){logger[_0x1071('0x11')](_0x1071('0x2b'),_0xa83950[_0x1071('0x16')]);emit(util[_0x1071('0x2c')]('user:%s',_0xa83950['name']),_0x1071('0x2d'),{'callNumber':_0x5c6995,'callerId':_0x5e578e,'callbackUrl':_0x344fc3});return _0x2fd7ea[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x2e')});})[_0x1071('0x1c')](handleError(_0x2fd7ea));};exports[_0x1071('0x2f')]=function(_0x4686ba,_0x3d545f){logger[_0x1071('0x11')]('hangup\x20fired:',_0x4686ba[_0x1071('0x25')]);var _0x1515d7=hangupValidation['validate'](_0x4686ba['body']);if(_0x1515d7['length']>0x0){return _0x3d545f[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x1515d7);}var _0x19fbd4=_0x4686ba[_0x1071('0x25')][_0x1071('0x29')];var _0x15a657=_0x4686ba[_0x1071('0x25')]['sessionId'];return getAgent(_0x19fbd4)[_0x1071('0x18')](function(_0x593c99){logger[_0x1071('0x11')](_0x1071('0x2b'),_0x593c99[_0x1071('0x16')]);emit(util[_0x1071('0x2c')](_0x1071('0x30'),_0x593c99[_0x1071('0x16')]),_0x1071('0x31'),{'sessionId':_0x15a657});return _0x3d545f[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':'hangup\x20executed!'});})[_0x1071('0x1c')](handleError(_0x3d545f));};exports[_0x1071('0x32')]=function(_0x5d15b7,_0x5001bd){logger['info'](_0x1071('0x33'),_0x5d15b7[_0x1071('0x25')]);var _0x1c632c=answerValidation[_0x1071('0x26')](_0x5d15b7[_0x1071('0x25')]);if(_0x1c632c[_0x1071('0x22')]>0x0){return _0x5001bd[_0x1071('0x27')](0x190)['json'](_0x1c632c);}var _0xfcf4fd=_0x5d15b7['body'][_0x1071('0x29')];var _0x2f5190=_0x5d15b7[_0x1071('0x25')][_0x1071('0x21')];return getAgent(_0xfcf4fd)['then'](function(_0x42e308){logger[_0x1071('0x11')]('entityFound:',_0x42e308['name']);emit(util[_0x1071('0x2c')](_0x1071('0x30'),_0x42e308['name']),_0x1071('0x34'),{'sessionId':_0x2f5190});return _0x5001bd['status'](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x35')});})[_0x1071('0x1c')](handleError(_0x5001bd));};exports[_0x1071('0x36')]=function(_0x5e082e,_0x400647){logger[_0x1071('0x11')](_0x1071('0x37'),_0x5e082e[_0x1071('0x25')]);var _0x39dfbe=holdValidation[_0x1071('0x26')](_0x5e082e[_0x1071('0x25')]);if(_0x39dfbe[_0x1071('0x22')]>0x0){return _0x400647[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x39dfbe);}var _0x141822=_0x5e082e['body']['userId'];var _0x4bc3bf=_0x5e082e['body'][_0x1071('0x21')];return getAgent(_0x141822)[_0x1071('0x18')](function(_0x52f218){logger[_0x1071('0x11')]('entityFound:',_0x52f218['name']);emit(util[_0x1071('0x2c')]('user:%s',_0x52f218[_0x1071('0x16')]),_0x1071('0x38'),{'sessionId':_0x4bc3bf});return _0x400647[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x39')});})[_0x1071('0x1c')](handleError(_0x400647));};exports['unhold']=function(_0x5ae9a2,_0x55251b){logger['info']('unhold\x20fired:',_0x5ae9a2[_0x1071('0x25')]);var _0x85d9a3=unholdValidation[_0x1071('0x26')](_0x5ae9a2[_0x1071('0x25')]);if(_0x85d9a3[_0x1071('0x22')]>0x0){return _0x55251b[_0x1071('0x27')](0x190)['json'](_0x85d9a3);}var _0x4120f3=_0x5ae9a2[_0x1071('0x25')][_0x1071('0x29')];var _0x5ea9de=_0x5ae9a2[_0x1071('0x25')][_0x1071('0x21')];return getAgent(_0x4120f3)[_0x1071('0x18')](function(_0x35b39a){logger[_0x1071('0x11')](_0x1071('0x2b'),_0x35b39a[_0x1071('0x16')]);emit(util['format'](_0x1071('0x30'),_0x35b39a[_0x1071('0x16')]),_0x1071('0x3a'),{'sessionId':_0x5ea9de});return _0x55251b[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x3b')});})[_0x1071('0x1c')](handleError(_0x55251b));};exports[_0x1071('0x3c')]=function(_0x343cf3,_0x5a66f1){logger[_0x1071('0x11')](_0x1071('0x3d'),_0x5a66f1[_0x1071('0x25')]);var _0xccf35d=callsValidation[_0x1071('0x26')](_0x343cf3['body']);if(_0xccf35d[_0x1071('0x22')]>0x0){return _0x5a66f1[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0xccf35d);}var _0x47cb65=_0x343cf3['body']['userId'];var _0x52496a=respondWithRpcPromise(_0x1071('0x3e'));var _0x5d5238=getAgent(_0x47cb65);return Promise['all']([_0x52496a,_0x5d5238])[_0x1071('0x18')](function(_0xbc01a2){var _0x23c7ca=_0xbc01a2[0x0];var _0x19b799=_0xbc01a2[0x1];var _0x1fdfe3=_['filter'](_0x23c7ca[_0x1071('0x1f')],function(_0xc62827){return _0xc62827[_0x1071('0x20')]==_0x19b799['id'];});return _0x5a66f1[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'count':_0x1fdfe3[_0x1071('0x22')],'rows':_0x1fdfe3});})[_0x1071('0x1c')](handleError(_0x5a66f1));};exports[_0x1071('0x3f')]=function(_0x5a70a7,_0x587cf8){logger[_0x1071('0x11')](_0x1071('0x40'),_0x5a70a7[_0x1071('0x25')]);var _0x17e142=conferenceValidation[_0x1071('0x26')](_0x5a70a7['body']);if(_0x17e142['length']>0x0){return _0x587cf8[_0x1071('0x27')](0x190)[_0x1071('0x28')](_0x17e142);}var _0x4b5744=_0x5a70a7['body'][_0x1071('0x29')];return getAgent(_0x4b5744)[_0x1071('0x18')](function(_0x2179e7){logger[_0x1071('0x11')](_0x1071('0x2b'),_0x2179e7[_0x1071('0x16')]);emit(util['format']('user:%s',_0x2179e7[_0x1071('0x16')]),'webbar:conference');return _0x587cf8['status'](0xc8)['json']({'error':![],'message':_0x1071('0x41')});})[_0x1071('0x1c')](handleError(_0x587cf8));};exports[_0x1071('0x42')]=function(_0x6f6b22,_0x5a5ff6){logger[_0x1071('0x11')]('transfer\x20fired:',_0x6f6b22[_0x1071('0x25')]);var _0x387311=transferValidation[_0x1071('0x26')](_0x6f6b22['body']);if(_0x387311[_0x1071('0x22')]>0x0){return _0x5a5ff6['status'](0x190)['json'](_0x387311);}var _0x14e7fb=_0x6f6b22['body']['userId'];var _0xae3b8=_0x6f6b22[_0x1071('0x25')][_0x1071('0x21')];var _0x5cd2ae=_0x6f6b22[_0x1071('0x25')][_0x1071('0x43')];return getAgent(_0x14e7fb)[_0x1071('0x18')](function(_0x365447){logger['info'](_0x1071('0x2b'),_0x365447[_0x1071('0x16')]);emit(util[_0x1071('0x2c')](_0x1071('0x30'),_0x365447[_0x1071('0x16')]),_0x1071('0x44'),{'sessionId':_0xae3b8,'transferNumber':_0x5cd2ae});return _0x5a5ff6[_0x1071('0x27')](0xc8)[_0x1071('0x28')]({'error':![],'message':_0x1071('0x45')});})[_0x1071('0x1c')](handleError(_0x5a5ff6));}; \ No newline at end of file +var _0x7b19=['conference','webbar:conference','conference\x20executed!','transfer\x20fired:','transferNumber','webbar:transfer','transfer\x20executed!','lodash','../../mysqldb','../../config/environment','bluebird','jayson/promise','client','http','../../config/logger','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','info','emit','log','handleError:','error','stack','status','request','then','code','result','catch','findOne','agent','VoiceChannels','rows','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callbackUrl','entityFound:','name','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','format','webbar:hold','hold\x20executed!','unhold\x20fired:','webbar:unhold','unhold\x20executed!','filter','UserId'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x7b19,0x1b7));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var path=require('path');var fs=require('fs');var _=require(_0x97b1('0x0'));var db=require(_0x97b1('0x1'))['db'];var config=require(_0x97b1('0x2'));var util=require('util');var BPromise=require(_0x97b1('0x3'));var jayson=require(_0x97b1('0x4'));var amiClient=jayson[_0x97b1('0x5')][_0x97b1('0x6')]({'port':0x232a});var logger=require(_0x97b1('0x7'))(_0x97b1('0x8'));var Redis=require(_0x97b1('0x9'));config[_0x97b1('0xa')]=_['defaults'](config[_0x97b1('0xa')],{'host':_0x97b1('0xb'),'port':0x18eb});var io=require(_0x97b1('0xc'))(new Redis(config[_0x97b1('0xa')]));var Schema=require(_0x97b1('0xd'));var originateValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x97b1('0xf')]},'callerId':{'type':_0x97b1('0x10')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':_0x97b1('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x97b1('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':_0x97b1('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]},'sessionId':{'type':_0x97b1('0x10'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x97b1('0xe'),'required':[!![],_0x97b1('0x11')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x97b1('0x11')]}});function emit(_0x4ee206,_0x22d677,_0x5c9e4f){logger[_0x97b1('0x12')](_0x4ee206,_0x22d677,JSON['stringify'](_0x5c9e4f));io['to'](_0x4ee206)[_0x97b1('0x13')](_0x22d677,_0x5c9e4f);}function handleError(_0x2669e9){return function(_0x2860c4){console[_0x97b1('0x14')](_0x97b1('0x15'),_0x2860c4,_0x2860c4 instanceof RangeError);logger[_0x97b1('0x16')](_0x2860c4[_0x97b1('0x17')]);if(_0x2860c4 instanceof RangeError){if(_0x2860c4['name']){delete _0x2860c4['name'];}_0x2669e9[_0x97b1('0x18')](0x194)['send'](_0x2860c4);}else{if(_0x2860c4['name']){delete _0x2860c4['name'];}_0x2669e9[_0x97b1('0x18')](0x1f4)['send'](_0x2860c4);}};}function checkError(){return function(_0x3cd1fa){if(!_0x3cd1fa){throw new RangeError('NotFound');}return _0x3cd1fa;};}function respondWithRpcPromise(_0x248057,_0x16c9c0){return new BPromise(function(_0x5cbcb2,_0x129eec){var _0x20b3ff=amiClient;return _0x20b3ff[_0x97b1('0x19')](_0x248057,_0x16c9c0)[_0x97b1('0x1a')](function(_0x1c5108){if(_0x1c5108[_0x97b1('0x16')]){if(_0x1c5108[_0x97b1('0x16')][_0x97b1('0x1b')]===0x1f4){return _0x129eec(_0x1c5108[_0x97b1('0x16')]['message']);}return _0x5cbcb2(_0x1c5108[_0x97b1('0x16')]['message']);}else{_0x5cbcb2(_0x1c5108[_0x97b1('0x1c')]);}})[_0x97b1('0x1d')](function(_0x5bd2dd){_0x129eec(_0x5bd2dd);});});}function getAgent(_0x24e394){return db['User'][_0x97b1('0x1e')]({'where':{'id':_0x24e394,'role':_0x97b1('0x1f')}})[_0x97b1('0x1a')](checkError());}function getAgentCheckSession(_0x11e29e,_0x262809){return new BPromise(function(_0x4f3760,_0x120a0c){var _0x988004=respondWithRpcPromise(_0x97b1('0x20'));var _0x21f810=getAgent(_0x11e29e);Promise['all']([_0x988004,_0x21f810])['then'](function(_0x18fb67){var _0x200836=_0x18fb67[0x0];var _0x3b3093=_0x18fb67[0x1];var _0x96e07d=_['filter'](_0x200836[_0x97b1('0x21')],function(_0x2fb7e1){return _0x2fb7e1['UserId']==_0x3b3093['id']&&_0x2fb7e1[_0x97b1('0x22')]==_0x262809;});if(_0x96e07d[_0x97b1('0x23')]==0x1){_0x4f3760(_0x3b3093);}else{_0x120a0c(new RangeError('sessionId\x20'+_0x262809+_0x97b1('0x24')));}});});}exports[_0x97b1('0x25')]=function(_0x361b9c,_0x439bf5){logger[_0x97b1('0x12')](_0x97b1('0x26'),_0x361b9c[_0x97b1('0x27')]);var _0x38c2ba=originateValidation[_0x97b1('0xd')](_0x361b9c[_0x97b1('0x27')]);if(_0x38c2ba['length']>0x0){return _0x439bf5['status'](0x190)[_0x97b1('0x28')](_0x38c2ba);}var _0x25f769=_0x361b9c[_0x97b1('0x27')][_0x97b1('0x29')];var _0x1fe42a=_0x361b9c[_0x97b1('0x27')][_0x97b1('0x2a')];var _0x2ead5c=_0x361b9c[_0x97b1('0x27')]['callerId'];var _0x41fe5d=_0x361b9c[_0x97b1('0x27')][_0x97b1('0x2b')];return getAgent(_0x25f769)[_0x97b1('0x1a')](function(_0x308593){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x308593[_0x97b1('0x2d')]);emit(util['format'](_0x97b1('0x2e'),_0x308593[_0x97b1('0x2d')]),'webbar:originate',{'callNumber':_0x1fe42a,'callerId':_0x2ead5c,'callbackUrl':_0x41fe5d});return _0x439bf5[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x2f')});})[_0x97b1('0x1d')](handleError(_0x439bf5));};exports[_0x97b1('0x30')]=function(_0x43ffbb,_0x4b2843){logger[_0x97b1('0x12')](_0x97b1('0x31'),_0x43ffbb['body']);var _0x116087=hangupValidation[_0x97b1('0xd')](_0x43ffbb['body']);if(_0x116087[_0x97b1('0x23')]>0x0){return _0x4b2843['status'](0x190)[_0x97b1('0x28')](_0x116087);}var _0x411c50=_0x43ffbb[_0x97b1('0x27')][_0x97b1('0x29')];var _0x539e62=_0x43ffbb['body']['sessionId'];return getAgent(_0x411c50)['then'](function(_0xe6a4f8){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0xe6a4f8[_0x97b1('0x2d')]);emit(util['format']('user:%s',_0xe6a4f8[_0x97b1('0x2d')]),_0x97b1('0x32'),{'sessionId':_0x539e62});return _0x4b2843[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x33')});})[_0x97b1('0x1d')](handleError(_0x4b2843));};exports[_0x97b1('0x34')]=function(_0x590cf2,_0x329b08){logger[_0x97b1('0x12')](_0x97b1('0x35'),_0x590cf2['body']);var _0x382a97=answerValidation['validate'](_0x590cf2[_0x97b1('0x27')]);if(_0x382a97[_0x97b1('0x23')]>0x0){return _0x329b08['status'](0x190)[_0x97b1('0x28')](_0x382a97);}var _0x397b81=_0x590cf2['body']['userId'];var _0x2b6027=_0x590cf2['body'][_0x97b1('0x22')];return getAgent(_0x397b81)['then'](function(_0x1e4c55){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x1e4c55[_0x97b1('0x2d')]);emit(util['format']('user:%s',_0x1e4c55[_0x97b1('0x2d')]),_0x97b1('0x36'),{'sessionId':_0x2b6027});return _0x329b08[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x37')});})['catch'](handleError(_0x329b08));};exports[_0x97b1('0x38')]=function(_0xb0a8c8,_0x410399){logger[_0x97b1('0x12')]('hold\x20fired:',_0xb0a8c8['body']);var _0x29a6dc=holdValidation[_0x97b1('0xd')](_0xb0a8c8[_0x97b1('0x27')]);if(_0x29a6dc[_0x97b1('0x23')]>0x0){return _0x410399[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x29a6dc);}var _0xd8bfce=_0xb0a8c8[_0x97b1('0x27')][_0x97b1('0x29')];var _0xbfa94b=_0xb0a8c8[_0x97b1('0x27')][_0x97b1('0x22')];return getAgent(_0xd8bfce)['then'](function(_0x3c7692){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x3c7692['name']);emit(util[_0x97b1('0x39')]('user:%s',_0x3c7692[_0x97b1('0x2d')]),_0x97b1('0x3a'),{'sessionId':_0xbfa94b});return _0x410399[_0x97b1('0x18')](0xc8)['json']({'error':![],'message':_0x97b1('0x3b')});})[_0x97b1('0x1d')](handleError(_0x410399));};exports['unhold']=function(_0x7042fd,_0x54f54f){logger['info'](_0x97b1('0x3c'),_0x7042fd[_0x97b1('0x27')]);var _0x1c905f=unholdValidation[_0x97b1('0xd')](_0x7042fd[_0x97b1('0x27')]);if(_0x1c905f[_0x97b1('0x23')]>0x0){return _0x54f54f['status'](0x190)[_0x97b1('0x28')](_0x1c905f);}var _0x310df0=_0x7042fd['body'][_0x97b1('0x29')];var _0x4d8d25=_0x7042fd[_0x97b1('0x27')][_0x97b1('0x22')];return getAgent(_0x310df0)[_0x97b1('0x1a')](function(_0x4539b0){logger[_0x97b1('0x12')](_0x97b1('0x2c'),_0x4539b0[_0x97b1('0x2d')]);emit(util['format']('user:%s',_0x4539b0[_0x97b1('0x2d')]),_0x97b1('0x3d'),{'sessionId':_0x4d8d25});return _0x54f54f[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x3e')});})[_0x97b1('0x1d')](handleError(_0x54f54f));};exports['calls']=function(_0x55de2e,_0x3f3602){logger['info']('calls\x20fired:',_0x3f3602[_0x97b1('0x27')]);var _0x89be1=callsValidation[_0x97b1('0xd')](_0x55de2e[_0x97b1('0x27')]);if(_0x89be1[_0x97b1('0x23')]>0x0){return _0x3f3602[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x89be1);}var _0x11746e=_0x55de2e[_0x97b1('0x27')][_0x97b1('0x29')];var _0x36ee01=respondWithRpcPromise(_0x97b1('0x20'));var _0x54c495=getAgent(_0x11746e);return Promise['all']([_0x36ee01,_0x54c495])[_0x97b1('0x1a')](function(_0x48670a){var _0x2af9d7=_0x48670a[0x0];var _0x1c173c=_0x48670a[0x1];var _0x3b99fa=_[_0x97b1('0x3f')](_0x2af9d7[_0x97b1('0x21')],function(_0x5a09cd){return _0x5a09cd[_0x97b1('0x40')]==_0x1c173c['id'];});return _0x3f3602[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'count':_0x3b99fa['length'],'rows':_0x3b99fa});})[_0x97b1('0x1d')](handleError(_0x3f3602));};exports[_0x97b1('0x41')]=function(_0x5be89a,_0x2525dc){logger[_0x97b1('0x12')]('conference\x20fired:',_0x5be89a[_0x97b1('0x27')]);var _0x2ca4af=conferenceValidation[_0x97b1('0xd')](_0x5be89a['body']);if(_0x2ca4af[_0x97b1('0x23')]>0x0){return _0x2525dc[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x2ca4af);}var _0x5866de=_0x5be89a[_0x97b1('0x27')]['userId'];return getAgent(_0x5866de)['then'](function(_0x4ffc0b){logger['info'](_0x97b1('0x2c'),_0x4ffc0b['name']);emit(util[_0x97b1('0x39')](_0x97b1('0x2e'),_0x4ffc0b[_0x97b1('0x2d')]),_0x97b1('0x42'));return _0x2525dc[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x43')});})[_0x97b1('0x1d')](handleError(_0x2525dc));};exports['transfer']=function(_0x454504,_0x464584){logger[_0x97b1('0x12')](_0x97b1('0x44'),_0x454504[_0x97b1('0x27')]);var _0x5d19b5=transferValidation['validate'](_0x454504[_0x97b1('0x27')]);if(_0x5d19b5[_0x97b1('0x23')]>0x0){return _0x464584[_0x97b1('0x18')](0x190)[_0x97b1('0x28')](_0x5d19b5);}var _0x4f784e=_0x454504['body'][_0x97b1('0x29')];var _0x445986=_0x454504['body'][_0x97b1('0x22')];var _0x317eb6=_0x454504[_0x97b1('0x27')][_0x97b1('0x45')];return getAgent(_0x4f784e)[_0x97b1('0x1a')](function(_0xcfc47a){logger[_0x97b1('0x12')]('entityFound:',_0xcfc47a[_0x97b1('0x2d')]);emit(util['format'](_0x97b1('0x2e'),_0xcfc47a[_0x97b1('0x2d')]),_0x97b1('0x46'),{'sessionId':_0x445986,'transferNumber':_0x317eb6});return _0x464584[_0x97b1('0x18')](0xc8)[_0x97b1('0x28')]({'error':![],'message':_0x97b1('0x47')});})['catch'](handleError(_0x464584));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 93f9fdd..5573c0e 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 _0xcfdf=['/:id/notify','/:id/send','send','put','update','destroy','delete','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAgents','getApplications','create','post','addDisposition','addAnswer','/:id/users','/:id/applications'];(function(_0x1aa848,_0x394c9f){var _0x1054c5=function(_0x2619bd){while(--_0x2619bd){_0x1aa848['push'](_0x1aa848['shift']());}};_0x1054c5(++_0x394c9f);}(_0xcfdf,0x196));var _0xfcfd=function(_0x448e50,_0x10e622){_0x448e50=_0x448e50-0x0;var _0x1b12e7=_0xcfdf[_0x448e50];return _0x1b12e7;};'use strict';var multer=require('multer');var util=require(_0xfcfd('0x0'));var path=require(_0xfcfd('0x1'));var timeout=require(_0xfcfd('0x2'));var express=require(_0xfcfd('0x3'));var router=express['Router']();var fs_extra=require(_0xfcfd('0x4'));var auth=require(_0xfcfd('0x5'));var interaction=require(_0xfcfd('0x6'));var config=require(_0xfcfd('0x7'));var controller=require(_0xfcfd('0x8'));router[_0xfcfd('0x9')]('/',auth[_0xfcfd('0xa')](),controller['index']);router[_0xfcfd('0x9')](_0xfcfd('0xb'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0xc')]);router[_0xfcfd('0x9')](_0xfcfd('0xd'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0xe')]);router[_0xfcfd('0x9')](_0xfcfd('0xf'),auth['isAuthenticated'](),controller[_0xfcfd('0x10')]);router[_0xfcfd('0x9')](_0xfcfd('0x11'),auth[_0xfcfd('0xa')](),controller['getAnswers']);router['get']('/:id/users',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x12')]);router[_0xfcfd('0x9')]('/:id/applications',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x13')]);router['post']('/',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x14')]);router[_0xfcfd('0x15')]('/:id/dispositions',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x16')]);router[_0xfcfd('0x15')](_0xfcfd('0x11'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x17')]);router['post'](_0xfcfd('0x18'),auth[_0xfcfd('0xa')](),controller['addAgents']);router[_0xfcfd('0x15')](_0xfcfd('0x19'),auth[_0xfcfd('0xa')](),controller['addApplications']);router['post'](_0xfcfd('0x1a'),controller['notify']);router[_0xfcfd('0x15')](_0xfcfd('0x1b'),auth['isAuthenticated'](),controller[_0xfcfd('0x1c')]);router[_0xfcfd('0x1d')](_0xfcfd('0xd'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x1e')]);router['delete']('/:id',auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x1f')]);router[_0xfcfd('0x20')](_0xfcfd('0xf'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x21')]);router['delete'](_0xfcfd('0x11'),auth[_0xfcfd('0xa')](),controller[_0xfcfd('0x22')]);router[_0xfcfd('0x20')](_0xfcfd('0x18'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfcfd('0x23')]=router; \ No newline at end of file +var _0x392b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','isAuthenticated','/describe','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','post','addDisposition','addAnswer','addAgents','notify','/:id/send','send','put','update','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','express'];(function(_0x5b02f1,_0x498631){var _0x584317=function(_0x50c507){while(--_0x50c507){_0x5b02f1['push'](_0x5b02f1['shift']());}};_0x584317(++_0x498631);}(_0x392b,0x1e6));var _0xb392=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x392b[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require('multer');var util=require(_0xb392('0x0'));var path=require(_0xb392('0x1'));var timeout=require(_0xb392('0x2'));var express=require(_0xb392('0x3'));var router=express[_0xb392('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb392('0x5'));var interaction=require(_0xb392('0x6'));var config=require(_0xb392('0x7'));var controller=require(_0xb392('0x8'));router['get']('/',auth[_0xb392('0x9')](),controller['index']);router['get'](_0xb392('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xb392('0xb')](_0xb392('0xc'),auth[_0xb392('0x9')](),controller[_0xb392('0xd')]);router[_0xb392('0xb')](_0xb392('0xe'),auth[_0xb392('0x9')](),controller[_0xb392('0xf')]);router['get'](_0xb392('0x10'),auth[_0xb392('0x9')](),controller['getAnswers']);router[_0xb392('0xb')](_0xb392('0x11'),auth[_0xb392('0x9')](),controller[_0xb392('0x12')]);router[_0xb392('0xb')](_0xb392('0x13'),auth['isAuthenticated'](),controller[_0xb392('0x14')]);router[_0xb392('0x15')]('/',auth[_0xb392('0x9')](),controller['create']);router[_0xb392('0x15')](_0xb392('0xe'),auth['isAuthenticated'](),controller[_0xb392('0x16')]);router['post'](_0xb392('0x10'),auth[_0xb392('0x9')](),controller[_0xb392('0x17')]);router['post'](_0xb392('0x11'),auth[_0xb392('0x9')](),controller[_0xb392('0x18')]);router[_0xb392('0x15')](_0xb392('0x13'),auth[_0xb392('0x9')](),controller['addApplications']);router['post']('/:id/notify',controller[_0xb392('0x19')]);router[_0xb392('0x15')](_0xb392('0x1a'),auth['isAuthenticated'](),controller[_0xb392('0x1b')]);router[_0xb392('0x1c')](_0xb392('0xc'),auth[_0xb392('0x9')](),controller[_0xb392('0x1d')]);router[_0xb392('0x1e')](_0xb392('0xc'),auth[_0xb392('0x9')](),controller[_0xb392('0x1f')]);router[_0xb392('0x1e')](_0xb392('0xe'),auth[_0xb392('0x9')](),controller[_0xb392('0x20')]);router[_0xb392('0x1e')](_0xb392('0x10'),auth[_0xb392('0x9')](),controller[_0xb392('0x21')]);router['delete'](_0xb392('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb392('0x22')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 5ea9df8..7674e4a 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 _0x4bb9=['setDataValue','mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x339bf6,_0x1bd76c){var _0xe78da3=function(_0x2fe467){while(--_0x2fe467){_0x339bf6['push'](_0x339bf6['shift']());}};_0xe78da3(++_0x1bd76c);}(_0x4bb9,0x1d2));var _0x94bb=function(_0x295e31,_0x2abadf){_0x295e31=_0x295e31-0x0;var _0x601072=_0x4bb9[_0x295e31];return _0x601072;};'use strict';var Sequelize=require(_0x94bb('0x0'));var rs=require(_0x94bb('0x1'));module[_0x94bb('0x2')]={'name':{'type':Sequelize[_0x94bb('0x3')],'unique':_0x94bb('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x94bb('0x3')],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize[_0x94bb('0x3')],'defaultValue':function(){return rs[_0x94bb('0x5')]();}},'phone':{'type':Sequelize[_0x94bb('0x3')]},'type':{'type':Sequelize[_0x94bb('0x6')](_0x94bb('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x94bb('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x94bb('0x3')]},'notificationTemplate':{'type':Sequelize[_0x94bb('0x8')],'defaultValue':function(){return _0x94bb('0x9');}},'notificationSound':{'type':Sequelize[_0x94bb('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x94bb('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x94bb('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x94bb('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x94bb('0xb')],'comment':_0x94bb('0xc')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x94bb('0xd'),'set':function(_0x215a9e){if(!_0x215a9e){this[_0x94bb('0xe')](_0x94bb('0xf'),null);}this[_0x94bb('0xe')]('mandatoryDisposition',_0x215a9e);}},'description':{'type':Sequelize[_0x94bb('0x3')]}}; \ No newline at end of file +var _0xbbea=['ENUM','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate'];(function(_0x3109b1,_0xbfa978){var _0x38dfd2=function(_0x519813){while(--_0x519813){_0x3109b1['push'](_0x3109b1['shift']());}};_0x38dfd2(++_0xbfa978);}(_0xbbea,0xda));var _0xabbe=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xbbea[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xabbe('0x0'));var rs=require(_0xabbe('0x1'));module[_0xabbe('0x2')]={'name':{'type':Sequelize[_0xabbe('0x3')],'unique':_0xabbe('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xabbe('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xabbe('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xabbe('0x3')],'defaultValue':function(){return rs[_0xabbe('0x5')]();}},'phone':{'type':Sequelize[_0xabbe('0x3')]},'type':{'type':Sequelize[_0xabbe('0x6')]('twilio','sinch')},'accountSid':{'type':Sequelize[_0xabbe('0x3')]},'baseUrl':{'type':Sequelize[_0xabbe('0x3')]},'authToken':{'type':Sequelize[_0xabbe('0x3')]},'notificationTemplate':{'type':Sequelize[_0xabbe('0x7')],'defaultValue':function(){return _0xabbe('0x8');}},'notificationSound':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xabbe('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xabbe('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xabbe('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xabbe('0xa')],'comment':_0xabbe('0xb')},'mandatoryDisposition':{'type':Sequelize[_0xabbe('0x9')],'defaultValue':![],'comment':_0xabbe('0xc'),'set':function(_0x356133){if(!_0x356133){this[_0xabbe('0xd')](_0xabbe('0xe'),null);}this[_0xabbe('0xd')](_0xabbe('0xf'),_0x356133);}},'description':{'type':Sequelize[_0xabbe('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 8814e6a..b1b298f 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 _0x883b=['error','message','result','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','WhatsappAccount','rawAttributes','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','includeAll','create','body','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addDisposition','Disposition','findOne','WhatsappAccountId','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addAgents','spread','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','account','sinch','statuses','read','message_id','applications','asc','Sequelize','ValidationError','difference','updatedAt','createdAt','CompanyId','ListId','type','twilio','from','replace','whatsapp:','messageId','notifications','isNil','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','DESC','list','omit','Contacts','contact','WhatsappInteraction','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','Start','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','to\x20is\x20mandatory','CmList','List','defaults','out','WhatsappMessage','Messages','dataValues','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x97264,_0x5db8a7){var _0x4c3d58=function(_0x16dbc5){while(--_0x16dbc5){_0x97264['push'](_0x97264['shift']());}};_0x4c3d58(++_0x5db8a7);}(_0x883b,0x15d));var _0xb883=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x883b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb883('0x0'));var zipdir=require(_0xb883('0x1'));var jsonpatch=require(_0xb883('0x2'));var rp=require('request-promise');var moment=require(_0xb883('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb883('0x4'));var util=require(_0xb883('0x5'));var path=require(_0xb883('0x6'));var sox=require(_0xb883('0x7'));var csv=require(_0xb883('0x8'));var ejs=require(_0xb883('0x9'));var fs=require('fs');var fs_extra=require(_0xb883('0xa'));var _=require(_0xb883('0xb'));var squel=require(_0xb883('0xc'));var crypto=require(_0xb883('0xd'));var jsforce=require(_0xb883('0xe'));var deskjs=require(_0xb883('0xf'));var toCsv=require(_0xb883('0x8'));var querystring=require(_0xb883('0x10'));var Papa=require(_0xb883('0x11'));var Redis=require(_0xb883('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb883('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb883('0x14'));var logger=require('../../config/logger')(_0xb883('0x15'));var utils=require(_0xb883('0x16'));var config=require(_0xb883('0x17'));var licenseUtil=require(_0xb883('0x18'));var db=require(_0xb883('0x19'))['db'];config[_0xb883('0x1a')]=_['defaults'](config[_0xb883('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0xb883('0x1b'))(new Redis(config[_0xb883('0x1a')]));require(_0xb883('0x1c'))[_0xb883('0x1d')](socket);var jayson=require(_0xb883('0x1e'));var client=jayson[_0xb883('0x1f')][_0xb883('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x6aa5e2,_0x199360,_0x1fab0c,_0x4e3433){return new BPromise(function(_0x200018,_0x2f2eea){var _0x62ac91=_0x4e3433||client;return _0x62ac91['request'](_0x6aa5e2,_0x1fab0c)[_0xb883('0x21')](function(_0x4eee2e){logger[_0xb883('0x22')](_0xb883('0x23'),_0x199360,_0xb883('0x24'));logger[_0xb883('0x25')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x199360,'request\x20sent',JSON[_0xb883('0x26')](_0x4eee2e));if(_0x4eee2e[_0xb883('0x27')]){if(_0x4eee2e[_0xb883('0x27')]['code']===0x1f4){logger[_0xb883('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x199360,_0x4eee2e['error'][_0xb883('0x28')]);return _0x2f2eea(_0x4eee2e[_0xb883('0x27')][_0xb883('0x28')]);}logger[_0xb883('0x27')](_0xb883('0x23'),_0x199360,_0x4eee2e['error'][_0xb883('0x28')]);return _0x200018(_0x4eee2e[_0xb883('0x27')][_0xb883('0x28')]);}else{logger[_0xb883('0x22')](_0xb883('0x23'),_0x199360,_0xb883('0x24'));_0x200018(_0x4eee2e[_0xb883('0x29')][_0xb883('0x28')]);}})['catch'](function(_0x1e2ba1){logger[_0xb883('0x27')]('WhatsappAccount,\x20%s,\x20%s',_0x199360,_0x1e2ba1);_0x2f2eea(_0x1e2ba1);});});}function respondWithStatusCode(_0x575ecd,_0x3d6ea7){_0x3d6ea7=_0x3d6ea7||0xcc;return function(_0x38f138){if(_0x38f138){return _0x575ecd[_0xb883('0x2a')](_0x3d6ea7);}return _0x575ecd[_0xb883('0x2b')](_0x3d6ea7)[_0xb883('0x2c')]();};}function respondWithResult(_0x2fd7f2,_0xa6a70a){_0xa6a70a=_0xa6a70a||0xc8;return function(_0x1defef){if(_0x1defef){return _0x2fd7f2[_0xb883('0x2b')](_0xa6a70a)[_0xb883('0x2d')](_0x1defef);}};}function respondWithFilteredResult(_0x41f97f,_0x5d745a){return function(_0x2d5334){if(_0x2d5334){var _0x5e61f0=typeof _0x5d745a[_0xb883('0x2e')]===_0xb883('0x2f')&&typeof _0x5d745a[_0xb883('0x30')]===_0xb883('0x2f');var _0x43ff90=_0x2d5334[_0xb883('0x31')];var _0x3e84f6=_0x5e61f0?0x0:_0x5d745a[_0xb883('0x2e')];var _0x490b74=_0x5e61f0?_0x2d5334[_0xb883('0x31')]:_0x5d745a['offset']+_0x5d745a[_0xb883('0x30')];var _0x2b148b;if(_0x490b74>=_0x43ff90){_0x490b74=_0x43ff90;_0x2b148b=0xc8;}else{_0x2b148b=0xce;}_0x41f97f[_0xb883('0x2b')](_0x2b148b);return _0x41f97f[_0xb883('0x32')]('Content-Range',_0x3e84f6+'-'+_0x490b74+'/'+_0x43ff90)['json'](_0x2d5334);}return null;};}function patchUpdates(_0x18e0f4){return function(_0x59efed){try{jsonpatch[_0xb883('0x33')](_0x59efed,_0x18e0f4,!![]);}catch(_0x52b9b9){return BPromise[_0xb883('0x34')](_0x52b9b9);}return _0x59efed[_0xb883('0x35')]();};}function saveUpdates(_0x53e8c0,_0x42f665){return function(_0x304552){if(_0x304552){return _0x304552[_0xb883('0x36')](_0x53e8c0)[_0xb883('0x21')](function(_0x68b3a9){return _0x68b3a9;});}return null;};}function removeEntity(_0x497cb7,_0x46fa44){return function(_0x4dafa3){if(_0x4dafa3){return _0x4dafa3[_0xb883('0x37')]()['then'](function(){var _0x331723=_0x4dafa3[_0xb883('0x38')]({'plain':!![]});var _0x5cc80f=_0xb883('0x39');return db[_0xb883('0x3a')][_0xb883('0x37')]({'where':{'type':_0x5cc80f,'resourceId':_0x331723['id']}})[_0xb883('0x21')](function(){return _0x4dafa3;});})[_0xb883('0x21')](function(){_0x497cb7[_0xb883('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f3a26,_0x1bd946){return function(_0x497ade){if(!_0x497ade){_0x5f3a26[_0xb883('0x2a')](0x194);}return _0x497ade;};}function handleError(_0x5b7f52,_0x394563){_0x394563=_0x394563||0x1f4;return function(_0x4af5a5){logger[_0xb883('0x27')](_0x4af5a5[_0xb883('0x3b')]);if(_0x4af5a5[_0xb883('0x3c')]){delete _0x4af5a5[_0xb883('0x3c')];}_0x5b7f52[_0xb883('0x2b')](_0x394563)[_0xb883('0x3d')](_0x4af5a5);};}exports[_0xb883('0x3e')]=function(_0x381606,_0x2554c4){var _0x208199={'include':[{'model':db[_0xb883('0x3f')],'as':'mandatoryDispositionPause'}]},_0x4d8b64={},_0x8abd51={'count':0x0,'rows':[]};var _0x4c564e=_['map'](db[_0xb883('0x40')][_0xb883('0x41')],function(_0x1554f8){return{'name':_0x1554f8['fieldName'],'type':_0x1554f8['type'][_0xb883('0x42')]};});_0x4d8b64[_0xb883('0x43')]=_[_0xb883('0x44')](_0x4c564e,_0xb883('0x3c'));_0x4d8b64[_0xb883('0x45')]=_[_0xb883('0x46')](_0x381606[_0xb883('0x45')]);_0x4d8b64[_0xb883('0x47')]=_[_0xb883('0x48')](_0x4d8b64[_0xb883('0x43')],_0x4d8b64[_0xb883('0x45')]);_0x208199[_0xb883('0x49')]=_['intersection'](_0x4d8b64['model'],qs[_0xb883('0x4a')](_0x381606['query']['fields']));_0x208199[_0xb883('0x49')]=_0x208199[_0xb883('0x49')][_0xb883('0x4b')]?_0x208199[_0xb883('0x49')]:_0x4d8b64[_0xb883('0x43')];if(!_0x381606['query'][_0xb883('0x4c')](_0xb883('0x4d'))){_0x208199['limit']=qs[_0xb883('0x30')](_0x381606[_0xb883('0x45')][_0xb883('0x30')]);_0x208199[_0xb883('0x2e')]=qs[_0xb883('0x2e')](_0x381606[_0xb883('0x45')][_0xb883('0x2e')]);}_0x208199[_0xb883('0x4e')]=qs[_0xb883('0x4f')](_0x381606['query'][_0xb883('0x4f')]);_0x208199[_0xb883('0x50')]=qs[_0xb883('0x47')](_[_0xb883('0x51')](_0x381606[_0xb883('0x45')],_0x4d8b64[_0xb883('0x47')]),_0x4c564e);if(_0x381606['query'][_0xb883('0x52')]){_0x208199[_0xb883('0x50')]=_[_0xb883('0x53')](_0x208199[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x4c564e,function(_0x46848c){if(_0x46848c['type']!=='VIRTUAL'){var _0x3927f4={};_0x3927f4[_0x46848c['name']]={'$like':'%'+_0x381606['query'][_0xb883('0x52')]+'%'};return _0x3927f4;}})});}_0x208199=_['merge']({},_0x208199,_0x381606[_0xb883('0x54')]);var _0x13553b={'where':_0x208199[_0xb883('0x50')]};return db['WhatsappAccount']['count'](_0x13553b)[_0xb883('0x21')](function(_0x42a4a1){_0x8abd51[_0xb883('0x31')]=_0x42a4a1;if(_0x381606[_0xb883('0x45')]['includeAll']){_0x208199[_0xb883('0x55')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xb883('0x56')](_0x208199);})[_0xb883('0x21')](function(_0x1e9f09){_0x8abd51[_0xb883('0x57')]=_0x1e9f09;return _0x8abd51;})[_0xb883('0x21')](respondWithFilteredResult(_0x2554c4,_0x208199))[_0xb883('0x58')](handleError(_0x2554c4,null));};exports[_0xb883('0x59')]=function(_0x3842cd,_0xaabf19){var _0x41253b={'raw':![],'where':{'id':_0x3842cd['params']['id']},'include':[{'model':db[_0xb883('0x3f')],'as':'mandatoryDispositionPause'}]},_0x590cfe={};_0x590cfe[_0xb883('0x43')]=_[_0xb883('0x46')](db[_0xb883('0x40')][_0xb883('0x41')]);_0x590cfe[_0xb883('0x45')]=_[_0xb883('0x46')](_0x3842cd[_0xb883('0x45')]);_0x590cfe['filters']=_['intersection'](_0x590cfe[_0xb883('0x43')],_0x590cfe[_0xb883('0x45')]);_0x41253b['attributes']=_[_0xb883('0x48')](_0x590cfe[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x3842cd[_0xb883('0x45')][_0xb883('0x4a')]));_0x41253b[_0xb883('0x49')]=_0x41253b[_0xb883('0x49')][_0xb883('0x4b')]?_0x41253b[_0xb883('0x49')]:_0x590cfe[_0xb883('0x43')];if(_0x3842cd[_0xb883('0x45')][_0xb883('0x5a')]){_0x41253b[_0xb883('0x55')]=[{'all':!![]}];}_0x41253b=_[_0xb883('0x53')]({},_0x41253b,_0x3842cd['options']);return db['WhatsappAccount']['find'](_0x41253b)[_0xb883('0x21')](handleEntityNotFound(_0xaabf19,null))['then'](respondWithResult(_0xaabf19,null))[_0xb883('0x58')](handleError(_0xaabf19,null));};exports[_0xb883('0x5b')]=function(_0x119887,_0x661786){return db['WhatsappAccount'][_0xb883('0x5b')](_0x119887[_0xb883('0x5c')],{})[_0xb883('0x21')](function(_0x2d61cf){var _0x318778=_0x119887[_0xb883('0x5d')]['get']({'plain':!![]});if(!_0x318778)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x318778['role']===_0xb883('0x5d')){var _0x5066c8=_0x2d61cf['get']({'plain':!![]});var _0x1c772b=_0xb883('0x39');return db[_0xb883('0x5e')][_0xb883('0x5f')]({'where':{'name':_0x1c772b,'userProfileId':_0x318778[_0xb883('0x60')]},'raw':!![]})[_0xb883('0x21')](function(_0x56d7e9){if(_0x56d7e9&&_0x56d7e9[_0xb883('0x61')]===0x0){return db[_0xb883('0x3a')]['create']({'name':_0x5066c8[_0xb883('0x3c')],'resourceId':_0x5066c8['id'],'type':_0x56d7e9[_0xb883('0x3c')],'sectionId':_0x56d7e9['id']},{})['then'](function(){return _0x2d61cf;});}else{return _0x2d61cf;}})[_0xb883('0x58')](function(_0x374d95){logger['error'](_0xb883('0x62'),_0x374d95);throw _0x374d95;});}return _0x2d61cf;})[_0xb883('0x21')](respondWithResult(_0x661786,0xc9))['catch'](handleError(_0x661786,null));};exports[_0xb883('0x36')]=function(_0x328930,_0xfb9e53){if(_0x328930[_0xb883('0x5c')]['id']){delete _0x328930[_0xb883('0x5c')]['id'];}return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x328930[_0xb883('0x63')]['id']},'include':[{'model':db[_0xb883('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xb883('0x21')](handleEntityNotFound(_0xfb9e53,null))[_0xb883('0x21')](saveUpdates(_0x328930[_0xb883('0x5c')],null))['then'](respondWithResult(_0xfb9e53,null))['catch'](handleError(_0xfb9e53,null));};exports['destroy']=function(_0x357b4e,_0x7deda8){return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x357b4e[_0xb883('0x63')]['id']}})['then'](handleEntityNotFound(_0x7deda8,null))[_0xb883('0x21')](removeEntity(_0x7deda8,null))[_0xb883('0x58')](handleError(_0x7deda8,null));};exports[_0xb883('0x64')]=function(_0x45a5a1,_0x536534){return db[_0xb883('0x40')][_0xb883('0x64')]()[_0xb883('0x21')](respondWithResult(_0x536534,null))[_0xb883('0x58')](handleError(_0x536534,null));};exports[_0xb883('0x65')]=function(_0xa1b005,_0x170920,_0x290784){if(_0xa1b005[_0xb883('0x5c')]['id']){delete _0xa1b005[_0xb883('0x5c')]['id'];}return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0xa1b005[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x170920,null))['then'](function(_0xa11cae){if(_0xa11cae){_0xa1b005['body']['WhatsappAccountId']=_0xa11cae['id'];return db[_0xb883('0x66')][_0xb883('0x5b')](_0xa1b005['body']);}})[_0xb883('0x21')](respondWithResult(_0x170920,null))[_0xb883('0x58')](handleError(_0x170920,null));};exports['getDispositions']=function(_0x4a8746,_0x480d5a,_0x526633){var _0x32dc53={'raw':![],'where':{}};var _0x10f380={};var _0x385b94={'count':0x0,'rows':[]};return db[_0xb883('0x40')][_0xb883('0x67')]({'where':{'id':_0x4a8746['params']['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x480d5a,null))[_0xb883('0x21')](function(_0x5bbfb5){if(_0x5bbfb5){_0x10f380[_0xb883('0x43')]=_[_0xb883('0x46')](db[_0xb883('0x66')][_0xb883('0x41')]);_0x10f380[_0xb883('0x45')]=_['keys'](_0x4a8746[_0xb883('0x45')]);_0x10f380[_0xb883('0x47')]=_[_0xb883('0x48')](_0x10f380[_0xb883('0x43')],_0x10f380['query']);_0x32dc53[_0xb883('0x49')]=_[_0xb883('0x48')](_0x10f380[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x4a8746['query'][_0xb883('0x4a')]));_0x32dc53['attributes']=_0x32dc53[_0xb883('0x49')]['length']?_0x32dc53['attributes']:_0x10f380[_0xb883('0x43')];if(!_0x4a8746['query'][_0xb883('0x4c')](_0xb883('0x4d'))){_0x32dc53['limit']=qs[_0xb883('0x30')](_0x4a8746[_0xb883('0x45')][_0xb883('0x30')]);_0x32dc53[_0xb883('0x2e')]=qs[_0xb883('0x2e')](_0x4a8746[_0xb883('0x45')]['offset']);}_0x32dc53[_0xb883('0x4e')]=qs[_0xb883('0x4f')](_0x4a8746['query'][_0xb883('0x4f')]);_0x32dc53[_0xb883('0x50')]=qs[_0xb883('0x47')](_[_0xb883('0x51')](_0x4a8746[_0xb883('0x45')],_0x10f380[_0xb883('0x47')]));_0x32dc53[_0xb883('0x50')][_0xb883('0x68')]=_0x5bbfb5['id'];if(_0x4a8746[_0xb883('0x45')][_0xb883('0x52')]){_0x32dc53['where']=_['merge'](_0x32dc53[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x32dc53[_0xb883('0x49')],function(_0x45116b){var _0x330d38={};_0x330d38[_0x45116b]={'$like':'%'+_0x4a8746[_0xb883('0x45')][_0xb883('0x52')]+'%'};return _0x330d38;})});}_0x32dc53=_[_0xb883('0x53')]({},_0x32dc53,_0x4a8746[_0xb883('0x54')]);return db['Disposition'][_0xb883('0x31')]({'where':_0x32dc53[_0xb883('0x50')]})['then'](function(_0x270da5){_0x385b94[_0xb883('0x31')]=_0x270da5;if(_0x4a8746[_0xb883('0x45')][_0xb883('0x5a')]){_0x32dc53['include']=[{'all':!![]}];}return db[_0xb883('0x66')][_0xb883('0x56')](_0x32dc53);})[_0xb883('0x21')](function(_0x395c0d){_0x385b94['rows']=_0x395c0d;return _0x385b94;});}})[_0xb883('0x21')](respondWithFilteredResult(_0x480d5a,_0x32dc53))[_0xb883('0x58')](handleError(_0x480d5a,null));};exports[_0xb883('0x69')]=function(_0x136b4e,_0xceb527,_0x2fe9f9){return db[_0xb883('0x40')]['find']({'where':{'id':_0x136b4e[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0xceb527,null))[_0xb883('0x21')](function(_0x4ac6df){if(_0x4ac6df){return _0x4ac6df[_0xb883('0x69')](_0x136b4e[_0xb883('0x45')][_0xb883('0x6a')]);}})[_0xb883('0x21')](respondWithStatusCode(_0xceb527,null))[_0xb883('0x58')](handleError(_0xceb527,null));};exports[_0xb883('0x6b')]=function(_0x3763d4,_0x390839,_0x1877af){if(_0x3763d4[_0xb883('0x5c')]['id']){delete _0x3763d4[_0xb883('0x5c')]['id'];}return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x3763d4[_0xb883('0x63')]['id']}})['then'](handleEntityNotFound(_0x390839,null))[_0xb883('0x21')](function(_0x10f9f6){if(_0x10f9f6){_0x3763d4[_0xb883('0x5c')]['WhatsappAccountId']=_0x10f9f6['id'];return db['CannedAnswer'][_0xb883('0x5b')](_0x3763d4['body']);}})[_0xb883('0x21')](respondWithResult(_0x390839,null))[_0xb883('0x58')](handleError(_0x390839,null));};exports['getAnswers']=function(_0x448fe7,_0x1f63fd,_0x5e396c){var _0x3ea7b9={'raw':![],'where':{}};var _0x34458b={};var _0x18d0e2={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xb883('0x67')]({'where':{'id':_0x448fe7[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x1f63fd,null))[_0xb883('0x21')](function(_0x477bc4){if(_0x477bc4){_0x34458b['model']=_[_0xb883('0x46')](db[_0xb883('0x6c')][_0xb883('0x41')]);_0x34458b[_0xb883('0x45')]=_[_0xb883('0x46')](_0x448fe7[_0xb883('0x45')]);_0x34458b[_0xb883('0x47')]=_[_0xb883('0x48')](_0x34458b[_0xb883('0x43')],_0x34458b[_0xb883('0x45')]);_0x3ea7b9[_0xb883('0x49')]=_[_0xb883('0x48')](_0x34458b[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x448fe7[_0xb883('0x45')][_0xb883('0x4a')]));_0x3ea7b9['attributes']=_0x3ea7b9['attributes']['length']?_0x3ea7b9[_0xb883('0x49')]:_0x34458b[_0xb883('0x43')];if(!_0x448fe7[_0xb883('0x45')][_0xb883('0x4c')](_0xb883('0x4d'))){_0x3ea7b9[_0xb883('0x30')]=qs[_0xb883('0x30')](_0x448fe7[_0xb883('0x45')][_0xb883('0x30')]);_0x3ea7b9[_0xb883('0x2e')]=qs[_0xb883('0x2e')](_0x448fe7['query']['offset']);}_0x3ea7b9[_0xb883('0x4e')]=qs['sort'](_0x448fe7[_0xb883('0x45')][_0xb883('0x4f')]);_0x3ea7b9[_0xb883('0x50')]=qs['filters'](_[_0xb883('0x51')](_0x448fe7['query'],_0x34458b['filters']));_0x3ea7b9['where'][_0xb883('0x68')]=_0x477bc4['id'];if(_0x448fe7[_0xb883('0x45')]['filter']){_0x3ea7b9[_0xb883('0x50')]=_[_0xb883('0x53')](_0x3ea7b9[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x3ea7b9[_0xb883('0x49')],function(_0xf6093){var _0x377354={};_0x377354[_0xf6093]={'$like':'%'+_0x448fe7['query'][_0xb883('0x52')]+'%'};return _0x377354;})});}_0x3ea7b9=_['merge']({},_0x3ea7b9,_0x448fe7['options']);return db[_0xb883('0x6c')][_0xb883('0x31')]({'where':_0x3ea7b9[_0xb883('0x50')]})['then'](function(_0x1428f5){_0x18d0e2[_0xb883('0x31')]=_0x1428f5;if(_0x448fe7[_0xb883('0x45')]['includeAll']){_0x3ea7b9[_0xb883('0x55')]=[{'all':!![]}];}return db[_0xb883('0x6c')]['findAll'](_0x3ea7b9);})['then'](function(_0x5851be){_0x18d0e2[_0xb883('0x57')]=_0x5851be;return _0x18d0e2;});}})[_0xb883('0x21')](respondWithFilteredResult(_0x1f63fd,_0x3ea7b9))['catch'](handleError(_0x1f63fd,null));};exports[_0xb883('0x6d')]=function(_0x120998,_0x2102cb,_0x22c64b){return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x120998[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x2102cb,null))[_0xb883('0x21')](function(_0x544263){if(_0x544263){return _0x544263['removeAnswers'](_0x120998[_0xb883('0x45')][_0xb883('0x6a')]);}})[_0xb883('0x21')](respondWithStatusCode(_0x2102cb,null))['catch'](handleError(_0x2102cb,null));};exports[_0xb883('0x6e')]=function(_0x2231ac,_0x3071b8,_0x5ba584){return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x2231ac[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x3071b8,null))[_0xb883('0x21')](function(_0x2e68d3){if(_0x2e68d3){return _0x2e68d3[_0xb883('0x6e')](_0x2231ac['body'][_0xb883('0x6a')],_['omit'](_0x2231ac[_0xb883('0x5c')],[_0xb883('0x6a'),'id'])||{})[_0xb883('0x6f')](function(_0x4e46e5){for(var _0x390808=0x0;_0x390808<_0x2231ac[_0xb883('0x5c')][_0xb883('0x6a')][_0xb883('0x4b')];_0x390808+=0x1){socket[_0xb883('0x70')](_0xb883('0x71'),{'UserId':Number(_0x2231ac[_0xb883('0x5c')][_0xb883('0x6a')][_0x390808]),'WhatsappAccountId':Number(_0x2231ac[_0xb883('0x63')]['id'])});}return _0x4e46e5;});}})['then'](respondWithResult(_0x3071b8,null))[_0xb883('0x58')](handleError(_0x3071b8,null));};exports[_0xb883('0x72')]=function(_0x11131f,_0x57b760,_0x41f224){return db['WhatsappAccount'][_0xb883('0x5f')]({'where':{'id':_0x11131f[_0xb883('0x63')]['id']}})['then'](handleEntityNotFound(_0x57b760,null))[_0xb883('0x21')](function(_0x3d93c5){if(_0x3d93c5){return _0x3d93c5['removeAgents'](_0x11131f['query'][_0xb883('0x6a')])[_0xb883('0x21')](function(){if(_[_0xb883('0x73')](_0x11131f[_0xb883('0x45')][_0xb883('0x6a')])){for(var _0x32f1e6=0x0;_0x32f1e6<_0x11131f[_0xb883('0x45')][_0xb883('0x6a')][_0xb883('0x4b')];_0x32f1e6+=0x1){socket['emit'](_0xb883('0x74'),{'UserId':Number(_0x11131f[_0xb883('0x45')][_0xb883('0x6a')][_0x32f1e6]),'WhatsappAccountId':Number(_0x11131f[_0xb883('0x63')]['id'])});}}else{socket[_0xb883('0x70')](_0xb883('0x74'),{'UserId':Number(_0x11131f[_0xb883('0x45')]['ids']),'WhatsappAccountId':Number(_0x11131f['params']['id'])});}});}})[_0xb883('0x21')](respondWithStatusCode(_0x57b760,null))['catch'](handleError(_0x57b760,null));};exports[_0xb883('0x75')]=function(_0x236910,_0x5e6804,_0x4da4be){var _0x7c402c={};var _0x569dbe={};var _0x49f073;var _0x143a7f;return db[_0xb883('0x40')]['findOne']({'where':{'id':_0x236910[_0xb883('0x63')]['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x5e6804,null))[_0xb883('0x21')](function(_0x4d026c){if(_0x4d026c){_0x49f073=_0x4d026c;_0x569dbe[_0xb883('0x43')]=_[_0xb883('0x46')](db['User'][_0xb883('0x41')]);_0x569dbe[_0xb883('0x45')]=_[_0xb883('0x46')](_0x236910[_0xb883('0x45')]);_0x569dbe['filters']=_['intersection'](_0x569dbe[_0xb883('0x43')],_0x569dbe[_0xb883('0x45')]);_0x7c402c['attributes']=_['intersection'](_0x569dbe[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x236910[_0xb883('0x45')][_0xb883('0x4a')]));_0x7c402c[_0xb883('0x49')]=_0x7c402c[_0xb883('0x49')]['length']?_0x7c402c[_0xb883('0x49')]:_0x569dbe[_0xb883('0x43')];_0x7c402c['order']=qs['sort'](_0x236910[_0xb883('0x45')]['sort']);_0x7c402c['where']=qs[_0xb883('0x47')](_[_0xb883('0x51')](_0x236910[_0xb883('0x45')],_0x569dbe[_0xb883('0x47')]));if(_0x236910['query'][_0xb883('0x52')]){_0x7c402c['where']=_[_0xb883('0x53')](_0x7c402c[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x7c402c[_0xb883('0x49')],function(_0x409cff){var _0x19b9cb={};_0x19b9cb[_0x409cff]={'$like':'%'+_0x236910[_0xb883('0x45')][_0xb883('0x52')]+'%'};return _0x19b9cb;})});}_0x7c402c=_[_0xb883('0x53')]({},_0x7c402c,_0x236910[_0xb883('0x54')]);return _0x49f073['getAgents'](_0x7c402c);}})[_0xb883('0x21')](function(_0x169cc3){if(_0x169cc3){_0x143a7f=_0x169cc3['length'];if(!_0x236910['query'][_0xb883('0x4c')](_0xb883('0x4d'))){_0x7c402c[_0xb883('0x30')]=qs[_0xb883('0x30')](_0x236910[_0xb883('0x45')][_0xb883('0x30')]);_0x7c402c[_0xb883('0x2e')]=qs['offset'](_0x236910[_0xb883('0x45')][_0xb883('0x2e')]);}return _0x49f073[_0xb883('0x75')](_0x7c402c);}})[_0xb883('0x21')](function(_0x318ffd){if(_0x318ffd){return _0x318ffd?{'count':_0x143a7f,'rows':_0x318ffd}:null;}})[_0xb883('0x21')](respondWithResult(_0x5e6804,null))[_0xb883('0x58')](handleError(_0x5e6804,null));};exports['addApplications']=function(_0x5f2839,_0x2139a1){var _0x492522=_0x5f2839[_0xb883('0x63')]['id'];var _0x55284a=_0x5f2839[_0xb883('0x5c')];var _0x5ce28f=0xc8;var _0x2b64fd=null;return db[_0xb883('0x76')][_0xb883('0x77')]({'isolationLevel':db[_0xb883('0x76')][_0xb883('0x78')][_0xb883('0x79')][_0xb883('0x7a')]},function(_0x1f6fda){return db[_0xb883('0x40')][_0xb883('0x67')]({'where':{'id':_0x492522},'transaction':_0x1f6fda})[_0xb883('0x21')](function(_0x39fbf1){if(_0x39fbf1){return db[_0xb883('0x7b')]['destroy']({'where':{'WhatsappAccountId':_0x492522},'transaction':_0x1f6fda})[_0xb883('0x21')](function(){var _0x578316=_[_0xb883('0x44')](_0x55284a,function(_0x3efeca){_0x3efeca['WhatsappAccountId']=_0x492522;return _0x3efeca;});return db[_0xb883('0x7b')][_0xb883('0x7c')](_0x578316,{'transaction':_0x1f6fda});});}else{_0x5ce28f=0x194;_0x2b64fd=[];}});})[_0xb883('0x21')](function(){if(_0x5ce28f!==0x194){return db[_0xb883('0x7b')][_0xb883('0x7d')]({'where':{'WhatsappAccountId':_0x492522},'order':_0xb883('0x7e')})[_0xb883('0x21')](function(_0x3148f5){_0x2b64fd=_0x3148f5;});}})[_0xb883('0x58')](function(_0x47fce0){_0x5ce28f=0x1f4;logger[_0xb883('0x27')](_0x47fce0[_0xb883('0x3b')]);if(_0x47fce0[_0xb883('0x3c')]){delete _0x47fce0['name'];}_0x2b64fd=_0x47fce0;})[_0xb883('0x7f')](function(){if(_0x2b64fd===null){_0x2139a1[_0xb883('0x2a')](_0x5ce28f);}else{if(_0x5ce28f===0x1f4){_0x2139a1[_0xb883('0x2b')](_0x5ce28f)['send'](_0x2b64fd);}else{_0x2139a1[_0xb883('0x2b')](_0x5ce28f)[_0xb883('0x2d')](_0x2b64fd);}}});};exports[_0xb883('0x80')]=function(_0x1e597f,_0x59b776,_0x5b73f0){var _0x29d63a={};var _0x39a150={};var _0xcd5294;var _0xdd1135;return db[_0xb883('0x40')]['findOne']({'where':{'id':_0x1e597f['params']['id']}})[_0xb883('0x21')](handleEntityNotFound(_0x59b776,null))[_0xb883('0x21')](function(_0x4345a5){if(_0x4345a5){_0xcd5294=_0x4345a5;_0x39a150['model']=_['keys'](db[_0xb883('0x7b')][_0xb883('0x41')]);_0x39a150['query']=_[_0xb883('0x46')](_0x1e597f['query']);_0x39a150[_0xb883('0x47')]=_[_0xb883('0x48')](_0x39a150[_0xb883('0x43')],_0x39a150['query']);_0x29d63a[_0xb883('0x49')]=_[_0xb883('0x48')](_0x39a150[_0xb883('0x43')],qs[_0xb883('0x4a')](_0x1e597f['query'][_0xb883('0x4a')]));_0x29d63a[_0xb883('0x49')]=_0x29d63a[_0xb883('0x49')]['length']?_0x29d63a[_0xb883('0x49')]:_0x39a150[_0xb883('0x43')];_0x29d63a['order']=qs[_0xb883('0x4f')](_0x1e597f[_0xb883('0x45')]['sort']);_0x29d63a[_0xb883('0x50')]=qs['filters'](_[_0xb883('0x51')](_0x1e597f[_0xb883('0x45')],_0x39a150[_0xb883('0x47')]));if(_0x1e597f[_0xb883('0x45')][_0xb883('0x52')]){_0x29d63a['where']=_[_0xb883('0x53')](_0x29d63a[_0xb883('0x50')],{'$or':_[_0xb883('0x44')](_0x29d63a[_0xb883('0x49')],function(_0x45ca1a){var _0x2a1584={};_0x2a1584[_0x45ca1a]={'$like':'%'+_0x1e597f[_0xb883('0x45')][_0xb883('0x52')]+'%'};return _0x2a1584;})});}_0x29d63a=_[_0xb883('0x53')]({},_0x29d63a,_0x1e597f[_0xb883('0x54')]);return _0xcd5294[_0xb883('0x80')](_0x29d63a);}})[_0xb883('0x21')](function(_0x1816b5){if(_0x1816b5){_0xdd1135=_0x1816b5[_0xb883('0x4b')];if(!_0x1e597f[_0xb883('0x45')][_0xb883('0x4c')]('nolimit')){_0x29d63a[_0xb883('0x30')]=qs[_0xb883('0x30')](_0x1e597f[_0xb883('0x45')][_0xb883('0x30')]);_0x29d63a[_0xb883('0x2e')]=qs['offset'](_0x1e597f[_0xb883('0x45')][_0xb883('0x2e')]);}return _0xcd5294[_0xb883('0x80')](_0x29d63a);}})[_0xb883('0x21')](function(_0x177c6c){if(_0x177c6c){return _0x177c6c?{'count':_0xdd1135,'rows':_0x177c6c}:null;}})[_0xb883('0x21')](respondWithResult(_0x59b776,null))[_0xb883('0x58')](handleError(_0x59b776,null));};exports[_0xb883('0x81')]=function(_0x4fa7f5,_0x51081c,_0x2d2401){var _0x5f4e8d={'channel':'whatsapp'};var _0x2b5ddc=[];var _0x3063aa=[];var _0x537542={};return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x4fa7f5[_0xb883('0x63')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0xb883('0x82')}]})[_0xb883('0x21')](handleEntityNotFound(_0x51081c,null))['then'](function(_0x4fd52f){_0x5f4e8d['account']=_0x4fd52f;if(_0x5f4e8d[_0xb883('0x83')]&&_0x5f4e8d[_0xb883('0x83')]['type']===_0xb883('0x84')&&_0x4fa7f5[_0xb883('0x5c')]['statuses']){if(_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x85')]['length']===0x0)return;if(_0x4fa7f5[_0xb883('0x5c')]['statuses'][0x0]['state']!==_0xb883('0x86'))return;return db['WhatsappMessage'][_0xb883('0x36')]({'read':!![],'readAt':_0x4fa7f5[_0xb883('0x5c')]['statuses'][0x0]['timestamp']},{'where':{'messageId':_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x85')][0x0][_0xb883('0x87')]},'individualHooks':!![]})['then'](function(_0x3d7374){return _0x51081c[_0xb883('0x2b')](0xc8)[_0xb883('0x2d')](_0x3d7374);});}_0x5f4e8d[_0xb883('0x88')]=_['orderBy'](_0x4fd52f['Applications'],['priority'],[_0xb883('0x89')]);if(_0x5f4e8d['account'][_0xb883('0x82')]){delete _0x5f4e8d['account']['Applications'];}return db['CmContact'][_0xb883('0x64')]()[_0xb883('0x21')](function(_0x5e648e){if(!_0x5e648e){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))]('no\x20available\x20attributes');}_0x2b5ddc=_[_0xb883('0x8c')](_[_0xb883('0x46')](_0x5e648e),['createdAt',_0xb883('0x8d')]);_0x3063aa=_[_0xb883('0x8c')](_['keys'](_0x5e648e),[_0xb883('0x8e'),_0xb883('0x8d'),_0xb883('0x8f'),_0xb883('0x90')]);_0x5f4e8d[_0xb883('0x5c')]={'mapKey':'mobile'};if(_0x5f4e8d[_0xb883('0x83')]&&_0x5f4e8d[_0xb883('0x83')][_0xb883('0x91')]===_0xb883('0x92')){_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')]=_0x4fa7f5[_0xb883('0x5c')]['From'][_0xb883('0x94')](_0xb883('0x95'),'');_0x5f4e8d['body'][_0xb883('0x5c')]=_0x4fa7f5[_0xb883('0x5c')]['Body'];_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x96')]=_0x4fa7f5[_0xb883('0x5c')]['MessageSid'];}if(_0x5f4e8d[_0xb883('0x83')]&&_0x5f4e8d[_0xb883('0x83')][_0xb883('0x91')]===_0xb883('0x84')){_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')]=_0x4fa7f5[_0xb883('0x5c')]['notifications'][0x0][_0xb883('0x93')];_0x5f4e8d['body'][_0xb883('0x5c')]=_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x97')][0x0][_0xb883('0x28')]['body'];_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x96')]=_0x4fa7f5[_0xb883('0x5c')][_0xb883('0x97')][0x0]['message_id'];}if(_0x5f4e8d[_0xb883('0x5c')]['id']){delete _0x5f4e8d[_0xb883('0x5c')]['id'];}if(_[_0xb883('0x98')](_0x5f4e8d[_0xb883('0x5c')]['from'])){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))](_0xb883('0x99'));}if(_[_0xb883('0x98')](_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x5c')])||_0x5f4e8d[_0xb883('0x5c')]['body']===''){throw new db['Sequelize'][(_0xb883('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x5f4e8d[_0xb883('0x5c')]['mapKey'])){throw new db[(_0xb883('0x8a'))]['ValidationError'](_0xb883('0x9a')+_0x3063aa);}if(!_['includes'](_0x3063aa,_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x9b')])){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))](_0xb883('0x9c')+_0x3063aa);}_0x537542[_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x9b')]]=_0x5f4e8d['body'][_0xb883('0x93')];return db['CmList'][_0xb883('0x5f')]({'where':{'id':_0x5f4e8d[_0xb883('0x83')]['ListId']},'include':[{'model':db[_0xb883('0x9d')],'as':'Contacts','where':_0x537542,'limit':0x1,'order':[[_0xb883('0x8d'),_0xb883('0x9e')]]}]});})[_0xb883('0x21')](handleEntityNotFound(_0x51081c,null))[_0xb883('0x21')](function(_0x40f7a8){if(_0x40f7a8){_0x5f4e8d[_0xb883('0x9f')]=_[_0xb883('0xa0')](_0x40f7a8,['Contacts']);if(_0x40f7a8[_0xb883('0xa1')][_0xb883('0x4b')]){return _0x40f7a8[_0xb883('0xa1')][0x0];}var _0x1c4091=_['defaults'](_0x5f4e8d['body'],{'firstName':_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')],'ListId':_0x40f7a8['id']});_0x1c4091[_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x9b')]]=_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x93')];return db[_0xb883('0x9d')][_0xb883('0x5b')](_0x1c4091,{'fields':_0x2b5ddc,'raw':!![]});}})[_0xb883('0x21')](handleEntityNotFound(_0x51081c,null))[_0xb883('0x21')](function(_0x1f5ee8){if(_0x1f5ee8){_0x5f4e8d[_0xb883('0xa2')]=_0x1f5ee8;var _0x3a157d={'ContactId':_0x1f5ee8['id'],'phone':_0x5f4e8d['body'][_0xb883('0x93')],'WhatsappAccountId':_0x4fa7f5[_0xb883('0x63')]['id']};var _0x4e417c={'ContactId':_0x1f5ee8['id'],'WhatsappAccountId':_0x4fa7f5[_0xb883('0x63')]['id'],'closed':![]};return db[_0xb883('0xa3')][_0xb883('0x5f')]({'where':_0x4e417c})[_0xb883('0x21')](function(_0x344a9f){if(_0x344a9f){return[_0x344a9f,![]];}return db[_0xb883('0xa3')]['create'](_0x3a157d)['then'](function(_0x1b059e){return[_0x1b059e,!![]];});});}})[_0xb883('0x6f')](function(_0x3e2a2f,_0x322b58){_0x5f4e8d[_0xb883('0xa4')]=_0x3e2a2f[_0xb883('0x38')]({'plain':!![]});_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xa5')]=![];if(_0x322b58){if(_0x5f4e8d[_0xb883('0x83')][_0xb883('0xa6')]){_0x5f4e8d['applications'][_0xb883('0xa7')]({'id':0x0,'priority':_0x5f4e8d[_0xb883('0x88')][_0xb883('0x4b')]+0x1,'app':'close','appdata':_0xb883('0xa8'),'interval':_0xb883('0xa9')});}_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xa5')]=!![];}return db['WhatsappMessage'][_0xb883('0x5b')]({'phone':_0x5f4e8d['body'][_0xb883('0x93')],'messageId':_0x5f4e8d['body'][_0xb883('0x96')],'body':_0x5f4e8d[_0xb883('0x5c')][_0xb883('0x5c')],'WhatsappAccountId':_0x4fa7f5[_0xb883('0x63')]['id'],'WhatsappInteractionId':_0x3e2a2f['id'],'direction':'in','ContactId':_0x3e2a2f[_0xb883('0xaa')],'AttachmentId':_0x5f4e8d['body'][_0xb883('0xab')]});})[_0xb883('0x21')](function(_0x2f9e3a){_0x5f4e8d['message']=_0x2f9e3a;if(!_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xac')])return;return db['User'][_0xb883('0x5f')]({'attributes':['id',_0xb883('0x3c')],'where':{'id':_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xac')]}});})[_0xb883('0x21')](function(_0x2d7a28){if(_0x2d7a28){_0x5f4e8d[_0xb883('0x88')][_0xb883('0xad')]({'id':0x0,'priority':0x0,'app':_0xb883('0xae'),'appdata':_0x2d7a28[_0xb883('0x3c')]+','+(_0x5f4e8d[_0xb883('0x83')][_0xb883('0xaf')]||0xa),'interval':_0xb883('0xa9')});}if(!_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xb0')])return;return db[_0xb883('0xb1')][_0xb883('0x5f')]({'attributes':['id',_0xb883('0x3c')],'where':{'id':_0x5f4e8d[_0xb883('0xa4')][_0xb883('0xb0')]}});})[_0xb883('0x21')](function(_0x301dd2){if(_0x301dd2){_0x5f4e8d[_0xb883('0x88')][_0xb883('0xad')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x301dd2[_0xb883('0x3c')]+','+(_0x5f4e8d[_0xb883('0x83')]['waitForTheAssignedQueue']||0x12c),'interval':_0xb883('0xa9')});}return respondWithRpcPromise(_0xb883('0xb2'),_0xb883('0xb3'),_0x5f4e8d);})[_0xb883('0x21')](function(_0x13e2fc){if(_0x13e2fc){var _0xfecc5a=0xc8;var _0xf20f9d='receiveMessage';logger[_0xb883('0x22')](_0xb883('0xb4'),_0xf20f9d,_0xfecc5a,_0xb883('0xb5'));logger[_0xb883('0x25')](_0xb883('0xb6'),_0xf20f9d,_0xfecc5a,_0xb883('0xb5'),JSON[_0xb883('0x26')](_0x13e2fc));if(_0x5f4e8d[_0xb883('0x83')][_0xb883('0x91')]===_0xb883('0x92')){return _0x51081c[_0xb883('0x2b')](_0xfecc5a)[_0xb883('0x32')](_0xb883('0xb7'),_0xb883('0xb8'))[_0xb883('0x3d')](_0xb883('0xb9'));}else{return _0x51081c[_0xb883('0x2b')](_0xfecc5a)['json'](_0x13e2fc);}}});})[_0xb883('0x58')](handleError(_0x51081c,null));};exports[_0xb883('0x3d')]=function(_0x4e2164,_0x1c6456,_0x475c2a){var _0x2d9ad1,_0x3772e1,_0x5d17d6;if(_['isNil'](_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')])||_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')]===''){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x4e2164[_0xb883('0x5c')]['to'])){throw new db[(_0xb883('0x8a'))][(_0xb883('0x8b'))](_0xb883('0xba'));}_0x2d9ad1=_0x4e2164[_0xb883('0x5c')]['to'];return db[_0xb883('0x40')][_0xb883('0x5f')]({'where':{'id':_0x4e2164[_0xb883('0x63')]['id']},'include':[{'model':db[_0xb883('0xbb')],'as':_0xb883('0xbc'),'include':[{'model':db[_0xb883('0x9d')],'as':'Contacts','where':{'mobile':_0x2d9ad1},'limit':0x1,'order':[[_0xb883('0x8d'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x1c6456,null))['then'](function(_0x26992a){if(_0x26992a&&_0x26992a[_0xb883('0xbc')]){_0x3772e1=_0x26992a[_0xb883('0x38')]({'plain':!![]});if(_0x3772e1[_0xb883('0xbc')]&&_0x3772e1[_0xb883('0xbc')][_0xb883('0xa1')][_0xb883('0x4b')]){return _0x3772e1[_0xb883('0xbc')]['Contacts'][0x0];}return db['CmContact'][_0xb883('0x5b')](_[_0xb883('0xbd')](_0x4e2164[_0xb883('0x5c')],{'firstName':_0x2d9ad1,'mobile':_0x2d9ad1,'phone':_0x2d9ad1,'ListId':_0x3772e1[_0xb883('0x90')]}));}})['then'](handleEntityNotFound(_0x1c6456,null))[_0xb883('0x21')](function(_0xe9cfd8){if(_0xe9cfd8){_0x5d17d6=_0xe9cfd8;return db[_0xb883('0xa3')][_0xb883('0x5f')]({'where':{'ContactId':_0x5d17d6['id'],'closed':![],'WhatsappAccountId':_0x3772e1['id']}})['then'](function(_0x36ee49){if(_0x36ee49){return[_0x36ee49,![]];}return db[_0xb883('0xa3')][_0xb883('0x5b')]({'UserId':_0x4e2164[_0xb883('0x5d')]['id'],'ContactId':_0x5d17d6['id'],'WhatsappAccountId':_0x3772e1['id'],'phone':_0x2d9ad1,'firstMsgDirection':_0xb883('0xbe'),'Messages':[_['merge'](_0x4e2164[_0xb883('0x5c')],{'read':![],'body':_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')],'phone':_0x2d9ad1,'WhatsappAccountId':_0x3772e1['id'],'UserId':_0x4e2164[_0xb883('0x5d')]['id'],'ContactId':_0x5d17d6['id']})]},{'include':[{'model':db[_0xb883('0xbf')],'as':_0xb883('0xc0')}]})[_0xb883('0x21')](function(_0x2db8bf){return[_0x2db8bf,!![]];});});}})[_0xb883('0x6f')](function(_0x5b9f0b,_0x1088a9){if(_0x1088a9){return _0x5b9f0b;}return db[_0xb883('0xbf')][_0xb883('0x5b')](_[_0xb883('0x53')](_0x4e2164['body'],{'read':![],'body':_0x4e2164[_0xb883('0x5c')][_0xb883('0x5c')],'phone':_0x2d9ad1,'WhatsappAccountId':_0x3772e1['id'],'WhatsappInteractionId':_0x5b9f0b['id'],'UserId':_0x4e2164[_0xb883('0x5d')]['id'],'ContactId':_0x5d17d6['id']}))[_0xb883('0x21')](function(_0x352214){_0x5b9f0b[_0xb883('0xc1')][_0xb883('0xc0')]=[];_0x5b9f0b['dataValues'][_0xb883('0xc0')][_0xb883('0xa7')](_0x352214['dataValues']);return _0x5b9f0b;});})[_0xb883('0x21')](respondWithResult(_0x1c6456,null))[_0xb883('0x58')](handleError(_0x1c6456,null));}; \ No newline at end of file +var _0x26e4=['body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','CmContact','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','info','entity\x20found','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','Content-Type','text/xml','\x0a','List','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','end','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','WhatsappAccount','includeAll','include','findAll','rows','catch','show','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','pick','removeAnswers','addAgents','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','stack','finally','sendStatus','send','getApplications','whatsapp','account','sinch','statuses','state','read','WhatsappMessage','applications','orderBy','Applications','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','ListId','mobile','from','From','whatsapp:','Body','messageId','MessageSid','notifications','isNil','Sequelize','from\x20is\x20mandatory'];(function(_0x1c2142,_0x35e016){var _0x10c2a7=function(_0xde4dfc){while(--_0xde4dfc){_0x1c2142['push'](_0x1c2142['shift']());}};_0x10c2a7(++_0x35e016);}(_0x26e4,0xec));var _0x426e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x26e4[_0x19e35c];return _0x3e1fe8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x426e('0x0'));var zipdir=require(_0x426e('0x1'));var jsonpatch=require(_0x426e('0x2'));var rp=require(_0x426e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x426e('0x4'));var util=require(_0x426e('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x426e('0x6'));var ejs=require(_0x426e('0x7'));var fs=require('fs');var fs_extra=require(_0x426e('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x426e('0x9'));var deskjs=require(_0x426e('0xa'));var toCsv=require(_0x426e('0x6'));var querystring=require(_0x426e('0xb'));var Papa=require('papaparse');var Redis=require(_0x426e('0xc'));var authService=require(_0x426e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x426e('0xe'));var hardwareService=require(_0x426e('0xf'));var logger=require(_0x426e('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x426e('0x11'));var db=require(_0x426e('0x12'))['db'];config[_0x426e('0x13')]=_[_0x426e('0x14')](config[_0x426e('0x13')],{'host':_0x426e('0x15'),'port':0x18eb});var socket=require(_0x426e('0x16'))(new Redis(config[_0x426e('0x13')]));require(_0x426e('0x17'))[_0x426e('0x18')](socket);var jayson=require('jayson/promise');var client=jayson[_0x426e('0x19')][_0x426e('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0xdca847,_0x5f0c56,_0x263a6e,_0x5e5a15){return new BPromise(function(_0x2981d6,_0x4ea621){var _0x1e9e38=_0x5e5a15||client;return _0x1e9e38[_0x426e('0x1b')](_0xdca847,_0x263a6e)[_0x426e('0x1c')](function(_0x3c4e36){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,_0x426e('0x1d'));logger['debug'](_0x426e('0x1e'),_0x5f0c56,_0x426e('0x1d'),JSON[_0x426e('0x1f')](_0x3c4e36));if(_0x3c4e36['error']){if(_0x3c4e36[_0x426e('0x20')][_0x426e('0x21')]===0x1f4){logger[_0x426e('0x20')](_0x426e('0x22'),_0x5f0c56,_0x3c4e36[_0x426e('0x20')][_0x426e('0x23')]);return _0x4ea621(_0x3c4e36['error'][_0x426e('0x23')]);}logger[_0x426e('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,_0x3c4e36[_0x426e('0x20')]['message']);return _0x2981d6(_0x3c4e36[_0x426e('0x20')][_0x426e('0x23')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,'request\x20sent');_0x2981d6(_0x3c4e36[_0x426e('0x24')][_0x426e('0x23')]);}})['catch'](function(_0x280973){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x5f0c56,_0x280973);_0x4ea621(_0x280973);});});}function respondWithStatusCode(_0x4f9ad1,_0x28cac6){_0x28cac6=_0x28cac6||0xcc;return function(_0x450fc8){if(_0x450fc8){return _0x4f9ad1['sendStatus'](_0x28cac6);}return _0x4f9ad1[_0x426e('0x25')](_0x28cac6)['end']();};}function respondWithResult(_0x5083ca,_0x191d4a){_0x191d4a=_0x191d4a||0xc8;return function(_0x45c60c){if(_0x45c60c){return _0x5083ca['status'](_0x191d4a)[_0x426e('0x26')](_0x45c60c);}};}function respondWithFilteredResult(_0x5d6252,_0x380962){return function(_0x91fde4){if(_0x91fde4){var _0x50c510=typeof _0x380962['offset']==='undefined'&&typeof _0x380962[_0x426e('0x27')]==='undefined';var _0x19037c=_0x91fde4[_0x426e('0x28')];var _0x293bcf=_0x50c510?0x0:_0x380962[_0x426e('0x29')];var _0x56b09a=_0x50c510?_0x91fde4[_0x426e('0x28')]:_0x380962[_0x426e('0x29')]+_0x380962[_0x426e('0x27')];var _0xa14e20;if(_0x56b09a>=_0x19037c){_0x56b09a=_0x19037c;_0xa14e20=0xc8;}else{_0xa14e20=0xce;}_0x5d6252[_0x426e('0x25')](_0xa14e20);return _0x5d6252[_0x426e('0x2a')](_0x426e('0x2b'),_0x293bcf+'-'+_0x56b09a+'/'+_0x19037c)['json'](_0x91fde4);}return null;};}function patchUpdates(_0x3c5592){return function(_0x31bb67){try{jsonpatch[_0x426e('0x2c')](_0x31bb67,_0x3c5592,!![]);}catch(_0x4b4ce6){return BPromise[_0x426e('0x2d')](_0x4b4ce6);}return _0x31bb67[_0x426e('0x2e')]();};}function saveUpdates(_0x386688,_0xf9fb0){return function(_0x41cfaa){if(_0x41cfaa){return _0x41cfaa[_0x426e('0x2f')](_0x386688)[_0x426e('0x1c')](function(_0x3a72c4){return _0x3a72c4;});}return null;};}function removeEntity(_0x5e96e6,_0x38242a){return function(_0x5ab2f9){if(_0x5ab2f9){return _0x5ab2f9[_0x426e('0x30')]()[_0x426e('0x1c')](function(){var _0x208229=_0x5ab2f9[_0x426e('0x31')]({'plain':!![]});var _0x218cab=_0x426e('0x32');return db[_0x426e('0x33')][_0x426e('0x30')]({'where':{'type':_0x218cab,'resourceId':_0x208229['id']}})['then'](function(){return _0x5ab2f9;});})[_0x426e('0x1c')](function(){_0x5e96e6[_0x426e('0x25')](0xcc)[_0x426e('0x34')]();});}};}function handleEntityNotFound(_0x4d8e59,_0x592027){return function(_0x4fe3bf){if(!_0x4fe3bf){_0x4d8e59['sendStatus'](0x194);}return _0x4fe3bf;};}function handleError(_0x47f864,_0x298629){_0x298629=_0x298629||0x1f4;return function(_0x102777){logger[_0x426e('0x20')](_0x102777['stack']);if(_0x102777['name']){delete _0x102777['name'];}_0x47f864[_0x426e('0x25')](_0x298629)['send'](_0x102777);};}exports[_0x426e('0x35')]=function(_0x1d77c8,_0x1c243a){var _0x4aacb6={'include':[{'model':db[_0x426e('0x36')],'as':_0x426e('0x37')}]},_0x93faef={},_0x24f108={'count':0x0,'rows':[]};var _0x598dd5=_[_0x426e('0x38')](db['WhatsappAccount'][_0x426e('0x39')],function(_0x3cdf0e){return{'name':_0x3cdf0e[_0x426e('0x3a')],'type':_0x3cdf0e[_0x426e('0x3b')]['key']};});_0x93faef[_0x426e('0x3c')]=_[_0x426e('0x38')](_0x598dd5,_0x426e('0x3d'));_0x93faef[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x1d77c8[_0x426e('0x3e')]);_0x93faef[_0x426e('0x40')]=_[_0x426e('0x41')](_0x93faef['model'],_0x93faef[_0x426e('0x3e')]);_0x4aacb6['attributes']=_[_0x426e('0x41')](_0x93faef[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x1d77c8['query'][_0x426e('0x42')]));_0x4aacb6['attributes']=_0x4aacb6[_0x426e('0x43')][_0x426e('0x44')]?_0x4aacb6[_0x426e('0x43')]:_0x93faef[_0x426e('0x3c')];if(!_0x1d77c8[_0x426e('0x3e')][_0x426e('0x45')](_0x426e('0x46'))){_0x4aacb6[_0x426e('0x27')]=qs[_0x426e('0x27')](_0x1d77c8['query'][_0x426e('0x27')]);_0x4aacb6['offset']=qs[_0x426e('0x29')](_0x1d77c8[_0x426e('0x3e')]['offset']);}_0x4aacb6[_0x426e('0x47')]=qs[_0x426e('0x48')](_0x1d77c8[_0x426e('0x3e')][_0x426e('0x48')]);_0x4aacb6[_0x426e('0x49')]=qs['filters'](_['pick'](_0x1d77c8['query'],_0x93faef[_0x426e('0x40')]),_0x598dd5);if(_0x1d77c8[_0x426e('0x3e')][_0x426e('0x4a')]){_0x4aacb6[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x4aacb6[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x598dd5,function(_0x19df4c){if(_0x19df4c[_0x426e('0x3b')]!==_0x426e('0x4c')){var _0x967139={};_0x967139[_0x19df4c[_0x426e('0x3d')]]={'$like':'%'+_0x1d77c8[_0x426e('0x3e')]['filter']+'%'};return _0x967139;}})});}_0x4aacb6=_[_0x426e('0x4b')]({},_0x4aacb6,_0x1d77c8[_0x426e('0x4d')]);var _0x2e193f={'where':_0x4aacb6[_0x426e('0x49')]};return db[_0x426e('0x4e')][_0x426e('0x28')](_0x2e193f)[_0x426e('0x1c')](function(_0x22c152){_0x24f108[_0x426e('0x28')]=_0x22c152;if(_0x1d77c8['query'][_0x426e('0x4f')]){_0x4aacb6[_0x426e('0x50')]=[{'all':!![]}];}return db[_0x426e('0x4e')][_0x426e('0x51')](_0x4aacb6);})[_0x426e('0x1c')](function(_0xbc741e){_0x24f108[_0x426e('0x52')]=_0xbc741e;return _0x24f108;})[_0x426e('0x1c')](respondWithFilteredResult(_0x1c243a,_0x4aacb6))[_0x426e('0x53')](handleError(_0x1c243a,null));};exports[_0x426e('0x54')]=function(_0x30794e,_0x2ff1e3){var _0x57ca3b={'raw':![],'where':{'id':_0x30794e['params']['id']},'include':[{'model':db[_0x426e('0x36')],'as':'mandatoryDispositionPause'}]},_0x49bdc7={};_0x49bdc7[_0x426e('0x3c')]=_[_0x426e('0x3f')](db[_0x426e('0x4e')][_0x426e('0x39')]);_0x49bdc7['query']=_[_0x426e('0x3f')](_0x30794e['query']);_0x49bdc7['filters']=_[_0x426e('0x41')](_0x49bdc7[_0x426e('0x3c')],_0x49bdc7[_0x426e('0x3e')]);_0x57ca3b['attributes']=_[_0x426e('0x41')](_0x49bdc7[_0x426e('0x3c')],qs['fields'](_0x30794e[_0x426e('0x3e')][_0x426e('0x42')]));_0x57ca3b['attributes']=_0x57ca3b[_0x426e('0x43')][_0x426e('0x44')]?_0x57ca3b['attributes']:_0x49bdc7[_0x426e('0x3c')];if(_0x30794e[_0x426e('0x3e')][_0x426e('0x4f')]){_0x57ca3b[_0x426e('0x50')]=[{'all':!![]}];}_0x57ca3b=_[_0x426e('0x4b')]({},_0x57ca3b,_0x30794e[_0x426e('0x4d')]);return db['WhatsappAccount'][_0x426e('0x55')](_0x57ca3b)[_0x426e('0x1c')](handleEntityNotFound(_0x2ff1e3,null))['then'](respondWithResult(_0x2ff1e3,null))[_0x426e('0x53')](handleError(_0x2ff1e3,null));};exports[_0x426e('0x56')]=function(_0x2ad931,_0x1b220d){return db[_0x426e('0x4e')][_0x426e('0x56')](_0x2ad931['body'],{})[_0x426e('0x1c')](function(_0x290474){var _0x8fd615=_0x2ad931[_0x426e('0x57')][_0x426e('0x31')]({'plain':!![]});if(!_0x8fd615)throw new Error(_0x426e('0x58'));if(_0x8fd615[_0x426e('0x59')]==='user'){var _0x1ecfe5=_0x290474['get']({'plain':!![]});var _0x18284c=_0x426e('0x32');return db[_0x426e('0x5a')][_0x426e('0x55')]({'where':{'name':_0x18284c,'userProfileId':_0x8fd615['userProfileId']},'raw':!![]})['then'](function(_0x33d0ef){if(_0x33d0ef&&_0x33d0ef['autoAssociation']===0x0){return db[_0x426e('0x33')][_0x426e('0x56')]({'name':_0x1ecfe5['name'],'resourceId':_0x1ecfe5['id'],'type':_0x33d0ef['name'],'sectionId':_0x33d0ef['id']},{})[_0x426e('0x1c')](function(){return _0x290474;});}else{return _0x290474;}})[_0x426e('0x53')](function(_0x4a669d){logger[_0x426e('0x20')](_0x426e('0x5b'),_0x4a669d);throw _0x4a669d;});}return _0x290474;})[_0x426e('0x1c')](respondWithResult(_0x1b220d,0xc9))[_0x426e('0x53')](handleError(_0x1b220d,null));};exports['update']=function(_0x4b0257,_0x2c7061){if(_0x4b0257[_0x426e('0x5c')]['id']){delete _0x4b0257['body']['id'];}return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x4b0257['params']['id']},'include':[{'model':db[_0x426e('0x36')],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x2c7061,null))[_0x426e('0x1c')](saveUpdates(_0x4b0257[_0x426e('0x5c')],null))['then'](respondWithResult(_0x2c7061,null))[_0x426e('0x53')](handleError(_0x2c7061,null));};exports['destroy']=function(_0x431129,_0x25b0a1){return db['WhatsappAccount'][_0x426e('0x55')]({'where':{'id':_0x431129[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x25b0a1,null))[_0x426e('0x1c')](removeEntity(_0x25b0a1,null))[_0x426e('0x53')](handleError(_0x25b0a1,null));};exports['describe']=function(_0x361c90,_0x5b8388){return db['WhatsappAccount'][_0x426e('0x5e')]()['then'](respondWithResult(_0x5b8388,null))['catch'](handleError(_0x5b8388,null));};exports[_0x426e('0x5f')]=function(_0x2c31b7,_0x90f53a,_0x5c8bad){if(_0x2c31b7[_0x426e('0x5c')]['id']){delete _0x2c31b7[_0x426e('0x5c')]['id'];}return db['WhatsappAccount'][_0x426e('0x55')]({'where':{'id':_0x2c31b7[_0x426e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x90f53a,null))[_0x426e('0x1c')](function(_0x141a74){if(_0x141a74){_0x2c31b7[_0x426e('0x5c')][_0x426e('0x60')]=_0x141a74['id'];return db[_0x426e('0x61')]['create'](_0x2c31b7[_0x426e('0x5c')]);}})[_0x426e('0x1c')](respondWithResult(_0x90f53a,null))[_0x426e('0x53')](handleError(_0x90f53a,null));};exports[_0x426e('0x62')]=function(_0x4ed96c,_0x4ec18c,_0x4c5496){var _0x44c258={'raw':![],'where':{}};var _0x22ea7b={};var _0x1e9d38={'count':0x0,'rows':[]};return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x4ed96c[_0x426e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x4ec18c,null))[_0x426e('0x1c')](function(_0x596065){if(_0x596065){_0x22ea7b[_0x426e('0x3c')]=_[_0x426e('0x3f')](db['Disposition'][_0x426e('0x39')]);_0x22ea7b[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x4ed96c['query']);_0x22ea7b[_0x426e('0x40')]=_['intersection'](_0x22ea7b['model'],_0x22ea7b[_0x426e('0x3e')]);_0x44c258[_0x426e('0x43')]=_[_0x426e('0x41')](_0x22ea7b[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x4ed96c[_0x426e('0x3e')][_0x426e('0x42')]));_0x44c258[_0x426e('0x43')]=_0x44c258[_0x426e('0x43')][_0x426e('0x44')]?_0x44c258[_0x426e('0x43')]:_0x22ea7b[_0x426e('0x3c')];if(!_0x4ed96c['query'][_0x426e('0x45')]('nolimit')){_0x44c258[_0x426e('0x27')]=qs[_0x426e('0x27')](_0x4ed96c[_0x426e('0x3e')][_0x426e('0x27')]);_0x44c258[_0x426e('0x29')]=qs[_0x426e('0x29')](_0x4ed96c[_0x426e('0x3e')]['offset']);}_0x44c258[_0x426e('0x47')]=qs['sort'](_0x4ed96c[_0x426e('0x3e')]['sort']);_0x44c258[_0x426e('0x49')]=qs[_0x426e('0x40')](_['pick'](_0x4ed96c[_0x426e('0x3e')],_0x22ea7b[_0x426e('0x40')]));_0x44c258['where'][_0x426e('0x60')]=_0x596065['id'];if(_0x4ed96c[_0x426e('0x3e')][_0x426e('0x4a')]){_0x44c258[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x44c258[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x44c258[_0x426e('0x43')],function(_0x29fe7c){var _0x2fc34a={};_0x2fc34a[_0x29fe7c]={'$like':'%'+_0x4ed96c[_0x426e('0x3e')][_0x426e('0x4a')]+'%'};return _0x2fc34a;})});}_0x44c258=_[_0x426e('0x4b')]({},_0x44c258,_0x4ed96c[_0x426e('0x4d')]);return db[_0x426e('0x61')][_0x426e('0x28')]({'where':_0x44c258['where']})[_0x426e('0x1c')](function(_0x1be878){_0x1e9d38[_0x426e('0x28')]=_0x1be878;if(_0x4ed96c[_0x426e('0x3e')]['includeAll']){_0x44c258[_0x426e('0x50')]=[{'all':!![]}];}return db[_0x426e('0x61')]['findAll'](_0x44c258);})[_0x426e('0x1c')](function(_0x46bf7c){_0x1e9d38[_0x426e('0x52')]=_0x46bf7c;return _0x1e9d38;});}})[_0x426e('0x1c')](respondWithFilteredResult(_0x4ec18c,_0x44c258))[_0x426e('0x53')](handleError(_0x4ec18c,null));};exports[_0x426e('0x64')]=function(_0x269b34,_0x44caa5,_0x206d10){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x269b34[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x44caa5,null))[_0x426e('0x1c')](function(_0x3d4eed){if(_0x3d4eed){return _0x3d4eed[_0x426e('0x64')](_0x269b34[_0x426e('0x3e')][_0x426e('0x65')]);}})['then'](respondWithStatusCode(_0x44caa5,null))['catch'](handleError(_0x44caa5,null));};exports[_0x426e('0x66')]=function(_0x49a1bd,_0x533335,_0x3d80eb){if(_0x49a1bd[_0x426e('0x5c')]['id']){delete _0x49a1bd['body']['id'];}return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x49a1bd['params']['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x533335,null))[_0x426e('0x1c')](function(_0x29f1a9){if(_0x29f1a9){_0x49a1bd[_0x426e('0x5c')]['WhatsappAccountId']=_0x29f1a9['id'];return db['CannedAnswer']['create'](_0x49a1bd[_0x426e('0x5c')]);}})[_0x426e('0x1c')](respondWithResult(_0x533335,null))[_0x426e('0x53')](handleError(_0x533335,null));};exports[_0x426e('0x67')]=function(_0x3017a8,_0x2a3842,_0x1ceec4){var _0x3244d4={'raw':![],'where':{}};var _0x7b12eb={};var _0x57c2b5={'count':0x0,'rows':[]};return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x3017a8[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x2a3842,null))['then'](function(_0x1becec){if(_0x1becec){_0x7b12eb[_0x426e('0x3c')]=_[_0x426e('0x3f')](db[_0x426e('0x68')]['rawAttributes']);_0x7b12eb[_0x426e('0x3e')]=_['keys'](_0x3017a8[_0x426e('0x3e')]);_0x7b12eb['filters']=_[_0x426e('0x41')](_0x7b12eb[_0x426e('0x3c')],_0x7b12eb[_0x426e('0x3e')]);_0x3244d4['attributes']=_[_0x426e('0x41')](_0x7b12eb[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x3017a8['query'][_0x426e('0x42')]));_0x3244d4[_0x426e('0x43')]=_0x3244d4[_0x426e('0x43')][_0x426e('0x44')]?_0x3244d4[_0x426e('0x43')]:_0x7b12eb['model'];if(!_0x3017a8['query']['hasOwnProperty'](_0x426e('0x46'))){_0x3244d4['limit']=qs['limit'](_0x3017a8[_0x426e('0x3e')][_0x426e('0x27')]);_0x3244d4[_0x426e('0x29')]=qs['offset'](_0x3017a8['query']['offset']);}_0x3244d4[_0x426e('0x47')]=qs[_0x426e('0x48')](_0x3017a8[_0x426e('0x3e')][_0x426e('0x48')]);_0x3244d4['where']=qs['filters'](_[_0x426e('0x69')](_0x3017a8[_0x426e('0x3e')],_0x7b12eb['filters']));_0x3244d4[_0x426e('0x49')][_0x426e('0x60')]=_0x1becec['id'];if(_0x3017a8[_0x426e('0x3e')][_0x426e('0x4a')]){_0x3244d4[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x3244d4[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x3244d4[_0x426e('0x43')],function(_0x39f637){var _0x445fee={};_0x445fee[_0x39f637]={'$like':'%'+_0x3017a8[_0x426e('0x3e')][_0x426e('0x4a')]+'%'};return _0x445fee;})});}_0x3244d4=_[_0x426e('0x4b')]({},_0x3244d4,_0x3017a8[_0x426e('0x4d')]);return db[_0x426e('0x68')][_0x426e('0x28')]({'where':_0x3244d4[_0x426e('0x49')]})[_0x426e('0x1c')](function(_0x5e47de){_0x57c2b5[_0x426e('0x28')]=_0x5e47de;if(_0x3017a8[_0x426e('0x3e')]['includeAll']){_0x3244d4[_0x426e('0x50')]=[{'all':!![]}];}return db[_0x426e('0x68')][_0x426e('0x51')](_0x3244d4);})[_0x426e('0x1c')](function(_0x39a95f){_0x57c2b5['rows']=_0x39a95f;return _0x57c2b5;});}})[_0x426e('0x1c')](respondWithFilteredResult(_0x2a3842,_0x3244d4))[_0x426e('0x53')](handleError(_0x2a3842,null));};exports[_0x426e('0x6a')]=function(_0x24ad23,_0x4c92e6,_0x95d306){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x24ad23['params']['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x4c92e6,null))[_0x426e('0x1c')](function(_0x439b93){if(_0x439b93){return _0x439b93[_0x426e('0x6a')](_0x24ad23[_0x426e('0x3e')]['ids']);}})[_0x426e('0x1c')](respondWithStatusCode(_0x4c92e6,null))['catch'](handleError(_0x4c92e6,null));};exports[_0x426e('0x6b')]=function(_0x42da22,_0x27bd2f,_0x32f2b6){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x42da22['params']['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0x27bd2f,null))[_0x426e('0x1c')](function(_0x477422){if(_0x477422){return _0x477422[_0x426e('0x6b')](_0x42da22[_0x426e('0x5c')][_0x426e('0x65')],_['omit'](_0x42da22['body'],[_0x426e('0x65'),'id'])||{})['spread'](function(_0x799034){for(var _0x18c897=0x0;_0x18c897<_0x42da22[_0x426e('0x5c')]['ids'][_0x426e('0x44')];_0x18c897+=0x1){socket[_0x426e('0x6c')](_0x426e('0x6d'),{'UserId':Number(_0x42da22['body'][_0x426e('0x65')][_0x18c897]),'WhatsappAccountId':Number(_0x42da22[_0x426e('0x5d')]['id'])});}return _0x799034;});}})[_0x426e('0x1c')](respondWithResult(_0x27bd2f,null))[_0x426e('0x53')](handleError(_0x27bd2f,null));};exports[_0x426e('0x6e')]=function(_0x5c1d0f,_0xfc31ff,_0x7cd679){return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x5c1d0f[_0x426e('0x5d')]['id']}})[_0x426e('0x1c')](handleEntityNotFound(_0xfc31ff,null))[_0x426e('0x1c')](function(_0x3c9fec){if(_0x3c9fec){return _0x3c9fec[_0x426e('0x6e')](_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')])['then'](function(){if(_[_0x426e('0x6f')](_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')])){for(var _0x539d75=0x0;_0x539d75<_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')][_0x426e('0x44')];_0x539d75+=0x1){socket[_0x426e('0x6c')]('userWhatsappAccount:remove',{'UserId':Number(_0x5c1d0f['query']['ids'][_0x539d75]),'WhatsappAccountId':Number(_0x5c1d0f[_0x426e('0x5d')]['id'])});}}else{socket['emit'](_0x426e('0x70'),{'UserId':Number(_0x5c1d0f[_0x426e('0x3e')][_0x426e('0x65')]),'WhatsappAccountId':Number(_0x5c1d0f['params']['id'])});}});}})[_0x426e('0x1c')](respondWithStatusCode(_0xfc31ff,null))[_0x426e('0x53')](handleError(_0xfc31ff,null));};exports[_0x426e('0x71')]=function(_0x35f1da,_0x18bfd9,_0x3519af){var _0x2c09b7={};var _0x5a954d={};var _0x19db0f;var _0xe6e654;return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x35f1da[_0x426e('0x5d')]['id']}})['then'](handleEntityNotFound(_0x18bfd9,null))[_0x426e('0x1c')](function(_0x108274){if(_0x108274){_0x19db0f=_0x108274;_0x5a954d[_0x426e('0x3c')]=_['keys'](db[_0x426e('0x72')][_0x426e('0x39')]);_0x5a954d[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x35f1da[_0x426e('0x3e')]);_0x5a954d[_0x426e('0x40')]=_[_0x426e('0x41')](_0x5a954d[_0x426e('0x3c')],_0x5a954d['query']);_0x2c09b7[_0x426e('0x43')]=_['intersection'](_0x5a954d[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x35f1da[_0x426e('0x3e')][_0x426e('0x42')]));_0x2c09b7['attributes']=_0x2c09b7['attributes']['length']?_0x2c09b7[_0x426e('0x43')]:_0x5a954d['model'];_0x2c09b7['order']=qs[_0x426e('0x48')](_0x35f1da[_0x426e('0x3e')][_0x426e('0x48')]);_0x2c09b7[_0x426e('0x49')]=qs[_0x426e('0x40')](_['pick'](_0x35f1da['query'],_0x5a954d[_0x426e('0x40')]));if(_0x35f1da['query'][_0x426e('0x4a')]){_0x2c09b7[_0x426e('0x49')]=_['merge'](_0x2c09b7[_0x426e('0x49')],{'$or':_[_0x426e('0x38')](_0x2c09b7['attributes'],function(_0x2aef22){var _0x7ea6a6={};_0x7ea6a6[_0x2aef22]={'$like':'%'+_0x35f1da[_0x426e('0x3e')][_0x426e('0x4a')]+'%'};return _0x7ea6a6;})});}_0x2c09b7=_[_0x426e('0x4b')]({},_0x2c09b7,_0x35f1da[_0x426e('0x4d')]);return _0x19db0f[_0x426e('0x71')](_0x2c09b7);}})['then'](function(_0x120be1){if(_0x120be1){_0xe6e654=_0x120be1[_0x426e('0x44')];if(!_0x35f1da[_0x426e('0x3e')]['hasOwnProperty'](_0x426e('0x46'))){_0x2c09b7[_0x426e('0x27')]=qs[_0x426e('0x27')](_0x35f1da[_0x426e('0x3e')][_0x426e('0x27')]);_0x2c09b7[_0x426e('0x29')]=qs[_0x426e('0x29')](_0x35f1da['query'][_0x426e('0x29')]);}return _0x19db0f[_0x426e('0x71')](_0x2c09b7);}})[_0x426e('0x1c')](function(_0x3f6d8d){if(_0x3f6d8d){return _0x3f6d8d?{'count':_0xe6e654,'rows':_0x3f6d8d}:null;}})[_0x426e('0x1c')](respondWithResult(_0x18bfd9,null))[_0x426e('0x53')](handleError(_0x18bfd9,null));};exports[_0x426e('0x73')]=function(_0x27a362,_0x5a8706){var _0x395aed=_0x27a362[_0x426e('0x5d')]['id'];var _0x2d95d3=_0x27a362[_0x426e('0x5c')];var _0x400602=0xc8;var _0x60198f=null;return db['sequelize'][_0x426e('0x74')]({'isolationLevel':db['sequelize'][_0x426e('0x75')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x58d797){return db[_0x426e('0x4e')][_0x426e('0x63')]({'where':{'id':_0x395aed},'transaction':_0x58d797})[_0x426e('0x1c')](function(_0x285250){if(_0x285250){return db[_0x426e('0x76')]['destroy']({'where':{'WhatsappAccountId':_0x395aed},'transaction':_0x58d797})[_0x426e('0x1c')](function(){var _0x3c9c36=_[_0x426e('0x38')](_0x2d95d3,function(_0x2a664a){_0x2a664a[_0x426e('0x60')]=_0x395aed;return _0x2a664a;});return db[_0x426e('0x76')][_0x426e('0x77')](_0x3c9c36,{'transaction':_0x58d797});});}else{_0x400602=0x194;_0x60198f=[];}});})[_0x426e('0x1c')](function(){if(_0x400602!==0x194){return db['WhatsappApplication'][_0x426e('0x78')]({'where':{'WhatsappAccountId':_0x395aed},'order':_0x426e('0x79')})[_0x426e('0x1c')](function(_0x547786){_0x60198f=_0x547786;});}})['catch'](function(_0x5ce772){_0x400602=0x1f4;logger[_0x426e('0x20')](_0x5ce772[_0x426e('0x7a')]);if(_0x5ce772['name']){delete _0x5ce772['name'];}_0x60198f=_0x5ce772;})[_0x426e('0x7b')](function(){if(_0x60198f===null){_0x5a8706[_0x426e('0x7c')](_0x400602);}else{if(_0x400602===0x1f4){_0x5a8706[_0x426e('0x25')](_0x400602)[_0x426e('0x7d')](_0x60198f);}else{_0x5a8706[_0x426e('0x25')](_0x400602)['json'](_0x60198f);}}});};exports[_0x426e('0x7e')]=function(_0x193262,_0x5558aa,_0x4df3fb){var _0x3413dd={};var _0x2b2fe2={};var _0x305836;var _0x2c0252;return db[_0x426e('0x4e')]['findOne']({'where':{'id':_0x193262['params']['id']}})['then'](handleEntityNotFound(_0x5558aa,null))['then'](function(_0x33bf5f){if(_0x33bf5f){_0x305836=_0x33bf5f;_0x2b2fe2[_0x426e('0x3c')]=_[_0x426e('0x3f')](db['WhatsappApplication'][_0x426e('0x39')]);_0x2b2fe2[_0x426e('0x3e')]=_[_0x426e('0x3f')](_0x193262['query']);_0x2b2fe2[_0x426e('0x40')]=_[_0x426e('0x41')](_0x2b2fe2[_0x426e('0x3c')],_0x2b2fe2[_0x426e('0x3e')]);_0x3413dd[_0x426e('0x43')]=_[_0x426e('0x41')](_0x2b2fe2[_0x426e('0x3c')],qs[_0x426e('0x42')](_0x193262[_0x426e('0x3e')][_0x426e('0x42')]));_0x3413dd['attributes']=_0x3413dd[_0x426e('0x43')][_0x426e('0x44')]?_0x3413dd[_0x426e('0x43')]:_0x2b2fe2[_0x426e('0x3c')];_0x3413dd[_0x426e('0x47')]=qs[_0x426e('0x48')](_0x193262[_0x426e('0x3e')][_0x426e('0x48')]);_0x3413dd[_0x426e('0x49')]=qs['filters'](_[_0x426e('0x69')](_0x193262[_0x426e('0x3e')],_0x2b2fe2[_0x426e('0x40')]));if(_0x193262[_0x426e('0x3e')][_0x426e('0x4a')]){_0x3413dd[_0x426e('0x49')]=_[_0x426e('0x4b')](_0x3413dd['where'],{'$or':_[_0x426e('0x38')](_0x3413dd['attributes'],function(_0x2bfe8e){var _0x2168f0={};_0x2168f0[_0x2bfe8e]={'$like':'%'+_0x193262['query'][_0x426e('0x4a')]+'%'};return _0x2168f0;})});}_0x3413dd=_[_0x426e('0x4b')]({},_0x3413dd,_0x193262['options']);return _0x305836[_0x426e('0x7e')](_0x3413dd);}})[_0x426e('0x1c')](function(_0x403b93){if(_0x403b93){_0x2c0252=_0x403b93[_0x426e('0x44')];if(!_0x193262['query'][_0x426e('0x45')](_0x426e('0x46'))){_0x3413dd[_0x426e('0x27')]=qs['limit'](_0x193262[_0x426e('0x3e')][_0x426e('0x27')]);_0x3413dd[_0x426e('0x29')]=qs[_0x426e('0x29')](_0x193262['query'][_0x426e('0x29')]);}return _0x305836[_0x426e('0x7e')](_0x3413dd);}})[_0x426e('0x1c')](function(_0x21fccf){if(_0x21fccf){return _0x21fccf?{'count':_0x2c0252,'rows':_0x21fccf}:null;}})[_0x426e('0x1c')](respondWithResult(_0x5558aa,null))[_0x426e('0x53')](handleError(_0x5558aa,null));};exports['notify']=function(_0x345c57,_0x141242,_0x275a54){var _0x3c7e37={'channel':_0x426e('0x7f')};var _0x50fee5=[];var _0x38201e=[];var _0xd63a6a={};return db[_0x426e('0x4e')][_0x426e('0x55')]({'where':{'id':_0x345c57['params']['id']},'include':[{'model':db[_0x426e('0x76')],'as':'Applications'}]})[_0x426e('0x1c')](handleEntityNotFound(_0x141242,null))['then'](function(_0x14e123){_0x3c7e37['account']=_0x14e123;if(_0x3c7e37[_0x426e('0x80')]&&_0x3c7e37[_0x426e('0x80')][_0x426e('0x3b')]===_0x426e('0x81')&&_0x345c57[_0x426e('0x5c')][_0x426e('0x82')]){if(_0x345c57[_0x426e('0x5c')]['statuses'][_0x426e('0x44')]===0x0)return;if(_0x345c57[_0x426e('0x5c')][_0x426e('0x82')][0x0][_0x426e('0x83')]!==_0x426e('0x84'))return;return db[_0x426e('0x85')][_0x426e('0x2f')]({'read':!![],'readAt':_0x345c57[_0x426e('0x5c')][_0x426e('0x82')][0x0]['timestamp']},{'where':{'messageId':_0x345c57[_0x426e('0x5c')][_0x426e('0x82')][0x0]['message_id']},'individualHooks':!![]})[_0x426e('0x1c')](function(_0x43ea1f){return _0x141242['status'](0xc8)[_0x426e('0x26')](_0x43ea1f);});}_0x3c7e37[_0x426e('0x86')]=_[_0x426e('0x87')](_0x14e123[_0x426e('0x88')],[_0x426e('0x79')],['asc']);if(_0x3c7e37[_0x426e('0x80')][_0x426e('0x88')]){delete _0x3c7e37[_0x426e('0x80')]['Applications'];}return db['CmContact'][_0x426e('0x5e')]()[_0x426e('0x1c')](function(_0x32ea0b){if(!_0x32ea0b){throw new db['Sequelize'][(_0x426e('0x89'))](_0x426e('0x8a'));}_0x50fee5=_[_0x426e('0x8b')](_[_0x426e('0x3f')](_0x32ea0b),['createdAt',_0x426e('0x8c')]);_0x38201e=_[_0x426e('0x8b')](_[_0x426e('0x3f')](_0x32ea0b),[_0x426e('0x8d'),'updatedAt','CompanyId',_0x426e('0x8e')]);_0x3c7e37['body']={'mapKey':_0x426e('0x8f')};if(_0x3c7e37[_0x426e('0x80')]&&_0x3c7e37['account'][_0x426e('0x3b')]==='twilio'){_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x91')]['replace'](_0x426e('0x92'),'');_0x3c7e37['body'][_0x426e('0x5c')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x93')];_0x3c7e37[_0x426e('0x5c')][_0x426e('0x94')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x95')];}if(_0x3c7e37[_0x426e('0x80')]&&_0x3c7e37[_0x426e('0x80')][_0x426e('0x3b')]===_0x426e('0x81')){_0x3c7e37[_0x426e('0x5c')]['from']=_0x345c57[_0x426e('0x5c')][_0x426e('0x96')][0x0][_0x426e('0x90')];_0x3c7e37['body'][_0x426e('0x5c')]=_0x345c57['body'][_0x426e('0x96')][0x0]['message'][_0x426e('0x5c')];_0x3c7e37[_0x426e('0x5c')][_0x426e('0x94')]=_0x345c57[_0x426e('0x5c')][_0x426e('0x96')][0x0]['message_id'];}if(_0x3c7e37[_0x426e('0x5c')]['id']){delete _0x3c7e37[_0x426e('0x5c')]['id'];}if(_[_0x426e('0x97')](_0x3c7e37['body'][_0x426e('0x90')])){throw new db[(_0x426e('0x98'))][(_0x426e('0x89'))](_0x426e('0x99'));}if(_[_0x426e('0x97')](_0x3c7e37[_0x426e('0x5c')]['body'])||_0x3c7e37['body'][_0x426e('0x5c')]===''){throw new db[(_0x426e('0x98'))]['ValidationError'](_0x426e('0x9a'));}if(_[_0x426e('0x97')](_0x3c7e37['body'][_0x426e('0x9b')])){throw new db[(_0x426e('0x98'))]['ValidationError'](_0x426e('0x9c')+_0x38201e);}if(!_['includes'](_0x38201e,_0x3c7e37[_0x426e('0x5c')][_0x426e('0x9b')])){throw new db[(_0x426e('0x98'))][(_0x426e('0x89'))](_0x426e('0x9d')+_0x38201e);}_0xd63a6a[_0x3c7e37[_0x426e('0x5c')][_0x426e('0x9b')]]=_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')];return db[_0x426e('0x9e')][_0x426e('0x55')]({'where':{'id':_0x3c7e37[_0x426e('0x80')][_0x426e('0x8e')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xd63a6a,'limit':0x1,'order':[['updatedAt',_0x426e('0x9f')]]}]});})['then'](handleEntityNotFound(_0x141242,null))[_0x426e('0x1c')](function(_0x46e567){if(_0x46e567){_0x3c7e37[_0x426e('0xa0')]=_[_0x426e('0xa1')](_0x46e567,['Contacts']);if(_0x46e567['Contacts']['length']){return _0x46e567[_0x426e('0xa2')][0x0];}var _0xe85f73=_[_0x426e('0x14')](_0x3c7e37[_0x426e('0x5c')],{'firstName':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')],'ListId':_0x46e567['id']});_0xe85f73[_0x3c7e37[_0x426e('0x5c')]['mapKey']]=_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')];return db[_0x426e('0xa3')][_0x426e('0x56')](_0xe85f73,{'fields':_0x50fee5,'raw':!![]});}})[_0x426e('0x1c')](handleEntityNotFound(_0x141242,null))['then'](function(_0x1e1a63){if(_0x1e1a63){_0x3c7e37[_0x426e('0xa4')]=_0x1e1a63;var _0x421247={'ContactId':_0x1e1a63['id'],'phone':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x90')],'WhatsappAccountId':_0x345c57[_0x426e('0x5d')]['id']};var _0x59d2ec={'ContactId':_0x1e1a63['id'],'WhatsappAccountId':_0x345c57[_0x426e('0x5d')]['id'],'closed':![]};return db[_0x426e('0xa5')][_0x426e('0x55')]({'where':_0x59d2ec})[_0x426e('0x1c')](function(_0x2d6168){if(_0x2d6168){return[_0x2d6168,![]];}return db[_0x426e('0xa5')][_0x426e('0x56')](_0x421247)['then'](function(_0x329b3b){return[_0x329b3b,!![]];});});}})[_0x426e('0xa6')](function(_0x3d3971,_0x4d302e){_0x3c7e37[_0x426e('0xa7')]=_0x3d3971[_0x426e('0x31')]({'plain':!![]});_0x3c7e37[_0x426e('0xa7')][_0x426e('0xa8')]=![];if(_0x4d302e){if(_0x3c7e37[_0x426e('0x80')][_0x426e('0xa9')]){_0x3c7e37[_0x426e('0x86')][_0x426e('0xaa')]({'id':0x0,'priority':_0x3c7e37[_0x426e('0x86')]['length']+0x1,'app':_0x426e('0xab'),'appdata':_0x426e('0xac'),'interval':_0x426e('0xad')});}_0x3c7e37[_0x426e('0xa7')][_0x426e('0xa8')]=!![];}return db[_0x426e('0x85')]['create']({'phone':_0x3c7e37['body'][_0x426e('0x90')],'messageId':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x94')],'body':_0x3c7e37[_0x426e('0x5c')][_0x426e('0x5c')],'WhatsappAccountId':_0x345c57[_0x426e('0x5d')]['id'],'WhatsappInteractionId':_0x3d3971['id'],'direction':'in','ContactId':_0x3d3971[_0x426e('0xae')],'AttachmentId':_0x3c7e37['body'][_0x426e('0xaf')]});})[_0x426e('0x1c')](function(_0x2ddc6d){_0x3c7e37['message']=_0x2ddc6d;if(!_0x3c7e37['interaction'][_0x426e('0xb0')])return;return db[_0x426e('0x72')][_0x426e('0x55')]({'attributes':['id',_0x426e('0x3d')],'where':{'id':_0x3c7e37[_0x426e('0xa7')][_0x426e('0xb0')]}});})[_0x426e('0x1c')](function(_0x301aad){if(_0x301aad){_0x3c7e37['applications'][_0x426e('0xb1')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x301aad[_0x426e('0x3d')]+','+(_0x3c7e37[_0x426e('0x80')][_0x426e('0xb2')]||0xa),'interval':_0x426e('0xad')});}if(!_0x3c7e37[_0x426e('0xa7')][_0x426e('0xb3')])return;return db['WhatsappQueue'][_0x426e('0x55')]({'attributes':['id','name'],'where':{'id':_0x3c7e37[_0x426e('0xa7')][_0x426e('0xb3')]}});})[_0x426e('0x1c')](function(_0x5b8705){if(_0x5b8705){_0x3c7e37[_0x426e('0x86')]['unshift']({'id':0x0,'priority':0x1,'app':_0x426e('0xb4'),'appdata':_0x5b8705[_0x426e('0x3d')]+','+(_0x3c7e37[_0x426e('0x80')][_0x426e('0xb5')]||0x12c),'interval':_0x426e('0xad')});}return respondWithRpcPromise(_0x426e('0xb6'),_0x426e('0xb7'),_0x3c7e37);})[_0x426e('0x1c')](function(_0x4bfb58){if(_0x4bfb58){var _0x337f1b=0xc8;var _0x356292='receiveMessage';logger[_0x426e('0xb8')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x356292,_0x337f1b,_0x426e('0xb9'));logger[_0x426e('0xba')](_0x426e('0xbb'),_0x356292,_0x337f1b,_0x426e('0xb9'),JSON[_0x426e('0x1f')](_0x4bfb58));if(_0x3c7e37[_0x426e('0x80')]['type']===_0x426e('0xbc')){return _0x141242[_0x426e('0x25')](_0x337f1b)[_0x426e('0x2a')](_0x426e('0xbd'),_0x426e('0xbe'))[_0x426e('0x7d')](_0x426e('0xbf'));}else{return _0x141242[_0x426e('0x25')](_0x337f1b)[_0x426e('0x26')](_0x4bfb58);}}});})[_0x426e('0x53')](handleError(_0x141242,null));};exports['send']=function(_0x1935b0,_0x643207,_0x219bcd){var _0x4cb010,_0x1b8a35,_0x422de7;if(_[_0x426e('0x97')](_0x1935b0[_0x426e('0x5c')][_0x426e('0x5c')])||_0x1935b0[_0x426e('0x5c')][_0x426e('0x5c')]===''){throw new db[(_0x426e('0x98'))][(_0x426e('0x89'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x426e('0x97')](_0x1935b0['body']['to'])){throw new db['Sequelize'][(_0x426e('0x89'))]('to\x20is\x20mandatory');}_0x4cb010=_0x1935b0[_0x426e('0x5c')]['to'];return db['WhatsappAccount'][_0x426e('0x55')]({'where':{'id':_0x1935b0['params']['id']},'include':[{'model':db[_0x426e('0x9e')],'as':_0x426e('0xc0'),'include':[{'model':db[_0x426e('0xa3')],'as':_0x426e('0xa2'),'where':{'mobile':_0x4cb010},'limit':0x1,'order':[[_0x426e('0x8c'),'DESC']]}]}]})[_0x426e('0x1c')](handleEntityNotFound(_0x643207,null))['then'](function(_0x55e516){if(_0x55e516&&_0x55e516['List']){_0x1b8a35=_0x55e516[_0x426e('0x31')]({'plain':!![]});if(_0x1b8a35[_0x426e('0xc0')]&&_0x1b8a35['List'][_0x426e('0xa2')][_0x426e('0x44')]){return _0x1b8a35[_0x426e('0xc0')][_0x426e('0xa2')][0x0];}return db['CmContact'][_0x426e('0x56')](_['defaults'](_0x1935b0[_0x426e('0x5c')],{'firstName':_0x4cb010,'mobile':_0x4cb010,'phone':_0x4cb010,'ListId':_0x1b8a35[_0x426e('0x8e')]}));}})[_0x426e('0x1c')](handleEntityNotFound(_0x643207,null))[_0x426e('0x1c')](function(_0x30ab7c){if(_0x30ab7c){_0x422de7=_0x30ab7c;return db[_0x426e('0xa5')][_0x426e('0x55')]({'where':{'ContactId':_0x422de7['id'],'closed':![],'WhatsappAccountId':_0x1b8a35['id']}})[_0x426e('0x1c')](function(_0x132dee){if(_0x132dee){return[_0x132dee,![]];}return db[_0x426e('0xa5')][_0x426e('0x56')]({'UserId':_0x1935b0[_0x426e('0x57')]['id'],'ContactId':_0x422de7['id'],'WhatsappAccountId':_0x1b8a35['id'],'phone':_0x4cb010,'firstMsgDirection':'out','Messages':[_[_0x426e('0x4b')](_0x1935b0[_0x426e('0x5c')],{'read':![],'body':_0x1935b0['body']['body'],'phone':_0x4cb010,'WhatsappAccountId':_0x1b8a35['id'],'UserId':_0x1935b0['user']['id'],'ContactId':_0x422de7['id']})]},{'include':[{'model':db[_0x426e('0x85')],'as':_0x426e('0xc1')}]})['then'](function(_0x56f77f){return[_0x56f77f,!![]];});});}})['spread'](function(_0x3fc6da,_0x3f7d8f){if(_0x3f7d8f){return _0x3fc6da;}return db['WhatsappMessage']['create'](_['merge'](_0x1935b0[_0x426e('0x5c')],{'read':![],'body':_0x1935b0[_0x426e('0x5c')][_0x426e('0x5c')],'phone':_0x4cb010,'WhatsappAccountId':_0x1b8a35['id'],'WhatsappInteractionId':_0x3fc6da['id'],'UserId':_0x1935b0[_0x426e('0x57')]['id'],'ContactId':_0x422de7['id']}))[_0x426e('0x1c')](function(_0x49cb58){_0x3fc6da[_0x426e('0xc2')][_0x426e('0xc1')]=[];_0x3fc6da[_0x426e('0xc2')][_0x426e('0xc1')]['push'](_0x49cb58[_0x426e('0xc2')]);return _0x3fc6da;});})['then'](respondWithResult(_0x643207,null))[_0x426e('0x53')](handleError(_0x643207,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 02dd9a0..025995a 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 _0xf934=['events','../../mysqldb','WhatsappAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x12870e,_0x40960c){var _0x466dbd=function(_0x3bfcdb){while(--_0x3bfcdb){_0x12870e['push'](_0x12870e['shift']());}};_0x466dbd(++_0x40960c);}(_0xf934,0x14a));var _0x4f93=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xf934[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require(_0x4f93('0x0'));var WhatsappAccount=require(_0x4f93('0x1'))['db'][_0x4f93('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x4f93('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4f93('0x4'),'afterDestroy':_0x4f93('0x5')};function emitEvent(_0x2e7709){return function(_0x32d2b0,_0x98d37f,_0x15f5dc){WhatsappAccountEvents[_0x4f93('0x6')](_0x2e7709+':'+_0x32d2b0['id'],_0x32d2b0);WhatsappAccountEvents[_0x4f93('0x6')](_0x2e7709,_0x32d2b0);_0x15f5dc(null);};}for(var e in events){if(events[_0x4f93('0x7')](e)){var event=events[e];WhatsappAccount[_0x4f93('0x8')](e,emitEvent(event));}}module[_0x4f93('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xad7b=['save','remove','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount'];(function(_0x587dd0,_0x273922){var _0x56f153=function(_0x27fb33){while(--_0x27fb33){_0x587dd0['push'](_0x587dd0['shift']());}};_0x56f153(++_0x273922);}(_0xad7b,0x131));var _0xbad7=function(_0x41b01d,_0x384ae5){_0x41b01d=_0x41b01d-0x0;var _0x4d4393=_0xad7b[_0x41b01d];return _0x4d4393;};'use strict';var EventEmitter=require(_0xbad7('0x0'));var WhatsappAccount=require(_0xbad7('0x1'))['db'][_0xbad7('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbad7('0x3'),'afterUpdate':'update','afterDestroy':_0xbad7('0x4')};function emitEvent(_0x3de13d){return function(_0x56e6dc,_0x2ed0df,_0x198262){WhatsappAccountEvents['emit'](_0x3de13d+':'+_0x56e6dc['id'],_0x56e6dc);WhatsappAccountEvents['emit'](_0x3de13d,_0x56e6dc);_0x198262(null);};}for(var e in events){if(events[_0xbad7('0x5')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xbad7('0x6')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index de30f10..f0202e3 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 _0x0374=['rimraf','../../config/environment','./whatsappAccount.attributes','exports','WhatsappAccount','whatsapp_accounts','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x473ee7,_0x4dd754){var _0x30f0d4=function(_0x4d961d){while(--_0x4d961d){_0x473ee7['push'](_0x473ee7['shift']());}};_0x30f0d4(++_0x4dd754);}(_0x0374,0x186));var _0x4037=function(_0x2fde67,_0x340ddb){_0x2fde67=_0x2fde67-0x0;var _0x7093d3=_0x0374[_0x2fde67];return _0x7093d3;};'use strict';var _=require(_0x4037('0x0'));var util=require(_0x4037('0x1'));var logger=require(_0x4037('0x2'))(_0x4037('0x3'));var moment=require('moment');var BPromise=require(_0x4037('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4037('0x5'));var rimraf=require(_0x4037('0x6'));var config=require(_0x4037('0x7'));var attributes=require(_0x4037('0x8'));module[_0x4037('0x9')]=function(_0xcea19c,_0x3a2185){return _0xcea19c['define'](_0x4037('0xa'),attributes,{'tableName':_0x4037('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x26b3=['api','bluebird','path','./whatsappAccount.attributes','exports','define','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x5856d0,_0x296932){var _0x57c019=function(_0x12689b){while(--_0x12689b){_0x5856d0['push'](_0x5856d0['shift']());}};_0x57c019(++_0x296932);}(_0x26b3,0xbb));var _0x326b=function(_0x179190,_0xf3ee46){_0x179190=_0x179190-0x0;var _0xcac7f0=_0x26b3[_0x179190];return _0xcac7f0;};'use strict';var _=require(_0x326b('0x0'));var util=require(_0x326b('0x1'));var logger=require(_0x326b('0x2'))(_0x326b('0x3'));var moment=require('moment');var BPromise=require(_0x326b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x326b('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x326b('0x6'));module[_0x326b('0x7')]=function(_0x2b358a,_0x33a23d){return _0x2b358a[_0x326b('0x8')]('WhatsappAccount',attributes,{'tableName':_0x326b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 2da3797..80af84a 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 _0x2420=['debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','ShowWhatsappAccount','find','options','raw','attributes','map','include','model','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f32af,_0x1514ef){var _0x64627e=function(_0x5886da){while(--_0x5886da){_0x1f32af['push'](_0x1f32af['shift']());}};_0x64627e(++_0x1514ef);}(_0x2420,0xfd));var _0x0242=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x2420[_0x4fc9e6];return _0x551d28;};'use strict';var _=require(_0x0242('0x0'));var util=require(_0x0242('0x1'));var moment=require(_0x0242('0x2'));var BPromise=require(_0x0242('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0242('0x4'));var db=require(_0x0242('0x5'))['db'];var utils=require(_0x0242('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x0242('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0242('0x8')]({'port':0x232a});config[_0x0242('0x9')]=_[_0x0242('0xa')](config[_0x0242('0x9')],{'host':_0x0242('0xb'),'port':0x18eb});var socket=require(_0x0242('0xc'))(new Redis(config[_0x0242('0x9')]));require(_0x0242('0xd'))['register'](socket);function respondWithRpcPromise(_0x3add53,_0x5b9032,_0xcad981){return new BPromise(function(_0x3070d1,_0x1be3a2){return client[_0x0242('0xe')](_0x3add53,_0xcad981)[_0x0242('0xf')](function(_0x23c9bc){logger[_0x0242('0x10')](_0x0242('0x11'),_0x5b9032,_0x0242('0x12'));logger[_0x0242('0x13')](_0x0242('0x14'),_0x5b9032,_0x0242('0x12'),JSON[_0x0242('0x15')](_0x23c9bc));if(_0x23c9bc[_0x0242('0x16')]){if(_0x23c9bc[_0x0242('0x16')]['code']===0x1f4){logger['error'](_0x0242('0x11'),_0x5b9032,_0x23c9bc[_0x0242('0x16')][_0x0242('0x17')]);return _0x1be3a2(_0x23c9bc[_0x0242('0x16')][_0x0242('0x17')]);}logger[_0x0242('0x16')](_0x0242('0x11'),_0x5b9032,_0x23c9bc['error'][_0x0242('0x17')]);return _0x3070d1(_0x23c9bc[_0x0242('0x16')][_0x0242('0x17')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x5b9032,_0x0242('0x12'));_0x3070d1(_0x23c9bc[_0x0242('0x18')][_0x0242('0x17')]);}})['catch'](function(_0x155df4){logger[_0x0242('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x5b9032,_0x155df4);_0x1be3a2(_0x155df4);});});}exports[_0x0242('0x19')]=function(_0x5ef28a){var _0x11af1a=this;return new Promise(function(_0x4cdfe7,_0x2cf452){return db['WhatsappAccount'][_0x0242('0x1a')]({'raw':_0x5ef28a[_0x0242('0x1b')]?_0x5ef28a[_0x0242('0x1b')][_0x0242('0x1c')]===undefined?!![]:![]:!![],'where':_0x5ef28a[_0x0242('0x1b')]?_0x5ef28a[_0x0242('0x1b')]['where']||null:null,'attributes':_0x5ef28a['options']?_0x5ef28a[_0x0242('0x1b')][_0x0242('0x1d')]||null:null,'include':_0x5ef28a[_0x0242('0x1b')]?_0x5ef28a[_0x0242('0x1b')]['include']?_[_0x0242('0x1e')](_0x5ef28a[_0x0242('0x1b')][_0x0242('0x1f')],function(_0xdbd01c){return{'model':db[_0xdbd01c[_0x0242('0x20')]],'as':_0xdbd01c['as'],'attributes':_0xdbd01c[_0x0242('0x1d')],'include':_0xdbd01c['include']?_['map'](_0xdbd01c[_0x0242('0x1f')],function(_0x28539e){return{'model':db[_0x28539e[_0x0242('0x20')]],'as':_0x28539e['as'],'attributes':_0x28539e[_0x0242('0x1d')],'include':_0x28539e[_0x0242('0x1f')]?_[_0x0242('0x1e')](_0x28539e[_0x0242('0x1f')],function(_0x1e89be){return{'model':db[_0x1e89be[_0x0242('0x20')]],'as':_0x1e89be['as'],'attributes':_0x1e89be['attributes']};}):[]};}):[]};}):[]:[]})[_0x0242('0xf')](function(_0x14232){logger[_0x0242('0x10')](_0x0242('0x19'),_0x5ef28a);logger[_0x0242('0x13')](_0x0242('0x19'),_0x5ef28a,JSON[_0x0242('0x15')](_0x14232));_0x4cdfe7(_0x14232);})[_0x0242('0x21')](function(_0x3abcdc){logger[_0x0242('0x16')]('ShowWhatsappAccount',_0x3abcdc['message'],_0x5ef28a);_0x2cf452(_0x11af1a[_0x0242('0x16')](0x1f4,_0x3abcdc[_0x0242('0x17')]));});});}; \ No newline at end of file +var _0xccd8=['request','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','ShowWhatsappAccount','find','raw','options','where','attributes','map','include','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xccd8,0x10b));var _0x8ccd=function(_0x39ac23,_0x41cb30){_0x39ac23=_0x39ac23-0x0;var _0x1870a2=_0xccd8[_0x39ac23];return _0x1870a2;};'use strict';var _=require(_0x8ccd('0x0'));var util=require(_0x8ccd('0x1'));var moment=require(_0x8ccd('0x2'));var BPromise=require(_0x8ccd('0x3'));var rs=require(_0x8ccd('0x4'));var fs=require('fs');var Redis=require(_0x8ccd('0x5'));var db=require(_0x8ccd('0x6'))['db'];var utils=require(_0x8ccd('0x7'));var logger=require(_0x8ccd('0x8'))(_0x8ccd('0x9'));var config=require(_0x8ccd('0xa'));var jayson=require(_0x8ccd('0xb'));var client=jayson[_0x8ccd('0xc')][_0x8ccd('0xd')]({'port':0x232a});config[_0x8ccd('0xe')]=_[_0x8ccd('0xf')](config[_0x8ccd('0xe')],{'host':_0x8ccd('0x10'),'port':0x18eb});var socket=require(_0x8ccd('0x11'))(new Redis(config[_0x8ccd('0xe')]));require(_0x8ccd('0x12'))[_0x8ccd('0x13')](socket);function respondWithRpcPromise(_0x572726,_0x3d0639,_0x5a5595){return new BPromise(function(_0x485cd7,_0x57054a){return client[_0x8ccd('0x14')](_0x572726,_0x5a5595)['then'](function(_0x3c8423){logger[_0x8ccd('0x15')](_0x8ccd('0x16'),_0x3d0639,_0x8ccd('0x17'));logger[_0x8ccd('0x18')](_0x8ccd('0x19'),_0x3d0639,_0x8ccd('0x17'),JSON[_0x8ccd('0x1a')](_0x3c8423));if(_0x3c8423[_0x8ccd('0x1b')]){if(_0x3c8423[_0x8ccd('0x1b')][_0x8ccd('0x1c')]===0x1f4){logger[_0x8ccd('0x1b')](_0x8ccd('0x16'),_0x3d0639,_0x3c8423[_0x8ccd('0x1b')][_0x8ccd('0x1d')]);return _0x57054a(_0x3c8423['error'][_0x8ccd('0x1d')]);}logger[_0x8ccd('0x1b')](_0x8ccd('0x16'),_0x3d0639,_0x3c8423[_0x8ccd('0x1b')][_0x8ccd('0x1d')]);return _0x485cd7(_0x3c8423['error'][_0x8ccd('0x1d')]);}else{logger['info'](_0x8ccd('0x16'),_0x3d0639,'request\x20sent');_0x485cd7(_0x3c8423[_0x8ccd('0x1e')][_0x8ccd('0x1d')]);}})['catch'](function(_0x5ab325){logger[_0x8ccd('0x1b')](_0x8ccd('0x16'),_0x3d0639,_0x5ab325);_0x57054a(_0x5ab325);});});}exports[_0x8ccd('0x1f')]=function(_0x5ef41b){var _0x4bc62f=this;return new Promise(function(_0x5832c0,_0x3da385){return db['WhatsappAccount'][_0x8ccd('0x20')]({'raw':_0x5ef41b['options']?_0x5ef41b['options'][_0x8ccd('0x21')]===undefined?!![]:![]:!![],'where':_0x5ef41b[_0x8ccd('0x22')]?_0x5ef41b[_0x8ccd('0x22')][_0x8ccd('0x23')]||null:null,'attributes':_0x5ef41b['options']?_0x5ef41b[_0x8ccd('0x22')][_0x8ccd('0x24')]||null:null,'include':_0x5ef41b[_0x8ccd('0x22')]?_0x5ef41b['options']['include']?_[_0x8ccd('0x25')](_0x5ef41b[_0x8ccd('0x22')]['include'],function(_0xf3c955){return{'model':db[_0xf3c955['model']],'as':_0xf3c955['as'],'attributes':_0xf3c955[_0x8ccd('0x24')],'include':_0xf3c955['include']?_[_0x8ccd('0x25')](_0xf3c955[_0x8ccd('0x26')],function(_0x229e01){return{'model':db[_0x229e01['model']],'as':_0x229e01['as'],'attributes':_0x229e01[_0x8ccd('0x24')],'include':_0x229e01[_0x8ccd('0x26')]?_[_0x8ccd('0x25')](_0x229e01[_0x8ccd('0x26')],function(_0x424e95){return{'model':db[_0x424e95[_0x8ccd('0x27')]],'as':_0x424e95['as'],'attributes':_0x424e95[_0x8ccd('0x24')]};}):[]};}):[]};}):[]:[]})[_0x8ccd('0x28')](function(_0x450c91){logger[_0x8ccd('0x15')](_0x8ccd('0x1f'),_0x5ef41b);logger['debug'](_0x8ccd('0x1f'),_0x5ef41b,JSON[_0x8ccd('0x1a')](_0x450c91));_0x5832c0(_0x450c91);})['catch'](function(_0x41f9d8){logger[_0x8ccd('0x1b')]('ShowWhatsappAccount',_0x41f9d8[_0x8ccd('0x1d')],_0x5ef41b);_0x3da385(_0x4bc62f[_0x8ccd('0x1b')](0x1f4,_0x41f9d8['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5d55c7d..248f093 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 _0x2394=['removeListener','length','whatsappAccount:','save','update'];(function(_0x34b7ae,_0x5d3602){var _0x16aac5=function(_0x4943c6){while(--_0x4943c6){_0x34b7ae['push'](_0x34b7ae['shift']());}};_0x16aac5(++_0x5d3602);}(_0x2394,0x1a7));var _0x4239=function(_0x4f7016,_0x4e36b2){_0x4f7016=_0x4f7016-0x0;var _0x4617d9=_0x2394[_0x4f7016];return _0x4617d9;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x4239('0x0'),'remove',_0x4239('0x1')];function createListener(_0x25d1e6,_0x3356f0){return function(_0x262464){_0x3356f0['emit'](_0x25d1e6,_0x262464);};}function removeListener(_0x518924,_0x484584){return function(){WhatsappAccountEvents[_0x4239('0x2')](_0x518924,_0x484584);};}exports['register']=function(_0x4a37ad){for(var _0x385d72=0x0,_0x42b83b=events[_0x4239('0x3')];_0x385d72<_0x42b83b;_0x385d72++){var _0x3e98de=events[_0x385d72];var _0x52b139=createListener(_0x4239('0x4')+_0x3e98de,_0x4a37ad);WhatsappAccountEvents['on'](_0x3e98de,_0x52b139);}}; \ No newline at end of file +var _0xbd98=['./whatsappAccount.events','save','remove','update','emit','removeListener','register','length'];(function(_0x330414,_0x4f3207){var _0x99dbff=function(_0x166f85){while(--_0x166f85){_0x330414['push'](_0x330414['shift']());}};_0x99dbff(++_0x4f3207);}(_0xbd98,0x120));var _0x8bd9=function(_0x120694,_0x24aaba){_0x120694=_0x120694-0x0;var _0x188da3=_0xbd98[_0x120694];return _0x188da3;};'use strict';var WhatsappAccountEvents=require(_0x8bd9('0x0'));var events=[_0x8bd9('0x1'),_0x8bd9('0x2'),_0x8bd9('0x3')];function createListener(_0x59876f,_0x47e560){return function(_0x369848){_0x47e560[_0x8bd9('0x4')](_0x59876f,_0x369848);};}function removeListener(_0x1b2f02,_0x55df61){return function(){WhatsappAccountEvents[_0x8bd9('0x5')](_0x1b2f02,_0x55df61);};}exports[_0x8bd9('0x6')]=function(_0x46e824){for(var _0x4edde0=0x0,_0x1792b0=events[_0x8bd9('0x7')];_0x4edde0<_0x1792b0;_0x4edde0++){var _0x2128c3=events[_0x4edde0];var _0x27bafb=createListener('whatsappAccount:'+_0x2128c3,_0x46e824);WhatsappAccountEvents['on'](_0x2128c3,_0x27bafb);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 0f8c14d..30303e2 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 _0xb996=['post','create','put','update','delete','/:id','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated'];(function(_0x35eee2,_0x3e19af){var _0xb47b69=function(_0x4f2712){while(--_0x4f2712){_0x35eee2['push'](_0x35eee2['shift']());}};_0xb47b69(++_0x3e19af);}(_0xb996,0x194));var _0x6b99=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xb996[_0x2ec461];return _0x28603d;};'use strict';var multer=require(_0x6b99('0x0'));var util=require('util');var path=require(_0x6b99('0x1'));var timeout=require(_0x6b99('0x2'));var express=require(_0x6b99('0x3'));var router=express['Router']();var fs_extra=require(_0x6b99('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6b99('0x5'));var config=require(_0x6b99('0x6'));var controller=require(_0x6b99('0x7'));router[_0x6b99('0x8')]('/',auth[_0x6b99('0x9')](),controller['index']);router[_0x6b99('0x8')]('/:id',auth[_0x6b99('0x9')](),controller['show']);router[_0x6b99('0xa')]('/',auth[_0x6b99('0x9')](),controller[_0x6b99('0xb')]);router[_0x6b99('0xc')]('/:id',auth[_0x6b99('0x9')](),controller[_0x6b99('0xd')]);router[_0x6b99('0xe')](_0x6b99('0xf'),auth['isAuthenticated'](),controller[_0x6b99('0x10')]);module[_0x6b99('0x11')]=router; \ No newline at end of file +var _0x952f=['show','post','put','update','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id'];(function(_0x532f4f,_0x2ef9be){var _0x38bcd7=function(_0x2b6f90){while(--_0x2b6f90){_0x532f4f['push'](_0x532f4f['shift']());}};_0x38bcd7(++_0x2ef9be);}(_0x952f,0x1c4));var _0xf952=function(_0x44268d,_0xad8443){_0x44268d=_0x44268d-0x0;var _0x4be92d=_0x952f[_0x44268d];return _0x4be92d;};'use strict';var multer=require('multer');var util=require(_0xf952('0x0'));var path=require(_0xf952('0x1'));var timeout=require(_0xf952('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf952('0x3'));var auth=require(_0xf952('0x4'));var interaction=require(_0xf952('0x5'));var config=require(_0xf952('0x6'));var controller=require(_0xf952('0x7'));router['get']('/',auth[_0xf952('0x8')](),controller[_0xf952('0x9')]);router[_0xf952('0xa')](_0xf952('0xb'),auth[_0xf952('0x8')](),controller[_0xf952('0xc')]);router[_0xf952('0xd')]('/',auth[_0xf952('0x8')](),controller['create']);router[_0xf952('0xe')](_0xf952('0xb'),auth['isAuthenticated'](),controller[_0xf952('0xf')]);router['delete']('/:id',auth[_0xf952('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 6419f28..55a8496 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 _0x3032=['sequelize','STRING','noop','TEXT','*,*,*,*'];(function(_0xed0571,_0x2b26fc){var _0xef80f3=function(_0x22980b){while(--_0x22980b){_0xed0571['push'](_0xed0571['shift']());}};_0xef80f3(++_0x2b26fc);}(_0x3032,0xcd));var _0x2303=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3032[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2303('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2303('0x1')],'allowNull':![],'defaultValue':_0x2303('0x2')},'appdata':{'type':Sequelize[_0x2303('0x3')]()},'description':{'type':Sequelize[_0x2303('0x1')]},'interval':{'type':Sequelize[_0x2303('0x1')],'defaultValue':_0x2303('0x4')}}; \ No newline at end of file +var _0x34e4=['INTEGER','STRING','noop','TEXT','sequelize'];(function(_0x29db87,_0x73748){var _0x69d994=function(_0x134370){while(--_0x134370){_0x29db87['push'](_0x29db87['shift']());}};_0x69d994(++_0x73748);}(_0x34e4,0x18a));var _0x434e=function(_0x2f3d0e,_0x1d79a0){_0x2f3d0e=_0x2f3d0e-0x0;var _0x23c683=_0x34e4[_0x2f3d0e];return _0x23c683;};'use strict';var Sequelize=require(_0x434e('0x0'));module['exports']={'priority':{'type':Sequelize[_0x434e('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x434e('0x2')],'allowNull':![],'defaultValue':_0x434e('0x3')},'appdata':{'type':Sequelize[_0x434e('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x434e('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9347902..898ea76 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 _0x9e63=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','options','WhatsappApplication','includeAll','include','catch','show','params','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../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','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e63,0x65));var _0x39e6=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x9e63[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0x39e6('0x0'));var rimraf=require(_0x39e6('0x1'));var zipdir=require(_0x39e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39e6('0x3'));var moment=require(_0x39e6('0x4'));var BPromise=require(_0x39e6('0x5'));var Mustache=require(_0x39e6('0x6'));var util=require(_0x39e6('0x7'));var path=require(_0x39e6('0x8'));var sox=require(_0x39e6('0x9'));var csv=require(_0x39e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39e6('0xb'));var _=require(_0x39e6('0xc'));var squel=require(_0x39e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x39e6('0xe'));var deskjs=require(_0x39e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x39e6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x39e6('0x11'));var qs=require(_0x39e6('0x12'));var as=require(_0x39e6('0x13'));var hardwareService=require(_0x39e6('0x14'));var logger=require(_0x39e6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x39e6('0x16'));var licenseUtil=require(_0x39e6('0x17'));var db=require(_0x39e6('0x18'))['db'];function respondWithStatusCode(_0x80f85b,_0x168d1d){_0x168d1d=_0x168d1d||0xcc;return function(_0x57d223){if(_0x57d223){return _0x80f85b[_0x39e6('0x19')](_0x168d1d);}return _0x80f85b[_0x39e6('0x1a')](_0x168d1d)[_0x39e6('0x1b')]();};}function respondWithResult(_0x12253a,_0x4b9fc1){_0x4b9fc1=_0x4b9fc1||0xc8;return function(_0x4ed79d){if(_0x4ed79d){return _0x12253a[_0x39e6('0x1a')](_0x4b9fc1)[_0x39e6('0x1c')](_0x4ed79d);}};}function respondWithFilteredResult(_0xbca4f5,_0x3a4651){return function(_0x30c73e){if(_0x30c73e){var _0x5a86e3=typeof _0x3a4651[_0x39e6('0x1d')]===_0x39e6('0x1e')&&typeof _0x3a4651[_0x39e6('0x1f')]===_0x39e6('0x1e');var _0x18d076=_0x30c73e[_0x39e6('0x20')];var _0x1a3adf=_0x5a86e3?0x0:_0x3a4651['offset'];var _0x24a61c=_0x5a86e3?_0x30c73e[_0x39e6('0x20')]:_0x3a4651[_0x39e6('0x1d')]+_0x3a4651['limit'];var _0x47e94b;if(_0x24a61c>=_0x18d076){_0x24a61c=_0x18d076;_0x47e94b=0xc8;}else{_0x47e94b=0xce;}_0xbca4f5[_0x39e6('0x1a')](_0x47e94b);return _0xbca4f5[_0x39e6('0x21')](_0x39e6('0x22'),_0x1a3adf+'-'+_0x24a61c+'/'+_0x18d076)[_0x39e6('0x1c')](_0x30c73e);}return null;};}function patchUpdates(_0x18031b){return function(_0x5421fd){try{jsonpatch[_0x39e6('0x23')](_0x5421fd,_0x18031b,!![]);}catch(_0x59c532){return BPromise[_0x39e6('0x24')](_0x59c532);}return _0x5421fd[_0x39e6('0x25')]();};}function saveUpdates(_0x4b826a,_0x2884f6){return function(_0x1c626a){if(_0x1c626a){return _0x1c626a[_0x39e6('0x26')](_0x4b826a)[_0x39e6('0x27')](function(_0x314c7d){return _0x314c7d;});}return null;};}function removeEntity(_0x19df42,_0x183f33){return function(_0x4619ee){if(_0x4619ee){return _0x4619ee[_0x39e6('0x28')]()[_0x39e6('0x27')](function(){_0x19df42[_0x39e6('0x1a')](0xcc)[_0x39e6('0x1b')]();});}};}function handleEntityNotFound(_0x3dce4d,_0x5102d8){return function(_0x537462){if(!_0x537462){_0x3dce4d['sendStatus'](0x194);}return _0x537462;};}function handleError(_0x4aa6ee,_0x48fdb){_0x48fdb=_0x48fdb||0x1f4;return function(_0x22b820){logger[_0x39e6('0x29')](_0x22b820[_0x39e6('0x2a')]);if(_0x22b820['name']){delete _0x22b820[_0x39e6('0x2b')];}_0x4aa6ee[_0x39e6('0x1a')](_0x48fdb)['send'](_0x22b820);};}exports[_0x39e6('0x2c')]=function(_0x1a60ae,_0x582c81){var _0x1acc77={},_0x2117d0={},_0xc3c7fe={'count':0x0,'rows':[]};var _0x3e690f=_[_0x39e6('0x2d')](db['WhatsappApplication'][_0x39e6('0x2e')],function(_0x596d6f){return{'name':_0x596d6f[_0x39e6('0x2f')],'type':_0x596d6f[_0x39e6('0x30')][_0x39e6('0x31')]};});_0x2117d0[_0x39e6('0x32')]=_[_0x39e6('0x2d')](_0x3e690f,_0x39e6('0x2b'));_0x2117d0[_0x39e6('0x33')]=_[_0x39e6('0x34')](_0x1a60ae[_0x39e6('0x33')]);_0x2117d0[_0x39e6('0x35')]=_[_0x39e6('0x36')](_0x2117d0[_0x39e6('0x32')],_0x2117d0[_0x39e6('0x33')]);_0x1acc77[_0x39e6('0x37')]=_[_0x39e6('0x36')](_0x2117d0[_0x39e6('0x32')],qs['fields'](_0x1a60ae[_0x39e6('0x33')][_0x39e6('0x38')]));_0x1acc77[_0x39e6('0x37')]=_0x1acc77['attributes'][_0x39e6('0x39')]?_0x1acc77[_0x39e6('0x37')]:_0x2117d0[_0x39e6('0x32')];if(!_0x1a60ae['query'][_0x39e6('0x3a')]('nolimit')){_0x1acc77[_0x39e6('0x1f')]=qs[_0x39e6('0x1f')](_0x1a60ae[_0x39e6('0x33')]['limit']);_0x1acc77[_0x39e6('0x1d')]=qs[_0x39e6('0x1d')](_0x1a60ae[_0x39e6('0x33')][_0x39e6('0x1d')]);}_0x1acc77['order']=qs['sort'](_0x1a60ae[_0x39e6('0x33')][_0x39e6('0x3b')]);_0x1acc77[_0x39e6('0x3c')]=qs[_0x39e6('0x35')](_[_0x39e6('0x3d')](_0x1a60ae[_0x39e6('0x33')],_0x2117d0[_0x39e6('0x35')]),_0x3e690f);if(_0x1a60ae['query'][_0x39e6('0x3e')]){_0x1acc77['where']=_['merge'](_0x1acc77[_0x39e6('0x3c')],{'$or':_[_0x39e6('0x2d')](_0x3e690f,function(_0x34aee8){if(_0x34aee8[_0x39e6('0x30')]!==_0x39e6('0x3f')){var _0x380663={};_0x380663[_0x34aee8[_0x39e6('0x2b')]]={'$like':'%'+_0x1a60ae[_0x39e6('0x33')]['filter']+'%'};return _0x380663;}})});}_0x1acc77=_[_0x39e6('0x40')]({},_0x1acc77,_0x1a60ae[_0x39e6('0x41')]);var _0x2c4ae9={'where':_0x1acc77[_0x39e6('0x3c')]};return db[_0x39e6('0x42')]['count'](_0x2c4ae9)['then'](function(_0x16df4b){_0xc3c7fe[_0x39e6('0x20')]=_0x16df4b;if(_0x1a60ae['query'][_0x39e6('0x43')]){_0x1acc77[_0x39e6('0x44')]=[{'all':!![]}];}return db['WhatsappApplication']['findAll'](_0x1acc77);})[_0x39e6('0x27')](function(_0xd3342a){_0xc3c7fe['rows']=_0xd3342a;return _0xc3c7fe;})[_0x39e6('0x27')](respondWithFilteredResult(_0x582c81,_0x1acc77))[_0x39e6('0x45')](handleError(_0x582c81,null));};exports[_0x39e6('0x46')]=function(_0x2f3021,_0x3f8b5f){var _0x3bdd55={'raw':!![],'where':{'id':_0x2f3021[_0x39e6('0x47')]['id']}},_0x28397d={};_0x28397d['model']=_[_0x39e6('0x34')](db[_0x39e6('0x42')][_0x39e6('0x2e')]);_0x28397d['query']=_['keys'](_0x2f3021[_0x39e6('0x33')]);_0x28397d[_0x39e6('0x35')]=_[_0x39e6('0x36')](_0x28397d[_0x39e6('0x32')],_0x28397d[_0x39e6('0x33')]);_0x3bdd55[_0x39e6('0x37')]=_[_0x39e6('0x36')](_0x28397d['model'],qs['fields'](_0x2f3021['query'][_0x39e6('0x38')]));_0x3bdd55['attributes']=_0x3bdd55[_0x39e6('0x37')][_0x39e6('0x39')]?_0x3bdd55[_0x39e6('0x37')]:_0x28397d[_0x39e6('0x32')];if(_0x2f3021[_0x39e6('0x33')][_0x39e6('0x43')]){_0x3bdd55[_0x39e6('0x44')]=[{'all':!![]}];}_0x3bdd55=_[_0x39e6('0x40')]({},_0x3bdd55,_0x2f3021[_0x39e6('0x41')]);return db[_0x39e6('0x42')]['find'](_0x3bdd55)[_0x39e6('0x27')](handleEntityNotFound(_0x3f8b5f,null))[_0x39e6('0x27')](respondWithResult(_0x3f8b5f,null))[_0x39e6('0x45')](handleError(_0x3f8b5f,null));};exports[_0x39e6('0x48')]=function(_0x4ea62b,_0x49226f){return db[_0x39e6('0x42')]['create'](_0x4ea62b[_0x39e6('0x49')],{})[_0x39e6('0x27')](respondWithResult(_0x49226f,0xc9))['catch'](handleError(_0x49226f,null));};exports[_0x39e6('0x26')]=function(_0x2300b9,_0xabd04b){if(_0x2300b9[_0x39e6('0x49')]['id']){delete _0x2300b9[_0x39e6('0x49')]['id'];}return db[_0x39e6('0x42')][_0x39e6('0x4a')]({'where':{'id':_0x2300b9[_0x39e6('0x47')]['id']}})[_0x39e6('0x27')](handleEntityNotFound(_0xabd04b,null))[_0x39e6('0x27')](saveUpdates(_0x2300b9[_0x39e6('0x49')],null))[_0x39e6('0x27')](respondWithResult(_0xabd04b,null))[_0x39e6('0x45')](handleError(_0xabd04b,null));};exports[_0x39e6('0x28')]=function(_0x13e478,_0x12ee54){return db[_0x39e6('0x42')]['find']({'where':{'id':_0x13e478[_0x39e6('0x47')]['id']}})['then'](handleEntityNotFound(_0x12ee54,null))['then'](removeEntity(_0x12ee54,null))['catch'](handleError(_0x12ee54,null));}; \ No newline at end of file +var _0x6b19=['name','send','index','map','WhatsappApplication','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','create','body','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus'];(function(_0x2896f6,_0x180922){var _0x42d237=function(_0x3fa515){while(--_0x3fa515){_0x2896f6['push'](_0x2896f6['shift']());}};_0x42d237(++_0x180922);}(_0x6b19,0xf4));var _0x96b1=function(_0x50907b,_0xceb784){_0x50907b=_0x50907b-0x0;var _0x36739c=_0x6b19[_0x50907b];return _0x36739c;};'use strict';var emlformat=require(_0x96b1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x96b1('0x1'));var jsonpatch=require(_0x96b1('0x2'));var rp=require('request-promise');var moment=require(_0x96b1('0x3'));var BPromise=require(_0x96b1('0x4'));var Mustache=require(_0x96b1('0x5'));var util=require(_0x96b1('0x6'));var path=require('path');var sox=require(_0x96b1('0x7'));var csv=require(_0x96b1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96b1('0x9'));var squel=require(_0x96b1('0xa'));var crypto=require('crypto');var jsforce=require(_0x96b1('0xb'));var deskjs=require(_0x96b1('0xc'));var toCsv=require('to-csv');var querystring=require(_0x96b1('0xd'));var Papa=require(_0x96b1('0xe'));var Redis=require(_0x96b1('0xf'));var authService=require(_0x96b1('0x10'));var qs=require(_0x96b1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x96b1('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x96b1('0x13'));var db=require(_0x96b1('0x14'))['db'];function respondWithStatusCode(_0x16ee32,_0x1d942a){_0x1d942a=_0x1d942a||0xcc;return function(_0x2d7569){if(_0x2d7569){return _0x16ee32['sendStatus'](_0x1d942a);}return _0x16ee32[_0x96b1('0x15')](_0x1d942a)[_0x96b1('0x16')]();};}function respondWithResult(_0xe809b6,_0x2dbaac){_0x2dbaac=_0x2dbaac||0xc8;return function(_0x28b596){if(_0x28b596){return _0xe809b6[_0x96b1('0x15')](_0x2dbaac)[_0x96b1('0x17')](_0x28b596);}};}function respondWithFilteredResult(_0x1e5fdf,_0x3ba832){return function(_0x5772d3){if(_0x5772d3){var _0x2e9615=typeof _0x3ba832[_0x96b1('0x18')]===_0x96b1('0x19')&&typeof _0x3ba832[_0x96b1('0x1a')]===_0x96b1('0x19');var _0x23852a=_0x5772d3[_0x96b1('0x1b')];var _0x41227b=_0x2e9615?0x0:_0x3ba832[_0x96b1('0x18')];var _0x44cc44=_0x2e9615?_0x5772d3[_0x96b1('0x1b')]:_0x3ba832['offset']+_0x3ba832['limit'];var _0x151178;if(_0x44cc44>=_0x23852a){_0x44cc44=_0x23852a;_0x151178=0xc8;}else{_0x151178=0xce;}_0x1e5fdf['status'](_0x151178);return _0x1e5fdf['set'](_0x96b1('0x1c'),_0x41227b+'-'+_0x44cc44+'/'+_0x23852a)[_0x96b1('0x17')](_0x5772d3);}return null;};}function patchUpdates(_0x2bb819){return function(_0x4f0d78){try{jsonpatch[_0x96b1('0x1d')](_0x4f0d78,_0x2bb819,!![]);}catch(_0x3954e3){return BPromise[_0x96b1('0x1e')](_0x3954e3);}return _0x4f0d78[_0x96b1('0x1f')]();};}function saveUpdates(_0x1e1436,_0x276919){return function(_0x416022){if(_0x416022){return _0x416022[_0x96b1('0x20')](_0x1e1436)[_0x96b1('0x21')](function(_0x3a17d3){return _0x3a17d3;});}return null;};}function removeEntity(_0x2acd58,_0x1b0f88){return function(_0x295f05){if(_0x295f05){return _0x295f05[_0x96b1('0x22')]()[_0x96b1('0x21')](function(){_0x2acd58[_0x96b1('0x15')](0xcc)[_0x96b1('0x16')]();});}};}function handleEntityNotFound(_0x5b19b6,_0x3f5049){return function(_0x226603){if(!_0x226603){_0x5b19b6[_0x96b1('0x23')](0x194);}return _0x226603;};}function handleError(_0x321863,_0x3b7492){_0x3b7492=_0x3b7492||0x1f4;return function(_0x2ad760){logger['error'](_0x2ad760['stack']);if(_0x2ad760[_0x96b1('0x24')]){delete _0x2ad760['name'];}_0x321863[_0x96b1('0x15')](_0x3b7492)[_0x96b1('0x25')](_0x2ad760);};}exports[_0x96b1('0x26')]=function(_0x106864,_0x4e4426){var _0x59fc7c={},_0x45c20e={},_0x9fc960={'count':0x0,'rows':[]};var _0x5a9332=_[_0x96b1('0x27')](db[_0x96b1('0x28')][_0x96b1('0x29')],function(_0x2262ad){return{'name':_0x2262ad[_0x96b1('0x2a')],'type':_0x2262ad[_0x96b1('0x2b')]['key']};});_0x45c20e[_0x96b1('0x2c')]=_[_0x96b1('0x27')](_0x5a9332,_0x96b1('0x24'));_0x45c20e[_0x96b1('0x2d')]=_[_0x96b1('0x2e')](_0x106864[_0x96b1('0x2d')]);_0x45c20e[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x45c20e['model'],_0x45c20e[_0x96b1('0x2d')]);_0x59fc7c[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x45c20e[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x59fc7c[_0x96b1('0x31')]=_0x59fc7c['attributes'][_0x96b1('0x33')]?_0x59fc7c[_0x96b1('0x31')]:_0x45c20e[_0x96b1('0x2c')];if(!_0x106864['query']['hasOwnProperty'](_0x96b1('0x34'))){_0x59fc7c[_0x96b1('0x1a')]=qs['limit'](_0x106864['query']['limit']);_0x59fc7c[_0x96b1('0x18')]=qs[_0x96b1('0x18')](_0x106864[_0x96b1('0x2d')][_0x96b1('0x18')]);}_0x59fc7c[_0x96b1('0x35')]=qs[_0x96b1('0x36')](_0x106864[_0x96b1('0x2d')]['sort']);_0x59fc7c[_0x96b1('0x37')]=qs['filters'](_['pick'](_0x106864[_0x96b1('0x2d')],_0x45c20e[_0x96b1('0x2f')]),_0x5a9332);if(_0x106864['query'][_0x96b1('0x38')]){_0x59fc7c[_0x96b1('0x37')]=_[_0x96b1('0x39')](_0x59fc7c[_0x96b1('0x37')],{'$or':_[_0x96b1('0x27')](_0x5a9332,function(_0x49a5d7){if(_0x49a5d7[_0x96b1('0x2b')]!==_0x96b1('0x3a')){var _0x35ea21={};_0x35ea21[_0x49a5d7['name']]={'$like':'%'+_0x106864[_0x96b1('0x2d')]['filter']+'%'};return _0x35ea21;}})});}_0x59fc7c=_[_0x96b1('0x39')]({},_0x59fc7c,_0x106864['options']);var _0x53e072={'where':_0x59fc7c[_0x96b1('0x37')]};return db[_0x96b1('0x28')][_0x96b1('0x1b')](_0x53e072)[_0x96b1('0x21')](function(_0x4833c0){_0x9fc960[_0x96b1('0x1b')]=_0x4833c0;if(_0x106864[_0x96b1('0x2d')][_0x96b1('0x3b')]){_0x59fc7c[_0x96b1('0x3c')]=[{'all':!![]}];}return db[_0x96b1('0x28')][_0x96b1('0x3d')](_0x59fc7c);})[_0x96b1('0x21')](function(_0x52c232){_0x9fc960[_0x96b1('0x3e')]=_0x52c232;return _0x9fc960;})[_0x96b1('0x21')](respondWithFilteredResult(_0x4e4426,_0x59fc7c))[_0x96b1('0x3f')](handleError(_0x4e4426,null));};exports[_0x96b1('0x40')]=function(_0x50949f,_0x101253){var _0x40adda={'raw':!![],'where':{'id':_0x50949f[_0x96b1('0x41')]['id']}},_0x40a022={};_0x40a022[_0x96b1('0x2c')]=_[_0x96b1('0x2e')](db[_0x96b1('0x28')]['rawAttributes']);_0x40a022[_0x96b1('0x2d')]=_['keys'](_0x50949f[_0x96b1('0x2d')]);_0x40a022[_0x96b1('0x2f')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],_0x40a022[_0x96b1('0x2d')]);_0x40adda[_0x96b1('0x31')]=_[_0x96b1('0x30')](_0x40a022[_0x96b1('0x2c')],qs[_0x96b1('0x32')](_0x50949f[_0x96b1('0x2d')][_0x96b1('0x32')]));_0x40adda[_0x96b1('0x31')]=_0x40adda['attributes']['length']?_0x40adda[_0x96b1('0x31')]:_0x40a022['model'];if(_0x50949f['query'][_0x96b1('0x3b')]){_0x40adda['include']=[{'all':!![]}];}_0x40adda=_[_0x96b1('0x39')]({},_0x40adda,_0x50949f[_0x96b1('0x42')]);return db[_0x96b1('0x28')]['find'](_0x40adda)[_0x96b1('0x21')](handleEntityNotFound(_0x101253,null))[_0x96b1('0x21')](respondWithResult(_0x101253,null))[_0x96b1('0x3f')](handleError(_0x101253,null));};exports[_0x96b1('0x43')]=function(_0x584582,_0x27be9f){return db['WhatsappApplication'][_0x96b1('0x43')](_0x584582[_0x96b1('0x44')],{})[_0x96b1('0x21')](respondWithResult(_0x27be9f,0xc9))[_0x96b1('0x3f')](handleError(_0x27be9f,null));};exports[_0x96b1('0x20')]=function(_0x3070da,_0x248844){if(_0x3070da[_0x96b1('0x44')]['id']){delete _0x3070da['body']['id'];}return db[_0x96b1('0x28')][_0x96b1('0x45')]({'where':{'id':_0x3070da['params']['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x248844,null))[_0x96b1('0x21')](saveUpdates(_0x3070da[_0x96b1('0x44')],null))[_0x96b1('0x21')](respondWithResult(_0x248844,null))[_0x96b1('0x3f')](handleError(_0x248844,null));};exports[_0x96b1('0x22')]=function(_0x404848,_0x2159ba){return db[_0x96b1('0x28')]['find']({'where':{'id':_0x404848[_0x96b1('0x41')]['id']}})[_0x96b1('0x21')](handleEntityNotFound(_0x2159ba,null))[_0x96b1('0x21')](removeEntity(_0x2159ba,null))[_0x96b1('0x3f')](handleError(_0x2159ba,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 61ade45..b6f9dc7 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 _0x0f9f=['./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x915353,_0x408188){var _0x20bf34=function(_0x3c7806){while(--_0x3c7806){_0x915353['push'](_0x915353['shift']());}};_0x20bf34(++_0x408188);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0xd27155,_0x730a5a){_0xd27155=_0xd27155-0x0;var _0x4d49c2=_0x0f9f[_0xd27155];return _0x4d49c2;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var logger=require(_0xf0f9('0x1'))(_0xf0f9('0x2'));var moment=require('moment');var BPromise=require(_0xf0f9('0x3'));var rp=require(_0xf0f9('0x4'));var fs=require('fs');var path=require(_0xf0f9('0x5'));var rimraf=require(_0xf0f9('0x6'));var config=require(_0xf0f9('0x7'));var attributes=require(_0xf0f9('0x8'));module[_0xf0f9('0x9')]=function(_0x3eaff3,_0x425fbe){return _0x3eaff3[_0xf0f9('0xa')]('WhatsappApplication',attributes,{'tableName':_0xf0f9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf0f9('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xac31=['request-promise','rimraf','../../config/environment','define','WhatsappApplication','whatsapp_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x402eff,_0x2525f2){var _0x2eb371=function(_0x15e9b3){while(--_0x15e9b3){_0x402eff['push'](_0x402eff['shift']());}};_0x2eb371(++_0x2525f2);}(_0xac31,0xca));var _0x1ac3=function(_0x428b98,_0x117fe3){_0x428b98=_0x428b98-0x0;var _0x59b23f=_0xac31[_0x428b98];return _0x59b23f;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var logger=require(_0x1ac3('0x2'))(_0x1ac3('0x3'));var moment=require(_0x1ac3('0x4'));var BPromise=require(_0x1ac3('0x5'));var rp=require(_0x1ac3('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0xbe22b7,_0x20027f){return _0xbe22b7[_0x1ac3('0x9')](_0x1ac3('0xa'),attributes,{'tableName':_0x1ac3('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1ac3('0xc')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index abf6852..798e3c4 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 _0xac31=['code','WhatsappApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','then','info','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x207aeb,_0x24980f){var _0x3fe650=function(_0x2e3333){while(--_0x2e3333){_0x207aeb['push'](_0x207aeb['shift']());}};_0x3fe650(++_0x24980f);}(_0xac31,0xca));var _0x1ac3=function(_0x12d68d,_0x452a0e){_0x12d68d=_0x12d68d-0x0;var _0xf05f5b=_0xac31[_0x12d68d];return _0xf05f5b;};'use strict';var _=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var moment=require(_0x1ac3('0x2'));var BPromise=require(_0x1ac3('0x3'));var rs=require(_0x1ac3('0x4'));var fs=require('fs');var Redis=require(_0x1ac3('0x5'));var db=require(_0x1ac3('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1ac3('0x7'))(_0x1ac3('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1ac3('0x9')][_0x1ac3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bf9b1,_0x1be223,_0x157604){return new BPromise(function(_0x57893c,_0x2d17de){return client['request'](_0x2bf9b1,_0x157604)[_0x1ac3('0xb')](function(_0x40b64c){logger[_0x1ac3('0xc')]('WhatsappApplication,\x20%s,\x20%s',_0x1be223,_0x1ac3('0xd'));logger[_0x1ac3('0xe')](_0x1ac3('0xf'),_0x1be223,_0x1ac3('0xd'),JSON[_0x1ac3('0x10')](_0x40b64c));if(_0x40b64c[_0x1ac3('0x11')]){if(_0x40b64c['error'][_0x1ac3('0x12')]===0x1f4){logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c[_0x1ac3('0x11')]['message']);return _0x2d17de(_0x40b64c[_0x1ac3('0x11')][_0x1ac3('0x14')]);}logger[_0x1ac3('0x11')](_0x1ac3('0x13'),_0x1be223,_0x40b64c['error'][_0x1ac3('0x14')]);return _0x57893c(_0x40b64c[_0x1ac3('0x11')]['message']);}else{logger[_0x1ac3('0xc')](_0x1ac3('0x13'),_0x1be223,_0x1ac3('0xd'));_0x57893c(_0x40b64c['result'][_0x1ac3('0x14')]);}})[_0x1ac3('0x15')](function(_0x23e6e9){logger['error'](_0x1ac3('0x13'),_0x1be223,_0x23e6e9);_0x2d17de(_0x23e6e9);});});} \ No newline at end of file +var _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x511faa,_0x46a144){var _0x1a3c23=function(_0x2148b7){while(--_0x2148b7){_0x511faa['push'](_0x511faa['shift']());}};_0x1a3c23(++_0x46a144);}(_0x668b,0x140));var _0xb668=function(_0x2742db,_0x58e00c){_0x2742db=_0x2742db-0x0;var _0x18659e=_0x668b[_0x2742db];return _0x18659e;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 951fd46..995a2ee 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 _0xeff8=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','exports','multer','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x46dc85,_0x462745){var _0x403918=function(_0xc1f168){while(--_0xc1f168){_0x46dc85['push'](_0x46dc85['shift']());}};_0x403918(++_0x462745);}(_0xeff8,0x186));var _0x8eff=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xeff8[_0xc67528];return _0x38e26d;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get']('/',auth[_0x8eff('0x9')](),controller[_0x8eff('0xa')]);router[_0x8eff('0xb')](_0x8eff('0xc'),auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xb')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),controller['show']);router['get'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x10')]);router['get'](_0x8eff('0x11'),auth[_0x8eff('0x9')](),controller['download']);router[_0x8eff('0x12')]('/',auth[_0x8eff('0x9')](),controller['create']);router['post'](_0x8eff('0xf'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x13')]);router[_0x8eff('0x12')](_0x8eff('0x14'),auth['isAuthenticated'](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x17')),controller[_0x8eff('0x18')]);router[_0x8eff('0x19')](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1a')),controller[_0x8eff('0x1b')]);router['delete'](_0x8eff('0xe'),auth[_0x8eff('0x9')](),interaction[_0x8eff('0x15')](_0x8eff('0x16'),_0x8eff('0x1c')),controller[_0x8eff('0x1d')]);router[_0x8eff('0x1e')](_0x8eff('0x14'),auth[_0x8eff('0x9')](),controller[_0x8eff('0x1f')]);module[_0x8eff('0x20')]=router; \ No newline at end of file +var _0x4745=['../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','index','isAuthenticated','/:id','show','/:id/messages','getMessages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','delete','removeTags','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4785ea,_0x5b3f4e){var _0xa46dae=function(_0x5dd34e){while(--_0x5dd34e){_0x4785ea['push'](_0x4785ea['shift']());}};_0xa46dae(++_0x5b3f4e);}(_0x4745,0x1e7));var _0x5474=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x4745[_0x40ac5e];return _0x2839d6;};'use strict';var multer=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var path=require(_0x5474('0x2'));var timeout=require(_0x5474('0x3'));var express=require(_0x5474('0x4'));var router=express[_0x5474('0x5')]();var fs_extra=require(_0x5474('0x6'));var auth=require(_0x5474('0x7'));var interaction=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var controller=require(_0x5474('0xa'));router[_0x5474('0xb')]('/',auth['isAuthenticated'](),controller[_0x5474('0xc')]);router[_0x5474('0xb')]('/describe',auth[_0x5474('0xd')](),controller['describe']);router[_0x5474('0xb')](_0x5474('0xe'),auth['isAuthenticated'](),controller[_0x5474('0xf')]);router[_0x5474('0xb')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x11')]);router[_0x5474('0xb')](_0x5474('0x12'),auth[_0x5474('0xd')](),controller['download']);router[_0x5474('0x13')]('/',auth[_0x5474('0xd')](),controller[_0x5474('0x14')]);router[_0x5474('0x13')](_0x5474('0x10'),auth[_0x5474('0xd')](),controller[_0x5474('0x15')]);router[_0x5474('0x13')](_0x5474('0x16'),auth['isAuthenticated'](),interaction[_0x5474('0x17')](_0x5474('0x18'),_0x5474('0x19')),controller[_0x5474('0x1a')]);router['put']('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x5474('0x18'),_0x5474('0x1b')),controller[_0x5474('0x1c')]);router['delete'](_0x5474('0xe'),auth[_0x5474('0xd')](),interaction['tracked'](_0x5474('0x18'),_0x5474('0x1d')),controller[_0x5474('0x1e')]);router[_0x5474('0x1f')](_0x5474('0x16'),auth['isAuthenticated'](),controller[_0x5474('0x20')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index b20ea99..a8ee500 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 _0x288a=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','INTEGER'];(function(_0x1b9d3c,_0x3cac1d){var _0x12971e=function(_0x136425){while(--_0x136425){_0x1b9d3c['push'](_0x1b9d3c['shift']());}};_0x12971e(++_0x3cac1d);}(_0x288a,0x188));var _0xa288=function(_0x25ed32,_0x5063db){_0x25ed32=_0x25ed32-0x0;var _0x4a2228=_0x288a[_0x25ed32];return _0x4a2228;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa288('0x0'));module[_0xa288('0x1')]={'closed':{'type':Sequelize[_0xa288('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa288('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xa288('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xa288('0x4')]},'read1stAt':{'type':Sequelize[_0xa288('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xa288('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa288('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xa288('0x5')]('in',_0xa288('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa288('0x7')]}}; \ No newline at end of file +var _0x352e=['moment','exports','BOOLEAN','DATE','STRING','out','ENUM','INTEGER','sequelize'];(function(_0x16cd0f,_0x1c7184){var _0x595bac=function(_0x2ce8b4){while(--_0x2ce8b4){_0x16cd0f['push'](_0x16cd0f['shift']());}};_0x595bac(++_0x1c7184);}(_0x352e,0x1a6));var _0xe352=function(_0x467d9a,_0x43d804){_0x467d9a=_0x467d9a-0x0;var _0x2b4d2d=_0x352e[_0x467d9a];return _0x2b4d2d;};'use strict';var Sequelize=require(_0xe352('0x0'));var moment=require(_0xe352('0x1'));module[_0xe352('0x2')]={'closed':{'type':Sequelize[_0xe352('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe352('0x4')]},'disposition':{'type':Sequelize[_0xe352('0x5')]},'secondDisposition':{'type':Sequelize[_0xe352('0x5')]},'thirdDisposition':{'type':Sequelize[_0xe352('0x5')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xe352('0x5')]},'read1stAt':{'type':Sequelize[_0xe352('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xe352('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xe352('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xe352('0x7')]('in',_0xe352('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xe352('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index b93063a..ac2fc4a 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 _0xedd7=['redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','show','params','model','keys','WhatsappInteraction','filters','attributes','intersection','fields','length','includeAll','merge','options','find','create','body','describe','WhatsappMessage','ids','omit','findOne','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','setTags','spread','Tag','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','server','files','tmp','push','User','fullname','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt','direction','secret','WhatsappAccount','Account','Owner','get','closedAt','disposition','basename','createWriteStream','out','System','value','renderFile','views','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','download','log','err','unlinkSync','zip-dir','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment'];(function(_0x553973,_0x37054b){var _0x4d4f40=function(_0x54f2af){while(--_0x54f2af){_0x553973['push'](_0x553973['shift']());}};_0x4d4f40(++_0x37054b);}(_0xedd7,0x6f));var _0x7edd=function(_0xd95a4f,_0x5b2faf){_0xd95a4f=_0xd95a4f-0x0;var _0x913026=_0xedd7[_0xd95a4f];return _0x913026;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0x7edd('0x0'));var moment=require(_0x7edd('0x1'));var BPromise=require(_0x7edd('0x2'));var util=require(_0x7edd('0x3'));var path=require(_0x7edd('0x4'));var ejs=require(_0x7edd('0x5'));var fs=require('fs');var _=require(_0x7edd('0x6'));var Redis=require('ioredis');var interaction=require(_0x7edd('0x7'));var qs=require(_0x7edd('0x8'));var pdf=require(_0x7edd('0x9'));var logger=require('../../config/logger')(_0x7edd('0xa'));var config=require(_0x7edd('0xb'));var db=require('../../mysqldb')['db'];config[_0x7edd('0xc')]=_[_0x7edd('0xd')](config[_0x7edd('0xc')],{'host':_0x7edd('0xe'),'port':0x18eb});var socket=require(_0x7edd('0xf'))(new Redis(config['redis']));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x22e301,_0x47a8b4){_0x47a8b4=_0x47a8b4||0xcc;return function(_0x3eddce){if(_0x3eddce){return _0x22e301[_0x7edd('0x10')](_0x47a8b4);}return _0x22e301[_0x7edd('0x11')](_0x47a8b4)[_0x7edd('0x12')]();};}function respondWithResult(_0x46ef48,_0x1d471e){_0x1d471e=_0x1d471e||0xc8;return function(_0x16ea62){if(_0x16ea62){return _0x46ef48[_0x7edd('0x11')](_0x1d471e)[_0x7edd('0x13')](_0x16ea62);}};}function respondWithFilteredResult(_0x47e451,_0x43ed5c){return function(_0x45c247){if(_0x45c247){var _0x2fc912=typeof _0x43ed5c[_0x7edd('0x14')]===_0x7edd('0x15')&&typeof _0x43ed5c[_0x7edd('0x16')]===_0x7edd('0x15');var _0x4b989f=_0x45c247[_0x7edd('0x17')];var _0x5b207e=_0x2fc912?0x0:_0x43ed5c[_0x7edd('0x14')];var _0x2bdb01=_0x2fc912?_0x45c247[_0x7edd('0x17')]:_0x43ed5c[_0x7edd('0x14')]+_0x43ed5c[_0x7edd('0x16')];var _0x2bfdc9;if(_0x2bdb01>=_0x4b989f){_0x2bdb01=_0x4b989f;_0x2bfdc9=0xc8;}else{_0x2bfdc9=0xce;}_0x47e451[_0x7edd('0x11')](_0x2bfdc9);return _0x47e451[_0x7edd('0x18')](_0x7edd('0x19'),_0x5b207e+'-'+_0x2bdb01+'/'+_0x4b989f)[_0x7edd('0x13')](_0x45c247);}return null;};}function saveUpdates(_0x268950){return function(_0x3c40c8){if(_0x3c40c8){return _0x3c40c8[_0x7edd('0x1a')](_0x268950)[_0x7edd('0x1b')](function(_0x108266){return _0x108266;});}return null;};}function removeEntity(_0x7d62b7){return function(_0x417cb3){if(_0x417cb3){return _0x417cb3[_0x7edd('0x1c')]()[_0x7edd('0x1b')](function(){_0x7d62b7['status'](0xcc)[_0x7edd('0x12')]();});}};}function handleEntityNotFound(_0x8bf7e2){return function(_0x47944f){if(!_0x47944f){_0x8bf7e2['sendStatus'](0x194);}return _0x47944f;};}function handleError(_0x357174,_0x152e78){_0x152e78=_0x152e78||0x1f4;return function(_0x3634e0){logger[_0x7edd('0x1d')](_0x3634e0[_0x7edd('0x1e')]);if(_0x3634e0['name']){delete _0x3634e0[_0x7edd('0x1f')];}_0x357174[_0x7edd('0x11')](_0x152e78)[_0x7edd('0x20')](_0x3634e0);};}exports['index']=function(_0x12cdf5,_0x2945fa){var _0x48c970={};var _0xd953fb=_[_0x7edd('0x21')](db['WhatsappInteraction'][_0x7edd('0x22')],function(_0x5bded1){return{'name':_0x5bded1[_0x7edd('0x23')],'type':_0x5bded1[_0x7edd('0x24')][_0x7edd('0x25')]};});_0x48c970=qs[_0x7edd('0x26')](_0xd953fb,_0x12cdf5);return interaction[_0x7edd('0x27')](_0x7edd('0x28'),_0x12cdf5[_0x7edd('0x29')],_0x12cdf5['user'],_0x48c970,_0xd953fb)['then'](respondWithFilteredResult(_0x2945fa,_0x48c970))[_0x7edd('0x2a')](handleError(_0x2945fa,null));};exports[_0x7edd('0x2b')]=function(_0x37967b,_0x834bad){var _0x4d875b={'raw':![],'where':{'id':_0x37967b[_0x7edd('0x2c')]['id']}},_0x17765f={};_0x17765f[_0x7edd('0x2d')]=_[_0x7edd('0x2e')](db[_0x7edd('0x2f')][_0x7edd('0x22')]);_0x17765f[_0x7edd('0x29')]=_['keys'](_0x37967b[_0x7edd('0x29')]);_0x17765f[_0x7edd('0x30')]=_['intersection'](_0x17765f[_0x7edd('0x2d')],_0x17765f[_0x7edd('0x29')]);_0x4d875b[_0x7edd('0x31')]=_[_0x7edd('0x32')](_0x17765f[_0x7edd('0x2d')],qs[_0x7edd('0x33')](_0x37967b[_0x7edd('0x29')][_0x7edd('0x33')]));_0x4d875b['attributes']=_0x4d875b[_0x7edd('0x31')][_0x7edd('0x34')]?_0x4d875b[_0x7edd('0x31')]:_0x17765f[_0x7edd('0x2d')];if(_0x37967b[_0x7edd('0x29')][_0x7edd('0x35')]){_0x4d875b['include']=[{'all':!![]}];}_0x4d875b=_[_0x7edd('0x36')]({},_0x4d875b,_0x37967b[_0x7edd('0x37')]);return db[_0x7edd('0x2f')][_0x7edd('0x38')](_0x4d875b)[_0x7edd('0x1b')](handleEntityNotFound(_0x834bad,null))[_0x7edd('0x1b')](respondWithResult(_0x834bad,null))[_0x7edd('0x2a')](handleError(_0x834bad,null));};exports[_0x7edd('0x39')]=function(_0x453a43,_0x11ab7c){return db['WhatsappInteraction'][_0x7edd('0x39')](_0x453a43[_0x7edd('0x3a')],{})['then'](respondWithResult(_0x11ab7c,0xc9))[_0x7edd('0x2a')](handleError(_0x11ab7c,null));};exports[_0x7edd('0x1a')]=function(_0x550188,_0x5ba270){if(_0x550188[_0x7edd('0x3a')]['id']){delete _0x550188['body']['id'];}return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x550188[_0x7edd('0x2c')]['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0x5ba270,null))['then'](saveUpdates(_0x550188[_0x7edd('0x3a')],null))[_0x7edd('0x1b')](respondWithResult(_0x5ba270,null))[_0x7edd('0x2a')](handleError(_0x5ba270,null));};exports[_0x7edd('0x1c')]=function(_0x962e95,_0xe84c98){return db['WhatsappInteraction'][_0x7edd('0x38')]({'where':{'id':_0x962e95[_0x7edd('0x2c')]['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0xe84c98,null))['then'](removeEntity(_0xe84c98,null))[_0x7edd('0x2a')](handleError(_0xe84c98,null));};exports[_0x7edd('0x3b')]=function(_0x2b0f32,_0x5e7e5b){return db['WhatsappInteraction']['describe']()[_0x7edd('0x1b')](respondWithResult(_0x5e7e5b,null))[_0x7edd('0x2a')](handleError(_0x5e7e5b,null));};exports['addMessage']=function(_0x232614,_0x4d04e1){return db[_0x7edd('0x3c')]['find']({'where':{'id':_0x232614[_0x7edd('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4d04e1,null))[_0x7edd('0x1b')](function(_0x27d82f){if(_0x27d82f){return _0x27d82f['addMessage'](_0x232614[_0x7edd('0x3a')][_0x7edd('0x3d')],_[_0x7edd('0x3e')](_0x232614['body'],['ids','id'])||{});}})[_0x7edd('0x1b')](respondWithResult(_0x4d04e1,null))[_0x7edd('0x2a')](handleError(_0x4d04e1,null));};exports['getMessages']=function(_0x222dcf,_0x1249e9){var _0x193a1f={'raw':![],'where':{}};var _0x18e73e={};var _0x32d77c={'count':0x0,'rows':[]};return db[_0x7edd('0x2f')][_0x7edd('0x3f')]({'where':{'id':_0x222dcf['params']['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0x1249e9,null))[_0x7edd('0x1b')](function(_0x12ec70){if(_0x12ec70){_0x18e73e[_0x7edd('0x2d')]=_[_0x7edd('0x2e')](db[_0x7edd('0x3c')]['rawAttributes']);_0x18e73e['query']=_[_0x7edd('0x2e')](_0x222dcf[_0x7edd('0x29')]);_0x18e73e['filters']=_[_0x7edd('0x32')](_0x18e73e[_0x7edd('0x2d')],_0x18e73e[_0x7edd('0x29')]);_0x193a1f[_0x7edd('0x31')]=_[_0x7edd('0x32')](_0x18e73e[_0x7edd('0x2d')],qs[_0x7edd('0x33')](_0x222dcf[_0x7edd('0x29')]['fields']));_0x193a1f[_0x7edd('0x31')]=_0x193a1f[_0x7edd('0x31')]['length']?_0x193a1f[_0x7edd('0x31')]:_0x18e73e['model'];if(!_0x222dcf['query'][_0x7edd('0x40')](_0x7edd('0x41'))){_0x193a1f[_0x7edd('0x16')]=qs[_0x7edd('0x16')](_0x222dcf['query'][_0x7edd('0x16')]);_0x193a1f[_0x7edd('0x14')]=qs[_0x7edd('0x14')](_0x222dcf[_0x7edd('0x29')][_0x7edd('0x14')]);}_0x193a1f[_0x7edd('0x42')]=qs[_0x7edd('0x43')](_0x222dcf['query'][_0x7edd('0x43')]);_0x193a1f['where']=qs[_0x7edd('0x30')](_[_0x7edd('0x44')](_0x222dcf[_0x7edd('0x29')],_0x18e73e[_0x7edd('0x30')]));_0x193a1f[_0x7edd('0x45')][_0x7edd('0x46')]=_0x12ec70['id'];if(_0x222dcf[_0x7edd('0x29')][_0x7edd('0x47')]){_0x193a1f['where']=_[_0x7edd('0x36')](_0x193a1f[_0x7edd('0x45')],{'$or':_[_0x7edd('0x21')](_0x193a1f['attributes'],function(_0x4d9a7b){var _0x870977={};_0x870977[_0x4d9a7b]={'$like':'%'+_0x222dcf['query']['filter']+'%'};return _0x870977;})});}if(_0x222dcf[_0x7edd('0x29')][_0x7edd('0x48')]){var _0xc0f825=_0x222dcf['query'][_0x7edd('0x48')][_0x7edd('0x49')](',');var _0x92c775={};_0x92c775[_0xc0f825[0x0]]={'$gte':moment(_0xc0f825[0x1])[_0x7edd('0x4a')](_0x7edd('0x4b'))};_0x193a1f[_0x7edd('0x45')]=_[_0x7edd('0x36')](_0x193a1f['where'],_0x92c775);}_0x193a1f=_[_0x7edd('0x36')]({},_0x193a1f,_0x222dcf['options']);return db[_0x7edd('0x3c')]['count']({'where':_0x193a1f[_0x7edd('0x45')]})[_0x7edd('0x1b')](function(_0x537ce8){_0x32d77c[_0x7edd('0x17')]=_0x537ce8;if(_0x222dcf[_0x7edd('0x29')][_0x7edd('0x35')]){_0x193a1f[_0x7edd('0x4c')]=[{'all':!![]}];}return db[_0x7edd('0x3c')][_0x7edd('0x27')](_0x193a1f);})['then'](function(_0x5634c6){_0x32d77c['rows']=_0x5634c6;return _0x32d77c;});}})['then'](respondWithFilteredResult(_0x1249e9,_0x193a1f))[_0x7edd('0x2a')](handleError(_0x1249e9,null));};exports['addTags']=function(_0x2f7b89,_0x4f05d5){return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x2f7b89['params']['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0x4f05d5,null))[_0x7edd('0x1b')](function(_0x464d5e){if(_0x464d5e){return _0x464d5e[_0x7edd('0x4d')](_0x2f7b89[_0x7edd('0x3a')][_0x7edd('0x3d')],_['omit'](_0x2f7b89['body'],['ids','id'])||{})[_0x7edd('0x4e')](function(){return db[_0x7edd('0x4f')][_0x7edd('0x27')]({'attributes':['id',_0x7edd('0x1f'),'color'],'where':{'id':_0x2f7b89['body'][_0x7edd('0x3d')]}});})['then'](function(_0x16d089){socket[_0x7edd('0x50')](_0x7edd('0x51'),{'id':Number(_0x2f7b89[_0x7edd('0x2c')]['id']),'tags':_0x16d089||[]});return{'id':Number(_0x2f7b89[_0x7edd('0x2c')]['id']),'tags':_0x16d089||[]};});}})['then'](respondWithResult(_0x4f05d5,null))['catch'](handleError(_0x4f05d5,null));};exports[_0x7edd('0x52')]=function(_0x17ecaa,_0xbde754){return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x17ecaa['params']['id']}})[_0x7edd('0x1b')](handleEntityNotFound(_0xbde754,null))[_0x7edd('0x1b')](function(_0x467136){if(_0x467136){return _0x467136[_0x7edd('0x52')](_0x17ecaa['query']['ids']);}})[_0x7edd('0x1b')](respondWithStatusCode(_0xbde754,null))['catch'](handleError(_0xbde754,null));};exports['download']=function(_0x3a52bd,_0x47058f){var _0x13f8bd=moment()[_0x7edd('0x53')]()[_0x7edd('0x54')]();var _0x23c3ab=path[_0x7edd('0x55')](config[_0x7edd('0x56')],_0x7edd('0x57'),_0x7edd('0x58'),_0x7edd('0x59'));var _0x4dd06b=path[_0x7edd('0x55')](config['root'],_0x7edd('0x57'),_0x7edd('0x58'),'attachments');var _0x434884=path['join'](_0x23c3ab,_0x13f8bd);var _0x642b24=util[_0x7edd('0x4a')]('transcript-%d-%s.zip',_0x3a52bd[_0x7edd('0x2c')]['id'],_0x13f8bd);var _0x40c71a=path[_0x7edd('0x55')](_0x23c3ab,_0x642b24);var _0x94c6b7=[];_0x94c6b7[_0x7edd('0x5a')]({'model':db['User'],'as':_0x7edd('0x5b'),'attributes':['id',_0x7edd('0x5c')],'raw':!![]});_0x94c6b7[_0x7edd('0x5a')]({'model':db['CmContact'],'as':_0x7edd('0x5d'),'attributes':['id',_0x7edd('0x5e'),_0x7edd('0x5f')],'raw':!![]});if(_0x3a52bd[_0x7edd('0x29')][_0x7edd('0x60')]){_0x94c6b7[_0x7edd('0x5a')]({'model':db[_0x7edd('0x61')],'as':'Attachment','raw':!![]});}var _0xddf614=[{'model':db[_0x7edd('0x3c')],'as':_0x7edd('0x62'),'attributes':['id',_0x7edd('0x3a'),_0x7edd('0x63'),_0x7edd('0x64'),_0x7edd('0x65'),'read'],'include':_0x94c6b7}];_0xddf614[_0x7edd('0x5a')]({'model':db[_0x7edd('0x66')],'as':_0x7edd('0x67'),'attributes':['id',_0x7edd('0x1f')]});_0xddf614[_0x7edd('0x5a')]({'model':db[_0x7edd('0x5b')],'as':_0x7edd('0x68'),'attributes':['id',_0x7edd('0x5c')]});return db[_0x7edd('0x2f')][_0x7edd('0x38')]({'where':{'id':_0x3a52bd[_0x7edd('0x2c')]['id']},'include':_0xddf614})[_0x7edd('0x1b')](handleEntityNotFound(_0x47058f,null))[_0x7edd('0x1b')](function(_0x43c56d){if(_0x43c56d){var _0x3f3795=_0x43c56d[_0x7edd('0x69')]({'plain':!![]});fs['mkdirSync'](_0x434884);var _0x173d50={'channel':'Whatsapp','account':_0x3f3795['Account'][_0x7edd('0x1f')],'agent':_0x3f3795[_0x7edd('0x68')]?_0x3f3795['Owner'][_0x7edd('0x5c')]:'N.A.','createdAt':moment(_0x3f3795['createdAt'])[_0x7edd('0x4a')](_0x7edd('0x4b'))[_0x7edd('0x54')](),'closedAt':_0x3f3795['closed']?moment(_0x3f3795[_0x7edd('0x6a')])['format'](_0x7edd('0x4b'))[_0x7edd('0x54')]():'','disposition':_0x3f3795[_0x7edd('0x6b')],'messages':_(_0x3f3795[_0x7edd('0x62')])[_0x7edd('0x47')]({'secret':![]})[_0x7edd('0x21')](function(_0x520185){if(_0x520185[_0x7edd('0x61')]){var _0x4b0ffc=path['join'](_0x4dd06b,_0x520185[_0x7edd('0x61')][_0x7edd('0x6c')]);if(fs['existsSync'](_0x4b0ffc)){fs['createReadStream'](_0x4b0ffc)['pipe'](fs[_0x7edd('0x6d')](path[_0x7edd('0x55')](_0x434884,_0x520185[_0x7edd('0x61')][_0x7edd('0x6c')])));}}return{'date':moment(_0x520185['createdAt'])[_0x7edd('0x4a')](_0x7edd('0x4b'))[_0x7edd('0x54')](),'sender':_0x520185[_0x7edd('0x64')]===_0x7edd('0x6e')?_0x520185[_0x7edd('0x5b')]?_0x520185[_0x7edd('0x5b')]['fullname']:_0x7edd('0x6f'):_0x520185[_0x7edd('0x5d')][_0x7edd('0x5e')]+(_0x520185[_0x7edd('0x5d')]['lastName']?'\x20'+_0x520185[_0x7edd('0x5d')][_0x7edd('0x5f')]:''),'body':_0x520185[_0x7edd('0x61')]?_0x520185[_0x7edd('0x61')][_0x7edd('0x6c')]:_0x520185[_0x7edd('0x3a')],'direction':_0x520185[_0x7edd('0x64')]===_0x7edd('0x6e')?'A':'C','secret':_0x520185['secret'],'read':_0x520185['read'],'attachment':_0x520185[_0x7edd('0x61')]};})[_0x7edd('0x70')]()};return ejs[_0x7edd('0x71')](path['join'](config['root'],'server',_0x7edd('0x72'),_0x7edd('0x73')),{'interaction':_0x173d50})[_0x7edd('0x1b')](function(_0x4f8c65){var _0x499264=path[_0x7edd('0x55')](_0x434884,'transcript-'+_0x3f3795['id']+'-'+_0x13f8bd+_0x7edd('0x74'));var _0x1a59da={'path':_0x499264,'channel':_0x7edd('0x75'),'interactionId':_0x3f3795['id']};return pdf[_0x7edd('0x76')](_0x4f8c65,_0x1a59da);})['then'](function(){return new BPromise(function(_0x1ea842,_0x1df6b5){zipdir(_0x434884,{'saveTo':_0x40c71a},function(_0x2a973f,_0x124a33){if(_0x2a973f)return _0x1df6b5(_0x2a973f);return _0x1ea842(_0x124a33);});})[_0x7edd('0x1b')](function(){return new BPromise(function(_0x191cd8,_0x314347){rimraf(_0x434884,function(_0x29cd03){if(_0x29cd03)_0x314347(_0x29cd03);return _0x191cd8();});});})[_0x7edd('0x1b')](function(){return _0x47058f[_0x7edd('0x77')](_0x40c71a,_0x642b24,function(_0x4d4cb7){if(_0x4d4cb7){console[_0x7edd('0x78')](_0x7edd('0x79'),_0x4d4cb7);}else{fs[_0x7edd('0x7a')](_0x40c71a);}});});});}else{return _0x47058f['sendStatus'](0xc8);}})[_0x7edd('0x2a')](handleError(_0x47058f,null));}; \ No newline at end of file +var _0x376f=['../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','redis','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','stack','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','whatsapp','query','user','catch','model','keys','intersection','fields','attributes','merge','options','create','body','find','params','describe','addMessage','ids','omit','findOne','WhatsappMessage','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','spread','Tag','whatsappInteractionTags:save','removeTags','download','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','attachments','Attachment','Messages','direction','read','WhatsappAccount','Account','Owner','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','createWriteStream','createdAt','out','System','lastName','secret','value','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','rimraf','bluebird','util','ejs','lodash','ioredis'];(function(_0x4da313,_0x2c8e1f){var _0x1d133b=function(_0x49846f){while(--_0x49846f){_0x4da313['push'](_0x4da313['shift']());}};_0x1d133b(++_0x2c8e1f);}(_0x376f,0x78));var _0xf376=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x376f[_0x1cc8fe];return _0x230054;};'use strict';var rimraf=require(_0xf376('0x0'));var zipdir=require('zip-dir');var moment=require('moment');var BPromise=require(_0xf376('0x1'));var util=require(_0xf376('0x2'));var path=require('path');var ejs=require(_0xf376('0x3'));var fs=require('fs');var _=require(_0xf376('0x4'));var Redis=require(_0xf376('0x5'));var interaction=require(_0xf376('0x6'));var qs=require(_0xf376('0x7'));var pdf=require(_0xf376('0x8'));var logger=require(_0xf376('0x9'))('api');var config=require(_0xf376('0xa'));var db=require(_0xf376('0xb'))['db'];config[_0xf376('0xc')]=_['defaults'](config[_0xf376('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xf376('0xd'))(new Redis(config['redis']));require(_0xf376('0xe'))[_0xf376('0xf')](socket);function respondWithStatusCode(_0x2d8d85,_0xdf4fe1){_0xdf4fe1=_0xdf4fe1||0xcc;return function(_0x4b7d47){if(_0x4b7d47){return _0x2d8d85[_0xf376('0x10')](_0xdf4fe1);}return _0x2d8d85[_0xf376('0x11')](_0xdf4fe1)[_0xf376('0x12')]();};}function respondWithResult(_0x22ab84,_0x5f2660){_0x5f2660=_0x5f2660||0xc8;return function(_0x205872){if(_0x205872){return _0x22ab84[_0xf376('0x11')](_0x5f2660)[_0xf376('0x13')](_0x205872);}};}function respondWithFilteredResult(_0x4dca87,_0x12489c){return function(_0xdabd66){if(_0xdabd66){var _0x259933=typeof _0x12489c[_0xf376('0x14')]===_0xf376('0x15')&&typeof _0x12489c[_0xf376('0x16')]===_0xf376('0x15');var _0x5562b7=_0xdabd66[_0xf376('0x17')];var _0x69c83c=_0x259933?0x0:_0x12489c['offset'];var _0x36ed42=_0x259933?_0xdabd66[_0xf376('0x17')]:_0x12489c[_0xf376('0x14')]+_0x12489c[_0xf376('0x16')];var _0x52c6e1;if(_0x36ed42>=_0x5562b7){_0x36ed42=_0x5562b7;_0x52c6e1=0xc8;}else{_0x52c6e1=0xce;}_0x4dca87[_0xf376('0x11')](_0x52c6e1);return _0x4dca87['set'](_0xf376('0x18'),_0x69c83c+'-'+_0x36ed42+'/'+_0x5562b7)[_0xf376('0x13')](_0xdabd66);}return null;};}function saveUpdates(_0x5a8701){return function(_0x45a86a){if(_0x45a86a){return _0x45a86a[_0xf376('0x19')](_0x5a8701)[_0xf376('0x1a')](function(_0x5cbf32){return _0x5cbf32;});}return null;};}function removeEntity(_0x2583f4){return function(_0x4017fe){if(_0x4017fe){return _0x4017fe[_0xf376('0x1b')]()[_0xf376('0x1a')](function(){_0x2583f4['status'](0xcc)[_0xf376('0x12')]();});}};}function handleEntityNotFound(_0xba9748){return function(_0x5cfadf){if(!_0x5cfadf){_0xba9748[_0xf376('0x10')](0x194);}return _0x5cfadf;};}function handleError(_0x1fe1e3,_0x56a08a){_0x56a08a=_0x56a08a||0x1f4;return function(_0x31bb2a){logger[_0xf376('0x1c')](_0x31bb2a[_0xf376('0x1d')]);if(_0x31bb2a[_0xf376('0x1e')]){delete _0x31bb2a['name'];}_0x1fe1e3[_0xf376('0x11')](_0x56a08a)[_0xf376('0x1f')](_0x31bb2a);};}exports[_0xf376('0x20')]=function(_0x5ef0b8,_0x1a8e94){var _0xf0a79b={};var _0x21c7ba=_[_0xf376('0x21')](db[_0xf376('0x22')][_0xf376('0x23')],function(_0x564746){return{'name':_0x564746[_0xf376('0x24')],'type':_0x564746[_0xf376('0x25')][_0xf376('0x26')]};});_0xf0a79b=qs[_0xf376('0x27')](_0x21c7ba,_0x5ef0b8);return interaction[_0xf376('0x28')](_0xf376('0x29'),_0x5ef0b8[_0xf376('0x2a')],_0x5ef0b8[_0xf376('0x2b')],_0xf0a79b,_0x21c7ba)[_0xf376('0x1a')](respondWithFilteredResult(_0x1a8e94,_0xf0a79b))[_0xf376('0x2c')](handleError(_0x1a8e94,null));};exports['show']=function(_0x29d2c6,_0x47a1bc){var _0x2efa59={'raw':![],'where':{'id':_0x29d2c6['params']['id']}},_0x5b1612={};_0x5b1612[_0xf376('0x2d')]=_['keys'](db[_0xf376('0x22')][_0xf376('0x23')]);_0x5b1612['query']=_[_0xf376('0x2e')](_0x29d2c6['query']);_0x5b1612['filters']=_[_0xf376('0x2f')](_0x5b1612['model'],_0x5b1612[_0xf376('0x2a')]);_0x2efa59['attributes']=_[_0xf376('0x2f')](_0x5b1612[_0xf376('0x2d')],qs[_0xf376('0x30')](_0x29d2c6[_0xf376('0x2a')][_0xf376('0x30')]));_0x2efa59[_0xf376('0x31')]=_0x2efa59[_0xf376('0x31')]['length']?_0x2efa59[_0xf376('0x31')]:_0x5b1612[_0xf376('0x2d')];if(_0x29d2c6['query']['includeAll']){_0x2efa59['include']=[{'all':!![]}];}_0x2efa59=_[_0xf376('0x32')]({},_0x2efa59,_0x29d2c6[_0xf376('0x33')]);return db[_0xf376('0x22')]['find'](_0x2efa59)[_0xf376('0x1a')](handleEntityNotFound(_0x47a1bc,null))[_0xf376('0x1a')](respondWithResult(_0x47a1bc,null))[_0xf376('0x2c')](handleError(_0x47a1bc,null));};exports[_0xf376('0x34')]=function(_0x123227,_0x6855d4){return db[_0xf376('0x22')][_0xf376('0x34')](_0x123227[_0xf376('0x35')],{})[_0xf376('0x1a')](respondWithResult(_0x6855d4,0xc9))[_0xf376('0x2c')](handleError(_0x6855d4,null));};exports['update']=function(_0x13d1a2,_0x287ccd){if(_0x13d1a2[_0xf376('0x35')]['id']){delete _0x13d1a2[_0xf376('0x35')]['id'];}return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x13d1a2[_0xf376('0x37')]['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x287ccd,null))[_0xf376('0x1a')](saveUpdates(_0x13d1a2[_0xf376('0x35')],null))[_0xf376('0x1a')](respondWithResult(_0x287ccd,null))['catch'](handleError(_0x287ccd,null));};exports['destroy']=function(_0x57f216,_0x4f4240){return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x57f216[_0xf376('0x37')]['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x4f4240,null))[_0xf376('0x1a')](removeEntity(_0x4f4240,null))[_0xf376('0x2c')](handleError(_0x4f4240,null));};exports[_0xf376('0x38')]=function(_0x48be8a,_0x3ee085){return db[_0xf376('0x22')][_0xf376('0x38')]()[_0xf376('0x1a')](respondWithResult(_0x3ee085,null))[_0xf376('0x2c')](handleError(_0x3ee085,null));};exports['addMessage']=function(_0xcac266,_0x155347){return db['WhatsappMessage']['find']({'where':{'id':_0xcac266[_0xf376('0x37')]['id']}})['then'](handleEntityNotFound(_0x155347,null))[_0xf376('0x1a')](function(_0x15e69f){if(_0x15e69f){return _0x15e69f[_0xf376('0x39')](_0xcac266['body'][_0xf376('0x3a')],_[_0xf376('0x3b')](_0xcac266['body'],[_0xf376('0x3a'),'id'])||{});}})[_0xf376('0x1a')](respondWithResult(_0x155347,null))[_0xf376('0x2c')](handleError(_0x155347,null));};exports['getMessages']=function(_0x42f77f,_0x1a1261){var _0x163463={'raw':![],'where':{}};var _0x2d5964={};var _0x252627={'count':0x0,'rows':[]};return db[_0xf376('0x22')][_0xf376('0x3c')]({'where':{'id':_0x42f77f[_0xf376('0x37')]['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x1a1261,null))['then'](function(_0x315cc7){if(_0x315cc7){_0x2d5964[_0xf376('0x2d')]=_[_0xf376('0x2e')](db[_0xf376('0x3d')][_0xf376('0x23')]);_0x2d5964[_0xf376('0x2a')]=_[_0xf376('0x2e')](_0x42f77f[_0xf376('0x2a')]);_0x2d5964['filters']=_[_0xf376('0x2f')](_0x2d5964[_0xf376('0x2d')],_0x2d5964['query']);_0x163463['attributes']=_[_0xf376('0x2f')](_0x2d5964[_0xf376('0x2d')],qs[_0xf376('0x30')](_0x42f77f['query'][_0xf376('0x30')]));_0x163463[_0xf376('0x31')]=_0x163463['attributes'][_0xf376('0x3e')]?_0x163463[_0xf376('0x31')]:_0x2d5964['model'];if(!_0x42f77f[_0xf376('0x2a')][_0xf376('0x3f')](_0xf376('0x40'))){_0x163463[_0xf376('0x16')]=qs[_0xf376('0x16')](_0x42f77f[_0xf376('0x2a')][_0xf376('0x16')]);_0x163463[_0xf376('0x14')]=qs[_0xf376('0x14')](_0x42f77f[_0xf376('0x2a')][_0xf376('0x14')]);}_0x163463[_0xf376('0x41')]=qs[_0xf376('0x42')](_0x42f77f[_0xf376('0x2a')][_0xf376('0x42')]);_0x163463[_0xf376('0x43')]=qs[_0xf376('0x44')](_[_0xf376('0x45')](_0x42f77f['query'],_0x2d5964[_0xf376('0x44')]));_0x163463[_0xf376('0x43')]['WhatsappInteractionId']=_0x315cc7['id'];if(_0x42f77f[_0xf376('0x2a')][_0xf376('0x46')]){_0x163463[_0xf376('0x43')]=_['merge'](_0x163463[_0xf376('0x43')],{'$or':_['map'](_0x163463['attributes'],function(_0x259762){var _0x2fb94c={};_0x2fb94c[_0x259762]={'$like':'%'+_0x42f77f[_0xf376('0x2a')]['filter']+'%'};return _0x2fb94c;})});}if(_0x42f77f[_0xf376('0x2a')]['$gte']){var _0x27de46=_0x42f77f[_0xf376('0x2a')][_0xf376('0x47')][_0xf376('0x48')](',');var _0x1bf836={};_0x1bf836[_0x27de46[0x0]]={'$gte':moment(_0x27de46[0x1])[_0xf376('0x49')](_0xf376('0x4a'))};_0x163463[_0xf376('0x43')]=_[_0xf376('0x32')](_0x163463[_0xf376('0x43')],_0x1bf836);}_0x163463=_[_0xf376('0x32')]({},_0x163463,_0x42f77f[_0xf376('0x33')]);return db[_0xf376('0x3d')][_0xf376('0x17')]({'where':_0x163463[_0xf376('0x43')]})[_0xf376('0x1a')](function(_0x49d789){_0x252627[_0xf376('0x17')]=_0x49d789;if(_0x42f77f[_0xf376('0x2a')][_0xf376('0x4b')]){_0x163463['include']=[{'all':!![]}];}return db['WhatsappMessage'][_0xf376('0x28')](_0x163463);})['then'](function(_0x27a7d2){_0x252627[_0xf376('0x4c')]=_0x27a7d2;return _0x252627;});}})[_0xf376('0x1a')](respondWithFilteredResult(_0x1a1261,_0x163463))[_0xf376('0x2c')](handleError(_0x1a1261,null));};exports['addTags']=function(_0x11e794,_0x30bdf1){return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x11e794[_0xf376('0x37')]['id']}})['then'](handleEntityNotFound(_0x30bdf1,null))[_0xf376('0x1a')](function(_0x489e3b){if(_0x489e3b){return _0x489e3b[_0xf376('0x4d')](_0x11e794[_0xf376('0x35')][_0xf376('0x3a')],_[_0xf376('0x3b')](_0x11e794[_0xf376('0x35')],[_0xf376('0x3a'),'id'])||{})[_0xf376('0x4e')](function(){return db[_0xf376('0x4f')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x11e794[_0xf376('0x35')][_0xf376('0x3a')]}});})[_0xf376('0x1a')](function(_0x9e912){socket['emit'](_0xf376('0x50'),{'id':Number(_0x11e794[_0xf376('0x37')]['id']),'tags':_0x9e912||[]});return{'id':Number(_0x11e794[_0xf376('0x37')]['id']),'tags':_0x9e912||[]};});}})[_0xf376('0x1a')](respondWithResult(_0x30bdf1,null))[_0xf376('0x2c')](handleError(_0x30bdf1,null));};exports[_0xf376('0x51')]=function(_0x14017c,_0x5ee4b2){return db['WhatsappInteraction'][_0xf376('0x36')]({'where':{'id':_0x14017c['params']['id']}})[_0xf376('0x1a')](handleEntityNotFound(_0x5ee4b2,null))[_0xf376('0x1a')](function(_0x3e9cbd){if(_0x3e9cbd){return _0x3e9cbd['removeTags'](_0x14017c[_0xf376('0x2a')][_0xf376('0x3a')]);}})[_0xf376('0x1a')](respondWithStatusCode(_0x5ee4b2,null))['catch'](handleError(_0x5ee4b2,null));};exports[_0xf376('0x52')]=function(_0x2235f1,_0x23a335){var _0x4281b6=moment()['unix']()[_0xf376('0x53')]();var _0x3d3837=path[_0xf376('0x54')](config[_0xf376('0x55')],_0xf376('0x56'),_0xf376('0x57'),_0xf376('0x58'));var _0x47839c=path['join'](config[_0xf376('0x55')],_0xf376('0x56'),_0xf376('0x57'),'attachments');var _0x47fde2=path[_0xf376('0x54')](_0x3d3837,_0x4281b6);var _0x303de7=util[_0xf376('0x49')](_0xf376('0x59'),_0x2235f1[_0xf376('0x37')]['id'],_0x4281b6);var _0x3a3fea=path[_0xf376('0x54')](_0x3d3837,_0x303de7);var _0x4fce6b=[];_0x4fce6b[_0xf376('0x5a')]({'model':db[_0xf376('0x5b')],'as':_0xf376('0x5b'),'attributes':['id',_0xf376('0x5c')],'raw':!![]});_0x4fce6b['push']({'model':db['CmContact'],'as':_0xf376('0x5d'),'attributes':['id',_0xf376('0x5e'),'lastName'],'raw':!![]});if(_0x2235f1[_0xf376('0x2a')][_0xf376('0x5f')]){_0x4fce6b[_0xf376('0x5a')]({'model':db[_0xf376('0x60')],'as':'Attachment','raw':!![]});}var _0x409d90=[{'model':db[_0xf376('0x3d')],'as':_0xf376('0x61'),'attributes':['id',_0xf376('0x35'),'createdAt',_0xf376('0x62'),'secret',_0xf376('0x63')],'include':_0x4fce6b}];_0x409d90['push']({'model':db[_0xf376('0x64')],'as':_0xf376('0x65'),'attributes':['id',_0xf376('0x1e')]});_0x409d90[_0xf376('0x5a')]({'model':db['User'],'as':_0xf376('0x66'),'attributes':['id',_0xf376('0x5c')]});return db[_0xf376('0x22')][_0xf376('0x36')]({'where':{'id':_0x2235f1[_0xf376('0x37')]['id']},'include':_0x409d90})['then'](handleEntityNotFound(_0x23a335,null))['then'](function(_0x544c3f){if(_0x544c3f){var _0x48ed92=_0x544c3f['get']({'plain':!![]});fs[_0xf376('0x67')](_0x47fde2);var _0x5204d3={'channel':_0xf376('0x68'),'account':_0x48ed92[_0xf376('0x65')][_0xf376('0x1e')],'agent':_0x48ed92['Owner']?_0x48ed92[_0xf376('0x66')]['fullname']:_0xf376('0x69'),'createdAt':moment(_0x48ed92['createdAt'])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xf376('0x53')](),'closedAt':_0x48ed92[_0xf376('0x6a')]?moment(_0x48ed92[_0xf376('0x6b')])[_0xf376('0x49')](_0xf376('0x4a'))[_0xf376('0x53')]():'','disposition':_0x48ed92[_0xf376('0x6c')],'messages':_(_0x48ed92['Messages'])['filter']({'secret':![]})['map'](function(_0x3833d5){if(_0x3833d5['Attachment']){var _0x1e9f3c=path[_0xf376('0x54')](_0x47839c,_0x3833d5[_0xf376('0x60')][_0xf376('0x6d')]);if(fs[_0xf376('0x6e')](_0x1e9f3c)){fs[_0xf376('0x6f')](_0x1e9f3c)[_0xf376('0x70')](fs[_0xf376('0x71')](path[_0xf376('0x54')](_0x47fde2,_0x3833d5[_0xf376('0x60')][_0xf376('0x6d')])));}}return{'date':moment(_0x3833d5[_0xf376('0x72')])[_0xf376('0x49')](_0xf376('0x4a'))['toString'](),'sender':_0x3833d5[_0xf376('0x62')]===_0xf376('0x73')?_0x3833d5[_0xf376('0x5b')]?_0x3833d5[_0xf376('0x5b')][_0xf376('0x5c')]:_0xf376('0x74'):_0x3833d5[_0xf376('0x5d')][_0xf376('0x5e')]+(_0x3833d5[_0xf376('0x5d')]['lastName']?'\x20'+_0x3833d5[_0xf376('0x5d')][_0xf376('0x75')]:''),'body':_0x3833d5[_0xf376('0x60')]?_0x3833d5[_0xf376('0x60')]['basename']:_0x3833d5[_0xf376('0x35')],'direction':_0x3833d5[_0xf376('0x62')]===_0xf376('0x73')?'A':'C','secret':_0x3833d5[_0xf376('0x76')],'read':_0x3833d5[_0xf376('0x63')],'attachment':_0x3833d5[_0xf376('0x60')]};})[_0xf376('0x77')]()};return ejs['renderFile'](path[_0xf376('0x54')](config['root'],_0xf376('0x56'),'views',_0xf376('0x78')),{'interaction':_0x5204d3})[_0xf376('0x1a')](function(_0xaa755){var _0x4e7c11=path[_0xf376('0x54')](_0x47fde2,_0xf376('0x79')+_0x48ed92['id']+'-'+_0x4281b6+_0xf376('0x7a'));var _0x360415={'path':_0x4e7c11,'channel':'Whatsapp','interactionId':_0x48ed92['id']};return pdf[_0xf376('0x7b')](_0xaa755,_0x360415);})[_0xf376('0x1a')](function(){return new BPromise(function(_0x4ea48c,_0x262a84){zipdir(_0x47fde2,{'saveTo':_0x3a3fea},function(_0x246766,_0x17f84e){if(_0x246766)return _0x262a84(_0x246766);return _0x4ea48c(_0x17f84e);});})['then'](function(){return new BPromise(function(_0xda6b79,_0x29e8ad){rimraf(_0x47fde2,function(_0x453006){if(_0x453006)_0x29e8ad(_0x453006);return _0xda6b79();});});})[_0xf376('0x1a')](function(){return _0x23a335[_0xf376('0x52')](_0x3a3fea,_0x303de7,function(_0xfea21a){if(_0xfea21a){console[_0xf376('0x7c')](_0xf376('0x7d'),_0xfea21a);}else{fs['unlinkSync'](_0x3a3fea);}});});});}else{return _0x23a335[_0xf376('0x10')](0xc8);}})[_0xf376('0x2c')](handleError(_0x23a335,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 0f1a920..2d1bda4 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 _0xc964=['then','Users','map','emit','catch','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners','update','getUsers'];(function(_0x43cf24,_0x2f0cfb){var _0x301158=function(_0x25d79e){while(--_0x25d79e){_0x43cf24['push'](_0x43cf24['shift']());}};_0x301158(++_0x2f0cfb);}(_0xc964,0x7e));var _0x4c96=function(_0x4566e7,_0x5049ef){_0x4566e7=_0x4566e7-0x0;var _0x1a0bcc=_0xc964[_0x4566e7];return _0x1a0bcc;};'use strict';var EventEmitter=require(_0x4c96('0x0'));var WhatsappInteraction=require(_0x4c96('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4c96('0x1'))['db'][_0x4c96('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4c96('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4c96('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1b0a58){return function(_0x3afa6e,_0x1ab184,_0x2f6461){_0x3afa6e[_0x4c96('0x5')]({'attributes':['id'],'raw':!![]})[_0x4c96('0x6')](function(_0x4070a5){_0x3afa6e['setDataValue'](_0x4c96('0x7'),_0x4070a5[_0x4c96('0x8')](function(_0x135c89){return{'id':_0x135c89['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0x3afa6e['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4c96('0x6')](function(_0x2ea23f){_0x3afa6e['setDataValue']('unreadMessages',_0x2ea23f['length']);WhatsappInteractionEvents[_0x4c96('0x9')](_0x1b0a58+':'+_0x3afa6e['id'],_0x3afa6e);WhatsappInteractionEvents[_0x4c96('0x9')](_0x1b0a58,_0x3afa6e);_0x2f6461(null);})[_0x4c96('0xa')](_0x2f6461(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x4c96('0xb')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0x9861=['../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','emit','hasOwnProperty','events'];(function(_0x57a8f8,_0x5faefc){var _0x55670a=function(_0x2ab259){while(--_0x2ab259){_0x57a8f8['push'](_0x57a8f8['shift']());}};_0x55670a(++_0x5faefc);}(_0x9861,0x176));var _0x1986=function(_0x360e44,_0xd75765){_0x360e44=_0x360e44-0x0;var _0x4c3875=_0x9861[_0x360e44];return _0x4c3875;};'use strict';var EventEmitter=require(_0x1986('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x1986('0x1'))['db'][_0x1986('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x1986('0x3')](0x0);var events={'afterCreate':_0x1986('0x4'),'afterUpdate':_0x1986('0x5'),'afterDestroy':_0x1986('0x6')};function emitEvent(_0x5462a7){return function(_0xe033ef,_0x279741,_0x1b56d6){_0xe033ef[_0x1986('0x7')]({'attributes':['id'],'raw':!![]})[_0x1986('0x8')](function(_0xc5e066){_0xe033ef[_0x1986('0x9')](_0x1986('0xa'),_0xc5e066[_0x1986('0xb')](function(_0x1432d5){return{'id':_0x1432d5['id']};}));return WhatsappMessage['findAll']({'where':{'WhatsappInteractionId':_0xe033ef['id'],'direction':'in','read':![]},'raw':!![]});})[_0x1986('0x8')](function(_0x1578f9){_0xe033ef[_0x1986('0x9')](_0x1986('0xc'),_0x1578f9['length']);WhatsappInteractionEvents[_0x1986('0xd')](_0x5462a7+':'+_0xe033ef['id'],_0xe033ef);WhatsappInteractionEvents[_0x1986('0xd')](_0x5462a7,_0xe033ef);_0x1b56d6(null);})['catch'](_0x1b56d6(null));};}for(var e in events){if(events[_0x1986('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index e8dc3c3..4975199 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 _0xf23c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','whatsapp_interactions','changed','closed','closedAt','format'];(function(_0x247bf5,_0x4732ca){var _0x781d4f=function(_0x16aaae){while(--_0x16aaae){_0x247bf5['push'](_0x247bf5['shift']());}};_0x781d4f(++_0x4732ca);}(_0xf23c,0x77));var _0xcf23=function(_0x31bab3,_0x44554f){_0x31bab3=_0x31bab3-0x0;var _0x4fd382=_0xf23c[_0x31bab3];return _0x4fd382;};'use strict';var _=require(_0xcf23('0x0'));var util=require(_0xcf23('0x1'));var logger=require(_0xcf23('0x2'))(_0xcf23('0x3'));var moment=require(_0xcf23('0x4'));var BPromise=require(_0xcf23('0x5'));var rp=require(_0xcf23('0x6'));var fs=require('fs');var path=require(_0xcf23('0x7'));var rimraf=require(_0xcf23('0x8'));var config=require(_0xcf23('0x9'));var attributes=require(_0xcf23('0xa'));module[_0xcf23('0xb')]=function(_0x29d89c,_0x208604){return _0x29d89c['define']('WhatsappInteraction',attributes,{'tableName':_0xcf23('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x30ecf2,_0x1d2be7,_0x2a2680){if(_0x30ecf2[_0xcf23('0xd')](_0xcf23('0xe'))){_0x30ecf2[_0xcf23('0xf')]=moment()[_0xcf23('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2a2680(null,_0x30ecf2);}}});}; \ No newline at end of file +var _0x20cc=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x20cc,0x196));var _0xc20c=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0x20cc[_0x5416db];return _0x243e35;};'use strict';var _=require(_0xc20c('0x0'));var util=require(_0xc20c('0x1'));var logger=require(_0xc20c('0x2'))('api');var moment=require(_0xc20c('0x3'));var BPromise=require(_0xc20c('0x4'));var rp=require(_0xc20c('0x5'));var fs=require('fs');var path=require(_0xc20c('0x6'));var rimraf=require(_0xc20c('0x7'));var config=require(_0xc20c('0x8'));var attributes=require(_0xc20c('0x9'));module[_0xc20c('0xa')]=function(_0xaa5fce,_0x34f9ac){return _0xaa5fce[_0xc20c('0xb')](_0xc20c('0xc'),attributes,{'tableName':'whatsapp_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3bdd17,_0x3e23fa,_0x4c36b7){if(_0x3bdd17[_0xc20c('0xd')](_0xc20c('0xe'))){_0x3bdd17['closedAt']=moment()[_0xc20c('0xf')](_0xc20c('0x10'));}_0x4c36b7(null,_0x3bdd17);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index fbc2d1c..c46fa6f 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 _0xe184=['defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateWhatsappInteraction','update','body','options','raw','where','attributes','limit','then','debug','WhatsappInteraction','find','ids','omit','spread','AddTags','catch','moment','randomstring','../../config/logger','../../config/environment','jayson/promise','http','redis'];(function(_0x7d2db1,_0x34145b){var _0x2b4c06=function(_0x552a4e){while(--_0x552a4e){_0x7d2db1['push'](_0x7d2db1['shift']());}};_0x2b4c06(++_0x34145b);}(_0xe184,0x158));var _0x4e18=function(_0x4ab2f4,_0x2f2b40){_0x4ab2f4=_0x4ab2f4-0x0;var _0xbb2b70=_0xe184[_0x4ab2f4];return _0xbb2b70;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4e18('0x0'));var BPromise=require('bluebird');var rs=require(_0x4e18('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4e18('0x2'))('rpc');var config=require(_0x4e18('0x3'));var jayson=require(_0x4e18('0x4'));var client=jayson['client'][_0x4e18('0x5')]({'port':0x232a});config[_0x4e18('0x6')]=_[_0x4e18('0x7')](config[_0x4e18('0x6')],{'host':_0x4e18('0x8'),'port':0x18eb});var socket=require(_0x4e18('0x9'))(new Redis(config[_0x4e18('0x6')]));require(_0x4e18('0xa'))[_0x4e18('0xb')](socket);function respondWithRpcPromise(_0x1c628c,_0x53360c,_0x4bc846){return new BPromise(function(_0x4ed86d,_0x3f6a6e){return client[_0x4e18('0xc')](_0x1c628c,_0x4bc846)['then'](function(_0xe0103e){logger[_0x4e18('0xd')](_0x4e18('0xe'),_0x53360c,_0x4e18('0xf'));logger['debug'](_0x4e18('0x10'),_0x53360c,'request\x20sent',JSON[_0x4e18('0x11')](_0xe0103e));if(_0xe0103e['error']){if(_0xe0103e[_0x4e18('0x12')][_0x4e18('0x13')]===0x1f4){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x53360c,_0xe0103e[_0x4e18('0x12')][_0x4e18('0x14')]);return _0x3f6a6e(_0xe0103e['error'][_0x4e18('0x14')]);}logger[_0x4e18('0x12')](_0x4e18('0xe'),_0x53360c,_0xe0103e[_0x4e18('0x12')][_0x4e18('0x14')]);return _0x4ed86d(_0xe0103e[_0x4e18('0x12')][_0x4e18('0x14')]);}else{logger[_0x4e18('0xd')]('WhatsappInteraction,\x20%s,\x20%s',_0x53360c,_0x4e18('0xf'));_0x4ed86d(_0xe0103e[_0x4e18('0x15')][_0x4e18('0x14')]);}})['catch'](function(_0x19926a){logger[_0x4e18('0x12')](_0x4e18('0xe'),_0x53360c,_0x19926a);_0x3f6a6e(_0x19926a);});});}exports[_0x4e18('0x16')]=function(_0x4a62bb){var _0x267806=this;return new Promise(function(_0x2bf483,_0x4c3cf1){return db['WhatsappInteraction'][_0x4e18('0x17')](_0x4a62bb[_0x4e18('0x18')],{'raw':_0x4a62bb['options']?_0x4a62bb[_0x4e18('0x19')][_0x4e18('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a62bb[_0x4e18('0x19')]?_0x4a62bb[_0x4e18('0x19')][_0x4e18('0x1b')]||null:null,'attributes':_0x4a62bb[_0x4e18('0x19')]?_0x4a62bb[_0x4e18('0x19')][_0x4e18('0x1c')]||null:null,'limit':_0x4a62bb['options']?_0x4a62bb['options'][_0x4e18('0x1d')]||null:null})[_0x4e18('0x1e')](function(_0x18d53a){logger[_0x4e18('0xd')]('UpdateWhatsappInteraction',_0x4a62bb);logger[_0x4e18('0x1f')]('UpdateWhatsappInteraction',_0x4a62bb,JSON[_0x4e18('0x11')](_0x18d53a));_0x2bf483(_0x18d53a);})['catch'](function(_0x2b6f5e){logger[_0x4e18('0x12')](_0x4e18('0x16'),_0x2b6f5e['message'],_0x4a62bb);_0x4c3cf1(_0x267806[_0x4e18('0x12')](0x1f4,_0x2b6f5e['message']));});});};exports['AddTagsToWhatsappInteraction']=function(_0x2c71d0){return new Promise(function(_0x305a94,_0x3c7a1b){return db[_0x4e18('0x20')][_0x4e18('0x21')]({'where':_0x2c71d0[_0x4e18('0x19')]?_0x2c71d0[_0x4e18('0x19')][_0x4e18('0x1b')]||null:null})[_0x4e18('0x1e')](function(_0x8e5479){if(_0x8e5479){return _0x8e5479['addTags'](_0x2c71d0['body'][_0x4e18('0x22')],_[_0x4e18('0x23')](_0x2c71d0['body'],[_0x4e18('0x22'),'id'])||{});}})[_0x4e18('0x24')](function(_0x49d35f){logger[_0x4e18('0xd')](_0x4e18('0x25'),_0x2c71d0);logger[_0x4e18('0x1f')](_0x4e18('0x25'),_0x2c71d0,JSON['stringify'](_0x49d35f));_0x305a94(_0x49d35f);})[_0x4e18('0x26')](function(_0x3eb0ca){logger[_0x4e18('0x12')](_0x4e18('0x25'),_0x3eb0ca['message'],_0x2c71d0);_0x3c7a1b(_this[_0x4e18('0x12')](0x1f4,_0x3eb0ca[_0x4e18('0x14')]));});});}; \ No newline at end of file +var _0x0441=['ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','./whatsappInteraction.socket','register','request','info','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','error','message','result','catch','body','options','where','attributes','limit','UpdateWhatsappInteraction','stringify','then','addTags','omit'];(function(_0x3174d4,_0x2b9f59){var _0x71d869=function(_0x1d5078){while(--_0x1d5078){_0x3174d4['push'](_0x3174d4['shift']());}};_0x71d869(++_0x2b9f59);}(_0x0441,0x16b));var _0x1044=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0x0441[_0x284bc3];return _0x41ac81;};'use strict';var _=require(_0x1044('0x0'));var util=require(_0x1044('0x1'));var moment=require(_0x1044('0x2'));var BPromise=require(_0x1044('0x3'));var rs=require(_0x1044('0x4'));var fs=require('fs');var Redis=require(_0x1044('0x5'));var db=require(_0x1044('0x6'))['db'];var utils=require(_0x1044('0x7'));var logger=require(_0x1044('0x8'))(_0x1044('0x9'));var config=require('../../config/environment');var jayson=require(_0x1044('0xa'));var client=jayson['client'][_0x1044('0xb')]({'port':0x232a});config[_0x1044('0xc')]=_[_0x1044('0xd')](config[_0x1044('0xc')],{'host':_0x1044('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1044('0xc')]));require(_0x1044('0xf'))[_0x1044('0x10')](socket);function respondWithRpcPromise(_0x1db04e,_0x5ccfe0,_0x43cadf){return new BPromise(function(_0x1f7f33,_0x5067d3){return client[_0x1044('0x11')](_0x1db04e,_0x43cadf)['then'](function(_0x147bb9){logger[_0x1044('0x12')](_0x1044('0x13'),_0x5ccfe0,_0x1044('0x14'));logger[_0x1044('0x15')](_0x1044('0x16'),_0x5ccfe0,'request\x20sent',JSON['stringify'](_0x147bb9));if(_0x147bb9[_0x1044('0x17')]){if(_0x147bb9[_0x1044('0x17')]['code']===0x1f4){logger['error'](_0x1044('0x13'),_0x5ccfe0,_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);return _0x5067d3(_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);}logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x5ccfe0,_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);return _0x1f7f33(_0x147bb9[_0x1044('0x17')][_0x1044('0x18')]);}else{logger[_0x1044('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0x5ccfe0,_0x1044('0x14'));_0x1f7f33(_0x147bb9[_0x1044('0x19')][_0x1044('0x18')]);}})[_0x1044('0x1a')](function(_0x303f84){logger['error'](_0x1044('0x13'),_0x5ccfe0,_0x303f84);_0x5067d3(_0x303f84);});});}exports['UpdateWhatsappInteraction']=function(_0x2f7fba){var _0xa5905=this;return new Promise(function(_0x2b7370,_0x1075dc){return db['WhatsappInteraction']['update'](_0x2f7fba[_0x1044('0x1b')],{'raw':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba[_0x1044('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba['options'][_0x1044('0x1d')]||null:null,'attributes':_0x2f7fba['options']?_0x2f7fba[_0x1044('0x1c')][_0x1044('0x1e')]||null:null,'limit':_0x2f7fba[_0x1044('0x1c')]?_0x2f7fba[_0x1044('0x1c')][_0x1044('0x1f')]||null:null})['then'](function(_0x4ffa96){logger[_0x1044('0x12')]('UpdateWhatsappInteraction',_0x2f7fba);logger['debug'](_0x1044('0x20'),_0x2f7fba,JSON[_0x1044('0x21')](_0x4ffa96));_0x2b7370(_0x4ffa96);})[_0x1044('0x1a')](function(_0x45a8a9){logger[_0x1044('0x17')](_0x1044('0x20'),_0x45a8a9[_0x1044('0x18')],_0x2f7fba);_0x1075dc(_0xa5905[_0x1044('0x17')](0x1f4,_0x45a8a9[_0x1044('0x18')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x242eb2){return new Promise(function(_0xf36ee4,_0x58e79c){return db['WhatsappInteraction']['find']({'where':_0x242eb2[_0x1044('0x1c')]?_0x242eb2[_0x1044('0x1c')][_0x1044('0x1d')]||null:null})[_0x1044('0x22')](function(_0x9570fd){if(_0x9570fd){return _0x9570fd[_0x1044('0x23')](_0x242eb2[_0x1044('0x1b')]['ids'],_[_0x1044('0x24')](_0x242eb2[_0x1044('0x1b')],[_0x1044('0x25'),'id'])||{});}})[_0x1044('0x26')](function(_0x249f9c){logger['info'](_0x1044('0x27'),_0x242eb2);logger[_0x1044('0x15')](_0x1044('0x27'),_0x242eb2,JSON[_0x1044('0x21')](_0x249f9c));_0xf36ee4(_0x249f9c);})['catch'](function(_0xda4a56){logger[_0x1044('0x17')](_0x1044('0x27'),_0xda4a56[_0x1044('0x18')],_0x242eb2);_0x58e79c(_this[_0x1044('0x17')](0x1f4,_0xda4a56[_0x1044('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4c84d6e..aabdcc0 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 _0x4829=['length','whatsappInteraction:','./whatsappInteraction.events','save','remove','emit','removeListener'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0x4829,0xdb));var _0x9482=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4829[_0x5d2803];return _0xdcad2c;};'use strict';var WhatsappInteractionEvents=require(_0x9482('0x0'));var events=[_0x9482('0x1'),_0x9482('0x2'),'update'];function createListener(_0x2e4fab,_0x2c848d){return function(_0x58b652){_0x2c848d[_0x9482('0x3')](_0x2e4fab,_0x58b652);};}function removeListener(_0x365264,_0x1c542c){return function(){WhatsappInteractionEvents[_0x9482('0x4')](_0x365264,_0x1c542c);};}exports['register']=function(_0x7b9e80){for(var _0x483394=0x0,_0x9bfcbe=events[_0x9482('0x5')];_0x483394<_0x9bfcbe;_0x483394++){var _0x55115c=events[_0x483394];var _0x37e238=createListener(_0x9482('0x6')+_0x55115c,_0x7b9e80);WhatsappInteractionEvents['on'](_0x55115c,_0x37e238);}}; \ No newline at end of file +var _0x7f0c=['whatsappInteraction:','./whatsappInteraction.events','remove','update','emit','removeListener','register','length'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x7f0c,0x141));var _0xc7f0=function(_0x51a85c,_0x2660a3){_0x51a85c=_0x51a85c-0x0;var _0x55001f=_0x7f0c[_0x51a85c];return _0x55001f;};'use strict';var WhatsappInteractionEvents=require(_0xc7f0('0x0'));var events=['save',_0xc7f0('0x1'),_0xc7f0('0x2')];function createListener(_0x5d7760,_0x40014d){return function(_0x25cc13){_0x40014d[_0xc7f0('0x3')](_0x5d7760,_0x25cc13);};}function removeListener(_0x492b6e,_0x53dc7f){return function(){WhatsappInteractionEvents[_0xc7f0('0x4')](_0x492b6e,_0x53dc7f);};}exports[_0xc7f0('0x5')]=function(_0x1c3308){for(var _0x51f317=0x0,_0x5c459b=events[_0xc7f0('0x6')];_0x51f317<_0x5c459b;_0x51f317++){var _0x52b9e5=events[_0x51f317];var _0x241c8c=createListener(_0xc7f0('0x7')+_0x52b9e5,_0x1c3308);WhatsappInteractionEvents['on'](_0x52b9e5,_0x241c8c);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index bb6245d..56ae48c 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 _0xece7=['show','post','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x295853,_0x343723){var _0x1305bb=function(_0x3de12e){while(--_0x3de12e){_0x295853['push'](_0x295853['shift']());}};_0x1305bb(++_0x343723);}(_0xece7,0x12a));var _0x7ece=function(_0x432fca,_0xb0b1b5){_0x432fca=_0x432fca-0x0;var _0x3adba4=_0xece7[_0x432fca];return _0x3adba4;};'use strict';var multer=require(_0x7ece('0x0'));var util=require(_0x7ece('0x1'));var path=require(_0x7ece('0x2'));var timeout=require(_0x7ece('0x3'));var express=require('express');var router=express[_0x7ece('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7ece('0x5'));var interaction=require(_0x7ece('0x6'));var config=require(_0x7ece('0x7'));var controller=require(_0x7ece('0x8'));router[_0x7ece('0x9')]('/',auth[_0x7ece('0xa')](),controller['index']);router[_0x7ece('0x9')](_0x7ece('0xb'),auth['isAuthenticated'](),controller[_0x7ece('0xc')]);router['get'](_0x7ece('0xd'),auth[_0x7ece('0xa')](),controller[_0x7ece('0xe')]);router[_0x7ece('0xf')]('/',auth[_0x7ece('0xa')](),interaction['tracked']('whatsapp',_0x7ece('0x10')),controller[_0x7ece('0x11')]);router[_0x7ece('0xf')](_0x7ece('0x12'),controller['status']);router['put'](_0x7ece('0xd'),auth[_0x7ece('0xa')](),controller['update']);router[_0x7ece('0x13')](_0x7ece('0x14'),auth[_0x7ece('0xa')](),controller[_0x7ece('0x15')]);router[_0x7ece('0x13')](_0x7ece('0x16'),auth[_0x7ece('0xa')](),controller[_0x7ece('0x17')]);router['delete']('/:id',auth[_0x7ece('0xa')](),controller[_0x7ece('0x18')]);module[_0x7ece('0x19')]=router; \ No newline at end of file +var _0x71cb=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','show','post','tracked','whatsapp','create','/:id/status','accept','/:id/reject','reject','destroy','multer','util','connect-timeout','express','Router'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0x71cb,0x1c9));var _0xb71c=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x71cb[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0xb71c('0x0'));var util=require(_0xb71c('0x1'));var path=require('path');var timeout=require(_0xb71c('0x2'));var express=require(_0xb71c('0x3'));var router=express[_0xb71c('0x4')]();var fs_extra=require(_0xb71c('0x5'));var auth=require(_0xb71c('0x6'));var interaction=require(_0xb71c('0x7'));var config=require('../../config/environment');var controller=require('./whatsappMessage.controller');router[_0xb71c('0x8')]('/',auth[_0xb71c('0x9')](),controller[_0xb71c('0xa')]);router[_0xb71c('0x8')]('/describe',auth[_0xb71c('0x9')](),controller['describe']);router[_0xb71c('0x8')](_0xb71c('0xb'),auth[_0xb71c('0x9')](),controller[_0xb71c('0xc')]);router[_0xb71c('0xd')]('/',auth[_0xb71c('0x9')](),interaction[_0xb71c('0xe')](_0xb71c('0xf'),'whatsappmessage:create'),controller[_0xb71c('0x10')]);router[_0xb71c('0xd')](_0xb71c('0x11'),controller['status']);router['put'](_0xb71c('0xb'),auth[_0xb71c('0x9')](),controller['update']);router['put']('/:id/accept',auth[_0xb71c('0x9')](),controller[_0xb71c('0x12')]);router['put'](_0xb71c('0x13'),auth['isAuthenticated'](),controller[_0xb71c('0x14')]);router['delete'](_0xb71c('0xb'),auth['isAuthenticated'](),controller[_0xb71c('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index 2d08fee..2110a1e 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 _0x3b59=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x58e5ce,_0x3f6c43){var _0xbdfe34=function(_0x441652){while(--_0x441652){_0x58e5ce['push'](_0x58e5ce['shift']());}};_0xbdfe34(++_0x3f6c43);}(_0x3b59,0xc0));var _0x93b5=function(_0x22df91,_0x1521d2){_0x22df91=_0x22df91-0x0;var _0x10f330=_0x3b59[_0x22df91];return _0x10f330;};'use strict';var Sequelize=require(_0x93b5('0x0'));module['exports']={'body':{'type':Sequelize[_0x93b5('0x1')](_0x93b5('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x93b5('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x93b5('0x4')]('in',_0x93b5('0x5')),'defaultValue':_0x93b5('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x93b5('0x6')](0xbe)},'phone':{'type':Sequelize[_0x93b5('0x6')]},'readAt':{'type':Sequelize[_0x93b5('0x7')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x93b5('0x6')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x68f5=['STRING','DATE','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x8f7cb6,_0xf929c8){var _0xf4d3a1=function(_0x3e3d31){while(--_0x3e3d31){_0x8f7cb6['push'](_0x8f7cb6['shift']());}};_0xf4d3a1(++_0xf929c8);}(_0x68f5,0x11a));var _0x568f=function(_0x5a4056,_0x468183){_0x5a4056=_0x5a4056-0x0;var _0x1c3045=_0x68f5[_0x5a4056];return _0x1c3045;};'use strict';var Sequelize=require(_0x568f('0x0'));module[_0x568f('0x1')]={'body':{'type':Sequelize[_0x568f('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x568f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x568f('0x4')]('in',_0x568f('0x5')),'defaultValue':_0x568f('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x568f('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x568f('0x7')]},'secret':{'type':Sequelize[_0x568f('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x568f('0x6')]},'providerResponse':{'type':Sequelize[_0x568f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index cab7fb3..c7b51ba 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 _0x299e=['lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','client','http','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','json','offset','limit','count','status','set','update','end','sendStatus','stack','name','index','map','WhatsappMessage','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','include','findAll','show','includeAll','find','create','body','params','destroy','accept','whatsapp','acceptMessage','reject','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','role','interaction','null','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','util'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x299e,0x69));var _0xe299=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x299e[_0x14add3];return _0x4a174f;};'use strict';var util=require(_0xe299('0x0'));var _=require(_0xe299('0x1'));var Redis=require(_0xe299('0x2'));var interactionService=require(_0xe299('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xe299('0x4'))(_0xe299('0x5'));var config=require('../../config/environment');var db=require(_0xe299('0x6'))['db'];config[_0xe299('0x7')]=_[_0xe299('0x8')](config[_0xe299('0x7')],{'host':_0xe299('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe299('0x7')]));require(_0xe299('0xa'))[_0xe299('0xb')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe299('0xc')][_0xe299('0xd')]({'port':0x232c});var client9002=jayson['client'][_0xe299('0xd')]({'port':0x232a});var interaction_log=require('../../config/logger')('whatsapp-interactions');function respondWithRpcPromise(_0x3df7f7,_0x1f346f,_0x571cca,_0x4a0acd){return new Promise(function(_0xd3cf6d,_0x3cfd9d){var _0x590594=_0x4a0acd||client;return _0x590594['request'](_0x3df7f7,_0x571cca)[_0xe299('0xe')](function(_0x2ea9f3){logger['info'](_0xe299('0xf'),_0x1f346f,'request\x20sent');logger['debug']('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1f346f,_0xe299('0x10'),JSON['stringify'](_0x2ea9f3));if(_0x2ea9f3['error']){if(_0x2ea9f3[_0xe299('0x11')][_0xe299('0x12')]===0x1f4){logger[_0xe299('0x11')](_0xe299('0xf'),_0x1f346f,_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);return _0x3cfd9d(_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x1f346f,_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);return _0xd3cf6d(_0x2ea9f3[_0xe299('0x11')][_0xe299('0x13')]);}else{logger[_0xe299('0x14')]('WhatsappMessage,\x20%s,\x20%s',_0x1f346f,'request\x20sent');_0xd3cf6d(_0x2ea9f3[_0xe299('0x15')]['message']);}})[_0xe299('0x16')](function(_0x29c71e){logger[_0xe299('0x11')](_0xe299('0xf'),_0x1f346f,_0x29c71e);_0x3cfd9d(_0x29c71e);});});}function respondWithResult(_0x118aa1,_0x16536b){_0x16536b=_0x16536b||0xc8;return function(_0x3f845e){if(_0x3f845e){return _0x118aa1['status'](_0x16536b)[_0xe299('0x17')](_0x3f845e);}};}function respondWithFilteredResult(_0x3f7e20,_0x1dbde2){return function(_0x19aea0){if(_0x19aea0){var _0x11f79=typeof _0x1dbde2[_0xe299('0x18')]==='undefined'&&typeof _0x1dbde2[_0xe299('0x19')]==='undefined';var _0x3d1a21=_0x19aea0['count'];var _0x3ccbd6=_0x11f79?0x0:_0x1dbde2[_0xe299('0x18')];var _0x14e035=_0x11f79?_0x19aea0[_0xe299('0x1a')]:_0x1dbde2[_0xe299('0x18')]+_0x1dbde2[_0xe299('0x19')];var _0x29d4b3;if(_0x14e035>=_0x3d1a21){_0x14e035=_0x3d1a21;_0x29d4b3=0xc8;}else{_0x29d4b3=0xce;}_0x3f7e20[_0xe299('0x1b')](_0x29d4b3);return _0x3f7e20[_0xe299('0x1c')]('Content-Range',_0x3ccbd6+'-'+_0x14e035+'/'+_0x3d1a21)[_0xe299('0x17')](_0x19aea0);}return null;};}function saveUpdates(_0x5f0d1d){return function(_0x5a3cdc){if(_0x5a3cdc){return _0x5a3cdc[_0xe299('0x1d')](_0x5f0d1d)[_0xe299('0xe')](function(_0x5c39a3){return _0x5c39a3;});}return null;};}function removeEntity(_0x66329){return function(_0x2f8056){if(_0x2f8056){return _0x2f8056['destroy']()['then'](function(){_0x66329[_0xe299('0x1b')](0xcc)[_0xe299('0x1e')]();});}};}function handleEntityNotFound(_0x5d2efe){return function(_0xeb3fb7){if(!_0xeb3fb7){_0x5d2efe[_0xe299('0x1f')](0x194);}return _0xeb3fb7;};}function handleError(_0x2f7cac,_0x38ef8d){_0x38ef8d=_0x38ef8d||0x1f4;return function(_0x401470){logger[_0xe299('0x11')](_0x401470[_0xe299('0x20')]);if(_0x401470[_0xe299('0x21')]){delete _0x401470[_0xe299('0x21')];}_0x2f7cac[_0xe299('0x1b')](_0x38ef8d)['send'](_0x401470);};}exports[_0xe299('0x22')]=function(_0x56326f,_0x4c21d6){var _0x9dd4e9={},_0xa337b6={},_0x12975d={'count':0x0,'rows':[]};var _0x54c6c8=_[_0xe299('0x23')](db[_0xe299('0x24')]['rawAttributes'],function(_0x4dcc46){return{'name':_0x4dcc46[_0xe299('0x25')],'type':_0x4dcc46[_0xe299('0x26')][_0xe299('0x27')]};});_0xa337b6[_0xe299('0x28')]=_['map'](_0x54c6c8,_0xe299('0x21'));_0xa337b6[_0xe299('0x29')]=_[_0xe299('0x2a')](_0x56326f[_0xe299('0x29')]);_0xa337b6['filters']=_[_0xe299('0x2b')](_0xa337b6[_0xe299('0x28')],_0xa337b6[_0xe299('0x29')]);_0x9dd4e9['attributes']=_[_0xe299('0x2b')](_0xa337b6['model'],qs[_0xe299('0x2c')](_0x56326f[_0xe299('0x29')][_0xe299('0x2c')]));_0x9dd4e9['attributes']=_0x9dd4e9[_0xe299('0x2d')][_0xe299('0x2e')]?_0x9dd4e9[_0xe299('0x2d')]:_0xa337b6[_0xe299('0x28')];if(!_0x56326f['query'][_0xe299('0x2f')](_0xe299('0x30'))){_0x9dd4e9[_0xe299('0x19')]=qs[_0xe299('0x19')](_0x56326f[_0xe299('0x29')]['limit']);_0x9dd4e9[_0xe299('0x18')]=qs[_0xe299('0x18')](_0x56326f[_0xe299('0x29')][_0xe299('0x18')]);}_0x9dd4e9[_0xe299('0x31')]=qs[_0xe299('0x32')](_0x56326f[_0xe299('0x29')]['sort']);_0x9dd4e9['where']=qs[_0xe299('0x33')](_[_0xe299('0x34')](_0x56326f[_0xe299('0x29')],_0xa337b6[_0xe299('0x33')]),_0x54c6c8);if(_0x56326f[_0xe299('0x29')][_0xe299('0x35')]){_0x9dd4e9[_0xe299('0x36')]=_['merge'](_0x9dd4e9[_0xe299('0x36')],{'$or':_['map'](_0x54c6c8,function(_0x1ce7ed){if(_0x1ce7ed[_0xe299('0x26')]!==_0xe299('0x37')){var _0x5a2e0f={};_0x5a2e0f[_0x1ce7ed['name']]={'$like':'%'+_0x56326f['query']['filter']+'%'};return _0x5a2e0f;}})});}_0x9dd4e9=_[_0xe299('0x38')]({},_0x9dd4e9,_0x56326f[_0xe299('0x39')]);var _0x425902={'where':_0x9dd4e9[_0xe299('0x36')]};return db[_0xe299('0x24')][_0xe299('0x1a')](_0x425902)[_0xe299('0xe')](function(_0x39457c){_0x12975d[_0xe299('0x1a')]=_0x39457c;if(_0x56326f['query']['includeAll']){_0x9dd4e9[_0xe299('0x3a')]=[{'all':!![]}];}return db[_0xe299('0x24')][_0xe299('0x3b')](_0x9dd4e9);})['then'](function(_0x187cc0){_0x12975d['rows']=_0x187cc0;return _0x12975d;})['then'](respondWithFilteredResult(_0x4c21d6,_0x9dd4e9))[_0xe299('0x16')](handleError(_0x4c21d6,null));};exports[_0xe299('0x3c')]=function(_0x335511,_0xdbfa5f){var _0x18f87b={'raw':!![],'where':{'id':_0x335511['params']['id']}},_0x260df9={};_0x260df9[_0xe299('0x28')]=_[_0xe299('0x2a')](db[_0xe299('0x24')]['rawAttributes']);_0x260df9[_0xe299('0x29')]=_[_0xe299('0x2a')](_0x335511[_0xe299('0x29')]);_0x260df9[_0xe299('0x33')]=_[_0xe299('0x2b')](_0x260df9['model'],_0x260df9['query']);_0x18f87b['attributes']=_[_0xe299('0x2b')](_0x260df9[_0xe299('0x28')],qs['fields'](_0x335511[_0xe299('0x29')][_0xe299('0x2c')]));_0x18f87b[_0xe299('0x2d')]=_0x18f87b['attributes'][_0xe299('0x2e')]?_0x18f87b[_0xe299('0x2d')]:_0x260df9[_0xe299('0x28')];if(_0x335511[_0xe299('0x29')][_0xe299('0x3d')]){_0x18f87b['include']=[{'all':!![]}];}_0x18f87b=_[_0xe299('0x38')]({},_0x18f87b,_0x335511[_0xe299('0x39')]);return db[_0xe299('0x24')][_0xe299('0x3e')](_0x18f87b)[_0xe299('0xe')](handleEntityNotFound(_0xdbfa5f,null))[_0xe299('0xe')](respondWithResult(_0xdbfa5f,null))['catch'](handleError(_0xdbfa5f,null));};exports[_0xe299('0x3f')]=function(_0x1c1c42,_0x3c7047){return db[_0xe299('0x24')][_0xe299('0x3f')](_0x1c1c42[_0xe299('0x40')],{})[_0xe299('0xe')](respondWithResult(_0x3c7047,0xc9))[_0xe299('0x16')](handleError(_0x3c7047,null));};exports[_0xe299('0x1d')]=function(_0x8e0f25,_0x380a2f){if(_0x8e0f25['body']['id']){delete _0x8e0f25[_0xe299('0x40')]['id'];}return db['WhatsappMessage'][_0xe299('0x3e')]({'where':{'id':_0x8e0f25[_0xe299('0x41')]['id']}})[_0xe299('0xe')](handleEntityNotFound(_0x380a2f,null))[_0xe299('0xe')](saveUpdates(_0x8e0f25['body'],null))[_0xe299('0xe')](respondWithResult(_0x380a2f,null))[_0xe299('0x16')](handleError(_0x380a2f,null));};exports[_0xe299('0x42')]=function(_0xc8b9ea,_0x31daab){return db[_0xe299('0x24')][_0xe299('0x3e')]({'where':{'id':_0xc8b9ea['params']['id']}})[_0xe299('0xe')](handleEntityNotFound(_0x31daab,null))[_0xe299('0xe')](removeEntity(_0x31daab,null))[_0xe299('0x16')](handleError(_0x31daab,null));};exports['describe']=function(_0x52cca3,_0x20416e){return db['WhatsappMessage']['describe']()[_0xe299('0xe')](respondWithResult(_0x20416e,null))[_0xe299('0x16')](handleError(_0x20416e,null));};exports[_0xe299('0x43')]=function(_0x35f321,_0x722e20){var _0x4c115f=_0xe299('0x44');return interactionService[_0xe299('0x45')](_0x35f321,_0x4c115f)[_0xe299('0xe')](respondWithResult(_0x722e20,null))[_0xe299('0x16')](handleError(_0x722e20,null));};exports[_0xe299('0x46')]=function(_0x39c29b,_0x176a25){var _0x257f00={'agent':{},'channel':_0xe299('0x44')};if(_0x39c29b['body']['id']){delete _0x39c29b[_0xe299('0x40')]['id'];}_0x39c29b['body'][_0xe299('0x47')]=_0x39c29b[_0xe299('0x40')]['UserId']||_0x39c29b[_0xe299('0x48')]['id'];_0x257f00[_0xe299('0x49')]['id']=_0x39c29b['body'][_0xe299('0x47')];return db[_0xe299('0x24')][_0xe299('0x3e')]({'where':{'id':_0x39c29b['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x176a25,null))[_0xe299('0xe')](function(_0x47015c){if(_0x47015c){_0x257f00[_0xe299('0x13')]=_0x47015c[_0xe299('0x4a')]({'plain':!![]});return db[_0xe299('0x4b')]['find']({'where':{'id':_0x47015c[_0xe299('0x4c')]}});}return null;})[_0xe299('0xe')](handleEntityNotFound(_0x176a25,null))[_0xe299('0xe')](function(_0xb85779){if(_0xb85779){_0x257f00['interaction']=_0xb85779['get']({'plain':!![]});interaction_log[_0xe299('0x14')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x39c29b['user']['id'],_0x39c29b[_0xe299('0x48')][_0xe299('0x21')],_0x39c29b['user'][_0xe299('0x4d')],_0x257f00[_0xe299('0x4e')]['id'],_0x39c29b[_0xe299('0x40')]?JSON['stringify'](_0x39c29b['body']):_0xe299('0x4f'));return respondWithRpcPromise(_0xe299('0x50'),_0xe299('0x51'),_0x257f00);}return null;})[_0xe299('0xe')](function(_0x23336d){var _0x49001a=_0xe299('0x52')+_0x23336d[_0xe299('0x13')][_0xe299('0x53')];return db['sequelize'][_0xe299('0x29')](_0x49001a,{'type':db[_0xe299('0x54')][_0xe299('0x55')][_0xe299('0x56')],'raw':!![]})[_0xe299('0xe')](function(_0x14acad){return _0x14acad;});})[_0xe299('0xe')](function(_0x483569){if(_0x483569){_0x257f00['message'][_0xe299('0x57')]=_0x483569[0x0];if(!_0x39c29b['body'][_0xe299('0x47')])return;return db[_0xe299('0x58')]['find']({'where':{'id':_0x39c29b[_0xe299('0x40')]['UserId'],'role':_0xe299('0x49')},'attributes':['id',_0xe299('0x21'),_0xe299('0x59'),_0xe299('0x5a'),_0xe299('0x5b')],'raw':!![]});}return null;})[_0xe299('0xe')](function(_0x24d176){if(!_0x24d176)return null;_0x257f00[_0xe299('0x13')][_0xe299('0x49')]=_0x24d176;return _0x257f00;})[_0xe299('0xe')](function(_0x48b1aa){if(_0x48b1aa){_0x48b1aa[_0xe299('0x13')][_0xe299('0x5c')]=util['format']('SIP/%s',_0x39c29b[_0xe299('0x48')][_0xe299('0x21')]);_0x48b1aa[_0xe299('0x13')][_0xe299('0x5d')]=_0x257f00[_0xe299('0x5d')];_0x48b1aa[_0xe299('0x13')][_0xe299('0x5e')]=_0x257f00['channel'];_0x48b1aa['message'][_0xe299('0x5f')]=_0xe299('0x46');respondWithRpcPromise(_0xe299('0x60'),'EventManager',{'event':_0xe299('0x61'),'message':_0x48b1aa['message']},client9002);return _0x257f00;}return null;})[_0xe299('0xe')](respondWithResult(_0x176a25,null))[_0xe299('0x16')](handleError(_0x176a25,null));};exports['status']=function(_0x56c017,_0x213036){if(_0x56c017['body']['id']){delete _0x56c017[_0xe299('0x40')]['id'];}var _0x54d8f7;return db[_0xe299('0x24')][_0xe299('0x3e')]({'where':{'id':_0x56c017[_0xe299('0x41')]['id']}})['then'](handleEntityNotFound(_0x213036,null))[_0xe299('0xe')](function(_0x1296a9){if(_0x1296a9){_0x54d8f7=_0x1296a9;return db[_0xe299('0x62')][_0xe299('0x3e')]({'where':{'id':_0x1296a9['WhatsappAccountId']}});}})['then'](handleEntityNotFound(_0x213036,null))[_0xe299('0xe')](function(_0xfd4c8c){if(_0xfd4c8c){logger['debug'](_0xe299('0x63'),_0xe299('0x1b'),_0xe299('0x64'),_0xfd4c8c[_0xe299('0x26')],util[_0xe299('0x65')](_0x56c017[_0xe299('0x40')],{'showHidden':![],'depth':null}));switch(_0xfd4c8c[_0xe299('0x26')]){case _0xe299('0x66'):if(_0x56c017[_0xe299('0x40')][_0xe299('0x67')]&&_0x56c017[_0xe299('0x40')][_0xe299('0x67')]===_0x54d8f7['messageId']&&_0x56c017[_0xe299('0x40')][_0xe299('0x68')]&&_0x56c017[_0xe299('0x40')][_0xe299('0x68')]===_0xe299('0x69')){return _0x54d8f7[_0xe299('0x1d')]({'read':!![]});}else{logger['error']('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0xe299('0x1b'),_0xe299('0x66'),util['inspect'](_0x56c017[_0xe299('0x40')],{'showHidden':![],'depth':null}));}break;}return _0x54d8f7;}})[_0xe299('0xe')](respondWithResult(_0x213036,null))[_0xe299('0x16')](handleError(_0x213036,null));}; \ No newline at end of file +var _0xce9a=['messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','whatsapp-interactions','request','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','status','json','offset','undefined','limit','count','Content-Range','update','destroy','end','sendStatus','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','where','merge','VIRTUAL','name','filter','options','WhatsappMessage','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','accept','acceptMessage','reject','UserId','user','agent','get','WhatsappInteractionId','interaction','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','ContactId','sequelize','QueryTypes','contact','User','internal','format','channel','motionChannel','event','EventManager','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','type','twilio','MessageSid'];(function(_0xe8cf75,_0x2a2ce2){var _0x579504=function(_0x2465a5){while(--_0x2465a5){_0xe8cf75['push'](_0xe8cf75['shift']());}};_0x579504(++_0x2a2ce2);}(_0xce9a,0xdb));var _0xace9=function(_0x5a3601,_0x355890){_0x5a3601=_0x5a3601-0x0;var _0x1e2b08=_0xce9a[_0x5a3601];return _0x1e2b08;};'use strict';var util=require('util');var _=require(_0xace9('0x0'));var Redis=require(_0xace9('0x1'));var interactionService=require(_0xace9('0x2'));var qs=require(_0xace9('0x3'));var logger=require(_0xace9('0x4'))(_0xace9('0x5'));var config=require(_0xace9('0x6'));var db=require(_0xace9('0x7'))['db'];config[_0xace9('0x8')]=_[_0xace9('0x9')](config[_0xace9('0x8')],{'host':_0xace9('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xace9('0x8')]));require(_0xace9('0xb'))[_0xace9('0xc')](socket);var jayson=require(_0xace9('0xd'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xace9('0xe')]['http']({'port':0x232a});var interaction_log=require('../../config/logger')(_0xace9('0xf'));function respondWithRpcPromise(_0x1da37b,_0x1375dd,_0x26bb41,_0x182371){return new Promise(function(_0x217e26,_0x936c1b){var _0x304de0=_0x182371||client;return _0x304de0[_0xace9('0x10')](_0x1da37b,_0x26bb41)[_0xace9('0x11')](function(_0x55f3dc){logger[_0xace9('0x12')](_0xace9('0x13'),_0x1375dd,'request\x20sent');logger[_0xace9('0x14')](_0xace9('0x15'),_0x1375dd,_0xace9('0x16'),JSON['stringify'](_0x55f3dc));if(_0x55f3dc['error']){if(_0x55f3dc[_0xace9('0x17')]['code']===0x1f4){logger[_0xace9('0x17')](_0xace9('0x13'),_0x1375dd,_0x55f3dc['error'][_0xace9('0x18')]);return _0x936c1b(_0x55f3dc[_0xace9('0x17')][_0xace9('0x18')]);}logger[_0xace9('0x17')](_0xace9('0x13'),_0x1375dd,_0x55f3dc[_0xace9('0x17')][_0xace9('0x18')]);return _0x217e26(_0x55f3dc[_0xace9('0x17')]['message']);}else{logger['info'](_0xace9('0x13'),_0x1375dd,_0xace9('0x16'));_0x217e26(_0x55f3dc['result'][_0xace9('0x18')]);}})['catch'](function(_0x121959){logger[_0xace9('0x17')](_0xace9('0x13'),_0x1375dd,_0x121959);_0x936c1b(_0x121959);});});}function respondWithResult(_0x1aede3,_0x4e8932){_0x4e8932=_0x4e8932||0xc8;return function(_0x543b7f){if(_0x543b7f){return _0x1aede3[_0xace9('0x19')](_0x4e8932)[_0xace9('0x1a')](_0x543b7f);}};}function respondWithFilteredResult(_0x56cf78,_0x9d296d){return function(_0x4ba15d){if(_0x4ba15d){var _0x5bcc5d=typeof _0x9d296d[_0xace9('0x1b')]===_0xace9('0x1c')&&typeof _0x9d296d[_0xace9('0x1d')]===_0xace9('0x1c');var _0x6a752e=_0x4ba15d[_0xace9('0x1e')];var _0x2ade04=_0x5bcc5d?0x0:_0x9d296d['offset'];var _0x2dfcf8=_0x5bcc5d?_0x4ba15d[_0xace9('0x1e')]:_0x9d296d[_0xace9('0x1b')]+_0x9d296d[_0xace9('0x1d')];var _0xe78f1d;if(_0x2dfcf8>=_0x6a752e){_0x2dfcf8=_0x6a752e;_0xe78f1d=0xc8;}else{_0xe78f1d=0xce;}_0x56cf78[_0xace9('0x19')](_0xe78f1d);return _0x56cf78['set'](_0xace9('0x1f'),_0x2ade04+'-'+_0x2dfcf8+'/'+_0x6a752e)['json'](_0x4ba15d);}return null;};}function saveUpdates(_0x4f3b59){return function(_0x4f5d6a){if(_0x4f5d6a){return _0x4f5d6a[_0xace9('0x20')](_0x4f3b59)[_0xace9('0x11')](function(_0x1931dc){return _0x1931dc;});}return null;};}function removeEntity(_0x2449a1){return function(_0x2fbbc9){if(_0x2fbbc9){return _0x2fbbc9[_0xace9('0x21')]()['then'](function(){_0x2449a1[_0xace9('0x19')](0xcc)[_0xace9('0x22')]();});}};}function handleEntityNotFound(_0x2828a8){return function(_0x3d9bfb){if(!_0x3d9bfb){_0x2828a8[_0xace9('0x23')](0x194);}return _0x3d9bfb;};}function handleError(_0x4b2312,_0x13b369){_0x13b369=_0x13b369||0x1f4;return function(_0x2b3804){logger[_0xace9('0x17')](_0x2b3804['stack']);if(_0x2b3804['name']){delete _0x2b3804['name'];}_0x4b2312['status'](_0x13b369)['send'](_0x2b3804);};}exports[_0xace9('0x24')]=function(_0x4eb139,_0x48ad93){var _0xfcb65b={},_0x4df463={},_0x3dd945={'count':0x0,'rows':[]};var _0x2e18f8=_[_0xace9('0x25')](db['WhatsappMessage'][_0xace9('0x26')],function(_0x2aaf0a){return{'name':_0x2aaf0a[_0xace9('0x27')],'type':_0x2aaf0a['type'][_0xace9('0x28')]};});_0x4df463[_0xace9('0x29')]=_['map'](_0x2e18f8,'name');_0x4df463[_0xace9('0x2a')]=_[_0xace9('0x2b')](_0x4eb139[_0xace9('0x2a')]);_0x4df463['filters']=_[_0xace9('0x2c')](_0x4df463['model'],_0x4df463[_0xace9('0x2a')]);_0xfcb65b[_0xace9('0x2d')]=_[_0xace9('0x2c')](_0x4df463[_0xace9('0x29')],qs[_0xace9('0x2e')](_0x4eb139[_0xace9('0x2a')][_0xace9('0x2e')]));_0xfcb65b[_0xace9('0x2d')]=_0xfcb65b[_0xace9('0x2d')]['length']?_0xfcb65b[_0xace9('0x2d')]:_0x4df463['model'];if(!_0x4eb139[_0xace9('0x2a')][_0xace9('0x2f')](_0xace9('0x30'))){_0xfcb65b['limit']=qs[_0xace9('0x1d')](_0x4eb139['query'][_0xace9('0x1d')]);_0xfcb65b[_0xace9('0x1b')]=qs[_0xace9('0x1b')](_0x4eb139[_0xace9('0x2a')][_0xace9('0x1b')]);}_0xfcb65b[_0xace9('0x31')]=qs[_0xace9('0x32')](_0x4eb139[_0xace9('0x2a')][_0xace9('0x32')]);_0xfcb65b['where']=qs[_0xace9('0x33')](_['pick'](_0x4eb139[_0xace9('0x2a')],_0x4df463[_0xace9('0x33')]),_0x2e18f8);if(_0x4eb139[_0xace9('0x2a')]['filter']){_0xfcb65b[_0xace9('0x34')]=_[_0xace9('0x35')](_0xfcb65b[_0xace9('0x34')],{'$or':_['map'](_0x2e18f8,function(_0x4bbda1){if(_0x4bbda1['type']!==_0xace9('0x36')){var _0x4ea642={};_0x4ea642[_0x4bbda1[_0xace9('0x37')]]={'$like':'%'+_0x4eb139[_0xace9('0x2a')][_0xace9('0x38')]+'%'};return _0x4ea642;}})});}_0xfcb65b=_[_0xace9('0x35')]({},_0xfcb65b,_0x4eb139[_0xace9('0x39')]);var _0x4e53d3={'where':_0xfcb65b[_0xace9('0x34')]};return db[_0xace9('0x3a')][_0xace9('0x1e')](_0x4e53d3)[_0xace9('0x11')](function(_0x3014a9){_0x3dd945[_0xace9('0x1e')]=_0x3014a9;if(_0x4eb139['query'][_0xace9('0x3b')]){_0xfcb65b[_0xace9('0x3c')]=[{'all':!![]}];}return db[_0xace9('0x3a')][_0xace9('0x3d')](_0xfcb65b);})[_0xace9('0x11')](function(_0x132bd3){_0x3dd945[_0xace9('0x3e')]=_0x132bd3;return _0x3dd945;})['then'](respondWithFilteredResult(_0x48ad93,_0xfcb65b))[_0xace9('0x3f')](handleError(_0x48ad93,null));};exports['show']=function(_0x3f6556,_0x35704b){var _0x3c572b={'raw':!![],'where':{'id':_0x3f6556['params']['id']}},_0xdc692a={};_0xdc692a[_0xace9('0x29')]=_[_0xace9('0x2b')](db['WhatsappMessage']['rawAttributes']);_0xdc692a[_0xace9('0x2a')]=_['keys'](_0x3f6556['query']);_0xdc692a['filters']=_['intersection'](_0xdc692a['model'],_0xdc692a[_0xace9('0x2a')]);_0x3c572b['attributes']=_[_0xace9('0x2c')](_0xdc692a[_0xace9('0x29')],qs['fields'](_0x3f6556['query'][_0xace9('0x2e')]));_0x3c572b['attributes']=_0x3c572b['attributes'][_0xace9('0x40')]?_0x3c572b[_0xace9('0x2d')]:_0xdc692a[_0xace9('0x29')];if(_0x3f6556['query'][_0xace9('0x3b')]){_0x3c572b[_0xace9('0x3c')]=[{'all':!![]}];}_0x3c572b=_['merge']({},_0x3c572b,_0x3f6556[_0xace9('0x39')]);return db[_0xace9('0x3a')][_0xace9('0x41')](_0x3c572b)[_0xace9('0x11')](handleEntityNotFound(_0x35704b,null))['then'](respondWithResult(_0x35704b,null))[_0xace9('0x3f')](handleError(_0x35704b,null));};exports[_0xace9('0x42')]=function(_0x5a4227,_0x2e4ed9){return db[_0xace9('0x3a')][_0xace9('0x42')](_0x5a4227[_0xace9('0x43')],{})['then'](respondWithResult(_0x2e4ed9,0xc9))[_0xace9('0x3f')](handleError(_0x2e4ed9,null));};exports[_0xace9('0x20')]=function(_0x1b9a3f,_0x10788d){if(_0x1b9a3f[_0xace9('0x43')]['id']){delete _0x1b9a3f[_0xace9('0x43')]['id'];}return db[_0xace9('0x3a')]['find']({'where':{'id':_0x1b9a3f['params']['id']}})[_0xace9('0x11')](handleEntityNotFound(_0x10788d,null))[_0xace9('0x11')](saveUpdates(_0x1b9a3f[_0xace9('0x43')],null))[_0xace9('0x11')](respondWithResult(_0x10788d,null))[_0xace9('0x3f')](handleError(_0x10788d,null));};exports[_0xace9('0x21')]=function(_0xec3cff,_0x2aa693){return db[_0xace9('0x3a')][_0xace9('0x41')]({'where':{'id':_0xec3cff[_0xace9('0x44')]['id']}})[_0xace9('0x11')](handleEntityNotFound(_0x2aa693,null))[_0xace9('0x11')](removeEntity(_0x2aa693,null))[_0xace9('0x3f')](handleError(_0x2aa693,null));};exports[_0xace9('0x45')]=function(_0x2c7709,_0x2f972c){return db[_0xace9('0x3a')][_0xace9('0x45')]()[_0xace9('0x11')](respondWithResult(_0x2f972c,null))[_0xace9('0x3f')](handleError(_0x2f972c,null));};exports[_0xace9('0x46')]=function(_0x1dda8b,_0x5c465f){var _0xc26070='whatsapp';return interactionService[_0xace9('0x47')](_0x1dda8b,_0xc26070)[_0xace9('0x11')](respondWithResult(_0x5c465f,null))[_0xace9('0x3f')](handleError(_0x5c465f,null));};exports[_0xace9('0x48')]=function(_0x3b6500,_0xc6e47b){var _0x42f9e0={'agent':{},'channel':'whatsapp'};if(_0x3b6500[_0xace9('0x43')]['id']){delete _0x3b6500[_0xace9('0x43')]['id'];}_0x3b6500[_0xace9('0x43')][_0xace9('0x49')]=_0x3b6500['body']['UserId']||_0x3b6500[_0xace9('0x4a')]['id'];_0x42f9e0[_0xace9('0x4b')]['id']=_0x3b6500[_0xace9('0x43')][_0xace9('0x49')];return db[_0xace9('0x3a')][_0xace9('0x41')]({'where':{'id':_0x3b6500[_0xace9('0x44')]['id'],'UserId':null}})[_0xace9('0x11')](handleEntityNotFound(_0xc6e47b,null))['then'](function(_0x2fc6a6){if(_0x2fc6a6){_0x42f9e0[_0xace9('0x18')]=_0x2fc6a6[_0xace9('0x4c')]({'plain':!![]});return db['WhatsappInteraction'][_0xace9('0x41')]({'where':{'id':_0x2fc6a6[_0xace9('0x4d')]}});}return null;})[_0xace9('0x11')](handleEntityNotFound(_0xc6e47b,null))[_0xace9('0x11')](function(_0x298ec4){if(_0x298ec4){_0x42f9e0[_0xace9('0x4e')]=_0x298ec4[_0xace9('0x4c')]({'plain':!![]});interaction_log['info'](_0xace9('0x4f'),_0x3b6500[_0xace9('0x4a')]['id'],_0x3b6500[_0xace9('0x4a')][_0xace9('0x37')],_0x3b6500[_0xace9('0x4a')]['role'],_0x42f9e0[_0xace9('0x4e')]['id'],_0x3b6500[_0xace9('0x43')]?JSON[_0xace9('0x50')](_0x3b6500['body']):_0xace9('0x51'));return respondWithRpcPromise(_0xace9('0x52'),'rejectMessage',_0x42f9e0);}return null;})['then'](function(_0x2b9b86){var _0x1d1eba='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2b9b86[_0xace9('0x18')][_0xace9('0x53')];return db[_0xace9('0x54')][_0xace9('0x2a')](_0x1d1eba,{'type':db['Sequelize'][_0xace9('0x55')]['SELECT'],'raw':!![]})[_0xace9('0x11')](function(_0x442cde){return _0x442cde;});})[_0xace9('0x11')](function(_0x3b6ff9){if(_0x3b6ff9){_0x42f9e0[_0xace9('0x18')][_0xace9('0x56')]=_0x3b6ff9[0x0];if(!_0x3b6500[_0xace9('0x43')][_0xace9('0x49')])return;return db[_0xace9('0x57')][_0xace9('0x41')]({'where':{'id':_0x3b6500[_0xace9('0x43')][_0xace9('0x49')],'role':_0xace9('0x4b')},'attributes':['id',_0xace9('0x37'),'fullname','email',_0xace9('0x58')],'raw':!![]});}return null;})[_0xace9('0x11')](function(_0x4ae20d){if(!_0x4ae20d)return null;_0x42f9e0[_0xace9('0x18')]['agent']=_0x4ae20d;return _0x42f9e0;})[_0xace9('0x11')](function(_0x559388){if(_0x559388){_0x559388['message']['interface']=util[_0xace9('0x59')]('SIP/%s',_0x3b6500[_0xace9('0x4a')][_0xace9('0x37')]);_0x559388[_0xace9('0x18')]['channel']=_0x42f9e0[_0xace9('0x5a')];_0x559388[_0xace9('0x18')][_0xace9('0x5b')]=_0x42f9e0['channel'];_0x559388[_0xace9('0x18')][_0xace9('0x5c')]=_0xace9('0x48');respondWithRpcPromise(_0xace9('0x5d'),_0xace9('0x5d'),{'event':_0xace9('0x5e'),'message':_0x559388[_0xace9('0x18')]},client9002);return _0x42f9e0;}return null;})['then'](respondWithResult(_0xc6e47b,null))[_0xace9('0x3f')](handleError(_0xc6e47b,null));};exports[_0xace9('0x19')]=function(_0x474cfd,_0x7289ba){if(_0x474cfd[_0xace9('0x43')]['id']){delete _0x474cfd[_0xace9('0x43')]['id'];}var _0x57091c;return db['WhatsappMessage']['find']({'where':{'id':_0x474cfd[_0xace9('0x44')]['id']}})['then'](handleEntityNotFound(_0x7289ba,null))[_0xace9('0x11')](function(_0x20172a){if(_0x20172a){_0x57091c=_0x20172a;return db[_0xace9('0x5f')]['find']({'where':{'id':_0x20172a[_0xace9('0x60')]}});}})[_0xace9('0x11')](handleEntityNotFound(_0x7289ba,null))[_0xace9('0x11')](function(_0x45f321){if(_0x45f321){logger[_0xace9('0x14')](_0xace9('0x61'),_0xace9('0x19'),_0xace9('0x62'),_0x45f321[_0xace9('0x63')],util['inspect'](_0x474cfd[_0xace9('0x43')],{'showHidden':![],'depth':null}));switch(_0x45f321[_0xace9('0x63')]){case _0xace9('0x64'):if(_0x474cfd[_0xace9('0x43')]['MessageSid']&&_0x474cfd[_0xace9('0x43')][_0xace9('0x65')]===_0x57091c[_0xace9('0x66')]&&_0x474cfd[_0xace9('0x43')][_0xace9('0x67')]&&_0x474cfd[_0xace9('0x43')][_0xace9('0x67')]===_0xace9('0x68')){return _0x57091c[_0xace9('0x20')]({'read':!![]});}else{logger['error'](_0xace9('0x69'),'status',_0xace9('0x64'),util[_0xace9('0x6a')](_0x474cfd[_0xace9('0x43')],{'showHidden':![],'depth':null}));}break;}return _0x57091c;}})[_0xace9('0x11')](respondWithResult(_0x7289ba,null))[_0xace9('0x3f')](handleError(_0x7289ba,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 30bd5e1..0a87d68 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 _0x373d=['update','emit','hasOwnProperty','hook','exports','events','WhatsappMessage','setMaxListeners','save'];(function(_0x235d53,_0xd6cf33){var _0x94e7b=function(_0xd2ee8b){while(--_0xd2ee8b){_0x235d53['push'](_0x235d53['shift']());}};_0x94e7b(++_0xd6cf33);}(_0x373d,0x1e2));var _0xd373=function(_0x58926f,_0x4f9633){_0x58926f=_0x58926f-0x0;var _0x19f1fc=_0x373d[_0x58926f];return _0x19f1fc;};'use strict';var EventEmitter=require(_0xd373('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0xd373('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xd373('0x2')](0x0);var events={'afterCreate':_0xd373('0x3'),'afterUpdate':_0xd373('0x4'),'afterDestroy':'remove'};function emitEvent(_0x151fe9){return function(_0x547fca,_0x2b6e64,_0x598692){WhatsappMessageEvents['emit'](_0x151fe9+':'+_0x547fca['id'],_0x547fca);WhatsappMessageEvents[_0xd373('0x5')](_0x151fe9,_0x547fca);_0x598692(null);};}for(var e in events){if(events[_0xd373('0x6')](e)){var event=events[e];WhatsappMessage[_0xd373('0x7')](e,emitEvent(event));}}module[_0xd373('0x8')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa25c=['WhatsappMessage','setMaxListeners','save','update','remove','hasOwnProperty','exports','../../mysqldb'];(function(_0x20b380,_0x28fe70){var _0x29061c=function(_0x4983c8){while(--_0x4983c8){_0x20b380['push'](_0x20b380['shift']());}};_0x29061c(++_0x28fe70);}(_0xa25c,0x13f));var _0xca25=function(_0x33cfe6,_0x3e215c){_0x33cfe6=_0x33cfe6-0x0;var _0x34b6cf=_0xa25c[_0x33cfe6];return _0x34b6cf;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0xca25('0x0'))['db'][_0xca25('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xca25('0x2')](0x0);var events={'afterCreate':_0xca25('0x3'),'afterUpdate':_0xca25('0x4'),'afterDestroy':_0xca25('0x5')};function emitEvent(_0x2cc2d6){return function(_0x336741,_0x498b8e,_0x41d208){WhatsappMessageEvents['emit'](_0x2cc2d6+':'+_0x336741['id'],_0x336741);WhatsappMessageEvents['emit'](_0x2cc2d6,_0x336741);_0x41d208(null);};}for(var e in events){if(events[_0xca25('0x6')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module[_0xca25('0x7')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a424238..7900726 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 _0xf3cc=['node-fetch','rimraf','../../config/environment','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','models','get','direction','toLowerCase','out','isNil','WhatsappInteractionId','update','catch','error','secret','WhatsappAccount','WhatsappAccountId','then','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','sinch','/whatsapp/v1/','/messages/','POST','application/json','message_id','statuses','err','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xf3cc,0x10d));var _0xcf3c=function(_0x38ecda,_0x3b551e){_0x38ecda=_0x38ecda-0x0;var _0x3fa8f3=_0xf3cc[_0x38ecda];return _0x3fa8f3;};'use strict';var _=require(_0xcf3c('0x0'));var util=require(_0xcf3c('0x1'));var logger=require(_0xcf3c('0x2'))(_0xcf3c('0x3'));var moment=require('moment');var BPromise=require(_0xcf3c('0x4'));var rp=require(_0xcf3c('0x5'));var fetch=require(_0xcf3c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcf3c('0x7'));var config=require(_0xcf3c('0x8'));var attributes=require('./whatsappMessage.attributes');module[_0xcf3c('0x9')]=function(_0x2b5cae,_0x35cb18){return _0x2b5cae[_0xcf3c('0xa')](_0xcf3c('0xb'),attributes,{'tableName':_0xcf3c('0xc'),'paranoid':![],'indexes':[{'name':_0xcf3c('0xd'),'fields':[_0xcf3c('0xd')]},{'name':_0xcf3c('0xe'),'fields':[_0xcf3c('0xf')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x58fe7b,_0x2c2b70,_0xd4d142){var _0x3022f2=_0x2b5cae[_0xcf3c('0x10')];var _0x46e82c=_0x58fe7b[_0xcf3c('0x11')]({'plain':!![]});if(_0x46e82c[_0xcf3c('0x12')][_0xcf3c('0x13')]()==='in'||_0x46e82c['direction'][_0xcf3c('0x13')]()===_0xcf3c('0x14')&&!_0x46e82c['secret']&&!_[_0xcf3c('0x15')](_0x46e82c['UserId'])){_0x3022f2['WhatsappInteraction']['findOne']({'where':{'id':_0x46e82c[_0xcf3c('0x16')]}})['then'](function(_0x2f387b){if(_0x2f387b){_0x2f387b[_0xcf3c('0x17')]({'lastMsgAt':_0x46e82c['createdAt'],'lastMsgDirection':_0x46e82c[_0xcf3c('0x12')]['toLowerCase']()});}})[_0xcf3c('0x18')](function(_0x1db425){console[_0xcf3c('0x19')](_0x1db425);});}if(_0x46e82c['direction']===_0xcf3c('0x14')&&!_0x46e82c[_0xcf3c('0x1a')]){var _0x395159;_0x3022f2[_0xcf3c('0x1b')]['find']({'where':{'id':_0x46e82c[_0xcf3c('0x1c')]},'raw':!![]})[_0xcf3c('0x1d')](function(_0x25ebf3){_0x395159=_0x25ebf3;if(_0x395159&&_0x395159[_0xcf3c('0x1e')]){switch(_0x395159[_0xcf3c('0x1e')]){case _0xcf3c('0x1f'):var _0xf22c4e=require(_0xcf3c('0x1f'));if(_0x395159[_0xcf3c('0x20')]&&_0x395159[_0xcf3c('0x21')]&&_0x395159[_0xcf3c('0x22')]){var _0x15e346=new _0xf22c4e(_0x395159['accountSid'],_0x395159[_0xcf3c('0x21')]);_0x15e346['messages'][_0xcf3c('0x23')]({'body':_0x46e82c[_0xcf3c('0xf')],'to':'whatsapp:'+_0x46e82c[_0xcf3c('0x22')],'from':_0xcf3c('0x24')+_0x395159[_0xcf3c('0x22')],'statusCallback':_0x395159[_0xcf3c('0x25')]+_0xcf3c('0x26')+_0x46e82c['id']+_0xcf3c('0x27')+_0x395159[_0xcf3c('0x28')]})[_0xcf3c('0x1d')](function(_0x58b8e5){if(_0x58b8e5[_0xcf3c('0x29')]){return _0x58fe7b['update']({'messageId':_0x58b8e5[_0xcf3c('0x29')]});}})[_0xcf3c('0x18')](function(_0x42ce14){logger[_0xcf3c('0x19')](_0xcf3c('0x2a'),_0xcf3c('0x2b'),'twilio',util[_0xcf3c('0x2c')](_0x42ce14,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xcf3c('0x2a'),_0xcf3c('0x2b'),_0xcf3c('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xcf3c('0x2d'):var _0x54174a=_0x395159[_0xcf3c('0x20')];var _0xe22e99=_0x395159[_0xcf3c('0x21')];var _0x5bdae3=_0x395159['baseUrl']+_0xcf3c('0x2e')+_0x54174a+_0xcf3c('0x2f');var _0x1f53ee={'to':[_0x46e82c[_0xcf3c('0x22')]],'message':{'type':'text','text':_0x46e82c[_0xcf3c('0xf')]}};var _0x2cf47e={'method':_0xcf3c('0x30'),'uri':_0x5bdae3,'headers':{'Authorization':'Bearer\x20'+_0xe22e99,'Content-Type':_0xcf3c('0x31')},'body':_0x1f53ee,'json':!![]};rp(_0x2cf47e)[_0xcf3c('0x1d')](function(_0x196b02){if(_0x196b02['statuses'][0x0][_0xcf3c('0x32')]){return _0x58fe7b[_0xcf3c('0x17')]({'messageId':_0x196b02[_0xcf3c('0x33')][0x0][_0xcf3c('0x32')]});}})[_0xcf3c('0x18')](function(_0x534f56){logger[_0xcf3c('0x34')]('WhatsappMessage,\x20%s',_0x534f56);});break;}}})[_0xcf3c('0x35')](function(){_0xd4d142();});}else{_0xd4d142();}}},'charset':'utf8mb4','collate':_0xcf3c('0x36')});}; \ No newline at end of file +var _0xc305=['../../config/environment','./whatsappMessage.attributes','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','WhatsappInteraction','findOne','then','createdAt','catch','error','out','WhatsappAccount','find','WhatsappAccountId','twilio','authToken','accountSid','messages','create','whatsapp:','phone','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','afterCreate','inspect','WhatsappMessage,\x20%s,\x20%s,\x20%s','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl','/whatsapp/v1/','/messages/','POST','Bearer\x20','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','request-promise','node-fetch','path','rimraf'];(function(_0x17a32f,_0x5a51a){var _0x15a293=function(_0x55fbd3){while(--_0x55fbd3){_0x17a32f['push'](_0x17a32f['shift']());}};_0x15a293(++_0x5a51a);}(_0xc305,0x1d9));var _0x5c30=function(_0x590a38,_0x2bc65c){_0x590a38=_0x590a38-0x0;var _0xf36626=_0xc305[_0x590a38];return _0xf36626;};'use strict';var _=require('lodash');var util=require(_0x5c30('0x0'));var logger=require('../../config/logger')(_0x5c30('0x1'));var moment=require('moment');var BPromise=require(_0x5c30('0x2'));var rp=require(_0x5c30('0x3'));var fetch=require(_0x5c30('0x4'));var fs=require('fs');var path=require(_0x5c30('0x5'));var rimraf=require(_0x5c30('0x6'));var config=require(_0x5c30('0x7'));var attributes=require(_0x5c30('0x8'));module['exports']=function(_0xc27fee,_0x3aa577){return _0xc27fee[_0x5c30('0x9')]('WhatsappMessage',attributes,{'tableName':_0x5c30('0xa'),'paranoid':![],'indexes':[{'name':_0x5c30('0xb'),'fields':['messageId']},{'name':_0x5c30('0xc'),'fields':[_0x5c30('0xd')],'type':_0x5c30('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x248246,_0x428a35,_0x27a423){var _0x4dd28d=_0xc27fee[_0x5c30('0xf')];var _0x15e82f=_0x248246[_0x5c30('0x10')]({'plain':!![]});if(_0x15e82f[_0x5c30('0x11')][_0x5c30('0x12')]()==='in'||_0x15e82f[_0x5c30('0x11')][_0x5c30('0x12')]()==='out'&&!_0x15e82f[_0x5c30('0x13')]&&!_[_0x5c30('0x14')](_0x15e82f[_0x5c30('0x15')])){_0x4dd28d[_0x5c30('0x16')][_0x5c30('0x17')]({'where':{'id':_0x15e82f['WhatsappInteractionId']}})[_0x5c30('0x18')](function(_0x527c8d){if(_0x527c8d){_0x527c8d['update']({'lastMsgAt':_0x15e82f[_0x5c30('0x19')],'lastMsgDirection':_0x15e82f['direction'][_0x5c30('0x12')]()});}})[_0x5c30('0x1a')](function(_0x2cd017){console[_0x5c30('0x1b')](_0x2cd017);});}if(_0x15e82f['direction']===_0x5c30('0x1c')&&!_0x15e82f[_0x5c30('0x13')]){var _0xb336f9;_0x4dd28d[_0x5c30('0x1d')][_0x5c30('0x1e')]({'where':{'id':_0x15e82f[_0x5c30('0x1f')]},'raw':!![]})[_0x5c30('0x18')](function(_0x489f95){_0xb336f9=_0x489f95;if(_0xb336f9&&_0xb336f9['type']){switch(_0xb336f9['type']){case _0x5c30('0x20'):var _0x5806f2=require(_0x5c30('0x20'));if(_0xb336f9['accountSid']&&_0xb336f9[_0x5c30('0x21')]&&_0xb336f9['phone']){var _0x4850ae=new _0x5806f2(_0xb336f9[_0x5c30('0x22')],_0xb336f9['authToken']);_0x4850ae[_0x5c30('0x23')][_0x5c30('0x24')]({'body':_0x15e82f[_0x5c30('0xd')],'to':_0x5c30('0x25')+_0x15e82f[_0x5c30('0x26')],'from':'whatsapp:'+_0xb336f9[_0x5c30('0x26')],'statusCallback':_0xb336f9[_0x5c30('0x27')]+_0x5c30('0x28')+_0x15e82f['id']+_0x5c30('0x29')+_0xb336f9[_0x5c30('0x2a')]})[_0x5c30('0x18')](function(_0xde9e45){if(_0xde9e45[_0x5c30('0x2b')]){return _0x248246[_0x5c30('0x2c')]({'messageId':_0xde9e45[_0x5c30('0x2b')]});}})[_0x5c30('0x1a')](function(_0x291b64){logger[_0x5c30('0x1b')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x5c30('0x2d'),_0x5c30('0x20'),util[_0x5c30('0x2e')](_0x291b64,{'showHidden':![],'depth':null}));});}else{logger[_0x5c30('0x1b')](_0x5c30('0x2f'),_0x5c30('0x2d'),_0x5c30('0x20'),_0x5c30('0x30'));}break;case _0x5c30('0x31'):var _0x508aa1=_0xb336f9[_0x5c30('0x22')];var _0x2343bf=_0xb336f9[_0x5c30('0x21')];var _0x1b34e9=_0xb336f9[_0x5c30('0x32')]+_0x5c30('0x33')+_0x508aa1+_0x5c30('0x34');var _0x273924={'to':[_0x15e82f['phone']],'message':{'type':'text','text':_0x15e82f[_0x5c30('0xd')]}};var _0x402bdf={'method':_0x5c30('0x35'),'uri':_0x1b34e9,'headers':{'Authorization':_0x5c30('0x36')+_0x2343bf,'Content-Type':'application/json'},'body':_0x273924,'json':!![]};rp(_0x402bdf)['then'](function(_0x2f0c97){if(_0x2f0c97['statuses'][0x0][_0x5c30('0x37')]){return _0x248246[_0x5c30('0x2c')]({'messageId':_0x2f0c97['statuses'][0x0]['message_id']});}})[_0x5c30('0x1a')](function(_0x1761f7){logger[_0x5c30('0x38')](_0x5c30('0x39'),_0x1761f7);});break;}}})['finally'](function(){_0x27a423();});}else{_0x27a423();}}},'charset':_0x5c30('0x3a'),'collate':_0x5c30('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 3d395f6..1eb0284 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 _0x43d0=['request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','raw','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./whatsappMessage.socket','register'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x43d0,0x1ab));var _0x043d=function(_0x3725ee,_0x543bd9){_0x3725ee=_0x3725ee-0x0;var _0x399c71=_0x43d0[_0x3725ee];return _0x399c71;};'use strict';var _=require(_0x043d('0x0'));var util=require('util');var moment=require(_0x043d('0x1'));var BPromise=require(_0x043d('0x2'));var rs=require(_0x043d('0x3'));var fs=require('fs');var Redis=require(_0x043d('0x4'));var db=require(_0x043d('0x5'))['db'];var utils=require(_0x043d('0x6'));var logger=require('../../config/logger')(_0x043d('0x7'));var config=require(_0x043d('0x8'));var jayson=require(_0x043d('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0x043d('0xa')]=_[_0x043d('0xb')](config[_0x043d('0xa')],{'host':_0x043d('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x043d('0xa')]));require(_0x043d('0xd'))[_0x043d('0xe')](socket);function respondWithRpcPromise(_0xcc04d,_0x461ec3,_0x4ba9c5){return new BPromise(function(_0x33a3bb,_0x13057f){return client[_0x043d('0xf')](_0xcc04d,_0x4ba9c5)[_0x043d('0x10')](function(_0x2a8e4b){logger[_0x043d('0x11')](_0x043d('0x12'),_0x461ec3,_0x043d('0x13'));logger['debug'](_0x043d('0x14'),_0x461ec3,_0x043d('0x13'),JSON[_0x043d('0x15')](_0x2a8e4b));if(_0x2a8e4b[_0x043d('0x16')]){if(_0x2a8e4b[_0x043d('0x16')][_0x043d('0x17')]===0x1f4){logger[_0x043d('0x16')](_0x043d('0x12'),_0x461ec3,_0x2a8e4b[_0x043d('0x16')][_0x043d('0x18')]);return _0x13057f(_0x2a8e4b[_0x043d('0x16')][_0x043d('0x18')]);}logger['error'](_0x043d('0x12'),_0x461ec3,_0x2a8e4b[_0x043d('0x16')][_0x043d('0x18')]);return _0x33a3bb(_0x2a8e4b[_0x043d('0x16')]['message']);}else{logger[_0x043d('0x11')](_0x043d('0x12'),_0x461ec3,_0x043d('0x13'));_0x33a3bb(_0x2a8e4b[_0x043d('0x19')][_0x043d('0x18')]);}})[_0x043d('0x1a')](function(_0x4dd5fd){logger[_0x043d('0x16')](_0x043d('0x12'),_0x461ec3,_0x4dd5fd);_0x13057f(_0x4dd5fd);});});}exports[_0x043d('0x1b')]=function(_0xefdef9){var _0x11cd70=this;return new Promise(function(_0x21c58d,_0x152ad1){return db[_0x043d('0x1c')][_0x043d('0x1d')](_0xefdef9[_0x043d('0x1e')],{'raw':_0xefdef9[_0x043d('0x1f')]?_0xefdef9[_0x043d('0x1f')][_0x043d('0x20')]===undefined?!![]:![]:!![]})[_0x043d('0x10')](function(_0x3f13c0){logger[_0x043d('0x11')]('CreateWhatsappMessage',_0xefdef9);logger[_0x043d('0x21')](_0x043d('0x1b'),_0xefdef9,JSON[_0x043d('0x15')](_0x3f13c0));_0x21c58d(_0x3f13c0);})[_0x043d('0x1a')](function(_0x34b71c){logger[_0x043d('0x16')](_0x043d('0x1b'),_0x34b71c[_0x043d('0x18')],_0xefdef9);_0x152ad1(_0x11cd70[_0x043d('0x16')](0x1f4,_0x34b71c[_0x043d('0x18')]));});});}; \ No newline at end of file +var _0x3824=['../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','debug','request\x20sent','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','WhatsappMessage','body','options','raw','then','CreateWhatsappMessage','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e775a,_0x57eaaa){var _0x191794=function(_0xf883ca){while(--_0xf883ca){_0x5e775a['push'](_0x5e775a['shift']());}};_0x191794(++_0x57eaaa);}(_0x3824,0xaf));var _0x4382=function(_0x33bc64,_0x4d1e92){_0x33bc64=_0x33bc64-0x0;var _0x3fdd34=_0x3824[_0x33bc64];return _0x3fdd34;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x4382('0x0'));var rs=require(_0x4382('0x1'));var fs=require('fs');var Redis=require(_0x4382('0x2'));var db=require(_0x4382('0x3'))['db'];var utils=require(_0x4382('0x4'));var logger=require(_0x4382('0x5'))(_0x4382('0x6'));var config=require(_0x4382('0x7'));var jayson=require(_0x4382('0x8'));var client=jayson['client'][_0x4382('0x9')]({'port':0x232a});config['redis']=_[_0x4382('0xa')](config[_0x4382('0xb')],{'host':_0x4382('0xc'),'port':0x18eb});var socket=require(_0x4382('0xd'))(new Redis(config[_0x4382('0xb')]));require('./whatsappMessage.socket')[_0x4382('0xe')](socket);function respondWithRpcPromise(_0x126552,_0x49ad5b,_0xe5a3b0){return new BPromise(function(_0x37ae66,_0x502235){return client[_0x4382('0xf')](_0x126552,_0xe5a3b0)['then'](function(_0x162357){logger[_0x4382('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x49ad5b,'request\x20sent');logger[_0x4382('0x11')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x49ad5b,_0x4382('0x12'),JSON['stringify'](_0x162357));if(_0x162357['error']){if(_0x162357[_0x4382('0x13')][_0x4382('0x14')]===0x1f4){logger['error'](_0x4382('0x15'),_0x49ad5b,_0x162357['error'][_0x4382('0x16')]);return _0x502235(_0x162357[_0x4382('0x13')]['message']);}logger[_0x4382('0x13')](_0x4382('0x15'),_0x49ad5b,_0x162357[_0x4382('0x13')][_0x4382('0x16')]);return _0x37ae66(_0x162357[_0x4382('0x13')][_0x4382('0x16')]);}else{logger['info'](_0x4382('0x15'),_0x49ad5b,_0x4382('0x12'));_0x37ae66(_0x162357[_0x4382('0x17')]['message']);}})['catch'](function(_0x318f80){logger['error'](_0x4382('0x15'),_0x49ad5b,_0x318f80);_0x502235(_0x318f80);});});}exports['CreateWhatsappMessage']=function(_0x52407c){var _0x25bf48=this;return new Promise(function(_0x5aaa41,_0x3b2aa2){return db[_0x4382('0x18')]['create'](_0x52407c[_0x4382('0x19')],{'raw':_0x52407c[_0x4382('0x1a')]?_0x52407c[_0x4382('0x1a')][_0x4382('0x1b')]===undefined?!![]:![]:!![]})[_0x4382('0x1c')](function(_0x518bf8){logger['info'](_0x4382('0x1d'),_0x52407c);logger[_0x4382('0x11')](_0x4382('0x1d'),_0x52407c,JSON['stringify'](_0x518bf8));_0x5aaa41(_0x518bf8);})['catch'](function(_0x3a81c7){logger[_0x4382('0x13')]('CreateWhatsappMessage',_0x3a81c7[_0x4382('0x16')],_0x52407c);_0x3b2aa2(_0x25bf48[_0x4382('0x13')](0x1f4,_0x3a81c7[_0x4382('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 3f14535..6731c35 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 _0x327c=['register','length','whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener'];(function(_0x5481c0,_0x6a415c){var _0x1046d3=function(_0x1300f4){while(--_0x1300f4){_0x5481c0['push'](_0x5481c0['shift']());}};_0x1046d3(++_0x6a415c);}(_0x327c,0xff));var _0xc327=function(_0x5a1256,_0x43e77b){_0x5a1256=_0x5a1256-0x0;var _0x2057be=_0x327c[_0x5a1256];return _0x2057be;};'use strict';var WhatsappMessageEvents=require(_0xc327('0x0'));var events=[_0xc327('0x1'),_0xc327('0x2'),_0xc327('0x3')];function createListener(_0x4e34db,_0x40f373){return function(_0x3666f2){_0x40f373[_0xc327('0x4')](_0x4e34db,_0x3666f2);};}function removeListener(_0x2674d1,_0x5c482e){return function(){WhatsappMessageEvents[_0xc327('0x5')](_0x2674d1,_0x5c482e);};}exports[_0xc327('0x6')]=function(_0x419b4b){for(var _0x69fdb8=0x0,_0x470798=events[_0xc327('0x7')];_0x69fdb8<_0x470798;_0x69fdb8++){var _0x133959=events[_0x69fdb8];var _0x2d38c3=createListener(_0xc327('0x8')+_0x133959,_0x419b4b);WhatsappMessageEvents['on'](_0x133959,_0x2d38c3);}}; \ No newline at end of file +var _0x9992=['removeListener','register','length','whatsappMessage:','./whatsappMessage.events','save','update','emit'];(function(_0x5a746f,_0x5b3a87){var _0x2e685c=function(_0x1f838e){while(--_0x1f838e){_0x5a746f['push'](_0x5a746f['shift']());}};_0x2e685c(++_0x5b3a87);}(_0x9992,0xfc));var _0x2999=function(_0x7148a3,_0x1c6652){_0x7148a3=_0x7148a3-0x0;var _0x52f31d=_0x9992[_0x7148a3];return _0x52f31d;};'use strict';var WhatsappMessageEvents=require(_0x2999('0x0'));var events=[_0x2999('0x1'),'remove',_0x2999('0x2')];function createListener(_0x5f0da5,_0x3dbe7a){return function(_0x5010b5){_0x3dbe7a[_0x2999('0x3')](_0x5f0da5,_0x5010b5);};}function removeListener(_0x525ca9,_0x5ac4cd){return function(){WhatsappMessageEvents[_0x2999('0x4')](_0x525ca9,_0x5ac4cd);};}exports[_0x2999('0x5')]=function(_0x266389){for(var _0x38265c=0x0,_0x384827=events[_0x2999('0x6')];_0x38265c<_0x384827;_0x38265c++){var _0x42f02b=events[_0x38265c];var _0x3c9046=createListener(_0x2999('0x7')+_0x42f02b,_0x266389);WhatsappMessageEvents['on'](_0x42f02b,_0x3c9046);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 6aeb5fa..e0ea2c0 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 _0xcaf5=['getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams'];(function(_0x3b4054,_0x396c72){var _0x1b9722=function(_0xbdf315){while(--_0xbdf315){_0x3b4054['push'](_0x3b4054['shift']());}};_0x1b9722(++_0x396c72);}(_0xcaf5,0xa8));var _0x5caf=function(_0x2e7dae,_0x404f90){_0x2e7dae=_0x2e7dae-0x0;var _0x178c6d=_0xcaf5[_0x2e7dae];return _0x178c6d;};'use strict';var multer=require(_0x5caf('0x0'));var util=require(_0x5caf('0x1'));var path=require(_0x5caf('0x2'));var timeout=require(_0x5caf('0x3'));var express=require(_0x5caf('0x4'));var router=express['Router']();var fs_extra=require(_0x5caf('0x5'));var auth=require(_0x5caf('0x6'));var interaction=require(_0x5caf('0x7'));var config=require(_0x5caf('0x8'));var controller=require('./whatsappQueue.controller');router[_0x5caf('0x9')]('/',auth[_0x5caf('0xa')](),controller['index']);router['get'](_0x5caf('0xb'),auth[_0x5caf('0xa')](),controller[_0x5caf('0xc')]);router[_0x5caf('0x9')](_0x5caf('0xd'),auth[_0x5caf('0xa')](),controller[_0x5caf('0xe')]);router[_0x5caf('0x9')](_0x5caf('0xf'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x10')]);router[_0x5caf('0x9')](_0x5caf('0x11'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x12')]);router['get'](_0x5caf('0x13'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x14')]);router[_0x5caf('0x15')]('/',auth[_0x5caf('0xa')](),controller[_0x5caf('0x16')]);router[_0x5caf('0x15')]('/:id/teams',auth[_0x5caf('0xa')](),controller[_0x5caf('0x17')]);router[_0x5caf('0x15')]('/:id/users',auth[_0x5caf('0xa')](),controller[_0x5caf('0x18')]);router[_0x5caf('0x19')]('/:id',auth[_0x5caf('0xa')](),controller[_0x5caf('0x1a')]);router[_0x5caf('0x1b')](_0x5caf('0xd'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x1c')]);router[_0x5caf('0x1b')]('/:id/teams',auth[_0x5caf('0xa')](),controller['removeTeams']);router['delete'](_0x5caf('0x13'),auth[_0x5caf('0xa')](),controller[_0x5caf('0x1d')]);module[_0x5caf('0x1e')]=router; \ No newline at end of file +var _0xb6ec=['../../components/interaction/service','./whatsappQueue.controller','get','isAuthenticated','/describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x5afd7e,_0x53002f){var _0x2b0626=function(_0x9e1b0){while(--_0x9e1b0){_0x5afd7e['push'](_0x5afd7e['shift']());}};_0x2b0626(++_0x53002f);}(_0xb6ec,0x1e7));var _0xcb6e=function(_0x9e6b05,_0x402640){_0x9e6b05=_0x9e6b05-0x0;var _0x1db966=_0xb6ec[_0x9e6b05];return _0x1db966;};'use strict';var multer=require(_0xcb6e('0x0'));var util=require('util');var path=require(_0xcb6e('0x1'));var timeout=require(_0xcb6e('0x2'));var express=require(_0xcb6e('0x3'));var router=express[_0xcb6e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xcb6e('0x5'));var interaction=require(_0xcb6e('0x6'));var config=require('../../config/environment');var controller=require(_0xcb6e('0x7'));router[_0xcb6e('0x8')]('/',auth[_0xcb6e('0x9')](),controller['index']);router[_0xcb6e('0x8')](_0xcb6e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xcb6e('0x8')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xc')]);router[_0xcb6e('0x8')]('/:id/members',auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xd')]);router[_0xcb6e('0x8')](_0xcb6e('0xe'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0xf')]);router[_0xcb6e('0x8')](_0xcb6e('0x10'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x11')]);router[_0xcb6e('0x12')]('/',auth['isAuthenticated'](),controller[_0xcb6e('0x13')]);router[_0xcb6e('0x12')](_0xcb6e('0xe'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x14')]);router[_0xcb6e('0x12')](_0xcb6e('0x10'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x15')]);router[_0xcb6e('0x16')](_0xcb6e('0xb'),auth[_0xcb6e('0x9')](),controller[_0xcb6e('0x17')]);router[_0xcb6e('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xcb6e('0x19')]);router[_0xcb6e('0x18')](_0xcb6e('0xe'),auth['isAuthenticated'](),controller[_0xcb6e('0x1a')]);router[_0xcb6e('0x18')]('/:id/users',auth['isAuthenticated'](),controller[_0xcb6e('0x1b')]);module[_0xcb6e('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 88ad4eb..3b817f7 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 _0x5b02=['exports','STRING','name','rrmemory','roundrobin','sequelize'];(function(_0x16c5e1,_0x17b81c){var _0x354f29=function(_0x2d517e){while(--_0x2d517e){_0x16c5e1['push'](_0x16c5e1['shift']());}};_0x354f29(++_0x17b81c);}(_0x5b02,0xe9));var _0x25b0=function(_0x93187e,_0x2f60cb){_0x93187e=_0x93187e-0x0;var _0x15b88e=_0x5b02[_0x93187e];return _0x15b88e;};'use strict';var Sequelize=require(_0x25b0('0x0'));module[_0x25b0('0x1')]={'name':{'type':Sequelize[_0x25b0('0x2')],'unique':_0x25b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x25b0('0x4'),'beepall',_0x25b0('0x5'))},'description':{'type':Sequelize[_0x25b0('0x2')]}}; \ No newline at end of file +var _0x4ef1=['STRING','sequelize','exports','name','INTEGER','ENUM','rrmemory','beepall','roundrobin'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x4ef1,0xeb));var _0x14ef=function(_0x14af87,_0x149ac3){_0x14af87=_0x14af87-0x0;var _0x4ff770=_0x4ef1[_0x14af87];return _0x4ff770;};'use strict';var Sequelize=require(_0x14ef('0x0'));module[_0x14ef('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x14ef('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x14ef('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x14ef('0x4')](_0x14ef('0x5'),_0x14ef('0x6'),_0x14ef('0x7'))},'description':{'type':Sequelize[_0x14ef('0x8')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 66b9b31..50b797f 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 _0x05cb=['field','tq.TeamId','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','isArray','userWhatsappQueue:remove','findOne','order','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','catch','show','params','model','keys','filters','attributes','intersection','fields','merge','find','body','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserWhatsappQueue','length','hasOwnProperty','nolimit','sort','filter','options','findAll','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','Agents','online','interface','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05cb,0x10f));var _0xb05c=function(_0x45f2f2,_0x4688f1){_0x45f2f2=_0x45f2f2-0x0;var _0xfa119f=_0x05cb[_0x45f2f2];return _0xfa119f;};'use strict';var BPromise=require(_0xb05c('0x0'));var util=require(_0xb05c('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xb05c('0x2'));var qs=require(_0xb05c('0x3'));var logger=require(_0xb05c('0x4'))(_0xb05c('0x5'));var config=require(_0xb05c('0x6'));var db=require('../../mysqldb')['db'];config[_0xb05c('0x7')]=_['defaults'](config[_0xb05c('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xb05c('0x8'))(new Redis(config[_0xb05c('0x7')]));require(_0xb05c('0x9'))[_0xb05c('0xa')](socket);function respondWithStatusCode(_0x4e7af7,_0xad80){_0xad80=_0xad80||0xcc;return function(_0x297cb8){if(_0x297cb8){return _0x4e7af7[_0xb05c('0xb')](_0xad80);}return _0x4e7af7['status'](_0xad80)[_0xb05c('0xc')]();};}function respondWithResult(_0x50d5e9,_0x128305){_0x128305=_0x128305||0xc8;return function(_0x1fb486){if(_0x1fb486){return _0x50d5e9[_0xb05c('0xd')](_0x128305)[_0xb05c('0xe')](_0x1fb486);}};}function respondWithFilteredResult(_0x4c3b36,_0x39993a){return function(_0x266dbd){if(_0x266dbd){var _0x57f602=typeof _0x39993a[_0xb05c('0xf')]===_0xb05c('0x10')&&typeof _0x39993a[_0xb05c('0x11')]===_0xb05c('0x10');var _0x39c6d7=_0x266dbd[_0xb05c('0x12')];var _0x34bbef=_0x57f602?0x0:_0x39993a[_0xb05c('0xf')];var _0x404486=_0x57f602?_0x266dbd['count']:_0x39993a[_0xb05c('0xf')]+_0x39993a['limit'];var _0x5b4776;if(_0x404486>=_0x39c6d7){_0x404486=_0x39c6d7;_0x5b4776=0xc8;}else{_0x5b4776=0xce;}_0x4c3b36[_0xb05c('0xd')](_0x5b4776);return _0x4c3b36['set'](_0xb05c('0x13'),_0x34bbef+'-'+_0x404486+'/'+_0x39c6d7)[_0xb05c('0xe')](_0x266dbd);}return null;};}function saveUpdates(_0x48fa27){return function(_0x24130f){if(_0x24130f){return _0x24130f[_0xb05c('0x14')](_0x48fa27)[_0xb05c('0x15')](function(_0x2f8984){return _0x2f8984;});}return null;};}function removeEntity(_0x11acbf){return function(_0x557015){if(_0x557015){return _0x557015[_0xb05c('0x16')]()[_0xb05c('0x15')](function(){var _0x2cfa16=_0x557015[_0xb05c('0x17')]({'plain':!![]});var _0x5cdc56=_0xb05c('0x18');return db[_0xb05c('0x19')][_0xb05c('0x16')]({'where':{'type':_0x5cdc56,'resourceId':_0x2cfa16['id']}})[_0xb05c('0x15')](function(){return _0x557015;});})['then'](function(){_0x11acbf[_0xb05c('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e8b44){return function(_0x17efad){if(!_0x17efad){_0x4e8b44[_0xb05c('0xb')](0x194);}return _0x17efad;};}function handleError(_0x5eeb0c,_0x3b6672){_0x3b6672=_0x3b6672||0x1f4;return function(_0x5100df){logger[_0xb05c('0x1a')](_0x5100df[_0xb05c('0x1b')]);if(_0x5100df[_0xb05c('0x1c')]){delete _0x5100df[_0xb05c('0x1c')];}_0x5eeb0c['status'](_0x3b6672)['send'](_0x5100df);};}exports[_0xb05c('0x1d')]=function(_0xd50b85,_0x4c2391){var _0x21fac0={};var _0x23dc7c={'count':0x0,'rows':[]};var _0x5dcffc=_[_0xb05c('0x1e')](db[_0xb05c('0x1f')][_0xb05c('0x20')],function(_0x7f7a95){return{'name':_0x7f7a95[_0xb05c('0x21')],'type':_0x7f7a95[_0xb05c('0x22')][_0xb05c('0x23')]};});_0x21fac0=qs[_0xb05c('0x24')](_0x5dcffc,_0xd50b85);var _0x15c137={'where':_0x21fac0[_0xb05c('0x25')]};return db[_0xb05c('0x1f')]['count'](_0x15c137)[_0xb05c('0x15')](function(_0x1aa4d5){_0x23dc7c[_0xb05c('0x12')]=_0x1aa4d5;_0x21fac0[_0xb05c('0x26')]=qs[_0xb05c('0x26')](_0xd50b85[_0xb05c('0x27')]);return db[_0xb05c('0x1f')]['findAll'](_0x21fac0);})[_0xb05c('0x15')](function(_0x368d57){_0x23dc7c['rows']=_0x368d57;return _0x23dc7c;})[_0xb05c('0x15')](respondWithFilteredResult(_0x4c2391,_0x21fac0))[_0xb05c('0x28')](handleError(_0x4c2391,null));};exports[_0xb05c('0x29')]=function(_0x1a5eca,_0x144610){var _0x3bbbd9={'raw':!![],'where':{'id':_0x1a5eca[_0xb05c('0x2a')]['id']}},_0xdcb7a5={};_0xdcb7a5[_0xb05c('0x2b')]=_[_0xb05c('0x2c')](db[_0xb05c('0x1f')][_0xb05c('0x20')]);_0xdcb7a5[_0xb05c('0x27')]=_[_0xb05c('0x2c')](_0x1a5eca[_0xb05c('0x27')]);_0xdcb7a5[_0xb05c('0x2d')]=_['intersection'](_0xdcb7a5[_0xb05c('0x2b')],_0xdcb7a5['query']);_0x3bbbd9[_0xb05c('0x2e')]=_[_0xb05c('0x2f')](_0xdcb7a5[_0xb05c('0x2b')],qs['fields'](_0x1a5eca['query'][_0xb05c('0x30')]));_0x3bbbd9['attributes']=_0x3bbbd9['attributes']['length']?_0x3bbbd9[_0xb05c('0x2e')]:_0xdcb7a5['model'];if(_0x1a5eca[_0xb05c('0x27')]['includeAll']){_0x3bbbd9[_0xb05c('0x26')]=[{'all':!![]}];}_0x3bbbd9=_[_0xb05c('0x31')]({},_0x3bbbd9,_0x1a5eca['options']);return db[_0xb05c('0x1f')][_0xb05c('0x32')](_0x3bbbd9)[_0xb05c('0x15')](handleEntityNotFound(_0x144610,null))[_0xb05c('0x15')](respondWithResult(_0x144610,null))['catch'](handleError(_0x144610,null));};exports['create']=function(_0x4fa9a2,_0x290974){return db[_0xb05c('0x1f')]['create'](_0x4fa9a2[_0xb05c('0x33')],{})['then'](function(_0x462624){var _0xcfe8bc=_0x4fa9a2[_0xb05c('0x34')]['get']({'plain':!![]});if(!_0xcfe8bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xcfe8bc['role']===_0xb05c('0x34')){var _0x232c4a=_0x462624['get']({'plain':!![]});var _0x5ebfe5=_0xb05c('0x18');return db[_0xb05c('0x35')][_0xb05c('0x32')]({'where':{'name':_0x5ebfe5,'userProfileId':_0xcfe8bc[_0xb05c('0x36')]},'raw':!![]})[_0xb05c('0x15')](function(_0x5d4d46){if(_0x5d4d46&&_0x5d4d46[_0xb05c('0x37')]===0x0){return db[_0xb05c('0x19')][_0xb05c('0x38')]({'name':_0x232c4a[_0xb05c('0x1c')],'resourceId':_0x232c4a['id'],'type':_0x5d4d46[_0xb05c('0x1c')],'sectionId':_0x5d4d46['id']},{})[_0xb05c('0x15')](function(){return _0x462624;});}else{return _0x462624;}})[_0xb05c('0x28')](function(_0x465512){logger['error'](_0xb05c('0x39'),_0x465512);throw _0x465512;});}return _0x462624;})[_0xb05c('0x15')](respondWithResult(_0x290974,0xc9))[_0xb05c('0x28')](handleError(_0x290974,null));};exports[_0xb05c('0x14')]=function(_0x487b56,_0x74ab6c){if(_0x487b56[_0xb05c('0x33')]['id']){delete _0x487b56['body']['id'];}return db['WhatsappQueue'][_0xb05c('0x32')]({'where':{'id':_0x487b56[_0xb05c('0x2a')]['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x74ab6c,null))['then'](saveUpdates(_0x487b56[_0xb05c('0x33')],null))[_0xb05c('0x15')](respondWithResult(_0x74ab6c,null))['catch'](handleError(_0x74ab6c,null));};exports[_0xb05c('0x16')]=function(_0x19ea74,_0x590623){return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x19ea74[_0xb05c('0x2a')]['id']}})['then'](handleEntityNotFound(_0x590623,null))[_0xb05c('0x15')](removeEntity(_0x590623,null))['catch'](handleError(_0x590623,null));};exports[_0xb05c('0x3a')]=function(_0x3f76f6,_0x3a1487){return db['WhatsappQueue'][_0xb05c('0x3a')]()[_0xb05c('0x15')](respondWithResult(_0x3a1487,null))[_0xb05c('0x28')](handleError(_0x3a1487,null));};exports['getMembers']=function(_0x116bf6,_0x4ad56d){var _0x1b4a13={'raw':!![],'where':{}},_0x3e37fb={},_0x3ea84f;return db[_0xb05c('0x1f')]['findOne']({'where':{'id':_0x116bf6['params']['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x4ad56d,null))[_0xb05c('0x15')](function(_0x4b57b6){if(_0x4b57b6){_0x3ea84f=_0x4b57b6[_0xb05c('0x17')]({'plain':!![]});_0x3e37fb[_0xb05c('0x2b')]=_[_0xb05c('0x2c')](db[_0xb05c('0x3b')][_0xb05c('0x20')]);_0x3e37fb['query']=_[_0xb05c('0x2c')](_0x116bf6[_0xb05c('0x27')]);_0x3e37fb['filters']=_['intersection'](_0x3e37fb[_0xb05c('0x2b')],_0x3e37fb[_0xb05c('0x27')]);_0x1b4a13[_0xb05c('0x2e')]=_['intersection'](_0x3e37fb['model'],qs['fields'](_0x116bf6[_0xb05c('0x27')][_0xb05c('0x30')]));_0x1b4a13[_0xb05c('0x2e')]=_0x1b4a13[_0xb05c('0x2e')][_0xb05c('0x3c')]?_0x1b4a13[_0xb05c('0x2e')]:_0x3e37fb[_0xb05c('0x2b')];if(!_0x116bf6[_0xb05c('0x27')][_0xb05c('0x3d')](_0xb05c('0x3e'))){_0x1b4a13[_0xb05c('0x11')]=qs['limit'](_0x116bf6[_0xb05c('0x27')]['limit']);_0x1b4a13[_0xb05c('0xf')]=qs[_0xb05c('0xf')](_0x116bf6['query'][_0xb05c('0xf')]);}_0x1b4a13['order']=qs[_0xb05c('0x3f')](_0x116bf6[_0xb05c('0x27')][_0xb05c('0x3f')]);_0x1b4a13['where']=qs[_0xb05c('0x2d')](_['pick'](_0x116bf6['query'],_0x3e37fb[_0xb05c('0x2d')]));_0x1b4a13[_0xb05c('0x25')]['WhatsappQueueId']=_0x4b57b6['id'];if(_0x116bf6[_0xb05c('0x27')][_0xb05c('0x40')]){_0x1b4a13[_0xb05c('0x25')]=_[_0xb05c('0x31')](_0x1b4a13[_0xb05c('0x25')],{'$or':_[_0xb05c('0x1e')](_0x1b4a13[_0xb05c('0x2e')],function(_0x21bfca){var _0x33c924={};_0x33c924[_0x21bfca]={'$like':'%'+_0x116bf6['query'][_0xb05c('0x40')]+'%'};return _0x33c924;})});}_0x1b4a13=_[_0xb05c('0x31')]({},_0x1b4a13,_0x116bf6[_0xb05c('0x41')]);return db[_0xb05c('0x3b')][_0xb05c('0x42')](_0x1b4a13);}})[_0xb05c('0x15')](function(_0x4ca074){if(_0x4ca074){return db[_0xb05c('0x43')][_0xb05c('0x44')]({'where':{'id':_[_0xb05c('0x1e')](_0x4ca074,_0xb05c('0x45')),'role':_0xb05c('0x46')},'attributes':['id',_0xb05c('0x1c'),_0xb05c('0x47'),_0xb05c('0x48'),_0xb05c('0x49')]});}})['then'](function(_0x13bd0f){if(_0x13bd0f){return{'count':_0x13bd0f[_0xb05c('0x12')],'rows':_[_0xb05c('0x1e')](_0x13bd0f[_0xb05c('0x4a')],function(_0x15f841){return{'membername':_0x15f841[_0xb05c('0x1c')],'UserId':_0x15f841['id'],'queue_name':_0x3ea84f[_0xb05c('0x1c')],'WhatsappQueueId':_0x3ea84f['id'],'interface':util[_0xb05c('0x4b')](_0xb05c('0x4c'),_0xb05c('0x4d'),_0x15f841[_0xb05c('0x1c')]),'penalty':0x0,'paused':_0x15f841[_0xb05c('0x47')],'createdAt':_0x15f841[_0xb05c('0x49')],'updatedAt':_0x15f841['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xb05c('0x15')](respondWithFilteredResult(_0x4ad56d,_0x1b4a13))[_0xb05c('0x28')](handleError(_0x4ad56d,null));};exports[_0xb05c('0x4e')]=function(_0x129a9a,_0x297910){var _0x4c4e58={};var _0x363321={};var _0x41367d;var _0x2d0012;return db[_0xb05c('0x1f')]['findOne']({'where':{'id':_0x129a9a['params']['id']}})['then'](handleEntityNotFound(_0x297910,null))[_0xb05c('0x15')](function(_0x28de5a){if(_0x28de5a){_0x41367d=_0x28de5a;_0x363321[_0xb05c('0x2b')]=_['keys'](db[_0xb05c('0x4f')]['rawAttributes']);_0x363321['query']=_[_0xb05c('0x2c')](_0x129a9a[_0xb05c('0x27')]);_0x363321[_0xb05c('0x2d')]=_[_0xb05c('0x2f')](_0x363321[_0xb05c('0x2b')],_0x363321['query']);_0x4c4e58[_0xb05c('0x2e')]=_[_0xb05c('0x2f')](_0x363321[_0xb05c('0x2b')],qs['fields'](_0x129a9a[_0xb05c('0x27')][_0xb05c('0x30')]));_0x4c4e58[_0xb05c('0x2e')]=_0x4c4e58['attributes'][_0xb05c('0x3c')]?_0x4c4e58[_0xb05c('0x2e')]:_0x363321[_0xb05c('0x2b')];_0x4c4e58['order']=qs[_0xb05c('0x3f')](_0x129a9a[_0xb05c('0x27')][_0xb05c('0x3f')]);_0x4c4e58['where']=qs[_0xb05c('0x2d')](_[_0xb05c('0x50')](_0x129a9a[_0xb05c('0x27')],_0x363321[_0xb05c('0x2d')]));if(_0x129a9a[_0xb05c('0x27')][_0xb05c('0x40')]){_0x4c4e58[_0xb05c('0x25')]=_['merge'](_0x4c4e58[_0xb05c('0x25')],{'$or':_['map'](_0x4c4e58[_0xb05c('0x2e')],function(_0x4b8188){var _0x191168={};_0x191168[_0x4b8188]={'$like':'%'+_0x129a9a['query'][_0xb05c('0x40')]+'%'};return _0x191168;})});}_0x4c4e58=_[_0xb05c('0x31')]({},_0x4c4e58,_0x129a9a[_0xb05c('0x41')]);return _0x41367d[_0xb05c('0x4e')](_0x4c4e58);}})[_0xb05c('0x15')](function(_0x37b747){if(_0x37b747){_0x2d0012=_0x37b747[_0xb05c('0x3c')];if(!_0x129a9a[_0xb05c('0x27')][_0xb05c('0x3d')](_0xb05c('0x3e'))){_0x4c4e58[_0xb05c('0x11')]=qs[_0xb05c('0x11')](_0x129a9a['query']['limit']);_0x4c4e58[_0xb05c('0xf')]=qs[_0xb05c('0xf')](_0x129a9a[_0xb05c('0x27')]['offset']);}return _0x41367d[_0xb05c('0x4e')](_0x4c4e58);}})['then'](function(_0xe6f1ed){if(_0xe6f1ed){return _0xe6f1ed?{'count':_0x2d0012,'rows':_0xe6f1ed}:null;}})['then'](respondWithResult(_0x297910,null))[_0xb05c('0x28')](handleError(_0x297910,null));};exports[_0xb05c('0x51')]=function(_0x3c04e6,_0x3bdf96){var _0x493a53=_0x3c04e6[_0xb05c('0x33')][_0xb05c('0x52')];return db[_0xb05c('0x4f')]['findAll']({'where':{'id':_0x493a53},'attributes':['id'],'include':[{'model':db[_0xb05c('0x43')],'as':_0xb05c('0x53'),'attributes':['id',_0xb05c('0x1c'),_0xb05c('0x54'),'voicePause',_0xb05c('0x55')],'raw':!![]}]})['then'](function(_0x2859b7){if(_0x2859b7){var _0xdd815b=_['flatMap'](_0x2859b7,function(_0x4dfaee){var _0x222c1b=_0x4dfaee[_0xb05c('0x17')]({'plain':!![]});return _0x222c1b[_0xb05c('0x53')];});return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x3c04e6['params']['id']}})[_0xb05c('0x15')](function(_0x2a77f9){return db[_0xb05c('0x56')][_0xb05c('0x57')](function(_0x52e1a4){return _0x2a77f9[_0xb05c('0x51')](_0x493a53,{'transaction':_0x52e1a4})[_0xb05c('0x15')](function(){return BPromise[_0xb05c('0x58')](_0xdd815b,function(_0x4a175f){return db[_0xb05c('0x3b')][_0xb05c('0x59')]({'where':{'UserId':_0x4a175f['id'],'WhatsappQueueId':_0x3c04e6['params']['id']},'transaction':_0x52e1a4});});})[_0xb05c('0x15')](function(){_0xdd815b[_0xb05c('0x5a')](function(_0x35a4ff){socket[_0xb05c('0x5b')](_0xb05c('0x5c'),{'UserId':_0x35a4ff['id'],'WhatsappQueueId':_0x2a77f9['id']});});});});});}})[_0xb05c('0x15')](respondWithStatusCode(_0x3bdf96,null))[_0xb05c('0x28')](handleError(_0x3bdf96,null));};exports[_0xb05c('0x5d')]=function(_0x498cf8,_0x9be55c){return db[_0xb05c('0x4f')]['findAll']({'where':{'id':_0x498cf8[_0xb05c('0x27')][_0xb05c('0x52')]},'attributes':['id'],'include':[{'model':db[_0xb05c('0x43')],'as':_0xb05c('0x53'),'attributes':['id'],'raw':!![]}]})[_0xb05c('0x15')](handleEntityNotFound(_0x9be55c,null))['then'](function(_0x5672c4){var _0x520c6b=_[_0xb05c('0x1e')](_0x5672c4,'id');var _0x129c02=[];var _0x5a49ac=[];var _0x91a27d=squel[_0xb05c('0x5e')]();_0x91a27d[_0xb05c('0x5f')](_0xb05c('0x60'))['from'](_0xb05c('0x61'),'tq')['join'](_0xb05c('0x62'),'ut',_0xb05c('0x63'))[_0xb05c('0x25')](_0xb05c('0x64'),_0x498cf8[_0xb05c('0x2a')]['id']);for(var _0x3a7e60=0x0;_0x3a7e60<_0x5672c4['length'];_0x3a7e60+=0x1){let _0x247515=_0x5672c4[_0x3a7e60];for(var _0x302e10=0x0;_0x302e10<_0x247515[_0xb05c('0x53')][_0xb05c('0x3c')];_0x302e10+=0x1){let _0xcdaebf=_0x247515[_0xb05c('0x53')][_0x302e10];var _0x1d0804=_0x91a27d[_0xb05c('0x65')]();_0x1d0804[_0xb05c('0x25')]('ut.UserId\x20=\x20?',_0xcdaebf['id']);_0x5a49ac[_0xb05c('0x66')](db['sequelize']['query'](_0x1d0804[_0xb05c('0x67')](),{'type':db[_0xb05c('0x56')][_0xb05c('0x68')][_0xb05c('0x69')]})[_0xb05c('0x15')](function(_0x3c7c00){if(_0x3c7c00[_0xb05c('0x3c')]===0x1){return _0xcdaebf['id'];}else{var _0x87213b=_['every'](_[_0xb05c('0x1e')](_0x3c7c00,_0xb05c('0x6a')),function(_0x25e008){return _[_0xb05c('0x6b')](_0x520c6b,_0x25e008);});if(_0x87213b){return _0xcdaebf['id'];}}}));}}return BPromise[_0xb05c('0x6c')](_0x5a49ac)[_0xb05c('0x15')](function(_0x368fbc){_0x129c02=_(_0x129c02)[_0xb05c('0x6d')](_0x368fbc)[_0xb05c('0x6e')]()[_0xb05c('0x6f')]();return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x498cf8[_0xb05c('0x2a')]['id']}})['then'](function(_0xd711c9){return db['sequelize'][_0xb05c('0x57')](function(_0xf30f14){return _0xd711c9[_0xb05c('0x5d')](_0x498cf8[_0xb05c('0x27')][_0xb05c('0x52')],{'transaction':_0xf30f14})[_0xb05c('0x15')](function(){if(!_[_0xb05c('0x70')](_0x129c02)){return _0xd711c9[_0xb05c('0x71')](_0x129c02,{'transaction':_0xf30f14});}})[_0xb05c('0x15')](function(){_0x129c02[_0xb05c('0x5a')](function(_0x26094f){socket[_0xb05c('0x5b')]('userWhatsappQueue:remove',{'UserId':_0x26094f,'WhatsappQueueId':_0xd711c9['id']});});});});});});})[_0xb05c('0x15')](respondWithStatusCode(_0x9be55c,null))['catch'](handleError(_0x9be55c,null));};exports[_0xb05c('0x72')]=function(_0x205ae3,_0x4d4c8f){return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0x205ae3[_0xb05c('0x2a')]['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x4d4c8f,null))[_0xb05c('0x15')](function(_0x41c224){if(_0x41c224){return _0x41c224['addAgents'](_0x205ae3[_0xb05c('0x33')][_0xb05c('0x52')],_[_0xb05c('0x73')](_0x205ae3[_0xb05c('0x33')],[_0xb05c('0x52'),'id'])||{})[_0xb05c('0x74')](function(_0xbc1c9b){for(var _0x5c8f2b=0x0;_0x5c8f2b<_0x205ae3[_0xb05c('0x33')][_0xb05c('0x52')]['length'];_0x5c8f2b+=0x1){socket[_0xb05c('0x5b')](_0xb05c('0x5c'),{'UserId':Number(_0x205ae3[_0xb05c('0x33')][_0xb05c('0x52')][_0x5c8f2b]),'WhatsappQueueId':Number(_0x205ae3[_0xb05c('0x2a')]['id'])});}return _0xbc1c9b;});}})[_0xb05c('0x15')](respondWithResult(_0x4d4c8f,null))['catch'](handleError(_0x4d4c8f,null));};exports[_0xb05c('0x71')]=function(_0xf5d630,_0x15b7ca){return db[_0xb05c('0x1f')][_0xb05c('0x32')]({'where':{'id':_0xf5d630['params']['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x15b7ca,null))['then'](function(_0x59af8d){if(_0x59af8d){return _0x59af8d[_0xb05c('0x71')](_0xf5d630[_0xb05c('0x27')]['ids'])[_0xb05c('0x15')](function(){if(_[_0xb05c('0x75')](_0xf5d630[_0xb05c('0x27')][_0xb05c('0x52')])){for(var _0x1e57ff=0x0;_0x1e57ff<_0xf5d630[_0xb05c('0x27')]['ids'][_0xb05c('0x3c')];_0x1e57ff+=0x1){socket[_0xb05c('0x5b')](_0xb05c('0x76'),{'UserId':Number(_0xf5d630[_0xb05c('0x27')][_0xb05c('0x52')][_0x1e57ff]),'WhatsappQueueId':Number(_0xf5d630[_0xb05c('0x2a')]['id'])});}}else{socket['emit'](_0xb05c('0x76'),{'UserId':Number(_0xf5d630['query']['ids']),'WhatsappQueueId':Number(_0xf5d630[_0xb05c('0x2a')]['id'])});}});}})['then'](respondWithStatusCode(_0x15b7ca,null))[_0xb05c('0x28')](handleError(_0x15b7ca,null));};exports['getAgents']=function(_0x38929b,_0x15201a){var _0x295849={};var _0x16d92b={};var _0x1004ca;var _0x746083;return db[_0xb05c('0x1f')][_0xb05c('0x77')]({'where':{'id':_0x38929b[_0xb05c('0x2a')]['id']}})[_0xb05c('0x15')](handleEntityNotFound(_0x15201a,null))['then'](function(_0x81ea4c){if(_0x81ea4c){_0x1004ca=_0x81ea4c;_0x16d92b[_0xb05c('0x2b')]=_[_0xb05c('0x2c')](db[_0xb05c('0x43')][_0xb05c('0x20')]);_0x16d92b['query']=_[_0xb05c('0x2c')](_0x38929b[_0xb05c('0x27')]);_0x16d92b['filters']=_['intersection'](_0x16d92b[_0xb05c('0x2b')],_0x16d92b[_0xb05c('0x27')]);_0x295849['attributes']=_[_0xb05c('0x2f')](_0x16d92b[_0xb05c('0x2b')],qs['fields'](_0x38929b[_0xb05c('0x27')][_0xb05c('0x30')]));_0x295849['attributes']=_0x295849[_0xb05c('0x2e')][_0xb05c('0x3c')]?_0x295849[_0xb05c('0x2e')]:_0x16d92b[_0xb05c('0x2b')];_0x295849[_0xb05c('0x78')]=qs[_0xb05c('0x3f')](_0x38929b[_0xb05c('0x27')][_0xb05c('0x3f')]);_0x295849[_0xb05c('0x25')]=qs['filters'](_[_0xb05c('0x50')](_0x38929b[_0xb05c('0x27')],_0x16d92b[_0xb05c('0x2d')]));if(_0x38929b['query'][_0xb05c('0x40')]){_0x295849[_0xb05c('0x25')]=_[_0xb05c('0x31')](_0x295849[_0xb05c('0x25')],{'$or':_[_0xb05c('0x1e')](_0x295849[_0xb05c('0x2e')],function(_0x1feec1){var _0x5c1fc8={};_0x5c1fc8[_0x1feec1]={'$like':'%'+_0x38929b[_0xb05c('0x27')]['filter']+'%'};return _0x5c1fc8;})});}_0x295849=_[_0xb05c('0x31')]({},_0x295849,_0x38929b[_0xb05c('0x41')]);return _0x1004ca[_0xb05c('0x79')](_0x295849);}})[_0xb05c('0x15')](function(_0x3fa81c){if(_0x3fa81c){_0x746083=_0x3fa81c[_0xb05c('0x3c')];if(!_0x38929b[_0xb05c('0x27')][_0xb05c('0x3d')](_0xb05c('0x3e'))){_0x295849['limit']=qs[_0xb05c('0x11')](_0x38929b[_0xb05c('0x27')][_0xb05c('0x11')]);_0x295849[_0xb05c('0xf')]=qs[_0xb05c('0xf')](_0x38929b['query'][_0xb05c('0xf')]);}return _0x1004ca['getAgents'](_0x295849);}})[_0xb05c('0x15')](function(_0x1b45ec){if(_0x1b45ec){return _0x1b45ec?{'count':_0x746083,'rows':_0x1b45ec}:null;}})['then'](respondWithResult(_0x15201a,null))['catch'](handleError(_0x15201a,null));}; \ No newline at end of file +var _0x2133=['agent','whatsappPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','nolimit','addTeams','ids','Agents','interface','sequelize','each','forEach','emit','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','toString','SELECT','every','TeamId','all','compact','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','userWhatsappQueue:save','getAgents','hasOwnProperty','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','then','destroy','get','WhatsappQueues','UserProfileResource','name','index','map','WhatsappQueue','rawAttributes','type','key','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','error','describe','findOne','UserWhatsappQueue','order','sort','where','pick','WhatsappQueueId','filter','User'];(function(_0x19d988,_0x294a0f){var _0x5f2138=function(_0x2a142c){while(--_0x2a142c){_0x19d988['push'](_0x19d988['shift']());}};_0x5f2138(++_0x294a0f);}(_0x2133,0x96));var _0x3213=function(_0x5ba0b2,_0x8563d4){_0x5ba0b2=_0x5ba0b2-0x0;var _0x209397=_0x2133[_0x5ba0b2];return _0x209397;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x3213('0x0'));var squel=require(_0x3213('0x1'));var Redis=require(_0x3213('0x2'));var qs=require(_0x3213('0x3'));var logger=require(_0x3213('0x4'))(_0x3213('0x5'));var config=require(_0x3213('0x6'));var db=require(_0x3213('0x7'))['db'];config[_0x3213('0x8')]=_[_0x3213('0x9')](config[_0x3213('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x3213('0xa'))(new Redis(config['redis']));require('./whatsappQueue.socket')[_0x3213('0xb')](socket);function respondWithStatusCode(_0x23c899,_0x2f438a){_0x2f438a=_0x2f438a||0xcc;return function(_0x860c6c){if(_0x860c6c){return _0x23c899[_0x3213('0xc')](_0x2f438a);}return _0x23c899[_0x3213('0xd')](_0x2f438a)[_0x3213('0xe')]();};}function respondWithResult(_0x57bf7d,_0xa92b55){_0xa92b55=_0xa92b55||0xc8;return function(_0x2f564b){if(_0x2f564b){return _0x57bf7d[_0x3213('0xd')](_0xa92b55)['json'](_0x2f564b);}};}function respondWithFilteredResult(_0x30b7e3,_0x3f466e){return function(_0xccc64f){if(_0xccc64f){var _0x1d8d6b=typeof _0x3f466e['offset']==='undefined'&&typeof _0x3f466e['limit']===_0x3213('0xf');var _0x3a7409=_0xccc64f[_0x3213('0x10')];var _0x407b48=_0x1d8d6b?0x0:_0x3f466e[_0x3213('0x11')];var _0x48ff5b=_0x1d8d6b?_0xccc64f[_0x3213('0x10')]:_0x3f466e[_0x3213('0x11')]+_0x3f466e[_0x3213('0x12')];var _0x45fc89;if(_0x48ff5b>=_0x3a7409){_0x48ff5b=_0x3a7409;_0x45fc89=0xc8;}else{_0x45fc89=0xce;}_0x30b7e3[_0x3213('0xd')](_0x45fc89);return _0x30b7e3[_0x3213('0x13')](_0x3213('0x14'),_0x407b48+'-'+_0x48ff5b+'/'+_0x3a7409)['json'](_0xccc64f);}return null;};}function saveUpdates(_0x506200){return function(_0x199f3b){if(_0x199f3b){return _0x199f3b['update'](_0x506200)[_0x3213('0x15')](function(_0x30d5e5){return _0x30d5e5;});}return null;};}function removeEntity(_0x503d28){return function(_0x35824e){if(_0x35824e){return _0x35824e[_0x3213('0x16')]()[_0x3213('0x15')](function(){var _0x804633=_0x35824e[_0x3213('0x17')]({'plain':!![]});var _0x4a7b33=_0x3213('0x18');return db[_0x3213('0x19')]['destroy']({'where':{'type':_0x4a7b33,'resourceId':_0x804633['id']}})[_0x3213('0x15')](function(){return _0x35824e;});})[_0x3213('0x15')](function(){_0x503d28[_0x3213('0xd')](0xcc)[_0x3213('0xe')]();});}};}function handleEntityNotFound(_0x4b2435){return function(_0x3b3379){if(!_0x3b3379){_0x4b2435['sendStatus'](0x194);}return _0x3b3379;};}function handleError(_0x1781d9,_0x255e03){_0x255e03=_0x255e03||0x1f4;return function(_0x1be6e8){logger['error'](_0x1be6e8['stack']);if(_0x1be6e8[_0x3213('0x1a')]){delete _0x1be6e8[_0x3213('0x1a')];}_0x1781d9[_0x3213('0xd')](_0x255e03)['send'](_0x1be6e8);};}exports[_0x3213('0x1b')]=function(_0x1e77ef,_0x2c90bd){var _0x2e8c90={};var _0x169ad8={'count':0x0,'rows':[]};var _0x23c388=_[_0x3213('0x1c')](db[_0x3213('0x1d')][_0x3213('0x1e')],function(_0x3104a5){return{'name':_0x3104a5['fieldName'],'type':_0x3104a5[_0x3213('0x1f')][_0x3213('0x20')]};});_0x2e8c90=qs['getOptions'](_0x23c388,_0x1e77ef);var _0x3fffc4={'where':_0x2e8c90['where']};return db['WhatsappQueue'][_0x3213('0x10')](_0x3fffc4)[_0x3213('0x15')](function(_0x140221){_0x169ad8[_0x3213('0x10')]=_0x140221;_0x2e8c90[_0x3213('0x21')]=qs[_0x3213('0x21')](_0x1e77ef[_0x3213('0x22')]);return db['WhatsappQueue'][_0x3213('0x23')](_0x2e8c90);})[_0x3213('0x15')](function(_0x3ea5f4){_0x169ad8[_0x3213('0x24')]=_0x3ea5f4;return _0x169ad8;})['then'](respondWithFilteredResult(_0x2c90bd,_0x2e8c90))['catch'](handleError(_0x2c90bd,null));};exports[_0x3213('0x25')]=function(_0x3d899d,_0x4e6eea){var _0x544514={'raw':!![],'where':{'id':_0x3d899d[_0x3213('0x26')]['id']}},_0x1fde27={};_0x1fde27[_0x3213('0x27')]=_[_0x3213('0x28')](db[_0x3213('0x1d')]['rawAttributes']);_0x1fde27[_0x3213('0x22')]=_[_0x3213('0x28')](_0x3d899d[_0x3213('0x22')]);_0x1fde27[_0x3213('0x29')]=_[_0x3213('0x2a')](_0x1fde27[_0x3213('0x27')],_0x1fde27[_0x3213('0x22')]);_0x544514[_0x3213('0x2b')]=_['intersection'](_0x1fde27[_0x3213('0x27')],qs[_0x3213('0x2c')](_0x3d899d[_0x3213('0x22')][_0x3213('0x2c')]));_0x544514[_0x3213('0x2b')]=_0x544514[_0x3213('0x2b')][_0x3213('0x2d')]?_0x544514[_0x3213('0x2b')]:_0x1fde27[_0x3213('0x27')];if(_0x3d899d[_0x3213('0x22')][_0x3213('0x2e')]){_0x544514[_0x3213('0x21')]=[{'all':!![]}];}_0x544514=_[_0x3213('0x2f')]({},_0x544514,_0x3d899d[_0x3213('0x30')]);return db[_0x3213('0x1d')][_0x3213('0x31')](_0x544514)[_0x3213('0x15')](handleEntityNotFound(_0x4e6eea,null))[_0x3213('0x15')](respondWithResult(_0x4e6eea,null))[_0x3213('0x32')](handleError(_0x4e6eea,null));};exports[_0x3213('0x33')]=function(_0x4d2ac8,_0x5e5c12){return db[_0x3213('0x1d')][_0x3213('0x33')](_0x4d2ac8[_0x3213('0x34')],{})[_0x3213('0x15')](function(_0x317e0c){var _0x24ba25=_0x4d2ac8['user']['get']({'plain':!![]});if(!_0x24ba25)throw new Error(_0x3213('0x35'));if(_0x24ba25[_0x3213('0x36')]===_0x3213('0x37')){var _0x26e8ff=_0x317e0c[_0x3213('0x17')]({'plain':!![]});var _0x32de0d=_0x3213('0x18');return db['UserProfileSection'][_0x3213('0x31')]({'where':{'name':_0x32de0d,'userProfileId':_0x24ba25['userProfileId']},'raw':!![]})[_0x3213('0x15')](function(_0x46a76c){if(_0x46a76c&&_0x46a76c[_0x3213('0x38')]===0x0){return db[_0x3213('0x19')]['create']({'name':_0x26e8ff[_0x3213('0x1a')],'resourceId':_0x26e8ff['id'],'type':_0x46a76c[_0x3213('0x1a')],'sectionId':_0x46a76c['id']},{})[_0x3213('0x15')](function(){return _0x317e0c;});}else{return _0x317e0c;}})[_0x3213('0x32')](function(_0x5b0b17){logger[_0x3213('0x39')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5b0b17);throw _0x5b0b17;});}return _0x317e0c;})[_0x3213('0x15')](respondWithResult(_0x5e5c12,0xc9))['catch'](handleError(_0x5e5c12,null));};exports['update']=function(_0x41d236,_0x2cc66c){if(_0x41d236['body']['id']){delete _0x41d236[_0x3213('0x34')]['id'];}return db['WhatsappQueue']['find']({'where':{'id':_0x41d236[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x2cc66c,null))['then'](saveUpdates(_0x41d236['body'],null))[_0x3213('0x15')](respondWithResult(_0x2cc66c,null))[_0x3213('0x32')](handleError(_0x2cc66c,null));};exports[_0x3213('0x16')]=function(_0x2dc0e7,_0x4963dd){return db[_0x3213('0x1d')][_0x3213('0x31')]({'where':{'id':_0x2dc0e7['params']['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x4963dd,null))[_0x3213('0x15')](removeEntity(_0x4963dd,null))[_0x3213('0x32')](handleError(_0x4963dd,null));};exports[_0x3213('0x3a')]=function(_0x2c8b50,_0x47cab9){return db[_0x3213('0x1d')]['describe']()[_0x3213('0x15')](respondWithResult(_0x47cab9,null))[_0x3213('0x32')](handleError(_0x47cab9,null));};exports['getMembers']=function(_0xb2967e,_0x506eee){var _0x43176a={'raw':!![],'where':{}},_0xce23e0={},_0x25909b;return db[_0x3213('0x1d')][_0x3213('0x3b')]({'where':{'id':_0xb2967e['params']['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x506eee,null))[_0x3213('0x15')](function(_0x22d5d5){if(_0x22d5d5){_0x25909b=_0x22d5d5[_0x3213('0x17')]({'plain':!![]});_0xce23e0[_0x3213('0x27')]=_[_0x3213('0x28')](db[_0x3213('0x3c')][_0x3213('0x1e')]);_0xce23e0[_0x3213('0x22')]=_[_0x3213('0x28')](_0xb2967e[_0x3213('0x22')]);_0xce23e0[_0x3213('0x29')]=_[_0x3213('0x2a')](_0xce23e0[_0x3213('0x27')],_0xce23e0[_0x3213('0x22')]);_0x43176a['attributes']=_[_0x3213('0x2a')](_0xce23e0[_0x3213('0x27')],qs[_0x3213('0x2c')](_0xb2967e['query'][_0x3213('0x2c')]));_0x43176a[_0x3213('0x2b')]=_0x43176a[_0x3213('0x2b')][_0x3213('0x2d')]?_0x43176a[_0x3213('0x2b')]:_0xce23e0[_0x3213('0x27')];if(!_0xb2967e[_0x3213('0x22')]['hasOwnProperty']('nolimit')){_0x43176a[_0x3213('0x12')]=qs['limit'](_0xb2967e[_0x3213('0x22')][_0x3213('0x12')]);_0x43176a[_0x3213('0x11')]=qs[_0x3213('0x11')](_0xb2967e[_0x3213('0x22')]['offset']);}_0x43176a[_0x3213('0x3d')]=qs['sort'](_0xb2967e[_0x3213('0x22')][_0x3213('0x3e')]);_0x43176a[_0x3213('0x3f')]=qs[_0x3213('0x29')](_[_0x3213('0x40')](_0xb2967e[_0x3213('0x22')],_0xce23e0[_0x3213('0x29')]));_0x43176a[_0x3213('0x3f')][_0x3213('0x41')]=_0x22d5d5['id'];if(_0xb2967e[_0x3213('0x22')][_0x3213('0x42')]){_0x43176a[_0x3213('0x3f')]=_[_0x3213('0x2f')](_0x43176a[_0x3213('0x3f')],{'$or':_[_0x3213('0x1c')](_0x43176a['attributes'],function(_0x2c268c){var _0xbd69fe={};_0xbd69fe[_0x2c268c]={'$like':'%'+_0xb2967e[_0x3213('0x22')][_0x3213('0x42')]+'%'};return _0xbd69fe;})});}_0x43176a=_['merge']({},_0x43176a,_0xb2967e[_0x3213('0x30')]);return db['UserWhatsappQueue'][_0x3213('0x23')](_0x43176a);}})[_0x3213('0x15')](function(_0x179ece){if(_0x179ece){return db[_0x3213('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x179ece,'UserId'),'role':_0x3213('0x44')},'attributes':['id',_0x3213('0x1a'),_0x3213('0x45'),_0x3213('0x46'),'createdAt']});}})[_0x3213('0x15')](function(_0x1cd5a9){if(_0x1cd5a9){return{'count':_0x1cd5a9[_0x3213('0x10')],'rows':_[_0x3213('0x1c')](_0x1cd5a9['rows'],function(_0x322653){return{'membername':_0x322653['name'],'UserId':_0x322653['id'],'queue_name':_0x25909b[_0x3213('0x1a')],'WhatsappQueueId':_0x25909b['id'],'interface':util[_0x3213('0x47')](_0x3213('0x48'),_0x3213('0x49'),_0x322653[_0x3213('0x1a')]),'penalty':0x0,'paused':_0x322653['whatsappPause'],'createdAt':_0x322653[_0x3213('0x4a')],'updatedAt':_0x322653[_0x3213('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x506eee,_0x43176a))[_0x3213('0x32')](handleError(_0x506eee,null));};exports[_0x3213('0x4b')]=function(_0x3b1cea,_0x2b646c){var _0xd05418={};var _0x5306c7={};var _0x17c3f6;var _0x4242df;return db['WhatsappQueue'][_0x3213('0x3b')]({'where':{'id':_0x3b1cea['params']['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x2b646c,null))[_0x3213('0x15')](function(_0xfa4d52){if(_0xfa4d52){_0x17c3f6=_0xfa4d52;_0x5306c7[_0x3213('0x27')]=_['keys'](db[_0x3213('0x4c')]['rawAttributes']);_0x5306c7[_0x3213('0x22')]=_[_0x3213('0x28')](_0x3b1cea[_0x3213('0x22')]);_0x5306c7[_0x3213('0x29')]=_[_0x3213('0x2a')](_0x5306c7['model'],_0x5306c7[_0x3213('0x22')]);_0xd05418[_0x3213('0x2b')]=_[_0x3213('0x2a')](_0x5306c7[_0x3213('0x27')],qs[_0x3213('0x2c')](_0x3b1cea[_0x3213('0x22')][_0x3213('0x2c')]));_0xd05418[_0x3213('0x2b')]=_0xd05418['attributes'][_0x3213('0x2d')]?_0xd05418[_0x3213('0x2b')]:_0x5306c7[_0x3213('0x27')];_0xd05418[_0x3213('0x3d')]=qs[_0x3213('0x3e')](_0x3b1cea[_0x3213('0x22')][_0x3213('0x3e')]);_0xd05418['where']=qs[_0x3213('0x29')](_[_0x3213('0x40')](_0x3b1cea[_0x3213('0x22')],_0x5306c7[_0x3213('0x29')]));if(_0x3b1cea[_0x3213('0x22')][_0x3213('0x42')]){_0xd05418['where']=_[_0x3213('0x2f')](_0xd05418['where'],{'$or':_[_0x3213('0x1c')](_0xd05418['attributes'],function(_0x1137c1){var _0x5eafec={};_0x5eafec[_0x1137c1]={'$like':'%'+_0x3b1cea[_0x3213('0x22')][_0x3213('0x42')]+'%'};return _0x5eafec;})});}_0xd05418=_[_0x3213('0x2f')]({},_0xd05418,_0x3b1cea[_0x3213('0x30')]);return _0x17c3f6[_0x3213('0x4b')](_0xd05418);}})['then'](function(_0x557d09){if(_0x557d09){_0x4242df=_0x557d09['length'];if(!_0x3b1cea[_0x3213('0x22')]['hasOwnProperty'](_0x3213('0x4d'))){_0xd05418['limit']=qs[_0x3213('0x12')](_0x3b1cea[_0x3213('0x22')][_0x3213('0x12')]);_0xd05418[_0x3213('0x11')]=qs[_0x3213('0x11')](_0x3b1cea[_0x3213('0x22')]['offset']);}return _0x17c3f6[_0x3213('0x4b')](_0xd05418);}})['then'](function(_0x12a40d){if(_0x12a40d){return _0x12a40d?{'count':_0x4242df,'rows':_0x12a40d}:null;}})[_0x3213('0x15')](respondWithResult(_0x2b646c,null))[_0x3213('0x32')](handleError(_0x2b646c,null));};exports[_0x3213('0x4e')]=function(_0x428830,_0x37d876){var _0x3ef30f=_0x428830[_0x3213('0x34')][_0x3213('0x4f')];return db[_0x3213('0x4c')][_0x3213('0x23')]({'where':{'id':_0x3ef30f},'attributes':['id'],'include':[{'model':db[_0x3213('0x43')],'as':_0x3213('0x50'),'attributes':['id',_0x3213('0x1a'),'online','voicePause',_0x3213('0x51')],'raw':!![]}]})[_0x3213('0x15')](function(_0x5f5b42){if(_0x5f5b42){var _0x2de1c8=_['flatMap'](_0x5f5b42,function(_0xeb3759){var _0x1fcc0a=_0xeb3759[_0x3213('0x17')]({'plain':!![]});return _0x1fcc0a['Agents'];});return db['WhatsappQueue'][_0x3213('0x31')]({'where':{'id':_0x428830[_0x3213('0x26')]['id']}})['then'](function(_0x405b47){return db[_0x3213('0x52')]['transaction'](function(_0x45d24a){return _0x405b47[_0x3213('0x4e')](_0x3ef30f,{'transaction':_0x45d24a})[_0x3213('0x15')](function(){return BPromise[_0x3213('0x53')](_0x2de1c8,function(_0x5ebb32){return db['UserWhatsappQueue']['findOrCreate']({'where':{'UserId':_0x5ebb32['id'],'WhatsappQueueId':_0x428830[_0x3213('0x26')]['id']},'transaction':_0x45d24a});});})[_0x3213('0x15')](function(){_0x2de1c8[_0x3213('0x54')](function(_0x29a742){socket[_0x3213('0x55')]('userWhatsappQueue:save',{'UserId':_0x29a742['id'],'WhatsappQueueId':_0x405b47['id']});});});});});}})[_0x3213('0x15')](respondWithStatusCode(_0x37d876,null))[_0x3213('0x32')](handleError(_0x37d876,null));};exports[_0x3213('0x56')]=function(_0x1a3f07,_0x377a99){return db[_0x3213('0x4c')][_0x3213('0x23')]({'where':{'id':_0x1a3f07[_0x3213('0x22')][_0x3213('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x3213('0x43')],'as':_0x3213('0x50'),'attributes':['id'],'raw':!![]}]})[_0x3213('0x15')](handleEntityNotFound(_0x377a99,null))[_0x3213('0x15')](function(_0x39c965){var _0x2c760d=_['map'](_0x39c965,'id');var _0x130391=[];var _0x48571b=[];var _0x4bfa6a=squel[_0x3213('0x57')]();_0x4bfa6a[_0x3213('0x58')](_0x3213('0x59'))[_0x3213('0x5a')](_0x3213('0x5b'),'tq')['join'](_0x3213('0x5c'),'ut',_0x3213('0x5d'))['where']('WhatsappQueueId\x20=\x20?',_0x1a3f07[_0x3213('0x26')]['id']);for(var _0x2705b2=0x0;_0x2705b2<_0x39c965['length'];_0x2705b2+=0x1){let _0x208bfa=_0x39c965[_0x2705b2];for(var _0x3e2ba4=0x0;_0x3e2ba4<_0x208bfa[_0x3213('0x50')][_0x3213('0x2d')];_0x3e2ba4+=0x1){let _0x53fe2a=_0x208bfa[_0x3213('0x50')][_0x3e2ba4];var _0x18b73b=_0x4bfa6a['clone']();_0x18b73b[_0x3213('0x3f')]('ut.UserId\x20=\x20?',_0x53fe2a['id']);_0x48571b[_0x3213('0x5e')](db[_0x3213('0x52')]['query'](_0x18b73b[_0x3213('0x5f')](),{'type':db['sequelize']['QueryTypes'][_0x3213('0x60')]})[_0x3213('0x15')](function(_0x26fd43){if(_0x26fd43['length']===0x1){return _0x53fe2a['id'];}else{var _0x3040e2=_[_0x3213('0x61')](_['map'](_0x26fd43,_0x3213('0x62')),function(_0x39ce0e){return _['includes'](_0x2c760d,_0x39ce0e);});if(_0x3040e2){return _0x53fe2a['id'];}}}));}}return BPromise[_0x3213('0x63')](_0x48571b)[_0x3213('0x15')](function(_0x23b095){_0x130391=_(_0x130391)['union'](_0x23b095)[_0x3213('0x64')]()['value']();return db[_0x3213('0x1d')]['find']({'where':{'id':_0x1a3f07[_0x3213('0x26')]['id']}})['then'](function(_0x328b0a){return db[_0x3213('0x52')]['transaction'](function(_0x5e7e11){return _0x328b0a[_0x3213('0x56')](_0x1a3f07[_0x3213('0x22')]['ids'],{'transaction':_0x5e7e11})[_0x3213('0x15')](function(){if(!_[_0x3213('0x65')](_0x130391)){return _0x328b0a[_0x3213('0x66')](_0x130391,{'transaction':_0x5e7e11});}})[_0x3213('0x15')](function(){_0x130391['forEach'](function(_0xe67f3e){socket[_0x3213('0x55')](_0x3213('0x67'),{'UserId':_0xe67f3e,'WhatsappQueueId':_0x328b0a['id']});});});});});});})[_0x3213('0x15')](respondWithStatusCode(_0x377a99,null))['catch'](handleError(_0x377a99,null));};exports[_0x3213('0x68')]=function(_0x9828d1,_0x18bb48){return db[_0x3213('0x1d')]['find']({'where':{'id':_0x9828d1[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x18bb48,null))[_0x3213('0x15')](function(_0xd07856){if(_0xd07856){return _0xd07856[_0x3213('0x68')](_0x9828d1[_0x3213('0x34')][_0x3213('0x4f')],_[_0x3213('0x69')](_0x9828d1[_0x3213('0x34')],['ids','id'])||{})['spread'](function(_0x5b8ab0){for(var _0x337672=0x0;_0x337672<_0x9828d1[_0x3213('0x34')]['ids']['length'];_0x337672+=0x1){socket[_0x3213('0x55')](_0x3213('0x6a'),{'UserId':Number(_0x9828d1[_0x3213('0x34')][_0x3213('0x4f')][_0x337672]),'WhatsappQueueId':Number(_0x9828d1[_0x3213('0x26')]['id'])});}return _0x5b8ab0;});}})[_0x3213('0x15')](respondWithResult(_0x18bb48,null))['catch'](handleError(_0x18bb48,null));};exports[_0x3213('0x66')]=function(_0x323ea3,_0x39bd26){return db['WhatsappQueue'][_0x3213('0x31')]({'where':{'id':_0x323ea3[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x39bd26,null))['then'](function(_0x3aa589){if(_0x3aa589){return _0x3aa589[_0x3213('0x66')](_0x323ea3['query'][_0x3213('0x4f')])[_0x3213('0x15')](function(){if(_['isArray'](_0x323ea3[_0x3213('0x22')][_0x3213('0x4f')])){for(var _0x39e45b=0x0;_0x39e45b<_0x323ea3[_0x3213('0x22')][_0x3213('0x4f')][_0x3213('0x2d')];_0x39e45b+=0x1){socket[_0x3213('0x55')]('userWhatsappQueue:remove',{'UserId':Number(_0x323ea3['query'][_0x3213('0x4f')][_0x39e45b]),'WhatsappQueueId':Number(_0x323ea3['params']['id'])});}}else{socket[_0x3213('0x55')](_0x3213('0x67'),{'UserId':Number(_0x323ea3[_0x3213('0x22')]['ids']),'WhatsappQueueId':Number(_0x323ea3['params']['id'])});}});}})[_0x3213('0x15')](respondWithStatusCode(_0x39bd26,null))[_0x3213('0x32')](handleError(_0x39bd26,null));};exports[_0x3213('0x6b')]=function(_0x2b0f54,_0x37a75c){var _0x52b396={};var _0x2bbb9a={};var _0x901188;var _0x40c22f;return db['WhatsappQueue'][_0x3213('0x3b')]({'where':{'id':_0x2b0f54[_0x3213('0x26')]['id']}})[_0x3213('0x15')](handleEntityNotFound(_0x37a75c,null))['then'](function(_0x589720){if(_0x589720){_0x901188=_0x589720;_0x2bbb9a[_0x3213('0x27')]=_[_0x3213('0x28')](db[_0x3213('0x43')][_0x3213('0x1e')]);_0x2bbb9a[_0x3213('0x22')]=_[_0x3213('0x28')](_0x2b0f54['query']);_0x2bbb9a[_0x3213('0x29')]=_['intersection'](_0x2bbb9a[_0x3213('0x27')],_0x2bbb9a[_0x3213('0x22')]);_0x52b396[_0x3213('0x2b')]=_['intersection'](_0x2bbb9a[_0x3213('0x27')],qs[_0x3213('0x2c')](_0x2b0f54[_0x3213('0x22')][_0x3213('0x2c')]));_0x52b396[_0x3213('0x2b')]=_0x52b396[_0x3213('0x2b')][_0x3213('0x2d')]?_0x52b396[_0x3213('0x2b')]:_0x2bbb9a[_0x3213('0x27')];_0x52b396[_0x3213('0x3d')]=qs[_0x3213('0x3e')](_0x2b0f54[_0x3213('0x22')][_0x3213('0x3e')]);_0x52b396[_0x3213('0x3f')]=qs['filters'](_[_0x3213('0x40')](_0x2b0f54[_0x3213('0x22')],_0x2bbb9a['filters']));if(_0x2b0f54['query'][_0x3213('0x42')]){_0x52b396[_0x3213('0x3f')]=_[_0x3213('0x2f')](_0x52b396['where'],{'$or':_[_0x3213('0x1c')](_0x52b396['attributes'],function(_0x102fdf){var _0x10316c={};_0x10316c[_0x102fdf]={'$like':'%'+_0x2b0f54[_0x3213('0x22')][_0x3213('0x42')]+'%'};return _0x10316c;})});}_0x52b396=_[_0x3213('0x2f')]({},_0x52b396,_0x2b0f54[_0x3213('0x30')]);return _0x901188['getAgents'](_0x52b396);}})['then'](function(_0x441b6a){if(_0x441b6a){_0x40c22f=_0x441b6a[_0x3213('0x2d')];if(!_0x2b0f54[_0x3213('0x22')][_0x3213('0x6c')](_0x3213('0x4d'))){_0x52b396[_0x3213('0x12')]=qs[_0x3213('0x12')](_0x2b0f54[_0x3213('0x22')]['limit']);_0x52b396[_0x3213('0x11')]=qs[_0x3213('0x11')](_0x2b0f54[_0x3213('0x22')][_0x3213('0x11')]);}return _0x901188[_0x3213('0x6b')](_0x52b396);}})['then'](function(_0x2244c5){if(_0x2244c5){return _0x2244c5?{'count':_0x40c22f,'rows':_0x2244c5}:null;}})[_0x3213('0x15')](respondWithResult(_0x37a75c,null))[_0x3213('0x32')](handleError(_0x37a75c,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index acac76b..31b89c1 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 _0x2b9b=['events','../../mysqldb','WhatsappQueue','setMaxListeners','update','remove','emit','hook'];(function(_0x137b8d,_0x2e8545){var _0x527daf=function(_0x57f818){while(--_0x57f818){_0x137b8d['push'](_0x137b8d['shift']());}};_0x527daf(++_0x2e8545);}(_0x2b9b,0x110));var _0xb2b9=function(_0x3919d4,_0x22b207){_0x3919d4=_0x3919d4-0x0;var _0x285a31=_0x2b9b[_0x3919d4];return _0x285a31;};'use strict';var EventEmitter=require(_0xb2b9('0x0'));var WhatsappQueue=require(_0xb2b9('0x1'))['db'][_0xb2b9('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb2b9('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xb2b9('0x4'),'afterDestroy':_0xb2b9('0x5')};function emitEvent(_0x5b257d){return function(_0x1fd124,_0x385112,_0x299f65){WhatsappQueueEvents[_0xb2b9('0x6')](_0x5b257d+':'+_0x1fd124['id'],_0x1fd124);WhatsappQueueEvents[_0xb2b9('0x6')](_0x5b257d,_0x1fd124);_0x299f65(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0xb2b9('0x7')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file +var _0x2157=['events','../../mysqldb','WhatsappQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2157,0x96));var _0x7215=function(_0x4e7e3f,_0x2f149b){_0x4e7e3f=_0x4e7e3f-0x0;var _0x1ffc45=_0x2157[_0x4e7e3f];return _0x1ffc45;};'use strict';var EventEmitter=require(_0x7215('0x0'));var WhatsappQueue=require(_0x7215('0x1'))['db'][_0x7215('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x7215('0x3')](0x0);var events={'afterCreate':_0x7215('0x4'),'afterUpdate':_0x7215('0x5'),'afterDestroy':_0x7215('0x6')};function emitEvent(_0xc61a0e){return function(_0x37c174,_0x4cf262,_0x1927e7){WhatsappQueueEvents[_0x7215('0x7')](_0xc61a0e+':'+_0x37c174['id'],_0x37c174);WhatsappQueueEvents[_0x7215('0x7')](_0xc61a0e,_0x37c174);_0x1927e7(null);};}for(var e in events){if(events[_0x7215('0x8')](e)){var event=events[e];WhatsappQueue[_0x7215('0x9')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 46c63df..21bccf0 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 _0x8a9a=['./whatsappQueue.attributes','exports','define','whatsapp_queues','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3bb991,_0x5cbfa3){var _0x22103c=function(_0x422937){while(--_0x422937){_0x3bb991['push'](_0x3bb991['shift']());}};_0x22103c(++_0x5cbfa3);}(_0x8a9a,0x1a6));var _0xa8a9=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0x8a9a[_0x13e741];return _0x3f8bb3;};'use strict';var _=require(_0xa8a9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8a9('0x1'));var moment=require('moment');var BPromise=require(_0xa8a9('0x2'));var rp=require(_0xa8a9('0x3'));var fs=require('fs');var path=require(_0xa8a9('0x4'));var rimraf=require(_0xa8a9('0x5'));var config=require(_0xa8a9('0x6'));var attributes=require(_0xa8a9('0x7'));module[_0xa8a9('0x8')]=function(_0x1d5674,_0x220f1f){return _0x1d5674[_0xa8a9('0x9')]('WhatsappQueue',attributes,{'tableName':_0xa8a9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3b0=['../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x3a3495,_0x13f120){var _0xfd4b45=function(_0x4dccaa){while(--_0x4dccaa){_0x3a3495['push'](_0x3a3495['shift']());}};_0xfd4b45(++_0x13f120);}(_0xb3b0,0x1ce));var _0x0b3b=function(_0x358c57,_0x1add01){_0x358c57=_0x358c57-0x0;var _0x333dcd=_0xb3b0[_0x358c57];return _0x333dcd;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0b3b('0x0'))(_0x0b3b('0x1'));var moment=require(_0x0b3b('0x2'));var BPromise=require('bluebird');var rp=require(_0x0b3b('0x3'));var fs=require('fs');var path=require(_0x0b3b('0x4'));var rimraf=require(_0x0b3b('0x5'));var config=require(_0x0b3b('0x6'));var attributes=require(_0x0b3b('0x7'));module[_0x0b3b('0x8')]=function(_0x21c0d5,_0x2f7fce){return _0x21c0d5[_0x0b3b('0x9')](_0x0b3b('0xa'),attributes,{'tableName':_0x0b3b('0xb'),'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 cad27ca..262a51a 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 _0xe370=['then','request\x20sent','debug','error','WhatsappQueue,\x20%s,\x20%s','message','info','result','catch','WhatsappQueue','findAll','options','raw','where','include','model','attributes','map','GetWhatsappQueue','ShowWhatsappQueue','find','stringify','lodash','util','moment','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request'];(function(_0x4b401b,_0x2ac8d1){var _0x196abd=function(_0x983cc0){while(--_0x983cc0){_0x4b401b['push'](_0x4b401b['shift']());}};_0x196abd(++_0x2ac8d1);}(_0xe370,0x120));var _0x0e37=function(_0x1deb72,_0x3f6338){_0x1deb72=_0x1deb72-0x0;var _0x18bbdf=_0xe370[_0x1deb72];return _0x18bbdf;};'use strict';var _=require(_0x0e37('0x0'));var util=require(_0x0e37('0x1'));var moment=require(_0x0e37('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(_0x0e37('0x3'));var logger=require(_0x0e37('0x4'))('rpc');var config=require(_0x0e37('0x5'));var jayson=require(_0x0e37('0x6'));var client=jayson[_0x0e37('0x7')][_0x0e37('0x8')]({'port':0x232a});config['redis']=_[_0x0e37('0x9')](config[_0x0e37('0xa')],{'host':_0x0e37('0xb'),'port':0x18eb});var socket=require(_0x0e37('0xc'))(new Redis(config['redis']));require(_0x0e37('0xd'))[_0x0e37('0xe')](socket);function respondWithRpcPromise(_0xda6c28,_0x225073,_0x39b4bf){return new BPromise(function(_0x124bb7,_0xa6c144){return client[_0x0e37('0xf')](_0xda6c28,_0x39b4bf)[_0x0e37('0x10')](function(_0x426300){logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x225073,_0x0e37('0x11'));logger[_0x0e37('0x12')]('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x225073,_0x0e37('0x11'),JSON['stringify'](_0x426300));if(_0x426300[_0x0e37('0x13')]){if(_0x426300['error']['code']===0x1f4){logger[_0x0e37('0x13')](_0x0e37('0x14'),_0x225073,_0x426300[_0x0e37('0x13')]['message']);return _0xa6c144(_0x426300[_0x0e37('0x13')][_0x0e37('0x15')]);}logger[_0x0e37('0x13')](_0x0e37('0x14'),_0x225073,_0x426300[_0x0e37('0x13')]['message']);return _0x124bb7(_0x426300[_0x0e37('0x13')][_0x0e37('0x15')]);}else{logger[_0x0e37('0x16')](_0x0e37('0x14'),_0x225073,_0x0e37('0x11'));_0x124bb7(_0x426300[_0x0e37('0x17')][_0x0e37('0x15')]);}})[_0x0e37('0x18')](function(_0x1251b8){logger[_0x0e37('0x13')](_0x0e37('0x14'),_0x225073,_0x1251b8);_0xa6c144(_0x1251b8);});});}exports['GetWhatsappQueue']=function(_0x4496e2){var _0x1da8b7=this;return new Promise(function(_0x5171f5,_0x6e2679){return db[_0x0e37('0x19')][_0x0e37('0x1a')]({'raw':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')][_0x0e37('0x1c')]===undefined?!![]:![]:!![],'where':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')][_0x0e37('0x1d')]||null:null,'attributes':_0x4496e2['options']?_0x4496e2['options']['attributes']||null:null,'limit':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')]['limit']||null:null,'include':_0x4496e2[_0x0e37('0x1b')]?_0x4496e2[_0x0e37('0x1b')][_0x0e37('0x1e')]?_['map'](_0x4496e2['options'][_0x0e37('0x1e')],function(_0x192001){return{'model':db[_0x192001[_0x0e37('0x1f')]],'as':_0x192001['as'],'attributes':_0x192001[_0x0e37('0x20')],'include':_0x192001[_0x0e37('0x1e')]?_[_0x0e37('0x21')](_0x192001['include'],function(_0x39f6f4){return{'model':db[_0x39f6f4['model']],'as':_0x39f6f4['as'],'attributes':_0x39f6f4['attributes'],'include':_0x39f6f4[_0x0e37('0x1e')]?_['map'](_0x39f6f4['include'],function(_0xdffc49){return{'model':db[_0xdffc49[_0x0e37('0x1f')]],'as':_0xdffc49['as'],'attributes':_0xdffc49['attributes']};}):[]};}):[]};}):[]:[]})[_0x0e37('0x10')](function(_0x481cf6){logger[_0x0e37('0x16')](_0x0e37('0x22'),_0x4496e2);logger['debug']('GetWhatsappQueue',_0x4496e2,JSON['stringify'](_0x481cf6));_0x5171f5(_0x481cf6);})[_0x0e37('0x18')](function(_0x1b193c){logger[_0x0e37('0x13')]('GetWhatsappQueue',_0x1b193c[_0x0e37('0x15')],_0x4496e2);_0x6e2679(_0x1da8b7[_0x0e37('0x13')](0x1f4,_0x1b193c[_0x0e37('0x15')]));});});};exports[_0x0e37('0x23')]=function(_0x132b8a){var _0xad5963=this;return new Promise(function(_0xc8bb70,_0x432f3e){return db[_0x0e37('0x19')][_0x0e37('0x24')]({'raw':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a[_0x0e37('0x1b')][_0x0e37('0x1c')]===undefined?!![]:![]:!![],'where':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a[_0x0e37('0x1b')]['where']||null:null,'attributes':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a['options'][_0x0e37('0x20')]||null:null,'include':_0x132b8a[_0x0e37('0x1b')]?_0x132b8a[_0x0e37('0x1b')][_0x0e37('0x1e')]?_['map'](_0x132b8a['options'][_0x0e37('0x1e')],function(_0x457527){return{'model':db[_0x457527[_0x0e37('0x1f')]],'as':_0x457527['as'],'attributes':_0x457527[_0x0e37('0x20')],'include':_0x457527[_0x0e37('0x1e')]?_[_0x0e37('0x21')](_0x457527['include'],function(_0x17e048){return{'model':db[_0x17e048[_0x0e37('0x1f')]],'as':_0x17e048['as'],'attributes':_0x17e048[_0x0e37('0x20')],'include':_0x17e048[_0x0e37('0x1e')]?_['map'](_0x17e048['include'],function(_0x46e90e){return{'model':db[_0x46e90e['model']],'as':_0x46e90e['as'],'attributes':_0x46e90e[_0x0e37('0x20')]};}):[]};}):[]};}):[]:[]})[_0x0e37('0x10')](function(_0x3fac5f){logger[_0x0e37('0x16')](_0x0e37('0x23'),_0x132b8a);logger[_0x0e37('0x12')](_0x0e37('0x23'),_0x132b8a,JSON[_0x0e37('0x25')](_0x3fac5f));_0xc8bb70(_0x3fac5f);})[_0x0e37('0x18')](function(_0x381c8e){logger[_0x0e37('0x13')](_0x0e37('0x23'),_0x381c8e[_0x0e37('0x15')],_0x132b8a);_0x432f3e(_0xad5963[_0x0e37('0x13')](0x1f4,_0x381c8e[_0x0e37('0x15')]));});});}; \ No newline at end of file +var _0x9a28=['./whatsappQueue.socket','register','request','then','info','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','WhatsappQueue,\x20%s,\x20%s','message','catch','GetWhatsappQueue','findAll','options','raw','where','include','map','model','attributes','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x29f699,_0x5ba40e){var _0x5e4b51=function(_0x5c4a27){while(--_0x5c4a27){_0x29f699['push'](_0x29f699['shift']());}};_0x5e4b51(++_0x5ba40e);}(_0x9a28,0xb5));var _0x89a2=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x9a28[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x89a2('0x0'));var util=require(_0x89a2('0x1'));var moment=require(_0x89a2('0x2'));var BPromise=require(_0x89a2('0x3'));var rs=require(_0x89a2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x89a2('0x5'));var logger=require(_0x89a2('0x6'))(_0x89a2('0x7'));var config=require(_0x89a2('0x8'));var jayson=require(_0x89a2('0x9'));var client=jayson[_0x89a2('0xa')]['http']({'port':0x232a});config['redis']=_[_0x89a2('0xb')](config[_0x89a2('0xc')],{'host':_0x89a2('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x89a2('0xe'))[_0x89a2('0xf')](socket);function respondWithRpcPromise(_0x78a057,_0x1f66a8,_0x5da43e){return new BPromise(function(_0x16cd52,_0x1d2f81){return client[_0x89a2('0x10')](_0x78a057,_0x5da43e)[_0x89a2('0x11')](function(_0x273357){logger[_0x89a2('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x1f66a8,_0x89a2('0x13'));logger[_0x89a2('0x14')](_0x89a2('0x15'),_0x1f66a8,_0x89a2('0x13'),JSON[_0x89a2('0x16')](_0x273357));if(_0x273357['error']){if(_0x273357['error'][_0x89a2('0x17')]===0x1f4){logger[_0x89a2('0x18')](_0x89a2('0x19'),_0x1f66a8,_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);return _0x1d2f81(_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);}logger['error'](_0x89a2('0x19'),_0x1f66a8,_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);return _0x16cd52(_0x273357[_0x89a2('0x18')][_0x89a2('0x1a')]);}else{logger['info']('WhatsappQueue,\x20%s,\x20%s',_0x1f66a8,_0x89a2('0x13'));_0x16cd52(_0x273357['result']['message']);}})[_0x89a2('0x1b')](function(_0x1b91bd){logger[_0x89a2('0x18')](_0x89a2('0x19'),_0x1f66a8,_0x1b91bd);_0x1d2f81(_0x1b91bd);});});}exports[_0x89a2('0x1c')]=function(_0x132e0d){var _0x2a533c=this;return new Promise(function(_0x1db0f4,_0x4d89f8){return db['WhatsappQueue'][_0x89a2('0x1d')]({'raw':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')][_0x89a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')][_0x89a2('0x20')]||null:null,'attributes':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d['options']['attributes']||null:null,'limit':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')]['limit']||null:null,'include':_0x132e0d[_0x89a2('0x1e')]?_0x132e0d[_0x89a2('0x1e')][_0x89a2('0x21')]?_[_0x89a2('0x22')](_0x132e0d['options'][_0x89a2('0x21')],function(_0x2c19b1){return{'model':db[_0x2c19b1[_0x89a2('0x23')]],'as':_0x2c19b1['as'],'attributes':_0x2c19b1[_0x89a2('0x24')],'include':_0x2c19b1['include']?_[_0x89a2('0x22')](_0x2c19b1['include'],function(_0x23bd1c){return{'model':db[_0x23bd1c[_0x89a2('0x23')]],'as':_0x23bd1c['as'],'attributes':_0x23bd1c[_0x89a2('0x24')],'include':_0x23bd1c[_0x89a2('0x21')]?_[_0x89a2('0x22')](_0x23bd1c[_0x89a2('0x21')],function(_0x33a3f0){return{'model':db[_0x33a3f0[_0x89a2('0x23')]],'as':_0x33a3f0['as'],'attributes':_0x33a3f0[_0x89a2('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x56cfca){logger[_0x89a2('0x12')]('GetWhatsappQueue',_0x132e0d);logger[_0x89a2('0x14')]('GetWhatsappQueue',_0x132e0d,JSON[_0x89a2('0x16')](_0x56cfca));_0x1db0f4(_0x56cfca);})[_0x89a2('0x1b')](function(_0x5a2af3){logger[_0x89a2('0x18')](_0x89a2('0x1c'),_0x5a2af3[_0x89a2('0x1a')],_0x132e0d);_0x4d89f8(_0x2a533c['error'](0x1f4,_0x5a2af3['message']));});});};exports[_0x89a2('0x25')]=function(_0x41eca3){var _0x8b6958=this;return new Promise(function(_0x26f638,_0x4f2605){return db['WhatsappQueue'][_0x89a2('0x26')]({'raw':_0x41eca3['options']?_0x41eca3['options'][_0x89a2('0x1f')]===undefined?!![]:![]:!![],'where':_0x41eca3[_0x89a2('0x1e')]?_0x41eca3['options']['where']||null:null,'attributes':_0x41eca3[_0x89a2('0x1e')]?_0x41eca3[_0x89a2('0x1e')][_0x89a2('0x24')]||null:null,'include':_0x41eca3[_0x89a2('0x1e')]?_0x41eca3[_0x89a2('0x1e')]['include']?_[_0x89a2('0x22')](_0x41eca3['options'][_0x89a2('0x21')],function(_0x477719){return{'model':db[_0x477719['model']],'as':_0x477719['as'],'attributes':_0x477719['attributes'],'include':_0x477719['include']?_[_0x89a2('0x22')](_0x477719[_0x89a2('0x21')],function(_0x7d871a){return{'model':db[_0x7d871a['model']],'as':_0x7d871a['as'],'attributes':_0x7d871a[_0x89a2('0x24')],'include':_0x7d871a[_0x89a2('0x21')]?_[_0x89a2('0x22')](_0x7d871a[_0x89a2('0x21')],function(_0x223f5e){return{'model':db[_0x223f5e[_0x89a2('0x23')]],'as':_0x223f5e['as'],'attributes':_0x223f5e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x123524){logger[_0x89a2('0x12')](_0x89a2('0x25'),_0x41eca3);logger['debug'](_0x89a2('0x25'),_0x41eca3,JSON['stringify'](_0x123524));_0x26f638(_0x123524);})[_0x89a2('0x1b')](function(_0x4ac713){logger[_0x89a2('0x18')](_0x89a2('0x25'),_0x4ac713[_0x89a2('0x1a')],_0x41eca3);_0x4f2605(_0x8b6958[_0x89a2('0x18')](0x1f4,_0x4ac713[_0x89a2('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index 9a0530a..71bb1fb 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 _0xe9f4=['removeListener','register','whatsappQueue:','./whatsappQueue.events','save','update'];(function(_0x10ae2a,_0x93f6bb){var _0x1a942a=function(_0x23c45c){while(--_0x23c45c){_0x10ae2a['push'](_0x10ae2a['shift']());}};_0x1a942a(++_0x93f6bb);}(_0xe9f4,0xf3));var _0x4e9f=function(_0x281d89,_0x46a6e4){_0x281d89=_0x281d89-0x0;var _0x2f6861=_0xe9f4[_0x281d89];return _0x2f6861;};'use strict';var WhatsappQueueEvents=require(_0x4e9f('0x0'));var events=[_0x4e9f('0x1'),'remove',_0x4e9f('0x2')];function createListener(_0x28700d,_0x230f36){return function(_0x28d1e4){_0x230f36['emit'](_0x28700d,_0x28d1e4);};}function removeListener(_0x4853b7,_0xdb0929){return function(){WhatsappQueueEvents[_0x4e9f('0x3')](_0x4853b7,_0xdb0929);};}exports[_0x4e9f('0x4')]=function(_0x55a834){for(var _0x4d92a1=0x0,_0x1f4570=events['length'];_0x4d92a1<_0x1f4570;_0x4d92a1++){var _0x182deb=events[_0x4d92a1];var _0x44ac07=createListener(_0x4e9f('0x5')+_0x182deb,_0x55a834);WhatsappQueueEvents['on'](_0x182deb,_0x44ac07);}}; \ No newline at end of file +var _0x82d3=['remove','update','emit','removeListener','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x556504,_0x3d5bb1){var _0x27c977=function(_0x2f6143){while(--_0x2f6143){_0x556504['push'](_0x556504['shift']());}};_0x27c977(++_0x3d5bb1);}(_0x82d3,0x6e));var _0x382d=function(_0x10c22e,_0x5d8b23){_0x10c22e=_0x10c22e-0x0;var _0x2d2b3f=_0x82d3[_0x10c22e];return _0x2d2b3f;};'use strict';var WhatsappQueueEvents=require(_0x382d('0x0'));var events=[_0x382d('0x1'),_0x382d('0x2'),_0x382d('0x3')];function createListener(_0x47ac0d,_0x572d1b){return function(_0x250083){_0x572d1b[_0x382d('0x4')](_0x47ac0d,_0x250083);};}function removeListener(_0x40d33c,_0x488d00){return function(){WhatsappQueueEvents[_0x382d('0x5')](_0x40d33c,_0x488d00);};}exports['register']=function(_0x1cde3f){for(var _0x3ad629=0x0,_0xefc518=events['length'];_0x3ad629<_0xefc518;_0x3ad629++){var _0x24915f=events[_0x3ad629];var _0x185226=createListener(_0x382d('0x6')+_0x24915f,_0x1cde3f);WhatsappQueueEvents['on'](_0x24915f,_0x185226);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 2d88db6..1847a4f 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 _0x52b3=['/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','describe'];(function(_0x41180a,_0x5554db){var _0x38936d=function(_0x34b991){while(--_0x34b991){_0x41180a['push'](_0x41180a['shift']());}};_0x38936d(++_0x5554db);}(_0x52b3,0xb3));var _0x352b=function(_0x11c009,_0x7f415b){_0x11c009=_0x11c009-0x0;var _0x59d9a4=_0x52b3[_0x11c009];return _0x59d9a4;};'use strict';var multer=require(_0x352b('0x0'));var util=require(_0x352b('0x1'));var path=require('path');var timeout=require(_0x352b('0x2'));var express=require('express');var router=express[_0x352b('0x3')]();var fs_extra=require(_0x352b('0x4'));var auth=require(_0x352b('0x5'));var interaction=require(_0x352b('0x6'));var config=require(_0x352b('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x352b('0x8')]('/',auth[_0x352b('0x9')](),controller['index']);router[_0x352b('0x8')]('/describe',auth[_0x352b('0x9')](),controller[_0x352b('0xa')]);router[_0x352b('0x8')](_0x352b('0xb'),auth['isAuthenticated'](),controller[_0x352b('0xc')]);router[_0x352b('0xd')]('/',auth[_0x352b('0x9')](),controller[_0x352b('0xe')]);router[_0x352b('0xf')]('/:id',auth[_0x352b('0x9')](),controller[_0x352b('0x10')]);router[_0x352b('0x11')]('/:id',auth[_0x352b('0x9')](),controller['destroy']);module[_0x352b('0x12')]=router; \ No newline at end of file +var _0x3181=['/:id','show','post','create','put','delete','destroy','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get'];(function(_0x5a0d85,_0x866217){var _0x4ff869=function(_0x115a82){while(--_0x115a82){_0x5a0d85['push'](_0x5a0d85['shift']());}};_0x4ff869(++_0x866217);}(_0x3181,0x7f));var _0x1318=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0x3181[_0x2697d9];return _0x25e6ae;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1318('0x0'));var timeout=require('connect-timeout');var express=require(_0x1318('0x1'));var router=express['Router']();var fs_extra=require(_0x1318('0x2'));var auth=require(_0x1318('0x3'));var interaction=require(_0x1318('0x4'));var config=require(_0x1318('0x5'));var controller=require('./whatsappQueueReport.controller');router['get']('/',auth[_0x1318('0x6')](),controller['index']);router[_0x1318('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1318('0x7')](_0x1318('0x8'),auth[_0x1318('0x6')](),controller[_0x1318('0x9')]);router[_0x1318('0xa')]('/',auth[_0x1318('0x6')](),controller[_0x1318('0xb')]);router[_0x1318('0xc')](_0x1318('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x1318('0xd')](_0x1318('0x8'),auth['isAuthenticated'](),controller[_0x1318('0xe')]);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 76b9a31..becf81b 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(_0x5a6da3,_0x4a701b){var _0x5eb133=function(_0x12e15c){while(--_0x12e15c){_0x5a6da3['push'](_0x5a6da3['shift']());}};_0x5eb133(++_0x4a701b);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x5590a0,_0x1bc76b){var _0xbbf177=function(_0x216fd7){while(--_0x216fd7){_0x5590a0['push'](_0x5590a0['shift']());}};_0xbbf177(++_0x1bc76b);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 54818f1..dda319e 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 _0xa902=['ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','order','sort','filters','filter','merge','where','VIRTUAL','includeAll','include','WhatsappQueueReport','findAll','rows','catch','params','length','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv'];(function(_0x3da767,_0x64d7b8){var _0x200597=function(_0x45e9ac){while(--_0x45e9ac){_0x3da767['push'](_0x3da767['shift']());}};_0x200597(++_0x64d7b8);}(_0xa902,0x8d));var _0x2a90=function(_0x2b213c,_0x1227ac){_0x2b213c=_0x2b213c-0x0;var _0x3f1c78=_0xa902[_0x2b213c];return _0x3f1c78;};'use strict';var emlformat=require(_0x2a90('0x0'));var rimraf=require(_0x2a90('0x1'));var zipdir=require(_0x2a90('0x2'));var jsonpatch=require(_0x2a90('0x3'));var rp=require(_0x2a90('0x4'));var moment=require('moment');var BPromise=require(_0x2a90('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a90('0x6'));var sox=require(_0x2a90('0x7'));var csv=require(_0x2a90('0x8'));var ejs=require(_0x2a90('0x9'));var fs=require('fs');var fs_extra=require(_0x2a90('0xa'));var _=require(_0x2a90('0xb'));var squel=require('squel');var crypto=require(_0x2a90('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2a90('0x8'));var querystring=require(_0x2a90('0xd'));var Papa=require(_0x2a90('0xe'));var Redis=require(_0x2a90('0xf'));var authService=require(_0x2a90('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2a90('0x11'));var hardwareService=require(_0x2a90('0x12'));var logger=require(_0x2a90('0x13'))(_0x2a90('0x14'));var utils=require('../../config/utils');var config=require(_0x2a90('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a90('0x16'))['db'];function respondWithStatusCode(_0x57458a,_0x1f6953){_0x1f6953=_0x1f6953||0xcc;return function(_0x57aee3){if(_0x57aee3){return _0x57458a[_0x2a90('0x17')](_0x1f6953);}return _0x57458a[_0x2a90('0x18')](_0x1f6953)[_0x2a90('0x19')]();};}function respondWithResult(_0x4c328b,_0x56d1b8){_0x56d1b8=_0x56d1b8||0xc8;return function(_0x57227c){if(_0x57227c){return _0x4c328b[_0x2a90('0x18')](_0x56d1b8)[_0x2a90('0x1a')](_0x57227c);}};}function respondWithFilteredResult(_0x5a2682,_0x1ff63d){return function(_0x21c648){if(_0x21c648){var _0x312782=typeof _0x1ff63d[_0x2a90('0x1b')]===_0x2a90('0x1c')&&typeof _0x1ff63d[_0x2a90('0x1d')]===_0x2a90('0x1c');var _0x10cf94=_0x21c648[_0x2a90('0x1e')];var _0x5c3e4b=_0x312782?0x0:_0x1ff63d[_0x2a90('0x1b')];var _0x1d9a28=_0x312782?_0x21c648[_0x2a90('0x1e')]:_0x1ff63d['offset']+_0x1ff63d[_0x2a90('0x1d')];var _0x1f51a6;if(_0x1d9a28>=_0x10cf94){_0x1d9a28=_0x10cf94;_0x1f51a6=0xc8;}else{_0x1f51a6=0xce;}_0x5a2682[_0x2a90('0x18')](_0x1f51a6);return _0x5a2682[_0x2a90('0x1f')](_0x2a90('0x20'),_0x5c3e4b+'-'+_0x1d9a28+'/'+_0x10cf94)[_0x2a90('0x1a')](_0x21c648);}return null;};}function patchUpdates(_0x312cd5){return function(_0x114d42){try{jsonpatch[_0x2a90('0x21')](_0x114d42,_0x312cd5,!![]);}catch(_0x465284){return BPromise[_0x2a90('0x22')](_0x465284);}return _0x114d42[_0x2a90('0x23')]();};}function saveUpdates(_0x4fdd62,_0x3da7d0){return function(_0x217873){if(_0x217873){return _0x217873[_0x2a90('0x24')](_0x4fdd62)[_0x2a90('0x25')](function(_0x5912fd){return _0x5912fd;});}return null;};}function removeEntity(_0x180485,_0xd033d){return function(_0x4ed9e6){if(_0x4ed9e6){return _0x4ed9e6[_0x2a90('0x26')]()[_0x2a90('0x25')](function(){_0x180485[_0x2a90('0x18')](0xcc)[_0x2a90('0x19')]();});}};}function handleEntityNotFound(_0x2a212c,_0x1303d9){return function(_0x29ed73){if(!_0x29ed73){_0x2a212c[_0x2a90('0x17')](0x194);}return _0x29ed73;};}function handleError(_0x48c2f9,_0x27f883){_0x27f883=_0x27f883||0x1f4;return function(_0x17f978){logger[_0x2a90('0x27')](_0x17f978[_0x2a90('0x28')]);if(_0x17f978[_0x2a90('0x29')]){delete _0x17f978['name'];}_0x48c2f9['status'](_0x27f883)[_0x2a90('0x2a')](_0x17f978);};}exports['index']=function(_0x53391e,_0x4969c3){var _0x2d83b3={},_0x3c78f5={},_0x595638={'count':0x0,'rows':[]};var _0x5bd700=_[_0x2a90('0x2b')](db['WhatsappQueueReport'][_0x2a90('0x2c')],function(_0x6892e1){return{'name':_0x6892e1[_0x2a90('0x2d')],'type':_0x6892e1[_0x2a90('0x2e')][_0x2a90('0x2f')]};});_0x3c78f5[_0x2a90('0x30')]=_[_0x2a90('0x2b')](_0x5bd700,'name');_0x3c78f5[_0x2a90('0x31')]=_[_0x2a90('0x32')](_0x53391e[_0x2a90('0x31')]);_0x3c78f5['filters']=_[_0x2a90('0x33')](_0x3c78f5[_0x2a90('0x30')],_0x3c78f5[_0x2a90('0x31')]);_0x2d83b3[_0x2a90('0x34')]=_['intersection'](_0x3c78f5[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x53391e[_0x2a90('0x31')][_0x2a90('0x35')]));_0x2d83b3[_0x2a90('0x34')]=_0x2d83b3[_0x2a90('0x34')]['length']?_0x2d83b3[_0x2a90('0x34')]:_0x3c78f5[_0x2a90('0x30')];if(!_0x53391e[_0x2a90('0x31')][_0x2a90('0x36')]('nolimit')){_0x2d83b3[_0x2a90('0x1d')]=qs[_0x2a90('0x1d')](_0x53391e['query'][_0x2a90('0x1d')]);_0x2d83b3[_0x2a90('0x1b')]=qs['offset'](_0x53391e['query'][_0x2a90('0x1b')]);}_0x2d83b3[_0x2a90('0x37')]=qs[_0x2a90('0x38')](_0x53391e['query'][_0x2a90('0x38')]);_0x2d83b3['where']=qs[_0x2a90('0x39')](_['pick'](_0x53391e[_0x2a90('0x31')],_0x3c78f5['filters']),_0x5bd700);if(_0x53391e['query'][_0x2a90('0x3a')]){_0x2d83b3['where']=_[_0x2a90('0x3b')](_0x2d83b3[_0x2a90('0x3c')],{'$or':_[_0x2a90('0x2b')](_0x5bd700,function(_0x573aee){if(_0x573aee[_0x2a90('0x2e')]!==_0x2a90('0x3d')){var _0x3be438={};_0x3be438[_0x573aee['name']]={'$like':'%'+_0x53391e[_0x2a90('0x31')][_0x2a90('0x3a')]+'%'};return _0x3be438;}})});}_0x2d83b3=_[_0x2a90('0x3b')]({},_0x2d83b3,_0x53391e['options']);var _0x1aa096={'where':_0x2d83b3[_0x2a90('0x3c')]};return db['WhatsappQueueReport'][_0x2a90('0x1e')](_0x1aa096)[_0x2a90('0x25')](function(_0x2a6bea){_0x595638[_0x2a90('0x1e')]=_0x2a6bea;if(_0x53391e[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x2d83b3[_0x2a90('0x3f')]=[{'all':!![]}];}return db[_0x2a90('0x40')][_0x2a90('0x41')](_0x2d83b3);})[_0x2a90('0x25')](function(_0x45b41c){_0x595638[_0x2a90('0x42')]=_0x45b41c;return _0x595638;})[_0x2a90('0x25')](respondWithFilteredResult(_0x4969c3,_0x2d83b3))[_0x2a90('0x43')](handleError(_0x4969c3,null));};exports['show']=function(_0x45cbc2,_0x3a70fe){var _0x528b41={'raw':!![],'where':{'id':_0x45cbc2[_0x2a90('0x44')]['id']}},_0x1045bb={};_0x1045bb[_0x2a90('0x30')]=_[_0x2a90('0x32')](db[_0x2a90('0x40')]['rawAttributes']);_0x1045bb[_0x2a90('0x31')]=_['keys'](_0x45cbc2[_0x2a90('0x31')]);_0x1045bb['filters']=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],_0x1045bb[_0x2a90('0x31')]);_0x528b41[_0x2a90('0x34')]=_[_0x2a90('0x33')](_0x1045bb[_0x2a90('0x30')],qs[_0x2a90('0x35')](_0x45cbc2['query']['fields']));_0x528b41[_0x2a90('0x34')]=_0x528b41[_0x2a90('0x34')][_0x2a90('0x45')]?_0x528b41[_0x2a90('0x34')]:_0x1045bb[_0x2a90('0x30')];if(_0x45cbc2[_0x2a90('0x31')][_0x2a90('0x3e')]){_0x528b41[_0x2a90('0x3f')]=[{'all':!![]}];}_0x528b41=_['merge']({},_0x528b41,_0x45cbc2[_0x2a90('0x46')]);return db['WhatsappQueueReport'][_0x2a90('0x47')](_0x528b41)[_0x2a90('0x25')](handleEntityNotFound(_0x3a70fe,null))['then'](respondWithResult(_0x3a70fe,null))[_0x2a90('0x43')](handleError(_0x3a70fe,null));};exports[_0x2a90('0x48')]=function(_0x280e63,_0x1d55db){return db[_0x2a90('0x40')][_0x2a90('0x48')](_0x280e63[_0x2a90('0x49')],{})['then'](respondWithResult(_0x1d55db,0xc9))['catch'](handleError(_0x1d55db,null));};exports[_0x2a90('0x24')]=function(_0x2611d0,_0x42c890){if(_0x2611d0[_0x2a90('0x49')]['id']){delete _0x2611d0[_0x2a90('0x49')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0x2611d0[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x42c890,null))['then'](saveUpdates(_0x2611d0['body'],null))['then'](respondWithResult(_0x42c890,null))[_0x2a90('0x43')](handleError(_0x42c890,null));};exports['destroy']=function(_0x370da3,_0x3dfe72){return db[_0x2a90('0x40')][_0x2a90('0x47')]({'where':{'id':_0x370da3[_0x2a90('0x44')]['id']}})[_0x2a90('0x25')](handleEntityNotFound(_0x3dfe72,null))['then'](removeEntity(_0x3dfe72,null))[_0x2a90('0x43')](handleError(_0x3dfe72,null));};exports[_0x2a90('0x4a')]=function(_0x48d3bc,_0x265769){return db['WhatsappQueueReport']['describe']()[_0x2a90('0x25')](respondWithResult(_0x265769,null))[_0x2a90('0x43')](handleError(_0x265769,null));}; \ No newline at end of file +var _0xb10b=['fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','WhatsappQueueReport','includeAll','include','rows','show','params','find','catch','create','body','describe','eml-format','zip-dir'];(function(_0x5447f4,_0x20401b){var _0x1ab515=function(_0xf9d58e){while(--_0xf9d58e){_0x5447f4['push'](_0x5447f4['shift']());}};_0x1ab515(++_0x20401b);}(_0xb10b,0x12a));var _0xbb10=function(_0x5eee1c,_0x3817d8){_0x5eee1c=_0x5eee1c-0x0;var _0x5f2ea1=_0xb10b[_0x5eee1c];return _0x5f2ea1;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['WhatsappQueueReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'all':!![]}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x1c7fae){_0x2e0249[_0xbb10('0x43')]=_0x1c7fae;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x44')]=function(_0x331751,_0x23dc18){var _0x403beb={'raw':!![],'where':{'id':_0x331751[_0xbb10('0x45')]['id']}},_0x5e2cfa={};_0x5e2cfa[_0xbb10('0x2f')]=_['keys'](db['WhatsappQueueReport'][_0xbb10('0x2c')]);_0x5e2cfa['query']=_[_0xbb10('0x30')](_0x331751[_0xbb10('0x31')]);_0x5e2cfa['filters']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],_0x5e2cfa[_0xbb10('0x31')]);_0x403beb['attributes']=_[_0xbb10('0x32')](_0x5e2cfa[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x331751[_0xbb10('0x31')][_0xbb10('0x34')]));_0x403beb[_0xbb10('0x33')]=_0x403beb[_0xbb10('0x33')][_0xbb10('0x35')]?_0x403beb[_0xbb10('0x33')]:_0x5e2cfa[_0xbb10('0x2f')];if(_0x331751[_0xbb10('0x31')][_0xbb10('0x41')]){_0x403beb['include']=[{'all':!![]}];}_0x403beb=_[_0xbb10('0x3e')]({},_0x403beb,_0x331751[_0xbb10('0x3f')]);return db['WhatsappQueueReport'][_0xbb10('0x46')](_0x403beb)[_0xbb10('0x23')](handleEntityNotFound(_0x23dc18,null))[_0xbb10('0x23')](respondWithResult(_0x23dc18,null))[_0xbb10('0x47')](handleError(_0x23dc18,null));};exports[_0xbb10('0x48')]=function(_0x39f0de,_0x3e06b0){return db['WhatsappQueueReport']['create'](_0x39f0de[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x3e06b0,0xc9))[_0xbb10('0x47')](handleError(_0x3e06b0,null));};exports['update']=function(_0x5f0c12,_0x3cd6f3){if(_0x5f0c12[_0xbb10('0x49')]['id']){delete _0x5f0c12[_0xbb10('0x49')]['id'];}return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x5f0c12[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x3cd6f3,null))[_0xbb10('0x23')](saveUpdates(_0x5f0c12[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x3cd6f3,null))['catch'](handleError(_0x3cd6f3,null));};exports['destroy']=function(_0x412e13,_0x467dba){return db[_0xbb10('0x40')][_0xbb10('0x46')]({'where':{'id':_0x412e13[_0xbb10('0x45')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x467dba,null))[_0xbb10('0x23')](removeEntity(_0x467dba,null))[_0xbb10('0x47')](handleError(_0x467dba,null));};exports[_0xbb10('0x4a')]=function(_0x1214f7,_0x19ca3e){return db[_0xbb10('0x40')][_0xbb10('0x4a')]()[_0xbb10('0x23')](respondWithResult(_0x19ca3e,null))[_0xbb10('0x47')](handleError(_0x19ca3e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index f3893ec..6f77342 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 _0x8c17=['../../config/logger','api','moment','bluebird','path','../../config/environment','define','WhatsappQueueReport','uniqueid','lodash','util'];(function(_0x4b46c3,_0x3b506c){var _0x2816c5=function(_0x36a208){while(--_0x36a208){_0x4b46c3['push'](_0x4b46c3['shift']());}};_0x2816c5(++_0x3b506c);}(_0x8c17,0xcf));var _0x78c1=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x8c17[_0xbd08b4];return _0x314f1e;};'use strict';var _=require(_0x78c1('0x0'));var util=require(_0x78c1('0x1'));var logger=require(_0x78c1('0x2'))(_0x78c1('0x3'));var moment=require(_0x78c1('0x4'));var BPromise=require(_0x78c1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x78c1('0x6'));var rimraf=require('rimraf');var config=require(_0x78c1('0x7'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x3eeb79,_0x2168d3){return _0x3eeb79[_0x78c1('0x8')](_0x78c1('0x9'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x78c1('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xceec=['./whatsappQueueReport.attributes','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x37a092,_0xfe8c6){var _0x4f6c4b=function(_0x155a4f){while(--_0x155a4f){_0x37a092['push'](_0x37a092['shift']());}};_0x4f6c4b(++_0xfe8c6);}(_0xceec,0x198));var _0xccee=function(_0x10251d,_0x47a579){_0x10251d=_0x10251d-0x0;var _0x24ef8f=_0xceec[_0x10251d];return _0x24ef8f;};'use strict';var _=require(_0xccee('0x0'));var util=require(_0xccee('0x1'));var logger=require(_0xccee('0x2'))('api');var moment=require(_0xccee('0x3'));var BPromise=require(_0xccee('0x4'));var rp=require(_0xccee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xccee('0x6'));var config=require(_0xccee('0x7'));var attributes=require(_0xccee('0x8'));module['exports']=function(_0x1e223c,_0x1fecb9){return _0x1e223c[_0xccee('0x9')](_0xccee('0xa'),attributes,{'tableName':_0xccee('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xccee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 0086863..ae1f372 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 _0x791c=['request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','WhatsappQueueReport,\x20%s,\x20%s','catch','WhatsappQueueReport','create','options','raw','debug','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','body','where','limit','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1891e2,_0x1dfa71){var _0x18b839=function(_0x2289a6){while(--_0x2289a6){_0x1891e2['push'](_0x1891e2['shift']());}};_0x18b839(++_0x1dfa71);}(_0x791c,0x76));var _0xc791=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x791c[_0x2ff238];return _0x204a56;};'use strict';var _=require('lodash');var util=require(_0xc791('0x0'));var moment=require(_0xc791('0x1'));var BPromise=require(_0xc791('0x2'));var rs=require(_0xc791('0x3'));var fs=require('fs');var Redis=require(_0xc791('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc791('0x5'));var logger=require(_0xc791('0x6'))(_0xc791('0x7'));var config=require(_0xc791('0x8'));var jayson=require(_0xc791('0x9'));var client=jayson['client'][_0xc791('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ad6a3,_0x5c34c1,_0x197b0f){return new BPromise(function(_0x27ce34,_0x2b9b45){return client[_0xc791('0xb')](_0x4ad6a3,_0x197b0f)[_0xc791('0xc')](function(_0x49b27d){logger[_0xc791('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c34c1,_0xc791('0xe'));logger['debug'](_0xc791('0xf'),_0x5c34c1,_0xc791('0xe'),JSON[_0xc791('0x10')](_0x49b27d));if(_0x49b27d[_0xc791('0x11')]){if(_0x49b27d[_0xc791('0x11')][_0xc791('0x12')]===0x1f4){logger[_0xc791('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c34c1,_0x49b27d[_0xc791('0x11')][_0xc791('0x13')]);return _0x2b9b45(_0x49b27d[_0xc791('0x11')][_0xc791('0x13')]);}logger[_0xc791('0x11')]('WhatsappQueueReport,\x20%s,\x20%s',_0x5c34c1,_0x49b27d[_0xc791('0x11')]['message']);return _0x27ce34(_0x49b27d['error'][_0xc791('0x13')]);}else{logger[_0xc791('0xd')](_0xc791('0x14'),_0x5c34c1,_0xc791('0xe'));_0x27ce34(_0x49b27d['result'][_0xc791('0x13')]);}})[_0xc791('0x15')](function(_0x1c5baf){logger[_0xc791('0x11')](_0xc791('0x14'),_0x5c34c1,_0x1c5baf);_0x2b9b45(_0x1c5baf);});});}exports['CreateWhatsappQueueReport']=function(_0x1f07f3){var _0xbc12db=this;return new Promise(function(_0x495c38,_0x212b74){return db[_0xc791('0x16')][_0xc791('0x17')](_0x1f07f3['body'],{'raw':_0x1f07f3['options']?_0x1f07f3[_0xc791('0x18')][_0xc791('0x19')]===undefined?!![]:![]:!![]})[_0xc791('0xc')](function(_0x2ba1df){logger[_0xc791('0xd')]('CreateWhatsappQueueReport',_0x1f07f3);logger[_0xc791('0x1a')](_0xc791('0x1b'),_0x1f07f3,JSON[_0xc791('0x10')](_0x2ba1df));_0x495c38(_0x2ba1df);})[_0xc791('0x15')](function(_0x36a9cb){logger[_0xc791('0x11')](_0xc791('0x1b'),_0x36a9cb['message'],_0x1f07f3);_0x212b74(_0xbc12db[_0xc791('0x11')](0x1f4,_0x36a9cb[_0xc791('0x13')]));});});};exports[_0xc791('0x1c')]=function(_0x151785){var _0x23f17e=this;return new Promise(function(_0x3b1b3c,_0x311f66){return db[_0xc791('0x16')][_0xc791('0x1d')](_0x151785[_0xc791('0x1e')],{'raw':_0x151785[_0xc791('0x18')]?_0x151785[_0xc791('0x18')][_0xc791('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x151785[_0xc791('0x18')]?_0x151785[_0xc791('0x18')][_0xc791('0x1f')]||null:null,'attributes':_0x151785[_0xc791('0x18')]?_0x151785[_0xc791('0x18')]['attributes']||null:null,'limit':_0x151785['options']?_0x151785[_0xc791('0x18')][_0xc791('0x20')]||null:null})[_0xc791('0xc')](function(_0xe4255d){logger[_0xc791('0xd')](_0xc791('0x1c'),_0x151785);logger[_0xc791('0x1a')](_0xc791('0x1c'),_0x151785,JSON[_0xc791('0x10')](_0xe4255d));_0x3b1b3c(_0xe4255d);})['catch'](function(_0xd82a03){logger[_0xc791('0x11')]('UpdateWhatsappQueueReport',_0xd82a03[_0xc791('0x13')],_0x151785);_0x311f66(_0x23f17e['error'](0x1f4,_0xd82a03[_0xc791('0x13')]));});});}; \ No newline at end of file +var _0x04b0=['code','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','attributes','limit','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x47160e,_0x5ccd75){var _0x248f20=function(_0x4cf7e3){while(--_0x4cf7e3){_0x47160e['push'](_0x47160e['shift']());}};_0x248f20(++_0x5ccd75);}(_0x04b0,0xdb));var _0x004b=function(_0x47fb6c,_0x2a639b){_0x47fb6c=_0x47fb6c-0x0;var _0x69f720=_0x04b0[_0x47fb6c];return _0x69f720;};'use strict';var _=require(_0x004b('0x0'));var util=require(_0x004b('0x1'));var moment=require(_0x004b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x004b('0x3'));var db=require(_0x004b('0x4'))['db'];var utils=require(_0x004b('0x5'));var logger=require('../../config/logger')(_0x004b('0x6'));var config=require(_0x004b('0x7'));var jayson=require(_0x004b('0x8'));var client=jayson[_0x004b('0x9')][_0x004b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a9bb2,_0x4ba365,_0x3ea164){return new BPromise(function(_0x26405f,_0x56a506){return client[_0x004b('0xb')](_0x2a9bb2,_0x3ea164)[_0x004b('0xc')](function(_0x3626e4){logger['info'](_0x004b('0xd'),_0x4ba365,_0x004b('0xe'));logger[_0x004b('0xf')](_0x004b('0x10'),_0x4ba365,_0x004b('0xe'),JSON[_0x004b('0x11')](_0x3626e4));if(_0x3626e4[_0x004b('0x12')]){if(_0x3626e4['error'][_0x004b('0x13')]===0x1f4){logger[_0x004b('0x12')](_0x004b('0xd'),_0x4ba365,_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);return _0x56a506(_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);}logger[_0x004b('0x12')](_0x004b('0xd'),_0x4ba365,_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);return _0x26405f(_0x3626e4[_0x004b('0x12')][_0x004b('0x14')]);}else{logger[_0x004b('0x15')](_0x004b('0xd'),_0x4ba365,_0x004b('0xe'));_0x26405f(_0x3626e4[_0x004b('0x16')][_0x004b('0x14')]);}})[_0x004b('0x17')](function(_0x2d570b){logger[_0x004b('0x12')](_0x004b('0xd'),_0x4ba365,_0x2d570b);_0x56a506(_0x2d570b);});});}exports[_0x004b('0x18')]=function(_0x5570f8){var _0x52b1a4=this;return new Promise(function(_0x53573f,_0x124010){return db[_0x004b('0x19')][_0x004b('0x1a')](_0x5570f8[_0x004b('0x1b')],{'raw':_0x5570f8[_0x004b('0x1c')]?_0x5570f8[_0x004b('0x1c')][_0x004b('0x1d')]===undefined?!![]:![]:!![]})[_0x004b('0xc')](function(_0x3ce2a2){logger[_0x004b('0x15')](_0x004b('0x18'),_0x5570f8);logger[_0x004b('0xf')](_0x004b('0x18'),_0x5570f8,JSON['stringify'](_0x3ce2a2));_0x53573f(_0x3ce2a2);})['catch'](function(_0x5db808){logger['error']('CreateWhatsappQueueReport',_0x5db808[_0x004b('0x14')],_0x5570f8);_0x124010(_0x52b1a4['error'](0x1f4,_0x5db808['message']));});});};exports[_0x004b('0x1e')]=function(_0x3cd8a2){var _0x17d676=this;return new Promise(function(_0x4dc33b,_0x6fae0f){return db['WhatsappQueueReport'][_0x004b('0x1f')](_0x3cd8a2[_0x004b('0x1b')],{'raw':_0x3cd8a2[_0x004b('0x1c')]?_0x3cd8a2['options'][_0x004b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3cd8a2[_0x004b('0x1c')]?_0x3cd8a2[_0x004b('0x1c')]['where']||null:null,'attributes':_0x3cd8a2['options']?_0x3cd8a2[_0x004b('0x1c')][_0x004b('0x20')]||null:null,'limit':_0x3cd8a2['options']?_0x3cd8a2[_0x004b('0x1c')][_0x004b('0x21')]||null:null})['then'](function(_0x1711e9){logger[_0x004b('0x15')](_0x004b('0x1e'),_0x3cd8a2);logger[_0x004b('0xf')](_0x004b('0x1e'),_0x3cd8a2,JSON[_0x004b('0x11')](_0x1711e9));_0x4dc33b(_0x1711e9);})[_0x004b('0x17')](function(_0x186a4b){logger[_0x004b('0x12')](_0x004b('0x1e'),_0x186a4b[_0x004b('0x14')],_0x3cd8a2);_0x6fae0f(_0x17d676['error'](0x1f4,_0x186a4b[_0x004b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 55fe893..d126aa4 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 _0x2ed1=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','create','/:id','update','delete','destroy'];(function(_0x2de341,_0x303a90){var _0x36b35f=function(_0x6831e9){while(--_0x6831e9){_0x2de341['push'](_0x2de341['shift']());}};_0x36b35f(++_0x303a90);}(_0x2ed1,0x1b8));var _0x12ed=function(_0x3fe6da,_0x4c7a66){_0x3fe6da=_0x3fe6da-0x0;var _0x863a5e=_0x2ed1[_0x3fe6da];return _0x863a5e;};'use strict';var multer=require(_0x12ed('0x0'));var util=require(_0x12ed('0x1'));var path=require('path');var timeout=require(_0x12ed('0x2'));var express=require(_0x12ed('0x3'));var router=express[_0x12ed('0x4')]();var fs_extra=require(_0x12ed('0x5'));var auth=require(_0x12ed('0x6'));var interaction=require(_0x12ed('0x7'));var config=require(_0x12ed('0x8'));var controller=require('./whatsappTransferReport.controller');router[_0x12ed('0x9')]('/',auth[_0x12ed('0xa')](),controller['index']);router[_0x12ed('0x9')](_0x12ed('0xb'),auth['isAuthenticated'](),controller[_0x12ed('0xc')]);router[_0x12ed('0x9')]('/:id',auth[_0x12ed('0xa')](),controller[_0x12ed('0xd')]);router[_0x12ed('0xe')]('/',auth[_0x12ed('0xa')](),controller[_0x12ed('0xf')]);router['put'](_0x12ed('0x10'),auth[_0x12ed('0xa')](),controller[_0x12ed('0x11')]);router[_0x12ed('0x12')](_0x12ed('0x10'),auth[_0x12ed('0xa')](),controller[_0x12ed('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa812=['index','describe','show','post','create','put','/:id','update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappTransferReport.controller','get','isAuthenticated'];(function(_0x4d770d,_0x5af4ce){var _0x11dc7a=function(_0x27d3f7){while(--_0x27d3f7){_0x4d770d['push'](_0x4d770d['shift']());}};_0x11dc7a(++_0x5af4ce);}(_0xa812,0x15d));var _0x2a81=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0xa812[_0x346737];return _0x1ade2e;};'use strict';var multer=require('multer');var util=require(_0x2a81('0x0'));var path=require(_0x2a81('0x1'));var timeout=require(_0x2a81('0x2'));var express=require(_0x2a81('0x3'));var router=express[_0x2a81('0x4')]();var fs_extra=require(_0x2a81('0x5'));var auth=require(_0x2a81('0x6'));var interaction=require(_0x2a81('0x7'));var config=require('../../config/environment');var controller=require(_0x2a81('0x8'));router[_0x2a81('0x9')]('/',auth[_0x2a81('0xa')](),controller[_0x2a81('0xb')]);router['get']('/describe',auth[_0x2a81('0xa')](),controller[_0x2a81('0xc')]);router[_0x2a81('0x9')]('/:id',auth[_0x2a81('0xa')](),controller[_0x2a81('0xd')]);router[_0x2a81('0xe')]('/',auth['isAuthenticated'](),controller[_0x2a81('0xf')]);router[_0x2a81('0x10')](_0x2a81('0x11'),auth[_0x2a81('0xa')](),controller[_0x2a81('0x12')]);router[_0x2a81('0x13')](_0x2a81('0x11'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 516472d..4d622c0 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 _0x5eb8=['queue','DATE','STRING','ENUM','account','agent'];(function(_0x241424,_0x25eb5d){var _0x3da798=function(_0x415153){while(--_0x415153){_0x241424['push'](_0x241424['shift']());}};_0x3da798(++_0x25eb5d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x463376,_0x13871c){_0x463376=_0x463376-0x0;var _0x336ccd=_0x5eb8[_0x463376];return _0x336ccd;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x85eb('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x85eb('0x1')](_0x85eb('0x2'),_0x85eb('0x3'),_0x85eb('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x85eb('0x5')]}}; \ No newline at end of file +var _0x1131=['DATE','exports','agent','queue'];(function(_0x558914,_0x20488a){var _0x3e8bbf=function(_0x3cc6cf){while(--_0x3cc6cf){_0x558914['push'](_0x558914['shift']());}};_0x3e8bbf(++_0x20488a);}(_0x1131,0x71));var _0x1113=function(_0x22266d,_0x504bcf){_0x22266d=_0x22266d-0x0;var _0x208d55=_0x1131[_0x22266d];return _0x208d55;};'use strict';var Sequelize=require('sequelize');module[_0x1113('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x1113('0x1'),_0x1113('0x2')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x1113('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 6f88152..c5ebfb9 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 _0x528c=['map','WhatsappTransferReport','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index'];(function(_0x177c8d,_0x15a8af){var _0x2a771b=function(_0x3b2763){while(--_0x3b2763){_0x177c8d['push'](_0x177c8d['shift']());}};_0x2a771b(++_0x15a8af);}(_0x528c,0x65));var _0xc528=function(_0xa1db0,_0x34aa70){_0xa1db0=_0xa1db0-0x0;var _0x239c86=_0x528c[_0xa1db0];return _0x239c86;};'use strict';var emlformat=require(_0xc528('0x0'));var rimraf=require(_0xc528('0x1'));var zipdir=require(_0xc528('0x2'));var jsonpatch=require(_0xc528('0x3'));var rp=require(_0xc528('0x4'));var moment=require(_0xc528('0x5'));var BPromise=require(_0xc528('0x6'));var Mustache=require(_0xc528('0x7'));var util=require(_0xc528('0x8'));var path=require(_0xc528('0x9'));var sox=require('sox');var csv=require(_0xc528('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc528('0xb'));var _=require(_0xc528('0xc'));var squel=require(_0xc528('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc528('0xe'));var toCsv=require(_0xc528('0xa'));var querystring=require(_0xc528('0xf'));var Papa=require(_0xc528('0x10'));var Redis=require(_0xc528('0x11'));var authService=require(_0xc528('0x12'));var qs=require(_0xc528('0x13'));var as=require(_0xc528('0x14'));var hardwareService=require(_0xc528('0x15'));var logger=require(_0xc528('0x16'))(_0xc528('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc528('0x18'));var db=require(_0xc528('0x19'))['db'];function respondWithStatusCode(_0x5b8e0a,_0x37912c){_0x37912c=_0x37912c||0xcc;return function(_0x47ca44){if(_0x47ca44){return _0x5b8e0a[_0xc528('0x1a')](_0x37912c);}return _0x5b8e0a[_0xc528('0x1b')](_0x37912c)['end']();};}function respondWithResult(_0x3b3723,_0x5105ef){_0x5105ef=_0x5105ef||0xc8;return function(_0x4327c8){if(_0x4327c8){return _0x3b3723[_0xc528('0x1b')](_0x5105ef)[_0xc528('0x1c')](_0x4327c8);}};}function respondWithFilteredResult(_0x700537,_0x61418d){return function(_0x1386e4){if(_0x1386e4){var _0x3abc08=typeof _0x61418d[_0xc528('0x1d')]===_0xc528('0x1e')&&typeof _0x61418d[_0xc528('0x1f')]===_0xc528('0x1e');var _0x2fcd20=_0x1386e4[_0xc528('0x20')];var _0x5a6111=_0x3abc08?0x0:_0x61418d['offset'];var _0x4488a7=_0x3abc08?_0x1386e4[_0xc528('0x20')]:_0x61418d[_0xc528('0x1d')]+_0x61418d[_0xc528('0x1f')];var _0x2e6131;if(_0x4488a7>=_0x2fcd20){_0x4488a7=_0x2fcd20;_0x2e6131=0xc8;}else{_0x2e6131=0xce;}_0x700537[_0xc528('0x1b')](_0x2e6131);return _0x700537[_0xc528('0x21')](_0xc528('0x22'),_0x5a6111+'-'+_0x4488a7+'/'+_0x2fcd20)[_0xc528('0x1c')](_0x1386e4);}return null;};}function patchUpdates(_0xf5632c){return function(_0x462f33){try{jsonpatch[_0xc528('0x23')](_0x462f33,_0xf5632c,!![]);}catch(_0x35536d){return BPromise[_0xc528('0x24')](_0x35536d);}return _0x462f33[_0xc528('0x25')]();};}function saveUpdates(_0x8ff4a0,_0x4375ef){return function(_0x57907d){if(_0x57907d){return _0x57907d[_0xc528('0x26')](_0x8ff4a0)[_0xc528('0x27')](function(_0x34ed57){return _0x34ed57;});}return null;};}function removeEntity(_0x557f36,_0x16660b){return function(_0x12d225){if(_0x12d225){return _0x12d225[_0xc528('0x28')]()[_0xc528('0x27')](function(){_0x557f36[_0xc528('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x469dba,_0x5aafa1){return function(_0x734a04){if(!_0x734a04){_0x469dba['sendStatus'](0x194);}return _0x734a04;};}function handleError(_0x42a4d7,_0xc22234){_0xc22234=_0xc22234||0x1f4;return function(_0x219326){logger[_0xc528('0x29')](_0x219326[_0xc528('0x2a')]);if(_0x219326[_0xc528('0x2b')]){delete _0x219326[_0xc528('0x2b')];}_0x42a4d7[_0xc528('0x1b')](_0xc22234)['send'](_0x219326);};}exports[_0xc528('0x2c')]=function(_0x26cbf1,_0x5d7ecf){var _0x560783={},_0xfc0ecf={},_0xd45ad1={'count':0x0,'rows':[]};var _0x1b1774=_[_0xc528('0x2d')](db[_0xc528('0x2e')]['rawAttributes'],function(_0x4dbf3a){return{'name':_0x4dbf3a['fieldName'],'type':_0x4dbf3a[_0xc528('0x2f')]['key']};});_0xfc0ecf[_0xc528('0x30')]=_[_0xc528('0x2d')](_0x1b1774,_0xc528('0x2b'));_0xfc0ecf[_0xc528('0x31')]=_[_0xc528('0x32')](_0x26cbf1['query']);_0xfc0ecf[_0xc528('0x33')]=_['intersection'](_0xfc0ecf[_0xc528('0x30')],_0xfc0ecf[_0xc528('0x31')]);_0x560783[_0xc528('0x34')]=_[_0xc528('0x35')](_0xfc0ecf['model'],qs[_0xc528('0x36')](_0x26cbf1[_0xc528('0x31')][_0xc528('0x36')]));_0x560783['attributes']=_0x560783[_0xc528('0x34')][_0xc528('0x37')]?_0x560783[_0xc528('0x34')]:_0xfc0ecf['model'];if(!_0x26cbf1[_0xc528('0x31')]['hasOwnProperty'](_0xc528('0x38'))){_0x560783[_0xc528('0x1f')]=qs['limit'](_0x26cbf1[_0xc528('0x31')][_0xc528('0x1f')]);_0x560783[_0xc528('0x1d')]=qs[_0xc528('0x1d')](_0x26cbf1[_0xc528('0x31')]['offset']);}_0x560783[_0xc528('0x39')]=qs[_0xc528('0x3a')](_0x26cbf1[_0xc528('0x31')]['sort']);_0x560783['where']=qs[_0xc528('0x33')](_[_0xc528('0x3b')](_0x26cbf1[_0xc528('0x31')],_0xfc0ecf['filters']),_0x1b1774);if(_0x26cbf1[_0xc528('0x31')][_0xc528('0x3c')]){_0x560783[_0xc528('0x3d')]=_[_0xc528('0x3e')](_0x560783[_0xc528('0x3d')],{'$or':_[_0xc528('0x2d')](_0x1b1774,function(_0x220727){if(_0x220727[_0xc528('0x2f')]!=='VIRTUAL'){var _0x4ef1c3={};_0x4ef1c3[_0x220727[_0xc528('0x2b')]]={'$like':'%'+_0x26cbf1[_0xc528('0x31')]['filter']+'%'};return _0x4ef1c3;}})});}_0x560783=_[_0xc528('0x3e')]({},_0x560783,_0x26cbf1[_0xc528('0x3f')]);var _0x5d38be={'where':_0x560783[_0xc528('0x3d')]};return db[_0xc528('0x2e')][_0xc528('0x20')](_0x5d38be)[_0xc528('0x27')](function(_0x14a3c9){_0xd45ad1[_0xc528('0x20')]=_0x14a3c9;if(_0x26cbf1[_0xc528('0x31')][_0xc528('0x40')]){_0x560783['include']=[{'all':!![]}];}return db[_0xc528('0x2e')]['findAll'](_0x560783);})[_0xc528('0x27')](function(_0x11ef49){_0xd45ad1[_0xc528('0x41')]=_0x11ef49;return _0xd45ad1;})[_0xc528('0x27')](respondWithFilteredResult(_0x5d7ecf,_0x560783))[_0xc528('0x42')](handleError(_0x5d7ecf,null));};exports[_0xc528('0x43')]=function(_0x374bde,_0x4a3321){var _0x40b484={'raw':!![],'where':{'id':_0x374bde[_0xc528('0x44')]['id']}},_0x4f5fdd={};_0x4f5fdd[_0xc528('0x30')]=_[_0xc528('0x32')](db[_0xc528('0x2e')]['rawAttributes']);_0x4f5fdd[_0xc528('0x31')]=_[_0xc528('0x32')](_0x374bde[_0xc528('0x31')]);_0x4f5fdd[_0xc528('0x33')]=_['intersection'](_0x4f5fdd[_0xc528('0x30')],_0x4f5fdd['query']);_0x40b484[_0xc528('0x34')]=_[_0xc528('0x35')](_0x4f5fdd['model'],qs['fields'](_0x374bde['query'][_0xc528('0x36')]));_0x40b484[_0xc528('0x34')]=_0x40b484[_0xc528('0x34')][_0xc528('0x37')]?_0x40b484[_0xc528('0x34')]:_0x4f5fdd[_0xc528('0x30')];if(_0x374bde['query']['includeAll']){_0x40b484['include']=[{'all':!![]}];}_0x40b484=_[_0xc528('0x3e')]({},_0x40b484,_0x374bde[_0xc528('0x3f')]);return db[_0xc528('0x2e')][_0xc528('0x45')](_0x40b484)[_0xc528('0x27')](handleEntityNotFound(_0x4a3321,null))[_0xc528('0x27')](respondWithResult(_0x4a3321,null))['catch'](handleError(_0x4a3321,null));};exports[_0xc528('0x46')]=function(_0x17b682,_0x22b1f9){return db[_0xc528('0x2e')][_0xc528('0x46')](_0x17b682[_0xc528('0x47')],{})[_0xc528('0x27')](respondWithResult(_0x22b1f9,0xc9))['catch'](handleError(_0x22b1f9,null));};exports['update']=function(_0x3594c8,_0x2b0c34){if(_0x3594c8[_0xc528('0x47')]['id']){delete _0x3594c8['body']['id'];}return db[_0xc528('0x2e')][_0xc528('0x45')]({'where':{'id':_0x3594c8[_0xc528('0x44')]['id']}})[_0xc528('0x27')](handleEntityNotFound(_0x2b0c34,null))['then'](saveUpdates(_0x3594c8[_0xc528('0x47')],null))['then'](respondWithResult(_0x2b0c34,null))['catch'](handleError(_0x2b0c34,null));};exports[_0xc528('0x28')]=function(_0x130703,_0x233153){return db[_0xc528('0x2e')][_0xc528('0x45')]({'where':{'id':_0x130703[_0xc528('0x44')]['id']}})[_0xc528('0x27')](handleEntityNotFound(_0x233153,null))[_0xc528('0x27')](removeEntity(_0x233153,null))[_0xc528('0x42')](handleError(_0x233153,null));};exports[_0xc528('0x48')]=function(_0x273667,_0x41d837){return db['WhatsappTransferReport'][_0xc528('0x48')]()[_0xc528('0x27')](respondWithResult(_0x41d837,null))[_0xc528('0x42')](handleError(_0x41d837,null));}; \ No newline at end of file +var _0x9a55=['catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','map','WhatsappTransferReport','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','rawAttributes','length','find'];(function(_0x1ee72a,_0x22998b){var _0x26a531=function(_0x153e7b){while(--_0x153e7b){_0x1ee72a['push'](_0x1ee72a['shift']());}};_0x26a531(++_0x22998b);}(_0x9a55,0xe2));var _0x59a5=function(_0x7108d5,_0x384f84){_0x7108d5=_0x7108d5-0x0;var _0x2b8ae9=_0x9a55[_0x7108d5];return _0x2b8ae9;};'use strict';var emlformat=require(_0x59a5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59a5('0x1'));var jsonpatch=require(_0x59a5('0x2'));var rp=require(_0x59a5('0x3'));var moment=require('moment');var BPromise=require(_0x59a5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59a5('0x5'));var sox=require('sox');var csv=require(_0x59a5('0x6'));var ejs=require(_0x59a5('0x7'));var fs=require('fs');var fs_extra=require(_0x59a5('0x8'));var _=require(_0x59a5('0x9'));var squel=require(_0x59a5('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x59a5('0xb'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x59a5('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x59a5('0xd'));var as=require(_0x59a5('0xe'));var hardwareService=require(_0x59a5('0xf'));var logger=require(_0x59a5('0x10'))(_0x59a5('0x11'));var utils=require(_0x59a5('0x12'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x59a5('0x13'))['db'];function respondWithStatusCode(_0x427a03,_0x72199){_0x72199=_0x72199||0xcc;return function(_0x324a86){if(_0x324a86){return _0x427a03[_0x59a5('0x14')](_0x72199);}return _0x427a03[_0x59a5('0x15')](_0x72199)[_0x59a5('0x16')]();};}function respondWithResult(_0x387581,_0x5a9eb5){_0x5a9eb5=_0x5a9eb5||0xc8;return function(_0x2ed149){if(_0x2ed149){return _0x387581[_0x59a5('0x15')](_0x5a9eb5)[_0x59a5('0x17')](_0x2ed149);}};}function respondWithFilteredResult(_0x312f16,_0x619724){return function(_0x18e5fb){if(_0x18e5fb){var _0x25b019=typeof _0x619724[_0x59a5('0x18')]===_0x59a5('0x19')&&typeof _0x619724['limit']===_0x59a5('0x19');var _0xe4fee1=_0x18e5fb[_0x59a5('0x1a')];var _0x44ef9a=_0x25b019?0x0:_0x619724['offset'];var _0x415f38=_0x25b019?_0x18e5fb[_0x59a5('0x1a')]:_0x619724[_0x59a5('0x18')]+_0x619724[_0x59a5('0x1b')];var _0x46a0f8;if(_0x415f38>=_0xe4fee1){_0x415f38=_0xe4fee1;_0x46a0f8=0xc8;}else{_0x46a0f8=0xce;}_0x312f16['status'](_0x46a0f8);return _0x312f16[_0x59a5('0x1c')](_0x59a5('0x1d'),_0x44ef9a+'-'+_0x415f38+'/'+_0xe4fee1)[_0x59a5('0x17')](_0x18e5fb);}return null;};}function patchUpdates(_0x4feb84){return function(_0x4bbe3f){try{jsonpatch[_0x59a5('0x1e')](_0x4bbe3f,_0x4feb84,!![]);}catch(_0x51fe04){return BPromise[_0x59a5('0x1f')](_0x51fe04);}return _0x4bbe3f[_0x59a5('0x20')]();};}function saveUpdates(_0x2ab3e1,_0x3c6208){return function(_0x536339){if(_0x536339){return _0x536339[_0x59a5('0x21')](_0x2ab3e1)[_0x59a5('0x22')](function(_0x285a62){return _0x285a62;});}return null;};}function removeEntity(_0x26007d,_0x3a9ab0){return function(_0x53865c){if(_0x53865c){return _0x53865c[_0x59a5('0x23')]()[_0x59a5('0x22')](function(){_0x26007d[_0x59a5('0x15')](0xcc)[_0x59a5('0x16')]();});}};}function handleEntityNotFound(_0x5b8f10,_0x5981c0){return function(_0x1667a4){if(!_0x1667a4){_0x5b8f10[_0x59a5('0x14')](0x194);}return _0x1667a4;};}function handleError(_0x4e46f5,_0x3fb821){_0x3fb821=_0x3fb821||0x1f4;return function(_0x4e43cd){logger[_0x59a5('0x24')](_0x4e43cd[_0x59a5('0x25')]);if(_0x4e43cd[_0x59a5('0x26')]){delete _0x4e43cd[_0x59a5('0x26')];}_0x4e46f5[_0x59a5('0x15')](_0x3fb821)['send'](_0x4e43cd);};}exports['index']=function(_0x5bd23f,_0x456049){var _0x2c9160={},_0x5eacd6={},_0x5d93c3={'count':0x0,'rows':[]};var _0x4d37f5=_[_0x59a5('0x27')](db[_0x59a5('0x28')]['rawAttributes'],function(_0x39da62){return{'name':_0x39da62[_0x59a5('0x29')],'type':_0x39da62[_0x59a5('0x2a')][_0x59a5('0x2b')]};});_0x5eacd6[_0x59a5('0x2c')]=_[_0x59a5('0x27')](_0x4d37f5,_0x59a5('0x26'));_0x5eacd6['query']=_[_0x59a5('0x2d')](_0x5bd23f[_0x59a5('0x2e')]);_0x5eacd6[_0x59a5('0x2f')]=_['intersection'](_0x5eacd6['model'],_0x5eacd6[_0x59a5('0x2e')]);_0x2c9160[_0x59a5('0x30')]=_[_0x59a5('0x31')](_0x5eacd6[_0x59a5('0x2c')],qs[_0x59a5('0x32')](_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x32')]));_0x2c9160['attributes']=_0x2c9160[_0x59a5('0x30')]['length']?_0x2c9160[_0x59a5('0x30')]:_0x5eacd6[_0x59a5('0x2c')];if(!_0x5bd23f['query'][_0x59a5('0x33')](_0x59a5('0x34'))){_0x2c9160['limit']=qs[_0x59a5('0x1b')](_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x1b')]);_0x2c9160[_0x59a5('0x18')]=qs[_0x59a5('0x18')](_0x5bd23f[_0x59a5('0x2e')]['offset']);}_0x2c9160[_0x59a5('0x35')]=qs[_0x59a5('0x36')](_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x36')]);_0x2c9160['where']=qs[_0x59a5('0x2f')](_[_0x59a5('0x37')](_0x5bd23f[_0x59a5('0x2e')],_0x5eacd6[_0x59a5('0x2f')]),_0x4d37f5);if(_0x5bd23f['query'][_0x59a5('0x38')]){_0x2c9160[_0x59a5('0x39')]=_[_0x59a5('0x3a')](_0x2c9160[_0x59a5('0x39')],{'$or':_[_0x59a5('0x27')](_0x4d37f5,function(_0x5b6c87){if(_0x5b6c87[_0x59a5('0x2a')]!==_0x59a5('0x3b')){var _0xab0cfa={};_0xab0cfa[_0x5b6c87['name']]={'$like':'%'+_0x5bd23f[_0x59a5('0x2e')]['filter']+'%'};return _0xab0cfa;}})});}_0x2c9160=_[_0x59a5('0x3a')]({},_0x2c9160,_0x5bd23f[_0x59a5('0x3c')]);var _0x4afb12={'where':_0x2c9160[_0x59a5('0x39')]};return db[_0x59a5('0x28')][_0x59a5('0x1a')](_0x4afb12)[_0x59a5('0x22')](function(_0x936088){_0x5d93c3[_0x59a5('0x1a')]=_0x936088;if(_0x5bd23f[_0x59a5('0x2e')][_0x59a5('0x3d')]){_0x2c9160[_0x59a5('0x3e')]=[{'all':!![]}];}return db[_0x59a5('0x28')][_0x59a5('0x3f')](_0x2c9160);})[_0x59a5('0x22')](function(_0x5d4c3f){_0x5d93c3[_0x59a5('0x40')]=_0x5d4c3f;return _0x5d93c3;})[_0x59a5('0x22')](respondWithFilteredResult(_0x456049,_0x2c9160))['catch'](handleError(_0x456049,null));};exports[_0x59a5('0x41')]=function(_0x1d1d97,_0x5169e3){var _0x599409={'raw':!![],'where':{'id':_0x1d1d97[_0x59a5('0x42')]['id']}},_0x331cde={};_0x331cde[_0x59a5('0x2c')]=_[_0x59a5('0x2d')](db[_0x59a5('0x28')][_0x59a5('0x43')]);_0x331cde[_0x59a5('0x2e')]=_['keys'](_0x1d1d97[_0x59a5('0x2e')]);_0x331cde[_0x59a5('0x2f')]=_['intersection'](_0x331cde[_0x59a5('0x2c')],_0x331cde[_0x59a5('0x2e')]);_0x599409[_0x59a5('0x30')]=_['intersection'](_0x331cde['model'],qs[_0x59a5('0x32')](_0x1d1d97[_0x59a5('0x2e')][_0x59a5('0x32')]));_0x599409[_0x59a5('0x30')]=_0x599409[_0x59a5('0x30')][_0x59a5('0x44')]?_0x599409[_0x59a5('0x30')]:_0x331cde[_0x59a5('0x2c')];if(_0x1d1d97['query']['includeAll']){_0x599409[_0x59a5('0x3e')]=[{'all':!![]}];}_0x599409=_[_0x59a5('0x3a')]({},_0x599409,_0x1d1d97[_0x59a5('0x3c')]);return db['WhatsappTransferReport'][_0x59a5('0x45')](_0x599409)[_0x59a5('0x22')](handleEntityNotFound(_0x5169e3,null))[_0x59a5('0x22')](respondWithResult(_0x5169e3,null))[_0x59a5('0x46')](handleError(_0x5169e3,null));};exports['create']=function(_0x8dab8e,_0x430999){return db[_0x59a5('0x28')][_0x59a5('0x47')](_0x8dab8e[_0x59a5('0x48')],{})['then'](respondWithResult(_0x430999,0xc9))[_0x59a5('0x46')](handleError(_0x430999,null));};exports['update']=function(_0x23ee0e,_0x4e191e){if(_0x23ee0e[_0x59a5('0x48')]['id']){delete _0x23ee0e['body']['id'];}return db[_0x59a5('0x28')][_0x59a5('0x45')]({'where':{'id':_0x23ee0e[_0x59a5('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e191e,null))['then'](saveUpdates(_0x23ee0e[_0x59a5('0x48')],null))[_0x59a5('0x22')](respondWithResult(_0x4e191e,null))[_0x59a5('0x46')](handleError(_0x4e191e,null));};exports[_0x59a5('0x23')]=function(_0x4c3e00,_0x192a5a){return db[_0x59a5('0x28')][_0x59a5('0x45')]({'where':{'id':_0x4c3e00[_0x59a5('0x42')]['id']}})[_0x59a5('0x22')](handleEntityNotFound(_0x192a5a,null))[_0x59a5('0x22')](removeEntity(_0x192a5a,null))[_0x59a5('0x46')](handleError(_0x192a5a,null));};exports['describe']=function(_0x416d3f,_0x2d8771){return db[_0x59a5('0x28')][_0x59a5('0x49')]()[_0x59a5('0x22')](respondWithResult(_0x2d8771,null))[_0x59a5('0x46')](handleError(_0x2d8771,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 5ae8148..7bf9809 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 _0x0ead=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer'];(function(_0x466f51,_0x1393ed){var _0x2db305=function(_0x126ae3){while(--_0x126ae3){_0x466f51['push'](_0x466f51['shift']());}};_0x2db305(++_0x1393ed);}(_0x0ead,0x175));var _0xd0ea=function(_0x522084,_0x4d98b6){_0x522084=_0x522084-0x0;var _0x519c7c=_0x0ead[_0x522084];return _0x519c7c;};'use strict';var _=require(_0xd0ea('0x0'));var util=require(_0xd0ea('0x1'));var logger=require(_0xd0ea('0x2'))(_0xd0ea('0x3'));var moment=require('moment');var BPromise=require(_0xd0ea('0x4'));var rp=require(_0xd0ea('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0ea('0x6'));var attributes=require(_0xd0ea('0x7'));module['exports']=function(_0x2abe39,_0x3b1296){return _0x2abe39[_0xd0ea('0x8')](_0xd0ea('0x9'),attributes,{'tableName':_0xd0ea('0xa'),'paranoid':![],'indexes':[{'name':_0xd0ea('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x9942=['moment','request-promise','path','rimraf','./whatsappTransferReport.attributes','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x9942,0x64));var _0x2994=function(_0x22d19d,_0x379051){_0x22d19d=_0x22d19d-0x0;var _0x103fc2=_0x9942[_0x22d19d];return _0x103fc2;};'use strict';var _=require(_0x2994('0x0'));var util=require(_0x2994('0x1'));var logger=require(_0x2994('0x2'))(_0x2994('0x3'));var moment=require(_0x2994('0x4'));var BPromise=require('bluebird');var rp=require(_0x2994('0x5'));var fs=require('fs');var path=require(_0x2994('0x6'));var rimraf=require(_0x2994('0x7'));var config=require('../../config/environment');var attributes=require(_0x2994('0x8'));module[_0x2994('0x9')]=function(_0x44a27d,_0x545c78){return _0x44a27d[_0x2994('0xa')]('WhatsappTransferReport',attributes,{'tableName':_0x2994('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x2994('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 1e8092d..d0a8fbc 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 _0x0686=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0686,0x1a3));var _0x6068=function(_0x5b71ef,_0x4e59dd){_0x5b71ef=_0x5b71ef-0x0;var _0x5302cb=_0x0686[_0x5b71ef];return _0x5302cb;};'use strict';var _=require('lodash');var util=require(_0x6068('0x0'));var moment=require(_0x6068('0x1'));var BPromise=require(_0x6068('0x2'));var rs=require(_0x6068('0x3'));var fs=require('fs');var Redis=require(_0x6068('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6068('0x5'));var logger=require(_0x6068('0x6'))(_0x6068('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6068('0x8')][_0x6068('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x248bd3,_0x2eee1d,_0x5dd74a){return new BPromise(function(_0x1cfc71,_0x378630){return client[_0x6068('0xa')](_0x248bd3,_0x5dd74a)[_0x6068('0xb')](function(_0x4297f0){logger[_0x6068('0xc')](_0x6068('0xd'),_0x2eee1d,_0x6068('0xe'));logger['debug'](_0x6068('0xf'),_0x2eee1d,_0x6068('0xe'),JSON[_0x6068('0x10')](_0x4297f0));if(_0x4297f0[_0x6068('0x11')]){if(_0x4297f0[_0x6068('0x11')][_0x6068('0x12')]===0x1f4){logger['error'](_0x6068('0xd'),_0x2eee1d,_0x4297f0['error'][_0x6068('0x13')]);return _0x378630(_0x4297f0[_0x6068('0x11')][_0x6068('0x13')]);}logger[_0x6068('0x11')](_0x6068('0xd'),_0x2eee1d,_0x4297f0[_0x6068('0x11')][_0x6068('0x13')]);return _0x1cfc71(_0x4297f0[_0x6068('0x11')][_0x6068('0x13')]);}else{logger[_0x6068('0xc')](_0x6068('0xd'),_0x2eee1d,_0x6068('0xe'));_0x1cfc71(_0x4297f0[_0x6068('0x14')][_0x6068('0x13')]);}})['catch'](function(_0x337c79){logger[_0x6068('0x11')](_0x6068('0xd'),_0x2eee1d,_0x337c79);_0x378630(_0x337c79);});});} \ No newline at end of file +var _0x70ce=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','lodash','moment','bluebird'];(function(_0x582ab9,_0x5f08b6){var _0x3732d3=function(_0x12b0d2){while(--_0x12b0d2){_0x582ab9['push'](_0x582ab9['shift']());}};_0x3732d3(++_0x5f08b6);}(_0x70ce,0x177));var _0xe70c=function(_0x107f17,_0x198f8c){_0x107f17=_0x107f17-0x0;var _0x1c7074=_0x70ce[_0x107f17];return _0x1c7074;};'use strict';var _=require(_0xe70c('0x0'));var util=require('util');var moment=require(_0xe70c('0x1'));var BPromise=require(_0xe70c('0x2'));var rs=require(_0xe70c('0x3'));var fs=require('fs');var Redis=require(_0xe70c('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe70c('0x5'));var logger=require(_0xe70c('0x6'))(_0xe70c('0x7'));var config=require(_0xe70c('0x8'));var jayson=require(_0xe70c('0x9'));var client=jayson[_0xe70c('0xa')][_0xe70c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3bf6cc,_0x10f943,_0x1fadab){return new BPromise(function(_0x16c0c8,_0x45a7a2){return client['request'](_0x3bf6cc,_0x1fadab)['then'](function(_0x723342){logger['info'](_0xe70c('0xc'),_0x10f943,_0xe70c('0xd'));logger[_0xe70c('0xe')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x10f943,_0xe70c('0xd'),JSON[_0xe70c('0xf')](_0x723342));if(_0x723342[_0xe70c('0x10')]){if(_0x723342[_0xe70c('0x10')]['code']===0x1f4){logger[_0xe70c('0x10')](_0xe70c('0xc'),_0x10f943,_0x723342[_0xe70c('0x10')][_0xe70c('0x11')]);return _0x45a7a2(_0x723342[_0xe70c('0x10')][_0xe70c('0x11')]);}logger[_0xe70c('0x10')](_0xe70c('0xc'),_0x10f943,_0x723342[_0xe70c('0x10')]['message']);return _0x16c0c8(_0x723342[_0xe70c('0x10')][_0xe70c('0x11')]);}else{logger[_0xe70c('0x12')]('WhatsappTransferReport,\x20%s,\x20%s',_0x10f943,_0xe70c('0xd'));_0x16c0c8(_0x723342[_0xe70c('0x13')][_0xe70c('0x11')]);}})[_0xe70c('0x14')](function(_0x25119f){logger[_0xe70c('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x10f943,_0x25119f);_0x45a7a2(_0x25119f);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index fcaca35..eaea764 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x503a=['filter','exitCode','number','length','map','pm2_env','name','online','join','Offline\x20apps:','status','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/license','./config/environment','./config/logger','app','./config/pm2','./config/pm2/config','./config/schedule/transcribe','./config/schedule/cloud-provider','sync','then','seedDB','default','info','start'];(function(_0x2a8d67,_0x5ed354){var _0xccf6c4=function(_0x16a21e){while(--_0x16a21e){_0x2a8d67['push'](_0x2a8d67['shift']());}};_0xccf6c4(++_0x5ed354);}(_0x503a,0x19d));var _0xa503=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x503a[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xa503('0x0'));var db=require(_0xa503('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xa503('0x2'));var rpc=require('./rpc');var config=require(_0xa503('0x3'));var logger=require(_0xa503('0x4'))(_0xa503('0x5'));var pm2=require(_0xa503('0x6'));var pm2Config=require(_0xa503('0x7'));var schedule=require('./config/schedule');var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xa503('0x8'));var provider=require(_0xa503('0x9'));function main(){return db['sequelize'][_0xa503('0xa')]()[_0xa503('0xb')](function(){if(config[_0xa503('0xc')]){return seedDb[_0xa503('0xd')]();}})[_0xa503('0xb')](function(){return checkLicense[_0xa503('0xd')]();})[_0xa503('0xb')](function(){return rpc['listen']();})[_0xa503('0xb')](function(_0x1f85e3){logger[_0xa503('0xe')](_0x1f85e3);return chat['start']();})[_0xa503('0xb')](function(){return whatsapp['start']();})[_0xa503('0xb')](function(){return schedule['start']();})[_0xa503('0xb')](function(){return transcribe[_0xa503('0xf')]();})['then'](function(){return provider['start']();})[_0xa503('0xb')](function(_0x1a84ba){logger[_0xa503('0xe')](_0x1a84ba);return pm2[_0xa503('0xf')](pm2Config);})[_0xa503('0xb')](function(_0x1c1971){var _0xfa3e18=_0x1c1971[_0xa503('0x10')](function(_0x3ae1b0){return typeof _0x3ae1b0[_0xa503('0x11')]===_0xa503('0x12')&&_0x3ae1b0[_0xa503('0x11')]>=0x0;});if(_0xfa3e18[_0xa503('0x13')]>0x0){throw new Error(_0xfa3e18[_0xa503('0x13')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xa503('0x14')](_0xfa3e18,function(_0x2a9557){return'\x22'+_0x2a9557[_0xa503('0x15')][_0xa503('0x16')]+'\x22';}));}logger[_0xa503('0xe')]('Online\x20apps:',_[_0xa503('0x14')](_['filter'](_0x1c1971,{'status':_0xa503('0x17')}),_0xa503('0x16'))[_0xa503('0x18')]());logger[_0xa503('0xe')](_0xa503('0x19'),_[_0xa503('0x14')](_[_0xa503('0x10')](_0x1c1971,function(_0x10486f){return _0x10486f[_0xa503('0x1a')]!==_0xa503('0x17');}),_0xa503('0x16'))[_0xa503('0x18')]()||'None');console['log'](_0xa503('0x1b'));})[_0xa503('0x1c')](function(_0x1f7abe){console[_0xa503('0x1d')](_0xa503('0x1e'),_0x1f7abe);logger['error'](_0xa503('0x1f'),_0x1f7abe);process[_0xa503('0x20')](0x1);});}main(); \ No newline at end of file +var _0x5eb8=['start','exitCode','number','length','map','name','info','Online\x20apps:','online','join','Offline\x20apps:','filter','None','log','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./config/seedDB','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','default','listen'];(function(_0x43ce41,_0x5203a1){var _0x11c797=function(_0x177251){while(--_0x177251){_0x43ce41['push'](_0x43ce41['shift']());}};_0x11c797(++_0x5203a1);}(_0x5eb8,0x1d1));var _0x85eb=function(_0x270a54,_0x307ff6){_0x270a54=_0x270a54-0x0;var _0x4d07d0=_0x5eb8[_0x270a54];return _0x4d07d0;};'use strict';var _=require('lodash');var db=require(_0x85eb('0x0'))['db'];var seedDb=require(_0x85eb('0x1'));var checkLicense=require('./config/license');var rpc=require('./rpc');var config=require(_0x85eb('0x2'));var logger=require(_0x85eb('0x3'))('app');var pm2=require(_0x85eb('0x4'));var pm2Config=require(_0x85eb('0x5'));var schedule=require(_0x85eb('0x6'));var chat=require(_0x85eb('0x7'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x85eb('0x8'));var provider=require(_0x85eb('0x9'));function main(){return db[_0x85eb('0xa')][_0x85eb('0xb')]()[_0x85eb('0xc')](function(){if(config['seedDB']){return seedDb[_0x85eb('0xd')]();}})['then'](function(){return checkLicense['default']();})[_0x85eb('0xc')](function(){return rpc[_0x85eb('0xe')]();})['then'](function(_0x51b041){logger['info'](_0x51b041);return chat['start']();})[_0x85eb('0xc')](function(){return whatsapp['start']();})[_0x85eb('0xc')](function(){return schedule[_0x85eb('0xf')]();})[_0x85eb('0xc')](function(){return transcribe[_0x85eb('0xf')]();})['then'](function(){return provider[_0x85eb('0xf')]();})[_0x85eb('0xc')](function(_0x5b2e91){logger['info'](_0x5b2e91);return pm2['start'](pm2Config);})['then'](function(_0x15f959){var _0x48e45f=_0x15f959['filter'](function(_0x4cec4e){return typeof _0x4cec4e[_0x85eb('0x10')]===_0x85eb('0x11')&&_0x4cec4e[_0x85eb('0x10')]>=0x0;});if(_0x48e45f['length']>0x0){throw new Error(_0x48e45f[_0x85eb('0x12')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0x85eb('0x13')](_0x48e45f,function(_0x50aa0d){return'\x22'+_0x50aa0d['pm2_env'][_0x85eb('0x14')]+'\x22';}));}logger[_0x85eb('0x15')](_0x85eb('0x16'),_['map'](_['filter'](_0x15f959,{'status':_0x85eb('0x17')}),_0x85eb('0x14'))[_0x85eb('0x18')]());logger['info'](_0x85eb('0x19'),_[_0x85eb('0x13')](_[_0x85eb('0x1a')](_0x15f959,function(_0x3a8be6){return _0x3a8be6['status']!=='online';}),'name')[_0x85eb('0x18')]()||_0x85eb('0x1b'));console[_0x85eb('0x1c')]('App\x20Ready!');})['catch'](function(_0x4607ce){console[_0x85eb('0x1c')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x4607ce);logger[_0x85eb('0x1d')](_0x85eb('0x1e'),_0x4607ce);process[_0x85eb('0x1f')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index bdf8cf9..ed2c376 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 _0xeb42=['smsAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','use','ChatInteraction','params','closed','disposition','query','forceDownload','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','Basic','find','then','authenticate','pass','json','Wrong\x20credentials.','user','headers','Bearer','apikey','getUuid','User','sub','Setting','findOne','blockDuration','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','generateApiKey','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','options','verify','randomBytes','toString','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','composable-middleware','basic-auth','bluebird','util','moment','secrets','session','role','fullname','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer'];(function(_0x3faf98,_0x4bfa5c){var _0x21c141=function(_0x4e556b){while(--_0x4e556b){_0x3faf98['push'](_0x3faf98['shift']());}};_0x21c141(++_0x4bfa5c);}(_0xeb42,0x1f2));var _0x2eb4=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xeb42[_0x455c6c];return _0x488242;};'use strict';var db=require(_0x2eb4('0x0'))['db'];var config=require(_0x2eb4('0x1'));var hardwareConf=require(_0x2eb4('0x2'));var licenseUtil=require(_0x2eb4('0x3'));var encryptor=require(_0x2eb4('0x4'));var _=require(_0x2eb4('0x5'));var jwt=require(_0x2eb4('0x6'));var expressJwt=require('express-jwt');var compose=require(_0x2eb4('0x7'));var basicAuth=require(_0x2eb4('0x8'));var crypto=require('crypto');var BPromise=require(_0x2eb4('0x9'));var util=require(_0x2eb4('0xa'));var moment=require(_0x2eb4('0xb'));var validateJwt=expressJwt({'secret':config[_0x2eb4('0xc')][_0x2eb4('0xd')]});var userAttributes=['id',_0x2eb4('0xe'),_0x2eb4('0xf'),'name',_0x2eb4('0x10'),_0x2eb4('0x11'),_0x2eb4('0x12'),_0x2eb4('0x13'),_0x2eb4('0x14'),_0x2eb4('0x15'),_0x2eb4('0x16'),_0x2eb4('0x17'),_0x2eb4('0x18'),_0x2eb4('0x19'),_0x2eb4('0x1a'),_0x2eb4('0x1b'),_0x2eb4('0x1c'),'lastLoginAt',_0x2eb4('0x1d'),_0x2eb4('0x1e'),_0x2eb4('0x1f'),_0x2eb4('0x20'),'alias',_0x2eb4('0x21'),_0x2eb4('0x22'),_0x2eb4('0x23'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x2eb4('0x24'),_0x2eb4('0x25'),'phoneBarPrefixRequired',_0x2eb4('0x26'),_0x2eb4('0x27'),_0x2eb4('0x28'),_0x2eb4('0x29'),'userProfileId',_0x2eb4('0x2a'),_0x2eb4('0x2b'),_0x2eb4('0x2c'),'downloadVoiceRecordings',_0x2eb4('0x2d'),_0x2eb4('0x2e'),_0x2eb4('0x2f'),_0x2eb4('0x30'),_0x2eb4('0x31'),_0x2eb4('0x32'),_0x2eb4('0x33'),_0x2eb4('0x34'),_0x2eb4('0x35'),_0x2eb4('0x36'),'openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer',_0x2eb4('0x37'),'whatsappAutoanswer',_0x2eb4('0x38'),_0x2eb4('0x39')];exports[_0x2eb4('0x3a')]=function(){return this['isAuthenticated'](!![])[_0x2eb4('0x3b')](function(_0x223456,_0x3b1a70,_0x379e42){if(_0x223456['user']){_0x379e42();}else{return db[_0x2eb4('0x3c')]['findOne']({'where':{'id':_0x223456[_0x2eb4('0x3d')]['id']},'attributes':['id',_0x2eb4('0x3e'),_0x2eb4('0x3f')],'raw':!![]})['then'](function(_0x1aed7f){if(_0x1aed7f&&_0x1aed7f['closed']&&!_0x223456[_0x2eb4('0x40')][_0x2eb4('0x41')]){return _0x3b1a70[_0x2eb4('0x42')](_0x1aed7f[_0x2eb4('0x3f')]===_0x2eb4('0x43')?0x195:0x193)['json']({'message':_0x1aed7f[_0x2eb4('0x3f')]===_0x2eb4('0x43')?_0x2eb4('0x44'):_0x2eb4('0x45')});}else{_0x379e42();}})[_0x2eb4('0x46')](function(_0x45d5ce){_0x379e42(_0x45d5ce);});}});};exports['isAuthenticated']=function isAuthenticated(_0x33748f){return compose()['use'](function(_0x2ceac5,_0xcc049a,_0x2a2500){var _0x18dbcb;if(_0x2ceac5['headers'][_0x2eb4('0x47')]){if(_[_0x2eb4('0x48')](_0x2ceac5['headers'][_0x2eb4('0x47')],_0x2eb4('0x49'))){var _0x1eb5ae=basicAuth(_0x2ceac5);db['User'][_0x2eb4('0x4a')]({'where':{'name':_0x1eb5ae['name']}})[_0x2eb4('0x4b')](function(_0x504c08){if(!_0x504c08||!_0x504c08[_0x2eb4('0x4c')](_0x1eb5ae[_0x2eb4('0x4d')])){return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x4f')});}_0x2ceac5[_0x2eb4('0x50')]={'id':_0x504c08['id']};_0x2a2500();})[_0x2eb4('0x46')](function(_0x381194){_0x2a2500(_0x381194);});}else if(_[_0x2eb4('0x48')](_0x2ceac5[_0x2eb4('0x51')][_0x2eb4('0x47')],_0x2eb4('0x52'))){validateJwt(_0x2ceac5,_0xcc049a,_0x2a2500);}else{if(_0x33748f){_0x2a2500();}else{return _0xcc049a[_0x2eb4('0x42')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x2ceac5['query'][_0x2eb4('0x53')]){try{var _0x260838={'audience':hardwareConf[_0x2eb4('0x54')](),'issuer':hardwareConf[_0x2eb4('0x54')]()};verifyJwt(_0x2ceac5[_0x2eb4('0x40')]['apikey'],_0x260838)['then'](function(_0x164dcf){return db[_0x2eb4('0x55')][_0x2eb4('0x4a')]({'where':{'id':_0x164dcf[_0x2eb4('0x56')]}})[_0x2eb4('0x4b')](function(_0x459420){_0x18dbcb=_0x459420;return db[_0x2eb4('0x57')][_0x2eb4('0x58')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0x2eb4('0x59')],'raw':!![]});})[_0x2eb4('0x4b')](function(_0x59587f){if(!_0x18dbcb||!_['isEqual'](_0x18dbcb[_0x2eb4('0x5a')],_0x164dcf[_0x2eb4('0x5b')])){return _0xcc049a[_0x2eb4('0x42')](0x191)['json']({'message':_0x2eb4('0x5c')});}if(_0x18dbcb[_0x2eb4('0x5d')]){return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x5e')});}if(_0x18dbcb['blocked']){if(_0x59587f['blockDuration']>0x0){if(moment(_0x18dbcb['blockedAt'])['add'](_0x59587f[_0x2eb4('0x59')],'minutes')>moment()){return _0xcc049a['status'](0x191)['json']({'message':_0x2eb4('0x5e')});}}else{return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x2ceac5['user']={'id':_0x18dbcb['id']};_0x2a2500();});})[_0x2eb4('0x46')](function(){return _0xcc049a[_0x2eb4('0x42')](0x191)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x5e')});});}catch(_0x3ab7d8){_0x2a2500(_0x3ab7d8);}}else if(_0x33748f){_0x2a2500();}else{return _0xcc049a[_0x2eb4('0x42')](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}})[_0x2eb4('0x3b')](function(_0x4c32c0,_0x29885d,_0x306aa6){if(_0x4c32c0[_0x2eb4('0x50')]){db['User'][_0x2eb4('0x4a')]({'where':{'id':_0x4c32c0[_0x2eb4('0x50')]['id']},'attributes':userAttributes})[_0x2eb4('0x4b')](function(_0x526e7e){if(!_0x526e7e){return _0x29885d[_0x2eb4('0x42')](0x194)['json']({'message':_0x2eb4('0x5f')});}_0x4c32c0[_0x2eb4('0x50')]=_0x526e7e;_0x306aa6();})[_0x2eb4('0x46')](function(_0x2d47d1){_0x306aa6(_0x2d47d1);});}else if(_0x33748f){_0x306aa6();}else{return _0x29885d['status'](0x194)[_0x2eb4('0x4e')]({'message':_0x2eb4('0x60')});}});};exports[_0x2eb4('0x61')]=function canUpdate(){return compose()[_0x2eb4('0x3b')](function(_0x41404c,_0x33ec9c,_0x1d05cf){return licenseUtil[_0x2eb4('0x62')]()[_0x2eb4('0x4b')](function(_0x350db9){if(_0x350db9[_0x2eb4('0x63')]){_0x1d05cf();}else{return _0x33ec9c['status'](0x193)[_0x2eb4('0x4e')]({'message':'Forbidden'});}})['catch'](function(_0x3ebfeb){_0x1d05cf(_0x3ebfeb);});});};exports[_0x2eb4('0x64')]=function isWebrtcLicence(){return compose()['use'](function(_0x56c706,_0x2fa51f,_0x1a0cfe){return licenseUtil[_0x2eb4('0x62')]()[_0x2eb4('0x4b')](function(_0x5f03a3){if(_0x5f03a3[_0x2eb4('0x65')]){_0x1a0cfe();}else{return _0x2fa51f[_0x2eb4('0x42')](0x193)['json']({'message':'Forbidden'});}})['catch'](function(_0x2b2088){_0x1a0cfe(_0x2b2088);});});};exports[_0x2eb4('0x66')]=function(_0x2283c0,_0x24b6de,_0x40f362){_0x2283c0[_0x2eb4('0x66')]=!![];return _0x40f362();};exports[_0x2eb4('0x67')]=function signToken(_0x5525a9){return signJwt(_0x5525a9);};exports[_0x2eb4('0x68')]=function(_0x39415e,_0x467c54){if(!_0x39415e['user']){return _0x467c54[_0x2eb4('0x42')](0x194)[_0x2eb4('0x4e')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x33e871={'payload':{'id':_0x39415e[_0x2eb4('0x50')]['id'],'role':_0x39415e[_0x2eb4('0x50')][_0x2eb4('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x33e871)[_0x2eb4('0x4b')](function(_0x21e405){_0x467c54[_0x2eb4('0x69')](_0x2eb4('0x6a'),_0x21e405);_0x467c54[_0x2eb4('0x6b')](_0x2eb4('0x6c'));})[_0x2eb4('0x46')](function(_0x5abf6e){return _0x467c54['status'](0x1f4)['send'](_0x5abf6e);});};exports[_0x2eb4('0x6d')]=function(_0x9bee8c){if(_[_0x2eb4('0x6e')](_0x9bee8c['apiKeyNonce'])||_[_0x2eb4('0x6e')](_0x9bee8c['apiKeyIat'])){return null;}else{return createJwt(_0x9bee8c);}};exports[_0x2eb4('0x6f')]=function(_0x5998c8){_0x5998c8[_0x2eb4('0x5a')]=generateNonce();_0x5998c8[_0x2eb4('0x70')]=generateIssuedAt();return createJwt(_0x5998c8);};exports[_0x2eb4('0x71')]=function(_0x70d4db,_0x4a07b8){var _0x47391c=_0x70d4db['query'][_0x2eb4('0x53')];if(_0x47391c){var _0x40893c={'nonce':_0x4a07b8[_0x2eb4('0x5a')],'iat':_0x4a07b8[_0x2eb4('0x70')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x47391c,_0x40893c)['then'](function(){return generateApiKey(_0x4a07b8);});}else{throw{'message':_0x2eb4('0x72')};}};exports[_0x2eb4('0x73')]=function(_0x5652b3){var _0x24606d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x24606d['test'](_0x5652b3))throw new db['Sequelize']['ValidationError'](_0x2eb4('0x74'));return;};exports['validatePasswordHistory']=function(_0x57937e,_0xe6b59,_0xc365){var _0x493f84=encryptor['decryptString'](_0xe6b59)[_0x2eb4('0x75')](',');for(var _0x5d3be0=0x0;_0x5d3be0<_0xc365;_0x5d3be0++){if(!_0x493f84[_0x5d3be0])break;if(_0x57937e[_0x2eb4('0x76')]()===_0x493f84[_0x5d3be0]['toLowerCase']()){var _0x5c6cf5=util[_0x2eb4('0x77')](_0x2eb4('0x78'),_0xc365);if(_0xc365===0x1){_0x5c6cf5=_0x2eb4('0x79');}throw new db[(_0x2eb4('0x7a'))]['ValidationError'](_0x5c6cf5);}}return;};exports[_0x2eb4('0x7b')]=function(_0x125a29,_0x465bc6){var _0x445c8a=_0x465bc6?encryptor['decryptString'](_0x465bc6)[_0x2eb4('0x75')](','):[];if(_0x445c8a[_0x2eb4('0x7c')]===0x5){_0x445c8a[_0x2eb4('0x7d')](-0x1,0x1);}_0x445c8a[_0x2eb4('0x7e')](_0x125a29);return encryptor[_0x2eb4('0x7f')](_0x445c8a[_0x2eb4('0x80')](','));};function signJwt(_0x10d014){var _0x17ebc5=BPromise[_0x2eb4('0x81')](jwt[_0x2eb4('0x82')],{'context':jwt});var _0x4ea9ea=_0x10d014[_0x2eb4('0x83')]||config[_0x2eb4('0xc')][_0x2eb4('0xd')];return new BPromise(function(_0x31ea3e,_0x2035a3){_0x17ebc5(_0x10d014['payload'],_0x4ea9ea,_0x10d014[_0x2eb4('0x84')])[_0x2eb4('0x4b')](function(_0x2fa7f7){_0x31ea3e(_0x2fa7f7);})[_0x2eb4('0x46')](function(_0xa91af6){_0x2035a3(_0xa91af6);});});}function verifyJwt(_0x1c2a6f,_0x120399,_0x54d292){var _0x152263=BPromise[_0x2eb4('0x81')](jwt[_0x2eb4('0x85')],{'context':jwt});var _0x253c84=_0x54d292||config[_0x2eb4('0xc')][_0x2eb4('0xd')];return new BPromise(function(_0x4b7d4e,_0x7ef9a){_0x152263(_0x1c2a6f,_0x253c84,_0x120399)['then'](function(_0x3f4e58){_0x4b7d4e(_0x3f4e58);})[_0x2eb4('0x46')](function(_0x526ccd){_0x7ef9a(_0x526ccd);});});}function generateNonce(){return crypto[_0x2eb4('0x86')](0x10)[_0x2eb4('0x87')]('hex');}function generateIssuedAt(){return Math[_0x2eb4('0x88')](Date[_0x2eb4('0x89')]()/0x3e8)['toString']();}function createJwt(_0x56d5bc){var _0x3f37c5={'payload':{'iat':_0x56d5bc[_0x2eb4('0x70')],'nonce':_0x56d5bc[_0x2eb4('0x5a')]},'options':{'algorithm':'HS512','subject':_0x56d5bc['id'][_0x2eb4('0x87')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x2eb4('0x54')]()}};return signJwt(_0x3f37c5)[_0x2eb4('0x4b')](function(_0x23e3df){return{'iat':_0x56d5bc[_0x2eb4('0x70')],'nonce':_0x56d5bc[_0x2eb4('0x5a')],'token':_0x23e3df};});} \ No newline at end of file +var _0x5a74=['bluebird','util','moment','secrets','fullname','name','email','userpic','permissions','md5secret','voicePause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','settingsEnabled','wssPort','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','then','closed','forceDownload','status','disposition','unmanaged','Unmanaged.','Forbidden.','catch','headers','authorization','startsWith','find','pass','json','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','User','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','user','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','update','isWebrtcLicence','Forbidden','isMiddleware','signToken','setTokenCookie','role','cookie','motion.token','redirect','/dashboards/general','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','payload','promisify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x5a74,0x118));var _0x45a7=function(_0x37b624,_0x28c3aa){_0x37b624=_0x37b624-0x0;var _0x44abd9=_0x5a74[_0x37b624];return _0x44abd9;};'use strict';var db=require(_0x45a7('0x0'))['db'];var config=require(_0x45a7('0x1'));var hardwareConf=require(_0x45a7('0x2'));var licenseUtil=require(_0x45a7('0x3'));var encryptor=require(_0x45a7('0x4'));var _=require('lodash');var jwt=require(_0x45a7('0x5'));var expressJwt=require(_0x45a7('0x6'));var compose=require(_0x45a7('0x7'));var basicAuth=require(_0x45a7('0x8'));var crypto=require(_0x45a7('0x9'));var BPromise=require(_0x45a7('0xa'));var util=require(_0x45a7('0xb'));var moment=require(_0x45a7('0xc'));var validateJwt=expressJwt({'secret':config[_0x45a7('0xd')]['session']});var userAttributes=['id','role',_0x45a7('0xe'),_0x45a7('0xf'),'internal',_0x45a7('0x10'),_0x45a7('0x11'),_0x45a7('0x12'),_0x45a7('0x13'),_0x45a7('0x14'),'chatPause',_0x45a7('0x15'),'faxPause',_0x45a7('0x16'),'openchannelPause',_0x45a7('0x17'),_0x45a7('0x18'),_0x45a7('0x19'),'lastPauseAt',_0x45a7('0x1a'),_0x45a7('0x1b'),'passwordResetAt','alias',_0x45a7('0x1c'),_0x45a7('0x1d'),_0x45a7('0x1e'),_0x45a7('0x1f'),_0x45a7('0x20'),_0x45a7('0x21'),_0x45a7('0x22'),_0x45a7('0x23'),_0x45a7('0x24'),_0x45a7('0x25'),_0x45a7('0x26'),_0x45a7('0x27'),_0x45a7('0x28'),'privacyEnabled',_0x45a7('0x29'),_0x45a7('0x2a'),'downloadVoiceRecordings',_0x45a7('0x2b'),_0x45a7('0x2c'),_0x45a7('0x2d'),_0x45a7('0x2e'),'chatAutoanswer',_0x45a7('0x2f'),_0x45a7('0x30'),_0x45a7('0x31'),_0x45a7('0x32'),_0x45a7('0x33'),_0x45a7('0x34'),_0x45a7('0x35'),_0x45a7('0x36'),'faxAutoanswerDelay',_0x45a7('0x37'),_0x45a7('0x38'),'messengerSoundNotification'];exports[_0x45a7('0x39')]=function(){return this[_0x45a7('0x3a')](!![])[_0x45a7('0x3b')](function(_0x2839c7,_0x296889,_0x5cf64f){if(_0x2839c7['user']){_0x5cf64f();}else{return db[_0x45a7('0x3c')][_0x45a7('0x3d')]({'where':{'id':_0x2839c7[_0x45a7('0x3e')]['id']},'attributes':['id','closed','disposition'],'raw':!![]})[_0x45a7('0x3f')](function(_0x1a25dc){if(_0x1a25dc&&_0x1a25dc[_0x45a7('0x40')]&&!_0x2839c7['query'][_0x45a7('0x41')]){return _0x296889[_0x45a7('0x42')](_0x1a25dc[_0x45a7('0x43')]==='unmanaged'?0x195:0x193)['json']({'message':_0x1a25dc['disposition']===_0x45a7('0x44')?_0x45a7('0x45'):_0x45a7('0x46')});}else{_0x5cf64f();}})[_0x45a7('0x47')](function(_0x4b3eeb){_0x5cf64f(_0x4b3eeb);});}});};exports[_0x45a7('0x3a')]=function isAuthenticated(_0x1dce9e){return compose()['use'](function(_0x250b11,_0x206468,_0x387c32){var _0x3ea770;if(_0x250b11[_0x45a7('0x48')][_0x45a7('0x49')]){if(_[_0x45a7('0x4a')](_0x250b11[_0x45a7('0x48')][_0x45a7('0x49')],'Basic')){var _0x56974f=basicAuth(_0x250b11);db['User'][_0x45a7('0x4b')]({'where':{'name':_0x56974f['name']}})[_0x45a7('0x3f')](function(_0x51d712){if(!_0x51d712||!_0x51d712['authenticate'](_0x56974f[_0x45a7('0x4c')])){return _0x206468['status'](0x191)[_0x45a7('0x4d')]({'message':'Wrong\x20credentials.'});}_0x250b11['user']={'id':_0x51d712['id']};_0x387c32();})[_0x45a7('0x47')](function(_0x2a7dd1){_0x387c32(_0x2a7dd1);});}else if(_[_0x45a7('0x4a')](_0x250b11['headers'][_0x45a7('0x49')],_0x45a7('0x4e'))){validateJwt(_0x250b11,_0x206468,_0x387c32);}else{if(_0x1dce9e){_0x387c32();}else{return _0x206468[_0x45a7('0x42')](0x193)[_0x45a7('0x4d')]({'message':_0x45a7('0x4f')});}}}else if(_0x250b11[_0x45a7('0x50')][_0x45a7('0x51')]){try{var _0x51f348={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x45a7('0x52')]()};verifyJwt(_0x250b11[_0x45a7('0x50')][_0x45a7('0x51')],_0x51f348)['then'](function(_0x4a7262){return db[_0x45a7('0x53')]['find']({'where':{'id':_0x4a7262[_0x45a7('0x54')]}})['then'](function(_0x21b699){_0x3ea770=_0x21b699;return db[_0x45a7('0x55')][_0x45a7('0x3d')]({'where':{'id':0x1},'attributes':[_0x45a7('0x56'),_0x45a7('0x57')],'raw':!![]});})['then'](function(_0x389ecc){if(!_0x3ea770||!_[_0x45a7('0x58')](_0x3ea770[_0x45a7('0x59')],_0x4a7262[_0x45a7('0x5a')])){return _0x206468[_0x45a7('0x42')](0x191)[_0x45a7('0x4d')]({'message':_0x45a7('0x5b')});}if(_0x3ea770[_0x45a7('0x5c')]){return _0x206468[_0x45a7('0x42')](0x191)[_0x45a7('0x4d')]({'message':_0x45a7('0x5d')});}if(_0x3ea770[_0x45a7('0x5e')]){if(_0x389ecc[_0x45a7('0x57')]>0x0){if(moment(_0x3ea770[_0x45a7('0x5f')])['add'](_0x389ecc[_0x45a7('0x57')],'minutes')>moment()){return _0x206468['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x206468['status'](0x191)[_0x45a7('0x4d')]({'message':_0x45a7('0x5d')});}}_0x250b11['user']={'id':_0x3ea770['id']};_0x387c32();});})[_0x45a7('0x47')](function(){return _0x206468['status'](0x191)['json']({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x5c536c){_0x387c32(_0x5c536c);}}else if(_0x1dce9e){_0x387c32();}else{return _0x206468[_0x45a7('0x42')](0x193)[_0x45a7('0x4d')]({'message':_0x45a7('0x4f')});}})[_0x45a7('0x3b')](function(_0x5804af,_0x375776,_0x2ba199){if(_0x5804af[_0x45a7('0x60')]){db[_0x45a7('0x53')]['find']({'where':{'id':_0x5804af['user']['id']},'attributes':userAttributes})[_0x45a7('0x3f')](function(_0x11644b){if(!_0x11644b){return _0x375776[_0x45a7('0x42')](0x194)[_0x45a7('0x4d')]({'message':_0x45a7('0x61')});}_0x5804af[_0x45a7('0x60')]=_0x11644b;_0x2ba199();})[_0x45a7('0x47')](function(_0x17e330){_0x2ba199(_0x17e330);});}else if(_0x1dce9e){_0x2ba199();}else{return _0x375776['status'](0x194)[_0x45a7('0x4d')]({'message':_0x45a7('0x62')});}});};exports[_0x45a7('0x63')]=function canUpdate(){return compose()[_0x45a7('0x3b')](function(_0x3d9c8b,_0x87ffc2,_0x5c66b4){return licenseUtil[_0x45a7('0x64')]()[_0x45a7('0x3f')](function(_0x84fddd){if(_0x84fddd[_0x45a7('0x65')]){_0x5c66b4();}else{return _0x87ffc2['status'](0x193)[_0x45a7('0x4d')]({'message':'Forbidden'});}})[_0x45a7('0x47')](function(_0x4ad853){_0x5c66b4(_0x4ad853);});});};exports[_0x45a7('0x66')]=function isWebrtcLicence(){return compose()[_0x45a7('0x3b')](function(_0x289987,_0x1e0d82,_0x4d2de9){return licenseUtil[_0x45a7('0x64')]()[_0x45a7('0x3f')](function(_0x473651){if(_0x473651['webrtc']){_0x4d2de9();}else{return _0x1e0d82['status'](0x193)[_0x45a7('0x4d')]({'message':_0x45a7('0x67')});}})[_0x45a7('0x47')](function(_0x198f1){_0x4d2de9(_0x198f1);});});};exports[_0x45a7('0x68')]=function(_0x24fab2,_0x321a89,_0x5e4db3){_0x24fab2[_0x45a7('0x68')]=!![];return _0x5e4db3();};exports[_0x45a7('0x69')]=function signToken(_0x3ca3f2){return signJwt(_0x3ca3f2);};exports[_0x45a7('0x6a')]=function(_0x302273,_0xdb77d9){if(!_0x302273[_0x45a7('0x60')]){return _0xdb77d9['status'](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x403dd4={'payload':{'id':_0x302273[_0x45a7('0x60')]['id'],'role':_0x302273[_0x45a7('0x60')][_0x45a7('0x6b')]},'options':{'expiresIn':0x15180}};return signJwt(_0x403dd4)[_0x45a7('0x3f')](function(_0x3428e1){_0xdb77d9[_0x45a7('0x6c')](_0x45a7('0x6d'),_0x3428e1);_0xdb77d9[_0x45a7('0x6e')](_0x45a7('0x6f'));})[_0x45a7('0x47')](function(_0x37e035){return _0xdb77d9[_0x45a7('0x42')](0x1f4)['send'](_0x37e035);});};exports[_0x45a7('0x70')]=function(_0xb45c03){if(_[_0x45a7('0x71')](_0xb45c03[_0x45a7('0x59')])||_['isNil'](_0xb45c03[_0x45a7('0x72')])){return null;}else{return createJwt(_0xb45c03);}};exports[_0x45a7('0x73')]=function(_0x2a98ab){_0x2a98ab[_0x45a7('0x59')]=generateNonce();_0x2a98ab[_0x45a7('0x72')]=generateIssuedAt();return createJwt(_0x2a98ab);};exports[_0x45a7('0x74')]=function(_0x2f96a7,_0x2cc0c7){var _0x1ec5e9=_0x2f96a7[_0x45a7('0x50')][_0x45a7('0x51')];if(_0x1ec5e9){var _0x2a8b06={'nonce':_0x2cc0c7[_0x45a7('0x59')],'iat':_0x2cc0c7['apiKeyIat'],'audience':hardwareConf[_0x45a7('0x52')](),'issuer':hardwareConf[_0x45a7('0x52')]()};return verifyJwt(_0x1ec5e9,_0x2a8b06)['then'](function(){return generateApiKey(_0x2cc0c7);});}else{throw{'message':_0x45a7('0x75')};}};exports['validatePasswordPattern']=function(_0x3aae98){var _0x2fe731=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x2fe731[_0x45a7('0x76')](_0x3aae98))throw new db[(_0x45a7('0x77'))][(_0x45a7('0x78'))](_0x45a7('0x79'));return;};exports[_0x45a7('0x7a')]=function(_0xd3f9c9,_0x2b8e8b,_0x56a24c){var _0xfe57aa=encryptor[_0x45a7('0x7b')](_0x2b8e8b)[_0x45a7('0x7c')](',');for(var _0x206c35=0x0;_0x206c35<_0x56a24c;_0x206c35++){if(!_0xfe57aa[_0x206c35])break;if(_0xd3f9c9[_0x45a7('0x7d')]()===_0xfe57aa[_0x206c35]['toLowerCase']()){var _0x505b65=util[_0x45a7('0x7e')](_0x45a7('0x7f'),_0x56a24c);if(_0x56a24c===0x1){_0x505b65='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x45a7('0x77'))][(_0x45a7('0x78'))](_0x505b65);}}return;};exports[_0x45a7('0x80')]=function(_0x20ab2c,_0x520867){var _0x2ec6d4=_0x520867?encryptor[_0x45a7('0x7b')](_0x520867)['split'](','):[];if(_0x2ec6d4[_0x45a7('0x81')]===0x5){_0x2ec6d4[_0x45a7('0x82')](-0x1,0x1);}_0x2ec6d4[_0x45a7('0x83')](_0x20ab2c);return encryptor[_0x45a7('0x84')](_0x2ec6d4[_0x45a7('0x85')](','));};function signJwt(_0x19149d){var _0x549ba3=BPromise['promisify'](jwt[_0x45a7('0x86')],{'context':jwt});var _0x9a415e=_0x19149d[_0x45a7('0x87')]||config['secrets'][_0x45a7('0x88')];return new BPromise(function(_0x2ac7eb,_0x2a850f){_0x549ba3(_0x19149d[_0x45a7('0x89')],_0x9a415e,_0x19149d['options'])[_0x45a7('0x3f')](function(_0x3fb616){_0x2ac7eb(_0x3fb616);})[_0x45a7('0x47')](function(_0x4f3aff){_0x2a850f(_0x4f3aff);});});}function verifyJwt(_0x4a7df0,_0x1c864b,_0x5061da){var _0x2c66b8=BPromise[_0x45a7('0x8a')](jwt['verify'],{'context':jwt});var _0x401139=_0x5061da||config[_0x45a7('0xd')]['session'];return new BPromise(function(_0x608d83,_0x1fbf41){_0x2c66b8(_0x4a7df0,_0x401139,_0x1c864b)['then'](function(_0x7ae26f){_0x608d83(_0x7ae26f);})[_0x45a7('0x47')](function(_0x4c47bb){_0x1fbf41(_0x4c47bb);});});}function generateNonce(){return crypto[_0x45a7('0x8b')](0x10)[_0x45a7('0x8c')](_0x45a7('0x8d'));}function generateIssuedAt(){return Math[_0x45a7('0x8e')](Date[_0x45a7('0x8f')]()/0x3e8)[_0x45a7('0x8c')]();}function createJwt(_0x3e9829){var _0x4009f6={'payload':{'iat':_0x3e9829['apiKeyIat'],'nonce':_0x3e9829[_0x45a7('0x59')]},'options':{'algorithm':_0x45a7('0x90'),'subject':_0x3e9829['id'][_0x45a7('0x8c')](),'issuer':hardwareConf[_0x45a7('0x52')](),'audience':hardwareConf[_0x45a7('0x52')]()}};return signJwt(_0x4009f6)[_0x45a7('0x3f')](function(_0x4ef08d){return{'iat':_0x3e9829[_0x45a7('0x72')],'nonce':_0x3e9829['apiKeyNonce'],'token':_0x4ef08d};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 54911e2..3a50dbe 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 _0xc7e3=['parseQueryParameters','where','default','fields','filter','user','tags','ids','countFilteredContacts','count','buildContactsQuery','clause','getFilteredContacts','catch','describe','CmContact','keys','startsWith','CmCustomField','findOne','slice','length','cf_','type','map','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','search'];(function(_0x281457,_0x5d9e3c){var _0x2dea1e=function(_0x42aca8){while(--_0x42aca8){_0x281457['push'](_0x281457['shift']());}};_0x2dea1e(++_0x5d9e3c);}(_0xc7e3,0x14f));var _0x3c7e=function(_0x512c83,_0x42a67a){_0x512c83=_0x512c83-0x0;var _0x1f7f25=_0xc7e3[_0x512c83];return _0x1f7f25;};'use strict';var _=require('lodash');var sqlUtils=require(_0x3c7e('0x0'));var db=require(_0x3c7e('0x1'))['db'];exports['findAll']=function(_0x50f16c,_0x102062,_0x1d7032,_0x3f077b){var _0x31b97c={'count':0x0,'rows':[]};var _0x1e77b2=sqlUtils[_0x3c7e('0x2')](_0x102062,_0x50f16c);if(_0x1e77b2){return Promise[_0x3c7e('0x3')](_0x31b97c);}var _0x4636bb=sqlUtils['getContactsSubquery']();var _0x3cefa3={};var _0x58ab7b=![];var _0x3cdf8d=![];return Promise['resolve']()[_0x3c7e('0x4')](function(){if(_0x50f16c[_0x3c7e('0x5')]){return sqlUtils['parseAdvancedSearchFilter'](_0x50f16c[_0x3c7e('0x5')],_0x3f077b);}else{return sqlUtils[_0x3c7e('0x6')](_0x50f16c,_0x3f077b);}})[_0x3c7e('0x4')](function(_0x3ba051){_0x4636bb[_0x3c7e('0x7')](_0x3ba051[_0x3c7e('0x8')]);_0x4636bb[_0x3c7e('0x7')](_0x3ba051[_0x3c7e('0x9')]);_0x4636bb[_0x3c7e('0x7')](_0x3ba051[_0x3c7e('0xa')]);_0x4636bb['where'](_0x3ba051[_0x3c7e('0xb')]['clause']);_0x3cefa3=_0x3ba051[_0x3c7e('0xc')];_0x3cdf8d=_0x3ba051['user']['skip'];return sqlUtils['checkListsRestrictions'](_0x102062,_0x50f16c,_0x3cdf8d);})['then'](function(_0x577d76){_0x4636bb[_0x3c7e('0x7')](_0x577d76);var _0xe1087=_0x50f16c['search']?_0x3cefa3[_0x3c7e('0xd')]:_0x50f16c['tag'];_0x58ab7b=_0xe1087?!![]:![];return sqlUtils[_0x3c7e('0xe')](_0x4636bb,_0xe1087);})['then'](function(_0x3b69bb){_0x31b97c['count']=_0x3b69bb;if(_0x31b97c[_0x3c7e('0xf')]===0x0){return;}if(_0x50f16c['User']){_0x3cdf8d=!![];}return sqlUtils[_0x3c7e('0x10')](_0x4636bb,_0x50f16c[_0x3c7e('0x9')],_0x1d7032,_0x58ab7b,_0x3cefa3[_0x3c7e('0x11')],_0x3cdf8d);})['then'](function(_0x2c3fa2){if(!_0x2c3fa2){return[];}return sqlUtils[_0x3c7e('0x12')](_0x2c3fa2,_0x50f16c,_0x1d7032);})[_0x3c7e('0x4')](function(_0x46c508){_0x31b97c['rows']=_0x46c508;return _0x31b97c;})[_0x3c7e('0x13')](function(_0x5563c2){throw _0x5563c2;});};exports[_0x3c7e('0x14')]=function(){var _0x3dc767={};var _0x16d6b3=[];return db[_0x3c7e('0x15')][_0x3c7e('0x14')]()[_0x3c7e('0x4')](function(_0x3117b7){_0x3dc767=_0x3117b7;var _0xb16615=Object[_0x3c7e('0x16')](_0x3dc767)['filter'](function(_0x28012a){return _[_0x3c7e('0x17')](_0x28012a,'cf_')?_0x28012a:undefined;});var _0x2f9f41=_0xb16615['map'](function(_0x29fd1c){return db[_0x3c7e('0x18')][_0x3c7e('0x19')]({'where':{'id':_0x29fd1c[_0x3c7e('0x1a')](0x3)},'raw':!![]});});return Promise['all'](_0x2f9f41);})[_0x3c7e('0x4')](function(_0x5980ba){for(var _0x36733a=0x0;_0x36733a<_0x5980ba[_0x3c7e('0x1b')];_0x36733a++){if(_0x5980ba[_0x36733a]){var _0x3943c5=_0x3c7e('0x1c')+_0x5980ba[_0x36733a]['id'];_0x3dc767[_0x3943c5]['fieldType']=_0x5980ba[_0x36733a][_0x3c7e('0x1d')];}}_0x16d6b3=_[_0x3c7e('0x1e')](Object['keys'](_0x3dc767),function(_0x27ca31){return{'name':_0x27ca31,'type':_0x3dc767[_0x27ca31]['type']};});return _0x16d6b3;})[_0x3c7e('0x13')](function(_0x1bf6e9){throw _0x1bf6e9;});}; \ No newline at end of file +var _0xe3bc=['user','clause','tags','checkListsRestrictions','then','ids','tag','countFilteredContacts','count','fields','rows','catch','describe','CmContact','keys','startsWith','CmCustomField','findOne','slice','all','cf_','fieldType','type','lodash','./sql-utils','../../mysqldb','findAll','skipContactsQuery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter'];(function(_0x54ed8e,_0x3106ab){var _0x12443e=function(_0x43832e){while(--_0x43832e){_0x54ed8e['push'](_0x54ed8e['shift']());}};_0x12443e(++_0x3106ab);}(_0xe3bc,0x1de));var _0xce3b=function(_0x41c74e,_0x1917d7){_0x41c74e=_0x41c74e-0x0;var _0x4f5f6a=_0xe3bc[_0x41c74e];return _0x4f5f6a;};'use strict';var _=require(_0xce3b('0x0'));var sqlUtils=require(_0xce3b('0x1'));var db=require(_0xce3b('0x2'))['db'];exports[_0xce3b('0x3')]=function(_0x5e06bf,_0x59fdd3,_0x4b9468,_0x4f6fbd){var _0x174210={'count':0x0,'rows':[]};var _0x6d98d9=sqlUtils[_0xce3b('0x4')](_0x59fdd3,_0x5e06bf);if(_0x6d98d9){return Promise['resolve'](_0x174210);}var _0x4e1fe8=sqlUtils['getContactsSubquery']();var _0x53c18d={};var _0x55d3b6=![];var _0x286a87=![];return Promise[_0xce3b('0x5')]()['then'](function(){if(_0x5e06bf[_0xce3b('0x6')]){return sqlUtils[_0xce3b('0x7')](_0x5e06bf['search'],_0x4f6fbd);}else{return sqlUtils[_0xce3b('0x8')](_0x5e06bf,_0x4f6fbd);}})['then'](function(_0x59c760){_0x4e1fe8[_0xce3b('0x9')](_0x59c760[_0xce3b('0xa')]);_0x4e1fe8[_0xce3b('0x9')](_0x59c760['fields']);_0x4e1fe8[_0xce3b('0x9')](_0x59c760[_0xce3b('0xb')]);_0x4e1fe8[_0xce3b('0x9')](_0x59c760[_0xce3b('0xc')][_0xce3b('0xd')]);_0x53c18d=_0x59c760[_0xce3b('0xe')];_0x286a87=_0x59c760[_0xce3b('0xc')]['skip'];return sqlUtils[_0xce3b('0xf')](_0x59fdd3,_0x5e06bf,_0x286a87);})[_0xce3b('0x10')](function(_0xb4b727){_0x4e1fe8[_0xce3b('0x9')](_0xb4b727);var _0x51d502=_0x5e06bf[_0xce3b('0x6')]?_0x53c18d[_0xce3b('0x11')]:_0x5e06bf[_0xce3b('0x12')];_0x55d3b6=_0x51d502?!![]:![];return sqlUtils[_0xce3b('0x13')](_0x4e1fe8,_0x51d502);})['then'](function(_0x260b5b){_0x174210[_0xce3b('0x14')]=_0x260b5b;if(_0x174210[_0xce3b('0x14')]===0x0){return;}if(_0x5e06bf['User']){_0x286a87=!![];}return sqlUtils['buildContactsQuery'](_0x4e1fe8,_0x5e06bf[_0xce3b('0x15')],_0x4b9468,_0x55d3b6,_0x53c18d['clause'],_0x286a87);})['then'](function(_0x2c2457){if(!_0x2c2457){return[];}return sqlUtils['getFilteredContacts'](_0x2c2457,_0x5e06bf,_0x4b9468);})[_0xce3b('0x10')](function(_0x2d9c83){_0x174210[_0xce3b('0x16')]=_0x2d9c83;return _0x174210;})[_0xce3b('0x17')](function(_0x389b4e){throw _0x389b4e;});};exports[_0xce3b('0x18')]=function(){var _0x55d0d1={};var _0xfd4ad0=[];return db[_0xce3b('0x19')][_0xce3b('0x18')]()[_0xce3b('0x10')](function(_0x30bf9b){_0x55d0d1=_0x30bf9b;var _0x464cf7=Object[_0xce3b('0x1a')](_0x55d0d1)[_0xce3b('0xb')](function(_0x1231f8){return _[_0xce3b('0x1b')](_0x1231f8,'cf_')?_0x1231f8:undefined;});var _0x3c1ce1=_0x464cf7['map'](function(_0xec9369){return db[_0xce3b('0x1c')][_0xce3b('0x1d')]({'where':{'id':_0xec9369[_0xce3b('0x1e')](0x3)},'raw':!![]});});return Promise[_0xce3b('0x1f')](_0x3c1ce1);})[_0xce3b('0x10')](function(_0x5f23c5){for(var _0x1ee300=0x0;_0x1ee300<_0x5f23c5['length'];_0x1ee300++){if(_0x5f23c5[_0x1ee300]){var _0xd000bf=_0xce3b('0x20')+_0x5f23c5[_0x1ee300]['id'];_0x55d0d1[_0xd000bf][_0xce3b('0x21')]=_0x5f23c5[_0x1ee300][_0xce3b('0x22')];}}_0xfd4ad0=_['map'](Object[_0xce3b('0x1a')](_0x55d0d1),function(_0x44cce){return{'name':_0x44cce,'type':_0x55d0d1[_0x44cce][_0xce3b('0x22')]};});return _0xfd4ad0;})[_0xce3b('0x17')](function(_0x555c93){throw _0x555c93;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index 71c4211..b14d108 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 _0xd09e=['Tag','split','map','tags','clause','and','ids','User','user','uc.UserId\x20=\x20?','skip','some','compact','Contact','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','length','attributes','group','limit','offset','having','order','DESC','subqry.','findAll','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','t.id\x20IN\x20?','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','search','ListId','autocomplete','true','select','from','where','c.deletedAt\x20IS\x20NULL','left_join','cm_user_has_contacts','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','subqry','firstName','phone','mobile','fax','email','CompanyId','updatedAt','TagIds','includes','push','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd09e,0x9c));var _0xed09=function(_0x380ccf,_0x112e26){_0x380ccf=_0x380ccf-0x0;var _0x5c04a0=_0xd09e[_0x380ccf];return _0x5c04a0;};'use strict';var _=require(_0xed09('0x0'));var squel=require(_0xed09('0x1'));var as=require(_0xed09('0x2'));var qs=require(_0xed09('0x3'));var utils=require(_0xed09('0x4'));var db=require(_0xed09('0x5'))['db'];function skipContactsQuery(_0x575ea1,_0x5e0acc){var _0x451e7e=![];if(_0x575ea1[_0xed09('0x6')]===_0xed09('0x7')&&!_0x5e0acc[_0xed09('0x8')]&&!_0x5e0acc[_0xed09('0x9')]&&_0x5e0acc[_0xed09('0xa')]!==_0xed09('0xb')){_0x451e7e=!![];}return _0x451e7e;}function getContactsSubquery(){return squel[_0xed09('0xc')]()[_0xed09('0xd')]('cm_contacts','c')[_0xed09('0xe')](_0xed09('0xf'));}function applyJoinClauses(_0x2c8999,_0x1d61c1){var _0x47237d=_0x1d61c1?'c':'subqry';_0x2c8999[_0xed09('0x10')](_0xed09('0x11'),'uc','uc.CmContactId\x20=\x20'+_0x47237d+_0xed09('0x12'))[_0xed09('0x10')](_0xed09('0x13'),'ct',_0xed09('0x14')+_0x47237d+_0xed09('0x12'))[_0xed09('0x10')](_0xed09('0x15'),'t','t.id\x20=\x20ct.TagId');return _0x2c8999;}function addFieldsToQuery(_0x21591d,_0x4c3e40,_0x38b2c9,_0x42221d,_0x535d2d){var _0xb993ca=_0x535d2d?'c':_0xed09('0x16');if(!_0x4c3e40){_0x4c3e40=['id',_0xed09('0x17'),'lastName',_0xed09('0x18'),_0xed09('0x19'),_0xed09('0x1a'),_0xed09('0x1b'),'ListId',_0xed09('0x1c'),'createdAt',_0xed09('0x1d'),'deletedAt',_0xed09('0x1e')];}else if(!_0x4c3e40[_0xed09('0x1f')]('id')){_0x4c3e40[_0xed09('0x20')]('id');}var _0x203f0a=_0x38b2c9&&_0x535d2d||!_0x38b2c9&&!_0x535d2d;if(_0x42221d){_0x203f0a=_0x42221d&&_0x535d2d||!_0x42221d&&!_0x535d2d;}_0x4c3e40[_0xed09('0x21')](function(_0x23efea){if(_0x23efea===_0xed09('0x1e')){if(_0x203f0a){_0x21591d['field'](_0xed09('0x22'),_0x23efea);}else if(_0x38b2c9||_0x42221d){_0x21591d[_0xed09('0x23')](_0xb993ca+'.'+_0x23efea);}}else{_0x21591d[_0xed09('0x23')](_0xb993ca+'.'+_0x23efea);}});return _0x21591d;}function getSqlClauses(){var _0x580d74={'default':squel[_0xed09('0x24')](),'fields':squel[_0xed09('0x24')](),'filter':squel['expr'](),'tags':{'clause':squel[_0xed09('0x24')](),'ids':null},'user':{'clause':squel[_0xed09('0x24')](),'skip':![]}};return _0x580d74;}function parseTagParameter(_0x3d6c1c){var _0x3b2c2c=squel[_0xed09('0x24')]();if(_0x3d6c1c){var _0x9aedb6=utils[_0xed09('0x25')](_0x3d6c1c);_0x9aedb6[_0xed09('0x21')](function(_0x20f8b9){_0x3b2c2c['or'](_0xed09('0x26'),'%,'+_0x20f8b9+',%');});}return _0x3b2c2c;}function parseSearchFilter(_0x68c488){var _0x12f2cb=squel[_0xed09('0x24')]();if(_0x68c488){var _0x60f2f5=_0x68c488[_0xed09('0x27')]('\x5c','\x5c\x5c')[_0xed09('0x27')](/'/g,'\x27\x27');var _0x308a8b=qs[_0xed09('0x28')](_0x60f2f5);if(_0x60f2f5['split']('\x20')['length']>0x1){_0x12f2cb['or'](_0xed09('0x29'),qs[_0xed09('0x2a')](_0x60f2f5,!![]),null);}else{if(qs['isNumeric'](_0x60f2f5)){_0x12f2cb['or'](_0xed09('0x2b'),_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x2c'),_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x2d'),_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x2e'),_0x308a8b+'%');}else if(qs[_0xed09('0x2f')](_0x60f2f5)){_0x12f2cb['or'](_0xed09('0x30'),_0x308a8b+'%');}else{_0x12f2cb['or']('c.firstName\x20LIKE\x20?','%'+_0x308a8b+'%');_0x12f2cb['or'](_0xed09('0x31'),'%'+_0x308a8b+'%');_0x12f2cb['or']('c.email\x20LIKE\x20?','%'+_0x308a8b+'%');}}}return _0x12f2cb;}function parseAdvancedSearchFilter(_0x43d94a,_0x25d5ca){var _0x5daf12=getSqlClauses();var _0xc0531e=as['parseSearch'](_0x43d94a);var _0x2a5f09=_0xc0531e[_0xed09('0x32')];for(var _0x123497=0x0;_0x123497<_0xc0531e[_0xed09('0x33')]['length'];_0x123497++){var _0x5a7598=_0xc0531e[_0xed09('0x33')][_0x123497];var _0x285b1f='c';var _0x458a64=_[_0xed09('0x34')](_0x25d5ca,[_0xed09('0x35'),_0x5a7598[_0xed09('0x23')]]);if(_0x458a64){if(_0x5a7598[_0xed09('0x23')]===_0xed09('0x36')||_0x458a64[_0xed09('0x37')]===_0xed09('0x38')){_0x5a7598[_0xed09('0x39')]=_0xed09('0x3a');}var _0x4bfdc7=as[_0xed09('0x3b')](_0x285b1f,_0x458a64[_0xed09('0x3c')],_0x5a7598);_0x5daf12[_0xed09('0x3d')][_0x2a5f09](_0x4bfdc7[_0xed09('0x3e')],_0x4bfdc7[_0xed09('0x3f')][_0xed09('0x40')],_0x4bfdc7[_0xed09('0x3f')][_0xed09('0x41')]);}else{if(_0x5a7598[_0xed09('0x23')]===_0xed09('0x42')){var _0x4f7421=_0x5a7598['value'][_0xed09('0x43')](',')[_0xed09('0x44')](function(_0x36d753){return Number(_0x36d753);});var _0x29de95=parseTagParameter(_0x4f7421);_0x5daf12[_0xed09('0x45')][_0xed09('0x46')][_0xed09('0x47')](_0x29de95);_0x5daf12[_0xed09('0x45')][_0xed09('0x48')]=_0x4f7421;}else if(_0x5a7598['field']===_0xed09('0x49')){_0x5daf12[_0xed09('0x4a')][_0xed09('0x46')][_0xed09('0x47')](_0xed09('0x4b'),_0x5a7598['value']);_0x5daf12['user'][_0xed09('0x4c')]=!![];}}}return _0x5daf12;}function parseModelFields(_0x3d1838,_0x34a178){var _0x182f57=squel[_0xed09('0x24')]();var _0x485ae3=_(_0x3d1838)['keys']()[_0xed09('0x44')](function(_0x20e242){return _[_0xed09('0x4d')](_0x34a178,[_0xed09('0x35'),_0x20e242])?_0x20e242:undefined;})[_0xed09('0x4e')]()[_0xed09('0x3f')]();if(_0x3d1838[_0xed09('0x4f')]){_0x485ae3[_0xed09('0x20')]('Contact');}if(_0x3d1838[_0xed09('0x49')]){_0x485ae3['push'](_0xed09('0x49'));}if(_0x485ae3['length']>0x0){_0x485ae3[_0xed09('0x21')](function(_0x277faa){if(_0x277faa==='ListId'){_0x182f57[_0xed09('0x47')](_0xed09('0x50'),[]['concat'](_0x3d1838[_0x277faa]));}else if(_0x277faa==='Contact'){var _0x3dac93='%'+_0x3d1838[_0x277faa]+'%';_0x182f57[_0xed09('0x47')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0x3dac93);}else if(_0x277faa==='User'){_0x182f57['and'](_0xed09('0x4b'),_0x3d1838[_0x277faa]);}else{_0x182f57[_0xed09('0x47')]('c.'+_0x277faa+_0xed09('0x51'),_0x3d1838[_0x277faa]);}});}return _0x182f57;}function parseQueryParameters(_0x53622e,_0x16a38f){var _0x2c44e9=getSqlClauses();return Promise[_0xed09('0x52')]()[_0xed09('0x53')](function(){return parseModelFields(_0x53622e,_0x16a38f);})[_0xed09('0x53')](function(_0x55d21e){_0x2c44e9[_0xed09('0x54')][_0xed09('0x47')](_0x55d21e);return parseTagParameter(_0x53622e[_0xed09('0x55')]);})['then'](function(_0x22831a){_0x2c44e9[_0xed09('0x45')][_0xed09('0x46')][_0xed09('0x47')](_0x22831a);return parseSearchFilter(_0x53622e['filter']);})[_0xed09('0x53')](function(_0x4ac426){_0x2c44e9[_0xed09('0x56')]=_0x4ac426;return _0x2c44e9;});}function checkListsRestrictions(_0x3b8af7,_0x4e5e7c,_0x3eb26c){var _0x16b01f=squel['expr']();return Promise['resolve']()[_0xed09('0x53')](function(){if(_0x4e5e7c[_0xed09('0x8')]&&_0x3b8af7['role']==='agent'&&!_0x3eb26c){return _0x3b8af7[_0xed09('0x57')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x274bfa){if(_0x274bfa){if(_0x274bfa[_0xed09('0x58')]===0x0){_0x16b01f['and']('c.ListId\x20IS\x20NULL');}else{_0x16b01f[_0xed09('0x47')](_0xed09('0x50'),_[_0xed09('0x44')](_0x274bfa,'id'));}}})[_0xed09('0x53')](function(){return _0x16b01f;});}function buildContactsQuery(_0x3ee3ac,_0x556ec7,_0x3edfbe,_0x1cf2e6,_0x30cb24,_0x3f3922){if(_0x556ec7){_0x556ec7=_0x3edfbe[_0xed09('0x59')];}_0x3ee3ac=addFieldsToQuery(_0x3ee3ac,_0x556ec7,_0x1cf2e6,_0x3f3922,!![]);var _0x251603=squel['select']();_0x251603=addFieldsToQuery(_0x251603,_0x556ec7,_0x1cf2e6,_0x3f3922,![]);if(_0x1cf2e6||_0x3f3922){_0x3ee3ac=applyJoinClauses(_0x3ee3ac,!![]);_0x3ee3ac[_0xed09('0x5a')]('c.id');if(_0x3edfbe[_0xed09('0x5b')]){_0x251603[_0xed09('0x5b')](_0x3edfbe[_0xed09('0x5b')]);}if(_0x3edfbe[_0xed09('0x5c')]){_0x251603[_0xed09('0x5c')](_0x3edfbe[_0xed09('0x5c')]);}}else{_0x251603=applyJoinClauses(_0x251603,![]);_0x251603[_0xed09('0x5a')]('subqry.id');if(_0x3edfbe['limit']){_0x3ee3ac[_0xed09('0x5b')](_0x3edfbe[_0xed09('0x5b')]);}if(_0x3edfbe[_0xed09('0x5c')]){_0x3ee3ac[_0xed09('0x5c')](_0x3edfbe['offset']);}}_0x251603[_0xed09('0x5d')](_0x30cb24);if(_0x3edfbe[_0xed09('0x5e')]){_0x3edfbe[_0xed09('0x5e')][_0xed09('0x21')](function(_0x157fa2){_0x3ee3ac[_0xed09('0x5e')]('c.'+_0x157fa2[0x0],_0x157fa2[0x1]===_0xed09('0x5f')?![]:!![]);_0x251603[_0xed09('0x5e')](_0xed09('0x60')+_0x157fa2[0x0],_0x157fa2[0x1]===_0xed09('0x5f')?![]:!![]);});}_0x251603[_0xed09('0xd')](_0x3ee3ac,_0xed09('0x16'));return _0x251603;}function getFilteredContacts(_0x224a4a){var _0x120d43=[];return db[_0xed09('0x42')][_0xed09('0x61')]({'attributes':['id','name','color'],'raw':!![]})[_0xed09('0x53')](function(_0x3befc3){_0x120d43=_[_0xed09('0x62')](_0x3befc3,'id');var _0x3634b2={'type':db[_0xed09('0x63')][_0xed09('0x64')][_0xed09('0x65')],'model':db[_0xed09('0x66')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xed09('0x67')][_0xed09('0x68')](_0x224a4a[_0xed09('0x69')](),_0x3634b2);})[_0xed09('0x53')](function(_0x55a3a6){_0x55a3a6[_0xed09('0x21')](function(_0xf7b55e){if(_0xf7b55e[_0xed09('0x1e')]){_0xf7b55e[_0xed09('0x6a')]=[];_0xf7b55e['TagIds'][_0xed09('0x43')](',')['forEach'](function(_0x417ef9){_0xf7b55e[_0xed09('0x6a')][_0xed09('0x20')](_0x120d43[_0x417ef9]);});}delete _0xf7b55e[_0xed09('0x1e')];});return _0x55a3a6;});}function countFilteredContacts(_0x233e60,_0x28da0b){var _0x2a02ff=_0x233e60[_0xed09('0x6b')]();_0x2a02ff[_0xed09('0x23')]('COUNT(*)');_0x2a02ff=applyJoinClauses(_0x2a02ff,!![]);_0x233e60[_0xed09('0x5a')]('c.id');var _0x5c30ac=utils['getSelectedTags'](_0x28da0b);if(!_['isEmpty'](_0x5c30ac)){_0x2a02ff[_0xed09('0xe')](_0xed09('0x6c'),_0x5c30ac);}var _0x241e87={'type':db[_0xed09('0x63')]['QueryTypes'][_0xed09('0x65')],'raw':!![]};return db['sequelize']['query'](_0x2a02ff['toString'](),_0x241e87)[_0xed09('0x53')](function(_0x9b1784){return _0x9b1784[0x0][_0xed09('0x6d')];});}module[_0xed09('0x6e')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x4578=['castTo','buildExpression','type','text','start','end','Tag','value','map','clause','and','ids','user','skip','keys','some','compact','Contact','push','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','fields','tag','then','filter','search','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','../interaction/utils','agent','ListId','true','select','where','subqry','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20','tools_tags','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','fax','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','escapeLIKESpecialChars','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.firstName\x20LIKE\x20?','c.email\x20LIKE\x20?','parseSearch','conditions','find','name','dateOfBirth','fieldType','datetime'];(function(_0x5dd9d1,_0x52619f){var _0x4a773c=function(_0x5abd68){while(--_0x5abd68){_0x5dd9d1['push'](_0x5dd9d1['shift']());}};_0x4a773c(++_0x52619f);}(_0x4578,0x1f3));var _0x8457=function(_0x3231e8,_0x41df58){_0x3231e8=_0x3231e8-0x0;var _0x13a897=_0x4578[_0x3231e8];return _0x13a897;};'use strict';var _=require(_0x8457('0x0'));var squel=require('squel');var as=require(_0x8457('0x1'));var qs=require(_0x8457('0x2'));var utils=require(_0x8457('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x10357d,_0x47e2be){var _0x3dc3a8=![];if(_0x10357d['role']===_0x8457('0x4')&&!_0x47e2be['search']&&!_0x47e2be[_0x8457('0x5')]&&_0x47e2be['autocomplete']!==_0x8457('0x6')){_0x3dc3a8=!![];}return _0x3dc3a8;}function getContactsSubquery(){return squel[_0x8457('0x7')]()['from']('cm_contacts','c')[_0x8457('0x8')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0xd5896,_0x568a04){var _0x5e6c36=_0x568a04?'c':_0x8457('0x9');_0xd5896['left_join'](_0x8457('0xa'),'uc',_0x8457('0xb')+_0x5e6c36+_0x8457('0xc'))[_0x8457('0xd')](_0x8457('0xe'),'ct',_0x8457('0xf')+_0x5e6c36+_0x8457('0xc'))['left_join'](_0x8457('0x10'),'t',_0x8457('0x11'));return _0xd5896;}function addFieldsToQuery(_0x2d5ef0,_0x10a4ad,_0x2502d9,_0x135c4a,_0x447fea){var _0x1b1f6d=_0x447fea?'c':'subqry';if(!_0x10a4ad){_0x10a4ad=['id',_0x8457('0x12'),_0x8457('0x13'),_0x8457('0x14'),_0x8457('0x15'),_0x8457('0x16'),'email',_0x8457('0x5'),_0x8457('0x17'),_0x8457('0x18'),_0x8457('0x19'),_0x8457('0x1a'),_0x8457('0x1b')];}else if(!_0x10a4ad[_0x8457('0x1c')]('id')){_0x10a4ad['push']('id');}var _0x16f1c6=_0x2502d9&&_0x447fea||!_0x2502d9&&!_0x447fea;if(_0x135c4a){_0x16f1c6=_0x135c4a&&_0x447fea||!_0x135c4a&&!_0x447fea;}_0x10a4ad[_0x8457('0x1d')](function(_0x1b0feb){if(_0x1b0feb===_0x8457('0x1b')){if(_0x16f1c6){_0x2d5ef0[_0x8457('0x1e')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1b0feb);}else if(_0x2502d9||_0x135c4a){_0x2d5ef0[_0x8457('0x1e')](_0x1b1f6d+'.'+_0x1b0feb);}}else{_0x2d5ef0['field'](_0x1b1f6d+'.'+_0x1b0feb);}});return _0x2d5ef0;}function getSqlClauses(){var _0x4d885d={'default':squel[_0x8457('0x1f')](),'fields':squel['expr'](),'filter':squel[_0x8457('0x1f')](),'tags':{'clause':squel[_0x8457('0x1f')](),'ids':null},'user':{'clause':squel[_0x8457('0x1f')](),'skip':![]}};return _0x4d885d;}function parseTagParameter(_0xdafe6f){var _0x4f4dcf=squel['expr']();if(_0xdafe6f){var _0x1fdd72=utils[_0x8457('0x20')](_0xdafe6f);_0x1fdd72[_0x8457('0x1d')](function(_0x2960da){_0x4f4dcf['or'](_0x8457('0x21'),'%,'+_0x2960da+',%');});}return _0x4f4dcf;}function parseSearchFilter(_0x52d809){var _0x1e0904=squel[_0x8457('0x1f')]();if(_0x52d809){var _0x3e47a8=_0x52d809[_0x8457('0x22')]('\x5c','\x5c\x5c')[_0x8457('0x22')](/'/g,'\x27\x27');var _0x3b08d1=qs[_0x8457('0x23')](_0x3e47a8);if(_0x3e47a8[_0x8457('0x24')]('\x20')[_0x8457('0x25')]>0x1){_0x1e0904['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8457('0x26')](_0x3e47a8,!![]),null);}else{if(qs['isNumeric'](_0x3e47a8)){_0x1e0904['or'](_0x8457('0x27'),_0x3b08d1+'%');_0x1e0904['or']('c.phone\x20LIKE\x20?',_0x3b08d1+'%');_0x1e0904['or'](_0x8457('0x28'),_0x3b08d1+'%');_0x1e0904['or']('c.fax\x20LIKE\x20?',_0x3b08d1+'%');}else if(qs[_0x8457('0x29')](_0x3e47a8)){_0x1e0904['or']('c.email\x20LIKE\x20?',_0x3b08d1+'%');}else{_0x1e0904['or'](_0x8457('0x2a'),'%'+_0x3b08d1+'%');_0x1e0904['or']('c.lastName\x20LIKE\x20?','%'+_0x3b08d1+'%');_0x1e0904['or'](_0x8457('0x2b'),'%'+_0x3b08d1+'%');}}}return _0x1e0904;}function parseAdvancedSearchFilter(_0x5d6a47,_0x119c27){var _0x3c1d3f=getSqlClauses();var _0x1125ae=as[_0x8457('0x2c')](_0x5d6a47);var _0x4663fc=_0x1125ae['sqlOperator'];for(var _0x76bc88=0x0;_0x76bc88<_0x1125ae[_0x8457('0x2d')][_0x8457('0x25')];_0x76bc88++){var _0x12481d=_0x1125ae[_0x8457('0x2d')][_0x76bc88];var _0x47fa8b='c';var _0x2b45ca=_[_0x8457('0x2e')](_0x119c27,[_0x8457('0x2f'),_0x12481d[_0x8457('0x1e')]]);if(_0x2b45ca){if(_0x12481d['field']===_0x8457('0x30')||_0x2b45ca[_0x8457('0x31')]===_0x8457('0x32')){_0x12481d[_0x8457('0x33')]='DATE';}var _0xcdf9a6=as[_0x8457('0x34')](_0x47fa8b,_0x2b45ca[_0x8457('0x35')],_0x12481d);_0x3c1d3f['default'][_0x4663fc](_0xcdf9a6[_0x8457('0x36')],_0xcdf9a6['value'][_0x8457('0x37')],_0xcdf9a6['value'][_0x8457('0x38')]);}else{if(_0x12481d[_0x8457('0x1e')]===_0x8457('0x39')){var _0xaefd0d=_0x12481d[_0x8457('0x3a')][_0x8457('0x24')](',')[_0x8457('0x3b')](function(_0x3cf3d5){return Number(_0x3cf3d5);});var _0x2d4c9d=parseTagParameter(_0xaefd0d);_0x3c1d3f['tags'][_0x8457('0x3c')][_0x8457('0x3d')](_0x2d4c9d);_0x3c1d3f['tags'][_0x8457('0x3e')]=_0xaefd0d;}else if(_0x12481d[_0x8457('0x1e')]==='User'){_0x3c1d3f['user'][_0x8457('0x3c')][_0x8457('0x3d')]('uc.UserId\x20=\x20?',_0x12481d[_0x8457('0x3a')]);_0x3c1d3f[_0x8457('0x3f')][_0x8457('0x40')]=!![];}}}return _0x3c1d3f;}function parseModelFields(_0xc9a2e3,_0x3d75cc){var _0x588102=squel['expr']();var _0x6cc823=_(_0xc9a2e3)[_0x8457('0x41')]()['map'](function(_0x204779){return _[_0x8457('0x42')](_0x3d75cc,[_0x8457('0x2f'),_0x204779])?_0x204779:undefined;})[_0x8457('0x43')]()[_0x8457('0x3a')]();if(_0xc9a2e3[_0x8457('0x44')]){_0x6cc823[_0x8457('0x45')]('Contact');}if(_0xc9a2e3[_0x8457('0x46')]){_0x6cc823['push'](_0x8457('0x46'));}if(_0x6cc823['length']>0x0){_0x6cc823[_0x8457('0x1d')](function(_0x45b8f1){if(_0x45b8f1===_0x8457('0x5')){_0x588102['and'](_0x8457('0x47'),[][_0x8457('0x48')](_0xc9a2e3[_0x45b8f1]));}else if(_0x45b8f1==='Contact'){var _0x28b6cb='%'+_0xc9a2e3[_0x45b8f1]+'%';_0x588102['and'](_0x8457('0x49'),_0x28b6cb);}else if(_0x45b8f1===_0x8457('0x46')){_0x588102[_0x8457('0x3d')]('uc.UserId\x20=\x20?',_0xc9a2e3[_0x45b8f1]);}else{_0x588102[_0x8457('0x3d')]('c.'+_0x45b8f1+_0x8457('0x4a'),_0xc9a2e3[_0x45b8f1]);}});}return _0x588102;}function parseQueryParameters(_0x22d78b,_0x113db2){var _0x435b77=getSqlClauses();return Promise[_0x8457('0x4b')]()['then'](function(){return parseModelFields(_0x22d78b,_0x113db2);})['then'](function(_0xfd0fa5){_0x435b77[_0x8457('0x4c')][_0x8457('0x3d')](_0xfd0fa5);return parseTagParameter(_0x22d78b[_0x8457('0x4d')]);})[_0x8457('0x4e')](function(_0x2eb950){_0x435b77['tags'][_0x8457('0x3c')][_0x8457('0x3d')](_0x2eb950);return parseSearchFilter(_0x22d78b['filter']);})[_0x8457('0x4e')](function(_0x4a1f3c){_0x435b77[_0x8457('0x4f')]=_0x4a1f3c;return _0x435b77;});}function checkListsRestrictions(_0x18fbb5,_0x195915,_0x3a0298){var _0x293fa6=squel['expr']();return Promise[_0x8457('0x4b')]()[_0x8457('0x4e')](function(){if(_0x195915[_0x8457('0x50')]&&_0x18fbb5['role']==='agent'&&!_0x3a0298){return _0x18fbb5[_0x8457('0x51')]({'attributes':['id'],'raw':!![]});}})[_0x8457('0x4e')](function(_0x333bb1){if(_0x333bb1){if(_0x333bb1['length']===0x0){_0x293fa6[_0x8457('0x3d')](_0x8457('0x52'));}else{_0x293fa6[_0x8457('0x3d')](_0x8457('0x47'),_[_0x8457('0x3b')](_0x333bb1,'id'));}}})['then'](function(){return _0x293fa6;});}function buildContactsQuery(_0x240935,_0x10091d,_0x46448a,_0x3c1108,_0x2587e4,_0x166a4d){if(_0x10091d){_0x10091d=_0x46448a[_0x8457('0x53')];}_0x240935=addFieldsToQuery(_0x240935,_0x10091d,_0x3c1108,_0x166a4d,!![]);var _0x54f67f=squel['select']();_0x54f67f=addFieldsToQuery(_0x54f67f,_0x10091d,_0x3c1108,_0x166a4d,![]);if(_0x3c1108||_0x166a4d){_0x240935=applyJoinClauses(_0x240935,!![]);_0x240935[_0x8457('0x54')](_0x8457('0x55'));if(_0x46448a['limit']){_0x54f67f['limit'](_0x46448a[_0x8457('0x56')]);}if(_0x46448a[_0x8457('0x57')]){_0x54f67f[_0x8457('0x57')](_0x46448a[_0x8457('0x57')]);}}else{_0x54f67f=applyJoinClauses(_0x54f67f,![]);_0x54f67f[_0x8457('0x54')](_0x8457('0x58'));if(_0x46448a[_0x8457('0x56')]){_0x240935[_0x8457('0x56')](_0x46448a['limit']);}if(_0x46448a[_0x8457('0x57')]){_0x240935['offset'](_0x46448a['offset']);}}_0x54f67f[_0x8457('0x59')](_0x2587e4);if(_0x46448a[_0x8457('0x5a')]){_0x46448a['order'][_0x8457('0x1d')](function(_0x2b5f45){_0x240935[_0x8457('0x5a')]('c.'+_0x2b5f45[0x0],_0x2b5f45[0x1]===_0x8457('0x5b')?![]:!![]);_0x54f67f['order'](_0x8457('0x5c')+_0x2b5f45[0x0],_0x2b5f45[0x1]==='DESC'?![]:!![]);});}_0x54f67f[_0x8457('0x5d')](_0x240935,_0x8457('0x9'));return _0x54f67f;}function getFilteredContacts(_0x11cb5e){var _0x53b83c=[];return db[_0x8457('0x39')][_0x8457('0x5e')]({'attributes':['id',_0x8457('0x2f'),_0x8457('0x5f')],'raw':!![]})[_0x8457('0x4e')](function(_0xe7a7b1){_0x53b83c=_[_0x8457('0x60')](_0xe7a7b1,'id');var _0xfa3813={'type':db[_0x8457('0x61')][_0x8457('0x62')][_0x8457('0x63')],'model':db[_0x8457('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x8457('0x65')][_0x8457('0x66')](_0x11cb5e[_0x8457('0x67')](),_0xfa3813);})[_0x8457('0x4e')](function(_0x438d84){_0x438d84[_0x8457('0x1d')](function(_0x2a7c34){if(_0x2a7c34[_0x8457('0x1b')]){_0x2a7c34[_0x8457('0x68')]=[];_0x2a7c34['TagIds'][_0x8457('0x24')](',')[_0x8457('0x1d')](function(_0x23a074){_0x2a7c34[_0x8457('0x68')][_0x8457('0x45')](_0x53b83c[_0x23a074]);});}delete _0x2a7c34['TagIds'];});return _0x438d84;});}function countFilteredContacts(_0x4a6bd1,_0x255d71){var _0x226f77=_0x4a6bd1[_0x8457('0x69')]();_0x226f77['field'](_0x8457('0x6a'));_0x226f77=applyJoinClauses(_0x226f77,!![]);_0x4a6bd1[_0x8457('0x54')]('c.id');var _0x1628aa=utils['getSelectedTags'](_0x255d71);if(!_[_0x8457('0x6b')](_0x1628aa)){_0x226f77[_0x8457('0x8')](_0x8457('0x6c'),_0x1628aa);}var _0x14dfdb={'type':db['Sequelize'][_0x8457('0x62')][_0x8457('0x63')],'raw':!![]};return db[_0x8457('0x65')][_0x8457('0x66')](_0x226f77[_0x8457('0x67')](),_0x14dfdb)[_0x8457('0x4e')](function(_0x2767c5){return _0x2767c5[0x0][_0x8457('0x6a')];});}module[_0x8457('0x6d')]={'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 79a6ec8..e48f27b 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 _0x5893=['data','update','binary','write','end','close','unlink','decryptFile','createDecipher','final','encryptString','secret','createCipher','base64','decryptString','utf8','bluebird','../../config/logger','session','aes-256-ctr','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','encryptFile','createReadStream','createWriteStream'];(function(_0x224f43,_0x3ac2b1){var _0x39a831=function(_0x330450){while(--_0x330450){_0x224f43['push'](_0x224f43['shift']());}};_0x39a831(++_0x3ac2b1);}(_0x5893,0x146));var _0x3589=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x5893[_0x4565bf];return _0x5610ba;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x3589('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x3589('0x1'))('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0x3589('0x2')],'algorithm':_0x3589('0x3')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config[_0x3589('0x4')][_0x3589('0x5')]){var isSupported=isAlgorithmSupported(config['encrypt']['algorithm']);if(isSupported){fileOptions[_0x3589('0x5')]=config[_0x3589('0x4')][_0x3589('0x5')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x3589('0x6')](',\x20');logger[_0x3589('0x7')](config[_0x3589('0x4')][_0x3589('0x5')],_0x3589('0x8'),supportedAlgorithms);}}function isASupportedCipher(_0x58a70f){return AES_SUPPORTED_RX[_0x3589('0x9')](_0x58a70f);}function getSupportedCiphers(){return crypto[_0x3589('0xa')]()[_0x3589('0xb')](isASupportedCipher);}function isAlgorithmSupported(_0x585d16){return getSupportedCiphers()['indexOf'](_0x585d16)>-0x1;}function combineOptions(_0x5e804e){var _0x3d088e={};for(var _0x3130f0 in fileOptions){if(fileOptions['hasOwnProperty'](_0x3130f0)){_0x3d088e[_0x3130f0]=fileOptions[_0x3130f0];}}if(_0x5e804e){for(var _0x38b26b in _0x5e804e){if(_0x5e804e['hasOwnProperty'](_0x38b26b)){_0x3d088e[_0x38b26b]=_0x5e804e[_0x38b26b];}}}return _0x3d088e;}exports[_0x3589('0xc')]=function(_0x41e8e4,_0x8c0efc,_0x477d59,_0x344904){return new BPromise(function(_0x32df1f,_0x470880){_0x344904=combineOptions(_0x344904);var _0x212958=new Buffer(_0x477d59);var _0x218a38=fs[_0x3589('0xd')](_0x41e8e4);var _0x27b7b7=fs[_0x3589('0xe')](_0x8c0efc);var _0x1cf5be=crypto['createCipher'](_0x344904[_0x3589('0x5')],_0x212958);_0x218a38['on'](_0x3589('0xf'),function(_0x402d12){var _0x258b3c=new Buffer(_0x1cf5be[_0x3589('0x10')](_0x402d12),_0x3589('0x11'));_0x27b7b7[_0x3589('0x12')](_0x258b3c);});_0x218a38['on'](_0x3589('0x13'),function(){try{var _0x22446a=new Buffer(_0x1cf5be['final'](_0x3589('0x11')),_0x3589('0x11'));_0x27b7b7[_0x3589('0x12')](_0x22446a);_0x27b7b7[_0x3589('0x13')]();_0x27b7b7['on'](_0x3589('0x14'),function(){return _0x32df1f(_0x8c0efc);});}catch(_0x2c600d){fs[_0x3589('0x15')](_0x8c0efc);return _0x470880(_0x2c600d);}});});};exports[_0x3589('0x16')]=function(_0x1d0f24,_0x5d564f,_0x14db89,_0xeeb5b2){return new BPromise(function(_0x1a43e7,_0x5330f6){_0xeeb5b2=combineOptions(_0xeeb5b2);var _0xcdbb2b=new Buffer(_0x14db89);var _0x4b5772=fs[_0x3589('0xd')](_0x1d0f24);var _0x3f40cb=fs[_0x3589('0xe')](_0x5d564f);var _0x1cec76=crypto[_0x3589('0x17')](_0xeeb5b2[_0x3589('0x5')],_0xcdbb2b);_0x4b5772['on'](_0x3589('0xf'),function(_0x8e1336){var _0x43c496=new Buffer(_0x1cec76['update'](_0x8e1336),_0x3589('0x11'));_0x3f40cb['write'](_0x43c496);});_0x4b5772['on'](_0x3589('0x13'),function(){try{var _0x20221a=new Buffer(_0x1cec76[_0x3589('0x18')](_0x3589('0x11')),'binary');_0x3f40cb[_0x3589('0x12')](_0x20221a);_0x3f40cb[_0x3589('0x13')]();_0x3f40cb['on'](_0x3589('0x14'),function(){return _0x1a43e7(_0x5d564f);});}catch(_0x5823fd){fs[_0x3589('0x15')](_0x5d564f);return _0x5330f6(_0x5823fd);}});});};exports[_0x3589('0x19')]=function(_0x5a04fb,_0x5eb645,_0x1d4f09){var _0x5c49b4=_0x1d4f09||stringOptions[_0x3589('0x5')];var _0x5ab40c=_0x5eb645||stringOptions[_0x3589('0x1a')];var _0x2e3e38=crypto[_0x3589('0x1b')](_0x5c49b4,_0x5ab40c);var _0x385cbc=_0x2e3e38[_0x3589('0x10')](_0x5a04fb,'utf8',_0x3589('0x1c'));_0x385cbc+=_0x2e3e38[_0x3589('0x18')](_0x3589('0x1c'));return _0x385cbc;};exports[_0x3589('0x1d')]=function(_0x4ec75d,_0x5c63d9,_0x3596cf){var _0xed6f7=_0x3596cf||stringOptions[_0x3589('0x5')];var _0x269037=_0x5c63d9||stringOptions[_0x3589('0x1a')];var _0x231ff7=crypto[_0x3589('0x17')](_0xed6f7,_0x269037);var _0x2fcc70=_0x231ff7[_0x3589('0x10')](_0x4ec75d,'base64',_0x3589('0x1e'));_0x2fcc70+=_0x231ff7['final'](_0x3589('0x1e'));return _0x2fcc70;}; \ No newline at end of file +var _0x40e8=['encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','update','write','end','final','binary','close','decryptFile','data','unlink','secret','utf8','base64','decryptString','bluebird','lodash','../../config/environment','../../config/logger','app','secrets','session','aes-256-ctr','aes192'];(function(_0x4f712f,_0x595559){var _0x238bce=function(_0x3b3f22){while(--_0x3b3f22){_0x4f712f['push'](_0x4f712f['shift']());}};_0x238bce(++_0x595559);}(_0x40e8,0x183));var _0x840e=function(_0x879e31,_0x139d02){_0x879e31=_0x879e31-0x0;var _0x3467e8=_0x40e8[_0x879e31];return _0x3467e8;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x840e('0x0'));var _=require(_0x840e('0x1'));var config=require(_0x840e('0x2'));var logger=require(_0x840e('0x3'))(_0x840e('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x840e('0x5')][_0x840e('0x6')],'algorithm':_0x840e('0x7')};const fileOptions={'algorithm':_0x840e('0x8')};if(config['encrypt']&&config[_0x840e('0x9')][_0x840e('0xa')]){var isSupported=isAlgorithmSupported(config[_0x840e('0x9')]['algorithm']);if(isSupported){fileOptions['algorithm']=config['encrypt'][_0x840e('0xa')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x840e('0xb')](',\x20');logger[_0x840e('0xc')](config[_0x840e('0x9')][_0x840e('0xa')],_0x840e('0xd'),supportedAlgorithms);}}function isASupportedCipher(_0x58b7f1){return AES_SUPPORTED_RX[_0x840e('0xe')](_0x58b7f1);}function getSupportedCiphers(){return crypto[_0x840e('0xf')]()[_0x840e('0x10')](isASupportedCipher);}function isAlgorithmSupported(_0x168493){return getSupportedCiphers()[_0x840e('0x11')](_0x168493)>-0x1;}function combineOptions(_0x373b26){var _0x2c3393={};for(var _0x192cb6 in fileOptions){if(fileOptions['hasOwnProperty'](_0x192cb6)){_0x2c3393[_0x192cb6]=fileOptions[_0x192cb6];}}if(_0x373b26){for(var _0x4ced7b in _0x373b26){if(_0x373b26[_0x840e('0x12')](_0x4ced7b)){_0x2c3393[_0x4ced7b]=_0x373b26[_0x4ced7b];}}}return _0x2c3393;}exports[_0x840e('0x13')]=function(_0xbe8fa5,_0x2209a8,_0x429033,_0x29bde9){return new BPromise(function(_0x2b9286,_0x53eb86){_0x29bde9=combineOptions(_0x29bde9);var _0x4a9586=new Buffer(_0x429033);var _0x2ea09b=fs[_0x840e('0x14')](_0xbe8fa5);var _0x2b8da1=fs[_0x840e('0x15')](_0x2209a8);var _0x463626=crypto[_0x840e('0x16')](_0x29bde9[_0x840e('0xa')],_0x4a9586);_0x2ea09b['on']('data',function(_0x3265c8){var _0x48b034=new Buffer(_0x463626[_0x840e('0x17')](_0x3265c8),'binary');_0x2b8da1[_0x840e('0x18')](_0x48b034);});_0x2ea09b['on'](_0x840e('0x19'),function(){try{var _0x373a65=new Buffer(_0x463626[_0x840e('0x1a')](_0x840e('0x1b')),_0x840e('0x1b'));_0x2b8da1[_0x840e('0x18')](_0x373a65);_0x2b8da1['end']();_0x2b8da1['on'](_0x840e('0x1c'),function(){return _0x2b9286(_0x2209a8);});}catch(_0x50394c){fs['unlink'](_0x2209a8);return _0x53eb86(_0x50394c);}});});};exports[_0x840e('0x1d')]=function(_0x156e63,_0x5aa0b8,_0x4a16a4,_0xa4a4cf){return new BPromise(function(_0xbae24e,_0x2754fa){_0xa4a4cf=combineOptions(_0xa4a4cf);var _0x4effab=new Buffer(_0x4a16a4);var _0x4bfbe0=fs['createReadStream'](_0x156e63);var _0x243023=fs[_0x840e('0x15')](_0x5aa0b8);var _0x2c0fb6=crypto['createDecipher'](_0xa4a4cf['algorithm'],_0x4effab);_0x4bfbe0['on'](_0x840e('0x1e'),function(_0x219dec){var _0x5e62c1=new Buffer(_0x2c0fb6[_0x840e('0x17')](_0x219dec),_0x840e('0x1b'));_0x243023['write'](_0x5e62c1);});_0x4bfbe0['on'](_0x840e('0x19'),function(){try{var _0x2ad549=new Buffer(_0x2c0fb6[_0x840e('0x1a')](_0x840e('0x1b')),_0x840e('0x1b'));_0x243023['write'](_0x2ad549);_0x243023[_0x840e('0x19')]();_0x243023['on'](_0x840e('0x1c'),function(){return _0xbae24e(_0x5aa0b8);});}catch(_0x25dcff){fs[_0x840e('0x1f')](_0x5aa0b8);return _0x2754fa(_0x25dcff);}});});};exports['encryptString']=function(_0x4cf7a7,_0x5906d6,_0xd51799){var _0x497bd9=_0xd51799||stringOptions[_0x840e('0xa')];var _0x5c2811=_0x5906d6||stringOptions[_0x840e('0x20')];var _0x28444a=crypto[_0x840e('0x16')](_0x497bd9,_0x5c2811);var _0x5c8b20=_0x28444a[_0x840e('0x17')](_0x4cf7a7,_0x840e('0x21'),_0x840e('0x22'));_0x5c8b20+=_0x28444a['final'](_0x840e('0x22'));return _0x5c8b20;};exports[_0x840e('0x23')]=function(_0x3965aa,_0x1c8e8e,_0xfaac97){var _0x12a8f9=_0xfaac97||stringOptions[_0x840e('0xa')];var _0xadc6ab=_0x1c8e8e||stringOptions[_0x840e('0x20')];var _0x1de639=crypto['createDecipher'](_0x12a8f9,_0xadc6ab);var _0x3dff86=_0x1de639[_0x840e('0x17')](_0x3965aa,'base64',_0x840e('0x21'));_0x3dff86+=_0x1de639[_0x840e('0x1a')](_0x840e('0x21'));return _0x3dff86;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1dd52e2..21fa07a 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 _0x8abf=['zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','catch','inspect','Failed','exit','util','lodash','to-csv','bluebird','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','splitSizeCsv','then','sequelize','query','num','Empty','split','length','range','isInteger','push','QueryTypes','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','dirname','.csv','existsSync','join','mkdirSync','each','csv','%s.%s','writeFileSync','zip'];(function(_0x17935c,_0x1a7396){var _0x27cfe7=function(_0x4e35bc){while(--_0x4e35bc){_0x17935c['push'](_0x17935c['shift']());}};_0x27cfe7(++_0x1a7396);}(_0x8abf,0x6c));var _0xf8ab=function(_0x4848af,_0x2f99f2){_0x4848af=_0x4848af-0x0;var _0x125cdf=_0x8abf[_0x4848af];return _0x125cdf;};'use strict';var util=require(_0xf8ab('0x0'));var path=require('path');var _=require(_0xf8ab('0x1'));var csv=require(_0xf8ab('0x2'));var fs=require('fs');var BPromise=require(_0xf8ab('0x3'));var zipdir=require(_0xf8ab('0x4'));var rimraf=require(_0xf8ab('0x5'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf8ab('0x6')];var logger=require(_0xf8ab('0x7'))(_0xf8ab('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xf8ab('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x231cc7,_0xe2ad2c){var _0x200bd1={'status':_0x231cc7};var _0x2eaeb9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xe2ad2c){_0x200bd1[_0xf8ab('0xa')]=_0xe2ad2c;}return db[_0xf8ab('0xb')][_0xf8ab('0xc')](_0x200bd1,_0x2eaeb9);}function main(){var _0x46c1a1=0x1388;var _0x326404;logger[_0xf8ab('0xd')](util[_0xf8ab('0xe')](_0xf8ab('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xf8ab('0x10')][_0xf8ab('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf8ab('0x12')]})['then'](function(_0x3cc3af){if(_0x3cc3af){_0x326404=_0x3cc3af;_0x46c1a1=_0x326404[_0xf8ab('0x12')]||0x1388;}})[_0xf8ab('0x13')](function(){return dbH[_0xf8ab('0x14')][_0xf8ab('0x15')](util[_0xf8ab('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xf8ab('0x14')]['QueryTypes']['SELECT']});})[_0xf8ab('0x13')](function(_0x1832a8){if(!_0x1832a8[0x0][_0xf8ab('0x16')]){return analyticExtractedReport(_0xf8ab('0x17'));}var _0x3f51c2=[];var _0x2be21b=0x0;if(_0x326404[_0xf8ab('0x18')]){if(_0x1832a8&&_0x1832a8[_0xf8ab('0x19')]){var _0xa6d83d=_[_0xf8ab('0x1a')](_0x1832a8[0x0]['num']/_0x46c1a1);var _0x7384cb=Number[_0xf8ab('0x1b')](_0x1832a8[0x0]['num']/_0x46c1a1)?_0x1832a8[0x0][_0xf8ab('0x16')]%_0x46c1a1:0x0;_0xa6d83d['forEach'](function(_0x4231c2){if(_0x4231c2>0x0){_0x2be21b+=_0x46c1a1;}_0x3f51c2[_0xf8ab('0x1c')](dbH[_0xf8ab('0x14')][_0xf8ab('0x15')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x46c1a1,_0x2be21b),{'type':dbH[_0xf8ab('0x14')][_0xf8ab('0x1d')]['SELECT']}));});if(_0x7384cb>0x0){_0x2be21b+=_0x46c1a1;_0x3f51c2['push'](dbH[_0xf8ab('0x14')][_0xf8ab('0x15')](util['format'](_0xf8ab('0x1e'),QUERY,_0x7384cb,_0x2be21b),{'type':dbH['sequelize'][_0xf8ab('0x1d')][_0xf8ab('0x1f')]}));}}}else{_0x3f51c2[_0xf8ab('0x1c')](dbH['sequelize'][_0xf8ab('0x15')](QUERY,{'type':dbH[_0xf8ab('0x14')][_0xf8ab('0x1d')][_0xf8ab('0x1f')]}));}var _0x23df15=path[_0xf8ab('0x20')](PATH);var _0x3780c2=path['basename'](PATH,_0xf8ab('0x21'));var _0x5bd9d7=_0x326404[_0xf8ab('0x18')]&&_0x3f51c2['length']>0x1;var _0x5181c0=[];if(!fs[_0xf8ab('0x22')](path[_0xf8ab('0x23')](_0x23df15,_0x3780c2))&&_0x5bd9d7){fs[_0xf8ab('0x24')](path[_0xf8ab('0x23')](_0x23df15,_0x3780c2));}return BPromise[_0xf8ab('0x25')](_0x3f51c2,function(_0x4840a7){_0x5181c0['push'](_0x4840a7);})['then'](function(){for(var _0x58d010=0x0;_0x58d010<_0x5181c0[_0xf8ab('0x19')];_0x58d010+=0x1){var _0x28e354;var _0x56b247=_0x5181c0[_0x58d010];if(_0x5bd9d7){_0x28e354=path[_0xf8ab('0x23')](_0x23df15,_0x3780c2,util[_0xf8ab('0xe')]('%s%d.%s',_0x3780c2,_0x58d010,_0xf8ab('0x26')));}else{_0x28e354=path[_0xf8ab('0x23')](_0x23df15,util['format'](_0xf8ab('0x27'),_0x3780c2,_0xf8ab('0x26')));}fs[_0xf8ab('0x28')](_0x28e354,csv(_0x56b247));}})[_0xf8ab('0x13')](function(){if(_0x5bd9d7){return new Promise(function(_0x22d0ab){zipdir(path['join'](_0x23df15,_0x3780c2),{'saveTo':path[_0xf8ab('0x23')](_0x23df15,util['format']('%s.%s',_0x3780c2,_0xf8ab('0x29')))},function(_0x5e1c8e,_0x43be74){rimraf(path[_0xf8ab('0x23')](_0x23df15,_0x3780c2),function(){});_0x22d0ab(_0xf8ab('0x2a'));});});}})[_0xf8ab('0x13')](function(){logger[_0xf8ab('0xd')](util['format'](_0xf8ab('0x2b'),EXTRACTED_REPORT_ID,_0xf8ab('0x2c')));return analyticExtractedReport(_0xf8ab('0x2d'),_0x5bd9d7?util[_0xf8ab('0xe')](_0xf8ab('0x27'),_0x3780c2,_0x5bd9d7?'zip':_0xf8ab('0x26')):null);});})[_0xf8ab('0x2e')](function(_0x21fda3){logger[_0xf8ab('0xd')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xf8ab('0x2c')),util[_0xf8ab('0x2f')](_0x21fda3,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf8ab('0x30'));})['finally'](function(){process[_0xf8ab('0x31')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xac7d=['SELECT','dirname','basename','.csv','length','existsSync','mkdirSync','join','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','to-csv','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','then','splitSizeCsv','sequelize','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','Empty','isInteger','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3503e5,_0x490a96){var _0x2059fa=function(_0x6e735f){while(--_0x6e735f){_0x3503e5['push'](_0x3503e5['shift']());}};_0x2059fa(++_0x490a96);}(_0xac7d,0x6f));var _0xdac7=function(_0x2e73e5,_0x2ef23b){_0x2e73e5=_0x2e73e5-0x0;var _0x104540=_0xac7d[_0x2e73e5];return _0x104540;};'use strict';var util=require('util');var path=require(_0xdac7('0x0'));var _=require('lodash');var csv=require(_0xdac7('0x1'));var fs=require('fs');var BPromise=require(_0xdac7('0x2'));var zipdir=require(_0xdac7('0x3'));var rimraf=require('rimraf');var db=require(_0xdac7('0x4'))['db'];var dbH=require(_0xdac7('0x4'))[_0xdac7('0x5')];var logger=require('../../config/logger')(_0xdac7('0x6'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xdac7('0x7')][0x3];var PATH=process[_0xdac7('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2e40ce,_0x2d2c87){var _0x38b581={'status':_0x2e40ce};var _0x243ba9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2d2c87){_0x38b581[_0xdac7('0x8')]=_0x2d2c87;}return db[_0xdac7('0x9')][_0xdac7('0xa')](_0x38b581,_0x243ba9);}function main(){var _0x3b2961=0x1388;var _0x5e23d0;logger[_0xdac7('0xb')](util['format'](_0xdac7('0xc'),EXTRACTED_REPORT_ID,_0xdac7('0xd')));return db[_0xdac7('0xe')][_0xdac7('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xdac7('0x10'),'splitSizeCsv']})[_0xdac7('0x11')](function(_0x1e80db){if(_0x1e80db){_0x5e23d0=_0x1e80db;_0x3b2961=_0x5e23d0[_0xdac7('0x12')]||0x1388;}})[_0xdac7('0x11')](function(){return dbH[_0xdac7('0x13')][_0xdac7('0x14')](util[_0xdac7('0x15')](_0xdac7('0x16'),QUERY),{'type':dbH[_0xdac7('0x13')][_0xdac7('0x17')]['SELECT']});})[_0xdac7('0x11')](function(_0x3edf5f){if(!_0x3edf5f[0x0]['num']){return analyticExtractedReport(_0xdac7('0x18'));}var _0x3ce6fc=[];var _0x1194d4=0x0;if(_0x5e23d0[_0xdac7('0x10')]){if(_0x3edf5f&&_0x3edf5f['length']){var _0x34f6b2=_['range'](_0x3edf5f[0x0]['num']/_0x3b2961);var _0x29db15=Number[_0xdac7('0x19')](_0x3edf5f[0x0][_0xdac7('0x1a')]/_0x3b2961)?_0x3edf5f[0x0][_0xdac7('0x1a')]%_0x3b2961:0x0;_0x34f6b2[_0xdac7('0x1b')](function(_0x583bc5){if(_0x583bc5>0x0){_0x1194d4+=_0x3b2961;}_0x3ce6fc[_0xdac7('0x1c')](dbH['sequelize'][_0xdac7('0x14')](util[_0xdac7('0x15')](_0xdac7('0x1d'),QUERY,_0x3b2961,_0x1194d4),{'type':dbH[_0xdac7('0x13')]['QueryTypes'][_0xdac7('0x1e')]}));});if(_0x29db15>0x0){_0x1194d4+=_0x3b2961;_0x3ce6fc[_0xdac7('0x1c')](dbH['sequelize']['query'](util[_0xdac7('0x15')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x29db15,_0x1194d4),{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}}}else{_0x3ce6fc[_0xdac7('0x1c')](dbH[_0xdac7('0x13')][_0xdac7('0x14')](QUERY,{'type':dbH[_0xdac7('0x13')]['QueryTypes'][_0xdac7('0x1e')]}));}var _0x20e532=path[_0xdac7('0x1f')](PATH);var _0x139a92=path[_0xdac7('0x20')](PATH,_0xdac7('0x21'));var _0x4a3ed5=_0x5e23d0[_0xdac7('0x10')]&&_0x3ce6fc[_0xdac7('0x22')]>0x1;var _0x13a8e=[];if(!fs[_0xdac7('0x23')](path['join'](_0x20e532,_0x139a92))&&_0x4a3ed5){fs[_0xdac7('0x24')](path['join'](_0x20e532,_0x139a92));}return BPromise['each'](_0x3ce6fc,function(_0x483355){_0x13a8e['push'](_0x483355);})['then'](function(){for(var _0x3dd863=0x0;_0x3dd863<_0x13a8e[_0xdac7('0x22')];_0x3dd863+=0x1){var _0x11fc28;var _0x5152fd=_0x13a8e[_0x3dd863];if(_0x4a3ed5){_0x11fc28=path[_0xdac7('0x25')](_0x20e532,_0x139a92,util[_0xdac7('0x15')](_0xdac7('0x26'),_0x139a92,_0x3dd863,_0xdac7('0x27')));}else{_0x11fc28=path[_0xdac7('0x25')](_0x20e532,util[_0xdac7('0x15')](_0xdac7('0x28'),_0x139a92,_0xdac7('0x27')));}fs['writeFileSync'](_0x11fc28,csv(_0x5152fd));}})[_0xdac7('0x11')](function(){if(_0x4a3ed5){return new Promise(function(_0xf1a047){zipdir(path[_0xdac7('0x25')](_0x20e532,_0x139a92),{'saveTo':path[_0xdac7('0x25')](_0x20e532,util[_0xdac7('0x15')]('%s.%s',_0x139a92,_0xdac7('0x29')))},function(_0x5c8126,_0x58b855){rimraf(path[_0xdac7('0x25')](_0x20e532,_0x139a92),function(){});_0xf1a047('zip\x20finished');});});}})[_0xdac7('0x11')](function(){logger[_0xdac7('0xb')](util[_0xdac7('0x15')](_0xdac7('0x2a'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x4a3ed5?util[_0xdac7('0x15')]('%s.%s',_0x139a92,_0x4a3ed5?_0xdac7('0x29'):_0xdac7('0x27')):null);});})[_0xdac7('0x2b')](function(_0x461923){logger[_0xdac7('0xb')](util[_0xdac7('0x15')](_0xdac7('0x2c'),EXTRACTED_REPORT_ID,_0xdac7('0xd')),util[_0xdac7('0x2d')](_0x461923,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xdac7('0x2e'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 011632c..6a7f37b 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 _0xbbc1=['catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','util','path','moment','html-to-pdfmake','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','tableHeader','pick','map','fill','length','auto','push','body','concat','keys','forEach','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','format','header','pageBreak','margin','\x20/\x20','footer','Arial','black','num','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x5e1158,_0x56d622){var _0x3eaa5f=function(_0x408b3d){while(--_0x408b3d){_0x5e1158['push'](_0x5e1158['shift']());}};_0x3eaa5f(++_0x56d622);}(_0xbbc1,0x6e));var _0x1bbc=function(_0x390680,_0x44392b){_0x390680=_0x390680-0x0;var _0x117c4a=_0xbbc1[_0x390680];return _0x117c4a;};'use strict';var _=require('lodash');var fs=require('fs');var util=require(_0x1bbc('0x0'));var path=require(_0x1bbc('0x1'));var moment=require(_0x1bbc('0x2'));var htmlToPdfmake=require(_0x1bbc('0x3'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0x1bbc('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x1bbc('0x5'))[_0x1bbc('0x6')];var window=new JSDOM('')[_0x1bbc('0x7')];var BPromise=require(_0x1bbc('0x8'));var db=require(_0x1bbc('0x9'))['db'];var dbH=require(_0x1bbc('0x9'))[_0x1bbc('0xa')];var logger=require(_0x1bbc('0xb'))(_0x1bbc('0xc'));var EXTRACTED_REPORT_ID=Number(process[_0x1bbc('0xd')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x1bbc('0xd')][0x5];var FORMAT=_0x1bbc('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x3af0ec,_0xb0590c){var _0x3147a1={'status':_0x3af0ec};var _0x22181f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xb0590c){_0x3147a1[_0x1bbc('0xf')]=_0xb0590c;}return db[_0x1bbc('0x10')][_0x1bbc('0x11')](_0x3147a1,_0x22181f);}function getHeaders(_0x27f1bf){return _['map'](_0x27f1bf,function(_0x39e195){return{'text':_0x39e195,'style':_0x1bbc('0x12')};});}function getRows(_0x3af72b,_0x1c0bca){return _['map'](_0x1c0bca,function(_0x12b7f5){return _(_0x12b7f5)[_0x1bbc('0x13')](_0x3af72b)[_0x1bbc('0x14')](function(_0xce90e0){return _0xce90e0?_['toString'](_0xce90e0):'';})['value']();});}function createTable(_0x3bb9c9,_0x447455){var _0x1c1200={'widths':_[_0x1bbc('0x15')](Array(_0x3bb9c9[_0x1bbc('0x16')]),0x91),'heights':function(_0x2bb93f){return _0x2bb93f===0x0?_0x1bbc('0x17'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x52a68c=getHeaders(_0x3bb9c9);_0x1c1200['body'][_0x1bbc('0x18')](_0x52a68c);var _0x5382ae=getRows(_0x3bb9c9,_0x447455);_0x1c1200[_0x1bbc('0x19')]=_0x1c1200[_0x1bbc('0x19')][_0x1bbc('0x1a')](_0x5382ae);return _0x1c1200;}function createTables(_0x34edcc){var _0x1a0702=[];var _0x7ac59c=_['chunk'](Object[_0x1bbc('0x1b')](_0x34edcc[0x0]),0x5);_0x7ac59c[_0x1bbc('0x1c')](function(_0x4726fb){_0x1a0702[_0x1bbc('0x18')](createTable(_0x4726fb,_0x34edcc));});return _0x1a0702;}function getPDFDocDefinition(_0x4bdc61){var _0x3f671b=util['format'](_0x1bbc('0x1d'),NAME,EXTRACTED_REPORT[_0x1bbc('0x1e')],moment(EXTRACTED_REPORT[_0x1bbc('0x1f')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x1bbc('0x20')](FORMAT));var _0x2b1e61=[];for(var _0x56e5b0=0x0;_0x56e5b0<_0x4bdc61[_0x1bbc('0x16')];_0x56e5b0++){var _0x50ccf1=[];if(_0x56e5b0===0x0){_0x50ccf1[_0x1bbc('0x18')]({'text':_0x3f671b,'style':_0x1bbc('0x21')});}var _0xefe063={'table':_0x4bdc61[_0x56e5b0]};if(_0x56e5b0>0x0){_0xefe063[_0x1bbc('0x22')]='before';_0xefe063[_0x1bbc('0x23')]=[0x0,0x46,0x0,0x0];}_0x50ccf1[_0x1bbc('0x18')](_0xefe063);_0x2b1e61['push'](_0x50ccf1);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x2b1e61,'footer':function(_0x177f02,_0x527291){return{'text':_0x177f02['toString']()+_0x1bbc('0x24')+_0x527291,'style':_0x1bbc('0x25')};},'defaultStyle':{'font':_0x1bbc('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x1bbc('0x27')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x563be5){var _0x5f4305=0x1388;var _0x5dd71b;if(!_0x563be5[0x0][_0x1bbc('0x28')]){return analyticExtractedReport('Empty');}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1bbc('0x29'),_0x1bbc('0x2a')]})['then'](function(_0x26e1aa){if(_0x26e1aa){_0x5dd71b=_0x26e1aa;_0x5f4305=_0x5dd71b[_0x1bbc('0x2a')]||0x3e8;}})[_0x1bbc('0x2b')](function(){var _0x1e99aa=[];var _0x128ff0=0x0;if(_0x5dd71b[_0x1bbc('0x29')]){if(_0x563be5&&_0x563be5[_0x1bbc('0x16')]){var _0x57bdca=_[_0x1bbc('0x2c')](_0x563be5[0x0][_0x1bbc('0x28')]/_0x5f4305);var _0x53fdd9=Number[_0x1bbc('0x2d')](_0x563be5[0x0][_0x1bbc('0x28')]/_0x5f4305)?_0x563be5[0x0][_0x1bbc('0x28')]%_0x5f4305:0x0;_0x57bdca[_0x1bbc('0x1c')](function(_0x11a0cf){if(_0x11a0cf>0x0){_0x128ff0+=_0x5f4305;}_0x1e99aa[_0x1bbc('0x18')](dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](util[_0x1bbc('0x20')](_0x1bbc('0x30'),QUERY,_0x5f4305,_0x128ff0),{'type':dbH['sequelize'][_0x1bbc('0x31')][_0x1bbc('0x32')]}));});if(_0x53fdd9>0x0){_0x128ff0+=_0x5f4305;_0x1e99aa['push'](dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](util[_0x1bbc('0x20')](_0x1bbc('0x30'),QUERY,_0x53fdd9,_0x128ff0),{'type':dbH[_0x1bbc('0x2e')]['QueryTypes'][_0x1bbc('0x32')]}));}}}else{_0x1e99aa[_0x1bbc('0x18')](dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](QUERY,{'type':dbH['sequelize'][_0x1bbc('0x31')][_0x1bbc('0x32')]}));}var _0x4dda97=path[_0x1bbc('0x33')](PATH);var _0x48278e=path[_0x1bbc('0x34')](PATH,'.pdf');var _0x11fd19=_0x5dd71b[_0x1bbc('0x29')]&&_0x1e99aa[_0x1bbc('0x16')]>0x1;var _0x1192e2=[];if(!fs[_0x1bbc('0x35')](path['join'](_0x4dda97,_0x48278e))&&_0x11fd19){fs['mkdirSync'](path[_0x1bbc('0x36')](_0x4dda97,_0x48278e));}return BPromise[_0x1bbc('0x37')](_0x1e99aa,function(_0x214326){_0x1192e2['push'](_0x214326);})[_0x1bbc('0x2b')](function(){var _0x539220=[];for(var _0x5698f7=0x0;_0x5698f7<_0x1192e2[_0x1bbc('0x16')];_0x5698f7+=0x1){var _0x540d35=_0x1192e2[_0x5698f7];var _0x4157ed=createTables(_[_0x1bbc('0x38')](_0x540d35));var _0x146c64;var _0x473c29=getPDFDocDefinition(_0x4157ed);var _0x8d6823=getPDFPrinter();var _0x544b3b=_0x8d6823[_0x1bbc('0x39')](_0x473c29);if(_0x11fd19){_0x146c64=path[_0x1bbc('0x36')](_0x4dda97,_0x48278e,util[_0x1bbc('0x20')](_0x1bbc('0x3a'),_0x48278e,_0x5698f7,_0x1bbc('0x3b')));}else{_0x146c64=path[_0x1bbc('0x36')](_0x4dda97,util[_0x1bbc('0x20')](_0x1bbc('0x3c'),_0x48278e,'pdf'));}_0x539220[_0x1bbc('0x18')](writePDFDocument(_0x544b3b,_0x146c64));}return Promise['all'](_0x539220);})['then'](function(){if(_0x11fd19){return new Promise(function(_0x1b9df){zipdir(path[_0x1bbc('0x36')](_0x4dda97,_0x48278e),{'saveTo':path['join'](_0x4dda97,util['format'](_0x1bbc('0x3c'),_0x48278e,'zip'))},function(){rimraf(path['join'](_0x4dda97,_0x48278e),function(){});_0x1b9df('zip\x20finished');});});}})[_0x1bbc('0x2b')](function(){if(!_0x11fd19)return;rimraf(path[_0x1bbc('0x36')](_0x4dda97,_0x48278e),function(){});})[_0x1bbc('0x2b')](function(){logger['info'](util[_0x1bbc('0x20')](_0x1bbc('0x3d'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x1bbc('0x3e'),_0x11fd19?util[_0x1bbc('0x20')](_0x1bbc('0x3c'),_0x48278e,_0x11fd19?'zip':_0x1bbc('0x3b')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x1bbc('0x3f')](util[_0x1bbc('0x20')](_0x1bbc('0x40'),EXTRACTED_REPORT_ID,_0x1bbc('0x41')));return db[_0x1bbc('0x10')][_0x1bbc('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1ecd4a){EXTRACTED_REPORT=_0x1ecd4a;return dbH[_0x1bbc('0x2e')][_0x1bbc('0x2f')](util[_0x1bbc('0x20')](_0x1bbc('0x43'),QUERY),{'type':dbH[_0x1bbc('0x2e')]['QueryTypes'][_0x1bbc('0x32')]});})['then'](extractReport)[_0x1bbc('0x44')](function(_0x4a58ba){logger[_0x1bbc('0x3f')](util[_0x1bbc('0x20')](_0x1bbc('0x45'),EXTRACTED_REPORT_ID,'PDF'),util[_0x1bbc('0x46')](_0x4a58ba,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1bbc('0x47'));})[_0x1bbc('0x48')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0xf2235b=new PdfPrinter({'Arial':{'normal':__dirname+_0x1bbc('0x49'),'bold':__dirname+_0x1bbc('0x4a'),'italics':__dirname+_0x1bbc('0x4b'),'bolditalics':__dirname+_0x1bbc('0x4c')}});return _0xf2235b;}function getPDFDocDefinitionFromHTML(_0x6104bc,_0x326170){var _0x2e4fd3=util[_0x1bbc('0x20')](_0x1bbc('0x4d'),_0x326170[_0x1bbc('0x4e')],_0x326170[_0x1bbc('0x4f')]);var _0x1b9dcd=moment()[_0x1bbc('0x20')](_0x1bbc('0x50'))['toString']();var _0xeb9f3a=htmlToPdfmake(_0x6104bc,{'window':window,'tableAutoSize':!![]});return{'content':[_0xeb9f3a],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x1bbc('0x51'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x1bbc('0x51'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':'center'}},'header':function(){return[{'text':_0x1bbc('0x52'),'style':_0x1bbc('0x21')}];},'footer':function(_0x4e7351,_0x59a7d5){return[{'text':util[_0x1bbc('0x20')](_0x1bbc('0x53'),_0x2e4fd3,_0x4e7351,_0x59a7d5,_0x1b9dcd),'style':_0x1bbc('0x25')}];}};}function writePDFDocument(_0xe42fda,_0x2bc303){return new Promise(function(_0x3579bc,_0x73569d){var _0x44b740=_0xe42fda[_0x1bbc('0x54')](fs[_0x1bbc('0x55')](_0x2bc303));_0x44b740['on'](_0x1bbc('0x56'),function(){_0x3579bc('finish');});_0x44b740['on'](_0x1bbc('0x57'),function(_0x51cb73){_0x73569d(_0x51cb73);});_0xe42fda['end']();});}exports[_0x1bbc('0x58')]=function(_0x38a96b,_0x1ed429){var _0x264276=getPDFPrinter();var _0x5bd7b9=getPDFDocDefinitionFromHTML(_0x38a96b,_0x1ed429);var _0x2ff684=_0x264276[_0x1bbc('0x39')](_0x5bd7b9);return writePDFDocument(_0x2ff684,_0x1ed429[_0x1bbc('0x1')])[_0x1bbc('0x44')](function(_0x12b154){throw _0x12b154;});}; \ No newline at end of file +var _0x792d=['Arial','black','right','num','Empty','Setting','find','split','splitSizePdf','then','sequelize','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','query','basename','.pdf','mkdirSync','join','flatten','pdf','all','%s.%s','zip','zip\x20finished','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','finally','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','createWriteStream','finish','error','end','createPdfFromHTML','createPdfKitDocument','lodash','util','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','before','margin','landscape','\x20/\x20','footer'];(function(_0x2c7eb4,_0x37591e){var _0xe2dedc=function(_0x2ccac0){while(--_0x2ccac0){_0x2c7eb4['push'](_0x2c7eb4['shift']());}};_0xe2dedc(++_0x37591e);}(_0x792d,0x141));var _0xd792=function(_0x218733,_0x5e1bf1){_0x218733=_0x218733-0x0;var _0x3c80fa=_0x792d[_0x218733];return _0x3c80fa;};'use strict';var _=require(_0xd792('0x0'));var fs=require('fs');var util=require(_0xd792('0x1'));var path=require(_0xd792('0x2'));var moment=require(_0xd792('0x3'));var htmlToPdfmake=require(_0xd792('0x4'));var PdfPrinter=require(_0xd792('0x5'));var zipdir=require(_0xd792('0x6'));var rimraf=require(_0xd792('0x7'));var JSDOM=require(_0xd792('0x8'))[_0xd792('0x9')];var window=new JSDOM('')['window'];var BPromise=require(_0xd792('0xa'));var db=require(_0xd792('0xb'))['db'];var dbH=require(_0xd792('0xb'))[_0xd792('0xc')];var logger=require(_0xd792('0xd'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd792('0xe')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd792('0xe')][0x4];var NAME=process[_0xd792('0xe')][0x5];var FORMAT=_0xd792('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x236456,_0x1b2579){var _0x59e4f7={'status':_0x236456};var _0x3bc46d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1b2579){_0x59e4f7[_0xd792('0x10')]=_0x1b2579;}return db[_0xd792('0x11')][_0xd792('0x12')](_0x59e4f7,_0x3bc46d);}function getHeaders(_0x36376f){return _[_0xd792('0x13')](_0x36376f,function(_0xff7f63){return{'text':_0xff7f63,'style':_0xd792('0x14')};});}function getRows(_0x4a7b6c,_0x4d9f79){return _['map'](_0x4d9f79,function(_0x2e022e){return _(_0x2e022e)[_0xd792('0x15')](_0x4a7b6c)[_0xd792('0x13')](function(_0x503968){return _0x503968?_[_0xd792('0x16')](_0x503968):'';})[_0xd792('0x17')]();});}function createTable(_0x15a290,_0x467cc1){var _0x3419f0={'widths':_[_0xd792('0x18')](Array(_0x15a290[_0xd792('0x19')]),0x91),'heights':function(_0x1f562b){return _0x1f562b===0x0?_0xd792('0x1a'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1a3d5c=getHeaders(_0x15a290);_0x3419f0[_0xd792('0x1b')][_0xd792('0x1c')](_0x1a3d5c);var _0x1993fa=getRows(_0x15a290,_0x467cc1);_0x3419f0[_0xd792('0x1b')]=_0x3419f0[_0xd792('0x1b')][_0xd792('0x1d')](_0x1993fa);return _0x3419f0;}function createTables(_0x5b3fb4){var _0x1141d3=[];var _0x45ad6e=_[_0xd792('0x1e')](Object[_0xd792('0x1f')](_0x5b3fb4[0x0]),0x5);_0x45ad6e[_0xd792('0x20')](function(_0x443ba2){_0x1141d3[_0xd792('0x1c')](createTable(_0x443ba2,_0x5b3fb4));});return _0x1141d3;}function getPDFDocDefinition(_0x492e8c){var _0x3b133c=util[_0xd792('0x21')](_0xd792('0x22'),NAME,EXTRACTED_REPORT[_0xd792('0x23')],moment(EXTRACTED_REPORT[_0xd792('0x24')])[_0xd792('0x21')](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0xd792('0x21')](FORMAT));var _0x53d80a=[];for(var _0x29b060=0x0;_0x29b060<_0x492e8c[_0xd792('0x19')];_0x29b060++){var _0x371f20=[];if(_0x29b060===0x0){_0x371f20[_0xd792('0x1c')]({'text':_0x3b133c,'style':_0xd792('0x25')});}var _0x2c0ade={'table':_0x492e8c[_0x29b060]};if(_0x29b060>0x0){_0x2c0ade['pageBreak']=_0xd792('0x26');_0x2c0ade[_0xd792('0x27')]=[0x0,0x46,0x0,0x0];}_0x371f20['push'](_0x2c0ade);_0x53d80a[_0xd792('0x1c')](_0x371f20);}return{'pageSize':'A4','pageOrientation':_0xd792('0x28'),'content':_0x53d80a,'footer':function(_0x244b3a,_0x545ea8){return{'text':_0x244b3a[_0xd792('0x16')]()+_0xd792('0x29')+_0x545ea8,'style':_0xd792('0x2a')};},'defaultStyle':{'font':_0xd792('0x2b')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xd792('0x2c')},'footer':{'alignment':_0xd792('0x2d'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x27f44c){var _0x4585b1=0x1388;var _0x52d4cf;if(!_0x27f44c[0x0][_0xd792('0x2e')]){return analyticExtractedReport(_0xd792('0x2f'));}return db[_0xd792('0x30')][_0xd792('0x31')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd792('0x32'),_0xd792('0x33')]})[_0xd792('0x34')](function(_0x5e41f8){if(_0x5e41f8){_0x52d4cf=_0x5e41f8;_0x4585b1=_0x52d4cf[_0xd792('0x33')]||0x3e8;}})[_0xd792('0x34')](function(){var _0x40bdca=[];var _0x3055f0=0x0;if(_0x52d4cf['split']){if(_0x27f44c&&_0x27f44c[_0xd792('0x19')]){var _0x288fde=_['range'](_0x27f44c[0x0]['num']/_0x4585b1);var _0x4d396a=Number['isInteger'](_0x27f44c[0x0][_0xd792('0x2e')]/_0x4585b1)?_0x27f44c[0x0][_0xd792('0x2e')]%_0x4585b1:0x0;_0x288fde['forEach'](function(_0x26a2e1){if(_0x26a2e1>0x0){_0x3055f0+=_0x4585b1;}_0x40bdca[_0xd792('0x1c')](dbH[_0xd792('0x35')]['query'](util[_0xd792('0x21')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x4585b1,_0x3055f0),{'type':dbH[_0xd792('0x35')][_0xd792('0x36')][_0xd792('0x37')]}));});if(_0x4d396a>0x0){_0x3055f0+=_0x4585b1;_0x40bdca[_0xd792('0x1c')](dbH[_0xd792('0x35')]['query'](util[_0xd792('0x21')](_0xd792('0x38'),QUERY,_0x4d396a,_0x3055f0),{'type':dbH['sequelize'][_0xd792('0x36')][_0xd792('0x37')]}));}}}else{_0x40bdca[_0xd792('0x1c')](dbH[_0xd792('0x35')][_0xd792('0x39')](QUERY,{'type':dbH[_0xd792('0x35')]['QueryTypes'][_0xd792('0x37')]}));}var _0x4b4a9e=path['dirname'](PATH);var _0x1b9fb8=path[_0xd792('0x3a')](PATH,_0xd792('0x3b'));var _0xd7fb8d=_0x52d4cf[_0xd792('0x32')]&&_0x40bdca[_0xd792('0x19')]>0x1;var _0x52e857=[];if(!fs['existsSync'](path['join'](_0x4b4a9e,_0x1b9fb8))&&_0xd7fb8d){fs[_0xd792('0x3c')](path[_0xd792('0x3d')](_0x4b4a9e,_0x1b9fb8));}return BPromise['each'](_0x40bdca,function(_0x41e3d6){_0x52e857['push'](_0x41e3d6);})[_0xd792('0x34')](function(){var _0x124f8a=[];for(var _0x2344ab=0x0;_0x2344ab<_0x52e857[_0xd792('0x19')];_0x2344ab+=0x1){var _0x2ff013=_0x52e857[_0x2344ab];var _0x1d5925=createTables(_[_0xd792('0x3e')](_0x2ff013));var _0x4a2b9d;var _0x4986d7=getPDFDocDefinition(_0x1d5925);var _0x22f8d7=getPDFPrinter();var _0x41e01c=_0x22f8d7['createPdfKitDocument'](_0x4986d7);if(_0xd7fb8d){_0x4a2b9d=path[_0xd792('0x3d')](_0x4b4a9e,_0x1b9fb8,util[_0xd792('0x21')]('%s%d.%s',_0x1b9fb8,_0x2344ab,_0xd792('0x3f')));}else{_0x4a2b9d=path['join'](_0x4b4a9e,util[_0xd792('0x21')]('%s.%s',_0x1b9fb8,'pdf'));}_0x124f8a[_0xd792('0x1c')](writePDFDocument(_0x41e01c,_0x4a2b9d));}return Promise[_0xd792('0x40')](_0x124f8a);})[_0xd792('0x34')](function(){if(_0xd7fb8d){return new Promise(function(_0x186dbb){zipdir(path['join'](_0x4b4a9e,_0x1b9fb8),{'saveTo':path[_0xd792('0x3d')](_0x4b4a9e,util[_0xd792('0x21')](_0xd792('0x41'),_0x1b9fb8,_0xd792('0x42')))},function(){rimraf(path['join'](_0x4b4a9e,_0x1b9fb8),function(){});_0x186dbb(_0xd792('0x43'));});});}})[_0xd792('0x34')](function(){if(!_0xd7fb8d)return;rimraf(path[_0xd792('0x3d')](_0x4b4a9e,_0x1b9fb8),function(){});})['then'](function(){logger[_0xd792('0x44')](util[_0xd792('0x21')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xd792('0x45')));return analyticExtractedReport(_0xd792('0x46'),_0xd7fb8d?util[_0xd792('0x21')]('%s.%s',_0x1b9fb8,_0xd7fb8d?_0xd792('0x42'):_0xd792('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0xd792('0x21')](_0xd792('0x47'),EXTRACTED_REPORT_ID,_0xd792('0x45')));return db[_0xd792('0x11')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xd792('0x34')](function(_0x4b5a5a){EXTRACTED_REPORT=_0x4b5a5a;return dbH[_0xd792('0x35')][_0xd792('0x39')](util[_0xd792('0x21')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xd792('0x35')]['QueryTypes'][_0xd792('0x37')]});})[_0xd792('0x34')](extractReport)[_0xd792('0x48')](function(_0x273a3d){logger[_0xd792('0x44')](util[_0xd792('0x21')](_0xd792('0x49'),EXTRACTED_REPORT_ID,_0xd792('0x45')),util['inspect'](_0x273a3d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xd792('0x4a')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x57f407=new PdfPrinter({'Arial':{'normal':__dirname+_0xd792('0x4b'),'bold':__dirname+_0xd792('0x4c'),'italics':__dirname+_0xd792('0x4d'),'bolditalics':__dirname+_0xd792('0x4e')}});return _0x57f407;}function getPDFDocDefinitionFromHTML(_0x5010fc,_0x13b02f){var _0x3091d4=util[_0xd792('0x21')]('%s\x20#%d',_0x13b02f[_0xd792('0x4f')],_0x13b02f[_0xd792('0x50')]);var _0xe50f53=moment()[_0xd792('0x21')](_0xd792('0x51'))[_0xd792('0x16')]();var _0x448f84=htmlToPdfmake(_0x5010fc,{'window':window,'tableAutoSize':!![]});return{'content':[_0x448f84],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xd792('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0xd792('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xd792('0x52')}},'header':function(){return[{'text':_0xd792('0x53'),'style':_0xd792('0x25')}];},'footer':function(_0x560519,_0x1eeef0){return[{'text':util[_0xd792('0x21')](_0xd792('0x54'),_0x3091d4,_0x560519,_0x1eeef0,_0xe50f53),'style':_0xd792('0x2a')}];}};}function writePDFDocument(_0x4ac9b1,_0x171c2e){return new Promise(function(_0x1a9e47,_0x37c4da){var _0x2a8aa9=_0x4ac9b1['pipe'](fs[_0xd792('0x55')](_0x171c2e));_0x2a8aa9['on'](_0xd792('0x56'),function(){_0x1a9e47(_0xd792('0x56'));});_0x2a8aa9['on'](_0xd792('0x57'),function(_0x2b6241){_0x37c4da(_0x2b6241);});_0x4ac9b1[_0xd792('0x58')]();});}exports[_0xd792('0x59')]=function(_0x3e6955,_0x2e8261){var _0x167ff7=getPDFPrinter();var _0x2f49c7=getPDFDocDefinitionFromHTML(_0x3e6955,_0x2e8261);var _0x3d083d=_0x167ff7[_0xd792('0x5a')](_0x2f49c7);return writePDFDocument(_0x3d083d,_0x2e8261[_0xd792('0x2')])[_0xd792('0x48')](function(_0x5091ec){throw _0x5091ec;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 3c7c653..fa6b9fa 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 _0xe903=['existsSync','join','mkdirSync','each','%s%d.%s','xlsx','zip','zip\x20finished','XLSX','Completed','%s.%s','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','split','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','num','Empty','length','range','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','basename','.xlsx'];(function(_0x5ee3d3,_0x537c30){var _0x4b272f=function(_0x3dc277){while(--_0x3dc277){_0x5ee3d3['push'](_0x5ee3d3['shift']());}};_0x4b272f(++_0x537c30);}(_0xe903,0x17d));var _0x3e90=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xe903[_0x8de54f];return _0x14cba4;};'use strict';var util=require(_0x3e90('0x0'));var path=require(_0x3e90('0x1'));var _=require(_0x3e90('0x2'));var fs=require('fs');var json2xls=require(_0x3e90('0x3'));var BPromise=require(_0x3e90('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x3e90('0x5'));var db=require(_0x3e90('0x6'))['db'];var dbH=require(_0x3e90('0x6'))[_0x3e90('0x7')];var logger=require(_0x3e90('0x8'))(_0x3e90('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0x3e90('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4f8b35,_0x59623e){var _0x1c7b00={'status':_0x4f8b35};var _0x3b743f={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x59623e){_0x1c7b00[_0x3e90('0xb')]=_0x59623e;}return db[_0x3e90('0xc')][_0x3e90('0xd')](_0x1c7b00,_0x3b743f);}function main(){var _0x23580f=0x1388;var _0x6cd33f;logger[_0x3e90('0xe')](util[_0x3e90('0xf')](_0x3e90('0x10'),EXTRACTED_REPORT_ID,'XLSX'));return db['Setting'][_0x3e90('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e90('0x12'),_0x3e90('0x13')]})[_0x3e90('0x14')](function(_0x1bcba9){if(_0x1bcba9){_0x6cd33f=_0x1bcba9;_0x23580f=_0x6cd33f[_0x3e90('0x13')]||0x1388;}})[_0x3e90('0x14')](function(){return dbH['sequelize'][_0x3e90('0x15')](util[_0x3e90('0xf')](_0x3e90('0x16'),QUERY),{'type':dbH[_0x3e90('0x17')][_0x3e90('0x18')]['SELECT']});})[_0x3e90('0x14')](function(_0x1a30d0){if(!_0x1a30d0[0x0][_0x3e90('0x19')]){return analyticExtractedReport(_0x3e90('0x1a'));}var _0xfab73b=[];var _0x22556e=0x0;if(_0x6cd33f[_0x3e90('0x12')]){if(_0x1a30d0&&_0x1a30d0[_0x3e90('0x1b')]){var _0x1f9b0e=_[_0x3e90('0x1c')](_0x1a30d0[0x0][_0x3e90('0x19')]/_0x23580f);var _0x2ed204=Number['isInteger'](_0x1a30d0[0x0][_0x3e90('0x19')]/_0x23580f)?_0x1a30d0[0x0][_0x3e90('0x19')]%_0x23580f:0x0;_0x1f9b0e[_0x3e90('0x1d')](function(_0x374ff0){if(_0x374ff0>0x0){_0x22556e+=_0x23580f;}_0xfab73b[_0x3e90('0x1e')](dbH[_0x3e90('0x17')][_0x3e90('0x15')](util[_0x3e90('0xf')](_0x3e90('0x1f'),QUERY,_0x23580f,_0x22556e),{'type':dbH[_0x3e90('0x17')][_0x3e90('0x18')]['SELECT']}));});if(_0x2ed204>0x0){_0x22556e+=_0x23580f;_0xfab73b[_0x3e90('0x1e')](dbH[_0x3e90('0x17')][_0x3e90('0x15')](util[_0x3e90('0xf')](_0x3e90('0x1f'),QUERY,_0x2ed204,_0x22556e),{'type':dbH['sequelize'][_0x3e90('0x18')][_0x3e90('0x20')]}));}}}else{_0xfab73b[_0x3e90('0x1e')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x3e90('0x17')][_0x3e90('0x18')]['SELECT']}));}var _0x2ed350=path['dirname'](PATH);var _0x420eaf=path[_0x3e90('0x21')](PATH,_0x3e90('0x22'));var _0x49900a=_0x6cd33f[_0x3e90('0x12')]&&_0xfab73b[_0x3e90('0x1b')]>0x1;var _0x28b852=[];if(!fs[_0x3e90('0x23')](path[_0x3e90('0x24')](_0x2ed350,_0x420eaf))&&_0x49900a){fs[_0x3e90('0x25')](path['join'](_0x2ed350,_0x420eaf));}return BPromise[_0x3e90('0x26')](_0xfab73b,function(_0x503cf2){_0x28b852[_0x3e90('0x1e')](_0x503cf2);})[_0x3e90('0x14')](function(){for(var _0x4311f8=0x0;_0x4311f8<_0x28b852[_0x3e90('0x1b')];_0x4311f8+=0x1){var _0x4cf016;var _0x28340a=_0x28b852[_0x4311f8];if(_0x49900a){_0x4cf016=path['join'](_0x2ed350,_0x420eaf,util['format'](_0x3e90('0x27'),_0x420eaf,_0x4311f8,_0x3e90('0x28')));}else{_0x4cf016=path[_0x3e90('0x24')](_0x2ed350,util['format']('%s.%s',_0x420eaf,_0x3e90('0x28')));}fs['writeFileSync'](_0x4cf016,json2xls(_0x28340a),'binary');}})[_0x3e90('0x14')](function(){if(_0x49900a){return new Promise(function(_0x35e476){zipdir(path[_0x3e90('0x24')](_0x2ed350,_0x420eaf),{'saveTo':path['join'](_0x2ed350,util[_0x3e90('0xf')]('%s.%s',_0x420eaf,_0x3e90('0x29')))},function(_0x55c4f1,_0x5e07f1){rimraf(path['join'](_0x2ed350,_0x420eaf),function(){});_0x35e476(_0x3e90('0x2a'));});});}})[_0x3e90('0x14')](function(){logger[_0x3e90('0xe')](util[_0x3e90('0xf')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3e90('0x2b')));return analyticExtractedReport(_0x3e90('0x2c'),_0x49900a?util[_0x3e90('0xf')](_0x3e90('0x2d'),_0x420eaf,_0x49900a?_0x3e90('0x29'):_0x3e90('0x28')):null);});})[_0x3e90('0x2e')](function(_0x1aa6fc){logger[_0x3e90('0xe')](util[_0x3e90('0xf')](_0x3e90('0x2f'),EXTRACTED_REPORT_ID,_0x3e90('0x2b')),util[_0x3e90('0x30')](_0x1aa6fc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x3e90('0x31'));})[_0x3e90('0x32')](function(){process[_0x3e90('0x33')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe423=['SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','join','mkdirSync','%s%d.%s','xlsx','writeFileSync','binary','zip\x20finished','Completed','inspect','exit','util','path','lodash','rimraf','../../mysqldb','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','then','splitSizeXlsx','sequelize','query'];(function(_0x1d949f,_0x3a914e){var _0x50a59e=function(_0x10ccfb){while(--_0x10ccfb){_0x1d949f['push'](_0x1d949f['shift']());}};_0x50a59e(++_0x3a914e);}(_0xe423,0xf4));var _0x3e42=function(_0x1ba05a,_0x3460fd){_0x1ba05a=_0x1ba05a-0x0;var _0x5b9908=_0xe423[_0x1ba05a];return _0x5b9908;};'use strict';var util=require(_0x3e42('0x0'));var path=require(_0x3e42('0x1'));var _=require(_0x3e42('0x2'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0x3e42('0x3'));var db=require(_0x3e42('0x4'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require('../../config/logger')(_0x3e42('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x3e42('0x6')][0x3];var PATH=process[_0x3e42('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1d848a,_0x111edf){var _0x5e1d96={'status':_0x1d848a};var _0x48cd63={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x111edf){_0x5e1d96[_0x3e42('0x7')]=_0x111edf;}return db[_0x3e42('0x8')][_0x3e42('0x9')](_0x5e1d96,_0x48cd63);}function main(){var _0x1dca1e=0x1388;var _0x53a1ad;logger[_0x3e42('0xa')](util[_0x3e42('0xb')](_0x3e42('0xc'),EXTRACTED_REPORT_ID,_0x3e42('0xd')));return db['Setting'][_0x3e42('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x3e42('0xf'),'splitSizeXlsx']})[_0x3e42('0x10')](function(_0x36e3c6){if(_0x36e3c6){_0x53a1ad=_0x36e3c6;_0x1dca1e=_0x53a1ad[_0x3e42('0x11')]||0x1388;}})[_0x3e42('0x10')](function(){return dbH[_0x3e42('0x12')][_0x3e42('0x13')](util[_0x3e42('0xb')](_0x3e42('0x14'),QUERY),{'type':dbH[_0x3e42('0x12')][_0x3e42('0x15')][_0x3e42('0x16')]});})['then'](function(_0x39cc83){if(!_0x39cc83[0x0]['num']){return analyticExtractedReport(_0x3e42('0x17'));}var _0x91c3cf=[];var _0x475c28=0x0;if(_0x53a1ad[_0x3e42('0xf')]){if(_0x39cc83&&_0x39cc83[_0x3e42('0x18')]){var _0x45ef97=_[_0x3e42('0x19')](_0x39cc83[0x0][_0x3e42('0x1a')]/_0x1dca1e);var _0x108f87=Number[_0x3e42('0x1b')](_0x39cc83[0x0][_0x3e42('0x1a')]/_0x1dca1e)?_0x39cc83[0x0][_0x3e42('0x1a')]%_0x1dca1e:0x0;_0x45ef97[_0x3e42('0x1c')](function(_0xdbeb7d){if(_0xdbeb7d>0x0){_0x475c28+=_0x1dca1e;}_0x91c3cf['push'](dbH[_0x3e42('0x12')][_0x3e42('0x13')](util['format'](_0x3e42('0x1d'),QUERY,_0x1dca1e,_0x475c28),{'type':dbH['sequelize'][_0x3e42('0x15')]['SELECT']}));});if(_0x108f87>0x0){_0x475c28+=_0x1dca1e;_0x91c3cf[_0x3e42('0x1e')](dbH[_0x3e42('0x12')][_0x3e42('0x13')](util[_0x3e42('0xb')](_0x3e42('0x1d'),QUERY,_0x108f87,_0x475c28),{'type':dbH[_0x3e42('0x12')][_0x3e42('0x15')]['SELECT']}));}}}else{_0x91c3cf['push'](dbH['sequelize'][_0x3e42('0x13')](QUERY,{'type':dbH['sequelize'][_0x3e42('0x15')][_0x3e42('0x16')]}));}var _0x12b6a5=path[_0x3e42('0x1f')](PATH);var _0x120012=path[_0x3e42('0x20')](PATH,_0x3e42('0x21'));var _0x4cdc10=_0x53a1ad['split']&&_0x91c3cf[_0x3e42('0x18')]>0x1;var _0xbb709a=[];if(!fs['existsSync'](path[_0x3e42('0x22')](_0x12b6a5,_0x120012))&&_0x4cdc10){fs[_0x3e42('0x23')](path[_0x3e42('0x22')](_0x12b6a5,_0x120012));}return BPromise['each'](_0x91c3cf,function(_0x3e5a7f){_0xbb709a[_0x3e42('0x1e')](_0x3e5a7f);})[_0x3e42('0x10')](function(){for(var _0x243a76=0x0;_0x243a76<_0xbb709a[_0x3e42('0x18')];_0x243a76+=0x1){var _0x2e951b;var _0x522128=_0xbb709a[_0x243a76];if(_0x4cdc10){_0x2e951b=path[_0x3e42('0x22')](_0x12b6a5,_0x120012,util['format'](_0x3e42('0x24'),_0x120012,_0x243a76,_0x3e42('0x25')));}else{_0x2e951b=path[_0x3e42('0x22')](_0x12b6a5,util[_0x3e42('0xb')]('%s.%s',_0x120012,'xlsx'));}fs[_0x3e42('0x26')](_0x2e951b,json2xls(_0x522128),_0x3e42('0x27'));}})['then'](function(){if(_0x4cdc10){return new Promise(function(_0x415ca8){zipdir(path['join'](_0x12b6a5,_0x120012),{'saveTo':path['join'](_0x12b6a5,util['format']('%s.%s',_0x120012,'zip'))},function(_0x3a2046,_0x2fe2b8){rimraf(path[_0x3e42('0x22')](_0x12b6a5,_0x120012),function(){});_0x415ca8(_0x3e42('0x28'));});});}})[_0x3e42('0x10')](function(){logger[_0x3e42('0xa')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x3e42('0xd')));return analyticExtractedReport(_0x3e42('0x29'),_0x4cdc10?util[_0x3e42('0xb')]('%s.%s',_0x120012,_0x4cdc10?'zip':_0x3e42('0x25')):null);});})['catch'](function(_0x2e5f55){logger[_0x3e42('0xa')](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x3e42('0xd')),util[_0x3e42('0x2a')](_0x2e5f55,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x3e42('0x2b')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 3e5bd5a..958840f 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 _0x4fd9=['format','CDR(type)=%s','type','context','VoiceExtensionId','inbound','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','interval','*,*,*,*','intervals','hasOwnProperty','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','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','transaction','destroy','sortBy','error','rewrite','lodash','util','Interval','findAll','VoiceExtension','IntervalId','then','models','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','priority','extensions','extension','push','Set'];(function(_0x30921a,_0x24b33d){var _0x23c23c=function(_0x221575){while(--_0x221575){_0x30921a['push'](_0x30921a['shift']());}};_0x23c23c(++_0x24b33d);}(_0x4fd9,0xb9));var _0x94fd=function(_0x537106,_0x5b7cc0){_0x537106=_0x537106-0x0;var _0x2a7fa9=_0x4fd9[_0x537106];return _0x2a7fa9;};'use strict';var _=require(_0x94fd('0x0'));var util=require(_0x94fd('0x1'));function rewrite(_0x7b0cab,_0x48669c){var _0x2e56ec=this;return _0x7b0cab['models'][_0x94fd('0x2')][_0x94fd('0x3')]({'raw':!![]})['then'](function(_0x23d78c){_0x2e56ec['intervals']=_0x23d78c;return _0x7b0cab['models'][_0x94fd('0x4')][_0x94fd('0x3')]({'where':{'IntervalId':_0x48669c[_0x94fd('0x5')]},'raw':!![]});})[_0x94fd('0x6')](function(_0x171f7a){return _0x7b0cab[_0x94fd('0x7')][_0x94fd('0x4')][_0x94fd('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x94fd('0x8')](_0x171f7a,_0x94fd('0x9')))}},'order':[{'raw':_0x94fd('0xa')}],'raw':!![]});})[_0x94fd('0x6')](function(_0x46396f){var _0x4a6afa=_[_0x94fd('0xb')](_0x46396f,{'priority':'1'});var _0x204141=_['filter'](_0x46396f,{'isApp':0x1});var _0x31e68c=_[_0x94fd('0xc')](_0x204141,'exten');var _0x373be0=[_0x94fd('0xd'),'playback'];var _0x32917b=[];var _0x3b0658=[];for(var _0x54187b in _0x31e68c){if(_0x31e68c['hasOwnProperty'](_0x54187b)){_0x2e56ec[_0x94fd('0xe')]=0x2;_0x2e56ec[_0x94fd('0xf')]=[];_0x2e56ec[_0x94fd('0x10')]=_['find'](_0x4a6afa,{'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')]});_0x2e56ec['extensions'][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0]['type'],'app':_0x94fd('0x12'),'appdata':util[_0x94fd('0x13')](_0x94fd('0x14'),_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')]),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});if(_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')]===_0x94fd('0x18')){_0x2e56ec['extensions'][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':'CDR(routeid)='+_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')],'context':_0x31e68c[_0x54187b][0x0]['context'],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}else if(_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')]===_0x94fd('0x19')){if(_0x2e56ec[_0x94fd('0x10')]){_0x2e56ec[_0x94fd('0xf')]['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x94fd('0x1a')+(_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]?_0x94fd('0x1c')+_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]+'}':_0x94fd('0x1d')),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}_0x2e56ec['extensions'][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x94fd('0x1e')+_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')],'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});var _0x952a11=_0x2e56ec['priority']++;_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x1f'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x952a11+0x2)+_0x94fd('0x20')+(_0x952a11+0x1)+')','context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x952a11,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});if(_0x2e56ec[_0x94fd('0x10')]){_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]?_0x94fd('0x21')+_0x2e56ec[_0x94fd('0x10')][_0x94fd('0x1b')]+'}':'CDR(prefix)=noprefix','context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0]['exten'],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x22')+_0x31e68c[_0x54187b][0x0]['VoiceExtensionId'],'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0]['VoiceExtensionId']});if(_0x2e56ec[_0x94fd('0x10')]&&_0x2e56ec[_0x94fd('0x10')]['hasOwnProperty'](_0x94fd('0x23'))&&_0x2e56ec['extension'][_0x94fd('0x23')]!==_0x94fd('0x24')){_0x2e56ec[_0x94fd('0xf')]['push']({'type':_0x31e68c[_0x54187b][0x0]['type'],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x25'),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x26')+_0x2e56ec[_0x94fd('0x10')]['recordingFormat']||_0x94fd('0x27'),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0]['exten'],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}}_0x2e56ec[_0x94fd('0xf')][_0x94fd('0x11')]({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x28'),'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec[_0x94fd('0xe')]++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0]['VoiceExtensionId']});_0x2e56ec['extensions']['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'priority':_0x2e56ec['priority']++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0]['VoiceExtensionId']});_0x2e56ec[_0x94fd('0xf')]['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Set','appdata':_0x94fd('0x29'),'context':_0x31e68c[_0x54187b][0x0]['context'],'exten':_0x31e68c[_0x54187b][0x0]['exten'],'priority':_0x2e56ec['priority']++,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});for(var _0x48b20b=0x0,_0x24fe49=0x0;_0x48b20b<_0x31e68c[_0x54187b][_0x94fd('0x2a')];_0x48b20b+=0x1,_0x24fe49=0x0){var _0x184e61=_0x31e68c[_0x54187b][_0x48b20b];if(_0x184e61['type']){_0x184e61['type']=_0x184e61['type'][_0x94fd('0x2b')]();}var _0x9402da=[];var _0x3ccce7=[];delete _0x184e61['id'];delete _0x184e61['createdAt'];delete _0x184e61[_0x94fd('0x2c')];var _0x7fca50=_0x184e61[_0x94fd('0x2d')]!==_0x94fd('0x2e')?[_0x184e61[_0x94fd('0x2d')]]:_0x184e61['IntervalId']?_[_0x94fd('0x8')](_[_0x94fd('0xb')](_0x2e56ec[_0x94fd('0x2f')],{'IntervalId':_0x184e61[_0x94fd('0x5')]}),'interval'):[];if(_0x184e61[_0x94fd('0x30')](_0x94fd('0x31'))){if(_0x184e61[_0x94fd('0x31')]&&_0x184e61[_0x94fd('0x31')]!=='--'){_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'Set','appdata':'CDR(tag)='+_0x184e61['tag'],'context':_0x184e61['context'],'exten':_0x184e61['exten'],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}}if(_0x184e61['type']==='outbound'&&_0x184e61[_0x94fd('0x30')](_0x94fd('0x32'))){if(_0x184e61[_0x94fd('0x32')]){_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'ExecIf','appdata':_0x94fd('0x33')+_0x184e61[_0x94fd('0x32')]+')','context':_0x184e61['context'],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec['priority']+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}else{_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'ExecIf','appdata':_0x94fd('0x34'),'context':_0x184e61[_0x94fd('0x16')],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}}if(_0x184e61[_0x94fd('0x30')](_0x94fd('0x35'))){if(_0x373be0[_0x94fd('0x36')](_0x184e61['app'][_0x94fd('0x2b')]())>=0x0&&_0x184e61[_0x94fd('0x37')]!=='custom'){if(_0x184e61[_0x94fd('0x35')]){_0x9402da[_0x94fd('0x11')]({'type':_0x184e61['type'],'app':_0x94fd('0x1f'),'appdata':_0x94fd('0x38'),'context':_0x184e61[_0x94fd('0x16')],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});_0x9402da[_0x94fd('0x11')]({'type':_0x184e61['type'],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x39'),'context':_0x184e61['context'],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});}else{_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':'ExecIf','appdata':_0x94fd('0x3a'),'context':_0x184e61[_0x94fd('0x16')],'exten':_0x184e61[_0x94fd('0x9')],'priority':_0x7fca50[_0x94fd('0x2a')]+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61[_0x94fd('0x17')]});_0x9402da[_0x94fd('0x11')]({'type':_0x184e61[_0x94fd('0x15')],'app':_0x94fd('0x12'),'appdata':_0x94fd('0x3b'),'context':_0x184e61['context'],'exten':_0x184e61['exten'],'priority':_0x7fca50['length']+_0x2e56ec[_0x94fd('0xe')]+_0x24fe49++,'VoiceExtensionId':_0x184e61['VoiceExtensionId']});}}}for(var _0x90983e=0x0;_0x90983e<_0x7fca50['length'];_0x90983e+=0x1){var _0x3ff679=_0x2e56ec['priority']+_0x7fca50[_0x94fd('0x2a')];var _0x5acd12=_0x90983e===_0x7fca50[_0x94fd('0x2a')]-0x1?_0x2e56ec[_0x94fd('0xe')]+_0x9402da['length']+_0x3ccce7[_0x94fd('0x2a')]+0x2:_0x2e56ec[_0x94fd('0xe')]+_0x90983e+0x1;_0x9402da['splice'](_0x90983e,0x0,{'type':_0x184e61[_0x94fd('0x15')],'app':'GotoIfTime','appdata':_0x7fca50[_0x90983e]+'?'+_0x184e61[_0x94fd('0x16')]+_0x94fd('0x3c')+_0x3ff679+':'+_0x184e61[_0x94fd('0x16')]+_0x94fd('0x3c')+_0x5acd12,'exten':_0x184e61['exten'],'context':_0x184e61[_0x94fd('0x16')],'priority':_0x2e56ec[_0x94fd('0xe')]+_0x90983e,'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});}_0x184e61[_0x94fd('0xe')]=_0x9402da['length']?_[_0x94fd('0x3d')](_0x9402da)[_0x94fd('0xe')]+0x1:_0x2e56ec['priority'];_0x2e56ec[_0x94fd('0xe')]=(_0x3ccce7[_0x94fd('0x2a')]?_['last'](_0x3ccce7)['priority']:_0x184e61[_0x94fd('0xe')])+0x1;_0x2e56ec['extensions']=_[_0x94fd('0x3e')](_0x2e56ec[_0x94fd('0xf')],_0x9402da,[_0x184e61],_0x3ccce7);}_0x2e56ec['extensions']['push']({'type':_0x31e68c[_0x54187b][0x0][_0x94fd('0x15')],'app':'Hangup','exten':_0x31e68c[_0x54187b][0x0][_0x94fd('0x9')],'context':_0x31e68c[_0x54187b][0x0][_0x94fd('0x16')],'priority':_0x2e56ec['priority'],'VoiceExtensionId':_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]});_0x32917b[_0x94fd('0x11')](_0x31e68c[_0x54187b][0x0][_0x94fd('0x17')]);_0x3b0658=_['concat'](_0x3b0658,_0x2e56ec[_0x94fd('0xf')]);}}return _0x7b0cab[_0x94fd('0x3f')](function(_0x52c487){return _0x7b0cab[_0x94fd('0x7')][_0x94fd('0x4')][_0x94fd('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x32917b}},'transaction':_0x52c487})[_0x94fd('0x6')](function(_0x43f572){return _0x7b0cab[_0x94fd('0x7')][_0x94fd('0x4')]['bulkCreate'](_[_0x94fd('0x41')](_0x3b0658,'priority'),{'transaction':_0x52c487});});});})['catch'](function(_0x45fcde){console[_0x94fd('0x42')](_0x45fcde);});}exports[_0x94fd('0x43')]=rewrite; \ No newline at end of file +var _0x8a68=['then','intervals','IntervalId','VoiceExtension','uniq','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','exten','queue','playback','hasOwnProperty','extensions','find','push','type','format','CDR(type)=%s','context','priority','VoiceExtensionId','Set','CDR(routeid)=','outbound','extension','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','*,*,*,*','interval','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','last','concat','Hangup','bulkCreate','catch','error','rewrite','lodash','util','models','findAll'];(function(_0xc1f504,_0x1d6d8a){var _0xaedabf=function(_0x4e7efd){while(--_0x4e7efd){_0xc1f504['push'](_0xc1f504['shift']());}};_0xaedabf(++_0x1d6d8a);}(_0x8a68,0x1a6));var _0x88a6=function(_0x2386ef,_0x4026f1){_0x2386ef=_0x2386ef-0x0;var _0x4ef7ad=_0x8a68[_0x2386ef];return _0x4ef7ad;};'use strict';var _=require(_0x88a6('0x0'));var util=require(_0x88a6('0x1'));function rewrite(_0x213ba1,_0x469b31){var _0x4293e7=this;return _0x213ba1[_0x88a6('0x2')]['Interval'][_0x88a6('0x3')]({'raw':!![]})[_0x88a6('0x4')](function(_0x40ec95){_0x4293e7[_0x88a6('0x5')]=_0x40ec95;return _0x213ba1[_0x88a6('0x2')]['VoiceExtension'][_0x88a6('0x3')]({'where':{'IntervalId':_0x469b31[_0x88a6('0x6')]},'raw':!![]});})['then'](function(_0x4c04e8){return _0x213ba1[_0x88a6('0x2')][_0x88a6('0x7')][_0x88a6('0x3')]({'where':{'exten':{'$in':_[_0x88a6('0x8')](_['map'](_0x4c04e8,'exten'))}},'order':[{'raw':_0x88a6('0x9')}],'raw':!![]});})[_0x88a6('0x4')](function(_0x422661){var _0x44e436=_[_0x88a6('0xa')](_0x422661,{'priority':'1'});var _0x507f40=_[_0x88a6('0xa')](_0x422661,{'isApp':0x1});var _0x3ea7ab=_[_0x88a6('0xb')](_0x507f40,_0x88a6('0xc'));var _0x3b00f3=[_0x88a6('0xd'),_0x88a6('0xe')];var _0x49f79c=[];var _0x411dbb=[];for(var _0x2f8314 in _0x3ea7ab){if(_0x3ea7ab[_0x88a6('0xf')](_0x2f8314)){_0x4293e7['priority']=0x2;_0x4293e7[_0x88a6('0x10')]=[];_0x4293e7['extension']=_[_0x88a6('0x11')](_0x44e436,{'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')]});_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':'Set','appdata':util[_0x88a6('0x14')](_0x88a6('0x15'),_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')]),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});if(_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')]==='inbound'){_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x1a')+_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')],'context':_0x3ea7ab[_0x2f8314][0x0]['context'],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}else if(_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')]===_0x88a6('0x1b')){if(_0x4293e7[_0x88a6('0x1c')]){_0x4293e7['extensions']['push']({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':'Set','appdata':_0x88a6('0x1d')+(_0x4293e7[_0x88a6('0x1c')][_0x88a6('0x1e')]?_0x88a6('0x1f')+_0x4293e7['extension'][_0x88a6('0x1e')]+'}':_0x88a6('0x20')),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x1a')+_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')],'context':_0x3ea7ab[_0x2f8314][0x0]['context'],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});var _0x3f3564=_0x4293e7['priority']++;_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x3f3564+0x2)+_0x88a6('0x22')+(_0x3f3564+0x1)+')','context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x3f3564,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0]['VoiceExtensionId']});if(_0x4293e7[_0x88a6('0x1c')]){_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x4293e7['extension'][_0x88a6('0x1e')]?_0x88a6('0x23')+_0x4293e7['extension'][_0x88a6('0x1e')]+'}':_0x88a6('0x24'),'context':_0x3ea7ab[_0x2f8314][0x0]['context'],'exten':_0x3ea7ab[_0x2f8314][0x0]['exten'],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':_0x88a6('0x19'),'appdata':'outboundrouteid='+_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')],'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0]['VoiceExtensionId']});if(_0x4293e7[_0x88a6('0x1c')]&&_0x4293e7[_0x88a6('0x1c')][_0x88a6('0xf')]('recordingFormat')&&_0x4293e7['extension']['recordingFormat']!==_0x88a6('0x25')){_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x26'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x4293e7[_0x88a6('0x10')][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x27')+_0x4293e7['extension'][_0x88a6('0x28')]||_0x88a6('0x29'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0]['exten'],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}}_0x4293e7[_0x88a6('0x10')]['push']({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x2a'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x2b'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'priority':_0x4293e7[_0x88a6('0x17')]++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x4293e7['extensions']['push']({'type':_0x3ea7ab[_0x2f8314][0x0]['type'],'app':'Set','appdata':_0x88a6('0x2c'),'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'exten':_0x3ea7ab[_0x2f8314][0x0]['exten'],'priority':_0x4293e7['priority']++,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});for(var _0x369e4f=0x0,_0x3b5cd0=0x0;_0x369e4f<_0x3ea7ab[_0x2f8314][_0x88a6('0x2d')];_0x369e4f+=0x1,_0x3b5cd0=0x0){var _0x14fc93=_0x3ea7ab[_0x2f8314][_0x369e4f];if(_0x14fc93[_0x88a6('0x13')]){_0x14fc93[_0x88a6('0x13')]=_0x14fc93[_0x88a6('0x13')][_0x88a6('0x2e')]();}var _0x57eb2d=[];var _0x517615=[];delete _0x14fc93['id'];delete _0x14fc93['createdAt'];delete _0x14fc93['updatedAt'];var _0x1dc415=_0x14fc93['interval']!==_0x88a6('0x2f')?[_0x14fc93[_0x88a6('0x30')]]:_0x14fc93[_0x88a6('0x6')]?_[_0x88a6('0x31')](_[_0x88a6('0xa')](_0x4293e7[_0x88a6('0x5')],{'IntervalId':_0x14fc93[_0x88a6('0x6')]}),_0x88a6('0x30')):[];if(_0x14fc93[_0x88a6('0xf')](_0x88a6('0x32'))){if(_0x14fc93['tag']&&_0x14fc93[_0x88a6('0x32')]!=='--'){_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x33')+_0x14fc93[_0x88a6('0x32')],'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93['VoiceExtensionId']});}}if(_0x14fc93['type']===_0x88a6('0x1b')&&_0x14fc93[_0x88a6('0xf')](_0x88a6('0x34'))){if(_0x14fc93['callerID']){_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x35')+_0x14fc93['callerID']+')','context':_0x14fc93['context'],'exten':_0x14fc93['exten'],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7['priority']+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}else{_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x36'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}}if(_0x14fc93[_0x88a6('0xf')](_0x88a6('0x37'))){if(_0x3b00f3[_0x88a6('0x38')](_0x14fc93[_0x88a6('0x39')][_0x88a6('0x2e')]())>=0x0&&_0x14fc93[_0x88a6('0x3a')]!==_0x88a6('0x3b')){if(_0x14fc93[_0x88a6('0x37')]){_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x3c'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7['priority']+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}else{_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x21'),'appdata':_0x88a6('0x3d'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93['exten'],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7['priority']+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});_0x57eb2d[_0x88a6('0x12')]({'type':_0x14fc93[_0x88a6('0x13')],'app':_0x88a6('0x19'),'appdata':_0x88a6('0x3e'),'context':_0x14fc93[_0x88a6('0x16')],'exten':_0x14fc93[_0x88a6('0xc')],'priority':_0x1dc415[_0x88a6('0x2d')]+_0x4293e7[_0x88a6('0x17')]+_0x3b5cd0++,'VoiceExtensionId':_0x14fc93[_0x88a6('0x18')]});}}}for(var _0x4ba3c7=0x0;_0x4ba3c7<_0x1dc415['length'];_0x4ba3c7+=0x1){var _0x1a8170=_0x4293e7[_0x88a6('0x17')]+_0x1dc415[_0x88a6('0x2d')];var _0x2bac52=_0x4ba3c7===_0x1dc415['length']-0x1?_0x4293e7[_0x88a6('0x17')]+_0x57eb2d[_0x88a6('0x2d')]+_0x517615[_0x88a6('0x2d')]+0x2:_0x4293e7['priority']+_0x4ba3c7+0x1;_0x57eb2d['splice'](_0x4ba3c7,0x0,{'type':_0x14fc93[_0x88a6('0x13')],'app':'GotoIfTime','appdata':_0x1dc415[_0x4ba3c7]+'?'+_0x14fc93[_0x88a6('0x16')]+_0x88a6('0x3f')+_0x1a8170+':'+_0x14fc93[_0x88a6('0x16')]+_0x88a6('0x3f')+_0x2bac52,'exten':_0x14fc93['exten'],'context':_0x14fc93[_0x88a6('0x16')],'priority':_0x4293e7[_0x88a6('0x17')]+_0x4ba3c7,'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});}_0x14fc93[_0x88a6('0x17')]=_0x57eb2d[_0x88a6('0x2d')]?_[_0x88a6('0x40')](_0x57eb2d)['priority']+0x1:_0x4293e7[_0x88a6('0x17')];_0x4293e7[_0x88a6('0x17')]=(_0x517615[_0x88a6('0x2d')]?_[_0x88a6('0x40')](_0x517615)[_0x88a6('0x17')]:_0x14fc93['priority'])+0x1;_0x4293e7[_0x88a6('0x10')]=_[_0x88a6('0x41')](_0x4293e7[_0x88a6('0x10')],_0x57eb2d,[_0x14fc93],_0x517615);}_0x4293e7['extensions'][_0x88a6('0x12')]({'type':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x13')],'app':_0x88a6('0x42'),'exten':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0xc')],'context':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x16')],'priority':_0x4293e7[_0x88a6('0x17')],'VoiceExtensionId':_0x3ea7ab[_0x2f8314][0x0][_0x88a6('0x18')]});_0x49f79c['push'](_0x3ea7ab[_0x2f8314][0x0]['VoiceExtensionId']);_0x411dbb=_[_0x88a6('0x41')](_0x411dbb,_0x4293e7['extensions']);}}return _0x213ba1['transaction'](function(_0x58a434){return _0x213ba1[_0x88a6('0x2')][_0x88a6('0x7')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x49f79c}},'transaction':_0x58a434})[_0x88a6('0x4')](function(_0x46c9dd){return _0x213ba1[_0x88a6('0x2')][_0x88a6('0x7')][_0x88a6('0x43')](_['sortBy'](_0x411dbb,_0x88a6('0x17')),{'transaction':_0x58a434});});});})[_0x88a6('0x44')](function(_0x543102){console[_0x88a6('0x45')](_0x543102);});}exports[_0x88a6('0x46')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ba8a93f..a4e40a8 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 _0x599c=['emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','data','firstName','firstName\x20not\x20specified!','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','inspect','insert','into','fromQuery','ContactId','createdAt','updatedAt','phone','NOW()','scheduledAt','toString','field','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','select','ListId\x20=\x20?','id\x20IN\x20?','str','calleridnum','cm_hopper','cm_hopper_black','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','all','VoiceQueue','BlackLists','CampaignId','Campaign','cmContact,\x20%s,\x20%s','stringify','finally'];(function(_0x450c7f,_0x161fb5){var _0x15239e=function(_0x4cacb2){while(--_0x4cacb2){_0x450c7f['push'](_0x450c7f['shift']());}};_0x15239e(++_0x161fb5);}(_0x599c,0xee));var _0xc599=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x599c[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xc599('0x0'));var fs=require('fs');var squel=require(_0xc599('0x1'));var Papa=require(_0xc599('0x2'));var Redis=require(_0xc599('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xc599('0x4'));var logger=require(_0xc599('0x5'))(_0xc599('0x6'));config[_0xc599('0x7')]=_[_0xc599('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc599('0x9'))(new Redis(config[_0xc599('0x7')]));require(_0xc599('0xa'))[_0xc599('0xb')](socket);try{if(!process['argv'][0x2]||process[_0xc599('0xc')][0x2]===_0xc599('0xd')||process[_0xc599('0xc')][0x2]===_0xc599('0xe')){throw new Error(_0xc599('0xf'));}var FILEPATH=process['argv'][0x2];if(!process[_0xc599('0xc')][0x3]||process['argv'][0x3]==='undefined'||process[_0xc599('0xc')][0x3]==='null'||!process[_0xc599('0xc')][0x4]||process['argv'][0x4]===_0xc599('0xd')||process['argv'][0x4]==='null'){throw new Error(_0xc599('0x10'));}var FIELDS=_['zipObject'](process[_0xc599('0xc')][0x3][_0xc599('0x11')](','),process[_0xc599('0xc')][0x4][_0xc599('0x11')](','));if(!process[_0xc599('0xc')][0x5]||process[_0xc599('0xc')][0x5]===_0xc599('0xd')||process[_0xc599('0xc')][0x5]===_0xc599('0xe')){throw new Error(_0xc599('0x12'));}var LISTID=process[_0xc599('0xc')][0x5];var COMPANYID=process[_0xc599('0xc')][0x6]&&process[_0xc599('0xc')][0x6]!==_0xc599('0xd')&&process[_0xc599('0xc')][0x6]!==_0xc599('0xe')?process[_0xc599('0xc')][0x6]:null;var DUPLICATES=process[_0xc599('0xc')][0x7]&&process['argv'][0x7]!==_0xc599('0xd')&&process[_0xc599('0xc')][0x7]!==_0xc599('0xe')?process[_0xc599('0xc')][0x7]:null;if(!process['argv'][0x8]||process[_0xc599('0xc')][0x8]===_0xc599('0xd')||process[_0xc599('0xc')][0x8]===_0xc599('0xe')){throw new Error(_0xc599('0x13'));}var SOCKET_TIMESTAMP=process[_0xc599('0xc')][0x8];}catch(_0x56bdeb){logger[_0xc599('0x14')](_0x56bdeb);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(_0x495d9e,_0x390109,_0x555c1f,_0x28b95b){var _0x4f0835={'message':_0x390109};_0x4f0835[_0x495d9e]=!![];if(_0x555c1f){_0x4f0835[_0xc599('0x15')]=_0x555c1f;}if(_0x28b95b){_0x4f0835['index']=_0x28b95b;}return _0x4f0835;}function isEmail(_0x427409){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))*$/[_0xc599('0x16')](_0x427409);}function checkRow(_0x25d3e6,_0x34c3ce,_0x121379){return new BPromise(function(_0x3413d5,_0x49eb1a){if(_[_0xc599('0x17')](_0x25d3e6)){return _0x49eb1a(handleCheckRowError('error',_0xc599('0x18'),null,_0x121379));}if(_0x25d3e6[_0xc599('0x19')]&&_0x25d3e6[_0xc599('0x19')][_0xc599('0x1a')]){var _0x260353=_['map'](_0x25d3e6[_0xc599('0x19')],_0xc599('0x1b'))[_0xc599('0x1c')](';');return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),_0x260353,null,_0x121379));}var _0x16f7ea={};for(var _0x52742d in FIELDS){if(FIELDS['hasOwnProperty'](_0x52742d)&&FIELDS[_0x52742d]){_0x16f7ea[_0x52742d]=_0x25d3e6[_0xc599('0x1d')][0x0][FIELDS[_0x52742d]]||_0x25d3e6[_0xc599('0x1d')][0x0]['\ufeff'+FIELDS[_0x52742d]];}}if(!_0x16f7ea[_0xc599('0x1e')]){return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),_0xc599('0x1f'),null,_0x121379));}if(!_0x16f7ea['phone']){return _0x49eb1a(handleCheckRowError('error',_0xc599('0x20'),null,_0x121379));}if(_0x16f7ea[_0xc599('0x21')]){var _0x17e93c=moment(_0x16f7ea[_0xc599('0x21')],_0xc599('0x22'));if(!_0x17e93c['isValid']()){return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x121379));}}if(_0x16f7ea[_0xc599('0x23')]){if(!isEmail(_0x16f7ea[_0xc599('0x23')])){return _0x49eb1a(handleCheckRowError('error',_0xc599('0x24'),null,_0x121379));}}_0x16f7ea[_0xc599('0x25')]=LISTID;_0x16f7ea[_0xc599('0x26')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x34c3ce){var _0x259f93={};for(var _0x16a46c=0x0,_0x1925af=DUPLICATES[_0xc599('0x1a')];_0x16a46c<_0x1925af;_0x16a46c+=0x1){_0x259f93[DUPLICATES[_0x16a46c]]=_0x16f7ea[DUPLICATES[_0x16a46c]];}var _0x49cdff=_['find'](_0x34c3ce,_0x259f93);if(_0x49cdff){return _0x49eb1a(handleCheckRowError(_0xc599('0x27'),_0xc599('0x28'),_0x49cdff,_0x121379));}}return db[_0xc599('0x29')]['create'](_0x16f7ea,{'raw':!![],'hooks':![],'fields':_[_0xc599('0x2a')](_0x16f7ea)})['then'](function(_0xb98caa){if(DUPLICATES&&DUPLICATES[_0xc599('0x1a')]&&_0x34c3ce){_0x34c3ce[_0xc599('0x2b')](_[_0xc599('0x2c')](_0x16f7ea,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xb98caa['id'];return _0x3413d5();})[_0xc599('0x2d')](function(_0x573eb1){return _0x49eb1a(handleCheckRowError(_0xc599('0x14'),_0xc599('0x2e')+(_0x573eb1[_0xc599('0x1b')]||JSON['stringify'](_0x573eb1)),null,_0x121379));});});}function checkHopper(){function _0x195373(){return function(_0xce5f5b){logger['error'](_0xc599('0x2f'),_0xc599('0x30'),util[_0xc599('0x31')](_0xce5f5b,{'showHidden':![],'depth':null}));};}var _0x16d7de=function(_0x3e2543,_0x10ed7){var _0x5a7bd5=squel[_0xc599('0x32')]()[_0xc599('0x33')]('cm_hopper')[_0xc599('0x34')](['phone','scheduledAt',_0xc599('0x35'),_0xc599('0x25'),_0x10ed7,_0xc599('0x36'),_0xc599('0x37')],squel['select']()['field'](_0xc599('0x38'),_0xc599('0x38'))['field'](_0xc599('0x39'),_0xc599('0x3a'))['field']('id',_0xc599('0x35'))['field'](LISTID[_0xc599('0x3b')](),'ListId')[_0xc599('0x3c')](_0x3e2543['id'][_0xc599('0x3b')](),_0x10ed7)[_0xc599('0x3c')]('NOW()',_0xc599('0x36'))[_0xc599('0x3c')]('NOW()',_0xc599('0x37'))[_0xc599('0x3d')](_0xc599('0x3e'))[_0xc599('0x3f')](_0xc599('0x40'))[_0xc599('0x3f')]('ListId\x20=\x20?',LISTID[_0xc599('0x3b')]())[_0xc599('0x3f')](_0xc599('0x41'))['where'](_0xc599('0x42'),squel['select']()['field'](_0xc599('0x38'))[_0xc599('0x3d')]('cm_hopper')[_0xc599('0x3f')](_0x10ed7+_0xc599('0x43'),_0x3e2543['id'][_0xc599('0x3b')]())))['toString']();return _0x5a7bd5;};var _0x3443ea=function(_0x314e7b,_0x20f7f7){var _0x5157dd=squel[_0xc599('0x32')]()[_0xc599('0x33')]('cm_hopper')[_0xc599('0x34')]([_0xc599('0x38'),_0xc599('0x3a'),_0xc599('0x35'),'ListId',_0x20f7f7,_0xc599('0x36'),'updatedAt'],squel[_0xc599('0x44')]()[_0xc599('0x3c')](_0xc599('0x38'),_0xc599('0x38'))[_0xc599('0x3c')]('NOW()','scheduledAt')['field']('id',_0xc599('0x35'))[_0xc599('0x3c')](LISTID['toString'](),'ListId')['field'](_0x314e7b['id'][_0xc599('0x3b')](),_0x20f7f7)[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x36'))['field'](_0xc599('0x39'),'updatedAt')[_0xc599('0x3d')](_0xc599('0x3e'))[_0xc599('0x3f')](_0xc599('0x40'))['where'](_0xc599('0x45'),LISTID['toString']())[_0xc599('0x3f')](_0xc599('0x46'),squel[_0xc599('0x47')](hopperContacts))[_0xc599('0x3f')](_0xc599('0x41'))[_0xc599('0x3f')](_0xc599('0x42'),squel['select']()['field'](_0xc599('0x48'))['from']('cm_hopper_final')[_0xc599('0x3f')](_0x20f7f7+_0xc599('0x43'),_0x314e7b['id']['toString']()))[_0xc599('0x3f')](_0xc599('0x42'),squel[_0xc599('0x44')]()['field'](_0xc599('0x38'))[_0xc599('0x3d')](_0xc599('0x49'))[_0xc599('0x3f')](_0x20f7f7+'\x20=\x20?',_0x314e7b['id']['toString']())))[_0xc599('0x3b')]();return _0x5157dd;};function _0x530771(_0x533401,_0x14bc66){var _0x2e8b2d=squel[_0xc599('0x32')]()[_0xc599('0x33')]('cm_hopper')[_0xc599('0x34')]([_0xc599('0x38'),_0xc599('0x3a'),_0xc599('0x35'),'ListId',_0x14bc66,_0xc599('0x36'),_0xc599('0x37')],squel[_0xc599('0x44')]()[_0xc599('0x3c')](_0xc599('0x38'),_0xc599('0x38'))[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x3a'))[_0xc599('0x3c')]('id','ContactId')[_0xc599('0x3c')](LISTID[_0xc599('0x3b')](),'ListId')[_0xc599('0x3c')](_0x533401['id']['toString'](),_0x14bc66)[_0xc599('0x3c')]('NOW()',_0xc599('0x36'))[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x37'))[_0xc599('0x3d')]('cm_contacts')[_0xc599('0x3f')](_0xc599('0x40'))['where']('ListId\x20=\x20?',LISTID[_0xc599('0x3b')]())[_0xc599('0x3f')](_0xc599('0x46'),squel['str'](hopperContacts))[_0xc599('0x3f')](_0xc599('0x41')))[_0xc599('0x3b')]();return _0x2e8b2d;}function _0x242e3d(_0x192e51,_0x339e9f){var _0x2031ed=squel[_0xc599('0x32')]()[_0xc599('0x33')](_0xc599('0x4a'))['fromQuery'](['phone',_0xc599('0x35'),'ListId',_0x339e9f,'createdAt',_0xc599('0x37')],squel[_0xc599('0x44')]()[_0xc599('0x3c')](_0xc599('0x38'),'phone')[_0xc599('0x3c')]('id',_0xc599('0x35'))['field'](LISTID[_0xc599('0x3b')](),_0xc599('0x25'))[_0xc599('0x3c')](_0x192e51['id'][_0xc599('0x3b')](),_0x339e9f)[_0xc599('0x3c')](_0xc599('0x39'),_0xc599('0x36'))[_0xc599('0x3c')](_0xc599('0x39'),'updatedAt')[_0xc599('0x3d')]('cm_contacts')[_0xc599('0x3f')](_0xc599('0x40'))['where'](_0xc599('0x45'),LISTID[_0xc599('0x3b')]())[_0xc599('0x3f')](_0xc599('0x46'),squel['str'](hopperContacts))[_0xc599('0x3f')](_0xc599('0x41')))[_0xc599('0x3b')]();return _0x2031ed;}return db['VoiceQueue'][_0xc599('0x4b')]({'where':{'type':_0xc599('0x4c')},'attributes':['id',_0xc599('0x4d')],'include':[{'model':db[_0xc599('0x4e')],'as':_0xc599('0x4f'),'where':{'id':LISTID}}]})[_0xc599('0x50')](function(_0x599a0e){var _0x2f8087=[];if(_0x599a0e){var _0x140b56;for(var _0xb38c09=0x0,_0x43dda2;_0xb38c09<_0x599a0e[_0xc599('0x1a')];_0xb38c09+=0x1){_0x43dda2=_0x599a0e[_0xb38c09][_0xc599('0x51')]({'plain':!![]});switch(_0x43dda2[_0xc599('0x4d')]){case _0xc599('0x52'):_0x2f8087['push'](db[_0xc599('0x53')]['query'](_0x3443ea(_0x43dda2,_0xc599('0x54')))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));break;case _0xc599('0x55'):_0x2f8087[_0xc599('0x2b')](db[_0xc599('0x53')]['query'](_0x16d7de(_0x43dda2,_0xc599('0x54')))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));break;default:_0x2f8087[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x530771(_0x43dda2,_0xc599('0x54')))['then'](function(){})[_0xc599('0x2d')](_0x195373()));}}}return _0x2f8087;})[_0xc599('0x57')]()['then'](function(){return db[_0xc599('0x58')][_0xc599('0x4b')]({'where':{'type':_0xc599('0x4c')},'attributes':['id'],'include':[{'model':db[_0xc599('0x4e')],'as':_0xc599('0x59'),'where':{'id':LISTID}}]})[_0xc599('0x50')](function(_0x4e981f){var _0x186107=[];if(_0x4e981f){var _0x45ff65;for(var _0x1a356b=0x0,_0x245058;_0x1a356b<_0x4e981f[_0xc599('0x1a')];_0x1a356b+=0x1){_0x245058=_0x4e981f[_0x1a356b][_0xc599('0x51')]({'plain':!![]});_0x186107[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x242e3d(_0x245058,'VoiceQueueId'))[_0xc599('0x50')](function(){})['catch'](_0x195373()));}}return _0x186107;})['all']();})[_0xc599('0x50')](function(){return db['Campaign']['findAll']({'attributes':['id',_0xc599('0x4d')],'include':[{'model':db[_0xc599('0x4e')],'as':_0xc599('0x4f'),'where':{'id':LISTID}}]})[_0xc599('0x50')](function(_0x247280){var _0x4af7e8=[];if(_0x247280){for(var _0x22d02a=0x0,_0x4220c3;_0x22d02a<_0x247280[_0xc599('0x1a')];_0x22d02a+=0x1){_0x4220c3=_0x247280[_0x22d02a][_0xc599('0x51')]({'plain':!![]});switch(_0x4220c3[_0xc599('0x4d')]){case _0xc599('0x52'):_0x4af7e8[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x3443ea(_0x4220c3,_0xc599('0x5a')))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));break;case'onlyIfOpen':_0x4af7e8['push'](db[_0xc599('0x53')][_0xc599('0x56')](_0x16d7de(_0x4220c3,_0xc599('0x5a')))['then'](function(){})[_0xc599('0x2d')](_0x195373()));break;default:_0x4af7e8['push'](db[_0xc599('0x53')][_0xc599('0x56')](_0x530771(_0x4220c3,'CampaignId'))[_0xc599('0x50')](function(){})[_0xc599('0x2d')](_0x195373()));}}}return _0x4af7e8;})[_0xc599('0x57')]();})[_0xc599('0x50')](function(){return db[_0xc599('0x5b')][_0xc599('0x4b')]({'attributes':['id'],'include':[{'model':db[_0xc599('0x4e')],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x33cb2f){var _0x39aadf=[];if(_0x33cb2f){for(var _0x48899a=0x0,_0x1c0da6;_0x48899a<_0x33cb2f[_0xc599('0x1a')];_0x48899a+=0x1){_0x1c0da6=_0x33cb2f[_0x48899a]['get']({'plain':!![]});_0x39aadf[_0xc599('0x2b')](db[_0xc599('0x53')][_0xc599('0x56')](_0x242e3d(_0x1c0da6,_0xc599('0x5a')))['then'](function(){})[_0xc599('0x2d')](_0x195373()));}}return _0x39aadf;})['all']();})[_0xc599('0x2d')](function(_0x2be75d){logger[_0xc599('0x14')](_0xc599('0x5c'),'generalCheckHopper',_0x2be75d[_0xc599('0x1b')]);});}var processPromises=function(_0xac170f){return BPromise[_0xc599('0x57')](promises)['then'](function(_0x2debb8){})[_0xc599('0x2d')](function(_0x5a1d39){logger['error']('Error\x20processing\x20rows\x20block:',JSON[_0xc599('0x5d')](_0x5a1d39));})[_0xc599('0x5e')](function(){socket[_0xc599('0x5f')](_0xc599('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0xac170f){return _0xac170f[_0xc599('0x61')]();}});};var endCsv=function(){return BPromise[_0xc599('0x62')]()[_0xc599('0x50')](function(){if(hopperContacts){return checkHopper();}})[_0xc599('0x50')](function(){socket['emit'](_0xc599('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc599('0x63')](FILEPATH);}catch(_0xe8f18f){logger['error'](_0xc599('0x64'),JSON[_0xc599('0x5d')](_0xe8f18f));}finally{process[_0xc599('0x65')](0x0);}});};process['on'](_0xc599('0x66'),function(){logger['info'](_0xc599('0x67'));endCsv();});function main(){return BPromise['resolve']()[_0xc599('0x50')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xc599('0x29')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x52fa1b){var _0xddcdde=fs[_0xc599('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc599('0x69')](_0xddcdde,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1c5651,_0x63b98b){total+=0x1;var _0x4289e8=total;promises[_0xc599('0x2b')](checkRow(_0x1c5651,_0x52fa1b,_0x4289e8)[_0xc599('0x50')](function(){success+=0x1;})['catch'](function(_0xbf34ed){if(_0xbf34ed[_0xc599('0x14')]){errors+=0x1;delete _0xbf34ed[_0xc599('0x14')];}else if(_0xbf34ed[_0xc599('0x27')]){duplicates+=0x1;delete _0xbf34ed[_0xc599('0x27')];}rows[_0xc599('0x2b')](_0xbf34ed);}));if(total%0xc8===0x0){_0x63b98b[_0xc599('0x6a')]();return processPromises(_0x63b98b);}},'complete':function(){return processPromises()[_0xc599('0x50')](function(){logger[_0xc599('0x6b')](_0xc599('0x6c'));endCsv();});},'error':function(_0x589c68,_0x303b36){logger[_0xc599('0x6b')](_0xc599('0x6d'),JSON[_0xc599('0x5d')](_0x589c68));endCsv();}});})[_0xc599('0x2d')](function(_0x34d2b3){logger['error'](_0xc599('0x6e'),JSON['stringify'](_0x34d2b3));});}main(); \ No newline at end of file +var _0x559c=['cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','contact','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','duplicate','Duplicate\x20Contact','CmContact','keys','then','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','cm_hopper','fromQuery','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','createdAt','from','cm_contacts','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','insert','into','deletedAt\x20IS\x20NULL','id\x20IN\x20?','str','calleridnum','cm_hopper_final','cm_hopper_black','VoiceQueue','dialCheckDuplicateType','CmList','Lists','get','push','sequelize','query','VoiceQueueId','catch','all','findAll','outbound','BlackLists','Campaign','always','CampaignId'];(function(_0x575374,_0x48341f){var _0x1403c1=function(_0x244c1e){while(--_0x244c1e){_0x575374['push'](_0x575374['shift']());}};_0x1403c1(++_0x48341f);}(_0x559c,0x155));var _0xc559=function(_0x11c331,_0x523ccf){_0x11c331=_0x11c331-0x0;var _0x1b89e1=_0x559c[_0x11c331];return _0x1b89e1;};'use strict';var BPromise=require(_0xc559('0x0'));var util=require(_0xc559('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xc559('0x2'));var Papa=require(_0xc559('0x3'));var Redis=require('ioredis');var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require(_0xc559('0x4'))(_0xc559('0x5'));config[_0xc559('0x6')]=_[_0xc559('0x7')](config['redis'],{'host':_0xc559('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc559('0x9'))[_0xc559('0xa')](socket);try{if(!process[_0xc559('0xb')][0x2]||process[_0xc559('0xb')][0x2]===_0xc559('0xc')||process[_0xc559('0xb')][0x2]===_0xc559('0xd')){throw new Error(_0xc559('0xe'));}var FILEPATH=process['argv'][0x2];if(!process['argv'][0x3]||process['argv'][0x3]===_0xc559('0xc')||process['argv'][0x3]===_0xc559('0xd')||!process[_0xc559('0xb')][0x4]||process[_0xc559('0xb')][0x4]===_0xc559('0xc')||process[_0xc559('0xb')][0x4]===_0xc559('0xd')){throw new Error(_0xc559('0xf'));}var FIELDS=_[_0xc559('0x10')](process[_0xc559('0xb')][0x3][_0xc559('0x11')](','),process[_0xc559('0xb')][0x4]['split'](','));if(!process['argv'][0x5]||process[_0xc559('0xb')][0x5]===_0xc559('0xc')||process[_0xc559('0xb')][0x5]===_0xc559('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0xc559('0xb')][0x5];var COMPANYID=process[_0xc559('0xb')][0x6]&&process[_0xc559('0xb')][0x6]!==_0xc559('0xc')&&process['argv'][0x6]!=='null'?process[_0xc559('0xb')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xc559('0xb')][0x7]!==_0xc559('0xc')&&process['argv'][0x7]!==_0xc559('0xd')?process[_0xc559('0xb')][0x7]:null;if(!process['argv'][0x8]||process['argv'][0x8]==='undefined'||process[_0xc559('0xb')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xc559('0xb')][0x8];}catch(_0x45b853){logger['error'](_0x45b853);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(_0x50ddd5,_0x469220,_0x4e07dc,_0x26bdbc){var _0x538ba4={'message':_0x469220};_0x538ba4[_0x50ddd5]=!![];if(_0x4e07dc){_0x538ba4[_0xc559('0x12')]=_0x4e07dc;}if(_0x26bdbc){_0x538ba4['index']=_0x26bdbc;}return _0x538ba4;}function isEmail(_0xd6e7e9){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'](_0xd6e7e9);}function checkRow(_0x195c62,_0x3935c4,_0x3686ad){return new BPromise(function(_0x4c5220,_0x2c58c3){if(_['isNil'](_0x195c62)){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x14'),null,_0x3686ad));}if(_0x195c62[_0xc559('0x15')]&&_0x195c62[_0xc559('0x15')][_0xc559('0x16')]){var _0x2122c0=_['map'](_0x195c62[_0xc559('0x15')],_0xc559('0x17'))[_0xc559('0x18')](';');return _0x2c58c3(handleCheckRowError('error',_0x2122c0,null,_0x3686ad));}var _0x453264={};for(var _0x50dbe9 in FIELDS){if(FIELDS[_0xc559('0x19')](_0x50dbe9)&&FIELDS[_0x50dbe9]){_0x453264[_0x50dbe9]=_0x195c62[_0xc559('0x1a')][0x0][FIELDS[_0x50dbe9]]||_0x195c62[_0xc559('0x1a')][0x0]['\ufeff'+FIELDS[_0x50dbe9]];}}if(!_0x453264[_0xc559('0x1b')]){return _0x2c58c3(handleCheckRowError('error',_0xc559('0x1c'),null,_0x3686ad));}if(!_0x453264[_0xc559('0x1d')]){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x1e'),null,_0x3686ad));}if(_0x453264[_0xc559('0x1f')]){var _0x182013=moment(_0x453264['birthDate'],_0xc559('0x20'));if(!_0x182013['isValid']()){return _0x2c58c3(handleCheckRowError('error',_0xc559('0x21'),null,_0x3686ad));}}if(_0x453264[_0xc559('0x22')]){if(!isEmail(_0x453264[_0xc559('0x22')])){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x23'),null,_0x3686ad));}}_0x453264[_0xc559('0x24')]=LISTID;_0x453264[_0xc559('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x3935c4){var _0x3986b1={};for(var _0x4cdaa4=0x0,_0x4aff68=DUPLICATES[_0xc559('0x16')];_0x4cdaa4<_0x4aff68;_0x4cdaa4+=0x1){_0x3986b1[DUPLICATES[_0x4cdaa4]]=_0x453264[DUPLICATES[_0x4cdaa4]];}var _0x471f20=_['find'](_0x3935c4,_0x3986b1);if(_0x471f20){return _0x2c58c3(handleCheckRowError(_0xc559('0x26'),_0xc559('0x27'),_0x471f20,_0x3686ad));}}return db[_0xc559('0x28')]['create'](_0x453264,{'raw':!![],'hooks':![],'fields':_[_0xc559('0x29')](_0x453264)})[_0xc559('0x2a')](function(_0x383a38){if(DUPLICATES&&DUPLICATES[_0xc559('0x16')]&&_0x3935c4){_0x3935c4['push'](_[_0xc559('0x2b')](_0x453264,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x383a38['id'];return _0x4c5220();})['catch'](function(_0x16e30e){return _0x2c58c3(handleCheckRowError(_0xc559('0x13'),_0xc559('0x2c')+(_0x16e30e['message']||JSON[_0xc559('0x2d')](_0x16e30e)),null,_0x3686ad));});});}function checkHopper(){function _0x42c51c(){return function(_0x2155e1){logger[_0xc559('0x13')](_0xc559('0x2e'),_0xc559('0x2f'),util[_0xc559('0x30')](_0x2155e1,{'showHidden':![],'depth':null}));};}var _0x54f4f1=function(_0x20349b,_0xecef72){var _0x5c8d1b=squel['insert']()['into'](_0xc559('0x31'))[_0xc559('0x32')]([_0xc559('0x1d'),_0xc559('0x33'),'ContactId',_0xc559('0x24'),_0xecef72,'createdAt',_0xc559('0x34')],squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x1d'),_0xc559('0x1d'))[_0xc559('0x36')](_0xc559('0x37'),_0xc559('0x33'))[_0xc559('0x36')]('id',_0xc559('0x38'))[_0xc559('0x36')](LISTID[_0xc559('0x39')](),'ListId')[_0xc559('0x36')](_0x20349b['id'][_0xc559('0x39')](),_0xecef72)['field'](_0xc559('0x37'),_0xc559('0x3a'))['field'](_0xc559('0x37'),'updatedAt')[_0xc559('0x3b')](_0xc559('0x3c'))[_0xc559('0x3d')]('deletedAt\x20IS\x20NULL')[_0xc559('0x3d')](_0xc559('0x3e'),LISTID[_0xc559('0x39')]())['where'](_0xc559('0x3f'))[_0xc559('0x3d')](_0xc559('0x40'),squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x1d'))[_0xc559('0x3b')](_0xc559('0x31'))[_0xc559('0x3d')](_0xecef72+_0xc559('0x41'),_0x20349b['id'][_0xc559('0x39')]())))['toString']();return _0x5c8d1b;};var _0x3e0cd1=function(_0x289b70,_0x2b18c3){var _0x29e952=squel[_0xc559('0x42')]()[_0xc559('0x43')](_0xc559('0x31'))[_0xc559('0x32')]([_0xc559('0x1d'),'scheduledAt','ContactId',_0xc559('0x24'),_0x2b18c3,_0xc559('0x3a'),_0xc559('0x34')],squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x1d'),_0xc559('0x1d'))[_0xc559('0x36')](_0xc559('0x37'),_0xc559('0x33'))[_0xc559('0x36')]('id',_0xc559('0x38'))[_0xc559('0x36')](LISTID[_0xc559('0x39')](),_0xc559('0x24'))['field'](_0x289b70['id']['toString'](),_0x2b18c3)[_0xc559('0x36')](_0xc559('0x37'),'createdAt')['field'](_0xc559('0x37'),_0xc559('0x34'))[_0xc559('0x3b')](_0xc559('0x3c'))['where'](_0xc559('0x44'))[_0xc559('0x3d')](_0xc559('0x3e'),LISTID[_0xc559('0x39')]())[_0xc559('0x3d')](_0xc559('0x45'),squel[_0xc559('0x46')](hopperContacts))[_0xc559('0x3d')]('phone\x20IS\x20NOT\x20NULL')[_0xc559('0x3d')](_0xc559('0x40'),squel[_0xc559('0x35')]()[_0xc559('0x36')](_0xc559('0x47'))[_0xc559('0x3b')](_0xc559('0x48'))[_0xc559('0x3d')](_0x2b18c3+_0xc559('0x41'),_0x289b70['id'][_0xc559('0x39')]()))['where'](_0xc559('0x40'),squel[_0xc559('0x35')]()[_0xc559('0x36')]('phone')[_0xc559('0x3b')]('cm_hopper')['where'](_0x2b18c3+_0xc559('0x41'),_0x289b70['id'][_0xc559('0x39')]())))[_0xc559('0x39')]();return _0x29e952;};function _0x355043(_0x253bf7,_0x5b64a1){var _0x4b5c32=squel['insert']()[_0xc559('0x43')]('cm_hopper')[_0xc559('0x32')]([_0xc559('0x1d'),_0xc559('0x33'),_0xc559('0x38'),_0xc559('0x24'),_0x5b64a1,_0xc559('0x3a'),'updatedAt'],squel[_0xc559('0x35')]()['field'](_0xc559('0x1d'),'phone')[_0xc559('0x36')](_0xc559('0x37'),_0xc559('0x33'))[_0xc559('0x36')]('id',_0xc559('0x38'))['field'](LISTID[_0xc559('0x39')](),_0xc559('0x24'))[_0xc559('0x36')](_0x253bf7['id'][_0xc559('0x39')](),_0x5b64a1)['field'](_0xc559('0x37'),'createdAt')[_0xc559('0x36')](_0xc559('0x37'),'updatedAt')[_0xc559('0x3b')]('cm_contacts')[_0xc559('0x3d')](_0xc559('0x44'))[_0xc559('0x3d')](_0xc559('0x3e'),LISTID[_0xc559('0x39')]())[_0xc559('0x3d')](_0xc559('0x45'),squel[_0xc559('0x46')](hopperContacts))['where'](_0xc559('0x3f')))[_0xc559('0x39')]();return _0x4b5c32;}function _0x339de8(_0x441fc0,_0x3098c3){var _0x3d1d5a=squel[_0xc559('0x42')]()[_0xc559('0x43')](_0xc559('0x49'))['fromQuery']([_0xc559('0x1d'),_0xc559('0x38'),_0xc559('0x24'),_0x3098c3,_0xc559('0x3a'),_0xc559('0x34')],squel['select']()[_0xc559('0x36')](_0xc559('0x1d'),_0xc559('0x1d'))[_0xc559('0x36')]('id',_0xc559('0x38'))[_0xc559('0x36')](LISTID[_0xc559('0x39')](),_0xc559('0x24'))['field'](_0x441fc0['id'][_0xc559('0x39')](),_0x3098c3)[_0xc559('0x36')](_0xc559('0x37'),'createdAt')[_0xc559('0x36')]('NOW()',_0xc559('0x34'))[_0xc559('0x3b')](_0xc559('0x3c'))[_0xc559('0x3d')](_0xc559('0x44'))[_0xc559('0x3d')]('ListId\x20=\x20?',LISTID[_0xc559('0x39')]())[_0xc559('0x3d')]('id\x20IN\x20?',squel[_0xc559('0x46')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc559('0x39')]();return _0x3d1d5a;}return db[_0xc559('0x4a')]['findAll']({'where':{'type':'outbound'},'attributes':['id',_0xc559('0x4b')],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x4d'),'where':{'id':LISTID}}]})[_0xc559('0x2a')](function(_0x37fd53){var _0x26b065=[];if(_0x37fd53){var _0x881096;for(var _0x9efc0b=0x0,_0x134484;_0x9efc0b<_0x37fd53['length'];_0x9efc0b+=0x1){_0x134484=_0x37fd53[_0x9efc0b][_0xc559('0x4e')]({'plain':!![]});switch(_0x134484['dialCheckDuplicateType']){case'always':_0x26b065[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x3e0cd1(_0x134484,'VoiceQueueId'))[_0xc559('0x2a')](function(){})['catch'](_0x42c51c()));break;case'onlyIfOpen':_0x26b065['push'](db[_0xc559('0x50')][_0xc559('0x51')](_0x54f4f1(_0x134484,'VoiceQueueId'))[_0xc559('0x2a')](function(){})['catch'](_0x42c51c()));break;default:_0x26b065[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x355043(_0x134484,_0xc559('0x52')))[_0xc559('0x2a')](function(){})[_0xc559('0x53')](_0x42c51c()));}}}return _0x26b065;})[_0xc559('0x54')]()[_0xc559('0x2a')](function(){return db[_0xc559('0x4a')][_0xc559('0x55')]({'where':{'type':_0xc559('0x56')},'attributes':['id'],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x57'),'where':{'id':LISTID}}]})[_0xc559('0x2a')](function(_0x311bf5){var _0x11dac8=[];if(_0x311bf5){var _0x5c1b93;for(var _0x508bc2=0x0,_0x3c052b;_0x508bc2<_0x311bf5['length'];_0x508bc2+=0x1){_0x3c052b=_0x311bf5[_0x508bc2][_0xc559('0x4e')]({'plain':!![]});_0x11dac8[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x339de8(_0x3c052b,_0xc559('0x52')))['then'](function(){})[_0xc559('0x53')](_0x42c51c()));}}return _0x11dac8;})[_0xc559('0x54')]();})[_0xc559('0x2a')](function(){return db[_0xc559('0x58')][_0xc559('0x55')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x4d'),'where':{'id':LISTID}}]})[_0xc559('0x2a')](function(_0x3c54bb){var _0x27752c=[];if(_0x3c54bb){for(var _0x4dd253=0x0,_0x9b4019;_0x4dd253<_0x3c54bb[_0xc559('0x16')];_0x4dd253+=0x1){_0x9b4019=_0x3c54bb[_0x4dd253][_0xc559('0x4e')]({'plain':!![]});switch(_0x9b4019['dialCheckDuplicateType']){case _0xc559('0x59'):_0x27752c[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x3e0cd1(_0x9b4019,_0xc559('0x5a')))['then'](function(){})[_0xc559('0x53')](_0x42c51c()));break;case'onlyIfOpen':_0x27752c[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x54f4f1(_0x9b4019,_0xc559('0x5a')))[_0xc559('0x2a')](function(){})['catch'](_0x42c51c()));break;default:_0x27752c['push'](db[_0xc559('0x50')][_0xc559('0x51')](_0x355043(_0x9b4019,_0xc559('0x5a')))[_0xc559('0x2a')](function(){})[_0xc559('0x53')](_0x42c51c()));}}}return _0x27752c;})[_0xc559('0x54')]();})[_0xc559('0x2a')](function(){return db[_0xc559('0x58')][_0xc559('0x55')]({'attributes':['id'],'include':[{'model':db[_0xc559('0x4c')],'as':_0xc559('0x57'),'where':{'id':LISTID}}]})['then'](function(_0x381bee){var _0xff15a4=[];if(_0x381bee){for(var _0x404d33=0x0,_0xa4b53e;_0x404d33<_0x381bee[_0xc559('0x16')];_0x404d33+=0x1){_0xa4b53e=_0x381bee[_0x404d33][_0xc559('0x4e')]({'plain':!![]});_0xff15a4[_0xc559('0x4f')](db[_0xc559('0x50')][_0xc559('0x51')](_0x339de8(_0xa4b53e,_0xc559('0x5a')))[_0xc559('0x2a')](function(){})[_0xc559('0x53')](_0x42c51c()));}}return _0xff15a4;})[_0xc559('0x54')]();})['catch'](function(_0x1cb044){logger['error'](_0xc559('0x5b'),_0xc559('0x5c'),_0x1cb044[_0xc559('0x17')]);});}var processPromises=function(_0x45ad65){return BPromise[_0xc559('0x54')](promises)[_0xc559('0x2a')](function(_0x2b4c8a){})[_0xc559('0x53')](function(_0x121316){logger[_0xc559('0x13')](_0xc559('0x5d'),JSON[_0xc559('0x2d')](_0x121316));})[_0xc559('0x5e')](function(){socket[_0xc559('0x5f')](_0xc559('0x60')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x45ad65){return _0x45ad65[_0xc559('0x61')]();}});};var endCsv=function(){return BPromise[_0xc559('0x62')]()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xc559('0x2a')](function(){socket[_0xc559('0x5f')](_0xc559('0x60')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc559('0x63')](FILEPATH);}catch(_0x56b4e3){logger[_0xc559('0x13')](_0xc559('0x64'),JSON['stringify'](_0x56b4e3));}finally{process['exit'](0x0);}});};process['on'](_0xc559('0x65'),function(){logger[_0xc559('0x66')](_0xc559('0x67'));endCsv();});function main(){return BPromise[_0xc559('0x62')]()[_0xc559('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc559('0x11')](',');return db[_0xc559('0x28')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x1063b6){var _0xcd3538=fs['createReadStream'](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc559('0x68')](_0xcd3538,{'header':!![],'skipEmptyLines':!![],'step':function(_0x9fd497,_0x4289ba){total+=0x1;var _0x1bbc59=total;promises[_0xc559('0x4f')](checkRow(_0x9fd497,_0x1063b6,_0x1bbc59)[_0xc559('0x2a')](function(){success+=0x1;})[_0xc559('0x53')](function(_0x4167eb){if(_0x4167eb[_0xc559('0x13')]){errors+=0x1;delete _0x4167eb[_0xc559('0x13')];}else if(_0x4167eb[_0xc559('0x26')]){duplicates+=0x1;delete _0x4167eb[_0xc559('0x26')];}rows['push'](_0x4167eb);}));if(total%0xc8===0x0){_0x4289ba[_0xc559('0x69')]();return processPromises(_0x4289ba);}},'complete':function(){return processPromises()[_0xc559('0x2a')](function(){logger[_0xc559('0x66')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x35c6f8,_0x393dad){logger[_0xc559('0x66')](_0xc559('0x6a'),JSON['stringify'](_0x35c6f8));endCsv();}});})[_0xc559('0x53')](function(_0x3e86f7){logger['error'](_0xc559('0x6b'),JSON[_0xc559('0x2d')](_0x3e86f7));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 825892b..7bc9315 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 _0xee45=['ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','UserId','cm_hopper.id','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','keys','CompanyId','scheduledAt','deletedAt\x20IS\x20NULL','min_id','info','Received\x20SIGINT','error','message','errors','code','sequelize','query','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','spread','voice_queues.id','voice_queues.dialTimezone','timezones','utcOffset','set','offset','dialTimezone','stringify','start','binding','socket_timestamp','server/files/tmp','.csv','includes','header','ContactItemType','_description','writeFileSync','parse','createReadStream','rows','data','find','name','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','each','contactId','orderBy','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','voice_queues_has_cm_lists','finish','affectedRows','exit','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','redis','defaults','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','from','join','.id\x20=\x20','where','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','CmContactHasItem','update','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','ContactId','ListId','createdAt','updatedAt','recallme','fields','cm_contacts','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.createdAt','cm_contacts.ListId\x20=\x20','cm_hopper_black'];(function(_0x4f34c9,_0x33bdb1){var _0x4e27f0=function(_0x1a4df2){while(--_0x1a4df2){_0x4f34c9['push'](_0x4f34c9['shift']());}};_0x4e27f0(++_0x33bdb1);}(_0xee45,0x126));var _0x5ee4=function(_0x487ace,_0x1966df){_0x487ace=_0x487ace-0x0;var _0xe3725a=_0xee45[_0x487ace];return _0xe3725a;};'use strict';var fs=require('fs');var path=require(_0x5ee4('0x0'));var _=require(_0x5ee4('0x1'));var Papa=require(_0x5ee4('0x2'));var util=require(_0x5ee4('0x3'));var BPromise=require(_0x5ee4('0x4'));var moment=require(_0x5ee4('0x5'));var squel=require(_0x5ee4('0x6'));var Redis=require(_0x5ee4('0x7'));var db=require(_0x5ee4('0x8'))['db'];var config=require(_0x5ee4('0x9'));var shared=require(_0x5ee4('0xa'));var logger=require('../../../config/logger')('import');config[_0x5ee4('0xb')]=_[_0x5ee4('0xc')](config[_0x5ee4('0xb')],{'host':_0x5ee4('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5ee4('0xe')](_0x5ee4('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5ee4('0xe')](_0x5ee4('0xf'));function isEmail(_0x3455f5){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))*$/[_0x5ee4('0x10')](_0x3455f5);}function selectNotIn(_0x1e4718,_0x1f79e2,_0x589e43,_0x486dcc,_0x344438){return squel[_0x5ee4('0x11')]()[_0x5ee4('0x12')]('phone')[_0x5ee4('0x13')](_0x486dcc)[_0x5ee4('0x14')](_0x1f79e2,null,_0x1f79e2+_0x5ee4('0x15')+_0x486dcc+'.'+_0x589e43)[_0x5ee4('0x16')](_0x486dcc+'.'+_0x589e43+'\x20=\x20'+_0x1e4718+'.'+_0x589e43)[_0x5ee4('0x16')](_0x1f79e2+'.dialCheckDuplicateType\x20IN\x20('+_0x344438['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4e1776,_0xbaaa86){promisesAdditionalPhones=[];return db[_0x5ee4('0x17')][_0x5ee4('0x18')]({'raw':!![],'attributes':['id',_0x5ee4('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5ee4('0x1a')](function(_0x581577){if(_0x581577!==null){var _0x11fd9f=[];for(var _0x3a851c=0x0;_0x3a851c<_0x581577['length'];_0x3a851c++){var _0x584e54=_0x581577[_0x3a851c];_0x11fd9f[_0x5ee4('0x1b')](insertAdditionalPhones(_0x584e54));}}Promise[_0x5ee4('0x1c')](_0x11fd9f)['then'](function(){_0x4e1776({'val':0x1});});});});}function insertAdditionalPhones(_0x295bc1){return new Promise(function(_0x45dc63,_0x3a1c7a){var _0x521214=_0x295bc1[_0x5ee4('0x19')];var _0x3ae6f5=_0x521214[_0x5ee4('0x1d')](';');var _0x2c02bc=[];orderBy=0x0;for(var _0x365018=0x0;_0x365018<_0x3ae6f5[_0x5ee4('0x1e')];_0x365018++){_0x2c02bc[_0x5ee4('0x1b')](splitAdditionalPhone(_0x295bc1['id'],_0x3ae6f5[_0x365018]));}Promise['all'](_0x2c02bc)[_0x5ee4('0x1a')](function(){_0x45dc63({'val':_0x3ae6f5[_0x5ee4('0x1e')]});});});}function splitAdditionalPhone(_0x1b926c,_0x3832dd){return new Promise(function(_0x1f90c6,_0x296a6f){var _0x57718d=_0x3832dd[_0x5ee4('0x1d')](':');var _0x5a597e=_0x57718d[0x0];var _0x30e70e=_0x57718d[0x1];if(!_[_0x5ee4('0x1f')](_0x30e70e)){var _0x1eb5b7=_0x30e70e[_0x5ee4('0x1d')]('|');var _0x3ca56b=[];for(var _0x104217=0x0;_0x104217<_0x1eb5b7['length'];_0x104217++){if(_0x1eb5b7[_0x104217]!==''){var _0x4d1464=_['filter'](promisesAdditionalPhones,{'contactId':_0x1b926c,'phone':_0x1eb5b7[_0x104217]});if(_0x4d1464[_0x5ee4('0x1e')]==0x0){orderBy++;promisesAdditionalPhones[_0x5ee4('0x1b')]({'contactId':_0x1b926c,'contactTypeId':_0x5a597e,'phone':_0x1eb5b7[_0x104217],'orderBy':orderBy});}}}_0x1f90c6({'ok':0x1});}else _0x1f90c6({'res':0x0});});}function createAdditionalPhone(_0x403f6d,_0x491885,_0x491311,_0x4d9218){var _0x40b02b='';var _0x62b002='';var _0x45d02c=_0x491311[_0x5ee4('0x1d')]('§');_0x40b02b=_0x45d02c[0x0];if(_0x45d02c['length']==0x2)_0x62b002=_0x45d02c[0x1];return new Promise(function(_0x3cc764,_0x2b62fa){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x403f6d,'item':_0x40b02b}})[_0x5ee4('0x1a')](function(_0x295b89){if(_0x295b89){return db[_0x5ee4('0x20')][_0x5ee4('0x21')]({'ItemTypeId':_0x491885,'description':_0x62b002,'OrderBy':_0x4d9218},{'where':{'CmContactId':_0x403f6d,'item':_0x40b02b}})[_0x5ee4('0x1a')](function(_0x459f4a){_0x3cc764({'res':_0x5ee4('0x22')});});}else{return db[_0x5ee4('0x20')][_0x5ee4('0x23')]({'CmContactId':_0x403f6d,'item':_0x40b02b,'description':_0x62b002,'ItemTypeId':_0x491885,'OrderBy':_0x4d9218,'ItemClass':_0x5ee4('0x24')})[_0x5ee4('0x1a')](function(_0x4cc8c7){_0x3cc764({'res':'inserted'});});}});});}function insertCmHopper(_0x38d55c,_0x2f8fca,_0x4a8758,_0x5728e4,_0x67f58c){var _0x381bac=[_0x5ee4('0x25'),_0x5ee4('0x26'),_0x5ee4('0x27'),_0x5ee4('0x28'),_0x2f8fca+'.'+_0x5728e4,'cm_contacts.createdAt',_0x5ee4('0x29'),_0x5ee4('0x2a'),_0x5ee4('0x2b'),'\x22'+_0x67f58c+'\x22'];return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')]('cm_hopper')[_0x5ee4('0x2e')]([_0x5ee4('0x2f'),'scheduledat',_0x5ee4('0x30'),_0x5ee4('0x31'),_0x5728e4,_0x5ee4('0x32'),_0x5ee4('0x33'),'priority','UserId',_0x5ee4('0x34')],squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x381bac)[_0x5ee4('0x13')](_0x2f8fca)[_0x5ee4('0x14')](_0x5ee4('0x36'),null,'cm_contacts.ListId\x20=\x20'+_0x2f8fca+_0x5ee4('0x37'))[_0x5ee4('0x14')](_0x4a8758,null,_0x4a8758+_0x5ee4('0x15')+_0x2f8fca+'.'+_0x5728e4)[_0x5ee4('0x16')](_0x2f8fca+_0x5ee4('0x38'),_0x38d55c)[_0x5ee4('0x16')](_0x5ee4('0x39'),NOW)[_0x5ee4('0x16')](_0x5ee4('0x3a'),selectNotIn(_0x2f8fca,_0x4a8758,_0x5728e4,_0x5ee4('0x3b'),['\x22always\x22',_0x5ee4('0x3c')]))['where'](_0x5ee4('0x3a'),selectNotIn(_0x2f8fca,_0x4a8758,_0x5728e4,_0x5ee4('0x3b'),[_0x5ee4('0x3d')])))[_0x5ee4('0x3e')]();}function insertCmHopperBlack(_0x3ab828,_0x2bf29f,_0x80773f,_0x5456ce){var _0x882a55=[_0x5ee4('0x25'),_0x5ee4('0x27'),_0x5ee4('0x28'),_0x2bf29f+'.'+_0x5456ce,_0x5ee4('0x3f'),_0x5ee4('0x29')];return squel['insert']()[_0x5ee4('0x2d')]('cm_hopper_black')['fromQuery']([_0x5ee4('0x2f'),_0x5ee4('0x30'),'ListId',_0x5456ce,_0x5ee4('0x32'),'updatedAt'],squel['select']()['fields'](_0x882a55)[_0x5ee4('0x13')](_0x2bf29f)[_0x5ee4('0x14')](_0x5ee4('0x36'),null,_0x5ee4('0x40')+_0x2bf29f+_0x5ee4('0x37'))[_0x5ee4('0x14')](_0x80773f,null,_0x80773f+'.id\x20=\x20'+_0x2bf29f+'.'+_0x5456ce)[_0x5ee4('0x16')](_0x2bf29f+_0x5ee4('0x38'),_0x3ab828)[_0x5ee4('0x16')](_0x5ee4('0x39'),NOW)['where'](_0x5ee4('0x3a'),squel['select']()[_0x5ee4('0x12')]('phone')['from'](_0x5ee4('0x41'))['where'](_0x5ee4('0x42'),_0x3ab828)[_0x5ee4('0x16')](_0x5456ce+'\x20=\x20'+_0x2bf29f+'.'+_0x5456ce)))[_0x5ee4('0x3e')]();}function insertTzCmHopper(_0x2571dd,_0x3f2d9c,_0x56a9c2,_0x238131,_0x53c52f,_0x451ccf){var _0x152efb=[_0x5ee4('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x451ccf+_0x5ee4('0x43'),_0x5ee4('0x27'),'cm_contacts.ListId',_0x3f2d9c+'.'+_0x238131,_0x5ee4('0x3f'),_0x5ee4('0x29'),'cm_contacts.priority',_0x5ee4('0x2b'),'\x22'+_0x53c52f+'\x22'];var _0x528cee=squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')]('cm_hopper')[_0x5ee4('0x2e')]([_0x5ee4('0x2f'),_0x5ee4('0x44'),'ContactId',_0x5ee4('0x31'),_0x238131,_0x5ee4('0x32'),_0x5ee4('0x33'),'priority',_0x5ee4('0x45'),_0x5ee4('0x34')],squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x152efb)[_0x5ee4('0x13')](_0x3f2d9c)[_0x5ee4('0x14')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x3f2d9c+'.CmListId')[_0x5ee4('0x14')](_0x56a9c2,null,_0x56a9c2+'.id\x20=\x20'+_0x3f2d9c+'.'+_0x238131)['join'](_0x451ccf,null,_0x451ccf+_0x5ee4('0x15')+_0x3f2d9c+'.'+_0x238131)['where'](_0x3f2d9c+'.CmListId\x20=\x20?',_0x2571dd)['where'](_0x5ee4('0x39'),NOW)[_0x5ee4('0x16')](_0x5ee4('0x3a'),selectNotIn(_0x3f2d9c,_0x56a9c2,_0x238131,_0x5ee4('0x3b'),['\x22always\x22',_0x5ee4('0x3c')]))['where'](_0x5ee4('0x3a'),selectNotIn(_0x3f2d9c,_0x56a9c2,_0x238131,_0x5ee4('0x3b'),[_0x5ee4('0x3d')])))[_0x5ee4('0x3e')]();return _0x528cee;}function insertTzCmHopperBlack(_0x22b8d9,_0x585c75,_0x209c4f,_0x475094){var _0x11050c=[_0x5ee4('0x25'),_0x5ee4('0x27'),_0x5ee4('0x28'),_0x585c75+'.'+_0x475094,_0x5ee4('0x3f'),_0x5ee4('0x29')];return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')](_0x5ee4('0x41'))[_0x5ee4('0x2e')]([_0x5ee4('0x2f'),_0x5ee4('0x30'),_0x5ee4('0x31'),_0x475094,'createdAt',_0x5ee4('0x33')],squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x11050c)['from'](_0x585c75)[_0x5ee4('0x14')](_0x5ee4('0x36'),null,_0x5ee4('0x40')+_0x585c75+_0x5ee4('0x37'))[_0x5ee4('0x14')](_0x209c4f,null,_0x209c4f+_0x5ee4('0x15')+_0x585c75+'.'+_0x475094)[_0x5ee4('0x16')](_0x585c75+_0x5ee4('0x38'),_0x22b8d9)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x5ee4('0x16')](_0x5ee4('0x3a'),squel[_0x5ee4('0x11')]()[_0x5ee4('0x12')](_0x5ee4('0x2f'))[_0x5ee4('0x13')](_0x5ee4('0x41'))['where']('ListId\x20=\x20?',_0x22b8d9)['where'](_0x475094+'\x20=\x20'+_0x585c75+'.'+_0x475094)))[_0x5ee4('0x3e')]();}function insertCmHopperAdditionalPhones(_0x981520){var _0x306b68=[_0x5ee4('0x46'),'cm_contact_has_items.item',_0x5ee4('0x47'),_0x5ee4('0x48'),_0x5ee4('0x49')];return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')](_0x5ee4('0x4a'))[_0x5ee4('0x2e')]([_0x5ee4('0x4b'),_0x5ee4('0x2f'),'OrderBy',_0x5ee4('0x32'),_0x5ee4('0x33')],squel['select']()[_0x5ee4('0x35')](_0x306b68)[_0x5ee4('0x13')](_0x5ee4('0x3b'))[_0x5ee4('0x14')]('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x5ee4('0x14')](_0x5ee4('0x4c'),null,_0x5ee4('0x4d'))['where']('cm_hopper.ListId\x20=\x20?',_0x981520)[_0x5ee4('0x16')]('cm_contacts.createdAt\x20=\x20?',NOW))['toString']();}function insertCmContact(_0xa30236,_0x4b7ad6,_0x501718,_0xaee4c3){var _0x42fc2e=_['concat'](_[_0x5ee4('0x4e')](_0xaee4c3),[_0x5ee4('0x31'),_0x5ee4('0x4f'),_0x5ee4('0x32'),_0x5ee4('0x33'),_0x5ee4('0x50')]);return squel[_0x5ee4('0x2c')]()[_0x5ee4('0x2d')](_0x5ee4('0x36'))[_0x5ee4('0x2e')](_0x42fc2e,squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')](_0x42fc2e)[_0x5ee4('0x13')](_0x4b7ad6)[_0x5ee4('0x16')]('('+_0x501718['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x5ee4('0x11')]()['fields'](_0x501718)[_0x5ee4('0x13')](_0x5ee4('0x36'))['where']('ListId\x20=\x20?',_0xa30236)[_0x5ee4('0x16')](_0x5ee4('0x51')))[_0x5ee4('0x16')]('id\x20IN\x20?',squel[_0x5ee4('0x11')]()[_0x5ee4('0x12')]('MIN(id)',_0x5ee4('0x52'))[_0x5ee4('0x13')](_0x4b7ad6)['group'](_0x501718[_0x5ee4('0x14')](','))))[_0x5ee4('0x3e')]();}function handleStop(){logger[_0x5ee4('0x53')](_0x5ee4('0x54'));stopped=!![];}function handleUncaughtException(_0x5e413c){logger[_0x5ee4('0x55')](_0x5e413c[_0x5ee4('0x56')]);process['exit'](0x1);}function handleError(_0x18fc35,_0x5df6af){stats[_0x5ee4('0x57')]['push']({'name':_0x5df6af[_0x5ee4('0x58')],'message':_0x5df6af['message'],'row':_0x18fc35});}function handleQuery(_0x17a1b5){logger[_0x5ee4('0x53')](_0x17a1b5);return db[_0x5ee4('0x59')][_0x5ee4('0x5a')](_0x17a1b5)['spread'](function(_0xe8924){results[_0x5ee4('0x1b')](_0xe8924);})[_0x5ee4('0x5b')](function(_0x5e8914){logger[_0x5ee4('0x55')](_0x5e8914['message']);});}function updateTzCampaigns(_0x1294ed){return new Promise(function(_0x1ea77f,_0x424fa9){var _0x2efbc8=squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')]([_0x5ee4('0x5c'),_0x5ee4('0x5d')])[_0x5ee4('0x13')](_0x5ee4('0x5e'))['join'](_0x5ee4('0x5f'),null,_0x5ee4('0x60'))[_0x5ee4('0x16')]('campaigns_has_cm_lists.CmListId='+_0x1294ed);db['sequelize']['query'](_0x2efbc8[_0x5ee4('0x3e')]())[_0x5ee4('0x61')](function(_0x2c451b){var _0x3bdb56=[];for(var _0x5dfde3=0x0;_0x5dfde3<_0x2c451b[_0x5ee4('0x1e')];_0x5dfde3++){_0x3bdb56[_0x5ee4('0x1b')](getTimezoneData(_0x2c451b[_0x5dfde3],tmp_campaigns));}BPromise[_0x5ee4('0x1c')](_0x3bdb56)['then'](function(){_0x1ea77f({'val':0x1});});})[_0x5ee4('0x5b')](function(_0x5ab1d6){logger['error'](_0x5ab1d6['message']);_0x1ea77f({'val':0x0});});});}function updateTzVoiceQueues(_0x5e7891){return new Promise(function(_0x34018b,_0x5abeb2){var _0x8d9b92=squel[_0x5ee4('0x11')]()[_0x5ee4('0x35')]([_0x5ee4('0x62'),_0x5ee4('0x63')])[_0x5ee4('0x13')]('voice_queues')['join']('voice_queues_has_cm_lists',null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x5ee4('0x16')]('voice_queues_has_cm_lists.CmListId='+_0x5e7891);db[_0x5ee4('0x59')][_0x5ee4('0x5a')](_0x8d9b92[_0x5ee4('0x3e')]())[_0x5ee4('0x61')](function(_0x1e6a9d){var _0x581787=[];for(var _0xe19f52=0x0;_0xe19f52<_0x1e6a9d[_0x5ee4('0x1e')];_0xe19f52++){_0x581787['push'](getTimezoneData(_0x1e6a9d[_0xe19f52],tmp_voice_queues));}BPromise[_0x5ee4('0x1c')](_0x581787)['then'](function(){_0x34018b({'val':0x1});});})[_0x5ee4('0x5b')](function(_0x27b164){logger[_0x5ee4('0x55')](_0x27b164[_0x5ee4('0x56')]);_0x34018b({'val':0x0});});});}function getTimezoneData(_0x37ecfc,_0x1739e0){return new Promise(function(_0x3f6e8f,_0x1bc7ca){var _0x13ab5c=shared[_0x5ee4('0x64')];var _0x91a619=_0x13ab5c[_0x37ecfc['dialTimezone']];if(_[_0x5ee4('0x1f')](_0x91a619)){_0x3f6e8f({'ret':0x1});}else{var _0x2c568e=_0x91a619[_0x5ee4('0x65')];var _0x5c5944=squel[_0x5ee4('0x2c')]()['into'](_0x1739e0)[_0x5ee4('0x66')]('id',_0x37ecfc['id'])['set'](_0x5ee4('0x67'),_0x2c568e)[_0x5ee4('0x66')](_0x5ee4('0x68'),_0x37ecfc[_0x5ee4('0x68')])[_0x5ee4('0x3e')]();return db[_0x5ee4('0x59')][_0x5ee4('0x5a')](_0x5c5944)['spread'](function(_0x14a7dd){_0x3f6e8f({'ret':0x1});})[_0x5ee4('0x5b')](function(_0x2994c4){logger[_0x5ee4('0x55')](_0x2994c4[_0x5ee4('0x56')]);_0x1bc7ca({'ret':0x1});});}});}function handleTZQuery(_0x4715e2){logger[_0x5ee4('0x53')](_0x4715e2);return db[_0x5ee4('0x59')]['query'](_0x4715e2)[_0x5ee4('0x61')](function(_0x28d945){})['catch'](function(_0x1ce312){logger[_0x5ee4('0x55')](_0x1ce312[_0x5ee4('0x56')]);});}function main(_0x178653,_0xb07cef,_0x15536d,_0x2bd583){logger['info']('main',_0x178653,JSON[_0x5ee4('0x69')](_0xb07cef));process['send'](_0x5ee4('0x6a'));var _0x3875b4=_0xb07cef[_0x5ee4('0x6b')];var _0x6552b4=_['clone'](_0x3875b4);var _0x3ac3b3=_0xb07cef[_0x5ee4('0x6c')];var _0x37194a=path['join'](config['root'],_0x5ee4('0x6d'),_0x3ac3b3+_0x5ee4('0x6e'));hasTZ=_['keys'](_0x3875b4)[_0x5ee4('0x6f')](_0x5ee4('0x68'));var _0x54e4ee=_[_0x5ee4('0x4e')](_0x3875b4)['join']();logger['info'](_0x5ee4('0x70'),_0x54e4ee);db[_0x5ee4('0x71')]['findAll']({'raw':!![],'attributes':['id','name']})[_0x5ee4('0x1a')](function(_0xb5bc67){for(var _0x27e618=0x0;_0x27e618<_0xb5bc67['length'];_0x27e618++){if(_0xb5bc67[_0x27e618]['name']in _0x3875b4){contactItemTypes[_0x5ee4('0x1b')](_0xb5bc67[_0x27e618]);delete _0x6552b4[_0xb5bc67[_0x27e618]['name']];hasAdditionalPhones=!![];}for(var _0x4f33ed in _0x3875b4){if(_0xb5bc67[_0x27e618]['name']+_0x5ee4('0x72')===_0x4f33ed){phoneDescriptions['push']({'itemTypeId':_0xb5bc67[_0x27e618]['id'],'description':_0x4f33ed});delete _0x6552b4[_0x4f33ed];}}}if(hasAdditionalPhones)_0x6552b4[_0x5ee4('0x19')]='';var _0x5c1bdb=_[_0x5ee4('0x4e')](_0x6552b4)[_0x5ee4('0x14')]();logger[_0x5ee4('0x53')](_0x5ee4('0x70'),_0x5c1bdb);fs[_0x5ee4('0x73')](_0x37194a,_0x5c1bdb+'\x0a');Papa[_0x5ee4('0x74')](fs[_0x5ee4('0x75')](_0x178653),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5d654a,_0x51ff20){try{for(var _0x300375=0x0,_0x5c5696=[];_0x300375<_0x5d654a['data'][_0x5ee4('0x1e')];_0x300375++){stats[_0x5ee4('0x76')]+=0x1;if(_0x5d654a[_0x5ee4('0x57')][_0x300375]){handleError(_0x5d654a[_0x5ee4('0x77')][_0x300375],_0x5d654a[_0x5ee4('0x57')][_0x300375]);}else{var _0x3f7f23=[];var _0x190ff8=[];var _0x1be7f9={};for(var _0x384edc in _0x3875b4){let _0x1e0d13=contactItemTypes[_0x5ee4('0x78')](_0x48c8ba=>_0x48c8ba[_0x5ee4('0x79')]===_0x384edc);let _0x58416b=contactItemTypes[_0x5ee4('0x78')](_0x3d85ec=>_0x3d85ec['name']+_0x5ee4('0x72')===_0x384edc);if(_['isNil'](_0x1e0d13)&&_[_0x5ee4('0x1f')](_0x58416b)){if(_0x3875b4[_0x5ee4('0x7a')](_0x384edc)){if(_0x5d654a['data'][_0x300375][_0x3875b4[_0x384edc]]){var _0x3ec9eb=_[_0x5ee4('0x7b')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x384edc]][_0x5ee4('0x7c')](/"/g,'\x27'));switch(_0x384edc){case _0x5ee4('0x44'):var _0x30ad4b=moment(_0x3ec9eb,_0x5ee4('0xf'),!![]);if(_0x30ad4b[_0x5ee4('0x7d')]()){_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');}else{_0x3f7f23[_0x5ee4('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x31cb66=parseInt(_0x3ec9eb);_0x3ec9eb=_[_0x5ee4('0x7e')](_0x31cb66)||_0x31cb66<0x0||_0x31cb66>0x4?_0x2bd583?0x3:0x2:_0x31cb66;_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');break;case'UserId':var _0x2c790f=parseInt(_0x3ec9eb);if(_[_0x5ee4('0x7f')](_0x2c790f)&&_['includes'](_0x15536d,_0x2c790f)){_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x2c790f+'\x22');}else{_0x3f7f23[_0x5ee4('0x1b')]('agent\x20not\x20exists');}break;case _0x5ee4('0x80'):if(isEmail(_0x3ec9eb)){_0x5c5696['push']('\x22'+_0x3ec9eb+'\x22');}else{_0x3f7f23['push'](_0x5ee4('0x81'));}break;case'dateOfBirth':var _0xdb68c=moment(_0x3ec9eb,_0x5ee4('0x82'),!![]);if(_0xdb68c[_0x5ee4('0x7d')]()){_0x5c5696['push']('\x22'+_0x3ec9eb+'\x22');}else{_0x3f7f23['push'](_0x5ee4('0x83'));}break;case _0x5ee4('0x68'):var _0x2a4d94=shared[_0x5ee4('0x64')];var _0x1e20f2=_0x2a4d94[_0x3ec9eb];if(!_[_0x5ee4('0x1f')](_0x1e20f2)){var _0x3d1f12=_0x1e20f2[_0x5ee4('0x65')];_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3d1f12+'\x22');}break;default:_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x3ec9eb+'\x22');}}else{switch(_0x384edc){case _0x5ee4('0x84'):case _0x5ee4('0x2f'):_0x3f7f23[_0x5ee4('0x1b')](_0x384edc+_0x5ee4('0x85'));break;default:_0x5c5696[_0x5ee4('0x1b')]('\x22\x22');}}}}else{var _0x37db36='';if(!_[_0x5ee4('0x1f')](_0x1e0d13)){if(!_0x1be7f9['hasOwnProperty'](_0x1e0d13['id'])){if(!_[_0x5ee4('0x1f')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x384edc]])){var _0x3ec9eb=_[_0x5ee4('0x7b')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x384edc]]['replace'](/"/g,'\x27'));var _0x220e6d=phoneDescriptions[_0x5ee4('0x78')](_0x14b5dd=>_0x14b5dd[_0x5ee4('0x86')]===_0x1e0d13['id']);if(!_[_0x5ee4('0x1f')](_0x220e6d)){var _0xa3537d=_[_0x5ee4('0x7b')](_0x5d654a[_0x5ee4('0x77')][_0x300375][_0x3875b4[_0x220e6d[_0x5ee4('0x87')]]][_0x5ee4('0x7c')](/"/g,'\x27'));if(!_[_0x5ee4('0x1f')](_0xa3537d))_0x3ec9eb=_0x3ec9eb+'§'+_0xa3537d;}if(_0x37db36=='')_0x37db36=_0x3ec9eb;else _0x37db36+='|'+_0x3ec9eb;}_0x190ff8[_0x5ee4('0x1b')](_0x1e0d13['id']+':'+_0x37db36);_0x1be7f9[_0x1e0d13['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5c5696[_0x5ee4('0x1b')]('\x22'+_0x190ff8[_0x5ee4('0x14')](';')+'\x22');}if(_0x3f7f23['length']){handleError(_0x5d654a[_0x5ee4('0x77')][_0x300375],{'code':_0x5ee4('0x88'),'message':_0x3f7f23[_0x5ee4('0x14')]()});}else{fs[_0x5ee4('0x89')](_0x37194a,_0x5c5696['join']()+'\x0a');}_0x5c5696=[];}if(!(stats[_0x5ee4('0x76')]%0xc8)){socket[_0x5ee4('0x8a')](_0x5ee4('0x8b')+_0x3ac3b3,stats);stats['errors']=[];}}if(stopped){logger[_0x5ee4('0x53')](_0x5ee4('0x8c'));_0x51ff20[_0x5ee4('0x8d')]();}}catch(_0x167833){handleError(_0x5d654a[_0x5ee4('0x77')][_0x300375],{'code':_0x5ee4('0x8e'),'message':_0x167833[_0x5ee4('0x56')]});logger[_0x5ee4('0x55')](_0x5ee4('0x8f'),_0x167833[_0x5ee4('0x56')]);}},'complete':function(){try{var _0x1ec7f2=[];var _0x3a7de7=[];var _0x52aadd=_0x5ee4('0x36');if(_0xb07cef['duplicates']&&_0xb07cef['duplicates']['length']){_0x52aadd=_0x5ee4('0x90')+_0x3ac3b3;_0x1ec7f2[_0x5ee4('0x1b')]('CREATE\x20TABLE\x20'+_0x52aadd+_0x5ee4('0x91'));}tmp_campaigns=_0x5ee4('0x92')+_0x3ac3b3;tmp_voice_queues=_0x5ee4('0x93')+_0x3ac3b3;_0x3a7de7[_0x5ee4('0x1b')](_0x5ee4('0x94')+tmp_campaigns+_0x5ee4('0x95'));_0x3a7de7[_0x5ee4('0x1b')](_0x5ee4('0x94')+tmp_voice_queues+_0x5ee4('0x95'));BPromise['each'](_0x3a7de7,handleTZQuery)[_0x5ee4('0x1a')](function(_0x17537d){updateTzCampaigns(_0xb07cef['ListId'])[_0x5ee4('0x1a')](function(_0x4e673e){updateTzVoiceQueues(_0xb07cef[_0x5ee4('0x31')])[_0x5ee4('0x1a')](function(_0x1b6a9b){if(hasTZ)_0x5c1bdb=_0x5c1bdb['replace']('dialTimezone',_0x5ee4('0x96'));var _0x477589=util[_0x5ee4('0xe')](_0x5ee4('0x97'),_0x37194a,_0x52aadd,_0x5c1bdb,_0xb07cef[_0x5ee4('0x31')],_0xb07cef[_0x5ee4('0x4f')]||null,NOW,NOW);if(_[_0x5ee4('0x1f')](_0x3875b4['scheduledat'])){_0x477589+=_0x5ee4('0x98');}_0x1ec7f2['push'](_0x477589);if(_0xb07cef[_0x5ee4('0x99')]&&_0xb07cef[_0x5ee4('0x99')][_0x5ee4('0x1e')]){_0x1ec7f2[_0x5ee4('0x1b')](insertCmContact(_0xb07cef['ListId'],_0x52aadd,_0xb07cef['duplicates'],_0x3875b4));_0x1ec7f2[_0x5ee4('0x1b')](_0x5ee4('0x9a')+_0x52aadd+';');}BPromise[_0x5ee4('0x9b')](_0x1ec7f2,handleQuery)[_0x5ee4('0x1a')](function(_0x30449c){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0x1ec7f2=[];for(var _0x5867d8=0x0;_0x5867d8\x20\x20','argv','file\x20doesn\x27t\x20exists','binding','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','localhost','socket.io-emitter','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','field','phone','from','\x20=\x20','join','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','CmContactHasItem','update','updated','inserted','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','cm_hopper','fromQuery','scheduledat','ContactId','ListId'];(function(_0x1343dc,_0x3ff82c){var _0x48a00c=function(_0x1c1325){while(--_0x1c1325){_0x1343dc['push'](_0x1343dc['shift']());}};_0x48a00c(++_0x3ff82c);}(_0x3886,0x13e));var _0x6388=function(_0x4869d4,_0x175984){_0x4869d4=_0x4869d4-0x0;var _0x2b6d92=_0x3886[_0x4869d4];return _0x2b6d92;};'use strict';var fs=require('fs');var path=require(_0x6388('0x0'));var _=require(_0x6388('0x1'));var Papa=require(_0x6388('0x2'));var util=require(_0x6388('0x3'));var BPromise=require('bluebird');var moment=require(_0x6388('0x4'));var squel=require(_0x6388('0x5'));var Redis=require(_0x6388('0x6'));var db=require(_0x6388('0x7'))['db'];var config=require(_0x6388('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x6388('0x9'))(_0x6388('0xa'));config['redis']=_[_0x6388('0xb')](config['redis'],{'host':_0x6388('0xc'),'port':0x18eb});var socket=require(_0x6388('0xd'))(new Redis(config[_0x6388('0xe')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x6388('0xf')](_0x6388('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x6388('0xf')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x1c120d){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))*$/[_0x6388('0x11')](_0x1c120d);}function selectNotIn(_0x7b32a6,_0x4b7f76,_0x551ac2,_0xe71346,_0x3ca0cd){return squel['select']()[_0x6388('0x12')](_0x6388('0x13'))[_0x6388('0x14')](_0xe71346)['join'](_0x4b7f76,null,_0x4b7f76+'.id\x20=\x20'+_0xe71346+'.'+_0x551ac2)['where'](_0xe71346+'.'+_0x551ac2+_0x6388('0x15')+_0x7b32a6+'.'+_0x551ac2)['where'](_0x4b7f76+'.dialCheckDuplicateType\x20IN\x20('+_0x3ca0cd[_0x6388('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x57a57f,_0x148d73){promisesAdditionalPhones=[];return db[_0x6388('0x17')][_0x6388('0x18')]({'raw':!![],'attributes':['id',_0x6388('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x6388('0x1a')](function(_0xdfcb90){if(_0xdfcb90!==null){var _0x29bc09=[];for(var _0x3894e6=0x0;_0x3894e6<_0xdfcb90['length'];_0x3894e6++){var _0x5981f6=_0xdfcb90[_0x3894e6];_0x29bc09[_0x6388('0x1b')](insertAdditionalPhones(_0x5981f6));}}Promise[_0x6388('0x1c')](_0x29bc09)[_0x6388('0x1a')](function(){_0x57a57f({'val':0x1});});});});}function insertAdditionalPhones(_0x2d581f){return new Promise(function(_0x230e42,_0x43e971){var _0xd65e58=_0x2d581f[_0x6388('0x19')];var _0x1206ba=_0xd65e58[_0x6388('0x1d')](';');var _0x288151=[];orderBy=0x0;for(var _0x2b66b4=0x0;_0x2b66b4<_0x1206ba[_0x6388('0x1e')];_0x2b66b4++){_0x288151[_0x6388('0x1b')](splitAdditionalPhone(_0x2d581f['id'],_0x1206ba[_0x2b66b4]));}Promise['all'](_0x288151)['then'](function(){_0x230e42({'val':_0x1206ba[_0x6388('0x1e')]});});});}function splitAdditionalPhone(_0xd1832,_0x4100b7){return new Promise(function(_0x554cfa,_0x3546a7){var _0x362456=_0x4100b7[_0x6388('0x1d')](':');var _0x5b2559=_0x362456[0x0];var _0x4227ac=_0x362456[0x1];if(!_[_0x6388('0x1f')](_0x4227ac)){var _0x4a9bee=_0x4227ac[_0x6388('0x1d')]('|');var _0x3222b5=[];for(var _0x2bcebb=0x0;_0x2bcebb<_0x4a9bee[_0x6388('0x1e')];_0x2bcebb++){if(_0x4a9bee[_0x2bcebb]!==''){var _0x1b455c=_[_0x6388('0x20')](promisesAdditionalPhones,{'contactId':_0xd1832,'phone':_0x4a9bee[_0x2bcebb]});if(_0x1b455c[_0x6388('0x1e')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0xd1832,'contactTypeId':_0x5b2559,'phone':_0x4a9bee[_0x2bcebb],'orderBy':orderBy});}}}_0x554cfa({'ok':0x1});}else _0x554cfa({'res':0x0});});}function createAdditionalPhone(_0x972efe,_0x3d850d,_0x4de78c,_0x3af0f2){var _0x3ad53f='';var _0x149397='';var _0x27fce5=_0x4de78c[_0x6388('0x1d')]('§');_0x3ad53f=_0x27fce5[0x0];if(_0x27fce5[_0x6388('0x1e')]==0x2)_0x149397=_0x27fce5[0x1];return new Promise(function(_0x311653,_0x3139f6){return db[_0x6388('0x21')]['findOne']({'where':{'CmContactId':_0x972efe,'item':_0x3ad53f}})['then'](function(_0x111aec){if(_0x111aec){return db[_0x6388('0x21')][_0x6388('0x22')]({'ItemTypeId':_0x3d850d,'description':_0x149397,'OrderBy':_0x3af0f2},{'where':{'CmContactId':_0x972efe,'item':_0x3ad53f}})[_0x6388('0x1a')](function(_0x311470){_0x311653({'res':_0x6388('0x23')});});}else{return db[_0x6388('0x21')]['create']({'CmContactId':_0x972efe,'item':_0x3ad53f,'description':_0x149397,'ItemTypeId':_0x3d850d,'OrderBy':_0x3af0f2,'ItemClass':'PHONE'})[_0x6388('0x1a')](function(_0x12af85){_0x311653({'res':_0x6388('0x24')});});}});});}function insertCmHopper(_0x54931d,_0xcf9b41,_0x19310f,_0x5d7147,_0x1656bb){var _0x7a5f3d=['cm_contacts.phone',_0x6388('0x25'),_0x6388('0x26'),_0x6388('0x27'),_0xcf9b41+'.'+_0x5d7147,_0x6388('0x28'),'cm_contacts.updatedAt',_0x6388('0x29'),_0x6388('0x2a'),'\x22'+_0x1656bb+'\x22'];return squel['insert']()['into'](_0x6388('0x2b'))[_0x6388('0x2c')]([_0x6388('0x13'),_0x6388('0x2d'),_0x6388('0x2e'),_0x6388('0x2f'),_0x5d7147,_0x6388('0x30'),'updatedAt',_0x6388('0x31'),_0x6388('0x32'),_0x6388('0x33')],squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x7a5f3d)['from'](_0xcf9b41)[_0x6388('0x16')]('cm_contacts',null,_0x6388('0x36')+_0xcf9b41+_0x6388('0x37'))[_0x6388('0x16')](_0x19310f,null,_0x19310f+_0x6388('0x38')+_0xcf9b41+'.'+_0x5d7147)[_0x6388('0x39')](_0xcf9b41+_0x6388('0x3a'),_0x54931d)[_0x6388('0x39')](_0x6388('0x3b'),NOW)[_0x6388('0x39')](_0x6388('0x3c'),selectNotIn(_0xcf9b41,_0x19310f,_0x5d7147,_0x6388('0x2b'),[_0x6388('0x3d'),'\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0xcf9b41,_0x19310f,_0x5d7147,'cm_hopper',[_0x6388('0x3d')])))[_0x6388('0x3e')]();}function insertCmHopperBlack(_0x25e49c,_0x4efef3,_0x5b719e,_0xa2deac){var _0x239200=[_0x6388('0x3f'),_0x6388('0x26'),_0x6388('0x27'),_0x4efef3+'.'+_0xa2deac,'cm_contacts.createdAt',_0x6388('0x40')];return squel['insert']()['into'](_0x6388('0x41'))[_0x6388('0x2c')]([_0x6388('0x13'),'ContactId','ListId',_0xa2deac,_0x6388('0x30'),'updatedAt'],squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x239200)['from'](_0x4efef3)[_0x6388('0x16')]('cm_contacts',null,_0x6388('0x36')+_0x4efef3+_0x6388('0x37'))[_0x6388('0x16')](_0x5b719e,null,_0x5b719e+_0x6388('0x38')+_0x4efef3+'.'+_0xa2deac)['where'](_0x4efef3+'.CmListId\x20=\x20?',_0x25e49c)[_0x6388('0x39')](_0x6388('0x3b'),NOW)[_0x6388('0x39')](_0x6388('0x3c'),squel['select']()[_0x6388('0x12')](_0x6388('0x13'))[_0x6388('0x14')](_0x6388('0x41'))[_0x6388('0x39')](_0x6388('0x42'),_0x25e49c)[_0x6388('0x39')](_0xa2deac+_0x6388('0x15')+_0x4efef3+'.'+_0xa2deac)))[_0x6388('0x3e')]();}function insertTzCmHopper(_0x4dbf8d,_0x3fc23c,_0x55be06,_0x26ebd3,_0x409018,_0x37d19f){var _0x3aadcb=[_0x6388('0x3f'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x37d19f+_0x6388('0x43'),_0x6388('0x26'),_0x6388('0x27'),_0x3fc23c+'.'+_0x26ebd3,'cm_contacts.createdAt',_0x6388('0x40'),'cm_contacts.priority',_0x6388('0x2a'),'\x22'+_0x409018+'\x22'];var _0x2842aa=squel['insert']()[_0x6388('0x44')]('cm_hopper')[_0x6388('0x2c')]([_0x6388('0x13'),_0x6388('0x2d'),_0x6388('0x2e'),_0x6388('0x2f'),_0x26ebd3,_0x6388('0x30'),_0x6388('0x45'),'priority','UserId','recallme'],squel['select']()[_0x6388('0x35')](_0x3aadcb)['from'](_0x3fc23c)[_0x6388('0x16')](_0x6388('0x46'),null,_0x6388('0x36')+_0x3fc23c+_0x6388('0x37'))[_0x6388('0x16')](_0x55be06,null,_0x55be06+_0x6388('0x38')+_0x3fc23c+'.'+_0x26ebd3)[_0x6388('0x16')](_0x37d19f,null,_0x37d19f+_0x6388('0x38')+_0x3fc23c+'.'+_0x26ebd3)[_0x6388('0x39')](_0x3fc23c+_0x6388('0x3a'),_0x4dbf8d)[_0x6388('0x39')]('cm_contacts.createdAt\x20=\x20?',NOW)['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x3fc23c,_0x55be06,_0x26ebd3,_0x6388('0x2b'),[_0x6388('0x3d'),_0x6388('0x47')]))[_0x6388('0x39')](_0x6388('0x3c'),selectNotIn(_0x3fc23c,_0x55be06,_0x26ebd3,'cm_hopper',[_0x6388('0x3d')])))['toString']();return _0x2842aa;}function insertTzCmHopperBlack(_0x7b0c58,_0x26339b,_0x147b51,_0x3352ef){var _0x394cd1=[_0x6388('0x3f'),_0x6388('0x26'),_0x6388('0x27'),_0x26339b+'.'+_0x3352ef,_0x6388('0x28'),'cm_contacts.updatedAt'];return squel[_0x6388('0x48')]()[_0x6388('0x44')]('cm_hopper_black')[_0x6388('0x2c')]([_0x6388('0x13'),_0x6388('0x2e'),_0x6388('0x2f'),_0x3352ef,_0x6388('0x30'),_0x6388('0x45')],squel['select']()[_0x6388('0x35')](_0x394cd1)[_0x6388('0x14')](_0x26339b)[_0x6388('0x16')](_0x6388('0x46'),null,'cm_contacts.ListId\x20=\x20'+_0x26339b+_0x6388('0x37'))[_0x6388('0x16')](_0x147b51,null,_0x147b51+_0x6388('0x38')+_0x26339b+'.'+_0x3352ef)[_0x6388('0x39')](_0x26339b+_0x6388('0x3a'),_0x7b0c58)[_0x6388('0x39')](_0x6388('0x3b'),NOW)[_0x6388('0x39')](_0x6388('0x3c'),squel[_0x6388('0x34')]()[_0x6388('0x12')]('phone')[_0x6388('0x14')](_0x6388('0x41'))['where']('ListId\x20=\x20?',_0x7b0c58)['where'](_0x3352ef+'\x20=\x20'+_0x26339b+'.'+_0x3352ef)))['toString']();}function insertCmHopperAdditionalPhones(_0x9544b5){var _0x4a425a=[_0x6388('0x49'),_0x6388('0x4a'),_0x6388('0x4b'),_0x6388('0x4c'),_0x6388('0x4d')];return squel[_0x6388('0x48')]()[_0x6388('0x44')]('cm_hopper_additional_phones')[_0x6388('0x2c')]([_0x6388('0x4e'),_0x6388('0x13'),_0x6388('0x4f'),_0x6388('0x30'),_0x6388('0x45')],squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x4a425a)[_0x6388('0x14')]('cm_hopper')['join'](_0x6388('0x46'),null,_0x6388('0x50'))[_0x6388('0x16')]('cm_contact_has_items',null,_0x6388('0x51'))[_0x6388('0x39')](_0x6388('0x52'),_0x9544b5)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x6388('0x3e')]();}function insertCmContact(_0x4180b5,_0x41173e,_0x2895f8,_0x3c9159){var _0x35df3e=_[_0x6388('0x53')](_['keys'](_0x3c9159),[_0x6388('0x2f'),'CompanyId',_0x6388('0x30'),_0x6388('0x45'),'scheduledAt']);return squel[_0x6388('0x48')]()[_0x6388('0x44')](_0x6388('0x46'))[_0x6388('0x2c')](_0x35df3e,squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x35df3e)[_0x6388('0x14')](_0x41173e)[_0x6388('0x39')]('('+_0x2895f8[_0x6388('0x16')](',')+')\x20NOT\x20IN\x20?',squel[_0x6388('0x34')]()[_0x6388('0x35')](_0x2895f8)[_0x6388('0x14')](_0x6388('0x46'))[_0x6388('0x39')]('ListId\x20=\x20?',_0x4180b5)[_0x6388('0x39')]('deletedAt\x20IS\x20NULL'))[_0x6388('0x39')](_0x6388('0x54'),squel[_0x6388('0x34')]()[_0x6388('0x12')](_0x6388('0x55'),_0x6388('0x56'))[_0x6388('0x14')](_0x41173e)[_0x6388('0x57')](_0x2895f8['join'](','))))['toString']();}function handleStop(){logger[_0x6388('0x58')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x4a570c){logger['error'](_0x4a570c[_0x6388('0x59')]);process[_0x6388('0x5a')](0x1);}function handleError(_0x2a845c,_0x137aea){stats['errors'][_0x6388('0x1b')]({'name':_0x137aea[_0x6388('0x5b')],'message':_0x137aea[_0x6388('0x59')],'row':_0x2a845c});}function handleQuery(_0x524ef3){logger['info'](_0x524ef3);return db[_0x6388('0x5c')]['query'](_0x524ef3)['spread'](function(_0x1ca752){results[_0x6388('0x1b')](_0x1ca752);})[_0x6388('0x5d')](function(_0x3ebe12){logger[_0x6388('0x5e')](_0x3ebe12[_0x6388('0x59')]);});}function updateTzCampaigns(_0x731584){return new Promise(function(_0x37e732,_0x44d9f3){var _0x2a8c05=squel['select']()['fields']([_0x6388('0x5f'),_0x6388('0x60')])['from'](_0x6388('0x61'))['join'](_0x6388('0x62'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x6388('0x39')](_0x6388('0x63')+_0x731584);db['sequelize'][_0x6388('0x64')](_0x2a8c05['toString']())[_0x6388('0x65')](function(_0xacd6b){var _0x3ac3d8=[];for(var _0x2cf7ed=0x0;_0x2cf7ed<_0xacd6b[_0x6388('0x1e')];_0x2cf7ed++){_0x3ac3d8['push'](getTimezoneData(_0xacd6b[_0x2cf7ed],tmp_campaigns));}BPromise[_0x6388('0x1c')](_0x3ac3d8)[_0x6388('0x1a')](function(){_0x37e732({'val':0x1});});})[_0x6388('0x5d')](function(_0x39d777){logger[_0x6388('0x5e')](_0x39d777[_0x6388('0x59')]);_0x37e732({'val':0x0});});});}function updateTzVoiceQueues(_0x42ce5b){return new Promise(function(_0x1d6d98,_0x58d1aa){var _0x360e94=squel['select']()['fields']([_0x6388('0x66'),_0x6388('0x67')])[_0x6388('0x14')]('voice_queues')[_0x6388('0x16')](_0x6388('0x68'),null,_0x6388('0x69'))[_0x6388('0x39')](_0x6388('0x6a')+_0x42ce5b);db['sequelize'][_0x6388('0x64')](_0x360e94[_0x6388('0x3e')]())[_0x6388('0x65')](function(_0x137f3e){var _0x3746bd=[];for(var _0x2c2fc1=0x0;_0x2c2fc1<_0x137f3e[_0x6388('0x1e')];_0x2c2fc1++){_0x3746bd[_0x6388('0x1b')](getTimezoneData(_0x137f3e[_0x2c2fc1],tmp_voice_queues));}BPromise[_0x6388('0x1c')](_0x3746bd)['then'](function(){_0x1d6d98({'val':0x1});});})[_0x6388('0x5d')](function(_0x5dc11a){logger[_0x6388('0x5e')](_0x5dc11a['message']);_0x1d6d98({'val':0x0});});});}function getTimezoneData(_0x44f797,_0x24a68b){return new Promise(function(_0x5d1406,_0x4c560a){var _0x390cd8=shared[_0x6388('0x6b')];var _0xc4bbca=_0x390cd8[_0x44f797['dialTimezone']];if(_['isNil'](_0xc4bbca)){_0x5d1406({'ret':0x1});}else{var _0x5822da=_0xc4bbca[_0x6388('0x6c')];var _0x53691c=squel['insert']()['into'](_0x24a68b)[_0x6388('0x6d')]('id',_0x44f797['id'])['set']('offset',_0x5822da)['set'](_0x6388('0x6e'),_0x44f797[_0x6388('0x6e')])[_0x6388('0x3e')]();return db[_0x6388('0x5c')]['query'](_0x53691c)[_0x6388('0x65')](function(_0x54c6b3){_0x5d1406({'ret':0x1});})[_0x6388('0x5d')](function(_0x2511a5){logger[_0x6388('0x5e')](_0x2511a5[_0x6388('0x59')]);_0x4c560a({'ret':0x1});});}});}function handleTZQuery(_0x5ad4de){logger[_0x6388('0x58')](_0x5ad4de);return db['sequelize'][_0x6388('0x64')](_0x5ad4de)[_0x6388('0x65')](function(_0x5390d6){})[_0x6388('0x5d')](function(_0x20b363){logger[_0x6388('0x5e')](_0x20b363[_0x6388('0x59')]);});}function main(_0x2d8363,_0x488427,_0xa9b5a5,_0x59d3b0){logger[_0x6388('0x58')](_0x6388('0x6f'),_0x2d8363,JSON[_0x6388('0x70')](_0x488427));process[_0x6388('0x71')]('start');var _0x236061=_0x488427['binding'];var _0x18b4a8=_[_0x6388('0x72')](_0x236061);var _0x4d531b=_0x488427[_0x6388('0x73')];var _0x1d190f=path[_0x6388('0x16')](config[_0x6388('0x74')],_0x6388('0x75'),_0x4d531b+'.csv');hasTZ=_[_0x6388('0x76')](_0x236061)[_0x6388('0x77')](_0x6388('0x6e'));var _0x45cba8=_[_0x6388('0x76')](_0x236061)[_0x6388('0x16')]();logger[_0x6388('0x58')](_0x6388('0x78'),_0x45cba8);db['ContactItemType'][_0x6388('0x18')]({'raw':!![],'attributes':['id',_0x6388('0x79')]})[_0x6388('0x1a')](function(_0xc4ef0a){for(var _0x6d4fc=0x0;_0x6d4fc<_0xc4ef0a['length'];_0x6d4fc++){if(_0xc4ef0a[_0x6d4fc]['name']in _0x236061){contactItemTypes['push'](_0xc4ef0a[_0x6d4fc]);delete _0x18b4a8[_0xc4ef0a[_0x6d4fc]['name']];hasAdditionalPhones=!![];}for(var _0x360aab in _0x236061){if(_0xc4ef0a[_0x6d4fc]['name']+_0x6388('0x7a')===_0x360aab){phoneDescriptions['push']({'itemTypeId':_0xc4ef0a[_0x6d4fc]['id'],'description':_0x360aab});delete _0x18b4a8[_0x360aab];}}}if(hasAdditionalPhones)_0x18b4a8[_0x6388('0x19')]='';var _0x3d29e5=_[_0x6388('0x76')](_0x18b4a8)[_0x6388('0x16')]();logger[_0x6388('0x58')](_0x6388('0x78'),_0x3d29e5);fs[_0x6388('0x7b')](_0x1d190f,_0x3d29e5+'\x0a');Papa[_0x6388('0x7c')](fs[_0x6388('0x7d')](_0x2d8363),{'header':!![],'skipEmptyLines':!![],'step':function(_0x20dcd3,_0xdc2de6){try{for(var _0xc8bce5=0x0,_0xf62aee=[];_0xc8bce5<_0x20dcd3[_0x6388('0x7e')][_0x6388('0x1e')];_0xc8bce5++){stats[_0x6388('0x7f')]+=0x1;if(_0x20dcd3[_0x6388('0x80')][_0xc8bce5]){handleError(_0x20dcd3[_0x6388('0x7e')][_0xc8bce5],_0x20dcd3['errors'][_0xc8bce5]);}else{var _0x31d1e3=[];var _0x84af50=[];var _0x5a0171={};for(var _0x1d11f5 in _0x236061){let _0x3be217=contactItemTypes[_0x6388('0x81')](_0x585bd4=>_0x585bd4[_0x6388('0x79')]===_0x1d11f5);let _0x44bcfd=contactItemTypes['find'](_0x36b40e=>_0x36b40e[_0x6388('0x79')]+'_description'===_0x1d11f5);if(_[_0x6388('0x1f')](_0x3be217)&&_[_0x6388('0x1f')](_0x44bcfd)){if(_0x236061[_0x6388('0x82')](_0x1d11f5)){if(_0x20dcd3[_0x6388('0x7e')][_0xc8bce5][_0x236061[_0x1d11f5]]){var _0xb8d7a8=_['trim'](_0x20dcd3[_0x6388('0x7e')][_0xc8bce5][_0x236061[_0x1d11f5]]['replace'](/"/g,'\x27'));switch(_0x1d11f5){case'scheduledat':var _0x59be8f=moment(_0xb8d7a8,_0x6388('0x10'),!![]);if(_0x59be8f[_0x6388('0x83')]()){_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');}else{_0x31d1e3[_0x6388('0x1b')](_0x6388('0x84'));}break;case _0x6388('0x31'):var _0x13ee29=parseInt(_0xb8d7a8);_0xb8d7a8=_[_0x6388('0x85')](_0x13ee29)||_0x13ee29<0x0||_0x13ee29>0x4?_0x59d3b0?0x3:0x2:_0x13ee29;_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');break;case'UserId':var _0x1612ef=parseInt(_0xb8d7a8);if(_[_0x6388('0x86')](_0x1612ef)&&_[_0x6388('0x77')](_0xa9b5a5,_0x1612ef)){_0xf62aee[_0x6388('0x1b')]('\x22'+_0x1612ef+'\x22');}else{_0x31d1e3['push']('agent\x20not\x20exists');}break;case _0x6388('0x87'):if(isEmail(_0xb8d7a8)){_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');}else{_0x31d1e3[_0x6388('0x1b')]('email\x20wrong\x20format');}break;case _0x6388('0x88'):var _0x393732=moment(_0xb8d7a8,'YYYY-MM-DD',!![]);if(_0x393732['isValid']()){_0xf62aee['push']('\x22'+_0xb8d7a8+'\x22');}else{_0x31d1e3[_0x6388('0x1b')](_0x6388('0x89'));}break;case'dialTimezone':var _0x4ebcc4=shared[_0x6388('0x6b')];var _0x486681=_0x4ebcc4[_0xb8d7a8];if(!_[_0x6388('0x1f')](_0x486681)){var _0x263f67=_0x486681[_0x6388('0x6c')];_0xf62aee['push']('\x22'+_0xb8d7a8+'\x22');_0xf62aee['push']('\x22'+_0x263f67+'\x22');}break;default:_0xf62aee[_0x6388('0x1b')]('\x22'+_0xb8d7a8+'\x22');}}else{switch(_0x1d11f5){case _0x6388('0x8a'):case'phone':_0x31d1e3['push'](_0x1d11f5+_0x6388('0x8b'));break;default:_0xf62aee['push']('\x22\x22');}}}}else{var _0x1af0a1='';if(!_[_0x6388('0x1f')](_0x3be217)){if(!_0x5a0171['hasOwnProperty'](_0x3be217['id'])){if(!_[_0x6388('0x1f')](_0x20dcd3['data'][_0xc8bce5][_0x236061[_0x1d11f5]])){var _0xb8d7a8=_['trim'](_0x20dcd3['data'][_0xc8bce5][_0x236061[_0x1d11f5]]['replace'](/"/g,'\x27'));var _0x2f5b8d=phoneDescriptions[_0x6388('0x81')](_0xad7361=>_0xad7361[_0x6388('0x8c')]===_0x3be217['id']);if(!_[_0x6388('0x1f')](_0x2f5b8d)){var _0x152157=_[_0x6388('0x8d')](_0x20dcd3[_0x6388('0x7e')][_0xc8bce5][_0x236061[_0x2f5b8d[_0x6388('0x8e')]]][_0x6388('0x8f')](/"/g,'\x27'));if(!_[_0x6388('0x1f')](_0x152157))_0xb8d7a8=_0xb8d7a8+'§'+_0x152157;}if(_0x1af0a1=='')_0x1af0a1=_0xb8d7a8;else _0x1af0a1+='|'+_0xb8d7a8;}_0x84af50[_0x6388('0x1b')](_0x3be217['id']+':'+_0x1af0a1);_0x5a0171[_0x3be217['id']]=0x1;}}}}if(hasAdditionalPhones){_0xf62aee['push']('\x22'+_0x84af50[_0x6388('0x16')](';')+'\x22');}if(_0x31d1e3[_0x6388('0x1e')]){handleError(_0x20dcd3[_0x6388('0x7e')][_0xc8bce5],{'code':_0x6388('0x90'),'message':_0x31d1e3[_0x6388('0x16')]()});}else{fs[_0x6388('0x91')](_0x1d190f,_0xf62aee[_0x6388('0x16')]()+'\x0a');}_0xf62aee=[];}if(!(stats[_0x6388('0x7f')]%0xc8)){socket[_0x6388('0x92')](_0x6388('0x93')+_0x4d531b,stats);stats['errors']=[];}}if(stopped){logger[_0x6388('0x58')](_0x6388('0x94'));_0xdc2de6[_0x6388('0x95')]();}}catch(_0xaebc0){handleError(_0x20dcd3['data'][_0xc8bce5],{'code':_0x6388('0x96'),'message':_0xaebc0[_0x6388('0x59')]});logger[_0x6388('0x5e')](_0x6388('0x97'),_0xaebc0['message']);}},'complete':function(){try{var _0x294f27=[];var _0xfe2130=[];var _0x15211e='cm_contacts';if(_0x488427[_0x6388('0x98')]&&_0x488427['duplicates'][_0x6388('0x1e')]){_0x15211e='cm_contacts_'+_0x4d531b;_0x294f27[_0x6388('0x1b')](_0x6388('0x99')+_0x15211e+_0x6388('0x9a'));}tmp_campaigns=_0x6388('0x9b')+_0x4d531b;tmp_voice_queues=_0x6388('0x9c')+_0x4d531b;_0xfe2130[_0x6388('0x1b')](_0x6388('0x99')+tmp_campaigns+_0x6388('0x9d'));_0xfe2130['push'](_0x6388('0x99')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x6388('0x9e')](_0xfe2130,handleTZQuery)[_0x6388('0x1a')](function(_0x5bf670){updateTzCampaigns(_0x488427[_0x6388('0x2f')])[_0x6388('0x1a')](function(_0x5abc95){updateTzVoiceQueues(_0x488427['ListId'])[_0x6388('0x1a')](function(_0x197e8a){if(hasTZ)_0x3d29e5=_0x3d29e5[_0x6388('0x8f')](_0x6388('0x6e'),_0x6388('0x9f'));var _0x296f14=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',_0x1d190f,_0x15211e,_0x3d29e5,_0x488427[_0x6388('0x2f')],_0x488427[_0x6388('0xa0')]||null,NOW,NOW);if(_[_0x6388('0x1f')](_0x236061[_0x6388('0x2d')])){_0x296f14+=_0x6388('0xa1');}_0x294f27[_0x6388('0x1b')](_0x296f14);if(_0x488427[_0x6388('0x98')]&&_0x488427[_0x6388('0x98')][_0x6388('0x1e')]){_0x294f27['push'](insertCmContact(_0x488427[_0x6388('0x2f')],_0x15211e,_0x488427[_0x6388('0x98')],_0x236061));_0x294f27[_0x6388('0x1b')](_0x6388('0xa2')+_0x15211e+';');}BPromise[_0x6388('0x9e')](_0x294f27,handleQuery)[_0x6388('0x1a')](function(_0x7c6e1d){BPromise[_0x6388('0x1c')]([handleAdditionalPhones()])[_0x6388('0x1a')](function(){_0x294f27=[];for(var _0x270725=0x0;_0x270725\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','SIGINT','uncaughtException','lodash','papaparse','util','bluebird','moment','ioredis','import','redis','defaults','localhost'];(function(_0x2745a7,_0x3f7774){var _0x310459=function(_0x5b875f){while(--_0x5b875f){_0x2745a7['push'](_0x2745a7['shift']());}};_0x310459(++_0x3f7774);}(_0xeeeb,0x1bb));var _0xbeee=function(_0x36bd0e,_0x4999a2){_0x36bd0e=_0x36bd0e-0x0;var _0x54231d=_0xeeeb[_0x36bd0e];return _0x54231d;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0xbeee('0x0'));var Papa=require(_0xbeee('0x1'));var util=require(_0xbeee('0x2'));var BPromise=require(_0xbeee('0x3'));var moment=require(_0xbeee('0x4'));var squel=require('squel');var Redis=require(_0xbeee('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xbeee('0x6'));config[_0xbeee('0x7')]=_[_0xbeee('0x8')](config[_0xbeee('0x7')],{'host':_0xbeee('0x9'),'port':0x18eb});var socket=require(_0xbeee('0xa'))(new Redis(config['redis']));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()[_0xbeee('0xb')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName='cm_contacts_temp_'+moment()[_0xbeee('0xb')]('YYYYMMDDHHmmss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x582450){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))*$/[_0xbeee('0xc')](_0x582450);}function selectNotIn(_0x2e2269,_0x5a3b0e,_0x3b4a9d,_0x535404,_0x33314f){return squel[_0xbeee('0xd')]()[_0xbeee('0xe')](_0xbeee('0xf'))[_0xbeee('0x10')](_0x535404)[_0xbeee('0x11')](_0x5a3b0e,null,_0x5a3b0e+_0xbeee('0x12')+_0x535404+'.'+_0x3b4a9d)['where'](_0x535404+'.'+_0x3b4a9d+_0xbeee('0x13')+_0x2e2269+'.'+_0x3b4a9d)[_0xbeee('0x14')](_0x5a3b0e+'.dialCheckDuplicateType\x20IN\x20('+_0x33314f[_0xbeee('0x11')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4b7b6d,_0x13b691){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xbeee('0x15')](_0xbeee('0x16')+tempTableName)[_0xbeee('0x17')](function(_0x377a78){if(_0x377a78!==null){var _0x4fcea7=[];for(var _0x48d0b3=0x0;_0x48d0b3<_0x377a78[_0xbeee('0x18')];_0x48d0b3++){var _0x122992=_0x377a78[_0x48d0b3];if(!_['isNil'](_0x122992['phone'])){if(!_[_0xbeee('0x19')](_0x122992[_0xbeee('0x1a')]))_0x4fcea7[_0xbeee('0x1b')](insertAdditionalPhones(_0x122992));promisesContact[_0xbeee('0x1b')]({'contact':_0x122992});}}}Promise[_0xbeee('0x1c')](_0x4fcea7)[_0xbeee('0x1d')](function(){_0x4b7b6d({'val':0x1});});})[_0xbeee('0x1e')](function(_0x438e8c){logger[_0xbeee('0x1f')](_0x438e8c['message']);});});}function insertAdditionalPhones(_0x41ca56){return new Promise(function(_0x48bf0d,_0x5c882c){var _0x2d2c79=_0x41ca56['AdditionalPhones'];if(_[_0xbeee('0x19')](_0x2d2c79))_0x5c882c({'val':0x0});else{var _0x554e59=_0x2d2c79[_0xbeee('0x20')](';');var _0x32fa75=[];orderBy=0x0;for(var _0x522ce2=0x0;_0x522ce2<_0x554e59['length'];_0x522ce2++){_0x32fa75[_0xbeee('0x1b')](splitAdditionalPhone(_0x41ca56['id'],_0x554e59[_0x522ce2]));}Promise[_0xbeee('0x1c')](_0x32fa75)[_0xbeee('0x1d')](function(){_0x48bf0d({'val':_0x554e59[_0xbeee('0x18')]});});}});}function splitAdditionalPhone(_0x2953a4,_0xf60f9b){return new Promise(function(_0x3787cd,_0x404e38){var _0x947a83=_0xf60f9b[_0xbeee('0x20')](':');var _0x2e6610=_0x947a83[0x0];var _0x4fd3e7=_0x947a83[0x1];if(_0x4fd3e7!==''){var _0x541846=_0x4fd3e7['split']('|');var _0x240677=[];for(var _0x8cafc7=0x0;_0x8cafc7<_0x541846[_0xbeee('0x18')];_0x8cafc7++){if(_0x541846[_0x8cafc7]!==''){var _0x379c81=_[_0xbeee('0x21')](promisesAdditionalPhones,{'contactId':_0x2953a4,'phone':_0x541846[_0x8cafc7]});if(_0x379c81['length']==0x0){orderBy++;promisesAdditionalPhones[_0xbeee('0x1b')]({'contactId':_0x2953a4,'contactTypeId':_0x2e6610,'phone':_0x541846[_0x8cafc7],'orderBy':orderBy});}}}_0x3787cd({'ok':0x1});}else _0x3787cd({'res':0x0});});}function createAdditionalPhone(_0x3593d1,_0x2472db,_0x11d692,_0x56c852){var _0x851c90='';var _0x51bfe2='';var _0x5d19c6=_0x11d692[_0xbeee('0x20')]('§');_0x851c90=_0x5d19c6[0x0];if(_0x5d19c6[_0xbeee('0x18')]==0x2)_0x51bfe2=_0x5d19c6[0x1];return new Promise(function(_0x24a946,_0x2813a5){return db[_0xbeee('0x22')]['findOne']({'where':{'CmContactId':_0x3593d1,'item':_0x851c90}})[_0xbeee('0x1d')](function(_0x37a90d){if(_0x37a90d){return db[_0xbeee('0x22')][_0xbeee('0x23')]({'ItemTypeId':_0x2472db,'description':_0x51bfe2,'OrderBy':_0x56c852},{'where':{'CmContactId':_0x3593d1,'item':_0x851c90}})[_0xbeee('0x1d')](function(_0x4a7085){_0x24a946({'res':_0xbeee('0x24')});});}else{return db[_0xbeee('0x22')][_0xbeee('0x25')]({'CmContactId':_0x3593d1,'item':_0x851c90,'ItemTypeId':_0x2472db,'description':_0x51bfe2,'OrderBy':_0x56c852,'ItemClass':'PHONE'})['then'](function(_0x3af937){_0x24a946({'res':_0xbeee('0x26')});});}});});}function updateContact(_0x3d142d){return new Promise(function(_0x4dd9dc,_0x125c62){var _0x14cafe=_0x3d142d['id'];delete _0x3d142d['id'];return db[_0xbeee('0x27')][_0xbeee('0x23')](_0x3d142d,{'where':{'id':_0x14cafe}})[_0xbeee('0x1d')](function(_0x26dd3f){updatedRows+=0x1;return db[_0xbeee('0x28')][_0xbeee('0x23')]({'phone':_0x3d142d[_0xbeee('0xf')]},{'where':{'ContactId':_0x14cafe}})['then'](function(_0x8dc7b2){_0x4dd9dc({'ret':'OK'});});});});}function insertCmHopper(_0x7c2055,_0x42ef5e,_0x1cc84b,_0x4fa13c,_0x5874a0){var _0x2383fd=[_0xbeee('0x29'),_0xbeee('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x42ef5e+'.'+_0x4fa13c,_0xbeee('0x2b'),_0xbeee('0x2c'),'cm_contacts.priority',_0xbeee('0x2d'),'\x22'+_0x5874a0+'\x22'];return squel[_0xbeee('0x2e')]()[_0xbeee('0x2f')](_0xbeee('0x30'))[_0xbeee('0x31')](['phone',_0xbeee('0x32'),_0xbeee('0x33'),'ListId',_0x4fa13c,_0xbeee('0x34'),'updatedAt',_0xbeee('0x35'),_0xbeee('0x36'),'recallme'],squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x2383fd)[_0xbeee('0x10')](_0x42ef5e)[_0xbeee('0x11')](_0xbeee('0x38'),null,'cm_contacts.ListId\x20=\x20'+_0x42ef5e+_0xbeee('0x39'))[_0xbeee('0x11')](_0x1cc84b,null,_0x1cc84b+_0xbeee('0x12')+_0x42ef5e+'.'+_0x4fa13c)[_0xbeee('0x14')](_0x42ef5e+_0xbeee('0x3a'),_0x7c2055)['where'](_0xbeee('0x3b'),NOW)[_0xbeee('0x14')](_0xbeee('0x3c'),selectNotIn(_0x42ef5e,_0x1cc84b,_0x4fa13c,_0xbeee('0x30'),[_0xbeee('0x3d'),_0xbeee('0x3e')]))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x42ef5e,_0x1cc84b,_0x4fa13c,_0xbeee('0x30'),['\x22always\x22'])))[_0xbeee('0x3f')]();}function insertCmHopperBlack(_0x545cd8,_0xb76244,_0x4d76cd,_0x1f6cb6){var _0x254e53=[_0xbeee('0x29'),_0xbeee('0x40'),_0xbeee('0x41'),_0xb76244+'.'+_0x1f6cb6,_0xbeee('0x2b'),_0xbeee('0x2c')];return squel[_0xbeee('0x2e')]()[_0xbeee('0x2f')](_0xbeee('0x42'))['fromQuery']([_0xbeee('0xf'),_0xbeee('0x33'),_0xbeee('0x43'),_0x1f6cb6,_0xbeee('0x34'),_0xbeee('0x44')],squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x254e53)['from'](_0xb76244)['join']('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0xb76244+_0xbeee('0x39'))['join'](_0x4d76cd,null,_0x4d76cd+'.id\x20=\x20'+_0xb76244+'.'+_0x1f6cb6)[_0xbeee('0x14')](_0xb76244+_0xbeee('0x3a'),_0x545cd8)[_0xbeee('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0xbeee('0x14')](_0xbeee('0x3c'),squel[_0xbeee('0xd')]()[_0xbeee('0xe')](_0xbeee('0xf'))['from'](_0xbeee('0x42'))[_0xbeee('0x14')](_0xbeee('0x45'),_0x545cd8)['where'](_0x1f6cb6+_0xbeee('0x46'),_0xb76244+'.'+_0x1f6cb6)))[_0xbeee('0x3f')]();}function insertCmHopperAdditionalPhones(_0x3b0e97){var _0x5239f9=[_0xbeee('0x47'),_0xbeee('0x48'),_0xbeee('0x49'),'cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt'];return squel[_0xbeee('0x2e')]()[_0xbeee('0x2f')](_0xbeee('0x4a'))[_0xbeee('0x31')](['CmHopperId',_0xbeee('0xf'),_0xbeee('0x4b'),_0xbeee('0x34'),_0xbeee('0x44')],squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x5239f9)[_0xbeee('0x10')](_0xbeee('0x30'))[_0xbeee('0x11')](_0xbeee('0x38'),null,_0xbeee('0x4c'))[_0xbeee('0x11')](_0xbeee('0x4d'),null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0xbeee('0x14')](_0xbeee('0x4e'),_0x3b0e97)['where'](_0xbeee('0x3b'),NOW))[_0xbeee('0x3f')]();}function insertCmContact(_0x5552b9,_0x1bdcb3,_0x311bfd,_0x3970aa){var _0x909c7c=_[_0xbeee('0x4f')](_[_0xbeee('0x50')](_0x3970aa),[_0xbeee('0x43'),_0xbeee('0x51'),_0xbeee('0x34'),_0xbeee('0x44')]);return squel[_0xbeee('0x2e')]()['into']('cm_contacts')['fromQuery'](_0x909c7c,squel['select']()['fields'](_0x909c7c)['from'](_0x1bdcb3)[_0xbeee('0x14')]('('+_0x311bfd[_0xbeee('0x11')](',')+_0xbeee('0x52'),squel[_0xbeee('0xd')]()[_0xbeee('0x37')](_0x311bfd)[_0xbeee('0x10')]('cm_contacts')[_0xbeee('0x14')]('ListId\x20=\x20?',_0x5552b9))[_0xbeee('0x14')](_0xbeee('0x53'),squel[_0xbeee('0xd')]()[_0xbeee('0xe')](_0xbeee('0x54'),'min_id')[_0xbeee('0x10')](_0x1bdcb3)[_0xbeee('0x55')](_0x311bfd[_0xbeee('0x11')](','))))[_0xbeee('0x3f')]();}function handleStop(){logger[_0xbeee('0x56')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x154ac0){logger['error'](_0x154ac0[_0xbeee('0x57')]);process['exit'](0x1);}function handleError(_0x3e9f6a,_0xab960c){stats[_0xbeee('0x58')][_0xbeee('0x1b')]({'name':_0xab960c[_0xbeee('0x59')],'message':_0xab960c['message'],'row':_0x3e9f6a});}function handleQuery(_0x464481){logger[_0xbeee('0x56')](_0x464481);return db[_0xbeee('0x5a')]['query'](_0x464481)[_0xbeee('0x17')](function(_0x3baac7){results[_0xbeee('0x1b')](_0x3baac7);})[_0xbeee('0x1e')](function(_0x7ee14){logger['error'](_0x7ee14['message']);});}function main(_0xa88b64,_0x5de4f5,_0x2c2ff3,_0x354c48){logger[_0xbeee('0x56')](_0xbeee('0x5b'),_0xa88b64,JSON[_0xbeee('0x5c')](_0x5de4f5));process['send'](_0xbeee('0x5d'));var _0x2e954c=_0x5de4f5[_0xbeee('0x5e')];var _0x1e82ed=_[_0xbeee('0x5f')](_0x2e954c);var _0x3aba49=_0x5de4f5['socket_timestamp'];var _0x28f2f2=path['join'](config[_0xbeee('0x60')],_0xbeee('0x61'),_0x3aba49+'.csv');logger[_0xbeee('0x56')](_0xbeee('0x62'),_0x5de4f5);db[_0xbeee('0x63')][_0xbeee('0x64')]({'raw':!![],'attributes':['id',_0xbeee('0x65')]})[_0xbeee('0x1d')](function(_0x2499b1){for(var _0x4c11f9=0x0;_0x4c11f9<_0x2499b1[_0xbeee('0x18')];_0x4c11f9++){if(_0x2499b1[_0x4c11f9][_0xbeee('0x65')]in _0x2e954c){contactItemTypes[_0xbeee('0x1b')](_0x2499b1[_0x4c11f9]);delete _0x1e82ed[_0x2499b1[_0x4c11f9][_0xbeee('0x65')]];hasAdditionalPhones=!![];}for(var _0x206688 in _0x2e954c){if(_0x2499b1[_0x4c11f9][_0xbeee('0x65')]+_0xbeee('0x66')===_0x206688){phoneDescriptions['push']({'itemTypeId':_0x2499b1[_0x4c11f9]['id'],'description':_0x206688});delete _0x1e82ed[_0x206688];}}}if(hasAdditionalPhones)_0x1e82ed[_0xbeee('0x1a')]='';var _0x2c2888=_[_0xbeee('0x50')](_0x1e82ed)[_0xbeee('0x11')]();logger[_0xbeee('0x56')]('header',_0x2c2888);fs[_0xbeee('0x67')](_0x28f2f2,_0x2c2888+'\x0a');Papa[_0xbeee('0x68')](fs[_0xbeee('0x69')](_0xa88b64),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5242c6,_0x823520){try{for(var _0x4457b4=0x0,_0x2714be=[];_0x4457b4<_0x5242c6[_0xbeee('0x6a')][_0xbeee('0x18')];_0x4457b4++){stats[_0xbeee('0x6b')]+=0x1;if(_0x5242c6['errors'][_0x4457b4]){handleError(_0x5242c6['data'][_0x4457b4],_0x5242c6[_0xbeee('0x58')][_0x4457b4]);}else{var _0x1e23b4=[];var _0x5c8322=[];var _0x28caea={};for(var _0x18016d in _0x2e954c){let _0x50f5d2=contactItemTypes[_0xbeee('0x6c')](_0x3e6f5c=>_0x3e6f5c[_0xbeee('0x65')]===_0x18016d);let _0x3f2cd5=contactItemTypes[_0xbeee('0x6c')](_0x1b3035=>_0x1b3035['name']+_0xbeee('0x66')===_0x18016d);if(_[_0xbeee('0x19')](_0x50f5d2)&&_[_0xbeee('0x19')](_0x3f2cd5)){if(_0x2e954c['hasOwnProperty'](_0x18016d)){if(_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x18016d]]){var _0x57e2fb=_[_0xbeee('0x6d')](_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x18016d]]['replace'](/"/g,'\x27'));switch(_0x18016d){case'scheduledat':var _0xf58d50=moment(_0x57e2fb,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0xf58d50[_0xbeee('0x6e')]()){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}else{_0x1e23b4[_0xbeee('0x1b')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xbeee('0x35'):var _0x53ba44=parseInt(_0x57e2fb);_0x57e2fb=_[_0xbeee('0x6f')](_0x53ba44)||_0x53ba44<0x0||_0x53ba44>0x4?_0x354c48?0x3:0x2:_0x53ba44;_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');break;case _0xbeee('0x36'):var _0x330a56=parseInt(_0x57e2fb);if(_[_0xbeee('0x70')](_0x330a56)&&_['includes'](_0x2c2ff3,_0x330a56)){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x330a56+'\x22');}else{_0x1e23b4[_0xbeee('0x1b')]('agent\x20not\x20exists');}break;case _0xbeee('0x71'):if(isEmail(_0x57e2fb)){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}else{_0x1e23b4[_0xbeee('0x1b')](_0xbeee('0x72'));}break;case _0xbeee('0x73'):var _0x112405=moment(_0x57e2fb,'YYYY-MM-DD',!![]);if(_0x112405['isValid']()){_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}else{_0x1e23b4['push'](_0xbeee('0x74'));}break;default:_0x2714be[_0xbeee('0x1b')]('\x22'+_0x57e2fb+'\x22');}}else{switch(_0x18016d){case'firstName':case _0xbeee('0xf'):_0x1e23b4[_0xbeee('0x1b')](_0x18016d+_0xbeee('0x75'));break;default:_0x2714be[_0xbeee('0x1b')]('\x22\x22');}}}}else{var _0x1fa1b6='';if(!_['isNil'](_0x50f5d2)){if(!_0x28caea[_0xbeee('0x76')](_0x50f5d2['id'])){for(var _0xaefa78=0x0;_0xaefa78<_0x2e954c[_0x18016d][_0xbeee('0x18')];_0xaefa78++){var _0x57e2fb=_[_0xbeee('0x6d')](_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x18016d][_0xaefa78]][_0xbeee('0x77')](/"/g,'\x27'));var _0x1221e6=phoneDescriptions[_0xbeee('0x6c')](_0x3e8fae=>_0x3e8fae[_0xbeee('0x78')]===_0x50f5d2['id']);if(!_['isNil'](_0x1221e6)){var _0x3b4380=_[_0xbeee('0x6d')](_0x5242c6[_0xbeee('0x6a')][_0x4457b4][_0x2e954c[_0x1221e6['description']][0x0]][_0xbeee('0x77')](/"/g,'\x27'));if(!_['isNil'](_0x3b4380))_0x57e2fb=_0x57e2fb+'§'+_0x3b4380;}if(_0x1fa1b6=='')_0x1fa1b6=_0x57e2fb;else _0x1fa1b6+='|'+_0x57e2fb;}_0x5c8322[_0xbeee('0x1b')](_0x50f5d2['id']+':'+_0x1fa1b6);_0x28caea[_0x50f5d2['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2714be['push']('\x22'+_0x5c8322[_0xbeee('0x11')](';')+'\x22');}if(_0x1e23b4[_0xbeee('0x18')]){handleError(_0x5242c6[_0xbeee('0x6a')][_0x4457b4],{'code':_0xbeee('0x79'),'message':_0x1e23b4[_0xbeee('0x11')]()});}else{fs[_0xbeee('0x7a')](_0x28f2f2,_0x2714be[_0xbeee('0x11')]()+'\x0a');}_0x2714be=[];}if(!(stats['rows']%0xc8)){socket[_0xbeee('0x7b')](_0xbeee('0x7c')+_0x3aba49,stats);stats[_0xbeee('0x58')]=[];}}if(stopped){logger[_0xbeee('0x56')](_0xbeee('0x7d'));_0x823520[_0xbeee('0x7e')]();}}catch(_0x41e111){handleError(_0x5242c6['data'][_0x4457b4],{'code':_0xbeee('0x7f'),'message':_0x41e111['message']});logger[_0xbeee('0x1f')](_0xbeee('0x80'),_0x41e111['message']);}},'complete':function(){try{var _0x6b8ce7=[];var _0x2cc52c=tempTableName;_0x6b8ce7[_0xbeee('0x1b')](_0xbeee('0x81')+_0x2cc52c+'\x20LIKE\x20cm_contacts;');logger[_0xbeee('0x56')](_0xbeee('0x82'),contactItemTypes[_0xbeee('0x18')]);var _0x4e7450=util[_0xbeee('0xb')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x28f2f2,_0x2cc52c,_0x2c2888,_0x5de4f5[_0xbeee('0x43')],_0x5de4f5[_0xbeee('0x51')]||null,NOW,NOW);if(_[_0xbeee('0x19')](_0x2e954c[_0xbeee('0x32')])){_0x4e7450+=_0xbeee('0x83');}_0x6b8ce7[_0xbeee('0x1b')](_0x4e7450);BPromise[_0xbeee('0x84')](_0x6b8ce7,handleQuery)['then'](function(_0x58288a){BPromise[_0xbeee('0x1c')]([handleAdditionalPhones()])[_0xbeee('0x1d')](function(){_0x6b8ce7=[];for(var _0x3bfceb=0x0;_0x3bfceb\x20\x20','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x63cc06,_0x6fe5d8){var _0x43a143=function(_0x41fe49){while(--_0x41fe49){_0x63cc06['push'](_0x63cc06['shift']());}};_0x43a143(++_0x6fe5d8);}(_0xdfb1,0x8c));var _0x1dfb=function(_0xe62b9f,_0x4be658){_0xe62b9f=_0xe62b9f-0x0;var _0x33a712=_0xdfb1[_0xe62b9f];return _0x33a712;};'use strict';var fs=require('fs');var path=require(_0x1dfb('0x0'));var _=require(_0x1dfb('0x1'));var Papa=require(_0x1dfb('0x2'));var util=require(_0x1dfb('0x3'));var BPromise=require('bluebird');var moment=require(_0x1dfb('0x4'));var squel=require(_0x1dfb('0x5'));var Redis=require(_0x1dfb('0x6'));var db=require(_0x1dfb('0x7'))['db'];var config=require('../../../config/environment');var logger=require('../../../config/logger')('import');config[_0x1dfb('0x8')]=_[_0x1dfb('0x9')](config[_0x1dfb('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0x1dfb('0xa'))(new Redis(config[_0x1dfb('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x1dfb('0xb')](_0x1dfb('0xc'));var tempTableName='cm_contacts_temp_'+moment()[_0x1dfb('0xb')](_0x1dfb('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x191d87){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'](_0x191d87);}function selectNotIn(_0xd747ac,_0x6a43eb,_0x449e56,_0x224c3c,_0x3a0366){return squel[_0x1dfb('0xe')]()[_0x1dfb('0xf')](_0x1dfb('0x10'))[_0x1dfb('0x11')](_0x224c3c)['join'](_0x6a43eb,null,_0x6a43eb+_0x1dfb('0x12')+_0x224c3c+'.'+_0x449e56)[_0x1dfb('0x13')](_0x224c3c+'.'+_0x449e56+'\x20=\x20'+_0xd747ac+'.'+_0x449e56)[_0x1dfb('0x13')](_0x6a43eb+_0x1dfb('0x14')+_0x3a0366[_0x1dfb('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4ea317,_0xd9413b){promisesAdditionalPhones=[];promisesContact=[];return db[_0x1dfb('0x16')][_0x1dfb('0x17')]('select\x20*\x20from\x20'+tempTableName)[_0x1dfb('0x18')](function(_0x2d4287){if(_0x2d4287!==null){var _0x425fa9=[];for(var _0x5535ad=0x0;_0x5535ad<_0x2d4287[_0x1dfb('0x19')];_0x5535ad++){var _0x2a146f=_0x2d4287[_0x5535ad];if(!_[_0x1dfb('0x1a')](_0x2a146f['phone'])){if(!_['isNil'](_0x2a146f[_0x1dfb('0x1b')]))_0x425fa9[_0x1dfb('0x1c')](insertAdditionalPhones(_0x2a146f));promisesContact[_0x1dfb('0x1c')]({'contact':_0x2a146f});}}}Promise[_0x1dfb('0x1d')](_0x425fa9)['then'](function(){_0x4ea317({'val':0x1});});})[_0x1dfb('0x1e')](function(_0x33f6e5){logger[_0x1dfb('0x1f')](_0x33f6e5[_0x1dfb('0x20')]);});});}function insertAdditionalPhones(_0x3fde47){return new Promise(function(_0x4dff46,_0x18ee9a){var _0x5c9f21=_0x3fde47['AdditionalPhones'];if(_['isNil'](_0x5c9f21))_0x18ee9a({'val':0x0});else{var _0x546c06=_0x5c9f21[_0x1dfb('0x21')](';');var _0x3cb51e=[];orderBy=0x0;for(var _0x5ab2f8=0x0;_0x5ab2f8<_0x546c06['length'];_0x5ab2f8++){_0x3cb51e['push'](splitAdditionalPhone(_0x3fde47['id'],_0x546c06[_0x5ab2f8]));}Promise[_0x1dfb('0x1d')](_0x3cb51e)[_0x1dfb('0x22')](function(){_0x4dff46({'val':_0x546c06[_0x1dfb('0x19')]});});}});}function splitAdditionalPhone(_0x1250c4,_0x128cc6){return new Promise(function(_0x55da8b,_0x136a7d){var _0x1162b3=_0x128cc6[_0x1dfb('0x21')](':');var _0x52601a=_0x1162b3[0x0];var _0x5111eb=_0x1162b3[0x1];if(_0x5111eb!==''){var _0x386911=_0x5111eb[_0x1dfb('0x21')]('|');var _0x4c9c81=[];for(var _0x520ac8=0x0;_0x520ac8<_0x386911['length'];_0x520ac8++){if(_0x386911[_0x520ac8]!==''){var _0x36bda8=_[_0x1dfb('0x23')](promisesAdditionalPhones,{'contactId':_0x1250c4,'phone':_0x386911[_0x520ac8]});if(_0x36bda8['length']==0x0){orderBy++;promisesAdditionalPhones[_0x1dfb('0x1c')]({'contactId':_0x1250c4,'contactTypeId':_0x52601a,'phone':_0x386911[_0x520ac8],'orderBy':orderBy});}}}_0x55da8b({'ok':0x1});}else _0x55da8b({'res':0x0});});}function createAdditionalPhone(_0x47be04,_0x47518e,_0x18d254,_0x51b2e9){var _0x1bc2c3='';var _0x417f71='';var _0x292c2d=_0x18d254['split']('§');_0x1bc2c3=_0x292c2d[0x0];if(_0x292c2d[_0x1dfb('0x19')]==0x2)_0x417f71=_0x292c2d[0x1];return new Promise(function(_0x82339a,_0x2dfa60){return db[_0x1dfb('0x24')][_0x1dfb('0x25')]({'where':{'CmContactId':_0x47be04,'item':_0x1bc2c3}})['then'](function(_0x2bcc56){if(_0x2bcc56){return db[_0x1dfb('0x24')]['update']({'ItemTypeId':_0x47518e,'description':_0x417f71,'OrderBy':_0x51b2e9},{'where':{'CmContactId':_0x47be04,'item':_0x1bc2c3}})[_0x1dfb('0x22')](function(_0x2572b7){_0x82339a({'res':'updated'});});}else{return db[_0x1dfb('0x24')][_0x1dfb('0x26')]({'CmContactId':_0x47be04,'item':_0x1bc2c3,'ItemTypeId':_0x47518e,'description':_0x417f71,'OrderBy':_0x51b2e9,'ItemClass':_0x1dfb('0x27')})[_0x1dfb('0x22')](function(_0xdcb715){_0x82339a({'res':_0x1dfb('0x28')});});}});});}function updateContact(_0x1960d0){return new Promise(function(_0x3c6252,_0x193cc8){var _0x8b1da8=_0x1960d0['id'];delete _0x1960d0['id'];return db['CmContact'][_0x1dfb('0x29')](_0x1960d0,{'where':{'id':_0x8b1da8}})[_0x1dfb('0x22')](function(_0x450cec){updatedRows+=0x1;return db['CmHopper'][_0x1dfb('0x29')]({'phone':_0x1960d0[_0x1dfb('0x10')]},{'where':{'ContactId':_0x8b1da8}})[_0x1dfb('0x22')](function(_0x5a614c){_0x3c6252({'ret':'OK'});});});});}function insertCmHopper(_0x4bb473,_0x3deb39,_0x34503c,_0x572423,_0x288254){var _0x2b95d0=[_0x1dfb('0x2a'),'cm_contacts.scheduledat',_0x1dfb('0x2b'),_0x1dfb('0x2c'),_0x3deb39+'.'+_0x572423,_0x1dfb('0x2d'),_0x1dfb('0x2e'),'cm_contacts.priority',_0x1dfb('0x2f'),'\x22'+_0x288254+'\x22'];return squel[_0x1dfb('0x30')]()['into']('cm_hopper')[_0x1dfb('0x31')](['phone',_0x1dfb('0x32'),'ContactId','ListId',_0x572423,_0x1dfb('0x33'),_0x1dfb('0x34'),_0x1dfb('0x35'),_0x1dfb('0x36'),_0x1dfb('0x37')],squel['select']()[_0x1dfb('0x38')](_0x2b95d0)[_0x1dfb('0x11')](_0x3deb39)[_0x1dfb('0x15')](_0x1dfb('0x39'),null,_0x1dfb('0x3a')+_0x3deb39+_0x1dfb('0x3b'))['join'](_0x34503c,null,_0x34503c+'.id\x20=\x20'+_0x3deb39+'.'+_0x572423)[_0x1dfb('0x13')](_0x3deb39+_0x1dfb('0x3c'),_0x4bb473)[_0x1dfb('0x13')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x1dfb('0x3d'),selectNotIn(_0x3deb39,_0x34503c,_0x572423,_0x1dfb('0x3e'),['\x22always\x22',_0x1dfb('0x3f')]))[_0x1dfb('0x13')](_0x1dfb('0x3d'),selectNotIn(_0x3deb39,_0x34503c,_0x572423,_0x1dfb('0x3e'),[_0x1dfb('0x40')])))[_0x1dfb('0x41')]();}function insertCmHopperBlack(_0x477b29,_0x49ed09,_0x42a010,_0x22345e){var _0x36ef53=[_0x1dfb('0x2a'),'cm_contacts.id','cm_contacts.ListId',_0x49ed09+'.'+_0x22345e,_0x1dfb('0x2d'),'cm_contacts.updatedAt'];return squel[_0x1dfb('0x30')]()[_0x1dfb('0x42')]('cm_hopper_black')[_0x1dfb('0x31')](['phone','ContactId','ListId',_0x22345e,_0x1dfb('0x33'),_0x1dfb('0x34')],squel[_0x1dfb('0xe')]()['fields'](_0x36ef53)['from'](_0x49ed09)['join'](_0x1dfb('0x39'),null,_0x1dfb('0x3a')+_0x49ed09+_0x1dfb('0x3b'))[_0x1dfb('0x15')](_0x42a010,null,_0x42a010+_0x1dfb('0x12')+_0x49ed09+'.'+_0x22345e)[_0x1dfb('0x13')](_0x49ed09+_0x1dfb('0x3c'),_0x477b29)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x1dfb('0x13')](_0x1dfb('0x3d'),squel[_0x1dfb('0xe')]()['field'](_0x1dfb('0x10'))[_0x1dfb('0x11')](_0x1dfb('0x43'))[_0x1dfb('0x13')](_0x1dfb('0x44'),_0x477b29)['where'](_0x22345e+_0x1dfb('0x45'),_0x49ed09+'.'+_0x22345e)))[_0x1dfb('0x41')]();}function insertCmHopperAdditionalPhones(_0x49acd1){var _0x370d5e=[_0x1dfb('0x46'),'cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x1dfb('0x47')];return squel[_0x1dfb('0x30')]()[_0x1dfb('0x42')](_0x1dfb('0x48'))[_0x1dfb('0x31')]([_0x1dfb('0x49'),_0x1dfb('0x10'),'OrderBy',_0x1dfb('0x33'),_0x1dfb('0x34')],squel[_0x1dfb('0xe')]()['fields'](_0x370d5e)[_0x1dfb('0x11')](_0x1dfb('0x3e'))['join'](_0x1dfb('0x39'),null,_0x1dfb('0x4a'))[_0x1dfb('0x15')](_0x1dfb('0x4b'),null,_0x1dfb('0x4c'))[_0x1dfb('0x13')](_0x1dfb('0x4d'),_0x49acd1)[_0x1dfb('0x13')](_0x1dfb('0x4e'),NOW))['toString']();}function insertCmContact(_0x193683,_0x39f405,_0x3f8e55,_0x556de4){var _0x380cc3=_[_0x1dfb('0x4f')](_[_0x1dfb('0x50')](_0x556de4),[_0x1dfb('0x51'),_0x1dfb('0x52'),'createdAt',_0x1dfb('0x34')]);return squel['insert']()['into']('cm_contacts')['fromQuery'](_0x380cc3,squel[_0x1dfb('0xe')]()[_0x1dfb('0x38')](_0x380cc3)[_0x1dfb('0x11')](_0x39f405)[_0x1dfb('0x13')]('('+_0x3f8e55[_0x1dfb('0x15')](',')+_0x1dfb('0x53'),squel[_0x1dfb('0xe')]()[_0x1dfb('0x38')](_0x3f8e55)[_0x1dfb('0x11')](_0x1dfb('0x39'))[_0x1dfb('0x13')]('ListId\x20=\x20?',_0x193683))[_0x1dfb('0x13')](_0x1dfb('0x54'),squel['select']()[_0x1dfb('0xf')](_0x1dfb('0x55'),_0x1dfb('0x56'))[_0x1dfb('0x11')](_0x39f405)[_0x1dfb('0x57')](_0x3f8e55[_0x1dfb('0x15')](','))))['toString']();}function handleStop(){logger['info'](_0x1dfb('0x58'));stopped=!![];}function handleUncaughtException(_0x1d397e){logger['error'](_0x1d397e[_0x1dfb('0x20')]);process['exit'](0x1);}function handleError(_0x3c16b2,_0x555c77){stats[_0x1dfb('0x59')][_0x1dfb('0x1c')]({'name':_0x555c77[_0x1dfb('0x5a')],'message':_0x555c77[_0x1dfb('0x20')],'row':_0x3c16b2});}function handleQuery(_0x452e18){logger[_0x1dfb('0x5b')](_0x452e18);return db[_0x1dfb('0x16')][_0x1dfb('0x17')](_0x452e18)['spread'](function(_0x14a384){results['push'](_0x14a384);})[_0x1dfb('0x1e')](function(_0x123e5e){logger[_0x1dfb('0x1f')](_0x123e5e['message']);});}function main(_0x545f5b,_0x240167,_0xabb993,_0x576c22){logger[_0x1dfb('0x5b')](_0x1dfb('0x5c'),_0x545f5b,JSON[_0x1dfb('0x5d')](_0x240167));process[_0x1dfb('0x5e')](_0x1dfb('0x5f'));var _0x1aea50=_0x240167[_0x1dfb('0x60')];var _0x293522=_['clone'](_0x1aea50);var _0x1d0c6c=_0x240167[_0x1dfb('0x61')];var _0x28176e=path[_0x1dfb('0x15')](config['root'],_0x1dfb('0x62'),_0x1d0c6c+_0x1dfb('0x63'));logger[_0x1dfb('0x5b')](_0x1dfb('0x64'),_0x240167);db[_0x1dfb('0x65')][_0x1dfb('0x66')]({'raw':!![],'attributes':['id','name']})[_0x1dfb('0x22')](function(_0x54356c){for(var _0x36ac8e=0x0;_0x36ac8e<_0x54356c[_0x1dfb('0x19')];_0x36ac8e++){if(_0x54356c[_0x36ac8e][_0x1dfb('0x67')]in _0x1aea50){contactItemTypes[_0x1dfb('0x1c')](_0x54356c[_0x36ac8e]);delete _0x293522[_0x54356c[_0x36ac8e][_0x1dfb('0x67')]];hasAdditionalPhones=!![];}for(var _0x5cb4bd in _0x1aea50){if(_0x54356c[_0x36ac8e]['name']+_0x1dfb('0x68')===_0x5cb4bd){phoneDescriptions['push']({'itemTypeId':_0x54356c[_0x36ac8e]['id'],'description':_0x5cb4bd});delete _0x293522[_0x5cb4bd];}}}if(hasAdditionalPhones)_0x293522[_0x1dfb('0x1b')]='';var _0x548b2c=_[_0x1dfb('0x50')](_0x293522)[_0x1dfb('0x15')]();logger[_0x1dfb('0x5b')]('header',_0x548b2c);fs[_0x1dfb('0x69')](_0x28176e,_0x548b2c+'\x0a');Papa[_0x1dfb('0x6a')](fs[_0x1dfb('0x6b')](_0x545f5b),{'header':!![],'skipEmptyLines':!![],'step':function(_0x160c35,_0x367404){try{for(var _0x135c42=0x0,_0x5488e1=[];_0x135c42<_0x160c35['data'][_0x1dfb('0x19')];_0x135c42++){stats[_0x1dfb('0x6c')]+=0x1;if(_0x160c35[_0x1dfb('0x59')][_0x135c42]){handleError(_0x160c35[_0x1dfb('0x6d')][_0x135c42],_0x160c35[_0x1dfb('0x59')][_0x135c42]);}else{var _0x1ed96c=[];var _0x482ead=[];var _0x498153={};for(var _0x31cfba in _0x1aea50){let _0x36c4da=contactItemTypes['find'](_0x97bd16=>_0x97bd16[_0x1dfb('0x67')]===_0x31cfba);let _0x3b975a=contactItemTypes[_0x1dfb('0x6e')](_0x2b92e5=>_0x2b92e5['name']+_0x1dfb('0x68')===_0x31cfba);if(_[_0x1dfb('0x1a')](_0x36c4da)&&_['isNil'](_0x3b975a)){if(_0x1aea50[_0x1dfb('0x6f')](_0x31cfba)){if(_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x31cfba]]){var _0x48dc86=_[_0x1dfb('0x70')](_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x31cfba]][_0x1dfb('0x71')](/"/g,'\x27'));switch(_0x31cfba){case _0x1dfb('0x32'):var _0x5408fc=moment(_0x48dc86,_0x1dfb('0xc'),!![]);if(_0x5408fc[_0x1dfb('0x72')]()){_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x48dc86+'\x22');}else{_0x1ed96c[_0x1dfb('0x1c')](_0x1dfb('0x73'));}break;case'priority':var _0x389fc6=parseInt(_0x48dc86);_0x48dc86=_['isNaN'](_0x389fc6)||_0x389fc6<0x0||_0x389fc6>0x4?_0x576c22?0x3:0x2:_0x389fc6;_0x5488e1['push']('\x22'+_0x48dc86+'\x22');break;case'UserId':var _0x991a8c=parseInt(_0x48dc86);if(_['isNumber'](_0x991a8c)&&_[_0x1dfb('0x74')](_0xabb993,_0x991a8c)){_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x991a8c+'\x22');}else{_0x1ed96c['push']('agent\x20not\x20exists');}break;case _0x1dfb('0x75'):if(isEmail(_0x48dc86)){_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x48dc86+'\x22');}else{_0x1ed96c[_0x1dfb('0x1c')](_0x1dfb('0x76'));}break;case'dateOfBirth':var _0x484a40=moment(_0x48dc86,'YYYY-MM-DD',!![]);if(_0x484a40[_0x1dfb('0x72')]()){_0x5488e1['push']('\x22'+_0x48dc86+'\x22');}else{_0x1ed96c[_0x1dfb('0x1c')](_0x1dfb('0x77'));}break;default:_0x5488e1[_0x1dfb('0x1c')]('\x22'+_0x48dc86+'\x22');}}else{switch(_0x31cfba){case _0x1dfb('0x78'):case _0x1dfb('0x10'):_0x1ed96c[_0x1dfb('0x1c')](_0x31cfba+_0x1dfb('0x79'));break;default:_0x5488e1[_0x1dfb('0x1c')]('\x22\x22');}}}}else{var _0x2fcf39='';if(!_[_0x1dfb('0x1a')](_0x36c4da)){if(!_0x498153[_0x1dfb('0x6f')](_0x36c4da['id'])){for(var _0x58c5db=0x0;_0x58c5db<_0x1aea50[_0x31cfba]['length'];_0x58c5db++){var _0x48dc86=_[_0x1dfb('0x70')](_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x31cfba][_0x58c5db]][_0x1dfb('0x71')](/"/g,'\x27'));var _0x28202c=phoneDescriptions['find'](_0x19564c=>_0x19564c[_0x1dfb('0x7a')]===_0x36c4da['id']);if(!_[_0x1dfb('0x1a')](_0x28202c)){var _0x2bae51=_['trim'](_0x160c35[_0x1dfb('0x6d')][_0x135c42][_0x1aea50[_0x28202c['description']][0x0]][_0x1dfb('0x71')](/"/g,'\x27'));if(!_['isNil'](_0x2bae51))_0x48dc86=_0x48dc86+'§'+_0x2bae51;}if(_0x2fcf39=='')_0x2fcf39=_0x48dc86;else _0x2fcf39+='|'+_0x48dc86;}_0x482ead[_0x1dfb('0x1c')](_0x36c4da['id']+':'+_0x2fcf39);_0x498153[_0x36c4da['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5488e1['push']('\x22'+_0x482ead['join'](';')+'\x22');}if(_0x1ed96c['length']){handleError(_0x160c35[_0x1dfb('0x6d')][_0x135c42],{'code':_0x1dfb('0x7b'),'message':_0x1ed96c[_0x1dfb('0x15')]()});}else{fs[_0x1dfb('0x7c')](_0x28176e,_0x5488e1[_0x1dfb('0x15')]()+'\x0a');}_0x5488e1=[];}if(!(stats['rows']%0xc8)){socket[_0x1dfb('0x7d')](_0x1dfb('0x7e')+_0x1d0c6c,stats);stats[_0x1dfb('0x59')]=[];}}if(stopped){logger['info'](_0x1dfb('0x7f'));_0x367404[_0x1dfb('0x80')]();}}catch(_0x1181a0){handleError(_0x160c35[_0x1dfb('0x6d')][_0x135c42],{'code':_0x1dfb('0x81'),'message':_0x1181a0[_0x1dfb('0x20')]});logger['error'](_0x1dfb('0x82'),_0x1181a0[_0x1dfb('0x20')]);}},'complete':function(){try{var _0x329ea0=[];var _0x32124a=tempTableName;_0x329ea0[_0x1dfb('0x1c')]('CREATE\x20TABLE\x20'+_0x32124a+_0x1dfb('0x83'));logger[_0x1dfb('0x5b')]('CIS\x20len',contactItemTypes[_0x1dfb('0x19')]);var _0x17af11=util[_0x1dfb('0xb')](_0x1dfb('0x84'),_0x28176e,_0x32124a,_0x548b2c,_0x240167['ListId'],_0x240167[_0x1dfb('0x52')]||null,NOW,NOW);if(_[_0x1dfb('0x1a')](_0x1aea50[_0x1dfb('0x32')])){_0x17af11+=_0x1dfb('0x85');}_0x329ea0[_0x1dfb('0x1c')](_0x17af11);BPromise[_0x1dfb('0x86')](_0x329ea0,handleQuery)['then'](function(_0x2f80a5){BPromise[_0x1dfb('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x329ea0=[];for(var _0x2cd97f=0x0;_0x2cd97f\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','Contact.email','c.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','toString','findOne','enableEmailPreview','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','QueryTypes','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','getAccountFK','role','agent','select','field','name','color','from','getInteractionFK','_interactions','u.id','ui.','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','getInteractionsTables','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','unreadMessages\x20{OPERATOR}\x200','{OPERATOR}','replace','i.id\x20LIKE\x20?','sms','whatsapp','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','c.email\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','default','text','start','value','end','unreadMessages','read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','map','tags','clause','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','some','compact','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','then','fields','tag','filter','get','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','SELECT','query','keyBy','merge','attributes','forEach','a.key','Account.key','a.mandatoryDisposition','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'];(function(_0x1676a8,_0x538b74){var _0x1cee50=function(_0x33cf95){while(--_0x33cf95){_0x1676a8['push'](_0x1676a8['shift']());}};_0x1cee50(++_0x538b74);}(_0x4227,0xcf));var _0x7422=function(_0x91e16e,_0x298e3f){_0x91e16e=_0x91e16e-0x0;var _0x36798f=_0x4227[_0x91e16e];return _0x36798f;};'use strict';var _=require(_0x7422('0x0'));var squel=require(_0x7422('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x7422('0x2'));var updateInteraction=require(_0x7422('0x3'))[_0x7422('0x4')];var utils=require(_0x7422('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x117ad2,_0x24e8cb,_0x46dcf0){var _0xa8a04c=![];var _0x400cda=utils[_0x7422('0x6')](_0x117ad2);if(_0x24e8cb[_0x7422('0x7')]===_0x7422('0x8')&&!_0x46dcf0['search']&&!_0x46dcf0[_0x400cda]){_0xa8a04c=!![];}return _0xa8a04c;}function getTagsQuery(){return squel[_0x7422('0x9')]()[_0x7422('0xa')]('id')[_0x7422('0xa')](_0x7422('0xb'))[_0x7422('0xa')](_0x7422('0xc'))[_0x7422('0xd')]('tools_tags');}function getUsersQuery(_0x118f28,_0x3a49a0){var _0x4b3ae0=utils[_0x7422('0xe')](_0x118f28);var _0x366f1='user_has_'+_0x118f28+_0x7422('0xf');var _0x24a0d1=squel[_0x7422('0x9')]()['field'](_0x7422('0x10'))['field']('u.fullname')[_0x7422('0xa')](_0x7422('0x11')+_0x4b3ae0)[_0x7422('0xd')](_0x366f1,'ui')[_0x7422('0x12')](_0x7422('0x13'),'u',_0x7422('0x14'));if(_0x3a49a0[_0x7422('0x15')]>0x0){_0x24a0d1[_0x7422('0x16')]('ui.'+_0x4b3ae0+_0x7422('0x17'),_['map'](_0x3a49a0,'id'));}return _0x24a0d1;}function getInteractionsQuery(_0x18d576){var _0x44b7cc=utils[_0x7422('0x18')](_0x18d576);var _0x4afce6=utils[_0x7422('0x6')](_0x18d576);var _0x30cbe4=utils[_0x7422('0xe')](_0x18d576);return squel[_0x7422('0x9')]()['from'](_0x44b7cc['interactions'],'i')[_0x7422('0x12')](_0x7422('0x19'),'c',_0x7422('0x1a'))[_0x7422('0x12')](_0x7422('0x13'),'o','o.id\x20=\x20i.UserId')[_0x7422('0x12')](_0x44b7cc[_0x7422('0x1b')],'a',_0x7422('0x1c')+_0x4afce6)[_0x7422('0x12')](_0x44b7cc[_0x7422('0x1d')],'me',_0x7422('0x1e')+_0x30cbe4+_0x7422('0x1f'))['left_join'](_0x44b7cc[_0x7422('0x20')],'it',_0x7422('0x21')+_0x30cbe4+_0x7422('0x1f'))['left_join'](_0x7422('0x22'),'t',_0x7422('0x23'));}function getSqlClauses(){var _0x5191b4={'body':squel[_0x7422('0x24')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x7422('0x24')](),'filter':squel['expr'](),'read':squel[_0x7422('0x24')](),'tags':{'clause':squel[_0x7422('0x24')](),'ids':null},'user':squel[_0x7422('0x24')]()};return _0x5191b4;}function parseTagParameter(_0x301e18){var _0x55e961=squel[_0x7422('0x24')]();if(_0x301e18){var _0x4fc550=utils[_0x7422('0x25')](_0x301e18);_0x4fc550['forEach'](function(_0x625ebe){_0x55e961['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x625ebe+',%');});}return _0x55e961;}function parseReadParameter(_0x4bc0d1){var _0x256d35='';if(_0x4bc0d1){_0x256d35=_0x7422('0x26');if(_0x4bc0d1==='1'){_0x256d35=_0x256d35['replace'](_0x7422('0x27'),'=');}else{_0x256d35=_0x256d35[_0x7422('0x28')](_0x7422('0x27'),'>');}}return _0x256d35;}function parseSearchFilter(_0x2ed16c,_0x556015){var _0x3396c3=squel[_0x7422('0x24')]();if(_0x556015){var _0x3c9243=_0x556015['replace']('\x5c','\x5c\x5c')[_0x7422('0x28')](/'/g,'\x27\x27');var _0x504399=qs['escapeLIKESpecialChars'](_0x3c9243);if(qs['isNumeric'](_0x3c9243)){_0x3396c3['or'](_0x7422('0x29'),_0x504399+'%');if([_0x7422('0x2a'),_0x7422('0x2b')][_0x7422('0x2c')](_0x2ed16c)){_0x3396c3['or'](_0x7422('0x2d'),_0x504399+'%');}else if(_0x2ed16c===_0x7422('0x2e')){_0x3396c3['or'](_0x7422('0x2f'),_0x504399+'%');}else if(_0x2ed16c===_0x7422('0x30')){_0x3396c3['or'](_0x7422('0x31'),_0x504399+'%');}}else if(_0x2ed16c==='mail'&&qs['isEmail'](_0x3c9243)){_0x3396c3['or'](_0x7422('0x32'),_0x504399+'%');}else{if(_0x2ed16c===_0x7422('0x33')){_0x3396c3['or'](_0x7422('0x34'),qs[_0x7422('0x35')](_0x3c9243,!![]))['or'](_0x7422('0x36'),qs[_0x7422('0x35')](_0x3c9243));}else if(_0x2ed16c!=='fax'){_0x3396c3['or'](_0x7422('0x37'),qs['getFullTextValue'](_0x3c9243));}_0x3396c3['or'](_0x7422('0x38'),qs[_0x7422('0x35')](_0x3c9243,!![]),null);}}return _0x3396c3;}function parseAdvancedSearchFilter(_0x235243,_0x4132d8){var _0x195563=getSqlClauses();var _0x18e224=as[_0x7422('0x39')](_0x235243);var _0x5ee799=_0x18e224['sqlOperator'];for(var _0x3ef693=0x0;_0x3ef693<_0x18e224[_0x7422('0x3a')][_0x7422('0x15')];_0x3ef693++){var _0x387755=_0x18e224['conditions'][_0x3ef693];var _0x23e5a8='i';var _0x39c218=_[_0x7422('0x3b')](_0x4132d8,[_0x7422('0xb'),_0x387755[_0x7422('0xa')]]);if(_0x39c218){var _0xa14089=as[_0x7422('0x3c')](_0x23e5a8,_0x39c218[_0x7422('0x3d')],_0x387755);_0x195563[_0x7422('0x3e')][_0x5ee799](_0xa14089[_0x7422('0x3f')],_0xa14089['value'][_0x7422('0x40')],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);}else{switch(_0x387755['field']){case _0x7422('0x43'):var _0x18d78d=parseReadParameter(_0x387755[_0x7422('0x41')]);_0x195563[_0x7422('0x44')][_0x7422('0x45')](_0x18d78d);break;case _0x7422('0x46'):if(_0x387755[_0x7422('0x47')]===_0x7422('0x48')){if(_0x387755[_0x7422('0x41')][_0x7422('0x49')]('\x20')[_0x7422('0x15')]>0x1){_0x195563[_0x7422('0x4a')][_0x5ee799](_0x7422('0x38'),qs[_0x7422('0x35')](_0x387755[_0x7422('0x41')],!![]),null);}else{var _0x514d13='%'+_0x387755[_0x7422('0x41')]+'%';_0x195563[_0x7422('0x4a')][_0x5ee799](_0x7422('0x4b'),_0x514d13,_0x514d13,_0x514d13);}}else{_0x39c218=_[_0x7422('0x3b')](_0x4132d8,[_0x7422('0xb'),_0x7422('0x4c')]);_0x387755[_0x7422('0xa')]=_0x7422('0x4c');_0xa14089=as[_0x7422('0x3c')](_0x23e5a8,_0x39c218['type'],_0x387755);_0x195563[_0x7422('0x4a')][_0x5ee799](_0xa14089[_0x7422('0x3f')],_0xa14089[_0x7422('0x41')]['start'],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);}break;case _0x7422('0x4d'):var _0x3d7831=_0x387755[_0x7422('0x41')][_0x7422('0x49')](',')[_0x7422('0x4e')](function(_0x3f4fe4){return Number(_0x3f4fe4);});var _0x59d828=parseTagParameter(_0x3d7831);_0x195563[_0x7422('0x4f')][_0x7422('0x50')][_0x7422('0x45')](_0x59d828);_0x195563[_0x7422('0x4f')][_0x7422('0x51')]=_0x3d7831;break;case'User':if(_0x387755[_0x7422('0x47')]===_0x7422('0x48')){_0x195563['user'][_0x5ee799](_0x7422('0x52'),'%'+_0x387755[_0x7422('0x41')]+'%',null);}else{_0x39c218=_[_0x7422('0x3b')](_0x4132d8,[_0x7422('0xb'),_0x7422('0x53')]);_0x387755[_0x7422('0xa')]=_0x7422('0x53');_0xa14089=as[_0x7422('0x3c')](_0x23e5a8,_0x39c218['type'],_0x387755);_0x195563['user'][_0x5ee799](_0xa14089[_0x7422('0x3f')],_0xa14089[_0x7422('0x41')]['start'],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);}break;case _0x7422('0x54'):case'plainBody':_0xa14089=as[_0x7422('0x3c')]('me',null,_0x387755);_0x195563[_0x7422('0x54')][_0x5ee799](_0xa14089['text'],_0xa14089[_0x7422('0x41')][_0x7422('0x40')],_0xa14089[_0x7422('0x41')][_0x7422('0x42')]);break;}}}return _0x195563;}function parseModelFields(_0x4d16fb,_0x5045cb,_0x54e6d0){var _0x38d7da=utils[_0x7422('0x6')](_0x4d16fb);var _0x160b1c=squel[_0x7422('0x24')]();var _0x349697=_(_0x5045cb)['keys']()['map'](function(_0x50a016){return _[_0x7422('0x55')](_0x54e6d0,[_0x7422('0xb'),_0x50a016])?_0x50a016:undefined;})[_0x7422('0x56')]()[_0x7422('0x41')]();if(_0x349697['length']>0x0){_0x349697['forEach'](function(_0x5af035){if(_0x5af035===_0x38d7da){_0x160b1c[_0x7422('0x45')]('i.'+_0x38d7da+_0x7422('0x17'),[][_0x7422('0x57')](_0x5045cb[_0x5af035]));}else if(_0x5af035===_0x7422('0x58')){var _0x41f7c3=JSON[_0x7422('0x59')](_0x5045cb[_0x5af035])[_0x7422('0x5a')];var _0x2df829=JSON['parse'](_0x5045cb[_0x5af035])[_0x7422('0x5b')];_0x160b1c[_0x7422('0x45')](_0x7422('0x5c'),_0x41f7c3,_0x2df829);}else{if(_0x5045cb[_0x5af035]===_0x7422('0x5d')){_0x160b1c[_0x7422('0x45')]('i.'+_0x5af035+'\x20IS\x20NULL');}else{_0x160b1c[_0x7422('0x45')]('i.'+_0x5af035+_0x7422('0x5e'),_0x5045cb[_0x5af035]);}}});}return _0x160b1c;}function parseQueryParameters(_0x44c337,_0x5ca4fe,_0x1f7ab6){var _0x30b39e=getSqlClauses();return Promise['resolve']()['then'](function(){return parseModelFields(_0x44c337,_0x5ca4fe,_0x1f7ab6);})[_0x7422('0x5f')](function(_0xc8f201){_0x30b39e[_0x7422('0x60')][_0x7422('0x45')](_0xc8f201);return parseReadParameter(_0x5ca4fe[_0x7422('0x44')]);})[_0x7422('0x5f')](function(_0x18915a){_0x30b39e[_0x7422('0x44')][_0x7422('0x45')](_0x18915a);return parseTagParameter(_0x5ca4fe[_0x7422('0x61')]);})[_0x7422('0x5f')](function(_0x3b55e0){_0x30b39e[_0x7422('0x4f')][_0x7422('0x50')][_0x7422('0x45')](_0x3b55e0);return parseSearchFilter(_0x44c337,_0x5ca4fe[_0x7422('0x62')]);})[_0x7422('0x5f')](function(_0x90292c){_0x30b39e[_0x7422('0x62')]=_0x90292c;return _0x30b39e;});}function checkAccountsRestrictions(_0x3f7b26,_0x9427f2,_0x185e50){var _0x5d1c77=utils['getAccountFK'](_0x3f7b26);var _0x1525ed=_0x7422('0x63')+_[_0x7422('0x64')](_0x3f7b26)+(_0x3f7b26===_0x7422('0x65')?_0x7422('0x66'):_0x7422('0x67'));var _0x437341=squel[_0x7422('0x24')]();return Promise['resolve']()['then'](function(){if(_0x185e50[_0x7422('0x68')]&&_0x9427f2[_0x7422('0x7')]==='agent'){return _0x9427f2[_0x1525ed]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x1b9ba9){if(_0x1b9ba9){if(_0x1b9ba9['length']===0x0){_0x437341[_0x7422('0x45')]('i.'+_0x5d1c77+'\x20IS\x20NULL');}else{_0x437341[_0x7422('0x45')]('i.'+_0x5d1c77+_0x7422('0x17'),_[_0x7422('0x4e')](_0x1b9ba9,'id'));}}else if(!_0x185e50[_0x5d1c77]){_0x437341['and']('i.'+_0x5d1c77+_0x7422('0x69'));}})['then'](function(){return _0x437341;});}function getClosedOrderClause(_0x3d4c03,_0x5ecd2f){var _0x1a8885='';var _0x54a4fd=[_0x7422('0x6a'),_0x7422('0x6b'),_0x7422('0x6c')];if(_0x3d4c03===_0x7422('0x33')){_0x54a4fd['unshift']('i.substatus');}if(_0x5ecd2f['closed']==='0'&&_0x3d4c03===_0x7422('0x33')){_0x1a8885=_0x7422('0x6d');}else{if(_0x5ecd2f[_0x7422('0x6e')]==='1'){_0x54a4fd[_0x7422('0x6f')]();}_0x1a8885=_0x7422('0x70')+_0x54a4fd[_0x7422('0x71')](',\x20')+')';}return _0x1a8885;}function getFilteredInteractions(_0x6c40ed,_0x5343d9,_0x31f29e,_0x2f8eb5){var _0x38ab52=utils['getInteractionFK'](_0x6c40ed);var _0x971606=_[_0x7422('0x64')](_0x6c40ed)+_0x7422('0x72');var _0x262d0e=[];var _0x312476=getTagsQuery();var _0x3f6c9e={'type':db[_0x7422('0x73')]['QueryTypes'][_0x7422('0x74')],'raw':!![]};var _0x1ebc0e=[];var _0xfcb4f5=[];return db['sequelize'][_0x7422('0x75')](_0x312476['toString'](),_0x3f6c9e)[_0x7422('0x5f')](function(_0x28532c){_0x262d0e=_[_0x7422('0x76')](_0x28532c,'id');_0x3f6c9e=_[_0x7422('0x77')](_0x3f6c9e,{'model':db[_0x971606],'mapToModel':!![],'nest':!![]});if(_0x31f29e[_0x7422('0x60')]){_0x2f8eb5[_0x7422('0x78')][_0x7422('0x79')](function(_0x224afd){_0x5343d9[_0x7422('0xa')]('i.'+_0x224afd);});}else{_0x5343d9['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5343d9[_0x7422('0xa')](_0x7422('0x7a'),_0x7422('0x7b'));_0x5343d9['field'](_0x7422('0x7c'),_0x7422('0x7d'));if(_0x6c40ed===_0x7422('0x33')){_0x5343d9[_0x7422('0xa')](_0x7422('0x7e'),'Account.email');_0x5343d9[_0x7422('0xa')](_0x7422('0x7f'),_0x7422('0x80'));_0x5343d9[_0x7422('0xa')](_0x7422('0x81'));_0x5343d9[_0x7422('0xa')](_0x7422('0x82'));_0x5343d9[_0x7422('0xa')](_0x7422('0x83'));_0x5343d9[_0x7422('0xa')](_0x7422('0x84'));_0x5343d9[_0x7422('0xa')](_0x7422('0x85'));_0x5343d9[_0x7422('0xa')](_0x7422('0x86'));_0x5343d9['field'](_0x7422('0x87'));_0x5343d9[_0x7422('0xa')](_0x7422('0x88'));_0x5343d9['field'](_0x7422('0x89'));_0x5343d9[_0x7422('0xa')](_0x7422('0x6c'));_0x5343d9[_0x7422('0xa')]('i.secondDisposition');_0x5343d9[_0x7422('0xa')](_0x7422('0x6a'));_0x5343d9[_0x7422('0xa')](_0x7422('0x6d'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8a'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8b'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8c'));_0x5343d9[_0x7422('0xa')](_0x7422('0x8d'));}else if(_0x6c40ed===_0x7422('0x30')){_0x5343d9[_0x7422('0xa')](_0x7422('0x8e'),_0x7422('0x80'));}else{_0x5343d9[_0x7422('0xa')](_0x7422('0x8f'),_0x7422('0x80'));}if(_0x6c40ed!==_0x7422('0x33')){_0x5343d9['field'](_0x7422('0x90'));}_0x5343d9['field'](_0x7422('0x91'),_0x7422('0x92'));_0x5343d9[_0x7422('0xa')](_0x7422('0x93'),'Contact.lastName');_0x5343d9[_0x7422('0xa')](_0x7422('0x94'),_0x7422('0x95'));_0x5343d9[_0x7422('0xa')]('c.phone','Contact.phone');_0x5343d9[_0x7422('0xa')](_0x7422('0x96'),'Contact.mobile');_0x5343d9[_0x7422('0xa')](_0x7422('0x97'),'Contact.fax');_0x5343d9[_0x7422('0xa')](_0x7422('0x98'),_0x7422('0x99'));_0x5343d9[_0x7422('0xa')]('o.internal',_0x7422('0x9a'));_0x5343d9[_0x7422('0xa')](_0x7422('0x9b'),_0x7422('0x9c'));}if(_0x2f8eb5[_0x7422('0x9d')]){_0x5343d9['limit'](_0x2f8eb5[_0x7422('0x9d')]);}if(_0x2f8eb5[_0x7422('0x9e')]){_0x5343d9[_0x7422('0x9e')](_0x2f8eb5[_0x7422('0x9e')]);}return db[_0x7422('0x9f')][_0x7422('0x75')](_0x5343d9[_0x7422('0xa0')](),_0x3f6c9e);})[_0x7422('0x5f')](function(_0x2b7d28){_0x1ebc0e=_0x2b7d28;var _0x5cffc9=getUsersQuery(_0x6c40ed,_0x1ebc0e);return db['sequelize'][_0x7422('0x75')](_0x5cffc9['toString'](),_0x3f6c9e);})[_0x7422('0x5f')](function(_0x237283){_0xfcb4f5=_['groupBy'](_0x237283,_0x38ab52);if(_0x6c40ed==='mail'){return db['Setting'][_0x7422('0xa1')]({'attributes':[_0x7422('0xa2')],'raw':!![]});}})[_0x7422('0x5f')](function(_0x42bcb2){var _0x1f7adc=_0x42bcb2?_0x42bcb2[_0x7422('0xa2')]:undefined;var _0x1d1e72=_0x1ebc0e['map'](function(_0x12bd72){return updateInteraction(_0x12bd72,_0x262d0e,_0xfcb4f5,_0x1f7adc);});return Promise['all'](_0x1d1e72);});}function countFilteredInteractions(_0x5704e4,_0x52c2f1){var _0x56f82e=_0x5704e4['clone']();_0x56f82e['field'](_0x7422('0xa3'));_0x56f82e['field'](_0x7422('0xa4'),'unreadMessages');var _0x3dca07=utils[_0x7422('0x25')](_0x52c2f1);if(!_[_0x7422('0xa5')](_0x3dca07)){_0x56f82e[_0x7422('0x16')](_0x7422('0xa6'),_0x3dca07);}var _0x5c915d={'type':db[_0x7422('0x73')][_0x7422('0xa7')]['SELECT'],'raw':!![]};return db[_0x7422('0x9f')][_0x7422('0x75')](_0x56f82e[_0x7422('0xa0')](),_0x5c915d);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x02e6=['i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','i.MailAccountId','i.UserId','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','toString','groupBy','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','tools_tags','u.id','u.fullname','ui.','from','left_join','users','u.id\x20=\x20ui.UserId','length','where','\x20IN\x20?','map','getInteractionFK','interactions','o.id\x20=\x20i.UserId','messages','me.','\x20=\x20i.id','interactionsTags','it.','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','escapeLIKESpecialChars','isNumeric','sms','includes','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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)','parseSearch','conditions','find','buildExpression','type','text','value','end','unreadMessages','read','and','Contact','split','contact','ContactId','start','Tag','tags','ids','user','body','plainBody','some','compact','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','resolve','then','fields','tag','clause','filter','capitalize','chat','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','shift','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','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'];(function(_0x171a62,_0x303a59){var _0x13e4c1=function(_0x433474){while(--_0x433474){_0x171a62['push'](_0x171a62['shift']());}};_0x13e4c1(++_0x303a59);}(_0x02e6,0x180));var _0x602e=function(_0x20a714,_0x5ee64a){_0x20a714=_0x20a714-0x0;var _0x3b3f8c=_0x02e6[_0x20a714];return _0x3b3f8c;};'use strict';var _=require(_0x602e('0x0'));var squel=require(_0x602e('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x602e('0x2'));var updateInteraction=require(_0x602e('0x3'))[_0x602e('0x4')];var utils=require(_0x602e('0x5'));var db=require(_0x602e('0x6'))['db'];function skipInteractionsQuery(_0x30119f,_0xfeccc1,_0x542b5d){var _0x510764=![];var _0x3a6f31=utils[_0x602e('0x7')](_0x30119f);if(_0xfeccc1['role']===_0x602e('0x8')&&!_0x542b5d[_0x602e('0x9')]&&!_0x542b5d[_0x3a6f31]){_0x510764=!![];}return _0x510764;}function getTagsQuery(){return squel[_0x602e('0xa')]()['field']('id')[_0x602e('0xb')](_0x602e('0xc'))[_0x602e('0xb')](_0x602e('0xd'))['from'](_0x602e('0xe'));}function getUsersQuery(_0x5b4e52,_0x11e1d2){var _0x15736f=utils['getInteractionFK'](_0x5b4e52);var _0x20d728='user_has_'+_0x5b4e52+'_interactions';var _0x515e48=squel[_0x602e('0xa')]()[_0x602e('0xb')](_0x602e('0xf'))['field'](_0x602e('0x10'))['field'](_0x602e('0x11')+_0x15736f)[_0x602e('0x12')](_0x20d728,'ui')[_0x602e('0x13')](_0x602e('0x14'),'u',_0x602e('0x15'));if(_0x11e1d2[_0x602e('0x16')]>0x0){_0x515e48[_0x602e('0x17')](_0x602e('0x11')+_0x15736f+_0x602e('0x18'),_[_0x602e('0x19')](_0x11e1d2,'id'));}return _0x515e48;}function getInteractionsQuery(_0xfb7bc0){var _0x1745ff=utils['getInteractionsTables'](_0xfb7bc0);var _0x1119a9=utils[_0x602e('0x7')](_0xfb7bc0);var _0x5572fc=utils[_0x602e('0x1a')](_0xfb7bc0);return squel[_0x602e('0xa')]()[_0x602e('0x12')](_0x1745ff[_0x602e('0x1b')],'i')[_0x602e('0x13')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x602e('0x13')]('users','o',_0x602e('0x1c'))[_0x602e('0x13')](_0x1745ff['accounts'],'a','a.id\x20=\x20i.'+_0x1119a9)[_0x602e('0x13')](_0x1745ff[_0x602e('0x1d')],'me',_0x602e('0x1e')+_0x5572fc+_0x602e('0x1f'))[_0x602e('0x13')](_0x1745ff[_0x602e('0x20')],'it',_0x602e('0x21')+_0x5572fc+'\x20=\x20i.id')[_0x602e('0x13')](_0x602e('0xe'),'t',_0x602e('0x22'));}function getSqlClauses(){var _0xf4d8a1={'body':squel[_0x602e('0x23')](),'contact':squel['expr'](),'default':squel['expr'](),'fields':squel[_0x602e('0x23')](),'filter':squel[_0x602e('0x23')](),'read':squel['expr'](),'tags':{'clause':squel['expr'](),'ids':null},'user':squel[_0x602e('0x23')]()};return _0xf4d8a1;}function parseTagParameter(_0x1682a5){var _0x2b48c0=squel[_0x602e('0x23')]();if(_0x1682a5){var _0x33793f=utils[_0x602e('0x24')](_0x1682a5);_0x33793f[_0x602e('0x25')](function(_0x4a6b5f){_0x2b48c0['or'](_0x602e('0x26'),'%,'+_0x4a6b5f+',%');});}return _0x2b48c0;}function parseReadParameter(_0x5686b4){var _0x4795b1='';if(_0x5686b4){_0x4795b1='unreadMessages\x20{OPERATOR}\x200';if(_0x5686b4==='1'){_0x4795b1=_0x4795b1[_0x602e('0x27')](_0x602e('0x28'),'=');}else{_0x4795b1=_0x4795b1[_0x602e('0x27')](_0x602e('0x28'),'>');}}return _0x4795b1;}function parseSearchFilter(_0x3a6605,_0x19bb1a){var _0x44f4a8=squel['expr']();if(_0x19bb1a){var _0x55db33=_0x19bb1a[_0x602e('0x27')]('\x5c','\x5c\x5c')[_0x602e('0x27')](/'/g,'\x27\x27');var _0x5452d8=qs[_0x602e('0x29')](_0x55db33);if(qs[_0x602e('0x2a')](_0x55db33)){_0x44f4a8['or']('i.id\x20LIKE\x20?',_0x5452d8+'%');if([_0x602e('0x2b'),'whatsapp'][_0x602e('0x2c')](_0x3a6605)){_0x44f4a8['or'](_0x602e('0x2d'),_0x5452d8+'%');}else if(_0x3a6605===_0x602e('0x2e')){_0x44f4a8['or'](_0x602e('0x2f'),_0x5452d8+'%');}else if(_0x3a6605===_0x602e('0x30')){_0x44f4a8['or'](_0x602e('0x31'),_0x5452d8+'%');}}else if(_0x3a6605===_0x602e('0x32')&&qs[_0x602e('0x33')](_0x55db33)){_0x44f4a8['or'](_0x602e('0x34'),_0x5452d8+'%');}else{if(_0x3a6605===_0x602e('0x32')){_0x44f4a8['or'](_0x602e('0x35'),qs[_0x602e('0x36')](_0x55db33,!![]))['or'](_0x602e('0x37'),qs['getFullTextValue'](_0x55db33));}else if(_0x3a6605!==_0x602e('0x2e')){_0x44f4a8['or'](_0x602e('0x38'),qs[_0x602e('0x36')](_0x55db33));}_0x44f4a8['or'](_0x602e('0x39'),qs[_0x602e('0x36')](_0x55db33,!![]),null);}}return _0x44f4a8;}function parseAdvancedSearchFilter(_0xc207a0,_0x35bb3e){var _0x13e2bc=getSqlClauses();var _0x513ba8=as[_0x602e('0x3a')](_0xc207a0);var _0x30e6e7=_0x513ba8['sqlOperator'];for(var _0x4516bd=0x0;_0x4516bd<_0x513ba8['conditions'][_0x602e('0x16')];_0x4516bd++){var _0x2a30eb=_0x513ba8[_0x602e('0x3b')][_0x4516bd];var _0x1e1219='i';var _0x1d4584=_[_0x602e('0x3c')](_0x35bb3e,[_0x602e('0xc'),_0x2a30eb[_0x602e('0xb')]]);if(_0x1d4584){var _0x363d47=as[_0x602e('0x3d')](_0x1e1219,_0x1d4584[_0x602e('0x3e')],_0x2a30eb);_0x13e2bc['default'][_0x30e6e7](_0x363d47[_0x602e('0x3f')],_0x363d47['value']['start'],_0x363d47[_0x602e('0x40')][_0x602e('0x41')]);}else{switch(_0x2a30eb[_0x602e('0xb')]){case _0x602e('0x42'):var _0x19ddc1=parseReadParameter(_0x2a30eb['value']);_0x13e2bc[_0x602e('0x43')][_0x602e('0x44')](_0x19ddc1);break;case _0x602e('0x45'):if(_0x2a30eb['operator']==='$substring'){if(_0x2a30eb[_0x602e('0x40')][_0x602e('0x46')]('\x20')[_0x602e('0x16')]>0x1){_0x13e2bc[_0x602e('0x47')][_0x30e6e7](_0x602e('0x39'),qs[_0x602e('0x36')](_0x2a30eb[_0x602e('0x40')],!![]),null);}else{var _0x5deeb4='%'+_0x2a30eb[_0x602e('0x40')]+'%';_0x13e2bc[_0x602e('0x47')][_0x30e6e7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x5deeb4,_0x5deeb4,_0x5deeb4);}}else{_0x1d4584=_['find'](_0x35bb3e,[_0x602e('0xc'),_0x602e('0x48')]);_0x2a30eb[_0x602e('0xb')]=_0x602e('0x48');_0x363d47=as[_0x602e('0x3d')](_0x1e1219,_0x1d4584[_0x602e('0x3e')],_0x2a30eb);_0x13e2bc[_0x602e('0x47')][_0x30e6e7](_0x363d47['text'],_0x363d47[_0x602e('0x40')][_0x602e('0x49')],_0x363d47[_0x602e('0x40')]['end']);}break;case _0x602e('0x4a'):var _0x59e454=_0x2a30eb['value'][_0x602e('0x46')](',')[_0x602e('0x19')](function(_0x26dda2){return Number(_0x26dda2);});var _0x5bee32=parseTagParameter(_0x59e454);_0x13e2bc[_0x602e('0x4b')]['clause'][_0x602e('0x44')](_0x5bee32);_0x13e2bc['tags'][_0x602e('0x4c')]=_0x59e454;break;case'User':if(_0x2a30eb['operator']==='$substring'){_0x13e2bc[_0x602e('0x4d')][_0x30e6e7]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','%'+_0x2a30eb[_0x602e('0x40')]+'%',null);}else{_0x1d4584=_[_0x602e('0x3c')](_0x35bb3e,['name','UserId']);_0x2a30eb[_0x602e('0xb')]='UserId';_0x363d47=as['buildExpression'](_0x1e1219,_0x1d4584[_0x602e('0x3e')],_0x2a30eb);_0x13e2bc[_0x602e('0x4d')][_0x30e6e7](_0x363d47[_0x602e('0x3f')],_0x363d47[_0x602e('0x40')][_0x602e('0x49')],_0x363d47[_0x602e('0x40')][_0x602e('0x41')]);}break;case _0x602e('0x4e'):case _0x602e('0x4f'):_0x363d47=as[_0x602e('0x3d')]('me',null,_0x2a30eb);_0x13e2bc[_0x602e('0x4e')][_0x30e6e7](_0x363d47['text'],_0x363d47[_0x602e('0x40')][_0x602e('0x49')],_0x363d47[_0x602e('0x40')][_0x602e('0x41')]);break;}}}return _0x13e2bc;}function parseModelFields(_0x2bee95,_0x3cb9b6,_0x56c6ae){var _0x353fea=utils[_0x602e('0x7')](_0x2bee95);var _0x371e99=squel[_0x602e('0x23')]();var _0x26b5e7=_(_0x3cb9b6)['keys']()['map'](function(_0x634bd4){return _[_0x602e('0x50')](_0x56c6ae,[_0x602e('0xc'),_0x634bd4])?_0x634bd4:undefined;})[_0x602e('0x51')]()['value']();if(_0x26b5e7[_0x602e('0x16')]>0x0){_0x26b5e7[_0x602e('0x25')](function(_0x2ad69c){if(_0x2ad69c===_0x353fea){_0x371e99['and']('i.'+_0x353fea+_0x602e('0x18'),[]['concat'](_0x3cb9b6[_0x2ad69c]));}else if(_0x2ad69c===_0x602e('0x52')){var _0x59a69e=JSON[_0x602e('0x53')](_0x3cb9b6[_0x2ad69c])[_0x602e('0x54')];var _0x3aad20=JSON['parse'](_0x3cb9b6[_0x2ad69c])['$lte'];_0x371e99[_0x602e('0x44')](_0x602e('0x55'),_0x59a69e,_0x3aad20);}else{if(_0x3cb9b6[_0x2ad69c]===_0x602e('0x56')){_0x371e99['and']('i.'+_0x2ad69c+'\x20IS\x20NULL');}else{_0x371e99[_0x602e('0x44')]('i.'+_0x2ad69c+_0x602e('0x57'),_0x3cb9b6[_0x2ad69c]);}}});}return _0x371e99;}function parseQueryParameters(_0x5eba6b,_0x4aadd2,_0x3c97fd){var _0x638ffb=getSqlClauses();return Promise[_0x602e('0x58')]()['then'](function(){return parseModelFields(_0x5eba6b,_0x4aadd2,_0x3c97fd);})[_0x602e('0x59')](function(_0x960032){_0x638ffb[_0x602e('0x5a')]['and'](_0x960032);return parseReadParameter(_0x4aadd2[_0x602e('0x43')]);})[_0x602e('0x59')](function(_0x59e954){_0x638ffb[_0x602e('0x43')][_0x602e('0x44')](_0x59e954);return parseTagParameter(_0x4aadd2[_0x602e('0x5b')]);})[_0x602e('0x59')](function(_0x50c511){_0x638ffb['tags'][_0x602e('0x5c')][_0x602e('0x44')](_0x50c511);return parseSearchFilter(_0x5eba6b,_0x4aadd2[_0x602e('0x5d')]);})[_0x602e('0x59')](function(_0x562c99){_0x638ffb[_0x602e('0x5d')]=_0x562c99;return _0x638ffb;});}function checkAccountsRestrictions(_0x527224,_0x3bc72b,_0x20c9b3){var _0x12ec74=utils[_0x602e('0x7')](_0x527224);var _0x55d7e2='get'+_[_0x602e('0x5e')](_0x527224)+(_0x527224===_0x602e('0x5f')?_0x602e('0x60'):_0x602e('0x61'));var _0x33ed84=squel[_0x602e('0x23')]();return Promise[_0x602e('0x58')]()[_0x602e('0x59')](function(){if(_0x20c9b3[_0x602e('0x9')]&&_0x3bc72b[_0x602e('0x62')]===_0x602e('0x8')){return _0x3bc72b[_0x55d7e2]({'attributes':['id'],'raw':!![]});}})[_0x602e('0x59')](function(_0x483b76){if(_0x483b76){if(_0x483b76[_0x602e('0x16')]===0x0){_0x33ed84['and']('i.'+_0x12ec74+'\x20IS\x20NULL');}else{_0x33ed84[_0x602e('0x44')]('i.'+_0x12ec74+_0x602e('0x18'),_[_0x602e('0x19')](_0x483b76,'id'));}}else if(!_0x20c9b3[_0x12ec74]){_0x33ed84[_0x602e('0x44')]('i.'+_0x12ec74+_0x602e('0x63'));}})[_0x602e('0x59')](function(){return _0x33ed84;});}function getClosedOrderClause(_0x226a3e,_0xfe67bc){var _0x287fa5='';var _0xa8c307=[_0x602e('0x64'),_0x602e('0x65'),_0x602e('0x66')];if(_0x226a3e==='mail'){_0xa8c307[_0x602e('0x67')](_0x602e('0x68'));}if(_0xfe67bc[_0x602e('0x69')]==='0'&&_0x226a3e===_0x602e('0x32')){_0x287fa5=_0x602e('0x68');}else{if(_0xfe67bc[_0x602e('0x69')]==='1'){_0xa8c307[_0x602e('0x6a')]();}_0x287fa5=_0x602e('0x6b')+_0xa8c307[_0x602e('0x6c')](',\x20')+')';}return _0x287fa5;}function getFilteredInteractions(_0x358573,_0x5c1541,_0x24249a,_0x3691f0){var _0x5e6a81=utils[_0x602e('0x1a')](_0x358573);var _0xc400b2=_[_0x602e('0x5e')](_0x358573)+_0x602e('0x6d');var _0x3a3f8a=[];var _0x14bea6=getTagsQuery();var _0x10149c={'type':db[_0x602e('0x6e')][_0x602e('0x6f')][_0x602e('0x70')],'raw':!![]};var _0x5012e8=[];var _0x444d3c=[];return db[_0x602e('0x71')][_0x602e('0x72')](_0x14bea6['toString'](),_0x10149c)['then'](function(_0x2177f3){_0x3a3f8a=_[_0x602e('0x73')](_0x2177f3,'id');_0x10149c=_[_0x602e('0x74')](_0x10149c,{'model':db[_0xc400b2],'mapToModel':!![],'nest':!![]});if(_0x24249a[_0x602e('0x5a')]){_0x3691f0[_0x602e('0x75')]['forEach'](function(_0x125b93){_0x5c1541[_0x602e('0xb')]('i.'+_0x125b93);});}else{_0x5c1541[_0x602e('0xb')](_0x602e('0x76'),'unreadMessages');_0x5c1541[_0x602e('0xb')](_0x602e('0x77'),_0x602e('0x78'));_0x5c1541[_0x602e('0xb')](_0x602e('0x79'),_0x602e('0x7a'));if(_0x358573===_0x602e('0x32')){_0x5c1541[_0x602e('0xb')]('a.email',_0x602e('0x7b'));_0x5c1541[_0x602e('0xb')](_0x602e('0x7c'),_0x602e('0x7d'));_0x5c1541[_0x602e('0xb')](_0x602e('0x7e'));_0x5c1541['field'](_0x602e('0x7f'));_0x5c1541[_0x602e('0xb')](_0x602e('0x80'));_0x5c1541[_0x602e('0xb')](_0x602e('0x81'));_0x5c1541[_0x602e('0xb')](_0x602e('0x82'));_0x5c1541[_0x602e('0xb')](_0x602e('0x83'));_0x5c1541[_0x602e('0xb')](_0x602e('0x84'));_0x5c1541[_0x602e('0xb')](_0x602e('0x85'));_0x5c1541['field']('i.subject');_0x5c1541[_0x602e('0xb')]('i.disposition');_0x5c1541['field']('i.secondDisposition');_0x5c1541[_0x602e('0xb')](_0x602e('0x64'));_0x5c1541[_0x602e('0xb')](_0x602e('0x68'));_0x5c1541['field'](_0x602e('0x86'));_0x5c1541['field'](_0x602e('0x87'));_0x5c1541[_0x602e('0xb')](_0x602e('0x88'));_0x5c1541[_0x602e('0xb')](_0x602e('0x89'));}else if(_0x358573===_0x602e('0x30')){_0x5c1541[_0x602e('0xb')](_0x602e('0x8a'),_0x602e('0x7d'));}else{_0x5c1541['field'](_0x602e('0x8b'),_0x602e('0x7d'));}if(_0x358573!==_0x602e('0x32')){_0x5c1541[_0x602e('0xb')](_0x602e('0x8c'));}_0x5c1541[_0x602e('0xb')](_0x602e('0x8d'),_0x602e('0x8e'));_0x5c1541[_0x602e('0xb')](_0x602e('0x8f'),_0x602e('0x90'));_0x5c1541[_0x602e('0xb')](_0x602e('0x91'),_0x602e('0x92'));_0x5c1541['field'](_0x602e('0x93'),_0x602e('0x94'));_0x5c1541['field'](_0x602e('0x95'),_0x602e('0x96'));_0x5c1541[_0x602e('0xb')](_0x602e('0x97'),_0x602e('0x98'));_0x5c1541['field']('o.fullname',_0x602e('0x99'));_0x5c1541[_0x602e('0xb')](_0x602e('0x9a'),'Owner.internal');_0x5c1541[_0x602e('0xb')](_0x602e('0x9b'),_0x602e('0x9c'));}if(_0x3691f0['limit']){_0x5c1541['limit'](_0x3691f0[_0x602e('0x9d')]);}if(_0x3691f0[_0x602e('0x9e')]){_0x5c1541['offset'](_0x3691f0[_0x602e('0x9e')]);}return db[_0x602e('0x71')]['query'](_0x5c1541[_0x602e('0x9f')](),_0x10149c);})[_0x602e('0x59')](function(_0x446616){_0x5012e8=_0x446616;var _0x511666=getUsersQuery(_0x358573,_0x5012e8);return db[_0x602e('0x71')]['query'](_0x511666[_0x602e('0x9f')](),_0x10149c);})['then'](function(_0xb336b6){_0x444d3c=_[_0x602e('0xa0')](_0xb336b6,_0x5e6a81);if(_0x358573===_0x602e('0x32')){return db[_0x602e('0xa1')][_0x602e('0xa2')]({'attributes':['enableEmailPreview'],'raw':!![]});}})['then'](function(_0x593285){var _0x1a51bc=_0x593285?_0x593285[_0x602e('0xa3')]:undefined;var _0x2891d6=_0x5012e8[_0x602e('0x19')](function(_0x1c2456){return updateInteraction(_0x1c2456,_0x3a3f8a,_0x444d3c,_0x1a51bc);});return Promise[_0x602e('0xa4')](_0x2891d6);});}function countFilteredInteractions(_0x464e0d,_0x2e249b){var _0x3df745=_0x464e0d[_0x602e('0xa5')]();_0x3df745[_0x602e('0xb')](_0x602e('0xa6'));_0x3df745[_0x602e('0xb')](_0x602e('0x76'),_0x602e('0x42'));var _0x4051e9=utils[_0x602e('0x24')](_0x2e249b);if(!_[_0x602e('0xa7')](_0x4051e9)){_0x3df745[_0x602e('0x17')](_0x602e('0xa8'),_0x4051e9);}var _0x405fa9={'type':db[_0x602e('0x6e')][_0x602e('0x6f')][_0x602e('0x70')],'raw':!![]};return db['sequelize'][_0x602e('0x72')](_0x3df745[_0x602e('0x9f')](),_0x405fa9);}module[_0x602e('0xa9')]={'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 2f93bfc..7a4678d 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 _0x7db5=['then','lastMsgText','trimStart','catch','updateInteraction','Users','TagIds','Tags','lodash','map','fullname','split','forEach','push','waiting','talking','answered','unmanaged','total','closed','disposition','abandoned','UserId','MailMessage','findOne','out','plainBody','-id'];(function(_0x2b186f,_0x3addfa){var _0x569ebd=function(_0x1df920){while(--_0x1df920){_0x2b186f['push'](_0x2b186f['shift']());}};_0x569ebd(++_0x3addfa);}(_0x7db5,0x13c));var _0x57db=function(_0x55659c,_0x56a592){_0x55659c=_0x55659c-0x0;var _0x5f198c=_0x7db5[_0x55659c];return _0x5f198c;};'use strict';var _=require(_0x57db('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x578a46,_0x12406c){return new Promise(function(_0x4104b1,_0x256a7b){try{var _0x50f153=[];if(_0x12406c[_0x578a46]){_0x50f153=_0x12406c[_0x578a46][_0x57db('0x1')](function(_0x55106d){return{'id':_0x55106d['id'],'fullname':_0x55106d[_0x57db('0x2')]};});}return _0x4104b1(_0x50f153);}catch(_0x318220){_0x256a7b(_0x318220);}});}function getInteractionTags(_0x5b0b4c,_0x8e4e99){var _0x58ff14=[];if(_0x5b0b4c){_0x5b0b4c[_0x57db('0x3')](',')[_0x57db('0x4')](function(_0x5a2597){_0x58ff14[_0x57db('0x5')](_0x8e4e99[_0x5a2597]);});}return _0x58ff14;}function updateWaitingCounter(_0x381eda){if(_0x381eda[_0x57db('0x6')]){_0x381eda[_0x57db('0x6')]-=0x1;}}function updateInteractionCounters(_0xc100d9){_0xc100d9[_0x57db('0x6')]=0x0;_0xc100d9[_0x57db('0x7')]=0x0;_0xc100d9[_0x57db('0x8')]=0x0;_0xc100d9[_0x57db('0x9')]=0x0;_0xc100d9['abandoned']=0x0;_0xc100d9[_0x57db('0xa')]=0x0;if(_0xc100d9[_0x57db('0xb')]){if(_0xc100d9[_0x57db('0xc')]===_0x57db('0xd')){_0xc100d9[_0x57db('0xd')]+=0x1;updateWaitingCounter(_0xc100d9);}if(_0xc100d9[_0x57db('0xe')]){_0xc100d9['answered']+=0x1;if(_0xc100d9[_0x57db('0x7')]){_0xc100d9[_0x57db('0x7')]-=0x1;}}else{if(_0xc100d9[_0x57db('0xc')]){_0xc100d9['unmanaged']+=0x1;updateWaitingCounter(_0xc100d9);}}}else{if(!_0xc100d9[_0x57db('0xe')]){_0xc100d9[_0x57db('0x6')]+=0x1;}if(_0xc100d9[_0x57db('0xe')]){_0xc100d9[_0x57db('0x7')]+=0x1;updateWaitingCounter(_0xc100d9);}}_0xc100d9[_0x57db('0xa')]+=0x1;return _0xc100d9;}function getLastMessageText(_0x1bc5d2){return db[_0x57db('0xf')][_0x57db('0x10')]({'where':{'$and':[{'MailInteractionId':_0x1bc5d2['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x57db('0x11')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x57db('0x12')],'order':_0x57db('0x13'),'raw':!![]})[_0x57db('0x14')](function(_0x1b5b03){if(_0x1b5b03&&_0x1b5b03[_0x57db('0x12')]){_0x1bc5d2[_0x57db('0x15')]=_[_0x57db('0x16')](_0x1b5b03[_0x57db('0x12')]);}return _0x1bc5d2;})[_0x57db('0x17')](function(_0x482361){throw _0x482361;});}exports[_0x57db('0x18')]=function(_0x5b4cdf,_0x36cf9f,_0x4135b3,_0x510a8f){return new Promise(function(_0x482f72,_0x247ddb){return getInteractionUsers(_0x5b4cdf['id'],_0x4135b3)[_0x57db('0x14')](function(_0x2d2784){_0x5b4cdf[_0x57db('0x19')]=_0x2d2784;return getInteractionTags(_0x5b4cdf[_0x57db('0x1a')],_0x36cf9f);})[_0x57db('0x14')](function(_0x155873){_0x5b4cdf[_0x57db('0x1b')]=_0x155873;delete _0x5b4cdf[_0x57db('0x1a')];return updateInteractionCounters(_0x5b4cdf);})[_0x57db('0x14')](function(_0x35e0fe){if(_0x510a8f){return getLastMessageText(_0x35e0fe);}else{return _0x35e0fe;}})['then'](function(_0x5bc299){_0x482f72(_0x5bc299);})[_0x57db('0x17')](function(_0x4fdbb4){_0x247ddb(_0x4fdbb4);});});}; \ No newline at end of file +var _0x1e6b=['MailMessage','findOne','out','-id','then','lastMsgText','trimStart','plainBody','updateInteraction','Tags','TagIds','catch','lodash','map','fullname','split','forEach','push','waiting','talking','answered','total','closed','disposition','UserId'];(function(_0x4cf9f9,_0x175b3b){var _0xb18c4=function(_0x252e08){while(--_0x252e08){_0x4cf9f9['push'](_0x4cf9f9['shift']());}};_0xb18c4(++_0x175b3b);}(_0x1e6b,0x11f));var _0xb1e6=function(_0x3e3d9f,_0x29b853){_0x3e3d9f=_0x3e3d9f-0x0;var _0xb82f4e=_0x1e6b[_0x3e3d9f];return _0xb82f4e;};'use strict';var _=require(_0xb1e6('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x18aff6,_0x5b758b){return new Promise(function(_0x467cb6,_0x30e813){try{var _0x325dbd=[];if(_0x5b758b[_0x18aff6]){_0x325dbd=_0x5b758b[_0x18aff6][_0xb1e6('0x1')](function(_0x3deeae){return{'id':_0x3deeae['id'],'fullname':_0x3deeae[_0xb1e6('0x2')]};});}return _0x467cb6(_0x325dbd);}catch(_0x291015){_0x30e813(_0x291015);}});}function getInteractionTags(_0x7c845b,_0x5a691a){var _0x6c42f5=[];if(_0x7c845b){_0x7c845b[_0xb1e6('0x3')](',')[_0xb1e6('0x4')](function(_0x315d1a){_0x6c42f5[_0xb1e6('0x5')](_0x5a691a[_0x315d1a]);});}return _0x6c42f5;}function updateWaitingCounter(_0x181d22){if(_0x181d22['waiting']){_0x181d22[_0xb1e6('0x6')]-=0x1;}}function updateInteractionCounters(_0x1602e7){_0x1602e7[_0xb1e6('0x6')]=0x0;_0x1602e7[_0xb1e6('0x7')]=0x0;_0x1602e7[_0xb1e6('0x8')]=0x0;_0x1602e7['unmanaged']=0x0;_0x1602e7['abandoned']=0x0;_0x1602e7[_0xb1e6('0x9')]=0x0;if(_0x1602e7[_0xb1e6('0xa')]){if(_0x1602e7[_0xb1e6('0xb')]==='abandoned'){_0x1602e7['abandoned']+=0x1;updateWaitingCounter(_0x1602e7);}if(_0x1602e7[_0xb1e6('0xc')]){_0x1602e7[_0xb1e6('0x8')]+=0x1;if(_0x1602e7['talking']){_0x1602e7[_0xb1e6('0x7')]-=0x1;}}else{if(_0x1602e7['disposition']){_0x1602e7['unmanaged']+=0x1;updateWaitingCounter(_0x1602e7);}}}else{if(!_0x1602e7['UserId']){_0x1602e7[_0xb1e6('0x6')]+=0x1;}if(_0x1602e7[_0xb1e6('0xc')]){_0x1602e7[_0xb1e6('0x7')]+=0x1;updateWaitingCounter(_0x1602e7);}}_0x1602e7[_0xb1e6('0x9')]+=0x1;return _0x1602e7;}function getLastMessageText(_0x3ee31f){return db[_0xb1e6('0xd')][_0xb1e6('0xe')]({'where':{'$and':[{'MailInteractionId':_0x3ee31f['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xb1e6('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xb1e6('0x10'),'raw':!![]})[_0xb1e6('0x11')](function(_0x5d4cfb){if(_0x5d4cfb&&_0x5d4cfb['plainBody']){_0x3ee31f[_0xb1e6('0x12')]=_[_0xb1e6('0x13')](_0x5d4cfb[_0xb1e6('0x14')]);}return _0x3ee31f;})['catch'](function(_0x2a7ec3){throw _0x2a7ec3;});}exports[_0xb1e6('0x15')]=function(_0x2e5262,_0x4fdd1a,_0x312e69,_0x2ec2e8){return new Promise(function(_0x494a0e,_0x499991){return getInteractionUsers(_0x2e5262['id'],_0x312e69)[_0xb1e6('0x11')](function(_0x4780a1){_0x2e5262['Users']=_0x4780a1;return getInteractionTags(_0x2e5262['TagIds'],_0x4fdd1a);})[_0xb1e6('0x11')](function(_0x4d580f){_0x2e5262[_0xb1e6('0x16')]=_0x4d580f;delete _0x2e5262[_0xb1e6('0x17')];return updateInteractionCounters(_0x2e5262);})[_0xb1e6('0x11')](function(_0x224f8d){if(_0x2ec2e8){return getLastMessageText(_0x224f8d);}else{return _0x224f8d;}})['then'](function(_0x3e7941){_0x494a0e(_0x3e7941);})[_0xb1e6('0x18')](function(_0x17fd53){_0x499991(_0x17fd53);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 5c6bf6c..e291ca2 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 _0x929f=['websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','stringify','null','Interaction','findOne','then','info','catch','error','toLowerCase','name','role','\x20role=','\x20interaction=','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst'];(function(_0x31e1a9,_0x5ce674){var _0x5ec9d3=function(_0x48440c){while(--_0x48440c){_0x31e1a9['push'](_0x31e1a9['shift']());}};_0x5ec9d3(++_0x5ce674);}(_0x929f,0x193));var _0xf929=function(_0x58b9d6,_0x3100d5){_0x58b9d6=_0x58b9d6-0x0;var _0x1ee77e=_0x929f[_0x58b9d6];return _0x1ee77e;};'use strict';var _=require(_0xf929('0x0'));var db=require(_0xf929('0x1'))['db'];var loggers={'openchannel':require(_0xf929('0x2'))(_0xf929('0x3')),'mail':require(_0xf929('0x2'))(_0xf929('0x4')),'fax':require(_0xf929('0x2'))(_0xf929('0x5')),'sms':require(_0xf929('0x2'))(_0xf929('0x6')),'chat':require(_0xf929('0x2'))(_0xf929('0x7')),'whatsapp':require(_0xf929('0x2'))(_0xf929('0x8'))};function getAccountFK(_0x4fb6f0){return _[_0xf929('0x9')](_0x4fb6f0)+(_0x4fb6f0===_0xf929('0xa')?_0xf929('0xb'):_0xf929('0xc'))+'Id';}function getInteractionFK(_0x453edc){return _[_0xf929('0x9')](_0x453edc)+_0xf929('0xd');}function getInteractionId(_0x3f5969,_0x35fb91,_0x1aa196){if(_0x3f5969&&_0x3f5969[_[_0xf929('0xe')](_0x1aa196)+_0xf929('0xd')]){return _0x3f5969[_['upperFirst'](_0x1aa196)+_0xf929('0xd')];}else if(_0x3f5969&&_0x3f5969['id']){return _0x3f5969['id'];}else if(_0x35fb91&&_0x35fb91['id']){return _0x35fb91['id'];}else{return'unknown';}}function getInteractionsTables(_0xc941a2){return{'accounts':_0xc941a2+'_'+(_0xc941a2===_0xf929('0xa')?_0xf929('0xf'):_0xf929('0x10')),'interactions':_0xc941a2+_0xf929('0x11'),'interactionsTags':_0xc941a2+_0xf929('0x12'),'messages':_0xc941a2+_0xf929('0x13'),'userInteractions':_0xf929('0x14')+_0xc941a2+'_interactions'};}function getSelectedTags(_0x3b01d3){var _0x41eae3=[];if(_0x3b01d3){_0x41eae3=Array[_0xf929('0x15')](_0x3b01d3)?_0x3b01d3:[_0x3b01d3];}return _0x41eae3;}function log(_0x36ddb9,_0x1187f4,_0x268e8e,_0x5b6f2f,_0x619ca5,_0x296e47){loggers[_0x619ca5['toLowerCase']()][_0x36ddb9](_0xf929('0x16'),_0x296e47[_0xf929('0x17')](),_0x1187f4?_0x1187f4['id']:null,_0x1187f4?_0x1187f4['name']:null,_0x1187f4?_0x1187f4['role']:null,getInteractionId(_0x268e8e,_0x5b6f2f,_0x619ca5),_0x268e8e?JSON[_0xf929('0x18')](_0x268e8e):_0xf929('0x19'));}function updateUser(_0x1e0704,_0x242d00,_0x4326f1,_0x1c0926,_0x362eee){db[_[_0xf929('0xe')](_0x1c0926)+_0xf929('0x1a')][_0xf929('0x1b')]({'where':{'id':getInteractionId(_0x242d00,_0x4326f1,_0x1c0926)}})[_0xf929('0x1c')](function(_0x1eeecb){if(_0x1eeecb){return _0x1eeecb['update']({'UserId':_0x1e0704?_0x1e0704['id']:null});}})[_0xf929('0x1c')](function(_0x12ccc7){if(_0x12ccc7){log(_0xf929('0x1d'),_0x1e0704,_0x242d00,_0x4326f1,_0x1c0926,_0x362eee);}})[_0xf929('0x1e')](function(){log(_0xf929('0x1f'),_0x1e0704,_0x242d00,_0x4326f1,_0x1c0926,_0x362eee);});}function logAcceptMessage(_0x26b020,_0x3d9f41,_0x1a367e,_0x49b299){var _0x34d36b=loggers[_0x26b020[_0xf929('0x20')]()];var _0x4cdecd=_0x3d9f41['id'];var _0x113b71=_0x3d9f41[_0xf929('0x21')];var _0x59b973=_0x3d9f41[_0xf929('0x22')];var _0x513183=JSON[_0xf929('0x18')](_0x49b299||null);_0x34d36b[_0xf929('0x1d')]('['+_0x26b020[_0xf929('0x17')]()+'MESSAGE:ACCEPT]\x20id='+_0x4cdecd+'\x20name='+_0x113b71+_0xf929('0x23')+_0x59b973+_0xf929('0x24')+_0x1a367e+'\x20body='+_0x513183);}module[_0xf929('0x25')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file +var _0x5bce=['_interactions','_interaction_has_tags','_messages','toLowerCase','toUpperCase','name','null','Interaction','findOne','then','update','info','catch','error','role','stringify','MESSAGE:ACCEPT]\x20id=','\x20interaction=','\x20body=','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','Website','Account','upperFirst','InteractionId','unknown','chat','websites','accounts'];(function(_0x1ece2d,_0x26fd2b){var _0x20199a=function(_0x462c9d){while(--_0x462c9d){_0x1ece2d['push'](_0x1ece2d['shift']());}};_0x20199a(++_0x26fd2b);}(_0x5bce,0x160));var _0xe5bc=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0x5bce[_0x4b12ae];return _0x16957b;};'use strict';var _=require(_0xe5bc('0x0'));var db=require(_0xe5bc('0x1'))['db'];var loggers={'openchannel':require(_0xe5bc('0x2'))(_0xe5bc('0x3')),'mail':require(_0xe5bc('0x2'))(_0xe5bc('0x4')),'fax':require(_0xe5bc('0x2'))(_0xe5bc('0x5')),'sms':require(_0xe5bc('0x2'))(_0xe5bc('0x6')),'chat':require(_0xe5bc('0x2'))(_0xe5bc('0x7')),'whatsapp':require(_0xe5bc('0x2'))(_0xe5bc('0x8'))};function getAccountFK(_0x211bea){return _[_0xe5bc('0x9')](_0x211bea)+(_0x211bea==='chat'?_0xe5bc('0xa'):_0xe5bc('0xb'))+'Id';}function getInteractionFK(_0x19d13f){return _[_0xe5bc('0x9')](_0x19d13f)+'InteractionId';}function getInteractionId(_0x368ba3,_0x3e8e56,_0x4b2ac8){if(_0x368ba3&&_0x368ba3[_[_0xe5bc('0xc')](_0x4b2ac8)+_0xe5bc('0xd')]){return _0x368ba3[_[_0xe5bc('0xc')](_0x4b2ac8)+_0xe5bc('0xd')];}else if(_0x368ba3&&_0x368ba3['id']){return _0x368ba3['id'];}else if(_0x3e8e56&&_0x3e8e56['id']){return _0x3e8e56['id'];}else{return _0xe5bc('0xe');}}function getInteractionsTables(_0x4f25db){return{'accounts':_0x4f25db+'_'+(_0x4f25db===_0xe5bc('0xf')?_0xe5bc('0x10'):_0xe5bc('0x11')),'interactions':_0x4f25db+_0xe5bc('0x12'),'interactionsTags':_0x4f25db+_0xe5bc('0x13'),'messages':_0x4f25db+_0xe5bc('0x14'),'userInteractions':'user_has_'+_0x4f25db+_0xe5bc('0x12')};}function getSelectedTags(_0x5d0c35){var _0x57d566=[];if(_0x5d0c35){_0x57d566=Array['isArray'](_0x5d0c35)?_0x5d0c35:[_0x5d0c35];}return _0x57d566;}function log(_0x4efe5e,_0x19d608,_0xb8ca25,_0x56e0f5,_0x31efbd,_0x5159ae){loggers[_0x31efbd[_0xe5bc('0x15')]()][_0x4efe5e]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5159ae[_0xe5bc('0x16')](),_0x19d608?_0x19d608['id']:null,_0x19d608?_0x19d608[_0xe5bc('0x17')]:null,_0x19d608?_0x19d608['role']:null,getInteractionId(_0xb8ca25,_0x56e0f5,_0x31efbd),_0xb8ca25?JSON['stringify'](_0xb8ca25):_0xe5bc('0x18'));}function updateUser(_0xc051ad,_0x1e2b7d,_0x2c218d,_0x31a1dc,_0x940c30){db[_['upperFirst'](_0x31a1dc)+_0xe5bc('0x19')][_0xe5bc('0x1a')]({'where':{'id':getInteractionId(_0x1e2b7d,_0x2c218d,_0x31a1dc)}})[_0xe5bc('0x1b')](function(_0x42570c){if(_0x42570c){return _0x42570c[_0xe5bc('0x1c')]({'UserId':_0xc051ad?_0xc051ad['id']:null});}})['then'](function(_0x15057b){if(_0x15057b){log(_0xe5bc('0x1d'),_0xc051ad,_0x1e2b7d,_0x2c218d,_0x31a1dc,_0x940c30);}})[_0xe5bc('0x1e')](function(){log(_0xe5bc('0x1f'),_0xc051ad,_0x1e2b7d,_0x2c218d,_0x31a1dc,_0x940c30);});}function logAcceptMessage(_0x211761,_0x1b06d5,_0x3efdb5,_0x4e8db5){var _0x4d5a51=loggers[_0x211761[_0xe5bc('0x15')]()];var _0x4c51a9=_0x1b06d5['id'];var _0x22fc26=_0x1b06d5[_0xe5bc('0x17')];var _0x10b803=_0x1b06d5[_0xe5bc('0x20')];var _0x53adb5=JSON[_0xe5bc('0x21')](_0x4e8db5||null);_0x4d5a51['info']('['+_0x211761['toUpperCase']()+_0xe5bc('0x22')+_0x4c51a9+'\x20name='+_0x22fc26+'\x20role='+_0x10b803+_0xe5bc('0x23')+_0x3efdb5+_0xe5bc('0x24')+_0x53adb5);}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'logAcceptMessage':logAcceptMessage,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 0fc17a6..d1681e5 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 _0xac47=['count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','admin','user','isUserLimit','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','base64','utf8','parse','use','then'];(function(_0x41a45d,_0x1e61c3){var _0x24b1d6=function(_0x5d1f8b){while(--_0x5d1f8b){_0x41a45d['push'](_0x41a45d['shift']());}};_0x24b1d6(++_0x1e61c3);}(_0xac47,0x11c));var _0x7ac4=function(_0x5a7d41,_0x4447e2){_0x5a7d41=_0x5a7d41-0x0;var _0x98d8fa=_0xac47[_0x5a7d41];return _0x98d8fa;};'use strict';var crypto=require('crypto');var util=require(_0x7ac4('0x0'));var compose=require(_0x7ac4('0x1'));var db=require(_0x7ac4('0x2'))['db'];var config=require(_0x7ac4('0x3'));function getValueFromLicense(_0x550e08,_0x55336a){if(_0x550e08&&_0x55336a){if(_0x55336a[_0x7ac4('0x4')]&&_0x55336a[_0x7ac4('0x5')]){var _0x10e258=_0x55336a[_0x7ac4('0x4')];var _0x1b6d5c=_0x55336a[_0x7ac4('0x5')];var _0x19f29b=_0x10e258[_0x7ac4('0x6')]('-')[0x4];var _0x361523=_0x10e258['split']('-')[0x0];var _0x48f935=crypto['createDecipher'](_0x7ac4('0x7'),util[_0x7ac4('0x8')]('%s:%s:%s',_0x19f29b,_0x10e258,_0x361523));var _0x43f353=_0x48f935[_0x7ac4('0x9')](_0x1b6d5c,_0x7ac4('0xa'),'utf8');_0x43f353+=_0x48f935['final'](_0x7ac4('0xb'));var _0x3a0d2b=JSON[_0x7ac4('0xc')](_0x43f353);return _0x3a0d2b['hasOwnProperty'](_0x550e08)?_0x3a0d2b[_0x550e08]:null;}}return null;}function isLimit(_0x1af264,_0x16c5c8,_0x596af5,_0x464704){var _0x34f8a8=_0x16c5c8;return compose()[_0x7ac4('0xd')](function(_0x478765,_0x179ebc,_0x551f59){return db['License']['findOne']({'where':{'id':0x1},'raw':!![]})[_0x7ac4('0xe')](function(_0x55bafe){var _0x1b1bbc=getValueFromLicense(_0x1af264,_0x55bafe);return _0x1b1bbc?_0x1b1bbc:_0x34f8a8;})[_0x7ac4('0xe')](function(_0x107df1){_0x34f8a8=_0x107df1;return _0x596af5[_0x7ac4('0xf')](_0x464704);})[_0x7ac4('0xe')](function(_0x3efa56){if(_0x3efa56>=_0x34f8a8){return _0x179ebc[_0x7ac4('0x10')](0x193)[_0x7ac4('0x11')]({'message':util[_0x7ac4('0x8')](_0x7ac4('0x12'),_0x1af264)});}_0x551f59();})['catch'](function(_0x291546){_0x551f59(_0x291546);});});}function isUserLimit(){return isLimit(_0x7ac4('0x13'),0x1,db['User'],{'where':{'$or':[{'role':_0x7ac4('0x14')},{'role':_0x7ac4('0x15')}]}});}exports[_0x7ac4('0x16')]=isUserLimit; \ No newline at end of file +var _0x5d7d=['data1','license','createDecipher','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','License','findOne','then','catch','users','User','admin','isUserLimit','util','composable-middleware'];(function(_0x2410db,_0x2f7f33){var _0x1b1f22=function(_0xf04143){while(--_0xf04143){_0x2410db['push'](_0x2410db['shift']());}};_0x1b1f22(++_0x2f7f33);}(_0x5d7d,0x1cc));var _0xd5d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5d7d[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var util=require(_0xd5d7('0x0'));var compose=require(_0xd5d7('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x7a1321,_0x228b32){if(_0x7a1321&&_0x228b32){if(_0x228b32[_0xd5d7('0x2')]&&_0x228b32[_0xd5d7('0x3')]){var _0x196831=_0x228b32['data1'];var _0x2d6071=_0x228b32[_0xd5d7('0x3')];var _0x3f8f52=_0x196831['split']('-')[0x4];var _0x4f2afe=_0x196831['split']('-')[0x0];var _0x4763ff=crypto[_0xd5d7('0x4')]('aes-256-ctr',util['format'](_0xd5d7('0x5'),_0x3f8f52,_0x196831,_0x4f2afe));var _0x50360e=_0x4763ff[_0xd5d7('0x6')](_0x2d6071,_0xd5d7('0x7'),'utf8');_0x50360e+=_0x4763ff[_0xd5d7('0x8')](_0xd5d7('0x9'));var _0x12e43e=JSON[_0xd5d7('0xa')](_0x50360e);return _0x12e43e[_0xd5d7('0xb')](_0x7a1321)?_0x12e43e[_0x7a1321]:null;}}return null;}function isLimit(_0x40858e,_0x3d38e2,_0x1267c1,_0x366f45){var _0x3773e4=_0x3d38e2;return compose()[_0xd5d7('0xc')](function(_0x40faf6,_0x30e48b,_0x316a33){return db[_0xd5d7('0xd')][_0xd5d7('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xd5d7('0xf')](function(_0x2134e3){var _0x547e63=getValueFromLicense(_0x40858e,_0x2134e3);return _0x547e63?_0x547e63:_0x3773e4;})[_0xd5d7('0xf')](function(_0x164ff9){_0x3773e4=_0x164ff9;return _0x1267c1['count'](_0x366f45);})[_0xd5d7('0xf')](function(_0x163470){if(_0x163470>=_0x3773e4){return _0x30e48b['status'](0x193)['json']({'message':util['format']('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x40858e)});}_0x316a33();})[_0xd5d7('0x10')](function(_0xfb7848){_0x316a33(_0xfb7848);});});}function isUserLimit(){return isLimit(_0xd5d7('0x11'),0x1,db[_0xd5d7('0x12')],{'where':{'$or':[{'role':_0xd5d7('0x13')},{'role':'user'}]}});}exports[_0xd5d7('0x14')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 07de19a..9436dce 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 _0x1c06=['<>\x20?','$substring','$endsWith','$lt','<\x20?','>\x20?','$lte','>=\x20?','start','$startsWith','utcOffset','add','hours','minutes','parseSearch','startsWith','[$or]','and','replace','[$and]','split','slice','forEach','shift','filter','indexOf','conditions','push','DATE','$eq','$between','value','includes','$gt','operator','days','format','YYYY-MM-DD','castTo','CAST(','field','text','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?'];(function(_0x3e69ae,_0x366e8d){var _0x3d7f42=function(_0x5df093){while(--_0x5df093){_0x3e69ae['push'](_0x3e69ae['shift']());}};_0x3d7f42(++_0x366e8d);}(_0x1c06,0x19e));var _0x61c0=function(_0x2cdec6,_0x39d4c8){_0x2cdec6=_0x2cdec6-0x0;var _0xa36703=_0x1c06[_0x2cdec6];return _0xa36703;};'use strict';var _=require('lodash');var moment=require('moment');exports[_0x61c0('0x0')]=function(_0x4b19d2){var _0x571957={'conditions':[]};_0x571957['sqlOperator']=_[_0x61c0('0x1')](_0x4b19d2,_0x61c0('0x2'))?'or':_0x61c0('0x3');var _0x499bf8=_0x4b19d2[_0x61c0('0x4')](_0x61c0('0x5'),'')[_0x61c0('0x4')](_0x61c0('0x2'),'')[_0x61c0('0x6')]('||');for(var _0x4d4e6f=0x0;_0x4d4e6f<_0x499bf8['length'];_0x4d4e6f++){var _0x33bda4=_0x499bf8[_0x4d4e6f][_0x61c0('0x6')](':=');var _0x421a50=_0x33bda4[0x0];var _0x10bbfc=_0x33bda4[_0x61c0('0x7')](0x1);_0x10bbfc[_0x61c0('0x8')](function(_0x5ed2b4){var _0x18ba86=_0x5ed2b4[_0x61c0('0x6')]('[')[_0x61c0('0x9')]();var _0x4a67a7=_0x5ed2b4['match'](/\[(.*?)\]/g);_0x4a67a7[_0x61c0('0x8')](function(_0x5e5016){var _0x1c9601=_0x5e5016[_0x61c0('0x6')]('[')[_0x61c0('0xa')](function(_0x3dbf51){return _0x3dbf51[_0x61c0('0xb')](']')>-0x1;})['map'](function(_0x17f159){return _0x17f159[_0x61c0('0x6')](']')[0x0];})[0x0];_0x571957[_0x61c0('0xc')][_0x61c0('0xd')]({'field':_0x421a50,'operator':_0x18ba86,'value':_0x1c9601});});});}return _0x571957;};exports['buildExpression']=function(_0xc24315,_0xe6f4a6,_0x3306ec){var _0x45e6c5={};if(_0xe6f4a6===_0x61c0('0xe')){if(_0x3306ec['operator']===_0x61c0('0xf')){_0x3306ec['operator']=_0x61c0('0x10');_0x3306ec[_0x61c0('0x11')]+=','+_0x3306ec[_0x61c0('0x11')];}else if(_[_0x61c0('0x12')]([_0x61c0('0x13'),'$lte'],_0x3306ec[_0x61c0('0x14')])){_0x3306ec[_0x61c0('0x11')]=moment(_0x3306ec[_0x61c0('0x11')])['add'](0x1,_0x61c0('0x15'))[_0x61c0('0x16')](_0x61c0('0x17'));}}if(_0x3306ec[_0x61c0('0x18')]){_0xe6f4a6=_0x3306ec[_0x61c0('0x18')];_0x45e6c5['text']=_0x61c0('0x19')+_0xc24315+'.'+_0x3306ec[_0x61c0('0x1a')]+'\x20AS\x20'+_0x3306ec[_0x61c0('0x18')]+')\x20'+parseOperator(_0x3306ec[_0x61c0('0x14')]);}else{_0x45e6c5[_0x61c0('0x1b')]=_0xc24315+'.'+_0x3306ec[_0x61c0('0x1a')]+'\x20'+parseOperator(_0x3306ec[_0x61c0('0x14')]);}if(_[_0x61c0('0x12')]([_0x61c0('0x1c'),_0x61c0('0x1d')],_0x3306ec['operator']))_0x45e6c5[_0x61c0('0x1b')]='('+_0x45e6c5[_0x61c0('0x1b')]+_0x61c0('0x1e')+_0xc24315+'.'+_0x3306ec['field']+_0x61c0('0x1f');_0x45e6c5[_0x61c0('0x11')]=parseValue(_0xe6f4a6,_0x3306ec[_0x61c0('0x14')],_0x3306ec[_0x61c0('0x11')]);return _0x45e6c5;};function parseOperator(_0x5f121f){var _0x6fb20f;switch(_0x5f121f){case _0x61c0('0x20'):_0x6fb20f=_0x61c0('0x21');break;case _0x61c0('0x1d'):_0x6fb20f=_0x61c0('0x22');break;case _0x61c0('0xf'):_0x6fb20f=_0x61c0('0x23');break;case _0x61c0('0x1c'):_0x6fb20f=_0x61c0('0x24');break;case _0x61c0('0x25'):case'$startsWith':case _0x61c0('0x26'):_0x6fb20f='LIKE\x20?';break;case _0x61c0('0x27'):_0x6fb20f=_0x61c0('0x28');break;case _0x61c0('0x13'):_0x6fb20f=_0x61c0('0x29');break;case _0x61c0('0x2a'):_0x6fb20f='<=\x20?';break;case'$gte':_0x6fb20f=_0x61c0('0x2b');break;case'$between':_0x6fb20f='BETWEEN\x20?\x20AND\x20?';break;}return _0x6fb20f;}function parseValue(_0x21d6e5,_0x4cff90,_0x5bf967){var _0x188ddc={'start':undefined,'end':undefined};switch(_0x4cff90){case _0x61c0('0x20'):case _0x61c0('0x1d'):_0x188ddc[_0x61c0('0x2c')]=_0x5bf967[_0x61c0('0x6')](',');break;case _0x61c0('0x25'):_0x188ddc['start']='%'+_0x5bf967+'%';break;case _0x61c0('0x2d'):_0x188ddc[_0x61c0('0x2c')]=_0x5bf967+'%';break;case _0x61c0('0x26'):_0x188ddc[_0x61c0('0x2c')]='%'+_0x5bf967;break;case'$between':var _0x43405b=_0x5bf967['split'](',');var _0x5bf967=_0x43405b[_0x61c0('0x9')]();var _0x2c8b4c=_0x43405b['pop']();if(_0x21d6e5==='DATE'){_0x5bf967=moment(_0x5bf967)[_0x61c0('0x2e')](0x0,!![])['format']();_0x2c8b4c=moment(_0x2c8b4c)['utcOffset'](0x0,!![])[_0x61c0('0x2f')](0x17,_0x61c0('0x30'))[_0x61c0('0x2f')](0x3b,_0x61c0('0x31'))[_0x61c0('0x2f')](0x3b,'seconds')[_0x61c0('0x16')]();}_0x188ddc={'start':_0x5bf967,'end':_0x2c8b4c};break;default:_0x188ddc[_0x61c0('0x2c')]=_0x5bf967;break;}return _0x188ddc;} \ No newline at end of file +var _0x2fb2=['push','buildExpression','operator','$eq','$between','value','includes','$lte','add','days','format','YYYY-MM-DD','text','CAST(','\x20AS\x20','castTo','$ne','$notIn','\x20OR\x20','field','\x20IS\x20NULL)','NOT\x20IN\x20?','=\x20?','<>\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','<\x20?','$gt','>\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$in','start','pop','DATE','utcOffset','minutes','seconds','lodash','moment','parseSearch','startsWith','replace','[$and]','split','forEach','shift','match','filter','indexOf','map'];(function(_0xcdb8b5,_0x1be02c){var _0x355d78=function(_0xcff49a){while(--_0xcff49a){_0xcdb8b5['push'](_0xcdb8b5['shift']());}};_0x355d78(++_0x1be02c);}(_0x2fb2,0xcf));var _0x22fb=function(_0x732a07,_0x10a02c){_0x732a07=_0x732a07-0x0;var _0x1d412e=_0x2fb2[_0x732a07];return _0x1d412e;};'use strict';var _=require(_0x22fb('0x0'));var moment=require(_0x22fb('0x1'));exports[_0x22fb('0x2')]=function(_0x3f81f8){var _0x2024fe={'conditions':[]};_0x2024fe['sqlOperator']=_[_0x22fb('0x3')](_0x3f81f8,'[$or]')?'or':'and';var _0x36af99=_0x3f81f8[_0x22fb('0x4')](_0x22fb('0x5'),'')[_0x22fb('0x4')]('[$or]','')['split']('||');for(var _0x40d22f=0x0;_0x40d22f<_0x36af99['length'];_0x40d22f++){var _0xf8b0d0=_0x36af99[_0x40d22f][_0x22fb('0x6')](':=');var _0x368dd8=_0xf8b0d0[0x0];var _0x158733=_0xf8b0d0['slice'](0x1);_0x158733[_0x22fb('0x7')](function(_0x1463e6){var _0x4ff393=_0x1463e6['split']('[')[_0x22fb('0x8')]();var _0x5f0877=_0x1463e6[_0x22fb('0x9')](/\[(.*?)\]/g);_0x5f0877[_0x22fb('0x7')](function(_0x306959){var _0x578221=_0x306959[_0x22fb('0x6')]('[')[_0x22fb('0xa')](function(_0x4058bf){return _0x4058bf[_0x22fb('0xb')](']')>-0x1;})[_0x22fb('0xc')](function(_0x5b545a){return _0x5b545a[_0x22fb('0x6')](']')[0x0];})[0x0];_0x2024fe['conditions'][_0x22fb('0xd')]({'field':_0x368dd8,'operator':_0x4ff393,'value':_0x578221});});});}return _0x2024fe;};exports[_0x22fb('0xe')]=function(_0x59c3d5,_0x176a07,_0x49bf4b){var _0x1fa027={};if(_0x176a07==='DATE'){if(_0x49bf4b[_0x22fb('0xf')]===_0x22fb('0x10')){_0x49bf4b[_0x22fb('0xf')]=_0x22fb('0x11');_0x49bf4b[_0x22fb('0x12')]+=','+_0x49bf4b[_0x22fb('0x12')];}else if(_[_0x22fb('0x13')](['$gt',_0x22fb('0x14')],_0x49bf4b[_0x22fb('0xf')])){_0x49bf4b['value']=moment(_0x49bf4b[_0x22fb('0x12')])[_0x22fb('0x15')](0x1,_0x22fb('0x16'))[_0x22fb('0x17')](_0x22fb('0x18'));}}if(_0x49bf4b['castTo']){_0x176a07=_0x49bf4b['castTo'];_0x1fa027[_0x22fb('0x19')]=_0x22fb('0x1a')+_0x59c3d5+'.'+_0x49bf4b['field']+_0x22fb('0x1b')+_0x49bf4b[_0x22fb('0x1c')]+')\x20'+parseOperator(_0x49bf4b[_0x22fb('0xf')]);}else{_0x1fa027['text']=_0x59c3d5+'.'+_0x49bf4b['field']+'\x20'+parseOperator(_0x49bf4b[_0x22fb('0xf')]);}if(_[_0x22fb('0x13')]([_0x22fb('0x1d'),_0x22fb('0x1e')],_0x49bf4b['operator']))_0x1fa027[_0x22fb('0x19')]='('+_0x1fa027['text']+_0x22fb('0x1f')+_0x59c3d5+'.'+_0x49bf4b[_0x22fb('0x20')]+_0x22fb('0x21');_0x1fa027[_0x22fb('0x12')]=parseValue(_0x176a07,_0x49bf4b[_0x22fb('0xf')],_0x49bf4b[_0x22fb('0x12')]);return _0x1fa027;};function parseOperator(_0x27e201){var _0x2691f0;switch(_0x27e201){case'$in':_0x2691f0='IN\x20?';break;case _0x22fb('0x1e'):_0x2691f0=_0x22fb('0x22');break;case'$eq':_0x2691f0=_0x22fb('0x23');break;case _0x22fb('0x1d'):_0x2691f0=_0x22fb('0x24');break;case _0x22fb('0x25'):case _0x22fb('0x26'):case _0x22fb('0x27'):_0x2691f0=_0x22fb('0x28');break;case _0x22fb('0x29'):_0x2691f0=_0x22fb('0x2a');break;case _0x22fb('0x2b'):_0x2691f0=_0x22fb('0x2c');break;case _0x22fb('0x14'):_0x2691f0='<=\x20?';break;case _0x22fb('0x2d'):_0x2691f0=_0x22fb('0x2e');break;case _0x22fb('0x11'):_0x2691f0=_0x22fb('0x2f');break;}return _0x2691f0;}function parseValue(_0xb6d037,_0x4f718f,_0xad6d95){var _0x14b98b={'start':undefined,'end':undefined};switch(_0x4f718f){case _0x22fb('0x30'):case _0x22fb('0x1e'):_0x14b98b['start']=_0xad6d95[_0x22fb('0x6')](',');break;case'$substring':_0x14b98b['start']='%'+_0xad6d95+'%';break;case'$startsWith':_0x14b98b[_0x22fb('0x31')]=_0xad6d95+'%';break;case _0x22fb('0x27'):_0x14b98b['start']='%'+_0xad6d95;break;case _0x22fb('0x11'):var _0xb72e4b=_0xad6d95[_0x22fb('0x6')](',');var _0xad6d95=_0xb72e4b[_0x22fb('0x8')]();var _0x55b7ef=_0xb72e4b[_0x22fb('0x32')]();if(_0xb6d037===_0x22fb('0x33')){_0xad6d95=moment(_0xad6d95)['utcOffset'](0x0,!![])[_0x22fb('0x17')]();_0x55b7ef=moment(_0x55b7ef)[_0x22fb('0x34')](0x0,!![])[_0x22fb('0x15')](0x17,'hours')['add'](0x3b,_0x22fb('0x35'))[_0x22fb('0x15')](0x3b,_0x22fb('0x36'))[_0x22fb('0x17')]();}_0x14b98b={'start':_0xad6d95,'end':_0x55b7ef};break;default:_0x14b98b[_0x22fb('0x31')]=_0xad6d95;break;}return _0x14b98b;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 86ef96e..6f36534 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 _0x44ed=['options','include','escapeLIKESpecialChars','lodash','sequelize','moment','../../mysqldb','keys','parse','model','alias','fields','split','filters','isEmpty','forOwn','find','$gte','YYYY-MM-DD','utc','format','$lte','name','uniqueid','isArray','offset','sort','indexOf','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','^[+]?[0-9]*$','match','{EXPR}','replace','trim','forEach','push','query','$id','map','intersection','attributes','nolimit','limit','order','where','filter','object','type','VIRTUAL','lower','merge'];(function(_0x26f702,_0x3919bf){var _0x11417d=function(_0x1aa3e8){while(--_0x1aa3e8){_0x26f702['push'](_0x26f702['shift']());}};_0x11417d(++_0x3919bf);}(_0x44ed,0x1c3));var _0xd44e=function(_0x34e51c,_0x1f46b0){_0x34e51c=_0x34e51c-0x0;var _0x31643c=_0x44ed[_0x34e51c];return _0x31643c;};'use strict';var _=require(_0xd44e('0x0'));var sequelize=require(_0xd44e('0x1'));var moment=require(_0xd44e('0x2'));var db=require(_0xd44e('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x15c555){var _0x2e58c3=['ne'];try{var _0x569bb0=JSON['parse'](_0x15c555);var _0x5ed0bd=Object[_0xd44e('0x4')](_0x569bb0)[0x0];return _0x2e58c3['includes'](_0x5ed0bd);}catch(_0x5b03ad){return![];}}function getOperatorValue(_0x5660e5){var _0x135276=JSON[_0xd44e('0x5')](_0x5660e5);var _0x27b9fb=Object[_0xd44e('0x4')](_0x135276)[0x0];var _0xefee65=_0x135276[_0x27b9fb];return{['$'+_0x27b9fb]:_0xefee65};}function parseIncludeModel(_0x2a7843){var _0x338082=JSON[_0xd44e('0x5')](_0x2a7843);return{'model':db[_0x338082[_0xd44e('0x6')]],'as':_0x338082[_0xd44e('0x7')],'attributes':_0x338082['fields'],'raw':_0x338082['raw']};}exports[_0xd44e('0x8')]=function(_0x155027){var _0xd57e85=null;if(_0x155027){_0xd57e85=_0x155027[_0xd44e('0x9')](',');}return _0xd57e85;};exports[_0xd44e('0xa')]=function(_0x17daff,_0x59a1e7){var _0x5b4ae1={};if(!_[_0xd44e('0xb')](_0x17daff)){_[_0xd44e('0xc')](_0x17daff,function(_0x8a5147,_0x2b43e4){try{if(_0x59a1e7){var _0xf804d1=_[_0xd44e('0xd')](_0x59a1e7,{'name':_0x2b43e4})||{};if(hasSequelizeOperator(_0x8a5147)){_0x5b4ae1[_0x2b43e4]=getOperatorValue(_0x8a5147);}else if(_0xf804d1['type']==='DATE'&&_['isPlainObject'](_0x8a5147)){var _0x27ed9b=JSON['parse'](_0x8a5147);var _0x1b9081={'$gte':moment(moment(_0x27ed9b[_0xd44e('0xe')])['format'](_0xd44e('0xf')))[_0xd44e('0x10')]()[_0xd44e('0x11')](),'$lte':moment(moment(_0x27ed9b[_0xd44e('0x12')])['format']('YYYY-MM-DD'))[_0xd44e('0x10')]()['subtract'](0x1,'s')[_0xd44e('0x11')]()};_0x5b4ae1[_0x2b43e4]=_0x1b9081;}else if(_0xf804d1[_0xd44e('0x13')]===_0xd44e('0x14')){_0x5b4ae1[_0x2b43e4]=_0x8a5147;}else{_0x5b4ae1[_0x2b43e4]=_[_0xd44e('0x15')](_0x8a5147)?_0x8a5147:JSON[_0xd44e('0x5')](_0x8a5147);}}else{_0x5b4ae1[_0x2b43e4]=_[_0xd44e('0x15')](_0x8a5147)?_0x8a5147:JSON[_0xd44e('0x5')](_0x8a5147);}}catch(_0x11a909){_0x5b4ae1[_0x2b43e4]=_0x8a5147[_0xd44e('0x9')](',');}});}return _0x5b4ae1;};exports['limit']=function(_0x6e9870){_0x6e9870=parseInt(_0x6e9870,0xa);if(!_0x6e9870||_0x6e9870<0x0){_0x6e9870=LIMIT_VALUE;}return _0x6e9870;};exports[_0xd44e('0x16')]=function(_0x56c60d){_0x56c60d=parseInt(_0x56c60d,0xa);if(!_0x56c60d||_0x56c60d<0x0){_0x56c60d=0x0;}return _0x56c60d;};exports[_0xd44e('0x17')]=function(_0x2eeafc){var _0x46a9dd,_0xd6d1b=null;if(_0x2eeafc){_0x46a9dd=_0x2eeafc[_0xd44e('0x9')](',');_0xd6d1b=_['map'](_0x46a9dd,function(_0x4719fe){if(_0x4719fe[_0xd44e('0x18')]('-')===0x0){return[_0x4719fe===_0xd44e('0x19')?sequelize['cast'](sequelize[_0xd44e('0x1a')](_0xd44e('0x19')),_0xd44e('0x1b')):_0x4719fe[_0xd44e('0x1c')](0x1),_0xd44e('0x1d')];}else{return[_0x4719fe===_0xd44e('0x19')?sequelize[_0xd44e('0x1e')](sequelize[_0xd44e('0x1a')](_0xd44e('0x19')),_0xd44e('0x1b')):_0x4719fe,_0xd44e('0x1f')];}});}return _0xd6d1b;};exports[_0xd44e('0x20')]=function(_0x42800f,_0x1ab1c8){if(_[_0xd44e('0xb')](_0x42800f)){return _0x42800f;}if(_[_0xd44e('0x15')](_0x42800f)){for(var _0x31a1af=0x0;_0x31a1af<_0x42800f[_0xd44e('0x21')];_0x31a1af+=0x1){_0x42800f[_0x31a1af]=this['omit'](_0x42800f[_0x31a1af],_0x1ab1c8);}return _0x42800f;}if(!_[_0xd44e('0x22')](_0x42800f)){return _0x42800f;}if(_[_0xd44e('0x23')](_0x1ab1c8)){_0x1ab1c8=[_0x1ab1c8];}if(!_[_0xd44e('0x15')](_0x1ab1c8)){return _0x42800f;}for(var _0x48a905=0x0;_0x48a905<_0x1ab1c8['length'];_0x48a905+=0x1){_[_0xd44e('0x24')](_0x42800f,_0x1ab1c8[_0x48a905]);}for(var _0x55a943 in _0x42800f){if(_0x42800f[_0xd44e('0x25')](_0x55a943)){_0x42800f[_0x55a943]=this[_0xd44e('0x20')](_0x42800f[_0x55a943],_0x1ab1c8);}}return _0x42800f;};exports[_0xd44e('0x26')]=function(_0x4f7b3f){return _0x4f7b3f['match'](RegExp(_0xd44e('0x27')))?!![]:![];};exports['isEmail']=function(_0x26d62f){return _0x26d62f[_0xd44e('0x28')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1cfbb5,_0x4b3882){var _0x17529b=[];var _0x42041f=/([^:]")"+/g;var _0x5c3dfd=/[*<>~@-]/g;var _0x34f016=/[ `!@#$%^&*()_\-?~<>]/;var _0x5d6163=/[ ,]+/;var _0xf6c1ab=_0x4b3882?'\x22{EXPR}\x22':_0xd44e('0x29');if(_0x4b3882){_0x1cfbb5=_0x1cfbb5[_0xd44e('0x2a')](_0x5c3dfd,'\x20')[_0xd44e('0x2b')]();}_0x1cfbb5[_0xd44e('0x9')](_0x5d6163)[_0xd44e('0x2c')](function(_0x5112b7){_0x5112b7=_0x5112b7['replace'](_0x42041f,'$1');_0x5112b7='+'+_0x5112b7+'*';var _0x7b1c57=_0x5112b7[_0xd44e('0x28')](_0x34f016);if(_0x7b1c57){_0x5112b7='\x22'+_0x5112b7+'\x22';}_0x17529b[_0xd44e('0x2d')](_0x5112b7);});_0xf6c1ab=_0xf6c1ab[_0xd44e('0x2a')]('{EXPR}',_0x17529b['join']('\x20'));return _0xf6c1ab;};exports['getOptions']=function(_0x4de487,_0x310431,_0xe6e327){var _0x2a4e64={},_0x1ce2fa={};if(_0x310431[_0xd44e('0x2e')][_0xd44e('0x2f')]){_0x310431[_0xd44e('0x2e')]['id']=_0x310431[_0xd44e('0x2e')][_0xd44e('0x2f')];delete _0x310431['query']['$id'];}_0x2a4e64[_0xd44e('0x6')]=_[_0xd44e('0x30')](_0x4de487,'name');_0x2a4e64[_0xd44e('0x2e')]=_[_0xd44e('0x4')](_0x310431['query']);_0x2a4e64[_0xd44e('0xa')]=_[_0xd44e('0x31')](_0x2a4e64['model'],_0x2a4e64[_0xd44e('0x2e')]);_0x1ce2fa[_0xd44e('0x32')]=_['intersection'](_0x2a4e64[_0xd44e('0x6')],this[_0xd44e('0x8')](_0x310431[_0xd44e('0x2e')][_0xd44e('0x8')]));_0x1ce2fa[_0xd44e('0x32')]=_0x1ce2fa[_0xd44e('0x32')][_0xd44e('0x21')]?_0x1ce2fa[_0xd44e('0x32')]:_0x2a4e64['model'];if(!_0x310431['query'][_0xd44e('0x25')](_0xd44e('0x33'))){_0x1ce2fa[_0xd44e('0x34')]=this[_0xd44e('0x34')](_0x310431[_0xd44e('0x2e')]['limit']);_0x1ce2fa[_0xd44e('0x16')]=this[_0xd44e('0x16')](_0x310431['query'][_0xd44e('0x16')]);}_0x1ce2fa[_0xd44e('0x35')]=this[_0xd44e('0x17')](_0x310431[_0xd44e('0x2e')][_0xd44e('0x17')]);_0x1ce2fa[_0xd44e('0x36')]=this[_0xd44e('0xa')](_['pick'](_0x310431[_0xd44e('0x2e')],_0x2a4e64['filters']),_0x4de487);if(_0x310431[_0xd44e('0x2e')][_0xd44e('0x37')]){var _0x15b9b5=_0x4de487;var _0x1c40b7=_0x310431['query']['filter'];if(typeof _0x1c40b7===_0xd44e('0x38')){_0x15b9b5=_[_0xd44e('0x37')](_0x4de487,function(_0x325dfe){return _['includes'](_0x1c40b7['columns'],_0x325dfe['name']);});_0x1c40b7=_0x1c40b7['value'];}_0x1ce2fa[_0xd44e('0x36')]=_['merge'](_0x1ce2fa[_0xd44e('0x36')],{'$or':_['map'](_0x15b9b5,function(_0x5bad37){if(_0x5bad37[_0xd44e('0x39')]!==_0xd44e('0x3a')){if(_0xe6e327){return sequelize[_0xd44e('0x36')](sequelize['fn'](_0xd44e('0x3b'),sequelize[_0xd44e('0x1a')](_0x5bad37['name'])),{'$like':sequelize['fn'](_0xd44e('0x3b'),'%'+_0x310431[_0xd44e('0x2e')]['filter']+'%')});}else{var _0x3f0a1e={};_0x3f0a1e[_0x5bad37[_0xd44e('0x13')]]={'$like':'%'+_0x310431[_0xd44e('0x2e')]['filter']+'%'};return _0x3f0a1e;}}})});}_0x1ce2fa=_[_0xd44e('0x3c')]({},_0x1ce2fa,_0x310431[_0xd44e('0x3d')]);return _0x1ce2fa;};exports[_0xd44e('0x3e')]=function(_0x24a0d3){var _0xbce919=[];if(_0x24a0d3['includeAll']){_0xbce919[_0xd44e('0x2d')]({'all':!![]});}else if(_0x24a0d3[_0xd44e('0x3e')]){if(Array[_0xd44e('0x15')](_0x24a0d3[_0xd44e('0x3e')])){_0xbce919=Object[_0xd44e('0x4')](_0x24a0d3[_0xd44e('0x3e')])[_0xd44e('0x30')](function(_0x9040ac){return parseIncludeModel(_0x24a0d3[_0xd44e('0x3e')][_0x9040ac]);});}else{var _0x38e724=parseIncludeModel(_0x24a0d3[_0xd44e('0x3e')]);_0xbce919[_0xd44e('0x2d')](_0x38e724);}}return _0xbce919;};exports[_0xd44e('0x3f')]=function(_0x57c9de){return _0x57c9de[_0xd44e('0x2a')](/[%_^-]/g,function(_0x2ffc14){return'\x5c'+_0x2ffc14;});}; \ No newline at end of file +var _0xd093=['sequelize','moment','parse','keys','includes','model','fields','raw','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','offset','sort','map','indexOf','cast','col','priority','substr','unsigned','ASC','omit','length','isObject','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','\x22{EXPR}\x22','replace','trim','forEach','{EXPR}','join','getOptions','query','$id','intersection','attributes','nolimit','limit','order','where','pick','filter','value','VIRTUAL','lower','include','includeAll','escapeLIKESpecialChars','lodash'];(function(_0x532749,_0x2fdabf){var _0x37c09e=function(_0x228041){while(--_0x228041){_0x532749['push'](_0x532749['shift']());}};_0x37c09e(++_0x2fdabf);}(_0xd093,0x185));var _0x3d09=function(_0x5a8cd4,_0x58b4b7){_0x5a8cd4=_0x5a8cd4-0x0;var _0x1967e6=_0xd093[_0x5a8cd4];return _0x1967e6;};'use strict';var _=require(_0x3d09('0x0'));var sequelize=require(_0x3d09('0x1'));var moment=require(_0x3d09('0x2'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0xf7bc64){var _0x247a2b=['ne'];try{var _0x5df45e=JSON[_0x3d09('0x3')](_0xf7bc64);var _0x3a54e7=Object[_0x3d09('0x4')](_0x5df45e)[0x0];return _0x247a2b[_0x3d09('0x5')](_0x3a54e7);}catch(_0x185784){return![];}}function getOperatorValue(_0x5af835){var _0x5cf216=JSON[_0x3d09('0x3')](_0x5af835);var _0x45ecc6=Object['keys'](_0x5cf216)[0x0];var _0x6c76ed=_0x5cf216[_0x45ecc6];return{['$'+_0x45ecc6]:_0x6c76ed};}function parseIncludeModel(_0x489d2d){var _0xadaf0b=JSON[_0x3d09('0x3')](_0x489d2d);return{'model':db[_0xadaf0b[_0x3d09('0x6')]],'as':_0xadaf0b['alias'],'attributes':_0xadaf0b[_0x3d09('0x7')],'raw':_0xadaf0b[_0x3d09('0x8')]};}exports[_0x3d09('0x7')]=function(_0x2b2831){var _0x11e006=null;if(_0x2b2831){_0x11e006=_0x2b2831[_0x3d09('0x9')](',');}return _0x11e006;};exports[_0x3d09('0xa')]=function(_0x4d977b,_0x40cf01){var _0x21439a={};if(!_[_0x3d09('0xb')](_0x4d977b)){_[_0x3d09('0xc')](_0x4d977b,function(_0x2df4f9,_0x839da2){try{if(_0x40cf01){var _0x8fc6a5=_[_0x3d09('0xd')](_0x40cf01,{'name':_0x839da2})||{};if(hasSequelizeOperator(_0x2df4f9)){_0x21439a[_0x839da2]=getOperatorValue(_0x2df4f9);}else if(_0x8fc6a5[_0x3d09('0xe')]==='DATE'&&_[_0x3d09('0xf')](_0x2df4f9)){var _0x48f0c1=JSON['parse'](_0x2df4f9);var _0x445659={'$gte':moment(moment(_0x48f0c1[_0x3d09('0x10')])[_0x3d09('0x11')](_0x3d09('0x12')))[_0x3d09('0x13')]()[_0x3d09('0x11')](),'$lte':moment(moment(_0x48f0c1[_0x3d09('0x14')])[_0x3d09('0x11')]('YYYY-MM-DD'))[_0x3d09('0x13')]()[_0x3d09('0x15')](0x1,'s')[_0x3d09('0x11')]()};_0x21439a[_0x839da2]=_0x445659;}else if(_0x8fc6a5[_0x3d09('0x16')]==='uniqueid'){_0x21439a[_0x839da2]=_0x2df4f9;}else{_0x21439a[_0x839da2]=_[_0x3d09('0x17')](_0x2df4f9)?_0x2df4f9:JSON[_0x3d09('0x3')](_0x2df4f9);}}else{_0x21439a[_0x839da2]=_['isArray'](_0x2df4f9)?_0x2df4f9:JSON[_0x3d09('0x3')](_0x2df4f9);}}catch(_0x4ead8c){_0x21439a[_0x839da2]=_0x2df4f9[_0x3d09('0x9')](',');}});}return _0x21439a;};exports['limit']=function(_0x519d35){_0x519d35=parseInt(_0x519d35,0xa);if(!_0x519d35||_0x519d35<0x0){_0x519d35=LIMIT_VALUE;}return _0x519d35;};exports[_0x3d09('0x18')]=function(_0x3fbd56){_0x3fbd56=parseInt(_0x3fbd56,0xa);if(!_0x3fbd56||_0x3fbd56<0x0){_0x3fbd56=0x0;}return _0x3fbd56;};exports[_0x3d09('0x19')]=function(_0x24d5b8){var _0x3f0b55,_0x579ffc=null;if(_0x24d5b8){_0x3f0b55=_0x24d5b8['split'](',');_0x579ffc=_[_0x3d09('0x1a')](_0x3f0b55,function(_0x44cb98){if(_0x44cb98[_0x3d09('0x1b')]('-')===0x0){return[_0x44cb98==='priority'?sequelize[_0x3d09('0x1c')](sequelize[_0x3d09('0x1d')](_0x3d09('0x1e')),'unsigned'):_0x44cb98[_0x3d09('0x1f')](0x1),'DESC'];}else{return[_0x44cb98===_0x3d09('0x1e')?sequelize[_0x3d09('0x1c')](sequelize[_0x3d09('0x1d')](_0x3d09('0x1e')),_0x3d09('0x20')):_0x44cb98,_0x3d09('0x21')];}});}return _0x579ffc;};exports[_0x3d09('0x22')]=function(_0x38a713,_0x3ec9b1){if(_[_0x3d09('0xb')](_0x38a713)){return _0x38a713;}if(_['isArray'](_0x38a713)){for(var _0x5824dc=0x0;_0x5824dc<_0x38a713[_0x3d09('0x23')];_0x5824dc+=0x1){_0x38a713[_0x5824dc]=this[_0x3d09('0x22')](_0x38a713[_0x5824dc],_0x3ec9b1);}return _0x38a713;}if(!_[_0x3d09('0x24')](_0x38a713)){return _0x38a713;}if(_['isString'](_0x3ec9b1)){_0x3ec9b1=[_0x3ec9b1];}if(!_[_0x3d09('0x17')](_0x3ec9b1)){return _0x38a713;}for(var _0x1382ab=0x0;_0x1382ab<_0x3ec9b1[_0x3d09('0x23')];_0x1382ab+=0x1){_[_0x3d09('0x25')](_0x38a713,_0x3ec9b1[_0x1382ab]);}for(var _0x272eff in _0x38a713){if(_0x38a713[_0x3d09('0x26')](_0x272eff)){_0x38a713[_0x272eff]=this[_0x3d09('0x22')](_0x38a713[_0x272eff],_0x3ec9b1);}}return _0x38a713;};exports['isNumeric']=function(_0x50204a){return _0x50204a[_0x3d09('0x27')](RegExp(_0x3d09('0x28')))?!![]:![];};exports[_0x3d09('0x29')]=function(_0x3f0a9d){return _0x3f0a9d[_0x3d09('0x27')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x25f4dd,_0x52137d){var _0x201933=[];var _0x2eda6a=/([^:]")"+/g;var _0x105259=/[*<>~@-]/g;var _0x5ce2f4=/[ `!@#$%^&*()_\-?~<>]/;var _0x569d0e=/[ ,]+/;var _0x11e34e=_0x52137d?_0x3d09('0x2a'):'{EXPR}';if(_0x52137d){_0x25f4dd=_0x25f4dd[_0x3d09('0x2b')](_0x105259,'\x20')[_0x3d09('0x2c')]();}_0x25f4dd[_0x3d09('0x9')](_0x569d0e)[_0x3d09('0x2d')](function(_0x786247){_0x786247=_0x786247['replace'](_0x2eda6a,'$1');_0x786247='+'+_0x786247+'*';var _0x47f1a9=_0x786247[_0x3d09('0x27')](_0x5ce2f4);if(_0x47f1a9){_0x786247='\x22'+_0x786247+'\x22';}_0x201933['push'](_0x786247);});_0x11e34e=_0x11e34e[_0x3d09('0x2b')](_0x3d09('0x2e'),_0x201933[_0x3d09('0x2f')]('\x20'));return _0x11e34e;};exports[_0x3d09('0x30')]=function(_0x3349ea,_0x809b90,_0xc1918d){var _0x4eee92={},_0x24f89f={};if(_0x809b90[_0x3d09('0x31')][_0x3d09('0x32')]){_0x809b90[_0x3d09('0x31')]['id']=_0x809b90[_0x3d09('0x31')][_0x3d09('0x32')];delete _0x809b90[_0x3d09('0x31')]['$id'];}_0x4eee92[_0x3d09('0x6')]=_['map'](_0x3349ea,_0x3d09('0x16'));_0x4eee92[_0x3d09('0x31')]=_[_0x3d09('0x4')](_0x809b90[_0x3d09('0x31')]);_0x4eee92[_0x3d09('0xa')]=_[_0x3d09('0x33')](_0x4eee92[_0x3d09('0x6')],_0x4eee92[_0x3d09('0x31')]);_0x24f89f[_0x3d09('0x34')]=_[_0x3d09('0x33')](_0x4eee92['model'],this[_0x3d09('0x7')](_0x809b90[_0x3d09('0x31')][_0x3d09('0x7')]));_0x24f89f[_0x3d09('0x34')]=_0x24f89f[_0x3d09('0x34')][_0x3d09('0x23')]?_0x24f89f[_0x3d09('0x34')]:_0x4eee92['model'];if(!_0x809b90[_0x3d09('0x31')][_0x3d09('0x26')](_0x3d09('0x35'))){_0x24f89f['limit']=this[_0x3d09('0x36')](_0x809b90[_0x3d09('0x31')][_0x3d09('0x36')]);_0x24f89f[_0x3d09('0x18')]=this[_0x3d09('0x18')](_0x809b90['query']['offset']);}_0x24f89f[_0x3d09('0x37')]=this['sort'](_0x809b90[_0x3d09('0x31')][_0x3d09('0x19')]);_0x24f89f[_0x3d09('0x38')]=this['filters'](_[_0x3d09('0x39')](_0x809b90[_0x3d09('0x31')],_0x4eee92[_0x3d09('0xa')]),_0x3349ea);if(_0x809b90['query'][_0x3d09('0x3a')]){var _0x66f922=_0x3349ea;var _0x2b0d6b=_0x809b90['query'][_0x3d09('0x3a')];if(typeof _0x2b0d6b==='object'){_0x66f922=_['filter'](_0x3349ea,function(_0x22f037){return _[_0x3d09('0x5')](_0x2b0d6b['columns'],_0x22f037[_0x3d09('0x16')]);});_0x2b0d6b=_0x2b0d6b[_0x3d09('0x3b')];}_0x24f89f[_0x3d09('0x38')]=_['merge'](_0x24f89f[_0x3d09('0x38')],{'$or':_[_0x3d09('0x1a')](_0x66f922,function(_0x2954c6){if(_0x2954c6[_0x3d09('0xe')]!==_0x3d09('0x3c')){if(_0xc1918d){return sequelize[_0x3d09('0x38')](sequelize['fn'](_0x3d09('0x3d'),sequelize[_0x3d09('0x1d')](_0x2954c6[_0x3d09('0x16')])),{'$like':sequelize['fn'](_0x3d09('0x3d'),'%'+_0x809b90['query'][_0x3d09('0x3a')]+'%')});}else{var _0x319b3c={};_0x319b3c[_0x2954c6['name']]={'$like':'%'+_0x809b90[_0x3d09('0x31')][_0x3d09('0x3a')]+'%'};return _0x319b3c;}}})});}_0x24f89f=_['merge']({},_0x24f89f,_0x809b90['options']);return _0x24f89f;};exports[_0x3d09('0x3e')]=function(_0x5f1827){var _0x1bc3c5=[];if(_0x5f1827[_0x3d09('0x3f')]){_0x1bc3c5['push']({'all':!![]});}else if(_0x5f1827[_0x3d09('0x3e')]){if(Array[_0x3d09('0x17')](_0x5f1827[_0x3d09('0x3e')])){_0x1bc3c5=Object[_0x3d09('0x4')](_0x5f1827[_0x3d09('0x3e')])[_0x3d09('0x1a')](function(_0x4fca8a){return parseIncludeModel(_0x5f1827[_0x3d09('0x3e')][_0x4fca8a]);});}else{var _0x2900c3=parseIncludeModel(_0x5f1827['include']);_0x1bc3c5['push'](_0x2900c3);}}return _0x1bc3c5;};exports[_0x3d09('0x40')]=function(_0x732a35){return _0x732a35['replace'](/[%_^-]/g,function(_0x532427){return'\x5c'+_0x532427;});}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index d256160..ad2e908 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 _0x8f4c=['catch','getRealtimeAgents','*pause','busy','getAgentStatus','startCase','Queue','getAgents','all','flatten','map','value','getAgentIdsByQueues','includes','resolve','User','findAll','name','chatPause','openchannelPause','smsPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','fullname','substring','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastPauseAt','address','mailPause','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum','screenrecording','phoneBarEnableScreenRecordingByAgent','whatsappPause','pick','filterAgentAttributes','role','lastLoginAt','whatsappCapacity','phoneBarEnableAutomaticScreenRecording','lodash','jayson/promise','../../mysqldb','client','http','faxPause','voicePause','every','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge'];(function(_0x2380f5,_0x47fe0e){var _0x544e32=function(_0x2d71bb){while(--_0x2d71bb){_0x2380f5['push'](_0x2380f5['shift']());}};_0x544e32(++_0x47fe0e);}(_0x8f4c,0x113));var _0xc8f4=function(_0x335ef5,_0x1a74a9){_0x335ef5=_0x335ef5-0x0;var _0xc51af9=_0x8f4c[_0x335ef5];return _0xc51af9;};'use strict';var _=require(_0xc8f4('0x0'));var jayson=require(_0xc8f4('0x1'));var db=require(_0xc8f4('0x2'))['db'];var amiClient=jayson[_0xc8f4('0x3')][_0xc8f4('0x4')]({'port':0x232a});var routingClient=jayson[_0xc8f4('0x3')]['http']({'port':0x232c});function isAgentPaused(_0x26b969,_0x47350d){var _0x133764=[_0x26b969['chatPause'],_0x26b969[_0xc8f4('0x5')],_0x26b969['mailPause'],_0x26b969['openchannelPause'],_0x26b969['smsPause'],_0x26b969[_0xc8f4('0x6')],_0x26b969['whatsappPause']];if(!_0x47350d)return _[_0xc8f4('0x7')](_0x133764);var _0x3a9ab1=_[_0xc8f4('0x8')](_0x133764);return _0x3a9ab1[_0xc8f4('0x9')]>0x0&&_0x3a9ab1[_0xc8f4('0x9')]<_0x133764['length']?!![]:![];}function isIdle(_0x38c41b){return _0x38c41b===_0xc8f4('0xa')||_0x38c41b===_0xc8f4('0xb')||_0x38c41b===_0xc8f4('0xc')||_0x38c41b==='ringing'||_[_0xc8f4('0xd')](_0x38c41b);}function isAgentIdle(_0x52c699){if(_0x52c699[_0xc8f4('0xe')]!==_0xc8f4('0xa')&&_0x52c699[_0xc8f4('0x6')]){_0x52c699[_0xc8f4('0xe')]=_0xc8f4('0xf');return![];}return _['every']([_0x52c699[_0xc8f4('0x10')],_0x52c699[_0xc8f4('0x11')],_0x52c699[_0xc8f4('0x12')],_0x52c699[_0xc8f4('0x13')],_0x52c699[_0xc8f4('0x14')],_0x52c699[_0xc8f4('0xe')],_0x52c699['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xc8f4('0x15')](_0xc8f4('0x16'),{})[_0xc8f4('0x17')](function(_0x46ac15){if(_0x46ac15[_0xc8f4('0x18')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xac45d5=_0x46ac15['result'];return routingClient['request'](_0xc8f4('0x16'),{})[_0xc8f4('0x17')](function(_0x108076){if(_0x108076[_0xc8f4('0x18')]){throw new Error(_0xc8f4('0x19'));}var _0x374761=_0x108076[_0xc8f4('0x1a')];return _[_0xc8f4('0x1b')]({},_0xac45d5,_0x374761);});})[_0xc8f4('0x1c')](function(_0x1a7bac){throw _0x1a7bac;});}exports[_0xc8f4('0x1d')]=getRealtimeAgents;function getAgentStatus(_0x3126e5){var _0x22236c='unknown';if(isAgentPaused(_0x3126e5))_0x22236c=_0xc8f4('0xf');else if(isAgentPaused(_0x3126e5,!![]))_0x22236c=_0xc8f4('0x1e');else if(isAgentIdle(_0x3126e5))_0x22236c=_0xc8f4('0xa');else _0x22236c=_0xc8f4('0x1f');return _0x22236c;}exports[_0xc8f4('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x3b42ee,_0xaeee7d){var _0x43eb57=_['isArray'](_0x3b42ee)?_0x3b42ee:[_0x3b42ee];var _0x4463aa=_[_0xc8f4('0x21')](_0xaeee7d)+_0xc8f4('0x22');var _0x1d159e=_['map'](_0x43eb57,function(_0x39174f){return db[_0x4463aa]['findOne']({'where':{'id':_0x39174f}})[_0xc8f4('0x17')](function(_0x540b25){if(!_0x540b25)return[];return _0x540b25[_0xc8f4('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xc8f4('0x24')](_0x1d159e)['then'](function(_0x41f4de){var _0x21062f=_(_0x41f4de)[_0xc8f4('0x25')]()[_0xc8f4('0x26')]('id')['uniq']()[_0xc8f4('0x27')]();return _0x21062f;});}exports[_0xc8f4('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x5db666,_0x190f61,_0x37957c){try{if(_0x190f61[_0xc8f4('0x9')]>0x0){_0x5db666=_0x5db666[_0xc8f4('0x8')](function(_0x24bef0){return _0x190f61[_0xc8f4('0x29')](_0x24bef0['id']);});}var _0x4a25da=_0x5db666[_0xc8f4('0x8')](function(_0x24bb78){var _0x1ea3d9='busy';if(isAgentIdle(_0x24bb78)){_0x1ea3d9=_0xc8f4('0xa');}return _0x1ea3d9===_0x37957c;});return _[_0xc8f4('0x26')](_0x4a25da,'id');}catch(_0x5ab6cb){throw _0x5ab6cb;}}exports['getAgentIdsByStatus']=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4d6c43,_0x2717ff,_0x323432){return Promise[_0xc8f4('0x2a')]()[_0xc8f4('0x17')](function(){if(_0x2717ff[_0xc8f4('0x9')]>0x0){_0x4d6c43=_0x4d6c43[_0xc8f4('0x8')](function(_0x3181af){return _0x2717ff[_0xc8f4('0x29')](_0x3181af['id']);});}return _0x4d6c43;})['then'](function(){return db[_0xc8f4('0x2b')][_0xc8f4('0x2c')]({'attributes':['id',_0xc8f4('0x2d'),'fullname',_0xc8f4('0x2e'),_0xc8f4('0x5'),'mailPause',_0xc8f4('0x2f'),_0xc8f4('0x30'),_0xc8f4('0x6'),'whatsappPause',_0xc8f4('0x31')],'where':{'id':{'$in':_[_0xc8f4('0x26')](_0x4d6c43,'id')}},'raw':!![]});})[_0xc8f4('0x17')](function(_0x498a84){return _0x498a84[_0xc8f4('0x26')](function(_0x45a356){var _0x4764b3=_[_0xc8f4('0x32')](_0x4d6c43,['id',_0x45a356['id']]);var _0x215203=filterAgentAttributes(_0x4764b3);_[_0xc8f4('0x1b')](_0x45a356,_0x215203);_0x45a356[_0xc8f4('0x33')]=getAgentStatus(_0x45a356);return _0x45a356;});})[_0xc8f4('0x17')](function(_0x2da6ab){var _0x2b0ee1=sortAgentsByStatus(_0x2da6ab,_0x323432);return _[_0xc8f4('0x26')](_0x2b0ee1,'id');})[_0xc8f4('0x1c')](function(_0x255888){throw _0x255888;});}exports[_0xc8f4('0x34')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x200b25){var _0x453640={'fields':[],'order':null};var _0x520c16=_0x200b25[_0xc8f4('0x35')](',');_0x453640['fields']=_[_0xc8f4('0x8')](_0x520c16,function(_0x51bfe6){if(!_0x51bfe6[_0xc8f4('0x29')](_0xc8f4('0x33'))){return!![];}_0x453640[_0xc8f4('0x36')]=_[_0xc8f4('0x37')](_0x51bfe6,'-')?_0xc8f4('0x38'):_0xc8f4('0x39');return![];});return _0x453640;}exports[_0xc8f4('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x51915d){if(!_0x51915d){_0x51915d=_0xc8f4('0x3b');}if(_0x51915d[_0xc8f4('0x29')](_0xc8f4('0x3c'))&&!_0x51915d[_0xc8f4('0x29')]('internal')){var _0x172836=_0x51915d[_0xc8f4('0x3d')](0x0,_0x51915d[_0xc8f4('0x3e')](_0xc8f4('0x3c')));_0x51915d+=','+_0x172836+_0xc8f4('0x3f');}return _0x51915d;}exports[_0xc8f4('0x40')]=validateSortParameter;function sortAgentsByStatus(_0xca3cc,_0x330a08){var _0x1eebbd=_0xca3cc[_0xc8f4('0x41')](function(_0x211aca,_0xd56415){if(_0x211aca['globalStatus']===_0xd56415[_0xc8f4('0x33')]){if(_0x211aca[_0xc8f4('0x33')]===_0xc8f4('0xf')){if(_0x330a08===_0xc8f4('0x38')){return(_0x211aca['pauseType']||'')<(_0xd56415['pauseType']||'')||_0x211aca[_0xc8f4('0x3c')][_0xc8f4('0x42')]()>_0xd56415['fullname'][_0xc8f4('0x42')]()?0x1:-0x1;}else{return(_0x211aca[_0xc8f4('0x31')]||'')<(_0xd56415['pauseType']||'')||_0x211aca['fullname'][_0xc8f4('0x42')]()>_0xd56415[_0xc8f4('0x3c')][_0xc8f4('0x42')]()?-0x1:0x1;}}else{if(_0x330a08===_0xc8f4('0x38')){return _0x211aca[_0xc8f4('0x3c')][_0xc8f4('0x42')]()<_0xd56415['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x211aca[_0xc8f4('0x3c')][_0xc8f4('0x42')]()<_0xd56415[_0xc8f4('0x3c')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x330a08==='DESC'){return _0x211aca['globalStatus']<_0xd56415['globalStatus']?0x1:-0x1;}else{return _0x211aca['globalStatus']<_0xd56415[_0xc8f4('0x33')]?-0x1:0x1;}}});return _0x1eebbd;}exports[_0xc8f4('0x43')]=sortAgentsByStatus;function filterAgentAttributes(_0x3523ab){var _0x2781b5=[_0xc8f4('0x44'),_0xc8f4('0x45'),'lastLoginAt',_0xc8f4('0x46'),_0xc8f4('0x31'),'lastPauseAt','internal',_0xc8f4('0x47'),_0xc8f4('0x2e'),_0xc8f4('0x2f'),_0xc8f4('0x48'),'smsPause','whatsappPause',_0xc8f4('0x5'),_0xc8f4('0x6'),_0xc8f4('0x49'),_0xc8f4('0x4a'),_0xc8f4('0x4b'),_0xc8f4('0x4c'),'whatsappCapacity','faxCapacity',_0xc8f4('0x4d'),_0xc8f4('0x4e'),_0xc8f4('0x4f'),_0xc8f4('0x50'),_0xc8f4('0x51'),_0xc8f4('0x52'),_0xc8f4('0x10'),_0xc8f4('0x13'),_0xc8f4('0x12'),'smsStatus','whatsappStatus',_0xc8f4('0x11'),_0xc8f4('0xe'),_0xc8f4('0x53'),_0xc8f4('0x54'),_0xc8f4('0x55'),_0xc8f4('0x56'),_0xc8f4('0x57'),_0xc8f4('0x58'),_0xc8f4('0x59'),_0xc8f4('0x5a'),_0xc8f4('0x5b'),_0xc8f4('0x5c'),_0xc8f4('0x5d'),'phoneBarEnableAutomaticScreenRecording'];var _0x3d291b=[_0xc8f4('0x2e'),_0xc8f4('0x2f'),_0xc8f4('0x48'),'smsPause',_0xc8f4('0x5e'),_0xc8f4('0x5'),'voicePause','online'];var _0x405391=_(_0x3523ab)['omit'](_0x3d291b)[_0xc8f4('0x5f')](_0x2781b5)[_0xc8f4('0x27')]();return _0x405391;}exports[_0xc8f4('0x60')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xc8f4('0x2d'),_0xc8f4('0x3c'),_0xc8f4('0x61'),_0xc8f4('0x3f'),_0xc8f4('0x45'),_0xc8f4('0x33'),_0xc8f4('0x44'),_0xc8f4('0x62'),'pauseType',_0xc8f4('0x46'),_0xc8f4('0x5'),_0xc8f4('0x2e'),_0xc8f4('0x48'),'openchannelPause',_0xc8f4('0x30'),'voicePause','whatsappPause',_0xc8f4('0x10'),_0xc8f4('0x11'),_0xc8f4('0x12'),_0xc8f4('0x13'),_0xc8f4('0x14'),_0xc8f4('0xe'),'whatsappStatus','chatStatusTime',_0xc8f4('0x58'),_0xc8f4('0x55'),_0xc8f4('0x54'),_0xc8f4('0x56'),_0xc8f4('0x59'),_0xc8f4('0x57'),_0xc8f4('0x49'),'faxCapacity',_0xc8f4('0x4b'),_0xc8f4('0x4a'),'smsCapacity',_0xc8f4('0x63'),_0xc8f4('0x4d'),_0xc8f4('0x52'),_0xc8f4('0x4f'),_0xc8f4('0x4e'),_0xc8f4('0x50'),_0xc8f4('0x51'),'phoneBarEnableScreenRecordingByAgent',_0xc8f4('0x64'),_0xc8f4('0x5b'),'onhold','queue',_0xc8f4('0x5c')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x63a5=['../../mysqldb','http','mailPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','faxStatus','mailStatus','smsStatus','whatsappStatus','request','error','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','getRealtimeAgents','busy','getAgentStatus','isArray','Queue','map','findOne','then','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','chatPause','faxPause','openchannelPause','find','merge','globalStatus','catch','fields','startsWith','ASC','getUpdatedSortOptions','fullname,internal','substring','indexOf','fullname','internal','validateSortParameter','sort','pauseType','toLowerCase','DESC','sortAgentsByStatus','userpic','lastPauseAt','address','whatsappPause','chatCapacity','mailCapacity','smsCapacity','whatsappCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatusTime','smsStatusTime','whatsappStatusTime','queue','destconnectedlinenum','online','omit','pick','filterAgentAttributes','name','role','lastLoginAt','faxStatusTime','openchannelStatusTime','voiceStatusTime','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise'];(function(_0x2903a2,_0x5e54c4){var _0x119ad9=function(_0x35fca9){while(--_0x35fca9){_0x2903a2['push'](_0x2903a2['shift']());}};_0x119ad9(++_0x5e54c4);}(_0x63a5,0x18e));var _0x563a=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x63a5[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x563a('0x0'));var jayson=require(_0x563a('0x1'));var db=require(_0x563a('0x2'))['db'];var amiClient=jayson['client'][_0x563a('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x563a('0x3')]({'port':0x232c});function isAgentPaused(_0x13195e,_0x386400){var _0x37e617=[_0x13195e['chatPause'],_0x13195e['faxPause'],_0x13195e[_0x563a('0x4')],_0x13195e['openchannelPause'],_0x13195e[_0x563a('0x5')],_0x13195e[_0x563a('0x6')],_0x13195e['whatsappPause']];if(!_0x386400)return _['every'](_0x37e617);var _0xff1f59=_[_0x563a('0x7')](_0x37e617);return _0xff1f59[_0x563a('0x8')]>0x0&&_0xff1f59[_0x563a('0x8')]<_0x37e617[_0x563a('0x8')]?!![]:![];}function isIdle(_0xa61ffa){return _0xa61ffa===_0x563a('0x9')||_0xa61ffa===_0x563a('0xa')||_0xa61ffa===_0x563a('0xb')||_0xa61ffa===_0x563a('0xc')||_[_0x563a('0xd')](_0xa61ffa);}function isAgentIdle(_0x2361dd){if(_0x2361dd[_0x563a('0xe')]!==_0x563a('0x9')&&_0x2361dd['voicePause']){_0x2361dd[_0x563a('0xe')]=_0x563a('0xf');return![];}return _[_0x563a('0x10')]([_0x2361dd[_0x563a('0x11')],_0x2361dd[_0x563a('0x12')],_0x2361dd[_0x563a('0x13')],_0x2361dd['openchannelStatus'],_0x2361dd[_0x563a('0x14')],_0x2361dd[_0x563a('0xe')],_0x2361dd[_0x563a('0x15')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x563a('0x16')]('Agents',{})['then'](function(_0x414535){if(_0x414535[_0x563a('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x2ade24=_0x414535[_0x563a('0x18')];return routingClient[_0x563a('0x16')](_0x563a('0x19'),{})['then'](function(_0x598693){if(_0x598693[_0x563a('0x17')]){throw new Error(_0x563a('0x1a'));}var _0x54a3b4=_0x598693['result'];return _['merge']({},_0x2ade24,_0x54a3b4);});})['catch'](function(_0x4c15c1){throw _0x4c15c1;});}exports[_0x563a('0x1b')]=getRealtimeAgents;function getAgentStatus(_0x300956){var _0x26061f=_0x563a('0xa');if(isAgentPaused(_0x300956))_0x26061f='pause';else if(isAgentPaused(_0x300956,!![]))_0x26061f='*pause';else if(isAgentIdle(_0x300956))_0x26061f=_0x563a('0x9');else _0x26061f=_0x563a('0x1c');return _0x26061f;}exports[_0x563a('0x1d')]=getAgentStatus;function getAgentIdsByQueues(_0x2beccb,_0x1bf502){var _0x2dc7e2=_[_0x563a('0x1e')](_0x2beccb)?_0x2beccb:[_0x2beccb];var _0x563378=_['startCase'](_0x1bf502)+_0x563a('0x1f');var _0x5422f6=_[_0x563a('0x20')](_0x2dc7e2,function(_0xd3e0ae){return db[_0x563378][_0x563a('0x21')]({'where':{'id':_0xd3e0ae}})[_0x563a('0x22')](function(_0x113ebc){if(!_0x113ebc)return[];return _0x113ebc[_0x563a('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x563a('0x24')](_0x5422f6)[_0x563a('0x22')](function(_0x4de4c3){var _0x146ea0=_(_0x4de4c3)[_0x563a('0x25')]()[_0x563a('0x20')]('id')[_0x563a('0x26')]()[_0x563a('0x27')]();return _0x146ea0;});}exports[_0x563a('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1afdff,_0x199045,_0x249db8){try{if(_0x199045[_0x563a('0x8')]>0x0){_0x1afdff=_0x1afdff[_0x563a('0x7')](function(_0x24d1a8){return _0x199045[_0x563a('0x29')](_0x24d1a8['id']);});}var _0x7696c2=_0x1afdff['filter'](function(_0x43379c){var _0x3c16d0=_0x563a('0x1c');if(isAgentIdle(_0x43379c)){_0x3c16d0='idle';}return _0x3c16d0===_0x249db8;});return _[_0x563a('0x20')](_0x7696c2,'id');}catch(_0x2e5c4b){throw _0x2e5c4b;}}exports[_0x563a('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x28a8f6,_0x166f89,_0x1f81f6){return Promise[_0x563a('0x2b')]()['then'](function(){if(_0x166f89[_0x563a('0x8')]>0x0){_0x28a8f6=_0x28a8f6[_0x563a('0x7')](function(_0x4259f6){return _0x166f89[_0x563a('0x29')](_0x4259f6['id']);});}return _0x28a8f6;})[_0x563a('0x22')](function(){return db['User']['findAll']({'attributes':['id','name','fullname',_0x563a('0x2c'),_0x563a('0x2d'),_0x563a('0x4'),_0x563a('0x2e'),_0x563a('0x5'),_0x563a('0x6'),'whatsappPause','pauseType'],'where':{'id':{'$in':_[_0x563a('0x20')](_0x28a8f6,'id')}},'raw':!![]});})[_0x563a('0x22')](function(_0x10f667){return _0x10f667[_0x563a('0x20')](function(_0x10d5d0){var _0x172289=_[_0x563a('0x2f')](_0x28a8f6,['id',_0x10d5d0['id']]);var _0x29dbc7=filterAgentAttributes(_0x172289);_[_0x563a('0x30')](_0x10d5d0,_0x29dbc7);_0x10d5d0[_0x563a('0x31')]=getAgentStatus(_0x10d5d0);return _0x10d5d0;});})[_0x563a('0x22')](function(_0x246a6){var _0x251a98=sortAgentsByStatus(_0x246a6,_0x1f81f6);return _[_0x563a('0x20')](_0x251a98,'id');})[_0x563a('0x32')](function(_0x17da2b){throw _0x17da2b;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x34b51c){var _0x733924={'fields':[],'order':null};var _0x28ac6c=_0x34b51c['split'](',');_0x733924[_0x563a('0x33')]=_['filter'](_0x28ac6c,function(_0x2c8dec){if(!_0x2c8dec[_0x563a('0x29')]('globalStatus')){return!![];}_0x733924['order']=_[_0x563a('0x34')](_0x2c8dec,'-')?'DESC':_0x563a('0x35');return![];});return _0x733924;}exports[_0x563a('0x36')]=getUpdatedSortOptions;function validateSortParameter(_0x441bb0){if(!_0x441bb0){_0x441bb0=_0x563a('0x37');}if(_0x441bb0['includes']('fullname')&&!_0x441bb0[_0x563a('0x29')]('internal')){var _0x46d471=_0x441bb0[_0x563a('0x38')](0x0,_0x441bb0[_0x563a('0x39')](_0x563a('0x3a')));_0x441bb0+=','+_0x46d471+_0x563a('0x3b');}return _0x441bb0;}exports[_0x563a('0x3c')]=validateSortParameter;function sortAgentsByStatus(_0x4bf555,_0x8f260c){var _0x4c71df=_0x4bf555[_0x563a('0x3d')](function(_0x480d67,_0x20c142){if(_0x480d67[_0x563a('0x31')]===_0x20c142[_0x563a('0x31')]){if(_0x480d67[_0x563a('0x31')]==='pause'){if(_0x8f260c==='DESC'){return(_0x480d67['pauseType']||'')<(_0x20c142[_0x563a('0x3e')]||'')||_0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()>_0x20c142[_0x563a('0x3a')][_0x563a('0x3f')]()?0x1:-0x1;}else{return(_0x480d67[_0x563a('0x3e')]||'')<(_0x20c142[_0x563a('0x3e')]||'')||_0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()>_0x20c142[_0x563a('0x3a')][_0x563a('0x3f')]()?-0x1:0x1;}}else{if(_0x8f260c===_0x563a('0x40')){return _0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()<_0x20c142[_0x563a('0x3a')][_0x563a('0x3f')]()?0x1:-0x1;}else{return _0x480d67[_0x563a('0x3a')][_0x563a('0x3f')]()<_0x20c142[_0x563a('0x3a')]['toLowerCase']()?-0x1:0x1;}}}else{if(_0x8f260c==='DESC'){return _0x480d67[_0x563a('0x31')]<_0x20c142[_0x563a('0x31')]?0x1:-0x1;}else{return _0x480d67[_0x563a('0x31')]<_0x20c142[_0x563a('0x31')]?-0x1:0x1;}}});return _0x4c71df;}exports[_0x563a('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x29b55a){var _0x9ee047=[_0x563a('0x42'),'online','lastLoginAt',_0x563a('0x43'),_0x563a('0x3e'),_0x563a('0x43'),_0x563a('0x3b'),_0x563a('0x44'),_0x563a('0x2c'),_0x563a('0x2e'),_0x563a('0x4'),'smsPause',_0x563a('0x45'),_0x563a('0x2d'),'voicePause',_0x563a('0x46'),'openchannelCapacity',_0x563a('0x47'),_0x563a('0x48'),_0x563a('0x49'),'faxCapacity',_0x563a('0x4a'),_0x563a('0x4b'),_0x563a('0x4c'),_0x563a('0x4d'),_0x563a('0x4e'),_0x563a('0x4f'),_0x563a('0x11'),_0x563a('0x50'),_0x563a('0x13'),_0x563a('0x14'),_0x563a('0x15'),_0x563a('0x12'),_0x563a('0xe'),'chatStatusTime','openchannelStatusTime',_0x563a('0x51'),_0x563a('0x52'),_0x563a('0x53'),'faxStatusTime','voiceStatusTime',_0x563a('0x54'),_0x563a('0x55'),'screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording'];var _0x1a957e=[_0x563a('0x2c'),_0x563a('0x2e'),_0x563a('0x4'),_0x563a('0x5'),_0x563a('0x45'),'faxPause','voicePause',_0x563a('0x56')];var _0x48271e=_(_0x29b55a)[_0x563a('0x57')](_0x1a957e)[_0x563a('0x58')](_0x9ee047)[_0x563a('0x27')]();return _0x48271e;}exports[_0x563a('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x563a('0x5a'),_0x563a('0x3a'),_0x563a('0x5b'),'internal',_0x563a('0x56'),_0x563a('0x31'),'userpic',_0x563a('0x5c'),_0x563a('0x3e'),_0x563a('0x43'),_0x563a('0x2d'),_0x563a('0x2c'),_0x563a('0x4'),_0x563a('0x2e'),_0x563a('0x5'),_0x563a('0x6'),_0x563a('0x45'),'chatStatus',_0x563a('0x12'),_0x563a('0x13'),'openchannelStatus','smsStatus',_0x563a('0xe'),_0x563a('0x15'),'chatStatusTime',_0x563a('0x5d'),'mailStatusTime',_0x563a('0x5e'),_0x563a('0x52'),_0x563a('0x5f'),_0x563a('0x53'),_0x563a('0x46'),'faxCapacity','mailCapacity','openchannelCapacity','smsCapacity',_0x563a('0x49'),'chatCurrentCapacity',_0x563a('0x4f'),'mailCurrentCapacity',_0x563a('0x4b'),_0x563a('0x4d'),_0x563a('0x4e'),_0x563a('0x60'),_0x563a('0x61'),'destconnectedlinenum',_0x563a('0x62'),'queue','screenrecording'];}exports[_0x563a('0x63')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 921dfe9..de70dbf 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 _0x738a=['message','statusMessage','dialActive','dialMethod','startPredictive','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','concat','map','get','paused','voice','busy','find','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','waiting','inUse','invalid','notInUse','ringing','talking','unavailable','pTalking','originated'];(function(_0xa46ae9,_0x1344b8){var _0x199641=function(_0x18fe65){while(--_0x18fe65){_0xa46ae9['push'](_0xa46ae9['shift']());}};_0x199641(++_0x1344b8);}(_0x738a,0x185));var _0xa738=function(_0x550651,_0x32926b){_0x550651=_0x550651-0x0;var _0x53edcf=_0x738a[_0x550651];return _0x53edcf;};'use strict';var _=require(_0xa738('0x0'));var jayson=require(_0xa738('0x1'));var util=require(_0xa738('0x2'));var amiClient=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0xa738('0x3')][_0xa738('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xa738('0x5'),_0xa738('0x6'),'paused',_0xa738('0x7')];var VOICE_QUEUE_ATTRIBUTES=['busy',_0xa738('0x8'),_0xa738('0x9'),'loggedInDb',_0xa738('0xa'),'onHold',_0xa738('0xb'),'ringInUse',_0xa738('0xc'),_0xa738('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0xa738('0xe'),_0xa738('0xf'),_0xa738('0x10'),_0xa738('0x11'),_0xa738('0x12'),_0xa738('0x13'),'Trunk',_0xa738('0x14'),'startProgressive','erlangCalls',_0xa738('0x15'),'erlangAbandonmentRate',_0xa738('0x16'),_0xa738('0x17'),_0xa738('0x18'),_0xa738('0x19'),'predictiveIntervalAvailable',_0xa738('0x1a'),_0xa738('0x1b'),'predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x3d282f,_0x157483){var _0x598b6c=_0x157483==='voice'?amiClient:routingClient;return _0x598b6c['request'](_[_0xa738('0x1c')](_0x157483)+_0xa738('0x1d'),_0x3d282f)[_0xa738('0x1e')](function(_0x30dffc){if(_0x30dffc[_0xa738('0x1f')])throw new Error(util[_0xa738('0x20')](_0xa738('0x21'),_0x157483));return _0x30dffc[_0xa738('0x22')];})[_0xa738('0x23')](function(_0x249fcc){throw _0x249fcc;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x2b1f06,_0x150927,_0x3536fe,_0x334549){var _0x5aa211=DEFAULT_QUEUE_ATTRIBUTES;if(_0x3536fe==='voice'){if(_0x334549==='inbound'){_0x5aa211=_0x5aa211[_0xa738('0x24')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x334549==='outbound'){_0x5aa211=_0x5aa211[_0xa738('0x24')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x2b1f06[_0xa738('0x25')](function(_0x4d7671){var _0x8d4206=_0x4d7671[_0xa738('0x26')]({'plain':!![]});_0x8d4206[_0xa738('0x27')]=0x0;_0x8d4206['loggedInDb']=0x0;_0x8d4206['loggedIn']=0x0;_0x8d4206[_0xa738('0x5')]=0x0;_0x8d4206[_0xa738('0x7')]=0x0;if(_0x3536fe===_0xa738('0x28')){_0x8d4206[_0xa738('0xc')]=0x0;_0x8d4206[_0xa738('0x29')]=0x0;if(_0x334549==='outbound'){_0x8d4206['pTalking']=0x0;_0x8d4206[_0xa738('0xf')]=0x0;}}var _0x4d8b28=_[_0xa738('0x2a')](_0x150927,['id',_0x8d4206['id']]);if(_0x4d8b28){_['merge'](_0x8d4206,_[_0xa738('0x2b')](_0x4d8b28,_0x5aa211));}return _0x8d4206;});}exports[_0xa738('0x2c')]=initializeQueues; \ No newline at end of file +var _0xc6d0=['concat','outbound','map','get','paused','available','find','merge','pick','jayson/promise','util','client','http','loggedIn','busy','inUse','invalid','loggedInDb','notInUse','onHold','ringing','unavailable','pTalking','originated','statusMessage','dialActive','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound'];(function(_0x18b32d,_0x5b5432){var _0x11a467=function(_0x54aea4){while(--_0x54aea4){_0x18b32d['push'](_0x18b32d['shift']());}};_0x11a467(++_0x5b5432);}(_0xc6d0,0xa2));var _0x0c6d=function(_0x4a6262,_0x4bfb8c){_0x4a6262=_0x4a6262-0x0;var _0x10385a=_0xc6d0[_0x4a6262];return _0x10385a;};'use strict';var _=require('lodash');var jayson=require(_0x0c6d('0x0'));var util=require(_0x0c6d('0x1'));var amiClient=jayson[_0x0c6d('0x2')][_0x0c6d('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x0c6d('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available',_0x0c6d('0x4'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x0c6d('0x5'),_0x0c6d('0x6'),_0x0c6d('0x7'),_0x0c6d('0x8'),_0x0c6d('0x9'),_0x0c6d('0xa'),_0x0c6d('0xb'),'ringInUse','talking',_0x0c6d('0xc'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x0c6d('0xd'),_0x0c6d('0xe'),'message',_0x0c6d('0xf'),_0x0c6d('0x10'),'dialMethod',_0x0c6d('0x11'),_0x0c6d('0x12'),_0x0c6d('0x13'),_0x0c6d('0x14'),_0x0c6d('0x15'),'erlangAbandonmentRate',_0x0c6d('0x16'),_0x0c6d('0x17'),'dialPredictiveIntervalMaxThreshold',_0x0c6d('0x18'),_0x0c6d('0x19'),_0x0c6d('0x1a'),_0x0c6d('0x1b'),_0x0c6d('0x1c'),_0x0c6d('0x1d'),_0x0c6d('0x1e'),_0x0c6d('0x1f')];function getRealtimeQueues(_0x83acb0,_0x539821){var _0x203e25=_0x539821===_0x0c6d('0x20')?amiClient:routingClient;return _0x203e25[_0x0c6d('0x21')](_[_0x0c6d('0x22')](_0x539821)+'Queues',_0x83acb0)[_0x0c6d('0x23')](function(_0xec92ce){if(_0xec92ce[_0x0c6d('0x24')])throw new Error(util[_0x0c6d('0x25')](_0x0c6d('0x26'),_0x539821));return _0xec92ce[_0x0c6d('0x27')];})[_0x0c6d('0x28')](function(_0x2ec5e2){throw _0x2ec5e2;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x1eb4aa,_0x1ccb75,_0x446b6c,_0x57d35c){var _0x2dd3f8=DEFAULT_QUEUE_ATTRIBUTES;if(_0x446b6c===_0x0c6d('0x20')){if(_0x57d35c===_0x0c6d('0x29')){_0x2dd3f8=_0x2dd3f8[_0x0c6d('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x57d35c===_0x0c6d('0x2b')){_0x2dd3f8=_0x2dd3f8['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x1eb4aa[_0x0c6d('0x2c')](function(_0x87417c){var _0x2563de=_0x87417c[_0x0c6d('0x2d')]({'plain':!![]});_0x2563de[_0x0c6d('0x2e')]=0x0;_0x2563de[_0x0c6d('0x8')]=0x0;_0x2563de['loggedIn']=0x0;_0x2563de[_0x0c6d('0x2f')]=0x0;_0x2563de['waiting']=0x0;if(_0x446b6c===_0x0c6d('0x20')){_0x2563de['talking']=0x0;_0x2563de[_0x0c6d('0x5')]=0x0;if(_0x57d35c===_0x0c6d('0x2b')){_0x2563de['pTalking']=0x0;_0x2563de[_0x0c6d('0xe')]=0x0;}}var _0x460608=_[_0x0c6d('0x30')](_0x1ccb75,['id',_0x2563de['id']]);if(_0x460608){_[_0x0c6d('0x31')](_0x2563de,_[_0x0c6d('0x32')](_0x460608,_0x2dd3f8));}return _0x2563de;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5fd0d32..229bb5a 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(_0x129a57,_0x330d03){var _0xa7147c=function(_0x4e6c1f){while(--_0x4e6c1f){_0x129a57['push'](_0x129a57['shift']());}};_0xa7147c(++_0x330d03);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x5f1617,_0x46277b){var _0x3af5da=function(_0x15b934){while(--_0x15b934){_0x5f1617['push'](_0x5f1617['shift']());}};_0x3af5da(++_0x46277b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'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 fa7db81..15268c5 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 _0x5c58=['dmidecode\x20--string\x20system-uuid','utf8','macAddress','ipAddress','createHash','update','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length','filter','family','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','cpus','join','md5','digest','hex','getUuid','platform','licenseToken','test','win32'];(function(_0x3035a1,_0x39f021){var _0x279691=function(_0x1cc873){while(--_0x1cc873){_0x3035a1['push'](_0x3035a1['shift']());}};_0x279691(++_0x39f021);}(_0x5c58,0x1e3));var _0x85c5=function(_0x14374a,_0x138abb){_0x14374a=_0x14374a-0x0;var _0x37217e=_0x5c58[_0x14374a];return _0x37217e;};'use strict';var _=require(_0x85c5('0x0'));var os=require('os');var crypto=require(_0x85c5('0x1'));var machine=require(_0x85c5('0x2'));var exec=require(_0x85c5('0x3'))[_0x85c5('0x4')];var config=require(_0x85c5('0x5'));function getInterfaces(){var _0x2cb8e1=[];var _0x44e180=os[_0x85c5('0x6')]();var _0x217e15=_[_0x85c5('0x7')](_['keys'](_0x44e180));for(var _0x9b7a4d=0x0;_0x9b7a4d<_0x217e15[_0x85c5('0x8')];_0x9b7a4d++){var _0x2a0168=_0x44e180[_0x217e15[_0x9b7a4d]][_0x85c5('0x9')](function(_0xf7dfab){return _0xf7dfab[_0x85c5('0xa')]==='IPv4'&&_0xf7dfab['internal']===![];});_0x2cb8e1=_0x2cb8e1[_0x85c5('0xb')](_0x2a0168);}return _0x2cb8e1;}function getFirstInterface(){var _0x1ba2cb=_[_0x85c5('0xc')](getInterfaces());return{'macAddress':_0x1ba2cb&&_0x1ba2cb[_0x85c5('0xd')]?_0x1ba2cb[_0x85c5('0xd')]:_0x85c5('0xe'),'ipAddress':_0x1ba2cb&&_0x1ba2cb[_0x85c5('0xf')]?_0x1ba2cb['address']:_0x85c5('0x10')};}exports['getFirstInterface']=getFirstInterface;function getCPUhash(){var _0x582172=_[_0x85c5('0x7')](os[_0x85c5('0x11')]()['map'](function(_0x1dd7e0){return _0x1dd7e0['model'];}))[_0x85c5('0x12')](':');return crypto['createHash'](_0x85c5('0x13'))['update'](_0x582172)[_0x85c5('0x14')](_0x85c5('0x15'));}exports[_0x85c5('0x16')]=function(){var _0x4af6c6=os[_0x85c5('0x17')]();var _0x15167d=/[0-9a-f-]{36}/;if(config[_0x85c5('0x18')]&&_0x15167d[_0x85c5('0x19')](config[_0x85c5('0x18')])){return config[_0x85c5('0x18')];}else if(_0x4af6c6===_0x85c5('0x1a')){return exec(_0x85c5('0x1b'),{'encoding':_0x85c5('0x1c')})['replace']('\x0d\x0a','');}else{var _0x151662=getFirstInterface();var _0x57eec9=getCPUhash();var _0x501b18=_0x57eec9+'|'+os['hostname']()+'|'+_0x151662[_0x85c5('0x1d')]+'|'+_0x151662[_0x85c5('0x1e')];var _0x482847=crypto[_0x85c5('0x1f')](_0x85c5('0x13'))[_0x85c5('0x20')](_0x501b18)[_0x85c5('0x14')]('hex');return _0x482847[_0x85c5('0x21')](0x0,0x8)+'-'+_0x482847[_0x85c5('0x21')](0x8,0xc)+'-'+_0x482847[_0x85c5('0x21')](0xc,0x10)+'-'+_0x482847[_0x85c5('0x21')](0x10,0x14)+'-'+_0x482847[_0x85c5('0x21')](0x14);}}; \ No newline at end of file +var _0x6913=['ipAddress','update','digest','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','networkInterfaces','orderBy','length','filter','IPv4','concat','head','mac','address','getFirstInterface','map','model','join','createHash','md5','hex','getUuid','platform','licenseToken','test','win32','utf8','hostname','macAddress'];(function(_0x1b94c1,_0x3b4769){var _0x38c1ad=function(_0x1bca2f){while(--_0x1bca2f){_0x1b94c1['push'](_0x1b94c1['shift']());}};_0x38c1ad(++_0x3b4769);}(_0x6913,0x190));var _0x3691=function(_0x221035,_0x15a7e7){_0x221035=_0x221035-0x0;var _0x181c2b=_0x6913[_0x221035];return _0x181c2b;};'use strict';var _=require(_0x3691('0x0'));var os=require('os');var crypto=require(_0x3691('0x1'));var machine=require(_0x3691('0x2'));var exec=require(_0x3691('0x3'))[_0x3691('0x4')];var config=require('../environment');function getInterfaces(){var _0x1bf592=[];var _0xa31cae=os[_0x3691('0x5')]();var _0x2ab518=_[_0x3691('0x6')](_['keys'](_0xa31cae));for(var _0x4682b7=0x0;_0x4682b7<_0x2ab518[_0x3691('0x7')];_0x4682b7++){var _0x23fed0=_0xa31cae[_0x2ab518[_0x4682b7]][_0x3691('0x8')](function(_0x3dfb1c){return _0x3dfb1c['family']===_0x3691('0x9')&&_0x3dfb1c['internal']===![];});_0x1bf592=_0x1bf592[_0x3691('0xa')](_0x23fed0);}return _0x1bf592;}function getFirstInterface(){var _0x1116da=_[_0x3691('0xb')](getInterfaces());return{'macAddress':_0x1116da&&_0x1116da[_0x3691('0xc')]?_0x1116da[_0x3691('0xc')]:'00:00:00:00:00:00','ipAddress':_0x1116da&&_0x1116da[_0x3691('0xd')]?_0x1116da[_0x3691('0xd')]:'127.0.0.1'};}exports[_0x3691('0xe')]=getFirstInterface;function getCPUhash(){var _0x281ef8=_[_0x3691('0x6')](os['cpus']()[_0x3691('0xf')](function(_0x311dc2){return _0x311dc2[_0x3691('0x10')];}))[_0x3691('0x11')](':');return crypto[_0x3691('0x12')](_0x3691('0x13'))['update'](_0x281ef8)['digest'](_0x3691('0x14'));}exports[_0x3691('0x15')]=function(){var _0x11b156=os[_0x3691('0x16')]();var _0x404867=/[0-9a-f-]{36}/;if(config[_0x3691('0x17')]&&_0x404867[_0x3691('0x18')](config[_0x3691('0x17')])){return config['licenseToken'];}else if(_0x11b156===_0x3691('0x19')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x3691('0x1a')})['replace']('\x0d\x0a','');}else{var _0x588450=getFirstInterface();var _0x3b568f=getCPUhash();var _0x1b3ace=_0x3b568f+'|'+os[_0x3691('0x1b')]()+'|'+_0x588450[_0x3691('0x1c')]+'|'+_0x588450[_0x3691('0x1d')];var _0x4b1df5=crypto[_0x3691('0x12')](_0x3691('0x13'))[_0x3691('0x1e')](_0x1b3ace)[_0x3691('0x1f')](_0x3691('0x14'));return _0x4b1df5[_0x3691('0x20')](0x0,0x8)+'-'+_0x4b1df5['substring'](0x8,0xc)+'-'+_0x4b1df5['substring'](0xc,0x10)+'-'+_0x4b1df5[_0x3691('0x20')](0x10,0x14)+'-'+_0x4b1df5[_0x3691('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 76a68cf..67b8398 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 _0x3c88=['message','finally','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','moment','request-promise','bluebird','pkginfo','version','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','GET','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','decryptString','days','DEMO\x20START\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','then'];(function(_0x4066ac,_0x33f50e){var _0x3ce385=function(_0x152a26){while(--_0x152a26){_0x4066ac['push'](_0x4066ac['shift']());}};_0x3ce385(++_0x33f50e);}(_0x3c88,0x1f3));var _0x83c8=function(_0x159663,_0x222e4d){_0x159663=_0x159663-0x0;var _0x39d088=_0x3c88[_0x159663];return _0x39d088;};'use strict';var util=require(_0x83c8('0x0'));var moment=require(_0x83c8('0x1'));var rp=require(_0x83c8('0x2'));var BPromise=require(_0x83c8('0x3'));var pkginfo=require(_0x83c8('0x4'))(module,_0x83c8('0x5'));var db=require(_0x83c8('0x6'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0x83c8('0x7'));var logger=require(_0x83c8('0x8'))(_0x83c8('0x9'));var HOST=_0x83c8('0xa');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xdf80a6){return new BPromise(function(_0x34bde5,_0x58bb61){var _0x451996=util[_0x83c8('0xb')](_0x83c8('0xc'),HOST,_0xdf80a6,module[_0x83c8('0xd')][_0x83c8('0x5')]);if(oldToken){_0x451996=util[_0x83c8('0xb')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0xdf80a6,module[_0x83c8('0xd')][_0x83c8('0x5')],oldToken);}var _0x4e713e={'uri':_0x451996,'method':_0x83c8('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x4e713e)['then'](function(_0x1214c3){_0x34bde5(_0x1214c3);})[_0x83c8('0xf')](function(_0x2b90f5){_0x58bb61(_0x2b90f5);});});}function manageLicense(_0x26fbf3,_0x37b7c4){var _0x4a6db7=_0x37b7c4['get']({'plain':!![]});if(!isOldTokenSent&&_0x4a6db7[_0x83c8('0x10')]!==_0x26fbf3&&!_0x4a6db7[_0x83c8('0x11')]){oldToken=_0x4a6db7[_0x83c8('0x10')];}httpRequest(_0x26fbf3)['then'](function(_0x4663df){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x4663df[_0x83c8('0x12')]){isOldTokenSent=![];if(!_0x4a6db7[_0x83c8('0x9')]&&_0x4a6db7[_0x83c8('0x9')]!=_0x4663df[_0x83c8('0x9')]||_0x4a6db7[_0x83c8('0x9')]&&_0x4a6db7[_0x83c8('0x11')]){logger[_0x83c8('0x13')](_0x83c8('0x14'));}if(_0x4a6db7[_0x83c8('0x9')]&&!_0x4a6db7['data2']&&_0x4a6db7['license']!=_0x4663df[_0x83c8('0x9')]){logger[_0x83c8('0x13')](_0x83c8('0x15'));}if(_0x4a6db7[_0x83c8('0x9')]&&!_0x4a6db7[_0x83c8('0x11')]&&_0x4a6db7[_0x83c8('0x9')]==_0x4663df[_0x83c8('0x9')]){return _0x37b7c4;}return _0x37b7c4[_0x83c8('0x16')]({'data1':_0x26fbf3,'data2':null,'license':_0x4663df[_0x83c8('0x9')]});}else{if(_0x4663df[_0x83c8('0x9')]||_0x4a6db7['license']){if(!_0x4a6db7[_0x83c8('0x11')]){if(_0x4a6db7[_0x83c8('0x10')]==_0x26fbf3){GRAY_PERIOD_REASON=_0x83c8('0x17');logger[_0x83c8('0x13')](_0x83c8('0x18'));}else{GRAY_PERIOD_REASON=_0x83c8('0x19');logger[_0x83c8('0x13')](_0x83c8('0x1a'),_0x4a6db7[_0x83c8('0x10')],_0x26fbf3);}logger[_0x83c8('0x13')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x83c8('0x1b')](),moment()[_0x83c8('0xb')]('YYYY-MM-DD\x20HH:mm'));return _0x37b7c4[_0x83c8('0x16')]({'data2':encryptor[_0x83c8('0x1c')](moment()[_0x83c8('0xb')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()['diff'](encryptor[_0x83c8('0x1d')](_0x4a6db7[_0x83c8('0x11')]),_0x83c8('0x1e'))>DAYS){logger['info'](_0x83c8('0x1f'),moment()[_0x83c8('0xb')](_0x83c8('0x20')));isOldTokenSent=![];return _0x37b7c4[_0x83c8('0x16')]({'data1':_0x26fbf3,'data2':null,'license':null});}}}else{if(_0x4a6db7[_0x83c8('0x10')]!=_0x26fbf3){logger[_0x83c8('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4a6db7[_0x83c8('0x10')],_0x26fbf3);return _0x37b7c4[_0x83c8('0x16')]({'data1':_0x26fbf3,'data2':null,'license':null});}}}return _0x37b7c4;})[_0x83c8('0x21')](function(_0x890903){_0x37b7c4=_0x890903;})[_0x83c8('0xf')](function(_0x4e3202){logger['error'](_0x4e3202[_0x83c8('0x22')]);})[_0x83c8('0x23')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x37b7c4);},TIME);});}function defaultLicense(){var _0x443116=hardware['getUuid']();if(_0x443116){return db[_0x83c8('0x24')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x443116}})[_0x83c8('0x25')](function(_0x35ae7d,_0xae6abe){logger[_0x83c8('0x13')](_0x83c8('0x26'),_0x443116);manageLicense(_0x443116,_0x35ae7d);})['catch'](function(_0x310515){logger[_0x83c8('0x27')](_0x310515['message']);});}}exports[_0x83c8('0x28')]=defaultLicense; \ No newline at end of file +var _0x1c5a=['decryptString','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','moment','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','encryptString','YYYY-MM-DD\x20HH:mm'];(function(_0x5834ca,_0x3c0256){var _0x202321=function(_0x35e4ed){while(--_0x35e4ed){_0x5834ca['push'](_0x5834ca['shift']());}};_0x202321(++_0x3c0256);}(_0x1c5a,0xcd));var _0xa1c5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x1c5a[_0x13b02f];return _0x12e9a6;};'use strict';var util=require('util');var moment=require(_0xa1c5('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0xa1c5('0x1'))(module,_0xa1c5('0x2'));var db=require(_0xa1c5('0x3'))['db'];var encryptor=require(_0xa1c5('0x4'));var hardware=require(_0xa1c5('0x5'));var logger=require('../logger')(_0xa1c5('0x6'));var HOST=_0xa1c5('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1c9aa6){return new BPromise(function(_0x4be64a,_0x12ff71){var _0x4a29aa=util[_0xa1c5('0x8')](_0xa1c5('0x9'),HOST,_0x1c9aa6,module[_0xa1c5('0xa')][_0xa1c5('0x2')]);if(oldToken){_0x4a29aa=util[_0xa1c5('0x8')](_0xa1c5('0xb'),HOST,_0x1c9aa6,module[_0xa1c5('0xa')]['version'],oldToken);}var _0x12b22b={'uri':_0x4a29aa,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x12b22b)[_0xa1c5('0xc')](function(_0x3dda1d){_0x4be64a(_0x3dda1d);})[_0xa1c5('0xd')](function(_0x47592b){_0x12ff71(_0x47592b);});});}function manageLicense(_0x8b2f36,_0x12ef99){var _0x4fb0e7=_0x12ef99[_0xa1c5('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x4fb0e7[_0xa1c5('0xf')]!==_0x8b2f36&&!_0x4fb0e7['data2']){oldToken=_0x4fb0e7['data1'];}httpRequest(_0x8b2f36)[_0xa1c5('0xc')](function(_0x6aabc4){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x6aabc4[_0xa1c5('0x10')]){isOldTokenSent=![];if(!_0x4fb0e7[_0xa1c5('0x6')]&&_0x4fb0e7[_0xa1c5('0x6')]!=_0x6aabc4[_0xa1c5('0x6')]||_0x4fb0e7['license']&&_0x4fb0e7[_0xa1c5('0x11')]){logger[_0xa1c5('0x12')](_0xa1c5('0x13'));}if(_0x4fb0e7['license']&&!_0x4fb0e7[_0xa1c5('0x11')]&&_0x4fb0e7[_0xa1c5('0x6')]!=_0x6aabc4[_0xa1c5('0x6')]){logger['info'](_0xa1c5('0x14'));}if(_0x4fb0e7[_0xa1c5('0x6')]&&!_0x4fb0e7[_0xa1c5('0x11')]&&_0x4fb0e7[_0xa1c5('0x6')]==_0x6aabc4['license']){return _0x12ef99;}return _0x12ef99[_0xa1c5('0x15')]({'data1':_0x8b2f36,'data2':null,'license':_0x6aabc4[_0xa1c5('0x6')]});}else{if(_0x6aabc4[_0xa1c5('0x6')]||_0x4fb0e7[_0xa1c5('0x6')]){if(!_0x4fb0e7[_0xa1c5('0x11')]){if(_0x4fb0e7['data1']==_0x8b2f36){GRAY_PERIOD_REASON=_0xa1c5('0x16');logger[_0xa1c5('0x12')](_0xa1c5('0x17'));}else{GRAY_PERIOD_REASON=_0xa1c5('0x18');logger[_0xa1c5('0x12')](_0xa1c5('0x19'),_0x4fb0e7['data1'],_0x8b2f36);}logger['info'](_0xa1c5('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xa1c5('0x8')]('YYYY-MM-DD\x20HH:mm'));return _0x12ef99[_0xa1c5('0x15')]({'data2':encryptor[_0xa1c5('0x1b')](moment()['format'](_0xa1c5('0x1c')))});}else{if(moment()['diff'](encryptor[_0xa1c5('0x1d')](_0x4fb0e7['data2']),_0xa1c5('0x1e'))>DAYS){logger[_0xa1c5('0x12')](_0xa1c5('0x1f'),moment()[_0xa1c5('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x12ef99[_0xa1c5('0x15')]({'data1':_0x8b2f36,'data2':null,'license':null});}}}else{if(_0x4fb0e7['data1']!=_0x8b2f36){logger[_0xa1c5('0x12')](_0xa1c5('0x19'),_0x4fb0e7['data1'],_0x8b2f36);return _0x12ef99[_0xa1c5('0x15')]({'data1':_0x8b2f36,'data2':null,'license':null});}}}return _0x12ef99;})['then'](function(_0x2b16e2){_0x12ef99=_0x2b16e2;})[_0xa1c5('0xd')](function(_0xbfea6e){logger[_0xa1c5('0x20')](_0xbfea6e[_0xa1c5('0x21')]);})[_0xa1c5('0x22')](function(){setTimeout(function(){manageLicense(hardware[_0xa1c5('0x23')](),_0x12ef99);},TIME);});}function defaultLicense(){var _0x55c586=hardware[_0xa1c5('0x23')]();if(_0x55c586){return db['License'][_0xa1c5('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x55c586}})[_0xa1c5('0x25')](function(_0x3917a7,_0x39da08){logger[_0xa1c5('0x12')](_0xa1c5('0x26'),_0x55c586);manageLicense(_0x55c586,_0x3917a7);})[_0xa1c5('0xd')](function(_0x394339){logger[_0xa1c5('0x20')](_0x394339[_0xa1c5('0x21')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 9367306..6a7107e 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 _0xc4e3=['./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','Breaking\x20license','getUuid','License','find','defaults','then','catch','uuid','data1','license','isEmpty','split','decryptString','format','%s:%s:%s','parse','machineUuid','gray','add','grayReason','changed','disabled','message','findAll','role','sequelize','COUNT','col','admin','telephone','users','telephones','forEach','user','count','pick','countBy','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','lodash','moment','bluebird'];(function(_0x1bbf9e,_0x2efe4b){var _0x3741eb=function(_0x5a8bf0){while(--_0x5a8bf0){_0x1bbf9e['push'](_0x1bbf9e['shift']());}};_0x3741eb(++_0x2efe4b);}(_0xc4e3,0x1dd));var _0x3c4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc4e3[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x3c4e('0x0'));var moment=require(_0x3c4e('0x1'));var BPromise=require(_0x3c4e('0x2'));var hardware=require(_0x3c4e('0x3'));var encryptor=require(_0x3c4e('0x4'));var db=require(_0x3c4e('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3c4e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3c4e('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x3c4e('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3c4e('0x8'),'machineUuid':hardware[_0x3c4e('0x9')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0xc32a25){return new BPromise(function(_0x971fd8,_0x3ffdcb){return db[_0x3c4e('0xa')][_0x3c4e('0xb')](_[_0x3c4e('0xc')](_0xc32a25,{'raw':!![],'where':{'id':0x1}}))[_0x3c4e('0xd')](function(_0x17bf7f){return checkLicense(_0x17bf7f,null);})['then'](function(_0xf45df7){_0x971fd8(_0xf45df7);return;})[_0x3c4e('0xe')](function(_0x496185){_0x3ffdcb(_0x496185);});});}function checkLicense(_0x4aa416,_0x2c92a7){if(!_0x4aa416){demoLicense[_0x3c4e('0xf')]=_0x4aa416[_0x3c4e('0x10')];return demoLicense;}try{var _0x231691=_0x2c92a7||_0x4aa416[_0x3c4e('0x11')];if(_[_0x3c4e('0x12')](_0x231691)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x2d4940=_0x4aa416[_0x3c4e('0x10')];var _0x41bf8d=_0x4aa416['data2'];var _0x15d132=_0x2d4940[_0x3c4e('0x13')]('-')[0x4];var _0x4b9152=_0x2d4940[_0x3c4e('0x13')]('-')[0x0];var _0x1bb8a6=encryptor[_0x3c4e('0x14')](_0x231691,util[_0x3c4e('0x15')](_0x3c4e('0x16'),_0x15d132,_0x2d4940,_0x4b9152));var _0x1ee6c=JSON[_0x3c4e('0x17')](_0x1bb8a6);_0x1ee6c['demo']=![];_0x1ee6c[_0x3c4e('0xf')]=_0x2d4940;_0x1ee6c[_0x3c4e('0x18')]=hardware['getUuid']();if(_0x41bf8d){var _0x3d2ea8=encryptor[_0x3c4e('0x14')](_0x41bf8d);_0x1ee6c[_0x3c4e('0x19')]=_0x3d2ea8;_0x1ee6c['deadline']=moment(_0x3d2ea8)[_0x3c4e('0x1a')](0x7,'days')[_0x3c4e('0x15')]();_0x1ee6c[_0x3c4e('0x1b')]=_0x1ee6c['uuid']!=_0x1ee6c[_0x3c4e('0x18')]?_0x3c4e('0x1c'):_0x3c4e('0x1d');}return _0x1ee6c;}catch(_0x296c7c){breakingLicense[_0x3c4e('0xf')]=_0x4aa416['data1'];breakingLicense[_0x3c4e('0x1e')]=_0x296c7c[_0x3c4e('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x4a3218,_0x418993){getLicense()[_0x3c4e('0xd')](function(_0x183b01){return db['User'][_0x3c4e('0x1f')]({'attributes':[_0x3c4e('0x20'),[db[_0x3c4e('0x21')]['fn'](_0x3c4e('0x22'),db['sequelize'][_0x3c4e('0x23')](_0x3c4e('0x20'))),'count']],'group':'role','where':{'role':{'$or':[_0x3c4e('0x24'),'user',_0x3c4e('0x25')]}},'raw':!![]})['then'](function(_0x382914){var _0x82c3a1={'user':_0x183b01[_0x3c4e('0x26')]||0x0,'telephone':_0x183b01[_0x3c4e('0x27')]||0x0};_0x382914[_0x3c4e('0x28')](function(_0x49e48b){var _0x2c5743=_0x49e48b[_0x3c4e('0x20')]===_0x3c4e('0x24')?_0x3c4e('0x29'):_0x49e48b[_0x3c4e('0x20')];_0x82c3a1[_0x2c5743]-=_0x49e48b[_0x3c4e('0x2a')];if(_0x82c3a1[_0x2c5743]<0x0)_0x82c3a1[_0x2c5743]=0x0;});_0x4a3218(_0x82c3a1);return;});})[_0x3c4e('0xe')](function(_0x149295){_0x418993(_0x149295);});});}function checkUserLimits(_0x162eea){return new BPromise(function(_0x24c8f7,_0x3351d1){getLimits()['then'](function(_0x21038c){var _0x4e3eb4=_[_0x3c4e('0x2b')](_[_0x3c4e('0x2c')](_0x162eea,_0x3c4e('0x20')),['admin',_0x3c4e('0x29'),_0x3c4e('0x25')]);var _0x165e73=(_0x4e3eb4['admin']||0x0)+(_0x4e3eb4[_0x3c4e('0x29')]||0x0);var _0x78486=_0x4e3eb4[_0x3c4e('0x25')]||0x0;if(_0x165e73>_0x21038c[_0x3c4e('0x29')])return _0x3351d1(_0x3c4e('0x2d'));if(_0x78486>_0x21038c[_0x3c4e('0x25')])return _0x3351d1(_0x3c4e('0x2e'));return _0x24c8f7();})['catch'](function(_0x317200){_0x3351d1(_0x317200);});});}module[_0x3c4e('0x2f')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x8a61=['telephone','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','License\x20key\x20value\x20not\x20found','data2','split','%s:%s:%s','parse','demo','machineUuid','decryptString','gray','deadline','days','format','changed','disabled','message','User','findAll','sequelize','COUNT','role','count','admin','user'];(function(_0x3dae0d,_0x3ecfdb){var _0x1e7d06=function(_0x4312b2){while(--_0x4312b2){_0x3dae0d['push'](_0x3dae0d['shift']());}};_0x1e7d06(++_0x3ecfdb);}(_0x8a61,0x1f4));var _0x18a6=function(_0x212e7a,_0x32e0d){_0x212e7a=_0x212e7a-0x0;var _0x445799=_0x8a61[_0x212e7a];return _0x445799;};'use strict';var util=require(_0x18a6('0x0'));var _=require(_0x18a6('0x1'));var moment=require(_0x18a6('0x2'));var BPromise=require(_0x18a6('0x3'));var hardware=require('./hardware');var encryptor=require(_0x18a6('0x4'));var db=require(_0x18a6('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18a6('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x18a6('0x7'),'machineUuid':hardware[_0x18a6('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x18a6('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x18a6('0x9'),'machineUuid':hardware[_0x18a6('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x528e5a){return new BPromise(function(_0x523824,_0x3d8213){return db[_0x18a6('0xa')][_0x18a6('0xb')](_[_0x18a6('0xc')](_0x528e5a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x222300){return checkLicense(_0x222300,null);})[_0x18a6('0xd')](function(_0x5a7e2a){_0x523824(_0x5a7e2a);return;})[_0x18a6('0xe')](function(_0x8a13bd){_0x3d8213(_0x8a13bd);});});}function checkLicense(_0x5eb7ed,_0x184b5e){if(!_0x5eb7ed){demoLicense[_0x18a6('0xf')]=_0x5eb7ed[_0x18a6('0x10')];return demoLicense;}try{var _0x521f14=_0x184b5e||_0x5eb7ed['license'];if(_['isEmpty'](_0x521f14)){throw new Error(_0x18a6('0x11'));}var _0x14e7e1=_0x5eb7ed[_0x18a6('0x10')];var _0x48528d=_0x5eb7ed[_0x18a6('0x12')];var _0x566f82=_0x14e7e1[_0x18a6('0x13')]('-')[0x4];var _0x597a8a=_0x14e7e1['split']('-')[0x0];var _0x1638fe=encryptor['decryptString'](_0x521f14,util['format'](_0x18a6('0x14'),_0x566f82,_0x14e7e1,_0x597a8a));var _0x533b5a=JSON[_0x18a6('0x15')](_0x1638fe);_0x533b5a[_0x18a6('0x16')]=![];_0x533b5a[_0x18a6('0xf')]=_0x14e7e1;_0x533b5a[_0x18a6('0x17')]=hardware['getUuid']();if(_0x48528d){var _0x29482a=encryptor[_0x18a6('0x18')](_0x48528d);_0x533b5a[_0x18a6('0x19')]=_0x29482a;_0x533b5a[_0x18a6('0x1a')]=moment(_0x29482a)['add'](0x7,_0x18a6('0x1b'))[_0x18a6('0x1c')]();_0x533b5a['grayReason']=_0x533b5a['uuid']!=_0x533b5a[_0x18a6('0x17')]?_0x18a6('0x1d'):_0x18a6('0x1e');}return _0x533b5a;}catch(_0x27a7a6){breakingLicense[_0x18a6('0xf')]=_0x5eb7ed['data1'];breakingLicense[_0x18a6('0x1f')]=_0x27a7a6[_0x18a6('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x303ef5,_0x585487){getLicense()[_0x18a6('0xd')](function(_0x1f4d03){return db[_0x18a6('0x20')][_0x18a6('0x21')]({'attributes':['role',[db[_0x18a6('0x22')]['fn'](_0x18a6('0x23'),db[_0x18a6('0x22')]['col'](_0x18a6('0x24'))),_0x18a6('0x25')]],'group':_0x18a6('0x24'),'where':{'role':{'$or':[_0x18a6('0x26'),_0x18a6('0x27'),_0x18a6('0x28')]}},'raw':!![]})[_0x18a6('0xd')](function(_0x1129fd){var _0x45ac50={'user':_0x1f4d03['users']||0x0,'telephone':_0x1f4d03['telephones']||0x0};_0x1129fd['forEach'](function(_0x1c64b7){var _0x180ada=_0x1c64b7[_0x18a6('0x24')]===_0x18a6('0x26')?_0x18a6('0x27'):_0x1c64b7[_0x18a6('0x24')];_0x45ac50[_0x180ada]-=_0x1c64b7[_0x18a6('0x25')];if(_0x45ac50[_0x180ada]<0x0)_0x45ac50[_0x180ada]=0x0;});_0x303ef5(_0x45ac50);return;});})[_0x18a6('0xe')](function(_0x12d275){_0x585487(_0x12d275);});});}function checkUserLimits(_0x5d2038){return new BPromise(function(_0x4cc22d,_0xe38499){getLimits()['then'](function(_0x46d7ae){var _0x3d22fc=_[_0x18a6('0x29')](_[_0x18a6('0x2a')](_0x5d2038,_0x18a6('0x24')),[_0x18a6('0x26'),_0x18a6('0x27'),'telephone']);var _0x3e57e1=(_0x3d22fc[_0x18a6('0x26')]||0x0)+(_0x3d22fc[_0x18a6('0x27')]||0x0);var _0x2e9dfd=_0x3d22fc[_0x18a6('0x28')]||0x0;if(_0x3e57e1>_0x46d7ae[_0x18a6('0x27')])return _0xe38499(_0x18a6('0x2b'));if(_0x2e9dfd>_0x46d7ae['telephone'])return _0xe38499('License\x20limit\x20reached\x20for\x20telephones');return _0x4cc22d();})[_0x18a6('0xe')](function(_0x651bfc){_0xe38499(_0x651bfc);});});}module[_0x18a6('0x2c')]={'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 af16a77..c661081 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 _0x5b12=['http://localhost:9000','myappanuglar-secret','secret','exports'];(function(_0x291443,_0x2a03aa){var _0x42c01b=function(_0x3ae538){while(--_0x3ae538){_0x291443['push'](_0x291443['shift']());}};_0x42c01b(++_0x2a03aa);}(_0x5b12,0xa3));var _0x25b1=function(_0x2e7248,_0x30be45){_0x2e7248=_0x2e7248-0x0;var _0x3848f5=_0x5b12[_0x2e7248];return _0x3848f5;};'use strict';module[_0x25b1('0x0')]={'DOMAIN':_0x25b1('0x1'),'SESSION_SECRET':_0x25b1('0x2'),'GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x25b1('0x3'),'DEBUG':''}; \ No newline at end of file +var _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xfb11[_0x550d12];return _0x12103d;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index f1e30d0..1977fef 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedcc=['../utils/loggers'];(function(_0x28dfa7,_0x821042){var _0x5d02b9=function(_0x161d72){while(--_0x161d72){_0x28dfa7['push'](_0x28dfa7['shift']());}};_0x5d02b9(++_0x821042);}(_0xedcc,0x137));var _0xcedc=function(_0x5d2d37,_0x1901dd){_0x5d2d37=_0x5d2d37-0x0;var _0x6374f6=_0xedcc[_0x5d2d37];return _0x6374f6;};'use strict';var fileLogger=require(_0xcedc('0x0'))['fileLogger'];module['exports']=fileLogger; \ No newline at end of file +var _0x26b5=['fileLogger','exports'];(function(_0x1f2c8c,_0x14e047){var _0x15086b=function(_0x406d4e){while(--_0x406d4e){_0x1f2c8c['push'](_0x1f2c8c['shift']());}};_0x15086b(++_0x14e047);}(_0x26b5,0x1d6));var _0x526b=function(_0x356123,_0x5c816f){_0x356123=_0x356123-0x0;var _0xc89fd9=_0x26b5[_0x356123];return _0xc89fd9;};'use strict';var fileLogger=require('../utils/loggers')[_0x526b('0x0')];module[_0x526b('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 5fa1163..4c41915 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 _0xed42=['../../services/xdr/index.js','exports','path','../../config/environment','join','express','../../services/express/index.js','ami','agi','email','routing','../../services/routing/index.js','xdr'];(function(_0x4912ca,_0x1345b0){var _0x1b8006=function(_0x232d71){while(--_0x232d71){_0x4912ca['push'](_0x4912ca['shift']());}};_0x1b8006(++_0x1345b0);}(_0xed42,0x154));var _0x2ed4=function(_0x548961,_0x5a13d0){_0x548961=_0x548961-0x0;var _0x31593d=_0xed42[_0x548961];return _0x31593d;};'use strict';var path=require(_0x2ed4('0x0'));var cfg=require(_0x2ed4('0x1'));var env={'NODE_PATH':path['resolve'](path[_0x2ed4('0x2')](cfg['root'],'legacy-libs'))};var pm2config={'apps':[{'name':_0x2ed4('0x3'),'script':path['join'](__dirname,_0x2ed4('0x4')),'env':env},{'name':_0x2ed4('0x5'),'script':path['join'](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x2ed4('0x6'),'script':path[_0x2ed4('0x2')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x2ed4('0x7'),'script':path[_0x2ed4('0x2')](__dirname,'../../services/email/index.js'),'env':env},{'name':_0x2ed4('0x8'),'script':path[_0x2ed4('0x2')](__dirname,_0x2ed4('0x9')),'env':env},{'name':_0x2ed4('0xa'),'script':path[_0x2ed4('0x2')](__dirname,_0x2ed4('0xb')),'env':env}]};module[_0x2ed4('0xc')]=pm2config; \ No newline at end of file +var _0xc4a3=['exports','../../config/environment','resolve','join','root','legacy-libs','express','../../services/express/index.js','ami','../../services/ami/index.js','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js'];(function(_0xafa225,_0xd29c03){var _0x4f546a=function(_0x565b3f){while(--_0x565b3f){_0xafa225['push'](_0xafa225['shift']());}};_0x4f546a(++_0xd29c03);}(_0xc4a3,0x1dd));var _0x3c4a=function(_0x8ae1c9,_0x1c61ab){_0x8ae1c9=_0x8ae1c9-0x0;var _0x18b221=_0xc4a3[_0x8ae1c9];return _0x18b221;};'use strict';var path=require('path');var cfg=require(_0x3c4a('0x0'));var env={'NODE_PATH':path[_0x3c4a('0x1')](path[_0x3c4a('0x2')](cfg[_0x3c4a('0x3')],_0x3c4a('0x4')))};var pm2config={'apps':[{'name':_0x3c4a('0x5'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0x6')),'env':env},{'name':_0x3c4a('0x7'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0x8')),'env':env},{'name':'agi','script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0x9')),'env':env},{'name':_0x3c4a('0xa'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0xb')),'env':env},{'name':_0x3c4a('0xc'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0xd')),'env':env},{'name':_0x3c4a('0xe'),'script':path[_0x3c4a('0x2')](__dirname,_0x3c4a('0xf')),'env':env}]};module[_0x3c4a('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 4776e4a..e87ce1c 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 _0xf9e3=['pm2','connect','connected','start','disconnect','stop','then','list','describe','delete','dump','saved'];(function(_0x21eb10,_0x4837ee){var _0x2be61d=function(_0xfa6769){while(--_0xfa6769){_0x21eb10['push'](_0x21eb10['shift']());}};_0x2be61d(++_0x4837ee);}(_0xf9e3,0x108));var _0x3f9e=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xf9e3[_0x2aecb2];return _0x3ebb80;};'use strict';var pm2=require(_0x3f9e('0x0'));var BPromise=require('bluebird');var config=require('./config');function connect(){return new BPromise(function(_0x40557f,_0x48b066){return pm2[_0x3f9e('0x1')](function(_0x283965){if(_0x283965){return _0x48b066(_0x283965);}return _0x40557f(_0x3f9e('0x2'));});});};exports[_0x3f9e('0x3')]=function(_0x7538bd){return connect()['then'](function(){return new BPromise(function(_0xfd5e95,_0x1a6e4c){return pm2['start'](_0x7538bd,function(_0x3aa9bb,_0x2fc601){if(_0x3aa9bb){return _0x1a6e4c(_0x3aa9bb);}pm2[_0x3f9e('0x4')]();return _0xfd5e95(_0x2fc601);});});});};exports[_0x3f9e('0x5')]=function(_0x20486b){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x5cc591,_0x3f60a0){return pm2[_0x3f9e('0x5')](_0x20486b,function(_0x353dff,_0xa024b5){if(_0x353dff){return _0x3f60a0(_0x353dff);}pm2['disconnect']();return _0x5cc591(_0xa024b5);});});});};exports['restart']=function(_0x12a161){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x22856c,_0x223457){return pm2['restart'](_0x12a161,function(_0x212116,_0xdb84cb){if(_0x212116){return _0x223457(_0x212116);}pm2[_0x3f9e('0x4')]();return _0x22856c(_0xdb84cb);});});});};exports[_0x3f9e('0x7')]=function(){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0xa5793a,_0x4066ff){return pm2[_0x3f9e('0x7')](function(_0x5d0577,_0x4616e4){if(_0x5d0577){return _0x4066ff(_0x5d0577);}pm2['disconnect']();return _0xa5793a(_0x4616e4);});});});};exports[_0x3f9e('0x8')]=function(_0x4b37d3){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x427f6a,_0x2b98ad){return pm2[_0x3f9e('0x8')](_0x4b37d3,function(_0x553125,_0x41dd9c){if(_0x553125){return _0x2b98ad(_0x553125);}pm2['disconnect']();return _0x427f6a(_0x41dd9c);});});});};exports[_0x3f9e('0x9')]=function(_0x240099){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x565a5f,_0x4936d7){return pm2[_0x3f9e('0x9')](_0x240099,function(_0x265bbf,_0x32682c){if(_0x265bbf){return _0x4936d7(_0x265bbf);}pm2[_0x3f9e('0x4')]();return _0x565a5f(_0x32682c);});});});};exports[_0x3f9e('0xa')]=function(){return connect()[_0x3f9e('0x6')](function(){return new BPromise(function(_0x2fed,_0x47bdec){return pm2[_0x3f9e('0xa')](function(_0x3fbb0d){if(_0x3fbb0d){return _0x47bdec(_0x3fbb0d);}return _0x2fed(_0x3f9e('0xb'));});});});}; \ No newline at end of file +var _0x99a0=['delete','dump','pm2','bluebird','connected','then','start','disconnect','stop','restart','list','describe'];(function(_0x2d6726,_0x5bdc68){var _0x156978=function(_0x104163){while(--_0x104163){_0x2d6726['push'](_0x2d6726['shift']());}};_0x156978(++_0x5bdc68);}(_0x99a0,0x9e));var _0x099a=function(_0x1e0d90,_0x379210){_0x1e0d90=_0x1e0d90-0x0;var _0x5efe91=_0x99a0[_0x1e0d90];return _0x5efe91;};'use strict';var pm2=require(_0x099a('0x0'));var BPromise=require(_0x099a('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x1217f1,_0x324516){return pm2['connect'](function(_0x1a05ad){if(_0x1a05ad){return _0x324516(_0x1a05ad);}return _0x1217f1(_0x099a('0x2'));});});};exports['start']=function(_0xa411d3){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x2594e0,_0x3c4389){return pm2[_0x099a('0x4')](_0xa411d3,function(_0x1af84e,_0x30c92e){if(_0x1af84e){return _0x3c4389(_0x1af84e);}pm2[_0x099a('0x5')]();return _0x2594e0(_0x30c92e);});});});};exports[_0x099a('0x6')]=function(_0x412028){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x5cc427,_0x3b141b){return pm2[_0x099a('0x6')](_0x412028,function(_0x48a676,_0x7f1dbe){if(_0x48a676){return _0x3b141b(_0x48a676);}pm2['disconnect']();return _0x5cc427(_0x7f1dbe);});});});};exports[_0x099a('0x7')]=function(_0x4438ca){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x50b948,_0xe20ef7){return pm2[_0x099a('0x7')](_0x4438ca,function(_0x3b6441,_0x48d0d4){if(_0x3b6441){return _0xe20ef7(_0x3b6441);}pm2[_0x099a('0x5')]();return _0x50b948(_0x48d0d4);});});});};exports[_0x099a('0x8')]=function(){return connect()['then'](function(){return new BPromise(function(_0x387714,_0x250c69){return pm2['list'](function(_0x4437bf,_0x3213a6){if(_0x4437bf){return _0x250c69(_0x4437bf);}pm2['disconnect']();return _0x387714(_0x3213a6);});});});};exports[_0x099a('0x9')]=function(_0x5b1647){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x299b4b,_0x2138c0){return pm2['describe'](_0x5b1647,function(_0x4c7f8a,_0x379c72){if(_0x4c7f8a){return _0x2138c0(_0x4c7f8a);}pm2['disconnect']();return _0x299b4b(_0x379c72);});});});};exports[_0x099a('0xa')]=function(_0x2019aa){return connect()['then'](function(){return new BPromise(function(_0x476fbd,_0x3855f9){return pm2[_0x099a('0xa')](_0x2019aa,function(_0xa0b020,_0x4254c6){if(_0xa0b020){return _0x3855f9(_0xa0b020);}pm2['disconnect']();return _0x476fbd(_0x4254c6);});});});};exports[_0x099a('0xb')]=function(){return connect()[_0x099a('0x3')](function(){return new BPromise(function(_0x4ec0fc,_0x29d411){return pm2[_0x099a('0xb')](function(_0x3c513c){if(_0x3c513c){return _0x29d411(_0x3c513c);}return _0x4ec0fc('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index fb1b22f..8eff55b 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 _0x6a66=['Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','info','[CHAT]\x20Interactions\x20to\x20close:','system','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','length','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','socket.io-emitter'];(function(_0x3213b7,_0x6789ca){var _0xb960bf=function(_0x2f7f04){while(--_0x2f7f04){_0x3213b7['push'](_0x3213b7['shift']());}};_0xb960bf(++_0x6789ca);}(_0x6a66,0xa0));var _0x66a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6a66[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require(_0x66a6('0x0'));var util=require(_0x66a6('0x1'));var config=require(_0x66a6('0x2'));var db=require('../../mysqldb')['db'];var logger=require(_0x66a6('0x3'))(_0x66a6('0x4'));config[_0x66a6('0x5')]=_[_0x66a6('0x6')](config[_0x66a6('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x66a6('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x51ac41=0x0;var _0x41ed3a=[];return db[_0x66a6('0x8')][_0x66a6('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x66a6('0xa')](function(_0x2147ff){_0x51ac41=_0x2147ff[_0x66a6('0xb')];if(_0x51ac41){return db[_0x66a6('0xc')][_0x66a6('0xd')]({'raw':!![],'attributes':['id',_0x66a6('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x66a6('0xf')](_0x2147ff[_0x66a6('0xb')],'minutes')}}});}else{return[];}})[_0x66a6('0xa')](function(_0x43a0c6){if(_0x43a0c6&&_0x43a0c6['length']){_0x41ed3a=_['map'](_0x43a0c6||[],'id');logger[_0x66a6('0x10')](_0x66a6('0x11'),_0x41ed3a['join']());return db[_0x66a6('0xc')]['update']({'closeReason':_0x66a6('0x12'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0x66a6('0x13')](_0x66a6('0x14'))},{'where':{'id':_0x41ed3a}});}})['then'](function(){if(_0x41ed3a&&_0x41ed3a['length']){logger[_0x66a6('0x10')](_0x66a6('0x15'),_0x41ed3a['join']());for(var _0x7fa519=0x0;_0x7fa519<_0x41ed3a[_0x66a6('0x16')];_0x7fa519++){io['emit'](_0x66a6('0x17'),{'id':_0x41ed3a[_0x7fa519],'closed':!![]});}}})[_0x66a6('0x18')](function(_0xcaeaac){logger[_0x66a6('0x19')](_0x66a6('0x1a'),_0xcaeaac?util['inspect'](_0xcaeaac,{'showHidden':![],'depth':null}):'');});}exports[_0x66a6('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xaf3e=['then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','timeout','format','emit','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment','../logger','schedule','redis','localhost','socket.io-emitter','Setting','chatTimeout'];(function(_0x38485f,_0x61ffb1){var _0x3f6813=function(_0x38bc83){while(--_0x38bc83){_0x38485f['push'](_0x38485f['shift']());}};_0x3f6813(++_0x61ffb1);}(_0xaf3e,0x1ed));var _0xeaf3=function(_0x3f7598,_0x212e37){_0x3f7598=_0x3f7598-0x0;var _0x51fb16=_0xaf3e[_0x3f7598];return _0x51fb16;};'use strict';var _=require('lodash');var moment=require(_0xeaf3('0x0'));var Redis=require(_0xeaf3('0x1'));var util=require(_0xeaf3('0x2'));var config=require(_0xeaf3('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xeaf3('0x4'))(_0xeaf3('0x5'));config[_0xeaf3('0x6')]=_['defaults'](config[_0xeaf3('0x6')],{'host':_0xeaf3('0x7'),'port':0x18eb});var io=require(_0xeaf3('0x8'))(new Redis(config[_0xeaf3('0x6')]));function closeInteractions(){var _0x50f2b6=0x0;var _0x493a87=[];return db[_0xeaf3('0x9')]['find']({'raw':!![],'attributes':['id',_0xeaf3('0xa')],'where':{'id':0x1}})[_0xeaf3('0xb')](function(_0x27e660){_0x50f2b6=_0x27e660[_0xeaf3('0xa')];if(_0x50f2b6){return db[_0xeaf3('0xc')][_0xeaf3('0xd')]({'raw':!![],'attributes':['id',_0xeaf3('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xeaf3('0xf')](_0x27e660[_0xeaf3('0xa')],_0xeaf3('0x10'))}}});}else{return[];}})[_0xeaf3('0xb')](function(_0x3b2055){if(_0x3b2055&&_0x3b2055[_0xeaf3('0x11')]){_0x493a87=_[_0xeaf3('0x12')](_0x3b2055||[],'id');logger[_0xeaf3('0x13')](_0xeaf3('0x14'),_0x493a87['join']());return db['ChatInteraction']['update']({'closeReason':'system','disposition':_0xeaf3('0x15'),'closed':!![],'closedAt':moment()[_0xeaf3('0x16')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x493a87}});}})[_0xeaf3('0xb')](function(){if(_0x493a87&&_0x493a87[_0xeaf3('0x11')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x493a87['join']());for(var _0x7deac3=0x0;_0x7deac3<_0x493a87[_0xeaf3('0x11')];_0x7deac3++){io[_0xeaf3('0x17')]('chatInteraction:update',{'id':_0x493a87[_0x7deac3],'closed':!![]});}}})['catch'](function(_0x40c09e){logger[_0xeaf3('0x18')](_0xeaf3('0x19'),_0x40c09e?util[_0xeaf3('0x1a')](_0x40c09e,{'showHidden':![],'depth':null}):'');});}exports[_0xeaf3('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 a839f19..c84bdf9 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. * // * * // ************************************************************************* -'use strict';function start(){var _0x3e8ca0=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x3e8ca0['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x8b71=['../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals','exports'];(function(_0x39157f,_0x3d8c1e){var _0x1ae4e2=function(_0x3429af){while(--_0x3429af){_0x39157f['push'](_0x39157f['shift']());}};_0x1ae4e2(++_0x3d8c1e);}(_0x8b71,0x13b));var _0x18b7=function(_0x35e169,_0x3e6b0f){_0x35e169=_0x35e169-0x0;var _0xf0313b=_0x8b71[_0x35e169];return _0xf0313b;};'use strict';function start(){var _0x28d299=require(_0x18b7('0x0'));return _0x28d299[_0x18b7('0x1')]();}module[_0x18b7('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index af6ceae..5f9da46 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 _0x79e7=['stop','still\x20loading','case\x20completed','data','case\x20empty','dataValues','attempt','Job\x20ID\x20','\x20Attempt\x20#:','sendMail','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','exec\x20defaul\x20report\x20id:%s','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','Schedule','findAll','MailServerOut','CloudProvider','map','difference','intersection','length','toString','exists','deleteJob','delete\x20cron','resolve','cron','active','isBetween','startAt','add','add\x20cron','stop\x20cron','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','../logger','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','\x22%s\x22\x20<%s>','Smtp','user','bcc','format','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','../../files/reports','savename','%s.%s','basename','extname','zip','join','existsSync','status','message','attachments','text','stringify','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','case\x20loading','retryOptions','job','operation'];(function(_0x578fd7,_0x12660f){var _0x5e8c73=function(_0x35fa21){while(--_0x35fa21){_0x578fd7['push'](_0x578fd7['shift']());}};_0x5e8c73(++_0x12660f);}(_0x79e7,0x14c));var _0x779e=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x79e7[_0xfae23b];return _0x200640;};'use strict';var fs=require('fs');var util=require(_0x779e('0x0'));var path=require(_0x779e('0x1'));var _=require(_0x779e('0x2'));var moment=require(_0x779e('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x779e('0x4'));var BPromise=require(_0x779e('0x5'));var logger=require(_0x779e('0x6'))('schedule');var db=require('../../mysqldb')['db'];const retry=require(_0x779e('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x779e('0x8'));var client=jayson[_0x779e('0x9')][_0x779e('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x1b2b9d){const _0x4a1303={};if(typeof _0x1b2b9d==='number'){_0x4a1303['id']=_0x1b2b9d;}return db['AnalyticExtractedReport']['findOne']({'where':_0x4a1303})[_0x779e('0xb')](function(_0x11a8bd){return _0x11a8bd;})[_0x779e('0xc')](function(_0x55f992){logger[_0x779e('0xd')](_0x55f992);});}function handleSendEmail(_0x1e5c37,_0x180f25){logger[_0x779e('0xe')](_0x779e('0xf'),_0x1e5c37[_0x779e('0x10')]);var _0x42f41e=!![];var _0x5b587d=_0x1e5c37[_0x779e('0x11')]['getSmtpOptions']();var _0x3fe9b5={'account':_0x5b587d,'message':{'from':util['format'](_0x779e('0x12'),_0x1e5c37[_0x779e('0x11')]['name'],_0x1e5c37[_0x779e('0x11')]['email']||_0x1e5c37[_0x779e('0x11')][_0x779e('0x13')][_0x779e('0x14')]),'to':_0x1e5c37[_0x779e('0x10')],'cc':_0x1e5c37['cc'],'bcc':_0x1e5c37[_0x779e('0x15')],'subject':util[_0x779e('0x16')](_0x779e('0x17'),_0x180f25[_0x779e('0x18')],_0x1e5c37[_0x779e('0x19')],_0x1e5c37['subtractUnit'])}};var _0x23c2c1=path['join'](__dirname,_0x779e('0x1a'));var _0x419ed3=_0x180f25[_0x779e('0x1b')];var _0x460773=util[_0x779e('0x16')](_0x779e('0x1c'),path[_0x779e('0x1d')](_0x180f25[_0x779e('0x1b')],path[_0x779e('0x1e')](_0x180f25[_0x779e('0x1b')])),_0x779e('0x1f'));var _0x36b66e=path['join'](_0x23c2c1,_0x419ed3);var _0x33e766=path[_0x779e('0x20')](_0x23c2c1,_0x460773);if(fs[_0x779e('0x21')](_0x36b66e)){_0x180f25[_0x779e('0x22')]='Sent';_0x3fe9b5[_0x779e('0x23')][_0x779e('0x24')]=[{'filename':_0x419ed3,'path':_0x36b66e}];_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]=util[_0x779e('0x16')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x779e('0x26')](_0x180f25,null,0x2));}else if(fs[_0x779e('0x21')](_0x33e766)){_0x180f25['status']='Sent';_0x3fe9b5['message'][_0x779e('0x24')]=[{'filename':_0x460773,'path':_0x33e766}];}else{if(_0x180f25[_0x779e('0x22')]==='Empty'){_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x1e5c37['sendIfEmpty']){_0x42f41e=![];logger[_0x779e('0xe')](_0x779e('0x27'));}}else if(_0x180f25[_0x779e('0x22')]===_0x779e('0x28')){_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]=_0x779e('0x29');}else if(_0x180f25[_0x779e('0x22')]===_0x779e('0x2a')){_0x3fe9b5[_0x779e('0x23')][_0x779e('0x25')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x180f25['status']===_0x779e('0x2b')){_0x3fe9b5[_0x779e('0x23')]['text']='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger['error'](_0x779e('0x2c'),_0x180f25['status']);}}if(_0x42f41e){return client[_0x779e('0x2d')](_0x779e('0x2e'),_0x3fe9b5)['then'](function(_0x2c71c5){if(_0x2c71c5[_0x779e('0xd')]){return logger[_0x779e('0xd')](_0x779e('0x2f'),JSON['stringify'](_0x2c71c5));}return logger[_0x779e('0xe')]('email\x20sent');})['catch'](function(_0x4bae9a){return logger[_0x779e('0xd')]('error\x20mail',JSON[_0x779e('0x26')](_0x4bae9a));});}}function handleError(){return function(_0x239d56){return logger['error'](JSON[_0x779e('0x26')](_0x239d56));};}function loading(_0x113c1c){logger[_0x779e('0xe')](_0x779e('0x30'));if(_0x113c1c['currentAttempt']===_0x113c1c[_0x779e('0x31')]['retries']){handleSendEmail(_0x113c1c[_0x779e('0x32')],_0x113c1c['data']);_0x113c1c[_0x779e('0x33')][_0x779e('0x34')]();}else{_0x113c1c[_0x779e('0x33')]['retry'](_0x779e('0x35'));}}function completed(_0x3b8941){logger['info'](_0x779e('0x36'));handleSendEmail(_0x3b8941[_0x779e('0x32')],_0x3b8941[_0x779e('0x37')]);_0x3b8941[_0x779e('0x33')]['stop']();}function empty(_0x1a2a72){logger[_0x779e('0xe')](_0x779e('0x38'));handleSendEmail(_0x1a2a72[_0x779e('0x32')],_0x1a2a72[_0x779e('0x37')]);_0x1a2a72[_0x779e('0x33')]['stop']();}function failed(_0x29f7ea){logger[_0x779e('0xe')]('case\x20failed');handleSendEmail(_0x29f7ea[_0x779e('0x32')],_0x29f7ea[_0x779e('0x37')]);_0x29f7ea[_0x779e('0x33')][_0x779e('0x34')]();}function urecognized(_0x4bafd6){logger['error']('Unrecognized\x20status:',_0x4bafd6['entity'][_0x779e('0x39')][_0x779e('0x22')]);_0x4bafd6[_0x779e('0x33')][_0x779e('0x34')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x4aede8,_0xcc51e8){const _0x504a2a={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x4692f9=retry[_0x779e('0x33')](_0x504a2a);_0x4692f9[_0x779e('0x3a')](_0xc30c0a=>{logger[_0x779e('0xe')](_0x779e('0x3b')+_0x4aede8['id']+_0x779e('0x3c')+_0xc30c0a);try{getReportData(_0xcc51e8['id'])['then'](function(_0x3c2919){_0xcc51e8=_0x3c2919;logger['info']('report\x20status:',_0x3c2919[_0x779e('0x39')][_0x779e('0x22')]);if(!reportStatusStrategies[_0x3c2919[_0x779e('0x39')]['status']]){logger[_0x779e('0xd')]('report\x20status:',_0x3c2919[_0x779e('0x39')][_0x779e('0x22')]);_0x4692f9[_0x779e('0x7')]();}reportStatusStrategies[_0x3c2919[_0x779e('0x39')]['status']]({'operation':_0x4692f9,'currentAttempt':_0xc30c0a,'retryOptions':_0x504a2a,'job':_0x4aede8,'data':_0xcc51e8,'entity':_0x3c2919});});}catch(_0x2f9572){_0x4692f9[_0x779e('0x7')](_0x2f9572);}});}function handleResult(_0x1e2a11){return function(_0x610844){if(_0x1e2a11[_0x779e('0x3d')]&&_0x1e2a11[_0x779e('0x11')]&&_0x1e2a11[_0x779e('0x11')][_0x779e('0x13')]&&!_[_0x779e('0x3e')](_0x1e2a11['email'])){retryer(_0x1e2a11,_0x610844);}};}function handleJob(_0x4a561a){return function(){try{if(_[_0x779e('0x3e')](_0x4a561a['subtractNumber'])){return logger[_0x779e('0xe')](_0x779e('0x3f'));}if(_['isNil'](_0x4a561a[_0x779e('0x40')])){return logger['info'](_0x779e('0x41'));}var _0xb76dd={'startDate':moment()['subtract'](_0x4a561a[_0x779e('0x19')],_0x4a561a[_0x779e('0x40')])[_0x779e('0x16')](_0x779e('0x42')),'endDate':moment()[_0x779e('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x4a561a[_0x779e('0x43')],'name':_0x4a561a[_0x779e('0x18')]};if(!_['isNil'](_0x4a561a[_0x779e('0x44')])){logger[_0x779e('0xe')](_0x779e('0x45'),_0x4a561a[_0x779e('0x44')]);return analyticDefaultReportController[_0x779e('0x46')]({'id':_0x4a561a[_0x779e('0x44')]},_0xb76dd)[_0x779e('0xb')](handleResult(_0x4a561a))[_0x779e('0xc')](handleError());}if(!_[_0x779e('0x3e')](_0x4a561a['CustomReportId'])){logger[_0x779e('0xe')](_0x779e('0x47'),_0x4a561a[_0x779e('0x48')]);return analyticCustomReportController[_0x779e('0x46')]({'id':_0x4a561a[_0x779e('0x48')]},_0xb76dd)[_0x779e('0xb')](handleResult(_0x4a561a))[_0x779e('0xc')](handleError());}}catch(_0x2dcf58){logger['error'](JSON[_0x779e('0x26')](_0x2dcf58));}return logger[_0x779e('0xe')]('no\x20report\x20id');};}function getJobs(_0x27647a){var _0x3cec87={};if(_0x27647a){_0x3cec87['id']=_0x27647a;}return db[_0x779e('0x49')][_0x779e('0x4a')]({'where':_0x3cec87,'include':[{'model':db[_0x779e('0x11')],'attributes':['id',_0x779e('0x18'),'email'],'include':[{'model':db[_0x779e('0x4b')],'as':_0x779e('0x13'),'include':[{'model':db['CloudProvider'],'as':_0x779e('0x4c')}]}]}]})[_0x779e('0xb')](function(_0x417b95){var _0x2287e9=_['keys'](manager['jobs']);var _0xcfa63b=_[_0x779e('0x4d')](_0x417b95,function(_0x3787d7){return _0x3787d7['id']['toString']();});var _0x150a12=_['keyBy'](_0x417b95,function(_0x243815){return _0x243815['id']['toString']();});var _0x516a32=_0x27647a?_0xcfa63b:_[_0x779e('0x4e')](_0xcfa63b,_0x2287e9);var _0x30f1ed=_[_0x779e('0x4f')](_0xcfa63b,_0x2287e9);var _0xdddcec=_[_0x779e('0x4e')](_0x2287e9,_0xcfa63b);var _0x590372;var _0x4f5014;for(_0x590372=0x0;_0x590372<_0xdddcec[_0x779e('0x50')]&&!_0x27647a;_0x590372+=0x1){_0x4f5014=_0xdddcec[_0x590372][_0x779e('0x51')]();if(manager[_0x779e('0x52')](_0x4f5014)){manager[_0x779e('0x34')](_0x4f5014);manager[_0x779e('0x53')](_0x4f5014);logger[_0x779e('0xe')](_0x779e('0x54'),_0x4f5014);}}logger[_0x779e('0xe')]('toRun',JSON[_0x779e('0x26')](_0x516a32));for(_0x590372=0x0;_0x590372<_0x516a32['length'];_0x590372+=0x1){_0x4f5014=_0x516a32[_0x590372][_0x779e('0x51')]();if(_0x27647a){logger[_0x779e('0xe')](JSON[_0x779e('0x26')](_0x150a12[_0x4f5014]));BPromise[_0x779e('0x55')]()[_0x779e('0xb')](handleJob(_0x150a12[_0x4f5014]));logger[_0x779e('0xe')]('run\x20job',_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}else if(_0x150a12[_0x4f5014]['cron']&&_0x150a12[_0x4f5014][_0x779e('0x57')]&&moment()[_0x779e('0x58')](_0x150a12[_0x4f5014][_0x779e('0x59')],_0x150a12[_0x4f5014]['endAt'])){manager[_0x779e('0x5a')](_0x4f5014,_0x150a12[_0x4f5014][_0x779e('0x56')],handleJob(_0x150a12[_0x4f5014]));manager['start'](_0x4f5014);logger[_0x779e('0xe')](_0x779e('0x5b'),_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}else if(manager['exists'](_0x4f5014)){manager['stop'](_0x4f5014);manager[_0x779e('0x53')](_0x4f5014);logger[_0x779e('0xe')](_0x779e('0x5c'),_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}}for(_0x590372=0x0,_0x4f5014;_0x590372<_0x30f1ed[_0x779e('0x50')]&&!_0x27647a;_0x590372+=0x1){_0x4f5014=_0x30f1ed[_0x590372]['toString']();if(manager[_0x779e('0x52')](_0x4f5014)){if(_0x150a12[_0x4f5014]['cron']&&_0x150a12[_0x4f5014]['active']&&moment()[_0x779e('0x58')](_0x150a12[_0x4f5014][_0x779e('0x59')],_0x150a12[_0x4f5014]['endAt'])){manager[_0x779e('0x5d')](_0x4f5014,_0x150a12[_0x4f5014][_0x779e('0x56')],handleJob(_0x150a12[_0x4f5014]));logger[_0x779e('0xe')](_0x779e('0x5e'),_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}else{manager[_0x779e('0x34')](_0x4f5014);manager['deleteJob'](_0x4f5014);logger[_0x779e('0xe')]('stop\x20cron',_0x150a12[_0x4f5014][_0x779e('0x18')],_0x150a12[_0x4f5014][_0x779e('0x56')]);}}}})[_0x779e('0xc')](function(_0x4e24cd){logger[_0x779e('0xd')](JSON[_0x779e('0x26')](_0x4e24cd));});}exports[_0x779e('0x5f')]=function(_0x24d32a){return getJobs(_0x24d32a);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xdb75=['stop\x20cron','startAt','endAt','update','update\x20cron','run','util','path','cron-job-manager','jayson/promise','bluebird','../logger','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','http','number','then','catch','error','Try\x20to\x20send\x20a\x20mail\x20to','email','getSmtpOptions','\x22%s\x22\x20<%s>','MailAccount','name','Smtp','user','format','subtractUnit','join','savename','basename','extname','zip','existsSync','Sent','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','attachments','status','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','SendMail','error\x20mail','email\x20sent','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20failed','Unrecognized\x20status:','entity','dataValues','attempt','report\x20status:','subtractNumber','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','runReport','DefaultReportId','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','exists','delete\x20cron','length','resolve','run\x20job','cron','active','isBetween','start','add\x20cron','deleteJob'];(function(_0x3fc3c0,_0x313d37){var _0x16ed79=function(_0x5e25e6){while(--_0x5e25e6){_0x3fc3c0['push'](_0x3fc3c0['shift']());}};_0x16ed79(++_0x313d37);}(_0xdb75,0x144));var _0x5db7=function(_0x33f6ae,_0x499448){_0x33f6ae=_0x33f6ae-0x0;var _0x16ec5c=_0xdb75[_0x33f6ae];return _0x16ec5c;};'use strict';var fs=require('fs');var util=require(_0x5db7('0x0'));var path=require(_0x5db7('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0x5db7('0x2'));var jayson=require(_0x5db7('0x3'));var BPromise=require(_0x5db7('0x4'));var logger=require(_0x5db7('0x5'))('schedule');var db=require(_0x5db7('0x6'))['db'];const retry=require(_0x5db7('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x5db7('0x8'));var client=jayson['client'][_0x5db7('0x9')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0xbe6527){const _0x3a105b={};if(typeof _0xbe6527===_0x5db7('0xa')){_0x3a105b['id']=_0xbe6527;}return db['AnalyticExtractedReport']['findOne']({'where':_0x3a105b})[_0x5db7('0xb')](function(_0x57d816){return _0x57d816;})[_0x5db7('0xc')](function(_0x2c57ce){logger[_0x5db7('0xd')](_0x2c57ce);});}function handleSendEmail(_0x14828e,_0x5ebcbe){logger['info'](_0x5db7('0xe'),_0x14828e[_0x5db7('0xf')]);var _0x4bdd20=!![];var _0x19a72b=_0x14828e['MailAccount'][_0x5db7('0x10')]();var _0x4ff274={'account':_0x19a72b,'message':{'from':util['format'](_0x5db7('0x11'),_0x14828e[_0x5db7('0x12')][_0x5db7('0x13')],_0x14828e[_0x5db7('0x12')][_0x5db7('0xf')]||_0x14828e['MailAccount'][_0x5db7('0x14')][_0x5db7('0x15')]),'to':_0x14828e[_0x5db7('0xf')],'cc':_0x14828e['cc'],'bcc':_0x14828e['bcc'],'subject':util[_0x5db7('0x16')]('Report\x20%s\x20last\x20%s\x20%s',_0x5ebcbe[_0x5db7('0x13')],_0x14828e['subtractNumber'],_0x14828e[_0x5db7('0x17')])}};var _0x436da2=path[_0x5db7('0x18')](__dirname,'../../files/reports');var _0x1a4246=_0x5ebcbe[_0x5db7('0x19')];var _0x5ac52f=util[_0x5db7('0x16')]('%s.%s',path[_0x5db7('0x1a')](_0x5ebcbe[_0x5db7('0x19')],path[_0x5db7('0x1b')](_0x5ebcbe[_0x5db7('0x19')])),_0x5db7('0x1c'));var _0x4e3634=path[_0x5db7('0x18')](_0x436da2,_0x1a4246);var _0x56bc5f=path[_0x5db7('0x18')](_0x436da2,_0x5ac52f);if(fs[_0x5db7('0x1d')](_0x4e3634)){_0x5ebcbe['status']=_0x5db7('0x1e');_0x4ff274[_0x5db7('0x1f')]['attachments']=[{'filename':_0x1a4246,'path':_0x4e3634}];_0x4ff274['message'][_0x5db7('0x20')]=util[_0x5db7('0x16')](_0x5db7('0x21'),JSON[_0x5db7('0x22')](_0x5ebcbe,null,0x2));}else if(fs[_0x5db7('0x1d')](_0x56bc5f)){_0x5ebcbe['status']='Sent';_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x23')]=[{'filename':_0x5ac52f,'path':_0x56bc5f}];}else{if(_0x5ebcbe[_0x5db7('0x24')]==='Empty'){_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x20')]=_0x5db7('0x25');if(!_0x14828e[_0x5db7('0x26')]){_0x4bdd20=![];logger[_0x5db7('0x27')](_0x5db7('0x28'));}}else if(_0x5ebcbe[_0x5db7('0x24')]===_0x5db7('0x29')){_0x4ff274['message'][_0x5db7('0x20')]=_0x5db7('0x2a');}else if(_0x5ebcbe['status']===_0x5db7('0x2b')){_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x20')]=_0x5db7('0x2c');}else if(_0x5ebcbe[_0x5db7('0x24')]===_0x5db7('0x2d')){_0x4ff274[_0x5db7('0x1f')][_0x5db7('0x20')]=_0x5db7('0x2e');}else{logger[_0x5db7('0xd')]('[handleSendEmail]\x20Unrecognized\x20status:',_0x5ebcbe[_0x5db7('0x24')]);}}if(_0x4bdd20){return client['request'](_0x5db7('0x2f'),_0x4ff274)[_0x5db7('0xb')](function(_0xba410c){if(_0xba410c[_0x5db7('0xd')]){return logger[_0x5db7('0xd')](_0x5db7('0x30'),JSON[_0x5db7('0x22')](_0xba410c));}return logger[_0x5db7('0x27')](_0x5db7('0x31'));})['catch'](function(_0x15e9f7){return logger[_0x5db7('0xd')](_0x5db7('0x30'),JSON[_0x5db7('0x22')](_0x15e9f7));});}}function handleError(){return function(_0x261d53){return logger[_0x5db7('0xd')](JSON[_0x5db7('0x22')](_0x261d53));};}function loading(_0x2b9f41){logger[_0x5db7('0x27')](_0x5db7('0x32'));if(_0x2b9f41[_0x5db7('0x33')]===_0x2b9f41[_0x5db7('0x34')][_0x5db7('0x35')]){handleSendEmail(_0x2b9f41[_0x5db7('0x36')],_0x2b9f41[_0x5db7('0x37')]);_0x2b9f41[_0x5db7('0x38')][_0x5db7('0x39')]();}else{_0x2b9f41['operation'][_0x5db7('0x7')](_0x5db7('0x3a'));}}function completed(_0x556700){logger[_0x5db7('0x27')](_0x5db7('0x3b'));handleSendEmail(_0x556700[_0x5db7('0x36')],_0x556700[_0x5db7('0x37')]);_0x556700[_0x5db7('0x38')]['stop']();}function empty(_0x18ef03){logger['info']('case\x20empty');handleSendEmail(_0x18ef03[_0x5db7('0x36')],_0x18ef03[_0x5db7('0x37')]);_0x18ef03['operation'][_0x5db7('0x39')]();}function failed(_0x1aa0df){logger[_0x5db7('0x27')](_0x5db7('0x3c'));handleSendEmail(_0x1aa0df[_0x5db7('0x36')],_0x1aa0df['data']);_0x1aa0df[_0x5db7('0x38')][_0x5db7('0x39')]();}function urecognized(_0x19c5f6){logger[_0x5db7('0xd')](_0x5db7('0x3d'),_0x19c5f6[_0x5db7('0x3e')][_0x5db7('0x3f')][_0x5db7('0x24')]);_0x19c5f6['operation']['stop']();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x55c63f,_0x25f399){const _0x576c8c={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x2bc384=retry[_0x5db7('0x38')](_0x576c8c);_0x2bc384[_0x5db7('0x40')](_0xf2825c=>{logger[_0x5db7('0x27')]('Job\x20ID\x20'+_0x55c63f['id']+'\x20Attempt\x20#:'+_0xf2825c);try{getReportData(_0x25f399['id'])['then'](function(_0x5646e6){_0x25f399=_0x5646e6;logger[_0x5db7('0x27')](_0x5db7('0x41'),_0x5646e6['dataValues']['status']);if(!reportStatusStrategies[_0x5646e6[_0x5db7('0x3f')][_0x5db7('0x24')]]){logger[_0x5db7('0xd')](_0x5db7('0x41'),_0x5646e6[_0x5db7('0x3f')][_0x5db7('0x24')]);_0x2bc384[_0x5db7('0x7')]();}reportStatusStrategies[_0x5646e6[_0x5db7('0x3f')][_0x5db7('0x24')]]({'operation':_0x2bc384,'currentAttempt':_0xf2825c,'retryOptions':_0x576c8c,'job':_0x55c63f,'data':_0x25f399,'entity':_0x5646e6});});}catch(_0x10bed3){_0x2bc384[_0x5db7('0x7')](_0x10bed3);}});}function handleResult(_0x3bd4ef){return function(_0x187e92){if(_0x3bd4ef['sendMail']&&_0x3bd4ef[_0x5db7('0x12')]&&_0x3bd4ef['MailAccount'][_0x5db7('0x14')]&&!_['isNil'](_0x3bd4ef['email'])){retryer(_0x3bd4ef,_0x187e92);}};}function handleJob(_0x2ad740){return function(){try{if(_['isNil'](_0x2ad740[_0x5db7('0x42')])){return logger[_0x5db7('0x27')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x5db7('0x43')](_0x2ad740[_0x5db7('0x17')])){return logger[_0x5db7('0x27')](_0x5db7('0x44'));}var _0x54f499={'startDate':moment()[_0x5db7('0x45')](_0x2ad740[_0x5db7('0x42')],_0x2ad740['subtractUnit'])['format'](_0x5db7('0x46')),'endDate':moment()[_0x5db7('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x5db7('0x47'),'output':_0x2ad740[_0x5db7('0x48')],'name':_0x2ad740[_0x5db7('0x13')]};if(!_[_0x5db7('0x43')](_0x2ad740['DefaultReportId'])){logger[_0x5db7('0x27')](_0x5db7('0x49'),_0x2ad740['DefaultReportId']);return analyticDefaultReportController[_0x5db7('0x4a')]({'id':_0x2ad740[_0x5db7('0x4b')]},_0x54f499)[_0x5db7('0xb')](handleResult(_0x2ad740))[_0x5db7('0xc')](handleError());}if(!_[_0x5db7('0x43')](_0x2ad740['CustomReportId'])){logger[_0x5db7('0x27')]('exec\x20custom\x20report\x20id:%s',_0x2ad740[_0x5db7('0x4c')]);return analyticCustomReportController['runReport']({'id':_0x2ad740[_0x5db7('0x4c')]},_0x54f499)[_0x5db7('0xb')](handleResult(_0x2ad740))[_0x5db7('0xc')](handleError());}}catch(_0x122cec){logger[_0x5db7('0xd')](JSON[_0x5db7('0x22')](_0x122cec));}return logger[_0x5db7('0x27')](_0x5db7('0x4d'));};}function getJobs(_0x2f55f4){var _0x4257c3={};if(_0x2f55f4){_0x4257c3['id']=_0x2f55f4;}return db[_0x5db7('0x4e')][_0x5db7('0x4f')]({'where':_0x4257c3,'include':[{'model':db[_0x5db7('0x12')],'attributes':['id',_0x5db7('0x13'),_0x5db7('0xf')],'include':[{'model':db[_0x5db7('0x50')],'as':_0x5db7('0x14'),'include':[{'model':db[_0x5db7('0x51')],'as':_0x5db7('0x51')}]}]}]})[_0x5db7('0xb')](function(_0x38eaec){var _0x4014e4=_[_0x5db7('0x52')](manager[_0x5db7('0x53')]);var _0x2e5ae6=_[_0x5db7('0x54')](_0x38eaec,function(_0x4e5bfa){return _0x4e5bfa['id'][_0x5db7('0x55')]();});var _0x21646f=_[_0x5db7('0x56')](_0x38eaec,function(_0xc33f83){return _0xc33f83['id']['toString']();});var _0x59aefa=_0x2f55f4?_0x2e5ae6:_['difference'](_0x2e5ae6,_0x4014e4);var _0x33af22=_[_0x5db7('0x57')](_0x2e5ae6,_0x4014e4);var _0x437a28=_[_0x5db7('0x58')](_0x4014e4,_0x2e5ae6);var _0x3df4fd;var _0x5a3215;for(_0x3df4fd=0x0;_0x3df4fd<_0x437a28['length']&&!_0x2f55f4;_0x3df4fd+=0x1){_0x5a3215=_0x437a28[_0x3df4fd]['toString']();if(manager[_0x5db7('0x59')](_0x5a3215)){manager[_0x5db7('0x39')](_0x5a3215);manager['deleteJob'](_0x5a3215);logger[_0x5db7('0x27')](_0x5db7('0x5a'),_0x5a3215);}}logger[_0x5db7('0x27')]('toRun',JSON['stringify'](_0x59aefa));for(_0x3df4fd=0x0;_0x3df4fd<_0x59aefa[_0x5db7('0x5b')];_0x3df4fd+=0x1){_0x5a3215=_0x59aefa[_0x3df4fd][_0x5db7('0x55')]();if(_0x2f55f4){logger[_0x5db7('0x27')](JSON[_0x5db7('0x22')](_0x21646f[_0x5a3215]));BPromise[_0x5db7('0x5c')]()['then'](handleJob(_0x21646f[_0x5a3215]));logger[_0x5db7('0x27')](_0x5db7('0x5d'),_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}else if(_0x21646f[_0x5a3215]['cron']&&_0x21646f[_0x5a3215][_0x5db7('0x5f')]&&moment()[_0x5db7('0x60')](_0x21646f[_0x5a3215]['startAt'],_0x21646f[_0x5a3215]['endAt'])){manager['add'](_0x5a3215,_0x21646f[_0x5a3215][_0x5db7('0x5e')],handleJob(_0x21646f[_0x5a3215]));manager[_0x5db7('0x61')](_0x5a3215);logger[_0x5db7('0x27')](_0x5db7('0x62'),_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215]['cron']);}else if(manager[_0x5db7('0x59')](_0x5a3215)){manager[_0x5db7('0x39')](_0x5a3215);manager[_0x5db7('0x63')](_0x5a3215);logger[_0x5db7('0x27')](_0x5db7('0x64'),_0x21646f[_0x5a3215]['name'],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}}for(_0x3df4fd=0x0,_0x5a3215;_0x3df4fd<_0x33af22[_0x5db7('0x5b')]&&!_0x2f55f4;_0x3df4fd+=0x1){_0x5a3215=_0x33af22[_0x3df4fd][_0x5db7('0x55')]();if(manager['exists'](_0x5a3215)){if(_0x21646f[_0x5a3215]['cron']&&_0x21646f[_0x5a3215][_0x5db7('0x5f')]&&moment()[_0x5db7('0x60')](_0x21646f[_0x5a3215][_0x5db7('0x65')],_0x21646f[_0x5a3215][_0x5db7('0x66')])){manager[_0x5db7('0x67')](_0x5a3215,_0x21646f[_0x5a3215][_0x5db7('0x5e')],handleJob(_0x21646f[_0x5a3215]));logger[_0x5db7('0x27')](_0x5db7('0x68'),_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}else{manager[_0x5db7('0x39')](_0x5a3215);manager[_0x5db7('0x63')](_0x5a3215);logger[_0x5db7('0x27')]('stop\x20cron',_0x21646f[_0x5a3215][_0x5db7('0x13')],_0x21646f[_0x5a3215][_0x5db7('0x5e')]);}}}})['catch'](function(_0x5b8e00){logger[_0x5db7('0xd')](JSON[_0x5db7('0x22')](_0x5b8e00));});}exports[_0x5db7('0x69')]=function(_0x29b27c){return getJobs(_0x29b27c);};exports[_0x5db7('0x61')]=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 f3ca5e7..9e4bd3a 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 _0xcd31=['TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','format','[RECORDING:%d]\x20Get\x20transcript','info','[RECORDING:%d]\x20Transcript\x20downloaded','transcripts','results','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','language','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','data2','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','Positive','SentimentScore','Negative','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','sentiment','sentimentRegion','findOne','Mixed','catch','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Settings\x20not\x20available','transcribeAccountId','Transcribe\x20not\x20configured','Cloud\x20Provider\x20not\x20configured','forEach','push','all','name','start','aws-sdk','request-promise','util','../../mysqldb','../../config/logger','transcribe','getTranscriptionJob','detectSentiment','substring','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','transcribeRegion','then','fileText','TranscriptionJob'];(function(_0x4c7250,_0x286624){var _0x16e46d=function(_0x5069e5){while(--_0x5069e5){_0x4c7250['push'](_0x4c7250['shift']());}};_0x16e46d(++_0x286624);}(_0xcd31,0x15d));var _0x1cd3=function(_0x38ccb4,_0x1897b8){_0x38ccb4=_0x38ccb4-0x0;var _0x4bc3db=_0xcd31[_0x38ccb4];return _0x4bc3db;};var _=require('lodash');var AWS=require(_0x1cd3('0x0'));var rp=require(_0x1cd3('0x1'));var util=require(_0x1cd3('0x2'));var BPromise=require('bluebird');var db=require(_0x1cd3('0x3'))['db'];var logger=require(_0x1cd3('0x4'))(_0x1cd3('0x5'));function getTranscriptionJob(_0x28c67f,_0x295933,_0xf9f49b,_0x5bc77d){return new Promise(function(_0x26ffcb,_0x1ca151){var _0xedb6d1=new AWS['TranscribeService']({'accessKeyId':_0x295933,'secretAccessKey':_0x28c67f,'region':_0xf9f49b});_0xedb6d1[_0x1cd3('0x6')]({'TranscriptionJobName':_0x5bc77d},function(_0x11b139,_0x124659){if(_0x11b139){return _0x1ca151(_0x11b139);}else{return _0x26ffcb(_0x124659);}});});}function sentiment(_0x4a2204,_0x1af2c4,_0x3953d3,_0x17d5c8,_0xb3159f){return new Promise(function(_0x406bc8,_0x3eb8af){var _0x7e5c1a=new AWS['Comprehend']({'accessKeyId':_0x1af2c4,'secretAccessKey':_0x4a2204,'region':_0x3953d3});_0x7e5c1a[_0x1cd3('0x7')]({'Text':_0x17d5c8,'LanguageCode':_0xb3159f[_0x1cd3('0x8')](0x0,0x2)},function(_0x2e460d,_0x44010d){if(_0x2e460d){return _0x3eb8af(_0x2e460d);}else{return _0x406bc8(_0x44010d);}});});}function checkTranscribeJob(_0x5102af,_0xfe288e,_0x4c9c6d){var _0x41016f;return new BPromise(function(_0x35a9ae,_0x3fcc45){logger['info'](util['format'](_0x1cd3('0x9'),_0x5102af['id'],_0x5102af[_0x1cd3('0xa')]));return getTranscriptionJob(_0x4c9c6d[_0x1cd3('0xb')],_0x4c9c6d['data2'],_0xfe288e[_0x1cd3('0xc')],_0x5102af[_0x1cd3('0xa')])[_0x1cd3('0xd')](function(_0x418da3){logger['info'](util['format']('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x5102af['id'],_0x5102af['transcribeName'],_0x418da3['TranscriptionJob']['TranscriptionJobStatus']));if(!_0x5102af[_0x1cd3('0xe')]){switch(_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')]){case _0x1cd3('0x11'):var _0x359899={'transcribeStatus':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x10')],'fileUri':_0x418da3[_0x1cd3('0xf')][_0x1cd3('0x12')][_0x1cd3('0x13')]};logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x15'),_0x5102af['id']));return rp({'uri':_0x418da3['TranscriptionJob'][_0x1cd3('0x12')][_0x1cd3('0x13')],'json':!![]})['then'](function(_0x20cda5){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x17'),_0x5102af['id']));if(_0x20cda5&&_0x20cda5['results']&&_0x20cda5['results'][_0x1cd3('0x18')]&&_0x20cda5[_0x1cd3('0x19')]['transcripts']['length']){_0x359899[_0x1cd3('0xe')]='';for(var _0x44b162=0x0;_0x44b162<_0x20cda5['results']['transcripts'][_0x1cd3('0x1a')];_0x44b162++){_0x359899[_0x1cd3('0xe')]+=_0x20cda5['results']['transcripts'][_0x44b162][_0x1cd3('0x1b')]+'';}}return _0x5102af[_0x1cd3('0x1c')](_0x359899);})[_0x1cd3('0xd')](function(){logger['info'](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));if(!_0x5102af['tempSentiment']){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x20'));}if(!_0xfe288e['sentiment']||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e['sentimentRegion']||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x24'));}if(!_0x359899[_0x1cd3('0xe')]){throw new Error(_0x1cd3('0x25'));}if(_0xfe288e[_0x1cd3('0x21')]===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_settings[_0x1cd3('0x21')]}});}})[_0x1cd3('0xd')](function(_0x1412cb){if(!_0x1412cb){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x1412cb['data1']||!_0x1412cb[_0x1cd3('0x28')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x1412cb;logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x29'),_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f[_0x1cd3('0x28')],_0xfe288e['sentimentRegion'],_0x359899[_0x1cd3('0xe')],_0xfe288e['language']);})['then'](function(_0x1633af){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x1633af[_0x1cd3('0x2b')],'sPositive':_0x1633af['SentimentScore'][_0x1cd3('0x2c')],'sNegative':_0x1633af[_0x1cd3('0x2d')][_0x1cd3('0x2e')],'sMixed':_0x1633af[_0x1cd3('0x2d')]['Mixed'],'sNeutral':_0x1633af['SentimentScore'][_0x1cd3('0x2f')]});})['then'](function(){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});case _0x1cd3('0x30'):return _0x5102af[_0x1cd3('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x418da3['TranscriptionJob']['FailureReason']})['then'](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});default:logger['info'](util[_0x1cd3('0x14')](_0x1cd3('0x31'),_0x5102af['id']));break;}}else{return BPromise['resolve']()[_0x1cd3('0xd')](function(){if(!_0x5102af[_0x1cd3('0x32')]){throw new db[(_0x1cd3('0x1e'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0xfe288e[_0x1cd3('0x33')]||!_0xfe288e[_0x1cd3('0x21')]||!_0xfe288e[_0x1cd3('0x34')]||!_0xfe288e[_0x1cd3('0x22')]||!_0xfe288e[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x24'));}if(!_0x5102af[_0x1cd3('0xe')]){throw new Error('Transcript\x20not\x20available');}if(_0xfe288e['sentimentAccountId']===_0x4c9c6d['id']){return _0x4c9c6d;}else{return db['CloudProvider'][_0x1cd3('0x35')]({'where':{'id':_settings[_0x1cd3('0x21')]}});}})['then'](function(_0x2eeea6){if(!_0x2eeea6){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x27'));}if(!_0x2eeea6[_0x1cd3('0xb')]||!_0x2eeea6[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x41016f=_0x2eeea6;logger[_0x1cd3('0x16')](util['format']('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5102af['id']));return sentiment(_0x41016f[_0x1cd3('0xb')],_0x41016f['data2'],_0xfe288e[_0x1cd3('0x34')],_0x5102af[_0x1cd3('0xe')],_0xfe288e[_0x1cd3('0x22')]);})[_0x1cd3('0xd')](function(_0x326a80){logger[_0x1cd3('0x16')](util[_0x1cd3('0x14')](_0x1cd3('0x2a'),_0x5102af['id']));return _0x5102af['update']({'sentiment':_0x326a80[_0x1cd3('0x2b')],'sPositive':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2c')],'sNegative':_0x326a80['SentimentScore']['Negative'],'sMixed':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x36')],'sNeutral':_0x326a80[_0x1cd3('0x2d')][_0x1cd3('0x2f')],'transcribeStatus':_0x1cd3('0x11')});})[_0x1cd3('0xd')](function(){logger[_0x1cd3('0x16')](util['format'](_0x1cd3('0x1d'),_0x5102af['id']));_0x35a9ae();});}})[_0x1cd3('0x37')](function(_0xbc7fbe){if(_0xbc7fbe){if(!_0xbc7fbe['name']||_0xbc7fbe['name']!==_0x1cd3('0x38')){logger[_0x1cd3('0x39')](util[_0x1cd3('0x14')](_0x1cd3('0x3a'),_0x5102af['id']),util[_0x1cd3('0x3b')](_0xbc7fbe,{'showHidden':![],'depth':null}));}}_0x35a9ae();});});}function checkTranscribe(){var _0x4e746b;var _0x5da126;var _0x500fcf;return db[_0x1cd3('0x3c')][_0x1cd3('0x3d')]({'where':{'transcribeStatus':_0x1cd3('0x3e')}})[_0x1cd3('0xd')](function(_0x1ae177){if(!_0x1ae177||!_0x1ae177['length']){throw new db['Sequelize'][(_0x1cd3('0x1f'))](_0x1cd3('0x3f'));}_0x4e746b=_0x1ae177;return db['Setting'][_0x1cd3('0x35')]({'where':{'id':0x1}});})[_0x1cd3('0xd')](function(_0x2542f6){if(!_0x2542f6){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x40'));}_0x5da126=_0x2542f6;if(!_0x5da126['transcribe']||!_0x5da126[_0x1cd3('0x41')]||!_0x5da126[_0x1cd3('0xc')]||!_0x5da126[_0x1cd3('0x22')]||!_0x5da126[_0x1cd3('0x23')]){throw new db[(_0x1cd3('0x1e'))][(_0x1cd3('0x1f'))](_0x1cd3('0x42'));}return db[_0x1cd3('0x26')]['findOne']({'where':{'id':_0x5da126[_0x1cd3('0x41')]}});})[_0x1cd3('0xd')](function(_0xbd4ea2){if(!_0xbd4ea2){throw new db[(_0x1cd3('0x1e'))]['ValidationError'](_0x1cd3('0x27'));}if(!_0xbd4ea2[_0x1cd3('0xb')]||!_0xbd4ea2[_0x1cd3('0x28')]){throw new db['Sequelize']['ValidationError'](_0x1cd3('0x43'));}_0x500fcf=_0xbd4ea2;var _0x5e31b2=[];_0x4e746b[_0x1cd3('0x44')](function(_0x233ef5){_0x5e31b2[_0x1cd3('0x45')](checkTranscribeJob(_0x233ef5,_0x5da126,_0x500fcf));});return BPromise[_0x1cd3('0x46')](_0x5e31b2);})['catch'](function(_0x12a2d0){if(_0x12a2d0){if(!_0x12a2d0[_0x1cd3('0x47')]||_0x12a2d0[_0x1cd3('0x47')]!==_0x1cd3('0x38')){logger['error'](util[_0x1cd3('0x3b')](_0x12a2d0,{'showHidden':![],'depth':null}));}}});}exports[_0x1cd3('0x48')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x93ed=['Sequelize','ValidationError','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','SentimentScore','Positive','Mixed','FAILED','resolve','Sentiment\x20Analysis\x20not\x20requested','bucket','Cloud\x20Provider\x20not\x20configured','Sentiment','Negative','Neutral','catch','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','Transcribe\x20not\x20configured','transcribeAccountId','push','all','error','start','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','TranscribeService','Comprehend','detectSentiment','substring','transcribeName','data1','data2','info','format','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated'];(function(_0x17bfef,_0x4feee7){var _0x26e71e=function(_0xcc8568){while(--_0xcc8568){_0x17bfef['push'](_0x17bfef['shift']());}};_0x26e71e(++_0x4feee7);}(_0x93ed,0xfe));var _0xd93e=function(_0x1c6e10,_0x5ae23c){_0x1c6e10=_0x1c6e10-0x0;var _0x2a5924=_0x93ed[_0x1c6e10];return _0x2a5924;};var _=require(_0xd93e('0x0'));var AWS=require(_0xd93e('0x1'));var rp=require(_0xd93e('0x2'));var util=require(_0xd93e('0x3'));var BPromise=require(_0xd93e('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xd93e('0x5'))('transcribe');function getTranscriptionJob(_0x5a6206,_0x812267,_0x5a4150,_0x462444){return new Promise(function(_0x3481fa,_0x462ab2){var _0x478305=new AWS[(_0xd93e('0x6'))]({'accessKeyId':_0x812267,'secretAccessKey':_0x5a6206,'region':_0x5a4150});_0x478305['getTranscriptionJob']({'TranscriptionJobName':_0x462444},function(_0x4ef1a1,_0x466fca){if(_0x4ef1a1){return _0x462ab2(_0x4ef1a1);}else{return _0x3481fa(_0x466fca);}});});}function sentiment(_0x3b1527,_0x8ff0d1,_0x14fc46,_0x561e6d,_0x4bb433){return new Promise(function(_0x25b7c0,_0x5d916b){var _0x3f3f19=new AWS[(_0xd93e('0x7'))]({'accessKeyId':_0x8ff0d1,'secretAccessKey':_0x3b1527,'region':_0x14fc46});_0x3f3f19[_0xd93e('0x8')]({'Text':_0x561e6d,'LanguageCode':_0x4bb433[_0xd93e('0x9')](0x0,0x2)},function(_0x1f9ad3,_0x5993e5){if(_0x1f9ad3){return _0x5d916b(_0x1f9ad3);}else{return _0x25b7c0(_0x5993e5);}});});}function checkTranscribeJob(_0x652ac9,_0x256f8a,_0x444b08){var _0x2e4284;return new BPromise(function(_0x2032c7,_0x55aeec){logger['info'](util['format']('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x652ac9['id'],_0x652ac9[_0xd93e('0xa')]));return getTranscriptionJob(_0x444b08[_0xd93e('0xb')],_0x444b08[_0xd93e('0xc')],_0x256f8a['transcribeRegion'],_0x652ac9[_0xd93e('0xa')])['then'](function(_0x1826b8){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0xf'),_0x652ac9['id'],_0x652ac9[_0xd93e('0xa')],_0x1826b8[_0xd93e('0x10')][_0xd93e('0x11')]));if(!_0x652ac9['fileText']){switch(_0x1826b8['TranscriptionJob']['TranscriptionJobStatus']){case _0xd93e('0x12'):var _0x9896c8={'transcribeStatus':_0x1826b8[_0xd93e('0x10')]['TranscriptionJobStatus'],'fileUri':_0x1826b8['TranscriptionJob'][_0xd93e('0x13')][_0xd93e('0x14')]};logger[_0xd93e('0xd')](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Get\x20transcript',_0x652ac9['id']));return rp({'uri':_0x1826b8[_0xd93e('0x10')][_0xd93e('0x13')][_0xd93e('0x14')],'json':!![]})[_0xd93e('0x15')](function(_0x25193b){logger['info'](util['format'](_0xd93e('0x16'),_0x652ac9['id']));if(_0x25193b&&_0x25193b[_0xd93e('0x17')]&&_0x25193b[_0xd93e('0x17')][_0xd93e('0x18')]&&_0x25193b[_0xd93e('0x17')][_0xd93e('0x18')][_0xd93e('0x19')]){_0x9896c8[_0xd93e('0x1a')]='';for(var _0x47487c=0x0;_0x47487c<_0x25193b[_0xd93e('0x17')][_0xd93e('0x18')]['length'];_0x47487c++){_0x9896c8[_0xd93e('0x1a')]+=_0x25193b['results']['transcripts'][_0x47487c][_0xd93e('0x1b')]+'';}}return _0x652ac9[_0xd93e('0x1c')](_0x9896c8);})['then'](function(){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x1d'),_0x652ac9['id']));if(!_0x652ac9['tempSentiment']){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))]('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x256f8a[_0xd93e('0x20')]||!_0x256f8a[_0xd93e('0x21')]||!_0x256f8a[_0xd93e('0x22')]||!_0x256f8a[_0xd93e('0x23')]||!_0x256f8a['bucket']){throw new db['Sequelize']['ValidationError'](_0xd93e('0x24'));}if(!_0x9896c8[_0xd93e('0x1a')]){throw new Error(_0xd93e('0x25'));}if(_0x256f8a[_0xd93e('0x21')]===_0x444b08['id']){return _0x444b08;}else{return db[_0xd93e('0x26')][_0xd93e('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd93e('0x15')](function(_0x48289c){if(!_0x48289c){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x28'));}if(!_0x48289c[_0xd93e('0xb')]||!_0x48289c[_0xd93e('0xc')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x2e4284=_0x48289c;logger['info'](util['format'](_0xd93e('0x29'),_0x652ac9['id']));return sentiment(_0x2e4284[_0xd93e('0xb')],_0x2e4284[_0xd93e('0xc')],_0x256f8a['sentimentRegion'],_0x9896c8[_0xd93e('0x1a')],_0x256f8a['language']);})['then'](function(_0x136176){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x2a'),_0x652ac9['id']));return _0x652ac9['update']({'sentiment':_0x136176['Sentiment'],'sPositive':_0x136176[_0xd93e('0x2b')][_0xd93e('0x2c')],'sNegative':_0x136176[_0xd93e('0x2b')]['Negative'],'sMixed':_0x136176[_0xd93e('0x2b')][_0xd93e('0x2d')],'sNeutral':_0x136176['SentimentScore']['Neutral']});})['then'](function(){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x1d'),_0x652ac9['id']));_0x2032c7();});case _0xd93e('0x2e'):return _0x652ac9[_0xd93e('0x1c')]({'transcribeStatus':_0xd93e('0x2e'),'failureReason':_0x1826b8[_0xd93e('0x10')]['FailureReason']})[_0xd93e('0x15')](function(){logger['info'](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x652ac9['id']));_0x2032c7();});default:logger[_0xd93e('0xd')](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x652ac9['id']));break;}}else{return BPromise[_0xd93e('0x2f')]()[_0xd93e('0x15')](function(){if(!_0x652ac9['tempSentiment']){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x30'));}if(!_0x256f8a['sentiment']||!_0x256f8a['sentimentAccountId']||!_0x256f8a['sentimentRegion']||!_0x256f8a[_0xd93e('0x23')]||!_0x256f8a[_0xd93e('0x31')]){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x24'));}if(!_0x652ac9[_0xd93e('0x1a')]){throw new Error(_0xd93e('0x25'));}if(_0x256f8a[_0xd93e('0x21')]===_0x444b08['id']){return _0x444b08;}else{return db['CloudProvider'][_0xd93e('0x27')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0xd93e('0x15')](function(_0x3919e4){if(!_0x3919e4){throw new db['Sequelize'][(_0xd93e('0x1f'))](_0xd93e('0x28'));}if(!_0x3919e4[_0xd93e('0xb')]||!_0x3919e4[_0xd93e('0xc')]){throw new db[(_0xd93e('0x1e'))]['ValidationError'](_0xd93e('0x32'));}_0x2e4284=_0x3919e4;logger[_0xd93e('0xd')](util[_0xd93e('0xe')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x652ac9['id']));return sentiment(_0x2e4284[_0xd93e('0xb')],_0x2e4284['data2'],_0x256f8a['sentimentRegion'],_0x652ac9[_0xd93e('0x1a')],_0x256f8a[_0xd93e('0x23')]);})[_0xd93e('0x15')](function(_0x4a3772){logger['info'](util[_0xd93e('0xe')](_0xd93e('0x2a'),_0x652ac9['id']));return _0x652ac9[_0xd93e('0x1c')]({'sentiment':_0x4a3772[_0xd93e('0x33')],'sPositive':_0x4a3772['SentimentScore']['Positive'],'sNegative':_0x4a3772[_0xd93e('0x2b')][_0xd93e('0x34')],'sMixed':_0x4a3772[_0xd93e('0x2b')][_0xd93e('0x2d')],'sNeutral':_0x4a3772[_0xd93e('0x2b')][_0xd93e('0x35')],'transcribeStatus':_0xd93e('0x12')});})[_0xd93e('0x15')](function(){logger[_0xd93e('0xd')](util[_0xd93e('0xe')](_0xd93e('0x1d'),_0x652ac9['id']));_0x2032c7();});}})[_0xd93e('0x36')](function(_0x3c92fb){if(_0x3c92fb){if(!_0x3c92fb[_0xd93e('0x37')]||_0x3c92fb[_0xd93e('0x37')]!==_0xd93e('0x38')){logger['error'](util[_0xd93e('0xe')](_0xd93e('0x39'),_0x652ac9['id']),util[_0xd93e('0x3a')](_0x3c92fb,{'showHidden':![],'depth':null}));}}_0x2032c7();});});}function checkTranscribe(){var _0x7e330e;var _0x59a718;var _0x15fc29;return db['VoiceRecording'][_0xd93e('0x3b')]({'where':{'transcribeStatus':_0xd93e('0x3c')}})[_0xd93e('0x15')](function(_0xd1c085){if(!_0xd1c085||!_0xd1c085[_0xd93e('0x19')]){throw new db['Sequelize'][(_0xd93e('0x1f'))](_0xd93e('0x3d'));}_0x7e330e=_0xd1c085;return db[_0xd93e('0x3e')][_0xd93e('0x27')]({'where':{'id':0x1}});})[_0xd93e('0x15')](function(_0x4d9073){if(!_0x4d9073){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x3f'));}_0x59a718=_0x4d9073;if(!_0x59a718[_0xd93e('0x40')]||!_0x59a718['transcribeAccountId']||!_0x59a718['transcribeRegion']||!_0x59a718[_0xd93e('0x23')]||!_0x59a718[_0xd93e('0x31')]){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))](_0xd93e('0x41'));}return db[_0xd93e('0x26')][_0xd93e('0x27')]({'where':{'id':_0x59a718[_0xd93e('0x42')]}});})['then'](function(_0x4c6eaa){if(!_0x4c6eaa){throw new db[(_0xd93e('0x1e'))]['ValidationError'](_0xd93e('0x28'));}if(!_0x4c6eaa[_0xd93e('0xb')]||!_0x4c6eaa[_0xd93e('0xc')]){throw new db[(_0xd93e('0x1e'))][(_0xd93e('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x15fc29=_0x4c6eaa;var _0x21230d=[];_0x7e330e['forEach'](function(_0x1cf398){_0x21230d[_0xd93e('0x43')](checkTranscribeJob(_0x1cf398,_0x59a718,_0x15fc29));});return BPromise[_0xd93e('0x44')](_0x21230d);})['catch'](function(_0x36ddc2){if(_0x36ddc2){if(!_0x36ddc2['name']||_0x36ddc2['name']!==_0xd93e('0x38')){logger[_0xd93e('0x45')](util[_0xd93e('0x3a')](_0x36ddc2,{'showHidden':![],'depth':null}));}}});}exports[_0xd93e('0x46')]=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 2eb63c7..9e20b3f 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 _0x53f3=['map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','start','moment','util','../../config/environment','../../mysqldb','../logger','schedule','redis','defaults','localhost','socket.io-emitter','lastMsgAt','subtract','hours','then'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x53f3,0x10a));var _0x353f=function(_0x418c14,_0x47039e){_0x418c14=_0x418c14-0x0;var _0x5a1918=_0x53f3[_0x418c14];return _0x5a1918;};'use strict';var _=require('lodash');var moment=require(_0x353f('0x0'));var Redis=require('ioredis');var util=require(_0x353f('0x1'));var config=require(_0x353f('0x2'));var db=require(_0x353f('0x3'))['db'];var logger=require(_0x353f('0x4'))(_0x353f('0x5'));config[_0x353f('0x6')]=_[_0x353f('0x7')](config[_0x353f('0x6')],{'host':_0x353f('0x8'),'port':0x18eb});var io=require(_0x353f('0x9'))(new Redis(config[_0x353f('0x6')]));function closeInteractions(){var _0x557695=[];return db['WhatsappInteraction']['findAll']({'raw':!![],'attributes':['id',_0x353f('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x353f('0xb')](0x18,_0x353f('0xc'))}}})[_0x353f('0xd')](function(_0x2c0b44){if(_0x2c0b44&&_0x2c0b44['length']){_0x557695=_[_0x353f('0xe')](_0x2c0b44||[],'id');logger[_0x353f('0xf')](_0x353f('0x10'),_0x557695[_0x353f('0x11')]());return db['WhatsappInteraction'][_0x353f('0x12')]({'closeReason':_0x353f('0x13'),'disposition':_0x353f('0x14'),'closed':!![],'closedAt':moment()['format'](_0x353f('0x15'))},{'where':{'id':_0x557695}});}})[_0x353f('0xd')](function(){if(_0x557695&&_0x557695[_0x353f('0x16')]){logger[_0x353f('0xf')](_0x353f('0x17'),_0x557695[_0x353f('0x11')]());for(var _0x22c539=0x0;_0x22c539<_0x557695[_0x353f('0x16')];_0x22c539++){io[_0x353f('0x18')](_0x353f('0x19'),{'id':_0x557695[_0x22c539],'closed':!![]});}}})[_0x353f('0x1a')](function(_0x2498bf){logger['error']('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x2498bf?util['inspect'](_0x2498bf,{'showHidden':![],'depth':null}):'');});}exports[_0x353f('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x5706=['redis','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','then','length','map','info','join','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','inspect','start','lodash','moment','ioredis','util','../../config/environment','../../mysqldb','../logger'];(function(_0x42a0ec,_0x5a45cb){var _0x173d4f=function(_0x39ecc0){while(--_0x39ecc0){_0x42a0ec['push'](_0x42a0ec['shift']());}};_0x173d4f(++_0x5a45cb);}(_0x5706,0x8a));var _0x6570=function(_0x4fe585,_0xaebe86){_0x4fe585=_0x4fe585-0x0;var _0x7d612=_0x5706[_0x4fe585];return _0x7d612;};'use strict';var _=require(_0x6570('0x0'));var moment=require(_0x6570('0x1'));var Redis=require(_0x6570('0x2'));var util=require(_0x6570('0x3'));var config=require(_0x6570('0x4'));var db=require(_0x6570('0x5'))['db'];var logger=require(_0x6570('0x6'))('schedule');config[_0x6570('0x7')]=_['defaults'](config[_0x6570('0x7')],{'host':_0x6570('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x278218=[];return db[_0x6570('0x9')][_0x6570('0xa')]({'raw':!![],'attributes':['id',_0x6570('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x6570('0xc')](0x18,'hours')}}})[_0x6570('0xd')](function(_0x5d42fb){if(_0x5d42fb&&_0x5d42fb[_0x6570('0xe')]){_0x278218=_[_0x6570('0xf')](_0x5d42fb||[],'id');logger[_0x6570('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x278218[_0x6570('0x11')]());return db[_0x6570('0x9')]['update']({'closeReason':_0x6570('0x12'),'disposition':_0x6570('0x13'),'closed':!![],'closedAt':moment()[_0x6570('0x14')](_0x6570('0x15'))},{'where':{'id':_0x278218}});}})[_0x6570('0xd')](function(){if(_0x278218&&_0x278218[_0x6570('0xe')]){logger[_0x6570('0x10')](_0x6570('0x16'),_0x278218[_0x6570('0x11')]());for(var _0x14863e=0x0;_0x14863e<_0x278218[_0x6570('0xe')];_0x14863e++){io[_0x6570('0x17')](_0x6570('0x18'),{'id':_0x278218[_0x14863e],'closed':!![]});}}})[_0x6570('0x19')](function(_0x12ecec){logger[_0x6570('0x1a')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x12ecec?util[_0x6570('0x1b')](_0x12ecec,{'showHidden':![],'depth':null}):'');});}exports[_0x6570('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 6cce9e5..78b4f6d 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xae72=['util','../mysqldb','Biondo','@xcally.com','push','now','Innocenzo','innocenzo.biondo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper2'];(function(_0x5312b8,_0x332153){var _0x44f5f7=function(_0x47aaed){while(--_0x47aaed){_0x5312b8['push'](_0x5312b8['shift']());}};_0x44f5f7(++_0x332153);}(_0xae72,0x110));var _0x2ae7=function(_0xa6a3b1,_0x5ccc11){_0xa6a3b1=_0xa6a3b1-0x0;var _0x4054ff=_0xae72[_0xa6a3b1];return _0x4054ff;};'use strict';var util=require(_0x2ae7('0x0'));var db=require(_0x2ae7('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x2ae7('0x2')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x2ae7('0x3')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x2ae7('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2ae7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2ae7('0x5')](),'updatedAt':Date[_0x2ae7('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x2ae7('0x4')]({'id':i,'firstName':_0x2ae7('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x2ae7('0x7')+i+_0x2ae7('0x3')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x2ae7('0x4')]({'id':i,'active':![],'scheduledat':Date[_0x2ae7('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x2ae7('0x5')](),'updatedAt':Date[_0x2ae7('0x5')]()});}db[_0x2ae7('0x8')][_0x2ae7('0x9')]({'where':{}})[_0x2ae7('0xa')](function(){return db['CmContact'][_0x2ae7('0xb')](contacts);})[_0x2ae7('0xa')](function(){console[_0x2ae7('0xc')](_0x2ae7('0xd'),_0x2ae7('0xe'));return db[_0x2ae7('0xf')]['destroy']({'where':{}});})[_0x2ae7('0xa')](function(){return db[_0x2ae7('0xf')][_0x2ae7('0xb')](hopper);})[_0x2ae7('0xa')](function(){console[_0x2ae7('0xc')]('finished\x20populating','hopper1');return db['CmContact'][_0x2ae7('0xb')](contacts2);})[_0x2ae7('0xa')](function(){console['log'](_0x2ae7('0xd'),'contacts2');return db[_0x2ae7('0xf')][_0x2ae7('0xb')](hopper2);})[_0x2ae7('0xa')](function(){console[_0x2ae7('0xc')](_0x2ae7('0xd'),_0x2ae7('0x10'));})['catch'](function(_0x4602b6){console['log'](_0x4602b6);}); \ No newline at end of file +var _0x4639=['innocenzo.biondo','@xcally.com','now','CmContact','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','then','hopper1','contacts2','hopper2','catch','util','../mysqldb','push','Innocenzo','Biondo'];(function(_0x23e049,_0x306845){var _0xeaaa15=function(_0x1047cf){while(--_0x1047cf){_0x23e049['push'](_0x23e049['shift']());}};_0xeaaa15(++_0x306845);}(_0x4639,0x19f));var _0x9463=function(_0xa14d8c,_0x14759b){_0xa14d8c=_0xa14d8c-0x0;var _0x3facda=_0x4639[_0xa14d8c];return _0x3facda;};'use strict';var util=require(_0x9463('0x0'));var db=require(_0x9463('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x9463('0x2')]({'id':i,'firstName':_0x9463('0x3')+i,'lastName':_0x9463('0x4')+i,'phone':0xf879fb460+i,'email':_0x9463('0x5')+i+_0x9463('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x9463('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9463('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9463('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x9463('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x9463('0x4')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x9463('0x6')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x9463('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x9463('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x9463('0x7')]()});}db[_0x9463('0x8')]['destroy']({'where':{}})['then'](function(){return db[_0x9463('0x8')][_0x9463('0x9')](contacts);})['then'](function(){console[_0x9463('0xa')](_0x9463('0xb'),_0x9463('0xc'));return db[_0x9463('0xd')][_0x9463('0xe')]({'where':{}});})[_0x9463('0xf')](function(){return db[_0x9463('0xd')][_0x9463('0x9')](hopper);})[_0x9463('0xf')](function(){console['log']('finished\x20populating',_0x9463('0x10'));return db[_0x9463('0x8')][_0x9463('0x9')](contacts2);})[_0x9463('0xf')](function(){console['log']('finished\x20populating',_0x9463('0x11'));return db['CmHopper'][_0x9463('0x9')](hopper2);})['then'](function(){console[_0x9463('0xa')](_0x9463('0xb'),_0x9463('0x12'));})[_0x9463('0x13')](function(_0x39cab3){console['log'](_0x39cab3);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 5cd39c3..de6570e 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5485=['%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','then','log','../mysqldb','push','format','%s%s','agent'];(function(_0x2aa0f0,_0x21a1c4){var _0x54014a=function(_0x569952){while(--_0x569952){_0x2aa0f0['push'](_0x2aa0f0['shift']());}};_0x54014a(++_0x21a1c4);}(_0x5485,0x1f3));var _0x5548=function(_0x456b90,_0x42844b){_0x456b90=_0x456b90-0x0;var _0x402b71=_0x5485[_0x456b90];return _0x402b71;};'use strict';var util=require('util');var db=require(_0x5548('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x5548('0x1')]({'name':util[_0x5548('0x2')](_0x5548('0x3'),_0x5548('0x4'),i),'fullname':util['format'](_0x5548('0x3'),'agent',i),'email':util[_0x5548('0x2')](_0x5548('0x5'),_0x5548('0x4'),i),'role':_0x5548('0x4'),'password':_0x5548('0x6'),'internal':0xfa0+i,'type':_0x5548('0x7'),'transport':[_0x5548('0x8'),'ws',_0x5548('0x9')],'disallow':['all'],'allow':[_0x5548('0xa')],'defaultuser':util[_0x5548('0x2')](_0x5548('0x3'),'agent',i),'encryption':_0x5548('0xb'),'avpf':_0x5548('0xb'),'force_avp':_0x5548('0xb'),'icesupport':_0x5548('0xb'),'dtlsenable':_0x5548('0xb'),'dtlsverify':'no','dtlscertfile':_0x5548('0xc'),'dtlsprivatekey':_0x5548('0xd'),'dtlssetup':_0x5548('0xe'),'callerid':util[_0x5548('0x2')]('\x22%s\x22\x20<%s>',util[_0x5548('0x2')](_0x5548('0x3'),_0x5548('0x4'),i),0xfa0+i)});}db[_0x5548('0xf')]['bulkCreate'](users)[_0x5548('0x10')](function(){console[_0x5548('0x11')]('add\x20user');})['catch'](function(_0x5dd8df){console[_0x5548('0x11')](_0x5dd8df);}); \ No newline at end of file +var _0x6fd4=['all','ulaw','yes','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','util','../mysqldb','%s%s','format','agent','%s%s@xcally.com','password','friend','wss'];(function(_0x594e7a,_0x5455af){var _0x14369d=function(_0x3f4e84){while(--_0x3f4e84){_0x594e7a['push'](_0x594e7a['shift']());}};_0x14369d(++_0x5455af);}(_0x6fd4,0xd3));var _0x46fd=function(_0x1d6fc6,_0x857c7){_0x1d6fc6=_0x1d6fc6-0x0;var _0x595a5a=_0x6fd4[_0x1d6fc6];return _0x595a5a;};'use strict';var util=require(_0x46fd('0x0'));var db=require(_0x46fd('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format'](_0x46fd('0x2'),'agent',i),'fullname':util[_0x46fd('0x3')](_0x46fd('0x2'),_0x46fd('0x4'),i),'email':util[_0x46fd('0x3')](_0x46fd('0x5'),_0x46fd('0x4'),i),'role':'agent','password':_0x46fd('0x6'),'internal':0xfa0+i,'type':_0x46fd('0x7'),'transport':['udp','ws',_0x46fd('0x8')],'disallow':[_0x46fd('0x9')],'allow':[_0x46fd('0xa')],'defaultuser':util[_0x46fd('0x3')](_0x46fd('0x2'),_0x46fd('0x4'),i),'encryption':_0x46fd('0xb'),'avpf':_0x46fd('0xb'),'force_avp':_0x46fd('0xb'),'icesupport':_0x46fd('0xb'),'dtlsenable':_0x46fd('0xb'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0x46fd('0xc'),'dtlssetup':_0x46fd('0xd'),'callerid':util['format'](_0x46fd('0xe'),util[_0x46fd('0x3')](_0x46fd('0x2'),'agent',i),0xfa0+i)});}db[_0x46fd('0xf')]['bulkCreate'](users)[_0x46fd('0x10')](function(){console[_0x46fd('0x11')](_0x46fd('0x12'));})[_0x46fd('0x13')](function(_0x547d14){console[_0x46fd('0x11')](_0x547d14);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 82a9e60..ee61876 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93e9=['user_has_whatsapp_interactions:remove','log','join','default','connection','request','remoteAddress','remotePort','connectedAt','SocketIO\x20','nsp','address','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','name','Agents','role','agent','telephone','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','SmsQueues','OpenchannelQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','User','where','Campaign','type','format','%s:queue:%s','user:%s','handshake','query','find','userProfileId','ChatInteraction','ChatInteractions','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','ChatQueues','ChatQueue','FaxQueues','OpenchannelQueue','WhatsappQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','length','fax','sms','mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeSmsInteractions','OpenchannelInteractions','removeOpenchannelInteractions'];(function(_0x5713f2,_0x40ef5f){var _0x52232b=function(_0x3b30f1){while(--_0x3b30f1){_0x5713f2['push'](_0x5713f2['shift']());}};_0x52232b(++_0x40ef5f);}(_0x93e9,0xcc));var _0x993e=function(_0x4a8c66,_0xaa36a3){_0x4a8c66=_0x4a8c66-0x0;var _0x55eeea=_0x93e9[_0x4a8c66];return _0x55eeea;};'use strict';var _=require(_0x993e('0x0'));var util=require(_0x993e('0x1'));var BPromise=require(_0x993e('0x2'));var db=require(_0x993e('0x3'))['db'];var config=require(_0x993e('0x4'));var queryQueues={'attributes':['id',_0x993e('0x5')],'include':[{'as':_0x993e('0x6'),'model':db['User'],'attributes':['id','name',_0x993e('0x7')],'raw':!![],'where':{'role':_0x993e('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x993e('0x5')],'where':{'role':_0x993e('0x9')}};var queryTrunks={'raw':!![],'attributes':['id',_0x993e('0x5')]};var queryAgents={'raw':!![],'attributes':['id',_0x993e('0x5')],'where':{'role':_0x993e('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x993e('0x5'),'type'],'where':{'type':_0x993e('0xa')}};function getAssociatedResources(_0x69ff1,_0x15d774,_0x280291){return db[_0x993e('0xb')][_0x993e('0xc')]({'where':{'name':_0x69ff1,'userProfileId':_0x15d774},'raw':!![]})[_0x993e('0xd')](function(_0x48291a){if(_0x48291a){if(_0x48291a[_0x993e('0xe')]){switch(_0x69ff1){case _0x993e('0xf'):case'ChatQueues':case'FaxQueues':case _0x993e('0x10'):case'MailQueues':case _0x993e('0x11'):case'WhatsappQueues':return db[_0x280291]['findAll'](queryQueues);case _0x993e('0x12'):return db[_0x280291][_0x993e('0x13')](queryTelephones);case _0x993e('0x14'):return db[_0x280291][_0x993e('0x13')](queryTrunks);case _0x993e('0x15'):return db[_0x280291][_0x993e('0x13')](queryCampaigns);}}else{return db[_0x993e('0x16')][_0x993e('0x13')]({'attributes':[_0x993e('0x17')],'where':{'sectionId':_0x48291a['id']},'raw':!![]})[_0x993e('0xd')](function(_0x1a7726){if(_0x1a7726){var _0x135771={'where':{'id':_[_0x993e('0x18')](_0x1a7726,_0x993e('0x17'))},'raw':!![]};switch(_0x280291){case _0x993e('0x19'):_0x135771[_0x993e('0x1a')][_0x993e('0x7')]='telephone';break;case _0x993e('0x1b'):_0x135771[_0x993e('0x1a')][_0x993e('0x1c')]=_0x993e('0xa');break;}return db[_0x280291][_0x993e('0x13')](_0x135771);}else{return[];}});}}else{return[];}})[_0x993e('0xd')](function(_0x5f3205){return _0x5f3205;});}function joinOrLeaveQueues(_0x11cd41,_0xc00010,_0x1eaf57,_0x22390e){_0x11cd41[_0xc00010](util[_0x993e('0x1d')](_0x993e('0x1e'),_0x1eaf57,_0x22390e[_0x993e('0x5')]));if(_0x22390e[_0x993e('0x6')]){for(var _0x4bbe9c=0x0;_0x4bbe9c<_0x22390e[_0x993e('0x6')]['length'];_0x4bbe9c+=0x1){_0x11cd41[_0xc00010](util[_0x993e('0x1d')](_0x993e('0x1f'),_0x22390e[_0x993e('0x6')][_0x4bbe9c]['name']));}}}function joinOrLeave(_0x2353d4,_0x13db4e,_0xfba00f){var _0x1c52fd;if(_0x2353d4[_0x993e('0x20')][_0x993e('0x21')]['id']){db[_0x993e('0x19')][_0x993e('0x22')]({'attributes':['id',_0x993e('0x5'),_0x993e('0x7'),_0x993e('0x23')],'where':{'id':_0x2353d4[_0x993e('0x20')]['query']['id']},'include':[{'model':db[_0x993e('0x24')],'as':_0x993e('0x25'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x993e('0x26'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x993e('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x993e('0x28')],'as':_0x993e('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x993e('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x993e('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x993e('0xd')](function(_0x4a4f00){if(_0x4a4f00){_0x1c52fd=_0x4a4f00;_0x2353d4[_0x13db4e](util[_0x993e('0x1d')](_0x993e('0x1f'),_0x4a4f00[_0x993e('0x5')]));var _0x4c5ee3=[];switch(_0x4a4f00[_0x993e('0x7')]){case _0x993e('0x2c'):_0x2353d4[_0x13db4e](_0x993e('0x2d'));_0x2353d4[_0x13db4e](_0x993e('0x2e'));if(queryQueues[_0x993e('0x2f')]('include')){delete queryQueues[_0x993e('0x30')];}_0x4c5ee3['push'](db[_0x993e('0x31')]['findAll'](queryQueues));_0x4c5ee3[_0x993e('0x32')](db['ChatQueue'][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x33')][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x34')]['findAll'](queryQueues));_0x4c5ee3[_0x993e('0x32')](db['MailQueue']['findAll'](queryQueues));_0x4c5ee3[_0x993e('0x32')](db['OpenchannelQueue'][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x35')][_0x993e('0x13')](queryQueues));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x19')][_0x993e('0x13')](queryTelephones));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x36')][_0x993e('0x13')](queryTrunks));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x1b')][_0x993e('0x13')](queryCampaigns));_0x4c5ee3[_0x993e('0x32')](db[_0x993e('0x19')]['findAll'](queryAgents));break;case _0x993e('0x37'):_0x2353d4[_0x13db4e](_0x993e('0x2d'));_0x2353d4[_0x13db4e](_0x993e('0x2e'));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0xf'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x31')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x38'),_0x4a4f00['userProfileId'],_0x993e('0x39')));_0x4c5ee3['push'](getAssociatedResources(_0x993e('0x3a'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x33')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x10'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x34')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources('MailQueues',_0x4a4f00[_0x993e('0x23')],'MailQueue'));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources('OpenchannelQueues',_0x4a4f00[_0x993e('0x23')],_0x993e('0x3b')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x3c'),_0x4a4f00[_0x993e('0x23')],_0x993e('0x35')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources(_0x993e('0x12'),_0x4a4f00['userProfileId'],_0x993e('0x19')));_0x4c5ee3['push'](getAssociatedResources('Trunks',_0x4a4f00[_0x993e('0x23')],_0x993e('0x36')));_0x4c5ee3[_0x993e('0x32')](getAssociatedResources('IvrCampaigns',_0x4a4f00[_0x993e('0x23')],_0x993e('0x1b')));_0x4c5ee3[_0x993e('0x32')](db['User']['findAll'](queryAgents));break;case'agent':_0x2353d4[_0x13db4e](_0x993e('0x2d'));_0x2353d4[_0x13db4e](_0x993e('0x2e'));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00['getVoiceQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00['getChatQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00['getFaxQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00[_0x993e('0x3d')]({'attributes':['id','name']}));_0x4c5ee3['push'](_0x4a4f00['getMailQueues']({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3[_0x993e('0x32')](_0x4a4f00[_0x993e('0x3e')]({'attributes':['id',_0x993e('0x5')]}));_0x4c5ee3['push'](_0x4a4f00[_0x993e('0x3f')]({'attributes':['id',_0x993e('0x5')]}));break;}return BPromise[_0x993e('0x40')](_0x4c5ee3);}})[_0x993e('0xd')](function(_0x3f7664){if(_0x3f7664&&_0x3f7664[_0x993e('0x41')]){for(var _0x52f148=0x0;_0x52f148<_0x3f7664['length'];_0x52f148+=0x1){for(var _0x189a3b=0x0;_0x189a3b<_0x3f7664[_0x52f148][_0x993e('0x41')];_0x189a3b+=0x1){switch(_0x52f148){case 0x0:joinOrLeaveQueues(_0x2353d4,_0x13db4e,'voice',_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x1:joinOrLeaveQueues(_0x2353d4,_0x13db4e,'chat',_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x2:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x42'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x3:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x43'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x4:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x44'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x5:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x45'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x6:joinOrLeaveQueues(_0x2353d4,_0x13db4e,_0x993e('0x46'),_0x3f7664[_0x52f148][_0x189a3b]);break;case 0x7:if(_0x1c52fd[_0x993e('0x7')]!=='agent')_0x2353d4[_0x13db4e](util[_0x993e('0x1d')]('telephone:%s',_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x5')]));break;case 0x8:if(_0x1c52fd[_0x993e('0x7')]!==_0x993e('0x8'))_0x2353d4[_0x13db4e](util[_0x993e('0x1d')](_0x993e('0x47'),_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x5')]));break;case 0x9:if(_0x1c52fd[_0x993e('0x7')]!==_0x993e('0x8'))_0x2353d4[_0x13db4e](util['format'](_0x993e('0x48'),_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x1c')],_0x3f7664[_0x52f148][_0x189a3b][_0x993e('0x5')]));break;case 0xa:_0x2353d4[_0x13db4e](util['format'](_0x993e('0x1f'),_0x3f7664[_0x52f148][_0x189a3b]['name']));break;}}}}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x5cd41a=_[_0x993e('0x18')](_0x1c52fd[_0x993e('0x25')],'id');return _0x1c52fd['removeChatInteractions'](_0x5cd41a)[_0x993e('0xd')](function(){for(var _0x207e27=0x0;_0x207e27<_0x5cd41a[_0x993e('0x41')];_0x207e27+=0x1){_0xfba00f[_0x993e('0x4a')](_0x993e('0x4b'),{'ChatInteractionId':Number(_0x5cd41a[_0x207e27]),'UserId':Number(_0x1c52fd['id'])});}});}})['then'](function(){if(_0x13db4e==='leave'){var _0x5ad215=_[_0x993e('0x18')](_0x1c52fd[_0x993e('0x26')],'id');return _0x1c52fd[_0x993e('0x4c')](_0x5ad215)[_0x993e('0xd')](function(){for(var _0x1f7813=0x0;_0x1f7813<_0x5ad215[_0x993e('0x41')];_0x1f7813+=0x1){_0xfba00f['emit'](_0x993e('0x4d'),{'MailInteractionId':Number(_0x5ad215[_0x1f7813]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x5224a7=_[_0x993e('0x18')](_0x1c52fd['FaxInteractions'],'id');return _0x1c52fd['removeFaxInteractions'](_0x5224a7)[_0x993e('0xd')](function(){for(var _0x37d7b1=0x0;_0x37d7b1<_0x5224a7['length'];_0x37d7b1+=0x1){_0xfba00f[_0x993e('0x4a')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x5224a7[_0x37d7b1]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x4a0dbd=_['map'](_0x1c52fd[_0x993e('0x29')],'id');return _0x1c52fd[_0x993e('0x4e')](_0x4a0dbd)[_0x993e('0xd')](function(){for(var _0x43b224=0x0;_0x43b224<_0x4a0dbd[_0x993e('0x41')];_0x43b224+=0x1){_0xfba00f[_0x993e('0x4a')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x4a0dbd[_0x43b224]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x493719=_[_0x993e('0x18')](_0x1c52fd[_0x993e('0x4f')],'id');return _0x1c52fd[_0x993e('0x50')](_0x493719)['then'](function(){for(var _0x426341=0x0;_0x426341<_0x493719[_0x993e('0x41')];_0x426341+=0x1){_0xfba00f[_0x993e('0x4a')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x493719[_0x426341]),'UserId':Number(_0x1c52fd['id'])});}});}})[_0x993e('0xd')](function(){if(_0x13db4e===_0x993e('0x49')){var _0x110a04=_['map'](_0x1c52fd['WhatsappInteractions'],'id');return _0x1c52fd['removeWhatsappInteractions'](_0x110a04)[_0x993e('0xd')](function(){for(var _0x98d16c=0x0;_0x98d16c<_0x110a04[_0x993e('0x41')];_0x98d16c+=0x1){_0xfba00f[_0x993e('0x4a')](_0x993e('0x51'),{'WhatsappInteractionId':Number(_0x110a04[_0x98d16c]),'UserId':Number(_0x1c52fd['id'])});}});}})['catch'](function(_0x18367f){_0x2353d4[_0x993e('0x52')](_0x18367f);});}}function onDisconnect(_0x1344de,_0x522cb3){joinOrLeave(_0x1344de,_0x993e('0x49'),_0x522cb3);}function onConnect(_0x2ec170){joinOrLeave(_0x2ec170,_0x993e('0x53'));}exports[_0x993e('0x54')]=function(_0x5e4ab1){_0x5e4ab1['on'](_0x993e('0x55'),function(_0x3d8c0d){_0x3d8c0d['setMaxListeners'](0x0);_0x3d8c0d['address']=_0x3d8c0d[_0x993e('0x56')][_0x993e('0x55')][_0x993e('0x57')]+':'+_0x3d8c0d[_0x993e('0x56')][_0x993e('0x55')][_0x993e('0x58')];_0x3d8c0d[_0x993e('0x59')]=new Date();_0x3d8c0d[_0x993e('0x52')]=function(_0x380751){console[_0x993e('0x52')](_0x993e('0x5a')+_0x3d8c0d[_0x993e('0x5b')][_0x993e('0x5')]+'['+_0x3d8c0d[_0x993e('0x5c')]+']',_0x380751);};_0x3d8c0d['on'](_0x993e('0x5d'),function(){onDisconnect(_0x3d8c0d,_0x5e4ab1);_0x3d8c0d[_0x993e('0x52')]('DISCONNECTED');});onConnect(_0x3d8c0d);_0x3d8c0d[_0x993e('0x52')](_0x993e('0x5e'));});}; \ No newline at end of file +var _0xda20=['findOne','then','autoAssociation','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','map','where','role','Campaign','format','%s:queue:%s','length','user:%s','Agents','handshake','query','find','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','VoiceQueues','userProfileId','VoiceQueue','ChatQueues','SmsQueue','IvrCampaigns','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getWhatsappQueues','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','address','request','remoteAddress','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','name','User','agent','type','ivr'];(function(_0x2312ad,_0x142f8a){var _0x34d760=function(_0x417e01){while(--_0x417e01){_0x2312ad['push'](_0x2312ad['shift']());}};_0x34d760(++_0x142f8a);}(_0xda20,0x1d9));var _0x0da2=function(_0x1b2ca6,_0x2bbea5){_0x1b2ca6=_0x1b2ca6-0x0;var _0x35e3eb=_0xda20[_0x1b2ca6];return _0x35e3eb;};'use strict';var _=require(_0x0da2('0x0'));var util=require('util');var BPromise=require(_0x0da2('0x1'));var db=require('../mysqldb')['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x0da2('0x2')],'include':[{'as':'Agents','model':db[_0x0da2('0x3')],'attributes':['id',_0x0da2('0x2'),'role'],'raw':!![],'where':{'role':_0x0da2('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0da2('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x0da2('0x2')]};var queryAgents={'raw':!![],'attributes':['id',_0x0da2('0x2')],'where':{'role':_0x0da2('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0da2('0x2'),_0x0da2('0x5')],'where':{'type':_0x0da2('0x6')}};function getAssociatedResources(_0x3e76ad,_0x131fa8,_0x248bce){return db['UserProfileSection'][_0x0da2('0x7')]({'where':{'name':_0x3e76ad,'userProfileId':_0x131fa8},'raw':!![]})[_0x0da2('0x8')](function(_0x18ff2b){if(_0x18ff2b){if(_0x18ff2b[_0x0da2('0x9')]){switch(_0x3e76ad){case'VoiceQueues':case'ChatQueues':case _0x0da2('0xa'):case _0x0da2('0xb'):case _0x0da2('0xc'):case _0x0da2('0xd'):case _0x0da2('0xe'):return db[_0x248bce][_0x0da2('0xf')](queryQueues);case _0x0da2('0x10'):return db[_0x248bce]['findAll'](queryTelephones);case _0x0da2('0x11'):return db[_0x248bce]['findAll'](queryTrunks);case'IvrCampaigns':return db[_0x248bce]['findAll'](queryCampaigns);}}else{return db[_0x0da2('0x12')]['findAll']({'attributes':[_0x0da2('0x13')],'where':{'sectionId':_0x18ff2b['id']},'raw':!![]})[_0x0da2('0x8')](function(_0x5d0f4e){if(_0x5d0f4e){var _0xa0613c={'where':{'id':_[_0x0da2('0x14')](_0x5d0f4e,'resourceId')},'raw':!![]};switch(_0x248bce){case _0x0da2('0x3'):_0xa0613c[_0x0da2('0x15')][_0x0da2('0x16')]='telephone';break;case _0x0da2('0x17'):_0xa0613c[_0x0da2('0x15')]['type']='ivr';break;}return db[_0x248bce][_0x0da2('0xf')](_0xa0613c);}else{return[];}});}}else{return[];}})['then'](function(_0x16e7ab){return _0x16e7ab;});}function joinOrLeaveQueues(_0x569834,_0x522b89,_0x495311,_0x5cf40a){_0x569834[_0x522b89](util[_0x0da2('0x18')](_0x0da2('0x19'),_0x495311,_0x5cf40a[_0x0da2('0x2')]));if(_0x5cf40a['Agents']){for(var _0x5304af=0x0;_0x5304af<_0x5cf40a['Agents'][_0x0da2('0x1a')];_0x5304af+=0x1){_0x569834[_0x522b89](util[_0x0da2('0x18')](_0x0da2('0x1b'),_0x5cf40a[_0x0da2('0x1c')][_0x5304af][_0x0da2('0x2')]));}}}function joinOrLeave(_0x51786b,_0x7a3708,_0x113c40){var _0x1c3ab0;if(_0x51786b[_0x0da2('0x1d')][_0x0da2('0x1e')]['id']){db[_0x0da2('0x3')][_0x0da2('0x1f')]({'attributes':['id',_0x0da2('0x2'),_0x0da2('0x16'),'userProfileId'],'where':{'id':_0x51786b[_0x0da2('0x1d')]['query']['id']},'include':[{'model':db[_0x0da2('0x20')],'as':_0x0da2('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x0da2('0x22')],'as':_0x0da2('0x23'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x0da2('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0da2('0x25')],'as':_0x0da2('0x26'),'attributes':['id'],'raw':!![]},{'model':db[_0x0da2('0x27')],'as':_0x0da2('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x0da2('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x525dc){if(_0x525dc){_0x1c3ab0=_0x525dc;_0x51786b[_0x7a3708](util[_0x0da2('0x18')](_0x0da2('0x1b'),_0x525dc[_0x0da2('0x2')]));var _0x1d17ad=[];switch(_0x525dc[_0x0da2('0x16')]){case _0x0da2('0x2a'):_0x51786b[_0x7a3708](_0x0da2('0x2b'));_0x51786b[_0x7a3708](_0x0da2('0x2c'));if(queryQueues[_0x0da2('0x2d')](_0x0da2('0x2e'))){delete queryQueues['include'];}_0x1d17ad['push'](db['VoiceQueue'][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db['ChatQueue']['findAll'](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x30')][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db['SmsQueue'][_0x0da2('0xf')](queryQueues));_0x1d17ad['push'](db[_0x0da2('0x31')][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x32')][_0x0da2('0xf')](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x33')]['findAll'](queryQueues));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x3')][_0x0da2('0xf')](queryTelephones));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x34')][_0x0da2('0xf')](queryTrunks));_0x1d17ad['push'](db[_0x0da2('0x17')][_0x0da2('0xf')](queryCampaigns));_0x1d17ad[_0x0da2('0x2f')](db[_0x0da2('0x3')]['findAll'](queryAgents));break;case'user':_0x51786b[_0x7a3708](_0x0da2('0x2b'));_0x51786b[_0x7a3708](_0x0da2('0x2c'));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x35'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x37')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x38'),_0x525dc[_0x0da2('0x36')],'ChatQueue'));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0xa'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x30')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0xb'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x39')));_0x1d17ad['push'](getAssociatedResources(_0x0da2('0xc'),_0x525dc['userProfileId'],'MailQueue'));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources('OpenchannelQueues',_0x525dc[_0x0da2('0x36')],_0x0da2('0x32')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0xe'),_0x525dc['userProfileId'],_0x0da2('0x33')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x10'),_0x525dc[_0x0da2('0x36')],_0x0da2('0x3')));_0x1d17ad[_0x0da2('0x2f')](getAssociatedResources(_0x0da2('0x11'),_0x525dc[_0x0da2('0x36')],'Trunk'));_0x1d17ad['push'](getAssociatedResources(_0x0da2('0x3a'),_0x525dc['userProfileId'],_0x0da2('0x17')));_0x1d17ad['push'](db[_0x0da2('0x3')]['findAll'](queryAgents));break;case'agent':_0x51786b[_0x7a3708]('voice:inbound');_0x51786b[_0x7a3708](_0x0da2('0x2c'));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3b')]({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad['push'](_0x525dc[_0x0da2('0x3c')]({'attributes':['id','name']}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3d')]({'attributes':['id','name']}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3e')]({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc['getMailQueues']({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc['getOpenchannelQueues']({'attributes':['id',_0x0da2('0x2')]}));_0x1d17ad[_0x0da2('0x2f')](_0x525dc[_0x0da2('0x3f')]({'attributes':['id',_0x0da2('0x2')]}));break;}return BPromise['all'](_0x1d17ad);}})[_0x0da2('0x8')](function(_0x5265f2){if(_0x5265f2&&_0x5265f2[_0x0da2('0x1a')]){for(var _0x971567=0x0;_0x971567<_0x5265f2[_0x0da2('0x1a')];_0x971567+=0x1){for(var _0x19fc01=0x0;_0x19fc01<_0x5265f2[_0x971567][_0x0da2('0x1a')];_0x19fc01+=0x1){switch(_0x971567){case 0x0:joinOrLeaveQueues(_0x51786b,_0x7a3708,'voice',_0x5265f2[_0x971567][_0x19fc01]);break;case 0x1:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x40'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x2:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x41'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x3:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x42'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x4:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x43'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x5:joinOrLeaveQueues(_0x51786b,_0x7a3708,'openchannel',_0x5265f2[_0x971567][_0x19fc01]);break;case 0x6:joinOrLeaveQueues(_0x51786b,_0x7a3708,_0x0da2('0x44'),_0x5265f2[_0x971567][_0x19fc01]);break;case 0x7:if(_0x1c3ab0[_0x0da2('0x16')]!==_0x0da2('0x4'))_0x51786b[_0x7a3708](util[_0x0da2('0x18')](_0x0da2('0x45'),_0x5265f2[_0x971567][_0x19fc01]['name']));break;case 0x8:if(_0x1c3ab0[_0x0da2('0x16')]!==_0x0da2('0x4'))_0x51786b[_0x7a3708](util[_0x0da2('0x18')](_0x0da2('0x46'),_0x5265f2[_0x971567][_0x19fc01][_0x0da2('0x2')]));break;case 0x9:if(_0x1c3ab0[_0x0da2('0x16')]!==_0x0da2('0x4'))_0x51786b[_0x7a3708](util['format'](_0x0da2('0x47'),_0x5265f2[_0x971567][_0x19fc01]['type'],_0x5265f2[_0x971567][_0x19fc01]['name']));break;case 0xa:_0x51786b[_0x7a3708](util['format'](_0x0da2('0x1b'),_0x5265f2[_0x971567][_0x19fc01][_0x0da2('0x2')]));break;}}}}})[_0x0da2('0x8')](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x5537e4=_[_0x0da2('0x14')](_0x1c3ab0['ChatInteractions'],'id');return _0x1c3ab0['removeChatInteractions'](_0x5537e4)['then'](function(){for(var _0x34ddb1=0x0;_0x34ddb1<_0x5537e4[_0x0da2('0x1a')];_0x34ddb1+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x4a'),{'ChatInteractionId':Number(_0x5537e4[_0x34ddb1]),'UserId':Number(_0x1c3ab0['id'])});}});}})['then'](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x42dcd9=_[_0x0da2('0x14')](_0x1c3ab0[_0x0da2('0x23')],'id');return _0x1c3ab0[_0x0da2('0x4b')](_0x42dcd9)[_0x0da2('0x8')](function(){for(var _0x44e99a=0x0;_0x44e99a<_0x42dcd9['length'];_0x44e99a+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x4c'),{'MailInteractionId':Number(_0x42dcd9[_0x44e99a]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x11ad94=_['map'](_0x1c3ab0['FaxInteractions'],'id');return _0x1c3ab0[_0x0da2('0x4d')](_0x11ad94)[_0x0da2('0x8')](function(){for(var _0x53b355=0x0;_0x53b355<_0x11ad94['length'];_0x53b355+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x4e'),{'FaxInteractionId':Number(_0x11ad94[_0x53b355]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708===_0x0da2('0x48')){var _0x8c48d6=_[_0x0da2('0x14')](_0x1c3ab0[_0x0da2('0x26')],'id');return _0x1c3ab0[_0x0da2('0x4f')](_0x8c48d6)[_0x0da2('0x8')](function(){for(var _0x2e0236=0x0;_0x2e0236<_0x8c48d6[_0x0da2('0x1a')];_0x2e0236+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x50'),{'SmsInteractionId':Number(_0x8c48d6[_0x2e0236]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708==='leave'){var _0x10cda4=_['map'](_0x1c3ab0['OpenchannelInteractions'],'id');return _0x1c3ab0[_0x0da2('0x51')](_0x10cda4)[_0x0da2('0x8')](function(){for(var _0x33e12e=0x0;_0x33e12e<_0x10cda4[_0x0da2('0x1a')];_0x33e12e+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x52'),{'OpenchannelInteractionId':Number(_0x10cda4[_0x33e12e]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x8')](function(){if(_0x7a3708==='leave'){var _0x50abf1=_[_0x0da2('0x14')](_0x1c3ab0['WhatsappInteractions'],'id');return _0x1c3ab0['removeWhatsappInteractions'](_0x50abf1)[_0x0da2('0x8')](function(){for(var _0x3527cd=0x0;_0x3527cd<_0x50abf1[_0x0da2('0x1a')];_0x3527cd+=0x1){_0x113c40[_0x0da2('0x49')](_0x0da2('0x53'),{'WhatsappInteractionId':Number(_0x50abf1[_0x3527cd]),'UserId':Number(_0x1c3ab0['id'])});}});}})[_0x0da2('0x54')](function(_0x571728){_0x51786b[_0x0da2('0x55')](_0x571728);});}}function onDisconnect(_0xd2d895,_0x1cfc42){joinOrLeave(_0xd2d895,_0x0da2('0x48'),_0x1cfc42);}function onConnect(_0x4d2cf9){joinOrLeave(_0x4d2cf9,_0x0da2('0x56'));}exports[_0x0da2('0x57')]=function(_0x49ef1d){_0x49ef1d['on'](_0x0da2('0x58'),function(_0x5984ab){_0x5984ab[_0x0da2('0x59')](0x0);_0x5984ab[_0x0da2('0x5a')]=_0x5984ab[_0x0da2('0x5b')][_0x0da2('0x58')][_0x0da2('0x5c')]+':'+_0x5984ab[_0x0da2('0x5b')]['connection']['remotePort'];_0x5984ab['connectedAt']=new Date();_0x5984ab[_0x0da2('0x55')]=function(_0x3313b2){console[_0x0da2('0x55')]('SocketIO\x20'+_0x5984ab['nsp'][_0x0da2('0x2')]+'['+_0x5984ab['address']+']',_0x3313b2);};_0x5984ab['on'](_0x0da2('0x5d'),function(){onDisconnect(_0x5984ab,_0x49ef1d);_0x5984ab[_0x0da2('0x55')](_0x0da2('0x5e'));});onConnect(_0x5984ab);_0x5984ab[_0x0da2('0x55')](_0x0da2('0x5f'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 658b9b0..9676ee6 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 _0x8d46=['OpenchannelInteraction','Openchannel','request','EventManager','then','info','error','code','Trigger,\x20%s','get','channel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','agent','AfterCreateMessage','motionChannel','offlineMessage','sequelize','query','format','catch','AfterCreate','changed','closed','substatus','AfterUpdate','User','find','fullname','email','internal','length','hasOwnProperty','model','hook','callback','toLowerCase','../../mysqldb','jayson/promise','../logger','triggers','client','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','Whatsapp','WhatsappInteraction','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0x8d46,0x193));var _0x68d4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x8d46[_0x2641f9];return _0x585741;};'use strict';var util=require('util');var db=require(_0x68d4('0x0'))['db'];var jayson=require(_0x68d4('0x1'));var logger=require(_0x68d4('0x2'))(_0x68d4('0x3'));var client=jayson[_0x68d4('0x4')]['http']({'port':0x232a});var triggers=[{'channel':_0x68d4('0x5'),'model':_0x68d4('0x6'),'event':_0x68d4('0x7'),'condition':_0x68d4('0x8'),'callback':afterCreate},{'channel':_0x68d4('0x5'),'model':'ChatInteraction','event':'afterUpdate','condition':_0x68d4('0x9'),'callback':afterUpdate},{'channel':_0x68d4('0x5'),'model':'ChatMessage','event':'afterCreate','condition':_0x68d4('0xa'),'callback':afterCreateMessage},{'channel':'Chat','model':_0x68d4('0xb'),'event':_0x68d4('0x7'),'condition':_0x68d4('0xa'),'callback':afterCreateOfflineMessage},{'channel':_0x68d4('0xc'),'model':_0x68d4('0xd'),'event':_0x68d4('0x7'),'condition':_0x68d4('0x8'),'callback':afterCreate},{'channel':'Sms','model':_0x68d4('0xd'),'event':_0x68d4('0xe'),'condition':'closedinteraction','callback':afterUpdate},{'channel':'Sms','model':'SmsMessage','event':_0x68d4('0x7'),'condition':_0x68d4('0xa'),'callback':afterCreateMessage},{'channel':_0x68d4('0xf'),'model':_0x68d4('0x10'),'event':_0x68d4('0x7'),'condition':_0x68d4('0x8'),'callback':afterCreate},{'channel':_0x68d4('0xf'),'model':_0x68d4('0x10'),'event':'afterUpdate','condition':_0x68d4('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':_0x68d4('0x7'),'condition':_0x68d4('0xa'),'callback':afterCreateMessage},{'channel':_0x68d4('0x11'),'model':_0x68d4('0x12'),'event':_0x68d4('0x7'),'condition':'newinteraction','callback':afterCreate},{'channel':_0x68d4('0x11'),'model':_0x68d4('0x12'),'event':_0x68d4('0xe'),'condition':_0x68d4('0x9'),'callback':afterUpdate},{'channel':_0x68d4('0x11'),'model':_0x68d4('0x13'),'event':_0x68d4('0x7'),'condition':_0x68d4('0xa'),'callback':afterCreateMessage},{'channel':_0x68d4('0x14'),'model':_0x68d4('0x15'),'event':_0x68d4('0x7'),'condition':_0x68d4('0x8'),'callback':afterCreate},{'channel':_0x68d4('0x14'),'model':_0x68d4('0x15'),'event':_0x68d4('0xe'),'condition':_0x68d4('0x9'),'callback':afterUpdate},{'channel':_0x68d4('0x14'),'model':_0x68d4('0x16'),'event':_0x68d4('0x7'),'condition':_0x68d4('0xa'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0x68d4('0x17'),'event':_0x68d4('0x7'),'condition':_0x68d4('0x8'),'callback':afterCreate},{'channel':_0x68d4('0x18'),'model':_0x68d4('0x17'),'event':_0x68d4('0xe'),'condition':_0x68d4('0x9'),'callback':afterUpdate},{'channel':_0x68d4('0x18'),'model':'OpenchannelMessage','event':_0x68d4('0x7'),'condition':_0x68d4('0xa'),'callback':afterCreateMessage}];function request(_0x6d4240){return client[_0x68d4('0x19')](_0x68d4('0x1a'),_0x6d4240)[_0x68d4('0x1b')](function(_0x43ca0b){logger[_0x68d4('0x1c')]('Trigger,\x20%s',_0x68d4('0x1a'),_0x43ca0b);if(_0x43ca0b['error']){if(_0x43ca0b[_0x68d4('0x1d')][_0x68d4('0x1e')]===0x1f4){logger[_0x68d4('0x1d')](_0x68d4('0x1f'),_0x68d4('0x1a'),_0x43ca0b[_0x68d4('0x1d')]);}}})['catch'](function(_0x47914a){logger['error'](_0x68d4('0x1f'),'EventManager',_0x47914a);});}function afterCreateMessage(_0x540805){return function(_0x3c8717){_0x3c8717=_0x3c8717[_0x68d4('0x20')]({'plain':!![]});_0x3c8717[_0x68d4('0x21')]=_0x540805;_0x3c8717['motionChannel']=_0x540805;_0x3c8717[_0x68d4('0x22')]=_0x3c8717[_0x68d4('0x23')];Promise[_0x68d4('0x24')]()[_0x68d4('0x1b')](function(){if(typeof _0x3c8717[_0x68d4('0x25')]===_0x68d4('0x26'))return null;var _0x3c2afb=_0x68d4('0x27')+_0x3c8717[_0x68d4('0x25')];return db['sequelize']['query'](_0x3c2afb,{'type':db['Sequelize'][_0x68d4('0x28')][_0x68d4('0x29')],'raw':!![]});})[_0x68d4('0x1b')](function(_0x4aa1d6){if(_0x4aa1d6){_0x3c8717[_0x68d4('0x2a')]=_0x4aa1d6[0x0];}if(typeof _0x3c8717[_0x68d4('0x2b')]===_0x68d4('0x26'))return;return getAgent(_0x3c8717[_0x68d4('0x2b')]);})[_0x68d4('0x1b')](function(_0xa4e017){if(_0xa4e017){_0x3c8717[_0x68d4('0x2c')]=util['format'](_0x68d4('0x2d'),_0xa4e017[_0x68d4('0x2e')]);_0x3c8717[_0x68d4('0x2f')]=_0xa4e017;_0x3c8717[_0x68d4('0x21')]=_0x540805;return request({'event':'incomingmessage','message':_0x3c8717});}else{return request({'event':'outgoingmessage','message':_0x3c8717});}})['catch'](function(_0x1f9312){logger[_0x68d4('0x1d')](_0x68d4('0x1f'),_0x68d4('0x30'),_0x1f9312);});};}function afterCreateOfflineMessage(_0x56fdcf){return function(_0x5b8459){_0x5b8459=_0x5b8459['get']({'plain':!![]});_0x5b8459['channel']=_0x56fdcf;_0x5b8459[_0x68d4('0x31')]=_0x56fdcf;_0x5b8459['event']=_0x68d4('0x32');return request({'event':_0x5b8459[_0x68d4('0x22')],'message':_0x5b8459});};}function afterCreate(_0xa29e48,_0x1305de){return function(_0x1719df){var _0x217268=_0x1719df['get']({'plain':!![]});_0x217268[_0x68d4('0x21')]=_0xa29e48;_0x217268[_0x68d4('0x31')]=_0xa29e48;_0x217268[_0x68d4('0x22')]='opened';Promise[_0x68d4('0x24')]()[_0x68d4('0x1b')](function(){var _0x3403ad=_0x68d4('0x27')+_0x217268['ContactId'];return db[_0x68d4('0x33')][_0x68d4('0x34')](_0x3403ad,{'type':db['Sequelize'][_0x68d4('0x28')][_0x68d4('0x29')],'raw':!![]});})[_0x68d4('0x1b')](function(_0x216441){if(_0x216441){_0x217268[_0x68d4('0x2a')]=_0x216441[0x0];}if(_0x217268[_0x68d4('0x2b')]){return getAgent(_0x217268[_0x68d4('0x2b')]);}return;})['then'](function(_0x197dd0){if(_0x197dd0){_0x217268['interface']=util[_0x68d4('0x35')](_0x68d4('0x2d'),_0x197dd0[_0x68d4('0x2e')]);_0x217268[_0x68d4('0x2f')]=_0x197dd0;}return request({'event':_0x1305de,'message':_0x217268});})[_0x68d4('0x36')](function(_0x2a1d52){logger[_0x68d4('0x1d')](_0x68d4('0x1f'),_0x68d4('0x37'),_0x2a1d52);});};}function afterUpdate(_0x45fc2b){return function(_0x439bcd){var _0x45c93d=_0x439bcd[_0x68d4('0x38')](_0x68d4('0x39'))&&_0x439bcd['closed'];var _0xaaa3f4=_0x439bcd[_0x68d4('0x38')](_0x68d4('0x3a'));if(_0x45c93d||_0xaaa3f4){var _0x3078d5=_0x45c93d?_0x68d4('0x9'):_0x68d4('0x3a');var _0x36299c=_0x439bcd[_0x68d4('0x20')]({'plain':!![]});_0x36299c['channel']=_0x45fc2b;_0x36299c[_0x68d4('0x31')]=_0x45fc2b;_0x36299c[_0x68d4('0x22')]=_0x45c93d?_0x68d4('0x39'):_0x68d4('0x3a');var _0xfc1017='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x36299c['ContactId'];return db[_0x68d4('0x33')]['query'](_0xfc1017,{'type':db['Sequelize'][_0x68d4('0x28')][_0x68d4('0x29')],'raw':!![]})[_0x68d4('0x1b')](function(_0x191254){if(_0x191254){_0x36299c['contact']=_0x191254[0x0];}if(typeof _0x36299c[_0x68d4('0x2b')]===_0x68d4('0x26'))return;return getAgent(_0x36299c[_0x68d4('0x2b')]);})[_0x68d4('0x1b')](function(_0xaf2ec8){if(_0xaf2ec8){_0x36299c[_0x68d4('0x2c')]=util['format'](_0x68d4('0x2d'),_0xaf2ec8[_0x68d4('0x2e')]);_0x36299c[_0x68d4('0x2f')]=_0xaf2ec8;}return request({'event':_0x3078d5,'message':_0x36299c});})[_0x68d4('0x36')](function(_0x49b9fd){logger[_0x68d4('0x1d')]('Trigger,\x20%s',_0x68d4('0x3b'),_0x49b9fd);});}};}function getAgent(_0x529f30){return db[_0x68d4('0x3c')][_0x68d4('0x3d')]({'where':{'id':_0x529f30},'attributes':['id',_0x68d4('0x2e'),_0x68d4('0x3e'),_0x68d4('0x3f'),_0x68d4('0x40')],'raw':!![]})[_0x68d4('0x1b')](function(_0x28abdb){return _0x28abdb;});}exports['default']=function(){for(var _0x50efcf=0x0;_0x50efcf=_0x2f6b37[_0x3ef5('0x12')]){throw Error(_0x3ef5('0x13'));}_0x47e128(_0x438e8d);})[_0x3ef5('0x14')](function(_0x3b9c09){_0x45c560(_0x3b9c09);});});}; \ No newline at end of file +var _0xb524=['then','agents','Maximum\x20login\x20has\x20been\x20reached','lodash','../mysqldb','voice','mail','chat','fax','sms','whatsapp','openchannel','toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','User','count','agent'];(function(_0x359058,_0x2175a3){var _0x9ced29=function(_0x53f1bc){while(--_0x53f1bc){_0x359058['push'](_0x359058['shift']());}};_0x9ced29(++_0x2175a3);}(_0xb524,0xc9));var _0x4b52=function(_0x5c90ea,_0x457b03){_0x5c90ea=_0x5c90ea-0x0;var _0x2620fb=_0xb524[_0x5c90ea];return _0x2620fb;};'use strict';var _=require(_0x4b52('0x0'));var BPromise=require('bluebird');var db=require(_0x4b52('0x1'))['db'];var util=require('./license/util');var channels=[_0x4b52('0x2'),_0x4b52('0x3'),_0x4b52('0x4'),_0x4b52('0x5'),_0x4b52('0x6'),_0x4b52('0x7'),_0x4b52('0x8')];exports['getChannels']=function(){return channels;};exports['isValidChannel']=function(_0xd4e7e6){_0xd4e7e6=_0xd4e7e6[_0x4b52('0x9')]();return _[_0x4b52('0xa')](channels,_0xd4e7e6);};exports['clearBlockUser']=function(_0x3edd93,_0x49dbec,_0x272483,_0x576ffb){var _0x4e09cd={'loginAttempts':_0x49dbec,'blocked':_0x272483};if(!_[_0x4b52('0xb')](_0x576ffb)){_0x4e09cd[_0x4b52('0xc')]=_0x576ffb;}return _0x3edd93[_0x4b52('0xd')](_0x4e09cd);};exports[_0x4b52('0xe')]=function(_0x1f8e99){return new BPromise(function(_0x253e66,_0x558f1b){var _0x3657ce=0x0;if(_0x1f8e99[_0x4b52('0xf')]!=='agent'){_0x253e66(_0x1f8e99);}db[_0x4b52('0x10')][_0x4b52('0x11')]({'where':{'role':_0x4b52('0x12'),'online':!![],'id':{'$ne':_0x1f8e99['id']}}})[_0x4b52('0x13')](function(_0x4b7900){_0x3657ce=_0x4b7900;return util[_0x4b52('0xe')]();})[_0x4b52('0x13')](function(_0x59156b){if(_0x59156b&&_0x59156b[_0x4b52('0x14')]&&_0x3657ce>=_0x59156b[_0x4b52('0x14')]){throw Error(_0x4b52('0x15'));}_0x253e66(_0x1f8e99);})['catch'](function(_0x506a1c){_0x558f1b(_0x506a1c);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index facc179..2bf95a7 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x01f1=['Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','Conflict','Not\x20Found','error','status','send','exports','util','api','name','Error','Bad\x20Request','inherits','Forbidden','message'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0x01f1,0x76));var _0x101f=function(_0x525b28,_0x5cf5a0){_0x525b28=_0x525b28-0x0;var _0x180178=_0x01f1[_0x525b28];return _0x180178;};'use strict';var util=require(_0x101f('0x0'));var logger=require('../config/logger')(_0x101f('0x1'));var APIError=function(_0x1e97b4,_0x58b137){this['message']=_0x1e97b4||'Internal\x20Server\x20Error';this[_0x101f('0x2')]=_0x58b137||_0x101f('0x3');util['inherits'](APIError,Error);};var APIBadRequestError=function(_0x20256d){this['message']=_0x20256d||_0x101f('0x4');this[_0x101f('0x2')]='Bad\x20Request';util[_0x101f('0x5')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x39a702){this['message']=_0x39a702||_0x101f('0x6');this['name']=_0x101f('0x6');util[_0x101f('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x30514d){this[_0x101f('0x7')]=_0x30514d||'Entity\x20not\x20found';this[_0x101f('0x2')]='Not\x20Found';util['inherits'](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3aa9ab){this[_0x101f('0x7')]=_0x3aa9ab||_0x101f('0x8');this[_0x101f('0x2')]=_0x101f('0x9');this[_0x101f('0xa')]=0x193;this[_0x101f('0xb')]={'type':'OutOfInterval'};util[_0x101f('0x5')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x761233){this['message']=_0x761233||'Resource\x20Conflict';this[_0x101f('0x2')]=_0x101f('0xc');util[_0x101f('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x110daa){switch(_0x110daa){case _0x101f('0x4'):return 0x190;case _0x101f('0x6'),'Out\x20Of\x20Interval':return 0x193;case _0x101f('0xd'):return 0x194;case _0x101f('0xc'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x3fd24b){if(_0x3fd24b===_0x101f('0x9'))return _0x3fd24b;return null;}function handleError(_0x2f8079){return function(_0x2add05){logger[_0x101f('0xe')](_0x2add05['stack']);var _0xc33174=getStatusCode(_0x2add05[_0x101f('0x2')]);var _0x3a822d=getCustomStatusMessage(_0x2add05[_0x101f('0x2')]);if(_0x2add05[_0x101f('0x2')]){delete _0x2add05[_0x101f('0x2')];}if(_0x3a822d){_0x2f8079['statusMessage']=_0x3a822d;}return _0x2f8079[_0x101f('0xf')](_0xc33174)[_0x101f('0x10')](_0x2add05);};}module[_0x101f('0x11')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xea82=['api','message','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Resource\x20Conflict','Conflict','error','statusMessage','util'];(function(_0x4641b3,_0xad3d46){var _0xbcd73b=function(_0x47fe25){while(--_0x47fe25){_0x4641b3['push'](_0x4641b3['shift']());}};_0xbcd73b(++_0xad3d46);}(_0xea82,0x131));var _0x2ea8=function(_0x5d93a4,_0x10fca8){_0x5d93a4=_0x5d93a4-0x0;var _0x17b491=_0xea82[_0x5d93a4];return _0x17b491;};'use strict';var util=require(_0x2ea8('0x0'));var logger=require('../config/logger')(_0x2ea8('0x1'));var APIError=function(_0x1e5c10,_0x2a74f7){this[_0x2ea8('0x2')]=_0x1e5c10||'Internal\x20Server\x20Error';this[_0x2ea8('0x3')]=_0x2a74f7||'Error';util[_0x2ea8('0x4')](APIError,Error);};var APIBadRequestError=function(_0x19148){this[_0x2ea8('0x2')]=_0x19148||_0x2ea8('0x5');this[_0x2ea8('0x3')]=_0x2ea8('0x5');util[_0x2ea8('0x4')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x13aa3b){this[_0x2ea8('0x2')]=_0x13aa3b||_0x2ea8('0x6');this[_0x2ea8('0x3')]=_0x2ea8('0x6');util[_0x2ea8('0x4')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x5895f1){this['message']=_0x5895f1||_0x2ea8('0x7');this[_0x2ea8('0x3')]=_0x2ea8('0x8');util[_0x2ea8('0x4')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0xfee93b){this[_0x2ea8('0x2')]=_0xfee93b||_0x2ea8('0x9');this['name']=_0x2ea8('0xa');this[_0x2ea8('0xb')]=0x193;this[_0x2ea8('0xc')]={'type':_0x2ea8('0xd')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x49c729){this[_0x2ea8('0x2')]=_0x49c729||_0x2ea8('0xe');this[_0x2ea8('0x3')]=_0x2ea8('0xf');util[_0x2ea8('0x4')](APIBadRequestError,APIError);};function getStatusCode(_0x3fd813){switch(_0x3fd813){case _0x2ea8('0x5'):return 0x190;case _0x2ea8('0x6'),_0x2ea8('0xa'):return 0x193;case'Not\x20Found':return 0x194;case'Conflict':return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1afc64){if(_0x1afc64==='Out\x20Of\x20Interval')return _0x1afc64;return null;}function handleError(_0x106528){return function(_0xb1e33f){logger[_0x2ea8('0x10')](_0xb1e33f['stack']);var _0x17c724=getStatusCode(_0xb1e33f['name']);var _0x312ca7=getCustomStatusMessage(_0xb1e33f[_0x2ea8('0x3')]);if(_0xb1e33f['name']){delete _0xb1e33f['name'];}if(_0x312ca7){_0x106528[_0x2ea8('0x11')]=_0x312ca7;}return _0x106528['status'](_0x17c724)['send'](_0xb1e33f);};}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 b8f3c75..2bb9f86 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8b1=['json','exports','404','render','status'];(function(_0x296c14,_0x232f57){var _0x5454bc=function(_0x434973){while(--_0x434973){_0x296c14['push'](_0x296c14['shift']());}};_0x5454bc(++_0x232f57);}(_0xa8b1,0x182));var _0x1a8b=function(_0xffde61,_0x559c33){_0xffde61=_0xffde61-0x0;var _0x22cc1d=_0xa8b1[_0xffde61];return _0x22cc1d;};'use strict';module[_0x1a8b('0x0')][0x194]=function pageNotFound(_0x30c0aa,_0x1a339f){var _0x3003e6=_0x1a8b('0x1');var _0x2bf605=0x194;var _0xd654e6={'status':_0x2bf605};_0x1a339f['status'](_0xd654e6['status']);_0x1a339f[_0x1a8b('0x2')](_0x3003e6,{},function(_0xd117a2,_0x57eaa3){if(_0xd117a2){return _0x1a339f[_0x1a8b('0x3')](_0xd654e6[_0x1a8b('0x3')])[_0x1a8b('0x4')](_0xd654e6);}_0x1a339f['send'](_0x57eaa3);});}; \ No newline at end of file +var _0xcece=['status','render','json','send'];(function(_0x47ae6c,_0x268531){var _0x360bdd=function(_0x4e6534){while(--_0x4e6534){_0x47ae6c['push'](_0x47ae6c['shift']());}};_0x360bdd(++_0x268531);}(_0xcece,0x1f4));var _0xecec=function(_0x11f854,_0x1e3488){_0x11f854=_0x11f854-0x0;var _0x5cfb7e=_0xcece[_0x11f854];return _0x5cfb7e;};'use strict';module['exports'][0x194]=function pageNotFound(_0x31c68c,_0x616db7){var _0x27a19a='404';var _0x2fd38a=0x194;var _0x4e01ab={'status':_0x2fd38a};_0x616db7[_0xecec('0x0')](_0x4e01ab[_0xecec('0x0')]);_0x616db7[_0xecec('0x1')](_0x27a19a,{},function(_0x372ee1,_0x3ee8b3){if(_0x372ee1){return _0x616db7[_0xecec('0x0')](_0x4e01ab[_0xecec('0x0')])[_0xecec('0x2')](_0x4e01ab);}_0x616db7[_0xecec('0x3')](_0x3ee8b3);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 7ed14e7..14e3043 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5098=['ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','CampaignId','OwnerId','Campaign','AutomationAllId','Any','AutomationAnyId','Action','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','AnalyticCustomReport','MetricId','Configurations','AccountId','SalesforceField','Subjects','SubjectId','Descriptions','DescriptionId','Fields','FieldId','Subject','Description','Field','VariableId','SugarcrmAccount','DeskConfiguration','ZendeskConfiguration','ZendeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','JscriptyProject','TeamVoiceQueue','team_has_chat_queues','team_has_sms_queues','WhatsappQueues','TrunkBackupId','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','ToUserId','ToQueue','ToMailAccountId','ToAccount','FromAgent','ToAgent','ToChatQueueId','FromFaxAccountId','ToFaxQueueId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','UserProfileResource','sectionId','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','../config/environment','lodash','jstz','determine','sequelize','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','sequelizeHistory','database','username','password','options','User','import','../api/user/user.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/action/action.model','Automation','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','Interval','../api/interval/interval.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','../api/schedule/schedule.model','Sound','../api/sound/sound.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','Variable','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','Network','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','../api/cloudProvider/cloudProvider.model','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','VoiceMail','cascade','UserId','userSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','ChatInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','VoiceChanSpy','SpiedAgents','Applications','VoiceMusicOnHold','moh_has_sounds','Members','HopperHistories','VoiceQueueId','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Agents','Teams','BlackLists','ScreenRecording','Messages','mailboxuser','mailbox','VoiceMailMessage','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','ContactId','MailAccountId','CloudProvider','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','MailMessage','Interactions','ListId','user_has_mail_accounts','team_has_mail_queues','Account','Owner','Tag','mail_interaction_has_tags','Tags','ThroughTags','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','ChatOfflineMessageId','TagId','MailQueueReport','List','Dashboard','Items','FaxAccountId','CannedAnswer','Exntensions','FaxMessage','FaxInteractionId','Users','AttachmentId','team_has_fax_queues','SmsAccount','SmsAccountId','Pause','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','user_has_chat_websites','Agent','Queue','ChatQueueId','Website','ChatMessage'];(function(_0x18b033,_0x1507fd){var _0x21c86d=function(_0x13f300){while(--_0x13f300){_0x18b033['push'](_0x18b033['shift']());}};_0x21c86d(++_0x1507fd);}(_0x5098,0x6a));var _0x8509=function(_0x50b789,_0xc2c9bb){_0x50b789=_0x50b789-0x0;var _0x91eea6=_0x5098[_0x50b789];return _0x91eea6;};'use strict';var config=require(_0x8509('0x0'));var Sequelize=require('sequelize');var _=require(_0x8509('0x1'));var jstz=require(_0x8509('0x2'));var timezone=jstz[_0x8509('0x3')]();config[_0x8509('0x4')]=_['defaultsDeep'](config[_0x8509('0x4')],{'database':_0x8509('0x5'),'username':_0x8509('0x6'),'password':_0x8509('0x7'),'options':{'host':_0x8509('0x8'),'port':0xcea,'dialect':_0x8509('0x9'),'dialectOptions':{'charset':_0x8509('0xa')},'logging':![],'timezone':timezone[_0x8509('0xb')](),'define':{'charset':_0x8509('0xc'),'collate':'utf8_general_ci'}}});config[_0x8509('0xd')]=_['defaultsDeep'](config[_0x8509('0xd')],{'database':_0x8509('0x5'),'username':_0x8509('0x6'),'password':'xC@LL1234','options':{'host':_0x8509('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x8509('0xa')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8509('0x4')][_0x8509('0xe')],config[_0x8509('0x4')][_0x8509('0xf')],config[_0x8509('0x4')][_0x8509('0x10')],config[_0x8509('0x4')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x8509('0xd')][_0x8509('0xe')],config['sequelizeHistory'][_0x8509('0xf')],config[_0x8509('0xd')][_0x8509('0x10')],config['sequelizeHistory'][_0x8509('0x11')])};db[_0x8509('0x12')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x14'));db['VoiceChanSpy']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x8509('0x15')]=db[_0x8509('0x4')]['import'](_0x8509('0x16'));db[_0x8509('0x17')]=db[_0x8509('0x4')]['import'](_0x8509('0x18'));db['VoiceMusicOnHold']=db['sequelize'][_0x8509('0x13')](_0x8509('0x19'));db[_0x8509('0x1a')]=db[_0x8509('0x4')]['import'](_0x8509('0x1b'));db[_0x8509('0x1c')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x1d'));db['ScreenRecording']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x1e'));db['VoiceMail']=db['sequelize'][_0x8509('0x13')](_0x8509('0x1f'));db['VoiceMailMessage']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0x8509('0x20')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x21'));db[_0x8509('0x22')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x23'));db['VoiceAgentReport']=db[_0x8509('0x4')]['import'](_0x8509('0x24'));db[_0x8509('0x25')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x26'));db[_0x8509('0x27')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x28'));db[_0x8509('0x29')]=db['sequelize']['import']('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0x8509('0x13')]('../api/voiceTransferReport/voiceTransferReport.model');db[_0x8509('0x2a')]=db[_0x8509('0x4')]['import'](_0x8509('0x2b'));db[_0x8509('0x2c')]=db['sequelize'][_0x8509('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x8509('0x2d')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x2e'));db[_0x8509('0x2f')]=db[_0x8509('0x4')]['import'](_0x8509('0x30'));db[_0x8509('0x31')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x32'));db['UserSmsQueue']=db[_0x8509('0x4')]['import'](_0x8509('0x33'));db[_0x8509('0x34')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x35'));db[_0x8509('0x36')]=db['sequelize']['import'](_0x8509('0x37'));db[_0x8509('0x38')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x39'));db[_0x8509('0x3a')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x3b'));db[_0x8509('0x3c')]=db[_0x8509('0x4')]['import'](_0x8509('0x3d'));db[_0x8509('0x3e')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x3f'));db['MailSubstatus']=db[_0x8509('0x4')]['import'](_0x8509('0x40'));db[_0x8509('0x41')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x42'));db['MailMessage']=db[_0x8509('0x4')]['import'](_0x8509('0x43'));db[_0x8509('0x44')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x45'));db['MailQueueReport']=db[_0x8509('0x4')]['import'](_0x8509('0x46'));db['Dashboard']=db[_0x8509('0x4')]['import'](_0x8509('0x47'));db[_0x8509('0x48')]=db[_0x8509('0x4')]['import'](_0x8509('0x49'));db[_0x8509('0x4a')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/faxAccount/faxAccount.model');db[_0x8509('0x4b')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x4c'));db[_0x8509('0x4d')]=db[_0x8509('0x4')]['import'](_0x8509('0x4e'));db['FaxMessage']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/faxMessage/faxMessage.model');db[_0x8509('0x4f')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x50'));db[_0x8509('0x51')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x52'));db['SmsAccount']=db['sequelize'][_0x8509('0x13')]('../api/smsAccount/smsAccount.model');db[_0x8509('0x53')]=db['sequelize'][_0x8509('0x13')]('../api/smsApplication/smsApplication.model');db[_0x8509('0x54')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x55'));db[_0x8509('0x56')]=db[_0x8509('0x4')]['import']('../api/smsMessage/smsMessage.model');db[_0x8509('0x57')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x58'));db[_0x8509('0x59')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x5a'));db[_0x8509('0x5b')]=db[_0x8509('0x4')]['import'](_0x8509('0x5c'));db[_0x8509('0x5d')]=db[_0x8509('0x4')]['import'](_0x8509('0x5e'));db[_0x8509('0x5f')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x60'));db[_0x8509('0x61')]=db[_0x8509('0x4')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0x8509('0x62')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x63'));db[_0x8509('0x64')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x65'));db[_0x8509('0x66')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/chatApplication/chatApplication.model');db['ChatInteraction']=db[_0x8509('0x4')]['import'](_0x8509('0x67'));db['ChatMessage']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x68'));db['ChatOfflineMessage']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x69'));db[_0x8509('0x6a')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x6b'));db[_0x8509('0x6c')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/chatGroup/chatGroup.model');db['ChatProactiveAction']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x6d'));db[_0x8509('0x6e')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x6f'));db['CmContact']=db[_0x8509('0x4')]['import'](_0x8509('0x70'));db[_0x8509('0x71')]=db[_0x8509('0x4')]['import'](_0x8509('0x72'));db[_0x8509('0x73')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x74'));db[_0x8509('0x75')]=db[_0x8509('0x4')]['import']('../api/cmHopperFinal/cmHopperFinal.model');db[_0x8509('0x76')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x77'));db[_0x8509('0x78')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x79'));db[_0x8509('0x7a')]=db['sequelize'][_0x8509('0x13')]('../api/cmCustomField/cmCustomField.model');db['Action']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x7b'));db[_0x8509('0x7c')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/automation/automation.model');db['CannedAnswer']=db['sequelize'][_0x8509('0x13')](_0x8509('0x7d'));db[_0x8509('0x7e')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/disposition/disposition.model');db[_0x8509('0x7f')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/condition/condition.model');db[_0x8509('0x80')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x81'));db['Pause']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/pause/pause.model');db[_0x8509('0x82')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x83'));db[_0x8509('0x84')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x85'));db['Schedule']=db[_0x8509('0x4')]['import'](_0x8509('0x86'));db[_0x8509('0x87')]=db['sequelize']['import'](_0x8509('0x88'));db['Tag']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/tag/tag.model');db[_0x8509('0x89')]=db[_0x8509('0x4')]['import'](_0x8509('0x8a'));db[_0x8509('0x8b')]=db[_0x8509('0x4')]['import'](_0x8509('0x8c'));db['CmHopperAdditionalPhone']=db['sequelize'][_0x8509('0x13')](_0x8509('0x8d'));db[_0x8509('0x8e')]=db[_0x8509('0x4')]['import'](_0x8509('0x8f'));db['Trigger']=db['sequelize'][_0x8509('0x13')]('../api/trigger/trigger.model');db[_0x8509('0x90')]=db['sequelize'][_0x8509('0x13')]('../api/variable/variable.model');db['Integration']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x91'));db[_0x8509('0x92')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x93'));db['AnalyticCustomReport']=db[_0x8509('0x4')]['import'](_0x8509('0x94'));db[_0x8509('0x95')]=db[_0x8509('0x4')]['import'](_0x8509('0x96'));db[_0x8509('0x97')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x98'));db[_0x8509('0x99')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x9a'));db[_0x8509('0x9b')]=db['sequelize']['import'](_0x8509('0x9c'));db[_0x8509('0x9d')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x8509('0x9e')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x9f'));db[_0x8509('0xa0')]=db[_0x8509('0x4')]['import']('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db['SalesforceField']=db['sequelize']['import'](_0x8509('0xa1'));db['SugarcrmAccount']=db[_0x8509('0x4')]['import'](_0x8509('0xa2'));db[_0x8509('0xa3')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0x8509('0xa4')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xa5'));db[_0x8509('0xa6')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intDeskAccount/intDeskAccount.model');db['DeskConfiguration']=db[_0x8509('0x4')]['import'](_0x8509('0xa7'));db[_0x8509('0xa8')]=db[_0x8509('0x4')]['import'](_0x8509('0xa9'));db[_0x8509('0xaa')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xab'));db[_0x8509('0xac')]=db[_0x8509('0x4')]['import'](_0x8509('0xad'));db[_0x8509('0xae')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xaf'));db[_0x8509('0xb0')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb1'));db['ZendeskConfiguration']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb2'));db['ZendeskField']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb3'));db[_0x8509('0xb4')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xb5'));db[_0x8509('0xb6')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xb7'));db[_0x8509('0xb8')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xb9'));db['VtigerConfiguration']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xba'));db[_0x8509('0xbb')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xbc'));db['ServicenowConfiguration']=db['sequelize'][_0x8509('0x13')](_0x8509('0xbd'));db[_0x8509('0xbe')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xbf'));db[_0x8509('0xc0')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xc1'));db[_0x8509('0xc2')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xc3'));db[_0x8509('0xc4')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xc5'));db[_0x8509('0xc6')]=db[_0x8509('0x4')]['import'](_0x8509('0xc7'));db[_0x8509('0xc8')]=db[_0x8509('0x4')]['import'](_0x8509('0xc9'));db[_0x8509('0xca')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xcb'));db[_0x8509('0xcc')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x91'));db[_0x8509('0xcd')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xce'));db['ChatQueueReport']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xcf'));db[_0x8509('0xd0')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x8509('0xd1')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xd2'));db[_0x8509('0xd3')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xd4'));db['JscriptySessionReport']=db[_0x8509('0x4')][_0x8509('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0x8509('0xd5')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xd6'));db[_0x8509('0xd7')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xd8'));db[_0x8509('0xd9')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xda'));db['JscriptyProject']=db['sequelize'][_0x8509('0x13')](_0x8509('0xdb'));db[_0x8509('0xdc')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xdd'));db['SquareOdbc']=db['sequelize'][_0x8509('0x13')]('../api/squareOdbc/squareOdbc.model');db[_0x8509('0xde')]=db[_0x8509('0x4')]['import'](_0x8509('0xdf'));db[_0x8509('0xe0')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xe1'));db[_0x8509('0xe2')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe3'));db[_0x8509('0xe4')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe5'));db['License']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe6'));db['Campaign']=db['sequelize'][_0x8509('0x13')](_0x8509('0xe7'));db[_0x8509('0xe8')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xe9'));db[_0x8509('0xea')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xeb'));db[_0x8509('0xec')]=db[_0x8509('0x4')]['import'](_0x8509('0xed'));db['MailTransferReport']=db['sequelize']['import'](_0x8509('0xee'));db[_0x8509('0xef')]=db[_0x8509('0x4')]['import'](_0x8509('0xf0'));db[_0x8509('0xf1')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xf2'));db[_0x8509('0xf3')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xf4'));db[_0x8509('0xf5')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xf6'));db[_0x8509('0xf7')]=db['sequelize'][_0x8509('0x13')](_0x8509('0xf8'));db[_0x8509('0xf9')]=db[_0x8509('0x4')]['import']('../api/voicePrefix/voicePrefix.model');db[_0x8509('0xfa')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/userProfile/userProfile.model');db[_0x8509('0xfb')]=db[_0x8509('0x4')]['import']('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db['sequelize']['import']('../api/userProfileResource/userProfileResource.model');db[_0x8509('0xfc')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xfd'));db['WhatsappAccount']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0xfe'));db[_0x8509('0xff')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db['sequelize']['import'](_0x8509('0x100'));db[_0x8509('0x101')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/whatsappMessage/whatsappMessage.model');db[_0x8509('0x102')]=db['sequelize'][_0x8509('0x13')](_0x8509('0x103'));db[_0x8509('0x104')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x105'));db[_0x8509('0x106')]=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x107'));db['CloudProvider']=db['sequelize'][_0x8509('0x13')](_0x8509('0x108'));db['TeamVoiceQueue']=db[_0x8509('0x4')][_0x8509('0x13')](_0x8509('0x109'));db[_0x8509('0x10a')]=db[_0x8509('0x4')]['import'](_0x8509('0x10b'));db[_0x8509('0x10c')]=db[_0x8509('0x4')][_0x8509('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db[_0x8509('0x10d')]=db['sequelize']['import'](_0x8509('0x10e'));db[_0x8509('0x10f')]=db[_0x8509('0x4')]['import'](_0x8509('0x110'));db['User'][_0x8509('0x111')](db['VoiceMail'],{'as':_0x8509('0x112'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x111')](db[_0x8509('0x10d')],{'as':_0x8509('0x115'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x1c')],{'as':_0x8509('0x117'),'foreignKey':'UserId'});db[_0x8509('0x12')][_0x8509('0x116')](db['UserVoiceQueueRt'],{'as':_0x8509('0x118'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x17')],{'as':_0x8509('0x119'),'onDelete':_0x8509('0x113'),'hooks':!![]});db['User']['hasMany'](db[_0x8509('0x75')],{'as':_0x8509('0x11a'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db['CmHopperHistory'],{'as':_0x8509('0x11b'),'foreignKey':'UserId'});db[_0x8509('0x12')][_0x8509('0x116')](db['ReportAgentPreview'],{'as':_0x8509('0x78'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x5d')],{'as':'OpenchannelInteractions','foreignKey':_0x8509('0x114')});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x11c')],{'as':'ChatInteractions','foreignKey':_0x8509('0x114')});db[_0x8509('0x12')]['hasMany'](db[_0x8509('0x54')],{'as':_0x8509('0x11d'),'foreignKey':'UserId'});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x4d')],{'as':_0x8509('0x11e'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x12')]['hasMany'](db[_0x8509('0x41')],{'as':_0x8509('0x11f'),'foreignKey':_0x8509('0x114')});db['User'][_0x8509('0x116')](db[_0x8509('0x120')],{'as':_0x8509('0x121'),'foreignKey':_0x8509('0x114')});db['User']['hasMany'](db[_0x8509('0xfc')],{'as':_0x8509('0x122'),'foreignKey':'SenderId'});db[_0x8509('0x12')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':_0x8509('0x123'),'foreignKey':_0x8509('0x114'),'onDelete':_0x8509('0x124')});db[_0x8509('0x12')][_0x8509('0x125')](db[_0x8509('0xfa')],{'as':'UserProfile','foreignKey':_0x8509('0x126')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x6c')],{'as':_0x8509('0x128'),'through':_0x8509('0x129')});db['User'][_0x8509('0x127')](db[_0x8509('0x12a')],{'as':'Contacts','through':'cm_user_has_contacts'});db[_0x8509('0x12')][_0x8509('0x127')](db['CmList'],{'as':_0x8509('0x12b'),'through':_0x8509('0x12c')});db['User'][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x12d')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x41')],{'as':_0x8509('0x11f'),'through':_0x8509('0x12e')});db[_0x8509('0x12')]['belongsToMany'](db['ChatInteraction'],{'as':_0x8509('0x12f'),'through':_0x8509('0x130')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x4d')],{'as':_0x8509('0x11e'),'through':_0x8509('0x131')});db[_0x8509('0x12')]['belongsToMany'](db[_0x8509('0x54')],{'as':'SmsInteractions','through':_0x8509('0x132')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x5d')],{'as':_0x8509('0x133'),'through':_0x8509('0x134')});db['User'][_0x8509('0x127')](db[_0x8509('0x120')],{'as':_0x8509('0x121'),'through':_0x8509('0x135')});db['User'][_0x8509('0x127')](db['VoiceQueue'],{'as':_0x8509('0x136'),'through':'UserVoiceQueue','required':![]});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0xf9')],{'as':_0x8509('0x137'),'through':_0x8509('0x10c'),'required':![]});db[_0x8509('0x12')]['belongsToMany'](db[_0x8509('0x3e')],{'as':_0x8509('0x138'),'through':_0x8509('0x2f'),'required':![]});db['User']['belongsToMany'](db[_0x8509('0x6a')],{'as':_0x8509('0x139'),'through':_0x8509('0x2d'),'required':![],'hooks':!![]});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x4f')],{'as':_0x8509('0x13a'),'through':'UserFaxQueue','required':![]});db['User'][_0x8509('0x127')](db[_0x8509('0x57')],{'as':_0x8509('0x13b'),'through':_0x8509('0x13c'),'required':![]});db['User']['belongsToMany'](db[_0x8509('0x61')],{'as':_0x8509('0x13d'),'through':'UserOpenchannelQueue','required':![]});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x106')],{'as':'WhatsappQueues','through':_0x8509('0x36'),'required':![]});db[_0x8509('0x12')]['belongsToMany'](db['CmList'],{'through':_0x8509('0x12c')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x62')],{'as':'ChatWebsites','through':'user_has_chat_websites'});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x4a')],{'as':_0x8509('0x13e'),'through':_0x8509('0x13f')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x3c')],{'as':_0x8509('0x140'),'through':'user_has_mail_accounts'});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x59')],{'as':_0x8509('0x141'),'through':'user_has_openchannel_accounts'});db[_0x8509('0x12')][_0x8509('0x127')](db['SmsAccount'],{'as':_0x8509('0x142'),'through':_0x8509('0x143')});db[_0x8509('0x12')][_0x8509('0x127')](db[_0x8509('0x144')],{'as':_0x8509('0x145'),'through':'user_has_whatsapp_accounts'});db[_0x8509('0x146')]['hasMany'](db[_0x8509('0x17')],{'as':_0x8509('0x147'),'onDelete':_0x8509('0x113'),'foreignKey':'ChanSpyId'});db['VoiceContext'][_0x8509('0x116')](db[_0x8509('0x17')],{'onDelete':'cascade'});db['VoiceExtension']['hasMany'](db['VoiceExtension'],{'as':_0x8509('0x148'),'onDelete':_0x8509('0x113')});db[_0x8509('0x149')][_0x8509('0x127')](db['Sound'],{'as':'Sounds','through':_0x8509('0x14a')});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x2a')],{'as':_0x8509('0x14b'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':_0x8509('0x123'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')][_0x8509('0x116')](db['CmHopperFinal'],{'as':_0x8509('0x11a'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')][_0x8509('0x116')](db['CmHopperHistory'],{'as':_0x8509('0x14c'),'foreignKey':_0x8509('0x14d')});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x78')],{'as':_0x8509('0x78'),'foreignKey':'VoiceQueueId'});db[_0x8509('0x1a')]['hasMany'](db[_0x8509('0x73')],{'as':_0x8509('0x14e'),'foreignKey':_0x8509('0x14d')});db[_0x8509('0x1a')][_0x8509('0x116')](db[_0x8509('0x14f')],{'as':_0x8509('0x150'),'foreignKey':_0x8509('0x14d')});db[_0x8509('0x1a')]['belongsTo'](db[_0x8509('0x29')],{'as':_0x8509('0x29'),'foreignKey':_0x8509('0x151')});db['VoiceQueue'][_0x8509('0x125')](db[_0x8509('0x29')],{'as':_0x8509('0x152'),'foreignKey':'TrunkBackupId'});db['VoiceQueue'][_0x8509('0x125')](db[_0x8509('0x80')],{'as':_0x8509('0x80'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x1a')]['belongsTo'](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':'Lists','through':_0x8509('0x156')});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x2c')});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0xe4')],{'as':_0x8509('0x158'),'through':'TeamVoiceQueue'});db[_0x8509('0x1a')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':_0x8509('0x159'),'through':'voice_queues_has_cm_blacklists'});db[_0x8509('0x1c')][_0x8509('0x125')](db[_0x8509('0x12')],{'as':'User','foreignKey':_0x8509('0x114')});db[_0x8509('0x15a')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x12'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x112')][_0x8509('0x116')](db['VoiceMailMessage'],{'as':_0x8509('0x15b'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x15c'),'sourceKey':_0x8509('0x15d')});db[_0x8509('0x15e')][_0x8509('0x125')](db[_0x8509('0x112')],{'foreignKey':_0x8509('0x15c'),'targetKey':_0x8509('0x15d')});db['VoiceCallReport'][_0x8509('0x116')](db[_0x8509('0x25')],{'as':_0x8509('0x15f'),'foreignKey':_0x8509('0x160'),'constraints':![]});db[_0x8509('0x20')]['hasMany'](db[_0x8509('0x161')],{'as':_0x8509('0x162'),'foreignKey':_0x8509('0x160'),'constraints':![]});db[_0x8509('0x20')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x12'),'foreignKey':'UserId'});db[_0x8509('0x20')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x38')][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':'MailAccount','foreignKey':_0x8509('0x165')});db[_0x8509('0x38')]['belongsTo'](db[_0x8509('0x166')],{'as':_0x8509('0x166'),'foreignKey':_0x8509('0x167'),'onDelete':_0x8509('0x168')});db[_0x8509('0x3a')]['belongsTo'](db[_0x8509('0x3c')],{'as':_0x8509('0x3c'),'foreignKey':_0x8509('0x165')});db[_0x8509('0x3a')][_0x8509('0x125')](db[_0x8509('0x166')],{'as':'CloudProvider','foreignKey':_0x8509('0x167'),'onDelete':_0x8509('0x168')});db['MailAccount'][_0x8509('0x111')](db[_0x8509('0x38')],{'as':_0x8509('0x169'),'onDelete':_0x8509('0x113')});db['MailAccount'][_0x8509('0x111')](db[_0x8509('0x3a')],{'as':_0x8509('0x16a'),'onDelete':_0x8509('0x113')});db[_0x8509('0x3c')][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':'MailAccountId','onDelete':_0x8509('0x113')});db[_0x8509('0x3c')][_0x8509('0x116')](db['CannedAnswer'],{'as':_0x8509('0x16c'),'foreignKey':'MailAccountId'});db[_0x8509('0x3c')][_0x8509('0x116')](db[_0x8509('0x16d')],{'as':'Messages','foreignKey':_0x8509('0x165')});db[_0x8509('0x3c')]['hasMany'](db['MailInteraction'],{'as':_0x8509('0x16e')});db[_0x8509('0x3c')][_0x8509('0x116')](db[_0x8509('0x44')],{'as':_0x8509('0x148'),'foreignKey':'MailAccountId','onDelete':'cascade'});db[_0x8509('0x3c')][_0x8509('0x125')](db['CmList'],{'as':'List','foreignKey':_0x8509('0x16f')});db['MailAccount'][_0x8509('0x125')](db['Template'],{'as':_0x8509('0x8e'),'foreignKey':'TemplateId'});db['MailAccount']['belongsTo'](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x3c')]['belongsToMany'](db['User'],{'as':_0x8509('0x157'),'through':_0x8509('0x170')});db[_0x8509('0x3e')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':'UserMailQueue'});db[_0x8509('0x3e')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x171'),'as':_0x8509('0x158')});db['MailInteraction']['hasMany'](db[_0x8509('0x16d')],{'as':_0x8509('0x15b'),'onDelete':_0x8509('0x113'),'foreignKey':'MailInteractionId'});db[_0x8509('0x41')][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x165')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db['MailInteraction'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':'UserId'});db[_0x8509('0x41')]['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x175'),'as':_0x8509('0x176')});db[_0x8509('0x41')]['belongsToMany'](db['Tag'],{'through':_0x8509('0x175'),'as':_0x8509('0x177')});db[_0x8509('0x41')][_0x8509('0x127')](db['User'],{'as':'Users','through':'user_has_mail_interactions','foreignKey':_0x8509('0x178')});db['MailMessage'][_0x8509('0x116')](db['Attachment'],{'as':_0x8509('0x179'),'onDelete':_0x8509('0x113')});db['MailMessage'][_0x8509('0x125')](db['User'],{'as':'User'});db[_0x8509('0x16d')]['belongsTo'](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163')});db[_0x8509('0x16d')]['belongsTo'](db[_0x8509('0x41')],{'as':_0x8509('0x17a'),'foreignKey':_0x8509('0x178')});db[_0x8509('0x16d')][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':'Account','foreignKey':_0x8509('0x165')});db[_0x8509('0x16d')]['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x62'),'foreignKey':_0x8509('0x17b')});db[_0x8509('0x16d')][_0x8509('0x125')](db['ChatOfflineMessage'],{'as':_0x8509('0x17c'),'foreignKey':_0x8509('0x17d')});db[_0x8509('0x44')]['belongsTo'](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x44')][_0x8509('0x125')](db[_0x8509('0x3e')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x44')][_0x8509('0x125')](db[_0x8509('0x3c')],{'onDelete':_0x8509('0x168')});db['MailApplication'][_0x8509('0x125')](db[_0x8509('0x80')],{'onDelete':'restrict','foreignKey':_0x8509('0x153')});db['MailApplication'][_0x8509('0x125')](db[_0x8509('0x174')],{'onDelete':'restrict','foreignKey':_0x8509('0x17e')});db[_0x8509('0x17f')][_0x8509('0x125')](db[_0x8509('0x3c')],{});db[_0x8509('0x17f')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f')});db['MailQueueReport'][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':'ContactId'});db['MailQueueReport'][_0x8509('0x125')](db['MailInteraction'],{});db[_0x8509('0x17f')][_0x8509('0x125')](db['MailMessage'],{});db[_0x8509('0x17f')][_0x8509('0x125')](db['User'],{});db[_0x8509('0x17f')]['belongsTo'](db[_0x8509('0x3e')],{});db[_0x8509('0x181')][_0x8509('0x116')](db[_0x8509('0x48')],{'as':_0x8509('0x182'),'onDelete':_0x8509('0x113')});db['FaxAccount'][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x183'),'onDelete':'cascade'});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':_0x8509('0x183')});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x4d')],{'as':_0x8509('0x16e')});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x4b')],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x183'),'onDelete':_0x8509('0x113')});db['FaxAccount'][_0x8509('0x116')](db['VoiceExtension'],{'as':_0x8509('0x185'),'onDelete':_0x8509('0x113')});db[_0x8509('0x4a')][_0x8509('0x116')](db[_0x8509('0x186')],{'as':_0x8509('0x15b')});db[_0x8509('0x4a')][_0x8509('0x125')](db['Trunk'],{'as':_0x8509('0x29')});db[_0x8509('0x4a')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':'List','foreignKey':'ListId'});db[_0x8509('0x4a')][_0x8509('0x125')](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x8509('0x4a')][_0x8509('0x127')](db['User'],{'as':'Agents','through':_0x8509('0x13f')});db[_0x8509('0x4b')][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db['FaxApplication'][_0x8509('0x125')](db[_0x8509('0x4f')],{'onDelete':_0x8509('0x168')});db['FaxApplication'][_0x8509('0x125')](db['FaxAccount'],{'onDelete':_0x8509('0x168')});db[_0x8509('0x4b')][_0x8509('0x125')](db['Tag'],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x17e')});db[_0x8509('0x4d')]['hasMany'](db[_0x8509('0x186')],{'as':_0x8509('0x15b'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x187')});db['FaxInteraction'][_0x8509('0x125')](db[_0x8509('0x4a')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x183')});db[_0x8509('0x4d')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':_0x8509('0x164')});db[_0x8509('0x4d')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x4d')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':'fax_interaction_has_tags','as':_0x8509('0x176')});db[_0x8509('0x4d')]['belongsToMany'](db[_0x8509('0x174')],{'through':'fax_interaction_has_tags','as':_0x8509('0x177')});db[_0x8509('0x4d')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':'user_has_fax_interactions','foreignKey':_0x8509('0x187')});db['FaxMessage'][_0x8509('0x125')](db['User'],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x12')});db[_0x8509('0x186')][_0x8509('0x125')](db[_0x8509('0x4d')],{'as':_0x8509('0x17a'),'foreignKey':_0x8509('0x187')});db[_0x8509('0x186')][_0x8509('0x125')](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163')});db[_0x8509('0x186')][_0x8509('0x125')](db[_0x8509('0xea')],{'as':_0x8509('0xea'),'foreignKey':_0x8509('0x189')});db['FaxMessage'][_0x8509('0x125')](db[_0x8509('0x4a')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x183')});db['FaxQueue'][_0x8509('0x127')](db[_0x8509('0x12')],{'as':'Agents','through':_0x8509('0x31')});db[_0x8509('0x4f')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x18a'),'as':_0x8509('0x158')});db[_0x8509('0x51')][_0x8509('0x125')](db['FaxAccount'],{});db['FaxQueueReport']['belongsTo'](db['CmList'],{'as':_0x8509('0x180'),'foreignKey':'ListId'});db[_0x8509('0x51')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':'ContactId'});db[_0x8509('0x51')]['belongsTo'](db[_0x8509('0x4d')],{});db[_0x8509('0x51')][_0x8509('0x125')](db[_0x8509('0x186')],{});db[_0x8509('0x51')][_0x8509('0x125')](db[_0x8509('0x12')],{});db[_0x8509('0x51')][_0x8509('0x125')](db['FaxQueue'],{});db[_0x8509('0x18b')]['hasMany'](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x18c'),'onDelete':_0x8509('0x113')});db[_0x8509('0x18b')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':_0x8509('0x18c')});db[_0x8509('0x18b')]['hasMany'](db['SmsMessage'],{'as':_0x8509('0x15b'),'foreignKey':_0x8509('0x18c')});db['SmsAccount'][_0x8509('0x116')](db[_0x8509('0x54')],{'as':'Interactions'});db['SmsAccount'][_0x8509('0x116')](db['SmsApplication'],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x18c'),'onDelete':_0x8509('0x113')});db['SmsAccount']['belongsTo'](db[_0x8509('0xf7')],{'as':'List','foreignKey':_0x8509('0x16f')});db[_0x8509('0x18b')][_0x8509('0x125')](db[_0x8509('0x18d')],{'as':'mandatoryDispositionPause','foreignKey':_0x8509('0x155')});db['SmsAccount'][_0x8509('0x127')](db[_0x8509('0x12')],{'as':'Agents','through':_0x8509('0x143')});db[_0x8509('0x53')]['belongsTo'](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x53')][_0x8509('0x125')](db['SmsQueue'],{'onDelete':_0x8509('0x168')});db[_0x8509('0x53')][_0x8509('0x125')](db['SmsAccount'],{'onDelete':_0x8509('0x168')});db[_0x8509('0x53')][_0x8509('0x125')](db[_0x8509('0x80')],{'onDelete':_0x8509('0x168'),'foreignKey':'IntervalId'});db['SmsApplication'][_0x8509('0x125')](db[_0x8509('0x174')],{'onDelete':_0x8509('0x168'),'foreignKey':'TagId'});db[_0x8509('0x54')][_0x8509('0x116')](db[_0x8509('0x56')],{'as':_0x8509('0x15b'),'onDelete':'cascade','foreignKey':_0x8509('0x18e')});db[_0x8509('0x54')][_0x8509('0x125')](db[_0x8509('0x18b')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x18c')});db['SmsInteraction'][_0x8509('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x8509('0x164')});db[_0x8509('0x54')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x8509('0x114')});db[_0x8509('0x54')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x18f'),'as':_0x8509('0x176')});db[_0x8509('0x54')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':'sms_interaction_has_tags','as':_0x8509('0x177')});db[_0x8509('0x54')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x132'),'foreignKey':_0x8509('0x18e')});db[_0x8509('0x56')][_0x8509('0x125')](db['User'],{'as':_0x8509('0x12')});db['SmsMessage'][_0x8509('0x125')](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163')});db['SmsMessage'][_0x8509('0x125')](db[_0x8509('0x54')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x17a'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0x8509('0x125')](db[_0x8509('0x18b')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x18c')});db[_0x8509('0x57')][_0x8509('0x127')](db['User'],{'as':'Agents','through':'UserSmsQueue','foreignKey':_0x8509('0x190')});db['SmsQueue'][_0x8509('0x127')](db['Team'],{'through':'team_has_sms_queues','as':_0x8509('0x158')});db['OpenchannelAccount'][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':'OpenchannelAccountId','onDelete':_0x8509('0x113')});db[_0x8509('0x59')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':'OpenchannelAccountId'});db[_0x8509('0x59')][_0x8509('0x116')](db[_0x8509('0x5d')],{'as':_0x8509('0x16e'),'foreignKey':_0x8509('0x191')});db['OpenchannelAccount'][_0x8509('0x116')](db[_0x8509('0x5f')],{'as':'Messages','foreignKey':'OpenchannelAccountId'});db[_0x8509('0x59')][_0x8509('0x116')](db['OpenchannelApplication'],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x191'),'onDelete':_0x8509('0x113')});db[_0x8509('0x59')][_0x8509('0x125')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x8509('0x59')][_0x8509('0x125')](db[_0x8509('0x18d')],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x59')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x192')});db['OpenchannelApplication'][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0x5b')][_0x8509('0x125')](db[_0x8509('0x61')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x193')});db['OpenchannelApplication'][_0x8509('0x125')](db['OpenchannelAccount'],{'onDelete':_0x8509('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x8509('0x5b')][_0x8509('0x125')](db[_0x8509('0x80')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x5b')][_0x8509('0x125')](db[_0x8509('0x174')],{'onDelete':'restrict','foreignKey':_0x8509('0x17e')});db[_0x8509('0x5d')][_0x8509('0x116')](db['OpenchannelMessage'],{'as':'Messages','onDelete':_0x8509('0x113'),'foreignKey':'OpenchannelInteractionId'});db[_0x8509('0x5d')][_0x8509('0x125')](db[_0x8509('0x59')],{'as':_0x8509('0x172'),'foreignKey':'OpenchannelAccountId'});db[_0x8509('0x5d')]['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db['OpenchannelInteraction'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x5d')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x194'),'as':_0x8509('0x176')});db['OpenchannelInteraction']['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x194'),'as':'ThroughTags'});db[_0x8509('0x5d')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x134'),'foreignKey':'OpenchannelInteractionId'});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':'cascade','as':_0x8509('0x12')});db[_0x8509('0x5f')][_0x8509('0x125')](db['CmContact'],{'onDelete':'cascade','as':_0x8509('0x163')});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0x5d')],{'onDelete':_0x8509('0x113'),'as':'Interaction','foreignKey':_0x8509('0x195')});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0xea')],{'as':_0x8509('0xea'),'foreignKey':_0x8509('0x189')});db[_0x8509('0x5f')][_0x8509('0x125')](db[_0x8509('0x59')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x191')});db[_0x8509('0x61')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x34'),'foreignKey':_0x8509('0x193')});db['OpenchannelQueue']['belongsToMany'](db[_0x8509('0xe4')],{'through':_0x8509('0x196'),'as':_0x8509('0x158')});db['ChatWebsite'][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x17b'),'onDelete':_0x8509('0x113')});db[_0x8509('0x62')][_0x8509('0x116')](db[_0x8509('0x184')],{'as':_0x8509('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0x8509('0x62')]['hasMany'](db[_0x8509('0x197')],{'as':_0x8509('0x198')});db[_0x8509('0x62')]['hasMany'](db[_0x8509('0x11c')],{'as':_0x8509('0x16e')});db[_0x8509('0x62')][_0x8509('0x116')](db[_0x8509('0x66')],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x17b'),'onDelete':'cascade'});db[_0x8509('0x62')][_0x8509('0x116')](db['ChatMessage'],{'as':_0x8509('0x15b')});db[_0x8509('0x62')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':'List','foreignKey':'ListId'});db['ChatWebsite'][_0x8509('0x125')](db[_0x8509('0x80')],{'as':_0x8509('0x80'),'foreignKey':'IntervalId'});db['ChatWebsite'][_0x8509('0x125')](db[_0x8509('0x3c')],{'as':_0x8509('0x3c'),'foreignKey':_0x8509('0x165')});db[_0x8509('0x62')]['belongsTo'](db[_0x8509('0x18d')],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x62')][_0x8509('0x127')](db['User'],{'as':_0x8509('0x157'),'through':_0x8509('0x199')});db[_0x8509('0x64')][_0x8509('0x125')](db['OpenchannelAccount'],{});db['OpenchannelQueueReport']['belongsTo'](db[_0x8509('0xf7')],{'as':'List','foreignKey':_0x8509('0x16f')});db[_0x8509('0x64')][_0x8509('0x125')](db['CmContact'],{'as':'Contact','foreignKey':_0x8509('0x164')});db[_0x8509('0x64')][_0x8509('0x125')](db[_0x8509('0x5d')],{});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0x8509('0x64')]['belongsTo'](db[_0x8509('0x12')],{});db[_0x8509('0x64')][_0x8509('0x125')](db[_0x8509('0x61')],{});db[_0x8509('0x66')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x19a'),'foreignKey':_0x8509('0x114'),'onDelete':'restrict'});db[_0x8509('0x66')][_0x8509('0x125')](db[_0x8509('0x6a')],{'as':_0x8509('0x19b'),'foreignKey':_0x8509('0x19c'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x19d'),'foreignKey':_0x8509('0x17b'),'onDelete':_0x8509('0x168')});db[_0x8509('0x66')]['belongsTo'](db[_0x8509('0x174')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x17e')});db[_0x8509('0x11c')][_0x8509('0x116')](db[_0x8509('0x19e')],{'as':_0x8509('0x15b'),'onDelete':'cascade','foreignKey':_0x8509('0x19f')});db[_0x8509('0x11c')][_0x8509('0x125')](db[_0x8509('0x62')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x17b')});db[_0x8509('0x11c')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x11c')][_0x8509('0x125')](db['User'],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db[_0x8509('0x11c')][_0x8509('0x127')](db['Tag'],{'through':_0x8509('0x1a0'),'as':_0x8509('0x176')});db[_0x8509('0x11c')][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x1a0'),'as':_0x8509('0x177')});db['ChatInteraction'][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x130'),'foreignKey':_0x8509('0x19f')});db[_0x8509('0x19e')][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x12')});db[_0x8509('0x19e')]['belongsTo'](db[_0x8509('0x12a')],{'onDelete':_0x8509('0x113'),'as':_0x8509('0x163'),'foreignKey':'ContactId'});db[_0x8509('0x19e')][_0x8509('0x125')](db[_0x8509('0x11c')],{'onDelete':_0x8509('0x113'),'as':'Interaction','foreignKey':'ChatInteractionId'});db['ChatMessage'][_0x8509('0x125')](db[_0x8509('0xea')],{'as':_0x8509('0xea'),'foreignKey':_0x8509('0x189')});db[_0x8509('0x19e')]['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x172'),'foreignKey':'ChatWebsiteId'});db[_0x8509('0x17c')][_0x8509('0x116')](db[_0x8509('0xea')],{'as':'Attachments','foreignKey':_0x8509('0x17d'),'onDelete':_0x8509('0x113'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x8509('0x113'),'as':'Contact','foreignKey':_0x8509('0x164')});db['ChatOfflineMessage'][_0x8509('0x125')](db[_0x8509('0x62')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x8509('0x6a')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x2d'),'hooks':!![]});db['ChatQueue'][_0x8509('0x127')](db['Team'],{'through':'team_has_chat_queues','as':_0x8509('0x158')});db[_0x8509('0x6c')][_0x8509('0x116')](db[_0x8509('0xd0')],{'as':'Messages','foreignKey':_0x8509('0x1a1'),'onDelete':'cascade'});db[_0x8509('0x6c')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x14b'),'through':'chat_group_has_users'});db[_0x8509('0x197')]['belongsTo'](db[_0x8509('0x62')],{'as':_0x8509('0x19d'),'foreignKey':_0x8509('0x17b')});db[_0x8509('0x6e')]['hasMany'](db['CmContact'],{'as':_0x8509('0x1a2'),'foreignKey':_0x8509('0x1a3')});db[_0x8509('0x12a')]['hasMany'](db[_0x8509('0x8b')],{'as':_0x8509('0x1a4'),'foreignKey':_0x8509('0x1a5')});db[_0x8509('0x12a')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':_0x8509('0x123'),'foreignKey':'ContactId'});db['CmContact'][_0x8509('0x116')](db[_0x8509('0x75')],{'as':_0x8509('0x11a'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x12a')][_0x8509('0x116')](db[_0x8509('0x76')],{'as':'HopperHistories','foreignKey':_0x8509('0x164')});db[_0x8509('0x12a')][_0x8509('0x116')](db[_0x8509('0x78')],{'as':_0x8509('0x78'),'foreignKey':_0x8509('0x164')});db['CmContact'][_0x8509('0x116')](db[_0x8509('0x14f')],{'as':'JscriptySessions','foreignKey':_0x8509('0x164')});db[_0x8509('0x12a')][_0x8509('0x116')](db['OpenchannelInteraction'],{'as':_0x8509('0x133'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x8509('0x12a')][_0x8509('0x116')](db['ChatInteraction'],{'as':_0x8509('0x12f'),'foreignKey':'ContactId','onDelete':_0x8509('0x168')});db[_0x8509('0x12a')]['hasMany'](db[_0x8509('0x54')],{'as':_0x8509('0x11d'),'foreignKey':_0x8509('0x164'),'onDelete':'restrict'});db[_0x8509('0x12a')]['hasMany'](db[_0x8509('0x4d')],{'as':_0x8509('0x11e'),'foreignKey':_0x8509('0x164'),'onDelete':_0x8509('0x168')});db['CmContact'][_0x8509('0x116')](db[_0x8509('0x41')],{'as':_0x8509('0x11f'),'foreignKey':_0x8509('0x164'),'onDelete':_0x8509('0x168')});db[_0x8509('0x12a')][_0x8509('0x125')](db[_0x8509('0x6e')],{'as':_0x8509('0x1a6'),'foreignKey':_0x8509('0x1a3')});db[_0x8509('0x12a')][_0x8509('0x125')](db['CmList'],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f'),'onDelete':'cascade'});db[_0x8509('0x12a')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'through':_0x8509('0x1a7')});db[_0x8509('0x12a')][_0x8509('0x127')](db[_0x8509('0x174')],{'as':_0x8509('0x176'),'through':_0x8509('0x1a8')});db[_0x8509('0x12a')]['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x1a8'),'as':'ThroughTags'});db[_0x8509('0x71')][_0x8509('0x116')](db[_0x8509('0x1a9')],{'as':_0x8509('0x1aa'),'foreignKey':_0x8509('0x1ab')});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164'),'onDelete':_0x8509('0x113')});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f'),'onDelete':'cascade'});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0x12')],{'as':'Agent','foreignKey':'UserId'});db[_0x8509('0x71')][_0x8509('0x125')](db[_0x8509('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0x8509('0x113')});db[_0x8509('0x71')][_0x8509('0x125')](db['Campaign'],{'as':'Campaign','foreignKey':_0x8509('0x1ac'),'onDelete':'cascade'});db[_0x8509('0x71')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x1ad')});db[_0x8509('0x73')]['belongsTo'](db[_0x8509('0x12a')],{'as':'Contact','foreignKey':_0x8509('0x164'),'onDelete':'cascade'});db['CmHopperBlack']['belongsTo'](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f'),'onDelete':_0x8509('0x113')});db[_0x8509('0x73')][_0x8509('0x125')](db['VoiceQueue'],{'as':_0x8509('0x19b'),'foreignKey':_0x8509('0x14d'),'onDelete':_0x8509('0x113')});db[_0x8509('0x73')][_0x8509('0x125')](db[_0x8509('0x1ae')],{'as':_0x8509('0x1ae'),'foreignKey':_0x8509('0x1ac'),'onDelete':_0x8509('0x113')});db[_0x8509('0x7c')]['hasMany'](db[_0x8509('0x7f')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0x8509('0x1af'),'onDelete':_0x8509('0x113'),'hooks':!![]});db['Automation'][_0x8509('0x116')](db['Condition'],{'as':{'plural':_0x8509('0x1b0'),'singular':'OneAny'},'foreignKey':_0x8509('0x1b1'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x7c')]['hasMany'](db[_0x8509('0x1b2')],{'as':_0x8509('0x1b3'),'foreignKey':_0x8509('0x1b4'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x7e')][_0x8509('0x116')](db['Disposition'],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x1b5'),'onDelete':_0x8509('0x113')});db[_0x8509('0x80')]['hasMany'](db[_0x8509('0x80')],{'as':_0x8509('0x1b6'),'foreignKey':_0x8509('0x153'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x8509('0x80')][_0x8509('0x116')](db[_0x8509('0x17')],{'as':_0x8509('0x119'),'foreignKey':_0x8509('0x153'),'onDelete':_0x8509('0x168')});db[_0x8509('0x80')][_0x8509('0x116')](db[_0x8509('0x44')],{'as':_0x8509('0x1b7'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x80')][_0x8509('0x116')](db[_0x8509('0x66')],{'as':'ChatApplications','foreignKey':_0x8509('0x153')});db['Interval']['hasMany'](db[_0x8509('0x4b')],{'as':_0x8509('0x1b8'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x80')]['hasMany'](db[_0x8509('0x53')],{'as':_0x8509('0x1b9'),'foreignKey':_0x8509('0x153')});db[_0x8509('0x1ba')][_0x8509('0x125')](db[_0x8509('0x3c')],{});db[_0x8509('0x1ba')][_0x8509('0x125')](db['AnalyticDefaultReport'],{'foreignKey':_0x8509('0x1bb')});db[_0x8509('0x1ba')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x8509('0x1bc')});db['Sound']['belongsToMany'](db[_0x8509('0x149')],{'as':_0x8509('0x1bd'),'through':_0x8509('0x14a'),'onDelete':'restrict'});db[_0x8509('0x174')]['belongsToMany'](db[_0x8509('0x12a')],{'through':'cm_contact_has_tags'});db[_0x8509('0x174')][_0x8509('0x127')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag']['belongsToMany'](db[_0x8509('0x41')],{'through':_0x8509('0x175')});db['Tag'][_0x8509('0x127')](db['SmsInteraction'],{'through':_0x8509('0x18f')});db['Tag'][_0x8509('0x127')](db[_0x8509('0x4d')],{'through':'fax_interaction_has_tags'});db[_0x8509('0x174')][_0x8509('0x127')](db[_0x8509('0x5d')],{'through':'openchannel_interaction_has_tags'});db[_0x8509('0x174')]['belongsToMany'](db[_0x8509('0x120')],{'through':_0x8509('0x1be')});db['CmContactHasItem'][_0x8509('0x125')](db[_0x8509('0x89')],{'as':_0x8509('0x1bf'),'foreignKey':_0x8509('0x1c0')});db[_0x8509('0x1a9')][_0x8509('0x125')](db['CmHopper'],{'as':'Hopper','foreignKey':_0x8509('0x1ab')});db[_0x8509('0x8b')][_0x8509('0x125')](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':'CmContactId'});db[_0x8509('0x1c1')][_0x8509('0x116')](db[_0x8509('0x7f')],{'as':{'plural':_0x8509('0x1c2'),'singular':_0x8509('0x1c3')},'foreignKey':_0x8509('0x1c4'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x1c1')][_0x8509('0x116')](db['Condition'],{'as':{'plural':_0x8509('0x1c5'),'singular':_0x8509('0x1c6')},'foreignKey':'TriggerAnyId','onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x1c1')][_0x8509('0x116')](db[_0x8509('0x1b2')],{'as':_0x8509('0x1b3'),'foreignKey':_0x8509('0x1c7'),'onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x1c8')][_0x8509('0x116')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1bc'),'hooks':!![]});db[_0x8509('0x95')][_0x8509('0x116')](db[_0x8509('0x9b')],{'as':'Fields','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1bb')});db['AnalyticMetric']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x8509('0x1c9')});db['AnalyticFieldReport']['belongsTo'](db[_0x8509('0x99')],{'foreignKey':_0x8509('0x1c9')});db[_0x8509('0x9e')][_0x8509('0x116')](db[_0x8509('0xa0')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1cb')});db[_0x8509('0xa0')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1cd'),'onDelete':'cascade','foreignKey':_0x8509('0x1ce')});db[_0x8509('0xa0')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1cf'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa0')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xa0')]['belongsTo'](db[_0x8509('0x9e')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0x1cc')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0x1cc')][_0x8509('0x116')](db['SalesforceField'],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1cc')][_0x8509('0x116')](db[_0x8509('0x1cc')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db['SalesforceField']['belongsTo'](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0x1d7')][_0x8509('0x116')](db[_0x8509('0xa3')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1cb')});db['SugarcrmConfiguration'][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x8509('0x1ce')});db['SugarcrmConfiguration'][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':_0x8509('0x1cf'),'onDelete':'cascade','foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa3')]['hasMany'](db[_0x8509('0xa4')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xa3')][_0x8509('0x125')](db[_0x8509('0x1d7')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db['SugarcrmField'][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':'Subject','foreignKey':_0x8509('0x1ce')});db[_0x8509('0xa4')][_0x8509('0x116')](db[_0x8509('0xa4')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa4')]['hasMany'](db[_0x8509('0xa4')],{'as':_0x8509('0x1d5'),'foreignKey':'FieldId'});db[_0x8509('0xa4')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xa6')][_0x8509('0x116')](db[_0x8509('0x1d8')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0x1d8')]['hasMany'](db[_0x8509('0xa8')],{'as':_0x8509('0x1cd'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1ce')});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':_0x8509('0x1cf'),'onDelete':'cascade','foreignKey':_0x8509('0x1d0')});db['DeskConfiguration'][_0x8509('0x116')](db[_0x8509('0xa8')],{'as':'Fields','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db['DeskConfiguration'][_0x8509('0x125')](db[_0x8509('0xa6')],{'as':'Account','foreignKey':_0x8509('0x1cb')});db['DeskConfiguration'][_0x8509('0x127')](db[_0x8509('0x174')],{'through':'int_desk_configuration_has_tags'});db[_0x8509('0xa8')][_0x8509('0x116')](db[_0x8509('0xa8')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0xa8')]['hasMany'](db[_0x8509('0xa8')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xa8')][_0x8509('0x116')](db[_0x8509('0xa8')],{'as':'Field','foreignKey':_0x8509('0x1d2')});db[_0x8509('0xa8')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xaa')][_0x8509('0x116')](db[_0x8509('0xac')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0xac')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':_0x8509('0x1cd'),'onDelete':_0x8509('0x113'),'foreignKey':'SubjectId'});db[_0x8509('0xac')]['hasMany'](db['ZohoField'],{'as':_0x8509('0x1cf'),'onDelete':_0x8509('0x113'),'foreignKey':'DescriptionId'});db[_0x8509('0xac')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':_0x8509('0x1d1'),'onDelete':'cascade','foreignKey':_0x8509('0x1d2')});db[_0x8509('0xac')][_0x8509('0x125')](db['ZohoAccount'],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0xae')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8509('0xae')]['hasMany'](db[_0x8509('0xae')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xae')][_0x8509('0x116')](db[_0x8509('0xae')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xae')]['belongsTo'](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':'VariableId'});db[_0x8509('0xb0')]['hasMany'](db[_0x8509('0x1d9')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1cd'),'foreignKey':_0x8509('0x1ce')});db['ZendeskConfiguration']['hasMany'](db[_0x8509('0x1da')],{'as':_0x8509('0x1cf'),'foreignKey':_0x8509('0x1d0')});db['ZendeskConfiguration'][_0x8509('0x116')](db['ZendeskField'],{'as':'Fields','foreignKey':_0x8509('0x1d2')});db[_0x8509('0x1d9')][_0x8509('0x125')](db[_0x8509('0xb0')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x1cb')});db[_0x8509('0x1d9')][_0x8509('0x127')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0x8509('0x1da')][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0x1da')][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1da')][_0x8509('0x116')](db[_0x8509('0x1da')],{'as':_0x8509('0x1d5'),'foreignKey':'FieldId'});db[_0x8509('0x1da')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0x1db')][_0x8509('0x116')](db[_0x8509('0xb4')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0xb4')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':_0x8509('0x1cd'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x8509('0xb4')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':'Descriptions','onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d0')});db['FreshdeskConfiguration']['hasMany'](db[_0x8509('0xb6')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xb4')][_0x8509('0x125')](db[_0x8509('0x1db')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db['FreshdeskConfiguration'][_0x8509('0x127')](db[_0x8509('0x174')],{'through':_0x8509('0x1dc')});db[_0x8509('0xb6')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':'Subject','foreignKey':'SubjectId'});db[_0x8509('0xb6')][_0x8509('0x116')](db[_0x8509('0xb6')],{'as':_0x8509('0x1d4'),'foreignKey':'DescriptionId'});db[_0x8509('0xb6')]['hasMany'](db[_0x8509('0xb6')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db['FreshdeskField']['belongsTo'](db[_0x8509('0x90')],{'as':'Variable','foreignKey':'VariableId'});db['VtigerAccount'][_0x8509('0x116')](db[_0x8509('0x1dd')],{'as':_0x8509('0x1ca'),'onDelete':'cascade','foreignKey':_0x8509('0x1cb')});db[_0x8509('0x1dd')][_0x8509('0x116')](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x8509('0x1dd')][_0x8509('0x116')](db['VtigerField'],{'as':_0x8509('0x1cf'),'foreignKey':'DescriptionId'});db[_0x8509('0x1dd')][_0x8509('0x116')](db['VtigerField'],{'as':'Fields','foreignKey':_0x8509('0x1d2')});db[_0x8509('0x1dd')]['belongsTo'](db['VtigerAccount'],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0x1de')]['hasMany'](db[_0x8509('0x1de')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0x1de')]['hasMany'](db[_0x8509('0x1de')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1de')]['hasMany'](db[_0x8509('0x1de')],{'as':_0x8509('0x1d5'),'foreignKey':'FieldId'});db[_0x8509('0x1de')]['belongsTo'](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xbb')][_0x8509('0x116')](db['ServicenowConfiguration'],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':'AccountId'});db['ServicenowConfiguration'][_0x8509('0x116')](db[_0x8509('0xbe')],{'as':_0x8509('0x1cd'),'foreignKey':'SubjectId'});db['ServicenowConfiguration']['hasMany'](db[_0x8509('0xbe')],{'as':'Descriptions','foreignKey':_0x8509('0x1d0')});db[_0x8509('0x1df')]['hasMany'](db[_0x8509('0xbe')],{'as':_0x8509('0x1d1'),'foreignKey':_0x8509('0x1d2')});db['ServicenowConfiguration'][_0x8509('0x125')](db[_0x8509('0xbb')],{'as':_0x8509('0x172'),'foreignKey':'AccountId'});db[_0x8509('0xbe')][_0x8509('0x116')](db['ServicenowField'],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db['ServicenowField'][_0x8509('0x116')](db['ServicenowField'],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xbe')][_0x8509('0x116')](db[_0x8509('0xbe')],{'as':'Field','foreignKey':_0x8509('0x1d2')});db['ServicenowField'][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':_0x8509('0x1d6')});db[_0x8509('0xc0')]['hasMany'](db[_0x8509('0xc2')],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1cb')});db[_0x8509('0xc0')][_0x8509('0x125')](db['CloudProvider'],{'as':_0x8509('0x166'),'foreignKey':_0x8509('0x167')});db[_0x8509('0xc2')][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1cd'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0xc2')][_0x8509('0x116')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0x8509('0x1d0')});db['Dynamics365Configuration'][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1d1'),'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xc2')]['belongsTo'](db[_0x8509('0xc0')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x1cb')});db['Dynamics365Field'][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1d3'),'foreignKey':_0x8509('0x1ce')});db[_0x8509('0xc4')][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db['Dynamics365Field'][_0x8509('0x116')](db[_0x8509('0xc4')],{'as':'Field','foreignKey':_0x8509('0x1d2')});db[_0x8509('0xc4')]['belongsTo'](db[_0x8509('0x90')],{'as':'Variable','foreignKey':_0x8509('0x1d6')});db[_0x8509('0xc6')][_0x8509('0x116')](db['FreshsalesConfiguration'],{'as':_0x8509('0x1ca'),'onDelete':_0x8509('0x113'),'foreignKey':'AccountId'});db[_0x8509('0xc8')][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1cd'),'foreignKey':'SubjectId'});db[_0x8509('0xc8')][_0x8509('0x116')](db['FreshsalesField'],{'as':_0x8509('0x1cf'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xc8')][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1d1'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xc8')]['belongsTo'](db[_0x8509('0xc6')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x1cb')});db['FreshsalesField'][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1d3'),'foreignKey':'SubjectId'});db[_0x8509('0xca')][_0x8509('0x116')](db[_0x8509('0xca')],{'as':_0x8509('0x1d4'),'foreignKey':_0x8509('0x1d0')});db[_0x8509('0xca')]['hasMany'](db[_0x8509('0xca')],{'as':_0x8509('0x1d5'),'foreignKey':_0x8509('0x1d2')});db[_0x8509('0xca')][_0x8509('0x125')](db[_0x8509('0x90')],{'as':_0x8509('0x90'),'foreignKey':'VariableId'});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0x62')],{});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f')});db[_0x8509('0x1e0')]['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x1e0')][_0x8509('0x125')](db['ChatInteraction'],{});db[_0x8509('0x1e0')]['belongsTo'](db['ChatMessage'],{});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0x12')],{});db[_0x8509('0x1e0')][_0x8509('0x125')](db[_0x8509('0x6a')],{});db[_0x8509('0xd0')]['belongsTo'](db[_0x8509('0x12')],{'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1e1')});db['ChatInternalMessage'][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x113'),'foreignKey':_0x8509('0x1e2')});db['JscriptySessionReport'][_0x8509('0x116')](db[_0x8509('0xd3')],{'foreignKey':_0x8509('0x1e3'),'onDelete':_0x8509('0x113')});db['JscriptySessionReport'][_0x8509('0x116')](db['JscriptyAnswerReport'],{'foreignKey':_0x8509('0x1e3'),'onDelete':_0x8509('0x113')});db[_0x8509('0xd5')][_0x8509('0x125')](db[_0x8509('0x18b')],{});db[_0x8509('0xd5')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':_0x8509('0x180'),'foreignKey':_0x8509('0x16f')});db[_0x8509('0xd5')][_0x8509('0x125')](db['CmContact'],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0xd5')][_0x8509('0x125')](db[_0x8509('0x54')],{});db[_0x8509('0xd5')][_0x8509('0x125')](db['SmsMessage'],{});db[_0x8509('0xd5')][_0x8509('0x125')](db['User'],{});db[_0x8509('0xd5')]['belongsTo'](db[_0x8509('0x57')],{});db['JscriptyProject'][_0x8509('0x116')](db[_0x8509('0x14f')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0x8509('0x116')](db['JscriptyQuestionReport'],{'foreignKey':_0x8509('0x1e4')});db[_0x8509('0x1e5')][_0x8509('0x116')](db[_0x8509('0xd1')],{'foreignKey':'ProjectId'});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':'user_has_teams'});db[_0x8509('0xe4')][_0x8509('0x127')](db['VoiceQueue'],{'through':_0x8509('0x1e6'),'as':'VoiceQueues'});db[_0x8509('0xe4')][_0x8509('0x127')](db['MailQueue'],{'through':'team_has_mail_queues','as':_0x8509('0x138')});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x6a')],{'through':_0x8509('0x1e7'),'as':_0x8509('0x139')});db['Team']['belongsToMany'](db[_0x8509('0x4f')],{'through':'team_has_fax_queues','as':_0x8509('0x13a')});db[_0x8509('0xe4')]['belongsToMany'](db[_0x8509('0x57')],{'through':_0x8509('0x1e8'),'as':'SmsQueues'});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x61')],{'through':'team_has_openchannel_queues','as':_0x8509('0x13d')});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0x106')],{'through':'team_has_whatsapp_queues','as':_0x8509('0x1e9')});db[_0x8509('0xe4')][_0x8509('0x127')](db[_0x8509('0xf9')],{'through':_0x8509('0x10a'),'as':_0x8509('0x137')});db[_0x8509('0x1ae')][_0x8509('0x116')](db[_0x8509('0x71')],{'as':'Hoppers','foreignKey':_0x8509('0x1ac')});db[_0x8509('0x1ae')][_0x8509('0x116')](db[_0x8509('0x75')],{'as':_0x8509('0x11a'),'foreignKey':_0x8509('0x1ac')});db['Campaign'][_0x8509('0x116')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0x8509('0x1ac')});db[_0x8509('0x1ae')][_0x8509('0x116')](db[_0x8509('0x73')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign'][_0x8509('0x125')](db['Trunk'],{'as':_0x8509('0x29'),'foreignKey':_0x8509('0x151')});db[_0x8509('0x1ae')]['belongsTo'](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0x8509('0x1ea')});db[_0x8509('0x1ae')]['belongsTo'](db['Interval'],{'as':'Interval','foreignKey':_0x8509('0x153')});db[_0x8509('0x1ae')][_0x8509('0x125')](db[_0x8509('0xde')],{'as':_0x8509('0xde'),'foreignKey':_0x8509('0x1eb')});db[_0x8509('0x1ae')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':_0x8509('0x12b'),'through':_0x8509('0x1ec')});db[_0x8509('0x1ae')][_0x8509('0x127')](db[_0x8509('0xf7')],{'as':'BlackLists','through':_0x8509('0x1ed')});db['Attachment'][_0x8509('0x125')](db[_0x8509('0x17c')],{'as':_0x8509('0x17c'),'foreignKey':'ChatOfflineMessageId'});db[_0x8509('0x1ee')][_0x8509('0x125')](db[_0x8509('0x16d')],{});db[_0x8509('0x1ee')][_0x8509('0x125')](db['MailInteraction'],{});db[_0x8509('0x1ee')]['belongsTo'](db['MailAccount'],{'foreignKey':_0x8509('0x1ef'),'as':_0x8509('0x1f0')});db[_0x8509('0x1ee')]['belongsTo'](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':'FromAgent'});db[_0x8509('0x1ee')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f2'),'as':'ToAgent'});db['MailTransferReport'][_0x8509('0x125')](db[_0x8509('0x3e')],{'foreignKey':'ToMailQueueId','as':_0x8509('0x1f3')});db[_0x8509('0x1ee')][_0x8509('0x125')](db[_0x8509('0x3c')],{'foreignKey':_0x8509('0x1f4'),'as':_0x8509('0x1f5')});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x19e')],{});db[_0x8509('0xef')]['belongsTo'](db['ChatInteraction'],{});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x62')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db[_0x8509('0xef')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f2'),'as':_0x8509('0x1f7')});db[_0x8509('0xef')][_0x8509('0x125')](db['ChatQueue'],{'foreignKey':_0x8509('0x1f8'),'as':_0x8509('0x1f3')});db[_0x8509('0xef')]['belongsTo'](db[_0x8509('0x62')],{'foreignKey':'ToChatWebsiteId','as':_0x8509('0x1f5')});db[_0x8509('0xf1')][_0x8509('0x125')](db['FaxMessage'],{});db[_0x8509('0xf1')][_0x8509('0x125')](db[_0x8509('0x4d')],{});db[_0x8509('0xf1')]['belongsTo'](db[_0x8509('0x4a')],{'foreignKey':_0x8509('0x1f9'),'as':'FromAccount'});db['FaxTransferReport'][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db[_0x8509('0xf1')][_0x8509('0x125')](db['User'],{'foreignKey':'ToUserId','as':_0x8509('0x1f7')});db[_0x8509('0xf1')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x8509('0x1fa'),'as':_0x8509('0x1f3')});db['FaxTransferReport'][_0x8509('0x125')](db[_0x8509('0x4a')],{'foreignKey':'ToFaxAccountId','as':_0x8509('0x1f5')});db[_0x8509('0xf3')][_0x8509('0x125')](db[_0x8509('0x5f')],{});db[_0x8509('0xf3')]['belongsTo'](db[_0x8509('0x5d')],{});db[_0x8509('0xf3')][_0x8509('0x125')](db[_0x8509('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':_0x8509('0x1f0')});db[_0x8509('0xf3')][_0x8509('0x125')](db['User'],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db[_0x8509('0xf3')][_0x8509('0x125')](db['User'],{'foreignKey':_0x8509('0x1f2'),'as':_0x8509('0x1f7')});db[_0x8509('0xf3')][_0x8509('0x125')](db[_0x8509('0x61')],{'foreignKey':'ToOpenchannelQueueId','as':_0x8509('0x1f3')});db[_0x8509('0xf3')]['belongsTo'](db[_0x8509('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport'][_0x8509('0x125')](db[_0x8509('0x56')],{});db[_0x8509('0xf5')][_0x8509('0x125')](db['SmsInteraction'],{});db[_0x8509('0xf5')][_0x8509('0x125')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0x8509('0x1f0')});db[_0x8509('0xf5')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':_0x8509('0x1f1'),'as':_0x8509('0x1f6')});db['SmsTransferReport'][_0x8509('0x125')](db['User'],{'foreignKey':'ToUserId','as':_0x8509('0x1f7')});db[_0x8509('0xf5')]['belongsTo'](db[_0x8509('0x57')],{'foreignKey':_0x8509('0x1fb'),'as':_0x8509('0x1f3')});db[_0x8509('0xf5')][_0x8509('0x125')](db['SmsAccount'],{'foreignKey':_0x8509('0x1fc'),'as':_0x8509('0x1f5')});db[_0x8509('0xf7')][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':_0x8509('0x16f'),'onDelete':_0x8509('0x113')});db['CmList'][_0x8509('0x116')](db[_0x8509('0x7a')],{'as':_0x8509('0x1fd'),'foreignKey':_0x8509('0x16f')});db[_0x8509('0xf7')][_0x8509('0x116')](db[_0x8509('0x12a')],{'as':_0x8509('0x1a2'),'onDelete':'cascade','foreignKey':_0x8509('0x16f')});db['CmList'][_0x8509('0x116')](db[_0x8509('0x75')],{'as':'HopperFinals','foreignKey':_0x8509('0x16f')});db[_0x8509('0xf7')][_0x8509('0x116')](db[_0x8509('0x76')],{'as':_0x8509('0x11b'),'foreignKey':_0x8509('0x16f')});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x8509('0x16f')});db['CmList'][_0x8509('0x127')](db[_0x8509('0x1a')],{'as':_0x8509('0x1fe'),'through':_0x8509('0x156')});db[_0x8509('0xf7')]['belongsToMany'](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':'cm_user_has_lists'});db[_0x8509('0xf9')][_0x8509('0x116')](db[_0x8509('0x17')],{'as':_0x8509('0x119'),'onDelete':_0x8509('0x113')});db[_0x8509('0xf9')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x10c')});db[_0x8509('0xf9')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x10a'),'as':_0x8509('0x158')});db[_0x8509('0xfa')][_0x8509('0x116')](db[_0x8509('0x12')],{'as':_0x8509('0x188'),'foreignKey':'userProfileId'});db[_0x8509('0xfa')][_0x8509('0x116')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x8509('0x126'),'onDelete':_0x8509('0x113')});db[_0x8509('0xfb')][_0x8509('0x116')](db[_0x8509('0x1ff')],{'as':'Resources','foreignKey':_0x8509('0x200'),'onDelete':'cascade'});db[_0x8509('0x144')][_0x8509('0x116')](db[_0x8509('0x7e')],{'as':_0x8509('0x16b'),'foreignKey':'WhatsappAccountId','onDelete':_0x8509('0x113')});db[_0x8509('0x144')][_0x8509('0x116')](db['CannedAnswer'],{'as':_0x8509('0x16c'),'foreignKey':_0x8509('0x201')});db[_0x8509('0x144')][_0x8509('0x116')](db[_0x8509('0x101')],{'as':_0x8509('0x15b'),'foreignKey':_0x8509('0x201')});db['WhatsappAccount']['hasMany'](db[_0x8509('0x120')],{'as':_0x8509('0x16e')});db[_0x8509('0x144')][_0x8509('0x116')](db[_0x8509('0xff')],{'as':_0x8509('0x148'),'foreignKey':_0x8509('0x201'),'onDelete':_0x8509('0x113')});db[_0x8509('0x144')][_0x8509('0x125')](db[_0x8509('0xf7')],{'as':'List','foreignKey':_0x8509('0x16f')});db['WhatsappAccount'][_0x8509('0x125')](db['Pause'],{'as':_0x8509('0x154'),'foreignKey':_0x8509('0x155')});db[_0x8509('0x144')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':'Agents','through':_0x8509('0x202')});db['WhatsappApplication'][_0x8509('0x125')](db[_0x8509('0x12')],{'onDelete':_0x8509('0x168')});db[_0x8509('0xff')][_0x8509('0x125')](db[_0x8509('0x106')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x8509('0x125')](db[_0x8509('0x144')],{'onDelete':'restrict'});db[_0x8509('0xff')][_0x8509('0x125')](db['Interval'],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x153')});db[_0x8509('0xff')]['belongsTo'](db[_0x8509('0x174')],{'onDelete':_0x8509('0x168'),'foreignKey':_0x8509('0x17e')});db[_0x8509('0x120')][_0x8509('0x116')](db[_0x8509('0x101')],{'as':_0x8509('0x15b'),'onDelete':'cascade','foreignKey':_0x8509('0x203')});db['WhatsappInteraction']['belongsTo'](db[_0x8509('0x144')],{'as':'Account','foreignKey':'WhatsappAccountId'});db[_0x8509('0x120')]['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db['WhatsappInteraction'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':_0x8509('0x173'),'foreignKey':_0x8509('0x114')});db['WhatsappInteraction'][_0x8509('0x127')](db['Tag'],{'through':'whatsapp_interaction_has_tags','as':_0x8509('0x176')});db[_0x8509('0x120')]['belongsToMany'](db[_0x8509('0x174')],{'through':_0x8509('0x1be'),'as':_0x8509('0x177')});db[_0x8509('0x120')][_0x8509('0x127')](db['User'],{'as':_0x8509('0x188'),'through':_0x8509('0x135'),'foreignKey':_0x8509('0x203')});db[_0x8509('0x101')]['belongsTo'](db[_0x8509('0x12')],{'as':_0x8509('0x12')});db[_0x8509('0x101')][_0x8509('0x125')](db['CmContact'],{'onDelete':'cascade','as':'Contact'});db[_0x8509('0x101')][_0x8509('0x125')](db[_0x8509('0x120')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x8509('0x203')});db[_0x8509('0x101')][_0x8509('0x125')](db[_0x8509('0x144')],{'as':_0x8509('0x172'),'foreignKey':_0x8509('0x201')});db[_0x8509('0x102')]['belongsTo'](db[_0x8509('0x144')],{});db['WhatsappQueueReport']['belongsTo'](db['CmList'],{'as':_0x8509('0x180'),'foreignKey':'ListId'});db['WhatsappQueueReport']['belongsTo'](db[_0x8509('0x12a')],{'as':_0x8509('0x163'),'foreignKey':_0x8509('0x164')});db[_0x8509('0x102')][_0x8509('0x125')](db[_0x8509('0x120')],{});db[_0x8509('0x102')]['belongsTo'](db['WhatsappQueue'],{});db[_0x8509('0x102')][_0x8509('0x125')](db[_0x8509('0x101')],{});db[_0x8509('0x102')]['belongsTo'](db['User'],{});db['WhatsappTransferReport'][_0x8509('0x125')](db[_0x8509('0x101')],{});db['WhatsappTransferReport'][_0x8509('0x125')](db[_0x8509('0x120')],{});db[_0x8509('0x104')][_0x8509('0x125')](db[_0x8509('0x144')],{'foreignKey':_0x8509('0x204'),'as':_0x8509('0x1f0')});db[_0x8509('0x104')][_0x8509('0x125')](db[_0x8509('0x144')],{'foreignKey':_0x8509('0x205'),'as':_0x8509('0x1f5')});db[_0x8509('0x104')][_0x8509('0x125')](db['WhatsappQueue'],{'foreignKey':_0x8509('0x206'),'as':_0x8509('0x1f3')});db[_0x8509('0x104')][_0x8509('0x125')](db[_0x8509('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0x8509('0x104')][_0x8509('0x125')](db['User'],{'foreignKey':_0x8509('0x1f2'),'as':_0x8509('0x1f7')});db[_0x8509('0x106')][_0x8509('0x127')](db[_0x8509('0x12')],{'as':_0x8509('0x157'),'through':_0x8509('0x36'),'foreignKey':_0x8509('0x207')});db[_0x8509('0x106')][_0x8509('0x127')](db[_0x8509('0xe4')],{'through':_0x8509('0x208'),'as':_0x8509('0x158')});db['UserSetting'][_0x8509('0x125')](db[_0x8509('0x12')],{'as':'user','foreignKey':'UserId','onDelete':_0x8509('0x113'),'hooks':!![]});db[_0x8509('0x166')]['hasOne'](db['Dynamics365Account'],{'as':_0x8509('0xc0'),'onDelete':_0x8509('0x168')});db[_0x8509('0x166')][_0x8509('0x111')](db[_0x8509('0x38')],{'as':_0x8509('0x169'),'onDelete':_0x8509('0x168')});db[_0x8509('0x166')][_0x8509('0x111')](db[_0x8509('0x3a')],{'as':'Smtp','onDelete':_0x8509('0x168')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa4b2=['UserFaxQueue','team_has_fax_queues','SmsAccountId','Answers','SmsMessage','mandatoryDispositionPause','IntervalId','sms_interaction_has_tags','ThroughTags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','team_has_openchannel_queues','ProactiveActions','OpenchannelQueueReport','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','ChatGroupId','Members','CompanyId','Phones','CmContactId','HopperHistories','Company','cm_contact_has_tags','AdditionalPhones','CmHopperId','Campaign','CampaignId','OwnerId','OneAll','AutomationAllId','Any','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','AnalyticCustomReport','CustomReportId','moh_has_sounds','ItemType','Hopper','AllConditions','AllCondition','AnyCondition','TriggerAnyId','Actions','TriggerId','Fields','AnalyticMetric','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','Subject','SubjectId','Description','Field','VariableId','SugarcrmAccount','DeskAccount','DeskField','int_desk_configuration_has_tags','ZohoAccount','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','ServicenowAccount','FreshsalesField','FromId','ToId','SessionId','JscriptyProject','ProjectId','team_has_mail_queues','team_has_chat_queues','team_has_sms_queues','team_has_whatsapp_queues','VoicePrefix','SquareProjectId','campaigns_has_cm_blacklists','MailTransferReport','FromAccount','FromUserId','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','ToChatQueueId','ToQueue','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','Resources','sectionId','WhatsappAccountId','WhatsappMessage','WhatsappInteractionId','whatsapp_interaction_has_tags','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','determine','motion2','xcall','xC@LL1234','mysql','name','utf8','utf8_general_ci','127.0.0.1','utf8mb4','database','password','options','sequelizeHistory','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../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','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Pause','../api/pause/pause.model','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskField/intDeskField.model','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','../api/integration/integration.model','Network','ChatQueueReport','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','Team','../api/team/team.model','../api/license/license.model','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/smsTransferReport/smsTransferReport.model','CmList','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','userSetting','cascade','hasMany','Recordings','Extensions','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','UserNotifications','CmHopper','Hoppers','belongsTo','userProfileId','belongsToMany','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','VoiceContext','Applications','Sounds','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','Interval','mandatoryDispositionPauseId','Agents','Teams','BlackLists','mailboxuser','mailbox','uniqueid','AgentReports','Contact','ContactId','CloudProviderId','restrict','MailServerOut','MailAccount','MailAccountId','Imap','Smtp','Dispositions','Messages','Interactions','Template','TemplateId','user_has_mail_accounts','MailInteractionId','Account','Owner','Tag','mail_interaction_has_tags','Tags','Users','user_has_mail_interactions','Attachment','Attachments','ChatWebsiteId','ChatOfflineMessageId','TagId','MailQueueReport','List','ListId','Dashboard','FaxAccountId','FaxApplication','FaxInteractionId','fax_interaction_has_tags','Interaction','AttachmentId'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa4b2,0x80));var _0x2a4b=function(_0x5c5c3e,_0x45f203){_0x5c5c3e=_0x5c5c3e-0x0;var _0x34b64=_0xa4b2[_0x5c5c3e];return _0x34b64;};'use strict';var config=require(_0x2a4b('0x0'));var Sequelize=require(_0x2a4b('0x1'));var _=require(_0x2a4b('0x2'));var jstz=require('jstz');var timezone=jstz[_0x2a4b('0x3')]();config[_0x2a4b('0x1')]=_['defaultsDeep'](config[_0x2a4b('0x1')],{'database':_0x2a4b('0x4'),'username':_0x2a4b('0x5'),'password':_0x2a4b('0x6'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0x2a4b('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0x2a4b('0x8')](),'define':{'charset':_0x2a4b('0x9'),'collate':_0x2a4b('0xa')}}});config['sequelizeHistory']=_['defaultsDeep'](config['sequelizeHistory'],{'database':_0x2a4b('0x4'),'username':_0x2a4b('0x5'),'password':_0x2a4b('0x6'),'options':{'host':_0x2a4b('0xb'),'port':0xcea,'dialect':_0x2a4b('0x7'),'dialectOptions':{'charset':_0x2a4b('0xc')},'logging':![],'timezone':timezone[_0x2a4b('0x8')](),'define':{'charset':'utf8','collate':_0x2a4b('0xa')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x2a4b('0xd')],config[_0x2a4b('0x1')]['username'],config[_0x2a4b('0x1')][_0x2a4b('0xe')],config[_0x2a4b('0x1')][_0x2a4b('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x2a4b('0x10')][_0x2a4b('0xd')],config['sequelizeHistory']['username'],config[_0x2a4b('0x10')][_0x2a4b('0xe')],config['sequelizeHistory'][_0x2a4b('0xf')])};db[_0x2a4b('0x11')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x12'));db[_0x2a4b('0x13')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x15'));db['VoiceContext']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x16'));db[_0x2a4b('0x17')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x18'));db[_0x2a4b('0x19')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x1a'));db[_0x2a4b('0x1b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/voiceQueue/voiceQueue.model');db[_0x2a4b('0x1c')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/voiceRecording/voiceRecording.model');db[_0x2a4b('0x1d')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x1e'));db[_0x2a4b('0x1f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x20'));db[_0x2a4b('0x21')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x22'));db[_0x2a4b('0x23')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x24'));db['VoiceDialReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x25'));db[_0x2a4b('0x26')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x27'));db[_0x2a4b('0x28')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x29'));db['MemberReport']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x2a'));db[_0x2a4b('0x2b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x2c'));db[_0x2a4b('0x2d')]=db['sequelize']['import'](_0x2a4b('0x2e'));db[_0x2a4b('0x2f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x30'));db[_0x2a4b('0x31')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x32'));db[_0x2a4b('0x33')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x34'));db[_0x2a4b('0x35')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x36'));db['UserFaxQueue']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x37'));db['UserSmsQueue']=db['sequelize']['import'](_0x2a4b('0x38'));db[_0x2a4b('0x39')]=db['sequelize'][_0x2a4b('0x14')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x2a4b('0x3a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x3b'));db[_0x2a4b('0x3c')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x3d'));db['MailAccount']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x3e'));db[_0x2a4b('0x3f')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x40'));db[_0x2a4b('0x41')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x42'));db[_0x2a4b('0x43')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x44'));db[_0x2a4b('0x45')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x46'));db[_0x2a4b('0x47')]=db['sequelize'][_0x2a4b('0x14')]('../api/mailApplication/mailApplication.model');db['MailQueueReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/mailQueueReport/mailQueueReport.model');db['Dashboard']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x48'));db[_0x2a4b('0x49')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x4a'));db[_0x2a4b('0x4b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x4c'));db['FaxApplication']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x4d'));db[_0x2a4b('0x4e')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x4f'));db[_0x2a4b('0x50')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x51'));db[_0x2a4b('0x52')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x53'));db[_0x2a4b('0x54')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/faxQueueReport/faxQueueReport.model');db['SmsAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x55'));db[_0x2a4b('0x56')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/smsApplication/smsApplication.model');db[_0x2a4b('0x57')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x58'));db['SmsMessage']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x59'));db[_0x2a4b('0x5a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x5b'));db[_0x2a4b('0x5c')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x5d'));db[_0x2a4b('0x5e')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x5f'));db[_0x2a4b('0x60')]=db[_0x2a4b('0x1')]['import']('../api/openchannelInteraction/openchannelInteraction.model');db[_0x2a4b('0x61')]=db['sequelize']['import'](_0x2a4b('0x62'));db[_0x2a4b('0x63')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x64'));db[_0x2a4b('0x65')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x66'));db['OpenchannelQueueReport']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x67'));db[_0x2a4b('0x68')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x69'));db[_0x2a4b('0x6a')]=db[_0x2a4b('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x2a4b('0x6b')]=db['sequelize'][_0x2a4b('0x14')]('../api/chatMessage/chatMessage.model');db[_0x2a4b('0x6c')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x6d'));db[_0x2a4b('0x6e')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x6f'));db[_0x2a4b('0x70')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/chatGroup/chatGroup.model');db[_0x2a4b('0x71')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x72'));db[_0x2a4b('0x73')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x74'));db['CmContact']=db[_0x2a4b('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x75'));db[_0x2a4b('0x76')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x77'));db[_0x2a4b('0x78')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x79'));db[_0x2a4b('0x7a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x2a4b('0x7b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x7c'));db[_0x2a4b('0x7d')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x7e'));db[_0x2a4b('0x7f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/action/action.model');db[_0x2a4b('0x80')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x81'));db[_0x2a4b('0x82')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x83'));db[_0x2a4b('0x84')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x85'));db[_0x2a4b('0x86')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x87'));db['Interval']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/interval/interval.model');db[_0x2a4b('0x88')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x89'));db['Cdr']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x8a'));db[_0x2a4b('0x8b')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x8c'));db[_0x2a4b('0x8d')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x8e'));db[_0x2a4b('0x8f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x90'));db['Tag']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x91'));db[_0x2a4b('0x92')]=db['sequelize']['import'](_0x2a4b('0x93'));db[_0x2a4b('0x94')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x95'));db[_0x2a4b('0x96')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db['Template']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x97'));db[_0x2a4b('0x98')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x99'));db[_0x2a4b('0x9a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/variable/variable.model');db[_0x2a4b('0x9b')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/integration/integration.model');db[_0x2a4b('0x9c')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x9d'));db['AnalyticCustomReport']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x9e'));db[_0x2a4b('0x9f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa0'));db[_0x2a4b('0xa1')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa2'));db['AnalyticMetric']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa3'));db[_0x2a4b('0xa4')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xa5'));db['AnalyticTreeReport']=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xa6'));db[_0x2a4b('0xa7')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xa8'));db[_0x2a4b('0xa9')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xaa'));db[_0x2a4b('0xab')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xac'));db['SugarcrmAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xad'));db[_0x2a4b('0xae')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xaf'));db[_0x2a4b('0xb0')]=db['sequelize']['import'](_0x2a4b('0xb1'));db['DeskAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intDeskAccount/intDeskAccount.model');db[_0x2a4b('0xb2')]=db['sequelize'][_0x2a4b('0x14')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xb3'));db['ZohoAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xb4'));db[_0x2a4b('0xb5')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xb6'));db[_0x2a4b('0xb7')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intZohoField/intZohoField.model');db[_0x2a4b('0xb8')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xb9'));db[_0x2a4b('0xba')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xbb'));db[_0x2a4b('0xbc')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xbd'));db[_0x2a4b('0xbe')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xbf'));db[_0x2a4b('0xc0')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model');db[_0x2a4b('0xc1')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xc2'));db[_0x2a4b('0xc3')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xc4'));db['VtigerConfiguration']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xc5'));db[_0x2a4b('0xc6')]=db['sequelize']['import'](_0x2a4b('0xc7'));db['ServicenowAccount']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xc8'));db[_0x2a4b('0xc9')]=db[_0x2a4b('0x1')]['import']('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0x2a4b('0xca')]=db[_0x2a4b('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db[_0x2a4b('0xcb')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xcc'));db[_0x2a4b('0xcd')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x2a4b('0xce')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xcf'));db[_0x2a4b('0xd0')]=db['sequelize'][_0x2a4b('0x14')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x2a4b('0xd1')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xd2'));db['FreshsalesField']=db[_0x2a4b('0x1')]['import']('../api/intFreshsalesField/intFreshsalesField.model');db['Integration']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xd3'));db[_0x2a4b('0xd4')]=db['sequelize'][_0x2a4b('0x14')]('../api/network/network.model');db[_0x2a4b('0xd5')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/chatQueueReport/chatQueueReport.model');db[_0x2a4b('0xd6')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xd7'));db[_0x2a4b('0xd8')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xd9'));db[_0x2a4b('0xda')]=db['sequelize']['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xdb'));db[_0x2a4b('0xdc')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xdd'));db[_0x2a4b('0xde')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xdf'));db['SquareDetailsReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/squareReportDetail/squareReportDetail.model');db['JscriptyProject']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xe0'));db[_0x2a4b('0xe1')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xe2'));db[_0x2a4b('0xe3')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/squareOdbc/squareOdbc.model');db[_0x2a4b('0xe4')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xe5'));db[_0x2a4b('0xe6')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0xe7'));db[_0x2a4b('0xe8')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/squareMessage/squareMessage.model');db[_0x2a4b('0xe9')]=db['sequelize']['import'](_0x2a4b('0xea'));db['License']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xeb'));db['Campaign']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0xec'));db[_0x2a4b('0xed')]=db[_0x2a4b('0x1')]['import']('../api/migration/migration.model');db['Attachment']=db['sequelize']['import'](_0x2a4b('0xee'));db[_0x2a4b('0xef')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/plugin/plugin.model');db['MailTransferReport']=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/mailTransferReport/mailTransferReport.model');db[_0x2a4b('0xf0')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xf1'));db[_0x2a4b('0xf2')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xf3'));db['OpenchannelTransferReport']=db['sequelize'][_0x2a4b('0x14')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0xf4'));db[_0x2a4b('0xf5')]=db['sequelize'][_0x2a4b('0x14')]('../api/cmList/cmList.model');db['VoicePrefix']=db['sequelize']['import'](_0x2a4b('0xf6'));db[_0x2a4b('0xf7')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/userProfile/userProfile.model');db[_0x2a4b('0xf8')]=db['sequelize'][_0x2a4b('0x14')]('../api/userProfileSection/userProfileSection.model');db[_0x2a4b('0xf9')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xfa'));db[_0x2a4b('0xfb')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0xfc'));db[_0x2a4b('0xfd')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0xfe'));db[_0x2a4b('0xff')]=db['sequelize']['import'](_0x2a4b('0x100'));db[_0x2a4b('0x101')]=db['sequelize'][_0x2a4b('0x14')]('../api/whatsappInteraction/whatsappInteraction.model');db['WhatsappMessage']=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x102'));db[_0x2a4b('0x103')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x104'));db[_0x2a4b('0x105')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/whatsappTransferReport/whatsappTransferReport.model');db[_0x2a4b('0x106')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x107'));db[_0x2a4b('0x108')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x109'));db[_0x2a4b('0x10a')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0x2a4b('0x10b')]=db[_0x2a4b('0x1')]['import'](_0x2a4b('0x10c'));db[_0x2a4b('0x10d')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x10e'));db[_0x2a4b('0x10f')]=db[_0x2a4b('0x1')][_0x2a4b('0x14')](_0x2a4b('0x110'));db[_0x2a4b('0x111')]=db['sequelize'][_0x2a4b('0x14')](_0x2a4b('0x112'));db[_0x2a4b('0x11')][_0x2a4b('0x113')](db['VoiceMail'],{'as':_0x2a4b('0x1f'),'onDelete':'cascade','foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x113')](db['UserSetting'],{'as':_0x2a4b('0x115'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x1c')],{'as':_0x2a4b('0x118'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')]['hasMany'](db[_0x2a4b('0x2f')],{'as':'VoiceQueuesRt','foreignKey':_0x2a4b('0x114')});db['User'][_0x2a4b('0x117')](db[_0x2a4b('0x17')],{'as':_0x2a4b('0x119'),'onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['CmHopperHistory'],{'as':_0x2a4b('0x11a'),'foreignKey':'UserId'});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':_0x2a4b('0x7b'),'foreignKey':_0x2a4b('0x114')});db['User']['hasMany'](db[_0x2a4b('0x60')],{'as':_0x2a4b('0x11b'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x6a')],{'as':_0x2a4b('0x11c'),'foreignKey':_0x2a4b('0x114')});db['User'][_0x2a4b('0x117')](db[_0x2a4b('0x57')],{'as':_0x2a4b('0x11d'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db[_0x2a4b('0x4e')],{'as':_0x2a4b('0x11e'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['MailInteraction'],{'as':_0x2a4b('0x11f'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x11')][_0x2a4b('0x117')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','foreignKey':_0x2a4b('0x114')});db['User']['hasMany'](db[_0x2a4b('0xfb')],{'as':_0x2a4b('0x120'),'foreignKey':'SenderId'});db[_0x2a4b('0x11')]['hasMany'](db[_0x2a4b('0x121')],{'as':_0x2a4b('0x122'),'foreignKey':'UserId','onDelete':'SET\x20NULL'});db[_0x2a4b('0x11')][_0x2a4b('0x123')](db[_0x2a4b('0xf7')],{'as':_0x2a4b('0xf7'),'foreignKey':_0x2a4b('0x124')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db['ChatGroup'],{'as':'Groups','through':_0x2a4b('0x126')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x128'),'through':_0x2a4b('0x129')});db[_0x2a4b('0x11')]['belongsToMany'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x12a'),'through':'cm_user_has_lists'});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':_0x2a4b('0x12b')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x43')],{'as':_0x2a4b('0x11f'),'through':'user_has_mail_interactions'});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x6a')],{'as':'ChatInteractions','through':_0x2a4b('0x12c')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x4e')],{'as':_0x2a4b('0x11e'),'through':_0x2a4b('0x12d')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x57')],{'as':_0x2a4b('0x11d'),'through':_0x2a4b('0x12e')});db[_0x2a4b('0x11')]['belongsToMany'](db[_0x2a4b('0x60')],{'as':_0x2a4b('0x11b'),'through':'user_has_openchannel_interactions'});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db['WhatsappInteraction'],{'as':'WhatsappInteractions','through':_0x2a4b('0x12f')});db[_0x2a4b('0x11')]['belongsToMany'](db['VoiceQueue'],{'as':_0x2a4b('0x130'),'through':_0x2a4b('0x31'),'required':![]});db[_0x2a4b('0x11')]['belongsToMany'](db['VoicePrefix'],{'as':_0x2a4b('0x131'),'through':_0x2a4b('0x10d'),'required':![]});db['User']['belongsToMany'](db[_0x2a4b('0x3f')],{'as':_0x2a4b('0x132'),'through':_0x2a4b('0x35'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x6e')],{'as':_0x2a4b('0x133'),'through':_0x2a4b('0x33'),'required':![],'hooks':!![]});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x52')],{'as':_0x2a4b('0x134'),'through':'UserFaxQueue','required':![]});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x5a')],{'as':_0x2a4b('0x135'),'through':_0x2a4b('0x136'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x63')],{'as':_0x2a4b('0x137'),'through':_0x2a4b('0x39'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x106')],{'as':_0x2a4b('0x138'),'through':_0x2a4b('0x3a'),'required':![]});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0xf5')],{'through':_0x2a4b('0x139')});db[_0x2a4b('0x11')]['belongsToMany'](db['ChatWebsite'],{'as':'ChatWebsites','through':_0x2a4b('0x13a')});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0x4b')],{'as':_0x2a4b('0x13b'),'through':_0x2a4b('0x13c')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db['MailAccount'],{'as':_0x2a4b('0x13d'),'through':'user_has_mail_accounts'});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x5c')],{'as':_0x2a4b('0x13e'),'through':_0x2a4b('0x13f')});db[_0x2a4b('0x11')][_0x2a4b('0x125')](db[_0x2a4b('0x140')],{'as':_0x2a4b('0x141'),'through':_0x2a4b('0x142')});db['User'][_0x2a4b('0x125')](db[_0x2a4b('0xfd')],{'as':'WhatsappAccounts','through':_0x2a4b('0x143')});db[_0x2a4b('0x13')]['hasMany'](db[_0x2a4b('0x17')],{'as':'SpiedAgents','onDelete':_0x2a4b('0x116'),'foreignKey':'ChanSpyId'});db[_0x2a4b('0x144')]['hasMany'](db[_0x2a4b('0x17')],{'onDelete':'cascade'});db[_0x2a4b('0x17')]['hasMany'](db['VoiceExtension'],{'as':_0x2a4b('0x145'),'onDelete':_0x2a4b('0x116')});db['VoiceMusicOnHold']['belongsToMany'](db[_0x2a4b('0x8f')],{'as':_0x2a4b('0x146'),'through':'moh_has_sounds'});db[_0x2a4b('0x1b')][_0x2a4b('0x117')](db[_0x2a4b('0x2f')],{'as':'Members','foreignKey':_0x2a4b('0x147')});db['VoiceQueue']['hasMany'](db[_0x2a4b('0x121')],{'as':'Hoppers','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x2a4b('0x117')](db[_0x2a4b('0x78')],{'as':_0x2a4b('0x148'),'foreignKey':'VoiceQueueId'});db[_0x2a4b('0x1b')]['hasMany'](db[_0x2a4b('0x7a')],{'as':'HopperHistories','foreignKey':_0x2a4b('0x147')});db['VoiceQueue'][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':'ReportAgentPreview','foreignKey':_0x2a4b('0x147')});db[_0x2a4b('0x1b')]['hasMany'](db[_0x2a4b('0x76')],{'as':_0x2a4b('0x149'),'foreignKey':'VoiceQueueId'});db[_0x2a4b('0x1b')]['hasMany'](db[_0x2a4b('0x14a')],{'as':_0x2a4b('0x14b'),'foreignKey':_0x2a4b('0x147')});db['VoiceQueue'][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x2b'),'foreignKey':_0x2a4b('0x14c')});db['VoiceQueue'][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x14d'),'foreignKey':_0x2a4b('0x14e')});db[_0x2a4b('0x1b')][_0x2a4b('0x123')](db['Interval'],{'as':_0x2a4b('0x14f'),'foreignKey':'IntervalId'});db['VoiceQueue']['belongsTo'](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db['VoiceQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xf5')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db[_0x2a4b('0x1b')]['belongsToMany'](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x31')});db[_0x2a4b('0x1b')]['belongsToMany'](db['Team'],{'as':_0x2a4b('0x152'),'through':_0x2a4b('0x10a')});db['VoiceQueue'][_0x2a4b('0x125')](db['CmList'],{'as':_0x2a4b('0x153'),'through':'voice_queues_has_cm_blacklists'});db[_0x2a4b('0x1c')][_0x2a4b('0x123')](db['User'],{'as':'User','foreignKey':'UserId'});db[_0x2a4b('0x1d')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x11'),'foreignKey':'UserId'});db[_0x2a4b('0x1f')][_0x2a4b('0x117')](db[_0x2a4b('0x21')],{'as':'Messages','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x154'),'sourceKey':_0x2a4b('0x155')});db[_0x2a4b('0x21')]['belongsTo'](db[_0x2a4b('0x1f')],{'foreignKey':_0x2a4b('0x154'),'targetKey':'mailbox'});db['VoiceCallReport'][_0x2a4b('0x117')](db[_0x2a4b('0x28')],{'as':'QueueCalls','foreignKey':_0x2a4b('0x156'),'constraints':![]});db[_0x2a4b('0x23')]['hasMany'](db['VoiceAgentReport'],{'as':_0x2a4b('0x157'),'foreignKey':_0x2a4b('0x156'),'constraints':![]});db[_0x2a4b('0x23')][_0x2a4b('0x123')](db['User'],{'as':_0x2a4b('0x11'),'foreignKey':_0x2a4b('0x114')});db['VoiceCallReport'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x3c')][_0x2a4b('0x123')](db['MailAccount'],{'as':'MailAccount','foreignKey':'MailAccountId'});db[_0x2a4b('0x3c')][_0x2a4b('0x123')](db[_0x2a4b('0x108')],{'as':_0x2a4b('0x108'),'foreignKey':_0x2a4b('0x15a'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x15c')][_0x2a4b('0x123')](db['MailAccount'],{'as':_0x2a4b('0x15d'),'foreignKey':_0x2a4b('0x15e')});db['MailServerOut'][_0x2a4b('0x123')](db[_0x2a4b('0x108')],{'as':_0x2a4b('0x108'),'foreignKey':_0x2a4b('0x15a'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x15d')][_0x2a4b('0x113')](db[_0x2a4b('0x3c')],{'as':_0x2a4b('0x15f'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x15d')]['hasOne'](db['MailServerOut'],{'as':_0x2a4b('0x160'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x15d')][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x15e'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x2a4b('0x82')],{'as':'Answers','foreignKey':_0x2a4b('0x15e')});db[_0x2a4b('0x15d')][_0x2a4b('0x117')](db['MailMessage'],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x15e')});db[_0x2a4b('0x15d')]['hasMany'](db[_0x2a4b('0x43')],{'as':_0x2a4b('0x163')});db[_0x2a4b('0x15d')][_0x2a4b('0x117')](db[_0x2a4b('0x47')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x15e'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x15d')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':'List','foreignKey':'ListId'});db['MailAccount']['belongsTo'](db[_0x2a4b('0x164')],{'as':_0x2a4b('0x164'),'foreignKey':_0x2a4b('0x165')});db['MailAccount'][_0x2a4b('0x123')](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db[_0x2a4b('0x15d')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x166')});db[_0x2a4b('0x3f')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x35')});db['MailQueue']['belongsToMany'](db[_0x2a4b('0xe9')],{'through':'team_has_mail_queues','as':_0x2a4b('0x152')});db[_0x2a4b('0x43')][_0x2a4b('0x117')](db[_0x2a4b('0x45')],{'as':'Messages','onDelete':'cascade','foreignKey':_0x2a4b('0x167')});db['MailInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x15d')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x15e')});db['MailInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x43')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x43')]['belongsToMany'](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x16b'),'as':_0x2a4b('0x16c')});db['MailInteraction'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0x2a4b('0x43')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x16e'),'foreignKey':_0x2a4b('0x167')});db[_0x2a4b('0x45')]['hasMany'](db[_0x2a4b('0x16f')],{'as':_0x2a4b('0x170'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x45')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x11')});db[_0x2a4b('0x45')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'onDelete':'cascade','as':_0x2a4b('0x158')});db[_0x2a4b('0x45')]['belongsTo'](db['MailInteraction'],{'as':'Interaction','foreignKey':_0x2a4b('0x167')});db['MailMessage']['belongsTo'](db[_0x2a4b('0x15d')],{'as':'Account','foreignKey':_0x2a4b('0x15e')});db['MailMessage']['belongsTo'](db[_0x2a4b('0x65')],{'as':'ChatWebsite','foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x45')][_0x2a4b('0x123')](db[_0x2a4b('0x6c')],{'as':_0x2a4b('0x6c'),'foreignKey':_0x2a4b('0x172')});db[_0x2a4b('0x47')]['belongsTo'](db[_0x2a4b('0x11')],{'onDelete':'restrict'});db[_0x2a4b('0x47')][_0x2a4b('0x123')](db['MailQueue'],{'onDelete':_0x2a4b('0x15b')});db['MailApplication'][_0x2a4b('0x123')](db[_0x2a4b('0x15d')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x47')]['belongsTo'](db['Interval'],{'onDelete':_0x2a4b('0x15b'),'foreignKey':'IntervalId'});db[_0x2a4b('0x47')][_0x2a4b('0x123')](db[_0x2a4b('0x16a')],{'onDelete':'restrict','foreignKey':_0x2a4b('0x173')});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db['MailAccount'],{});db[_0x2a4b('0x174')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['MailQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db[_0x2a4b('0x43')],{});db['MailQueueReport'][_0x2a4b('0x123')](db['MailMessage'],{});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{});db[_0x2a4b('0x174')][_0x2a4b('0x123')](db['MailQueue'],{});db[_0x2a4b('0x177')][_0x2a4b('0x117')](db[_0x2a4b('0x49')],{'as':'Items','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':'Dispositions','foreignKey':'FaxAccountId','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x4b')]['hasMany'](db[_0x2a4b('0x82')],{'as':'Answers','foreignKey':_0x2a4b('0x178')});db['FaxAccount']['hasMany'](db['FaxInteraction'],{'as':_0x2a4b('0x163')});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x179')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x178'),'onDelete':'cascade'});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x17')],{'as':'Exntensions','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x4b')][_0x2a4b('0x117')](db[_0x2a4b('0x50')],{'as':_0x2a4b('0x162')});db[_0x2a4b('0x4b')][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x2b')});db[_0x2a4b('0x4b')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':'ListId'});db[_0x2a4b('0x4b')][_0x2a4b('0x123')](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db['FaxAccount'][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x13c')});db[_0x2a4b('0x179')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db['FaxApplication'][_0x2a4b('0x123')](db[_0x2a4b('0x52')],{'onDelete':'restrict'});db[_0x2a4b('0x179')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x179')]['belongsTo'](db['Tag'],{'onDelete':'restrict','foreignKey':_0x2a4b('0x173')});db['FaxInteraction'][_0x2a4b('0x117')](db[_0x2a4b('0x50')],{'as':_0x2a4b('0x162'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x17a')});db[_0x2a4b('0x4e')][_0x2a4b('0x123')](db['FaxAccount'],{'as':_0x2a4b('0x168'),'foreignKey':'FaxAccountId'});db['FaxInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db['FaxInteraction'][_0x2a4b('0x123')](db['User'],{'as':_0x2a4b('0x169'),'foreignKey':'UserId'});db[_0x2a4b('0x4e')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':'fax_interaction_has_tags','as':_0x2a4b('0x16c')});db[_0x2a4b('0x4e')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x17b'),'as':'ThroughTags'});db[_0x2a4b('0x4e')][_0x2a4b('0x125')](db['User'],{'as':'Users','through':_0x2a4b('0x12d'),'foreignKey':'FaxInteractionId'});db[_0x2a4b('0x50')]['belongsTo'](db['User'],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x11')});db[_0x2a4b('0x50')][_0x2a4b('0x123')](db[_0x2a4b('0x4e')],{'as':_0x2a4b('0x17c'),'foreignKey':_0x2a4b('0x17a')});db[_0x2a4b('0x50')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158')});db['FaxMessage'][_0x2a4b('0x123')](db[_0x2a4b('0x16f')],{'as':_0x2a4b('0x16f'),'foreignKey':_0x2a4b('0x17d')});db[_0x2a4b('0x50')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x178')});db[_0x2a4b('0x52')][_0x2a4b('0x125')](db['User'],{'as':'Agents','through':_0x2a4b('0x17e')});db['FaxQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':_0x2a4b('0x17f'),'as':_0x2a4b('0x152')});db[_0x2a4b('0x54')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{});db[_0x2a4b('0x54')]['belongsTo'](db['CmList'],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0x54')]['belongsTo'](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x54')][_0x2a4b('0x123')](db[_0x2a4b('0x4e')],{});db['FaxQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x50')],{});db[_0x2a4b('0x54')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{});db[_0x2a4b('0x54')]['belongsTo'](db[_0x2a4b('0x52')],{});db[_0x2a4b('0x140')]['hasMany'](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x180'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x140')][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':_0x2a4b('0x181'),'foreignKey':_0x2a4b('0x180')});db['SmsAccount']['hasMany'](db[_0x2a4b('0x182')],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x180')});db[_0x2a4b('0x140')][_0x2a4b('0x117')](db[_0x2a4b('0x57')],{'as':'Interactions'});db[_0x2a4b('0x140')][_0x2a4b('0x117')](db[_0x2a4b('0x56')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x180'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x140')][_0x2a4b('0x123')](db['CmList'],{'as':_0x2a4b('0x175'),'foreignKey':'ListId'});db[_0x2a4b('0x140')][_0x2a4b('0x123')](db['Pause'],{'as':_0x2a4b('0x183'),'foreignKey':_0x2a4b('0x150')});db[_0x2a4b('0x140')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x142')});db[_0x2a4b('0x56')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x56')][_0x2a4b('0x123')](db[_0x2a4b('0x5a')],{'onDelete':'restrict'});db[_0x2a4b('0x56')]['belongsTo'](db[_0x2a4b('0x140')],{'onDelete':'restrict'});db[_0x2a4b('0x56')]['belongsTo'](db[_0x2a4b('0x14f')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x184')});db['SmsApplication'][_0x2a4b('0x123')](db[_0x2a4b('0x16a')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x173')});db['SmsInteraction'][_0x2a4b('0x117')](db['SmsMessage'],{'as':'Messages','onDelete':_0x2a4b('0x116'),'foreignKey':'SmsInteractionId'});db[_0x2a4b('0x57')][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{'as':'Account','foreignKey':_0x2a4b('0x180')});db['SmsInteraction'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x57')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db['SmsInteraction'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':'sms_interaction_has_tags','as':_0x2a4b('0x16c')});db[_0x2a4b('0x57')][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x185'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x57')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x12e'),'foreignKey':_0x2a4b('0x187')});db[_0x2a4b('0x182')]['belongsTo'](db[_0x2a4b('0x11')],{'as':'User'});db[_0x2a4b('0x182')][_0x2a4b('0x123')](db['CmContact'],{'onDelete':_0x2a4b('0x116'),'as':'Contact'});db[_0x2a4b('0x182')]['belongsTo'](db[_0x2a4b('0x57')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x17c'),'foreignKey':_0x2a4b('0x187')});db['SmsMessage'][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0x2a4b('0x5a')]['belongsToMany'](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x136'),'foreignKey':_0x2a4b('0x188')});db['SmsQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':'team_has_sms_queues','as':_0x2a4b('0x152')});db['OpenchannelAccount'][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':'Dispositions','foreignKey':_0x2a4b('0x189'),'onDelete':_0x2a4b('0x116')});db['OpenchannelAccount'][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':'Answers','foreignKey':_0x2a4b('0x189')});db[_0x2a4b('0x5c')][_0x2a4b('0x117')](db[_0x2a4b('0x60')],{'as':_0x2a4b('0x163'),'foreignKey':'OpenchannelAccountId'});db[_0x2a4b('0x5c')][_0x2a4b('0x117')](db[_0x2a4b('0x61')],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x189')});db[_0x2a4b('0x5c')][_0x2a4b('0x117')](db['OpenchannelApplication'],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x189'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x5c')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0x2a4b('0x5c')][_0x2a4b('0x123')](db['Pause'],{'as':_0x2a4b('0x183'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2a4b('0x5c')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':'user_has_openchannel_accounts'});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x63')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x18a')});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x189')});db[_0x2a4b('0x5e')][_0x2a4b('0x123')](db[_0x2a4b('0x14f')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x5e')]['belongsTo'](db['Tag'],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x173')});db[_0x2a4b('0x60')][_0x2a4b('0x117')](db[_0x2a4b('0x61')],{'as':'Messages','onDelete':_0x2a4b('0x116'),'foreignKey':'OpenchannelInteractionId'});db[_0x2a4b('0x60')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'as':_0x2a4b('0x168'),'foreignKey':'OpenchannelAccountId'});db[_0x2a4b('0x60')]['belongsTo'](db['CmContact'],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x60')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x60')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x18b'),'as':_0x2a4b('0x16c')});db[_0x2a4b('0x60')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x18b'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x60')][_0x2a4b('0x125')](db['User'],{'as':_0x2a4b('0x16d'),'through':'user_has_openchannel_interactions','foreignKey':_0x2a4b('0x18c')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':'cascade','as':_0x2a4b('0x11')});db[_0x2a4b('0x61')]['belongsTo'](db[_0x2a4b('0x127')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x60')],{'onDelete':_0x2a4b('0x116'),'as':'Interaction','foreignKey':_0x2a4b('0x18c')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x16f')],{'as':_0x2a4b('0x16f'),'foreignKey':_0x2a4b('0x17d')});db[_0x2a4b('0x61')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'as':'Account','foreignKey':_0x2a4b('0x189')});db['OpenchannelQueue']['belongsToMany'](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x39'),'foreignKey':_0x2a4b('0x18a')});db[_0x2a4b('0x63')]['belongsToMany'](db['Team'],{'through':_0x2a4b('0x18d'),'as':'Teams'});db[_0x2a4b('0x65')]['hasMany'](db['Disposition'],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x171'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x65')][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':_0x2a4b('0x181'),'foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x65')]['hasMany'](db[_0x2a4b('0x71')],{'as':_0x2a4b('0x18e')});db[_0x2a4b('0x65')]['hasMany'](db['ChatInteraction'],{'as':_0x2a4b('0x163')});db[_0x2a4b('0x65')]['hasMany'](db['ChatApplication'],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x171'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x65')][_0x2a4b('0x117')](db[_0x2a4b('0x6b')],{'as':_0x2a4b('0x162')});db[_0x2a4b('0x65')]['belongsTo'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['ChatWebsite']['belongsTo'](db[_0x2a4b('0x14f')],{'as':_0x2a4b('0x14f'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x65')][_0x2a4b('0x123')](db[_0x2a4b('0x15d')],{'as':_0x2a4b('0x15d'),'foreignKey':'MailAccountId'});db[_0x2a4b('0x65')]['belongsTo'](db[_0x2a4b('0x88')],{'as':'mandatoryDispositionPause','foreignKey':_0x2a4b('0x150')});db['ChatWebsite'][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x13a')});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['OpenchannelQueueReport'][_0x2a4b('0x123')](db['CmContact'],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x60')],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x61')],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db['User'],{});db[_0x2a4b('0x18f')][_0x2a4b('0x123')](db[_0x2a4b('0x63')],{});db[_0x2a4b('0x68')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x190'),'foreignKey':_0x2a4b('0x114'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x68')][_0x2a4b('0x123')](db[_0x2a4b('0x6e')],{'as':_0x2a4b('0x191'),'foreignKey':_0x2a4b('0x192'),'onDelete':'restrict'});db[_0x2a4b('0x68')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'as':'Website','foreignKey':_0x2a4b('0x171'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x68')]['belongsTo'](db[_0x2a4b('0x16a')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':'TagId'});db['ChatInteraction'][_0x2a4b('0x117')](db[_0x2a4b('0x6b')],{'as':_0x2a4b('0x162'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x193')});db[_0x2a4b('0x6a')][_0x2a4b('0x123')](db['ChatWebsite'],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x6a')]['belongsTo'](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x6a')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x6a')][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x194'),'as':_0x2a4b('0x16c')});db['ChatInteraction'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x194'),'as':'ThroughTags'});db[_0x2a4b('0x6a')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':'Users','through':'user_has_chat_interactions','foreignKey':_0x2a4b('0x193')});db[_0x2a4b('0x6b')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x11')});db['ChatMessage'][_0x2a4b('0x123')](db['CmContact'],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x6b')][_0x2a4b('0x123')](db[_0x2a4b('0x6a')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x17c'),'foreignKey':_0x2a4b('0x193')});db['ChatMessage'][_0x2a4b('0x123')](db['Attachment'],{'as':_0x2a4b('0x16f'),'foreignKey':_0x2a4b('0x17d')});db['ChatMessage'][_0x2a4b('0x123')](db['ChatWebsite'],{'as':_0x2a4b('0x168'),'foreignKey':'ChatWebsiteId'});db[_0x2a4b('0x6c')][_0x2a4b('0x117')](db[_0x2a4b('0x16f')],{'as':'Attachments','foreignKey':_0x2a4b('0x172'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x6c')]['belongsTo'](db['CmContact'],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x6c')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x6e')][_0x2a4b('0x125')](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x33'),'hooks':!![]});db['ChatQueue'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':'team_has_chat_queues','as':_0x2a4b('0x152')});db[_0x2a4b('0x70')]['hasMany'](db[_0x2a4b('0xd6')],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x195'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x70')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x196'),'through':_0x2a4b('0x126')});db[_0x2a4b('0x71')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'as':'Website','foreignKey':_0x2a4b('0x171')});db[_0x2a4b('0x73')]['hasMany'](db['CmContact'],{'as':_0x2a4b('0x128'),'foreignKey':_0x2a4b('0x197')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db['CmContactHasItem'],{'as':_0x2a4b('0x198'),'foreignKey':_0x2a4b('0x199')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x121')],{'as':_0x2a4b('0x122'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')]['hasMany'](db['CmHopperFinal'],{'as':_0x2a4b('0x148'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')]['hasMany'](db[_0x2a4b('0x7a')],{'as':_0x2a4b('0x19a'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':_0x2a4b('0x7b'),'foreignKey':'ContactId'});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x14a')],{'as':_0x2a4b('0x14b'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x60')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x127')]['hasMany'](db['ChatInteraction'],{'as':_0x2a4b('0x11c'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db['SmsInteraction'],{'as':_0x2a4b('0x11d'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0x2a4b('0x127')][_0x2a4b('0x117')](db[_0x2a4b('0x4e')],{'as':'FaxInteractions','foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x15b')});db['CmContact'][_0x2a4b('0x117')](db[_0x2a4b('0x43')],{'as':_0x2a4b('0x11f'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x127')][_0x2a4b('0x123')](db[_0x2a4b('0x73')],{'as':_0x2a4b('0x19b'),'foreignKey':'CompanyId'});db[_0x2a4b('0x127')][_0x2a4b('0x123')](db['CmList'],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176'),'onDelete':'cascade'});db[_0x2a4b('0x127')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x129')});db[_0x2a4b('0x127')]['belongsToMany'](db[_0x2a4b('0x16a')],{'as':_0x2a4b('0x16c'),'through':_0x2a4b('0x19c')});db['CmContact'][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x19c'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x121')]['hasMany'](db[_0x2a4b('0x96')],{'as':_0x2a4b('0x19d'),'foreignKey':_0x2a4b('0x19e')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x116')});db['CmHopper'][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176'),'onDelete':_0x2a4b('0x116')});db['CmHopper']['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x190'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x1b')],{'as':_0x2a4b('0x191'),'foreignKey':_0x2a4b('0x147'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x19f')],{'as':_0x2a4b('0x19f'),'foreignKey':_0x2a4b('0x1a0'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x121')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x1a1')});db[_0x2a4b('0x76')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159'),'onDelete':_0x2a4b('0x116')});db['CmHopperBlack'][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176'),'onDelete':'cascade'});db[_0x2a4b('0x76')][_0x2a4b('0x123')](db[_0x2a4b('0x1b')],{'as':'Queue','foreignKey':_0x2a4b('0x147'),'onDelete':_0x2a4b('0x116')});db['CmHopperBlack'][_0x2a4b('0x123')](db['Campaign'],{'as':_0x2a4b('0x19f'),'foreignKey':_0x2a4b('0x1a0'),'onDelete':_0x2a4b('0x116')});db['Automation'][_0x2a4b('0x117')](db[_0x2a4b('0x86')],{'as':{'plural':'All','singular':_0x2a4b('0x1a2')},'foreignKey':_0x2a4b('0x1a3'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x80')][_0x2a4b('0x117')](db['Condition'],{'as':{'plural':_0x2a4b('0x1a4'),'singular':_0x2a4b('0x1a5')},'foreignKey':_0x2a4b('0x1a6'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x80')][_0x2a4b('0x117')](db[_0x2a4b('0x7f')],{'as':'Actions','foreignKey':_0x2a4b('0x1a7'),'onDelete':'cascade','hooks':!![]});db['Disposition'][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x1a8'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db['Interval'],{'as':_0x2a4b('0x1a9'),'foreignKey':_0x2a4b('0x184'),'onDelete':_0x2a4b('0x116'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db['VoiceExtension'],{'as':_0x2a4b('0x119'),'foreignKey':'IntervalId','onDelete':'restrict'});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db[_0x2a4b('0x47')],{'as':_0x2a4b('0x1aa'),'foreignKey':'IntervalId'});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db[_0x2a4b('0x68')],{'as':_0x2a4b('0x1ab'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x14f')][_0x2a4b('0x117')](db[_0x2a4b('0x179')],{'as':_0x2a4b('0x1ac'),'foreignKey':_0x2a4b('0x184')});db['Interval'][_0x2a4b('0x117')](db['SmsApplication'],{'as':_0x2a4b('0x1ad'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0x8d')]['belongsTo'](db[_0x2a4b('0x15d')],{});db[_0x2a4b('0x8d')]['belongsTo'](db[_0x2a4b('0x9f')],{'foreignKey':_0x2a4b('0x1ae')});db[_0x2a4b('0x8d')][_0x2a4b('0x123')](db[_0x2a4b('0x1af')],{'foreignKey':_0x2a4b('0x1b0')});db[_0x2a4b('0x8f')][_0x2a4b('0x125')](db[_0x2a4b('0x19')],{'as':'Mohs','through':_0x2a4b('0x1b1'),'onDelete':'restrict'});db['Tag'][_0x2a4b('0x125')](db['CmContact'],{'through':_0x2a4b('0x19c')});db[_0x2a4b('0x16a')][_0x2a4b('0x125')](db[_0x2a4b('0x6a')],{'through':_0x2a4b('0x194')});db['Tag'][_0x2a4b('0x125')](db[_0x2a4b('0x43')],{'through':_0x2a4b('0x16b')});db[_0x2a4b('0x16a')][_0x2a4b('0x125')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db['Tag'][_0x2a4b('0x125')](db['FaxInteraction'],{'through':_0x2a4b('0x17b')});db[_0x2a4b('0x16a')][_0x2a4b('0x125')](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0x2a4b('0x16a')]['belongsToMany'](db[_0x2a4b('0x101')],{'through':'whatsapp_interaction_has_tags'});db[_0x2a4b('0x94')][_0x2a4b('0x123')](db[_0x2a4b('0x92')],{'as':_0x2a4b('0x1b2'),'foreignKey':'ItemTypeId'});db[_0x2a4b('0x96')]['belongsTo'](db[_0x2a4b('0x121')],{'as':_0x2a4b('0x1b3'),'foreignKey':_0x2a4b('0x19e')});db[_0x2a4b('0x94')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':'CmContactId'});db[_0x2a4b('0x98')][_0x2a4b('0x117')](db['Condition'],{'as':{'plural':_0x2a4b('0x1b4'),'singular':_0x2a4b('0x1b5')},'foreignKey':'TriggerAllId','onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x98')][_0x2a4b('0x117')](db[_0x2a4b('0x86')],{'as':{'plural':'AnyConditions','singular':_0x2a4b('0x1b6')},'foreignKey':_0x2a4b('0x1b7'),'onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x98')][_0x2a4b('0x117')](db['Action'],{'as':_0x2a4b('0x1b8'),'foreignKey':_0x2a4b('0x1b9'),'onDelete':_0x2a4b('0x116'),'hooks':!![]});db[_0x2a4b('0x1af')]['hasMany'](db['AnalyticFieldReport'],{'as':_0x2a4b('0x1ba'),'onDelete':'cascade','foreignKey':'CustomReportId','hooks':!![]});db[_0x2a4b('0x9f')][_0x2a4b('0x117')](db[_0x2a4b('0xa4')],{'as':_0x2a4b('0x1ba'),'onDelete':'cascade','foreignKey':_0x2a4b('0x1ae')});db[_0x2a4b('0x1bb')][_0x2a4b('0x117')](db['AnalyticFieldReport'],{'as':_0x2a4b('0x1ba'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1bc')});db[_0x2a4b('0xa4')][_0x2a4b('0x123')](db[_0x2a4b('0x1bb')],{'foreignKey':_0x2a4b('0x1bc')});db['SalesforceAccount']['hasMany'](db[_0x2a4b('0xa9')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xa9')][_0x2a4b('0x117')](db[_0x2a4b('0xab')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':'SubjectId'});db[_0x2a4b('0xa9')][_0x2a4b('0x117')](db['SalesforceField'],{'as':_0x2a4b('0x1c0'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xa9')]['hasMany'](db['SalesforceField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2a4b('0x1c2')});db['SalesforceConfiguration'][_0x2a4b('0x123')](db[_0x2a4b('0xa7')],{'as':'Account','foreignKey':_0x2a4b('0x1be')});db['SalesforceField'][_0x2a4b('0x117')](db[_0x2a4b('0xab')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xab')]['hasMany'](db[_0x2a4b('0xab')],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xab')][_0x2a4b('0x117')](db['SalesforceField'],{'as':_0x2a4b('0x1c6'),'foreignKey':'FieldId'});db['SalesforceField'][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0x1c8')][_0x2a4b('0x117')](db['SugarcrmConfiguration'],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xae')]['hasMany'](db[_0x2a4b('0xb0')],{'as':_0x2a4b('0x1bf'),'onDelete':'cascade','foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xae')][_0x2a4b('0x117')](db[_0x2a4b('0xb0')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xae')][_0x2a4b('0x117')](db[_0x2a4b('0xb0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xae')][_0x2a4b('0x123')](db[_0x2a4b('0x1c8')],{'as':'Account','foreignKey':_0x2a4b('0x1be')});db['SugarcrmField'][_0x2a4b('0x117')](db['SugarcrmField'],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xb0')][_0x2a4b('0x117')](db['SugarcrmField'],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db['SugarcrmField'][_0x2a4b('0x117')](db['SugarcrmField'],{'as':'Field','foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xb0')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0x1c9')]['hasMany'](db[_0x2a4b('0xb2')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db['DeskConfiguration'][_0x2a4b('0x117')](db['DeskField'],{'as':_0x2a4b('0x1bf'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x2a4b('0xb2')][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xb2')]['hasMany'](db[_0x2a4b('0x1ca')],{'as':'Fields','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xb2')][_0x2a4b('0x123')](db[_0x2a4b('0x1c9')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xb2')][_0x2a4b('0x125')](db['Tag'],{'through':_0x2a4b('0x1cb')});db[_0x2a4b('0x1ca')][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db['DeskField'][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2a4b('0x1ca')][_0x2a4b('0x117')](db[_0x2a4b('0x1ca')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0x1ca')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':'VariableId'});db[_0x2a4b('0x1cc')][_0x2a4b('0x117')](db[_0x2a4b('0xb5')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db['ZohoConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0xb7')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':'SubjectId'});db[_0x2a4b('0xb5')][_0x2a4b('0x117')](db[_0x2a4b('0xb7')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xb5')]['hasMany'](db[_0x2a4b('0xb7')],{'as':'Fields','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xb5')][_0x2a4b('0x123')](db[_0x2a4b('0x1cc')],{'as':'Account','foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xb7')][_0x2a4b('0x117')](db[_0x2a4b('0xb7')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xb7')][_0x2a4b('0x117')](db['ZohoField'],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xb7')]['hasMany'](db[_0x2a4b('0xb7')],{'as':_0x2a4b('0x1c6'),'foreignKey':'FieldId'});db[_0x2a4b('0xb7')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db['ZendeskAccount'][_0x2a4b('0x117')](db[_0x2a4b('0xba')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db[_0x2a4b('0xba')][_0x2a4b('0x117')](db['ZendeskField'],{'as':_0x2a4b('0x1bf'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xba')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1c0'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xba')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1ba'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xba')][_0x2a4b('0x123')](db['ZendeskAccount'],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db['ZendeskConfiguration'][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1cd')});db[_0x2a4b('0xbc')]['hasMany'](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1c3'),'foreignKey':'SubjectId'});db[_0x2a4b('0xbc')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':'Description','foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xbc')][_0x2a4b('0x117')](db[_0x2a4b('0xbc')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xbc')]['belongsTo'](db[_0x2a4b('0x9a')],{'as':'Variable','foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xbe')]['hasMany'](db[_0x2a4b('0xc0')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xc0')][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c4')});db['FreshdeskConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Descriptions','onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xc0')][_0x2a4b('0x117')](db['FreshdeskField'],{'as':_0x2a4b('0x1ba'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc0')]['belongsTo'](db['FreshdeskAccount'],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xc0')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1ce')});db[_0x2a4b('0xc1')][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Subject','foreignKey':_0x2a4b('0x1c4')});db['FreshdeskField'][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Description','foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xc1')][_0x2a4b('0x117')](db[_0x2a4b('0xc1')],{'as':'Field','foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc1')][_0x2a4b('0x123')](db['Variable'],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xc3')]['hasMany'](db[_0x2a4b('0x1cf')],{'as':_0x2a4b('0x1bd'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0x2a4b('0x1cf')]['hasMany'](db['VtigerField'],{'as':_0x2a4b('0x1bf'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0x1cf')]['hasMany'](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1c0'),'foreignKey':_0x2a4b('0x1c1')});db['VtigerConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1ba'),'foreignKey':_0x2a4b('0x1c2')});db['VtigerConfiguration'][_0x2a4b('0x123')](db['VtigerAccount'],{'as':_0x2a4b('0x168'),'foreignKey':'AccountId'});db[_0x2a4b('0xc6')][_0x2a4b('0x117')](db[_0x2a4b('0xc6')],{'as':'Subject','foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xc6')]['hasMany'](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xc6')][_0x2a4b('0x117')](db[_0x2a4b('0xc6')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc6')]['belongsTo'](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db['ServicenowAccount'][_0x2a4b('0x117')](db['ServicenowConfiguration'],{'as':'Configurations','onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db[_0x2a4b('0xca')],{'as':'Subjects','foreignKey':'SubjectId'});db[_0x2a4b('0xc9')][_0x2a4b('0x117')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xc9')][_0x2a4b('0x117')](db[_0x2a4b('0xca')],{'as':_0x2a4b('0x1ba'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xc9')]['belongsTo'](db[_0x2a4b('0x1d0')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xca')][_0x2a4b('0x117')](db[_0x2a4b('0xca')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xca')][_0x2a4b('0x117')](db['ServicenowField'],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xca')][_0x2a4b('0x117')](db[_0x2a4b('0xca')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db['ServicenowField'][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xcb')][_0x2a4b('0x117')](db['Dynamics365Configuration'],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1be')});db['Dynamics365Account'][_0x2a4b('0x123')](db[_0x2a4b('0x108')],{'as':_0x2a4b('0x108'),'foreignKey':_0x2a4b('0x15a')});db[_0x2a4b('0xcd')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1bf'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xcd')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1c0'),'onDelete':_0x2a4b('0x116'),'foreignKey':'DescriptionId'});db[_0x2a4b('0xcd')]['hasMany'](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1ba'),'onDelete':_0x2a4b('0x116'),'foreignKey':'FieldId'});db['Dynamics365Configuration'][_0x2a4b('0x123')](db[_0x2a4b('0xcb')],{'as':_0x2a4b('0x168'),'foreignKey':_0x2a4b('0x1be')});db[_0x2a4b('0xce')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db['Dynamics365Field'][_0x2a4b('0x117')](db['Dynamics365Field'],{'as':_0x2a4b('0x1c5'),'foreignKey':_0x2a4b('0x1c1')});db[_0x2a4b('0xce')][_0x2a4b('0x117')](db[_0x2a4b('0xce')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0xce')][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':_0x2a4b('0x1c7')});db[_0x2a4b('0xd0')]['hasMany'](db[_0x2a4b('0xd1')],{'as':_0x2a4b('0x1bd'),'onDelete':_0x2a4b('0x116'),'foreignKey':'AccountId'});db[_0x2a4b('0xd1')][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1bf'),'foreignKey':_0x2a4b('0x1c4')});db[_0x2a4b('0xd1')][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1c0'),'foreignKey':_0x2a4b('0x1c1')});db['FreshsalesConfiguration'][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1ba'),'foreignKey':'FieldId'});db[_0x2a4b('0xd1')][_0x2a4b('0x123')](db[_0x2a4b('0xd0')],{'as':_0x2a4b('0x168'),'foreignKey':'AccountId'});db['FreshsalesField'][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1c3'),'foreignKey':_0x2a4b('0x1c4')});db['FreshsalesField']['hasMany'](db['FreshsalesField'],{'as':_0x2a4b('0x1c5'),'foreignKey':'DescriptionId'});db['FreshsalesField'][_0x2a4b('0x117')](db[_0x2a4b('0x1d1')],{'as':_0x2a4b('0x1c6'),'foreignKey':_0x2a4b('0x1c2')});db[_0x2a4b('0x1d1')][_0x2a4b('0x123')](db[_0x2a4b('0x9a')],{'as':_0x2a4b('0x9a'),'foreignKey':'VariableId'});db[_0x2a4b('0xd5')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{});db['ChatQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':'ListId'});db[_0x2a4b('0xd5')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':'Contact','foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0xd5')]['belongsTo'](db[_0x2a4b('0x6a')],{});db[_0x2a4b('0xd5')]['belongsTo'](db[_0x2a4b('0x6b')],{});db[_0x2a4b('0xd5')]['belongsTo'](db['User'],{});db[_0x2a4b('0xd5')][_0x2a4b('0x123')](db[_0x2a4b('0x6e')],{});db[_0x2a4b('0xd6')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1d2')});db[_0x2a4b('0xd6')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1d3')});db[_0x2a4b('0x14a')][_0x2a4b('0x117')](db[_0x2a4b('0xda')],{'foreignKey':_0x2a4b('0x1d4'),'onDelete':_0x2a4b('0x116')});db['JscriptySessionReport'][_0x2a4b('0x117')](db[_0x2a4b('0xd8')],{'foreignKey':_0x2a4b('0x1d4'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db['SmsQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db['SmsQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x57')],{});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db['SmsMessage'],{});db[_0x2a4b('0xdc')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{});db['SmsQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x5a')],{});db[_0x2a4b('0x1d5')][_0x2a4b('0x117')](db[_0x2a4b('0x14a')],{'foreignKey':_0x2a4b('0x1d6')});db[_0x2a4b('0x1d5')][_0x2a4b('0x117')](db[_0x2a4b('0xda')],{'foreignKey':_0x2a4b('0x1d6')});db[_0x2a4b('0x1d5')]['hasMany'](db[_0x2a4b('0xd8')],{'foreignKey':_0x2a4b('0x1d6')});db[_0x2a4b('0xe9')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':'Agents','through':'user_has_teams'});db['Team'][_0x2a4b('0x125')](db[_0x2a4b('0x1b')],{'through':'TeamVoiceQueue','as':'VoiceQueues'});db[_0x2a4b('0xe9')]['belongsToMany'](db[_0x2a4b('0x3f')],{'through':_0x2a4b('0x1d7'),'as':_0x2a4b('0x132')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db['ChatQueue'],{'through':_0x2a4b('0x1d8'),'as':_0x2a4b('0x133')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x52')],{'through':'team_has_fax_queues','as':'FaxQueues'});db[_0x2a4b('0xe9')]['belongsToMany'](db[_0x2a4b('0x5a')],{'through':_0x2a4b('0x1d9'),'as':'SmsQueues'});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x63')],{'through':_0x2a4b('0x18d'),'as':_0x2a4b('0x137')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x106')],{'through':_0x2a4b('0x1da'),'as':_0x2a4b('0x138')});db[_0x2a4b('0xe9')][_0x2a4b('0x125')](db[_0x2a4b('0x1db')],{'through':_0x2a4b('0x10b'),'as':_0x2a4b('0x131')});db[_0x2a4b('0x19f')]['hasMany'](db['CmHopper'],{'as':'Hoppers','foreignKey':_0x2a4b('0x1a0')});db['Campaign']['hasMany'](db[_0x2a4b('0x78')],{'as':'HopperFinals','foreignKey':_0x2a4b('0x1a0')});db[_0x2a4b('0x19f')][_0x2a4b('0x117')](db[_0x2a4b('0x7a')],{'as':_0x2a4b('0x19a'),'foreignKey':_0x2a4b('0x1a0')});db[_0x2a4b('0x19f')][_0x2a4b('0x117')](db[_0x2a4b('0x76')],{'as':_0x2a4b('0x149'),'foreignKey':_0x2a4b('0x1a0')});db['Campaign']['belongsTo'](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x2b'),'foreignKey':_0x2a4b('0x14c')});db[_0x2a4b('0x19f')][_0x2a4b('0x123')](db[_0x2a4b('0x2b')],{'as':_0x2a4b('0x14d'),'foreignKey':'TrunkBackupId'});db[_0x2a4b('0x19f')][_0x2a4b('0x123')](db[_0x2a4b('0x14f')],{'as':_0x2a4b('0x14f'),'foreignKey':'IntervalId'});db[_0x2a4b('0x19f')][_0x2a4b('0x123')](db['SquareProject'],{'as':_0x2a4b('0xe4'),'foreignKey':_0x2a4b('0x1dc')});db[_0x2a4b('0x19f')][_0x2a4b('0x125')](db['CmList'],{'as':_0x2a4b('0x12a'),'through':'campaigns_has_cm_lists'});db[_0x2a4b('0x19f')]['belongsToMany'](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x153'),'through':_0x2a4b('0x1dd')});db[_0x2a4b('0x16f')][_0x2a4b('0x123')](db[_0x2a4b('0x6c')],{'as':_0x2a4b('0x6c'),'foreignKey':_0x2a4b('0x172')});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db['MailMessage'],{});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db[_0x2a4b('0x43')],{});db[_0x2a4b('0x1de')]['belongsTo'](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0x2a4b('0x1df')});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e2'),'as':_0x2a4b('0x1e3')});db[_0x2a4b('0x1de')]['belongsTo'](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x2a4b('0x1de')][_0x2a4b('0x123')](db['MailAccount'],{'foreignKey':_0x2a4b('0x1e4'),'as':_0x2a4b('0x1e5')});db['ChatTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x6b')],{});db[_0x2a4b('0xf0')][_0x2a4b('0x123')](db[_0x2a4b('0x6a')],{});db[_0x2a4b('0xf0')][_0x2a4b('0x123')](db[_0x2a4b('0x65')],{'foreignKey':'FromChatWebsiteId','as':'FromAccount'});db[_0x2a4b('0xf0')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0xf0')][_0x2a4b('0x123')](db['User'],{'foreignKey':_0x2a4b('0x1e2'),'as':_0x2a4b('0x1e3')});db['ChatTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x6e')],{'foreignKey':_0x2a4b('0x1e6'),'as':_0x2a4b('0x1e7')});db[_0x2a4b('0xf0')]['belongsTo'](db[_0x2a4b('0x65')],{'foreignKey':'ToChatWebsiteId','as':_0x2a4b('0x1e5')});db[_0x2a4b('0xf2')][_0x2a4b('0x123')](db[_0x2a4b('0x50')],{});db['FaxTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x4e')],{});db['FaxTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'foreignKey':_0x2a4b('0x1e8'),'as':_0x2a4b('0x1df')});db[_0x2a4b('0xf2')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db['FaxTransferReport'][_0x2a4b('0x123')](db['User'],{'foreignKey':_0x2a4b('0x1e2'),'as':_0x2a4b('0x1e3')});db[_0x2a4b('0xf2')]['belongsTo'](db[_0x2a4b('0x52')],{'foreignKey':_0x2a4b('0x1e9'),'as':_0x2a4b('0x1e7')});db[_0x2a4b('0xf2')][_0x2a4b('0x123')](db[_0x2a4b('0x4b')],{'foreignKey':_0x2a4b('0x1ea'),'as':_0x2a4b('0x1e5')});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db['OpenchannelMessage'],{});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x60')],{});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x5c')],{'foreignKey':_0x2a4b('0x1ec'),'as':_0x2a4b('0x1df')});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db['OpenchannelTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e2'),'as':'ToAgent'});db[_0x2a4b('0x1eb')][_0x2a4b('0x123')](db[_0x2a4b('0x63')],{'foreignKey':_0x2a4b('0x1ed'),'as':_0x2a4b('0x1e7')});db[_0x2a4b('0x1eb')]['belongsTo'](db[_0x2a4b('0x5c')],{'foreignKey':_0x2a4b('0x1ee'),'as':_0x2a4b('0x1e5')});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db[_0x2a4b('0x182')],{});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db[_0x2a4b('0x57')],{});db['SmsTransferReport']['belongsTo'](db[_0x2a4b('0x140')],{'foreignKey':'FromSmsAccountId','as':_0x2a4b('0x1df')});db[_0x2a4b('0x1ef')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db['User'],{'foreignKey':'ToUserId','as':_0x2a4b('0x1e3')});db[_0x2a4b('0x1ef')][_0x2a4b('0x123')](db[_0x2a4b('0x5a')],{'foreignKey':_0x2a4b('0x1f0'),'as':_0x2a4b('0x1e7')});db['SmsTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x140')],{'foreignKey':_0x2a4b('0x1f1'),'as':_0x2a4b('0x1e5')});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':'Dispositions','foreignKey':'ListId','onDelete':_0x2a4b('0x116')});db[_0x2a4b('0xf5')]['hasMany'](db[_0x2a4b('0x7d')],{'as':_0x2a4b('0x1f2'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x128'),'onDelete':_0x2a4b('0x116'),'foreignKey':'ListId'});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x78')],{'as':_0x2a4b('0x148'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xf5')]['hasMany'](db[_0x2a4b('0x7a')],{'as':'HopperHistory','foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xf5')][_0x2a4b('0x117')](db[_0x2a4b('0x7b')],{'as':_0x2a4b('0x7b'),'foreignKey':_0x2a4b('0x176')});db['CmList'][_0x2a4b('0x125')](db[_0x2a4b('0x1b')],{'as':_0x2a4b('0x1f3'),'through':'voice_queues_has_cm_lists'});db['CmList'][_0x2a4b('0x125')](db['User'],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x139')});db[_0x2a4b('0x1db')][_0x2a4b('0x117')](db[_0x2a4b('0x17')],{'as':_0x2a4b('0x119'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0x1db')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x10d')});db['VoicePrefix'][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':'TeamVoicePrefix','as':'Teams'});db[_0x2a4b('0xf7')][_0x2a4b('0x117')](db['User'],{'as':_0x2a4b('0x16d'),'foreignKey':_0x2a4b('0x124')});db[_0x2a4b('0xf7')][_0x2a4b('0x117')](db['UserProfileSection'],{'as':'UserProfileSections','foreignKey':_0x2a4b('0x124'),'onDelete':_0x2a4b('0x116')});db[_0x2a4b('0xf8')][_0x2a4b('0x117')](db[_0x2a4b('0xf9')],{'as':_0x2a4b('0x1f4'),'foreignKey':_0x2a4b('0x1f5'),'onDelete':_0x2a4b('0x116')});db['WhatsappAccount'][_0x2a4b('0x117')](db[_0x2a4b('0x84')],{'as':_0x2a4b('0x161'),'foreignKey':_0x2a4b('0x1f6'),'onDelete':'cascade'});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db[_0x2a4b('0x82')],{'as':_0x2a4b('0x181'),'foreignKey':_0x2a4b('0x1f6')});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db['WhatsappMessage'],{'as':_0x2a4b('0x162'),'foreignKey':_0x2a4b('0x1f6')});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db[_0x2a4b('0x101')],{'as':_0x2a4b('0x163')});db[_0x2a4b('0xfd')][_0x2a4b('0x117')](db[_0x2a4b('0xff')],{'as':_0x2a4b('0x145'),'foreignKey':_0x2a4b('0x1f6'),'onDelete':'cascade'});db[_0x2a4b('0xfd')][_0x2a4b('0x123')](db[_0x2a4b('0xf5')],{'as':_0x2a4b('0x175'),'foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0xfd')][_0x2a4b('0x123')](db[_0x2a4b('0x88')],{'as':_0x2a4b('0x183'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x2a4b('0xfd')]['belongsToMany'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x143')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db[_0x2a4b('0x106')],{'onDelete':'restrict'});db['WhatsappApplication'][_0x2a4b('0x123')](db['WhatsappAccount'],{'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db[_0x2a4b('0x14f')],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x184')});db[_0x2a4b('0xff')][_0x2a4b('0x123')](db['Tag'],{'onDelete':_0x2a4b('0x15b'),'foreignKey':_0x2a4b('0x173')});db[_0x2a4b('0x101')][_0x2a4b('0x117')](db[_0x2a4b('0x1f7')],{'as':_0x2a4b('0x162'),'onDelete':_0x2a4b('0x116'),'foreignKey':_0x2a4b('0x1f8')});db[_0x2a4b('0x101')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{'as':'Account','foreignKey':_0x2a4b('0x1f6')});db[_0x2a4b('0x101')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x101')]['belongsTo'](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x169'),'foreignKey':_0x2a4b('0x114')});db[_0x2a4b('0x101')][_0x2a4b('0x125')](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1f9'),'as':_0x2a4b('0x16c')});db[_0x2a4b('0x101')]['belongsToMany'](db[_0x2a4b('0x16a')],{'through':_0x2a4b('0x1f9'),'as':_0x2a4b('0x186')});db[_0x2a4b('0x101')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x16d'),'through':_0x2a4b('0x12f'),'foreignKey':_0x2a4b('0x1f8')});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'as':'User'});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x158')});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0x101')],{'onDelete':_0x2a4b('0x116'),'as':_0x2a4b('0x17c'),'foreignKey':'WhatsappInteractionId'});db[_0x2a4b('0x1f7')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{'as':_0x2a4b('0x168'),'foreignKey':'WhatsappAccountId'});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{});db['WhatsappQueueReport']['belongsTo'](db[_0x2a4b('0xf5')],{'as':'List','foreignKey':_0x2a4b('0x176')});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0x127')],{'as':_0x2a4b('0x158'),'foreignKey':_0x2a4b('0x159')});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0x101')],{});db['WhatsappQueueReport'][_0x2a4b('0x123')](db[_0x2a4b('0x106')],{});db[_0x2a4b('0x103')][_0x2a4b('0x123')](db[_0x2a4b('0x1f7')],{});db['WhatsappQueueReport']['belongsTo'](db['User'],{});db[_0x2a4b('0x105')][_0x2a4b('0x123')](db[_0x2a4b('0x1f7')],{});db['WhatsappTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x101')],{});db[_0x2a4b('0x105')]['belongsTo'](db[_0x2a4b('0xfd')],{'foreignKey':'FromWhatsappAccountId','as':_0x2a4b('0x1df')});db[_0x2a4b('0x105')][_0x2a4b('0x123')](db[_0x2a4b('0xfd')],{'foreignKey':_0x2a4b('0x1fa'),'as':'ToAccount'});db['WhatsappTransferReport'][_0x2a4b('0x123')](db[_0x2a4b('0x106')],{'foreignKey':'ToQueueId','as':_0x2a4b('0x1e7')});db[_0x2a4b('0x105')][_0x2a4b('0x123')](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e0'),'as':_0x2a4b('0x1e1')});db[_0x2a4b('0x105')]['belongsTo'](db[_0x2a4b('0x11')],{'foreignKey':_0x2a4b('0x1e2'),'as':'ToAgent'});db[_0x2a4b('0x106')][_0x2a4b('0x125')](db[_0x2a4b('0x11')],{'as':_0x2a4b('0x151'),'through':_0x2a4b('0x3a'),'foreignKey':_0x2a4b('0x1fb')});db[_0x2a4b('0x106')][_0x2a4b('0x125')](db[_0x2a4b('0xe9')],{'through':_0x2a4b('0x1da'),'as':_0x2a4b('0x152')});db[_0x2a4b('0x10f')][_0x2a4b('0x123')](db['User'],{'as':_0x2a4b('0x1fc'),'foreignKey':_0x2a4b('0x114'),'onDelete':'cascade','hooks':!![]});db[_0x2a4b('0x108')]['hasOne'](db[_0x2a4b('0xcb')],{'as':_0x2a4b('0xcb'),'onDelete':_0x2a4b('0x15b')});db[_0x2a4b('0x108')][_0x2a4b('0x113')](db[_0x2a4b('0x3c')],{'as':'Imap','onDelete':_0x2a4b('0x15b')});db['CloudProvider']['hasOne'](db[_0x2a4b('0x15c')],{'as':_0x2a4b('0x160'),'onDelete':_0x2a4b('0x15b')});module[_0x2a4b('0x1fd')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b976919..e14b350 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3d04=['./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperHistory','/api/cm/custom_fields','./api/action','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','/api/intervals','./api/interval','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','/api/integrations/desk/configurations','./api/intDeskConfiguration','/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/configurations','./api/intZendeskConfiguration','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','/api/settings','./api/setting','/api/square/projects','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','/api/campaigns','/api/attachments','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','root','/www','join','/demo','/snippet','3.13.0','/plugins','/server/files/plugins','get','route','sendFile','resolve','appPath','/index.html','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailQueueReport','./api/dashboard','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact'];(function(_0x53f402,_0x326920){var _0x45a76d=function(_0x51f590){while(--_0x51f590){_0x53f402['push'](_0x53f402['shift']());}};_0x45a76d(++_0x326920);}(_0x3d04,0xbe));var _0x43d0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x3d04[_0x1facfa];return _0x9ec701;};'use strict';var path=require(_0x43d0('0x0'));var express=require(_0x43d0('0x1'));var errors=require(_0x43d0('0x2'));var config=require(_0x43d0('0x3'));var setupLoggers=require(_0x43d0('0x4'))[_0x43d0('0x5')];var clientSideLogs=require(_0x43d0('0x6'));exports[_0x43d0('0x7')]=function(_0x5a9e1d){return setupLoggers(_0x5a9e1d)[_0x43d0('0x8')](function(){_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xa'),require(_0x43d0('0xb')));_0x5a9e1d['use']('/api/voice/chanspy',require('./api/voiceChanSpy'));_0x5a9e1d['use'](_0x43d0('0xc'),require(_0x43d0('0xd')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe'),require(_0x43d0('0xf')));_0x5a9e1d['use']('/api/voice/mohs',require(_0x43d0('0x10')));_0x5a9e1d['use']('/api/voice/queues',require(_0x43d0('0x11')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x12'),require(_0x43d0('0x13')));_0x5a9e1d['use'](_0x43d0('0x14'),require(_0x43d0('0x15')));_0x5a9e1d['use'](_0x43d0('0x16'),require(_0x43d0('0x17')));_0x5a9e1d[_0x43d0('0x9')]('/api/voice/mails/messages',require(_0x43d0('0x18')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x19'),require('./api/voiceCallReport'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x1a'),require(_0x43d0('0x1b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x1c'),require('./api/voiceAgentReport'));_0x5a9e1d['use'](_0x43d0('0x1d'),require(_0x43d0('0x1e')));_0x5a9e1d[_0x43d0('0x9')]('/api/members/reports',require(_0x43d0('0x1f')));_0x5a9e1d['use'](_0x43d0('0x20'),require(_0x43d0('0x21')));_0x5a9e1d[_0x43d0('0x9')]('/api/voice/transfers/reports',require(_0x43d0('0x22')));_0x5a9e1d[_0x43d0('0x9')]('/api/mail/out_servers',require(_0x43d0('0x23')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x24'),require(_0x43d0('0x25')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x26'),require(_0x43d0('0x27')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x28'),require(_0x43d0('0x29')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x2a'),require(_0x43d0('0x2b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x2c'),require('./api/mailMessage'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x2d'),require('./api/mailApplication'));_0x5a9e1d[_0x43d0('0x9')]('/api/mail/reports/queue',require(_0x43d0('0x2e')));_0x5a9e1d[_0x43d0('0x9')]('/api/dashboards',require(_0x43d0('0x2f')));_0x5a9e1d[_0x43d0('0x9')]('/api/dashboards/items',require(_0x43d0('0x30')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x31'),require('./api/faxAccount'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x32'),require(_0x43d0('0x33')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x34'),require(_0x43d0('0x35')));_0x5a9e1d[_0x43d0('0x9')]('/api/fax/messages',require(_0x43d0('0x36')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x37'),require('./api/faxQueue'));_0x5a9e1d['use']('/api/fax/reports/queue',require(_0x43d0('0x38')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x39'),require(_0x43d0('0x3a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x3b'),require('./api/smsApplication'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x3c'),require(_0x43d0('0x3d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x3e'),require(_0x43d0('0x3f')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x40'),require(_0x43d0('0x41')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x42'),require('./api/openchannelAccount'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x43'),require(_0x43d0('0x44')));_0x5a9e1d[_0x43d0('0x9')]('/api/openchannel/interactions',require(_0x43d0('0x45')));_0x5a9e1d['use'](_0x43d0('0x46'),require(_0x43d0('0x47')));_0x5a9e1d['use'](_0x43d0('0x48'),require(_0x43d0('0x49')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x4a'),require(_0x43d0('0x4b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x4c'),require(_0x43d0('0x4d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x4e'),require(_0x43d0('0x4f')));_0x5a9e1d['use'](_0x43d0('0x50'),require(_0x43d0('0x51')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x52'),require(_0x43d0('0x53')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x54'),require(_0x43d0('0x55')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x56'),require(_0x43d0('0x57')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x58'),require(_0x43d0('0x59')));_0x5a9e1d['use'](_0x43d0('0x5a'),require(_0x43d0('0x5b')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x5c'),require(_0x43d0('0x5d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x5e'),require(_0x43d0('0x5f')));_0x5a9e1d['use']('/api/cm/hopper',require(_0x43d0('0x60')));_0x5a9e1d['use']('/api/cm/hopper_black',require(_0x43d0('0x61')));_0x5a9e1d['use'](_0x43d0('0x62'),require('./api/cmHopperFinal'));_0x5a9e1d[_0x43d0('0x9')]('/api/cm/hopper_history',require(_0x43d0('0x63')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x64'),require('./api/cmCustomField'));_0x5a9e1d[_0x43d0('0x9')]('/api/actions',require(_0x43d0('0x65')));_0x5a9e1d['use']('/api/automations',require(_0x43d0('0x66')));_0x5a9e1d[_0x43d0('0x9')]('/api/canned_answers',require(_0x43d0('0x67')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x68'),require(_0x43d0('0x69')));_0x5a9e1d[_0x43d0('0x9')]('/api/conditions',require(_0x43d0('0x6a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x6b'),require(_0x43d0('0x6c')));_0x5a9e1d['use'](_0x43d0('0x6d'),require(_0x43d0('0x6e')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x6f'),require(_0x43d0('0x70')));_0x5a9e1d['use'](_0x43d0('0x71'),require(_0x43d0('0x72')));_0x5a9e1d['use'](_0x43d0('0x73'),require(_0x43d0('0x74')));_0x5a9e1d[_0x43d0('0x9')]('/api/sounds',require(_0x43d0('0x75')));_0x5a9e1d['use'](_0x43d0('0x76'),require('./api/tag'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x77'),require(_0x43d0('0x78')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x79'),require('./api/cmContactHasItem'));_0x5a9e1d[_0x43d0('0x9')]('/api/cm_hopper_additional_phones',require(_0x43d0('0x7a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x7b'),require(_0x43d0('0x7c')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x7d'),require(_0x43d0('0x7e')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x7f'),require(_0x43d0('0x80')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x81'),require('./api/integration'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x82'),require(_0x43d0('0x83')));_0x5a9e1d['use'](_0x43d0('0x84'),require('./api/analyticCustomReport'));_0x5a9e1d['use'](_0x43d0('0x85'),require(_0x43d0('0x86')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x87'),require(_0x43d0('0x88')));_0x5a9e1d['use']('/api/analytics/metrics',require(_0x43d0('0x89')));_0x5a9e1d['use'](_0x43d0('0x8a'),require(_0x43d0('0x8b')));_0x5a9e1d['use']('/api/analytics/tree_reports',require('./api/analyticTreeReport'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x8c'),require(_0x43d0('0x8d')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x8e'),require(_0x43d0('0x8f')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x90'),require(_0x43d0('0x91')));_0x5a9e1d['use'](_0x43d0('0x92'),require(_0x43d0('0x93')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x94'),require(_0x43d0('0x95')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x96'),require(_0x43d0('0x97')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x98'),require('./api/intDeskAccount'));_0x5a9e1d['use'](_0x43d0('0x99'),require(_0x43d0('0x9a')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x9b'),require(_0x43d0('0x9c')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x9d'),require(_0x43d0('0x9e')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x9f'),require(_0x43d0('0xa0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xa1'),require(_0x43d0('0xa2')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x5a9e1d['use'](_0x43d0('0xa3'),require(_0x43d0('0xa4')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/zendesk/fields',require('./api/intZendeskField'));_0x5a9e1d['use'](_0x43d0('0xa5'),require('./api/intFreshdeskAccount'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xa6'),require(_0x43d0('0xa7')));_0x5a9e1d['use'](_0x43d0('0xa8'),require(_0x43d0('0xa9')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xaa'),require(_0x43d0('0xab')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xac'),require(_0x43d0('0xad')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xae'),require('./api/intVtigerField'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xaf'),require(_0x43d0('0xb0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xb1'),require(_0x43d0('0xb2')));_0x5a9e1d['use'](_0x43d0('0xb3'),require(_0x43d0('0xb4')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xb5'),require(_0x43d0('0xb6')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/dynamics365/configurations',require(_0x43d0('0xb7')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xb8'),require(_0x43d0('0xb9')));_0x5a9e1d['use'](_0x43d0('0xba'),require(_0x43d0('0xbb')));_0x5a9e1d[_0x43d0('0x9')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xbc'),require('./api/intFreshsalesField'));_0x5a9e1d['use'](_0x43d0('0xbd'),require(_0x43d0('0xbe')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xbf'),require(_0x43d0('0xc0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xc1'),require(_0x43d0('0xc2')));_0x5a9e1d['use'](_0x43d0('0xc3'),require(_0x43d0('0xc4')));_0x5a9e1d['use']('/api/jscripty/questions/reports',require('./api/jscriptyQuestionReport'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xc5'),require(_0x43d0('0xc6')));_0x5a9e1d['use'](_0x43d0('0xc7'),require(_0x43d0('0xc8')));_0x5a9e1d['use'](_0x43d0('0xc9'),require(_0x43d0('0xca')));_0x5a9e1d['use'](_0x43d0('0xcb'),require('./api/squareReportDetail'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xcc'),require('./api/jscriptyProject'));_0x5a9e1d['use'](_0x43d0('0xcd'),require(_0x43d0('0xce')));_0x5a9e1d[_0x43d0('0x9')]('/api/square/odbc',require('./api/squareOdbc'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xcf'),require('./api/squareProject'));_0x5a9e1d[_0x43d0('0x9')]('/api/square/recordings',require('./api/squareRecording'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd0'),require(_0x43d0('0xd1')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd2'),require(_0x43d0('0xd3')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd4'),require(_0x43d0('0xd5')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd6'),require('./api/campaign'));_0x5a9e1d[_0x43d0('0x9')]('/api/migrations',require('./api/migration'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd7'),require('./api/attachment'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xd8'),require(_0x43d0('0xd9')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xda'),require(_0x43d0('0xdb')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xdc'),require(_0x43d0('0xdd')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xde'),require(_0x43d0('0xdf')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe0'),require(_0x43d0('0xe1')));_0x5a9e1d['use'](_0x43d0('0xe2'),require(_0x43d0('0xe3')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe4'),require(_0x43d0('0xe5')));_0x5a9e1d[_0x43d0('0x9')]('/api/voice/prefixes',require(_0x43d0('0xe6')));_0x5a9e1d['use'](_0x43d0('0xe7'),require(_0x43d0('0xe8')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xe9'),require(_0x43d0('0xea')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xeb'),require('./api/userProfileResource'));_0x5a9e1d['use'](_0x43d0('0xec'),require(_0x43d0('0xed')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xee'),require(_0x43d0('0xef')));_0x5a9e1d[_0x43d0('0x9')]('/api/whatsapp/applications',require('./api/whatsappApplication'));_0x5a9e1d[_0x43d0('0x9')]('/api/whatsapp/interactions',require(_0x43d0('0xf0')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf1'),require(_0x43d0('0xf2')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf3'),require(_0x43d0('0xf4')));_0x5a9e1d['use'](_0x43d0('0xf5'),require(_0x43d0('0xf6')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf7'),require(_0x43d0('0xf8')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xf9'),require(_0x43d0('0xfa')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xfb'),require(_0x43d0('0xfc')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xfd'),require(_0x43d0('0xfe')));_0x5a9e1d['use']('/api/mail_interaction_has_tags',require('./api/mailInteractionHasTag'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0xff'),require(_0x43d0('0x100')));_0x5a9e1d[_0x43d0('0x9')]('/api/auth/google',require(_0x43d0('0x101')));_0x5a9e1d['use'](_0x43d0('0x102'),require(_0x43d0('0x103')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x104'),require(_0x43d0('0x105')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x106'),require('./api/rpc'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x107'),require(_0x43d0('0x108')));_0x5a9e1d[_0x43d0('0x9')]('/api/system',require(_0x43d0('0x109')));_0x5a9e1d['use'](_0x43d0('0x10a'),require('./api/pm2'));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x10b'),require(_0x43d0('0x10c')));_0x5a9e1d['use'](_0x43d0('0x10d'),clientSideLogs);_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x10e'),express[_0x43d0('0x10f')](path['join'](config[_0x43d0('0x110')],_0x43d0('0x10e'))));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x111'),express[_0x43d0('0x10f')](path[_0x43d0('0x112')](config[_0x43d0('0x110')],_0x43d0('0x111'))));_0x5a9e1d['use'](_0x43d0('0x113'),express['static'](path[_0x43d0('0x112')](config[_0x43d0('0x110')],'/demo')));_0x5a9e1d[_0x43d0('0x9')](_0x43d0('0x114'),express[_0x43d0('0x10f')](path[_0x43d0('0x112')](config[_0x43d0('0x110')],'snippet',_0x43d0('0x115'))));_0x5a9e1d['use'](_0x43d0('0x116'),express['static'](path[_0x43d0('0x112')](config['root'],_0x43d0('0x117'))));_0x5a9e1d['route']('/:url(api|auth|components|app|bower_components|assets)/*')[_0x43d0('0x118')](errors[0x194]);_0x5a9e1d[_0x43d0('0x119')]('/*')[_0x43d0('0x118')](function(_0xa016ad,_0x2f9ef9){_0x2f9ef9[_0x43d0('0x11a')](path[_0x43d0('0x11b')](_0x5a9e1d[_0x43d0('0x118')](_0x43d0('0x11c'))+_0x43d0('0x11d')));});return _0x5a9e1d;});}; \ No newline at end of file +var _0x4975=['/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/teams','./api/team','/api/license','./api/license','/api/migrations','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','/api/voice/prefixes','/api/userProfiles','./api/userProfile','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','/api/realtime','./api/realtime','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','/api/webbar','/apidoc','static','join','root','/www','/demo','snippet','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','appPath','/index.html','path','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./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/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','/api/dispositions','./api/disposition','./api/condition','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/voiceQueuesLog','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','./api/cmHopperAdditionalPhone','/api/templates','./api/template','./api/trigger','./api/variable','/api/integrations','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x4975,0x86));var _0x5497=function(_0x211f1a,_0x140249){_0x211f1a=_0x211f1a-0x0;var _0x74234f=_0x4975[_0x211f1a];return _0x74234f;};'use strict';var path=require(_0x5497('0x0'));var express=require('express');var errors=require(_0x5497('0x1'));var config=require(_0x5497('0x2'));var setupLoggers=require(_0x5497('0x3'))[_0x5497('0x4')];var clientSideLogs=require(_0x5497('0x5'));exports[_0x5497('0x6')]=function(_0x14cecb){return setupLoggers(_0x14cecb)[_0x5497('0x7')](function(){_0x14cecb[_0x5497('0x8')](_0x5497('0x9'),require('./api/user'));_0x14cecb[_0x5497('0x8')]('/api/voice/chanspy',require(_0x5497('0xa')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb'),require('./api/voiceContext'));_0x14cecb[_0x5497('0x8')]('/api/voice/extensions',require(_0x5497('0xc')));_0x14cecb[_0x5497('0x8')](_0x5497('0xd'),require(_0x5497('0xe')));_0x14cecb[_0x5497('0x8')](_0x5497('0xf'),require(_0x5497('0x10')));_0x14cecb[_0x5497('0x8')]('/api/voice/recordings',require('./api/voiceRecording'));_0x14cecb['use'](_0x5497('0x11'),require(_0x5497('0x12')));_0x14cecb[_0x5497('0x8')](_0x5497('0x13'),require(_0x5497('0x14')));_0x14cecb[_0x5497('0x8')](_0x5497('0x15'),require(_0x5497('0x16')));_0x14cecb[_0x5497('0x8')](_0x5497('0x17'),require('./api/voiceCallReport'));_0x14cecb[_0x5497('0x8')]('/api/voice/dials/reports',require(_0x5497('0x18')));_0x14cecb[_0x5497('0x8')](_0x5497('0x19'),require(_0x5497('0x1a')));_0x14cecb[_0x5497('0x8')](_0x5497('0x1b'),require(_0x5497('0x1c')));_0x14cecb['use']('/api/members/reports',require(_0x5497('0x1d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x1e'),require('./api/trunk'));_0x14cecb[_0x5497('0x8')](_0x5497('0x1f'),require(_0x5497('0x20')));_0x14cecb[_0x5497('0x8')](_0x5497('0x21'),require(_0x5497('0x22')));_0x14cecb[_0x5497('0x8')](_0x5497('0x23'),require(_0x5497('0x24')));_0x14cecb[_0x5497('0x8')](_0x5497('0x25'),require('./api/mailQueue'));_0x14cecb[_0x5497('0x8')]('/api/mail/substatuses',require(_0x5497('0x26')));_0x14cecb[_0x5497('0x8')](_0x5497('0x27'),require(_0x5497('0x28')));_0x14cecb[_0x5497('0x8')](_0x5497('0x29'),require('./api/mailMessage'));_0x14cecb['use'](_0x5497('0x2a'),require(_0x5497('0x2b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x2c'),require('./api/mailQueueReport'));_0x14cecb[_0x5497('0x8')]('/api/dashboards',require(_0x5497('0x2d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x2e'),require(_0x5497('0x2f')));_0x14cecb[_0x5497('0x8')](_0x5497('0x30'),require('./api/faxAccount'));_0x14cecb[_0x5497('0x8')]('/api/fax/applications',require('./api/faxApplication'));_0x14cecb['use'](_0x5497('0x31'),require('./api/faxInteraction'));_0x14cecb['use'](_0x5497('0x32'),require(_0x5497('0x33')));_0x14cecb[_0x5497('0x8')]('/api/fax/queues',require('./api/faxQueue'));_0x14cecb['use'](_0x5497('0x34'),require(_0x5497('0x35')));_0x14cecb[_0x5497('0x8')]('/api/sms/accounts',require('./api/smsAccount'));_0x14cecb['use'](_0x5497('0x36'),require('./api/smsApplication'));_0x14cecb[_0x5497('0x8')](_0x5497('0x37'),require(_0x5497('0x38')));_0x14cecb['use'](_0x5497('0x39'),require(_0x5497('0x3a')));_0x14cecb['use'](_0x5497('0x3b'),require(_0x5497('0x3c')));_0x14cecb[_0x5497('0x8')]('/api/openchannel/accounts',require(_0x5497('0x3d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x3e'),require(_0x5497('0x3f')));_0x14cecb[_0x5497('0x8')]('/api/openchannel/interactions',require(_0x5497('0x40')));_0x14cecb[_0x5497('0x8')]('/api/openchannel/messages',require(_0x5497('0x41')));_0x14cecb[_0x5497('0x8')](_0x5497('0x42'),require(_0x5497('0x43')));_0x14cecb[_0x5497('0x8')](_0x5497('0x44'),require('./api/chatWebsite'));_0x14cecb[_0x5497('0x8')]('/api/openchannel/reports/queue',require(_0x5497('0x45')));_0x14cecb[_0x5497('0x8')](_0x5497('0x46'),require('./api/chatApplication'));_0x14cecb['use'](_0x5497('0x47'),require(_0x5497('0x48')));_0x14cecb[_0x5497('0x8')](_0x5497('0x49'),require(_0x5497('0x4a')));_0x14cecb[_0x5497('0x8')]('/api/chat/offline_messages',require(_0x5497('0x4b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x4c'),require(_0x5497('0x4d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x4e'),require(_0x5497('0x4f')));_0x14cecb[_0x5497('0x8')](_0x5497('0x50'),require('./api/chatProactiveAction'));_0x14cecb[_0x5497('0x8')](_0x5497('0x51'),require(_0x5497('0x52')));_0x14cecb[_0x5497('0x8')](_0x5497('0x53'),require(_0x5497('0x54')));_0x14cecb[_0x5497('0x8')]('/api/cm/hopper',require(_0x5497('0x55')));_0x14cecb[_0x5497('0x8')](_0x5497('0x56'),require(_0x5497('0x57')));_0x14cecb[_0x5497('0x8')](_0x5497('0x58'),require(_0x5497('0x59')));_0x14cecb['use'](_0x5497('0x5a'),require(_0x5497('0x5b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x5c'),require(_0x5497('0x5d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x5e'),require(_0x5497('0x5f')));_0x14cecb[_0x5497('0x8')](_0x5497('0x60'),require('./api/automation'));_0x14cecb[_0x5497('0x8')]('/api/canned_answers',require(_0x5497('0x61')));_0x14cecb[_0x5497('0x8')](_0x5497('0x62'),require(_0x5497('0x63')));_0x14cecb[_0x5497('0x8')]('/api/conditions',require(_0x5497('0x64')));_0x14cecb[_0x5497('0x8')]('/api/intervals',require(_0x5497('0x65')));_0x14cecb['use'](_0x5497('0x66'),require('./api/pause'));_0x14cecb[_0x5497('0x8')](_0x5497('0x67'),require(_0x5497('0x68')));_0x14cecb[_0x5497('0x8')](_0x5497('0x69'),require('./api/voiceQueuesLog'));_0x14cecb['use']('/api/schedules',require('./api/schedule'));_0x14cecb[_0x5497('0x8')](_0x5497('0x6a'),require(_0x5497('0x6b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x6c'),require(_0x5497('0x6d')));_0x14cecb[_0x5497('0x8')](_0x5497('0x6e'),require(_0x5497('0x6f')));_0x14cecb['use'](_0x5497('0x70'),require(_0x5497('0x71')));_0x14cecb[_0x5497('0x8')]('/api/cm_hopper_additional_phones',require(_0x5497('0x72')));_0x14cecb['use'](_0x5497('0x73'),require(_0x5497('0x74')));_0x14cecb[_0x5497('0x8')]('/api/triggers',require(_0x5497('0x75')));_0x14cecb[_0x5497('0x8')]('/api/variables',require(_0x5497('0x76')));_0x14cecb['use'](_0x5497('0x77'),require('./api/integration'));_0x14cecb[_0x5497('0x8')](_0x5497('0x78'),require(_0x5497('0x79')));_0x14cecb[_0x5497('0x8')](_0x5497('0x7a'),require(_0x5497('0x7b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x7c'),require('./api/analyticDefaultReport'));_0x14cecb[_0x5497('0x8')]('/api/analytics/extracted_reports',require('./api/analyticExtractedReport'));_0x14cecb[_0x5497('0x8')](_0x5497('0x7d'),require('./api/analyticMetric'));_0x14cecb[_0x5497('0x8')](_0x5497('0x7e'),require(_0x5497('0x7f')));_0x14cecb[_0x5497('0x8')]('/api/analytics/tree_reports',require(_0x5497('0x80')));_0x14cecb['use']('/api/integrations/salesforce/accounts',require(_0x5497('0x81')));_0x14cecb[_0x5497('0x8')](_0x5497('0x82'),require('./api/intSalesforceConfiguration'));_0x14cecb['use'](_0x5497('0x83'),require('./api/intSalesforceField'));_0x14cecb[_0x5497('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x5497('0x84')));_0x14cecb['use'](_0x5497('0x85'),require(_0x5497('0x86')));_0x14cecb['use'](_0x5497('0x87'),require('./api/intSugarcrmField'));_0x14cecb['use'](_0x5497('0x88'),require(_0x5497('0x89')));_0x14cecb['use'](_0x5497('0x8a'),require(_0x5497('0x8b')));_0x14cecb[_0x5497('0x8')](_0x5497('0x8c'),require(_0x5497('0x8d')));_0x14cecb[_0x5497('0x8')]('/api/integrations/zoho/accounts',require(_0x5497('0x8e')));_0x14cecb['use']('/api/integrations/zoho/configurations',require('./api/intZohoConfiguration'));_0x14cecb[_0x5497('0x8')](_0x5497('0x8f'),require(_0x5497('0x90')));_0x14cecb['use'](_0x5497('0x91'),require('./api/intZendeskAccount'));_0x14cecb['use'](_0x5497('0x92'),require(_0x5497('0x93')));_0x14cecb[_0x5497('0x8')](_0x5497('0x94'),require(_0x5497('0x95')));_0x14cecb[_0x5497('0x8')]('/api/integrations/freshdesk/accounts',require(_0x5497('0x96')));_0x14cecb[_0x5497('0x8')](_0x5497('0x97'),require(_0x5497('0x98')));_0x14cecb['use'](_0x5497('0x99'),require(_0x5497('0x9a')));_0x14cecb[_0x5497('0x8')](_0x5497('0x9b'),require('./api/intVtigerAccount'));_0x14cecb[_0x5497('0x8')](_0x5497('0x9c'),require(_0x5497('0x9d')));_0x14cecb['use'](_0x5497('0x9e'),require('./api/intVtigerField'));_0x14cecb['use']('/api/integrations/servicenow/accounts',require(_0x5497('0x9f')));_0x14cecb[_0x5497('0x8')](_0x5497('0xa0'),require('./api/intServicenowConfiguration'));_0x14cecb[_0x5497('0x8')](_0x5497('0xa1'),require(_0x5497('0xa2')));_0x14cecb[_0x5497('0x8')]('/api/integrations/dynamics365/accounts',require(_0x5497('0xa3')));_0x14cecb[_0x5497('0x8')](_0x5497('0xa4'),require('./api/intDynamics365Configuration'));_0x14cecb[_0x5497('0x8')](_0x5497('0xa5'),require(_0x5497('0xa6')));_0x14cecb[_0x5497('0x8')](_0x5497('0xa7'),require(_0x5497('0xa8')));_0x14cecb[_0x5497('0x8')]('/api/integrations/freshsales/configurations',require(_0x5497('0xa9')));_0x14cecb[_0x5497('0x8')](_0x5497('0xaa'),require(_0x5497('0xab')));_0x14cecb['use']('/api/networks',require('./api/network'));_0x14cecb[_0x5497('0x8')](_0x5497('0xac'),require(_0x5497('0xad')));_0x14cecb['use'](_0x5497('0xae'),require(_0x5497('0xaf')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb0'),require(_0x5497('0xb1')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb2'),require(_0x5497('0xb3')));_0x14cecb[_0x5497('0x8')](_0x5497('0xb4'),require(_0x5497('0xb5')));_0x14cecb['use'](_0x5497('0xb6'),require(_0x5497('0xb7')));_0x14cecb[_0x5497('0x8')]('/api/square/reports',require(_0x5497('0xb8')));_0x14cecb['use'](_0x5497('0xb9'),require(_0x5497('0xba')));_0x14cecb['use'](_0x5497('0xbb'),require(_0x5497('0xbc')));_0x14cecb[_0x5497('0x8')](_0x5497('0xbd'),require('./api/setting'));_0x14cecb[_0x5497('0x8')](_0x5497('0xbe'),require(_0x5497('0xbf')));_0x14cecb['use'](_0x5497('0xc0'),require(_0x5497('0xc1')));_0x14cecb['use'](_0x5497('0xc2'),require(_0x5497('0xc3')));_0x14cecb[_0x5497('0x8')]('/api/square/messages',require('./api/squareMessage'));_0x14cecb[_0x5497('0x8')](_0x5497('0xc4'),require(_0x5497('0xc5')));_0x14cecb[_0x5497('0x8')](_0x5497('0xc6'),require(_0x5497('0xc7')));_0x14cecb[_0x5497('0x8')]('/api/campaigns',require('./api/campaign'));_0x14cecb[_0x5497('0x8')](_0x5497('0xc8'),require('./api/migration'));_0x14cecb[_0x5497('0x8')](_0x5497('0xc9'),require(_0x5497('0xca')));_0x14cecb['use'](_0x5497('0xcb'),require(_0x5497('0xcc')));_0x14cecb['use'](_0x5497('0xcd'),require(_0x5497('0xce')));_0x14cecb[_0x5497('0x8')](_0x5497('0xcf'),require(_0x5497('0xd0')));_0x14cecb['use'](_0x5497('0xd1'),require(_0x5497('0xd2')));_0x14cecb[_0x5497('0x8')](_0x5497('0xd3'),require(_0x5497('0xd4')));_0x14cecb['use'](_0x5497('0xd5'),require(_0x5497('0xd6')));_0x14cecb[_0x5497('0x8')](_0x5497('0xd7'),require('./api/cmList'));_0x14cecb[_0x5497('0x8')](_0x5497('0xd8'),require('./api/voicePrefix'));_0x14cecb[_0x5497('0x8')](_0x5497('0xd9'),require(_0x5497('0xda')));_0x14cecb[_0x5497('0x8')]('/api/userProfile/sections',require('./api/userProfileSection'));_0x14cecb['use']('/api/userProfile/resources',require('./api/userProfileResource'));_0x14cecb[_0x5497('0x8')](_0x5497('0xdb'),require(_0x5497('0xdc')));_0x14cecb[_0x5497('0x8')](_0x5497('0xdd'),require('./api/whatsappAccount'));_0x14cecb['use'](_0x5497('0xde'),require(_0x5497('0xdf')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe0'),require(_0x5497('0xe1')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe2'),require(_0x5497('0xe3')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe4'),require('./api/whatsappQueueReport'));_0x14cecb[_0x5497('0x8')](_0x5497('0xe5'),require(_0x5497('0xe6')));_0x14cecb[_0x5497('0x8')](_0x5497('0xe7'),require(_0x5497('0xe8')));_0x14cecb['use'](_0x5497('0xe9'),require('./api/cloudProvider'));_0x14cecb[_0x5497('0x8')](_0x5497('0xea'),require(_0x5497('0xeb')));_0x14cecb['use']('/api/user-settings',require(_0x5497('0xec')));_0x14cecb[_0x5497('0x8')](_0x5497('0xed'),require(_0x5497('0xee')));_0x14cecb[_0x5497('0x8')](_0x5497('0xef'),require(_0x5497('0xf0')));_0x14cecb[_0x5497('0x8')]('/api/auth/google',require('./api/authGoogle'));_0x14cecb['use'](_0x5497('0xf1'),require(_0x5497('0xf2')));_0x14cecb[_0x5497('0x8')](_0x5497('0xf3'),require('./api/jira'));_0x14cecb['use'](_0x5497('0xf4'),require(_0x5497('0xf5')));_0x14cecb['use'](_0x5497('0xf6'),require(_0x5497('0xf7')));_0x14cecb[_0x5497('0x8')](_0x5497('0xf8'),require('./api/system'));_0x14cecb['use']('/api/pm2',require('./api/pm2'));_0x14cecb['use'](_0x5497('0xf9'),require('./api/webbar'));_0x14cecb[_0x5497('0x8')]('/api/logs',clientSideLogs);_0x14cecb[_0x5497('0x8')](_0x5497('0xfa'),express[_0x5497('0xfb')](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0xfa'))));_0x14cecb['use'](_0x5497('0xfe'),express['static'](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0xfe'))));_0x14cecb[_0x5497('0x8')](_0x5497('0xff'),express[_0x5497('0xfb')](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0xff'))));_0x14cecb[_0x5497('0x8')]('/snippet',express[_0x5497('0xfb')](path['join'](config[_0x5497('0xfd')],_0x5497('0x100'),'3.13.0')));_0x14cecb[_0x5497('0x8')](_0x5497('0x101'),express[_0x5497('0xfb')](path[_0x5497('0xfc')](config[_0x5497('0xfd')],_0x5497('0x102'))));_0x14cecb[_0x5497('0x103')](_0x5497('0x104'))[_0x5497('0x105')](errors[0x194]);_0x14cecb[_0x5497('0x103')]('/*')[_0x5497('0x105')](function(_0x926bc1,_0x38d9fe){_0x38d9fe[_0x5497('0x106')](path['resolve'](_0x14cecb[_0x5497('0x105')](_0x5497('0x107'))+_0x5497('0x108')));});return _0x14cecb;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 6a1f7e5..953c864 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6d19=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','jayson/promise','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x6d19,0x160));var _0x96d1=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x6d19[_0x45d55e];return _0x29812a;};'use strict';var jayson=require(_0x96d1('0x0'));var _=require(_0x96d1('0x1'));var config=require(_0x96d1('0x2'));exports[_0x96d1('0x3')]=function(){return new Promise(function(_0x874fcb,_0x31518c){var _0x36405d={};_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x4')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x6')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/voiceQueue/voiceQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x7')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x8')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x9')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xa')));_0x36405d=_['merge'](_0x36405d,require('../api/memberReport/memberReport.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xb')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0xc')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0xd')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xe')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0xf')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/mailQueue/mailQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x10')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x11')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/mailApplication/mailApplication.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x12')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x13')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x14')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x15')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x16')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x17')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x18')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x19')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x1a')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1b')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/smsQueue/smsQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1c')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1d')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x1e')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x1f')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x20')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x21')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/chatQueue/chatQueue.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x22')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/cmHopper/cmHopper.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x23')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x24')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x25')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x26')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x27')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x28')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x29')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2a')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2b')));_0x36405d=_['merge'](_0x36405d,require('../api/variable/variable.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2c')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2d')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x2e')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x2f')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x30')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x31')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x32')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x33')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x34')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x35')));_0x36405d=_['merge'](_0x36405d,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x36')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x37')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x38')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x39')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3a')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3b')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/squareMessage/squareMessage.rpc'));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3c')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3d')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x3e')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require('../api/whatsappAccount/whatsappAccount.rpc'));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x3f')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x40')));_0x36405d=_[_0x96d1('0x5')](_0x36405d,require(_0x96d1('0x41')));_0x36405d=_['merge'](_0x36405d,require(_0x96d1('0x42')));var _0x4110ce=jayson['server'](_0x36405d)[_0x96d1('0x43')]();var _0x26439c=config[_0x96d1('0x44')][_0x96d1('0x45')]||config['port']+0x1;var _0x192099=config['rpc']['ip']||'localhost';_0x4110ce['on'](_0x96d1('0x46'),function(_0x3e10f3){return _0x31518c(_0x3e10f3);});_0x4110ce['listen'](_0x26439c,_0x192099,function(){console['log'](_0x96d1('0x47'),_0x192099,_0x26439c);require('../config/triggers')[_0x96d1('0x48')]();return _0x874fcb('RPC\x20listening\x20on\x20'+_0x192099+':'+_0x26439c);});});}; \ No newline at end of file +var _0x80aa=['../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','../config/environment','listen','../api/user/user.rpc','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x80aa,0x1ec));var _0xa80a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x80aa[_0x14add3];return _0x4a174f;};'use strict';var jayson=require('jayson/promise');var _=require(_0xa80a('0x0'));var config=require(_0xa80a('0x1'));exports[_0xa80a('0x2')]=function(){return new Promise(function(_0x3f0702,_0x511cd3){var _0xb8e2db={};_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x3')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x5')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/voiceQueue/voiceQueue.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x6')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x7')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x8')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x9')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/voiceQueueReport/voiceQueueReport.rpc'));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/memberReport/memberReport.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xa')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xb')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xc')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xd')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0xe')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0xf')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x10')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x11')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x12')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x13')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/faxAccount/faxAccount.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/faxApplication/faxApplication.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x14')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x15')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x16')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x17')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x18')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x19')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1a')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1b')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1c')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1d')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1e')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x1f')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x20')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/chatInteraction/chatInteraction.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x21')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/chatQueue/chatQueue.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x22')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x23')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x24')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x25')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x26')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x27')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x28')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x29')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x2a')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x2b')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2c')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2d')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2e')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x2f')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x30')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x31')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x32')));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x33')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/intServicenowAccount/intServicenowAccount.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x34')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x35')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x36')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/squareReport/squareReport.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/squareReportDetail/squareReportDetail.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/setting/setting.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x37')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x38')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x39')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3a')));_0xb8e2db=_['merge'](_0xb8e2db,require('../api/campaign/campaign.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3b')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/plugin/plugin.rpc'));_0xb8e2db=_['merge'](_0xb8e2db,require(_0xa80a('0x3c')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require('../api/whatsappInteraction/whatsappInteraction.rpc'));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3d')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3e')));_0xb8e2db=_[_0xa80a('0x4')](_0xb8e2db,require(_0xa80a('0x3f')));var _0x5b9a40=jayson[_0xa80a('0x40')](_0xb8e2db)[_0xa80a('0x41')]();var _0x566f57=config[_0xa80a('0x42')][_0xa80a('0x43')]||config[_0xa80a('0x43')]+0x1;var _0x2e2596=config[_0xa80a('0x42')]['ip']||_0xa80a('0x44');_0x5b9a40['on']('error',function(_0x36e104){return _0x511cd3(_0x36e104);});_0x5b9a40[_0xa80a('0x2')](_0x566f57,_0x2e2596,function(){console['log'](_0xa80a('0x45'),_0x2e2596,_0x566f57);require(_0xa80a('0x46'))['default']();return _0x3f0702(_0xa80a('0x47')+_0x2e2596+':'+_0x566f57);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 78e7600..599cf1d 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 _0xb9f4=['wav','BEEP','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','lodash','EventEmitter','call','setEncoding','utf8','setTimeout','headers','ready','line','toLowerCase','hangup','emit','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','split','length','error','E_AGI_SOCKET_ERROR','code','close','timeout','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile'];(function(_0x404bda,_0x1c2365){var _0x4b5a6e=function(_0xe9ec47){while(--_0xe9ec47){_0x404bda['push'](_0x404bda['shift']());}};_0x4b5a6e(++_0x1c2365);}(_0xb9f4,0xf4));var _0x4b9f=function(_0x5eacc3,_0x2ef066){_0x5eacc3=_0x5eacc3-0x0;var _0x410cfa=_0xb9f4[_0x5eacc3];return _0x410cfa;};'use strict';var util=require('util');var _=require(_0x4b9f('0x0'));var EventEmitter=require('events')[_0x4b9f('0x1')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x4372ef){var _0x5bad5c=this,_0x34ae00=new AGIReply(),_0x1df6ea=![],_0x51f5aa={};EventEmitter[_0x4b9f('0x2')](_0x5bad5c);_0x4372ef[_0x4b9f('0x3')](_0x4b9f('0x4'));_0x4372ef[_0x4b9f('0x5')](0x8*0x3c*0x3c*0x3e8);_0x34ae00[_0x4b9f('0x3')](_0x4b9f('0x4'));_0x34ae00['on'](_0x4b9f('0x6'),function(_0x395cec){for(var _0x34c8ed in _0x395cec){_0x5bad5c[_0x34c8ed]=_0x395cec[_0x34c8ed];}_0x5bad5c['emit'](_0x4b9f('0x7'));});_0x34ae00['on'](_0x4b9f('0x8'),function(_0x32b87d){if(_0x32b87d[_0x4b9f('0x9')]()==_0x4b9f('0xa')){_0x5bad5c[_0x4b9f('0xb')]('hangup');return;}if(_0x32b87d[_0x4b9f('0xc')](0x0,0xb)==_0x4b9f('0xd')){_0x1df6ea=!![];}if(_0x1df6ea){_0x51f5aa['rx']+=_0x32b87d+'\x0a';if(_0x32b87d[_0x4b9f('0xe')](_0x4b9f('0xf'))!=-0x1){_0x1df6ea=![];}}else{_0x51f5aa['rx']=_0x32b87d;}if(_0x1df6ea){return;}if(typeof _0x51f5aa['cb']==_0x4b9f('0x10')){var _0x3c51ae=_0x51f5aa['rx'][_0x4b9f('0xc')](0x0,0x3),_0x171e52=null,_0xf5f1cd=null;_0x3c51ae=parseInt(_0x3c51ae);if(isNaN(_0x3c51ae)){_0x51f5aa['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x4b9f('0x11')});return;}if(_0x3c51ae!=0xc8){_0x51f5aa['cb'](null,{'code':_0x3c51ae,'result':-0x1,'extra':'KO'});return;}_0x171e52=_0x51f5aa['rx'][_0x4b9f('0xc')](0x4)[_0x4b9f('0x12')]('result=','');if(_0x171e52[_0x4b9f('0x13')]('\x20')!=-0x1){_0x171e52=_0x171e52['substr'](0x0,_0x171e52[_0x4b9f('0x13')]('\x20'));}if(_[_0x4b9f('0x14')](_0x171e52,'-1')){_0x171e52=parseInt(_0x171e52);}_0xf5f1cd=_0x51f5aa['rx'][_0x4b9f('0x15')]('\x20');if(_0xf5f1cd[_0x4b9f('0x16')]==0x3){_0xf5f1cd=_0xf5f1cd[0x2][_0x4b9f('0xc')](0x1,_0xf5f1cd[0x2][_0x4b9f('0x16')]-0x1);}else if(_0xf5f1cd['length']>0x3){var _0x4b2e8b=/\((.+)\)/;var _0x354e26=_0x51f5aa['rx']['match'](_0x4b2e8b);if(_0x354e26){_0xf5f1cd=_0x354e26[0x1];}else{_0xf5f1cd=null;}}else{_0xf5f1cd=null;}_0x51f5aa['cb'](null,{'code':_0x3c51ae,'result':_0x171e52,'extra':_0xf5f1cd});}});_0x4372ef['on']('error',function(_0x1d3856){_0x5bad5c['emit'](_0x4b9f('0x17'),new AGIError(_0x4b9f('0x18'),_0x1d3856[_0x4b9f('0x19')]));});_0x4372ef['on'](_0x4b9f('0x1a'),function(){_0x5bad5c[_0x4b9f('0xb')](_0x4b9f('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4372ef['on'](_0x4b9f('0x1b'),function(){_0x5bad5c[_0x4b9f('0xb')](_0x4b9f('0x1b'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x4372ef[_0x4b9f('0x1c')]();});_0x4372ef[_0x4b9f('0x1d')](_0x34ae00);this[_0x4b9f('0x1e')]=function(_0x451cbb,_0x551227){var _0x451cbb=_0x451cbb||'',_0x551227=typeof _0x551227==_0x4b9f('0x10')?_0x551227:new Function();_0x51f5aa={'tx':_0x451cbb,'rx':'','cb':_0x551227};_0x4372ef[_0x4b9f('0x1f')](_0x451cbb+'\x0a');},this[_0x4b9f('0x1a')]=function(){_0x4372ef[_0x4b9f('0x1c')]();};}util[_0x4b9f('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x22')]=function(_0x1c6d92){return this[_0x4b9f('0x1e')][_0x4b9f('0x23')](this,_0x1c6d92);};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x24')]=function(){return this[_0x4b9f('0x22')](_0x4b9f('0x25'));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x26')]=function(_0x269a4a,_0x14f92c,_0xb5387d){_0x269a4a=_0x269a4a===undefined?_0x4b9f('0x27'):_0x269a4a;_0x14f92c=_0x14f92c===undefined?'5':_0x14f92c;_0xb5387d=_0xb5387d===undefined?'1':_0xb5387d;return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x29'),_0x269a4a,_0x14f92c*0x3e8,_0xb5387d));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x2a')]=function(_0x3958f8){_0x3958f8=_0x3958f8||_0x4b9f('0x2b');return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x2c'),_0x3958f8));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x2d')]=function(_0x350a41,_0x150241){if(_[_0x4b9f('0x2e')](_0x150241)){return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x2f'),_0x350a41,_0x150241[_0x4b9f('0x30')](',')));}return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x2f'),_0x350a41,_0x150241));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x31')]=function(_0x41b540){return this[_0x4b9f('0x22')](util['format'](_0x4b9f('0x32'),_0x41b540));};AGIChannel['prototype'][_0x4b9f('0x33')]=function(_0x124273){return this['sendRequest'](util['format'](_0x4b9f('0x34'),_0x124273));};AGIChannel['prototype'][_0x4b9f('0x35')]=function(_0x226fc3){return this[_0x4b9f('0x22')](util['format'](_0x4b9f('0x36'),_0x226fc3));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0xa')]=function(){return this[_0x4b9f('0x22')](_0x4b9f('0x37'));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x38')]=function(_0xee07a2,_0x56ebb9){var _0xafdaa3=_['isBoolean'](_0x56ebb9)||_[_0x4b9f('0x39')](_0x56ebb9)?_0x56ebb9[_0x4b9f('0x3a')]():_0x56ebb9;return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x3b'),_0xee07a2,_0xafdaa3?_0xafdaa3[_0x4b9f('0x3a')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x3c')]=function(_0x23d54e,_0x5b1824){return this['sendRequest'](util[_0x4b9f('0x28')](_0x4b9f('0x3d'),_0x23d54e,_0x5b1824));};AGIChannel[_0x4b9f('0x21')]['sayDigits']=function(_0x5eb388,_0x286be3){return this['sendRequest'](util[_0x4b9f('0x28')](_0x4b9f('0x3e'),_0x5eb388,_0x286be3));};AGIChannel['prototype']['sayPhonetic']=function(_0x3d98e,_0x411916){return this[_0x4b9f('0x22')](util[_0x4b9f('0x28')](_0x4b9f('0x3f'),_0x3d98e,_0x411916));};AGIChannel['prototype'][_0x4b9f('0x40')]=function(_0x1ee35f,_0x33536a,_0x4d53e2){_0x33536a=_0x33536a||this['extension'];_0x4d53e2=_0x4d53e2||0x1;this[_0x4b9f('0x31')](_0x1ee35f);this['setExtension'](_0x33536a);this[_0x4b9f('0x35')](_0x4d53e2);return this[_0x4b9f('0x2a')](util['format'](_0x4b9f('0x41'),_0x1ee35f,_0x33536a,_0x4d53e2));};AGIChannel[_0x4b9f('0x21')]['getVariable']=function(_0x39d35e){return this[_0x4b9f('0x22')](util['format'](_0x4b9f('0x42'),_0x39d35e));};AGIChannel[_0x4b9f('0x21')][_0x4b9f('0x43')]=function(_0x5669a4,_0x4a96ac,_0x1fa88d,_0x212d6e,_0x1ccab7,_0x5cef86){_0x4a96ac=_0x4a96ac||_0x4b9f('0x44');_0x1fa88d=_0x1fa88d||'';_0x212d6e=_0x212d6e===undefined?-0x1:_0x212d6e==='-1'?-0x1:_0x212d6e*0x3e8;_0x1ccab7=_0x1ccab7===undefined?'':'s='+_0x1ccab7;_0x5cef86=_0x5cef86?_0x4b9f('0x45'):'';return this['sendRequest'](util[_0x4b9f('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x5669a4,_0x4a96ac,_0x1fa88d,_0x212d6e,_0x5cef86,_0x1ccab7));};AGIChannel['prototype'][_0x4b9f('0x46')]=function(_0x98cc73,_0x1ad998){_0x1ad998=_0x1ad998||'';return this['sendRequest'](util[_0x4b9f('0x28')](_0x4b9f('0x47'),_0x98cc73,_0x1ad998));};AGIChannel[_0x4b9f('0x21')]['agi']=function(_0xd2c083){return this[_0x4b9f('0x2d')](_0x4b9f('0x48'),_0xd2c083);};AGIChannel['prototype'][_0x4b9f('0x49')]=function(_0x564ef7){return this[_0x4b9f('0x2d')](_0x4b9f('0x4a'),_0x564ef7);};AGIChannel['prototype'][_0x4b9f('0x17')]=function(_0x2f79ad,_0x165fc7){this[_0x4b9f('0x2a')](util[_0x4b9f('0x28')](_0x4b9f('0x4b'),_0x2f79ad['id'],_0x2f79ad[_0x4b9f('0x4c')],_0x165fc7));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4b9f('0x4d')]=AGIChannel; \ No newline at end of file +var _0x2f5e=['BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','exec','WAIT','label','exports','lodash','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','line','toLowerCase','hangup','520-Invalid','search','520\x20End\x20of\x20proper','function','substring','no\x20code','replace','result=','indexOf','substr','startsWith','length','error','E_AGI_SOCKET_ERROR','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','sendRequest','prototype','ANSWER','getData','beep','format','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','EXEC\x20%s\x20%s','join','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','toString','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','setContext','setExtension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav'];(function(_0x358393,_0x32a76d){var _0x3758e4=function(_0x108983){while(--_0x108983){_0x358393['push'](_0x358393['shift']());}};_0x3758e4(++_0x32a76d);}(_0x2f5e,0xe0));var _0xe2f5=function(_0x189c9e,_0x1c3b55){_0x189c9e=_0x189c9e-0x0;var _0x3f38ca=_0x2f5e[_0x189c9e];return _0x3f38ca;};'use strict';var util=require('util');var _=require(_0xe2f5('0x0'));var EventEmitter=require('events')['EventEmitter'];var AGIReply=require(_0xe2f5('0x1'));var AGIError=require(_0xe2f5('0x2'));function AGIChannel(_0x868bd0){var _0x30f212=this,_0x92ee5f=new AGIReply(),_0x51f475=![],_0x3ad654={};EventEmitter[_0xe2f5('0x3')](_0x30f212);_0x868bd0['setEncoding'](_0xe2f5('0x4'));_0x868bd0[_0xe2f5('0x5')](0x8*0x3c*0x3c*0x3e8);_0x92ee5f[_0xe2f5('0x6')]('utf8');_0x92ee5f['on'](_0xe2f5('0x7'),function(_0x2562a3){for(var _0x49edc0 in _0x2562a3){_0x30f212[_0x49edc0]=_0x2562a3[_0x49edc0];}_0x30f212[_0xe2f5('0x8')](_0xe2f5('0x9'));});_0x92ee5f['on'](_0xe2f5('0xa'),function(_0x5f060b){if(_0x5f060b[_0xe2f5('0xb')]()==_0xe2f5('0xc')){_0x30f212[_0xe2f5('0x8')](_0xe2f5('0xc'));return;}if(_0x5f060b['substring'](0x0,0xb)==_0xe2f5('0xd')){_0x51f475=!![];}if(_0x51f475){_0x3ad654['rx']+=_0x5f060b+'\x0a';if(_0x5f060b[_0xe2f5('0xe')](_0xe2f5('0xf'))!=-0x1){_0x51f475=![];}}else{_0x3ad654['rx']=_0x5f060b;}if(_0x51f475){return;}if(typeof _0x3ad654['cb']==_0xe2f5('0x10')){var _0x24ccca=_0x3ad654['rx'][_0xe2f5('0x11')](0x0,0x3),_0x80ba59=null,_0x5bf4c1=null;_0x24ccca=parseInt(_0x24ccca);if(isNaN(_0x24ccca)){_0x3ad654['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe2f5('0x12')});return;}if(_0x24ccca!=0xc8){_0x3ad654['cb'](null,{'code':_0x24ccca,'result':-0x1,'extra':'KO'});return;}_0x80ba59=_0x3ad654['rx']['substring'](0x4)[_0xe2f5('0x13')](_0xe2f5('0x14'),'');if(_0x80ba59[_0xe2f5('0x15')]('\x20')!=-0x1){_0x80ba59=_0x80ba59[_0xe2f5('0x16')](0x0,_0x80ba59[_0xe2f5('0x15')]('\x20'));}if(_[_0xe2f5('0x17')](_0x80ba59,'-1')){_0x80ba59=parseInt(_0x80ba59);}_0x5bf4c1=_0x3ad654['rx']['split']('\x20');if(_0x5bf4c1[_0xe2f5('0x18')]==0x3){_0x5bf4c1=_0x5bf4c1[0x2][_0xe2f5('0x11')](0x1,_0x5bf4c1[0x2][_0xe2f5('0x18')]-0x1);}else if(_0x5bf4c1['length']>0x3){var _0x4c3824=/\((.+)\)/;var _0x1da730=_0x3ad654['rx']['match'](_0x4c3824);if(_0x1da730){_0x5bf4c1=_0x1da730[0x1];}else{_0x5bf4c1=null;}}else{_0x5bf4c1=null;}_0x3ad654['cb'](null,{'code':_0x24ccca,'result':_0x80ba59,'extra':_0x5bf4c1});}});_0x868bd0['on'](_0xe2f5('0x19'),function(_0x56ab1c){_0x30f212[_0xe2f5('0x8')](_0xe2f5('0x19'),new AGIError(_0xe2f5('0x1a'),_0x56ab1c['code']));});_0x868bd0['on'](_0xe2f5('0x1b'),function(){_0x30f212[_0xe2f5('0x8')](_0xe2f5('0x1b'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x868bd0['on'](_0xe2f5('0x1c'),function(){_0x30f212['emit'](_0xe2f5('0x1c'),new AGIError(_0xe2f5('0x1d')));_0x868bd0[_0xe2f5('0x1e')]();});_0x868bd0['pipe'](_0x92ee5f);this[_0xe2f5('0x1f')]=function(_0xc56a88,_0xd31609){var _0xc56a88=_0xc56a88||'',_0xd31609=typeof _0xd31609==_0xe2f5('0x10')?_0xd31609:new Function();_0x3ad654={'tx':_0xc56a88,'rx':'','cb':_0xd31609};_0x868bd0[_0xe2f5('0x20')](_0xc56a88+'\x0a');},this['close']=function(){_0x868bd0[_0xe2f5('0x1e')]();};}util[_0xe2f5('0x21')](AGIChannel,EventEmitter);AGIChannel['prototype'][_0xe2f5('0x22')]=function(_0x583fe6){return this[_0xe2f5('0x1f')]['sync'](this,_0x583fe6);};AGIChannel[_0xe2f5('0x23')]['answer']=function(){return this[_0xe2f5('0x22')](_0xe2f5('0x24'));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x25')]=function(_0xd8dac4,_0x3b956d,_0x222e21){_0xd8dac4=_0xd8dac4===undefined?_0xe2f5('0x26'):_0xd8dac4;_0x3b956d=_0x3b956d===undefined?'5':_0x3b956d;_0x222e21=_0x222e21===undefined?'1':_0x222e21;return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('GET\x20DATA\x20\x22%s\x22\x20%s\x20%s',_0xd8dac4,_0x3b956d*0x3e8,_0x222e21));};AGIChannel['prototype'][_0xe2f5('0x28')]=function(_0x4d666d){_0x4d666d=_0x4d666d||_0xe2f5('0x29');return this[_0xe2f5('0x22')](util['format'](_0xe2f5('0x2a'),_0x4d666d));};AGIChannel[_0xe2f5('0x23')]['exec']=function(_0x5c7f28,_0x2af100){if(_['isArray'](_0x2af100)){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')](_0xe2f5('0x2b'),_0x5c7f28,_0x2af100[_0xe2f5('0x2c')](',')));}return this['sendRequest'](util[_0xe2f5('0x27')]('EXEC\x20%s\x20%s',_0x5c7f28,_0x2af100));};AGIChannel[_0xe2f5('0x23')]['setContext']=function(_0x54e89a){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SET\x20CONTEXT\x20%s',_0x54e89a));};AGIChannel[_0xe2f5('0x23')]['setExtension']=function(_0x89a5ec){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SET\x20EXTENSION\x20%s',_0x89a5ec));};AGIChannel[_0xe2f5('0x23')]['setPriority']=function(_0x497384){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')](_0xe2f5('0x2d'),_0x497384));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0xc')]=function(){return this[_0xe2f5('0x22')](_0xe2f5('0x2e'));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x2f')]=function(_0x29c588,_0x40c661){var _0x5f6c81=_[_0xe2f5('0x30')](_0x40c661)||_['isNumber'](_0x40c661)?_0x40c661[_0xe2f5('0x31')]():_0x40c661;return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x29c588,_0x5f6c81?_0x5f6c81[_0xe2f5('0x31')]()[_0xe2f5('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x32')]=function(_0xd52970,_0x21c7ce){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0xd52970,_0x21c7ce));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x33')]=function(_0x43fbff,_0x1cbacf){return this[_0xe2f5('0x22')](util['format'](_0xe2f5('0x34'),_0x43fbff,_0x1cbacf));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x35')]=function(_0x59df8f,_0x3701d9){return this[_0xe2f5('0x22')](util[_0xe2f5('0x27')](_0xe2f5('0x36'),_0x59df8f,_0x3701d9));};AGIChannel['prototype'][_0xe2f5('0x37')]=function(_0x55d3f3,_0x340e33,_0x548a09){_0x340e33=_0x340e33||this['extension'];_0x548a09=_0x548a09||0x1;this[_0xe2f5('0x38')](_0x55d3f3);this[_0xe2f5('0x39')](_0x340e33);this[_0xe2f5('0x3a')](_0x548a09);return this[_0xe2f5('0x28')](util[_0xe2f5('0x27')](_0xe2f5('0x3b'),_0x55d3f3,_0x340e33,_0x548a09));};AGIChannel['prototype'][_0xe2f5('0x3c')]=function(_0x3628be){return this['sendRequest'](util[_0xe2f5('0x27')](_0xe2f5('0x3d'),_0x3628be));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x3e')]=function(_0x359357,_0x52efa8,_0x1a1dd2,_0x1f7c15,_0x38e108,_0x2bc4b9){_0x52efa8=_0x52efa8||_0xe2f5('0x3f');_0x1a1dd2=_0x1a1dd2||'';_0x1f7c15=_0x1f7c15===undefined?-0x1:_0x1f7c15==='-1'?-0x1:_0x1f7c15*0x3e8;_0x38e108=_0x38e108===undefined?'':'s='+_0x38e108;_0x2bc4b9=_0x2bc4b9?_0xe2f5('0x40'):'';return this['sendRequest'](util[_0xe2f5('0x27')](_0xe2f5('0x41'),_0x359357,_0x52efa8,_0x1a1dd2,_0x1f7c15,_0x2bc4b9,_0x38e108));};AGIChannel[_0xe2f5('0x23')]['streamFile']=function(_0x121ac5,_0x49c332){_0x49c332=_0x49c332||'';return this[_0xe2f5('0x22')](util['format'](_0xe2f5('0x42'),_0x121ac5,_0x49c332));};AGIChannel[_0xe2f5('0x23')][_0xe2f5('0x43')]=function(_0x16881e){return this[_0xe2f5('0x44')]('AGI',_0x16881e);};AGIChannel[_0xe2f5('0x23')]['wait']=function(_0x45bbae){return this[_0xe2f5('0x44')](_0xe2f5('0x45'),_0x45bbae);};AGIChannel[_0xe2f5('0x23')]['error']=function(_0x406bf7,_0x5c19b5){this[_0xe2f5('0x28')](util[_0xe2f5('0x27')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x406bf7['id'],_0x406bf7[_0xe2f5('0x46')],_0x5c19b5));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe2f5('0x47')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index a244591..bcf18f7 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 _0xcb10=['name','exports','util','Undefined\x20error.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x4e7fa9,_0x29d247){var _0x401f9e=function(_0x2f6a12){while(--_0x2f6a12){_0x4e7fa9['push'](_0x4e7fa9['shift']());}};_0x401f9e(++_0x29d247);}(_0xcb10,0x1a6));var _0x0cb1=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xcb10[_0x13d07a];return _0x5ee0ee;};'use strict';var util=require(_0x0cb1('0x0'));var error={'E_AGI_UNDEFINED':_0x0cb1('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x0cb1('0x2'),'E_AGI_SERVER_CLOSE':_0x0cb1('0x3'),'E_AGI_SERVER_MAXCONNECTION':_0x0cb1('0x4'),'E_AGI_SERVER_VOICE_DISABLED':_0x0cb1('0x5'),'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':_0x0cb1('0x6'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0cb1('0x7')};function AGIError(_0x1efaac){var _0x1efaac=_0x1efaac||null,_0x747a90=_0x747a90||[],_0x4df5ad=0x1,_0x4b5af5='';if(!error[_0x1efaac]){_0x1efaac=_0x0cb1('0x8');}_0x747a90[_0x0cb1('0x9')](error[_0x1efaac]);while(arguments[_0x4df5ad]){_0x747a90[_0x0cb1('0x9')](arguments[_0x4df5ad]);_0x4df5ad++;}_0x4b5af5=util[_0x0cb1('0xa')][_0x0cb1('0xb')](util,_0x747a90);this[_0x0cb1('0xc')]=_0x4b5af5;this[_0x0cb1('0xd')]=_0x1efaac;}module[_0x0cb1('0xe')]=AGIError; \ No newline at end of file +var _0x6c57=['message','name','exports','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply'];(function(_0x3ab6e8,_0x1eaeb6){var _0x54186f=function(_0x290fac){while(--_0x290fac){_0x3ab6e8['push'](_0x3ab6e8['shift']());}};_0x54186f(++_0x1eaeb6);}(_0x6c57,0xc6));var _0x76c5=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x6c57[_0x5c351c];return _0x26f3b3;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0x76c5('0x0'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x76c5('0x1'),'E_AGI_SERVER_MAXCONNECTION':_0x76c5('0x2'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0x76c5('0x3'),'E_AGI_SOCKET_TIMEOUT':_0x76c5('0x4'),'E_AGI_COMMAND_EMPTY':_0x76c5('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x76c5('0x6'),'E_AGI_IVR_ENTRY':_0x76c5('0x7')};function AGIError(_0x425f3d){var _0x425f3d=_0x425f3d||null,_0x3cde66=_0x3cde66||[],_0x273b99=0x1,_0x9d5fc3='';if(!error[_0x425f3d]){_0x425f3d=_0x76c5('0x8');}_0x3cde66[_0x76c5('0x9')](error[_0x425f3d]);while(arguments[_0x273b99]){_0x3cde66[_0x76c5('0x9')](arguments[_0x273b99]);_0x273b99++;}_0x9d5fc3=util[_0x76c5('0xa')][_0x76c5('0xb')](util,_0x3cde66);this[_0x76c5('0xc')]=_0x9d5fc3;this[_0x76c5('0xd')]=_0x425f3d;}module[_0x76c5('0xe')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 5d05c01..6ec0bb6 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 _0xdf01=['exports','lodash','events','EventEmitter','ioredis','./error','redis','defaults','localhost','subscribe','emit','error','E_AGI_SERVER_ERROR','message','parse'];(function(_0x3fc017,_0x288faf){var _0x542e8c=function(_0x42438c){while(--_0x42438c){_0x3fc017['push'](_0x3fc017['shift']());}};_0x542e8c(++_0x288faf);}(_0xdf01,0x1e1));var _0x1df0=function(_0x4c9a16,_0x253693){_0x4c9a16=_0x4c9a16-0x0;var _0x528969=_0xdf01[_0x4c9a16];return _0x528969;};'use strict';var _=require(_0x1df0('0x0'));var EventEmitter=require(_0x1df0('0x1'))[_0x1df0('0x2')];var Redis=require(_0x1df0('0x3'));var AGIError=require(_0x1df0('0x4'));var config=require('../../config/environment');config[_0x1df0('0x5')]=_[_0x1df0('0x6')](config[_0x1df0('0x5')],{'host':_0x1df0('0x7'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x1df0('0x5')]);sub[_0x1df0('0x8')]('agi',function(_0x6960d9){if(_0x6960d9)return eventEmitter[_0x1df0('0x9')](_0x1df0('0xa'),new AGIError(_0x1df0('0xb'),_0x6960d9));});sub['on'](_0x1df0('0xc'),function(_0x4de577,_0x55b47e){if(_0x4de577!=='agi')return;try{var _0x56d05e=JSON[_0x1df0('0xd')](_0x55b47e);eventEmitter['emit']('projectUpdate',_0x56d05e);}catch(_0x1eeda7){eventEmitter['emit'](_0x1df0('0xa'),new AGIError(_0x1df0('0xb'),_0x1eeda7));}});module[_0x1df0('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xca74=['defaults','agi','error','E_AGI_SERVER_ERROR','message','parse','emit','exports','lodash','events','EventEmitter','ioredis','./error','../../config/environment','redis'];(function(_0x14fb34,_0x174afb){var _0x1ff44d=function(_0x2065a1){while(--_0x2065a1){_0x14fb34['push'](_0x14fb34['shift']());}};_0x1ff44d(++_0x174afb);}(_0xca74,0x1ac));var _0x4ca7=function(_0x208c01,_0x2dd63d){_0x208c01=_0x208c01-0x0;var _0x54a5fc=_0xca74[_0x208c01];return _0x54a5fc;};'use strict';var _=require(_0x4ca7('0x0'));var EventEmitter=require(_0x4ca7('0x1'))[_0x4ca7('0x2')];var Redis=require(_0x4ca7('0x3'));var AGIError=require(_0x4ca7('0x4'));var config=require(_0x4ca7('0x5'));config[_0x4ca7('0x6')]=_[_0x4ca7('0x7')](config[_0x4ca7('0x6')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x4ca7('0x6')]);sub['subscribe'](_0x4ca7('0x8'),function(_0x5b6cfc){if(_0x5b6cfc)return eventEmitter['emit'](_0x4ca7('0x9'),new AGIError(_0x4ca7('0xa'),_0x5b6cfc));});sub['on'](_0x4ca7('0xb'),function(_0x566e00,_0x4851c4){if(_0x566e00!=='agi')return;try{var _0x4740d2=JSON[_0x4ca7('0xc')](_0x4851c4);eventEmitter[_0x4ca7('0xd')]('projectUpdate',_0x4740d2);}catch(_0x2c1eae){eventEmitter[_0x4ca7('0xd')]('error',new AGIError(_0x4ca7('0xa'),_0x2c1eae));}});module[_0x4ca7('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 1c0e1d9..3016a7e 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 _0x5160=['getdigits','vertices','edges','prototype','addVertex','addEdge','size','relations','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','split','agicommand','target','invalid','vswitch','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','menu'];(function(_0x722103,_0x5732f3){var _0x3e2435=function(_0x44c44a){while(--_0x44c44a){_0x722103['push'](_0x722103['shift']());}};_0x3e2435(++_0x5732f3);}(_0x5160,0x136));var _0x0516=function(_0x36decd,_0x575a45){_0x36decd=_0x36decd-0x0;var _0x807951=_0x5160[_0x36decd];return _0x807951;};'use strict';var _=require(_0x0516('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=[_0x0516('0x1'),_0x0516('0x2'),'getsecretdigits'];var Graph=function(){this[_0x0516('0x3')]={};this[_0x0516('0x4')]={};this['numberOfEdges']=0x0;};Graph[_0x0516('0x5')][_0x0516('0x6')]=function(_0x11113e){this[_0x0516('0x3')][_0x11113e['id']]=_0x11113e;this[_0x0516('0x4')][_0x11113e['id']]=[];};Graph[_0x0516('0x5')][_0x0516('0x7')]=function(_0x4be976,_0x539dd8,_0x46efde){this['edges'][_0x4be976]['push']({'target':_0x539dd8,'condition':_0x46efde});this['numberOfEdges']+=0x1;};Graph[_0x0516('0x5')][_0x0516('0x8')]=function(){return _[_0x0516('0x8')](this[_0x0516('0x3')]);};Graph[_0x0516('0x5')][_0x0516('0x9')]=function(){return this['numberOfEdges'];};Graph[_0x0516('0x5')]['getVertex']=function(_0x298fe4){return this['vertices'][_0x298fe4];};Graph[_0x0516('0x5')][_0x0516('0xa')]=function(_0x6248ce,_0xf2160d){if(!this[_0x0516('0x3')][_0x6248ce]){return logger[_0x0516('0xb')](_0x0516('0xc'));}var _0x26a67a=_0xf2160d(this[_0x0516('0x3')][_0x6248ce]);if(!_0x26a67a){return logger['info'](_0x0516('0xd'));}if(this['edges'][_0x6248ce]['length']===0x0){return logger['info']('no\x20edge/s\x20available');}for(var _0x260c2b=0x0,_0x7c27dd=[],_0x172262=![];_0x260c2b\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','handleNotFound'];(function(_0x48e4a4,_0x120886){var _0x2c7b56=function(_0x1d5ea6){while(--_0x1d5ea6){_0x48e4a4['push'](_0x48e4a4['shift']());}};_0x2c7b56(++_0x120886);}(_0x35ba,0x1d3));var _0xa35b=function(_0x440464,_0xb7afd8){_0x440464=_0x440464-0x0;var _0x2f4043=_0x35ba[_0x440464];return _0x2f4043;};'use strict';var _=require(_0xa35b('0x0'));var syncho=require('syncho');var util=require(_0xa35b('0x1'));var config=require(_0xa35b('0x2'));var logger=require('../../config/logger')(_0xa35b('0x3'));var utilLicense=require(_0xa35b('0x4'));var rpc=require(_0xa35b('0x5'));var Project=require('./project');var AGIEmitter=require(_0xa35b('0x6'))[_0xa35b('0x7')];var projects=[];config[_0xa35b('0x3')]=_[_0xa35b('0x8')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0xa35b('0x9'),projectUpdateHandler);function connectionHandler(_0x32e4e8){process[_0xa35b('0xa')](function(){syncho(function(){try{setChannelVariables(_0x32e4e8);agiHandler(_0x32e4e8);}catch(_0x3300d5){logger[_0xa35b('0xb')](_0x3300d5[_0xa35b('0xc')]);}});});}function projectUpdateHandler(_0x471978){try{var _0x2e4340=_[_0xa35b('0xd')](projects,['id',_0x471978['id']]);if(_0x2e4340>-0x1){if(_0x471978['deleted']===!![]){projects[_0xa35b('0xe')](_0x2e4340,0x1);}else{projects[_0x2e4340]=_0x471978;}}else{projects['push'](_0x471978);}}catch(_0x19565b){logger['error'](_0x19565b['stack']);}}function listeningHandler(){var _0x1d5fd9=config[_0xa35b('0xf')]===_0xa35b('0x10')||![];console[_0xa35b('0x11')](_0xa35b('0x12'),config[_0xa35b('0x3')][_0xa35b('0x13')]);logger[_0xa35b('0x14')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',_0x1d5fd9?config[_0xa35b('0x3')]['ip']:'host.docker.internal',config['agi']['port']));}function errorHandler(_0x2154b1){if(_0x2154b1&&_0x2154b1[_0xa35b('0x15')]&&_0x2154b1[_0xa35b('0x16')]){logger['error'](util[_0xa35b('0x17')]('[%s]\x20%s',_0x2154b1[_0xa35b('0x15')],_0x2154b1[_0xa35b('0x16')]));}else{logger[_0xa35b('0xb')](util[_0xa35b('0x17')](_0xa35b('0x18'),_0x2154b1['stack']));}}function closeHandler(){logger[_0xa35b('0x14')](util[_0xa35b('0x17')](_0xa35b('0x19'),this[_0xa35b('0x1a')],this[_0xa35b('0x1b')],this['callerid'],this['dnid'],this[_0xa35b('0x1c')]));try{createSquareReport(this);}catch(_0x478c21){logger[_0xa35b('0xb')](_0x478c21['stack']);}}function timeoutHandler(){logger[_0xa35b('0x14')](util[_0xa35b('0x17')](_0xa35b('0x1d'),this['arg_1'],this['calleridname'],this[_0xa35b('0x1e')],this[_0xa35b('0x1f')],this['uniqueid']));}function hangupHandler(){logger['info'](util['format'](_0xa35b('0x20'),this[_0xa35b('0x1a')],this[_0xa35b('0x1b')],this['callerid'],this[_0xa35b('0x1f')],this[_0xa35b('0x1c')]));this['evtHangup']=!![];}function createSquareReport(_0x53f5f7,_0x3f5848){rpc['createSquareReport'](_0x53f5f7)[_0xa35b('0x21')](function(_0x4d01e2){if(_0x3f5848){_0x3f5848(null,_0x4d01e2);}})[_0xa35b('0x22')](function(_0xa0b74b){if(_0x3f5848){_0x3f5848(null,_0xa0b74b);}});}function setChannelVariables(_0x3878f5){for(var _0x28a23f in _0x3878f5){if(_0x3878f5[_0xa35b('0x23')](_0x28a23f)){if(_0x28a23f[_0xa35b('0x24')](_0xa35b('0x25'))===0x0){_0x3878f5[_0x28a23f[_0xa35b('0x26')](0x4)]=_0x3878f5[_0x28a23f];delete _0x3878f5[_0x28a23f];}}}}function agiHandler(_0x3f19ec){logger[_0xa35b('0x27')](_0xa35b('0x28'),JSON[_0xa35b('0x29')](_0x3f19ec,null,0x2));logger['info'](util['format']('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3f19ec[_0xa35b('0x1a')],_0x3f19ec[_0xa35b('0x1b')],_0x3f19ec[_0xa35b('0x1e')],_0x3f19ec[_0xa35b('0x1f')],_0x3f19ec[_0xa35b('0x1c')]));_0x3f19ec['on'](_0xa35b('0xb'),errorHandler);_0x3f19ec['on'](_0xa35b('0x2a'),closeHandler);_0x3f19ec['on'](_0xa35b('0x2b'),timeoutHandler);_0x3f19ec['evtHangup']=![];_0x3f19ec['on'](_0xa35b('0x2c'),hangupHandler);var _0x9cfaf7=_['find'](projects,[_0xa35b('0x15'),_0x3f19ec[_0xa35b('0x1a')]]);if(!_0x9cfaf7)return Project[_0xa35b('0x2d')](_0x3f19ec);if(!_0x9cfaf7['production'])return Project['handleUnpublished'](_0x3f19ec);return Project['initialize'](_0x9cfaf7,_0x3f19ec);}function main(){var _0x5f4a37;return utilLicense[_0xa35b('0x2e')]()['then'](function(_0x5d25a3){if(!_0x5d25a3)return;if(_0x5d25a3[_0xa35b('0x2f')]){if(_0x5d25a3[_0xa35b('0x30')]&&_0x5d25a3[_0xa35b('0x30')]>0x0){logger[_0xa35b('0x14')](util[_0xa35b('0x17')](_0xa35b('0x31'),_0x5d25a3[_0xa35b('0x30')]));_0x5f4a37=_0x5d25a3[_0xa35b('0x30')];}else{logger[_0xa35b('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xa35b('0x14')](_0xa35b('0x32'));_0x5f4a37=-0x1;}})[_0xa35b('0x21')](function(){return Project[_0xa35b('0x33')]();})['then'](function(_0xfbf254){projects=_0xfbf254;return;})[_0xa35b('0x22')](function(_0x1cd60f){logger[_0xa35b('0xb')](_0xa35b('0x34'),_0x1cd60f['stack']);})[_0xa35b('0x35')](function(){var _0xeedf64=require(_0xa35b('0x36'))(config['agi'][_0xa35b('0x13')],config[_0xa35b('0x3')]['ip'],_0x5f4a37);_0xeedf64['on'](_0xa35b('0xb'),errorHandler);_0xeedf64['on'](_0xa35b('0x37'),listeningHandler);_0xeedf64['on'](_0xa35b('0x38'),connectionHandler);_0xeedf64['on'](_0xa35b('0x2a'),closeHandler);});}main(); \ No newline at end of file +var _0x042d=['voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','catch','finally','connection','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./rpc','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate','error','stack','deleted','env','production','log','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','host.docker.internal','message','[%s]\x20%s','name','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','createSquareReport','indexOf','substring','debug','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleUnpublished','initialize','getLicense'];(function(_0x304043,_0x40bffb){var _0x3b8e06=function(_0x42a127){while(--_0x42a127){_0x304043['push'](_0x304043['shift']());}};_0x3b8e06(++_0x40bffb);}(_0x042d,0xdc));var _0xd042=function(_0x2c7dc6,_0x3c4ce0){_0x2c7dc6=_0x2c7dc6-0x0;var _0x10002b=_0x042d[_0x2c7dc6];return _0x10002b;};'use strict';var _=require(_0xd042('0x0'));var syncho=require(_0xd042('0x1'));var util=require(_0xd042('0x2'));var config=require(_0xd042('0x3'));var logger=require(_0xd042('0x4'))('agi');var utilLicense=require(_0xd042('0x5'));var rpc=require(_0xd042('0x6'));var Project=require(_0xd042('0x7'));var AGIEmitter=require(_0xd042('0x8'))[_0xd042('0x9')];var projects=[];config[_0xd042('0xa')]=_[_0xd042('0xb')](config[_0xd042('0xa')],{'ip':_0xd042('0xc'),'port':0x11dd});AGIEmitter['on'](_0xd042('0xd'),projectUpdateHandler);function connectionHandler(_0x8b37d){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x8b37d);agiHandler(_0x8b37d);}catch(_0x42ffa2){logger[_0xd042('0xe')](_0x42ffa2[_0xd042('0xf')]);}});});}function projectUpdateHandler(_0x23377f){try{var _0x15ec9c=_['findIndex'](projects,['id',_0x23377f['id']]);if(_0x15ec9c>-0x1){if(_0x23377f[_0xd042('0x10')]===!![]){projects['splice'](_0x15ec9c,0x1);}else{projects[_0x15ec9c]=_0x23377f;}}else{projects['push'](_0x23377f);}}catch(_0x214d41){logger[_0xd042('0xe')](_0x214d41['stack']);}}function listeningHandler(){var _0x2f05b3=config[_0xd042('0x11')]===_0xd042('0x12')||![];console[_0xd042('0x13')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config['agi'][_0xd042('0x14')]);logger[_0xd042('0x15')](util[_0xd042('0x16')](_0xd042('0x17'),_0x2f05b3?config[_0xd042('0xa')]['ip']:_0xd042('0x18'),config[_0xd042('0xa')][_0xd042('0x14')]));}function errorHandler(_0x116d55){if(_0x116d55&&_0x116d55['name']&&_0x116d55[_0xd042('0x19')]){logger['error'](util['format'](_0xd042('0x1a'),_0x116d55[_0xd042('0x1b')],_0x116d55[_0xd042('0x19')]));}else{logger[_0xd042('0xe')](util[_0xd042('0x16')](_0xd042('0x1c'),_0x116d55[_0xd042('0xf')]));}}function closeHandler(){logger[_0xd042('0x15')](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd042('0x1d')],this[_0xd042('0x1e')],this[_0xd042('0x1f')],this[_0xd042('0x20')],this[_0xd042('0x21')]));try{createSquareReport(this);}catch(_0x280f10){logger[_0xd042('0xe')](_0x280f10[_0xd042('0xf')]);}}function timeoutHandler(){logger[_0xd042('0x15')](util[_0xd042('0x16')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xd042('0x1d')],this['calleridname'],this['callerid'],this[_0xd042('0x20')],this[_0xd042('0x21')]));}function hangupHandler(){logger[_0xd042('0x15')](util[_0xd042('0x16')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this['arg_1'],this[_0xd042('0x1e')],this[_0xd042('0x1f')],this[_0xd042('0x20')],this[_0xd042('0x21')]));this['evtHangup']=!![];}function createSquareReport(_0x232038,_0x263f66){rpc[_0xd042('0x22')](_0x232038)['then'](function(_0x33c24f){if(_0x263f66){_0x263f66(null,_0x33c24f);}})['catch'](function(_0x295950){if(_0x263f66){_0x263f66(null,_0x295950);}});}function setChannelVariables(_0x59dd11){for(var _0x53cebf in _0x59dd11){if(_0x59dd11['hasOwnProperty'](_0x53cebf)){if(_0x53cebf[_0xd042('0x23')]('agi_')===0x0){_0x59dd11[_0x53cebf[_0xd042('0x24')](0x4)]=_0x59dd11[_0x53cebf];delete _0x59dd11[_0x53cebf];}}}}function agiHandler(_0x1c0196){logger[_0xd042('0x25')]('variables',JSON['stringify'](_0x1c0196,null,0x2));logger[_0xd042('0x15')](util['format'](_0xd042('0x26'),_0x1c0196[_0xd042('0x1d')],_0x1c0196[_0xd042('0x1e')],_0x1c0196['callerid'],_0x1c0196[_0xd042('0x20')],_0x1c0196[_0xd042('0x21')]));_0x1c0196['on'](_0xd042('0xe'),errorHandler);_0x1c0196['on'](_0xd042('0x27'),closeHandler);_0x1c0196['on'](_0xd042('0x28'),timeoutHandler);_0x1c0196['evtHangup']=![];_0x1c0196['on'](_0xd042('0x29'),hangupHandler);var _0x7e0952=_['find'](projects,[_0xd042('0x1b'),_0x1c0196[_0xd042('0x1d')]]);if(!_0x7e0952)return Project['handleNotFound'](_0x1c0196);if(!_0x7e0952[_0xd042('0x12')])return Project[_0xd042('0x2a')](_0x1c0196);return Project[_0xd042('0x2b')](_0x7e0952,_0x1c0196);}function main(){var _0x1dded3;return utilLicense[_0xd042('0x2c')]()['then'](function(_0x33e992){if(!_0x33e992)return;if(_0x33e992[_0xd042('0x2d')]){if(_0x33e992[_0xd042('0x2e')]&&_0x33e992[_0xd042('0x2e')]>0x0){logger[_0xd042('0x15')](util[_0xd042('0x16')](_0xd042('0x2f'),_0x33e992['callysquare']));_0x1dded3=_0x33e992[_0xd042('0x2e')];}else{logger[_0xd042('0x15')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xd042('0x15')](_0xd042('0x30'));_0x1dded3=-0x1;}})[_0xd042('0x31')](function(){return Project['getAll']();})[_0xd042('0x31')](function(_0x2ba9ab){projects=_0x2ba9ab;return;})[_0xd042('0x32')](function(_0x385693){logger[_0xd042('0xe')]('[LICENSE]',_0x385693[_0xd042('0xf')]);})[_0xd042('0x33')](function(){var _0x17f1b4=require('./server')(config[_0xd042('0xa')][_0xd042('0x14')],config[_0xd042('0xa')]['ip'],_0x1dded3);_0x17f1b4['on'](_0xd042('0xe'),errorHandler);_0x17f1b4['on']('listening',listeningHandler);_0x17f1b4['on'](_0xd042('0x34'),connectionHandler);_0x17f1b4['on'](_0xd042('0x27'),closeHandler);});}main(); \ No newline at end of file diff --git a/server/services/agi/mailRpc/index.js b/server/services/agi/mailRpc/index.js index 134cce3..074adc7 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 _0x3c2e=['request','then','error','message','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x5223bf,_0x109da4){var _0x181da4=function(_0x5d7047){while(--_0x5d7047){_0x5223bf['push'](_0x5223bf['shift']());}};_0x181da4(++_0x109da4);}(_0x3c2e,0x9d));var _0xe3c2=function(_0x574286,_0x306381){_0x574286=_0x574286-0x0;var _0x46a860=_0x3c2e[_0x574286];return _0x46a860;};'use strict';var BPromise=require(_0xe3c2('0x0'));var jayson=require(_0xe3c2('0x1'));var client=jayson['client'][_0xe3c2('0x2')]({'port':0x232b});function request(_0x290d42,_0x21ec6a){return new BPromise(function(_0xeb4d08,_0x5f519e){return client[_0xe3c2('0x3')](_0x290d42,_0x21ec6a)[_0xe3c2('0x4')](function(_0x3e73d1){if(_0x3e73d1[_0xe3c2('0x5')]){return _0x5f519e(_0x3e73d1['error'][_0xe3c2('0x6')]);}else{return _0xeb4d08(_0x3e73d1['result']);}})[_0xe3c2('0x7')](function(_0x36ae7d){return _0x5f519e(_0x36ae7d);});});}exports[_0xe3c2('0x8')]=function(_0x302dc3,_0x1b7c3e){return request(_0xe3c2('0x9'),{'account':_0x302dc3,'message':_0x1b7c3e});}; \ No newline at end of file +var _0x65f6=['message','catch','bluebird','jayson/promise','client','http','request','then','error'];(function(_0x467436,_0x201bf1){var _0x4d6334=function(_0x579f8e){while(--_0x579f8e){_0x467436['push'](_0x467436['shift']());}};_0x4d6334(++_0x201bf1);}(_0x65f6,0x80));var _0x665f=function(_0x57e496,_0x1fa5e1){_0x57e496=_0x57e496-0x0;var _0x168769=_0x65f6[_0x57e496];return _0x168769;};'use strict';var BPromise=require(_0x665f('0x0'));var jayson=require(_0x665f('0x1'));var client=jayson[_0x665f('0x2')][_0x665f('0x3')]({'port':0x232b});function request(_0x2ae060,_0x2cb8cc){return new BPromise(function(_0x2da693,_0x36bd36){return client[_0x665f('0x4')](_0x2ae060,_0x2cb8cc)[_0x665f('0x5')](function(_0x4568fe){if(_0x4568fe[_0x665f('0x6')]){return _0x36bd36(_0x4568fe[_0x665f('0x6')][_0x665f('0x7')]);}else{return _0x2da693(_0x4568fe['result']);}})[_0x665f('0x8')](function(_0x31ef99){return _0x36bd36(_0x31ef99);});});}exports['sendMailMessage']=function(_0x5cfb8a,_0x548cf0){return request('SendMail',{'account':_0x5cfb8a,'message':_0x548cf0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 4fc485e..932a70d 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 _0x5762=['context','extension','response','code','evtHangup','isUndefined','result','toString','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','priority','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','moment','xml2json','util','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','error','stack','agicommand','hasOwnProperty','retry','addVertex','omit','length','source','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','dnid','uniqueid','traverseBFS','clear','vertex','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x3cb62c,_0x92f62f){var _0x1bda2b=function(_0x38e569){while(--_0x38e569){_0x3cb62c['push'](_0x3cb62c['shift']());}};_0x1bda2b(++_0x92f62f);}(_0x5762,0x8c));var _0x2576=function(_0x1911ed,_0x4e8c73){_0x1911ed=_0x1911ed-0x0;var _0x11edaa=_0x5762[_0x1911ed];return _0x11edaa;};'use strict';var _=require(_0x2576('0x0'));var moment=require(_0x2576('0x1'));var parser=require(_0x2576('0x2'));var util=require(_0x2576('0x3'));var logger=require('../../config/logger')('agi');var rpc=require(_0x2576('0x4'));var mailRpc=require(_0x2576('0x5'));var Graph=require(_0x2576('0x6'));var Vertices=require(_0x2576('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x2576('0x8')]()['catch'](function(_0x141b84){logger[_0x2576('0x9')]('Unable\x20to\x20download\x20CallySquare\x20projects',_0x141b84[_0x2576('0xa')]);return[];});}function addVertex(_0x14e66e,_0x5c489e,_0xfdf38d){_0x5c489e[_0x2576('0xb')]=_0xfdf38d;if(_0x5c489e[_0x2576('0xc')](_0x2576('0xd'))){_0x5c489e['maxRetry']=parseInt(_0x5c489e[_0x2576('0xd')],0xa);}_0x14e66e[_0x2576('0xe')](_[_0x2576('0xf')](_0x5c489e,'mxCell'));}function initGraph(_0x435d3a,_0x483a48){var _0x3352bd=new Graph();for(var _0x4614c3 in _0x435d3a){if(_0x435d3a[_0x2576('0xc')](_0x4614c3)){if(_['isArray'](_0x435d3a[_0x4614c3])){for(var _0x3482aa=0x0;_0x3482aa<_0x435d3a[_0x4614c3][_0x2576('0x10')];_0x3482aa+=0x1){addVertex(_0x3352bd,_0x435d3a[_0x4614c3][_0x3482aa],_0x4614c3);}}else{addVertex(_0x3352bd,_0x435d3a[_0x4614c3],_0x4614c3);}}}for(var _0x43d526=0x0;_0x43d526<_0x483a48[_0x2576('0x10')];_0x43d526+=0x1){if(_0x483a48[_0x43d526][_0x2576('0x11')]&&_0x483a48[_0x43d526][_0x2576('0x12')]){_0x3352bd[_0x2576('0x13')](_0x483a48[_0x43d526][_0x2576('0x11')],_0x483a48[_0x43d526][_0x2576('0x12')],_0x483a48[_0x43d526][_0x2576('0x14')]);}}return _0x3352bd;}function getRoot(_0x5aed38){return parser[_0x2576('0x15')](_0x5aed38,{'object':!![]})[_0x2576('0x16')][_0x2576('0x17')];}function inspect(_0x284d03){return util[_0x2576('0x18')](_0x284d03,{'showHidden':![],'depth':null});}function initialize(_0x28272b,_0xe04c48){var _0x2cd194=getRoot(_0x28272b[_0x2576('0x19')]);if(!_0x2cd194||!_0x2cd194[_0x2576('0x1a')])return;var _0x29d6c2,_0x1e59a2,_0x598b5e;logger[_0x2576('0x1b')](_0x2576('0x17'),JSON[_0x2576('0x1c')](_0x2cd194,null,0x2));_0xe04c48[_0x2576('0x1d')]=moment()[_0x2576('0x1e')](_0x2576('0x1f'));_0x29d6c2=initGraph(_[_0x2576('0xf')](_0x2cd194,_0x2576('0x20')),_0x2cd194[_0x2576('0x20')]);_0x1e59a2=new Vertices(_0xe04c48,rpc,mailRpc);logger[_0x2576('0x21')](util[_0x2576('0x1e')](_0x2576('0x22'),_0xe04c48[_0x2576('0x23')],_0xe04c48[_0x2576('0x24')],_0xe04c48['callerid'],_0xe04c48[_0x2576('0x25')],_0xe04c48[_0x2576('0x26')]));_0x29d6c2[_0x2576('0x27')](_0x2cd194[_0x2576('0x1a')]['id'],function(_0x11ee65){try{_0x11ee65=_0x1e59a2[_0x2576('0x28')](_0x11ee65);logger[_0x2576('0x1b')](_0x2576('0x29'),JSON[_0x2576('0x1c')](_0x11ee65,null,0x2));if(_0x11ee65['agicommand']==='gotoc'){logger[_0x2576('0x21')](_0x2576('0x2a'));_0xe04c48[_0x2576('0x2b')]=_0x11ee65['context']||_0xe04c48[_0x2576('0x2b')];_0xe04c48[_0x2576('0x2c')]=_0x11ee65[_0x2576('0x2c')];_0xe04c48['priority']=_0x11ee65['priority']?_0x11ee65['priority']-0x1:0x1;return null;}else if(_0x11ee65&&_0x1e59a2[_0x11ee65[_0x2576('0xb')]]){_0x598b5e=_0x1e59a2[_0x11ee65[_0x2576('0xb')]](_0x11ee65);logger[_0x2576('0x21')](_0x2576('0x2d'),JSON[_0x2576('0x1c')](_0x598b5e,null,0x2));if(_0x598b5e&&_0x598b5e[_0x2576('0x2e')]===AGI_CODE_SUCCESS&&_0x598b5e['result']!==AGI_RESULT_ERROR&&!_0xe04c48[_0x2576('0x2f')]){logger[_0x2576('0x1b')](_0x2576('0x2d'),inspect(_0x598b5e));return _[_0x2576('0x30')](_0x598b5e['result'])?null:_0x598b5e[_0x2576('0x31')][_0x2576('0x32')]();}else{logger[_0x2576('0x9')](_0x2576('0x2d'),inspect(_0x598b5e));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x4fb025){logger[_0x2576('0x9')](_0x4fb025[_0x2576('0xa')]);return null;}});if(_0x2cd194[_0x2576('0x33')]){logger[_0x2576('0x21')](util['format'](_0x2576('0x34'),_0xe04c48[_0x2576('0x23')],_0xe04c48[_0x2576('0x24')],_0xe04c48[_0x2576('0x35')],_0xe04c48[_0x2576('0x25')],_0xe04c48[_0x2576('0x26')]));_0x29d6c2[_0x2576('0x27')](_0x2cd194[_0x2576('0x33')]['id'],function(_0x13537c){try{_0x13537c=_0x1e59a2[_0x2576('0x28')](_0x13537c);logger[_0x2576('0x1b')]('vertex',JSON['stringify'](_0x13537c,null,0x2));if(_0x13537c&&_0x1e59a2[_0x13537c[_0x2576('0xb')]]){_0x598b5e=_0x1e59a2[_0x13537c['agicommand']](_0x13537c);if(_0x598b5e){logger[_0x2576('0x1b')]('response',inspect(_0x598b5e));return _[_0x2576('0x30')](_0x598b5e[_0x2576('0x31')])?null:_0x598b5e[_0x2576('0x31')][_0x2576('0x32')]();}else{logger[_0x2576('0x9')]('response',inspect(_0x598b5e));return null;}}else{logger[_0x2576('0x9')]('agicommand\x20not\x20found');return null;}}catch(_0xe3dfcc){logger[_0x2576('0x9')](_0xe3dfcc[_0x2576('0xa')]);return null;}});}logger[_0x2576('0x21')](util['format'](_0x2576('0x36'),_0xe04c48[_0x2576('0x23')],_0xe04c48[_0x2576('0x24')],_0xe04c48[_0x2576('0x35')],_0xe04c48[_0x2576('0x25')],_0xe04c48[_0x2576('0x26')]));logger['info'](util[_0x2576('0x1e')](_0x2576('0x37'),_0xe04c48[_0x2576('0x2b')],_0xe04c48[_0x2576('0x2c')],parseInt(_0xe04c48[_0x2576('0x38')],0xa)+0x1));_0xe04c48[_0x2576('0x39')](_0xe04c48[_0x2576('0x2b')],_0xe04c48[_0x2576('0x2c')],parseInt(_0xe04c48[_0x2576('0x38')],0xa)+0x1);_0xe04c48[_0x2576('0x3a')]();}function handleNotFound(_0x5914bb){logger[_0x2576('0x9')](util[_0x2576('0x1e')](_0x2576('0x3b'),_0x5914bb[_0x2576('0x23')]));_0x5914bb[_0x2576('0x39')](_0x5914bb[_0x2576('0x2b')],_0x5914bb[_0x2576('0x2c')],parseInt(_0x5914bb[_0x2576('0x38')],0xa)+0x1);_0x5914bb[_0x2576('0x3a')]();}function handleUnpublished(_0x55a36b){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x55a36b[_0x2576('0x23')]));_0x55a36b['continueAt'](_0x55a36b[_0x2576('0x2b')],_0x55a36b[_0x2576('0x2c')],parseInt(_0x55a36b['priority'],0xa)+0x1);_0x55a36b[_0x2576('0x3a')]();}module[_0x2576('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x631c=['moment','xml2json','util','./mailRpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','retry','omit','hasOwnProperty','length','addEdge','source','target','value','toJson','production','start','debug','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','clear','vertex','stringify','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','code','evtHangup','response','isUndefined','result','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','lodash'];(function(_0x230ebb,_0x1609b2){var _0x4b1e42=function(_0x1cd0fc){while(--_0x1cd0fc){_0x230ebb['push'](_0x230ebb['shift']());}};_0x4b1e42(++_0x1609b2);}(_0x631c,0xeb));var _0xc631=function(_0x3212b1,_0x3e9262){_0x3212b1=_0x3212b1-0x0;var _0xc2c9f3=_0x631c[_0x3212b1];return _0xc2c9f3;};'use strict';var _=require(_0xc631('0x0'));var moment=require(_0xc631('0x1'));var parser=require(_0xc631('0x2'));var util=require(_0xc631('0x3'));var logger=require('../../config/logger')('agi');var rpc=require('./rpc');var mailRpc=require(_0xc631('0x4'));var Graph=require(_0xc631('0x5'));var Vertices=require(_0xc631('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc631('0x7')]()[_0xc631('0x8')](function(_0xd8aae3){logger[_0xc631('0x9')](_0xc631('0xa'),_0xd8aae3[_0xc631('0xb')]);return[];});}function addVertex(_0x54d091,_0x66a492,_0x2762be){_0x66a492[_0xc631('0xc')]=_0x2762be;if(_0x66a492['hasOwnProperty'](_0xc631('0xd'))){_0x66a492['maxRetry']=parseInt(_0x66a492[_0xc631('0xd')],0xa);}_0x54d091['addVertex'](_[_0xc631('0xe')](_0x66a492,'mxCell'));}function initGraph(_0x508765,_0x21057d){var _0x49d175=new Graph();for(var _0xabf7cc in _0x508765){if(_0x508765[_0xc631('0xf')](_0xabf7cc)){if(_['isArray'](_0x508765[_0xabf7cc])){for(var _0x4b590a=0x0;_0x4b590a<_0x508765[_0xabf7cc]['length'];_0x4b590a+=0x1){addVertex(_0x49d175,_0x508765[_0xabf7cc][_0x4b590a],_0xabf7cc);}}else{addVertex(_0x49d175,_0x508765[_0xabf7cc],_0xabf7cc);}}}for(var _0x3d4a80=0x0;_0x3d4a80<_0x21057d[_0xc631('0x10')];_0x3d4a80+=0x1){if(_0x21057d[_0x3d4a80]['source']&&_0x21057d[_0x3d4a80]['target']){_0x49d175[_0xc631('0x11')](_0x21057d[_0x3d4a80][_0xc631('0x12')],_0x21057d[_0x3d4a80][_0xc631('0x13')],_0x21057d[_0x3d4a80][_0xc631('0x14')]);}}return _0x49d175;}function getRoot(_0x5394e6){return parser[_0xc631('0x15')](_0x5394e6,{'object':!![]})['mxGraphModel']['root'];}function inspect(_0x527258){return util['inspect'](_0x527258,{'showHidden':![],'depth':null});}function initialize(_0x182893,_0x54a3a8){var _0x25998a=getRoot(_0x182893[_0xc631('0x16')]);if(!_0x25998a||!_0x25998a[_0xc631('0x17')])return;var _0x523c76,_0x2dd7b,_0x4f193a;logger[_0xc631('0x18')]('root',JSON['stringify'](_0x25998a,null,0x2));_0x54a3a8['joinAt']=moment()[_0xc631('0x19')](_0xc631('0x1a'));_0x523c76=initGraph(_[_0xc631('0xe')](_0x25998a,_0xc631('0x1b')),_0x25998a['mxCell']);_0x2dd7b=new Vertices(_0x54a3a8,rpc,mailRpc);logger[_0xc631('0x1c')](util[_0xc631('0x19')](_0xc631('0x1d'),_0x54a3a8[_0xc631('0x1e')],_0x54a3a8[_0xc631('0x1f')],_0x54a3a8[_0xc631('0x20')],_0x54a3a8['dnid'],_0x54a3a8[_0xc631('0x21')]));_0x523c76[_0xc631('0x22')](_0x25998a[_0xc631('0x17')]['id'],function(_0xddd771){try{_0xddd771=_0x2dd7b[_0xc631('0x23')](_0xddd771);logger[_0xc631('0x18')](_0xc631('0x24'),JSON[_0xc631('0x25')](_0xddd771,null,0x2));if(_0xddd771[_0xc631('0xc')]===_0xc631('0x26')){logger[_0xc631('0x1c')](_0xc631('0x27'));_0x54a3a8[_0xc631('0x28')]=_0xddd771['context']||_0x54a3a8[_0xc631('0x28')];_0x54a3a8[_0xc631('0x29')]=_0xddd771['extension'];_0x54a3a8[_0xc631('0x2a')]=_0xddd771[_0xc631('0x2a')]?_0xddd771[_0xc631('0x2a')]-0x1:0x1;return null;}else if(_0xddd771&&_0x2dd7b[_0xddd771['agicommand']]){_0x4f193a=_0x2dd7b[_0xddd771[_0xc631('0xc')]](_0xddd771);logger[_0xc631('0x1c')]('response',JSON[_0xc631('0x25')](_0x4f193a,null,0x2));if(_0x4f193a&&_0x4f193a[_0xc631('0x2b')]===AGI_CODE_SUCCESS&&_0x4f193a['result']!==AGI_RESULT_ERROR&&!_0x54a3a8[_0xc631('0x2c')]){logger[_0xc631('0x18')](_0xc631('0x2d'),inspect(_0x4f193a));return _[_0xc631('0x2e')](_0x4f193a['result'])?null:_0x4f193a[_0xc631('0x2f')][_0xc631('0x30')]();}else{logger[_0xc631('0x9')](_0xc631('0x2d'),inspect(_0x4f193a));return null;}}else{logger[_0xc631('0x9')](_0xc631('0x31'));return null;}}catch(_0x31ddb5){logger[_0xc631('0x9')](_0x31ddb5['stack']);return null;}});if(_0x25998a[_0xc631('0x32')]){logger[_0xc631('0x1c')](util[_0xc631('0x19')](_0xc631('0x33'),_0x54a3a8[_0xc631('0x1e')],_0x54a3a8['calleridname'],_0x54a3a8[_0xc631('0x20')],_0x54a3a8[_0xc631('0x34')],_0x54a3a8[_0xc631('0x21')]));_0x523c76[_0xc631('0x22')](_0x25998a['finally']['id'],function(_0x8bdd69){try{_0x8bdd69=_0x2dd7b[_0xc631('0x23')](_0x8bdd69);logger['debug']('vertex',JSON[_0xc631('0x25')](_0x8bdd69,null,0x2));if(_0x8bdd69&&_0x2dd7b[_0x8bdd69[_0xc631('0xc')]]){_0x4f193a=_0x2dd7b[_0x8bdd69[_0xc631('0xc')]](_0x8bdd69);if(_0x4f193a){logger['debug'](_0xc631('0x2d'),inspect(_0x4f193a));return _[_0xc631('0x2e')](_0x4f193a[_0xc631('0x2f')])?null:_0x4f193a[_0xc631('0x2f')][_0xc631('0x30')]();}else{logger[_0xc631('0x9')](_0xc631('0x2d'),inspect(_0x4f193a));return null;}}else{logger['error']('agicommand\x20not\x20found');return null;}}catch(_0x5fb713){logger['error'](_0x5fb713[_0xc631('0xb')]);return null;}});}logger['info'](util[_0xc631('0x19')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x54a3a8['arg_1'],_0x54a3a8['calleridname'],_0x54a3a8[_0xc631('0x20')],_0x54a3a8[_0xc631('0x34')],_0x54a3a8[_0xc631('0x21')]));logger[_0xc631('0x1c')](util['format'](_0xc631('0x35'),_0x54a3a8['context'],_0x54a3a8[_0xc631('0x29')],parseInt(_0x54a3a8[_0xc631('0x2a')],0xa)+0x1));_0x54a3a8[_0xc631('0x36')](_0x54a3a8[_0xc631('0x28')],_0x54a3a8['extension'],parseInt(_0x54a3a8[_0xc631('0x2a')],0xa)+0x1);_0x54a3a8[_0xc631('0x37')]();}function handleNotFound(_0x12d668){logger[_0xc631('0x9')](util[_0xc631('0x19')](_0xc631('0x38'),_0x12d668[_0xc631('0x1e')]));_0x12d668[_0xc631('0x36')](_0x12d668['context'],_0x12d668[_0xc631('0x29')],parseInt(_0x12d668['priority'],0xa)+0x1);_0x12d668[_0xc631('0x37')]();}function handleUnpublished(_0x47b888){logger[_0xc631('0x9')](util[_0xc631('0x19')](_0xc631('0x39'),_0x47b888[_0xc631('0x1e')]));_0x47b888[_0xc631('0x36')](_0x47b888[_0xc631('0x28')],_0x47b888[_0xc631('0x29')],parseInt(_0x47b888[_0xc631('0x2a')],0xa)+0x1);_0x47b888['close']();}module[_0xc631('0x3a')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index c846bd1..6c728e4 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 _0xd433=['_inBody','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','toString','length','split','indexOf','slice','trim','emit','headers','line','substring','exports','util','stream','call','_localBuffer'];(function(_0x3cc751,_0x38b8ff){var _0x3956a2=function(_0x237cbc){while(--_0x237cbc){_0x3cc751['push'](_0x3cc751['shift']());}};_0x3956a2(++_0x38b8ff);}(_0xd433,0x1c8));var _0x3d43=function(_0x370bc4,_0x118300){_0x370bc4=_0x370bc4-0x0;var _0x53df59=_0xd433[_0x370bc4];return _0x53df59;};'use strict';var util=require(_0x3d43('0x0'));var Transform=require(_0x3d43('0x1'))['Transform'];function AGIReply(_0x23a6c4){Transform[_0x3d43('0x2')](this,_0x23a6c4);this[_0x3d43('0x3')]='';this[_0x3d43('0x4')]=![];}util[_0x3d43('0x5')](AGIReply,Transform);AGIReply[_0x3d43('0x6')][_0x3d43('0x7')]=function(_0x4509ba,_0x28f693,_0x17cbda){var _0x4f90fd='\x0a',_0x3d5ad4=['\x0a\x0a',_0x3d43('0x8')],_0x25900a=-0x1,_0x41ecb8=-0x1,_0x3e6af2='',_0x5eeefb=0x0,_0x16f08d='',_0x1edbf3='';this[_0x3d43('0x3')]+=_0x4509ba[_0x3d43('0x9')]();_0x16f08d=this[_0x3d43('0x3')];if(!this[_0x3d43('0x4')]){_0x5eeefb=0x0;while(_0x3d5ad4[_0x5eeefb]){while((_0x41ecb8=_0x16f08d['indexOf'](_0x3d5ad4[_0x5eeefb]))!=-0x1){_0x3e6af2=_0x3d5ad4[_0x5eeefb];_0x1edbf3=_0x16f08d['substring'](0x0,_0x41ecb8);_0x16f08d=_0x16f08d['substring'](_0x41ecb8+_0x3e6af2[_0x3d43('0xa')]);var _0x12fc91=_0x1edbf3[_0x3d43('0xb')](_0x4f90fd),_0x3e6c15=0x0,_0x504f77={},_0x294dbf='',_0x2c13bd='',_0x28e23e=-0x1;while(_0x12fc91[_0x3e6c15]){_0x28e23e=_0x12fc91[_0x3e6c15][_0x3d43('0xc')](':');if(_0x28e23e!=-0x1){_0x294dbf=_0x12fc91[_0x3e6c15][_0x3d43('0xd')](0x0,_0x28e23e)[_0x3d43('0xe')]();_0x2c13bd=_0x12fc91[_0x3e6c15][_0x3d43('0xd')](_0x28e23e+0x1)[_0x3d43('0xe')]();if(_0x294dbf['length']>0x0){_0x504f77[_0x294dbf]=_0x2c13bd;}}else{}_0x3e6c15++;}this[_0x3d43('0xf')](_0x3d43('0x10'),_0x504f77);this[_0x3d43('0x4')]=!![];}_0x5eeefb++;}this[_0x3d43('0x3')]=_0x16f08d;}else{while((_0x25900a=_0x16f08d['indexOf'](_0x4f90fd))!=-0x1){_0x1edbf3=_0x16f08d['substring'](0x0,_0x25900a);this['emit'](_0x3d43('0x11'),_0x1edbf3);_0x16f08d=_0x16f08d[_0x3d43('0x12')](_0x25900a+_0x4f90fd[_0x3d43('0xa')]);}this[_0x3d43('0x3')]=_0x16f08d;}_0x17cbda();};module[_0x3d43('0x13')]=AGIReply; \ No newline at end of file +var _0x3436=['_localBuffer','_inBody','inherits','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','slice','trim','emit','headers','util','stream','Transform','call'];(function(_0x132e49,_0x3f04be){var _0x88b9ff=function(_0x387e34){while(--_0x387e34){_0x132e49['push'](_0x132e49['shift']());}};_0x88b9ff(++_0x3f04be);}(_0x3436,0x1b6));var _0x6343=function(_0x22a58f,_0x4b7ee3){_0x22a58f=_0x22a58f-0x0;var _0x3cc8a3=_0x3436[_0x22a58f];return _0x3cc8a3;};'use strict';var util=require(_0x6343('0x0'));var Transform=require(_0x6343('0x1'))[_0x6343('0x2')];function AGIReply(_0x3ddd3b){Transform[_0x6343('0x3')](this,_0x3ddd3b);this[_0x6343('0x4')]='';this[_0x6343('0x5')]=![];}util[_0x6343('0x6')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x2d7e6c,_0x19c4db,_0x5c1c3a){var _0x473b1d='\x0a',_0x16d117=['\x0a\x0a',_0x6343('0x7')],_0x2f658e=-0x1,_0x313ee5=-0x1,_0x1832bd='',_0xf57b31=0x0,_0x1d8b8c='',_0x47356c='';this[_0x6343('0x4')]+=_0x2d7e6c[_0x6343('0x8')]();_0x1d8b8c=this[_0x6343('0x4')];if(!this[_0x6343('0x5')]){_0xf57b31=0x0;while(_0x16d117[_0xf57b31]){while((_0x313ee5=_0x1d8b8c[_0x6343('0x9')](_0x16d117[_0xf57b31]))!=-0x1){_0x1832bd=_0x16d117[_0xf57b31];_0x47356c=_0x1d8b8c[_0x6343('0xa')](0x0,_0x313ee5);_0x1d8b8c=_0x1d8b8c[_0x6343('0xa')](_0x313ee5+_0x1832bd[_0x6343('0xb')]);var _0x27c2d3=_0x47356c[_0x6343('0xc')](_0x473b1d),_0x114ebf=0x0,_0x1f38fe={},_0x4d530c='',_0x5aedca='',_0x378abf=-0x1;while(_0x27c2d3[_0x114ebf]){_0x378abf=_0x27c2d3[_0x114ebf]['indexOf'](':');if(_0x378abf!=-0x1){_0x4d530c=_0x27c2d3[_0x114ebf]['slice'](0x0,_0x378abf)['trim']();_0x5aedca=_0x27c2d3[_0x114ebf][_0x6343('0xd')](_0x378abf+0x1)[_0x6343('0xe')]();if(_0x4d530c[_0x6343('0xb')]>0x0){_0x1f38fe[_0x4d530c]=_0x5aedca;}}else{}_0x114ebf++;}this[_0x6343('0xf')](_0x6343('0x10'),_0x1f38fe);this[_0x6343('0x5')]=!![];}_0xf57b31++;}this[_0x6343('0x4')]=_0x1d8b8c;}else{while((_0x2f658e=_0x1d8b8c[_0x6343('0x9')](_0x473b1d))!=-0x1){_0x47356c=_0x1d8b8c[_0x6343('0xa')](0x0,_0x2f658e);this[_0x6343('0xf')]('line',_0x47356c);_0x1d8b8c=_0x1d8b8c[_0x6343('0xa')](_0x2f658e+_0x473b1d['length']);}this[_0x6343('0x4')]=_0x1d8b8c;}_0x5c1c3a();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index fcfc9d0..253e18b 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 _0x758e=['ShowVariable','ShowSquareOdbc','ShowUser','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','getIntervalById','ShowInterval','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ShowCmHopper','phone','ListId','getPauseById','ShowPause','agentLogin','agentPause','agentLogout','LogoutUser','lodash','client','http','request','then','error','message','result','getSquareProjects','ShowSquareProject','production','MailServerOut','Smtp','CloudProvider','name','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById'];(function(_0x1d5677,_0x342d27){var _0x274227=function(_0x5ead9c){while(--_0x5ead9c){_0x1d5677['push'](_0x1d5677['shift']());}};_0x274227(++_0x342d27);}(_0x758e,0x1af));var _0xe758=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x758e[_0x6c993a];return _0x27f547;};'use strict';var _=require(_0xe758('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xe758('0x1')][_0xe758('0x2')]({'port':0x2329});function request(_0xbc060d,_0x4b7512){return new Promise(function(_0x5e7714,_0x31641f){return client[_0xe758('0x3')](_0xbc060d,_0x4b7512)[_0xe758('0x4')](function(_0x2d60f4){if(_0x2d60f4['error']){return _0x31641f(_0x2d60f4[_0xe758('0x5')][_0xe758('0x6')]);}else{return _0x5e7714(_0x2d60f4[_0xe758('0x7')]);}})['catch'](function(_0x4c03ba){return _0x31641f(_0x4c03ba);});});}exports[_0xe758('0x8')]=function(){return request('GetSquareProjects',{'options':{'raw':![],'attributes':['id','name','production']}});};exports['getSquareProject']=function(_0x314577){return request(_0xe758('0x9'),{'options':{'raw':![],'where':{'name':_0x314577},'attributes':[_0xe758('0xa')]}});};exports['getMailAccountById']=function(_0x3971f7){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x3971f7},'include':[{'model':_0xe758('0xb'),'as':_0xe758('0xc'),'include':[{'model':_0xe758('0xd'),'as':'CloudProvider'}]}],'attributes':['id',_0xe758('0xe'),'email'],'smtp':!![]}});};exports[_0xe758('0xf')]=function(_0x279b93){return request(_0xe758('0x9'),{'options':{'where':{'id':_0x279b93},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x10')]=function(_0x27517f){return request(_0xe758('0x11'),{'options':{'where':{'id':_0x27517f},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x12')]=function(_0x509431){return request(_0xe758('0x13'),{'options':{'where':{'id':_0x509431},'attributes':['name']}});};exports['getSquareOdbcById']=function(_0x425d74){return request(_0xe758('0x14'),{'options':{'where':{'id':_0x425d74},'attributes':['dsn']}});};exports['getUserById']=function(_0x7ed4e9){return request(_0xe758('0x15'),{'options':{'where':{'id':_0x7ed4e9},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x16')]=function(_0x3fe7e8){return request(_0xe758('0x17'),{'options':{'where':{'phone':_0x3fe7e8['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x44a6db){return request(_0xe758('0x18'),{'options':{'where':{'id':_0x44a6db},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x19')]=function(_0x938a56){return request('ShowSound',{'options':{'where':{'id':_0x938a56},'attributes':['save_name']}});};exports[_0xe758('0x1a')]=function(_0xc7afba){return request(_0xe758('0x1b'),{'options':{'raw':![],'where':{'id':_0xc7afba},'include':[{'model':_0xe758('0x1c'),'as':'Intervals'}]}});};exports[_0xe758('0x1d')]=function(_0x39fbb2){return request(_0xe758('0x1e'),{'options':{'where':{'id':_0x39fbb2},'attributes':['id',_0xe758('0xe')]}});};exports[_0xe758('0x1f')]=function(_0x992bb5){return request(_0xe758('0x20'),{'body':_0x992bb5});};exports['createSquareDetailsReport']=function(_0x5a54df){return request('CreateSquareDetailsReport',{'body':_0x5a54df});};exports['createSquareReport']=function(_0x3efeb9){return request(_0xe758('0x21'),{'body':_[_0xe758('0x22')](_0x3efeb9,{'project_name':_0x3efeb9[_0xe758('0x23')],'prev_project_name':_0x3efeb9['arg_2']||'','is_subproject':_0x3efeb9[_0xe758('0x24')]?!![]:![],'leaveAt':moment()['format'](_0xe758('0x25'))})});};exports['createSquareRecording']=function(_0x5befbe){return request(_0xe758('0x26'),{'body':_0x5befbe});};exports[_0xe758('0x27')]=function(_0x2051f0){return request(_0xe758('0x28'),{'body':_0x2051f0});};exports['createCmContact']=function(_0xf00ed6){return request(_0xe758('0x29'),{'options':{'raw':![],'where':{'phone':_0xf00ed6[_0xe758('0x2a')],'ListId':_0xf00ed6[_0xe758('0x2b')]}}})['then'](function(_0x3a7e96){if(_0x3a7e96){return _0x3a7e96;}return request('CreateCmContact',{'body':_0xf00ed6});});};exports[_0xe758('0x2c')]=function(_0x3979cd){return request(_0xe758('0x2d'),{'options':{'where':{'id':_0x3979cd},'attributes':[_0xe758('0xe')]}});};exports[_0xe758('0x2e')]=function(_0x5be009,_0x4d7e4a){return request('LoginUser',{'body':{'interface':_0x4d7e4a},'options':{'where':_0x5be009}});};exports[_0xe758('0x2f')]=function(_0x53a413,_0x44f767,_0x1ee099){return request('PauseUser',{'body':{'type':_0x44f767,'uniqueid':_0x1ee099},'options':{'where':_0x53a413}});};exports['agentUnpause']=function(_0x401e51){return request('UnpauseUser',{'body':{},'options':{'where':_0x401e51}});};exports[_0xe758('0x30')]=function(_0x1d853c){return request(_0xe758('0x31'),{'body':{},'options':{'where':_0x1d853c}});}; \ No newline at end of file +var _0xfa2b=['getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','Intervals','getSmsAccountById','ShowSmsAccount','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','CreateSquareMessage','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','client','http','request','then','error','message','result','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getSquareOdbcById','dsn','getUserById','ShowUser'];(function(_0x214648,_0x16265d){var _0x520e6f=function(_0x3af627){while(--_0x3af627){_0x214648['push'](_0x214648['shift']());}};_0x520e6f(++_0x16265d);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x23ef99,_0x43cd61){_0x23ef99=_0x23ef99-0x0;var _0x2680a8=_0xfa2b[_0x23ef99];return _0x2680a8;};'use strict';var _=require(_0xbfa2('0x0'));var moment=require(_0xbfa2('0x1'));var jayson=require(_0xbfa2('0x2'));var client=jayson[_0xbfa2('0x3')][_0xbfa2('0x4')]({'port':0x2329});function request(_0x41d712,_0xa0aa2f){return new Promise(function(_0x1103cf,_0x116ab4){return client[_0xbfa2('0x5')](_0x41d712,_0xa0aa2f)[_0xbfa2('0x6')](function(_0x2e8f3b){if(_0x2e8f3b[_0xbfa2('0x7')]){return _0x116ab4(_0x2e8f3b[_0xbfa2('0x7')][_0xbfa2('0x8')]);}else{return _0x1103cf(_0x2e8f3b[_0xbfa2('0x9')]);}})['catch'](function(_0x46a151){return _0x116ab4(_0x46a151);});});}exports['getSquareProjects']=function(){return request(_0xbfa2('0xa'),{'options':{'raw':![],'attributes':['id',_0xbfa2('0xb'),_0xbfa2('0xc')]}});};exports[_0xbfa2('0xd')]=function(_0x35ad85){return request(_0xbfa2('0xe'),{'options':{'raw':![],'where':{'name':_0x35ad85},'attributes':[_0xbfa2('0xc')]}});};exports[_0xbfa2('0xf')]=function(_0xbcc412){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0xbcc412},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xbfa2('0x10'),'as':_0xbfa2('0x10')}]}],'attributes':['id',_0xbfa2('0xb'),_0xbfa2('0x11')],'smtp':!![]}});};exports[_0xbfa2('0x12')]=function(_0xd9bec2){return request('ShowSquareProject',{'options':{'where':{'id':_0xd9bec2},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x13')]=function(_0x458653){return request(_0xbfa2('0x14'),{'options':{'where':{'id':_0x458653},'attributes':[_0xbfa2('0xb')]}});};exports['getVariableById']=function(_0xa988cc){return request('ShowVariable',{'options':{'where':{'id':_0xa988cc},'attributes':['name']}});};exports[_0xbfa2('0x15')]=function(_0x55c9fe){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x55c9fe},'attributes':[_0xbfa2('0x16')]}});};exports[_0xbfa2('0x17')]=function(_0x54cdb2){return request(_0xbfa2('0x18'),{'options':{'where':{'id':_0x54cdb2},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x19')]=function(_0x4088c5){return request(_0xbfa2('0x1a'),{'options':{'where':{'phone':_0x4088c5[_0xbfa2('0x1b')]},'attributes':['id']}});};exports[_0xbfa2('0x1c')]=function(_0x5c3123){return request(_0xbfa2('0x1d'),{'options':{'where':{'id':_0x5c3123},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x1e')]=function(_0x479af0){return request(_0xbfa2('0x1f'),{'options':{'where':{'id':_0x479af0},'attributes':[_0xbfa2('0x20')]}});};exports['getIntervalById']=function(_0xd5760d){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0xd5760d},'include':[{'model':'Interval','as':_0xbfa2('0x21')}]}});};exports[_0xbfa2('0x22')]=function(_0x1ec19f){return request(_0xbfa2('0x23'),{'options':{'where':{'id':_0x1ec19f},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x599df2){return request(_0xbfa2('0x24'),{'body':_0x599df2});};exports['createSquareDetailsReport']=function(_0x1a5249){return request('CreateSquareDetailsReport',{'body':_0x1a5249});};exports[_0xbfa2('0x25')]=function(_0x4db5af){return request(_0xbfa2('0x26'),{'body':_[_0xbfa2('0x27')](_0x4db5af,{'project_name':_0x4db5af[_0xbfa2('0x28')],'prev_project_name':_0x4db5af[_0xbfa2('0x29')]||'','is_subproject':_0x4db5af[_0xbfa2('0x29')]?!![]:![],'leaveAt':moment()['format'](_0xbfa2('0x2a'))})});};exports[_0xbfa2('0x2b')]=function(_0x4f782b){return request(_0xbfa2('0x2c'),{'body':_0x4f782b});};exports[_0xbfa2('0x2d')]=function(_0x4ccdb5){return request(_0xbfa2('0x2e'),{'body':_0x4ccdb5});};exports['createCmContact']=function(_0x16bc84){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x16bc84[_0xbfa2('0x1b')],'ListId':_0x16bc84[_0xbfa2('0x2f')]}}})[_0xbfa2('0x6')](function(_0x33e5af){if(_0x33e5af){return _0x33e5af;}return request('CreateCmContact',{'body':_0x16bc84});});};exports[_0xbfa2('0x30')]=function(_0x4aac4e){return request(_0xbfa2('0x31'),{'options':{'where':{'id':_0x4aac4e},'attributes':[_0xbfa2('0xb')]}});};exports[_0xbfa2('0x32')]=function(_0x5e3831,_0x1b8fe6){return request(_0xbfa2('0x33'),{'body':{'interface':_0x1b8fe6},'options':{'where':_0x5e3831}});};exports[_0xbfa2('0x34')]=function(_0x5db6ae,_0x47fd5a,_0x5aa051){return request(_0xbfa2('0x35'),{'body':{'type':_0x47fd5a,'uniqueid':_0x5aa051},'options':{'where':_0x5db6ae}});};exports[_0xbfa2('0x36')]=function(_0x55e318){return request(_0xbfa2('0x37'),{'body':{},'options':{'where':_0x55e318}});};exports[_0xbfa2('0x38')]=function(_0x39d1ce){return request(_0xbfa2('0x39'),{'body':{},'options':{'where':_0x39d1ce}});}; \ 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 1a493e4..8473285 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 _0x2bd8=['./polly','exports'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x2bd8,0x130));var _0x82bd=function(_0x32ff9a,_0x187823){_0x32ff9a=_0x32ff9a-0x0;var _0x1c515b=_0x2bd8[_0x32ff9a];return _0x1c515b;};var polly=require(_0x82bd('0x0'));var lex=require('./lex');module[_0x82bd('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x2d95=['./polly','exports'];(function(_0x7c2406,_0x610a0f){var _0x21280a=function(_0x4cb399){while(--_0x4cb399){_0x7c2406['push'](_0x7c2406['shift']());}};_0x21280a(++_0x610a0f);}(_0x2d95,0xca));var _0x52d9=function(_0x101f50,_0x3f68ef){_0x101f50=_0x101f50-0x0;var _0x208060=_0x2d95[_0x101f50];return _0x208060;};var polly=require(_0x52d9('0x0'));var lex=require('./lex');module[_0x52d9('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 0fba17f..346152a 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 _0x668b=['./lib/api','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x668b,0x140));var _0xb668=function(_0x11a962,_0x3cc338){_0x11a962=_0x11a962-0x0;var _0x55d423=_0x668b[_0x11a962];return _0x55d423;};'use strict';var lex=require(_0xb668('0x0'));module[_0xb668('0x1')]=function(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83){return lex(_0x51555f,_0x15fbea,_0x2c30c1,_0x49a53b,_0x336ba4,_0x5e2e83);}; \ No newline at end of file +var _0x5b02=['exports','./lib/api'];(function(_0xdf5f28,_0x1fb72e){var _0x52ec5c=function(_0x411986){while(--_0x411986){_0xdf5f28['push'](_0xdf5f28['shift']());}};_0x52ec5c(++_0x1fb72e);}(_0x5b02,0xe9));var _0x25b0=function(_0x15c097,_0x37def2){_0x15c097=_0x15c097-0x0;var _0x4550e6=_0x5b02[_0x15c097];return _0x4550e6;};'use strict';var lex=require(_0x25b0('0x0'));module[_0x25b0('0x1')]=function(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e){return lex(_0x428458,_0x1c3295,_0x4ef71c,_0x4cb227,_0x2b5f2d,_0x53493e);}; \ 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 5bd3bb6..6e382fa 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(_0x389b0f,_0x3faa3e){var _0x175c1f=function(_0x8c6b8c){while(--_0x8c6b8c){_0x389b0f['push'](_0x389b0f['shift']());}};_0x175c1f(++_0x3faa3e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x21f425,_0x327226){var _0x4eaa83=function(_0x6580cc){while(--_0x6580cc){_0x21f425['push'](_0x21f425['shift']());}};_0x4eaa83(++_0x327226);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index e702022..ef6f39a 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 _0xd456=['exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd456,0x1da));var _0x6d45=function(_0x3edfec,_0x2d0038){_0x3edfec=_0x3edfec-0x0;var _0x29f9ab=_0xd456[_0x3edfec];return _0x29f9ab;};'use strict';var polly=require('./lib/api');module[_0x6d45('0x0')]=function(_0x3ec0b4,_0x21318d,_0x252d26,_0x48acd9,_0x1f1e0b,_0x1bcab3,_0x2510f1){return polly(_0x3ec0b4,_0x21318d,_0x252d26,_0x48acd9,_0x1f1e0b,_0x1bcab3,_0x2510f1);}; \ No newline at end of file +var _0x0d25=['./lib/api','exports'];(function(_0xf7f96f,_0x132272){var _0x324a98=function(_0x22ebd3){while(--_0x22ebd3){_0xf7f96f['push'](_0xf7f96f['shift']());}};_0x324a98(++_0x132272);}(_0x0d25,0x16c));var _0x50d2=function(_0x494315,_0x2d42bd){_0x494315=_0x494315-0x0;var _0x49cc18=_0x0d25[_0x494315];return _0x49cc18;};'use strict';var polly=require(_0x50d2('0x0'));module[_0x50d2('0x1')]=function(_0x58ec66,_0x276bff,_0x271456,_0x1d94d5,_0x227353,_0x149b70,_0x41c00a){return polly(_0x58ec66,_0x276bff,_0x271456,_0x1d94d5,_0x227353,_0x149b70,_0x41c00a);}; \ 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 17a238c..53e429c 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 _0x4843=['bluebird','randomstring','aws-sdk','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text','mp3','path'];(function(_0x511b14,_0x475bf1){var _0x9e1937=function(_0x1ec7aa){while(--_0x1ec7aa){_0x511b14['push'](_0x511b14['shift']());}};_0x9e1937(++_0x475bf1);}(_0x4843,0x107));var _0x3484=function(_0x4e2fef,_0x304017){_0x4e2fef=_0x4e2fef-0x0;var _0x30d08a=_0x4843[_0x4e2fef];return _0x30d08a;};'use strict';var fs=require('fs');var path=require(_0x3484('0x0'));var BPromise=require(_0x3484('0x1'));var rs=require(_0x3484('0x2'));var AWS=require(_0x3484('0x3'));function pollyResult(_0x6ad648,_0x5465d7,_0x2ec2eb){return new BPromise(function(_0x42142f,_0x13e891){_0x6ad648['synthesizeSpeech'](_0x5465d7,function(_0x223f88,_0x565dec){if(_0x223f88){_0x13e891(_0x223f88);}else if(_0x565dec){if(_0x565dec['AudioStream']instanceof Buffer){fs[_0x3484('0x4')](_0x2ec2eb,_0x565dec[_0x3484('0x5')],function(_0x5e2587){if(_0x5e2587){_0x13e891(_0x5e2587);}else{_0x42142f();}});}else{_0x13e891(new Error(_0x3484('0x6')));}}else{_0x13e891(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x3484('0x7')]=function(_0x27cce2,_0x11ab94,_0x9736ca,_0x2a3453,_0x298370,_0x1449e8,_0x4925b2){var _0x5e192d=new AWS[(_0x3484('0x8'))]({'accessKeyId':_0x27cce2,'secretAccessKey':_0x11ab94,'region':_0x9736ca});var _0x111ec4={'Text':_0x298370,'TextType':_0x1449e8||_0x3484('0x9'),'OutputFormat':_0x3484('0xa'),'VoiceId':_0x2a3453};return pollyResult(_0x5e192d,_0x111ec4,_0x4925b2);}; \ No newline at end of file +var _0x2d23=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x437e9d,_0x1ad7c0){var _0x6349f2=function(_0x5d9d20){while(--_0x5d9d20){_0x437e9d['push'](_0x437e9d['shift']());}};_0x6349f2(++_0x1ad7c0);}(_0x2d23,0x1c7));var _0x32d2=function(_0xcb65be,_0x551ddd){_0xcb65be=_0xcb65be-0x0;var _0x4b7824=_0x2d23[_0xcb65be];return _0x4b7824;};'use strict';var fs=require('fs');var path=require(_0x32d2('0x0'));var BPromise=require(_0x32d2('0x1'));var rs=require(_0x32d2('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x391254,_0x3b2213,_0x115f6d){return new BPromise(function(_0x3a2aea,_0x1b6efd){_0x391254[_0x32d2('0x3')](_0x3b2213,function(_0x5a0057,_0x5dd676){if(_0x5a0057){_0x1b6efd(_0x5a0057);}else if(_0x5dd676){if(_0x5dd676[_0x32d2('0x4')]instanceof Buffer){fs[_0x32d2('0x5')](_0x115f6d,_0x5dd676[_0x32d2('0x4')],function(_0x31a7ef){if(_0x31a7ef){_0x1b6efd(_0x31a7ef);}else{_0x3a2aea();}});}else{_0x1b6efd(new Error(_0x32d2('0x6')));}}else{_0x1b6efd(new Error(_0x32d2('0x7')));}});});}module['exports']=function(_0x37819d,_0x2bd6a6,_0x5d333b,_0x508134,_0x1e9874,_0x3b4644,_0x5533ec){var _0x35e492=new AWS[(_0x32d2('0x8'))]({'accessKeyId':_0x37819d,'secretAccessKey':_0x2bd6a6,'region':_0x5d333b});var _0x3e4c91={'Text':_0x1e9874,'TextType':_0x3b4644||_0x32d2('0x9'),'OutputFormat':_0x32d2('0xa'),'VoiceId':_0x508134};return pollyResult(_0x35e492,_0x3e4c91,_0x5533ec);}; \ 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 cb0da90..3107f05 100644 --- a/server/services/agi/scripts/google/asr/index.js +++ b/server/services/agi/scripts/google/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81ef=['./lib/api'];(function(_0x11930d,_0x1c69f0){var _0x23e47b=function(_0x1c802e){while(--_0x1c802e){_0x11930d['push'](_0x11930d['shift']());}};_0x23e47b(++_0x1c69f0);}(_0x81ef,0x90));var _0xf81e=function(_0x890769,_0x1c8085){_0x890769=_0x890769-0x0;var _0x46ece3=_0x81ef[_0x890769];return _0x46ece3;};'use strict';var asr=require(_0xf81e('0x0'));module['exports']=function(_0x429a13,_0x25b572,_0x9f6af1,_0xf48d3b){return asr(_0x429a13,_0x25b572,_0x9f6af1);}; \ No newline at end of file +var _0x178e=['./lib/api'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x178e,0x71));var _0xe178=function(_0x1b664d,_0x1d8695){_0x1b664d=_0x1b664d-0x0;var _0x43af6b=_0x178e[_0x1b664d];return _0x43af6b;};'use strict';var asr=require(_0xe178('0x0'));module['exports']=function(_0xf1c6c9,_0x1447ce,_0x2d5267,_0x311b4a){return asr(_0xf1c6c9,_0x1447ce,_0x2d5267);}; \ 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 bf34e0f..d607ca5 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 _0xdab2=['lang\x20should\x20be\x20a\x20string','readFileSync','POST','/v1/speech:recognize?key=','url','bluebird','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined'];(function(_0x45ad8b,_0x4a8017){var _0x2da38a=function(_0x2c84c2){while(--_0x2c84c2){_0x45ad8b['push'](_0x45ad8b['shift']());}};_0x2da38a(++_0x4a8017);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var url=require(_0x2dab('0x0'));var BPromise=require(_0x2dab('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x2dab('0x2')]=function(_0x2aa420,_0x37079c,_0x16ac06){return new BPromise(function(_0x56a9cc,_0x2078be){var _0x2480cb;if(typeof _0x2aa420!==_0x2dab('0x3')||_0x2aa420[_0x2dab('0x4')]===0x0){return _0x2078be(_0x2dab('0x5'));}if(typeof _0x37079c!==_0x2dab('0x3')||_0x37079c[_0x2dab('0x4')]===0x0){return _0x2078be(_0x2dab('0x6'));}if(typeof _0x16ac06!==_0x2dab('0x7')&&(typeof _0x16ac06!==_0x2dab('0x3')||_0x16ac06[_0x2dab('0x4')]===0x0)){return _0x2078be(_0x2dab('0x8'));}try{_0x2480cb=fs[_0x2dab('0x9')](_0x2aa420)['toString']('base64');}catch(_0x26852f){return _0x2078be(_0x26852f);}return _0x56a9cc({'method':_0x2dab('0xa'),'uri':host+_0x2dab('0xb')+_0x37079c,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':'8000','languageCode':_0x16ac06},'audio':{'content':_0x2480cb}},'json':!![]});});}; \ No newline at end of file +var _0x9221=['toString','base64','/v1/speech:recognize?key=','LINEAR16','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x42780d,_0x21fc28){var _0x4d8dae=function(_0x177fe2){while(--_0x177fe2){_0x42780d['push'](_0x42780d['shift']());}};_0x4d8dae(++_0x21fc28);}(_0x9221,0x64));var _0x1922=function(_0x2a4692,_0x5db910){_0x2a4692=_0x2a4692-0x0;var _0x370e6b=_0x9221[_0x2a4692];return _0x370e6b;};'use strict';var url=require('url');var BPromise=require(_0x1922('0x0'));var fs=require('fs');var host=_0x1922('0x1');module['exports']=function(_0x23df25,_0x1099ca,_0x5f14f2){return new BPromise(function(_0x309b6b,_0x43c8a3){var _0x459eee;if(typeof _0x23df25!==_0x1922('0x2')||_0x23df25[_0x1922('0x3')]===0x0){return _0x43c8a3(_0x1922('0x4'));}if(typeof _0x1099ca!==_0x1922('0x2')||_0x1099ca['length']===0x0){return _0x43c8a3(_0x1922('0x5'));}if(typeof _0x5f14f2!==_0x1922('0x6')&&(typeof _0x5f14f2!==_0x1922('0x2')||_0x5f14f2['length']===0x0)){return _0x43c8a3(_0x1922('0x7'));}try{_0x459eee=fs['readFileSync'](_0x23df25)[_0x1922('0x8')](_0x1922('0x9'));}catch(_0x1082d8){return _0x43c8a3(_0x1082d8);}return _0x309b6b({'method':'POST','uri':host+_0x1922('0xa')+_0x1099ca,'body':{'config':{'encoding':_0x1922('0xb'),'sampleRateHertz':'8000','languageCode':_0x5f14f2},'audio':{'content':_0x459eee}},'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 e6f67d0..5c77c7b 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 _0x4eae=['./asr'];(function(_0x295e6d,_0xeb1975){var _0x20edfa=function(_0x3ce783){while(--_0x3ce783){_0x295e6d['push'](_0x295e6d['shift']());}};_0x20edfa(++_0xeb1975);}(_0x4eae,0xdc));var _0xe4ea=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0x4eae[_0x4b91c4];return _0x25cb80;};var asr=require(_0xe4ea('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x9a9b=['exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a9b,0x80));var _0xb9a9=function(_0x352e09,_0x37a7da){_0x352e09=_0x352e09-0x0;var _0x1b7094=_0x9a9b[_0x352e09];return _0x1b7094;};var asr=require('./asr');module[_0xb9a9('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index cfc4986..6473a6b 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 _0x161b=['boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20confidence','awsPolly','polly','ispeechTTS','%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','nda','text','channelData','AudioFromTts','audiofile','dirName','bluebird','dialogflow','http','https','md5','path','querystring','randomstring','sox','google-tts-api','url','parse','util','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','unlink','pipe','end','WHAT_EVER','data','transcode','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','text:synthesize','POST','.mp3','from','audioContent','then','googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','generic','slice','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','[%s]\x20%s:%s','name','message','textRequest','result','resolvedQuery','action','fulfillment','score','code','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','queryResult','allRequiredParamsPresent','diagnosticInfo','fields'];(function(_0x3b2d98,_0xaa0b26){var _0x256bf1=function(_0x1fe933){while(--_0x1fe933){_0x3b2d98['push'](_0x3b2d98['shift']());}};_0x256bf1(++_0xaa0b26);}(_0x161b,0x19d));var _0xb161=function(_0x1f1bda,_0x49bf67){_0x1f1bda=_0x1f1bda-0x0;var _0x357549=_0x161b[_0x1f1bda];return _0x357549;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0xb161('0x0'));var dialogflow=require(_0xb161('0x1'));var fs=require('fs');var http=require(_0xb161('0x2'));var https=require(_0xb161('0x3'));var md5=require(_0xb161('0x4'));var path=require(_0xb161('0x5'));var querystring=require(_0xb161('0x6'));var rp=require('request-promise');var rs=require(_0xb161('0x7'));var sox=require(_0xb161('0x8'));var tts=require(_0xb161('0x9'));var urlParse=require(_0xb161('0xa'))[_0xb161('0xb')];var util=require(_0xb161('0xc'));var aws=require('./aws');var google=require(_0xb161('0xd'));var sestek=require('./sestek');var tilde=require(_0xb161('0xe'));var logger=require(_0xb161('0xf'))(_0xb161('0x10'));var ISPEECH_API=_0xb161('0x11');function downloadFile(_0x5db0dc,_0x438827){return new BPromise(function(_0x607e64,_0x3cb09c){var _0x519749=urlParse(_0x5db0dc);var _0x3c7cb6=_0x519749[_0xb161('0x12')]===_0xb161('0x13')?https:http;var _0x1df433={'host':_0x519749[_0xb161('0x14')],'path':_0x519749[_0xb161('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x3c7cb6[_0xb161('0x15')](_0x1df433,function(_0x4b38b7){if(_0x4b38b7['statusCode']!==0xc8){logger[_0xb161('0x16')](_0xb161('0x17')+_0x5db0dc+_0xb161('0x18')+_0x4b38b7['statusCode']+'\x20('+_0x4b38b7['statusMessage']+')');_0x3cb09c(new Error(_0xb161('0x17')+_0x5db0dc+_0xb161('0x18')+_0x4b38b7[_0xb161('0x19')]+'\x20('+_0x4b38b7[_0xb161('0x1a')]+')'));return;}var _0x39465d=fs['createWriteStream'](_0x438827);_0x39465d['on'](_0xb161('0x1b'),function(){logger[_0xb161('0x1c')](_0xb161('0x1d'));_0x39465d[_0xb161('0x1e')](_0x607e64);});_0x39465d['on'](_0xb161('0x16'),function(_0x32035a){fs[_0xb161('0x1f')](_0x438827);logger[_0xb161('0x16')]('download\x20error',_0x32035a);_0x3cb09c(_0x32035a);});_0x4b38b7[_0xb161('0x20')](_0x39465d);})['on']('error',function(_0x1c10ae){logger[_0xb161('0x16')](_0x1c10ae);_0x3cb09c(_0x1c10ae);})[_0xb161('0x21')]();});}function uploadFile(_0x3e2188){return new BPromise(function(_0xfc865c,_0x16908e){var _0x560fd3=urlParse(_0x3e2188);var _0x27dc51=_0x560fd3['protocol']===_0xb161('0x13')?https:http;var _0x101e6f={'host':_0x560fd3[_0xb161('0x14')],'path':_0x560fd3['path'],'headers':{'user-agent':_0xb161('0x22')}};_0x27dc51[_0xb161('0x15')](_0x101e6f,function(_0x43169c){if(_0x43169c[_0xb161('0x19')]!==0xc8){_0x16908e(new Error(_0xb161('0x17')+_0x3e2188+_0xb161('0x18')+_0x43169c[_0xb161('0x19')]+'\x20('+_0x43169c['statusMessage']+')'));return;}var _0x1c434d='';_0x43169c['on'](_0xb161('0x23'),function(_0x423f94){_0x1c434d+=_0x423f94;});_0x43169c['on'](_0xb161('0x21'),function(){_0xfc865c(_0x1c434d);});})['on'](_0xb161('0x16'),function(_0x40e599){_0x16908e(_0x40e599);})[_0xb161('0x21')]();});}function convertFile(_0x450bff,_0x163431){return new BPromise(function(_0x4badc1,_0x2c3a0d){var _0x13fb86=sox[_0xb161('0x24')](_0x450bff,_0x163431,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x13fb86['on'](_0xb161('0x16'),function(_0x423a2f){logger['error']('error\x20convert',_0x423a2f);_0x2c3a0d(_0x423a2f);});_0x13fb86['on'](_0xb161('0x21'),function(){logger[_0xb161('0x1c')](_0xb161('0x25'));_0x4badc1();});_0x13fb86[_0xb161('0x26')]();});}function base64Decode(_0x3e57c0,_0x4024ed){var _0x4fb368=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));fs[_0xb161('0x2b')](_0x4fb368,_0x3e57c0,_0xb161('0x2c'));return convertFile(_0x4fb368,_0x4024ed)['then'](function(){try{fs[_0xb161('0x1f')](_0x4fb368);fs[_0xb161('0x2d')](_0x4024ed,_0xb161('0x2e'));}catch(_0x1b364a){logger['error'](_0x1b364a);}return _0x4024ed[_0xb161('0x2f')]('.')[0x0];});}function base64Encode(_0xc8a153){var _0x4e3049=fs[_0xb161('0x30')](_0xc8a153);return new Buffer(_0x4e3049)[_0xb161('0x31')]('base64');}exports[_0xb161('0x32')]=function(_0x557055,_0x1e8974,_0x2753d7,_0x54e084,_0x1dd331,_0x55bfa7){var _0x27f0fc,_0x4a2d4c;var _0x565059=_0xb161('0x33');var _0x246675=_0xb161('0x34')+_0x557055;var _0x399d47={};if(_0x1e8974===_0xb161('0x35')){_0x399d47[_0xb161('0x36')]={'ssml':_0x2753d7};}else{_0x399d47[_0xb161('0x36')]={'text':_0x2753d7};};_0x399d47[_0xb161('0x37')]={'languageCode':_0x54e084,'ssmlGender':_0x1dd331};_0x399d47[_0xb161('0x38')]={'audioEncoding':'MP3','sampleRateHertz':0x1f40};var _0x5eedb0={'url':_0x565059+_0xb161('0x39')+_0x246675,'method':_0xb161('0x3a'),'json':!![],'body':_0x399d47};return rp(_0x5eedb0)['then'](function(_0x4cacd6){return new BPromise(function(_0x229f8c,_0x487089){_0x27f0fc=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x3b'));var _0x1a9c18=Buffer[_0xb161('0x3c')](_0x4cacd6[_0xb161('0x3d')],'base64');return fs['writeFile'](_0x27f0fc,_0x1a9c18,function(_0x3bf39a){_0x487089(_0x3bf39a);},function(_0x6324f2){fs[_0xb161('0x2d')](_0x27f0fc,_0xb161('0x2e'));_0x229f8c(_0x6324f2);});});})['then'](function(_0xff1302){_0x4a2d4c=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));return convertFile(_0x27f0fc,_0x4a2d4c);})[_0xb161('0x3e')](function(){try{fs[_0xb161('0x1f')](_0x27f0fc);fs[_0xb161('0x2d')](_0x4a2d4c,_0xb161('0x2e'));}catch(_0x22f0ff){logger[_0xb161('0x16')](_0x22f0ff);}logger[_0xb161('0x1c')]('googleCloudTTS\x20path',_0x4a2d4c[_0xb161('0x2f')]('.')[0x0]);return _0x4a2d4c[_0xb161('0x2f')]('.')[0x0];});};exports[_0xb161('0x3f')]=function(_0xbb2979,_0x3dc130){var _0x2ebf79='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x448552,_0x5f5e17;var _0xcafcc5;var _0x286f06={'encoding':_0xb161('0x40'),'method':_0xb161('0x3a'),'timeout':0x2710,'url':_0x2ebf79,'headers':{'Content-Type':_0xb161('0x41')},'body':_0xb161('0x42')+encodeURIComponent(JSON[_0xb161('0x43')]([[[_0xb161('0x44'),JSON['stringify']([_0xbb2979,_0x3dc130||'en',![],_0xb161('0x45')]),null,_0xb161('0x46')]]]))};return rp(_0x286f06)[_0xb161('0x3e')](function(_0x54c24e){try{_0xcafcc5=eval(_0x54c24e[_0xb161('0x47')](0x5))[0x0][0x2];}catch(_0x1b57c2){throw new Error('parse\x20response\x20failed:\x0a'+_0x54c24e[_0xb161('0x23')]);}if(!_0xcafcc5){if(_0xbb2979[_0xb161('0x48')]>0xc8){throw new Error(_0xb161('0x49'));}else{throw new Error(_0xb161('0x4a')+_0x3dc130+_0xb161('0x4b'));}}try{_0xcafcc5=eval(_0xcafcc5)[0x0];}catch(_0x229f51){throw new Error(_0xb161('0x4c')+res[_0xb161('0x23')]);}const _0xf475a9=_0xcafcc5;_0x448552=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+'.mp3');fs[_0xb161('0x2b')](_0x448552,_0xcafcc5,{'encoding':_0xb161('0x2c')});_0x5f5e17=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));return convertFile(_0x448552,_0x5f5e17);})['then'](function(){try{fs['unlink'](_0x448552);fs[_0xb161('0x2d')](_0x5f5e17,_0xb161('0x2e'));}catch(_0xb5d513){logger[_0xb161('0x16')](_0xb5d513);}logger[_0xb161('0x1c')](_0xb161('0x4d'),_0x5f5e17[_0xb161('0x2f')]('.')[0x0]);return _0x5f5e17[_0xb161('0x2f')]('.')[0x0];});};exports['googleASR']=function(_0x140de1,_0x2f60d3,_0x5249c8){return google[_0xb161('0x4e')](_0x140de1,_0x2f60d3,_0x5249c8)[_0xb161('0x3e')](function(_0x1b64d1){logger[_0xb161('0x1c')](_0x1b64d1[_0xb161('0x4f')]);return rp(_0x1b64d1);})['then'](function(_0x305608){var _0x319210='';var _0x500109=0x0;try{fs['unlink'](_0x140de1);}catch(_0x33fac7){logger['error'](_0x33fac7);}if(_0x305608&&_0x305608[_0xb161('0x50')]){_0x319210=_0x305608[_0xb161('0x50')][_0xb161('0x51')](function(_0x4e827a){return _0x4e827a&&_0x4e827a[_0xb161('0x52')][0x0]&&_0x4e827a['alternatives'][0x0][_0xb161('0x53')]?_0x4e827a[_0xb161('0x52')][0x0][_0xb161('0x53')]:'';})[_0xb161('0x54')]('\x0a');_0x500109=_0x305608[_0xb161('0x50')][_0xb161('0x51')](function(_0x4b9261){return _0x4b9261&&_0x4b9261['alternatives'][0x0]&&_0x4b9261['alternatives'][0x0][_0xb161('0x55')]?_0x4b9261[_0xb161('0x52')][0x0]['confidence']:0x0;})[_0xb161('0x54')]('\x0a');}logger[_0xb161('0x1c')]('googleASR\x20transcription',_0x319210);logger[_0xb161('0x1c')]('googleASR\x20confidence',_0x500109);return{'transcript':_0x319210,'confidence':_0x500109};})['catch'](function(_0x3d103d){logger['error'](_0xb161('0x56'),_0x3d103d[_0xb161('0x19')],_0x3d103d[_0xb161('0x57')],_0x3d103d[_0xb161('0x58')]);});};exports['googleDialogflow']=function(_0x1c7399,_0x37af74,_0x2a5384,_0x5dff61){var _0x4c3253=apiai(_0x37af74,{'language':_0x5dff61||'en'});return _0x4c3253[_0xb161('0x59')](_0x2a5384,{'sessionId':md5(_0x1c7399)})['then'](function(_0x38b4c7){logger[_0xb161('0x1c')](JSON[_0xb161('0x43')](_0x38b4c7));return{'source':_0x38b4c7['result']['source'],'resolvedQuery':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x5b')],'action':_0x38b4c7['result'][_0xb161('0x5c')],'actionIncomplete':_0x38b4c7[_0xb161('0x5a')]['actionIncomplete'],'speech':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x5d')]['speech'],'score':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x5e')],'statusCode':_0x38b4c7['status'][_0xb161('0x5f')],'endConversation':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x60')][_0xb161('0x61')]||![],'isFallbackIntent':_0x38b4c7[_0xb161('0x5a')][_0xb161('0x60')]['isFallbackIntent']};});};exports[_0xb161('0x62')]=function(_0x399d42,_0xca4278,_0x31d986,_0x51819c,_0x230321,_0x5dc200){var _0xe20b53=_0x51819c[_0xb161('0x63')](/\\n/g,'\x0a');var _0x11e12e={'credentials':{'private_key':_0xe20b53,'client_email':_0x31d986}};var _0x1af657=new dialogflow[(_0xb161('0x64'))](_0x11e12e);var _0x3d520d=_0x1af657[_0xb161('0x65')](_0xca4278,md5(_0x399d42));var _0x5773cf={'session':_0x3d520d,'queryInput':{'text':{'text':_0x230321,'languageCode':_0x5dc200}}};return _0x1af657[_0xb161('0x66')](_0x5773cf)[_0xb161('0x3e')](function(_0x5ac283){if(_0x5ac283&&_0x5ac283[_0xb161('0x48')]){logger[_0xb161('0x1c')]('Dialogflow\x20V2\x20response:',JSON['stringify'](_0x5ac283));var _0x3bda6f=_0x5ac283[0x0];if(_0x3bda6f){var _0x2a54a4={'action':_0x3bda6f['queryResult']['action'],'allRequiredParamsPresent':_0x3bda6f[_0xb161('0x67')][_0xb161('0x68')],'endConversation':_0x3bda6f[_0xb161('0x67')][_0xb161('0x69')]&&_0x3bda6f[_0xb161('0x67')][_0xb161('0x69')][_0xb161('0x6a')]?_0x3bda6f[_0xb161('0x67')][_0xb161('0x69')][_0xb161('0x6a')]['end_conversation'][_0xb161('0x6b')]:![],'fulfillmentText':_0x3bda6f['queryResult'][_0xb161('0x6c')],'intentName':_0x3bda6f[_0xb161('0x67')][_0xb161('0x6d')][_0xb161('0x57')],'intentDisplayName':_0x3bda6f['queryResult'][_0xb161('0x6d')][_0xb161('0x6e')],'isFallbackIntent':_0x3bda6f[_0xb161('0x67')]['intent'][_0xb161('0x6f')],'languageCode':_0x3bda6f[_0xb161('0x67')][_0xb161('0x70')],'queryText':_0x3bda6f[_0xb161('0x67')][_0xb161('0x71')],'responseId':_0x3bda6f[_0xb161('0x72')],'score':_0x3bda6f[_0xb161('0x67')][_0xb161('0x73')],'speech':_0x3bda6f[_0xb161('0x67')]['fulfillmentText'],'providerResponse':JSON['stringify'](_0x5ac283)};return _0x2a54a4;}}});};exports[_0xb161('0x74')]=function(_0x267c48,_0xf04027,_0x2ade8f,_0x4f8777){return tilde['asr'](_0x267c48,_0xf04027,_0x2ade8f,_0x4f8777)[_0xb161('0x3e')](function(_0x4763ca){try{fs[_0xb161('0x1f')](_0x267c48);}catch(_0x3b9ea1){logger[_0xb161('0x16')](_0x3b9ea1);}logger[_0xb161('0x1c')]('Tilde\x20ASR\x20transcription',_0x4763ca[_0xb161('0x53')]);logger[_0xb161('0x1c')](_0xb161('0x75'),_0x4763ca['confidence']);return _0x4763ca;});};exports[_0xb161('0x76')]=function(_0x5f0c2c,_0x3f9bae,_0x5aab86,_0x348ff6,_0x1a3836,_0x1863d9){var _0xfc6e49=path[_0xb161('0x27')](__dirname,'tmp',rs['generate'](0x4)+_0xb161('0x3b'));var _0x10afc9;return aws[_0xb161('0x77')](_0x5f0c2c,_0x3f9bae,_0x5aab86,_0x348ff6,_0x1a3836,_0x1863d9,_0xfc6e49)[_0xb161('0x3e')](function(){_0x10afc9=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+'.wav');return convertFile(_0xfc6e49,_0x10afc9);})[_0xb161('0x3e')](function(){try{fs[_0xb161('0x1f')](_0xfc6e49);fs[_0xb161('0x2d')](_0x10afc9,_0xb161('0x2e'));}catch(_0x355861){logger[_0xb161('0x16')](_0x355861);}return _0x10afc9[_0xb161('0x2f')]('.')[0x0];});};exports['awsLex']=function(_0x536eef,_0x561bcb,_0x20ec5e,_0x3713b5,_0x3b6461,_0xf0af6a){return aws['lex'](_0x536eef,_0x561bcb,_0x20ec5e,_0x3713b5,_0x3b6461,_0xf0af6a)[_0xb161('0x3e')](function(_0x23ee94){logger[_0xb161('0x1c')](JSON[_0xb161('0x43')](_0x23ee94));return _0x23ee94;});};exports[_0xb161('0x78')]=function(_0x104b20,_0xad490c,_0x5f2b61,_0x25031c){var _0x5e6d33=util['format'](_0xb161('0x79'),ISPEECH_API,_0x104b20,encodeURIComponent(_0xad490c),_0x5f2b61,_0x25031c);var _0x578b37=path['resolve'](__dirname,_0xb161('0x28'),rs['generate'](0x4)+_0xb161('0x3b'));var _0x825f7f;return downloadFile(_0x5e6d33,_0x578b37)[_0xb161('0x3e')](function(){_0x825f7f=path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs[_0xb161('0x29')](0x4)+_0xb161('0x2a'));return convertFile(_0x578b37,_0x825f7f);})['then'](function(){try{fs['unlink'](_0x578b37);fs[_0xb161('0x2d')](_0x825f7f,_0xb161('0x2e'));}catch(_0x4f4ce7){logger['error'](_0x4f4ce7);}return _0x825f7f['split']('.')[0x0];});};exports[_0xb161('0x7a')]=function(_0x5e6ede,_0x445a82,_0x53e269,_0x57e009){var _0x20253d=util['format'](_0xb161('0x7b'),ISPEECH_API,_0x445a82,_0x53e269,base64Encode(_0x5e6ede),_0x57e009?util['format']('model=%s',encodeURIComponent(_0x57e009)):'freeform=3');return uploadFile(_0x20253d)['then'](function(_0x2bebe1){return querystring[_0xb161('0xb')](_0x2bebe1);});};exports['sestekNDA']=function(_0x2bba23,_0x3c440d){return sestek[_0xb161('0x7c')](_0x2bba23,_0x3c440d)[_0xb161('0x3e')](function(_0x34a88a){logger['info'](JSON[_0xb161('0x43')](_0x34a88a));var _0x3e084c={'speech':_0x34a88a[_0xb161('0x7d')],'action':_0x34a88a[_0xb161('0x7e')]?_0x34a88a['channelData']['CustomAction']:undefined,'actiondata':_0x34a88a[_0xb161('0x7e')]?_0x34a88a[_0xb161('0x7e')]['CustomActionData']:undefined};if(_0x34a88a[_0xb161('0x7e')]&&_0x34a88a[_0xb161('0x7e')][_0xb161('0x7f')]){return base64Decode(_0x34a88a[_0xb161('0x7e')][_0xb161('0x7f')]['Data'],path[_0xb161('0x27')](__dirname,_0xb161('0x28'),rs['generate'](0x4)+_0xb161('0x2a')))[_0xb161('0x3e')](function(_0x198eaa){_0x3e084c[_0xb161('0x80')]=_0x198eaa;return _0x3e084c;});}return _0x3e084c;});};exports[_0xb161('0x81')]=function(){return __dirname;}; \ No newline at end of file +var _0x67c7=['?key=','ssml','input','voice','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','chmodSync','googleCloudTTS\x20path','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','parse\x20response\x20failed:\x0a','.mp3','goggleTTS\x20path','asr','results','alternatives','transcript','join','googleASR\x20transcription','catch','name','message','googleDialogflow','textRequest','result','resolvedQuery','fulfillment','speech','score','status','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','detectIntent','length','queryResult','action','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','model=%s','sestekNDA','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','host','statusCode','statusMessage','finish','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','https:','WHAT_EVER','get','\x20failed,\x20status\x20code\x20=\x20','data','end','transcode','error\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','then','777','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/'];(function(_0x51a3cc,_0x16a5ef){var _0x151fc=function(_0x1498a2){while(--_0x1498a2){_0x51a3cc['push'](_0x51a3cc['shift']());}};_0x151fc(++_0x16a5ef);}(_0x67c7,0xdc));var _0x767c=function(_0x243bba,_0x1ea69f){_0x243bba=_0x243bba-0x0;var _0x12e696=_0x67c7[_0x243bba];return _0x12e696;};'use strict';var apiai=require('apiai-promise');var BPromise=require(_0x767c('0x0'));var dialogflow=require(_0x767c('0x1'));var fs=require('fs');var http=require('http');var https=require(_0x767c('0x2'));var md5=require(_0x767c('0x3'));var path=require(_0x767c('0x4'));var querystring=require(_0x767c('0x5'));var rp=require(_0x767c('0x6'));var rs=require(_0x767c('0x7'));var sox=require(_0x767c('0x8'));var tts=require(_0x767c('0x9'));var urlParse=require('url')[_0x767c('0xa')];var util=require(_0x767c('0xb'));var aws=require(_0x767c('0xc'));var google=require(_0x767c('0xd'));var sestek=require('./sestek');var tilde=require(_0x767c('0xe'));var logger=require(_0x767c('0xf'))(_0x767c('0x10'));var ISPEECH_API=_0x767c('0x11');function downloadFile(_0x2f7e21,_0x3e6d32){return new BPromise(function(_0x5c29b7,_0x5287bd){var _0xeec530=urlParse(_0x2f7e21);var _0x36cddd=_0xeec530[_0x767c('0x12')]==='https:'?https:http;var _0x1f9a9c={'host':_0xeec530[_0x767c('0x13')],'path':_0xeec530[_0x767c('0x4')],'headers':{'user-agent':'WHAT_EVER'}};_0x36cddd['get'](_0x1f9a9c,function(_0x1696bc){if(_0x1696bc[_0x767c('0x14')]!==0xc8){logger['error']('request\x20to\x20'+_0x2f7e21+'\x20failed,\x20status\x20code\x20=\x20'+_0x1696bc[_0x767c('0x14')]+'\x20('+_0x1696bc[_0x767c('0x15')]+')');_0x5287bd(new Error('request\x20to\x20'+_0x2f7e21+'\x20failed,\x20status\x20code\x20=\x20'+_0x1696bc[_0x767c('0x14')]+'\x20('+_0x1696bc[_0x767c('0x15')]+')'));return;}var _0x1bedce=fs['createWriteStream'](_0x3e6d32);_0x1bedce['on'](_0x767c('0x16'),function(){logger[_0x767c('0x17')](_0x767c('0x18'));_0x1bedce[_0x767c('0x19')](_0x5c29b7);});_0x1bedce['on'](_0x767c('0x1a'),function(_0xa468b4){fs[_0x767c('0x1b')](_0x3e6d32);logger['error'](_0x767c('0x1c'),_0xa468b4);_0x5287bd(_0xa468b4);});_0x1696bc[_0x767c('0x1d')](_0x1bedce);})['on'](_0x767c('0x1a'),function(_0x201135){logger[_0x767c('0x1a')](_0x201135);_0x5287bd(_0x201135);})['end']();});}function uploadFile(_0x2e4aa1){return new BPromise(function(_0x5a0008,_0x25c800){var _0x5a3a6a=urlParse(_0x2e4aa1);var _0x634812=_0x5a3a6a[_0x767c('0x12')]===_0x767c('0x1e')?https:http;var _0xaa5862={'host':_0x5a3a6a[_0x767c('0x13')],'path':_0x5a3a6a['path'],'headers':{'user-agent':_0x767c('0x1f')}};_0x634812[_0x767c('0x20')](_0xaa5862,function(_0x20ac2f){if(_0x20ac2f[_0x767c('0x14')]!==0xc8){_0x25c800(new Error('request\x20to\x20'+_0x2e4aa1+_0x767c('0x21')+_0x20ac2f[_0x767c('0x14')]+'\x20('+_0x20ac2f[_0x767c('0x15')]+')'));return;}var _0x34dd2e='';_0x20ac2f['on'](_0x767c('0x22'),function(_0x34e079){_0x34dd2e+=_0x34e079;});_0x20ac2f['on']('end',function(){_0x5a0008(_0x34dd2e);});})['on'](_0x767c('0x1a'),function(_0x52f892){_0x25c800(_0x52f892);})[_0x767c('0x23')]();});}function convertFile(_0x21db9e,_0x420c8e){return new BPromise(function(_0x9e4243,_0x5c583c){var _0x45f68e=sox[_0x767c('0x24')](_0x21db9e,_0x420c8e,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x45f68e['on'](_0x767c('0x1a'),function(_0x15ec07){logger['error'](_0x767c('0x25'),_0x15ec07);_0x5c583c(_0x15ec07);});_0x45f68e['on'](_0x767c('0x23'),function(){logger[_0x767c('0x17')]('finish\x20to\x20convert');_0x9e4243();});_0x45f68e[_0x767c('0x26')]();});}function base64Decode(_0xf712f8,_0x1fada1){var _0x1631ed=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x2a'));fs[_0x767c('0x2b')](_0x1631ed,_0xf712f8,'base64');return convertFile(_0x1631ed,_0x1fada1)[_0x767c('0x2c')](function(){try{fs['unlink'](_0x1631ed);fs['chmodSync'](_0x1fada1,_0x767c('0x2d'));}catch(_0x2f8116){logger['error'](_0x2f8116);}return _0x1fada1['split']('.')[0x0];});}function base64Encode(_0x39565c){var _0x499f88=fs['readFileSync'](_0x39565c);return new Buffer(_0x499f88)[_0x767c('0x2e')](_0x767c('0x2f'));}exports[_0x767c('0x30')]=function(_0xba291,_0x54c49b,_0x198ccb,_0x1ef67a,_0xda0e45,_0x3468c5){var _0x217e15,_0x1f8c5e;var _0x432cc0=_0x767c('0x31');var _0x49e7f1=_0x767c('0x32')+_0xba291;var _0x30a0f0={};if(_0x54c49b===_0x767c('0x33')){_0x30a0f0[_0x767c('0x34')]={'ssml':_0x198ccb};}else{_0x30a0f0['input']={'text':_0x198ccb};};_0x30a0f0[_0x767c('0x35')]={'languageCode':_0x1ef67a,'ssmlGender':_0xda0e45};_0x30a0f0[_0x767c('0x36')]={'audioEncoding':_0x767c('0x37'),'sampleRateHertz':0x1f40};var _0x1d2e37={'url':_0x432cc0+_0x767c('0x38')+_0x49e7f1,'method':_0x767c('0x39'),'json':!![],'body':_0x30a0f0};return rp(_0x1d2e37)[_0x767c('0x2c')](function(_0x73eca9){return new BPromise(function(_0x48e62b,_0x48f22c){_0x217e15=path['resolve'](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+'.mp3');var _0x215a2d=Buffer[_0x767c('0x3a')](_0x73eca9[_0x767c('0x3b')],_0x767c('0x2f'));return fs[_0x767c('0x3c')](_0x217e15,_0x215a2d,function(_0x25e722){_0x48f22c(_0x25e722);},function(_0x149eaa){fs['chmodSync'](_0x217e15,'777');_0x48e62b(_0x149eaa);});});})[_0x767c('0x2c')](function(_0x3b4c6c){_0x1f8c5e=path['resolve'](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x2a'));return convertFile(_0x217e15,_0x1f8c5e);})[_0x767c('0x2c')](function(){try{fs['unlink'](_0x217e15);fs[_0x767c('0x3d')](_0x1f8c5e,_0x767c('0x2d'));}catch(_0x537002){logger['error'](_0x537002);}logger[_0x767c('0x17')](_0x767c('0x3e'),_0x1f8c5e['split']('.')[0x0]);return _0x1f8c5e[_0x767c('0x3f')]('.')[0x0];});};exports[_0x767c('0x40')]=function(_0x2db72c,_0x161a9e){var _0x1e2d0c=_0x767c('0x41');var _0x307d49,_0x450bf5;var _0x550186;var _0x30003a={'encoding':_0x767c('0x42'),'method':_0x767c('0x39'),'timeout':0x2710,'url':_0x1e2d0c,'headers':{'Content-Type':_0x767c('0x43')},'body':_0x767c('0x44')+encodeURIComponent(JSON['stringify']([[['jQ1olc',JSON[_0x767c('0x45')]([_0x2db72c,_0x161a9e||'en',![],_0x767c('0x46')]),null,_0x767c('0x47')]]]))};return rp(_0x30003a)[_0x767c('0x2c')](function(_0x587d16){try{_0x550186=eval(_0x587d16['slice'](0x5))[0x0][0x2];}catch(_0x4c49d2){throw new Error('parse\x20response\x20failed:\x0a'+_0x587d16['data']);}if(!_0x550186){if(_0x2db72c['length']>0xc8){throw new Error(_0x767c('0x48'));}else{throw new Error(_0x767c('0x49')+_0x161a9e+_0x767c('0x4a'));}}try{_0x550186=eval(_0x550186)[0x0];}catch(_0x4e6b90){throw new Error(_0x767c('0x4b')+res[_0x767c('0x22')]);}const _0x11cbf1=_0x550186;_0x307d49=path['resolve'](__dirname,_0x767c('0x28'),rs['generate'](0x4)+_0x767c('0x4c'));fs[_0x767c('0x2b')](_0x307d49,_0x550186,{'encoding':'base64'});_0x450bf5=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs['generate'](0x4)+_0x767c('0x2a'));return convertFile(_0x307d49,_0x450bf5);})[_0x767c('0x2c')](function(){try{fs[_0x767c('0x1b')](_0x307d49);fs['chmodSync'](_0x450bf5,_0x767c('0x2d'));}catch(_0x57daca){logger[_0x767c('0x1a')](_0x57daca);}logger['info'](_0x767c('0x4d'),_0x450bf5['split']('.')[0x0]);return _0x450bf5[_0x767c('0x3f')]('.')[0x0];});};exports['googleASR']=function(_0x2a63c8,_0xd1cac2,_0x53f673){return google[_0x767c('0x4e')](_0x2a63c8,_0xd1cac2,_0x53f673)['then'](function(_0x36f4e2){logger[_0x767c('0x17')](_0x36f4e2['uri']);return rp(_0x36f4e2);})['then'](function(_0x2ebce6){var _0x8410b2='';var _0x193353=0x0;try{fs['unlink'](_0x2a63c8);}catch(_0x14487e){logger['error'](_0x14487e);}if(_0x2ebce6&&_0x2ebce6[_0x767c('0x4f')]){_0x8410b2=_0x2ebce6['results']['map'](function(_0x422f81){return _0x422f81&&_0x422f81[_0x767c('0x50')][0x0]&&_0x422f81['alternatives'][0x0][_0x767c('0x51')]?_0x422f81[_0x767c('0x50')][0x0][_0x767c('0x51')]:'';})[_0x767c('0x52')]('\x0a');_0x193353=_0x2ebce6['results']['map'](function(_0x523b5b){return _0x523b5b&&_0x523b5b[_0x767c('0x50')][0x0]&&_0x523b5b['alternatives'][0x0]['confidence']?_0x523b5b[_0x767c('0x50')][0x0]['confidence']:0x0;})[_0x767c('0x52')]('\x0a');}logger[_0x767c('0x17')](_0x767c('0x53'),_0x8410b2);logger[_0x767c('0x17')]('googleASR\x20confidence',_0x193353);return{'transcript':_0x8410b2,'confidence':_0x193353};})[_0x767c('0x54')](function(_0x9c50fb){logger['error']('[%s]\x20%s:%s',_0x9c50fb['statusCode'],_0x9c50fb[_0x767c('0x55')],_0x9c50fb[_0x767c('0x56')]);});};exports[_0x767c('0x57')]=function(_0x5e720b,_0x5f2e2f,_0x346126,_0x39596b){var _0x90ef72=apiai(_0x5f2e2f,{'language':_0x39596b||'en'});return _0x90ef72[_0x767c('0x58')](_0x346126,{'sessionId':md5(_0x5e720b)})['then'](function(_0x92cf42){logger['info'](JSON[_0x767c('0x45')](_0x92cf42));return{'source':_0x92cf42[_0x767c('0x59')]['source'],'resolvedQuery':_0x92cf42['result'][_0x767c('0x5a')],'action':_0x92cf42['result']['action'],'actionIncomplete':_0x92cf42[_0x767c('0x59')]['actionIncomplete'],'speech':_0x92cf42['result'][_0x767c('0x5b')][_0x767c('0x5c')],'score':_0x92cf42['result'][_0x767c('0x5d')],'statusCode':_0x92cf42[_0x767c('0x5e')][_0x767c('0x5f')],'endConversation':_0x92cf42[_0x767c('0x59')]['metadata'][_0x767c('0x60')]||![],'isFallbackIntent':_0x92cf42[_0x767c('0x59')][_0x767c('0x61')][_0x767c('0x62')]};});};exports[_0x767c('0x63')]=function(_0x9da79,_0x5e2516,_0xc624d6,_0x3e6132,_0x235930,_0x445048){var _0x3fcf8a=_0x3e6132[_0x767c('0x64')](/\\n/g,'\x0a');var _0x47db3e={'credentials':{'private_key':_0x3fcf8a,'client_email':_0xc624d6}};var _0x11740f=new dialogflow['SessionsClient'](_0x47db3e);var _0x4dba92=_0x11740f['sessionPath'](_0x5e2516,md5(_0x9da79));var _0x46f4d8={'session':_0x4dba92,'queryInput':{'text':{'text':_0x235930,'languageCode':_0x445048}}};return _0x11740f[_0x767c('0x65')](_0x46f4d8)[_0x767c('0x2c')](function(_0x2ca53b){if(_0x2ca53b&&_0x2ca53b[_0x767c('0x66')]){logger[_0x767c('0x17')]('Dialogflow\x20V2\x20response:',JSON[_0x767c('0x45')](_0x2ca53b));var _0x3f2f7e=_0x2ca53b[0x0];if(_0x3f2f7e){var _0x543cf={'action':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x68')],'allRequiredParamsPresent':_0x3f2f7e[_0x767c('0x67')]['allRequiredParamsPresent'],'endConversation':_0x3f2f7e['queryResult'][_0x767c('0x69')]&&_0x3f2f7e[_0x767c('0x67')][_0x767c('0x69')][_0x767c('0x6a')]?_0x3f2f7e[_0x767c('0x67')][_0x767c('0x69')][_0x767c('0x6a')][_0x767c('0x6b')][_0x767c('0x6c')]:![],'fulfillmentText':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x6d')],'intentName':_0x3f2f7e['queryResult'][_0x767c('0x6e')][_0x767c('0x55')],'intentDisplayName':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x6e')][_0x767c('0x6f')],'isFallbackIntent':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x6e')][_0x767c('0x70')],'languageCode':_0x3f2f7e[_0x767c('0x67')][_0x767c('0x71')],'queryText':_0x3f2f7e[_0x767c('0x67')]['queryText'],'responseId':_0x3f2f7e[_0x767c('0x72')],'score':_0x3f2f7e[_0x767c('0x67')]['intentDetectionConfidence'],'speech':_0x3f2f7e[_0x767c('0x67')]['fulfillmentText'],'providerResponse':JSON[_0x767c('0x45')](_0x2ca53b)};return _0x543cf;}}});};exports[_0x767c('0x73')]=function(_0x246d3e,_0x4dfd71,_0x561e73,_0xfd98b9){return tilde['asr'](_0x246d3e,_0x4dfd71,_0x561e73,_0xfd98b9)[_0x767c('0x2c')](function(_0x50ec67){try{fs[_0x767c('0x1b')](_0x246d3e);}catch(_0x43546d){logger[_0x767c('0x1a')](_0x43546d);}logger[_0x767c('0x17')](_0x767c('0x74'),_0x50ec67['transcript']);logger['info'](_0x767c('0x75'),_0x50ec67[_0x767c('0x76')]);return _0x50ec67;});};exports[_0x767c('0x77')]=function(_0x1d0c42,_0x23ac36,_0x170eed,_0x18c0e1,_0x3da9b0,_0x167e5f){var _0x34804b=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs['generate'](0x4)+_0x767c('0x4c'));var _0xe0ee78;return aws[_0x767c('0x78')](_0x1d0c42,_0x23ac36,_0x170eed,_0x18c0e1,_0x3da9b0,_0x167e5f,_0x34804b)[_0x767c('0x2c')](function(){_0xe0ee78=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x2a'));return convertFile(_0x34804b,_0xe0ee78);})[_0x767c('0x2c')](function(){try{fs['unlink'](_0x34804b);fs[_0x767c('0x3d')](_0xe0ee78,_0x767c('0x2d'));}catch(_0xe0ebdb){logger[_0x767c('0x1a')](_0xe0ebdb);}return _0xe0ee78['split']('.')[0x0];});};exports[_0x767c('0x79')]=function(_0x5f5ca4,_0x471356,_0x2c3a41,_0x4f3bfb,_0x49665e,_0x2b1349){return aws[_0x767c('0x7a')](_0x5f5ca4,_0x471356,_0x2c3a41,_0x4f3bfb,_0x49665e,_0x2b1349)['then'](function(_0x592d0d){logger[_0x767c('0x17')](JSON[_0x767c('0x45')](_0x592d0d));return _0x592d0d;});};exports['ispeechTTS']=function(_0x4a563f,_0x544a2b,_0x9649e5,_0x4bfb6c){var _0x187512=util[_0x767c('0x7b')](_0x767c('0x7c'),ISPEECH_API,_0x4a563f,encodeURIComponent(_0x544a2b),_0x9649e5,_0x4bfb6c);var _0x353473=path[_0x767c('0x27')](__dirname,_0x767c('0x28'),rs[_0x767c('0x29')](0x4)+_0x767c('0x4c'));var _0x1490d6;return downloadFile(_0x187512,_0x353473)[_0x767c('0x2c')](function(){_0x1490d6=path[_0x767c('0x27')](__dirname,'tmp',rs[_0x767c('0x29')](0x4)+'.wav');return convertFile(_0x353473,_0x1490d6);})[_0x767c('0x2c')](function(){try{fs[_0x767c('0x1b')](_0x353473);fs['chmodSync'](_0x1490d6,_0x767c('0x2d'));}catch(_0x5097d5){logger[_0x767c('0x1a')](_0x5097d5);}return _0x1490d6[_0x767c('0x3f')]('.')[0x0];});};exports[_0x767c('0x7d')]=function(_0xcfbfcd,_0x3628de,_0x560e24,_0x1d5a2c){var _0x213c99=util[_0x767c('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3628de,_0x560e24,base64Encode(_0xcfbfcd),_0x1d5a2c?util[_0x767c('0x7b')](_0x767c('0x7e'),encodeURIComponent(_0x1d5a2c)):'freeform=3');return uploadFile(_0x213c99)[_0x767c('0x2c')](function(_0x4206f5){return querystring[_0x767c('0xa')](_0x4206f5);});};exports[_0x767c('0x7f')]=function(_0x21462c,_0x10a32a){return sestek['nda'](_0x21462c,_0x10a32a)['then'](function(_0x490807){logger[_0x767c('0x17')](JSON['stringify'](_0x490807));var _0x54c15f={'speech':_0x490807[_0x767c('0x80')],'action':_0x490807['channelData']?_0x490807[_0x767c('0x81')][_0x767c('0x82')]:undefined,'actiondata':_0x490807[_0x767c('0x81')]?_0x490807['channelData']['CustomActionData']:undefined};if(_0x490807[_0x767c('0x81')]&&_0x490807[_0x767c('0x81')][_0x767c('0x83')]){return base64Decode(_0x490807['channelData']['AudioFromTts'][_0x767c('0x84')],path[_0x767c('0x27')](__dirname,'tmp',rs[_0x767c('0x29')](0x4)+'.wav'))['then'](function(_0x3961ce){_0x54c15f[_0x767c('0x85')]=_0x3961ce;return _0x54c15f;});}return _0x54c15f;});};exports[_0x767c('0x86')]=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 8f34e03..aa6ea79 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 nda=require('./nda');module['exports']={'nda':nda}; \ No newline at end of file +var _0x0909=['./nda','exports'];(function(_0x5e3f4d,_0x501fb5){var _0x360e1b=function(_0x1f4bc8){while(--_0x1f4bc8){_0x5e3f4d['push'](_0x5e3f4d['shift']());}};_0x360e1b(++_0x501fb5);}(_0x0909,0x150));var _0x9090=function(_0x4060eb,_0x12b228){_0x4060eb=_0x4060eb-0x0;var _0x2ee246=_0x0909[_0x4060eb];return _0x2ee246;};var nda=require(_0x9090('0x0'));module[_0x9090('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index ecdbe1b..fa89e90 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 _0xd136=['CustomActionData','info','stringify','url','../../../../../config/logger','exports','POST','resolve','ndauth_url','/token','password','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','Nda','uniqueid','callerid','extension','text','Bearer\x20','project','body','channelData','ProjectName','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data'];(function(_0x526793,_0x46037a){var _0x590a86=function(_0x38eeee){while(--_0x38eeee){_0x526793['push'](_0x526793['shift']());}};_0x590a86(++_0x46037a);}(_0xd136,0x94));var _0x6d13=function(_0x484277,_0x3aa7cc){_0x484277=_0x484277-0x0;var _0x59df04=_0xd136[_0x484277];return _0x59df04;};'use strict';var rp=require('request-promise');var url=require(_0x6d13('0x0'));var logger=require(_0x6d13('0x1'))('agi');module[_0x6d13('0x2')]=function(_0x2d8f30,_0x12b9d6){var _0x2a3702={'method':_0x6d13('0x3'),'uri':url[_0x6d13('0x4')](_0x12b9d6[_0x6d13('0x5')],_0x6d13('0x6')),'form':{'grant_type':_0x6d13('0x7'),'username':_0x12b9d6['username'],'password':_0x12b9d6[_0x6d13('0x7')]},'json':!![]};return rp(_0x2a3702)[_0x6d13('0x8')](function(_0x4c563a){var _0x598021={'method':_0x6d13('0x3'),'uri':url[_0x6d13('0x4')](_0x12b9d6[_0x6d13('0x9')],_0x6d13('0xa')),'body':{'type':_0x12b9d6['ndaactivity_type']||'message','channelId':_0x6d13('0xb'),'conversation':{'id':_0x2d8f30[_0x6d13('0xc')]},'from':{'id':_0x2d8f30[_0x6d13('0xd')],'name':_0x2d8f30['calleridname']},'recipient':{'id':_0x2d8f30['dnid'],'name':_0x2d8f30[_0x6d13('0xe')]},'text':_0x12b9d6[_0x6d13('0xf')],'channelData':{}},'headers':{'Authorization':_0x6d13('0x10')+_0x4c563a['access_token']},'json':!![]};if(_0x12b9d6[_0x6d13('0x11')]){_0x598021[_0x6d13('0x12')][_0x6d13('0x13')][_0x6d13('0x14')]=_0x12b9d6['project'];}if(_0x12b9d6['ndagenerate_audio']=='1'){_0x598021['body'][_0x6d13('0x13')][_0x6d13('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6d13('0x16')};}if(_0x12b9d6[_0x6d13('0x17')]){_0x598021[_0x6d13('0x12')]['channelData'][_0x6d13('0x18')]=_0x12b9d6[_0x6d13('0x17')];if(_0x12b9d6[_0x6d13('0x19')]){_0x598021[_0x6d13('0x12')][_0x6d13('0x13')][_0x6d13('0x1a')]=_0x12b9d6[_0x6d13('0x19')];}}logger[_0x6d13('0x1b')](JSON[_0x6d13('0x1c')](_0x598021));return rp(_0x598021);});}; \ No newline at end of file +var _0x8721=['then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','text','Bearer\x20','access_token','project','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','body','CustomAction','CustomActionData','info','request-promise','url','../../../../../config/logger','resolve','ndauth_url','/token','password'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x8721,0xd9));var _0x1872=function(_0x35d4e9,_0x298c61){_0x35d4e9=_0x35d4e9-0x0;var _0x5c2770=_0x8721[_0x35d4e9];return _0x5c2770;};'use strict';var rp=require(_0x1872('0x0'));var url=require(_0x1872('0x1'));var logger=require(_0x1872('0x2'))('agi');module['exports']=function(_0x43f8e9,_0x532ce1){var _0x4e2e8f={'method':'POST','uri':url[_0x1872('0x3')](_0x532ce1[_0x1872('0x4')],_0x1872('0x5')),'form':{'grant_type':'password','username':_0x532ce1['username'],'password':_0x532ce1[_0x1872('0x6')]},'json':!![]};return rp(_0x4e2e8f)[_0x1872('0x7')](function(_0x4230d7){var _0x4d019e={'method':_0x1872('0x8'),'uri':url[_0x1872('0x3')](_0x532ce1[_0x1872('0x9')],_0x1872('0xa')),'body':{'type':_0x532ce1[_0x1872('0xb')]||_0x1872('0xc'),'channelId':_0x1872('0xd'),'conversation':{'id':_0x43f8e9[_0x1872('0xe')]},'from':{'id':_0x43f8e9[_0x1872('0xf')],'name':_0x43f8e9[_0x1872('0x10')]},'recipient':{'id':_0x43f8e9[_0x1872('0x11')],'name':_0x43f8e9['extension']},'text':_0x532ce1[_0x1872('0x12')],'channelData':{}},'headers':{'Authorization':_0x1872('0x13')+_0x4230d7[_0x1872('0x14')]},'json':!![]};if(_0x532ce1[_0x1872('0x15')]){_0x4d019e['body'][_0x1872('0x16')][_0x1872('0x17')]=_0x532ce1[_0x1872('0x15')];}if(_0x532ce1[_0x1872('0x18')]=='1'){_0x4d019e['body']['channelData'][_0x1872('0x19')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x1872('0x1a')};}if(_0x532ce1[_0x1872('0x1b')]){_0x4d019e[_0x1872('0x1c')][_0x1872('0x16')][_0x1872('0x1d')]=_0x532ce1['custom_action'];if(_0x532ce1['custom_action_data']){_0x4d019e[_0x1872('0x1c')][_0x1872('0x16')][_0x1872('0x1e')]=_0x532ce1['custom_action_data'];}}logger[_0x1872('0x1f')](JSON['stringify'](_0x4d019e));return rp(_0x4d019e);});}; \ 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 1c54e31..25a968b 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 _0x9b2c=['exports'];(function(_0x2da853,_0x3f8748){var _0x514abe=function(_0x53b550){while(--_0x53b550){_0x2da853['push'](_0x2da853['shift']());}};_0x514abe(++_0x3f8748);}(_0x9b2c,0x189));var _0xc9b2=function(_0xf973b7,_0x46699f){_0xf973b7=_0xf973b7-0x0;var _0x499087=_0x9b2c[_0xf973b7];return _0x499087;};'use strict';var asr=require('./lib/api');module[_0xc9b2('0x0')]=function(_0x644700,_0x4b4bdd,_0x140704,_0x54dbb1){return asr(_0x644700,_0x4b4bdd,_0x140704,_0x54dbb1);}; \ No newline at end of file +var _0x6971=['exports'];(function(_0x1e1218,_0x218085){var _0x4e8a0c=function(_0x339898){while(--_0x339898){_0x1e1218['push'](_0x1e1218['shift']());}};_0x4e8a0c(++_0x218085);}(_0x6971,0xbc));var _0x1697=function(_0x5a0112,_0x44f7d2){_0x5a0112=_0x5a0112-0x0;var _0x3bb9f8=_0x6971[_0x5a0112];return _0x3bb9f8;};'use strict';var asr=require('./lib/api');module[_0x1697('0x0')]=function(_0x26f046,_0x1118c3,_0x40a2fd,_0x333dd7){return asr(_0x26f046,_0x1118c3,_0x40a2fd,_0x333dd7);}; \ 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 966c981..40c1db3 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 _0x3f42=['Error\x20Tilde\x20ASR\x20socket','isObject','open','message','bluebird','moment','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','digest','unix','send','stringify','createReadStream','close','error','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket'];(function(_0x3b81a,_0x56c527){var _0x17c6a7=function(_0x5c6f17){while(--_0x5c6f17){_0x3b81a['push'](_0x3b81a['shift']());}};_0x17c6a7(++_0x56c527);}(_0x3f42,0x1d8));var _0x23f4=function(_0x3cce76,_0xbd4607){_0x3cce76=_0x3cce76-0x0;var _0xbc6055=_0x3f42[_0x3cce76];return _0xbc6055;};'use strict';var BPromise=require(_0x23f4('0x0'));var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x23f4('0x1'));var crypto=require('crypto');var logger=require(_0x23f4('0x2'))(_0x23f4('0x3'));module[_0x23f4('0x4')]=function(_0x473539,_0x245143,_0x42746c,_0x360b6d){return new BPromise(function(_0x560c66,_0x5b43aa){logger[_0x23f4('0x5')](_0x23f4('0x6'),_0x360b6d||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x160b8b=new WebSocket(_0x360b6d||_0x23f4('0x7'),{'perMessageDeflate':![]});var _0x71838d='';var _0x13198a='0';var _0x2ffb0e='1';var _0x985383=_0x23f4('0x8');function _0x2dcb35(_0x5ace37){var _0x1396db=crypto[_0x23f4('0x9')]('sha1');_0x1396db['update'](_0x5ace37);return _0x1396db[_0x23f4('0xa')]('hex');}function _0xb5b2f(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x46684c=moment()[_0x23f4('0xb')]();var _0x37c02d=_0x2dcb35(_0x46684c+_0x245143+_0x42746c);_0x160b8b[_0x23f4('0xc')](JSON[_0x23f4('0xd')]({'appID':_0x245143,'timestamp':_0x46684c,'appKey':_0x37c02d}));var _0x585299=fs[_0x23f4('0xe')](_0x473539);_0x585299['on']('data',function(_0xb5208e){_0x160b8b[_0x23f4('0xc')](_0xb5208e);});_0x585299['on'](_0x23f4('0xf'),function(){_0x160b8b['send']('EOS');});}catch(_0x587ea8){logger[_0x23f4('0x10')]('Tilde\x20ASR\x20send\x20error',JSON[_0x23f4('0xd')](_0x587ea8));_0x160b8b[_0x23f4('0x11')]();}}function _0x30184f(_0x3ca6c0){try{if(_0x3ca6c0){var _0x4295c7=JSON[_0x23f4('0x12')](_0x3ca6c0);switch(_0x4295c7[_0x23f4('0x13')]){case 0x0:if(_0x4295c7[_0x23f4('0x14')]){if(_0x4295c7[_0x23f4('0x14')][_0x23f4('0x15')]){logger[_0x23f4('0x5')](_0x23f4('0x16'),JSON[_0x23f4('0xd')](_0x4295c7[_0x23f4('0x14')][_0x23f4('0x17')]));_0x71838d=_0x4295c7['result'][_0x23f4('0x17')][0x0][_0x23f4('0x18')];_0x13198a=_0x4295c7[_0x23f4('0x14')][_0x23f4('0x17')][0x0][_0x23f4('0x19')];_0x2ffb0e='0';_0x985383='Success.';_0x160b8b[_0x23f4('0x11')]();}}break;case 0x1:logger[_0x23f4('0x5')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2ffb0e='1';_0x985383=_0x23f4('0x8');break;case 0x2:logger[_0x23f4('0x5')](_0x23f4('0x1a'));_0x2ffb0e='2';_0x985383=_0x23f4('0x1a');break;case 0x9:logger[_0x23f4('0x5')](_0x23f4('0x1b'));_0x2ffb0e='9';_0x985383=_0x23f4('0x1b');break;case 0xa:logger['info'](_0x23f4('0x1c'));_0x2ffb0e='10';_0x985383='Authentication\x20failed.';break;case 0xb:logger[_0x23f4('0x5')](_0x23f4('0x1d'));_0x2ffb0e='11';_0x985383=_0x23f4('0x1d');}}}catch(_0x2ced50){logger[_0x23f4('0x10')](_0x23f4('0x1e'),JSON[_0x23f4('0xd')](_0x2ced50));_0x160b8b[_0x23f4('0x11')]();}}function _0x131dcf(){logger['info'](_0x23f4('0x1f'));_0x560c66({'transcript':_0x71838d,'confidence':_0x13198a,'status':_0x2ffb0e,'status_message':_0x985383});}function _0x6a69d3(_0x10ef42){logger[_0x23f4('0x10')](_0x23f4('0x20'));if(!_['isNil'](_0x10ef42)){logger[_0x23f4('0x10')](_[_0x23f4('0x21')](_0x10ef42)?JSON[_0x23f4('0xd')](_0x10ef42):_0x10ef42);}}_0x160b8b['on'](_0x23f4('0x22'),_0xb5b2f);_0x160b8b['on'](_0x23f4('0x23'),_0x30184f);_0x160b8b['on'](_0x23f4('0xf'),_0x131dcf);_0x160b8b['on'](_0x23f4('0x10'),_0x6a69d3);});}; \ No newline at end of file +var _0x449b=['lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','createReadStream','data','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','stringify','Close\x20Tilde\x20ASR\x20socket','error','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','close','bluebird'];(function(_0xce287c,_0x533fe7){var _0x53cae7=function(_0x15068e){while(--_0x15068e){_0xce287c['push'](_0xce287c['shift']());}};_0x53cae7(++_0x533fe7);}(_0x449b,0x1bb));var _0xb449=function(_0x516ca1,_0x51ac46){_0x516ca1=_0x516ca1-0x0;var _0x572a65=_0x449b[_0x516ca1];return _0x572a65;};'use strict';var BPromise=require(_0xb449('0x0'));var _=require(_0xb449('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb449('0x2'));var crypto=require(_0xb449('0x3'));var logger=require(_0xb449('0x4'))(_0xb449('0x5'));module[_0xb449('0x6')]=function(_0x2a6961,_0x4907c2,_0x17c4e6,_0x3e2b09){return new BPromise(function(_0x29025d,_0x28b11a){logger[_0xb449('0x7')](_0xb449('0x8'),_0x3e2b09||_0xb449('0x9'));var _0x20c32a=new WebSocket(_0x3e2b09||_0xb449('0x9'),{'perMessageDeflate':![]});var _0x572809='';var _0x17ec23='0';var _0x401c52='1';var _0x168f25='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x5d7b8e(_0x511740){var _0x5d2304=crypto[_0xb449('0xa')](_0xb449('0xb'));_0x5d2304[_0xb449('0xc')](_0x511740);return _0x5d2304[_0xb449('0xd')]('hex');}function _0x40c17d(){try{logger[_0xb449('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x539e40=moment()['unix']();var _0x253a45=_0x5d7b8e(_0x539e40+_0x4907c2+_0x17c4e6);_0x20c32a['send'](JSON['stringify']({'appID':_0x4907c2,'timestamp':_0x539e40,'appKey':_0x253a45}));var _0x5d5dbc=fs[_0xb449('0xe')](_0x2a6961);_0x5d5dbc['on'](_0xb449('0xf'),function(_0x53c1f7){_0x20c32a['send'](_0x53c1f7);});_0x5d5dbc['on']('close',function(){_0x20c32a['send']('EOS');});}catch(_0xf79b68){logger['error'](_0xb449('0x10'),JSON['stringify'](_0xf79b68));_0x20c32a['terminate']();}}function _0x12b857(_0x4f2e27){try{if(_0x4f2e27){var _0x222d2d=JSON['parse'](_0x4f2e27);switch(_0x222d2d[_0xb449('0x11')]){case 0x0:if(_0x222d2d[_0xb449('0x12')]){if(_0x222d2d['result'][_0xb449('0x13')]){logger['info'](_0xb449('0x14'),JSON['stringify'](_0x222d2d['result'][_0xb449('0x15')]));_0x572809=_0x222d2d[_0xb449('0x12')][_0xb449('0x15')][0x0]['transcript'];_0x17ec23=_0x222d2d['result'][_0xb449('0x15')][0x0]['likelihood'];_0x401c52='0';_0x168f25=_0xb449('0x16');_0x20c32a['terminate']();}}break;case 0x1:logger[_0xb449('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x401c52='1';_0x168f25=_0xb449('0x17');break;case 0x2:logger['info'](_0xb449('0x18'));_0x401c52='2';_0x168f25='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger[_0xb449('0x7')](_0xb449('0x19'));_0x401c52='9';_0x168f25=_0xb449('0x19');break;case 0xa:logger[_0xb449('0x7')]('Authentication\x20failed.');_0x401c52='10';_0x168f25=_0xb449('0x1a');break;case 0xb:logger[_0xb449('0x7')](_0xb449('0x1b'));_0x401c52='11';_0x168f25='All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.';}}}catch(_0x14d47f){logger['error'](_0xb449('0x1c'),JSON[_0xb449('0x1d')](_0x14d47f));_0x20c32a['terminate']();}}function _0x237371(){logger[_0xb449('0x7')](_0xb449('0x1e'));_0x29025d({'transcript':_0x572809,'confidence':_0x17ec23,'status':_0x401c52,'status_message':_0x168f25});}function _0x1a35dc(_0x2e0feb){logger[_0xb449('0x1f')](_0xb449('0x20'));if(!_['isNil'](_0x2e0feb)){logger['error'](_[_0xb449('0x21')](_0x2e0feb)?JSON['stringify'](_0x2e0feb):_0x2e0feb);}}_0x20c32a['on'](_0xb449('0x22'),_0x40c17d);_0x20c32a['on'](_0xb449('0x23'),_0x12b857);_0x20c32a['on'](_0xb449('0x24'),_0x237371);_0x20c32a['on'](_0xb449('0x1f'),_0x1a35dc);});}; \ 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 a06964e..be596ca 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 _0x2c30=['./asr'];(function(_0x15bc31,_0x14f70c){var _0x1989fe=function(_0x35b7d9){while(--_0x35b7d9){_0x15bc31['push'](_0x15bc31['shift']());}};_0x1989fe(++_0x14f70c);}(_0x2c30,0x1a7));var _0x02c3=function(_0x309885,_0x59dae9){_0x309885=_0x309885-0x0;var _0x5bded5=_0x2c30[_0x309885];return _0x5bded5;};var asr=require(_0x02c3('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x6020=['exports','./asr'];(function(_0x2738e9,_0x5bf2f8){var _0x3dda42=function(_0x30ccf2){while(--_0x30ccf2){_0x2738e9['push'](_0x2738e9['shift']());}};_0x3dda42(++_0x5bf2f8);}(_0x6020,0x69));var _0x0602=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x6020[_0x3ee1fe];return _0x1ae57a;};var asr=require(_0x0602('0x0'));module[_0x0602('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 5d9df84..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(_0x481bdf,_0x231538){var _0x281a12=function(_0x264b18){while(--_0x264b18){_0x481bdf['push'](_0x481bdf['shift']());}};_0x281a12(++_0x231538);}(_0xe706,0xa3));var _0x6e70=function(_0x4bedce,_0x265ebf){_0x4bedce=_0x4bedce-0x0;var _0x4fd2fb=_0xe706[_0x4bedce];return _0x4fd2fb;};'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 7357eb2..340ea2d 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 _0x98d3=['An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','private_key','dialogflowV2_language','ispeechTTS','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','includes','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','options','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','grammar','no\x20grammar\x20configured','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','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','no\x20list\x20selected','scheduledAt','add','delay','noop','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','exec','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','MRCPRecog','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','no\x20query\x20configured','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','sip_id','no\x20user\x20selected','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','client_email','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DIALOGFLOW_%s','out','DialogflowV2\x20Result\x20%s','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','sestekNDA','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','awspolly','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','wav','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','ispeech\x20%s\x20file\x20created','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','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','toLowerCase','QUEUE','macro','position','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','\x22%s\x22\x20<%s>','user','bcc','subject','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','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','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','moment','request-promise','../../config/logger','./scripts','/var/opt/motion2/server/files','rawHeaders','menu','getdigits','getsecretdigits','channel','rpc','mailRpc','prototype','getVariable','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareOdbcById','dsn','getUserById','getTrunk','getSound','save_name','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','callerid','createSquareRecording','calleridname','context','extension','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','%s/%s@from-sip/n','shellCommand','googleCloudTTS','apiKey','text','languageCode','ssmlGender','audioEncoding','MP3','googleTTS','restAPI','url','timeout','POST','PUT','method','toUpperCase','body','rawBody','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','parse'];(function(_0x2a7ed9,_0x5bb4bc){var _0xb194dc=function(_0x108212){while(--_0x108212){_0x2a7ed9['push'](_0x2a7ed9['shift']());}};_0xb194dc(++_0x5bb4bc);}(_0x98d3,0x173));var _0x398d=function(_0x39149,_0x548a65){_0x39149=_0x39149-0x0;var _0x5a0f05=_0x98d3[_0x39149];return _0x5a0f05;};'use strict';var fs=require('fs');var util=require(_0x398d('0x0'));var _=require(_0x398d('0x1'));var sh=require('shelljs');var odbc=require(_0x398d('0x2'))();var rs=require('randomstring');var moment=require(_0x398d('0x3'));var Mustache=require('mustache');var rp=require(_0x398d('0x4'));var logger=require(_0x398d('0x5'))('agi');var config=require('../../config/environment');var scripts=require(_0x398d('0x6'));var FILES_PATH=_0x398d('0x7');var recursiveMapAttributes=[_0x398d('0x8'),'rawBody'];var verticesWithRetry=[_0x398d('0x9'),_0x398d('0xa'),_0x398d('0xb')];var AGIVertices=function(_0x399598,_0x2f654c,_0x54c349){this[_0x398d('0xc')]=_0x399598;this[_0x398d('0xd')]=_0x2f654c;this[_0x398d('0xe')]=_0x54c349;};AGIVertices[_0x398d('0xf')][_0x398d('0x10')]=function(_0x1b144a,_0x37eb46){this[_0x398d('0xd')]['getVariableById'](_0x1b144a)[_0x398d('0x11')](function(_0x1f25e4){_0x37eb46(null,_0x1f25e4?_0x1f25e4[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x15a424){_0x37eb46(_0x15a424);});};AGIVertices[_0x398d('0xf')][_0x398d('0x14')]=function(_0x162d55,_0x3bf2a2){this[_0x398d('0xd')][_0x398d('0x15')](_0x162d55)['then'](function(_0x50a3f9){_0x3bf2a2(null,_0x50a3f9?_0x50a3f9[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x347508){_0x3bf2a2(_0x347508);});};AGIVertices[_0x398d('0xf')][_0x398d('0x16')]=function(_0x4099a5,_0x3ff03c){this[_0x398d('0xd')]['getSquareProjectById'](_0x4099a5)[_0x398d('0x11')](function(_0x54e717){_0x3ff03c(null,_0x54e717?_0x54e717[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x297768){_0x3ff03c(_0x297768);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x4e574b,_0x28b124){this[_0x398d('0xd')][_0x398d('0x17')](_0x4e574b)[_0x398d('0x11')](function(_0x15f024){_0x28b124(null,_0x15f024?_0x15f024[_0x398d('0x18')]:![]);})[_0x398d('0x13')](function(_0x552411){_0x28b124(_0x552411);});};AGIVertices['prototype']['getUser']=function(_0x16e580,_0x3b275a){this[_0x398d('0xd')][_0x398d('0x19')](_0x16e580)[_0x398d('0x11')](function(_0x557df7){_0x3b275a(null,_0x557df7?_0x557df7['name']:![]);})[_0x398d('0x13')](function(_0x497ad1){_0x3b275a(_0x497ad1);});};AGIVertices['prototype'][_0x398d('0x1a')]=function(_0x38d8da,_0x5ae3b4){this['rpc']['getTrunkById'](_0x38d8da)[_0x398d('0x11')](function(_0x2cc4ef){_0x5ae3b4(null,_0x2cc4ef?_0x2cc4ef[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x2a1f4d){_0x5ae3b4(_0x2a1f4d);});};AGIVertices[_0x398d('0xf')][_0x398d('0x1b')]=function(_0x17318c,_0x4f4466){var _0x35bd19=this;this['rpc']['getSoundById'](_0x17318c)[_0x398d('0x11')](function(_0x27bc6e){_0x4f4466(null,_0x27bc6e?_0x35bd19['getSoundPath'](_0x27bc6e[_0x398d('0x1c')]):![]);})['catch'](function(_0x3ae172){_0x4f4466(_0x3ae172);});};AGIVertices[_0x398d('0xf')]['getMailAccount']=function(_0x5681d0,_0x410db2){this[_0x398d('0xd')]['getMailAccountById'](_0x5681d0)[_0x398d('0x11')](function(_0x2fbcce){_0x410db2(null,_0x2fbcce?_0x2fbcce:![]);})[_0x398d('0x13')](function(_0x353cd7){_0x410db2(_0x353cd7);});};AGIVertices[_0x398d('0xf')][_0x398d('0x1d')]=function(_0x490bee,_0x5a9f61,_0x347c8a){this[_0x398d('0xe')][_0x398d('0x1d')](_0x490bee,_0x5a9f61)[_0x398d('0x11')](function(){_0x347c8a(null);})[_0x398d('0x13')](function(_0x27ed5b){_0x347c8a(_0x27ed5b);});};AGIVertices[_0x398d('0xf')][_0x398d('0x1e')]=function(_0x1827be,_0x5411c5){this[_0x398d('0xd')][_0x398d('0x1f')](_0x1827be)[_0x398d('0x11')](function(_0x557f83){if(_0x557f83){if(_0x557f83['IntervalId']){_0x5411c5(null,[_0x557f83[_0x398d('0x20')]]);}else{_0x5411c5(null,_[_0x398d('0x21')](_0x557f83[_0x398d('0x22')],_0x398d('0x20')));}}else{_0x5411c5(null,![]);}})[_0x398d('0x13')](function(_0x321a49){_0x5411c5(_0x321a49);});};AGIVertices[_0x398d('0xf')][_0x398d('0x23')]=function(_0x28318f){return util[_0x398d('0x24')](_0x398d('0x25'),FILES_PATH,_0x28318f);};AGIVertices[_0x398d('0xf')][_0x398d('0x26')]=function(_0x1c7859,_0x306c30,_0x302314){odbc[_0x398d('0x27')](_0x1c7859,function(_0x24cd9b){if(_0x24cd9b){logger[_0x398d('0x28')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x24cd9b);_0x302314(_0x24cd9b);}else{logger[_0x398d('0x29')](_0x398d('0x2a'));odbc[_0x398d('0x2b')](_0x306c30,function(_0x17de78,_0x209c2b){if(_0x17de78){logger[_0x398d('0x29')](_0x398d('0x2c'),_0x306c30);_0x302314(_0x17de78);}else{logger['info'](_0x398d('0x2d'),_0x306c30);odbc[_0x398d('0x2e')](function(_0x165d26){if(_0x165d26){logger[_0x398d('0x28')](_0x398d('0x2f'),_0x165d26);}_0x302314(null,_0x209c2b);});}});}});};AGIVertices[_0x398d('0xf')][_0x398d('0x30')]=function(_0x3dddcf,_0x518e7c){this[_0x398d('0xd')][_0x398d('0x31')](_0x3dddcf)[_0x398d('0x11')](function(_0x2d0a82){_0x518e7c(null,_0x2d0a82?_0x2d0a82:![]);})[_0x398d('0x13')](function(_0x5229c2){_0x518e7c(_0x5229c2);});};AGIVertices[_0x398d('0xf')][_0x398d('0x32')]=function(_0x484410,_0x4541c7){this[_0x398d('0xd')][_0x398d('0x32')](_0x484410)[_0x398d('0x11')](function(_0x217fc0){_0x4541c7(null,_0x217fc0);})[_0x398d('0x13')](function(_0x3c78a0){_0x4541c7(_0x3c78a0);});};AGIVertices[_0x398d('0xf')][_0x398d('0x33')]=function(_0x5d7d33,_0x2760f2,_0x28defa){this[_0x398d('0xd')][_0x398d('0x33')]({'uniqueid':this[_0x398d('0xc')][_0x398d('0x34')],'node':_0x5d7d33['label'],'application':_0x5d7d33[_0x398d('0x35')],'data':_0x2760f2||null,'project_name':this[_0x398d('0xc')]['arg_1'],'callerid':this[_0x398d('0xc')][_0x398d('0x36')]})[_0x398d('0x11')](function(_0x49fd99){if(_0x28defa){_0x28defa(null,_0x49fd99);}})[_0x398d('0x13')](function(_0x19dabb){if(_0x28defa){_0x28defa(_0x19dabb);}});};AGIVertices[_0x398d('0xf')][_0x398d('0x37')]=function(_0xe87d16,_0x4a024a,_0x3db9ff,_0x1d75a8){this[_0x398d('0xd')]['createSquareRecording']({'uniqueid':this[_0x398d('0xc')][_0x398d('0x34')],'callerid':this['channel'][_0x398d('0x36')],'calleridname':this[_0x398d('0xc')][_0x398d('0x38')],'context':this[_0x398d('0xc')][_0x398d('0x39')],'extension':this[_0x398d('0xc')][_0x398d('0x3a')],'priority':this[_0x398d('0xc')]['priority'],'accountcode':this[_0x398d('0xc')][_0x398d('0x3b')],'dnid':this['channel']['dnid'],'projectName':this[_0x398d('0xc')][_0x398d('0x3c')],'saveName':_0x4a024a,'filename':_0xe87d16[_0x398d('0x3d')]||_0x4a024a,'savePath':_0x3db9ff})[_0x398d('0x11')](function(_0x49a6de){_0x1d75a8(null,_0x49a6de);})[_0x398d('0x13')](function(_0x4826b2){_0x1d75a8(_0x4826b2);});};AGIVertices[_0x398d('0xf')]['createSquareMessage']=function(_0x3c27a1,_0x588548,_0x53fc9c,_0x4a1384,_0x38604a){this[_0x398d('0xd')][_0x398d('0x3e')]({'uniqueid':this[_0x398d('0xc')]['uniqueid'],'body':_0x3c27a1,'direction':_0x588548,'providerName':_0x53fc9c,'providerResponse':_0x4a1384})['then'](function(_0x339f55){if(_0x38604a){_0x38604a(null,_0x339f55);}})[_0x398d('0x13')](function(_0x1615ee){if(_0x38604a){_0x38604a(_0x1615ee);}});};AGIVertices['prototype'][_0x398d('0x3f')]=function(_0x2fcb61,_0x2376c3){this[_0x398d('0xd')][_0x398d('0x3f')]({'firstName':_[_0x398d('0x40')](_0x2fcb61['name'])||_[_0x398d('0x41')](_0x2fcb61[_0x398d('0x12')])?_0x398d('0x42')+Math[_0x398d('0x43')]():_0x2fcb61['name'],'lastName':_[_0x398d('0x40')](_0x2fcb61[_0x398d('0x44')])||_[_0x398d('0x41')](_0x2fcb61[_0x398d('0x44')])?null:_0x2fcb61['lastName'],'phone':_0x2fcb61['phone'],'ListId':_0x2fcb61[_0x398d('0x45')],'scheduledat':_0x2fcb61['scheduledAt'],'callbackUniqueid':this[_0x398d('0xc')][_0x398d('0x34')],'tags':'callback','description':_0x398d('0x46')+_0x2fcb61['scheduledAt'][_0x398d('0x47')](),'priority':_0x2fcb61[_0x398d('0x48')]})[_0x398d('0x11')](function(_0x1c4c38){_0x2376c3(null,_0x1c4c38);})[_0x398d('0x13')](function(_0x3aed8b){_0x2376c3(_0x3aed8b);});};AGIVertices[_0x398d('0xf')][_0x398d('0x49')]=function(_0x16f014,_0x3b4eaf){this[_0x398d('0xd')][_0x398d('0x4a')](_0x16f014)[_0x398d('0x11')](function(_0x783c74){_0x3b4eaf(null,_0x783c74?_0x783c74[_0x398d('0x12')]:![]);})[_0x398d('0x13')](function(_0x20b5e1){_0x3b4eaf(_0x20b5e1);});};AGIVertices[_0x398d('0xf')][_0x398d('0x4b')]=function(_0xb25709,_0x7f4acb,_0xcd2b9d){var _0x5453b6={'role':_0x398d('0x4c')};_0x5453b6[_0xb25709]=this[_0x398d('0xc')][_0x398d('0x36')];this[_0x398d('0xd')][_0x398d('0x4b')](_0x5453b6,_0x7f4acb,this[_0x398d('0xc')][_0x398d('0x34')])[_0x398d('0x11')](function(_0xe6cf33){_0xcd2b9d(null,_[_0x398d('0x41')](_0xe6cf33)?![]:!![]);})[_0x398d('0x13')](function(_0x5a64a2){logger[_0x398d('0x28')](_0x5a64a2);_0xcd2b9d(null,![]);});};AGIVertices[_0x398d('0xf')]['agentUnpause']=function(_0x362471,_0x548a8a){var _0x4832f5={'role':'agent'};_0x4832f5[_0x362471]=this[_0x398d('0xc')][_0x398d('0x36')];this['rpc'][_0x398d('0x4d')](_0x4832f5)[_0x398d('0x11')](function(_0x422b03){_0x548a8a(null,_['isNil'](_0x422b03)?![]:!![]);})[_0x398d('0x13')](function(_0x6e9484){logger[_0x398d('0x28')](_0x6e9484);_0x548a8a(null,![]);});};AGIVertices['prototype'][_0x398d('0x4e')]=function(_0x542e3b,_0x2755c6){var _0x5a7de6={'role':_0x398d('0x4c')};_0x5a7de6[_0x542e3b]=this['channel'][_0x398d('0x36')];this[_0x398d('0xd')][_0x398d('0x4e')](_0x5a7de6)[_0x398d('0x11')](function(_0x2938d7){_0x2755c6(null,_['isNil'](_0x2938d7)?![]:!![]);})[_0x398d('0x13')](function(_0x4446d7){logger[_0x398d('0x28')](_0x4446d7);_0x2755c6(null,![]);});};AGIVertices[_0x398d('0xf')][_0x398d('0x4f')]=function(_0x12d76f,_0x187d18){var _0x5b073c={'role':_0x398d('0x4c')};_0x5b073c[_0x12d76f]=this[_0x398d('0xc')][_0x398d('0x36')];var _0x5085f4=_0x12d76f!='internal'?util[_0x398d('0x24')](_0x398d('0x50'),'LOCAL',this['channel'][_0x398d('0x36')]):undefined;this['rpc'][_0x398d('0x4f')](_0x5b073c,_0x5085f4)['then'](function(_0x359f5d){_0x187d18(null,_['isNil'](_0x359f5d)?![]:!![]);})['catch'](function(_0x4e1bbf){logger[_0x398d('0x28')](_0x4e1bbf);_0x187d18(null,![]);});};AGIVertices[_0x398d('0xf')][_0x398d('0x51')]=function(_0xef2db4,_0x459976){sh['exec'](_['trim'](_0xef2db4),function(_0x5b0ec5,_0x57267a){var _0x423232=_0x57267a['replace'](/(\r\n|\n|\r)/gm,'');_0x459976(null,_0x423232);});};AGIVertices[_0x398d('0xf')][_0x398d('0x52')]=function(_0x6fc4e3,_0x324436){scripts[_0x398d('0x52')](_0x6fc4e3[_0x398d('0x53')],_0x6fc4e3['google_cloud_tts_text_type']||'text',_0x6fc4e3[_0x398d('0x54')],_0x6fc4e3[_0x398d('0x55')]||'en-US',_0x6fc4e3[_0x398d('0x56')]||'MALE',_0x6fc4e3[_0x398d('0x57')]||_0x398d('0x58'))[_0x398d('0x11')](function(_0xaa4021){_0x324436(null,_0xaa4021);})['catch'](function(_0x22961e){_0x324436(_0x22961e);});};AGIVertices[_0x398d('0xf')][_0x398d('0x59')]=function(_0x28144d,_0x18e1de){scripts['googleTTS'](_0x28144d[_0x398d('0x54')],_0x28144d['google_tts_language']||'en',0x1)[_0x398d('0x11')](function(_0x918e5b){_0x18e1de(null,_0x918e5b);})[_0x398d('0x13')](function(_0x56a134){_0x18e1de(_0x56a134);});};AGIVertices[_0x398d('0xf')][_0x398d('0x5a')]=function(_0x5492b6,_0x37c9e2){var _0x36801f={'uri':_0x5492b6[_0x398d('0x5b')],'method':_0x5492b6['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x5492b6['timeout'])==='number'&&parseInt(_0x5492b6['timeout'])>=0x1?parseInt(_0x5492b6[_0x398d('0x5c')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x398d('0x5d'),_0x398d('0x5e')],_0x36801f[_0x398d('0x5f')][_0x398d('0x60')]())){try{_0x36801f[_0x398d('0x61')]=_0x5492b6[_0x398d('0x62')]?JSON['parse'](_0x5492b6[_0x398d('0x62')]):{};}catch(_0x3e0b01){logger['error'](_0x398d('0x63'),_0x3e0b01);}}try{_0x36801f[_0x398d('0x64')]=_0x5492b6[_0x398d('0x8')]?JSON[_0x398d('0x65')](_0x5492b6[_0x398d('0x8')]):{};}catch(_0x352b6d){logger[_0x398d('0x28')](_0x398d('0x66'),_0x352b6d);}if(_0x5492b6[_0x398d('0x67')]){try{var _0x1721aa=require(_0x5492b6['computedVariables'])[_0x398d('0x68')](this,_0x36801f);_0x36801f[_0x398d('0x69')]=Mustache[_0x398d('0x6a')](_0x5492b6['url'],_0x1721aa,{},['$$','$$']);if(_0x36801f[_0x398d('0x64')]){_0x36801f[_0x398d('0x64')]=JSON[_0x398d('0x65')](Mustache[_0x398d('0x6a')](JSON[_0x398d('0x6b')](_0x36801f[_0x398d('0x64')]),_0x1721aa,{},['$$','$$']));}if(_0x36801f[_0x398d('0x61')]){_0x36801f[_0x398d('0x61')]=JSON['parse'](Mustache[_0x398d('0x6a')](JSON[_0x398d('0x6b')](_0x36801f[_0x398d('0x61')]),_0x1721aa,{},['$$','$$']));}}catch(_0x46e7e0){logger[_0x398d('0x28')](_0x398d('0x6c'),_0x46e7e0);}}rp(_0x36801f)['then'](function(_0x5ea815){var _0xc8f67a={'statusCode':_0x5ea815[_0x398d('0x6d')]||0xc8,'statusMessage':_0x5ea815[_0x398d('0x6e')]||'OK','headers':_0x5ea815[_0x398d('0x64')]||{},'body':_0x5ea815['body']||{}};_0x37c9e2(null,_0xc8f67a);})['catch'](function(_0xd90e93){var _0x2b6281={'statusCode':_0xd90e93[_0x398d('0x6d')]||0x1f4,'statusMessage':_0xd90e93[_0x398d('0x6f')]||_0x398d('0x70'),'headers':_0xd90e93['options']['headers']||{},'body':_0xd90e93['options'][_0x398d('0x61')]||{}};_0x37c9e2(null,_0x2b6281);});};AGIVertices[_0x398d('0xf')][_0x398d('0x71')]=function(_0xc6066a,_0x2bed67){scripts[_0x398d('0x71')](this[_0x398d('0xc')][_0x398d('0x34')],_0xc6066a[_0x398d('0x72')],_0xc6066a[_0x398d('0x54')],_0xc6066a[_0x398d('0x73')]||'en')[_0x398d('0x11')](function(_0x3a65e3){_0x2bed67(null,_0x3a65e3);})[_0x398d('0x13')](function(_0x752d2a){_0x2bed67(_0x752d2a);});};AGIVertices[_0x398d('0xf')][_0x398d('0x74')]=function(_0x34142f,_0x551b72){scripts['googleDialogflowV2'](this[_0x398d('0xc')][_0x398d('0x34')],_0x34142f[_0x398d('0x75')],_0x34142f['client_email'],_0x34142f[_0x398d('0x76')],_0x34142f[_0x398d('0x54')],_0x34142f[_0x398d('0x77')]||'en')[_0x398d('0x11')](function(_0x3a022d){_0x551b72(null,_0x3a022d);})[_0x398d('0x13')](function(_0x320444){_0x551b72(_0x320444);});};AGIVertices[_0x398d('0xf')]['sestekNDA']=function(_0x1c09e9,_0xad3fd1){scripts['sestekNDA'](this[_0x398d('0xc')],_0x1c09e9)[_0x398d('0x11')](function(_0x4ad08e){_0xad3fd1(null,_0x4ad08e);})['catch'](function(_0x47766c){_0xad3fd1(_0x47766c);});};AGIVertices[_0x398d('0xf')][_0x398d('0x78')]=function(_0x10076f,_0x30ec49){scripts[_0x398d('0x78')](_0x10076f[_0x398d('0x72')],_0x10076f[_0x398d('0x54')],_0x10076f['ispeech_tts_language']||_0x398d('0x79'),_0x10076f[_0x398d('0x7a')])[_0x398d('0x11')](function(_0x45de5d){_0x30ec49(null,_0x45de5d);})[_0x398d('0x13')](function(_0x2002c3){_0x30ec49(_0x2002c3);});};AGIVertices['prototype'][_0x398d('0x7b')]=function(_0x4f7d04,_0x33f491,_0x4ce9d4){scripts[_0x398d('0x7b')](_0x33f491,_0x4f7d04[_0x398d('0x72')],_0x4f7d04[_0x398d('0x7c')]||_0x398d('0x79'),this[_0x398d('0x7d')](_0x4f7d04['model'])?_0x4f7d04[_0x398d('0x7e')]:undefined)[_0x398d('0x11')](function(_0x560fb0){_0x4ce9d4(null,_0x560fb0);})[_0x398d('0x13')](function(_0x305b92){_0x4ce9d4(_0x305b92);});};AGIVertices[_0x398d('0xf')][_0x398d('0x7f')]=function(_0x204f40,_0x18efa9){scripts[_0x398d('0x7f')](_0x204f40[_0x398d('0x80')],_0x204f40[_0x398d('0x81')],_0x204f40[_0x398d('0x82')],_0x204f40[_0x398d('0x83')]||_0x398d('0x84'),_0x204f40[_0x398d('0x54')],_0x204f40[_0x398d('0x85')]||_0x398d('0x54'))[_0x398d('0x11')](function(_0x2a1ed8){_0x18efa9(null,_0x2a1ed8);})[_0x398d('0x13')](function(_0x861f13){_0x18efa9(_0x861f13);});};AGIVertices[_0x398d('0xf')][_0x398d('0x86')]=function(_0x45ccc4,_0x5cb4eb){scripts[_0x398d('0x86')](this['channel']['uniqueid'],_0x45ccc4['aws_access_key_id'],_0x45ccc4[_0x398d('0x81')],_0x45ccc4[_0x398d('0x87')],_0x45ccc4[_0x398d('0x54')],_0x45ccc4[_0x398d('0x88')])[_0x398d('0x11')](function(_0x43207f){_0x5cb4eb(null,_0x43207f);})[_0x398d('0x13')](function(_0x5c266f){_0x5cb4eb(_0x5c266f);});};AGIVertices[_0x398d('0xf')][_0x398d('0x89')]=function(_0x26dd69,_0x4a8ca6,_0xf1772d){scripts[_0x398d('0x89')](_0x4a8ca6,_0x26dd69['key'],_0x26dd69['google_asr_language']||'en-US')[_0x398d('0x11')](function(_0x57086e){_0xf1772d(null,_0x57086e);})[_0x398d('0x13')](function(_0x12269a){_0xf1772d(_0x12269a);});};AGIVertices['prototype'][_0x398d('0x8a')]=function(_0x16e130,_0x171c00,_0x508d68){scripts[_0x398d('0x8a')](_0x171c00,_0x16e130[_0x398d('0x8b')],_0x16e130['appsecret'],_0x16e130[_0x398d('0x69')])[_0x398d('0x11')](function(_0x1df628){_0x508d68(null,_0x1df628);})['catch'](function(_0x35117b){_0x508d68(_0x35117b);});};AGIVertices[_0x398d('0xf')]['clear']=function(_0x6868a9){var _0x370c2a=_[_0x398d('0x8c')](verticesWithRetry,_0x6868a9[_0x398d('0x35')])?_0x6868a9:_[_0x398d('0x8d')](_0x6868a9);for(var _0x212a0e in _0x370c2a){if(_0x370c2a[_0x398d('0x8e')](_0x212a0e)){if(_0x370c2a[_0x212a0e]&&_[_0x398d('0x8f')](_0x370c2a[_0x212a0e])){if(_[_0x398d('0x8c')](recursiveMapAttributes,_0x212a0e)){_0x370c2a[_0x212a0e]=this[_0x398d('0x90')](_0x370c2a[_0x212a0e]);}else{_0x370c2a[_0x212a0e]=this[_0x398d('0x91')](_0x370c2a[_0x212a0e]);}}}}return _0x370c2a;};AGIVertices[_0x398d('0xf')][_0x398d('0x92')]=function(_0x50da80){for(var _0x4cb8d4 in _0x50da80){if(_0x50da80[_0x398d('0x8e')](_0x4cb8d4)){if(_['isPlainObject'](_0x50da80[_0x4cb8d4])){this[_0x398d('0x92')](_0x50da80[_0x4cb8d4]);}else if(_['isArray'](_0x50da80[_0x4cb8d4])){for(var _0x35a47b=0x0;_0x35a47b<_0x50da80[_0x4cb8d4][_0x398d('0x93')];_0x35a47b++){this[_0x398d('0x92')](_0x50da80[_0x4cb8d4][_0x35a47b]);}}else if(_['isString'](_0x50da80[_0x4cb8d4])){_0x50da80[_0x4cb8d4]=this[_0x398d('0x91')](_0x50da80[_0x4cb8d4]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0xd895cd,_0x550a1b){for(var _0x4980d6 in _0xd895cd){if(_0xd895cd['hasOwnProperty'](_0x4980d6)){if(_[_0x398d('0x94')](_0xd895cd[_0x4980d6])){if(!_[_0x398d('0x40')](_0xd895cd[_0x4980d6])){this[_0x398d('0x95')](_0xd895cd[_0x4980d6],util[_0x398d('0x24')]('%s.%s',_0x550a1b,_0x4980d6));}}else if(_['isArray'](_0xd895cd[_0x4980d6])){for(var _0x175206=0x0;_0x175206<_0xd895cd[_0x4980d6][_0x398d('0x93')];_0x175206++){this[_0x398d('0x95')](_0xd895cd[_0x4980d6][_0x175206],util[_0x398d('0x24')](_0x398d('0x96'),_0x550a1b,_0x4980d6+'['+_0x175206+']'));}}else{if(!_[_0x398d('0x41')](_0xd895cd[_0x4980d6])){this[_0x398d('0xc')][_0x398d('0x97')](util['format'](_0x398d('0x96'),_0x550a1b,_0x4980d6),_0xd895cd[_0x4980d6]);}}}}};AGIVertices[_0x398d('0xf')][_0x398d('0x90')]=function(_0x4a5fce){try{var _0x1906d3=JSON[_0x398d('0x65')](_0x4a5fce);this[_0x398d('0x92')](_0x1906d3);return JSON[_0x398d('0x6b')](_0x1906d3);}catch(_0x55adf5){return this[_0x398d('0x91')](_0x4a5fce);}};AGIVertices['prototype']['replaceAllVariables']=function(_0xa25bdd){var _0x4312c3=_0xa25bdd[_0x398d('0x98')]('{');for(var _0x3d7064=0x1;_0x3d7064<_0x4312c3[_0x398d('0x93')];_0x3d7064+=0x1){var _0x1544e6=_0x4312c3[_0x3d7064][_0x398d('0x98')]('}');if(_0x1544e6[_0x398d('0x93')]>0x1){_0xa25bdd=_0xa25bdd[_0x398d('0x99')]('{'+_0x1544e6[0x0]+'}',this['channel'][_0x398d('0x10')](_0x1544e6[0x0])['extra']||_0x1544e6[0x0]);}}if(_0x4312c3[_0x398d('0x93')]===0x1){return _0xa25bdd[_0x398d('0x47')]();}return this[_0x398d('0x91')](_0xa25bdd);};AGIVertices[_0x398d('0xf')][_0x398d('0x9a')]=function(_0x309db6,_0x50cbba){var _0x30db44=this[_0x398d('0xc')][_0x398d('0x10')](_0x309db6);if(_0x30db44[_0x398d('0x9b')]===-0x1){return _0x30db44;}logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x9c'),_0x50cbba,_0x30db44[_0x398d('0x9d')]));return this['channel'][_0x398d('0x97')](_0x50cbba,_0x30db44[_0x398d('0x9d')]);};AGIVertices[_0x398d('0xf')][_0x398d('0x7d')]=function(_0x36515f){return _0x36515f&&_0x36515f!=='0'&&_0x36515f!=='-1'&&_0x36515f!=='';};AGIVertices['prototype'][_0x398d('0x9e')]=function(_0x1aef07){this[_0x398d('0x33')][_0x398d('0x68')](this,_0x1aef07,'-');_0x1aef07[_0x398d('0x9f')]=_0x1aef07['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices[_0x398d('0xf')][_0x398d('0xa0')]=function(_0x116db8){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xa1'),_0x116db8[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x116db8['text'])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa3'));}var _0x132a4a='\x22'+_0x116db8[_0x398d('0x54')]+'\x22';if(this[_0x398d('0x7d')](_0x116db8[_0x398d('0xa4')])){_0x132a4a+=','+_0x116db8['options'];}var _0x2d7d4e=this[_0x398d('0xc')]['exec'](_0x398d('0xa5'),_0x132a4a);if(_0x2d7d4e['result']===-0x1){return _0x2d7d4e;}return this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0xa6'),_0x132a4a));};AGIVertices[_0x398d('0xf')]['mrcprecog']=function(_0x2fab60){logger['info'](util[_0x398d('0x24')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x2fab60['label']));if(!this['isConfigured'](_0x2fab60[_0x398d('0xa7')])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa8'));}var _0x486252=_0x2fab60['grammar'];if(this[_0x398d('0x7d')](_0x2fab60['options'])){_0x486252+=','+_0x2fab60['options'];}var _0x32e551=this[_0x398d('0xc')]['exec']('MRCPRecog',_0x486252);if(_0x32e551['result']===-0x1){return _0x32e551;}var _0x6a2960=this[_0x398d('0x9a')]('RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE');if(_0x6a2960[_0x398d('0x9b')]===-0x1){return _0x6a2960;}var _0x522c5c=this[_0x398d('0x9a')](_0x398d('0xa9'),_0x398d('0xaa'));if(_0x522c5c[_0x398d('0x9b')]===-0x1){return _0x522c5c;}var _0x11f9f4=this[_0x398d('0x9a')](_0x398d('0xab'),_0x398d('0xac'));if(_0x11f9f4[_0x398d('0x9b')]===-0x1){return _0x11f9f4;}return this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0xad'),_0x486252));};AGIVertices[_0x398d('0xf')][_0x398d('0xae')]=function(_0x4ac3f9){logger[_0x398d('0x29')](util['format'](_0x398d('0xaf'),_0x4ac3f9[_0x398d('0xa2')]));return this['channel'][_0x398d('0xae')]([_0x4ac3f9[_0x398d('0xb0')],_0x4ac3f9[_0x398d('0xb1')]]);};AGIVertices[_0x398d('0xf')][_0x398d('0xb2')]=function(_0x1a7cf1){logger[_0x398d('0x29')](util['format']('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1a7cf1[_0x398d('0xa2')]));if(this['isConfigured'](_0x1a7cf1['timeout'])){logger['info'](util[_0x398d('0x24')](_0x398d('0xb3'),_0x1a7cf1['timeout']));var _0x233ffe=this[_0x398d('0xc')][_0x398d('0xb4')](_0x1a7cf1['timeout']);if(_0x233ffe['result']===-0x1){return _0x233ffe;}}return this['channel']['answer']();};AGIVertices[_0x398d('0xf')][_0x398d('0xb5')]=function(_0x134167){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x134167[_0x398d('0xa2')]));if(!this['isConfigured'](_0x134167[_0x398d('0x45')])){return this[_0x398d('0xc')]['error'](_0x134167,_0x398d('0xb6'));}_0x134167[_0x398d('0xb7')]=moment();if(this[_0x398d('0x7d')](_0x134167['delay'])){_0x134167[_0x398d('0xb7')]=moment()[_0x398d('0xb8')](_0x134167[_0x398d('0xb9')],'minutes');}if(!this[_0x398d('0x7d')](_0x134167[_0x398d('0x48')])){_0x134167['callback_priority']=0x2;}this[_0x398d('0x3f')][_0x398d('0x68')](this,_0x134167);return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xbb'),_0x134167[_0x398d('0xbc')],_0x134167[_0x398d('0x45')],_0x134167[_0x398d('0xb7')]));};AGIVertices[_0x398d('0xf')][_0x398d('0xbd')]=function(_0x51ee0b){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xbe'),_0x51ee0b[_0x398d('0xa2')]));var _0x498e8d=this[_0x398d('0xc')][_0x398d('0xbf')](_0x51ee0b[_0x398d('0xc0')],_0x51ee0b[_0x398d('0xa4')]);if(_0x498e8d[_0x398d('0x9b')]===-0x1){return _0x498e8d;}return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xc1'),_0x51ee0b['application'],_0x51ee0b[_0x398d('0xa4')]));};AGIVertices[_0x398d('0xf')]['lumenvoxtts']=function(_0x3e94a1){logger['info'](util[_0x398d('0x24')](_0x398d('0xc2'),_0x3e94a1[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x3e94a1['text'])){return this['channel'][_0x398d('0xba')](_0x398d('0xa3'));}var _0x17de53='\x22'+_0x3e94a1[_0x398d('0x54')]+'\x22';if(this[_0x398d('0x7d')](_0x3e94a1['options'])){_0x17de53+=','+_0x3e94a1[_0x398d('0xa4')];}var _0x406aeb=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0xa5'),_0x17de53);if(_0x406aeb['result']===-0x1){return _0x406aeb;}return this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0xa6'),_0x17de53));};AGIVertices[_0x398d('0xf')]['sestektts']=function(_0x522417){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xc3'),_0x522417['label']));if(!this[_0x398d('0x7d')](_0x522417[_0x398d('0x54')])){return this['channel'][_0x398d('0xba')](_0x398d('0xa3'));}var _0x4f8765='\x22'+_0x522417[_0x398d('0x54')]+'\x22';if(this[_0x398d('0x7d')](_0x522417[_0x398d('0xa4')])){_0x4f8765+=','+_0x522417['options'];}var _0xe655d0=this['channel'][_0x398d('0xbf')](_0x398d('0xa5'),_0x4f8765);if(_0xe655d0['result']===-0x1){return _0xe655d0;}return this['channel']['noop'](util['format']('Executed\x20command\x20MRCPSynth\x20%s',_0x4f8765));};AGIVertices[_0x398d('0xf')][_0x398d('0xc4')]=function(_0x37ffaa){logger[_0x398d('0x29')](util['format'](_0x398d('0xc5'),_0x37ffaa[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x37ffaa[_0x398d('0xa7')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20grammar\x20configured');}var _0x5c0733=_0x37ffaa[_0x398d('0xa7')];if(this[_0x398d('0x7d')](_0x37ffaa[_0x398d('0xa4')])){_0x5c0733+=','+_0x37ffaa[_0x398d('0xa4')];}var _0x29c65=this[_0x398d('0xc')]['exec'](_0x398d('0xc6'),_0x5c0733);if(_0x29c65[_0x398d('0x9b')]===-0x1){return _0x29c65;}var _0x504f83=this[_0x398d('0x9a')]('RECOG_CONFIDENCE()',_0x398d('0xc7'));if(_0x504f83[_0x398d('0x9b')]===-0x1){return _0x504f83;}var _0x3e9579=this['getAndSetVariable'](_0x398d('0xa9'),_0x398d('0xc8'));if(_0x3e9579[_0x398d('0x9b')]===-0x1){return _0x3e9579;}var _0x247691=this[_0x398d('0x9a')](_0x398d('0xab'),_0x398d('0xc9'));if(_0x247691['result']===-0x1){return _0x247691;}return this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0xad'),_0x5c0733));};AGIVertices[_0x398d('0xf')][_0x398d('0xca')]=function(_0x203943){logger[_0x398d('0x29')](util['format'](_0x398d('0xcb'),_0x203943['label']));if(!this['isConfigured'](_0x203943['grammar'])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa8'));}var _0x538765=_0x203943['grammar'];if(this[_0x398d('0x7d')](_0x203943['options'])){_0x538765+=','+_0x203943['options'];}var _0x5a4ff7=this['channel'][_0x398d('0xbf')](_0x398d('0xc6'),_0x538765);if(_0x5a4ff7[_0x398d('0x9b')]===-0x1){return _0x5a4ff7;}var _0x57fee9=this[_0x398d('0x9a')](_0x398d('0xcc'),_0x398d('0xcd'));if(_0x57fee9[_0x398d('0x9b')]===-0x1){return _0x57fee9;}var _0x5d25cd=this[_0x398d('0x9a')](_0x398d('0xa9'),_0x398d('0xce'));if(_0x5d25cd[_0x398d('0x9b')]===-0x1){return _0x5d25cd;}var _0x22409d=this[_0x398d('0x9a')](_0x398d('0xab'),_0x398d('0xcf'));if(_0x22409d[_0x398d('0x9b')]===-0x1){return _0x22409d;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xad'),_0x538765));};AGIVertices[_0x398d('0xf')]['database']=function(_0x319273){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xd0'),_0x319273['label']));if(!this[_0x398d('0x7d')](_0x319273[_0x398d('0xd1')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x319273,_0x398d('0xd2'));}var _0x15b777=this[_0x398d('0xd3')][_0x398d('0x68')](this,_0x319273[_0x398d('0xd1')]);if(!_0x15b777){return this['channel'][_0x398d('0x28')](_0x319273,'no\x20odbc\x20database\x20found');}if(!this[_0x398d('0x7d')](_0x319273[_0x398d('0x2b')])){return this['channel'][_0x398d('0x28')](_0x319273,_0x398d('0xd4'));}var _0x5a63e0=_0x319273['query'][_0x398d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xd6'),_0x5a63e0));var _0x2b6952=this['getQueryOdbc']['sync'](this,_0x15b777,_0x5a63e0);this[_0x398d('0x33')][_0x398d('0x68')](this,_0x319273,_0x5a63e0);if(!this[_0x398d('0x7d')](_0x319273[_0x398d('0xd7')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xd8'));}var _0x3d4c68=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x319273[_0x398d('0xd7')]);if(!_0x3d4c68){return this[_0x398d('0xc')][_0x398d('0x28')](_0x319273,_0x398d('0xd9'));}var _0x42ad1d=this;_0x2b6952[_0x398d('0xda')](function(_0x4a8f95,_0xe717e6){Object[_0x398d('0xdb')](_0x4a8f95)[_0x398d('0xda')](function(_0x52fe40){_0x42ad1d['channel'][_0x398d('0x97')](util['format'](_0x398d('0xdc'),_0x3d4c68,_0xe717e6,_0x52fe40),_0x4a8f95[_0x52fe40]);});});this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0xdd'),_0x3d4c68),_0x2b6952[_0x398d('0x93')]);return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')]('variable\x20%s\x20set',_0x3d4c68));};AGIVertices[_0x398d('0xf')][_0x398d('0xde')]=function(_0x2a8ea6){logger[_0x398d('0xdf')](util[_0x398d('0x24')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x2a8ea6['label']));if(!this[_0x398d('0x7d')](_0x2a8ea6[_0x398d('0xe0')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x2a8ea6,_0x398d('0xe1'));}var _0x44a86e=this[_0x398d('0xe2')]['sync'](this,_0x2a8ea6[_0x398d('0xe0')]);if(!_0x44a86e){return this['channel'][_0x398d('0x28')](_0x2a8ea6,_0x398d('0xe3'));}var _0x2bb8b9=this['channel']['exec']('DIAL',[util[_0x398d('0x24')](_0x398d('0xe4'),_0x44a86e),_0x2a8ea6[_0x398d('0x5c')],_0x2a8ea6[_0x398d('0xe5')],_0x2a8ea6[_0x398d('0x5b')]]);if(_0x2bb8b9[_0x398d('0x9b')]===-0x1){return _0x2bb8b9;}return this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xe6'),_0x398d('0xe7')));};AGIVertices[_0x398d('0xf')][_0x398d('0xe8')]=function(_0x472bda){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xe9'),_0x472bda['label']));if(!this['isConfigured'](_0x472bda[_0x398d('0x72')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20key\x20configured');}if(!this[_0x398d('0x7d')](_0x472bda[_0x398d('0x54')])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa3'));}this[_0x398d('0xc')][_0x398d('0xea')]=!![];this['createSquareDetailsReport'](_0x472bda);this[_0x398d('0x3e')](_0x472bda[_0x398d('0x54')],'in','','');this['channel'][_0x398d('0xba')](util[_0x398d('0x24')]('Trying\x20Dialogflow:\x20%s',_0x472bda[_0x398d('0x54')]));var _0x145c84=this[_0x398d('0x71')][_0x398d('0x68')](this,_0x472bda);if(_0x145c84){for(var _0x365a08 in _0x145c84){if(_0x145c84['hasOwnProperty'](_0x365a08)){this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')]('DIALOGFLOW_%s',_0x365a08[_0x398d('0x60')]()),_0x145c84[_0x365a08]);}}this[_0x398d('0x3e')](_0x145c84[_0x398d('0xeb')],'out',_0x398d('0xe8'),'');return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xec'),_0x145c84[_0x398d('0xeb')]));}return this[_0x398d('0xc')][_0x398d('0x28')](_0x472bda,_0x398d('0xed'));};AGIVertices['prototype'][_0x398d('0xee')]=function(_0x4ba606){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0xef'),_0x4ba606[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x4ba606[_0x398d('0x75')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf0'));}if(!this[_0x398d('0x7d')](_0x4ba606[_0x398d('0xf1')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf2'));}if(!this[_0x398d('0x7d')](_0x4ba606['private_key'])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf3'));}if(!this['isConfigured'](_0x4ba606[_0x398d('0x77')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xf4'));}if(!this[_0x398d('0x7d')](_0x4ba606[_0x398d('0x54')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xa3'));}this[_0x398d('0xc')]['bot']=!![];this[_0x398d('0x33')](_0x4ba606);this[_0x398d('0x3e')](_0x4ba606[_0x398d('0x54')],'in','','');this['channel'][_0x398d('0xba')](util['format']('Trying\x20DialogflowV2:\x20%s',_0x4ba606['text']));var _0x320b4c=this[_0x398d('0x74')][_0x398d('0x68')](this,_0x4ba606);if(_0x320b4c){for(var _0x6d6fbe in _0x320b4c){if(_0x320b4c[_0x398d('0x8e')](_0x6d6fbe)){if(_0x6d6fbe!==_0x398d('0xf5')){this[_0x398d('0xc')]['setVariable'](util[_0x398d('0x24')](_0x398d('0xf6'),_0x6d6fbe[_0x398d('0x60')]()),_0x320b4c[_0x6d6fbe]);}}}this[_0x398d('0x3e')](_0x320b4c[_0x398d('0xeb')],_0x398d('0xf7'),'dialogflowV2',_0x320b4c[_0x398d('0xf5')]);return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xf8'),_0x320b4c[_0x398d('0xeb')]));}return this[_0x398d('0xc')]['error'](_0x4ba606,'DialogflowV2\x20is\x20unreachable');};AGIVertices[_0x398d('0xf')][_0x398d('0xf9')]=function(_0x547d86){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x547d86[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x547d86[_0x398d('0xfa')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xfb'));}if(!this['isConfigured'](_0x547d86[_0x398d('0xfc')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xfd'));}if(!this['isConfigured'](_0x547d86[_0x398d('0xfe')])){return this['channel'][_0x398d('0xba')](_0x398d('0xff'));}if(!this[_0x398d('0x7d')](_0x547d86[_0x398d('0x100')])){return this['channel']['noop'](_0x398d('0xa3'));}this['channel']['bot']=!![];this[_0x398d('0x33')](_0x547d86);this['createSquareMessage'](_0x547d86[_0x398d('0x54')],'in','','');this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x101'),_0x547d86[_0x398d('0x54')]));var _0xabc93c=this[_0x398d('0x102')][_0x398d('0x68')](this,_0x547d86);if(_0xabc93c){for(var _0xd8fa1 in _0xabc93c){if(_0xabc93c['hasOwnProperty'](_0xd8fa1)){this[_0x398d('0xc')]['setVariable'](util[_0x398d('0x24')](_0x398d('0x103'),_0xd8fa1[_0x398d('0x60')]()),_0xabc93c[_0xd8fa1]);}}this[_0x398d('0x3e')](_0xabc93c[_0x398d('0xeb')],_0x398d('0xf7'),_0x398d('0xf9'),'');if(_0xabc93c['audiofile']){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x104'),_0xabc93c['audiofile']));var _0xd5925=this[_0x398d('0xc')][_0x398d('0x105')](_0xabc93c[_0x398d('0x106')]);try{fs[_0x398d('0x107')](_0xabc93c[_0x398d('0x106')]+_0x398d('0x108'));}catch(_0xea47b5){logger[_0x398d('0x28')](_0xea47b5);}return _0xd5925;}else{return this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0x109'),_0xabc93c[_0x398d('0xeb')]));}}return this[_0x398d('0xc')]['error'](_0x547d86,_0x398d('0x10a'));};AGIVertices['prototype'][_0x398d('0x10b')]=function(_0x20bc91){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x10c'),_0x20bc91['label']));return this[_0x398d('0xc')][_0x398d('0xba')]('end');};AGIVertices['prototype']['ext_dial']=function(_0x57032e){logger[_0x398d('0x29')](util['format'](_0x398d('0x10d'),_0x57032e[_0x398d('0xa2')]));var _0x1459e0='';if(_0x57032e[_0x398d('0x10e')]){if(!this[_0x398d('0x7d')](_0x57032e[_0x398d('0x10e')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x57032e,'no\x20trunk\x20selected');}else{var _0x2f2434=parseInt(_0x57032e[_0x398d('0x10e')],0xa);if(isNaN(_0x2f2434)){_0x1459e0=_0x57032e[_0x398d('0x10e')];}else{_0x1459e0=this[_0x398d('0x1a')][_0x398d('0x68')](this,_0x57032e[_0x398d('0x10e')]);if(!_0x1459e0){return this[_0x398d('0xc')][_0x398d('0x28')](_0x57032e,'no\x20trunk\x20found');}}}}else if(_0x57032e['trunk_name']){_0x1459e0=_0x57032e[_0x398d('0x10f')];}else{return this['channel'][_0x398d('0x28')](_0x57032e,_0x398d('0x110'));}var _0x3c776b=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0xe7'),[util[_0x398d('0x24')](_0x398d('0x111'),_0x1459e0,_0x57032e[_0x398d('0xbc')]),_0x57032e[_0x398d('0x5c')],_0x57032e[_0x398d('0xe5')],_0x57032e[_0x398d('0x5b')]]);if(_0x3c776b[_0x398d('0x9b')]===-0x1){return _0x3c776b;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xe6'),_0x398d('0xe7')));};AGIVertices[_0x398d('0xf')][_0x398d('0x112')]=function(_0x4c1f39){logger[_0x398d('0x29')](util['format'](_0x398d('0x113'),_0x4c1f39['label']));return this[_0x398d('0xc')]['noop'](_0x398d('0x112'));};AGIVertices['prototype'][_0x398d('0xa')]=function(_0xd91015){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x114'),_0xd91015['label']));if(_0xd91015[_0x398d('0x9f')]===0x0){return this['maxRetry'](_0xd91015);}_0xd91015[_0x398d('0x9f')]-=0x1;if(!this[_0x398d('0x7d')](_0xd91015[_0x398d('0x115')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0xd91015,_0x398d('0x116'));}var _0x433d2b=this[_0x398d('0x1b')]['sync'](this,_0xd91015['file_id']);if(!_0x433d2b){return this[_0x398d('0xc')][_0x398d('0x28')](_0xd91015,_0x398d('0x117'));}if(!this[_0x398d('0x7d')](_0xd91015[_0x398d('0xd7')])){return this[_0x398d('0xc')]['error'](_0x398d('0xd8'));}var _0x54ac9b=this['channel'][_0x398d('0x118')](_0x433d2b,_0xd91015[_0x398d('0x119')],_0xd91015[_0x398d('0x11a')]);var _0x1ea60c=_0x54ac9b[_0x398d('0x9b')]?_0x54ac9b[_0x398d('0x9b')][_0x398d('0x47')]():'';logger[_0x398d('0x29')](_0x398d('0x11b'),JSON[_0x398d('0x6b')](_0x54ac9b));if(_0x54ac9b[_0x398d('0x9b')]===-0x1){this['createSquareDetailsReport']['sync'](this,_0xd91015,_0x1ea60c);return _0x54ac9b;}else if(_0x54ac9b[_0x398d('0x9d')]==='timeout'){_0x54ac9b[_0x398d('0x9b')]=_0x1ea60c[_0x398d('0x93')]>=parseInt(_0xd91015[_0x398d('0x11c')])?'x':'i';}else{_0x54ac9b['result']=_0x1ea60c['length']>=parseInt(_0xd91015['mindigit'])&&_0x1ea60c['length']<=parseInt(_0xd91015['maxdigit'])?'x':'i';}var _0x562cf6=this['getVariable'][_0x398d('0x68')](this,_0xd91015[_0x398d('0xd7')]);if(!_0x562cf6){return this[_0x398d('0xc')][_0x398d('0x28')](_0xd91015,_0x398d('0xd9'));}this[_0x398d('0xc')][_0x398d('0x97')](_0x562cf6,_0x1ea60c);if(this[_0x398d('0x7d')](_0xd91015[_0x398d('0x11d')])){var _0x46fcf4=parseInt(_0xd91015['hiddendigitsnum'],0xa);var _0x1be1ec=rs[_0x398d('0x11e')]({'charset':'*','length':_0x46fcf4});var _0x17014c=_0x1ea60c[_0x398d('0x93')];if(_0x17014c>0x0){if(_0x17014c>_0x46fcf4){this[_0x398d('0x33')][_0x398d('0x68')](this,_0xd91015,_0xd91015[_0x398d('0x11f')]===_0x398d('0x120')?_0x1be1ec+_0x1ea60c[_0x398d('0x121')](_0x46fcf4):_0x1ea60c[_0x398d('0x121')](0x0,_0x17014c-_0x46fcf4)+_0x1be1ec);}else{this['createSquareDetailsReport'][_0x398d('0x68')](this,_0xd91015,rs['generate']({'charset':'*','length':_0x17014c}));}}else{this[_0x398d('0x33')]['sync'](this,_0xd91015,'');}}else{this[_0x398d('0x33')]['sync'](this,_0xd91015,_0x1ea60c);}return _0x54ac9b;};AGIVertices[_0x398d('0xf')]['getsecretdigits']=function(_0x40e178){logger['info'](util[_0x398d('0x24')](_0x398d('0x122'),_0x40e178[_0x398d('0xa2')]));return this[_0x398d('0xa')](_0x40e178);};AGIVertices['prototype'][_0x398d('0x123')]=function(_0x4eb228){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x124'),_0x4eb228[_0x398d('0xa2')]));this[_0x398d('0x33')][_0x398d('0x68')](this,_0x4eb228,_0x4eb228['goalname']);return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x125'),_0x4eb228[_0x398d('0x126')]));};AGIVertices[_0x398d('0xf')][_0x398d('0x127')]=function(_0x5bc3f8){logger[_0x398d('0x29')](util[_0x398d('0x24')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5bc3f8[_0x398d('0xa2')]));if(!this['isConfigured'](_0x5bc3f8['aws_access_key_id'])||!this[_0x398d('0x7d')](_0x5bc3f8[_0x398d('0x81')])){return this[_0x398d('0xc')]['noop'](_0x398d('0x128'));}if(!this[_0x398d('0x7d')](_0x5bc3f8[_0x398d('0x54')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xa3'));}this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')]('Trying\x20aws\x20Polly\x20%s',_0x5bc3f8['text']));var _0x54c9fd=this[_0x398d('0x7f')][_0x398d('0x68')](this,_0x5bc3f8);if(_0x54c9fd){this[_0x398d('0xc')]['noop'](util['format'](_0x398d('0x129'),_0x54c9fd));var _0x1e001a=this[_0x398d('0xc')]['streamFile'](_0x54c9fd);try{fs[_0x398d('0x107')](_0x54c9fd+_0x398d('0x108'));}catch(_0x4ad78b){logger[_0x398d('0x28')](_0x4ad78b);}return _0x1e001a;}return this[_0x398d('0xc')][_0x398d('0x28')](_0x5bc3f8,_0x398d('0x12a'));};AGIVertices['prototype'][_0x398d('0x12b')]=function(_0x3f8f07){logger['info'](util[_0x398d('0x24')](_0x398d('0x12c'),_0x3f8f07[_0x398d('0xa2')]));if(!this['isConfigured'](_0x3f8f07[_0x398d('0x80')])||!this[_0x398d('0x7d')](_0x3f8f07['aws_secret_access_key'])){return this[_0x398d('0xc')]['noop'](_0x398d('0x128'));}if(!this[_0x398d('0x7d')](_0x3f8f07[_0x398d('0x88')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20bot\x20name\x20configured');}if(!this[_0x398d('0x7d')](_0x3f8f07[_0x398d('0x54')])){return this['channel']['noop'](_0x398d('0xa3'));}this[_0x398d('0xc')][_0x398d('0xea')]=!![];this[_0x398d('0x33')](_0x3f8f07);this['createSquareMessage'](_0x3f8f07[_0x398d('0x54')],'in','','');this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x12d'),_0x3f8f07[_0x398d('0x54')]));var _0x1da18f=this[_0x398d('0x86')][_0x398d('0x68')](this,_0x3f8f07);if(_0x1da18f){for(var _0x2d1d12 in _0x1da18f){if(_0x1da18f['hasOwnProperty'](_0x2d1d12)&&_[_0x398d('0x8f')](_0x1da18f[_0x2d1d12])){this[_0x398d('0xc')][_0x398d('0x97')](util['format'](_0x398d('0x12e'),_0x2d1d12[_0x398d('0x60')]()),_0x1da18f[_0x2d1d12]);}}if(_[_0x398d('0x41')](_0x1da18f[_0x398d('0x6f')])){return this['channel'][_0x398d('0xba')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x398d('0x3e')](_0x1da18f[_0x398d('0x6f')],_0x398d('0xf7'),_0x398d('0x12f'),'');return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x130'),_0x1da18f['message']));}}return this[_0x398d('0xc')]['error'](_0x3f8f07,_0x398d('0x131'));};AGIVertices[_0x398d('0xf')][_0x398d('0x132')]=function(_0x3488cc){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x133'),_0x3488cc['label'],_0x3488cc[_0x398d('0x5c')]));if(!this[_0x398d('0x7d')](_0x3488cc[_0x398d('0x72')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x134'));}var _0x57eb17=_0x398d('0x135');var _0x3f850a=util[_0x398d('0x24')](_0x398d('0x136'),FILES_PATH,rs[_0x398d('0x11e')](0x4));var _0x4d3069=util[_0x398d('0x24')](_0x398d('0x96'),_0x3f850a,_0x57eb17);var _0x27b39b=!![];if(_0x3488cc[_0x398d('0x137')]===_0x398d('0x138')){_0x27b39b=![];}var _0x49d460=this[_0x398d('0xc')][_0x398d('0x139')](_0x3f850a,_0x57eb17,_0x3488cc[_0x398d('0x13a')],_0x3488cc[_0x398d('0x5c')],undefined,_0x27b39b);if(_0x49d460[_0x398d('0x9b')]!==-0x1){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('google\x20%s\x20file\x20created',_0x4d3069));var _0x176cd9=this[_0x398d('0x89')][_0x398d('0x68')](this,_0x3488cc,_0x4d3069);if(_0x176cd9){for(var _0x2b0df8 in _0x176cd9){if(_0x176cd9['hasOwnProperty'](_0x2b0df8)){this[_0x398d('0xc')]['setVariable'](util['format']('GOOGLE_ASR_%s',_0x2b0df8['toUpperCase']()),_0x176cd9[_0x2b0df8]);}}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x13b'),JSON[_0x398d('0x6b')](_0x176cd9)));}}return _0x49d460;};AGIVertices[_0x398d('0xf')][_0x398d('0x13c')]=function(_0x28c122){logger['info'](util[_0x398d('0x24')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x28c122['label']));if(!this[_0x398d('0x7d')](_0x28c122['appid'])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x13d'));}if(!this[_0x398d('0x7d')](_0x28c122[_0x398d('0x13e')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x13f'));}var _0x3d005c='wav';var _0xa8c2e8=util[_0x398d('0x24')]('%s/recordings/%s',FILES_PATH,rs[_0x398d('0x11e')](0x4));var _0x37ff49=util['format'](_0x398d('0x96'),_0xa8c2e8,_0x3d005c);var _0x4ed02a=!![];if(_0x28c122[_0x398d('0x137')]===_0x398d('0x138')){_0x4ed02a=![];}var _0x49bb3d=this[_0x398d('0xc')]['recordFile'](_0xa8c2e8,_0x3d005c,_0x28c122[_0x398d('0x13a')],_0x28c122['timeout'],undefined,_0x4ed02a);if(_0x49bb3d[_0x398d('0x9b')]!==-0x1){this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x140'),_0x37ff49));var _0x1093d6=this['tildeASR'][_0x398d('0x68')](this,_0x28c122,_0x37ff49);if(_0x1093d6){for(var _0x1acd33 in _0x1093d6){if(_0x1093d6[_0x398d('0x8e')](_0x1acd33)){this[_0x398d('0xc')][_0x398d('0x97')](util['format'](_0x398d('0x141'),_0x1acd33[_0x398d('0x60')]()),_0x1093d6[_0x1acd33]);}}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x142'),JSON[_0x398d('0x6b')](_0x1093d6)));}}return _0x49bb3d;};AGIVertices[_0x398d('0xf')]['gotoc']=function(_0x4bb6b3){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x143'),_0x4bb6b3[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0x144')](_0x4bb6b3[_0x398d('0x39')],_0x4bb6b3[_0x398d('0x3a')],_0x4bb6b3[_0x398d('0x145')]);};AGIVertices[_0x398d('0xf')][_0x398d('0x146')]=function(_0x28fefd){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x147'),_0x28fefd[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x28fefd[_0x398d('0x148')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x28fefd,_0x398d('0x149'));}try{var _0x453b07=eval(_0x28fefd[_0x398d('0x148')])?_0x398d('0x14a'):_0x398d('0x14b');this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x14c'),_0x28fefd[_0x398d('0x148')],_0x453b07));return{'code':0xc8,'result':_0x453b07};}catch(_0x478b17){return{'code':0xc8,'result':_0x398d('0x14b')};}};AGIVertices[_0x398d('0xf')]['gotoiftime']=function(_0x489b5d){logger[_0x398d('0x29')](util['format'](_0x398d('0x14d'),_0x489b5d[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x489b5d[_0x398d('0x14e')])){return this[_0x398d('0xc')]['error'](_0x489b5d,_0x398d('0x14f'));}var _0x12d670=this[_0x398d('0x1e')][_0x398d('0x68')](this,_0x489b5d[_0x398d('0x14e')]);if(!_0x12d670){return this['channel']['error'](_0x489b5d,_0x398d('0x150'));}for(var _0x206e0b=0x0;_0x206e0b<_0x12d670['length'];_0x206e0b+=0x1){var _0x55d2df=this[_0x398d('0xc')][_0x398d('0x10')](util['format'](_0x398d('0x151'),_0x12d670[_0x206e0b]));if(_0x55d2df['result']===-0x1){return _0x55d2df;}logger['info'](util[_0x398d('0x24')](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x55d2df[_0x398d('0x9d')]));if(_0x55d2df[_0x398d('0x9d')]===_0x398d('0x14a')){logger[_0x398d('0x29')](util['format'](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x398d('0x14a')));this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x398d('0x14a')));return{'code':0xc8,'result':_0x398d('0x14a')};}else{logger[_0x398d('0x29')](util['format'](_0x398d('0x152'),_0x12d670[_0x206e0b],_0x398d('0x14b')));this[_0x398d('0xc')]['noop'](util['format'](_0x398d('0x152'),_0x12d670[_0x206e0b],'false'));}}return{'code':0xc8,'result':_0x398d('0x14b')};};AGIVertices[_0x398d('0xf')][_0x398d('0x153')]=function(_0x3318de){logger[_0x398d('0x29')](util['format'](_0x398d('0x154'),_0x3318de['label']));return this[_0x398d('0xc')][_0x398d('0x153')]();};AGIVertices[_0x398d('0xf')][_0x398d('0x155')]=function(_0x18a70b){logger[_0x398d('0x29')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x18a70b[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x18a70b[_0x398d('0x72')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x134'));}var _0x333c7d=_0x398d('0x135');var _0x564f2a=util[_0x398d('0x24')](_0x398d('0x136'),FILES_PATH,rs[_0x398d('0x11e')](0x4));var _0x5dda21=util[_0x398d('0x24')]('%s.%s',_0x564f2a,_0x333c7d);var _0x5a4e7d=!![];if(_0x18a70b[_0x398d('0x137')]===_0x398d('0x138')){_0x5a4e7d=![];}var _0x1f8075=this[_0x398d('0xc')][_0x398d('0x139')](_0x564f2a,_0x333c7d,_0x18a70b[_0x398d('0x13a')],_0x18a70b[_0x398d('0x5c')],undefined,_0x5a4e7d);if(_0x1f8075[_0x398d('0x9b')]!==-0x1){this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x156'),_0x5dda21));var _0x196646=this[_0x398d('0x7b')][_0x398d('0x68')](this,_0x18a70b,_0x5dda21);if(_0x196646){for(var _0x59db17 in _0x196646){if(_0x196646['hasOwnProperty'](_0x59db17)){this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x157'),_0x59db17[_0x398d('0x60')]()),_0x196646[_0x59db17]);}}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x158'),JSON[_0x398d('0x6b')](_0x196646)));}}return _0x1f8075;};AGIVertices['prototype'][_0x398d('0x159')]=function(_0x380c7f){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x15a'),_0x380c7f[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x380c7f['key'])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x134'));}if(!this[_0x398d('0x7d')](_0x380c7f[_0x398d('0x54')])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20text\x20configured');}this['channel']['noop'](util['format'](_0x398d('0x15b'),_0x380c7f['text']));var _0x36a1be=this[_0x398d('0x78')]['sync'](this,_0x380c7f);if(_0x36a1be){this[_0x398d('0xc')]['noop'](util['format']('ispeech\x20%s\x20file\x20created',_0x36a1be));var _0x21ec33=this[_0x398d('0xc')][_0x398d('0x105')](_0x36a1be,_0x380c7f[_0x398d('0x13a')]);try{fs['unlink'](_0x36a1be+_0x398d('0x108'));}catch(_0x1a46c9){logger[_0x398d('0x28')](_0x1a46c9);}return _0x21ec33;}return this[_0x398d('0xc')]['error'](_0x380c7f,_0x398d('0x15c'));};AGIVertices[_0x398d('0xf')]['login']=function(_0x5b452f){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x15d'),_0x5b452f['label']));if(!this[_0x398d('0x7d')](_0x5b452f[_0x398d('0x15e')])){return this['channel'][_0x398d('0x28')](_0x5b452f,_0x398d('0x15f'));}logger[_0x398d('0x29')](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f[_0x398d('0x15e')]));var _0x5af9d5=this[_0x398d('0x4f')][_0x398d('0x68')](this,_0x5b452f[_0x398d('0x15e')]);if(_0x5af9d5){logger['info'](util[_0x398d('0x24')](_0x398d('0x160'),this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f['findBy']));return{'code':0xc8,'result':_0x398d('0x161')};}else{logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x162'),this[_0x398d('0xc')][_0x398d('0x36')],_0x5b452f['findBy']));this['channel'][_0x398d('0xba')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x398d('0x36')],_0x5b452f[_0x398d('0x15e')]));return{'code':0xc8,'result':_0x398d('0x163')};}};AGIVertices[_0x398d('0xf')][_0x398d('0x164')]=function(_0x4c2c31){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x165'),_0x4c2c31[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x4c2c31[_0x398d('0x15e')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x4c2c31,_0x398d('0x15f'));}logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x166'),this[_0x398d('0xc')][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));var _0x1eac9c=this[_0x398d('0x4e')][_0x398d('0x68')](this,_0x4c2c31[_0x398d('0x15e')]);if(_0x1eac9c){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x160'),this['channel'][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));this['channel'][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x162'),this[_0x398d('0xc')]['callerid'],_0x4c2c31[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x4c2c31[_0x398d('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x398d('0x167')]=function(_0x46ef8b){logger[_0x398d('0x29')](util['format'](_0x398d('0x168'),_0x46ef8b['label']));if(!this['isConfigured'](_0x46ef8b[_0x398d('0x169')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x46ef8b,_0x398d('0x16a'));}this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x16b'),_0x46ef8b[_0x398d('0x169')]));var _0x4ff77a=eval(_0x46ef8b[_0x398d('0x169')]);if(!this[_0x398d('0x7d')](_0x46ef8b[_0x398d('0xd7')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0xd8'));}var _0x3b61bd=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x46ef8b['variable_id']);if(!_0x3b61bd){return this['channel']['error'](_0x46ef8b,'no\x20variable\x20found');}if(_[_0x398d('0x16c')](_0x4ff77a)){var _0x4d9ef5=this;_0x4ff77a['forEach'](function(_0x38544f,_0x4236fe){_0x4d9ef5[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x16d'),_0x3b61bd,_0x4236fe),_0x38544f);});return this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x16e'),_0x3b61bd));}else{return this[_0x398d('0xc')][_0x398d('0x97')](_0x3b61bd,_0x4ff77a);}};AGIVertices['prototype']['menu']=function(_0x55c9b7){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x55c9b7['label']));if(_0x55c9b7[_0x398d('0x9f')]===0x0){return this['maxRetry'](_0x55c9b7);}_0x55c9b7[_0x398d('0x9f')]-=0x1;if(!this['isConfigured'](_0x55c9b7['file_id'])){return this['channel'][_0x398d('0x28')](_0x55c9b7,'no\x20file\x20audio\x20selected');}var _0x4c12e2=this['getSound']['sync'](this,_0x55c9b7[_0x398d('0x115')]);if(!_0x4c12e2){return this[_0x398d('0xc')][_0x398d('0x28')](_0x55c9b7,_0x398d('0x117'));}var _0x22839d=this[_0x398d('0xc')][_0x398d('0x118')](_0x4c12e2,_0x55c9b7['response'],_0x55c9b7[_0x398d('0x16f')]);var _0xe1c3c6=_0x22839d[_0x398d('0x9b')];if(_0x22839d[_0x398d('0x9b')]===-0x1){this[_0x398d('0x33')][_0x398d('0x68')](this,_0x55c9b7,'-1');return _0x22839d;}else if(_0x22839d[_0x398d('0x9d')]===_0x398d('0x5c')){_0x22839d[_0x398d('0x9b')]=_0x22839d['result'][_0x398d('0x93')]>0x0?_0x22839d['result']:'t';}else if(_['isEmpty'](_0x22839d[_0x398d('0x9b')])){_0x22839d[_0x398d('0x9b')]='#';_0xe1c3c6='#';}if(!this[_0x398d('0x7d')](_0x55c9b7[_0x398d('0xd7')])){this['channel']['noop'](_0x398d('0xd8'));}else{var _0x483fff=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x55c9b7[_0x398d('0xd7')]);if(!_0x483fff){return this[_0x398d('0xc')][_0x398d('0x28')](_0x55c9b7,'no\x20variable\x20found');}this[_0x398d('0xc')]['setVariable'](_0x483fff,_0xe1c3c6);}this[_0x398d('0x33')]['sync'](this,_0x55c9b7,_0xe1c3c6);return _0x22839d;};AGIVertices['prototype'][_0x398d('0xba')]=function(_0xc4c224){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x170'),_0xc4c224['label']));return this[_0x398d('0xc')][_0x398d('0xba')](_0xc4c224['output']||_0xc4c224['label']);};AGIVertices[_0x398d('0xf')][_0x398d('0x171')]=function(_0x262a46){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x262a46['label']));if(!this[_0x398d('0x7d')](_0x262a46[_0x398d('0x15e')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x262a46,_0x398d('0x15f'));}logger[_0x398d('0x29')](util[_0x398d('0x24')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x262a46[_0x398d('0x15e')]));var _0x3e725e=this[_0x398d('0x49')][_0x398d('0x68')](this,_0x262a46[_0x398d('0x172')]);var _0x3c647b=this[_0x398d('0x4b')][_0x398d('0x68')](this,_0x262a46[_0x398d('0x15e')],_0x3e725e);if(_0x3c647b){logger[_0x398d('0x29')](util[_0x398d('0x24')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x262a46[_0x398d('0x15e')]));this[_0x398d('0xc')]['noop'](util['format'](_0x398d('0x160'),this['channel'][_0x398d('0x36')],_0x262a46[_0x398d('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util[_0x398d('0x24')](_0x398d('0x162'),this[_0x398d('0xc')]['callerid'],_0x262a46[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x398d('0xc')][_0x398d('0x36')],_0x262a46[_0x398d('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x398d('0xf')]['playback']=function(_0x5f8bf2){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x173'),_0x5f8bf2[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x5f8bf2['file_id'])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x5f8bf2,_0x398d('0x116'));}var _0x498100=this[_0x398d('0x1b')][_0x398d('0x68')](this,_0x5f8bf2[_0x398d('0x115')]);if(!_0x498100){return this[_0x398d('0xc')][_0x398d('0x28')](_0x5f8bf2,_0x398d('0x117'));}var _0x3da9ac=this[_0x398d('0xc')][_0x398d('0xbf')]('PLAYBACK',[_0x498100,_0x5f8bf2['opts']]);if(_0x3da9ac[_0x398d('0x9b')]===-0x1){return _0x3da9ac;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('Executed\x20command\x20%s\x20%s',_0x398d('0x174'),_0x498100));};AGIVertices[_0x398d('0xf')][_0x398d('0x175')]=function(_0x47dc21){logger[_0x398d('0x29')](util['format'](_0x398d('0x176'),_0x47dc21['label']));if(!this[_0x398d('0x7d')](_0x47dc21[_0x398d('0x177')])){return this[_0x398d('0xc')]['error'](_0x47dc21,_0x398d('0x178'));}var _0x5f17cc='';var _0x697906=parseInt(_0x47dc21['queue_id'],0xa);if(isNaN(_0x697906)){_0x5f17cc=_0x47dc21['queue_id'];}else{_0x5f17cc=this['getVoiceQueue'][_0x398d('0x68')](this,_0x47dc21['queue_id']);if(!_0x5f17cc){return this['channel'][_0x398d('0x28')](_0x47dc21,_0x398d('0x179'));}}var _0x440cd9='';if(this[_0x398d('0x7d')](_0x47dc21[_0x398d('0x115')])){var _0xc4ee5c=this[_0x398d('0x1b')][_0x398d('0x68')](this,_0x47dc21[_0x398d('0x115')]);if(_0xc4ee5c){_0x440cd9=_0xc4ee5c;}}this[_0x398d('0x33')][_0x398d('0x68')](this,_0x47dc21,_0x5f17cc);if(_0x47dc21[_0x398d('0xe5')]['indexOf']('x')<0x0){_0x47dc21[_0x398d('0xe5')]+='x';}if(_0x47dc21[_0x398d('0xe5')][_0x398d('0x17a')]('X')<0x0){_0x47dc21['opts']+='X';}this[_0x398d('0xc')][_0x398d('0x97')](_0x398d('0x17b'),_0x5f17cc?_0x5f17cc[_0x398d('0x17c')]():'');var _0x554a64=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0x17d'),[_0x5f17cc,_0x47dc21['opts'],_0x47dc21[_0x398d('0x5b')],_0x440cd9,_0x47dc21['timeout'],_0x47dc21[_0x398d('0xae')],_0x47dc21[_0x398d('0x17e')],_0x47dc21['gosub'],'',_0x47dc21[_0x398d('0x17f')]]);if(_0x554a64['result']===-0x1){return _0x554a64;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xc1'),'QUEUE',_0x5f17cc));};AGIVertices[_0x398d('0xf')]['record']=function(_0x399265){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x180'),_0x399265['label']));var _0x4b16ec=_0x399265[_0x398d('0x181')]||_0x398d('0x135');var _0x5f0d08=util[_0x398d('0x24')](_0x398d('0x182'),this[_0x398d('0xc')][_0x398d('0x34')],rs['generate'](0x5));var _0x3fbbf0=util[_0x398d('0x24')](_0x398d('0x183'),FILES_PATH,_0x5f0d08,_0x4b16ec);var _0x9f3b19=util[_0x398d('0x24')](_0x398d('0x136'),FILES_PATH,_0x5f0d08);this['createSquareRecording'][_0x398d('0x68')](this,_0x399265,_0x5f0d08,_0x3fbbf0);this[_0x398d('0xc')]['setVariable'](_0x398d('0x184'),_0x5f0d08);logger[_0x398d('0x29')](_0x398d('0x185'),_0x9f3b19,_0x4b16ec,_0x399265[_0x398d('0x186')],_0x399265[_0x398d('0x5c')]);return this['channel'][_0x398d('0x139')](_0x9f3b19,_0x4b16ec,_0x399265[_0x398d('0x186')],_0x399265[_0x398d('0x5c')],undefined,!![]);};AGIVertices['prototype'][_0x398d('0x187')]=function(_0x41ad5d){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x41ad5d[_0x398d('0xa2')]));if(!this['isConfigured'](_0x41ad5d[_0x398d('0x5b')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x188'));}var _0x53535d=this['restAPI'][_0x398d('0x68')](this,_0x41ad5d);logger['info'](util['format'](_0x398d('0x189'),util[_0x398d('0x18a')](_0x53535d,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x41ad5d[_0x398d('0xd7')])){return this['channel']['noop'](_0x398d('0x18b'));}var _0x1cdd5d=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x41ad5d[_0x398d('0xd7')]);if(!_0x1cdd5d){return this[_0x398d('0xc')]['error'](_0x41ad5d,_0x398d('0xd9'));}this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x18c'),_0x1cdd5d),_0x53535d['statusCode']?_0x53535d[_0x398d('0x6d')]:'200');this[_0x398d('0xc')][_0x398d('0x97')](util[_0x398d('0x24')](_0x398d('0x18d'),_0x1cdd5d),_0x53535d[_0x398d('0x6e')]?_0x53535d[_0x398d('0x6e')]:'OK');if(_0x53535d[_0x398d('0x61')]){try{this[_0x398d('0x95')](_0x53535d[_0x398d('0x61')],_0x1cdd5d);}catch(_0x1a3f5b){logger[_0x398d('0x28')](util[_0x398d('0x24')](_0x398d('0x18e'),_0x1cdd5d));}}return this['channel']['noop'](util[_0x398d('0x24')]('variable\x20%s\x20set',_0x1cdd5d));};AGIVertices[_0x398d('0xf')][_0x398d('0x18f')]=function(_0xd3880e){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0xd3880e[_0x398d('0xa2')]));return this['channel']['sayDigits'](_0xd3880e[_0x398d('0x190')][_0x398d('0xd5')](/\s+/g,''),_0xd3880e[_0x398d('0x186')]);};AGIVertices[_0x398d('0xf')][_0x398d('0x191')]=function(_0x144cbb){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x192'),_0x144cbb[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0x193')](_0x144cbb[_0x398d('0x194')][_0x398d('0xd5')](/\s+/g,''),_0x144cbb['escape_digits']);};AGIVertices[_0x398d('0xf')][_0x398d('0x195')]=function(_0x7bef9e){logger['info'](util[_0x398d('0x24')](_0x398d('0x196'),_0x7bef9e[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0x197')](_0x7bef9e['text'],_0x7bef9e[_0x398d('0x186')]);};AGIVertices['prototype'][_0x398d('0x198')]=function(_0x731c96){logger[_0x398d('0x29')](util['format'](_0x398d('0x199'),_0x731c96['label']));if(!this[_0x398d('0x7d')](_0x731c96['account_id'])){return this['channel'][_0x398d('0xba')](_0x398d('0x19a'));}var _0x4ba2a2=this[_0x398d('0x19b')]['sync'](this,_0x731c96[_0x398d('0x19c')]);if(!_0x4ba2a2||!_0x4ba2a2[_0x398d('0x19d')]){return this[_0x398d('0xc')]['error'](_0x731c96,'no\x20mail\x20account\x20found');}var _0x34bf92={'from':util['format'](_0x398d('0x19e'),_0x4ba2a2[_0x398d('0x12')],_0x4ba2a2['email']||_0x4ba2a2['Smtp'][_0x398d('0x19f')]),'to':_0x731c96['to']||'','cc':_0x731c96['cc']||'','bcc':_0x731c96[_0x398d('0x1a0')]||'','subject':_0x731c96[_0x398d('0x1a1')],'html':_0x731c96[_0x398d('0x54')],'text':_0x731c96[_0x398d('0x54')]};if(this[_0x398d('0x7d')](_0x731c96[_0x398d('0x1a2')])){}logger[_0x398d('0xdf')](_0x398d('0x1a3'),JSON[_0x398d('0x6b')](_0x34bf92));this[_0x398d('0x33')][_0x398d('0x68')](this,_0x731c96,_0x731c96[_0x398d('0x19c')]);this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1a4'),_0x4ba2a2[_0x398d('0x12')]));this[_0x398d('0x1d')][_0x398d('0x68')](this,_0x4ba2a2['smtpOptions'],_0x34bf92);return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1a5'));};AGIVertices[_0x398d('0xf')]['sendFax']=function(_0x5c830b){logger[_0x398d('0x29')](util['format'](_0x398d('0x1a6'),_0x5c830b[_0x398d('0xa2')]));return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1a7'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1a8')]=function(_0x899bda){logger['info'](util[_0x398d('0x24')](_0x398d('0x1a9'),_0x899bda[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x899bda[_0x398d('0x1aa')])){return this['channel']['noop'](_0x398d('0x1ab'));}var _0x287e28=this[_0x398d('0x30')][_0x398d('0x68')](this,_0x899bda[_0x398d('0x1aa')]);if(!_0x287e28){return this['channel']['error'](_0x899bda,'no\x20sms\x20account\x20found');}var _0x260b42={'body':_0x899bda[_0x398d('0x1ac')],'phone':_0x899bda['to']||'','SmsAccountId':_0x287e28['id']};logger[_0x398d('0xdf')]('sendSMS\x20message',JSON[_0x398d('0x6b')](_0x260b42));this[_0x398d('0x33')]['sync'](this,_0x899bda,_0x899bda['sms_account_id']);this['channel'][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1ad'),_0x287e28[_0x398d('0x12')]));this[_0x398d('0x32')][_0x398d('0x68')](this,_0x260b42);return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1ae'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1af')]=function(_0x53d4b3){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1b0'),_0x53d4b3[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x53d4b3[_0x398d('0xd7')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x53d4b3,_0x398d('0x1b1'));}var _0x139040=this['getVariable']['sync'](this,_0x53d4b3[_0x398d('0xd7')]);if(!_0x139040){return this[_0x398d('0xc')][_0x398d('0x28')](_0x53d4b3,_0x398d('0xd9'));}return this[_0x398d('0xc')][_0x398d('0x97')](_0x139040,_0x53d4b3['variable_value']);};AGIVertices['prototype'][_0x398d('0x1b2')]=function(_0x3b71cc){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1b3'),_0x3b71cc[_0x398d('0xa2')]));this['channel']['noop'](_0x398d('0x1b4'));var _0x1a1e08=this[_0x398d('0xc')]['getVariable'](_0x398d('0x1b5'));if(!_[_0x398d('0x40')](_0x1a1e08[_0x398d('0x9d')])){this[_0x398d('0xc')]['uniqueid']=_0x1a1e08['extra'];}if(_0x3b71cc['answer']===_0x398d('0x1b6')){this['channel'][_0x398d('0xba')](_0x398d('0x1b7'));return this['channel'][_0x398d('0xb2')]();}return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1b8'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1b9')]=function(_0x186ce8){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1ba'),_0x186ce8[_0x398d('0xa2')]));if(!this['isConfigured'](_0x186ce8[_0x398d('0x1bb')])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x186ce8,_0x398d('0x1bc'));}var _0x543dd6=this['getSquareProject'][_0x398d('0x68')](this,_0x186ce8[_0x398d('0x1bb')]);if(!this[_0x398d('0x7d')](_0x543dd6)){return this[_0x398d('0xc')]['error'](_0x186ce8,util[_0x398d('0x24')](_0x398d('0x1bd'),_0x186ce8[_0x398d('0x1bb')]));}if(_0x543dd6===this[_0x398d('0xc')]['arg_1']){return this[_0x398d('0xc')][_0x398d('0x28')](_0x186ce8,_0x398d('0x1be'));}this[_0x398d('0x33')][_0x398d('0x68')](this,_0x186ce8,_0x543dd6);var _0x28be59=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0x1bf'),util[_0x398d('0x24')](_0x398d('0x1c0'),config['agi'][_0x398d('0x1c1')]||_0x398d('0x1c2'),_0x543dd6,this['channel'][_0x398d('0x3c')]));if(_0x28be59[_0x398d('0x9b')]===-0x1){return _0x28be59;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('Executed\x20command\x20%s\x20%s',_0x398d('0x1bf'),_0x543dd6));};AGIVertices[_0x398d('0xf')][_0x398d('0x1c3')]=function(_0x28da59){logger[_0x398d('0x29')](util[_0x398d('0x24')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x28da59[_0x398d('0xa2')]));var _0x354cc5=this[_0x398d('0x51')][_0x398d('0x68')](this,_0x28da59[_0x398d('0xb0')]);this[_0x398d('0x33')]['sync'](this,_0x28da59,_0x28da59[_0x398d('0xb0')]);if(this[_0x398d('0x7d')](_0x28da59[_0x398d('0xd7')])){var _0x536ba9=this[_0x398d('0x10')][_0x398d('0x68')](this,_0x28da59[_0x398d('0xd7')]);if(_0x536ba9){this[_0x398d('0xc')][_0x398d('0x97')](_0x536ba9,_0x354cc5);return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1c4'),_0x28da59[_0x398d('0xb0')],_0x536ba9));}}return this[_0x398d('0xc')][_0x398d('0xba')](util['format'](_0x398d('0x1c5'),_0x28da59[_0x398d('0xb0')]));};AGIVertices['prototype']['google_cloud_tts']=function(_0x613732){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1c6'),_0x613732['label']));_0x613732['text']=_0x613732['text'][_0x398d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x398d('0x7d')](_0x613732[_0x398d('0x53')])){return this[_0x398d('0xc')][_0x398d('0xba')](_0x398d('0x1c7'));}if(!this[_0x398d('0x7d')](_0x613732['text'])){return this[_0x398d('0xc')][_0x398d('0xba')]('no\x20text\x20configured');}this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1c8'),_0x613732['text']));var _0x1346a8=this[_0x398d('0x52')][_0x398d('0x68')](this,_0x613732);if(_0x1346a8){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1c9'),_0x1346a8));var _0x5d76d8=this[_0x398d('0xc')][_0x398d('0x105')](_0x1346a8);try{fs['unlink'](_0x1346a8+'.wav');}catch(_0x43739d){logger[_0x398d('0x28')](_0x43739d);}return _0x5d76d8;}return this[_0x398d('0xc')][_0x398d('0x28')](_0x613732,_0x398d('0x1ca'));};AGIVertices['prototype'][_0x398d('0x1cb')]=function(_0x1a2e26){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x1a2e26[_0x398d('0xa2')]));_0x1a2e26[_0x398d('0x54')]=_0x1a2e26['text'][_0x398d('0xd5')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x398d('0x7d')](_0x1a2e26['text'])){return this[_0x398d('0xc')]['noop'](_0x398d('0xa3'));}this['channel']['noop'](util[_0x398d('0x24')](_0x398d('0x1cc'),_0x1a2e26[_0x398d('0x54')]));var _0x2b5de5=this[_0x398d('0x59')]['sync'](this,_0x1a2e26);if(_0x2b5de5){this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0x1cd'),_0x2b5de5));var _0x49181c=this[_0x398d('0xc')]['streamFile'](_0x2b5de5);try{fs[_0x398d('0x107')](_0x2b5de5+'.wav');}catch(_0x39d391){logger[_0x398d('0x28')](_0x39d391);}return _0x49181c;}return this[_0x398d('0xc')]['error'](_0x1a2e26,_0x398d('0x1ce'));};AGIVertices[_0x398d('0xf')][_0x398d('0x1cf')]=function(_0x242012){logger[_0x398d('0x29')](util['format'](_0x398d('0x1d0'),_0x242012['label']));if(!this['isConfigured'](_0x242012['findBy'])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x242012,_0x398d('0x15f'));}logger['info'](util[_0x398d('0x24')](_0x398d('0x166'),this[_0x398d('0xc')]['callerid'],_0x242012[_0x398d('0x15e')]));var _0x14a94e=this[_0x398d('0x4d')][_0x398d('0x68')](this,_0x242012[_0x398d('0x15e')]);if(_0x14a94e){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x160'),this[_0x398d('0xc')][_0x398d('0x36')],_0x242012['findBy']));this[_0x398d('0xc')]['noop'](util[_0x398d('0x24')](_0x398d('0x160'),this[_0x398d('0xc')][_0x398d('0x36')],_0x242012[_0x398d('0x15e')]));return{'code':0xc8,'result':_0x398d('0x161')};}else{logger['info'](util[_0x398d('0x24')](_0x398d('0x162'),this['channel']['callerid'],_0x242012[_0x398d('0x15e')]));this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0x398d('0x36')],_0x242012[_0x398d('0x15e')]));return{'code':0xc8,'result':_0x398d('0x163')};}};AGIVertices['prototype'][_0x398d('0x1d1')]=function(_0xaceb3){logger[_0x398d('0x29')](util[_0x398d('0x24')](_0x398d('0x1d2'),_0xaceb3[_0x398d('0xa2')]));var _0x15e0d8=this[_0x398d('0xc')][_0x398d('0xbf')](_0x398d('0x1d3'),[_0xaceb3[_0x398d('0x1d4')],_0xaceb3['options']]);if(_0x15e0d8[_0x398d('0x9b')]===-0x1){return _0x15e0d8;}return this[_0x398d('0xc')][_0x398d('0xba')](util[_0x398d('0x24')](_0x398d('0xc1'),_0x398d('0x1d3'),_0xaceb3['mailbox']));};AGIVertices[_0x398d('0xf')][_0x398d('0x1d5')]=function(_0x1cab1f){logger['info'](util[_0x398d('0x24')](_0x398d('0x1d6'),_0x1cab1f[_0x398d('0xa2')]));if(!this[_0x398d('0x7d')](_0x1cab1f['variable_id'])){return this[_0x398d('0xc')][_0x398d('0x28')](_0x1cab1f,_0x398d('0x1b1'));}var _0x48dda7=this['getVariable'][_0x398d('0x68')](this,_0x1cab1f[_0x398d('0xd7')]);if(!_0x48dda7){return this[_0x398d('0xc')]['error'](_0x1cab1f,_0x398d('0xd9'));}var _0x48249e=this[_0x398d('0xc')][_0x398d('0x10')](_0x48dda7);return{'code':0xc8,'result':_0x48249e['extra']?_0x48249e[_0x398d('0x9d')]:'-'};};String['prototype']['replaceAll']=function(_0x58bc18,_0x4aa1c8){return this['split'](_0x58bc18)[_0x398d('0x1d7')](_0x4aa1c8);};module[_0x398d('0x1d8')]=AGIVertices; \ No newline at end of file +var _0xfd28=['sestekNDA','ispeechTTS','ispeech_tts_language','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_secret_access_key','aws_polly_voice','awsLex','aws_access_key_id','aws_bot_name','googleASR','google_asr_language','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','replaceAllVariables','recursiveNodeIndex','length','isPlainObject','isArray','saveRestApiResult','%s.%s','replaceObjectAllVariables','split','replaceAll','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','extra','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','list_id','custom_app','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','MRCPSynth','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','no\x20grammar\x20configured','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','no\x20variable\x20selected\x20for\x20the\x20result','forEach','keys','setVariable','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','sip_id','getUser','DIAL','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','providerResponse','DialogflowV2\x20Result\x20%s','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','streamFile','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','opts','url','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','variable_id','getData','response','test','mindigit','maxdigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','googleasr','wav','%s/recordings/%s','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','beep','ispeech\x20%s\x20file\x20created','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','no\x20find\x20by\x20configured','failure','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','no\x20file\x20audio\x20found','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','indexOf','XMCS-QUEUE','toLowerCase','position','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','Enter\x20in\x20RESTAPI\x20(%s)\x20block','restAPI','Response:','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','sayNumber','number','replace','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','Smtp','user','bcc','template_id','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','AGI','system','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','apiKey','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20is\x20unreachable','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','lodash','shelljs','randomstring','mustache','request-promise','../../config/logger','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getsecretdigits','channel','mailRpc','getVariable','getVariableById','name','catch','prototype','getVoiceQueue','rpc','getVoiceQueueById','then','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','error','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','callerid','createSquareRecording','extension','priority','accountcode','dnid','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','isNil','agentUnpause','agent','agentLogout','agentLogin','LOCAL','shellCommand','exec','trim','googleCloudTTS','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','method','timeout','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','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','dialogflowV2_language'];(function(_0x5cce01,_0x176354){var _0x4693ca=function(_0x37ca44){while(--_0x37ca44){_0x5cce01['push'](_0x5cce01['shift']());}};_0x4693ca(++_0x176354);}(_0xfd28,0x148));var _0x8fd2=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xfd28[_0xa148b7];return _0x51efd3;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x8fd2('0x0'));var sh=require(_0x8fd2('0x1'));var odbc=require('odbc')();var rs=require(_0x8fd2('0x2'));var moment=require('moment');var Mustache=require(_0x8fd2('0x3'));var rp=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('agi');var config=require(_0x8fd2('0x6'));var scripts=require(_0x8fd2('0x7'));var FILES_PATH=_0x8fd2('0x8');var recursiveMapAttributes=[_0x8fd2('0x9'),_0x8fd2('0xa')];var verticesWithRetry=['menu','getdigits',_0x8fd2('0xb')];var AGIVertices=function(_0x466c3d,_0x5c7e16,_0x4d794a){this[_0x8fd2('0xc')]=_0x466c3d;this['rpc']=_0x5c7e16;this[_0x8fd2('0xd')]=_0x4d794a;};AGIVertices['prototype'][_0x8fd2('0xe')]=function(_0x4fdf0b,_0x1ca2a1){this['rpc'][_0x8fd2('0xf')](_0x4fdf0b)['then'](function(_0x4706b2){_0x1ca2a1(null,_0x4706b2?_0x4706b2[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0xa6d7ca){_0x1ca2a1(_0xa6d7ca);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x13')]=function(_0x1e214c,_0xf22ae){this[_0x8fd2('0x14')][_0x8fd2('0x15')](_0x1e214c)[_0x8fd2('0x16')](function(_0x6b8ef){_0xf22ae(null,_0x6b8ef?_0x6b8ef[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0xa65b4){_0xf22ae(_0xa65b4);});};AGIVertices['prototype'][_0x8fd2('0x17')]=function(_0x5ef478,_0x4f0b17){this['rpc'][_0x8fd2('0x18')](_0x5ef478)[_0x8fd2('0x16')](function(_0x1ced10){_0x4f0b17(null,_0x1ced10?_0x1ced10[_0x8fd2('0x10')]:![]);})['catch'](function(_0xabbeb4){_0x4f0b17(_0xabbeb4);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x19')]=function(_0x36e675,_0x14641a){this['rpc']['getSquareOdbcById'](_0x36e675)[_0x8fd2('0x16')](function(_0x4a2002){_0x14641a(null,_0x4a2002?_0x4a2002[_0x8fd2('0x1a')]:![]);})['catch'](function(_0x1631c6){_0x14641a(_0x1631c6);});};AGIVertices[_0x8fd2('0x12')]['getUser']=function(_0x122b60,_0x4c2be8){this[_0x8fd2('0x14')][_0x8fd2('0x1b')](_0x122b60)['then'](function(_0x1c925c){_0x4c2be8(null,_0x1c925c?_0x1c925c[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0x490ea5){_0x4c2be8(_0x490ea5);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1c')]=function(_0x27d03b,_0x4742cf){this[_0x8fd2('0x14')][_0x8fd2('0x1d')](_0x27d03b)[_0x8fd2('0x16')](function(_0x398925){_0x4742cf(null,_0x398925?_0x398925[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0x3392fb){_0x4742cf(_0x3392fb);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1e')]=function(_0x512e5a,_0x4c6af7){var _0x345bc3=this;this[_0x8fd2('0x14')][_0x8fd2('0x1f')](_0x512e5a)['then'](function(_0x2f26ae){_0x4c6af7(null,_0x2f26ae?_0x345bc3[_0x8fd2('0x20')](_0x2f26ae[_0x8fd2('0x21')]):![]);})[_0x8fd2('0x11')](function(_0x119439){_0x4c6af7(_0x119439);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x22')]=function(_0x5bfaa4,_0xe76676){this[_0x8fd2('0x14')][_0x8fd2('0x23')](_0x5bfaa4)[_0x8fd2('0x16')](function(_0x313902){_0xe76676(null,_0x313902?_0x313902:![]);})[_0x8fd2('0x11')](function(_0x39df3a){_0xe76676(_0x39df3a);});};AGIVertices['prototype']['sendMailMessage']=function(_0x5144ba,_0x422f3c,_0x216350){this[_0x8fd2('0xd')][_0x8fd2('0x24')](_0x5144ba,_0x422f3c)['then'](function(){_0x216350(null);})['catch'](function(_0x3ebeab){_0x216350(_0x3ebeab);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x25')]=function(_0x18fe4e,_0x121fd4){this['rpc'][_0x8fd2('0x26')](_0x18fe4e)['then'](function(_0x20a9d0){if(_0x20a9d0){if(_0x20a9d0['IntervalId']){_0x121fd4(null,[_0x20a9d0[_0x8fd2('0x27')]]);}else{_0x121fd4(null,_['map'](_0x20a9d0[_0x8fd2('0x28')],_0x8fd2('0x27')));}}else{_0x121fd4(null,![]);}})[_0x8fd2('0x11')](function(_0x52422c){_0x121fd4(_0x52422c);});};AGIVertices[_0x8fd2('0x12')]['getSoundPath']=function(_0x11a71d){return util[_0x8fd2('0x29')](_0x8fd2('0x2a'),FILES_PATH,_0x11a71d);};AGIVertices['prototype'][_0x8fd2('0x2b')]=function(_0x199a85,_0x21adc6,_0x58ce31){odbc[_0x8fd2('0x2c')](_0x199a85,function(_0x1f4428){if(_0x1f4428){logger[_0x8fd2('0x2d')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x1f4428);_0x58ce31(_0x1f4428);}else{logger[_0x8fd2('0x2e')](_0x8fd2('0x2f'));odbc['query'](_0x21adc6,function(_0x16b1f3,_0x130072){if(_0x16b1f3){logger[_0x8fd2('0x2e')](_0x8fd2('0x30'),_0x21adc6);_0x58ce31(_0x16b1f3);}else{logger[_0x8fd2('0x2e')](_0x8fd2('0x31'),_0x21adc6);odbc[_0x8fd2('0x32')](function(_0x5e6140){if(_0x5e6140){logger[_0x8fd2('0x2d')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x5e6140);}_0x58ce31(null,_0x130072);});}});}});};AGIVertices['prototype'][_0x8fd2('0x33')]=function(_0xb2c8cc,_0x467f71){this[_0x8fd2('0x14')][_0x8fd2('0x34')](_0xb2c8cc)[_0x8fd2('0x16')](function(_0x5d3727){_0x467f71(null,_0x5d3727?_0x5d3727:![]);})['catch'](function(_0x2df1da){_0x467f71(_0x2df1da);});};AGIVertices['prototype']['createSmsMessage']=function(_0x1c9962,_0x346d93){this[_0x8fd2('0x14')][_0x8fd2('0x35')](_0x1c9962)['then'](function(_0x39cd8e){_0x346d93(null,_0x39cd8e);})[_0x8fd2('0x11')](function(_0x1530ac){_0x346d93(_0x1530ac);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x36')]=function(_0x1de9aa,_0xb1938a,_0x5a60e6){this[_0x8fd2('0x14')][_0x8fd2('0x36')]({'uniqueid':this[_0x8fd2('0xc')][_0x8fd2('0x37')],'node':_0x1de9aa[_0x8fd2('0x38')],'application':_0x1de9aa[_0x8fd2('0x39')],'data':_0xb1938a||null,'project_name':this[_0x8fd2('0xc')]['arg_1'],'callerid':this[_0x8fd2('0xc')][_0x8fd2('0x3a')]})[_0x8fd2('0x16')](function(_0x3ca3dd){if(_0x5a60e6){_0x5a60e6(null,_0x3ca3dd);}})[_0x8fd2('0x11')](function(_0x3fa3be){if(_0x5a60e6){_0x5a60e6(_0x3fa3be);}});};AGIVertices[_0x8fd2('0x12')]['createSquareRecording']=function(_0x383964,_0x515f66,_0x43017d,_0x5c7440){this[_0x8fd2('0x14')][_0x8fd2('0x3b')]({'uniqueid':this[_0x8fd2('0xc')]['uniqueid'],'callerid':this[_0x8fd2('0xc')][_0x8fd2('0x3a')],'calleridname':this[_0x8fd2('0xc')]['calleridname'],'context':this[_0x8fd2('0xc')]['context'],'extension':this[_0x8fd2('0xc')][_0x8fd2('0x3c')],'priority':this[_0x8fd2('0xc')][_0x8fd2('0x3d')],'accountcode':this[_0x8fd2('0xc')][_0x8fd2('0x3e')],'dnid':this[_0x8fd2('0xc')][_0x8fd2('0x3f')],'projectName':this[_0x8fd2('0xc')][_0x8fd2('0x40')],'saveName':_0x515f66,'filename':_0x383964[_0x8fd2('0x41')]||_0x515f66,'savePath':_0x43017d})[_0x8fd2('0x16')](function(_0xd3d8cb){_0x5c7440(null,_0xd3d8cb);})[_0x8fd2('0x11')](function(_0x109d49){_0x5c7440(_0x109d49);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x42')]=function(_0x2a2c69,_0x2fdbe5,_0x57084b,_0x50f894,_0x43a9a8){this[_0x8fd2('0x14')][_0x8fd2('0x42')]({'uniqueid':this['channel']['uniqueid'],'body':_0x2a2c69,'direction':_0x2fdbe5,'providerName':_0x57084b,'providerResponse':_0x50f894})[_0x8fd2('0x16')](function(_0x5603e9){if(_0x43a9a8){_0x43a9a8(null,_0x5603e9);}})[_0x8fd2('0x11')](function(_0x1295c4){if(_0x43a9a8){_0x43a9a8(_0x1295c4);}});};AGIVertices[_0x8fd2('0x12')]['createCmContact']=function(_0x2251d9,_0x1ec30e){this['rpc'][_0x8fd2('0x43')]({'firstName':_[_0x8fd2('0x44')](_0x2251d9[_0x8fd2('0x10')])||_['isNil'](_0x2251d9[_0x8fd2('0x10')])?_0x8fd2('0x45')+Math[_0x8fd2('0x46')]():_0x2251d9[_0x8fd2('0x10')],'lastName':_[_0x8fd2('0x44')](_0x2251d9[_0x8fd2('0x47')])||_['isNil'](_0x2251d9['lastName'])?null:_0x2251d9[_0x8fd2('0x47')],'phone':_0x2251d9[_0x8fd2('0x48')],'ListId':_0x2251d9['list_id'],'scheduledat':_0x2251d9[_0x8fd2('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0x8fd2('0x4a'),'description':_0x8fd2('0x4b')+_0x2251d9[_0x8fd2('0x49')][_0x8fd2('0x4c')](),'priority':_0x2251d9[_0x8fd2('0x4d')]})[_0x8fd2('0x16')](function(_0x52c912){_0x1ec30e(null,_0x52c912);})[_0x8fd2('0x11')](function(_0x1a2ffc){_0x1ec30e(_0x1a2ffc);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x4e')]=function(_0x24260f,_0x51b586){this['rpc']['getPauseById'](_0x24260f)['then'](function(_0x57b8f6){_0x51b586(null,_0x57b8f6?_0x57b8f6[_0x8fd2('0x10')]:![]);})[_0x8fd2('0x11')](function(_0x18ee30){_0x51b586(_0x18ee30);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x4f')]=function(_0x25abdc,_0x460f31,_0x4a81ab){var _0x5e5f79={'role':'agent'};_0x5e5f79[_0x25abdc]=this[_0x8fd2('0xc')][_0x8fd2('0x3a')];this['rpc']['agentPause'](_0x5e5f79,_0x460f31,this[_0x8fd2('0xc')][_0x8fd2('0x37')])[_0x8fd2('0x16')](function(_0x30a952){_0x4a81ab(null,_[_0x8fd2('0x50')](_0x30a952)?![]:!![]);})['catch'](function(_0x2196d3){logger[_0x8fd2('0x2d')](_0x2196d3);_0x4a81ab(null,![]);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x51')]=function(_0x5446e0,_0x9c5a26){var _0x3bd8ce={'role':_0x8fd2('0x52')};_0x3bd8ce[_0x5446e0]=this[_0x8fd2('0xc')]['callerid'];this['rpc']['agentUnpause'](_0x3bd8ce)[_0x8fd2('0x16')](function(_0x19e68d){_0x9c5a26(null,_[_0x8fd2('0x50')](_0x19e68d)?![]:!![]);})[_0x8fd2('0x11')](function(_0x116a1d){logger['error'](_0x116a1d);_0x9c5a26(null,![]);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x53')]=function(_0x538236,_0x25123f){var _0x164991={'role':_0x8fd2('0x52')};_0x164991[_0x538236]=this[_0x8fd2('0xc')][_0x8fd2('0x3a')];this['rpc'][_0x8fd2('0x53')](_0x164991)[_0x8fd2('0x16')](function(_0x21f1a7){_0x25123f(null,_[_0x8fd2('0x50')](_0x21f1a7)?![]:!![]);})[_0x8fd2('0x11')](function(_0x268724){logger[_0x8fd2('0x2d')](_0x268724);_0x25123f(null,![]);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x54')]=function(_0x4680f0,_0xf7c83a){var _0x4d0402={'role':_0x8fd2('0x52')};_0x4d0402[_0x4680f0]=this['channel'][_0x8fd2('0x3a')];var _0x237756=_0x4680f0!='internal'?util['format']('%s/%s@from-sip/n',_0x8fd2('0x55'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')]):undefined;this[_0x8fd2('0x14')][_0x8fd2('0x54')](_0x4d0402,_0x237756)[_0x8fd2('0x16')](function(_0x52a332){_0xf7c83a(null,_[_0x8fd2('0x50')](_0x52a332)?![]:!![]);})[_0x8fd2('0x11')](function(_0x510553){logger[_0x8fd2('0x2d')](_0x510553);_0xf7c83a(null,![]);});};AGIVertices['prototype'][_0x8fd2('0x56')]=function(_0x25d69d,_0x9eccb3){sh[_0x8fd2('0x57')](_[_0x8fd2('0x58')](_0x25d69d),function(_0x4aaa16,_0x1a1b40){var _0xfb0041=_0x1a1b40['replace'](/(\r\n|\n|\r)/gm,'');_0x9eccb3(null,_0xfb0041);});};AGIVertices[_0x8fd2('0x12')]['googleCloudTTS']=function(_0x50c6a6,_0x433912){scripts[_0x8fd2('0x59')](_0x50c6a6['apiKey'],_0x50c6a6[_0x8fd2('0x5a')]||_0x8fd2('0x5b'),_0x50c6a6[_0x8fd2('0x5b')],_0x50c6a6['languageCode']||_0x8fd2('0x5c'),_0x50c6a6[_0x8fd2('0x5d')]||_0x8fd2('0x5e'),_0x50c6a6[_0x8fd2('0x5f')]||_0x8fd2('0x60'))[_0x8fd2('0x16')](function(_0x33603c){_0x433912(null,_0x33603c);})['catch'](function(_0x55f13b){_0x433912(_0x55f13b);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x61')]=function(_0x549af8,_0x500678){scripts['googleTTS'](_0x549af8['text'],_0x549af8['google_tts_language']||'en',0x1)[_0x8fd2('0x16')](function(_0x3b2d1a){_0x500678(null,_0x3b2d1a);})[_0x8fd2('0x11')](function(_0x37ad5c){_0x500678(_0x37ad5c);});};AGIVertices[_0x8fd2('0x12')]['restAPI']=function(_0x2fba70,_0x181634){var _0x3b94f9={'uri':_0x2fba70['url'],'method':_0x2fba70[_0x8fd2('0x62')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2fba70[_0x8fd2('0x63')])==='number'&&parseInt(_0x2fba70[_0x8fd2('0x63')])>=0x1?parseInt(_0x2fba70[_0x8fd2('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x8fd2('0x64')]([_0x8fd2('0x65'),_0x8fd2('0x66')],_0x3b94f9[_0x8fd2('0x62')][_0x8fd2('0x67')]())){try{_0x3b94f9['body']=_0x2fba70[_0x8fd2('0xa')]?JSON[_0x8fd2('0x68')](_0x2fba70[_0x8fd2('0xa')]):{};}catch(_0x1a924f){logger[_0x8fd2('0x2d')](_0x8fd2('0x69'),_0x1a924f);}}try{_0x3b94f9[_0x8fd2('0x6a')]=_0x2fba70['rawHeaders']?JSON[_0x8fd2('0x68')](_0x2fba70[_0x8fd2('0x9')]):{};}catch(_0x5dba4a){logger[_0x8fd2('0x2d')](_0x8fd2('0x6b'),_0x5dba4a);}if(_0x2fba70[_0x8fd2('0x6c')]){try{var _0x131ee8=require(_0x2fba70[_0x8fd2('0x6c')])[_0x8fd2('0x6d')](this,_0x3b94f9);_0x3b94f9[_0x8fd2('0x6e')]=Mustache[_0x8fd2('0x6f')](_0x2fba70['url'],_0x131ee8,{},['$$','$$']);if(_0x3b94f9[_0x8fd2('0x6a')]){_0x3b94f9['headers']=JSON['parse'](Mustache['render'](JSON[_0x8fd2('0x70')](_0x3b94f9['headers']),_0x131ee8,{},['$$','$$']));}if(_0x3b94f9[_0x8fd2('0x71')]){_0x3b94f9['body']=JSON['parse'](Mustache[_0x8fd2('0x6f')](JSON[_0x8fd2('0x70')](_0x3b94f9['body']),_0x131ee8,{},['$$','$$']));}}catch(_0x40fc80){logger[_0x8fd2('0x2d')](_0x8fd2('0x72'),_0x40fc80);}}rp(_0x3b94f9)[_0x8fd2('0x16')](function(_0x570b06){var _0x4ff263={'statusCode':_0x570b06[_0x8fd2('0x73')]||0xc8,'statusMessage':_0x570b06['statusMessage']||'OK','headers':_0x570b06[_0x8fd2('0x6a')]||{},'body':_0x570b06[_0x8fd2('0x71')]||{}};_0x181634(null,_0x4ff263);})['catch'](function(_0x1a96f7){var _0xc60005={'statusCode':_0x1a96f7[_0x8fd2('0x73')]||0x1f4,'statusMessage':_0x1a96f7[_0x8fd2('0x74')]||_0x8fd2('0x75'),'headers':_0x1a96f7[_0x8fd2('0x76')][_0x8fd2('0x6a')]||{},'body':_0x1a96f7['options'][_0x8fd2('0x71')]||{}};_0x181634(null,_0xc60005);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x77')]=function(_0x192f30,_0x47ac94){scripts[_0x8fd2('0x77')](this[_0x8fd2('0xc')][_0x8fd2('0x37')],_0x192f30[_0x8fd2('0x78')],_0x192f30['text'],_0x192f30['dialogflow_language']||'en')[_0x8fd2('0x16')](function(_0x5d3a54){_0x47ac94(null,_0x5d3a54);})['catch'](function(_0x2167ce){_0x47ac94(_0x2167ce);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x2710a5,_0x1f2770){scripts[_0x8fd2('0x79')](this[_0x8fd2('0xc')][_0x8fd2('0x37')],_0x2710a5[_0x8fd2('0x7a')],_0x2710a5[_0x8fd2('0x7b')],_0x2710a5['private_key'],_0x2710a5[_0x8fd2('0x5b')],_0x2710a5[_0x8fd2('0x7c')]||'en')[_0x8fd2('0x16')](function(_0x42f29e){_0x1f2770(null,_0x42f29e);})['catch'](function(_0x2a62b0){_0x1f2770(_0x2a62b0);});};AGIVertices['prototype']['sestekNDA']=function(_0x1a45d8,_0x23932a){scripts[_0x8fd2('0x7d')](this[_0x8fd2('0xc')],_0x1a45d8)[_0x8fd2('0x16')](function(_0xe90905){_0x23932a(null,_0xe90905);})[_0x8fd2('0x11')](function(_0x3e0d5f){_0x23932a(_0x3e0d5f);});};AGIVertices['prototype']['ispeechTTS']=function(_0x3a851e,_0xa32605){scripts[_0x8fd2('0x7e')](_0x3a851e[_0x8fd2('0x78')],_0x3a851e['text'],_0x3a851e[_0x8fd2('0x7f')]||_0x8fd2('0x5c'),_0x3a851e['speed'])[_0x8fd2('0x16')](function(_0x31128d){_0xa32605(null,_0x31128d);})['catch'](function(_0x191333){_0xa32605(_0x191333);});};AGIVertices[_0x8fd2('0x12')]['ispeechASR']=function(_0xb0d4a6,_0x26ffac,_0x2d2e4f){scripts[_0x8fd2('0x80')](_0x26ffac,_0xb0d4a6[_0x8fd2('0x78')],_0xb0d4a6[_0x8fd2('0x81')]||'en-US',this[_0x8fd2('0x82')](_0xb0d4a6[_0x8fd2('0x83')])?_0xb0d4a6[_0x8fd2('0x83')]:undefined)[_0x8fd2('0x16')](function(_0x36c809){_0x2d2e4f(null,_0x36c809);})[_0x8fd2('0x11')](function(_0x411a45){_0x2d2e4f(_0x411a45);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x84')]=function(_0x4640ba,_0x226b9d){scripts['awsPolly'](_0x4640ba['aws_access_key_id'],_0x4640ba[_0x8fd2('0x85')],_0x4640ba['aws_polly_region'],_0x4640ba[_0x8fd2('0x86')]||'Amy',_0x4640ba[_0x8fd2('0x5b')],_0x4640ba['aws_text_type']||'text')[_0x8fd2('0x16')](function(_0x3fbe9a){_0x226b9d(null,_0x3fbe9a);})[_0x8fd2('0x11')](function(_0x142937){_0x226b9d(_0x142937);});};AGIVertices['prototype']['awsLex']=function(_0x4c95b2,_0x3c89cf){scripts[_0x8fd2('0x87')](this[_0x8fd2('0xc')]['uniqueid'],_0x4c95b2[_0x8fd2('0x88')],_0x4c95b2[_0x8fd2('0x85')],_0x4c95b2['aws_lex_region'],_0x4c95b2['text'],_0x4c95b2[_0x8fd2('0x89')])['then'](function(_0x48eb26){_0x3c89cf(null,_0x48eb26);})[_0x8fd2('0x11')](function(_0x2ca20d){_0x3c89cf(_0x2ca20d);});};AGIVertices['prototype']['googleASR']=function(_0x39be64,_0x232b1d,_0x5f4bbf){scripts[_0x8fd2('0x8a')](_0x232b1d,_0x39be64[_0x8fd2('0x78')],_0x39be64[_0x8fd2('0x8b')]||_0x8fd2('0x5c'))[_0x8fd2('0x16')](function(_0x16846b){_0x5f4bbf(null,_0x16846b);})['catch'](function(_0x371f08){_0x5f4bbf(_0x371f08);});};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x8c')]=function(_0x17279f,_0x42bb94,_0x1c7dd9){scripts['tildeASR'](_0x42bb94,_0x17279f['appid'],_0x17279f[_0x8fd2('0x8d')],_0x17279f[_0x8fd2('0x6e')])[_0x8fd2('0x16')](function(_0x214be5){_0x1c7dd9(null,_0x214be5);})[_0x8fd2('0x11')](function(_0x4ec574){_0x1c7dd9(_0x4ec574);});};AGIVertices['prototype'][_0x8fd2('0x8e')]=function(_0x444ad3){var _0x241dd1=_['includes'](verticesWithRetry,_0x444ad3['agicommand'])?_0x444ad3:_[_0x8fd2('0x8f')](_0x444ad3);for(var _0x4df822 in _0x241dd1){if(_0x241dd1[_0x8fd2('0x90')](_0x4df822)){if(_0x241dd1[_0x4df822]&&_[_0x8fd2('0x91')](_0x241dd1[_0x4df822])){if(_['includes'](recursiveMapAttributes,_0x4df822)){_0x241dd1[_0x4df822]=this['replaceObjectAllVariables'](_0x241dd1[_0x4df822]);}else{_0x241dd1[_0x4df822]=this[_0x8fd2('0x92')](_0x241dd1[_0x4df822]);}}}}return _0x241dd1;};AGIVertices['prototype'][_0x8fd2('0x93')]=function(_0x479a35){for(var _0x1dc0bb in _0x479a35){if(_0x479a35[_0x8fd2('0x90')](_0x1dc0bb)){if(_['isPlainObject'](_0x479a35[_0x1dc0bb])){this['recursiveNodeIndex'](_0x479a35[_0x1dc0bb]);}else if(_['isArray'](_0x479a35[_0x1dc0bb])){for(var _0x3f3ddf=0x0;_0x3f3ddf<_0x479a35[_0x1dc0bb][_0x8fd2('0x94')];_0x3f3ddf++){this[_0x8fd2('0x93')](_0x479a35[_0x1dc0bb][_0x3f3ddf]);}}else if(_[_0x8fd2('0x91')](_0x479a35[_0x1dc0bb])){_0x479a35[_0x1dc0bb]=this[_0x8fd2('0x92')](_0x479a35[_0x1dc0bb]);}}}};AGIVertices[_0x8fd2('0x12')]['saveRestApiResult']=function(_0xe676a0,_0x445c80){for(var _0x512e07 in _0xe676a0){if(_0xe676a0[_0x8fd2('0x90')](_0x512e07)){if(_[_0x8fd2('0x95')](_0xe676a0[_0x512e07])){if(!_[_0x8fd2('0x44')](_0xe676a0[_0x512e07])){this['saveRestApiResult'](_0xe676a0[_0x512e07],util[_0x8fd2('0x29')]('%s.%s',_0x445c80,_0x512e07));}}else if(_[_0x8fd2('0x96')](_0xe676a0[_0x512e07])){for(var _0x4bff03=0x0;_0x4bff03<_0xe676a0[_0x512e07][_0x8fd2('0x94')];_0x4bff03++){this[_0x8fd2('0x97')](_0xe676a0[_0x512e07][_0x4bff03],util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x445c80,_0x512e07+'['+_0x4bff03+']'));}}else{if(!_[_0x8fd2('0x50')](_0xe676a0[_0x512e07])){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x445c80,_0x512e07),_0xe676a0[_0x512e07]);}}}}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x99')]=function(_0x496091){try{var _0x116e85=JSON[_0x8fd2('0x68')](_0x496091);this[_0x8fd2('0x93')](_0x116e85);return JSON[_0x8fd2('0x70')](_0x116e85);}catch(_0x2053a2){return this[_0x8fd2('0x92')](_0x496091);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x1a7d31){var _0x27ae56=_0x1a7d31[_0x8fd2('0x9a')]('{');for(var _0x25ef96=0x1;_0x25ef96<_0x27ae56[_0x8fd2('0x94')];_0x25ef96+=0x1){var _0x21ec91=_0x27ae56[_0x25ef96][_0x8fd2('0x9a')]('}');if(_0x21ec91['length']>0x1){_0x1a7d31=_0x1a7d31[_0x8fd2('0x9b')]('{'+_0x21ec91[0x0]+'}',this[_0x8fd2('0xc')][_0x8fd2('0xe')](_0x21ec91[0x0])['extra']||_0x21ec91[0x0]);}}if(_0x27ae56['length']===0x1){return _0x1a7d31[_0x8fd2('0x4c')]();}return this[_0x8fd2('0x92')](_0x1a7d31);};AGIVertices[_0x8fd2('0x12')]['getAndSetVariable']=function(_0x34daa0,_0x555944){var _0x423d02=this[_0x8fd2('0xc')]['getVariable'](_0x34daa0);if(_0x423d02[_0x8fd2('0x9c')]===-0x1){return _0x423d02;}logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x9d'),_0x555944,_0x423d02['extra']));return this['channel']['setVariable'](_0x555944,_0x423d02[_0x8fd2('0x9e')]);};AGIVertices['prototype'][_0x8fd2('0x82')]=function(_0x3c8ec8){return _0x3c8ec8&&_0x3c8ec8!=='0'&&_0x3c8ec8!=='-1'&&_0x3c8ec8!=='';};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x9f')]=function(_0x12d53f){this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x12d53f,'-');_0x12d53f[_0x8fd2('0xa0')]=_0x12d53f[_0x8fd2('0x9f')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xa1')]=function(_0xa8cc27){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xa2'),_0xa8cc27['label']));if(!this[_0x8fd2('0x82')](_0xa8cc27[_0x8fd2('0x5b')])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}var _0x1dee46='\x22'+_0xa8cc27[_0x8fd2('0x5b')]+'\x22';if(this[_0x8fd2('0x82')](_0xa8cc27['options'])){_0x1dee46+=','+_0xa8cc27[_0x8fd2('0x76')];}var _0x4246c9=this[_0x8fd2('0xc')][_0x8fd2('0x57')]('MRCPSynth',_0x1dee46);if(_0x4246c9[_0x8fd2('0x9c')]===-0x1){return _0x4246c9;}return this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0xa5'),_0x1dee46));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xa6')]=function(_0x38ae2a){logger['info'](util['format'](_0x8fd2('0xa7'),_0x38ae2a[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x38ae2a['grammar'])){return this['channel'][_0x8fd2('0xa3')]('no\x20grammar\x20configured');}var _0x4bca9c=_0x38ae2a['grammar'];if(this[_0x8fd2('0x82')](_0x38ae2a[_0x8fd2('0x76')])){_0x4bca9c+=','+_0x38ae2a['options'];}var _0x25049c=this[_0x8fd2('0xc')][_0x8fd2('0x57')](_0x8fd2('0xa8'),_0x4bca9c);if(_0x25049c[_0x8fd2('0x9c')]===-0x1){return _0x25049c;}var _0x3480e1=this[_0x8fd2('0xa9')](_0x8fd2('0xaa'),_0x8fd2('0xab'));if(_0x3480e1[_0x8fd2('0x9c')]===-0x1){return _0x3480e1;}var _0x28970d=this[_0x8fd2('0xa9')](_0x8fd2('0xac'),_0x8fd2('0xad'));if(_0x28970d['result']===-0x1){return _0x28970d;}var _0x484d2b=this[_0x8fd2('0xa9')](_0x8fd2('0xae'),_0x8fd2('0xaf'));if(_0x484d2b['result']===-0x1){return _0x484d2b;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xb0'),_0x4bca9c));};AGIVertices['prototype']['agi']=function(_0x17fa53){logger[_0x8fd2('0x2e')](util['format']('Enter\x20in\x20AGI\x20(%s)\x20block',_0x17fa53[_0x8fd2('0x38')]));return this['channel'][_0x8fd2('0xb1')]([_0x17fa53['command'],_0x17fa53[_0x8fd2('0xb2')]]);};AGIVertices['prototype'][_0x8fd2('0xb3')]=function(_0x50b70e){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x50b70e[_0x8fd2('0x38')]));if(this[_0x8fd2('0x82')](_0x50b70e['timeout'])){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0xb4'),_0x50b70e[_0x8fd2('0x63')]));var _0x1b102f=this[_0x8fd2('0xc')][_0x8fd2('0xb5')](_0x50b70e[_0x8fd2('0x63')]);if(_0x1b102f['result']===-0x1){return _0x1b102f;}}return this[_0x8fd2('0xc')][_0x8fd2('0xb3')]();};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x4a')]=function(_0x1eda84){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xb6'),_0x1eda84[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x1eda84['list_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x1eda84,_0x8fd2('0xb7'));}_0x1eda84['scheduledAt']=moment();if(this[_0x8fd2('0x82')](_0x1eda84['delay'])){_0x1eda84[_0x8fd2('0x49')]=moment()[_0x8fd2('0xb8')](_0x1eda84[_0x8fd2('0xb9')],_0x8fd2('0xba'));}if(!this[_0x8fd2('0x82')](_0x1eda84[_0x8fd2('0x4d')])){_0x1eda84[_0x8fd2('0x4d')]=0x2;}this['createCmContact'][_0x8fd2('0x6d')](this,_0x1eda84);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xbb'),_0x1eda84[_0x8fd2('0x48')],_0x1eda84[_0x8fd2('0xbc')],_0x1eda84[_0x8fd2('0x49')]));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xbd')]=function(_0x5d3434){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x5d3434['label']));var _0xb18a98=this[_0x8fd2('0xc')][_0x8fd2('0x57')](_0x5d3434[_0x8fd2('0xbe')],_0x5d3434[_0x8fd2('0x76')]);if(_0xb18a98[_0x8fd2('0x9c')]===-0x1){return _0xb18a98;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('Executed\x20command\x20%s\x20%s',_0x5d3434['application'],_0x5d3434[_0x8fd2('0x76')]));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xbf')]=function(_0x6e4d7){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0xc0'),_0x6e4d7[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x6e4d7[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}var _0x7224a6='\x22'+_0x6e4d7[_0x8fd2('0x5b')]+'\x22';if(this['isConfigured'](_0x6e4d7[_0x8fd2('0x76')])){_0x7224a6+=','+_0x6e4d7['options'];}var _0x9fce77=this['channel'][_0x8fd2('0x57')]('MRCPSynth',_0x7224a6);if(_0x9fce77[_0x8fd2('0x9c')]===-0x1){return _0x9fce77;}return this['channel'][_0x8fd2('0xa3')](util['format'](_0x8fd2('0xa5'),_0x7224a6));};AGIVertices[_0x8fd2('0x12')]['sestektts']=function(_0x18e3d9){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xc1'),_0x18e3d9[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x18e3d9[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('no\x20text\x20configured');}var _0x34be96='\x22'+_0x18e3d9[_0x8fd2('0x5b')]+'\x22';if(this[_0x8fd2('0x82')](_0x18e3d9['options'])){_0x34be96+=','+_0x18e3d9[_0x8fd2('0x76')];}var _0x52c3ca=this[_0x8fd2('0xc')]['exec'](_0x8fd2('0xc2'),_0x34be96);if(_0x52c3ca[_0x8fd2('0x9c')]===-0x1){return _0x52c3ca;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xa5'),_0x34be96));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xc3')]=function(_0x1f2f56){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0xc4'),_0x1f2f56['label']));if(!this[_0x8fd2('0x82')](_0x1f2f56[_0x8fd2('0xc5')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x1717d3=_0x1f2f56[_0x8fd2('0xc5')];if(this[_0x8fd2('0x82')](_0x1f2f56[_0x8fd2('0x76')])){_0x1717d3+=','+_0x1f2f56[_0x8fd2('0x76')];}var _0x181544=this['channel'][_0x8fd2('0x57')](_0x8fd2('0xa8'),_0x1717d3);if(_0x181544[_0x8fd2('0x9c')]===-0x1){return _0x181544;}var _0x3feffb=this['getAndSetVariable'](_0x8fd2('0xaa'),_0x8fd2('0xc6'));if(_0x3feffb['result']===-0x1){return _0x3feffb;}var _0x35c044=this[_0x8fd2('0xa9')](_0x8fd2('0xac'),_0x8fd2('0xc7'));if(_0x35c044[_0x8fd2('0x9c')]===-0x1){return _0x35c044;}var _0x245472=this[_0x8fd2('0xa9')](_0x8fd2('0xae'),_0x8fd2('0xc8'));if(_0x245472[_0x8fd2('0x9c')]===-0x1){return _0x245472;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1717d3));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xc9')]=function(_0x2bc578){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0xca'),_0x2bc578[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x2bc578[_0x8fd2('0xc5')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xcb'));}var _0x3c0947=_0x2bc578[_0x8fd2('0xc5')];if(this[_0x8fd2('0x82')](_0x2bc578[_0x8fd2('0x76')])){_0x3c0947+=','+_0x2bc578[_0x8fd2('0x76')];}var _0x395e93=this[_0x8fd2('0xc')][_0x8fd2('0x57')]('MRCPRecog',_0x3c0947);if(_0x395e93[_0x8fd2('0x9c')]===-0x1){return _0x395e93;}var _0x49ecbb=this[_0x8fd2('0xa9')](_0x8fd2('0xaa'),_0x8fd2('0xcc'));if(_0x49ecbb[_0x8fd2('0x9c')]===-0x1){return _0x49ecbb;}var _0xec467=this['getAndSetVariable'](_0x8fd2('0xac'),_0x8fd2('0xcd'));if(_0xec467['result']===-0x1){return _0xec467;}var _0xb90437=this[_0x8fd2('0xa9')](_0x8fd2('0xae'),_0x8fd2('0xce'));if(_0xb90437['result']===-0x1){return _0xb90437;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xb0'),_0x3c0947));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xcf')]=function(_0x54d96b){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0xd0'),_0x54d96b[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x54d96b['odbc_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x54d96b,_0x8fd2('0xd1'));}var _0x5ee794=this[_0x8fd2('0x19')][_0x8fd2('0x6d')](this,_0x54d96b[_0x8fd2('0xd2')]);if(!_0x5ee794){return this[_0x8fd2('0xc')]['error'](_0x54d96b,_0x8fd2('0xd3'));}if(!this[_0x8fd2('0x82')](_0x54d96b[_0x8fd2('0xd4')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x54d96b,_0x8fd2('0xd5'));}var _0x35117e=_0x54d96b[_0x8fd2('0xd4')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('query:\x20%s',_0x35117e));var _0x49afed=this[_0x8fd2('0x2b')][_0x8fd2('0x6d')](this,_0x5ee794,_0x35117e);this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x54d96b,_0x35117e);if(!this['isConfigured'](_0x54d96b['variable_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xd6'));}var _0x378206=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x54d96b['variable_id']);if(!_0x378206){return this[_0x8fd2('0xc')]['error'](_0x54d96b,'no\x20variable\x20found');}var _0x583692=this;_0x49afed[_0x8fd2('0xd7')](function(_0x471afc,_0x5ca097){Object[_0x8fd2('0xd8')](_0x471afc)[_0x8fd2('0xd7')](function(_0x35413b){_0x583692['channel'][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0xda'),_0x378206,_0x5ca097,_0x35413b),_0x471afc[_0x35413b]);});});this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0xdb'),_0x378206),_0x49afed[_0x8fd2('0x94')]);return this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('variable\x20%s\x20set',_0x378206));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xdc')]=function(_0xe1cd1d){logger[_0x8fd2('0xdd')](util[_0x8fd2('0x29')]('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xe1cd1d['label']));if(!this[_0x8fd2('0x82')](_0xe1cd1d[_0x8fd2('0xde')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0xe1cd1d,'no\x20user\x20selected');}var _0x267489=this[_0x8fd2('0xdf')][_0x8fd2('0x6d')](this,_0xe1cd1d[_0x8fd2('0xde')]);if(!_0x267489){return this['channel'][_0x8fd2('0x2d')](_0xe1cd1d,'no\x20user\x20found');}var _0x14a41a=this[_0x8fd2('0xc')][_0x8fd2('0x57')](_0x8fd2('0xe0'),[util['format']('SIP/%s',_0x267489),_0xe1cd1d['timeout'],_0xe1cd1d['opts'],_0xe1cd1d['url']]);if(_0x14a41a[_0x8fd2('0x9c')]===-0x1){return _0x14a41a;}return this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xe1'),_0x8fd2('0xe0')));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xe2')]=function(_0x105022){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0xe3'),_0x105022[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x105022[_0x8fd2('0x78')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xe4'));}if(!this[_0x8fd2('0x82')](_0x105022[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xe5')]=!![];this[_0x8fd2('0x36')](_0x105022);this['createSquareMessage'](_0x105022[_0x8fd2('0x5b')],'in','','');this['channel']['noop'](util[_0x8fd2('0x29')](_0x8fd2('0xe6'),_0x105022['text']));var _0x375ca6=this['googleDialogflow'][_0x8fd2('0x6d')](this,_0x105022);if(_0x375ca6){for(var _0x568e1a in _0x375ca6){if(_0x375ca6[_0x8fd2('0x90')](_0x568e1a)){this['channel'][_0x8fd2('0xd9')](util['format'](_0x8fd2('0xe7'),_0x568e1a[_0x8fd2('0x67')]()),_0x375ca6[_0x568e1a]);}}this[_0x8fd2('0x42')](_0x375ca6['speech'],_0x8fd2('0xe8'),_0x8fd2('0xe2'),'');return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0xe9'),_0x375ca6[_0x8fd2('0xea')]));}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x105022,_0x8fd2('0xeb'));};AGIVertices[_0x8fd2('0x12')]['dialogflowV2']=function(_0x2cbadb){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x2cbadb[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x2cbadb[_0x8fd2('0x7a')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xec'));}if(!this[_0x8fd2('0x82')](_0x2cbadb['client_email'])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xed'));}if(!this[_0x8fd2('0x82')](_0x2cbadb['private_key'])){return this['channel']['noop'](_0x8fd2('0xee'));}if(!this[_0x8fd2('0x82')](_0x2cbadb[_0x8fd2('0x7c')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xef'));}if(!this['isConfigured'](_0x2cbadb[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xe5')]=!![];this['createSquareDetailsReport'](_0x2cbadb);this['createSquareMessage'](_0x2cbadb['text'],'in','','');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('Trying\x20DialogflowV2:\x20%s',_0x2cbadb['text']));var _0x3266ae=this[_0x8fd2('0x79')][_0x8fd2('0x6d')](this,_0x2cbadb);if(_0x3266ae){for(var _0x1d7c3c in _0x3266ae){if(_0x3266ae[_0x8fd2('0x90')](_0x1d7c3c)){if(_0x1d7c3c!==_0x8fd2('0xf0')){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')](_0x8fd2('0xe7'),_0x1d7c3c[_0x8fd2('0x67')]()),_0x3266ae[_0x1d7c3c]);}}}this['createSquareMessage'](_0x3266ae[_0x8fd2('0xea')],'out','dialogflowV2',_0x3266ae[_0x8fd2('0xf0')]);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xf1'),_0x3266ae[_0x8fd2('0xea')]));}return this['channel'][_0x8fd2('0x2d')](_0x2cbadb,'DialogflowV2\x20is\x20unreachable');};AGIVertices['prototype'][_0x8fd2('0xf2')]=function(_0x314293){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0xf3'),_0x314293[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x314293['ndauth_url'])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xf4'));}if(!this[_0x8fd2('0x82')](_0x314293[_0x8fd2('0xf5')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xf6'));}if(!this[_0x8fd2('0x82')](_0x314293[_0x8fd2('0xf7')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xf8'));}if(!this[_0x8fd2('0x82')](_0x314293[_0x8fd2('0xf9')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('no\x20text\x20configured');}this['channel'][_0x8fd2('0xe5')]=!![];this['createSquareDetailsReport'](_0x314293);this['createSquareMessage'](_0x314293['text'],'in','','');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0xfa'),_0x314293[_0x8fd2('0x5b')]));var _0x58b2ad=this['sestekNDA']['sync'](this,_0x314293);if(_0x58b2ad){for(var _0x34a0a9 in _0x58b2ad){if(_0x58b2ad[_0x8fd2('0x90')](_0x34a0a9)){this['channel'][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0xfb'),_0x34a0a9[_0x8fd2('0x67')]()),_0x58b2ad[_0x34a0a9]);}}this[_0x8fd2('0x42')](_0x58b2ad[_0x8fd2('0xea')],_0x8fd2('0xe8'),_0x8fd2('0xf2'),'');if(_0x58b2ad['audiofile']){this['channel']['noop'](util['format']('Sestek\x20NDA\x20%s\x20file\x20created',_0x58b2ad[_0x8fd2('0xfc')]));var _0x3e0cf5=this['channel'][_0x8fd2('0xfd')](_0x58b2ad['audiofile']);try{fs['unlink'](_0x58b2ad[_0x8fd2('0xfc')]+_0x8fd2('0xfe'));}catch(_0x6f5edc){logger['error'](_0x6f5edc);}return _0x3e0cf5;}else{return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('SestekNDA\x20Result\x20%s',_0x58b2ad[_0x8fd2('0xea')]));}}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x314293,_0x8fd2('0xff'));};AGIVertices['prototype'][_0x8fd2('0x100')]=function(_0x2576b6){logger['info'](util['format'](_0x8fd2('0x101'),_0x2576b6[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x100'));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x102')]=function(_0x381595){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x103'),_0x381595['label']));var _0x5bbb9c='';if(_0x381595[_0x8fd2('0x104')]){if(!this['isConfigured'](_0x381595['trunk_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x381595,'no\x20trunk\x20selected');}else{var _0x4b5d57=parseInt(_0x381595[_0x8fd2('0x104')],0xa);if(isNaN(_0x4b5d57)){_0x5bbb9c=_0x381595[_0x8fd2('0x104')];}else{_0x5bbb9c=this['getTrunk'][_0x8fd2('0x6d')](this,_0x381595[_0x8fd2('0x104')]);if(!_0x5bbb9c){return this[_0x8fd2('0xc')]['error'](_0x381595,_0x8fd2('0x105'));}}}}else if(_0x381595[_0x8fd2('0x106')]){_0x5bbb9c=_0x381595['trunk_name'];}else{return this['channel'][_0x8fd2('0x2d')](_0x381595,_0x8fd2('0x107'));}var _0x1c7189=this['channel'][_0x8fd2('0x57')](_0x8fd2('0xe0'),[util[_0x8fd2('0x29')]('SIP/%s/%s',_0x5bbb9c,_0x381595[_0x8fd2('0x48')]),_0x381595[_0x8fd2('0x63')],_0x381595[_0x8fd2('0x108')],_0x381595[_0x8fd2('0x109')]]);if(_0x1c7189[_0x8fd2('0x9c')]===-0x1){return _0x1c7189;}return this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0xe1'),_0x8fd2('0xe0')));};AGIVertices['prototype'][_0x8fd2('0x10a')]=function(_0x5118be){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x10b'),_0x5118be[_0x8fd2('0x38')]));return this['channel'][_0x8fd2('0xa3')]('finally');};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x10c')]=function(_0x27d20f){logger['info'](util['format'](_0x8fd2('0x10d'),_0x27d20f[_0x8fd2('0x38')]));if(_0x27d20f[_0x8fd2('0xa0')]===0x0){return this[_0x8fd2('0x9f')](_0x27d20f);}_0x27d20f[_0x8fd2('0xa0')]-=0x1;if(!this['isConfigured'](_0x27d20f['file_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x27d20f,_0x8fd2('0x10e'));}var _0x3c9a5c=this[_0x8fd2('0x1e')][_0x8fd2('0x6d')](this,_0x27d20f[_0x8fd2('0x10f')]);if(!_0x3c9a5c){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x27d20f,'no\x20file\x20audio\x20found');}if(!this[_0x8fd2('0x82')](_0x27d20f[_0x8fd2('0x110')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x8fd2('0xd6'));}var _0x22c8bb=this['channel'][_0x8fd2('0x111')](_0x3c9a5c,_0x27d20f[_0x8fd2('0x112')],_0x27d20f['maxdigit']);var _0x187046=_0x22c8bb[_0x8fd2('0x9c')]?_0x22c8bb[_0x8fd2('0x9c')][_0x8fd2('0x4c')]():'';logger[_0x8fd2('0x2e')](_0x8fd2('0x113'),JSON['stringify'](_0x22c8bb));if(_0x22c8bb[_0x8fd2('0x9c')]===-0x1){this[_0x8fd2('0x36')]['sync'](this,_0x27d20f,_0x187046);return _0x22c8bb;}else if(_0x22c8bb[_0x8fd2('0x9e')]==='timeout'){_0x22c8bb[_0x8fd2('0x9c')]=_0x187046[_0x8fd2('0x94')]>=parseInt(_0x27d20f['mindigit'])?'x':'i';}else{_0x22c8bb[_0x8fd2('0x9c')]=_0x187046[_0x8fd2('0x94')]>=parseInt(_0x27d20f[_0x8fd2('0x114')])&&_0x187046[_0x8fd2('0x94')]<=parseInt(_0x27d20f[_0x8fd2('0x115')])?'x':'i';}var _0x2a0f64=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x27d20f[_0x8fd2('0x110')]);if(!_0x2a0f64){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x27d20f,_0x8fd2('0x116'));}this['channel'][_0x8fd2('0xd9')](_0x2a0f64,_0x187046);if(this[_0x8fd2('0x82')](_0x27d20f[_0x8fd2('0x117')])){var _0x14edbd=parseInt(_0x27d20f['hiddendigitsnum'],0xa);var _0x45f33b=rs[_0x8fd2('0x118')]({'charset':'*','length':_0x14edbd});var _0x4f7b73=_0x187046[_0x8fd2('0x94')];if(_0x4f7b73>0x0){if(_0x4f7b73>_0x14edbd){this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x27d20f,_0x27d20f[_0x8fd2('0x119')]===_0x8fd2('0x11a')?_0x45f33b+_0x187046['substr'](_0x14edbd):_0x187046['substr'](0x0,_0x4f7b73-_0x14edbd)+_0x45f33b);}else{this['createSquareDetailsReport'][_0x8fd2('0x6d')](this,_0x27d20f,rs[_0x8fd2('0x118')]({'charset':'*','length':_0x4f7b73}));}}else{this['createSquareDetailsReport']['sync'](this,_0x27d20f,'');}}else{this['createSquareDetailsReport'][_0x8fd2('0x6d')](this,_0x27d20f,_0x187046);}return _0x22c8bb;};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xb')]=function(_0x40f452){logger['info'](util[_0x8fd2('0x29')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x40f452[_0x8fd2('0x38')]));return this[_0x8fd2('0x10c')](_0x40f452);};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x11b')]=function(_0x5d33b1){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x11c'),_0x5d33b1['label']));this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x5d33b1,_0x5d33b1[_0x8fd2('0x11d')]);return this['channel']['noop'](util[_0x8fd2('0x29')]('GOAL\x20%s',_0x5d33b1[_0x8fd2('0x11d')]));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x11e')]=function(_0x2c9454){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x11f'),_0x2c9454[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x2c9454['aws_access_key_id'])||!this[_0x8fd2('0x82')](_0x2c9454['aws_secret_access_key'])){return this['channel']['noop'](_0x8fd2('0x120'));}if(!this[_0x8fd2('0x82')](_0x2c9454['text'])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x121'),_0x2c9454[_0x8fd2('0x5b')]));var _0x2c6c03=this[_0x8fd2('0x84')]['sync'](this,_0x2c9454);if(_0x2c6c03){this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x2c6c03));var _0x487a92=this[_0x8fd2('0xc')]['streamFile'](_0x2c6c03);try{fs[_0x8fd2('0x122')](_0x2c6c03+_0x8fd2('0xfe'));}catch(_0x3bdf96){logger['error'](_0x3bdf96);}return _0x487a92;}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x2c9454,_0x8fd2('0x123'));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x124')]=function(_0x4b9a10){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x125'),_0x4b9a10[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x4b9a10[_0x8fd2('0x88')])||!this['isConfigured'](_0x4b9a10['aws_secret_access_key'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x120'));}if(!this[_0x8fd2('0x82')](_0x4b9a10[_0x8fd2('0x89')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0x126'));}if(!this[_0x8fd2('0x82')](_0x4b9a10['text'])){return this['channel'][_0x8fd2('0xa3')]('no\x20text\x20configured');}this[_0x8fd2('0xc')][_0x8fd2('0xe5')]=!![];this[_0x8fd2('0x36')](_0x4b9a10);this[_0x8fd2('0x42')](_0x4b9a10[_0x8fd2('0x5b')],'in','','');this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x127'),_0x4b9a10[_0x8fd2('0x5b')]));var _0x4a88d4=this[_0x8fd2('0x87')][_0x8fd2('0x6d')](this,_0x4b9a10);if(_0x4a88d4){for(var _0x4265cb in _0x4a88d4){if(_0x4a88d4[_0x8fd2('0x90')](_0x4265cb)&&_['isString'](_0x4a88d4[_0x4265cb])){this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x128'),_0x4265cb[_0x8fd2('0x67')]()),_0x4a88d4[_0x4265cb]);}}if(_[_0x8fd2('0x50')](_0x4a88d4[_0x8fd2('0x74')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x129'));}else{this['createSquareMessage'](_0x4a88d4[_0x8fd2('0x74')],_0x8fd2('0xe8'),_0x8fd2('0x12a'),'');return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x12b'),_0x4a88d4[_0x8fd2('0x74')]));}}return this[_0x8fd2('0xc')]['error'](_0x4b9a10,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices['prototype'][_0x8fd2('0x12c')]=function(_0x5bd308){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x5bd308[_0x8fd2('0x38')],_0x5bd308['timeout']));if(!this[_0x8fd2('0x82')](_0x5bd308[_0x8fd2('0x78')])){return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0xe4'));}var _0x3fc833=_0x8fd2('0x12d');var _0x5ad311=util[_0x8fd2('0x29')](_0x8fd2('0x12e'),FILES_PATH,rs[_0x8fd2('0x118')](0x4));var _0xadab84=util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x5ad311,_0x3fc833);var _0x268b9e=!![];if(_0x5bd308['beep']===_0x8fd2('0x12f')){_0x268b9e=![];}var _0x29a479=this['channel'][_0x8fd2('0x130')](_0x5ad311,_0x3fc833,_0x5bd308[_0x8fd2('0x131')],_0x5bd308['timeout'],undefined,_0x268b9e);if(_0x29a479['result']!==-0x1){this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x132'),_0xadab84));var _0x1766f3=this[_0x8fd2('0x8a')]['sync'](this,_0x5bd308,_0xadab84);if(_0x1766f3){for(var _0x4799be in _0x1766f3){if(_0x1766f3[_0x8fd2('0x90')](_0x4799be)){this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x133'),_0x4799be[_0x8fd2('0x67')]()),_0x1766f3[_0x4799be]);}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x134'),JSON['stringify'](_0x1766f3)));}}return _0x29a479;};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x135')]=function(_0x4ec48f){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x136'),_0x4ec48f[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x4ec48f['appid'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x137'));}if(!this[_0x8fd2('0x82')](_0x4ec48f[_0x8fd2('0x8d')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x138'));}var _0x31fd85=_0x8fd2('0x12d');var _0x286ac5=util['format'](_0x8fd2('0x12e'),FILES_PATH,rs[_0x8fd2('0x118')](0x4));var _0x1d148a=util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x286ac5,_0x31fd85);var _0x4a21c6=!![];if(_0x4ec48f['beep']===_0x8fd2('0x12f')){_0x4a21c6=![];}var _0x591353=this[_0x8fd2('0xc')][_0x8fd2('0x130')](_0x286ac5,_0x31fd85,_0x4ec48f['intKey'],_0x4ec48f[_0x8fd2('0x63')],undefined,_0x4a21c6);if(_0x591353[_0x8fd2('0x9c')]!==-0x1){this['channel'][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x139'),_0x1d148a));var _0x1738fa=this['tildeASR']['sync'](this,_0x4ec48f,_0x1d148a);if(_0x1738fa){for(var _0x20b546 in _0x1738fa){if(_0x1738fa[_0x8fd2('0x90')](_0x20b546)){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')](_0x8fd2('0x13a'),_0x20b546[_0x8fd2('0x67')]()),_0x1738fa[_0x20b546]);}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('TildeASR\x20Result\x20%s',JSON[_0x8fd2('0x70')](_0x1738fa)));}}return _0x591353;};AGIVertices['prototype'][_0x8fd2('0x13b')]=function(_0x16f7bb){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x13c'),_0x16f7bb['label']));return this[_0x8fd2('0xc')][_0x8fd2('0x13d')](_0x16f7bb['context'],_0x16f7bb['extension'],_0x16f7bb[_0x8fd2('0x3d')]);};AGIVertices['prototype'][_0x8fd2('0x13e')]=function(_0x3af676){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x13f'),_0x3af676[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x3af676[_0x8fd2('0x140')])){return this['channel'][_0x8fd2('0x2d')](_0x3af676,_0x8fd2('0x141'));}try{var _0x53c6ed=eval(_0x3af676[_0x8fd2('0x140')])?_0x8fd2('0x142'):_0x8fd2('0x143');this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x144'),_0x3af676['condition'],_0x53c6ed));return{'code':0xc8,'result':_0x53c6ed};}catch(_0x5c4eb9){return{'code':0xc8,'result':'false'};}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x145')]=function(_0x29bfc6){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x146'),_0x29bfc6[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x29bfc6[_0x8fd2('0x147')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x29bfc6,'no\x20interval\x20configured');}var _0x5e5cb4=this[_0x8fd2('0x25')][_0x8fd2('0x6d')](this,_0x29bfc6['interval_id']);if(!_0x5e5cb4){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x29bfc6,'no\x20intervals\x20found');}for(var _0x1a68d6=0x0;_0x1a68d6<_0x5e5cb4[_0x8fd2('0x94')];_0x1a68d6+=0x1){var _0x12a6eb=this['channel'][_0x8fd2('0xe')](util[_0x8fd2('0x29')](_0x8fd2('0x148'),_0x5e5cb4[_0x1a68d6]));if(_0x12a6eb[_0x8fd2('0x9c')]===-0x1){return _0x12a6eb;}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x149'),_0x5e5cb4[_0x1a68d6],_0x12a6eb[_0x8fd2('0x9e')]));if(_0x12a6eb['extra']===_0x8fd2('0x142')){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x149'),_0x5e5cb4[_0x1a68d6],'true'));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format']('IFTIME\x20%s\x20%s',_0x5e5cb4[_0x1a68d6],_0x8fd2('0x142')));return{'code':0xc8,'result':_0x8fd2('0x142')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('IFTIME\x20%s\x20%s',_0x5e5cb4[_0x1a68d6],_0x8fd2('0x143')));this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x149'),_0x5e5cb4[_0x1a68d6],_0x8fd2('0x143')));}}return{'code':0xc8,'result':_0x8fd2('0x143')};};AGIVertices[_0x8fd2('0x12')]['hangup']=function(_0x182ab3){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x182ab3[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x14a')]();};AGIVertices['prototype'][_0x8fd2('0x14b')]=function(_0x7d43d7){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x14c'),_0x7d43d7[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x7d43d7[_0x8fd2('0x78')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xe4'));}var _0x2ee4d8=_0x8fd2('0x12d');var _0x52356c=util['format'](_0x8fd2('0x12e'),FILES_PATH,rs[_0x8fd2('0x118')](0x4));var _0x2587ec=util[_0x8fd2('0x29')](_0x8fd2('0x98'),_0x52356c,_0x2ee4d8);var _0x3b02d6=!![];if(_0x7d43d7[_0x8fd2('0x14d')]==='NOBEEP'){_0x3b02d6=![];}var _0x163382=this[_0x8fd2('0xc')][_0x8fd2('0x130')](_0x52356c,_0x2ee4d8,_0x7d43d7[_0x8fd2('0x131')],_0x7d43d7['timeout'],undefined,_0x3b02d6);if(_0x163382[_0x8fd2('0x9c')]!==-0x1){this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x14e'),_0x2587ec));var _0x40e428=this[_0x8fd2('0x80')][_0x8fd2('0x6d')](this,_0x7d43d7,_0x2587ec);if(_0x40e428){for(var _0x1fbfb3 in _0x40e428){if(_0x40e428['hasOwnProperty'](_0x1fbfb3)){this[_0x8fd2('0xc')]['setVariable'](util[_0x8fd2('0x29')]('ISPEECH_ASR_%s',_0x1fbfb3[_0x8fd2('0x67')]()),_0x40e428[_0x1fbfb3]);}}return this[_0x8fd2('0xc')]['noop'](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x8fd2('0x70')](_0x40e428)));}}return _0x163382;};AGIVertices[_0x8fd2('0x12')]['ispeechtts']=function(_0x53c617){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x14f'),_0x53c617[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x53c617['key'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x53c617['text'])){return this['channel'][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x150'),_0x53c617[_0x8fd2('0x5b')]));var _0x29cc9a=this['ispeechTTS'][_0x8fd2('0x6d')](this,_0x53c617);if(_0x29cc9a){this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x14e'),_0x29cc9a));var _0x45edad=this[_0x8fd2('0xc')][_0x8fd2('0xfd')](_0x29cc9a,_0x53c617[_0x8fd2('0x131')]);try{fs[_0x8fd2('0x122')](_0x29cc9a+'.wav');}catch(_0x37f8e0){logger[_0x8fd2('0x2d')](_0x37f8e0);}return _0x45edad;}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x53c617,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x151')]=function(_0xd9713a){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x152'),_0xd9713a[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0xd9713a[_0x8fd2('0x153')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0xd9713a,'no\x20find\x20by\x20configured');}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x154'),this[_0x8fd2('0xc')]['callerid'],_0xd9713a[_0x8fd2('0x153')]));var _0x509935=this['agentLogin']['sync'](this,_0xd9713a[_0x8fd2('0x153')]);if(_0x509935){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0xd9713a[_0x8fd2('0x153')]));this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0xd9713a[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0xd9713a[_0x8fd2('0x153')]));this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this[_0x8fd2('0xc')]['callerid'],_0xd9713a['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x8fd2('0x12')]['logout']=function(_0x12734d){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20LOGOUT\x20(%s)\x20block',_0x12734d[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x12734d[_0x8fd2('0x153')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x12734d,_0x8fd2('0x158'));}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x154'),this['channel']['callerid'],_0x12734d[_0x8fd2('0x153')]));var _0x2c4721=this[_0x8fd2('0x53')][_0x8fd2('0x6d')](this,_0x12734d[_0x8fd2('0x153')]);if(_0x2c4721){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this['channel'][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));this[_0x8fd2('0xc')]['noop'](util['format'](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x12734d[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x159')};}};AGIVertices[_0x8fd2('0x12')]['math']=function(_0x415592){logger['info'](util['format'](_0x8fd2('0x15a'),_0x415592[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x415592[_0x8fd2('0x15b')])){return this['channel'][_0x8fd2('0x2d')](_0x415592,_0x8fd2('0x15c'));}this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x15d'),_0x415592[_0x8fd2('0x15b')]));var _0x6e7844=eval(_0x415592[_0x8fd2('0x15b')]);if(!this[_0x8fd2('0x82')](_0x415592[_0x8fd2('0x110')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xd6'));}var _0x4826b0=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x415592[_0x8fd2('0x110')]);if(!_0x4826b0){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x415592,_0x8fd2('0x116'));}if(_[_0x8fd2('0x96')](_0x6e7844)){var _0x1f8fee=this;_0x6e7844[_0x8fd2('0xd7')](function(_0xd8fdd4,_0x31749d){_0x1f8fee['channel'][_0x8fd2('0xd9')](util['format']('%s[%s]',_0x4826b0,_0x31749d),_0xd8fdd4);});return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x15e'),_0x4826b0));}else{return this[_0x8fd2('0xc')][_0x8fd2('0xd9')](_0x4826b0,_0x6e7844);}};AGIVertices['prototype']['menu']=function(_0x57f316){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x57f316['label']));if(_0x57f316[_0x8fd2('0xa0')]===0x0){return this['maxRetry'](_0x57f316);}_0x57f316[_0x8fd2('0xa0')]-=0x1;if(!this[_0x8fd2('0x82')](_0x57f316[_0x8fd2('0x10f')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x57f316,_0x8fd2('0x10e'));}var _0x20135f=this[_0x8fd2('0x1e')][_0x8fd2('0x6d')](this,_0x57f316[_0x8fd2('0x10f')]);if(!_0x20135f){return this['channel']['error'](_0x57f316,'no\x20file\x20audio\x20found');}var _0xd42fd6=this['channel']['getData'](_0x20135f,_0x57f316[_0x8fd2('0x112')],_0x57f316['digit']);var _0xf3b6e9=_0xd42fd6['result'];if(_0xd42fd6['result']===-0x1){this[_0x8fd2('0x36')]['sync'](this,_0x57f316,'-1');return _0xd42fd6;}else if(_0xd42fd6[_0x8fd2('0x9e')]===_0x8fd2('0x63')){_0xd42fd6[_0x8fd2('0x9c')]=_0xd42fd6['result'][_0x8fd2('0x94')]>0x0?_0xd42fd6[_0x8fd2('0x9c')]:'t';}else if(_['isEmpty'](_0xd42fd6[_0x8fd2('0x9c')])){_0xd42fd6[_0x8fd2('0x9c')]='#';_0xf3b6e9='#';}if(!this[_0x8fd2('0x82')](_0x57f316['variable_id'])){this['channel']['noop'](_0x8fd2('0xd6'));}else{var _0x80b8a2=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x57f316[_0x8fd2('0x110')]);if(!_0x80b8a2){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x57f316,_0x8fd2('0x116'));}this[_0x8fd2('0xc')]['setVariable'](_0x80b8a2,_0xf3b6e9);}this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x57f316,_0xf3b6e9);return _0xd42fd6;};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0xa3')]=function(_0x1b1a6a){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x15f'),_0x1b1a6a['label']));return this['channel'][_0x8fd2('0xa3')](_0x1b1a6a[_0x8fd2('0x160')]||_0x1b1a6a['label']);};AGIVertices['prototype'][_0x8fd2('0x161')]=function(_0x2e5fe7){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x2e5fe7[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x2e5fe7[_0x8fd2('0x153')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x2e5fe7,_0x8fd2('0x158'));}logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x2e5fe7[_0x8fd2('0x153')]));var _0x365bf8=this['getPause']['sync'](this,_0x2e5fe7['pause_id']);var _0xa0f25=this[_0x8fd2('0x4f')]['sync'](this,_0x2e5fe7[_0x8fd2('0x153')],_0x365bf8);if(_0xa0f25){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this['channel'][_0x8fd2('0x3a')],_0x2e5fe7['findBy']));this[_0x8fd2('0xc')]['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x155'),this[_0x8fd2('0xc')]['callerid'],_0x2e5fe7[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x157'),this[_0x8fd2('0xc')]['callerid'],_0x2e5fe7[_0x8fd2('0x153')]));this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x2e5fe7[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x159')};}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x162')]=function(_0x397a70){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x163'),_0x397a70[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x397a70[_0x8fd2('0x10f')])){return this[_0x8fd2('0xc')]['error'](_0x397a70,'no\x20file\x20audio\x20selected');}var _0x1402d6=this['getSound'][_0x8fd2('0x6d')](this,_0x397a70['file_id']);if(!_0x1402d6){return this[_0x8fd2('0xc')]['error'](_0x397a70,_0x8fd2('0x164'));}var _0x4120ec=this['channel'][_0x8fd2('0x57')](_0x8fd2('0x165'),[_0x1402d6,_0x397a70['opts']]);if(_0x4120ec[_0x8fd2('0x9c')]===-0x1){return _0x4120ec;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x165'),_0x1402d6));};AGIVertices['prototype'][_0x8fd2('0x167')]=function(_0x31aedf){logger['info'](util['format'](_0x8fd2('0x168'),_0x31aedf[_0x8fd2('0x38')]));if(!this['isConfigured'](_0x31aedf['queue_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x31aedf,'no\x20queue\x20selected');}var _0x3440f3='';var _0x21e9d2=parseInt(_0x31aedf['queue_id'],0xa);if(isNaN(_0x21e9d2)){_0x3440f3=_0x31aedf['queue_id'];}else{_0x3440f3=this[_0x8fd2('0x13')][_0x8fd2('0x6d')](this,_0x31aedf['queue_id']);if(!_0x3440f3){return this[_0x8fd2('0xc')]['error'](_0x31aedf,'no\x20queue\x20found');}}var _0x2ef134='';if(this[_0x8fd2('0x82')](_0x31aedf[_0x8fd2('0x10f')])){var _0x5a7d44=this[_0x8fd2('0x1e')][_0x8fd2('0x6d')](this,_0x31aedf[_0x8fd2('0x10f')]);if(_0x5a7d44){_0x2ef134=_0x5a7d44;}}this['createSquareDetailsReport'][_0x8fd2('0x6d')](this,_0x31aedf,_0x3440f3);if(_0x31aedf[_0x8fd2('0x108')][_0x8fd2('0x169')]('x')<0x0){_0x31aedf[_0x8fd2('0x108')]+='x';}if(_0x31aedf[_0x8fd2('0x108')][_0x8fd2('0x169')]('X')<0x0){_0x31aedf[_0x8fd2('0x108')]+='X';}this[_0x8fd2('0xc')][_0x8fd2('0xd9')](_0x8fd2('0x16a'),_0x3440f3?_0x3440f3[_0x8fd2('0x16b')]():'');var _0x3826ab=this['channel']['exec']('QUEUE',[_0x3440f3,_0x31aedf[_0x8fd2('0x108')],_0x31aedf[_0x8fd2('0x109')],_0x2ef134,_0x31aedf['timeout'],_0x31aedf[_0x8fd2('0xb1')],_0x31aedf['macro'],_0x31aedf['gosub'],'',_0x31aedf[_0x8fd2('0x16c')]]);if(_0x3826ab[_0x8fd2('0x9c')]===-0x1){return _0x3826ab;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x16d'),_0x3440f3));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x16e')]=function(_0x3245d9){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x16f'),_0x3245d9[_0x8fd2('0x38')]));var _0x5c7038=_0x3245d9[_0x8fd2('0x170')]||_0x8fd2('0x12d');var _0x511598=util[_0x8fd2('0x29')](_0x8fd2('0x171'),this[_0x8fd2('0xc')][_0x8fd2('0x37')],rs[_0x8fd2('0x118')](0x5));var _0x4f9a7c=util[_0x8fd2('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x511598,_0x5c7038);var _0x35c594=util['format'](_0x8fd2('0x12e'),FILES_PATH,_0x511598);this['createSquareRecording'][_0x8fd2('0x6d')](this,_0x3245d9,_0x511598,_0x4f9a7c);this['channel'][_0x8fd2('0xd9')](_0x8fd2('0x172'),_0x511598);logger['info'](_0x8fd2('0x173'),_0x35c594,_0x5c7038,_0x3245d9[_0x8fd2('0x174')],_0x3245d9[_0x8fd2('0x63')]);return this['channel']['recordFile'](_0x35c594,_0x5c7038,_0x3245d9[_0x8fd2('0x174')],_0x3245d9['timeout'],undefined,!![]);};AGIVertices['prototype']['restapi']=function(_0x360612){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x175'),_0x360612['label']));if(!this[_0x8fd2('0x82')](_0x360612[_0x8fd2('0x109')])){return this['channel'][_0x8fd2('0xa3')]('no\x20url\x20configured');}var _0x330f93=this[_0x8fd2('0x176')][_0x8fd2('0x6d')](this,_0x360612);logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x177'),util['inspect'](_0x330f93,{'showHidden':![],'depth':null})));if(!this[_0x8fd2('0x82')](_0x360612[_0x8fd2('0x110')])){return this['channel'][_0x8fd2('0xa3')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x23a739=this[_0x8fd2('0xe')]['sync'](this,_0x360612['variable_id']);if(!_0x23a739){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x360612,_0x8fd2('0x116'));}this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x178'),_0x23a739),_0x330f93[_0x8fd2('0x73')]?_0x330f93[_0x8fd2('0x73')]:_0x8fd2('0x179'));this[_0x8fd2('0xc')][_0x8fd2('0xd9')](util[_0x8fd2('0x29')](_0x8fd2('0x17a'),_0x23a739),_0x330f93[_0x8fd2('0x17b')]?_0x330f93[_0x8fd2('0x17b')]:'OK');if(_0x330f93[_0x8fd2('0x71')]){try{this['saveRestApiResult'](_0x330f93['body'],_0x23a739);}catch(_0x40811a){logger[_0x8fd2('0x2d')](util[_0x8fd2('0x29')](_0x8fd2('0x17c'),_0x23a739));}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x17d'),_0x23a739));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x17e')]=function(_0x268b71){logger['info'](util['format'](_0x8fd2('0x17f'),_0x268b71[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x180')](_0x268b71[_0x8fd2('0x181')]['replace'](/\s+/g,''),_0x268b71['escape_digits']);};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x182')]=function(_0xad7f08){logger['info'](util[_0x8fd2('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0xad7f08[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x183')](_0xad7f08[_0x8fd2('0x184')][_0x8fd2('0x185')](/\s+/g,''),_0xad7f08[_0x8fd2('0x174')]);};AGIVertices[_0x8fd2('0x12')]['sayphonetic']=function(_0x39e0f5){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x186'),_0x39e0f5[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')][_0x8fd2('0x187')](_0x39e0f5['text'],_0x39e0f5[_0x8fd2('0x174')]);};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x188')]=function(_0x317e69){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x189'),_0x317e69['label']));if(!this[_0x8fd2('0x82')](_0x317e69[_0x8fd2('0x18a')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x18b'));}var _0x2a2507=this[_0x8fd2('0x22')][_0x8fd2('0x6d')](this,_0x317e69[_0x8fd2('0x18a')]);if(!_0x2a2507||!_0x2a2507['Smtp']){return this['channel'][_0x8fd2('0x2d')](_0x317e69,_0x8fd2('0x18c'));}var _0x2e2ebc={'from':util[_0x8fd2('0x29')](_0x8fd2('0x18d'),_0x2a2507[_0x8fd2('0x10')],_0x2a2507['email']||_0x2a2507[_0x8fd2('0x18e')][_0x8fd2('0x18f')]),'to':_0x317e69['to']||'','cc':_0x317e69['cc']||'','bcc':_0x317e69[_0x8fd2('0x190')]||'','subject':_0x317e69['subject'],'html':_0x317e69[_0x8fd2('0x5b')],'text':_0x317e69[_0x8fd2('0x5b')]};if(this[_0x8fd2('0x82')](_0x317e69[_0x8fd2('0x191')])){}logger[_0x8fd2('0xdd')]('sendMail\x20message',JSON[_0x8fd2('0x70')](_0x2e2ebc));this['createSquareDetailsReport']['sync'](this,_0x317e69,_0x317e69['account_id']);this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x192'),_0x2a2507[_0x8fd2('0x10')]));this[_0x8fd2('0x24')]['sync'](this,_0x2a2507[_0x8fd2('0x193')],_0x2e2ebc);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x194'));};AGIVertices[_0x8fd2('0x12')]['sendFax']=function(_0x5d4720){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x195'),_0x5d4720[_0x8fd2('0x38')]));return this[_0x8fd2('0xc')]['noop'](_0x8fd2('0x196'));};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x197')]=function(_0x1963fa){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x198'),_0x1963fa['label']));if(!this[_0x8fd2('0x82')](_0x1963fa['sms_account_id'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x199'));}var _0x51b249=this[_0x8fd2('0x33')][_0x8fd2('0x6d')](this,_0x1963fa[_0x8fd2('0x19a')]);if(!_0x51b249){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x1963fa,_0x8fd2('0x19b'));}var _0xe8e497={'body':_0x1963fa[_0x8fd2('0x19c')],'phone':_0x1963fa['to']||'','SmsAccountId':_0x51b249['id']};logger['debug'](_0x8fd2('0x19d'),JSON[_0x8fd2('0x70')](_0xe8e497));this[_0x8fd2('0x36')]['sync'](this,_0x1963fa,_0x1963fa[_0x8fd2('0x19a')]);this['channel']['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x19e'),_0x51b249[_0x8fd2('0x10')]));this[_0x8fd2('0x35')][_0x8fd2('0x6d')](this,_0xe8e497);return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x19f'));};AGIVertices['prototype']['set']=function(_0x5944f2){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1a0'),_0x5944f2[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x5944f2['variable_id'])){return this['channel'][_0x8fd2('0x2d')](_0x5944f2,_0x8fd2('0x1a1'));}var _0x18329d=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x5944f2[_0x8fd2('0x110')]);if(!_0x18329d){return this['channel']['error'](_0x5944f2,'no\x20variable\x20found');}return this[_0x8fd2('0xc')]['setVariable'](_0x18329d,_0x5944f2[_0x8fd2('0x1a2')]);};AGIVertices['prototype'][_0x8fd2('0x1a3')]=function(_0x3c66c2){logger['info'](util[_0x8fd2('0x29')](_0x8fd2('0x1a4'),_0x3c66c2[_0x8fd2('0x38')]));this[_0x8fd2('0xc')][_0x8fd2('0xa3')]('START\x20CALLY\x20SQUARE');var _0x1a83e6=this['channel'][_0x8fd2('0xe')](_0x8fd2('0x1a5'));if(!_['isEmpty'](_0x1a83e6[_0x8fd2('0x9e')])){this['channel'][_0x8fd2('0x37')]=_0x1a83e6[_0x8fd2('0x9e')];}if(_0x3c66c2['answer']===_0x8fd2('0x1a6')){this[_0x8fd2('0xc')]['noop'](_0x8fd2('0x1a7'));return this[_0x8fd2('0xc')][_0x8fd2('0xb3')]();}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0x1a8'));};AGIVertices['prototype'][_0x8fd2('0x1a9')]=function(_0x57f84e){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1aa'),_0x57f84e[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x57f84e[_0x8fd2('0x1ab')])){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x57f84e,_0x8fd2('0x1ac'));}var _0x55399e=this[_0x8fd2('0x17')][_0x8fd2('0x6d')](this,_0x57f84e[_0x8fd2('0x1ab')]);if(!this['isConfigured'](_0x55399e)){return this[_0x8fd2('0xc')]['error'](_0x57f84e,util[_0x8fd2('0x29')](_0x8fd2('0x1ad'),_0x57f84e[_0x8fd2('0x1ab')]));}if(_0x55399e===this[_0x8fd2('0xc')][_0x8fd2('0x40')]){return this['channel'][_0x8fd2('0x2d')](_0x57f84e,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x8fd2('0x36')][_0x8fd2('0x6d')](this,_0x57f84e,_0x55399e);var _0x1b48dd=this[_0x8fd2('0xc')][_0x8fd2('0x57')]('AGI',util[_0x8fd2('0x29')](_0x8fd2('0x1ae'),config[_0x8fd2('0xb1')][_0x8fd2('0x1af')]||_0x8fd2('0x1b0'),_0x55399e,this[_0x8fd2('0xc')][_0x8fd2('0x40')]));if(_0x1b48dd[_0x8fd2('0x9c')]===-0x1){return _0x1b48dd;}return this['channel'][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x1b1'),_0x55399e));};AGIVertices['prototype'][_0x8fd2('0x1b2')]=function(_0x11c97e){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x11c97e[_0x8fd2('0x38')]));var _0x15a434=this[_0x8fd2('0x56')][_0x8fd2('0x6d')](this,_0x11c97e[_0x8fd2('0x1b3')]);this[_0x8fd2('0x36')]['sync'](this,_0x11c97e,_0x11c97e[_0x8fd2('0x1b3')]);if(this[_0x8fd2('0x82')](_0x11c97e[_0x8fd2('0x110')])){var _0x326ca0=this[_0x8fd2('0xe')][_0x8fd2('0x6d')](this,_0x11c97e[_0x8fd2('0x110')]);if(_0x326ca0){this[_0x8fd2('0xc')]['setVariable'](_0x326ca0,_0x15a434);return this['channel']['noop'](util[_0x8fd2('0x29')](_0x8fd2('0x1b4'),_0x11c97e[_0x8fd2('0x1b3')],_0x326ca0));}}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x1b5'),_0x11c97e['command']));};AGIVertices['prototype'][_0x8fd2('0x1b6')]=function(_0x2d639d){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x2d639d[_0x8fd2('0x38')]));_0x2d639d['text']=_0x2d639d[_0x8fd2('0x5b')][_0x8fd2('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8fd2('0x82')](_0x2d639d[_0x8fd2('0x1b7')])){return this[_0x8fd2('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x8fd2('0x82')](_0x2d639d['text'])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x1b8'),_0x2d639d[_0x8fd2('0x5b')]));var _0x111a61=this[_0x8fd2('0x59')][_0x8fd2('0x6d')](this,_0x2d639d);if(_0x111a61){this['channel']['noop'](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x111a61));var _0xe03c73=this[_0x8fd2('0xc')][_0x8fd2('0xfd')](_0x111a61);try{fs['unlink'](_0x111a61+_0x8fd2('0xfe'));}catch(_0x2d13bf){logger[_0x8fd2('0x2d')](_0x2d13bf);}return _0xe03c73;}return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x2d639d,_0x8fd2('0x1b9'));};AGIVertices['prototype']['tts']=function(_0x11a65a){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x11a65a[_0x8fd2('0x38')]));_0x11a65a[_0x8fd2('0x5b')]=_0x11a65a[_0x8fd2('0x5b')][_0x8fd2('0x185')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x8fd2('0x82')](_0x11a65a[_0x8fd2('0x5b')])){return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](_0x8fd2('0xa4'));}this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x1ba'),_0x11a65a[_0x8fd2('0x5b')]));var _0x1b63aa=this[_0x8fd2('0x61')][_0x8fd2('0x6d')](this,_0x11a65a);if(_0x1b63aa){this['channel']['noop'](util[_0x8fd2('0x29')]('Google\x20TTS\x20%s\x20file\x20created',_0x1b63aa));var _0x3ae159=this[_0x8fd2('0xc')][_0x8fd2('0xfd')](_0x1b63aa);try{fs[_0x8fd2('0x122')](_0x1b63aa+_0x8fd2('0xfe'));}catch(_0x39f817){logger['error'](_0x39f817);}return _0x3ae159;}return this[_0x8fd2('0xc')]['error'](_0x11a65a,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1bb')]=function(_0x3b5248){logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x1bc'),_0x3b5248['label']));if(!this[_0x8fd2('0x82')](_0x3b5248[_0x8fd2('0x153')])){return this['channel'][_0x8fd2('0x2d')](_0x3b5248,_0x8fd2('0x158'));}logger[_0x8fd2('0x2e')](util['format'](_0x8fd2('0x154'),this['channel'][_0x8fd2('0x3a')],_0x3b5248[_0x8fd2('0x153')]));var _0x1547df=this['agentUnpause']['sync'](this,_0x3b5248[_0x8fd2('0x153')]);if(_0x1547df){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x3b5248['findBy']));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util['format'](_0x8fd2('0x155'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x3b5248[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x156')};}else{logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this['channel']['callerid'],_0x3b5248['findBy']));this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x157'),this[_0x8fd2('0xc')][_0x8fd2('0x3a')],_0x3b5248[_0x8fd2('0x153')]));return{'code':0xc8,'result':_0x8fd2('0x159')};}};AGIVertices[_0x8fd2('0x12')][_0x8fd2('0x1bd')]=function(_0x271a55){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1be'),_0x271a55[_0x8fd2('0x38')]));var _0x42634f=this[_0x8fd2('0xc')]['exec']('VOICEMAIL',[_0x271a55[_0x8fd2('0x1bf')],_0x271a55[_0x8fd2('0x76')]]);if(_0x42634f[_0x8fd2('0x9c')]===-0x1){return _0x42634f;}return this[_0x8fd2('0xc')][_0x8fd2('0xa3')](util[_0x8fd2('0x29')](_0x8fd2('0x166'),_0x8fd2('0x1c0'),_0x271a55[_0x8fd2('0x1bf')]));};AGIVertices['prototype'][_0x8fd2('0x1c1')]=function(_0x6bfeef){logger[_0x8fd2('0x2e')](util[_0x8fd2('0x29')](_0x8fd2('0x1c2'),_0x6bfeef[_0x8fd2('0x38')]));if(!this[_0x8fd2('0x82')](_0x6bfeef[_0x8fd2('0x110')])){return this[_0x8fd2('0xc')]['error'](_0x6bfeef,_0x8fd2('0x1a1'));}var _0x3e3612=this[_0x8fd2('0xe')]['sync'](this,_0x6bfeef[_0x8fd2('0x110')]);if(!_0x3e3612){return this[_0x8fd2('0xc')][_0x8fd2('0x2d')](_0x6bfeef,_0x8fd2('0x116'));}var _0x4b7d0a=this[_0x8fd2('0xc')][_0x8fd2('0xe')](_0x3e3612);return{'code':0xc8,'result':_0x4b7d0a[_0x8fd2('0x9e')]?_0x4b7d0a[_0x8fd2('0x9e')]:'-'};};String[_0x8fd2('0x12')][_0x8fd2('0x9b')]=function(_0x1fe874,_0x3e70bd){return this[_0x8fd2('0x9a')](_0x1fe874)[_0x8fd2('0x1c3')](_0x3e70bd);};module[_0x8fd2('0x1c4')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index bfd2e81..bab3370 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 _0xb63a=['[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','acwTimeout','format','uniqueid','updateAcw','finally','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','[ACW][STOP]\x20%s','acw','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','attended','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','exports','../ami','../../../config/logger','../rpc/voiceAgentReport','voiceQueues','agents','channels','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','timers','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','getAgent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb63a,0x83));var _0xab63=function(_0x57014b,_0x360c0f){_0x57014b=_0x57014b-0x0;var _0x2b258a=_0xb63a[_0x57014b];return _0x2b258a;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0xab63('0x0'));var logger=require(_0xab63('0x1'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0xab63('0x2'));function Acw(_0x5e5358){this[_0xab63('0x3')]=_0x5e5358[_0xab63('0x3')];this[_0xab63('0x4')]=_0x5e5358[_0xab63('0x4')];this['timers']=_0x5e5358['timers'];this[_0xab63('0x5')]={};ami['on']('agentconnect',this[_0xab63('0x6')][_0xab63('0x7')](this));ami['on'](_0xab63('0x8'),this['syncHangupRequest'][_0xab63('0x7')](this));ami['on'](_0xab63('0x9'),this[_0xab63('0xa')][_0xab63('0x7')](this));ami['on'](_0xab63('0xb'),this[_0xab63('0xc')][_0xab63('0x7')](this));ami['on'](_0xab63('0xd'),this['syncAttendedTransfer'][_0xab63('0x7')](this));ami['on']('blindtransfer',this[_0xab63('0xe')][_0xab63('0x7')](this));ami['on'](_0xab63('0xf'),this[_0xab63('0x10')][_0xab63('0x7')](this));}function getDiff(_0x3a8aa1){var _0x3d964a=moment()['milliseconds'](0x0);var _0x3bed13=moment(_0x3a8aa1)[_0xab63('0x11')](0x0);return _0x3d964a[_0xab63('0x12')](_0x3bed13,_0xab63('0x13'));}Acw['prototype']['updateAcw']=function(_0x5e0b37,_0x27cec7){var _0xdc16f2=this;var _0x21f50b=getDiff(_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['lastPauseAt']);clearTimeout(_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['timer']);_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['timer']=![];return RpcVoiceAgentReport[_0xab63('0x15')]({'acwtime':_0x21f50b},_0xdc16f2[_0xab63('0x14')][_0x5e0b37]['uniqueid'],_0x5e0b37)[_0xab63('0x16')](function(_0x3d3032){logger[_0xab63('0x17')](_0xab63('0x18'),_0x27cec7,_0x21f50b,_0x3d3032);})[_0xab63('0x19')](function(_0x3cc0b9){logger[_0xab63('0x1a')](_0xab63('0x1b'),_0x27cec7,_0x3cc0b9);})['finally'](function(){delete _0xdc16f2['timers'][_0x5e0b37];});};Acw[_0xab63('0x1c')][_0xab63('0x1d')]=function(_0x3a1e93){try{var _0x29f7df=this;var _0x5e05b4=this[_0xab63('0x5')][_0x3a1e93][_0xab63('0x1e')];var _0x4e851d=this[_0xab63('0x5')][_0x3a1e93][_0xab63('0x1f')];var _0x4ea550=this[_0xab63('0x3')][_0x4e851d];var _0x323d12=![];var _0x107db6=_0xab63('0x20');if(_0x4ea550[_0xab63('0x21')]&&_0x4ea550[_0xab63('0x22')][_0xab63('0x23')]){_0x323d12=!![];_0x107db6=_0x4ea550[_0xab63('0x22')]['name'];}return ami[_0xab63('0x24')]({'action':_0xab63('0x25'),'interface':_0x5e05b4,'paused':!![],'reason':_0x107db6})[_0xab63('0x16')](function(){if(_0x29f7df[_0xab63('0x4')][_0x5e05b4]){return RpcUser[_0xab63('0x26')](_0x29f7df[_0xab63('0x4')][_0x5e05b4]['id'])[_0xab63('0x16')](function(_0x4d268e){if(!_0x4d268e||_0x4d268e['voicePause']){logger['info'](_0xab63('0x27'),_0x3a1e93,_0x5e05b4,_0x4e851d);return;}logger['info'](_0xab63('0x28'),_0x3a1e93,_0x5e05b4,_0x4e851d);var _0x320353=_0x29f7df['channels'][_0x3a1e93]['attended']&&_0x29f7df[_0xab63('0x5')][_0x3a1e93][_0xab63('0x29')]?_0x29f7df[_0xab63('0x5')][_0x3a1e93][_0xab63('0x29')]:_0x3a1e93;return RpcUser[_0xab63('0x2a')](_0x29f7df['agents'][_0x5e05b4],_0x107db6,_0x320353)[_0xab63('0x16')](function(_0x190a5e){_0x29f7df[_0xab63('0x3')][_0x4e851d][_0xab63('0x2b')]-=0x1;_0x29f7df[_0xab63('0x3')][_0x4e851d][_0xab63('0x2c')]+=0x1;return _0x190a5e;});})['then'](function(_0x40c17d){if(_0x323d12||!_0x40c17d){return;}_0x29f7df['timers'][_0x5e05b4]={};logger[_0xab63('0x17')](_0xab63('0x2d'),_0x3a1e93,_0x29f7df['voiceQueues'][_0x4e851d]['acwTimeout'],_0x5e05b4,_0x4e851d);_0x29f7df[_0xab63('0x14')][_0x5e05b4][_0xab63('0x2e')]=setTimeout(_0x29f7df['stopAcw'][_0xab63('0x7')](_0x29f7df,_0x5e05b4),_0x29f7df[_0xab63('0x3')][_0x4e851d][_0xab63('0x2f')]*0x3e8);_0x29f7df[_0xab63('0x14')][_0x5e05b4]['lastPauseAt']=moment()[_0xab63('0x30')]('YYYY-MM-DD\x20HH:mm:ss');_0x29f7df[_0xab63('0x14')][_0x5e05b4][_0xab63('0x31')]=_0x3a1e93;_0x29f7df[_0xab63('0x14')][_0x5e05b4]['queue']=_0x4e851d;_0x29f7df[_0xab63('0x14')][_0x5e05b4][_0xab63('0x32')]=_0x29f7df['updateAcw'][_0xab63('0x7')](_0x29f7df,_0x5e05b4,_0x3a1e93);});}})[_0xab63('0x19')](function(){logger[_0xab63('0x1a')](_0xab63('0x2d'),_0x3a1e93,_0x29f7df[_0xab63('0x3')][_0x4e851d]['acwTimeout'],_0x5e05b4,_0x4e851d);})[_0xab63('0x33')](function(){delete _0x29f7df['channels'][_0x3a1e93];});}catch(_0x2d2582){logger[_0xab63('0x1a')](_0xab63('0x34'),_0x2d2582[_0xab63('0x35')]);}};Acw['prototype']['stopAcw']=function(_0x1d68a3){try{var _0x366bd9=this;if(_0x366bd9[_0xab63('0x14')][_0x1d68a3]){_0x366bd9[_0xab63('0x14')][_0x1d68a3][_0xab63('0x2e')]=![];var _0x4d0720=_0x366bd9[_0xab63('0x14')][_0x1d68a3][_0xab63('0x31')];var _0x18c461=_0x366bd9[_0xab63('0x14')][_0x1d68a3][_0xab63('0x1f')];var _0x50b1a2=_0x366bd9[_0xab63('0x3')][_0x18c461][_0xab63('0x2f')];logger[_0xab63('0x17')](_0xab63('0x36'),_0x4d0720,_0x1d68a3);RpcUser[_0xab63('0x26')](this['agents'][_0x1d68a3]['id'])[_0xab63('0x16')](function(_0x52b1da){if(_0x52b1da['pauseType']==='ACW'){return RpcUser['saveUnpause'](_0x366bd9[_0xab63('0x4')][_0x1d68a3]);}});RpcVoiceAgentReport[_0xab63('0x15')]({'acwtime':_0x50b1a2,'agentacw':!![]},_0x4d0720,_0x1d68a3)['then'](function(_0xd15b56){logger[_0xab63('0x17')]('[%s][UPDATE][ACWTIME:%s]',_0x4d0720,_0x50b1a2,_0xd15b56);})[_0xab63('0x19')](function(_0x18bf44){logger[_0xab63('0x1a')](_0xab63('0x1b'),_0x4d0720,_0x18bf44);});}else{logger[_0xab63('0x1a')](_0xab63('0x37'),_0x1d68a3);if(_0x366bd9[_0xab63('0x14')]){logger['info'](_0xab63('0x38'),JSON['stringify'](_0x366bd9[_0xab63('0x14')]));}}}catch(_0x2acf4e){logger[_0xab63('0x1a')](_0xab63('0x39'),_0x2acf4e[_0xab63('0x35')]);}};Acw['prototype'][_0xab63('0x6')]=function(_0x703a3d){try{if(this[_0xab63('0x3')][_0x703a3d[_0xab63('0x1f')]]&&(this[_0xab63('0x3')][_0x703a3d[_0xab63('0x1f')]][_0xab63('0x3a')]||this[_0xab63('0x3')][_0x703a3d[_0xab63('0x1f')]][_0xab63('0x21')])){if(this[_0xab63('0x4')][_0x703a3d[_0xab63('0x1e')]]){this[_0xab63('0x5')][_0x703a3d['uniqueid']]={'queue':_0x703a3d[_0xab63('0x1f')],'interface':_0x703a3d[_0xab63('0x1e')],'destlinkedid':_0x703a3d[_0xab63('0x29')]};}}}catch(_0xedb69e){logger[_0xab63('0x1a')](_0xab63('0x3b'),_0xedb69e['message']);}};Acw[_0xab63('0x1c')][_0xab63('0x10')]=function(_0x255a40){try{if(this[_0xab63('0x3')][_0x255a40[_0xab63('0x1f')]]&&(this['voiceQueues'][_0x255a40[_0xab63('0x1f')]][_0xab63('0x3a')]||this[_0xab63('0x3')][_0x255a40[_0xab63('0x1f')]][_0xab63('0x21')])){if(this[_0xab63('0x4')][_0x255a40[_0xab63('0x1e')]]){this[_0xab63('0x5')][_0x255a40[_0xab63('0x31')]]={'queue':_0x255a40['queue'],'interface':_0x255a40[_0xab63('0x1e')]};}}}catch(_0x44a64b){logger['error'](_0xab63('0x3c'),_0x44a64b['message']);}};Acw[_0xab63('0x1c')][_0xab63('0x3d')]=function(_0x209b9f){try{if(this[_0xab63('0x5')][_0x209b9f['uniqueid']]&&_[_0xab63('0x3e')](this[_0xab63('0x5')][_0x209b9f[_0xab63('0x31')]][_0xab63('0x3f')])){logger[_0xab63('0x17')]('[%s][HANGUP:UNIQUEID]',_0x209b9f[_0xab63('0x31')]);this[_0xab63('0x1d')](_0x209b9f[_0xab63('0x31')]);}else if(this[_0xab63('0x5')][_0x209b9f['linkedid']]&&_['isUndefined'](this['channels'][_0x209b9f[_0xab63('0x40')]][_0xab63('0x3f')])){logger[_0xab63('0x17')]('[%s][HANGUP:LINKEDID]',_0x209b9f[_0xab63('0x40')]);this[_0xab63('0x1d')](_0x209b9f[_0xab63('0x40')]);}}catch(_0x3328c3){logger[_0xab63('0x1a')](_0xab63('0x41'),_0x3328c3[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0xa')]=function(_0x38f669){try{if(this['channels'][_0x38f669[_0xab63('0x31')]]&&this[_0xab63('0x5')][_0x38f669[_0xab63('0x31')]][_0xab63('0x3f')]){logger['info'](_0xab63('0x42'),_0x38f669['uniqueid']);this['startAcw'](_0x38f669['uniqueid']);}else if(this['channels'][_0x38f669[_0xab63('0x40')]]&&this[_0xab63('0x5')][_0x38f669[_0xab63('0x40')]]['attended']){logger['info'](_0xab63('0x43'),_0x38f669['linkedid']);this[_0xab63('0x1d')](_0x38f669[_0xab63('0x40')]);}}catch(_0x4b11ee){logger[_0xab63('0x1a')](_0xab63('0x44'),_0x4b11ee[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')]['syncAttendedTransfer']=function(_0x47f6af){try{if(!_[_0xab63('0x45')](this[_0xab63('0x5')][_0x47f6af[_0xab63('0x46')]])){this[_0xab63('0x1d')](_0x47f6af['transfereeuniqueid']);if(this[_0xab63('0x5')][_0x47f6af[_0xab63('0x47')]]){this[_0xab63('0x5')][_0x47f6af[_0xab63('0x47')]][_0xab63('0x3f')]=!![];this[_0xab63('0x5')][_0x47f6af[_0xab63('0x48')]]=this[_0xab63('0x5')][_0x47f6af[_0xab63('0x47')]];this[_0xab63('0x49')](_0x47f6af['secondtransfereruniqueid']);}}else if(!_[_0xab63('0x45')](this[_0xab63('0x5')][_0x47f6af['transfertargetuniqueid']])){this['startAcw'](_0x47f6af[_0xab63('0x48')]);if(this['channels'][_0x47f6af[_0xab63('0x4a')]]){this[_0xab63('0x5')][_0x47f6af[_0xab63('0x4a')]]['attended']=!![];this[_0xab63('0x5')][_0x47f6af[_0xab63('0x46')]]=this[_0xab63('0x5')][_0x47f6af[_0xab63('0x4a')]];this[_0xab63('0x49')](_0x47f6af[_0xab63('0x4a')]);}}}catch(_0xb4f8cf){logger[_0xab63('0x1a')](_0xab63('0x4b'),_0xb4f8cf[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0xe')]=function(_0x2a7c1f){try{if(this['channels'][_0x2a7c1f[_0xab63('0x4c')]]){logger['info'](_0xab63('0x4d'),JSON[_0xab63('0x4e')](_0x2a7c1f['transfereruniqueid']));this[_0xab63('0x1d')](_0x2a7c1f['transfereruniqueid']);}else if(this[_0xab63('0x5')][_0x2a7c1f[_0xab63('0x4f')]]){logger[_0xab63('0x17')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xab63('0x4e')](_0x2a7c1f[_0xab63('0x4f')]));this[_0xab63('0x1d')](_0x2a7c1f[_0xab63('0x4f')]);}}catch(_0x2892bd){logger[_0xab63('0x1a')](_0xab63('0x50'),_0x2892bd[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0xc')]=function(_0x211e6f){try{if(this[_0xab63('0x3')][_0x211e6f[_0xab63('0x1f')]]&&this[_0xab63('0x3')][_0x211e6f[_0xab63('0x1f')]][_0xab63('0x51')]===_0xab63('0x52')){if(this[_0xab63('0x4')][_0x211e6f[_0xab63('0x1e')]]){logger['info'](_0xab63('0x53'),_0x211e6f['uniqueid'],_0x211e6f['interface'],_0x211e6f['queue']);return RpcUser[_0xab63('0x2a')](this[_0xab63('0x4')][_0x211e6f[_0xab63('0x1e')]],'Auto-Pause',_0x211e6f['uniqueid']);}}}catch(_0x3846ca){logger[_0xab63('0x1a')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x3846ca[_0xab63('0x35')]);}};Acw[_0xab63('0x1c')][_0xab63('0x49')]=function(_0x368acb,_0x1b5d30=0x2710){if(this[_0xab63('0x5')][_0x368acb]){setTimeout(()=>{delete this[_0xab63('0x5')][_0x368acb];},_0x1b5d30);}};module[_0xab63('0x54')]=Acw; \ No newline at end of file +var _0x6094=['[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','bind','hanguprequest','syncHangupRequest','hangup','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','prototype','updateAcw','timer','update','uniqueid','info','[%s][UPDATE][ACWTIME:%s]','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','destlinkedid','savePause','available','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','catch','error','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','startAcw','linkedid','attended','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid'];(function(_0x286b00,_0x72775a){var _0x3559fd=function(_0x305944){while(--_0x305944){_0x286b00['push'](_0x286b00['shift']());}};_0x3559fd(++_0x72775a);}(_0x6094,0x108));var _0x4609=function(_0x4606e5,_0x5a4b6d){_0x4606e5=_0x4606e5-0x0;var _0x387b17=_0x6094[_0x4606e5];return _0x387b17;};'use strict';var _=require(_0x4609('0x0'));var moment=require(_0x4609('0x1'));var ami=require('../ami');var logger=require(_0x4609('0x2'))(_0x4609('0x3'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x4609('0x4'));function Acw(_0x4bcd69){this[_0x4609('0x5')]=_0x4bcd69[_0x4609('0x5')];this[_0x4609('0x6')]=_0x4bcd69['agents'];this[_0x4609('0x7')]=_0x4bcd69[_0x4609('0x7')];this[_0x4609('0x8')]={};ami['on'](_0x4609('0x9'),this['syncAgentConnect'][_0x4609('0xa')](this));ami['on'](_0x4609('0xb'),this[_0x4609('0xc')][_0x4609('0xa')](this));ami['on'](_0x4609('0xd'),this['syncHangup'][_0x4609('0xa')](this));ami['on']('agentringnoanswer',this[_0x4609('0xe')]['bind'](this));ami['on'](_0x4609('0xf'),this[_0x4609('0x10')][_0x4609('0xa')](this));ami['on']('blindtransfer',this[_0x4609('0x11')]['bind'](this));ami['on'](_0x4609('0x12'),this[_0x4609('0x13')][_0x4609('0xa')](this));}function getDiff(_0x59c190){var _0x4dab88=moment()[_0x4609('0x14')](0x0);var _0x36aad5=moment(_0x59c190)[_0x4609('0x14')](0x0);return _0x4dab88[_0x4609('0x15')](_0x36aad5,'seconds');}Acw[_0x4609('0x16')][_0x4609('0x17')]=function(_0x283426,_0x47108c){var _0x575668=this;var _0x4f262a=getDiff(_0x575668[_0x4609('0x7')][_0x283426]['lastPauseAt']);clearTimeout(_0x575668[_0x4609('0x7')][_0x283426][_0x4609('0x18')]);_0x575668[_0x4609('0x7')][_0x283426][_0x4609('0x18')]=![];return RpcVoiceAgentReport[_0x4609('0x19')]({'acwtime':_0x4f262a},_0x575668[_0x4609('0x7')][_0x283426][_0x4609('0x1a')],_0x283426)['then'](function(_0x727509){logger[_0x4609('0x1b')](_0x4609('0x1c'),_0x47108c,_0x4f262a,_0x727509);})['catch'](function(_0x1af5e5){logger['error'](_0x4609('0x1d'),_0x47108c,_0x1af5e5);})[_0x4609('0x1e')](function(){delete _0x575668[_0x4609('0x7')][_0x283426];});};Acw['prototype']['startAcw']=function(_0x2834b8){try{var _0x570416=this;var _0x1b996a=this['channels'][_0x2834b8][_0x4609('0x1f')];var _0x479407=this[_0x4609('0x8')][_0x2834b8][_0x4609('0x20')];var _0x555a5c=this[_0x4609('0x5')][_0x479407];var _0x1ad127=![];var _0x34c2a5=_0x4609('0x21');if(_0x555a5c[_0x4609('0x22')]&&_0x555a5c[_0x4609('0x23')]['name']){_0x1ad127=!![];_0x34c2a5=_0x555a5c[_0x4609('0x23')][_0x4609('0x24')];}return ami[_0x4609('0x25')]({'action':_0x4609('0x26'),'interface':_0x1b996a,'paused':!![],'reason':_0x34c2a5})[_0x4609('0x27')](function(){if(_0x570416['agents'][_0x1b996a]){return RpcUser[_0x4609('0x28')](_0x570416[_0x4609('0x6')][_0x1b996a]['id'])[_0x4609('0x27')](function(_0x410ee9){if(!_0x410ee9||_0x410ee9[_0x4609('0x29')]){logger[_0x4609('0x1b')](_0x4609('0x2a'),_0x2834b8,_0x1b996a,_0x479407);return;}logger[_0x4609('0x1b')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x2834b8,_0x1b996a,_0x479407);var _0x40fa30=_0x570416['channels'][_0x2834b8]['attended']&&_0x570416[_0x4609('0x8')][_0x2834b8][_0x4609('0x2b')]?_0x570416[_0x4609('0x8')][_0x2834b8]['destlinkedid']:_0x2834b8;return RpcUser[_0x4609('0x2c')](_0x570416[_0x4609('0x6')][_0x1b996a],_0x34c2a5,_0x40fa30)[_0x4609('0x27')](function(_0x57071a){_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2d')]-=0x1;_0x570416['voiceQueues'][_0x479407]['paused']+=0x1;return _0x57071a;});})[_0x4609('0x27')](function(_0x163420){if(_0x1ad127||!_0x163420){return;}_0x570416[_0x4609('0x7')][_0x1b996a]={};logger[_0x4609('0x1b')](_0x4609('0x2e'),_0x2834b8,_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2f')],_0x1b996a,_0x479407);_0x570416[_0x4609('0x7')][_0x1b996a][_0x4609('0x18')]=setTimeout(_0x570416[_0x4609('0x30')]['bind'](_0x570416,_0x1b996a),_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2f')]*0x3e8);_0x570416[_0x4609('0x7')][_0x1b996a][_0x4609('0x31')]=moment()[_0x4609('0x32')](_0x4609('0x33'));_0x570416['timers'][_0x1b996a]['uniqueid']=_0x2834b8;_0x570416['timers'][_0x1b996a][_0x4609('0x20')]=_0x479407;_0x570416[_0x4609('0x7')][_0x1b996a][_0x4609('0x17')]=_0x570416['updateAcw']['bind'](_0x570416,_0x1b996a,_0x2834b8);});}})[_0x4609('0x34')](function(){logger[_0x4609('0x35')](_0x4609('0x2e'),_0x2834b8,_0x570416[_0x4609('0x5')][_0x479407][_0x4609('0x2f')],_0x1b996a,_0x479407);})[_0x4609('0x1e')](function(){delete _0x570416[_0x4609('0x8')][_0x2834b8];});}catch(_0x303dba){logger[_0x4609('0x35')](_0x4609('0x36'),_0x303dba[_0x4609('0x37')]);}};Acw['prototype'][_0x4609('0x30')]=function(_0x196fe6){try{var _0x15e104=this;if(_0x15e104[_0x4609('0x7')][_0x196fe6]){_0x15e104[_0x4609('0x7')][_0x196fe6][_0x4609('0x18')]=![];var _0x8c1c16=_0x15e104[_0x4609('0x7')][_0x196fe6]['uniqueid'];var _0x19dfc5=_0x15e104['timers'][_0x196fe6][_0x4609('0x20')];var _0x412bf9=_0x15e104[_0x4609('0x5')][_0x19dfc5][_0x4609('0x2f')];logger['info'](_0x4609('0x38'),_0x8c1c16,_0x196fe6);RpcUser[_0x4609('0x28')](this[_0x4609('0x6')][_0x196fe6]['id'])[_0x4609('0x27')](function(_0x200c9d){if(_0x200c9d[_0x4609('0x39')]==='ACW'){return RpcUser[_0x4609('0x3a')](_0x15e104[_0x4609('0x6')][_0x196fe6]);}});RpcVoiceAgentReport['update']({'acwtime':_0x412bf9,'agentacw':!![]},_0x8c1c16,_0x196fe6)[_0x4609('0x27')](function(_0x54ccc6){logger[_0x4609('0x1b')](_0x4609('0x1c'),_0x8c1c16,_0x412bf9,_0x54ccc6);})['catch'](function(_0x1e30c0){logger['error'](_0x4609('0x1d'),_0x8c1c16,_0x1e30c0);});}else{logger['error'](_0x4609('0x3b'),_0x196fe6);if(_0x15e104[_0x4609('0x7')]){logger[_0x4609('0x1b')](_0x4609('0x3c'),JSON[_0x4609('0x3d')](_0x15e104[_0x4609('0x7')]));}}}catch(_0x22f30a){logger[_0x4609('0x35')]('[ACW][STOP]\x20%s',_0x22f30a[_0x4609('0x37')]);}};Acw[_0x4609('0x16')]['syncAgentConnect']=function(_0x57d09b){try{if(this[_0x4609('0x5')][_0x57d09b[_0x4609('0x20')]]&&(this[_0x4609('0x5')][_0x57d09b[_0x4609('0x20')]][_0x4609('0x3')]||this[_0x4609('0x5')][_0x57d09b['queue']][_0x4609('0x22')])){if(this[_0x4609('0x6')][_0x57d09b['interface']]){this[_0x4609('0x8')][_0x57d09b[_0x4609('0x1a')]]={'queue':_0x57d09b[_0x4609('0x20')],'interface':_0x57d09b['interface'],'destlinkedid':_0x57d09b['destlinkedid']};}}}catch(_0x24c7a1){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x24c7a1[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x13')]=function(_0x159ece){try{if(this['voiceQueues'][_0x159ece[_0x4609('0x20')]]&&(this[_0x4609('0x5')][_0x159ece['queue']][_0x4609('0x3')]||this[_0x4609('0x5')][_0x159ece[_0x4609('0x20')]][_0x4609('0x22')])){if(this[_0x4609('0x6')][_0x159ece['interface']]){this['channels'][_0x159ece[_0x4609('0x1a')]]={'queue':_0x159ece['queue'],'interface':_0x159ece[_0x4609('0x1f')]};}}}catch(_0x509ae2){logger[_0x4609('0x35')](_0x4609('0x3e'),_0x509ae2['message']);}};Acw[_0x4609('0x16')][_0x4609('0xc')]=function(_0x5bd500){try{if(this[_0x4609('0x8')][_0x5bd500[_0x4609('0x1a')]]&&_[_0x4609('0x3f')](this[_0x4609('0x8')][_0x5bd500[_0x4609('0x1a')]]['attended'])){logger['info']('[%s][HANGUP:UNIQUEID]',_0x5bd500[_0x4609('0x1a')]);this[_0x4609('0x40')](_0x5bd500[_0x4609('0x1a')]);}else if(this[_0x4609('0x8')][_0x5bd500[_0x4609('0x41')]]&&_[_0x4609('0x3f')](this[_0x4609('0x8')][_0x5bd500[_0x4609('0x41')]][_0x4609('0x42')])){logger[_0x4609('0x1b')]('[%s][HANGUP:LINKEDID]',_0x5bd500[_0x4609('0x41')]);this['startAcw'](_0x5bd500[_0x4609('0x41')]);}}catch(_0x388c14){logger['error']('[ACW][syncHangupRequest]\x20%s',_0x388c14[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x43')]=function(_0x5d4ef1){try{if(this['channels'][_0x5d4ef1[_0x4609('0x1a')]]&&this['channels'][_0x5d4ef1[_0x4609('0x1a')]][_0x4609('0x42')]){logger[_0x4609('0x1b')](_0x4609('0x44'),_0x5d4ef1[_0x4609('0x1a')]);this['startAcw'](_0x5d4ef1['uniqueid']);}else if(this[_0x4609('0x8')][_0x5d4ef1[_0x4609('0x41')]]&&this['channels'][_0x5d4ef1[_0x4609('0x41')]][_0x4609('0x42')]){logger[_0x4609('0x1b')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x5d4ef1['linkedid']);this[_0x4609('0x40')](_0x5d4ef1[_0x4609('0x41')]);}}catch(_0x2095f2){logger[_0x4609('0x35')](_0x4609('0x45'),_0x2095f2[_0x4609('0x37')]);}};Acw[_0x4609('0x16')]['syncAttendedTransfer']=function(_0x5e9db7){try{if(!_[_0x4609('0x46')](this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x47')]])){this[_0x4609('0x40')](_0x5e9db7[_0x4609('0x47')]);if(this[_0x4609('0x8')][_0x5e9db7['secondtransfereruniqueid']]){this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x48')]]['attended']=!![];this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x49')]]=this['channels'][_0x5e9db7[_0x4609('0x48')]];this[_0x4609('0x4a')](_0x5e9db7[_0x4609('0x48')]);}}else if(!_['isNil'](this[_0x4609('0x8')][_0x5e9db7[_0x4609('0x49')]])){this[_0x4609('0x40')](_0x5e9db7[_0x4609('0x49')]);if(this[_0x4609('0x8')][_0x5e9db7['origtransfereruniqueid']]){this[_0x4609('0x8')][_0x5e9db7['origtransfereruniqueid']][_0x4609('0x42')]=!![];this['channels'][_0x5e9db7[_0x4609('0x47')]]=this[_0x4609('0x8')][_0x5e9db7['origtransfereruniqueid']];this[_0x4609('0x4a')](_0x5e9db7[_0x4609('0x4b')]);}}}catch(_0x40aab3){logger[_0x4609('0x35')](_0x4609('0x4c'),_0x40aab3[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x11')]=function(_0x456e1e){try{if(this[_0x4609('0x8')][_0x456e1e[_0x4609('0x4d')]]){logger[_0x4609('0x1b')](_0x4609('0x4e'),JSON[_0x4609('0x3d')](_0x456e1e[_0x4609('0x4d')]));this[_0x4609('0x40')](_0x456e1e[_0x4609('0x4d')]);}else if(this[_0x4609('0x8')][_0x456e1e[_0x4609('0x4f')]]){logger[_0x4609('0x1b')](_0x4609('0x50'),JSON['stringify'](_0x456e1e['transfererlinkedid']));this[_0x4609('0x40')](_0x456e1e[_0x4609('0x4f')]);}}catch(_0x5d47f0){logger[_0x4609('0x35')](_0x4609('0x51'),_0x5d47f0['message']);}};Acw['prototype'][_0x4609('0xe')]=function(_0x235559){try{if(this['voiceQueues'][_0x235559[_0x4609('0x20')]]&&this[_0x4609('0x5')][_0x235559[_0x4609('0x20')]][_0x4609('0x52')]==='all'){if(this[_0x4609('0x6')][_0x235559[_0x4609('0x1f')]]){logger['info']('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x235559[_0x4609('0x1a')],_0x235559['interface'],_0x235559[_0x4609('0x20')]);return RpcUser[_0x4609('0x2c')](this[_0x4609('0x6')][_0x235559[_0x4609('0x1f')]],_0x4609('0x53'),_0x235559[_0x4609('0x1a')]);}}}catch(_0x35802a){logger[_0x4609('0x35')](_0x4609('0x54'),_0x35802a[_0x4609('0x37')]);}};Acw[_0x4609('0x16')][_0x4609('0x4a')]=function(_0x5c3ef7,_0xa8b4b4=0x2710){if(this['channels'][_0x5c3ef7]){setTimeout(()=>{delete this[_0x4609('0x8')][_0x5c3ef7];},_0xa8b4b4);}};module[_0x4609('0x55')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f2301c2..1971ff2 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 _0xc564=['info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','inspect','exports','asterisk-manager','bluebird','ami','asterisk','port','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','username','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','actionQueueSummary','actionCoreShowChannels','coreshowchannels'];(function(_0x6522af,_0x200962){var _0x39f7de=function(_0x2da9f7){while(--_0x2da9f7){_0x6522af['push'](_0x6522af['shift']());}};_0x39f7de(++_0x200962);}(_0xc564,0xcd));var _0x4c56=function(_0x4ad00c,_0x1dccc7){_0x4ad00c=_0x4ad00c-0x0;var _0x39b511=_0xc564[_0x4ad00c];return _0x39b511;};'use strict';var Manager=require(_0x4c56('0x0'));var BPromise=require(_0x4c56('0x1'));var util=require('util');var logger=require('../../config/logger')(_0x4c56('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x4c56('0x3')][_0x4c56('0x4')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')]['username'],config['asterisk'][_0x4c56('0x5')],!![]);ami[_0x4c56('0x6')]();ami[_0x4c56('0x7')]=BPromise['promisify'](ami[_0x4c56('0x8')]);function error(_0x17595e){logger[_0x4c56('0x9')](util[_0x4c56('0xa')](_0x4c56('0xb'),config[_0x4c56('0x3')][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config['asterisk'][_0x4c56('0x4')],util['inspect'](_0x17595e,![],null)));}function close(){logger['error'](util[_0x4c56('0xa')](_0x4c56('0xd'),config['asterisk'][_0x4c56('0xc')],config['asterisk']['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')]));}ami[_0x4c56('0xe')]=function(){return function(){return ami['Action']({'action':'sipshowregistry'});};};ami[_0x4c56('0xf')]=function(){return function(){return ami[_0x4c56('0x7')]({'action':'devicestatelist'});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x4c56('0x7')]({'action':'sippeerstatus'});};};ami[_0x4c56('0x10')]=function(){return function(){return ami[_0x4c56('0x7')]({'action':'queuesummary'});};};ami[_0x4c56('0x11')]=function(){return function(){return ami['Action']({'action':_0x4c56('0x12')});};};function connect(){logger[_0x4c56('0x13')](util[_0x4c56('0xa')](_0x4c56('0x14'),config['asterisk'][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')]));ami[_0x4c56('0x15')](_0x4c56('0x9'),error);ami['once'](_0x4c56('0x16'),close);}ami['on'](_0x4c56('0x17'),connect);ami['on']('shutdown',function(_0xce395a){logger['info'](util[_0x4c56('0xa')](_0x4c56('0x18'),config[_0x4c56('0x3')][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')],util['inspect'](_0xce395a,![],null)));});ami['on'](_0x4c56('0x19'),function(){logger[_0x4c56('0x13')](util[_0x4c56('0xa')](_0x4c56('0x1a'),config[_0x4c56('0x3')][_0x4c56('0xc')],config[_0x4c56('0x3')]['ip'],config[_0x4c56('0x3')][_0x4c56('0x4')]));return Promise[_0x4c56('0x1b')]()['then'](ami[_0x4c56('0xe')]())[_0x4c56('0x1c')](ami[_0x4c56('0xf')]())[_0x4c56('0x1c')](ami['actionSipPeerStatus']())[_0x4c56('0x1c')](ami[_0x4c56('0x10')]())[_0x4c56('0x1c')](ami['actionCoreShowChannels']())[_0x4c56('0x1d')](function(_0x3563d7){logger[_0x4c56('0x9')]('[ami.js][fullybooted]',util[_0x4c56('0x1e')](_0x3563d7,{'showHidden':![],'depth':null}));});});ami['once'](_0x4c56('0x9'),error);ami[_0x4c56('0x15')](_0x4c56('0x16'),close);module[_0x4c56('0x1f')]=ami; \ No newline at end of file +var _0x8d88=['username','password','keepConnected','Action','action','error','format','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','inspect','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','[ami.js][fullybooted]','exports','util','../../config/logger','ami','../../config/environment','asterisk'];(function(_0x268db5,_0x3408a0){var _0x5c0a20=function(_0x4b6445){while(--_0x4b6445){_0x268db5['push'](_0x268db5['shift']());}};_0x5c0a20(++_0x3408a0);}(_0x8d88,0x14f));var _0x88d8=function(_0x476392,_0x43d678){_0x476392=_0x476392-0x0;var _0x25d9f4=_0x8d88[_0x476392];return _0x25d9f4;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x88d8('0x0'));var logger=require(_0x88d8('0x1'))(_0x88d8('0x2'));var config=require(_0x88d8('0x3'));var ami=new Manager(config['asterisk']['port'],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0x5')],config[_0x88d8('0x4')][_0x88d8('0x6')],!![]);ami[_0x88d8('0x7')]();ami[_0x88d8('0x8')]=BPromise['promisify'](ami[_0x88d8('0x9')]);function error(_0x2048bf){logger[_0x88d8('0xa')](util[_0x88d8('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')],util['inspect'](_0x2048bf,![],null)));}function close(){logger['error'](util['format'](_0x88d8('0xd'),config[_0x88d8('0x4')][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')]['port']));}ami[_0x88d8('0xe')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':'sipshowregistry'});};};ami[_0x88d8('0xf')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':_0x88d8('0x10')});};};ami[_0x88d8('0x11')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':_0x88d8('0x12')});};};ami[_0x88d8('0x13')]=function(){return function(){return ami[_0x88d8('0x8')]({'action':_0x88d8('0x14')});};};ami[_0x88d8('0x15')]=function(){return function(){return ami['Action']({'action':_0x88d8('0x16')});};};function connect(){logger['info'](util[_0x88d8('0xb')](_0x88d8('0x17'),config['asterisk']['username'],config['asterisk']['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')]));ami[_0x88d8('0x18')](_0x88d8('0xa'),error);ami[_0x88d8('0x18')](_0x88d8('0x19'),close);}ami['on']('connect',connect);ami['on'](_0x88d8('0x1a'),function(_0x3bf740){logger[_0x88d8('0x1b')](util[_0x88d8('0xb')](_0x88d8('0x1c'),config['asterisk'][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')],util[_0x88d8('0x1d')](_0x3bf740,![],null)));});ami['on']('fullybooted',function(){logger[_0x88d8('0x1b')](util[_0x88d8('0xb')](_0x88d8('0x1e'),config[_0x88d8('0x4')][_0x88d8('0x5')],config[_0x88d8('0x4')]['ip'],config[_0x88d8('0x4')][_0x88d8('0xc')]));return Promise['resolve']()[_0x88d8('0x1f')](ami[_0x88d8('0xe')]())[_0x88d8('0x1f')](ami[_0x88d8('0xf')]())[_0x88d8('0x1f')](ami[_0x88d8('0x11')]())[_0x88d8('0x1f')](ami[_0x88d8('0x13')]())[_0x88d8('0x1f')](ami[_0x88d8('0x15')]())['catch'](function(_0x2e427c){logger[_0x88d8('0xa')](_0x88d8('0x20'),util[_0x88d8('0x1d')](_0x2e427c,{'showHidden':![],'depth':null}));});});ami[_0x88d8('0x18')](_0x88d8('0xa'),error);ami[_0x88d8('0x18')](_0x88d8('0x19'),close);module[_0x88d8('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 0f25831..67fe911 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 _0x70e0=['catch','exports','jayson/promise','bluebird','../../config/logger','http','Request','then','memberReport','error','rpc','message','result'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x70e0,0x17b));var _0x070e=function(_0x35b649,_0x23d618){_0x35b649=_0x35b649-0x0;var _0x36d6d8=_0x70e0[_0x35b649];return _0x36d6d8;};'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 +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xb7e7,0x121));var _0x7b7e=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0xb7e7[_0x34bf97];return _0x292719;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index bd54a1b..6b5edeb 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 _0xb66c=['Voice\x20Queue\x20%s\x20$s','intervalIftime','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','silly','AMI\x20IfTime','queue','uniqueId','uniqueid','[syncAgentConnect]','answertime','outboundAnswerCallsDay','agent','agiafterat','dialQueueProject2','YYYY-MM-DD\x20HH:mm:ss','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','ivr','[syncQueueCallerAbandon]','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','rescheduleContact','add','minutes','ContactId','ListId','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','CampaignId','channel','actionid','roundrobin','isNil','locked','paused','stateinterface','queueBooked','strategy','rrmemory','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','decrementOriginate','[syncQueueStatusComplete]','VoiceQueueId','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','MACHINE','Machine','countnoanswerretry','countnosuchnumberretry','createStateFinal','reason\x2019\x20machine....','[syncHangup]','ivrAnswerCallsDay','cause-txt','Normal\x20Clearing','[syncAgentCompleteIvr][createHistory]','[syncAgentCompleteIvr]','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','[syncHangup2]','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','checkDialMethod','[syncQueueSummary]','queueSummaryCountersUpdated','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','enqueue','[clearZombieChannels]','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','[emptyContact]','UserId','[emptyContact][createHistory]','[syncQueueCallerAbandon]\x20[Drop]','Agent','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialAgiAfterHangupAgent','getCaller','XMD-AMDINITIALSILENCE','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','TrunkBackup','dialOriginateCallerIdName','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','variables','SIP/%s/%s%s','dialPrefix','substring','dialCutDigit','trim','from-sip','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','checkRetriveMax','[rescheduleContact][NoAnswer]','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','object','reason','outboundNoSuchCallsDay','NoSuchNumber','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyRetryFrequency','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','avgHandleTime','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','agentBusyFactor','one\x20call\x20every:','milliseconds','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','checkIsBlackListIvr','[actionOriginateIvr]','[handleIvr]','[getContactCampaign2]','dialLimitQueue','not_inuse','countReScheduled','[countReScheduled]\x20','[actionOriginate]\x20','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','getContactDialer','checkContactLowerLimitOriginate','Contact','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','interval\x20=\x20','Amax\x20=\x20','busyFactor','----\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','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Ts\x20=\x20','p\x20=\x20','Umin\x20=\x20','erlangb','util','uuid','ioredis','./utils','./utils/hopper','../../../config/environment/','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/voiceQueueRt','../rpc/setting','../rpc/interval','./models/history','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','startProgressive','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','originateresponse','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','getSettings','previewRecallmeReminderInterval','emit','type','outbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalTotalCalls','isUndefined','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','message','state','statedesc','endtime','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','stringify','pick','Interval','NULL_INTERVAL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','isIVRCampaignActive','isIVRCampaign','campaign:save','originated','sendMessageOneNotActive','INACTIVE','is\x20not\x20active','DISACTIVED','is\x20deactivated','[ifTime][Action]','Error','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','checkIfTime','checkIfTimeIntervals','ifTimeIvr','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','then','content','true','catch','all','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','dialMethod','progressive','handlePower','power','booked','Queue','method\x20not\x20recognized','dialTimezone','Dialer::ifTime()'];(function(_0x3563fc,_0x73403c){var _0x40bb72=function(_0x3882be){while(--_0x3882be){_0x3563fc['push'](_0x3563fc['shift']());}};_0x40bb72(++_0x73403c);}(_0xb66c,0x175));var _0xcb66=function(_0x90db76,_0x2ed8ff){_0x90db76=_0x90db76-0x0;var _0x1bb292=_0xb66c[_0x90db76];return _0x1bb292;};'use strict';var util=require(_0xcb66('0x0'));var _=require('lodash');var uuid=require(_0xcb66('0x1'));var moment=require('moment');var rr=require('rr');var Redis=require(_0xcb66('0x2'));var utils=require(_0xcb66('0x3'));var hopperUtils=require(_0xcb66('0x4'));var ut=require('../preview/util/util');var config=require(_0xcb66('0x5'));var logger=require(_0xcb66('0x6'))(_0xcb66('0x7'));var loggerBooked=require(_0xcb66('0x6'))('booked');var loggerPredictive=require('../../../config/logger')(_0xcb66('0x8'));var loggerPredictiveCalls=require(_0xcb66('0x6'))(_0xcb66('0x9'));var loggerSyncQueueSummary=require(_0xcb66('0x6'))(_0xcb66('0xa'));var ami=require('../ami');config[_0xcb66('0xb')]=_[_0xcb66('0xc')](config[_0xcb66('0xb')],{'host':_0xcb66('0xd'),'port':0x18eb});var io=require(_0xcb66('0xe'))(new Redis(config['redis']));var cmHopper=require(_0xcb66('0xf'));var voiceQueueRt=require(_0xcb66('0x10'));var RpcSetting=require(_0xcb66('0x11'));var Interval=require(_0xcb66('0x12'));var Action=require('./models/action');var History=require(_0xcb66('0x13'));var Final=require(_0xcb66('0x14'));var AgentComplete=require(_0xcb66('0x15'));var QueueCallerAbandon=require(_0xcb66('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0xcb66('0x17')][_0xcb66('0x18')]||_0xcb66('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0xcb66('0x1a')]['enqueue']=function(_0x19072b){this['tail']=this[_0xcb66('0x1b')]?this['tail'][_0xcb66('0x1c')](_0x19072b):_0x19072b();};function Dialer(_0x573dc7,_0x4bef09){this[_0xcb66('0x1d')]=new Sequence();this[_0xcb66('0x1e')]=_0x4bef09;this[_0xcb66('0x1f')]=_0x573dc7[_0xcb66('0x1f')];this['campaigns']=_0x573dc7[_0xcb66('0x20')];this[_0xcb66('0x21')]=_0x573dc7[_0xcb66('0x21')];this['trunks']=_0x573dc7[_0xcb66('0x22')];this['maxNumberOriginate']=config[_0xcb66('0x23')]||0x2;this[_0xcb66('0x24')]={};this[_0xcb66('0x25')]={};this[_0xcb66('0x26')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0xcb66('0x27')]={};this['ivrOriginated']={};this['queueBooked']={};this[_0xcb66('0x28')]={};this['queuesSummary']={};ami['on'](_0xcb66('0x29'),this[_0xcb66('0x2a')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x2c'),this[_0xcb66('0x2d')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x2e'),this['syncOriginateResponse'][_0xcb66('0x2b')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x2f'),this[_0xcb66('0xa')]['bind'](this));ami['on'](_0xcb66('0x30'),this[_0xcb66('0x31')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x32'),this['syncHangup'][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x33'),this[_0xcb66('0x34')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x35'),this[_0xcb66('0x36')][_0xcb66('0x2b')](this));ami['on'](_0xcb66('0x37'),this[_0xcb66('0x38')][_0xcb66('0x2b')](this));ami['on']('queuestatuscomplete',this[_0xcb66('0x39')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();RpcSetting[_0xcb66('0x3a')]()['then'](function(_0xb135e3){previewRecallmeReminderInterval=_0xb135e3[_0xcb66('0x3b')];});}function isNotNull(_0x1b8a79){return _0x1b8a79!==null&&!_['isUndefined'](_0x1b8a79);}function msgResponse(_0x123787,_0x1df50e,_0x266862){return{'action':_0x123787,'response':_0x1df50e,'message':_0x266862,'stack':_0x266862};}function emit(_0x311ede,_0xa411e3,_0x375636){io['to'](_0x311ede)[_0xcb66('0x3c')](_0xa411e3,_0x375636);}function emitOutboundVoiceQueueSummary(_0x36dfe3){if(_0x36dfe3[_0xcb66('0x3d')]===_0xcb66('0x3e')){logger['debug'](_0xcb66('0x3f'),util[_0xcb66('0x40')](_0x36dfe3,{'showHidden':![],'depth':null}));emit(util[_0xcb66('0x41')](_0xcb66('0x42'),_0x36dfe3[_0xcb66('0x43')]),_0xcb66('0x44'),_0x36dfe3);}}function checkGetDataPredictive(_0xec4052){if(isNotNull(_0xec4052)&&!_['isEmpty'](_0xec4052)){loggerPredictive[_0xcb66('0x45')](_0xcb66('0x46'));loggerPredictive[_0xcb66('0x45')](_0xcb66('0x47'),_0xec4052['predictiveIntervalTotalCalls']);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x48'),_0xec4052[_0xcb66('0x49')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x4a'),_0xec4052[_0xcb66('0x4b')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x4c'),_0xec4052[_0xcb66('0x4d')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x4e'),_0xec4052[_0xcb66('0x4f')]);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xec4052['predictiveIntervalAvgTalktime']);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));if(_0xec4052[_0xcb66('0x51')]>0x0){if(!_[_0xcb66('0x52')](_0xec4052[_0xcb66('0x53')])&&_0xec4052[_0xcb66('0x53')]>0x0){return!![];}loggerPredictive['info'](_0xcb66('0x54'));if(!_['isUndefined'](_0xec4052['predictiveIntervalAvgHoldtime'])&&_0xec4052['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0xcb66('0x45')](_0xcb66('0x55'));}else{loggerPredictive[_0xcb66('0x45')](_0xcb66('0x56'));}}else{loggerPredictive[_0xcb66('0x45')](_0xcb66('0x57'));}return![];}function mergeDataErlangB(_0x3422b6){return function(_0x1c119e){loggerPredictive[_0xcb66('0x45')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xcb66('0x45')](_0xcb66('0x58'),_0x1c119e[_0xcb66('0x59')]);loggerPredictive['info'](_0xcb66('0x5a'),_0x1c119e[_0xcb66('0x5b')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c119e[_0xcb66('0x5c')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1c119e[_0xcb66('0x5d')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x5e'),_0x1c119e[_0xcb66('0x5c')]);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));_[_0xcb66('0x5f')](_0x3422b6,_0x1c119e);};}function ifInterval(_0xff5ce5,_0x1b8f2e){if(_['isUndefined'](_0x1b8f2e)){return![];}return utils['getSeconds'](undefined,_0x1b8f2e)<_0xff5ce5*0x3c;}function clearPredictiveAttributes(_0x4e364d){if(_0x4e364d[_0xcb66('0x27')]){_0x4e364d['startProgressive']=undefined;loggerPredictive[_0xcb66('0x60')](_0x4e364d['name'],_0xcb66('0x61'));}if(_0x4e364d[_0xcb66('0x62')]){_0x4e364d[_0xcb66('0x62')]=undefined;loggerPredictive[_0xcb66('0x60')](_0x4e364d[_0xcb66('0x43')],_0xcb66('0x63'));}if(_0x4e364d['handlePredictive']){clearInterval(_0x4e364d['handlePredictive']);_0x4e364d[_0xcb66('0x64')]=undefined;loggerPredictive[_0xcb66('0x60')](_0x4e364d[_0xcb66('0x43')],_0xcb66('0x65'));}}function loggerCatchPredictive(_0xf2c532,_0x1c149b){return function(_0x1465df){loggerPredictive[_0xcb66('0x66')](_0x1c149b[_0xcb66('0x43')],_0xf2c532);loggerPredictive['error'](_0x1465df[_0xcb66('0x67')]);clearPredictiveAttributes(_0x1c149b);};}function loggerCatch(_0x29dd1f){return function(_0x4370ff){logger[_0xcb66('0x66')](_0x29dd1f,util['inspect'](_0x4370ff,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x18ec73){return function(_0x2f9fb5){if(isNotNull(_0x2f9fb5)&&isNotNull(_0x2f9fb5[0x0])){if(_0x2f9fb5[0x0][_0xcb66('0x68')]>0x0){_0x18ec73['message']=utils[_0xcb66('0x69')][_0xcb66('0x6a')];logger[_0xcb66('0x45')](_0xcb66('0x6b')+_0x18ec73['name'],_0x2f9fb5[0x0][_0xcb66('0x68')],_0xcb66('0x6c'));}else{_0x18ec73[_0xcb66('0x6d')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0xcb66('0x45')]('[getContactDialer2][Empty]'+_0x18ec73[_0xcb66('0x43')]);}}};}function createObjHistory(_0x55c6e4,_0x184653,_0x416448,_0x1bb017,_0x5c07c3){_0x55c6e4[_0xcb66('0x6d')]=_0x416448;var _0x5f01a2=new Action(_0x55c6e4,_0x184653);var _0x228504=new History(_0x5f01a2);_0x228504[_0xcb66('0x6e')]=_0x1bb017;_0x228504[_0xcb66('0x6f')]=_0x5c07c3;_0x228504[_0xcb66('0x70')]=_0x5f01a2[_0xcb66('0x71')];return _0x228504;}function unlockQueueStatus(_0x5369f8,_0x9017f4){setTimeout(function(){if(_['isUndefined'](_0x5369f8[_0xcb66('0x72')])){loggerBooked[_0xcb66('0x66')](_0xcb66('0x73'),_0x9017f4);}_0x5369f8['queueStatusComplete']=!![];loggerBooked['info']('[booked][unlockQueueStatus]',_0x9017f4,JSON[_0xcb66('0x74')](_[_0xcb66('0x75')](_0x5369f8,[_0xcb66('0x43'),_0xcb66('0x72')])));},0x1f3);}function checkInterval(_0x196ffe){return function(){if(!isNotNull(_0x196ffe[_0xcb66('0x76')])){_0x196ffe[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x77')];throw _0x196ffe[_0xcb66('0x43')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x196ffe[_0xcb66('0x76')][_0xcb66('0x78')])){_0x196ffe[_0xcb66('0x6d')]=utils[_0xcb66('0x69')]['NULL_INTERVAL'];throw _0x196ffe['name']+_0xcb66('0x79');}if(!isNotNull(_[_0xcb66('0x7a')](_0x196ffe[_0xcb66('0x76')][_0xcb66('0x78')]))){_0x196ffe[_0xcb66('0x6d')]=utils[_0xcb66('0x69')]['NULL_INTERVAL'];throw _0x196ffe[_0xcb66('0x43')]+_0xcb66('0x79');}};}function checkIsIVRCampaignActive(_0x83b627){return function(){if(!utils[_0xcb66('0x7b')](_0x83b627)){_0x83b627['message']=utils[_0xcb66('0x69')]['INACTIVE'];throw _0x83b627[_0xcb66('0x43')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x11e42d){if(utils[_0xcb66('0x7c')](_0x11e42d)){emit(util[_0xcb66('0x41')]('campaign:ivr:%s',_0x11e42d['name']),_0xcb66('0x7d'),_0x11e42d);}}function loggerCatchQueueSummary(_0x3ebc9a,_0x55ab08){return function(_0x557819){clearPredictiveAttributes(_0x55ab08);emitCampaignSummary(_0x55ab08);loggerSyncQueueSummary[_0xcb66('0x60')](_0x3ebc9a,util['inspect'](_0x557819,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3c9106){if(_0x3c9106['sendMessageOneNotActive']){if(_0x3c9106[_0xcb66('0x7e')]===0x0){_0x3c9106[_0xcb66('0x7f')]=![];_0x3c9106[_0xcb66('0x6d')]=utils['CAMPAIGN_STATUS'][_0xcb66('0x80')];loggerSyncQueueSummary[_0xcb66('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3c9106[_0xcb66('0x43')],_0xcb66('0x81'));}else{_0x3c9106[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x82')];loggerSyncQueueSummary[_0xcb66('0x60')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x3c9106[_0xcb66('0x43')],_0xcb66('0x83'));}emitCampaignSummary(_0x3c9106);}}function myreject(_0x20466b){return function(_0x22438d){return _0x20466b(msgResponse(_0xcb66('0x84'),_0xcb66('0x85'),JSON[_0xcb66('0x74')](_0x22438d)));};}Dialer[_0xcb66('0x1a')][_0xcb66('0x86')]=function(_0x4ac2d1){return!_[_0xcb66('0x52')](_0x4ac2d1)&&_0x4ac2d1&&!_[_0xcb66('0x52')](_0x4ac2d1[_0xcb66('0x43')])&&!_[_0xcb66('0x52')](_0x4ac2d1[_0xcb66('0x87')])&&_0x4ac2d1[_0xcb66('0x87')]&&(this['trunks'][util[_0xcb66('0x41')](_0xcb66('0x88'),_0x4ac2d1['name'])][_0xcb66('0x89')]===_0xcb66('0x8a')||this[_0xcb66('0x22')][util[_0xcb66('0x41')]('SIP/%s',_0x4ac2d1[_0xcb66('0x43')])][_0xcb66('0x89')]===_0xcb66('0x8b'));};Dialer[_0xcb66('0x1a')][_0xcb66('0x8c')]=function(_0x16dc20){var _0x265534=this;return function(){if(!_0x265534[_0xcb66('0x86')](_0x16dc20[_0xcb66('0x8d')])){if(!_0x265534[_0xcb66('0x86')](_0x16dc20['TrunkBackup'])){_0x16dc20[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x8e')];throw _0x16dc20[_0xcb66('0x43')]+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0xcb66('0x1a')][_0xcb66('0x8f')]=function(_0x3f2605,_0x1c0533,_0x183381,_0x30d02f){var _0x185363=this;return function(){var _0x49f0b7=!![];return _0x185363['ifTimeIvr'](_0x3f2605,_0x1c0533,_0x183381,_0x30d02f,_0x49f0b7);};};Dialer[_0xcb66('0x1a')][_0xcb66('0x90')]=function(_0x17782a,_0x43fb09,_0xaef77,_0x11072c){var _0x5678a3=this;return function(){var _0x166372=![];return _0x5678a3[_0xcb66('0x91')](_0x17782a[_0xcb66('0x78')],_0x43fb09,_0xaef77,_0x11072c,_0x166372);};};Dialer[_0xcb66('0x1a')][_0xcb66('0x91')]=function(_0x16e0ec,_0x5eb8a8,_0x3bf094,_0x28b205,_0x28ad40){var _0x1fc4ac=[];return new Promise(function(_0xfddd73,_0x37051c){if(!isNotNull(_0x16e0ec)){_0x28b205[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x77')];return _0x37051c(msgResponse(_0xcb66('0x92'),_0xcb66('0x93'),_0x3bf094+_0xcb66('0x94')));}if(_[_0xcb66('0x7a')](_0x16e0ec)){_0x28b205[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x95')];return _0x37051c(msgResponse(_0xcb66('0x92'),_0xcb66('0x93'),_0x3bf094+_0xcb66('0x96')));}if(_0x5eb8a8&&_['isUndefined'](config[_0xcb66('0x97')][_0x5eb8a8])){_0x28b205['message']=utils[_0xcb66('0x69')]['UNKNOWN_TIMEZONE'];return _0x37051c(msgResponse(_0xcb66('0x92'),_0xcb66('0x93'),_0x3bf094+_0xcb66('0x98')+_0x5eb8a8));}if(_[_0xcb66('0x99')](_0x16e0ec)){for(var _0x1e13f0=0x0;_0x1e13f0<_0x16e0ec[_0xcb66('0x9a')];_0x1e13f0+=0x1){_0x1fc4ac[_0xcb66('0x9b')](ami[_0xcb66('0x9c')]({'action':_0xcb66('0x9d'),'command':util[_0xcb66('0x41')](_0xcb66('0x9e'),_0x16e0ec[_0x1e13f0][_0xcb66('0x9f')],!_[_0xcb66('0x52')](config['timezones'][_0x5eb8a8])?_0x5eb8a8:'')})[_0xcb66('0xa0')](function(_0x45b25e){return _0x45b25e[_0xcb66('0xa1')]['indexOf'](_0xcb66('0xa2'))>=0x0;})[_0xcb66('0xa3')](myreject(_0x37051c)));}}else{_0x1fc4ac[_0xcb66('0x9b')](ami['Action']({'action':_0xcb66('0x9d'),'command':util[_0xcb66('0x41')](_0xcb66('0x9e'),_0x16e0ec,!_[_0xcb66('0x52')](config[_0xcb66('0x97')][_0x5eb8a8])?_0x5eb8a8:'')})[_0xcb66('0xa0')](function(_0x49fe07){return _0x49fe07[_0xcb66('0xa1')]['indexOf'](_0xcb66('0xa2'))>=0x0;})['catch'](myreject(_0x37051c)));}Promise[_0xcb66('0xa4')](_0x1fc4ac)['then'](function(_0x3b4c30){var _0x20fb30=_[_0xcb66('0xa5')](_0x3b4c30);if(_0x20fb30){return _0xfddd73(_0x20fb30);}else{_0x28b205['message']=_0x28ad40?utils[_0xcb66('0x69')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0xcb66('0x69')][_0xcb66('0xa6')];return _0x37051c(msgResponse(_0xcb66('0xa7'),_0xcb66('0x93'),_0xcb66('0xa8')+_0x28ad40+'\x20'+_0x3bf094+'\x20Interval\x20is\x20overtime:\x20'+util[_0xcb66('0x40')](_0x16e0ec,{'showHidden':![],'depth':null})+_0xcb66('0xa9')+_0x5eb8a8));}})[_0xcb66('0xa3')](function(_0x456bea){return _0x37051c(msgResponse('ifTime',_0xcb66('0x93'),JSON[_0xcb66('0x74')](_0x456bea)));});});};Dialer['prototype'][_0xcb66('0xaa')]=function(){var _0x30b941=this;return cmHopper[_0xcb66('0xab')]({'active':![]},{'where':{'active':!![]}})[_0xcb66('0xa0')](function(){setInterval(function(){_0x30b941['syncCampaigns']();},0x3e8);});};Dialer[_0xcb66('0x1a')][_0xcb66('0xac')]=function(){var _0x2a7063=this;var _0x25ae78;for(var _0x2f6d70 in this['campaigns']){if(typeof this[_0xcb66('0x20')][_0x2f6d70]!==_0xcb66('0xad')){_0x25ae78=this[_0xcb66('0x20')][_0x2f6d70];if(utils[_0xcb66('0x7c')](_0x25ae78)&&utils[_0xcb66('0x7b')](_0x25ae78)){_0x25ae78[_0xcb66('0x7f')]=!![];Promise[_0xcb66('0xae')]()['then'](checkIsIVRCampaignActive(_0x25ae78))['then'](checkInterval(_0x25ae78))['then'](_0x2a7063[_0xcb66('0x8c')](_0x25ae78))[_0xcb66('0xa0')](_0x2a7063['checkIfTime'](_0x25ae78[_0xcb66('0xaf')],_0x25ae78['dialTimezone'],_0x25ae78[_0xcb66('0x43')],_0x25ae78))[_0xcb66('0xa0')](_0x2a7063[_0xcb66('0x90')](_0x25ae78[_0xcb66('0x76')],_0x25ae78['dialTimezone'],_0x25ae78[_0xcb66('0x43')],_0x25ae78))[_0xcb66('0xa0')](_0x2a7063[_0xcb66('0xb0')](_0x25ae78))[_0xcb66('0xa3')](loggerCatchQueueSummary(_0xcb66('0xb1'),_0x25ae78));}else{notSendMessagesCampaign(_0x25ae78);}}}};Dialer['prototype']['checkDialMethod']=function(_0x198c13){if(_0x198c13['dialMethod']!==_0xcb66('0x8')){clearPredictiveAttributes(_0x198c13);}switch(_0x198c13[_0xcb66('0xb2')]){case _0xcb66('0xb3'):this[_0xcb66('0xb4')](_0x198c13,0x1);break;case _0xcb66('0xb5'):this[_0xcb66('0xb4')](_0x198c13,_0x198c13['dialPowerLevel']);break;case _0xcb66('0x8'):this['predictive'](_0x198c13);break;case _0xcb66('0xb6'):this[_0xcb66('0xb4')](_0x198c13,0x1);break;default:logger[_0xcb66('0x66')](_0xcb66('0xb7'),_0x198c13[_0xcb66('0x43')],_0xcb66('0xb8'));}};Dialer['prototype'][_0xcb66('0x92')]=function(_0x2b73e3,_0x3980fa){var _0x2803d1=_0x2b73e3[_0xcb66('0xb9')];var _0x3f92c5=_0x3980fa?_0x2b73e3[_0xcb66('0xaf')]:_0x2b73e3[_0xcb66('0x76')]['Intervals'];logger['silly'](_0xcb66('0xba'),_0x3f92c5,_0x2803d1,_0x2b73e3[_0xcb66('0x43')],util['format'](_0xcb66('0xbb'),_0x2b73e3[_0xcb66('0x43')],_0x2b73e3['id']));var _0x5e6799=null;return Interval[_0xcb66('0xbc')](_0x3f92c5,_0x2803d1)['then'](function(_0x2c7884){if(_0x2c7884===!![]){return _0x2c7884;}else{_0x2b73e3[_0xcb66('0x6d')]=_0x3980fa?utils[_0xcb66('0x69')][_0xcb66('0xbd')]:utils[_0xcb66('0x69')]['OVERTIME_INTERVAL'];_0x5e6799=msgResponse('[ifTime][promiseAll]',_0xcb66('0x93'),_0xcb66('0xa8')+_0x3980fa+'\x20'+_0x2b73e3[_0xcb66('0x43')]+_0xcb66('0xbe')+util[_0xcb66('0x40')](_0x3f92c5,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x2803d1);}if(_0x5e6799!==null){logger[_0xcb66('0xbf')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x5e6799);_0x5e6799['isGlobal']=_0x3980fa;throw _0x5e6799;}})[_0xcb66('0xa3')](function(_0x565f6c){logger['error'](_0xcb66('0xc0'),_0x565f6c);throw msgResponse(_0xcb66('0x84'),'Error',util[_0xcb66('0x40')](_0x565f6c,{'showHidden':![],'depth':null}));});};Dialer[_0xcb66('0x1a')][_0xcb66('0x2a')]=function(_0x3acdeb){if(this[_0xcb66('0x1f')][_0x3acdeb[_0xcb66('0xc1')]]){if(this[_0xcb66('0xc2')][_0x3acdeb[_0xcb66('0xc3')]]&&this[_0xcb66('0xc2')][_0x3acdeb[_0xcb66('0xc3')]][_0xcb66('0x3d')]!=='ivr'){utils['decrementOriginate'](this[_0xcb66('0x1f')][_0x3acdeb[_0xcb66('0xc1')]],_0xcb66('0xc4'));this[_0xcb66('0xc2')][_0x3acdeb[_0xcb66('0xc3')]][_0xcb66('0xc5')]=moment()[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xcb66('0x1a')]['syncAgentComplete']=function(_0x4f30c2){var _0x590640=this[_0xcb66('0xc2')][_0x4f30c2[_0xcb66('0xc3')]];if(this[_0xcb66('0x1f')][_0x4f30c2['queue']]){if(_0x590640&&_0x590640[_0xcb66('0x3d')]!=='ivr'){delete this['uniqueId'][_0x4f30c2[_0xcb66('0xc3')]];this[_0xcb66('0x1f')][_0x4f30c2[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;var _0x2668f2=new AgentComplete(_0x590640,_0x4f30c2);if(_0x4f30c2['reason']===_0xcb66('0xc7')){_0x2668f2[_0xcb66('0xc8')]=this[_0xcb66('0x1f')][_0x4f30c2[_0xcb66('0xc1')]][_0xcb66('0xc9')]&&this[_0xcb66('0x1f')][_0x4f30c2[_0xcb66('0xc1')]]['dialAgiAfterHangupAgent']?moment()[_0xcb66('0x41')](_0xcb66('0xca')):undefined;}hopperUtils[_0xcb66('0xcb')](_0x2668f2)['catch'](loggerCatch(_0xcb66('0xcc')));hopperUtils[_0xcb66('0xcd')](_0x2668f2)['catch'](loggerCatch(_0xcb66('0xce')));}}};Dialer[_0xcb66('0x1a')][_0xcb66('0x2d')]=function(_0x4eef77){var _0x2b398b=this[_0xcb66('0xc2')][_0x4eef77[_0xcb66('0xc3')]];var _0x20870d=this;var _0x25f06c=![];var _0x5b2e1d;var _0x1a175a;if(this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]]){if(_0x2b398b&&_0x2b398b[_0xcb66('0x3d')]!==_0xcb66('0xcf')){delete this[_0xcb66('0xc2')][_0x4eef77['uniqueid']];utils['decrementOriginate'](this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]],_0xcb66('0xd0'));_0x2b398b[_0xcb66('0xd1')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));var _0x5d84cb=new QueueCallerAbandon(_0x2b398b,_0x4eef77);if(utils[_0xcb66('0xd2')](_0x2b398b[_0xcb66('0xd1')],_0x2b398b[_0xcb66('0xd3')])>=_0x2b398b[_0xcb66('0xd4')]){this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0x4b')]+=0x1;this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xd5')]+=0x1;this[_0xcb66('0x1f')][_0x4eef77['queue']][_0xcb66('0xd6')]+=0x1;_0x5d84cb[_0xcb66('0x6e')]=0xa;_0x5d84cb['statedesc']='Drop';_0x5d84cb[_0xcb66('0xd7')]=_0xcb66('0xd8');_0x5d84cb[_0xcb66('0xc8')]=this['voiceQueues'][_0x4eef77['queue']][_0xcb66('0xc9')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x5d84cb[_0xcb66('0xd9')]+=0x1;_0x5d84cb['countglobal']+=0x1;_0x5b2e1d=this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xda')];_0x1a175a=this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xdb')];hopperUtils[_0xcb66('0xdc')](_0x5d84cb,_0x5d84cb[_0xcb66('0x6e')],_0x2b398b[_0xcb66('0xdd')])['then'](function(_0x12f0b3){_0x25f06c=_0x12f0b3[_0xcb66('0xde')]==0x1;if(_0x5d84cb[_0xcb66('0xd9')]>=_0x20870d[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xdf')]){_0x20870d[_0xcb66('0xe0')](_0x5d84cb,_0x12f0b3[_0xcb66('0xde')]);}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countdropretry':_0x5d84cb[_0xcb66('0xd9')],'scheduledat':moment()[_0xcb66('0xe2')](_0x20870d[_0xcb66('0x1f')][_0x4eef77['queue']][_0xcb66('0xda')],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0x2b398b[_0xcb66('0xe4')],'ListId':_0x2b398b[_0xcb66('0xe5')],'VoiceQueueId':_0x2b398b['VoiceQueueId']||undefined,'CampaignId':_0x2b398b['CampaignId']||undefined})['catch'](loggerCatch(_0xcb66('0xe6')));var _0x5ab121=new History(_0x5d84cb);_0x5ab121['state']=0xa;_0x5ab121[_0xcb66('0x6f')]=_0xcb66('0xe7');_0x5ab121[_0xcb66('0x71')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));_0x5ab121[_0xcb66('0x70')]=_0x5ab121[_0xcb66('0x71')];_0x5ab121[_0xcb66('0xe8')]=_0x5d84cb['calleridname'];_0x5ab121[_0xcb66('0xe9')]=_0x5d84cb[_0xcb66('0xe9')];hopperUtils[_0xcb66('0xcb')](_0x5ab121)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0xea')));}})[_0xcb66('0xa0')](function(){if(_0x25f06c)hopperUtils[_0xcb66('0xeb')](_0x5d84cb,_0x5b2e1d,_0x1a175a)[_0xcb66('0xa0')](function(){return 0x1;});});}else{this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0x4d')]+=0x1;this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xec')]+=0x1;_0x5d84cb[_0xcb66('0x6e')]=0xb;_0x5d84cb[_0xcb66('0x6f')]=_0xcb66('0xed');_0x5d84cb[_0xcb66('0xd7')]='CALLEREXIT';_0x5d84cb[_0xcb66('0xee')]+=0x1;_0x5d84cb[_0xcb66('0xef')]+=0x1;_0x5b2e1d=this['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xf0')];_0x1a175a=this[_0xcb66('0x1f')][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xdb')];hopperUtils[_0xcb66('0xdc')](_0x5d84cb,_0x5d84cb[_0xcb66('0x6e')],_0x2b398b['voiceQueue'])[_0xcb66('0xa0')](function(_0x55f652){if(_0x5d84cb['countabandonedretry']>=_0x20870d['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xf1')]){_0x20870d[_0xcb66('0xe0')](_0x5d84cb,_0x55f652[_0xcb66('0xde')]);}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countabandonedretry':_0x5d84cb[_0xcb66('0xee')],'scheduledat':moment()[_0xcb66('0xe2')](_0x20870d['voiceQueues'][_0x4eef77[_0xcb66('0xc1')]][_0xcb66('0xf0')],_0xcb66('0xe3'))[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b398b[_0xcb66('0xe4')],'ListId':_0x2b398b['ListId'],'VoiceQueueId':_0x2b398b['VoiceQueueId']||undefined,'CampaignId':_0x2b398b[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x459977=new History(_0x5d84cb);_0x459977[_0xcb66('0x6e')]=0xb;_0x459977[_0xcb66('0x6f')]=_0xcb66('0xed');_0x459977['starttime']=moment()[_0xcb66('0x41')](_0xcb66('0xca'));_0x459977[_0xcb66('0x70')]=_0x459977[_0xcb66('0x71')];_0x459977['calleridname']=_0x5d84cb[_0xcb66('0xe8')];_0x459977['calleridnum']=_0x5d84cb[_0xcb66('0xe9')];hopperUtils[_0xcb66('0xcb')](_0x459977)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})['then'](function(){if(_0x25f06c)hopperUtils[_0xcb66('0xeb')](_0x5d84cb,_0x5b2e1d,_0x1a175a)[_0xcb66('0xa0')](function(){return 0x1;});});}}}};Dialer['prototype'][_0xcb66('0x34')]=function(_0x2b8f94){if(this['actions'][_0x2b8f94[_0xcb66('0xc3')]]){this[_0xcb66('0x25')][_0x2b8f94[_0xcb66('0xc3')]][_0xcb66('0xf3')]=_0x2b8f94[_0xcb66('0xf3')];}if(this[_0xcb66('0xc2')][_0x2b8f94[_0xcb66('0xc3')]]){this[_0xcb66('0xc2')][_0x2b8f94['uniqueid']][_0xcb66('0xf3')]=_0x2b8f94[_0xcb66('0xf3')];}};Dialer[_0xcb66('0x1a')][_0xcb66('0x38')]=function(_0x22c74e){if(!this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]]){return;}var _0x5b8d8d=this[_0xcb66('0x1f')][this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]]['strategy']||'rrmemory';if(_0x5b8d8d===_0xcb66('0xf5')){if(this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]]&&_[_0xcb66('0xf6')](this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xf7')])&&_0x22c74e[_0xcb66('0x89')]==='1'&&_0x22c74e[_0xcb66('0xf8')]==='0'){if(this[_0xcb66('0x21')][_0x22c74e[_0xcb66('0xf9')]]){if(!this[_0xcb66('0x21')][_0x22c74e['stateinterface']]['locked']){this['agents'][_0x22c74e[_0xcb66('0xf9')]][_0xcb66('0xf7')]=!![];this[_0xcb66('0x25')][_0x22c74e['actionid']][_0xcb66('0xf7')]=!![];this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xf9')]=_0x22c74e['stateinterface'];}}}}else if(_0x5b8d8d==='rrmemory'){if(this[_0xcb66('0x25')][_0x22c74e['actionid']]){if(this[_0xcb66('0x21')][_0x22c74e[_0xcb66('0xf9')]]){this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xf9')]=_0x22c74e[_0xcb66('0xf9')];if(_[_0xcb66('0xf6')](this['queueBooked'][this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]])){this[_0xcb66('0xfa')][this['actions'][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]]=[];}this[_0xcb66('0xfa')][this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]][_0xcb66('0xc1')]][_0xcb66('0x9b')](_[_0xcb66('0x5f')](_[_0xcb66('0x75')](this[_0xcb66('0x25')][_0x22c74e[_0xcb66('0xf4')]],['idHopper',_0xcb66('0xf9')]),{'status':_0x22c74e[_0xcb66('0x89')],'paused':_0x22c74e[_0xcb66('0xf8')]}));}}}};Dialer[_0xcb66('0x1a')][_0xcb66('0x39')]=function(_0x6d4f38){if(!this['actions'][_0x6d4f38[_0xcb66('0xf4')]]){return;}var _0xf593ec=this;var _0x53a4d1=this[_0xcb66('0x1f')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]]['queue']];var _0x4ef54f=_0x53a4d1[_0xcb66('0xfb')]||_0xcb66('0xfc');if(_0x4ef54f==='roundrobin'){if(this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]]&&this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xf9')]){this['preview'][_0xcb66('0xfd')](this[_0xcb66('0x25')][_0x6d4f38['actionid']][_0xcb66('0xfe')],this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xf9')])[_0xcb66('0xa3')](function(_0x46eb02){logger['error'](_0xcb66('0xff'),util['inspect'](_0x46eb02,{'showHidden':![],'depth':null}));})[_0xcb66('0x1c')](function(){utils[_0xcb66('0x100')](_0xf593ec['voiceQueues'][_0xf593ec[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]],'[syncQueueStatusComplete]');_0xf593ec[_0xcb66('0x21')][_0xf593ec[_0xcb66('0x25')][_0x6d4f38['actionid']][_0xcb66('0xf9')]][_0xcb66('0xf7')]=![];delete _0xf593ec[_0xcb66('0x25')][_0x6d4f38['actionid']];unlockQueueStatus(_0x53a4d1);});}else{utils[_0xcb66('0x100')](this[_0xcb66('0x1f')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]],_0xcb66('0x101'));hopperUtils[_0xcb66('0xe1')]({'active':![],'ContactId':this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xe4')],'ListId':this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xe5')],'VoiceQueueId':this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0x102')]||undefined,'CampaignId':this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0xcb66('0x25')][_0x6d4f38['actionid']];unlockQueueStatus(_0x53a4d1);}}else if(_0x4ef54f===_0xcb66('0xfc')){var _0x14d72b;if(this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]]&&!_[_0xcb66('0x7a')](this[_0xcb66('0xfa')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]])){if(this[_0xcb66('0x28')][_0xf593ec['actions'][_0x6d4f38[_0xcb66('0xf4')]]['queue']]){this['queueBookedRR'][_0xf593ec[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]=this[_0xcb66('0x28')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]?this['queueBookedRR'][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]:this[_0xcb66('0xfa')][this[_0xcb66('0x25')][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]]?this[_0xcb66('0xfa')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]][_0xcb66('0x103')]||0x0:0x0;}this[_0xcb66('0xfa')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]]['queue']][_0xcb66('0x103')]=this[_0xcb66('0x28')][this['actions'][_0x6d4f38[_0xcb66('0xf4')]][_0xcb66('0xc1')]];for(var _0xe99299=0x0;_0xe99299=_0x4a719a[_0xcb66('0x12b')]){_0x7290b5[_0xcb66('0x12c')](_0x5c5b35,_0x42684a,_0x2cb3b3,_0xcb66('0x12d'));}else{if(_0x5c5b35[_0xcb66('0x125')]>=_0x4a719a[_0xcb66('0x12e')]){_0x7290b5['createStateFinal'](_0x5c5b35,_0x42684a,_0x2cb3b3,'reason\x2019\x20machine....');}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countmachineretry':_0x5c5b35['countmachineretry'],'scheduledat':moment()[_0xcb66('0xe2')](_0x4a719a[_0xcb66('0x12f')],'minutes')[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0x5c5b35['ContactId'],'ListId':_0x5c5b35[_0xcb66('0xe5')],'VoiceQueueId':_0x5c5b35[_0xcb66('0x102')]||undefined,'CampaignId':_0x5c5b35[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x130')));_0x42684a({'reschedule':0x1});}}});}if(_0x28727c[_0xcb66('0x3d')]===_0xcb66('0xcf')&&this['campaigns'][_0x28727c[_0xcb66('0xc1')]][_0xcb66('0x118')]&&_0xec6e1d[_0xcb66('0x119')]==='HANGUP'){delete this['uniqueId'][_0xec6e1d[_0xcb66('0xc3')]];utils['decrementOriginate'](this[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]],_0xcb66('0x11b'));_0x307f7e=new Hangup(_0x28727c,_0xec6e1d);_0x307f7e['state']=0x12;_0x307f7e[_0xcb66('0x6f')]=_0xcb66('0x11d');_0x307f7e['membername']=_0xcb66('0x11f');ami[_0xcb66('0x3c')]('custom:amd',ut[_0xcb66('0x126')](_0x307f7e,_0xcb66('0x121')));this[_0xcb66('0x122')](_0x307f7e,_0xcb66('0x131'),_0xcb66('0x132'));}if(_0x28727c[_0xcb66('0x3d')]===_0xcb66('0xcf')&&this[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]][_0xcb66('0x118')]&&_0xec6e1d['value']===_0xcb66('0x133')){return new Promise(function(_0x3757db,_0x339346){delete _0x7290b5['uniqueId'][_0xec6e1d[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](_0x7290b5[_0xcb66('0x20')][_0x28727c['queue']],_0xcb66('0x11b'));_0x7290b5[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;_0x7290b5[_0xcb66('0x20')][_0x28727c[_0xcb66('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x2a380e=_0x7290b5[_0xcb66('0x20')][_0x28727c['queue']];var _0x49ccd2=new Hangup(_0x28727c,_0xec6e1d);_0x49ccd2[_0xcb66('0x6e')]=0x13;_0x49ccd2[_0xcb66('0x6f')]=_0xcb66('0x134');_0x49ccd2[_0xcb66('0x11e')]=_0xcb66('0x11f');_0x49ccd2[_0xcb66('0x125')]+=0x1;_0x49ccd2['countglobal']+=0x1;_0x49ccd2[_0xcb66('0x121')]=!![];ami[_0xcb66('0x3c')]('custom:amd',ut[_0xcb66('0x126')](_0x49ccd2,'amd'));hopperUtils['createHistory'](_0x49ccd2)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x127')));if(_0x49ccd2[_0xcb66('0x128')]+_0x49ccd2[_0xcb66('0x129')]+_0x49ccd2[_0xcb66('0x135')]+_0x49ccd2[_0xcb66('0x136')]+_0x49ccd2[_0xcb66('0xd9')]+_0x49ccd2[_0xcb66('0xee')]+_0x49ccd2[_0xcb66('0x125')]+_0x49ccd2[_0xcb66('0x12a')]>=_0x2a380e[_0xcb66('0x12b')]){_0x7290b5['stateGlobal'](_0x49ccd2,_0x3757db,_0x339346,_0xcb66('0x12d'));}else{if(_0x49ccd2[_0xcb66('0x125')]>=_0x2a380e[_0xcb66('0x12e')]){_0x7290b5[_0xcb66('0x137')](_0x49ccd2,_0x3757db,_0x339346,_0xcb66('0x138'));}else{hopperUtils[_0xcb66('0xe1')]({'active':![],'countmachineretry':_0x49ccd2[_0xcb66('0x125')],'scheduledat':moment()[_0xcb66('0xe2')](_0x2a380e['dialMachineRetryFrequency'],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0x49ccd2[_0xcb66('0xe4')],'ListId':_0x49ccd2['ListId'],'VoiceQueueId':_0x49ccd2[_0xcb66('0x102')]||undefined,'CampaignId':_0x49ccd2[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x130')));_0x3757db({'reschedule':0x1});}}});}}};Dialer[_0xcb66('0x1a')]['syncHangup']=function(_0x5b9d36){var _0x566401=this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];var _0x119ebf;if(!_0x566401){return;}if(_0x566401[_0xcb66('0x3d')]===_0xcb66('0xcf')){delete this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](this['campaigns'][_0x566401['queue']],_0xcb66('0x139'));this[_0xcb66('0x20')][_0x566401[_0xcb66('0xc1')]][_0xcb66('0x13a')]+=0x1;if(_0x5b9d36[_0xcb66('0x13b')]===_0xcb66('0x13c')){const _0x447169=new AgentComplete(_0x566401,_0x5b9d36);_0x447169['CampaignId']=this['campaigns'][_0x566401[_0xcb66('0xc1')]]['id'];hopperUtils[_0xcb66('0xcb')](_0x447169)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x13d')));hopperUtils[_0xcb66('0xcd')](_0x447169)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x13e')));}else{_0x119ebf=new Hangup(_0x566401,_0x5b9d36);hopperUtils['createHistory'](_0x119ebf)['catch'](loggerCatch(_0xcb66('0x13f')));hopperUtils[_0xcb66('0xcd')](_0x119ebf)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x140')));}}else{if(isNotNull(this['voiceQueues'][_0x566401[_0xcb66('0xc1')]]['dialQueueProject'])){delete this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]],_0xcb66('0x139'));this['voiceQueues'][_0x566401[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]]['outboundAnswerAgiCallsDay']+=0x1;_0x119ebf=new Hangup(_0x566401,_0x5b9d36);_0x119ebf['state']=0x10;_0x119ebf[_0xcb66('0x6f')]=_0xcb66('0x141');_0x119ebf['membername']=_0xcb66('0x142');hopperUtils[_0xcb66('0xcb')](_0x119ebf)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0xcb66('0xcd')](_0x119ebf)[_0xcb66('0xa3')](loggerCatch('[syncHangupIvr]'));}else{delete this[_0xcb66('0xc2')][_0x5b9d36[_0xcb66('0xc3')]];utils[_0xcb66('0x100')](this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]],_0xcb66('0x143'));if(_0x5b9d36[_0xcb66('0x13b')]===_0xcb66('0x13c')){this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]][_0xcb66('0xc6')]+=0x1;const _0x31604a=new AgentComplete(_0x566401,_0x5b9d36);_0x31604a[_0xcb66('0x102')]=this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]]['id'];hopperUtils[_0xcb66('0xcb')](_0x31604a)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x31604a)['catch'](loggerCatch(_0xcb66('0xce')));}else{this[_0xcb66('0x1f')][_0x566401[_0xcb66('0xc1')]]['outboundUnknownCallsDay']+=0x1;_0x119ebf=new Hangup(_0x566401,_0x5b9d36);_0x119ebf[_0xcb66('0x6e')]=0xc;_0x119ebf[_0xcb66('0x6f')]=_0x5b9d36[_0xcb66('0x13b')];_0x119ebf[_0xcb66('0x11e')]='Unknown';hopperUtils[_0xcb66('0xcb')](_0x119ebf)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x144')));hopperUtils[_0xcb66('0xcd')](_0x119ebf)['catch'](loggerCatch('[syncHangup]'));}}}};Dialer[_0xcb66('0x1a')]['syncQueueSummary']=function(_0xfb644a){var _0x454967=this;if(!_0x454967[_0xcb66('0x145')][_0xfb644a['name']]){_0x454967[_0xcb66('0x145')][_0xfb644a['name']]={'running':![]};}else if(_0x454967[_0xcb66('0x145')][_0xfb644a[_0xcb66('0x43')]][_0xcb66('0x146')]===!![]){return;}else if(_0x454967[_0xcb66('0x145')][_0xfb644a[_0xcb66('0x43')]][_0xcb66('0x146')]===![]){_0x454967[_0xcb66('0x145')][_0xfb644a['name']]['running']=!![];}var _0x2c703f=_0x454967[_0xcb66('0x1f')][_0xfb644a[_0xcb66('0x43')]];var _0x5112db=_0x2c703f[_0xcb66('0x6d')]!==utils[_0xcb66('0x69')][_0xcb66('0x80')];var _0x19f853=utils[_0xcb66('0x147')](_0x2c703f);_0x2c703f['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x2c703f,_0x454967['trunks']);Promise[_0xcb66('0xae')]()['then'](function(){if(_0x2c703f[_0xcb66('0x148')]===utils[_0xcb66('0x69')][_0xcb66('0x80')]){if(_0x5112db){clearPredictiveAttributes(_0x2c703f);_0xfb644a[_0xcb66('0x62')]=undefined;_0xfb644a[_0xcb66('0x27')]=undefined;}if(_0x2c703f[_0xcb66('0x148')]===utils[_0xcb66('0x69')][_0xcb66('0x80')]){_0xfb644a[_0xcb66('0x149')]=0x0;_0xfb644a[_0xcb66('0xf8')]=0x0;_0xfb644a[_0xcb66('0x14a')]=0x0;_0xfb644a[_0xcb66('0x14b')]=0x0;_0xfb644a[_0xcb66('0x14c')]=0x0;}}else if(_0x2c703f[_0xcb66('0x148')]===utils[_0xcb66('0x69')][_0xcb66('0x14d')]&&!_0x19f853){return _0x454967[_0xcb66('0x92')](_0x2c703f,!![])[_0xcb66('0xa0')](function(){return _0x454967[_0xcb66('0x92')](_0x2c703f,![]);})[_0xcb66('0xa0')](function(){return _0x454967[_0xcb66('0x14e')](_0x2c703f);})['catch'](function(_0x5377e1){loggerSyncQueueSummary[_0xcb66('0x60')](_0xcb66('0x14f'),util[_0xcb66('0x40')](_0x5377e1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x2c703f);});}else{clearPredictiveAttributes(_0x2c703f);}})[_0xcb66('0xa0')](function(){var _0x1ca355=_0xfb644a['compareToOutboundQueue'](_0x2c703f);if(_0x1ca355||_0x2c703f[_0xcb66('0x150')]){_0x2c703f[_0xcb66('0x150')]=![];_0xfb644a['updateReportFromOutboundQueue'](_0x2c703f);Object[_0xcb66('0x151')](_0x2c703f,_0xfb644a);emitOutboundVoiceQueueSummary(_0xfb644a);}_0x454967[_0xcb66('0x145')][_0x2c703f[_0xcb66('0x43')]][_0xcb66('0x146')]=![];})[_0xcb66('0xa3')](function(_0x2a1e08){logger[_0xcb66('0x66')](_0xcb66('0x14f'),util[_0xcb66('0x40')](_0x2a1e08,{'showHidden':![],'depth':null}));_0x454967['queuesSummary'][_0x2c703f['name']][_0xcb66('0x146')]=![];});};Dialer['prototype'][_0xcb66('0x31')]=_[_0xcb66('0x152')](function(){var _0x51190a=_[_0xcb66('0x153')](this[_0xcb66('0x1f')],function(_0x2151dd){return _0x2151dd[_0xcb66('0x154')];});var _0x2b51bc=_[_0xcb66('0x153')](this[_0xcb66('0x21')],function(_0x24c5b4){return _0x24c5b4['online']&&_0x24c5b4[_0xcb66('0x89')]===_0xcb66('0x8a');});if(_0x51190a[_0xcb66('0x9a')]>0x0&&_0x2b51bc['length']>0x0){return Promise['resolve']()[_0xcb66('0xa0')](cmHopper[_0xcb66('0x155')](_[_0xcb66('0x156')](_0x51190a,'id'),previewRecallmeReminderInterval,_[_0xcb66('0x156')](_0x2b51bc,'id')))[_0xcb66('0xa0')](function(_0x2f4f75){for(var _0x4fc594=0x0;_0x4fc594<_0x2f4f75[_0xcb66('0x9a')];_0x4fc594++){var _0x5dcb2d=_0x2f4f75[_0x4fc594]['Agent'][_0xcb66('0x43')];if(_0x5dcb2d)io['to'](util[_0xcb66('0x41')](_0xcb66('0x157'),_0x5dcb2d))['emit'](_0xcb66('0x158'),{'hopper':_0x2f4f75[_0x4fc594]});}})[_0xcb66('0xa3')](function(_0x10c99f){logger[_0xcb66('0x66')](_0xcb66('0x159'),_0x10c99f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0xcb66('0x1a')][_0xcb66('0x15a')]=function(){var _0x23147e=this;setInterval(function(){_0x23147e[_0xcb66('0x15b')](_0x23147e[_0xcb66('0xc2')],_0xcb66('0x15c'));_0x23147e[_0xcb66('0x15b')](_0x23147e[_0xcb66('0x25')],_0xcb66('0x15d'));},0x32c8);};Dialer[_0xcb66('0x1a')][_0xcb66('0x15b')]=function(_0x44dce9,_0x192a6f){var _0x379c77=this;for(var _0x543d62 in _0x44dce9){if(typeof _0x44dce9[_0x543d62]!==_0xcb66('0xad')){this[_0xcb66('0x1d')][_0xcb66('0x15e')](function(){if(!_['isNil'](_0x44dce9[_0x543d62])){return ami['Action']({'action':'status','channel':_0x44dce9[_0x543d62][_0xcb66('0xf3')]})[_0xcb66('0xa3')](function(_0x19a1a2){if(_0x19a1a2[_0xcb66('0x6d')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x44dce9[_0x543d62]&&_0x44dce9[_0x543d62][_0xcb66('0x3d')]!==_0xcb66('0xcf')){utils['decrementOriginate'](_0x379c77[_0xcb66('0x1f')][_0x44dce9[_0x543d62][_0xcb66('0xc1')]],_0xcb66('0x15f'));logger['error'](_0xcb66('0x160'),_0x192a6f,_0x543d62,_0x44dce9[_0x543d62][_0xcb66('0xc1')]);delete _0x44dce9[_0x543d62];}if(_0x44dce9[_0x543d62]&&_0x44dce9[_0x543d62][_0xcb66('0x3d')]===_0xcb66('0xcf')){utils['decrementOriginate'](_0x379c77['campaigns'][_0x44dce9[_0x543d62][_0xcb66('0xc1')]],_0xcb66('0x15f'));logger[_0xcb66('0x66')](_0xcb66('0x161'),_0x192a6f,_0x543d62,_0x44dce9[_0x543d62][_0xcb66('0xc1')]);delete _0x44dce9[_0x543d62];}},0x2328);}});}});}}};Dialer[_0xcb66('0x1a')]['getVoiceQueueRtPauses']=function(_0x333048){return Promise[_0xcb66('0xae')]()['then'](voiceQueueRt[_0xcb66('0x162')](_0x333048))[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x163')));};Dialer[_0xcb66('0x1a')][_0xcb66('0x164')]=function(_0xacb3cf,_0x1aad4a,_0x262542){var _0x27a88d={'state':0x19,'statedesc':'notFound'};utils[_0xcb66('0x100')](_0x1aad4a,_0xcb66('0x165')+_0xacb3cf);this['saveInDb'](_['merge'](_0x27a88d,_[_0xcb66('0x75')](_0x262542,[_0xcb66('0xe4'),'ListId',_0xcb66('0x166'),_0xcb66('0x102'),_0xcb66('0xf2')])),_0xcb66('0x167'),_0xcb66('0x165'));logger[_0xcb66('0x66')](_0xacb3cf);};Dialer[_0xcb66('0x1a')][_0xcb66('0x122')]=function(_0x515755,_0x1ba4b7,_0x3724e9){hopperUtils['createHistory'](_0x515755)[_0xcb66('0xa3')](loggerCatch(_0x1ba4b7));hopperUtils[_0xcb66('0xcd')](_0x515755)[_0xcb66('0xa3')](loggerCatch(_0x3724e9));};Dialer[_0xcb66('0x1a')]['queueCallerAbandonCreateState']=function(_0x90f15,_0x561fa5){hopperUtils['createHistory'](_0x90f15)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0xcc')));if(_0x561fa5==0x0){hopperUtils[_0xcb66('0xcd')](_0x90f15)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x168')));}};Dialer[_0xcb66('0x1a')][_0xcb66('0x159')]=function(_0x421fec){return Promise[_0xcb66('0xae')]()[_0xcb66('0xa0')](cmHopper[_0xcb66('0x155')](_0x421fec['id'],previewRecallmeReminderInterval))[_0xcb66('0xa0')](function(_0x29ade2){for(var _0x1aaf57=0x0;_0x1aaf57<_0x29ade2[_0xcb66('0x9a')];_0x1aaf57++){var _0x589489=_0x29ade2[_0x1aaf57][_0xcb66('0x169')]['name'];if(_0x589489)io['to'](util[_0xcb66('0x41')](_0xcb66('0x157'),_0x589489))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x29ade2[_0x1aaf57]});}})[_0xcb66('0xa3')](function(){});};Dialer[_0xcb66('0x1a')]['launchHandleIvr']=function(_0x4cde41){var _0x164e16=this;return function(){_0x164e16[_0xcb66('0x16a')](_0x4cde41);};};Dialer['prototype'][_0xcb66('0x16b')]=function(_0x3946f7,_0xa89cf3){var _0x28826b=this;var _0x724c71=uuid['v4']();this[_0xcb66('0x25')][_0x724c71]=new Action(_0x3946f7,_0xa89cf3,_0x724c71);return new Promise(function(_0x5d63e7,_0xcc67c1){if(_[_0xcb66('0x52')](_0x3946f7)&&typeof _0x3946f7!=='object'){return _0xcc67c1(msgResponse(_0xcb66('0x16c'),'Failure',_0xcb66('0x16d')));}if(_[_0xcb66('0x52')](_0xa89cf3[_0xcb66('0x16e')])||_0xa89cf3['phone']===null){return _0xcc67c1(msgResponse(_0xcb66('0x16c'),_0xcb66('0x93'),'contact\x20is\x20undefine'));}var _0x10c0f1={'XMD-CALLERID':_0x28826b[_0xcb66('0x25')][_0x724c71]['getCaller'](),'XMD-AGI':_0x3946f7['dialQueueProject']?util[_0xcb66('0x41')](_0xcb66('0x16f'),ipAgi,_0x3946f7[_0xcb66('0x170')]):_0xcb66('0x171'),'XMD-AGIAFTER':_0x3946f7['dialQueueProject2']?util[_0xcb66('0x41')](_0xcb66('0x16f'),ipAgi,_0x3946f7['dialQueueProject2']):_0xcb66('0x171'),'XMD-QUEUE':utils[_0xcb66('0x172')](_0x3946f7)?util['format'](_0xcb66('0x173'),_0x3946f7[_0xcb66('0x43')],_0x3946f7['dialQueueOptions']||'',_0x3946f7[_0xcb66('0x174')]?'c':'',_0x3946f7[_0xcb66('0xd4')]||0x3):_0xcb66('0x171'),'XMD-CONTACTID':_0xa89cf3[_0xcb66('0xe4')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x28826b[_0xcb66('0x25')][_0x724c71][_0xcb66('0x175')](),'XMD-AMD':_0x3946f7[_0xcb66('0x118')]?_0xcb66('0x14d'):'NONE','XMD-DESTINATION':_0xcb66('0x117')};if(_0x3946f7['dialAMDActive']){_0x10c0f1[_0xcb66('0x176')]=_0x3946f7['dialAMDInitialSilence']||0x9c4;_0x10c0f1[_0xcb66('0x177')]=_0x3946f7[_0xcb66('0x178')]||0x5dc;_0x10c0f1[_0xcb66('0x179')]=_0x3946f7[_0xcb66('0x17a')]||0x320;_0x10c0f1[_0xcb66('0x17b')]=_0x3946f7[_0xcb66('0x17c')]||0x1388;_0x10c0f1[_0xcb66('0x17d')]=_0x3946f7[_0xcb66('0x17e')]||0x64;_0x10c0f1[_0xcb66('0x17f')]=_0x3946f7[_0xcb66('0x180')]||0x32;_0x10c0f1[_0xcb66('0x181')]=_0x3946f7[_0xcb66('0x182')]||0x3;_0x10c0f1[_0xcb66('0x183')]=_0x3946f7['dialAMDSilenceThreshold']||0x100;_0x10c0f1[_0xcb66('0x184')]=_0x3946f7[_0xcb66('0x185')]||0x1388;}if(utils[_0xcb66('0x172')](_0x3946f7)){_0x10c0f1[_0xcb66('0x186')]=_0xa89cf3['VoiceQueueId'];}else{_0x10c0f1[_0xcb66('0x187')]=_0xa89cf3['CampaignId'];}var _0x8e395=utils['setXMDContactVariables'](_0xa89cf3['Contact']);Object[_0xcb66('0x151')](_0x10c0f1,_0x8e395);var _0x5a07ca=_0x28826b['isTrunkReachable'](_0x3946f7['Trunk'])?utils[_0xcb66('0x188')](_0x3946f7[_0xcb66('0x8d')][_0xcb66('0x189')],_0x3946f7['dialOriginateCallerIdName'],_0x3946f7[_0xcb66('0x18a')]>0x0?utils[_0xcb66('0x18b')](_0x3946f7['dialOriginateCallerIdNumber'],_0x3946f7[_0xcb66('0x18a')]):_0x3946f7['dialOriginateCallerIdNumber']):utils[_0xcb66('0x188')](_[_0xcb66('0xf6')](_0x3946f7[_0xcb66('0x18c')])?_0x3946f7[_0xcb66('0x8d')]['callerid']:_0x3946f7['TrunkBackup']['callerid'],_0x3946f7[_0xcb66('0x18d')],_0x3946f7[_0xcb66('0x18a')]>0x0?utils[_0xcb66('0x18b')](_0x3946f7[_0xcb66('0x18e')],_0x3946f7[_0xcb66('0x18a')]):_0x3946f7['dialOriginateCallerIdNumber']);if(_0x5a07ca){_0x10c0f1['XMD-ORIGINATECALLERIDNAME']=_0x28826b[_0xcb66('0x25')][_0x724c71][_0xcb66('0x18f')]=utils[_0xcb66('0x190')](_0x5a07ca);_0x10c0f1['XMD-ORIGINATECALLERIDNUM']=_0xa89cf3[_0xcb66('0x16e')];}_0x3946f7[_0xcb66('0x191')]=_0x10c0f1;return ami['Action']({'actionid':_0x724c71,'action':_0xcb66('0x16c'),'channel':_0x28826b[_0xcb66('0x86')](_0x3946f7['Trunk'])?util[_0xcb66('0x41')](_0xcb66('0x192'),_0x3946f7['Trunk']['name'],isNotNull(_0x3946f7['dialPrefix'])?_0x3946f7[_0xcb66('0x193')]['trim']()||'':'',_0x3946f7['dialCutDigit']>0x0?_0xa89cf3['phone'][_0xcb66('0x194')](_0x3946f7[_0xcb66('0x195')]):_0xa89cf3[_0xcb66('0x16e')]):util[_0xcb66('0x41')]('SIP/%s/%s%s',_[_0xcb66('0xf6')](_0x3946f7[_0xcb66('0x18c')])?_0x3946f7[_0xcb66('0x8d')][_0xcb66('0x43')]:_0x3946f7['TrunkBackup'][_0xcb66('0x43')],isNotNull(_0x3946f7['dialPrefix'])?_0x3946f7['dialPrefix'][_0xcb66('0x196')]()||'':'',_0x3946f7[_0xcb66('0x195')]>0x0?_0xa89cf3[_0xcb66('0x16e')][_0xcb66('0x194')](_0x3946f7[_0xcb66('0x195')]):_0xa89cf3['phone']),'callerid':_0x5a07ca,'Exten':_0xcb66('0x117'),'Context':_0xcb66('0x197'),'Priority':'1','variable':_0x10c0f1,'timeout':(_0x3946f7['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x724c71})[_0xcb66('0xa0')](function(_0x359702){return _0x5d63e7(_0x359702);})[_0xcb66('0xa3')](function(_0x3ceaeb){_0x3946f7['outboundOriginateFailureCallsDay']+=0x1;var _0x184526=new History(_0x28826b[_0xcb66('0x25')][_0x724c71]);logger[_0xcb66('0x66')](util[_0xcb66('0x41')](_0xcb66('0x198'),JSON[_0xcb66('0x74')](_0x3ceaeb)));_0x184526[_0xcb66('0x6e')]=0xe;_0x184526[_0xcb66('0x6f')]='OriginateError';_0x184526['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x184526[_0xcb66('0x70')]=_0x184526['starttime'];hopperUtils['createHistory'](_0x184526)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x199')));_0x28826b[_0xcb66('0xcd')](_0x184526)['catch'](loggerCatch(_0xcb66('0x199')))[_0xcb66('0x1c')](function(){delete _0x28826b['actions'][_0x724c71];return _0xcc67c1(msgResponse('originate',_0xcb66('0x85'),_0xcb66('0x19a')));});});});};Dialer['prototype'][_0xcb66('0x19b')]=function(_0x124e04,_0x54e3a4,_0x788ec6){var _0xbff938=new History(_0x54e3a4);if(_0xbff938[_0xcb66('0x128')]+_0xbff938[_0xcb66('0x129')]+_0xbff938['countnoanswerretry']+_0xbff938[_0xcb66('0x136')]+_0xbff938[_0xcb66('0xd9')]+_0xbff938['countabandonedretry']+_0xbff938['countmachineretry']+_0xbff938['countagentrejectretry']>=_0x788ec6[_0xcb66('0x12b')]-0x1){return!![];}switch(_0x124e04){case 0x3:if(_0xbff938[_0xcb66('0x135')]>=_0x788ec6['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countnoanswerretry':_0xbff938[_0xcb66('0x135')]+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6['dialNoAnswerRetryFrequency'],_0xcb66('0xe3'))['format'](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938['ListId'],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x19c')));break;case 0x5:if(_0xbff938[_0xcb66('0x128')]>=_0x788ec6['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countbusyretry':_0xbff938['countbusyretry']+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6['dialBusyRetryFrequency'],_0xcb66('0xe3'))['format'](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x19d')));break;case 0x8:if(_0xbff938['countcongestionretry']>=_0x788ec6[_0xcb66('0x19e')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0xbff938[_0xcb66('0x129')]+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6[_0xcb66('0x19f')],_0xcb66('0xe3'))[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})['catch'](loggerCatch(_0xcb66('0x1a0')));break;case 0x0:if(_0xbff938[_0xcb66('0x136')]>=_0x788ec6[_0xcb66('0x1a1')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xbff938[_0xcb66('0x136')]+=0x1,'scheduledat':moment()['add'](_0x788ec6[_0xcb66('0x1a2')],_0xcb66('0xe3'))['format'](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938['VoiceQueueId']||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1a3')));}break;case 0xa:if(_0xbff938['countdropretry']>=_0x788ec6[_0xcb66('0xdf')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xbff938[_0xcb66('0xd9')]+=0x1,'scheduledat':moment()['add'](_0x788ec6[_0xcb66('0xda')],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0xbff938['ContactId'],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})['catch'](loggerCatch(_0xcb66('0xe6')));break;case 0xb:if(_0xbff938['countabandonedretry']>=_0x788ec6[_0xcb66('0xf1')]-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countabandonedretry':_0xbff938['countabandonedretry']+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6['dialAbandonedRetryFrequency'],_0xcb66('0xe3'))[_0xcb66('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938[_0xcb66('0xe5')],'VoiceQueueId':_0xbff938['VoiceQueueId']||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1a4')));break;case 0x13:if(_0xbff938[_0xcb66('0x125')]>=_0x788ec6[_0xcb66('0x12e')]-0x1){return!![];}hopperUtils[_0xcb66('0xe1')]({'active':![],'countmachineretry':_0xbff938['countmachineretry']+=0x1,'scheduledat':moment()['add'](_0x788ec6['dialMachineRetryFrequency'],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938['ListId'],'VoiceQueueId':_0xbff938[_0xcb66('0x102')]||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x130')));break;case 0x14:if(_0xbff938[_0xcb66('0x12a')]>=_0x788ec6[_0xcb66('0x1a5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xbff938[_0xcb66('0x12a')]+=0x1,'scheduledat':moment()[_0xcb66('0xe2')](_0x788ec6[_0xcb66('0x1a6')],_0xcb66('0xe3'))[_0xcb66('0x41')](_0xcb66('0xca')),'ContactId':_0xbff938[_0xcb66('0xe4')],'ListId':_0xbff938['ListId'],'VoiceQueueId':_0xbff938['VoiceQueueId']||undefined,'CampaignId':_0xbff938[_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1a7')));break;default:return!![];}};Dialer['prototype']['callProgressDetecting']=function(_0x893ea8,_0x1c712d,_0x59acc1){var _0x2d77d0=this;var _0x39c476=new History(_0x893ea8);var _0x5cf95b=![];var _0x42327a;var _0x63b689;return new Promise(function(_0x1ae85f,_0x5ae852){if(_[_0xcb66('0x52')](_0x1c712d)&&typeof _0x1c712d!=='object'){return _0x5ae852(msgResponse(_0xcb66('0x1a8'),_0xcb66('0x93'),_0xcb66('0x1a9')));}if(_['isUndefined'](_0x59acc1)&&typeof _0x59acc1!==_0xcb66('0x1aa')){return _0x5ae852(msgResponse(_0xcb66('0x1a8'),_0xcb66('0x93'),'evt\x20is\x20undefine'));}hopperUtils[_0xcb66('0xdc')](_0x39c476,_0x59acc1[_0xcb66('0x1ab')],_0x1c712d)['then'](function(_0xdcc52d){if(_0xdcc52d[_0xcb66('0xde')]==0x1)_0x5cf95b=!![];switch(_0x59acc1[_0xcb66('0x1ab')]){case'0':_0x1c712d[_0xcb66('0x1ac')]+=0x1;_0x39c476['state']=0x0;_0x39c476['statedesc']=_0xcb66('0x1ad');_0x39c476['countnosuchnumberretry']+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x893ea8,'nosuchnumber'));_0x42327a=_0x1c712d[_0xcb66('0x1a2')];_0x63b689=_0x1c712d[_0xcb66('0xdb')];hopperUtils[_0xcb66('0xcb')](_0x39c476)[_0xcb66('0xa3')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2d77d0[_0xcb66('0x19b')](0x0,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x136')]>=_0x1c712d['dialNoSuchNumberMaxRetry']){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,'reason\x200\x20no\x20such\x20number....');}else{_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x1c712d[_0xcb66('0x1ae')]+=0x1;_0x39c476['state']=0x3;_0x39c476[_0xcb66('0x6f')]=_0xcb66('0x1af');_0x39c476[_0xcb66('0x135')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;var _0xb38e4e=ut[_0xcb66('0x1b0')](_0x893ea8,_0x1c712d);ami[_0xcb66('0x3c')](_0xcb66('0x1b1'),_0xb38e4e);_0x42327a=_0x1c712d['dialNoAnswerRetryFrequency'];_0x63b689=_0x1c712d[_0xcb66('0xdb')];hopperUtils[_0xcb66('0xcb')](_0x39c476)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1b2')));if(_0x2d77d0['checkRetriveMax'](0x3,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x135')]>=_0x1c712d['dialNoAnswerMaxRetry']){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b3'));}else{_0x2d77d0['stateGlobal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b3'));}}break;case'5':_0x1c712d[_0xcb66('0x1b4')]+=0x1;_0x39c476[_0xcb66('0x6e')]=0x5;_0x39c476[_0xcb66('0x6f')]='Busy';_0x39c476[_0xcb66('0x128')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;ami[_0xcb66('0x3c')](_0xcb66('0x1b5'),ut[_0xcb66('0x126')](_0x893ea8,_0xcb66('0x1b6')));_0x42327a=_0x1c712d[_0xcb66('0x1b7')];_0x63b689=_0x1c712d['callAdditionalPhoneAfterMin'];hopperUtils[_0xcb66('0xcb')](_0x39c476)['catch'](loggerCatch(_0xcb66('0x1b8')));if(_0x2d77d0['checkRetriveMax'](0x5,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x128')]>=_0x1c712d['dialBusyMaxRetry']){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b9'));}else{_0x2d77d0['stateGlobal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1b9'));}}break;case'8':_0x1c712d[_0xcb66('0x1ba')]+=0x1;_0x39c476[_0xcb66('0x6e')]=0x8;_0x39c476['statedesc']='Congestion';_0x39c476['countcongestionretry']+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;_0x42327a=_0x1c712d[_0xcb66('0x19f')];_0x63b689=_0x1c712d[_0xcb66('0xdb')];ami[_0xcb66('0x3c')](_0xcb66('0x1bb'),ut[_0xcb66('0x126')](_0x893ea8,_0xcb66('0x1bc')));hopperUtils[_0xcb66('0xcb')](_0x39c476)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1bd')));if(_0x2d77d0['checkRetriveMax'](0x8,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x129')]>=_0x1c712d[_0xcb66('0x19e')]){_0x2d77d0[_0xcb66('0x137')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1be'));}else{_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1be'));}}break;case'11':_0x1c712d['outboundAbandonedCallsDay']+=0x1;_0x39c476[_0xcb66('0x6e')]=0xb;_0x39c476['statedesc']='Abandoned';_0x39c476[_0xcb66('0xee')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;_0x42327a=_0x1c712d[_0xcb66('0xf0')];_0x63b689=_0x1c712d['callAdditionalPhoneAfterMin'];hopperUtils[_0xcb66('0xcb')](_0x39c476)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x2d77d0['checkRetriveMax'](0xb,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0xee')]>=_0x1c712d[_0xcb66('0xf1')]){_0x2d77d0['createStateFinal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1bf'));}else{_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1bf'));}}break;case'20':_0x1c712d['outboundRejectCallsDay']+=0x1;_0x39c476[_0xcb66('0x6e')]=0x14;_0x39c476[_0xcb66('0x6f')]=_0xcb66('0x1c0');_0x39c476[_0xcb66('0x12a')]+=0x1;_0x39c476[_0xcb66('0xef')]+=0x1;_0x42327a=_0x1c712d[_0xcb66('0x1a6')];_0x63b689=_0x1c712d['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentreject',ut[_0xcb66('0x126')](_0x893ea8,_0xcb66('0x1c1')));hopperUtils['createHistory'](_0x39c476)[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1c2')));if(_0x2d77d0[_0xcb66('0x19b')](0x14,_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x12a')]>=_0x1c712d['dialAgentRejectMaxRetry']){_0x2d77d0['createStateFinal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1c3'));}else{_0x2d77d0['stateGlobal'](_0x39c476,_0x1ae85f,_0x5ae852,_0xcb66('0x1c3'));}}break;default:_0x1c712d[_0xcb66('0x1c4')]+=0x1;_0x39c476['state']=0xc;_0x39c476[_0xcb66('0x6f')]=_0x59acc1[_0xcb66('0x1ab')];_0x42327a=_0x1c712d[_0xcb66('0x1a6')];_0x63b689=_0x1c712d[_0xcb66('0xdb')];hopperUtils[_0xcb66('0xcb')](_0x39c476)['catch'](loggerCatch(_0xcb66('0x1c5')));if(_0x2d77d0[_0xcb66('0x19b')](_0x59acc1[_0xcb66('0x1ab')],_0x893ea8,_0x1c712d)&&!_0x5cf95b){if(_0x39c476[_0xcb66('0x128')]+_0x39c476['countcongestionretry']+_0x39c476['countnoanswerretry']+_0x39c476[_0xcb66('0x136')]+_0x39c476[_0xcb66('0xd9')]+_0x39c476[_0xcb66('0xee')]+_0x39c476['countmachineretry']+_0x39c476[_0xcb66('0x12a')]>=_0x1c712d['dialGlobalMaxRetry']){_0x2d77d0[_0xcb66('0x12c')](_0x39c476,_0x1ae85f,_0x5ae852,_0x59acc1['reason']);}else{_0x2d77d0['createStateFinal'](_0x39c476,_0x1ae85f,_0x5ae852,_0x59acc1[_0xcb66('0x1ab')]);}}}})['then'](function(){if(_0x5cf95b){hopperUtils[_0xcb66('0xeb')](_0x39c476,_0x42327a,_0x63b689)[_0xcb66('0xa0')](function(){return _0x1ae85f(0x1);});}});});};Dialer[_0xcb66('0x1a')]['stateGlobal']=function(_0x476337,_0x1974c3,_0x460e8e,_0x292033){var _0xa72050=new Final(_0x476337);_0xa72050['state']=0xf;_0xa72050[_0xcb66('0x6f')]=_0xcb66('0x1c6');this[_0xcb66('0x137')](_0xa72050,_0x1974c3,_0x460e8e,_0x292033);};Dialer['prototype']['createStateFinal']=function(_0x29d222,_0x2a184b,_0x10c629,_0x122e25){hopperUtils[_0xcb66('0xcd')](_0x29d222)[_0xcb66('0xa0')](function(){return _0x2a184b(msgResponse(_0xcb66('0x1a8'),'Success',_0x122e25));})[_0xcb66('0xa3')](function(){return _0x10c629(msgResponse(_0xcb66('0x1c7'),_0xcb66('0x93'),_0xcb66('0x1c8')));});};Dialer[_0xcb66('0x1a')][_0xcb66('0x8')]=function(_0x36933b){var _0x2e983b=_0x36933b[_0xcb66('0x1c9')]/0x64;var _0x21214d=_0x36933b[_0xcb66('0xd5')]/(_0x36933b[_0xcb66('0xd5')]+_0x36933b['outboundAnswerCallsDay']);var _0x3ac785=Math[_0xcb66('0x1ca')](_0x36933b[_0xcb66('0x1cb')]*(_0x36933b[_0xcb66('0x1cc')]/0x64));var _0x5d21a6=Math[_0xcb66('0x1ca')](_0x36933b[_0xcb66('0x1cb')]*(_0x36933b[_0xcb66('0x1cd')]/0x64));var _0x88d747=_0x36933b[_0xcb66('0x149')]+_0x36933b[_0xcb66('0x14b')];var _0x570b57=Math[_0xcb66('0x1ce')](_0x36933b[_0xcb66('0x59')]*_0x36933b[_0xcb66('0x5c')]*_0x36933b[_0xcb66('0x1cf')]*_0x36933b[_0xcb66('0x1d0')]);if(_[_0xcb66('0x52')](_0x36933b[_0xcb66('0x27')])){if(!_[_0xcb66('0x52')](_0x36933b['startPredictive'])){_0x36933b['startPredictive']=undefined;loggerPredictive[_0xcb66('0x66')]('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_['isUndefined'](_0x36933b[_0xcb66('0x64')])){loggerPredictive[_0xcb66('0x66')](_0xcb66('0x1d1'),_0xcb66('0x1d2'));clearInterval(_0x36933b[_0xcb66('0x64')]);_0x36933b['handlePredictive']=undefined;}_0x36933b[_0xcb66('0x27')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));loggerPredictive[_0xcb66('0x45')](_0x36933b[_0xcb66('0x43')],_0xcb66('0x1d3'),_0x36933b[_0xcb66('0x27')]);this['handlePower'](_0x36933b,0x1);}else if(ifInterval(_0x36933b[_0xcb66('0x1d4')],_0x36933b[_0xcb66('0x27')])){this['handlePower'](_0x36933b,0x1);loggerPredictiveCalls[_0xcb66('0x45')](_0xcb66('0x1d5'),_0x36933b[_0xcb66('0x27')],_0x36933b[_0xcb66('0x43')]);_0x36933b[_0xcb66('0x59')]=0x0;_0x36933b[_0xcb66('0xd6')]=0x0;}else if(_0x2e983b<_0x21214d&&_0x36933b['dialPredictiveOptimization']===_0xcb66('0x1d6')){clearPredictiveAttributes(_0x36933b);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x1d7'),_0xcb66('0x1d8'),_0x21214d,_0xcb66('0x27'),_0x36933b[_0xcb66('0x43')]);}else if(_0x570b57<_0x36933b[_0xcb66('0xd6')]&&_0x36933b[_0xcb66('0x1d9')]===_0xcb66('0x1d6')){clearPredictiveAttributes(_0x36933b);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x1da'),_0xcb66('0x1db'),_0x570b57,'Drop\x20in\x20this\x20interval',_0x36933b[_0xcb66('0xd6')],_0xcb66('0x27'),_0x36933b[_0xcb66('0x43')]);}else if(!ifInterval(_0x36933b[_0xcb66('0x1d4')],_0x36933b[_0xcb66('0x27')])&&_[_0xcb66('0x52')](_0x36933b[_0xcb66('0x62')])&&!_[_0xcb66('0x52')](_0x36933b[_0xcb66('0x27')])){_0x36933b['startPredictive']=moment()[_0xcb66('0x41')](_0xcb66('0xca'));loggerPredictive[_0xcb66('0x45')](_0x36933b[_0xcb66('0x43')],_0xcb66('0x1dc'),_0x36933b[_0xcb66('0x62')]);hopperUtils[_0xcb66('0x1dd')](_0x36933b[_0xcb66('0x1d4')])['then'](this['getDataPredictive'](_0x36933b))[_0xcb66('0xa0')](mergeDataErlangB(_0x36933b))[_0xcb66('0xa0')](this['startMethodPredictive'](_0x36933b))[_0xcb66('0xa3')](loggerCatchPredictive(_0xcb66('0x1de'),_0x36933b));}else if(!ifInterval(_0x36933b[_0xcb66('0x1d4')],_0x36933b[_0xcb66('0x62')])){_0x36933b[_0xcb66('0xd6')]=0x0;_0x36933b[_0xcb66('0x62')]=moment()[_0xcb66('0x41')](_0xcb66('0xca'));loggerPredictive[_0xcb66('0x45')](_0x36933b['name'],_0xcb66('0x1df'),_0x36933b[_0xcb66('0x62')]);clearInterval(_0x36933b[_0xcb66('0x64')]);_0x36933b[_0xcb66('0x64')]=undefined;hopperUtils[_0xcb66('0x1dd')](_0x36933b['dialPredictiveInterval'])[_0xcb66('0xa0')](this[_0xcb66('0x1e0')](_0x36933b))['then'](mergeDataErlangB(_0x36933b))['then'](this[_0xcb66('0x1e1')](_0x36933b))[_0xcb66('0xa3')](loggerCatchPredictive(_0xcb66('0x1e2'),_0x36933b));}else if(_0x36933b[_0xcb66('0x1cb')]&&_0x88d747<_0x36933b['predictiveIntervalAvailable']-_0x5d21a6){clearPredictiveAttributes(_0x36933b);loggerPredictive['info'](_0x36933b['name'],_0xcb66('0x1e3'),_0x88d747,_0xcb66('0x1e4'),_0x36933b[_0xcb66('0x1cb')],'-',_0x5d21a6,'=',_0x36933b['predictiveIntervalAvailable']-_0x5d21a6,')');}else if(_0x36933b[_0xcb66('0x1cb')]&&_0x88d747>_0x36933b['predictiveIntervalAvailable']+_0x3ac785){clearPredictiveAttributes(_0x36933b);loggerPredictive[_0xcb66('0x45')](_0x36933b['name'],_0xcb66('0x1e3'),_0x88d747,_0xcb66('0x1e5'),_0x36933b[_0xcb66('0x1cb')],'+',_0x3ac785,'=',_0x36933b['predictiveIntervalAvailable']+_0x3ac785,')');}};Dialer['prototype'][_0xcb66('0x1e0')]=function(_0x8ecc2a){var _0x52135e=this;return function(_0x25a82a){return new Promise(function(_0x288188,_0x2fafbb){_[_0xcb66('0x5f')](_0x8ecc2a,_0x25a82a[0x0]);if(checkGetDataPredictive(_0x25a82a[0x0])){var _0x928773=_0x8ecc2a[_0xcb66('0x1cb')]=_0x8ecc2a[_0xcb66('0x14b')]+_0x8ecc2a['available'];var _0x1e4528=_0x8ecc2a[_0xcb66('0x1d4')]*0x3c;var _0x3473ce=_0x25a82a[0x0][_0xcb66('0x53')]+_0x25a82a[0x0]['predictiveIntervalAvgHoldtime'];var _0x454a22=(_0x25a82a[0x0][_0xcb66('0x49')]+_0x25a82a[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x25a82a[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x25a82a[0x0]['predictiveIntervalTotalCalls'];_0x8ecc2a[_0xcb66('0x1cf')]=_0x454a22>0x0?_0x454a22:0x1;switch(_0x8ecc2a[_0xcb66('0x1d9')]){case'dropRate':var _0x487bd2=_0x8ecc2a[_0xcb66('0x1c9')]/0x64;return _0x52135e[_0xcb66('0x1e6')](_0x928773,_0x1e4528,_0x3473ce,_0x454a22,_0x487bd2)[_0xcb66('0xa0')](function(_0x2d1dcd){return _0x288188(_0x2d1dcd);});case'agentBusyFactor':var _0x33c25d=_0x8ecc2a['dialPredictiveOptimizationPercentage']/0x64;return _0x52135e['busyFactor'](_0x928773,_0x1e4528,_0x3473ce,_0x454a22,_0x33c25d)[_0xcb66('0xa0')](function(_0x4baf16){return _0x288188(_0x4baf16);});default:return _0x2fafbb(msgResponse(_0xcb66('0x1e7'),'Failure',_0xcb66('0x1e8')));}}else{return _0x2fafbb(msgResponse(_0xcb66('0x1e7'),'Failure',_0xcb66('0x1e9')));}});};};Dialer[_0xcb66('0x1a')][_0xcb66('0x1ea')]=function(_0x4d13f2){var _0x35ef1b=this;return function(_0x1fb96c){return new Promise(function(_0x155be9,_0x5c13db){_[_0xcb66('0x5f')](_0x4d13f2,_0x1fb96c[0x0]);if(checkGetDataPredictive(_0x1fb96c[0x0])){loggerPredictive['info'](JSON[_0xcb66('0x74')](_0x1fb96c[0x0]));if(_0x4d13f2['dialPredictiveOptimization']===_0xcb66('0x1d6')){return _0x35ef1b['getVoiceQueueRtPauses'](_0x4d13f2['id'])[_0xcb66('0xa0')](function(_0x4f27ce){var _0x55c4f7=_0x4d13f2[_0xcb66('0x1eb')]-_0x4f27ce[0x0][_0xcb66('0x1ec')];var _0x197804=_0x4d13f2[_0xcb66('0x1d4')]*0x3c;var _0x3b4f93=_0x1fb96c[0x0][_0xcb66('0x53')]+_0x1fb96c[0x0]['predictiveIntervalAvgHoldtime'];var _0x87335b=(_0x1fb96c[0x0][_0xcb66('0x49')]+_0x1fb96c[0x0][_0xcb66('0x4b')]+_0x1fb96c[0x0][_0xcb66('0x4d')])/_0x1fb96c[0x0][_0xcb66('0x51')];var _0x38d9e5=_0x4d13f2[_0xcb66('0x1c9')]/0x64;_0x4d13f2[_0xcb66('0x1ed')]=_0x4f27ce[0x0][_0xcb66('0x1ec')]||0x0;_0x4d13f2[_0xcb66('0x1cf')]=_0x87335b>0x0?_0x87335b:0x1;return _0x35ef1b[_0xcb66('0x1e6')](_0x55c4f7,_0x197804,_0x3b4f93,_0x87335b,_0x38d9e5);})['then'](function(_0x2d4fd9){return _0x155be9(_0x2d4fd9);})[_0xcb66('0xa3')](function(_0x4c210f){return _0x5c13db(msgResponse('[CatchErlangB]',_0xcb66('0x93'),JSON['stringify'](_0x4c210f)));});}if(_0x4d13f2[_0xcb66('0x1d9')]===_0xcb66('0x1ee')){return _0x35ef1b['getVoiceQueueRtPauses'](_0x4d13f2['id'])[_0xcb66('0xa0')](function(_0x2e6a2b){var _0x589849=_0x4d13f2[_0xcb66('0x1eb')]-_0x2e6a2b[0x0][_0xcb66('0x1ec')];var _0x203ee0=_0x4d13f2[_0xcb66('0x1d4')]*0x3c;var _0x5074bc=_0x1fb96c[0x0][_0xcb66('0x53')]+_0x1fb96c[0x0][_0xcb66('0x4f')];var _0x578e03=(_0x1fb96c[0x0]['predictiveIntervalAnsweredCalls']+_0x1fb96c[0x0][_0xcb66('0x4b')]+_0x1fb96c[0x0][_0xcb66('0x4d')])/_0x1fb96c[0x0][_0xcb66('0x51')];var _0x8ddbb1=_0x4d13f2['dialPredictiveOptimizationPercentage']/0x64;_0x4d13f2[_0xcb66('0x1ed')]=_0x2e6a2b[0x0][_0xcb66('0x1ec')]||0x0;_0x4d13f2[_0xcb66('0x1cf')]=_0x578e03>0x0?_0x578e03:0x1;return _0x35ef1b['busyFactor'](_0x589849,_0x203ee0,_0x5074bc,_0x578e03,_0x8ddbb1);})[_0xcb66('0xa0')](function(_0x297eb0){return _0x155be9(_0x297eb0);})[_0xcb66('0xa3')](function(_0x4d6578){return _0x5c13db(msgResponse('[CatchErlangB]',_0xcb66('0x93'),JSON['stringify'](_0x4d6578)));});}}else{return _0x5c13db(msgResponse('[getDataPredictive]','Failure',_0xcb66('0x1e9')));}});};};Dialer[_0xcb66('0x1a')][_0xcb66('0x1e1')]=function(_0x57a726){var _0x5d9b1b=this;return function(){var _0x5674ad=0x0;var _0x4878f0=Math[_0xcb66('0x1ce')](_0x57a726[_0xcb66('0x5b')]*0x3e8);if(_0x4878f0>0x0){_0x4878f0=_0x4878f0<0x64?0x64:_0x4878f0;loggerPredictive['info'](_0x57a726[_0xcb66('0x43')],_0xcb66('0x1ef'),_0x4878f0,_0xcb66('0x1f0'));_0x57a726[_0xcb66('0x64')]=setInterval(function(){_0x5d9b1b[_0xcb66('0x64')](_0x57a726);loggerPredictiveCalls['info']('[handlePredictive]',_0x5674ad+=0x1);},_0x4878f0);}else{loggerPredictive[_0xcb66('0x45')](_0x57a726[_0xcb66('0x43')],_0xcb66('0x1f1'));}};};Dialer[_0xcb66('0x1a')][_0xcb66('0x1f2')]=function(_0x461438,_0x255171){var _0x54b42c=this;return function(_0x99abc1){if(_[_0xcb66('0x7a')](_0x99abc1)){if(_[_0xcb66('0xf6')](_0x255171[_0xcb66('0x166')])||!_0x255171[_0xcb66('0x1f3')]){if(_0x461438[_0xcb66('0xb2')]===_0xcb66('0xb6')){_0x461438[_0xcb66('0x72')]=_[_0xcb66('0x52')](_0x461438['queueStatusComplete'])?!![]:_0x461438['queueStatusComplete'];var _0xe5af90=uuid['v4']();_0x54b42c[_0xcb66('0x25')][_0xe5af90]=new Action(_0x461438,_0x255171,_0xe5af90);loggerBooked['info']('[booked][checkContactBlack]',_0xe5af90,_0xcb66('0x1f4'),JSON[_0xcb66('0x74')](_0x461438[_0xcb66('0x72')]),'Queue:\x20',_0x461438['name']);if(_0x461438['queueStatusComplete']){_0x461438[_0xcb66('0x72')]=![];_0x54b42c[_0xcb66('0xfa')][_0x54b42c[_0xcb66('0x25')][_0xe5af90]['queue']]=[];ami['Action']({'actionid':_0xe5af90,'action':_0xcb66('0x1f5'),'queue':_0x461438['name']})[_0xcb66('0xa3')](function(){utils[_0xcb66('0x100')](_0x461438,_0xcb66('0x1f6'));hopperUtils[_0xcb66('0xe1')]({'active':![],'ContactId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0xe4')],'ListId':_0x54b42c[_0xcb66('0x25')][_0xe5af90]['ListId'],'VoiceQueueId':_0x54b42c['actions'][_0xe5af90][_0xcb66('0x102')]||undefined,'CampaignId':_0x54b42c['actions'][_0xe5af90][_0xcb66('0xf2')]||undefined})[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x1f7')));delete _0x54b42c[_0xcb66('0x25')][_0xe5af90];});}else{loggerBooked['info'](_0xcb66('0x1f8'),JSON[_0xcb66('0x74')](_0x461438[_0xcb66('0x72')]),_0xcb66('0x1f9'),_0x461438[_0xcb66('0x43')]);utils['decrementOriginate'](_0x461438,_0xcb66('0x1f6'));hopperUtils[_0xcb66('0xe1')]({'active':![],'ContactId':_0x54b42c[_0xcb66('0x25')][_0xe5af90]['ContactId'],'ListId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0xe5')],'VoiceQueueId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0x102')]||undefined,'CampaignId':_0x54b42c[_0xcb66('0x25')][_0xe5af90][_0xcb66('0xf2')]||undefined})['catch'](loggerCatch(_0xcb66('0x1f7')));delete _0x54b42c[_0xcb66('0x25')][_0xe5af90];}}else{return _0x54b42c['actionOriginate'](_0x461438,_0x255171);}}else{if(utils[_0xcb66('0xd2')](undefined,_0x255171[_0xcb66('0x1fa')])<_0x461438[_0xcb66('0x1fb')]*0x3c){if(_0x255171[_0xcb66('0x169')]&&!_0x255171[_0xcb66('0x169')]['voicePause']){_0x54b42c['preview'][_0xcb66('0xfd')](_0x255171['id'])[_0xcb66('0x1c')](function(){utils[_0xcb66('0x100')](_0x461438,_0xcb66('0x1f6'));});}else{hopperUtils[_0xcb66('0x1fc')]({'active':![]},_0x255171['id'],0x1)[_0xcb66('0x1c')](function(){utils[_0xcb66('0x100')](_0x461438,'[checkContactBlack]');});}}else{_0x461438[_0xcb66('0x1fd')]+=0x1;utils[_0xcb66('0x100')](_0x461438,_0xcb66('0x1f6'));if(_0x461438[_0xcb66('0x1fe')]){hopperUtils[_0xcb66('0xe1')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x255171['ContactId'],'ListId':_0x255171[_0xcb66('0xe5')],'VoiceQueueId':_0x255171[_0xcb66('0x102')]||undefined,'CampaignId':_0x255171['CampaignId']||undefined})['catch'](loggerCatch(_0xcb66('0x1ff')));hopperUtils[_0xcb66('0xcb')](createObjHistory(_0x461438,_0x255171,utils[_0xcb66('0x69')]['QUEUE_RECALL'],0x17,_0xcb66('0x200')))['catch'](loggerCatch(_0xcb66('0x201')));}else{_0x54b42c[_0xcb66('0x122')](createObjHistory(_0x461438,_0x255171,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0xcb66('0x202')),_0xcb66('0x203'),'[Originate][HistoryRecallClose]');}}}}else{_0x461438['outboundBlacklistCallsDay']+=0x1;_0x54b42c[_0xcb66('0x122')](createObjHistory(_0x461438,_0x255171,utils[_0xcb66('0x69')][_0xcb66('0x204')],0xd,_0xcb66('0x205')),_0xcb66('0x206'),_0xcb66('0x207'));throw'inBlackList';}};};Dialer[_0xcb66('0x1a')][_0xcb66('0x16a')]=function(_0x4a8d80){var _0x1518b8=this;var _0x357a5a=_0x4a8d80[_0xcb66('0x208')]-_0x4a8d80[_0xcb66('0x7e')];emitCampaignSummary(_0x4a8d80);if(_0x357a5a>0x0&&_0x4a8d80['temp']==0x0){if(_0x357a5a>this[_0xcb66('0x23')]){_0x357a5a=this['maxNumberOriginate'];}_0x4a8d80[_0xcb66('0x209')]=0x1;hopperUtils[_0xcb66('0x20a')](_0x4a8d80,_0x357a5a)['then'](function(_0x2f0935){_0x4a8d80['temp']=0x0;if(_0x2f0935){if(!utils[_0xcb66('0x20b')](_0x2f0935)){_0x4a8d80[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x20c')];logger[_0xcb66('0x45')](_0xcb66('0x20d')+_0x4a8d80['name']);}else{_0x4a8d80[_0xcb66('0x7e')]+=_0x2f0935['length'];_0x4a8d80[_0xcb66('0x6d')]=utils[_0xcb66('0x69')][_0xcb66('0x20e')];for(var _0x34f780=0x0;_0x34f780<_0x2f0935[_0xcb66('0x9a')];_0x34f780+=0x1){_0x4a8d80[_0xcb66('0x20f')]+=0x1;if(_['isNil'](_0x2f0935[_0x34f780])||_['isNil'](_0x2f0935[_0x34f780]['Contact'])||_['isNil'](_0x2f0935[_0x34f780][_0xcb66('0x16e')])){_0x1518b8['emptyContact']('[actionOriginate]\x20',_0x4a8d80,_0x2f0935[_0x34f780]);}else{hopperUtils[_0xcb66('0x210')](_[_0xcb66('0x75')](_0x2f0935[_0x34f780],['CampaignId',_0xcb66('0x16e')]))[_0xcb66('0xa0')](_0x1518b8[_0xcb66('0x1f2')](_0x4a8d80,_0x2f0935[_0x34f780]))[_0xcb66('0xa3')](function(_0x43af13){logger[_0xcb66('0x66')](_0xcb66('0x211'),_0x43af13);utils[_0xcb66('0x100')](_0x4a8d80,_0xcb66('0x212'));});}}}}})[_0xcb66('0xa3')](function(_0x10b6e8){_0x4a8d80[_0xcb66('0x209')]=0x0;logger['error'](_0xcb66('0x213'),_0x10b6e8);});}};Dialer[_0xcb66('0x1a')][_0xcb66('0xb4')]=function(_0x39127d,_0x3ea5bd){var _0x2b6271=this;var _0x54408e=[];if(_0x3ea5bd<0x1||_0x39127d[_0xcb66('0xb2')]==='booked'){_0x3ea5bd=0x1;}var _0x3574b2=Math['floor'](_0x39127d['available']*_0x3ea5bd)-_0x39127d[_0xcb66('0x7e')];if(_0x39127d[_0xcb66('0x214')]>0x0){var _0x43b942=_0x39127d[_0xcb66('0x214')]-_0x39127d[_0xcb66('0x7e')]-_0x39127d[_0xcb66('0x14b')]-_0x39127d[_0xcb66('0x14c')];if(_0x3574b2>_0x43b942){_0x3574b2=_0x43b942;}}if(_0x3574b2>0x0&&_0x39127d[_0xcb66('0x209')]==0x0){if(_0x39127d[_0xcb66('0xb2')]===_0xcb66('0xb6')){_0x3574b2=0x1;}if(_0x3574b2>this[_0xcb66('0x23')]){_0x3574b2=this['maxNumberOriginate'];}for(var _0x39bffa in this['agents']){if(typeof this[_0xcb66('0x21')][_0x39bffa]!=='undefined'){if(this['agents'][_0x39bffa][_0xcb66('0x6e')]===_0xcb66('0x215')&&this[_0xcb66('0x21')][_0x39bffa][_0xcb66('0x89')]==='reachable'){_0x54408e[_0xcb66('0x9b')](this['agents'][_0x39bffa]['id']);}}}_0x39127d['temp']=0x1;hopperUtils['getContactDialer'](_0x39127d,_0x54408e,_0x3574b2)['then'](function(_0x147060){_0x39127d[_0xcb66('0x209')]=0x0;if(_0x147060){if(!utils['checkContactEmpty'](_0x147060)){hopperUtils[_0xcb66('0x216')](_0x39127d)[_0xcb66('0xa0')](sendMessageReschedule(_0x39127d))[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x217')));}else{_0x39127d[_0xcb66('0x7e')]+=_0x147060[_0xcb66('0x9a')];_0x39127d[_0xcb66('0x6d')]=_0x39127d[_0xcb66('0xb2')]===_0xcb66('0xb6')?utils[_0xcb66('0x69')][_0xcb66('0x14d')]:utils['CAMPAIGN_STATUS'][_0xcb66('0x20e')];for(var _0x3d8b99=0x0;_0x3d8b99<_0x147060['length'];_0x3d8b99+=0x1){if(_[_0xcb66('0xf6')](_0x147060[_0x3d8b99])||_['isNil'](_0x147060[_0x3d8b99]['Contact'])||_[_0xcb66('0xf6')](_0x147060[_0x3d8b99][_0xcb66('0x16e')])){_0x2b6271[_0xcb66('0x164')](_0xcb66('0x218'),_0x39127d,_0x147060[_0x3d8b99]);}else{hopperUtils[_0xcb66('0x219')](_['pick'](_0x147060[_0x3d8b99],[_0xcb66('0x102'),_0xcb66('0x16e')]))[_0xcb66('0xa0')](_0x2b6271['checkContactBlack'](_0x39127d,_0x147060[_0x3d8b99]))['catch'](function(_0xd3f7e8){logger[_0xcb66('0x66')](_0xcb66('0x21a'),_0xd3f7e8);utils[_0xcb66('0x100')](_0x39127d,_0xcb66('0x21b'));});}}}}})[_0xcb66('0xa3')](function(_0x26b033){_0x39127d[_0xcb66('0x209')]=0x0;logger[_0xcb66('0x66')](_0xcb66('0x213'),_0x26b033);});}};Dialer[_0xcb66('0x1a')][_0xcb66('0x64')]=function(_0x31e621){if(_0x31e621[_0xcb66('0x214')]>0x0){var _0x41464d=_0x31e621[_0xcb66('0x214')]-_0x31e621[_0xcb66('0x7e')]-_0x31e621[_0xcb66('0x14b')];if(_0x41464d>0x0&&_0x31e621[_0xcb66('0x209')]==0x0){this['tryOriginatePredictive'](_0x31e621);}else{loggerPredictiveCalls['info'](_0xcb66('0x21c'));}}else{this[_0xcb66('0x21d')](_0x31e621);}};Dialer['prototype'][_0xcb66('0x21d')]=function(_0x4f6cec){var _0x15e1f2=this;var _0x4f92ec=[];_0x4f6cec['originated']+=0x1;for(var _0x1009b7 in this['agents']){if(typeof this[_0xcb66('0x21')][_0x1009b7]!==_0xcb66('0xad')){if(this[_0xcb66('0x21')][_0x1009b7][_0xcb66('0x6e')]===_0xcb66('0x215')&&this['agents'][_0x1009b7][_0xcb66('0x89')]===_0xcb66('0x8a')){_0x4f92ec[_0xcb66('0x9b')](this[_0xcb66('0x21')][_0x1009b7]['id']);}}}_0x4f6cec[_0xcb66('0x209')]=0x1;return this[_0xcb66('0x21e')](_0x4f6cec['id'],_0x4f92ec,0x1,_0x4f6cec['dialOrderByScheduledAt'],_0x4f6cec)[_0xcb66('0xa0')](function(_0x5463a6){_0x4f6cec[_0xcb66('0x209')]=0x1;if(_0x5463a6){if(!utils['checkContactEmpty'](_0x5463a6)){utils[_0xcb66('0x21f')](_0x4f6cec,0x1,0x0);return hopperUtils[_0xcb66('0x216')](_0x4f6cec)[_0xcb66('0xa0')](sendMessageReschedule(_0x4f6cec))[_0xcb66('0xa3')](loggerCatch(_0xcb66('0x217')));}else{_0x4f6cec['message']=utils['CAMPAIGN_STATUS'][_0xcb66('0x20e')];if(_[_0xcb66('0xf6')](_0x5463a6[0x0])||_[_0xcb66('0xf6')](_0x5463a6[0x0][_0xcb66('0x220')])||_[_0xcb66('0xf6')](_0x5463a6[0x0][_0xcb66('0x16e')])){_0x15e1f2[_0xcb66('0x164')]('[actionOriginate]\x20',_0x4f6cec,_0x5463a6[0x0]);}else{return hopperUtils[_0xcb66('0x219')](_[_0xcb66('0x75')](_0x5463a6[0x0],[_0xcb66('0x102'),_0xcb66('0x16e')]))[_0xcb66('0xa0')](_0x15e1f2['checkContactBlack'](_0x4f6cec,_0x5463a6[0x0]))[_0xcb66('0xa3')](function(_0x563d69){logger[_0xcb66('0x66')]('[actionOriginatePredictive]',_0x563d69);utils[_0xcb66('0x100')](_0x4f6cec,'[actionOriginatePredictive]');});}}}})[_0xcb66('0xa3')](function(_0x5849a9){_0x4f6cec[_0xcb66('0x209')]=0x0;logger[_0xcb66('0x66')](_0xcb66('0x213'),_0x5849a9);});};Dialer[_0xcb66('0x1a')][_0xcb66('0x1e6')]=function(_0x5c1341,_0x56ace3,_0x3c2f2d,_0x39b409,_0x5d37c9,_0x3f011a){loggerPredictive[_0xcb66('0x45')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('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',_0x5c1341);loggerPredictive['info'](_0xcb66('0x221'),_0x56ace3);loggerPredictive[_0xcb66('0x45')]('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',_0x3c2f2d);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x222'),_0x39b409);loggerPredictive[_0xcb66('0x45')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5d37c9);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));return new Promise(function(_0x152508,_0x571f30){if(_0x5c1341<=0x0||isNaN(_0x5c1341)){return _0x571f30(msgResponse(_0xcb66('0x223'),'Error',_0xcb66('0x224')+_0x5c1341));}if(_0x3c2f2d<=0x0||isNaN(_0x3c2f2d)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),'Ts\x20=\x20'+_0x3c2f2d));}if(_0x39b409<=0x0||isNaN(_0x39b409)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),'p\x20=\x20'+_0x39b409));}if(_0x56ace3<=0x0||isNaN(_0x56ace3)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),_0xcb66('0x225')+_0x56ace3));}if(_0x5d37c9<=0x0||isNaN(_0x5d37c9)){return _0x571f30(msgResponse('[abandonmentRate]',_0xcb66('0x85'),_0xcb66('0x226')+_0x5d37c9));}_0x3f011a=_0x3f011a||0x0;var _0x5ebfd2=0x1/_0x3c2f2d;var _0x303bb8=0x0;var _0x561cc9=0x0;var _0x4e3f85=0x0;var _0x946339=0x0;for(var _0x2bb371=0x0;_0x4e3f85<_0x5d37c9;_0x2bb371+=0x1){_0x561cc9=_0x2bb371/_0x56ace3;_0x303bb8=(_0x39b409*_0x561cc9+_0x3f011a)/_0x5ebfd2;_0x4e3f85=utils['erlangb'](_0x303bb8,_0x5c1341);_0x946339=_0x303bb8/_0x5c1341*(0x1-utils['erlangb'](_0x303bb8,_0x5c1341));}return _0x152508({'erlangCalls':_0x2bb371,'erlangCallToSecond':_0x56ace3/_0x2bb371,'erlangAbandonmentRate':_0x4e3f85,'erlangBusyFactor':_0x946339});});};Dialer[_0xcb66('0x1a')][_0xcb66('0x227')]=function(_0x48b026,_0x18c56a,_0x4607a0,_0x284d5e,_0x1ccfab,_0x288747){loggerPredictive[_0xcb66('0x45')](_0xcb66('0x228'));loggerPredictive['info']('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',_0x48b026);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x221'),_0x18c56a);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x229'),_0x4607a0);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x222'),_0x284d5e);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x22a'),_0x1ccfab);loggerPredictive[_0xcb66('0x45')](_0xcb66('0x50'));return new Promise(function(_0x57fd15,_0x279db6){if(_0x48b026<=0x0||isNaN(_0x48b026)){return _0x279db6(msgResponse('[busyFactor]','Error',_0xcb66('0x224')+_0x48b026));}if(_0x4607a0<=0x0||isNaN(_0x4607a0)){return _0x279db6(msgResponse(_0xcb66('0x22b'),_0xcb66('0x85'),_0xcb66('0x22c')+_0x4607a0));}if(_0x284d5e<=0x0||isNaN(_0x284d5e)){return _0x279db6(msgResponse(_0xcb66('0x22b'),_0xcb66('0x85'),_0xcb66('0x22d')+_0x284d5e));}if(_0x18c56a<=0x0||isNaN(_0x18c56a)){return _0x279db6(msgResponse(_0xcb66('0x22b'),_0xcb66('0x85'),_0xcb66('0x225')+_0x18c56a));}if(_0x1ccfab<=0x0||isNaN(_0x1ccfab)){return _0x279db6(msgResponse('[busyFactor]','Error',_0xcb66('0x22e')+_0x1ccfab));}_0x288747=_0x288747||0x0;var _0x5eeb26=0x1/_0x4607a0;var _0x57e479=0x0;var _0x4234c7=0x0;var _0x1bedc3=0x0;var _0x4cabc2=0x0;for(var _0x18c05e=0x0;_0x4cabc2<_0x1ccfab;_0x18c05e+=0x1){_0x4234c7=_0x18c05e/_0x18c56a;_0x57e479=(_0x284d5e*_0x4234c7+_0x288747)/_0x5eeb26;_0x1bedc3=utils[_0xcb66('0x22f')](_0x57e479,_0x48b026);_0x4cabc2=_0x57e479/_0x48b026*(0x1-utils['erlangb'](_0x57e479,_0x48b026));}return _0x57fd15({'erlangCalls':_0x18c05e,'erlangCallToSecond':_0x18c56a/_0x18c05e,'erlangAbandonmentRate':_0x1bedc3,'erlangBusyFactor':_0x4cabc2});});};module['exports']=Dialer; \ No newline at end of file +var _0x1847=['syncCampaigns','undefined','isIVRCampaignActive','resolve','dialTimezone','checkIfTimeIntervals','launchHandleIvr','checkDialMethod','dialMethod','progressive','power','handlePower','dialPowerLevel','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','OVERTIME_GLOBAL_INTERVAL','\x20Interval\x20is\x20overtime:\x20','silly','isGlobal','AMI\x20IfTime','syncAgentConnect','uniqueId','type','decrementOriginate','queue','[syncAgentConnect]','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','reason','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','ivr','[syncQueueCallerAbandon]','droptime','getSeconds','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','countglobal','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','countdropretry','dialDropMaxRetry','queueCallerAbandonCreateState','dialDropRetryFrequency','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','CALLEREXIT','countabandonedretry','rescheduleContact','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','actions','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','syncQueueStatusComplete','preview','run','[Catch][Preview][syncQueueStatusComplete]','[syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','finally','[booked][RR][finaly]','[booked][unlock]','[unlock2][syncQueueStatusComplete]','getQueue','Success','[syncOriginateResponse]','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','exten','dialAMDActive','value','HANGUP','[syncVarSet]','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','add','dialMachineRetryFrequency','saveInDb','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countnosuchnumberretry','reason19\x20machine....','[syncHangup]','ivrAnswerCallsDay','cause-txt','[syncAgentCompleteIvr]','[syncHangupIvr]','dialQueueProject','AGI','[syncHangupIvr][createHistory]','[syncHangup2]','Normal\x20Clearing','outboundUnknownCallsDay','[syncHangup][createHistory]','queuesSummary','running','isPreviewCampaign','statusMessage','inUse','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','handlePreviewRecallNotifications','map','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[actions]','No\x20such\x20channel','[clearZombieChannels]','[Dialer][checkChannel]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','emptyContact','[emptyContact]','UserId','Agent','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','xcally-motion-dialer','XMD-AMDINITIALSILENCE','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialGlobalMaxRetry','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','reason\x208\x20congestion','outboundAbandonedCallsDay','Abandoned','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalMinThreshold','talking','floor','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','abandonmentRate','[CatchErlangB]','predictiveIntervalHitRate','[handlePredictive]','fail\x20to\x20scheduled\x20calls','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[checkContactBlack]','[unlockOriginate][syncQueueStatusComplete]','scheduledat','voicePause','unlockContact','outboundReCallsDay','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][historyBlacklist]','inBlackList','handleIvr','temp','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','checkContactBlack','[handleIvr]','[getContactCampaign2]','available','dialLimitQueue','pTalking','not_inuse','getContactDialer','checkContactEmpty','countReScheduled','[countReScheduled]\x20','ACTIVE','checkIsBlackList','[actionOriginate]','[handlePower]','[handlePredictive][limitChannel]','tryOriginatePredictive','dialOrderByScheduledAt','[actionOriginatePredictive]','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/logger','dialer','booked','predictive','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','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','contactsId','optionPredictive','startProgressive','ivrOriginated','queueBooked','syncQueueCallerAbandon','bind','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','queuemember','loopCampaigns','loopClearZombieChannels','then','isUndefined','emit','outbound','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\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','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','debug','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','contactsRescheduled','message','CAMPAIGN_STATUS','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','[getContactDialer2][Empty]','state','statedesc','endtime','starttime','[unlockQueueStatus][undefined]','queueStatusComplete','stringify','pick','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','INACTIVE','isIVRCampaign','format','campaign:ivr:%s','campaign:save','originated','is\x20not\x20active','DISACTIVED','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','[ifTime][Action]','Error','active','status','reachable','SIP/%s','unmonitored','checkIsTrunkReachable','isTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','indexOf','true','catch','content','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','Timezone:\x20','resetActiveCalls'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1847,0x185));var _0x7184=function(_0x459baf,_0x332707){_0x459baf=_0x459baf-0x0;var _0x4a5970=_0x1847[_0x459baf];return _0x4a5970;};'use strict';var util=require(_0x7184('0x0'));var _=require('lodash');var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var Redis=require(_0x7184('0x1'));var utils=require(_0x7184('0x2'));var hopperUtils=require(_0x7184('0x3'));var ut=require(_0x7184('0x4'));var config=require('../../../config/environment/');var logger=require(_0x7184('0x5'))(_0x7184('0x6'));var loggerBooked=require(_0x7184('0x5'))(_0x7184('0x7'));var loggerPredictive=require(_0x7184('0x5'))(_0x7184('0x8'));var loggerPredictiveCalls=require(_0x7184('0x5'))('predictiveCalls');var loggerSyncQueueSummary=require(_0x7184('0x5'))(_0x7184('0x9'));var ami=require(_0x7184('0xa'));config[_0x7184('0xb')]=_[_0x7184('0xc')](config[_0x7184('0xb')],{'host':_0x7184('0xd'),'port':0x18eb});var io=require(_0x7184('0xe'))(new Redis(config[_0x7184('0xb')]));var cmHopper=require(_0x7184('0xf'));var voiceQueueRt=require(_0x7184('0x10'));var RpcSetting=require(_0x7184('0x11'));var Interval=require(_0x7184('0x12'));var Action=require(_0x7184('0x13'));var History=require(_0x7184('0x14'));var Final=require(_0x7184('0x15'));var AgentComplete=require(_0x7184('0x16'));var QueueCallerAbandon=require(_0x7184('0x17'));var Hangup=require(_0x7184('0x18'));var ipAgi=process[_0x7184('0x19')][_0x7184('0x1a')]||_0x7184('0x1b');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7184('0x1c')][_0x7184('0x1d')]=function(_0x31edaa){this['tail']=this[_0x7184('0x1e')]?this[_0x7184('0x1e')]['finally'](_0x31edaa):_0x31edaa();};function Dialer(_0x4135ee,_0x5790ec){this[_0x7184('0x1f')]=new Sequence();this['preview']=_0x5790ec;this[_0x7184('0x20')]=_0x4135ee[_0x7184('0x20')];this[_0x7184('0x21')]=_0x4135ee[_0x7184('0x21')];this[_0x7184('0x22')]=_0x4135ee['agents'];this[_0x7184('0x23')]=_0x4135ee['trunks'];this['maxNumberOriginate']=config[_0x7184('0x24')]||0x2;this['channels']={};this['actions']={};this[_0x7184('0x25')]={};this['uniqueId']={};this[_0x7184('0x26')]={};this['startPredictive']={};this[_0x7184('0x27')]={};this[_0x7184('0x28')]={};this[_0x7184('0x29')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on']('queuecallerabandon',this[_0x7184('0x2a')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x2c'),this[_0x7184('0x2d')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x2e'),this[_0x7184('0x2f')][_0x7184('0x2b')](this));ami['on']('custom:queuesummary',this[_0x7184('0x9')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x30'),this[_0x7184('0x31')][_0x7184('0x2b')](this));ami['on'](_0x7184('0x32'),this[_0x7184('0x33')]['bind'](this));ami['on'](_0x7184('0x34'),this[_0x7184('0x35')][_0x7184('0x2b')](this));ami['on']('varset',this['syncVarSet'][_0x7184('0x2b')](this));ami['on'](_0x7184('0x36'),this['syncQueueMember'][_0x7184('0x2b')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0x7184('0x2b')](this));this[_0x7184('0x37')]();this[_0x7184('0x38')]();RpcSetting['getSettings']()[_0x7184('0x39')](function(_0x14cd0b){previewRecallmeReminderInterval=_0x14cd0b['previewRecallmeReminderInterval'];});}function isNotNull(_0x1c6be6){return _0x1c6be6!==null&&!_[_0x7184('0x3a')](_0x1c6be6);}function msgResponse(_0x2b3457,_0x168f5d,_0x4a5f96){return{'action':_0x2b3457,'response':_0x168f5d,'message':_0x4a5f96,'stack':_0x4a5f96};}function emit(_0x5becd2,_0x1d1abe,_0x4fcd57){io['to'](_0x5becd2)[_0x7184('0x3b')](_0x1d1abe,_0x4fcd57);}function emitOutboundVoiceQueueSummary(_0x457907){if(_0x457907['type']===_0x7184('0x3c')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x7184('0x3d')](_0x457907,{'showHidden':![],'depth':null}));emit(util['format'](_0x7184('0x3e'),_0x457907[_0x7184('0x3f')]),_0x7184('0x40'),_0x457907);}}function checkGetDataPredictive(_0x2ac0ea){if(isNotNull(_0x2ac0ea)&&!_[_0x7184('0x41')](_0x2ac0ea)){loggerPredictive[_0x7184('0x42')](_0x7184('0x43'));loggerPredictive['info']('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ac0ea[_0x7184('0x44')]);loggerPredictive[_0x7184('0x42')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ac0ea[_0x7184('0x45')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x46'),_0x2ac0ea[_0x7184('0x47')]);loggerPredictive[_0x7184('0x42')]('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x2ac0ea[_0x7184('0x48')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x49'),_0x2ac0ea[_0x7184('0x4a')]);loggerPredictive['info'](_0x7184('0x4b'),_0x2ac0ea[_0x7184('0x4c')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x4d'));if(_0x2ac0ea[_0x7184('0x44')]>0x0){if(!_[_0x7184('0x3a')](_0x2ac0ea[_0x7184('0x4c')])&&_0x2ac0ea[_0x7184('0x4c')]>0x0){return!![];}loggerPredictive[_0x7184('0x42')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');if(!_[_0x7184('0x3a')](_0x2ac0ea[_0x7184('0x4a')])&&_0x2ac0ea['predictiveIntervalAvgHoldtime']>0x0){return!![];}loggerPredictive[_0x7184('0x42')](_0x7184('0x4e'));}else{loggerPredictive[_0x7184('0x42')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x7184('0x42')](_0x7184('0x4f'));}return![];}function mergeDataErlangB(_0x388424){return function(_0xb48d34){loggerPredictive[_0x7184('0x42')](_0x7184('0x50'));loggerPredictive[_0x7184('0x42')](_0x7184('0x51'),_0xb48d34[_0x7184('0x52')]);loggerPredictive['info'](_0x7184('0x53'),_0xb48d34[_0x7184('0x54')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x55'),_0xb48d34[_0x7184('0x56')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x57'),_0xb48d34[_0x7184('0x58')]);loggerPredictive[_0x7184('0x42')](_0x7184('0x55'),_0xb48d34['erlangAbandonmentRate']);loggerPredictive[_0x7184('0x42')](_0x7184('0x4d'));_[_0x7184('0x59')](_0x388424,_0xb48d34);};}function ifInterval(_0xe6f80c,_0x5e2a2d){if(_[_0x7184('0x3a')](_0x5e2a2d)){return![];}return utils['getSeconds'](undefined,_0x5e2a2d)<_0xe6f80c*0x3c;}function clearPredictiveAttributes(_0x3e5ac0){if(_0x3e5ac0[_0x7184('0x27')]){_0x3e5ac0[_0x7184('0x27')]=undefined;loggerPredictive[_0x7184('0x5a')](_0x3e5ac0[_0x7184('0x3f')],_0x7184('0x5b'));}if(_0x3e5ac0[_0x7184('0x5c')]){_0x3e5ac0['startPredictive']=undefined;loggerPredictive[_0x7184('0x5a')](_0x3e5ac0[_0x7184('0x3f')],_0x7184('0x5d'));}if(_0x3e5ac0['handlePredictive']){clearInterval(_0x3e5ac0[_0x7184('0x5e')]);_0x3e5ac0[_0x7184('0x5e')]=undefined;loggerPredictive[_0x7184('0x5a')](_0x3e5ac0[_0x7184('0x3f')],_0x7184('0x5f'));}}function loggerCatchPredictive(_0x148d3f,_0x4b784b){return function(_0x5ea3d4){loggerPredictive[_0x7184('0x60')](_0x4b784b[_0x7184('0x3f')],_0x148d3f);loggerPredictive['error'](_0x5ea3d4['stack']);clearPredictiveAttributes(_0x4b784b);};}function loggerCatch(_0x584ca5){return function(_0x93d642){logger[_0x7184('0x60')](_0x584ca5,util['inspect'](_0x93d642,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x478f4f){return function(_0x341db9){if(isNotNull(_0x341db9)&&isNotNull(_0x341db9[0x0])){if(_0x341db9[0x0][_0x7184('0x61')]>0x0){_0x478f4f[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x64')];logger['info'](_0x7184('0x65')+_0x478f4f[_0x7184('0x3f')],_0x341db9[0x0][_0x7184('0x61')],_0x7184('0x66'));}else{_0x478f4f[_0x7184('0x62')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x7184('0x42')](_0x7184('0x67')+_0x478f4f[_0x7184('0x3f')]);}}};}function createObjHistory(_0x1be476,_0x43365b,_0x3e3d57,_0xcfc6b3,_0xcb42e){_0x1be476[_0x7184('0x62')]=_0x3e3d57;var _0x4d0dc8=new Action(_0x1be476,_0x43365b);var _0x436666=new History(_0x4d0dc8);_0x436666[_0x7184('0x68')]=_0xcfc6b3;_0x436666[_0x7184('0x69')]=_0xcb42e;_0x436666[_0x7184('0x6a')]=_0x4d0dc8[_0x7184('0x6b')];return _0x436666;}function unlockQueueStatus(_0x1fd94b,_0x5c33ee){setTimeout(function(){if(_[_0x7184('0x3a')](_0x1fd94b['queueStatusComplete'])){loggerBooked['error'](_0x7184('0x6c'),_0x5c33ee);}_0x1fd94b[_0x7184('0x6d')]=!![];loggerBooked[_0x7184('0x42')]('[booked][unlockQueueStatus]',_0x5c33ee,JSON[_0x7184('0x6e')](_[_0x7184('0x6f')](_0x1fd94b,[_0x7184('0x3f'),_0x7184('0x6d')])));},0x1f3);}function checkInterval(_0x8e99ba){return function(){if(!isNotNull(_0x8e99ba['Interval'])){_0x8e99ba[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];throw _0x8e99ba[_0x7184('0x3f')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x8e99ba[_0x7184('0x71')][_0x7184('0x72')])){_0x8e99ba[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];throw _0x8e99ba[_0x7184('0x3f')]+_0x7184('0x73');}if(!isNotNull(_[_0x7184('0x41')](_0x8e99ba[_0x7184('0x71')][_0x7184('0x72')]))){_0x8e99ba[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];throw _0x8e99ba[_0x7184('0x3f')]+_0x7184('0x73');}};}function checkIsIVRCampaignActive(_0x3a6bb4){return function(){if(!utils['isIVRCampaignActive'](_0x3a6bb4)){_0x3a6bb4[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x74')];throw _0x3a6bb4['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x28783f){if(utils[_0x7184('0x75')](_0x28783f)){emit(util[_0x7184('0x76')](_0x7184('0x77'),_0x28783f[_0x7184('0x3f')]),_0x7184('0x78'),_0x28783f);}}function loggerCatchQueueSummary(_0x4d5e0b,_0x323e8e){return function(_0x5c2054){clearPredictiveAttributes(_0x323e8e);emitCampaignSummary(_0x323e8e);loggerSyncQueueSummary[_0x7184('0x5a')](_0x4d5e0b,util[_0x7184('0x3d')](_0x5c2054,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1f85d2){if(_0x1f85d2['sendMessageOneNotActive']){if(_0x1f85d2[_0x7184('0x79')]===0x0){_0x1f85d2['sendMessageOneNotActive']=![];_0x1f85d2[_0x7184('0x62')]=utils['CAMPAIGN_STATUS'][_0x7184('0x74')];loggerSyncQueueSummary['debug']('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1f85d2[_0x7184('0x3f')],_0x7184('0x7a'));}else{_0x1f85d2[_0x7184('0x62')]=utils['CAMPAIGN_STATUS'][_0x7184('0x7b')];loggerSyncQueueSummary[_0x7184('0x5a')](_0x7184('0x7c'),_0x1f85d2[_0x7184('0x3f')],'is\x20deactivated');}emitCampaignSummary(_0x1f85d2);}}function myreject(_0x439865){return function(_0x37f2da){return _0x439865(msgResponse(_0x7184('0x7d'),_0x7184('0x7e'),JSON[_0x7184('0x6e')](_0x37f2da)));};}Dialer['prototype']['isTrunkReachable']=function(_0x4367c6){return!_['isUndefined'](_0x4367c6)&&_0x4367c6&&!_[_0x7184('0x3a')](_0x4367c6['name'])&&!_[_0x7184('0x3a')](_0x4367c6[_0x7184('0x7f')])&&_0x4367c6['active']&&(this[_0x7184('0x23')][util[_0x7184('0x76')]('SIP/%s',_0x4367c6['name'])][_0x7184('0x80')]===_0x7184('0x81')||this[_0x7184('0x23')][util['format'](_0x7184('0x82'),_0x4367c6[_0x7184('0x3f')])][_0x7184('0x80')]===_0x7184('0x83'));};Dialer[_0x7184('0x1c')][_0x7184('0x84')]=function(_0x180aeb){var _0x158d04=this;return function(){if(!_0x158d04[_0x7184('0x85')](_0x180aeb[_0x7184('0x86')])){if(!_0x158d04[_0x7184('0x85')](_0x180aeb[_0x7184('0x87')])){_0x180aeb['message']=utils['CAMPAIGN_STATUS'][_0x7184('0x88')];throw _0x180aeb[_0x7184('0x3f')]+_0x7184('0x89');}}};};Dialer[_0x7184('0x1c')][_0x7184('0x8a')]=function(_0x152d64,_0x5733fb,_0x513a9e,_0x53049a){var _0x478f95=this;return function(){var _0x1a04d4=!![];return _0x478f95[_0x7184('0x8b')](_0x152d64,_0x5733fb,_0x513a9e,_0x53049a,_0x1a04d4);};};Dialer[_0x7184('0x1c')]['checkIfTimeIntervals']=function(_0x381de7,_0x518ba9,_0x20cbb7,_0x54f6c1){var _0x552c77=this;return function(){var _0x53e2fe=![];return _0x552c77[_0x7184('0x8b')](_0x381de7[_0x7184('0x72')],_0x518ba9,_0x20cbb7,_0x54f6c1,_0x53e2fe);};};Dialer[_0x7184('0x1c')]['ifTimeIvr']=function(_0x384f3e,_0x3c6bd6,_0xf1c091,_0x351881,_0x4a5ad0){var _0x369f87=[];return new Promise(function(_0x1bbaab,_0x244b6a){if(!isNotNull(_0x384f3e)){_0x351881[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x70')];return _0x244b6a(msgResponse(_0x7184('0x8c'),_0x7184('0x8d'),_0xf1c091+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x384f3e)){_0x351881[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x8e')];return _0x244b6a(msgResponse(_0x7184('0x8c'),_0x7184('0x8d'),_0xf1c091+_0x7184('0x8f')));}if(_0x3c6bd6&&_[_0x7184('0x3a')](config[_0x7184('0x90')][_0x3c6bd6])){_0x351881[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x91')];return _0x244b6a(msgResponse('ifTime',_0x7184('0x8d'),_0xf1c091+_0x7184('0x92')+_0x3c6bd6));}if(_[_0x7184('0x93')](_0x384f3e)){for(var _0x20cb84=0x0;_0x20cb84<_0x384f3e[_0x7184('0x94')];_0x20cb84+=0x1){_0x369f87[_0x7184('0x95')](ami[_0x7184('0x96')]({'action':_0x7184('0x97'),'command':util[_0x7184('0x76')](_0x7184('0x98'),_0x384f3e[_0x20cb84][_0x7184('0x99')],!_[_0x7184('0x3a')](config[_0x7184('0x90')][_0x3c6bd6])?_0x3c6bd6:'')})[_0x7184('0x39')](function(_0x556860){return _0x556860['content'][_0x7184('0x9a')](_0x7184('0x9b'))>=0x0;})[_0x7184('0x9c')](myreject(_0x244b6a)));}}else{_0x369f87[_0x7184('0x95')](ami[_0x7184('0x96')]({'action':_0x7184('0x97'),'command':util['format'](_0x7184('0x98'),_0x384f3e,!_[_0x7184('0x3a')](config[_0x7184('0x90')][_0x3c6bd6])?_0x3c6bd6:'')})[_0x7184('0x39')](function(_0x18485d){return _0x18485d[_0x7184('0x9d')][_0x7184('0x9a')](_0x7184('0x9b'))>=0x0;})[_0x7184('0x9c')](myreject(_0x244b6a)));}Promise['all'](_0x369f87)[_0x7184('0x39')](function(_0x8b0e1){var _0x219ec7=_['some'](_0x8b0e1);if(_0x219ec7){return _0x1bbaab(_0x219ec7);}else{_0x351881[_0x7184('0x62')]=_0x4a5ad0?utils[_0x7184('0x63')]['OVERTIME_GLOBAL_INTERVAL']:utils['CAMPAIGN_STATUS'][_0x7184('0x9e')];return _0x244b6a(msgResponse(_0x7184('0x9f'),_0x7184('0x8d'),_0x7184('0xa0')+_0x4a5ad0+'\x20'+_0xf1c091+'\x20Interval\x20is\x20overtime:\x20'+util[_0x7184('0x3d')](_0x384f3e,{'showHidden':![],'depth':null})+_0x7184('0xa1')+_0x3c6bd6));}})[_0x7184('0x9c')](function(_0x56c5b3){return _0x244b6a(msgResponse('ifTime',_0x7184('0x8d'),JSON[_0x7184('0x6e')](_0x56c5b3)));});});};Dialer[_0x7184('0x1c')]['loopCampaigns']=function(){var _0x1bbe29=this;return cmHopper[_0x7184('0xa2')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x1bbe29['syncCampaigns']();},0x3e8);});};Dialer[_0x7184('0x1c')][_0x7184('0xa3')]=function(){var _0x303533=this;var _0x57fe4c;for(var _0x2d4540 in this[_0x7184('0x21')]){if(typeof this[_0x7184('0x21')][_0x2d4540]!==_0x7184('0xa4')){_0x57fe4c=this[_0x7184('0x21')][_0x2d4540];if(utils['isIVRCampaign'](_0x57fe4c)&&utils[_0x7184('0xa5')](_0x57fe4c)){_0x57fe4c['sendMessageOneNotActive']=!![];Promise[_0x7184('0xa6')]()['then'](checkIsIVRCampaignActive(_0x57fe4c))[_0x7184('0x39')](checkInterval(_0x57fe4c))[_0x7184('0x39')](_0x303533['checkIsTrunkReachable'](_0x57fe4c))[_0x7184('0x39')](_0x303533[_0x7184('0x8a')](_0x57fe4c['dialGlobalInterval'],_0x57fe4c[_0x7184('0xa7')],_0x57fe4c[_0x7184('0x3f')],_0x57fe4c))[_0x7184('0x39')](_0x303533[_0x7184('0xa8')](_0x57fe4c[_0x7184('0x71')],_0x57fe4c[_0x7184('0xa7')],_0x57fe4c[_0x7184('0x3f')],_0x57fe4c))[_0x7184('0x39')](_0x303533[_0x7184('0xa9')](_0x57fe4c))[_0x7184('0x9c')](loggerCatchQueueSummary('[syncCampaigns]',_0x57fe4c));}else{notSendMessagesCampaign(_0x57fe4c);}}}};Dialer['prototype'][_0x7184('0xaa')]=function(_0x5a1c74){if(_0x5a1c74[_0x7184('0xab')]!==_0x7184('0x8')){clearPredictiveAttributes(_0x5a1c74);}switch(_0x5a1c74[_0x7184('0xab')]){case _0x7184('0xac'):this['handlePower'](_0x5a1c74,0x1);break;case _0x7184('0xad'):this[_0x7184('0xae')](_0x5a1c74,_0x5a1c74[_0x7184('0xaf')]);break;case _0x7184('0x8'):this['predictive'](_0x5a1c74);break;case'booked':this['handlePower'](_0x5a1c74,0x1);break;default:logger[_0x7184('0x60')](_0x7184('0xb0'),_0x5a1c74[_0x7184('0x3f')],_0x7184('0xb1'));}};Dialer[_0x7184('0x1c')]['ifTime']=function(_0x34cf5f,_0x504a73){var _0x997de1=_0x34cf5f[_0x7184('0xa7')];var _0x23a1f1=_0x504a73?_0x34cf5f[_0x7184('0xb2')]:_0x34cf5f[_0x7184('0x71')][_0x7184('0x72')];logger['silly'](_0x7184('0xb3'),_0x23a1f1,_0x997de1,_0x34cf5f['name'],util[_0x7184('0x76')](_0x7184('0xb4'),_0x34cf5f[_0x7184('0x3f')],_0x34cf5f['id']));var _0x598a2f=null;return Interval['intervalIftime'](_0x23a1f1,_0x997de1)[_0x7184('0x39')](function(_0xfd34e5){if(_0xfd34e5===!![]){return _0xfd34e5;}else{_0x34cf5f[_0x7184('0x62')]=_0x504a73?utils['CAMPAIGN_STATUS'][_0x7184('0xb5')]:utils[_0x7184('0x63')][_0x7184('0x9e')];_0x598a2f=msgResponse(_0x7184('0x9f'),_0x7184('0x8d'),_0x7184('0xa0')+_0x504a73+'\x20'+_0x34cf5f[_0x7184('0x3f')]+_0x7184('0xb6')+util['inspect'](_0x23a1f1,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x997de1);}if(_0x598a2f!==null){logger[_0x7184('0xb7')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x598a2f);_0x598a2f[_0x7184('0xb8')]=_0x504a73;throw _0x598a2f;}})[_0x7184('0x9c')](function(_0x2907c0){logger[_0x7184('0x60')](_0x7184('0xb9'),_0x2907c0);throw msgResponse(_0x7184('0x7d'),_0x7184('0x7e'),util[_0x7184('0x3d')](_0x2907c0,{'showHidden':![],'depth':null}));});};Dialer[_0x7184('0x1c')][_0x7184('0xba')]=function(_0x3ba9ba){if(this[_0x7184('0x20')][_0x3ba9ba['queue']]){if(this['uniqueId'][_0x3ba9ba['uniqueid']]&&this[_0x7184('0xbb')][_0x3ba9ba['uniqueid']][_0x7184('0xbc')]!=='ivr'){utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x3ba9ba[_0x7184('0xbe')]],_0x7184('0xbf'));this[_0x7184('0xbb')][_0x3ba9ba[_0x7184('0xc0')]][_0x7184('0xc1')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));}}};Dialer[_0x7184('0x1c')][_0x7184('0x2f')]=function(_0x5aa5c0){var _0x28b50e=this[_0x7184('0xbb')][_0x5aa5c0[_0x7184('0xc0')]];if(this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]]){if(_0x28b50e&&_0x28b50e[_0x7184('0xbc')]!=='ivr'){delete this[_0x7184('0xbb')][_0x5aa5c0[_0x7184('0xc0')]];this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]]['outboundAnswerCallsDay']+=0x1;var _0x354e0c=new AgentComplete(_0x28b50e,_0x5aa5c0);if(_0x5aa5c0[_0x7184('0xc3')]===_0x7184('0xc4')){_0x354e0c[_0x7184('0xc5')]=this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]]['dialQueueProject2']&&this[_0x7184('0x20')][_0x5aa5c0[_0x7184('0xbe')]][_0x7184('0xc6')]?moment()[_0x7184('0x76')](_0x7184('0xc2')):undefined;}hopperUtils[_0x7184('0xc7')](_0x354e0c)[_0x7184('0x9c')](loggerCatch(_0x7184('0xc8')));hopperUtils[_0x7184('0xc9')](_0x354e0c)[_0x7184('0x9c')](loggerCatch(_0x7184('0xca')));}}};Dialer[_0x7184('0x1c')][_0x7184('0x2a')]=function(_0x1f0eb6){var _0x2b243d=this[_0x7184('0xbb')][_0x1f0eb6[_0x7184('0xc0')]];var _0x5e616a=this;var _0x4ea0f7=![];var _0x1ff6ae;var _0x59c2c7;if(this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]){if(_0x2b243d&&_0x2b243d[_0x7184('0xbc')]!==_0x7184('0xcb')){delete this[_0x7184('0xbb')][_0x1f0eb6[_0x7184('0xc0')]];utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x1f0eb6['queue']],_0x7184('0xcc'));_0x2b243d[_0x7184('0xcd')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));var _0x4cd065=new QueueCallerAbandon(_0x2b243d,_0x1f0eb6);if(utils[_0x7184('0xce')](_0x2b243d[_0x7184('0xcd')],_0x2b243d[_0x7184('0xcf')])>=_0x2b243d[_0x7184('0xd0')]){this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x7184('0x20')][_0x1f0eb6['queue']][_0x7184('0xd1')]+=0x1;this['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xd2')]+=0x1;_0x4cd065['state']=0xa;_0x4cd065[_0x7184('0x69')]=_0x7184('0xd3');_0x4cd065[_0x7184('0xd4')]=_0x7184('0xd5');_0x4cd065[_0x7184('0xc5')]=this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['dialQueueProject2']?moment()[_0x7184('0x76')](_0x7184('0xc2')):undefined;_0x4cd065['countdropretry']+=0x1;_0x4cd065[_0x7184('0xd6')]+=0x1;_0x1ff6ae=this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['dialDropRetryFrequency'];_0x59c2c7=this['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xd7')];hopperUtils[_0x7184('0xd8')](_0x4cd065,_0x4cd065[_0x7184('0x68')],_0x2b243d[_0x7184('0xd9')])['then'](function(_0x4e022a){_0x4ea0f7=_0x4e022a[_0x7184('0xda')]==0x1;if(_0x4cd065[_0x7184('0xdb')]>=_0x5e616a['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xdc')]){_0x5e616a[_0x7184('0xdd')](_0x4cd065,_0x4e022a[_0x7184('0xda')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4cd065[_0x7184('0xdb')],'scheduledat':moment()['add'](_0x5e616a['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xde')],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b243d[_0x7184('0xe0')],'ListId':_0x2b243d[_0x7184('0xe1')],'VoiceQueueId':_0x2b243d[_0x7184('0xe2')]||undefined,'CampaignId':_0x2b243d[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0xe4')));var _0x16f818=new History(_0x4cd065);_0x16f818[_0x7184('0x68')]=0xa;_0x16f818[_0x7184('0x69')]=_0x7184('0xd3');_0x16f818[_0x7184('0x6b')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));_0x16f818[_0x7184('0x6a')]=_0x16f818[_0x7184('0x6b')];_0x16f818[_0x7184('0xe5')]=_0x4cd065[_0x7184('0xe5')];_0x16f818['calleridnum']=_0x4cd065[_0x7184('0xe6')];hopperUtils[_0x7184('0xc7')](_0x16f818)['catch'](loggerCatch(_0x7184('0xe7')));}})[_0x7184('0x39')](function(){if(_0x4ea0f7)hopperUtils[_0x7184('0xe8')](_0x4cd065,_0x1ff6ae,_0x59c2c7)[_0x7184('0x39')](function(){return 0x1;});});}else{this[_0x7184('0x20')][_0x1f0eb6['queue']]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xe9')]+=0x1;_0x4cd065['state']=0xb;_0x4cd065[_0x7184('0x69')]='Abandoned';_0x4cd065[_0x7184('0xd4')]=_0x7184('0xea');_0x4cd065[_0x7184('0xeb')]+=0x1;_0x4cd065[_0x7184('0xd6')]+=0x1;_0x1ff6ae=this['voiceQueues'][_0x1f0eb6[_0x7184('0xbe')]]['dialAbandonedRetryFrequency'];_0x59c2c7=this[_0x7184('0x20')][_0x1f0eb6['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x7184('0xd8')](_0x4cd065,_0x4cd065[_0x7184('0x68')],_0x2b243d[_0x7184('0xd9')])[_0x7184('0x39')](function(_0x2ba6dd){if(_0x4cd065['countabandonedretry']>=_0x5e616a[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]]['dialAbandonedMaxRetry']){_0x5e616a[_0x7184('0xdd')](_0x4cd065,_0x2ba6dd[_0x7184('0xda')]);}else{hopperUtils[_0x7184('0xec')]({'active':![],'countabandonedretry':_0x4cd065[_0x7184('0xeb')],'scheduledat':moment()['add'](_0x5e616a[_0x7184('0x20')][_0x1f0eb6[_0x7184('0xbe')]][_0x7184('0xed')],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b243d[_0x7184('0xe0')],'ListId':_0x2b243d[_0x7184('0xe1')],'VoiceQueueId':_0x2b243d[_0x7184('0xe2')]||undefined,'CampaignId':_0x2b243d['CampaignId']||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0xee')));var _0x5dc9e8=new History(_0x4cd065);_0x5dc9e8[_0x7184('0x68')]=0xb;_0x5dc9e8[_0x7184('0x69')]='Abandoned';_0x5dc9e8['starttime']=moment()[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss');_0x5dc9e8[_0x7184('0x6a')]=_0x5dc9e8[_0x7184('0x6b')];_0x5dc9e8[_0x7184('0xe5')]=_0x4cd065[_0x7184('0xe5')];_0x5dc9e8[_0x7184('0xe6')]=_0x4cd065[_0x7184('0xe6')];hopperUtils['createHistory'](_0x5dc9e8)[_0x7184('0x9c')](loggerCatch(_0x7184('0xef')));}})[_0x7184('0x39')](function(){if(_0x4ea0f7)hopperUtils[_0x7184('0xe8')](_0x4cd065,_0x1ff6ae,_0x59c2c7)[_0x7184('0x39')](function(){return 0x1;});});}}}};Dialer[_0x7184('0x1c')][_0x7184('0x35')]=function(_0x548ddc){if(this[_0x7184('0xf0')][_0x548ddc[_0x7184('0xc0')]]){this[_0x7184('0xf0')][_0x548ddc[_0x7184('0xc0')]][_0x7184('0xf1')]=_0x548ddc[_0x7184('0xf1')];}if(this['uniqueId'][_0x548ddc[_0x7184('0xc0')]]){this[_0x7184('0xbb')][_0x548ddc[_0x7184('0xc0')]][_0x7184('0xf1')]=_0x548ddc[_0x7184('0xf1')];}};Dialer[_0x7184('0x1c')][_0x7184('0xf2')]=function(_0x5bfbae){if(!this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]){return;}var _0x4b1ad9=this['voiceQueues'][this['actions'][_0x5bfbae[_0x7184('0xf3')]][_0x7184('0xbe')]][_0x7184('0xf4')]||_0x7184('0xf5');if(_0x4b1ad9===_0x7184('0xf6')){if(this['actions'][_0x5bfbae['actionid']]&&_[_0x7184('0xf7')](this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]][_0x7184('0xf8')])&&_0x5bfbae['status']==='1'&&_0x5bfbae[_0x7184('0xf9')]==='0'){if(this[_0x7184('0x22')][_0x5bfbae[_0x7184('0xfa')]]){if(!this[_0x7184('0x22')][_0x5bfbae[_0x7184('0xfa')]]['locked']){this['agents'][_0x5bfbae[_0x7184('0xfa')]][_0x7184('0xf8')]=!![];this['actions'][_0x5bfbae['actionid']][_0x7184('0xf8')]=!![];this['actions'][_0x5bfbae[_0x7184('0xf3')]]['stateinterface']=_0x5bfbae['stateinterface'];}}}}else if(_0x4b1ad9===_0x7184('0xf5')){if(this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]){if(this['agents'][_0x5bfbae[_0x7184('0xfa')]]){this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]][_0x7184('0xfa')]=_0x5bfbae[_0x7184('0xfa')];if(_[_0x7184('0xf7')](this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]['queue']])){this['queueBooked'][this[_0x7184('0xf0')][_0x5bfbae['actionid']][_0x7184('0xbe')]]=[];}this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x5bfbae[_0x7184('0xf3')]]['queue']][_0x7184('0x95')](_[_0x7184('0x59')](_[_0x7184('0x6f')](this[_0x7184('0xf0')][_0x5bfbae['actionid']],[_0x7184('0xfb'),'stateinterface']),{'status':_0x5bfbae[_0x7184('0x80')],'paused':_0x5bfbae[_0x7184('0xf9')]}));}}}};Dialer[_0x7184('0x1c')][_0x7184('0xfc')]=function(_0x3abbcd){if(!this['actions'][_0x3abbcd['actionid']]){return;}var _0x54f9f3=this;var _0x50e20b=this[_0x7184('0x20')][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]];var _0x252d2b=_0x50e20b['strategy']||_0x7184('0xf5');if(_0x252d2b===_0x7184('0xf6')){if(this[_0x7184('0xf0')][_0x3abbcd['actionid']]&&this['actions'][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xfa')]){this[_0x7184('0xfd')][_0x7184('0xfe')](this['actions'][_0x3abbcd['actionid']][_0x7184('0xfb')],this['actions'][_0x3abbcd['actionid']][_0x7184('0xfa')])[_0x7184('0x9c')](function(_0x57193e){logger[_0x7184('0x60')](_0x7184('0xff'),util['inspect'](_0x57193e,{'showHidden':![],'depth':null}));})['finally'](function(){utils[_0x7184('0xbd')](_0x54f9f3[_0x7184('0x20')][_0x54f9f3['actions'][_0x3abbcd[_0x7184('0xf3')]]['queue']],_0x7184('0x100'));_0x54f9f3['agents'][_0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]]['stateinterface']][_0x7184('0xf8')]=![];delete _0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]];unlockQueueStatus(_0x50e20b);});}else{utils[_0x7184('0xbd')](this['voiceQueues'][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]],_0x7184('0x100'));hopperUtils['rescheduleContact']({'active':![],'ContactId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xe0')],'ListId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xe1')],'VoiceQueueId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x7184('0xf0')][_0x3abbcd['actionid']];unlockQueueStatus(_0x50e20b);}}else if(_0x252d2b===_0x7184('0xf5')){var _0x292994;if(this['actions'][_0x3abbcd[_0x7184('0xf3')]]&&!_[_0x7184('0x41')](this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x3abbcd['actionid']][_0x7184('0xbe')]])){if(this[_0x7184('0x101')][_0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]){this[_0x7184('0x101')][_0x54f9f3[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]=this[_0x7184('0x101')][this[_0x7184('0xf0')][_0x3abbcd['actionid']][_0x7184('0xbe')]]?this[_0x7184('0x101')][this['actions'][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]:this[_0x7184('0x29')][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]]?this[_0x7184('0x29')][this['actions'][_0x3abbcd['actionid']]['queue']]['_rr']||0x0:0x0;}this[_0x7184('0x29')][this['actions'][_0x3abbcd[_0x7184('0xf3')]]['queue']][_0x7184('0x102')]=this[_0x7184('0x101')][this[_0x7184('0xf0')][_0x3abbcd[_0x7184('0xf3')]][_0x7184('0xbe')]];for(var _0x20e3af=0x0;_0x20e3af=_0x2401d9['dialGlobalMaxRetry']){_0xdcc304[_0x7184('0x127')](_0x446b8a,_0x517953,_0x4fa899,'reason19\x20machine....');}else{if(_0x446b8a[_0x7184('0x122')]>=_0x2401d9[_0x7184('0x128')]){_0xdcc304[_0x7184('0x129')](_0x446b8a,_0x517953,_0x4fa899,_0x7184('0x12a'));}else{hopperUtils[_0x7184('0xec')]({'active':![],'countmachineretry':_0x446b8a['countmachineretry'],'scheduledat':moment()[_0x7184('0x12b')](_0x2401d9[_0x7184('0x12c')],_0x7184('0xdf'))[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x446b8a['ContactId'],'ListId':_0x446b8a['ListId'],'VoiceQueueId':_0x446b8a[_0x7184('0xe2')]||undefined,'CampaignId':_0x446b8a[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[rescheduleContact][Machine]'));_0x517953({'reschedule':0x1});}}});}if(_0x33d973[_0x7184('0xbc')]===_0x7184('0xcb')&&this[_0x7184('0x21')][_0x33d973['queue']][_0x7184('0x113')]&&_0x12382d[_0x7184('0x114')]==='HANGUP'){delete this[_0x7184('0xbb')][_0x12382d[_0x7184('0xc0')]];utils['decrementOriginate'](this[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]],_0x7184('0x116'));_0x2c9e1a=new Hangup(_0x33d973,_0x12382d);_0x2c9e1a[_0x7184('0x68')]=0x12;_0x2c9e1a[_0x7184('0x69')]='HangupInAMD';_0x2c9e1a[_0x7184('0x11a')]=_0x7184('0x11b');ami['emit']('custom:amd',ut[_0x7184('0x11d')](_0x2c9e1a,'amd'));this[_0x7184('0x12d')](_0x2c9e1a,_0x7184('0x12e'),_0x7184('0x12f'));}if(_0x33d973[_0x7184('0xbc')]===_0x7184('0xcb')&&this[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]][_0x7184('0x113')]&&_0x12382d[_0x7184('0x114')]===_0x7184('0x120')){return new Promise(function(_0x40e26c,_0x4ae597){delete _0xdcc304[_0x7184('0xbb')][_0x12382d[_0x7184('0xc0')]];utils[_0x7184('0xbd')](_0xdcc304[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]],_0x7184('0x116'));_0xdcc304[_0x7184('0x21')][_0x33d973[_0x7184('0xbe')]][_0x7184('0x117')]+=0x1;_0xdcc304[_0x7184('0x21')][_0x33d973['queue']][_0x7184('0x118')]+=0x1;var _0xf88953=_0xdcc304[_0x7184('0x21')][_0x33d973['queue']];var _0x1cb92e=new Hangup(_0x33d973,_0x12382d);_0x1cb92e[_0x7184('0x68')]=0x13;_0x1cb92e['statedesc']=_0x7184('0x121');_0x1cb92e[_0x7184('0x11a')]=_0x7184('0x11b');_0x1cb92e[_0x7184('0x122')]+=0x1;_0x1cb92e[_0x7184('0xd6')]+=0x1;_0x1cb92e[_0x7184('0x11e')]=!![];ami[_0x7184('0x3b')](_0x7184('0x11c'),ut[_0x7184('0x11d')](_0x1cb92e,_0x7184('0x11e')));hopperUtils[_0x7184('0xc7')](_0x1cb92e)[_0x7184('0x9c')](loggerCatch(_0x7184('0x130')));if(_0x1cb92e[_0x7184('0x123')]+_0x1cb92e[_0x7184('0x124')]+_0x1cb92e[_0x7184('0x125')]+_0x1cb92e[_0x7184('0x131')]+_0x1cb92e[_0x7184('0xdb')]+_0x1cb92e[_0x7184('0xeb')]+_0x1cb92e[_0x7184('0x122')]+_0x1cb92e[_0x7184('0x126')]>=_0xf88953['dialGlobalMaxRetry']){_0xdcc304['stateGlobal'](_0x1cb92e,_0x40e26c,_0x4ae597,_0x7184('0x132'));}else{if(_0x1cb92e['countmachineretry']>=_0xf88953[_0x7184('0x128')]){_0xdcc304[_0x7184('0x129')](_0x1cb92e,_0x40e26c,_0x4ae597,_0x7184('0x12a'));}else{hopperUtils[_0x7184('0xec')]({'active':![],'countmachineretry':_0x1cb92e['countmachineretry'],'scheduledat':moment()[_0x7184('0x12b')](_0xf88953[_0x7184('0x12c')],'minutes')[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x1cb92e['ContactId'],'ListId':_0x1cb92e['ListId'],'VoiceQueueId':_0x1cb92e[_0x7184('0xe2')]||undefined,'CampaignId':_0x1cb92e['CampaignId']||undefined})[_0x7184('0x9c')](loggerCatch('[rescheduleContact][Machine]'));_0x40e26c({'reschedule':0x1});}}});}}};Dialer[_0x7184('0x1c')][_0x7184('0x33')]=function(_0x2bcfb4){var _0x5b5938=this['uniqueId'][_0x2bcfb4[_0x7184('0xc0')]];var _0x3c90cc;if(!_0x5b5938){return;}if(_0x5b5938[_0x7184('0xbc')]===_0x7184('0xcb')){delete this[_0x7184('0xbb')][_0x2bcfb4[_0x7184('0xc0')]];utils['decrementOriginate'](this[_0x7184('0x21')][_0x5b5938['queue']],_0x7184('0x133'));this['campaigns'][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x134')]+=0x1;if(_0x2bcfb4[_0x7184('0x135')]==='Normal\x20Clearing'){const _0x5ca507=new AgentComplete(_0x5b5938,_0x2bcfb4);_0x5ca507[_0x7184('0xe3')]=this[_0x7184('0x21')][_0x5b5938['queue']]['id'];hopperUtils[_0x7184('0xc7')](_0x5ca507)[_0x7184('0x9c')](loggerCatch('[syncAgentCompleteIvr][createHistory]'));hopperUtils[_0x7184('0xc9')](_0x5ca507)[_0x7184('0x9c')](loggerCatch(_0x7184('0x136')));}else{_0x3c90cc=new Hangup(_0x5b5938,_0x2bcfb4);hopperUtils[_0x7184('0xc7')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7184('0xc9')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x137')));}}else{if(isNotNull(this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x138')])){delete this[_0x7184('0xbb')][_0x2bcfb4[_0x7184('0xc0')]];utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x5b5938['queue']],_0x7184('0x133'));this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x117')]+=0x1;this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x118')]+=0x1;_0x3c90cc=new Hangup(_0x5b5938,_0x2bcfb4);_0x3c90cc[_0x7184('0x68')]=0x10;_0x3c90cc[_0x7184('0x69')]='AnswerAGI';_0x3c90cc[_0x7184('0x11a')]=_0x7184('0x139');hopperUtils[_0x7184('0xc7')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x13a')));hopperUtils[_0x7184('0xc9')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x137')));}else{delete this['uniqueId'][_0x2bcfb4[_0x7184('0xc0')]];utils[_0x7184('0xbd')](this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]],_0x7184('0x13b'));if(_0x2bcfb4['cause-txt']===_0x7184('0x13c')){this[_0x7184('0x20')][_0x5b5938['queue']][_0x7184('0x117')]+=0x1;const _0x43be6c=new AgentComplete(_0x5b5938,_0x2bcfb4);_0x43be6c[_0x7184('0xe2')]=this['voiceQueues'][_0x5b5938['queue']]['id'];hopperUtils[_0x7184('0xc7')](_0x43be6c)['catch'](loggerCatch(_0x7184('0xc8')));hopperUtils['moveContactManagedDialer'](_0x43be6c)['catch'](loggerCatch(_0x7184('0xca')));}else{this[_0x7184('0x20')][_0x5b5938[_0x7184('0xbe')]][_0x7184('0x13d')]+=0x1;_0x3c90cc=new Hangup(_0x5b5938,_0x2bcfb4);_0x3c90cc['state']=0xc;_0x3c90cc['statedesc']=_0x2bcfb4[_0x7184('0x135')];_0x3c90cc[_0x7184('0x11a')]='Unknown';hopperUtils[_0x7184('0xc7')](_0x3c90cc)[_0x7184('0x9c')](loggerCatch(_0x7184('0x13e')));hopperUtils[_0x7184('0xc9')](_0x3c90cc)['catch'](loggerCatch(_0x7184('0x133')));}}}};Dialer[_0x7184('0x1c')][_0x7184('0x9')]=function(_0x5e5076){var _0xa7e220=this;if(!_0xa7e220[_0x7184('0x13f')][_0x5e5076[_0x7184('0x3f')]]){_0xa7e220[_0x7184('0x13f')][_0x5e5076[_0x7184('0x3f')]]={'running':![]};}else if(_0xa7e220['queuesSummary'][_0x5e5076[_0x7184('0x3f')]]['running']===!![]){return;}else if(_0xa7e220['queuesSummary'][_0x5e5076[_0x7184('0x3f')]][_0x7184('0x140')]===![]){_0xa7e220[_0x7184('0x13f')][_0x5e5076[_0x7184('0x3f')]][_0x7184('0x140')]=!![];}var _0x5979c2=_0xa7e220['voiceQueues'][_0x5e5076[_0x7184('0x3f')]];var _0x4c5dc5=_0x5979c2[_0x7184('0x62')]!==utils['CAMPAIGN_STATUS']['INACTIVE'];var _0x28f05d=utils[_0x7184('0x141')](_0x5979c2);_0x5979c2['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x5979c2,_0xa7e220['trunks']);Promise[_0x7184('0xa6')]()[_0x7184('0x39')](function(){if(_0x5979c2[_0x7184('0x142')]===utils[_0x7184('0x63')][_0x7184('0x74')]){if(_0x4c5dc5){clearPredictiveAttributes(_0x5979c2);_0x5e5076[_0x7184('0x5c')]=undefined;_0x5e5076['startProgressive']=undefined;}if(_0x5979c2['statusMessage']===utils[_0x7184('0x63')][_0x7184('0x74')]){_0x5e5076['available']=0x0;_0x5e5076[_0x7184('0xf9')]=0x0;_0x5e5076[_0x7184('0x143')]=0x0;_0x5e5076['talking']=0x0;_0x5e5076['pTalking']=0x0;}}else if(_0x5979c2[_0x7184('0x142')]===utils['CAMPAIGN_STATUS']['ACTIVE']&&!_0x28f05d){return _0xa7e220['ifTime'](_0x5979c2,!![])['then'](function(){return _0xa7e220['ifTime'](_0x5979c2,![]);})[_0x7184('0x39')](function(){return _0xa7e220[_0x7184('0xaa')](_0x5979c2);})['catch'](function(_0xd97538){loggerSyncQueueSummary['debug'](_0x7184('0x144'),util[_0x7184('0x3d')](_0xd97538,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x5979c2);});}else{clearPredictiveAttributes(_0x5979c2);}})[_0x7184('0x39')](function(){var _0x43fccb=_0x5e5076[_0x7184('0x145')](_0x5979c2);if(_0x43fccb||_0x5979c2[_0x7184('0x146')]){_0x5979c2[_0x7184('0x146')]=![];_0x5e5076[_0x7184('0x147')](_0x5979c2);Object[_0x7184('0x148')](_0x5979c2,_0x5e5076);emitOutboundVoiceQueueSummary(_0x5e5076);}_0xa7e220[_0x7184('0x13f')][_0x5979c2[_0x7184('0x3f')]]['running']=![];})['catch'](function(_0x24f28f){logger[_0x7184('0x60')](_0x7184('0x144'),util[_0x7184('0x3d')](_0x24f28f,{'showHidden':![],'depth':null}));_0xa7e220[_0x7184('0x13f')][_0x5979c2[_0x7184('0x3f')]][_0x7184('0x140')]=![];});};Dialer[_0x7184('0x1c')][_0x7184('0x31')]=_[_0x7184('0x149')](function(){var _0x2f1f7e=_[_0x7184('0x14a')](this['voiceQueues'],function(_0x5abe08){return _0x5abe08[_0x7184('0x14b')];});var _0x50695d=_[_0x7184('0x14a')](this[_0x7184('0x22')],function(_0x1eb28a){return _0x1eb28a['online']&&_0x1eb28a[_0x7184('0x80')]===_0x7184('0x81');});if(_0x2f1f7e[_0x7184('0x94')]>0x0&&_0x50695d[_0x7184('0x94')]>0x0){return Promise['resolve']()[_0x7184('0x39')](cmHopper[_0x7184('0x14c')](_[_0x7184('0x14d')](_0x2f1f7e,'id'),previewRecallmeReminderInterval,_[_0x7184('0x14d')](_0x50695d,'id')))[_0x7184('0x39')](function(_0x2606be){for(var _0x5cbed9=0x0;_0x5cbed9<_0x2606be[_0x7184('0x94')];_0x5cbed9++){var _0x2edb80=_0x2606be[_0x5cbed9]['Agent'][_0x7184('0x3f')];if(_0x2edb80)io['to'](util['format'](_0x7184('0x14e'),_0x2edb80))['emit'](_0x7184('0x14f'),{'hopper':_0x2606be[_0x5cbed9]});}})[_0x7184('0x9c')](function(_0x410fe6){logger[_0x7184('0x60')](_0x7184('0x150'),_0x410fe6);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7184('0x1c')][_0x7184('0x38')]=function(){var _0x4dd117=this;setInterval(function(){_0x4dd117[_0x7184('0x151')](_0x4dd117[_0x7184('0xbb')],'[uniqueid]');_0x4dd117['clearZombieChannels'](_0x4dd117['actions'],_0x7184('0x152'));},0x32c8);};Dialer[_0x7184('0x1c')][_0x7184('0x151')]=function(_0x1b0380,_0x24371d){var _0xd50c06=this;for(var _0x1d838f in _0x1b0380){if(typeof _0x1b0380[_0x1d838f]!=='undefined'){this[_0x7184('0x1f')][_0x7184('0x1d')](function(){if(!_[_0x7184('0xf7')](_0x1b0380[_0x1d838f])){return ami[_0x7184('0x96')]({'action':_0x7184('0x80'),'channel':_0x1b0380[_0x1d838f][_0x7184('0xf1')]})[_0x7184('0x9c')](function(_0x179b02){if(_0x179b02['message']===_0x7184('0x153')){setTimeout(function(){if(_0x1b0380[_0x1d838f]&&_0x1b0380[_0x1d838f][_0x7184('0xbc')]!==_0x7184('0xcb')){utils[_0x7184('0xbd')](_0xd50c06[_0x7184('0x20')][_0x1b0380[_0x1d838f]['queue']],_0x7184('0x154'));logger['error'](_0x7184('0x155'),_0x24371d,_0x1d838f,_0x1b0380[_0x1d838f][_0x7184('0xbe')]);delete _0x1b0380[_0x1d838f];}if(_0x1b0380[_0x1d838f]&&_0x1b0380[_0x1d838f]['type']===_0x7184('0xcb')){utils[_0x7184('0xbd')](_0xd50c06[_0x7184('0x21')][_0x1b0380[_0x1d838f]['queue']],_0x7184('0x154'));logger['error']('[Dialer][checkChannel][ivr]',_0x24371d,_0x1d838f,_0x1b0380[_0x1d838f][_0x7184('0xbe')]);delete _0x1b0380[_0x1d838f];}},0x2328);}});}});}}};Dialer['prototype'][_0x7184('0x156')]=function(_0x1ea144){return Promise[_0x7184('0xa6')]()[_0x7184('0x39')](voiceQueueRt[_0x7184('0x156')](_0x1ea144))[_0x7184('0x9c')](loggerCatch(_0x7184('0x157')));};Dialer['prototype'][_0x7184('0x158')]=function(_0x171c68,_0x39b19e,_0x205b27){var _0x38832d={'state':0x19,'statedesc':'notFound'};utils['decrementOriginate'](_0x39b19e,_0x7184('0x159')+_0x171c68);this['saveInDb'](_[_0x7184('0x59')](_0x38832d,_[_0x7184('0x6f')](_0x205b27,[_0x7184('0xe0'),_0x7184('0xe1'),_0x7184('0x15a'),'VoiceQueueId',_0x7184('0xe3')])),'[emptyContact][createHistory]',_0x7184('0x159'));logger[_0x7184('0x60')](_0x171c68);};Dialer[_0x7184('0x1c')][_0x7184('0x12d')]=function(_0x5bc374,_0x189d2f,_0x2d1bb2){hopperUtils[_0x7184('0xc7')](_0x5bc374)['catch'](loggerCatch(_0x189d2f));hopperUtils['moveContactManagedDialer'](_0x5bc374)['catch'](loggerCatch(_0x2d1bb2));};Dialer[_0x7184('0x1c')][_0x7184('0xdd')]=function(_0x44e77e,_0x315cb0){hopperUtils['createHistory'](_0x44e77e)['catch'](loggerCatch(_0x7184('0xc8')));if(_0x315cb0==0x0){hopperUtils['moveContactManagedDialer'](_0x44e77e)['catch'](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer['prototype'][_0x7184('0x150')]=function(_0x4fd038){return Promise[_0x7184('0xa6')]()[_0x7184('0x39')](cmHopper[_0x7184('0x14c')](_0x4fd038['id'],previewRecallmeReminderInterval))[_0x7184('0x39')](function(_0x1f97db){for(var _0x194e1d=0x0;_0x194e1d<_0x1f97db[_0x7184('0x94')];_0x194e1d++){var _0x3001bd=_0x1f97db[_0x194e1d][_0x7184('0x15b')][_0x7184('0x3f')];if(_0x3001bd)io['to'](util['format']('user:%s',_0x3001bd))['emit'](_0x7184('0x14f'),{'hopper':_0x1f97db[_0x194e1d]});}})[_0x7184('0x9c')](function(){});};Dialer[_0x7184('0x1c')]['launchHandleIvr']=function(_0x17d9d0){var _0x3bf92c=this;return function(){_0x3bf92c['handleIvr'](_0x17d9d0);};};Dialer[_0x7184('0x1c')][_0x7184('0x15c')]=function(_0x628754,_0x1db506){var _0x3d4cd7=this;var _0x2c4ae9=uuid['v4']();this['actions'][_0x2c4ae9]=new Action(_0x628754,_0x1db506,_0x2c4ae9);return new Promise(function(_0x4babcc,_0x200659){if(_[_0x7184('0x3a')](_0x628754)&&typeof _0x628754!==_0x7184('0x15d')){return _0x200659(msgResponse(_0x7184('0x15e'),_0x7184('0x8d'),_0x7184('0x15f')));}if(_[_0x7184('0x3a')](_0x1db506[_0x7184('0x160')])||_0x1db506['phone']===null){return _0x200659(msgResponse('originate',_0x7184('0x8d'),'contact\x20is\x20undefine'));}var _0x40c91e={'XMD-CALLERID':_0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9][_0x7184('0x161')](),'XMD-AGI':_0x628754[_0x7184('0x138')]?util[_0x7184('0x76')](_0x7184('0x162'),ipAgi,_0x628754[_0x7184('0x138')]):_0x7184('0x163'),'XMD-AGIAFTER':_0x628754[_0x7184('0x164')]?util['format'](_0x7184('0x162'),ipAgi,_0x628754[_0x7184('0x164')]):_0x7184('0x163'),'XMD-QUEUE':utils[_0x7184('0x165')](_0x628754)?util[_0x7184('0x76')](_0x7184('0x166'),_0x628754[_0x7184('0x3f')],_0x628754[_0x7184('0x167')]||'',_0x628754[_0x7184('0xc6')]?'c':'',_0x628754[_0x7184('0xd0')]||0x3):_0x7184('0x163'),'XMD-CONTACTID':_0x1db506[_0x7184('0xe0')],'XMD-CDRTYPE':_0x7184('0x6'),'CALLERID(all)':_0x3d4cd7['actions'][_0x2c4ae9][_0x7184('0x161')](),'XMD-AMD':_0x628754[_0x7184('0x113')]?'ACTIVE':_0x7184('0x163'),'XMD-DESTINATION':_0x7184('0x168')};if(_0x628754[_0x7184('0x113')]){_0x40c91e[_0x7184('0x169')]=_0x628754['dialAMDInitialSilence']||0x9c4;_0x40c91e['XMD-AMDGREETING']=_0x628754[_0x7184('0x16a')]||0x5dc;_0x40c91e[_0x7184('0x16b')]=_0x628754[_0x7184('0x16c')]||0x320;_0x40c91e[_0x7184('0x16d')]=_0x628754[_0x7184('0x16e')]||0x1388;_0x40c91e[_0x7184('0x16f')]=_0x628754[_0x7184('0x170')]||0x64;_0x40c91e[_0x7184('0x171')]=_0x628754['dialAMDBetweenWordsSilence']||0x32;_0x40c91e[_0x7184('0x172')]=_0x628754['dialAMDMaximumNumberOfWords']||0x3;_0x40c91e[_0x7184('0x173')]=_0x628754[_0x7184('0x174')]||0x100;_0x40c91e[_0x7184('0x175')]=_0x628754[_0x7184('0x176')]||0x1388;}if(utils['isOutboundQueue'](_0x628754)){_0x40c91e[_0x7184('0x177')]=_0x1db506[_0x7184('0xe2')];}else{_0x40c91e[_0x7184('0x178')]=_0x1db506['CampaignId'];}var _0x13ffd6=utils[_0x7184('0x179')](_0x1db506[_0x7184('0x17a')]);Object['assign'](_0x40c91e,_0x13ffd6);var _0x2f7613=_0x3d4cd7[_0x7184('0x85')](_0x628754[_0x7184('0x86')])?utils[_0x7184('0x17b')](_0x628754[_0x7184('0x86')][_0x7184('0x17c')],_0x628754[_0x7184('0x17d')],_0x628754[_0x7184('0x17e')]>0x0?utils[_0x7184('0x17f')](_0x628754[_0x7184('0x180')],_0x628754['dialRandomLastDigitCallerIdNumber']):_0x628754['dialOriginateCallerIdNumber']):utils[_0x7184('0x17b')](_['isNil'](_0x628754[_0x7184('0x87')])?_0x628754['Trunk'][_0x7184('0x17c')]:_0x628754[_0x7184('0x87')]['callerid'],_0x628754['dialOriginateCallerIdName'],_0x628754[_0x7184('0x17e')]>0x0?utils[_0x7184('0x17f')](_0x628754[_0x7184('0x180')],_0x628754['dialRandomLastDigitCallerIdNumber']):_0x628754[_0x7184('0x180')]);if(_0x2f7613){_0x40c91e[_0x7184('0x181')]=_0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9][_0x7184('0x182')]=utils[_0x7184('0x183')](_0x2f7613);_0x40c91e[_0x7184('0x184')]=_0x1db506[_0x7184('0x160')];}_0x628754[_0x7184('0x185')]=_0x40c91e;return ami['Action']({'actionid':_0x2c4ae9,'action':_0x7184('0x15e'),'channel':_0x3d4cd7[_0x7184('0x85')](_0x628754[_0x7184('0x86')])?util[_0x7184('0x76')](_0x7184('0x186'),_0x628754[_0x7184('0x86')]['name'],isNotNull(_0x628754[_0x7184('0x187')])?_0x628754[_0x7184('0x187')][_0x7184('0x188')]()||'':'',_0x628754[_0x7184('0x189')]>0x0?_0x1db506[_0x7184('0x160')]['substring'](_0x628754[_0x7184('0x189')]):_0x1db506[_0x7184('0x160')]):util[_0x7184('0x76')](_0x7184('0x186'),_[_0x7184('0xf7')](_0x628754[_0x7184('0x87')])?_0x628754[_0x7184('0x86')][_0x7184('0x3f')]:_0x628754['TrunkBackup'][_0x7184('0x3f')],isNotNull(_0x628754['dialPrefix'])?_0x628754[_0x7184('0x187')][_0x7184('0x188')]()||'':'',_0x628754[_0x7184('0x189')]>0x0?_0x1db506[_0x7184('0x160')][_0x7184('0x18a')](_0x628754[_0x7184('0x189')]):_0x1db506[_0x7184('0x160')]),'callerid':_0x2f7613,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x40c91e,'timeout':(_0x628754['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2c4ae9})[_0x7184('0x39')](function(_0x3e3e6c){return _0x4babcc(_0x3e3e6c);})[_0x7184('0x9c')](function(_0xe9b0af){_0x628754[_0x7184('0x18b')]+=0x1;var _0x156aa9=new History(_0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9]);logger[_0x7184('0x60')](util['format'](_0x7184('0x18c'),JSON[_0x7184('0x6e')](_0xe9b0af)));_0x156aa9['state']=0xe;_0x156aa9[_0x7184('0x69')]=_0x7184('0x18d');_0x156aa9[_0x7184('0x6b')]=moment()[_0x7184('0x76')](_0x7184('0xc2'));_0x156aa9[_0x7184('0x6a')]=_0x156aa9[_0x7184('0x6b')];hopperUtils['createHistory'](_0x156aa9)[_0x7184('0x9c')](loggerCatch(_0x7184('0x18e')));_0x3d4cd7[_0x7184('0xc9')](_0x156aa9)[_0x7184('0x9c')](loggerCatch(_0x7184('0x18e')))[_0x7184('0x107')](function(){delete _0x3d4cd7[_0x7184('0xf0')][_0x2c4ae9];return _0x200659(msgResponse('originate','Error',_0x7184('0x18f')));});});});};Dialer[_0x7184('0x1c')][_0x7184('0x190')]=function(_0x12eb71,_0x2a1175,_0xcf3ce){var _0x1c1a56=new History(_0x2a1175);if(_0x1c1a56[_0x7184('0x123')]+_0x1c1a56[_0x7184('0x124')]+_0x1c1a56[_0x7184('0x125')]+_0x1c1a56['countnosuchnumberretry']+_0x1c1a56['countdropretry']+_0x1c1a56[_0x7184('0xeb')]+_0x1c1a56[_0x7184('0x122')]+_0x1c1a56[_0x7184('0x126')]>=_0xcf3ce[_0x7184('0x191')]-0x1){return!![];}switch(_0x12eb71){case 0x3:if(_0x1c1a56[_0x7184('0x125')]>=_0xcf3ce[_0x7184('0x192')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x1c1a56[_0x7184('0x125')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce['dialNoAnswerRetryFrequency'],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1a56['ContactId'],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0x193')));break;case 0x5:if(_0x1c1a56['countbusyretry']>=_0xcf3ce[_0x7184('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x1c1a56[_0x7184('0x123')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x195')],'minutes')['format'](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0x196')));break;case 0x8:if(_0x1c1a56[_0x7184('0x124')]>=_0xcf3ce[_0x7184('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x1c1a56[_0x7184('0x124')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce['dialCongestionRetryFrequency'],_0x7184('0xdf'))[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56['ListId'],'VoiceQueueId':_0x1c1a56['VoiceQueueId']||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x198')));break;case 0x0:if(_0x1c1a56[_0x7184('0x131')]>=_0xcf3ce[_0x7184('0x199')]-0x1){return!![];}else{hopperUtils[_0x7184('0xec')]({'active':![],'countnosuchnumberretry':_0x1c1a56[_0x7184('0x131')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x19a')],_0x7184('0xdf'))['format'](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56['VoiceQueueId']||undefined,'CampaignId':_0x1c1a56['CampaignId']||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x19b')));}break;case 0xa:if(_0x1c1a56[_0x7184('0xdb')]>=_0xcf3ce['dialDropMaxRetry']-0x1){return!![];}hopperUtils[_0x7184('0xec')]({'active':![],'countdropretry':_0x1c1a56['countdropretry']+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce['dialDropRetryFrequency'],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56['ListId'],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56['CampaignId']||undefined})['catch'](loggerCatch(_0x7184('0xe4')));break;case 0xb:if(_0x1c1a56[_0x7184('0xeb')]>=_0xcf3ce[_0x7184('0x19c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x1c1a56[_0x7184('0xeb')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0xed')],_0x7184('0xdf'))[_0x7184('0x76')](_0x7184('0xc2')),'ContactId':_0x1c1a56['ContactId'],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[rescheduleContact][Abandoned]'));break;case 0x13:if(_0x1c1a56[_0x7184('0x122')]>=_0xcf3ce[_0x7184('0x128')]-0x1){return!![];}hopperUtils[_0x7184('0xec')]({'active':![],'countmachineretry':_0x1c1a56[_0x7184('0x122')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x12c')],_0x7184('0xdf'))[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56['VoiceQueueId']||undefined,'CampaignId':_0x1c1a56['CampaignId']||undefined})['catch'](loggerCatch(_0x7184('0x19d')));break;case 0x14:if(_0x1c1a56[_0x7184('0x126')]>=_0xcf3ce[_0x7184('0x19e')]-0x1){return!![];}hopperUtils[_0x7184('0xec')]({'active':![],'countagentrejectretry':_0x1c1a56[_0x7184('0x126')]+=0x1,'scheduledat':moment()[_0x7184('0x12b')](_0xcf3ce[_0x7184('0x19f')],_0x7184('0xdf'))['format'](_0x7184('0xc2')),'ContactId':_0x1c1a56[_0x7184('0xe0')],'ListId':_0x1c1a56[_0x7184('0xe1')],'VoiceQueueId':_0x1c1a56[_0x7184('0xe2')]||undefined,'CampaignId':_0x1c1a56[_0x7184('0xe3')]||undefined})['catch'](loggerCatch(_0x7184('0x1a0')));break;default:return!![];}};Dialer[_0x7184('0x1c')]['callProgressDetecting']=function(_0x45c99d,_0x2cfcc7,_0x3df6d5){var _0x473a48=this;var _0x4cf2af=new History(_0x45c99d);var _0x3f8ea9=![];var _0x53eb79;var _0x2783b0;return new Promise(function(_0x1ec0d0,_0x47bb83){if(_[_0x7184('0x3a')](_0x2cfcc7)&&typeof _0x2cfcc7!==_0x7184('0x15d')){return _0x47bb83(msgResponse(_0x7184('0x1a1'),'Failure','entity\x20is\x20undefine'));}if(_[_0x7184('0x3a')](_0x3df6d5)&&typeof _0x3df6d5!==_0x7184('0x15d')){return _0x47bb83(msgResponse('[callProgressDetecting]',_0x7184('0x8d'),_0x7184('0x1a2')));}hopperUtils[_0x7184('0xd8')](_0x4cf2af,_0x3df6d5[_0x7184('0xc3')],_0x2cfcc7)['then'](function(_0x253ba4){if(_0x253ba4['additional']==0x1)_0x3f8ea9=!![];switch(_0x3df6d5[_0x7184('0xc3')]){case'0':_0x2cfcc7[_0x7184('0x1a3')]+=0x1;_0x4cf2af[_0x7184('0x68')]=0x0;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1a4');_0x4cf2af[_0x7184('0x131')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;ami[_0x7184('0x3b')](_0x7184('0x1a5'),ut[_0x7184('0x11d')](_0x45c99d,_0x7184('0x1a6')));_0x53eb79=_0x2cfcc7['dialNoSuchNumberRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils[_0x7184('0xc7')](_0x4cf2af)[_0x7184('0x9c')](loggerCatch(_0x7184('0x130')));if(_0x473a48['checkRetriveMax'](0x0,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x131')]>=_0x2cfcc7['dialNoSuchNumberMaxRetry']){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1a7'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1a7'));}}break;case'3':_0x2cfcc7['outboundNoAnswerCallsDay']+=0x1;_0x4cf2af[_0x7184('0x68')]=0x3;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1a8');_0x4cf2af[_0x7184('0x125')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;var _0x5d916e=ut[_0x7184('0x1a9')](_0x45c99d,_0x2cfcc7);ami[_0x7184('0x3b')](_0x7184('0x1aa'),_0x5d916e);_0x53eb79=_0x2cfcc7['dialNoAnswerRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils['createHistory'](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x473a48['checkRetriveMax'](0x3,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af['countnoanswerretry']>=_0x2cfcc7[_0x7184('0x192')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1ab'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1ab'));}}break;case'5':_0x2cfcc7[_0x7184('0x1ac')]+=0x1;_0x4cf2af['state']=0x5;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1ad');_0x4cf2af[_0x7184('0x123')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;ami[_0x7184('0x3b')](_0x7184('0x1ae'),ut[_0x7184('0x11d')](_0x45c99d,_0x7184('0x1af')));_0x53eb79=_0x2cfcc7['dialBusyRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils['createHistory'](_0x4cf2af)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x473a48[_0x7184('0x190')](0x5,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x123')]>=_0x2cfcc7[_0x7184('0x194')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b0'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,'reason\x205\x20busy');}}break;case'8':_0x2cfcc7[_0x7184('0x1b1')]+=0x1;_0x4cf2af['state']=0x8;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1b2');_0x4cf2af[_0x7184('0x124')]+=0x1;_0x4cf2af[_0x7184('0xd6')]+=0x1;_0x53eb79=_0x2cfcc7[_0x7184('0x1b3')];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];ami[_0x7184('0x3b')]('custom:agentcongestion',ut['buildObj'](_0x45c99d,'congestion'));hopperUtils[_0x7184('0xc7')](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x473a48[_0x7184('0x190')](0x8,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x124')]>=_0x2cfcc7['dialCongestionMaxRetry']){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b4'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b4'));}}break;case'11':_0x2cfcc7[_0x7184('0x1b5')]+=0x1;_0x4cf2af[_0x7184('0x68')]=0xb;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1b6');_0x4cf2af['countabandonedretry']+=0x1;_0x4cf2af['countglobal']+=0x1;_0x53eb79=_0x2cfcc7['dialAbandonedRetryFrequency'];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils[_0x7184('0xc7')](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x473a48[_0x7184('0x190')](0xb,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0xeb')]>=_0x2cfcc7[_0x7184('0x19c')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1b7'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,'reason\x2011\x20abandoned');}}break;case'20':_0x2cfcc7[_0x7184('0x1b8')]+=0x1;_0x4cf2af[_0x7184('0x68')]=0x14;_0x4cf2af[_0x7184('0x69')]=_0x7184('0x1b9');_0x4cf2af[_0x7184('0x126')]+=0x1;_0x4cf2af['countglobal']+=0x1;_0x53eb79=_0x2cfcc7[_0x7184('0x19f')];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];ami[_0x7184('0x3b')](_0x7184('0x1ba'),ut['buildObj'](_0x45c99d,'agentreject'));hopperUtils['createHistory'](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x473a48[_0x7184('0x190')](0x14,_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x126')]>=_0x2cfcc7[_0x7184('0x19e')]){_0x473a48[_0x7184('0x129')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1bb'));}else{_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x7184('0x1bb'));}}break;default:_0x2cfcc7['outboundUnknownCallsDay']+=0x1;_0x4cf2af[_0x7184('0x68')]=0xc;_0x4cf2af[_0x7184('0x69')]=_0x3df6d5[_0x7184('0xc3')];_0x53eb79=_0x2cfcc7[_0x7184('0x19f')];_0x2783b0=_0x2cfcc7[_0x7184('0xd7')];hopperUtils['createHistory'](_0x4cf2af)[_0x7184('0x9c')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x473a48[_0x7184('0x190')](_0x3df6d5[_0x7184('0xc3')],_0x45c99d,_0x2cfcc7)&&!_0x3f8ea9){if(_0x4cf2af[_0x7184('0x123')]+_0x4cf2af[_0x7184('0x124')]+_0x4cf2af['countnoanswerretry']+_0x4cf2af[_0x7184('0x131')]+_0x4cf2af[_0x7184('0xdb')]+_0x4cf2af[_0x7184('0xeb')]+_0x4cf2af[_0x7184('0x122')]+_0x4cf2af[_0x7184('0x126')]>=_0x2cfcc7[_0x7184('0x191')]){_0x473a48[_0x7184('0x127')](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x3df6d5['reason']);}else{_0x473a48['createStateFinal'](_0x4cf2af,_0x1ec0d0,_0x47bb83,_0x3df6d5['reason']);}}}})[_0x7184('0x39')](function(){if(_0x3f8ea9){hopperUtils[_0x7184('0xe8')](_0x4cf2af,_0x53eb79,_0x2783b0)[_0x7184('0x39')](function(){return _0x1ec0d0(0x1);});}});});};Dialer[_0x7184('0x1c')][_0x7184('0x127')]=function(_0x1566a9,_0x57e3ae,_0x5538f7,_0x257b36){var _0x1addc1=new Final(_0x1566a9);_0x1addc1[_0x7184('0x68')]=0xf;_0x1addc1[_0x7184('0x69')]=_0x7184('0x1bc');this[_0x7184('0x129')](_0x1addc1,_0x57e3ae,_0x5538f7,_0x257b36);};Dialer[_0x7184('0x1c')][_0x7184('0x129')]=function(_0x2f6641,_0x5a9921,_0x375542,_0x1996ba){hopperUtils[_0x7184('0xc9')](_0x2f6641)[_0x7184('0x39')](function(){return _0x5a9921(msgResponse(_0x7184('0x1a1'),'Success',_0x1996ba));})['catch'](function(){return _0x375542(msgResponse(_0x7184('0x1bd'),_0x7184('0x8d'),_0x7184('0x1be')));});};Dialer[_0x7184('0x1c')][_0x7184('0x8')]=function(_0x19fc56){var _0x4ccc75=_0x19fc56[_0x7184('0x1bf')]/0x64;var _0x4c6951=_0x19fc56[_0x7184('0xd1')]/(_0x19fc56[_0x7184('0xd1')]+_0x19fc56['outboundAnswerCallsDay']);var _0x15ad03=Math[_0x7184('0x1c0')](_0x19fc56['predictiveIntervalAvailable']*(_0x19fc56[_0x7184('0x1c1')]/0x64));var _0x81d954=Math['round'](_0x19fc56[_0x7184('0x1c2')]*(_0x19fc56[_0x7184('0x1c3')]/0x64));var _0x240217=_0x19fc56['available']+_0x19fc56[_0x7184('0x1c4')];var _0x322ec8=Math[_0x7184('0x1c5')](_0x19fc56[_0x7184('0x52')]*_0x19fc56['erlangAbandonmentRate']*_0x19fc56['predictiveIntervalHitRate']*_0x19fc56[_0x7184('0x1c6')]);if(_['isUndefined'](_0x19fc56[_0x7184('0x27')])){if(!_[_0x7184('0x3a')](_0x19fc56['startPredictive'])){_0x19fc56[_0x7184('0x5c')]=undefined;loggerPredictive[_0x7184('0x60')](_0x7184('0x1c7'),_0x7184('0x1c8'));}if(!_[_0x7184('0x3a')](_0x19fc56[_0x7184('0x5e')])){loggerPredictive['error'](_0x7184('0x1c7'),_0x7184('0x1c9'));clearInterval(_0x19fc56[_0x7184('0x5e')]);_0x19fc56[_0x7184('0x5e')]=undefined;}_0x19fc56['startProgressive']=moment()[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1ca'),_0x19fc56['startProgressive']);this[_0x7184('0xae')](_0x19fc56,0x1);}else if(ifInterval(_0x19fc56[_0x7184('0x1cb')],_0x19fc56['startProgressive'])){this[_0x7184('0xae')](_0x19fc56,0x1);loggerPredictiveCalls[_0x7184('0x42')](_0x7184('0x1cc'),_0x19fc56['startProgressive'],_0x19fc56[_0x7184('0x3f')]);_0x19fc56['erlangCalls']=0x0;_0x19fc56[_0x7184('0xd2')]=0x0;}else if(_0x4ccc75<_0x4c6951&&_0x19fc56[_0x7184('0x1cd')]===_0x7184('0x1ce')){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7184('0x1cf'),_0x4c6951,'startProgressive',_0x19fc56[_0x7184('0x3f')]);}else if(_0x322ec8<_0x19fc56[_0x7184('0xd2')]&&_0x19fc56[_0x7184('0x1cd')]===_0x7184('0x1ce')){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7184('0x1d0'),_0x322ec8,_0x7184('0x1d1'),_0x19fc56[_0x7184('0xd2')],'startProgressive',_0x19fc56[_0x7184('0x3f')]);}else if(!ifInterval(_0x19fc56['dialPredictiveInterval'],_0x19fc56[_0x7184('0x27')])&&_[_0x7184('0x3a')](_0x19fc56['startPredictive'])&&!_['isUndefined'](_0x19fc56[_0x7184('0x27')])){_0x19fc56[_0x7184('0x5c')]=moment()['format'](_0x7184('0xc2'));loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d2'),_0x19fc56[_0x7184('0x5c')]);hopperUtils[_0x7184('0x1d3')](_0x19fc56[_0x7184('0x1cb')])['then'](this[_0x7184('0x1d4')](_0x19fc56))['then'](mergeDataErlangB(_0x19fc56))[_0x7184('0x39')](this[_0x7184('0x1d5')](_0x19fc56))[_0x7184('0x9c')](loggerCatchPredictive(_0x7184('0x1d6'),_0x19fc56));}else if(!ifInterval(_0x19fc56['dialPredictiveInterval'],_0x19fc56[_0x7184('0x5c')])){_0x19fc56[_0x7184('0xd2')]=0x0;_0x19fc56['startPredictive']=moment()[_0x7184('0x76')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d7'),_0x19fc56[_0x7184('0x5c')]);clearInterval(_0x19fc56[_0x7184('0x5e')]);_0x19fc56[_0x7184('0x5e')]=undefined;hopperUtils['avgHandleTime'](_0x19fc56[_0x7184('0x1cb')])[_0x7184('0x39')](this[_0x7184('0x1d4')](_0x19fc56))['then'](mergeDataErlangB(_0x19fc56))[_0x7184('0x39')](this[_0x7184('0x1d5')](_0x19fc56))[_0x7184('0x9c')](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x19fc56));}else if(_0x19fc56['predictiveIntervalAvailable']&&_0x240217<_0x19fc56[_0x7184('0x1c2')]-_0x81d954){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d8'),_0x240217,')\x20are\x20less\x20than\x20threshold\x20(',_0x19fc56['predictiveIntervalAvailable'],'-',_0x81d954,'=',_0x19fc56['predictiveIntervalAvailable']-_0x81d954,')');}else if(_0x19fc56[_0x7184('0x1c2')]&&_0x240217>_0x19fc56[_0x7184('0x1c2')]+_0x15ad03){clearPredictiveAttributes(_0x19fc56);loggerPredictive[_0x7184('0x42')](_0x19fc56[_0x7184('0x3f')],_0x7184('0x1d8'),_0x240217,_0x7184('0x1d9'),_0x19fc56[_0x7184('0x1c2')],'+',_0x15ad03,'=',_0x19fc56['predictiveIntervalAvailable']+_0x15ad03,')');}};Dialer[_0x7184('0x1c')][_0x7184('0x1d4')]=function(_0x5146d4){var _0x3de0f5=this;return function(_0x3c39dc){return new Promise(function(_0x10cae8,_0x48c971){_[_0x7184('0x59')](_0x5146d4,_0x3c39dc[0x0]);if(checkGetDataPredictive(_0x3c39dc[0x0])){var _0x5d6320=_0x5146d4[_0x7184('0x1c2')]=_0x5146d4[_0x7184('0x1c4')]+_0x5146d4['available'];var _0x3a3b1f=_0x5146d4[_0x7184('0x1cb')]*0x3c;var _0x5ab1a0=_0x3c39dc[0x0]['predictiveIntervalAvgTalktime']+_0x3c39dc[0x0][_0x7184('0x4a')];var _0xba9311=(_0x3c39dc[0x0]['predictiveIntervalAnsweredCalls']+_0x3c39dc[0x0][_0x7184('0x47')]+_0x3c39dc[0x0][_0x7184('0x48')])/_0x3c39dc[0x0][_0x7184('0x44')];_0x5146d4['predictiveIntervalHitRate']=_0xba9311>0x0?_0xba9311:0x1;switch(_0x5146d4['dialPredictiveOptimization']){case _0x7184('0x1ce'):var _0x247531=_0x5146d4[_0x7184('0x1bf')]/0x64;return _0x3de0f5['abandonmentRate'](_0x5d6320,_0x3a3b1f,_0x5ab1a0,_0xba9311,_0x247531)['then'](function(_0x5b0a46){return _0x10cae8(_0x5b0a46);});case _0x7184('0x1da'):var _0x231c9e=_0x5146d4[_0x7184('0x1bf')]/0x64;return _0x3de0f5[_0x7184('0x1db')](_0x5d6320,_0x3a3b1f,_0x5ab1a0,_0xba9311,_0x231c9e)[_0x7184('0x39')](function(_0x394ef4){return _0x10cae8(_0x394ef4);});default:return _0x48c971(msgResponse(_0x7184('0x1dc'),'Failure',_0x7184('0x1dd')));}}else{return _0x48c971(msgResponse('[getDataPredictive]',_0x7184('0x8d'),_0x7184('0x1de')));}});};};Dialer[_0x7184('0x1c')][_0x7184('0x1df')]=function(_0x2eea75){var _0x3175c4=this;return function(_0x41b02c){return new Promise(function(_0x178935,_0x3db5bc){_[_0x7184('0x59')](_0x2eea75,_0x41b02c[0x0]);if(checkGetDataPredictive(_0x41b02c[0x0])){loggerPredictive[_0x7184('0x42')](JSON[_0x7184('0x6e')](_0x41b02c[0x0]));if(_0x2eea75[_0x7184('0x1cd')]===_0x7184('0x1ce')){return _0x3175c4[_0x7184('0x156')](_0x2eea75['id'])[_0x7184('0x39')](function(_0x14c2b6){var _0x53b5bf=_0x2eea75[_0x7184('0x1e0')]-_0x14c2b6[0x0][_0x7184('0x1e1')];var _0x482d24=_0x2eea75[_0x7184('0x1cb')]*0x3c;var _0x331073=_0x41b02c[0x0][_0x7184('0x4c')]+_0x41b02c[0x0][_0x7184('0x4a')];var _0x5c9d1c=(_0x41b02c[0x0]['predictiveIntervalAnsweredCalls']+_0x41b02c[0x0][_0x7184('0x47')]+_0x41b02c[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x41b02c[0x0][_0x7184('0x44')];var _0x51541a=_0x2eea75[_0x7184('0x1bf')]/0x64;_0x2eea75[_0x7184('0x1e2')]=_0x14c2b6[0x0][_0x7184('0x1e1')]||0x0;_0x2eea75['predictiveIntervalHitRate']=_0x5c9d1c>0x0?_0x5c9d1c:0x1;return _0x3175c4[_0x7184('0x1e3')](_0x53b5bf,_0x482d24,_0x331073,_0x5c9d1c,_0x51541a);})[_0x7184('0x39')](function(_0x5a8f78){return _0x178935(_0x5a8f78);})[_0x7184('0x9c')](function(_0x7d8427){return _0x3db5bc(msgResponse(_0x7184('0x1e4'),_0x7184('0x8d'),JSON[_0x7184('0x6e')](_0x7d8427)));});}if(_0x2eea75[_0x7184('0x1cd')]==='agentBusyFactor'){return _0x3175c4[_0x7184('0x156')](_0x2eea75['id'])[_0x7184('0x39')](function(_0x506137){var _0x1d0961=_0x2eea75[_0x7184('0x1e0')]-_0x506137[0x0][_0x7184('0x1e1')];var _0x41fa29=_0x2eea75[_0x7184('0x1cb')]*0x3c;var _0x3ba4f9=_0x41b02c[0x0][_0x7184('0x4c')]+_0x41b02c[0x0][_0x7184('0x4a')];var _0x1adf0e=(_0x41b02c[0x0][_0x7184('0x45')]+_0x41b02c[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x41b02c[0x0][_0x7184('0x48')])/_0x41b02c[0x0][_0x7184('0x44')];var _0x45ced2=_0x2eea75[_0x7184('0x1bf')]/0x64;_0x2eea75[_0x7184('0x1e2')]=_0x506137[0x0][_0x7184('0x1e1')]||0x0;_0x2eea75[_0x7184('0x1e5')]=_0x1adf0e>0x0?_0x1adf0e:0x1;return _0x3175c4[_0x7184('0x1db')](_0x1d0961,_0x41fa29,_0x3ba4f9,_0x1adf0e,_0x45ced2);})[_0x7184('0x39')](function(_0x4c0e54){return _0x178935(_0x4c0e54);})[_0x7184('0x9c')](function(_0x2124a9){return _0x3db5bc(msgResponse(_0x7184('0x1e4'),_0x7184('0x8d'),JSON[_0x7184('0x6e')](_0x2124a9)));});}}else{return _0x3db5bc(msgResponse(_0x7184('0x1dc'),'Failure',_0x7184('0x1de')));}});};};Dialer[_0x7184('0x1c')][_0x7184('0x1d5')]=function(_0x9285b){var _0x367d52=this;return function(){var _0x1eaa37=0x0;var _0x13b260=Math['floor'](_0x9285b['erlangCallToSecond']*0x3e8);if(_0x13b260>0x0){_0x13b260=_0x13b260<0x64?0x64:_0x13b260;loggerPredictive[_0x7184('0x42')](_0x9285b[_0x7184('0x3f')],'one\x20call\x20every:',_0x13b260,'milliseconds');_0x9285b['handlePredictive']=setInterval(function(){_0x367d52['handlePredictive'](_0x9285b);loggerPredictiveCalls[_0x7184('0x42')](_0x7184('0x1e6'),_0x1eaa37+=0x1);},_0x13b260);}else{loggerPredictive['info'](_0x9285b[_0x7184('0x3f')],_0x7184('0x1e7'));}};};Dialer['prototype']['checkContactBlack']=function(_0x1971c6,_0x3c41fa){var _0x295fda=this;return function(_0x5d7f49){if(_[_0x7184('0x41')](_0x5d7f49)){if(_['isNil'](_0x3c41fa['UserId'])||!_0x3c41fa[_0x7184('0x1e8')]){if(_0x1971c6['dialMethod']==='booked'){_0x1971c6[_0x7184('0x6d')]=_[_0x7184('0x3a')](_0x1971c6['queueStatusComplete'])?!![]:_0x1971c6[_0x7184('0x6d')];var _0x4505a8=uuid['v4']();_0x295fda['actions'][_0x4505a8]=new Action(_0x1971c6,_0x3c41fa,_0x4505a8);loggerBooked[_0x7184('0x42')](_0x7184('0x1e9'),_0x4505a8,_0x7184('0x1ea'),JSON[_0x7184('0x6e')](_0x1971c6['queueStatusComplete']),_0x7184('0x1eb'),_0x1971c6[_0x7184('0x3f')]);if(_0x1971c6[_0x7184('0x6d')]){_0x1971c6[_0x7184('0x6d')]=![];_0x295fda['queueBooked'][_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xbe')]]=[];ami[_0x7184('0x96')]({'actionid':_0x4505a8,'action':_0x7184('0x1ec'),'queue':_0x1971c6[_0x7184('0x3f')]})[_0x7184('0x9c')](function(){utils[_0x7184('0xbd')](_0x1971c6,_0x7184('0x1ed'));hopperUtils[_0x7184('0xec')]({'active':![],'ContactId':_0x295fda[_0x7184('0xf0')][_0x4505a8]['ContactId'],'ListId':_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xe1')],'VoiceQueueId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe2')]||undefined,'CampaignId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x1ee')));delete _0x295fda['actions'][_0x4505a8];});}else{loggerBooked[_0x7184('0x42')]('[booked][checkContactBlack][else]',JSON[_0x7184('0x6e')](_0x1971c6[_0x7184('0x6d')]),_0x7184('0x1eb'),_0x1971c6[_0x7184('0x3f')]);utils[_0x7184('0xbd')](_0x1971c6,_0x7184('0x1ed'));hopperUtils[_0x7184('0xec')]({'active':![],'ContactId':_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xe0')],'ListId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe1')],'VoiceQueueId':_0x295fda['actions'][_0x4505a8][_0x7184('0xe2')]||undefined,'CampaignId':_0x295fda[_0x7184('0xf0')][_0x4505a8][_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x295fda['actions'][_0x4505a8];}}else{return _0x295fda[_0x7184('0x15c')](_0x1971c6,_0x3c41fa);}}else{if(utils['getSeconds'](undefined,_0x3c41fa[_0x7184('0x1ef')])<_0x1971c6['dialRecallMeTimeout']*0x3c){if(_0x3c41fa['Agent']&&!_0x3c41fa[_0x7184('0x15b')][_0x7184('0x1f0')]){_0x295fda['preview'][_0x7184('0xfe')](_0x3c41fa['id'])['finally'](function(){utils['decrementOriginate'](_0x1971c6,_0x7184('0x1ed'));});}else{hopperUtils[_0x7184('0x1f1')]({'active':![]},_0x3c41fa['id'],0x1)[_0x7184('0x107')](function(){utils['decrementOriginate'](_0x1971c6,_0x7184('0x1ed'));});}}else{_0x1971c6[_0x7184('0x1f2')]+=0x1;utils[_0x7184('0xbd')](_0x1971c6,_0x7184('0x1ed'));if(_0x1971c6['dialRecallInQueue']){hopperUtils[_0x7184('0xec')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x3c41fa['ContactId'],'ListId':_0x3c41fa['ListId'],'VoiceQueueId':_0x3c41fa['VoiceQueueId']||undefined,'CampaignId':_0x3c41fa[_0x7184('0xe3')]||undefined})[_0x7184('0x9c')](loggerCatch(_0x7184('0x1f3')));hopperUtils[_0x7184('0xc7')](createObjHistory(_0x1971c6,_0x3c41fa,utils['CAMPAIGN_STATUS'][_0x7184('0x1f4')],0x17,_0x7184('0x1f5')))[_0x7184('0x9c')](loggerCatch(_0x7184('0x1f6')));}else{_0x295fda[_0x7184('0x12d')](createObjHistory(_0x1971c6,_0x3c41fa,utils['CAMPAIGN_STATUS'][_0x7184('0x1f7')],0x16,_0x7184('0x1f8')),'[Originate][HistoryRecallClose][historyCatch]',_0x7184('0x1f9'));}}}}else{_0x1971c6[_0x7184('0x1fa')]+=0x1;_0x295fda['saveInDb'](createObjHistory(_0x1971c6,_0x3c41fa,utils[_0x7184('0x63')][_0x7184('0x1fb')],0xd,'Blacklist'),_0x7184('0x1fc'),'[Originate][MoveBlacklist]');throw _0x7184('0x1fd');}};};Dialer[_0x7184('0x1c')][_0x7184('0x1fe')]=function(_0xd833d5){var _0x5817f8=this;var _0x16857e=_0xd833d5['limitCalls']-_0xd833d5[_0x7184('0x79')];emitCampaignSummary(_0xd833d5);if(_0x16857e>0x0&&_0xd833d5[_0x7184('0x1ff')]==0x0){if(_0x16857e>this['maxNumberOriginate']){_0x16857e=this[_0x7184('0x24')];}_0xd833d5[_0x7184('0x1ff')]=0x1;hopperUtils['getContactDialerIvr'](_0xd833d5,_0x16857e)[_0x7184('0x39')](function(_0x1fc218){_0xd833d5[_0x7184('0x1ff')]=0x0;if(_0x1fc218){if(!utils['checkContactEmpty'](_0x1fc218)){_0xd833d5[_0x7184('0x62')]=utils['CAMPAIGN_STATUS'][_0x7184('0x200')];logger[_0x7184('0x42')](_0x7184('0x201')+_0xd833d5[_0x7184('0x3f')]);}else{_0xd833d5['originated']+=_0x1fc218[_0x7184('0x94')];_0xd833d5[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x202')];for(var _0x54285b=0x0;_0x54285b<_0x1fc218[_0x7184('0x94')];_0x54285b+=0x1){_0xd833d5[_0x7184('0x203')]+=0x1;if(_[_0x7184('0xf7')](_0x1fc218[_0x54285b])||_[_0x7184('0xf7')](_0x1fc218[_0x54285b][_0x7184('0x17a')])||_[_0x7184('0xf7')](_0x1fc218[_0x54285b][_0x7184('0x160')])){_0x5817f8[_0x7184('0x158')](_0x7184('0x204'),_0xd833d5,_0x1fc218[_0x54285b]);}else{hopperUtils[_0x7184('0x205')](_[_0x7184('0x6f')](_0x1fc218[_0x54285b],['CampaignId',_0x7184('0x160')]))['then'](_0x5817f8[_0x7184('0x206')](_0xd833d5,_0x1fc218[_0x54285b]))[_0x7184('0x9c')](function(_0x312db5){logger[_0x7184('0x60')]('[actionOriginateIvr]',_0x312db5);utils['decrementOriginate'](_0xd833d5,_0x7184('0x207'));});}}}}})[_0x7184('0x9c')](function(_0x5e562f){_0xd833d5[_0x7184('0x1ff')]=0x0;logger[_0x7184('0x60')](_0x7184('0x208'),_0x5e562f);});}};Dialer['prototype'][_0x7184('0xae')]=function(_0x15ab23,_0x1d9343){var _0x21b7a1=this;var _0x362ed9=[];if(_0x1d9343<0x1||_0x15ab23['dialMethod']===_0x7184('0x7')){_0x1d9343=0x1;}var _0x15c013=Math[_0x7184('0x1c5')](_0x15ab23[_0x7184('0x209')]*_0x1d9343)-_0x15ab23[_0x7184('0x79')];if(_0x15ab23[_0x7184('0x20a')]>0x0){var _0x523c43=_0x15ab23[_0x7184('0x20a')]-_0x15ab23[_0x7184('0x79')]-_0x15ab23['talking']-_0x15ab23[_0x7184('0x20b')];if(_0x15c013>_0x523c43){_0x15c013=_0x523c43;}}if(_0x15c013>0x0&&_0x15ab23[_0x7184('0x1ff')]==0x0){if(_0x15ab23[_0x7184('0xab')]===_0x7184('0x7')){_0x15c013=0x1;}if(_0x15c013>this[_0x7184('0x24')]){_0x15c013=this[_0x7184('0x24')];}for(var _0x1d04fe in this[_0x7184('0x22')]){if(typeof this['agents'][_0x1d04fe]!==_0x7184('0xa4')){if(this[_0x7184('0x22')][_0x1d04fe][_0x7184('0x68')]===_0x7184('0x20c')&&this['agents'][_0x1d04fe]['status']===_0x7184('0x81')){_0x362ed9[_0x7184('0x95')](this[_0x7184('0x22')][_0x1d04fe]['id']);}}}_0x15ab23[_0x7184('0x1ff')]=0x1;hopperUtils[_0x7184('0x20d')](_0x15ab23,_0x362ed9,_0x15c013)['then'](function(_0x24412c){_0x15ab23['temp']=0x0;if(_0x24412c){if(!utils[_0x7184('0x20e')](_0x24412c)){hopperUtils[_0x7184('0x20f')](_0x15ab23)[_0x7184('0x39')](sendMessageReschedule(_0x15ab23))['catch'](loggerCatch(_0x7184('0x210')));}else{_0x15ab23[_0x7184('0x79')]+=_0x24412c[_0x7184('0x94')];_0x15ab23[_0x7184('0x62')]=_0x15ab23['dialMethod']==='booked'?utils['CAMPAIGN_STATUS'][_0x7184('0x211')]:utils['CAMPAIGN_STATUS']['RUNNING'];for(var _0x67f3de=0x0;_0x67f3de<_0x24412c['length'];_0x67f3de+=0x1){if(_['isNil'](_0x24412c[_0x67f3de])||_['isNil'](_0x24412c[_0x67f3de]['Contact'])||_[_0x7184('0xf7')](_0x24412c[_0x67f3de][_0x7184('0x160')])){_0x21b7a1[_0x7184('0x158')](_0x7184('0x204'),_0x15ab23,_0x24412c[_0x67f3de]);}else{hopperUtils[_0x7184('0x212')](_['pick'](_0x24412c[_0x67f3de],['VoiceQueueId',_0x7184('0x160')]))['then'](_0x21b7a1[_0x7184('0x206')](_0x15ab23,_0x24412c[_0x67f3de]))[_0x7184('0x9c')](function(_0x10148d){logger['error'](_0x7184('0x213'),_0x10148d);utils[_0x7184('0xbd')](_0x15ab23,_0x7184('0x214'));});}}}}})[_0x7184('0x9c')](function(_0x47234b){_0x15ab23['temp']=0x0;logger['error'](_0x7184('0x208'),_0x47234b);});}};Dialer[_0x7184('0x1c')]['handlePredictive']=function(_0x1aab6a){if(_0x1aab6a['dialLimitQueue']>0x0){var _0x4e910f=_0x1aab6a[_0x7184('0x20a')]-_0x1aab6a['originated']-_0x1aab6a[_0x7184('0x1c4')];if(_0x4e910f>0x0&&_0x1aab6a[_0x7184('0x1ff')]==0x0){this['tryOriginatePredictive'](_0x1aab6a);}else{loggerPredictiveCalls[_0x7184('0x42')](_0x7184('0x215'));}}else{this[_0x7184('0x216')](_0x1aab6a);}};Dialer['prototype'][_0x7184('0x216')]=function(_0x975086){var _0x511012=this;var _0x51aef9=[];_0x975086[_0x7184('0x79')]+=0x1;for(var _0x336a9c in this[_0x7184('0x22')]){if(typeof this['agents'][_0x336a9c]!==_0x7184('0xa4')){if(this['agents'][_0x336a9c][_0x7184('0x68')]==='not_inuse'&&this['agents'][_0x336a9c][_0x7184('0x80')]==='reachable'){_0x51aef9[_0x7184('0x95')](this[_0x7184('0x22')][_0x336a9c]['id']);}}}_0x975086[_0x7184('0x1ff')]=0x1;return this[_0x7184('0x20d')](_0x975086['id'],_0x51aef9,0x1,_0x975086[_0x7184('0x217')],_0x975086)[_0x7184('0x39')](function(_0x53d770){_0x975086[_0x7184('0x1ff')]=0x1;if(_0x53d770){if(!utils[_0x7184('0x20e')](_0x53d770)){utils['checkContactLowerLimitOriginate'](_0x975086,0x1,0x0);return hopperUtils[_0x7184('0x20f')](_0x975086)[_0x7184('0x39')](sendMessageReschedule(_0x975086))[_0x7184('0x9c')](loggerCatch(_0x7184('0x210')));}else{_0x975086[_0x7184('0x62')]=utils[_0x7184('0x63')][_0x7184('0x202')];if(_[_0x7184('0xf7')](_0x53d770[0x0])||_[_0x7184('0xf7')](_0x53d770[0x0][_0x7184('0x17a')])||_['isNil'](_0x53d770[0x0][_0x7184('0x160')])){_0x511012['emptyContact'](_0x7184('0x204'),_0x975086,_0x53d770[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x7184('0x6f')](_0x53d770[0x0],[_0x7184('0xe2'),_0x7184('0x160')]))[_0x7184('0x39')](_0x511012[_0x7184('0x206')](_0x975086,_0x53d770[0x0]))['catch'](function(_0x162609){logger[_0x7184('0x60')]('[actionOriginatePredictive]',_0x162609);utils[_0x7184('0xbd')](_0x975086,_0x7184('0x218'));});}}}})['catch'](function(_0x232224){_0x975086[_0x7184('0x1ff')]=0x0;logger['error'](_0x7184('0x208'),_0x232224);});};Dialer[_0x7184('0x1c')][_0x7184('0x1e3')]=function(_0x109251,_0x12fcc8,_0x1599fc,_0x23ccd4,_0x3712a1,_0x3b7911){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x7184('0x42')](_0x7184('0x219'),_0x109251);loggerPredictive[_0x7184('0x42')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x12fcc8);loggerPredictive[_0x7184('0x42')](_0x7184('0x21a'),_0x1599fc);loggerPredictive[_0x7184('0x42')](_0x7184('0x21b'),_0x23ccd4);loggerPredictive[_0x7184('0x42')](_0x7184('0x21c'),_0x3712a1);loggerPredictive[_0x7184('0x42')]('---------------------------');return new Promise(function(_0x39bcce,_0x925f1e){if(_0x109251<=0x0||isNaN(_0x109251)){return _0x925f1e(msgResponse(_0x7184('0x21d'),'Error',_0x7184('0x21e')+_0x109251));}if(_0x1599fc<=0x0||isNaN(_0x1599fc)){return _0x925f1e(msgResponse('[abandonmentRate]','Error',_0x7184('0x21f')+_0x1599fc));}if(_0x23ccd4<=0x0||isNaN(_0x23ccd4)){return _0x925f1e(msgResponse('[abandonmentRate]',_0x7184('0x7e'),_0x7184('0x220')+_0x23ccd4));}if(_0x12fcc8<=0x0||isNaN(_0x12fcc8)){return _0x925f1e(msgResponse(_0x7184('0x21d'),_0x7184('0x7e'),_0x7184('0x221')+_0x12fcc8));}if(_0x3712a1<=0x0||isNaN(_0x3712a1)){return _0x925f1e(msgResponse(_0x7184('0x21d'),_0x7184('0x7e'),_0x7184('0x222')+_0x3712a1));}_0x3b7911=_0x3b7911||0x0;var _0x433286=0x1/_0x1599fc;var _0x311455=0x0;var _0x349fb8=0x0;var _0x4e9342=0x0;var _0x9d219a=0x0;for(var _0x189c18=0x0;_0x4e9342<_0x3712a1;_0x189c18+=0x1){_0x349fb8=_0x189c18/_0x12fcc8;_0x311455=(_0x23ccd4*_0x349fb8+_0x3b7911)/_0x433286;_0x4e9342=utils[_0x7184('0x223')](_0x311455,_0x109251);_0x9d219a=_0x311455/_0x109251*(0x1-utils[_0x7184('0x223')](_0x311455,_0x109251));}return _0x39bcce({'erlangCalls':_0x189c18,'erlangCallToSecond':_0x12fcc8/_0x189c18,'erlangAbandonmentRate':_0x4e9342,'erlangBusyFactor':_0x9d219a});});};Dialer['prototype'][_0x7184('0x1db')]=function(_0x39dc41,_0xf78139,_0x13456c,_0x7c680f,_0x4a1ac3,_0x47f886){loggerPredictive[_0x7184('0x42')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x7184('0x42')](_0x7184('0x219'),_0x39dc41);loggerPredictive['info'](_0x7184('0x224'),_0xf78139);loggerPredictive[_0x7184('0x42')](_0x7184('0x21a'),_0x13456c);loggerPredictive[_0x7184('0x42')]('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',_0x7c680f);loggerPredictive[_0x7184('0x42')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4a1ac3);loggerPredictive[_0x7184('0x42')](_0x7184('0x4d'));return new Promise(function(_0x1d660f,_0x339d50){if(_0x39dc41<=0x0||isNaN(_0x39dc41)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x21e')+_0x39dc41));}if(_0x13456c<=0x0||isNaN(_0x13456c)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x21f')+_0x13456c));}if(_0x7c680f<=0x0||isNaN(_0x7c680f)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x220')+_0x7c680f));}if(_0xf78139<=0x0||isNaN(_0xf78139)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x221')+_0xf78139));}if(_0x4a1ac3<=0x0||isNaN(_0x4a1ac3)){return _0x339d50(msgResponse(_0x7184('0x225'),_0x7184('0x7e'),_0x7184('0x226')+_0x4a1ac3));}_0x47f886=_0x47f886||0x0;var _0x1caf69=0x1/_0x13456c;var _0x23bf1e=0x0;var _0x5e40ce=0x0;var _0x30d58f=0x0;var _0x4d397c=0x0;for(var _0x24def1=0x0;_0x4d397c<_0x4a1ac3;_0x24def1+=0x1){_0x5e40ce=_0x24def1/_0xf78139;_0x23bf1e=(_0x7c680f*_0x5e40ce+_0x47f886)/_0x1caf69;_0x30d58f=utils[_0x7184('0x223')](_0x23bf1e,_0x39dc41);_0x4d397c=_0x23bf1e/_0x39dc41*(0x1-utils['erlangb'](_0x23bf1e,_0x39dc41));}return _0x1d660f({'erlangCalls':_0x24def1,'erlangCallToSecond':_0xf78139/_0x24def1,'erlangAbandonmentRate':_0x30d58f,'erlangBusyFactor':_0x4d397c});});};module[_0x7184('0x227')]=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 07d257e..b821e94 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 _0xa76d=['countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','originatecalleridnum','prototype','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','util','lodash','moment','isNil','string','voiceQueue','Contact','firstName','lastName','number','phone','queue','name','active','type','dialQueueTimeout'];(function(_0x121f6d,_0x515797){var _0x4dd075=function(_0x53a4e6){while(--_0x53a4e6){_0x121f6d['push'](_0x121f6d['shift']());}};_0x4dd075(++_0x515797);}(_0xa76d,0x1b3));var _0xda76=function(_0x5c0370,_0x15d3a0){_0x5c0370=_0x5c0370-0x0;var _0x2c94d8=_0xa76d[_0x5c0370];return _0x2c94d8;};'use strict';var util=require(_0xda76('0x0'));var _=require(_0xda76('0x1'));var moment=require(_0xda76('0x2'));function checkNameSurname(_0xc5902a,_0x267b31,_0x29b5ed){var _0x173547='';if(!_['isNil'](_0x267b31)&&'string'===typeof _0x267b31){_0x173547+=_0x267b31;}if(!_[_0xda76('0x3')](_0x29b5ed)&&_0xda76('0x4')===typeof _0x29b5ed){_0x173547+='\x20'+_0x29b5ed;}if(_0x173547!==''){return _0x173547;}return _0xc5902a;}function Action(_0x2a6be2,_0x806cab,_0x257995){this[_0xda76('0x5')]=_0x2a6be2;this['uniqueid']=_0x257995||undefined;this['name']=checkNameSurname(_0x806cab[_0xda76('0x6')]['phone'],_0x806cab[_0xda76('0x6')][_0xda76('0x7')],_0x806cab[_0xda76('0x6')][_0xda76('0x8')]);this[_0xda76('0x9')]=_0x806cab[_0xda76('0xa')];this[_0xda76('0xb')]=_0x2a6be2[_0xda76('0xc')];this[_0xda76('0xd')]=_0x806cab[_0xda76('0xd')]||![];this['type']=_0x2a6be2[_0xda76('0xe')];this[_0xda76('0xf')]=_0x2a6be2[_0xda76('0xf')]||0x3;this['scheduledat']=_0x806cab['scheduledat'];this[_0xda76('0x10')]=_0x806cab[_0xda76('0x10')];this[_0xda76('0x11')]=_0x806cab[_0xda76('0x11')];this['countnoanswerretry']=_0x806cab[_0xda76('0x12')];this[_0xda76('0x13')]=_0x806cab[_0xda76('0x13')];this[_0xda76('0x14')]=_0x806cab[_0xda76('0x14')];this[_0xda76('0x15')]=_0x806cab['countabandonedretry'];this[_0xda76('0x16')]=_0x806cab[_0xda76('0x16')];this[_0xda76('0x17')]=_0x806cab[_0xda76('0x17')];this[_0xda76('0x18')]=_0x806cab['ContactId'];this['ListId']=_0x806cab[_0xda76('0x19')];this[_0xda76('0x1a')]=_0x806cab[_0xda76('0x1a')];this['VoiceQueueId']=_0x806cab[_0xda76('0x1b')];this[_0xda76('0x1c')]=_0x806cab[_0xda76('0x1c')];this[_0xda76('0x1d')]=_0x806cab['id'];this[_0xda76('0x1e')]=_0x806cab[_0xda76('0x6')][_0xda76('0x7')]||'';this['starttime']=moment()[_0xda76('0x1f')](_0xda76('0x20'));this[_0xda76('0x21')]=_0x806cab[_0xda76('0x21')];this[_0xda76('0x22')]=_0x806cab[_0xda76('0x22')];this[_0xda76('0x23')]=_0x806cab[_0xda76('0x23')];this['recallme']=_0x806cab['recallme'];this[_0xda76('0x24')]='';this['originatecalleridname']='';}Action[_0xda76('0x25')]['getCaller']=function(){return util[_0xda76('0x1f')](_0xda76('0x26'),this['name'],this[_0xda76('0x5')][_0xda76('0x27')]>0x0?this[_0xda76('0x9')]['substring'](this[_0xda76('0x5')]['dialCutDigit']):this[_0xda76('0x9')]);};Action[_0xda76('0x25')][_0xda76('0x28')]=function(){return this[_0xda76('0xb')];};module['exports']=Action; \ No newline at end of file +var _0x84e5=['countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','dialCutDigit','substring','getQueue','queue','util','lodash','moment','string','voiceQueue','uniqueid','name','Contact','phone','firstName','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x7460d8,_0x2fc1a1){var _0x338f82=function(_0x1cec50){while(--_0x1cec50){_0x7460d8['push'](_0x7460d8['shift']());}};_0x338f82(++_0x2fc1a1);}(_0x84e5,0x1d9));var _0x584e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0x84e5[_0x17406a];return _0x1501ff;};'use strict';var util=require(_0x584e('0x0'));var _=require(_0x584e('0x1'));var moment=require(_0x584e('0x2'));function checkNameSurname(_0x263247,_0x57eef3,_0x92ac29){var _0x4f528b='';if(!_['isNil'](_0x57eef3)&&'string'===typeof _0x57eef3){_0x4f528b+=_0x57eef3;}if(!_['isNil'](_0x92ac29)&&_0x584e('0x3')===typeof _0x92ac29){_0x4f528b+='\x20'+_0x92ac29;}if(_0x4f528b!==''){return _0x4f528b;}return _0x263247;}function Action(_0x25331c,_0x193e02,_0x4825bd){this[_0x584e('0x4')]=_0x25331c;this[_0x584e('0x5')]=_0x4825bd||undefined;this[_0x584e('0x6')]=checkNameSurname(_0x193e02[_0x584e('0x7')][_0x584e('0x8')],_0x193e02[_0x584e('0x7')][_0x584e('0x9')],_0x193e02[_0x584e('0x7')][_0x584e('0xa')]);this[_0x584e('0xb')]=_0x193e02[_0x584e('0x8')];this['queue']=_0x25331c[_0x584e('0x6')];this[_0x584e('0xc')]=_0x193e02[_0x584e('0xc')]||![];this[_0x584e('0xd')]=_0x25331c[_0x584e('0xd')];this[_0x584e('0xe')]=_0x25331c[_0x584e('0xe')]||0x3;this[_0x584e('0xf')]=_0x193e02[_0x584e('0xf')];this[_0x584e('0x10')]=_0x193e02['countbusyretry'];this['countcongestionretry']=_0x193e02['countcongestionretry'];this[_0x584e('0x11')]=_0x193e02[_0x584e('0x11')];this['countnosuchnumberretry']=_0x193e02[_0x584e('0x12')];this[_0x584e('0x13')]=_0x193e02[_0x584e('0x13')];this[_0x584e('0x14')]=_0x193e02[_0x584e('0x14')];this[_0x584e('0x15')]=_0x193e02['countmachineretry'];this[_0x584e('0x16')]=_0x193e02[_0x584e('0x16')];this['ContactId']=_0x193e02[_0x584e('0x17')];this[_0x584e('0x18')]=_0x193e02[_0x584e('0x18')];this[_0x584e('0x19')]=_0x193e02[_0x584e('0x19')];this[_0x584e('0x1a')]=_0x193e02[_0x584e('0x1a')];this[_0x584e('0x1b')]=_0x193e02['CampaignId'];this[_0x584e('0x1c')]=_0x193e02['id'];this[_0x584e('0x1d')]=_0x193e02[_0x584e('0x7')][_0x584e('0x9')]||'';this[_0x584e('0x1e')]=moment()[_0x584e('0x1f')](_0x584e('0x20'));this[_0x584e('0x21')]=_0x193e02[_0x584e('0x21')];this[_0x584e('0x22')]=_0x193e02[_0x584e('0x22')];this[_0x584e('0x23')]=_0x193e02[_0x584e('0x23')];this[_0x584e('0x24')]=_0x193e02[_0x584e('0x24')];this[_0x584e('0x25')]='';this[_0x584e('0x26')]='';}Action[_0x584e('0x27')][_0x584e('0x28')]=function(){return util[_0x584e('0x1f')]('\x22%s\x22\x20<%s>',this['name'],this[_0x584e('0x4')][_0x584e('0x29')]>0x0?this[_0x584e('0xb')][_0x584e('0x2a')](this[_0x584e('0x4')][_0x584e('0x29')]):this[_0x584e('0xb')]);};Action[_0x584e('0x27')][_0x584e('0x2b')]=function(){return this[_0x584e('0x2c')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 9875ac7..0245550 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 _0xa26c=['responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','getSeconds','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','../utils','state','statedesc','Answer','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','starttime'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa26c,0xed));var _0xca26=function(_0x3ee5b3,_0x2a1b5e){_0x3ee5b3=_0x3ee5b3-0x0;var _0x1e753e=_0xa26c[_0x3ee5b3];return _0x1e753e;};'use strict';var moment=require(_0xca26('0x0'));var utils=require(_0xca26('0x1'));function AgentComplete(_0x52050b,_0x2aebf5){this[_0xca26('0x2')]=0x4;this[_0xca26('0x3')]=_0xca26('0x4');this['scheduledat']=_0x52050b['scheduledat'];this[_0xca26('0x5')]=_0x52050b[_0xca26('0x5')];this[_0xca26('0x6')]=_0x52050b[_0xca26('0x5')]===_0xca26('0x7')?_0xca26('0x8'):_0x52050b['type'];this['countbusyretry']=_0x52050b[_0xca26('0x9')];this[_0xca26('0xa')]=_0x52050b['countcongestionretry'];this['countnoanswerretry']=_0x52050b[_0xca26('0xb')];this['countglobal']=_0x52050b[_0xca26('0x9')]+_0x52050b[_0xca26('0xa')]+_0x52050b[_0xca26('0xb')]+_0x52050b[_0xca26('0xc')]+_0x52050b[_0xca26('0xd')]+_0x52050b[_0xca26('0xe')]+_0x52050b[_0xca26('0xf')]+_0x52050b[_0xca26('0x10')];this[_0xca26('0xc')]=_0x52050b[_0xca26('0xc')];this[_0xca26('0xd')]=_0x52050b[_0xca26('0xd')];this[_0xca26('0xe')]=_0x52050b[_0xca26('0xe')];this['countmachineretry']=_0x52050b[_0xca26('0xf')];this['countagentrejectretry']=_0x52050b[_0xca26('0x10')];this[_0xca26('0x11')]=_0x2aebf5[_0xca26('0x11')];this[_0xca26('0x12')]=_0x52050b['name'];this[_0xca26('0x13')]=_0x52050b['number'];this[_0xca26('0x14')]=_0x52050b[_0xca26('0x14')];this['responsetime']=_0x52050b[_0xca26('0x15')];this[_0xca26('0x16')]=_0x52050b['answertime'];this[_0xca26('0x17')]=moment()[_0xca26('0x18')](_0xca26('0x19'));this[_0xca26('0x1a')]=utils['getSeconds'](_0x52050b[_0xca26('0x15')],_0x52050b[_0xca26('0x14')]);this[_0xca26('0x1b')]=utils[_0xca26('0x1c')](_0x52050b[_0xca26('0x16')],_0x52050b[_0xca26('0x15')]);this['talktime']=utils[_0xca26('0x1c')](this['endtime'],_0x52050b[_0xca26('0x16')]);this['queue']=_0x2aebf5['queue'];this[_0xca26('0x1d')]=_0x2aebf5['membername'];this['reason']=_0x2aebf5[_0xca26('0x1e')];this[_0xca26('0x1f')]=_0x52050b[_0xca26('0x1f')];this[_0xca26('0x20')]=_0x52050b[_0xca26('0x20')];this['callbackat']=_0x52050b[_0xca26('0x21')];this[_0xca26('0x22')]=_0x52050b[_0xca26('0x22')];this[_0xca26('0x23')]=_0x52050b['ContactId'];this[_0xca26('0x24')]=_0x52050b[_0xca26('0x24')];this[_0xca26('0x25')]=_0x52050b[_0xca26('0x25')];this[_0xca26('0x26')]=_0x52050b[_0xca26('0x26')];this[_0xca26('0x27')]=_0x52050b[_0xca26('0x27')];this[_0xca26('0x28')]=_0x52050b[_0xca26('0x28')]||'';this[_0xca26('0x29')]=_0x52050b[_0xca26('0x29')]||'';this[_0xca26('0x2a')]=_0x52050b[_0xca26('0x2a')];}module['exports']=AgentComplete; \ No newline at end of file +var _0x447c=['membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','holdtime','talktime'];(function(_0x9d577e,_0x43b574){var _0x34466e=function(_0x31398f){while(--_0x31398f){_0x9d577e['push'](_0x9d577e['shift']());}};_0x34466e(++_0x43b574);}(_0x447c,0x6b));var _0xc447=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x447c[_0x49b207];return _0x2dc8fa;};'use strict';var moment=require('moment');var utils=require('../utils');function AgentComplete(_0x5ef39d,_0x4ac78d){this[_0xc447('0x0')]=0x4;this[_0xc447('0x1')]=_0xc447('0x2');this[_0xc447('0x3')]=_0x5ef39d[_0xc447('0x3')];this[_0xc447('0x4')]=_0x5ef39d[_0xc447('0x4')];this[_0xc447('0x5')]=_0x5ef39d['type']===_0xc447('0x6')?_0xc447('0x7'):_0x5ef39d[_0xc447('0x4')];this[_0xc447('0x8')]=_0x5ef39d[_0xc447('0x8')];this['countcongestionretry']=_0x5ef39d[_0xc447('0x9')];this[_0xc447('0xa')]=_0x5ef39d[_0xc447('0xa')];this[_0xc447('0xb')]=_0x5ef39d[_0xc447('0x8')]+_0x5ef39d[_0xc447('0x9')]+_0x5ef39d['countnoanswerretry']+_0x5ef39d[_0xc447('0xc')]+_0x5ef39d[_0xc447('0xd')]+_0x5ef39d[_0xc447('0xe')]+_0x5ef39d['countmachineretry']+_0x5ef39d[_0xc447('0xf')];this[_0xc447('0xc')]=_0x5ef39d[_0xc447('0xc')];this[_0xc447('0xd')]=_0x5ef39d[_0xc447('0xd')];this[_0xc447('0xe')]=_0x5ef39d[_0xc447('0xe')];this[_0xc447('0x10')]=_0x5ef39d[_0xc447('0x10')];this['countagentrejectretry']=_0x5ef39d[_0xc447('0xf')];this[_0xc447('0x11')]=_0x4ac78d[_0xc447('0x11')];this[_0xc447('0x12')]=_0x5ef39d[_0xc447('0x13')];this[_0xc447('0x14')]=_0x5ef39d[_0xc447('0x15')];this[_0xc447('0x16')]=_0x5ef39d[_0xc447('0x16')];this[_0xc447('0x17')]=_0x5ef39d[_0xc447('0x17')];this[_0xc447('0x18')]=_0x5ef39d[_0xc447('0x18')];this[_0xc447('0x19')]=moment()[_0xc447('0x1a')](_0xc447('0x1b'));this['ringtime']=utils[_0xc447('0x1c')](_0x5ef39d[_0xc447('0x17')],_0x5ef39d['starttime']);this[_0xc447('0x1d')]=utils['getSeconds'](_0x5ef39d[_0xc447('0x18')],_0x5ef39d[_0xc447('0x17')]);this[_0xc447('0x1e')]=utils[_0xc447('0x1c')](this[_0xc447('0x19')],_0x5ef39d[_0xc447('0x18')]);this['queue']=_0x4ac78d[_0xc447('0x7')];this[_0xc447('0x1f')]=_0x4ac78d[_0xc447('0x1f')];this['reason']=_0x4ac78d[_0xc447('0x20')];this[_0xc447('0x21')]=_0x5ef39d[_0xc447('0x21')];this[_0xc447('0x22')]=_0x5ef39d[_0xc447('0x22')];this[_0xc447('0x23')]=_0x5ef39d['callbackat'];this[_0xc447('0x24')]=_0x5ef39d[_0xc447('0x24')];this[_0xc447('0x25')]=_0x5ef39d['ContactId'];this['ListId']=_0x5ef39d[_0xc447('0x26')];this[_0xc447('0x27')]=_0x5ef39d[_0xc447('0x27')];this['VoiceQueueId']=_0x5ef39d[_0xc447('0x28')];this[_0xc447('0x29')]=_0x5ef39d['CampaignId'];this[_0xc447('0x2a')]=_0x5ef39d[_0xc447('0x2a')]||'';this[_0xc447('0x2b')]=_0x5ef39d[_0xc447('0x2b')]||'';this[_0xc447('0x2c')]=_0x5ef39d[_0xc447('0x2c')];}module[_0xc447('0x2d')]=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 d0d4131..e77de3f 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 _0x06f0=['holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime'];(function(_0x3b9bc0,_0x1c48df){var _0x9eeb03=function(_0x7fb47d){while(--_0x7fb47d){_0x3b9bc0['push'](_0x3b9bc0['shift']());}};_0x9eeb03(++_0x1c48df);}(_0x06f0,0x1d7));var _0x006f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x06f0[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0xd1de49){this[_0x006f('0x0')]=_0xd1de49[_0x006f('0x0')];this[_0x006f('0x1')]=_0xd1de49[_0x006f('0x1')];this[_0x006f('0x2')]=_0xd1de49[_0x006f('0x2')];this[_0x006f('0x3')]=_0xd1de49[_0x006f('0x2')]==='outbound'?'queue':_0xd1de49['type'];this[_0x006f('0x4')]=_0xd1de49[_0x006f('0x4')];this[_0x006f('0x5')]=_0xd1de49['countcongestionretry'];this[_0x006f('0x6')]=_0xd1de49[_0x006f('0x6')];this[_0x006f('0x7')]=_0xd1de49[_0x006f('0x4')]+_0xd1de49['countcongestionretry']+_0xd1de49['countnoanswerretry']+_0xd1de49[_0x006f('0x8')]+_0xd1de49[_0x006f('0x9')]+_0xd1de49[_0x006f('0xa')]+_0xd1de49[_0x006f('0xb')]+_0xd1de49[_0x006f('0xc')];this[_0x006f('0x8')]=_0xd1de49[_0x006f('0x8')];this['countdropretry']=_0xd1de49[_0x006f('0x9')];this[_0x006f('0xa')]=_0xd1de49[_0x006f('0xa')];this[_0x006f('0xb')]=_0xd1de49[_0x006f('0xb')];this[_0x006f('0xc')]=_0xd1de49[_0x006f('0xc')];this[_0x006f('0xd')]=_0xd1de49[_0x006f('0xd')];this[_0x006f('0xe')]=_0xd1de49[_0x006f('0xe')];this[_0x006f('0xf')]=_0xd1de49[_0x006f('0xf')];this[_0x006f('0x10')]=_0xd1de49[_0x006f('0x10')];this[_0x006f('0x11')]=_0xd1de49['responsetime'];this['endtime']=_0xd1de49[_0x006f('0x11')];this[_0x006f('0x12')]=_0xd1de49[_0x006f('0x12')]||0x0;this[_0x006f('0x13')]=_0xd1de49[_0x006f('0x13')]||0x0;this[_0x006f('0x14')]=_0xd1de49[_0x006f('0x14')]||0x0;this['callback']=_0xd1de49[_0x006f('0x15')];this[_0x006f('0x16')]=_0xd1de49[_0x006f('0x16')];this[_0x006f('0x17')]=_0xd1de49[_0x006f('0x17')];this[_0x006f('0x18')]=_0xd1de49[_0x006f('0x18')];this['ContactId']=_0xd1de49[_0x006f('0x19')];this[_0x006f('0x1a')]=_0xd1de49[_0x006f('0x1a')];this['UserId']=_0xd1de49[_0x006f('0x1b')];this[_0x006f('0x1c')]=_0xd1de49['VoiceQueueId'];this[_0x006f('0x1d')]=_0xd1de49[_0x006f('0x1d')];this[_0x006f('0x1e')]=_0xd1de49[_0x006f('0x1e')]||'';this['originatecalleridname']=_0xd1de49[_0x006f('0x1f')]||'';this[_0x006f('0x20')]=_0xd1de49[_0x006f('0x20')];this['statedesc']=_0xd1de49[_0x006f('0x21')];}module[_0x006f('0x22')]=Final; \ No newline at end of file +var _0xa33d=['countnosuchnumberretry','countmachineretry','queue','calleridname','calleridnum','starttime','responsetime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry'];(function(_0x4eddb5,_0xf71395){var _0x5223bb=function(_0x38e7e9){while(--_0x38e7e9){_0x4eddb5['push'](_0x4eddb5['shift']());}};_0x5223bb(++_0xf71395);}(_0xa33d,0xbb));var _0xda33=function(_0x5b4260,_0x1b4823){_0x5b4260=_0x5b4260-0x0;var _0x204aca=_0xa33d[_0x5b4260];return _0x204aca;};'use strict';function Final(_0x5511d1){this[_0xda33('0x0')]=_0x5511d1[_0xda33('0x0')];this['scheduledat']=_0x5511d1[_0xda33('0x1')];this[_0xda33('0x2')]=_0x5511d1[_0xda33('0x2')];this['campaigntype']=_0x5511d1['type']===_0xda33('0x3')?'queue':_0x5511d1[_0xda33('0x2')];this[_0xda33('0x4')]=_0x5511d1[_0xda33('0x4')];this[_0xda33('0x5')]=_0x5511d1[_0xda33('0x5')];this[_0xda33('0x6')]=_0x5511d1['countnoanswerretry'];this[_0xda33('0x7')]=_0x5511d1[_0xda33('0x4')]+_0x5511d1['countcongestionretry']+_0x5511d1['countnoanswerretry']+_0x5511d1['countnosuchnumberretry']+_0x5511d1[_0xda33('0x8')]+_0x5511d1[_0xda33('0x9')]+_0x5511d1['countmachineretry']+_0x5511d1[_0xda33('0xa')];this[_0xda33('0xb')]=_0x5511d1['countnosuchnumberretry'];this[_0xda33('0x8')]=_0x5511d1['countdropretry'];this[_0xda33('0x9')]=_0x5511d1[_0xda33('0x9')];this['countmachineretry']=_0x5511d1[_0xda33('0xc')];this[_0xda33('0xa')]=_0x5511d1[_0xda33('0xa')];this[_0xda33('0xd')]=_0x5511d1['queue'];this[_0xda33('0xe')]=_0x5511d1[_0xda33('0xe')];this['calleridnum']=_0x5511d1[_0xda33('0xf')];this[_0xda33('0x10')]=_0x5511d1[_0xda33('0x10')];this['responsetime']=_0x5511d1[_0xda33('0x11')];this['endtime']=_0x5511d1[_0xda33('0x11')];this['ringtime']=_0x5511d1['ringtime']||0x0;this['holdtime']=_0x5511d1[_0xda33('0x12')]||0x0;this['talktime']=_0x5511d1[_0xda33('0x13')]||0x0;this[_0xda33('0x14')]=_0x5511d1[_0xda33('0x14')];this[_0xda33('0x15')]=_0x5511d1[_0xda33('0x15')];this['callbackat']=_0x5511d1[_0xda33('0x16')];this[_0xda33('0x17')]=_0x5511d1[_0xda33('0x17')];this[_0xda33('0x18')]=_0x5511d1[_0xda33('0x18')];this['ListId']=_0x5511d1[_0xda33('0x19')];this[_0xda33('0x1a')]=_0x5511d1['UserId'];this[_0xda33('0x1b')]=_0x5511d1['VoiceQueueId'];this[_0xda33('0x1c')]=_0x5511d1['CampaignId'];this[_0xda33('0x1d')]=_0x5511d1['originatecalleridnum']||'';this[_0xda33('0x1e')]=_0x5511d1[_0xda33('0x1e')]||'';this[_0xda33('0x1f')]=_0x5511d1[_0xda33('0x1f')];this[_0xda33('0x20')]=_0x5511d1['statedesc'];}module['exports']=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index f603868..bd01878 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 _0x93da=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ListId','UserId','VoiceQueueId','CampaignId','exports','moment','../utils','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','uniqueid','calleridnum','number','starttime'];(function(_0x42968e,_0x3bea04){var _0xe76974=function(_0x2115a1){while(--_0x2115a1){_0x42968e['push'](_0x42968e['shift']());}};_0xe76974(++_0x3bea04);}(_0x93da,0x8b));var _0xa93d=function(_0xf73a39,_0x222a74){_0xf73a39=_0xf73a39-0x0;var _0x244f68=_0x93da[_0xf73a39];return _0x244f68;};'use strict';var moment=require(_0xa93d('0x0'));var utils=require(_0xa93d('0x1'));function Hangup(_0x51b754,_0x151558){this['state']=0x4;this['statedesc']=_0xa93d('0x2');this['scheduledat']=_0x51b754[_0xa93d('0x3')];this[_0xa93d('0x4')]=_0x51b754[_0xa93d('0x4')];this[_0xa93d('0x5')]=_0x51b754['type']===_0xa93d('0x6')?'queue':_0x51b754[_0xa93d('0x4')];this[_0xa93d('0x7')]=_0x51b754[_0xa93d('0x7')]||![];this[_0xa93d('0x8')]=_0x51b754[_0xa93d('0x8')];this[_0xa93d('0x9')]=_0x51b754[_0xa93d('0x9')];this['countnoanswerretry']=_0x51b754['countnoanswerretry'];this[_0xa93d('0xa')]=_0x51b754[_0xa93d('0x8')]+_0x51b754[_0xa93d('0x9')]+_0x51b754[_0xa93d('0xb')]+_0x51b754[_0xa93d('0xc')]+_0x51b754[_0xa93d('0xd')]+_0x51b754['countabandonedretry']+_0x51b754[_0xa93d('0xe')]+_0x51b754[_0xa93d('0xf')];this[_0xa93d('0xc')]=_0x51b754[_0xa93d('0xc')];this['countdropretry']=_0x51b754[_0xa93d('0xd')];this[_0xa93d('0x10')]=_0x51b754['countabandonedretry'];this[_0xa93d('0xe')]=_0x51b754['countmachineretry'];this[_0xa93d('0xf')]=_0x51b754[_0xa93d('0xf')];this[_0xa93d('0x11')]=_0x151558['uniqueid'];this['calleridname']=_0x51b754['name'];this[_0xa93d('0x12')]=_0x51b754[_0xa93d('0x13')];this[_0xa93d('0x14')]=_0x51b754[_0xa93d('0x14')];this[_0xa93d('0x15')]=_0x51b754[_0xa93d('0x15')];this[_0xa93d('0x16')]=moment()[_0xa93d('0x17')](_0xa93d('0x18'));this[_0xa93d('0x19')]=utils[_0xa93d('0x1a')](_0x51b754[_0xa93d('0x15')],_0x51b754[_0xa93d('0x14')]);this['holdtime']=0x0;this['talktime']=utils[_0xa93d('0x1a')](this[_0xa93d('0x16')],_0x51b754['responsetime']);this['queue']=_0x51b754[_0xa93d('0x1b')];this[_0xa93d('0x1c')]='IVR';this[_0xa93d('0x1d')]=_0x151558[_0xa93d('0x1e')];this[_0xa93d('0x1f')]=_0x51b754[_0xa93d('0x1f')];this[_0xa93d('0x20')]=_0x51b754[_0xa93d('0x20')];this[_0xa93d('0x21')]=_0x51b754[_0xa93d('0x21')];this[_0xa93d('0x22')]=_0x51b754['recallme'];this['ContactId']=_0x51b754['ContactId'];this['ListId']=_0x51b754[_0xa93d('0x23')];this[_0xa93d('0x24')]=_0x51b754[_0xa93d('0x24')];this[_0xa93d('0x25')]=_0x51b754[_0xa93d('0x25')];this[_0xa93d('0x26')]=_0x51b754[_0xa93d('0x26')];}module[_0xa93d('0x27')]=Hangup; \ No newline at end of file +var _0x8508=['membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','Answer','scheduledat','type','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number','starttime','responsetime','endtime','format','ringtime','getSeconds','holdtime','talktime','queue'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8508,0x1b0));var _0x8850=function(_0x4c9602,_0x553667){_0x4c9602=_0x4c9602-0x0;var _0x524ddf=_0x8508[_0x4c9602];return _0x524ddf;};'use strict';var moment=require(_0x8850('0x0'));var utils=require(_0x8850('0x1'));function Hangup(_0x483ba7,_0x58517f){this[_0x8850('0x2')]=0x4;this['statedesc']=_0x8850('0x3');this['scheduledat']=_0x483ba7[_0x8850('0x4')];this[_0x8850('0x5')]=_0x483ba7[_0x8850('0x5')];this['campaigntype']=_0x483ba7['type']===_0x8850('0x6')?'queue':_0x483ba7[_0x8850('0x5')];this[_0x8850('0x7')]=_0x483ba7[_0x8850('0x7')]||![];this[_0x8850('0x8')]=_0x483ba7[_0x8850('0x8')];this[_0x8850('0x9')]=_0x483ba7['countcongestionretry'];this[_0x8850('0xa')]=_0x483ba7['countnoanswerretry'];this[_0x8850('0xb')]=_0x483ba7[_0x8850('0x8')]+_0x483ba7['countcongestionretry']+_0x483ba7[_0x8850('0xa')]+_0x483ba7['countnosuchnumberretry']+_0x483ba7[_0x8850('0xc')]+_0x483ba7[_0x8850('0xd')]+_0x483ba7[_0x8850('0xe')]+_0x483ba7[_0x8850('0xf')];this[_0x8850('0x10')]=_0x483ba7[_0x8850('0x10')];this['countdropretry']=_0x483ba7[_0x8850('0xc')];this['countabandonedretry']=_0x483ba7[_0x8850('0xd')];this[_0x8850('0xe')]=_0x483ba7[_0x8850('0xe')];this[_0x8850('0xf')]=_0x483ba7[_0x8850('0xf')];this['uniqueid']=_0x58517f[_0x8850('0x11')];this[_0x8850('0x12')]=_0x483ba7[_0x8850('0x13')];this['calleridnum']=_0x483ba7[_0x8850('0x14')];this[_0x8850('0x15')]=_0x483ba7[_0x8850('0x15')];this['responsetime']=_0x483ba7[_0x8850('0x16')];this[_0x8850('0x17')]=moment()[_0x8850('0x18')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x8850('0x19')]=utils[_0x8850('0x1a')](_0x483ba7[_0x8850('0x16')],_0x483ba7[_0x8850('0x15')]);this[_0x8850('0x1b')]=0x0;this[_0x8850('0x1c')]=utils[_0x8850('0x1a')](this[_0x8850('0x17')],_0x483ba7[_0x8850('0x16')]);this[_0x8850('0x1d')]=_0x483ba7[_0x8850('0x1d')];this[_0x8850('0x1e')]=_0x8850('0x1f');this[_0x8850('0x20')]=_0x58517f['cause-txt'];this[_0x8850('0x21')]=_0x483ba7[_0x8850('0x21')];this[_0x8850('0x22')]=_0x483ba7[_0x8850('0x22')];this[_0x8850('0x23')]=_0x483ba7[_0x8850('0x23')];this[_0x8850('0x24')]=_0x483ba7[_0x8850('0x24')];this[_0x8850('0x25')]=_0x483ba7[_0x8850('0x25')];this[_0x8850('0x26')]=_0x483ba7[_0x8850('0x26')];this[_0x8850('0x27')]=_0x483ba7[_0x8850('0x27')];this[_0x8850('0x28')]=_0x483ba7['VoiceQueueId'];this[_0x8850('0x29')]=_0x483ba7[_0x8850('0x29')];}module['exports']=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 2799141..25afb34 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 _0x6467=['responsetime','endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','exports','../utils','uniqueid','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime'];(function(_0x46021c,_0x5890eb){var _0x33aabe=function(_0x4bdeb0){while(--_0x4bdeb0){_0x46021c['push'](_0x46021c['shift']());}};_0x33aabe(++_0x5890eb);}(_0x6467,0x179));var _0x7646=function(_0x461004,_0xe15a6){_0x461004=_0x461004-0x0;var _0x370ca6=_0x6467[_0x461004];return _0x370ca6;};'use strict';var utils=require(_0x7646('0x0'));function History(_0x3d0207){this['uniqueid']=_0x3d0207[_0x7646('0x1')];this['scheduledat']=_0x3d0207[_0x7646('0x2')]||undefined;this['type']=_0x3d0207['type'];this['campaigntype']=_0x3d0207[_0x7646('0x3')]==='outbound'?'queue':_0x3d0207[_0x7646('0x3')];this[_0x7646('0x4')]=_0x3d0207['countbusyretry'];this['countcongestionretry']=_0x3d0207[_0x7646('0x5')];this[_0x7646('0x6')]=_0x3d0207[_0x7646('0x6')];this[_0x7646('0x7')]=_0x3d0207['countbusyretry']+_0x3d0207[_0x7646('0x5')]+_0x3d0207[_0x7646('0x6')]+_0x3d0207['countnosuchnumberretry']+_0x3d0207[_0x7646('0x8')]+_0x3d0207[_0x7646('0x9')]+_0x3d0207['countmachineretry']+_0x3d0207['countagentrejectretry'];this[_0x7646('0xa')]=_0x3d0207[_0x7646('0xa')];this[_0x7646('0x8')]=_0x3d0207[_0x7646('0x8')];this[_0x7646('0x9')]=_0x3d0207[_0x7646('0x9')];this[_0x7646('0xb')]=_0x3d0207[_0x7646('0xb')];this['countagentrejectretry']=_0x3d0207[_0x7646('0xc')];this[_0x7646('0xd')]=_0x3d0207[_0x7646('0xd')];this[_0x7646('0xe')]=_0x3d0207[_0x7646('0xf')];this[_0x7646('0x10')]=_0x3d0207[_0x7646('0x11')];this[_0x7646('0x12')]=_0x3d0207['starttime'];this[_0x7646('0x13')]=_0x3d0207[_0x7646('0x13')];this[_0x7646('0x14')]=_0x3d0207[_0x7646('0x13')];this['ringtime']=utils[_0x7646('0x15')](_0x3d0207[_0x7646('0x13')],_0x3d0207[_0x7646('0x12')]);this[_0x7646('0x16')]=0x0;this['talktime']=0x0;this[_0x7646('0x17')]=_0x3d0207[_0x7646('0x17')];this[_0x7646('0x18')]=_0x3d0207[_0x7646('0x18')];this[_0x7646('0x19')]=_0x3d0207[_0x7646('0x19')];this['recallme']=_0x3d0207[_0x7646('0x1a')];this['ContactId']=_0x3d0207[_0x7646('0x1b')];this['ListId']=_0x3d0207[_0x7646('0x1c')];this['UserId']=_0x3d0207[_0x7646('0x1d')];this[_0x7646('0x1e')]=_0x3d0207[_0x7646('0x1e')];this[_0x7646('0x1f')]=_0x3d0207[_0x7646('0x1f')];this[_0x7646('0x20')]=_0x3d0207[_0x7646('0x20')]||'';this['originatecalleridname']=_0x3d0207['originatecalleridname']||'';this[_0x7646('0x21')]=_0x3d0207[_0x7646('0x21')];this['statedesc']=_0x3d0207[_0x7646('0x22')];}module[_0x7646('0x23')]=History; \ No newline at end of file +var _0xd5fc=['scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid'];(function(_0x5f5ac5,_0x526505){var _0x3697f2=function(_0x49cec5){while(--_0x49cec5){_0x5f5ac5['push'](_0x5f5ac5['shift']());}};_0x3697f2(++_0x526505);}(_0xd5fc,0xf4));var _0xcd5f=function(_0x565919,_0x42a861){_0x565919=_0x565919-0x0;var _0x23e3f9=_0xd5fc[_0x565919];return _0x23e3f9;};'use strict';var utils=require('../utils');function History(_0x48c24a){this[_0xcd5f('0x0')]=_0x48c24a[_0xcd5f('0x0')];this[_0xcd5f('0x1')]=_0x48c24a['scheduledat']||undefined;this[_0xcd5f('0x2')]=_0x48c24a[_0xcd5f('0x2')];this['campaigntype']=_0x48c24a[_0xcd5f('0x2')]===_0xcd5f('0x3')?'queue':_0x48c24a[_0xcd5f('0x2')];this[_0xcd5f('0x4')]=_0x48c24a['countbusyretry'];this['countcongestionretry']=_0x48c24a[_0xcd5f('0x5')];this[_0xcd5f('0x6')]=_0x48c24a[_0xcd5f('0x6')];this[_0xcd5f('0x7')]=_0x48c24a[_0xcd5f('0x4')]+_0x48c24a[_0xcd5f('0x5')]+_0x48c24a[_0xcd5f('0x6')]+_0x48c24a['countnosuchnumberretry']+_0x48c24a[_0xcd5f('0x8')]+_0x48c24a['countabandonedretry']+_0x48c24a[_0xcd5f('0x9')]+_0x48c24a['countagentrejectretry'];this['countnosuchnumberretry']=_0x48c24a['countnosuchnumberretry'];this[_0xcd5f('0x8')]=_0x48c24a['countdropretry'];this[_0xcd5f('0xa')]=_0x48c24a[_0xcd5f('0xa')];this[_0xcd5f('0x9')]=_0x48c24a['countmachineretry'];this['countagentrejectretry']=_0x48c24a[_0xcd5f('0xb')];this[_0xcd5f('0xc')]=_0x48c24a[_0xcd5f('0xc')];this[_0xcd5f('0xd')]=_0x48c24a[_0xcd5f('0xe')];this[_0xcd5f('0xf')]=_0x48c24a[_0xcd5f('0x10')];this[_0xcd5f('0x11')]=_0x48c24a['starttime'];this[_0xcd5f('0x12')]=_0x48c24a['responsetime'];this['endtime']=_0x48c24a[_0xcd5f('0x12')];this[_0xcd5f('0x13')]=utils[_0xcd5f('0x14')](_0x48c24a['responsetime'],_0x48c24a[_0xcd5f('0x11')]);this[_0xcd5f('0x15')]=0x0;this['talktime']=0x0;this[_0xcd5f('0x16')]=_0x48c24a[_0xcd5f('0x16')];this['callbackuniqueid']=_0x48c24a[_0xcd5f('0x17')];this[_0xcd5f('0x18')]=_0x48c24a[_0xcd5f('0x18')];this['recallme']=_0x48c24a[_0xcd5f('0x19')];this[_0xcd5f('0x1a')]=_0x48c24a[_0xcd5f('0x1a')];this[_0xcd5f('0x1b')]=_0x48c24a['ListId'];this['UserId']=_0x48c24a['UserId'];this[_0xcd5f('0x1c')]=_0x48c24a['VoiceQueueId'];this['CampaignId']=_0x48c24a[_0xcd5f('0x1d')];this['originatecalleridnum']=_0x48c24a[_0xcd5f('0x1e')]||'';this[_0xcd5f('0x1f')]=_0x48c24a[_0xcd5f('0x1f')]||'';this[_0xcd5f('0x20')]=_0x48c24a[_0xcd5f('0x20')];this['statedesc']=_0x48c24a[_0xcd5f('0x21')];}module[_0xcd5f('0x22')]=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 8e690cd..53418f0 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 _0x2883=['exports','../utils','scheduledat','type','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state'];(function(_0xd9b4b7,_0x288556){var _0x22445d=function(_0x1dbe57){while(--_0x1dbe57){_0xd9b4b7['push'](_0xd9b4b7['shift']());}};_0x22445d(++_0x288556);}(_0x2883,0xfd));var _0x3288=function(_0x54b59a,_0x42ed59){_0x54b59a=_0x54b59a-0x0;var _0x6c4407=_0x2883[_0x54b59a];return _0x6c4407;};'use strict';var utils=require(_0x3288('0x0'));function QueueCallerAbandon(_0x552dac,_0x47b6bf){this[_0x3288('0x1')]=_0x552dac[_0x3288('0x1')];this[_0x3288('0x2')]=_0x552dac[_0x3288('0x2')];this['campaigntype']=_0x552dac[_0x3288('0x2')]==='outbound'?'queue':_0x552dac[_0x3288('0x2')];this['countbusyretry']=_0x552dac[_0x3288('0x3')];this[_0x3288('0x4')]=_0x552dac[_0x3288('0x4')];this[_0x3288('0x5')]=_0x552dac['countnoanswerretry'];this['countglobal']=_0x552dac[_0x3288('0x3')]+_0x552dac[_0x3288('0x4')]+_0x552dac[_0x3288('0x5')]+_0x552dac[_0x3288('0x6')]+_0x552dac['countdropretry']+_0x552dac[_0x3288('0x7')]+_0x552dac[_0x3288('0x8')]+_0x552dac['countagentrejectretry'];this[_0x3288('0x6')]=_0x552dac[_0x3288('0x6')];this[_0x3288('0x9')]=_0x552dac[_0x3288('0x9')];this[_0x3288('0x7')]=_0x552dac[_0x3288('0x7')];this[_0x3288('0x8')]=_0x552dac[_0x3288('0x8')];this[_0x3288('0xa')]=_0x552dac[_0x3288('0xa')];this[_0x3288('0xb')]=_0x47b6bf[_0x3288('0xb')];this[_0x3288('0xc')]=_0x552dac[_0x3288('0xd')];this[_0x3288('0xe')]=_0x552dac[_0x3288('0xf')];this['starttime']=_0x552dac[_0x3288('0x10')];this[_0x3288('0x11')]=_0x552dac[_0x3288('0x11')];this[_0x3288('0x12')]=_0x552dac[_0x3288('0x12')];this[_0x3288('0x13')]=_0x552dac['dropreason'];this[_0x3288('0x14')]=this['droptime'];this[_0x3288('0x15')]=utils[_0x3288('0x16')](_0x552dac[_0x3288('0x11')],_0x552dac['starttime']);this['holdtime']=utils[_0x3288('0x16')](this[_0x3288('0x12')],_0x552dac['responsetime']);this[_0x3288('0x17')]=0x0;this['queue']=_0x47b6bf[_0x3288('0x18')];this[_0x3288('0x19')]=_0x47b6bf[_0x3288('0x1a')];this[_0x3288('0x1b')]=_0x47b6bf[_0x3288('0x1b')];this['callback']=_0x552dac[_0x3288('0x1c')];this[_0x3288('0x1d')]=_0x552dac[_0x3288('0x1d')];this[_0x3288('0x1e')]=_0x552dac[_0x3288('0x1e')];this[_0x3288('0x1f')]=_0x552dac[_0x3288('0x1f')];this[_0x3288('0x20')]=_0x552dac[_0x3288('0x20')];this[_0x3288('0x21')]=_0x552dac[_0x3288('0x21')];this[_0x3288('0x22')]=_0x552dac[_0x3288('0x22')];this['VoiceQueueId']=_0x552dac[_0x3288('0x23')];this[_0x3288('0x24')]=_0x552dac[_0x3288('0x24')];this[_0x3288('0x25')]=_0x552dac[_0x3288('0x25')]||'';this[_0x3288('0x26')]=_0x552dac[_0x3288('0x26')]||'';this[_0x3288('0x27')]=_0x552dac[_0x3288('0x27')];this[_0x3288('0x28')]=_0x552dac[_0x3288('0x28')];this['statedesc']=_0x552dac['statedesc'];}module[_0x3288('0x29')]=QueueCallerAbandon; \ No newline at end of file +var _0x7ba8=['uniqueid','name','number','starttime','droptime','endtime','getSeconds','responsetime','holdtime','talktime','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry'];(function(_0x53e029,_0x280473){var _0x1d1885=function(_0x289e9d){while(--_0x289e9d){_0x53e029['push'](_0x53e029['shift']());}};_0x1d1885(++_0x280473);}(_0x7ba8,0x16f));var _0x87ba=function(_0x579840,_0x17d9bf){_0x579840=_0x579840-0x0;var _0x568bd3=_0x7ba8[_0x579840];return _0x568bd3;};'use strict';var utils=require(_0x87ba('0x0'));function QueueCallerAbandon(_0x471b7d,_0x3db0b4){this['scheduledat']=_0x471b7d['scheduledat'];this[_0x87ba('0x1')]=_0x471b7d[_0x87ba('0x1')];this[_0x87ba('0x2')]=_0x471b7d['type']===_0x87ba('0x3')?_0x87ba('0x4'):_0x471b7d[_0x87ba('0x1')];this[_0x87ba('0x5')]=_0x471b7d[_0x87ba('0x5')];this[_0x87ba('0x6')]=_0x471b7d[_0x87ba('0x6')];this['countnoanswerretry']=_0x471b7d[_0x87ba('0x7')];this['countglobal']=_0x471b7d['countbusyretry']+_0x471b7d[_0x87ba('0x6')]+_0x471b7d[_0x87ba('0x7')]+_0x471b7d[_0x87ba('0x8')]+_0x471b7d['countdropretry']+_0x471b7d[_0x87ba('0x9')]+_0x471b7d[_0x87ba('0xa')]+_0x471b7d['countagentrejectretry'];this[_0x87ba('0x8')]=_0x471b7d[_0x87ba('0x8')];this[_0x87ba('0xb')]=_0x471b7d['countdropretry'];this[_0x87ba('0x9')]=_0x471b7d['countabandonedretry'];this[_0x87ba('0xa')]=_0x471b7d[_0x87ba('0xa')];this[_0x87ba('0xc')]=_0x471b7d[_0x87ba('0xc')];this[_0x87ba('0xd')]=_0x3db0b4['uniqueid'];this['calleridname']=_0x471b7d[_0x87ba('0xe')];this['calleridnum']=_0x471b7d[_0x87ba('0xf')];this['starttime']=_0x471b7d[_0x87ba('0x10')];this['responsetime']=_0x471b7d['responsetime'];this[_0x87ba('0x11')]=_0x471b7d[_0x87ba('0x11')];this['dropreason']=_0x471b7d['dropreason'];this[_0x87ba('0x12')]=this[_0x87ba('0x11')];this['ringtime']=utils[_0x87ba('0x13')](_0x471b7d[_0x87ba('0x14')],_0x471b7d[_0x87ba('0x10')]);this[_0x87ba('0x15')]=utils['getSeconds'](this[_0x87ba('0x11')],_0x471b7d[_0x87ba('0x14')]);this[_0x87ba('0x16')]=0x0;this[_0x87ba('0x4')]=_0x3db0b4[_0x87ba('0x4')];this[_0x87ba('0x17')]=_0x3db0b4[_0x87ba('0x18')];this['reason']=_0x3db0b4['reason'];this[_0x87ba('0x19')]=_0x471b7d['callback'];this[_0x87ba('0x1a')]=_0x471b7d[_0x87ba('0x1a')];this['callbackat']=_0x471b7d[_0x87ba('0x1b')];this[_0x87ba('0x1c')]=_0x471b7d[_0x87ba('0x1c')];this[_0x87ba('0x1d')]=_0x471b7d['ContactId'];this[_0x87ba('0x1e')]=_0x471b7d['ListId'];this['UserId']=_0x471b7d[_0x87ba('0x1f')];this['VoiceQueueId']=_0x471b7d['VoiceQueueId'];this['CampaignId']=_0x471b7d[_0x87ba('0x20')];this[_0x87ba('0x21')]=_0x471b7d['originatecalleridnum']||'';this[_0x87ba('0x22')]=_0x471b7d[_0x87ba('0x22')]||'';this['agiafterat']=_0x471b7d[_0x87ba('0x23')];this[_0x87ba('0x24')]=_0x471b7d[_0x87ba('0x24')];this[_0x87ba('0x25')]=_0x471b7d['statedesc'];}module['exports']=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 52f5dd3..1b086ca 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 _0xc4aa=['temp','error','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','[unlockContact]','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','getContactDialer','dialOrderByScheduledAt','catch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xc4aa[_0x2e4aa2];return _0x5e6092;};'use strict';var util=require(_0xac4a('0x0'));var logger=require(_0xac4a('0x1'))(_0xac4a('0x2'));var cmHopper=require(_0xac4a('0x3'));var cmHopperAdditionalPhone=require(_0xac4a('0x4'));var cmHopperBlack=require(_0xac4a('0x5'));var cmHopperHistory=require('../../rpc/cmHopperHistory');function inspectError(_0x5cda73){return util['inspect'](_0x5cda73,{'showHidden':![],'depth':null});}function getContactDialer(_0x2f48ed,_0x15b967,_0x730a38){return cmHopper[_0xac4a('0x6')](_0x2f48ed['id'],_0x15b967,_0x730a38,_0x2f48ed[_0xac4a('0x7')])[_0xac4a('0x8')](function(_0x3ef77c){_0x2f48ed[_0xac4a('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0x3ef77c));});}exports[_0xac4a('0x6')]=getContactDialer;function getContactDialerIvr(_0x2a4d53,_0x26ec84){return cmHopper['getContactDialerIvr'](_0x2a4d53['id'],_0x26ec84,_0x2a4d53[_0xac4a('0x7')])[_0xac4a('0x8')](function(_0x3e64f5){_0x2a4d53['temp']=0x0;logger[_0xac4a('0xa')]('[getContactDialerIvr]',inspectError(_0x3e64f5));});}exports[_0xac4a('0xb')]=getContactDialerIvr;function countReScheduled(_0x4855b6){return cmHopper[_0xac4a('0xc')](_0x4855b6)[_0xac4a('0x8')](function(_0x24291d){logger['error'](_0xac4a('0xd'),inspectError(_0x24291d));});}exports[_0xac4a('0xc')]=countReScheduled;function rescheduleContact(_0x247b78){return cmHopper[_0xac4a('0xe')](_0x247b78)[_0xac4a('0x8')](function(_0x3b71c0){logger[_0xac4a('0xa')](_0xac4a('0xf'),inspectError(_0x3b71c0));});}exports[_0xac4a('0xe')]=rescheduleContact;function unlockContact(_0x42c7fc,_0x11e101,_0x26dbb8){return cmHopper['unlockContact'](_0x42c7fc,_0x11e101,_0x26dbb8)[_0xac4a('0x8')](function(_0x34d797){logger[_0xac4a('0xa')](_0xac4a('0x10'),inspectError(_0x34d797));});}exports[_0xac4a('0x11')]=unlockContact;function moveContactManagedDialer(_0x387a54){return cmHopper[_0xac4a('0x12')](_0x387a54)[_0xac4a('0x8')](function(_0x546c5d){logger['error'](_0xac4a('0x13'),inspectError(_0x546c5d));});}exports[_0xac4a('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x39b691){return cmHopperBlack['checkIsBlackList'](_0x39b691)[_0xac4a('0x8')](function(_0x15c223){logger[_0xac4a('0xa')](_0xac4a('0x14'),inspectError(_0x15c223));});}exports[_0xac4a('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x3e829c){return cmHopperBlack[_0xac4a('0x16')](_0x3e829c)[_0xac4a('0x8')](function(_0x534092){logger[_0xac4a('0xa')](_0xac4a('0x17'),inspectError(_0x534092));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d7ce0,_0x4169c0,_0x3eacd3){return cmHopperAdditionalPhone[_0xac4a('0x18')](_0x3d7ce0,_0x4169c0,_0x3eacd3)['catch'](function(_0x1b7998){logger[_0xac4a('0xa')](_0xac4a('0x19'),inspectError(_0x1b7998));});}exports[_0xac4a('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x594f36,_0x2b0dc2,_0x222507){return cmHopperAdditionalPhone[_0xac4a('0x1a')](_0x594f36,_0x2b0dc2,_0x222507)[_0xac4a('0x8')](function(_0x3bc318){logger[_0xac4a('0xa')](_0xac4a('0x1b'),inspectError(_0x3bc318));});}exports[_0xac4a('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x472c57){return cmHopperHistory[_0xac4a('0x1c')](_0x472c57)[_0xac4a('0x8')](function(_0x4e17ce){logger[_0xac4a('0xa')](_0xac4a('0x1d'),inspectError(_0x4e17ce));});}exports[_0xac4a('0x1c')]=avgHandleTime;function createHistory(_0x2772fe){return cmHopperHistory[_0xac4a('0x1e')](_0x2772fe)['catch'](function(_0x47f49c){logger[_0xac4a('0xa')](_0xac4a('0x1f'),inspectError(_0x47f49c));});}exports[_0xac4a('0x1e')]=createHistory; \ No newline at end of file +var _0x2da6=['../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','createHistory','[createHistory]','util','../../../../config/logger','dialer'];(function(_0x577891,_0x50762b){var _0x31ad13=function(_0x1a9ada){while(--_0x1a9ada){_0x577891['push'](_0x577891['shift']());}};_0x31ad13(++_0x50762b);}(_0x2da6,0x1dd));var _0x62da=function(_0x195552,_0x25d4d6){_0x195552=_0x195552-0x0;var _0x48166b=_0x2da6[_0x195552];return _0x48166b;};'use strict';var util=require(_0x62da('0x0'));var logger=require(_0x62da('0x1'))(_0x62da('0x2'));var cmHopper=require(_0x62da('0x3'));var cmHopperAdditionalPhone=require(_0x62da('0x4'));var cmHopperBlack=require(_0x62da('0x5'));var cmHopperHistory=require(_0x62da('0x6'));function inspectError(_0x3552dc){return util['inspect'](_0x3552dc,{'showHidden':![],'depth':null});}function getContactDialer(_0x4a8428,_0xe28204,_0x3163df){return cmHopper[_0x62da('0x7')](_0x4a8428['id'],_0xe28204,_0x3163df,_0x4a8428[_0x62da('0x8')])[_0x62da('0x9')](function(_0x9d9139){_0x4a8428[_0x62da('0xa')]=0x0;logger[_0x62da('0xb')](_0x62da('0xc'),inspectError(_0x9d9139));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x19b866,_0x2a3937){return cmHopper[_0x62da('0xd')](_0x19b866['id'],_0x2a3937,_0x19b866[_0x62da('0x8')])['catch'](function(_0x241090){_0x19b866[_0x62da('0xa')]=0x0;logger[_0x62da('0xb')](_0x62da('0xe'),inspectError(_0x241090));});}exports[_0x62da('0xd')]=getContactDialerIvr;function countReScheduled(_0x5c990c){return cmHopper[_0x62da('0xf')](_0x5c990c)[_0x62da('0x9')](function(_0xd27693){logger[_0x62da('0xb')](_0x62da('0x10'),inspectError(_0xd27693));});}exports['countReScheduled']=countReScheduled;function rescheduleContact(_0x47c18e){return cmHopper[_0x62da('0x11')](_0x47c18e)[_0x62da('0x9')](function(_0x1bd7f9){logger[_0x62da('0xb')](_0x62da('0x12'),inspectError(_0x1bd7f9));});}exports[_0x62da('0x11')]=rescheduleContact;function unlockContact(_0x3c6498,_0x624a1c,_0x2cbdf6){return cmHopper[_0x62da('0x13')](_0x3c6498,_0x624a1c,_0x2cbdf6)[_0x62da('0x9')](function(_0x27ab5f){logger[_0x62da('0xb')](_0x62da('0x14'),inspectError(_0x27ab5f));});}exports['unlockContact']=unlockContact;function moveContactManagedDialer(_0x4ad626){return cmHopper[_0x62da('0x15')](_0x4ad626)['catch'](function(_0x4d6482){logger[_0x62da('0xb')](_0x62da('0x16'),inspectError(_0x4d6482));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0x29191b){return cmHopperBlack['checkIsBlackList'](_0x29191b)[_0x62da('0x9')](function(_0x37c15d){logger[_0x62da('0xb')](_0x62da('0x17'),inspectError(_0x37c15d));});}exports[_0x62da('0x18')]=checkIsBlackList;function checkIsBlackListIvr(_0x267cef){return cmHopperBlack[_0x62da('0x19')](_0x267cef)[_0x62da('0x9')](function(_0x1cb647){logger['error'](_0x62da('0x1a'),inspectError(_0x1cb647));});}exports[_0x62da('0x19')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x2fd925,_0x1f6f96,_0x35f687){return cmHopperAdditionalPhone[_0x62da('0x1b')](_0x2fd925,_0x1f6f96,_0x35f687)[_0x62da('0x9')](function(_0x50ed6b){logger['error']('[verifyAdditionalPhone]',inspectError(_0x50ed6b));});}exports[_0x62da('0x1b')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x1d1ef3,_0x14897c,_0x3f6fc9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x1d1ef3,_0x14897c,_0x3f6fc9)[_0x62da('0x9')](function(_0x3b9c06){logger['error'](_0x62da('0x1c'),inspectError(_0x3b9c06));});}exports[_0x62da('0x1d')]=swapAdditionalPhones;function avgHandleTime(_0x1775ea){return cmHopperHistory['avgHandleTime'](_0x1775ea)[_0x62da('0x9')](function(_0x87f92b){logger[_0x62da('0xb')]('[avgHandleTime]',inspectError(_0x87f92b));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x3c6274){return cmHopperHistory[_0x62da('0x1e')](_0x3c6274)[_0x62da('0x9')](function(_0x594c5a){logger[_0x62da('0xb')](_0x62da('0x1f'),inspectError(_0x594c5a));});}exports[_0x62da('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 35170e6..669d93c 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 _0x396e=['dialMethod','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Intervals','isEmpty','Interval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','reachable','includes','status','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','DISACTIVED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','\x22%s\x22\x20<%s>','format','string','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','checkContactLowerLimitOriginate','createdAt','tags','updatedAt','undefined','description','XMD-','toUpperCase','substring','setXMDContactVariables','lodash','moment','util','dialer','../../../../config/environment/shared','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x396e,0x10e));var _0xe396=function(_0x55b2d9,_0x8d8130){_0x55b2d9=_0x55b2d9-0x0;var _0x2ebe76=_0x396e[_0x55b2d9];return _0x2ebe76;};'use strict';var _=require(_0xe396('0x0'));var moment=require(_0xe396('0x1'));var util=require(_0xe396('0x2'));var logger=require('../../../../config/logger')(_0xe396('0x3'));var timezones=require(_0xe396('0x4'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xe396('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xe396('0x6'),'DEACTIVATED':_0xe396('0x7'),'DISACTIVED':_0xe396('0x8'),'EMPTY_INTERVAL':_0xe396('0x9'),'INACTIVE':_0xe396('0xa'),'NO_AGENTS_LOGGED':_0xe396('0xb'),'NO_AVAILABLE_CONTACTS':_0xe396('0xc'),'NULL_INTERVAL':_0xe396('0xd'),'OVERTIME_INTERVAL':_0xe396('0xe'),'OVERTIME_GLOBAL_INTERVAL':_0xe396('0xf'),'QUEUE_RECALL':_0xe396('0x10'),'RECALL_TIMEOUT':_0xe396('0x11'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xe396('0x12'),'UNREACHABLE_TRUNK':_0xe396('0x13')};exports[_0xe396('0x14')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x78e566){return _0x78e566[_0xe396('0x15')]==='preview';}exports[_0xe396('0x16')]=isPreviewCampaign;function isIVRCampaign(_0x29b780){return _0x29b780[_0xe396('0x17')]===_0xe396('0x18');}exports[_0xe396('0x19')]=isIVRCampaign;function isOutboundQueue(_0x17a313){return _0x17a313[_0xe396('0x17')]===_0xe396('0x1a');}exports['isOutboundQueue']=isOutboundQueue;function isQueueCampaignActive(_0x18a072){return _0x18a072[_0xe396('0x1b')];}exports[_0xe396('0x1c')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2c0c27){return _0x2c0c27[_0xe396('0x1d')];}exports[_0xe396('0x1e')]=isIVRCampaignActive;function getSeconds(_0xedc6cd,_0x4e4d05){var _0x1db0bc=moment(_0xedc6cd)[_0xe396('0x1f')](0x0);var _0x13cb8d=moment(_0x4e4d05)['milliseconds'](0x0);return _0x1db0bc[_0xe396('0x20')](_0x13cb8d,_0xe396('0x21'));}exports[_0xe396('0x22')]=getSeconds;function hasQueueCampaignDataChanged(_0x515b1d,_0x3ee9e8){var _0x5b5fd1=![];var _0x2088ac=_0x515b1d[_0xe396('0x15')]!==_0x3ee9e8[_0xe396('0x15')]||_0x515b1d[_0xe396('0x1b')]!==_0x3ee9e8['dialActive']||_0x515b1d[_0xe396('0x23')]!==_0x3ee9e8[_0xe396('0x23')];var _0x2b6516=_0x515b1d[_0xe396('0x24')]!==_0x3ee9e8[_0xe396('0x24')]||_0x515b1d[_0xe396('0x25')]!==_0x3ee9e8[_0xe396('0x25')]||_0x515b1d[_0xe396('0x26')]!==_0x3ee9e8[_0xe396('0x26')]||_0x515b1d[_0xe396('0x27')]!==_0x3ee9e8['paused']||_0x515b1d[_0xe396('0x28')]!==_0x3ee9e8[_0xe396('0x28')]||_0x515b1d[_0xe396('0x29')]!==_0x3ee9e8[_0xe396('0x29')]||_0x515b1d[_0xe396('0x2a')]!==_0x3ee9e8[_0xe396('0x2a')]||_0x515b1d[_0xe396('0x2b')]!==_0x3ee9e8[_0xe396('0x2b')]||_0x515b1d[_0xe396('0x2c')]!==_0x3ee9e8[_0xe396('0x2c')];if(_0x515b1d[_0xe396('0x2d')]&&_0x3ee9e8[_0xe396('0x2d')]){_0x5b5fd1=_0x515b1d[_0xe396('0x2d')][_0xe396('0x2e')]!==_0x3ee9e8[_0xe396('0x2d')][_0xe396('0x2e')]||_0x515b1d[_0xe396('0x2d')][_0xe396('0x1d')]!==_0x3ee9e8['Trunk'][_0xe396('0x1d')];}return _0x2088ac||_0x2b6516||_0x5b5fd1;}exports[_0xe396('0x2f')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x450c85){var _0xc4a78e=null;var _0x2b76b1=_0x450c85[_0xe396('0x30')];if(_[_0xe396('0x31')](_0x450c85[_0xe396('0x32')])||_[_0xe396('0x31')](_0x450c85['Interval'])||_[_0xe396('0x31')](_0x450c85['Interval'][_0xe396('0x33')])){_0xc4a78e=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0xe396('0x34')](_0x450c85[_0xe396('0x32')])||_['isEmpty'](_0x450c85[_0xe396('0x35')]['Intervals'])){_0xc4a78e=CAMPAIGN_STATUS[_0xe396('0x36')];}else if(_0x2b76b1&&!timezones[_0x2b76b1]){_0xc4a78e=CAMPAIGN_STATUS[_0xe396('0x37')];}return _0xc4a78e;}function checkAnyValidTrunk(_0x5687dd,_0x31fc53){var _0xdfb7c=null;var _0x3fd16b=_0xe396('0x38');var _0xc54f99=[_0xe396('0x39'),'unmonitored'];var _0x1c0c04=!![];if(_0x5687dd[_0xe396('0x2d')]&&_0x5687dd['Trunk'][_0xe396('0x1d')]){_0x3fd16b+=_0x5687dd['Trunk'][_0xe396('0x2e')];_0xdfb7c=_0x31fc53[_0x3fd16b];_0x1c0c04=_0xc54f99[_0xe396('0x3a')](_0xdfb7c[_0xe396('0x3b')]);}else if(_0x5687dd[_0xe396('0x3c')]&&_0x5687dd[_0xe396('0x3c')][_0xe396('0x1d')]){_0x3fd16b+=_0x5687dd[_0xe396('0x3c')]['name'];_0xdfb7c=_0x31fc53[_0x3fd16b];_0x1c0c04=_0xc54f99['includes'](_0xdfb7c[_0xe396('0x3b')]);}return _0x1c0c04;}function getQueueCampaignStatusMessage(_0x4284af,_0x57935b){var _0x2168e2=CAMPAIGN_STATUS['ACTIVE'];var _0x343e58=isPreviewCampaign(_0x4284af);if(!isQueueCampaignActive(_0x4284af)){if(_0x343e58){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3d')];}else{if(_0x4284af[_0xe396('0x2c')]===0x0&&_0x4284af[_0xe396('0x28')]===0x0&&_0x4284af[_0xe396('0x2a')]===0x0&&(_0x4284af[_0xe396('0x29')]||0x0)===0x0){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3d')];}else{_0x2168e2=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x4284af[_0xe396('0x25')]===0x0){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3e')];}else if(!checkAnyValidTrunk(_0x4284af,_0x57935b)){_0x2168e2=CAMPAIGN_STATUS[_0xe396('0x3f')];}else if(!isPreviewCampaign(_0x4284af)){var _0x480ded=checkAnyValidQueueCampaignInterval(_0x4284af);if(_0x480ded){_0x2168e2=_0x480ded;}}return _0x2168e2;}exports[_0xe396('0x40')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x31dffa){var _0x4173da=CAMPAIGN_STATUS[_0xe396('0x41')];if(_0x31dffa[_0xe396('0x2c')]===0x0&&_0x31dffa[_0xe396('0x28')]===0x0&&_0x31dffa[_0xe396('0x2a')]===0x0&&(_0x31dffa[_0xe396('0x29')]||0x0)===0x0){_0x4173da=CAMPAIGN_STATUS[_0xe396('0x3d')];}return _0x4173da;}exports[_0xe396('0x42')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x708c27){var _0x3b3aef=_0x708c27[_0xe396('0x43')](/"(.*?)"/);return _0x3b3aef?_0x3b3aef[0x1]:_0x708c27;}exports[_0xe396('0x44')]=extractCalleridName;function getCallerId(_0x3c2e87,_0x51d438,_0x3f2975){if(!_[_0xe396('0x45')](_0x3f2975)&&typeof _0x3f2975==='string'&&!_[_0xe396('0x34')](_0x3f2975)){if(!_[_0xe396('0x45')](_0x51d438)&&typeof _0x51d438==='string'&&!_[_0xe396('0x34')](_0x51d438)){return util['format'](_0xe396('0x46'),_0x51d438,_0x3f2975);}return util[_0xe396('0x47')](_0xe396('0x46'),_0x3f2975,_0x3f2975);}if(!_[_0xe396('0x45')](_0x3c2e87)&&typeof _0x3c2e87===_0xe396('0x48')&&!_[_0xe396('0x34')](_0x3c2e87)){return _0x3c2e87;}return _0xe396('0x49');}exports[_0xe396('0x4a')]=getCallerId;function getCallerIdRandom(_0x654999,_0x5e25c2){var _0x44e819;var _0x223fb5;var _0x85ca1;if(_0x5e25c2<=0x0){_0x5e25c2=0x1;}_0x44e819=new RegExp(_0xe396('0x4b')+_0x5e25c2+'}$');_0x223fb5=Math['pow'](0xa,_0x5e25c2-0x1);_0x85ca1=Math[_0xe396('0x4c')](0xa,_0x5e25c2)-0x1;return util[_0xe396('0x47')]('%s',_[_0xe396('0x4d')](_0x654999,_0x44e819,_[_0xe396('0x4e')](_0x223fb5,_0x85ca1)[_0xe396('0x4f')]()));}exports[_0xe396('0x50')]=getCallerIdRandom;function decrementOriginate(_0x4ed420,_0x4f91e4){if(_0x4ed420[_0xe396('0x2c')]&&_0x4ed420[_0xe396('0x2c')]>0x0){_0x4ed420[_0xe396('0x2c')]-=0x1;}else{logger[_0xe396('0x51')](_0xe396('0x52'),_0x4f91e4);}}exports[_0xe396('0x53')]=decrementOriginate;function checkContactEmpty(_0x3c5fc8){return _0x3c5fc8&&_0x3c5fc8[_0xe396('0x54')]>0x0;}exports[_0xe396('0x55')]=checkContactEmpty;function erlangb(_0x18f106,_0x335cba){if(_0x335cba===0x0){return 0x0;}var _0x4921d6=0x1;for(var _0xd8fb77=0x1;_0xd8fb77<=_0x335cba;_0xd8fb77+=0x1){_0x4921d6=0x1+_0x4921d6*_0xd8fb77/_0x18f106;}return 0x1/_0x4921d6;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2ab7f5,_0x470ed6,_0x3caab3){if(_0x470ed6>_0x3caab3){for(var _0x3ce0f6=0x0;_0x3ce0f6<_0x470ed6-_0x3caab3;_0x3ce0f6+=0x1){decrementOriginate(_0x2ab7f5,_0xe396('0x56'));}}}exports[_0xe396('0x57')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x4344d2){var _0xad47ae={};var _0x2067ee=['id',_0xe396('0x58'),_0xe396('0x59'),_0xe396('0x5a')];const _0x540501=0xfa;if(_0x4344d2){for(var _0x3434f7 in _0x4344d2){if(typeof _0x4344d2[_0x3434f7]!==_0xe396('0x5b')){if(!_['isNil'](_0x4344d2[_0x3434f7])&&!_0x2067ee[_0xe396('0x3a')](_0x3434f7)){if(_0x3434f7===_0xe396('0x5c')&&_0x4344d2[_0x3434f7][_0xe396('0x54')]>_0x540501){_0xad47ae[_0xe396('0x5d')+_0x3434f7[_0xe396('0x5e')]()]=_0x4344d2[_0x3434f7]['toString']()[_0xe396('0x5f')](0x0,_0x540501);}else{_0xad47ae['XMD-'+_0x3434f7[_0xe396('0x5e')]()]=_0x4344d2[_0x3434f7];}}}}}return _0xad47ae;}exports[_0xe396('0x60')]=setXMDContactVariables; \ No newline at end of file +var _0x917e=['XMD-','setXMDContactVariables','lodash','moment','util','dialer','timezones','RESCHEDULED_CONTACTS','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available','loggedIn','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','UNKNOWN_TIMEZONE','SIP/','unmonitored','includes','TrunkBackup','INACTIVE','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','DISACTIVED','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value','decrementOriginate','length','checkContactEmpty','[checkContactLowerLimitOriginate]\x20','tags','updatedAt','undefined','description','toUpperCase'];(function(_0x308a40,_0x336738){var _0x287fc2=function(_0xffb938){while(--_0xffb938){_0x308a40['push'](_0x308a40['shift']());}};_0x287fc2(++_0x336738);}(_0x917e,0xf2));var _0xe917=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x917e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe917('0x0'));var moment=require(_0xe917('0x1'));var util=require(_0xe917('0x2'));var logger=require('../../../../config/logger')(_0xe917('0x3'));var timezones=require('../../../../config/environment/shared')[_0xe917('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0xe917('0x5'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':_0xe917('0x6'),'EMPTY_INTERVAL':_0xe917('0x7'),'INACTIVE':_0xe917('0x8'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0xe917('0x9'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xe917('0xa'),'RECALL_TIMEOUT':_0xe917('0xb'),'RUNNING':_0xe917('0xc'),'UNKNOWN_TIMEZONE':_0xe917('0xd'),'UNREACHABLE_TRUNK':_0xe917('0xe')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x181c63){return _0x181c63[_0xe917('0xf')]===_0xe917('0x10');}exports[_0xe917('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x1236c8){return _0x1236c8[_0xe917('0x12')]===_0xe917('0x13');}exports[_0xe917('0x14')]=isIVRCampaign;function isOutboundQueue(_0x262712){return _0x262712['type']==='outbound';}exports[_0xe917('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x20741b){return _0x20741b[_0xe917('0x16')];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0x533b53){return _0x533b53[_0xe917('0x17')];}exports[_0xe917('0x18')]=isIVRCampaignActive;function getSeconds(_0x5ebf93,_0xd38ef3){var _0xc60121=moment(_0x5ebf93)[_0xe917('0x19')](0x0);var _0x357f5c=moment(_0xd38ef3)[_0xe917('0x19')](0x0);return _0xc60121[_0xe917('0x1a')](_0x357f5c,_0xe917('0x1b'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x5acb17,_0x226dde){var _0x17ed99=![];var _0x1451d8=_0x5acb17[_0xe917('0xf')]!==_0x226dde[_0xe917('0xf')]||_0x5acb17[_0xe917('0x16')]!==_0x226dde['dialActive']||_0x5acb17[_0xe917('0x1c')]!==_0x226dde[_0xe917('0x1c')];var _0x329ba3=_0x5acb17[_0xe917('0x1d')]!==_0x226dde[_0xe917('0x1d')]||_0x5acb17[_0xe917('0x1e')]!==_0x226dde[_0xe917('0x1e')]||_0x5acb17['loggedInDb']!==_0x226dde['loggedInDb']||_0x5acb17[_0xe917('0x1f')]!==_0x226dde['paused']||_0x5acb17[_0xe917('0x20')]!==_0x226dde[_0xe917('0x20')]||_0x5acb17[_0xe917('0x21')]!==_0x226dde['pTalking']||_0x5acb17[_0xe917('0x22')]!==_0x226dde['waiting']||_0x5acb17['inUse']!==_0x226dde[_0xe917('0x23')]||_0x5acb17[_0xe917('0x24')]!==_0x226dde[_0xe917('0x24')];if(_0x5acb17['Trunk']&&_0x226dde['Trunk']){_0x17ed99=_0x5acb17[_0xe917('0x25')]['name']!==_0x226dde[_0xe917('0x25')][_0xe917('0x26')]||_0x5acb17[_0xe917('0x25')][_0xe917('0x17')]!==_0x226dde['Trunk'][_0xe917('0x17')];}return _0x1451d8||_0x329ba3||_0x17ed99;}exports['hasQueueCampaignDataChanged']=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2a2e2f){var _0x61c323=null;var _0x4f87a2=_0x2a2e2f[_0xe917('0x27')];if(_[_0xe917('0x28')](_0x2a2e2f[_0xe917('0x29')])||_[_0xe917('0x28')](_0x2a2e2f[_0xe917('0x2a')])||_[_0xe917('0x28')](_0x2a2e2f[_0xe917('0x2a')][_0xe917('0x2b')])){_0x61c323=CAMPAIGN_STATUS[_0xe917('0x2c')];}else if(_[_0xe917('0x2d')](_0x2a2e2f[_0xe917('0x29')])||_[_0xe917('0x2d')](_0x2a2e2f['Interval']['Intervals'])){_0x61c323=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x4f87a2&&!timezones[_0x4f87a2]){_0x61c323=CAMPAIGN_STATUS[_0xe917('0x2e')];}return _0x61c323;}function checkAnyValidTrunk(_0x21a891,_0x54266a){var _0xaf5ce=null;var _0x5b2476=_0xe917('0x2f');var _0x578ece=['reachable',_0xe917('0x30')];var _0x6be81e=!![];if(_0x21a891[_0xe917('0x25')]&&_0x21a891[_0xe917('0x25')][_0xe917('0x17')]){_0x5b2476+=_0x21a891[_0xe917('0x25')][_0xe917('0x26')];_0xaf5ce=_0x54266a[_0x5b2476];_0x6be81e=_0x578ece[_0xe917('0x31')](_0xaf5ce['status']);}else if(_0x21a891[_0xe917('0x32')]&&_0x21a891[_0xe917('0x32')][_0xe917('0x17')]){_0x5b2476+=_0x21a891[_0xe917('0x32')]['name'];_0xaf5ce=_0x54266a[_0x5b2476];_0x6be81e=_0x578ece['includes'](_0xaf5ce['status']);}return _0x6be81e;}function getQueueCampaignStatusMessage(_0x35219e,_0x1f1aab){var _0x5df3e2=CAMPAIGN_STATUS['ACTIVE'];var _0x462035=isPreviewCampaign(_0x35219e);if(!isQueueCampaignActive(_0x35219e)){if(_0x462035){_0x5df3e2=CAMPAIGN_STATUS[_0xe917('0x33')];}else{if(_0x35219e[_0xe917('0x24')]===0x0&&_0x35219e[_0xe917('0x20')]===0x0&&_0x35219e[_0xe917('0x22')]===0x0&&(_0x35219e[_0xe917('0x21')]||0x0)===0x0){_0x5df3e2=CAMPAIGN_STATUS['INACTIVE'];}else{_0x5df3e2=CAMPAIGN_STATUS['DISACTIVED'];}}}else if(_0x35219e[_0xe917('0x1e')]===0x0){_0x5df3e2=CAMPAIGN_STATUS[_0xe917('0x34')];}else if(!checkAnyValidTrunk(_0x35219e,_0x1f1aab)){_0x5df3e2=CAMPAIGN_STATUS[_0xe917('0x35')];}else if(!isPreviewCampaign(_0x35219e)){var _0x3709af=checkAnyValidQueueCampaignInterval(_0x35219e);if(_0x3709af){_0x5df3e2=_0x3709af;}}return _0x5df3e2;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x5c046c){var _0x2edd23=CAMPAIGN_STATUS[_0xe917('0x36')];if(_0x5c046c[_0xe917('0x24')]===0x0&&_0x5c046c[_0xe917('0x20')]===0x0&&_0x5c046c['waiting']===0x0&&(_0x5c046c[_0xe917('0x21')]||0x0)===0x0){_0x2edd23=CAMPAIGN_STATUS['INACTIVE'];}return _0x2edd23;}exports[_0xe917('0x37')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x33537a){var _0x5a44ad=_0x33537a['match'](/"(.*?)"/);return _0x5a44ad?_0x5a44ad[0x1]:_0x33537a;}exports[_0xe917('0x38')]=extractCalleridName;function getCallerId(_0x68e6a2,_0x45a403,_0x7c4acd){if(!_[_0xe917('0x39')](_0x7c4acd)&&typeof _0x7c4acd===_0xe917('0x3a')&&!_[_0xe917('0x2d')](_0x7c4acd)){if(!_[_0xe917('0x39')](_0x45a403)&&typeof _0x45a403===_0xe917('0x3a')&&!_[_0xe917('0x2d')](_0x45a403)){return util[_0xe917('0x3b')](_0xe917('0x3c'),_0x45a403,_0x7c4acd);}return util[_0xe917('0x3b')](_0xe917('0x3c'),_0x7c4acd,_0x7c4acd);}if(!_['isUndefined'](_0x68e6a2)&&typeof _0x68e6a2==='string'&&!_[_0xe917('0x2d')](_0x68e6a2)){return _0x68e6a2;}return'\x22\x22\x20<>';}exports['getCallerId']=getCallerId;function getCallerIdRandom(_0x31a4fb,_0x278007){var _0x40d5cd;var _0x6ce51c;var _0x70591e;if(_0x278007<=0x0){_0x278007=0x1;}_0x40d5cd=new RegExp(_0xe917('0x3d')+_0x278007+'}$');_0x6ce51c=Math[_0xe917('0x3e')](0xa,_0x278007-0x1);_0x70591e=Math[_0xe917('0x3e')](0xa,_0x278007)-0x1;return util[_0xe917('0x3b')]('%s',_[_0xe917('0x3f')](_0x31a4fb,_0x40d5cd,_[_0xe917('0x40')](_0x6ce51c,_0x70591e)[_0xe917('0x41')]()));}exports[_0xe917('0x42')]=getCallerIdRandom;function decrementOriginate(_0xecf277,_0x227e35){if(_0xecf277[_0xe917('0x24')]&&_0xecf277['originated']>0x0){_0xecf277[_0xe917('0x24')]-=0x1;}else{logger[_0xe917('0x43')](_0xe917('0x44'),_0x227e35);}}exports[_0xe917('0x45')]=decrementOriginate;function checkContactEmpty(_0x1437c9){return _0x1437c9&&_0x1437c9[_0xe917('0x46')]>0x0;}exports[_0xe917('0x47')]=checkContactEmpty;function erlangb(_0x1bcd85,_0x49de2a){if(_0x49de2a===0x0){return 0x0;}var _0x5a1e4b=0x1;for(var _0x39b814=0x1;_0x39b814<=_0x49de2a;_0x39b814+=0x1){_0x5a1e4b=0x1+_0x5a1e4b*_0x39b814/_0x1bcd85;}return 0x1/_0x5a1e4b;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x2d49a4,_0x14f587,_0x437f6c){if(_0x14f587>_0x437f6c){for(var _0x1765f9=0x0;_0x1765f9<_0x14f587-_0x437f6c;_0x1765f9+=0x1){decrementOriginate(_0x2d49a4,_0xe917('0x48'));}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x14e8ca){var _0x1b6fb1={};var _0x4bca9f=['id','createdAt',_0xe917('0x49'),_0xe917('0x4a')];const _0x3c367c=0xfa;if(_0x14e8ca){for(var _0x191d16 in _0x14e8ca){if(typeof _0x14e8ca[_0x191d16]!==_0xe917('0x4b')){if(!_[_0xe917('0x28')](_0x14e8ca[_0x191d16])&&!_0x4bca9f[_0xe917('0x31')](_0x191d16)){if(_0x191d16===_0xe917('0x4c')&&_0x14e8ca[_0x191d16][_0xe917('0x46')]>_0x3c367c){_0x1b6fb1['XMD-'+_0x191d16[_0xe917('0x4d')]()]=_0x14e8ca[_0x191d16][_0xe917('0x41')]()['substring'](0x0,_0x3c367c);}else{_0x1b6fb1[_0xe917('0x4e')+_0x191d16[_0xe917('0x4d')]()]=_0x14e8ca[_0x191d16];}}}}}return _0x1b6fb1;}exports[_0xe917('0x4f')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 2149d55..4972911 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(_0x88861,_0x36baae){var _0x195361=function(_0x290b4e){while(--_0x290b4e){_0x88861['push'](_0x88861['shift']());}};_0x195361(++_0x36baae);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa9e0[_0x5b644e];return _0x49c6bf;};'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(_0x44e4b7,_0x55ebac){var _0x56cdea=function(_0x519dc4){while(--_0x519dc4){_0x44e4b7['push'](_0x44e4b7['shift']());}};_0x56cdea(++_0x55ebac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 84496d5..f58e713 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 _0xa124=['value','channelstate','channelstatedesc','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','notify','error','stringify','catch','\x20receiveFax\x20','syncOriginateResponse','merge','pick','response','update','AttachmentId','then','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','[Fax][execOriginate][success]','message','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','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','path','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','tiff2pdf','./util/gs','fax','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','syncNewchannel','context','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','prototype','variable'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xa124,0x19e));var _0x4a12=function(_0x196e1b,_0x55fa06){_0x196e1b=_0x196e1b-0x0;var _0x5e1f18=_0xa124[_0x196e1b];return _0x5e1f18;};'use strict';var util=require('util');var _=require(_0x4a12('0x0'));var BPromise=require(_0x4a12('0x1'));var uuid=require(_0x4a12('0x2'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0x4a12('0x3'));var gs=require(_0x4a12('0x4'));var logger=require('../../../config/logger')(_0x4a12('0x5'));var ami=require('../ami');var rpcDb=require('./rpcDb');var Channel=require(_0x4a12('0x6'));var ut=require('./util/util');var Action=require(_0x4a12('0x7'));var faxAccount=require(_0x4a12('0x8'));var attachment=require(_0x4a12('0x9'));var faxMessage=require('../rpc/faxMessage');function Fax(_0x2a68d5){this[_0x4a12('0xa')]={};this[_0x4a12('0xb')]=_0x2a68d5['faxAccounts'];this[_0x4a12('0xc')]=_0x2a68d5[_0x4a12('0xc')];this[_0x4a12('0xd')]={};ami['on'](_0x4a12('0xe'),this['syncNewchannel'][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x10'),this[_0x4a12('0x11')][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x12'),this[_0x4a12('0x13')][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x14'),this[_0x4a12('0x15')][_0x4a12('0xf')](this));ami['on'](_0x4a12('0x16'),this[_0x4a12('0x17')][_0x4a12('0xf')](this));ami['on']('receivefax',this[_0x4a12('0x18')][_0x4a12('0xf')](this));ami['on']('hangup',this[_0x4a12('0x19')][_0x4a12('0xf')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x4a12('0xf')](this));}Fax['prototype'][_0x4a12('0x1a')]=function(_0x220177){if(_0x220177[_0x4a12('0x1b')]==='from-voip-provider'){for(var _0x10a99a in this[_0x4a12('0xb')]){if(this[_0x4a12('0xb')][_0x4a12('0x1c')](_0x10a99a)){if(_0x220177[_0x4a12('0x1d')]===this[_0x4a12('0xb')][_0x10a99a][_0x4a12('0x1e')]){this['channels'][_0x220177[_0x4a12('0x1f')]]={};this['channels'][_0x220177[_0x4a12('0x1f')]][_0x4a12('0x20')]=_0x220177[_0x4a12('0x20')];this[_0x4a12('0xa')][_0x220177[_0x4a12('0x1f')]]['id']=this[_0x4a12('0xb')][_0x10a99a]['id'];this[_0x4a12('0xa')][_0x220177[_0x4a12('0x1f')]]['name']=this[_0x4a12('0xb')][_0x10a99a][_0x4a12('0x21')];logger[_0x4a12('0x22')](_0x220177[_0x4a12('0x1f')],_0x4a12('0x23'));}}}}if(this[_0x4a12('0xd')][_0x220177[_0x4a12('0x1f')]]){this['channels'][_0x220177[_0x4a12('0x1f')]]={};this[_0x4a12('0xa')][_0x220177[_0x4a12('0x1f')]][_0x4a12('0x20')]=_0x220177[_0x4a12('0x20')];logger['info'](_0x220177['uniqueid'],_0x4a12('0x23'));}};Fax[_0x4a12('0x24')][_0x4a12('0x11')]=function(_0x1e3def){if(this['channels'][_0x1e3def['uniqueid']]){for(var _0x57b431 in _0x1e3def[_0x4a12('0x25')]){if(_0x1e3def['variable'][_0x4a12('0x1c')](_0x57b431)){this[_0x4a12('0xa')][_0x1e3def['uniqueid']][_0x57b431]=_0x1e3def[_0x4a12('0x26')];}}}};Fax['prototype']['syncNewState']=function(_0x5aa195){if(this[_0x4a12('0xa')][_0x5aa195[_0x4a12('0x1f')]]){this[_0x4a12('0xa')][_0x5aa195[_0x4a12('0x1f')]][_0x4a12('0x27')]=_0x5aa195['channelstate'];this[_0x4a12('0xa')][_0x5aa195['uniqueid']][_0x4a12('0x28')]=_0x5aa195[_0x4a12('0x28')];}};Fax[_0x4a12('0x24')]['syncNewExten']=function(_0x40de87){if(this[_0x4a12('0xa')][_0x40de87[_0x4a12('0x1f')]]){for(var _0x2d8307 in _0x40de87[_0x4a12('0x25')]){if(_0x40de87[_0x4a12('0x25')][_0x4a12('0x1c')](_0x2d8307)){this['channels'][_0x40de87[_0x4a12('0x1f')]][_0x2d8307]=_0x40de87[_0x4a12('0x26')];}}}};Fax[_0x4a12('0x24')]['syncFaxStatus']=function(_0x354c35){if(this[_0x4a12('0xa')][_0x354c35['uniqueid']]){this[_0x4a12('0xa')][_0x354c35[_0x4a12('0x1f')]][_0x4a12('0x29')]=_0x354c35[_0x4a12('0x29')];this[_0x4a12('0xa')][_0x354c35[_0x4a12('0x1f')]][_0x4a12('0x2a')]=_0x354c35['status'];this[_0x4a12('0xa')][_0x354c35['uniqueid']]['localstationid']=_0x354c35['localstationid'];this[_0x4a12('0xa')][_0x354c35[_0x4a12('0x1f')]][_0x4a12('0x2b')]=_0x354c35['filename'];logger[_0x4a12('0x22')](_0x354c35['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x4a12('0x24')][_0x4a12('0x18')]=function(_0x3d4d2b){var _0x242de4=this;if(this['channels'][_0x3d4d2b[_0x4a12('0x1f')]]){var _0x4ed351=this['channels'][_0x3d4d2b[_0x4a12('0x1f')]]['id'];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]]['remotestationid']=_0x3d4d2b[_0x4a12('0x2c')];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]]['pagestransferred']=_0x3d4d2b[_0x4a12('0x2d')];this['channels'][_0x3d4d2b[_0x4a12('0x1f')]]['localstationid']=_0x3d4d2b['localstationid'];this['channels'][_0x3d4d2b[_0x4a12('0x1f')]][_0x4a12('0x2e')]=_0x3d4d2b[_0x4a12('0x2e')];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]][_0x4a12('0x2f')]=_0x3d4d2b[_0x4a12('0x2f')];this[_0x4a12('0xa')][_0x3d4d2b[_0x4a12('0x1f')]][_0x4a12('0x2b')]=_0x3d4d2b['filename'];this[_0x4a12('0xa')][_0x3d4d2b['uniqueid']][_0x4a12('0x30')]=_0x3d4d2b[_0x4a12('0x30')];if(this[_0x4a12('0xa')][_0x3d4d2b['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x3d4d2b[_0x4a12('0x2b')],_0x4a12('0x31'),function(_0x40b33e){logger[_0x4a12('0x22')](_0x3d4d2b[_0x4a12('0x1f')],'\x20result\x20conversion\x20file\x20',_0x40b33e['message']);attachment[_0x4a12('0x32')]({'name':path['parse'](_0x3d4d2b['filename'])[_0x4a12('0x21')],'basename':path[_0x4a12('0x33')](_0x3d4d2b[_0x4a12('0x2b')])['name']+_0x4a12('0x34'),'type':_0x4a12('0x35')})['then'](function(_0x5854f4){faxAccount[_0x4a12('0x36')](_0x4ed351,{'from':_0x3d4d2b[_0x4a12('0x30')],'mapKey':_0x4a12('0x5'),'body':path['parse'](_0x3d4d2b[_0x4a12('0x2b')])['name']+_0x4a12('0x34'),'AttachmentId':_0x5854f4['id']})['catch'](function(_0x5eb316){logger[_0x4a12('0x37')](_0x3d4d2b[_0x4a12('0x1f')],'\x20notify\x20',JSON[_0x4a12('0x38')](_0x5eb316));});})[_0x4a12('0x39')](function(_0x4a0392){logger[_0x4a12('0x37')](_0x3d4d2b['uniqueid'],_0x4a12('0x3a'),JSON[_0x4a12('0x38')](_0x4a0392));});});}logger[_0x4a12('0x22')](_0x3d4d2b[_0x4a12('0x1f')],_0x4a12('0x3a'));}};Fax[_0x4a12('0x24')][_0x4a12('0x3b')]=function(_0x58dd75){if(this[_0x4a12('0xd')][_0x58dd75[_0x4a12('0x1f')]]){_[_0x4a12('0x3c')](this[_0x4a12('0xa')][_0x58dd75['uniqueid']],_[_0x4a12('0x3d')](_0x58dd75,[_0x4a12('0x3e'),'reason']));}};function updateStatus(_0x22b494){if(_0x22b494['AttachmentId']){faxMessage[_0x4a12('0x3f')](_0x22b494[_0x4a12('0x40')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x4a12('0x41')](function(_0x8c8b5a){ut[_0x4a12('0x42')](_0x4a12('0x43'),_0x8c8b5a);})[_0x4a12('0x39')](function(_0x4502c5){ut['logger']('[Fax][Message][Error][NoUpdate1]',_0x4502c5);});}else{ut['logger'](_0x4a12('0x44'));}}Fax[_0x4a12('0x24')][_0x4a12('0x45')]=function(_0x1b2ec5,_0x461707,_0x285205){var _0x3f20ea=this;var _0x38bc8e={};if(_0x461707){_0x38bc8e={'read':_0x461707};}else{_0x38bc8e={'failMessage':_0x285205};}if(this[_0x4a12('0xd')][_0x1b2ec5][_0x4a12('0x40')]){faxMessage[_0x4a12('0x3f')](this['actions'][_0x1b2ec5][_0x4a12('0x40')],_0x38bc8e)['then'](function(_0x483413){ut['logger']('[Fax][Message][Updated]',_0x483413);})[_0x4a12('0x39')](function(_0x5a47f5){ut[_0x4a12('0x42')]('[Fax][Message][NoUpdate1]',_0x5a47f5);})['finally'](function(){delete _0x3f20ea[_0x4a12('0xa')][_0x1b2ec5];delete _0x3f20ea[_0x4a12('0xd')][_0x1b2ec5];});}else{ut[_0x4a12('0x42')](_0x4a12('0x46'));this[_0x4a12('0x47')](_0x1b2ec5);delete this['actions'][_0x1b2ec5];}};Fax[_0x4a12('0x24')][_0x4a12('0x19')]=function(_0x1c01f6){var _0x44d99a=this;if(this['channels'][_0x1c01f6[_0x4a12('0x1f')]]){if(this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]]){this[_0x4a12('0xa')][_0x1c01f6['uniqueid']]['id']=this[_0x4a12('0xd')][_0x1c01f6['uniqueid']]['id'];this[_0x4a12('0xa')][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x21')]=this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x21')];}logger[_0x4a12('0x22')](_0x1c01f6['uniqueid'],this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]]?_0x4a12('0x48'):_0x4a12('0x49'),JSON[_0x4a12('0x38')](this['channels'][_0x1c01f6[_0x4a12('0x1f')]]));if(this[_0x4a12('0xd')][_0x1c01f6[_0x4a12('0x1f')]]){if(this['channels'][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x4a')]>0x0&&this['channels'][_0x1c01f6[_0x4a12('0x1f')]]['faxstatus']==='SUCCESS'){this[_0x4a12('0x45')](_0x1c01f6[_0x4a12('0x1f')],!![]);}else{this['updateStatus'](_0x1c01f6[_0x4a12('0x1f')],![],this['channels'][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x4b')]?'SENDING\x20FAILED:\x20'+this[_0x4a12('0xa')][_0x1c01f6[_0x4a12('0x1f')]][_0x4a12('0x4b')]:_0x4a12('0x4c'));}}}};Fax[_0x4a12('0x24')][_0x4a12('0x4d')]=function(_0x1a36ff){var _0x405d67=this;return new BPromise(function(_0x2420a7,_0xff786b){_0x405d67['execOriginate'](_0x1a36ff,_0x405d67[_0x4a12('0xb')][_0x1a36ff[_0x4a12('0x4e')]])[_0x4a12('0x41')](function(_0x5e3e49){ut[_0x4a12('0x42')](_0x4a12('0x4f'),_0x5e3e49);_0x2420a7(ut[_0x4a12('0x50')](_0x4a12('0x51')));})[_0x4a12('0x39')](function(_0x1895e9){ut[_0x4a12('0x42')](_0x4a12('0x52'),_0x1895e9);updateStatus(_0x1a36ff);_0xff786b(ut[_0x4a12('0x50')](_0x4a12('0x53')));});});};Fax['prototype'][_0x4a12('0x54')]=function(_0x39d141){var _0x1ee958=this;return new BPromise(function(_0x34e1b6,_0x1e7795){var _0x5e8d04=_0x1ee958[_0x4a12('0x55')](_0x1ee958[_0x4a12('0xb')][_0x39d141[_0x4a12('0x4e')]][_0x4a12('0x56')],_0x39d141);if(_0x5e8d04[_0x4a12('0x57')]){_0x34e1b6(ut[_0x4a12('0x50')](_0x4a12('0x58')));}else{_0x1e7795(ut['message'](_0x5e8d04[_0x4a12('0x50')]));}});};function originate(_0x5b3802,_0x13f81f,_0x467f2b){return new BPromise(function(_0x3e8c7a,_0xb41fc3){if(_0x467f2b){var _0x4af16c=util[_0x4a12('0x59')](_0x4a12('0x5a'),path[_0x4a12('0x33')](_0x5b3802['path'])['name'],_0x5b3802['path']);gs['execute'](_0x4af16c)[_0x4a12('0x41')](function(){_0x5b3802[_0x4a12('0x5b')]=util[_0x4a12('0x59')](_0x4a12('0x5c'),path['parse'](_0x5b3802[_0x4a12('0x5b')])['dir'],path[_0x4a12('0x33')](_0x5b3802[_0x4a12('0x5b')])['name']);_0x13f81f[_0x4a12('0x5d')]=_0x5b3802[_0x4a12('0x5b')];ut[_0x4a12('0x42')](_0x4a12('0x5e'),'');ami[_0x4a12('0x5f')](ut[_0x4a12('0x60')](_0x5b3802,_0x13f81f))[_0x4a12('0x41')](function(_0x48a625){_0x3e8c7a(_0x48a625);})[_0x4a12('0x39')](function(_0x13a07b){_0xb41fc3(_0x13a07b);});})['catch'](function(_0xb6694){_0xb41fc3(_0xb6694);});}else{ami[_0x4a12('0x5f')](ut[_0x4a12('0x60')](_0x5b3802,_0x13f81f))[_0x4a12('0x41')](function(_0x3df964){_0x3e8c7a(_0x3df964);})[_0x4a12('0x39')](function(_0x5c1aab){_0xb41fc3(_0x5c1aab);});}});}Fax['prototype'][_0x4a12('0x61')]=function(_0x402eab,_0x235a49){var _0x3484e3=this;return new BPromise(function(_0x1104f0,_0x353e2){var _0x341cb4=uuid['v4']();var _0x98d48e=ut[_0x4a12('0x62')](_0x402eab,_0x235a49);_0x3484e3[_0x4a12('0xd')][_0x341cb4]=new Action(_0x341cb4,_0x235a49,_0x402eab);var _0x1bd3b8=_0x3484e3[_0x4a12('0xd')][_0x341cb4];if(path[_0x4a12('0x33')](_0x402eab['path'])[_0x4a12('0x63')]===_0x4a12('0x34')){originate(_0x1bd3b8,_0x98d48e,!![])[_0x4a12('0x41')](function(_0xb4e8cb){_0x1104f0(_0xb4e8cb);})['catch'](function(_0x333182){_0x353e2(_0x333182);});}else{originate(_0x1bd3b8,_0x98d48e,![])[_0x4a12('0x41')](function(_0x24aa3b){_0x1104f0(_0x24aa3b);})[_0x4a12('0x39')](function(_0x51d22d){_0x353e2(_0x51d22d);});}});};Fax['prototype'][_0x4a12('0x64')]=function(_0x5d11db){return!_[_0x4a12('0x65')](_0x5d11db)&&!_[_0x4a12('0x65')](_0x5d11db[_0x4a12('0x21')])&&!_[_0x4a12('0x65')](_0x5d11db[_0x4a12('0x66')])&&_0x5d11db[_0x4a12('0x66')]&&!_[_0x4a12('0x65')](this[_0x4a12('0xc')][util['format']('SIP/%s',_0x5d11db[_0x4a12('0x21')])])&&!_[_0x4a12('0x65')](this[_0x4a12('0xc')][util[_0x4a12('0x59')](_0x4a12('0x67'),_0x5d11db[_0x4a12('0x21')])][_0x4a12('0x2a')])&&(this[_0x4a12('0xc')][util[_0x4a12('0x59')](_0x4a12('0x67'),_0x5d11db[_0x4a12('0x21')])][_0x4a12('0x2a')]===_0x4a12('0x68')||this['trunks'][util[_0x4a12('0x59')]('SIP/%s',_0x5d11db[_0x4a12('0x21')])][_0x4a12('0x2a')]===_0x4a12('0x69'));};Fax[_0x4a12('0x24')][_0x4a12('0x55')]=function(_0x416904,_0x1952a0){if(!this[_0x4a12('0x64')](_0x416904)){ut[_0x4a12('0x42')](_0x4a12('0x6a'),_[_0x4a12('0x65')](_0x416904)?'':_0x416904['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x4a12('0x6b')};}if(_[_0x4a12('0x65')](_0x1952a0[_0x4a12('0x5')])){ut['logger'](_0x4a12('0x6c'),JSON['stringify'](_0x1952a0));return{'isValid':![],'message':_0x4a12('0x6d')};}if(_[_0x4a12('0x65')](_0x1952a0['path'])){ut['logger']('[Fax][checkTrunk][Empty\x20path]',JSON[_0x4a12('0x38')](_0x1952a0));return{'isValid':![],'message':_0x4a12('0x6e')};}return{'isValid':!![],'message':_0x4a12('0x6f')};};Fax[_0x4a12('0x24')][_0x4a12('0x47')]=function(_0x33d2b4,_0x23b915=0x2710){if(this[_0x4a12('0xa')][_0x33d2b4]){setTimeout(()=>{delete this['channels'][_0x33d2b4];},_0x23b915);}};module[_0x4a12('0x70')]=Fax; \ No newline at end of file +var _0xbfdb=['fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewState','syncNewExten','faxstatus','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','operation','status','localstationid','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','application/pdf','then','notify','calleridnum','.pdf','\x20notify\x20','error','stringify','\x20receiveFax\x20','merge','pick','response','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][Updated]','catch','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED:\x20','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','message','[Fax][execOriginate][failure]','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isTrunkReachable','isNil','active','SIP/%s','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xbfdb,0x1d4));var _0xbbfd=function(_0x68f6a2,_0x292f96){_0x68f6a2=_0x68f6a2-0x0;var _0x52d81e=_0xbfdb[_0x68f6a2];return _0x52d81e;};'use strict';var util=require(_0xbbfd('0x0'));var _=require(_0xbbfd('0x1'));var BPromise=require(_0xbbfd('0x2'));var uuid=require('uuid');var moment=require(_0xbbfd('0x3'));var path=require(_0xbbfd('0x4'));var tiff2pdf=require(_0xbbfd('0x5'));var gs=require(_0xbbfd('0x6'));var logger=require(_0xbbfd('0x7'))(_0xbbfd('0x8'));var ami=require(_0xbbfd('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0xbbfd('0xa'));var ut=require(_0xbbfd('0xb'));var Action=require(_0xbbfd('0xc'));var faxAccount=require(_0xbbfd('0xd'));var attachment=require(_0xbbfd('0xe'));var faxMessage=require(_0xbbfd('0xf'));function Fax(_0x69bc47){this[_0xbbfd('0x10')]={};this[_0xbbfd('0x11')]=_0x69bc47['faxAccounts'];this[_0xbbfd('0x12')]=_0x69bc47[_0xbbfd('0x12')];this[_0xbbfd('0x13')]={};ami['on']('newchannel',this[_0xbbfd('0x14')][_0xbbfd('0x15')](this));ami['on'](_0xbbfd('0x16'),this[_0xbbfd('0x17')][_0xbbfd('0x15')](this));ami['on'](_0xbbfd('0x18'),this[_0xbbfd('0x19')][_0xbbfd('0x15')](this));ami['on']('newexten',this[_0xbbfd('0x1a')]['bind'](this));ami['on'](_0xbbfd('0x1b'),this['syncFaxStatus'][_0xbbfd('0x15')](this));ami['on']('receivefax',this['syncReceiveFax']['bind'](this));ami['on'](_0xbbfd('0x1c'),this['syncHangup'][_0xbbfd('0x15')](this));ami['on'](_0xbbfd('0x1d'),this[_0xbbfd('0x1e')][_0xbbfd('0x15')](this));}Fax[_0xbbfd('0x1f')][_0xbbfd('0x14')]=function(_0xd9e8da){if(_0xd9e8da[_0xbbfd('0x20')]===_0xbbfd('0x21')){for(var _0x2642e3 in this[_0xbbfd('0x11')]){if(this[_0xbbfd('0x11')][_0xbbfd('0x22')](_0x2642e3)){if(_0xd9e8da[_0xbbfd('0x23')]===this[_0xbbfd('0x11')][_0x2642e3]['localstationid']){this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]={};this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]][_0xbbfd('0x25')]=_0xd9e8da[_0xbbfd('0x25')];this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]['id']=this['faxAccounts'][_0x2642e3]['id'];this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]][_0xbbfd('0x26')]=this[_0xbbfd('0x11')][_0x2642e3][_0xbbfd('0x26')];logger[_0xbbfd('0x27')](_0xd9e8da['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0xd9e8da[_0xbbfd('0x24')]]){this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]={};this[_0xbbfd('0x10')][_0xd9e8da[_0xbbfd('0x24')]]['channel']=_0xd9e8da['channel'];logger['info'](_0xd9e8da[_0xbbfd('0x24')],_0xbbfd('0x28'));}};Fax['prototype'][_0xbbfd('0x17')]=function(_0x50125c){if(this[_0xbbfd('0x10')][_0x50125c['uniqueid']]){for(var _0x1d6378 in _0x50125c[_0xbbfd('0x29')]){if(_0x50125c['variable']['hasOwnProperty'](_0x1d6378)){this['channels'][_0x50125c[_0xbbfd('0x24')]][_0x1d6378]=_0x50125c[_0xbbfd('0x2a')];}}}};Fax[_0xbbfd('0x1f')]['syncNewState']=function(_0x1ee749){if(this['channels'][_0x1ee749[_0xbbfd('0x24')]]){this[_0xbbfd('0x10')][_0x1ee749[_0xbbfd('0x24')]][_0xbbfd('0x2b')]=_0x1ee749[_0xbbfd('0x2b')];this[_0xbbfd('0x10')][_0x1ee749[_0xbbfd('0x24')]][_0xbbfd('0x2c')]=_0x1ee749[_0xbbfd('0x2c')];}};Fax[_0xbbfd('0x1f')]['syncNewExten']=function(_0x30a0f7){if(this['channels'][_0x30a0f7[_0xbbfd('0x24')]]){for(var _0x5513b1 in _0x30a0f7['variable']){if(_0x30a0f7[_0xbbfd('0x29')][_0xbbfd('0x22')](_0x5513b1)){this[_0xbbfd('0x10')][_0x30a0f7[_0xbbfd('0x24')]][_0x5513b1]=_0x30a0f7[_0xbbfd('0x2a')];}}}};Fax[_0xbbfd('0x1f')]['syncFaxStatus']=function(_0xc22cea){if(this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]]){this['channels'][_0xc22cea[_0xbbfd('0x24')]][_0xbbfd('0x2d')]=_0xc22cea[_0xbbfd('0x2d')];this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]]['status']=_0xc22cea[_0xbbfd('0x2e')];this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]][_0xbbfd('0x2f')]=_0xc22cea[_0xbbfd('0x2f')];this[_0xbbfd('0x10')][_0xc22cea[_0xbbfd('0x24')]][_0xbbfd('0x30')]=_0xc22cea[_0xbbfd('0x30')];logger['info'](_0xc22cea[_0xbbfd('0x24')],_0xbbfd('0x31'));}};Fax[_0xbbfd('0x1f')][_0xbbfd('0x32')]=function(_0x66d33c){var _0x25dc90=this;if(this['channels'][_0x66d33c[_0xbbfd('0x24')]]){var _0x55bf5e=this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]]['id'];this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]][_0xbbfd('0x33')]=_0x66d33c[_0xbbfd('0x33')];this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x34')]=_0x66d33c[_0xbbfd('0x34')];this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]][_0xbbfd('0x2f')]=_0x66d33c['localstationid'];this[_0xbbfd('0x10')][_0x66d33c[_0xbbfd('0x24')]][_0xbbfd('0x35')]=_0x66d33c[_0xbbfd('0x35')];this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x36')]=_0x66d33c[_0xbbfd('0x36')];this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x30')]=_0x66d33c[_0xbbfd('0x30')];this['channels'][_0x66d33c['uniqueid']]['calleridnum']=_0x66d33c['calleridnum'];if(this[_0xbbfd('0x10')][_0x66d33c['uniqueid']][_0xbbfd('0x34')]>0x0){tiff2pdf(_0x66d33c[_0xbbfd('0x30')],_0xbbfd('0x37'),function(_0x477372){logger[_0xbbfd('0x27')](_0x66d33c[_0xbbfd('0x24')],_0xbbfd('0x38'),_0x477372['message']);attachment[_0xbbfd('0x39')]({'name':path['parse'](_0x66d33c[_0xbbfd('0x30')])[_0xbbfd('0x26')],'basename':path[_0xbbfd('0x3a')](_0x66d33c[_0xbbfd('0x30')])[_0xbbfd('0x26')]+'.pdf','type':_0xbbfd('0x3b')})[_0xbbfd('0x3c')](function(_0x1d01d7){faxAccount[_0xbbfd('0x3d')](_0x55bf5e,{'from':_0x66d33c[_0xbbfd('0x3e')],'mapKey':_0xbbfd('0x8'),'body':path['parse'](_0x66d33c[_0xbbfd('0x30')])['name']+_0xbbfd('0x3f'),'AttachmentId':_0x1d01d7['id']})['catch'](function(_0x5833c3){logger['error'](_0x66d33c[_0xbbfd('0x24')],_0xbbfd('0x40'),JSON['stringify'](_0x5833c3));});})['catch'](function(_0x1652dc){logger[_0xbbfd('0x41')](_0x66d33c['uniqueid'],'\x20receiveFax\x20',JSON[_0xbbfd('0x42')](_0x1652dc));});});}logger[_0xbbfd('0x27')](_0x66d33c[_0xbbfd('0x24')],_0xbbfd('0x43'));}};Fax['prototype'][_0xbbfd('0x1e')]=function(_0x1a4dda){if(this[_0xbbfd('0x13')][_0x1a4dda[_0xbbfd('0x24')]]){_[_0xbbfd('0x44')](this[_0xbbfd('0x10')][_0x1a4dda['uniqueid']],_[_0xbbfd('0x45')](_0x1a4dda,[_0xbbfd('0x46'),'reason']));}};function updateStatus(_0x5dd742){if(_0x5dd742['AttachmentId']){faxMessage['update'](_0x5dd742[_0xbbfd('0x47')],{'failMessage':_0xbbfd('0x48')})[_0xbbfd('0x3c')](function(_0x2c25eb){ut[_0xbbfd('0x49')](_0xbbfd('0x4a'),_0x2c25eb);})[_0xbbfd('0x4b')](function(_0x5f1b91){ut[_0xbbfd('0x49')]('[Fax][Message][Error][NoUpdate1]',_0x5f1b91);});}else{ut[_0xbbfd('0x49')](_0xbbfd('0x4c'));}}Fax[_0xbbfd('0x1f')]['updateStatus']=function(_0x31f4d7,_0xdf2212,_0x36593f){var _0x30c60a=this;var _0x247538={};if(_0xdf2212){_0x247538={'read':_0xdf2212};}else{_0x247538={'failMessage':_0x36593f};}if(this[_0xbbfd('0x13')][_0x31f4d7][_0xbbfd('0x47')]){faxMessage['update'](this[_0xbbfd('0x13')][_0x31f4d7]['AttachmentId'],_0x247538)[_0xbbfd('0x3c')](function(_0x1bfc8d){ut['logger'](_0xbbfd('0x4d'),_0x1bfc8d);})[_0xbbfd('0x4b')](function(_0x5e5fac){ut[_0xbbfd('0x49')]('[Fax][Message][NoUpdate1]',_0x5e5fac);})[_0xbbfd('0x4e')](function(){delete _0x30c60a[_0xbbfd('0x10')][_0x31f4d7];delete _0x30c60a[_0xbbfd('0x13')][_0x31f4d7];});}else{ut[_0xbbfd('0x49')](_0xbbfd('0x4f'));this[_0xbbfd('0x50')](_0x31f4d7);delete this[_0xbbfd('0x13')][_0x31f4d7];}};Fax['prototype'][_0xbbfd('0x51')]=function(_0xfb0450){var _0x4aa44f=this;if(this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]]){if(this[_0xbbfd('0x13')][_0xfb0450[_0xbbfd('0x24')]]){this['channels'][_0xfb0450[_0xbbfd('0x24')]]['id']=this[_0xbbfd('0x13')][_0xfb0450[_0xbbfd('0x24')]]['id'];this['channels'][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x26')]=this[_0xbbfd('0x13')][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x26')];}logger[_0xbbfd('0x27')](_0xfb0450[_0xbbfd('0x24')],this[_0xbbfd('0x13')][_0xfb0450['uniqueid']]?_0xbbfd('0x52'):_0xbbfd('0x53'),JSON[_0xbbfd('0x42')](this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]]));if(this[_0xbbfd('0x13')][_0xfb0450['uniqueid']]){if(this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]]['faxpages']>0x0&&this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x1b')]===_0xbbfd('0x54')){this[_0xbbfd('0x55')](_0xfb0450[_0xbbfd('0x24')],!![]);}else{this[_0xbbfd('0x55')](_0xfb0450['uniqueid'],![],this[_0xbbfd('0x10')][_0xfb0450[_0xbbfd('0x24')]][_0xbbfd('0x56')]?_0xbbfd('0x57')+this[_0xbbfd('0x10')][_0xfb0450['uniqueid']][_0xbbfd('0x56')]:'SENDING\x20FAILED');}}}};Fax[_0xbbfd('0x1f')][_0xbbfd('0x58')]=function(_0x4eb25b){var _0x135d51=this;return new BPromise(function(_0x21ea87,_0x102fcd){_0x135d51[_0xbbfd('0x59')](_0x4eb25b,_0x135d51[_0xbbfd('0x11')][_0x4eb25b[_0xbbfd('0x5a')]])[_0xbbfd('0x3c')](function(_0x14e6e3){ut['logger'](_0xbbfd('0x5b'),_0x14e6e3);_0x21ea87(ut[_0xbbfd('0x5c')]('Fax\x20received'));})['catch'](function(_0x409316){ut[_0xbbfd('0x49')](_0xbbfd('0x5d'),_0x409316);updateStatus(_0x4eb25b);_0x102fcd(ut[_0xbbfd('0x5c')](_0xbbfd('0x5e')));});});};Fax[_0xbbfd('0x1f')][_0xbbfd('0x5f')]=function(_0x19d824){var _0x5a4cb4=this;return new BPromise(function(_0x127441,_0x4ca031){var _0x469470=_0x5a4cb4[_0xbbfd('0x60')](_0x5a4cb4['faxAccounts'][_0x19d824[_0xbbfd('0x5a')]][_0xbbfd('0x61')],_0x19d824);if(_0x469470[_0xbbfd('0x62')]){_0x127441(ut[_0xbbfd('0x5c')]('Trunk\x20Reachable'));}else{_0x4ca031(ut[_0xbbfd('0x5c')](_0x469470[_0xbbfd('0x5c')]));}});};function originate(_0x1129a1,_0x4c3746,_0x4295e2){return new BPromise(function(_0x545415,_0x1a5488){if(_0x4295e2){var _0x18d68b=util[_0xbbfd('0x63')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x1129a1['path'])[_0xbbfd('0x26')],_0x1129a1[_0xbbfd('0x4')]);gs[_0xbbfd('0x64')](_0x18d68b)[_0xbbfd('0x3c')](function(){_0x1129a1[_0xbbfd('0x4')]=util['format'](_0xbbfd('0x65'),path[_0xbbfd('0x3a')](_0x1129a1[_0xbbfd('0x4')])['dir'],path['parse'](_0x1129a1[_0xbbfd('0x4')])[_0xbbfd('0x26')]);_0x4c3746[_0xbbfd('0x66')]=_0x1129a1[_0xbbfd('0x4')];ut[_0xbbfd('0x49')](_0xbbfd('0x67'),'');ami['Action'](ut['variablesAction'](_0x1129a1,_0x4c3746))['then'](function(_0x2be233){_0x545415(_0x2be233);})[_0xbbfd('0x4b')](function(_0x26a34d){_0x1a5488(_0x26a34d);});})[_0xbbfd('0x4b')](function(_0x5d4cbd){_0x1a5488(_0x5d4cbd);});}else{ami[_0xbbfd('0x68')](ut[_0xbbfd('0x69')](_0x1129a1,_0x4c3746))[_0xbbfd('0x3c')](function(_0x5133b8){_0x545415(_0x5133b8);})[_0xbbfd('0x4b')](function(_0x1697fb){_0x1a5488(_0x1697fb);});}});}Fax[_0xbbfd('0x1f')][_0xbbfd('0x59')]=function(_0x307a93,_0x4f2f7f){var _0x4bc645=this;return new BPromise(function(_0x33a5f7,_0xa445e){var _0x186f32=uuid['v4']();var _0x29d923=ut['addVariables'](_0x307a93,_0x4f2f7f);_0x4bc645[_0xbbfd('0x13')][_0x186f32]=new Action(_0x186f32,_0x4f2f7f,_0x307a93);var _0x1606c7=_0x4bc645['actions'][_0x186f32];if(path[_0xbbfd('0x3a')](_0x307a93['path'])[_0xbbfd('0x6a')]===_0xbbfd('0x3f')){originate(_0x1606c7,_0x29d923,!![])[_0xbbfd('0x3c')](function(_0x45c573){_0x33a5f7(_0x45c573);})[_0xbbfd('0x4b')](function(_0x292a13){_0xa445e(_0x292a13);});}else{originate(_0x1606c7,_0x29d923,![])['then'](function(_0x2adba2){_0x33a5f7(_0x2adba2);})[_0xbbfd('0x4b')](function(_0x2bb72e){_0xa445e(_0x2bb72e);});}});};Fax[_0xbbfd('0x1f')][_0xbbfd('0x6b')]=function(_0x3877ae){return!_[_0xbbfd('0x6c')](_0x3877ae)&&!_[_0xbbfd('0x6c')](_0x3877ae[_0xbbfd('0x26')])&&!_[_0xbbfd('0x6c')](_0x3877ae[_0xbbfd('0x6d')])&&_0x3877ae[_0xbbfd('0x6d')]&&!_['isNil'](this[_0xbbfd('0x12')][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae['name'])])&&!_[_0xbbfd('0x6c')](this[_0xbbfd('0x12')][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae[_0xbbfd('0x26')])][_0xbbfd('0x2e')])&&(this[_0xbbfd('0x12')][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae['name'])]['status']==='reachable'||this['trunks'][util[_0xbbfd('0x63')](_0xbbfd('0x6e'),_0x3877ae[_0xbbfd('0x26')])]['status']==='unmonitored');};Fax[_0xbbfd('0x1f')]['checkTrunk']=function(_0x4e8f11,_0x14f6b6){if(!this[_0xbbfd('0x6b')](_0x4e8f11)){ut[_0xbbfd('0x49')](_0xbbfd('0x6f'),_[_0xbbfd('0x6c')](_0x4e8f11)?'':_0x4e8f11[_0xbbfd('0x26')]+_0xbbfd('0x70'));return{'isValid':![],'message':_0xbbfd('0x71')};}if(_['isNil'](_0x14f6b6[_0xbbfd('0x8')])){ut[_0xbbfd('0x49')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xbbfd('0x42')](_0x14f6b6));return{'isValid':![],'message':_0xbbfd('0x72')};}if(_[_0xbbfd('0x6c')](_0x14f6b6[_0xbbfd('0x4')])){ut[_0xbbfd('0x49')](_0xbbfd('0x73'),JSON[_0xbbfd('0x42')](_0x14f6b6));return{'isValid':![],'message':_0xbbfd('0x74')};}return{'isValid':!![],'message':_0xbbfd('0x75')};};Fax[_0xbbfd('0x1f')][_0xbbfd('0x50')]=function(_0x4cebb5,_0x1e027b=0x2710){if(this[_0xbbfd('0x10')][_0x4cebb5]){setTimeout(()=>{delete this[_0xbbfd('0x10')][_0x4cebb5];},_0x1e027b);}};module[_0xbbfd('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 9e91544..e27ef60 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 _0x1ca4=['[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','error','notify','resolve','then','catch'];(function(_0x57cd68,_0x8378c9){var _0x39ddfb=function(_0x201864){while(--_0x201864){_0x57cd68['push'](_0x57cd68['shift']());}};_0x39ddfb(++_0x8378c9);}(_0x1ca4,0x114));var _0x41ca=function(_0x2bc67c,_0x141396){_0x2bc67c=_0x2bc67c-0x0;var _0x4de5ac=_0x1ca4[_0x2bc67c];return _0x4de5ac;};'use strict';var util=require(_0x41ca('0x0'));var BPromise=require(_0x41ca('0x1'));var logger=require(_0x41ca('0x2'))(_0x41ca('0x3'));var _=require(_0x41ca('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x36144e){return function(_0x14e36c){logger[_0x41ca('0x5')](_0x36144e,util['inspect'](_0x14e36c,{'showHidden':![],'depth':null}));};}exports[_0x41ca('0x6')]=function(_0x3bf317,_0x1cb659){return BPromise[_0x41ca('0x7')]()[_0x41ca('0x8')](faxAccount['notify'](_0x3bf317,_0x1cb659))[_0x41ca('0x9')](loggerCatch(_0x41ca('0xa')));}; \ No newline at end of file +var _0x030a=['then','catch','[Notify]\x20','util','bluebird','../../../config/logger','preview','lodash','inspect','notify','resolve'];(function(_0x4bdf64,_0x3022b2){var _0x9a1a19=function(_0x4e551b){while(--_0x4e551b){_0x4bdf64['push'](_0x4bdf64['shift']());}};_0x9a1a19(++_0x3022b2);}(_0x030a,0xc9));var _0xa030=function(_0x153810,_0x4b3117){_0x153810=_0x153810-0x0;var _0x3df31a=_0x030a[_0x153810];return _0x3df31a;};'use strict';var util=require(_0xa030('0x0'));var BPromise=require(_0xa030('0x1'));var logger=require(_0xa030('0x2'))(_0xa030('0x3'));var _=require(_0xa030('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x42be95){return function(_0x477183){logger['error'](_0x42be95,util[_0xa030('0x5')](_0x477183,{'showHidden':![],'depth':null}));};}exports[_0xa030('0x6')]=function(_0x3165f5,_0x288af2){return BPromise[_0xa030('0x7')]()[_0xa030('0x8')](faxAccount[_0xa030('0x6')](_0x3165f5,_0x288af2))[_0xa030('0x9')](loggerCatch(_0xa030('0xa')));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index e37f2d4..b630bf5 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 _0xe357=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','child_process','exec','info'];(function(_0x52812a,_0x38cc57){var _0x83cfa9=function(_0x596897){while(--_0x596897){_0x52812a['push'](_0x52812a['shift']());}};_0x83cfa9(++_0x38cc57);}(_0xe357,0xf6));var _0x7e35=function(_0x216bb8,_0x103b3b){_0x216bb8=_0x216bb8-0x0;var _0x5756ad=_0xe357[_0x216bb8];return _0x5756ad;};'use strict';var util=require(_0x7e35('0x0'));var logger=require('../../../../config/logger')(_0x7e35('0x1'));var BPromise=require(_0x7e35('0x2'));var exec=require(_0x7e35('0x3'))[_0x7e35('0x4')];exports['execute']=function(_0x3b291c){return new BPromise(function(_0x502328,_0x587133){exec(_0x3b291c,function(_0x1b345c,_0x5f32c4,_0x4be580){logger[_0x7e35('0x5')]('Exec\x20gs',_0x5f32c4);if(_0x1b345c){logger[_0x7e35('0x5')](_0x7e35('0x6'),_0x7e35('0x7'),util[_0x7e35('0x8')](_0x1b345c,{'showHidden':![],'depth':null}),_0x5f32c4,_0x4be580);_0x587133(_0x1b345c);}_0x502328(_0x5f32c4);});});}; \ No newline at end of file +var _0xe7df=['inspect','../../../../config/logger','fax','bluebird','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xe7df,0x17d));var _0xfe7d=function(_0x214f7c,_0x132269){_0x214f7c=_0x214f7c-0x0;var _0x141af3=_0xe7df[_0x214f7c];return _0x141af3;};'use strict';var util=require('util');var logger=require(_0xfe7d('0x0'))(_0xfe7d('0x1'));var BPromise=require(_0xfe7d('0x2'));var exec=require(_0xfe7d('0x3'))[_0xfe7d('0x4')];exports[_0xfe7d('0x5')]=function(_0x1f5e85){return new BPromise(function(_0x338680,_0x431793){exec(_0x1f5e85,function(_0x2c0382,_0x309c49,_0x430905){logger[_0xfe7d('0x6')](_0xfe7d('0x7'),_0x309c49);if(_0x2c0382){logger[_0xfe7d('0x6')](_0xfe7d('0x7'),_0xfe7d('0x8'),util[_0xfe7d('0x9')](_0x2c0382,{'showHidden':![],'depth':null}),_0x309c49,_0x430905);_0x431793(_0x2c0382);}_0x338680(_0x309c49);});});}; \ 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 3395a1a..61dd2b7 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 _0xcd4d=['info','addVariables','ecm','minrate','maxrate','format','\x22%s\x22','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','originate','xcally-motion-fax','from-sip','headerinfo','util','lodash','moment','../../../../config/logger','fax','message','logger'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xcd4d,0xda));var _0xdcd4=function(_0xa4b76a,_0x2b92c0){_0xa4b76a=_0xa4b76a-0x0;var _0x3bb6ef=_0xcd4d[_0xa4b76a];return _0x3bb6ef;};'use strict';var util=require(_0xdcd4('0x0'));var _=require(_0xdcd4('0x1'));var moment=require(_0xdcd4('0x2'));var logger=require(_0xdcd4('0x3'))(_0xdcd4('0x4'));exports[_0xdcd4('0x5')]=function(_0x27dde0){return{'message':_0x27dde0};};exports[_0xdcd4('0x6')]=function(_0x4a949c,_0x48c4e4){logger[_0xdcd4('0x7')](_0x4a949c,util['inspect'](_0x48c4e4,{'showHidden':![],'depth':null}));};exports[_0xdcd4('0x8')]=function(_0x2f9197,_0xa4e6ac){var _0x1b51a1={'XMF-ECM':_0xa4e6ac[_0xdcd4('0x9')],'XMF-HEADERINFO':_0xa4e6ac['headerinfo'],'XMF-MINRATE':_0xa4e6ac[_0xdcd4('0xa')],'XMF-MAXRATE':_0xa4e6ac[_0xdcd4('0xb')],'XMF-MODEM':util[_0xdcd4('0xc')](_0xdcd4('0xd'),_0xa4e6ac['modem']),'XMF-GATEWAY':_0xa4e6ac[_0xdcd4('0xe')],'XMF-FAXDETECT':_0xa4e6ac[_0xdcd4('0xf')],'XMF-T38TIMEOUT':_0xa4e6ac[_0xdcd4('0x10')],'XMF-LOCALSTATIONID':_0xa4e6ac[_0xdcd4('0x11')],'XMF-PATH':_0x2f9197[_0xdcd4('0x12')]};return _0x1b51a1;};exports[_0xdcd4('0x13')]=function(_0x220eb5,_0x37c3c0){return{'actionid':_0x220eb5[_0xdcd4('0x14')],'action':_0xdcd4('0x15'),'channel':_0x220eb5['channel'],'Exten':_0xdcd4('0x16'),'Context':_0xdcd4('0x17'),'Priority':'1','callerid':util[_0xdcd4('0xc')]('\x22%s\x22\x20<%s>',_0x220eb5['headerinfo']?_0x220eb5[_0xdcd4('0x18')]:'',_0x220eb5[_0xdcd4('0x11')]),'variable':_0x37c3c0,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x220eb5[_0xdcd4('0x14')]};}; \ No newline at end of file +var _0x0848=['headerinfo','minrate','maxrate','format','modem','gateway','faxdetect','localstationid','path','uniqueid','channel','from-sip','\x22%s\x22\x20<%s>','lodash','moment','../../../../config/logger','fax','message','logger','inspect','ecm'];(function(_0x17972a,_0x58da5d){var _0x2a446e=function(_0x5ca868){while(--_0x5ca868){_0x17972a['push'](_0x17972a['shift']());}};_0x2a446e(++_0x58da5d);}(_0x0848,0x15d));var _0x8084=function(_0x3bfa21,_0x3639c9){_0x3bfa21=_0x3bfa21-0x0;var _0x1f9315=_0x0848[_0x3bfa21];return _0x1f9315;};'use strict';var util=require('util');var _=require(_0x8084('0x0'));var moment=require(_0x8084('0x1'));var logger=require(_0x8084('0x2'))(_0x8084('0x3'));exports[_0x8084('0x4')]=function(_0x1751d1){return{'message':_0x1751d1};};exports[_0x8084('0x5')]=function(_0x5133e8,_0x353d88){logger['info'](_0x5133e8,util[_0x8084('0x6')](_0x353d88,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x13d677,_0x51b276){var _0x31a121={'XMF-ECM':_0x51b276[_0x8084('0x7')],'XMF-HEADERINFO':_0x51b276[_0x8084('0x8')],'XMF-MINRATE':_0x51b276[_0x8084('0x9')],'XMF-MAXRATE':_0x51b276[_0x8084('0xa')],'XMF-MODEM':util[_0x8084('0xb')]('\x22%s\x22',_0x51b276[_0x8084('0xc')]),'XMF-GATEWAY':_0x51b276[_0x8084('0xd')],'XMF-FAXDETECT':_0x51b276[_0x8084('0xe')],'XMF-T38TIMEOUT':_0x51b276['t38timeout'],'XMF-LOCALSTATIONID':_0x51b276[_0x8084('0xf')],'XMF-PATH':_0x13d677[_0x8084('0x10')]};return _0x31a121;};exports['variablesAction']=function(_0x5b5bc6,_0x57a536){return{'actionid':_0x5b5bc6[_0x8084('0x11')],'action':'originate','channel':_0x5b5bc6[_0x8084('0x12')],'Exten':'xcally-motion-fax','Context':_0x8084('0x13'),'Priority':'1','callerid':util['format'](_0x8084('0x14'),_0x5b5bc6[_0x8084('0x8')]?_0x5b5bc6[_0x8084('0x8')]:'',_0x5b5bc6[_0x8084('0xf')]),'variable':_0x57a536,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5b5bc6['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index f476cd5..c9a5844 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 _0xba47=['initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','listen','sync','[index.js][main]','inspect','util','moment','./realtime','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami','hour','get','resolve','then','getTrunks','initTrunks','getVoiceQueues','initTriggers','initTemplates','getZendeskAccounts'];(function(_0x43d440,_0x3e352e){var _0x19be0e=function(_0x1694ba){while(--_0x1694ba){_0x43d440['push'](_0x43d440['shift']());}};_0x19be0e(++_0x3e352e);}(_0xba47,0xb1));var _0x7ba4=function(_0x4f5948,_0x576931){_0x4f5948=_0x4f5948-0x0;var _0x5a5da8=_0xba47[_0x4f5948];return _0x5a5da8;};'use strict';var util=require(_0x7ba4('0x0'));var moment=require(_0x7ba4('0x1'));var server=require('./server');var Realtime=require(_0x7ba4('0x2'));var Report=require('./report');var Acw=require(_0x7ba4('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x7ba4('0x4'));var Fax=require(_0x7ba4('0x5'));var user=require(_0x7ba4('0x6'));var voiceQueue=require(_0x7ba4('0x7'));var voiceQueueReport=require(_0x7ba4('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x7ba4('0x9'));var trigger=require(_0x7ba4('0xa'));var template=require(_0x7ba4('0xb'));var cmHopperHistory=require(_0x7ba4('0xc'));var campaign=require(_0x7ba4('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7ba4('0xe'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x7ba4('0xf'));var freshdesk=require(_0x7ba4('0x10'));var desk=require('./rpc/integrations/desk');var zoho=require(_0x7ba4('0x11'));var vtiger=require(_0x7ba4('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require(_0x7ba4('0x13'));var dynamics365=require(_0x7ba4('0x14'));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(_0x7ba4('0x15'))(_0x7ba4('0x16'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x7ba4('0x17'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7ba4('0x18')](_0x7ba4('0x17'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7ba4('0x19')]()[_0x7ba4('0x1a')](user['getAgents']())[_0x7ba4('0x1a')](realtime['initAgents']())[_0x7ba4('0x1a')](user['getTelephones']())['then'](realtime['initTelephones']())['then'](trunk[_0x7ba4('0x1b')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x1c')]())[_0x7ba4('0x1a')](voiceQueue[_0x7ba4('0x1d')]())['then'](realtime['initVoiceQueues']())['then'](trigger['getTriggers']())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x1e')]())[_0x7ba4('0x1a')](template['getTemplates']())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x1f')]())[_0x7ba4('0x1a')](zendesk[_0x7ba4('0x20')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x21')]())[_0x7ba4('0x1a')](salesforce[_0x7ba4('0x22')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x23')]())[_0x7ba4('0x1a')](sugarcrm['getSugarcrmAccounts']())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x24')]())[_0x7ba4('0x1a')](freshdesk[_0x7ba4('0x25')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x26')]())['then'](desk[_0x7ba4('0x27')]())['then'](realtime[_0x7ba4('0x28')]())[_0x7ba4('0x1a')](zoho[_0x7ba4('0x29')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x2a')]())['then'](vtiger[_0x7ba4('0x2b')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x2c')]())[_0x7ba4('0x1a')](freshsales[_0x7ba4('0x2d')]())[_0x7ba4('0x1a')](realtime['initFreshsalesAccounts']())[_0x7ba4('0x1a')](servicenow[_0x7ba4('0x2e')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x2f')]())[_0x7ba4('0x1a')](dynamics365[_0x7ba4('0x30')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x31')]())[_0x7ba4('0x1a')](campaign[_0x7ba4('0x32')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x33')]())[_0x7ba4('0x1a')](voiceExtension[_0x7ba4('0x34')]())['then'](realtime[_0x7ba4('0x35')]())[_0x7ba4('0x1a')](faxAccount[_0x7ba4('0x36')]())['then'](realtime[_0x7ba4('0x37')]())[_0x7ba4('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x7ba4('0x19')]()[_0x7ba4('0x1a')](voiceQueueReport[_0x7ba4('0x38')]())[_0x7ba4('0x1a')](realtime['initVoiceQueueReports']())[_0x7ba4('0x1a')](cmHopperHistory[_0x7ba4('0x39')]())[_0x7ba4('0x1a')](realtime[_0x7ba4('0x3a')]())[_0x7ba4('0x1a')](cmHopperHistory[_0x7ba4('0x3b')]())['then'](realtime[_0x7ba4('0x3c')]())[_0x7ba4('0x1a')](voiceCallReport[_0x7ba4('0x3d')]())['then'](realtime[_0x7ba4('0x3e')]())[_0x7ba4('0x3f')](function(_0xb5d053){logger[_0x7ba4('0x40')](_0x7ba4('0x41'),util['inspect'](_0xb5d053,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7ba4('0x42')](realtime,preview,fax)[_0x7ba4('0x1a')](function(){return initRealtime();})[_0x7ba4('0x1a')](function(){return initParams();})[_0x7ba4('0x1a')](function(){report[_0x7ba4('0x43')]();setInterval(initRealtime,0x1388);})[_0x7ba4('0x3f')](function(_0x193677){logger[_0x7ba4('0x40')](_0x7ba4('0x44'),util[_0x7ba4('0x45')](_0x193677,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x6d6d=['get','hour','resolve','then','getAgents','initAgents','initTelephones','initTrunks','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','initFreshdeskAccounts','initDeskAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports','catch','error','[index.js][initParams]','sync','inspect','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/campaign','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','ami'];(function(_0x4226a,_0x47de7d){var _0x5ae293=function(_0x5810a8){while(--_0x5810a8){_0x4226a['push'](_0x4226a['shift']());}};_0x5ae293(++_0x47de7d);}(_0x6d6d,0x1c8));var _0xd6d6=function(_0x227c21,_0xc4d046){_0x227c21=_0x227c21-0x0;var _0x107b54=_0x6d6d[_0x227c21];return _0x107b54;};'use strict';var util=require(_0xd6d6('0x0'));var moment=require(_0xd6d6('0x1'));var server=require(_0xd6d6('0x2'));var Realtime=require(_0xd6d6('0x3'));var Report=require(_0xd6d6('0x4'));var Acw=require(_0xd6d6('0x5'));var Trigger=require(_0xd6d6('0x6'));var Dialer=require(_0xd6d6('0x7'));var Preview=require(_0xd6d6('0x8'));var Fax=require(_0xd6d6('0x9'));var user=require('./rpc/user');var voiceQueue=require(_0xd6d6('0xa'));var voiceQueueReport=require(_0xd6d6('0xb'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0xd6d6('0xc'));var trigger=require(_0xd6d6('0xd'));var template=require(_0xd6d6('0xe'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0xd6d6('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require('./rpc/faxAccount');var zendesk=require(_0xd6d6('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0xd6d6('0x11'));var freshdesk=require(_0xd6d6('0x12'));var desk=require(_0xd6d6('0x13'));var zoho=require(_0xd6d6('0x14'));var vtiger=require(_0xd6d6('0x15'));var freshsales=require(_0xd6d6('0x16'));var servicenow=require(_0xd6d6('0x17'));var dynamics365=require(_0xd6d6('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0xd6d6('0x19'))(_0xd6d6('0x1a'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0xd6d6('0x1b')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xd6d6('0x1c'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0xd6d6('0x1d')]()[_0xd6d6('0x1e')](user[_0xd6d6('0x1f')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x20')]())['then'](user['getTelephones']())['then'](realtime[_0xd6d6('0x21')]())[_0xd6d6('0x1e')](trunk['getTrunks']())['then'](realtime[_0xd6d6('0x22')]())['then'](voiceQueue['getVoiceQueues']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x23')]())['then'](trigger[_0xd6d6('0x24')]())[_0xd6d6('0x1e')](realtime['initTriggers']())[_0xd6d6('0x1e')](template['getTemplates']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x25')]())[_0xd6d6('0x1e')](zendesk[_0xd6d6('0x26')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x27')]())['then'](salesforce[_0xd6d6('0x28')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x29')]())[_0xd6d6('0x1e')](sugarcrm['getSugarcrmAccounts']())['then'](realtime[_0xd6d6('0x2a')]())[_0xd6d6('0x1e')](freshdesk['getFreshdeskAccounts']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x2b')]())[_0xd6d6('0x1e')](desk['getDeskAccounts']())['then'](realtime[_0xd6d6('0x2c')]())[_0xd6d6('0x1e')](zoho['getZohoAccounts']())['then'](realtime[_0xd6d6('0x2d')]())[_0xd6d6('0x1e')](vtiger[_0xd6d6('0x2e')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x2f')]())[_0xd6d6('0x1e')](freshsales[_0xd6d6('0x30')]())['then'](realtime[_0xd6d6('0x31')]())['then'](servicenow[_0xd6d6('0x32')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x33')]())[_0xd6d6('0x1e')](dynamics365[_0xd6d6('0x34')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x35')]())[_0xd6d6('0x1e')](campaign[_0xd6d6('0x36')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x37')]())[_0xd6d6('0x1e')](voiceExtension['getVoiceExtensions']())[_0xd6d6('0x1e')](realtime['initVoiceExtensions']())[_0xd6d6('0x1e')](faxAccount[_0xd6d6('0x38')]())['then'](realtime[_0xd6d6('0x39')]())[_0xd6d6('0x1e')](function(){return realtime;});}function initParams(){return Promise[_0xd6d6('0x1d')]()[_0xd6d6('0x1e')](voiceQueueReport[_0xd6d6('0x3a')]())[_0xd6d6('0x1e')](realtime['initVoiceQueueReports']())[_0xd6d6('0x1e')](cmHopperHistory[_0xd6d6('0x3b')]())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x3c')]())[_0xd6d6('0x1e')](cmHopperHistory[_0xd6d6('0x3d')]())['then'](realtime[_0xd6d6('0x3e')]())[_0xd6d6('0x1e')](voiceCallReport['getVoiceCallReports']())[_0xd6d6('0x1e')](realtime[_0xd6d6('0x3f')]())[_0xd6d6('0x40')](function(_0x597cdc){logger[_0xd6d6('0x41')](_0xd6d6('0x42'),util['inspect'](_0x597cdc,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0xd6d6('0x1e')](function(){return initParams();})[_0xd6d6('0x1e')](function(){report[_0xd6d6('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0xec4066){logger[_0xd6d6('0x41')]('[index.js][main]',util[_0xd6d6('0x44')](_0xec4066,{'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 b3b114d..b29dc93 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 _0x22c4=['not_inuse','inuse','talking','statePause','toNumber','format','user:%s','user:ami:update','omit','emit','user:presence','exports','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase'];(function(_0x5aff15,_0x1d7463){var _0xd355bf=function(_0x5b3d8c){while(--_0x5b3d8c){_0x5aff15['push'](_0x5aff15['shift']());}};_0xd355bf(++_0x1d7463);}(_0x22c4,0x81));var _0x422c=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x22c4[_0x387dc1];return _0x17567c;};'use strict';var _=require(_0x422c('0x0'));var util=require('util');var moment=require(_0x422c('0x1'));var md5=require(_0x422c('0x2'));var Redis=require(_0x422c('0x3'));var config=require(_0x422c('0x4'));config[_0x422c('0x5')]=_[_0x422c('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x422c('0x7'))(new Redis(config[_0x422c('0x5')]));function Agent(_0x1db2da){this['id']=_0x1db2da['id']||0x0;this[_0x422c('0x8')]=_0x1db2da['name']||'';this[_0x422c('0x9')]=_0x1db2da['email']||'';this[_0x422c('0xa')]=_0x1db2da['accountcode']||'';this[_0x422c('0xb')]=_0x1db2da[_0x422c('0xb')]||'';this[_0x422c('0xc')]=_0x422c('0xd');this[_0x422c('0xe')]=0x0;this[_0x422c('0xf')]=_0x422c('0xd');this[_0x422c('0x10')]='';this['phone']='';this['mobile']='';this['interface']='';this['online']=_0x1db2da[_0x422c('0x11')]||![];this[_0x422c('0x12')]='unknown';this[_0x422c('0x13')]=0x0;this[_0x422c('0x14')]='';this[_0x422c('0x15')]='';this[_0x422c('0x16')]=![];this[_0x422c('0x17')]=![];this[_0x422c('0x2')]='';}Agent[_0x422c('0x18')][_0x422c('0x19')]=function(_0x2749fe){var _0x41bc1a;if(_0x2749fe&&_0x2749fe['state']){_0x41bc1a=_0x2749fe[_0x422c('0xc')][_0x422c('0x1a')]();switch(_0x41bc1a){case _0x422c('0x1b'):_0x41bc1a='idle';break;case _0x422c('0x1c'):_0x41bc1a=_0x422c('0x1d');break;}}if(_0x41bc1a&&this[_0x422c('0x12')]!==_0x41bc1a||_0x2749fe[_0x422c('0x1e')]){this[_0x422c('0x13')]=_[_0x422c('0x1f')](moment()[_0x422c('0x20')]('x'));}if(_0x41bc1a){this[_0x422c('0x12')]=_0x41bc1a;}var _0x4d0750={'id':this['id'],'name':this[_0x422c('0x8')],'email':this[_0x422c('0x9')],'accountcode':this[_0x422c('0xa')],'fullname':this[_0x422c('0xb')],'state':this['state'],'stateTime':this[_0x422c('0xe')],'status':this[_0x422c('0xf')],'address':this[_0x422c('0x10')],'online':this['online'],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this['interface'],'onhold':this['onhold']};var _0x40bcb9=md5(JSON['stringify'](_0x4d0750));if(this['md5']!==_0x40bcb9){this[_0x422c('0x2')]=_0x40bcb9;io['to'](util[_0x422c('0x20')](_0x422c('0x21'),_0x4d0750['name']))['emit'](_0x422c('0x22'),_[_0x422c('0x23')](_0x4d0750,[_0x422c('0x11')]));io[_0x422c('0x24')](_0x422c('0x25'),_0x4d0750);}};module[_0x422c('0x26')]=Agent; \ No newline at end of file +var _0x67cd=['redis','name','email','accountcode','state','unknown','stateTime','status','address','phone','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','md5','prototype','updateStatusRealtime','toLowerCase','idle','inuse','talking','toNumber','format','fullname','stringify','user:%s','emit','omit','user:presence','exports','lodash','moment','../../../config/environment','defaults','localhost'];(function(_0x5a0113,_0x22121d){var _0x3614f8=function(_0x143354){while(--_0x143354){_0x5a0113['push'](_0x5a0113['shift']());}};_0x3614f8(++_0x22121d);}(_0x67cd,0xdf));var _0xd67c=function(_0x114984,_0x5c9593){_0x114984=_0x114984-0x0;var _0x44822b=_0x67cd[_0x114984];return _0x44822b;};'use strict';var _=require(_0xd67c('0x0'));var util=require('util');var moment=require(_0xd67c('0x1'));var md5=require('md5');var Redis=require('ioredis');var config=require(_0xd67c('0x2'));config['redis']=_[_0xd67c('0x3')](config['redis'],{'host':_0xd67c('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd67c('0x5')]));function Agent(_0x59b512){this['id']=_0x59b512['id']||0x0;this[_0xd67c('0x6')]=_0x59b512['name']||'';this['email']=_0x59b512[_0xd67c('0x7')]||'';this[_0xd67c('0x8')]=_0x59b512['accountcode']||'';this['fullname']=_0x59b512['fullname']||'';this[_0xd67c('0x9')]=_0xd67c('0xa');this[_0xd67c('0xb')]=0x0;this[_0xd67c('0xc')]=_0xd67c('0xa');this[_0xd67c('0xd')]='';this[_0xd67c('0xe')]='';this['mobile']='';this[_0xd67c('0xf')]='';this['online']=_0x59b512[_0xd67c('0x10')]||![];this[_0xd67c('0x11')]=_0xd67c('0xa');this[_0xd67c('0x12')]=0x0;this[_0xd67c('0x13')]='';this[_0xd67c('0x14')]='';this[_0xd67c('0x15')]=![];this['local']=![];this[_0xd67c('0x16')]='';}Agent[_0xd67c('0x17')][_0xd67c('0x18')]=function(_0x23df6b){var _0x232eeb;if(_0x23df6b&&_0x23df6b[_0xd67c('0x9')]){_0x232eeb=_0x23df6b[_0xd67c('0x9')][_0xd67c('0x19')]();switch(_0x232eeb){case'not_inuse':_0x232eeb=_0xd67c('0x1a');break;case _0xd67c('0x1b'):_0x232eeb=_0xd67c('0x1c');break;}}if(_0x232eeb&&this[_0xd67c('0x11')]!==_0x232eeb||_0x23df6b['statePause']){this['voiceStatusTime']=_[_0xd67c('0x1d')](moment()[_0xd67c('0x1e')]('x'));}if(_0x232eeb){this[_0xd67c('0x11')]=_0x232eeb;}var _0x435454={'id':this['id'],'name':this[_0xd67c('0x6')],'email':this[_0xd67c('0x7')],'accountcode':this[_0xd67c('0x8')],'fullname':this[_0xd67c('0x1f')],'state':this['state'],'stateTime':this[_0xd67c('0xb')],'status':this[_0xd67c('0xc')],'address':this['address'],'online':this[_0xd67c('0x10')],'voiceStatus':this[_0xd67c('0x11')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0xd67c('0xf')],'onhold':this[_0xd67c('0x15')]};var _0x5ca48a=md5(JSON[_0xd67c('0x20')](_0x435454));if(this['md5']!==_0x5ca48a){this['md5']=_0x5ca48a;io['to'](util['format'](_0xd67c('0x21'),_0x435454[_0xd67c('0x6')]))[_0xd67c('0x22')]('user:ami:update',_[_0xd67c('0x23')](_0x435454,[_0xd67c('0x10')]));io[_0xd67c('0x22')](_0xd67c('0x24'),_0x435454);}};module[_0xd67c('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 23717b0..8d843b2 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 _0xe930=['dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency'];(function(_0x2bff01,_0x53f6ee){var _0x5aef33=function(_0x2be952){while(--_0x2be952){_0x2bff01['push'](_0x2bff01['shift']());}};_0x5aef33(++_0x53f6ee);}(_0xe930,0xb4));var _0x0e93=function(_0x2c0ded,_0x3de22c){_0x2c0ded=_0x2c0ded-0x0;var _0x4473e5=_0xe930[_0x2c0ded];return _0x4473e5;};'use strict';function Campaign(_0x5c83e0){this['id']=_0x5c83e0['id']||0x0;this[_0x0e93('0x0')]=_0x5c83e0['name']||'';this[_0x0e93('0x1')]=_0x5c83e0[_0x0e93('0x1')]||'campaign';this[_0x0e93('0x2')]=0x0;this['temp']=0x0;this[_0x0e93('0x3')]=0x0;this[_0x0e93('0x4')]=0x0;this[_0x0e93('0x5')]='';this[_0x0e93('0x6')]=!![];this[_0x0e93('0x7')]=_0x5c83e0[_0x0e93('0x7')];this['limitCalls']=_0x5c83e0[_0x0e93('0x8')];this[_0x0e93('0x9')]=_0x5c83e0[_0x0e93('0x9')]||null;this['dialGlobalInterval']=_0x5c83e0[_0x0e93('0xa')]?_0x5c83e0[_0x0e93('0xa')]:null;this[_0x0e93('0xb')]=_0x5c83e0['dialOriginateCallerIdName'];this['dialOriginateCallerIdNumber']=_0x5c83e0[_0x0e93('0xc')];this[_0x0e93('0xd')]=_0x5c83e0['dialOriginateTimeout']||0x1e;this[_0x0e93('0xe')]=_0x5c83e0[_0x0e93('0xe')];this['dialCongestionRetryFrequency']=_0x5c83e0[_0x0e93('0xf')];this[_0x0e93('0x10')]=_0x5c83e0[_0x0e93('0x10')];this['dialBusyRetryFrequency']=_0x5c83e0['dialBusyRetryFrequency'];this['dialNoAnswerMaxRetry']=_0x5c83e0[_0x0e93('0x11')];this['dialNoAnswerRetryFrequency']=_0x5c83e0[_0x0e93('0x12')];this['dialGlobalMaxRetry']=_0x5c83e0[_0x0e93('0x13')];this[_0x0e93('0x14')]=_0x5c83e0['dialNoSuchNumberMaxRetry']||0x3;this[_0x0e93('0x15')]=_0x5c83e0[_0x0e93('0x15')]||0x96;this[_0x0e93('0x16')]=_0x5c83e0[_0x0e93('0x16')]||0x3;this['dialDropRetryFrequency']=_0x5c83e0[_0x0e93('0x17')]||0x96;this[_0x0e93('0x18')]=_0x5c83e0['dialAbandonedMaxRetry']||0x3;this['dialAbandonedRetryFrequency']=_0x5c83e0[_0x0e93('0x19')]||0x96;this[_0x0e93('0x1a')]=_0x5c83e0[_0x0e93('0x1a')]||0x3;this[_0x0e93('0x1b')]=_0x5c83e0[_0x0e93('0x1b')]||0x96;this[_0x0e93('0x1c')]=_0x5c83e0[_0x0e93('0x1c')]||0x3;this[_0x0e93('0x1d')]=_0x5c83e0[_0x0e93('0x1d')]||0x96;this[_0x0e93('0x1e')]=_0x5c83e0[_0x0e93('0x1e')]||_0x0e93('0x1f');this[_0x0e93('0x20')]=_0x5c83e0[_0x0e93('0x20')]||undefined;this[_0x0e93('0x21')]=_0x5c83e0[_0x0e93('0x21')]||undefined;this['dialCutDigit']=_0x5c83e0[_0x0e93('0x22')]||undefined;this[_0x0e93('0x23')]=_0x5c83e0[_0x0e93('0x23')]?_0x5c83e0[_0x0e93('0x23')]:undefined;this[_0x0e93('0x24')]=_0x5c83e0[_0x0e93('0x24')]?_0x5c83e0[_0x0e93('0x24')]:undefined;this[_0x0e93('0x25')]=_0x5c83e0[_0x0e93('0x25')]?_0x5c83e0[_0x0e93('0x25')]:undefined;this[_0x0e93('0x26')]=_0x5c83e0[_0x0e93('0x26')]?_0x5c83e0['SquareProject']:undefined;this[_0x0e93('0x27')]=_0x5c83e0[_0x0e93('0x26')]?_0x5c83e0['SquareProject'][_0x0e93('0x0')]:undefined;this[_0x0e93('0x28')]=_0x5c83e0[_0x0e93('0x28')]||![];this[_0x0e93('0x29')]=_0x5c83e0['dialAMDInitialSilence'];this[_0x0e93('0x2a')]=_0x5c83e0[_0x0e93('0x2a')];this[_0x0e93('0x2b')]=_0x5c83e0[_0x0e93('0x2b')];this[_0x0e93('0x2c')]=_0x5c83e0[_0x0e93('0x2c')];this['dialAMDMinWordLength']=_0x5c83e0[_0x0e93('0x2d')];this[_0x0e93('0x2e')]=_0x5c83e0[_0x0e93('0x2e')];this[_0x0e93('0x2f')]=_0x5c83e0['dialAMDMaximumNumberOfWords'];this[_0x0e93('0x30')]=_0x5c83e0[_0x0e93('0x30')];this[_0x0e93('0x31')]=_0x5c83e0[_0x0e93('0x31')];}module[_0x0e93('0x32')]=Campaign; \ No newline at end of file +var _0xd748=['type','campaign','originated','temp','ivrTotalCallsDays','message','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd748,0x95));var _0x8d74=function(_0x47adb8,_0x591ccc){_0x47adb8=_0x47adb8-0x0;var _0x4689a8=_0xd748[_0x47adb8];return _0x4689a8;};'use strict';function Campaign(_0x9dac8e){this['id']=_0x9dac8e['id']||0x0;this['name']=_0x9dac8e[_0x8d74('0x0')]||'';this[_0x8d74('0x1')]=_0x9dac8e['type']||_0x8d74('0x2');this[_0x8d74('0x3')]=0x0;this[_0x8d74('0x4')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x8d74('0x5')]=0x0;this[_0x8d74('0x6')]='';this['sendMessageOneNotActive']=!![];this[_0x8d74('0x7')]=_0x9dac8e[_0x8d74('0x7')];this['limitCalls']=_0x9dac8e[_0x8d74('0x8')];this['dialTimezone']=_0x9dac8e[_0x8d74('0x9')]||null;this['dialGlobalInterval']=_0x9dac8e[_0x8d74('0xa')]?_0x9dac8e[_0x8d74('0xa')]:null;this[_0x8d74('0xb')]=_0x9dac8e['dialOriginateCallerIdName'];this[_0x8d74('0xc')]=_0x9dac8e['dialOriginateCallerIdNumber'];this['dialOriginateTimeout']=_0x9dac8e[_0x8d74('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x9dac8e[_0x8d74('0xe')];this[_0x8d74('0xf')]=_0x9dac8e['dialCongestionRetryFrequency'];this[_0x8d74('0x10')]=_0x9dac8e[_0x8d74('0x10')];this['dialBusyRetryFrequency']=_0x9dac8e[_0x8d74('0x11')];this[_0x8d74('0x12')]=_0x9dac8e[_0x8d74('0x12')];this[_0x8d74('0x13')]=_0x9dac8e['dialNoAnswerRetryFrequency'];this[_0x8d74('0x14')]=_0x9dac8e[_0x8d74('0x14')];this[_0x8d74('0x15')]=_0x9dac8e[_0x8d74('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x9dac8e[_0x8d74('0x16')]||0x96;this[_0x8d74('0x17')]=_0x9dac8e['dialDropMaxRetry']||0x3;this[_0x8d74('0x18')]=_0x9dac8e[_0x8d74('0x18')]||0x96;this['dialAbandonedMaxRetry']=_0x9dac8e[_0x8d74('0x19')]||0x3;this['dialAbandonedRetryFrequency']=_0x9dac8e['dialAbandonedRetryFrequency']||0x96;this[_0x8d74('0x1a')]=_0x9dac8e[_0x8d74('0x1a')]||0x3;this['dialMachineRetryFrequency']=_0x9dac8e[_0x8d74('0x1b')]||0x96;this[_0x8d74('0x1c')]=_0x9dac8e[_0x8d74('0x1c')]||0x3;this[_0x8d74('0x1d')]=_0x9dac8e['dialAgentRejectRetryFrequency']||0x96;this[_0x8d74('0x1e')]=_0x9dac8e[_0x8d74('0x1e')]||_0x8d74('0x1f');this[_0x8d74('0x20')]=_0x9dac8e[_0x8d74('0x20')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x9dac8e[_0x8d74('0x21')]||undefined;this[_0x8d74('0x22')]=_0x9dac8e['dialCutDigit']||undefined;this[_0x8d74('0x23')]=_0x9dac8e['TrunkBackup']?_0x9dac8e[_0x8d74('0x23')]:undefined;this[_0x8d74('0x24')]=_0x9dac8e[_0x8d74('0x24')]?_0x9dac8e[_0x8d74('0x24')]:undefined;this[_0x8d74('0x25')]=_0x9dac8e[_0x8d74('0x25')]?_0x9dac8e[_0x8d74('0x25')]:undefined;this['SquareProject']=_0x9dac8e['SquareProject']?_0x9dac8e[_0x8d74('0x26')]:undefined;this[_0x8d74('0x27')]=_0x9dac8e[_0x8d74('0x26')]?_0x9dac8e[_0x8d74('0x26')][_0x8d74('0x0')]:undefined;this['dialAMDActive']=_0x9dac8e['dialAMDActive']||![];this[_0x8d74('0x28')]=_0x9dac8e[_0x8d74('0x28')];this[_0x8d74('0x29')]=_0x9dac8e['dialAMDGreeting'];this[_0x8d74('0x2a')]=_0x9dac8e[_0x8d74('0x2a')];this[_0x8d74('0x2b')]=_0x9dac8e[_0x8d74('0x2b')];this[_0x8d74('0x2c')]=_0x9dac8e[_0x8d74('0x2c')];this[_0x8d74('0x2d')]=_0x9dac8e[_0x8d74('0x2d')];this[_0x8d74('0x2e')]=_0x9dac8e[_0x8d74('0x2e')];this[_0x8d74('0x2f')]=_0x9dac8e[_0x8d74('0x2f')];this[_0x8d74('0x30')]=_0x9dac8e[_0x8d74('0x30')];}module[_0x8d74('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index e5fc3c5..c9d011f 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 _0x2272=['exten','answered','answertime','endtime','unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','type','disposition','monitor','monitorFilename','queue','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0x2272,0xd8));var _0x2227=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2272[_0xa464c9];return _0x3d73c4;};'use strict';function Channel(){this[_0x2227('0x0')]=null;this[_0x2227('0x1')]='';this[_0x2227('0x2')]='';this[_0x2227('0x3')]=0x0;this[_0x2227('0x4')]='';this['connectedlinenum']=undefined;this[_0x2227('0x5')]=undefined;this[_0x2227('0x6')]=0x0;this[_0x2227('0x7')]='';this['uniqueid']=0x0;this['linkedid']=0x0;this[_0x2227('0x8')]=0x0;this[_0x2227('0x9')]=![];this[_0x2227('0xa')]=null;this[_0x2227('0xb')]=null;this[_0x2227('0xc')]=![];this[_0x2227('0xd')]=![];this[_0x2227('0xe')]='';this[_0x2227('0xf')]='';this[_0x2227('0x10')]=0x0;this[_0x2227('0x11')]=0x0;this['holdtime']=0x0;this[_0x2227('0x12')]=null;this['tag']=null;this[_0x2227('0x13')]=null;this[_0x2227('0x14')]=![];this[_0x2227('0x15')]=null;this[_0x2227('0x16')]=null;this[_0x2227('0x17')]=[];this['transfercalleridnum']=undefined;this[_0x2227('0x18')]=undefined;this[_0x2227('0x19')]=undefined;this[_0x2227('0x1a')]=0x0;}module[_0x2227('0x1b')]=Channel; \ No newline at end of file +var _0x7275=['linkedid','endtime','abandoned','lastdata','billableseconds','holdtime','tag','disposition','monitorFilename','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridname','connectedlinename','accountcode','uniqueid'];(function(_0xe942c5,_0x53f5a1){var _0x2d0361=function(_0x50c794){while(--_0x50c794){_0xe942c5['push'](_0xe942c5['shift']());}};_0x2d0361(++_0x53f5a1);}(_0x7275,0x143));var _0x5727=function(_0x532a08,_0x1079ab){_0x532a08=_0x532a08-0x0;var _0xd9c5ee=_0x7275[_0x532a08];return _0xd9c5ee;};'use strict';function Channel(){this[_0x5727('0x0')]=null;this[_0x5727('0x1')]='';this[_0x5727('0x2')]='';this['calleridnum']=0x0;this[_0x5727('0x3')]='';this['connectedlinenum']=undefined;this[_0x5727('0x4')]=undefined;this[_0x5727('0x5')]=0x0;this['context']='';this[_0x5727('0x6')]=0x0;this[_0x5727('0x7')]=0x0;this['exten']=0x0;this['answered']=![];this['answertime']=null;this[_0x5727('0x8')]=null;this['unmanaged']=![];this[_0x5727('0x9')]=![];this['lastapplication']='';this[_0x5727('0xa')]='';this['duration']=0x0;this[_0x5727('0xb')]=0x0;this[_0x5727('0xc')]=0x0;this['type']=null;this[_0x5727('0xd')]=null;this[_0x5727('0xe')]=null;this['monitor']=![];this[_0x5727('0xf')]=null;this[_0x5727('0x10')]=null;this['monitors']=[];this[_0x5727('0x11')]=undefined;this[_0x5727('0x12')]=undefined;this[_0x5727('0x13')]=undefined;this[_0x5727('0x14')]=0x0;}module[_0x5727('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 944fb92..11390b0 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 _0xec6c=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','Configurations','exports','name'];(function(_0x3c7122,_0x175c9d){var _0x3fc088=function(_0xf7512a){while(--_0xf7512a){_0x3c7122['push'](_0x3c7122['shift']());}};_0x3fc088(++_0x175c9d);}(_0xec6c,0x17f));var _0xcec6=function(_0x412018,_0x32c87e){_0x412018=_0x412018-0x0;var _0x442d9b=_0xec6c[_0x412018];return _0x442d9b;};'use strict';function DeskAccount(_0x174697){this['id']=_0x174697['id']||0x0;this[_0xcec6('0x0')]=_0x174697[_0xcec6('0x0')]||'';this[_0xcec6('0x1')]=_0x174697[_0xcec6('0x1')]||'';this['remoteUri']=_0x174697[_0xcec6('0x2')]||'';this[_0xcec6('0x3')]=_0x174697[_0xcec6('0x3')]||'';this[_0xcec6('0x4')]=_0x174697[_0xcec6('0x4')]||'';this[_0xcec6('0x5')]=_0x174697['consumerKey']||'';this[_0xcec6('0x6')]=_0x174697[_0xcec6('0x6')]||'';this[_0xcec6('0x7')]=_0x174697[_0xcec6('0x7')]||'';this['tokenSecret']=_0x174697[_0xcec6('0x8')]||'';this[_0xcec6('0x9')]=_0x174697[_0xcec6('0x9')]||'';this['serverUrl']=_0x174697['serverUrl']||'';this['Configurations']=_0x174697[_0xcec6('0xa')]||{};}module[_0xcec6('0xb')]=DeskAccount; \ No newline at end of file +var _0xb82e=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','username','remoteUri','authType','password'];(function(_0x590205,_0x53cafa){var _0x5bc855=function(_0x75e819){while(--_0x75e819){_0x590205['push'](_0x590205['shift']());}};_0x5bc855(++_0x53cafa);}(_0xb82e,0xcd));var _0xeb82=function(_0x935920,_0x49105f){_0x935920=_0x935920-0x0;var _0x5edc44=_0xb82e[_0x935920];return _0x5edc44;};'use strict';function DeskAccount(_0x1dc7f9){this['id']=_0x1dc7f9['id']||0x0;this['name']=_0x1dc7f9['name']||'';this[_0xeb82('0x0')]=_0x1dc7f9[_0xeb82('0x0')]||'';this[_0xeb82('0x1')]=_0x1dc7f9[_0xeb82('0x1')]||'';this[_0xeb82('0x2')]=_0x1dc7f9[_0xeb82('0x2')]||'';this[_0xeb82('0x3')]=_0x1dc7f9[_0xeb82('0x3')]||'';this[_0xeb82('0x4')]=_0x1dc7f9[_0xeb82('0x4')]||'';this[_0xeb82('0x5')]=_0x1dc7f9[_0xeb82('0x5')]||'';this[_0xeb82('0x6')]=_0x1dc7f9[_0xeb82('0x6')]||'';this[_0xeb82('0x7')]=_0x1dc7f9[_0xeb82('0x7')]||'';this[_0xeb82('0x8')]=_0x1dc7f9[_0xeb82('0x8')]||'';this['serverUrl']=_0x1dc7f9[_0xeb82('0x9')]||'';this[_0xeb82('0xa')]=_0x1dc7f9[_0xeb82('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ca8efb2..d5cacdb 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 _0x2af8=['modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x415b04,_0x3ab6cb){var _0x468fc9=function(_0x536ebc){while(--_0x536ebc){_0x415b04['push'](_0x415b04['shift']());}};_0x468fc9(++_0x3ab6cb);}(_0x2af8,0x154));var _0x82af=function(_0x1a24f3,_0x59a629){_0x1a24f3=_0x1a24f3-0x0;var _0x4edf11=_0x2af8[_0x1a24f3];return _0x4edf11;};'use strict';function Dynamics365Account(_0x1d2e73){this['id']=_0x1d2e73['id']||0x0;this[_0x82af('0x0')]=_0x1d2e73[_0x82af('0x0')]||'';this[_0x82af('0x1')]=_0x1d2e73[_0x82af('0x1')]||'';this[_0x82af('0x2')]=_0x1d2e73[_0x82af('0x2')]||'';this[_0x82af('0x3')]=_0x1d2e73[_0x82af('0x3')]||'';this['tenantId']=_0x1d2e73[_0x82af('0x4')]||'';this[_0x82af('0x5')]=_0x1d2e73['clientId']||'';this[_0x82af('0x6')]=_0x1d2e73[_0x82af('0x6')]||{};this[_0x82af('0x7')]=_0x1d2e73[_0x82af('0x7')]||'';this[_0x82af('0x8')]=_0x1d2e73[_0x82af('0x8')]||![];this[_0x82af('0x9')]=_0x1d2e73[_0x82af('0x9')]||{};this[_0x82af('0xa')]=_0x1d2e73['CloudProvider']||{};}module[_0x82af('0xb')]=Dynamics365Account; \ No newline at end of file +var _0x8932=['tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri'];(function(_0x55e492,_0x398035){var _0x27b6a7=function(_0x3bff20){while(--_0x3bff20){_0x55e492['push'](_0x55e492['shift']());}};_0x27b6a7(++_0x398035);}(_0x8932,0xee));var _0x2893=function(_0x1e211b,_0x47f48c){_0x1e211b=_0x1e211b-0x0;var _0x29d307=_0x8932[_0x1e211b];return _0x29d307;};'use strict';function Dynamics365Account(_0x385591){this['id']=_0x385591['id']||0x0;this[_0x2893('0x0')]=_0x385591[_0x2893('0x0')]||'';this[_0x2893('0x1')]=_0x385591[_0x2893('0x1')]||'';this['password']=_0x385591[_0x2893('0x2')]||'';this[_0x2893('0x3')]=_0x385591[_0x2893('0x3')]||'';this['tenantId']=_0x385591[_0x2893('0x4')]||'';this[_0x2893('0x5')]=_0x385591[_0x2893('0x5')]||'';this[_0x2893('0x6')]=_0x385591[_0x2893('0x6')]||{};this['serverUrl']=_0x385591['serverUrl']||'';this[_0x2893('0x7')]=_0x385591[_0x2893('0x7')]||![];this[_0x2893('0x8')]=_0x385591[_0x2893('0x8')]||{};this[_0x2893('0x9')]=_0x385591['CloudProvider']||{};}module[_0x2893('0xa')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 586db11..e60a2b6 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 _0x1a81=['headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x57b9e0,_0x2fffc9){var _0x104561=function(_0x3f8157){while(--_0x3f8157){_0x57b9e0['push'](_0x57b9e0['shift']());}};_0x104561(++_0x2fffc9);}(_0x1a81,0x19b));var _0x11a8=function(_0x50aca8,_0x30cd2b){_0x50aca8=_0x50aca8-0x0;var _0x2a0c87=_0x1a81[_0x50aca8];return _0x2a0c87;};'use strict';function FaxAccount(_0x3d4f6a){this['id']=_0x3d4f6a['id']||0x0;this[_0x11a8('0x0')]=_0x3d4f6a[_0x11a8('0x0')]||'';this[_0x11a8('0x1')]=_0x3d4f6a[_0x11a8('0x1')];this[_0x11a8('0x2')]=_0x3d4f6a[_0x11a8('0x2')];this[_0x11a8('0x3')]=_0x3d4f6a[_0x11a8('0x3')];this[_0x11a8('0x4')]=_0x3d4f6a[_0x11a8('0x4')];this[_0x11a8('0x5')]=_0x3d4f6a[_0x11a8('0x5')]||0x960;this[_0x11a8('0x6')]=_0x3d4f6a[_0x11a8('0x6')]||0x3840;this[_0x11a8('0x7')]=_0x3d4f6a['modem']||_0x11a8('0x8');this['gateway']=_0x3d4f6a[_0x11a8('0x9')]||'no';this[_0x11a8('0xa')]=_0x3d4f6a[_0x11a8('0xa')]||'no';this['t38timeout']=_0x3d4f6a[_0x11a8('0xb')]||0x1388;this[_0x11a8('0xc')]=_0x3d4f6a[_0x11a8('0xc')]||_0x11a8('0xd');this[_0x11a8('0xe')]=_0x3d4f6a[_0x11a8('0xe')]?_0x3d4f6a[_0x11a8('0xe')]:undefined;this[_0x11a8('0xf')]=_0x3d4f6a['ListId'];this[_0x11a8('0x10')]=_0x3d4f6a['key'];}module[_0x11a8('0x11')]=FaxAccount; \ No newline at end of file +var _0x7643=['description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name'];(function(_0x941d1c,_0x3ce8e2){var _0x4ba201=function(_0x28584a){while(--_0x28584a){_0x941d1c['push'](_0x941d1c['shift']());}};_0x4ba201(++_0x3ce8e2);}(_0x7643,0x6b));var _0x3764=function(_0xaa656e,_0x250a02){_0xaa656e=_0xaa656e-0x0;var _0x2b2d99=_0x7643[_0xaa656e];return _0x2b2d99;};'use strict';function FaxAccount(_0x124408){this['id']=_0x124408['id']||0x0;this[_0x3764('0x0')]=_0x124408['name']||'';this[_0x3764('0x1')]=_0x124408[_0x3764('0x1')];this[_0x3764('0x2')]=_0x124408[_0x3764('0x2')];this[_0x3764('0x3')]=_0x124408[_0x3764('0x3')];this[_0x3764('0x4')]=_0x124408[_0x3764('0x4')];this[_0x3764('0x5')]=_0x124408[_0x3764('0x5')]||0x960;this[_0x3764('0x6')]=_0x124408[_0x3764('0x6')]||0x3840;this[_0x3764('0x7')]=_0x124408[_0x3764('0x7')]||_0x3764('0x8');this[_0x3764('0x9')]=_0x124408[_0x3764('0x9')]||'no';this[_0x3764('0xa')]=_0x124408[_0x3764('0xa')]||'no';this['t38timeout']=_0x124408[_0x3764('0xb')]||0x1388;this[_0x3764('0xc')]=_0x124408[_0x3764('0xc')]||_0x3764('0xd');this[_0x3764('0xe')]=_0x124408['Trunk']?_0x124408[_0x3764('0xe')]:undefined;this[_0x3764('0xf')]=_0x124408['ListId'];this[_0x3764('0x10')]=_0x124408[_0x3764('0x10')];}module[_0x3764('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 117691c..3466874 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 _0x7212=['apiKey','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x1f4ff0,_0x2077a1){var _0x36ed56=function(_0xf1d4ae){while(--_0xf1d4ae){_0x1f4ff0['push'](_0x1f4ff0['shift']());}};_0x36ed56(++_0x2077a1);}(_0x7212,0x1be));var _0x2721=function(_0x20233b,_0x42beca){_0x20233b=_0x20233b-0x0;var _0x199546=_0x7212[_0x20233b];return _0x199546;};'use strict';function FreshdeskAccount(_0x137448){this['id']=_0x137448['id']||0x0;this[_0x2721('0x0')]=_0x137448[_0x2721('0x0')]||'';this[_0x2721('0x1')]=_0x137448[_0x2721('0x1')]||'';this[_0x2721('0x2')]=_0x137448['token']||'';this[_0x2721('0x3')]=_0x137448[_0x2721('0x3')]||'';this[_0x2721('0x4')]=_0x137448['serverUrl']||'';this[_0x2721('0x5')]=_0x137448[_0x2721('0x5')]||{};}module[_0x2721('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x5243=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x5243,0x9e));var _0x3524=function(_0x17bd75,_0x436927){_0x17bd75=_0x17bd75-0x0;var _0x5b99cb=_0x5243[_0x17bd75];return _0x5b99cb;};'use strict';function FreshdeskAccount(_0x3ad0f5){this['id']=_0x3ad0f5['id']||0x0;this[_0x3524('0x0')]=_0x3ad0f5['name']||'';this[_0x3524('0x1')]=_0x3ad0f5[_0x3524('0x1')]||'';this[_0x3524('0x2')]=_0x3ad0f5[_0x3524('0x3')]||'';this['remoteUri']=_0x3ad0f5[_0x3524('0x4')]||'';this[_0x3524('0x5')]=_0x3ad0f5[_0x3524('0x5')]||'';this[_0x3524('0x6')]=_0x3ad0f5['Configurations']||{};}module[_0x3524('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 6d2ef56..f0eef52 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 _0x33c5=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4b2863,_0x494899){var _0x567d67=function(_0x751f03){while(--_0x751f03){_0x4b2863['push'](_0x4b2863['shift']());}};_0x567d67(++_0x494899);}(_0x33c5,0xe6));var _0x533c=function(_0x454165,_0x1f3e74){_0x454165=_0x454165-0x0;var _0x56db53=_0x33c5[_0x454165];return _0x56db53;};'use strict';function FreshsalesAccount(_0x3e6081){this['id']=_0x3e6081['id']||0x0;this[_0x533c('0x0')]=_0x3e6081[_0x533c('0x0')]||'';this['username']=_0x3e6081[_0x533c('0x1')]||'';this[_0x533c('0x2')]=_0x3e6081[_0x533c('0x3')]||'';this[_0x533c('0x4')]=_0x3e6081[_0x533c('0x4')]||'';this['serverUrl']=_0x3e6081[_0x533c('0x5')]||'';this[_0x533c('0x6')]=_0x3e6081[_0x533c('0x6')]||{};}module[_0x533c('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0xa786=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa786,0x1d2));var _0x6a78=function(_0x5cbdab,_0x3d2cf8){_0x5cbdab=_0x5cbdab-0x0;var _0x3b6829=_0xa786[_0x5cbdab];return _0x3b6829;};'use strict';function FreshsalesAccount(_0x1a809b){this['id']=_0x1a809b['id']||0x0;this['name']=_0x1a809b[_0x6a78('0x0')]||'';this[_0x6a78('0x1')]=_0x1a809b[_0x6a78('0x1')]||'';this[_0x6a78('0x2')]=_0x1a809b[_0x6a78('0x3')]||'';this[_0x6a78('0x4')]=_0x1a809b[_0x6a78('0x4')]||'';this['serverUrl']=_0x1a809b[_0x6a78('0x5')]||'';this[_0x6a78('0x6')]=_0x1a809b[_0x6a78('0x6')]||{};}module[_0x6a78('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 9a48e1c..a1bdc26 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 _0x622b=['mohtime','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','originalposition','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','assigned','motionChannel','voice'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x622b,0x1aa));var _0xb622=function(_0x92dda1,_0x5348ca){_0x92dda1=_0x92dda1-0x0;var _0x17dee2=_0x622b[_0x92dda1];return _0x17dee2;};'use strict';function QueueReport(){this[_0xb622('0x0')]=_0xb622('0x1');this[_0xb622('0x2')]='';this[_0xb622('0x3')]='';this[_0xb622('0x4')]='';this[_0xb622('0x5')]='';this[_0xb622('0x6')]=null;this[_0xb622('0x7')]=null;this[_0xb622('0x8')]=0x1;this[_0xb622('0x9')]=0x1;this[_0xb622('0xa')]=![];this[_0xb622('0xb')]=null;this[_0xb622('0xc')]=![];this[_0xb622('0xd')]=null;this['queuecallerexit']=![];this['queuecallerexitAt']=null;this[_0xb622('0xe')]=0x1;this[_0xb622('0xf')]='';this[_0xb622('0x10')]='';this[_0xb622('0x11')]='';this['accountcode']='';this['context']='';this[_0xb622('0x12')]='';this[_0xb622('0x13')]='';this[_0xb622('0x14')]=0x0;this[_0xb622('0x15')]=![];this['lastAssignedTo']='';this[_0xb622('0x16')]=_0xb622('0x17');this[_0xb622('0x18')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xba85=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallerexit','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','mohtime','variables','exports','inbound'];(function(_0x169857,_0x4f3839){var _0x57dd1e=function(_0x28a448){while(--_0x28a448){_0x169857['push'](_0x169857['shift']());}};_0x57dd1e(++_0x4f3839);}(_0xba85,0x1df));var _0x5ba8=function(_0x5a94f7,_0x384db6){_0x5a94f7=_0x5a94f7-0x0;var _0x1c6049=_0xba85[_0x5a94f7];return _0x1c6049;};'use strict';function QueueReport(){this['type']=_0x5ba8('0x0');this[_0x5ba8('0x1')]='';this[_0x5ba8('0x2')]='';this[_0x5ba8('0x3')]='';this[_0x5ba8('0x4')]='';this[_0x5ba8('0x5')]=null;this['queuecallerleaveAt']=null;this[_0x5ba8('0x6')]=0x1;this[_0x5ba8('0x7')]=0x1;this[_0x5ba8('0x8')]=![];this[_0x5ba8('0x9')]=null;this[_0x5ba8('0xa')]=![];this['queuecallercompleteAt']=null;this[_0x5ba8('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this[_0x5ba8('0xc')]='';this[_0x5ba8('0xd')]='';this[_0x5ba8('0xe')]='';this[_0x5ba8('0xf')]='';this[_0x5ba8('0x10')]='';this[_0x5ba8('0x11')]='';this[_0x5ba8('0x12')]=0x0;this[_0x5ba8('0x13')]=![];this['lastAssignedTo']='';this[_0x5ba8('0x14')]='voice';this[_0x5ba8('0x15')]=0x0;this[_0x5ba8('0x16')]={};}module[_0x5ba8('0x17')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f7a16ab..714a2fb 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 _0xe3cc=['clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri','password'];(function(_0xa8bd51,_0x51b538){var _0x1ef2e5=function(_0x37f31c){while(--_0x37f31c){_0xa8bd51['push'](_0xa8bd51['shift']());}};_0x1ef2e5(++_0x51b538);}(_0xe3cc,0x8b));var _0xce3c=function(_0x4efaae,_0x3073d1){_0x4efaae=_0x4efaae-0x0;var _0x1e43af=_0xe3cc[_0x4efaae];return _0x1e43af;};'use strict';function SalesforceAccount(_0x8e2f2b){this['id']=_0x8e2f2b['id']||0x0;this[_0xce3c('0x0')]=_0x8e2f2b[_0xce3c('0x0')]||'';this[_0xce3c('0x1')]=_0x8e2f2b[_0xce3c('0x1')]||'';this[_0xce3c('0x2')]=_0x8e2f2b[_0xce3c('0x2')]||'';this[_0xce3c('0x3')]=_0x8e2f2b[_0xce3c('0x3')]||'';this['clientId']=_0x8e2f2b['clientId']||'';this[_0xce3c('0x4')]=_0x8e2f2b['clientSecret']||'';this['securityToken']=_0x8e2f2b[_0xce3c('0x5')]||'';this['type']=_0x8e2f2b[_0xce3c('0x6')]||_0xce3c('0x7');this[_0xce3c('0x8')]=_0x8e2f2b[_0xce3c('0x8')]||'';this[_0xce3c('0x9')]=_0x8e2f2b[_0xce3c('0x9')]||{};}module[_0xce3c('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x6d08=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name','username'];(function(_0x30ef3d,_0x4befff){var _0x4a3620=function(_0x3083a7){while(--_0x3083a7){_0x30ef3d['push'](_0x30ef3d['shift']());}};_0x4a3620(++_0x4befff);}(_0x6d08,0x13d));var _0x86d0=function(_0x2c8c94,_0x52a5b8){_0x2c8c94=_0x2c8c94-0x0;var _0x17b5d8=_0x6d08[_0x2c8c94];return _0x17b5d8;};'use strict';function SalesforceAccount(_0x1c72f4){this['id']=_0x1c72f4['id']||0x0;this[_0x86d0('0x0')]=_0x1c72f4[_0x86d0('0x0')]||'';this[_0x86d0('0x1')]=_0x1c72f4[_0x86d0('0x1')]||'';this[_0x86d0('0x2')]=_0x1c72f4[_0x86d0('0x2')]||'';this[_0x86d0('0x3')]=_0x1c72f4[_0x86d0('0x3')]||'';this[_0x86d0('0x4')]=_0x1c72f4[_0x86d0('0x4')]||'';this['clientSecret']=_0x1c72f4[_0x86d0('0x5')]||'';this[_0x86d0('0x6')]=_0x1c72f4[_0x86d0('0x6')]||'';this[_0x86d0('0x7')]=_0x1c72f4[_0x86d0('0x7')]||_0x86d0('0x8');this['serverUrl']=_0x1c72f4[_0x86d0('0x9')]||'';this['Configurations']=_0x1c72f4[_0x86d0('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 18bf490..49a409e 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 _0xca37=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xca37,0x17b));var _0x7ca3=function(_0x36f197,_0x1d6ab1){_0x36f197=_0x36f197-0x0;var _0x35585c=_0xca37[_0x36f197];return _0x35585c;};'use strict';function ServicenowAccount(_0x5ba0e2){this['id']=_0x5ba0e2['id']||0x0;this[_0x7ca3('0x0')]=_0x5ba0e2[_0x7ca3('0x0')]||'';this[_0x7ca3('0x1')]=_0x5ba0e2[_0x7ca3('0x1')]||'';this[_0x7ca3('0x2')]=_0x5ba0e2[_0x7ca3('0x2')]||'';this[_0x7ca3('0x3')]=_0x5ba0e2[_0x7ca3('0x3')]||'';this[_0x7ca3('0x4')]=_0x5ba0e2[_0x7ca3('0x4')]||'';this[_0x7ca3('0x5')]=_0x5ba0e2[_0x7ca3('0x5')]||{};}module[_0x7ca3('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x6584=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0xbed368,_0x43c7b3){var _0x221bfa=function(_0x13ce14){while(--_0x13ce14){_0xbed368['push'](_0xbed368['shift']());}};_0x221bfa(++_0x43c7b3);}(_0x6584,0x175));var _0x4658=function(_0x133277,_0xb1d6b2){_0x133277=_0x133277-0x0;var _0x5b4a22=_0x6584[_0x133277];return _0x5b4a22;};'use strict';function ServicenowAccount(_0xd0b5ce){this['id']=_0xd0b5ce['id']||0x0;this[_0x4658('0x0')]=_0xd0b5ce[_0x4658('0x0')]||'';this[_0x4658('0x1')]=_0xd0b5ce['username']||'';this[_0x4658('0x2')]=_0xd0b5ce[_0x4658('0x2')]||'';this[_0x4658('0x3')]=_0xd0b5ce['remoteUri']||'';this['serverUrl']=_0xd0b5ce[_0x4658('0x4')]||'';this[_0x4658('0x5')]=_0xd0b5ce[_0x4658('0x5')]||{};}module[_0x4658('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 705bfac..6f931f3 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 _0xd3d4=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x4c851b,_0x447ec0){var _0x413380=function(_0x44d27e){while(--_0x44d27e){_0x4c851b['push'](_0x4c851b['shift']());}};_0x413380(++_0x447ec0);}(_0xd3d4,0x1b4));var _0x4d3d=function(_0x81bf2f,_0x2a705e){_0x81bf2f=_0x81bf2f-0x0;var _0x447f8e=_0xd3d4[_0x81bf2f];return _0x447f8e;};'use strict';function SugarcrmAccount(_0x1eed0e){this['id']=_0x1eed0e['id']||0x0;this[_0x4d3d('0x0')]=_0x1eed0e[_0x4d3d('0x0')]||'';this[_0x4d3d('0x1')]=_0x1eed0e['username']||'';this[_0x4d3d('0x2')]=_0x1eed0e[_0x4d3d('0x2')]||'';this[_0x4d3d('0x3')]=_0x1eed0e[_0x4d3d('0x3')]||'';this[_0x4d3d('0x4')]=_0x1eed0e[_0x4d3d('0x4')]||'';this[_0x4d3d('0x5')]=_0x1eed0e[_0x4d3d('0x5')]||{};}module[_0x4d3d('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x2b24=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x3b6303,_0x1abd3e){var _0x51ea5f=function(_0x44d8e4){while(--_0x44d8e4){_0x3b6303['push'](_0x3b6303['shift']());}};_0x51ea5f(++_0x1abd3e);}(_0x2b24,0x82));var _0x42b2=function(_0x2fa2f2,_0x19bc20){_0x2fa2f2=_0x2fa2f2-0x0;var _0x37ec73=_0x2b24[_0x2fa2f2];return _0x37ec73;};'use strict';function SugarcrmAccount(_0x5c2dd0){this['id']=_0x5c2dd0['id']||0x0;this['name']=_0x5c2dd0[_0x42b2('0x0')]||'';this[_0x42b2('0x1')]=_0x5c2dd0[_0x42b2('0x1')]||'';this[_0x42b2('0x2')]=_0x5c2dd0['password']||'';this[_0x42b2('0x3')]=_0x5c2dd0[_0x42b2('0x3')]||'';this[_0x42b2('0x4')]=_0x5c2dd0[_0x42b2('0x4')]||'';this['Configurations']=_0x5c2dd0[_0x42b2('0x5')]||{};}module[_0x42b2('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 2169010..1283859 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 _0xd3d3=['unknown','exports','name','accountcode','stateTime','status'];(function(_0x1bdd2c,_0x34c99a){var _0x1dc9ef=function(_0x217f38){while(--_0x217f38){_0x1bdd2c['push'](_0x1bdd2c['shift']());}};_0x1dc9ef(++_0x34c99a);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0xd3d3[_0x4fde08];return _0x12e725;};'use strict';function Telephone(_0x48c2ec){this['id']=_0x48c2ec['id']||0x0;this['name']=_0x48c2ec[_0x3d3d('0x0')]||'';this[_0x3d3d('0x1')]=_0x48c2ec['accountcode']||'';this['state']='unknown';this[_0x3d3d('0x2')]=0x0;this[_0x3d3d('0x3')]=_0x3d3d('0x4');this['address']='';}module[_0x3d3d('0x5')]=Telephone; \ No newline at end of file +var _0xa226=['address','exports','name','accountcode','state','unknown','status'];(function(_0x426dee,_0x151359){var _0x2cc9d0=function(_0x8e4feb){while(--_0x8e4feb){_0x426dee['push'](_0x426dee['shift']());}};_0x2cc9d0(++_0x151359);}(_0xa226,0x64));var _0x6a22=function(_0x23c4e8,_0x8e4d91){_0x23c4e8=_0x23c4e8-0x0;var _0x2f10f3=_0xa226[_0x23c4e8];return _0x2f10f3;};'use strict';function Telephone(_0x45ae06){this['id']=_0x45ae06['id']||0x0;this[_0x6a22('0x0')]=_0x45ae06['name']||'';this[_0x6a22('0x1')]=_0x45ae06[_0x6a22('0x1')]||'';this[_0x6a22('0x2')]=_0x6a22('0x3');this['stateTime']=0x0;this[_0x6a22('0x4')]=_0x6a22('0x3');this[_0x6a22('0x5')]='';}module[_0x6a22('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3a0eff8..a5b0bed 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(_0x37f1c1,_0x4c2b7a){var _0x41884c=function(_0x2f4b5b){while(--_0x2f4b5b){_0x37f1c1['push'](_0x37f1c1['shift']());}};_0x41884c(++_0x4c2b7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x4e7c2,_0x3b3347){_0x4e7c2=_0x4e7c2-0x0;var _0x84bb35=_0xb10b[_0x4e7c2];return _0x84bb35;};'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(_0x579e85,_0x536108){var _0x1e6c61=function(_0x4e1ef2){while(--_0x4e1ef2){_0x579e85['push'](_0x579e85['shift']());}};_0x1e6c61(++_0x536108);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 d758905..a2ce1c4 100644 --- a/server/services/ami/model/trigger.js +++ b/server/services/ami/model/trigger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x4e7a58,_0x5104d9){var _0x22e4b6=function(_0x44fffe){while(--_0x44fffe){_0x4e7a58['push'](_0x4e7a58['shift']());}};_0x22e4b6(++_0x5104d9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xb7e7[_0x3c4737];return _0x2bb926;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file +var _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x42f836,_0x45d3f9){var _0x3334fd=function(_0x176d7f){while(--_0x176d7f){_0x42f836['push'](_0x42f836['shift']());}};_0x3334fd(++_0x45d3f9);}(_0xda3f,0xec));var _0xfda3=function(_0x38889b,_0x2851c7){_0x38889b=_0x38889b-0x0;var _0x5c2b85=_0xda3f[_0x38889b];return _0x5c2b85;};'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 diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index ab72600..59e3f95 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 _0x2679=['host','port','domainport','registrationtime','defaultuser','exports','active','name','state','unknown','status','registry','indexOf'];(function(_0x38441d,_0x12e5f5){var _0x23c0a0=function(_0xa360c8){while(--_0xa360c8){_0x38441d['push'](_0x38441d['shift']());}};_0x23c0a0(++_0x12e5f5);}(_0x2679,0x165));var _0x9267=function(_0x45d1b1,_0x328cb0){_0x45d1b1=_0x45d1b1-0x0;var _0x313c30=_0x2679[_0x45d1b1];return _0x313c30;};'use strict';function Trunk(_0x31acef){this['id']=_0x31acef['id']||0x0;this[_0x9267('0x0')]=_0x31acef[_0x9267('0x0')]||![];this[_0x9267('0x1')]=_0x31acef[_0x9267('0x1')]||'';this[_0x9267('0x2')]=_0x9267('0x3');this['stateTime']=0x0;this[_0x9267('0x4')]=_0x9267('0x3');this[_0x9267('0x5')]=_0x31acef[_0x9267('0x5')]&&_0x31acef[_0x9267('0x5')][_0x9267('0x6')](':')?_0x31acef[_0x9267('0x5')]['split'](':')[0x0]:'';this[_0x9267('0x7')]='';this[_0x9267('0x8')]='';this['domain']='';this[_0x9267('0x9')]='';this['refresh']='';this['stateRegistry']=_0x9267('0x3');this[_0x9267('0xa')]='';this['address']='';this[_0x9267('0xb')]=_0x31acef['defaultuser']||'';}module[_0x9267('0xc')]=Trunk; \ No newline at end of file +var _0x1d99=['registrationtime','address','defaultuser','active','name','state','unknown','stateTime','status','registry','indexOf','split','host','domain','domainport','refresh','stateRegistry'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0x1d99,0x179));var _0x91d9=function(_0x65fab3,_0x390c6c){_0x65fab3=_0x65fab3-0x0;var _0x25c9ce=_0x1d99[_0x65fab3];return _0x25c9ce;};'use strict';function Trunk(_0x3fda51){this['id']=_0x3fda51['id']||0x0;this[_0x91d9('0x0')]=_0x3fda51[_0x91d9('0x0')]||![];this[_0x91d9('0x1')]=_0x3fda51['name']||'';this[_0x91d9('0x2')]=_0x91d9('0x3');this[_0x91d9('0x4')]=0x0;this[_0x91d9('0x5')]='unknown';this['registry']=_0x3fda51[_0x91d9('0x6')]&&_0x3fda51[_0x91d9('0x6')][_0x91d9('0x7')](':')?_0x3fda51['registry'][_0x91d9('0x8')](':')[0x0]:'';this[_0x91d9('0x9')]='';this['port']='';this[_0x91d9('0xa')]='';this[_0x91d9('0xb')]='';this[_0x91d9('0xc')]='';this[_0x91d9('0xd')]='unknown';this[_0x91d9('0xe')]='';this[_0x91d9('0xf')]='';this[_0x91d9('0x10')]=_0x3fda51['defaultuser']||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e54f8b7..134460f 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 _0x8791=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x1857d0,_0x6eade0){var _0x3e3c46=function(_0x3915b8){while(--_0x3915b8){_0x1857d0['push'](_0x1857d0['shift']());}};_0x3e3c46(++_0x6eade0);}(_0x8791,0x7a));var _0x1879=function(_0x4bbf7c,_0x1fda40){_0x4bbf7c=_0x4bbf7c-0x0;var _0x4bb91e=_0x8791[_0x4bbf7c];return _0x4bb91e;};'use strict';function voiceExtension(_0x3e2753){this['id']=_0x3e2753['id']||0x0;this[_0x1879('0x0')]=_0x3e2753['exten']||'';this[_0x1879('0x1')]=_0x3e2753['recordingFormat']||_0x1879('0x2');this[_0x1879('0x3')]=_0x3e2753[_0x1879('0x3')]||![];}module[_0x1879('0x4')]=voiceExtension; \ No newline at end of file +var _0xa2df=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x3862ed,_0x3b1524){var _0x15fea0=function(_0x124f38){while(--_0x124f38){_0x3862ed['push'](_0x3862ed['shift']());}};_0x15fea0(++_0x3b1524);}(_0xa2df,0x97));var _0xfa2d=function(_0x3fc44b,_0x2cf9c0){_0x3fc44b=_0x3fc44b-0x0;var _0x3b64f9=_0xa2df[_0x3fc44b];return _0x3b64f9;};'use strict';function voiceExtension(_0x3b3140){this['id']=_0x3b3140['id']||0x0;this[_0xfa2d('0x0')]=_0x3b3140[_0xfa2d('0x0')]||'';this[_0xfa2d('0x1')]=_0x3b3140[_0xfa2d('0x1')]||_0xfa2d('0x2');this[_0xfa2d('0x3')]=_0x3b3140['mandatoryDisposition']||![];}module[_0xfa2d('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 e21f66d..c66ecb0 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 _0x21b7=['loggedIn','paused','ringInUse','talking','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','fewestcalls','leastrecent','linear','random','rrmemory','rrordered','wrandom','name','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','unmanaged','abandoned','available','busy','inUse','invalid'];(function(_0x12b4d4,_0x26c1a7){var _0x4845a6=function(_0x55fad9){while(--_0x55fad9){_0x12b4d4['push'](_0x12b4d4['shift']());}};_0x4845a6(++_0x26c1a7);}(_0x21b7,0xef));var _0x721b=function(_0x2dd942,_0x36175e){_0x2dd942=_0x2dd942-0x0;var _0xb6787d=_0x21b7[_0x2dd942];return _0xb6787d;};'use strict';var monitorFormat={'wav':'wav','wav49':'wav49','gsm':'gsm'};var strategy={'fewestcalls':_0x721b('0x0'),'leastrecent':_0x721b('0x1'),'linear':_0x721b('0x2'),'random':_0x721b('0x3'),'ringall':'ringall','rr':'roundrobin','rrmemory':_0x721b('0x4'),'rrordered':_0x721b('0x5'),'wrandom':_0x721b('0x6')};function VoiceQueue(_0x343cd3){this['id']=_0x343cd3['id']||0x0;this[_0x721b('0x7')]=_0x343cd3[_0x721b('0x7')]||'';this['monitor_format']=_0x343cd3[_0x721b('0x8')]||'';this[_0x721b('0x9')]=_0x343cd3['type']||'inbound';this[_0x721b('0xa')]=0x0;this[_0x721b('0xb')]=0x0;this[_0x721b('0xc')]=0x0;this[_0x721b('0xd')]=0x0;this[_0x721b('0xe')]=0x0;this['sumBillable']=0x0;this[_0x721b('0xf')]=0x0;this[_0x721b('0x10')]=0x0;this[_0x721b('0x11')]=0x0;this[_0x721b('0x12')]=0x0;this[_0x721b('0x13')]=0x0;this[_0x721b('0x14')]=0x0;this[_0x721b('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0x721b('0x16')]=0x0;this['ringing']=0x0;this[_0x721b('0x17')]=0x0;this[_0x721b('0x18')]=0x0;this['unavailable']=0x0;this['unknown']=0x0;this[_0x721b('0x19')]=_0x343cd3[_0x721b('0x19')]||![];this[_0x721b('0x1a')]=_0x343cd3[_0x721b('0x1a')]||0xa;this[_0x721b('0x1b')]=_0x343cd3[_0x721b('0x1b')]||'no';this[_0x721b('0x1c')]=!![];this[_0x721b('0x1d')]='';this[_0x721b('0x1e')]='';this[_0x721b('0x1f')]=0x0;this[_0x721b('0x20')]=0x0;this[_0x721b('0x21')]=_0x343cd3[_0x721b('0x21')]||null;this[_0x721b('0x22')]=_0x343cd3['dialGlobalInterval']?_0x343cd3[_0x721b('0x22')]:null;this[_0x721b('0x23')]=_0x343cd3[_0x721b('0x23')];this[_0x721b('0x24')]=_0x343cd3[_0x721b('0x24')]||_0x721b('0x25');this[_0x721b('0x26')]=_0x343cd3['dialLimitChannel']||0x0;this[_0x721b('0x27')]=_0x343cd3[_0x721b('0x27')]||0x0;this[_0x721b('0x28')]=_0x343cd3[_0x721b('0x28')]||0x1;this[_0x721b('0x29')]=_0x343cd3[_0x721b('0x29')]||_0x721b('0x2a');this[_0x721b('0x2b')]=_0x343cd3[_0x721b('0x2b')]||0.03;this[_0x721b('0x2c')]=_0x343cd3['dialPredictiveInterval']||0x258;this[_0x721b('0x2d')]=_0x343cd3[_0x721b('0x2d')]||_0x721b('0x2e');this['dialOriginateCallerIdNumber']=_0x343cd3['dialOriginateCallerIdNumber']||_0x721b('0x2e');this[_0x721b('0x2f')]=_0x343cd3[_0x721b('0x2f')]||0x1e;this[_0x721b('0x30')]=_0x343cd3[_0x721b('0x30')]||_0x721b('0x31');this['dialQueueTimeout']=_0x343cd3[_0x721b('0x32')]||0x3;this[_0x721b('0x33')]=_0x343cd3['dialQueueProject']||undefined;this[_0x721b('0x34')]=_0x343cd3[_0x721b('0x34')]||0x3;this[_0x721b('0x35')]=_0x343cd3['dialCongestionRetryFrequency']||0x96;this[_0x721b('0x36')]=_0x343cd3['dialBusyMaxRetry']||0x3;this[_0x721b('0x37')]=_0x343cd3[_0x721b('0x37')]||0x96;this[_0x721b('0x38')]=_0x343cd3['dialNoAnswerMaxRetry']||0x3;this[_0x721b('0x39')]=_0x343cd3[_0x721b('0x39')]||0x96;this[_0x721b('0x3a')]=_0x343cd3['dialNoSuchNumberMaxRetry']||0x3;this[_0x721b('0x3b')]=_0x343cd3['dialNoSuchNumberRetryFrequency']||0x96;this[_0x721b('0x3c')]=_0x343cd3[_0x721b('0x3c')]||0x3;this['dialDropRetryFrequency']=_0x343cd3[_0x721b('0x3d')]||0x96;this[_0x721b('0x3e')]=_0x343cd3[_0x721b('0x3e')]||0x3;this['dialAbandonedRetryFrequency']=_0x343cd3[_0x721b('0x3f')]||0x96;this[_0x721b('0x40')]=_0x343cd3[_0x721b('0x40')]||0x3;this['dialMachineRetryFrequency']=_0x343cd3[_0x721b('0x41')]||0x96;this[_0x721b('0x42')]=_0x343cd3[_0x721b('0x42')]||0x3;this[_0x721b('0x43')]=_0x343cd3['dialAgentRejectRetryFrequency']||0x96;this[_0x721b('0x44')]=_0x343cd3[_0x721b('0x44')]||0x3;this[_0x721b('0x45')]=_0x343cd3[_0x721b('0x45')]||0x4;this[_0x721b('0x46')]=_0x343cd3[_0x721b('0x46')]?_0x343cd3[_0x721b('0x46')]:undefined;this[_0x721b('0x47')]=_0x343cd3[_0x721b('0x47')]?_0x343cd3[_0x721b('0x47')]:undefined;this[_0x721b('0x48')]=_0x343cd3[_0x721b('0x48')]||undefined;this[_0x721b('0x49')]=_0x343cd3[_0x721b('0x49')]?_0x343cd3[_0x721b('0x49')]:undefined;this[_0x721b('0x4a')]=_0x343cd3[_0x721b('0x4a')]||_0x721b('0x4b');this[_0x721b('0x4c')]=_0x343cd3[_0x721b('0x4c')]||undefined;this[_0x721b('0x4d')]=_0x343cd3[_0x721b('0x4d')]||undefined;this['strategy']=strategy[_0x343cd3[_0x721b('0x4e')]];this[_0x721b('0x4f')]=!![];this[_0x721b('0x50')]=_0x343cd3[_0x721b('0x50')]||![];this[_0x721b('0x51')]=_0x343cd3[_0x721b('0x51')];this[_0x721b('0x52')]=_0x343cd3[_0x721b('0x52')];this[_0x721b('0x53')]=_0x343cd3[_0x721b('0x53')];this[_0x721b('0x54')]=_0x343cd3[_0x721b('0x54')];this[_0x721b('0x55')]=_0x343cd3[_0x721b('0x55')];this[_0x721b('0x56')]=_0x343cd3[_0x721b('0x56')];this[_0x721b('0x57')]=_0x343cd3[_0x721b('0x57')];this[_0x721b('0x58')]=_0x343cd3['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x343cd3[_0x721b('0x59')];this[_0x721b('0x5a')]=0x0;this[_0x721b('0x5b')]=0x0;this[_0x721b('0x5c')]=_0x343cd3[_0x721b('0x5c')];this[_0x721b('0x5d')]=0x0;this[_0x721b('0x5e')]=0x0;this[_0x721b('0x5f')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x721b('0x60')]=0x0;this['outboundNoSuchCallsDay']=0x0;this[_0x721b('0x61')]=0x0;this[_0x721b('0x62')]=0x0;this[_0x721b('0x63')]=0x0;this[_0x721b('0x64')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x721b('0x65')]=0x0;this[_0x721b('0x66')]=0x0;this['startProgressive']=undefined;this[_0x721b('0x67')]=undefined;this[_0x721b('0x68')]=undefined;this[_0x721b('0x69')]=1.05;this[_0x721b('0x6a')]=0x0;this[_0x721b('0x6b')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x721b('0x6c')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this[_0x721b('0x6d')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0x721b('0x6e')]=0x0;this[_0x721b('0x6f')]=_0x343cd3['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x721b('0x70')]=_0x343cd3[_0x721b('0x71')]||0xa;this[_0x721b('0x72')]=0x0;this[_0x721b('0x73')]=0x0;this[_0x721b('0x74')]=0x1;this[_0x721b('0x75')]=0x0;this['erlangCallToSecond']=0x0;this[_0x721b('0x76')]=0x0;this[_0x721b('0x77')]=0x0;this['dialRecallMeTimeout']=_0x343cd3[_0x721b('0x78')]||0x1e;this[_0x721b('0x79')]=_0x343cd3[_0x721b('0x79')]||![];this[_0x721b('0x7a')]=!!_0x343cd3[_0x721b('0x7a')]||![];this[_0x721b('0x7b')]=!!_0x343cd3['dialPreviewRecallmeReminder']||![];this[_0x721b('0x7c')]=_0x343cd3[_0x721b('0x7c')]||undefined;this[_0x721b('0x7d')]=_0x343cd3['dialAgiAfterHangupClient']||![];this[_0x721b('0x7e')]=_0x343cd3[_0x721b('0x7e')]||![];this[_0x721b('0x8')]=monitorFormat[_0x343cd3['monitor_format']]?monitorFormat[_0x343cd3[_0x721b('0x8')]]:undefined;this['mandatoryDisposition']=_0x343cd3[_0x721b('0x7f')]||![];this[_0x721b('0x80')]=_0x343cd3['mandatoryDispositionPause']?_0x343cd3[_0x721b('0x80')]:undefined;this['queueSummaryCountersUpdated']=![];}module[_0x721b('0x81')]=VoiceQueue; \ No newline at end of file +var _0xbacd=['DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','dialRecallMeTimeout','dialRecallInQueue','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','fewestcalls','leastrecent','linear','ringall','roundrobin','rrmemory','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','unmanaged','available','busy','inUse','invalid','loggedIn','notInUse','onHold','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','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','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt'];(function(_0x11a6dc,_0x3537e2){var _0x121c0d=function(_0x3590ed){while(--_0x3590ed){_0x11a6dc['push'](_0x11a6dc['shift']());}};_0x121c0d(++_0x3537e2);}(_0xbacd,0x1c5));var _0xdbac=function(_0xdd84ad,_0x40ccfe){_0xdd84ad=_0xdd84ad-0x0;var _0x4bee4c=_0xbacd[_0xdd84ad];return _0x4bee4c;};'use strict';var monitorFormat={'wav':_0xdbac('0x0'),'wav49':_0xdbac('0x1'),'gsm':'gsm'};var strategy={'fewestcalls':_0xdbac('0x2'),'leastrecent':_0xdbac('0x3'),'linear':_0xdbac('0x4'),'random':'random','ringall':_0xdbac('0x5'),'rr':_0xdbac('0x6'),'rrmemory':_0xdbac('0x7'),'rrordered':_0xdbac('0x8'),'wrandom':_0xdbac('0x9')};function VoiceQueue(_0x376641){this['id']=_0x376641['id']||0x0;this[_0xdbac('0xa')]=_0x376641[_0xdbac('0xa')]||'';this[_0xdbac('0xb')]=_0x376641[_0xdbac('0xb')]||'';this[_0xdbac('0xc')]=_0x376641[_0xdbac('0xc')]||_0xdbac('0xd');this[_0xdbac('0xe')]=0x0;this[_0xdbac('0xf')]=0x0;this['answered']=0x0;this[_0xdbac('0x10')]=0x0;this[_0xdbac('0x11')]=0x0;this['sumBillable']=0x0;this[_0xdbac('0x12')]=0x0;this['abandoned']=0x0;this[_0xdbac('0x13')]=0x0;this[_0xdbac('0x14')]=0x0;this[_0xdbac('0x15')]=0x0;this[_0xdbac('0x16')]=0x0;this[_0xdbac('0x17')]=0x0;this[_0xdbac('0x18')]=0x0;this[_0xdbac('0x19')]=0x0;this[_0xdbac('0x1a')]=0x0;this[_0xdbac('0x1b')]=0x0;this['ringInUse']=0x0;this[_0xdbac('0x1c')]=0x0;this[_0xdbac('0x1d')]=0x0;this[_0xdbac('0x1e')]=0x0;this[_0xdbac('0x1f')]=_0x376641[_0xdbac('0x1f')]||![];this[_0xdbac('0x20')]=_0x376641[_0xdbac('0x20')]||0xa;this[_0xdbac('0x21')]=_0x376641['autopause']||'no';this[_0xdbac('0x22')]=!![];this[_0xdbac('0x23')]='';this[_0xdbac('0x24')]='';this['originated']=0x0;this[_0xdbac('0x25')]=0x0;this[_0xdbac('0x26')]=_0x376641[_0xdbac('0x26')]||null;this[_0xdbac('0x27')]=_0x376641[_0xdbac('0x27')]?_0x376641[_0xdbac('0x27')]:null;this[_0xdbac('0x28')]=_0x376641[_0xdbac('0x28')];this[_0xdbac('0x29')]=_0x376641[_0xdbac('0x29')]||_0xdbac('0x2a');this[_0xdbac('0x2b')]=_0x376641['dialLimitChannel']||0x0;this[_0xdbac('0x2c')]=_0x376641[_0xdbac('0x2c')]||0x0;this['dialPowerLevel']=_0x376641[_0xdbac('0x2d')]||0x1;this['dialPredictiveOptimization']=_0x376641[_0xdbac('0x2e')]||'dropRate';this[_0xdbac('0x2f')]=_0x376641[_0xdbac('0x2f')]||0.03;this[_0xdbac('0x30')]=_0x376641[_0xdbac('0x30')]||0x258;this[_0xdbac('0x31')]=_0x376641[_0xdbac('0x31')]||_0xdbac('0x32');this['dialOriginateCallerIdNumber']=_0x376641[_0xdbac('0x33')]||_0xdbac('0x32');this[_0xdbac('0x34')]=_0x376641[_0xdbac('0x34')]||0x1e;this[_0xdbac('0x35')]=_0x376641[_0xdbac('0x35')]||_0xdbac('0x36');this[_0xdbac('0x37')]=_0x376641[_0xdbac('0x37')]||0x3;this[_0xdbac('0x38')]=_0x376641[_0xdbac('0x38')]||undefined;this[_0xdbac('0x39')]=_0x376641[_0xdbac('0x39')]||0x3;this[_0xdbac('0x3a')]=_0x376641[_0xdbac('0x3a')]||0x96;this[_0xdbac('0x3b')]=_0x376641[_0xdbac('0x3b')]||0x3;this[_0xdbac('0x3c')]=_0x376641[_0xdbac('0x3c')]||0x96;this[_0xdbac('0x3d')]=_0x376641[_0xdbac('0x3d')]||0x3;this['dialNoAnswerRetryFrequency']=_0x376641[_0xdbac('0x3e')]||0x96;this[_0xdbac('0x3f')]=_0x376641[_0xdbac('0x3f')]||0x3;this[_0xdbac('0x40')]=_0x376641['dialNoSuchNumberRetryFrequency']||0x96;this['dialDropMaxRetry']=_0x376641[_0xdbac('0x41')]||0x3;this[_0xdbac('0x42')]=_0x376641[_0xdbac('0x42')]||0x96;this[_0xdbac('0x43')]=_0x376641['dialAbandonedMaxRetry']||0x3;this[_0xdbac('0x44')]=_0x376641[_0xdbac('0x44')]||0x96;this[_0xdbac('0x45')]=_0x376641[_0xdbac('0x45')]||0x3;this[_0xdbac('0x46')]=_0x376641[_0xdbac('0x46')]||0x96;this[_0xdbac('0x47')]=_0x376641[_0xdbac('0x47')]||0x3;this['dialAgentRejectRetryFrequency']=_0x376641['dialAgentRejectRetryFrequency']||0x96;this[_0xdbac('0x48')]=_0x376641[_0xdbac('0x48')]||0x3;this[_0xdbac('0x49')]=_0x376641[_0xdbac('0x49')]||0x4;this['Trunk']=_0x376641['Trunk']?_0x376641[_0xdbac('0x4a')]:undefined;this[_0xdbac('0x4b')]=_0x376641[_0xdbac('0x4b')]?_0x376641[_0xdbac('0x4b')]:undefined;this[_0xdbac('0x4c')]=_0x376641[_0xdbac('0x4c')]||undefined;this[_0xdbac('0x4d')]=_0x376641[_0xdbac('0x4d')]?_0x376641[_0xdbac('0x4d')]:undefined;this[_0xdbac('0x4e')]=_0x376641[_0xdbac('0x4e')]||_0xdbac('0x4f');this[_0xdbac('0x50')]=_0x376641['dialRandomLastDigitCallerIdNumber']||undefined;this[_0xdbac('0x51')]=_0x376641['dialCutDigit']||undefined;this[_0xdbac('0x52')]=strategy[_0x376641[_0xdbac('0x52')]];this[_0xdbac('0x53')]=!![];this[_0xdbac('0x54')]=_0x376641['dialAMDActive']||![];this[_0xdbac('0x55')]=_0x376641[_0xdbac('0x55')];this['dialAMDGreeting']=_0x376641['dialAMDGreeting'];this[_0xdbac('0x56')]=_0x376641['dialAMDAfterGreetingSilence'];this['dialAMDTotalAnalysisTime']=_0x376641[_0xdbac('0x57')];this[_0xdbac('0x58')]=_0x376641[_0xdbac('0x58')];this['dialAMDBetweenWordsSilence']=_0x376641[_0xdbac('0x59')];this[_0xdbac('0x5a')]=_0x376641[_0xdbac('0x5a')];this[_0xdbac('0x5b')]=_0x376641['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0x376641[_0xdbac('0x5c')];this[_0xdbac('0x5d')]=0x0;this[_0xdbac('0x5e')]=0x0;this[_0xdbac('0x5f')]=_0x376641[_0xdbac('0x5f')];this['outboundAnswerCallsDay']=0x0;this[_0xdbac('0x60')]=0x0;this[_0xdbac('0x61')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0xdbac('0x62')]=0x0;this[_0xdbac('0x63')]=0x0;this[_0xdbac('0x64')]=0x0;this[_0xdbac('0x65')]=0x0;this[_0xdbac('0x66')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xdbac('0x67')]=0x0;this[_0xdbac('0x68')]=0x0;this[_0xdbac('0x69')]=0x0;this[_0xdbac('0x6a')]=0x0;this[_0xdbac('0x6b')]=undefined;this[_0xdbac('0x6c')]=undefined;this[_0xdbac('0x6d')]=undefined;this[_0xdbac('0x6e')]=1.05;this[_0xdbac('0x6f')]=0x0;this[_0xdbac('0x70')]=0x0;this[_0xdbac('0x71')]=0x0;this[_0xdbac('0x72')]=0x0;this['predictiveIntervalAvgHoldtime']=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this['predictiveIntervalAvailable']=0x0;this[_0xdbac('0x73')]=_0x376641[_0xdbac('0x74')]||0x14;this[_0xdbac('0x75')]=_0x376641[_0xdbac('0x74')]||0xa;this[_0xdbac('0x76')]=0x0;this[_0xdbac('0x77')]=0x0;this[_0xdbac('0x78')]=0x1;this[_0xdbac('0x79')]=0x0;this[_0xdbac('0x7a')]=0x0;this['erlangAbandonmentRate']=0x0;this['erlangBusyFactor']=0x0;this['dialRecallMeTimeout']=_0x376641[_0xdbac('0x7b')]||0x1e;this[_0xdbac('0x7c')]=_0x376641['dialRecallInQueue']||![];this['dialPreviewAutoRecallMe']=!!_0x376641['dialPreviewAutoRecallMe']||![];this[_0xdbac('0x7d')]=!!_0x376641[_0xdbac('0x7d')]||![];this[_0xdbac('0x7e')]=_0x376641['dialQueueProject2']||undefined;this[_0xdbac('0x7f')]=_0x376641[_0xdbac('0x7f')]||![];this[_0xdbac('0x80')]=_0x376641[_0xdbac('0x80')]||![];this[_0xdbac('0xb')]=monitorFormat[_0x376641['monitor_format']]?monitorFormat[_0x376641[_0xdbac('0xb')]]:undefined;this[_0xdbac('0x81')]=_0x376641[_0xdbac('0x81')]||![];this[_0xdbac('0x82')]=_0x376641['mandatoryDispositionPause']?_0x376641[_0xdbac('0x82')]:undefined;this[_0xdbac('0x83')]=![];}module[_0xdbac('0x84')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index acb1e05..80737dd 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 _0x029b=['status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','preview','exports','available','loggedIn','paused','ringing','waiting','loggedInDb','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','talking','sumDuration','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','ringInUse','sumBillable','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','notInUse','loggedin','callers','length','SIP/','includes'];(function(_0x3b541e,_0x14a851){var _0x1b54ae=function(_0x408dd9){while(--_0x408dd9){_0x3b541e['push'](_0x3b541e['shift']());}};_0x1b54ae(++_0x14a851);}(_0x029b,0x66));var _0xb029=function(_0x3b9143,_0x527f5b){_0x3b9143=_0x3b9143-0x0;var _0x2189a8=_0x029b[_0x3b9143];return _0x2189a8;};'use strict';var INBOUND_COUNTERS=[_0xb029('0x0'),_0xb029('0x1'),'loggedInDb',_0xb029('0x2'),_0xb029('0x3'),'talking',_0xb029('0x4')];var OUTBOUND_COUNTERS=[_0xb029('0x0'),'answered','inUse',_0xb029('0x1'),_0xb029('0x5'),_0xb029('0x6'),_0xb029('0x7'),_0xb029('0x8'),'outboundBlacklistCallsDay',_0xb029('0x9'),'outboundCongestionCallsDay',_0xb029('0xa'),'outboundNoSuchCallsDay',_0xb029('0xb'),'outboundRejectCallsDay',_0xb029('0xc'),'paused',_0xb029('0xd'),_0xb029('0xe'),'sumBillable',_0xb029('0xf'),_0xb029('0x10'),_0xb029('0x4')];function VoiceQueueSummary(_0x3abf90){this['id']=_0x3abf90['id'];this[_0xb029('0x11')]=_0x3abf90['name'];this[_0xb029('0x12')]=_0x3abf90['strategy'];this[_0xb029('0x13')]=_0x3abf90[_0xb029('0x13')]||0x0;this[_0xb029('0x14')]=_0x3abf90[_0xb029('0x14')]||0x0;this['available']=_0x3abf90[_0xb029('0x0')]||0x0;this[_0xb029('0x15')]=_0x3abf90[_0xb029('0x15')]||0x0;this['inUse']=_0x3abf90[_0xb029('0x16')]||0x0;this[_0xb029('0x17')]=_0x3abf90[_0xb029('0x17')]||0x0;this[_0xb029('0x1')]=_0x3abf90[_0xb029('0x1')]||0x0;this[_0xb029('0x5')]=_0x3abf90[_0xb029('0x5')]||0x0;this[_0xb029('0x18')]=_0x3abf90[_0xb029('0x18')]||0x0;this['notInUse']=_0x3abf90['notInUse']||0x0;this[_0xb029('0x2')]=_0x3abf90['paused']||0x0;this[_0xb029('0x3')]=_0x3abf90[_0xb029('0x3')]||0x0;this[_0xb029('0x19')]=_0x3abf90['ringInUse'];this['sumBillable']=_0x3abf90[_0xb029('0x1a')];this[_0xb029('0xf')]=_0x3abf90[_0xb029('0xf')];this[_0xb029('0x1b')]=_0x3abf90[_0xb029('0x1b')]||0x0;this[_0xb029('0xe')]=_0x3abf90['talking']||0x0;this['total']=_0x3abf90['total']||0x0;this['type']=_0x3abf90[_0xb029('0x1c')];this[_0xb029('0x1d')]=_0x3abf90[_0xb029('0x1d')]||0x0;this[_0xb029('0x1e')]=_0x3abf90['unknown']||0x0;this[_0xb029('0x1f')]=_0x3abf90[_0xb029('0x1f')]||0x0;this[_0xb029('0x4')]=_0x3abf90[_0xb029('0x4')]||0x0;if(_0x3abf90[_0xb029('0x1c')]===_0xb029('0x20')){this[_0xb029('0xd')]=_0x3abf90[_0xb029('0xd')]||0x0;this[_0xb029('0x21')]=_0x3abf90[_0xb029('0x21')];this[_0xb029('0x22')]=_0x3abf90[_0xb029('0x22')];this[_0xb029('0x23')]=_0x3abf90['dialOriginateCallerIdName'];this[_0xb029('0x24')]=_0x3abf90[_0xb029('0x24')];this['dialOriginateTimeout']=_0x3abf90['dialOriginateTimeout'];this[_0xb029('0x25')]=_0x3abf90[_0xb029('0x25')];this[_0xb029('0x26')]=_0x3abf90[_0xb029('0x26')];this[_0xb029('0x27')]=_0x3abf90['outboundAnswerAgiCallsDay'];this[_0xb029('0x8')]=_0x3abf90['outboundAnswerCallsDay'];this[_0xb029('0x28')]=_0x3abf90[_0xb029('0x28')];this[_0xb029('0x9')]=_0x3abf90['outboundBusyCallsDay'];this[_0xb029('0x29')]=_0x3abf90[_0xb029('0x29')];this['outboundDropCallsDayACS']=_0x3abf90[_0xb029('0x2a')];this['outboundDropCallsDayCallersExit']=_0x3abf90[_0xb029('0x2b')];this['outboundDropCallsDayTimeout']=_0x3abf90[_0xb029('0x2c')];this[_0xb029('0xa')]=_0x3abf90[_0xb029('0xa')];this[_0xb029('0x2d')]=_0x3abf90[_0xb029('0x2d')];this[_0xb029('0x2e')]=_0x3abf90[_0xb029('0x2e')];this[_0xb029('0xb')]=_0x3abf90['outboundReCallsDay'];this[_0xb029('0x2f')]=_0x3abf90[_0xb029('0x2f')];this[_0xb029('0xc')]=_0x3abf90['outboundUnknownCallsDay'];this[_0xb029('0x30')]=_0x3abf90[_0xb029('0x30')];this['predictiveIntervalAvgHoldtime']=_0x3abf90[_0xb029('0x31')];this['predictiveIntervalAvgTalktime']=_0x3abf90[_0xb029('0x32')];this['predictiveIntervalDroppedCallsCallersExit']=_0x3abf90[_0xb029('0x33')];this[_0xb029('0x34')]=_0x3abf90[_0xb029('0x34')];this[_0xb029('0x35')]=_0x3abf90[_0xb029('0x35')];this[_0xb029('0x36')]=_0x3abf90[_0xb029('0x36')];this['predictiveIntervalHitRate']=_0x3abf90[_0xb029('0x37')];this[_0xb029('0x38')]=_0x3abf90['predictiveIntervalMultiplicativeFactor'];this[_0xb029('0x39')]=_0x3abf90[_0xb029('0x39')];this[_0xb029('0x3a')]=_0x3abf90[_0xb029('0x3a')];this['predictiveIntervalTotalCalls']=_0x3abf90[_0xb029('0x3b')];this[_0xb029('0x6')]=_0x3abf90[_0xb029('0x6')];this['erlangCalls']=_0x3abf90[_0xb029('0x3c')];this[_0xb029('0x3d')]=_0x3abf90[_0xb029('0x3d')];this[_0xb029('0x3e')]=_0x3abf90[_0xb029('0x3e')];this[_0xb029('0x3f')]=_0x3abf90[_0xb029('0x3f')];this[_0xb029('0x40')]=_0x3abf90[_0xb029('0x40')];this[_0xb029('0x41')]=_0x3abf90['startProgressive'];this[_0xb029('0x42')]=_0x3abf90[_0xb029('0x42')];this[_0xb029('0x43')]=_0x3abf90['statusMessage'];}if(_0x3abf90['Trunk']){this['Trunk']={'id':_0x3abf90[_0xb029('0x44')]['id'],'name':_0x3abf90[_0xb029('0x44')]['name'],'active':_0x3abf90[_0xb029('0x44')][_0xb029('0x45')],'callerid':_0x3abf90[_0xb029('0x44')][_0xb029('0x46')]};}}VoiceQueueSummary[_0xb029('0x47')]['createReport']=function(_0x2f5599,_0x935a15,_0x584b8a,_0x2edce2){this[_0xb029('0x5')]=0x0;this[_0xb029('0xe')]=0x0;this['paused']=0x0;this[_0xb029('0x1e')]=0x0;this[_0xb029('0x48')]=0x0;this['inUse']=0x0;this['busy']=0x0;this[_0xb029('0x17')]=0x0;this[_0xb029('0x1d')]=0x0;this[_0xb029('0x3')]=0x0;this[_0xb029('0x19')]=0x0;this['onHold']=0x0;if(_0x584b8a){if(_0x584b8a['available']){this[_0xb029('0x0')]=Number(_0x584b8a['available']);}if(_0x584b8a[_0xb029('0x49')]){this['loggedIn']=Number(_0x584b8a[_0xb029('0x49')]);}if(_0x584b8a[_0xb029('0x4a')]){this[_0xb029('0x4')]=Number(_0x584b8a[_0xb029('0x4a')]);}}for(var _0x45a7d5=0x0;_0x45a7d5<_0x2f5599[_0xb029('0x4b')];_0x45a7d5++){var _0x5f294b=_0x935a15[_0xb029('0x4c')+_0x2f5599[_0x45a7d5]['name']];if(_0x5f294b&&_0x5f294b['online']){this[_0xb029('0x5')]+=0x1;}if(_0x2f5599[_0x45a7d5]['incall']==='1'){this[_0xb029('0xe')]+=0x1;}if(_0x2f5599[_0x45a7d5]['paused']==='1'&&!['2','7','8'][_0xb029('0x4d')](_0x2f5599[_0x45a7d5][_0xb029('0x4e')])){this[_0xb029('0x2')]+=0x1;}switch(_0x2f5599[_0x45a7d5][_0xb029('0x4e')]){case'0':this['unknown']+=0x1;break;case'1':this[_0xb029('0x48')]+=0x1;break;case'2':this[_0xb029('0x16')]+=0x1;break;case'3':this[_0xb029('0x15')]+=0x1;break;case'4':this[_0xb029('0x17')]+=0x1;break;case'5':this[_0xb029('0x1d')]+=0x1;break;case'6':this[_0xb029('0x3')]+=0x1;break;case'7':this[_0xb029('0x19')]+=0x1;break;case'8':this[_0xb029('0x18')]+=0x1;break;}}if(this[_0xb029('0x22')]===_0xb029('0x4f')){var _0x593dd9=Object[_0xb029('0x50')](_0x2edce2);for(var _0x2345cd=0x0;_0x2345cd<_0x593dd9[_0xb029('0x4b')];_0x2345cd++){var _0x3172a2=_0x593dd9[_0x2345cd];var _0x4845ab=_0x2edce2[_0x3172a2];if(_0x4845ab[_0xb029('0x51')]===this['name']&&_0x4845ab[_0xb029('0x1c')]===_0xb029('0x52')&&_0x4845ab[_0xb029('0x53')]===_0xb029('0x54')){this[_0xb029('0xe')]+=0x1;}}if(this['talking']>this['inUse']){this[_0xb029('0xe')]=this[_0xb029('0x16')];}this[_0xb029('0xd')]=0x0;}return this;};VoiceQueueSummary[_0xb029('0x47')][_0xb029('0x55')]=function(_0x32cceb){var _0x505538=![];if(_0x32cceb){_0x505538=INBOUND_COUNTERS[_0xb029('0x56')](function(_0x1b584d){return this[_0x1b584d]!==_0x32cceb[_0x1b584d];},this);}return _0x505538;};VoiceQueueSummary[_0xb029('0x47')]['compareToOutboundQueue']=function(_0x5a0178){var _0x10b4f7=![];var _0x538722=![];var _0x36ee76=![];if(_0x5a0178){_0x10b4f7=this[_0xb029('0x22')]!==_0x5a0178[_0xb029('0x22')]||this['dialActive']!==_0x5a0178[_0xb029('0x21')]||this[_0xb029('0x42')]!==_0x5a0178['message']||this[_0xb029('0x43')]!==_0x5a0178[_0xb029('0x43')];_0x538722=OUTBOUND_COUNTERS[_0xb029('0x56')](function(_0x50fa99){return this[_0x50fa99]!==_0x5a0178[_0x50fa99];},this);if(this[_0xb029('0x44')]&&_0x5a0178[_0xb029('0x44')]){_0x36ee76=this[_0xb029('0x44')][_0xb029('0x11')]!==_0x5a0178['Trunk'][_0xb029('0x11')]||this[_0xb029('0x44')][_0xb029('0x45')]!==_0x5a0178['Trunk'][_0xb029('0x45')];}}return _0x10b4f7||_0x538722||_0x36ee76;};VoiceQueueSummary['prototype'][_0xb029('0x57')]=function(_0x391d1a){this[_0xb029('0x14')]=_0x391d1a[_0xb029('0x14')];this[_0xb029('0x42')]=_0x391d1a[_0xb029('0x42')];this[_0xb029('0x43')]=_0x391d1a['statusMessage'];this['originated']=_0x391d1a['originated'];this[_0xb029('0x7')]=_0x391d1a[_0xb029('0x7')];this[_0xb029('0x8')]=_0x391d1a[_0xb029('0x8')];this[_0xb029('0x28')]=_0x391d1a['outboundBlacklistCallsDay'];this[_0xb029('0x9')]=_0x391d1a[_0xb029('0x9')];this[_0xb029('0x29')]=_0x391d1a[_0xb029('0x29')];this['outboundNoAnswerCallsDay']=_0x391d1a[_0xb029('0xa')];this[_0xb029('0x2d')]=_0x391d1a[_0xb029('0x2d')];this[_0xb029('0xb')]=_0x391d1a[_0xb029('0xb')];this[_0xb029('0x2f')]=_0x391d1a[_0xb029('0x2f')];this[_0xb029('0xc')]=_0x391d1a['outboundUnknownCallsDay'];this[_0xb029('0x1a')]=_0x391d1a[_0xb029('0x1a')];this['sumDuration']=_0x391d1a[_0xb029('0xf')];this[_0xb029('0x10')]=_0x391d1a[_0xb029('0x10')];if(this[_0xb029('0x22')]===_0xb029('0x58')){this[_0xb029('0xd')]=_0x391d1a[_0xb029('0xd')];}};module[_0xb029('0x59')]=VoiceQueueSummary; \ No newline at end of file +var _0x61b8=['createReport','unknown','loggedin','callers','SIP/','online','incall','status','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','updateReportFromOutboundQueue','sumBillable','preview','exports','available','loggedIn','loggedInDb','ringing','answered','inUse','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','paused','pTalking','talking','sumDuration','waiting','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','unavailable','unmanaged','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype'];(function(_0x1cb100,_0x5f43bd){var _0x2435d2=function(_0x30d8a1){while(--_0x30d8a1){_0x1cb100['push'](_0x1cb100['shift']());}};_0x2435d2(++_0x5f43bd);}(_0x61b8,0x169));var _0x861b=function(_0x4e92fb,_0x1eb643){_0x4e92fb=_0x4e92fb-0x0;var _0x4c75f1=_0x61b8[_0x4e92fb];return _0x4c75f1;};'use strict';var INBOUND_COUNTERS=[_0x861b('0x0'),_0x861b('0x1'),_0x861b('0x2'),'paused',_0x861b('0x3'),'talking','waiting'];var OUTBOUND_COUNTERS=[_0x861b('0x0'),_0x861b('0x4'),_0x861b('0x5'),'loggedIn',_0x861b('0x2'),_0x861b('0x6'),_0x861b('0x7'),_0x861b('0x8'),_0x861b('0x9'),_0x861b('0xa'),_0x861b('0xb'),_0x861b('0xc'),_0x861b('0xd'),_0x861b('0xe'),_0x861b('0xf'),'outboundUnknownCallsDay',_0x861b('0x10'),_0x861b('0x11'),_0x861b('0x12'),'sumBillable',_0x861b('0x13'),'total',_0x861b('0x14')];function VoiceQueueSummary(_0xd7656){this['id']=_0xd7656['id'];this['name']=_0xd7656[_0x861b('0x15')];this[_0x861b('0x16')]=_0xd7656[_0x861b('0x16')];this[_0x861b('0x17')]=_0xd7656[_0x861b('0x17')]||0x0;this[_0x861b('0x4')]=_0xd7656[_0x861b('0x4')]||0x0;this[_0x861b('0x0')]=_0xd7656[_0x861b('0x0')]||0x0;this[_0x861b('0x18')]=_0xd7656[_0x861b('0x18')]||0x0;this[_0x861b('0x5')]=_0xd7656[_0x861b('0x5')]||0x0;this[_0x861b('0x19')]=_0xd7656[_0x861b('0x19')]||0x0;this[_0x861b('0x1')]=_0xd7656['loggedIn']||0x0;this[_0x861b('0x2')]=_0xd7656['loggedInDb']||0x0;this['onHold']=_0xd7656[_0x861b('0x1a')]||0x0;this['notInUse']=_0xd7656[_0x861b('0x1b')]||0x0;this[_0x861b('0x10')]=_0xd7656['paused']||0x0;this[_0x861b('0x3')]=_0xd7656[_0x861b('0x3')]||0x0;this[_0x861b('0x1c')]=_0xd7656[_0x861b('0x1c')];this['sumBillable']=_0xd7656['sumBillable'];this[_0x861b('0x13')]=_0xd7656[_0x861b('0x13')];this[_0x861b('0x1d')]=_0xd7656['sumHoldTime']||0x0;this[_0x861b('0x12')]=_0xd7656['talking']||0x0;this[_0x861b('0x1e')]=_0xd7656[_0x861b('0x1e')]||0x0;this['type']=_0xd7656['type'];this[_0x861b('0x1f')]=_0xd7656[_0x861b('0x1f')]||0x0;this['unknown']=_0xd7656['unknown']||0x0;this[_0x861b('0x20')]=_0xd7656['unmanaged']||0x0;this['waiting']=_0xd7656[_0x861b('0x14')]||0x0;if(_0xd7656['type']==='outbound'){this[_0x861b('0x11')]=_0xd7656[_0x861b('0x11')]||0x0;this[_0x861b('0x21')]=_0xd7656[_0x861b('0x21')];this[_0x861b('0x22')]=_0xd7656[_0x861b('0x22')];this['dialOriginateCallerIdName']=_0xd7656[_0x861b('0x23')];this[_0x861b('0x24')]=_0xd7656[_0x861b('0x24')];this[_0x861b('0x25')]=_0xd7656[_0x861b('0x25')];this[_0x861b('0x26')]=_0xd7656['dialPrefix'];this['temp']=_0xd7656[_0x861b('0x27')];this[_0x861b('0x28')]=_0xd7656[_0x861b('0x28')];this[_0x861b('0x8')]=_0xd7656[_0x861b('0x8')];this[_0x861b('0x9')]=_0xd7656['outboundBlacklistCallsDay'];this['outboundBusyCallsDay']=_0xd7656[_0x861b('0xa')];this['outboundCongestionCallsDay']=_0xd7656[_0x861b('0xb')];this[_0x861b('0x29')]=_0xd7656[_0x861b('0x29')];this[_0x861b('0x2a')]=_0xd7656[_0x861b('0x2a')];this[_0x861b('0x2b')]=_0xd7656[_0x861b('0x2b')];this[_0x861b('0xc')]=_0xd7656['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0xd7656[_0x861b('0xd')];this['outboundOriginateFailureCallsDay']=_0xd7656[_0x861b('0x2c')];this[_0x861b('0xe')]=_0xd7656['outboundReCallsDay'];this[_0x861b('0xf')]=_0xd7656['outboundRejectCallsDay'];this['outboundUnknownCallsDay']=_0xd7656[_0x861b('0x2d')];this[_0x861b('0x2e')]=_0xd7656['predictiveIntervalAnsweredCalls'];this[_0x861b('0x2f')]=_0xd7656[_0x861b('0x2f')];this['predictiveIntervalAvgTalktime']=_0xd7656[_0x861b('0x30')];this[_0x861b('0x31')]=_0xd7656['predictiveIntervalDroppedCallsCallersExit'];this[_0x861b('0x32')]=_0xd7656[_0x861b('0x32')];this[_0x861b('0x33')]=_0xd7656[_0x861b('0x33')];this[_0x861b('0x34')]=_0xd7656[_0x861b('0x34')];this['predictiveIntervalHitRate']=_0xd7656[_0x861b('0x35')];this[_0x861b('0x36')]=_0xd7656[_0x861b('0x36')];this[_0x861b('0x37')]=_0xd7656[_0x861b('0x37')];this['predictiveIntervalAvailable']=_0xd7656['predictiveIntervalAvailable'];this[_0x861b('0x38')]=_0xd7656[_0x861b('0x38')];this['originated']=_0xd7656['originated'];this[_0x861b('0x39')]=_0xd7656[_0x861b('0x39')];this[_0x861b('0x3a')]=_0xd7656[_0x861b('0x3a')];this[_0x861b('0x3b')]=_0xd7656[_0x861b('0x3b')];this['erlangBusyFactor']=_0xd7656[_0x861b('0x3c')];this[_0x861b('0x3d')]=_0xd7656[_0x861b('0x3d')];this[_0x861b('0x3e')]=_0xd7656[_0x861b('0x3e')];this[_0x861b('0x3f')]=_0xd7656['message'];this[_0x861b('0x40')]=_0xd7656['statusMessage'];}if(_0xd7656[_0x861b('0x41')]){this['Trunk']={'id':_0xd7656[_0x861b('0x41')]['id'],'name':_0xd7656[_0x861b('0x41')][_0x861b('0x15')],'active':_0xd7656[_0x861b('0x41')][_0x861b('0x42')],'callerid':_0xd7656['Trunk'][_0x861b('0x43')]};}}VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x45')]=function(_0xadca6f,_0x5c9bfa,_0x23ae99,_0x281ddb){this['loggedInDb']=0x0;this[_0x861b('0x12')]=0x0;this[_0x861b('0x10')]=0x0;this[_0x861b('0x46')]=0x0;this['notInUse']=0x0;this[_0x861b('0x5')]=0x0;this[_0x861b('0x18')]=0x0;this['invalid']=0x0;this[_0x861b('0x1f')]=0x0;this[_0x861b('0x3')]=0x0;this['ringInUse']=0x0;this[_0x861b('0x1a')]=0x0;if(_0x23ae99){if(_0x23ae99[_0x861b('0x0')]){this['available']=Number(_0x23ae99[_0x861b('0x0')]);}if(_0x23ae99[_0x861b('0x47')]){this[_0x861b('0x1')]=Number(_0x23ae99[_0x861b('0x47')]);}if(_0x23ae99[_0x861b('0x48')]){this[_0x861b('0x14')]=Number(_0x23ae99['callers']);}}for(var _0x8f3581=0x0;_0x8f3581<_0xadca6f['length'];_0x8f3581++){var _0x2b4bdc=_0x5c9bfa[_0x861b('0x49')+_0xadca6f[_0x8f3581]['name']];if(_0x2b4bdc&&_0x2b4bdc[_0x861b('0x4a')]){this[_0x861b('0x2')]+=0x1;}if(_0xadca6f[_0x8f3581][_0x861b('0x4b')]==='1'){this[_0x861b('0x12')]+=0x1;}if(_0xadca6f[_0x8f3581][_0x861b('0x10')]==='1'&&!['2','7','8']['includes'](_0xadca6f[_0x8f3581][_0x861b('0x4c')])){this[_0x861b('0x10')]+=0x1;}switch(_0xadca6f[_0x8f3581]['status']){case'0':this[_0x861b('0x46')]+=0x1;break;case'1':this[_0x861b('0x1b')]+=0x1;break;case'2':this[_0x861b('0x5')]+=0x1;break;case'3':this[_0x861b('0x18')]+=0x1;break;case'4':this[_0x861b('0x19')]+=0x1;break;case'5':this[_0x861b('0x1f')]+=0x1;break;case'6':this[_0x861b('0x3')]+=0x1;break;case'7':this[_0x861b('0x1c')]+=0x1;break;case'8':this[_0x861b('0x1a')]+=0x1;break;}}if(this[_0x861b('0x22')]==='booked'){var _0x3415d4=Object['keys'](_0x281ddb);for(var _0x1074f1=0x0;_0x1074f1<_0x3415d4['length'];_0x1074f1++){var _0x3865a7=_0x3415d4[_0x1074f1];var _0x166eee=_0x281ddb[_0x3865a7];if(_0x166eee['queue']===this[_0x861b('0x15')]&&_0x166eee['type']===_0x861b('0x4d')&&_0x166eee[_0x861b('0x4e')]===_0x861b('0x4f')){this['talking']+=0x1;}}if(this[_0x861b('0x12')]>this[_0x861b('0x5')]){this[_0x861b('0x12')]=this[_0x861b('0x5')];}this[_0x861b('0x11')]=0x0;}return this;};VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x50')]=function(_0xedf4c5){var _0x4e5147=![];if(_0xedf4c5){_0x4e5147=INBOUND_COUNTERS[_0x861b('0x51')](function(_0x4380db){return this[_0x4380db]!==_0xedf4c5[_0x4380db];},this);}return _0x4e5147;};VoiceQueueSummary[_0x861b('0x44')]['compareToOutboundQueue']=function(_0x2fdb54){var _0x9d4fef=![];var _0x4b0e1e=![];var _0x2aac41=![];if(_0x2fdb54){_0x9d4fef=this['dialMethod']!==_0x2fdb54[_0x861b('0x22')]||this[_0x861b('0x21')]!==_0x2fdb54[_0x861b('0x21')]||this[_0x861b('0x3f')]!==_0x2fdb54['message']||this[_0x861b('0x40')]!==_0x2fdb54[_0x861b('0x40')];_0x4b0e1e=OUTBOUND_COUNTERS['some'](function(_0x3fc0a7){return this[_0x3fc0a7]!==_0x2fdb54[_0x3fc0a7];},this);if(this[_0x861b('0x41')]&&_0x2fdb54['Trunk']){_0x2aac41=this[_0x861b('0x41')][_0x861b('0x15')]!==_0x2fdb54[_0x861b('0x41')][_0x861b('0x15')]||this[_0x861b('0x41')][_0x861b('0x42')]!==_0x2fdb54[_0x861b('0x41')][_0x861b('0x42')];}}return _0x9d4fef||_0x4b0e1e||_0x2aac41;};VoiceQueueSummary[_0x861b('0x44')][_0x861b('0x52')]=function(_0x4e0e32){this[_0x861b('0x4')]=_0x4e0e32[_0x861b('0x4')];this[_0x861b('0x3f')]=_0x4e0e32[_0x861b('0x3f')];this[_0x861b('0x40')]=_0x4e0e32['statusMessage'];this[_0x861b('0x6')]=_0x4e0e32[_0x861b('0x6')];this[_0x861b('0x7')]=_0x4e0e32['outboundAbandonedCallsDay'];this[_0x861b('0x8')]=_0x4e0e32['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x4e0e32[_0x861b('0x9')];this[_0x861b('0xa')]=_0x4e0e32['outboundBusyCallsDay'];this[_0x861b('0xb')]=_0x4e0e32[_0x861b('0xb')];this[_0x861b('0xc')]=_0x4e0e32[_0x861b('0xc')];this[_0x861b('0xd')]=_0x4e0e32[_0x861b('0xd')];this[_0x861b('0xe')]=_0x4e0e32[_0x861b('0xe')];this[_0x861b('0xf')]=_0x4e0e32[_0x861b('0xf')];this[_0x861b('0x2d')]=_0x4e0e32[_0x861b('0x2d')];this[_0x861b('0x53')]=_0x4e0e32['sumBillable'];this['sumDuration']=_0x4e0e32[_0x861b('0x13')];this[_0x861b('0x1e')]=_0x4e0e32[_0x861b('0x1e')];if(this[_0x861b('0x22')]===_0x861b('0x54')){this[_0x861b('0x11')]=_0x4e0e32[_0x861b('0x11')];}};module[_0x861b('0x55')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 5a52d26..d8e8f3d 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 _0x0dee=['Configurations','name','username','accessKey','remoteUri','serverUrl'];(function(_0x5f2913,_0x208c1f){var _0x5f0071=function(_0x4a8103){while(--_0x4a8103){_0x5f2913['push'](_0x5f2913['shift']());}};_0x5f0071(++_0x208c1f);}(_0x0dee,0xf7));var _0xe0de=function(_0x2d219d,_0x12e626){_0x2d219d=_0x2d219d-0x0;var _0x3a6f07=_0x0dee[_0x2d219d];return _0x3a6f07;};'use strict';function VtigerAccount(_0x2d297c){this['id']=_0x2d297c['id']||0x0;this[_0xe0de('0x0')]=_0x2d297c['name']||'';this[_0xe0de('0x1')]=_0x2d297c['username']||'';this[_0xe0de('0x2')]=_0x2d297c[_0xe0de('0x2')]||'';this['remoteUri']=_0x2d297c[_0xe0de('0x3')]||'';this[_0xe0de('0x4')]=_0x2d297c[_0xe0de('0x4')]||'';this['Configurations']=_0x2d297c[_0xe0de('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file +var _0x91ac=['serverUrl','exports','name','username','accessKey','remoteUri'];(function(_0x175a55,_0x4082fd){var _0x167adf=function(_0x18ef07){while(--_0x18ef07){_0x175a55['push'](_0x175a55['shift']());}};_0x167adf(++_0x4082fd);}(_0x91ac,0x17c));var _0xc91a=function(_0x4bbccf,_0x43982f){_0x4bbccf=_0x4bbccf-0x0;var _0x453807=_0x91ac[_0x4bbccf];return _0x453807;};'use strict';function VtigerAccount(_0x3c94eb){this['id']=_0x3c94eb['id']||0x0;this[_0xc91a('0x0')]=_0x3c94eb[_0xc91a('0x0')]||'';this[_0xc91a('0x1')]=_0x3c94eb[_0xc91a('0x1')]||'';this[_0xc91a('0x2')]=_0x3c94eb[_0xc91a('0x2')]||'';this[_0xc91a('0x3')]=_0x3c94eb[_0xc91a('0x3')]||'';this[_0xc91a('0x4')]=_0x3c94eb['serverUrl']||'';this['Configurations']=_0x3c94eb['Configurations']||{};}module[_0xc91a('0x5')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 196cdcc..b9ac6b8 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 _0xfeae=['password','remoteUri','authType','type','serverUrl','Configurations','name','username'];(function(_0x2e5d2f,_0x5c6b91){var _0x2d20c0=function(_0x4ca478){while(--_0x4ca478){_0x2e5d2f['push'](_0x2e5d2f['shift']());}};_0x2d20c0(++_0x5c6b91);}(_0xfeae,0x11e));var _0xefea=function(_0x3808dc,_0x40ac14){_0x3808dc=_0x3808dc-0x0;var _0x51ef36=_0xfeae[_0x3808dc];return _0x51ef36;};'use strict';function ZendeskAccount(_0x932be5){this['id']=_0x932be5['id']||0x0;this['name']=_0x932be5[_0xefea('0x0')]||'';this[_0xefea('0x1')]=_0x932be5['username']||'';this['password']=_0x932be5[_0xefea('0x2')]||'';this['token']=_0x932be5['token']||'';this[_0xefea('0x3')]=_0x932be5[_0xefea('0x3')]||'';this['authType']=_0x932be5[_0xefea('0x4')]||'';this[_0xefea('0x5')]=_0x932be5[_0xefea('0x5')]||'integrationTab';this[_0xefea('0x6')]=_0x932be5[_0xefea('0x6')]||'';this[_0xefea('0x7')]=_0x932be5[_0xefea('0x7')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file +var _0xf24a=['token','remoteUri','authType','type','integrationTab','Configurations','exports','name','username','password'];(function(_0x31611f,_0x1e6d20){var _0x3185e6=function(_0x4d8ec1){while(--_0x4d8ec1){_0x31611f['push'](_0x31611f['shift']());}};_0x3185e6(++_0x1e6d20);}(_0xf24a,0x18d));var _0xaf24=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf24a[_0x321bb2];return _0x9c12ed;};'use strict';function ZendeskAccount(_0x257cfd){this['id']=_0x257cfd['id']||0x0;this[_0xaf24('0x0')]=_0x257cfd['name']||'';this[_0xaf24('0x1')]=_0x257cfd['username']||'';this[_0xaf24('0x2')]=_0x257cfd[_0xaf24('0x2')]||'';this['token']=_0x257cfd[_0xaf24('0x3')]||'';this['remoteUri']=_0x257cfd[_0xaf24('0x4')]||'';this[_0xaf24('0x5')]=_0x257cfd[_0xaf24('0x5')]||'';this['type']=_0x257cfd[_0xaf24('0x6')]||_0xaf24('0x7');this['serverUrl']=_0x257cfd['serverUrl']||'';this[_0xaf24('0x8')]=_0x257cfd[_0xaf24('0x8')]||{};}module[_0xaf24('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 3b45788..eae4f97 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 _0xd66e=['clientId','serverUrl','code','refreshToken','Configurations','exports','name','host','zone'];(function(_0x313bac,_0xd06cca){var _0x225fa7=function(_0x536ca8){while(--_0x536ca8){_0x313bac['push'](_0x313bac['shift']());}};_0x225fa7(++_0xd06cca);}(_0xd66e,0x192));var _0xed66=function(_0x3a1953,_0x440442){_0x3a1953=_0x3a1953-0x0;var _0x51c757=_0xd66e[_0x3a1953];return _0x51c757;};'use strict';function ZohoAccount(_0x5aa6ef){this['id']=_0x5aa6ef['id']||0x0;this[_0xed66('0x0')]=_0x5aa6ef[_0xed66('0x0')]||'';this['description']=_0x5aa6ef['description']||'';this[_0xed66('0x1')]=_0x5aa6ef[_0xed66('0x1')]||'';this[_0xed66('0x2')]=_0x5aa6ef['zone']||'';this[_0xed66('0x3')]=_0x5aa6ef[_0xed66('0x3')]||'';this['clientSecret']=_0x5aa6ef['clientSecret']||'';this['serverUrl']=_0x5aa6ef[_0xed66('0x4')]||'';this[_0xed66('0x5')]=_0x5aa6ef['code']||'';this[_0xed66('0x6')]=_0x5aa6ef[_0xed66('0x6')]||'';this[_0xed66('0x7')]=_0x5aa6ef[_0xed66('0x7')]||{};}module[_0xed66('0x8')]=ZohoAccount; \ No newline at end of file +var _0x7500=['serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId','clientSecret'];(function(_0x41ea22,_0x3b31f4){var _0x9694d3=function(_0x19a86d){while(--_0x19a86d){_0x41ea22['push'](_0x41ea22['shift']());}};_0x9694d3(++_0x3b31f4);}(_0x7500,0x7e));var _0x0750=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7500[_0x2c91e9];return _0x13f0ff;};'use strict';function ZohoAccount(_0xa9ef2f){this['id']=_0xa9ef2f['id']||0x0;this['name']=_0xa9ef2f[_0x0750('0x0')]||'';this['description']=_0xa9ef2f[_0x0750('0x1')]||'';this[_0x0750('0x2')]=_0xa9ef2f[_0x0750('0x2')]||'';this[_0x0750('0x3')]=_0xa9ef2f[_0x0750('0x3')]||'';this[_0x0750('0x4')]=_0xa9ef2f[_0x0750('0x4')]||'';this[_0x0750('0x5')]=_0xa9ef2f[_0x0750('0x5')]||'';this['serverUrl']=_0xa9ef2f[_0x0750('0x6')]||'';this[_0x0750('0x7')]=_0xa9ef2f[_0x0750('0x7')]||'';this[_0x0750('0x8')]=_0xa9ef2f[_0x0750('0x8')]||'';this[_0x0750('0x9')]=_0xa9ef2f[_0x0750('0x9')]||{};}module[_0x0750('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index 38e2143..c086fb3 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 _0xb016=['countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','Agent','name','membername','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x24061a,_0x1c9f4d){var _0x82054e=function(_0x2ec346){while(--_0x2ec346){_0x24061a['push'](_0x24061a['shift']());}};_0x82054e(++_0x1c9f4d);}(_0xb016,0x159));var _0x6b01=function(_0x44d27c,_0x2dca6b){_0x44d27c=_0x44d27c-0x0;var _0x109d45=_0xb016[_0x44d27c];return _0x109d45;};'use strict';var util=require(_0x6b01('0x0'));var _=require(_0x6b01('0x1'));var moment=require('moment');function checkNameSurname(_0x57ecae,_0xf74fa1,_0x531b6a){var _0x160a7d='';if(!_[_0x6b01('0x2')](_0xf74fa1)&&_0x6b01('0x3')===typeof _0xf74fa1){_0x160a7d+=_0xf74fa1;}if(!_[_0x6b01('0x2')](_0x531b6a)&&'string'===typeof _0x531b6a){_0x160a7d+='\x20'+_0x531b6a;}if(_0x160a7d!==''){return _0x160a7d;}return _0x57ecae;}function Action(_0x1b7dd6,_0x65407a,_0x192b2d,_0x5759a1,_0x5c5bfb){this[_0x6b01('0x4')]=_0x192b2d||undefined;this[_0x6b01('0x5')]=_0x1b7dd6['id'];this['queue']=_0x65407a['name'];this[_0x6b01('0x6')]=_0x65407a[_0x6b01('0x6')];this[_0x6b01('0x7')]=_0x6b01('0x8');this[_0x6b01('0x9')]=![];this['membername']=_['isNil'](_0x1b7dd6[_0x6b01('0xa')])?undefined:_0x1b7dd6[_0x6b01('0xa')][_0x6b01('0xb')];this['channelAgent']=this[_0x6b01('0xc')]?util['format']('SIP/%s',this[_0x6b01('0xc')]):_0x5759a1||undefined;this['calleridname']=checkNameSurname(_0x1b7dd6[_0x6b01('0xd')][_0x6b01('0xe')],_0x1b7dd6['Contact'][_0x6b01('0xf')],_0x1b7dd6['Contact']['lastName']);this['active']=_0x1b7dd6[_0x6b01('0x10')]||![];this['calleridnum']=_0x1b7dd6['phone'];this[_0x6b01('0x11')]=_0x1b7dd6[_0x6b01('0x11')];this[_0x6b01('0x12')]=_0x1b7dd6[_0x6b01('0x12')]||0x0;this[_0x6b01('0x13')]=_0x1b7dd6[_0x6b01('0x13')]||0x0;this[_0x6b01('0x14')]=_0x1b7dd6[_0x6b01('0x14')]||0x0;this[_0x6b01('0x15')]=(_0x1b7dd6[_0x6b01('0x12')]||0x0)+(_0x1b7dd6[_0x6b01('0x13')]||0x0)+(_0x1b7dd6['countnoanswerretry']||0x0)+(_0x1b7dd6[_0x6b01('0x16')]||0x0)+(_0x1b7dd6[_0x6b01('0x17')]||0x0)+(_0x1b7dd6[_0x6b01('0x18')]||0x0)+(_0x1b7dd6[_0x6b01('0x19')]||0x0)+(_0x1b7dd6[_0x6b01('0x1a')]||0x0);this[_0x6b01('0x16')]=_0x1b7dd6[_0x6b01('0x16')]||0x0;this[_0x6b01('0x17')]=_0x1b7dd6['countdropretry']||0x0;this[_0x6b01('0x18')]=_0x1b7dd6[_0x6b01('0x18')]||0x0;this[_0x6b01('0x19')]=_0x1b7dd6[_0x6b01('0x19')]||0x0;this[_0x6b01('0x1a')]=_0x1b7dd6[_0x6b01('0x1a')]||0x0;this[_0x6b01('0x1b')]=_0x1b7dd6['callback'];this[_0x6b01('0x1c')]=_0x1b7dd6[_0x6b01('0x1c')];this[_0x6b01('0x1d')]=_0x1b7dd6['callbackat'];this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')];this[_0x6b01('0x1f')]=_0x1b7dd6[_0x6b01('0x1f')];this[_0x6b01('0x20')]=_0x1b7dd6[_0x6b01('0x20')];this[_0x6b01('0x21')]=_[_0x6b01('0x2')](_0x1b7dd6[_0x6b01('0xa')])?_0x1b7dd6[_0x6b01('0x21')]:_0x1b7dd6[_0x6b01('0xa')]['id'];this[_0x6b01('0x22')]=_0x1b7dd6[_0x6b01('0x22')];this['originatecalleridnum']='';this[_0x6b01('0x23')]='';}Action[_0x6b01('0x24')][_0x6b01('0x25')]=function(){return util[_0x6b01('0x26')](_0x6b01('0x27'),this['calleridname'],this['number']);};module[_0x6b01('0x28')]=Action; \ No newline at end of file +var _0x8603=['prototype','getCaller','number','exports','lodash','moment','isNil','string','uniqueid','type','queue','dialAnswer','Agent','name','channelAgent','format','SIP/%s','membername','calleridname','Contact','phone','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','originatecalleridnum','originatecalleridname'];(function(_0x321961,_0x2e2ccd){var _0x5bc995=function(_0x399e4a){while(--_0x399e4a){_0x321961['push'](_0x321961['shift']());}};_0x5bc995(++_0x2e2ccd);}(_0x8603,0x190));var _0x3860=function(_0x20d805,_0x3ddce9){_0x20d805=_0x20d805-0x0;var _0x2413ab=_0x8603[_0x20d805];return _0x2413ab;};'use strict';var util=require('util');var _=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));function checkNameSurname(_0x96d2bc,_0x51bfda,_0x4961d6){var _0x2ebe8b='';if(!_[_0x3860('0x2')](_0x51bfda)&&_0x3860('0x3')===typeof _0x51bfda){_0x2ebe8b+=_0x51bfda;}if(!_['isNil'](_0x4961d6)&&_0x3860('0x3')===typeof _0x4961d6){_0x2ebe8b+='\x20'+_0x4961d6;}if(_0x2ebe8b!==''){return _0x2ebe8b;}return _0x96d2bc;}function Action(_0x56f8c5,_0xb0fc24,_0x40739b,_0x1eca44,_0xd3ce26){this[_0x3860('0x4')]=_0x40739b||undefined;this['idContact']=_0x56f8c5['id'];this['queue']=_0xb0fc24['name'];this[_0x3860('0x5')]=_0xb0fc24[_0x3860('0x5')];this['campaigntype']=_0x3860('0x6');this[_0x3860('0x7')]=![];this['membername']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?undefined:_0x56f8c5['Agent'][_0x3860('0x9')];this[_0x3860('0xa')]=this['membername']?util[_0x3860('0xb')](_0x3860('0xc'),this[_0x3860('0xd')]):_0x1eca44||undefined;this[_0x3860('0xe')]=checkNameSurname(_0x56f8c5[_0x3860('0xf')][_0x3860('0x10')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x11')],_0x56f8c5[_0x3860('0xf')][_0x3860('0x12')]);this['active']=_0x56f8c5[_0x3860('0x13')]||![];this[_0x3860('0x14')]=_0x56f8c5[_0x3860('0x10')];this[_0x3860('0x15')]=_0x56f8c5[_0x3860('0x15')];this[_0x3860('0x16')]=_0x56f8c5[_0x3860('0x16')]||0x0;this[_0x3860('0x17')]=_0x56f8c5[_0x3860('0x17')]||0x0;this[_0x3860('0x18')]=_0x56f8c5[_0x3860('0x18')]||0x0;this[_0x3860('0x19')]=(_0x56f8c5['countbusyretry']||0x0)+(_0x56f8c5['countcongestionretry']||0x0)+(_0x56f8c5[_0x3860('0x18')]||0x0)+(_0x56f8c5[_0x3860('0x1a')]||0x0)+(_0x56f8c5[_0x3860('0x1b')]||0x0)+(_0x56f8c5['countabandonedretry']||0x0)+(_0x56f8c5[_0x3860('0x1c')]||0x0)+(_0x56f8c5[_0x3860('0x1d')]||0x0);this[_0x3860('0x1a')]=_0x56f8c5[_0x3860('0x1a')]||0x0;this[_0x3860('0x1b')]=_0x56f8c5[_0x3860('0x1b')]||0x0;this[_0x3860('0x1e')]=_0x56f8c5[_0x3860('0x1e')]||0x0;this[_0x3860('0x1c')]=_0x56f8c5[_0x3860('0x1c')]||0x0;this[_0x3860('0x1d')]=_0x56f8c5[_0x3860('0x1d')]||0x0;this[_0x3860('0x1f')]=_0x56f8c5[_0x3860('0x1f')];this[_0x3860('0x20')]=_0x56f8c5['callbackuniqueid'];this[_0x3860('0x21')]=_0x56f8c5[_0x3860('0x21')];this[_0x3860('0x22')]=_0x56f8c5[_0x3860('0x22')];this[_0x3860('0x23')]=_0x56f8c5['ContactId'];this[_0x3860('0x24')]=_0x56f8c5['ListId'];this['UserId']=_[_0x3860('0x2')](_0x56f8c5[_0x3860('0x8')])?_0x56f8c5['UserId']:_0x56f8c5['Agent']['id'];this['VoiceQueueId']=_0x56f8c5[_0x3860('0x25')];this[_0x3860('0x26')]='';this[_0x3860('0x27')]='';}Action[_0x3860('0x28')][_0x3860('0x29')]=function(){return util[_0x3860('0xb')]('\x22%s\x22\x20<%s>',this['calleridname'],this[_0x3860('0x2a')]);};module[_0x3860('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 180778c..ab4ea7b 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 _0x69c4=['INACTIVE','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','custom:agentnosuchnumber','buildObj','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','linkedid','actioncountonusuch','incrementPreviewCounters','swapAdditionalPhones','ANSWER','answertime','uniqueid','\x20Queue','custom:agentconnect','mandatoryDisposition','custom:agentConnectPreview','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','rescheduleContact','idContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','NoAnswer','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerRetryFrequency','activeContact','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','congestion','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalking][no\x20Hangup][Preview]','callAdditionalPhoneAfterMin','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','decrementOriginate','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','NoSuchNumber','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[originated][decrement][callProgressDetectingAgent]','resolve','[incrementPreviewCounters]\x20','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlock','unlockContact','execRun','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','checkInBlack','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','dialCutDigit','trim','substring','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','callerid','originatecalleridname','originatecalleridnum','addVariables','setXMDContactVariables','merge','toLowerVariables','variables','variablesAction','actionid','logLookAgent','clone','responsetime','isFailure','custom:agentringnoanswer','[syncHangup][talking]','cause','callProgressDetectingCustomer','statedesc','dialQueueProject','channelstate','[syncHangup][talking][transfer]','destuniqueid','addVariable','syncVarSet','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','syncBlindTransfer','transfererlinkedid','transfer','exports','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./rpcDb','../rpc/cmHopperAdditionalPhone','./action','./util/util','../dialer/utils','redis','defaults','prototype','enqueue','tail','finally','sequence','campaignsPreview','trunks','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','paused','message','CAMPAIGN_STATUS','logger','name','DEACTIVATED','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','type','clearZombieChannels','outbound','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','isNil','actions','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','pTalking','dialAnswer','pick','contactId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','[clearZombieChannel]','decrementTalking','loggerError','[Dialer][checkChannel][pTalking][Preview]','[action]','recallMe','getContactRecallMe','then','length','getDiff','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','rescheduleContactInQueue','createBody','createCustomerHistory','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','dialActive'];(function(_0x638e6b,_0x55ac87){var _0x1f4dbf=function(_0x3e3bdc){while(--_0x3e3bdc){_0x638e6b['push'](_0x638e6b['shift']());}};_0x1f4dbf(++_0x55ac87);}(_0x69c4,0xcd));var _0x469c=function(_0x348532,_0x380509){_0x348532=_0x348532-0x0;var _0x26e33d=_0x69c4[_0x348532];return _0x26e33d;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x469c('0x0'));var moment=require('moment');var Redis=require(_0x469c('0x1'));var config=require(_0x469c('0x2'));var logger=require(_0x469c('0x3'))(_0x469c('0x4'));var loggerAction=require(_0x469c('0x3'))(_0x469c('0x5'));var ami=require(_0x469c('0x6'));var rpcDb=require(_0x469c('0x7'));var cmHopperAdditionalPhone=require(_0x469c('0x8'));var Action=require(_0x469c('0x9'));var ut=require(_0x469c('0xa'));var utils=require(_0x469c('0xb'));config[_0x469c('0xc')]=_[_0x469c('0xd')](config[_0x469c('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x469c('0xe')][_0x469c('0xf')]=function(_0x19e9f2){this[_0x469c('0x10')]=this['tail']?this['tail'][_0x469c('0x11')](_0x19e9f2):_0x19e9f2();};function Preview(_0x46031c){this[_0x469c('0x12')]=new Sequence();this[_0x469c('0x13')]=_0x46031c['voiceQueues'];this[_0x469c('0x14')]=_0x46031c['trunks'];this['actions']={};this[_0x469c('0x15')]=_0x46031c['agents'];this[_0x469c('0x16')]=0x0;ami['on'](_0x469c('0x17'),this[_0x469c('0x18')][_0x469c('0x19')](this));ami['on'](_0x469c('0x1a'),this['syncHangup']['bind'](this));ami['on']('hanguprequest',this[_0x469c('0x1b')][_0x469c('0x19')](this));ami['on'](_0x469c('0x1c'),this[_0x469c('0x1d')]['bind'](this));ami['on'](_0x469c('0x1e'),this[_0x469c('0x1f')][_0x469c('0x19')](this));ami['on']('varset',this['syncVarSet'][_0x469c('0x19')](this));ami['on'](_0x469c('0x20'),this[_0x469c('0x21')][_0x469c('0x19')](this));ami['on'](_0x469c('0x22'),this['syncBlindTransfer'][_0x469c('0x19')](this));this[_0x469c('0x23')](this[_0x469c('0x13')]);}function emit(_0x5c7a14,_0x439ada,_0x1ddb95){io['to'](_0x5c7a14)[_0x469c('0x24')](_0x439ada,_0x1ddb95);}function emitVoiceQueueChannelRemove(_0x4ad460){logger[_0x469c('0x25')](_0x469c('0x26'),JSON[_0x469c('0x27')](_0x4ad460));emit(util[_0x469c('0x28')](_0x469c('0x29'),_0x4ad460['name']),_0x469c('0x2a'),_0x4ad460);io[_0x469c('0x24')](_0x469c('0x2b'),_0x4ad460);}function notSendMessagesQueue(_0x4ef32f){if(_0x4ef32f[_0x469c('0x2c')]){if(_0x4ef32f[_0x469c('0x2d')]===0x0&&_0x4ef32f['pTalking']===0x0){_0x4ef32f[_0x469c('0x2c')]=![];_0x4ef32f[_0x469c('0x2e')]=0x0;_0x4ef32f[_0x469c('0x2f')]=0x0;_0x4ef32f[_0x469c('0x30')]=utils[_0x469c('0x31')]['INACTIVE'];ut[_0x469c('0x32')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x4ef32f[_0x469c('0x33')]+'\x20is\x20not\x20active');}else{_0x4ef32f[_0x469c('0x30')]=utils[_0x469c('0x31')][_0x469c('0x34')];ut['logger'](_0x469c('0x35'),_0x4ef32f[_0x469c('0x33')]+_0x469c('0x36'));}}}Preview[_0x469c('0xe')][_0x469c('0x23')]=function(){var _0x254530=this;setInterval(function(){_0x254530[_0x469c('0x37')]();},0x7cf);};Preview[_0x469c('0xe')][_0x469c('0x37')]=function(){var _0x24f674=this[_0x469c('0x13')];this[_0x469c('0x16')]+=0x1;for(var _0x15be7e in _0x24f674){if(_0x24f674[_0x469c('0x38')](_0x15be7e)&&(_0x24f674[_0x15be7e]['dialMethod']===_0x469c('0x4')||_0x24f674[_0x15be7e]['dialMethod']==='booked')&&_0x24f674[_0x15be7e][_0x469c('0x39')]==='outbound'){if(this[_0x469c('0x16')]>0x7){this[_0x469c('0x16')]=0x0;this[_0x469c('0x3a')]();}}if(_0x24f674[_0x469c('0x38')](_0x15be7e)&&_0x24f674[_0x15be7e]['dialMethod']===_0x469c('0x4')&&_0x24f674[_0x15be7e]['type']===_0x469c('0x3b')){if(_0x24f674[_0x15be7e]['dialActive']){this[_0x469c('0x3c')](_0x24f674[_0x15be7e]);if(_0x24f674[_0x15be7e][_0x469c('0x3d')])this['recallMe'](_0x24f674[_0x15be7e]);}else{notSendMessagesQueue(_0x24f674[_0x15be7e]);}}}};Preview[_0x469c('0xe')][_0x469c('0x3e')]=function(_0x3c14f9){var _0x1045e9=this;this[_0x469c('0x12')]['enqueue'](function(){if(!_[_0x469c('0x3f')](_0x1045e9[_0x469c('0x40')][_0x3c14f9])){loggerAction['info'](_0x469c('0x41'),_0x3c14f9,_0x469c('0x42'),_0x1045e9[_0x469c('0x40')][_0x3c14f9][_0x469c('0x43')],_0x469c('0x44'),JSON['stringify'](_0x1045e9['campaignsPreview'][_0x1045e9['actions'][_0x3c14f9][_0x469c('0x43')]][_0x469c('0x2d')]),_0x469c('0x45'),JSON[_0x469c('0x27')](_0x1045e9[_0x469c('0x13')][_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']][_0x469c('0x46')]),JSON[_0x469c('0x27')](_0x1045e9['actions'][_0x3c14f9][_0x469c('0x47')]),JSON[_0x469c('0x27')](_[_0x469c('0x48')](_0x1045e9['actions'][_0x3c14f9],[_0x469c('0x49'),'UserId',_0x469c('0x4a'),'ListId'])));return ami[_0x469c('0x4b')]({'action':_0x469c('0x4c'),'channel':_0x1045e9[_0x469c('0x40')][_0x3c14f9][_0x469c('0x4d')]})[_0x469c('0x4e')](function(_0xaf049e){if(_0xaf049e[_0x469c('0x30')]===_0x469c('0x4f')){setTimeout(function(){if(_0x1045e9['actions'][_0x3c14f9]){utils['decrementOriginate'](_0x1045e9['campaignsPreview'][_0x1045e9['actions'][_0x3c14f9]['queue']],_0x469c('0x50'));if(_0x1045e9[_0x469c('0x40')][_0x3c14f9][_0x469c('0x47')]===!![]){ut[_0x469c('0x51')](_0x1045e9[_0x469c('0x13')][_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']],_0x469c('0x50'));ut[_0x469c('0x52')](_0x469c('0x53')+_0x3c14f9,_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']);}ut[_0x469c('0x52')]('[Dialer][checkChannel][Preview]'+_0x3c14f9,_0x1045e9[_0x469c('0x40')][_0x3c14f9]['queue']);delete _0x1045e9[_0x469c('0x40')][_0x3c14f9];}},0x2328);}});}});};Preview[_0x469c('0xe')][_0x469c('0x3a')]=function(){var _0xdd48b=this;loggerAction[_0x469c('0x25')](_0x469c('0x54'),_['size'](this[_0x469c('0x40')]));for(var _0x38339a in this[_0x469c('0x40')]){if(_0xdd48b[_0x469c('0x40')][_0x469c('0x38')](_0x38339a)){_0xdd48b[_0x469c('0x3e')](_0x38339a);}}};Preview[_0x469c('0xe')][_0x469c('0x55')]=function(_0x56ecbd){var _0x3552d7=this;rpcDb[_0x469c('0x56')](_0x56ecbd['id'],ut['agentReadyId'](this[_0x469c('0x15')]))[_0x469c('0x57')](function(_0x348866){if(!_[_0x469c('0x3f')](_0x348866)){for(var _0x4a7cc9=0x0;_0x4a7cc9<_0x348866[_0x469c('0x58')];_0x4a7cc9+=0x1){if(ut[_0x469c('0x59')](_0x348866[_0x4a7cc9]['scheduledat'])<_0x56ecbd[_0x469c('0x5a')]*0x3c){if(_0x348866[_0x4a7cc9][_0x469c('0x5b')]&&!_0x348866[_0x4a7cc9][_0x469c('0x5b')][_0x469c('0x5c')]){_0x3552d7[_0x469c('0x5d')](_0x348866[_0x4a7cc9]['id'])[_0x469c('0x57')](ut[_0x469c('0x5e')](_0x469c('0x5f')))[_0x469c('0x4e')](ut[_0x469c('0x5e')](_0x469c('0x5f')));}else{rpcDb[_0x469c('0x60')](_0x348866[_0x4a7cc9]['id']);}}else{var _0x452075=new Action(_0x348866[_0x4a7cc9],_0x56ecbd);_0x452075[_0x469c('0x61')]=moment()[_0x469c('0x28')](_0x469c('0x62'));_0x56ecbd[_0x469c('0x63')]+=0x1;ut[_0x469c('0x64')](_0x452075,0x17,'RecallInQueue');if(_0x56ecbd['dialRecallInQueue']){rpcDb[_0x469c('0x65')](ut[_0x469c('0x66')](_0x348866[_0x4a7cc9]));rpcDb[_0x469c('0x67')](_0x452075,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x452075,0x16,_0x469c('0x68'));rpcDb['createCustomerHistory'](_0x452075,_0x469c('0x69'));rpcDb[_0x469c('0x6a')](_0x452075,_0x469c('0x69'));}}}}})['catch'](ut[_0x469c('0x5e')](_0x469c('0x6b')));};Preview['prototype']['setMessage']=function(_0x119b97){_0x119b97[_0x469c('0x2c')]=!![];if(ut[_0x469c('0x6c')](_0x119b97['loggedIn'])){_0x119b97[_0x469c('0x30')]=utils[_0x469c('0x31')][_0x469c('0x6d')];}else if(!ut['isActive'](_0x119b97[_0x469c('0x6e')])){_0x119b97['message']=utils['CAMPAIGN_STATUS'][_0x469c('0x6f')];}else if(!this[_0x469c('0x70')](_0x119b97[_0x469c('0x71')])){if(!this[_0x469c('0x70')](_0x119b97[_0x469c('0x72')])){_0x119b97[_0x469c('0x30')]=utils['CAMPAIGN_STATUS']['UNREACHABLE_TRUNK'];}else{_0x119b97['message']=utils[_0x469c('0x31')][_0x469c('0x73')];}}else{_0x119b97[_0x469c('0x30')]=utils[_0x469c('0x31')]['ACTIVE'];}};Preview[_0x469c('0xe')]['callProgressDetectingCustomer']=function(_0x633209,_0x5e78d3,_0x1b4604){var _0x50af71=this;var _0x2ae992=this[_0x469c('0x40')][_0x5e78d3];var _0x597fee=this[_0x469c('0x13')][_0x2ae992[_0x469c('0x43')]];var _0x14de92;var _0x15f617=![];var _0x27216e=0x2;var _0x3a6bed=0x3;if(_0x597fee){switch(_0x1b4604){case'1':_0x597fee['outboundNoSuchCallsDay']+=0x1;_0x2ae992[_0x469c('0x74')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x0,'NoSuchNumber');ami['emit'](_0x469c('0x77'),ut[_0x469c('0x78')](_0x2ae992,'nosuchnumber'));rpcDb[_0x469c('0x67')](_0x2ae992,'[callProgressDetectingCustomer][logNoSuch]');_0x50af71[_0x469c('0x79')](_0x2ae992,'0',_0x597fee)[_0x469c('0x57')](function(_0x57332e){_0x15f617=_0x57332e[_0x469c('0x7a')]==0x1;_0x27216e=_0x597fee[_0x469c('0x7b')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];if(!_0x15f617){if(ut['totalGlobal'](_0x2ae992)>=_0x597fee['dialGlobalMaxRetry']){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0x7e'));}else{if(_0x2ae992[_0x469c('0x74')]>=_0x597fee[_0x469c('0x7f')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0x7e'));}else{rpcDb['rescheduleContact'](ut[_0x469c('0x80')](_0x2ae992,'countnosuchnumberretry',_0x597fee[_0x469c('0x7b')]),_0x2ae992[_0x469c('0x81')],_0x2ae992['activeContact']);}}delete this[_0x469c('0x40')][_0x633209[_0x469c('0x82')]];}else{_0x2ae992[_0x469c('0x74')]++;logger[_0x469c('0x25')](_0x469c('0x83'),_0x2ae992[_0x469c('0x74')]);logger[_0x469c('0x25')]('id',_0x2ae992['idContact']);_0x50af71[_0x469c('0x84')]({'id':_0x2ae992['idContact'],'field':{'countnosuchnumberretry':_0x2ae992[_0x469c('0x74')]}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)['then'](function(){});});}});break;case _0x469c('0x86'):var _0x28b8ae=moment()[_0x469c('0x28')](_0x469c('0x62'));_0x2ae992['responsetime']=_0x28b8ae;_0x2ae992[_0x469c('0x87')]=_0x28b8ae;_0x2ae992[_0x469c('0x47')]=!![];_0x597fee[_0x469c('0x46')]+=0x1;logger[_0x469c('0x25')]('[syncHangup][talking][increment]',_0x2ae992[_0x469c('0x88')],_0x469c('0x89'),_0x597fee[_0x469c('0x33')],_0x469c('0x45'),_0x597fee['pTalking']);ami[_0x469c('0x24')](_0x469c('0x8a'),ut[_0x469c('0x78')](_0x2ae992,'connect',this[_0x469c('0x13')][_0x2ae992[_0x469c('0x43')]]));if(_0x597fee['acw']||_0x597fee[_0x469c('0x8b')]){ami[_0x469c('0x24')](_0x469c('0x8c'),{'queue':_0x2ae992['queue'],'interface':_0x2ae992[_0x469c('0x8d')],'uniqueid':_0x2ae992[_0x469c('0x88')]});}break;case'16':ami[_0x469c('0x24')](_0x469c('0x8e'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0x8f'),this[_0x469c('0x13')][_0x2ae992['queue']]));emitVoiceQueueChannelRemove(ut[_0x469c('0x78')](_0x2ae992,'complete'));_0x597fee[_0x469c('0x90')]+=0x1;_0x597fee[_0x469c('0x91')]+=0x1;_0x597fee[_0x469c('0x92')]+=0x1;ut[_0x469c('0x51')](_0x597fee,_0x469c('0x93'));_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x4,_0x469c('0x94'));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0x95'));rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0x96'));rpcDb['crateCustomerReportQueue'](_0x2ae992);_0x597fee[_0x469c('0x97')]+=_0x2ae992[_0x469c('0x98')];_0x597fee[_0x469c('0x99')]+=_0x2ae992[_0x469c('0x98')];logger[_0x469c('0x25')](_0x469c('0x9a'),_0x2ae992[_0x469c('0x88')],'\x20Queue',_0x597fee[_0x469c('0x33')],'pTalking:\x20',_0x597fee[_0x469c('0x46')]);delete this[_0x469c('0x40')][_0x633209[_0x469c('0x82')]];break;case _0x469c('0x9b'):_0x597fee[_0x469c('0x9c')]+=0x1;_0x2ae992[_0x469c('0x9d')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut['logCustomer'](_0x2ae992,0x5,'Busy');_0x27216e=_0x597fee[_0x469c('0x9e')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];ami['emit'](_0x469c('0x9f'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xa0')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xa1'));_0x50af71[_0x469c('0x79')](_0x2ae992,'5',_0x597fee)[_0x469c('0x57')](function(_0xd6d071){_0x15f617=_0xd6d071[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut['totalGlobal'](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0xa3'));}else{if(_0x2ae992[_0x469c('0x9d')]>=_0x597fee[_0x469c('0xa4')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xa1'));}else{rpcDb[_0x469c('0xa5')](ut[_0x469c('0x80')](_0x2ae992,_0x469c('0x9d'),_0x597fee[_0x469c('0x9e')]),_0x2ae992[_0x469c('0x81')],_0x2ae992['activeContact']);}}}else{_0x2ae992[_0x469c('0x9d')]++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countbusyretry':_0x2ae992[_0x469c('0x9d')]}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case _0x469c('0xa7'):_0x597fee[_0x469c('0xa8')]+=0x1;_0x2ae992[_0x469c('0xa9')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x3,_0x469c('0xaa'));_0x27216e=_0x597fee['dialNoAnswerRetryFrequency'];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];var _0x59326a=ut[_0x469c('0xab')](_0x2ae992,_0x597fee);ami[_0x469c('0x24')]('custom:agentnoanswer',_0x59326a);rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xac'));_0x50af71['verifyAdditionalPhones'](_0x2ae992,'3',_0x597fee)['then'](function(_0x24c556){_0x15f617=_0x24c556[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut['totalGlobal'](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut['cloneAction'](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0xad'));}else{if(_0x2ae992['countnoanswerretry']>=_0x597fee['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x2ae992,_0x469c('0xac'));}else{rpcDb[_0x469c('0xa5')](ut[_0x469c('0x80')](_0x2ae992,_0x469c('0xa9'),_0x597fee[_0x469c('0xae')]),_0x2ae992[_0x469c('0x81')],_0x2ae992[_0x469c('0xaf')]);}}}else{_0x2ae992['countnoanswerretry']++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992[_0x469c('0xa9')]}})['then'](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case'CONGESTION':_0x597fee[_0x469c('0xb0')]+=0x1;_0x2ae992[_0x469c('0xb1')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut['totalGlobal'](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x8,_0x469c('0xb2'));_0x27216e=_0x597fee[_0x469c('0xb3')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xb4')));rpcDb[_0x469c('0x67')](_0x2ae992,'[callProgressDetectingCustomer][logCongestion]');_0x50af71[_0x469c('0x79')](_0x2ae992,'8',_0x597fee)[_0x469c('0x57')](function(_0x53f6f7){_0x15f617=_0x53f6f7[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee['dialGlobalMaxRetry']){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,'Global');rpcDb[_0x469c('0x6a')](_0x14de92,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x2ae992[_0x469c('0xb1')]>=_0x597fee[_0x469c('0xb5')]){rpcDb[_0x469c('0x6a')](_0x2ae992,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x2ae992,_0x469c('0xb1'),_0x597fee['dialBusyRetryFrequency']),_0x2ae992[_0x469c('0x81')],_0x2ae992['activeContact']);}}}else{_0x2ae992[_0x469c('0xb1')]++;_0x50af71['incrementPreviewCounters']({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countcongestionretry':_0x2ae992[_0x469c('0xb1')]}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)['then'](function(){});});}});break;case _0x469c('0xb6'):_0x597fee[_0x469c('0xb7')]+=0x1;_0x2ae992[_0x469c('0xb8')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x14,_0x469c('0xb9'));_0x27216e=_0x597fee[_0x469c('0xba')];_0x3a6bed=_0x597fee['callAdditionalPhoneAfterMin'];ami[_0x469c('0x24')](_0x469c('0xbb'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xbc')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xbd'));_0x50af71[_0x469c('0x79')](_0x2ae992,'20',_0x597fee)[_0x469c('0x57')](function(_0x29b074){_0x15f617=_0x29b074[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x14de92,_0x469c('0xbe'));}else{if(_0x2ae992[_0x469c('0xb8')]>=_0x597fee[_0x469c('0xbf')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xbe'));}else{rpcDb[_0x469c('0xa5')](ut['scheduledAt'](_0x2ae992,_0x469c('0xb8'),_0x597fee['dialAgentRejectRetryFrequency']),_0x2ae992[_0x469c('0x81')],_0x2ae992[_0x469c('0xaf')]);}}}else{_0x2ae992[_0x469c('0xa9')]++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992['countnoanswerretry']}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case'ABANDONED':_0x597fee[_0x469c('0xc0')]+=0x1;_0x2ae992[_0x469c('0xc1')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut['totalGlobal'](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0xb,_0x469c('0xc2'));rpcDb['createCustomerHistory'](_0x2ae992,_0x469c('0xc3'));_0x50af71[_0x469c('0x79')](_0x2ae992,'11',_0x597fee)['then'](function(_0x5ab789){_0x15f617=_0x5ab789['additional']==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,'Global');rpcDb['createCustomerFinal'](_0x14de92,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2ae992[_0x469c('0xc4')]>=_0x597fee[_0x469c('0xc5')]){rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xc3'));}else{rpcDb[_0x469c('0xa5')](ut[_0x469c('0x80')](_0x2ae992,_0x469c('0xc1'),_0x597fee['dialAbandonedRetryFrequency']),_0x2ae992[_0x469c('0x81')],_0x2ae992[_0x469c('0xaf')]);}}}else{_0x2ae992[_0x469c('0xa9')]++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992['idContact'],'field':{'countnoanswerretry':_0x2ae992[_0x469c('0xa9')]}})[_0x469c('0x57')](function(){_0x50af71['swapAdditionalPhones'](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});break;case'18':_0x597fee[_0x469c('0xc6')]+=0x1;_0x2ae992[_0x469c('0xc7')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x12,_0x633209[_0x469c('0xc8')]||_0x633209[_0x469c('0xc9')]);ami['emit'](_0x469c('0xca'),ut[_0x469c('0x78')](_0x2ae992,_0x469c('0xcb')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xcc'));_0x50af71[_0x469c('0x79')](_0x2ae992,'18',_0x597fee)['then'](function(_0x34afbd){_0x15f617=_0x34afbd['additional']==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee['dialGlobalMaxRetry']){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0x12,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,_0x469c('0xcc'));}else{rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xcc'));}}else{_0x2ae992['countnoanswerretry']++;_0x50af71[_0x469c('0x84')]({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992['countnoanswerretry']}})[_0x469c('0x57')](function(){_0x50af71[_0x469c('0x85')](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});});}});delete this[_0x469c('0x40')][_0x633209['linkedid']];break;case'19':_0x597fee[_0x469c('0xc6')]+=0x1;_0x2ae992['countglobal']=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0x13,_0x633209[_0x469c('0xc8')]||_0x633209[_0x469c('0xc9')]);ami['emit'](_0x469c('0xca'),ut['buildObj'](_0x2ae992,_0x469c('0xcb')));rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xcd'));_0x50af71['verifyAdditionalPhones'](_0x2ae992,'18',_0x597fee)[_0x469c('0x57')](function(_0x3f6dac){_0x15f617=_0x3f6dac[_0x469c('0x7a')]==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb['createCustomerFinal'](_0x14de92,_0x469c('0xcd'));}else{rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xcd'));}}else{_0x2ae992[_0x469c('0xa9')]++;_0x50af71['incrementPreviewCounters']({'id':_0x2ae992[_0x469c('0xa6')],'field':{'countnoanswerretry':_0x2ae992[_0x469c('0xa9')]}})[_0x469c('0x57')](function(){_0x50af71['swapAdditionalPhones'](_0x2ae992,_0x27216e,_0x3a6bed)['then'](function(){});});}});delete this[_0x469c('0x40')][_0x633209['linkedid']];break;default:if(_0x2ae992[_0x469c('0x47')]){ut[_0x469c('0x51')](_0x597fee,_0x469c('0xce'));ut[_0x469c('0x52')](_0x469c('0xcf')+_0x597fee[_0x469c('0x33')],_0x633209);}_0x597fee[_0x469c('0xc6')]+=0x1;_0x2ae992[_0x469c('0x75')]=ut[_0x469c('0x76')](_0x2ae992);ut[_0x469c('0x64')](_0x2ae992,0xc,_0x633209['cause-txt']||_0x633209[_0x469c('0xc9')]);_0x27216e=_0x597fee[_0x469c('0xba')];_0x3a6bed=_0x597fee[_0x469c('0xd0')];rpcDb[_0x469c('0x67')](_0x2ae992,_0x469c('0xd1'));_0x50af71[_0x469c('0x79')](_0x2ae992,'20',_0x597fee)[_0x469c('0x57')](function(_0x33f947){_0x15f617=_0x33f947['additional']==0x1;if(!_0x15f617){if(ut[_0x469c('0x76')](_0x2ae992)>=_0x597fee[_0x469c('0xa2')]){_0x14de92=ut[_0x469c('0x7c')](_0x2ae992,0xf,_0x469c('0x7d'));rpcDb[_0x469c('0x6a')](_0x14de92,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x469c('0x6a')](_0x2ae992,_0x469c('0xd2'));}delete this['actions'][_0x633209[_0x469c('0x82')]];}else{_0x50af71['swapAdditionalPhones'](_0x2ae992,_0x27216e,_0x3a6bed)[_0x469c('0x57')](function(){});}});}if(!(_0x2ae992[_0x469c('0x47')]&&_0x1b4604==='16')){utils[_0x469c('0xd3')](_0x597fee,'[callProgressDetectingCustomer]');logger[_0x469c('0x25')](_0x469c('0xd4'),_0x2ae992[_0x469c('0x88')],'\x20Queue',_0x597fee['name'],_0x469c('0x44'),_0x597fee[_0x469c('0x2d')]);}if(_0x1b4604!==_0x469c('0x86')){delete this[_0x469c('0x40')][_0x633209['linkedid']];delete this[_0x469c('0x40')][_0x633209[_0x469c('0xd5')]];}_0x597fee[_0x469c('0xd6')]=!![];}};Preview[_0x469c('0xe')][_0x469c('0xd7')]=function(_0x3b1ab5,_0x37369d,_0x441d0e){if(_[_0x469c('0xd8')](_0x37369d)&&_0x469c('0xd9')!==typeof _0x37369d){return;}if(_[_0x469c('0xd8')](_0x441d0e)&&_0x469c('0xd9')!==typeof _0x441d0e){return;}switch(_0x441d0e[_0x469c('0xda')]){case'0':ut[_0x469c('0xdb')](_0x3b1ab5,0x0,_0x469c('0xdc'));rpcDb[_0x469c('0xdd')](_0x3b1ab5,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x469c('0xdb')](_0x3b1ab5,0x3,_0x469c('0xaa'));rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xde'));break;case'5':ut[_0x469c('0xdb')](_0x3b1ab5,0x5,_0x469c('0xdf'));rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xe0'));break;case'8':ut[_0x469c('0xdb')](_0x3b1ab5,0x8,'Congestion');rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xe1'));break;case'22':ut[_0x469c('0xdb')](_0x3b1ab5,0x16,_0x469c('0xe2'));rpcDb['createAgentHistory'](_0x3b1ab5,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x469c('0xdb')](_0x3b1ab5,0xc,_0x441d0e[_0x469c('0xda')]);rpcDb[_0x469c('0xdd')](_0x3b1ab5,_0x469c('0xe1'));}utils['decrementOriginate'](_0x37369d,'[callProgressDetectingAgent]');logger['info'](_0x469c('0xe3'),_0x3b1ab5[_0x469c('0x88')],_0x469c('0x89'),_0x37369d[_0x469c('0x33')],_0x469c('0x44'),_0x37369d[_0x469c('0x2d')]);delete this['actions'][_0x3b1ab5[_0x469c('0x88')]];};Preview['prototype'][_0x469c('0x79')]=function(_0x1a9ee5,_0x3e9d05,_0x432b97){return cmHopperAdditionalPhone[_0x469c('0x79')](_0x1a9ee5,_0x3e9d05,_0x432b97)[_0x469c('0x4e')](logger[_0x469c('0x25')]('[verifyAdditionalPhone]\x20'));};Preview[_0x469c('0xe')][_0x469c('0x85')]=function(_0x37d9ed,_0x2fa44d,_0x4f5574){return cmHopperAdditionalPhone[_0x469c('0x85')](_0x37d9ed,_0x2fa44d,_0x4f5574)['catch'](logger[_0x469c('0x25')]('[swapAdditionalPhone]\x20'));};Preview['prototype'][_0x469c('0x84')]=function(_0x59346b){return Promise[_0x469c('0xe4')]()[_0x469c('0x57')](cmHopperAdditionalPhone[_0x469c('0x84')](_0x59346b))[_0x469c('0x4e')](logger[_0x469c('0x25')](_0x469c('0xe5')));};Preview['prototype']['checkInBlack']=function(_0x42e324,_0x13e6ff,_0x1065ce,_0x1f1f56,_0xcc233a){var _0x541ec5=this;return new Promise(function(_0x533505,_0x3116af){if(_['isNil'](_0x13e6ff)||_[_0x469c('0x3f')](_0x13e6ff[_0x469c('0xe6')])||_[_0x469c('0x3f')](_0x13e6ff[_0x469c('0xe7')])||_['isNil'](_0x13e6ff[_0x469c('0x4a')])){_0x3116af(ut['message'](_0x469c('0xe8'),_0x1f1f56,_0xcc233a));return;}var _0x8dde=uuid['v4']();var _0x4d6d18=_0x541ec5[_0x469c('0x13')][_0x13e6ff[_0x469c('0x42')]['name']];var _0x5e3cb6=_0x1065ce?_0x541ec5['agents'][_0x1065ce]['id']:undefined;_0x541ec5[_0x469c('0x40')][_0x8dde]=new Action(_0x13e6ff,_0x4d6d18,_0x8dde,_0x1065ce,_0x5e3cb6);var _0x2825dd=_0x541ec5['actions'][_0x8dde];_0x2825dd[_0x469c('0x81')]=_0x1f1f56;_0x2825dd['activeContact']=_0xcc233a;_0x2825dd[_0x469c('0xe9')]=_0x1065ce;if(_[_0x469c('0xea')](_0x42e324)){_0x541ec5[_0x469c('0xeb')](_0x2825dd,_0x4d6d18,_0x13e6ff,_0x1065ce)['then'](function(_0x3d0c44){logger[_0x469c('0x25')](_0x469c('0xec'),_0x469c('0xed')+_0x2825dd['queue']+'\x20IdHopper:\x20'+_0x2825dd[_0x469c('0xa6')],JSON[_0x469c('0x27')](_0x3d0c44));ami[_0x469c('0x24')]('custom:agentcalled',ut[_0x469c('0x78')](_0x2825dd,_0x469c('0xee'),_0x541ec5['campaignsPreview'][_0x2825dd[_0x469c('0x43')]]));_0x533505(ut['message'](_0x469c('0xef')));})[_0x469c('0x4e')](function(_0x50dde8){ut[_0x469c('0x32')](_0x469c('0xf0'),_0x50dde8);_0x3116af(ut[_0x469c('0x30')]('Call\x20failed',_0x1f1f56,_0xcc233a));});}else{_0x4d6d18[_0x469c('0xf1')]+=0x1;ut[_0x469c('0xf2')](_0x2825dd);rpcDb[_0x469c('0xf3')](_0x2825dd,_0x469c('0xf4'));delete _0x541ec5[_0x469c('0x40')][_0x8dde];_0x3116af(ut[_0x469c('0x30')](_0x469c('0xf5'),_0x1f1f56,_0xcc233a));}});};Preview[_0x469c('0xe')][_0x469c('0x70')]=function(_0x2daf1a){return!_[_0x469c('0x3f')](_0x2daf1a)&&!_[_0x469c('0x3f')](_0x2daf1a[_0x469c('0x33')])&&!_[_0x469c('0x3f')](_0x2daf1a[_0x469c('0xf6')])&&_0x2daf1a[_0x469c('0xf6')]&&!_[_0x469c('0x3f')](this[_0x469c('0x14')][util[_0x469c('0x28')]('SIP/%s',_0x2daf1a[_0x469c('0x33')])])&&!_['isNil'](this[_0x469c('0x14')][util[_0x469c('0x28')](_0x469c('0xf7'),_0x2daf1a[_0x469c('0x33')])]['status'])&&(this[_0x469c('0x14')][util['format'](_0x469c('0xf7'),_0x2daf1a[_0x469c('0x33')])][_0x469c('0x4c')]===_0x469c('0xf8')||this[_0x469c('0x14')][util['format'](_0x469c('0xf7'),_0x2daf1a[_0x469c('0x33')])][_0x469c('0x4c')]===_0x469c('0xf9'));};Preview['prototype'][_0x469c('0x5d')]=function(_0x39d688,_0x5c058d){return this['execRun'](_0x39d688,_0x5c058d)[_0x469c('0x57')](function(_0x559823){return _[_0x469c('0x48')](_0x559823,['message']);})[_0x469c('0x4e')](function(_0x22d1c1){if(_0x22d1c1[_0x469c('0xfa')]){rpcDb[_0x469c('0xfb')](_0x39d688);}if(_0x22d1c1['active']){rpcDb[_0x469c('0x60')](_0x39d688);}throw _['pick'](_0x22d1c1,[_0x469c('0x30')]);});};Preview[_0x469c('0xe')][_0x469c('0xfc')]=function(_0x32a0bc,_0x1112bf){var _0x432b9e=this;var _0x59c1d9,_0x4186da;return rpcDb[_0x469c('0xfd')](_0x32a0bc)[_0x469c('0x57')](function(_0x5e4501){if(!_[_0x469c('0x3f')](_0x5e4501[0x0])){_0x4186da=_0x5e4501[0x0]['recallme']?![]:!![];_0x59c1d9=_0x5e4501[0x0][_0x469c('0xfe')]?!![]:![];_0x59c1d9=_0x1112bf?!![]:_0x59c1d9;}var _0x3ca9ad=_0x432b9e[_0x469c('0xff')](_0x5e4501);if(_0x3ca9ad[_0x469c('0x100')]){rpcDb[_0x469c('0x101')](_['pick'](_0x5e4501[0x0],[_0x469c('0x4a'),'phone']))[_0x469c('0x57')](function(_0x5c4382){_0x432b9e[_0x469c('0x102')](_0x5c4382,_0x5e4501[0x0],_0x1112bf,_0x4186da,_0x59c1d9)['then'](function(_0x236113){return _0x236113;})[_0x469c('0x4e')](function(_0x5d0e49){throw _0x5d0e49;});})[_0x469c('0x4e')](function(_0xb73c9f){ut[_0x469c('0x32')]('[Preview][checkIsBlackList]',_0xb73c9f);throw ut[_0x469c('0x30')](_0x469c('0x103'),_0x4186da,_0x59c1d9);});}else{throw ut[_0x469c('0x30')](_0x3ca9ad['message'],_0x4186da,_0x59c1d9);}})[_0x469c('0x4e')](function(_0x4a91b2){ut[_0x469c('0x32')](_0x469c('0x104'),_0x4a91b2);throw ut['message'](_0x469c('0x103'),![],!![]);});};Preview[_0x469c('0xe')][_0x469c('0xff')]=function(_0x500c35){if(_[_0x469c('0x3f')](_0x500c35)||_[_0x469c('0xea')](_0x500c35)||!_[_0x469c('0x3f')](_0x500c35[0x0][_0x469c('0x5b')])&&_[_0x469c('0x3f')](_0x500c35[0x0][_0x469c('0x5b')][_0x469c('0x33')])){ut[_0x469c('0x32')]('[Preview][validateContact][Empty\x20Contact]',_0x500c35);return{'isValid':![],'message':'Empty\x20Contact'};}var _0x2ed208=this[_0x469c('0x13')][_0x500c35[0x0]['Queue'][_0x469c('0x33')]];_0x2ed208['message']=utils[_0x469c('0x31')][_0x469c('0x73')];if(_['isNil'](_0x2ed208)){ut['logger'](_0x469c('0x105'),_0x2ed208);return{'isValid':![],'message':_0x469c('0x106')};}if(!this['isTrunkReachable'](_0x2ed208[_0x469c('0x71')])){ut[_0x469c('0x32')](_0x469c('0x107'),'campaign\x20Name:\x20'+_0x2ed208[_0x469c('0x33')]+_0x469c('0x108'));if(!this['isTrunkReachable'](_0x2ed208['TrunkBackup'])){ut['logger'](_0x469c('0x107'),_0x2ed208[_0x469c('0x33')]+_0x469c('0x109'));return{'isValid':![],'message':_0x469c('0x10a')};}}if(!ut[_0x469c('0x10b')](_0x2ed208[_0x469c('0x6e')])){ut['logger'](_0x469c('0x10c'),_0x2ed208[_0x469c('0x33')]+_0x469c('0x10d'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x2ed208[_0x469c('0x33')]+_0x469c('0x10d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x469c('0xe')]['execCall']=function(_0x423b2f,_0x2ca937,_0x617126,_0x5e0653){var _0x3ab2f0=this;return new Promise(function(_0x13eab2,_0x49606){var _0x2885d7=_0x423b2f[_0x469c('0x88')];var _0x188775=_0x3ab2f0[_0x469c('0x70')](_0x2ca937['Trunk'])?util['format'](_0x469c('0x10e'),_0x2ca937[_0x469c('0x71')]['name'],_[_0x469c('0x3f')](_0x2ca937[_0x469c('0x10f')])?'':_0x2ca937[_0x469c('0x10f')]['trim']()||'',_0x2ca937[_0x469c('0x110')]>0x0?_0x617126[_0x469c('0xe7')]['substring'](_0x2ca937[_0x469c('0x110')]):_0x617126[_0x469c('0xe7')]):util[_0x469c('0x28')]('SIP/%s/%s%s',_[_0x469c('0x3f')](_0x2ca937['TrunkBackup'])?_0x2ca937[_0x469c('0x71')][_0x469c('0x33')]:_0x2ca937[_0x469c('0x72')]['name'],_[_0x469c('0x3f')](_0x2ca937[_0x469c('0x10f')])?'':_0x2ca937['dialPrefix'][_0x469c('0x111')]()||'',_0x2ca937[_0x469c('0x110')]>0x0?_0x617126[_0x469c('0xe7')][_0x469c('0x112')](_0x2ca937['dialCutDigit']):_0x617126[_0x469c('0xe7')]);var _0x110789=_0x3ab2f0['isTrunkReachable'](_0x2ca937[_0x469c('0x71')])?ut['getCallerId'](_0x2ca937[_0x469c('0x71')]['callerid'],_0x2ca937[_0x469c('0x113')],_0x2ca937['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x469c('0x114')](_0x2ca937[_0x469c('0x115')],_0x2ca937['dialRandomLastDigitCallerIdNumber']):_0x2ca937[_0x469c('0x115')]):ut[_0x469c('0x116')](_['isNil'](_0x2ca937[_0x469c('0x72')])?_0x2ca937[_0x469c('0x71')][_0x469c('0x117')]:_0x2ca937[_0x469c('0x72')][_0x469c('0x117')],_0x2ca937[_0x469c('0x113')],_0x2ca937['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x469c('0x114')](_0x2ca937[_0x469c('0x115')],_0x2ca937['dialRandomLastDigitCallerIdNumber']):_0x2ca937[_0x469c('0x115')]);if(_0x110789){_0x423b2f[_0x469c('0x118')]=ut['extractCalleridName'](_0x110789);_0x423b2f[_0x469c('0x119')]=ut['extractCalleridNumber'](_0x110789);}var _0x148581=ut[_0x469c('0x11a')](_0x2ca937,_0x617126,_0x188775,_0x110789,_0x2885d7,_0x423b2f);var _0x1d94f8=utils[_0x469c('0x11b')](_0x617126[_0x469c('0xe6')]);Object['assign'](_0x148581,_0x1d94f8);_[_0x469c('0x11c')](_0x423b2f,ut[_0x469c('0x11d')](_0x148581));_0x423b2f[_0x469c('0x61')]=moment()[_0x469c('0x28')](_0x469c('0x62'));_0x2ca937[_0x469c('0x11e')]=_0x148581;var _0x2aefe8=ut[_0x469c('0x11f')](_0x423b2f,_0x2ca937,_0x148581,_0x423b2f[_0x469c('0xaf')],_0x5e0653);return ami[_0x469c('0x4b')](_0x2aefe8)[_0x469c('0x57')](function(_0x4adc65){_0x2ca937['originated']+=0x1;logger[_0x469c('0x25')]('[originated][increment]',_0x2885d7,_0x469c('0x89'),_0x2ca937['name'],_0x469c('0x44'),_0x2ca937[_0x469c('0x2d')]);_0x13eab2(_0x4adc65);})[_0x469c('0x4e')](function(_0x1cb8f0){ut[_0x469c('0xdb')](_0x423b2f,0xe,'OriginateError');rpcDb[_0x469c('0xdd')](_0x423b2f,'[originateFailure][logOriginateFailure]');_0x49606(_0x1cb8f0);});});};Preview[_0x469c('0xe')]['syncNewExten']=function(_0x22cee9){if(this['actions'][_0x22cee9[_0x469c('0x82')]]){this[_0x469c('0x40')][_0x22cee9[_0x469c('0x82')]][_0x469c('0x4d')]=_0x22cee9['channel'];}};Preview['prototype'][_0x469c('0x18')]=function(_0x2670cb){var _0x30d1d8=this;var _0x34fa51=this['actions'][_0x2670cb[_0x469c('0x120')]];if(_0x34fa51){if(_0x34fa51['lookAgent']&&this['agents'][_0x34fa51['lookAgent']]){ut[_0x469c('0x121')](_0x34fa51,this['agents'][_0x34fa51['lookAgent']][_0x469c('0x33')],this[_0x469c('0x15')][_0x34fa51[_0x469c('0xe9')]]['id']);}var _0x2c8f61=_[_0x469c('0x122')](_0x34fa51);_0x2c8f61[_0x469c('0x123')]=moment()[_0x469c('0x28')](_0x469c('0x62'));var _0x2fbc01=_0x30d1d8[_0x469c('0x13')][_0x34fa51[_0x469c('0x43')]];if(ut[_0x469c('0x124')](_0x2670cb['response'])){if(_0x34fa51[_0x469c('0x81')]){rpcDb['unlockContact'](_0x34fa51[_0x469c('0xa6')]);}if(_0x34fa51['activeContact']){rpcDb['disableContact'](_0x34fa51[_0x469c('0xa6')]);}ami[_0x469c('0x24')](_0x469c('0x125'),ut[_0x469c('0x78')](_0x34fa51,'rejected',this[_0x469c('0x13')][_0x34fa51[_0x469c('0x43')]]));this['callProgressDetectingAgent'](_0x2c8f61,_0x2fbc01,_0x2670cb);}else{_0x34fa51[_0x469c('0x61')]=moment()[_0x469c('0x28')](_0x469c('0x62'));ut[_0x469c('0xdb')](_0x2c8f61,0x4,_0x469c('0x94'));rpcDb[_0x469c('0xdd')](_0x2c8f61,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x469c('0xe')]['syncHangup']=function(_0x44cd13){var _0x5c2d6d=this['actions'][_0x44cd13[_0x469c('0x82')]];var _0x2ca196;if(_0x5c2d6d){_0x2ca196=this[_0x469c('0x13')][_0x5c2d6d[_0x469c('0x43')]];logger['info'](_0x469c('0x126'),_0x44cd13[_0x469c('0x82')],_0x469c('0x89'),_0x2ca196[_0x469c('0x33')],_0x469c('0x45'),_0x2ca196[_0x469c('0x46')]);}if(this[_0x469c('0x40')][_0x44cd13['linkedid']]&&_0x44cd13[_0x469c('0x82')]!==_0x44cd13[_0x469c('0x88')]){if(_0x44cd13[_0x469c('0x127')]==='16'&&this[_0x469c('0x40')][_0x44cd13[_0x469c('0x82')]][_0x469c('0x47')]){this[_0x469c('0x128')](_0x44cd13,_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')]);}else if(this[_0x469c('0x40')][_0x44cd13[_0x469c('0x82')]]['dialAnswer']){logger[_0x469c('0x25')]('[syncHangup][talking][cause]',_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')],'\x20Queue',_0x2ca196['name'],_0x469c('0x45'),_0x2ca196[_0x469c('0x46')]);this[_0x469c('0x128')](_0x44cd13,_0x44cd13['linkedid'],_0x44cd13[_0x469c('0x127')]);}}else if(_0x5c2d6d&&_[_0x469c('0x3f')](_0x5c2d6d[_0x469c('0x129')])&&_0x2ca196[_0x469c('0x12a')]&&_0x44cd13[_0x469c('0x82')]===_0x44cd13[_0x469c('0x88')]&&_['isNil'](_0x44cd13[_0x469c('0xda')])&&_0x44cd13['cause']==='16'&&_0x44cd13[_0x469c('0x12b')]==='6'&&_[_0x469c('0xd8')](_0x5c2d6d['transfer'])){if(_0x5c2d6d[_0x469c('0x81')]){rpcDb[_0x469c('0xfb')](_0x5c2d6d[_0x469c('0xa6')]);}if(_0x5c2d6d[_0x469c('0xaf')]){rpcDb['disableContact'](_0x5c2d6d[_0x469c('0xa6')]);}_0x44cd13[_0x469c('0xda')]='22';this[_0x469c('0xd7')](_0x5c2d6d,_0x2ca196,_0x44cd13);}else if(_0x5c2d6d&&_0x5c2d6d['transfer']){if(_0x44cd13[_0x469c('0x127')]==='16'&&this['actions'][_0x44cd13[_0x469c('0x82')]]['dialAnswer']){logger[_0x469c('0x25')](_0x469c('0x12c'),_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')],'\x20Queue',_0x2ca196['name'],_0x469c('0x45'),_0x2ca196['pTalking']);this[_0x469c('0x128')](_0x44cd13,_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')]);}else if(this['actions'][_0x44cd13[_0x469c('0x82')]][_0x469c('0x47')]){logger[_0x469c('0x25')]('[syncHangup][talking][cause]',_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')],_0x469c('0x89'),_0x2ca196[_0x469c('0x33')],_0x469c('0x45'),_0x2ca196[_0x469c('0x46')]);this[_0x469c('0x128')](_0x44cd13,_0x44cd13[_0x469c('0x82')],_0x44cd13[_0x469c('0x127')]);}}};Preview[_0x469c('0xe')][_0x469c('0x1d')]=function(_0x3aa548){if(this[_0x469c('0x40')][_0x3aa548[_0x469c('0xd5')]]&&_0x3aa548[_0x469c('0xd5')]!==_0x3aa548[_0x469c('0x12d')]){this[_0x469c('0x128')](_0x3aa548,_0x3aa548[_0x469c('0xd5')],_0x3aa548[_0x469c('0xc9')]);}};Preview[_0x469c('0xe')]['syncHangupRequest']=function(_0x542eb4){if(this[_0x469c('0x40')][_0x542eb4['linkedid']]&&_0x542eb4['linkedid']!==_0x542eb4[_0x469c('0x88')]&&!this[_0x469c('0x40')][_0x542eb4[_0x469c('0x82')]][_0x469c('0x47')]){if(_0x542eb4[_0x469c('0x127')]==='1'){this[_0x469c('0x128')](_0x542eb4,_0x542eb4[_0x469c('0x82')],_0x542eb4[_0x469c('0x127')]);}}};Preview[_0x469c('0xe')][_0x469c('0x12e')]=function(_0x30e97c,_0x2863d6,_0x537b4f){if(this['actions'][_0x30e97c]){if(_['isNil'](this[_0x469c('0x40')][_0x30e97c][_0x469c('0x11e')])){this['actions'][_0x30e97c][_0x469c('0x11e')]={};}this[_0x469c('0x40')][_0x30e97c][_0x469c('0x11e')][_0x2863d6]=_0x537b4f;}};Preview[_0x469c('0xe')][_0x469c('0x12f')]=function(_0xde7253){try{if(!_['isNil'](_0xde7253)){if(ut[_0x469c('0x130')](_[_0x469c('0x131')](_0xde7253[_0x469c('0x132')])[0x0])){this[_0x469c('0x12e')](_0xde7253[_0x469c('0x88')],_[_0x469c('0x131')](_0xde7253['variable'])[0x0],_0xde7253[_0x469c('0x133')]);}}}catch(_0x5461a3){logger[_0x469c('0x134')](_0x469c('0x135'),util[_0x469c('0x136')](_0x5461a3,{'showHidden':![],'depth':null}));}};Preview['prototype'][_0x469c('0x21')]=function(_0xffe076){if(_0xffe076){if(this[_0x469c('0x40')][_0xffe076[_0x469c('0x137')]]){this[_0x469c('0x40')][_0xffe076['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x469c('0xe')][_0x469c('0x138')]=function(_0x52968e){if(_0x52968e){if(this['actions'][_0x52968e[_0x469c('0x139')]]){this[_0x469c('0x40')][_0x52968e[_0x469c('0x139')]][_0x469c('0x13a')]=!![];}}};module[_0x469c('0x13b')]=Preview; \ No newline at end of file +var _0x75e3=['dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','cause-txt','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalking][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','isUndefined','object','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','checkInBlack','Contact','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','called','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','active','SIP/%s','reachable','execRun','unlock','recallme','validateContact','isValid','phone','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','\x20Not\x20Active','Is\x20Valid','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','assign','merge','toLowerVariables','YYYY-MM-DD\x20HH:mm:ss','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','clone','unlockContact','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','destuniqueid','addVariable','variables','keys','variable','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','moment','ioredis','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','socket.io-emitter','prototype','enqueue','tail','finally','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','campaignsPreview','emit','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','available','message','CAMPAIGN_STATUS','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','DEACTIVATED','logger','\x20is\x20deactivated','loopCampaigns','syncCampaigns','preview','dialMethod','booked','type','outbound','clearZombieChannels','hasOwnProperty','dialActive','setMessage','dialPreviewAutoRecallMe','sequence','info','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','Action','status','channel','catch','No\x20such\x20channel','decrementOriginate','[clearZombieChannel]','loggerError','[Dialer][checkChannel][Preview]','[action]','clearZombieChannel','recallMe','getContactRecallMe','agentReadyId','isNil','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','format','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','loggedIn','isActive','INACTIVE','isTrunkReachable','Trunk','TrunkBackup','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','dialNoSuchNumberMaxRetry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','linkedid','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking','custom:agentconnect','connect','acw','mandatoryDisposition','channelAgent','custom:agentcomplete','complete','outboundAnswerCallsDay','total','decrementTalking','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','[syncHangup][talking][decrement]','BUSY','outboundBusyCallsDay','countbusyretry','Busy','[callProgressDetectingCustomer][logBusy]','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','unlockAgent','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','countnoanswerretry','activeContact','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','CANCEL','outboundRejectCallsDay','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','countabandonedretry','dialAbandonedRetryFrequency','outboundUnknownCallsDay'];(function(_0x6662d9,_0x1055a5){var _0x556686=function(_0x1c6e7e){while(--_0x1c6e7e){_0x6662d9['push'](_0x6662d9['shift']());}};_0x556686(++_0x1055a5);}(_0x75e3,0x1b0));var _0x375e=function(_0x37ed96,_0x2a7a7a){_0x37ed96=_0x37ed96-0x0;var _0x53ed4d=_0x75e3[_0x37ed96];return _0x53ed4d;};'use strict';var util=require(_0x375e('0x0'));var _=require(_0x375e('0x1'));var uuid=require(_0x375e('0x2'));var moment=require(_0x375e('0x3'));var Redis=require(_0x375e('0x4'));var config=require('../../../config/environment');var logger=require(_0x375e('0x5'))('preview');var loggerAction=require('../../../config/logger')(_0x375e('0x6'));var ami=require(_0x375e('0x7'));var rpcDb=require(_0x375e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x375e('0x9'));var ut=require(_0x375e('0xa'));var utils=require(_0x375e('0xb'));config['redis']=_['defaults'](config[_0x375e('0xc')],{'host':'localhost','port':0x18eb});var io=require(_0x375e('0xd'))(new Redis(config[_0x375e('0xc')]));var Sequence=function(){};Sequence[_0x375e('0xe')][_0x375e('0xf')]=function(_0x92e865){this[_0x375e('0x10')]=this[_0x375e('0x10')]?this[_0x375e('0x10')][_0x375e('0x11')](_0x92e865):_0x92e865();};function Preview(_0x283927){this['sequence']=new Sequence();this['campaignsPreview']=_0x283927[_0x375e('0x12')];this[_0x375e('0x13')]=_0x283927[_0x375e('0x13')];this[_0x375e('0x14')]={};this[_0x375e('0x15')]=_0x283927['agents'];this[_0x375e('0x16')]=0x0;ami['on'](_0x375e('0x17'),this[_0x375e('0x18')][_0x375e('0x19')](this));ami['on'](_0x375e('0x1a'),this[_0x375e('0x1b')][_0x375e('0x19')](this));ami['on'](_0x375e('0x1c'),this[_0x375e('0x1d')]['bind'](this));ami['on']('dialend',this[_0x375e('0x1e')][_0x375e('0x19')](this));ami['on'](_0x375e('0x1f'),this[_0x375e('0x20')][_0x375e('0x19')](this));ami['on'](_0x375e('0x21'),this[_0x375e('0x22')][_0x375e('0x19')](this));ami['on'](_0x375e('0x23'),this[_0x375e('0x24')][_0x375e('0x19')](this));ami['on'](_0x375e('0x25'),this[_0x375e('0x26')][_0x375e('0x19')](this));this['loopCampaigns'](this[_0x375e('0x27')]);}function emit(_0x13014c,_0x4f8f89,_0xfb8423){io['to'](_0x13014c)[_0x375e('0x28')](_0x4f8f89,_0xfb8423);}function emitVoiceQueueChannelRemove(_0x870736){logger['info'](_0x375e('0x29'),JSON[_0x375e('0x2a')](_0x870736));emit(util['format'](_0x375e('0x2b'),_0x870736[_0x375e('0x2c')]),_0x375e('0x2d'),_0x870736);io[_0x375e('0x28')](_0x375e('0x2e'),_0x870736);}function notSendMessagesQueue(_0x4fc870){if(_0x4fc870[_0x375e('0x2f')]){if(_0x4fc870[_0x375e('0x30')]===0x0&&_0x4fc870['pTalking']===0x0){_0x4fc870[_0x375e('0x2f')]=![];_0x4fc870[_0x375e('0x31')]=0x0;_0x4fc870['paused']=0x0;_0x4fc870[_0x375e('0x32')]=utils[_0x375e('0x33')]['INACTIVE'];ut['logger'](_0x375e('0x34'),_0x4fc870[_0x375e('0x2c')]+_0x375e('0x35'));}else{_0x4fc870['message']=utils[_0x375e('0x33')][_0x375e('0x36')];ut[_0x375e('0x37')](_0x375e('0x34'),_0x4fc870['name']+_0x375e('0x38'));}}}Preview[_0x375e('0xe')][_0x375e('0x39')]=function(){var _0x1c165b=this;setInterval(function(){_0x1c165b[_0x375e('0x3a')]();},0x7cf);};Preview[_0x375e('0xe')][_0x375e('0x3a')]=function(){var _0x5dceb3=this[_0x375e('0x27')];this[_0x375e('0x16')]+=0x1;for(var _0x15c719 in _0x5dceb3){if(_0x5dceb3['hasOwnProperty'](_0x15c719)&&(_0x5dceb3[_0x15c719]['dialMethod']===_0x375e('0x3b')||_0x5dceb3[_0x15c719][_0x375e('0x3c')]===_0x375e('0x3d'))&&_0x5dceb3[_0x15c719][_0x375e('0x3e')]===_0x375e('0x3f')){if(this[_0x375e('0x16')]>0x7){this[_0x375e('0x16')]=0x0;this[_0x375e('0x40')]();}}if(_0x5dceb3[_0x375e('0x41')](_0x15c719)&&_0x5dceb3[_0x15c719][_0x375e('0x3c')]===_0x375e('0x3b')&&_0x5dceb3[_0x15c719]['type']==='outbound'){if(_0x5dceb3[_0x15c719][_0x375e('0x42')]){this[_0x375e('0x43')](_0x5dceb3[_0x15c719]);if(_0x5dceb3[_0x15c719][_0x375e('0x44')])this['recallMe'](_0x5dceb3[_0x15c719]);}else{notSendMessagesQueue(_0x5dceb3[_0x15c719]);}}}};Preview[_0x375e('0xe')]['clearZombieChannel']=function(_0x33378b){var _0x31541e=this;this[_0x375e('0x45')][_0x375e('0xf')](function(){if(!_['isNil'](_0x31541e[_0x375e('0x14')][_0x33378b])){loggerAction[_0x375e('0x46')](_0x375e('0x47'),_0x33378b,_0x375e('0x48'),_0x31541e['actions'][_0x33378b][_0x375e('0x49')],_0x375e('0x4a'),JSON[_0x375e('0x2a')](_0x31541e[_0x375e('0x27')][_0x31541e['actions'][_0x33378b][_0x375e('0x49')]][_0x375e('0x30')]),_0x375e('0x4b'),JSON[_0x375e('0x2a')](_0x31541e[_0x375e('0x27')][_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]]['pTalking']),JSON[_0x375e('0x2a')](_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x4c')]),JSON[_0x375e('0x2a')](_[_0x375e('0x4d')](_0x31541e[_0x375e('0x14')][_0x33378b],[_0x375e('0x4e'),_0x375e('0x4f'),_0x375e('0x50'),'ListId'])));return ami[_0x375e('0x51')]({'action':_0x375e('0x52'),'channel':_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x53')]})[_0x375e('0x54')](function(_0x595850){if(_0x595850[_0x375e('0x32')]===_0x375e('0x55')){setTimeout(function(){if(_0x31541e[_0x375e('0x14')][_0x33378b]){utils[_0x375e('0x56')](_0x31541e['campaignsPreview'][_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]],_0x375e('0x57'));if(_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x4c')]===!![]){ut['decrementTalking'](_0x31541e[_0x375e('0x27')][_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]],_0x375e('0x57'));ut['loggerError']('[Dialer][checkChannel][pTalking][Preview]'+_0x33378b,_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]);}ut[_0x375e('0x58')](_0x375e('0x59')+_0x33378b,_0x31541e[_0x375e('0x14')][_0x33378b][_0x375e('0x49')]);delete _0x31541e['actions'][_0x33378b];}},0x2328);}});}});};Preview[_0x375e('0xe')][_0x375e('0x40')]=function(){var _0x5e73f1=this;loggerAction[_0x375e('0x46')](_0x375e('0x5a'),_['size'](this['actions']));for(var _0x32beca in this[_0x375e('0x14')]){if(_0x5e73f1[_0x375e('0x14')][_0x375e('0x41')](_0x32beca)){_0x5e73f1[_0x375e('0x5b')](_0x32beca);}}};Preview[_0x375e('0xe')][_0x375e('0x5c')]=function(_0x25e9b3){var _0xeba5fa=this;rpcDb[_0x375e('0x5d')](_0x25e9b3['id'],ut[_0x375e('0x5e')](this[_0x375e('0x15')]))['then'](function(_0x58826e){if(!_[_0x375e('0x5f')](_0x58826e)){for(var _0x44688b=0x0;_0x44688b<_0x58826e[_0x375e('0x60')];_0x44688b+=0x1){if(ut[_0x375e('0x61')](_0x58826e[_0x44688b][_0x375e('0x62')])<_0x25e9b3[_0x375e('0x63')]*0x3c){if(_0x58826e[_0x44688b][_0x375e('0x64')]&&!_0x58826e[_0x44688b][_0x375e('0x64')][_0x375e('0x65')]){_0xeba5fa[_0x375e('0x66')](_0x58826e[_0x44688b]['id'])[_0x375e('0x67')](ut[_0x375e('0x68')](_0x375e('0x69')))[_0x375e('0x54')](ut[_0x375e('0x68')]('[RecallMe]'));}else{rpcDb[_0x375e('0x6a')](_0x58826e[_0x44688b]['id']);}}else{var _0x5e5664=new Action(_0x58826e[_0x44688b],_0x25e9b3);_0x5e5664[_0x375e('0x6b')]=moment()[_0x375e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0x25e9b3['outboundReCallsDay']+=0x1;ut[_0x375e('0x6d')](_0x5e5664,0x17,_0x375e('0x6e'));if(_0x25e9b3[_0x375e('0x6f')]){rpcDb[_0x375e('0x70')](ut[_0x375e('0x71')](_0x58826e[_0x44688b]));rpcDb[_0x375e('0x72')](_0x5e5664,'[HistoryDialRecallInQueue][historyCatch]');}else{ut['logCustomer'](_0x5e5664,0x16,'RecallFailedTimeout');rpcDb[_0x375e('0x72')](_0x5e5664,'[HistoryRecallClose]');rpcDb[_0x375e('0x73')](_0x5e5664,'[HistoryRecallClose]');}}}}})['catch'](ut['logger2'](_0x375e('0x74')));};Preview['prototype'][_0x375e('0x43')]=function(_0x1baf71){_0x1baf71[_0x375e('0x2f')]=!![];if(ut[_0x375e('0x75')](_0x1baf71[_0x375e('0x76')])){_0x1baf71[_0x375e('0x32')]=utils[_0x375e('0x33')]['NO_AGENTS_LOGGED'];}else if(!ut[_0x375e('0x77')](_0x1baf71[_0x375e('0x42')])){_0x1baf71['message']=utils[_0x375e('0x33')][_0x375e('0x78')];}else if(!this[_0x375e('0x79')](_0x1baf71[_0x375e('0x7a')])){if(!this[_0x375e('0x79')](_0x1baf71[_0x375e('0x7b')])){_0x1baf71[_0x375e('0x32')]=utils[_0x375e('0x33')][_0x375e('0x7c')];}else{_0x1baf71[_0x375e('0x32')]=utils[_0x375e('0x33')]['ACTIVE'];}}else{_0x1baf71[_0x375e('0x32')]=utils['CAMPAIGN_STATUS'][_0x375e('0x7d')];}};Preview[_0x375e('0xe')][_0x375e('0x7e')]=function(_0x5b5bb9,_0x36f775,_0x450069){var _0x419ba6=this;var _0x14d479=this['actions'][_0x36f775];var _0x3ade1c=this[_0x375e('0x27')][_0x14d479['queue']];var _0x1e9dd2;var _0x4f1cd0=![];var _0x2e4c6d=0x2;var _0x3fb22b=0x3;if(_0x3ade1c){switch(_0x450069){case'1':_0x3ade1c['outboundNoSuchCallsDay']+=0x1;_0x14d479[_0x375e('0x7f')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x0,'NoSuchNumber');ami['emit']('custom:agentnosuchnumber',ut[_0x375e('0x82')](_0x14d479,_0x375e('0x83')));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0x84'));_0x419ba6[_0x375e('0x85')](_0x14d479,'0',_0x3ade1c)[_0x375e('0x67')](function(_0x3851f7){_0x4f1cd0=_0x3851f7[_0x375e('0x86')]==0x1;_0x2e4c6d=_0x3ade1c[_0x375e('0x87')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,'Global');rpcDb['createCustomerFinal'](_0x1e9dd2,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x14d479['countnosuchnumberretry']>=_0x3ade1c[_0x375e('0x8b')]){rpcDb[_0x375e('0x73')](_0x14d479,_0x375e('0x8c'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,'countnosuchnumberretry',_0x3ade1c[_0x375e('0x87')]),_0x14d479['unlockAgent'],_0x14d479['activeContact']);}}delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];}else{_0x14d479[_0x375e('0x7f')]++;logger[_0x375e('0x46')](_0x375e('0x90'),_0x14d479[_0x375e('0x7f')]);logger[_0x375e('0x46')]('id',_0x14d479[_0x375e('0x91')]);_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnosuchnumberretry':_0x14d479[_0x375e('0x7f')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0x94'):var _0x1d5d06=moment()[_0x375e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');_0x14d479[_0x375e('0x95')]=_0x1d5d06;_0x14d479['answertime']=_0x1d5d06;_0x14d479[_0x375e('0x4c')]=!![];_0x3ade1c['pTalking']+=0x1;logger[_0x375e('0x46')](_0x375e('0x96'),_0x14d479[_0x375e('0x97')],_0x375e('0x98'),_0x3ade1c[_0x375e('0x2c')],_0x375e('0x4b'),_0x3ade1c[_0x375e('0x99')]);ami[_0x375e('0x28')](_0x375e('0x9a'),ut['buildObj'](_0x14d479,_0x375e('0x9b'),this[_0x375e('0x27')][_0x14d479[_0x375e('0x49')]]));if(_0x3ade1c[_0x375e('0x9c')]||_0x3ade1c[_0x375e('0x9d')]){ami[_0x375e('0x28')]('custom:agentConnectPreview',{'queue':_0x14d479[_0x375e('0x49')],'interface':_0x14d479[_0x375e('0x9e')],'uniqueid':_0x14d479[_0x375e('0x97')]});}break;case'16':ami[_0x375e('0x28')](_0x375e('0x9f'),ut[_0x375e('0x82')](_0x14d479,_0x375e('0xa0'),this[_0x375e('0x27')][_0x14d479[_0x375e('0x49')]]));emitVoiceQueueChannelRemove(ut[_0x375e('0x82')](_0x14d479,_0x375e('0xa0')));_0x3ade1c[_0x375e('0xa1')]+=0x1;_0x3ade1c[_0x375e('0xa2')]+=0x1;_0x3ade1c['answered']+=0x1;ut[_0x375e('0xa3')](_0x3ade1c,_0x375e('0xa4'));_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x4,_0x375e('0xa5'));rpcDb['createCustomerHistory'](_0x14d479,_0x375e('0xa6'));rpcDb[_0x375e('0x73')](_0x14d479,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x375e('0xa7')](_0x14d479);_0x3ade1c[_0x375e('0xa8')]+=_0x14d479['talktime'];_0x3ade1c['sumBillable']+=_0x14d479['talktime'];logger[_0x375e('0x46')](_0x375e('0xa9'),_0x14d479[_0x375e('0x97')],_0x375e('0x98'),_0x3ade1c[_0x375e('0x2c')],_0x375e('0x4b'),_0x3ade1c[_0x375e('0x99')]);delete this[_0x375e('0x14')][_0x5b5bb9['linkedid']];break;case _0x375e('0xaa'):_0x3ade1c[_0x375e('0xab')]+=0x1;_0x14d479[_0x375e('0xac')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x5,_0x375e('0xad'));_0x2e4c6d=_0x3ade1c['dialBusyRetryFrequency'];_0x3fb22b=_0x3ade1c['callAdditionalPhoneAfterMin'];ami[_0x375e('0x28')]('custom:agentbusy',ut[_0x375e('0x82')](_0x14d479,'busy'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xae'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'5',_0x3ade1c)[_0x375e('0x67')](function(_0x4bc6a4){_0x4f1cd0=_0x4bc6a4['additional']==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xb0'));}else{if(_0x14d479[_0x375e('0xac')]>=_0x3ade1c[_0x375e('0xb1')]){rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xae'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xac'),_0x3ade1c[_0x375e('0xb2')]),_0x14d479[_0x375e('0xb3')],_0x14d479['activeContact']);}}}else{_0x14d479[_0x375e('0xac')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countbusyretry':_0x14d479[_0x375e('0xac')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0xb4'):_0x3ade1c[_0x375e('0xb5')]+=0x1;_0x14d479['countnoanswerretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x3,_0x375e('0xb6'));_0x2e4c6d=_0x3ade1c[_0x375e('0xb7')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];var _0x3ff21c=ut[_0x375e('0xb8')](_0x14d479,_0x3ade1c);ami[_0x375e('0x28')]('custom:agentnoanswer',_0x3ff21c);rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xb9'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'3',_0x3ade1c)[_0x375e('0x67')](function(_0x195ee3){_0x4f1cd0=_0x195ee3[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c['dialGlobalMaxRetry']){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xba'));}else{if(_0x14d479[_0x375e('0xbb')]>=_0x3ade1c['dialNoAnswerMaxRetry']){rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xb9'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xbb'),_0x3ade1c[_0x375e('0xb7')]),_0x14d479[_0x375e('0xb3')],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479[_0x375e('0xbb')]}})['then'](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0xbd'):_0x3ade1c[_0x375e('0xbe')]+=0x1;_0x14d479[_0x375e('0xbf')]+=0x1;_0x14d479[_0x375e('0x80')]=ut['totalGlobal'](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x8,_0x375e('0xc0'));_0x2e4c6d=_0x3ade1c[_0x375e('0xc1')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];ami['emit'](_0x375e('0xc2'),ut[_0x375e('0x82')](_0x14d479,_0x375e('0xc3')));rpcDb['createCustomerHistory'](_0x14d479,_0x375e('0xc4'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'8',_0x3ade1c)[_0x375e('0x67')](function(_0x31a3a9){_0x4f1cd0=_0x31a3a9[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xc5'));}else{if(_0x14d479[_0x375e('0xbf')]>=_0x3ade1c[_0x375e('0xc6')]){rpcDb[_0x375e('0x73')](_0x14d479,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xbf'),_0x3ade1c['dialBusyRetryFrequency']),_0x14d479[_0x375e('0xb3')],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbf')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countcongestionretry':_0x14d479[_0x375e('0xbf')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case _0x375e('0xc7'):_0x3ade1c[_0x375e('0xc8')]+=0x1;_0x14d479['countagentrejectretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x14,'AgentReject');_0x2e4c6d=_0x3ade1c['dialAgentRejectRetryFrequency'];_0x3fb22b=_0x3ade1c['callAdditionalPhoneAfterMin'];ami[_0x375e('0x28')](_0x375e('0xc9'),ut[_0x375e('0x82')](_0x14d479,_0x375e('0xca')));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xcb'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'20',_0x3ade1c)[_0x375e('0x67')](function(_0x3d76b7){_0x4f1cd0=_0x3d76b7[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0x14,'AgentReject');rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xcc'));}else{if(_0x14d479[_0x375e('0xcd')]>=_0x3ade1c['dialAgentRejectMaxRetry']){rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xcc'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xcd'),_0x3ade1c[_0x375e('0xce')]),_0x14d479[_0x375e('0xb3')],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479[_0x375e('0xbb')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)['then'](function(){});});}});break;case _0x375e('0xcf'):_0x3ade1c[_0x375e('0xd0')]+=0x1;_0x14d479['countabandonedretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut['totalGlobal'](_0x14d479);ut['logCustomer'](_0x14d479,0xb,_0x375e('0xd1'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xd2'));_0x419ba6[_0x375e('0x85')](_0x14d479,'11',_0x3ade1c)[_0x375e('0x67')](function(_0x452d5f){_0x4f1cd0=_0x452d5f[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c['dialGlobalMaxRetry']){_0x1e9dd2=ut['cloneAction'](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xd2'));}else{if(_0x14d479[_0x375e('0xd3')]>=_0x3ade1c[_0x375e('0xd4')]){rpcDb[_0x375e('0x73')](_0x14d479,_0x375e('0xd2'));}else{rpcDb[_0x375e('0x8d')](ut[_0x375e('0x8e')](_0x14d479,_0x375e('0xd5'),_0x3ade1c[_0x375e('0xd6')]),_0x14d479['unlockAgent'],_0x14d479[_0x375e('0xbc')]);}}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479[_0x375e('0xbb')]}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});break;case'18':_0x3ade1c[_0x375e('0xd7')]+=0x1;_0x14d479['countmachineretry']+=0x1;_0x14d479[_0x375e('0x80')]=ut['totalGlobal'](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0x12,_0x5b5bb9['cause-txt']||_0x5b5bb9[_0x375e('0xd8')]);ami[_0x375e('0x28')](_0x375e('0xd9'),ut[_0x375e('0x82')](_0x14d479,'amd'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xda'));_0x419ba6[_0x375e('0x85')](_0x14d479,'18',_0x3ade1c)[_0x375e('0x67')](function(_0x3d6fe2){_0x4f1cd0=_0x3d6fe2[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0x12,'Global');rpcDb[_0x375e('0x73')](_0x1e9dd2,'[callProgressDetectingCustomer][hangupInAMD]');}else{rpcDb[_0x375e('0x73')](_0x14d479,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479['countnoanswerretry']}})['then'](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)['then'](function(){});});}});delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];break;case'19':_0x3ade1c[_0x375e('0xd7')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut['logCustomer'](_0x14d479,0x13,_0x5b5bb9[_0x375e('0xdb')]||_0x5b5bb9[_0x375e('0xd8')]);ami['emit'](_0x375e('0xd9'),ut['buildObj'](_0x14d479,'amd'));rpcDb[_0x375e('0x72')](_0x14d479,_0x375e('0xdc'));_0x419ba6['verifyAdditionalPhones'](_0x14d479,'18',_0x3ade1c)[_0x375e('0x67')](function(_0x4ba5c4){_0x4f1cd0=_0x4ba5c4[_0x375e('0x86')]==0x1;if(!_0x4f1cd0){if(ut['totalGlobal'](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,_0x375e('0xaf'));rpcDb[_0x375e('0x73')](_0x1e9dd2,_0x375e('0xdc'));}else{rpcDb[_0x375e('0x73')](_0x14d479,_0x375e('0xdc'));}}else{_0x14d479[_0x375e('0xbb')]++;_0x419ba6[_0x375e('0x92')]({'id':_0x14d479[_0x375e('0x91')],'field':{'countnoanswerretry':_0x14d479['countnoanswerretry']}})[_0x375e('0x67')](function(){_0x419ba6[_0x375e('0x93')](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});});}});delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];break;default:if(_0x14d479[_0x375e('0x4c')]){ut[_0x375e('0xa3')](_0x3ade1c,'[default]');ut['loggerError'](_0x375e('0xdd')+_0x3ade1c[_0x375e('0x2c')],_0x5b5bb9);}_0x3ade1c[_0x375e('0xd7')]+=0x1;_0x14d479[_0x375e('0x80')]=ut[_0x375e('0x81')](_0x14d479);ut[_0x375e('0x6d')](_0x14d479,0xc,_0x5b5bb9['cause-txt']||_0x5b5bb9[_0x375e('0xd8')]);_0x2e4c6d=_0x3ade1c[_0x375e('0xce')];_0x3fb22b=_0x3ade1c[_0x375e('0x88')];rpcDb[_0x375e('0x72')](_0x14d479,'[callProgressDetectingCustomer][logUnknown]');_0x419ba6[_0x375e('0x85')](_0x14d479,'20',_0x3ade1c)[_0x375e('0x67')](function(_0x249202){_0x4f1cd0=_0x249202['additional']==0x1;if(!_0x4f1cd0){if(ut[_0x375e('0x81')](_0x14d479)>=_0x3ade1c[_0x375e('0x89')]){_0x1e9dd2=ut[_0x375e('0x8a')](_0x14d479,0xf,'Global');rpcDb[_0x375e('0x73')](_0x1e9dd2,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x14d479,_0x375e('0xde'));}delete this['actions'][_0x5b5bb9[_0x375e('0x8f')]];}else{_0x419ba6['swapAdditionalPhones'](_0x14d479,_0x2e4c6d,_0x3fb22b)[_0x375e('0x67')](function(){});}});}if(!(_0x14d479['dialAnswer']&&_0x450069==='16')){utils[_0x375e('0x56')](_0x3ade1c,_0x375e('0xdf'));logger[_0x375e('0x46')]('[originated][decrement][callProgressDetectingCustomer]',_0x14d479[_0x375e('0x97')],_0x375e('0x98'),_0x3ade1c[_0x375e('0x2c')],_0x375e('0x4a'),_0x3ade1c['originated']);}if(_0x450069!=='ANSWER'){delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0x8f')]];delete this[_0x375e('0x14')][_0x5b5bb9[_0x375e('0xe0')]];}_0x3ade1c[_0x375e('0xe1')]=!![];}};Preview['prototype'][_0x375e('0xe2')]=function(_0x2cdfb5,_0x405b95,_0x3cd6bf){if(_[_0x375e('0xe3')](_0x405b95)&&_0x375e('0xe4')!==typeof _0x405b95){return;}if(_[_0x375e('0xe3')](_0x3cd6bf)&&_0x375e('0xe4')!==typeof _0x3cd6bf){return;}switch(_0x3cd6bf[_0x375e('0xe5')]){case'0':ut[_0x375e('0xe6')](_0x2cdfb5,0x0,'NoSuchNumber');rpcDb['createAgentHistory'](_0x2cdfb5,_0x375e('0xe7'));break;case'3':ut[_0x375e('0xe6')](_0x2cdfb5,0x3,_0x375e('0xb6'));rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xe9'));break;case'5':ut[_0x375e('0xe6')](_0x2cdfb5,0x5,_0x375e('0xad'));rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xea'));break;case'8':ut[_0x375e('0xe6')](_0x2cdfb5,0x8,'Congestion');rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xeb'));break;case'22':ut['logAgent'](_0x2cdfb5,0x16,_0x375e('0xec'));rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xed'));break;default:ut[_0x375e('0xe6')](_0x2cdfb5,0xc,_0x3cd6bf[_0x375e('0xe5')]);rpcDb[_0x375e('0xe8')](_0x2cdfb5,_0x375e('0xeb'));}utils[_0x375e('0x56')](_0x405b95,'[callProgressDetectingAgent]');logger[_0x375e('0x46')](_0x375e('0xee'),_0x2cdfb5[_0x375e('0x97')],_0x375e('0x98'),_0x405b95[_0x375e('0x2c')],'originated:\x20',_0x405b95[_0x375e('0x30')]);delete this[_0x375e('0x14')][_0x2cdfb5[_0x375e('0x97')]];};Preview[_0x375e('0xe')]['verifyAdditionalPhones']=function(_0x5451c1,_0x33c3f1,_0x3b06eb){return cmHopperAdditionalPhone[_0x375e('0x85')](_0x5451c1,_0x33c3f1,_0x3b06eb)[_0x375e('0x54')](logger[_0x375e('0x46')](_0x375e('0xef')));};Preview[_0x375e('0xe')]['swapAdditionalPhones']=function(_0x5d0fe8,_0x2d02eb,_0x4f137c){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x5d0fe8,_0x2d02eb,_0x4f137c)[_0x375e('0x54')](logger[_0x375e('0x46')](_0x375e('0xf0')));};Preview[_0x375e('0xe')][_0x375e('0x92')]=function(_0x5c417d){return Promise[_0x375e('0xf1')]()[_0x375e('0x67')](cmHopperAdditionalPhone[_0x375e('0x92')](_0x5c417d))[_0x375e('0x54')](logger[_0x375e('0x46')](_0x375e('0xf2')));};Preview[_0x375e('0xe')][_0x375e('0xf3')]=function(_0x42afac,_0x61657b,_0x18e7bf,_0x3f6de8,_0x17316f){var _0x5995ab=this;return new Promise(function(_0x36e52e,_0x10879b){if(_[_0x375e('0x5f')](_0x61657b)||_[_0x375e('0x5f')](_0x61657b[_0x375e('0xf4')])||_[_0x375e('0x5f')](_0x61657b['phone'])||_['isNil'](_0x61657b[_0x375e('0x50')])){_0x10879b(ut[_0x375e('0x32')]('Contact\x20is\x20undefined',_0x3f6de8,_0x17316f));return;}var _0xd7bfcb=uuid['v4']();var _0x274274=_0x5995ab['campaignsPreview'][_0x61657b[_0x375e('0x48')][_0x375e('0x2c')]];var _0x5ee062=_0x18e7bf?_0x5995ab[_0x375e('0x15')][_0x18e7bf]['id']:undefined;_0x5995ab[_0x375e('0x14')][_0xd7bfcb]=new Action(_0x61657b,_0x274274,_0xd7bfcb,_0x18e7bf,_0x5ee062);var _0xa31f8=_0x5995ab[_0x375e('0x14')][_0xd7bfcb];_0xa31f8[_0x375e('0xb3')]=_0x3f6de8;_0xa31f8['activeContact']=_0x17316f;_0xa31f8[_0x375e('0xf5')]=_0x18e7bf;if(_[_0x375e('0xf6')](_0x42afac)){_0x5995ab[_0x375e('0xf7')](_0xa31f8,_0x274274,_0x61657b,_0x18e7bf)[_0x375e('0x67')](function(_0x587862){logger[_0x375e('0x46')](_0x375e('0xf8'),_0x375e('0xf9')+_0xa31f8['queue']+_0x375e('0xfa')+_0xa31f8[_0x375e('0x91')],JSON[_0x375e('0x2a')](_0x587862));ami[_0x375e('0x28')](_0x375e('0xfb'),ut[_0x375e('0x82')](_0xa31f8,_0x375e('0xfc'),_0x5995ab[_0x375e('0x27')][_0xa31f8[_0x375e('0x49')]]));_0x36e52e(ut[_0x375e('0x32')](_0x375e('0xfd')));})[_0x375e('0x54')](function(_0x15e5ed){ut[_0x375e('0x37')](_0x375e('0xfe'),_0x15e5ed);_0x10879b(ut[_0x375e('0x32')]('Call\x20failed',_0x3f6de8,_0x17316f));});}else{_0x274274[_0x375e('0xff')]+=0x1;ut['logBlacklist'](_0xa31f8);rpcDb[_0x375e('0x100')](_0xa31f8,_0x375e('0x101'));delete _0x5995ab[_0x375e('0x14')][_0xd7bfcb];_0x10879b(ut['message']('Contact\x20in\x20black\x20List',_0x3f6de8,_0x17316f));}});};Preview[_0x375e('0xe')][_0x375e('0x79')]=function(_0xaac10d){return!_[_0x375e('0x5f')](_0xaac10d)&&!_['isNil'](_0xaac10d[_0x375e('0x2c')])&&!_[_0x375e('0x5f')](_0xaac10d[_0x375e('0x102')])&&_0xaac10d[_0x375e('0x102')]&&!_['isNil'](this['trunks'][util[_0x375e('0x6c')](_0x375e('0x103'),_0xaac10d[_0x375e('0x2c')])])&&!_[_0x375e('0x5f')](this[_0x375e('0x13')][util[_0x375e('0x6c')]('SIP/%s',_0xaac10d[_0x375e('0x2c')])][_0x375e('0x52')])&&(this[_0x375e('0x13')][util[_0x375e('0x6c')](_0x375e('0x103'),_0xaac10d[_0x375e('0x2c')])][_0x375e('0x52')]===_0x375e('0x104')||this[_0x375e('0x13')][util[_0x375e('0x6c')]('SIP/%s',_0xaac10d[_0x375e('0x2c')])][_0x375e('0x52')]==='unmonitored');};Preview[_0x375e('0xe')][_0x375e('0x66')]=function(_0x511419,_0x27ed66){return this[_0x375e('0x105')](_0x511419,_0x27ed66)[_0x375e('0x67')](function(_0x4f3e66){return _['pick'](_0x4f3e66,[_0x375e('0x32')]);})[_0x375e('0x54')](function(_0x53aab4){if(_0x53aab4[_0x375e('0x106')]){rpcDb['unlockContact'](_0x511419);}if(_0x53aab4[_0x375e('0x102')]){rpcDb[_0x375e('0x6a')](_0x511419);}throw _[_0x375e('0x4d')](_0x53aab4,[_0x375e('0x32')]);});};Preview[_0x375e('0xe')][_0x375e('0x105')]=function(_0x302dbe,_0x5e7446){var _0x2f5897=this;var _0x274986,_0x361aaa;return rpcDb['getContactPreview'](_0x302dbe)[_0x375e('0x67')](function(_0x46b758){if(!_[_0x375e('0x5f')](_0x46b758[0x0])){_0x361aaa=_0x46b758[0x0]['recallme']?![]:!![];_0x274986=_0x46b758[0x0][_0x375e('0x107')]?!![]:![];_0x274986=_0x5e7446?!![]:_0x274986;}var _0x1e1ddb=_0x2f5897[_0x375e('0x108')](_0x46b758);if(_0x1e1ddb[_0x375e('0x109')]){rpcDb['checkIsBlackList'](_[_0x375e('0x4d')](_0x46b758[0x0],[_0x375e('0x50'),_0x375e('0x10a')]))[_0x375e('0x67')](function(_0x5328d4){_0x2f5897[_0x375e('0xf3')](_0x5328d4,_0x46b758[0x0],_0x5e7446,_0x361aaa,_0x274986)['then'](function(_0x35d60d){return _0x35d60d;})[_0x375e('0x54')](function(_0x5ff14a){throw _0x5ff14a;});})[_0x375e('0x54')](function(_0x24a35c){ut['logger']('[Preview][checkIsBlackList]',_0x24a35c);throw ut[_0x375e('0x32')](_0x375e('0x10b'),_0x361aaa,_0x274986);});}else{throw ut[_0x375e('0x32')](_0x1e1ddb[_0x375e('0x32')],_0x361aaa,_0x274986);}})[_0x375e('0x54')](function(_0xac861c){ut[_0x375e('0x37')]('[Preview][getContactPreview]',_0xac861c);throw ut[_0x375e('0x32')](_0x375e('0x10b'),![],!![]);});};Preview[_0x375e('0xe')][_0x375e('0x108')]=function(_0x5e5f45){if(_[_0x375e('0x5f')](_0x5e5f45)||_[_0x375e('0xf6')](_0x5e5f45)||!_[_0x375e('0x5f')](_0x5e5f45[0x0][_0x375e('0x64')])&&_[_0x375e('0x5f')](_0x5e5f45[0x0]['Agent'][_0x375e('0x2c')])){ut[_0x375e('0x37')](_0x375e('0x10c'),_0x5e5f45);return{'isValid':![],'message':_0x375e('0x10d')};}var _0x184b32=this[_0x375e('0x27')][_0x5e5f45[0x0][_0x375e('0x48')][_0x375e('0x2c')]];_0x184b32['message']=utils[_0x375e('0x33')][_0x375e('0x7d')];if(_[_0x375e('0x5f')](_0x184b32)){ut[_0x375e('0x37')]('[Preview][validateContact][Empty\x20Campaign]',_0x184b32);return{'isValid':![],'message':_0x375e('0x10e')};}if(!this[_0x375e('0x79')](_0x184b32[_0x375e('0x7a')])){ut[_0x375e('0x37')](_0x375e('0x10f'),'campaign\x20Name:\x20'+_0x184b32[_0x375e('0x2c')]+_0x375e('0x110'));if(!this['isTrunkReachable'](_0x184b32['TrunkBackup'])){ut[_0x375e('0x37')](_0x375e('0x10f'),_0x184b32[_0x375e('0x2c')]+_0x375e('0x111'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x375e('0x77')](_0x184b32[_0x375e('0x42')])){ut[_0x375e('0x37')]('[Preview][validateContact][Campaign\x20Active]',_0x184b32[_0x375e('0x2c')]+_0x375e('0x112'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x184b32['name']+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x375e('0x113')};};Preview[_0x375e('0xe')]['execCall']=function(_0x14c1ff,_0x1b813b,_0xeaa864,_0x30abeb){var _0x52ce83=this;return new Promise(function(_0xabeac3,_0x23c98a){var _0x5d1541=_0x14c1ff[_0x375e('0x97')];var _0x2be0d1=_0x52ce83[_0x375e('0x79')](_0x1b813b[_0x375e('0x7a')])?util['format']('SIP/%s/%s%s',_0x1b813b['Trunk'][_0x375e('0x2c')],_['isNil'](_0x1b813b[_0x375e('0x114')])?'':_0x1b813b['dialPrefix'][_0x375e('0x115')]()||'',_0x1b813b[_0x375e('0x116')]>0x0?_0xeaa864[_0x375e('0x10a')][_0x375e('0x117')](_0x1b813b[_0x375e('0x116')]):_0xeaa864[_0x375e('0x10a')]):util[_0x375e('0x6c')](_0x375e('0x118'),_['isNil'](_0x1b813b[_0x375e('0x7b')])?_0x1b813b[_0x375e('0x7a')]['name']:_0x1b813b['TrunkBackup'][_0x375e('0x2c')],_[_0x375e('0x5f')](_0x1b813b[_0x375e('0x114')])?'':_0x1b813b[_0x375e('0x114')][_0x375e('0x115')]()||'',_0x1b813b[_0x375e('0x116')]>0x0?_0xeaa864[_0x375e('0x10a')]['substring'](_0x1b813b['dialCutDigit']):_0xeaa864[_0x375e('0x10a')]);var _0x494a97=_0x52ce83[_0x375e('0x79')](_0x1b813b[_0x375e('0x7a')])?ut[_0x375e('0x119')](_0x1b813b[_0x375e('0x7a')][_0x375e('0x11a')],_0x1b813b[_0x375e('0x11b')],_0x1b813b[_0x375e('0x11c')]>0x0?ut[_0x375e('0x11d')](_0x1b813b[_0x375e('0x11e')],_0x1b813b[_0x375e('0x11c')]):_0x1b813b[_0x375e('0x11e')]):ut[_0x375e('0x119')](_[_0x375e('0x5f')](_0x1b813b[_0x375e('0x7b')])?_0x1b813b[_0x375e('0x7a')][_0x375e('0x11a')]:_0x1b813b['TrunkBackup'][_0x375e('0x11a')],_0x1b813b['dialOriginateCallerIdName'],_0x1b813b['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x375e('0x11d')](_0x1b813b[_0x375e('0x11e')],_0x1b813b['dialRandomLastDigitCallerIdNumber']):_0x1b813b[_0x375e('0x11e')]);if(_0x494a97){_0x14c1ff[_0x375e('0x11f')]=ut[_0x375e('0x120')](_0x494a97);_0x14c1ff[_0x375e('0x121')]=ut[_0x375e('0x122')](_0x494a97);}var _0x2a46a3=ut['addVariables'](_0x1b813b,_0xeaa864,_0x2be0d1,_0x494a97,_0x5d1541,_0x14c1ff);var _0x53068b=utils['setXMDContactVariables'](_0xeaa864[_0x375e('0xf4')]);Object[_0x375e('0x123')](_0x2a46a3,_0x53068b);_[_0x375e('0x124')](_0x14c1ff,ut[_0x375e('0x125')](_0x2a46a3));_0x14c1ff[_0x375e('0x6b')]=moment()[_0x375e('0x6c')](_0x375e('0x126'));_0x1b813b['variables']=_0x2a46a3;var _0x5c3fe3=ut[_0x375e('0x127')](_0x14c1ff,_0x1b813b,_0x2a46a3,_0x14c1ff[_0x375e('0xbc')],_0x30abeb);return ami[_0x375e('0x51')](_0x5c3fe3)[_0x375e('0x67')](function(_0x5e9fd4){_0x1b813b[_0x375e('0x30')]+=0x1;logger['info'](_0x375e('0x128'),_0x5d1541,'\x20Queue',_0x1b813b[_0x375e('0x2c')],_0x375e('0x4a'),_0x1b813b[_0x375e('0x30')]);_0xabeac3(_0x5e9fd4);})[_0x375e('0x54')](function(_0x485249){ut[_0x375e('0xe6')](_0x14c1ff,0xe,_0x375e('0x129'));rpcDb[_0x375e('0xe8')](_0x14c1ff,_0x375e('0x12a'));_0x23c98a(_0x485249);});});};Preview[_0x375e('0xe')][_0x375e('0x20')]=function(_0x2506e5){if(this[_0x375e('0x14')][_0x2506e5[_0x375e('0x8f')]]){this['actions'][_0x2506e5[_0x375e('0x8f')]][_0x375e('0x53')]=_0x2506e5[_0x375e('0x53')];}};Preview[_0x375e('0xe')][_0x375e('0x18')]=function(_0x5341f7){var _0x96e4d1=this;var _0x146819=this[_0x375e('0x14')][_0x5341f7[_0x375e('0x12b')]];if(_0x146819){if(_0x146819[_0x375e('0xf5')]&&this[_0x375e('0x15')][_0x146819[_0x375e('0xf5')]]){ut['logLookAgent'](_0x146819,this[_0x375e('0x15')][_0x146819[_0x375e('0xf5')]][_0x375e('0x2c')],this[_0x375e('0x15')][_0x146819[_0x375e('0xf5')]]['id']);}var _0x293195=_[_0x375e('0x12c')](_0x146819);_0x293195[_0x375e('0x95')]=moment()[_0x375e('0x6c')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4c2f8a=_0x96e4d1['campaignsPreview'][_0x146819[_0x375e('0x49')]];if(ut['isFailure'](_0x5341f7['response'])){if(_0x146819[_0x375e('0xb3')]){rpcDb[_0x375e('0x12d')](_0x146819['idContact']);}if(_0x146819[_0x375e('0xbc')]){rpcDb['disableContact'](_0x146819[_0x375e('0x91')]);}ami[_0x375e('0x28')](_0x375e('0x12e'),ut[_0x375e('0x82')](_0x146819,_0x375e('0x12f'),this[_0x375e('0x27')][_0x146819[_0x375e('0x49')]]));this[_0x375e('0xe2')](_0x293195,_0x4c2f8a,_0x5341f7);}else{_0x146819[_0x375e('0x6b')]=moment()[_0x375e('0x6c')](_0x375e('0x126'));ut[_0x375e('0xe6')](_0x293195,0x4,_0x375e('0xa5'));rpcDb['createAgentHistory'](_0x293195,_0x375e('0x130'));}}};Preview[_0x375e('0xe')][_0x375e('0x1b')]=function(_0x541e82){var _0x40f81e=this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]];var _0x3b188a;if(_0x40f81e){_0x3b188a=this[_0x375e('0x27')][_0x40f81e['queue']];logger['info'](_0x375e('0x131'),_0x541e82[_0x375e('0x8f')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],'pTalking:\x20',_0x3b188a['pTalking']);}if(this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]&&_0x541e82[_0x375e('0x8f')]!==_0x541e82[_0x375e('0x97')]){if(_0x541e82[_0x375e('0x132')]==='16'&&this['actions'][_0x541e82['linkedid']]['dialAnswer']){this[_0x375e('0x7e')](_0x541e82,_0x541e82['linkedid'],_0x541e82['cause']);}else if(this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]['dialAnswer']){logger[_0x375e('0x46')](_0x375e('0x133'),_0x541e82[_0x375e('0x8f')],_0x541e82[_0x375e('0x132')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],'pTalking:\x20',_0x3b188a['pTalking']);this[_0x375e('0x7e')](_0x541e82,_0x541e82[_0x375e('0x8f')],_0x541e82['cause']);}}else if(_0x40f81e&&_[_0x375e('0x5f')](_0x40f81e[_0x375e('0x134')])&&_0x3b188a[_0x375e('0x135')]&&_0x541e82[_0x375e('0x8f')]===_0x541e82[_0x375e('0x97')]&&_[_0x375e('0x5f')](_0x541e82['reason'])&&_0x541e82[_0x375e('0x132')]==='16'&&_0x541e82[_0x375e('0x136')]==='6'&&_[_0x375e('0xe3')](_0x40f81e[_0x375e('0x137')])){if(_0x40f81e[_0x375e('0xb3')]){rpcDb[_0x375e('0x12d')](_0x40f81e['idContact']);}if(_0x40f81e[_0x375e('0xbc')]){rpcDb['disableContact'](_0x40f81e['idContact']);}_0x541e82['reason']='22';this['callProgressDetectingAgent'](_0x40f81e,_0x3b188a,_0x541e82);}else if(_0x40f81e&&_0x40f81e[_0x375e('0x137')]){if(_0x541e82['cause']==='16'&&this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]['dialAnswer']){logger[_0x375e('0x46')](_0x375e('0x138'),_0x541e82[_0x375e('0x8f')],_0x541e82[_0x375e('0x132')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],_0x375e('0x4b'),_0x3b188a[_0x375e('0x99')]);this[_0x375e('0x7e')](_0x541e82,_0x541e82['linkedid'],_0x541e82[_0x375e('0x132')]);}else if(this[_0x375e('0x14')][_0x541e82[_0x375e('0x8f')]]['dialAnswer']){logger[_0x375e('0x46')]('[syncHangup][talking][cause]',_0x541e82[_0x375e('0x8f')],_0x541e82[_0x375e('0x132')],_0x375e('0x98'),_0x3b188a[_0x375e('0x2c')],_0x375e('0x4b'),_0x3b188a[_0x375e('0x99')]);this[_0x375e('0x7e')](_0x541e82,_0x541e82['linkedid'],_0x541e82[_0x375e('0x132')]);}}};Preview[_0x375e('0xe')][_0x375e('0x1e')]=function(_0x3acb1b){if(this[_0x375e('0x14')][_0x3acb1b[_0x375e('0xe0')]]&&_0x3acb1b[_0x375e('0xe0')]!==_0x3acb1b[_0x375e('0x139')]){this['callProgressDetectingCustomer'](_0x3acb1b,_0x3acb1b[_0x375e('0xe0')],_0x3acb1b[_0x375e('0xd8')]);}};Preview[_0x375e('0xe')][_0x375e('0x1d')]=function(_0x553735){if(this[_0x375e('0x14')][_0x553735[_0x375e('0x8f')]]&&_0x553735[_0x375e('0x8f')]!==_0x553735[_0x375e('0x97')]&&!this[_0x375e('0x14')][_0x553735[_0x375e('0x8f')]][_0x375e('0x4c')]){if(_0x553735[_0x375e('0x132')]==='1'){this[_0x375e('0x7e')](_0x553735,_0x553735[_0x375e('0x8f')],_0x553735[_0x375e('0x132')]);}}};Preview[_0x375e('0xe')][_0x375e('0x13a')]=function(_0x433453,_0x54f174,_0x134564){if(this[_0x375e('0x14')][_0x433453]){if(_[_0x375e('0x5f')](this['actions'][_0x433453]['variables'])){this[_0x375e('0x14')][_0x433453][_0x375e('0x13b')]={};}this[_0x375e('0x14')][_0x433453][_0x375e('0x13b')][_0x54f174]=_0x134564;}};Preview[_0x375e('0xe')][_0x375e('0x22')]=function(_0x19ddfa){try{if(!_[_0x375e('0x5f')](_0x19ddfa)){if(ut['filterKey'](_[_0x375e('0x13c')](_0x19ddfa[_0x375e('0x13d')])[0x0])){this[_0x375e('0x13a')](_0x19ddfa[_0x375e('0x97')],_[_0x375e('0x13c')](_0x19ddfa[_0x375e('0x13d')])[0x0],_0x19ddfa['value']);}}}catch(_0x1d818a){logger[_0x375e('0x13e')](_0x375e('0x13f'),util[_0x375e('0x140')](_0x1d818a,{'showHidden':![],'depth':null}));}};Preview[_0x375e('0xe')][_0x375e('0x24')]=function(_0x57cb63){if(_0x57cb63){if(this[_0x375e('0x14')][_0x57cb63[_0x375e('0x141')]]){this['actions'][_0x57cb63['transfertargetlinkedid']][_0x375e('0x137')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x3f867d){if(_0x3f867d){if(this[_0x375e('0x14')][_0x3f867d[_0x375e('0x142')]]){this[_0x375e('0x14')][_0x3f867d[_0x375e('0x142')]][_0x375e('0x137')]=!![];}}};module[_0x375e('0x143')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index de3293c..e66058c 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 _0x949c=['from-sip','xcally-motion-preview','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','inspect','createHistory','catch','[createHistory]\x20','resolve','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','then','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername'];(function(_0xa2ad96,_0x46aaac){var _0x3113c7=function(_0x4153cc){while(--_0x4153cc){_0xa2ad96['push'](_0xa2ad96['shift']());}};_0x3113c7(++_0x46aaac);}(_0x949c,0x1b2));var _0xc949=function(_0x329397,_0x102228){_0x329397=_0x329397-0x0;var _0x126bf9=_0x949c[_0x329397];return _0x126bf9;};'use strict';var util=require(_0xc949('0x0'));var BPromise=require(_0xc949('0x1'));var logger=require(_0xc949('0x2'))(_0xc949('0x3'));var cmHopper=require(_0xc949('0x4'));var cmHopperHistory=require(_0xc949('0x5'));var cmHopperBlack=require(_0xc949('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0xc949('0x7'));function loggerCatch(_0x31bcb8){return function(_0x213505){logger['error'](_0x31bcb8,util[_0xc949('0x8')](_0x213505,{'showHidden':![],'depth':null}));};}function create(_0x230807){return cmHopperHistory[_0xc949('0x9')](_0x230807)[_0xc949('0xa')](loggerCatch(_0xc949('0xb')));}function createAgent(_0x3a0065){return BPromise[_0xc949('0xc')]()['then'](agentReportPreview[_0xc949('0x9')](_0x3a0065))[_0xc949('0xa')](loggerCatch(_0xc949('0xb')));}function moveContact(_0x545a2f){return cmHopper[_0xc949('0xd')](_0x545a2f,!![])[_0xc949('0xa')](loggerCatch(_0xc949('0xe')));}exports[_0xc949('0xf')]=function(_0x1b0773){return cmHopperBlack[_0xc949('0xf')](_0x1b0773)['catch'](loggerCatch(_0xc949('0x10')));};exports[_0xc949('0x11')]=function(_0x508514){return BPromise[_0xc949('0xc')]()[_0xc949('0x12')](cmHopper['getContactPreview'](_0x508514))[_0xc949('0xa')](loggerCatch(_0xc949('0x13')));};exports[_0xc949('0x9')]=function(_0x16872a,_0x39a6e1){create(_0x16872a)[_0xc949('0xa')](loggerCatch(_0x39a6e1));moveContact(_0x16872a)[_0xc949('0xa')](loggerCatch(_0x39a6e1));};exports[_0xc949('0x14')]=function(_0x2f046c,_0x3cb315){createAgent(_0x2f046c)['catch'](loggerCatch(_0x3cb315));};exports[_0xc949('0x15')]=function(_0x2c9d7b,_0x25b7f9){create(_0x2c9d7b)[_0xc949('0xa')](loggerCatch(_0x25b7f9));};exports[_0xc949('0x16')]=function(_0x3e8b98,_0x4f0c68){moveContact(_0x3e8b98)[_0xc949('0xa')](loggerCatch(_0x4f0c68));};exports[_0xc949('0x17')]=function(_0x577fb3,_0x165090,_0x4fee81){if(_0x165090){_0x577fb3[_0xc949('0x18')]=null;}if(_0x4fee81){_0x577fb3['active']=![];}return cmHopper[_0xc949('0x17')](_0x577fb3)[_0xc949('0xa')](loggerCatch(_0xc949('0x19')));};exports[_0xc949('0x1a')]=function(_0x35efd1){return cmHopper['countReScheduled'](_0x35efd1)[_0xc949('0xa')](loggerCatch('[countReScheduled]\x20'));};exports['unlockContact']=function(_0x24eddd){return cmHopper[_0xc949('0x1b')]({'UserId':null},_0x24eddd,0x1)[_0xc949('0xa')](loggerCatch(_0xc949('0x1c')));};exports[_0xc949('0x1d')]=function(_0x353466){return cmHopper[_0xc949('0x1b')]({'active':![]},_0x353466,0x1)[_0xc949('0xa')](loggerCatch(_0xc949('0x1e')));};exports[_0xc949('0x1f')]=function(_0x3f0d19){var _0x445250={};_0x445250['type']=_0x3f0d19['type'];_0x445250[_0xc949('0x20')]=_0x3f0d19[_0xc949('0x20')];_0x445250[_0xc949('0x21')]=_0x3f0d19[_0xc949('0x21')];_0x445250[_0xc949('0x22')]=_0x3f0d19[_0xc949('0x22')];_0x445250['queue']=_0x3f0d19[_0xc949('0x23')];_0x445250[_0xc949('0x24')]=_0x3f0d19[_0xc949('0x25')];_0x445250[_0xc949('0x26')]=_0x3f0d19['answertime'];_0x445250[_0xc949('0x27')]=0x1;_0x445250['queuecallercompleteAt']=_0x3f0d19[_0xc949('0x28')];_0x445250[_0xc949('0x29')]=_0x3f0d19[_0xc949('0x2a')];_0x445250['context']=_0xc949('0x2b');_0x445250['exten']=_0xc949('0x2c');_0x445250['holdtime']=0x0;_0x445250[_0xc949('0x2d')]=0x1;_0x445250[_0xc949('0x2e')]=_0x3f0d19[_0xc949('0x2a')];_0x445250['queuecallerexitreason']=_0xc949('0x2f');return BPromise['resolve']()['then'](voiceQueueReport[_0xc949('0x30')](_0x445250))[_0xc949('0xa')](loggerCatch(_0xc949('0x31')));};exports[_0xc949('0x32')]=function(_0x5bd01a,_0x14a933){return BPromise[_0xc949('0xc')]()[_0xc949('0x12')](cmHopper[_0xc949('0x32')](_0x5bd01a,_0x14a933))[_0xc949('0xa')](loggerCatch(_0xc949('0x33')));};exports['rescheduleContactInQueue']=function(_0x5f420d){return cmHopper[_0xc949('0x17')](_0x5f420d,!![],!![])['catch'](loggerCatch(_0xc949('0x34')));}; \ No newline at end of file +var _0x0dcc=['create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','resolve','then','catch','[createHistory]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','endtime','membername','from-sip','exten','xcally-motion-preview','lastAssignedTo'];(function(_0x5e7429,_0x17c4ca){var _0x3eed62=function(_0x5ba8f4){while(--_0x5ba8f4){_0x5e7429['push'](_0x5e7429['shift']());}};_0x3eed62(++_0x17c4ca);}(_0x0dcc,0xfa));var _0xc0dc=function(_0xa4ae3d,_0x547c45){_0xa4ae3d=_0xa4ae3d-0x0;var _0x21b4dc=_0x0dcc[_0xa4ae3d];return _0x21b4dc;};'use strict';var util=require(_0xc0dc('0x0'));var BPromise=require(_0xc0dc('0x1'));var logger=require('../../../config/logger')(_0xc0dc('0x2'));var cmHopper=require('../rpc/cmHopper');var cmHopperHistory=require(_0xc0dc('0x3'));var cmHopperBlack=require(_0xc0dc('0x4'));var agentReportPreview=require(_0xc0dc('0x5'));var voiceQueueReport=require(_0xc0dc('0x6'));function loggerCatch(_0x261e77){return function(_0x53da18){logger[_0xc0dc('0x7')](_0x261e77,util[_0xc0dc('0x8')](_0x53da18,{'showHidden':![],'depth':null}));};}function create(_0x6c513b){return cmHopperHistory[_0xc0dc('0x9')](_0x6c513b)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x577c37){return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](agentReportPreview[_0xc0dc('0x9')](_0x577c37))[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0xd')));}function moveContact(_0x222b54){return cmHopper[_0xc0dc('0xe')](_0x222b54,!![])[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0xf')));}exports[_0xc0dc('0x10')]=function(_0xd9c7c1){return cmHopperBlack[_0xc0dc('0x10')](_0xd9c7c1)[_0xc0dc('0xc')](loggerCatch('[checkIsBlackList]\x20'));};exports['getContactPreview']=function(_0x581096){return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](cmHopper['getContactPreview'](_0x581096))['catch'](loggerCatch(_0xc0dc('0x11')));};exports[_0xc0dc('0x9')]=function(_0x34e28a,_0x25d29f){create(_0x34e28a)['catch'](loggerCatch(_0x25d29f));moveContact(_0x34e28a)[_0xc0dc('0xc')](loggerCatch(_0x25d29f));};exports[_0xc0dc('0x12')]=function(_0x103bab,_0x26be33){createAgent(_0x103bab)[_0xc0dc('0xc')](loggerCatch(_0x26be33));};exports['createCustomerHistory']=function(_0x11276f,_0x4a5458){create(_0x11276f)[_0xc0dc('0xc')](loggerCatch(_0x4a5458));};exports[_0xc0dc('0x13')]=function(_0x3f3045,_0x5d9db1){moveContact(_0x3f3045)[_0xc0dc('0xc')](loggerCatch(_0x5d9db1));};exports[_0xc0dc('0x14')]=function(_0x2d9e2a,_0x477f42,_0x4cff22){if(_0x477f42){_0x2d9e2a[_0xc0dc('0x15')]=null;}if(_0x4cff22){_0x2d9e2a['active']=![];}return cmHopper[_0xc0dc('0x14')](_0x2d9e2a)[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x16')));};exports[_0xc0dc('0x17')]=function(_0xe50021){return cmHopper[_0xc0dc('0x17')](_0xe50021)['catch'](loggerCatch(_0xc0dc('0x18')));};exports[_0xc0dc('0x19')]=function(_0x3de1c6){return cmHopper[_0xc0dc('0x19')]({'UserId':null},_0x3de1c6,0x1)['catch'](loggerCatch(_0xc0dc('0x1a')));};exports['disableContact']=function(_0x1a8752){return cmHopper[_0xc0dc('0x19')]({'active':![]},_0x1a8752,0x1)['catch'](loggerCatch(_0xc0dc('0x1b')));};exports[_0xc0dc('0x1c')]=function(_0x1a14e3){var _0x3259f8={};_0x3259f8[_0xc0dc('0x1d')]=_0x1a14e3['type'];_0x3259f8[_0xc0dc('0x1e')]=_0x1a14e3[_0xc0dc('0x1e')];_0x3259f8[_0xc0dc('0x1f')]=_0x1a14e3[_0xc0dc('0x1f')];_0x3259f8[_0xc0dc('0x20')]=_0x1a14e3['calleridname'];_0x3259f8[_0xc0dc('0x21')]=_0x1a14e3['queue'];_0x3259f8[_0xc0dc('0x22')]=_0x1a14e3[_0xc0dc('0x23')];_0x3259f8[_0xc0dc('0x24')]=_0x1a14e3[_0xc0dc('0x23')];_0x3259f8[_0xc0dc('0x25')]=0x1;_0x3259f8['queuecallercompleteAt']=_0x1a14e3[_0xc0dc('0x26')];_0x3259f8['connectedlinename']=_0x1a14e3[_0xc0dc('0x27')];_0x3259f8['context']=_0xc0dc('0x28');_0x3259f8[_0xc0dc('0x29')]=_0xc0dc('0x2a');_0x3259f8['holdtime']=0x0;_0x3259f8['assigned']=0x1;_0x3259f8[_0xc0dc('0x2b')]=_0x1a14e3['membername'];_0x3259f8['queuecallerexitreason']='COMPLETED';return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](voiceQueueReport[_0xc0dc('0x2c')](_0x3259f8))[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x2d')));};exports[_0xc0dc('0x2e')]=function(_0xc1eb3e,_0x5783ab){return BPromise[_0xc0dc('0xa')]()[_0xc0dc('0xb')](cmHopper['getContactRecallMe'](_0xc1eb3e,_0x5783ab))[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x2f')));};exports['rescheduleContactInQueue']=function(_0x43a5a8){return cmHopper[_0xc0dc('0x14')](_0x43a5a8,!![],!![])[_0xc0dc('0xc')](loggerCatch(_0xc0dc('0x30')));}; \ 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 edaea4a..27e6ddb 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 _0xcca9=['YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','endtime','statedesc','ringtime','getSeconds','logLookAgent','logCustomer','talktime','answertime','isFailure','Failure','variablesAction','uniqueid','originate','xcally-motion-preview','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','Global','scheduledAt','active','scheduledat','add','ListId','isNil','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','[decrementTalking]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','channelAgent','voice','mandatoryDisposition','buildObj','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','idContact','dialAnswer','membername','countglobal','callback','callbackuniqueid','callbackat','recallme','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrtt','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridNumber','variables','forEach','toLowerCase','util','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','inspect','info','loggerError','logger2','message','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','NONE','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','toLowerVariables','hasOwnProperty','toLower','logBlacklist'];(function(_0x19925b,_0x2454d7){var _0x3b2c8e=function(_0x4fee09){while(--_0x4fee09){_0x19925b['push'](_0x19925b['shift']());}};_0x3b2c8e(++_0x2454d7);}(_0xcca9,0x160));var _0x9cca=function(_0x5c3891,_0x284f4c){_0x5c3891=_0x5c3891-0x0;var _0x34ecda=_0xcca9[_0x5c3891];return _0x34ecda;};'use strict';var util=require(_0x9cca('0x0'));var _=require(_0x9cca('0x1'));var moment=require(_0x9cca('0x2'));var logger=require(_0x9cca('0x3'))(_0x9cca('0x4'));var ipAgi=process[_0x9cca('0x5')][_0x9cca('0x6')]||_0x9cca('0x7');var utils=require(_0x9cca('0x8'));exports['loggerCatch']=function(_0x7cb36f){return function(_0x4748fd){logger[_0x9cca('0x9')](_0x7cb36f,util[_0x9cca('0xa')](_0x4748fd,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x5a2a60,_0x7ccded){logger[_0x9cca('0xb')](_0x5a2a60,util[_0x9cca('0xa')](_0x7ccded,{'showHidden':![],'depth':null}));};exports[_0x9cca('0xc')]=function(_0x4591d0,_0x44739f){logger[_0x9cca('0x9')](_0x4591d0,util[_0x9cca('0xa')](_0x44739f,{'showHidden':![],'depth':null}));};exports[_0x9cca('0xd')]=function(_0x4b7cb2){return function(_0x3d11b2){logger[_0x9cca('0xb')](_0x4b7cb2,util['inspect'](_0x3d11b2,{'showHidden':![],'depth':null}));};};exports[_0x9cca('0xe')]=function(_0x4de285,_0xfdfd38,_0x2d5551){return{'message':_0x4de285,'unlock':_0xfdfd38,'active':_0x2d5551};};exports[_0x9cca('0xf')]=function(_0x107981,_0x63eceb,_0x410272){if(!_[_0x9cca('0x10')](_0x410272)&&_0x9cca('0x11')===typeof _0x410272&&!_['isEmpty'](_0x410272)){if(!_[_0x9cca('0x10')](_0x63eceb)&&_0x9cca('0x11')===typeof _0x63eceb&&!_[_0x9cca('0x12')](_0x63eceb)){return util[_0x9cca('0x13')]('\x22%s\x22\x20<%s>',_0x63eceb,_0x410272);}return util['format'](_0x9cca('0x14'),_0x410272,_0x410272);}if(!_[_0x9cca('0x10')](_0x107981)&&'string'===typeof _0x107981&&!_['isEmpty'](_0x107981)){return _0x107981;}return _0x9cca('0x15');};exports['isActive']=function(_0x656ff2){if(_['isNil'](_0x656ff2)){return![];}return _0x656ff2;};exports['addVariables']=function(_0x4d23d9,_0x1f9654,_0x32f2e6,_0x226544,_0x4284e7,_0x236148){var _0x18fd28={'XMD-QUEUE':_0x1f9654[_0x9cca('0x16')]?_0x1f9654[_0x9cca('0x16')][_0x9cca('0x17')]:'','XMD-CALLERID':_0x226544,'XMD-CALLERID-PREVIEW':_0x236148?util[_0x9cca('0x13')]('\x22%s\x22\x20<%s>',_0x236148[_0x9cca('0x18')],_0x236148[_0x9cca('0x19')]):_0x226544,'XMD-DIALID':_0x4284e7,'XMD-CONTACTID':_0x1f9654[_0x9cca('0x1a')],'XMD-CDRTYPE':_0x9cca('0x1b'),'CALLERID(all)':_0x226544,'XMD-VOICEQUEUEID':_0x1f9654[_0x9cca('0x1c')],'XMD-DIALCHANNEL':_0x32f2e6,'XMD-DIALTIMEOUT':_0x4d23d9[_0x9cca('0x1d')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x9cca('0x1e'),_0x4d23d9[_0x9cca('0x1f')]?'g':'',_[_0x9cca('0x12')](_0x4d23d9[_0x9cca('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x4d23d9['dialPreviewUrl']||'','XMD-AGI':_0x4d23d9[_0x9cca('0x21')]?util[_0x9cca('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x4d23d9[_0x9cca('0x21')]):_0x9cca('0x22'),'XMD-AGIAFTER':_0x4d23d9[_0x9cca('0x1f')]?util['format'](_0x9cca('0x23'),ipAgi,_0x4d23d9[_0x9cca('0x1f')]):_0x9cca('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x236148?_0x236148[_0x9cca('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x236148?_0x236148[_0x9cca('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x9cca('0x26')};if(!_[_0x9cca('0x12')](_0x4d23d9[_0x9cca('0x20')])){_0x18fd28[util['format']('%s',_0x9cca('0x27'))]=_0x4d23d9[_0x9cca('0x20')];_0x18fd28[util[_0x9cca('0x13')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x4284e7;}return _0x18fd28;};exports[_0x9cca('0x28')]=function(_0xa8f73d){var _0x2b06cf={};for(var _0x38a7dc in _0xa8f73d){if(_0xa8f73d[_0x9cca('0x29')](_0x38a7dc)){_0x2b06cf[util[_0x9cca('0x13')]('%s',_[_0x9cca('0x2a')](_0x38a7dc))]=_0xa8f73d[_0x38a7dc];}}return{'variables':_0x2b06cf};};exports[_0x9cca('0x2b')]=function(_0x42a2b6){var _0xdaf086=moment()[_0x9cca('0x13')](_0x9cca('0x2c'));_0x42a2b6[_0x9cca('0x2d')]=0xd;_0x42a2b6['statedesc']=_0x9cca('0x2e');_0x42a2b6[_0x9cca('0x2f')]=_0xdaf086;_0x42a2b6[_0x9cca('0x30')]=_0xdaf086;_0x42a2b6[_0x9cca('0x31')]=_0xdaf086;};exports['logAgent']=function(_0xf75b15,_0x3cc442,_0x2a68f3){var _0x22c99e=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0xf75b15[_0x9cca('0x2d')]=_0x3cc442;_0xf75b15[_0x9cca('0x32')]=_0x2a68f3;_0xf75b15[_0x9cca('0x30')]=_0x22c99e;_0xf75b15[_0x9cca('0x33')]=utils[_0x9cca('0x34')](_0xf75b15[_0x9cca('0x30')],_0xf75b15[_0x9cca('0x2f')]);};exports[_0x9cca('0x35')]=function(_0x5d9af6,_0x54a3d6,_0x113c7e){_0x5d9af6['membername']=_0x54a3d6;_0x5d9af6['UserId']=_0x113c7e;};exports[_0x9cca('0x36')]=function(_0x24aeaa,_0x52147e,_0x4c2435){var _0x46d489=moment()['format'](_0x9cca('0x2c'));_0x24aeaa['state']=_0x52147e;_0x24aeaa[_0x9cca('0x32')]=_0x4c2435;_0x24aeaa['responsetime']=_0x24aeaa[_0x9cca('0x30')]?_0x24aeaa['responsetime']:_0x46d489;_0x24aeaa[_0x9cca('0x31')]=_0x24aeaa['endtime']?_0x24aeaa['endtime']:_0x46d489;_0x24aeaa['ringtime']=utils[_0x9cca('0x34')](_0x24aeaa[_0x9cca('0x30')]||0x0,_0x24aeaa[_0x9cca('0x2f')]||0x0);_0x24aeaa[_0x9cca('0x37')]=_0x24aeaa['answertime']?utils[_0x9cca('0x34')](_0x24aeaa['endtime'],_0x24aeaa[_0x9cca('0x38')]):0x0;};exports[_0x9cca('0x39')]=function(_0x9532a9){return _0x9532a9===_0x9cca('0x3a');};exports[_0x9cca('0x3b')]=function(_0x3241ae,_0x1c49fa,_0x370d1a,_0x43d301,_0x2e8ae6){var _0x32b89e=_0x43d301?'RECALL':_0x3241ae[_0x9cca('0x18')];_0x32b89e=_0x2e8ae6?'BOOKED':_0x32b89e;return{'actionid':_0x3241ae[_0x9cca('0x3c')],'action':_0x9cca('0x3d'),'channel':_0x3241ae['channelAgent'],'callerid':util[_0x9cca('0x13')](_0x9cca('0x14'),_0x32b89e,_0x3241ae[_0x9cca('0x19')]),'Exten':_0x9cca('0x3e'),'Context':_0x9cca('0x3f'),'Priority':'1','variable':_0x370d1a,'timeout':(_0x1c49fa[_0x9cca('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3241ae[_0x9cca('0x3c')]};};exports[_0x9cca('0x41')]=function(_0x5ecc2f){return _0x5ecc2f[_0x9cca('0x42')]+_0x5ecc2f[_0x9cca('0x43')]+_0x5ecc2f[_0x9cca('0x44')]+_0x5ecc2f[_0x9cca('0x45')]+_0x5ecc2f[_0x9cca('0x46')];};exports['cloneAction']=function(_0x168e5f){var _0x3289c5=_['clone'](_0x168e5f);_0x3289c5['state']=0xf;_0x3289c5['statedesc']=_0x9cca('0x47');return _0x3289c5;};exports[_0x9cca('0x48')]=function(_0x52a7ea,_0xcb372d,_0x2244c4){var _0x456e55={};_0x456e55[_0xcb372d]=_0x52a7ea[_0xcb372d];_0x456e55[_0x9cca('0x49')]=![];_0x456e55[_0x9cca('0x4a')]=moment()[_0x9cca('0x4b')](_0x2244c4,'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss');_0x456e55[_0x9cca('0x1a')]=_0x52a7ea['ContactId'];_0x456e55[_0x9cca('0x4c')]=_0x52a7ea['ListId'];_0x456e55[_0x9cca('0x1c')]=_0x52a7ea[_0x9cca('0x1c')]||undefined;return _0x456e55;};exports['decrementTalking']=function(_0x11cb02,_0x472b5d){if(!_[_0x9cca('0x4d')](_0x11cb02)){if(_0x11cb02[_0x9cca('0x4e')]>0x0){_0x11cb02[_0x9cca('0x4e')]-=0x1;}else{logger[_0x9cca('0xb')](_0x472b5d,_0x9cca('0x4f'));}}else{logger['error'](_0x472b5d,_0x9cca('0x50'));}};exports[_0x9cca('0x51')]=function(_0x586297){if(_0x586297<=0x0){return!![];}return![];};function buildObj(_0x574619,_0x58317f,_0x3ee87c){_0x574619[_0x9cca('0x52')]=_0x58317f;_0x574619[_0x9cca('0x17')]=_0x574619[_0x9cca('0x53')];_0x574619['interface']=_0x574619[_0x9cca('0x54')];_0x574619['motionChannel']=_0x9cca('0x55');if(_0x3ee87c){_0x574619[_0x9cca('0x56')]=_0x3ee87c[_0x9cca('0x56')];}return _0x574619;}exports[_0x9cca('0x57')]=buildObj;exports[_0x9cca('0x58')]=function(_0x50eac7){var _0x4cb160=[];for(var _0x1c3c09 in _0x50eac7){if(_0x50eac7[_0x9cca('0x29')](_0x1c3c09)){if(!_[_0x9cca('0x4d')](_0x50eac7[_0x1c3c09])&&_0x50eac7[_0x1c3c09][_0x9cca('0x2d')]===_0x9cca('0x59')&&_0x50eac7[_0x1c3c09]['status']==='reachable'){_0x4cb160[_0x9cca('0x5a')](_0x50eac7[_0x1c3c09]['id']);}}}return _0x4cb160;};exports[_0x9cca('0x5b')]=function(_0x5bc5f1){var _0x583f68=moment()[_0x9cca('0x5c')](0x0);var _0x2cb4ef=moment(_0x5bc5f1)[_0x9cca('0x5c')](0x0);return _0x583f68[_0x9cca('0x5d')](_0x2cb4ef,_0x9cca('0x5e'));};exports['createBody']=function(_0x111c01){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x111c01[_0x9cca('0x1a')],'ListId':_0x111c01[_0x9cca('0x4c')],'VoiceQueueId':_0x111c01[_0x9cca('0x1c')]||undefined,'CampaignId':_0x111c01[_0x9cca('0x5f')]||undefined};};exports[_0x9cca('0x60')]=function(_0x5dd502){if(_0x5dd502===_0x9cca('0x3c')||_0x5dd502===_0x9cca('0x61')||_0x5dd502===_0x9cca('0x53')||_0x5dd502==='type'||_0x5dd502==='campaigntype'||_0x5dd502===_0x9cca('0x62')||_0x5dd502===_0x9cca('0x63')||_0x5dd502===_0x9cca('0x54')||_0x5dd502===_0x9cca('0x18')||_0x5dd502===_0x9cca('0x49')||_0x5dd502===_0x9cca('0x19')||_0x5dd502==='scheduledat'||_0x5dd502===_0x9cca('0x42')||_0x5dd502==='countcongestionretry'||_0x5dd502===_0x9cca('0x44')||_0x5dd502===_0x9cca('0x64')||_0x5dd502===_0x9cca('0x65')||_0x5dd502===_0x9cca('0x66')||_0x5dd502===_0x9cca('0x67')||_0x5dd502===_0x9cca('0x68')||_0x5dd502===_0x9cca('0x1a')||_0x5dd502===_0x9cca('0x4c')||_0x5dd502==='UserId'||_0x5dd502===_0x9cca('0x1c')||_0x5dd502==='sipcallid'||_0x5dd502==='xmd-voicequeueid'||_0x5dd502===_0x9cca('0x69')||_0x5dd502===_0x9cca('0x6a')||_0x5dd502===_0x9cca('0x6b')||_0x5dd502===_0x9cca('0x6c')||_0x5dd502===_0x9cca('0x6d')||_0x5dd502===_0x9cca('0x6e')||_0x5dd502==='xmd-dialid'||_0x5dd502==='xmd-dialchannel'||_0x5dd502===_0x9cca('0x6f')||_0x5dd502===_0x9cca('0x70')||_0x5dd502===_0x9cca('0x71')||_0x5dd502===_0x9cca('0x72')||_0x5dd502==='xmd-agi'||_0x5dd502===_0x9cca('0x73')||_0x5dd502===_0x9cca('0x74')||_0x5dd502==='rtpaudioqosjitter'||_0x5dd502===_0x9cca('0x75')||_0x5dd502===_0x9cca('0x76')||_0x5dd502==='rtpaudioqoslossbridged'||_0x5dd502==='rtpaudioqosrtt'||_0x5dd502===_0x9cca('0x77')||_0x5dd502===_0x9cca('0x73')||_0x5dd502===_0x9cca('0x74')||_0x5dd502===_0x9cca('0x78')||_0x5dd502===_0x9cca('0x75')||_0x5dd502===_0x9cca('0x76')||_0x5dd502===_0x9cca('0x79')||_0x5dd502===_0x9cca('0x7a')||_0x5dd502===_0x9cca('0x77')||_0x5dd502===_0x9cca('0x7b')||_0x5dd502==='bridgepvtcallid'||_0x5dd502===_0x9cca('0x2d')||_0x5dd502===_0x9cca('0x32')){return![];}return!![];};exports[_0x9cca('0x7c')]=function(_0x174a53,_0x2429b3){var _0x1b855c,_0x1fed25,_0x3ad272;if(_0x2429b3<=0x0){_0x2429b3=0x1;}_0x1b855c=new RegExp(_0x9cca('0x7d')+_0x2429b3+'}$');_0x1fed25=Math[_0x9cca('0x7e')](0xa,_0x2429b3-0x1);_0x3ad272=Math[_0x9cca('0x7e')](0xa,_0x2429b3)-0x1;return util[_0x9cca('0x13')]('%s',_[_0x9cca('0x7f')](_0x174a53,_0x1b855c,_['random'](_0x1fed25,_0x3ad272)));};exports['extractCalleridName']=function(_0x1f5b56){var _0x2f0560=_0x1f5b56['match'](/"(.*?)"/);return _0x2f0560?_0x2f0560[0x1]:_0x1f5b56;};exports[_0x9cca('0x80')]=function(_0x552d68){var _0x3a528d=_0x552d68['match'](/<(.*?)>/);return _0x3a528d?_0x3a528d[0x1]:_0x552d68;};function buildNoAnswerEventPayload(_0x442c30,_0x409b5c){var _0x159a80=buildObj(_0x442c30,'noanswer');if(!_['isEmpty'](_0x409b5c[_0x9cca('0x81')])){Object['keys'](_0x409b5c[_0x9cca('0x81')])[_0x9cca('0x82')](function(_0x2de978){_0x159a80[_0x2de978[_0x9cca('0x83')]()]=_0x409b5c[_0x9cca('0x81')][_0x2de978];});}return _0x159a80;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x64bf=['BOOKED','from-sip','timeout','uniqueid','totalGlobal','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','scheduledat','minutes','ListId','pTalking','[decrementTalking]\x20object\x20talking\x20is\x20negative','queue','interface','voice','mandatoryDisposition','buildObj','not_inuse','status','reachable','push','milliseconds','diff','seconds','filterKey','idContact','campaigntype','dialAnswer','active','countbusyretry','countcongestionretry','callback','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-cdrtype','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','error','logger','info','inspect','logger2','isUndefined','isEmpty','string','format','\x22%s\x22\x20<%s>','isNil','addVariables','Queue','name','calleridnum','ContactId','VoiceQueueId','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','\x22agi://%s/square,%s\x22','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','logBlacklist','state','statedesc','Blacklist','responsetime','endtime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','logLookAgent','membername','logCustomer','talktime','answertime','Failure','variablesAction','RECALL','calleridname'];(function(_0x591e16,_0x5aefc1){var _0x543b35=function(_0x81e3be){while(--_0x81e3be){_0x591e16['push'](_0x591e16['shift']());}};_0x543b35(++_0x5aefc1);}(_0x64bf,0x1cc));var _0xf64b=function(_0x4dc190,_0x443cdb){_0x4dc190=_0x4dc190-0x0;var _0x14dae6=_0x64bf[_0x4dc190];return _0x14dae6;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0xf64b('0x0'));var logger=require(_0xf64b('0x1'))(_0xf64b('0x2'));var ipAgi=process['env'][_0xf64b('0x3')]||_0xf64b('0x4');var utils=require(_0xf64b('0x5'));exports['loggerCatch']=function(_0x3d5c1f){return function(_0x3c11b8){logger[_0xf64b('0x6')](_0x3d5c1f,util['inspect'](_0x3c11b8,{'showHidden':![],'depth':null}));};};exports[_0xf64b('0x7')]=function(_0x21667c,_0x244c71){logger[_0xf64b('0x8')](_0x21667c,util[_0xf64b('0x9')](_0x244c71,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x5bb51f,_0xbdd784){logger['error'](_0x5bb51f,util[_0xf64b('0x9')](_0xbdd784,{'showHidden':![],'depth':null}));};exports[_0xf64b('0xa')]=function(_0x564083){return function(_0x241045){logger[_0xf64b('0x8')](_0x564083,util[_0xf64b('0x9')](_0x241045,{'showHidden':![],'depth':null}));};};exports['message']=function(_0xf80a69,_0x26d651,_0x265b7b){return{'message':_0xf80a69,'unlock':_0x26d651,'active':_0x265b7b};};exports['getCallerId']=function(_0x2c91cd,_0x59a35e,_0x48a4a0){if(!_[_0xf64b('0xb')](_0x48a4a0)&&'string'===typeof _0x48a4a0&&!_[_0xf64b('0xc')](_0x48a4a0)){if(!_[_0xf64b('0xb')](_0x59a35e)&&_0xf64b('0xd')===typeof _0x59a35e&&!_[_0xf64b('0xc')](_0x59a35e)){return util[_0xf64b('0xe')](_0xf64b('0xf'),_0x59a35e,_0x48a4a0);}return util[_0xf64b('0xe')](_0xf64b('0xf'),_0x48a4a0,_0x48a4a0);}if(!_['isUndefined'](_0x2c91cd)&&_0xf64b('0xd')===typeof _0x2c91cd&&!_[_0xf64b('0xc')](_0x2c91cd)){return _0x2c91cd;}return'\x22\x22\x20<>';};exports['isActive']=function(_0x501ff2){if(_[_0xf64b('0x10')](_0x501ff2)){return![];}return _0x501ff2;};exports[_0xf64b('0x11')]=function(_0x18ced3,_0x3b5d83,_0x3aaa70,_0x4e2eb3,_0x4683d9,_0x153889){var _0x2b9d86={'XMD-QUEUE':_0x3b5d83['Queue']?_0x3b5d83[_0xf64b('0x12')][_0xf64b('0x13')]:'','XMD-CALLERID':_0x4e2eb3,'XMD-CALLERID-PREVIEW':_0x153889?util[_0xf64b('0xe')](_0xf64b('0xf'),_0x153889['calleridname'],_0x153889[_0xf64b('0x14')]):_0x4e2eb3,'XMD-DIALID':_0x4683d9,'XMD-CONTACTID':_0x3b5d83[_0xf64b('0x15')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4e2eb3,'XMD-VOICEQUEUEID':_0x3b5d83[_0xf64b('0x16')],'XMD-DIALCHANNEL':_0x3aaa70,'XMD-DIALTIMEOUT':_0x18ced3['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util['format'](_0xf64b('0x17'),_0x18ced3[_0xf64b('0x18')]?'g':'',_[_0xf64b('0xc')](_0x18ced3[_0xf64b('0x19')])?'':_0xf64b('0x1a')),'XMD-DIALURL':_0x18ced3[_0xf64b('0x1b')]||'','XMD-AGI':_0x18ced3['dialQueueProject']?util[_0xf64b('0xe')](_0xf64b('0x1c'),ipAgi,_0x18ced3[_0xf64b('0x1d')]):_0xf64b('0x1e'),'XMD-AGIAFTER':_0x18ced3[_0xf64b('0x18')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x18ced3['dialQueueProject2']):_0xf64b('0x1e'),'XMD-ORIGINATECALLERIDNUM':_0x153889?_0x153889[_0xf64b('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x153889?_0x153889[_0xf64b('0x20')]:'','XMD-DESTINATION':_0xf64b('0x21'),'SIPADDHEADER':_0xf64b('0x22')};if(!_['isEmpty'](_0x18ced3[_0xf64b('0x19')])){_0x2b9d86[util[_0xf64b('0xe')]('%s',_0xf64b('0x23'))]=_0x18ced3[_0xf64b('0x19')];_0x2b9d86[util[_0xf64b('0xe')]('%s',_0xf64b('0x24'))]=_0x4683d9;}return _0x2b9d86;};exports[_0xf64b('0x25')]=function(_0x40d1bf){var _0x286fd3={};for(var _0x5d8024 in _0x40d1bf){if(_0x40d1bf[_0xf64b('0x26')](_0x5d8024)){_0x286fd3[util[_0xf64b('0xe')]('%s',_[_0xf64b('0x27')](_0x5d8024))]=_0x40d1bf[_0x5d8024];}}return{'variables':_0x286fd3};};exports[_0xf64b('0x28')]=function(_0x9561ff){var _0x222726=moment()[_0xf64b('0xe')]('YYYY-MM-DD\x20HH:mm:ss');_0x9561ff[_0xf64b('0x29')]=0xd;_0x9561ff[_0xf64b('0x2a')]=_0xf64b('0x2b');_0x9561ff['starttime']=_0x222726;_0x9561ff[_0xf64b('0x2c')]=_0x222726;_0x9561ff[_0xf64b('0x2d')]=_0x222726;};exports[_0xf64b('0x2e')]=function(_0x568f56,_0x4b772b,_0x504ca2){var _0x87205a=moment()[_0xf64b('0xe')](_0xf64b('0x2f'));_0x568f56[_0xf64b('0x29')]=_0x4b772b;_0x568f56['statedesc']=_0x504ca2;_0x568f56[_0xf64b('0x2c')]=_0x87205a;_0x568f56[_0xf64b('0x30')]=utils[_0xf64b('0x31')](_0x568f56['responsetime'],_0x568f56[_0xf64b('0x32')]);};exports[_0xf64b('0x33')]=function(_0x3fb93d,_0x5a1b72,_0x1d9a13){_0x3fb93d[_0xf64b('0x34')]=_0x5a1b72;_0x3fb93d['UserId']=_0x1d9a13;};exports[_0xf64b('0x35')]=function(_0x27ceeb,_0x4c1a6b,_0x368971){var _0x587a00=moment()[_0xf64b('0xe')](_0xf64b('0x2f'));_0x27ceeb[_0xf64b('0x29')]=_0x4c1a6b;_0x27ceeb[_0xf64b('0x2a')]=_0x368971;_0x27ceeb[_0xf64b('0x2c')]=_0x27ceeb[_0xf64b('0x2c')]?_0x27ceeb[_0xf64b('0x2c')]:_0x587a00;_0x27ceeb[_0xf64b('0x2d')]=_0x27ceeb['endtime']?_0x27ceeb[_0xf64b('0x2d')]:_0x587a00;_0x27ceeb[_0xf64b('0x30')]=utils[_0xf64b('0x31')](_0x27ceeb[_0xf64b('0x2c')]||0x0,_0x27ceeb[_0xf64b('0x32')]||0x0);_0x27ceeb[_0xf64b('0x36')]=_0x27ceeb['answertime']?utils[_0xf64b('0x31')](_0x27ceeb[_0xf64b('0x2d')],_0x27ceeb[_0xf64b('0x37')]):0x0;};exports['isFailure']=function(_0x48eb27){return _0x48eb27===_0xf64b('0x38');};exports[_0xf64b('0x39')]=function(_0x20e4a0,_0x259426,_0x1f0b5a,_0x51c4ce,_0x2f94c6){var _0x522312=_0x51c4ce?_0xf64b('0x3a'):_0x20e4a0[_0xf64b('0x3b')];_0x522312=_0x2f94c6?_0xf64b('0x3c'):_0x522312;return{'actionid':_0x20e4a0['uniqueid'],'action':'originate','channel':_0x20e4a0['channelAgent'],'callerid':util[_0xf64b('0xe')](_0xf64b('0xf'),_0x522312,_0x20e4a0[_0xf64b('0x14')]),'Exten':_0xf64b('0x21'),'Context':_0xf64b('0x3d'),'Priority':'1','variable':_0x1f0b5a,'timeout':(_0x259426[_0xf64b('0x3e')]||0x1e)*0x3e8,'async':!![],'channelid':_0x20e4a0[_0xf64b('0x3f')]};};exports[_0xf64b('0x40')]=function(_0x5ee2c2){return _0x5ee2c2['countbusyretry']+_0x5ee2c2['countcongestionretry']+_0x5ee2c2[_0xf64b('0x41')]+_0x5ee2c2[_0xf64b('0x42')]+_0x5ee2c2[_0xf64b('0x43')];};exports[_0xf64b('0x44')]=function(_0x1eafc1){var _0x15afcb=_['clone'](_0x1eafc1);_0x15afcb[_0xf64b('0x29')]=0xf;_0x15afcb['statedesc']='Global';return _0x15afcb;};exports['scheduledAt']=function(_0x426698,_0x1206da,_0x3cf230){var _0x5274f2={};_0x5274f2[_0x1206da]=_0x426698[_0x1206da];_0x5274f2['active']=![];_0x5274f2[_0xf64b('0x45')]=moment()['add'](_0x3cf230,_0xf64b('0x46'))[_0xf64b('0xe')](_0xf64b('0x2f'));_0x5274f2[_0xf64b('0x15')]=_0x426698[_0xf64b('0x15')];_0x5274f2['ListId']=_0x426698[_0xf64b('0x47')];_0x5274f2[_0xf64b('0x16')]=_0x426698[_0xf64b('0x16')]||undefined;return _0x5274f2;};exports['decrementTalking']=function(_0x898309,_0x2fe387){if(!_[_0xf64b('0x10')](_0x898309)){if(_0x898309[_0xf64b('0x48')]>0x0){_0x898309['pTalking']-=0x1;}else{logger[_0xf64b('0x8')](_0x2fe387,_0xf64b('0x49'));}}else{logger[_0xf64b('0x6')](_0x2fe387,'[decrementTalking]\x20is\x20null\x20or\x20undefined');}};exports['IsNotLoggedIn']=function(_0x331688){if(_0x331688<=0x0){return!![];}return![];};function buildObj(_0x38337a,_0x5ca7aa,_0x4509e0){_0x38337a['lastevent']=_0x5ca7aa;_0x38337a[_0xf64b('0x13')]=_0x38337a[_0xf64b('0x4a')];_0x38337a[_0xf64b('0x4b')]=_0x38337a['channelAgent'];_0x38337a['motionChannel']=_0xf64b('0x4c');if(_0x4509e0){_0x38337a[_0xf64b('0x4d')]=_0x4509e0[_0xf64b('0x4d')];}return _0x38337a;}exports[_0xf64b('0x4e')]=buildObj;exports['agentReadyId']=function(_0x15b4a6){var _0x277848=[];for(var _0x5ad9b0 in _0x15b4a6){if(_0x15b4a6['hasOwnProperty'](_0x5ad9b0)){if(!_[_0xf64b('0x10')](_0x15b4a6[_0x5ad9b0])&&_0x15b4a6[_0x5ad9b0][_0xf64b('0x29')]===_0xf64b('0x4f')&&_0x15b4a6[_0x5ad9b0][_0xf64b('0x50')]===_0xf64b('0x51')){_0x277848[_0xf64b('0x52')](_0x15b4a6[_0x5ad9b0]['id']);}}}return _0x277848;};exports['getDiff']=function(_0xea9e6a){var _0x420290=moment()['milliseconds'](0x0);var _0x5be9b8=moment(_0xea9e6a)[_0xf64b('0x53')](0x0);return _0x420290[_0xf64b('0x54')](_0x5be9b8,_0xf64b('0x55'));};exports['createBody']=function(_0x38fc6e){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x38fc6e[_0xf64b('0x15')],'ListId':_0x38fc6e[_0xf64b('0x47')],'VoiceQueueId':_0x38fc6e[_0xf64b('0x16')]||undefined,'CampaignId':_0x38fc6e['CampaignId']||undefined};};exports[_0xf64b('0x56')]=function(_0x347b43){if(_0x347b43===_0xf64b('0x3f')||_0x347b43===_0xf64b('0x57')||_0x347b43==='queue'||_0x347b43==='type'||_0x347b43===_0xf64b('0x58')||_0x347b43===_0xf64b('0x59')||_0x347b43===_0xf64b('0x34')||_0x347b43==='channelAgent'||_0x347b43===_0xf64b('0x3b')||_0x347b43===_0xf64b('0x5a')||_0x347b43===_0xf64b('0x14')||_0x347b43===_0xf64b('0x45')||_0x347b43===_0xf64b('0x5b')||_0x347b43===_0xf64b('0x5c')||_0x347b43===_0xf64b('0x41')||_0x347b43==='countglobal'||_0x347b43===_0xf64b('0x5d')||_0x347b43==='callbackuniqueid'||_0x347b43===_0xf64b('0x5e')||_0x347b43===_0xf64b('0x5f')||_0x347b43===_0xf64b('0x15')||_0x347b43===_0xf64b('0x47')||_0x347b43==='UserId'||_0x347b43===_0xf64b('0x16')||_0x347b43===_0xf64b('0x60')||_0x347b43===_0xf64b('0x61')||_0x347b43===_0xf64b('0x62')||_0x347b43==='xmd-phone'||_0x347b43===_0xf64b('0x63')||_0x347b43==='xmd-dialurl'||_0x347b43===_0xf64b('0x64')||_0x347b43===_0xf64b('0x65')||_0x347b43===_0xf64b('0x66')||_0x347b43===_0xf64b('0x67')||_0x347b43==='xmd-contactid'||_0x347b43===_0xf64b('0x68')||_0x347b43==='xmd-callerid'||_0x347b43===_0xf64b('0x69')||_0x347b43===_0xf64b('0x6a')||_0x347b43===_0xf64b('0x6b')||_0x347b43===_0xf64b('0x6c')||_0x347b43===_0xf64b('0x6d')||_0x347b43===_0xf64b('0x6e')||_0x347b43===_0xf64b('0x6f')||_0x347b43===_0xf64b('0x70')||_0x347b43===_0xf64b('0x71')||_0x347b43===_0xf64b('0x72')||_0x347b43===_0xf64b('0x6b')||_0x347b43===_0xf64b('0x6c')||_0x347b43===_0xf64b('0x6d')||_0x347b43==='rtpaudioqosjitterbridged'||_0x347b43===_0xf64b('0x6f')||_0x347b43===_0xf64b('0x70')||_0x347b43===_0xf64b('0x71')||_0x347b43===_0xf64b('0x72')||_0x347b43===_0xf64b('0x73')||_0x347b43===_0xf64b('0x74')||_0x347b43===_0xf64b('0x29')||_0x347b43===_0xf64b('0x2a')){return![];}return!![];};exports[_0xf64b('0x75')]=function(_0x40001b,_0x4dc4d9){var _0x4235bb,_0x4ed8e3,_0x47cfb8;if(_0x4dc4d9<=0x0){_0x4dc4d9=0x1;}_0x4235bb=new RegExp(_0xf64b('0x76')+_0x4dc4d9+'}$');_0x4ed8e3=Math[_0xf64b('0x77')](0xa,_0x4dc4d9-0x1);_0x47cfb8=Math['pow'](0xa,_0x4dc4d9)-0x1;return util['format']('%s',_[_0xf64b('0x78')](_0x40001b,_0x4235bb,_['random'](_0x4ed8e3,_0x47cfb8)));};exports[_0xf64b('0x79')]=function(_0x37935c){var _0x3ab44a=_0x37935c[_0xf64b('0x7a')](/"(.*?)"/);return _0x3ab44a?_0x3ab44a[0x1]:_0x37935c;};exports[_0xf64b('0x7b')]=function(_0x2f2c2e){var _0x421cbe=_0x2f2c2e[_0xf64b('0x7a')](/<(.*?)>/);return _0x421cbe?_0x421cbe[0x1]:_0x2f2c2e;};function buildNoAnswerEventPayload(_0x245f1d,_0x405140){var _0x5ad6db=buildObj(_0x245f1d,_0xf64b('0x7c'));if(!_['isEmpty'](_0x405140['variables'])){Object[_0xf64b('0x7d')](_0x405140[_0xf64b('0x7e')])[_0xf64b('0x7f')](function(_0x1f888a){_0x5ad6db[_0x1f888a[_0xf64b('0x80')]()]=_0x405140[_0xf64b('0x7e')][_0x1f888a];});}return _0x5ad6db;}exports[_0xf64b('0x81')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 8d5308b..5303654 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 _0x7b0d=['string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicequeuechannelredirect','queueadd'];(function(_0x2834c7,_0xf21164){var _0x5538b1=function(_0x58b277){while(--_0x58b277){_0x2834c7['push'](_0x2834c7['shift']());}};_0x5538b1(++_0xf21164);}(_0x7b0d,0x182));var _0xd7b0=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7b0d[_0xbb091];return _0x467a04;};'use strict';exports[_0xd7b0('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xd7b0('0x1'),'required':!![]},'penalty':{'type':_0xd7b0('0x2'),'required':![]},'paused':{'type':_0xd7b0('0x3'),'required':![]}};exports[_0xd7b0('0x4')]={'queue':{'type':_0xd7b0('0x1'),'required':!![]},'interface':{'type':_0xd7b0('0x1'),'required':!![]}};exports[_0xd7b0('0x5')]={'interface':{'type':_0xd7b0('0x1'),'required':!![]},'paused':{'type':_0xd7b0('0x3')},'reason':{'type':'string','required':![]}};exports[_0xd7b0('0x6')]={'module':{'type':'string','required':![]}};exports[_0xd7b0('0x7')]={'uniqueid':{'type':_0xd7b0('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xd7b0('0x1'),'required':!![]},'filename':{'type':_0xd7b0('0x1')},'format':{'type':_0xd7b0('0x1')},'mixmonitorid':{'type':_0xd7b0('0x1')}};exports['voicequeuechannelhangup']={'uniqueid':{'type':'string','required':!![]}};exports[_0xd7b0('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0xd7b0('0x1'),'required':!![]},'context':{'type':_0xd7b0('0x1')}}; \ No newline at end of file +var _0x2d45=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove','queuepause'];(function(_0x5e462b,_0x187b06){var _0xb01a65=function(_0x2cc9a3){while(--_0x2cc9a3){_0x5e462b['push'](_0x5e462b['shift']());}};_0xb01a65(++_0x187b06);}(_0x2d45,0x170));var _0x52d4=function(_0x832f17,_0x19d302){_0x832f17=_0x832f17-0x0;var _0x59ef13=_0x2d45[_0x832f17];return _0x59ef13;};'use strict';exports[_0x52d4('0x0')]={'queue':{'type':_0x52d4('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0x52d4('0x1'),'required':!![]},'penalty':{'type':_0x52d4('0x2'),'required':![]},'paused':{'type':_0x52d4('0x3'),'required':![]}};exports[_0x52d4('0x4')]={'queue':{'type':_0x52d4('0x1'),'required':!![]},'interface':{'type':_0x52d4('0x1'),'required':!![]}};exports[_0x52d4('0x5')]={'interface':{'type':_0x52d4('0x1'),'required':!![]},'paused':{'type':_0x52d4('0x3')},'reason':{'type':_0x52d4('0x1'),'required':![]}};exports[_0x52d4('0x6')]={'module':{'type':_0x52d4('0x1'),'required':![]}};exports[_0x52d4('0x7')]={'uniqueid':{'type':_0x52d4('0x1'),'required':!![]}};exports[_0x52d4('0x8')]={'uniqueid':{'type':_0x52d4('0x1'),'required':!![]},'filename':{'type':_0x52d4('0x1')},'format':{'type':_0x52d4('0x1')},'mixmonitorid':{'type':_0x52d4('0x1')}};exports[_0x52d4('0x9')]={'uniqueid':{'type':_0x52d4('0x1'),'required':!![]}};exports[_0x52d4('0xa')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x52d4('0x1'),'required':!![]},'context':{'type':_0x52d4('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 01fd6a3..1f6f6dd 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x924737,_0x2f5242){var _0x9a5c86=function(_0xa7bbd5){while(--_0xa7bbd5){_0x924737['push'](_0x924737['shift']());}};_0x9a5c86(++_0x2f5242);}(_0x5f66,0x1a0));var _0x65f6=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5f66[_0x465028];return _0xb783d4;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x5b5fc9,_0x1aa61a){var _0x26f48f=function(_0x13c44f){while(--_0x13c44f){_0x5b5fc9['push'](_0x5b5fc9['shift']());}};_0x26f48f(++_0x1aa61a);}(_0xdb28,0x106));var _0x8db2=function(_0x5ae700,_0x1cd241){_0x5ae700=_0x5ae700-0x0;var _0x1355c2=_0xdb28[_0x5ae700];return _0x1355c2;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index f75b15a..498ef7c 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 _0x1cfa=['assign','hasOwnProperty'];(function(_0x13c5bf,_0x336fca){var _0x242af1=function(_0xe19740){while(--_0xe19740){_0x13c5bf['push'](_0x13c5bf['shift']());}};_0x242af1(++_0x336fca);}(_0x1cfa,0x1de));var _0xa1cf=function(_0x47cb68,_0x3ac3d7){_0x47cb68=_0x47cb68-0x0;var _0x3cecb3=_0x1cfa[_0x47cb68];return _0x3cecb3;};'use strict';function mergeDBDataToRealtime(_0x37aef0,_0x1a6e61){var _0x2f3b73=Object[_0xa1cf('0x0')]({},_0x37aef0);for(var _0x125c41 in _0x1a6e61){if(_0x2f3b73[_0xa1cf('0x1')](_0x125c41)){_0x2f3b73[_0x125c41]=_0x1a6e61[_0x125c41];}}return _0x2f3b73;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0xfef2=['assign','hasOwnProperty','mergeDBDataToRealtime'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xfef2,0x10b));var _0x2fef=function(_0x137815,_0x78dd4b){_0x137815=_0x137815-0x0;var _0x29ded1=_0xfef2[_0x137815];return _0x29ded1;};'use strict';function mergeDBDataToRealtime(_0x7ea8cb,_0x12984b){var _0x12b7d6=Object[_0x2fef('0x0')]({},_0x7ea8cb);for(var _0x5ccd30 in _0x12984b){if(_0x12b7d6[_0x2fef('0x1')](_0x5ccd30)){_0x12b7d6[_0x5ccd30]=_0x12984b[_0x5ccd30];}}return _0x12b7d6;}exports[_0x2fef('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index ccceeb8..a37c391 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 _0x2c6e=['phone','voiceDialReport','transfererlinkedid','attendedTransfer','exports','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','./voiceQueueReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','findAgent','find','accountcode','name','interface','format','SIP/%s','length','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','getAgentByInternal','keys','getCallType','channel','split','calleridnum','outbound','internal','destination','exten','dialer','queue','lastdata','context','from-voip-provider','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','calleridpreview','disposition','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','linkedid','transfers','transfereelinkedid','uniqueid','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','voiceAgentReport','isArray','forEach','startsWith','Local','substring','indexOf','mobile'];(function(_0x242f38,_0x1c8cca){var _0x59a1f2=function(_0x3a234b){while(--_0x3a234b){_0x242f38['push'](_0x242f38['shift']());}};_0x59a1f2(++_0x1c8cca);}(_0x2c6e,0x181));var _0xe2c6=function(_0x2a8797,_0x501b74){_0x2a8797=_0x2a8797-0x0;var _0x52fa1d=_0x2c6e[_0x2a8797];return _0x52fa1d;};'use strict';var _=require('lodash');var moment=require(_0xe2c6('0x0'));var util=require('util');var config=require(_0xe2c6('0x1'));var ami=require(_0xe2c6('0x2'));var RpcVoiceAgentReport=require(_0xe2c6('0x3'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xe2c6('0x4'));var RpcVoiceQueueReport=require(_0xe2c6('0x5'));var RpcVoiceRecording=require(_0xe2c6('0x6'));var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0xe2c6('0x7'));var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xe2c6('0x8'));var VoiceDialReport=require(_0xe2c6('0x9'));var UserReport=require(_0xe2c6('0xa'));function Report(_0x30ea19){this[_0xe2c6('0xb')]=_0x30ea19;this[_0xe2c6('0xc')]=_0x30ea19[_0xe2c6('0xc')];this[_0xe2c6('0xd')]=_0x30ea19[_0xe2c6('0xd')];}Report[_0xe2c6('0xe')][_0xe2c6('0xf')]=function(_0x93cbe5){var _0x43266c=new VoiceQueueReport(this[_0xe2c6('0xb')]);var _0x24bde7=new VoiceAgentReport(this[_0xe2c6('0xb')]);var _0x4acd44=new VoiceDialReport(this['realtime']);var _0x3cec4f=new VoiceCallReport(this['realtime']);var _0x315062=new UserReport(this[_0xe2c6('0xb')]);if(config[_0xe2c6('0x10')]&&config['xdr'][_0xe2c6('0x11')]){ami['on'](_0xe2c6('0x12'),this[_0xe2c6('0x13')][_0xe2c6('0x14')](this));ami['on'](_0xe2c6('0x15'),this[_0xe2c6('0x16')]['bind'](this));ami['on'](_0xe2c6('0x17'),this['voiceAgentReport'][_0xe2c6('0x14')](this));ami['on'](_0xe2c6('0x18'),this['voiceDialReport']['bind'](this));ami['on'](_0xe2c6('0x19'),this[_0xe2c6('0x1a')]['bind'](this));ami['on'](_0xe2c6('0x1b'),this['attendedTransfer']['bind'](this));}};Report['prototype'][_0xe2c6('0x1c')]=function(_0x3f4492){var _0x40979e;_0x40979e=_[_0xe2c6('0x1d')](this[_0xe2c6('0xc')],function(_0x5017a3){return _0x5017a3[_0xe2c6('0x1e')]==_0x3f4492||_0x5017a3[_0xe2c6('0x1f')]==_0x3f4492;});if(_['isNil'](_0x40979e)){var _0x3f3efe=_[_0xe2c6('0x1d')](this[_0xe2c6('0xd')],function(_0x46b06a){return _0x46b06a[_0xe2c6('0x1e')]==_0x3f4492||_0x46b06a[_0xe2c6('0x1f')]==_0x3f4492;});if(_0x3f3efe){_0x40979e=_['find'](this['agents'],function(_0x3cc422){return _0x3cc422[_0xe2c6('0x20')]==util[_0xe2c6('0x21')](_0xe2c6('0x22'),_0x3f3efe[_0xe2c6('0x1f')]);});}}return _0x40979e;};Report[_0xe2c6('0xe')][_0xe2c6('0x13')]=function(_0x37d24a){for(var _0x5151f2=0x0;_0x5151f2<_0x37d24a[_0xe2c6('0x23')];_0x5151f2+=0x1){var _0xf40e26=this[_0xe2c6('0x1c')](_0x37d24a[_0x5151f2]['connectedlinenum']);if(_0xf40e26){_0x37d24a[_0x5151f2]['accountcode']=_0xf40e26['accountcode'];_0x37d24a[_0x5151f2]['assigned']=!![];_0x37d24a[_0x5151f2][_0xe2c6('0x24')]=_0xf40e26[_0xe2c6('0x1f')];_0x37d24a[_0x5151f2][_0xe2c6('0x20')]=_[_0xe2c6('0x25')](_0xf40e26[_0xe2c6('0x20')])?util[_0xe2c6('0x21')]('SIP/%s',_0xf40e26['name']):_0xf40e26['interface'];if(_0x37d24a[_0x5151f2][_0xe2c6('0x26')]){_0x37d24a[_0x5151f2][_0xe2c6('0x27')]=moment()['format'](_0xe2c6('0x28'));}if(_0x37d24a[_0x5151f2][_0xe2c6('0x29')]){_0x37d24a[_0x5151f2][_0xe2c6('0x2a')]=moment()[_0xe2c6('0x21')](_0xe2c6('0x28'));}RpcMemberReport[_0xe2c6('0x13')](_0x37d24a[_0x5151f2]);}RpcVoiceQueueReport[_0xe2c6('0x2b')](_0x37d24a[_0x5151f2]);}};function extractCalleridNumber(_0xa22f99){var _0x2fe5e0=_0xa22f99['match'](/<(.*?)>/);return _0x2fe5e0?_0x2fe5e0[0x1]:_0xa22f99;}Report[_0xe2c6('0xe')][_0xe2c6('0x2c')]=function(_0x5248eb){for(var _0xa7b068=0x0;_0xa7b068/);return _0x2d146d?_0x2d146d[0x1]:_0x30986e;}Report['prototype'][_0xcff5('0x35')]=function(_0x90020a){for(var _0x2e63fd=0x0;_0x2e63fd',_0x247445[_0xcff5('0x48')],_0x247445[_0xcff5('0x37')]);}if(RpcVoiceTransferReport['transfers'][_0x247445[_0xcff5('0x49')]]){var _0xd0454b=RpcVoiceTransferReport[_0xcff5('0x4a')][_0x247445[_0xcff5('0x49')]];_0xd0454b[_0xcff5('0x4b')]=_0x247445[_0xcff5('0x4c')];RpcVoiceTransferReport[_0xcff5('0x1e')](_0xd0454b);delete RpcVoiceTransferReport['transfers'][_0x247445[_0xcff5('0x49')]];}if(_[_0xcff5('0x25')](_0x247445[_0xcff5('0x3b')])){_0x247445[_0xcff5('0x3b')]=this['getCallType'](_0x247445);}if(_[_0xcff5('0x25')](_0x247445['UserId'])){var _0x5f0593=_0x247445[_0xcff5('0x43')][_0xcff5('0x36')]('-')[0x0];var _0x48067a=this['agents'][_0x5f0593];if(!_0x48067a)_0x48067a=this[_0xcff5('0x35')](_0x247445[_0xcff5('0x2b')]);if(_0x48067a){_0x247445[_0xcff5('0x4d')]=_0x48067a['id'];_0x247445[_0xcff5('0x4e')]=_0x48067a[_0xcff5('0x24')];}}RpcVoiceCallReport['create'](_0x247445);if(_0x247445['monitor']){for(var _0x2be482=0x0;_0x2be482<_0x247445['monitors'][_0xcff5('0x29')];_0x2be482+=0x1){_0x247445[_0xcff5('0x4f')]=_0x247445['monitors'][_0x2be482]['filename'];_0x247445[_0xcff5('0x50')]=_0x247445[_0xcff5('0x51')][_0x2be482]['createdAt'];if(_0x247445[_0xcff5('0x52')]==_0xcff5('0x53')){_0x247445[_0xcff5('0x37')]=_0x247445[_0xcff5('0x2a')];_0x247445['calleridname']=_0x247445['connectedlinename'];_0x247445['connectedlinenum']=_0x247445[_0xcff5('0x2b')];_0x247445[_0xcff5('0x54')]=_0x247445[_0xcff5('0x4e')];_0x247445[_0xcff5('0x52')]=_0x247445[_0xcff5('0x45')];}else if(_0x247445[_0xcff5('0x52')]=='xcally-motion-dialer'){_0x247445[_0xcff5('0x37')]=_0x247445['destination'];_0x247445['exten']=_0x247445[_0xcff5('0x45')];}RpcVoiceRecording['create'](_0x247445);}}};Report['prototype'][_0xcff5('0x1b')]=function(_0x12fdcc){if(_['isArray'](_0x12fdcc)){_0x12fdcc[_0xcff5('0x55')](function(_0x21babb){RpcVoiceAgentReport[_0xcff5('0x33')](_0x21babb);});}else{RpcVoiceAgentReport[_0xcff5('0x33')](_0x12fdcc);}};Report[_0xcff5('0x21')]['voiceDialReport']=function(_0x3a17a4){RpcVoiceDialReport[_0xcff5('0x33')](_0x3a17a4);var _0x4dbe6c;var _0x5e67ab;var _0x20dbb8=_0x3a17a4['channel'];if(_[_0xcff5('0x56')](_0x20dbb8,_0xcff5('0x57'))){_0x5e67ab=_0x20dbb8[_0xcff5('0x58')](_0x20dbb8['indexOf']('/')+0x1,_0x20dbb8[_0xcff5('0x59')]('@'));_0x4dbe6c=_['find'](this['agents'],function(_0x4646e8){return _0x4646e8['mobile']==_0x5e67ab||_0x4646e8['phone']==_0x5e67ab||_0x4646e8[_0xcff5('0x2b')]==_0x5e67ab;});}else{_0x5e67ab=_0x20dbb8[_0xcff5('0x58')](_0x20dbb8[_0xcff5('0x59')]('/')+0x1,_0x20dbb8[_0xcff5('0x5a')]('-'));_0x4dbe6c=this[_0xcff5('0x22')](_0x5e67ab);}if(_0x4dbe6c){_0x3a17a4[_0xcff5('0x26')]=_[_0xcff5('0x25')](_0x4dbe6c['interface'])?util['format'](_0xcff5('0x28'),_0x4dbe6c[_0xcff5('0x24')]):_0x4dbe6c['interface'];_0x3a17a4['membername']=_0x4dbe6c[_0xcff5('0x24')];_0x3a17a4[_0xcff5('0x2b')]=_0x4dbe6c[_0xcff5('0x2b')];RpcMemberReport[_0xcff5('0x5b')](_0x3a17a4);}};Report['prototype'][_0xcff5('0x1e')]=function(_0x4175f2){RpcVoiceTransferReport[_0xcff5('0x4a')][_0x4175f2[_0xcff5('0x5c')]]=_0x4175f2;};Report[_0xcff5('0x21')][_0xcff5('0x20')]=function(_0x475026){RpcVoiceTransferReport[_0xcff5('0x20')](_0x475026);};module['exports']=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index efe471d..50e225f 100644 --- a/server/services/ami/report/userReport.js +++ b/server/services/ami/report/userReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1508=['catch','error','[userReport][sipshowregistry]','inspect','resolve','actionSipPeerStatus','prototype','emit','isNotNull','[userReport][registry]\x20registry:%s\x20state:%s','state','username','stateRegistry','event','actionid','debug','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','trunk:save','[userReport][registry]','info','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','agents','local','toLowerCase','stateTime','toNumber','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','Local','indexOf','mobile','phone','accountcode','updateStatusRealtime','[userReport][devicestatechange]','address','peer','registered','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','[userReport][peerstatus]','exports','lodash','moment','util','ioredis','bluebird','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','trunks','telephones','registryentry','syncRegistry','devicestatechange','syncDeviceState','bind','peerstatus','syncPeerStatus','syncRealtimeShow','then'];(function(_0x319ebd,_0xca2c72){var _0x513fda=function(_0x592c6c){while(--_0x592c6c){_0x319ebd['push'](_0x319ebd['shift']());}};_0x513fda(++_0xca2c72);}(_0x1508,0x1e0));var _0x8150=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x1508[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x8150('0x0'));var moment=require(_0x8150('0x1'));var util=require(_0x8150('0x2'));var Redis=require(_0x8150('0x3'));var BPromise=require(_0x8150('0x4'));var config=require(_0x8150('0x5'));var logger=require(_0x8150('0x6'))(_0x8150('0x7'));var ami=require(_0x8150('0x8'));config[_0x8150('0x9')]=_[_0x8150('0xa')](config[_0x8150('0x9')],{'host':_0x8150('0xb'),'port':0x18eb});var io=require(_0x8150('0xc'))(new Redis(config[_0x8150('0x9')]));function UserReport(_0x15ffa4){this['trunks']=_0x15ffa4[_0x8150('0xd')];this['agents']=_0x15ffa4['agents'];this['telephones']=_0x15ffa4[_0x8150('0xe')];ami['on'](_0x8150('0xf'),this['syncRegistry']['bind'](this));ami['on']('registry',this[_0x8150('0x10')]['bind'](this));ami['on'](_0x8150('0x11'),this[_0x8150('0x12')][_0x8150('0x13')](this));ami['on'](_0x8150('0x14'),this[_0x8150('0x15')][_0x8150('0x13')](this));return this[_0x8150('0x16')]();}function showSipRegistrations(){Promise['resolve']()[_0x8150('0x17')](ami['actionSipShowRegistry']())[_0x8150('0x18')](function(_0x49097d){logger[_0x8150('0x19')](_0x8150('0x1a'),util[_0x8150('0x1b')](_0x49097d,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x8150('0x1c')]()['then'](ami['actionDeviceStateList']())['catch'](function(_0xbe7e82){logger[_0x8150('0x19')]('[userReport][devicestatelist]',util[_0x8150('0x1b')](_0xbe7e82,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise['resolve']()['then'](ami[_0x8150('0x1d')]())[_0x8150('0x18')](function(_0x509d00){logger[_0x8150('0x19')]('[userReport][sippeerstatus]',util[_0x8150('0x1b')](_0x509d00,{'showHidden':![],'depth':null}));});}UserReport[_0x8150('0x1e')][_0x8150('0x16')]=function(){setInterval(function(){BPromise[_0x8150('0x1c')]()[_0x8150('0x17')](showSipRegistrations())['then'](listDeviceStates())[_0x8150('0x17')](showPeersStatus());},0x32c8);};UserReport[_0x8150('0x1e')]['isNotNull']=function(_0x337612){return _0x337612!==null&&!_['isUndefined'](_0x337612);};UserReport[_0x8150('0x1e')][_0x8150('0x1f')]=function(_0x9a103c,_0x11a4f1,_0xbac0bf){io['to'](_0x9a103c)[_0x8150('0x1f')](_0x11a4f1,_0xbac0bf);};UserReport['prototype'][_0x8150('0x10')]=function(_0x2b8106){try{if(this[_0x8150('0x20')](_0x2b8106)){logger['info'](_0x8150('0x21'),_0x2b8106['username'],_0x2b8106[_0x8150('0x22')]);logger['debug']('[userReport][registry]',util['inspect'](_0x2b8106,{'showHidden':![],'depth':null}));var _0x5ca1c7=_['find'](this[_0x8150('0xd')],{'defaultuser':_0x2b8106[_0x8150('0x23')]});if(_0x5ca1c7){_0x2b8106[_0x8150('0x24')]=_0x2b8106[_0x8150('0x22')];_['merge'](_0x5ca1c7,_['omit'](_0x2b8106,[_0x8150('0x25'),_0x8150('0x26'),_0x8150('0x23'),_0x8150('0x22')]));logger[_0x8150('0x27')](_0x8150('0x28'),util[_0x8150('0x1b')](_0x5ca1c7,{'showHidden':![],'depth':null}));this[_0x8150('0x1f')](util[_0x8150('0x29')](_0x8150('0x2a'),_0x5ca1c7[_0x8150('0x2b')]),_0x8150('0x2c'),_0x5ca1c7);}}}catch(_0x25802f){logger[_0x8150('0x19')](_0x8150('0x2d'),util[_0x8150('0x1b')](_0x25802f,{'showHidden':![],'depth':null}));}};UserReport[_0x8150('0x1e')][_0x8150('0x12')]=function(_0x3258e1){try{if(this[_0x8150('0x20')](_0x3258e1)){logger[_0x8150('0x2e')](_0x8150('0x2f'),_0x3258e1[_0x8150('0x30')],_0x3258e1[_0x8150('0x22')]);logger[_0x8150('0x27')]('[userReport][devicestatechange]',util[_0x8150('0x1b')](_0x3258e1,{'showHidden':![],'depth':null}));if(this[_0x8150('0x31')][_0x3258e1[_0x8150('0x30')]]){if(!this[_0x8150('0x31')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x32')]||_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]()=='inuse'){this[_0x8150('0x31')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x32')]=![];if(this[_0x8150('0x31')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x22')]!==_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]()){this['agents'][_0x3258e1[_0x8150('0x30')]][_0x8150('0x34')]=_[_0x8150('0x35')](moment()[_0x8150('0x29')]('x'));}this['agents'][_0x3258e1[_0x8150('0x30')]][_0x8150('0x22')]=_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]();this[_0x8150('0x31')][_0x3258e1['device']]['updateStatusRealtime'](_0x3258e1);}}else if(this[_0x8150('0xe')][_0x3258e1['device']]){if(this[_0x8150('0xe')][_0x3258e1[_0x8150('0x30')]]['state']!==_0x3258e1['state'][_0x8150('0x33')]()){this[_0x8150('0xe')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x34')]=_[_0x8150('0x35')](moment()[_0x8150('0x29')]('x'));}this[_0x8150('0xe')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x22')]=_0x3258e1[_0x8150('0x22')]['toLowerCase']();logger[_0x8150('0x27')](_0x8150('0x36'),util[_0x8150('0x1b')](this[_0x8150('0xe')][_0x3258e1['device']],{'showHidden':![],'depth':null}));this[_0x8150('0x1f')](util[_0x8150('0x29')](_0x8150('0x37'),this[_0x8150('0xe')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x2b')]),_0x8150('0x38'),this['telephones'][_0x3258e1[_0x8150('0x30')]]);}else if(this[_0x8150('0xd')][_0x3258e1[_0x8150('0x30')]]){if(this['trunks'][_0x3258e1[_0x8150('0x30')]]['state']!==_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]()){this[_0x8150('0xd')][_0x3258e1[_0x8150('0x30')]]['stateTime']=_[_0x8150('0x35')](moment()['format']('x'));}this[_0x8150('0xd')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x22')]=_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]();logger[_0x8150('0x27')](_0x8150('0x39'),util[_0x8150('0x1b')](this[_0x8150('0xd')][_0x3258e1[_0x8150('0x30')]],{'showHidden':![],'depth':null}));this[_0x8150('0x1f')](util[_0x8150('0x29')](_0x8150('0x2a'),this[_0x8150('0xd')][_0x3258e1[_0x8150('0x30')]][_0x8150('0x2b')]),_0x8150('0x2c'),this[_0x8150('0xd')][_0x3258e1[_0x8150('0x30')]]);}else if(_['startsWith'](_0x3258e1['device'],_0x8150('0x3a'))){var _0x19fda4=_0x3258e1['device'];var _0x8ca436=_0x19fda4['substring'](_0x19fda4[_0x8150('0x3b')]('/')+0x1,_0x19fda4[_0x8150('0x3b')]('@'));var _0x3536ae=_['find'](this[_0x8150('0x31')],function(_0x371d72){return _0x371d72[_0x8150('0x3c')]==_0x8ca436||_0x371d72[_0x8150('0x3d')]==_0x8ca436||_0x371d72[_0x8150('0x3e')]==_0x8ca436;});if(_0x3536ae){if(_0x3536ae[_0x8150('0x22')]!==_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]()){_0x3536ae[_0x8150('0x34')]=_[_0x8150('0x35')](moment()[_0x8150('0x29')]('x'));}_0x3536ae[_0x8150('0x22')]=_0x3258e1[_0x8150('0x22')][_0x8150('0x33')]();_0x3536ae[_0x8150('0x32')]=!![];_0x3536ae[_0x8150('0x3f')](_0x3258e1);}}}}catch(_0x3d50d2){logger['error'](_0x8150('0x40'),util[_0x8150('0x1b')](_0x3d50d2,{'showHidden':![],'depth':null}));}};UserReport[_0x8150('0x1e')][_0x8150('0x15')]=function(_0x19117d){try{if(this['isNotNull'](_0x19117d)&&this[_0x8150('0x20')](_0x19117d[_0x8150('0x14')])){logger[_0x8150('0x2e')]('[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s',_0x19117d['peer'],_0x19117d[_0x8150('0x41')],_0x19117d[_0x8150('0x14')]);logger[_0x8150('0x27')]('[userReport][peerstatus]',util[_0x8150('0x1b')](_0x19117d,{'showHidden':![],'depth':null}));if(this[_0x8150('0x31')][_0x19117d['peer']]){if(!this['agents'][_0x19117d[_0x8150('0x42')]][_0x8150('0x32')]||_0x19117d[_0x8150('0x14')][_0x8150('0x33')]()==_0x8150('0x43')){this['agents'][_0x19117d[_0x8150('0x42')]]['local']=![];this[_0x8150('0x31')][_0x19117d[_0x8150('0x42')]][_0x8150('0x44')]=_0x19117d[_0x8150('0x14')][_0x8150('0x33')]();this[_0x8150('0x31')][_0x19117d[_0x8150('0x42')]]['address']=_0x19117d['address'];this[_0x8150('0x31')][_0x19117d[_0x8150('0x42')]][_0x8150('0x3f')](_0x19117d);}}else if(this[_0x8150('0xe')][_0x19117d[_0x8150('0x42')]]){this[_0x8150('0xe')][_0x19117d[_0x8150('0x42')]][_0x8150('0x44')]=_0x19117d[_0x8150('0x14')][_0x8150('0x33')]();this[_0x8150('0xe')][_0x19117d[_0x8150('0x42')]][_0x8150('0x41')]=_0x19117d[_0x8150('0x41')];logger[_0x8150('0x27')]('[userReport][peerstatus]\x20sending\x20telephone:save\x20event:',util[_0x8150('0x1b')](this['telephones'][_0x19117d[_0x8150('0x42')]],{'showHidden':![],'depth':null}));this[_0x8150('0x1f')](util[_0x8150('0x29')](_0x8150('0x37'),this[_0x8150('0xe')][_0x19117d[_0x8150('0x42')]][_0x8150('0x2b')]),_0x8150('0x38'),this[_0x8150('0xe')][_0x19117d[_0x8150('0x42')]]);}else if(this['trunks'][_0x19117d[_0x8150('0x42')]]){this[_0x8150('0xd')][_0x19117d['peer']][_0x8150('0x44')]=_0x19117d['peerstatus'][_0x8150('0x33')]();this[_0x8150('0xd')][_0x19117d[_0x8150('0x42')]][_0x8150('0x41')]=_0x19117d[_0x8150('0x41')];logger[_0x8150('0x27')](_0x8150('0x45'),util['inspect'](this[_0x8150('0xd')][_0x19117d[_0x8150('0x42')]],{'showHidden':![],'depth':null}));this[_0x8150('0x1f')](util['format'](_0x8150('0x2a'),this[_0x8150('0xd')][_0x19117d[_0x8150('0x42')]][_0x8150('0x2b')]),_0x8150('0x2c'),this['trunks'][_0x19117d['peer']]);}}}catch(_0x1e0355){logger[_0x8150('0x19')](_0x8150('0x46'),util['inspect'](_0x1e0355,{'showHidden':![],'depth':null}));}};module[_0x8150('0x47')]=UserReport; \ No newline at end of file +var _0xb99d=['isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','[userReport][registry]','find','merge','actionid','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','name','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','stateTime','toNumber','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','trunk:save','startsWith','Local','substring','indexOf','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','status','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','exports','moment','util','ioredis','../../../config/logger','ami','defaults','redis','localhost','trunks','agents','telephones','registryentry','syncRegistry','bind','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','[userReport][sippeerstatus]','prototype','isUndefined','emit'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xb99d,0xfe));var _0xdb99=function(_0x3dd96e,_0x339e08){_0x3dd96e=_0x3dd96e-0x0;var _0x27a4a0=_0xb99d[_0x3dd96e];return _0x27a4a0;};'use strict';var _=require('lodash');var moment=require(_0xdb99('0x0'));var util=require(_0xdb99('0x1'));var Redis=require(_0xdb99('0x2'));var BPromise=require('bluebird');var config=require('../../../config/environment');var logger=require(_0xdb99('0x3'))(_0xdb99('0x4'));var ami=require('../ami');config['redis']=_[_0xdb99('0x5')](config[_0xdb99('0x6')],{'host':_0xdb99('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xdb99('0x6')]));function UserReport(_0x1ca36f){this[_0xdb99('0x8')]=_0x1ca36f[_0xdb99('0x8')];this[_0xdb99('0x9')]=_0x1ca36f['agents'];this[_0xdb99('0xa')]=_0x1ca36f[_0xdb99('0xa')];ami['on'](_0xdb99('0xb'),this[_0xdb99('0xc')][_0xdb99('0xd')](this));ami['on']('registry',this[_0xdb99('0xc')][_0xdb99('0xd')](this));ami['on']('devicestatechange',this['syncDeviceState']['bind'](this));ami['on'](_0xdb99('0xe'),this[_0xdb99('0xf')]['bind'](this));return this[_0xdb99('0x10')]();}function showSipRegistrations(){Promise[_0xdb99('0x11')]()['then'](ami['actionSipShowRegistry']())[_0xdb99('0x12')](function(_0x26f38f){logger[_0xdb99('0x13')](_0xdb99('0x14'),util[_0xdb99('0x15')](_0x26f38f,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise['resolve']()[_0xdb99('0x16')](ami[_0xdb99('0x17')]())['catch'](function(_0x5ab61c){logger[_0xdb99('0x13')](_0xdb99('0x18'),util['inspect'](_0x5ab61c,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0xdb99('0x11')]()[_0xdb99('0x16')](ami[_0xdb99('0x19')]())['catch'](function(_0x356705){logger[_0xdb99('0x13')](_0xdb99('0x1a'),util[_0xdb99('0x15')](_0x356705,{'showHidden':![],'depth':null}));});}UserReport[_0xdb99('0x1b')]['syncRealtimeShow']=function(){setInterval(function(){BPromise[_0xdb99('0x11')]()['then'](showSipRegistrations())[_0xdb99('0x16')](listDeviceStates())[_0xdb99('0x16')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0xb85413){return _0xb85413!==null&&!_[_0xdb99('0x1c')](_0xb85413);};UserReport[_0xdb99('0x1b')][_0xdb99('0x1d')]=function(_0x3d1b2d,_0x4add1f,_0x36f705){io['to'](_0x3d1b2d)[_0xdb99('0x1d')](_0x4add1f,_0x36f705);};UserReport[_0xdb99('0x1b')][_0xdb99('0xc')]=function(_0x15c8f4){try{if(this[_0xdb99('0x1e')](_0x15c8f4)){logger[_0xdb99('0x1f')](_0xdb99('0x20'),_0x15c8f4[_0xdb99('0x21')],_0x15c8f4[_0xdb99('0x22')]);logger[_0xdb99('0x23')](_0xdb99('0x24'),util[_0xdb99('0x15')](_0x15c8f4,{'showHidden':![],'depth':null}));var _0x51a999=_[_0xdb99('0x25')](this[_0xdb99('0x8')],{'defaultuser':_0x15c8f4[_0xdb99('0x21')]});if(_0x51a999){_0x15c8f4['stateRegistry']=_0x15c8f4[_0xdb99('0x22')];_[_0xdb99('0x26')](_0x51a999,_['omit'](_0x15c8f4,['event',_0xdb99('0x27'),_0xdb99('0x21'),_0xdb99('0x22')]));logger[_0xdb99('0x23')](_0xdb99('0x28'),util[_0xdb99('0x15')](_0x51a999,{'showHidden':![],'depth':null}));this[_0xdb99('0x1d')](util[_0xdb99('0x29')](_0xdb99('0x2a'),_0x51a999[_0xdb99('0x2b')]),'trunk:save',_0x51a999);}}}catch(_0x1a107a){logger[_0xdb99('0x13')]('[userReport][registry]',util['inspect'](_0x1a107a,{'showHidden':![],'depth':null}));}};UserReport[_0xdb99('0x1b')][_0xdb99('0x2c')]=function(_0x2e31a1){try{if(this[_0xdb99('0x1e')](_0x2e31a1)){logger['info'](_0xdb99('0x2d'),_0x2e31a1[_0xdb99('0x2e')],_0x2e31a1['state']);logger[_0xdb99('0x23')](_0xdb99('0x2f'),util[_0xdb99('0x15')](_0x2e31a1,{'showHidden':![],'depth':null}));if(this[_0xdb99('0x9')][_0x2e31a1[_0xdb99('0x2e')]]){if(!this[_0xdb99('0x9')][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x30')]||_0x2e31a1['state'][_0xdb99('0x31')]()=='inuse'){this[_0xdb99('0x9')][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x30')]=![];if(this[_0xdb99('0x9')][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x22')]!==_0x2e31a1[_0xdb99('0x22')]['toLowerCase']()){this['agents'][_0x2e31a1['device']][_0xdb99('0x32')]=_[_0xdb99('0x33')](moment()[_0xdb99('0x29')]('x'));}this['agents'][_0x2e31a1[_0xdb99('0x2e')]]['state']=_0x2e31a1[_0xdb99('0x22')]['toLowerCase']();this[_0xdb99('0x9')][_0x2e31a1['device']]['updateStatusRealtime'](_0x2e31a1);}}else if(this[_0xdb99('0xa')][_0x2e31a1[_0xdb99('0x2e')]]){if(this[_0xdb99('0xa')][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x22')]!==_0x2e31a1[_0xdb99('0x22')][_0xdb99('0x31')]()){this['telephones'][_0x2e31a1['device']]['stateTime']=_[_0xdb99('0x33')](moment()[_0xdb99('0x29')]('x'));}this[_0xdb99('0xa')][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x22')]=_0x2e31a1[_0xdb99('0x22')][_0xdb99('0x31')]();logger['debug']('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0xdb99('0x15')](this['telephones'][_0x2e31a1[_0xdb99('0x2e')]],{'showHidden':![],'depth':null}));this[_0xdb99('0x1d')](util['format'](_0xdb99('0x34'),this['telephones'][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x2b')]),_0xdb99('0x35'),this[_0xdb99('0xa')][_0x2e31a1['device']]);}else if(this['trunks'][_0x2e31a1[_0xdb99('0x2e')]]){if(this[_0xdb99('0x8')][_0x2e31a1[_0xdb99('0x2e')]]['state']!==_0x2e31a1[_0xdb99('0x22')][_0xdb99('0x31')]()){this['trunks'][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x32')]=_['toNumber'](moment()[_0xdb99('0x29')]('x'));}this['trunks'][_0x2e31a1['device']][_0xdb99('0x22')]=_0x2e31a1[_0xdb99('0x22')][_0xdb99('0x31')]();logger[_0xdb99('0x23')](_0xdb99('0x36'),util['inspect'](this['trunks'][_0x2e31a1[_0xdb99('0x2e')]],{'showHidden':![],'depth':null}));this[_0xdb99('0x1d')](util[_0xdb99('0x29')](_0xdb99('0x2a'),this['trunks'][_0x2e31a1[_0xdb99('0x2e')]][_0xdb99('0x2b')]),_0xdb99('0x37'),this[_0xdb99('0x8')][_0x2e31a1['device']]);}else if(_[_0xdb99('0x38')](_0x2e31a1[_0xdb99('0x2e')],_0xdb99('0x39'))){var _0x55fc6a=_0x2e31a1[_0xdb99('0x2e')];var _0x43aa15=_0x55fc6a[_0xdb99('0x3a')](_0x55fc6a['indexOf']('/')+0x1,_0x55fc6a[_0xdb99('0x3b')]('@'));var _0xe0975c=_[_0xdb99('0x25')](this[_0xdb99('0x9')],function(_0x5d349d){return _0x5d349d['mobile']==_0x43aa15||_0x5d349d[_0xdb99('0x3c')]==_0x43aa15||_0x5d349d[_0xdb99('0x3d')]==_0x43aa15;});if(_0xe0975c){if(_0xe0975c[_0xdb99('0x22')]!==_0x2e31a1['state'][_0xdb99('0x31')]()){_0xe0975c[_0xdb99('0x32')]=_['toNumber'](moment()[_0xdb99('0x29')]('x'));}_0xe0975c[_0xdb99('0x22')]=_0x2e31a1[_0xdb99('0x22')][_0xdb99('0x31')]();_0xe0975c['local']=!![];_0xe0975c['updateStatusRealtime'](_0x2e31a1);}}}}catch(_0x18cd1b){logger[_0xdb99('0x13')](_0xdb99('0x2f'),util[_0xdb99('0x15')](_0x18cd1b,{'showHidden':![],'depth':null}));}};UserReport[_0xdb99('0x1b')]['syncPeerStatus']=function(_0x28f0d5){try{if(this[_0xdb99('0x1e')](_0x28f0d5)&&this['isNotNull'](_0x28f0d5[_0xdb99('0xe')])){logger[_0xdb99('0x1f')](_0xdb99('0x3e'),_0x28f0d5['peer'],_0x28f0d5[_0xdb99('0x3f')],_0x28f0d5[_0xdb99('0xe')]);logger[_0xdb99('0x23')](_0xdb99('0x40'),util[_0xdb99('0x15')](_0x28f0d5,{'showHidden':![],'depth':null}));if(this[_0xdb99('0x9')][_0x28f0d5['peer']]){if(!this[_0xdb99('0x9')][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x30')]||_0x28f0d5['peerstatus'][_0xdb99('0x31')]()==_0xdb99('0x42')){this['agents'][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x30')]=![];this['agents'][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x43')]=_0x28f0d5[_0xdb99('0xe')][_0xdb99('0x31')]();this[_0xdb99('0x9')][_0x28f0d5['peer']]['address']=_0x28f0d5['address'];this[_0xdb99('0x9')][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x44')](_0x28f0d5);}}else if(this[_0xdb99('0xa')][_0x28f0d5[_0xdb99('0x41')]]){this[_0xdb99('0xa')][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x43')]=_0x28f0d5['peerstatus'][_0xdb99('0x31')]();this['telephones'][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x3f')]=_0x28f0d5[_0xdb99('0x3f')];logger['debug'](_0xdb99('0x45'),util['inspect'](this[_0xdb99('0xa')][_0x28f0d5[_0xdb99('0x41')]],{'showHidden':![],'depth':null}));this[_0xdb99('0x1d')](util['format'](_0xdb99('0x34'),this[_0xdb99('0xa')][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x2b')]),'telephone:save',this[_0xdb99('0xa')][_0x28f0d5[_0xdb99('0x41')]]);}else if(this[_0xdb99('0x8')][_0x28f0d5[_0xdb99('0x41')]]){this[_0xdb99('0x8')][_0x28f0d5['peer']]['status']=_0x28f0d5[_0xdb99('0xe')][_0xdb99('0x31')]();this[_0xdb99('0x8')][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x3f')]=_0x28f0d5[_0xdb99('0x3f')];logger[_0xdb99('0x23')]('[userReport][peerstatus]\x20sending\x20trunk:save\x20event:',util['inspect'](this[_0xdb99('0x8')][_0x28f0d5[_0xdb99('0x41')]],{'showHidden':![],'depth':null}));this[_0xdb99('0x1d')](util[_0xdb99('0x29')]('trunk:%s',this[_0xdb99('0x8')][_0x28f0d5[_0xdb99('0x41')]][_0xdb99('0x2b')]),_0xdb99('0x37'),this[_0xdb99('0x8')][_0x28f0d5[_0xdb99('0x41')]]);}}}catch(_0x5412ce){logger[_0xdb99('0x13')]('[userReport][peerstatus]',util[_0xdb99('0x15')](_0x5412ce,{'showHidden':![],'depth':null}));}};module[_0xdb99('0x46')]=UserReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceAgentReport.js b/server/services/ami/report/voiceAgentReport.js index 2fc0556..d535c88 100644 --- a/server/services/ami/report/voiceAgentReport.js +++ b/server/services/ami/report/voiceAgentReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a0b=['syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','uniqueid','membername','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','isUndefined','called','mandatoryDisposition','type','assign','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','calleridnum','queue','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','user:called','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','YYYY-MM-DD\x20HH:mm:ss','connectedlinename','destchannelstate','destchannelstatedesc','lastevent','merge','interface','pick','destconnectedlinenum','name','accountcode','exten','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:agentringnoanswer','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','transfer','agent','talktime','acw','agentacw','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','[%s][voiceAgentReport][agentcomplete]','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','sipuri','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','seconds','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis','defaults','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x7a0b,0x85));var _0xb7a0=function(_0x3ab39f,_0xa6b62a){_0x3ab39f=_0x3ab39f-0x0;var _0x4435ed=_0x7a0b[_0x3ab39f];return _0x4435ed;};'use strict';var _=require(_0xb7a0('0x0'));var moment=require(_0xb7a0('0x1'));var util=require(_0xb7a0('0x2'));var Redis=require('ioredis');var config=require(_0xb7a0('0x3'));var logger=require(_0xb7a0('0x4'))(_0xb7a0('0x5'));var ami=require('../ami');config[_0xb7a0('0x6')]=_[_0xb7a0('0x7')](config[_0xb7a0('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb7a0('0x8'))(new Redis(config[_0xb7a0('0x6')]));function VoiceAgentReport(_0x39176b){this[_0xb7a0('0x9')]={};this['voiceChannels']=_0x39176b['channels'];this[_0xb7a0('0xa')]=_0x39176b[_0xb7a0('0xa')];this['agents']=_0x39176b[_0xb7a0('0xb')];this[_0xb7a0('0xc')]={};ami['on'](_0xb7a0('0xd'),this[_0xb7a0('0xe')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x10'),this[_0xb7a0('0x11')]['bind'](this));ami['on'](_0xb7a0('0x12'),this[_0xb7a0('0x13')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x14'),this[_0xb7a0('0x15')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x16'),this[_0xb7a0('0x17')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x18'),this[_0xb7a0('0x19')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x1a'),this[_0xb7a0('0x1b')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x1c'),this[_0xb7a0('0x1d')]['bind'](this));ami['on'](_0xb7a0('0x1e'),this[_0xb7a0('0x1f')][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x20'),this['syncAttendedTransfer'][_0xb7a0('0xf')](this));ami['on'](_0xb7a0('0x21'),this[_0xb7a0('0x22')][_0xb7a0('0xf')](this));}VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x24')]=function(_0x43cd45,_0x27236e,_0x3364e){io['to'](_0x43cd45)[_0xb7a0('0x24')](_0x27236e,_0x3364e);};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x25')]=function(_0x4fcd7d){return _0x4fcd7d!==null&&!_['isUndefined'](_0x4fcd7d);};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0xe')]=function(_0xa863a7){try{if(this[_0xb7a0('0x25')](_0xa863a7)){logger[_0xb7a0('0x26')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0xa863a7[_0xb7a0('0x27')],_0xa863a7[_0xb7a0('0x28')],_0xa863a7[_0xb7a0('0x29')]);logger['debug'](_0xb7a0('0x2a'),_0xa863a7[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0xa863a7,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['channels'][_0xa863a7['uniqueid']])){this['channels'][_0xa863a7[_0xb7a0('0x27')]]={};}var _0x581bb4=this[_0xb7a0('0xb')][_0xa863a7['interface']];var _0x339bb0=this[_0xb7a0('0x9')][_0xa863a7['uniqueid']][_0xa863a7[_0xb7a0('0x29')]];var _0x4ea148=this['voiceQueues'][_0xa863a7['queue']];var _0x76a129=this[_0xb7a0('0xc')][_0xa863a7['uniqueid']];if(_[_0xb7a0('0x2c')](_0x339bb0)){_0x339bb0={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0xb7a0('0x2d'),'mandatoryDisposition':_0x4ea148&&_0x4ea148['mandatoryDisposition']?_0x4ea148[_0xb7a0('0x2e')]:![],'type':_0x4ea148&&_0x4ea148[_0xb7a0('0x2f')]?_0x4ea148[_0xb7a0('0x2f')]:'inbound','variables':_0x76a129,'motionChannel':'voice'};}Object[_0xb7a0('0x30')](_0x339bb0,_['omit'](_0xa863a7,[_0xb7a0('0x31'),'privilege']));this[_0xb7a0('0x9')][_0xa863a7[_0xb7a0('0x27')]][_0xa863a7[_0xb7a0('0x29')]]=_0x339bb0;logger[_0xb7a0('0x32')](_0xb7a0('0x33'),_0xa863a7['uniqueid'],util[_0xb7a0('0x2b')](_0x339bb0,{'showHidden':![],'depth':null}));ami['emit'](_0xb7a0('0x34'),_0x339bb0);var _0x5134d2={'id':_0x581bb4['id'],'calleridnum':_0x339bb0[_0xb7a0('0x35')],'queue':_0x339bb0[_0xb7a0('0x36')],'variables':_0x339bb0[_0xb7a0('0xc')],'uniqueid':_0xa863a7[_0xb7a0('0x27')]};logger['debug'](_0xb7a0('0x37'),_0xa863a7[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x5134d2,{'showHidden':![],'depth':null}));this['emit'](util[_0xb7a0('0x38')](_0xb7a0('0x39'),_0xa863a7['membername']),_0xb7a0('0x3a'),_0x5134d2);}}catch(_0x1eb23e){logger['error'](_0xb7a0('0x3b'),_0xa863a7[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x1eb23e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x11')]=function(_0x3b350c){try{if(this[_0xb7a0('0x25')](_0x3b350c)){if(this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]]){for(var _0x467316 in this['channels'][_0x3b350c[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0x467316)){if(_0x3b350c[_0xb7a0('0x29')]===_0x467316){logger[_0xb7a0('0x26')](_0xb7a0('0x3d'),_0x3b350c[_0xb7a0('0x27')],_0x3b350c[_0xb7a0('0x28')],_0x3b350c[_0xb7a0('0x29')]);this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x3e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x40')]=_0x3b350c[_0xb7a0('0x40')];this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['connectedlinenum']=_0x3b350c['connectedlinenum'];this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x41')]=_0x3b350c['destchannelstate'];this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['destchannelstatedesc']=_0x3b350c[_0xb7a0('0x42')];this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['holdtime']=_0x3b350c['holdtime'];this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x43')]='connect';_[_0xb7a0('0x44')](this[_0xb7a0('0xb')][_0x3b350c[_0xb7a0('0x45')]],_[_0xb7a0('0x46')](_0x3b350c,['queue',_0xb7a0('0x47')]));var _0x4374b8=this['agents'][_0x3b350c[_0xb7a0('0x45')]];var _0x2807b7={'id':_0x4374b8['id'],'name':_0x4374b8[_0xb7a0('0x48')],'agentconnected':!![],'destaccountcode':_0x4374b8[_0xb7a0('0x49')],'destconnectedlinenum':this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]][_0xb7a0('0x4a')],'queue':this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]][_0xb7a0('0x36')],'uniqueid':this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]][_0xb7a0('0x27')]};ami['emit'](_0xb7a0('0x4b'),this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x3b350c[_0xb7a0('0x29')]]);this[_0xb7a0('0x24')](util[_0xb7a0('0x38')](_0xb7a0('0x39'),_0x3b350c['membername']),_0xb7a0('0x4c'),_0x2807b7);}else if(!this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x12')]&&!this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x4d'),_0x3b350c[_0xb7a0('0x27')],this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316]['membername'],_0x467316);this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['agentringnoanswer']=!![];this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x4e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this[_0xb7a0('0x9')][_0x3b350c['uniqueid']][_0x467316][_0xb7a0('0x4f')]=_0x3b350c[_0xb7a0('0x29')];this['channels'][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x50')]=_0x3b350c[_0xb7a0('0x28')];this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]['lastevent']=_0xb7a0('0x51');this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316][_0xb7a0('0x52')]=_0xb7a0('0x51');logger[_0xb7a0('0x32')](_0xb7a0('0x53'),_0x3b350c[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316],{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')](_0xb7a0('0x54'),this[_0xb7a0('0x9')][_0x3b350c[_0xb7a0('0x27')]][_0x467316]);}else{logger[_0xb7a0('0x32')](_0xb7a0('0x55'),_0x3b350c[_0xb7a0('0x27')]);}}}}}}catch(_0x4b403f){logger[_0xb7a0('0x56')](_0xb7a0('0x57'),_0x3b350c[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x4b403f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x13')]=function(_0x5f180b){try{if(this[_0xb7a0('0x25')](_0x5f180b)){logger[_0xb7a0('0x32')](_0xb7a0('0x58'),_0x5f180b['uniqueid'],util[_0xb7a0('0x2b')](_0x5f180b,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]]&&this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]][_0x5f180b[_0xb7a0('0x29')]]){logger[_0xb7a0('0x26')](_0xb7a0('0x59'),_0x5f180b['uniqueid'],_0x5f180b[_0xb7a0('0x28')],_0x5f180b['destuniqueid']);var _0x39a308=this['agents'][_0x5f180b[_0xb7a0('0x45')]];var _0x3bc7fe=this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]][_0x5f180b[_0xb7a0('0x29')]];_0x3bc7fe[_0xb7a0('0x12')]=!![];_0x3bc7fe[_0xb7a0('0x4e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));_0x3bc7fe['lastevent']=_0xb7a0('0x5a');_0x3bc7fe['reason']=_0xb7a0('0x5a');var _0x2f2739={'id':_0x39a308['id'],'name':_0x39a308[_0xb7a0('0x48')],'queue':_0x3bc7fe[_0xb7a0('0x36')],'uniqueid':_0x3bc7fe[_0xb7a0('0x27')]};logger[_0xb7a0('0x32')](_0xb7a0('0x5b'),_0x5f180b[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x2f2739,{'showHidden':![],'depth':null}));this[_0xb7a0('0x24')](util[_0xb7a0('0x38')](_0xb7a0('0x39'),_0x39a308[_0xb7a0('0x48')]),_0xb7a0('0x5c'),_0x2f2739);ami[_0xb7a0('0x24')](_0xb7a0('0x5d'),_0x3bc7fe);this[_0xb7a0('0x9')][_0x5f180b[_0xb7a0('0x27')]][_0x5f180b[_0xb7a0('0x29')]]=Object['assign']({},_0x3bc7fe);}}}catch(_0x239eda){logger[_0xb7a0('0x56')](_0xb7a0('0x5e'),_0x5f180b['uniqueid'],util[_0xb7a0('0x2b')](_0x239eda,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x15')]=function(_0x1d143f){try{if(this['isNotNull'](_0x1d143f)){logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x1d143f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x1d143f,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]]){for(var _0xcc89f1 in this[_0xb7a0('0x9')][_0x1d143f['uniqueid']]){if(this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0xcc89f1)&&!this['channels'][_0x1d143f['uniqueid']][_0xcc89f1]['agentringnoanswer']&&!this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x5f'),_0x1d143f[_0xb7a0('0x27')],this[_0xb7a0('0x9')][_0x1d143f['uniqueid']][_0xcc89f1][_0xb7a0('0x28')],_0xcc89f1);this['channels'][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x12')]=!![];this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x4e')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this['channels'][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1][_0xb7a0('0x43')]='abandoned';this[_0xb7a0('0x9')][_0x1d143f['uniqueid']][_0xcc89f1]['reason']=_0xb7a0('0x60');logger[_0xb7a0('0x32')](_0xb7a0('0x61'),_0x1d143f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1],{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')]('custom:agentqueuecallerabandon',this[_0xb7a0('0x9')][_0x1d143f[_0xb7a0('0x27')]][_0xcc89f1]);}}}}}catch(_0x55458f){logger[_0xb7a0('0x56')](_0xb7a0('0x62'),_0x1d143f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x55458f,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb7a0('0x17')]=function(_0x36f9da){try{if(this[_0xb7a0('0x25')](_0x36f9da)){logger[_0xb7a0('0x32')](_0xb7a0('0x63'),_0x36f9da['uniqueid'],util[_0xb7a0('0x2b')](_0x36f9da,{'showHidden':![],'depth':null}));if(this['channels'][_0x36f9da[_0xb7a0('0x27')]]){for(var _0x3b5e39 in this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0x3b5e39)){if(this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x3e')]&&!this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x64'),_0x36f9da['uniqueid'],this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['membername'],_0x3b5e39);this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['agentcomplete']=!![];this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x65')]=moment()[_0xb7a0('0x38')](_0xb7a0('0x3f'));this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x43')]='complete';this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x52')]=_0x36f9da['reason']==_0xb7a0('0x66')?_0xb7a0('0x67'):_0x36f9da[_0xb7a0('0x52')];this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['talktime']=_0x36f9da[_0xb7a0('0x68')];if(this[_0xb7a0('0xa')][_0x36f9da['queue']]&&this[_0xb7a0('0xa')][_0x36f9da[_0xb7a0('0x36')]][_0xb7a0('0x69')]){this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]['acwtime']=this[_0xb7a0('0xa')][_0x36f9da['queue']]['acwTimeout'];this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39][_0xb7a0('0x6a')]=!![];}this['agents'][_0x36f9da[_0xb7a0('0x45')]]=_['omit'](this[_0xb7a0('0xb')][_0x36f9da['interface']],[_0xb7a0('0x36'),_0xb7a0('0x47')]);logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:',_0x36f9da['uniqueid'],util[_0xb7a0('0x2b')](this['channels'][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39],{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')](_0xb7a0('0x6b'),this[_0xb7a0('0x9')][_0x36f9da[_0xb7a0('0x27')]][_0x3b5e39]);logger[_0xb7a0('0x32')](_0xb7a0('0x6c'),_0x36f9da[_0xb7a0('0x27')],util[_0xb7a0('0x2b')]({'id':this[_0xb7a0('0xb')][_0x36f9da[_0xb7a0('0x45')]]['id'],'destaccountcode':_0x36f9da[_0xb7a0('0x6d')]},{'showHidden':![],'depth':null}));this[_0xb7a0('0x24')](util[_0xb7a0('0x38')]('user:%s',_0x36f9da[_0xb7a0('0x28')]),'user:agentcomplete',{'id':this[_0xb7a0('0xb')][_0x36f9da[_0xb7a0('0x45')]]['id'],'destaccountcode':Number(_0x36f9da[_0xb7a0('0x6d')])});}}}}}}catch(_0x40e419){logger[_0xb7a0('0x56')](_0xb7a0('0x6e'),_0x36f9da[_0xb7a0('0x27')],util['inspect'](_0x40e419,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncVarSet']=function(_0x44a800){try{if(this[_0xb7a0('0x25')](_0x44a800)){logger[_0xb7a0('0x32')](_0xb7a0('0x6f'),_0x44a800[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x44a800,{'showHidden':![],'depth':null}));this[_0xb7a0('0x70')](_0x44a800[_0xb7a0('0x27')],_[_0xb7a0('0x71')](_0x44a800[_0xb7a0('0x72')])[0x0],_0x44a800[_0xb7a0('0x73')]);if(this['channels'][_0x44a800[_0xb7a0('0x27')]]){for(var _0x278885 in this[_0xb7a0('0x9')][_0x44a800[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x44a800['uniqueid']][_0xb7a0('0x3c')](_0x278885)){logger[_0xb7a0('0x26')]('[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s',_0x44a800[_0xb7a0('0x27')],_0x278885,_[_0xb7a0('0x71')](_0x44a800[_0xb7a0('0x72')])[0x0],_0x44a800[_0xb7a0('0x73')]);if(_[_0xb7a0('0x2c')](this[_0xb7a0('0x9')][_0x44a800['uniqueid']][_0x278885]['variables'])){this[_0xb7a0('0x9')][_0x44a800[_0xb7a0('0x27')]][_0x278885][_0xb7a0('0xc')]={};}this[_0xb7a0('0x9')][_0x44a800[_0xb7a0('0x27')]][_0x278885]['variables']=this[_0xb7a0('0xc')][_0x44a800['uniqueid']];}}}}}catch(_0x54dc0b){logger[_0xb7a0('0x56')](_0xb7a0('0x74'),_0x44a800[_0xb7a0('0x27')],util['inspect'](_0x54dc0b,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xb7a0('0x70')]=function(_0x2b14f9,_0x4e56f5,_0xb68bcc){var _0x1276d6=['rtpaudioqos',_0xb7a0('0x75'),_0xb7a0('0x76'),'rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid',_0xb7a0('0x77'),'bridgepeer',_0xb7a0('0x78'),'membercalls',_0xb7a0('0x79'),_0xb7a0('0x7a'),_0xb7a0('0x7b'),_0xb7a0('0x28'),_0xb7a0('0x7c'),_0xb7a0('0x7d')];if(!_[_0xb7a0('0x7e')](_0x4e56f5)&&!_['includes'](_0x1276d6,_0x4e56f5)){if(_[_0xb7a0('0x2c')](this[_0xb7a0('0xc')][_0x2b14f9])){this['variables'][_0x2b14f9]={};}this[_0xb7a0('0xc')][_0x2b14f9][_0x4e56f5]=_0xb68bcc;}};VoiceAgentReport['prototype']['syncHangup']=function(_0x53c809){try{if(this[_0xb7a0('0x25')](_0x53c809)){logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][hangup]\x20event:',_0x53c809[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x53c809,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]]){for(var _0x548a72 in this['channels'][_0x53c809[_0xb7a0('0x27')]]){if(this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]][_0xb7a0('0x3c')](_0x548a72)){if(this[_0xb7a0('0x9')][_0x53c809['uniqueid']][_0x548a72][_0xb7a0('0x52')]==_0xb7a0('0x66')&&this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]][_0x548a72][_0xb7a0('0x16')]){logger[_0xb7a0('0x26')](_0xb7a0('0x7f'),_0x53c809['uniqueid'],_0x548a72);this[_0xb7a0('0x9')][_0x53c809['uniqueid']][_0x548a72][_0xb7a0('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}}}logger[_0xb7a0('0x32')](_0xb7a0('0x80'),_0x53c809[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_['values'](this[_0xb7a0('0x9')][_0x53c809[_0xb7a0('0x27')]]),{'showHidden':![],'depth':null}));ami[_0xb7a0('0x24')](_0xb7a0('0x81'),_['values'](this['channels'][_0x53c809[_0xb7a0('0x27')]]));this[_0xb7a0('0x82')](_0x53c809[_0xb7a0('0x27')]);}if(this['variables'][_0x53c809['uniqueid']]){delete this['variables'][_0x53c809['uniqueid']];}}}catch(_0x315fb4){logger[_0xb7a0('0x56')](_0xb7a0('0x83'),_0x53c809[_0xb7a0('0x27')],util['inspect'](_0x315fb4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncAttendedTransfer']=function(_0x69061a){try{if(this['isNotNull'](_0x69061a)){logger[_0xb7a0('0x32')](_0xb7a0('0x84'),_0x69061a[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x69061a,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x69061a['transfereeuniqueid']]){for(var _0x57f0b8 in this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]]){if(this['channels'][_0x69061a[_0xb7a0('0x85')]][_0xb7a0('0x3c')](_0x57f0b8)){if(_0x69061a['origtransfereruniqueid']===_0x57f0b8){logger[_0xb7a0('0x26')](_0xb7a0('0x86'),_0x69061a['uniqueid'],this['channels'][_0x69061a['transfereeuniqueid']][_0x57f0b8][_0xb7a0('0x28')],_0x57f0b8);var _0x3ac983=moment();this[_0xb7a0('0x9')][_0x69061a['transfereeuniqueid']][_0x57f0b8][_0xb7a0('0x16')]=!![];this['channels'][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8][_0xb7a0('0x65')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8]['lastevent']='complete';this['channels'][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8][_0xb7a0('0x52')]='transfer';this['channels'][_0x69061a['transfereeuniqueid']][_0x57f0b8]['talktime']=_0x3ac983[_0xb7a0('0x87')](this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]][_0x57f0b8]['agentconnectAt'],'seconds');}}}}if(this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x88')]]){var _0x5b1292=this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x88')]];this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x88')]]=this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]];this[_0xb7a0('0x9')][_0x69061a[_0xb7a0('0x85')]]=_0x5b1292;}}}catch(_0x1a1913){logger[_0xb7a0('0x56')](_0xb7a0('0x89'),_0x69061a[_0xb7a0('0x27')],util['inspect'](_0x1a1913,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncBlindTransfer']=function(_0x5d4831){try{if(this[_0xb7a0('0x25')](_0x5d4831)){logger[_0xb7a0('0x32')](_0xb7a0('0x8a'),_0x5d4831[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x5d4831,{'showHidden':![],'depth':null}));if(this[_0xb7a0('0x9')][_0x5d4831['transfereeuniqueid']]){for(var _0x18c091 in this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]]){if(this[_0xb7a0('0x9')][_0x5d4831['transfereeuniqueid']][_0xb7a0('0x3c')](_0x18c091)){if(_0x5d4831[_0xb7a0('0x8b')]===_0x18c091){logger[_0xb7a0('0x26')](_0xb7a0('0x8c'),_0x5d4831[_0xb7a0('0x27')],this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091][_0xb7a0('0x28')],_0x18c091);var _0x2d5694=moment();this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['agentcomplete']=!![];this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['agentcompleteAt']=_0x2d5694;this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['lastevent']=_0xb7a0('0x8d');this['channels'][_0x5d4831[_0xb7a0('0x85')]][_0x18c091][_0xb7a0('0x52')]=_0xb7a0('0x66');this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091][_0xb7a0('0x68')]=_0x2d5694[_0xb7a0('0x87')](this[_0xb7a0('0x9')][_0x5d4831[_0xb7a0('0x85')]][_0x18c091]['agentconnectAt'],_0xb7a0('0x8e'));}}}}}}catch(_0x325129){logger[_0xb7a0('0x56')]('[%s][voiceAgentReport][blindtransfer]',_0x5d4831[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x325129,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x1d')]=function(_0x842ff3){var _0x167bd5='';try{if(this[_0xb7a0('0x25')](_0x842ff3)){logger[_0xb7a0('0x32')](_0xb7a0('0x8f'),_0x842ff3[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x842ff3,{'showHidden':![],'depth':null}));if(_0x842ff3['channel']){_0x167bd5=_0x842ff3[_0xb7a0('0x90')][_0xb7a0('0x91')](0x0,_0x842ff3['channel'][_0xb7a0('0x92')]('-'));if(this[_0xb7a0('0xb')][_0x167bd5]){logger[_0xb7a0('0x26')](_0xb7a0('0x93'),_0x842ff3[_0xb7a0('0x27')],_0x167bd5);this[_0xb7a0('0xb')][_0x167bd5][_0xb7a0('0x94')]=!![];}}}}catch(_0x55021f){logger['error']('[%s][voiceAgentReport][musiconholdstart]',_0x842ff3[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x55021f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')]['syncMusicOnHoldStop']=function(_0x22272f){var _0x24da9c='';try{if(this[_0xb7a0('0x25')](_0x22272f)){logger[_0xb7a0('0x32')]('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x22272f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x22272f,{'showHidden':![],'depth':null}));if(_0x22272f[_0xb7a0('0x90')]){_0x24da9c=_0x22272f['channel'][_0xb7a0('0x91')](0x0,_0x22272f[_0xb7a0('0x90')][_0xb7a0('0x92')]('-'));if(this['agents'][_0x24da9c]){logger[_0xb7a0('0x26')](_0xb7a0('0x95'),_0x22272f[_0xb7a0('0x27')],_0x24da9c);this[_0xb7a0('0xb')][_0x24da9c][_0xb7a0('0x94')]=![];}}}}catch(_0x166ec1){logger[_0xb7a0('0x56')](_0xb7a0('0x96'),_0x22272f[_0xb7a0('0x27')],util[_0xb7a0('0x2b')](_0x166ec1,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xb7a0('0x23')][_0xb7a0('0x82')]=function(_0x2bcbc3,_0x2922d9=0x2710){if(this[_0xb7a0('0x9')][_0x2bcbc3]){setTimeout(()=>{delete this['channels'][_0x2bcbc3];},_0x2922d9);}};module[_0xb7a0('0x97')]=VoiceAgentReport; \ No newline at end of file +var _0x3c85=['connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','pick','destconnectedlinenum','name','accountcode','custom:agentconnect','user:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','reason','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','error','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','agentringnoanswerAt','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','syncQueueCallerAbandon','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','voiceQueues','acw','acwtime','acwTimeout','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','keys','variable','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','value','[%s][voiceAgentReport][varset]','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','sipcallid','sipuri','bridgepeer','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','deleteChannelAfterTimeout','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]\x20event:','substring','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','ioredis','ami','../ami','redis','localhost','socket.io-emitter','channels','agents','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled','isNotNull','info','uniqueid','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','interface','queue','variables','format','YYYY-MM-DD\x20HH:mm:ss','called','mandatoryDisposition','type','inbound','voice','assign','omit','event','privilege','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','user:%s','membername','user:called','syncAgentConnect','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt'];(function(_0x4b79dc,_0x1f37b4){var _0x2e184a=function(_0x419732){while(--_0x419732){_0x4b79dc['push'](_0x4b79dc['shift']());}};_0x2e184a(++_0x1f37b4);}(_0x3c85,0x1a0));var _0x53c8=function(_0x3be551,_0xcf5bb5){_0x3be551=_0x3be551-0x0;var _0x32f356=_0x3c85[_0x3be551];return _0x32f356;};'use strict';var _=require(_0x53c8('0x0'));var moment=require(_0x53c8('0x1'));var util=require(_0x53c8('0x2'));var Redis=require(_0x53c8('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x53c8('0x4'));var ami=require(_0x53c8('0x5'));config[_0x53c8('0x6')]=_['defaults'](config[_0x53c8('0x6')],{'host':_0x53c8('0x7'),'port':0x18eb});var io=require(_0x53c8('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x5271ad){this['channels']={};this['voiceChannels']=_0x5271ad[_0x53c8('0x9')];this['voiceQueues']=_0x5271ad['voiceQueues'];this[_0x53c8('0xa')]=_0x5271ad[_0x53c8('0xa')];this['variables']={};ami['on']('agentcalled',this['syncAgentCalled'][_0x53c8('0xb')](this));ami['on']('agentconnect',this['syncAgentConnect'][_0x53c8('0xb')](this));ami['on'](_0x53c8('0xc'),this[_0x53c8('0xd')][_0x53c8('0xb')](this));ami['on'](_0x53c8('0xe'),this['syncQueueCallerAbandon'][_0x53c8('0xb')](this));ami['on'](_0x53c8('0xf'),this[_0x53c8('0x10')]['bind'](this));ami['on'](_0x53c8('0x11'),this[_0x53c8('0x12')]['bind'](this));ami['on'](_0x53c8('0x13'),this[_0x53c8('0x14')][_0x53c8('0xb')](this));ami['on'](_0x53c8('0x15'),this[_0x53c8('0x16')][_0x53c8('0xb')](this));ami['on'](_0x53c8('0x17'),this[_0x53c8('0x18')][_0x53c8('0xb')](this));ami['on'](_0x53c8('0x19'),this[_0x53c8('0x1a')][_0x53c8('0xb')](this));ami['on'](_0x53c8('0x1b'),this[_0x53c8('0x1c')][_0x53c8('0xb')](this));}VoiceAgentReport[_0x53c8('0x1d')]['emit']=function(_0x5147a7,_0x38215c,_0x1a006c){io['to'](_0x5147a7)[_0x53c8('0x1e')](_0x38215c,_0x1a006c);};VoiceAgentReport[_0x53c8('0x1d')]['isNotNull']=function(_0x167c8b){return _0x167c8b!==null&&!_[_0x53c8('0x1f')](_0x167c8b);};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x20')]=function(_0x12190e){try{if(this[_0x53c8('0x21')](_0x12190e)){logger[_0x53c8('0x22')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x12190e[_0x53c8('0x23')],_0x12190e['membername'],_0x12190e[_0x53c8('0x24')]);logger[_0x53c8('0x25')](_0x53c8('0x26'),_0x12190e[_0x53c8('0x23')],util['inspect'](_0x12190e,{'showHidden':![],'depth':null}));if(_[_0x53c8('0x1f')](this[_0x53c8('0x9')][_0x12190e[_0x53c8('0x23')]])){this[_0x53c8('0x9')][_0x12190e[_0x53c8('0x23')]]={};}var _0x454bc5=this[_0x53c8('0xa')][_0x12190e[_0x53c8('0x27')]];var _0x1b6be5=this[_0x53c8('0x9')][_0x12190e['uniqueid']][_0x12190e[_0x53c8('0x24')]];var _0x5883e7=this['voiceQueues'][_0x12190e[_0x53c8('0x28')]];var _0x181e88=this[_0x53c8('0x29')][_0x12190e[_0x53c8('0x23')]];if(_[_0x53c8('0x1f')](_0x1b6be5)){_0x1b6be5={'agentcalledAt':moment()[_0x53c8('0x2a')](_0x53c8('0x2b')),'lastevent':_0x53c8('0x2c'),'mandatoryDisposition':_0x5883e7&&_0x5883e7[_0x53c8('0x2d')]?_0x5883e7[_0x53c8('0x2d')]:![],'type':_0x5883e7&&_0x5883e7[_0x53c8('0x2e')]?_0x5883e7[_0x53c8('0x2e')]:_0x53c8('0x2f'),'variables':_0x181e88,'motionChannel':_0x53c8('0x30')};}Object[_0x53c8('0x31')](_0x1b6be5,_[_0x53c8('0x32')](_0x12190e,[_0x53c8('0x33'),_0x53c8('0x34')]));this[_0x53c8('0x9')][_0x12190e['uniqueid']][_0x12190e[_0x53c8('0x24')]]=_0x1b6be5;logger[_0x53c8('0x25')](_0x53c8('0x35'),_0x12190e['uniqueid'],util[_0x53c8('0x36')](_0x1b6be5,{'showHidden':![],'depth':null}));ami[_0x53c8('0x1e')](_0x53c8('0x37'),_0x1b6be5);var _0xa05081={'id':_0x454bc5['id'],'calleridnum':_0x1b6be5['calleridnum'],'queue':_0x1b6be5['queue'],'variables':_0x1b6be5[_0x53c8('0x29')],'uniqueid':_0x12190e[_0x53c8('0x23')]};logger[_0x53c8('0x25')](_0x53c8('0x38'),_0x12190e[_0x53c8('0x23')],util['inspect'](_0xa05081,{'showHidden':![],'depth':null}));this[_0x53c8('0x1e')](util['format'](_0x53c8('0x39'),_0x12190e[_0x53c8('0x3a')]),_0x53c8('0x3b'),_0xa05081);}}catch(_0x41072a){logger['error']('[%s][voiceAgentReport][agentcalled]',_0x12190e[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x41072a,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x3c')]=function(_0x320c40){try{if(this[_0x53c8('0x21')](_0x320c40)){if(this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]]){for(var _0x554dea in this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]]){if(this['channels'][_0x320c40[_0x53c8('0x23')]][_0x53c8('0x3d')](_0x554dea)){if(_0x320c40[_0x53c8('0x24')]===_0x554dea){logger[_0x53c8('0x22')](_0x53c8('0x3e'),_0x320c40[_0x53c8('0x23')],_0x320c40[_0x53c8('0x3a')],_0x320c40['destuniqueid']);this['channels'][_0x320c40['uniqueid']][_0x554dea][_0x53c8('0x3f')]=moment()[_0x53c8('0x2a')](_0x53c8('0x2b'));this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x40')]=_0x320c40[_0x53c8('0x40')];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x41')]=_0x320c40[_0x53c8('0x41')];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x42')]=_0x320c40[_0x53c8('0x42')];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x43')]=_0x320c40['destchannelstatedesc'];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x44')]=_0x320c40[_0x53c8('0x44')];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x45')]=_0x53c8('0x46');_['merge'](this[_0x53c8('0xa')][_0x320c40[_0x53c8('0x27')]],_[_0x53c8('0x47')](_0x320c40,[_0x53c8('0x28'),_0x53c8('0x48')]));var _0x11ceaa=this[_0x53c8('0xa')][_0x320c40[_0x53c8('0x27')]];var _0x34a026={'id':_0x11ceaa['id'],'name':_0x11ceaa[_0x53c8('0x49')],'agentconnected':!![],'destaccountcode':_0x11ceaa[_0x53c8('0x4a')],'destconnectedlinenum':this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x320c40[_0x53c8('0x24')]]['exten'],'queue':this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x320c40['destuniqueid']]['queue'],'uniqueid':this[_0x53c8('0x9')][_0x320c40['uniqueid']][_0x320c40[_0x53c8('0x24')]]['uniqueid']};ami[_0x53c8('0x1e')](_0x53c8('0x4b'),this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x320c40['destuniqueid']]);this['emit'](util['format'](_0x53c8('0x39'),_0x320c40[_0x53c8('0x3a')]),_0x53c8('0x4c'),_0x34a026);}else if(!this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea]['agentringnoanswer']&&!this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0xf')]){logger[_0x53c8('0x22')](_0x53c8('0x4d'),_0x320c40['uniqueid'],this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea]['membername'],_0x554dea);this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0xc')]=!![];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x4e')]=_0x320c40[_0x53c8('0x24')];this[_0x53c8('0x9')][_0x320c40['uniqueid']][_0x554dea][_0x53c8('0x4f')]=_0x320c40[_0x53c8('0x3a')];this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x45')]=_0x53c8('0x50');this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea][_0x53c8('0x51')]=_0x53c8('0x50');logger[_0x53c8('0x25')](_0x53c8('0x52'),_0x320c40['uniqueid'],util['inspect'](this[_0x53c8('0x9')][_0x320c40[_0x53c8('0x23')]][_0x554dea],{'showHidden':![],'depth':null}));ami[_0x53c8('0x1e')](_0x53c8('0x53'),this['channels'][_0x320c40[_0x53c8('0x23')]][_0x554dea]);}else{logger['debug'](_0x53c8('0x54'),_0x320c40[_0x53c8('0x23')]);}}}}}}catch(_0x2018e9){logger[_0x53c8('0x55')](_0x53c8('0x56'),_0x320c40['uniqueid'],util[_0x53c8('0x36')](_0x2018e9,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0xd')]=function(_0x3caf89){try{if(this[_0x53c8('0x21')](_0x3caf89)){logger[_0x53c8('0x25')](_0x53c8('0x57'),_0x3caf89[_0x53c8('0x23')],util['inspect'](_0x3caf89,{'showHidden':![],'depth':null}));if(this[_0x53c8('0x9')][_0x3caf89[_0x53c8('0x23')]]&&this['channels'][_0x3caf89['uniqueid']][_0x3caf89['destuniqueid']]){logger['info'](_0x53c8('0x58'),_0x3caf89['uniqueid'],_0x3caf89[_0x53c8('0x3a')],_0x3caf89[_0x53c8('0x24')]);var _0x2713c4=this[_0x53c8('0xa')][_0x3caf89[_0x53c8('0x27')]];var _0x10c690=this[_0x53c8('0x9')][_0x3caf89['uniqueid']][_0x3caf89[_0x53c8('0x24')]];_0x10c690['agentringnoanswer']=!![];_0x10c690[_0x53c8('0x59')]=moment()[_0x53c8('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x10c690[_0x53c8('0x45')]=_0x53c8('0x5a');_0x10c690['reason']=_0x53c8('0x5a');var _0x2d9953={'id':_0x2713c4['id'],'name':_0x2713c4[_0x53c8('0x49')],'queue':_0x10c690[_0x53c8('0x28')],'uniqueid':_0x10c690[_0x53c8('0x23')]};logger[_0x53c8('0x25')](_0x53c8('0x5b'),_0x3caf89['uniqueid'],util[_0x53c8('0x36')](_0x2d9953,{'showHidden':![],'depth':null}));this[_0x53c8('0x1e')](util['format']('user:%s',_0x2713c4[_0x53c8('0x49')]),'user:agentringnoanswer',_0x2d9953);ami['emit'](_0x53c8('0x5c'),_0x10c690);this[_0x53c8('0x9')][_0x3caf89[_0x53c8('0x23')]][_0x3caf89[_0x53c8('0x24')]]=Object['assign']({},_0x10c690);}}}catch(_0x2c1235){logger['error'](_0x53c8('0x5d'),_0x3caf89[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x2c1235,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x5e')]=function(_0x882f0d){try{if(this['isNotNull'](_0x882f0d)){logger[_0x53c8('0x25')](_0x53c8('0x5f'),_0x882f0d[_0x53c8('0x23')],util['inspect'](_0x882f0d,{'showHidden':![],'depth':null}));if(this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]]){for(var _0x1cd255 in this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]]){if(this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]][_0x53c8('0x3d')](_0x1cd255)&&!this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]][_0x1cd255][_0x53c8('0xc')]&&!this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]][_0x1cd255][_0x53c8('0xf')]){logger[_0x53c8('0x22')](_0x53c8('0x60'),_0x882f0d[_0x53c8('0x23')],this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]][_0x1cd255]['membername'],_0x1cd255);this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]][_0x1cd255][_0x53c8('0xc')]=!![];this['channels'][_0x882f0d[_0x53c8('0x23')]][_0x1cd255]['agentringnoanswerAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x53c8('0x9')][_0x882f0d[_0x53c8('0x23')]][_0x1cd255]['lastevent']=_0x53c8('0x61');this[_0x53c8('0x9')][_0x882f0d['uniqueid']][_0x1cd255][_0x53c8('0x51')]=_0x53c8('0x61');logger[_0x53c8('0x25')](_0x53c8('0x62'),_0x882f0d[_0x53c8('0x23')],util[_0x53c8('0x36')](this['channels'][_0x882f0d[_0x53c8('0x23')]][_0x1cd255],{'showHidden':![],'depth':null}));ami[_0x53c8('0x1e')](_0x53c8('0x63'),this['channels'][_0x882f0d[_0x53c8('0x23')]][_0x1cd255]);}}}}}catch(_0x1277e5){logger[_0x53c8('0x55')](_0x53c8('0x64'),_0x882f0d['uniqueid'],util[_0x53c8('0x36')](_0x1277e5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x10')]=function(_0x1ee0d6){try{if(this[_0x53c8('0x21')](_0x1ee0d6)){logger[_0x53c8('0x25')](_0x53c8('0x65'),_0x1ee0d6[_0x53c8('0x23')],util['inspect'](_0x1ee0d6,{'showHidden':![],'depth':null}));if(this[_0x53c8('0x9')][_0x1ee0d6['uniqueid']]){for(var _0x563c06 in this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]]){if(this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x53c8('0x3d')](_0x563c06)){if(this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06][_0x53c8('0x3f')]&&!this['channels'][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06]['agentcomplete']){logger['info'](_0x53c8('0x66'),_0x1ee0d6[_0x53c8('0x23')],this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06][_0x53c8('0x3a')],_0x563c06);this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06]['agentcomplete']=!![];this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06][_0x53c8('0x67')]=moment()['format'](_0x53c8('0x2b'));this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06][_0x53c8('0x45')]=_0x53c8('0x68');this[_0x53c8('0x9')][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06]['reason']=_0x1ee0d6[_0x53c8('0x51')]==_0x53c8('0x69')?_0x53c8('0x6a'):_0x1ee0d6['reason'];this[_0x53c8('0x9')][_0x1ee0d6['uniqueid']][_0x563c06][_0x53c8('0x6b')]=_0x1ee0d6[_0x53c8('0x6b')];if(this[_0x53c8('0x6c')][_0x1ee0d6[_0x53c8('0x28')]]&&this[_0x53c8('0x6c')][_0x1ee0d6[_0x53c8('0x28')]][_0x53c8('0x6d')]){this['channels'][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06][_0x53c8('0x6e')]=this['voiceQueues'][_0x1ee0d6[_0x53c8('0x28')]][_0x53c8('0x6f')];this[_0x53c8('0x9')][_0x1ee0d6['uniqueid']][_0x563c06][_0x53c8('0x70')]=!![];}this[_0x53c8('0xa')][_0x1ee0d6['interface']]=_[_0x53c8('0x32')](this['agents'][_0x1ee0d6[_0x53c8('0x27')]],[_0x53c8('0x28'),_0x53c8('0x48')]);logger['debug'](_0x53c8('0x71'),_0x1ee0d6[_0x53c8('0x23')],util[_0x53c8('0x36')](this['channels'][_0x1ee0d6[_0x53c8('0x23')]][_0x563c06],{'showHidden':![],'depth':null}));ami[_0x53c8('0x1e')](_0x53c8('0x72'),this[_0x53c8('0x9')][_0x1ee0d6['uniqueid']][_0x563c06]);logger['debug'](_0x53c8('0x73'),_0x1ee0d6['uniqueid'],util['inspect']({'id':this[_0x53c8('0xa')][_0x1ee0d6[_0x53c8('0x27')]]['id'],'destaccountcode':_0x1ee0d6[_0x53c8('0x74')]},{'showHidden':![],'depth':null}));this['emit'](util['format']('user:%s',_0x1ee0d6[_0x53c8('0x3a')]),_0x53c8('0x75'),{'id':this[_0x53c8('0xa')][_0x1ee0d6[_0x53c8('0x27')]]['id'],'destaccountcode':Number(_0x1ee0d6[_0x53c8('0x74')])});}}}}}}catch(_0x1df632){logger[_0x53c8('0x55')](_0x53c8('0x76'),_0x1ee0d6[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x1df632,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x12')]=function(_0x3e36d6){try{if(this[_0x53c8('0x21')](_0x3e36d6)){logger[_0x53c8('0x25')]('[%s][voiceAgentReport][varset]\x20event:',_0x3e36d6[_0x53c8('0x23')],util['inspect'](_0x3e36d6,{'showHidden':![],'depth':null}));this[_0x53c8('0x77')](_0x3e36d6['uniqueid'],_[_0x53c8('0x78')](_0x3e36d6[_0x53c8('0x79')])[0x0],_0x3e36d6['value']);if(this[_0x53c8('0x9')][_0x3e36d6[_0x53c8('0x23')]]){for(var _0xe860a in this[_0x53c8('0x9')][_0x3e36d6[_0x53c8('0x23')]]){if(this[_0x53c8('0x9')][_0x3e36d6[_0x53c8('0x23')]]['hasOwnProperty'](_0xe860a)){logger['info'](_0x53c8('0x7a'),_0x3e36d6[_0x53c8('0x23')],_0xe860a,_[_0x53c8('0x78')](_0x3e36d6[_0x53c8('0x79')])[0x0],_0x3e36d6[_0x53c8('0x7b')]);if(_[_0x53c8('0x1f')](this[_0x53c8('0x9')][_0x3e36d6[_0x53c8('0x23')]][_0xe860a]['variables'])){this[_0x53c8('0x9')][_0x3e36d6[_0x53c8('0x23')]][_0xe860a]['variables']={};}this[_0x53c8('0x9')][_0x3e36d6[_0x53c8('0x23')]][_0xe860a]['variables']=this[_0x53c8('0x29')][_0x3e36d6[_0x53c8('0x23')]];}}}}}catch(_0x149dc8){logger['error'](_0x53c8('0x7c'),_0x3e36d6[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x149dc8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x77')]=function(_0x2ee7cc,_0x2e4304,_0x36edbc){var _0x5c1c67=['rtpaudioqos',_0x53c8('0x7d'),_0x53c8('0x7e'),'rtpaudioqosjitterbridged',_0x53c8('0x7f'),_0x53c8('0x80'),'rtpaudioqosrtt','rtpaudioqosrttbridged',_0x53c8('0x81'),_0x53c8('0x82'),_0x53c8('0x83'),'bridgepvtcallid','membercalls',_0x53c8('0x84'),_0x53c8('0x85'),'memberlastcall','membername',_0x53c8('0x86'),_0x53c8('0x87')];if(!_[_0x53c8('0x88')](_0x2e4304)&&!_[_0x53c8('0x89')](_0x5c1c67,_0x2e4304)){if(_[_0x53c8('0x1f')](this['variables'][_0x2ee7cc])){this[_0x53c8('0x29')][_0x2ee7cc]={};}this[_0x53c8('0x29')][_0x2ee7cc][_0x2e4304]=_0x36edbc;}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x14')]=function(_0x329719){try{if(this[_0x53c8('0x21')](_0x329719)){logger[_0x53c8('0x25')]('[%s][voiceAgentReport][hangup]\x20event:',_0x329719['uniqueid'],util[_0x53c8('0x36')](_0x329719,{'showHidden':![],'depth':null}));if(this[_0x53c8('0x9')][_0x329719[_0x53c8('0x23')]]){for(var _0x13724e in this[_0x53c8('0x9')][_0x329719[_0x53c8('0x23')]]){if(this[_0x53c8('0x9')][_0x329719[_0x53c8('0x23')]][_0x53c8('0x3d')](_0x13724e)){if(this[_0x53c8('0x9')][_0x329719[_0x53c8('0x23')]][_0x13724e][_0x53c8('0x51')]==_0x53c8('0x69')&&this['channels'][_0x329719['uniqueid']][_0x13724e][_0x53c8('0xf')]){logger[_0x53c8('0x22')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x329719[_0x53c8('0x23')],_0x13724e);this[_0x53c8('0x9')][_0x329719['uniqueid']][_0x13724e][_0x53c8('0x67')]=moment()['format'](_0x53c8('0x2b'));}}}logger[_0x53c8('0x25')](_0x53c8('0x8a'),_0x329719[_0x53c8('0x23')],util[_0x53c8('0x36')](_[_0x53c8('0x8b')](this[_0x53c8('0x9')][_0x329719[_0x53c8('0x23')]]),{'showHidden':![],'depth':null}));ami[_0x53c8('0x1e')]('custom:voiceAgentReport',_[_0x53c8('0x8b')](this[_0x53c8('0x9')][_0x329719[_0x53c8('0x23')]]));this[_0x53c8('0x8c')](_0x329719['uniqueid']);}if(this[_0x53c8('0x29')][_0x329719[_0x53c8('0x23')]]){delete this[_0x53c8('0x29')][_0x329719[_0x53c8('0x23')]];}}}catch(_0x499d96){logger[_0x53c8('0x55')](_0x53c8('0x8d'),_0x329719[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x499d96,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')]['syncAttendedTransfer']=function(_0x5800f2){try{if(this[_0x53c8('0x21')](_0x5800f2)){logger[_0x53c8('0x25')](_0x53c8('0x8e'),_0x5800f2[_0x53c8('0x23')],util['inspect'](_0x5800f2,{'showHidden':![],'depth':null}));if(this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]]){for(var _0x1296f8 in this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]]){if(this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]]['hasOwnProperty'](_0x1296f8)){if(_0x5800f2['origtransfereruniqueid']===_0x1296f8){logger[_0x53c8('0x22')](_0x53c8('0x90'),_0x5800f2[_0x53c8('0x23')],this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]][_0x1296f8][_0x53c8('0x3a')],_0x1296f8);var _0x23ab58=moment();this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]][_0x1296f8]['agentcomplete']=!![];this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]][_0x1296f8]['agentcompleteAt']=moment()[_0x53c8('0x2a')](_0x53c8('0x2b'));this['channels'][_0x5800f2[_0x53c8('0x8f')]][_0x1296f8][_0x53c8('0x45')]=_0x53c8('0x68');this['channels'][_0x5800f2[_0x53c8('0x8f')]][_0x1296f8][_0x53c8('0x51')]='transfer';this['channels'][_0x5800f2['transfereeuniqueid']][_0x1296f8]['talktime']=_0x23ab58['diff'](this['channels'][_0x5800f2[_0x53c8('0x8f')]][_0x1296f8]['agentconnectAt'],_0x53c8('0x91'));}}}}if(this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x92')]]){var _0x246b9f=this[_0x53c8('0x9')][_0x5800f2['secondtransfereruniqueid']];this[_0x53c8('0x9')][_0x5800f2['secondtransfereruniqueid']]=this[_0x53c8('0x9')][_0x5800f2[_0x53c8('0x8f')]];this[_0x53c8('0x9')][_0x5800f2['transfereeuniqueid']]=_0x246b9f;}}}catch(_0x408b38){logger[_0x53c8('0x55')]('[%s][voiceAgentReport][attendedtransfer]',_0x5800f2[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x408b38,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x1c')]=function(_0x1702b7){try{if(this['isNotNull'](_0x1702b7)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x1702b7['uniqueid'],util[_0x53c8('0x36')](_0x1702b7,{'showHidden':![],'depth':null}));if(this['channels'][_0x1702b7[_0x53c8('0x8f')]]){for(var _0x3dbd28 in this['channels'][_0x1702b7[_0x53c8('0x8f')]]){if(this[_0x53c8('0x9')][_0x1702b7['transfereeuniqueid']][_0x53c8('0x3d')](_0x3dbd28)){if(_0x1702b7[_0x53c8('0x93')]===_0x3dbd28){logger['info'](_0x53c8('0x94'),_0x1702b7[_0x53c8('0x23')],this[_0x53c8('0x9')][_0x1702b7[_0x53c8('0x8f')]][_0x3dbd28]['membername'],_0x3dbd28);var _0x5b7ab1=moment();this[_0x53c8('0x9')][_0x1702b7[_0x53c8('0x8f')]][_0x3dbd28]['agentcomplete']=!![];this[_0x53c8('0x9')][_0x1702b7[_0x53c8('0x8f')]][_0x3dbd28]['agentcompleteAt']=_0x5b7ab1;this['channels'][_0x1702b7['transfereeuniqueid']][_0x3dbd28][_0x53c8('0x45')]=_0x53c8('0x68');this['channels'][_0x1702b7[_0x53c8('0x8f')]][_0x3dbd28]['reason']=_0x53c8('0x69');this[_0x53c8('0x9')][_0x1702b7['transfereeuniqueid']][_0x3dbd28][_0x53c8('0x6b')]=_0x5b7ab1[_0x53c8('0x95')](this[_0x53c8('0x9')][_0x1702b7['transfereeuniqueid']][_0x3dbd28][_0x53c8('0x3f')],_0x53c8('0x91'));}}}}}}catch(_0x5998b3){logger[_0x53c8('0x55')](_0x53c8('0x96'),_0x1702b7[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x5998b3,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x16')]=function(_0x5ef353){var _0x4ce40d='';try{if(this[_0x53c8('0x21')](_0x5ef353)){logger[_0x53c8('0x25')](_0x53c8('0x97'),_0x5ef353[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x5ef353,{'showHidden':![],'depth':null}));if(_0x5ef353[_0x53c8('0x98')]){_0x4ce40d=_0x5ef353[_0x53c8('0x98')]['substring'](0x0,_0x5ef353[_0x53c8('0x98')][_0x53c8('0x99')]('-'));if(this['agents'][_0x4ce40d]){logger[_0x53c8('0x22')](_0x53c8('0x9a'),_0x5ef353[_0x53c8('0x23')],_0x4ce40d);this['agents'][_0x4ce40d][_0x53c8('0x9b')]=!![];}}}}catch(_0x5d69c1){logger[_0x53c8('0x55')]('[%s][voiceAgentReport][musiconholdstart]',_0x5ef353[_0x53c8('0x23')],util['inspect'](_0x5d69c1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0x3a3d37){var _0x5e6e87='';try{if(this['isNotNull'](_0x3a3d37)){logger['debug'](_0x53c8('0x9c'),_0x3a3d37[_0x53c8('0x23')],util[_0x53c8('0x36')](_0x3a3d37,{'showHidden':![],'depth':null}));if(_0x3a3d37[_0x53c8('0x98')]){_0x5e6e87=_0x3a3d37['channel'][_0x53c8('0x9d')](0x0,_0x3a3d37['channel']['lastIndexOf']('-'));if(this[_0x53c8('0xa')][_0x5e6e87]){logger[_0x53c8('0x22')](_0x53c8('0x9e'),_0x3a3d37[_0x53c8('0x23')],_0x5e6e87);this[_0x53c8('0xa')][_0x5e6e87][_0x53c8('0x9b')]=![];}}}}catch(_0x2fa377){logger[_0x53c8('0x55')]('[%s][voiceAgentReport][musiconholdstop]',_0x3a3d37['uniqueid'],util[_0x53c8('0x36')](_0x2fa377,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x53c8('0x1d')][_0x53c8('0x8c')]=function(_0x261078,_0x1bcc64=0x2710){if(this['channels'][_0x261078]){setTimeout(()=>{delete this[_0x53c8('0x9')][_0x261078];},_0x1bcc64);}};module[_0x53c8('0x9f')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 355e6fe..4df4aad 100644 --- a/server/services/ami/report/voiceCallReport.js +++ b/server/services/ami/report/voiceCallReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x35df=['[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','transferToInternal','isEmpty','monitors','getSettings','stopRecordingOnTransfer','resolve','then','Action','catch','StopMixMonitor','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','syncAttendedTransfer','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','transfereecalleridnum','transfereruniqueid','transfererchannel','BLIND','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','mohtime','exports','lodash','moment','path','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','agi','dial','playback','voicemail','FAILED','NO\x20ANSWER','ANSWERED','redis','defaults','localhost','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','merge','pick','keys','context','from-sip','channel','exten','connectedlinenum','format','user:%s','name','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','starttime','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','destconnectedlinenum','undefined','user:agentconnect','[%s][voiceCallReport][newchannel]','application','applicationdata','appdata','toLowerCase','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','subtract','seconds','lastapplication','startsWith','cdr(','split','match','type','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','connectedlinename','destinationchannel','membername','xcally-motion-preview','UserId','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','push','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcalllinkedid','[%s][voiceCallReport][varset]','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit'];(function(_0x2dfd28,_0x153b3c){var _0x49c016=function(_0x1cfb4d){while(--_0x1cfb4d){_0x2dfd28['push'](_0x2dfd28['shift']());}};_0x49c016(++_0x153b3c);}(_0x35df,0xff));var _0xf35d=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0x35df[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0xf35d('0x0'));var moment=require(_0xf35d('0x1'));var util=require('util');var path=require(_0xf35d('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0xf35d('0x3'))(_0xf35d('0x4'));var ami=require(_0xf35d('0x5'));var Channel=require(_0xf35d('0x6'));var RpcSetting=require(_0xf35d('0x7'));var applications=[_0xf35d('0x8'),_0xf35d('0x9'),_0xf35d('0xa'),_0xf35d('0xb'),_0xf35d('0xc'),_0xf35d('0xd')];var dispositions=['NO\x20ANSWER',_0xf35d('0xe'),_0xf35d('0xe'),_0xf35d('0xf'),_0xf35d('0xf'),'NO\x20ANSWER',_0xf35d('0x10'),'BUSY','FAILED',_0xf35d('0xe'),_0xf35d('0xe')];config[_0xf35d('0x11')]=_[_0xf35d('0x12')](config[_0xf35d('0x11')],{'host':_0xf35d('0x13'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf35d('0x11')]));function VoiceCallReport(_0x48b82d){this['channels']=_0x48b82d[_0xf35d('0x14')];this[_0xf35d('0x15')]=_0x48b82d[_0xf35d('0x15')];this[_0xf35d('0x16')]={};ami['on'](_0xf35d('0x17'),this[_0xf35d('0x18')][_0xf35d('0x19')](this));ami['on']('newexten',this[_0xf35d('0x18')]['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0xf35d('0x19')](this));ami['on']('newstate',this['syncNewState'][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x1a'),this[_0xf35d('0x1b')][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x1c'),this[_0xf35d('0x1d')][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x1e'),this[_0xf35d('0x1f')][_0xf35d('0x19')](this));ami['on'](_0xf35d('0x20'),this['syncAttendedTransfer']['bind'](this));ami['on'](_0xf35d('0x21'),this[_0xf35d('0x22')]['bind'](this));ami['on'](_0xf35d('0x23'),this[_0xf35d('0x24')]['bind'](this));ami['on']('musiconholdstop',this[_0xf35d('0x25')][_0xf35d('0x19')](this));try{logger[_0xf35d('0x26')](_0xf35d('0x27'));ami[_0xf35d('0x28')]();}catch(_0x22853b){logger['error'](_0xf35d('0x29'),util[_0xf35d('0x2a')](_0x22853b,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x2c')]=function(_0x350619){return _0x350619!==null&&!_[_0xf35d('0x2d')](_0x350619);};VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x2e')]=function(_0x2e27f7,_0x45483f,_0x401600){io['to'](_0x2e27f7)[_0xf35d('0x2e')](_0x45483f,_0x401600);};VoiceCallReport['prototype'][_0xf35d('0x1f')]=function(_0x3bd1eb){try{if(this[_0xf35d('0x2c')](_0x3bd1eb)){logger['info']('[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s',_0x3bd1eb[_0xf35d('0x2f')],_0x3bd1eb['calleridname'],_0x3bd1eb[_0xf35d('0x30')]);logger[_0xf35d('0x31')](_0xf35d('0x32'),_0x3bd1eb[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x3bd1eb,{'showHidden':![],'depth':null}));if(_0x3bd1eb[_0xf35d('0x2f')]===_0x3bd1eb['linkedid']){if(!_[_0xf35d('0x2d')](this[_0xf35d('0x14')][_0x3bd1eb[_0xf35d('0x2f')]])){_[_0xf35d('0x33')](this[_0xf35d('0x14')][_0x3bd1eb[_0xf35d('0x2f')]],_[_0xf35d('0x34')](_0x3bd1eb,_[_0xf35d('0x35')](this['channels'][_0x3bd1eb[_0xf35d('0x2f')]])));}}if(_0x3bd1eb[_0xf35d('0x36')]===_0xf35d('0x37')){var _0x326c25=this[_0xf35d('0x15')][_0x3bd1eb[_0xf35d('0x38')]['split']('-')[0x0]];if(_0x326c25){if(_0x3bd1eb[_0xf35d('0x39')]=='xcally-motion-preview'){_0x326c25['destconnectedlinenum']=_0x3bd1eb[_0xf35d('0x3a')];this[_0xf35d('0x2e')](util[_0xf35d('0x3b')](_0xf35d('0x3c'),_0x326c25[_0xf35d('0x3d')]),'user:agentconnect',{'id':_0x326c25['id'],'destaccountcode':_0x326c25[_0xf35d('0x3e')],'destconnectedlinenum':_0x3bd1eb[_0xf35d('0x3a')]});}}}}}catch(_0x40b75b){logger[_0xf35d('0x3f')](_0xf35d('0x40'),_0x3bd1eb[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x40b75b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf35d('0x2b')]['syncNewChannel']=function(_0x311adf){try{if(this['isNotNull'](_0x311adf)){logger['debug'](_0xf35d('0x41'),_0x311adf[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x311adf,{'showHidden':![],'depth':null}));if(this[_0xf35d('0x14')][_0x311adf[_0xf35d('0x2f')]]){return;}if(_0x311adf['channel']===_0xf35d('0x42')){return;}if(_0x311adf[_0xf35d('0x2f')]!==_0x311adf[_0xf35d('0x43')]&&!this[_0xf35d('0x16')][_0x311adf[_0xf35d('0x43')]]){return;}logger[_0xf35d('0x26')]('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x311adf[_0xf35d('0x2f')],_0x311adf[_0xf35d('0x36')],_0x311adf[_0xf35d('0x39')]);this[_0xf35d('0x14')][_0x311adf[_0xf35d('0x2f')]]=new Channel();this[_0xf35d('0x14')][_0x311adf['uniqueid']][_0xf35d('0x44')]=moment()['format'](_0xf35d('0x45'));this[_0xf35d('0x14')][_0x311adf['uniqueid']][_0xf35d('0x46')]=dispositions[_[_0xf35d('0x47')](_0x311adf[_0xf35d('0x48')])];_[_0xf35d('0x33')](this['channels'][_0x311adf[_0xf35d('0x2f')]],_[_0xf35d('0x34')](_0x311adf,_[_0xf35d('0x35')](this['channels'][_0x311adf[_0xf35d('0x2f')]])));if(_0x311adf['context']===_0xf35d('0x37')){var _0x2235a0=this[_0xf35d('0x15')][_0x311adf['channel']['split']('-')[0x0]];if(_0x2235a0&&typeof _0x2235a0[_0xf35d('0x49')]===_0xf35d('0x4a')){_0x2235a0[_0xf35d('0x49')]=_0x311adf[_0xf35d('0x39')];logger[_0xf35d('0x31')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x311adf[_0xf35d('0x2f')],util[_0xf35d('0x2a')]({'id':_0x2235a0['id'],'destaccountcode':_0x2235a0[_0xf35d('0x3e')],'destconnectedlinenum':_0x311adf[_0xf35d('0x39')]},{'showHidden':![],'depth':null}));this['emit'](util[_0xf35d('0x3b')](_0xf35d('0x3c'),_0x2235a0[_0xf35d('0x3d')]),_0xf35d('0x4b'),{'id':_0x2235a0['id'],'destaccountcode':_0x2235a0[_0xf35d('0x3e')],'destconnectedlinenum':_0x311adf[_0xf35d('0x39')]});}}}}catch(_0x20cea9){logger[_0xf35d('0x3f')](_0xf35d('0x4c'),_0x311adf[_0xf35d('0x2f')],util['inspect'](_0x20cea9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x18')]=function(_0x1a2f45){try{if(this[_0xf35d('0x2c')](_0x1a2f45)){logger[_0xf35d('0x31')]('[%s][voiceCallReport][newexten]\x20event:',_0x1a2f45[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x1a2f45,{'showHidden':![],'depth':null}));if(_0x1a2f45['channel']===_0xf35d('0x42')||_0x1a2f45[_0xf35d('0x39')]==='h')return;if(_0x1a2f45['uniqueid']===_0x1a2f45[_0xf35d('0x43')]||this[_0xf35d('0x16')][_0x1a2f45[_0xf35d('0x43')]]){_0x1a2f45[_0xf35d('0x4d')]=_0x1a2f45[_0xf35d('0x4d')]?_0x1a2f45[_0xf35d('0x4d')]['toLowerCase']():undefined;_0x1a2f45[_0xf35d('0x4e')]=_0x1a2f45[_0xf35d('0x4f')]||_0x1a2f45[_0xf35d('0x4e')];if(_0x1a2f45[_0xf35d('0x4f')]&&_0x1a2f45[_0xf35d('0x4d')]!==_0xf35d('0x9')){_0x1a2f45[_0xf35d('0x4e')]=_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x50')]();}logger[_0xf35d('0x26')](_0xf35d('0x51'),_0x1a2f45[_0xf35d('0x2f')],_0x1a2f45['application'],_0x1a2f45[_0xf35d('0x4e')]);if(_[_0xf35d('0x2d')](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]])){this[_0xf35d('0x14')][_0x1a2f45['uniqueid']]=new Channel();this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]]['starttime']=_0x1a2f45[_0xf35d('0x52')]?moment()[_0xf35d('0x53')](moment[_0xf35d('0x52')](_0x1a2f45[_0xf35d('0x52')])['seconds'](),_0xf35d('0x54'))['format'](_0xf35d('0x45')):moment()[_0xf35d('0x3b')](_0xf35d('0x45'));this['channels'][_0x1a2f45['uniqueid']][_0xf35d('0x46')]=_0xf35d('0xf');}_[_0xf35d('0x33')](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]],_[_0xf35d('0x34')](_0x1a2f45,_[_0xf35d('0x35')](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]])));if(_['includes'](applications,_0x1a2f45[_0xf35d('0x4d')])){this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]][_0xf35d('0x55')]=_0x1a2f45[_0xf35d('0x4d')];this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]]['lastdata']=_0x1a2f45[_0xf35d('0x4e')];if(_0x1a2f45[_0xf35d('0x4d')]===_0xf35d('0x8')&&_[_0xf35d('0x56')](_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x50')](),_0xf35d('0x57'))){var _0xe30798=_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x58')]('=');var _0x103bbb=_0xe30798[0x0]['toLowerCase']()[_0xf35d('0x59')](/cdr\((.*)\)/);if(_0x103bbb){if(_0x103bbb[0x1]===_0xf35d('0x5a')&&!_['isNil'](this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]][_0x103bbb[0x1]]))return;this[_0xf35d('0x14')][_0x1a2f45[_0xf35d('0x2f')]][_0x103bbb[0x1]]=_0xe30798[0x1];}}else if(_0x1a2f45[_0xf35d('0x4d')]===_0xf35d('0x9')){this['channels'][_0x1a2f45[_0xf35d('0x2f')]][_0xf35d('0x9')]=_0x1a2f45[_0xf35d('0x4e')][_0xf35d('0x58')](',')[0x0];}}}}}catch(_0x50fe17){logger[_0xf35d('0x3f')](_0xf35d('0x5b'),_0x1a2f45[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x50fe17,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf35d('0x5c')]=function(_0x1fae33){try{if(this[_0xf35d('0x2c')](_0x1fae33)){logger[_0xf35d('0x26')](_0xf35d('0x5d'),_0x1fae33[_0xf35d('0x2f')],_0x1fae33['linkedid'],_0x1fae33[_0xf35d('0x5e')],_0x1fae33[_0xf35d('0x30')]);logger[_0xf35d('0x31')](_0xf35d('0x5f'),_0x1fae33[_0xf35d('0x2f')],util['inspect'](_0x1fae33,{'showHidden':![],'depth':null}));if(_0x1fae33[_0xf35d('0x48')]!=='6')return;var _0x4be9d9=this[_0xf35d('0x15')][_0x1fae33[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]];if(_0x1fae33['uniqueid']!==_0x1fae33[_0xf35d('0x43')]){var _0x557650=moment();if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]]){if(!this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x60')]){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]]['answered']=!![];this['channels'][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x61')]=_0x557650['format'](_0xf35d('0x45'));if(this[_0xf35d('0x14')][_0x1fae33['linkedid']][_0xf35d('0x44')]){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x62')]=_0x557650[_0xf35d('0x63')](this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x44')],_0xf35d('0x54'));}}this[_0xf35d('0x14')][_0x1fae33['linkedid']][_0xf35d('0x43')]=_0x1fae33['uniqueid'];if(_0x1fae33[_0xf35d('0x30')]!=='xcally-motion-preview'){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x3a')]=_0x1fae33['calleridnum'];}this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x64')]=_0x1fae33[_0xf35d('0x5e')];this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x65')]=_0x1fae33['channel'];this[_0xf35d('0x14')][_0x1fae33['linkedid']][_0xf35d('0x46')]=dispositions[_[_0xf35d('0x47')](_0x1fae33[_0xf35d('0x48')])];if(_0x4be9d9){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]]['UserId']=_0x4be9d9['id'];this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x66')]=_0x4be9d9[_0xf35d('0x3d')];}}if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]]){if(!this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x60')]){this[_0xf35d('0x14')][_0x1fae33['uniqueid']][_0xf35d('0x60')]=!![];this['channels'][_0x1fae33['uniqueid']][_0xf35d('0x61')]=_0x557650[_0xf35d('0x3b')](_0xf35d('0x45'));if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x44')]){this['channels'][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x62')]=_0x557650[_0xf35d('0x63')](this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x44')],_0xf35d('0x54'));}}if(_0x1fae33['calleridnum']!==_0xf35d('0x67')){this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x3a')]=_0x1fae33['calleridnum'];}this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x64')]=_0x1fae33[_0xf35d('0x5e')];this[_0xf35d('0x14')][_0x1fae33['uniqueid']]['destinationchannel']=_0x1fae33['channel'];this['channels'][_0x1fae33[_0xf35d('0x2f')]]['disposition']=dispositions[_[_0xf35d('0x47')](_0x1fae33[_0xf35d('0x48')])];}}else{if(this[_0xf35d('0x14')][_0x1fae33['uniqueid']]){if(_0x4be9d9){this['channels'][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x68')]=_0x4be9d9['id'];this[_0xf35d('0x14')][_0x1fae33['uniqueid']][_0xf35d('0x66')]=_0x4be9d9[_0xf35d('0x3d')];}}}if(_0x1fae33[_0xf35d('0x36')]==='from-sip'){if(_0x4be9d9){_0x4be9d9[_0xf35d('0x49')]=_0x1fae33['exten'];var _0xf2490;if(this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]]){_0xf2490=this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x2f')]][_0xf35d('0x9')];}else if(this[_0xf35d('0x14')][_0x1fae33['linkedid']]){_0xf2490=this[_0xf35d('0x14')][_0x1fae33[_0xf35d('0x43')]][_0xf35d('0x9')];}_0x4be9d9[_0xf35d('0x9')]=_0xf2490;var _0x9f57d2={'id':_0x4be9d9['id'],'name':_0x4be9d9[_0xf35d('0x3d')],'agentconnected':!![],'destaccountcode':_0x4be9d9[_0xf35d('0x3e')],'destconnectedlinenum':_0x1fae33[_0xf35d('0x39')],'queue':_0xf2490||undefined,'uniqueid':_0x1fae33[_0xf35d('0x43')]};logger[_0xf35d('0x31')](_0xf35d('0x69'),_0x1fae33['uniqueid'],util[_0xf35d('0x2a')](_0x9f57d2,{'showHidden':![],'depth':null}));this[_0xf35d('0x2e')](util[_0xf35d('0x3b')](_0xf35d('0x3c'),_0x4be9d9[_0xf35d('0x3d')]),'user:agentconnect',_0x9f57d2);}}}}catch(_0x3a56d1){logger[_0xf35d('0x3f')](_0xf35d('0x6a'),_0x1fae33[_0xf35d('0x2f')],util['inspect'](_0x3a56d1,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf35d('0x6b')]=function(_0x3ea4e6,_0x17fe0f){try{if(this['channels'][_0x3ea4e6]){logger[_0xf35d('0x26')]('[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s',_0x3ea4e6,_0x17fe0f);this[_0xf35d('0x14')][_0x3ea4e6][_0xf35d('0x6c')]=!![];if(_[_0xf35d('0x6d')](_0x17fe0f,_0xf35d('0x6e'))){_0x17fe0f=_0x17fe0f[_0xf35d('0x6f')](_0xf35d('0x6e'),_0xf35d('0x70'));}this['channels'][_0x3ea4e6][_0xf35d('0x71')]=_0x17fe0f;var _0x274fbb=_['find'](this[_0xf35d('0x14')][_0x3ea4e6]['monitors'],{'filename':_0x17fe0f});if(_['isNil'](_0x274fbb)){this['channels'][_0x3ea4e6]['monitors'][_0xf35d('0x72')]({'filename':_0x17fe0f,'createdAt':moment()[_0xf35d('0x3b')](_0xf35d('0x45')),'mixmonitorid':'','status':_0xf35d('0x73')});}}}catch(_0x3976c6){logger['error'](_0xf35d('0x74'),_0x3ea4e6,util[_0xf35d('0x2a')](_0x3976c6,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xf35d('0x1b')]=function(_0x5a34e9){try{if(this[_0xf35d('0x2c')](_0x5a34e9)){logger[_0xf35d('0x31')]('[%s][voiceCallReport][varset]\x20event:',_0x5a34e9[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x5a34e9,{'showHidden':![],'depth':null}));if(this[_0xf35d('0x14')][_0x5a34e9['uniqueid']]&&_0x5a34e9[_0xf35d('0x38')]!=_0xf35d('0x42')){if(this[_0xf35d('0x2c')](_0x5a34e9['variable'])){if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x76')])){logger[_0xf35d('0x26')](_0xf35d('0x77'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x6b')](_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x79')])){logger['info'](_0xf35d('0x7a'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9['uniqueid']][_0xf35d('0x30')]=_0x5a34e9['value'];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x7b')])){logger['info'](_0xf35d('0x7c'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9['value']);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x7d')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x7e')])){logger[_0xf35d('0x26')](_0xf35d('0x7f'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]]['type']=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x80')])){logger[_0xf35d('0x26')](_0xf35d('0x81'),_0x5a34e9['uniqueid'],_0x5a34e9[_0xf35d('0x78')][_0xf35d('0x58')](',')[0x0]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x9')]=_0x5a34e9[_0xf35d('0x78')][_0xf35d('0x58')](',')[0x0];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x82')])){logger[_0xf35d('0x26')](_0xf35d('0x83'),_0x5a34e9['uniqueid'],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x84')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9['variable']['xmd-destination'])){logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x85')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')]['xmd-callerid-preview'])){logger['info'](_0xf35d('0x86'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this['channels'][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x87')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9['variable'][_0xf35d('0x88')])){logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x9')]=_0x5a34e9[_0xf35d('0x78')];}else if(this[_0xf35d('0x2c')](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x89')])){logger[_0xf35d('0x26')](_0xf35d('0x8a'),_0x5a34e9[_0xf35d('0x2f')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x2f')]][_0xf35d('0x8b')]=_0x5a34e9['value'];}}}else if(this['isNotNull'](_0x5a34e9[_0xf35d('0x75')][_0xf35d('0x76')])){if(_0x5a34e9[_0xf35d('0x78')]){var _0x197d88=path[_0xf35d('0x8c')](_0x5a34e9[_0xf35d('0x78')])[_0xf35d('0x3d')];logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x197d88,_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x6b')](_0x197d88,_0x5a34e9['value']);}}else if(this[_0xf35d('0x14')][_0x5a34e9[_0xf35d('0x43')]]){if(this[_0xf35d('0x2c')](_0x5a34e9['variable'])){if(this[_0xf35d('0x2c')](_0x5a34e9['variable']['sipcallid'])){logger[_0xf35d('0x26')]('[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s',_0x5a34e9[_0xf35d('0x43')],_0x5a34e9[_0xf35d('0x78')]);this[_0xf35d('0x14')][_0x5a34e9['linkedid']][_0xf35d('0x8d')]=_0x5a34e9['value'];}}}}}catch(_0x3e3982){logger['error'](_0xf35d('0x8e'),_0x5a34e9[_0xf35d('0x2f')],util[_0xf35d('0x2a')](_0x3e3982,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xf35d('0x2b')][_0xf35d('0x1d')]=function(_0x5f29c0){try{if(this[_0xf35d('0x2c')](_0x5f29c0)){logger['debug']('[%s][voiceCallReport][hangup]\x20event:',_0x5f29c0[_0xf35d('0x2f')],util['inspect'](_0x5f29c0,{'showHidden':![],'depth':null}));if(this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]){if(this['channels'][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]]){this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0['linkedid']][_0xf35d('0x43')]][_0xf35d('0x2f')]=_0x5f29c0['uniqueid'];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['linkedid']][_0xf35d('0x60')]=this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x60')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['linkedid']][_0xf35d('0x61')]=this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x61')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]][_0xf35d('0x65')]=this['channels'][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]][_0xf35d('0x38')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['linkedid']][_0xf35d('0x46')]=this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x46')];this['channels'][_0x5f29c0[_0xf35d('0x2f')]]=this[_0xf35d('0x14')][this['blindTransfers'][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x43')]];this[_0xf35d('0x8f')](this['blindTransfers'][_0x5f29c0['linkedid']]['linkedid']);}else if(this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]]){this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']][_0xf35d('0x2f')]=[this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0['linkedid']]['uniqueid']]['linkedid'],this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x43')]=this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']][_0xf35d('0x2f')]][0x0];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']][_0xf35d('0x60')]=this['channels'][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x60')];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x61')]=this['channels'][_0x5f29c0[_0xf35d('0x2f')]]['answertime'];this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x65')]=this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0['linkedid']][_0xf35d('0x2f')]][_0xf35d('0x38')];this[_0xf35d('0x14')][this['blindTransfers'][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]][_0xf35d('0x46')]=this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x46')];this['channels'][_0x5f29c0[_0xf35d('0x2f')]]=this[_0xf35d('0x14')][this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]]['uniqueid']];this['deleteChannelAfterTimeout'](this[_0xf35d('0x16')][_0x5f29c0[_0xf35d('0x43')]][_0xf35d('0x2f')]);}}if(this[_0xf35d('0x14')][_0x5f29c0['uniqueid']]){logger[_0xf35d('0x26')](_0xf35d('0x90'),_0x5f29c0[_0xf35d('0x2f')],_0x5f29c0[_0xf35d('0x91')]);var _0x431654=moment();this[_0xf35d('0x14')][_0x5f29c0['uniqueid']][_0xf35d('0x92')]=_0x431654['format'](_0xf35d('0x45'));this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]]['duration']=_0x431654['diff'](this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x44')],_0xf35d('0x54'));if(this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x60')]){this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x93')]=_0x431654[_0xf35d('0x63')](this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x61')],_0xf35d('0x54'));this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x62')]=this['channels'][_0x5f29c0[_0xf35d('0x2f')]][_0xf35d('0x52')]-this[_0xf35d('0x14')][_0x5f29c0[_0xf35d('0x2f')]]['billableseconds'];}if(_0x5f29c0[_0xf35d('0x36')]===_0xf35d('0x37')){if(this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')]['split']('-')[0x0]]){this['agents'][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]=_[_0xf35d('0x94')](this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]],[_0xf35d('0x49')]);logger['debug'](_0xf35d('0x95'),_0x5f29c0[_0xf35d('0x2f')],util[_0xf35d('0x2a')]({'id':this[_0xf35d('0x15')][_0x5f29c0['channel'][_0xf35d('0x58')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0xf35d('0x2e')](util[_0xf35d('0x3b')]('user:%s',this['agents'][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]][_0xf35d('0x3d')]),_0xf35d('0x96'),{'id':this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]['id'],'destaccountcode':this[_0xf35d('0x15')][_0x5f29c0[_0xf35d('0x38')][_0xf35d('0x58')]('-')[0x0]]['accountcode']});for(var _0x4571a3=0x0;_0x4571a3{delete this['channels'][_0x2846cb];},_0x1fa830);}};module[_0xf35d('0xc9')]=VoiceCallReport; \ No newline at end of file +var _0xa28b=['isNotNull','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','debug','inspect','isUndefined','merge','pick','keys','context','channel','split','exten','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:%s','name','user:agentconnect','accountcode','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','linkedid','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','from-sip','undefined','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','disposition','includes','lastapplication','lastdata','startsWith','cdr(','match','type','syncNewState','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','connectedlinename','destinationchannel','UserId','membername','diff','calleridnum','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','replace','find','monitors','push','rec','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','xmd-destination','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','length','transferType','resolve','transferToInternal','isEmpty','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch','then','finally','webbar:stopmonitors','event','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transferconnectedlinenum','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','transfertargetcalleridnum','origtransfereruniqueid','some','origtransfererlinkedid','routeid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','transfercalleridnum','BLIND','syncHangup','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','isNil','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','moment','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','set','queue','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','redis','localhost','socket.io-emitter','channels','agents','blindTransfers','coreshowchannel','syncNewExten','bind','syncNewChannel','hangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','prototype','emit'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xa28b,0x160));var _0xba28=function(_0x414e8b,_0x58fdd1){_0x414e8b=_0x414e8b-0x0;var _0x37d1d4=_0xa28b[_0x414e8b];return _0x37d1d4;};'use strict';var _=require('lodash');var moment=require(_0xba28('0x0'));var util=require('util');var path=require(_0xba28('0x1'));var Redis=require(_0xba28('0x2'));var config=require(_0xba28('0x3'));var logger=require(_0xba28('0x4'))(_0xba28('0x5'));var ami=require(_0xba28('0x6'));var Channel=require('../model/channel');var RpcSetting=require('../rpc/setting');var applications=[_0xba28('0x7'),_0xba28('0x8'),_0xba28('0x9'),_0xba28('0xa'),_0xba28('0xb'),_0xba28('0xc')];var dispositions=[_0xba28('0xd'),_0xba28('0xe'),_0xba28('0xe'),_0xba28('0xd'),_0xba28('0xd'),_0xba28('0xd'),_0xba28('0xf'),_0xba28('0x10'),_0xba28('0xe'),_0xba28('0xe'),_0xba28('0xe')];config['redis']=_[_0xba28('0x11')](config[_0xba28('0x12')],{'host':_0xba28('0x13'),'port':0x18eb});var io=require(_0xba28('0x14'))(new Redis(config[_0xba28('0x12')]));function VoiceCallReport(_0x307a39){this[_0xba28('0x15')]=_0x307a39[_0xba28('0x15')];this['agents']=_0x307a39[_0xba28('0x16')];this[_0xba28('0x17')]={};ami['on'](_0xba28('0x18'),this[_0xba28('0x19')][_0xba28('0x1a')](this));ami['on']('newexten',this['syncNewExten'][_0xba28('0x1a')](this));ami['on']('newchannel',this[_0xba28('0x1b')][_0xba28('0x1a')](this));ami['on']('newstate',this['syncNewState'][_0xba28('0x1a')](this));ami['on']('varset',this['syncVarSet'][_0xba28('0x1a')](this));ami['on'](_0xba28('0x1c'),this['syncHangup'][_0xba28('0x1a')](this));ami['on']('newcallerid',this[_0xba28('0x1d')]['bind'](this));ami['on'](_0xba28('0x1e'),this[_0xba28('0x1f')]['bind'](this));ami['on'](_0xba28('0x20'),this[_0xba28('0x21')]['bind'](this));ami['on']('musiconholdstart',this[_0xba28('0x22')][_0xba28('0x1a')](this));ami['on'](_0xba28('0x23'),this[_0xba28('0x24')]['bind'](this));try{logger[_0xba28('0x25')]('[voiceCallReport][coreshowchannels]\x20started');ami[_0xba28('0x26')]();}catch(_0x493b37){logger['error'](_0xba28('0x27'),util['inspect'](_0x493b37,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype']['isNotNull']=function(_0x50633d){return _0x50633d!==null&&!_['isUndefined'](_0x50633d);};VoiceCallReport[_0xba28('0x28')]['emit']=function(_0x44192d,_0xc511fc,_0xf34c58){io['to'](_0x44192d)[_0xba28('0x29')](_0xc511fc,_0xf34c58);};VoiceCallReport['prototype'][_0xba28('0x1d')]=function(_0x29b7b8){try{if(this[_0xba28('0x2a')](_0x29b7b8)){logger['info'](_0xba28('0x2b'),_0x29b7b8[_0xba28('0x2c')],_0x29b7b8[_0xba28('0x2d')],_0x29b7b8['calleridnum']);logger[_0xba28('0x2e')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x29b7b8['uniqueid'],util[_0xba28('0x2f')](_0x29b7b8,{'showHidden':![],'depth':null}));if(_0x29b7b8[_0xba28('0x2c')]===_0x29b7b8['linkedid']){if(!_[_0xba28('0x30')](this[_0xba28('0x15')][_0x29b7b8[_0xba28('0x2c')]])){_[_0xba28('0x31')](this[_0xba28('0x15')][_0x29b7b8[_0xba28('0x2c')]],_[_0xba28('0x32')](_0x29b7b8,_[_0xba28('0x33')](this[_0xba28('0x15')][_0x29b7b8[_0xba28('0x2c')]])));}}if(_0x29b7b8[_0xba28('0x34')]==='from-sip'){var _0x44faf7=this['agents'][_0x29b7b8[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]];if(_0x44faf7){if(_0x29b7b8[_0xba28('0x37')]==_0xba28('0x38')){_0x44faf7[_0xba28('0x39')]=_0x29b7b8[_0xba28('0x3a')];this[_0xba28('0x29')](util['format'](_0xba28('0x3b'),_0x44faf7[_0xba28('0x3c')]),_0xba28('0x3d'),{'id':_0x44faf7['id'],'destaccountcode':_0x44faf7[_0xba28('0x3e')],'destconnectedlinenum':_0x29b7b8['connectedlinenum']});}}}}}catch(_0x492fd3){logger[_0xba28('0x3f')](_0xba28('0x40'),_0x29b7b8[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x492fd3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x1b')]=function(_0x3a46c5){try{if(this['isNotNull'](_0x3a46c5)){logger['debug'](_0xba28('0x41'),_0x3a46c5[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x3a46c5,{'showHidden':![],'depth':null}));if(this['channels'][_0x3a46c5[_0xba28('0x2c')]]){return;}if(_0x3a46c5['channel']===_0xba28('0x42')){return;}if(_0x3a46c5['uniqueid']!==_0x3a46c5[_0xba28('0x43')]&&!this[_0xba28('0x17')][_0x3a46c5[_0xba28('0x43')]]){return;}logger['info']('[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s',_0x3a46c5[_0xba28('0x2c')],_0x3a46c5['context'],_0x3a46c5[_0xba28('0x37')]);this[_0xba28('0x15')][_0x3a46c5[_0xba28('0x2c')]]=new Channel();this['channels'][_0x3a46c5[_0xba28('0x2c')]][_0xba28('0x44')]=moment()[_0xba28('0x45')](_0xba28('0x46'));this['channels'][_0x3a46c5[_0xba28('0x2c')]]['disposition']=dispositions[_[_0xba28('0x47')](_0x3a46c5[_0xba28('0x48')])];_['merge'](this[_0xba28('0x15')][_0x3a46c5[_0xba28('0x2c')]],_['pick'](_0x3a46c5,_[_0xba28('0x33')](this[_0xba28('0x15')][_0x3a46c5[_0xba28('0x2c')]])));if(_0x3a46c5[_0xba28('0x34')]===_0xba28('0x49')){var _0x4662c8=this[_0xba28('0x16')][_0x3a46c5[_0xba28('0x35')]['split']('-')[0x0]];if(_0x4662c8&&typeof _0x4662c8[_0xba28('0x39')]===_0xba28('0x4a')){_0x4662c8[_0xba28('0x39')]=_0x3a46c5[_0xba28('0x37')];logger[_0xba28('0x2e')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x3a46c5[_0xba28('0x2c')],util[_0xba28('0x2f')]({'id':_0x4662c8['id'],'destaccountcode':_0x4662c8[_0xba28('0x3e')],'destconnectedlinenum':_0x3a46c5['exten']},{'showHidden':![],'depth':null}));this[_0xba28('0x29')](util[_0xba28('0x45')](_0xba28('0x3b'),_0x4662c8[_0xba28('0x3c')]),_0xba28('0x3d'),{'id':_0x4662c8['id'],'destaccountcode':_0x4662c8[_0xba28('0x3e')],'destconnectedlinenum':_0x3a46c5[_0xba28('0x37')]});}}}}catch(_0x1b28db){logger[_0xba28('0x3f')]('[%s][voiceCallReport][newchannel]',_0x3a46c5[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x1b28db,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')]['syncNewExten']=function(_0x3340e4){try{if(this['isNotNull'](_0x3340e4)){logger[_0xba28('0x2e')](_0xba28('0x4b'),_0x3340e4[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x3340e4,{'showHidden':![],'depth':null}));if(_0x3340e4[_0xba28('0x35')]===_0xba28('0x42')||_0x3340e4[_0xba28('0x37')]==='h')return;if(_0x3340e4[_0xba28('0x2c')]===_0x3340e4[_0xba28('0x43')]||this[_0xba28('0x17')][_0x3340e4[_0xba28('0x43')]]){_0x3340e4['application']=_0x3340e4['application']?_0x3340e4[_0xba28('0x4c')][_0xba28('0x4d')]():undefined;_0x3340e4[_0xba28('0x4e')]=_0x3340e4['appdata']||_0x3340e4[_0xba28('0x4e')];if(_0x3340e4[_0xba28('0x4f')]&&_0x3340e4[_0xba28('0x4c')]!==_0xba28('0x8')){_0x3340e4[_0xba28('0x4e')]=_0x3340e4[_0xba28('0x4e')][_0xba28('0x4d')]();}logger[_0xba28('0x25')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x3340e4['uniqueid'],_0x3340e4[_0xba28('0x4c')],_0x3340e4[_0xba28('0x4e')]);if(_['isUndefined'](this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]])){this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]]=new Channel();this[_0xba28('0x15')][_0x3340e4['uniqueid']][_0xba28('0x44')]=_0x3340e4[_0xba28('0x50')]?moment()[_0xba28('0x51')](moment[_0xba28('0x50')](_0x3340e4[_0xba28('0x50')])[_0xba28('0x52')](),'seconds')[_0xba28('0x45')](_0xba28('0x46')):moment()[_0xba28('0x45')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x53')]='NO\x20ANSWER';}_[_0xba28('0x31')](this[_0xba28('0x15')][_0x3340e4['uniqueid']],_[_0xba28('0x32')](_0x3340e4,_[_0xba28('0x33')](this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]])));if(_[_0xba28('0x54')](applications,_0x3340e4[_0xba28('0x4c')])){this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x55')]=_0x3340e4[_0xba28('0x4c')];this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x56')]=_0x3340e4[_0xba28('0x4e')];if(_0x3340e4[_0xba28('0x4c')]===_0xba28('0x7')&&_[_0xba28('0x57')](_0x3340e4[_0xba28('0x4e')][_0xba28('0x4d')](),_0xba28('0x58'))){var _0x3fdc7d=_0x3340e4['applicationdata'][_0xba28('0x36')]('=');var _0x418bb6=_0x3fdc7d[0x0][_0xba28('0x4d')]()[_0xba28('0x59')](/cdr\((.*)\)/);if(_0x418bb6){if(_0x418bb6[0x1]===_0xba28('0x5a')&&!_['isNil'](this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0x418bb6[0x1]]))return;this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0x418bb6[0x1]]=_0x3fdc7d[0x1];}}else if(_0x3340e4[_0xba28('0x4c')]===_0xba28('0x8')){this[_0xba28('0x15')][_0x3340e4[_0xba28('0x2c')]][_0xba28('0x8')]=_0x3340e4[_0xba28('0x4e')][_0xba28('0x36')](',')[0x0];}}}}}catch(_0x4c3ffc){logger[_0xba28('0x3f')]('[%s][voiceCallReport][newexten]',_0x3340e4[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x4c3ffc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x5b')]=function(_0x1a7c31){try{if(this[_0xba28('0x2a')](_0x1a7c31)){logger[_0xba28('0x25')](_0xba28('0x5c'),_0x1a7c31['uniqueid'],_0x1a7c31['linkedid'],_0x1a7c31[_0xba28('0x2d')],_0x1a7c31['calleridnum']);logger[_0xba28('0x2e')](_0xba28('0x5d'),_0x1a7c31['uniqueid'],util['inspect'](_0x1a7c31,{'showHidden':![],'depth':null}));if(_0x1a7c31['channelstate']!=='6')return;var _0x3acf24=this[_0xba28('0x16')][_0x1a7c31['channel'][_0xba28('0x36')]('-')[0x0]];if(_0x1a7c31['uniqueid']!==_0x1a7c31[_0xba28('0x43')]){var _0x3db949=moment();if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]]){if(!this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x5e')]){this[_0xba28('0x15')][_0x1a7c31['linkedid']]['answered']=!![];this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x5f')]=_0x3db949[_0xba28('0x45')](_0xba28('0x46'));if(this['channels'][_0x1a7c31['linkedid']][_0xba28('0x44')]){this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x60')]=_0x3db949['diff'](this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x44')],_0xba28('0x52'));}}this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x43')]=_0x1a7c31[_0xba28('0x2c')];if(_0x1a7c31['calleridnum']!==_0xba28('0x38')){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x3a')]=_0x1a7c31['calleridnum'];}this[_0xba28('0x15')][_0x1a7c31['linkedid']][_0xba28('0x61')]=_0x1a7c31['calleridname'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x62')]=_0x1a7c31[_0xba28('0x35')];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]]['disposition']=dispositions[_[_0xba28('0x47')](_0x1a7c31[_0xba28('0x48')])];if(_0x3acf24){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x63')]=_0x3acf24['id'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x64')]=_0x3acf24['name'];}}if(this['channels'][_0x1a7c31['uniqueid']]){if(!this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x5e')]){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x5e')]=!![];this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x5f')]=_0x3db949[_0xba28('0x45')](_0xba28('0x46'));if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x44')]){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x60')]=_0x3db949[_0xba28('0x65')](this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x44')],_0xba28('0x52'));}}if(_0x1a7c31[_0xba28('0x66')]!==_0xba28('0x38')){this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x3a')]=_0x1a7c31[_0xba28('0x66')];}this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]['connectedlinename']=_0x1a7c31['calleridname'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x62')]=_0x1a7c31['channel'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]['disposition']=dispositions[_[_0xba28('0x47')](_0x1a7c31['channelstate'])];}}else{if(this[_0xba28('0x15')][_0x1a7c31['uniqueid']]){if(_0x3acf24){this[_0xba28('0x15')][_0x1a7c31['uniqueid']][_0xba28('0x63')]=_0x3acf24['id'];this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]][_0xba28('0x64')]=_0x3acf24[_0xba28('0x3c')];}}}if(_0x1a7c31[_0xba28('0x34')]===_0xba28('0x49')){if(_0x3acf24){_0x3acf24[_0xba28('0x39')]=_0x1a7c31['exten'];var _0x166c4a;if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]){_0x166c4a=this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x2c')]]['queue'];}else if(this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]]){_0x166c4a=this[_0xba28('0x15')][_0x1a7c31[_0xba28('0x43')]][_0xba28('0x8')];}_0x3acf24[_0xba28('0x8')]=_0x166c4a;var _0x11d99b={'id':_0x3acf24['id'],'name':_0x3acf24[_0xba28('0x3c')],'agentconnected':!![],'destaccountcode':_0x3acf24[_0xba28('0x3e')],'destconnectedlinenum':_0x1a7c31['exten'],'queue':_0x166c4a||undefined,'uniqueid':_0x1a7c31[_0xba28('0x43')]};logger[_0xba28('0x2e')](_0xba28('0x67'),_0x1a7c31[_0xba28('0x2c')],util['inspect'](_0x11d99b,{'showHidden':![],'depth':null}));this[_0xba28('0x29')](util['format'](_0xba28('0x3b'),_0x3acf24[_0xba28('0x3c')]),_0xba28('0x3d'),_0x11d99b);}}}}catch(_0x12e032){logger[_0xba28('0x3f')]('[%s][voiceCallReport][newstate]',_0x1a7c31[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x12e032,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x68')]=function(_0x13b860,_0xb718cb){try{if(this[_0xba28('0x15')][_0x13b860]){logger['info'](_0xba28('0x69'),_0x13b860,_0xb718cb);this[_0xba28('0x15')][_0x13b860][_0xba28('0x6a')]=!![];if(_[_0xba28('0x6b')](_0xb718cb,_0xba28('0x6c'))){_0xb718cb=_0xb718cb[_0xba28('0x6d')](_0xba28('0x6c'),'.WAV');}this[_0xba28('0x15')][_0x13b860]['monitorFilename']=_0xb718cb;var _0x27dd91=_[_0xba28('0x6e')](this[_0xba28('0x15')][_0x13b860][_0xba28('0x6f')],{'filename':_0xb718cb});if(_['isNil'](_0x27dd91)){this[_0xba28('0x15')][_0x13b860][_0xba28('0x6f')][_0xba28('0x70')]({'filename':_0xb718cb,'createdAt':moment()[_0xba28('0x45')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':_0xba28('0x71')});}}}catch(_0x462db2){logger[_0xba28('0x3f')](_0xba28('0x72'),_0x13b860,util[_0xba28('0x2f')](_0x462db2,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')][_0xba28('0x73')]=function(_0x12cc0f){try{if(this['isNotNull'](_0x12cc0f)){logger[_0xba28('0x2e')](_0xba28('0x74'),_0x12cc0f[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x12cc0f,{'showHidden':![],'depth':null}));if(this['channels'][_0x12cc0f[_0xba28('0x2c')]]&&_0x12cc0f[_0xba28('0x35')]!=_0xba28('0x42')){if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')])){if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')][_0xba28('0x76')])){logger[_0xba28('0x25')](_0xba28('0x77'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x68')](_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);}else if(this[_0xba28('0x2a')](_0x12cc0f['variable'][_0xba28('0x79')])){logger['info'](_0xba28('0x7a'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x66')]=_0x12cc0f[_0xba28('0x78')];}else if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')]['xmd-callerid'])){logger[_0xba28('0x25')](_0xba28('0x7b'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this['channels'][_0x12cc0f['uniqueid']][_0xba28('0x7c')]=_0x12cc0f[_0xba28('0x78')];}else if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')]['xmd-cdrtype'])){logger[_0xba28('0x25')]('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x12cc0f['uniqueid'],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x5a')]=_0x12cc0f[_0xba28('0x78')];}else if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')]['xmd-queue'])){logger[_0xba28('0x25')](_0xba28('0x7d'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')][_0xba28('0x36')](',')[0x0]);this['channels'][_0x12cc0f['uniqueid']][_0xba28('0x8')]=_0x12cc0f[_0xba28('0x78')][_0xba28('0x36')](',')[0x0];}else if(this['isNotNull'](_0x12cc0f['variable'][_0xba28('0x7e')])){logger[_0xba28('0x25')](_0xba28('0x7f'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x80')]=_0x12cc0f[_0xba28('0x78')];}else if(this[_0xba28('0x2a')](_0x12cc0f['variable'][_0xba28('0x81')])){logger[_0xba28('0x25')](_0xba28('0x82'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x83')]=_0x12cc0f['value'];}else if(this[_0xba28('0x2a')](_0x12cc0f['variable']['xmd-callerid-preview'])){logger['info'](_0xba28('0x84'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x85')]=_0x12cc0f[_0xba28('0x78')];}else if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')][_0xba28('0x86')])){logger[_0xba28('0x25')](_0xba28('0x87'),_0x12cc0f['uniqueid'],_0x12cc0f['value']);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x2c')]][_0xba28('0x8')]=_0x12cc0f['value'];}else if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')][_0xba28('0x88')])){logger[_0xba28('0x25')](_0xba28('0x89'),_0x12cc0f[_0xba28('0x2c')],_0x12cc0f[_0xba28('0x78')]);this['channels'][_0x12cc0f[_0xba28('0x2c')]]['sipcalluniqueid']=_0x12cc0f['value'];}}}else if(this[_0xba28('0x2a')](_0x12cc0f[_0xba28('0x75')][_0xba28('0x76')])){if(_0x12cc0f[_0xba28('0x78')]){var _0x4840f1=path['parse'](_0x12cc0f['value'])['name'];logger[_0xba28('0x25')](_0xba28('0x77'),_0x4840f1,_0x12cc0f['value']);this[_0xba28('0x68')](_0x4840f1,_0x12cc0f[_0xba28('0x78')]);}}else if(this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x43')]]){if(this[_0xba28('0x2a')](_0x12cc0f['variable'])){if(this['isNotNull'](_0x12cc0f[_0xba28('0x75')][_0xba28('0x88')])){logger[_0xba28('0x25')](_0xba28('0x89'),_0x12cc0f[_0xba28('0x43')],_0x12cc0f[_0xba28('0x78')]);this[_0xba28('0x15')][_0x12cc0f[_0xba28('0x43')]]['sipcalllinkedid']=_0x12cc0f[_0xba28('0x78')];}}}}}catch(_0x3108a8){logger['error']('[%s][voiceCallReport][varset]',_0x12cc0f[_0xba28('0x2c')],util[_0xba28('0x2f')](_0x3108a8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xba28('0x28')]['syncHangup']=function(_0x5ae717){try{if(this[_0xba28('0x2a')](_0x5ae717)){logger['debug'](_0xba28('0x8a'),_0x5ae717['uniqueid'],util[_0xba28('0x2f')](_0x5ae717,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x5ae717['linkedid']]){if(this[_0xba28('0x15')][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['linkedid']]){this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]]['uniqueid']=_0x5ae717[_0xba28('0x2c')];this['channels'][this[_0xba28('0x17')][_0x5ae717['linkedid']][_0xba28('0x43')]][_0xba28('0x5e')]=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x5e')];this['channels'][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['linkedid']][_0xba28('0x5f')]=this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x5f')];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717['linkedid']][_0xba28('0x43')]][_0xba28('0x62')]=this[_0xba28('0x15')][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]][_0xba28('0x35')];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]][_0xba28('0x53')]=this['channels'][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x53')];this[_0xba28('0x15')][_0x5ae717['uniqueid']]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x43')]];this['deleteChannelAfterTimeout'](this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['linkedid']);}else if(this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]]){this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x2c')]=[this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]]['uniqueid']]['linkedid'],this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x43')]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]]['uniqueid']][_0xba28('0x2c')]][0x0];this[_0xba28('0x15')][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]]['uniqueid']]['answered']=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]['answered'];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x5f')]=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x5f')];this['channels'][this['blindTransfers'][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x62')]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]][_0xba28('0x35')];this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]]['uniqueid']][_0xba28('0x53')]=this['channels'][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x53')];this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]=this[_0xba28('0x15')][this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]];this[_0xba28('0x8b')](this[_0xba28('0x17')][_0x5ae717[_0xba28('0x43')]][_0xba28('0x2c')]);}}if(this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]){logger[_0xba28('0x25')](_0xba28('0x8c'),_0x5ae717[_0xba28('0x2c')],_0x5ae717[_0xba28('0x8d')]);var _0x1ea0b4=moment();this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]['endtime']=_0x1ea0b4['format'](_0xba28('0x46'));this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x50')]=_0x1ea0b4[_0xba28('0x65')](this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x44')],_0xba28('0x52'));if(this['channels'][_0x5ae717['uniqueid']]['answered']){this['channels'][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x8e')]=_0x1ea0b4[_0xba28('0x65')](this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x5f')],_0xba28('0x52'));this[_0xba28('0x15')][_0x5ae717['uniqueid']][_0xba28('0x60')]=this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]]['duration']-this[_0xba28('0x15')][_0x5ae717[_0xba28('0x2c')]][_0xba28('0x8e')];}if(_0x5ae717[_0xba28('0x34')]==='from-sip'){if(this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]]){this['agents'][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]]=_[_0xba28('0x8f')](this[_0xba28('0x16')][_0x5ae717['channel'][_0xba28('0x36')]('-')[0x0]],['destconnectedlinenum']);logger[_0xba28('0x2e')](_0xba28('0x90'),_0x5ae717[_0xba28('0x2c')],util['inspect']({'id':this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')]['split']('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x5ae717['channel'][_0xba28('0x36')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this['emit'](util[_0xba28('0x45')](_0xba28('0x3b'),this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]][_0xba28('0x3c')]),'user:agentcomplete',{'id':this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0xba28('0x16')][_0x5ae717[_0xba28('0x35')][_0xba28('0x36')]('-')[0x0]][_0xba28('0x3e')]});for(var _0x500322=0x0;_0x500322{delete this[_0xba28('0x15')][_0x264e8a];},_0x29935d);}};module[_0xba28('0xc4')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index b6b847b..8a3dae4 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3565=['syncDialBegin','bind','syncDialEnd','varset','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','format','called','channel','substring','lastIndexOf','omit','event','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','debug','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','applications','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','syncVarSet','[%s][voiceDialReport][varset]\x20event:','keys','value','variable','outboundrouteid','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberpenalty','memberrealtime','isNil','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','diff','starttime','complete','total','answered','holdtime','answertime','seconds','billableseconds','sumHoldTime','sumBillable','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','toLowerCase','set','appdata','startsWith','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','match','[%s][voiceDialReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','localhost','socket.io-emitter','channels','outbound','variables','dialbegin'];(function(_0x504416,_0x15e991){var _0x18322a=function(_0x2a7d34){while(--_0x2a7d34){_0x504416['push'](_0x504416['shift']());}};_0x18322a(++_0x15e991);}(_0x3565,0x158));var _0x5356=function(_0x375bcf,_0x3aadd5){_0x375bcf=_0x375bcf-0x0;var _0x36a753=_0x3565[_0x375bcf];return _0x36a753;};'use strict';var _=require('lodash');var moment=require(_0x5356('0x0'));var util=require(_0x5356('0x1'));var Redis=require(_0x5356('0x2'));var config=require(_0x5356('0x3'));var logger=require(_0x5356('0x4'))('ami');var ami=require(_0x5356('0x5'));config[_0x5356('0x6')]=_['defaults'](config[_0x5356('0x6')],{'host':_0x5356('0x7'),'port':0x18eb});var io=require(_0x5356('0x8'))(new Redis(config[_0x5356('0x6')]));function VoiceDialReport(_0x1355bc){this[_0x5356('0x9')]=_0x1355bc['outboundChannels'];this[_0x5356('0xa')]=_0x1355bc['outbound'];this['applications']={};this[_0x5356('0xb')]={};ami['on'](_0x5356('0xc'),this[_0x5356('0xd')][_0x5356('0xe')](this));ami['on']('dialend',this[_0x5356('0xf')][_0x5356('0xe')](this));ami['on'](_0x5356('0x10'),this['syncVarSet'][_0x5356('0xe')](this));ami['on'](_0x5356('0x11'),this[_0x5356('0x12')][_0x5356('0xe')](this));}VoiceDialReport[_0x5356('0x13')][_0x5356('0x14')]=function(_0xa5c9be){return _0xa5c9be!==null&&!_[_0x5356('0x15')](_0xa5c9be);};VoiceDialReport[_0x5356('0x13')][_0x5356('0x16')]=function(_0x3552ae,_0x14bf20,_0xae83f9){io['to'](_0x3552ae)[_0x5356('0x16')](_0x14bf20,_0xae83f9);};VoiceDialReport[_0x5356('0x13')][_0x5356('0xd')]=function(_0x561c0b){try{if(this[_0x5356('0x14')](_0x561c0b)){logger['debug']('[%s][voiceDialReport][dialbegin]\x20event:',_0x561c0b['uniqueid'],util['inspect'](_0x561c0b,{'showHidden':![],'depth':null}));if(this['channels'][_0x561c0b[_0x5356('0x17')]]){_['merge'](this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]],{'starttime':moment()[_0x5356('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x5356('0x19'),'interface':_0x561c0b[_0x5356('0x1a')][_0x5356('0x1b')](0x0,_0x561c0b[_0x5356('0x1a')][_0x5356('0x1c')]('-')),'membername':_0x561c0b[_0x5356('0x1a')][_0x5356('0x1b')](_0x561c0b[_0x5356('0x1a')][_0x5356('0x1c')]('/')+0x1,_0x561c0b[_0x5356('0x1a')][_0x5356('0x1c')]('-'))},_[_0x5356('0x1d')](_0x561c0b,[_0x5356('0x1e'),'privilege']));logger[_0x5356('0x1f')](_0x5356('0x20'),_0x561c0b[_0x5356('0x17')],this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]][_0x5356('0x21')],this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]][_0x5356('0x22')]);logger[_0x5356('0x23')](_0x5356('0x24'),_0x561c0b[_0x5356('0x17')],util[_0x5356('0x25')](this['channels'][_0x561c0b[_0x5356('0x17')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x561c0b[_0x5356('0x17')]])_['merge'](this['channels'][_0x561c0b['uniqueid']],this[_0x5356('0x26')][_0x561c0b[_0x5356('0x17')]]);this['emit'](_0x5356('0x27'),_0x5356('0x28'),this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]]);logger[_0x5356('0x23')](_0x5356('0x29'),_0x561c0b[_0x5356('0x17')],util[_0x5356('0x25')](this[_0x5356('0x9')][_0x561c0b[_0x5356('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5356('0x16')](_0x5356('0x2a'),this['channels'][_0x561c0b['uniqueid']]);}}}catch(_0x267db6){logger[_0x5356('0x2b')](_0x5356('0x2c'),_0x561c0b[_0x5356('0x17')],util['inspect'](_0x267db6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')]['syncDialEnd']=function(_0x18210f){try{if(this[_0x5356('0x14')](_0x18210f)){logger[_0x5356('0x23')](_0x5356('0x2d'),_0x18210f[_0x5356('0x17')],util['inspect'](_0x18210f,{'showHidden':![],'depth':null}));if(this[_0x5356('0x9')][_0x18210f['uniqueid']]){this['channels'][_0x18210f[_0x5356('0x17')]][_0x5356('0x2e')]=_0x18210f[_0x5356('0x2e')];if(_0x18210f['dialstatus']===_0x5356('0x2f')){this[_0x5356('0x9')][_0x18210f[_0x5356('0x17')]][_0x5356('0x30')]=_0x18210f[_0x5356('0x30')];this[_0x5356('0x9')][_0x18210f[_0x5356('0x17')]][_0x5356('0x31')]=_0x18210f[_0x5356('0x31')];this['channels'][_0x18210f[_0x5356('0x17')]]['answertime']=moment()['format'](_0x5356('0x32'));this[_0x5356('0x9')][_0x18210f['uniqueid']][_0x5356('0x33')]=_0x5356('0x34');logger[_0x5356('0x1f')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0x18210f[_0x5356('0x17')],_0x18210f[_0x5356('0x1a')][_0x5356('0x1b')](_0x18210f[_0x5356('0x1a')][_0x5356('0x1c')]('/')+0x1,_0x18210f[_0x5356('0x1a')][_0x5356('0x1c')]('-')));logger[_0x5356('0x23')]('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0x18210f[_0x5356('0x17')],util[_0x5356('0x25')](this['channels'][_0x18210f['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0x5356('0x35'),this[_0x5356('0x9')][_0x18210f['uniqueid']]);}logger[_0x5356('0x23')](_0x5356('0x36'),_0x18210f[_0x5356('0x17')],util['inspect'](this[_0x5356('0x9')][_0x18210f['uniqueid']],{'showHidden':![],'depth':null}));this[_0x5356('0x16')](_0x5356('0x27'),'voice_outbound_channel:save',this[_0x5356('0x9')][_0x18210f[_0x5356('0x17')]]);}}}catch(_0xf57505){logger['error'](_0x5356('0x37'),_0x18210f[_0x5356('0x17')],util[_0x5356('0x25')](_0xf57505,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')][_0x5356('0x38')]=function(_0x34655d){try{if(this[_0x5356('0x14')](_0x34655d)){logger[_0x5356('0x23')](_0x5356('0x39'),_0x34655d[_0x5356('0x17')],util[_0x5356('0x25')](_0x34655d,{'showHidden':![],'depth':null}));this['addVariable'](_0x34655d[_0x5356('0x17')],_[_0x5356('0x3a')](_0x34655d['variable'])[0x0],_0x34655d[_0x5356('0x3b')]);if(this[_0x5356('0x14')](_0x34655d[_0x5356('0x3c')])&&this[_0x5356('0x14')](_0x34655d[_0x5356('0x3c')][_0x5356('0x3d')])){if(_['isUndefined'](this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]])){this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]]={'routeId':_0x34655d['value'],'variables':this['variables'][_0x34655d[_0x5356('0x17')]],'motionChannel':'voice'};logger[_0x5356('0x1f')](_0x5356('0x3e'),_0x34655d[_0x5356('0x17')],_0x34655d[_0x5356('0x3c')][_0x5356('0x3d')],_['keys'](_0x34655d[_0x5356('0x3c')])[0x0],_0x34655d[_0x5356('0x3b')]);logger['debug'](_0x5356('0x3f'),_0x34655d[_0x5356('0x17')],util['inspect'](this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]],{'showHidden':![],'depth':null}));this[_0x5356('0x16')](_0x5356('0x27'),_0x5356('0x28'),this[_0x5356('0x9')][_0x34655d[_0x5356('0x17')]]);}}}}catch(_0x34f1e0){logger[_0x5356('0x2b')](_0x5356('0x40'),_0x34655d['uniqueid'],util[_0x5356('0x25')](_0x34f1e0,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x5356('0x41')]=function(_0x1d9c67,_0x2b5496,_0x7cce19){var _0x2070d0=[_0x5356('0x42'),'rtpaudioqosbridged',_0x5356('0x43'),'rtpaudioqosjitterbridged',_0x5356('0x44'),'rtpaudioqoslossbridged',_0x5356('0x45'),_0x5356('0x46'),_0x5356('0x47'),_0x5356('0x48'),_0x5356('0x49'),_0x5356('0x4a'),_0x5356('0x4b'),_0x5356('0x4c'),_0x5356('0x4d'),'memberlastcall',_0x5356('0x21'),_0x5356('0x4e'),_0x5356('0x4f')];if(!_[_0x5356('0x50')](_0x2b5496)&&!_[_0x5356('0x51')](_0x2070d0,_0x2b5496)){if(_['isUndefined'](this[_0x5356('0xb')][_0x1d9c67])){this[_0x5356('0xb')][_0x1d9c67]={};}this[_0x5356('0xb')][_0x1d9c67][_0x2b5496]=_0x7cce19;}};VoiceDialReport[_0x5356('0x13')]['syncHangup']=function(_0x704251){try{if(this[_0x5356('0x14')](_0x704251)){logger[_0x5356('0x23')](_0x5356('0x52'),_0x704251['uniqueid'],util[_0x5356('0x25')](_0x704251,{'showHidden':![],'depth':null}));if(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]){logger[_0x5356('0x1f')](_0x5356('0x53'),_0x704251[_0x5356('0x17')],_0x704251[_0x5356('0x54')]);this[_0x5356('0x9')][_0x704251['uniqueid']]['endtime']=moment()[_0x5356('0x18')](_0x5356('0x32'));this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]['duration']=moment(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x55')])[_0x5356('0x56')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x57')],'seconds');this['channels'][_0x704251['uniqueid']][_0x5356('0x33')]=_0x5356('0x58');this[_0x5356('0xa')][_0x5356('0x59')]+=0x1;if(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]['answertime']){this[_0x5356('0xa')][_0x5356('0x5a')]+=0x1;this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5b')]=moment(this[_0x5356('0x9')][_0x704251['uniqueid']][_0x5356('0x5c')])['diff'](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x57')],_0x5356('0x5d'));this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5e')]=moment(this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x55')])[_0x5356('0x56')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5c')],_0x5356('0x5d'));this[_0x5356('0xa')][_0x5356('0x5f')]+=this[_0x5356('0x9')][_0x704251['uniqueid']][_0x5356('0x5b')]||0x0;this[_0x5356('0xa')][_0x5356('0x60')]+=this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]][_0x5356('0x5e')];}this[_0x5356('0xa')][_0x5356('0x61')]+=this[_0x5356('0x9')][_0x704251['uniqueid']]['duration'];logger[_0x5356('0x23')](_0x5356('0x62'),_0x704251[_0x5356('0x17')],util[_0x5356('0x25')](this['channels'][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5356('0x16')](_0x5356('0x63'),this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]);logger[_0x5356('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x704251[_0x5356('0x17')],util['inspect'](this['channels'][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));ami[_0x5356('0x16')](_0x5356('0x64'),this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]);logger[_0x5356('0x23')](_0x5356('0x65'),_0x704251[_0x5356('0x17')],util[_0x5356('0x25')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x5356('0x27'),'voice_outbound:save',this['outbound']);logger[_0x5356('0x1f')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this['channels'][_0x704251['uniqueid']]));logger[_0x5356('0x23')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:',_0x704251[_0x5356('0x17')],util[_0x5356('0x25')](this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]],{'showHidden':![],'depth':null}));this['emit'](_0x5356('0x27'),_0x5356('0x66'),this[_0x5356('0x9')][_0x704251[_0x5356('0x17')]]);this[_0x5356('0x67')](_0x704251['uniqueid']);}else if(this[_0x5356('0x9')][_0x704251[_0x5356('0x68')]]){this[_0x5356('0x9')][_0x704251[_0x5356('0x68')]]['uniqueid']=this[_0x5356('0x9')][_0x704251[_0x5356('0x68')]]['destuniqueid'];}if(this['variables'][_0x704251[_0x5356('0x17')]]){delete this[_0x5356('0xb')][_0x704251['uniqueid']];}}}catch(_0x1ea659){logger['error'](_0x5356('0x69'),_0x704251['uniqueid'],util[_0x5356('0x25')](_0x1ea659,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')][_0x5356('0x6a')]=function(_0x623697){try{if(this[_0x5356('0x14')](_0x623697)){logger[_0x5356('0x23')](_0x5356('0x6b'),_0x623697[_0x5356('0x17')],util[_0x5356('0x25')](_0x623697,{'showHidden':![],'depth':null}));if(_0x623697['application'][_0x5356('0x6c')]()===_0x5356('0x6d')){_0x623697['applicationdata']=(_0x623697[_0x5356('0x6e')]||_0x623697['applicationdata'])[_0x5356('0x6c')]();if(_[_0x5356('0x6f')](_0x623697[_0x5356('0x70')],_0x5356('0x71'))){if(_[_0x5356('0x15')](this[_0x5356('0x26')][_0x623697[_0x5356('0x17')]]))this[_0x5356('0x26')][_0x623697[_0x5356('0x17')]]={};logger[_0x5356('0x1f')](_0x5356('0x72'),_0x623697[_0x5356('0x17')],_0x623697[_0x5356('0x73')],_0x623697['applicationdata']);var _0x436c23=_0x623697['applicationdata']['split']('=');var _0xefd25b=_0x436c23[0x0][_0x5356('0x74')](/cdr\((.*)\)/);if(_0xefd25b)this[_0x5356('0x26')][_0x623697[_0x5356('0x17')]][_0xefd25b[0x1]]=_0x436c23[0x1];}}}}catch(_0x413dd2){logger[_0x5356('0x2b')](_0x5356('0x75'),_0x623697[_0x5356('0x17')],util[_0x5356('0x25')](_0x413dd2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x5356('0x13')][_0x5356('0x67')]=function(_0x4e321c,_0x502776=0x2710){if(this[_0x5356('0x9')][_0x4e321c]){setTimeout(()=>{delete this[_0x5356('0x9')][_0x4e321c];},_0x502776);}};module[_0x5356('0x76')]=VoiceDialReport; \ No newline at end of file +var _0xbedd=['startsWith','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','application','split','match','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','applications','variables','bind','dialend','varset','syncVarSet','syncHangup','isUndefined','prototype','emit','syncDialBegin','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','[%s][voiceDialReport][dialbegin]','syncDialEnd','isNotNull','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','voice','outboundrouteid','voice:outbound','error','[%s][voiceDialReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberpenalty','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','lastevent','complete','total','answered','billableseconds','sumHoldTime','holdtime','sumBillable','sumDuration','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][newexten]\x20event:','applicationdata','toLowerCase'];(function(_0x3cb86b,_0x3c75f6){var _0x3c10a0=function(_0x71331f){while(--_0x71331f){_0x3cb86b['push'](_0x3cb86b['shift']());}};_0x3c10a0(++_0x3c75f6);}(_0xbedd,0xf3));var _0xdbed=function(_0x415470,_0x8c567){_0x415470=_0x415470-0x0;var _0x5618c8=_0xbedd[_0x415470];return _0x5618c8;};'use strict';var _=require(_0xdbed('0x0'));var moment=require('moment');var util=require(_0xdbed('0x1'));var Redis=require(_0xdbed('0x2'));var config=require(_0xdbed('0x3'));var logger=require(_0xdbed('0x4'))('ami');var ami=require('../ami');config[_0xdbed('0x5')]=_[_0xdbed('0x6')](config[_0xdbed('0x5')],{'host':_0xdbed('0x7'),'port':0x18eb});var io=require(_0xdbed('0x8'))(new Redis(config[_0xdbed('0x5')]));function VoiceDialReport(_0x26ef93){this[_0xdbed('0x9')]=_0x26ef93[_0xdbed('0xa')];this[_0xdbed('0xb')]=_0x26ef93[_0xdbed('0xb')];this[_0xdbed('0xc')]={};this[_0xdbed('0xd')]={};ami['on']('dialbegin',this['syncDialBegin'][_0xdbed('0xe')](this));ami['on'](_0xdbed('0xf'),this['syncDialEnd'][_0xdbed('0xe')](this));ami['on'](_0xdbed('0x10'),this[_0xdbed('0x11')]['bind'](this));ami['on']('hangup',this[_0xdbed('0x12')][_0xdbed('0xe')](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x2a45d3){return _0x2a45d3!==null&&!_[_0xdbed('0x13')](_0x2a45d3);};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x15')]=function(_0xa64a3b,_0x54bc95,_0x233207){io['to'](_0xa64a3b)[_0xdbed('0x15')](_0x54bc95,_0x233207);};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x16')]=function(_0x1a4ffc){try{if(this['isNotNull'](_0x1a4ffc)){logger[_0xdbed('0x17')](_0xdbed('0x18'),_0x1a4ffc[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x1a4ffc,{'showHidden':![],'depth':null}));if(this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]]){_[_0xdbed('0x1b')](this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]],{'starttime':moment()[_0xdbed('0x1c')](_0xdbed('0x1d')),'lastevent':_0xdbed('0x1e'),'interface':_0x1a4ffc[_0xdbed('0x1f')][_0xdbed('0x20')](0x0,_0x1a4ffc['channel'][_0xdbed('0x21')]('-')),'membername':_0x1a4ffc[_0xdbed('0x1f')][_0xdbed('0x20')](_0x1a4ffc[_0xdbed('0x1f')]['lastIndexOf']('/')+0x1,_0x1a4ffc[_0xdbed('0x1f')][_0xdbed('0x21')]('-'))},_[_0xdbed('0x22')](_0x1a4ffc,[_0xdbed('0x23'),_0xdbed('0x24')]));logger['info'](_0xdbed('0x25'),_0x1a4ffc['uniqueid'],this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]][_0xdbed('0x26')],this['channels'][_0x1a4ffc[_0xdbed('0x19')]][_0xdbed('0x27')]);logger[_0xdbed('0x17')](_0xdbed('0x28'),_0x1a4ffc[_0xdbed('0x19')],util['inspect'](this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));if(this['applications'][_0x1a4ffc[_0xdbed('0x19')]])_['merge'](this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]],this[_0xdbed('0xc')][_0x1a4ffc[_0xdbed('0x19')]]);this['emit']('voice:outbound',_0xdbed('0x29'),this[_0xdbed('0x9')][_0x1a4ffc[_0xdbed('0x19')]]);logger[_0xdbed('0x17')](_0xdbed('0x2a'),_0x1a4ffc[_0xdbed('0x19')],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x1a4ffc['uniqueid']],{'showHidden':![],'depth':null}));ami['emit'](_0xdbed('0x2b'),this['channels'][_0x1a4ffc[_0xdbed('0x19')]]);}}}catch(_0x4b9773){logger['error'](_0xdbed('0x2c'),_0x1a4ffc[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x4b9773,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x2d')]=function(_0x3db025){try{if(this[_0xdbed('0x2e')](_0x3db025)){logger[_0xdbed('0x17')]('[%s][voiceDialReport][dialend]\x20event:',_0x3db025[_0xdbed('0x19')],util['inspect'](_0x3db025,{'showHidden':![],'depth':null}));if(this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]]){this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x2f')]=_0x3db025[_0xdbed('0x2f')];if(_0x3db025['dialstatus']===_0xdbed('0x30')){this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x31')]=_0x3db025[_0xdbed('0x31')];this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x32')]=_0x3db025[_0xdbed('0x32')];this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]][_0xdbed('0x33')]=moment()[_0xdbed('0x1c')](_0xdbed('0x1d'));this[_0xdbed('0x9')][_0x3db025['uniqueid']]['lastevent']=_0xdbed('0x34');logger[_0xdbed('0x35')](_0xdbed('0x36'),_0x3db025['uniqueid'],_0x3db025[_0xdbed('0x1f')]['substring'](_0x3db025[_0xdbed('0x1f')][_0xdbed('0x21')]('/')+0x1,_0x3db025[_0xdbed('0x1f')][_0xdbed('0x21')]('-')));logger['debug'](_0xdbed('0x37'),_0x3db025['uniqueid'],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));ami[_0xdbed('0x15')](_0xdbed('0x38'),this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]]);}logger[_0xdbed('0x17')](_0xdbed('0x39'),_0x3db025[_0xdbed('0x19')],util['inspect'](this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this['emit']('voice:outbound',_0xdbed('0x29'),this[_0xdbed('0x9')][_0x3db025[_0xdbed('0x19')]]);}}}catch(_0x3775ce){logger['error']('[%s][voiceDialReport][dialend]',_0x3db025['uniqueid'],util[_0xdbed('0x1a')](_0x3775ce,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x11')]=function(_0x27991c){try{if(this[_0xdbed('0x2e')](_0x27991c)){logger['debug'](_0xdbed('0x3a'),_0x27991c[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x27991c,{'showHidden':![],'depth':null}));this[_0xdbed('0x3b')](_0x27991c['uniqueid'],_[_0xdbed('0x3c')](_0x27991c[_0xdbed('0x3d')])[0x0],_0x27991c[_0xdbed('0x3e')]);if(this[_0xdbed('0x2e')](_0x27991c[_0xdbed('0x3d')])&&this[_0xdbed('0x2e')](_0x27991c[_0xdbed('0x3d')]['outboundrouteid'])){if(_['isUndefined'](this['channels'][_0x27991c[_0xdbed('0x19')]])){this[_0xdbed('0x9')][_0x27991c[_0xdbed('0x19')]]={'routeId':_0x27991c[_0xdbed('0x3e')],'variables':this['variables'][_0x27991c[_0xdbed('0x19')]],'motionChannel':_0xdbed('0x3f')};logger[_0xdbed('0x35')]('[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s',_0x27991c['uniqueid'],_0x27991c[_0xdbed('0x3d')][_0xdbed('0x40')],_[_0xdbed('0x3c')](_0x27991c[_0xdbed('0x3d')])[0x0],_0x27991c[_0xdbed('0x3e')]);logger['debug']('[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:',_0x27991c[_0xdbed('0x19')],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x27991c[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this[_0xdbed('0x15')](_0xdbed('0x41'),_0xdbed('0x29'),this['channels'][_0x27991c[_0xdbed('0x19')]]);}}}}catch(_0x329efc){logger[_0xdbed('0x42')](_0xdbed('0x43'),_0x27991c[_0xdbed('0x19')],util['inspect'](_0x329efc,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x3b')]=function(_0x376c80,_0x1deafc,_0x572142){var _0x805235=[_0xdbed('0x44'),_0xdbed('0x45'),'rtpaudioqosjitter',_0xdbed('0x46'),_0xdbed('0x47'),_0xdbed('0x48'),_0xdbed('0x49'),_0xdbed('0x4a'),_0xdbed('0x4b'),_0xdbed('0x4c'),_0xdbed('0x4d'),_0xdbed('0x4e'),_0xdbed('0x4f'),'memberdynamic','memberinterface','memberlastcall',_0xdbed('0x26'),_0xdbed('0x50'),'memberrealtime'];if(!_['isNil'](_0x1deafc)&&!_['includes'](_0x805235,_0x1deafc)){if(_[_0xdbed('0x13')](this[_0xdbed('0xd')][_0x376c80])){this[_0xdbed('0xd')][_0x376c80]={};}this[_0xdbed('0xd')][_0x376c80][_0x1deafc]=_0x572142;}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x12')]=function(_0x46381b){try{if(this[_0xdbed('0x2e')](_0x46381b)){logger['debug'](_0xdbed('0x51'),_0x46381b[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x46381b,{'showHidden':![],'depth':null}));if(this['channels'][_0x46381b[_0xdbed('0x19')]]){logger[_0xdbed('0x35')](_0xdbed('0x52'),_0x46381b[_0xdbed('0x19')],_0x46381b[_0xdbed('0x53')]);this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x54')]=moment()[_0xdbed('0x1c')](_0xdbed('0x1d'));this['channels'][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x55')]=moment(this['channels'][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x54')])[_0xdbed('0x56')](this[_0xdbed('0x9')][_0x46381b['uniqueid']][_0xdbed('0x57')],_0xdbed('0x58'));this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x59')]=_0xdbed('0x5a');this['outbound'][_0xdbed('0x5b')]+=0x1;if(this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x33')]){this['outbound'][_0xdbed('0x5c')]+=0x1;this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]['holdtime']=moment(this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x33')])[_0xdbed('0x56')](this[_0xdbed('0x9')][_0x46381b['uniqueid']]['starttime'],_0xdbed('0x58'));this[_0xdbed('0x9')][_0x46381b['uniqueid']][_0xdbed('0x5d')]=moment(this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]['endtime'])[_0xdbed('0x56')](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x33')],_0xdbed('0x58'));this[_0xdbed('0xb')][_0xdbed('0x5e')]+=this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x5f')]||0x0;this[_0xdbed('0xb')][_0xdbed('0x60')]+=this['channels'][_0x46381b[_0xdbed('0x19')]][_0xdbed('0x5d')];}this['outbound'][_0xdbed('0x61')]+=this[_0xdbed('0x9')][_0x46381b['uniqueid']][_0xdbed('0x55')];logger['debug']('[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:',_0x46381b['uniqueid'],util['inspect'](this['channels'][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));ami[_0xdbed('0x15')](_0xdbed('0x62'),this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]);logger[_0xdbed('0x17')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x46381b[_0xdbed('0x19')],util['inspect'](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));ami['emit'](_0xdbed('0x63'),this['channels'][_0x46381b['uniqueid']]);logger['debug'](_0xdbed('0x64'),_0x46381b['uniqueid'],util['inspect'](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this[_0xdbed('0x15')](_0xdbed('0x41'),'voice_outbound:save',this[_0xdbed('0xb')]);logger[_0xdbed('0x35')](_0xdbed('0x65'),JSON[_0xdbed('0x66')](this[_0xdbed('0x9')][_0x46381b['uniqueid']]));logger[_0xdbed('0x17')](_0xdbed('0x67'),_0x46381b['uniqueid'],util[_0xdbed('0x1a')](this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]],{'showHidden':![],'depth':null}));this[_0xdbed('0x15')]('voice:outbound',_0xdbed('0x68'),this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x19')]]);this[_0xdbed('0x69')](_0x46381b[_0xdbed('0x19')]);}else if(this[_0xdbed('0x9')][_0x46381b['linkedid']]){this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x6a')]]['uniqueid']=this[_0xdbed('0x9')][_0x46381b[_0xdbed('0x6a')]][_0xdbed('0x6b')];}if(this[_0xdbed('0xd')][_0x46381b[_0xdbed('0x19')]]){delete this[_0xdbed('0xd')][_0x46381b['uniqueid']];}}}catch(_0x20344f){logger['error']('[%s][voiceDialReport][hangup]',_0x46381b[_0xdbed('0x19')],util['inspect'](_0x20344f,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncNewExten']=function(_0x28d1c2){try{if(this[_0xdbed('0x2e')](_0x28d1c2)){logger[_0xdbed('0x17')](_0xdbed('0x6c'),_0x28d1c2[_0xdbed('0x19')],util[_0xdbed('0x1a')](_0x28d1c2,{'showHidden':![],'depth':null}));if(_0x28d1c2['application']['toLowerCase']()==='set'){_0x28d1c2[_0xdbed('0x6d')]=(_0x28d1c2['appdata']||_0x28d1c2[_0xdbed('0x6d')])[_0xdbed('0x6e')]();if(_[_0xdbed('0x6f')](_0x28d1c2[_0xdbed('0x6d')],_0xdbed('0x70'))){if(_[_0xdbed('0x13')](this['applications'][_0x28d1c2[_0xdbed('0x19')]]))this[_0xdbed('0xc')][_0x28d1c2[_0xdbed('0x19')]]={};logger['info'](_0xdbed('0x71'),_0x28d1c2[_0xdbed('0x19')],_0x28d1c2[_0xdbed('0x72')],_0x28d1c2[_0xdbed('0x6d')]);var _0x12deec=_0x28d1c2[_0xdbed('0x6d')][_0xdbed('0x73')]('=');var _0x48f085=_0x12deec[0x0][_0xdbed('0x74')](/cdr\((.*)\)/);if(_0x48f085)this[_0xdbed('0xc')][_0x28d1c2[_0xdbed('0x19')]][_0x48f085[0x1]]=_0x12deec[0x1];}}}}catch(_0x5688df){logger[_0xdbed('0x42')]('[%s][voiceDialReport][newexten]',_0x28d1c2['uniqueid'],util[_0xdbed('0x1a')](_0x5688df,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xdbed('0x14')][_0xdbed('0x69')]=function(_0x529a02,_0x3b28d3=0x2710){if(this[_0xdbed('0x9')][_0x529a02]){setTimeout(()=>{delete this[_0xdbed('0x9')][_0x529a02];},_0x3b28d3);}};module[_0xdbed('0x75')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index e37835b..21794b3 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb5e=['syncAttendedTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queuecallerexit','queuecallercomplete','clearZombieChannels','switch','enqueue','Action','status','channel','catch','error','[%s][voiceQueueReport][checkChannel]','[%s][voiceQueueReport][checkQueueReport]','inspect','[FullyBooted]\x20clear\x20realtime','clearQueueReport','summary','emitVoiceQueueChannelRemove','emitVoiceQueueChannelSave',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','emit','voice_queue_presence:save','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:remove\x20event:','ATTENDEDTRANSFER','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','isRunning','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','queues','name','summaryEvent','createReport','handleInboundQueueSummaryReport','syncQueueStatusComplete','outbound','custom:queuesummary','statusRequests','completeEvent','push','syncQueueSummary','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','assign','pick','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','queuecallerabandon','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinenum','connectedlinename','info','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentconnect]','[%s][voiceQueueReport][agentcomplete]','assigned','queuecallerexitAt','reason','transfer','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','local/','seconds','transfertype','FORWARD','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','linkedid','COMPLETEDBY','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][varset]','addVariable','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','custom:timeout','keys','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','membername','memberrealtime','isNil','includes','length','diff','total','answered','sumBillable','milliseconds','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','custom:queuecallerabandon','sumDuration','sumHoldTime','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','deleteChannelAfterTimeout','syncHangup','[%s][voiceQueueReport][hangup]','cause','handleHangup','transferid','cause-txt','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','secondtransfererexten','syncBlindTransfer','[%s][voiceQueueReport][blindtransfer]','BLIND','extension','BlindTransfer','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceQueueReport][musiconholdstop]','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','startsWith','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceQueueReport][newexten]','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','redis','localhost','socket.io-emitter','prototype','tail','finally','sequence','queueReports','realtime','agents','channels','queueChannels','voiceQueues','campaigns','variables','queuesummary','bind','syncQueueSummaryComplete','queuemember','syncQueueMember','queuecallerjoin','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','syncVarSet','hangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xcb5e,0x1a6));var _0xecb5=function(_0x5eb833,_0x2d4515){_0x5eb833=_0x5eb833-0x0;var _0x1678d4=_0xcb5e[_0x5eb833];return _0x1678d4;};'use strict';var _=require(_0xecb5('0x0'));var moment=require(_0xecb5('0x1'));var util=require('util');var Redis=require(_0xecb5('0x2'));var config=require(_0xecb5('0x3'));var logger=require(_0xecb5('0x4'))(_0xecb5('0x5'));var ami=require(_0xecb5('0x6'));var QueueReport=require(_0xecb5('0x7'));var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0xecb5('0x8')]=_['defaults'](config[_0xecb5('0x8')],{'host':_0xecb5('0x9'),'port':0x18eb});var io=require(_0xecb5('0xa'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xecb5('0xb')]['enqueue']=function(_0x36a9d0){this['tail']=this[_0xecb5('0xc')]?this[_0xecb5('0xc')][_0xecb5('0xd')](_0x36a9d0):_0x36a9d0();};function VoiceQueueReport(_0x18f374){this[_0xecb5('0xe')]=new Sequence();this[_0xecb5('0xf')]={};this[_0xecb5('0x10')]=_0x18f374;this[_0xecb5('0x11')]=_0x18f374[_0xecb5('0x11')];this[_0xecb5('0x12')]=_0x18f374[_0xecb5('0x13')];this[_0xecb5('0x14')]=_0x18f374[_0xecb5('0x14')];this[_0xecb5('0x15')]=_0x18f374[_0xecb5('0x15')];this['summary']=initializeSummary();this[_0xecb5('0x16')]={};ami['on'](_0xecb5('0x17'),this['syncQueueSummary'][_0xecb5('0x18')](this));ami['on']('queuesummarycomplete',this[_0xecb5('0x19')]['bind'](this));ami['on'](_0xecb5('0x1a'),this[_0xecb5('0x1b')][_0xecb5('0x18')](this));ami['on']('queuestatuscomplete',this['syncQueueStatusComplete'][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x1c'),this[_0xecb5('0x1d')]['bind'](this));ami['on']('queuecallerabandon',this[_0xecb5('0x1e')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x1f'),this[_0xecb5('0x20')][_0xecb5('0x18')](this));ami['on']('agentcomplete',this[_0xecb5('0x21')]['bind'](this));ami['on'](_0xecb5('0x22'),this[_0xecb5('0x23')][_0xecb5('0x18')](this));ami['on']('varset',this[_0xecb5('0x24')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x25'),this['syncHangup'][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x26'),this[_0xecb5('0x27')][_0xecb5('0x18')](this));ami['on']('musiconholdstart',this[_0xecb5('0x28')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x29'),this[_0xecb5('0x2a')][_0xecb5('0x18')](this));ami['on'](_0xecb5('0x2b'),this[_0xecb5('0x2c')]['bind'](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xecb5('0x18')](this));this['loopQueueSummary']();this[_0xecb5('0x2d')]();}function clearChannels(_0x3f140b){if(!_[_0xecb5('0x2e')](_0x3f140b)){for(var _0x4864a0 in _0x3f140b){if(_0x3f140b['hasOwnProperty'](_0x4864a0)){delete _0x3f140b[_0x4864a0];}}}}function clearCampaigns(_0xe557a1){if(!_[_0xecb5('0x2e')](_0xe557a1)){for(var _0x300945 in _0xe557a1){if(_0xe557a1[_0xecb5('0x2f')](_0x300945)){_0xe557a1[_0x300945][_0xecb5('0x30')]=0x0;}}}}function clearVoiceQueues(_0x1b86ce){if(!_['isEmpty'](_0x1b86ce)){for(var _0x287be8 in _0x1b86ce){if(_0x1b86ce[_0xecb5('0x2f')](_0x287be8)){_0x1b86ce[_0x287be8][_0xecb5('0x30')]=0x0;_0x1b86ce[_0x287be8][_0xecb5('0x31')]=0x0;_0x1b86ce[_0x287be8][_0xecb5('0x32')]=0x0;_0x1b86ce[_0x287be8][_0xecb5('0x33')]=0x0;_0x1b86ce[_0x287be8]['queueStatusComplete']=!![];}}}}function clearAgentBooked(_0x4608c7){if(!_['isEmpty'](_0x4608c7)){for(var _0x3b8d58 in _0x4608c7){if(_0x4608c7[_0xecb5('0x2f')](_0x3b8d58)){_0x4608c7[_0x3b8d58]['unlockRR']=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x178115){return _0x178115[_0xecb5('0x34')]||_0x178115['queuecallerabandon']||_0x178115[_0xecb5('0x35')];}VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x36')]=function(){var _0x57b487=this;for(var _0x366625 in this[_0xecb5('0x12')]){if(this[_0xecb5('0x12')]['hasOwnProperty'](_0x366625)&&!this['channels'][_0x366625][_0xecb5('0x37')]){this['sequence'][_0xecb5('0x38')](function(){if(!_['isNil'](_0x57b487[_0xecb5('0x12')][_0x366625])){return ami[_0xecb5('0x39')]({'action':_0xecb5('0x3a'),'channel':_0x57b487[_0xecb5('0x12')][_0x366625][_0xecb5('0x3b')]})[_0xecb5('0x3c')](function(_0xca0c0){if(_0xca0c0['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x57b487[_0xecb5('0x12')][_0x366625]){delete _0x57b487[_0xecb5('0x12')][_0x366625];logger[_0xecb5('0x3d')](_0xecb5('0x3e'),_0x366625,util['inspect'](_0xca0c0,{'showHidden':![],'depth':null}));}if(_0x57b487[_0xecb5('0xf')][_0x366625]){delete _0x57b487[_0xecb5('0xf')][_0x366625];logger[_0xecb5('0x3d')](_0xecb5('0x3f'),_0x366625,util[_0xecb5('0x40')](_0xca0c0,{'showHidden':![],'depth':null}));}if(_0x57b487['variables'][_0x366625]){delete _0x57b487[_0xecb5('0x16')][_0x366625];logger[_0xecb5('0x3d')]('[%s][voiceQueueReport][checkVariables]',_0x366625,util[_0xecb5('0x40')](_0xca0c0,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xecb5('0xb')]['syncFullyBooted']=function(){logger['error'](_0xecb5('0x41'));clearChannels(this['channels']);this[_0xecb5('0x42')](this['queueReports']);clearAgentBooked(this[_0xecb5('0x11')]);clearVoiceQueues(this[_0xecb5('0x14')]);clearCampaigns(this[_0xecb5('0x15')]);this[_0xecb5('0x43')]=initializeSummary();};VoiceQueueReport['prototype'][_0xecb5('0x42')]=function(_0x10f347){var _0x2c3859=this;if(!_[_0xecb5('0x2e')](_0x10f347)){for(var _0x1f9d11 in _0x10f347){if(_0x10f347[_0xecb5('0x2f')](_0x1f9d11)){_0x2c3859[_0xecb5('0x44')](_0x10f347[_0x1f9d11],'clearqueuereport');delete _0x10f347[_0x1f9d11];}}}};VoiceQueueReport[_0xecb5('0xb')]['emit']=function(_0x112dc9,_0x198fe0,_0x3f0399){io['to'](_0x112dc9)['emit'](_0x198fe0,_0x3f0399);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x45')]=function(_0x44ae8c,_0x22b8c1){logger['debug']('[%s][voiceQueueReport]['+_0x22b8c1+_0xecb5('0x46'),_0x44ae8c[_0xecb5('0x47')],util['inspect'](_0x44ae8c,{'showHidden':![],'depth':null}));this['emit'](util[_0xecb5('0x48')](_0xecb5('0x49'),_0x44ae8c[_0xecb5('0x4a')]),'voice_queue_channel:save',_0x44ae8c);io[_0xecb5('0x4b')](_0xecb5('0x4c'),_0x44ae8c);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x44')]=function(_0x25e091,_0x16ec50){logger[_0xecb5('0x4d')](_0xecb5('0x4e')+_0x16ec50+_0xecb5('0x4f'),_0x25e091[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x25e091,{'showHidden':![],'depth':null}));if(_0x25e091['queuecallerexitreason']===_0xecb5('0x50')){return;}this[_0xecb5('0x4b')](util['format'](_0xecb5('0x49'),_0x25e091['queue']),'voice_queue_channel:remove',_0x25e091);io['emit'](_0xecb5('0x51'),_0x25e091);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x52')]=function(_0x4b18a6){if(_0x4b18a6[_0xecb5('0x53')]===_0xecb5('0x54')){logger[_0xecb5('0x4d')](_0xecb5('0x55'),util[_0xecb5('0x40')](_0x4b18a6,{'showHidden':![],'depth':null}));this[_0xecb5('0x4b')](util[_0xecb5('0x48')]('voice:queue:%s',_0x4b18a6['name']),_0xecb5('0x56'),_0x4b18a6);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x57')]=function(_0xb752ba){return _0xb752ba!==null&&!_[_0xecb5('0x58')](_0xb752ba);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x2d')]=function(){var _0x522b12=this;setInterval(function(){_0x522b12[_0xecb5('0x36')]();ami['Action']({'action':'queues'})[_0xecb5('0x3c')](function(_0x2f5b9f){logger[_0xecb5('0x3d')](_0xecb5('0x59'),util[_0xecb5('0x40')](_0x2f5b9f,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xecb5('0xb')]['loopQueueSummary']=function(){var _0x556c8d=this;setInterval(function(){if(!_0x556c8d[_0xecb5('0x43')][_0xecb5('0x5a')]){return ami[_0xecb5('0x39')]({'action':'queuesummary'})[_0xecb5('0x5b')](function(_0x24a360){_0x556c8d[_0xecb5('0x43')]['id']=_0x24a360[_0xecb5('0x5c')];_0x556c8d[_0xecb5('0x43')]['isRunning']=!![];_0x556c8d['summary'][_0xecb5('0x5d')][_0x24a360[_0xecb5('0x5c')]]={};})[_0xecb5('0x3c')](function(_0x39551b){logger[_0xecb5('0x3d')](_0xecb5('0x5e'),util[_0xecb5('0x40')](_0x39551b,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x5f')]=function(_0x2570fd,_0x5c3ae6){var _0x4c1b2a;if(this[_0xecb5('0x43')]&&this[_0xecb5('0x43')][_0xecb5('0x60')]&&this[_0xecb5('0x43')][_0xecb5('0x60')][_0x2570fd['name']]){_0x4c1b2a=this[_0xecb5('0x43')]['queues'][_0x2570fd[_0xecb5('0x61')]][_0xecb5('0x62')];}var _0x3a036e=new VoiceQueueSummary(_0x2570fd);return _0x3a036e[_0xecb5('0x63')](_0x5c3ae6[_0xecb5('0x11')],this[_0xecb5('0x11')],_0x4c1b2a,this['realtime'][_0xecb5('0x12')]);};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x64')]=function(_0x38baf3,_0x3e7c2f){var _0x33d1c5=this['createQueueSummaryReport'](_0x38baf3,_0x3e7c2f);var _0x366e14=![];_0x366e14=_0x33d1c5['compareToInboundQueue'](_0x38baf3);if(_0x366e14){Object['assign'](_0x38baf3,_0x33d1c5);this[_0xecb5('0x10')][_0xecb5('0x14')][_0x38baf3[_0xecb5('0x61')]]=_0x38baf3;this[_0xecb5('0x52')](_0x33d1c5);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x65')]=function(_0x3cf029){var _0x4fda12=null;var _0x5973db=this[_0xecb5('0x43')]['id'];if(this[_0xecb5('0x43')][_0xecb5('0x5d')][_0x5973db]){_0x4fda12=this['summary']['queuestatus'][_0x5973db][_0x3cf029[_0xecb5('0x5c')]];}if(!_0x4fda12){this[_0xecb5('0x43')]=initializeSummary();return;}var _0x5d0162=this['voiceQueues'][_0x4fda12['queue']];if(_0x5d0162[_0xecb5('0x53')]===_0xecb5('0x54')){this['handleInboundQueueSummaryReport'](_0x5d0162,_0x4fda12);}else if(_0x5d0162[_0xecb5('0x53')]===_0xecb5('0x66')){var _0x33c45e=this['createQueueSummaryReport'](_0x5d0162,_0x4fda12);ami[_0xecb5('0x4b')](_0xecb5('0x67'),_0x33c45e);}this[_0xecb5('0x43')][_0xecb5('0x68')]-=0x1;var _0x921cbe=this[_0xecb5('0x43')][_0xecb5('0x68')]>0x0?!![]:![];if(!_0x921cbe){return this[_0xecb5('0x19')](this[_0xecb5('0x43')][_0xecb5('0x69')]);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x1b')]=function(_0x263210){var _0x591fd9=this[_0xecb5('0x43')]['id'];if(this[_0xecb5('0x43')][_0xecb5('0x5d')][_0x591fd9]&&this['summary']['queuestatus'][_0x591fd9][_0x263210[_0xecb5('0x5c')]]){this[_0xecb5('0x43')][_0xecb5('0x5d')][_0x591fd9][_0x263210[_0xecb5('0x5c')]][_0xecb5('0x11')][_0xecb5('0x6a')](_0x263210);}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x6b')]=function(_0x33a407){var _0x291be3=this;try{if(this[_0xecb5('0x57')](_0x33a407)&&this[_0xecb5('0x57')](_0x33a407['queue'])){logger[_0xecb5('0x4d')](_0xecb5('0x6c'),util[_0xecb5('0x40')](_0x33a407,{'showHidden':![],'depth':null}));var _0xa22e1b=this['voiceQueues'][_0x33a407[_0xecb5('0x4a')]];if(_0xa22e1b){logger[_0xecb5('0x4d')](_0xecb5('0x6d'),_0xa22e1b[_0xecb5('0x61')]);this['summary'][_0xecb5('0x60')][_0xa22e1b[_0xecb5('0x61')]]={'summaryEvent':_0x33a407};this[_0xecb5('0x43')]['statusRequests']+=0x1;return ami[_0xecb5('0x39')]({'action':_0xecb5('0x5d'),'queue':_0xa22e1b[_0xecb5('0x61')]})[_0xecb5('0x5b')](function(_0x43648a){if(!_0x291be3['summary']['queuestatus'][_0x33a407[_0xecb5('0x5c')]]){_0x291be3['summary'][_0xecb5('0x5d')][_0x33a407[_0xecb5('0x5c')]]={};}_0x291be3[_0xecb5('0x43')]['queuestatus'][_0x33a407[_0xecb5('0x5c')]][_0x43648a[_0xecb5('0x5c')]]={'queue':_0xa22e1b['name'],'agents':[]};})[_0xecb5('0x3c')](function(_0xe33ddb){throw _0xe33ddb;});}}}catch(_0x3181e7){logger[_0xecb5('0x3d')](_0xecb5('0x5e'),util[_0xecb5('0x40')](_0x3181e7,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xecb5('0x19')]=function(_0x1cb429){if(this['summary'][_0xecb5('0x68')]>0x0){this['summary']['completeEvent']=_0x1cb429;return;}logger[_0xecb5('0x4d')](_0xecb5('0x6e'),util[_0xecb5('0x40')](_0x1cb429,{'showHidden':![],'depth':null}));this[_0xecb5('0x43')]=initializeSummary();ami[_0xecb5('0x4b')](_0xecb5('0x6f'),{});};VoiceQueueReport[_0xecb5('0xb')]['syncQueueCallerJoin']=function(_0x409d6b){try{if(this[_0xecb5('0x57')](_0x409d6b)){logger[_0xecb5('0x4d')](_0xecb5('0x70'),_0x409d6b['uniqueid'],util[_0xecb5('0x40')](_0x409d6b,{'showHidden':![],'depth':null}));if(_[_0xecb5('0x58')](this[_0xecb5('0xf')][_0x409d6b['uniqueid']])){this['queueReports'][_0x409d6b[_0xecb5('0x47')]]=[];}if(_[_0xecb5('0x58')](this[_0xecb5('0x12')][_0x409d6b[_0xecb5('0x47')]])){this[_0xecb5('0x12')][_0x409d6b[_0xecb5('0x47')]]={};}var _0x54c2cc=new QueueReport();_0x54c2cc['queue']=_0x409d6b[_0xecb5('0x4a')];_0x54c2cc['type']=this[_0xecb5('0x14')][_0x54c2cc['queue']]&&this[_0xecb5('0x14')][_0x54c2cc['queue']][_0xecb5('0x53')]?this[_0xecb5('0x14')][_0x54c2cc[_0xecb5('0x4a')]]['type']||_0xecb5('0x54'):_0xecb5('0x54');_0x54c2cc[_0xecb5('0x71')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x54c2cc[_0xecb5('0x73')]=_0x409d6b['position'];_0x54c2cc['count']=_0x409d6b[_0xecb5('0x74')];_0x54c2cc[_0xecb5('0x47')]=_0x409d6b[_0xecb5('0x47')];logger['info'](_0xecb5('0x75'),_0x54c2cc['queue'],_0x54c2cc[_0xecb5('0x53')]);Object[_0xecb5('0x76')](_0x54c2cc,_[_0xecb5('0x77')](_0x409d6b,_['keys'](_0x54c2cc)));this[_0xecb5('0xf')][_0x409d6b[_0xecb5('0x47')]][_0xecb5('0x6a')](_0x54c2cc);this[_0xecb5('0x12')][_0x409d6b[_0xecb5('0x47')]]=_0x54c2cc;this[_0xecb5('0x45')](_0x54c2cc,_0xecb5('0x1c'));}}catch(_0x3e4000){logger[_0xecb5('0x3d')]('[%s][voiceQueueReport][queuecallerjoin]',_0x409d6b[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x3e4000,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x1e')]=function(_0x5683f5){try{if(this[_0xecb5('0x57')](_0x5683f5)){logger[_0xecb5('0x4d')](_0xecb5('0x78'),_0x5683f5['uniqueid'],util[_0xecb5('0x40')](_0x5683f5,{'showHidden':![],'depth':null}));if(this[_0xecb5('0xf')][_0x5683f5[_0xecb5('0x47')]]){var _0x580159=_[_0xecb5('0x79')](this['queueReports'][_0x5683f5['uniqueid']]);_0x580159['queuecallercomplete']=![];_0x580159[_0xecb5('0x7a')]=null;_0x580159[_0xecb5('0x7b')]=_0x5683f5[_0xecb5('0x7b')];_0x580159[_0xecb5('0x7c')]=_0x5683f5[_0xecb5('0x7c')];_0x580159['queuecallerabandon']=!![];_0x580159[_0xecb5('0x7d')]=moment()[_0xecb5('0x48')]('YYYY-MM-DD\x20HH:mm:ss');_0x580159[_0xecb5('0x7e')]=_0xecb5('0x7f');_0x580159['lastAssignedTo']=null;logger['info'](_0xecb5('0x80'),_0x580159[_0xecb5('0x4a')],_0x580159[_0xecb5('0x53')]);this['channels'][_0x5683f5[_0xecb5('0x47')]]=_0x580159;this[_0xecb5('0x44')](_0x580159,_0xecb5('0x81'));}}}catch(_0x5b91d1){logger[_0xecb5('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x5683f5[_0xecb5('0x47')],util['inspect'](_0x5b91d1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x20')]=function(_0x1b0096){try{if(this[_0xecb5('0x57')](_0x1b0096)){logger[_0xecb5('0x4d')](_0xecb5('0x82'),_0x1b0096['uniqueid'],util[_0xecb5('0x40')](_0x1b0096,{'showHidden':![],'depth':null}));if(this[_0xecb5('0xf')][_0x1b0096['uniqueid']]){var _0x2ec6c9=_[_0xecb5('0x79')](this[_0xecb5('0xf')][_0x1b0096[_0xecb5('0x47')]]);_0x2ec6c9[_0xecb5('0x83')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x2ec6c9[_0xecb5('0x84')]=_0x1b0096[_0xecb5('0x84')];_0x2ec6c9[_0xecb5('0x85')]=_0x1b0096[_0xecb5('0x85')];logger[_0xecb5('0x86')](_0xecb5('0x87'),_0x2ec6c9[_0xecb5('0x4a')],_0x2ec6c9[_0xecb5('0x53')],_0x1b0096[_0xecb5('0x84')],_0x1b0096[_0xecb5('0x85')]);this[_0xecb5('0x12')][_0x1b0096[_0xecb5('0x47')]]=_0x2ec6c9;this[_0xecb5('0x45')](_0x2ec6c9,_0xecb5('0x1f'));}}}catch(_0x277bdc){logger['error'](_0xecb5('0x82'),_0x1b0096[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x277bdc,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')]['syncAgentConnect']=function(_0x3e6750){try{if(this['isNotNull'](_0x3e6750)){logger['debug']('[%s][voiceQueueReport][agentconnect]',_0x3e6750[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x3e6750,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3e6750[_0xecb5('0x47')]]){var _0x4076a4=_[_0xecb5('0x79')](this['queueReports'][_0x3e6750[_0xecb5('0x47')]]);_0x4076a4[_0xecb5('0x35')]=!![];_0x4076a4[_0xecb5('0x7e')]=_0xecb5('0x88');logger[_0xecb5('0x86')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x4076a4[_0xecb5('0x4a')],_0x4076a4['type']);}}}catch(_0x1568eb){logger['error'](_0xecb5('0x89'),_0x3e6750['uniqueid'],util['inspect'](_0x1568eb,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x21')]=function(_0x59223d){try{if(this[_0xecb5('0x57')](_0x59223d)){logger[_0xecb5('0x4d')](_0xecb5('0x8a'),_0x59223d[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x59223d,{'showHidden':![],'depth':null}));if(this[_0xecb5('0xf')][_0x59223d[_0xecb5('0x47')]]){var _0x572145=_[_0xecb5('0x79')](this[_0xecb5('0xf')][_0x59223d[_0xecb5('0x47')]]);_0x572145[_0xecb5('0x81')]=![];_0x572145['queuecallerabandonAt']=null;_0x572145[_0xecb5('0x8b')]=!![];_0x572145['lastAssignedTo']=_0x59223d['membername'];_0x572145[_0xecb5('0x7b')]=_0x59223d['holdtime'];_0x572145[_0xecb5('0x35')]=!![];_0x572145[_0xecb5('0x34')]=![];_0x572145[_0xecb5('0x8c')]=null;if(!_0x572145['transfer']){if(_0x59223d[_0xecb5('0x8d')]==_0xecb5('0x8e')){_0x572145[_0xecb5('0x7e')]=_0xecb5('0x8f');logger['info'](_0xecb5('0x90'),_0x572145[_0xecb5('0x4a')],_0x572145[_0xecb5('0x53')]);}else{if(_['startsWith'](_0x59223d['channel']['toLowerCase'](),_0xecb5('0x91'))){if(this['queueReports'][_0x59223d['linkedid']]){var _0x1ee4f4=_['last'](this['queueReports'][_0x59223d['linkedid']]);_0x1ee4f4[_0xecb5('0x35')]=![];_0x1ee4f4[_0xecb5('0x34')]=!![];_0x1ee4f4[_0xecb5('0x8c')]=moment(_0x572145[_0xecb5('0x71')])['add'](_0x59223d[_0xecb5('0x7b')],_0xecb5('0x92'))[_0xecb5('0x48')](_0xecb5('0x72'));_0x1ee4f4[_0xecb5('0x7e')]='FORWARDTRANSFER';_0x1ee4f4['transfer']=!![];_0x1ee4f4[_0xecb5('0x93')]=_0xecb5('0x94');_0x1ee4f4[_0xecb5('0x95')]=_0x59223d[_0xecb5('0x96')];_0x1ee4f4[_0xecb5('0x97')]=_0x59223d['uniqueid'];logger[_0xecb5('0x86')](_0xecb5('0x98'),_0x1ee4f4[_0xecb5('0x4a')],_0x1ee4f4[_0xecb5('0x53')]);var _0x5bb847=this['queueReports'][_0x59223d[_0xecb5('0x99')]];this[_0xecb5('0xf')][_0x59223d[_0xecb5('0x99')]]=this[_0xecb5('0xf')][_0x59223d['uniqueid']];this['queueReports'][_0x59223d[_0xecb5('0x47')]]=_0x5bb847;}}else{_0x572145[_0xecb5('0x7e')]=_0xecb5('0x9a')+_0x59223d['reason']['toUpperCase']();logger[_0xecb5('0x86')](_0xecb5('0x9b'),_0x572145[_0xecb5('0x4a')],_0x572145[_0xecb5('0x53')],_0x572145['queuecallerexitreason']);}}}this[_0xecb5('0x12')][_0x59223d[_0xecb5('0x47')]]=_0x572145;}}}catch(_0x427752){logger[_0xecb5('0x3d')](_0xecb5('0x8a'),_0x59223d[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x427752,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')]['syncVarSet']=function(_0x406e95){try{if(this[_0xecb5('0x57')](_0x406e95)){logger[_0xecb5('0x4d')](_0xecb5('0x9c'),_0x406e95[_0xecb5('0x47')],util[_0xecb5('0x40')](_0x406e95,{'showHidden':![],'depth':null}));this[_0xecb5('0x9d')](_0x406e95[_0xecb5('0x47')],_['keys'](_0x406e95[_0xecb5('0x9e')])[0x0],_0x406e95[_0xecb5('0x9f')]);if(this[_0xecb5('0xf')][_0x406e95[_0xecb5('0x47')]]){var _0x1fecb3=_[_0xecb5('0x79')](this[_0xecb5('0xf')][_0x406e95['uniqueid']]);if(_0x1fecb3){if(this[_0xecb5('0x57')](_0x406e95[_0xecb5('0x9e')])&&this[_0xecb5('0x57')](_0x406e95[_0xecb5('0x9e')]['queuestatus'])){switch(_0x406e95[_0xecb5('0x9f')]){case _0xecb5('0xa0'):_0x1fecb3['queuecallerexit']=![];_0x1fecb3[_0xecb5('0x8c')]=null;break;case _0xecb5('0xa1'):_0x1fecb3[_0xecb5('0xa2')]=_0xecb5('0xa3');_0x1fecb3[_0xecb5('0x34')]=!![];_0x1fecb3['queuecallerexitAt']=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x1fecb3[_0xecb5('0x83')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0xecb5('0x4d')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x406e95['uniqueid'],util[_0xecb5('0x40')](_0x1fecb3,{'showHidden':![],'depth':null}));ami[_0xecb5('0x4b')](_0xecb5('0xa4'),_0x1fecb3);break;default:_0x1fecb3[_0xecb5('0x34')]=!![];_0x1fecb3[_0xecb5('0x8c')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x1fecb3[_0xecb5('0x83')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));}_0x1fecb3[_0xecb5('0x81')]=![];_0x1fecb3[_0xecb5('0x7d')]=null;_0x1fecb3[_0xecb5('0x7e')]=_0x406e95['value'];this[_0xecb5('0x12')][_0x406e95[_0xecb5('0x47')]]=_0x1fecb3;this[_0xecb5('0x44')](_0x1fecb3,'varset');}else if(this['isNotNull'](_0x406e95['variable'])&&this['isNotNull'](_0x406e95[_0xecb5('0x9e')]['queueposition'])){if(!_0x1fecb3[_0xecb5('0x81')]){_0x1fecb3[_0xecb5('0x34')]=!![];_0x1fecb3[_0xecb5('0x8c')]=moment()[_0xecb5('0x48')](_0xecb5('0x72'));_0x1fecb3[_0xecb5('0x7e')]='EXITWITHKEY';_0x1fecb3[_0xecb5('0x83')]=moment()[_0xecb5('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xecb5('0x12')][_0x406e95[_0xecb5('0x47')]]=_0x1fecb3;}}logger[_0xecb5('0x86')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x406e95['uniqueid'],_0x1fecb3['queue'],_0x1fecb3[_0xecb5('0x53')],_[_0xecb5('0xa5')](_0x406e95[_0xecb5('0x9e')])[0x0],_0x406e95[_0xecb5('0x9f')]);_0x1fecb3[_0xecb5('0x16')]=this['variables'][_0x406e95[_0xecb5('0x47')]];}}}}catch(_0x2fc040){logger['error'](_0xecb5('0x9c'),_0x406e95['uniqueid'],util[_0xecb5('0x40')](_0x2fc040,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xecb5('0xb')][_0xecb5('0x9d')]=function(_0x4a5670,_0x193ba5,_0xe73429){var _0x386cf6=[_0xecb5('0xa6'),_0xecb5('0xa7'),_0xecb5('0xa8'),_0xecb5('0xa9'),_0xecb5('0xaa'),'rtpaudioqoslossbridged',_0xecb5('0xab'),_0xecb5('0xac'),_0xecb5('0xad'),_0xecb5('0xae'),_0xecb5('0xaf'),_0xecb5('0xb0'),_0xecb5('0xb1'),'memberdynamic','memberinterface','memberlastcall',_0xecb5('0xb2'),'memberpenalty',_0xecb5('0xb3')];if(!_[_0xecb5('0xb4')](_0x193ba5)&&!_[_0xecb5('0xb5')](_0x386cf6,_0x193ba5)){if(_[_0xecb5('0x58')](this[_0xecb5('0x16')][_0x4a5670])){this[_0xecb5('0x16')][_0x4a5670]={};}this[_0xecb5('0x16')][_0x4a5670][_0x193ba5]=_0xe73429;}};VoiceQueueReport[_0xecb5('0xb')]['handleHangup']=function(_0x24daa4,_0x1515c8,_0x5cda45){try{var _0x30e679={};if(this['queueReports'][_0x24daa4]){for(var _0xd12950=0x0;_0xd12950{delete this[_0xecb5('0x12')][_0x39f1eb];},_0x1a2ae6);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xa1ee=['rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','memberdynamic','memberlastcall','memberrealtime','includes','handleHangup','sumHoldTime','length','sumDuration','milliseconds','diff','answered','queuecallercompleteAt','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','[%s][voiceQueueReport][handleHangup]','cause-txt','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','deleteChannelAfterTimeout','[%s][voiceQueueReport][hangup]','transfereeuniqueid','transferexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','transfertype','transferid','[%s][voiceQueueReport][attendedtransfer]','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','set','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','application','applicationdata','match','[%s][voiceQueueReport][newexten]','exports','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','agents','channels','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','queuemember','queuestatuscomplete','syncQueueStatusComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','varset','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','loopQueueSummary','loopQueueShow','isEmpty','hasOwnProperty','originated','talking','pTalking','queueStatusComplete','unlockRR','queuecallerexit','switch','sequence','isNil','status','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','queueReports','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','emitVoiceQueueChannelRemove','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','queue','voice_queue_channel:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','format','voice_queue_presence:remove','type','name','voice_queue:save','isNotNull','clearZombieChannels','queues','[voiceQueueReport][queues]','isRunning','then','queuestatus','actionid','createQueueSummaryReport','summaryEvent','realtime','handleInboundQueueSummaryReport','assign','emitInboundVoiceQueueSummary','inbound','custom:queuesummary','statusRequests','syncQueueSummaryComplete','completeEvent','syncQueueMember','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','[voiceQueueReport][queuesummary]','[%s][voiceQueueReport][queuecallerjoin]','isUndefined','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercomplete','holdtime','originalposition','queuecallerabandonAt','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','queuecallerleaveAt','connectedlinename','connectedlinenum','syncAgentConnect','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','lastAssignedTo','membername','transfer','reason','COMPLETED','startsWith','channel','toLowerCase','local/','linkedid','add','seconds','FORWARD','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','[%s][voiceQueueReport][agentcomplete]','variable','value','CONTINUE','TIMEOUT','lastevent','timeout','queuecallerexitAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','[%s][voiceQueueReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter'];(function(_0x233894,_0x143dc9){var _0x10338b=function(_0x57cfdb){while(--_0x57cfdb){_0x233894['push'](_0x233894['shift']());}};_0x10338b(++_0x143dc9);}(_0xa1ee,0x12f));var _0xea1e=function(_0x49e584,_0x2886f8){_0x49e584=_0x49e584-0x0;var _0x58b1be=_0xa1ee[_0x49e584];return _0x58b1be;};'use strict';var _=require('lodash');var moment=require(_0xea1e('0x0'));var util=require(_0xea1e('0x1'));var Redis=require(_0xea1e('0x2'));var config=require(_0xea1e('0x3'));var logger=require(_0xea1e('0x4'))('ami');var ami=require(_0xea1e('0x5'));var QueueReport=require('../model/queueReport');var VoiceQueueSummary=require('../model/voiceQueueSummary');config[_0xea1e('0x6')]=_[_0xea1e('0x7')](config[_0xea1e('0x6')],{'host':_0xea1e('0x8'),'port':0x18eb});var io=require(_0xea1e('0x9'))(new Redis(config[_0xea1e('0x6')]));var Sequence=function(){};Sequence[_0xea1e('0xa')][_0xea1e('0xb')]=function(_0x1ec64b){this[_0xea1e('0xc')]=this['tail']?this[_0xea1e('0xc')]['finally'](_0x1ec64b):_0x1ec64b();};function VoiceQueueReport(_0x7122a5){this['sequence']=new Sequence();this['queueReports']={};this['realtime']=_0x7122a5;this['agents']=_0x7122a5[_0xea1e('0xd')];this[_0xea1e('0xe')]=_0x7122a5[_0xea1e('0xf')];this['voiceQueues']=_0x7122a5[_0xea1e('0x10')];this[_0xea1e('0x11')]=_0x7122a5[_0xea1e('0x11')];this[_0xea1e('0x12')]=initializeSummary();this[_0xea1e('0x13')]={};ami['on'](_0xea1e('0x14'),this[_0xea1e('0x15')][_0xea1e('0x16')](this));ami['on']('queuesummarycomplete',this['syncQueueSummaryComplete'][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x17'),this['syncQueueMember'][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x18'),this[_0xea1e('0x19')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x1a'),this[_0xea1e('0x1b')]['bind'](this));ami['on'](_0xea1e('0x1c'),this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xea1e('0x1d'),this[_0xea1e('0x1e')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x1f'),this[_0xea1e('0x20')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x21'),this['syncAgentConnect']['bind'](this));ami['on'](_0xea1e('0x22'),this['syncVarSet'][_0xea1e('0x16')](this));ami['on']('hangup',this[_0xea1e('0x23')][_0xea1e('0x16')](this));ami['on'](_0xea1e('0x24'),this[_0xea1e('0x25')]['bind'](this));ami['on'](_0xea1e('0x26'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xea1e('0x27'),this[_0xea1e('0x28')][_0xea1e('0x16')](this));ami['on']('attendedtransfer',this[_0xea1e('0x29')]['bind'](this));ami['on'](_0xea1e('0x2a'),this['syncBlindTransfer'][_0xea1e('0x16')](this));this[_0xea1e('0x2b')]();this[_0xea1e('0x2c')]();}function clearChannels(_0x59365b){if(!_[_0xea1e('0x2d')](_0x59365b)){for(var _0x1f23f7 in _0x59365b){if(_0x59365b[_0xea1e('0x2e')](_0x1f23f7)){delete _0x59365b[_0x1f23f7];}}}}function clearCampaigns(_0x27129f){if(!_[_0xea1e('0x2d')](_0x27129f)){for(var _0xd3f518 in _0x27129f){if(_0x27129f[_0xea1e('0x2e')](_0xd3f518)){_0x27129f[_0xd3f518][_0xea1e('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x319341){if(!_[_0xea1e('0x2d')](_0x319341)){for(var _0x53e58d in _0x319341){if(_0x319341['hasOwnProperty'](_0x53e58d)){_0x319341[_0x53e58d][_0xea1e('0x2f')]=0x0;_0x319341[_0x53e58d][_0xea1e('0x30')]=0x0;_0x319341[_0x53e58d][_0xea1e('0x31')]=0x0;_0x319341[_0x53e58d]['waiting']=0x0;_0x319341[_0x53e58d][_0xea1e('0x32')]=!![];}}}}function clearAgentBooked(_0x53309a){if(!_[_0xea1e('0x2d')](_0x53309a)){for(var _0x45399b in _0x53309a){if(_0x53309a[_0xea1e('0x2e')](_0x45399b)){_0x53309a[_0x45399b][_0xea1e('0x33')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x25fd57){return _0x25fd57[_0xea1e('0x34')]||_0x25fd57['queuecallerabandon']||_0x25fd57['queuecallercomplete'];}VoiceQueueReport['prototype']['clearZombieChannels']=function(){var _0x1f19ca=this;for(var _0x82e8be in this[_0xea1e('0xe')]){if(this[_0xea1e('0xe')][_0xea1e('0x2e')](_0x82e8be)&&!this[_0xea1e('0xe')][_0x82e8be][_0xea1e('0x35')]){this[_0xea1e('0x36')][_0xea1e('0xb')](function(){if(!_[_0xea1e('0x37')](_0x1f19ca['channels'][_0x82e8be])){return ami['Action']({'action':_0xea1e('0x38'),'channel':_0x1f19ca['channels'][_0x82e8be]['channel']})[_0xea1e('0x39')](function(_0x1f862e){if(_0x1f862e[_0xea1e('0x3a')]===_0xea1e('0x3b')){setTimeout(function(){if(_0x1f19ca[_0xea1e('0xe')][_0x82e8be]){delete _0x1f19ca[_0xea1e('0xe')][_0x82e8be];logger[_0xea1e('0x3c')](_0xea1e('0x3d'),_0x82e8be,util[_0xea1e('0x3e')](_0x1f862e,{'showHidden':![],'depth':null}));}if(_0x1f19ca[_0xea1e('0x3f')][_0x82e8be]){delete _0x1f19ca[_0xea1e('0x3f')][_0x82e8be];logger[_0xea1e('0x3c')](_0xea1e('0x40'),_0x82e8be,util[_0xea1e('0x3e')](_0x1f862e,{'showHidden':![],'depth':null}));}if(_0x1f19ca[_0xea1e('0x13')][_0x82e8be]){delete _0x1f19ca[_0xea1e('0x13')][_0x82e8be];logger['error'](_0xea1e('0x41'),_0x82e8be,util['inspect'](_0x1f862e,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport['prototype']['syncFullyBooted']=function(){logger[_0xea1e('0x3c')](_0xea1e('0x42'));clearChannels(this[_0xea1e('0xe')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0xea1e('0xd')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0xea1e('0x11')]);this[_0xea1e('0x12')]=initializeSummary();};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x43')]=function(_0xf18ac9){var _0x522388=this;if(!_['isEmpty'](_0xf18ac9)){for(var _0x2ce997 in _0xf18ac9){if(_0xf18ac9[_0xea1e('0x2e')](_0x2ce997)){_0x522388[_0xea1e('0x44')](_0xf18ac9[_0x2ce997],_0xea1e('0x45'));delete _0xf18ac9[_0x2ce997];}}}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x46')]=function(_0x13b1d5,_0x17f0f1,_0x37d56e){io['to'](_0x13b1d5)[_0xea1e('0x46')](_0x17f0f1,_0x37d56e);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x47')]=function(_0x520298,_0x16c0c3){logger[_0xea1e('0x48')](_0xea1e('0x49')+_0x16c0c3+_0xea1e('0x4a'),_0x520298[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x520298,{'showHidden':![],'depth':null}));this[_0xea1e('0x46')](util['format']('voice:queue:%s',_0x520298[_0xea1e('0x4c')]),_0xea1e('0x4d'),_0x520298);io['emit']('voice_queue_presence:save',_0x520298);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x44')]=function(_0xad3c4,_0x3407e8){logger[_0xea1e('0x48')](_0xea1e('0x49')+_0x3407e8+_0xea1e('0x4e'),_0xad3c4['uniqueid'],util['inspect'](_0xad3c4,{'showHidden':![],'depth':null}));if(_0xad3c4[_0xea1e('0x4f')]===_0xea1e('0x50')){return;}this[_0xea1e('0x46')](util[_0xea1e('0x51')]('voice:queue:%s',_0xad3c4[_0xea1e('0x4c')]),'voice_queue_channel:remove',_0xad3c4);io[_0xea1e('0x46')](_0xea1e('0x52'),_0xad3c4);};VoiceQueueReport[_0xea1e('0xa')]['emitInboundVoiceQueueSummary']=function(_0x1d0557){if(_0x1d0557[_0xea1e('0x53')]==='inbound'){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0xea1e('0x3e')](_0x1d0557,{'showHidden':![],'depth':null}));this[_0xea1e('0x46')](util[_0xea1e('0x51')]('voice:queue:%s',_0x1d0557[_0xea1e('0x54')]),_0xea1e('0x55'),_0x1d0557);}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x56')]=function(_0x57fbf7){return _0x57fbf7!==null&&!_['isUndefined'](_0x57fbf7);};VoiceQueueReport[_0xea1e('0xa')]['loopQueueShow']=function(){var _0x578463=this;setInterval(function(){_0x578463[_0xea1e('0x57')]();ami['Action']({'action':_0xea1e('0x58')})[_0xea1e('0x39')](function(_0x396f99){logger['error'](_0xea1e('0x59'),util[_0xea1e('0x3e')](_0x396f99,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x2b')]=function(){var _0x463a8c=this;setInterval(function(){if(!_0x463a8c[_0xea1e('0x12')][_0xea1e('0x5a')]){return ami['Action']({'action':_0xea1e('0x14')})[_0xea1e('0x5b')](function(_0x98d992){_0x463a8c[_0xea1e('0x12')]['id']=_0x98d992['actionid'];_0x463a8c[_0xea1e('0x12')][_0xea1e('0x5a')]=!![];_0x463a8c[_0xea1e('0x12')][_0xea1e('0x5c')][_0x98d992[_0xea1e('0x5d')]]={};})[_0xea1e('0x39')](function(_0x3a981e){logger[_0xea1e('0x3c')]('[voiceQueueReport][queuesummary]',util[_0xea1e('0x3e')](_0x3a981e,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x5e')]=function(_0xb314bc,_0x238952){var _0x198d22;if(this[_0xea1e('0x12')]&&this[_0xea1e('0x12')]['queues']&&this['summary'][_0xea1e('0x58')][_0xb314bc[_0xea1e('0x54')]]){_0x198d22=this['summary'][_0xea1e('0x58')][_0xb314bc[_0xea1e('0x54')]][_0xea1e('0x5f')];}var _0xf6717c=new VoiceQueueSummary(_0xb314bc);return _0xf6717c['createReport'](_0x238952[_0xea1e('0xd')],this['agents'],_0x198d22,this[_0xea1e('0x60')][_0xea1e('0xe')]);};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x61')]=function(_0x3620c0,_0x1cc91b){var _0x383183=this[_0xea1e('0x5e')](_0x3620c0,_0x1cc91b);var _0x4f88c3=![];_0x4f88c3=_0x383183['compareToInboundQueue'](_0x3620c0);if(_0x4f88c3){Object[_0xea1e('0x62')](_0x3620c0,_0x383183);this[_0xea1e('0x60')][_0xea1e('0x10')][_0x3620c0[_0xea1e('0x54')]]=_0x3620c0;this[_0xea1e('0x63')](_0x383183);}};VoiceQueueReport[_0xea1e('0xa')]['syncQueueStatusComplete']=function(_0x3d43b9){var _0x2e0747=null;var _0x40e5e5=this['summary']['id'];if(this[_0xea1e('0x12')]['queuestatus'][_0x40e5e5]){_0x2e0747=this[_0xea1e('0x12')][_0xea1e('0x5c')][_0x40e5e5][_0x3d43b9[_0xea1e('0x5d')]];}if(!_0x2e0747){this['summary']=initializeSummary();return;}var _0x8f5a8e=this[_0xea1e('0x10')][_0x2e0747['queue']];if(_0x8f5a8e[_0xea1e('0x53')]===_0xea1e('0x64')){this['handleInboundQueueSummaryReport'](_0x8f5a8e,_0x2e0747);}else if(_0x8f5a8e[_0xea1e('0x53')]==='outbound'){var _0x40bd0d=this['createQueueSummaryReport'](_0x8f5a8e,_0x2e0747);ami[_0xea1e('0x46')](_0xea1e('0x65'),_0x40bd0d);}this[_0xea1e('0x12')][_0xea1e('0x66')]-=0x1;var _0x20c55a=this[_0xea1e('0x12')]['statusRequests']>0x0?!![]:![];if(!_0x20c55a){return this[_0xea1e('0x67')](this[_0xea1e('0x12')][_0xea1e('0x68')]);}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x69')]=function(_0x4df930){var _0x3bdef4=this[_0xea1e('0x12')]['id'];if(this['summary'][_0xea1e('0x5c')][_0x3bdef4]&&this[_0xea1e('0x12')][_0xea1e('0x5c')][_0x3bdef4][_0x4df930[_0xea1e('0x5d')]]){this['summary'][_0xea1e('0x5c')][_0x3bdef4][_0x4df930[_0xea1e('0x5d')]]['agents']['push'](_0x4df930);}};VoiceQueueReport[_0xea1e('0xa')]['syncQueueSummary']=function(_0x19e1e2){var _0x2db94a=this;try{if(this['isNotNull'](_0x19e1e2)&&this['isNotNull'](_0x19e1e2[_0xea1e('0x4c')])){logger[_0xea1e('0x48')](_0xea1e('0x6a'),util['inspect'](_0x19e1e2,{'showHidden':![],'depth':null}));var _0x1edd96=this[_0xea1e('0x10')][_0x19e1e2[_0xea1e('0x4c')]];if(_0x1edd96){logger[_0xea1e('0x48')](_0xea1e('0x6b'),_0x1edd96[_0xea1e('0x54')]);this[_0xea1e('0x12')][_0xea1e('0x58')][_0x1edd96[_0xea1e('0x54')]]={'summaryEvent':_0x19e1e2};this[_0xea1e('0x12')][_0xea1e('0x66')]+=0x1;return ami['Action']({'action':_0xea1e('0x5c'),'queue':_0x1edd96['name']})[_0xea1e('0x5b')](function(_0x145ae0){if(!_0x2db94a[_0xea1e('0x12')][_0xea1e('0x5c')][_0x19e1e2[_0xea1e('0x5d')]]){_0x2db94a[_0xea1e('0x12')][_0xea1e('0x5c')][_0x19e1e2['actionid']]={};}_0x2db94a[_0xea1e('0x12')][_0xea1e('0x5c')][_0x19e1e2[_0xea1e('0x5d')]][_0x145ae0[_0xea1e('0x5d')]]={'queue':_0x1edd96[_0xea1e('0x54')],'agents':[]};})[_0xea1e('0x39')](function(_0x4d5854){throw _0x4d5854;});}}}catch(_0x3d77ef){logger[_0xea1e('0x3c')](_0xea1e('0x6c'),util[_0xea1e('0x3e')](_0x3d77ef,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x67')]=function(_0x675ca2){if(this['summary'][_0xea1e('0x66')]>0x0){this['summary'][_0xea1e('0x68')]=_0x675ca2;return;}logger[_0xea1e('0x48')]('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0xea1e('0x3e')](_0x675ca2,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami['emit']('custom:queuesummarycomplete',{});};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x1b')]=function(_0x5d4fbd){try{if(this['isNotNull'](_0x5d4fbd)){logger[_0xea1e('0x48')](_0xea1e('0x6d'),_0x5d4fbd['uniqueid'],util[_0xea1e('0x3e')](_0x5d4fbd,{'showHidden':![],'depth':null}));if(_[_0xea1e('0x6e')](this['queueReports'][_0x5d4fbd[_0xea1e('0x4b')]])){this[_0xea1e('0x3f')][_0x5d4fbd[_0xea1e('0x4b')]]=[];}if(_[_0xea1e('0x6e')](this[_0xea1e('0xe')][_0x5d4fbd[_0xea1e('0x4b')]])){this[_0xea1e('0xe')][_0x5d4fbd['uniqueid']]={};}var _0x563a38=new QueueReport();_0x563a38[_0xea1e('0x4c')]=_0x5d4fbd[_0xea1e('0x4c')];_0x563a38['type']=this['voiceQueues'][_0x563a38['queue']]&&this['voiceQueues'][_0x563a38[_0xea1e('0x4c')]]['type']?this['voiceQueues'][_0x563a38['queue']][_0xea1e('0x53')]||_0xea1e('0x64'):_0xea1e('0x64');_0x563a38[_0xea1e('0x6f')]=moment()[_0xea1e('0x51')](_0xea1e('0x70'));_0x563a38['position']=_0x5d4fbd[_0xea1e('0x71')];_0x563a38[_0xea1e('0x72')]=_0x5d4fbd[_0xea1e('0x72')];_0x563a38[_0xea1e('0x4b')]=_0x5d4fbd[_0xea1e('0x4b')];logger[_0xea1e('0x73')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x563a38[_0xea1e('0x4c')],_0x563a38['type']);Object[_0xea1e('0x62')](_0x563a38,_[_0xea1e('0x74')](_0x5d4fbd,_[_0xea1e('0x75')](_0x563a38)));this[_0xea1e('0x3f')][_0x5d4fbd['uniqueid']]['push'](_0x563a38);this['channels'][_0x5d4fbd[_0xea1e('0x4b')]]=_0x563a38;this['emitVoiceQueueChannelSave'](_0x563a38,_0xea1e('0x1a'));}}catch(_0x215f23){logger[_0xea1e('0x3c')](_0xea1e('0x6d'),_0x5d4fbd['uniqueid'],util[_0xea1e('0x3e')](_0x215f23,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x76')]=function(_0x26ca0f){try{if(this[_0xea1e('0x56')](_0x26ca0f)){logger[_0xea1e('0x48')](_0xea1e('0x77'),_0x26ca0f[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x26ca0f,{'showHidden':![],'depth':null}));if(this[_0xea1e('0x3f')][_0x26ca0f['uniqueid']]){var _0x224746=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0x26ca0f[_0xea1e('0x4b')]]);_0x224746[_0xea1e('0x79')]=![];_0x224746['queuecallercompleteAt']=null;_0x224746['holdtime']=_0x26ca0f[_0xea1e('0x7a')];_0x224746[_0xea1e('0x7b')]=_0x26ca0f[_0xea1e('0x7b')];_0x224746[_0xea1e('0x1c')]=!![];_0x224746[_0xea1e('0x7c')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x224746[_0xea1e('0x4f')]='ABANDONED';_0x224746['lastAssignedTo']=null;logger['info'](_0xea1e('0x7d'),_0x224746['queue'],_0x224746[_0xea1e('0x53')]);this[_0xea1e('0xe')][_0x26ca0f[_0xea1e('0x4b')]]=_0x224746;this[_0xea1e('0x44')](_0x224746,_0xea1e('0x1c'));}}}catch(_0x1236f0){logger[_0xea1e('0x3c')](_0xea1e('0x77'),_0x26ca0f['uniqueid'],util[_0xea1e('0x3e')](_0x1236f0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')]['syncQueueCallerLeave']=function(_0xc4a9ed){try{if(this['isNotNull'](_0xc4a9ed)){logger[_0xea1e('0x48')](_0xea1e('0x7e'),_0xc4a9ed[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0xc4a9ed,{'showHidden':![],'depth':null}));if(this['queueReports'][_0xc4a9ed[_0xea1e('0x4b')]]){var _0x3283ce=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0xc4a9ed[_0xea1e('0x4b')]]);_0x3283ce[_0xea1e('0x7f')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x3283ce['connectedlinenum']=_0xc4a9ed['connectedlinenum'];_0x3283ce[_0xea1e('0x80')]=_0xc4a9ed[_0xea1e('0x80')];logger['info']('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x3283ce[_0xea1e('0x4c')],_0x3283ce[_0xea1e('0x53')],_0xc4a9ed[_0xea1e('0x81')],_0xc4a9ed['connectedlinename']);this[_0xea1e('0xe')][_0xc4a9ed['uniqueid']]=_0x3283ce;this[_0xea1e('0x47')](_0x3283ce,_0xea1e('0x1d'));}}}catch(_0x4502d5){logger[_0xea1e('0x3c')](_0xea1e('0x7e'),_0xc4a9ed[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x4502d5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')][_0xea1e('0x82')]=function(_0x24fd31){try{if(this[_0xea1e('0x56')](_0x24fd31)){logger[_0xea1e('0x48')]('[%s][voiceQueueReport][agentconnect]',_0x24fd31[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x24fd31,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x24fd31[_0xea1e('0x4b')]]){var _0x59ad13=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0x24fd31[_0xea1e('0x4b')]]);_0x59ad13[_0xea1e('0x79')]=!![];_0x59ad13[_0xea1e('0x4f')]=_0xea1e('0x83');logger[_0xea1e('0x73')](_0xea1e('0x84'),_0x59ad13['queue'],_0x59ad13[_0xea1e('0x53')]);}}}catch(_0xb8ca31){logger['error']('[%s][voiceQueueReport][agentconnect]',_0x24fd31[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0xb8ca31,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncAgentComplete']=function(_0xbd70e){try{if(this[_0xea1e('0x56')](_0xbd70e)){logger[_0xea1e('0x48')]('[%s][voiceQueueReport][agentcomplete]',_0xbd70e['uniqueid'],util[_0xea1e('0x3e')](_0xbd70e,{'showHidden':![],'depth':null}));if(this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x4b')]]){var _0x4e7d75=_['last'](this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x4b')]]);_0x4e7d75[_0xea1e('0x1c')]=![];_0x4e7d75[_0xea1e('0x7c')]=null;_0x4e7d75['assigned']=!![];_0x4e7d75[_0xea1e('0x85')]=_0xbd70e[_0xea1e('0x86')];_0x4e7d75[_0xea1e('0x7a')]=_0xbd70e['holdtime'];_0x4e7d75[_0xea1e('0x79')]=!![];_0x4e7d75[_0xea1e('0x34')]=![];_0x4e7d75['queuecallerexitAt']=null;if(!_0x4e7d75[_0xea1e('0x87')]){if(_0xbd70e[_0xea1e('0x88')]==_0xea1e('0x87')){_0x4e7d75[_0xea1e('0x4f')]=_0xea1e('0x89');logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x4e7d75[_0xea1e('0x4c')],_0x4e7d75[_0xea1e('0x53')]);}else{if(_[_0xea1e('0x8a')](_0xbd70e[_0xea1e('0x8b')][_0xea1e('0x8c')](),_0xea1e('0x8d'))){if(this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x8e')]]){var _0x52de4f=_[_0xea1e('0x78')](this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x8e')]]);_0x52de4f[_0xea1e('0x79')]=![];_0x52de4f[_0xea1e('0x34')]=!![];_0x52de4f['queuecallerexitAt']=moment(_0x4e7d75['queuecallerjoinAt'])[_0xea1e('0x8f')](_0xbd70e['holdtime'],_0xea1e('0x90'))[_0xea1e('0x51')](_0xea1e('0x70'));_0x52de4f[_0xea1e('0x4f')]='FORWARDTRANSFER';_0x52de4f['transfer']=!![];_0x52de4f['transfertype']=_0xea1e('0x91');_0x52de4f['transferexten']=_0xbd70e[_0xea1e('0x92')];_0x52de4f['transferuniqueid']=_0xbd70e[_0xea1e('0x4b')];logger[_0xea1e('0x73')](_0xea1e('0x93'),_0x52de4f[_0xea1e('0x4c')],_0x52de4f[_0xea1e('0x53')]);var _0x459e98=this['queueReports'][_0xbd70e[_0xea1e('0x8e')]];this[_0xea1e('0x3f')][_0xbd70e['linkedid']]=this[_0xea1e('0x3f')][_0xbd70e[_0xea1e('0x4b')]];this['queueReports'][_0xbd70e[_0xea1e('0x4b')]]=_0x459e98;}}else{_0x4e7d75[_0xea1e('0x4f')]=_0xea1e('0x94')+_0xbd70e[_0xea1e('0x88')][_0xea1e('0x95')]();logger[_0xea1e('0x73')](_0xea1e('0x96'),_0x4e7d75['queue'],_0x4e7d75['type'],_0x4e7d75[_0xea1e('0x4f')]);}}}this[_0xea1e('0xe')][_0xbd70e['uniqueid']]=_0x4e7d75;}}}catch(_0x41dd1a){logger[_0xea1e('0x3c')](_0xea1e('0x97'),_0xbd70e['uniqueid'],util['inspect'](_0x41dd1a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xea1e('0xa')]['syncVarSet']=function(_0x414764){try{if(this[_0xea1e('0x56')](_0x414764)){logger['debug']('[%s][voiceQueueReport][varset]',_0x414764[_0xea1e('0x4b')],util['inspect'](_0x414764,{'showHidden':![],'depth':null}));this['addVariable'](_0x414764[_0xea1e('0x4b')],_[_0xea1e('0x75')](_0x414764[_0xea1e('0x98')])[0x0],_0x414764[_0xea1e('0x99')]);if(this[_0xea1e('0x3f')][_0x414764[_0xea1e('0x4b')]]){var _0x2c2764=_[_0xea1e('0x78')](this['queueReports'][_0x414764[_0xea1e('0x4b')]]);if(_0x2c2764){if(this[_0xea1e('0x56')](_0x414764[_0xea1e('0x98')])&&this['isNotNull'](_0x414764['variable'][_0xea1e('0x5c')])){switch(_0x414764[_0xea1e('0x99')]){case _0xea1e('0x9a'):_0x2c2764[_0xea1e('0x34')]=![];_0x2c2764['queuecallerexitAt']=null;break;case _0xea1e('0x9b'):_0x2c2764[_0xea1e('0x9c')]=_0xea1e('0x9d');_0x2c2764['queuecallerexit']=!![];_0x2c2764[_0xea1e('0x9e')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c2764[_0xea1e('0x7f')]=moment()['format'](_0xea1e('0x70'));logger[_0xea1e('0x48')](_0xea1e('0x9f'),_0x414764['uniqueid'],util[_0xea1e('0x3e')](_0x2c2764,{'showHidden':![],'depth':null}));ami[_0xea1e('0x46')](_0xea1e('0xa0'),_0x2c2764);break;default:_0x2c2764[_0xea1e('0x34')]=!![];_0x2c2764[_0xea1e('0x9e')]=moment()['format'](_0xea1e('0x70'));_0x2c2764[_0xea1e('0x7f')]=moment()[_0xea1e('0x51')](_0xea1e('0x70'));}_0x2c2764[_0xea1e('0x1c')]=![];_0x2c2764[_0xea1e('0x7c')]=null;_0x2c2764[_0xea1e('0x4f')]=_0x414764['value'];this[_0xea1e('0xe')][_0x414764['uniqueid']]=_0x2c2764;this[_0xea1e('0x44')](_0x2c2764,_0xea1e('0x22'));}else if(this['isNotNull'](_0x414764[_0xea1e('0x98')])&&this['isNotNull'](_0x414764[_0xea1e('0x98')][_0xea1e('0xa1')])){if(!_0x2c2764[_0xea1e('0x1c')]){_0x2c2764[_0xea1e('0x34')]=!![];_0x2c2764[_0xea1e('0x9e')]=moment()[_0xea1e('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c2764[_0xea1e('0x4f')]=_0xea1e('0xa2');_0x2c2764[_0xea1e('0x7f')]=moment()[_0xea1e('0x51')](_0xea1e('0x70'));this['channels'][_0x414764[_0xea1e('0x4b')]]=_0x2c2764;}}logger[_0xea1e('0x73')](_0xea1e('0xa3'),_0x414764[_0xea1e('0x4b')],_0x2c2764[_0xea1e('0x4c')],_0x2c2764['type'],_[_0xea1e('0x75')](_0x414764[_0xea1e('0x98')])[0x0],_0x414764[_0xea1e('0x99')]);_0x2c2764[_0xea1e('0x13')]=this[_0xea1e('0x13')][_0x414764[_0xea1e('0x4b')]];}}}}catch(_0x37b184){logger[_0xea1e('0x3c')](_0xea1e('0xa4'),_0x414764[_0xea1e('0x4b')],util[_0xea1e('0x3e')](_0x37b184,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xea1e('0xa5')]=function(_0x6005e6,_0x5c5d89,_0x1c238d){var _0x3b25c4=[_0xea1e('0xa6'),_0xea1e('0xa7'),_0xea1e('0xa8'),'rtpaudioqosjitterbridged',_0xea1e('0xa9'),'rtpaudioqoslossbridged',_0xea1e('0xaa'),_0xea1e('0xab'),_0xea1e('0xac'),'sipuri','bridgepeer','bridgepvtcallid','membercalls',_0xea1e('0xad'),'memberinterface',_0xea1e('0xae'),_0xea1e('0x86'),'memberpenalty',_0xea1e('0xaf')];if(!_[_0xea1e('0x37')](_0x5c5d89)&&!_[_0xea1e('0xb0')](_0x3b25c4,_0x5c5d89)){if(_[_0xea1e('0x6e')](this[_0xea1e('0x13')][_0x6005e6])){this[_0xea1e('0x13')][_0x6005e6]={};}this[_0xea1e('0x13')][_0x6005e6][_0x5c5d89]=_0x1c238d;}};VoiceQueueReport['prototype'][_0xea1e('0xb1')]=function(_0x2a9042,_0x19304e,_0x4a9a19){try{var _0x3863e={};if(this['queueReports'][_0x2a9042]){for(var _0x1ba3fb=0x0;_0x1ba3fb{delete this[_0xea1e('0xe')][_0x193e8e];},_0x4a3d11);}};module[_0xea1e('0xeb')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 842f295..8cdd023 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x37f8=['campaign','queue','Request','CreateReportAgentPreview','../client','createHistory'];(function(_0x54f906,_0x5abb23){var _0x12de98=function(_0x6da4b5){while(--_0x6da4b5){_0x54f906['push'](_0x54f906['shift']());}};_0x12de98(++_0x5abb23);}(_0x37f8,0x1f0));var _0x837f=function(_0x35ccf7,_0x12dc1e){_0x35ccf7=_0x35ccf7-0x0;var _0x2ffbf8=_0x37f8[_0x35ccf7];return _0x2ffbf8;};'use strict';var client=require(_0x837f('0x0'));exports[_0x837f('0x1')]=function(_0x32c141){return function(){_0x32c141[_0x837f('0x2')]=_0x32c141[_0x837f('0x3')];return client[_0x837f('0x4')](_0x837f('0x5'),{'body':_0x32c141,'log':_0x837f('0x5')});};}; \ No newline at end of file +var _0x33be=['CreateReportAgentPreview','../client','createHistory','campaign','Request'];(function(_0x372047,_0x7f5c2b){var _0x44f282=function(_0x5a3d1c){while(--_0x5a3d1c){_0x372047['push'](_0x372047['shift']());}};_0x44f282(++_0x7f5c2b);}(_0x33be,0x12d));var _0xe33b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x33be[_0x4b369d];return _0x571a98;};'use strict';var client=require(_0xe33b('0x0'));exports[_0xe33b('0x1')]=function(_0x4f5a84){return function(){_0x4f5a84[_0xe33b('0x2')]=_0x4f5a84['queue'];return client[_0xe33b('0x3')](_0xe33b('0x4'),{'body':_0x4f5a84,'log':_0xe33b('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index bfca223..267acd7 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6f12=['Request','CreateAttachment','../client'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6f12,0x86));var _0x26f1=function(_0x2e28a3,_0x4678c2){_0x2e28a3=_0x2e28a3-0x0;var _0x54ec2e=_0x6f12[_0x2e28a3];return _0x54ec2e;};'use strict';var client=require(_0x26f1('0x0'));exports['create']=function(_0x3b6007){return client[_0x26f1('0x1')](_0x26f1('0x2'),{'body':_0x3b6007,'log':_0x26f1('0x2')});}; \ No newline at end of file +var _0x171c=['CreateAttachment','../client','create','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x171c,0x16d));var _0xc171=function(_0x4f23fb,_0x13424a){_0x4f23fb=_0x4f23fb-0x0;var _0x51fd97=_0x171c[_0x4f23fb];return _0x51fd97;};'use strict';var client=require(_0xc171('0x0'));exports[_0xc171('0x1')]=function(_0x16bd08){return client[_0xc171('0x2')](_0xc171('0x3'),{'body':_0x16bd08,'log':_0xc171('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index d890a63..8e675ab 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x270f18,_0x8155e9){var _0x39d745=function(_0x294bdd){while(--_0x294bdd){_0x270f18['push'](_0x270f18['shift']());}};_0x39d745(++_0x8155e9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc4aa[_0xfae23b];return _0x200640;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x21aea9,_0x4cc2c3){var _0x233ea8=function(_0x1e86e9){while(--_0x1e86e9){_0x21aea9['push'](_0x21aea9['shift']());}};_0x233ea8(++_0x4cc2c3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xc4aa[_0x1928c9];return _0x51b5fb;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 38ae327..97db348 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bfb=['../client','createContact','Request','CreateCmContact','GetCmContact'];(function(_0x436a4a,_0x6430c1){var _0x591a73=function(_0x3a951e){while(--_0x3a951e){_0x436a4a['push'](_0x436a4a['shift']());}};_0x591a73(++_0x6430c1);}(_0x9bfb,0x1b8));var _0xb9bf=function(_0x21d383,_0x71056d){_0x21d383=_0x21d383-0x0;var _0x3ea4a5=_0x9bfb[_0x21d383];return _0x3ea4a5;};'use strict';var client=require(_0xb9bf('0x0'));exports[_0xb9bf('0x1')]=function(_0x27e353){return function(){return client[_0xb9bf('0x2')](_0xb9bf('0x3'),{'body':_0x27e353,'log':'CreateCmContact'});};};exports['getContacts']=function(_0x39e297){return function(){return client[_0xb9bf('0x2')](_0xb9bf('0x4'),{'options':_0x39e297,'log':_0xb9bf('0x4')});};}; \ No newline at end of file +var _0xdde0=['../client','createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x27cd7f,_0x3e1ce4){var _0x23b7fa=function(_0x255ddf){while(--_0x255ddf){_0x27cd7f['push'](_0x27cd7f['shift']());}};_0x23b7fa(++_0x3e1ce4);}(_0xdde0,0x1e6));var _0x0dde=function(_0x541095,_0x1c21ab){_0x541095=_0x541095-0x0;var _0x57224f=_0xdde0[_0x541095];return _0x57224f;};'use strict';var client=require(_0x0dde('0x0'));exports[_0x0dde('0x1')]=function(_0x51ca77){return function(){return client[_0x0dde('0x2')]('CreateCmContact',{'body':_0x51ca77,'log':_0x0dde('0x3')});};};exports[_0x0dde('0x4')]=function(_0x4e937b){return function(){return client[_0x0dde('0x2')]('GetCmContact',{'options':_0x4e937b,'log':_0x0dde('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 135d16d..aeb713b 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfc9b=['YYYY-MM-DD\x20HH:mm:ss','priority','DESC','scheduledat','ASC','getContactDialerIvr','CmContact','moveContactManagedDialer','campaign','queue','MoveContactManagedDialer','ContactId','countReScheduled','CountReScheduled','getContactPreview','User','Agent','name','VoiceQueue','Queue','getCmHopper','getContactRecallMe','GetContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','getContacts','Request','GetCmHopper','Contact','updateContacts','UpdateCmHopper','format','ListId','VoiceQueueId','CampaignId','rescheduleContact','destroyContact','DestroyCmHopper','GetContactDialer'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xfc9b,0x74));var _0xbfc9=function(_0x4548b7,_0x1133e2){_0x4548b7=_0x4548b7-0x0;var _0x12fdc9=_0xfc9b[_0x4548b7];return _0x12fdc9;};'use strict';var client=require(_0xbfc9('0x0'));var moment=require(_0xbfc9('0x1'));exports[_0xbfc9('0x2')]=function(_0x38f482,_0x29639e){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x4'),{'options':{'where':{'VoiceQueueId':_0x38f482},'include':[{'model':'CmContact','as':_0xbfc9('0x5')}],'limit':_0x29639e,'raw':![]},'log':'getCmHopper'});};};exports[_0xbfc9('0x6')]=function(_0x1f1a3f,_0x523ff1,_0x1dbece){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x7'),{'body':_0x1f1a3f,'options':{'where':{'VoiceQueueId':_0x523ff1,'scheduledat':{'$lte':moment()[_0xbfc9('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'limit':_0x1dbece},'log':_0xbfc9('0x7')});};};exports['rescheduleContact']=function(_0x32bee5){return client['Request'](_0xbfc9('0x7'),{'body':_0x32bee5,'options':{'where':{'ContactId':_0x32bee5['ContactId'],'ListId':_0x32bee5[_0xbfc9('0x9')],'VoiceQueueId':_0x32bee5[_0xbfc9('0xa')],'CampaignId':_0x32bee5[_0xbfc9('0xb')]}},'log':_0xbfc9('0xc')});};exports[_0xbfc9('0xd')]=function(_0x20ded8,_0x540738,_0x1776a5){return function(){return client[_0xbfc9('0x3')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x20ded8,'ListId':_0x540738,'ContactId':_0x1776a5}},'log':_0xbfc9('0xe')});};};exports['getContactDialer']=function(_0x40500b,_0x259940,_0x128af6,_0x2a5c78){return client['Request'](_0xbfc9('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x40500b,'active':![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x259940}}]},'order':[[_0xbfc9('0x11'),_0xbfc9('0x12')],[_0xbfc9('0x13'),_0x2a5c78],['id',_0xbfc9('0x14')]],'raw':!![],'limit':_0x128af6},'log':_0xbfc9('0xf')});};exports[_0xbfc9('0x15')]=function(_0x42cacd,_0x3dd866,_0x1b6218){return client[_0xbfc9('0x3')](_0xbfc9('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x42cacd,'active':![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))}},'include':[{'model':_0xbfc9('0x16'),'as':_0xbfc9('0x5')}],'order':[[_0xbfc9('0x11'),_0xbfc9('0x12')],[_0xbfc9('0x13'),_0x1b6218],['id',_0xbfc9('0x14')]],'raw':!![],'limit':_0x3dd866},'log':'GetContactDialerIvr'});};exports[_0xbfc9('0x17')]=function(_0x1217f4,_0x237897){_0x1217f4[_0xbfc9('0x18')]=_0x1217f4[_0xbfc9('0x19')];return client[_0xbfc9('0x3')](_0xbfc9('0x1a'),{'body':_0x1217f4,'options':{'where':{'ContactId':_0x1217f4[_0xbfc9('0x1b')],'ListId':_0x1217f4[_0xbfc9('0x9')],'VoiceQueueId':_0x1217f4[_0xbfc9('0xa')],'CampaignId':_0x1217f4[_0xbfc9('0xb')],'active':_0x237897?undefined:!![]}},'log':_0xbfc9('0x1a')});};exports[_0xbfc9('0x1c')]=function(_0x7012e0){return client['Request'](_0xbfc9('0x1d'),{'options':{'where':{'VoiceQueueId':_0x7012e0['id']?_0x7012e0['id']||null:null}},'log':_0xbfc9('0x1c')});};exports[_0xbfc9('0x1e')]=function(_0x2ba7d6){return function(){return client[_0xbfc9('0x3')]('GetCmHopperPreview',{'options':{'where':{'id':_0x2ba7d6},'include':[{'model':_0xbfc9('0x16'),'as':_0xbfc9('0x5')},{'model':_0xbfc9('0x1f'),'as':_0xbfc9('0x20'),'attributes':['id',_0xbfc9('0x21')]},{'model':_0xbfc9('0x22'),'as':_0xbfc9('0x23'),'attributes':['id',_0xbfc9('0x21')]}],'raw':!![]},'log':_0xbfc9('0x24')});};};exports['unlockContact']=function(_0x5185e5,_0x555cf1,_0x1a02e3){return client['Request']('UpdateCmHopper',{'body':_0x5185e5,'options':{'where':{'id':_0x555cf1},'limit':_0x1a02e3},'log':_0xbfc9('0x7')});};exports[_0xbfc9('0x25')]=function(_0xfa1abc,_0x14e1ac){return function(){return client[_0xbfc9('0x3')](_0xbfc9('0x26'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xfa1abc,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xbfc9('0x8')](_0xbfc9('0x10'))},'UserId':{'$in':_0x14e1ac}},'order':[[_0xbfc9('0x11'),'DESC'],[_0xbfc9('0x13'),_0xbfc9('0x12')],['id',_0xbfc9('0x14')]],'include':[{'model':'CmContact','as':_0xbfc9('0x5')},{'model':_0xbfc9('0x1f'),'as':_0xbfc9('0x20'),'attributes':['id',_0xbfc9('0x21'),_0xbfc9('0x27')]}],'group':_0xbfc9('0x28'),'raw':!![]},'log':_0xbfc9('0xf')});};};exports[_0xbfc9('0x29')]=function(_0x23f96f,_0x157dd9){return client['Request']('ResetActiveCalls',{'body':_0x23f96f,'options':_0x157dd9||{},'log':_0xbfc9('0x2a')});};exports[_0xbfc9('0x2b')]=function(_0x3c1838,_0x1e2a10,_0x38bbd9){return function(){return client[_0xbfc9('0x3')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x3c1838,'interval':_0x1e2a10,'availableAgentsIds':_0x38bbd9}},'log':_0xbfc9('0x2b')});};}; \ No newline at end of file +var _0xdc0d=['GetCmHopperPreview','User','Agent','name','VoiceQueue','Queue','getContactRecallMe','GetContactRecallMe','priority','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request','GetCmHopper','CmContact','Contact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ContactId','ListId','VoiceQueueId','CampaignId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','DESC','scheduledat','ASC','moveContactManagedDialer','campaign','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview'];(function(_0x144d33,_0x3168cf){var _0x34c16c=function(_0x12e8f3){while(--_0x12e8f3){_0x144d33['push'](_0x144d33['shift']());}};_0x34c16c(++_0x3168cf);}(_0xdc0d,0x1db));var _0xddc0=function(_0x5f203f,_0x58f982){_0x5f203f=_0x5f203f-0x0;var _0x328803=_0xdc0d[_0x5f203f];return _0x328803;};'use strict';var client=require(_0xddc0('0x0'));var moment=require(_0xddc0('0x1'));exports['getContacts']=function(_0x3b6966,_0x558a1a){return function(){return client[_0xddc0('0x2')](_0xddc0('0x3'),{'options':{'where':{'VoiceQueueId':_0x3b6966},'include':[{'model':_0xddc0('0x4'),'as':_0xddc0('0x5')}],'limit':_0x558a1a,'raw':![]},'log':_0xddc0('0x6')});};};exports[_0xddc0('0x7')]=function(_0x2d915c,_0x39a8da,_0x20f5a9){return function(){return client['Request'](_0xddc0('0x8'),{'body':_0x2d915c,'options':{'where':{'VoiceQueueId':_0x39a8da,'scheduledat':{'$lte':moment()[_0xddc0('0x9')](_0xddc0('0xa'))}},'limit':_0x20f5a9},'log':_0xddc0('0x8')});};};exports[_0xddc0('0xb')]=function(_0x3aad0e){return client['Request'](_0xddc0('0x8'),{'body':_0x3aad0e,'options':{'where':{'ContactId':_0x3aad0e[_0xddc0('0xc')],'ListId':_0x3aad0e[_0xddc0('0xd')],'VoiceQueueId':_0x3aad0e[_0xddc0('0xe')],'CampaignId':_0x3aad0e[_0xddc0('0xf')]}},'log':_0xddc0('0xb')});};exports[_0xddc0('0x10')]=function(_0x36cf5e,_0x53075e,_0x142874){return function(){return client[_0xddc0('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x36cf5e,'ListId':_0x53075e,'ContactId':_0x142874}},'log':_0xddc0('0x11')});};};exports[_0xddc0('0x12')]=function(_0xde1081,_0x39d44c,_0x2faa0d,_0x53fb88){return client[_0xddc0('0x2')](_0xddc0('0x13'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0xde1081,'active':![],'scheduledat':{'$lte':moment()['format'](_0xddc0('0xa'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x39d44c}}]},'order':[['priority',_0xddc0('0x14')],[_0xddc0('0x15'),_0x53fb88],['id',_0xddc0('0x16')]],'raw':!![],'limit':_0x2faa0d},'log':'GetContactDialer'});};exports['getContactDialerIvr']=function(_0x22cf96,_0x367bff,_0x39b837){return client[_0xddc0('0x2')]('GetContactDialer',{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x22cf96,'active':![],'scheduledat':{'$lte':moment()[_0xddc0('0x9')](_0xddc0('0xa'))}},'include':[{'model':_0xddc0('0x4'),'as':_0xddc0('0x5')}],'order':[['priority',_0xddc0('0x14')],[_0xddc0('0x15'),_0x39b837],['id',_0xddc0('0x16')]],'raw':!![],'limit':_0x367bff},'log':'GetContactDialerIvr'});};exports[_0xddc0('0x17')]=function(_0x530b02,_0x2accad){_0x530b02[_0xddc0('0x18')]=_0x530b02['queue'];return client[_0xddc0('0x2')](_0xddc0('0x19'),{'body':_0x530b02,'options':{'where':{'ContactId':_0x530b02[_0xddc0('0xc')],'ListId':_0x530b02['ListId'],'VoiceQueueId':_0x530b02[_0xddc0('0xe')],'CampaignId':_0x530b02['CampaignId'],'active':_0x2accad?undefined:!![]}},'log':_0xddc0('0x19')});};exports['countReScheduled']=function(_0x1f08f4){return client['Request'](_0xddc0('0x1a'),{'options':{'where':{'VoiceQueueId':_0x1f08f4['id']?_0x1f08f4['id']||null:null}},'log':_0xddc0('0x1b')});};exports[_0xddc0('0x1c')]=function(_0x552614){return function(){return client[_0xddc0('0x2')](_0xddc0('0x1d'),{'options':{'where':{'id':_0x552614},'include':[{'model':_0xddc0('0x4'),'as':'Contact'},{'model':_0xddc0('0x1e'),'as':_0xddc0('0x1f'),'attributes':['id',_0xddc0('0x20')]},{'model':_0xddc0('0x21'),'as':_0xddc0('0x22'),'attributes':['id','name']}],'raw':!![]},'log':_0xddc0('0x6')});};};exports['unlockContact']=function(_0x5387cc,_0x5a8429,_0x2ac8bb){return client[_0xddc0('0x2')](_0xddc0('0x8'),{'body':_0x5387cc,'options':{'where':{'id':_0x5a8429},'limit':_0x2ac8bb},'log':_0xddc0('0x8')});};exports[_0xddc0('0x23')]=function(_0x410d9b,_0x279ac2){return function(){return client[_0xddc0('0x2')](_0xddc0('0x24'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x410d9b,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0xddc0('0x9')](_0xddc0('0xa'))},'UserId':{'$in':_0x279ac2}},'order':[[_0xddc0('0x25'),'DESC'],[_0xddc0('0x15'),_0xddc0('0x14')],['id',_0xddc0('0x16')]],'include':[{'model':_0xddc0('0x4'),'as':_0xddc0('0x5')},{'model':_0xddc0('0x1e'),'as':_0xddc0('0x1f'),'attributes':['id',_0xddc0('0x20'),'voicePause']}],'group':_0xddc0('0x26'),'raw':!![]},'log':_0xddc0('0x13')});};};exports[_0xddc0('0x27')]=function(_0x401278,_0x162512){return client['Request']('ResetActiveCalls',{'body':_0x401278,'options':_0x162512||{},'log':_0xddc0('0x28')});};exports[_0xddc0('0x29')]=function(_0x56e1cb,_0xe784e,_0x614f06){return function(){return client['Request']('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x56e1cb,'interval':_0xe784e,'availableAgentsIds':_0x614f06}},'log':_0xddc0('0x29')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index 1ec7a9f..9ed43af 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x26e5=['swapAdditionalPhones','Request','SwapAdditionalPhones','IncrementPreviewCounters','../client','verifyAdditionalPhones','VerifyAdditionalPhones'];(function(_0x336a6e,_0x4c454f){var _0x4c0b21=function(_0x3590a0){while(--_0x3590a0){_0x336a6e['push'](_0x336a6e['shift']());}};_0x4c0b21(++_0x4c454f);}(_0x26e5,0xc8));var _0x526e=function(_0x46b1c9,_0x169f87){_0x46b1c9=_0x46b1c9-0x0;var _0x17569c=_0x26e5[_0x46b1c9];return _0x17569c;};'use strict';var client=require(_0x526e('0x0'));exports[_0x526e('0x1')]=function(_0x547571,_0x58ad0b,_0x1aaddb){return client['Request'](_0x526e('0x2'),{'body':_0x547571,'reason':_0x58ad0b,'entity':_0x1aaddb,'log':'VerifyAdditionalPhones'});};exports[_0x526e('0x3')]=function(_0x771c7e,_0x521a75,_0x36e017){return client[_0x526e('0x4')](_0x526e('0x5'),{'body':_0x771c7e,'duration':_0x521a75,'waitTime':_0x36e017,'log':_0x526e('0x5')});};exports['incrementPreviewCounters']=function(_0x3b48b4){return function(){return client['Request'](_0x526e('0x6'),{'body':_0x3b48b4,'log':_0x526e('0x6')});};}; \ No newline at end of file +var _0x8b8b=['VerifyAdditionalPhones','SwapAdditionalPhones','incrementPreviewCounters','IncrementPreviewCounters','../client','verifyAdditionalPhones','Request'];(function(_0x3ae4be,_0x4b6f08){var _0x1c5ae3=function(_0x82a260){while(--_0x82a260){_0x3ae4be['push'](_0x3ae4be['shift']());}};_0x1c5ae3(++_0x4b6f08);}(_0x8b8b,0x19a));var _0xb8b8=function(_0x522d17,_0x4fed4f){_0x522d17=_0x522d17-0x0;var _0x4422a6=_0x8b8b[_0x522d17];return _0x4422a6;};'use strict';var client=require(_0xb8b8('0x0'));exports[_0xb8b8('0x1')]=function(_0x11f4fc,_0x2f48cd,_0x5870e3){return client[_0xb8b8('0x2')](_0xb8b8('0x3'),{'body':_0x11f4fc,'reason':_0x2f48cd,'entity':_0x5870e3,'log':_0xb8b8('0x3')});};exports['swapAdditionalPhones']=function(_0x597722,_0xef40f9,_0x47d893){return client[_0xb8b8('0x2')]('SwapAdditionalPhones',{'body':_0x597722,'duration':_0xef40f9,'waitTime':_0x47d893,'log':_0xb8b8('0x4')});};exports[_0xb8b8('0x5')]=function(_0x1a999c){return function(){return client[_0xb8b8('0x2')]('IncrementPreviewCounters',{'body':_0x1a999c,'log':_0xb8b8('0x6')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index b53eea6..544e11f 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba20=['Request','phone','GetCmHopperBlack','GetCmHopperBlackIvr','checkIsBlackList'];(function(_0x323759,_0xb30675){var _0x4dab95=function(_0x44443f){while(--_0x44443f){_0x323759['push'](_0x323759['shift']());}};_0x4dab95(++_0xb30675);}(_0xba20,0x18f));var _0x0ba2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xba20[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x0ba2('0x0')]=function(_0xa38a3f){return client[_0x0ba2('0x1')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0xa38a3f['VoiceQueueId'],'phone':_0xa38a3f[_0x0ba2('0x2')]},'raw':![]},'log':_0x0ba2('0x3')});};exports['checkIsBlackListIvr']=function(_0x23e997){return client[_0x0ba2('0x1')](_0x0ba2('0x3'),{'options':{'where':{'CampaignId':_0x23e997['CampaignId'],'phone':_0x23e997[_0x0ba2('0x2')]},'raw':![]},'log':_0x0ba2('0x4')});}; \ No newline at end of file +var _0xd02e=['../client','checkIsBlackList','Request','GetCmHopperBlack','VoiceQueueId','phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x5ce229,_0x4ee93f){var _0xb01988=function(_0x5181dd){while(--_0x5181dd){_0x5ce229['push'](_0x5ce229['shift']());}};_0xb01988(++_0x4ee93f);}(_0xd02e,0x18c));var _0xed02=function(_0x5dc654,_0xc35062){_0x5dc654=_0x5dc654-0x0;var _0x550a18=_0xd02e[_0x5dc654];return _0x550a18;};'use strict';var client=require(_0xed02('0x0'));exports[_0xed02('0x1')]=function(_0x2662dd){return client[_0xed02('0x2')](_0xed02('0x3'),{'options':{'where':{'VoiceQueueId':_0x2662dd[_0xed02('0x4')],'phone':_0x2662dd[_0xed02('0x5')]},'raw':![]},'log':_0xed02('0x3')});};exports[_0xed02('0x6')]=function(_0x512d45){return client[_0xed02('0x2')](_0xed02('0x3'),{'options':{'where':{'CampaignId':_0x512d45[_0xed02('0x7')],'phone':_0x512d45[_0xed02('0x5')]},'raw':![]},'log':_0xed02('0x8')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 2a253a6..dd6acb4 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce71=['Request','CreateCmHopperFinal','../client','createContact','campaign'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xce71,0x93));var _0x1ce7=function(_0x54b074,_0x595ad7){_0x54b074=_0x54b074-0x0;var _0x176513=_0xce71[_0x54b074];return _0x176513;};'use strict';var client=require(_0x1ce7('0x0'));exports[_0x1ce7('0x1')]=function(_0x1a59b3){return function(){_0x1a59b3[_0x1ce7('0x2')]=_0x1a59b3['queue'];return client[_0x1ce7('0x3')]('CreateCmHopperFinal',{'body':_0x1a59b3,'log':_0x1ce7('0x4')});};}; \ No newline at end of file +var _0xb5e6=['../client','createContact','campaign','queue','Request','CreateCmHopperFinal'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb5e6,0x11a));var _0x6b5e=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb5e6[_0x502c7d];return _0x30b7ed;};'use strict';var client=require(_0x6b5e('0x0'));exports[_0x6b5e('0x1')]=function(_0x372559){return function(){_0x372559[_0x6b5e('0x2')]=_0x372559[_0x6b5e('0x3')];return client[_0x6b5e('0x4')](_0x6b5e('0x5'),{'body':_0x372559,'log':_0x6b5e('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index f6445b3..82e16f4 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8801=['format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','day','endOf','GetCampaignHopperHistory','ivr','../client','moment','createHistory','queue','Request','CreateCmHopperHistory','avgHandleTime','minutes'];(function(_0x27d958,_0x29ef87){var _0x53e63e=function(_0x4130ec){while(--_0x4130ec){_0x27d958['push'](_0x27d958['shift']());}};_0x53e63e(++_0x29ef87);}(_0x8801,0xf7));var _0x1880=function(_0x3b8c6b,_0x52dff9){_0x3b8c6b=_0x3b8c6b-0x0;var _0x36b9d6=_0x8801[_0x3b8c6b];return _0x36b9d6;};'use strict';var client=require(_0x1880('0x0'));var moment=require(_0x1880('0x1'));exports[_0x1880('0x2')]=function(_0x3e8699){_0x3e8699['campaign']=_0x3e8699[_0x1880('0x3')];return client[_0x1880('0x4')](_0x1880('0x5'),{'body':_0x3e8699,'log':_0x1880('0x5')});};exports[_0x1880('0x6')]=function(_0x270947){return client[_0x1880('0x4')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()['subtract'](_0x270947,_0x1880('0x7'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x1880('0x8')](_0x1880('0x9'))]}},'raw':![]},'log':_0x1880('0xa')});};exports[_0x1880('0xb')]=function(){return function(){return client['Request'](_0x1880('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1880('0xd'))['format'](_0x1880('0x9')),moment()[_0x1880('0xe')](_0x1880('0xd'))[_0x1880('0x8')](_0x1880('0x9'))]},'campaigntype':_0x1880('0x3')},'raw':![]},'log':_0x1880('0xc')});};};exports['getCampaignHopperHistory']=function(){return function(){return client['Request'](_0x1880('0xf'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x1880('0xd'))[_0x1880('0x8')](_0x1880('0x9')),moment()[_0x1880('0xe')](_0x1880('0xd'))[_0x1880('0x8')](_0x1880('0x9'))]},'campaigntype':_0x1880('0x10')},'raw':![]},'log':_0x1880('0xf')});};}; \ No newline at end of file +var _0xd8a3=['campaign','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','YYYY-MM-DD\x20HH:mm:ss','format','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','endOf','day','GetCampaignHopperHistory','../client','moment','createHistory'];(function(_0x2b2b33,_0x56606f){var _0x229157=function(_0x52b63e){while(--_0x52b63e){_0x2b2b33['push'](_0x2b2b33['shift']());}};_0x229157(++_0x56606f);}(_0xd8a3,0x1ea));var _0x3d8a=function(_0x2614a5,_0x226c88){_0x2614a5=_0x2614a5-0x0;var _0x324a66=_0xd8a3[_0x2614a5];return _0x324a66;};'use strict';var client=require(_0x3d8a('0x0'));var moment=require(_0x3d8a('0x1'));exports[_0x3d8a('0x2')]=function(_0x149990){_0x149990[_0x3d8a('0x3')]=_0x149990['queue'];return client[_0x3d8a('0x4')](_0x3d8a('0x5'),{'body':_0x149990,'log':'CreateCmHopperHistory'});};exports[_0x3d8a('0x6')]=function(_0x564b7d){return client[_0x3d8a('0x4')](_0x3d8a('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0x3d8a('0x8')](_0x564b7d,'minutes')['format'](_0x3d8a('0x9')),moment()[_0x3d8a('0xa')](_0x3d8a('0x9'))]}},'raw':![]},'log':'GetCmHopperHistory'});};exports[_0x3d8a('0xb')]=function(){return function(){return client[_0x3d8a('0x4')](_0x3d8a('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3d8a('0xd')]('day')[_0x3d8a('0xa')](_0x3d8a('0x9')),moment()[_0x3d8a('0xe')](_0x3d8a('0xf'))[_0x3d8a('0xa')](_0x3d8a('0x9'))]},'campaigntype':'queue'},'raw':![]},'log':_0x3d8a('0xc')});};};exports['getCampaignHopperHistory']=function(){return function(){return client[_0x3d8a('0x4')](_0x3d8a('0x10'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x3d8a('0xd')](_0x3d8a('0xf'))[_0x3d8a('0xa')](_0x3d8a('0x9')),moment()[_0x3d8a('0xe')](_0x3d8a('0xf'))[_0x3d8a('0xa')](_0x3d8a('0x9'))]},'campaigntype':'ivr'},'raw':![]},'log':'GetCampaignHopperHistory'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 25140e1..0cd788d 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x02a7=['name','description','ecm','headerinfo','localstationid','minrate','maxrate','faxdetect','tech','TrunkId','callerid','getFaxAccount','notify','NotifyFaxAccount','getFaxAccounts','Request','GetFaxAccount'];(function(_0x4abcd2,_0x3a7538){var _0x3e072f=function(_0x345749){while(--_0x345749){_0x4abcd2['push'](_0x4abcd2['shift']());}};_0x3e072f(++_0x3a7538);}(_0x02a7,0x1a6));var _0x702a=function(_0x1f2e84,_0x43bfb1){_0x1f2e84=_0x1f2e84-0x0;var _0x52700c=_0x02a7[_0x1f2e84];return _0x52700c;};'use strict';var client=require('../client');exports[_0x702a('0x0')]=function(){return function(){return client[_0x702a('0x1')](_0x702a('0x2'),{'options':{'raw':![],'attributes':['id',_0x702a('0x3'),_0x702a('0x4'),_0x702a('0x5'),_0x702a('0x6'),_0x702a('0x7'),_0x702a('0x8'),_0x702a('0x9'),'modem','gateway',_0x702a('0xa'),'t38timeout',_0x702a('0xb'),_0x702a('0xc'),'ListId','key'],'include':[{'model':'Trunk','as':'Trunk','attributes':['id',_0x702a('0x3'),_0x702a('0xd'),'active']}]},'log':_0x702a('0xe')});};};exports[_0x702a('0xf')]=function(_0xebee92,_0x25920c){return client[_0x702a('0x1')](_0x702a('0x10'),{'account':{'id':_0xebee92},'body':_0x25920c,'log':_0x702a('0x10')});}; \ No newline at end of file +var _0xf9ac=['../client','GetFaxAccount','name','ecm','localstationid','modem','gateway','faxdetect','t38timeout','TrunkId','ListId','Trunk','callerid','getFaxAccount','Request'];(function(_0x1f8b41,_0x35bcaa){var _0x187d93=function(_0x2c782e){while(--_0x2c782e){_0x1f8b41['push'](_0x1f8b41['shift']());}};_0x187d93(++_0x35bcaa);}(_0xf9ac,0x87));var _0xcf9a=function(_0xfb6e79,_0x305867){_0xfb6e79=_0xfb6e79-0x0;var _0x1197d1=_0xf9ac[_0xfb6e79];return _0x1197d1;};'use strict';var client=require(_0xcf9a('0x0'));exports['getFaxAccounts']=function(){return function(){return client['Request'](_0xcf9a('0x1'),{'options':{'raw':![],'attributes':['id',_0xcf9a('0x2'),'description',_0xcf9a('0x3'),'headerinfo',_0xcf9a('0x4'),'minrate','maxrate',_0xcf9a('0x5'),_0xcf9a('0x6'),_0xcf9a('0x7'),_0xcf9a('0x8'),'tech',_0xcf9a('0x9'),_0xcf9a('0xa'),'key'],'include':[{'model':'Trunk','as':_0xcf9a('0xb'),'attributes':['id','name',_0xcf9a('0xc'),'active']}]},'log':_0xcf9a('0xd')});};};exports['notify']=function(_0x3d93ad,_0x683ab8){return client[_0xcf9a('0xe')]('NotifyFaxAccount',{'account':{'id':_0x3d93ad},'body':_0x683ab8,'log':'NotifyFaxAccount'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 38eae8d..d268cd7 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34f4=['update','Request','UpdateFaxMessage','../client'];(function(_0x1b8326,_0x44c46a){var _0x408488=function(_0x52e696){while(--_0x52e696){_0x1b8326['push'](_0x1b8326['shift']());}};_0x408488(++_0x44c46a);}(_0x34f4,0xeb));var _0x434f=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x34f4[_0xb0f7c3];return _0x28ea68;};'use strict';var client=require(_0x434f('0x0'));exports[_0x434f('0x1')]=function(_0x23b23b,_0x5bd970){return client[_0x434f('0x2')](_0x434f('0x3'),{'body':_0x5bd970,'options':{'where':{'AttachmentId':_0x23b23b}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0x2b6f=['Request','UpdateFaxMessage','../client','update'];(function(_0x28cfe2,_0x4af564){var _0x4a4e55=function(_0x12c797){while(--_0x12c797){_0x28cfe2['push'](_0x28cfe2['shift']());}};_0x4a4e55(++_0x4af564);}(_0x2b6f,0x14a));var _0xf2b6=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x2b6f[_0x8c43de];return _0xa6591b;};'use strict';var client=require(_0xf2b6('0x0'));exports[_0xf2b6('0x1')]=function(_0x17ccaf,_0x3f5cbb){return client[_0xf2b6('0x2')](_0xf2b6('0x3'),{'body':_0x3f5cbb,'options':{'where':{'AttachmentId':_0x17ccaf}},'log':_0xf2b6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 10e14f3..f3f06f0 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2611=['Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','username','password','remoteUri','authType','type','serverUrl','DeskField','Subjects','content','variableName','Variable','name','key','keyContent','Fields','idField','customField'];(function(_0xd0b415,_0x149675){var _0x2bdf2c=function(_0x59fbfa){while(--_0x59fbfa){_0xd0b415['push'](_0xd0b415['shift']());}};_0x2bdf2c(++_0x149675);}(_0x2611,0x12d));var _0x1261=function(_0xcdf816,_0x21b6f){_0xcdf816=_0xcdf816-0x0;var _0x4bdf3d=_0x2611[_0xcdf816];return _0x4bdf3d;};'use strict';var client=require(_0x1261('0x0'));exports[_0x1261('0x1')]=function(){return function(_0x2d83bc){return client[_0x1261('0x2')](_0x1261('0x3'),{'options':{'raw':![],'attributes':['id','name','description',_0x1261('0x4'),_0x1261('0x5'),_0x1261('0x6'),_0x1261('0x7'),_0x1261('0x8'),_0x1261('0x9')],'include':[{'model':'DeskConfiguration','as':'Configurations','attributes':['id','name'],'include':[{'model':_0x1261('0xa'),'as':_0x1261('0xb'),'attributes':['id','type',_0x1261('0xc'),_0x1261('0xd')],'include':[{'model':_0x1261('0xe'),'as':_0x1261('0xe'),'attributes':['id',_0x1261('0xf')]}]},{'model':'DeskField','as':'Descriptions','attributes':['id',_0x1261('0x8'),'content',_0x1261('0x10'),'keyType',_0x1261('0x11'),_0x1261('0xd')],'include':[{'model':_0x1261('0xe'),'as':_0x1261('0xe'),'attributes':['id',_0x1261('0xf')]}]},{'model':_0x1261('0xa'),'as':_0x1261('0x12'),'attributes':['id',_0x1261('0x8'),_0x1261('0xc'),_0x1261('0x13'),'nameField',_0x1261('0x14'),'variableName'],'include':[{'model':_0x1261('0xe'),'as':_0x1261('0xe'),'attributes':['id',_0x1261('0xf')]}]},{'model':_0x1261('0x15'),'as':_0x1261('0x16'),'attributes':['id',_0x1261('0xf')]}]}]},'log':_0x1261('0x3')});};}; \ No newline at end of file +var _0x5897=['content','variableName','Variable','Descriptions','type','key','keyType','keyContent','Fields','idField','nameField','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','description','username','password','remoteUri','authType','serverUrl','DeskConfiguration','Configurations','DeskField','Subjects'];(function(_0x318fcb,_0x550aa0){var _0x1fa10c=function(_0x38fe4a){while(--_0x38fe4a){_0x318fcb['push'](_0x318fcb['shift']());}};_0x1fa10c(++_0x550aa0);}(_0x5897,0xca));var _0x7589=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0x5897[_0xd050c6];return _0x7278a;};'use strict';var client=require(_0x7589('0x0'));exports[_0x7589('0x1')]=function(){return function(_0x22df09){return client[_0x7589('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x7589('0x3'),_0x7589('0x4'),_0x7589('0x5'),_0x7589('0x6'),_0x7589('0x7'),_0x7589('0x8'),'type',_0x7589('0x9')],'include':[{'model':_0x7589('0xa'),'as':_0x7589('0xb'),'attributes':['id',_0x7589('0x3')],'include':[{'model':_0x7589('0xc'),'as':_0x7589('0xd'),'attributes':['id','type',_0x7589('0xe'),_0x7589('0xf')],'include':[{'model':_0x7589('0x10'),'as':'Variable','attributes':['id',_0x7589('0x3')]}]},{'model':_0x7589('0xc'),'as':_0x7589('0x11'),'attributes':['id',_0x7589('0x12'),_0x7589('0xe'),_0x7589('0x13'),_0x7589('0x14'),_0x7589('0x15'),_0x7589('0xf')],'include':[{'model':'Variable','as':_0x7589('0x10'),'attributes':['id',_0x7589('0x3')]}]},{'model':_0x7589('0xc'),'as':_0x7589('0x16'),'attributes':['id','type',_0x7589('0xe'),_0x7589('0x17'),_0x7589('0x18'),'customField',_0x7589('0xf')],'include':[{'model':_0x7589('0x10'),'as':_0x7589('0x10'),'attributes':['id',_0x7589('0x3')]}]},{'model':'Tag','as':_0x7589('0x19'),'attributes':['id',_0x7589('0x3')]}]}]},'log':_0x7589('0x1a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index 463bce9..caf9ef2 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xefe2=['../../client','getDynamics365Accounts','Request','GetDynamics365Account','username','remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Dynamics365Configuration','Configurations','name','moduleCreate','additionalSearchContact','openNewTab','type','Variable','Dynamics365Field','Descriptions','content','key','keyType','keyContent','idField','nameField','variableName','data2','data5','data7'];(function(_0x1589f8,_0x14d0e3){var _0x2f89e1=function(_0x707386){while(--_0x707386){_0x1589f8['push'](_0x1589f8['shift']());}};_0x2f89e1(++_0x14d0e3);}(_0xefe2,0xd9));var _0x2efe=function(_0x21b831,_0x2de10a){_0x21b831=_0x21b831-0x0;var _0x31354f=_0xefe2[_0x21b831];return _0x31354f;};'use strict';var client=require(_0x2efe('0x0'));exports[_0x2efe('0x1')]=function(){return function(_0x521ca2){return client[_0x2efe('0x2')](_0x2efe('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x2efe('0x4'),'password',_0x2efe('0x5'),_0x2efe('0x6'),_0x2efe('0x7'),_0x2efe('0x8'),_0x2efe('0x9'),'description',_0x2efe('0xa')],'include':[{'model':_0x2efe('0xb'),'as':_0x2efe('0xc'),'attributes':['id',_0x2efe('0xd'),'ticketType',_0x2efe('0xe'),_0x2efe('0xf'),_0x2efe('0x10')],'include':[{'model':'Dynamics365Field','as':'Subjects','attributes':['id',_0x2efe('0x11'),'content','variableName'],'include':[{'model':_0x2efe('0x12'),'as':_0x2efe('0x12'),'attributes':['id',_0x2efe('0xd')]}]},{'model':_0x2efe('0x13'),'as':_0x2efe('0x14'),'attributes':['id',_0x2efe('0x11'),_0x2efe('0x15'),_0x2efe('0x16'),_0x2efe('0x17'),_0x2efe('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x2efe('0x12'),'attributes':['id',_0x2efe('0xd')]}]},{'model':'Dynamics365Field','as':'Fields','attributes':['id',_0x2efe('0x11'),'content',_0x2efe('0x19'),_0x2efe('0x1a'),'customField',_0x2efe('0x1b')],'include':[{'model':_0x2efe('0x12'),'as':'Variable','attributes':['id',_0x2efe('0xd')]}]}]},{'model':'CloudProvider','as':'CloudProvider','attributes':['id',_0x2efe('0x1c'),_0x2efe('0x1d'),_0x2efe('0x1e')]}]},'log':_0x2efe('0x3')});};}; \ No newline at end of file +var _0xe6e4=['type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','customField','CloudProvider','data5','data7','../../client','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','clientId','description','modernAuthentication','Configurations','ticketType','moduleCreate','additionalSearchContact','Dynamics365Field','Subjects'];(function(_0x332102,_0x3e23b4){var _0x20e752=function(_0x2ff97d){while(--_0x2ff97d){_0x332102['push'](_0x332102['shift']());}};_0x20e752(++_0x3e23b4);}(_0xe6e4,0xc1));var _0x4e6e=function(_0x24e056,_0x257d1a){_0x24e056=_0x24e056-0x0;var _0x57b6ea=_0xe6e4[_0x24e056];return _0x57b6ea;};'use strict';var client=require(_0x4e6e('0x0'));exports[_0x4e6e('0x1')]=function(){return function(_0x324f98){return client[_0x4e6e('0x2')](_0x4e6e('0x3'),{'options':{'raw':![],'attributes':['id',_0x4e6e('0x4'),_0x4e6e('0x5'),_0x4e6e('0x6'),_0x4e6e('0x7'),'tenantId',_0x4e6e('0x8'),'clientSecret','serverUrl',_0x4e6e('0x9'),_0x4e6e('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0x4e6e('0xb'),'attributes':['id',_0x4e6e('0x4'),_0x4e6e('0xc'),_0x4e6e('0xd'),_0x4e6e('0xe'),'openNewTab'],'include':[{'model':_0x4e6e('0xf'),'as':_0x4e6e('0x10'),'attributes':['id',_0x4e6e('0x11'),_0x4e6e('0x12'),_0x4e6e('0x13')],'include':[{'model':'Variable','as':_0x4e6e('0x14'),'attributes':['id',_0x4e6e('0x4')]}]},{'model':'Dynamics365Field','as':_0x4e6e('0x15'),'attributes':['id',_0x4e6e('0x11'),_0x4e6e('0x12'),_0x4e6e('0x16'),_0x4e6e('0x17'),_0x4e6e('0x18'),_0x4e6e('0x13')],'include':[{'model':'Variable','as':_0x4e6e('0x14'),'attributes':['id',_0x4e6e('0x4')]}]},{'model':_0x4e6e('0xf'),'as':_0x4e6e('0x19'),'attributes':['id',_0x4e6e('0x11'),_0x4e6e('0x12'),'idField','nameField',_0x4e6e('0x1a'),_0x4e6e('0x13')],'include':[{'model':'Variable','as':_0x4e6e('0x14'),'attributes':['id',_0x4e6e('0x4')]}]}]},{'model':_0x4e6e('0x1b'),'as':_0x4e6e('0x1b'),'attributes':['id','data2',_0x4e6e('0x1c'),_0x4e6e('0x1d')]}]},'log':_0x4e6e('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 9db4b4a..a0d1d79 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9bc3=['FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','Fields','customField','../../client','getFreshdeskAccounts','GetFreshdeskAccount','name','username','apiKey','serverUrl','FreshdeskConfiguration','Configurations'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x9bc3,0x137));var _0x39bc=function(_0x4bbabf,_0x3e3454){_0x4bbabf=_0x4bbabf-0x0;var _0x159343=_0x9bc3[_0x4bbabf];return _0x159343;};'use strict';var client=require(_0x39bc('0x0'));exports[_0x39bc('0x1')]=function(){return function(_0x3a68f5){return client['Request'](_0x39bc('0x2'),{'options':{'raw':![],'attributes':['id',_0x39bc('0x3'),_0x39bc('0x4'),_0x39bc('0x5'),'remoteUri',_0x39bc('0x6')],'include':[{'model':_0x39bc('0x7'),'as':_0x39bc('0x8'),'attributes':['id',_0x39bc('0x3')],'include':[{'model':'Tag','attributes':['id',_0x39bc('0x3')]},{'model':_0x39bc('0x9'),'as':_0x39bc('0xa'),'attributes':['id',_0x39bc('0xb'),_0x39bc('0xc'),_0x39bc('0xd')],'include':[{'model':_0x39bc('0xe'),'as':_0x39bc('0xe'),'attributes':['id','name']}]},{'model':_0x39bc('0x9'),'as':_0x39bc('0xf'),'attributes':['id',_0x39bc('0xb'),_0x39bc('0xc'),_0x39bc('0x10'),_0x39bc('0x11'),'keyContent','variableName'],'include':[{'model':_0x39bc('0xe'),'as':_0x39bc('0xe'),'attributes':['id','name']}]},{'model':_0x39bc('0x9'),'as':_0x39bc('0x12'),'attributes':['id',_0x39bc('0xb'),'content','idField','nameField',_0x39bc('0x13'),'variableName'],'include':[{'model':'Variable','as':_0x39bc('0xe'),'attributes':['id',_0x39bc('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file +var _0x2f38=['keyContent','nameField','customField','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','username','apiKey','remoteUri','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType'];(function(_0x10d88b,_0x11a58b){var _0x1ddf35=function(_0x3d8975){while(--_0x3d8975){_0x10d88b['push'](_0x10d88b['shift']());}};_0x1ddf35(++_0x11a58b);}(_0x2f38,0x1a7));var _0x82f3=function(_0xcd07c8,_0x88958){_0xcd07c8=_0xcd07c8-0x0;var _0x3d333b=_0x2f38[_0xcd07c8];return _0x3d333b;};'use strict';var client=require('../../client');exports[_0x82f3('0x0')]=function(){return function(_0x5c2f9c){return client[_0x82f3('0x1')](_0x82f3('0x2'),{'options':{'raw':![],'attributes':['id',_0x82f3('0x3'),_0x82f3('0x4'),_0x82f3('0x5'),_0x82f3('0x6'),'serverUrl'],'include':[{'model':_0x82f3('0x7'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x82f3('0x8'),'attributes':['id',_0x82f3('0x3')]},{'model':_0x82f3('0x9'),'as':_0x82f3('0xa'),'attributes':['id',_0x82f3('0xb'),_0x82f3('0xc'),_0x82f3('0xd')],'include':[{'model':_0x82f3('0xe'),'as':_0x82f3('0xe'),'attributes':['id',_0x82f3('0x3')]}]},{'model':_0x82f3('0x9'),'as':_0x82f3('0xf'),'attributes':['id',_0x82f3('0xb'),'content',_0x82f3('0x10'),_0x82f3('0x11'),_0x82f3('0x12'),_0x82f3('0xd')],'include':[{'model':_0x82f3('0xe'),'as':_0x82f3('0xe'),'attributes':['id',_0x82f3('0x3')]}]},{'model':'FreshdeskField','as':'Fields','attributes':['id',_0x82f3('0xb'),_0x82f3('0xc'),'idField',_0x82f3('0x13'),_0x82f3('0x14'),_0x82f3('0xd')],'include':[{'model':_0x82f3('0xe'),'as':_0x82f3('0xe'),'attributes':['id',_0x82f3('0x3')]}]}]}]},'log':'GetFreshdeskAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index c1d9506..8777a69 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbd0a=['Subjects','content','variableName','Variable','Descriptions','type','key','keyContent','GetFreshsalesccount','../../client','username','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','name','FreshsalesField'];(function(_0x244e21,_0x3298c6){var _0x34f9a0=function(_0x596c86){while(--_0x596c86){_0x244e21['push'](_0x244e21['shift']());}};_0x34f9a0(++_0x3298c6);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x73ce95,_0x40506e){_0x73ce95=_0x73ce95-0x0;var _0x2d3bdb=_0xbd0a[_0x73ce95];return _0x2d3bdb;};'use strict';var client=require(_0xabd0('0x0'));exports['getFreshsalesAccounts']=function(){return function(_0x3b0fc0){return client['Request']('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id','name',_0xabd0('0x1'),_0xabd0('0x2'),_0xabd0('0x3'),_0xabd0('0x4')],'include':[{'model':_0xabd0('0x5'),'as':_0xabd0('0x6'),'attributes':['id',_0xabd0('0x7')],'include':[{'model':_0xabd0('0x8'),'as':_0xabd0('0x9'),'attributes':['id','type',_0xabd0('0xa'),_0xabd0('0xb')],'include':[{'model':_0xabd0('0xc'),'as':'Variable','attributes':['id',_0xabd0('0x7')]}]},{'model':'FreshsalesField','as':_0xabd0('0xd'),'attributes':['id',_0xabd0('0xe'),_0xabd0('0xa'),_0xabd0('0xf'),'keyType',_0xabd0('0x10'),'variableName'],'include':[{'model':_0xabd0('0xc'),'as':_0xabd0('0xc'),'attributes':['id',_0xabd0('0x7')]}]}]}]},'log':_0xabd0('0x11')});};}; \ No newline at end of file +var _0x90ec=['../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','username','apiKey','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','type','content','Variable','Descriptions','key','keyType','variableName'];(function(_0x39fd11,_0x5d7883){var _0x302799=function(_0x4a0615){while(--_0x4a0615){_0x39fd11['push'](_0x39fd11['shift']());}};_0x302799(++_0x5d7883);}(_0x90ec,0x1d4));var _0xc90e=function(_0x35d559,_0x5c72b1){_0x35d559=_0x35d559-0x0;var _0x1d6da2=_0x90ec[_0x35d559];return _0x1d6da2;};'use strict';var client=require(_0xc90e('0x0'));exports[_0xc90e('0x1')]=function(){return function(_0x54f2e6){return client[_0xc90e('0x2')](_0xc90e('0x3'),{'options':{'raw':![],'attributes':['id',_0xc90e('0x4'),_0xc90e('0x5'),_0xc90e('0x6'),'remoteUri',_0xc90e('0x7')],'include':[{'model':_0xc90e('0x8'),'as':_0xc90e('0x9'),'attributes':['id','name'],'include':[{'model':_0xc90e('0xa'),'as':'Subjects','attributes':['id',_0xc90e('0xb'),_0xc90e('0xc'),'variableName'],'include':[{'model':_0xc90e('0xd'),'as':_0xc90e('0xd'),'attributes':['id',_0xc90e('0x4')]}]},{'model':_0xc90e('0xa'),'as':_0xc90e('0xe'),'attributes':['id',_0xc90e('0xb'),_0xc90e('0xc'),_0xc90e('0xf'),_0xc90e('0x10'),'keyContent',_0xc90e('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index ee28f62..ffdaa1b 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48bc=['GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','serverUrl','SalesforceConfiguration','Configurations','moduleSearch','ticketType','leadId','additionalSearchContact','additionalSearchLead','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts'];(function(_0x2b082b,_0x3f64d2){var _0x4ceb4c=function(_0xc98350){while(--_0xc98350){_0x2b082b['push'](_0x2b082b['shift']());}};_0x4ceb4c(++_0x3f64d2);}(_0x48bc,0x1b6));var _0xc48b=function(_0x17e458,_0x2f5e63){_0x17e458=_0x17e458-0x0;var _0x2c5f02=_0x48bc[_0x17e458];return _0x2c5f02;};'use strict';var client=require(_0xc48b('0x0'));exports[_0xc48b('0x1')]=function(){return function(_0x11f046){return client['Request'](_0xc48b('0x2'),{'options':{'raw':![],'attributes':['id',_0xc48b('0x3'),_0xc48b('0x4'),_0xc48b('0x5'),_0xc48b('0x6'),_0xc48b('0x7'),_0xc48b('0x8'),'securityToken',_0xc48b('0x9'),'type'],'include':[{'model':_0xc48b('0xa'),'as':_0xc48b('0xb'),'attributes':['id','name',_0xc48b('0xc'),'moduleCreate',_0xc48b('0xd'),_0xc48b('0xe'),'additionalSearchAccount',_0xc48b('0xf'),_0xc48b('0x10')],'include':[{'model':_0xc48b('0x11'),'as':_0xc48b('0x12'),'include':[{'model':_0xc48b('0x13'),'as':_0xc48b('0x13'),'attributes':['id',_0xc48b('0x3')]}]},{'model':_0xc48b('0x11'),'as':_0xc48b('0x14'),'include':[{'model':_0xc48b('0x13'),'as':_0xc48b('0x13'),'attributes':['id',_0xc48b('0x3')]}]},{'model':'SalesforceField','as':_0xc48b('0x15'),'include':[{'model':_0xc48b('0x13'),'as':_0xc48b('0x13'),'attributes':['id','name']}]}]}]},'log':_0xc48b('0x2')});};}; \ No newline at end of file +var _0xe296=['Configurations','moduleSearch','moduleCreate','ticketType','SalesforceField','Subjects','Variable','Descriptions','Fields','../../client','getSalesforceAccounts','Request','GetSalesforceAccount','name','username','remoteUri','clientSecret','type','SalesforceConfiguration'];(function(_0x5bfa42,_0x46ec12){var _0x5b1a31=function(_0x2e1e7e){while(--_0x2e1e7e){_0x5bfa42['push'](_0x5bfa42['shift']());}};_0x5b1a31(++_0x46ec12);}(_0xe296,0x1d1));var _0x6e29=function(_0x2b97ed,_0x33f871){_0x2b97ed=_0x2b97ed-0x0;var _0x357d6e=_0xe296[_0x2b97ed];return _0x357d6e;};'use strict';var client=require(_0x6e29('0x0'));exports[_0x6e29('0x1')]=function(){return function(_0x4ffe3a){return client[_0x6e29('0x2')](_0x6e29('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e29('0x4'),_0x6e29('0x5'),'password',_0x6e29('0x6'),'clientId',_0x6e29('0x7'),'securityToken','serverUrl',_0x6e29('0x8')],'include':[{'model':_0x6e29('0x9'),'as':_0x6e29('0xa'),'attributes':['id',_0x6e29('0x4'),_0x6e29('0xb'),_0x6e29('0xc'),_0x6e29('0xd'),'leadId','additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':_0x6e29('0xe'),'as':_0x6e29('0xf'),'include':[{'model':_0x6e29('0x10'),'as':_0x6e29('0x10'),'attributes':['id',_0x6e29('0x4')]}]},{'model':'SalesforceField','as':_0x6e29('0x11'),'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x6e29('0xe'),'as':_0x6e29('0x12'),'include':[{'model':'Variable','as':_0x6e29('0x10'),'attributes':['id',_0x6e29('0x4')]}]}]}]},'log':_0x6e29('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 077b53c..ed7b011 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31f0=['remoteUri','Subjects','type','content','variableName','Variable','ServicenowField','Descriptions','key','keyType','Fields','idField','nameField','customField','GetServicenowkAccount','../../client','GetServicenowAccount','name','description','username','email'];(function(_0x2092d7,_0x13840a){var _0x5a67ba=function(_0x1db31d){while(--_0x1db31d){_0x2092d7['push'](_0x2092d7['shift']());}};_0x5a67ba(++_0x13840a);}(_0x31f0,0xb7));var _0x031f=function(_0x1d4269,_0x5cb030){_0x1d4269=_0x1d4269-0x0;var _0x342d45=_0x31f0[_0x1d4269];return _0x342d45;};'use strict';var client=require(_0x031f('0x0'));exports['getServicenowAccounts']=function(){return function(_0xc4ca54){return client['Request'](_0x031f('0x1'),{'options':{'raw':![],'attributes':['id',_0x031f('0x2'),_0x031f('0x3'),_0x031f('0x4'),'password',_0x031f('0x5'),_0x031f('0x6'),'serverUrl'],'include':[{'model':'ServicenowConfiguration','as':'Configurations','attributes':['id',_0x031f('0x2')],'include':[{'model':'ServicenowField','as':_0x031f('0x7'),'attributes':['id',_0x031f('0x8'),_0x031f('0x9'),_0x031f('0xa')],'include':[{'model':'Variable','as':_0x031f('0xb'),'attributes':['id',_0x031f('0x2')]}]},{'model':_0x031f('0xc'),'as':_0x031f('0xd'),'attributes':['id',_0x031f('0x8'),_0x031f('0x9'),_0x031f('0xe'),_0x031f('0xf'),'keyContent',_0x031f('0xa')],'include':[{'model':_0x031f('0xb'),'as':_0x031f('0xb'),'attributes':['id',_0x031f('0x2')]}]},{'model':_0x031f('0xc'),'as':_0x031f('0x10'),'attributes':['id',_0x031f('0x8'),'content',_0x031f('0x11'),_0x031f('0x12'),_0x031f('0x13'),_0x031f('0xa')],'include':[{'model':_0x031f('0xb'),'as':'Variable','attributes':['id','name']}]}]}]},'log':_0x031f('0x14')});};}; \ No newline at end of file +var _0xc6ac=['GetServicenowAccount','name','description','username','password','email','remoteUri','serverUrl','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyContent','Fields','nameField','customField','GetServicenowkAccount','../../client','getServicenowAccounts','Request'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0xc6ac,0x15b));var _0xcc6a=function(_0x284907,_0x155309){_0x284907=_0x284907-0x0;var _0x49da09=_0xc6ac[_0x284907];return _0x49da09;};'use strict';var client=require(_0xcc6a('0x0'));exports[_0xcc6a('0x1')]=function(){return function(_0x1b6e92){return client[_0xcc6a('0x2')](_0xcc6a('0x3'),{'options':{'raw':![],'attributes':['id',_0xcc6a('0x4'),_0xcc6a('0x5'),_0xcc6a('0x6'),_0xcc6a('0x7'),_0xcc6a('0x8'),_0xcc6a('0x9'),_0xcc6a('0xa')],'include':[{'model':_0xcc6a('0xb'),'as':_0xcc6a('0xc'),'attributes':['id','name'],'include':[{'model':_0xcc6a('0xd'),'as':_0xcc6a('0xe'),'attributes':['id',_0xcc6a('0xf'),'content',_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]},{'model':_0xcc6a('0xd'),'as':'Descriptions','attributes':['id',_0xcc6a('0xf'),_0xcc6a('0x12'),_0xcc6a('0x13'),'keyType',_0xcc6a('0x14'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':'Variable','attributes':['id','name']}]},{'model':_0xcc6a('0xd'),'as':_0xcc6a('0x15'),'attributes':['id',_0xcc6a('0xf'),'content','idField',_0xcc6a('0x16'),_0xcc6a('0x17'),_0xcc6a('0x10')],'include':[{'model':_0xcc6a('0x11'),'as':_0xcc6a('0x11'),'attributes':['id',_0xcc6a('0x4')]}]}]}]},'log':_0xcc6a('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index 83a094e..017e3e5 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['GetSugarcrmAccount','getSugarcrmAccounts','Request','name','username','remoteUri','serverUrl','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','key','keyContent','customField'];(function(_0x26c15d,_0xdeb587){var _0x237b0d=function(_0x2442f8){while(--_0x2442f8){_0x26c15d['push'](_0x26c15d['shift']());}};_0x237b0d(++_0xdeb587);}(_0x2032,0xd9));var _0x2203=function(_0x1c2ceb,_0x2b27eb){_0x1c2ceb=_0x1c2ceb-0x0;var _0x179b92=_0x2032[_0x1c2ceb];return _0x179b92;};'use strict';var client=require('../../client');exports[_0x2203('0x0')]=function(){return function(_0x1e103d){return client[_0x2203('0x1')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x2203('0x2'),_0x2203('0x3'),'password',_0x2203('0x4'),_0x2203('0x5')],'include':[{'model':_0x2203('0x6'),'as':_0x2203('0x7'),'attributes':['id',_0x2203('0x2')],'include':[{'model':_0x2203('0x8'),'as':_0x2203('0x9'),'attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc')],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id','name']}]},{'model':_0x2203('0x8'),'as':'Descriptions','attributes':['id',_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xe'),'keyType',_0x2203('0xf'),'variableName'],'include':[{'model':_0x2203('0xd'),'as':'Variable','attributes':['id',_0x2203('0x2')]}]},{'model':_0x2203('0x8'),'as':'Fields','attributes':['id','type','content','idField','nameField',_0x2203('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x2203('0xd'),'attributes':['id',_0x2203('0x2')]}]}]}]},'log':_0x2203('0x11')});};}; \ No newline at end of file +var _0xdb28=['customField','GetSugarcrmAccount','../../client','getSugarcrmAccounts','Request','name','username','password','remoteUri','serverUrl','Configurations','type','content','variableName','Variable','SugarcrmField','key','keyContent','Fields','nameField'];(function(_0x288325,_0x26e4ff){var _0x3b9fd7=function(_0x1f2816){while(--_0x1f2816){_0x288325['push'](_0x288325['shift']());}};_0x3b9fd7(++_0x26e4ff);}(_0xdb28,0x106));var _0x8db2=function(_0x3c07d3,_0x446a59){_0x3c07d3=_0x3c07d3-0x0;var _0x4968e9=_0xdb28[_0x3c07d3];return _0x4968e9;};'use strict';var client=require(_0x8db2('0x0'));exports[_0x8db2('0x1')]=function(){return function(_0x1dc797){return client[_0x8db2('0x2')]('GetSugarcrmAccount',{'options':{'raw':![],'attributes':['id',_0x8db2('0x3'),_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7')],'include':[{'model':'SugarcrmConfiguration','as':_0x8db2('0x8'),'attributes':['id',_0x8db2('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x8db2('0x9'),_0x8db2('0xa'),_0x8db2('0xb')],'include':[{'model':_0x8db2('0xc'),'as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]},{'model':_0x8db2('0xd'),'as':'Descriptions','attributes':['id',_0x8db2('0x9'),_0x8db2('0xa'),_0x8db2('0xe'),'keyType',_0x8db2('0xf'),_0x8db2('0xb')],'include':[{'model':'Variable','as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]},{'model':_0x8db2('0xd'),'as':_0x8db2('0x10'),'attributes':['id',_0x8db2('0x9'),'content','idField',_0x8db2('0x11'),_0x8db2('0x12'),_0x8db2('0xb')],'include':[{'model':_0x8db2('0xc'),'as':_0x8db2('0xc'),'attributes':['id',_0x8db2('0x3')]}]}]}]},'log':_0x8db2('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index aee2e04..0bddd13 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc2c7=['keyContent','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','accessKey','serverUrl','VtigerConfiguration','VtigerField','content','variableName','Variable','Descriptions','type','key','keyType'];(function(_0x3b150c,_0x2f93f8){var _0x5cd414=function(_0x26305e){while(--_0x26305e){_0x3b150c['push'](_0x3b150c['shift']());}};_0x5cd414(++_0x2f93f8);}(_0xc2c7,0x72));var _0x7c2c=function(_0x4bcdfb,_0x4bfa8e){_0x4bcdfb=_0x4bcdfb-0x0;var _0x403181=_0xc2c7[_0x4bcdfb];return _0x403181;};'use strict';var client=require(_0x7c2c('0x0'));exports[_0x7c2c('0x1')]=function(){return function(_0x6aac1c){return client[_0x7c2c('0x2')](_0x7c2c('0x3'),{'options':{'raw':![],'attributes':['id',_0x7c2c('0x4'),_0x7c2c('0x5'),_0x7c2c('0x6'),_0x7c2c('0x7'),'remoteUri',_0x7c2c('0x8')],'include':[{'model':_0x7c2c('0x9'),'as':'Configurations','attributes':['id',_0x7c2c('0x4')],'include':[{'model':_0x7c2c('0xa'),'as':'Subjects','attributes':['id','type',_0x7c2c('0xb'),_0x7c2c('0xc')],'include':[{'model':_0x7c2c('0xd'),'as':_0x7c2c('0xd'),'attributes':['id',_0x7c2c('0x4')]}]},{'model':'VtigerField','as':_0x7c2c('0xe'),'attributes':['id',_0x7c2c('0xf'),_0x7c2c('0xb'),_0x7c2c('0x10'),_0x7c2c('0x11'),_0x7c2c('0x12'),'variableName'],'include':[{'model':_0x7c2c('0xd'),'as':_0x7c2c('0xd'),'attributes':['id',_0x7c2c('0x4')]}]},{'model':_0x7c2c('0xa'),'as':'Fields','attributes':['id',_0x7c2c('0xf'),_0x7c2c('0xb'),_0x7c2c('0x13'),_0x7c2c('0x14'),_0x7c2c('0x15'),'variableName'],'include':[{'model':_0x7c2c('0xd'),'as':'Variable','attributes':['id',_0x7c2c('0x4')]}]}]}]},'log':_0x7c2c('0x3')});};}; \ No newline at end of file +var _0xe856=['keyType','keyContent','Fields','idField','nameField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','accessKey','remoteUri','serverUrl','VtigerConfiguration','Configurations','VtigerField','Subjects','type','content','variableName','Variable','Descriptions','key'];(function(_0x17ee6c,_0x285dd3){var _0x2d599a=function(_0x3081ce){while(--_0x3081ce){_0x17ee6c['push'](_0x17ee6c['shift']());}};_0x2d599a(++_0x285dd3);}(_0xe856,0xc5));var _0x6e85=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0xe856[_0x422905];return _0x33dc6c;};'use strict';var client=require(_0x6e85('0x0'));exports[_0x6e85('0x1')]=function(){return function(_0x1a3077){return client[_0x6e85('0x2')](_0x6e85('0x3'),{'options':{'raw':![],'attributes':['id',_0x6e85('0x4'),_0x6e85('0x5'),'username',_0x6e85('0x6'),_0x6e85('0x7'),_0x6e85('0x8')],'include':[{'model':_0x6e85('0x9'),'as':_0x6e85('0xa'),'attributes':['id',_0x6e85('0x4')],'include':[{'model':_0x6e85('0xb'),'as':_0x6e85('0xc'),'attributes':['id',_0x6e85('0xd'),_0x6e85('0xe'),_0x6e85('0xf')],'include':[{'model':_0x6e85('0x10'),'as':_0x6e85('0x10'),'attributes':['id','name']}]},{'model':_0x6e85('0xb'),'as':_0x6e85('0x11'),'attributes':['id',_0x6e85('0xd'),_0x6e85('0xe'),_0x6e85('0x12'),_0x6e85('0x13'),_0x6e85('0x14'),_0x6e85('0xf')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0x6e85('0xb'),'as':_0x6e85('0x15'),'attributes':['id','type',_0x6e85('0xe'),_0x6e85('0x16'),_0x6e85('0x17'),'customField',_0x6e85('0xf')],'include':[{'model':_0x6e85('0x10'),'as':_0x6e85('0x10'),'attributes':['id',_0x6e85('0x4')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index c1fc03b..c5dba3a 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdf9=['Descriptions','key','keyType','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','password','token','serverUrl','type','ZendeskConfiguration','Tag','ZendeskField','Subjects','content','variableName','Variable'];(function(_0xb9e378,_0x2ba0ef){var _0x43b381=function(_0x3a466b){while(--_0x3a466b){_0xb9e378['push'](_0xb9e378['shift']());}};_0x43b381(++_0x2ba0ef);}(_0xcdf9,0x1be));var _0x9cdf=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xcdf9[_0x4e1d03];return _0x362d4b;};'use strict';var client=require(_0x9cdf('0x0'));exports[_0x9cdf('0x1')]=function(){return function(_0x4c1e19){return client[_0x9cdf('0x2')](_0x9cdf('0x3'),{'options':{'raw':![],'attributes':['id',_0x9cdf('0x4'),'username',_0x9cdf('0x5'),_0x9cdf('0x6'),'remoteUri','authType',_0x9cdf('0x7'),_0x9cdf('0x8')],'include':[{'model':_0x9cdf('0x9'),'as':'Configurations','attributes':['id',_0x9cdf('0x4')],'include':[{'model':_0x9cdf('0xa'),'attributes':['id',_0x9cdf('0x4')]},{'model':_0x9cdf('0xb'),'as':_0x9cdf('0xc'),'attributes':['id',_0x9cdf('0x8'),_0x9cdf('0xd'),_0x9cdf('0xe')],'include':[{'model':'Variable','as':_0x9cdf('0xf'),'attributes':['id',_0x9cdf('0x4')]}]},{'model':_0x9cdf('0xb'),'as':_0x9cdf('0x10'),'attributes':['id','type',_0x9cdf('0xd'),_0x9cdf('0x11'),_0x9cdf('0x12'),'keyContent',_0x9cdf('0xe')],'include':[{'model':_0x9cdf('0xf'),'as':'Variable','attributes':['id',_0x9cdf('0x4')]}]},{'model':_0x9cdf('0xb'),'as':'Fields','attributes':['id',_0x9cdf('0x8'),_0x9cdf('0xd'),_0x9cdf('0x13'),_0x9cdf('0x14'),_0x9cdf('0x15'),_0x9cdf('0xe')],'include':[{'model':_0x9cdf('0xf'),'as':'Variable','attributes':['id',_0x9cdf('0x4')]}]}]}]},'log':_0x9cdf('0x3')});};}; \ No newline at end of file +var _0x8b29=['ZendeskConfiguration','Configurations','Tag','content','variableName','Variable','ZendeskField','keyContent','Fields','customField','GetZendeskAccount','../../client','Request','name','password','token','remoteUri','authType','type'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x8b29,0x115));var _0x98b2=function(_0x32f7b1,_0x27dff9){_0x32f7b1=_0x32f7b1-0x0;var _0x59612e=_0x8b29[_0x32f7b1];return _0x59612e;};'use strict';var client=require(_0x98b2('0x0'));exports['getZendeskAccounts']=function(){return function(_0x1b31c1){return client[_0x98b2('0x1')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0x98b2('0x2'),'username',_0x98b2('0x3'),_0x98b2('0x4'),_0x98b2('0x5'),_0x98b2('0x6'),'serverUrl',_0x98b2('0x7')],'include':[{'model':_0x98b2('0x8'),'as':_0x98b2('0x9'),'attributes':['id',_0x98b2('0x2')],'include':[{'model':_0x98b2('0xa'),'attributes':['id',_0x98b2('0x2')]},{'model':'ZendeskField','as':'Subjects','attributes':['id',_0x98b2('0x7'),_0x98b2('0xb'),_0x98b2('0xc')],'include':[{'model':_0x98b2('0xd'),'as':'Variable','attributes':['id',_0x98b2('0x2')]}]},{'model':_0x98b2('0xe'),'as':'Descriptions','attributes':['id',_0x98b2('0x7'),_0x98b2('0xb'),'key','keyType',_0x98b2('0xf'),'variableName'],'include':[{'model':_0x98b2('0xd'),'as':_0x98b2('0xd'),'attributes':['id',_0x98b2('0x2')]}]},{'model':_0x98b2('0xe'),'as':_0x98b2('0x10'),'attributes':['id','type','content','idField','nameField',_0x98b2('0x11'),'variableName'],'include':[{'model':_0x98b2('0xd'),'as':_0x98b2('0xd'),'attributes':['id',_0x98b2('0x2')]}]}]}]},'log':_0x98b2('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index ab4a2f9..0c34dd9 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x08b9=['Configurations','moduleCreate','moduleSearch','Subjects','type','Variable','ZohoField','content','key','keyType','keyContent','variableName','Fields','idField','nameField','customField','getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','code','refreshToken','ZohoConfiguration'];(function(_0x4655e0,_0x59e0d6){var _0x46e632=function(_0x58b770){while(--_0x58b770){_0x4655e0['push'](_0x4655e0['shift']());}};_0x46e632(++_0x59e0d6);}(_0x08b9,0x160));var _0x908b=function(_0x436641,_0x4afca2){_0x436641=_0x436641-0x0;var _0x29e38f=_0x08b9[_0x436641];return _0x29e38f;};'use strict';var client=require('../../client');exports[_0x908b('0x0')]=function(){return function(_0x390414){return client[_0x908b('0x1')](_0x908b('0x2'),{'options':{'raw':![],'attributes':['id',_0x908b('0x3'),_0x908b('0x4'),_0x908b('0x5'),_0x908b('0x6'),_0x908b('0x7'),_0x908b('0x8'),'serverUrl',_0x908b('0x9'),_0x908b('0xa')],'include':[{'model':_0x908b('0xb'),'as':_0x908b('0xc'),'attributes':['id',_0x908b('0x3'),_0x908b('0xd'),_0x908b('0xe'),_0x908b('0x4')],'include':[{'model':'ZohoField','as':_0x908b('0xf'),'attributes':['id',_0x908b('0x10'),'content','variableName'],'include':[{'model':_0x908b('0x11'),'as':_0x908b('0x11'),'attributes':['id','name']}]},{'model':_0x908b('0x12'),'as':'Descriptions','attributes':['id',_0x908b('0x10'),_0x908b('0x13'),_0x908b('0x14'),_0x908b('0x15'),_0x908b('0x16'),_0x908b('0x17')],'include':[{'model':'Variable','as':_0x908b('0x11'),'attributes':['id',_0x908b('0x3')]}]},{'model':_0x908b('0x12'),'as':_0x908b('0x18'),'attributes':['id','type',_0x908b('0x13'),_0x908b('0x19'),_0x908b('0x1a'),_0x908b('0x1b'),_0x908b('0x17')],'include':[{'model':_0x908b('0x11'),'as':_0x908b('0x11'),'attributes':['id',_0x908b('0x3')]}]}]}]},'log':_0x908b('0x2')});};}; \ No newline at end of file +var _0x192f=['Fields','idField','nameField','customField','../../client','getZohoAccounts','GetZohoAccount','name','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','ZohoConfiguration','moduleCreate','moduleSearch','description','ZohoField','type','variableName','Variable','Descriptions','content','key','keyContent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x192f,0x148));var _0xf192=function(_0x20b9ac,_0x2b2e46){_0x20b9ac=_0x20b9ac-0x0;var _0x1772c8=_0x192f[_0x20b9ac];return _0x1772c8;};'use strict';var client=require(_0xf192('0x0'));exports[_0xf192('0x1')]=function(){return function(_0x4a1910){return client['Request'](_0xf192('0x2'),{'options':{'raw':![],'attributes':['id',_0xf192('0x3'),'description',_0xf192('0x4'),_0xf192('0x5'),_0xf192('0x6'),_0xf192('0x7'),_0xf192('0x8'),_0xf192('0x9'),_0xf192('0xa')],'include':[{'model':_0xf192('0xb'),'as':'Configurations','attributes':['id',_0xf192('0x3'),_0xf192('0xc'),_0xf192('0xd'),_0xf192('0xe')],'include':[{'model':_0xf192('0xf'),'as':'Subjects','attributes':['id',_0xf192('0x10'),'content',_0xf192('0x11')],'include':[{'model':_0xf192('0x12'),'as':'Variable','attributes':['id',_0xf192('0x3')]}]},{'model':_0xf192('0xf'),'as':_0xf192('0x13'),'attributes':['id',_0xf192('0x10'),_0xf192('0x14'),_0xf192('0x15'),'keyType',_0xf192('0x16'),'variableName'],'include':[{'model':_0xf192('0x12'),'as':'Variable','attributes':['id','name']}]},{'model':_0xf192('0xf'),'as':_0xf192('0x17'),'attributes':['id',_0xf192('0x10'),_0xf192('0x14'),_0xf192('0x18'),_0xf192('0x19'),_0xf192('0x1a'),_0xf192('0x11')],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]}]}]},'log':_0xf192('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index c362ec6..a7aea75 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x023b=['isArray','resolve','every','number','string','length','map','interval','concat','IntervalIftime','intervalIftime','../../../config/logger','dialer','../client','replace','trim','silly','intervalIftime\x20called\x20with'];(function(_0xb459b4,_0xf36423){var _0x51921a=function(_0x489db7){while(--_0x489db7){_0xb459b4['push'](_0xb459b4['shift']());}};_0x51921a(++_0xf36423);}(_0x023b,0xad));var _0xb023=function(_0x445941,_0xc5de89){_0x445941=_0x445941-0x0;var _0x3497f1=_0x023b[_0x445941];return _0x3497f1;};var logger=require(_0xb023('0x0'))(_0xb023('0x1'));var client=require(_0xb023('0x2'));function intervalIftime(_0x51d840,_0x7cc4bf){const _0x4df559=new Error()['stack'][_0xb023('0x3')](/^Error/,'')[_0xb023('0x4')]();logger[_0xb023('0x5')](_0xb023('0x6'),_0x51d840,_0x7cc4bf,_0x4df559);const _0x3351a6=Array[_0xb023('0x7')](_0x51d840);if(!_0x51d840||_0x3351a6&&_0x51d840['length']===0x0){return Promise[_0xb023('0x8')](![]);}else{var _0x48fac4=[];var _0x1e9749=[];var _0x47f4e3=_0x3351a6?_0x51d840:[_0x51d840];var _0x3dc99c=_0x47f4e3[_0xb023('0x9')](function(_0x343be6){return typeof _0x343be6===_0xb023('0xa');});var _0x4d58ed=_0x47f4e3[_0xb023('0x9')](function(_0x3e4c6a){return typeof _0x3e4c6a===_0xb023('0xb');});if(!_0x3dc99c&&!_0x4d58ed){_0x48fac4=_0x47f4e3['map'](function(_0x4e7226){return _0x4e7226['id'];});if(_0x48fac4[_0xb023('0xc')]===0x0){_0x1e9749=_0x47f4e3[_0xb023('0xd')](function(_0x4e0f7d){return _0x4e0f7d[_0xb023('0xe')];});}}else{if(_0x3dc99c){_0x48fac4=_0x48fac4[_0xb023('0xf')](_0x47f4e3);}if(_0x4d58ed){_0x1e9749=_0x1e9749[_0xb023('0xf')](_0x47f4e3);}}return client['Request'](_0xb023('0x10'),{'intervalIds':_0x48fac4,'intervals':_0x1e9749,'timezone':_0x7cc4bf,'log':_0xb023('0x10')});}}exports[_0xb023('0x11')]=intervalIftime; \ No newline at end of file +var _0xb374=['concat','Request','IntervalIftime','intervalIftime','../../../config/logger','../client','stack','replace','trim','silly','intervalIftime\x20called\x20with','length','number','every','string','map','interval'];(function(_0x59f644,_0x16665f){var _0x208d79=function(_0x5e03a6){while(--_0x5e03a6){_0x59f644['push'](_0x59f644['shift']());}};_0x208d79(++_0x16665f);}(_0xb374,0x103));var _0x4b37=function(_0x43ed18,_0x30f08e){_0x43ed18=_0x43ed18-0x0;var _0x46f6ec=_0xb374[_0x43ed18];return _0x46f6ec;};var logger=require(_0x4b37('0x0'))('dialer');var client=require(_0x4b37('0x1'));function intervalIftime(_0x1ca442,_0x761a09){const _0x308ff0=new Error()[_0x4b37('0x2')][_0x4b37('0x3')](/^Error/,'')[_0x4b37('0x4')]();logger[_0x4b37('0x5')](_0x4b37('0x6'),_0x1ca442,_0x761a09,_0x308ff0);const _0x3aa80d=Array['isArray'](_0x1ca442);if(!_0x1ca442||_0x3aa80d&&_0x1ca442[_0x4b37('0x7')]===0x0){return Promise['resolve'](![]);}else{var _0x20cf9b=[];var _0x122208=[];var _0x6166dd=_0x3aa80d?_0x1ca442:[_0x1ca442];var _0x315d3f=_0x6166dd['every'](function(_0x1f3183){return typeof _0x1f3183===_0x4b37('0x8');});var _0x4f6a55=_0x6166dd[_0x4b37('0x9')](function(_0x31aae1){return typeof _0x31aae1===_0x4b37('0xa');});if(!_0x315d3f&&!_0x4f6a55){_0x20cf9b=_0x6166dd[_0x4b37('0xb')](function(_0x289ee5){return _0x289ee5['id'];});if(_0x20cf9b[_0x4b37('0x7')]===0x0){_0x122208=_0x6166dd[_0x4b37('0xb')](function(_0x2913e6){return _0x2913e6[_0x4b37('0xc')];});}}else{if(_0x315d3f){_0x20cf9b=_0x20cf9b[_0x4b37('0xd')](_0x6166dd);}if(_0x4f6a55){_0x122208=_0x122208['concat'](_0x6166dd);}}return client[_0x4b37('0xe')](_0x4b37('0xf'),{'intervalIds':_0x20cf9b,'intervals':_0x122208,'timezone':_0x761a09,'log':_0x4b37('0xf')});}}exports[_0x4b37('0x10')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index 67579db..2a5fdc0 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1753=['uniqueid','CreateMemberReport','membername','endtime','starttime','outbound','dialstring','toNumber','moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','voice','isNil','interface','format','lastAssignedTo','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','agent','accountcode'];(function(_0x150e62,_0x1b584d){var _0xa25c4b=function(_0x106f2a){while(--_0x106f2a){_0x150e62['push'](_0x150e62['shift']());}};_0xa25c4b(++_0x1b584d);}(_0x1753,0xa4));var _0x3175=function(_0xfc357e,_0x21f04f){_0xfc357e=_0xfc357e-0x0;var _0x4e0cd7=_0x1753[_0xfc357e];return _0x4e0cd7;};'use strict';var moment=require(_0x3175('0x0'));var _=require('lodash');var util=require(_0x3175('0x1'));var client=require('../client');exports[_0x3175('0x2')]=function(_0x10ce63){var _0x2967f1=_0x10ce63[_0x3175('0x3')]||_0x10ce63[_0x3175('0x4')];return client['Request']('CreateMemberReport',{'body':{'channel':_0x3175('0x5'),'membername':_0x10ce63['lastAssignedTo'],'interface':_[_0x3175('0x6')](_0x10ce63[_0x3175('0x7')])?util[_0x3175('0x8')]('SIP/%s',_0x10ce63[_0x3175('0x9')]):_0x10ce63[_0x3175('0x7')],'type':_0x3175('0xa'),'enterAt':_0x10ce63['queuecallerleaveAt'],'exitAt':_0x2967f1,'duration':moment(_0x2967f1)['diff'](_0x10ce63[_0x3175('0xb')],_0x3175('0xc')),'data1':_0x3175('0xd'),'data2':_0x10ce63[_0x3175('0xe')],'data3':_0x10ce63[_0x3175('0xf')],'data4':null,'data5':_0x10ce63['queue'],'role':_0x3175('0x10'),'internal':_0x10ce63[_0x3175('0x11')]?_['toNumber'](_0x10ce63['accountcode']):undefined,'uniqueid':_0x10ce63[_0x3175('0x12')]},'log':_0x3175('0x13')});};exports['voiceDialReport']=function(_0x573e28){return client['Request']('CreateMemberReport',{'body':{'channel':_0x3175('0x5'),'membername':_0x573e28[_0x3175('0x14')],'interface':_0x573e28['interface'],'type':'TALKING','enterAt':_0x573e28['starttime'],'exitAt':_0x573e28[_0x3175('0x15')],'duration':moment(_0x573e28[_0x3175('0x15')])['diff'](_0x573e28[_0x3175('0x16')],_0x3175('0xc'))>=0x0?moment(_0x573e28[_0x3175('0x15')])['diff'](_0x573e28['starttime'],'seconds'):null,'data1':_0x3175('0x17'),'data2':_0x573e28[_0x3175('0x11')],'data3':_0x573e28['exten'],'data4':_0x573e28[_0x3175('0x18')]||null,'role':'agent','internal':_0x573e28[_0x3175('0x11')]?_[_0x3175('0x19')](_0x573e28[_0x3175('0x11')]):undefined,'uniqueid':_0x573e28['uniqueid']},'log':_0x3175('0x13')});}; \ No newline at end of file +var _0x1eb4=['toNumber','moment','lodash','util','../client','queuecallercompleteAt','Request','CreateMemberReport','lastAssignedTo','isNil','interface','SIP/%s','TALKING','diff','seconds','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','voice','membername','starttime','endtime','outbound','dialstring'];(function(_0x9b2bb0,_0x3965b1){var _0x2cdb3b=function(_0x177d75){while(--_0x177d75){_0x9b2bb0['push'](_0x9b2bb0['shift']());}};_0x2cdb3b(++_0x3965b1);}(_0x1eb4,0xa9));var _0x41eb=function(_0x20d400,_0x417891){_0x20d400=_0x20d400-0x0;var _0x3a99ab=_0x1eb4[_0x20d400];return _0x3a99ab;};'use strict';var moment=require(_0x41eb('0x0'));var _=require(_0x41eb('0x1'));var util=require(_0x41eb('0x2'));var client=require(_0x41eb('0x3'));exports['voiceQueueReport']=function(_0x367613){var _0xe1b671=_0x367613[_0x41eb('0x4')]||_0x367613['queuecallerexitAt'];return client[_0x41eb('0x5')](_0x41eb('0x6'),{'body':{'channel':'voice','membername':_0x367613[_0x41eb('0x7')],'interface':_[_0x41eb('0x8')](_0x367613[_0x41eb('0x9')])?util['format'](_0x41eb('0xa'),_0x367613['lastAssignedTo']):_0x367613['interface'],'type':_0x41eb('0xb'),'enterAt':_0x367613['queuecallerleaveAt'],'exitAt':_0xe1b671,'duration':moment(_0xe1b671)[_0x41eb('0xc')](_0x367613['queuecallerleaveAt'],_0x41eb('0xd')),'data1':'inbound','data2':_0x367613[_0x41eb('0xe')],'data3':_0x367613[_0x41eb('0xf')],'data4':null,'data5':_0x367613[_0x41eb('0x10')],'role':_0x41eb('0x11'),'internal':_0x367613[_0x41eb('0x12')]?_['toNumber'](_0x367613[_0x41eb('0x12')]):undefined,'uniqueid':_0x367613[_0x41eb('0x13')]},'log':_0x41eb('0x6')});};exports[_0x41eb('0x14')]=function(_0x21443f){return client[_0x41eb('0x5')](_0x41eb('0x6'),{'body':{'channel':_0x41eb('0x15'),'membername':_0x21443f[_0x41eb('0x16')],'interface':_0x21443f[_0x41eb('0x9')],'type':_0x41eb('0xb'),'enterAt':_0x21443f[_0x41eb('0x17')],'exitAt':_0x21443f['endtime'],'duration':moment(_0x21443f[_0x41eb('0x18')])[_0x41eb('0xc')](_0x21443f['starttime'],_0x41eb('0xd'))>=0x0?moment(_0x21443f[_0x41eb('0x18')])['diff'](_0x21443f[_0x41eb('0x17')],'seconds'):null,'data1':_0x41eb('0x19'),'data2':_0x21443f[_0x41eb('0x12')],'data3':_0x21443f[_0x41eb('0xf')],'data4':_0x21443f[_0x41eb('0x1a')]||null,'role':_0x41eb('0x11'),'internal':_0x21443f[_0x41eb('0x12')]?_[_0x41eb('0x1b')](_0x21443f[_0x41eb('0x12')]):undefined,'uniqueid':_0x21443f[_0x41eb('0x13')]},'log':_0x41eb('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 7b7dc08..b3d187b 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 _0x1f3c=['../client','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x1aea8c,_0x4bf3f3){var _0x4fb9bb=function(_0x53bc83){while(--_0x53bc83){_0x1aea8c['push'](_0x1aea8c['shift']());}};_0x4fb9bb(++_0x4bf3f3);}(_0x1f3c,0xd7));var _0xc1f3=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x1f3c[_0x5f0089];return _0x193892;};'use strict';var client=require(_0xc1f3('0x0'));exports[_0xc1f3('0x1')]=function(){return client[_0xc1f3('0x2')](_0xc1f3('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc1f3('0x4'),'previewRecallmeReminderInterval']},'log':'GetSettings'});}; \ No newline at end of file +var _0x4f31=['getSettings','ShowSetting','previewRecallmeReminderInterval','GetSettings','../client'];(function(_0x4256d9,_0x2f059e){var _0x3a56b9=function(_0x2efa60){while(--_0x2efa60){_0x4256d9['push'](_0x4256d9['shift']());}};_0x3a56b9(++_0x2f059e);}(_0x4f31,0x13f));var _0x14f3=function(_0x3d1de1,_0x16f0df){_0x3d1de1=_0x3d1de1-0x0;var _0x1cbd7c=_0x4f31[_0x3d1de1];return _0x1cbd7c;};'use strict';var client=require(_0x14f3('0x0'));exports[_0x14f3('0x1')]=function(){return client['Request'](_0x14f3('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x14f3('0x3')]},'log':_0x14f3('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 6aa1e03..c6226a5 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 _0x2d94=['name','html','Request','GetTemplate'];(function(_0x85d7a5,_0x106bb8){var _0x2c066d=function(_0x59c4f9){while(--_0x59c4f9){_0x85d7a5['push'](_0x85d7a5['shift']());}};_0x2c066d(++_0x106bb8);}(_0x2d94,0x86));var _0x42d9=function(_0x57fe11,_0x1878f7){_0x57fe11=_0x57fe11-0x0;var _0xef425a=_0x2d94[_0x57fe11];return _0xef425a;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x237fa2){return function(_0xe875ba){return client[_0x42d9('0x0')](_0x42d9('0x1'),{'options':{'raw':!![],'attributes':['id',_0x42d9('0x2'),_0x42d9('0x3')]},'log':_0x42d9('0x1')});};}; \ No newline at end of file +var _0x573c=['getTemplates','Request','GetTemplate','name','html','../client'];(function(_0x1daeaa,_0x297e73){var _0x2a6032=function(_0x11897b){while(--_0x11897b){_0x1daeaa['push'](_0x1daeaa['shift']());}};_0x2a6032(++_0x297e73);}(_0x573c,0x125));var _0xc573=function(_0x1b77f7,_0x5cc544){_0x1b77f7=_0x1b77f7-0x0;var _0x497fb4=_0x573c[_0x1b77f7];return _0x497fb4;};'use strict';var client=require(_0xc573('0x0'));exports[_0xc573('0x1')]=function(_0x4aa092){return function(_0x37072b){return client[_0xc573('0x2')](_0xc573('0x3'),{'options':{'raw':!![],'attributes':['id',_0xc573('0x4'),_0xc573('0x5')]},'log':_0xc573('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 22f4b7f..00ab3af 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 _0xd771=['Request','GetTrigger','name','AllConditions','field','operator','value','Condition','Action','Actions','data1','data2','data3','data5','data6','data7','../client','getTriggers'];(function(_0x59710f,_0x44c7f0){var _0xaae66a=function(_0x1c2397){while(--_0x1c2397){_0x59710f['push'](_0x59710f['shift']());}};_0xaae66a(++_0x44c7f0);}(_0xd771,0x10c));var _0x1d77=function(_0x40e29d,_0x4c28f8){_0x40e29d=_0x40e29d-0x0;var _0x24520d=_0xd771[_0x40e29d];return _0x24520d;};'use strict';var client=require(_0x1d77('0x0'));exports[_0x1d77('0x1')]=function(_0x1f53eb){return function(_0x31fc71){return client[_0x1d77('0x2')](_0x1d77('0x3'),{'options':{'raw':![],'attributes':['id',_0x1d77('0x4'),'channel','status'],'include':[{'model':'Condition','as':_0x1d77('0x5'),'attributes':['id',_0x1d77('0x6'),_0x1d77('0x7'),_0x1d77('0x8')]},{'model':_0x1d77('0x9'),'as':'AnyConditions','attributes':['id','field',_0x1d77('0x7'),_0x1d77('0x8')]},{'model':_0x1d77('0xa'),'as':_0x1d77('0xb'),'attributes':['id','action',_0x1d77('0xc'),_0x1d77('0xd'),_0x1d77('0xe'),'data4',_0x1d77('0xf'),_0x1d77('0x10'),_0x1d77('0x11')]}]},'log':_0x1d77('0x3')});};}; \ No newline at end of file +var _0x7e38=['Request','GetTrigger','name','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data5','data7','../client'];(function(_0x3b8751,_0x361a10){var _0x216a83=function(_0x17aeb8){while(--_0x17aeb8){_0x3b8751['push'](_0x3b8751['shift']());}};_0x216a83(++_0x361a10);}(_0x7e38,0x13a));var _0x87e3=function(_0x49a5e2,_0x268a5a){_0x49a5e2=_0x49a5e2-0x0;var _0xe5180b=_0x7e38[_0x49a5e2];return _0xe5180b;};'use strict';var client=require(_0x87e3('0x0'));exports['getTriggers']=function(_0x46c31a){return function(_0xaa04e0){return client[_0x87e3('0x1')](_0x87e3('0x2'),{'options':{'raw':![],'attributes':['id',_0x87e3('0x3'),'channel','status'],'include':[{'model':_0x87e3('0x4'),'as':_0x87e3('0x5'),'attributes':['id',_0x87e3('0x6'),_0x87e3('0x7'),_0x87e3('0x8')]},{'model':'Condition','as':_0x87e3('0x9'),'attributes':['id','field',_0x87e3('0x7'),_0x87e3('0x8')]},{'model':_0x87e3('0xa'),'as':_0x87e3('0xb'),'attributes':['id',_0x87e3('0xc'),'data1','data2','data3','data4',_0x87e3('0xd'),'data6',_0x87e3('0xe')]}]},'log':_0x87e3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index ebfd01e..2f0f461 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 _0x177a=['Request','GetTrunk','name','registry','defaultuser','../client'];(function(_0x3836ae,_0x33dcdb){var _0x4d4a64=function(_0x58810e){while(--_0x58810e){_0x3836ae['push'](_0x3836ae['shift']());}};_0x4d4a64(++_0x33dcdb);}(_0x177a,0xdd));var _0xa177=function(_0x3c5b89,_0x47a2ae){_0x3c5b89=_0x3c5b89-0x0;var _0x15063d=_0x177a[_0x3c5b89];return _0x15063d;};'use strict';var client=require(_0xa177('0x0'));exports['getTrunks']=function(_0x5ce606){return function(_0x3c21e0){return client[_0xa177('0x1')](_0xa177('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa177('0x3'),_0xa177('0x4'),_0xa177('0x5')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x6d6f=['Request','GetTrunk','registry'];(function(_0x582df7,_0x3d02cf){var _0x5081fd=function(_0x3f197c){while(--_0x3f197c){_0x582df7['push'](_0x582df7['shift']());}};_0x5081fd(++_0x3d02cf);}(_0x6d6f,0x159));var _0xf6d6=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x6d6f[_0x3e182f];return _0x23edc9;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x4cd1f2){return function(_0x2dc900){return client[_0xf6d6('0x0')](_0xf6d6('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xf6d6('0x2'),'defaultuser']},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 4a4077b..2ed3a61 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(_0x28306d,_0xe38571){var _0x212384=function(_0x287265){while(--_0x287265){_0x28306d['push'](_0x28306d['shift']());}};_0x212384(++_0xe38571);}(_0x9c44,0x178));var _0x49c4=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x9c44[_0x255d5b];return _0x3e141a;};'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(_0x93e811,_0x385377){var _0x2a0461=function(_0x5d47de){while(--_0x5d47de){_0x93e811['push'](_0x93e811['shift']());}};_0x2a0461(++_0x385377);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x255ac0,_0x3f6645){_0x255ac0=_0x255ac0-0x0;var _0x437bf1=_0xcb91[_0x255ac0];return _0x437bf1;};'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 bd96e62..543eba0 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 _0x1bd1=['../client','create','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x3b085,_0x250543){var _0x476a57=function(_0x480941){while(--_0x480941){_0x3b085['push'](_0x3b085['shift']());}};_0x476a57(++_0x250543);}(_0x1bd1,0x140));var _0x11bd=function(_0x4c29f7,_0x820749){_0x4c29f7=_0x4c29f7-0x0;var _0x2edc8e=_0x1bd1[_0x4c29f7];return _0x2edc8e;};'use strict';var client=require(_0x11bd('0x0'));exports[_0x11bd('0x1')]=function(_0x3cd890){return client['Request'](_0x11bd('0x2'),{'body':_0x3cd890,'log':_0x11bd('0x2')});};exports[_0x11bd('0x3')]=function(_0x39fb4a,_0x595387,_0x359029){return client['Request'](_0x11bd('0x4'),{'body':_0x39fb4a,'options':{'where':{'uniqueid':_0x595387,'interface':_0x359029,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file +var _0x33ef=['Request','CreateVoiceAgentReport','UpdateVoiceAgentReport','../client','create'];(function(_0x7ea5bc,_0x59b726){var _0x3484cf=function(_0x1e36cc){while(--_0x1e36cc){_0x7ea5bc['push'](_0x7ea5bc['shift']());}};_0x3484cf(++_0x59b726);}(_0x33ef,0xc6));var _0xf33e=function(_0x8dd85f,_0x102a4c){_0x8dd85f=_0x8dd85f-0x0;var _0x5d55ee=_0x33ef[_0x8dd85f];return _0x5d55ee;};'use strict';var client=require(_0xf33e('0x0'));exports[_0xf33e('0x1')]=function(_0x3a1ea8){return client[_0xf33e('0x2')]('CreateVoiceAgentReport',{'body':_0x3a1ea8,'log':_0xf33e('0x3')});};exports['update']=function(_0x5e228e,_0x2eb907,_0x71f8f2){return client[_0xf33e('0x2')](_0xf33e('0x4'),{'body':_0x5e228e,'options':{'where':{'uniqueid':_0x2eb907,'interface':_0x71f8f2,'agentcomplete':!![]}},'log':_0xf33e('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 48d16f0..2fba84d 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 _0x6d59=['create','Request','CreateVoiceCallReport','merge','context','DOCUMENTATION','getVoiceCallReports','outbound','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client'];(function(_0x546176,_0x2d3f51){var _0x25217e=function(_0x17fe6e){while(--_0x17fe6e){_0x546176['push'](_0x546176['shift']());}};_0x25217e(++_0x2d3f51);}(_0x6d59,0x14c));var _0x96d5=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x6d59[_0x465a0c];return _0x1e202e;};'use strict';var moment=require(_0x96d5('0x0'));var util=require(_0x96d5('0x1'));var _=require(_0x96d5('0x2'));var client=require(_0x96d5('0x3'));exports[_0x96d5('0x4')]=function(_0x200299){return client[_0x96d5('0x5')](_0x96d5('0x6'),{'body':_[_0x96d5('0x7')](_0x200299,{'source':_0x200299['calleridnum'],'destinationcontext':_0x200299[_0x96d5('0x8')],'callerid':_0x200299['callerid'],'amaflags':_0x96d5('0x9')}),'log':_0x96d5('0x6')});};exports[_0x96d5('0xa')]=function(){return function(){return client['Request']('GetVoiceCallReport',{'options':{'where':{'type':[_0x96d5('0xb')],'createdAt':{'$between':[moment()[_0x96d5('0xc')]('day')[_0x96d5('0xd')](_0x96d5('0xe')),moment()[_0x96d5('0xf')](_0x96d5('0x10'))['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type',_0x96d5('0x11'),_0x96d5('0x12'),_0x96d5('0x13')]},'log':_0x96d5('0x14')});};}; \ No newline at end of file +var _0x711c=['type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','../client','create','Request','CreateVoiceCallReport','merge','calleridnum','callerid','getVoiceCallReports','GetVoiceCallReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day'];(function(_0x530b95,_0x575518){var _0x482984=function(_0x32a100){while(--_0x32a100){_0x530b95['push'](_0x530b95['shift']());}};_0x482984(++_0x575518);}(_0x711c,0xec));var _0xc711=function(_0x337fb3,_0x458f30){_0x337fb3=_0x337fb3-0x0;var _0x34f370=_0x711c[_0x337fb3];return _0x34f370;};'use strict';var moment=require(_0xc711('0x0'));var util=require(_0xc711('0x1'));var _=require('lodash');var client=require(_0xc711('0x2'));exports[_0xc711('0x3')]=function(_0x5ef950){return client[_0xc711('0x4')](_0xc711('0x5'),{'body':_[_0xc711('0x6')](_0x5ef950,{'source':_0x5ef950[_0xc711('0x7')],'destinationcontext':_0x5ef950['context'],'callerid':_0x5ef950[_0xc711('0x8')],'amaflags':'DOCUMENTATION'}),'log':_0xc711('0x5')});};exports[_0xc711('0x9')]=function(){return function(){return client[_0xc711('0x4')](_0xc711('0xa'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0xc711('0xb')]('day')[_0xc711('0xc')](_0xc711('0xd')),moment()[_0xc711('0xe')](_0xc711('0xf'))[_0xc711('0xc')](_0xc711('0xd'))]}},'attributes':[_0xc711('0x10'),_0xc711('0x11'),_0xc711('0x12'),_0xc711('0x13')]},'log':_0xc711('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 49047d9..bc12de4 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 _0xb144=['../client','create','Request','CreateVoiceDialReport'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xb144,0x108));var _0x4b14=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb144[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x4b14('0x0'));exports[_0x4b14('0x1')]=function(_0x5edb76){return client[_0x4b14('0x2')](_0x4b14('0x3'),{'body':_0x5edb76,'log':_0x4b14('0x3')});}; \ No newline at end of file +var _0x8a2b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8a2b,0x1ac));var _0xb8a2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8a2b[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xb8a2('0x0'));exports[_0xb8a2('0x1')]=function(_0xb5f8ca){return client[_0xb8a2('0x2')](_0xb8a2('0x3'),{'body':_0xb5f8ca,'log':_0xb8a2('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 0424afe..ac2dbf1 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 _0x750a=['exten','recordingFormat','getVoiceExtensions'];(function(_0x401427,_0x439c91){var _0x906dd0=function(_0x3673d0){while(--_0x3673d0){_0x401427['push'](_0x401427['shift']());}};_0x906dd0(++_0x439c91);}(_0x750a,0x140));var _0xa750=function(_0x5c506f,_0xb7fed4){_0x5c506f=_0x5c506f-0x0;var _0x204474=_0x750a[_0x5c506f];return _0x204474;};'use strict';var client=require('../client');exports[_0xa750('0x0')]=function(){return function(){return client['Request']('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xa750('0x1'),_0xa750('0x2')],'where':{'VoiceExtensionId':null}},'log':_0xa750('0x0')});};}; \ No newline at end of file +var _0x180f=['getVoiceExtensions','GetVoiceExtension','exten','../client'];(function(_0x375492,_0x4ed149){var _0x18ba5b=function(_0x154a12){while(--_0x154a12){_0x375492['push'](_0x375492['shift']());}};_0x18ba5b(++_0x4ed149);}(_0x180f,0xf3));var _0xf180=function(_0x4c80d7,_0x2bef29){_0x4c80d7=_0x4c80d7-0x0;var _0x3c5095=_0x180f[_0x4c80d7];return _0x3c5095;};'use strict';var client=require(_0xf180('0x0'));exports[_0xf180('0x1')]=function(){return function(){return client['Request'](_0xf180('0x2'),{'options':{'raw':!![],'attributes':['id',_0xf180('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0xf180('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index d7bb2ac..ae60d75 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 _0xea26=['strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','autopause','dialActive','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallInQueue','dialOrderByScheduledAt'];(function(_0x470e46,_0x33c2e3){var _0x52b31b=function(_0x4db791){while(--_0x4db791){_0x470e46['push'](_0x470e46['shift']());}};_0x52b31b(++_0x33c2e3);}(_0xea26,0x170));var _0x6ea2=function(_0x230af5,_0x5cb0e6){_0x230af5=_0x230af5-0x0;var _0x24e019=_0xea26[_0x230af5];return _0x24e019;};'use strict';var client=require(_0x6ea2('0x0'));exports[_0x6ea2('0x1')]=function(){return function(){return client[_0x6ea2('0x2')](_0x6ea2('0x3'),{'options':{'raw':![],'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x5'),'acwTimeout',_0x6ea2('0x6'),'monitor_format','type',_0x6ea2('0x7'),_0x6ea2('0x8'),_0x6ea2('0x9'),'dialLimitQueue',_0x6ea2('0xa'),_0x6ea2('0xb'),_0x6ea2('0xc'),'dialPredictiveInterval',_0x6ea2('0xd'),'dialOriginateCallerIdNumber',_0x6ea2('0xe'),'dialQueueOptions',_0x6ea2('0xf'),_0x6ea2('0x10'),_0x6ea2('0x11'),_0x6ea2('0x12'),_0x6ea2('0x13'),_0x6ea2('0x14'),_0x6ea2('0x15'),_0x6ea2('0x16'),_0x6ea2('0x17'),_0x6ea2('0x18'),_0x6ea2('0x19'),_0x6ea2('0x1a'),_0x6ea2('0x1b'),'dialAMDActive',_0x6ea2('0x1c'),'dialAMDGreeting',_0x6ea2('0x1d'),_0x6ea2('0x1e'),_0x6ea2('0x1f'),_0x6ea2('0x20'),_0x6ea2('0x21'),_0x6ea2('0x22'),'dialAMDMaximumWordLength',_0x6ea2('0x23'),'dialRecallMeTimeout',_0x6ea2('0x24'),_0x6ea2('0x25'),'dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format',_0x6ea2('0x26'),_0x6ea2('0x27'),_0x6ea2('0x28'),_0x6ea2('0x29'),'dialNoSuchNumberRetryFrequency',_0x6ea2('0x2a'),'dialDropRetryFrequency',_0x6ea2('0x2b'),_0x6ea2('0x2c'),_0x6ea2('0x2d'),_0x6ea2('0x2e'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x6ea2('0x2f'),_0x6ea2('0x30'),_0x6ea2('0x31')],'include':[{'model':_0x6ea2('0x32'),'as':_0x6ea2('0x32'),'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x33'),_0x6ea2('0x34')]},{'model':_0x6ea2('0x35'),'as':_0x6ea2('0x36'),'attributes':['id',_0x6ea2('0x4')]},{'model':_0x6ea2('0x32'),'as':_0x6ea2('0x37'),'attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x33'),_0x6ea2('0x34')]},{'model':_0x6ea2('0x38'),'as':_0x6ea2('0x38'),'attributes':['id',_0x6ea2('0x4')],'include':[{'model':_0x6ea2('0x38'),'as':'Intervals','attributes':['id',_0x6ea2('0x4'),_0x6ea2('0x39')]}]}]},'log':_0x6ea2('0x1')});};}; \ No newline at end of file +var _0xb81a=['dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialAgiAfterHangupClient','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','Pause','mandatoryDispositionPause','callerid','active','Interval','Intervals','interval','getVoiceQueues','name','acw','monitor_format','type','dialMethod','dialLimitChannel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage'];(function(_0xe01db0,_0xc3bacb){var _0x41965f=function(_0xde7aac){while(--_0xde7aac){_0xe01db0['push'](_0xe01db0['shift']());}};_0x41965f(++_0xc3bacb);}(_0xb81a,0x186));var _0xab81=function(_0x1e494f,_0x91bb59){_0x1e494f=_0x1e494f-0x0;var _0x2bef55=_0xb81a[_0x1e494f];return _0x2bef55;};'use strict';var client=require('../client');exports[_0xab81('0x0')]=function(){return function(){return client['Request']('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xab81('0x1'),_0xab81('0x2'),'acwTimeout','autopause',_0xab81('0x3'),_0xab81('0x4'),'dialActive',_0xab81('0x5'),_0xab81('0x6'),'dialLimitQueue','dialPowerLevel',_0xab81('0x7'),_0xab81('0x8'),_0xab81('0x9'),_0xab81('0xa'),_0xab81('0xb'),'dialOriginateTimeout',_0xab81('0xc'),_0xab81('0xd'),'dialQueueProject',_0xab81('0xe'),_0xab81('0xf'),'dialBusyMaxRetry','dialBusyRetryFrequency',_0xab81('0x10'),_0xab81('0x11'),_0xab81('0x12'),_0xab81('0x13'),'dialGlobalInterval',_0xab81('0x14'),_0xab81('0x15'),'dialAMDActive',_0xab81('0x16'),_0xab81('0x17'),_0xab81('0x18'),'dialAMDTotalAnalysisTime',_0xab81('0x19'),_0xab81('0x1a'),'dialAMDMaximumNumberOfWords',_0xab81('0x1b'),'dialAMDMaximumWordLength',_0xab81('0x1c'),_0xab81('0x1d'),_0xab81('0x1e'),'dialOrderByScheduledAt','dialAgiAfterHangupAgent',_0xab81('0x1f'),_0xab81('0x20'),'monitor_format',_0xab81('0x21'),_0xab81('0x22'),_0xab81('0x23'),_0xab81('0x24'),_0xab81('0x25'),_0xab81('0x26'),'dialDropRetryFrequency',_0xab81('0x27'),_0xab81('0x28'),_0xab81('0x29'),_0xab81('0x2a'),_0xab81('0x2b'),_0xab81('0x2c'),_0xab81('0x2d'),_0xab81('0x2e'),_0xab81('0x2f'),'dialPreviewAutoRecallMe',_0xab81('0x30')],'include':[{'model':_0xab81('0x31'),'as':_0xab81('0x31'),'attributes':['id',_0xab81('0x1'),'callerid','active']},{'model':_0xab81('0x32'),'as':_0xab81('0x33'),'attributes':['id',_0xab81('0x1')]},{'model':_0xab81('0x31'),'as':'TrunkBackup','attributes':['id',_0xab81('0x1'),_0xab81('0x34'),_0xab81('0x35')]},{'model':_0xab81('0x36'),'as':_0xab81('0x36'),'attributes':['id',_0xab81('0x1')],'include':[{'model':_0xab81('0x36'),'as':_0xab81('0x37'),'attributes':['id',_0xab81('0x1'),_0xab81('0x38')]}]}]},'log':_0xab81('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 2110417..b146ca2 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(_0x5c7f47,_0x36f874){var _0x39e8a9=function(_0x270bce){while(--_0x270bce){_0x5c7f47['push'](_0x5c7f47['shift']());}};_0x39e8a9(++_0x36f874);}(_0xa9e0,0x123));var _0x0a9e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xa9e0[_0x49ca18];return _0x145d54;};'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(_0x4e851,_0xd07703){var _0x3d95fd=function(_0x10a759){while(--_0x10a759){_0x4e851['push'](_0x4e851['shift']());}};_0x3d95fd(++_0xd07703);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'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 54b15d9..010d526 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 _0x73a5=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x73a5,0x134));var _0x573a=function(_0x58fec5,_0x4eaa73){_0x58fec5=_0x58fec5-0x0;var _0x36f512=_0x73a5[_0x58fec5];return _0x36f512;};'use strict';var client=require(_0x573a('0x0'));exports[_0x573a('0x1')]=function(_0x5076de){return function(){return client[_0x573a('0x2')](_0x573a('0x3'),{'options':{'where':{'VoiceQueueId':_0x5076de,'paused':!![]},'raw':!![]},'log':_0x573a('0x1')});};}; \ No newline at end of file +var _0x94a5=['getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses','../client'];(function(_0x2d7310,_0xa7da6c){var _0x409df1=function(_0x4ec19e){while(--_0x4ec19e){_0x2d7310['push'](_0x2d7310['shift']());}};_0x409df1(++_0xa7da6c);}(_0x94a5,0x1f3));var _0x594a=function(_0x1f0a6b,_0x46b665){_0x1f0a6b=_0x1f0a6b-0x0;var _0x18d3f9=_0x94a5[_0x1f0a6b];return _0x18d3f9;};'use strict';var client=require(_0x594a('0x0'));exports[_0x594a('0x1')]=function(_0x1fc258){return function(){return client[_0x594a('0x2')](_0x594a('0x3'),{'options':{'where':{'VoiceQueueId':_0x1fc258,'paused':!![]},'raw':!![]},'log':_0x594a('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index d628011..428b1b0 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(_0x58a632,_0x1d8a91){var _0x4b99eb=function(_0x1a31b1){while(--_0x1a31b1){_0x58a632['push'](_0x58a632['shift']());}};_0x4b99eb(++_0x1d8a91);}(_0x7a54,0x106));var _0x47a5=function(_0x329732,_0x442458){_0x329732=_0x329732-0x0;var _0x52596c=_0x7a54[_0x329732];return _0x52596c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x169da5,_0x2c2bec){var _0x507cb5=function(_0x19849e){while(--_0x19849e){_0x169da5['push'](_0x169da5['shift']());}};_0x507cb5(++_0x2c2bec);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 9e7be02..4818c3c 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 _0x8e1b=['transfereecontext','transfereeexten','context','extension','CreateVoiceTransferReport','attendedTransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','isexternal','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename'];(function(_0xccbfa1,_0x4b6790){var _0xc4c856=function(_0x9100cb){while(--_0x9100cb){_0xccbfa1['push'](_0xccbfa1['shift']());}};_0xc4c856(++_0x4b6790);}(_0x8e1b,0x6f));var _0xb8e1=function(_0x46e252,_0x137bbc){_0x46e252=_0x46e252-0x0;var _0x2d4c80=_0x8e1b[_0x46e252];return _0x2d4c80;};'use strict';var client=require(_0xb8e1('0x0'));exports[_0xb8e1('0x1')]={};exports[_0xb8e1('0x2')]=function(_0x55c777){return client[_0xb8e1('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x55c777[_0xb8e1('0x4')],'transfererchannel':_0x55c777[_0xb8e1('0x5')],'transferercalleridnum':_0x55c777[_0xb8e1('0x6')],'transferercalleridname':_0x55c777[_0xb8e1('0x7')],'transfererconnectedlinenum':_0x55c777[_0xb8e1('0x8')],'transfererconnectedlinename':_0x55c777[_0xb8e1('0x9')],'transfereraccountcode':_0x55c777[_0xb8e1('0xa')],'transferercontext':_0x55c777[_0xb8e1('0xb')],'transfererexten':_0x55c777[_0xb8e1('0xc')],'transfererlinkedid':_0x55c777[_0xb8e1('0xd')],'transfereechannel':_0x55c777[_0xb8e1('0xe')],'transfereecalleridnum':_0x55c777[_0xb8e1('0xf')],'transfereecalleridname':_0x55c777[_0xb8e1('0x10')],'transfereeconnectedlinenum':_0x55c777['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x55c777[_0xb8e1('0x11')],'transfereeaccountcode':_0x55c777['transfereeaccountcode'],'transfereecontext':_0x55c777[_0xb8e1('0x12')],'transfereeexten':_0x55c777[_0xb8e1('0x13')],'transfereelinkedid':_0x55c777['transfereelinkedid'],'isexternal':_0x55c777['isexternal'],'context':_0x55c777[_0xb8e1('0x14')],'extension':_0x55c777[_0xb8e1('0x15')],'type':'blind'},'log':_0xb8e1('0x16')});};exports[_0xb8e1('0x17')]=function(_0x15b4cb){return client[_0xb8e1('0x3')](_0xb8e1('0x16'),{'body':{'result':_0x15b4cb['result'],'transfererchannel':_0x15b4cb[_0xb8e1('0x18')],'transferercalleridnum':_0x15b4cb[_0xb8e1('0x19')],'transferercalleridname':_0x15b4cb[_0xb8e1('0x1a')],'transfererconnectedlinenum':_0x15b4cb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x15b4cb[_0xb8e1('0x1b')],'transfereraccountcode':_0x15b4cb[_0xb8e1('0x1c')],'transferercontext':_0x15b4cb[_0xb8e1('0x1d')],'transfererexten':_0x15b4cb[_0xb8e1('0x1e')],'transfererlinkedid':_0x15b4cb[_0xb8e1('0x1f')],'transfereechannel':_0x15b4cb[_0xb8e1('0x20')],'transfereecalleridnum':_0x15b4cb['transfertargetcalleridnum'],'transfereecalleridname':_0x15b4cb[_0xb8e1('0x21')],'transfereeconnectedlinenum':_0x15b4cb[_0xb8e1('0x22')],'transfereeconnectedlinename':_0x15b4cb[_0xb8e1('0x23')],'transfereeaccountcode':_0x15b4cb[_0xb8e1('0x24')],'transfereecontext':_0x15b4cb[_0xb8e1('0x25')],'transfereeexten':_0x15b4cb[_0xb8e1('0x26')],'transfereelinkedid':_0x15b4cb['transfertargetlinkedid'],'isexternal':_0x15b4cb[_0xb8e1('0x27')],'context':_0x15b4cb[_0xb8e1('0x28')],'extension':_0x15b4cb[_0xb8e1('0x29')],'type':_0xb8e1('0x2a')},'log':_0xb8e1('0x16')});}; \ No newline at end of file +var _0x9c9e=['secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereeexten','transfereelinkedid','isexternal','attendedTransfer','origtransferercalleridname','secondtransfererconnectedlinenum'];(function(_0x578ba7,_0xd650ae){var _0x4aa9f3=function(_0x55a118){while(--_0x55a118){_0x578ba7['push'](_0x578ba7['shift']());}};_0x4aa9f3(++_0xd650ae);}(_0x9c9e,0xb4));var _0xe9c9=function(_0x3fd0ff,_0x88c923){_0x3fd0ff=_0x3fd0ff-0x0;var _0x130f99=_0x9c9e[_0x3fd0ff];return _0x130f99;};'use strict';var client=require(_0xe9c9('0x0'));exports[_0xe9c9('0x1')]={};exports[_0xe9c9('0x2')]=function(_0x3df876){return client[_0xe9c9('0x3')](_0xe9c9('0x4'),{'body':{'result':_0x3df876['result'],'transfererchannel':_0x3df876[_0xe9c9('0x5')],'transferercalleridnum':_0x3df876[_0xe9c9('0x6')],'transferercalleridname':_0x3df876[_0xe9c9('0x7')],'transfererconnectedlinenum':_0x3df876[_0xe9c9('0x8')],'transfererconnectedlinename':_0x3df876['transfererconnectedlinename'],'transfereraccountcode':_0x3df876[_0xe9c9('0x9')],'transferercontext':_0x3df876[_0xe9c9('0xa')],'transfererexten':_0x3df876[_0xe9c9('0xb')],'transfererlinkedid':_0x3df876[_0xe9c9('0xc')],'transfereechannel':_0x3df876[_0xe9c9('0xd')],'transfereecalleridnum':_0x3df876[_0xe9c9('0xe')],'transfereecalleridname':_0x3df876['transfereecalleridname'],'transfereeconnectedlinenum':_0x3df876[_0xe9c9('0xf')],'transfereeconnectedlinename':_0x3df876[_0xe9c9('0x10')],'transfereeaccountcode':_0x3df876[_0xe9c9('0x11')],'transfereecontext':_0x3df876['transfereecontext'],'transfereeexten':_0x3df876[_0xe9c9('0x12')],'transfereelinkedid':_0x3df876[_0xe9c9('0x13')],'isexternal':_0x3df876[_0xe9c9('0x14')],'context':_0x3df876['context'],'extension':_0x3df876['extension'],'type':'blind'},'log':_0xe9c9('0x4')});};exports[_0xe9c9('0x15')]=function(_0x2d7452){return client[_0xe9c9('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2d7452['result'],'transfererchannel':_0x2d7452['origtransfererchannel'],'transferercalleridnum':_0x2d7452['origtransferercalleridnum'],'transferercalleridname':_0x2d7452[_0xe9c9('0x16')],'transfererconnectedlinenum':_0x2d7452[_0xe9c9('0x17')],'transfererconnectedlinename':_0x2d7452[_0xe9c9('0x18')],'transfereraccountcode':_0x2d7452[_0xe9c9('0x19')],'transferercontext':_0x2d7452['secondtransferercontext'],'transfererexten':_0x2d7452[_0xe9c9('0x1a')],'transfererlinkedid':_0x2d7452[_0xe9c9('0x1b')],'transfereechannel':_0x2d7452['transfertargetchannel'],'transfereecalleridnum':_0x2d7452['transfertargetcalleridnum'],'transfereecalleridname':_0x2d7452[_0xe9c9('0x1c')],'transfereeconnectedlinenum':_0x2d7452['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2d7452['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2d7452[_0xe9c9('0x1d')],'transfereecontext':_0x2d7452['transfertargetcontext'],'transfereeexten':_0x2d7452[_0xe9c9('0x1e')],'transfereelinkedid':_0x2d7452[_0xe9c9('0x1f')],'isexternal':_0x2d7452['isexternal'],'context':_0x2d7452[_0xe9c9('0x20')],'extension':_0x2d7452['origtransfererexten'],'type':_0xe9c9('0x21')},'log':_0xe9c9('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index be46322..ad5682e 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(_0x586663,_0x5229bf){var _0x32d797=function(_0x3de852){while(--_0x3de852){_0x586663['push'](_0x586663['shift']());}};_0x32d797(++_0x5229bf);}(_0xb10b,0x12a));var _0xbb10=function(_0xdfdeb7,_0x29649c){_0xdfdeb7=_0xdfdeb7-0x0;var _0x1db931=_0xb10b[_0xdfdeb7];return _0x1db931;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x438021,_0x49c0f2){var _0x55ceed=function(_0x4dfc6e){while(--_0x4dfc6e){_0x438021['push'](_0x438021['shift']());}};_0x55ceed(++_0x49c0f2);}(_0xb10b,0x12a));var _0xbb10=function(_0x11adbd,_0x5055f5){_0x11adbd=_0x11adbd-0x0;var _0x270029=_0xb10b[_0x11adbd];return _0x270029;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 92dfb32..88dba7b 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 _0xe495=['exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','phone','fax','createdAt','scheduledAt','updatedAt','resolve','then','isEmpty','length','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name','trigger:%s','merge','lodash','ioredis','util','../../../../config/logger','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe495,0xfe));var _0x5e49=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe495[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x5e49('0x0'));var BPromise=require('bluebird');var Redis=require(_0x5e49('0x1'));var util=require(_0x5e49('0x2'));var config=require('../../../../config/environment');var logger=require(_0x5e49('0x3'))(_0x5e49('0x4'));var cmContactRpc=require(_0x5e49('0x5'));config['redis']=_[_0x5e49('0x6')](config[_0x5e49('0x7')],{'host':_0x5e49('0x8'),'port':0x18eb});var io=require(_0x5e49('0x9'))(new Redis(config[_0x5e49('0x7')]));function emit(_0xae637a,_0x53d14e,_0x5d45be,_0x246c9e,_0x153761){logger['info']('[CM][%s][%s]',_0xae637a,_0x53d14e['id'],_0x5d45be,_0x246c9e,JSON[_0x5e49('0xa')](_0x153761));io['to'](_0x5d45be)['emit'](_0x246c9e,_0x153761);}exports[_0x5e49('0xb')]=function(_0x1fdfbe,_0x1a2913,_0x59de55,_0x294ec1){var _0x3b49d1,_0x21184a;var _0xd757b0={};var _0xb0c2b1;var _0x526d73=Number(_0x59de55[_0x5e49('0xc')]);var _0x1c8bac=_0x59de55[_0x5e49('0xd')]?Boolean(Number(_0x59de55[_0x5e49('0xd')])):![];var _0x30843b;var _0x5415bf=![];if(!_[_0x5e49('0xe')](_0x59de55['data5'])){if(_0x59de55[_0x5e49('0xf')]=='1')_0x5415bf=!![];}if(!_0x5415bf){if(_0x294ec1[_0x5e49('0x10')]){_0xd757b0['id']=_0x294ec1[_0x5e49('0x10')];}}if(!_0xd757b0['id']){_0xd757b0[_0x5e49('0x11')]=_0x526d73;_0x30843b=_0x59de55[_0x5e49('0x12')]&&_0x59de55[_0x5e49('0x12')]!=='0'?_0x59de55['data3'][_0x5e49('0x13')](','):['phone'];_0xd757b0[_0x5e49('0x14')]=_[_0x5e49('0x15')](_0x30843b,function(_0x43c424){var _0x42518d={};_0x42518d[_0x43c424]=_0x294ec1[_0x5e49('0x16')]?_0x294ec1[_0x5e49('0x17')]:_0x294ec1['calleridnum'];return _0x42518d;});_0xb0c2b1=_0x294ec1[_0x5e49('0x16')]?_0x294ec1[_0x5e49('0x17')]:_0x294ec1[_0x5e49('0x18')];}var _0xd2d53a=['id',_0x5e49('0x19'),'lastName',_0x5e49('0x1a'),'mobile',_0x5e49('0x1b'),'ListId',_0x5e49('0x1c'),_0x5e49('0x1d'),_0x5e49('0x1e')];var _0x5c4ef4=_['union'](_0xd2d53a,_0x30843b);BPromise[_0x5e49('0x1f')]()[_0x5e49('0x20')](cmContactRpc['getContacts']({'attributes':_0x5c4ef4,'where':_0xd757b0,'phone':_0xb0c2b1}))[_0x5e49('0x20')](function(_0x125933){_0x21184a=_0x125933;if(!_[_0x5e49('0x21')](_0x21184a)){if(_0x21184a[_0x5e49('0x22')]===0x1){_0x3b49d1=_0x21184a[0x0];logger[_0x5e49('0x23')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x294ec1['uniqueid'],_0x1a2913['id'],_0x3b49d1['id']);}else{logger[_0x5e49('0x23')](_0x5e49('0x24'),_0x294ec1[_0x5e49('0x25')],_0x1a2913['id'],_[_0x5e49('0x15')](_0x21184a,'id')[_0x5e49('0x26')](','));}return;}else{logger['info'](_0x5e49('0x27'),_0x294ec1[_0x5e49('0x25')],_0x1a2913['id']);var _0x501c13={'ListId':_0x526d73};var _0x30d461=_0x59de55[_0x5e49('0x28')]&&_0x59de55[_0x5e49('0x28')]!=='0'?_0x59de55[_0x5e49('0x28')]:_0x5e49('0x1a');if(_0x1c8bac){logger[_0x5e49('0x23')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x294ec1[_0x5e49('0x25')],_0x1a2913['id']);_0x501c13[_0x30d461]=_[_0x5e49('0xe')](_0x294ec1['routeId'])?_0x294ec1[_0x5e49('0x18')]:_0x294ec1[_0x5e49('0x17')];if(_['isNil'](_0x294ec1[_0x5e49('0x16')])){_0x501c13[_0x5e49('0x19')]=_0x294ec1['calleridname']&&_0x294ec1[_0x5e49('0x29')]!==_0x5e49('0x2a')?_0x294ec1['calleridname']:_0x5e49('0x2b');}else{_0x501c13[_0x5e49('0x19')]=_0x294ec1[_0x5e49('0x2c')]&&_0x294ec1[_0x5e49('0x2c')]!==_0x5e49('0x2a')?_0x294ec1[_0x5e49('0x2c')]:'Unknown';}return BPromise[_0x5e49('0x1f')]()[_0x5e49('0x20')](cmContactRpc[_0x5e49('0x2d')](_0x501c13))[_0x5e49('0x20')](function(_0x117ea1){_0x3b49d1=_0x117ea1;_0x21184a[_0x5e49('0x2e')](_0x117ea1);if(_0x3b49d1){logger[_0x5e49('0x23')](_0x5e49('0x2f'),_0x294ec1[_0x5e49('0x25')],_0x1a2913['id'],_0x3b49d1['id']);}return;});}else{logger[_0x5e49('0x23')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x294ec1['uniqueid'],_0x1a2913['id']);_0x501c13[_0x30d461]=_[_0x5e49('0xe')](_0x294ec1[_0x5e49('0x16')])?_0x294ec1[_0x5e49('0x18')]:_0x294ec1[_0x5e49('0x17')];if(_[_0x5e49('0xe')](_0x294ec1[_0x5e49('0x16')])){_0x501c13[_0x5e49('0x19')]=_0x294ec1['calleridname']&&_0x294ec1[_0x5e49('0x29')]!==_0x5e49('0x2a')?_0x294ec1[_0x5e49('0x29')]:'Unknown';}else{_0x501c13[_0x5e49('0x19')]=_0x294ec1[_0x5e49('0x2c')]&&_0x294ec1[_0x5e49('0x2c')]!==_0x5e49('0x2a')?_0x294ec1['destcalleridname']:_0x5e49('0x2b');}_0x3b49d1=_0x501c13;_0x21184a[_0x5e49('0x2e')](_0x501c13);return;}}})[_0x5e49('0x20')](function(){if(_0x1fdfbe){emit(_0x294ec1[_0x5e49('0x25')],_0x1a2913,util[_0x5e49('0x30')](_0x5e49('0x31'),_0x1fdfbe[_0x5e49('0x32')]),util[_0x5e49('0x30')](_0x5e49('0x33'),_0x59de55['action']['toLowerCase']()),{'evt':_[_0x5e49('0x34')](_0x294ec1,{'autoCreate':_0x1c8bac}),'contact':_0x3b49d1===undefined?{}:_0x3b49d1,'contacts':_0x21184a[_0x5e49('0x22')]===0x0?undefined:_0x21184a});}});}; \ No newline at end of file +var _0xa2fa=['firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','getContacts','then','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','destcalleridname','','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','trigger','../../rpc/cmContact','redis','defaults','localhost','info','[CM][%s][%s]','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','map','routeId','destcalleridnum','calleridnum'];(function(_0x4156e9,_0x139ecf){var _0x5a77b7=function(_0x4d2caf){while(--_0x4d2caf){_0x4156e9['push'](_0x4156e9['shift']());}};_0x5a77b7(++_0x139ecf);}(_0xa2fa,0x95));var _0xaa2f=function(_0x4d9100,_0x5d39ff){_0x4d9100=_0x4d9100-0x0;var _0x4ffd43=_0xa2fa[_0x4d9100];return _0x4ffd43;};'use strict';var _=require(_0xaa2f('0x0'));var BPromise=require(_0xaa2f('0x1'));var Redis=require(_0xaa2f('0x2'));var util=require(_0xaa2f('0x3'));var config=require(_0xaa2f('0x4'));var logger=require('../../../../config/logger')(_0xaa2f('0x5'));var cmContactRpc=require(_0xaa2f('0x6'));config[_0xaa2f('0x7')]=_[_0xaa2f('0x8')](config[_0xaa2f('0x7')],{'host':_0xaa2f('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaa2f('0x7')]));function emit(_0xe1b279,_0x5eb846,_0x2aec13,_0xff4770,_0x1d80d2){logger[_0xaa2f('0xa')](_0xaa2f('0xb'),_0xe1b279,_0x5eb846['id'],_0x2aec13,_0xff4770,JSON[_0xaa2f('0xc')](_0x1d80d2));io['to'](_0x2aec13)[_0xaa2f('0xd')](_0xff4770,_0x1d80d2);}exports[_0xaa2f('0xe')]=function(_0x4a2b7c,_0x1aa8b7,_0x117964,_0x10a331){var _0x336fed,_0x161193;var _0x1f4bc8={};var _0x319013;var _0x285419=Number(_0x117964[_0xaa2f('0xf')]);var _0x2edd43=_0x117964[_0xaa2f('0x10')]?Boolean(Number(_0x117964[_0xaa2f('0x10')])):![];var _0x50f481;var _0x102de6=![];if(!_[_0xaa2f('0x11')](_0x117964[_0xaa2f('0x12')])){if(_0x117964['data5']=='1')_0x102de6=!![];}if(!_0x102de6){if(_0x10a331[_0xaa2f('0x13')]){_0x1f4bc8['id']=_0x10a331[_0xaa2f('0x13')];}}if(!_0x1f4bc8['id']){_0x1f4bc8[_0xaa2f('0x14')]=_0x285419;_0x50f481=_0x117964[_0xaa2f('0x15')]&&_0x117964['data3']!=='0'?_0x117964[_0xaa2f('0x15')][_0xaa2f('0x16')](','):[_0xaa2f('0x17')];_0x1f4bc8['$or']=_[_0xaa2f('0x18')](_0x50f481,function(_0x52af56){var _0x35ea10={};_0x35ea10[_0x52af56]=_0x10a331[_0xaa2f('0x19')]?_0x10a331[_0xaa2f('0x1a')]:_0x10a331[_0xaa2f('0x1b')];return _0x35ea10;});_0x319013=_0x10a331[_0xaa2f('0x19')]?_0x10a331[_0xaa2f('0x1a')]:_0x10a331[_0xaa2f('0x1b')];}var _0x2636dd=['id',_0xaa2f('0x1c'),_0xaa2f('0x1d'),_0xaa2f('0x17'),_0xaa2f('0x1e'),'fax',_0xaa2f('0x14'),_0xaa2f('0x1f'),_0xaa2f('0x20'),_0xaa2f('0x21')];var _0x55e804=_[_0xaa2f('0x22')](_0x2636dd,_0x50f481);BPromise[_0xaa2f('0x23')]()['then'](cmContactRpc[_0xaa2f('0x24')]({'attributes':_0x55e804,'where':_0x1f4bc8,'phone':_0x319013}))[_0xaa2f('0x25')](function(_0x32c95c){_0x161193=_0x32c95c;if(!_[_0xaa2f('0x26')](_0x161193)){if(_0x161193[_0xaa2f('0x27')]===0x1){_0x336fed=_0x161193[0x0];logger[_0xaa2f('0xa')](_0xaa2f('0x28'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id'],_0x336fed['id']);}else{logger[_0xaa2f('0xa')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id'],_['map'](_0x161193,'id')[_0xaa2f('0x2a')](','));}return;}else{logger['info'](_0xaa2f('0x2b'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id']);var _0x4e1315={'ListId':_0x285419};var _0x44e42c=_0x117964[_0xaa2f('0x2c')]&&_0x117964['data4']!=='0'?_0x117964[_0xaa2f('0x2c')]:'phone';if(_0x2edd43){logger[_0xaa2f('0xa')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id']);_0x4e1315[_0x44e42c]=_['isNil'](_0x10a331['routeId'])?_0x10a331[_0xaa2f('0x1b')]:_0x10a331[_0xaa2f('0x1a')];if(_[_0xaa2f('0x11')](_0x10a331[_0xaa2f('0x19')])){_0x4e1315['firstName']=_0x10a331[_0xaa2f('0x2d')]&&_0x10a331[_0xaa2f('0x2d')]!==''?_0x10a331[_0xaa2f('0x2d')]:'Unknown';}else{_0x4e1315[_0xaa2f('0x1c')]=_0x10a331[_0xaa2f('0x2e')]&&_0x10a331['destcalleridname']!==_0xaa2f('0x2f')?_0x10a331['destcalleridname']:_0xaa2f('0x30');}return BPromise['resolve']()['then'](cmContactRpc[_0xaa2f('0x31')](_0x4e1315))[_0xaa2f('0x25')](function(_0xcee62a){_0x336fed=_0xcee62a;_0x161193[_0xaa2f('0x32')](_0xcee62a);if(_0x336fed){logger['info'](_0xaa2f('0x33'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id'],_0x336fed['id']);}return;});}else{logger[_0xaa2f('0xa')](_0xaa2f('0x34'),_0x10a331[_0xaa2f('0x29')],_0x1aa8b7['id']);_0x4e1315[_0x44e42c]=_[_0xaa2f('0x11')](_0x10a331[_0xaa2f('0x19')])?_0x10a331[_0xaa2f('0x1b')]:_0x10a331[_0xaa2f('0x1a')];if(_[_0xaa2f('0x11')](_0x10a331[_0xaa2f('0x19')])){_0x4e1315[_0xaa2f('0x1c')]=_0x10a331[_0xaa2f('0x2d')]&&_0x10a331['calleridname']!==''?_0x10a331[_0xaa2f('0x2d')]:_0xaa2f('0x30');}else{_0x4e1315[_0xaa2f('0x1c')]=_0x10a331['destcalleridname']&&_0x10a331['destcalleridname']!==_0xaa2f('0x2f')?_0x10a331[_0xaa2f('0x2e')]:_0xaa2f('0x30');}_0x336fed=_0x4e1315;_0x161193[_0xaa2f('0x32')](_0x4e1315);return;}}})[_0xaa2f('0x25')](function(){if(_0x4a2b7c){emit(_0x10a331[_0xaa2f('0x29')],_0x1aa8b7,util[_0xaa2f('0x35')](_0xaa2f('0x36'),_0x4a2b7c[_0xaa2f('0x37')]),util[_0xaa2f('0x35')](_0xaa2f('0x38'),_0x117964['action'][_0xaa2f('0x39')]()),{'evt':_[_0xaa2f('0x3a')](_0x10a331,{'autoCreate':_0x2edd43}),'contact':_0x336fed===undefined?{}:_0x336fed,'contacts':_0x161193[_0xaa2f('0x27')]===0x0?undefined:_0x161193});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 86d6d2c..ad1337c 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 _0x8bf3=['windowWidth','data5','800','windowHeight','data6','600','winArguments','name','trigger:%s:%s','jscripty','user:%s','format','trigger:%s','exec','integration','queue','routeId','parse','query','search','replace','channel','every','AllConditions','checkConditions','AnyConditions','some','inspect','evt','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','message','event','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','created','equals','util','lodash','url','mustache','ioredis','./urlforward','./integration','./cmContact','./script','../../../config/logger','trigger','../ami','defaults','localhost','socket.io-emitter','redis','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','bind','custom:agentcomplete','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:queuecallerabandon','syncAgentDial','custom:dialconnect','custom:dialend','custom:closedinteraction','custom:substatus','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','prototype','info','stringify','emit','clone','motionChannel','undefined','voice','debug','checkTriggers','interface','status','merge','variables','Actions','length','action','toLowerCase','contactmanager','browser','data1','TemplateId','html','data2','render','template\x20not\x20found','buildUri','isNil','data3','data4','location'];(function(_0x1a5bea,_0xa59771){var _0x210e20=function(_0x5a61da){while(--_0x5a61da){_0x1a5bea['push'](_0x1a5bea['shift']());}};_0x210e20(++_0xa59771);}(_0x8bf3,0x130));var _0x38bf=function(_0x6e1179,_0x837a68){_0x6e1179=_0x6e1179-0x0;var _0x383ecf=_0x8bf3[_0x6e1179];return _0x383ecf;};'use strict';var util=require(_0x38bf('0x0'));var _=require(_0x38bf('0x1'));var url=require(_0x38bf('0x2'));var Mustache=require(_0x38bf('0x3'));var Redis=require(_0x38bf('0x4'));var urlforward=require(_0x38bf('0x5'));var integration=require(_0x38bf('0x6'));var cmContact=require(_0x38bf('0x7'));var script=require(_0x38bf('0x8'));var config=require('../../../config/environment');var logger=require(_0x38bf('0x9'))(_0x38bf('0xa'));var ami=require(_0x38bf('0xb'));config['redis']=_[_0x38bf('0xc')](config['redis'],{'host':_0x38bf('0xd'),'port':0x18eb});var io=require(_0x38bf('0xe'))(new Redis(config[_0x38bf('0xf')]));var operators={'equals':function(_0x43c5b1,_0x915c78){return _0x43c5b1==_0x915c78;},'not_equals':function(_0x7b13f9,_0x40fa95){return _0x7b13f9!=_0x40fa95;}};var barAndWebActions=[_0x38bf('0x10'),_0x38bf('0x2'),_0x38bf('0x11')];function Trigger(_0x53a2f6){this['triggers']=_0x53a2f6[_0x38bf('0x12')];this[_0x38bf('0x13')]=_0x53a2f6[_0x38bf('0x13')];this[_0x38bf('0x14')]=_0x53a2f6[_0x38bf('0x14')];this[_0x38bf('0x15')]=_0x53a2f6[_0x38bf('0x15')];this[_0x38bf('0x16')]=_0x53a2f6[_0x38bf('0x16')];this['zendeskAccounts']=_0x53a2f6[_0x38bf('0x17')];this[_0x38bf('0x18')]=_0x53a2f6[_0x38bf('0x18')];this[_0x38bf('0x19')]=_0x53a2f6[_0x38bf('0x19')];this[_0x38bf('0x1a')]=_0x53a2f6[_0x38bf('0x1a')];this[_0x38bf('0x1b')]=_0x53a2f6['zohoAccounts'];this['deskAccounts']=_0x53a2f6[_0x38bf('0x1c')];this[_0x38bf('0x1d')]=_0x53a2f6['vtigerAccounts'];this[_0x38bf('0x1e')]=_0x53a2f6[_0x38bf('0x1e')];this['dynamics365Accounts']=_0x53a2f6[_0x38bf('0x1f')];this['freshsalesAccounts']=_0x53a2f6[_0x38bf('0x20')];this[_0x38bf('0x21')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x38bf('0x19')],'freshdesk':this[_0x38bf('0x18')],'sugarcrm':this[_0x38bf('0x1a')],'zoho':this[_0x38bf('0x1b')],'desk':this['deskAccounts'],'vtiger':this[_0x38bf('0x1d')],'dynamics365':this[_0x38bf('0x1f')],'freshsales':this[_0x38bf('0x20')],'servicenow':this[_0x38bf('0x1e')]};ami['on'](_0x38bf('0x22'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on']('custom:agentconnect',this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on']('custom:agentringnoanswer',this['syncCustomEvent'][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x25'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x26'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x27'),this['syncCustomEvent'][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x28'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x29'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x2a'),this['syncCustomEvent']['bind'](this));ami['on']('custom:amd',this['syncCustomEvent'][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x2b'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on']('custom:timeout',this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on']('custom:dialbegin',this[_0x38bf('0x2c')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x2d'),this[_0x38bf('0x2c')]['bind'](this));ami['on'](_0x38bf('0x2e'),this[_0x38bf('0x2c')][_0x38bf('0x24')](this));ami['on']('custom:newinteraction',this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x2f'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on'](_0x38bf('0x30'),this[_0x38bf('0x23')][_0x38bf('0x24')](this));ami['on']('custom:incomingmessage',this['syncCustomEvent']['bind'](this));ami['on']('custom:outgoingmessage',this[_0x38bf('0x23')]['bind'](this));ami['on'](_0x38bf('0x31'),this[_0x38bf('0x23')]['bind'](this));ami['on'](_0x38bf('0x32'),this[_0x38bf('0x23')]['bind'](this));ami['on'](_0x38bf('0x33'),this['syncCustomEvent']['bind'](this));}Trigger[_0x38bf('0x34')]['emit']=function(_0x2e50c6,_0x24cb44,_0x30f2b5){logger[_0x38bf('0x35')](_0x2e50c6,_0x24cb44,JSON[_0x38bf('0x36')](_0x30f2b5));io['to'](_0x2e50c6)[_0x38bf('0x37')](_0x24cb44,_0x30f2b5);};Trigger[_0x38bf('0x34')][_0x38bf('0x23')]=function(_0x3ba6c6){var _0x10d044=_[_0x38bf('0x38')](_0x3ba6c6);if(typeof _0x10d044[_0x38bf('0x39')]===_0x38bf('0x3a')){_0x10d044[_0x38bf('0x39')]=_0x38bf('0x3b');}logger[_0x38bf('0x3c')](_0x38bf('0x23'),util['inspect'](_0x10d044,{'showHidden':!![],'depth':null}));this[_0x38bf('0x3d')](_0x10d044);};Trigger[_0x38bf('0x34')][_0x38bf('0x2c')]=function(_0x39722f){if(this[_0x38bf('0x13')][_0x39722f[_0x38bf('0x3e')]]){this[_0x38bf('0x23')](_0x39722f);}};Trigger[_0x38bf('0x34')][_0x38bf('0x3d')]=function(_0x2d79ed){var _0x301827;for(var _0x160e65 in this[_0x38bf('0x12')]){if(this[_0x38bf('0x12')]['hasOwnProperty'](_0x160e65)){if(this['triggers'][_0x160e65][_0x38bf('0x3f')]){_0x301827=this['checkTrigger'](this[_0x38bf('0x12')][_0x160e65],_0x2d79ed);if(_0x301827){_[_0x38bf('0x40')](_0x2d79ed,_0x2d79ed[_0x38bf('0x41')]);for(var _0x484247=0x0,_0x38359d,_0x5dfda1,_0x55d846;_0x4842470x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../config/logger','desk','defaults','redis','localhost','socket.io-emitter','emit','application/json','validateEmail','info','Getting\x20agent\x20with\x20email','format','remoteUri','then','total_entries','find','_embedded','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x4ee16f,_0x3c8da9){var _0x37a7f1=function(_0x5df22e){while(--_0x5df22e){_0x4ee16f['push'](_0x4ee16f['shift']());}};_0x37a7f1(++_0x3c8da9);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/dynamics365.js b/server/services/ami/trigger/integration/dynamics365.js index 477312e..1553d55 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 _0x1dce=[']\x20Enduser\x20created!','forEach','includes','string','type','nameField','toLowerCase','substring','indexOf','content','ticketType','incidents','assign','getString','Subjects','/contacts(','phonecall','queue','callDirection','phonecalls','Descriptions','Fields','ticketId','format','user:%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','Recording\x20is\x20enabled!',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','md5','ioredis','dynamics365','redis','defaults','localhost','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','clientId','username','password','clientSecret','then','access_token','catch','toUpperCase','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','userEmail','email','internalemailaddress','isdisabled','info','systemuserid','userId','length','outbound','destcalleridnum','calleridnum','POST','contacts','/systemusers(','body','headers','odata-entityid','lastIndexOf','enduserId','telephone1','&$filter=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing'];(function(_0x2c360d,_0x4889f1){var _0x14c7f0=function(_0x5182de){while(--_0x5182de){_0x2c360d['push'](_0x2c360d['shift']());}};_0x14c7f0(++_0x4889f1);}(_0x1dce,0x106));var _0xe1dc=function(_0x18c977,_0x5aaec9){_0x18c977=_0x18c977-0x0;var _0x38a276=_0x1dce[_0x18c977];return _0x38a276;};'use strict';var _=require(_0xe1dc('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require('./util');var md5=require(_0xe1dc('0x1'));var Redis=require(_0xe1dc('0x2'));var logger=require('../../../../config/logger')(_0xe1dc('0x3'));var config=require('../../../../config/environment');config[_0xe1dc('0x4')]=_[_0xe1dc('0x5')](config[_0xe1dc('0x4')],{'host':_0xe1dc('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function getAuthToken(_0x517871,_0x4d5df7,_0x156bab){if(_0x517871[_0xe1dc('0x7')]){_0x517871[_0xe1dc('0x8')]=_0x517871[_0xe1dc('0x9')]['data7'];_0x517871[_0xe1dc('0xa')]=_0x517871[_0xe1dc('0x9')][_0xe1dc('0xb')];return Promise['resolve'](_0x517871[_0xe1dc('0x9')][_0xe1dc('0xc')]);}var _0x32d9f5={'method':'POST','uri':_0x4d5df7,'form':{'client_id':_0x517871[_0xe1dc('0xd')],'resource':_0x517871[_0xe1dc('0x8')],'username':_0x517871[_0xe1dc('0xe')],'password':_0x517871[_0xe1dc('0xf')],'grant_type':'password','client_secret':_0x517871[_0xe1dc('0x10')]},'json':!![]};return rp(_0x32d9f5)[_0xe1dc('0x11')](function(_0x417d9d){return _0x417d9d[_0xe1dc('0x12')];})[_0xe1dc('0x13')](function(_0x35e4f){logger['error']('['+[_0x156bab[_0xe1dc('0x14')]()]+']\x20Wrong\x20credentials!');return _0x35e4f[_0xe1dc('0x15')];});}function getUser(_0x207813,_0xa0d751,_0x1f5e3a,_0x47cff2,_0x23f960,_0x658c3c){return new Promise(function(_0x38ceff,_0x4a66a6){return getAuthToken(_0xa0d751,_0x47cff2,_0x658c3c)['then'](function(_0x744f73){var _0x19208e={'method':_0xe1dc('0x16'),'uri':_0x23f960+_0xe1dc('0x17'),'headers':{'Authorization':_0xe1dc('0x18')+_0x744f73,'OData-Version':_0xe1dc('0x19')},'json':!![]};return rp(_0x19208e);})[_0xe1dc('0x11')](function(_0x575580){var _0x5e8b49=_0x575580[_0xe1dc('0x1a')];var _0x562e1f=![];var _0x13a39c=null;if(!_[_0xe1dc('0x1b')](_0x1f5e3a)){if(intUtil[_0xe1dc('0x1c')](_0x1f5e3a['email'])){_0x207813[_0xe1dc('0x1d')]=_0x1f5e3a[_0xe1dc('0x1e')];for(_0x13a39c=0x0;_0x13a39c<_0x5e8b49['length'];_0x13a39c++){if(_0x5e8b49[_0x13a39c][_0xe1dc('0x1f')]===_0x1f5e3a[_0xe1dc('0x1e')]&&!_0x5e8b49[_0x13a39c][_0xe1dc('0x20')]){_0x562e1f=!![];logger[_0xe1dc('0x21')]('['+[_0x658c3c[_0xe1dc('0x14')]()]+']\x20Agent\x20found\x20'+_0x5e8b49[_0x13a39c][_0xe1dc('0x22')]+'!');_0x207813[_0xe1dc('0x23')]=_0x5e8b49[_0x13a39c]['systemuserid'];}}}}if(!_0x562e1f){logger[_0xe1dc('0x21')]('['+[_0x658c3c[_0xe1dc('0x14')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x207813[_0xe1dc('0x1d')]=_0xa0d751[_0xe1dc('0xe')];for(_0x13a39c=0x0;_0x13a39c<_0x5e8b49[_0xe1dc('0x24')];_0x13a39c++){if(_0x5e8b49[_0x13a39c][_0xe1dc('0x1f')]===_0xa0d751[_0xe1dc('0xe')]){_0x207813[_0xe1dc('0x23')]=_0x5e8b49[_0x13a39c][_0xe1dc('0x22')];}}}_0x38ceff(_0x207813);})[_0xe1dc('0x13')](function(_0x3a3a60){_0x4a66a6(_0x3a3a60[_0xe1dc('0x15')]);});});}function createEndUser(_0x7c13db,_0x33c52a,_0x2e9622,_0x403380,_0x3dcd99,_0x363420,_0x201b5e){return new Promise(function(_0x2f506a,_0x267805){return getAuthToken(_0x33c52a,_0x2e9622,_0x363420)[_0xe1dc('0x11')](function(_0x4207d4){var _0x51d605=_0x363420['toLowerCase']()===_0xe1dc('0x25')?_0x3dcd99[_0xe1dc('0x26')]:_0x3dcd99[_0xe1dc('0x27')];var _0x3c6662={'method':_0xe1dc('0x28'),'uri':_0x403380+_0xe1dc('0x29'),'body':{'fullname':_0x51d605,'firstname':_0x51d605,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xe1dc('0x2a')+_0x7c13db[_0xe1dc('0x23')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4207d4,'OData-Version':_0xe1dc('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x3c6662[_0xe1dc('0x2b')][_0x201b5e]=_0x51d605;return rp(_0x3c6662);})['then'](function(_0x2bb4d4){var _0x262b41=_0x2bb4d4[_0xe1dc('0x2c')][_0xe1dc('0x2d')];var _0x5a8767=_0x262b41['substring'](_0x262b41[_0xe1dc('0x2e')]('(')+0x1,_0x262b41['lastIndexOf'](')'));_0x7c13db[_0xe1dc('0x2f')]=_0x5a8767;_0x2f506a(_0x7c13db);})[_0xe1dc('0x13')](function(_0x331da3){_0x267805(_0x331da3[_0xe1dc('0x15')]);});});}function getEndUser(_0x792a67,_0x27161d,_0x1e4b23,_0x1449cf,_0x2e18de,_0x2f7d26,_0x28a23e,_0x2e4554){var _0x4fb450=_0x2f7d26['toLowerCase']()==='outbound'?_0x2e18de[_0xe1dc('0x26')]:_0x2e18de[_0xe1dc('0x27')];return getAuthToken(_0x27161d,_0x1e4b23,_0x2f7d26)[_0xe1dc('0x11')](function(_0x27c702){_0x2e4554=_0x2e4554?_0x2e4554:_0xe1dc('0x30');var _0x37936e={'method':'GET','uri':_0x1449cf+'contacts?$select='+_0x2e4554+_0xe1dc('0x31')+_0x2e4554+_0xe1dc('0x32')+_0x4fb450[_0xe1dc('0x33')]('+',_0xe1dc('0x34'))+'\x27','headers':{'Authorization':_0xe1dc('0x18')+_0x27c702,'If-None-Match':null,'OData-Version':_0xe1dc('0x19')},'json':!![]};return rp(_0x37936e);})[_0xe1dc('0x11')](function(_0x143c01){var _0x445fec=![];if(!_0x143c01)return _0x445fec;var _0x323392=_0x143c01[_0xe1dc('0x1a')];for(var _0x587d4d=0x0;_0x587d4d<_0x323392[_0xe1dc('0x24')];_0x587d4d++){if(_0x323392[_0x587d4d][_0x2e4554]===_0x4fb450){_0x445fec=!![];_0x792a67[_0xe1dc('0x2f')]=_0x323392[_0x587d4d][_0xe1dc('0x35')];}}return _0x445fec;})[_0xe1dc('0x11')](function(_0x3f4192){if(_0x3f4192)return _0x792a67;if(_0x28a23e===_0xe1dc('0x36')){logger[_0xe1dc('0x21')]('['+[_0x2f7d26[_0xe1dc('0x14')]()]+_0xe1dc('0x37'));return _0x792a67;}return createEndUser(_0x792a67,_0x27161d,_0x1e4b23,_0x1449cf,_0x2e18de,_0x2f7d26,_0x2e4554)['then'](function(_0x4a9ca9){logger[_0xe1dc('0x21')]('['+[_0x2f7d26[_0xe1dc('0x14')]()]+_0xe1dc('0x38'),_0x4a9ca9[_0xe1dc('0x2f')]);return _0x4a9ca9;});});}function getCustomFields(_0x29a3d0,_0x551e9e,_0x50020a){var _0x27c71={};if(_0x29a3d0['length']>0x0){_[_0xe1dc('0x39')](_0x29a3d0,function(_0x39dd63){if(_[_0xe1dc('0x3a')]([_0xe1dc('0x3b'),'picklist'],_0x39dd63[_0xe1dc('0x3c')])&&_0x39dd63[_0xe1dc('0x3d')]&&!_0x39dd63['customField']){var _0x234920=_0x39dd63['idField'][_0xe1dc('0x3e')]();var _0xf84e5d=_0x234920[_0xe1dc('0x3f')](0x0,_0x234920['indexOf']('_'));var _0x5cec84=_0x234920[_0xe1dc('0x3f')](_0x234920[_0xe1dc('0x40')]('_')+0x1);if(_0xf84e5d===_0x50020a){_0x27c71[_0x5cec84]=_0x39dd63[_0xe1dc('0x41')];}}});}return _0x27c71;}function getTicket(_0x4383f3,_0x3f9766,_0x3b20ab,_0x51a656,_0x5f464f,_0x5c69dc,_0xd6879a){return new Promise(function(_0x35cd4d,_0x588222){var _0x4784a8;return getAuthToken(_0x3f9766,_0x3b20ab,_0xd6879a)[_0xe1dc('0x11')](function(_0x495520){if(_0x5c69dc[_0xe1dc('0x42')]==='incident'){_0x4784a8={'method':'POST','uri':_0x51a656+_0xe1dc('0x43'),'body':Object[_0xe1dc('0x44')]({},{'title':intUtil[_0xe1dc('0x45')](_0x5c69dc[_0xe1dc('0x46')],_0x5f464f,'\x20'),'description':intUtil[_0xe1dc('0x45')](_0x5c69dc['Descriptions'],_0x5f464f,'\x0a'),'customerid_contact@odata.bind':_0x4383f3[_0xe1dc('0x2f')]?_0xe1dc('0x47')+_0x4383f3[_0xe1dc('0x2f')]+')':undefined,'ownerid@odata.bind':_0xe1dc('0x2a')+_0x4383f3['userId']+')','caseorigincode':'1'},getCustomFields(_0x5c69dc['Fields'],_0x5f464f,_0x5c69dc[_0xe1dc('0x42')])),'headers':{'Authorization':_0xe1dc('0x18')+_0x495520,'OData-Version':_0xe1dc('0x19')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x5c69dc['ticketType']===_0xe1dc('0x48')){var _0x550cb7=_0x4383f3[_0xe1dc('0x2f')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x4383f3[_0xe1dc('0x23')]+')','participationtypemask':_0x4383f3['callDirection']===_0xe1dc('0x49')?0x2:0x1},{'partyid_contact@odata.bind':_0xe1dc('0x47')+_0x4383f3[_0xe1dc('0x2f')]+')','participationtypemask':_0x4383f3[_0xe1dc('0x4a')]==='queue'?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0xe1dc('0x2a')+_0x4383f3[_0xe1dc('0x23')]+')','participationtypemask':_0x4383f3[_0xe1dc('0x4a')]===_0xe1dc('0x49')?0x2:0x1}];_0x4784a8={'method':_0xe1dc('0x28'),'uri':_0x51a656+_0xe1dc('0x4b'),'body':Object[_0xe1dc('0x44')]({},{'subject':intUtil[_0xe1dc('0x45')](_0x5c69dc[_0xe1dc('0x46')],_0x5f464f,'\x20'),'phonenumber':String(_0x5f464f[_0xe1dc('0x27')]),'description':intUtil[_0xe1dc('0x45')](_0x5c69dc[_0xe1dc('0x4c')],_0x5f464f,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4383f3['enduserId']?_0xe1dc('0x47')+_0x4383f3[_0xe1dc('0x2f')]+')':undefined,'ownerid@odata.bind':_0xe1dc('0x2a')+_0x4383f3[_0xe1dc('0x23')]+')','directioncode':_0x4383f3[_0xe1dc('0x4a')]==='queue'?![]:!![],'phonecall_activity_parties':_0x550cb7},getCustomFields(_0x5c69dc[_0xe1dc('0x4d')],_0x5f464f,_0x5c69dc['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x495520,'OData-Version':_0xe1dc('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4784a8);})[_0xe1dc('0x11')](function(_0x178ee8){var _0x1d14c4=_0x178ee8[_0xe1dc('0x2c')][_0xe1dc('0x2d')];var _0x486ada=_0x1d14c4[_0xe1dc('0x3f')](_0x1d14c4[_0xe1dc('0x2e')]('(')+0x1,_0x1d14c4[_0xe1dc('0x2e')](')'));_0x4383f3[_0xe1dc('0x4e')]=_0x486ada;_0x35cd4d(_0x4383f3);})[_0xe1dc('0x13')](function(_0x1181da){_0x588222(_0x1181da['message']);});});}function emit(_0x58710a,_0x2b9342,_0x23cd99,_0x12caa1){var _0x1a4034={'uri':util[_0xe1dc('0x4f')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0x58710a,_0x23cd99,_0x12caa1)};io['to'](util[_0xe1dc('0x4f')](_0xe1dc('0x50'),_0x2b9342))[_0xe1dc('0x51')](_0xe1dc('0x52'),_0x1a4034);}exports['cs']=function(_0x306970,_0x2d41d5,_0x56ba61,_0x246fd8,_0x5a489e,_0x1f613d,_0x10568a,_0x387c93){var _0x529316={};_0x1f613d['remoteUri']=_0x1f613d[_0xe1dc('0x7')]?intUtil[_0xe1dc('0x53')](_0x1f613d['CloudProvider'][_0xe1dc('0x54')]):intUtil['stripTrailingSlash'](_0x1f613d[_0xe1dc('0x8')]);_0x1f613d[_0xe1dc('0x55')]=intUtil[_0xe1dc('0x53')](_0x1f613d['serverUrl']);_0x529316[_0xe1dc('0x4a')]=_0x387c93===_0xe1dc('0x49')||_0x387c93===_0xe1dc('0x56')?_0xe1dc('0x49'):'outbound';var _0xd45073=_0x1f613d[_0xe1dc('0x7')]?util[_0xe1dc('0x4f')]('%s/api/data/v9.0/',_0x1f613d[_0xe1dc('0x9')][_0xe1dc('0x54')]):util[_0xe1dc('0x4f')](_0xe1dc('0x57'),_0x1f613d[_0xe1dc('0x8')]);var _0x280aad=util[_0xe1dc('0x4f')]('https://login.microsoftonline.com/%s/oauth2/token',_0x1f613d['tenantId']);var _0x102f5e=util[_0xe1dc('0x4f')](_0xe1dc('0x58'),_0x1f613d['serverUrl'],_0x2d41d5['uniqueid'],md5(_0x2d41d5[_0xe1dc('0x59')]));if(_0x5a489e&&_0x5a489e[_0xe1dc('0x5a')]){logger[_0xe1dc('0x21')](_0xe1dc('0x5b'),'Recording\x20is\x20enabled!');_0x2d41d5[_0xe1dc('0x5c')]=_0x102f5e;}else if(_0x10568a&&_0x10568a['recordingFormat']&&_0x10568a[_0xe1dc('0x5d')]!==_0xe1dc('0x5e')){logger[_0xe1dc('0x21')]('[OUTBOUND]',_0xe1dc('0x5f'));_0x2d41d5['recordingURL']=_0x102f5e;}else{_0x2d41d5['recordingURL']='';}return getUser(_0x529316,_0x1f613d,_0x246fd8,_0x280aad,_0xd45073,_0x387c93)[_0xe1dc('0x11')](function(_0x3474e8){logger['info']('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x60'),_0x3474e8[_0xe1dc('0x23')]);logger[_0xe1dc('0x21')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x61'),_0x3474e8[_0xe1dc('0x1d')]);return getEndUser(_0x3474e8,_0x1f613d,_0x280aad,_0xd45073,_0x2d41d5,_0x387c93,_0x56ba61[_0xe1dc('0x62')],_0x56ba61['additionalSearchContact']);})[_0xe1dc('0x11')](function(_0x10b3ba){logger['info']('['+_0x387c93['toUpperCase']()+']\x20The\x20Enduser\x20ID\x20is:',_0x10b3ba[_0xe1dc('0x2f')]);logger[_0xe1dc('0x21')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x63'),_0x2d41d5['calleridnum']);return getTicket(_0x10b3ba,_0x1f613d,_0x280aad,_0xd45073,_0x2d41d5,_0x56ba61,_0x387c93);})[_0xe1dc('0x11')](function(_0x1bd69b){logger['info'](util[_0xe1dc('0x4f')]('['+_0x387c93[_0xe1dc('0x14')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x56ba61[_0xe1dc('0x42')],_0x1bd69b[_0xe1dc('0x4e')]));logger['info'](util[_0xe1dc('0x4f')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x64'),_0x387c93));if(_0x387c93!==_0xe1dc('0x56')&&_0x56ba61['openNewTab']){logger[_0xe1dc('0x21')]('['+_0x387c93[_0xe1dc('0x14')]()+']',_0xe1dc('0x65'));emit(_0x1f613d[_0xe1dc('0x8')],_0x246fd8[_0xe1dc('0x66')],_0x56ba61[_0xe1dc('0x42')],_0x1bd69b[_0xe1dc('0x4e')]);}})['catch'](function(_0x308139){logger[_0xe1dc('0x67')]('['+_0x387c93[_0xe1dc('0x14')]()+_0xe1dc('0x68'),_0x308139[_0xe1dc('0x15')]);console[_0xe1dc('0x67')](_0xe1dc('0x69'),_0x308139);});}; \ No newline at end of file +var _0x4804=['Displaying\x20call\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Dynamics365\x20integration','request-promise','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','POST','clientId','password','clientSecret','then','access_token','error',']\x20Wrong\x20credentials!','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','email','userEmail','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','userId','info','toUpperCase','username','catch','message','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','body','odata-entityid','substring','lastIndexOf','telephone1','contacts?$select=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','enduserId','length','forEach','includes','string','picklist','type','nameField','customField','idField','content','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','Bearer\x20','phonecall','queue','phonecalls','assign','callDirection','Fields','headers','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','data7','serverUrl','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','unmanaged','openNewTab'];(function(_0x408de5,_0x24fa7b){var _0x2015a1=function(_0x13082c){while(--_0x13082c){_0x408de5['push'](_0x408de5['shift']());}};_0x2015a1(++_0x24fa7b);}(_0x4804,0xe3));var _0x4480=function(_0x51bb4e,_0x365990){_0x51bb4e=_0x51bb4e-0x0;var _0x33d753=_0x4804[_0x51bb4e];return _0x33d753;};'use strict';var _=require('lodash');var rp=require(_0x4480('0x0'));var util=require('util');var intUtil=require('./util');var md5=require(_0x4480('0x1'));var Redis=require(_0x4480('0x2'));var logger=require(_0x4480('0x3'))(_0x4480('0x4'));var config=require('../../../../config/environment');config[_0x4480('0x5')]=_[_0x4480('0x6')](config[_0x4480('0x5')],{'host':_0x4480('0x7'),'port':0x18eb});var io=require(_0x4480('0x8'))(new Redis(config[_0x4480('0x5')]));function getAuthToken(_0x130b94,_0xeba925,_0x51219c){if(_0x130b94[_0x4480('0x9')]){_0x130b94[_0x4480('0xa')]=_0x130b94[_0x4480('0xb')]['data7'];_0x130b94[_0x4480('0xc')]=_0x130b94[_0x4480('0xb')][_0x4480('0xd')];return Promise['resolve'](_0x130b94[_0x4480('0xb')][_0x4480('0xe')]);}var _0x2734b9={'method':_0x4480('0xf'),'uri':_0xeba925,'form':{'client_id':_0x130b94[_0x4480('0x10')],'resource':_0x130b94[_0x4480('0xa')],'username':_0x130b94['username'],'password':_0x130b94[_0x4480('0x11')],'grant_type':_0x4480('0x11'),'client_secret':_0x130b94[_0x4480('0x12')]},'json':!![]};return rp(_0x2734b9)[_0x4480('0x13')](function(_0x1c155f){return _0x1c155f[_0x4480('0x14')];})['catch'](function(_0x301934){logger[_0x4480('0x15')]('['+[_0x51219c['toUpperCase']()]+_0x4480('0x16'));return _0x301934['message'];});}function getUser(_0x59e90e,_0x200722,_0x41c620,_0xa48e9,_0x4e1688,_0x38cd35){return new Promise(function(_0x35e9ba,_0xa5c872){return getAuthToken(_0x200722,_0xa48e9,_0x38cd35)[_0x4480('0x13')](function(_0x3f760f){var _0x3d0b90={'method':_0x4480('0x17'),'uri':_0x4e1688+_0x4480('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x3f760f,'OData-Version':_0x4480('0x19')},'json':!![]};return rp(_0x3d0b90);})[_0x4480('0x13')](function(_0x354094){var _0x73362a=_0x354094[_0x4480('0x1a')];var _0x4b2ddc=![];var _0x25b260=null;if(!_[_0x4480('0x1b')](_0x41c620)){if(intUtil['validateEmail'](_0x41c620[_0x4480('0x1c')])){_0x59e90e[_0x4480('0x1d')]=_0x41c620[_0x4480('0x1c')];for(_0x25b260=0x0;_0x25b260<_0x73362a['length'];_0x25b260++){if(_0x73362a[_0x25b260][_0x4480('0x1e')]===_0x41c620[_0x4480('0x1c')]&&!_0x73362a[_0x25b260][_0x4480('0x1f')]){_0x4b2ddc=!![];logger['info']('['+[_0x38cd35['toUpperCase']()]+_0x4480('0x20')+_0x73362a[_0x25b260][_0x4480('0x21')]+'!');_0x59e90e[_0x4480('0x22')]=_0x73362a[_0x25b260][_0x4480('0x21')];}}}}if(!_0x4b2ddc){logger[_0x4480('0x23')]('['+[_0x38cd35[_0x4480('0x24')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x59e90e[_0x4480('0x1d')]=_0x200722[_0x4480('0x25')];for(_0x25b260=0x0;_0x25b260<_0x73362a['length'];_0x25b260++){if(_0x73362a[_0x25b260][_0x4480('0x1e')]===_0x200722['username']){_0x59e90e['userId']=_0x73362a[_0x25b260][_0x4480('0x21')];}}}_0x35e9ba(_0x59e90e);})[_0x4480('0x26')](function(_0x5946c3){_0xa5c872(_0x5946c3[_0x4480('0x27')]);});});}function createEndUser(_0x30b18c,_0x494c1e,_0x353310,_0x1b815d,_0x4c761,_0x328c0c,_0x189de5){return new Promise(function(_0x1517fe,_0x106050){return getAuthToken(_0x494c1e,_0x353310,_0x328c0c)['then'](function(_0x1d94af){var _0x9f355c=_0x328c0c[_0x4480('0x28')]()===_0x4480('0x29')?_0x4c761[_0x4480('0x2a')]:_0x4c761[_0x4480('0x2b')];var _0x352653={'method':_0x4480('0xf'),'uri':_0x1b815d+_0x4480('0x2c'),'body':{'fullname':_0x9f355c,'firstname':_0x9f355c,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x4480('0x2d')+_0x30b18c['userId']+')'},'headers':{'Authorization':'Bearer\x20'+_0x1d94af,'OData-Version':_0x4480('0x19')},'json':!![],'resolveWithFullResponse':!![]};_0x352653[_0x4480('0x2e')][_0x189de5]=_0x9f355c;return rp(_0x352653);})['then'](function(_0x5af384){var _0x4e4477=_0x5af384['headers'][_0x4480('0x2f')];var _0x58b0e6=_0x4e4477[_0x4480('0x30')](_0x4e4477[_0x4480('0x31')]('(')+0x1,_0x4e4477['lastIndexOf'](')'));_0x30b18c['enduserId']=_0x58b0e6;_0x1517fe(_0x30b18c);})['catch'](function(_0x4a96a8){_0x106050(_0x4a96a8['message']);});});}function getEndUser(_0x2577f9,_0x3e8fa2,_0x373e15,_0x4bd285,_0xfcb373,_0x266776,_0xea6b1e,_0x451cb2){var _0x172269=_0x266776[_0x4480('0x28')]()===_0x4480('0x29')?_0xfcb373[_0x4480('0x2a')]:_0xfcb373[_0x4480('0x2b')];return getAuthToken(_0x3e8fa2,_0x373e15,_0x266776)[_0x4480('0x13')](function(_0x250afb){_0x451cb2=_0x451cb2?_0x451cb2:_0x4480('0x32');var _0x548079={'method':'GET','uri':_0x4bd285+_0x4480('0x33')+_0x451cb2+'&$filter='+_0x451cb2+_0x4480('0x34')+_0x172269[_0x4480('0x35')]('+','%2b')+'\x27','headers':{'Authorization':'Bearer\x20'+_0x250afb,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x548079);})[_0x4480('0x13')](function(_0x5631cb){var _0x4d4c0d=![];if(!_0x5631cb)return _0x4d4c0d;var _0x20e75b=_0x5631cb['value'];for(var _0x456c10=0x0;_0x456c10<_0x20e75b['length'];_0x456c10++){if(_0x20e75b[_0x456c10][_0x451cb2]===_0x172269){_0x4d4c0d=!![];_0x2577f9['enduserId']=_0x20e75b[_0x456c10]['contactid'];}}return _0x4d4c0d;})[_0x4480('0x13')](function(_0x34fd24){if(_0x34fd24)return _0x2577f9;if(_0xea6b1e===_0x4480('0x36')){logger[_0x4480('0x23')]('['+[_0x266776[_0x4480('0x24')]()]+_0x4480('0x37'));return _0x2577f9;}return createEndUser(_0x2577f9,_0x3e8fa2,_0x373e15,_0x4bd285,_0xfcb373,_0x266776,_0x451cb2)[_0x4480('0x13')](function(_0x1d0b3e){logger['info']('['+[_0x266776['toUpperCase']()]+_0x4480('0x38'),_0x1d0b3e[_0x4480('0x39')]);return _0x1d0b3e;});});}function getCustomFields(_0x2e3aeb,_0x308b6d,_0x4cd2cd){var _0x1ae93f={};if(_0x2e3aeb[_0x4480('0x3a')]>0x0){_[_0x4480('0x3b')](_0x2e3aeb,function(_0x3b177c){if(_[_0x4480('0x3c')]([_0x4480('0x3d'),_0x4480('0x3e')],_0x3b177c[_0x4480('0x3f')])&&_0x3b177c[_0x4480('0x40')]&&!_0x3b177c[_0x4480('0x41')]){var _0x2151e8=_0x3b177c[_0x4480('0x42')][_0x4480('0x28')]();var _0x12e5ca=_0x2151e8[_0x4480('0x30')](0x0,_0x2151e8['indexOf']('_'));var _0x304812=_0x2151e8[_0x4480('0x30')](_0x2151e8['indexOf']('_')+0x1);if(_0x12e5ca===_0x4cd2cd){_0x1ae93f[_0x304812]=_0x3b177c[_0x4480('0x43')];}}});}return _0x1ae93f;}function getTicket(_0x971e43,_0x227721,_0x245e0c,_0x2fac9d,_0x594647,_0x2c597b,_0x359160){return new Promise(function(_0x48a7c2,_0x4bad25){var _0x32c289;return getAuthToken(_0x227721,_0x245e0c,_0x359160)['then'](function(_0x8a62fc){if(_0x2c597b[_0x4480('0x44')]===_0x4480('0x45')){_0x32c289={'method':_0x4480('0xf'),'uri':_0x2fac9d+_0x4480('0x46'),'body':Object['assign']({},{'title':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x48')],_0x594647,'\x20'),'description':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x49')],_0x594647,'\x0a'),'customerid_contact@odata.bind':_0x971e43[_0x4480('0x39')]?_0x4480('0x4a')+_0x971e43[_0x4480('0x39')]+')':undefined,'ownerid@odata.bind':_0x4480('0x2d')+_0x971e43[_0x4480('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x2c597b['Fields'],_0x594647,_0x2c597b[_0x4480('0x44')])),'headers':{'Authorization':_0x4480('0x4b')+_0x8a62fc,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2c597b['ticketType']===_0x4480('0x4c')){var _0x29a8=_0x971e43[_0x4480('0x39')]?[{'partyid_systemuser@odata.bind':_0x4480('0x2d')+_0x971e43['userId']+')','participationtypemask':_0x971e43['callDirection']===_0x4480('0x4d')?0x2:0x1},{'partyid_contact@odata.bind':_0x4480('0x4a')+_0x971e43['enduserId']+')','participationtypemask':_0x971e43['callDirection']===_0x4480('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x4480('0x2d')+_0x971e43[_0x4480('0x22')]+')','participationtypemask':_0x971e43['callDirection']===_0x4480('0x4d')?0x2:0x1}];_0x32c289={'method':_0x4480('0xf'),'uri':_0x2fac9d+_0x4480('0x4e'),'body':Object[_0x4480('0x4f')]({},{'subject':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x48')],_0x594647,'\x20'),'phonenumber':String(_0x594647[_0x4480('0x2b')]),'description':intUtil[_0x4480('0x47')](_0x2c597b[_0x4480('0x49')],_0x594647,'\x0a'),'regardingobjectid_contact@odata.bind':_0x971e43[_0x4480('0x39')]?'/contacts('+_0x971e43[_0x4480('0x39')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x971e43['userId']+')','directioncode':_0x971e43[_0x4480('0x50')]===_0x4480('0x4d')?![]:!![],'phonecall_activity_parties':_0x29a8},getCustomFields(_0x2c597b[_0x4480('0x51')],_0x594647,_0x2c597b[_0x4480('0x44')])),'headers':{'Authorization':_0x4480('0x4b')+_0x8a62fc,'OData-Version':_0x4480('0x19')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x32c289);})[_0x4480('0x13')](function(_0x28e238){var _0x4dca11=_0x28e238[_0x4480('0x52')]['odata-entityid'];var _0x222cd6=_0x4dca11[_0x4480('0x30')](_0x4dca11[_0x4480('0x31')]('(')+0x1,_0x4dca11['lastIndexOf'](')'));_0x971e43[_0x4480('0x53')]=_0x222cd6;_0x48a7c2(_0x971e43);})[_0x4480('0x26')](function(_0x4ffe86){_0x4bad25(_0x4ffe86[_0x4480('0x27')]);});});}function emit(_0x22a2e7,_0x4ffe8b,_0x41d303,_0x1cdbbd){var _0x125101={'uri':util[_0x4480('0x54')](_0x4480('0x55'),_0x22a2e7,_0x41d303,_0x1cdbbd)};io['to'](util[_0x4480('0x54')]('user:%s',_0x4ffe8b))[_0x4480('0x56')](_0x4480('0x57'),_0x125101);}exports['cs']=function(_0x20d405,_0x16c4f0,_0x56bf1f,_0x277519,_0x5ede0,_0x39b0df,_0x1039a8,_0xd8a542){var _0x3cb0ab={};_0x39b0df[_0x4480('0xa')]=_0x39b0df[_0x4480('0x9')]?intUtil[_0x4480('0x58')](_0x39b0df['CloudProvider'][_0x4480('0x59')]):intUtil[_0x4480('0x58')](_0x39b0df[_0x4480('0xa')]);_0x39b0df[_0x4480('0x5a')]=intUtil['stripTrailingSlash'](_0x39b0df[_0x4480('0x5a')]);_0x3cb0ab['callDirection']=_0xd8a542===_0x4480('0x4d')||_0xd8a542==='unmanaged'?_0x4480('0x4d'):_0x4480('0x29');var _0x2e378c=_0x39b0df['modernAuthentication']?util[_0x4480('0x54')](_0x4480('0x5b'),_0x39b0df[_0x4480('0xb')][_0x4480('0x59')]):util[_0x4480('0x54')](_0x4480('0x5b'),_0x39b0df[_0x4480('0xa')]);var _0x23fcec=util[_0x4480('0x54')](_0x4480('0x5c'),_0x39b0df[_0x4480('0xc')]);var _0x1bacf0=util[_0x4480('0x54')](_0x4480('0x5d'),_0x39b0df['serverUrl'],_0x16c4f0['uniqueid'],md5(_0x16c4f0[_0x4480('0x5e')]));if(_0x5ede0&&_0x5ede0[_0x4480('0x5f')]){logger[_0x4480('0x23')](_0x4480('0x60'),_0x4480('0x61'));_0x16c4f0['recordingURL']=_0x1bacf0;}else if(_0x1039a8&&_0x1039a8[_0x4480('0x62')]&&_0x1039a8[_0x4480('0x62')]!=='none'){logger['info'](_0x4480('0x63'),_0x4480('0x61'));_0x16c4f0[_0x4480('0x64')]=_0x1bacf0;}else{_0x16c4f0[_0x4480('0x64')]='';}return getUser(_0x3cb0ab,_0x39b0df,_0x277519,_0x23fcec,_0x2e378c,_0xd8a542)['then'](function(_0x58fde9){logger[_0x4480('0x23')]('['+_0xd8a542[_0x4480('0x24')]()+']\x20The\x20User\x20ID\x20is:',_0x58fde9['userId']);logger[_0x4480('0x23')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x65'),_0x58fde9['userEmail']);return getEndUser(_0x58fde9,_0x39b0df,_0x23fcec,_0x2e378c,_0x16c4f0,_0xd8a542,_0x56bf1f[_0x4480('0x66')],_0x56bf1f['additionalSearchContact']);})[_0x4480('0x13')](function(_0x115443){logger['info']('['+_0xd8a542['toUpperCase']()+_0x4480('0x67'),_0x115443[_0x4480('0x39')]);logger[_0x4480('0x23')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x68'),_0x16c4f0[_0x4480('0x2b')]);return getTicket(_0x115443,_0x39b0df,_0x23fcec,_0x2e378c,_0x16c4f0,_0x56bf1f,_0xd8a542);})['then'](function(_0x57d192){logger[_0x4480('0x23')](util[_0x4480('0x54')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x69'),_0x56bf1f['ticketType'],_0x57d192['ticketId']));logger[_0x4480('0x23')](util[_0x4480('0x54')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x6a'),_0xd8a542));if(_0xd8a542!==_0x4480('0x6b')&&_0x56bf1f[_0x4480('0x6c')]){logger['info']('['+_0xd8a542[_0x4480('0x24')]()+']',_0x4480('0x6d'));emit(_0x39b0df[_0x4480('0xa')],_0x277519[_0x4480('0x6e')],_0x56bf1f[_0x4480('0x44')],_0x57d192['ticketId']);}})[_0x4480('0x26')](function(_0x46c816){logger[_0x4480('0x15')]('['+_0xd8a542[_0x4480('0x24')]()+_0x4480('0x6f'),_0x46c816[_0x4480('0x27')]);console['error']('Error\x20running\x20Dynamics365\x20integration',_0x46c816);});}; \ 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 8e78a05..479246c 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 _0x3cb7=['%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','error','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','lodash','request-promise','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','Caller\x20-\x20%s','calleridnum','Subjects','getString','
','Tags','name','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','remoteUri','POST','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','apiKey','toString','stringify','map','forEach','includes','string','picklist','nameField','customField','content','idField','type','variable','variableName','push','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL'];(function(_0x28f32c,_0x4cc342){var _0x355402=function(_0xdb5032){while(--_0xdb5032){_0x28f32c['push'](_0x28f32c['shift']());}};_0x355402(++_0x4cc342);}(_0x3cb7,0x11e));var _0x73cb=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x3cb7[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x73cb('0x0'));var rp=require(_0x73cb('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x73cb('0x2'));var intUtil=require(_0x73cb('0x3'));var config=require('../../../../config/environment');var logger=require(_0x73cb('0x4'))(_0x73cb('0x5'));config[_0x73cb('0x6')]=_[_0x73cb('0x7')](config['redis'],{'host':_0x73cb('0x8'),'port':0x18eb});var io=require(_0x73cb('0x9'))(new Redis(config[_0x73cb('0x6')]));var headers={'Content-Type':'application/json','Accept':_0x73cb('0xa')};function emit(_0x21b8f0,_0x54ea24,_0x2e04ca){io['to'](_0x21b8f0)[_0x73cb('0xb')](_0x54ea24,_0x2e04ca);}function getTicket(_0x4216c0,_0x2ae33b,_0x1242ce,_0x23d44f,_0xd968c5){logger[_0x73cb('0xc')](_0x73cb('0xd'));var _0x40606b=_['merge']({'responder_id':_0x2ae33b['id'],'requester_id':_0x1242ce['id'],'name':util['format'](_0x73cb('0xe'),_0xd968c5['calleridname']),'phone':_0xd968c5[_0x73cb('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x23d44f[_0x73cb('0x10')],_0xd968c5,'\x20'),'description':intUtil[_0x73cb('0x11')](_0x23d44f['Descriptions'],_0xd968c5,_0x73cb('0x12')),'tags':getTags(_0x23d44f[_0x73cb('0x13')],_0x73cb('0x14'))},getCustomFields(_0x23d44f['Fields'],_0xd968c5));_0x40606b[_0x73cb('0x15')]=_[_0x73cb('0x16')](_[_0x73cb('0x17')](_0x40606b[_0x73cb('0x15')],'id'),_0x73cb('0x18'));return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x1a'),_0x4216c0[_0x73cb('0x1b')]),'method':_0x73cb('0x1c'),'body':_0x40606b})['then'](function(_0x130031){logger[_0x73cb('0xc')](_0x73cb('0x1d'));return _0x130031;});}function getUser(_0x1b4526,_0x1439f7){if(intUtil[_0x73cb('0x1e')](_0x1439f7)){return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x1f'),_0x1b4526[_0x73cb('0x1b')]),'qs':{'email':_0x1439f7}})[_0x73cb('0x20')](function(_0x158355){if(_0x158355[_0x73cb('0x21')]){logger['info'](_0x73cb('0x22'));return _[_0x73cb('0x23')](_0x158355,function(_0x240a04){return _0x240a04[_0x73cb('0x24')][_0x73cb('0x25')]===_0x1439f7;});}else{logger[_0x73cb('0xc')](_0x73cb('0x26'));return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x27'),_0x1b4526[_0x73cb('0x1b')])})[_0x73cb('0x20')](function(_0x153367){logger[_0x73cb('0xc')]('Admin\x20account\x20selected.');return _0x153367;});}});}else{logger[_0x73cb('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x27'),_0x1b4526['remoteUri'])})[_0x73cb('0x20')](function(_0x2f7240){logger[_0x73cb('0xc')](_0x73cb('0x28'));return _0x2f7240;});}}function getEndUser(_0x195de2,_0x25ae8d,_0x325b0e){logger[_0x73cb('0xc')](_0x73cb('0x29'),_0x325b0e);return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x2a'),_0x195de2['remoteUri']),'qs':{'phone':_0x325b0e}})[_0x73cb('0x20')](function(_0x2fef25){if(_0x2fef25[_0x73cb('0x21')]){logger['info']('Enduser\x20found!');return _['find'](_0x2fef25,{'phone':_0x325b0e});}else{logger[_0x73cb('0xc')](_0x73cb('0x2b'));return request({'uri':util[_0x73cb('0x19')](_0x73cb('0x2a'),_0x195de2[_0x73cb('0x1b')]),'method':_0x73cb('0x1c'),'body':{'name':_0x25ae8d,'phone':_0x325b0e}})['then'](function(_0x168f7f){logger[_0x73cb('0xc')](_0x73cb('0x2c'));return _0x168f7f;});}});}function getAuth(_0x2f8c6c){return util[_0x73cb('0x19')]('Basic\x20%s',new Buffer(_0x2f8c6c[_0x73cb('0x2d')]+':X')[_0x73cb('0x2e')]('base64'));}function request(_0x38cbf7){logger['debug']('[HTTP]',JSON[_0x73cb('0x2f')](_0x38cbf7));return rp(_[_0x73cb('0x7')](_0x38cbf7,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1eae76,_0xb2aa15){var _0x2921e3=[];if(_0x1eae76&&_0x1eae76[_0x73cb('0x21')]>0x0){_0x2921e3=_[_0x73cb('0x30')](_0x1eae76,_0xb2aa15);}return _0x2921e3;}function getCustomFields(_0x38b0c1,_0x28d95b){var _0x5756fe=[];var _0x1eed8d={'custom_fields':[]};if(_0x38b0c1[_0x73cb('0x21')]>0x0){_[_0x73cb('0x31')](_0x38b0c1,function(_0x5480ce){if(_[_0x73cb('0x32')]([_0x73cb('0x33'),_0x73cb('0x34')],_0x5480ce['type'])&&_0x5480ce[_0x73cb('0x35')]&&!_0x5480ce[_0x73cb('0x36')]){_0x1eed8d[_0x5480ce[_0x73cb('0x35')]['toLowerCase']()]=_0x5480ce[_0x73cb('0x37')][_0x73cb('0x2e')]();}else if(_[_0x73cb('0x32')]([_0x73cb('0x33'),_0x73cb('0x34')],_0x5480ce['type'])&&_0x5480ce['idField']&&_0x5480ce[_0x73cb('0x36')]){_0x1eed8d[_0x73cb('0x15')]['push']({'id':_0x5480ce[_0x73cb('0x38')],'value':_0x5480ce['content'][_0x73cb('0x2e')]()});}else if(_0x5480ce[_0x73cb('0x39')]===_0x73cb('0x3a')&&_0x5480ce[_0x73cb('0x3b')]&&_0x5480ce[_0x73cb('0x38')]&&_0x5480ce[_0x73cb('0x36')]){_0x28d95b[_0x5480ce['variableName']]&&_0x1eed8d[_0x73cb('0x15')][_0x73cb('0x3c')]({'id':_0x5480ce['idField'],'value':_0x28d95b[_0x5480ce['variableName']][_0x73cb('0x2e')]()});}else if(_0x5480ce['type']==='customVariable'&&_0x5480ce[_0x73cb('0x3d')]&&_0x5480ce[_0x73cb('0x3d')]['name']&&_0x5480ce[_0x73cb('0x38')]&&_0x5480ce[_0x73cb('0x36')]){_0x28d95b[_0x5480ce['Variable'][_0x73cb('0x14')][_0x73cb('0x3e')]()]&&_0x1eed8d['custom_fields']['push']({'id':_0x5480ce['idField'],'value':_0x28d95b[_0x5480ce['Variable']['name'][_0x73cb('0x3e')]()][_0x73cb('0x2e')]()});}});}return _0x1eed8d;}exports[_0x73cb('0x3f')]=function(_0x4040ff,_0x18f07e,_0x3b4184,_0x206a58,_0x331cbe,_0x103597){var _0x114df8,_0x5ddf8f;_0x103597[_0x73cb('0x1b')]=intUtil[_0x73cb('0x40')](_0x103597['remoteUri']);_0x103597[_0x73cb('0x41')]=intUtil[_0x73cb('0x40')](_0x103597[_0x73cb('0x41')]);if(_0x331cbe&&_0x331cbe[_0x73cb('0x42')]){logger[_0x73cb('0xc')](_0x73cb('0x43'),_0x73cb('0x44'));_0x18f07e[_0x73cb('0x45')]=util[_0x73cb('0x19')](_0x73cb('0x46'),_0x103597['serverUrl'],_0x18f07e[_0x73cb('0x47')],md5(_0x18f07e[_0x73cb('0x47')]));}else{_0x18f07e['recordingURL']='';}headers[_0x73cb('0x48')]=getAuth(_0x103597);return getUser(_0x103597,_0x206a58[_0x73cb('0x25')])[_0x73cb('0x20')](function(_0x4cf743){_0x114df8=_0x4cf743;logger['info'](_0x73cb('0x49'),_0x114df8['id']);return getEndUser(_0x103597,_0x18f07e[_0x73cb('0x4a')],_0x18f07e[_0x73cb('0xf')]);})['then'](function(_0x50d074){_0x5ddf8f=_0x50d074;logger['info'](_0x73cb('0x4b'),_0x5ddf8f['id']);return getTicket(_0x103597,_0x114df8,_0x5ddf8f,_0x3b4184,_0x18f07e);})['then'](function(_0x1ea6cf){if(_0x1ea6cf&&_0x1ea6cf['id']){logger['info']('Ticket\x20created!');logger[_0x73cb('0xc')]('The\x20Ticket\x20ID\x20is:',_0x1ea6cf['id']);logger['info'](_0x73cb('0x43'),_0x73cb('0x4c'));emit(util[_0x73cb('0x19')](_0x73cb('0x4d'),_0x206a58['name']),_0x73cb('0x4e'),{'uri':util['format'](_0x73cb('0x4f'),_0x103597[_0x73cb('0x1b')],_0x1ea6cf['id'])});}})['catch'](function(_0x5a9ddb){logger[_0x73cb('0x50')]('[QUEUE]',JSON['stringify'](_0x5a9ddb));});};exports[_0x73cb('0x51')]=function(_0x393abd,_0x3fa95e,_0x199719,_0x4d120,_0x55a2be,_0x3ffdaa,_0x322a86){var _0x5b4ada,_0x5d425b;_0x3ffdaa[_0x73cb('0x1b')]=intUtil[_0x73cb('0x40')](_0x3ffdaa[_0x73cb('0x1b')]);_0x3ffdaa[_0x73cb('0x41')]=intUtil['stripTrailingSlash'](_0x3ffdaa[_0x73cb('0x41')]);if(_0x322a86&&_0x322a86[_0x73cb('0x52')]&&_0x322a86[_0x73cb('0x52')]!=='none'){logger[_0x73cb('0xc')](_0x73cb('0x53'),_0x73cb('0x44'));_0x3fa95e[_0x73cb('0x45')]=util[_0x73cb('0x19')](_0x73cb('0x46'),_0x3ffdaa[_0x73cb('0x41')],_0x3fa95e[_0x73cb('0x47')],md5(_0x3fa95e[_0x73cb('0x47')]));}headers[_0x73cb('0x48')]=getAuth(_0x3ffdaa);return getUser(_0x3ffdaa,_0x4d120[_0x73cb('0x25')])[_0x73cb('0x20')](function(_0x231a1c){_0x5b4ada=_0x231a1c;logger['info'](_0x73cb('0x49'),_0x5b4ada['id']);return getEndUser(_0x3ffdaa,_0x3fa95e[_0x73cb('0x54')],_0x3fa95e[_0x73cb('0x55')]);})[_0x73cb('0x20')](function(_0x2a6d5b){_0x5d425b=_0x2a6d5b;logger[_0x73cb('0xc')]('The\x20Enduser\x20ID\x20is:',_0x5d425b['id']);return getTicket(_0x3ffdaa,_0x5b4ada,_0x5d425b,_0x199719,_0x3fa95e);})[_0x73cb('0x20')](function(_0x4cc6a9){if(_0x4cc6a9&&_0x4cc6a9['id']){logger['info']('Ticket\x20created!');logger['info'](_0x73cb('0x56'),_0x4cc6a9['id']);logger[_0x73cb('0xc')]('[OUTBOUND]',_0x73cb('0x4c'));emit(util['format'](_0x73cb('0x4d'),_0x4d120['name']),'trigger:browser:url',{'uri':util[_0x73cb('0x19')](_0x73cb('0x4f'),_0x3ffdaa[_0x73cb('0x1b')],_0x4cc6a9['id'])});}})['catch'](function(_0x2a5ee8){logger['error']('[OUTBOUND]',JSON[_0x73cb('0x2f')](_0x2a5ee8));});};exports[_0x73cb('0x57')]=function(_0x12bdc1,_0xb7d0e4,_0x4a80d2,_0x2398e3,_0x28bd5b,_0x1b7583){var _0x99be76,_0x530cd6;_0x1b7583[_0x73cb('0x1b')]=intUtil[_0x73cb('0x40')](_0x1b7583[_0x73cb('0x1b')]);_0x1b7583['serverUrl']=intUtil[_0x73cb('0x40')](_0x1b7583[_0x73cb('0x41')]);if(_0x28bd5b&&_0x28bd5b[_0x73cb('0x42')]){logger['info']('['+_0xb7d0e4['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0xb7d0e4['recordingURL']=util[_0x73cb('0x19')](_0x73cb('0x46'),_0x1b7583[_0x73cb('0x41')],_0xb7d0e4[_0x73cb('0x47')],md5(_0xb7d0e4[_0x73cb('0x47')]));}else{_0xb7d0e4['recordingURL']='';}headers[_0x73cb('0x48')]=getAuth(_0x1b7583);return getUser(_0x1b7583,'')['then'](function(_0x2694aa){_0x99be76=_0x2694aa;logger[_0x73cb('0xc')](_0x73cb('0x49'),_0x99be76['id']);return getEndUser(_0x1b7583,_0xb7d0e4[_0x73cb('0x4a')],_0xb7d0e4[_0x73cb('0xf')]);})[_0x73cb('0x20')](function(_0x1890de){_0x530cd6=_0x1890de;logger[_0x73cb('0xc')]('The\x20Enduser\x20ID\x20is:',_0x530cd6['id']);return getTicket(_0x1b7583,_0x99be76,_0x530cd6,_0x4a80d2,_0xb7d0e4);})[_0x73cb('0x20')](function(_0x389710){if(_0x389710){logger[_0x73cb('0xc')]('Ticket\x20created!');logger[_0x73cb('0xc')](_0x73cb('0x56'),_0x389710['id']);}})['catch'](function(_0x3c53bc){logger[_0x73cb('0x50')]('['+_0xb7d0e4[_0x73cb('0x58')]['toUpperCase']()+']',JSON[_0x73cb('0x2f')](_0x3c53bc));});}; \ No newline at end of file +var _0x16cf=['uniqueid','Authorization','destcalleridnum','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','Recording\x20is\x20enabled!','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','defaults','localhost','redis','emit','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','
','Tags','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','then','contact','email','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','length','Enduser\x20found!','find','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','base64','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','push','idField','variable','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','catch','error','recordingFormat','none'];(function(_0x3074f3,_0x4f2c03){var _0x53f112=function(_0x4a17af){while(--_0x4a17af){_0x3074f3['push'](_0x3074f3['shift']());}};_0x53f112(++_0x4f2c03);}(_0x16cf,0x114));var _0xf16c=function(_0x19b8c6,_0x15fa95){_0x19b8c6=_0x19b8c6-0x0;var _0x45dfda=_0x16cf[_0x19b8c6];return _0x45dfda;};'use strict';var _=require(_0xf16c('0x0'));var rp=require(_0xf16c('0x1'));var md5=require(_0xf16c('0x2'));var util=require(_0xf16c('0x3'));var Redis=require(_0xf16c('0x4'));var intUtil=require('./util');var config=require(_0xf16c('0x5'));var logger=require('../../../../config/logger')(_0xf16c('0x6'));config['redis']=_[_0xf16c('0x7')](config['redis'],{'host':_0xf16c('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf16c('0x9')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x4bd850,_0x421ede,_0x77793a){io['to'](_0x4bd850)[_0xf16c('0xa')](_0x421ede,_0x77793a);}function getTicket(_0x313194,_0x506deb,_0x110794,_0x5751f2,_0x36abd3){logger['info']('Creating\x20new\x20ticket...');var _0xa999c=_['merge']({'responder_id':_0x506deb['id'],'requester_id':_0x110794['id'],'name':util['format'](_0xf16c('0xb'),_0x36abd3[_0xf16c('0xc')]),'phone':_0x36abd3[_0xf16c('0xd')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x5751f2[_0xf16c('0xe')],_0x36abd3,'\x20'),'description':intUtil['getString'](_0x5751f2['Descriptions'],_0x36abd3,_0xf16c('0xf')),'tags':getTags(_0x5751f2[_0xf16c('0x10')],'name')},getCustomFields(_0x5751f2[_0xf16c('0x11')],_0x36abd3));_0xa999c['custom_fields']=_[_0xf16c('0x12')](_[_0xf16c('0x13')](_0xa999c[_0xf16c('0x14')],'id'),_0xf16c('0x15'));return request({'uri':util[_0xf16c('0x16')](_0xf16c('0x17'),_0x313194[_0xf16c('0x18')]),'method':_0xf16c('0x19'),'body':_0xa999c})['then'](function(_0x3474f2){logger[_0xf16c('0x1a')](_0xf16c('0x1b'));return _0x3474f2;});}function getUser(_0x1317f6,_0x5f32f3){if(intUtil[_0xf16c('0x1c')](_0x5f32f3)){return request({'uri':util[_0xf16c('0x16')](_0xf16c('0x1d'),_0x1317f6[_0xf16c('0x18')]),'qs':{'email':_0x5f32f3}})[_0xf16c('0x1e')](function(_0x15480d){if(_0x15480d['length']){logger['info']('Agent\x20found!');return _['find'](_0x15480d,function(_0x2ac311){return _0x2ac311[_0xf16c('0x1f')][_0xf16c('0x20')]===_0x5f32f3;});}else{logger[_0xf16c('0x1a')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xf16c('0x16')]('%s/api/v2/agents/me',_0x1317f6[_0xf16c('0x18')])})['then'](function(_0x42d928){logger[_0xf16c('0x1a')](_0xf16c('0x21'));return _0x42d928;});}});}else{logger[_0xf16c('0x1a')](_0xf16c('0x22'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x1317f6['remoteUri'])})['then'](function(_0x17f9a3){logger['info'](_0xf16c('0x21'));return _0x17f9a3;});}}function getEndUser(_0x1e5437,_0x36a724,_0x180123){logger['info']('Searching\x20enduser\x20with\x20phone',_0x180123);return request({'uri':util[_0xf16c('0x16')]('%s/api/v2/contacts',_0x1e5437[_0xf16c('0x18')]),'qs':{'phone':_0x180123}})[_0xf16c('0x1e')](function(_0x20fe95){if(_0x20fe95[_0xf16c('0x23')]){logger[_0xf16c('0x1a')](_0xf16c('0x24'));return _[_0xf16c('0x25')](_0x20fe95,{'phone':_0x180123});}else{logger[_0xf16c('0x1a')](_0xf16c('0x26'));return request({'uri':util[_0xf16c('0x16')](_0xf16c('0x27'),_0x1e5437[_0xf16c('0x18')]),'method':_0xf16c('0x19'),'body':{'name':_0x36a724,'phone':_0x180123}})[_0xf16c('0x1e')](function(_0x229f84){logger[_0xf16c('0x1a')](_0xf16c('0x28'));return _0x229f84;});}});}function getAuth(_0x55e0d9){return util[_0xf16c('0x16')](_0xf16c('0x29'),new Buffer(_0x55e0d9[_0xf16c('0x2a')]+':X')['toString'](_0xf16c('0x2b')));}function request(_0x1a0586){logger['debug'](_0xf16c('0x2c'),JSON[_0xf16c('0x2d')](_0x1a0586));return rp(_[_0xf16c('0x7')](_0x1a0586,{'method':_0xf16c('0x2e'),'headers':headers,'json':!![]}));}function getTags(_0xadf66,_0x167baa){var _0x51b5db=[];if(_0xadf66&&_0xadf66['length']>0x0){_0x51b5db=_[_0xf16c('0x2f')](_0xadf66,_0x167baa);}return _0x51b5db;}function getCustomFields(_0x5b9101,_0x48b23f){var _0x6a5b40=[];var _0x511f58={'custom_fields':[]};if(_0x5b9101[_0xf16c('0x23')]>0x0){_[_0xf16c('0x30')](_0x5b9101,function(_0x137867){if(_[_0xf16c('0x31')]([_0xf16c('0x32'),_0xf16c('0x33')],_0x137867[_0xf16c('0x34')])&&_0x137867[_0xf16c('0x35')]&&!_0x137867[_0xf16c('0x36')]){_0x511f58[_0x137867[_0xf16c('0x35')][_0xf16c('0x37')]()]=_0x137867[_0xf16c('0x38')][_0xf16c('0x39')]();}else if(_['includes']([_0xf16c('0x32'),'picklist'],_0x137867[_0xf16c('0x34')])&&_0x137867['idField']&&_0x137867['customField']){_0x511f58[_0xf16c('0x14')][_0xf16c('0x3a')]({'id':_0x137867[_0xf16c('0x3b')],'value':_0x137867[_0xf16c('0x38')][_0xf16c('0x39')]()});}else if(_0x137867[_0xf16c('0x34')]===_0xf16c('0x3c')&&_0x137867[_0xf16c('0x3d')]&&_0x137867[_0xf16c('0x3b')]&&_0x137867[_0xf16c('0x36')]){_0x48b23f[_0x137867['variableName']]&&_0x511f58['custom_fields'][_0xf16c('0x3a')]({'id':_0x137867[_0xf16c('0x3b')],'value':_0x48b23f[_0x137867['variableName']][_0xf16c('0x39')]()});}else if(_0x137867[_0xf16c('0x34')]===_0xf16c('0x3e')&&_0x137867[_0xf16c('0x3f')]&&_0x137867[_0xf16c('0x3f')][_0xf16c('0x40')]&&_0x137867[_0xf16c('0x3b')]&&_0x137867[_0xf16c('0x36')]){_0x48b23f[_0x137867['Variable'][_0xf16c('0x40')][_0xf16c('0x37')]()]&&_0x511f58[_0xf16c('0x14')][_0xf16c('0x3a')]({'id':_0x137867[_0xf16c('0x3b')],'value':_0x48b23f[_0x137867[_0xf16c('0x3f')][_0xf16c('0x40')][_0xf16c('0x37')]()]['toString']()});}});}return _0x511f58;}exports[_0xf16c('0x41')]=function(_0x563b28,_0x521aa3,_0x309198,_0x497b24,_0x129afd,_0x10517c){var _0xd161e3,_0x2d522a;_0x10517c[_0xf16c('0x18')]=intUtil[_0xf16c('0x42')](_0x10517c[_0xf16c('0x18')]);_0x10517c[_0xf16c('0x43')]=intUtil[_0xf16c('0x42')](_0x10517c[_0xf16c('0x43')]);if(_0x129afd&&_0x129afd[_0xf16c('0x44')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x521aa3['recordingURL']=util['format'](_0xf16c('0x45'),_0x10517c['serverUrl'],_0x521aa3['uniqueid'],md5(_0x521aa3['uniqueid']));}else{_0x521aa3[_0xf16c('0x46')]='';}headers['Authorization']=getAuth(_0x10517c);return getUser(_0x10517c,_0x497b24[_0xf16c('0x20')])['then'](function(_0x289395){_0xd161e3=_0x289395;logger[_0xf16c('0x1a')](_0xf16c('0x47'),_0xd161e3['id']);return getEndUser(_0x10517c,_0x521aa3['calleridname'],_0x521aa3[_0xf16c('0xd')]);})['then'](function(_0x510727){_0x2d522a=_0x510727;logger['info'](_0xf16c('0x48'),_0x2d522a['id']);return getTicket(_0x10517c,_0xd161e3,_0x2d522a,_0x309198,_0x521aa3);})[_0xf16c('0x1e')](function(_0x13576c){if(_0x13576c&&_0x13576c['id']){logger['info'](_0xf16c('0x1b'));logger[_0xf16c('0x1a')](_0xf16c('0x49'),_0x13576c['id']);logger[_0xf16c('0x1a')](_0xf16c('0x4a'),_0xf16c('0x4b'));emit(util['format']('user:%s',_0x497b24['name']),'trigger:browser:url',{'uri':util[_0xf16c('0x16')]('%s/helpdesk/tickets/%d',_0x10517c[_0xf16c('0x18')],_0x13576c['id'])});}})[_0xf16c('0x4c')](function(_0x566128){logger[_0xf16c('0x4d')](_0xf16c('0x4a'),JSON[_0xf16c('0x2d')](_0x566128));});};exports['outbound']=function(_0x37fb1b,_0x430cf8,_0x13efcb,_0x164e37,_0x3e940c,_0x1b2d6b,_0x3abaee){var _0x2844c6,_0x5f23e4;_0x1b2d6b[_0xf16c('0x18')]=intUtil['stripTrailingSlash'](_0x1b2d6b['remoteUri']);_0x1b2d6b[_0xf16c('0x43')]=intUtil[_0xf16c('0x42')](_0x1b2d6b[_0xf16c('0x43')]);if(_0x3abaee&&_0x3abaee['recordingFormat']&&_0x3abaee[_0xf16c('0x4e')]!==_0xf16c('0x4f')){logger[_0xf16c('0x1a')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x430cf8[_0xf16c('0x46')]=util[_0xf16c('0x16')](_0xf16c('0x45'),_0x1b2d6b[_0xf16c('0x43')],_0x430cf8[_0xf16c('0x50')],md5(_0x430cf8[_0xf16c('0x50')]));}headers[_0xf16c('0x51')]=getAuth(_0x1b2d6b);return getUser(_0x1b2d6b,_0x164e37[_0xf16c('0x20')])['then'](function(_0x122f1b){_0x2844c6=_0x122f1b;logger[_0xf16c('0x1a')](_0xf16c('0x47'),_0x2844c6['id']);return getEndUser(_0x1b2d6b,_0x430cf8['destcalleridname'],_0x430cf8[_0xf16c('0x52')]);})[_0xf16c('0x1e')](function(_0x3be34d){_0x5f23e4=_0x3be34d;logger[_0xf16c('0x1a')](_0xf16c('0x48'),_0x5f23e4['id']);return getTicket(_0x1b2d6b,_0x2844c6,_0x5f23e4,_0x13efcb,_0x430cf8);})[_0xf16c('0x1e')](function(_0x1fe769){if(_0x1fe769&&_0x1fe769['id']){logger['info'](_0xf16c('0x1b'));logger['info'](_0xf16c('0x49'),_0x1fe769['id']);logger['info'](_0xf16c('0x53'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf16c('0x16')](_0xf16c('0x54'),_0x164e37[_0xf16c('0x40')]),'trigger:browser:url',{'uri':util[_0xf16c('0x16')]('%s/helpdesk/tickets/%d',_0x1b2d6b[_0xf16c('0x18')],_0x1fe769['id'])});}})['catch'](function(_0x3b7241){logger[_0xf16c('0x4d')]('[OUTBOUND]',JSON['stringify'](_0x3b7241));});};exports[_0xf16c('0x55')]=function(_0x3a8cf0,_0x5c17e2,_0x4503f5,_0x4e9808,_0xaf4e15,_0x20d82e){var _0x14cdcf,_0x275a82;_0x20d82e[_0xf16c('0x18')]=intUtil[_0xf16c('0x42')](_0x20d82e[_0xf16c('0x18')]);_0x20d82e['serverUrl']=intUtil[_0xf16c('0x42')](_0x20d82e['serverUrl']);if(_0xaf4e15&&_0xaf4e15[_0xf16c('0x44')]){logger[_0xf16c('0x1a')]('['+_0x5c17e2[_0xf16c('0x56')][_0xf16c('0x57')]()+']',_0xf16c('0x58'));_0x5c17e2[_0xf16c('0x46')]=util[_0xf16c('0x16')](_0xf16c('0x45'),_0x20d82e['serverUrl'],_0x5c17e2[_0xf16c('0x50')],md5(_0x5c17e2['uniqueid']));}else{_0x5c17e2['recordingURL']='';}headers['Authorization']=getAuth(_0x20d82e);return getUser(_0x20d82e,'')['then'](function(_0x425549){_0x14cdcf=_0x425549;logger[_0xf16c('0x1a')]('The\x20User\x20ID\x20is:',_0x14cdcf['id']);return getEndUser(_0x20d82e,_0x5c17e2[_0xf16c('0xc')],_0x5c17e2[_0xf16c('0xd')]);})['then'](function(_0x442bda){_0x275a82=_0x442bda;logger[_0xf16c('0x1a')](_0xf16c('0x48'),_0x275a82['id']);return getTicket(_0x20d82e,_0x14cdcf,_0x275a82,_0x4503f5,_0x5c17e2);})[_0xf16c('0x1e')](function(_0x17ba34){if(_0x17ba34){logger[_0xf16c('0x1a')]('Ticket\x20created!');logger['info'](_0xf16c('0x49'),_0x17ba34['id']);}})[_0xf16c('0x4c')](function(_0x37a38c){logger[_0xf16c('0x4d')]('['+_0x5c17e2[_0xf16c('0x56')][_0xf16c('0x57')]()+']',JSON['stringify'](_0x37a38c));});}; \ 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 9acf005..0f37e5b 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 _0x9ae8=['Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','lodash','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','message','/api/lookup?q=','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','ticketId','task','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','destcalleridnum','calleridnum','callDirection','queue','unmanaged','outbound','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]'];(function(_0x5a9a42,_0x5ee951){var _0x247f61=function(_0x3744d5){while(--_0x3744d5){_0x5a9a42['push'](_0x5a9a42['shift']());}};_0x247f61(++_0x5ee951);}(_0x9ae8,0x1b6));var _0x89ae=function(_0x3a293e,_0x5c56f5){_0x3a293e=_0x3a293e-0x0;var _0x18a51a=_0x9ae8[_0x3a293e];return _0x18a51a;};'use strict';var _=require(_0x89ae('0x0'));var rp=require('request-promise');var md5=require(_0x89ae('0x1'));var util=require(_0x89ae('0x2'));var moment=require(_0x89ae('0x3'));var Promise=require('bluebird');var Redis=require(_0x89ae('0x4'));var intUtil=require(_0x89ae('0x5'));var config=require(_0x89ae('0x6'));var logger=require(_0x89ae('0x7'))(_0x89ae('0x8'));config[_0x89ae('0x9')]=_['defaults'](config[_0x89ae('0x9')],{'host':_0x89ae('0xa'),'port':0x18eb});var io=require(_0x89ae('0xb'))(new Redis(config[_0x89ae('0x9')]));function getAdminId(_0x1d7eed,_0x14c085,_0x4f6645,_0x5a00ac){return new Promise(function(_0x2af70f,_0x3512c0){var _0x32466b=![];var _0x460766={'method':_0x89ae('0xc'),'uri':_0x5a00ac+'/api/selector/owners','json':!![]};_0x460766[_0x89ae('0xd')]=_0x4f6645;logger[_0x89ae('0xe')](_0x89ae('0xf'));return rp(_0x460766)[_0x89ae('0x10')](function(_0x5808cf){if(_0x5808cf){var _0x4b0edb=_0x5808cf[_0x89ae('0x11')];var _0x2cb57f=null;for(_0x2cb57f=0x0;_0x2cb57f<_0x4b0edb[_0x89ae('0x12')];_0x2cb57f++){if(_0x4b0edb[_0x2cb57f][_0x89ae('0x13')]===_0x1d7eed[_0x89ae('0x14')]){_0x1d7eed[_0x89ae('0x15')]=_0x4b0edb[_0x2cb57f]['id'];_0x32466b=!![];}}if(_0x32466b){logger['info'](_0x89ae('0x16'),_0x1d7eed['adminId']);_0x2af70f(_0x1d7eed);}else{_0x3512c0({'statusCode':0x194,'message':_0x89ae('0x17')});}}else{_0x3512c0({'statusCode':0x194,'message':_0x89ae('0x17')});}})[_0x89ae('0x18')](function(_0x3fd86f){logger[_0x89ae('0x19')]('['+[_0x14c085[_0x89ae('0x1a')]()]+']',_0x3fd86f['message']);_0x3512c0(_0x3fd86f);});});}function getUser(_0x321979,_0x5b8fda,_0x375582){return function(_0x4770a1){return new Promise(function(_0xc328ca,_0x2c8b1b){var _0x4e15af={'method':_0x89ae('0xc'),'uri':_0x375582+_0x89ae('0x1b'),'json':!![]};_0x4e15af[_0x89ae('0xd')]=_0x5b8fda;logger[_0x89ae('0xe')](_0x89ae('0x1c'));return rp(_0x4e15af)['then'](function(_0x30585e){if(_0x30585e){var _0x6919d8=_0x30585e[_0x89ae('0x11')];var _0x42c3f3=![];var _0x19cd7b=null;if(_0x4770a1[_0x89ae('0x1d')]!==null){logger[_0x89ae('0xe')](_0x89ae('0x1e'),_0x4770a1[_0x89ae('0x1d')]);_0x4770a1[_0x89ae('0x1f')]=_0x4770a1[_0x89ae('0x1d')];for(_0x19cd7b=0x0;_0x19cd7b<_0x6919d8[_0x89ae('0x12')];_0x19cd7b++){if(_0x6919d8[_0x19cd7b][_0x89ae('0x13')]===_0x4770a1[_0x89ae('0x1d')]){_0x42c3f3=!![];_0x4770a1[_0x89ae('0x20')]=_0x6919d8[_0x19cd7b]['id'];logger[_0x89ae('0xe')](_0x89ae('0x21'),_0x4770a1[_0x89ae('0x20')]);}}}if(!_0x42c3f3){logger[_0x89ae('0xe')](_0x89ae('0x22'));_0x4770a1[_0x89ae('0x1f')]=_0x4770a1[_0x89ae('0x14')];_0x4770a1[_0x89ae('0x20')]=_0x4770a1[_0x89ae('0x15')];_0x42c3f3=!![];}if(_0x42c3f3){_0xc328ca(_0x4770a1);}else{_0x2c8b1b({'statusCode':0x194,'message':_0x89ae('0x17')});}}else{_0x2c8b1b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x89ae('0x18')](function(_0x78b00){logger[_0x89ae('0x19')]('['+[_0x321979[_0x89ae('0x1a')]()]+']',_0x78b00[_0x89ae('0x23')]);_0x2c8b1b(_0x78b00);});});};}function searchContact(_0x2d5155,_0x50cc27,_0x3fe33d,_0x2fc4a3){return new Promise(function(_0x5537ed,_0x34a76a){var _0x5c93d1={'method':_0x89ae('0xc'),'headers':_0x50cc27,'uri':_0x2d5155+_0x89ae('0x24')+_0x2fc4a3+'&f='+_0x3fe33d+'&entities=contact','json':!![]};rp(_0x5c93d1)['then'](function(_0x3b5f52){var _0x2d1322=_[_0x89ae('0x25')](_0x3b5f52[_0x89ae('0x26')][_0x89ae('0x26')],[_0x3fe33d,_0x2fc4a3]);_0x5537ed(_0x2d1322);})[_0x89ae('0x18')](function(_0x577d1a){_0x34a76a(_0x577d1a);});});}function getEndUser(_0x27aabe,_0x2e5c91,_0x3db1fa){return function(_0x484385){return new Promise(function(_0x651e7,_0x401309){logger['info'](util['format'](_0x89ae('0x27'),_0x484385[_0x89ae('0x28')]));searchContact(_0x3db1fa,_0x2e5c91,_0x89ae('0x29'),_0x484385['contactNumber'])[_0x89ae('0x10')](function(_0x5f5da5){if(_0x5f5da5){_0x484385[_0x89ae('0x2a')]=_0x5f5da5['id'];logger[_0x89ae('0xe')](_0x89ae('0x2b'),_0x484385['endUserId']);return _0x651e7(_0x484385);}searchContact(_0x3db1fa,_0x2e5c91,'work_number',_0x484385['contactNumber'])['then'](function(_0x45edc8){if(_0x45edc8){_0x484385[_0x89ae('0x2a')]=_0x45edc8['id'];logger['info'](_0x89ae('0x2c'),_0x484385[_0x89ae('0x2a')]);return _0x651e7(_0x484385);}createEndUser(_0x484385,_0x27aabe,_0x2e5c91,_0x3db1fa)[_0x89ae('0x10')](function(_0x4304dd){logger[_0x89ae('0xe')](_0x89ae('0x2d'),_0x4304dd[_0x89ae('0x2a')]);return _0x651e7(_0x4304dd);});});})[_0x89ae('0x18')](function(_0x59cef2){_0x401309(_0x59cef2);});});};}function createEndUser(_0xeccd50,_0x5178df,_0x1aedab,_0x1d1c21){return new Promise(function(_0x2da14c,_0x1c26a2){var _0x1c3ba9=moment();var _0x50c506={'method':_0x89ae('0x2e'),'uri':_0x1d1c21+_0x89ae('0x2f'),'body':{'contact':{'last_name':_0xeccd50[_0x89ae('0x28')],'work_number':_0xeccd50[_0x89ae('0x28')],'mobile_number':_0xeccd50['contactNumber'],'owner_id':_0xeccd50[_0x89ae('0x20')],'created_at':_0x1c3ba9[_0x89ae('0x30')](_0x89ae('0x31'))}},'json':!![]};_0x50c506[_0x89ae('0xd')]=_0x1aedab;logger[_0x89ae('0xe')](_0x89ae('0x32'));return rp(_0x50c506)[_0x89ae('0x10')](function(_0x2508ee){_0xeccd50[_0x89ae('0x2a')]=_0x2508ee[_0x89ae('0x33')]['id'];_0x2da14c(_0xeccd50);})[_0x89ae('0x18')](function(_0x531e85){logger[_0x89ae('0x19')]('['+[_0x5178df['toUpperCase']()]+']',_0x531e85[_0x89ae('0x23')]);_0x1c26a2(_0x531e85[_0x89ae('0x23')]);});});}function getTicket(_0x5ae42f,_0x46cfe9,_0x2a8774,_0x33602b,_0xe7fb4d){return function(_0x200dea){logger[_0x89ae('0xe')](_0x89ae('0x34'));return new Promise(function(_0x594449,_0x4a5219){var _0x58b4e0=moment();var _0x2fc8d4={'method':_0x89ae('0x2e'),'uri':_0x2a8774+'/api/tasks','body':{'title':intUtil[_0x89ae('0x35')](_0x33602b[_0x89ae('0x36')],_0xe7fb4d,'\x20'),'description':intUtil['getString'](_0x33602b['Descriptions'],_0xe7fb4d,'\x0a'),'owner_id':_0x200dea[_0x89ae('0x20')],'creater_id':_0x200dea[_0x89ae('0x15')],'targetable_id':_0x200dea[_0x89ae('0x2a')],'targetable_type':_0x89ae('0x37'),'created_at':_0x58b4e0['format']('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x58b4e0[_0x89ae('0x38')](0x1e,'m')[_0x89ae('0x30')](_0x89ae('0x31'))},'json':!![]};_0x2fc8d4[_0x89ae('0xd')]=_0x46cfe9;return rp(_0x2fc8d4)[_0x89ae('0x10')](function(_0x33d2d2){_0x200dea[_0x89ae('0x39')]=_0x33d2d2[_0x89ae('0x3a')]['id'];logger['info']('Task\x20created:',_0x200dea[_0x89ae('0x39')]);_0x594449(_0x200dea);})[_0x89ae('0x18')](function(_0x3d7063){logger[_0x89ae('0x19')]('['+[_0x5ae42f['toUpperCase']()]+']',_0x3d7063[_0x89ae('0x23')]);_0x4a5219(_0x3d7063[_0x89ae('0x23')]);});});};}function emit(_0x632411,_0x4f9338,_0x413f85){var _0x4d93df={'uri':_0x632411+_0x89ae('0x3b')+_0x413f85};io['to'](util[_0x89ae('0x30')](_0x89ae('0x3c'),_0x4f9338))[_0x89ae('0x3d')](_0x89ae('0x3e'),_0x4d93df);}exports['cs']=function(_0x5af158,_0x3a2d1f,_0x588c8b,_0x19cddd,_0x4e15fb,_0x184580,_0x4d8651,_0x35d060){var _0x22db58={};var _0xa8987c={'Authorization':_0x89ae('0x3f')+_0x184580['apiKey']};_0x184580[_0x89ae('0x40')]=intUtil[_0x89ae('0x41')](_0x184580[_0x89ae('0x40')]);_0x184580[_0x89ae('0x42')]=intUtil[_0x89ae('0x41')](_0x184580[_0x89ae('0x42')]);var _0x1e67f1=_0x184580[_0x89ae('0x40')];_0x22db58[_0x89ae('0x14')]=_0x184580[_0x89ae('0x43')];_0x22db58[_0x89ae('0x28')]=_0x35d060['toLowerCase']()==='outbound'?_0x3a2d1f[_0x89ae('0x44')]:_0x3a2d1f[_0x89ae('0x45')];_0x22db58[_0x89ae('0x46')]=_0x35d060===_0x89ae('0x47')||_0x35d060===_0x89ae('0x48')?_0x89ae('0x47'):_0x89ae('0x49');if(_0x19cddd){_0x22db58[_0x89ae('0x1d')]=_0x19cddd[_0x89ae('0x13')];}var _0x69187=util['format'](_0x89ae('0x4a'),_0x184580['serverUrl'],_0x3a2d1f[_0x89ae('0x4b')],md5(_0x3a2d1f[_0x89ae('0x4b')]));if(_0x4e15fb&&_0x4e15fb[_0x89ae('0x4c')]){logger['info'](_0x89ae('0x4d'),_0x89ae('0x4e'));_0x3a2d1f[_0x89ae('0x4f')]=_0x69187;}else if(_0x4d8651&&_0x4d8651[_0x89ae('0x50')]&&_0x4d8651[_0x89ae('0x50')]!=='none'){logger[_0x89ae('0xe')](_0x89ae('0x51'),_0x89ae('0x4e'));_0x3a2d1f['recordingURL']=_0x69187;}else{_0x3a2d1f[_0x89ae('0x4f')]='';}return getAdminId(_0x22db58,_0x35d060,_0xa8987c,_0x1e67f1)[_0x89ae('0x10')](getUser(_0x35d060,_0xa8987c,_0x1e67f1))[_0x89ae('0x10')](getEndUser(_0x35d060,_0xa8987c,_0x1e67f1))[_0x89ae('0x10')](getTicket(_0x35d060,_0xa8987c,_0x1e67f1,_0x588c8b,_0x3a2d1f))[_0x89ae('0x10')](function(_0x227c7f){logger['info'](util[_0x89ae('0x30')](_0x89ae('0x52'),_0x227c7f[_0x89ae('0x39')]));if(_0x35d060!==_0x89ae('0x48')){logger[_0x89ae('0xe')]('['+[_0x35d060[_0x89ae('0x1a')]()]+']',_0x89ae('0x53'));emit(_0x1e67f1,_0x19cddd[_0x89ae('0x54')],_0x227c7f[_0x89ae('0x2a')]);}})[_0x89ae('0x18')](function(_0x179d9c){logger['error']('['+[_0x35d060[_0x89ae('0x1a')]()]+_0x89ae('0x55'),util['inspect'](_0x179d9c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1c8d=['The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','info','Getting\x20admin\x20information','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','headers','Getting\x20user\x20list','then','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','/api/lookup?q=','&f=','find','contacts','catch','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','getString','Subjects','Contact','add','task','Task\x20created:','ticketId','user:%s','emit','Token\x20token=','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','outbound','destcalleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x1c8d,0x1b7));var _0xd1c8=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1c8d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd1c8('0x0'));var rp=require(_0xd1c8('0x1'));var md5=require(_0xd1c8('0x2'));var util=require(_0xd1c8('0x3'));var moment=require(_0xd1c8('0x4'));var Promise=require('bluebird');var Redis=require(_0xd1c8('0x5'));var intUtil=require(_0xd1c8('0x6'));var config=require(_0xd1c8('0x7'));var logger=require(_0xd1c8('0x8'))('freshsales');config[_0xd1c8('0x9')]=_[_0xd1c8('0xa')](config[_0xd1c8('0x9')],{'host':_0xd1c8('0xb'),'port':0x18eb});var io=require(_0xd1c8('0xc'))(new Redis(config[_0xd1c8('0x9')]));function getAdminId(_0x28fef1,_0x2581ac,_0x22749f,_0x76be2d){return new Promise(function(_0x495fd7,_0xacb4c2){var _0x512436=![];var _0x33e4d9={'method':_0xd1c8('0xd'),'uri':_0x76be2d+_0xd1c8('0xe'),'json':!![]};_0x33e4d9['headers']=_0x22749f;logger[_0xd1c8('0xf')](_0xd1c8('0x10'));return rp(_0x33e4d9)['then'](function(_0x146f15){if(_0x146f15){var _0x5e0d6a=_0x146f15[_0xd1c8('0x11')];var _0x25c61b=null;for(_0x25c61b=0x0;_0x25c61b<_0x5e0d6a['length'];_0x25c61b++){if(_0x5e0d6a[_0x25c61b][_0xd1c8('0x12')]===_0x28fef1[_0xd1c8('0x13')]){_0x28fef1[_0xd1c8('0x14')]=_0x5e0d6a[_0x25c61b]['id'];_0x512436=!![];}}if(_0x512436){logger[_0xd1c8('0xf')](_0xd1c8('0x15'),_0x28fef1['adminId']);_0x495fd7(_0x28fef1);}else{_0xacb4c2({'statusCode':0x194,'message':_0xd1c8('0x16')});}}else{_0xacb4c2({'statusCode':0x194,'message':_0xd1c8('0x16')});}})['catch'](function(_0x2f0b01){logger[_0xd1c8('0x17')]('['+[_0x2581ac[_0xd1c8('0x18')]()]+']',_0x2f0b01[_0xd1c8('0x19')]);_0xacb4c2(_0x2f0b01);});});}function getUser(_0x4eab48,_0x44ae37,_0x3d3377){return function(_0x3eab09){return new Promise(function(_0x1a48a1,_0x2bdc34){var _0xa966df={'method':_0xd1c8('0xd'),'uri':_0x3d3377+_0xd1c8('0xe'),'json':!![]};_0xa966df[_0xd1c8('0x1a')]=_0x44ae37;logger[_0xd1c8('0xf')](_0xd1c8('0x1b'));return rp(_0xa966df)[_0xd1c8('0x1c')](function(_0xe13ebe){if(_0xe13ebe){var _0x379c77=_0xe13ebe[_0xd1c8('0x11')];var _0x26f6f5=![];var _0x2fae83=null;if(_0x3eab09[_0xd1c8('0x1d')]!==null){logger['info'](_0xd1c8('0x1e'),_0x3eab09['agentEmail']);_0x3eab09['userEmail']=_0x3eab09['agentEmail'];for(_0x2fae83=0x0;_0x2fae83<_0x379c77[_0xd1c8('0x1f')];_0x2fae83++){if(_0x379c77[_0x2fae83][_0xd1c8('0x12')]===_0x3eab09['agentEmail']){_0x26f6f5=!![];_0x3eab09[_0xd1c8('0x20')]=_0x379c77[_0x2fae83]['id'];logger[_0xd1c8('0xf')](_0xd1c8('0x21'),_0x3eab09[_0xd1c8('0x20')]);}}}if(!_0x26f6f5){logger[_0xd1c8('0xf')](_0xd1c8('0x22'));_0x3eab09[_0xd1c8('0x23')]=_0x3eab09[_0xd1c8('0x13')];_0x3eab09['userId']=_0x3eab09[_0xd1c8('0x14')];_0x26f6f5=!![];}if(_0x26f6f5){_0x1a48a1(_0x3eab09);}else{_0x2bdc34({'statusCode':0x194,'message':_0xd1c8('0x16')});}}else{_0x2bdc34({'statusCode':0x194,'message':_0xd1c8('0x16')});}})['catch'](function(_0x3b43b1){logger['error']('['+[_0x4eab48[_0xd1c8('0x18')]()]+']',_0x3b43b1[_0xd1c8('0x19')]);_0x2bdc34(_0x3b43b1);});});};}function searchContact(_0x20498c,_0x11c9a8,_0x5e1db0,_0x440be2){return new Promise(function(_0x410a79,_0x18a713){var _0x229503={'method':_0xd1c8('0xd'),'headers':_0x11c9a8,'uri':_0x20498c+_0xd1c8('0x24')+_0x440be2+_0xd1c8('0x25')+_0x5e1db0+'&entities=contact','json':!![]};rp(_0x229503)['then'](function(_0x2c5981){var _0x3d29c9=_[_0xd1c8('0x26')](_0x2c5981[_0xd1c8('0x27')][_0xd1c8('0x27')],[_0x5e1db0,_0x440be2]);_0x410a79(_0x3d29c9);})[_0xd1c8('0x28')](function(_0x14c989){_0x18a713(_0x14c989);});});}function getEndUser(_0x33e759,_0x1faaac,_0x55921f){return function(_0x210473){return new Promise(function(_0x2bcfda,_0x37c96a){logger[_0xd1c8('0xf')](util[_0xd1c8('0x29')](_0xd1c8('0x2a'),_0x210473[_0xd1c8('0x2b')]));searchContact(_0x55921f,_0x1faaac,_0xd1c8('0x2c'),_0x210473[_0xd1c8('0x2b')])[_0xd1c8('0x1c')](function(_0x1ead47){if(_0x1ead47){_0x210473[_0xd1c8('0x2d')]=_0x1ead47['id'];logger['info'](_0xd1c8('0x2e'),_0x210473[_0xd1c8('0x2d')]);return _0x2bcfda(_0x210473);}searchContact(_0x55921f,_0x1faaac,_0xd1c8('0x2f'),_0x210473[_0xd1c8('0x2b')])[_0xd1c8('0x1c')](function(_0x1e630c){if(_0x1e630c){_0x210473['endUserId']=_0x1e630c['id'];logger['info'](_0xd1c8('0x30'),_0x210473['endUserId']);return _0x2bcfda(_0x210473);}createEndUser(_0x210473,_0x33e759,_0x1faaac,_0x55921f)[_0xd1c8('0x1c')](function(_0x4c65ae){logger[_0xd1c8('0xf')](_0xd1c8('0x31'),_0x4c65ae[_0xd1c8('0x2d')]);return _0x2bcfda(_0x4c65ae);});});})[_0xd1c8('0x28')](function(_0x2c6097){_0x37c96a(_0x2c6097);});});};}function createEndUser(_0x32bab8,_0x16a55f,_0x96ef27,_0x507f38){return new Promise(function(_0x18a1c9,_0x7702f){var _0x40e0ae=moment();var _0x127135={'method':_0xd1c8('0x32'),'uri':_0x507f38+_0xd1c8('0x33'),'body':{'contact':{'last_name':_0x32bab8[_0xd1c8('0x2b')],'work_number':_0x32bab8['contactNumber'],'mobile_number':_0x32bab8[_0xd1c8('0x2b')],'owner_id':_0x32bab8['userId'],'created_at':_0x40e0ae[_0xd1c8('0x29')](_0xd1c8('0x34'))}},'json':!![]};_0x127135['headers']=_0x96ef27;logger[_0xd1c8('0xf')](_0xd1c8('0x35'));return rp(_0x127135)['then'](function(_0x5e9904){_0x32bab8[_0xd1c8('0x2d')]=_0x5e9904[_0xd1c8('0x36')]['id'];_0x18a1c9(_0x32bab8);})[_0xd1c8('0x28')](function(_0x48b9d9){logger[_0xd1c8('0x17')]('['+[_0x16a55f[_0xd1c8('0x18')]()]+']',_0x48b9d9['message']);_0x7702f(_0x48b9d9[_0xd1c8('0x19')]);});});}function getTicket(_0x8fc13c,_0x1a011e,_0x198b4d,_0x1ae1c5,_0x2b717e){return function(_0xca1b12){logger['info'](_0xd1c8('0x37'));return new Promise(function(_0x172254,_0x5de491){var _0x28add9=moment();var _0x3f2e92={'method':_0xd1c8('0x32'),'uri':_0x198b4d+'/api/tasks','body':{'title':intUtil[_0xd1c8('0x38')](_0x1ae1c5[_0xd1c8('0x39')],_0x2b717e,'\x20'),'description':intUtil['getString'](_0x1ae1c5['Descriptions'],_0x2b717e,'\x0a'),'owner_id':_0xca1b12[_0xd1c8('0x20')],'creater_id':_0xca1b12[_0xd1c8('0x14')],'targetable_id':_0xca1b12[_0xd1c8('0x2d')],'targetable_type':_0xd1c8('0x3a'),'created_at':_0x28add9[_0xd1c8('0x29')](_0xd1c8('0x34')),'due_date':_0x28add9[_0xd1c8('0x3b')](0x1e,'m')['format'](_0xd1c8('0x34'))},'json':!![]};_0x3f2e92[_0xd1c8('0x1a')]=_0x1a011e;return rp(_0x3f2e92)[_0xd1c8('0x1c')](function(_0x58b43e){_0xca1b12['ticketId']=_0x58b43e[_0xd1c8('0x3c')]['id'];logger[_0xd1c8('0xf')](_0xd1c8('0x3d'),_0xca1b12[_0xd1c8('0x3e')]);_0x172254(_0xca1b12);})[_0xd1c8('0x28')](function(_0x5044c9){logger[_0xd1c8('0x17')]('['+[_0x8fc13c[_0xd1c8('0x18')]()]+']',_0x5044c9[_0xd1c8('0x19')]);_0x5de491(_0x5044c9['message']);});});};}function emit(_0x5c4501,_0x24ea15,_0x131fad){var _0xfe44da={'uri':_0x5c4501+'/contacts/'+_0x131fad};io['to'](util[_0xd1c8('0x29')](_0xd1c8('0x3f'),_0x24ea15))[_0xd1c8('0x40')]('trigger:browser:url',_0xfe44da);}exports['cs']=function(_0x2c3007,_0x26e1f7,_0x3f584a,_0x4fe9f8,_0x55276b,_0x5845a2,_0x559a3d,_0x426e71){var _0x3b7e74={};var _0x4cc89b={'Authorization':_0xd1c8('0x41')+_0x5845a2['apiKey']};_0x5845a2['remoteUri']=intUtil['stripTrailingSlash'](_0x5845a2[_0xd1c8('0x42')]);_0x5845a2[_0xd1c8('0x43')]=intUtil[_0xd1c8('0x44')](_0x5845a2['serverUrl']);var _0x42da13=_0x5845a2[_0xd1c8('0x42')];_0x3b7e74['adminEmail']=_0x5845a2['username'];_0x3b7e74[_0xd1c8('0x2b')]=_0x426e71[_0xd1c8('0x45')]()===_0xd1c8('0x46')?_0x26e1f7[_0xd1c8('0x47')]:_0x26e1f7['calleridnum'];_0x3b7e74[_0xd1c8('0x48')]=_0x426e71==='queue'||_0x426e71===_0xd1c8('0x49')?_0xd1c8('0x4a'):'outbound';if(_0x4fe9f8){_0x3b7e74[_0xd1c8('0x1d')]=_0x4fe9f8[_0xd1c8('0x12')];}var _0x4fbd83=util[_0xd1c8('0x29')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5845a2[_0xd1c8('0x43')],_0x26e1f7[_0xd1c8('0x4b')],md5(_0x26e1f7[_0xd1c8('0x4b')]));if(_0x55276b&&_0x55276b[_0xd1c8('0x4c')]){logger[_0xd1c8('0xf')](_0xd1c8('0x4d'),_0xd1c8('0x4e'));_0x26e1f7[_0xd1c8('0x4f')]=_0x4fbd83;}else if(_0x559a3d&&_0x559a3d['recordingFormat']&&_0x559a3d[_0xd1c8('0x50')]!==_0xd1c8('0x51')){logger[_0xd1c8('0xf')](_0xd1c8('0x52'),'Recording\x20is\x20enabled!');_0x26e1f7['recordingURL']=_0x4fbd83;}else{_0x26e1f7[_0xd1c8('0x4f')]='';}return getAdminId(_0x3b7e74,_0x426e71,_0x4cc89b,_0x42da13)['then'](getUser(_0x426e71,_0x4cc89b,_0x42da13))[_0xd1c8('0x1c')](getEndUser(_0x426e71,_0x4cc89b,_0x42da13))[_0xd1c8('0x1c')](getTicket(_0x426e71,_0x4cc89b,_0x42da13,_0x3f584a,_0x26e1f7))[_0xd1c8('0x1c')](function(_0x1f30fe){logger[_0xd1c8('0xf')](util[_0xd1c8('0x29')](_0xd1c8('0x53'),_0x1f30fe[_0xd1c8('0x3e')]));if(_0x426e71!==_0xd1c8('0x49')){logger['info']('['+[_0x426e71[_0xd1c8('0x18')]()]+']',_0xd1c8('0x54'));emit(_0x42da13,_0x4fe9f8['name'],_0x1f30fe[_0xd1c8('0x2d')]);}})[_0xd1c8('0x28')](function(_0x231b25){logger[_0xd1c8('0x17')]('['+[_0x426e71['toUpperCase']()]+_0xd1c8('0x55'),util[_0xd1c8('0x56')](_0x231b25,{'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 fb8064b..fea422c 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 _0xfce5=['servicenow','data1','toLowerCase','data2','find','Configurations','data3','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','log','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','freshsales'];(function(_0x1347f8,_0x233feb){var _0x218368=function(_0x3f4ca3){while(--_0x3f4ca3){_0x1347f8['push'](_0x1347f8['shift']());}};_0x218368(++_0x233feb);}(_0xfce5,0xff));var _0x5fce=function(_0x589274,_0xa3f1bd){_0x589274=_0x589274-0x0;var _0x21814b=_0xfce5[_0x589274];return _0x21814b;};'use strict';var _=require(_0x5fce('0x0'));var util=require(_0x5fce('0x1'));var zendesk=require(_0x5fce('0x2'));var salesforce=require(_0x5fce('0x3'));var sugarcrm=require(_0x5fce('0x4'));var freshdesk=require(_0x5fce('0x5'));var zoho=require(_0x5fce('0x6'));var desk=require(_0x5fce('0x7'));var vtiger=require(_0x5fce('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x5fce('0x9'));var freshsales=require(_0x5fce('0xa'));var integrations=['zendesk',_0x5fce('0xb'),_0x5fce('0xc'),_0x5fce('0xd'),_0x5fce('0xe'),_0x5fce('0xf'),_0x5fce('0x10'),'dynamics365',_0x5fce('0x11'),_0x5fce('0x12')];exports['exec']=function(_0x341b53,_0x437548,_0xc100f9,_0x310633,_0x999d68,_0x256860){if(_0xc100f9){if(_['includes'](integrations,_0x341b53[_0x5fce('0x13')]['toLowerCase']())){try{var _0x129199=null;var _0x4181d8='';var _0xf2d767=_0xc100f9[_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')]()];if(_0xf2d767){var _0x21adfd=_0xf2d767[_0x341b53[_0x5fce('0x15')]];if(_0x21adfd){var _0x38d940=_[_0x5fce('0x16')](_0x21adfd[_0x5fce('0x17')],{'id':parseInt(_0x341b53[_0x5fce('0x18')],0xa)});if(_0x38d940){if(_0x310633){if(_0x999d68&&_0x437548[_0x5fce('0x19')]){_0x4181d8=_0x5fce('0x19');}else if(_0x437548[_0x5fce('0x1a')]){_0x4181d8=_0x5fce('0x1b');}else{console['log'](_0x5fce('0x1c'),_0x437548);}}else{_0x4181d8=_0x5fce('0x1d');}switch(_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')]()){case _0x5fce('0x1e'):zendesk[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xb'):salesforce[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xc'):sugarcrm[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case'freshdesk':freshdesk[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xe'):zoho[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0xf'):desk[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case _0x5fce('0x10'):vtiger[_0x4181d8](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860);break;case'freshsales':freshsales['cs'](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860,_0x4181d8);break;case _0x5fce('0x12'):servicenow['cs'](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860,_0x4181d8);break;case'dynamics365':dynamics365['cs'](_0x341b53,_0x437548,_0x38d940,_0x310633,_0x999d68,_0x21adfd,_0x256860,_0x4181d8);break;default:console[_0x5fce('0x1f')](_0x5fce('0x20'));}}else{_0x129199=require(_0x5fce('0x21'))(_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')]());_0x129199['error'](_0x5fce('0x22'),util[_0x5fce('0x23')](_0x5fce('0x24'),_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')](),_0x341b53[_0x5fce('0x18')]));}}else{_0x129199=require(_0x5fce('0x21'))(_0x341b53[_0x5fce('0x13')]['toLowerCase']());_0x129199[_0x5fce('0x25')](_0x5fce('0x22'),util[_0x5fce('0x23')](_0x5fce('0x26'),_0x341b53[_0x5fce('0x13')][_0x5fce('0x14')](),_0x341b53[_0x5fce('0x15')]));}}else{}}catch(_0x2fac85){console[_0x5fce('0x25')](_0x2fac85);}}}}; \ No newline at end of file +var _0x2cbe=['Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unknown\x20integration','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','../../../../config/logger','error','%s\x20account\x20#%s\x20not\x20found','lodash','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','includes','data1','toLowerCase','data2'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2cbe,0x11f));var _0xe2cb=function(_0x205e83,_0x2df5a4){_0x205e83=_0x205e83-0x0;var _0x10bb19=_0x2cbe[_0x205e83];return _0x10bb19;};'use strict';var _=require(_0xe2cb('0x0'));var util=require('util');var zendesk=require(_0xe2cb('0x1'));var salesforce=require(_0xe2cb('0x2'));var sugarcrm=require(_0xe2cb('0x3'));var freshdesk=require(_0xe2cb('0x4'));var zoho=require(_0xe2cb('0x5'));var desk=require(_0xe2cb('0x6'));var vtiger=require(_0xe2cb('0x7'));var servicenow=require(_0xe2cb('0x8'));var dynamics365=require(_0xe2cb('0x9'));var freshsales=require(_0xe2cb('0xa'));var integrations=[_0xe2cb('0xb'),_0xe2cb('0xc'),_0xe2cb('0xd'),_0xe2cb('0xe'),_0xe2cb('0xf'),_0xe2cb('0x10'),_0xe2cb('0x11'),_0xe2cb('0x12'),_0xe2cb('0x13'),_0xe2cb('0x14')];exports['exec']=function(_0x4b043c,_0x41d360,_0x5cd010,_0x200d6b,_0x23a7df,_0x2b6688){if(_0x5cd010){if(_[_0xe2cb('0x15')](integrations,_0x4b043c[_0xe2cb('0x16')]['toLowerCase']())){try{var _0x4cc921=null;var _0x5cba1b='';var _0x38a4cd=_0x5cd010[_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')]()];if(_0x38a4cd){var _0x189e60=_0x38a4cd[_0x4b043c[_0xe2cb('0x18')]];if(_0x189e60){var _0x25eb8c=_['find'](_0x189e60[_0xe2cb('0x19')],{'id':parseInt(_0x4b043c[_0xe2cb('0x1a')],0xa)});if(_0x25eb8c){if(_0x200d6b){if(_0x23a7df&&_0x41d360[_0xe2cb('0x1b')]){_0x5cba1b='queue';}else if(_0x41d360[_0xe2cb('0x1c')]){_0x5cba1b=_0xe2cb('0x1d');}else{console[_0xe2cb('0x1e')](_0xe2cb('0x1f'),_0x41d360);}}else{_0x5cba1b='unmanaged';}switch(_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')]()){case'zendesk':zendesk[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0xc'):salesforce[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0xd'):sugarcrm[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case'freshdesk':freshdesk[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0xf'):zoho[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0x10'):desk[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0x11'):vtiger[_0x5cba1b](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688);break;case _0xe2cb('0x13'):freshsales['cs'](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688,_0x5cba1b);break;case _0xe2cb('0x14'):servicenow['cs'](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688,_0x5cba1b);break;case _0xe2cb('0x12'):dynamics365['cs'](_0x4b043c,_0x41d360,_0x25eb8c,_0x200d6b,_0x23a7df,_0x189e60,_0x2b6688,_0x5cba1b);break;default:console[_0xe2cb('0x1e')](_0xe2cb('0x20'));}}else{_0x4cc921=require('../../../../config/logger')(_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')]());_0x4cc921['error'](_0xe2cb('0x21'),util[_0xe2cb('0x22')](_0xe2cb('0x23'),_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')](),_0x4b043c['data3']));}}else{_0x4cc921=require(_0xe2cb('0x24'))(_0x4b043c['data1'][_0xe2cb('0x17')]());_0x4cc921[_0xe2cb('0x25')](_0xe2cb('0x21'),util[_0xe2cb('0x22')](_0xe2cb('0x26'),_0x4b043c[_0xe2cb('0x16')][_0xe2cb('0x17')](),_0x4b043c[_0xe2cb('0x18')]));}}else{}}catch(_0x394835){console[_0xe2cb('0x25')](_0x394835);}}}}; \ 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 7aa577a..805129c 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 _0x007a=['account_contact_lead','additionalSearchAccount','Account','Lead','Contact','Name','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','No\x20Company','upperFirst','picklist','idField','toString','variable','variableName','customVariable','Variable','name','concat','securityToken','remoteUri','https://login.salesforce.com','clientId','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','recordingURL','email','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','none','uniqueid','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','moment','md5','ioredis','./util','../../../../config/environment','salesforce','redis','localhost','socket.io-emitter','Subjects','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','Case','ContactId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','validateEmail','User','find','then','length','Email','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','execute','additionalSearchLead','$or'];(function(_0x46efd7,_0x43f84d){var _0x5637e4=function(_0x54e078){while(--_0x54e078){_0x46efd7['push'](_0x46efd7['shift']());}};_0x5637e4(++_0x43f84d);}(_0x007a,0xc2));var _0xa007=function(_0x22708b,_0x2bee57){_0x22708b=_0x22708b-0x0;var _0x3e0055=_0x007a[_0x22708b];return _0x3e0055;};'use strict';var _=require(_0xa007('0x0'));var rp=require('request-promise');var moment=require(_0xa007('0x1'));var BPromise=require('bluebird');var md5=require(_0xa007('0x2'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xa007('0x3'));var intUtil=require(_0xa007('0x4'));var config=require(_0xa007('0x5'));var logger=require('../../../../config/logger')(_0xa007('0x6'));config[_0xa007('0x7')]=_['defaults'](config['redis'],{'host':_0xa007('0x8'),'port':0x18eb});var io=require(_0xa007('0x9'))(new Redis(config[_0xa007('0x7')]));function emit(_0x3c5385,_0x218f01,_0x109d1c){io['to'](_0x3c5385)['emit'](_0x218f01,_0x109d1c);}function getTicket(_0x3cddae,_0x4dfe22,_0x2835d8,_0x5add69,_0x838cfb,_0x22eee0,_0x4dde1c,_0x3ec7e2){var _0x3eca07=Object['assign']({},{'OwnerId':_0x4dfe22['id'],'Subject':intUtil['getString'](_0x5add69[_0xa007('0xa')],_0x838cfb,'\x20'),'Description':intUtil[_0xa007('0xb')](_0x5add69[_0xa007('0xc')],_0x838cfb,'\x0a')},getCustomFields(_0x22eee0,_0x838cfb));if(_0x2835d8){if(_0x5add69[_0xa007('0xd')]===_0xa007('0xe')){_0x3eca07[_0xa007('0xf')]=moment['utc']();_0x3eca07[_0xa007('0x10')]=![];_0x3eca07[_0xa007('0x11')]=![];if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x13')||_0x2835d8[_0xa007('0x12')]==='lead'){_0x3eca07[_0xa007('0x14')]=_0x2835d8['id'];}else if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x15')){_0x3eca07[_0xa007('0x16')]=_0x2835d8['id'];}}else if(_0x5add69[_0xa007('0xd')]===_0xa007('0x17')){if(_0x2835d8[_0xa007('0x12')]==='contact'){_0x3eca07[_0xa007('0x18')]=_0x2835d8['id'];}else if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x15')){_0x3eca07['AccountId']=_0x2835d8['id'];}else if(_0x2835d8[_0xa007('0x12')]===_0xa007('0x19')&&_0x5add69[_0xa007('0x1a')]){_0x3eca07[_0x5add69['leadId']]=_0x2835d8['id'];}else{logger[_0xa007('0x1b')](_0xa007('0x1c'));}}}return _0x4dde1c[_0xa007('0x1d')](_0x5add69[_0xa007('0xd')])[_0xa007('0x1e')](_0x3eca07);}function getUser(_0x337a01,_0x839e3d,_0x2b8cc2){if(!_['isNil'](_0x839e3d)&&intUtil[_0xa007('0x1f')](_0x839e3d)){var _0x3392fd={'Email':_0x839e3d};var _0x16250a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2b8cc2['sobject'](_0xa007('0x20'))[_0xa007('0x21')](_0x3392fd,_0x16250a)['execute']()[_0xa007('0x22')](function(_0x57bed9){if(_0x57bed9[_0xa007('0x23')]){var _0x1c32c1=_['find'](_0x57bed9,function(_0x1cf6e8){return _0x1cf6e8[_0xa007('0x24')]===_0x839e3d;});if(_0x1c32c1){logger[_0xa007('0x1b')]('Agent\x20%s\x20found.',_0x839e3d);return BPromise[_0xa007('0x25')]({'id':_0x1c32c1['Id'],'name':_0x1c32c1['Name']});}}else{logger[_0xa007('0x1b')](_0xa007('0x26'),_0x839e3d);return _0x2b8cc2[_0xa007('0x27')]()['then'](function(_0x5a66fa){return BPromise[_0xa007('0x25')]({'id':_0x5a66fa[_0xa007('0x28')],'name':_0x5a66fa[_0xa007('0x29')]});});}});}else{logger['info'](_0xa007('0x26'),_0x839e3d);return _0x2b8cc2[_0xa007('0x27')]()[_0xa007('0x22')](function(_0x27c482){return BPromise[_0xa007('0x25')]({'id':_0x27c482['user_id'],'name':_0x27c482[_0xa007('0x29')]});});}}function getEndUser(_0xc6dcf,_0x4ffc86,_0x37cc29,_0x4d8baf,_0x5041fb){var _0x2e6b00={'$or':{'Phone':_0x4d8baf}};var _0x1bdfb3={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xa007('0x25')]()[_0xa007('0x22')](function(){logger['info'](_0xa007('0x2a'),_0x4d8baf,_0x4ffc86[_0xa007('0x2b')]);switch(_0x4ffc86[_0xa007('0x2b')]){case'contact_lead':var _0x19e671=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x2d')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x2d')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x19e671['$or'],_0x47b8ee);}return _0x5041fb['sobject']('Contact')[_0xa007('0x21')](_0x19e671,_0x1bdfb3)[_0xa007('0x2f')]()[_0xa007('0x22')](function(_0x560cbd){if(_0x560cbd&&_0x560cbd[_0xa007('0x23')]){return _0x560cbd;}else{var _0x5682ee=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchLead']){var _0x1df024={};_0x1df024[_0x4ffc86[_0xa007('0x30')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x5682ee[_0xa007('0x31')],_0x1df024);}return _0x5041fb[_0xa007('0x1d')]('Lead')[_0xa007('0x21')](_0x5682ee,_0x1bdfb3);}});case _0xa007('0x32'):var _0x926438=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x33')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x33')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x926438[_0xa007('0x31')],_0x47b8ee);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x34'))[_0xa007('0x21')](_0x926438,_0x1bdfb3)[_0xa007('0x2f')]()[_0xa007('0x22')](function(_0x1f3d2d){if(_0x1f3d2d&&_0x1f3d2d['length']){return _0x1f3d2d;}else{var _0x237a5b=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchContact']){var _0x419d11={};_0x419d11[_0x4ffc86[_0xa007('0x2d')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x237a5b[_0xa007('0x31')],_0x419d11);}return _0x5041fb[_0xa007('0x1d')]('Contact')[_0xa007('0x21')](_0x237a5b,_0x1bdfb3)[_0xa007('0x22')](function(_0x1cacbf){if(_0x1cacbf&&_0x1cacbf[_0xa007('0x23')]){return _0x1cacbf;}else{var _0x24ec0a=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchLead']){var _0x5684e6={};_0x5684e6[_0x4ffc86[_0xa007('0x30')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x24ec0a['$or'],_0x5684e6);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x35'))['find'](_0x24ec0a,_0x1bdfb3);}});}});case _0xa007('0x13'):var _0x19e671=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86['additionalSearchContact']){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x2d')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x19e671['$or'],_0x47b8ee);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x36'))[_0xa007('0x21')](_0x19e671,_0x1bdfb3)['execute']();case'lead':var _0x3456ea=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x30')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86[_0xa007('0x30')]]=_0x4d8baf;_[_0xa007('0x2e')](_0x3456ea['$or'],_0x47b8ee);}return _0x5041fb['sobject'](_0xa007('0x35'))[_0xa007('0x21')](_0x3456ea,_0x1bdfb3);case _0xa007('0x15'):var _0x926438=_[_0xa007('0x2c')](_0x2e6b00);if(_0x4ffc86[_0xa007('0x33')]){var _0x47b8ee={};_0x47b8ee[_0x4ffc86['additionalSearchAccount']]=_0x4d8baf;_[_0xa007('0x2e')](_0x926438['$or'],_0x47b8ee);}return _0x5041fb[_0xa007('0x1d')](_0xa007('0x34'))[_0xa007('0x21')](_0x926438,_0x1bdfb3);default:return null;}})['then'](function(_0x4a2fd9){if(_0x4a2fd9&&_0x4a2fd9[_0xa007('0x23')]){var _0x2a03a7=_['first'](_0x4a2fd9);if(_0x2a03a7){return BPromise[_0xa007('0x25')]({'id':_0x2a03a7['Id'],'name':_0x2a03a7[_0xa007('0x37')],'phone':_0x2a03a7[_0xa007('0x38')],'endUserType':_0x2a03a7[_0xa007('0x39')][_0xa007('0x3a')][_0xa007('0x3b')]()});}}})[_0xa007('0x22')](function(_0x27f917){if(_0x27f917){logger['info'](_0xa007('0x3c'),_0x27f917[_0xa007('0x12')],_0x4d8baf);return BPromise[_0xa007('0x25')](_0x27f917);}else{logger[_0xa007('0x1b')](_0xa007('0x3d'),_0x4d8baf);var _0x2abfef={'Phone':_0x4d8baf};if(_0x4ffc86[_0xa007('0x3e')]){if(_0x4ffc86['moduleCreate']==='contact'){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x4d8baf,_0x4ffc86[_0xa007('0x3e')]);_0x2abfef[_0xa007('0x3f')]=_0x37cc29!==_0xa007('0x40')?_0x37cc29:util[_0xa007('0x41')](_0xa007('0x42'),_0x4d8baf);}else if(_0x4ffc86[_0xa007('0x3e')]===_0xa007('0x19')){logger[_0xa007('0x1b')](_0xa007('0x43'),_0x4d8baf,_0x4ffc86['moduleCreate']);_0x2abfef[_0xa007('0x3f')]=_0x37cc29!==_0xa007('0x40')?_0x37cc29:util[_0xa007('0x41')]('Caller\x20-\x20%s',_0x4d8baf);_0x2abfef[_0xa007('0x44')]=_0xa007('0x45');}else if(_0x4ffc86['moduleCreate']===_0xa007('0x15')){logger[_0xa007('0x1b')](_0xa007('0x43'),_0x4d8baf,_0x4ffc86[_0xa007('0x3e')]);_0x2abfef[_0xa007('0x37')]=_0x37cc29!==_0xa007('0x40')?_0x37cc29:util[_0xa007('0x41')]('Caller\x20-\x20%s',_0x4d8baf);}else{return null;}}return _0x5041fb['sobject'](_[_0xa007('0x46')](_0x4ffc86['moduleCreate']))[_0xa007('0x1e')](_0x2abfef)[_0xa007('0x22')](function(_0x55d374){return BPromise[_0xa007('0x25')]({'id':_0x55d374['id'],'endUserType':_0x4ffc86[_0xa007('0x3e')]});});}});}function getCustomFields(_0x4ebbde,_0x36b512){var _0x584104={};if(_0x4ebbde['length']>0x0){_['forEach'](_0x4ebbde,function(_0x38bf9a){if(_['includes'](['string',_0xa007('0x47')],_0x38bf9a[_0xa007('0x3a')])&&_0x38bf9a[_0xa007('0x48')]){_0x584104[_0x38bf9a[_0xa007('0x48')]]=_0x38bf9a['content'][_0xa007('0x49')]();}else if(_0x38bf9a[_0xa007('0x3a')]===_0xa007('0x4a')&&_0x38bf9a[_0xa007('0x4b')]&&_0x38bf9a[_0xa007('0x48')]){_0x36b512[_0x38bf9a[_0xa007('0x4b')]]&&(_0x584104[_0x38bf9a[_0xa007('0x48')]]=_0x36b512[_0x38bf9a[_0xa007('0x4b')]]['toString']());}else if(_0x38bf9a[_0xa007('0x3a')]===_0xa007('0x4c')&&_0x38bf9a[_0xa007('0x4d')]&&_0x38bf9a['Variable'][_0xa007('0x4e')]&&_0x38bf9a[_0xa007('0x48')]){_0x36b512[_0x38bf9a['Variable'][_0xa007('0x4e')]['toLowerCase']()]&&(_0x584104[_0x38bf9a['idField']]=_0x36b512[_0x38bf9a['Variable'][_0xa007('0x4e')][_0xa007('0x3b')]()][_0xa007('0x49')]());}});}return _0x584104;}function getConnection(_0x487a50){var _0x5aab4a=_0x487a50['password'][_0xa007('0x4f')](_0x487a50[_0xa007('0x50')]);var _0x1be743=new jsforce['Connection']({'oauth2':{'loginUrl':_0x487a50[_0xa007('0x51')]||_0xa007('0x52'),'clientId':_0x487a50[_0xa007('0x53')],'clientSecret':_0x487a50['clientSecret']}});return _0x1be743[_0xa007('0x54')](_0x487a50[_0xa007('0x55')],_0x5aab4a)[_0xa007('0x22')](function(){logger[_0xa007('0x1b')](_0xa007('0x56'));return _0x1be743;});}exports['queue']=function(_0x43cca7,_0x31ccac,_0x34251e,_0x3d948a,_0x45f1d1,_0x239269){var _0x186b6d,_0x4c829f,_0x59bae5,_0x2cdde9;_0x239269[_0xa007('0x57')]=intUtil[_0xa007('0x58')](_0x239269[_0xa007('0x57')]);_0x239269[_0xa007('0x51')]=intUtil[_0xa007('0x58')](_0x239269[_0xa007('0x51')]);if(_0x45f1d1&&_0x45f1d1[_0xa007('0x59')]){logger[_0xa007('0x1b')](_0xa007('0x5a'),_0xa007('0x5b'));_0x31ccac['recordingURL']=util[_0xa007('0x41')](_0xa007('0x5c'),_0x239269[_0xa007('0x57')],_0x31ccac['uniqueid'],md5(_0x31ccac['uniqueid']));}else{_0x31ccac[_0xa007('0x5d')]='';}return getConnection(_0x239269)[_0xa007('0x22')](function(_0x22a1b2){_0x2cdde9=_0x22a1b2;return getUser(_0x239269,_0x3d948a[_0xa007('0x5e')],_0x2cdde9);})[_0xa007('0x22')](function(_0x385f40){_0x186b6d=_0x385f40;return getEndUser(_0x239269,_0x34251e,_0x31ccac['calleridname'],_0x31ccac[_0xa007('0x5f')],_0x2cdde9);})[_0xa007('0x22')](function(_0x4ce95f){_0x4c829f=_0x4ce95f;return getTicket(_0x239269,_0x186b6d,_0x4c829f,_0x34251e,_0x31ccac,_0x34251e[_0xa007('0x60')],_0x2cdde9,_0xa007('0x61'));})[_0xa007('0x22')](function(_0x1184fa){_0x59bae5=_0x1184fa;logger[_0xa007('0x1b')](_0xa007('0x62'),_0x59bae5['id']);logger[_0xa007('0x1b')](_0xa007('0x63'),_0x59bae5['id'],_0x3d948a[_0xa007('0x4e')],_0x239269[_0xa007('0x3a')]);switch(_0x239269[_0xa007('0x3a')]){case _0xa007('0x64'):emit(util[_0xa007('0x41')](_0xa007('0x65'),_0x3d948a[_0xa007('0x4e')]),_0xa007('0x66'),{'recordId':_0x59bae5['id']});break;case _0xa007('0x67'):emit(util[_0xa007('0x41')]('user:%s',_0x3d948a[_0xa007('0x4e')]),_0xa007('0x68'),{'uri':util['format']('%s/%s/e',_0x2cdde9[_0xa007('0x69')],_0x59bae5['id'])});break;default:logger[_0xa007('0x6a')](_0xa007('0x6b'));}})[_0xa007('0x6c')](function(_0x3302fa){logger[_0xa007('0x6a')](_0xa007('0x5a'),_0x3302fa);});};exports[_0xa007('0x6d')]=function(_0x394ebb,_0x2fe9e0,_0x4efdf8,_0x562b1d,_0x357456,_0x4566dd,_0x130361){var _0x3e23d7,_0x31ab0e,_0x342e4f,_0x4d1f44;_0x4566dd[_0xa007('0x57')]=intUtil[_0xa007('0x58')](_0x4566dd[_0xa007('0x57')]);_0x4566dd[_0xa007('0x51')]=intUtil[_0xa007('0x58')](_0x4566dd['remoteUri']);if(_0x130361&&_0x130361[_0xa007('0x6e')]&&_0x130361[_0xa007('0x6e')]!==_0xa007('0x6f')){logger[_0xa007('0x1b')]('[OUTBOUND]',_0xa007('0x5b'));_0x2fe9e0['recordingURL']=util[_0xa007('0x41')](_0xa007('0x5c'),_0x4566dd[_0xa007('0x57')],_0x2fe9e0[_0xa007('0x70')],md5(_0x2fe9e0[_0xa007('0x70')]));}return getConnection(_0x4566dd)[_0xa007('0x22')](function(_0x1d05f4){_0x4d1f44=_0x1d05f4;return getUser(_0x4566dd,_0x562b1d[_0xa007('0x5e')],_0x4d1f44);})[_0xa007('0x22')](function(_0x2a032f){_0x3e23d7=_0x2a032f;return getEndUser(_0x4566dd,_0x4efdf8,_0x2fe9e0['destcalleridname'],_0x2fe9e0[_0xa007('0x71')],_0x4d1f44);})[_0xa007('0x22')](function(_0x1d41f5){_0x31ab0e=_0x1d41f5;return getTicket(_0x4566dd,_0x3e23d7,_0x31ab0e,_0x4efdf8,_0x2fe9e0,_0x4efdf8[_0xa007('0x60')],_0x4d1f44,'outbound');})[_0xa007('0x22')](function(_0x35a248){_0x342e4f=_0x35a248;logger[_0xa007('0x1b')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x342e4f['id']);logger[_0xa007('0x1b')](_0xa007('0x72'),_0x342e4f['id'],_0x562b1d[_0xa007('0x4e')],_0x4566dd[_0xa007('0x3a')]);switch(_0x4566dd[_0xa007('0x3a')]){case _0xa007('0x64'):emit(util[_0xa007('0x41')](_0xa007('0x65'),_0x562b1d[_0xa007('0x4e')]),'trigger:salesforce:display',{'recordId':_0x342e4f['id']});break;case _0xa007('0x67'):emit(util['format']('user:%s',_0x562b1d[_0xa007('0x4e')]),_0xa007('0x68'),{'uri':util[_0xa007('0x41')](_0xa007('0x73'),_0x4d1f44[_0xa007('0x69')],_0x342e4f['id'])});break;default:logger[_0xa007('0x6a')](_0xa007('0x74'),_0xa007('0x75'));}})[_0xa007('0x6c')](function(_0x324f0f){logger['error']('[OUTBOUND]',_0x324f0f);});};exports['unmanaged']=function(_0x3f7541,_0x2549c2,_0x2576f4,_0x6f7cbb,_0x10ec12,_0x1dafe0){var _0x5a2d45,_0x2ac298,_0x90c4df,_0xf82419;_0x1dafe0[_0xa007('0x57')]=intUtil[_0xa007('0x58')](_0x1dafe0[_0xa007('0x57')]);_0x1dafe0[_0xa007('0x51')]=intUtil['stripTrailingSlash'](_0x1dafe0[_0xa007('0x51')]);if(_0x10ec12&&_0x10ec12[_0xa007('0x59')]){logger[_0xa007('0x1b')]('['+_0x2549c2[_0xa007('0x76')][_0xa007('0x77')]()+']',_0xa007('0x5b'));_0x2549c2[_0xa007('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1dafe0[_0xa007('0x57')],_0x2549c2[_0xa007('0x70')],md5(_0x2549c2[_0xa007('0x70')]));}else{_0x2549c2[_0xa007('0x5d')]='';}return getConnection(_0x1dafe0)[_0xa007('0x22')](function(_0x4cbbcd){_0xf82419=_0x4cbbcd;if(!_['isNil'](_0x6f7cbb)){return getUser(_0x1dafe0,_0x6f7cbb['name'],_0xf82419);}else{return getUser(_0x1dafe0,null,_0xf82419);}})[_0xa007('0x22')](function(_0x1c2144){_0x5a2d45=_0x1c2144;return getEndUser(_0x1dafe0,_0x2576f4,_0x2549c2['calleridname'],_0x2549c2[_0xa007('0x5f')],_0xf82419);})[_0xa007('0x22')](function(_0x32fbb1){_0x2ac298=_0x32fbb1;return getTicket(_0x1dafe0,_0x5a2d45,_0x2ac298,_0x2576f4,_0x2549c2,_0x2576f4[_0xa007('0x60')],_0xf82419);})[_0xa007('0x22')](function(_0x2484c8){_0x90c4df=_0x2484c8;logger[_0xa007('0x1b')]('['+_0x2549c2['lastevent'][_0xa007('0x77')]()+_0xa007('0x78'),_0x90c4df['id']);logger[_0xa007('0x1b')]('['+_0x2549c2[_0xa007('0x76')][_0xa007('0x77')]()+_0xa007('0x79'),_0x1dafe0[_0xa007('0x3a')]);})[_0xa007('0x6c')](function(_0x5d6e0f){logger[_0xa007('0x6a')]('['+_0x2549c2[_0xa007('0x76')][_0xa007('0x77')]()+']',_0x5d6e0f);});}; \ No newline at end of file +var _0x8c1e=['Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','error','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','email','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','toUpperCase','lastevent',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','bluebird','md5','jsforce','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','ticketType','utc','IsRecurrence','endUserType','contact','account','WhatId','Case','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','validateEmail','find','execute','then','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','display_name','moduleSearch','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','cloneDeep','additionalSearchAccount','Account','Lead','first','Phone','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','No\x20Company','upperFirst','create','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','securityToken','remoteUri','https://login.salesforce.com','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format'];(function(_0x23284a,_0xab8e95){var _0x1f4a50=function(_0x32d3bc){while(--_0x32d3bc){_0x23284a['push'](_0x23284a['shift']());}};_0x1f4a50(++_0xab8e95);}(_0x8c1e,0x118));var _0xe8c1=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8c1e[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var rp=require(_0xe8c1('0x0'));var moment=require(_0xe8c1('0x1'));var BPromise=require(_0xe8c1('0x2'));var md5=require(_0xe8c1('0x3'));var jsforce=require(_0xe8c1('0x4'));var util=require(_0xe8c1('0x5'));var Redis=require(_0xe8c1('0x6'));var intUtil=require(_0xe8c1('0x7'));var config=require(_0xe8c1('0x8'));var logger=require(_0xe8c1('0x9'))(_0xe8c1('0xa'));config['redis']=_[_0xe8c1('0xb')](config[_0xe8c1('0xc')],{'host':_0xe8c1('0xd'),'port':0x18eb});var io=require(_0xe8c1('0xe'))(new Redis(config['redis']));function emit(_0x351eab,_0x30d092,_0x17f8be){io['to'](_0x351eab)[_0xe8c1('0xf')](_0x30d092,_0x17f8be);}function getTicket(_0x339dc1,_0x4e122a,_0x1c94c2,_0x3c3971,_0x2f2894,_0x57362f,_0x300156,_0x1077ec){var _0x15b7e7=Object[_0xe8c1('0x10')]({},{'OwnerId':_0x4e122a['id'],'Subject':intUtil[_0xe8c1('0x11')](_0x3c3971[_0xe8c1('0x12')],_0x2f2894,'\x20'),'Description':intUtil[_0xe8c1('0x11')](_0x3c3971['Descriptions'],_0x2f2894,'\x0a')},getCustomFields(_0x57362f,_0x2f2894));if(_0x1c94c2){if(_0x3c3971[_0xe8c1('0x13')]==='Task'){_0x15b7e7['ActivityDate']=moment[_0xe8c1('0x14')]();_0x15b7e7['IsReminderSet']=![];_0x15b7e7[_0xe8c1('0x15')]=![];if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x17')||_0x1c94c2[_0xe8c1('0x16')]==='lead'){_0x15b7e7['WhoId']=_0x1c94c2['id'];}else if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x18')){_0x15b7e7[_0xe8c1('0x19')]=_0x1c94c2['id'];}}else if(_0x3c3971[_0xe8c1('0x13')]===_0xe8c1('0x1a')){if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x17')){_0x15b7e7[_0xe8c1('0x1b')]=_0x1c94c2['id'];}else if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x18')){_0x15b7e7[_0xe8c1('0x1c')]=_0x1c94c2['id'];}else if(_0x1c94c2[_0xe8c1('0x16')]===_0xe8c1('0x1d')&&_0x3c3971[_0xe8c1('0x1e')]){_0x15b7e7[_0x3c3971[_0xe8c1('0x1e')]]=_0x1c94c2['id'];}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x20'));}}}return _0x300156[_0xe8c1('0x21')](_0x3c3971[_0xe8c1('0x13')])['create'](_0x15b7e7);}function getUser(_0x579a82,_0x24c277,_0x326cf8){if(!_[_0xe8c1('0x22')](_0x24c277)&&intUtil[_0xe8c1('0x23')](_0x24c277)){var _0x1f9041={'Email':_0x24c277};var _0x3c78d3={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x326cf8[_0xe8c1('0x21')]('User')[_0xe8c1('0x24')](_0x1f9041,_0x3c78d3)[_0xe8c1('0x25')]()[_0xe8c1('0x26')](function(_0x4600e2){if(_0x4600e2[_0xe8c1('0x27')]){var _0x312766=_[_0xe8c1('0x24')](_0x4600e2,function(_0xba0683){return _0xba0683[_0xe8c1('0x28')]===_0x24c277;});if(_0x312766){logger[_0xe8c1('0x1f')]('Agent\x20%s\x20found.',_0x24c277);return BPromise[_0xe8c1('0x29')]({'id':_0x312766['Id'],'name':_0x312766[_0xe8c1('0x2a')]});}}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x2b'),_0x24c277);return _0x326cf8['identity']()['then'](function(_0x2a6755){return BPromise[_0xe8c1('0x29')]({'id':_0x2a6755[_0xe8c1('0x2c')],'name':_0x2a6755['display_name']});});}});}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x2b'),_0x24c277);return _0x326cf8[_0xe8c1('0x2d')]()[_0xe8c1('0x26')](function(_0x26d483){return BPromise['resolve']({'id':_0x26d483[_0xe8c1('0x2c')],'name':_0x26d483[_0xe8c1('0x2e')]});});}}function getEndUser(_0x14ddf4,_0x3cd096,_0x5f77d,_0x5156fd,_0x3dd4eb){var _0x424439={'$or':{'Phone':_0x5156fd}};var _0x58a1e9={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xe8c1('0x29')]()['then'](function(){logger[_0xe8c1('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5156fd,_0x3cd096[_0xe8c1('0x2f')]);switch(_0x3cd096[_0xe8c1('0x2f')]){case'contact_lead':var _0x568199=_['cloneDeep'](_0x424439);if(_0x3cd096[_0xe8c1('0x30')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x30')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x568199[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb['sobject'](_0xe8c1('0x33'))['find'](_0x568199,_0x58a1e9)['execute']()[_0xe8c1('0x26')](function(_0x42aa0b){if(_0x42aa0b&&_0x42aa0b['length']){return _0x42aa0b;}else{var _0x3533a0=_['cloneDeep'](_0x424439);if(_0x3cd096[_0xe8c1('0x34')]){var _0x4ec9fe={};_0x4ec9fe[_0x3cd096['additionalSearchLead']]=_0x5156fd;_[_0xe8c1('0x31')](_0x3533a0['$or'],_0x4ec9fe);}return _0x3dd4eb[_0xe8c1('0x21')]('Lead')[_0xe8c1('0x24')](_0x3533a0,_0x58a1e9);}});case _0xe8c1('0x35'):var _0x4ab2a3=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096[_0xe8c1('0x37')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x37')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x4ab2a3[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x38'))[_0xe8c1('0x24')](_0x4ab2a3,_0x58a1e9)[_0xe8c1('0x25')]()[_0xe8c1('0x26')](function(_0x4f6507){if(_0x4f6507&&_0x4f6507[_0xe8c1('0x27')]){return _0x4f6507;}else{var _0x32acbd=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096['additionalSearchContact']){var _0x28f26a={};_0x28f26a[_0x3cd096[_0xe8c1('0x30')]]=_0x5156fd;_['merge'](_0x32acbd[_0xe8c1('0x32')],_0x28f26a);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x33'))[_0xe8c1('0x24')](_0x32acbd,_0x58a1e9)[_0xe8c1('0x26')](function(_0x440af8){if(_0x440af8&&_0x440af8[_0xe8c1('0x27')]){return _0x440af8;}else{var _0x4b0a50=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096['additionalSearchLead']){var _0x40b104={};_0x40b104[_0x3cd096[_0xe8c1('0x34')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x4b0a50['$or'],_0x40b104);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x39'))[_0xe8c1('0x24')](_0x4b0a50,_0x58a1e9);}});}});case _0xe8c1('0x17'):var _0x568199=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096['additionalSearchContact']){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x30')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x568199[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb['sobject'](_0xe8c1('0x33'))[_0xe8c1('0x24')](_0x568199,_0x58a1e9)['execute']();case _0xe8c1('0x1d'):var _0x345676=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096[_0xe8c1('0x34')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x34')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x345676[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x39'))[_0xe8c1('0x24')](_0x345676,_0x58a1e9);case _0xe8c1('0x18'):var _0x4ab2a3=_[_0xe8c1('0x36')](_0x424439);if(_0x3cd096[_0xe8c1('0x37')]){var _0x1abe74={};_0x1abe74[_0x3cd096[_0xe8c1('0x37')]]=_0x5156fd;_[_0xe8c1('0x31')](_0x4ab2a3[_0xe8c1('0x32')],_0x1abe74);}return _0x3dd4eb[_0xe8c1('0x21')](_0xe8c1('0x38'))[_0xe8c1('0x24')](_0x4ab2a3,_0x58a1e9);default:return null;}})[_0xe8c1('0x26')](function(_0x2a6c25){if(_0x2a6c25&&_0x2a6c25[_0xe8c1('0x27')]){var _0x468f52=_[_0xe8c1('0x3a')](_0x2a6c25);if(_0x468f52){return BPromise[_0xe8c1('0x29')]({'id':_0x468f52['Id'],'name':_0x468f52[_0xe8c1('0x2a')],'phone':_0x468f52[_0xe8c1('0x3b')],'endUserType':_0x468f52['attributes'][_0xe8c1('0x3c')][_0xe8c1('0x3d')]()});}}})[_0xe8c1('0x26')](function(_0x326cdb){if(_0x326cdb){logger['info'](_0xe8c1('0x3e'),_0x326cdb[_0xe8c1('0x16')],_0x5156fd);return BPromise[_0xe8c1('0x29')](_0x326cdb);}else{logger[_0xe8c1('0x1f')](_0xe8c1('0x3f'),_0x5156fd);var _0x58268a={'Phone':_0x5156fd};if(_0x3cd096[_0xe8c1('0x40')]){if(_0x3cd096[_0xe8c1('0x40')]==='contact'){logger['info'](_0xe8c1('0x41'),_0x5156fd,_0x3cd096['moduleCreate']);_0x58268a[_0xe8c1('0x42')]=_0x5f77d!==_0xe8c1('0x43')?_0x5f77d:util['format']('Caller\x20-\x20%s',_0x5156fd);}else if(_0x3cd096[_0xe8c1('0x40')]===_0xe8c1('0x1d')){logger['info'](_0xe8c1('0x41'),_0x5156fd,_0x3cd096[_0xe8c1('0x40')]);_0x58268a[_0xe8c1('0x42')]=_0x5f77d!==_0xe8c1('0x43')?_0x5f77d:util[_0xe8c1('0x44')](_0xe8c1('0x45'),_0x5156fd);_0x58268a['Company']=_0xe8c1('0x46');}else if(_0x3cd096[_0xe8c1('0x40')]===_0xe8c1('0x18')){logger[_0xe8c1('0x1f')](_0xe8c1('0x41'),_0x5156fd,_0x3cd096[_0xe8c1('0x40')]);_0x58268a['Name']=_0x5f77d!==_0xe8c1('0x43')?_0x5f77d:util[_0xe8c1('0x44')](_0xe8c1('0x45'),_0x5156fd);}else{return null;}}return _0x3dd4eb[_0xe8c1('0x21')](_[_0xe8c1('0x47')](_0x3cd096[_0xe8c1('0x40')]))[_0xe8c1('0x48')](_0x58268a)[_0xe8c1('0x26')](function(_0x41779d){return BPromise[_0xe8c1('0x29')]({'id':_0x41779d['id'],'endUserType':_0x3cd096['moduleCreate']});});}});}function getCustomFields(_0x303a30,_0x441f06){var _0x436e03={};if(_0x303a30['length']>0x0){_[_0xe8c1('0x49')](_0x303a30,function(_0x25f217){if(_[_0xe8c1('0x4a')]([_0xe8c1('0x4b'),_0xe8c1('0x4c')],_0x25f217[_0xe8c1('0x3c')])&&_0x25f217['idField']){_0x436e03[_0x25f217[_0xe8c1('0x4d')]]=_0x25f217[_0xe8c1('0x4e')][_0xe8c1('0x4f')]();}else if(_0x25f217[_0xe8c1('0x3c')]===_0xe8c1('0x50')&&_0x25f217['variableName']&&_0x25f217[_0xe8c1('0x4d')]){_0x441f06[_0x25f217['variableName']]&&(_0x436e03[_0x25f217[_0xe8c1('0x4d')]]=_0x441f06[_0x25f217[_0xe8c1('0x51')]][_0xe8c1('0x4f')]());}else if(_0x25f217[_0xe8c1('0x3c')]===_0xe8c1('0x52')&&_0x25f217[_0xe8c1('0x53')]&&_0x25f217[_0xe8c1('0x53')][_0xe8c1('0x54')]&&_0x25f217['idField']){_0x441f06[_0x25f217[_0xe8c1('0x53')][_0xe8c1('0x54')][_0xe8c1('0x3d')]()]&&(_0x436e03[_0x25f217[_0xe8c1('0x4d')]]=_0x441f06[_0x25f217['Variable'][_0xe8c1('0x54')]['toLowerCase']()][_0xe8c1('0x4f')]());}});}return _0x436e03;}function getConnection(_0x13a425){var _0x13840b=_0x13a425['password']['concat'](_0x13a425[_0xe8c1('0x55')]);var _0x948a70=new jsforce['Connection']({'oauth2':{'loginUrl':_0x13a425[_0xe8c1('0x56')]||_0xe8c1('0x57'),'clientId':_0x13a425['clientId'],'clientSecret':_0x13a425['clientSecret']}});return _0x948a70[_0xe8c1('0x58')](_0x13a425[_0xe8c1('0x59')],_0x13840b)['then'](function(){logger['info'](_0xe8c1('0x5a'));return _0x948a70;});}exports[_0xe8c1('0x5b')]=function(_0x1a717b,_0x306c77,_0x50c01e,_0x38a7e6,_0x3d2e8a,_0x331aa1){var _0x47e409,_0x5b2e6a,_0x5f3a06,_0x4c1b1f;_0x331aa1[_0xe8c1('0x5c')]=intUtil[_0xe8c1('0x5d')](_0x331aa1[_0xe8c1('0x5c')]);_0x331aa1[_0xe8c1('0x56')]=intUtil[_0xe8c1('0x5d')](_0x331aa1[_0xe8c1('0x56')]);if(_0x3d2e8a&&_0x3d2e8a[_0xe8c1('0x5e')]){logger[_0xe8c1('0x1f')]('[QUEUE]',_0xe8c1('0x5f'));_0x306c77[_0xe8c1('0x60')]=util[_0xe8c1('0x44')](_0xe8c1('0x61'),_0x331aa1[_0xe8c1('0x5c')],_0x306c77[_0xe8c1('0x62')],md5(_0x306c77['uniqueid']));}else{_0x306c77['recordingURL']='';}return getConnection(_0x331aa1)[_0xe8c1('0x26')](function(_0x200919){_0x4c1b1f=_0x200919;return getUser(_0x331aa1,_0x38a7e6['email'],_0x4c1b1f);})[_0xe8c1('0x26')](function(_0xa54f14){_0x47e409=_0xa54f14;return getEndUser(_0x331aa1,_0x50c01e,_0x306c77[_0xe8c1('0x63')],_0x306c77[_0xe8c1('0x64')],_0x4c1b1f);})[_0xe8c1('0x26')](function(_0x307476){_0x5b2e6a=_0x307476;return getTicket(_0x331aa1,_0x47e409,_0x5b2e6a,_0x50c01e,_0x306c77,_0x50c01e[_0xe8c1('0x65')],_0x4c1b1f,'queue');})[_0xe8c1('0x26')](function(_0x36eb4d){_0x5f3a06=_0x36eb4d;logger['info'](_0xe8c1('0x66'),_0x5f3a06['id']);logger[_0xe8c1('0x1f')](_0xe8c1('0x67'),_0x5f3a06['id'],_0x38a7e6['name'],_0x331aa1[_0xe8c1('0x3c')]);switch(_0x331aa1['type']){case _0xe8c1('0x68'):emit(util[_0xe8c1('0x44')](_0xe8c1('0x69'),_0x38a7e6['name']),_0xe8c1('0x6a'),{'recordId':_0x5f3a06['id']});break;case _0xe8c1('0x6b'):emit(util[_0xe8c1('0x44')](_0xe8c1('0x69'),_0x38a7e6[_0xe8c1('0x54')]),_0xe8c1('0x6c'),{'uri':util[_0xe8c1('0x44')]('%s/%s/e',_0x4c1b1f[_0xe8c1('0x6d')],_0x5f3a06['id'])});break;default:logger['error'](_0xe8c1('0x6e'));}})[_0xe8c1('0x6f')](function(_0x5ebd95){logger[_0xe8c1('0x70')](_0xe8c1('0x71'),_0x5ebd95);});};exports[_0xe8c1('0x72')]=function(_0x5741a9,_0x4a9d3d,_0x5bbc0a,_0x251c6d,_0x2e4535,_0x44c26d,_0x15e6d5){var _0x193390,_0x127064,_0x3be9af,_0x59f3df;_0x44c26d['serverUrl']=intUtil[_0xe8c1('0x5d')](_0x44c26d[_0xe8c1('0x5c')]);_0x44c26d[_0xe8c1('0x56')]=intUtil['stripTrailingSlash'](_0x44c26d['remoteUri']);if(_0x15e6d5&&_0x15e6d5[_0xe8c1('0x73')]&&_0x15e6d5[_0xe8c1('0x73')]!=='none'){logger['info'](_0xe8c1('0x74'),_0xe8c1('0x5f'));_0x4a9d3d[_0xe8c1('0x60')]=util[_0xe8c1('0x44')](_0xe8c1('0x61'),_0x44c26d[_0xe8c1('0x5c')],_0x4a9d3d[_0xe8c1('0x62')],md5(_0x4a9d3d[_0xe8c1('0x62')]));}return getConnection(_0x44c26d)['then'](function(_0x3498a1){_0x59f3df=_0x3498a1;return getUser(_0x44c26d,_0x251c6d[_0xe8c1('0x75')],_0x59f3df);})[_0xe8c1('0x26')](function(_0x1ff2a3){_0x193390=_0x1ff2a3;return getEndUser(_0x44c26d,_0x5bbc0a,_0x4a9d3d['destcalleridname'],_0x4a9d3d[_0xe8c1('0x76')],_0x59f3df);})[_0xe8c1('0x26')](function(_0x1cf131){_0x127064=_0x1cf131;return getTicket(_0x44c26d,_0x193390,_0x127064,_0x5bbc0a,_0x4a9d3d,_0x5bbc0a[_0xe8c1('0x65')],_0x59f3df,_0xe8c1('0x72'));})[_0xe8c1('0x26')](function(_0x4e25f2){_0x3be9af=_0x4e25f2;logger[_0xe8c1('0x1f')](_0xe8c1('0x77'),_0x3be9af['id']);logger[_0xe8c1('0x1f')]('[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x3be9af['id'],_0x251c6d[_0xe8c1('0x54')],_0x44c26d[_0xe8c1('0x3c')]);switch(_0x44c26d[_0xe8c1('0x3c')]){case _0xe8c1('0x68'):emit(util[_0xe8c1('0x44')]('user:%s',_0x251c6d[_0xe8c1('0x54')]),_0xe8c1('0x6a'),{'recordId':_0x3be9af['id']});break;case _0xe8c1('0x6b'):emit(util[_0xe8c1('0x44')](_0xe8c1('0x69'),_0x251c6d[_0xe8c1('0x54')]),'trigger:browser:url',{'uri':util[_0xe8c1('0x44')](_0xe8c1('0x78'),_0x59f3df[_0xe8c1('0x6d')],_0x3be9af['id'])});break;default:logger[_0xe8c1('0x70')](_0xe8c1('0x74'),_0xe8c1('0x79'));}})[_0xe8c1('0x6f')](function(_0x1a9f43){logger[_0xe8c1('0x70')](_0xe8c1('0x74'),_0x1a9f43);});};exports['unmanaged']=function(_0x14a201,_0x320485,_0x197fe6,_0x397804,_0x5a9bcb,_0x5d47aa){var _0x25b516,_0x541d3f,_0x55c8a3,_0x37a602;_0x5d47aa['serverUrl']=intUtil[_0xe8c1('0x5d')](_0x5d47aa[_0xe8c1('0x5c')]);_0x5d47aa['remoteUri']=intUtil[_0xe8c1('0x5d')](_0x5d47aa[_0xe8c1('0x56')]);if(_0x5a9bcb&&_0x5a9bcb['monitor_format']){logger[_0xe8c1('0x1f')]('['+_0x320485['lastevent'][_0xe8c1('0x7a')]()+']',_0xe8c1('0x5f'));_0x320485['recordingURL']=util[_0xe8c1('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d47aa[_0xe8c1('0x5c')],_0x320485[_0xe8c1('0x62')],md5(_0x320485[_0xe8c1('0x62')]));}else{_0x320485[_0xe8c1('0x60')]='';}return getConnection(_0x5d47aa)[_0xe8c1('0x26')](function(_0x3b15bf){_0x37a602=_0x3b15bf;if(!_['isNil'](_0x397804)){return getUser(_0x5d47aa,_0x397804['name'],_0x37a602);}else{return getUser(_0x5d47aa,null,_0x37a602);}})['then'](function(_0x517984){_0x25b516=_0x517984;return getEndUser(_0x5d47aa,_0x197fe6,_0x320485[_0xe8c1('0x63')],_0x320485[_0xe8c1('0x64')],_0x37a602);})[_0xe8c1('0x26')](function(_0x4c5c04){_0x541d3f=_0x4c5c04;return getTicket(_0x5d47aa,_0x25b516,_0x541d3f,_0x197fe6,_0x320485,_0x197fe6[_0xe8c1('0x65')],_0x37a602);})[_0xe8c1('0x26')](function(_0x2a4dd1){_0x55c8a3=_0x2a4dd1;logger[_0xe8c1('0x1f')]('['+_0x320485[_0xe8c1('0x7b')][_0xe8c1('0x7a')]()+']\x20Ticket\x20%s\x20created.',_0x55c8a3['id']);logger[_0xe8c1('0x1f')]('['+_0x320485[_0xe8c1('0x7b')][_0xe8c1('0x7a')]()+_0xe8c1('0x7c'),_0x5d47aa['type']);})[_0xe8c1('0x6f')](function(_0x126f5b){logger[_0xe8c1('0x70')]('['+_0x320485[_0xe8c1('0x7b')][_0xe8c1('0x7a')]()+']',_0x126f5b);});}; \ 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 589127a..4af9b82 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 _0x2bd3=['unmanaged','queue','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','localhost','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','userEmail','],\x20getUser\x20rp\x20obj','true','userId','adminId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','forEach','includes','string','type','customField','nameField','toLowerCase','toString','idField','variable','variableName','customVariable','Variable','name','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','?sysparm_query=name%3D','label_entry','incident','Incident\x20-\x20','ticketNumber',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','all','Tags','map','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','%s/api/now/table/','isNil','email','outbound','destcalleridnum','callDirection'];(function(_0x363e98,_0x36f200){var _0x566bdb=function(_0x2713a4){while(--_0x2713a4){_0x363e98['push'](_0x363e98['shift']());}};_0x566bdb(++_0x36f200);}(_0x2bd3,0x1a0));var _0x32bd=function(_0x1bdfe7,_0x5c062c){_0x1bdfe7=_0x1bdfe7-0x0;var _0x6dc98e=_0x2bd3[_0x1bdfe7];return _0x6dc98e;};'use strict';var _=require(_0x32bd('0x0'));var Promise=require('bluebird');var rp=require('request-promise');var util=require(_0x32bd('0x1'));var md5=require(_0x32bd('0x2'));var Redis=require(_0x32bd('0x3'));var intUtil=require(_0x32bd('0x4'));var config=require(_0x32bd('0x5'));var logger=require(_0x32bd('0x6'))(_0x32bd('0x7'));config['redis']=_[_0x32bd('0x8')](config[_0x32bd('0x9')],{'host':_0x32bd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x32bd('0x9')]));function getAdminUser(_0x15f955,_0x1da8e0,_0x6abe74,_0x7a4cff,_0x562960,_0x385a6c){return new Promise(function(_0x5352a8,_0x3f86d7){var _0x2d09b0={'method':_0x32bd('0xb'),'uri':_0x7a4cff+_0x32bd('0xc')+'&'+_0x562960+'&'+_0x385a6c,'auth':_0x1da8e0,'json':!![]};return rp(_0x2d09b0)[_0x32bd('0xd')](function(_0x31031a){if(_0x31031a[_0x32bd('0xe')][_0x32bd('0xf')]>0x0){_0x6abe74['adminId']=_0x31031a['result'][0x0][_0x32bd('0x10')];}logger[_0x32bd('0x11')]('['+[_0x15f955[_0x32bd('0x12')]()]+_0x32bd('0x13'),_0x6abe74);_0x5352a8(_0x6abe74);})[_0x32bd('0x14')](function(_0xeb11f8){logger[_0x32bd('0x15')]('['+[_0x15f955[_0x32bd('0x12')]()]+']',_0xeb11f8[_0x32bd('0x16')]);_0x3f86d7(_0xeb11f8['message']);});});}function getUser(_0xea3a29,_0x245e58,_0x14d9bc,_0x3521b0,_0x6ff3b7){return function(_0x542619){logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x17'),_0x542619);return new Promise(function(_0x40264b,_0x2cfeb5){if(intUtil['validateEmail'](_0x542619[_0x32bd('0x18')])){var _0x1fb731={'method':_0x32bd('0xb'),'uri':_0x14d9bc+'sys_user?sysparm_query=email%3D'+_0x542619[_0x32bd('0x18')]+'&'+_0x3521b0+'&'+_0x6ff3b7,'auth':_0x245e58,'json':!![]};logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x19'),_0x1fb731);return rp(_0x1fb731)[_0x32bd('0xd')](function(_0x218fff){logger['info']('['+[_0xea3a29[_0x32bd('0x12')]()]+'],\x20getUser\x20entity',_0x218fff);if(_0x218fff[_0x32bd('0xe')][_0x32bd('0xf')]>0x0&&String(_0x218fff[_0x32bd('0xe')][0x0]['active'])===_0x32bd('0x1a')){_0x542619[_0x32bd('0x1b')]=_0x218fff[_0x32bd('0xe')][0x0][_0x32bd('0x10')];}else{_0x542619[_0x32bd('0x1b')]=_0x542619[_0x32bd('0x1c')];_0x542619[_0x32bd('0x18')]=_0x542619[_0x32bd('0x1d')];}logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x1e'),_0x542619);_0x40264b(_0x542619);})[_0x32bd('0x14')](function(_0x54ab7f){logger['error']('['+[_0xea3a29[_0x32bd('0x12')]()]+']',_0x54ab7f[_0x32bd('0x16')]);_0x2cfeb5(_0x54ab7f[_0x32bd('0x16')]);});}else{logger[_0x32bd('0x11')]('['+[_0xea3a29[_0x32bd('0x12')]()]+_0x32bd('0x1f'));_0x542619[_0x32bd('0x1b')]=_0x542619[_0x32bd('0x1c')];_0x542619[_0x32bd('0x18')]=_0x542619[_0x32bd('0x1d')];_0x40264b(_0x542619);}});};}function createEndUser(_0x31611c,_0x3678c7,_0x4a9b30,_0x5e3add,_0x21940c){logger[_0x32bd('0x11')]('['+[_0x31611c[_0x32bd('0x12')]()]+_0x32bd('0x20'),_0x4a9b30);return new Promise(function(_0x234557,_0x1e474b){var _0x1cce65={'method':_0x32bd('0x21'),'uri':_0x5e3add+'sys_user?'+_0x21940c,'body':{'user_name':_0x4a9b30[_0x32bd('0x22')],'roles':_0x32bd('0x23'),'first_name':_0x4a9b30['endUserNumber'],'active':'true','date_format':'System','phone':_0x4a9b30[_0x32bd('0x22')]},'auth':_0x3678c7,'json':!![]};return rp(_0x1cce65)[_0x32bd('0xd')](function(_0x2999c8){logger['info']('['+[_0x31611c['toUpperCase']()]+_0x32bd('0x24'),_0x2999c8['result']);_0x4a9b30[_0x32bd('0x25')]=_0x2999c8[_0x32bd('0xe')][_0x32bd('0x10')];_0x234557(_0x4a9b30);})['catch'](function(_0x20a4da){logger['error']('['+[_0x31611c[_0x32bd('0x12')]()]+']',_0x20a4da[_0x32bd('0x16')]);_0x1e474b(_0x20a4da[_0x32bd('0x16')]);});});}function getEndUser(_0x469327,_0x57f08c,_0x4f2a76,_0x393510,_0x2bffa7){return function(_0x585e4d){logger[_0x32bd('0x11')]('['+[_0x469327[_0x32bd('0x12')]()]+_0x32bd('0x26'),_0x585e4d);return new Promise(function(_0x5b9186,_0x3ec15b){var _0x414d03={'method':_0x32bd('0xb'),'uri':_0x4f2a76+_0x32bd('0x27')+_0x585e4d[_0x32bd('0x22')]+'&'+_0x393510+'&'+_0x2bffa7,'auth':_0x57f08c,'json':!![]};return rp(_0x414d03)[_0x32bd('0xd')](function(_0x5923f5){if(_0x5923f5[_0x32bd('0xe')][_0x32bd('0xf')]>0x0){_0x585e4d[_0x32bd('0x25')]=_0x5923f5[_0x32bd('0xe')][0x0]['sys_id'];logger[_0x32bd('0x11')]('['+[_0x469327[_0x32bd('0x12')]()]+_0x32bd('0x28'),_0x585e4d);_0x5b9186(_0x585e4d);}else{return createEndUser(_0x469327,_0x57f08c,_0x585e4d,_0x4f2a76,_0x393510)[_0x32bd('0xd')](function(_0x4c518e){logger[_0x32bd('0x11')]('['+[_0x469327[_0x32bd('0x12')]()]+'],\x20createEndUser\x20crm',_0x4c518e);_0x5b9186(_0x4c518e);});}})[_0x32bd('0x14')](function(_0x34f9d7){logger[_0x32bd('0x15')]('['+[_0x469327[_0x32bd('0x12')]()]+']',_0x34f9d7['message']);_0x3ec15b(_0x34f9d7['message']);});});};}function getCustomFields(_0x3d840c,_0xef878b){var _0x3353db={};if(_0x3d840c[_0x32bd('0xf')]>0x0){_[_0x32bd('0x29')](_0x3d840c,function(_0x557537){if(_[_0x32bd('0x2a')]([_0x32bd('0x2b'),'picklist'],_0x557537[_0x32bd('0x2c')])&&_0x557537['nameField']&&!_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537[_0x32bd('0x2e')][_0x32bd('0x2f')]()]=_0x557537['content'][_0x32bd('0x30')]();}else if(_[_0x32bd('0x2a')](['string','picklist'],_0x557537[_0x32bd('0x2c')])&&_0x557537[_0x32bd('0x31')]&&_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537['idField'][_0x32bd('0x2f')]()]=_0x557537['content'][_0x32bd('0x30')]();}else if(_0x557537[_0x32bd('0x2c')]===_0x32bd('0x32')&&_0x557537[_0x32bd('0x33')]&&_0x557537[_0x32bd('0x31')]&&_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537[_0x32bd('0x31')][_0x32bd('0x2f')]()]=_0xef878b[_0x557537[_0x32bd('0x33')]][_0x32bd('0x30')]();}else if(_0x557537['type']===_0x32bd('0x34')&&_0x557537[_0x32bd('0x35')]&&_0x557537[_0x32bd('0x35')][_0x32bd('0x36')]&&_0x557537[_0x32bd('0x31')]&&_0x557537[_0x32bd('0x2d')]){_0x3353db[_0x557537['idField'][_0x32bd('0x2f')]()]=_0xef878b[_0x557537[_0x32bd('0x35')][_0x32bd('0x36')][_0x32bd('0x2f')]()][_0x32bd('0x30')]();}});}return _0x3353db;}function getTicket(_0x59d44a,_0x20701d,_0x27bda7,_0x33a13d,_0x390e14,_0x15f87f){return function(_0x3e8669){logger[_0x32bd('0x11')]('['+[_0x59d44a[_0x32bd('0x12')]()]+']\x20getTicket\x20input\x20crm',_0x3e8669);return new Promise(function(_0x3489d8,_0x1bca6a){var _0x5abd2d=_0x59d44a[_0x32bd('0x2f')]()==='outbound'?_0x3e8669[_0x32bd('0x1b')]:_0x3e8669['endUserId'];var _0x326318={'method':_0x32bd('0x21'),'uri':_0x27bda7+'incident'+'?'+_0x15f87f,'body':Object['assign']({},{'active':_0x32bd('0x1a'),'caller_id':_0x5abd2d,'assigned_to':_0x3e8669['userId'],'short_description':intUtil[_0x32bd('0x37')](_0x33a13d[_0x32bd('0x38')],_0x390e14,'\x20'),'description':intUtil[_0x32bd('0x37')](_0x33a13d[_0x32bd('0x39')],_0x390e14,'\x0a')},getCustomFields(_0x33a13d[_0x32bd('0x3a')],_0x390e14)),'auth':_0x20701d,'json':!![]};return rp(_0x326318)['then'](function(_0x51f74f){logger['info']('['+[_0x59d44a[_0x32bd('0x12')]()]+_0x32bd('0x3b'),_0x51f74f[_0x32bd('0xe')]);_0x3e8669[_0x32bd('0x3c')]=_0x51f74f['result']['sys_id'];_0x3e8669['ticketNumber']=_0x51f74f[_0x32bd('0xe')][_0x32bd('0x3d')];logger[_0x32bd('0x11')]('['+[_0x59d44a[_0x32bd('0x12')]()]+_0x32bd('0x3e'),_0x3e8669);_0x3489d8(_0x3e8669);})['catch'](function(_0x27eaaa){logger[_0x32bd('0x15')]('['+[_0x59d44a[_0x32bd('0x12')]()]+']',_0x27eaaa[_0x32bd('0x16')]);_0x1bca6a(_0x27eaaa[_0x32bd('0x16')]);});});};}function createRemoteTag(_0x214ffb,_0x26830b,_0x339162,_0x328150){return new Promise(function(_0x447436,_0xef76df){var _0x12a07a={'method':_0x32bd('0x21'),'uri':_0x339162+'label'+'?'+_0x328150,'body':{'short_description':_0x214ffb,'global':!![],'active':!![],'name':_0x214ffb},'auth':_0x26830b,'json':!![]};return rp(_0x12a07a)[_0x32bd('0xd')](function(_0x16fb75){var _0x35b457=_0x16fb75[_0x32bd('0xe')]['sys_id'];_0x447436(_0x35b457);});});}function getRemoteTag(_0x73a5b7,_0x4abccb,_0x36eff7,_0x3aee7b,_0x353d71){return new Promise(function(_0x3abd7a,_0x26a032){var _0x85a19f={'method':_0x32bd('0xb'),'uri':_0x36eff7+'label'+_0x32bd('0x3f')+_0x73a5b7+'&'+_0x3aee7b,'auth':_0x4abccb,'json':!![]};return rp(_0x85a19f)['then'](function(_0x11617e){if(_0x11617e['result'][_0x32bd('0xf')]>0x0){var _0x4b208e=_0x11617e[_0x32bd('0xe')][0x0][_0x32bd('0x10')];_0x3abd7a(_0x4b208e);}else{return createRemoteTag(_0x73a5b7,_0x4abccb,_0x36eff7,_0x3aee7b)[_0x32bd('0xd')](function(_0xd04dd1){_0x3abd7a(_0xd04dd1);});}});});}function assignTagToIncident(_0x3525a9,_0x4277d9,_0x2deb6b,_0x187c0a,_0x17ce2c){return new Promise(function(_0x4702f7,_0x116a21){var _0x46271a={'method':'POST','uri':_0x2deb6b+_0x32bd('0x40')+'?'+_0x17ce2c,'body':{'label':_0x3525a9,'table':_0x32bd('0x41'),'id_type':'Incident','table_key':_0x187c0a[_0x32bd('0x3c')],'title':_0x32bd('0x42')+_0x187c0a[_0x32bd('0x43')],'id_display':_0x187c0a[_0x32bd('0x43')]},'auth':_0x4277d9,'json':!![]};return rp(_0x46271a)[_0x32bd('0xd')](function(_0x32a854){_0x4702f7();})[_0x32bd('0x14')](function(){_0x4702f7();});});}function manageTags(_0x311973,_0x32f4c9,_0x2552b9,_0x1fa1c8,_0x5cd2d7,_0x3c1589,_0x2af041){return new Promise(function(_0x2bf2e5,_0x12cfa7){var _0x2ab7ae=[];_0x32f4c9[_0x32bd('0x29')](function(_0x5ef2db){_0x2ab7ae['push'](getRemoteTag(_0x5ef2db,_0x2552b9,_0x1fa1c8,_0x3c1589,_0x2af041));});return Promise['all'](_0x2ab7ae)[_0x32bd('0xd')](function(_0x2c2820){if(_0x2c2820[_0x32bd('0xf')]){logger[_0x32bd('0x11')]('['+[_0x311973['toUpperCase']()]+_0x32bd('0x44'),_0x2c2820);var _0xb735a6=[];_0x2c2820[_0x32bd('0x29')](function(_0x238d3b){_0xb735a6[_0x32bd('0x45')](assignTagToIncident(_0x238d3b,_0x2552b9,_0x1fa1c8,_0x5cd2d7,_0x3c1589));});return Promise[_0x32bd('0x46')](_0xb735a6)[_0x32bd('0xd')](function(){_0x2bf2e5();})[_0x32bd('0x14')](function(){_0x2bf2e5();});}else{_0x2bf2e5();}});});}function getTags(_0x32b485,_0x268d17,_0x47e27e,_0xe32ed3,_0x1c7534,_0x2f1fb2){return function(_0x190a93){return new Promise(function(_0x34da5e,_0x5484cd){var _0xd58e6c=[];var _0x4ad6ac=_0xe32ed3[_0x32bd('0x47')];if(_0x4ad6ac&&_0x4ad6ac['length']>0x0){_0xd58e6c=_[_0x32bd('0x48')](_0x4ad6ac,_0x32bd('0x36'));}if(_0xd58e6c['length']>0x0){return manageTags(_0x32b485,_0xd58e6c,_0x268d17,_0x47e27e,_0x190a93,_0x1c7534,_0x2f1fb2)['then'](function(){_0x34da5e(_0x190a93);});}else{_0x34da5e(_0x190a93);}});};}function emit(_0x504466,_0x388434,_0xfc21ed){var _0x18aefa='%26sysparm_record_target%3Dincident'+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x32bd('0x49')+_0x32bd('0x4a');var _0x32ccfb={'uri':_0x504466+_0x32bd('0x4b')+_0xfc21ed+_0x18aefa};io['to'](util[_0x32bd('0x4c')](_0x32bd('0x4d'),_0x388434))[_0x32bd('0x4e')]('trigger:browser:url',_0x32ccfb);}exports['cs']=function(_0x5bbd42,_0x585b5e,_0x549433,_0x3936d5,_0x187701,_0x4666bc,_0x98a780,_0x73d762){var _0x4bd26e={};var _0x100bec={'user':_0x4666bc['username'],'pass':_0x4666bc['password']};var _0x34ab8a=_0x32bd('0x4f');var _0x4e90a4=_0x32bd('0x50');_0x4666bc[_0x32bd('0x51')]=intUtil[_0x32bd('0x52')](_0x4666bc[_0x32bd('0x51')]);_0x4666bc['serverUrl']=intUtil['stripTrailingSlash'](_0x4666bc['serverUrl']);var _0x1c220c=util[_0x32bd('0x4c')](_0x32bd('0x53'),_0x4666bc['remoteUri']);_0x4bd26e[_0x32bd('0x18')]=!_[_0x32bd('0x54')](_0x3936d5)?_0x3936d5['email']:null;_0x4bd26e[_0x32bd('0x1d')]=_0x4666bc[_0x32bd('0x55')];_0x4bd26e['endUserNumber']=_0x73d762[_0x32bd('0x2f')]()===_0x32bd('0x56')?_0x585b5e[_0x32bd('0x57')]:_0x585b5e['calleridnum'];_0x4bd26e[_0x32bd('0x58')]=_0x73d762==='queue'||_0x73d762===_0x32bd('0x59')?_0x32bd('0x5a'):_0x32bd('0x56');var _0x5a6d6e=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4666bc[_0x32bd('0x5b')],_0x585b5e[_0x32bd('0x5c')],md5(_0x585b5e[_0x32bd('0x5c')]));if(_0x187701&&_0x187701[_0x32bd('0x5d')]){logger[_0x32bd('0x11')](_0x32bd('0x5e'),_0x32bd('0x5f'));_0x585b5e[_0x32bd('0x60')]=_0x5a6d6e;}else if(_0x98a780&&_0x98a780[_0x32bd('0x61')]&&_0x98a780['recordingFormat']!=='none'){logger[_0x32bd('0x11')]('[OUTBOUND]',_0x32bd('0x5f'));_0x585b5e[_0x32bd('0x60')]=_0x5a6d6e;}else{_0x585b5e[_0x32bd('0x60')]='';}return getAdminUser(_0x73d762,_0x100bec,_0x4bd26e,_0x1c220c,_0x4e90a4,_0x34ab8a)[_0x32bd('0xd')](getUser(_0x73d762,_0x100bec,_0x1c220c,_0x4e90a4,_0x34ab8a))[_0x32bd('0xd')](getEndUser(_0x73d762,_0x100bec,_0x1c220c,_0x4e90a4,_0x34ab8a))[_0x32bd('0xd')](getTicket(_0x73d762,_0x100bec,_0x1c220c,_0x549433,_0x585b5e,_0x4e90a4))[_0x32bd('0xd')](function(_0x956560){logger[_0x32bd('0x11')](util[_0x32bd('0x4c')](_0x32bd('0x62'),_0x956560[_0x32bd('0x3c')]));logger[_0x32bd('0x11')](util[_0x32bd('0x4c')](_0x32bd('0x63'),_0x73d762));if(_0x73d762!==_0x32bd('0x59')){logger[_0x32bd('0x11')]('['+[_0x73d762[_0x32bd('0x12')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x4666bc[_0x32bd('0x51')],_0x3936d5[_0x32bd('0x36')],_0x956560[_0x32bd('0x3c')]);}})[_0x32bd('0x14')](function(_0x3aaae5){logger[_0x32bd('0x15')]('['+[_0x73d762[_0x32bd('0x12')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x32bd('0x64')](_0x3aaae5,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7fcd=['./util','../../../../config/environment','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','result','adminId','sys_id','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','info','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','then','length','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','customField','nameField','toLowerCase','content','string','picklist','idField','variable','variableName','toString','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','POST','label_entry','Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','callDirection','unmanaged','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','request-promise','util','md5','ioredis'];(function(_0x5f50eb,_0x3e7d18){var _0xb912b6=function(_0x19d99d){while(--_0x19d99d){_0x5f50eb['push'](_0x5f50eb['shift']());}};_0xb912b6(++_0x3e7d18);}(_0x7fcd,0x1cf));var _0xd7fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7fcd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd7fc('0x0'));var Promise=require('bluebird');var rp=require(_0xd7fc('0x1'));var util=require(_0xd7fc('0x2'));var md5=require(_0xd7fc('0x3'));var Redis=require(_0xd7fc('0x4'));var intUtil=require(_0xd7fc('0x5'));var config=require(_0xd7fc('0x6'));var logger=require('../../../../config/logger')(_0xd7fc('0x7'));config[_0xd7fc('0x8')]=_[_0xd7fc('0x9')](config[_0xd7fc('0x8')],{'host':_0xd7fc('0xa'),'port':0x18eb});var io=require(_0xd7fc('0xb'))(new Redis(config[_0xd7fc('0x8')]));function getAdminUser(_0x4dc742,_0x14ecd4,_0x3c561f,_0x294bf3,_0x17d994,_0x2099b4){return new Promise(function(_0x2b86c3,_0x192d01){var _0x1d76f6={'method':_0xd7fc('0xc'),'uri':_0x294bf3+_0xd7fc('0xd')+'&'+_0x17d994+'&'+_0x2099b4,'auth':_0x14ecd4,'json':!![]};return rp(_0x1d76f6)['then'](function(_0x4e95a9){if(_0x4e95a9[_0xd7fc('0xe')]['length']>0x0){_0x3c561f[_0xd7fc('0xf')]=_0x4e95a9[_0xd7fc('0xe')][0x0][_0xd7fc('0x10')];}logger['info']('['+[_0x4dc742[_0xd7fc('0x11')]()]+_0xd7fc('0x12'),_0x3c561f);_0x2b86c3(_0x3c561f);})[_0xd7fc('0x13')](function(_0x998ab9){logger[_0xd7fc('0x14')]('['+[_0x4dc742[_0xd7fc('0x11')]()]+']',_0x998ab9[_0xd7fc('0x15')]);_0x192d01(_0x998ab9['message']);});});}function getUser(_0x30831e,_0x2a7ea0,_0x3b2527,_0x4f367b,_0x489d91){return function(_0x21391b){logger[_0xd7fc('0x16')]('['+[_0x30831e['toUpperCase']()]+_0xd7fc('0x17'),_0x21391b);return new Promise(function(_0x238fe6,_0x536d34){if(intUtil[_0xd7fc('0x18')](_0x21391b[_0xd7fc('0x19')])){var _0x149b5b={'method':_0xd7fc('0xc'),'uri':_0x3b2527+_0xd7fc('0x1a')+_0x21391b[_0xd7fc('0x19')]+'&'+_0x4f367b+'&'+_0x489d91,'auth':_0x2a7ea0,'json':!![]};logger[_0xd7fc('0x16')]('['+[_0x30831e['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x149b5b);return rp(_0x149b5b)[_0xd7fc('0x1b')](function(_0x24bcaa){logger['info']('['+[_0x30831e[_0xd7fc('0x11')]()]+'],\x20getUser\x20entity',_0x24bcaa);if(_0x24bcaa[_0xd7fc('0xe')][_0xd7fc('0x1c')]>0x0&&String(_0x24bcaa[_0xd7fc('0xe')][0x0]['active'])===_0xd7fc('0x1d')){_0x21391b[_0xd7fc('0x1e')]=_0x24bcaa[_0xd7fc('0xe')][0x0]['sys_id'];}else{_0x21391b['userId']=_0x21391b[_0xd7fc('0xf')];_0x21391b[_0xd7fc('0x19')]=_0x21391b[_0xd7fc('0x1f')];}logger[_0xd7fc('0x16')]('['+[_0x30831e['toUpperCase']()]+_0xd7fc('0x20'),_0x21391b);_0x238fe6(_0x21391b);})[_0xd7fc('0x13')](function(_0x1811bc){logger[_0xd7fc('0x14')]('['+[_0x30831e[_0xd7fc('0x11')]()]+']',_0x1811bc['message']);_0x536d34(_0x1811bc['message']);});}else{logger['info']('['+[_0x30831e['toUpperCase']()]+_0xd7fc('0x21'));_0x21391b[_0xd7fc('0x1e')]=_0x21391b[_0xd7fc('0xf')];_0x21391b[_0xd7fc('0x19')]=_0x21391b[_0xd7fc('0x1f')];_0x238fe6(_0x21391b);}});};}function createEndUser(_0x216647,_0x55f9ed,_0x46afb1,_0x1d3a8b,_0x2398ce){logger[_0xd7fc('0x16')]('['+[_0x216647['toUpperCase']()]+_0xd7fc('0x22'),_0x46afb1);return new Promise(function(_0x8a521b,_0x478129){var _0x181d13={'method':'POST','uri':_0x1d3a8b+_0xd7fc('0x23')+_0x2398ce,'body':{'user_name':_0x46afb1[_0xd7fc('0x24')],'roles':_0xd7fc('0x25'),'first_name':_0x46afb1[_0xd7fc('0x24')],'active':_0xd7fc('0x1d'),'date_format':_0xd7fc('0x26'),'phone':_0x46afb1[_0xd7fc('0x24')]},'auth':_0x55f9ed,'json':!![]};return rp(_0x181d13)['then'](function(_0x20225c){logger[_0xd7fc('0x16')]('['+[_0x216647[_0xd7fc('0x11')]()]+_0xd7fc('0x27'),_0x20225c['result']);_0x46afb1[_0xd7fc('0x28')]=_0x20225c[_0xd7fc('0xe')][_0xd7fc('0x10')];_0x8a521b(_0x46afb1);})[_0xd7fc('0x13')](function(_0x165264){logger['error']('['+[_0x216647['toUpperCase']()]+']',_0x165264['message']);_0x478129(_0x165264[_0xd7fc('0x15')]);});});}function getEndUser(_0x9e7f16,_0x234bbd,_0xc417e3,_0x47817e,_0x18a039){return function(_0x3daef8){logger['info']('['+[_0x9e7f16[_0xd7fc('0x11')]()]+_0xd7fc('0x29'),_0x3daef8);return new Promise(function(_0x19cf6b,_0x90ca8e){var _0x573181={'method':_0xd7fc('0xc'),'uri':_0xc417e3+_0xd7fc('0x2a')+_0x3daef8[_0xd7fc('0x24')]+'&'+_0x47817e+'&'+_0x18a039,'auth':_0x234bbd,'json':!![]};return rp(_0x573181)['then'](function(_0x274ef1){if(_0x274ef1[_0xd7fc('0xe')][_0xd7fc('0x1c')]>0x0){_0x3daef8[_0xd7fc('0x28')]=_0x274ef1[_0xd7fc('0xe')][0x0][_0xd7fc('0x10')];logger['info']('['+[_0x9e7f16[_0xd7fc('0x11')]()]+_0xd7fc('0x2b'),_0x3daef8);_0x19cf6b(_0x3daef8);}else{return createEndUser(_0x9e7f16,_0x234bbd,_0x3daef8,_0xc417e3,_0x47817e)[_0xd7fc('0x1b')](function(_0x3c877f){logger[_0xd7fc('0x16')]('['+[_0x9e7f16['toUpperCase']()]+_0xd7fc('0x2c'),_0x3c877f);_0x19cf6b(_0x3c877f);});}})[_0xd7fc('0x13')](function(_0x22fc63){logger[_0xd7fc('0x14')]('['+[_0x9e7f16[_0xd7fc('0x11')]()]+']',_0x22fc63[_0xd7fc('0x15')]);_0x90ca8e(_0x22fc63[_0xd7fc('0x15')]);});});};}function getCustomFields(_0x11aa6e,_0x4c961d){var _0x281f2f={};if(_0x11aa6e[_0xd7fc('0x1c')]>0x0){_[_0xd7fc('0x2d')](_0x11aa6e,function(_0x5768c9){if(_['includes'](['string','picklist'],_0x5768c9[_0xd7fc('0x2e')])&&_0x5768c9['nameField']&&!_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9[_0xd7fc('0x30')][_0xd7fc('0x31')]()]=_0x5768c9[_0xd7fc('0x32')]['toString']();}else if(_['includes']([_0xd7fc('0x33'),_0xd7fc('0x34')],_0x5768c9['type'])&&_0x5768c9[_0xd7fc('0x35')]&&_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9['idField'][_0xd7fc('0x31')]()]=_0x5768c9[_0xd7fc('0x32')]['toString']();}else if(_0x5768c9['type']===_0xd7fc('0x36')&&_0x5768c9[_0xd7fc('0x37')]&&_0x5768c9['idField']&&_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9[_0xd7fc('0x35')][_0xd7fc('0x31')]()]=_0x4c961d[_0x5768c9['variableName']][_0xd7fc('0x38')]();}else if(_0x5768c9[_0xd7fc('0x2e')]===_0xd7fc('0x39')&&_0x5768c9[_0xd7fc('0x3a')]&&_0x5768c9['Variable'][_0xd7fc('0x3b')]&&_0x5768c9[_0xd7fc('0x35')]&&_0x5768c9[_0xd7fc('0x2f')]){_0x281f2f[_0x5768c9[_0xd7fc('0x35')][_0xd7fc('0x31')]()]=_0x4c961d[_0x5768c9[_0xd7fc('0x3a')][_0xd7fc('0x3b')][_0xd7fc('0x31')]()][_0xd7fc('0x38')]();}});}return _0x281f2f;}function getTicket(_0x4e63c5,_0x325118,_0x47c790,_0x522172,_0xd696f0,_0x55ae5c){return function(_0x3a2a0c){logger[_0xd7fc('0x16')]('['+[_0x4e63c5[_0xd7fc('0x11')]()]+_0xd7fc('0x3c'),_0x3a2a0c);return new Promise(function(_0x2089a1,_0x4a5bef){var _0x1961cd=_0x4e63c5['toLowerCase']()===_0xd7fc('0x3d')?_0x3a2a0c[_0xd7fc('0x1e')]:_0x3a2a0c[_0xd7fc('0x28')];var _0xb29c26={'method':'POST','uri':_0x47c790+_0xd7fc('0x3e')+'?'+_0x55ae5c,'body':Object[_0xd7fc('0x3f')]({},{'active':_0xd7fc('0x1d'),'caller_id':_0x1961cd,'assigned_to':_0x3a2a0c[_0xd7fc('0x1e')],'short_description':intUtil[_0xd7fc('0x40')](_0x522172[_0xd7fc('0x41')],_0xd696f0,'\x20'),'description':intUtil[_0xd7fc('0x40')](_0x522172[_0xd7fc('0x42')],_0xd696f0,'\x0a')},getCustomFields(_0x522172[_0xd7fc('0x43')],_0xd696f0)),'auth':_0x325118,'json':!![]};return rp(_0xb29c26)[_0xd7fc('0x1b')](function(_0x10e81d){logger['info']('['+[_0x4e63c5[_0xd7fc('0x11')]()]+_0xd7fc('0x44'),_0x10e81d[_0xd7fc('0xe')]);_0x3a2a0c[_0xd7fc('0x45')]=_0x10e81d[_0xd7fc('0xe')][_0xd7fc('0x10')];_0x3a2a0c[_0xd7fc('0x46')]=_0x10e81d['result'][_0xd7fc('0x47')];logger[_0xd7fc('0x16')]('['+[_0x4e63c5[_0xd7fc('0x11')]()]+_0xd7fc('0x48'),_0x3a2a0c);_0x2089a1(_0x3a2a0c);})[_0xd7fc('0x13')](function(_0xa5fdfa){logger['error']('['+[_0x4e63c5['toUpperCase']()]+']',_0xa5fdfa[_0xd7fc('0x15')]);_0x4a5bef(_0xa5fdfa[_0xd7fc('0x15')]);});});};}function createRemoteTag(_0x3b6888,_0x2e5ca8,_0x1f8fad,_0x541d9e){return new Promise(function(_0x49e4da,_0x1c3f46){var _0x58a02d={'method':'POST','uri':_0x1f8fad+_0xd7fc('0x49')+'?'+_0x541d9e,'body':{'short_description':_0x3b6888,'global':!![],'active':!![],'name':_0x3b6888},'auth':_0x2e5ca8,'json':!![]};return rp(_0x58a02d)[_0xd7fc('0x1b')](function(_0xaec5da){var _0x59c556=_0xaec5da[_0xd7fc('0xe')][_0xd7fc('0x10')];_0x49e4da(_0x59c556);});});}function getRemoteTag(_0x5060a1,_0x6d561d,_0x6f0902,_0x33d2ce,_0x9d7bed){return new Promise(function(_0x501a57,_0x52750c){var _0x36740c={'method':'GET','uri':_0x6f0902+_0xd7fc('0x49')+'?sysparm_query=name%3D'+_0x5060a1+'&'+_0x33d2ce,'auth':_0x6d561d,'json':!![]};return rp(_0x36740c)[_0xd7fc('0x1b')](function(_0x1b6149){if(_0x1b6149[_0xd7fc('0xe')][_0xd7fc('0x1c')]>0x0){var _0x204f7=_0x1b6149[_0xd7fc('0xe')][0x0][_0xd7fc('0x10')];_0x501a57(_0x204f7);}else{return createRemoteTag(_0x5060a1,_0x6d561d,_0x6f0902,_0x33d2ce)['then'](function(_0x49242e){_0x501a57(_0x49242e);});}});});}function assignTagToIncident(_0x15e0d5,_0x5002ae,_0x161fee,_0x2eb125,_0x240f48){return new Promise(function(_0x46a158,_0x230ed5){var _0x52415f={'method':_0xd7fc('0x4a'),'uri':_0x161fee+_0xd7fc('0x4b')+'?'+_0x240f48,'body':{'label':_0x15e0d5,'table':'incident','id_type':_0xd7fc('0x4c'),'table_key':_0x2eb125[_0xd7fc('0x45')],'title':_0xd7fc('0x4d')+_0x2eb125[_0xd7fc('0x46')],'id_display':_0x2eb125[_0xd7fc('0x46')]},'auth':_0x5002ae,'json':!![]};return rp(_0x52415f)[_0xd7fc('0x1b')](function(_0x39b189){_0x46a158();})[_0xd7fc('0x13')](function(){_0x46a158();});});}function manageTags(_0x6e91fd,_0x35eec0,_0x1c2c7c,_0x234a57,_0x5e881d,_0x42326c,_0x30ab20){return new Promise(function(_0x4fac6d,_0x536125){var _0x5ece95=[];_0x35eec0['forEach'](function(_0x5e5603){_0x5ece95[_0xd7fc('0x4e')](getRemoteTag(_0x5e5603,_0x1c2c7c,_0x234a57,_0x42326c,_0x30ab20));});return Promise[_0xd7fc('0x4f')](_0x5ece95)['then'](function(_0x41f828){if(_0x41f828['length']){logger['info']('['+[_0x6e91fd[_0xd7fc('0x11')]()]+_0xd7fc('0x50'),_0x41f828);var _0x2a1fc4=[];_0x41f828[_0xd7fc('0x2d')](function(_0x307d83){_0x2a1fc4[_0xd7fc('0x4e')](assignTagToIncident(_0x307d83,_0x1c2c7c,_0x234a57,_0x5e881d,_0x42326c));});return Promise['all'](_0x2a1fc4)[_0xd7fc('0x1b')](function(){_0x4fac6d();})[_0xd7fc('0x13')](function(){_0x4fac6d();});}else{_0x4fac6d();}});});}function getTags(_0x1b2272,_0x41c3d7,_0x5abaff,_0x227b02,_0x353e53,_0x593fd5){return function(_0x2f9df5){return new Promise(function(_0x40c6c9,_0x59906c){var _0x4a7a65=[];var _0x37ee42=_0x227b02[_0xd7fc('0x51')];if(_0x37ee42&&_0x37ee42['length']>0x0){_0x4a7a65=_[_0xd7fc('0x52')](_0x37ee42,_0xd7fc('0x3b'));}if(_0x4a7a65[_0xd7fc('0x1c')]>0x0){return manageTags(_0x1b2272,_0x4a7a65,_0x41c3d7,_0x5abaff,_0x2f9df5,_0x353e53,_0x593fd5)['then'](function(){_0x40c6c9(_0x2f9df5);});}else{_0x40c6c9(_0x2f9df5);}});};}function emit(_0x1b1b64,_0x3dda01,_0x27552e){var _0x4f3207=_0xd7fc('0x53')+_0xd7fc('0x54')+'%26sysparm_record_list%3Dactive%253Dtrue'+_0xd7fc('0x55');var _0x2d987b={'uri':_0x1b1b64+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x27552e+_0x4f3207};io['to'](util[_0xd7fc('0x56')](_0xd7fc('0x57'),_0x3dda01))[_0xd7fc('0x58')](_0xd7fc('0x59'),_0x2d987b);}exports['cs']=function(_0x37ba9e,_0x599529,_0x348dd5,_0x29652b,_0x2a47c1,_0x306104,_0x3b3ecd,_0x3a025f){var _0x2240a6={};var _0x54d933={'user':_0x306104[_0xd7fc('0x5a')],'pass':_0x306104[_0xd7fc('0x5b')]};var _0x26a7cb=_0xd7fc('0x5c');var _0x30e921=_0xd7fc('0x5d');_0x306104['remoteUri']=intUtil[_0xd7fc('0x5e')](_0x306104[_0xd7fc('0x5f')]);_0x306104[_0xd7fc('0x60')]=intUtil['stripTrailingSlash'](_0x306104['serverUrl']);var _0x232353=util[_0xd7fc('0x56')](_0xd7fc('0x61'),_0x306104[_0xd7fc('0x5f')]);_0x2240a6[_0xd7fc('0x19')]=!_[_0xd7fc('0x62')](_0x29652b)?_0x29652b[_0xd7fc('0x63')]:null;_0x2240a6['adminEmail']=_0x306104[_0xd7fc('0x63')];_0x2240a6[_0xd7fc('0x24')]=_0x3a025f['toLowerCase']()===_0xd7fc('0x3d')?_0x599529[_0xd7fc('0x64')]:_0x599529['calleridnum'];_0x2240a6[_0xd7fc('0x65')]=_0x3a025f==='queue'||_0x3a025f===_0xd7fc('0x66')?_0xd7fc('0x67'):_0xd7fc('0x3d');var _0x5830e2=util['format'](_0xd7fc('0x68'),_0x306104[_0xd7fc('0x60')],_0x599529[_0xd7fc('0x69')],md5(_0x599529['uniqueid']));if(_0x2a47c1&&_0x2a47c1[_0xd7fc('0x6a')]){logger[_0xd7fc('0x16')](_0xd7fc('0x6b'),_0xd7fc('0x6c'));_0x599529[_0xd7fc('0x6d')]=_0x5830e2;}else if(_0x3b3ecd&&_0x3b3ecd[_0xd7fc('0x6e')]&&_0x3b3ecd['recordingFormat']!==_0xd7fc('0x6f')){logger['info'](_0xd7fc('0x70'),_0xd7fc('0x6c'));_0x599529['recordingURL']=_0x5830e2;}else{_0x599529[_0xd7fc('0x6d')]='';}return getAdminUser(_0x3a025f,_0x54d933,_0x2240a6,_0x232353,_0x30e921,_0x26a7cb)[_0xd7fc('0x1b')](getUser(_0x3a025f,_0x54d933,_0x232353,_0x30e921,_0x26a7cb))['then'](getEndUser(_0x3a025f,_0x54d933,_0x232353,_0x30e921,_0x26a7cb))[_0xd7fc('0x1b')](getTicket(_0x3a025f,_0x54d933,_0x232353,_0x348dd5,_0x599529,_0x30e921))[_0xd7fc('0x1b')](function(_0x4a1a6d){logger[_0xd7fc('0x16')](util[_0xd7fc('0x56')]('The\x20ticket\x20ID\x20is:\x20%s',_0x4a1a6d[_0xd7fc('0x45')]));logger[_0xd7fc('0x16')](util[_0xd7fc('0x56')](_0xd7fc('0x71'),_0x3a025f));if(_0x3a025f!==_0xd7fc('0x66')){logger[_0xd7fc('0x16')]('['+[_0x3a025f[_0xd7fc('0x11')]()]+']',_0xd7fc('0x72'));emit(_0x306104[_0xd7fc('0x5f')],_0x29652b[_0xd7fc('0x3b')],_0x4a1a6d['ticketId']);}})[_0xd7fc('0x13')](function(_0xbf6afa){logger[_0xd7fc('0x14')]('['+[_0x3a025f[_0xd7fc('0x11')]()]+_0xd7fc('0x73'),util[_0xd7fc('0x74')](_0xbf6afa,{'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 9c42415..95cbb88 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 _0xf219=['%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','unmanaged','uri','lastevent','toUpperCase','lodash','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','defaults','redis','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','Subjects','getString','toISOString','replace','duration_hours','duration_minutes','Contacts','name','length','forEach','variableName','idField','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','user_name','then','entry_list','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','find','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','type','string','nameField','push','content','variable','customField','custom_fields','Variable','toLowerCase','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','catch','error','outbound','recordingFormat','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','charAt'];(function(_0x9f9ed5,_0x56f438){var _0xbc71e3=function(_0x1de828){while(--_0x1de828){_0x9f9ed5['push'](_0x9f9ed5['shift']());}};_0xbc71e3(++_0x56f438);}(_0xf219,0x171));var _0x9f21=function(_0x36bbbb,_0x3f6709){_0x36bbbb=_0x36bbbb-0x0;var _0x3ca0eb=_0xf219[_0x36bbbb];return _0x3ca0eb;};'use strict';var _=require(_0x9f21('0x0'));var rp=require(_0x9f21('0x1'));var BPromise=require(_0x9f21('0x2'));var md5=require(_0x9f21('0x3'));var util=require(_0x9f21('0x4'));var Redis=require(_0x9f21('0x5'));var intUtil=require('./util');var config=require(_0x9f21('0x6'));var logger=require(_0x9f21('0x7'))(_0x9f21('0x8'));config['redis']=_[_0x9f21('0x9')](config[_0x9f21('0xa')],{'host':_0x9f21('0xb'),'port':0x18eb});var io=require(_0x9f21('0xc'))(new Redis(config[_0x9f21('0xa')]));var def={'method':'POST','json':!![]};function emit(_0x4f7610,_0x1b8262,_0xa9683){io['to'](_0x4f7610)[_0x9f21('0xd')](_0x1b8262,_0xa9683);}function getTicket(_0xf50977,_0x394e49,_0xe637a1,_0x113b0f,_0xd9e129,_0xb54d04,_0x227687,_0x1a28cc){logger[_0x9f21('0xe')](_0x9f21('0xf'));var _0x4b22b2=new Date();var _0x3313e2=[{'name':'name','value':intUtil['getString'](_0x113b0f[_0x9f21('0x10')],_0xd9e129,'\x20')},{'name':'assigned_user_id','value':_0x394e49['id']},{'name':'created_by','value':_0x394e49['id']},{'name':'description','value':intUtil[_0x9f21('0x11')](_0x113b0f['Descriptions'],_0xd9e129,'\x0a')},{'name':'date_start','value':_0x4b22b2[_0x9f21('0x12')]()['slice'](0x0,0x13)[_0x9f21('0x13')]('T','\x20')},{'name':_0x9f21('0x14'),'value':'0'},{'name':_0x9f21('0x15'),'value':'15'},{'name':'parent_id','value':_0xe637a1['id']},{'name':'parent_type','value':_0x9f21('0x16')},{'name':'parent_name','value':_0xe637a1[_0x9f21('0x17')]},{'name':'direction','value':_0x1a28cc}];if(_0xb54d04[_0x9f21('0x18')]){_[_0x9f21('0x19')](_0xb54d04,function(_0x164faf){if(_0xd9e129[_0x164faf[_0x9f21('0x1a')]]){_0x3313e2['push']({'name':_0x164faf[_0x9f21('0x1b')],'value':_0xd9e129[_0x164faf['variableName']]});}});}return request({'form':{'method':_0x9f21('0x1c'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x227687['id'],'module_name':_0x9f21('0x1f'),'name_value_list':_0x3313e2})}});}function getAuth(_0x4c1a96){return util[_0x9f21('0x20')]('Basic\x20%s',new Buffer(_0x4c1a96[_0x9f21('0x21')]+':X')[_0x9f21('0x22')](_0x9f21('0x23')));}function getServerInfo(_0x506b0e){return request({'form':{'method':_0x9f21('0x24'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f21('0x1e')]({'session':_0x506b0e['id']})}});}function getUser(_0x4c8f42,_0x53e0b5,_0x55344e){if(!_['isNil'](_0x53e0b5)){logger[_0x9f21('0xe')](_0x9f21('0x25'),_0x53e0b5);return request({'form':{'method':_0x9f21('0x26'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x55344e['id'],'module_name':_0x9f21('0x27'),'query':util[_0x9f21('0x20')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x53e0b5),'order_by':'','offset':'0','select_fields':['id',_0x9f21('0x17'),_0x9f21('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f21('0x29')](function(_0xb023ad){if(_0xb023ad[_0x9f21('0x2a')][_0x9f21('0x18')]){var _0x496db9=_['find'](_0xb023ad[_0x9f21('0x2a')],function(_0x47fe4d){return _0x47fe4d[_0x9f21('0x2b')][_0x9f21('0x28')][_0x9f21('0x2c')]===_0x53e0b5;});if(_0x496db9){logger['info'](_0x9f21('0x2d'));return BPromise[_0x9f21('0x2e')]({'id':_0x496db9[_0x9f21('0x2b')]['id'][_0x9f21('0x2c')],'name':_0x496db9[_0x9f21('0x2b')][_0x9f21('0x17')][_0x9f21('0x2c')]});}}logger[_0x9f21('0xe')](_0x9f21('0x2f'));return BPromise[_0x9f21('0x2e')]({'id':_0x55344e[_0x9f21('0x2b')][_0x9f21('0x30')][_0x9f21('0x2c')],'name':_0x55344e['name_value_list'][_0x9f21('0x28')]['value']});});}else{logger[_0x9f21('0xe')](_0x9f21('0x31'));return BPromise[_0x9f21('0x2e')]({'id':_0x55344e[_0x9f21('0x2b')]['user_id']['value'],'name':_0x55344e['name_value_list'][_0x9f21('0x28')][_0x9f21('0x2c')]});}}function getEndUser(_0x37765f,_0x5f127d,_0x2430e8,_0x1f78f5){logger[_0x9f21('0xe')](_0x9f21('0x32'),_0x2430e8);return request({'form':{'method':_0x9f21('0x26'),'input_type':_0x9f21('0x1d'),'response_type':_0x9f21('0x1d'),'rest_data':JSON['stringify']({'session':_0x1f78f5['id'],'module_name':_0x9f21('0x16'),'query':util[_0x9f21('0x20')](_0x9f21('0x33'),_0x2430e8),'order_by':'','offset':'0','select_fields':['id',_0x9f21('0x17'),_0x9f21('0x34')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x9f21('0x29')](function(_0x1dd06c){if(_0x1dd06c[_0x9f21('0x2a')]['length']){var _0x4c1d07=_[_0x9f21('0x35')](_0x1dd06c[_0x9f21('0x2a')],function(_0x1e813a){return _0x1e813a[_0x9f21('0x2b')]['phone_home'][_0x9f21('0x2c')]===_0x2430e8;});if(_0x4c1d07){logger[_0x9f21('0xe')](_0x9f21('0x36'));return BPromise[_0x9f21('0x2e')]({'id':_0x4c1d07[_0x9f21('0x2b')]['id'][_0x9f21('0x2c')],'name':_0x4c1d07[_0x9f21('0x2b')][_0x9f21('0x17')][_0x9f21('0x2c')],'phone':_0x4c1d07[_0x9f21('0x2b')][_0x9f21('0x34')][_0x9f21('0x2c')]});}}else{logger[_0x9f21('0xe')](_0x9f21('0x37'));return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x9f21('0x1e')]({'session':_0x1f78f5['id'],'module_name':'Contacts','name_value_list':[{'name':_0x9f21('0x38'),'value':_0x5f127d!==_0x9f21('0x39')?_0x5f127d:util['format'](_0x9f21('0x3a'),_0x2430e8)},{'name':_0x9f21('0x34'),'value':_0x2430e8}]})}})[_0x9f21('0x29')](function(_0x354c97){logger[_0x9f21('0xe')](_0x9f21('0x3b'));return BPromise[_0x9f21('0x2e')]({'id':_0x354c97['id'],'name':_0x354c97[_0x9f21('0x2a')][_0x9f21('0x38')]['value'],'phone':_0x354c97['entry_list'][_0x9f21('0x34')][_0x9f21('0x2c')]});});}});}function request(_0x4e2fb1){logger[_0x9f21('0x3c')](_0x9f21('0x3d'),JSON[_0x9f21('0x1e')](_0x4e2fb1));return rp(_[_0x9f21('0x3e')](def,_0x4e2fb1));}function getTags(_0x4f36f3,_0x5b4198){var _0x4b12b2=[];if(_0x4f36f3&&_0x4f36f3[_0x9f21('0x18')]>0x0){_0x4b12b2=_[_0x9f21('0x3f')](_0x4f36f3,_0x5b4198);}return _0x4b12b2;}function getCustomFields(_0x236f1a,_0x29fdf3){var _0x25805d=[];var _0x4eddfc={'custom_fields':[]};if(_0x236f1a[_0x9f21('0x18')]>0x0){_['forEach'](_0x236f1a,function(_0x38ac68){if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x41')&&_0x38ac68[_0x9f21('0x42')]&&!_0x38ac68['customField']){_0x4eddfc[_0x38ac68[_0x9f21('0x42')]['toLowerCase']()]=_0x38ac68['content'][_0x9f21('0x22')]();}else if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x41')&&_0x38ac68['idField']&&_0x38ac68['customField']){_0x4eddfc['custom_fields'][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x38ac68[_0x9f21('0x44')][_0x9f21('0x22')]()});}else if(_0x38ac68[_0x9f21('0x40')]===_0x9f21('0x45')&&_0x38ac68[_0x9f21('0x1a')]&&_0x38ac68['idField']&&_0x38ac68[_0x9f21('0x46')]){_0x29fdf3[_0x38ac68[_0x9f21('0x1a')]]&&_0x4eddfc[_0x9f21('0x47')][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x29fdf3[_0x38ac68['variableName']][_0x9f21('0x22')]()});}else if(_0x38ac68[_0x9f21('0x40')]==='customVariable'&&_0x38ac68[_0x9f21('0x48')]&&_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')]&&_0x38ac68[_0x9f21('0x1b')]&&_0x38ac68['customField']){_0x29fdf3[_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')][_0x9f21('0x49')]()]&&_0x4eddfc['custom_fields'][_0x9f21('0x43')]({'id':_0x38ac68[_0x9f21('0x1b')],'value':_0x29fdf3[_0x38ac68[_0x9f21('0x48')][_0x9f21('0x17')][_0x9f21('0x49')]()]['toString']()});}});}return _0x4eddfc;}function getConnection(_0x205b62){return request({'method':_0x9f21('0x4a'),'form':{'method':_0x9f21('0x4b'),'input_type':_0x9f21('0x1d'),'response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'user_auth':{'user_name':_0x205b62[_0x9f21('0x4c')],'password':_0x205b62[_0x9f21('0x4d')],'encryption':_0x9f21('0x4e')},'application':_0x9f21('0x4f')})}})[_0x9f21('0x29')](function(_0x4ec90e){var _0x2c82a9=_0x4ec90e;if(_0x2c82a9['id']){def[_0x9f21('0x50')]=_0x2c82a9['id'];return BPromise[_0x9f21('0x2e')](_0x2c82a9);}else{throw new Error(util[_0x9f21('0x20')]('Account\x20%d\x20is\x20not\x20valid',_0x205b62['id']));}});}function setRelationship(_0x260aef,_0x15ce1a,_0x19f7ba,_0x23ed68){return request({'form':{'method':_0x9f21('0x51'),'input_type':'JSON','response_type':_0x9f21('0x1d'),'rest_data':JSON[_0x9f21('0x1e')]({'session':_0x260aef['id'],'module_name':_0x9f21('0x1f'),'module_id':_0x19f7ba['id'],'link_field_name':_0x23ed68,'related_ids':[_0x15ce1a['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x9f21('0x52')]=function(_0x411800,_0x19165e,_0x37d088,_0x49feac,_0x14c6ec,_0x222c88){var _0xba34cd,_0x35ba71,_0xd84602,_0x34b483;_0x222c88[_0x9f21('0x53')]=intUtil[_0x9f21('0x54')](_0x222c88[_0x9f21('0x53')]);_0x222c88[_0x9f21('0x55')]=intUtil[_0x9f21('0x54')](_0x222c88['serverUrl']);def['uri']=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x222c88['remoteUri']);if(_0x14c6ec&&_0x14c6ec[_0x9f21('0x57')]){logger[_0x9f21('0xe')](_0x9f21('0x58'),'Recording\x20is\x20enabled!');_0x19165e[_0x9f21('0x59')]=util['format'](_0x9f21('0x5a'),_0x222c88[_0x9f21('0x55')],_0x19165e[_0x9f21('0x5b')],md5(_0x19165e[_0x9f21('0x5b')]));}else{_0x19165e[_0x9f21('0x59')]='';}return getConnection(_0x222c88)['then'](function(_0x15ea57){_0x34b483=_0x15ea57;return getUser(_0x222c88,_0x49feac[_0x9f21('0x17')],_0x34b483);})[_0x9f21('0x29')](function(_0x4edc0b){_0xba34cd=_0x4edc0b;logger[_0x9f21('0xe')]('The\x20User\x20ID\x20is:',_0xba34cd['id']);return getEndUser(_0x222c88,_0x19165e[_0x9f21('0x5c')],_0x19165e[_0x9f21('0x5d')],_0x34b483);})[_0x9f21('0x29')](function(_0x4e383d){_0x35ba71=_0x4e383d;logger[_0x9f21('0xe')](_0x9f21('0x5e'),_0x35ba71['id']);return getTicket(_0x222c88,_0xba34cd,_0x35ba71,_0x37d088,_0x19165e,_0x37d088['Fields'],_0x34b483,_0x9f21('0x5f'));})[_0x9f21('0x29')](function(_0x4a0116){_0xd84602=_0x4a0116;logger[_0x9f21('0xe')](_0x9f21('0x60'));logger['info'](_0x9f21('0x61'),_0xd84602['id']);return setRelationship(_0x34b483,_0xba34cd,_0xd84602,_0x9f21('0x62'));})[_0x9f21('0x29')](function(){return setRelationship(_0x34b483,_0x35ba71,_0xd84602,_0x9f21('0x63'));})['then'](function(){return getServerInfo(_0x34b483);})['then'](function(_0xcbe297){var _0x148729=parseInt(_0xcbe297[_0x9f21('0x64')]['charAt'](0x0));var _0xd802c2=util[_0x9f21('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x222c88[_0x9f21('0x53')],_0xd84602['id']);if(_0x148729>0x6){_0xd802c2=util[_0x9f21('0x20')](_0x9f21('0x65'),_0x222c88[_0x9f21('0x53')],_0xd84602['id']);}logger[_0x9f21('0xe')](_0x9f21('0x58'),_0x9f21('0x66'));emit(util[_0x9f21('0x20')](_0x9f21('0x67'),_0x49feac[_0x9f21('0x17')]),_0x9f21('0x68'),{'uri':_0xd802c2});})[_0x9f21('0x69')](function(_0x4ceae1){logger[_0x9f21('0x6a')](_0x9f21('0x58'),JSON[_0x9f21('0x1e')](_0x4ceae1));});};exports[_0x9f21('0x6b')]=function(_0x229a31,_0x5aa435,_0x1c13cd,_0x1da687,_0x3d65b7,_0x18db16,_0x32b0f5){var _0x5bf96d,_0x2214cb,_0x3777fc,_0xcd8d01;_0x18db16[_0x9f21('0x53')]=intUtil[_0x9f21('0x54')](_0x18db16[_0x9f21('0x53')]);_0x18db16[_0x9f21('0x55')]=intUtil['stripTrailingSlash'](_0x18db16['serverUrl']);def['uri']=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x18db16[_0x9f21('0x53')]);if(_0x32b0f5&&_0x32b0f5['recordingFormat']&&_0x32b0f5[_0x9f21('0x6c')]!=='none'){logger[_0x9f21('0xe')]('[OUTBOUND]',_0x9f21('0x6d'));_0x5aa435['recordingURL']=util['format'](_0x9f21('0x5a'),_0x18db16[_0x9f21('0x55')],_0x5aa435[_0x9f21('0x5b')],md5(_0x5aa435['uniqueid']));}return getConnection(_0x18db16)[_0x9f21('0x29')](function(_0x4a1b39){_0xcd8d01=_0x4a1b39;return getUser(_0x18db16,_0x1da687[_0x9f21('0x17')],_0xcd8d01);})[_0x9f21('0x29')](function(_0x1b8d0f){_0x5bf96d=_0x1b8d0f;logger[_0x9f21('0xe')](_0x9f21('0x6e'),_0x5bf96d['id']);return getEndUser(_0x18db16,_0x5aa435[_0x9f21('0x6f')],_0x5aa435[_0x9f21('0x70')],_0xcd8d01);})['then'](function(_0x5bad7d){_0x2214cb=_0x5bad7d;logger['info'](_0x9f21('0x5e'),_0x2214cb['id']);return getTicket(_0x18db16,_0x5bf96d,_0x2214cb,_0x1c13cd,_0x5aa435,_0x1c13cd[_0x9f21('0x71')],_0xcd8d01,'Outbound');})[_0x9f21('0x29')](function(_0x19c1ae){_0x3777fc=_0x19c1ae;logger['info'](_0x9f21('0x60'));logger['info'](_0x9f21('0x61'),_0x3777fc['id']);return setRelationship(_0xcd8d01,_0x5bf96d,_0x3777fc,'users');})['then'](function(){return setRelationship(_0xcd8d01,_0x2214cb,_0x3777fc,_0x9f21('0x63'));})[_0x9f21('0x29')](function(){return getServerInfo(_0xcd8d01);})[_0x9f21('0x29')](function(_0x3d53d6){var _0x1c59c0=parseInt(_0x3d53d6[_0x9f21('0x64')][_0x9f21('0x72')](0x0));var _0x55f3c5=util[_0x9f21('0x20')](_0x9f21('0x73'),_0x18db16[_0x9f21('0x53')],_0x3777fc['id']);if(_0x1c59c0>0x6){_0x55f3c5=util[_0x9f21('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x18db16['remoteUri'],_0x3777fc['id']);}logger[_0x9f21('0xe')](_0x9f21('0x74'),_0x9f21('0x66'));emit(util['format'](_0x9f21('0x67'),_0x1da687[_0x9f21('0x17')]),_0x9f21('0x68'),{'uri':_0x55f3c5});})[_0x9f21('0x69')](function(_0x24a86a){logger[_0x9f21('0x6a')](_0x9f21('0x74'),JSON['stringify'](_0x24a86a));});};exports[_0x9f21('0x75')]=function(_0x4c395f,_0x348f1f,_0x9a01a1,_0x1b42ee,_0x20be9a,_0x43e350){var _0x20fe75,_0x4a0c21,_0x16b748,_0x106837;_0x43e350['remoteUri']=intUtil[_0x9f21('0x54')](_0x43e350[_0x9f21('0x53')]);_0x43e350[_0x9f21('0x55')]=intUtil[_0x9f21('0x54')](_0x43e350['serverUrl']);def[_0x9f21('0x76')]=util[_0x9f21('0x20')](_0x9f21('0x56'),_0x43e350['remoteUri']);if(_0x20be9a&&_0x20be9a[_0x9f21('0x57')]){logger['info']('['+_0x348f1f[_0x9f21('0x77')][_0x9f21('0x78')]()+']','Recording\x20is\x20enabled!');_0x348f1f[_0x9f21('0x59')]=util[_0x9f21('0x20')](_0x9f21('0x5a'),_0x43e350[_0x9f21('0x55')],_0x348f1f[_0x9f21('0x5b')],md5(_0x348f1f[_0x9f21('0x5b')]));}else{_0x348f1f[_0x9f21('0x59')]='';}return getConnection(_0x43e350)[_0x9f21('0x29')](function(_0x377452){_0x106837=_0x377452;if(!_['isNil'](_0x1b42ee)){return getUser(_0x43e350,_0x1b42ee['name'],_0x106837);}else{return getUser(_0x43e350,null,_0x106837);}})[_0x9f21('0x29')](function(_0x4887bf){_0x20fe75=_0x4887bf;logger['info'](_0x9f21('0x6e'),_0x20fe75['id']);return getEndUser(_0x43e350,_0x348f1f[_0x9f21('0x5c')],_0x348f1f[_0x9f21('0x5d')],_0x106837);})['then'](function(_0x109caf){_0x4a0c21=_0x109caf;logger[_0x9f21('0xe')](_0x9f21('0x5e'),_0x4a0c21['id']);return getTicket(_0x43e350,_0x20fe75,_0x4a0c21,_0x9a01a1,_0x348f1f,_0x9a01a1[_0x9f21('0x71')],_0x106837,_0x9f21('0x5f'));})[_0x9f21('0x29')](function(_0x3bb853){_0x16b748=_0x3bb853;logger[_0x9f21('0xe')]('Ticket\x20created!');logger[_0x9f21('0xe')]('The\x20Ticket\x20ID\x20is:',_0x16b748['id']);return setRelationship(_0x106837,_0x20fe75,_0x16b748,_0x9f21('0x62'));})[_0x9f21('0x29')](function(){return setRelationship(_0x106837,_0x4a0c21,_0x16b748,_0x9f21('0x63'));})[_0x9f21('0x29')](function(){return getServerInfo(_0x106837);})[_0x9f21('0x69')](function(_0x40bf2b){logger[_0x9f21('0x6a')]('['+_0x348f1f['lastevent'][_0x9f21('0x78')]()+']',JSON[_0x9f21('0x1e')](_0x40bf2b));});}; \ No newline at end of file +var _0x6c0f=['uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','outbound','recordingFormat','none','destcalleridname','destcalleridnum','Fields','Outbound','contacts','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','user:%s','unmanaged','lastevent','toUpperCase','users','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','getString','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','Contacts','parent_name','name','direction','length','variableName','push','idField','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','name_value_list','value','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','get_entry_list','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','merge','map','forEach','type','string','nameField','customField','toLowerCase','content','custom_fields','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s'];(function(_0x3371f6,_0x4ec66f){var _0x1ba130=function(_0x5aa350){while(--_0x5aa350){_0x3371f6['push'](_0x3371f6['shift']());}};_0x1ba130(++_0x4ec66f);}(_0x6c0f,0x119));var _0xf6c0=function(_0x20b278,_0x1ff931){_0x20b278=_0x20b278-0x0;var _0x441a43=_0x6c0f[_0x20b278];return _0x441a43;};'use strict';var _=require(_0xf6c0('0x0'));var rp=require(_0xf6c0('0x1'));var BPromise=require(_0xf6c0('0x2'));var md5=require(_0xf6c0('0x3'));var util=require(_0xf6c0('0x4'));var Redis=require(_0xf6c0('0x5'));var intUtil=require(_0xf6c0('0x6'));var config=require(_0xf6c0('0x7'));var logger=require(_0xf6c0('0x8'))(_0xf6c0('0x9'));config['redis']=_['defaults'](config[_0xf6c0('0xa')],{'host':_0xf6c0('0xb'),'port':0x18eb});var io=require(_0xf6c0('0xc'))(new Redis(config['redis']));var def={'method':_0xf6c0('0xd'),'json':!![]};function emit(_0x51cd40,_0x361fce,_0x5f35cb){io['to'](_0x51cd40)[_0xf6c0('0xe')](_0x361fce,_0x5f35cb);}function getTicket(_0x5b2440,_0x176119,_0x1af16f,_0x5ea17c,_0x44e822,_0x17d2ac,_0x141938,_0x1d701a){logger[_0xf6c0('0xf')](_0xf6c0('0x10'));var _0x20d767=new Date();var _0x2794ae=[{'name':'name','value':intUtil[_0xf6c0('0x11')](_0x5ea17c['Subjects'],_0x44e822,'\x20')},{'name':_0xf6c0('0x12'),'value':_0x176119['id']},{'name':_0xf6c0('0x13'),'value':_0x176119['id']},{'name':_0xf6c0('0x14'),'value':intUtil[_0xf6c0('0x11')](_0x5ea17c['Descriptions'],_0x44e822,'\x0a')},{'name':_0xf6c0('0x15'),'value':_0x20d767[_0xf6c0('0x16')]()[_0xf6c0('0x17')](0x0,0x13)['replace']('T','\x20')},{'name':_0xf6c0('0x18'),'value':'0'},{'name':_0xf6c0('0x19'),'value':'15'},{'name':_0xf6c0('0x1a'),'value':_0x1af16f['id']},{'name':_0xf6c0('0x1b'),'value':_0xf6c0('0x1c')},{'name':_0xf6c0('0x1d'),'value':_0x1af16f[_0xf6c0('0x1e')]},{'name':_0xf6c0('0x1f'),'value':_0x1d701a}];if(_0x17d2ac[_0xf6c0('0x20')]){_['forEach'](_0x17d2ac,function(_0x262a23){if(_0x44e822[_0x262a23[_0xf6c0('0x21')]]){_0x2794ae[_0xf6c0('0x22')]({'name':_0x262a23[_0xf6c0('0x23')],'value':_0x44e822[_0x262a23[_0xf6c0('0x21')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'session':_0x141938['id'],'module_name':_0xf6c0('0x26'),'name_value_list':_0x2794ae})}});}function getAuth(_0x1f97bb){return util[_0xf6c0('0x27')]('Basic\x20%s',new Buffer(_0x1f97bb[_0xf6c0('0x28')]+':X')[_0xf6c0('0x29')](_0xf6c0('0x2a')));}function getServerInfo(_0xbe90ed){return request({'form':{'method':_0xf6c0('0x2b'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf6c0('0x25')]({'session':_0xbe90ed['id']})}});}function getUser(_0x559a22,_0x4fdb55,_0x1a30a6){if(!_['isNil'](_0x4fdb55)){logger[_0xf6c0('0xf')]('Getting\x20agent\x20with\x20name',_0x4fdb55);return request({'form':{'method':'get_entry_list','input_type':_0xf6c0('0x24'),'response_type':_0xf6c0('0x24'),'rest_data':JSON['stringify']({'session':_0x1a30a6['id'],'module_name':_0xf6c0('0x2c'),'query':util['format'](_0xf6c0('0x2d'),_0x4fdb55),'order_by':'','offset':'0','select_fields':['id',_0xf6c0('0x1e'),_0xf6c0('0x2e')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6c0('0x2f')](function(_0x29489b){if(_0x29489b['entry_list'][_0xf6c0('0x20')]){var _0x3ef968=_[_0xf6c0('0x30')](_0x29489b[_0xf6c0('0x31')],function(_0x3b0921){return _0x3b0921[_0xf6c0('0x32')][_0xf6c0('0x2e')][_0xf6c0('0x33')]===_0x4fdb55;});if(_0x3ef968){logger[_0xf6c0('0xf')]('Agent\x20found!');return BPromise[_0xf6c0('0x34')]({'id':_0x3ef968[_0xf6c0('0x32')]['id'][_0xf6c0('0x33')],'name':_0x3ef968['name_value_list'][_0xf6c0('0x1e')][_0xf6c0('0x33')]});}}logger[_0xf6c0('0xf')](_0xf6c0('0x35'));return BPromise[_0xf6c0('0x34')]({'id':_0x1a30a6['name_value_list'][_0xf6c0('0x36')]['value'],'name':_0x1a30a6[_0xf6c0('0x32')][_0xf6c0('0x2e')][_0xf6c0('0x33')]});});}else{logger[_0xf6c0('0xf')](_0xf6c0('0x37'));return BPromise[_0xf6c0('0x34')]({'id':_0x1a30a6['name_value_list'][_0xf6c0('0x36')]['value'],'name':_0x1a30a6['name_value_list'][_0xf6c0('0x2e')][_0xf6c0('0x33')]});}}function getEndUser(_0x233082,_0x5eddf6,_0x4c65f1,_0x4520a6){logger[_0xf6c0('0xf')](_0xf6c0('0x38'),_0x4c65f1);return request({'form':{'method':_0xf6c0('0x39'),'input_type':_0xf6c0('0x24'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x4520a6['id'],'module_name':'Contacts','query':util[_0xf6c0('0x27')](_0xf6c0('0x3a'),_0x4c65f1),'order_by':'','offset':'0','select_fields':['id',_0xf6c0('0x1e'),_0xf6c0('0x3b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf6c0('0x2f')](function(_0xe57cbd){if(_0xe57cbd[_0xf6c0('0x31')][_0xf6c0('0x20')]){var _0x2db8b1=_[_0xf6c0('0x30')](_0xe57cbd['entry_list'],function(_0x186ef9){return _0x186ef9[_0xf6c0('0x32')]['phone_home'][_0xf6c0('0x33')]===_0x4c65f1;});if(_0x2db8b1){logger[_0xf6c0('0xf')](_0xf6c0('0x3c'));return BPromise[_0xf6c0('0x34')]({'id':_0x2db8b1[_0xf6c0('0x32')]['id'][_0xf6c0('0x33')],'name':_0x2db8b1[_0xf6c0('0x32')][_0xf6c0('0x1e')]['value'],'phone':_0x2db8b1[_0xf6c0('0x32')][_0xf6c0('0x3b')][_0xf6c0('0x33')]});}}else{logger[_0xf6c0('0xf')](_0xf6c0('0x3d'));return request({'form':{'method':_0xf6c0('0x3e'),'input_type':'JSON','response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'session':_0x4520a6['id'],'module_name':_0xf6c0('0x1c'),'name_value_list':[{'name':'first_name','value':_0x5eddf6!==_0xf6c0('0x3f')?_0x5eddf6:util['format'](_0xf6c0('0x40'),_0x4c65f1)},{'name':_0xf6c0('0x3b'),'value':_0x4c65f1}]})}})[_0xf6c0('0x2f')](function(_0x211f0a){logger[_0xf6c0('0xf')](_0xf6c0('0x41'));return BPromise[_0xf6c0('0x34')]({'id':_0x211f0a['id'],'name':_0x211f0a[_0xf6c0('0x31')]['first_name']['value'],'phone':_0x211f0a[_0xf6c0('0x31')][_0xf6c0('0x3b')][_0xf6c0('0x33')]});});}});}function request(_0xb21a2f){logger[_0xf6c0('0x42')](_0xf6c0('0x43'),JSON[_0xf6c0('0x25')](_0xb21a2f));return rp(_[_0xf6c0('0x44')](def,_0xb21a2f));}function getTags(_0xc929f,_0x5b1d08){var _0x4b454c=[];if(_0xc929f&&_0xc929f[_0xf6c0('0x20')]>0x0){_0x4b454c=_[_0xf6c0('0x45')](_0xc929f,_0x5b1d08);}return _0x4b454c;}function getCustomFields(_0x4e8ee1,_0x1f89b8){var _0x4879d8=[];var _0x18fe7b={'custom_fields':[]};if(_0x4e8ee1[_0xf6c0('0x20')]>0x0){_[_0xf6c0('0x46')](_0x4e8ee1,function(_0x532fc2){if(_0x532fc2[_0xf6c0('0x47')]===_0xf6c0('0x48')&&_0x532fc2[_0xf6c0('0x49')]&&!_0x532fc2[_0xf6c0('0x4a')]){_0x18fe7b[_0x532fc2[_0xf6c0('0x49')][_0xf6c0('0x4b')]()]=_0x532fc2[_0xf6c0('0x4c')][_0xf6c0('0x29')]();}else if(_0x532fc2[_0xf6c0('0x47')]===_0xf6c0('0x48')&&_0x532fc2[_0xf6c0('0x23')]&&_0x532fc2[_0xf6c0('0x4a')]){_0x18fe7b[_0xf6c0('0x4d')][_0xf6c0('0x22')]({'id':_0x532fc2[_0xf6c0('0x23')],'value':_0x532fc2[_0xf6c0('0x4c')][_0xf6c0('0x29')]()});}else if(_0x532fc2['type']==='variable'&&_0x532fc2[_0xf6c0('0x21')]&&_0x532fc2[_0xf6c0('0x23')]&&_0x532fc2[_0xf6c0('0x4a')]){_0x1f89b8[_0x532fc2['variableName']]&&_0x18fe7b[_0xf6c0('0x4d')][_0xf6c0('0x22')]({'id':_0x532fc2[_0xf6c0('0x23')],'value':_0x1f89b8[_0x532fc2[_0xf6c0('0x21')]][_0xf6c0('0x29')]()});}else if(_0x532fc2[_0xf6c0('0x47')]==='customVariable'&&_0x532fc2[_0xf6c0('0x4e')]&&_0x532fc2[_0xf6c0('0x4e')][_0xf6c0('0x1e')]&&_0x532fc2[_0xf6c0('0x23')]&&_0x532fc2[_0xf6c0('0x4a')]){_0x1f89b8[_0x532fc2[_0xf6c0('0x4e')][_0xf6c0('0x1e')][_0xf6c0('0x4b')]()]&&_0x18fe7b[_0xf6c0('0x4d')][_0xf6c0('0x22')]({'id':_0x532fc2[_0xf6c0('0x23')],'value':_0x1f89b8[_0x532fc2[_0xf6c0('0x4e')][_0xf6c0('0x1e')][_0xf6c0('0x4b')]()][_0xf6c0('0x29')]()});}});}return _0x18fe7b;}function getConnection(_0x75c3f5){return request({'method':'POST','form':{'method':_0xf6c0('0x4f'),'input_type':_0xf6c0('0x24'),'response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'user_auth':{'user_name':_0x75c3f5[_0xf6c0('0x50')],'password':_0x75c3f5[_0xf6c0('0x51')],'encryption':_0xf6c0('0x52')},'application':_0xf6c0('0x53')})}})[_0xf6c0('0x2f')](function(_0x1302c9){var _0x5450d3=_0x1302c9;if(_0x5450d3['id']){def['sessionID']=_0x5450d3['id'];return BPromise[_0xf6c0('0x34')](_0x5450d3);}else{throw new Error(util[_0xf6c0('0x27')]('Account\x20%d\x20is\x20not\x20valid',_0x75c3f5['id']));}});}function setRelationship(_0x46b4ae,_0x2c746e,_0x5cfa1f,_0x15146e){return request({'form':{'method':_0xf6c0('0x54'),'input_type':_0xf6c0('0x24'),'response_type':_0xf6c0('0x24'),'rest_data':JSON[_0xf6c0('0x25')]({'session':_0x46b4ae['id'],'module_name':_0xf6c0('0x26'),'module_id':_0x5cfa1f['id'],'link_field_name':_0x15146e,'related_ids':[_0x2c746e['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf6c0('0x55')]=function(_0x52a3bd,_0x1a4744,_0x4012ad,_0x580c22,_0x5e2176,_0x352f56){var _0xd79247,_0x40d0c7,_0x141d65,_0x552bef;_0x352f56[_0xf6c0('0x56')]=intUtil[_0xf6c0('0x57')](_0x352f56[_0xf6c0('0x56')]);_0x352f56[_0xf6c0('0x58')]=intUtil[_0xf6c0('0x57')](_0x352f56[_0xf6c0('0x58')]);def[_0xf6c0('0x59')]=util[_0xf6c0('0x27')](_0xf6c0('0x5a'),_0x352f56[_0xf6c0('0x56')]);if(_0x5e2176&&_0x5e2176['monitor_format']){logger['info'](_0xf6c0('0x5b'),_0xf6c0('0x5c'));_0x1a4744['recordingURL']=util['format'](_0xf6c0('0x5d'),_0x352f56[_0xf6c0('0x58')],_0x1a4744[_0xf6c0('0x5e')],md5(_0x1a4744[_0xf6c0('0x5e')]));}else{_0x1a4744[_0xf6c0('0x5f')]='';}return getConnection(_0x352f56)[_0xf6c0('0x2f')](function(_0x53f2a5){_0x552bef=_0x53f2a5;return getUser(_0x352f56,_0x580c22[_0xf6c0('0x1e')],_0x552bef);})[_0xf6c0('0x2f')](function(_0x198dcf){_0xd79247=_0x198dcf;logger['info'](_0xf6c0('0x60'),_0xd79247['id']);return getEndUser(_0x352f56,_0x1a4744[_0xf6c0('0x61')],_0x1a4744[_0xf6c0('0x62')],_0x552bef);})['then'](function(_0x4c80ec){_0x40d0c7=_0x4c80ec;logger[_0xf6c0('0xf')](_0xf6c0('0x63'),_0x40d0c7['id']);return getTicket(_0x352f56,_0xd79247,_0x40d0c7,_0x4012ad,_0x1a4744,_0x4012ad['Fields'],_0x552bef,_0xf6c0('0x64'));})[_0xf6c0('0x2f')](function(_0x44bdf1){_0x141d65=_0x44bdf1;logger[_0xf6c0('0xf')](_0xf6c0('0x65'));logger['info'](_0xf6c0('0x66'),_0x141d65['id']);return setRelationship(_0x552bef,_0xd79247,_0x141d65,'users');})[_0xf6c0('0x2f')](function(){return setRelationship(_0x552bef,_0x40d0c7,_0x141d65,'contacts');})['then'](function(){return getServerInfo(_0x552bef);})['then'](function(_0x4277e0){var _0x2c9443=parseInt(_0x4277e0[_0xf6c0('0x67')][_0xf6c0('0x68')](0x0));var _0x133ca2=util[_0xf6c0('0x27')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x352f56[_0xf6c0('0x56')],_0x141d65['id']);if(_0x2c9443>0x6){_0x133ca2=util['format'](_0xf6c0('0x69'),_0x352f56[_0xf6c0('0x56')],_0x141d65['id']);}logger[_0xf6c0('0xf')](_0xf6c0('0x5b'),_0xf6c0('0x6a'));emit(util[_0xf6c0('0x27')]('user:%s',_0x580c22['name']),_0xf6c0('0x6b'),{'uri':_0x133ca2});})[_0xf6c0('0x6c')](function(_0x53119a){logger[_0xf6c0('0x6d')](_0xf6c0('0x5b'),JSON[_0xf6c0('0x25')](_0x53119a));});};exports[_0xf6c0('0x6e')]=function(_0x5bd482,_0x56b448,_0xfbf28d,_0x4a4b86,_0x33af28,_0x32a6e0,_0x43c869){var _0x31dfa1,_0x453dd4,_0x2f3b38,_0x51aad2;_0x32a6e0[_0xf6c0('0x56')]=intUtil[_0xf6c0('0x57')](_0x32a6e0[_0xf6c0('0x56')]);_0x32a6e0[_0xf6c0('0x58')]=intUtil[_0xf6c0('0x57')](_0x32a6e0[_0xf6c0('0x58')]);def[_0xf6c0('0x59')]=util[_0xf6c0('0x27')]('%s/service/v4_1/rest.php',_0x32a6e0[_0xf6c0('0x56')]);if(_0x43c869&&_0x43c869[_0xf6c0('0x6f')]&&_0x43c869[_0xf6c0('0x6f')]!==_0xf6c0('0x70')){logger[_0xf6c0('0xf')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x56b448[_0xf6c0('0x5f')]=util[_0xf6c0('0x27')](_0xf6c0('0x5d'),_0x32a6e0[_0xf6c0('0x58')],_0x56b448['uniqueid'],md5(_0x56b448['uniqueid']));}return getConnection(_0x32a6e0)['then'](function(_0x31382c){_0x51aad2=_0x31382c;return getUser(_0x32a6e0,_0x4a4b86['name'],_0x51aad2);})[_0xf6c0('0x2f')](function(_0x4681ee){_0x31dfa1=_0x4681ee;logger[_0xf6c0('0xf')](_0xf6c0('0x60'),_0x31dfa1['id']);return getEndUser(_0x32a6e0,_0x56b448[_0xf6c0('0x71')],_0x56b448[_0xf6c0('0x72')],_0x51aad2);})[_0xf6c0('0x2f')](function(_0x4fc538){_0x453dd4=_0x4fc538;logger['info'](_0xf6c0('0x63'),_0x453dd4['id']);return getTicket(_0x32a6e0,_0x31dfa1,_0x453dd4,_0xfbf28d,_0x56b448,_0xfbf28d[_0xf6c0('0x73')],_0x51aad2,_0xf6c0('0x74'));})[_0xf6c0('0x2f')](function(_0x3974cd){_0x2f3b38=_0x3974cd;logger[_0xf6c0('0xf')](_0xf6c0('0x65'));logger[_0xf6c0('0xf')](_0xf6c0('0x66'),_0x2f3b38['id']);return setRelationship(_0x51aad2,_0x31dfa1,_0x2f3b38,'users');})[_0xf6c0('0x2f')](function(){return setRelationship(_0x51aad2,_0x453dd4,_0x2f3b38,_0xf6c0('0x75'));})[_0xf6c0('0x2f')](function(){return getServerInfo(_0x51aad2);})[_0xf6c0('0x2f')](function(_0x48e7db){var _0x17eed5=parseInt(_0x48e7db[_0xf6c0('0x67')]['charAt'](0x0));var _0x1b46a3=util['format'](_0xf6c0('0x76'),_0x32a6e0[_0xf6c0('0x56')],_0x2f3b38['id']);if(_0x17eed5>0x6){_0x1b46a3=util[_0xf6c0('0x27')](_0xf6c0('0x69'),_0x32a6e0['remoteUri'],_0x2f3b38['id']);}logger[_0xf6c0('0xf')](_0xf6c0('0x77'),_0xf6c0('0x6a'));emit(util['format'](_0xf6c0('0x78'),_0x4a4b86[_0xf6c0('0x1e')]),_0xf6c0('0x6b'),{'uri':_0x1b46a3});})['catch'](function(_0x42ac0c){logger['error'](_0xf6c0('0x77'),JSON['stringify'](_0x42ac0c));});};exports[_0xf6c0('0x79')]=function(_0x515bf3,_0x5c3562,_0x469ada,_0x135dc4,_0x8d9a7,_0x2ebb20){var _0x5de335,_0x1612f7,_0x3f735a,_0x53f75a;_0x2ebb20[_0xf6c0('0x56')]=intUtil[_0xf6c0('0x57')](_0x2ebb20[_0xf6c0('0x56')]);_0x2ebb20[_0xf6c0('0x58')]=intUtil[_0xf6c0('0x57')](_0x2ebb20['serverUrl']);def[_0xf6c0('0x59')]=util[_0xf6c0('0x27')](_0xf6c0('0x5a'),_0x2ebb20['remoteUri']);if(_0x8d9a7&&_0x8d9a7['monitor_format']){logger[_0xf6c0('0xf')]('['+_0x5c3562[_0xf6c0('0x7a')][_0xf6c0('0x7b')]()+']',_0xf6c0('0x5c'));_0x5c3562[_0xf6c0('0x5f')]=util[_0xf6c0('0x27')](_0xf6c0('0x5d'),_0x2ebb20['serverUrl'],_0x5c3562[_0xf6c0('0x5e')],md5(_0x5c3562['uniqueid']));}else{_0x5c3562[_0xf6c0('0x5f')]='';}return getConnection(_0x2ebb20)[_0xf6c0('0x2f')](function(_0x5a82b1){_0x53f75a=_0x5a82b1;if(!_['isNil'](_0x135dc4)){return getUser(_0x2ebb20,_0x135dc4['name'],_0x53f75a);}else{return getUser(_0x2ebb20,null,_0x53f75a);}})[_0xf6c0('0x2f')](function(_0x580895){_0x5de335=_0x580895;logger[_0xf6c0('0xf')](_0xf6c0('0x60'),_0x5de335['id']);return getEndUser(_0x2ebb20,_0x5c3562[_0xf6c0('0x61')],_0x5c3562[_0xf6c0('0x62')],_0x53f75a);})['then'](function(_0x20ec58){_0x1612f7=_0x20ec58;logger['info'](_0xf6c0('0x63'),_0x1612f7['id']);return getTicket(_0x2ebb20,_0x5de335,_0x1612f7,_0x469ada,_0x5c3562,_0x469ada[_0xf6c0('0x73')],_0x53f75a,_0xf6c0('0x64'));})['then'](function(_0xa92781){_0x3f735a=_0xa92781;logger[_0xf6c0('0xf')](_0xf6c0('0x65'));logger[_0xf6c0('0xf')](_0xf6c0('0x66'),_0x3f735a['id']);return setRelationship(_0x53f75a,_0x5de335,_0x3f735a,_0xf6c0('0x7c'));})[_0xf6c0('0x2f')](function(){return setRelationship(_0x53f75a,_0x1612f7,_0x3f735a,_0xf6c0('0x75'));})[_0xf6c0('0x2f')](function(){return getServerInfo(_0x53f75a);})['catch'](function(_0x6431eb){logger['error']('['+_0x5c3562[_0xf6c0('0x7a')][_0xf6c0('0x7b')]()+']',JSON['stringify'](_0x6431eb));});}; \ 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 1f7cc69..0846e64 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 _0x3a56=['type','string','push','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','keyType','format','key','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x278428,_0x39442c){var _0x3e04b0=function(_0x270895){while(--_0x270895){_0x278428['push'](_0x278428['shift']());}};_0x3e04b0(++_0x39442c);}(_0x3a56,0xd4));var _0x63a5=function(_0x577519,_0x346daf){_0x577519=_0x577519-0x0;var _0x5b12f7=_0x3a56[_0x577519];return _0x5b12f7;};'use strict';var _=require(_0x63a5('0x0'));var util=require(_0x63a5('0x1'));exports[_0x63a5('0x2')]=function(_0x32f926,_0x3643bd,_0x893342){var _0x49ab64=[];if(_0x32f926[_0x63a5('0x3')]>0x0){var _0x4f7533=_['sortBy'](_0x32f926,['id']);for(var _0x21a24f=0x0;_0x21a24f<_0x4f7533[_0x63a5('0x3')];_0x21a24f++){var _0x4104e1=_0x4f7533[_0x21a24f];if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0x5')){_0x49ab64[_0x63a5('0x6')](_0x4104e1['content']);}else if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0x7')&&_0x4104e1[_0x63a5('0x8')]){_0x3643bd[_0x4104e1[_0x63a5('0x8')]]&&_0x49ab64[_0x63a5('0x6')](_0x3643bd[_0x4104e1['variableName']][_0x63a5('0x9')]());}else if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0xa')&&_0x4104e1['Variable']&&_0x4104e1['Variable']['name']){_0x3643bd[_0x4104e1['Variable'][_0x63a5('0xb')]['toLowerCase']()]&&_0x49ab64[_0x63a5('0x6')](_0x3643bd[_0x4104e1[_0x63a5('0xc')][_0x63a5('0xb')][_0x63a5('0xd')]()][_0x63a5('0x9')]());}else if(_0x4104e1[_0x63a5('0x4')]===_0x63a5('0xe')){if(_0x4104e1[_0x63a5('0xf')]==='string'&&_0x4104e1['key']){_0x49ab64[_0x63a5('0x6')](util[_0x63a5('0x10')]('%s:\x20%s',_0x4104e1['key'],_0x4104e1['keyContent']));}else if(_0x4104e1[_0x63a5('0xf')]===_0x63a5('0x7')&&_0x4104e1[_0x63a5('0x8')]&&_0x4104e1[_0x63a5('0x11')]){_0x3643bd[_0x4104e1[_0x63a5('0x8')]]&&_0x49ab64['push'](util['format']('%s:\x20%s',_0x4104e1[_0x63a5('0x11')],_0x3643bd[_0x4104e1[_0x63a5('0x8')]]));}else if(_0x4104e1[_0x63a5('0xf')]===_0x63a5('0xa')&&_0x4104e1[_0x63a5('0xc')]&&_0x4104e1[_0x63a5('0xc')][_0x63a5('0xb')]&&_0x4104e1[_0x63a5('0x11')]){_0x3643bd[_0x4104e1['Variable'][_0x63a5('0xb')][_0x63a5('0xd')]()]&&_0x49ab64['push'](util[_0x63a5('0x10')]('%s:\x20%s',_0x4104e1[_0x63a5('0x11')],_0x3643bd[_0x4104e1[_0x63a5('0xc')][_0x63a5('0xb')]['toLowerCase']()]));}}}}return _0x49ab64['join'](_0x893342);};exports[_0x63a5('0x12')]=function(_0x38ffc3){var _0x20812d=_0x38ffc3['slice'](-0x1);if(_0x20812d==='/'){_0x38ffc3=_0x38ffc3[_0x63a5('0x13')](0x0,_0x38ffc3[_0x63a5('0x14')](_0x20812d));}return _0x38ffc3;};exports[_0x63a5('0x15')]=function(_0x485e4c){if(!_[_0x63a5('0x16')](_0x485e4c)&&_0x485e4c!==''){var _0x87bcf=/^(([^<>()\[\]\\.,;:\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 _0x87bcf[_0x63a5('0x17')](String(_0x485e4c)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x23bc=['stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string','push','variable','variableName','toString','customVariable','name','Variable','toLowerCase','keyValue','key','%s:\x20%s','keyContent','keyType','format','join'];(function(_0x14eae9,_0x1e8cd8){var _0xe7ab39=function(_0x4da8ae){while(--_0x4da8ae){_0x14eae9['push'](_0x14eae9['shift']());}};_0xe7ab39(++_0x1e8cd8);}(_0x23bc,0x19d));var _0xc23b=function(_0x343481,_0x18c920){_0x343481=_0x343481-0x0;var _0x53c287=_0x23bc[_0x343481];return _0x53c287;};'use strict';var _=require(_0xc23b('0x0'));var util=require(_0xc23b('0x1'));exports[_0xc23b('0x2')]=function(_0x1b0bf5,_0x227579,_0x24d68d){var _0x3e954e=[];if(_0x1b0bf5[_0xc23b('0x3')]>0x0){var _0x2720eb=_[_0xc23b('0x4')](_0x1b0bf5,['id']);for(var _0x311103=0x0;_0x311103<_0x2720eb[_0xc23b('0x3')];_0x311103++){var _0x5e86a8=_0x2720eb[_0x311103];if(_0x5e86a8[_0xc23b('0x5')]===_0xc23b('0x6')){_0x3e954e[_0xc23b('0x7')](_0x5e86a8['content']);}else if(_0x5e86a8['type']===_0xc23b('0x8')&&_0x5e86a8[_0xc23b('0x9')]){_0x227579[_0x5e86a8['variableName']]&&_0x3e954e[_0xc23b('0x7')](_0x227579[_0x5e86a8[_0xc23b('0x9')]][_0xc23b('0xa')]());}else if(_0x5e86a8[_0xc23b('0x5')]===_0xc23b('0xb')&&_0x5e86a8['Variable']&&_0x5e86a8['Variable'][_0xc23b('0xc')]){_0x227579[_0x5e86a8[_0xc23b('0xd')]['name'][_0xc23b('0xe')]()]&&_0x3e954e[_0xc23b('0x7')](_0x227579[_0x5e86a8['Variable'][_0xc23b('0xc')][_0xc23b('0xe')]()][_0xc23b('0xa')]());}else if(_0x5e86a8[_0xc23b('0x5')]===_0xc23b('0xf')){if(_0x5e86a8['keyType']==='string'&&_0x5e86a8[_0xc23b('0x10')]){_0x3e954e[_0xc23b('0x7')](util['format'](_0xc23b('0x11'),_0x5e86a8['key'],_0x5e86a8[_0xc23b('0x12')]));}else if(_0x5e86a8[_0xc23b('0x13')]===_0xc23b('0x8')&&_0x5e86a8[_0xc23b('0x9')]&&_0x5e86a8[_0xc23b('0x10')]){_0x227579[_0x5e86a8[_0xc23b('0x9')]]&&_0x3e954e['push'](util['format'](_0xc23b('0x11'),_0x5e86a8['key'],_0x227579[_0x5e86a8[_0xc23b('0x9')]]));}else if(_0x5e86a8[_0xc23b('0x13')]===_0xc23b('0xb')&&_0x5e86a8[_0xc23b('0xd')]&&_0x5e86a8[_0xc23b('0xd')][_0xc23b('0xc')]&&_0x5e86a8[_0xc23b('0x10')]){_0x227579[_0x5e86a8[_0xc23b('0xd')][_0xc23b('0xc')][_0xc23b('0xe')]()]&&_0x3e954e[_0xc23b('0x7')](util[_0xc23b('0x14')](_0xc23b('0x11'),_0x5e86a8[_0xc23b('0x10')],_0x227579[_0x5e86a8[_0xc23b('0xd')]['name']['toLowerCase']()]));}}}}return _0x3e954e[_0xc23b('0x15')](_0x24d68d);};exports[_0xc23b('0x16')]=function(_0x32e437){var _0x2172fa=_0x32e437[_0xc23b('0x17')](-0x1);if(_0x2172fa==='/'){_0x32e437=_0x32e437[_0xc23b('0x18')](0x0,_0x32e437[_0xc23b('0x19')](_0x2172fa));}return _0x32e437;};exports[_0xc23b('0x1a')]=function(_0x3d0018){if(!_[_0xc23b('0x1b')](_0x3d0018)&&_0x3d0018!==''){var _0x556891=/^(([^<>()\[\]\\.,;:\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 _0x556891[_0xc23b('0x1c')](String(_0x3d0018)[_0xc23b('0xe')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 09f50ba..ddaefd6 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(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xa9e0[_0x4243a3];return _0x1b2a33;};'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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x352da4,_0x24fd36){var _0x183e4c=function(_0x21373c){while(--_0x21373c){_0x352da4['push'](_0x352da4['shift']());}};_0x183e4c(++_0x24fd36);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index eaf9604..fd04738 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 _0xa264=['Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','password','%s:%s','username','token','base64','debug','[HTTP]','defaults','GET','string','picklist','type','nameField','toLowerCase','content','idField','custom_fields','push','variableName','customField','toString','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','%s/agent/tickets/%s','/api/v2','error','catch','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','trigger:browser:url','replace','Zendesk\x20account\x20type\x20not\x20recognized','monitor_format','toUpperCase','calleridname','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','format','%s/tickets.json','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first'];(function(_0x343bac,_0x3d81fb){var _0x4435bf=function(_0x35620d){while(--_0x35620d){_0x343bac['push'](_0x343bac['shift']());}};_0x4435bf(++_0x3d81fb);}(_0xa264,0x183));var _0x4a26=function(_0x1cb18a,_0x33167a){_0x1cb18a=_0x1cb18a-0x0;var _0x22442e=_0xa264[_0x1cb18a];return _0x22442e;};'use strict';var _=require(_0x4a26('0x0'));var rp=require('request-promise');var md5=require(_0x4a26('0x1'));var util=require(_0x4a26('0x2'));var Redis=require('ioredis');var intUtil=require(_0x4a26('0x3'));var config=require(_0x4a26('0x4'));var logger=require(_0x4a26('0x5'))(_0x4a26('0x6'));config[_0x4a26('0x7')]=_['defaults'](config['redis'],{'host':_0x4a26('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x434bb8,_0x4c8e51,_0x2c0a65){io['to'](_0x434bb8)[_0x4a26('0x9')](_0x4c8e51,_0x2c0a65);}var headers={'Content-Type':_0x4a26('0xa'),'Accept':_0x4a26('0xa')};function getTicket(_0x407631,_0x4b0f72,_0x13c6b3,_0xe294f8,_0xf17a7d){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util[_0x4a26('0xb')](_0x4a26('0xc'),_0x407631[_0x4a26('0xd')]),'method':_0x4a26('0xe'),'body':{'ticket':_[_0x4a26('0xf')]({'requester_id':_0x13c6b3['id'],'submitter_id':_0x4b0f72?_0x4b0f72['id']:undefined,'assignee_id':_0x4b0f72?_0x4b0f72['id']:undefined,'tags':getTags(_0xe294f8[_0x4a26('0x10')],_0x4a26('0x11')),'subject':intUtil[_0x4a26('0x12')](_0xe294f8[_0x4a26('0x13')],_0xf17a7d,'\x20'),'description':intUtil[_0x4a26('0x12')](_0xe294f8['Descriptions'],_0xf17a7d,'\x0a'),'comment':{'public':![],'body':intUtil[_0x4a26('0x12')](_0xe294f8[_0x4a26('0x14')],_0xf17a7d,'\x0a')}},getCustomFields(_0xe294f8['Fields'],_0xf17a7d))}})[_0x4a26('0x15')](function(_0x486d17){logger[_0x4a26('0x16')]('Ticket\x20created!');return _0x486d17[_0x4a26('0x17')];});}function getUser(_0x18f914,_0x1db843){if(intUtil[_0x4a26('0x18')](_0x1db843)){logger[_0x4a26('0x16')](_0x4a26('0x19'),_0x1db843);return request({'uri':util[_0x4a26('0xb')](_0x4a26('0x1a'),_0x18f914[_0x4a26('0xd')]),'qs':{'query':util[_0x4a26('0xb')](_0x4a26('0x1b'),_0x1db843)}})[_0x4a26('0x15')](function(_0x22d1fd){if(_0x22d1fd[_0x4a26('0x1c')]){logger['info']('Agent\x20found!');return _[_0x4a26('0x1d')](_0x22d1fd[_0x4a26('0x1e')],{'email':_0x1db843,'role':_0x4a26('0x1f')});}else{logger[_0x4a26('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x4a26('0xb')](_0x4a26('0x20'),_0x18f914['remoteUri'])})['then'](function(_0x1f1348){logger[_0x4a26('0x16')](_0x4a26('0x21'));return _0x1f1348[_0x4a26('0x22')];});}});}else{logger['info'](_0x4a26('0x23'));return request({'uri':util[_0x4a26('0xb')]('%s/users/me.json',_0x18f914['remoteUri'])})[_0x4a26('0x15')](function(_0x1c9234){logger['info'](_0x4a26('0x21'));return _0x1c9234['user'];});}}function getEndUser(_0x4a3fec,_0x48aff9,_0x2888a8){logger[_0x4a26('0x16')]('Searching\x20enduser\x20with\x20phone',_0x2888a8);return request({'uri':util['format'](_0x4a26('0x1a'),_0x4a3fec[_0x4a26('0xd')]),'qs':{'query':util[_0x4a26('0xb')](_0x4a26('0x24'),_0x2888a8)}})[_0x4a26('0x15')](function(_0x3726f7){var _0x3fade3;if(_0x3726f7[_0x4a26('0x1e')][_0x4a26('0x25')]){_0x3726f7[_0x4a26('0x1e')]=_[_0x4a26('0x26')](_0x3726f7[_0x4a26('0x1e')],{'suspended':![],'role':_0x4a26('0x27')});if(_0x3726f7[_0x4a26('0x1e')]['length']){_0x3fade3=_[_0x4a26('0x28')](_0x3726f7[_0x4a26('0x1e')]);}}if(_0x3fade3){logger['info'](_0x4a26('0x29'));return _0x3fade3;}else{logger['info'](_0x4a26('0x2a'));return request({'uri':util['format']('%s/users.json',_0x4a3fec[_0x4a26('0xd')]),'method':_0x4a26('0xe'),'body':{'user':{'role':'end-user','name':util[_0x4a26('0xb')]('Caller\x20-\x20%s',_0x48aff9||_0x2888a8),'phone':_0x2888a8}}})['then'](function(_0x5e019c){logger[_0x4a26('0x16')](_0x4a26('0x2b'));return _0x5e019c[_0x4a26('0x22')];});}});}function getAuth(_0x66740c){var _0x2aea79;if(_0x66740c[_0x4a26('0x2c')]===_0x4a26('0x2d')){_0x2aea79=util[_0x4a26('0xb')](_0x4a26('0x2e'),_0x66740c[_0x4a26('0x2f')],_0x66740c['password']);}else if(_0x66740c[_0x4a26('0x2c')]===_0x4a26('0x30')){_0x2aea79=util[_0x4a26('0xb')]('%s/token:%s',_0x66740c[_0x4a26('0x2f')],_0x66740c[_0x4a26('0x30')]);}return util['format']('Basic\x20%s',new Buffer(_0x2aea79)['toString'](_0x4a26('0x31')));}function request(_0x6a4a12){logger[_0x4a26('0x32')](_0x4a26('0x33'),JSON['stringify'](_0x6a4a12));return rp(_[_0x4a26('0x34')](_0x6a4a12,{'method':_0x4a26('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x71683f,_0x2a8576){var _0x3219ea=[];if(_0x71683f&&_0x71683f[_0x4a26('0x25')]>0x0){_0x3219ea=_['map'](_0x71683f,_0x2a8576);}return _0x3219ea;}function getCustomFields(_0x240e0b,_0x66faea){var _0x4a50b1=[];var _0x507a1b={'custom_fields':[]};if(_0x240e0b['length']>0x0){_['forEach'](_0x240e0b,function(_0x323d11){if(_['includes']([_0x4a26('0x36'),_0x4a26('0x37')],_0x323d11[_0x4a26('0x38')])&&_0x323d11[_0x4a26('0x39')]&&!_0x323d11['customField']){_0x507a1b[_0x323d11[_0x4a26('0x39')][_0x4a26('0x3a')]()]=_0x323d11[_0x4a26('0x3b')]['toString']();}else if(_['includes']([_0x4a26('0x36'),_0x4a26('0x37')],_0x323d11[_0x4a26('0x38')])&&_0x323d11[_0x4a26('0x3c')]&&_0x323d11['customField']){_0x507a1b[_0x4a26('0x3d')][_0x4a26('0x3e')]({'id':_0x323d11['idField'],'value':_0x323d11['content']['toString']()});}else if(_0x323d11[_0x4a26('0x38')]==='variable'&&_0x323d11[_0x4a26('0x3f')]&&_0x323d11[_0x4a26('0x3c')]&&_0x323d11[_0x4a26('0x40')]){_0x66faea[_0x323d11[_0x4a26('0x3f')]]&&_0x507a1b['custom_fields'][_0x4a26('0x3e')]({'id':_0x323d11[_0x4a26('0x3c')],'value':_0x66faea[_0x323d11[_0x4a26('0x3f')]][_0x4a26('0x41')]()});}else if(_0x323d11[_0x4a26('0x38')]===_0x4a26('0x42')&&_0x323d11[_0x4a26('0x43')]&&_0x323d11[_0x4a26('0x43')][_0x4a26('0x11')]&&_0x323d11[_0x4a26('0x3c')]&&_0x323d11[_0x4a26('0x40')]){_0x66faea[_0x323d11['Variable'][_0x4a26('0x11')]['toLowerCase']()]&&_0x507a1b[_0x4a26('0x3d')][_0x4a26('0x3e')]({'id':_0x323d11[_0x4a26('0x3c')],'value':_0x66faea[_0x323d11[_0x4a26('0x43')][_0x4a26('0x11')]['toLowerCase']()][_0x4a26('0x41')]()});}});}return _0x507a1b;}exports[_0x4a26('0x44')]=function(_0x143978,_0x1f21b0,_0x5dd596,_0x2be207,_0x5b3eac,_0x269097){var _0x51188e,_0x1e7d5f;_0x269097['remoteUri']=intUtil[_0x4a26('0x45')](_0x269097[_0x4a26('0xd')]);_0x269097[_0x4a26('0x46')]=intUtil[_0x4a26('0x45')](_0x269097['serverUrl']);if(_0x5b3eac&&_0x5b3eac['monitor_format']){logger[_0x4a26('0x16')](_0x4a26('0x47'),_0x4a26('0x48'));_0x1f21b0['recordingURL']=util[_0x4a26('0xb')](_0x4a26('0x49'),_0x269097['serverUrl'],_0x1f21b0[_0x4a26('0x4a')],md5(_0x1f21b0['uniqueid']));}else{_0x1f21b0[_0x4a26('0x4b')]='';}headers[_0x4a26('0x4c')]=getAuth(_0x269097);return getUser(_0x269097,_0x2be207['email'])[_0x4a26('0x15')](function(_0x1e96d0){_0x51188e=_0x1e96d0;logger[_0x4a26('0x16')]('The\x20User\x20ID\x20is:',_0x51188e['id']);return getEndUser(_0x269097,_0x1f21b0['calleridname'],_0x1f21b0[_0x4a26('0x4d')]);})[_0x4a26('0x15')](function(_0xf11ee9){_0x1e7d5f=_0xf11ee9;logger[_0x4a26('0x16')](_0x4a26('0x4e'),_0x1e7d5f['id']);return getTicket(_0x269097,_0x51188e,_0x1e7d5f,_0x5dd596,_0x1f21b0);})['then'](function(_0x329396){if(_0x329396){logger[_0x4a26('0x16')](_0x4a26('0x4f'),_0x329396['id']);switch(_0x269097[_0x4a26('0x38')]){case _0x4a26('0x50'):logger[_0x4a26('0x16')](_0x4a26('0x47'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x4a26('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x269097[_0x4a26('0xd')],_0x51188e['id'],_0x329396['id']),'method':'POST'});case _0x4a26('0x51'):logger[_0x4a26('0x16')](_0x4a26('0x47'),_0x4a26('0x52'));emit(util['format'](_0x4a26('0x53'),_0x2be207[_0x4a26('0x11')]),'trigger:browser:url',{'uri':util[_0x4a26('0xb')](_0x4a26('0x54'),_0x269097[_0x4a26('0xd')]['replace'](_0x4a26('0x55'),''),_0x329396['id'])});break;default:logger[_0x4a26('0x56')]('[QUEUE]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x4a26('0x57')](function(_0x3c2d05){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a26('0x58')](_0x3c2d05,{'showHidden':!![],'depth':null}));});};exports[_0x4a26('0x59')]=function(_0xddcbda,_0x3f7158,_0x279aa3,_0x478b56,_0xa702ac,_0x3d8b26,_0x54c318){var _0x91964f,_0x5ef49e;_0x3d8b26['remoteUri']=intUtil[_0x4a26('0x45')](_0x3d8b26[_0x4a26('0xd')]);_0x3d8b26['serverUrl']=intUtil['stripTrailingSlash'](_0x3d8b26[_0x4a26('0x46')]);if(_0x54c318&&_0x54c318['recordingFormat']&&_0x54c318[_0x4a26('0x5a')]!==_0x4a26('0x5b')){logger[_0x4a26('0x16')](_0x4a26('0x5c'),_0x4a26('0x48'));_0x3f7158['recordingURL']=util[_0x4a26('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3d8b26[_0x4a26('0x46')],_0x3f7158[_0x4a26('0x4a')],md5(_0x3f7158['uniqueid']));}headers[_0x4a26('0x4c')]=getAuth(_0x3d8b26);return getUser(_0x3d8b26,_0x478b56[_0x4a26('0x5d')])[_0x4a26('0x15')](function(_0x398e4a){_0x91964f=_0x398e4a;logger[_0x4a26('0x16')](_0x4a26('0x5e'),_0x91964f['id']);return getEndUser(_0x3d8b26,_0x3f7158[_0x4a26('0x5f')],_0x3f7158[_0x4a26('0x60')]);})['then'](function(_0x47edd0){_0x5ef49e=_0x47edd0;logger[_0x4a26('0x16')]('The\x20Enduser\x20ID\x20is:',_0x5ef49e['id']);return getTicket(_0x3d8b26,_0x91964f,_0x5ef49e,_0x279aa3,_0x3f7158);})[_0x4a26('0x15')](function(_0x296582){if(_0x296582){logger[_0x4a26('0x16')]('The\x20Ticket\x20ID\x20is:',_0x296582['id']);switch(_0x3d8b26[_0x4a26('0x38')]){case _0x4a26('0x50'):logger['info'](_0x4a26('0x5c'),_0x4a26('0x61'));return request({'uri':util[_0x4a26('0xb')](_0x4a26('0x62'),_0x3d8b26[_0x4a26('0xd')],_0x91964f['id'],_0x296582['id']),'method':'POST'});case'newTab':logger[_0x4a26('0x16')](_0x4a26('0x5c'),_0x4a26('0x52'));emit(util[_0x4a26('0xb')](_0x4a26('0x53'),_0x478b56['name']),_0x4a26('0x63'),{'uri':util['format'](_0x4a26('0x54'),_0x3d8b26['remoteUri'][_0x4a26('0x64')]('/api/v2',''),_0x296582['id'])});break;default:logger[_0x4a26('0x56')](_0x4a26('0x5c'),_0x4a26('0x65'));}}})[_0x4a26('0x57')](function(_0xa6f49d){logger[_0x4a26('0x56')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x4a26('0x58')](_0xa6f49d,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xd33978,_0xe791d2,_0x4757db,_0x1d0e35,_0x433807,_0x1ec1bc){var _0x490418,_0x3a03db;_0x1ec1bc['remoteUri']=intUtil[_0x4a26('0x45')](_0x1ec1bc[_0x4a26('0xd')]);_0x1ec1bc[_0x4a26('0x46')]=intUtil['stripTrailingSlash'](_0x1ec1bc[_0x4a26('0x46')]);if(_0x433807&&_0x433807[_0x4a26('0x66')]){logger['info']('['+_0xe791d2['lastevent'][_0x4a26('0x67')]()+']','Recording\x20is\x20enabled!');_0xe791d2['recordingURL']=util[_0x4a26('0xb')](_0x4a26('0x49'),_0x1ec1bc[_0x4a26('0x46')],_0xe791d2[_0x4a26('0x4a')],md5(_0xe791d2[_0x4a26('0x4a')]));}else{_0xe791d2[_0x4a26('0x4b')]='';}headers[_0x4a26('0x4c')]=getAuth(_0x1ec1bc);return getUser(_0x1ec1bc)['then'](function(_0x399244){_0x490418=_0x399244;logger[_0x4a26('0x16')](_0x4a26('0x5e'),_0x490418['id']);return getEndUser(_0x1ec1bc,_0xe791d2[_0x4a26('0x68')],_0xe791d2[_0x4a26('0x4d')]);})['then'](function(_0x36ea41){_0x3a03db=_0x36ea41;logger[_0x4a26('0x16')](_0x4a26('0x4e'),_0x3a03db['id']);return getTicket(_0x1ec1bc,_0x490418,_0x3a03db,_0x4757db,_0xe791d2);})[_0x4a26('0x15')](function(_0x317b7d){if(_0x317b7d){logger[_0x4a26('0x16')](_0x4a26('0x4f'),_0x317b7d['id']);}})[_0x4a26('0x57')](function(_0xeaa936){logger[_0x4a26('0x56')]('['+_0xe791d2[_0x4a26('0x69')]['toUpperCase']()+']'+_0x4a26('0x6a'),util[_0x4a26('0x58')](_0xeaa936,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x5b20=['outbound','recordingFormat','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','toUpperCase','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','defaults','redis','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','Tags','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','authType','password','%s:%s','username','token','Basic\x20%s','toString','[HTTP]','stringify','GET','map','forEach','includes','string','type','nameField','toLowerCase','content','picklist','idField','customField','push','variable','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect'];(function(_0x291ac6,_0x3290fe){var _0x5cd7d4=function(_0x473ba0){while(--_0x473ba0){_0x291ac6['push'](_0x291ac6['shift']());}};_0x5cd7d4(++_0x3290fe);}(_0x5b20,0x80));var _0x05b2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5b20[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x05b2('0x0'));var rp=require(_0x05b2('0x1'));var md5=require(_0x05b2('0x2'));var util=require(_0x05b2('0x3'));var Redis=require(_0x05b2('0x4'));var intUtil=require(_0x05b2('0x5'));var config=require(_0x05b2('0x6'));var logger=require(_0x05b2('0x7'))(_0x05b2('0x8'));config['redis']=_[_0x05b2('0x9')](config[_0x05b2('0xa')],{'host':_0x05b2('0xb'),'port':0x18eb});var io=require(_0x05b2('0xc'))(new Redis(config[_0x05b2('0xa')]));function emit(_0x2c0831,_0x2263e7,_0xe0ab13){io['to'](_0x2c0831)['emit'](_0x2263e7,_0xe0ab13);}var headers={'Content-Type':'application/json','Accept':_0x05b2('0xd')};function getTicket(_0x344144,_0x5adcbf,_0x53d334,_0x30c281,_0x3b9c41){logger[_0x05b2('0xe')](_0x05b2('0xf'));return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x11'),_0x344144['remoteUri']),'method':_0x05b2('0x12'),'body':{'ticket':_[_0x05b2('0x13')]({'requester_id':_0x53d334['id'],'submitter_id':_0x5adcbf?_0x5adcbf['id']:undefined,'assignee_id':_0x5adcbf?_0x5adcbf['id']:undefined,'tags':getTags(_0x30c281[_0x05b2('0x14')],_0x05b2('0x15')),'subject':intUtil[_0x05b2('0x16')](_0x30c281[_0x05b2('0x17')],_0x3b9c41,'\x20'),'description':intUtil[_0x05b2('0x16')](_0x30c281[_0x05b2('0x18')],_0x3b9c41,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x30c281['Descriptions'],_0x3b9c41,'\x0a')}},getCustomFields(_0x30c281[_0x05b2('0x19')],_0x3b9c41))}})[_0x05b2('0x1a')](function(_0x1bbab0){logger[_0x05b2('0xe')](_0x05b2('0x1b'));return _0x1bbab0[_0x05b2('0x1c')];});}function getUser(_0x28154b,_0x31513e){if(intUtil[_0x05b2('0x1d')](_0x31513e)){logger[_0x05b2('0xe')](_0x05b2('0x1e'),_0x31513e);return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x1f'),_0x28154b[_0x05b2('0x20')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x31513e)}})[_0x05b2('0x1a')](function(_0x26c458){if(_0x26c458[_0x05b2('0x21')]){logger[_0x05b2('0xe')](_0x05b2('0x22'));return _[_0x05b2('0x23')](_0x26c458[_0x05b2('0x24')],{'email':_0x31513e,'role':_0x05b2('0x25')});}else{logger[_0x05b2('0xe')](_0x05b2('0x26'));return request({'uri':util[_0x05b2('0x10')]('%s/users/me.json',_0x28154b[_0x05b2('0x20')])})[_0x05b2('0x1a')](function(_0x1321a1){logger['info'](_0x05b2('0x27'));return _0x1321a1[_0x05b2('0x28')];});}});}else{logger['info'](_0x05b2('0x26'));return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x29'),_0x28154b['remoteUri'])})[_0x05b2('0x1a')](function(_0x42dfa8){logger['info'](_0x05b2('0x27'));return _0x42dfa8['user'];});}}function getEndUser(_0x40592b,_0x3536d0,_0x490a69){logger[_0x05b2('0xe')](_0x05b2('0x2a'),_0x490a69);return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x1f'),_0x40592b[_0x05b2('0x20')]),'qs':{'query':util['format'](_0x05b2('0x2b'),_0x490a69)}})[_0x05b2('0x1a')](function(_0x30e40b){var _0x34fb99;if(_0x30e40b[_0x05b2('0x24')][_0x05b2('0x2c')]){_0x30e40b[_0x05b2('0x24')]=_[_0x05b2('0x2d')](_0x30e40b['results'],{'suspended':![],'role':'end-user'});if(_0x30e40b[_0x05b2('0x24')][_0x05b2('0x2c')]){_0x34fb99=_[_0x05b2('0x2e')](_0x30e40b[_0x05b2('0x24')]);}}if(_0x34fb99){logger[_0x05b2('0xe')](_0x05b2('0x2f'));return _0x34fb99;}else{logger[_0x05b2('0xe')](_0x05b2('0x30'));return request({'uri':util[_0x05b2('0x10')]('%s/users.json',_0x40592b[_0x05b2('0x20')]),'method':_0x05b2('0x12'),'body':{'user':{'role':'end-user','name':util['format']('Caller\x20-\x20%s',_0x3536d0||_0x490a69),'phone':_0x490a69}}})['then'](function(_0x411fa2){logger[_0x05b2('0xe')](_0x05b2('0x31'));return _0x411fa2[_0x05b2('0x28')];});}});}function getAuth(_0x3f4c68){var _0x420136;if(_0x3f4c68[_0x05b2('0x32')]===_0x05b2('0x33')){_0x420136=util[_0x05b2('0x10')](_0x05b2('0x34'),_0x3f4c68[_0x05b2('0x35')],_0x3f4c68['password']);}else if(_0x3f4c68[_0x05b2('0x32')]===_0x05b2('0x36')){_0x420136=util[_0x05b2('0x10')]('%s/token:%s',_0x3f4c68[_0x05b2('0x35')],_0x3f4c68['token']);}return util['format'](_0x05b2('0x37'),new Buffer(_0x420136)[_0x05b2('0x38')]('base64'));}function request(_0x186ab1){logger['debug'](_0x05b2('0x39'),JSON[_0x05b2('0x3a')](_0x186ab1));return rp(_[_0x05b2('0x9')](_0x186ab1,{'method':_0x05b2('0x3b'),'headers':headers,'json':!![]}));}function getTags(_0x2808e1,_0x5d204e){var _0x1e86ff=[];if(_0x2808e1&&_0x2808e1[_0x05b2('0x2c')]>0x0){_0x1e86ff=_[_0x05b2('0x3c')](_0x2808e1,_0x5d204e);}return _0x1e86ff;}function getCustomFields(_0x418cb0,_0xf10abd){var _0x1184cf=[];var _0x4d4194={'custom_fields':[]};if(_0x418cb0[_0x05b2('0x2c')]>0x0){_[_0x05b2('0x3d')](_0x418cb0,function(_0x42221f){if(_[_0x05b2('0x3e')]([_0x05b2('0x3f'),'picklist'],_0x42221f[_0x05b2('0x40')])&&_0x42221f['nameField']&&!_0x42221f['customField']){_0x4d4194[_0x42221f[_0x05b2('0x41')][_0x05b2('0x42')]()]=_0x42221f[_0x05b2('0x43')][_0x05b2('0x38')]();}else if(_['includes']([_0x05b2('0x3f'),_0x05b2('0x44')],_0x42221f['type'])&&_0x42221f[_0x05b2('0x45')]&&_0x42221f[_0x05b2('0x46')]){_0x4d4194['custom_fields'][_0x05b2('0x47')]({'id':_0x42221f['idField'],'value':_0x42221f['content'][_0x05b2('0x38')]()});}else if(_0x42221f['type']===_0x05b2('0x48')&&_0x42221f[_0x05b2('0x49')]&&_0x42221f[_0x05b2('0x45')]&&_0x42221f[_0x05b2('0x46')]){_0xf10abd[_0x42221f[_0x05b2('0x49')]]&&_0x4d4194[_0x05b2('0x4a')][_0x05b2('0x47')]({'id':_0x42221f[_0x05b2('0x45')],'value':_0xf10abd[_0x42221f[_0x05b2('0x49')]][_0x05b2('0x38')]()});}else if(_0x42221f['type']===_0x05b2('0x4b')&&_0x42221f[_0x05b2('0x4c')]&&_0x42221f[_0x05b2('0x4c')][_0x05b2('0x15')]&&_0x42221f['idField']&&_0x42221f[_0x05b2('0x46')]){_0xf10abd[_0x42221f['Variable'][_0x05b2('0x15')]['toLowerCase']()]&&_0x4d4194['custom_fields']['push']({'id':_0x42221f[_0x05b2('0x45')],'value':_0xf10abd[_0x42221f[_0x05b2('0x4c')][_0x05b2('0x15')][_0x05b2('0x42')]()][_0x05b2('0x38')]()});}});}return _0x4d4194;}exports[_0x05b2('0x4d')]=function(_0x205d62,_0x3193ed,_0x462bfe,_0x3a7dcf,_0x357f98,_0x45d8d8){var _0x3acc6b,_0x298913;_0x45d8d8[_0x05b2('0x20')]=intUtil[_0x05b2('0x4e')](_0x45d8d8[_0x05b2('0x20')]);_0x45d8d8[_0x05b2('0x4f')]=intUtil[_0x05b2('0x4e')](_0x45d8d8[_0x05b2('0x4f')]);if(_0x357f98&&_0x357f98[_0x05b2('0x50')]){logger[_0x05b2('0xe')](_0x05b2('0x51'),_0x05b2('0x52'));_0x3193ed[_0x05b2('0x53')]=util[_0x05b2('0x10')](_0x05b2('0x54'),_0x45d8d8[_0x05b2('0x4f')],_0x3193ed[_0x05b2('0x55')],md5(_0x3193ed['uniqueid']));}else{_0x3193ed[_0x05b2('0x53')]='';}headers[_0x05b2('0x56')]=getAuth(_0x45d8d8);return getUser(_0x45d8d8,_0x3a7dcf[_0x05b2('0x57')])['then'](function(_0xc656fa){_0x3acc6b=_0xc656fa;logger[_0x05b2('0xe')](_0x05b2('0x58'),_0x3acc6b['id']);return getEndUser(_0x45d8d8,_0x3193ed[_0x05b2('0x59')],_0x3193ed[_0x05b2('0x5a')]);})[_0x05b2('0x1a')](function(_0x1440ea){_0x298913=_0x1440ea;logger[_0x05b2('0xe')]('The\x20Enduser\x20ID\x20is:',_0x298913['id']);return getTicket(_0x45d8d8,_0x3acc6b,_0x298913,_0x462bfe,_0x3193ed);})[_0x05b2('0x1a')](function(_0x4a029d){if(_0x4a029d){logger['info'](_0x05b2('0x5b'),_0x4a029d['id']);switch(_0x45d8d8['type']){case _0x05b2('0x5c'):logger[_0x05b2('0xe')]('[QUEUE]',_0x05b2('0x5d'));return request({'uri':util[_0x05b2('0x10')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x45d8d8[_0x05b2('0x20')],_0x3acc6b['id'],_0x4a029d['id']),'method':_0x05b2('0x12')});case'newTab':logger['info'](_0x05b2('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x05b2('0x5e'),_0x3a7dcf['name']),'trigger:browser:url',{'uri':util[_0x05b2('0x10')](_0x05b2('0x5f'),_0x45d8d8[_0x05b2('0x20')]['replace'](_0x05b2('0x60'),''),_0x4a029d['id'])});break;default:logger[_0x05b2('0x61')](_0x05b2('0x51'),_0x05b2('0x62'));}}})[_0x05b2('0x63')](function(_0x4dfe45){logger[_0x05b2('0x61')](_0x05b2('0x64'),util[_0x05b2('0x65')](_0x4dfe45,{'showHidden':!![],'depth':null}));});};exports[_0x05b2('0x66')]=function(_0x3f0365,_0x2008ca,_0x1f8b77,_0x4d29b6,_0x472fb6,_0x20e2b9,_0x58aa10){var _0x328d2f,_0x562ac0;_0x20e2b9[_0x05b2('0x20')]=intUtil[_0x05b2('0x4e')](_0x20e2b9['remoteUri']);_0x20e2b9['serverUrl']=intUtil[_0x05b2('0x4e')](_0x20e2b9[_0x05b2('0x4f')]);if(_0x58aa10&&_0x58aa10[_0x05b2('0x67')]&&_0x58aa10[_0x05b2('0x67')]!=='none'){logger['info'](_0x05b2('0x68'),_0x05b2('0x52'));_0x2008ca['recordingURL']=util[_0x05b2('0x10')](_0x05b2('0x54'),_0x20e2b9[_0x05b2('0x4f')],_0x2008ca[_0x05b2('0x55')],md5(_0x2008ca[_0x05b2('0x55')]));}headers[_0x05b2('0x56')]=getAuth(_0x20e2b9);return getUser(_0x20e2b9,_0x4d29b6[_0x05b2('0x57')])[_0x05b2('0x1a')](function(_0x4493ed){_0x328d2f=_0x4493ed;logger['info']('The\x20User\x20ID\x20is:',_0x328d2f['id']);return getEndUser(_0x20e2b9,_0x2008ca[_0x05b2('0x69')],_0x2008ca['destcalleridnum']);})['then'](function(_0xf3902f){_0x562ac0=_0xf3902f;logger[_0x05b2('0xe')](_0x05b2('0x6a'),_0x562ac0['id']);return getTicket(_0x20e2b9,_0x328d2f,_0x562ac0,_0x1f8b77,_0x2008ca);})[_0x05b2('0x1a')](function(_0x29d5f8){if(_0x29d5f8){logger['info'](_0x05b2('0x5b'),_0x29d5f8['id']);switch(_0x20e2b9[_0x05b2('0x40')]){case _0x05b2('0x5c'):logger[_0x05b2('0xe')](_0x05b2('0x68'),_0x05b2('0x5d'));return request({'uri':util[_0x05b2('0x10')](_0x05b2('0x6b'),_0x20e2b9[_0x05b2('0x20')],_0x328d2f['id'],_0x29d5f8['id']),'method':'POST'});case _0x05b2('0x6c'):logger[_0x05b2('0xe')]('[OUTBOUND]',_0x05b2('0x6d'));emit(util[_0x05b2('0x10')](_0x05b2('0x5e'),_0x4d29b6[_0x05b2('0x15')]),_0x05b2('0x6e'),{'uri':util[_0x05b2('0x10')](_0x05b2('0x5f'),_0x20e2b9[_0x05b2('0x20')][_0x05b2('0x6f')](_0x05b2('0x60'),''),_0x29d5f8['id'])});break;default:logger[_0x05b2('0x61')](_0x05b2('0x68'),_0x05b2('0x62'));}}})[_0x05b2('0x63')](function(_0x5f3b8b){logger[_0x05b2('0x61')](_0x05b2('0x70'),util['inspect'](_0x5f3b8b,{'showHidden':!![],'depth':null}));});};exports[_0x05b2('0x71')]=function(_0x50b70b,_0x1d40ad,_0x1606d5,_0x1ee43d,_0x2700d7,_0x2e3f00){var _0x190608,_0x5e2098;_0x2e3f00[_0x05b2('0x20')]=intUtil['stripTrailingSlash'](_0x2e3f00['remoteUri']);_0x2e3f00['serverUrl']=intUtil[_0x05b2('0x4e')](_0x2e3f00[_0x05b2('0x4f')]);if(_0x2700d7&&_0x2700d7[_0x05b2('0x50')]){logger[_0x05b2('0xe')]('['+_0x1d40ad['lastevent'][_0x05b2('0x72')]()+']',_0x05b2('0x52'));_0x1d40ad[_0x05b2('0x53')]=util[_0x05b2('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2e3f00[_0x05b2('0x4f')],_0x1d40ad[_0x05b2('0x55')],md5(_0x1d40ad[_0x05b2('0x55')]));}else{_0x1d40ad[_0x05b2('0x53')]='';}headers[_0x05b2('0x56')]=getAuth(_0x2e3f00);return getUser(_0x2e3f00)[_0x05b2('0x1a')](function(_0x1aecc8){_0x190608=_0x1aecc8;logger[_0x05b2('0xe')](_0x05b2('0x58'),_0x190608['id']);return getEndUser(_0x2e3f00,_0x1d40ad[_0x05b2('0x59')],_0x1d40ad['calleridnum']);})[_0x05b2('0x1a')](function(_0xc226f9){_0x5e2098=_0xc226f9;logger['info'](_0x05b2('0x6a'),_0x5e2098['id']);return getTicket(_0x2e3f00,_0x190608,_0x5e2098,_0x1606d5,_0x1d40ad);})[_0x05b2('0x1a')](function(_0x3f1999){if(_0x3f1999){logger[_0x05b2('0xe')](_0x05b2('0x5b'),_0x3f1999['id']);}})[_0x05b2('0x63')](function(_0x346980){logger['error']('['+_0x1d40ad['lastevent'][_0x05b2('0x72')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0x05b2('0x65')](_0x346980,{'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 138254e..8c553e7 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 _0xc411=['defaults','localhost','socket.io-emitter','emit','[HTTP]','forEach','includes','string','picklist','type','idField','toString','variable','variableName','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','Agent\x20found!','info','Administrator','user','profile','Using\x20the\x20admin\x20account!','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','/crm/v2/','startCase','moduleCreate','role','first_name','code','SUCCESS','details','log','contact_lead','uri','Leads','nothing','contact','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','last_name','Subject','Subjects','Description','getString','Descriptions','Contacts','Full_Name','First_Name','Last_Name','$se_module','talktime','Call_Duration','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','Call_Result','connect','Answered','abandoned','Abandoned','timeout','outbound','agentcalledAt','Call_Type','Inbound','merge','/crm/v2/Calls','Call\x20created!','err','stack','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','calleridname','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','/downloads?type=uniqueid&token=','email','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','[OUTBOUND]','monitor_format','lastevent','toUpperCase','Recording\x20is\x20enabled!','request-promise','md5','util','./util','ioredis','bluebird','../../../../config/logger','redis'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xc411,0x1b4));var _0x1c41=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0xc411[_0x41ee16];return _0x1f60de;};'use strict';var _=require('lodash');var rp=require(_0x1c41('0x0'));var md5=require(_0x1c41('0x1'));var util=require(_0x1c41('0x2'));var intUtil=require(_0x1c41('0x3'));var moment=require('moment');var Redis=require(_0x1c41('0x4'));var BPromise=require(_0x1c41('0x5'));var config=require('../../../../config/environment');var logger=require(_0x1c41('0x6'))('zoho');config[_0x1c41('0x7')]=_[_0x1c41('0x8')](config[_0x1c41('0x7')],{'host':_0x1c41('0x9'),'port':0x18eb});var io=require(_0x1c41('0xa'))(new Redis(config[_0x1c41('0x7')]));function emit(_0x23bca9,_0x258829,_0x2b1186){io['to'](_0x23bca9)[_0x1c41('0xb')](_0x258829,_0x2b1186);}function request(_0x128e04){logger['debug'](_0x1c41('0xc'),JSON['stringify'](_0x128e04));return rp(_0x128e04);}function getCustomFields(_0x705e4e,_0x48ddfe){var _0x403088={};if(_0x705e4e['length']>0x0){_[_0x1c41('0xd')](_0x705e4e,function(_0x13fb8c){if(_[_0x1c41('0xe')]([_0x1c41('0xf'),_0x1c41('0x10')],_0x13fb8c[_0x1c41('0x11')])&&_0x13fb8c[_0x1c41('0x12')]){_0x403088[_0x13fb8c[_0x1c41('0x12')]]=_0x13fb8c['content'][_0x1c41('0x13')]();}else if(_0x13fb8c[_0x1c41('0x11')]===_0x1c41('0x14')&&_0x13fb8c[_0x1c41('0x15')]&&_0x13fb8c['idField']&&_0x48ddfe[_0x13fb8c['variableName']]){_0x403088[_0x13fb8c['idField']]=_0x48ddfe[_0x13fb8c['variableName']][_0x1c41('0x13')]();}else if(_0x13fb8c['type']==='customVariable'&&_0x13fb8c[_0x1c41('0x16')]&&_0x13fb8c[_0x1c41('0x16')]['name']&&_0x13fb8c[_0x1c41('0x12')]&&_0x48ddfe[_0x13fb8c[_0x1c41('0x16')][_0x1c41('0x17')][_0x1c41('0x18')]()]){_0x403088[_0x13fb8c[_0x1c41('0x12')]]=_0x48ddfe[_0x13fb8c['Variable'][_0x1c41('0x17')][_0x1c41('0x18')]()][_0x1c41('0x13')]();}});}return _0x403088;}function getName(_0x11bea9){if(_0x11bea9[_0x1c41('0x19')]('\x20')>0x0){var _0x2922e8=_0x11bea9[_0x1c41('0x1a')](/ (.+)/);if(_0x2922e8[0x1]){return _0x2922e8;}}return[_0x11bea9,_0x11bea9];}var accountsTokens={};function getAccessToken(_0x4537f4){return new Promise(function(_0x1c9d30,_0x2c9d01){if(!_[_0x1c41('0x1b')](accountsTokens[_0x4537f4['id']])&&!_['isNil'](accountsTokens[_0x4537f4['id']][_0x1c41('0x1c')])){if(moment()[_0x1c41('0x1d')](accountsTokens[_0x4537f4['id']][_0x1c41('0x1e')])){_0x1c9d30(accountsTokens[_0x4537f4['id']][_0x1c41('0x1c')]);}}var _0x792ebb;switch(_0x4537f4[_0x1c41('0x1f')]){case'US':_0x792ebb=_0x1c41('0x20');break;case'AU':_0x792ebb='https://accounts.zoho.com.au';break;case'EU':_0x792ebb=_0x1c41('0x21');break;case'IN':_0x792ebb=_0x1c41('0x22');break;case'CN':_0x792ebb=_0x1c41('0x23');break;default:_0x792ebb=_0x1c41('0x21');break;}var _0x4b46af={'method':_0x1c41('0x24'),'uri':_0x792ebb+'/oauth/v2/token','qs':{'refresh_token':_0x4537f4[_0x1c41('0x25')],'client_id':_0x4537f4[_0x1c41('0x26')],'client_secret':_0x4537f4[_0x1c41('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x4b46af)[_0x1c41('0x28')](function(_0x54b6e2){accountsTokens[_0x4537f4['id']]={'access_token':_0x54b6e2[_0x1c41('0x1c')],'expires_in':moment()['add'](_0x54b6e2[_0x1c41('0x1e')],_0x1c41('0x29'))};_0x1c9d30(_0x54b6e2[_0x1c41('0x1c')]);})[_0x1c41('0x2a')](function(_0x574c1d){logger[_0x1c41('0x2b')](_0x1c41('0x2c'),_0x574c1d['stack']);_0x2c9d01(_0x574c1d);});});}function getUser(_0x4237ca,_0x460cb8,_0x10dfb2,_0x1c35bf){logger['info'](_0x1c41('0x2d'));return request({'method':_0x1c41('0x2e'),'uri':util['format'](_0x1c41('0x2f'),_0x460cb8),'qs':{'type':_0x1c41('0x30')},'headers':{'Authorization':_0x1c41('0x31')+_0x4237ca},'json':!![]})[_0x1c41('0x28')](function(_0x59f85d){if(_0x59f85d[_0x1c41('0x32')]){var _0x454da5=-0x1;if(_[_0x1c41('0x33')](_0x59f85d[_0x1c41('0x32')])){if(!_[_0x1c41('0x1b')](_0x1c35bf)){_0x454da5=_[_0x1c41('0x34')](_0x59f85d['users'],function(_0x130df3){return _0x130df3['email']===_0x1c35bf;});}if(_0x454da5>=0x0){logger['info'](_0x1c41('0x35'));}else{logger[_0x1c41('0x36')]('Using\x20the\x20admin\x20account!');_0x454da5=_[_0x1c41('0x34')](_0x59f85d['users'],function(_0x285ef1){return _0x285ef1['profile'][_0x1c41('0x17')]===_0x1c41('0x37');});}return _0x59f85d['users'][_0x454da5];}else{if(_0x59f85d[_0x1c41('0x38')][_0x1c41('0x39')]['name']===_0x1c41('0x37')){logger[_0x1c41('0x36')](_0x1c41('0x3a'));user=_0x59f85d[_0x1c41('0x38')];return user;}else{logger[_0x1c41('0x2b')](_0x1c41('0x3b'),JSON[_0x1c41('0x3c')](_0x59f85d));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x1c41('0x3c')](_0x59f85d));}}}else{logger['error'](_0x1c41('0x3b'),JSON[_0x1c41('0x3c')](_0x59f85d));throw new Error(_0x1c41('0x3d')+JSON[_0x1c41('0x3c')](_0x59f85d));}})[_0x1c41('0x2a')](function(_0xb7233c){console[_0x1c41('0x2b')](_0xb7233c);});}function getZohoUser(_0x263444,_0x1d1b1f){return new BPromise(function(_0x567d76,_0xf6d797){request(_0x263444)[_0x1c41('0x28')](function(_0x2a67c2){var _0x437c8b=null;if(_0x2a67c2){_0x437c8b=_0x2a67c2[_0x1c41('0x3e')][0x0];_0x437c8b[_0x1c41('0x3f')]=_0x1d1b1f;}_0x567d76(_0x437c8b);})[_0x1c41('0x2a')](function(_0x111000){_0xf6d797(_0x111000);});});}function createEndUser(_0x4095c1,_0x3eab5e,_0x191785,_0x24a53d,_0x148676,_0xf530a1){var _0x191785=getName(_0x191785);return request({'method':_0x1c41('0x24'),'uri':'https://www.zohoapis.'+_0x3eab5e+_0x1c41('0x40')+_[_0x1c41('0x41')](_0xf530a1[_0x1c41('0x42')])+'s','body':{'data':[{'Last_Name':_0x191785[0x1],'First_Name':_0x191785[0x0],'Phone':_0x24a53d,'Owner':{'name':!_[_0x1c41('0x1b')](_0x148676[_0x1c41('0x43')][_0x1c41('0x17')])?_0x148676['role'][_0x1c41('0x17')]:!_[_0x1c41('0x1b')](_0x148676[_0x1c41('0x44')])?_0x148676[_0x1c41('0x44')]+'\x20'+_0x148676['last_name']:_0x148676['last_name'],'id':_0x148676['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4095c1},'json':!![]})[_0x1c41('0x28')](function(_0x5db160){if(_0x5db160&&_0x5db160[_0x1c41('0x3e')][0x0][_0x1c41('0x45')]===_0x1c41('0x46')){var _0x21382f=_0x5db160[_0x1c41('0x3e')][0x0][_0x1c41('0x47')];_0x21382f[_0x1c41('0x3f')]=_[_0x1c41('0x41')](_0xf530a1['moduleCreate'])+'s';return _0x21382f;}logger['error'](_0x1c41('0x3b'),JSON['stringify'](data));throw new Error('Error:\x20'+JSON[_0x1c41('0x3c')](data));})[_0x1c41('0x2a')](function(_0x6ceac9){console[_0x1c41('0x48')]('CREATE\x20ERROR',_0x6ceac9);});}function getEndUser(_0xce318c,_0x578426,_0x595667,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9){var _0x411fd2={'method':_0x1c41('0x2e'),'uri':'','headers':{'Authorization':_0x1c41('0x31')+_0xce318c},'json':!![]};switch(_0x294ad9['moduleSearch']){case _0x1c41('0x49'):_0x411fd2['uri']='https://www.zohoapis.'+_0x578426+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0xe7eeea+'))';return getZohoUser(_0x411fd2,'Contacts')['then'](function(_0x523012){if(_0x523012)return _0x523012;_0x411fd2[_0x1c41('0x4a')]='https://www.zohoapis.'+_0x578426+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0xe7eeea+'))';return getZohoUser(_0x411fd2,_0x1c41('0x4b'))[_0x1c41('0x28')](function(_0x4a668f){if(_0x4a668f)return _0x4a668f;if(_0x294ad9[_0x1c41('0x42')]!=_0x1c41('0x4c')){return createEndUser(_0xce318c,_0x578426,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9);}else{return{};}});});break;case _0x1c41('0x4d'):_0x411fd2[_0x1c41('0x4a')]=_0x1c41('0x4e')+_0x578426+_0x1c41('0x4f')+_0xe7eeea+'))';return getZohoUser(_0x411fd2,'Contacts')[_0x1c41('0x28')](function(_0x334afb){if(_0x334afb)return _0x334afb;if(_0x294ad9[_0x1c41('0x42')]!=_0x1c41('0x4c')){return createEndUser(_0xce318c,_0x578426,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9);}else{return{};}});break;case'lead':_0x411fd2['uri']='https://www.zohoapis.'+_0x578426+_0x1c41('0x50')+_0xe7eeea+'))';return getZohoUser(_0x411fd2,_0x1c41('0x4b'))[_0x1c41('0x28')](function(_0x3ca837){if(_0x3ca837)return _0x3ca837;if(_0x294ad9['moduleCreate']!=_0x1c41('0x4c')){return createEndUser(_0xce318c,_0x578426,_0x29b76b,_0xe7eeea,_0x2f463d,_0x294ad9);}else{return{};}});break;}}function getCall(_0x2fd130,_0x33bdff,_0xa062a4,_0xb6e81f,_0x36fcaf,_0x1bb7d3,_0x1111f5,_0x44f56c){logger[_0x1c41('0x36')](_0x1c41('0x51'));var _0x5d7b13={};_0x5d7b13['Owner']={'name':!_[_0x1c41('0x1b')](_0xb6e81f[_0x1c41('0x43')][_0x1c41('0x17')])&&!_[_0x1c41('0x1b')](_0xb6e81f[_0x1c41('0x39')][_0x1c41('0x17')])&&_0xb6e81f['profile']['name']==='administrator'?_0xb6e81f[_0x1c41('0x43')][_0x1c41('0x17')]:!_[_0x1c41('0x1b')](_0xb6e81f['first_name'])?_0xb6e81f[_0x1c41('0x44')]+'\x20'+_0xb6e81f[_0x1c41('0x52')]:_0xb6e81f[_0x1c41('0x52')],'id':_0xb6e81f['id']};_0x5d7b13[_0x1c41('0x53')]=intUtil['getString'](_0x1bb7d3[_0x1c41('0x54')],_0x1111f5,'\x20');_0x5d7b13[_0x1c41('0x55')]=intUtil[_0x1c41('0x56')](_0x1bb7d3[_0x1c41('0x57')],_0x1111f5,'\x0a');if(_0x36fcaf['enduserType']===_0x1c41('0x58')){_0x5d7b13['Who_Id']={'name':!_[_0x1c41('0x1b')](_0x36fcaf[_0x1c41('0x59')])?_0x36fcaf[_0x1c41('0x59')]:!_[_0x1c41('0x1b')](_0x36fcaf[_0x1c41('0x5a')])?_0x36fcaf[_0x1c41('0x5a')]+'\x20'+_0x36fcaf[_0x1c41('0x5b')]:_0x36fcaf[_0x1c41('0x5b')],'id':_0x36fcaf['id']};}if(_0x36fcaf[_0x1c41('0x3f')]===_0x1c41('0x4b')){_0x5d7b13['What_Id']={'name':!_['isNil'](_0x36fcaf[_0x1c41('0x59')])?_0x36fcaf['Full_Name']:!_[_0x1c41('0x1b')](_0x36fcaf[_0x1c41('0x5a')])?_0x36fcaf['First_Name']+'\x20'+_0x36fcaf[_0x1c41('0x5b')]:_0x36fcaf[_0x1c41('0x5b')],'id':_0x36fcaf['id']};_0x5d7b13[_0x1c41('0x5c')]=_['startCase'](_0x36fcaf[_0x1c41('0x3f')]);}if(_0x1111f5[_0x1c41('0x5d')]){_0x5d7b13[_0x1c41('0x5e')]=moment[_0x1c41('0x5f')](parseInt(_0x1111f5[_0x1c41('0x5d')])*0x3e8)[_0x1c41('0x60')](_0x1c41('0x61'));}else if(_0x1111f5[_0x1c41('0x62')]&&_0x1111f5[_0x1c41('0x63')]){_0x5d7b13[_0x1c41('0x5e')]=moment[_0x1c41('0x5f')](moment(_0x1111f5[_0x1c41('0x63')],_0x1c41('0x64'))[_0x1c41('0x65')](moment(_0x1111f5[_0x1c41('0x66')],_0x1c41('0x64'))))[_0x1c41('0x60')]('mm:ss');}switch(_0x1111f5['lastevent']){case'called':_0x5d7b13[_0x1c41('0x67')]='Called';break;case'complete':case _0x1c41('0x68'):_0x5d7b13['Call_Result']=_0x1c41('0x69');break;case'rejected':_0x5d7b13[_0x1c41('0x67')]='Rejected';break;case _0x1c41('0x6a'):_0x5d7b13[_0x1c41('0x67')]=_0x1c41('0x6b');break;case _0x1c41('0x6c'):_0x5d7b13[_0x1c41('0x67')]='Timeout';default:}_0x5d7b13['Call_Start_Time']=(_0x44f56c===_0x1c41('0x6d')?moment(_0x1111f5['starttime'])[_0x1c41('0x60')](_0x1c41('0x64')):moment(_0x1111f5[_0x1c41('0x6e')])[_0x1c41('0x60')](_0x1c41('0x64')))||moment()[_0x1c41('0x60')]('YYYY-MM-DDTHH:mm:ss');_0x5d7b13[_0x1c41('0x6f')]=_0x44f56c||_0x1c41('0x70');_0x5d7b13=_[_0x1c41('0x71')](_0x5d7b13,getCustomFields(_0x1bb7d3['Fields'],_0x1111f5));return request({'method':_0x1c41('0x24'),'uri':_0x1c41('0x4e')+_0x33bdff+_0x1c41('0x72'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x2fd130},'body':{'data':[_0x5d7b13]},'json':!![]})[_0x1c41('0x28')](function(_0x1859ad){if(_0x1859ad&&_0x1859ad['data'][0x0]['code']===_0x1c41('0x46')){logger[_0x1c41('0x36')](_0x1c41('0x73'));return{'id':_0x1859ad[_0x1c41('0x3e')][0x0][_0x1c41('0x47')]['id']};}})[_0x1c41('0x2a')](function(_0x115b67){logger['info'](_0x1c41('0x74'),_0x115b67[_0x1c41('0x75')]);console[_0x1c41('0x48')]('err',_0x115b67);});}exports[_0x1c41('0x76')]=function(_0x2f3f6e,_0x591b7d,_0x4a6e88,_0x3196ef,_0x5d7555,_0x35b410){var _0x1be399,_0x304f09,_0x515a53;_0x35b410[_0x1c41('0x77')]=intUtil[_0x1c41('0x78')](_0x35b410['host']);_0x35b410[_0x1c41('0x79')]=intUtil[_0x1c41('0x78')](_0x35b410[_0x1c41('0x79')]);if(_0x5d7555&&_0x5d7555['monitor_format']){logger['info'](_0x1c41('0x7a'),'Recording\x20is\x20enabled!');_0x591b7d[_0x1c41('0x7b')]=_0x35b410['serverUrl']+_0x1c41('0x7c')+_0x591b7d[_0x1c41('0x7d')]+'/downloads?type=uniqueid&token='+md5(_0x591b7d[_0x1c41('0x7d')]);}else{_0x591b7d[_0x1c41('0x7b')]='';}var _0xd7136e=_0x35b410['host']===_0x1c41('0x7e')?'eu':_0x1c41('0x7f');return getAccessToken(_0x35b410)[_0x1c41('0x28')](function(_0x3d54e8){_0x515a53=_0x3d54e8;return getUser(_0x515a53,_0xd7136e,_0x35b410,_0x3196ef['email']);})[_0x1c41('0x28')](function(_0x199010){_0x1be399=_0x199010;logger[_0x1c41('0x36')]('The\x20User\x20ID\x20is:',_0x1be399['id']);return getEndUser(_0x515a53,_0xd7136e,_0x35b410,_0x591b7d[_0x1c41('0x80')],_0x591b7d[_0x1c41('0x81')],_0x1be399,_0x4a6e88);})[_0x1c41('0x28')](function(_0x199a01){_0x304f09=_0x199a01;return getCall(_0x515a53,_0xd7136e,_0x35b410,_0x1be399,_0x304f09,_0x4a6e88,_0x591b7d,_0x1c41('0x70'));})['then'](function(_0x266c10){if(_0x266c10){logger[_0x1c41('0x36')](_0x1c41('0x82'),_0x266c10['id']);logger['info'](_0x1c41('0x7a'),_0x1c41('0x83'));emit(util[_0x1c41('0x60')]('user:%s',_0x3196ef[_0x1c41('0x17')]),_0x1c41('0x84'),{'uri':_0x1c41('0x85')+_0x35b410[_0x1c41('0x77')]+_0x1c41('0x86')+_0x266c10['id']});}})[_0x1c41('0x2a')](function(_0x3022fd){logger[_0x1c41('0x2b')](_0x1c41('0x7a'),JSON[_0x1c41('0x3c')](_0x3022fd));});};exports[_0x1c41('0x6d')]=function(_0x316eff,_0x586576,_0x56b983,_0x1cb9ce,_0x46d997,_0xaabbe8,_0x499f4a){var _0x33d7aa,_0x5c5ada,_0x42c100;_0xaabbe8[_0x1c41('0x77')]=intUtil[_0x1c41('0x78')](_0xaabbe8['host']);_0xaabbe8['serverUrl']=intUtil[_0x1c41('0x78')](_0xaabbe8[_0x1c41('0x79')]);if(_0x499f4a&&_0x499f4a[_0x1c41('0x87')]&&_0x499f4a[_0x1c41('0x87')]!==_0x1c41('0x88')){logger[_0x1c41('0x36')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x586576[_0x1c41('0x7b')]=_0xaabbe8[_0x1c41('0x79')]+'/api/voice/recordings/'+_0x586576['uniqueid']+_0x1c41('0x89')+md5(_0x586576[_0x1c41('0x7d')]);}var _0x312870=_0xaabbe8['host']===_0x1c41('0x7e')?'eu':_0x1c41('0x7f');return getAccessToken(_0xaabbe8)[_0x1c41('0x28')](function(_0x2d2a8f){_0x42c100=_0x2d2a8f;return getUser(_0x42c100,_0x312870,_0xaabbe8,_0x1cb9ce[_0x1c41('0x8a')]);})['then'](function(_0x5881f6){_0x33d7aa=_0x5881f6;logger[_0x1c41('0x36')](_0x1c41('0x8b'),_0x33d7aa['id']);return getEndUser(_0x42c100,_0x312870,_0xaabbe8,_0x586576[_0x1c41('0x8c')],_0x586576[_0x1c41('0x8d')],_0x33d7aa,_0x56b983);})[_0x1c41('0x28')](function(_0x2fb03e){_0x5c5ada=_0x2fb03e;return getCall(_0x42c100,_0x312870,_0xaabbe8,_0x33d7aa,_0x5c5ada,_0x56b983,_0x586576,_0x1c41('0x8e'));})[_0x1c41('0x28')](function(_0x496205){if(_0x496205){logger[_0x1c41('0x36')](_0x1c41('0x82'),_0x496205['id']);logger['info'](_0x1c41('0x8f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x1c41('0x60')]('user:%s',_0x1cb9ce[_0x1c41('0x17')]),_0x1c41('0x84'),{'uri':_0x1c41('0x85')+_0xaabbe8[_0x1c41('0x77')]+_0x1c41('0x86')+_0x496205['id']});}})[_0x1c41('0x2a')](function(_0x96c19){logger[_0x1c41('0x2b')](_0x1c41('0x8f'),JSON[_0x1c41('0x3c')](_0x96c19));});};exports['unmanaged']=function(_0x2f5248,_0x650b55,_0x5c5116,_0x595ea5,_0x524a4c,_0x573b54){var _0x3dc3b3,_0xd314f9,_0x2a877e;_0x573b54['host']=intUtil[_0x1c41('0x78')](_0x573b54[_0x1c41('0x77')]);_0x573b54[_0x1c41('0x79')]=intUtil[_0x1c41('0x78')](_0x573b54['serverUrl']);if(_0x524a4c&&_0x524a4c[_0x1c41('0x90')]){logger['info']('['+_0x650b55[_0x1c41('0x91')][_0x1c41('0x92')]()+']',_0x1c41('0x93'));_0x650b55[_0x1c41('0x7b')]=_0x573b54[_0x1c41('0x79')]+_0x1c41('0x7c')+_0x650b55[_0x1c41('0x7d')]+_0x1c41('0x89')+md5(_0x650b55[_0x1c41('0x7d')]);}else{_0x650b55['recordingURL']='';}var _0x4b468d=_0x573b54[_0x1c41('0x77')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x573b54)[_0x1c41('0x28')](function(_0x3fbde2){_0x2a877e=_0x3fbde2;return getUser(_0x2a877e,_0x4b468d,_0x573b54);})[_0x1c41('0x28')](function(_0x2a0980){_0x3dc3b3=_0x2a0980;logger['info']('The\x20User\x20ID\x20is:',_0x3dc3b3['id']);return getEndUser(_0x2a877e,_0x4b468d,_0x573b54,_0x650b55[_0x1c41('0x80')],_0x650b55['calleridnum'],_0x3dc3b3,_0x5c5116);})[_0x1c41('0x28')](function(_0x57ba20){_0xd314f9=_0x57ba20;return getCall(_0x2a877e,_0x4b468d,_0x573b54,_0x3dc3b3,_0xd314f9,_0x5c5116,_0x650b55,'Inbound');})[_0x1c41('0x28')](function(_0x34bf8c){if(_0x34bf8c){logger[_0x1c41('0x36')](_0x1c41('0x82'),_0x34bf8c['id']);}})['catch'](function(_0x305da6){logger['error']('['+_0x650b55[_0x1c41('0x91')][_0x1c41('0x92')]()+']',JSON[_0x1c41('0x3c')](_0x305da6));});}; \ No newline at end of file +var _0x984b=['details','enduserType','Error:\x20','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Creating\x20new\x20call...','Owner','Subject','getString','Subjects','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','utc','mm:ss','answertime','endtime','starttime','called','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','timeout','Timeout','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','stack','queue','host','stripTrailingSlash','serverUrl','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','calleridname','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','outbound','recordingFormat','none','/downloads?type=uniqueid&token=','com','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','/crm/EntityInfo.do?module=Calls&id=','monitor_format','toUpperCase','The\x20User\x20ID\x20is:','calleridnum','lastevent','util','./util','moment','../../../../config/environment','../../../../config/logger','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','includes','picklist','idField','toString','type','variableName','Variable','name','toLowerCase','indexOf','split','isNil','isBefore','expires_in','access_token','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','error','Failing\x20creating\x20the\x20access_token','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','users','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS'];(function(_0x4d522c,_0x5c15e4){var _0x34a72e=function(_0x47e107){while(--_0x47e107){_0x4d522c['push'](_0x4d522c['shift']());}};_0x34a72e(++_0x5c15e4);}(_0x984b,0xee));var _0xb984=function(_0x493f30,_0x21d8b6){_0x493f30=_0x493f30-0x0;var _0x19c13a=_0x984b[_0x493f30];return _0x19c13a;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xb984('0x0'));var intUtil=require(_0xb984('0x1'));var moment=require(_0xb984('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0xb984('0x3'));var logger=require(_0xb984('0x4'))('zoho');config['redis']=_[_0xb984('0x5')](config[_0xb984('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xb984('0x7'))(new Redis(config[_0xb984('0x6')]));function emit(_0x4d72b7,_0x37fd36,_0x4e6b9a){io['to'](_0x4d72b7)[_0xb984('0x8')](_0x37fd36,_0x4e6b9a);}function request(_0x42dfd9){logger[_0xb984('0x9')](_0xb984('0xa'),JSON[_0xb984('0xb')](_0x42dfd9));return rp(_0x42dfd9);}function getCustomFields(_0x382f2b,_0x11525c){var _0xfca315={};if(_0x382f2b[_0xb984('0xc')]>0x0){_[_0xb984('0xd')](_0x382f2b,function(_0x1f107f){if(_[_0xb984('0xe')](['string',_0xb984('0xf')],_0x1f107f['type'])&&_0x1f107f[_0xb984('0x10')]){_0xfca315[_0x1f107f[_0xb984('0x10')]]=_0x1f107f['content'][_0xb984('0x11')]();}else if(_0x1f107f[_0xb984('0x12')]==='variable'&&_0x1f107f[_0xb984('0x13')]&&_0x1f107f[_0xb984('0x10')]&&_0x11525c[_0x1f107f['variableName']]){_0xfca315[_0x1f107f[_0xb984('0x10')]]=_0x11525c[_0x1f107f[_0xb984('0x13')]]['toString']();}else if(_0x1f107f[_0xb984('0x12')]==='customVariable'&&_0x1f107f[_0xb984('0x14')]&&_0x1f107f[_0xb984('0x14')][_0xb984('0x15')]&&_0x1f107f[_0xb984('0x10')]&&_0x11525c[_0x1f107f['Variable'][_0xb984('0x15')][_0xb984('0x16')]()]){_0xfca315[_0x1f107f[_0xb984('0x10')]]=_0x11525c[_0x1f107f[_0xb984('0x14')][_0xb984('0x15')][_0xb984('0x16')]()]['toString']();}});}return _0xfca315;}function getName(_0x2492f4){if(_0x2492f4[_0xb984('0x17')]('\x20')>0x0){var _0x694978=_0x2492f4[_0xb984('0x18')](/ (.+)/);if(_0x694978[0x1]){return _0x694978;}}return[_0x2492f4,_0x2492f4];}var accountsTokens={};function getAccessToken(_0x32831b){return new Promise(function(_0xcf9365,_0x54dd81){if(!_[_0xb984('0x19')](accountsTokens[_0x32831b['id']])&&!_[_0xb984('0x19')](accountsTokens[_0x32831b['id']]['access_token'])){if(moment()[_0xb984('0x1a')](accountsTokens[_0x32831b['id']][_0xb984('0x1b')])){_0xcf9365(accountsTokens[_0x32831b['id']][_0xb984('0x1c')]);}}var _0x932579;switch(_0x32831b[_0xb984('0x1d')]){case'US':_0x932579=_0xb984('0x1e');break;case'AU':_0x932579=_0xb984('0x1f');break;case'EU':_0x932579='https://accounts.zoho.eu';break;case'IN':_0x932579=_0xb984('0x20');break;case'CN':_0x932579=_0xb984('0x21');break;default:_0x932579=_0xb984('0x22');break;}var _0x5d4d38={'method':_0xb984('0x23'),'uri':_0x932579+_0xb984('0x24'),'qs':{'refresh_token':_0x32831b[_0xb984('0x25')],'client_id':_0x32831b[_0xb984('0x26')],'client_secret':_0x32831b[_0xb984('0x27')],'grant_type':_0xb984('0x28')},'json':!![]};return rp(_0x5d4d38)[_0xb984('0x29')](function(_0x4b3da0){accountsTokens[_0x32831b['id']]={'access_token':_0x4b3da0['access_token'],'expires_in':moment()[_0xb984('0x2a')](_0x4b3da0[_0xb984('0x1b')],_0xb984('0x2b'))};_0xcf9365(_0x4b3da0[_0xb984('0x1c')]);})['catch'](function(_0xa44895){logger[_0xb984('0x2c')](_0xb984('0x2d'),_0xa44895['stack']);_0x54dd81(_0xa44895);});});}function getUser(_0x363e33,_0x311e22,_0x2012ca,_0x3d2757){logger['info']('Search\x20user');return request({'method':'GET','uri':util[_0xb984('0x2e')](_0xb984('0x2f'),_0x311e22),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xb984('0x30')+_0x363e33},'json':!![]})[_0xb984('0x29')](function(_0x30d338){if(_0x30d338[_0xb984('0x31')]){var _0x518bef=-0x1;if(_['isArrayLikeObject'](_0x30d338[_0xb984('0x31')])){if(!_[_0xb984('0x19')](_0x3d2757)){_0x518bef=_[_0xb984('0x32')](_0x30d338[_0xb984('0x31')],function(_0x4df9e0){return _0x4df9e0[_0xb984('0x33')]===_0x3d2757;});}if(_0x518bef>=0x0){logger[_0xb984('0x34')](_0xb984('0x35'));}else{logger[_0xb984('0x34')](_0xb984('0x36'));_0x518bef=_[_0xb984('0x32')](_0x30d338['users'],function(_0x54a293){return _0x54a293[_0xb984('0x37')][_0xb984('0x15')]===_0xb984('0x38');});}return _0x30d338[_0xb984('0x31')][_0x518bef];}else{if(_0x30d338[_0xb984('0x39')]['profile'][_0xb984('0x15')]===_0xb984('0x38')){logger['info']('Using\x20the\x20admin\x20account!');user=_0x30d338[_0xb984('0x39')];return user;}else{logger['error'](_0xb984('0x3a'),JSON[_0xb984('0xb')](_0x30d338));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xb984('0xb')](_0x30d338));}}}else{logger['error'](_0xb984('0x3a'),JSON['stringify'](_0x30d338));throw new Error(_0xb984('0x3b')+JSON['stringify'](_0x30d338));}})['catch'](function(_0xf6d925){console[_0xb984('0x2c')](_0xf6d925);});}function getZohoUser(_0x4dac3f,_0x26b36c){return new BPromise(function(_0x1fd248,_0x4a8171){request(_0x4dac3f)[_0xb984('0x29')](function(_0x446f45){var _0x1a635b=null;if(_0x446f45){_0x1a635b=_0x446f45[_0xb984('0x3c')][0x0];_0x1a635b['enduserType']=_0x26b36c;}_0x1fd248(_0x1a635b);})[_0xb984('0x3d')](function(_0x4d6511){_0x4a8171(_0x4d6511);});});}function createEndUser(_0x383c87,_0x474fbd,_0x2d93d5,_0x345a60,_0xc257ee,_0x2e625a){var _0x2d93d5=getName(_0x2d93d5);return request({'method':_0xb984('0x23'),'uri':'https://www.zohoapis.'+_0x474fbd+_0xb984('0x3e')+_[_0xb984('0x3f')](_0x2e625a[_0xb984('0x40')])+'s','body':{'data':[{'Last_Name':_0x2d93d5[0x1],'First_Name':_0x2d93d5[0x0],'Phone':_0x345a60,'Owner':{'name':!_[_0xb984('0x19')](_0xc257ee[_0xb984('0x41')][_0xb984('0x15')])?_0xc257ee[_0xb984('0x41')][_0xb984('0x15')]:!_['isNil'](_0xc257ee['first_name'])?_0xc257ee[_0xb984('0x42')]+'\x20'+_0xc257ee['last_name']:_0xc257ee[_0xb984('0x43')],'id':_0xc257ee['id']}}]},'headers':{'Authorization':_0xb984('0x30')+_0x383c87},'json':!![]})[_0xb984('0x29')](function(_0x1660a1){if(_0x1660a1&&_0x1660a1['data'][0x0][_0xb984('0x44')]===_0xb984('0x45')){var _0x5d5e85=_0x1660a1[_0xb984('0x3c')][0x0][_0xb984('0x46')];_0x5d5e85[_0xb984('0x47')]=_[_0xb984('0x3f')](_0x2e625a[_0xb984('0x40')])+'s';return _0x5d5e85;}logger[_0xb984('0x2c')](_0xb984('0x3a'),JSON['stringify'](data));throw new Error(_0xb984('0x48')+JSON[_0xb984('0xb')](data));})['catch'](function(_0x5cb1dd){console[_0xb984('0x49')](_0xb984('0x4a'),_0x5cb1dd);});}function getEndUser(_0x3f1ea9,_0x248800,_0x1acc7a,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65){var _0x25413d={'method':_0xb984('0x4b'),'uri':'','headers':{'Authorization':_0xb984('0x30')+_0x3f1ea9},'json':!![]};switch(_0x424f65[_0xb984('0x4c')]){case _0xb984('0x4d'):_0x25413d[_0xb984('0x4e')]=_0xb984('0x4f')+_0x248800+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x50'))[_0xb984('0x29')](function(_0x4bd4db){if(_0x4bd4db)return _0x4bd4db;_0x25413d[_0xb984('0x4e')]=_0xb984('0x4f')+_0x248800+_0xb984('0x51')+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x52'))[_0xb984('0x29')](function(_0x49dde7){if(_0x49dde7)return _0x49dde7;if(_0x424f65[_0xb984('0x40')]!=_0xb984('0x53')){return createEndUser(_0x3f1ea9,_0x248800,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65);}else{return{};}});});break;case _0xb984('0x54'):_0x25413d[_0xb984('0x4e')]='https://www.zohoapis.'+_0x248800+_0xb984('0x55')+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x50'))[_0xb984('0x29')](function(_0x2ae0d8){if(_0x2ae0d8)return _0x2ae0d8;if(_0x424f65[_0xb984('0x40')]!=_0xb984('0x53')){return createEndUser(_0x3f1ea9,_0x248800,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65);}else{return{};}});break;case _0xb984('0x56'):_0x25413d[_0xb984('0x4e')]=_0xb984('0x4f')+_0x248800+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x664cb1+'))';return getZohoUser(_0x25413d,_0xb984('0x52'))[_0xb984('0x29')](function(_0x3a7cbb){if(_0x3a7cbb)return _0x3a7cbb;if(_0x424f65['moduleCreate']!=_0xb984('0x53')){return createEndUser(_0x3f1ea9,_0x248800,_0x56a3bf,_0x664cb1,_0x40666f,_0x424f65);}else{return{};}});break;}}function getCall(_0x42a9f8,_0x4e777e,_0xdb477,_0x481eac,_0x364416,_0x3a9ec3,_0x5a1a34,_0xa51a2d){logger[_0xb984('0x34')](_0xb984('0x57'));var _0x3ddeb5={};_0x3ddeb5[_0xb984('0x58')]={'name':!_[_0xb984('0x19')](_0x481eac['role'][_0xb984('0x15')])&&!_['isNil'](_0x481eac[_0xb984('0x37')][_0xb984('0x15')])&&_0x481eac[_0xb984('0x37')]['name']==='administrator'?_0x481eac[_0xb984('0x41')][_0xb984('0x15')]:!_['isNil'](_0x481eac['first_name'])?_0x481eac[_0xb984('0x42')]+'\x20'+_0x481eac[_0xb984('0x43')]:_0x481eac[_0xb984('0x43')],'id':_0x481eac['id']};_0x3ddeb5[_0xb984('0x59')]=intUtil[_0xb984('0x5a')](_0x3a9ec3[_0xb984('0x5b')],_0x5a1a34,'\x20');_0x3ddeb5['Description']=intUtil['getString'](_0x3a9ec3[_0xb984('0x5c')],_0x5a1a34,'\x0a');if(_0x364416[_0xb984('0x47')]==='Contacts'){_0x3ddeb5[_0xb984('0x5d')]={'name':!_[_0xb984('0x19')](_0x364416[_0xb984('0x5e')])?_0x364416[_0xb984('0x5e')]:!_['isNil'](_0x364416['First_Name'])?_0x364416[_0xb984('0x5f')]+'\x20'+_0x364416[_0xb984('0x60')]:_0x364416[_0xb984('0x60')],'id':_0x364416['id']};}if(_0x364416[_0xb984('0x47')]===_0xb984('0x52')){_0x3ddeb5[_0xb984('0x61')]={'name':!_['isNil'](_0x364416[_0xb984('0x5e')])?_0x364416[_0xb984('0x5e')]:!_[_0xb984('0x19')](_0x364416[_0xb984('0x5f')])?_0x364416[_0xb984('0x5f')]+'\x20'+_0x364416[_0xb984('0x60')]:_0x364416['Last_Name'],'id':_0x364416['id']};_0x3ddeb5['$se_module']=_['startCase'](_0x364416[_0xb984('0x47')]);}if(_0x5a1a34[_0xb984('0x62')]){_0x3ddeb5[_0xb984('0x63')]=moment[_0xb984('0x64')](parseInt(_0x5a1a34[_0xb984('0x62')])*0x3e8)['format'](_0xb984('0x65'));}else if(_0x5a1a34[_0xb984('0x66')]&&_0x5a1a34[_0xb984('0x67')]){_0x3ddeb5['Call_Duration']=moment[_0xb984('0x64')](moment(_0x5a1a34[_0xb984('0x67')],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x5a1a34[_0xb984('0x68')],'YYYY-MM-DDTHH:mm:ss')))['format'](_0xb984('0x65'));}switch(_0x5a1a34['lastevent']){case _0xb984('0x69'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x6b');break;case _0xb984('0x6c'):case _0xb984('0x6d'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x6e');break;case _0xb984('0x6f'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x70');break;case _0xb984('0x71'):_0x3ddeb5[_0xb984('0x6a')]='Abandoned';break;case _0xb984('0x72'):_0x3ddeb5[_0xb984('0x6a')]=_0xb984('0x73');default:}_0x3ddeb5['Call_Start_Time']=(_0xa51a2d==='outbound'?moment(_0x5a1a34[_0xb984('0x68')])[_0xb984('0x2e')](_0xb984('0x74')):moment(_0x5a1a34['agentcalledAt'])[_0xb984('0x2e')](_0xb984('0x74')))||moment()[_0xb984('0x2e')](_0xb984('0x74'));_0x3ddeb5[_0xb984('0x75')]=_0xa51a2d||_0xb984('0x76');_0x3ddeb5=_[_0xb984('0x77')](_0x3ddeb5,getCustomFields(_0x3a9ec3[_0xb984('0x78')],_0x5a1a34));return request({'method':_0xb984('0x23'),'uri':_0xb984('0x4f')+_0x4e777e+_0xb984('0x79'),'headers':{'Authorization':_0xb984('0x30')+_0x42a9f8},'body':{'data':[_0x3ddeb5]},'json':!![]})[_0xb984('0x29')](function(_0x9ea21f){if(_0x9ea21f&&_0x9ea21f['data'][0x0][_0xb984('0x44')]==='SUCCESS'){logger[_0xb984('0x34')]('Call\x20created!');return{'id':_0x9ea21f[_0xb984('0x3c')][0x0][_0xb984('0x46')]['id']};}})[_0xb984('0x3d')](function(_0xae996e){logger[_0xb984('0x34')](_0xb984('0x7a'),_0xae996e[_0xb984('0x7b')]);console[_0xb984('0x49')](_0xb984('0x7a'),_0xae996e);});}exports[_0xb984('0x7c')]=function(_0x2976f1,_0x4247e7,_0x23c3d5,_0x588e45,_0x4886bf,_0x917c53){var _0x441166,_0x1e90ae,_0x48f52d;_0x917c53[_0xb984('0x7d')]=intUtil[_0xb984('0x7e')](_0x917c53['host']);_0x917c53['serverUrl']=intUtil['stripTrailingSlash'](_0x917c53[_0xb984('0x7f')]);if(_0x4886bf&&_0x4886bf['monitor_format']){logger['info']('[QUEUE]',_0xb984('0x80'));_0x4247e7[_0xb984('0x81')]=_0x917c53[_0xb984('0x7f')]+_0xb984('0x82')+_0x4247e7['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x4247e7[_0xb984('0x83')]);}else{_0x4247e7[_0xb984('0x81')]='';}var _0x3c6050=_0x917c53[_0xb984('0x7d')]===_0xb984('0x84')?'eu':'com';return getAccessToken(_0x917c53)[_0xb984('0x29')](function(_0x3e7ed1){_0x48f52d=_0x3e7ed1;return getUser(_0x48f52d,_0x3c6050,_0x917c53,_0x588e45[_0xb984('0x33')]);})[_0xb984('0x29')](function(_0x11992a){_0x441166=_0x11992a;logger[_0xb984('0x34')]('The\x20User\x20ID\x20is:',_0x441166['id']);return getEndUser(_0x48f52d,_0x3c6050,_0x917c53,_0x4247e7[_0xb984('0x85')],_0x4247e7['calleridnum'],_0x441166,_0x23c3d5);})[_0xb984('0x29')](function(_0x1d9392){_0x1e90ae=_0x1d9392;return getCall(_0x48f52d,_0x3c6050,_0x917c53,_0x441166,_0x1e90ae,_0x23c3d5,_0x4247e7,_0xb984('0x76'));})[_0xb984('0x29')](function(_0x1d18e8){if(_0x1d18e8){logger['info'](_0xb984('0x86'),_0x1d18e8['id']);logger[_0xb984('0x34')](_0xb984('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xb984('0x2e')](_0xb984('0x88'),_0x588e45[_0xb984('0x15')]),_0xb984('0x89'),{'uri':_0xb984('0x8a')+_0x917c53['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1d18e8['id']});}})[_0xb984('0x3d')](function(_0x31d101){logger[_0xb984('0x2c')](_0xb984('0x87'),JSON['stringify'](_0x31d101));});};exports[_0xb984('0x8b')]=function(_0x34ce92,_0x286d56,_0x199e48,_0x5e4b1f,_0x1b0673,_0x2725eb,_0x417526){var _0x1a619f,_0x484a35,_0x14cd2c;_0x2725eb[_0xb984('0x7d')]=intUtil[_0xb984('0x7e')](_0x2725eb[_0xb984('0x7d')]);_0x2725eb[_0xb984('0x7f')]=intUtil[_0xb984('0x7e')](_0x2725eb[_0xb984('0x7f')]);if(_0x417526&&_0x417526[_0xb984('0x8c')]&&_0x417526[_0xb984('0x8c')]!==_0xb984('0x8d')){logger[_0xb984('0x34')]('[OUTBOUND]',_0xb984('0x80'));_0x286d56[_0xb984('0x81')]=_0x2725eb[_0xb984('0x7f')]+_0xb984('0x82')+_0x286d56[_0xb984('0x83')]+_0xb984('0x8e')+md5(_0x286d56['uniqueid']);}var _0x7845c7=_0x2725eb[_0xb984('0x7d')]===_0xb984('0x84')?'eu':_0xb984('0x8f');return getAccessToken(_0x2725eb)['then'](function(_0x41a85f){_0x14cd2c=_0x41a85f;return getUser(_0x14cd2c,_0x7845c7,_0x2725eb,_0x5e4b1f[_0xb984('0x33')]);})['then'](function(_0x18d79c){_0x1a619f=_0x18d79c;logger['info']('The\x20User\x20ID\x20is:',_0x1a619f['id']);return getEndUser(_0x14cd2c,_0x7845c7,_0x2725eb,_0x286d56[_0xb984('0x90')],_0x286d56[_0xb984('0x91')],_0x1a619f,_0x199e48);})[_0xb984('0x29')](function(_0xc27f82){_0x484a35=_0xc27f82;return getCall(_0x14cd2c,_0x7845c7,_0x2725eb,_0x1a619f,_0x484a35,_0x199e48,_0x286d56,_0xb984('0x92'));})[_0xb984('0x29')](function(_0x110745){if(_0x110745){logger[_0xb984('0x34')](_0xb984('0x86'),_0x110745['id']);logger['info']('[OUTBOUND]',_0xb984('0x93'));emit(util[_0xb984('0x2e')](_0xb984('0x88'),_0x5e4b1f[_0xb984('0x15')]),'trigger:browser:url',{'uri':_0xb984('0x8a')+_0x2725eb[_0xb984('0x7d')]+_0xb984('0x94')+_0x110745['id']});}})[_0xb984('0x3d')](function(_0x199c2){logger[_0xb984('0x2c')]('[OUTBOUND]',JSON[_0xb984('0xb')](_0x199c2));});};exports['unmanaged']=function(_0x38b0e6,_0x56cb5d,_0x3dd59c,_0x4f6b45,_0x55d92d,_0x28b95d){var _0x41fb90,_0x54a2b2,_0x38a5cc;_0x28b95d[_0xb984('0x7d')]=intUtil[_0xb984('0x7e')](_0x28b95d[_0xb984('0x7d')]);_0x28b95d[_0xb984('0x7f')]=intUtil['stripTrailingSlash'](_0x28b95d['serverUrl']);if(_0x55d92d&&_0x55d92d[_0xb984('0x95')]){logger[_0xb984('0x34')]('['+_0x56cb5d['lastevent'][_0xb984('0x96')]()+']',_0xb984('0x80'));_0x56cb5d[_0xb984('0x81')]=_0x28b95d['serverUrl']+_0xb984('0x82')+_0x56cb5d['uniqueid']+_0xb984('0x8e')+md5(_0x56cb5d[_0xb984('0x83')]);}else{_0x56cb5d['recordingURL']='';}var _0x170284=_0x28b95d[_0xb984('0x7d')]===_0xb984('0x84')?'eu':_0xb984('0x8f');return getAccessToken(_0x28b95d)['then'](function(_0x53880c){_0x38a5cc=_0x53880c;return getUser(_0x38a5cc,_0x170284,_0x28b95d);})['then'](function(_0x567cd0){_0x41fb90=_0x567cd0;logger['info'](_0xb984('0x97'),_0x41fb90['id']);return getEndUser(_0x38a5cc,_0x170284,_0x28b95d,_0x56cb5d[_0xb984('0x85')],_0x56cb5d[_0xb984('0x98')],_0x41fb90,_0x3dd59c);})[_0xb984('0x29')](function(_0xf9cc4c){_0x54a2b2=_0xf9cc4c;return getCall(_0x38a5cc,_0x170284,_0x28b95d,_0x41fb90,_0x54a2b2,_0x3dd59c,_0x56cb5d,_0xb984('0x76'));})['then'](function(_0x1e738b){if(_0x1e738b){logger['info']('The\x20Call\x20ID\x20is:',_0x1e738b['id']);}})[_0xb984('0x3d')](function(_0x51af15){logger[_0xb984('0x2c')]('['+_0x56cb5d[_0xb984('0x99')]['toUpperCase']()+']',JSON[_0xb984('0xb')](_0x51af15));});}; \ 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 4386980..f780fef 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 _0x45f7=['trigger','data2','Script','data3','render','exec','info','format','shelljs','mustache','../../../../config/logger'];(function(_0x41cb4b,_0x200468){var _0x1719c1=function(_0x53ad61){while(--_0x53ad61){_0x41cb4b['push'](_0x41cb4b['shift']());}};_0x1719c1(++_0x200468);}(_0x45f7,0x19f));var _0x745f=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x45f7[_0xc7348b];return _0x307cec;};'use strict';var util=require('util');var sh=require(_0x745f('0x0'));var Mustache=require(_0x745f('0x1'));var logger=require(_0x745f('0x2'))(_0x745f('0x3'));exports['exec']=function(_0x3bd7eb,_0x249623){var _0x4abe83=_0x3bd7eb[_0x745f('0x4')]?_0x3bd7eb[_0x745f('0x4')]:_0x745f('0x5');var _0x5170b5=_0x3bd7eb[_0x745f('0x6')]?Mustache[_0x745f('0x7')](_0x3bd7eb[_0x745f('0x6')],_0x249623):_0x249623;sh[_0x745f('0x8')](_0x5170b5,function(_0x51773d,_0x44d33c,_0x539ef5){if(_0x51773d!==0x0){logger['error'](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4abe83,_0x5170b5,_0x51773d,_0x539ef5));}else{logger[_0x745f('0x9')](util[_0x745f('0xa')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x4abe83,_0x5170b5,_0x44d33c));}});}; \ No newline at end of file +var _0xbdcf=['render','data3','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','data2','Script'];(function(_0x45cb66,_0x891fa1){var _0x57d039=function(_0x123c2c){while(--_0x123c2c){_0x45cb66['push'](_0x45cb66['shift']());}};_0x57d039(++_0x891fa1);}(_0xbdcf,0x145));var _0xfbdc=function(_0x5d56d3,_0x5e4b96){_0x5d56d3=_0x5d56d3-0x0;var _0x59358e=_0xbdcf[_0x5d56d3];return _0x59358e;};'use strict';var util=require(_0xfbdc('0x0'));var sh=require(_0xfbdc('0x1'));var Mustache=require(_0xfbdc('0x2'));var logger=require('../../../../config/logger')('trigger');exports['exec']=function(_0x3c07bb,_0x4da76b){var _0x3e31b7=_0x3c07bb[_0xfbdc('0x3')]?_0x3c07bb[_0xfbdc('0x3')]:_0xfbdc('0x4');var _0xd511a3=_0x3c07bb['data3']?Mustache[_0xfbdc('0x5')](_0x3c07bb[_0xfbdc('0x6')],_0x4da76b):_0x4da76b;sh['exec'](_0xd511a3,function(_0x201449,_0x290327,_0x11ffae){if(_0x201449!==0x0){logger['error'](util[_0xfbdc('0x7')](_0xfbdc('0x8'),_0x3e31b7,_0xd511a3,_0x201449,_0x11ffae));}else{logger[_0xfbdc('0x9')](util[_0xfbdc('0x7')](_0xfbdc('0xa'),_0x3e31b7,_0xd511a3,_0x290327));}});}; \ 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 ce7cb29..3c2801d 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 _0x2d77=['mustache','trigger','data1','render','data2','number','data5','headers','parse','data6','error','toUpperCase','DELETE','POST','PUT','data7','body','stack','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','lodash'];(function(_0x27b528,_0x20ab53){var _0x5bf4da=function(_0xb1c7c){while(--_0xb1c7c){_0x27b528['push'](_0x27b528['shift']());}};_0x5bf4da(++_0x20ab53);}(_0x2d77,0xf7));var _0x72d7=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x2d77[_0x5c351c];return _0x26f3b3;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0x72d7('0x0'));var Mustache=require(_0x72d7('0x1'));var logger=require('../../../../config/logger')(_0x72d7('0x2'));exports['exec']=function(_0x2367a6,_0x4ccce1){var _0x523389,_0x5829ac;var _0x594305={'method':_0x2367a6[_0x72d7('0x3')]['toUpperCase'](),'uri':Mustache[_0x72d7('0x4')](_0x2367a6[_0x72d7('0x5')],_0x4ccce1),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2367a6['data5'])===_0x72d7('0x6')&&parseInt(_0x2367a6[_0x72d7('0x7')])>=0x1&&parseInt(_0x2367a6['data5'])<=0xa?parseInt(_0x2367a6['data5'])*0x3e8:0x5*0x3e8};try{_0x594305[_0x72d7('0x8')]=_0x2367a6['data6']?JSON[_0x72d7('0x9')](Mustache['render'](_0x2367a6[_0x72d7('0xa')],_0x4ccce1)):{};}catch(_0x4fbd22){logger[_0x72d7('0xb')](_0x4fbd22['stack']);}switch(_0x2367a6['data1'][_0x72d7('0xc')]()){case'GET':case _0x72d7('0xd'):_0x523389=null;_0x594305['qs']=_0x4ccce1;break;case _0x72d7('0xe'):case _0x72d7('0xf'):if(_0x2367a6[_0x72d7('0x10')]){try{_0x523389=JSON[_0x72d7('0x9')](Mustache[_0x72d7('0x4')](_0x2367a6['data7'],_0x4ccce1));_0x594305[_0x72d7('0x11')]=_0x523389;}catch(_0xa0d530){logger[_0x72d7('0xb')](_0xa0d530[_0x72d7('0x12')]);logger[_0x72d7('0xb')](_0x72d7('0x13'));}}else{_0x523389=_0x4ccce1;_0x594305[_0x72d7('0x11')]=_0x523389;}break;}logger[_0x72d7('0x14')](util[_0x72d7('0x15')](_0x72d7('0x16'),_0x2367a6[_0x72d7('0x3')],_0x2367a6[_0x72d7('0x5')],JSON[_0x72d7('0x17')](_0x594305)));rp(_0x594305)[_0x72d7('0x18')](function(_0xa22f92){_0x523389=!_[_0x72d7('0x19')](_0x523389)?_0x72d7('0x1a')+_0x523389:'';_0x5829ac=typeof _0xa22f92[_0x72d7('0x11')]==='object'?JSON[_0x72d7('0x17')](_0xa22f92['body']):_0xa22f92[_0x72d7('0x11')];logger['info'](util[_0x72d7('0x15')](_0x72d7('0x1b'),_0x2367a6[_0x72d7('0x3')],_0x2367a6[_0x72d7('0x5')],_0xa22f92[_0x72d7('0x1c')],_0x5829ac));})['catch'](function(_0x1a197f){logger[_0x72d7('0xb')](util[_0x72d7('0x15')](_0x72d7('0x1d'),_0x2367a6[_0x72d7('0x3')],_0x2367a6[_0x72d7('0x5')],_0x1a197f[_0x72d7('0x1c')],_0x1a197f['name'],_0x1a197f[_0x72d7('0x1e')]));});}; \ No newline at end of file +var _0x49ae=['statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util','lodash','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','headers','data6','render','error','stack','GET','DELETE','POST','data7','parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify',',\x20request\x20body:\x20','format','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0xa432e0,_0x52b937){var _0x3367bf=function(_0x800c4c){while(--_0x800c4c){_0xa432e0['push'](_0xa432e0['shift']());}};_0x3367bf(++_0x52b937);}(_0x49ae,0xec));var _0xe49a=function(_0xdc82e2,_0x37832e){_0xdc82e2=_0xdc82e2-0x0;var _0x3ead18=_0x49ae[_0xdc82e2];return _0x3ead18;};'use strict';var rp=require(_0xe49a('0x0'));var util=require(_0xe49a('0x1'));var _=require(_0xe49a('0x2'));var Mustache=require('mustache');var logger=require(_0xe49a('0x3'))(_0xe49a('0x4'));exports[_0xe49a('0x5')]=function(_0x565036,_0x2e70d0){var _0x3f6ebd,_0x1a46df;var _0x1cce59={'method':_0x565036[_0xe49a('0x6')][_0xe49a('0x7')](),'uri':Mustache['render'](_0x565036[_0xe49a('0x8')],_0x2e70d0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x565036[_0xe49a('0x9')])==='number'&&parseInt(_0x565036['data5'])>=0x1&&parseInt(_0x565036['data5'])<=0xa?parseInt(_0x565036['data5'])*0x3e8:0x5*0x3e8};try{_0x1cce59[_0xe49a('0xa')]=_0x565036[_0xe49a('0xb')]?JSON['parse'](Mustache[_0xe49a('0xc')](_0x565036[_0xe49a('0xb')],_0x2e70d0)):{};}catch(_0x2389fc){logger[_0xe49a('0xd')](_0x2389fc[_0xe49a('0xe')]);}switch(_0x565036[_0xe49a('0x6')]['toUpperCase']()){case _0xe49a('0xf'):case _0xe49a('0x10'):_0x3f6ebd=null;_0x1cce59['qs']=_0x2e70d0;break;case _0xe49a('0x11'):case'PUT':if(_0x565036[_0xe49a('0x12')]){try{_0x3f6ebd=JSON[_0xe49a('0x13')](Mustache['render'](_0x565036[_0xe49a('0x12')],_0x2e70d0));_0x1cce59[_0xe49a('0x14')]=_0x3f6ebd;}catch(_0x28fe99){logger['error'](_0x28fe99[_0xe49a('0xe')]);logger[_0xe49a('0xd')](_0xe49a('0x15'));}}else{_0x3f6ebd=_0x2e70d0;_0x1cce59['body']=_0x3f6ebd;}break;}logger[_0xe49a('0x16')](util['format'](_0xe49a('0x17'),_0x565036['data1'],_0x565036[_0xe49a('0x8')],JSON[_0xe49a('0x18')](_0x1cce59)));rp(_0x1cce59)['then'](function(_0x44cd00){_0x3f6ebd=!_['isNil'](_0x3f6ebd)?_0xe49a('0x19')+_0x3f6ebd:'';_0x1a46df=typeof _0x44cd00['body']==='object'?JSON['stringify'](_0x44cd00['body']):_0x44cd00[_0xe49a('0x14')];logger[_0xe49a('0x16')](util[_0xe49a('0x1a')](_0xe49a('0x1b'),_0x565036[_0xe49a('0x6')],_0x565036[_0xe49a('0x8')],_0x44cd00[_0xe49a('0x1c')],_0x1a46df));})[_0xe49a('0x1d')](function(_0x58ef57){logger[_0xe49a('0xd')](util[_0xe49a('0x1a')](_0xe49a('0x1e'),_0x565036['data1'],_0x565036[_0xe49a('0x8')],_0x58ef57['statusCode'],_0x58ef57[_0xe49a('0x1f')],_0x58ef57[_0xe49a('0x20')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 4af6bae..4c81765 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 _0x743a=['Request','request','then','debug','error','rpc','message','result','catch','exports','bluebird','../../config/logger','routing','client','http'];(function(_0x4b5aaa,_0x1308b6){var _0x46f9aa=function(_0x40be44){while(--_0x40be44){_0x4b5aaa['push'](_0x4b5aaa['shift']());}};_0x46f9aa(++_0x1308b6);}(_0x743a,0x181));var _0xa743=function(_0x14c5f2,_0x2c4449){_0x14c5f2=_0x14c5f2-0x0;var _0x2cfd14=_0x743a[_0x14c5f2];return _0x2cfd14;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xa743('0x0'));var logger=require(_0xa743('0x1'))(_0xa743('0x2'));var client=jayson[_0xa743('0x3')][_0xa743('0x4')]({'port':0x2329});client[_0xa743('0x5')]=function(_0x403496,_0x1d5885){return new BPromise(function(_0x5a5664,_0x422295){return client[_0xa743('0x6')](_0x403496,_0x1d5885)[_0xa743('0x7')](function(_0x387d99){logger[_0xa743('0x8')]('rpc','routing',_0x403496,_0x1d5885,_0x387d99);if(_0x387d99[_0xa743('0x9')]){logger[_0xa743('0x9')](_0xa743('0xa'),'routing',_0x403496,_0x387d99[_0xa743('0x9')][_0xa743('0xb')],_0x1d5885);return _0x422295(_0x387d99[_0xa743('0x9')]['message']);}else{return _0x5a5664(_0x387d99[_0xa743('0xc')]);}})[_0xa743('0xd')](function(_0x1bbb1a){logger[_0xa743('0x9')](_0xa743('0xa'),_0xa743('0x2'),_0x403496,_0x1bbb1a,_0x1d5885);return _0x422295(_0x1bbb1a);});});};module[_0xa743('0xe')]=client; \ No newline at end of file +var _0x98e4=['../../config/logger','client','http','Request','request','then','debug','routing','rpc','error','message','catch','exports','jayson/promise','bluebird'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x98e4,0x12a));var _0x498e=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x98e4[_0x4d8ed9];return _0x1e2140;};'use strict';var jayson=require(_0x498e('0x0'));var BPromise=require(_0x498e('0x1'));var logger=require(_0x498e('0x2'))('routing');var client=jayson[_0x498e('0x3')][_0x498e('0x4')]({'port':0x2329});client[_0x498e('0x5')]=function(_0x531fe3,_0x44764a){return new BPromise(function(_0x489737,_0x23d5c3){return client[_0x498e('0x6')](_0x531fe3,_0x44764a)[_0x498e('0x7')](function(_0x5b1ef4){logger[_0x498e('0x8')]('rpc',_0x498e('0x9'),_0x531fe3,_0x44764a,_0x5b1ef4);if(_0x5b1ef4['error']){logger['error'](_0x498e('0xa'),_0x498e('0x9'),_0x531fe3,_0x5b1ef4[_0x498e('0xb')][_0x498e('0xc')],_0x44764a);return _0x23d5c3(_0x5b1ef4[_0x498e('0xb')][_0x498e('0xc')]);}else{return _0x489737(_0x5b1ef4['result']);}})[_0x498e('0xd')](function(_0xe60847){logger[_0x498e('0xb')](_0x498e('0xa'),'routing',_0x531fe3,_0xe60847,_0x44764a);return _0x23d5c3(_0xe60847);});});};module[_0x498e('0xe')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 5bdfa4c..e1f2b53 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 _0x6889=['getMailAccounts','refresh','listen','getSettings','loginMailFrequency','error','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/setting','../../config/logger','email','resolve','then'];(function(_0x1fe6c2,_0xfbc822){var _0x417fa4=function(_0x19f28a){while(--_0x19f28a){_0x1fe6c2['push'](_0x1fe6c2['shift']());}};_0x417fa4(++_0xfbc822);}(_0x6889,0xd9));var _0x9688=function(_0x2f1ebe,_0x2e340a){_0x2f1ebe=_0x2f1ebe-0x0;var _0x522491=_0x6889[_0x2f1ebe];return _0x522491;};'use strict';var server=require(_0x9688('0x0'));var Realtime=require(_0x9688('0x1'));var EmailChannel=require(_0x9688('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require(_0x9688('0x3'));var logger=require(_0x9688('0x4'))(_0x9688('0x5'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x9688('0x6')]()[_0x9688('0x7')](mailAccount[_0x9688('0x8')]())[_0x9688('0x7')](realtime['initMailAccounts']())[_0x9688('0x7')](function(){email[_0x9688('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x9688('0xa')](realtime,email)[_0x9688('0x7')](function(){return initRealtime();})[_0x9688('0x7')](function(){return setting[_0x9688('0xb')]();})[_0x9688('0x7')](function(_0x45ec5f){return setInterval(initRealtime,_0x45ec5f[_0x9688('0xc')]*0x3e8);})['catch'](function(_0x4c272f){logger[_0x9688('0xd')](_0x9688('0xe'),_0x4c272f);});}main(); \ No newline at end of file +var _0xd567=['./realtime','then','initMailAccounts','mailAccounts','getSettings','loginMailFrequency','catch','./server'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0xd567,0x17f));var _0x7d56=function(_0x11d82c,_0xb3675f){_0x11d82c=_0x11d82c-0x0;var _0x4ddc00=_0xd567[_0x11d82c];return _0x4ddc00;};'use strict';var server=require(_0x7d56('0x0'));var Realtime=require(_0x7d56('0x1'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise['resolve']()['then'](mailAccount['getMailAccounts']())[_0x7d56('0x2')](realtime[_0x7d56('0x3')]())[_0x7d56('0x2')](function(){email['refresh'](realtime[_0x7d56('0x4')]);return realtime;});}function main(){return server['listen'](realtime,email)[_0x7d56('0x2')](function(){return initRealtime();})[_0x7d56('0x2')](function(){return setting[_0x7d56('0x5')]();})['then'](function(_0x437e4e){return setInterval(initRealtime,_0x437e4e[_0x7d56('0x6')]*0x3e8);})[_0x7d56('0x7')](function(_0x4e9ba0){logger['error']('Email\x20service\x20initialization',_0x4e9ba0);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d4e14dd..1c9a1c6 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 _0x5e59=['mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','messageStatus','total','isNil','stringify','mailAccount:update','hasOwnProperty','active','service','provider','custom','handleImapBox','handleImapEmail','bind','end','handleImapEnd','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','then','info','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','verifySmtp','Smtp','verify','verified','bluebird','md5','ioredis','../../../config/environment','email','redis','defaults','localhost','socket.io-emitter','./smtp','start\x20email\x20channel'];(function(_0x13a293,_0x350e61){var _0x2dc554=function(_0x576499){while(--_0x576499){_0x13a293['push'](_0x13a293['shift']());}};_0x2dc554(++_0x350e61);}(_0x5e59,0xf9));var _0x95e5=function(_0x328534,_0x33b41e){_0x328534=_0x328534-0x0;var _0x2796c0=_0x5e59[_0x328534];return _0x2796c0;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x95e5('0x0'));var md5=require(_0x95e5('0x1'));var Redis=require(_0x95e5('0x2'));var config=require(_0x95e5('0x3'));var logger=require('../../../config/logger')(_0x95e5('0x4'));config[_0x95e5('0x5')]=_[_0x95e5('0x6')](config[_0x95e5('0x5')],{'host':_0x95e5('0x7'),'port':0x18eb});var io=require(_0x95e5('0x8'))(new Redis(config['redis']));var EmailImap=require('./imap');var EmailSmtp=require(_0x95e5('0x9'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x3281bd){logger['info'](_0x95e5('0xa'));this[_0x95e5('0xb')]=_0x3281bd[_0x95e5('0xb')];this[_0x95e5('0xc')]={};this[_0x95e5('0xd')]=new EmailSmtp();}EmailChannel[_0x95e5('0xe')][_0x95e5('0xf')]=function(_0x3579ea){var _0x2f14df=this[_0x95e5('0xb')][_0x3579ea];var _0x209b8c={'id':_0x2f14df['id'],'name':_0x2f14df[_0x95e5('0x10')],'key':_0x2f14df['key'],'active':_0x2f14df['active'],'Imap':{'status':_0x2f14df[_0x95e5('0x11')][_0x95e5('0x12')],'messageStatus':_0x2f14df[_0x95e5('0x11')][_0x95e5('0x13')],'total':_0x2f14df[_0x95e5('0x11')][_0x95e5('0x14')]}};if(_[_0x95e5('0x15')](md5Accounts[_0x3579ea])){md5Accounts[_0x3579ea]={};}var _0x5bb103=md5(JSON[_0x95e5('0x16')](_0x209b8c));if(md5Accounts[_0x3579ea][_0x95e5('0x1')]!==_0x5bb103){md5Accounts[_0x3579ea][_0x95e5('0x1')]=_0x5bb103;io[_0x95e5('0xf')](_0x95e5('0x17'),_0x209b8c);}};EmailChannel[_0x95e5('0xe')]['refresh']=function(_0x496593){for(var _0xa925be in _0x496593){if(_0x496593[_0x95e5('0x18')](_0xa925be)){if(_0x496593[_0xa925be][_0x95e5('0x11')]&&_0x496593[_0xa925be][_0x95e5('0x19')]){var _0x21402d=_0x496593[_0xa925be]['Imap'];if(!_0x21402d[_0x95e5('0x1a')]&&_0x496593[_0xa925be][_0x95e5('0x1b')]!==_0x95e5('0x1c'))_0x21402d[_0x95e5('0x1a')]=_0x496593[_0xa925be][_0x95e5('0x1b')];if(!this[_0x95e5('0xc')][_0x95e5('0x18')](_0x21402d['id'])){this[_0x95e5('0xc')][_0x21402d['id']]=new EmailImap(_0x21402d,_0x496593[_0xa925be]['email']);this[_0x95e5('0xc')][_0x21402d['id']]['on']('box',this[_0x95e5('0x1d')]['bind'](this,_0xa925be));this[_0x95e5('0xc')][_0x21402d['id']]['on'](_0x95e5('0x4'),this[_0x95e5('0x1e')][_0x95e5('0x1f')](this,_0xa925be));this[_0x95e5('0xc')][_0x21402d['id']]['on'](_0x95e5('0x20'),this[_0x95e5('0x21')][_0x95e5('0x1f')](this,_0xa925be));this[_0x95e5('0xc')][_0x21402d['id']]['on'](_0x95e5('0x22'),this['handleImapError']['bind'](this,_0xa925be));}}else{if(_[_0x95e5('0x15')](this['mailAccounts'][_0xa925be][_0x95e5('0x11')])){this['mailAccounts'][_0xa925be][_0x95e5('0x11')]={};}this[_0x95e5('0xb')][_0xa925be]['Imap'][_0x95e5('0x12')]=_0x95e5('0x23');this[_0x95e5('0xb')][_0xa925be]['Imap'][_0x95e5('0x13')]='';this[_0x95e5('0xf')](_0xa925be);}}}};EmailChannel['prototype'][_0x95e5('0x1d')]=function(_0x41438e,_0x162841){if(this['mailAccounts'][_0x41438e]){this[_0x95e5('0xb')][_0x41438e][_0x95e5('0x11')]['status']=_0x95e5('0x24');this[_0x95e5('0xb')][_0x41438e][_0x95e5('0x11')][_0x95e5('0x13')]=_0x162841[_0x95e5('0x10')];if(_0x162841['messages']){this[_0x95e5('0xb')][_0x41438e][_0x95e5('0x11')][_0x95e5('0x14')]=_0x162841[_0x95e5('0x25')][_0x95e5('0x14')];}return this[_0x95e5('0xf')](_0x41438e);}};EmailChannel[_0x95e5('0xe')][_0x95e5('0x1e')]=function(_0x2f8c30,_0x14fe02){logger['info'](_0x95e5('0x26'),_0x14fe02[_0x95e5('0x27')],_0x14fe02[_0x95e5('0x28')],_0x14fe02['from'],_0x2f8c30);if(this[_0x95e5('0xb')][_0x2f8c30]){return mailAccount['notify'](_0x2f8c30,_0x14fe02)[_0x95e5('0x29')](function(_0x2c90fd){if(_0x2c90fd){logger[_0x95e5('0x2a')](_0x95e5('0x2b'));}})[_0x95e5('0x2c')](function(_0x2c0bd6){logger[_0x95e5('0x22')](_0x95e5('0x2d'),JSON[_0x95e5('0x16')](_0x2c0bd6));});}};EmailChannel[_0x95e5('0xe')][_0x95e5('0x21')]=function(_0x1e5872){if(this[_0x95e5('0xb')][_0x1e5872]&&this[_0x95e5('0xb')][_0x1e5872][_0x95e5('0x11')]){if(this[_0x95e5('0xc')][this[_0x95e5('0xb')][_0x1e5872][_0x95e5('0x11')]['id']]){delete this[_0x95e5('0xc')][this[_0x95e5('0xb')][_0x1e5872][_0x95e5('0x11')]['id']];}this[_0x95e5('0xb')][_0x1e5872]['Imap'][_0x95e5('0x2e')]=moment();this[_0x95e5('0xf')](_0x1e5872);}};EmailChannel[_0x95e5('0xe')][_0x95e5('0x2f')]=function(_0x136e26,_0x13088b){if(this[_0x95e5('0xb')][_0x136e26]){this[_0x95e5('0xb')][_0x136e26][_0x95e5('0x11')][_0x95e5('0x12')]='error';this['mailAccounts'][_0x136e26][_0x95e5('0x11')][_0x95e5('0x13')]=_0x13088b;return this[_0x95e5('0xf')](_0x136e26);}};EmailChannel[_0x95e5('0xe')]['sendMail']=function(_0x76e43e,_0x3c1b2f){return this[_0x95e5('0xd')]['send'](_0x76e43e,_0x3c1b2f);};EmailChannel[_0x95e5('0xe')][_0x95e5('0x30')]=function(_0x1df4f2){var _0x204a9d=this;if(this[_0x95e5('0xb')][_0x1df4f2['id']]){if(_['isNil'](this[_0x95e5('0xb')][_0x1df4f2['id']][_0x95e5('0x31')])){this['mailAccounts'][_0x1df4f2['id']][_0x95e5('0x31')]={};}this['mailAccounts'][_0x1df4f2['id']][_0x95e5('0x31')][_0x95e5('0x2e')]=moment();return new BPromise(function(_0x2393e8,_0x32baf7){return _0x204a9d[_0x95e5('0xd')][_0x95e5('0x32')](_0x1df4f2)['then'](function(_0x5150eb){_0x204a9d[_0x95e5('0xb')][_0x1df4f2['id']]['Smtp'][_0x95e5('0x12')]=_0x95e5('0x33');_0x204a9d[_0x95e5('0xb')][_0x1df4f2['id']]['Smtp'][_0x95e5('0x13')]='';_0x204a9d['emit'](_0x1df4f2['id']);_0x2393e8(_0x5150eb);})[_0x95e5('0x2c')](function(_0x3933c1){_0x204a9d['mailAccounts'][_0x1df4f2['id']]['Smtp'][_0x95e5('0x12')]=_0x95e5('0x22');_0x204a9d[_0x95e5('0xb')][_0x1df4f2['id']][_0x95e5('0x31')][_0x95e5('0x13')]=_0x3933c1;_0x204a9d[_0x95e5('0xf')](_0x1df4f2['id']);_0x32baf7(_0x3933c1);});});}return this[_0x95e5('0xd')][_0x95e5('0x32')](_0x1df4f2);};module['exports']=EmailChannel; \ No newline at end of file +var _0x5264=['firstName','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','error','Mail\x20not\x20accepted\x20from\x20routing\x20%s','handleImapEnd','lastSync','send','verifySmtp','Smtp','verify','verified','catch','exports','lodash','moment','../../../config/logger','defaults','redis','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','prototype','emit','name','key','active','status','Imap','total','isNil','stringify','md5','refresh','hasOwnProperty','service','custom','provider','imapAccounts','email','handleImapBox','bind','handleImapEmail','end','handleImapError','disabled','messageStatus','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s'];(function(_0xfb9f90,_0x1df0b3){var _0x5e004b=function(_0x3e064d){while(--_0x3e064d){_0xfb9f90['push'](_0xfb9f90['shift']());}};_0x5e004b(++_0x1df0b3);}(_0x5264,0x138));var _0x4526=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x5264[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x4526('0x0'));var moment=require(_0x4526('0x1'));var BPromise=require('bluebird');var md5=require('md5');var Redis=require('ioredis');var config=require('../../../config/environment');var logger=require(_0x4526('0x2'))('email');config['redis']=_[_0x4526('0x3')](config[_0x4526('0x4')],{'host':_0x4526('0x5'),'port':0x18eb});var io=require(_0x4526('0x6'))(new Redis(config[_0x4526('0x4')]));var EmailImap=require(_0x4526('0x7'));var EmailSmtp=require(_0x4526('0x8'));var mailAccount=require(_0x4526('0x9'));var md5Accounts={};function EmailChannel(_0x461af0){logger[_0x4526('0xa')](_0x4526('0xb'));this[_0x4526('0xc')]=_0x461af0[_0x4526('0xc')];this['imapAccounts']={};this[_0x4526('0xd')]=new EmailSmtp();}EmailChannel[_0x4526('0xe')][_0x4526('0xf')]=function(_0x14989e){var _0x129007=this[_0x4526('0xc')][_0x14989e];var _0x4241ea={'id':_0x129007['id'],'name':_0x129007[_0x4526('0x10')],'key':_0x129007[_0x4526('0x11')],'active':_0x129007[_0x4526('0x12')],'Imap':{'status':_0x129007['Imap'][_0x4526('0x13')],'messageStatus':_0x129007[_0x4526('0x14')]['messageStatus'],'total':_0x129007[_0x4526('0x14')][_0x4526('0x15')]}};if(_[_0x4526('0x16')](md5Accounts[_0x14989e])){md5Accounts[_0x14989e]={};}var _0x3a1aa1=md5(JSON[_0x4526('0x17')](_0x4241ea));if(md5Accounts[_0x14989e][_0x4526('0x18')]!==_0x3a1aa1){md5Accounts[_0x14989e][_0x4526('0x18')]=_0x3a1aa1;io[_0x4526('0xf')]('mailAccount:update',_0x4241ea);}};EmailChannel['prototype'][_0x4526('0x19')]=function(_0x452aba){for(var _0x16094c in _0x452aba){if(_0x452aba[_0x4526('0x1a')](_0x16094c)){if(_0x452aba[_0x16094c]['Imap']&&_0x452aba[_0x16094c]['active']){var _0x238078=_0x452aba[_0x16094c][_0x4526('0x14')];if(!_0x238078[_0x4526('0x1b')]&&_0x452aba[_0x16094c]['provider']!==_0x4526('0x1c'))_0x238078[_0x4526('0x1b')]=_0x452aba[_0x16094c][_0x4526('0x1d')];if(!this[_0x4526('0x1e')][_0x4526('0x1a')](_0x238078['id'])){this['imapAccounts'][_0x238078['id']]=new EmailImap(_0x238078,_0x452aba[_0x16094c][_0x4526('0x1f')]);this[_0x4526('0x1e')][_0x238078['id']]['on']('box',this[_0x4526('0x20')][_0x4526('0x21')](this,_0x16094c));this['imapAccounts'][_0x238078['id']]['on'](_0x4526('0x1f'),this[_0x4526('0x22')][_0x4526('0x21')](this,_0x16094c));this[_0x4526('0x1e')][_0x238078['id']]['on'](_0x4526('0x23'),this['handleImapEnd'][_0x4526('0x21')](this,_0x16094c));this[_0x4526('0x1e')][_0x238078['id']]['on']('error',this[_0x4526('0x24')][_0x4526('0x21')](this,_0x16094c));}}else{if(_[_0x4526('0x16')](this['mailAccounts'][_0x16094c][_0x4526('0x14')])){this['mailAccounts'][_0x16094c][_0x4526('0x14')]={};}this['mailAccounts'][_0x16094c][_0x4526('0x14')][_0x4526('0x13')]=_0x4526('0x25');this[_0x4526('0xc')][_0x16094c][_0x4526('0x14')][_0x4526('0x26')]='';this['emit'](_0x16094c);}}}};EmailChannel['prototype'][_0x4526('0x20')]=function(_0x52ed79,_0x5e3d69){if(this[_0x4526('0xc')][_0x52ed79]){this[_0x4526('0xc')][_0x52ed79][_0x4526('0x14')]['status']=_0x4526('0x27');this[_0x4526('0xc')][_0x52ed79][_0x4526('0x14')][_0x4526('0x26')]=_0x5e3d69['name'];if(_0x5e3d69[_0x4526('0x28')]){this[_0x4526('0xc')][_0x52ed79][_0x4526('0x14')][_0x4526('0x15')]=_0x5e3d69['messages'][_0x4526('0x15')];}return this['emit'](_0x52ed79);}};EmailChannel[_0x4526('0xe')]['handleImapEmail']=function(_0x4d85b9,_0x45cf75){logger[_0x4526('0xa')](_0x4526('0x29'),_0x45cf75[_0x4526('0x2a')],_0x45cf75[_0x4526('0x2b')],_0x45cf75[_0x4526('0x2c')],_0x4d85b9);if(this['mailAccounts'][_0x4d85b9]){return mailAccount[_0x4526('0x2d')](_0x4d85b9,_0x45cf75)[_0x4526('0x2e')](function(_0x549e5d){if(_0x549e5d){logger[_0x4526('0xa')](_0x4526('0x2f'));}})['catch'](function(_0x55f59b){logger[_0x4526('0x30')](_0x4526('0x31'),JSON[_0x4526('0x17')](_0x55f59b));});}};EmailChannel[_0x4526('0xe')][_0x4526('0x32')]=function(_0x28a614){if(this['mailAccounts'][_0x28a614]&&this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')]){if(this[_0x4526('0x1e')][this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')]['id']]){delete this[_0x4526('0x1e')][this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')]['id']];}this[_0x4526('0xc')][_0x28a614][_0x4526('0x14')][_0x4526('0x33')]=moment();this['emit'](_0x28a614);}};EmailChannel[_0x4526('0xe')][_0x4526('0x24')]=function(_0x89074b,_0x4db883){if(this[_0x4526('0xc')][_0x89074b]){this[_0x4526('0xc')][_0x89074b][_0x4526('0x14')][_0x4526('0x13')]=_0x4526('0x30');this[_0x4526('0xc')][_0x89074b][_0x4526('0x14')][_0x4526('0x26')]=_0x4db883;return this[_0x4526('0xf')](_0x89074b);}};EmailChannel[_0x4526('0xe')]['sendMail']=function(_0x12898a,_0x1be784){return this[_0x4526('0xd')][_0x4526('0x34')](_0x12898a,_0x1be784);};EmailChannel[_0x4526('0xe')][_0x4526('0x35')]=function(_0x8707b0){var _0x3c6de6=this;if(this[_0x4526('0xc')][_0x8707b0['id']]){if(_[_0x4526('0x16')](this[_0x4526('0xc')][_0x8707b0['id']][_0x4526('0x36')])){this[_0x4526('0xc')][_0x8707b0['id']][_0x4526('0x36')]={};}this[_0x4526('0xc')][_0x8707b0['id']][_0x4526('0x36')]['lastSync']=moment();return new BPromise(function(_0x28bb0b,_0x1e8a10){return _0x3c6de6[_0x4526('0xd')][_0x4526('0x37')](_0x8707b0)[_0x4526('0x2e')](function(_0x32126a){_0x3c6de6[_0x4526('0xc')][_0x8707b0['id']]['Smtp'][_0x4526('0x13')]=_0x4526('0x38');_0x3c6de6['mailAccounts'][_0x8707b0['id']][_0x4526('0x36')][_0x4526('0x26')]='';_0x3c6de6['emit'](_0x8707b0['id']);_0x28bb0b(_0x32126a);})[_0x4526('0x39')](function(_0x50105a){_0x3c6de6['mailAccounts'][_0x8707b0['id']][_0x4526('0x36')][_0x4526('0x13')]=_0x4526('0x30');_0x3c6de6[_0x4526('0xc')][_0x8707b0['id']]['Smtp']['messageStatus']=_0x50105a;_0x3c6de6[_0x4526('0xf')](_0x8707b0['id']);_0x1e8a10(_0x50105a);});});}return this['smtp'][_0x4526('0x37')](_0x8707b0);};module[_0x4526('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 469d9d9..fef7080 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 _0xbccf=['host','port','tls','autotls','required','handleReady','openBox','handleOpenBox','emit','box','handleCloseBox','end','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','slice','message','error','handleFetchError','handleFetchEnd','closeBox','handleFetchMessage','body','attributes','handleMessageEnd','handleMessageBody','handleMessageAttributes','html','parser','warn','Email\x20text\x20truncated,\x20max\x20HTML\x20size\x20','\x20bytes,\x20email\x20size:\x20','\x20bytes','\x20[Email\x20text\x20truncated\x20because\x20size\x20more\x20than\x20','\x20bytes]','substring','text','handleEnd','stringify','textCode','hasOwnProperty','upperFirst','exports','util','mailparser','simpleParser','iconv','Iconv','EventEmitter','./utils','email','emailMaxHTMLbytesLimit','mailbox','account','getAccount','imap','once','bind','handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','generateXOAuth2Token','CloudProvider','data5','password','authentication'];(function(_0x768aca,_0x2235c7){var _0x346421=function(_0x45163b){while(--_0x45163b){_0x768aca['push'](_0x768aca['shift']());}};_0x346421(++_0x2235c7);}(_0xbccf,0x15e));var _0xfbcc=function(_0x2714ec,_0x36daa4){_0x2714ec=_0x2714ec-0x0;var _0x2608e5=_0xbccf[_0x2714ec];return _0x2608e5;};'use strict';var _=require('lodash');var util=require(_0xfbcc('0x0'));var Imap=require('imap');var simpleParser=require(_0xfbcc('0x1'))[_0xfbcc('0x2')];var Iconv=require(_0xfbcc('0x3'))[_0xfbcc('0x4')];var EventEmitter=require('events')[_0xfbcc('0x5')];var utils=require(_0xfbcc('0x6'));var logger=require('../../../config/logger')(_0xfbcc('0x7'));var config=require('../../../config/environment');const MAX_HTML_BYTES_SIZE=config[_0xfbcc('0x8')]||0xee6b2800;function EmailImap(_0x1ba297,_0x1f34d7){this[_0xfbcc('0x9')]=_0x1ba297[_0xfbcc('0x9')];this[_0xfbcc('0xa')]=this[_0xfbcc('0xb')](_0x1ba297,_0x1f34d7);this[_0xfbcc('0xc')]=new Imap(this['account']);this[_0xfbcc('0xc')][_0xfbcc('0xd')]('ready',this['handleReady'][_0xfbcc('0xe')](this));this[_0xfbcc('0xc')][_0xfbcc('0xd')]('end',this['handleEnd'][_0xfbcc('0xe')](this));this[_0xfbcc('0xc')]['on']('error',this[_0xfbcc('0xf')]['bind'](this));this[_0xfbcc('0xc')][_0xfbcc('0x10')]();}util[_0xfbcc('0x11')](EmailImap,EventEmitter);EmailImap[_0xfbcc('0x12')][_0xfbcc('0xb')]=function(_0x5db743,_0x197e00){var _0x2df2cc={'connTimeout':_0x5db743[_0xfbcc('0x13')]?_0x5db743[_0xfbcc('0x13')]*0x3e8:0x2710,'authTimeout':_0x5db743[_0xfbcc('0x14')]?_0x5db743[_0xfbcc('0x14')]*0x3e8:0x1388};if(_0x5db743[_0xfbcc('0x15')]){_0x2df2cc[_0xfbcc('0x16')]=_0x5db743['user'];if(_0x5db743[_0xfbcc('0x17')]){_0x2df2cc[_0xfbcc('0x18')]=utils[_0xfbcc('0x19')](_0x5db743[_0xfbcc('0x1a')][_0xfbcc('0x1b')],_0x5db743['user']);}else{_0x2df2cc[_0xfbcc('0x1c')]=_0x5db743[_0xfbcc('0x1c')];}}else{if(_0x5db743[_0xfbcc('0x1d')]){_0x2df2cc[_0xfbcc('0x16')]=_0x5db743[_0xfbcc('0x16')];_0x2df2cc[_0xfbcc('0x1c')]=_0x5db743[_0xfbcc('0x1c')];}}_0x2df2cc[_0xfbcc('0x7')]=_0x197e00||_0x5db743[_0xfbcc('0x16')]||'anonymous@xcally.com';_0x2df2cc['host']=_0x5db743[_0xfbcc('0x1e')];_0x2df2cc[_0xfbcc('0x1f')]=_0x5db743['port']||0x3e1;if(_0x5db743[_0xfbcc('0x20')]){_0x2df2cc['tls']=!![];}else{_0x2df2cc[_0xfbcc('0x20')]=![];_0x2df2cc[_0xfbcc('0x21')]=_0xfbcc('0x22');}return _0x2df2cc;};EmailImap['prototype'][_0xfbcc('0x23')]=function(){this[_0xfbcc('0xc')][_0xfbcc('0x24')](this[_0xfbcc('0x9')],![],this['handleOpenBox'][_0xfbcc('0xe')](this));};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x25')]=function(_0xab91b0,_0x55dee2){if(_0xab91b0){this[_0xfbcc('0xf')](_0xab91b0,!![]);}else{this[_0xfbcc('0x26')](_0xfbcc('0x27'),_0x55dee2);this['readUnseen']();}};EmailImap['prototype'][_0xfbcc('0x28')]=function(_0x141971){if(_0x141971){this[_0xfbcc('0xf')](_0x141971,!![]);}else{this[_0xfbcc('0xc')][_0xfbcc('0x29')]();this[_0xfbcc('0x26')](_0xfbcc('0x29'));}};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x2a')]=function(){this['imap'][_0xfbcc('0x2b')]([_0xfbcc('0x2c')],this[_0xfbcc('0x2d')][_0xfbcc('0xe')](this));};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x2d')]=function(_0x26cc20,_0x16fc28){if(_0x26cc20){this[_0xfbcc('0xf')](_0x26cc20,!![]);}else{if(_0x16fc28[_0xfbcc('0x2e')]){try{var _0x49197c=this[_0xfbcc('0xc')][_0xfbcc('0x2f')](_0x16fc28[_0xfbcc('0x30')](0x0,0xa),{'bodies':'','markSeen':!![]});_0x49197c['on'](_0xfbcc('0x31'),this['handleFetchMessage'][_0xfbcc('0xe')](this));_0x49197c['once'](_0xfbcc('0x32'),this[_0xfbcc('0x33')][_0xfbcc('0xe')](this));_0x49197c[_0xfbcc('0xd')](_0xfbcc('0x29'),this[_0xfbcc('0x34')][_0xfbcc('0xe')](this));}catch(_0x35e78a){logger[_0xfbcc('0x32')](_0xfbcc('0x2d'),this[_0xfbcc('0xa')]['email'],_0x35e78a);this['imap']['closeBox'](!![],this['handleCloseBox'][_0xfbcc('0xe')](this));}}else{this[_0xfbcc('0xc')][_0xfbcc('0x35')](!![],this['handleCloseBox'][_0xfbcc('0xe')](this));}}};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x36')]=function(_0xee092e){_0xee092e['on'](_0xfbcc('0x37'),this['handleMessageBody']['bind'](this));_0xee092e['once'](_0xfbcc('0x38'),this['handleMessageAttributes'][_0xfbcc('0xe')](this));_0xee092e[_0xfbcc('0xd')]('end',this[_0xfbcc('0x39')]['bind'](this));};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x3a')]=function(_0x55a44b){simpleParser(_0x55a44b,{'Iconv':Iconv},this['handleSimpleParser'][_0xfbcc('0xe')](this));};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x3b')]=function(){};EmailImap[_0xfbcc('0x12')][_0xfbcc('0x39')]=function(){};EmailImap[_0xfbcc('0x12')]['handleSimpleParser']=function(_0x3594f9,_0x2043f7){if(_0x3594f9){logger['error'](_0x3594f9);}else{const _0x1ce248=_0x2043f7['html'][_0xfbcc('0x2e')];var _0x35f952=this;const _0x1ce248=_0x2043f7[_0xfbcc('0x3c')][_0xfbcc('0x2e')];if(_0x1ce248Empty\x20message

','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','moment','randomstring','path','email','head','address','@xcally.com','name','substring','split','length','join','Anonymous','value','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8c0b,0xff));var _0xb8c0=function(_0x2b2858,_0x3f0832){_0x2b2858=_0x2b2858-0x0;var _0x12a1d8=_0x8c0b[_0x2b2858];return _0x12a1d8;};'use strict';var _=require('lodash');var moment=require(_0xb8c0('0x0'));var random=require(_0xb8c0('0x1'));var fs=require('fs');var path=require(_0xb8c0('0x2'));var util=require('util');var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xb8c0('0x3'));var config=require('../../../config/environment');function getAddress(_0x4da1e1){var _0x43d0c0=_[_0xb8c0('0x4')](_0x4da1e1['value']);return _0x43d0c0&&_0x43d0c0[_0xb8c0('0x5')]?_0x43d0c0[_0xb8c0('0x5')]:'anonymous'+random['generate'](0x6)+_0xb8c0('0x6');}function getFirstName(_0x4c6c99){var _0x16dec9=_[_0xb8c0('0x4')](_0x4c6c99['value']);if(_0x16dec9&&_0x16dec9['name']){if(_0x16dec9[_0xb8c0('0x7')]==_0x16dec9['address']){return _0x16dec9[_0xb8c0('0x7')][_0xb8c0('0x8')](0x0,_0x16dec9[_0xb8c0('0x7')]['indexOf']('@'));}var _0x1677aa=_0x16dec9[_0xb8c0('0x7')][_0xb8c0('0x9')](/\s+/);return _0x1677aa[_0xb8c0('0xa')]>0x1?_0x1677aa['slice'](0x0,-0x1)[_0xb8c0('0xb')]('\x20'):_0x16dec9[_0xb8c0('0x7')];}return _0xb8c0('0xc');}function getLastName(_0xce78ca){var _0x92febb=_[_0xb8c0('0x4')](_0xce78ca[_0xb8c0('0xd')]);if(_0x92febb&&_0x92febb[_0xb8c0('0x7')]){var _0x228408=_0x92febb[_0xb8c0('0x7')][_0xb8c0('0x9')](/\s+/);return _0x228408[_0xb8c0('0xa')]>0x1?_0x228408[_0xb8c0('0xe')]():'';}return'';}function getMails(_0x5f36d0,_0x385e43){var _0x33305d='';for(var _0x1e1f8a=0x0;_0x1e1f8a<_0x385e43['value'][_0xb8c0('0xa')];_0x1e1f8a+=0x1){if(_0x385e43[_0xb8c0('0xd')][_0x1e1f8a][_0xb8c0('0x5')]!==_0x5f36d0){if(!_[_0xb8c0('0xf')](_0x33305d)){_0x33305d+=',';}_0x33305d+=_0x385e43['value'][_0x1e1f8a][_0xb8c0('0x7')]||_0x385e43[_0xb8c0('0xd')][_0x1e1f8a][_0xb8c0('0x5')]||'';_0x33305d+='\x20<';_0x33305d+=_0x385e43['value'][_0x1e1f8a][_0xb8c0('0x5')]?_0x385e43[_0xb8c0('0xd')][_0x1e1f8a][_0xb8c0('0x5')]:'anonymous'+random['generate'](0x6)+_0xb8c0('0x6');_0x33305d+='>';}}return _0x33305d;}function parseEmail(_0x162309,_0x550095,_0x1d729f){if(_0x550095[_0xb8c0('0x10')]){var _0x36ec39=/)<[^<]*)*<\/script>/gi;while(_0x36ec39[_0xb8c0('0x11')](_0x550095[_0xb8c0('0x10')])){_0x550095[_0xb8c0('0x10')]=_0x550095[_0xb8c0('0x10')]['replace'](_0x36ec39,'');}if(_0x550095[_0xb8c0('0x10')][_0xb8c0('0x12')](_0xb8c0('0x13'))){var _0x499cb0=[];_0x550095[_0xb8c0('0x14')][_0xb8c0('0x15')](_0x4a78b6=>{_0x499cb0[_0xb8c0('0x16')](_0x4a78b6[_0xb8c0('0x17')]);});var _0x1bcb36=/]+>/g;var _0x323d44=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xa95e36=_0x550095[_0xb8c0('0x10')][_0xb8c0('0x18')](_0x323d44,_0xb8c0('0x19'));var _0x52c6fb=_0xa95e36['replace'](_0x1bcb36,_0xb8c0('0x1a'));for(let _0x16bf4d=0x0;_0x16bf4d<_0x499cb0[_0xb8c0('0xa')];_0x16bf4d++){var _0x1b75f6=_0x52c6fb[_0xb8c0('0x18')](_0xb8c0('0x1a'),_0xb8c0('0x1b')+_0x499cb0[_0x16bf4d]+'\x20]');_0x52c6fb=_0x1b75f6;}_0x550095[_0xb8c0('0x10')]=_0x52c6fb;}_0x1d729f[_0xb8c0('0x1c')]=_0x550095[_0xb8c0('0x10')];}else{_0x1d729f['body']=_0x550095[_0xb8c0('0x1d')];}if(_0x1d729f[_0xb8c0('0x1c')]){_0x1d729f[_0xb8c0('0x1c')]=_0x1d729f['body']['replace'](/0x0){var _0x5f58d3=[_0xb8c0('0x2e'),'X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x2bf47a=0x0;_0x2bf47a<_0x550095[_0xb8c0('0x2d')][_0xb8c0('0xa')];_0x2bf47a++){var _0x4ea910=_[_0xb8c0('0x2f')](_0x5f58d3,_0x550095['headerLines'][_0x2bf47a][_0xb8c0('0x30')]);if(_0x4ea910>=0x0){_0x1d729f[_0xb8c0('0x31')]=!![];}}}return _0x1d729f;}exports[_0xb8c0('0x32')]=function(_0x1209c6,_0x5c7700,_0x46a7f9){var _0x2aa71b={'from':getAddress(_0x5c7700['from']),'firstName':getFirstName(_0x5c7700[_0xb8c0('0x33')]),'lastName':getLastName(_0x5c7700['from']),'mapKey':_0xb8c0('0x3'),'message':{'from':getMails(_0x1209c6[_0xb8c0('0x3')],_0x5c7700['from']),'to':_0x1209c6[_0xb8c0('0x3')],'cc':'','subject':_0x5c7700[_0xb8c0('0x34')]||'','messageId':_0x5c7700[_0xb8c0('0x35')],'inReplyTo':_0x5c7700['inReplyTo'],'sentAt':moment(_0x5c7700[_0xb8c0('0x36')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x5c7700[_0xb8c0('0x10')]&&!_0x5c7700[_0xb8c0('0x1d')]){var _0x272453=_[_0xb8c0('0x37')](_0x5c7700[_0xb8c0('0x14')],{'contentType':_0xb8c0('0x38')});if(_0x272453[_0xb8c0('0xa')]){logger[_0xb8c0('0x39')](util[_0xb8c0('0x26')](_0xb8c0('0x3a'),_0x5c7700[_0xb8c0('0x35')]));tnef[_0xb8c0('0x3b')](_[_0xb8c0('0x3c')](_0x272453)[_0xb8c0('0x2c')],function(_0x431fd0,_0x556654){if(_0x556654){_0x5c7700[_0xb8c0('0x10')]=_0x556654['BodyHTML']||'

Empty\x20message

';if(_0x556654[_0xb8c0('0x3d')]){for(var _0x2f0a21=0x0;_0x2f0a21<_0x556654[_0xb8c0('0x3d')]['length'];_0x2f0a21++){var _0x40353b=_0x556654['Attachments'][_0x2f0a21];_0x2aa71b[_0xb8c0('0x1f')][_0xb8c0('0x14')][_0xb8c0('0x16')]({'filename':_0x40353b[_0xb8c0('0x3e')],'content':Buffer[_0xb8c0('0x33')](_0x40353b[_0xb8c0('0x3f')])});}}}_0x46a7f9(parseEmail(_0x1209c6,_0x5c7700,_0x2aa71b));});}else{_0x5c7700[_0xb8c0('0x10')]=_0xb8c0('0x40');_0x46a7f9(parseEmail(_0x1209c6,_0x5c7700,_0x2aa71b));}}else{_0x46a7f9(parseEmail(_0x1209c6,_0x5c7700,_0x2aa71b));}};exports[_0xb8c0('0x41')]=function(_0x9402c1,_0x6961d5){var _0x268699=[_0xb8c0('0x42')+(_0x6961d5||''),_0xb8c0('0x43')+_0x9402c1,'',''];return Buffer[_0xb8c0('0x33')](_0x268699[_0xb8c0('0xb')](''),_0xb8c0('0x44'))[_0xb8c0('0x45')](_0xb8c0('0x46'));}; \ No newline at end of file +var _0xb9f7=['Precedence:\x20auto_reply','line','parser','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','parseBuffer','first','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','@xcally.com','head','name','substring','indexOf','split','length','html','test','includes','attachments','filename','_SRC','replace','_IMG','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x131d39['slice'](0x0,-0x1)['join']('\x20'):_0x9a5845[_0x7b9f('0xe')];}return'Anonymous';}function getLastName(_0x311b1d){var _0x250d47=_[_0x7b9f('0xd')](_0x311b1d[_0x7b9f('0x9')]);if(_0x250d47&&_0x250d47[_0x7b9f('0xe')]){var _0x4428a4=_0x250d47[_0x7b9f('0xe')][_0x7b9f('0x11')](/\s+/);return _0x4428a4[_0x7b9f('0x12')]>0x1?_0x4428a4['pop']():'';}return'';}function getMails(_0x1a3004,_0x2ba1b6){var _0x4d7fef='';for(var _0x50cece=0x0;_0x50cece<_0x2ba1b6['value']['length'];_0x50cece+=0x1){if(_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]!==_0x1a3004){if(!_['isEmpty'](_0x4d7fef)){_0x4d7fef+=',';}_0x4d7fef+=_0x2ba1b6[_0x7b9f('0x9')][_0x50cece]['name']||_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]||'';_0x4d7fef+='\x20<';_0x4d7fef+=_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]?_0x2ba1b6[_0x7b9f('0x9')][_0x50cece][_0x7b9f('0xa')]:_0x7b9f('0xb')+random['generate'](0x6)+'@xcally.com';_0x4d7fef+='>';}}return _0x4d7fef;}function parseEmail(_0x5b19b4,_0x26a90b,_0x5e8ecc){if(_0x26a90b[_0x7b9f('0x13')]){var _0x2cf67d=/)<[^<]*)*<\/script>/gi;while(_0x2cf67d[_0x7b9f('0x14')](_0x26a90b[_0x7b9f('0x13')])){_0x26a90b[_0x7b9f('0x13')]=_0x26a90b[_0x7b9f('0x13')]['replace'](_0x2cf67d,'');}if(_0x26a90b[_0x7b9f('0x13')][_0x7b9f('0x15')]('{_0x398f01['push'](_0x1c73f7[_0x7b9f('0x17')]);});var _0x2d5616=/]+>/g;var _0x24e707=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x247e75=_0x26a90b[_0x7b9f('0x13')]['replace'](_0x24e707,_0x7b9f('0x18'));var _0x28e591=_0x247e75[_0x7b9f('0x19')](_0x2d5616,'_IMG');for(let _0x4163df=0x0;_0x4163df<_0x398f01['length'];_0x4163df++){var _0x3164cb=_0x28e591['replace'](_0x7b9f('0x1a'),_0x7b9f('0x1b')+_0x398f01[_0x4163df]+_0x7b9f('0x1c'));_0x28e591=_0x3164cb;}_0x26a90b['html']=_0x28e591;}_0x5e8ecc[_0x7b9f('0x1d')]=_0x26a90b[_0x7b9f('0x13')];}else{_0x5e8ecc[_0x7b9f('0x1d')]=_0x26a90b[_0x7b9f('0x1e')];}if(_0x5e8ecc[_0x7b9f('0x1d')]){_0x5e8ecc[_0x7b9f('0x1d')]=_0x5e8ecc[_0x7b9f('0x1d')][_0x7b9f('0x19')](/0x0){var _0x427635=[_0x7b9f('0x31'),_0x7b9f('0x32'),_0x7b9f('0x33')];for(var _0x29852b=0x0;_0x29852b<_0x26a90b[_0x7b9f('0x30')]['length'];_0x29852b++){var _0x4a6339=_[_0x7b9f('0x10')](_0x427635,_0x26a90b[_0x7b9f('0x30')][_0x29852b][_0x7b9f('0x34')]);if(_0x4a6339>=0x0){_0x5e8ecc['isAutoreply']=!![];}}}return _0x5e8ecc;}exports[_0x7b9f('0x35')]=function(_0x18c2ac,_0x1bb606,_0x30e7f8){var _0x5cad02={'from':getAddress(_0x1bb606[_0x7b9f('0x36')]),'firstName':getFirstName(_0x1bb606['from']),'lastName':getLastName(_0x1bb606[_0x7b9f('0x36')]),'mapKey':_0x7b9f('0x7'),'message':{'from':getMails(_0x18c2ac[_0x7b9f('0x7')],_0x1bb606[_0x7b9f('0x36')]),'to':_0x18c2ac[_0x7b9f('0x7')],'cc':'','subject':_0x1bb606[_0x7b9f('0x37')]||'','messageId':_0x1bb606[_0x7b9f('0x38')],'inReplyTo':_0x1bb606[_0x7b9f('0x39')],'sentAt':moment(_0x1bb606[_0x7b9f('0x3a')])['format'](_0x7b9f('0x3b')),'attach':![],'attachments':[]}};if(!_0x1bb606[_0x7b9f('0x13')]&&!_0x1bb606[_0x7b9f('0x1e')]){var _0x324335=_[_0x7b9f('0x3c')](_0x1bb606[_0x7b9f('0x16')],{'contentType':_0x7b9f('0x3d')});if(_0x324335['length']){logger[_0x7b9f('0x3e')](util['format']('Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system',_0x1bb606[_0x7b9f('0x38')]));tnef[_0x7b9f('0x3f')](_[_0x7b9f('0x40')](_0x324335)[_0x7b9f('0x2d')],function(_0xc9d3c,_0x170bb6){if(_0x170bb6){_0x1bb606[_0x7b9f('0x13')]=_0x170bb6['BodyHTML']||_0x7b9f('0x41');if(_0x170bb6[_0x7b9f('0x42')]){for(var _0x17bdf0=0x0;_0x17bdf0<_0x170bb6[_0x7b9f('0x42')][_0x7b9f('0x12')];_0x17bdf0++){var _0x41c095=_0x170bb6['Attachments'][_0x17bdf0];_0x5cad02[_0x7b9f('0x20')][_0x7b9f('0x16')]['push']({'filename':_0x41c095['Title'],'content':Buffer[_0x7b9f('0x36')](_0x41c095['Data'])});}}}_0x30e7f8(parseEmail(_0x18c2ac,_0x1bb606,_0x5cad02));});}else{_0x1bb606[_0x7b9f('0x13')]=_0x7b9f('0x41');_0x30e7f8(parseEmail(_0x18c2ac,_0x1bb606,_0x5cad02));}}else{_0x30e7f8(parseEmail(_0x18c2ac,_0x1bb606,_0x5cad02));}};exports[_0x7b9f('0x43')]=function(_0x26c826,_0x5f4c2c){var _0x52f662=[_0x7b9f('0x44')+(_0x5f4c2c||''),'auth=Bearer\x20'+_0x26c826,'',''];return Buffer[_0x7b9f('0x36')](_0x52f662[_0x7b9f('0x2a')](''),_0x7b9f('0x45'))['toString'](_0x7b9f('0x46'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index e741094..6c4e1a7 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 _0xa46d=['Service','key','SERV','active','Imap','exports','lodash','name'];(function(_0x459edb,_0x1e7fb9){var _0x3cc5c9=function(_0x2c01f4){while(--_0x2c01f4){_0x459edb['push'](_0x459edb['shift']());}};_0x3cc5c9(++_0x1e7fb9);}(_0xa46d,0x136));var _0xda46=function(_0x2b13,_0xbbacb7){_0x2b13=_0x2b13-0x0;var _0x3c553e=_0xa46d[_0x2b13];return _0x3c553e;};'use strict';var _=require(_0xda46('0x0'));function MailAccount(_0x4d10bb){this['id']=_0x4d10bb['id']||0x0;this['name']=_0x4d10bb[_0xda46('0x1')]||_0xda46('0x2');this[_0xda46('0x3')]=_0x4d10bb[_0xda46('0x3')]||_0xda46('0x4');this[_0xda46('0x5')]=_0x4d10bb[_0xda46('0x5')]||![];this[_0xda46('0x6')]=_0x4d10bb[_0xda46('0x6')]||[];this['Smtp']=_0x4d10bb['Smtp']||[];}module[_0xda46('0x7')]=MailAccount; \ No newline at end of file +var _0x82c8=['lodash','name','Service','key','SERV','active','Imap','Smtp'];(function(_0x99b397,_0x3423a0){var _0x2d0623=function(_0x2e174a){while(--_0x2e174a){_0x99b397['push'](_0x99b397['shift']());}};_0x2d0623(++_0x3423a0);}(_0x82c8,0x128));var _0x882c=function(_0x3f6cac,_0x2bec42){_0x3f6cac=_0x3f6cac-0x0;var _0xd01fea=_0x82c8[_0x3f6cac];return _0xd01fea;};'use strict';var _=require(_0x882c('0x0'));function MailAccount(_0x40b354){this['id']=_0x40b354['id']||0x0;this[_0x882c('0x1')]=_0x40b354[_0x882c('0x1')]||_0x882c('0x2');this[_0x882c('0x3')]=_0x40b354['key']||_0x882c('0x4');this['active']=_0x40b354[_0x882c('0x5')]||![];this[_0x882c('0x6')]=_0x40b354[_0x882c('0x6')]||[];this[_0x882c('0x7')]=_0x40b354[_0x882c('0x7')]||[];}module['exports']=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 813d356..9def7dc 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 _0x67a1=['hasOwnProperty','prototype','initMailAccounts','mailAccounts','isUndefined','merge','exports','lodash','../model/mailAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x67a1,0x1a5));var _0x167a=function(_0xdd1503,_0x1f212d){_0xdd1503=_0xdd1503-0x0;var _0x5b82a0=_0x67a1[_0xdd1503];return _0x5b82a0;};'use strict';var _=require(_0x167a('0x0'));var MailAccount=require(_0x167a('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x2efd81,_0x10fb6e,_0x416c67){var _0x4eafb3=_['mapKeys'](_0x2efd81,function(_0x3cf064,_0x324028){return _0x3cf064[_0x416c67];});for(var _0xd8b159 in _0x10fb6e){if(_0x10fb6e[_0x167a('0x2')](_0xd8b159)){if(!_0x4eafb3[_0xd8b159]){delete _0x10fb6e[_0xd8b159];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x6817c8,_0x2e63ba){for(var _0x150e77 in _0x2e63ba){if(_0x6817c8['hasOwnProperty'](_0x150e77)){_0x6817c8[_0x150e77]=_0x2e63ba[_0x150e77];}}};Realtime[_0x167a('0x3')][_0x167a('0x4')]=function(){var _0x243f32=this;return function(_0x2fccd3){if(_0x2fccd3){freeIsNotKey(_0x2fccd3,_0x243f32[_0x167a('0x5')],'id');for(var _0x34bfc9=0x0,_0x4beee1={},_0x3c641b={};_0x34bfc9<_0x2fccd3['length'];_0x34bfc9+=0x1){_0x4beee1=_0x2fccd3[_0x34bfc9];if(_[_0x167a('0x6')](_0x243f32[_0x167a('0x5')][_0x4beee1['id']])){_0x243f32['mailAccounts'][_0x4beee1['id']]=new MailAccount(_0x4beee1);}else{_[_0x167a('0x7')](_0x243f32[_0x167a('0x5')][_0x4beee1['id']],_0x4beee1);}}}return _0x243f32[_0x167a('0x5')];};};module[_0x167a('0x8')]=Realtime; \ No newline at end of file +var _0xcc64=['lodash','../model/mailAccount','mapKeys','hasOwnProperty','mergeFromDatabase','initMailAccounts','mailAccounts','merge','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcc64,0x87));var _0x4cc6=function(_0x3c93df,_0x3e981e){_0x3c93df=_0x3c93df-0x0;var _0x4dd0c8=_0xcc64[_0x3c93df];return _0x4dd0c8;};'use strict';var _=require(_0x4cc6('0x0'));var MailAccount=require(_0x4cc6('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x24b910,_0x3083d1,_0x394213){var _0x172d8f=_[_0x4cc6('0x2')](_0x24b910,function(_0x480ad1,_0x117c56){return _0x480ad1[_0x394213];});for(var _0x2beda6 in _0x3083d1){if(_0x3083d1[_0x4cc6('0x3')](_0x2beda6)){if(!_0x172d8f[_0x2beda6]){delete _0x3083d1[_0x2beda6];}}}}Realtime['prototype'][_0x4cc6('0x4')]=function(_0x115ac0,_0x562ab7){for(var _0x26b56c in _0x562ab7){if(_0x115ac0[_0x4cc6('0x3')](_0x26b56c)){_0x115ac0[_0x26b56c]=_0x562ab7[_0x26b56c];}}};Realtime['prototype'][_0x4cc6('0x5')]=function(){var _0x7b0748=this;return function(_0x19356b){if(_0x19356b){freeIsNotKey(_0x19356b,_0x7b0748[_0x4cc6('0x6')],'id');for(var _0x63bafb=0x0,_0x5e6921={},_0x5669d3={};_0x63bafb<_0x19356b['length'];_0x63bafb+=0x1){_0x5e6921=_0x19356b[_0x63bafb];if(_['isUndefined'](_0x7b0748[_0x4cc6('0x6')][_0x5e6921['id']])){_0x7b0748['mailAccounts'][_0x5e6921['id']]=new MailAccount(_0x5e6921);}else{_[_0x4cc6('0x7')](_0x7b0748[_0x4cc6('0x6')][_0x5e6921['id']],_0x5e6921);}}}return _0x7b0748[_0x4cc6('0x6')];};};module[_0x4cc6('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 00783f4..cb740ba 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 _0xa1d2=['email','active','key','ListId','TemplateId','Imap','CloudProvider','type','data5','MailServerOut','Smtp','notify','NotifyMailAccount','getMailAccounts','GetMailAccount','name','provider','service'];(function(_0x3d0352,_0x33127c){var _0x2ad888=function(_0x50393e){while(--_0x50393e){_0x3d0352['push'](_0x3d0352['shift']());}};_0x2ad888(++_0x33127c);}(_0xa1d2,0x151));var _0x2a1d=function(_0x17e4d0,_0x2d354b){_0x17e4d0=_0x17e4d0-0x0;var _0x559fe2=_0xa1d2[_0x17e4d0];return _0x559fe2;};'use strict';var client=require('../client');exports[_0x2a1d('0x0')]=function(){return function(){return client['Request'](_0x2a1d('0x1'),{'options':{'attributes':['id',_0x2a1d('0x2'),_0x2a1d('0x3'),_0x2a1d('0x4'),_0x2a1d('0x5'),_0x2a1d('0x6'),_0x2a1d('0x7'),_0x2a1d('0x8'),_0x2a1d('0x9')],'raw':![],'include':[{'model':'MailServerIn','as':_0x2a1d('0xa'),'include':[{'model':_0x2a1d('0xb'),'attributes':['id',_0x2a1d('0x2'),_0x2a1d('0x4'),_0x2a1d('0xc'),_0x2a1d('0xd')],'as':_0x2a1d('0xb')}]},{'model':_0x2a1d('0xe'),'as':_0x2a1d('0xf'),'include':[{'model':_0x2a1d('0xb'),'attributes':['id','name',_0x2a1d('0x4'),'type',_0x2a1d('0xd')],'as':_0x2a1d('0xb')}]}]},'log':'getMailAccount'});};};exports[_0x2a1d('0x10')]=function(_0x2b443f,_0x21f1d3){return client['Request'](_0x2a1d('0x11'),{'account':{'id':_0x2b443f},'body':_0x21f1d3,'log':'NotifyMailAccount'});}; \ No newline at end of file +var _0x76c1=['getMailAccounts','Request','GetMailAccount','name','provider','service','active','key','ListId','TemplateId','MailServerIn','CloudProvider','type','Smtp','notify','NotifyMailAccount','../client'];(function(_0x471faf,_0x48aef2){var _0x14fb3f=function(_0x5c09f0){while(--_0x5c09f0){_0x471faf['push'](_0x471faf['shift']());}};_0x14fb3f(++_0x48aef2);}(_0x76c1,0x87));var _0x176c=function(_0x4226d6,_0x3864ca){_0x4226d6=_0x4226d6-0x0;var _0x19655b=_0x76c1[_0x4226d6];return _0x19655b;};'use strict';var client=require(_0x176c('0x0'));exports[_0x176c('0x1')]=function(){return function(){return client[_0x176c('0x2')](_0x176c('0x3'),{'options':{'attributes':['id',_0x176c('0x4'),_0x176c('0x5'),_0x176c('0x6'),'email',_0x176c('0x7'),_0x176c('0x8'),_0x176c('0x9'),_0x176c('0xa')],'raw':![],'include':[{'model':_0x176c('0xb'),'as':'Imap','include':[{'model':_0x176c('0xc'),'attributes':['id',_0x176c('0x4'),'service',_0x176c('0xd'),'data5'],'as':_0x176c('0xc')}]},{'model':'MailServerOut','as':_0x176c('0xe'),'include':[{'model':'CloudProvider','attributes':['id',_0x176c('0x4'),_0x176c('0x6'),_0x176c('0xd'),'data5'],'as':_0x176c('0xc')}]}]},'log':'getMailAccount'});};};exports[_0x176c('0xf')]=function(_0x49e0f4,_0x53f496){return client[_0x176c('0x2')](_0x176c('0x10'),{'account':{'id':_0x49e0f4},'body':_0x53f496,'log':_0x176c('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index a862392..6288705 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 _0x71c3=['loginMailFrequency','../client','Request'];(function(_0x1d2bbb,_0x202267){var _0x38082b=function(_0x27d153){while(--_0x27d153){_0x1d2bbb['push'](_0x1d2bbb['shift']());}};_0x38082b(++_0x202267);}(_0x71c3,0x97));var _0x371c=function(_0x1418dc,_0x1cc11c){_0x1418dc=_0x1418dc-0x0;var _0x390791=_0x71c3[_0x1418dc];return _0x390791;};'use strict';var client=require(_0x371c('0x0'));exports['getSettings']=function(){return client[_0x371c('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x371c('0x2')]},'log':'GetSettings'});}; \ No newline at end of file +var _0x0e48=['loginMailFrequency','GetSettings','../client','ShowSetting'];(function(_0x4382bc,_0x231a2d){var _0x13c82a=function(_0x3723b0){while(--_0x3723b0){_0x4382bc['push'](_0x4382bc['shift']());}};_0x13c82a(++_0x231a2d);}(_0x0e48,0x1d6));var _0x80e4=function(_0x37be46,_0x2c2fee){_0x37be46=_0x37be46-0x0;var _0x36e16e=_0x0e48[_0x37be46];return _0x36e16e;};'use strict';var client=require(_0x80e4('0x0'));exports['getSettings']=function(){return client['Request'](_0x80e4('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x80e4('0x2')]},'log':_0x80e4('0x3')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 6b03128..29d5b40 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(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0xa9e0[_0xea8947];return _0x2455e9;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 e21b067..97b7216 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 _0x3506=['log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','timeout','listen','port','websocket','polling','redis','defaults','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','listening'];(function(_0x29051f,_0x2b1480){var _0x47d64c=function(_0x2c461d){while(--_0x2c461d){_0x29051f['push'](_0x29051f['shift']());}};_0x47d64c(++_0x2b1480);}(_0x3506,0x161));var _0x6350=function(_0x6ca944,_0x301be4){_0x6ca944=_0x6ca944-0x0;var _0x5965fe=_0x3506[_0x6ca944];return _0x5965fe;};'use strict';var _=require(_0x6350('0x0'));var http=require(_0x6350('0x1'));var express=require(_0x6350('0x2'));var sticky=require(_0x6350('0x3'));var Redis=require(_0x6350('0x4'));var config=require(_0x6350('0x5'));var app=express();var server=http['createServer'](app);server[_0x6350('0x6')]=0xdbba0;if(sticky[_0x6350('0x7')](server,config[_0x6350('0x8')])){var socketio=require('socket.io')(server,{'transports':[_0x6350('0x9'),_0x6350('0xa')]});config[_0x6350('0xb')]=_[_0x6350('0xc')](config[_0x6350('0xb')],{'host':_0x6350('0xd'),'port':0x18eb});socketio[_0x6350('0xe')](require(_0x6350('0xf'))({'pubClient':new Redis(config[_0x6350('0xb')]),'subClient':new Redis(config[_0x6350('0xb')])}));require(_0x6350('0x10'))[_0x6350('0x11')]();require(_0x6350('0x12'))[_0x6350('0x11')](socketio);require(_0x6350('0x13'))[_0x6350('0x11')](app);require(_0x6350('0x14'))[_0x6350('0x11')](app);}else{server['once'](_0x6350('0x15'),function(){console[_0x6350('0x16')](_0x6350('0x17'),config['port']);});}exports=module[_0x6350('0x18')]=app; \ No newline at end of file +var _0xe2d7=['createServer','timeout','listen','port','socket.io','websocket','polling','redis','defaults','localhost','adapter','../../config/triggers','default','../../config/socketio','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','http','sticky-session','ioredis','../../config/environment'];(function(_0x17b9e2,_0x3921fa){var _0x4335d2=function(_0x42b90b){while(--_0x42b90b){_0x17b9e2['push'](_0x17b9e2['shift']());}};_0x4335d2(++_0x3921fa);}(_0xe2d7,0xd8));var _0x7e2d=function(_0x2a564e,_0xcb1f8a){_0x2a564e=_0x2a564e-0x0;var _0x593482=_0xe2d7[_0x2a564e];return _0x593482;};'use strict';var _=require('lodash');var http=require(_0x7e2d('0x0'));var express=require('express');var sticky=require(_0x7e2d('0x1'));var Redis=require(_0x7e2d('0x2'));var config=require(_0x7e2d('0x3'));var app=express();var server=http[_0x7e2d('0x4')](app);server[_0x7e2d('0x5')]=0xdbba0;if(sticky[_0x7e2d('0x6')](server,config[_0x7e2d('0x7')])){var socketio=require(_0x7e2d('0x8'))(server,{'transports':[_0x7e2d('0x9'),_0x7e2d('0xa')]});config[_0x7e2d('0xb')]=_[_0x7e2d('0xc')](config[_0x7e2d('0xb')],{'host':_0x7e2d('0xd'),'port':0x18eb});socketio[_0x7e2d('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x7e2d('0xb')]),'subClient':new Redis(config[_0x7e2d('0xb')])}));require(_0x7e2d('0xf'))[_0x7e2d('0x10')]();require(_0x7e2d('0x11'))[_0x7e2d('0x10')](socketio);require('../../config/express')['default'](app);require('../../routes')[_0x7e2d('0x10')](app);}else{server['once'](_0x7e2d('0x12'),function(){console[_0x7e2d('0x13')](_0x7e2d('0x14'),config[_0x7e2d('0x7')]);});}exports=module[_0x7e2d('0x15')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 5806073..ea85037 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 _0xeb3f=['error','rpc','routing','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','client','http','request','then'];(function(_0x4caf11,_0x46db74){var _0x3e27db=function(_0x3fab9a){while(--_0x3fab9a){_0x4caf11['push'](_0x4caf11['shift']());}};_0x3e27db(++_0x46db74);}(_0xeb3f,0x77));var _0xfeb3=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xeb3f[_0x17d9e3];return _0x14192d;};'use strict';var jayson=require(_0xfeb3('0x0'));var BPromise=require(_0xfeb3('0x1'));var logger=require(_0xfeb3('0x2'))('routing');var client=jayson[_0xfeb3('0x3')][_0xfeb3('0x4')]({'port':0x2329});client['Request']=function(_0x385c9b,_0x1fa9ad){return new BPromise(function(_0x23edee,_0x178e4d){return client[_0xfeb3('0x5')](_0x385c9b,_0x1fa9ad)[_0xfeb3('0x6')](function(_0x1bff6e){logger['debug']('rpc','routing',_0x385c9b,_0x1fa9ad,_0x1bff6e);if(_0x1bff6e[_0xfeb3('0x7')]){logger[_0xfeb3('0x7')](_0xfeb3('0x8'),_0xfeb3('0x9'),_0x385c9b,_0x1bff6e[_0xfeb3('0x7')][_0xfeb3('0xa')],_0x1fa9ad);return _0x178e4d(_0x1bff6e[_0xfeb3('0x7')][_0xfeb3('0xa')]);}else{return _0x23edee(_0x1bff6e[_0xfeb3('0xb')]);}})[_0xfeb3('0xc')](function(_0x205449){logger[_0xfeb3('0x7')](_0xfeb3('0x8'),_0xfeb3('0x9'),_0x385c9b,_0x205449,_0x1fa9ad);return _0x178e4d(_0x205449);});});};module[_0xfeb3('0xd')]=client; \ No newline at end of file +var _0x1ed2=['catch','exports','../../config/logger','client','http','Request','request','debug','error','rpc','routing','message','result'];(function(_0xb83ec2,_0x18e73b){var _0x4d2fbf=function(_0x16538a){while(--_0x16538a){_0xb83ec2['push'](_0xb83ec2['shift']());}};_0x4d2fbf(++_0x18e73b);}(_0x1ed2,0x1bc));var _0x21ed=function(_0x8fd7be,_0xcd1d8d){_0x8fd7be=_0x8fd7be-0x0;var _0xd527d7=_0x1ed2[_0x8fd7be];return _0xd527d7;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x21ed('0x0'))('routing');var client=jayson[_0x21ed('0x1')][_0x21ed('0x2')]({'port':0x2329});client[_0x21ed('0x3')]=function(_0x4c34a9,_0x13797c){return new BPromise(function(_0x3a2908,_0x1aca5f){return client[_0x21ed('0x4')](_0x4c34a9,_0x13797c)['then'](function(_0x1c6d19){logger[_0x21ed('0x5')]('rpc','routing',_0x4c34a9,_0x13797c,_0x1c6d19);if(_0x1c6d19[_0x21ed('0x6')]){logger[_0x21ed('0x6')](_0x21ed('0x7'),_0x21ed('0x8'),_0x4c34a9,_0x1c6d19[_0x21ed('0x6')]['message'],_0x13797c);return _0x1aca5f(_0x1c6d19[_0x21ed('0x6')][_0x21ed('0x9')]);}else{return _0x3a2908(_0x1c6d19[_0x21ed('0xa')]);}})[_0x21ed('0xb')](function(_0x140458){logger[_0x21ed('0x6')](_0x21ed('0x7'),_0x21ed('0x8'),_0x4c34a9,_0x140458,_0x13797c);return _0x1aca5f(_0x140458);});});};module[_0x21ed('0xc')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index fc35ea2..9883647 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 _0x227d=['bluebird','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','catch','log'];(function(_0x566029,_0x5e152a){var _0x4d29f0=function(_0x56e8f7){while(--_0x56e8f7){_0x566029['push'](_0x566029['shift']());}};_0x4d29f0(++_0x5e152a);}(_0x227d,0x7d));var _0xd227=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x227d[_0x506d83];return _0x335e8b;};'use strict';var BPromise=require(_0xd227('0x0'));var server=require('./server');var Realtime=require(_0xd227('0x1'));var user=require(_0xd227('0x2'));var interval=require('./rpc/interval');var openchannelQueue=require(_0xd227('0x3'));var chatQueue=require(_0xd227('0x4'));var smsQueue=require(_0xd227('0x5'));var mailQueue=require(_0xd227('0x6'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xd227('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xd227('0x8')]()[_0xd227('0x9')](user['getAgents']())[_0xd227('0x9')](realtime['initAgents']())[_0xd227('0x9')](interval[_0xd227('0xa')]())[_0xd227('0x9')](realtime[_0xd227('0xb')]())['then'](openchannelQueue[_0xd227('0xc')]())[_0xd227('0x9')](realtime[_0xd227('0xd')]())['then'](chatQueue[_0xd227('0xe')]())[_0xd227('0x9')](realtime[_0xd227('0xf')]())[_0xd227('0x9')](smsQueue[_0xd227('0x10')]())[_0xd227('0x9')](realtime[_0xd227('0x11')]())[_0xd227('0x9')](mailQueue['getMailQueues']())[_0xd227('0x9')](realtime[_0xd227('0x12')]())[_0xd227('0x9')](faxQueue[_0xd227('0x13')]())[_0xd227('0x9')](realtime[_0xd227('0x14')]())[_0xd227('0x9')](whatsappQueue[_0xd227('0x15')]())[_0xd227('0x9')](realtime[_0xd227('0x16')]())[_0xd227('0x9')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0xd227('0x9')](function(_0x295351){return initRealtime();})['then'](function(_0x42c962){return setInterval(initRealtime,0x1388);})[_0xd227('0x17')](function(_0x21e52a){console[_0xd227('0x18')](_0x21e52a);});}main(); \ No newline at end of file +var _0x1958=['getIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server','./realtime','./rpc/user','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents'];(function(_0x119280,_0x439c3e){var _0x481797=function(_0x4265cb){while(--_0x4265cb){_0x119280['push'](_0x119280['shift']());}};_0x481797(++_0x439c3e);}(_0x1958,0x153));var _0x8195=function(_0x1c9f90,_0x538898){_0x1c9f90=_0x1c9f90-0x0;var _0x2e0c4c=_0x1958[_0x1c9f90];return _0x2e0c4c;};'use strict';var BPromise=require(_0x8195('0x0'));var server=require(_0x8195('0x1'));var Realtime=require(_0x8195('0x2'));var user=require(_0x8195('0x3'));var interval=require('./rpc/interval');var openchannelQueue=require(_0x8195('0x4'));var chatQueue=require(_0x8195('0x5'));var smsQueue=require(_0x8195('0x6'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x8195('0x7'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x8195('0x8')]()[_0x8195('0x9')](user[_0x8195('0xa')]())[_0x8195('0x9')](realtime['initAgents']())[_0x8195('0x9')](interval[_0x8195('0xb')]())[_0x8195('0x9')](realtime['initIntervals']())[_0x8195('0x9')](openchannelQueue[_0x8195('0xc')]())[_0x8195('0x9')](realtime[_0x8195('0xd')]())['then'](chatQueue['getChatQueues']())['then'](realtime[_0x8195('0xe')]())[_0x8195('0x9')](smsQueue['getSmsQueues']())['then'](realtime[_0x8195('0xf')]())['then'](mailQueue[_0x8195('0x10')]())[_0x8195('0x9')](realtime[_0x8195('0x11')]())[_0x8195('0x9')](faxQueue[_0x8195('0x12')]())[_0x8195('0x9')](realtime[_0x8195('0x13')]())[_0x8195('0x9')](whatsappQueue[_0x8195('0x14')]())['then'](realtime[_0x8195('0x15')]())['then'](function(){return realtime;});}function main(){return server[_0x8195('0x16')](realtime)[_0x8195('0x9')](function(_0x353b5f){return initRealtime();})[_0x8195('0x9')](function(_0x3c6430){return setInterval(initRealtime,0x1388);})[_0x8195('0x17')](function(_0x415b47){console[_0x8195('0x18')](_0x415b47);});}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 f3457e5..93e8531 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['turn','prioritize','priority','toJSON','map','toString','fromJSON','isString','object','exports','lodash','util','events','isNil','register','ignoreFactChanges','inherits','init','rules','activeRules','concat','prototype','sync','filter','orderBy','asc','execute','clone','consequence','ruleRef','name','index_','nextTick','push','call','isEqual','restart','length','condition','matchPath','noop','findRules'];(function(_0x2b19fa,_0x133f6a){var _0x396c9f=function(_0x4711f4){while(--_0x4711f4){_0x2b19fa['push'](_0x2b19fa['shift']());}};_0x396c9f(++_0x133f6a);}(_0x7a54,0x106));var _0x47a5=function(_0x828fd,_0x40b6f8){_0x828fd=_0x828fd-0x0;var _0x3929c6=_0x7a54[_0x828fd];return _0x3929c6;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var EventEmitter=require(_0x47a5('0x2'))['EventEmitter'];function RuleEngine(_0x1d33e,_0x4086cd){this['init']();if(!_[_0x47a5('0x3')](_0x1d33e)){this[_0x47a5('0x4')](_0x1d33e);}if(_0x4086cd){this[_0x47a5('0x5')]=_0x4086cd[_0x47a5('0x5')];}return this;}util[_0x47a5('0x6')](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x47a5('0x7')]=function(_0x59199c){this[_0x47a5('0x8')]=[];this[_0x47a5('0x9')]=[];};RuleEngine['prototype'][_0x47a5('0x4')]=function(_0x5077f3){if(Array['isArray'](_0x5077f3)){this['rules']=this[_0x47a5('0x8')][_0x47a5('0xa')](_0x5077f3);}else if(_0x5077f3!==null&&_['isObject'](_0x5077f3)){this[_0x47a5('0x8')]['push'](_0x5077f3);}this['sync']();};RuleEngine[_0x47a5('0xb')][_0x47a5('0xc')]=function(){this[_0x47a5('0x9')]=this[_0x47a5('0x8')][_0x47a5('0xd')](function(_0xd308b8){if(_[_0x47a5('0x3')](_0xd308b8['on'])){_0xd308b8['on']=!![];}if(_0xd308b8['on']===!![]){return _0xd308b8;}});this['activeRules']=_[_0x47a5('0xe')](this[_0x47a5('0x9')],['p'],[_0x47a5('0xf')]);};RuleEngine[_0x47a5('0xb')][_0x47a5('0x10')]=function(_0x620ee9,_0x3c6c46){var _0x190faa=![];_0x620ee9['result']=!![];var _0x362359=_[_0x47a5('0x11')](_0x620ee9);var _0x3b001e=_[_0x47a5('0x11')](_0x620ee9);var _0x1ef44c=this['activeRules'];var _0x549de3=[];var _0x138bc0=this['ignoreFactChanges'];(function FnRuleLoop(_0x5247fd){var _0x423a81={'rules':function(){return _0x1ef44c;},'rule':function(){return _0x1ef44c[_0x5247fd];},'when':function(_0xaf70a6){if(_0xaf70a6){var _0x2ce454=_0x1ef44c[_0x5247fd][_0x47a5('0x12')];_0x2ce454[_0x47a5('0x13')]=_0x1ef44c[_0x5247fd]['id']||_0x1ef44c[_0x5247fd][_0x47a5('0x14')]||_0x47a5('0x15')+_0x5247fd;process[_0x47a5('0x16')](function(){_0x549de3[_0x47a5('0x17')](_0x2ce454['ruleRef']);_0x2ce454[_0x47a5('0x18')](_0x362359,_0x423a81);});}else{process[_0x47a5('0x16')](function(){_0x423a81['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190faa=!![];return FnRuleLoop(0x0);},'next':function(_0x2b0360){if(!_0x138bc0&&!_[_0x47a5('0x19')](_0x3b001e,_0x362359)){_0x3b001e=_[_0x47a5('0x11')](_0x362359);process['nextTick'](function(){_0x423a81[_0x47a5('0x1a')]();});}else{process[_0x47a5('0x16')](function(){if(_[_0x47a5('0x3')](_0x2b0360)){return FnRuleLoop(_0x5247fd+0x1);}else{return FnRuleLoop(_0x2b0360);}});}}};if(_0x5247fd<_0x1ef44c[_0x47a5('0x1b')]&&_0x190faa===![]){var _0x5ef1b1=_0x1ef44c[_0x5247fd][_0x47a5('0x1c')];_0x5ef1b1[_0x47a5('0x18')](_0x362359,_0x423a81);}else{process['nextTick'](function(){_0x362359[_0x47a5('0x1d')]=_0x549de3;return _0x3c6c46?_0x3c6c46(_0x362359):_[_0x47a5('0x1e')]();});}}(0x0));};RuleEngine[_0x47a5('0xb')][_0x47a5('0x1f')]=function(_0x3abd6a){if(_['isNil'](_0x3abd6a)){return this['rules'];}else{var _0x136745=_['matches'](_0x3abd6a);return _[_0x47a5('0xd')](this['rules'],_0x136745);}};RuleEngine[_0x47a5('0xb')][_0x47a5('0x20')]=function(_0x36ad34,_0x1dac65){var _0x21f296=_0x36ad34==='on'||_0x36ad34==='ON'?!![]:![];var _0x3ba0b7=this[_0x47a5('0x1f')](_0x1dac65);for(var _0x136b14=0x0,_0x16631f=_0x3ba0b7[_0x47a5('0x1b')];_0x136b14<_0x16631f;_0x136b14+=0x1){_0x3ba0b7[_0x136b14]['on']=_0x21f296;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x21')]=function(_0x528582,_0x243210){_0x528582=parseInt(_0x528582,0xa);var _0x51833b=this[_0x47a5('0x1f')](_0x243210);for(var _0x9ac908=0x0,_0x16901f=_0x51833b['length'];_0x9ac908<_0x16901f;_0x9ac908+=0x1){_0x51833b[_0x9ac908][_0x47a5('0x22')]=_0x528582;}this[_0x47a5('0xc')]();};RuleEngine[_0x47a5('0xb')][_0x47a5('0x23')]=function(){var _0x51cc81=this['rules'];if(_0x51cc81 instanceof Array){_0x51cc81=_0x51cc81[_0x47a5('0x24')](function(_0xfb5ddb){_0xfb5ddb['condition']=_0xfb5ddb['condition'][_0x47a5('0x25')]();_0xfb5ddb[_0x47a5('0x12')]=_0xfb5ddb['consequence'][_0x47a5('0x25')]();return _0xfb5ddb;});}else if(!_['isNil'](_0x51cc81)){_0x51cc81[_0x47a5('0x1c')]=_0x51cc81[_0x47a5('0x1c')]['toString']();_0x51cc81['consequence']=_0x51cc81[_0x47a5('0x12')]['toString']();}return _0x51cc81;};RuleEngine[_0x47a5('0xb')][_0x47a5('0x26')]=function(_0xf269a8){this['init']();if(_[_0x47a5('0x27')](_0xf269a8)){_0xf269a8=JSON['parse'](_0xf269a8);}if(_0xf269a8 instanceof Array){_0xf269a8=_0xf269a8['map'](function(_0x65542e){_0x65542e['condition']=eval('('+_0x65542e[_0x47a5('0x1c')]+')');_0x65542e['consequence']=eval('('+_0x65542e[_0x47a5('0x12')]+')');return _0x65542e;});}else if(_0xf269a8!==null&&typeof _0xf269a8==_0x47a5('0x28')){_0xf269a8[_0x47a5('0x1c')]=eval('('+_0xf269a8[_0x47a5('0x1c')]+')');_0xf269a8[_0x47a5('0x12')]=eval('('+_0xf269a8[_0x47a5('0x12')]+')');}this[_0x47a5('0x4')](_0xf269a8);};module[_0x47a5('0x29')]=RuleEngine; \ No newline at end of file +var _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(_0x5a0e32,_0x347ae2){var _0xea8f24=function(_0x47f773){while(--_0x47f773){_0x5a0e32['push'](_0x5a0e32['shift']());}};_0xea8f24(++_0x347ae2);}(_0x5fc3,0xa8));var _0x35fc=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x5fc3[_0x618414];return _0x21c19a;};'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 diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 880046b..34b4062 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 _0x4837=['http','request','then','message','result','catch','sendMailMessage','SendMail','client'];(function(_0x3a45b6,_0x1b9079){var _0x397031=function(_0x4d543b){while(--_0x4d543b){_0x3a45b6['push'](_0x3a45b6['shift']());}};_0x397031(++_0x1b9079);}(_0x4837,0x1e5));var _0x7483=function(_0x704d75,_0x42305d){_0x704d75=_0x704d75-0x0;var _0xaba918=_0x4837[_0x704d75];return _0xaba918;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x7483('0x0')][_0x7483('0x1')]({'port':0x232b});function request(_0x11d518,_0x196135){return new BPromise(function(_0x2cad2c,_0x17daa6){return client[_0x7483('0x2')](_0x11d518,_0x196135)[_0x7483('0x3')](function(_0xf0a6d3){if(_0xf0a6d3['error']){return _0x17daa6(_0xf0a6d3['error'][_0x7483('0x4')]);}else{return _0x2cad2c(_0xf0a6d3[_0x7483('0x5')]);}})[_0x7483('0x6')](function(_0x58ef3b){return _0x17daa6(_0x58ef3b);});});}exports[_0x7483('0x7')]=function(_0x285370,_0xac0a4e){return request(_0x7483('0x8'),{'account':_0x285370,'message':_0xac0a4e});}; \ No newline at end of file +var _0x0198=['SendMail','bluebird','jayson/promise','client','request','error','message','result','catch','sendMailMessage'];(function(_0x522ebe,_0x569b6b){var _0x1135b2=function(_0x5c4a3e){while(--_0x5c4a3e){_0x522ebe['push'](_0x522ebe['shift']());}};_0x1135b2(++_0x569b6b);}(_0x0198,0xab));var _0x8019=function(_0x356e8d,_0x24c719){_0x356e8d=_0x356e8d-0x0;var _0x39e65a=_0x0198[_0x356e8d];return _0x39e65a;};'use strict';var BPromise=require(_0x8019('0x0'));var jayson=require(_0x8019('0x1'));var client=jayson[_0x8019('0x2')]['http']({'port':0x232b});function request(_0x3e46b4,_0x438859){return new BPromise(function(_0x86ae2e,_0x205555){return client[_0x8019('0x3')](_0x3e46b4,_0x438859)['then'](function(_0x56e50a){if(_0x56e50a[_0x8019('0x4')]){return _0x205555(_0x56e50a['error'][_0x8019('0x5')]);}else{return _0x86ae2e(_0x56e50a[_0x8019('0x6')]);}})[_0x8019('0x7')](function(_0x474cd3){return _0x205555(_0x474cd3);});});}exports[_0x8019('0x8')]=function(_0x51ebc5,_0x4bc357){return request(_0x8019('0x9'),{'account':_0x51ebc5,'message':_0x4bc357});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index b197ce4..83f4c36 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 _0x3a6d=['faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','CurrentCapacity','Capacity','maxcapacity','idle','prototype','updateRealtime','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','chatCapacity','chatCurrentCapacity','faxCurrentCapacity','smsCurrentCapacity','whatsappStatus','openchannelStatusTime','mailWaitingInteractions','stringify','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause'];(function(_0x39f624,_0x2f8a0b){var _0x5f3e08=function(_0x25e112){while(--_0x25e112){_0x39f624['push'](_0x39f624['shift']());}};_0x5f3e08(++_0x2f8a0b);}(_0x3a6d,0x143));var _0xd3a6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3a6d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd3a6('0x0'));var md5=require(_0xd3a6('0x1'));var moment=require('moment');var Redis=require(_0xd3a6('0x2'));var config=require(_0xd3a6('0x3'));config[_0xd3a6('0x4')]=_[_0xd3a6('0x5')](config[_0xd3a6('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd3a6('0x6'))(new Redis(config[_0xd3a6('0x4')]));function Agent(_0x1e44bd){this['id']=_0x1e44bd['id']||0x0;this[_0xd3a6('0x7')]=_0x1e44bd[_0xd3a6('0x7')]||'';this[_0xd3a6('0x8')]=_0x1e44bd['online']||!![];this[_0xd3a6('0x9')]=_0x1e44bd[_0xd3a6('0x9')]||![];this[_0xd3a6('0xa')]=_0x1e44bd[_0xd3a6('0xa')]||![];this[_0xd3a6('0xb')]=_0x1e44bd[_0xd3a6('0xb')]||![];this[_0xd3a6('0xc')]=_0x1e44bd[_0xd3a6('0xc')]||![];this[_0xd3a6('0xd')]=_0x1e44bd['smsPause']||![];this[_0xd3a6('0xe')]=_0x1e44bd[_0xd3a6('0xe')]||![];this[_0xd3a6('0xf')]=_0xd3a6('0x10');this[_0xd3a6('0x11')]=0x0;this['chatCapacity']=_0x1e44bd['chatCapacity']||0x0;this['chatCurrentCapacity']=0x0;this[_0xd3a6('0x12')]=_0xd3a6('0x10');this[_0xd3a6('0x13')]=0x0;this[_0xd3a6('0x14')]=_0x1e44bd[_0xd3a6('0x14')]||0x0;this[_0xd3a6('0x15')]=0x0;this[_0xd3a6('0x16')]='unknown';this[_0xd3a6('0x17')]=0x0;this[_0xd3a6('0x18')]=_0x1e44bd[_0xd3a6('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd3a6('0x19')]=_0xd3a6('0x10');this[_0xd3a6('0x1a')]=0x0;this['smsCapacity']=_0x1e44bd[_0xd3a6('0x1b')]||0x0;this['smsCurrentCapacity']=0x0;this['whatsappStatus']=_0xd3a6('0x10');this[_0xd3a6('0x1c')]=0x0;this[_0xd3a6('0x1d')]=_0x1e44bd[_0xd3a6('0x1d')]||0x0;this[_0xd3a6('0x1e')]=0x0;this[_0xd3a6('0x1f')]=_0xd3a6('0x10');this['openchannelStatusTime']=0x0;this[_0xd3a6('0x20')]=_0x1e44bd['openchannelCapacity']||0x0;this[_0xd3a6('0x21')]=0x0;this[_0xd3a6('0x22')]=![];this[_0xd3a6('0x23')]=undefined;this[_0xd3a6('0x1')]='';this[_0xd3a6('0x24')]={};this[_0xd3a6('0x25')]={};this['mailWaitingInteractions']={};this[_0xd3a6('0x26')]={};this[_0xd3a6('0x27')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent['prototype']['getChannelStatus']=function(_0x5c9075){if(this[_0x5c9075+_0xd3a6('0x28')]>0x0){if(this[_0x5c9075+_0xd3a6('0x29')]>0x0&&this[_0x5c9075+_0xd3a6('0x28')]>=this[_0x5c9075+'Capacity']){return _0xd3a6('0x2a');}else{return'working';}}else{return _0xd3a6('0x2b');}};Agent[_0xd3a6('0x2c')][_0xd3a6('0x2d')]=function(){var _0x4f6130=[_0xd3a6('0x2e'),_0xd3a6('0x2f'),_0xd3a6('0x30'),_0xd3a6('0x31'),_0xd3a6('0x32'),_0xd3a6('0x33')];for(var _0x5650d1=0x0;_0x5650d1<_0x4f6130[_0xd3a6('0x34')];_0x5650d1+=0x1){var _0x2b5448=this[_0xd3a6('0x35')](_0x4f6130[_0x5650d1]);if(this[_0x4f6130[_0x5650d1]+_0xd3a6('0x36')]!==_0x2b5448){this[_0x4f6130[_0x5650d1]+_0xd3a6('0x37')]=_[_0xd3a6('0x38')](moment()['format']('x'));}this[_0x4f6130[_0x5650d1]+'Status']=_0x2b5448;}var _0x1f4859={'id':this['id'],'name':this[_0xd3a6('0x7')],'online':this[_0xd3a6('0x8')],'voicePause':this[_0xd3a6('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0xd3a6('0xb')],'smsPause':this[_0xd3a6('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xd3a6('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this[_0xd3a6('0x11')],'chatCapacity':this[_0xd3a6('0x39')],'chatCurrentCapacity':this[_0xd3a6('0x3a')],'mailStatus':this[_0xd3a6('0x12')],'mailStatusTime':this[_0xd3a6('0x13')],'mailCapacity':this[_0xd3a6('0x14')],'mailCurrentCapacity':this[_0xd3a6('0x15')],'faxStatus':this['faxStatus'],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd3a6('0x18')],'faxCurrentCapacity':this[_0xd3a6('0x3b')],'smsStatus':this[_0xd3a6('0x19')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this[_0xd3a6('0x1b')],'smsCurrentCapacity':this[_0xd3a6('0x3c')],'whatsappStatus':this[_0xd3a6('0x3d')],'whatsappStatusTime':this[_0xd3a6('0x1c')],'whatsappCapacity':this[_0xd3a6('0x1d')],'whatsappCurrentCapacity':this[_0xd3a6('0x1e')],'openchannelStatus':this[_0xd3a6('0x1f')],'openchannelStatusTime':this[_0xd3a6('0x3e')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd3a6('0x21')],'busy':this[_0xd3a6('0x22')],'busyQueue':this[_0xd3a6('0x23')],'chatWaitingInteractions':this[_0xd3a6('0x24')],'faxWaitingInteractions':this[_0xd3a6('0x25')],'mailWaitingInteractions':this[_0xd3a6('0x3f')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0xd3a6('0x27')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x263615=md5(JSON[_0xd3a6('0x40')](_0x1f4859));if(this[_0xd3a6('0x1')]!==_0x263615){this[_0xd3a6('0x1')]=_0x263615;io['emit']('user:routing:update',_[_0xd3a6('0x41')](_0x1f4859,[_0xd3a6('0x8')]));}};module[_0xd3a6('0x42')]=Agent; \ No newline at end of file +var _0x2542=['openchannelCurrentCapacity','busy','chatWaitingInteractions','faxWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','maxcapacity','working','idle','openchannel','sms','whatsapp','length','Status','StatusTime','toNumber','format','chatStatusTime','faxStatus','whatsappCurrentCapacity','openchannelStatus','busyQueue','mailWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','stringify','emit','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','chatCapacity','chatCurrentCapacity','mailStatus','unknown','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','openchannelStatusTime','openchannelCapacity'];(function(_0x3d7293,_0x5182fd){var _0x559e78=function(_0x8338f8){while(--_0x8338f8){_0x3d7293['push'](_0x3d7293['shift']());}};_0x559e78(++_0x5182fd);}(_0x2542,0x169));var _0x2254=function(_0xc705b1,_0x22ccad){_0xc705b1=_0xc705b1-0x0;var _0x384056=_0x2542[_0xc705b1];return _0x384056;};'use strict';var _=require(_0x2254('0x0'));var md5=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var Redis=require(_0x2254('0x3'));var config=require('../../../config/environment');config[_0x2254('0x4')]=_['defaults'](config[_0x2254('0x4')],{'host':_0x2254('0x5'),'port':0x18eb});var io=require(_0x2254('0x6'))(new Redis(config[_0x2254('0x4')]));function Agent(_0x76c902){this['id']=_0x76c902['id']||0x0;this['name']=_0x76c902[_0x2254('0x7')]||'';this[_0x2254('0x8')]=_0x76c902[_0x2254('0x8')]||!![];this[_0x2254('0x9')]=_0x76c902[_0x2254('0x9')]||![];this[_0x2254('0xa')]=_0x76c902[_0x2254('0xa')]||![];this[_0x2254('0xb')]=_0x76c902[_0x2254('0xb')]||![];this[_0x2254('0xc')]=_0x76c902[_0x2254('0xc')]||![];this['smsPause']=_0x76c902[_0x2254('0xd')]||![];this[_0x2254('0xe')]=_0x76c902[_0x2254('0xe')]||![];this[_0x2254('0xf')]='unknown';this['chatStatusTime']=0x0;this[_0x2254('0x10')]=_0x76c902[_0x2254('0x10')]||0x0;this[_0x2254('0x11')]=0x0;this[_0x2254('0x12')]=_0x2254('0x13');this[_0x2254('0x14')]=0x0;this['mailCapacity']=_0x76c902[_0x2254('0x15')]||0x0;this[_0x2254('0x16')]=0x0;this['faxStatus']=_0x2254('0x13');this[_0x2254('0x17')]=0x0;this[_0x2254('0x18')]=_0x76c902[_0x2254('0x18')]||0x0;this[_0x2254('0x19')]=0x0;this[_0x2254('0x1a')]='unknown';this[_0x2254('0x1b')]=0x0;this['smsCapacity']=_0x76c902[_0x2254('0x1c')]||0x0;this[_0x2254('0x1d')]=0x0;this[_0x2254('0x1e')]=_0x2254('0x13');this[_0x2254('0x1f')]=0x0;this[_0x2254('0x20')]=_0x76c902['whatsappCapacity']||0x0;this['whatsappCurrentCapacity']=0x0;this['openchannelStatus']=_0x2254('0x13');this[_0x2254('0x21')]=0x0;this[_0x2254('0x22')]=_0x76c902[_0x2254('0x22')]||0x0;this[_0x2254('0x23')]=0x0;this[_0x2254('0x24')]=![];this['busyQueue']=undefined;this[_0x2254('0x1')]='';this[_0x2254('0x25')]={};this[_0x2254('0x26')]={};this['mailWaitingInteractions']={};this['openchannelWaitingInteractions']={};this['smsWaitingInteractions']={};this[_0x2254('0x27')]={};this[_0x2254('0x28')]();}Agent[_0x2254('0x29')]['getChannelStatus']=function(_0x5713e4){if(this[_0x5713e4+'CurrentCapacity']>0x0){if(this[_0x5713e4+'Capacity']>0x0&&this[_0x5713e4+'CurrentCapacity']>=this[_0x5713e4+'Capacity']){return _0x2254('0x2a');}else{return _0x2254('0x2b');}}else{return _0x2254('0x2c');}};Agent[_0x2254('0x29')][_0x2254('0x28')]=function(){var _0x1349c9=['mail','chat',_0x2254('0x2d'),'fax',_0x2254('0x2e'),_0x2254('0x2f')];for(var _0x31a543=0x0;_0x31a543<_0x1349c9[_0x2254('0x30')];_0x31a543+=0x1){var _0x19043b=this['getChannelStatus'](_0x1349c9[_0x31a543]);if(this[_0x1349c9[_0x31a543]+_0x2254('0x31')]!==_0x19043b){this[_0x1349c9[_0x31a543]+_0x2254('0x32')]=_[_0x2254('0x33')](moment()[_0x2254('0x34')]('x'));}this[_0x1349c9[_0x31a543]+_0x2254('0x31')]=_0x19043b;}var _0x377c41={'id':this['id'],'name':this[_0x2254('0x7')],'online':this[_0x2254('0x8')],'voicePause':this[_0x2254('0x9')],'chatPause':this[_0x2254('0xa')],'mailPause':this[_0x2254('0xb')],'smsPause':this[_0x2254('0xd')],'faxPause':this[_0x2254('0xc')],'openchannelPause':this[_0x2254('0xe')],'chatStatus':this[_0x2254('0xf')],'chatStatusTime':this[_0x2254('0x35')],'chatCapacity':this[_0x2254('0x10')],'chatCurrentCapacity':this[_0x2254('0x11')],'mailStatus':this[_0x2254('0x12')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x2254('0x15')],'mailCurrentCapacity':this[_0x2254('0x16')],'faxStatus':this[_0x2254('0x36')],'faxStatusTime':this[_0x2254('0x17')],'faxCapacity':this[_0x2254('0x18')],'faxCurrentCapacity':this[_0x2254('0x19')],'smsStatus':this[_0x2254('0x1a')],'smsStatusTime':this[_0x2254('0x1b')],'smsCapacity':this[_0x2254('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x2254('0x1e')],'whatsappStatusTime':this[_0x2254('0x1f')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this[_0x2254('0x37')],'openchannelStatus':this[_0x2254('0x38')],'openchannelStatusTime':this[_0x2254('0x21')],'openchannelCapacity':this[_0x2254('0x22')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0x2254('0x39')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0x2254('0x26')],'mailWaitingInteractions':this[_0x2254('0x3a')],'openchannelWaitingInteractions':this[_0x2254('0x3b')],'smsWaitingInteractions':this[_0x2254('0x3c')],'whatsappWaitingInteractions':this[_0x2254('0x27')]};var _0x2707f4=md5(JSON[_0x2254('0x3d')](_0x377c41));if(this['md5']!==_0x2707f4){this[_0x2254('0x1')]=_0x2707f4;io[_0x2254('0x3e')](_0x2254('0x3f'),_[_0x2254('0x40')](_0x377c41,[_0x2254('0x8')]));}};module[_0x2254('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 d2c4620..21e6f68 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 _0x4546=['../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','paused','length','chatPause','available','stringify','format','chat:queue:%s','emit','chat_queue:save','md5','ioredis'];(function(_0x48e885,_0x1b7f8a){var _0x3830a4=function(_0x27a583){while(--_0x27a583){_0x48e885['push'](_0x48e885['shift']());}};_0x3830a4(++_0x1b7f8a);}(_0x4546,0x1be));var _0x6454=function(_0x62826c,_0x4357c3){_0x62826c=_0x62826c-0x0;var _0x2d335a=_0x4546[_0x62826c];return _0x2d335a;};'use strict';var _=require('lodash');var md5=require(_0x6454('0x0'));var util=require('util');var Redis=require(_0x6454('0x1'));var config=require(_0x6454('0x2'));config['redis']=_[_0x6454('0x3')](config[_0x6454('0x4')],{'host':_0x6454('0x5'),'port':0x18eb});var io=require(_0x6454('0x6'))(new Redis(config[_0x6454('0x4')]));function ChatQueue(_0x299dc2){this['id']=_0x299dc2['id']||0x0;this[_0x6454('0x7')]=_0x299dc2['name']||'';this[_0x6454('0x8')]=_0x299dc2[_0x6454('0x8')]||0xa;this[_0x6454('0x9')]=_0x299dc2[_0x6454('0x9')]||_0x6454('0xa');this['Agents']=_0x299dc2[_0x6454('0xb')];this[_0x6454('0xc')]={};this[_0x6454('0xd')]=0x0;this[_0x6454('0x0')]='';this[_0x6454('0xe')]();this[_0x6454('0xf')]();}ChatQueue[_0x6454('0x10')]['updateRouting']=function(){var _0x40e4ae=this['mapAgentsId']['_rr'];this[_0x6454('0xc')]=_[_0x6454('0x11')](this['Agents'],'id');this[_0x6454('0xc')]['_rr']=_0x40e4ae;};ChatQueue['prototype']['updateRealtime']=function(){this[_0x6454('0x12')]=0x0;this[_0x6454('0x13')]=0x0;for(var _0x4ee856=0x0;_0x4ee856=0x0?this[_0x6454('0x16')]:0x0;var _0x381a9e={'id':this['id'],'available':this[_0x6454('0x16')],'loggedIn':this[_0x6454('0x12')],'name':this[_0x6454('0x7')],'paused':this[_0x6454('0x13')],'waiting':this['waiting']};var _0x3d9a51=md5(JSON[_0x6454('0x17')](_0x381a9e));if(this[_0x6454('0x0')]!==_0x3d9a51){this[_0x6454('0x0')]=_0x3d9a51;io['to'](util[_0x6454('0x18')](_0x6454('0x19'),_0x381a9e[_0x6454('0x7')]))[_0x6454('0x1a')](_0x6454('0x1b'),_0x381a9e);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x0d2c=['updateRouting','prototype','_rr','map','updateRealtime','length','online','chatPause','paused','loggedIn','available','stringify','format','chat:queue:%s','emit','chat_queue:save','exports','lodash','ioredis','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5'];(function(_0x6dfbaa,_0x31eede){var _0xfbe02=function(_0x4adcaf){while(--_0x4adcaf){_0x6dfbaa['push'](_0x6dfbaa['shift']());}};_0xfbe02(++_0x31eede);}(_0x0d2c,0xac));var _0xc0d2=function(_0x3846ce,_0x10c80a){_0x3846ce=_0x3846ce-0x0;var _0x117ce8=_0x0d2c[_0x3846ce];return _0x117ce8;};'use strict';var _=require(_0xc0d2('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xc0d2('0x1'));var config=require('../../../config/environment');config[_0xc0d2('0x2')]=_[_0xc0d2('0x3')](config[_0xc0d2('0x2')],{'host':_0xc0d2('0x4'),'port':0x18eb});var io=require(_0xc0d2('0x5'))(new Redis(config[_0xc0d2('0x2')]));function ChatQueue(_0x317b04){this['id']=_0x317b04['id']||0x0;this[_0xc0d2('0x6')]=_0x317b04[_0xc0d2('0x6')]||'';this[_0xc0d2('0x7')]=_0x317b04[_0xc0d2('0x7')]||0xa;this[_0xc0d2('0x8')]=_0x317b04[_0xc0d2('0x8')]||_0xc0d2('0x9');this['Agents']=_0x317b04[_0xc0d2('0xa')];this[_0xc0d2('0xb')]={};this[_0xc0d2('0xc')]=0x0;this[_0xc0d2('0xd')]='';this[_0xc0d2('0xe')]();this['updateRealtime']();}ChatQueue[_0xc0d2('0xf')][_0xc0d2('0xe')]=function(){var _0x2f433f=this[_0xc0d2('0xb')][_0xc0d2('0x10')];this[_0xc0d2('0xb')]=_[_0xc0d2('0x11')](this[_0xc0d2('0xa')],'id');this[_0xc0d2('0xb')]['_rr']=_0x2f433f;};ChatQueue[_0xc0d2('0xf')][_0xc0d2('0x12')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x10d685=0x0;_0x10d685=0x0?this[_0xc0d2('0x18')]:0x0;var _0x5f4ee1={'id':this['id'],'available':this[_0xc0d2('0x18')],'loggedIn':this['loggedIn'],'name':this[_0xc0d2('0x6')],'paused':this[_0xc0d2('0x16')],'waiting':this['waiting']};var _0x4e5cbb=md5(JSON[_0xc0d2('0x19')](_0x5f4ee1));if(this[_0xc0d2('0xd')]!==_0x4e5cbb){this[_0xc0d2('0xd')]=_0x4e5cbb;io['to'](util[_0xc0d2('0x1a')](_0xc0d2('0x1b'),_0x5f4ee1[_0xc0d2('0x6')]))[_0xc0d2('0x1c')](_0xc0d2('0x1d'),_0x5f4ee1);}};module[_0xc0d2('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 98d6679..7a0ecbb 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 _0x237d=['emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','faxPause','available','stringify','format','fax:queue:%s'];(function(_0x14cdd1,_0x52baaf){var _0x233641=function(_0x4282eb){while(--_0x4282eb){_0x14cdd1['push'](_0x14cdd1['shift']());}};_0x233641(++_0x52baaf);}(_0x237d,0x188));var _0xd237=function(_0x22b725,_0x80e5f4){_0x22b725=_0x22b725-0x0;var _0x19e57a=_0x237d[_0x22b725];return _0x19e57a;};'use strict';var _=require(_0xd237('0x0'));var md5=require(_0xd237('0x1'));var util=require('util');var Redis=require(_0xd237('0x2'));var config=require(_0xd237('0x3'));config[_0xd237('0x4')]=_[_0xd237('0x5')](config[_0xd237('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xd237('0x6'))(new Redis(config[_0xd237('0x4')]));function FaxQueue(_0x13732e){this['id']=_0x13732e['id']||0x0;this[_0xd237('0x7')]=_0x13732e['name']||'';this[_0xd237('0x8')]=_0x13732e[_0xd237('0x8')]||0xa;this[_0xd237('0x9')]=_0x13732e[_0xd237('0x9')]||_0xd237('0xa');this[_0xd237('0xb')]=_0x13732e['Agents'];this[_0xd237('0xc')]={};this[_0xd237('0xd')]=0x0;this['md5']='';this[_0xd237('0xe')]();this[_0xd237('0xf')]();}FaxQueue[_0xd237('0x10')]['updateRouting']=function(){var _0x406444=this[_0xd237('0xc')][_0xd237('0x11')];this['mapAgentsId']=_[_0xd237('0x12')](this[_0xd237('0xb')],'id');this[_0xd237('0xc')][_0xd237('0x11')]=_0x406444;};FaxQueue[_0xd237('0x10')][_0xd237('0xf')]=function(){this[_0xd237('0x13')]=0x0;this[_0xd237('0x14')]=0x0;for(var _0x2d49e0=0x0;_0x2d49e0=0x0?this[_0xd237('0x18')]:0x0;var _0x3e730b={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd237('0x13')],'name':this[_0xd237('0x7')],'paused':this[_0xd237('0x14')],'waiting':this[_0xd237('0xd')]};var _0x75ed5a=md5(JSON[_0xd237('0x19')](_0x3e730b));if(this[_0xd237('0x1')]!==_0x75ed5a){this[_0xd237('0x1')]=_0x75ed5a;io['to'](util[_0xd237('0x1a')](_0xd237('0x1b'),_0x3e730b[_0xd237('0x7')]))[_0xd237('0x1c')]('fax_queue:save',_0x3e730b);}};module[_0xd237('0x1d')]=FaxQueue; \ No newline at end of file +var _0xf263=['waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId'];(function(_0x33539a,_0xab9aa5){var _0x1a99a7=function(_0x3e95db){while(--_0x3e95db){_0x33539a['push'](_0x33539a['shift']());}};_0x1a99a7(++_0xab9aa5);}(_0xf263,0x115));var _0x3f26=function(_0x1c470d,_0x81d66b){_0x1c470d=_0x1c470d-0x0;var _0x12141b=_0xf263[_0x1c470d];return _0x12141b;};'use strict';var _=require('lodash');var md5=require(_0x3f26('0x0'));var util=require(_0x3f26('0x1'));var Redis=require(_0x3f26('0x2'));var config=require(_0x3f26('0x3'));config[_0x3f26('0x4')]=_[_0x3f26('0x5')](config[_0x3f26('0x4')],{'host':_0x3f26('0x6'),'port':0x18eb});var io=require(_0x3f26('0x7'))(new Redis(config[_0x3f26('0x4')]));function FaxQueue(_0x31e021){this['id']=_0x31e021['id']||0x0;this[_0x3f26('0x8')]=_0x31e021['name']||'';this['timeout']=_0x31e021['timeout']||0xa;this[_0x3f26('0x9')]=_0x31e021[_0x3f26('0x9')]||_0x3f26('0xa');this[_0x3f26('0xb')]=_0x31e021[_0x3f26('0xb')];this[_0x3f26('0xc')]={};this[_0x3f26('0xd')]=0x0;this[_0x3f26('0x0')]='';this['updateRouting']();this[_0x3f26('0xe')]();}FaxQueue[_0x3f26('0xf')][_0x3f26('0x10')]=function(){var _0x2ae41b=this[_0x3f26('0xc')][_0x3f26('0x11')];this[_0x3f26('0xc')]=_[_0x3f26('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x2ae41b;};FaxQueue[_0x3f26('0xf')]['updateRealtime']=function(){this[_0x3f26('0x13')]=0x0;this[_0x3f26('0x14')]=0x0;for(var _0x1382eb=0x0;_0x1382eb=0x0?this[_0x3f26('0x16')]:0x0;var _0x112a2f={'id':this['id'],'available':this[_0x3f26('0x16')],'loggedIn':this[_0x3f26('0x13')],'name':this[_0x3f26('0x8')],'paused':this['paused'],'waiting':this[_0x3f26('0xd')]};var _0x1f29dd=md5(JSON[_0x3f26('0x17')](_0x112a2f));if(this[_0x3f26('0x0')]!==_0x1f29dd){this[_0x3f26('0x0')]=_0x1f29dd;io['to'](util[_0x3f26('0x18')](_0x3f26('0x19'),_0x112a2f[_0x3f26('0x8')]))[_0x3f26('0x1a')](_0x3f26('0x1b'),_0x112a2f);}};module[_0x3f26('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 374110f..96cfd07 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 _0xb01d=['Intervals','exports','name'];(function(_0x54c181,_0x4ee31f){var _0x336c25=function(_0x399617){while(--_0x399617){_0x54c181['push'](_0x54c181['shift']());}};_0x336c25(++_0x4ee31f);}(_0xb01d,0xb3));var _0xdb01=function(_0x4f2c17,_0x4719f8){_0x4f2c17=_0x4f2c17-0x0;var _0xc52a02=_0xb01d[_0x4f2c17];return _0xc52a02;};'use strict';function Interval(_0x501ebb){this['id']=_0x501ebb['id']||0x0;this[_0xdb01('0x0')]=_0x501ebb[_0xdb01('0x0')]||'';this[_0xdb01('0x1')]=_0x501ebb['Intervals']||{};}module[_0xdb01('0x2')]=Interval; \ No newline at end of file +var _0x874e=['Intervals','exports','name'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x874e,0xd7));var _0xe874=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x874e[_0x3e6d5d];return _0x238923;};'use strict';function Interval(_0x141411){this['id']=_0x141411['id']||0x0;this[_0xe874('0x0')]=_0x141411[_0xe874('0x0')]||'';this[_0xe874('0x1')]=_0x141411[_0xe874('0x1')]||{};}module[_0xe874('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 98c3ec9..f06a0ed 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 _0x6da5=['beepall','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','Agents','length','online','mailPause','paused','available','loggedIn','stringify','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy'];(function(_0x459b01,_0x59ede4){var _0x2153aa=function(_0x5549b1){while(--_0x5549b1){_0x459b01['push'](_0x459b01['shift']());}};_0x2153aa(++_0x59ede4);}(_0x6da5,0xaf));var _0x56da=function(_0x4b8883,_0x5d6caf){_0x4b8883=_0x4b8883-0x0;var _0x289d14=_0x6da5[_0x4b8883];return _0x289d14;};'use strict';var _=require(_0x56da('0x0'));var md5=require(_0x56da('0x1'));var util=require(_0x56da('0x2'));var Redis=require(_0x56da('0x3'));var config=require(_0x56da('0x4'));config[_0x56da('0x5')]=_[_0x56da('0x6')](config[_0x56da('0x5')],{'host':_0x56da('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x56da('0x5')]));function MailQueue(_0x4e9ace){this['id']=_0x4e9ace['id']||0x0;this[_0x56da('0x8')]=_0x4e9ace[_0x56da('0x8')]||'';this[_0x56da('0x9')]=_0x4e9ace[_0x56da('0x9')]||0xa;this[_0x56da('0xa')]=_0x4e9ace[_0x56da('0xa')]||_0x56da('0xb');this['Agents']=_0x4e9ace['Agents'];this['mapAgentsId']={};this[_0x56da('0xc')]=0x0;this[_0x56da('0x1')]='';this[_0x56da('0xd')]();this[_0x56da('0xe')]();}MailQueue[_0x56da('0xf')][_0x56da('0xd')]=function(){var _0x1cd501=this[_0x56da('0x10')][_0x56da('0x11')];this[_0x56da('0x10')]=_[_0x56da('0x12')](this[_0x56da('0x13')],'id');this['mapAgentsId'][_0x56da('0x11')]=_0x1cd501;};MailQueue[_0x56da('0xf')][_0x56da('0xe')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x4c87b7=0x0;_0x4c87b7=0x0?this[_0x56da('0x18')]:0x0;var _0x33a3b4={'id':this['id'],'available':this[_0x56da('0x18')],'loggedIn':this[_0x56da('0x19')],'name':this[_0x56da('0x8')],'paused':this[_0x56da('0x17')],'waiting':this[_0x56da('0xc')]};var _0x573cac=md5(JSON[_0x56da('0x1a')](_0x33a3b4));if(this['md5']!==_0x573cac){this[_0x56da('0x1')]=_0x573cac;io['to'](util['format'](_0x56da('0x1b'),_0x33a3b4[_0x56da('0x8')]))[_0x56da('0x1c')](_0x56da('0x1d'),_0x33a3b4);}};module[_0x56da('0x1e')]=MailQueue; \ No newline at end of file +var _0x7cb0=['loggedIn','length','online','mailPause','paused','available','waiting','stringify','format','emit','mail_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr'];(function(_0x5c9bd4,_0x5c8aed){var _0x2e97f2=function(_0x5c2ed2){while(--_0x5c2ed2){_0x5c9bd4['push'](_0x5c9bd4['shift']());}};_0x2e97f2(++_0x5c8aed);}(_0x7cb0,0x1bf));var _0x07cb=function(_0x57d843,_0x2a95e0){_0x57d843=_0x57d843-0x0;var _0x42ba2d=_0x7cb0[_0x57d843];return _0x42ba2d;};'use strict';var _=require(_0x07cb('0x0'));var md5=require(_0x07cb('0x1'));var util=require('util');var Redis=require(_0x07cb('0x2'));var config=require(_0x07cb('0x3'));config['redis']=_['defaults'](config[_0x07cb('0x4')],{'host':_0x07cb('0x5'),'port':0x18eb});var io=require(_0x07cb('0x6'))(new Redis(config[_0x07cb('0x4')]));function MailQueue(_0x440e30){this['id']=_0x440e30['id']||0x0;this[_0x07cb('0x7')]=_0x440e30[_0x07cb('0x7')]||'';this[_0x07cb('0x8')]=_0x440e30[_0x07cb('0x8')]||0xa;this[_0x07cb('0x9')]=_0x440e30[_0x07cb('0x9')]||_0x07cb('0xa');this[_0x07cb('0xb')]=_0x440e30[_0x07cb('0xb')];this[_0x07cb('0xc')]={};this['waiting']=0x0;this[_0x07cb('0x1')]='';this[_0x07cb('0xd')]();this[_0x07cb('0xe')]();}MailQueue[_0x07cb('0xf')][_0x07cb('0xd')]=function(){var _0x4bafac=this[_0x07cb('0xc')][_0x07cb('0x10')];this[_0x07cb('0xc')]=_['map'](this['Agents'],'id');this[_0x07cb('0xc')][_0x07cb('0x10')]=_0x4bafac;};MailQueue[_0x07cb('0xf')]['updateRealtime']=function(){this[_0x07cb('0x11')]=0x0;this['paused']=0x0;for(var _0xa4334=0x0;_0xa4334=0x0?this[_0x07cb('0x16')]:0x0;var _0x3df235={'id':this['id'],'available':this[_0x07cb('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x07cb('0x15')],'waiting':this[_0x07cb('0x17')]};var _0x40a0a7=md5(JSON[_0x07cb('0x18')](_0x3df235));if(this[_0x07cb('0x1')]!==_0x40a0a7){this[_0x07cb('0x1')]=_0x40a0a7;io['to'](util[_0x07cb('0x19')]('mail:queue:%s',_0x3df235[_0x07cb('0x7')]))[_0x07cb('0x1a')](_0x07cb('0x1b'),_0x3df235);}};module[_0x07cb('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b0edd73..ff5ae05 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0xc4aa[_0x51020b];return _0x371e47;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file +var _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x326f,0xd1));var _0xf326=function(_0x4b2541,_0x50089e){_0x4b2541=_0x4b2541-0x0;var _0xca2ce7=_0x326f[_0x4b2541];return _0xca2ce7;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index d532105..033d194 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 _0x3b75=['updateRouting','updateRealtime','prototype','_rr','map','mapAgentsId','loggedIn','paused','length','online','available','stringify','format','sms:queue:%s','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','name','strategy','beepall','Agents','waiting'];(function(_0x5d269b,_0x3c9f75){var _0x59a8f3=function(_0x23e329){while(--_0x23e329){_0x5d269b['push'](_0x5d269b['shift']());}};_0x59a8f3(++_0x3c9f75);}(_0x3b75,0x144));var _0x53b7=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x3b75[_0x249e96];return _0x17444c;};'use strict';var _=require(_0x53b7('0x0'));var md5=require(_0x53b7('0x1'));var util=require(_0x53b7('0x2'));var Redis=require(_0x53b7('0x3'));var config=require(_0x53b7('0x4'));config[_0x53b7('0x5')]=_[_0x53b7('0x6')](config[_0x53b7('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x53b7('0x5')]));function SmsQueue(_0x2f8b3d){this['id']=_0x2f8b3d['id']||0x0;this[_0x53b7('0x7')]=_0x2f8b3d[_0x53b7('0x7')]||'';this['timeout']=_0x2f8b3d['timeout']||0xa;this[_0x53b7('0x8')]=_0x2f8b3d[_0x53b7('0x8')]||_0x53b7('0x9');this[_0x53b7('0xa')]=_0x2f8b3d[_0x53b7('0xa')];this['mapAgentsId']={};this[_0x53b7('0xb')]=0x0;this[_0x53b7('0x1')]='';this[_0x53b7('0xc')]();this[_0x53b7('0xd')]();}SmsQueue[_0x53b7('0xe')][_0x53b7('0xc')]=function(){var _0x4d8a1f=this['mapAgentsId'][_0x53b7('0xf')];this['mapAgentsId']=_[_0x53b7('0x10')](this['Agents'],'id');this[_0x53b7('0x11')][_0x53b7('0xf')]=_0x4d8a1f;};SmsQueue[_0x53b7('0xe')]['updateRealtime']=function(){this[_0x53b7('0x12')]=0x0;this[_0x53b7('0x13')]=0x0;for(var _0x4a64f4=0x0;_0x4a64f4=0x0?this[_0x53b7('0x16')]:0x0;var _0x47da7c={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x53b7('0x7')],'paused':this[_0x53b7('0x13')],'waiting':this[_0x53b7('0xb')]};var _0x113cb7=md5(JSON[_0x53b7('0x17')](_0x47da7c));if(this[_0x53b7('0x1')]!==_0x113cb7){this[_0x53b7('0x1')]=_0x113cb7;io['to'](util[_0x53b7('0x18')](_0x53b7('0x19'),_0x47da7c[_0x53b7('0x7')]))['emit'](_0x53b7('0x1a'),_0x47da7c);}};module[_0x53b7('0x1b')]=SmsQueue; \ No newline at end of file +var _0xcabc=['map','prototype','paused','length','online','smsPause','available','loggedIn','format','sms_queue:save','exports','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr'];(function(_0x570c60,_0x1f9ab1){var _0x5b93d2=function(_0x495551){while(--_0x495551){_0x570c60['push'](_0x570c60['shift']());}};_0x5b93d2(++_0x1f9ab1);}(_0xcabc,0x16a));var _0xccab=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xcabc[_0xfae23b];return _0x200640;};'use strict';var _=require('lodash');var md5=require(_0xccab('0x0'));var util=require(_0xccab('0x1'));var Redis=require(_0xccab('0x2'));var config=require(_0xccab('0x3'));config[_0xccab('0x4')]=_['defaults'](config[_0xccab('0x4')],{'host':_0xccab('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xccab('0x4')]));function SmsQueue(_0x316f83){this['id']=_0x316f83['id']||0x0;this[_0xccab('0x6')]=_0x316f83['name']||'';this[_0xccab('0x7')]=_0x316f83[_0xccab('0x7')]||0xa;this[_0xccab('0x8')]=_0x316f83['strategy']||_0xccab('0x9');this[_0xccab('0xa')]=_0x316f83['Agents'];this[_0xccab('0xb')]={};this[_0xccab('0xc')]=0x0;this[_0xccab('0x0')]='';this[_0xccab('0xd')]();this[_0xccab('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x17b729=this[_0xccab('0xb')][_0xccab('0xf')];this[_0xccab('0xb')]=_[_0xccab('0x10')](this[_0xccab('0xa')],'id');this[_0xccab('0xb')]['_rr']=_0x17b729;};SmsQueue[_0xccab('0x11')][_0xccab('0xe')]=function(){this['loggedIn']=0x0;this[_0xccab('0x12')]=0x0;for(var _0x4f0643=0x0;_0x4f0643=0x0?this['available']:0x0;var _0x4ba1c2={'id':this['id'],'available':this[_0xccab('0x16')],'loggedIn':this['loggedIn'],'name':this[_0xccab('0x6')],'paused':this[_0xccab('0x12')],'waiting':this[_0xccab('0xc')]};var _0x4ab126=md5(JSON['stringify'](_0x4ba1c2));if(this[_0xccab('0x0')]!==_0x4ab126){this[_0xccab('0x0')]=_0x4ab126;io['to'](util[_0xccab('0x18')]('sms:queue:%s',_0x4ba1c2[_0xccab('0x6')]))['emit'](_0xccab('0x19'),_0x4ba1c2);}};module[_0xccab('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 4daa98e..37844e4 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 _0x1c48=['emit','whatsapp_queue:save','exports','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','md5','whatsapp:queue:%s'];(function(_0x52666e,_0x5b3776){var _0x515330=function(_0x29cd4f){while(--_0x29cd4f){_0x52666e['push'](_0x52666e['shift']());}};_0x515330(++_0x5b3776);}(_0x1c48,0x111));var _0x81c4=function(_0x56bd3e,_0x26f679){_0x56bd3e=_0x56bd3e-0x0;var _0x1a5780=_0x1c48[_0x56bd3e];return _0x1a5780;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x81c4('0x0'));var Redis=require('ioredis');var config=require(_0x81c4('0x1'));config[_0x81c4('0x2')]=_[_0x81c4('0x3')](config[_0x81c4('0x2')],{'host':_0x81c4('0x4'),'port':0x18eb});var io=require(_0x81c4('0x5'))(new Redis(config[_0x81c4('0x2')]));function WhatsappQueue(_0x1ef98c){this['id']=_0x1ef98c['id']||0x0;this['name']=_0x1ef98c[_0x81c4('0x6')]||'';this[_0x81c4('0x7')]=_0x1ef98c[_0x81c4('0x7')]||0xa;this[_0x81c4('0x8')]=_0x1ef98c['strategy']||_0x81c4('0x9');this[_0x81c4('0xa')]=_0x1ef98c[_0x81c4('0xa')];this[_0x81c4('0xb')]={};this[_0x81c4('0xc')]=0x0;this['md5']='';this[_0x81c4('0xd')]();this[_0x81c4('0xe')]();}WhatsappQueue[_0x81c4('0xf')][_0x81c4('0xd')]=function(){var _0x26b282=this['mapAgentsId'][_0x81c4('0x10')];this[_0x81c4('0xb')]=_['map'](this[_0x81c4('0xa')],'id');this[_0x81c4('0xb')]['_rr']=_0x26b282;};WhatsappQueue[_0x81c4('0xf')]['updateRealtime']=function(){this[_0x81c4('0x11')]=0x0;this[_0x81c4('0x12')]=0x0;for(var _0x2a484f=0x0;_0x2a484f=0x0?this[_0x81c4('0x15')]:0x0;var _0x107a57={'id':this['id'],'available':this[_0x81c4('0x15')],'loggedIn':this[_0x81c4('0x11')],'name':this['name'],'paused':this[_0x81c4('0x12')],'waiting':this[_0x81c4('0xc')]};var _0x431687=md5(JSON['stringify'](_0x107a57));if(this[_0x81c4('0x16')]!==_0x431687){this[_0x81c4('0x16')]=_0x431687;io['to'](util['format'](_0x81c4('0x17'),_0x107a57[_0x81c4('0x6')]))[_0x81c4('0x18')](_0x81c4('0x19'),_0x107a57);}};module[_0x81c4('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x6781=['loggedIn','paused','online','available','stringify','md5','emit','whatsapp_queue:save','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','updateRealtime'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0x6781,0xa4));var _0x1678=function(_0x230f23,_0x532c40){_0x230f23=_0x230f23-0x0;var _0x177694=_0x6781[_0x230f23];return _0x177694;};'use strict';var _=require(_0x1678('0x0'));var md5=require('md5');var util=require(_0x1678('0x1'));var Redis=require(_0x1678('0x2'));var config=require(_0x1678('0x3'));config[_0x1678('0x4')]=_[_0x1678('0x5')](config[_0x1678('0x4')],{'host':_0x1678('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1678('0x4')]));function WhatsappQueue(_0x5c033c){this['id']=_0x5c033c['id']||0x0;this[_0x1678('0x7')]=_0x5c033c[_0x1678('0x7')]||'';this[_0x1678('0x8')]=_0x5c033c['timeout']||0xa;this[_0x1678('0x9')]=_0x5c033c['strategy']||'beepall';this[_0x1678('0xa')]=_0x5c033c[_0x1678('0xa')];this['mapAgentsId']={};this[_0x1678('0xb')]=0x0;this['md5']='';this[_0x1678('0xc')]();this['updateRealtime']();}WhatsappQueue[_0x1678('0xd')][_0x1678('0xc')]=function(){var _0x9414b9=this[_0x1678('0xe')][_0x1678('0xf')];this[_0x1678('0xe')]=_[_0x1678('0x10')](this[_0x1678('0xa')],'id');this[_0x1678('0xe')][_0x1678('0xf')]=_0x9414b9;};WhatsappQueue['prototype'][_0x1678('0x11')]=function(){this[_0x1678('0x12')]=0x0;this[_0x1678('0x13')]=0x0;for(var _0x3bcf15=0x0;_0x3bcf15=0x0?this[_0x1678('0x15')]:0x0;var _0x464f21={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1678('0x12')],'name':this[_0x1678('0x7')],'paused':this[_0x1678('0x13')],'waiting':this['waiting']};var _0x1949b3=md5(JSON[_0x1678('0x16')](_0x464f21));if(this[_0x1678('0x17')]!==_0x1949b3){this[_0x1678('0x17')]=_0x1949b3;io['to'](util['format']('whatsapp:queue:%s',_0x464f21['name']))[_0x1678('0x18')](_0x1678('0x19'),_0x464f21);}};module['exports']=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index fc1de82..8ccf3fb 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0xa9e0[_0xbb091];return _0x467a04;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _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(_0x25bea7,_0x49ab45){_0x25bea7=_0x25bea7-0x0;var _0x175952=_0xa9e0[_0x25bea7];return _0x175952;};'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 3cb0b93..54bc15a 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 _0x2782=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','addTagsToChatInteraction','../client'];(function(_0x481d81,_0x3a0e30){var _0x3035ab=function(_0x8112e2){while(--_0x8112e2){_0x481d81['push'](_0x481d81['shift']());}};_0x3035ab(++_0x3a0e30);}(_0x2782,0xc3));var _0x2278=function(_0x209ec9,_0x30378c){_0x209ec9=_0x209ec9-0x0;var _0x129b1b=_0x2782[_0x209ec9];return _0x129b1b;};'use strict';var client=require(_0x2278('0x0'));exports[_0x2278('0x1')]=function(_0x18353f,_0xfc4900){return client[_0x2278('0x2')](_0x2278('0x3'),{'body':_0xfc4900,'options':{'where':{'id':_0x18353f}},'log':_0x2278('0x4')});};exports[_0x2278('0x5')]=function(_0x457aa9,_0x5b13aa){return client[_0x2278('0x2')]('AddTagsToChatInteraction',{'body':_0x5b13aa,'options':{'where':{'id':_0x457aa9}},'log':_0x2278('0x6')});}; \ No newline at end of file +var _0xd965=['Request','UpdateChatInteraction','updateChatInteraction','addTags','../client','update'];(function(_0x21ad2e,_0x554906){var _0x443b40=function(_0x2668c4){while(--_0x2668c4){_0x21ad2e['push'](_0x21ad2e['shift']());}};_0x443b40(++_0x554906);}(_0xd965,0xca));var _0x5d96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd965[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x5d96('0x0'));exports[_0x5d96('0x1')]=function(_0x55789d,_0x16ccd7){return client[_0x5d96('0x2')](_0x5d96('0x3'),{'body':_0x16ccd7,'options':{'where':{'id':_0x55789d}},'log':_0x5d96('0x4')});};exports[_0x5d96('0x5')]=function(_0x5b26dd,_0x2fec03){return client[_0x5d96('0x2')]('AddTagsToChatInteraction',{'body':_0x2fec03,'options':{'where':{'id':_0x5b26dd}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index b53c294..a688648 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 _0x435f=['CreateChatMessage','../client','create'];(function(_0x2ccd45,_0x14363c){var _0x463dc4=function(_0x43c258){while(--_0x43c258){_0x2ccd45['push'](_0x2ccd45['shift']());}};_0x463dc4(++_0x14363c);}(_0x435f,0x15a));var _0xf435=function(_0x59a5b4,_0x17d273){_0x59a5b4=_0x59a5b4-0x0;var _0x46243d=_0x435f[_0x59a5b4];return _0x46243d;};'use strict';var client=require(_0xf435('0x0'));exports[_0xf435('0x1')]=function(_0x410e36){return client['Request'](_0xf435('0x2'),{'body':_0x410e36,'log':'createChatMessage'});}; \ No newline at end of file +var _0x2c15=['CreateChatMessage','createChatMessage','../client','create','Request'];(function(_0x381733,_0x4d14bd){var _0x2fb114=function(_0x5741f8){while(--_0x5741f8){_0x381733['push'](_0x381733['shift']());}};_0x2fb114(++_0x4d14bd);}(_0x2c15,0x133));var _0x52c1=function(_0x79aa4f,_0x34e095){_0x79aa4f=_0x79aa4f-0x0;var _0x335ffe=_0x2c15[_0x79aa4f];return _0x335ffe;};'use strict';var client=require(_0x52c1('0x0'));exports[_0x52c1('0x1')]=function(_0x4f76e7){return client[_0x52c1('0x2')](_0x52c1('0x3'),{'body':_0x4f76e7,'log':_0x52c1('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 42ec7a6..3b526ad 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 _0xe4b8=['getChatQueues','Request','GetChatQueue','name','timeout','strategy','online','chatPause','../client'];(function(_0xa375cd,_0x3c14ca){var _0x1217cd=function(_0xbb44be){while(--_0xbb44be){_0xa375cd['push'](_0xa375cd['shift']());}};_0x1217cd(++_0x3c14ca);}(_0xe4b8,0x179));var _0x8e4b=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xe4b8[_0x2be8c2];return _0x97f531;};'use strict';var client=require(_0x8e4b('0x0'));exports[_0x8e4b('0x1')]=function(){return function(){return client[_0x8e4b('0x2')](_0x8e4b('0x3'),{'options':{'raw':![],'attributes':['id',_0x8e4b('0x4'),_0x8e4b('0x5'),_0x8e4b('0x6')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x8e4b('0x4'),_0x8e4b('0x7'),_0x8e4b('0x8')]}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x7cab=['chatPause','../client','getChatQueues','Request','name','timeout','strategy','Agents'];(function(_0x1c3e2c,_0x1b4efa){var _0x59f7ca=function(_0x1414b6){while(--_0x1414b6){_0x1c3e2c['push'](_0x1c3e2c['shift']());}};_0x59f7ca(++_0x1b4efa);}(_0x7cab,0x91));var _0xb7ca=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0x7cab[_0x48e1ec];return _0x3b33eb;};'use strict';var client=require(_0xb7ca('0x0'));exports[_0xb7ca('0x1')]=function(){return function(){return client[_0xb7ca('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xb7ca('0x3'),_0xb7ca('0x4'),_0xb7ca('0x5')],'include':[{'model':'User','as':_0xb7ca('0x6'),'attributes':['id','name','online',_0xb7ca('0x7')]}]},'log':_0xb7ca('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 29fcf2c..83f82a8 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 _0x57d4=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x333806,_0x22743d){var _0x1063a4=function(_0x3481f7){while(--_0x3481f7){_0x333806['push'](_0x333806['shift']());}};_0x1063a4(++_0x22743d);}(_0x57d4,0x78));var _0x457d=function(_0x4ed10d,_0x20ef73){_0x4ed10d=_0x4ed10d-0x0;var _0x3c7f63=_0x57d4[_0x4ed10d];return _0x3c7f63;};'use strict';var client=require(_0x457d('0x0'));exports[_0x457d('0x1')]=function(_0x47a573){return client[_0x457d('0x2')](_0x457d('0x3'),{'body':_0x47a573,'log':_0x457d('0x3')});};exports[_0x457d('0x4')]=function(_0x1219e1,_0x3c89b2){return client[_0x457d('0x2')](_0x457d('0x5'),{'body':_0x3c89b2,'options':{'where':{'uniqueid':_0x1219e1},'order':[['id',_0x457d('0x6')]],'limit':0x1},'log':_0x457d('0x5')});}; \ No newline at end of file +var _0xf4dd=['../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x3f20c3,_0x38729e){var _0x2e5b1e=function(_0x78359a){while(--_0x78359a){_0x3f20c3['push'](_0x3f20c3['shift']());}};_0x2e5b1e(++_0x38729e);}(_0xf4dd,0xb4));var _0xdf4d=function(_0x1b1834,_0x165b05){_0x1b1834=_0x1b1834-0x0;var _0x5352ad=_0xf4dd[_0x1b1834];return _0x5352ad;};'use strict';var client=require(_0xdf4d('0x0'));exports[_0xdf4d('0x1')]=function(_0x160b41){return client[_0xdf4d('0x2')](_0xdf4d('0x3'),{'body':_0x160b41,'log':_0xdf4d('0x3')});};exports[_0xdf4d('0x4')]=function(_0x47d568,_0x1974da){return client['Request'](_0xdf4d('0x5'),{'body':_0x1974da,'options':{'where':{'uniqueid':_0x47d568},'order':[['id','DESC']],'limit':0x1},'log':_0xdf4d('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 17b4393..dbc2536 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x32b993,_0x1c5989){var _0x482780=function(_0x404179){while(--_0x404179){_0x32b993['push'](_0x32b993['shift']());}};_0x482780(++_0x1c5989);}(_0x7a54,0x106));var _0x47a5=function(_0x2fc097,_0x4edd6d){_0x2fc097=_0x2fc097-0x0;var _0x22d5d=_0x7a54[_0x2fc097];return _0x22d5d;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x211bc3,_0x5860c8){var _0x34c9a2=function(_0x4bfa37){while(--_0x4bfa37){_0x211bc3['push'](_0x211bc3['shift']());}};_0x34c9a2(++_0x5860c8);}(_0x7a54,0x106));var _0x47a5=function(_0x597929,_0x326ae7){_0x597929=_0x597929-0x0;var _0x489806=_0x7a54[_0x597929];return _0x489806;};'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 3cab2d2..eda997a 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 _0xddcd=['../client','create','Request','createFaxMessage'];(function(_0x129a63,_0x47489e){var _0x42751f=function(_0x4de638){while(--_0x4de638){_0x129a63['push'](_0x129a63['shift']());}};_0x42751f(++_0x47489e);}(_0xddcd,0xe4));var _0xdddc=function(_0x8a0201,_0x43c9a3){_0x8a0201=_0x8a0201-0x0;var _0x567440=_0xddcd[_0x8a0201];return _0x567440;};'use strict';var client=require(_0xdddc('0x0'));exports[_0xdddc('0x1')]=function(_0x28387f){return client[_0xdddc('0x2')]('CreateFaxMessage',{'body':_0x28387f,'log':_0xdddc('0x3')});}; \ No newline at end of file +var _0x7b40=['Request','CreateFaxMessage','createFaxMessage','create'];(function(_0x403750,_0x7755fd){var _0x5a5c5d=function(_0x52f608){while(--_0x52f608){_0x403750['push'](_0x403750['shift']());}};_0x5a5c5d(++_0x7755fd);}(_0x7b40,0x197));var _0x07b4=function(_0x425ce1,_0x1cbcf6){_0x425ce1=_0x425ce1-0x0;var _0x567c82=_0x7b40[_0x425ce1];return _0x567c82;};'use strict';var client=require('../client');exports[_0x07b4('0x0')]=function(_0x38969d){return client[_0x07b4('0x1')](_0x07b4('0x2'),{'body':_0x38969d,'log':_0x07b4('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index 48d0a38..84187f4 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 _0x3da0=['GetFaxQueue','timeout','Agents','name','online','../client','Request'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x3da0,0xb4));var _0x03da=function(_0x564e9f,_0x225a15){_0x564e9f=_0x564e9f-0x0;var _0x3a9f3e=_0x3da0[_0x564e9f];return _0x3a9f3e;};'use strict';var client=require(_0x03da('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0x03da('0x1')](_0x03da('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x03da('0x3'),'strategy'],'include':[{'model':'User','as':_0x03da('0x4'),'attributes':['id',_0x03da('0x5'),_0x03da('0x6'),'faxPause']}]},'log':'getFaxQueues'});};}; \ No newline at end of file +var _0x0f3a=['name','User','Agents','online','getFaxQueues','../client','Request'];(function(_0x2b993a,_0x25f37e){var _0x25ec8=function(_0x10c359){while(--_0x10c359){_0x2b993a['push'](_0x2b993a['shift']());}};_0x25ec8(++_0x25f37e);}(_0x0f3a,0x75));var _0xa0f3=function(_0xbaaaaa,_0x233ebf){_0xbaaaaa=_0xbaaaaa-0x0;var _0x6b771d=_0x0f3a[_0xbaaaaa];return _0x6b771d;};'use strict';var client=require(_0xa0f3('0x0'));exports['getFaxQueues']=function(){return function(){return client[_0xa0f3('0x1')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xa0f3('0x2'),'timeout','strategy'],'include':[{'model':_0xa0f3('0x3'),'as':_0xa0f3('0x4'),'attributes':['id','name',_0xa0f3('0x5'),'faxPause']}]},'log':_0xa0f3('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 653d065..b88fd18 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 _0x049d=['Request','CreateFaxQueueReport','DESC','create'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0x049d,0xc3));var _0xd049=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x049d[_0x20a584];return _0x4b41a8;};'use strict';var client=require('../client');exports[_0xd049('0x0')]=function(_0x4cdae8){return client[_0xd049('0x1')](_0xd049('0x2'),{'body':_0x4cdae8,'log':_0xd049('0x2')});};exports['update']=function(_0x329165,_0x44fa9c){return client['Request']('UpdateFaxQueueReport',{'body':_0x44fa9c,'options':{'where':{'uniqueid':_0x329165},'order':[['id',_0xd049('0x3')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x6951=['create','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client'];(function(_0x4e8b4a,_0x246326){var _0x555a37=function(_0x2cb124){while(--_0x2cb124){_0x4e8b4a['push'](_0x4e8b4a['shift']());}};_0x555a37(++_0x246326);}(_0x6951,0x133));var _0x1695=function(_0x594ba1,_0xa7b683){_0x594ba1=_0x594ba1-0x0;var _0x46ee83=_0x6951[_0x594ba1];return _0x46ee83;};'use strict';var client=require(_0x1695('0x0'));exports[_0x1695('0x1')]=function(_0x42af5e){return client[_0x1695('0x2')](_0x1695('0x3'),{'body':_0x42af5e,'log':_0x1695('0x3')});};exports[_0x1695('0x4')]=function(_0x356c6d,_0x1fb8d5){return client[_0x1695('0x2')](_0x1695('0x5'),{'body':_0x1fb8d5,'options':{'where':{'uniqueid':_0x356c6d},'order':[['id',_0x1695('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 7a3a0d1..c4f3462 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 _0x637b=['Request','GetInterval','name','Intervals','interval','getIntervals'];(function(_0x48ab5e,_0x4f703c){var _0x578b0b=function(_0x3fdec7){while(--_0x3fdec7){_0x48ab5e['push'](_0x48ab5e['shift']());}};_0x578b0b(++_0x4f703c);}(_0x637b,0xad));var _0xb637=function(_0x296689,_0x48d426){_0x296689=_0x296689-0x0;var _0x387e28=_0x637b[_0x296689];return _0x387e28;};'use strict';var client=require('../client');exports[_0xb637('0x0')]=function(){return function(){return client[_0xb637('0x1')](_0xb637('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb637('0x3')],'include':[{'model':'Interval','as':_0xb637('0x4'),'attributes':['id','name',_0xb637('0x5')]}]},'log':_0xb637('0x0')});};}; \ No newline at end of file +var _0xb8ca=['name','../client','getIntervals','Request','Interval','Intervals'];(function(_0x32a69b,_0x440e84){var _0x464b04=function(_0x82195b){while(--_0x82195b){_0x32a69b['push'](_0x32a69b['shift']());}};_0x464b04(++_0x440e84);}(_0xb8ca,0x9d));var _0xab8c=function(_0x259106,_0x2f7af3){_0x259106=_0x259106-0x0;var _0x34f733=_0xb8ca[_0x259106];return _0x34f733;};'use strict';var client=require(_0xab8c('0x0'));exports[_0xab8c('0x1')]=function(){return function(){return client[_0xab8c('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xab8c('0x3'),'as':_0xab8c('0x4'),'attributes':['id',_0xab8c('0x5'),'interval']}]},'log':_0xab8c('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index 01c8e9e..0d29f48 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 _0x7096=['AddTagsToMailInteraction','addTagsToChatInteraction','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x487702,_0x49f5d4){var _0x5e7150=function(_0x2b2b29){while(--_0x2b2b29){_0x487702['push'](_0x487702['shift']());}};_0x5e7150(++_0x49f5d4);}(_0x7096,0x10c));var _0x6709=function(_0xbb091,_0x3fe7ee){_0xbb091=_0xbb091-0x0;var _0x467a04=_0x7096[_0xbb091];return _0x467a04;};'use strict';var client=require('../client');exports[_0x6709('0x0')]=function(_0x5035b7,_0x253760){return client['Request'](_0x6709('0x1'),{'body':_0x253760,'options':{'where':{'id':_0x5035b7}},'log':_0x6709('0x2')});};exports[_0x6709('0x3')]=function(_0xccdcb5,_0x3cd087){return client[_0x6709('0x4')](_0x6709('0x5'),{'body':_0x3cd087,'options':{'where':{'id':_0xccdcb5}},'log':_0x6709('0x6')});}; \ No newline at end of file +var _0xf4f4=['addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','Request','UpdateMailInteraction','updateMailInteraction'];(function(_0x27f944,_0x528f68){var _0x26e19a=function(_0x42b2ab){while(--_0x42b2ab){_0x27f944['push'](_0x27f944['shift']());}};_0x26e19a(++_0x528f68);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x33a8f3,_0x362516){_0x33a8f3=_0x33a8f3-0x0;var _0x547760=_0xf4f4[_0x33a8f3];return _0x547760;};'use strict';var client=require(_0x4f4f('0x0'));exports[_0x4f4f('0x1')]=function(_0x533895,_0x16a496){return client[_0x4f4f('0x2')](_0x4f4f('0x3'),{'body':_0x16a496,'options':{'where':{'id':_0x533895}},'log':_0x4f4f('0x4')});};exports[_0x4f4f('0x5')]=function(_0x510b24,_0x5a752b){return client['Request'](_0x4f4f('0x6'),{'body':_0x5a752b,'options':{'where':{'id':_0x510b24}},'log':_0x4f4f('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index a322726..85dbc96 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 _0xe670=['CreateMailMessage','../client','create'];(function(_0x3f3f06,_0x581e5b){var _0x140feb=function(_0x4cc383){while(--_0x4cc383){_0x3f3f06['push'](_0x3f3f06['shift']());}};_0x140feb(++_0x581e5b);}(_0xe670,0x193));var _0x0e67=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0xe670[_0x17882c];return _0x355a59;};'use strict';var client=require(_0x0e67('0x0'));exports[_0x0e67('0x1')]=function(_0x3a237d){return client['Request'](_0x0e67('0x2'),{'body':_0x3a237d,'log':'createMailMessage'});}; \ No newline at end of file +var _0xe12b=['Request','createMailMessage','../client','create'];(function(_0x3759b7,_0x5b6ae9){var _0x5a4fae=function(_0x45af0a){while(--_0x45af0a){_0x3759b7['push'](_0x3759b7['shift']());}};_0x5a4fae(++_0x5b6ae9);}(_0xe12b,0xd6));var _0xbe12=function(_0x168e02,_0x4ce6d3){_0x168e02=_0x168e02-0x0;var _0x137d9f=_0xe12b[_0x168e02];return _0x137d9f;};'use strict';var client=require(_0xbe12('0x0'));exports[_0xbe12('0x1')]=function(_0x4d133d){return client[_0xbe12('0x2')]('CreateMailMessage',{'body':_0x4d133d,'log':_0xbe12('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 4346073..50ebff3 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 _0xbb20=['User','Agents','online','mailPause','getMailQueues','GetMailQueue','name'];(function(_0x51a725,_0x163041){var _0x2167a8=function(_0x4a05ea){while(--_0x4a05ea){_0x51a725['push'](_0x51a725['shift']());}};_0x2167a8(++_0x163041);}(_0xbb20,0x17e));var _0x0bb2=function(_0x34f964,_0xbd4421){_0x34f964=_0x34f964-0x0;var _0x45a451=_0xbb20[_0x34f964];return _0x45a451;};'use strict';var client=require('../client');exports[_0x0bb2('0x0')]=function(){return function(){return client['Request'](_0x0bb2('0x1'),{'options':{'raw':![],'attributes':['id',_0x0bb2('0x2'),'timeout','strategy'],'include':[{'model':_0x0bb2('0x3'),'as':_0x0bb2('0x4'),'attributes':['id',_0x0bb2('0x2'),_0x0bb2('0x5'),_0x0bb2('0x6')]}]},'log':_0x0bb2('0x0')});};}; \ No newline at end of file +var _0xf03a=['getMailQueues','Request','GetMailQueue','name','strategy','User','online','mailPause'];(function(_0x39f375,_0x3aa8ec){var _0x463f93=function(_0x290215){while(--_0x290215){_0x39f375['push'](_0x39f375['shift']());}};_0x463f93(++_0x3aa8ec);}(_0xf03a,0x1a0));var _0xaf03=function(_0x5691bb,_0x252708){_0x5691bb=_0x5691bb-0x0;var _0x4a063d=_0xf03a[_0x5691bb];return _0x4a063d;};'use strict';var client=require('../client');exports[_0xaf03('0x0')]=function(){return function(){return client[_0xaf03('0x1')](_0xaf03('0x2'),{'options':{'raw':![],'attributes':['id',_0xaf03('0x3'),'timeout',_0xaf03('0x4')],'include':[{'model':_0xaf03('0x5'),'as':'Agents','attributes':['id',_0xaf03('0x3'),_0xaf03('0x6'),_0xaf03('0x7')]}]},'log':_0xaf03('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 7de8d08..fc91821 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 _0xfb57=['create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x1fe40d,_0x140a14){var _0xb67fea=function(_0x39d0fc){while(--_0x39d0fc){_0x1fe40d['push'](_0x1fe40d['shift']());}};_0xb67fea(++_0x140a14);}(_0xfb57,0x96));var _0x7fb5=function(_0x34d533,_0x161449){_0x34d533=_0x34d533-0x0;var _0x4731f5=_0xfb57[_0x34d533];return _0x4731f5;};'use strict';var client=require('../client');exports[_0x7fb5('0x0')]=function(_0x4d20f9){return client[_0x7fb5('0x1')](_0x7fb5('0x2'),{'body':_0x4d20f9,'log':_0x7fb5('0x2')});};exports[_0x7fb5('0x3')]=function(_0x55b8fa,_0x5d28a7){return client[_0x7fb5('0x1')](_0x7fb5('0x4'),{'body':_0x5d28a7,'options':{'where':{'uniqueid':_0x55b8fa},'order':[['id','DESC']],'limit':0x1},'log':_0x7fb5('0x4')});}; \ No newline at end of file +var _0x82eb=['update','Request','UpdateMailQueueReport','create','CreateMailQueueReport'];(function(_0x57e9cd,_0x289043){var _0x15a8d0=function(_0x1bac87){while(--_0x1bac87){_0x57e9cd['push'](_0x57e9cd['shift']());}};_0x15a8d0(++_0x289043);}(_0x82eb,0x67));var _0xb82e=function(_0x8fc3a0,_0x1b2f6d){_0x8fc3a0=_0x8fc3a0-0x0;var _0x13f1dd=_0x82eb[_0x8fc3a0];return _0x13f1dd;};'use strict';var client=require('../client');exports[_0xb82e('0x0')]=function(_0x5d3cfd){return client['Request']('CreateMailQueueReport',{'body':_0x5d3cfd,'log':_0xb82e('0x1')});};exports[_0xb82e('0x2')]=function(_0x403d64,_0x38b509){return client[_0xb82e('0x3')]('UpdateMailQueueReport',{'body':_0x38b509,'options':{'where':{'uniqueid':_0x403d64},'order':[['id','DESC']],'limit':0x1},'log':_0xb82e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index e0860fb..ca9efe3 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 _0x3965=['update','Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x1a02dc,_0xe9dddd){var _0x12257e=function(_0x323a61){while(--_0x323a61){_0x1a02dc['push'](_0x1a02dc['shift']());}};_0x12257e(++_0xe9dddd);}(_0x3965,0xb3));var _0x5396=function(_0x4abc8f,_0xef597d){_0x4abc8f=_0x4abc8f-0x0;var _0x5d7939=_0x3965[_0x4abc8f];return _0x5d7939;};'use strict';var client=require(_0x5396('0x0'));exports[_0x5396('0x1')]=function(_0x58dea8,_0xa8f1cd){return client[_0x5396('0x2')](_0x5396('0x3'),{'body':_0xa8f1cd,'options':{'where':{'id':_0x58dea8}},'log':'updateOpenchannelInteraction'});};exports[_0x5396('0x4')]=function(_0x5d76a2,_0x3f0287){return client[_0x5396('0x2')](_0x5396('0x5'),{'body':_0x3f0287,'options':{'where':{'id':_0x5d76a2}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0xabc8=['updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','update','Request'];(function(_0x424a9a,_0x6a9d23){var _0x45d46e=function(_0x46f135){while(--_0x46f135){_0x424a9a['push'](_0x424a9a['shift']());}};_0x45d46e(++_0x6a9d23);}(_0xabc8,0x9a));var _0x8abc=function(_0x2f3794,_0x3c3bec){_0x2f3794=_0x2f3794-0x0;var _0x1c9fbe=_0xabc8[_0x2f3794];return _0x1c9fbe;};'use strict';var client=require('../client');exports[_0x8abc('0x0')]=function(_0x32b32d,_0x3c8b45){return client[_0x8abc('0x1')]('UpdateOpenchannelInteraction',{'body':_0x3c8b45,'options':{'where':{'id':_0x32b32d}},'log':_0x8abc('0x2')});};exports['addTags']=function(_0x42f405,_0x56c55b){return client[_0x8abc('0x1')](_0x8abc('0x3'),{'body':_0x56c55b,'options':{'where':{'id':_0x42f405}},'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 e3286ce..87bd783 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 _0x309b=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0xa743a6,_0x5b645a){var _0x24321c=function(_0x25ddac){while(--_0x25ddac){_0xa743a6['push'](_0xa743a6['shift']());}};_0x24321c(++_0x5b645a);}(_0x309b,0x10c));var _0xb309=function(_0x57288c,_0x1125ea){_0x57288c=_0x57288c-0x0;var _0x1987c2=_0x309b[_0x57288c];return _0x1987c2;};'use strict';var client=require(_0xb309('0x0'));exports[_0xb309('0x1')]=function(_0x4c1886){return client[_0xb309('0x2')](_0xb309('0x3'),{'body':_0x4c1886,'log':_0xb309('0x4')});}; \ No newline at end of file +var _0xb95d=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x2a3a89,_0x564786){var _0x4a9737=function(_0x156626){while(--_0x156626){_0x2a3a89['push'](_0x2a3a89['shift']());}};_0x4a9737(++_0x564786);}(_0xb95d,0x9b));var _0xdb95=function(_0x52e77f,_0x368694){_0x52e77f=_0x52e77f-0x0;var _0x3aad87=_0xb95d[_0x52e77f];return _0x3aad87;};'use strict';var client=require(_0xdb95('0x0'));exports[_0xdb95('0x1')]=function(_0x4f4a57){return client[_0xdb95('0x2')](_0xdb95('0x3'),{'body':_0x4f4a57,'log':_0xdb95('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 584a3a2..b761d1a 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 _0xd5c9=['getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online','openchannelPause','../client'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd5c9,0x175));var _0x9d5c=function(_0x1a8076,_0x270397){_0x1a8076=_0x1a8076-0x0;var _0x3df2d8=_0xd5c9[_0x1a8076];return _0x3df2d8;};'use strict';var client=require(_0x9d5c('0x0'));exports[_0x9d5c('0x1')]=function(){return function(){return client[_0x9d5c('0x2')](_0x9d5c('0x3'),{'options':{'raw':![],'attributes':['id',_0x9d5c('0x4'),_0x9d5c('0x5'),_0x9d5c('0x6')],'include':[{'model':_0x9d5c('0x7'),'as':_0x9d5c('0x8'),'attributes':['id',_0x9d5c('0x4'),_0x9d5c('0x9'),_0x9d5c('0xa')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0xdfe7=['online','getOpenchannelQueues','GetOpenchannelQueue','strategy','Agents'];(function(_0x2905f4,_0x1f2135){var _0x2eae97=function(_0x2498d8){while(--_0x2498d8){_0x2905f4['push'](_0x2905f4['shift']());}};_0x2eae97(++_0x1f2135);}(_0xdfe7,0x196));var _0x7dfe=function(_0x27b817,_0x5a7ecf){_0x27b817=_0x27b817-0x0;var _0x3c66a4=_0xdfe7[_0x27b817];return _0x3c66a4;};'use strict';var client=require('../client');exports[_0x7dfe('0x0')]=function(){return function(){return client['Request'](_0x7dfe('0x1'),{'options':{'raw':![],'attributes':['id','name','timeout',_0x7dfe('0x2')],'include':[{'model':'User','as':_0x7dfe('0x3'),'attributes':['id','name',_0x7dfe('0x4'),'openchannelPause']}]},'log':_0x7dfe('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index a296927..3a9a766 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 _0x3f9b=['UpdateOpenchannelQueueReport','DESC','CreateOpenchannelQueueReport','Request'];(function(_0x4d795f,_0x1c1d46){var _0x4dcaad=function(_0x5e911f){while(--_0x5e911f){_0x4d795f['push'](_0x4d795f['shift']());}};_0x4dcaad(++_0x1c1d46);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x3e9e76,_0x9b20c8){_0x3e9e76=_0x3e9e76-0x0;var _0x1d2d97=_0x3f9b[_0x3e9e76];return _0x1d2d97;};'use strict';var client=require('../client');exports['create']=function(_0x25e416){return client['Request'](_0xb3f9('0x0'),{'body':_0x25e416,'log':_0xb3f9('0x0')});};exports['update']=function(_0x55e5e8,_0x4970d5){return client[_0xb3f9('0x1')](_0xb3f9('0x2'),{'body':_0x4970d5,'options':{'where':{'uniqueid':_0x55e5e8},'order':[['id',_0xb3f9('0x3')]],'limit':0x1},'log':'UpdateOpenchannelQueueReport'});}; \ No newline at end of file +var _0x7b70=['UpdateOpenchannelQueueReport','../client','Request','CreateOpenchannelQueueReport','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7b70,0xc4));var _0x07b7=function(_0x9dfc10,_0x19c2d5){_0x9dfc10=_0x9dfc10-0x0;var _0x4f938a=_0x7b70[_0x9dfc10];return _0x4f938a;};'use strict';var client=require(_0x07b7('0x0'));exports['create']=function(_0x490521){return client[_0x07b7('0x1')](_0x07b7('0x2'),{'body':_0x490521,'log':_0x07b7('0x2')});};exports[_0x07b7('0x3')]=function(_0x3e7eb0,_0x279b6f){return client['Request'](_0x07b7('0x4'),{'body':_0x279b6f,'options':{'where':{'uniqueid':_0x3e7eb0},'order':[['id','DESC']],'limit':0x1},'log':_0x07b7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 79391f1..b6e04bf 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 _0x1e69=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0x1e69,0x85));var _0x91e6=function(_0xdf72bd,_0x98d8fe){_0xdf72bd=_0xdf72bd-0x0;var _0x57febb=_0x1e69[_0xdf72bd];return _0x57febb;};'use strict';var client=require('../client');exports[_0x91e6('0x0')]=function(_0x28561c,_0x6605eb){return client[_0x91e6('0x1')]('UpdateSmsInteraction',{'body':_0x6605eb,'options':{'where':{'id':_0x28561c}},'log':'updateSmsInteraction'});};exports[_0x91e6('0x2')]=function(_0x351c1d,_0x2b53b6){return client[_0x91e6('0x1')](_0x91e6('0x3'),{'body':_0x2b53b6,'options':{'where':{'id':_0x351c1d}},'log':_0x91e6('0x4')});}; \ No newline at end of file +var _0xdbd0=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','updateSmsInteraction'];(function(_0x13524d,_0x505b49){var _0x9918b4=function(_0xef1f0a){while(--_0xef1f0a){_0x13524d['push'](_0x13524d['shift']());}};_0x9918b4(++_0x505b49);}(_0xdbd0,0x88));var _0x0dbd=function(_0x599107,_0x7eecb4){_0x599107=_0x599107-0x0;var _0x43c3b6=_0xdbd0[_0x599107];return _0x43c3b6;};'use strict';var client=require(_0x0dbd('0x0'));exports[_0x0dbd('0x1')]=function(_0x2a19c3,_0xac1778){return client[_0x0dbd('0x2')]('UpdateSmsInteraction',{'body':_0xac1778,'options':{'where':{'id':_0x2a19c3}},'log':_0x0dbd('0x3')});};exports[_0x0dbd('0x4')]=function(_0x1aeffb,_0x5ec8d7){return client[_0x0dbd('0x2')](_0x0dbd('0x5'),{'body':_0x5ec8d7,'options':{'where':{'id':_0x1aeffb}},'log':_0x0dbd('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index f85b70a..7ed2f0c 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 _0x898c=['Request','../client','create'];(function(_0x1c3735,_0x2605cd){var _0x102e6a=function(_0x506ba1){while(--_0x506ba1){_0x1c3735['push'](_0x1c3735['shift']());}};_0x102e6a(++_0x2605cd);}(_0x898c,0x14b));var _0xc898=function(_0x381fa6,_0x5532d9){_0x381fa6=_0x381fa6-0x0;var _0x488bb5=_0x898c[_0x381fa6];return _0x488bb5;};'use strict';var client=require(_0xc898('0x0'));exports[_0xc898('0x1')]=function(_0x598b5d){return client[_0xc898('0x2')]('CreateSmsMessage',{'body':_0x598b5d,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xec7c=['../client','create','Request','CreateSmsMessage','createSmsMessage'];(function(_0x4cb6d0,_0x58e0ab){var _0xcf5c2f=function(_0x2967a){while(--_0x2967a){_0x4cb6d0['push'](_0x4cb6d0['shift']());}};_0xcf5c2f(++_0x58e0ab);}(_0xec7c,0x1e5));var _0xcec7=function(_0x3d4b6a,_0x42a23e){_0x3d4b6a=_0x3d4b6a-0x0;var _0x2c124a=_0xec7c[_0x3d4b6a];return _0x2c124a;};'use strict';var client=require(_0xcec7('0x0'));exports[_0xcec7('0x1')]=function(_0x573c59){return client[_0xcec7('0x2')](_0xcec7('0x3'),{'body':_0x573c59,'log':_0xcec7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 31bf191..9bec3a4 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 _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x8c8dd8,_0x8d604){var _0x50b349=function(_0x49217e){while(--_0x49217e){_0x8c8dd8['push'](_0x8c8dd8['shift']());}};_0x50b349(++_0x8d604);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0xb7e7[_0x1ccdf7];return _0x52a0ae;};'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 +var _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x222c93,_0x48b4cc){var _0x30ee50=function(_0x49e772){while(--_0x49e772){_0x222c93['push'](_0x222c93['shift']());}};_0x30ee50(++_0x48b4cc);}(_0x70e0,0x17b));var _0x070e=function(_0x183060,_0x273171){_0x183060=_0x183060-0x0;var _0x3d6b5a=_0x70e0[_0x183060];return _0x3d6b5a;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 91ea7a5..d7c59a4 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 _0x34e8=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC','../client'];(function(_0x4a0e49,_0x1929b5){var _0xd4fa5c=function(_0x2f3148){while(--_0x2f3148){_0x4a0e49['push'](_0x4a0e49['shift']());}};_0xd4fa5c(++_0x1929b5);}(_0x34e8,0x12c));var _0x834e=function(_0x38c832,_0x365533){_0x38c832=_0x38c832-0x0;var _0x4e06a7=_0x34e8[_0x38c832];return _0x4e06a7;};'use strict';var client=require(_0x834e('0x0'));exports[_0x834e('0x1')]=function(_0x8b339){return client[_0x834e('0x2')]('CreateSmsQueueReport',{'body':_0x8b339,'log':_0x834e('0x3')});};exports[_0x834e('0x4')]=function(_0x472111,_0x31bf20){return client[_0x834e('0x2')](_0x834e('0x5'),{'body':_0x31bf20,'options':{'where':{'uniqueid':_0x472111},'order':[['id',_0x834e('0x6')]],'limit':0x1},'log':'UpdateSmsQueueReport'});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x46a3ff,_0x470b9a){var _0x404bc2=function(_0x20f25f){while(--_0x20f25f){_0x46a3ff['push'](_0x46a3ff['shift']());}};_0x404bc2(++_0x470b9a);}(_0xedd9,0xfc));var _0x9edd=function(_0x5cf30b,_0x41598f){_0x5cf30b=_0x5cf30b-0x0;var _0xe6f60=_0xedd9[_0x5cf30b];return _0xe6f60;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 44a6bbe..6b2dcbf 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(_0x5aa730,_0x1b9b9c){var _0x31f1bd=function(_0x1a557a){while(--_0x1a557a){_0x5aa730['push'](_0x5aa730['shift']());}};_0x31f1bd(++_0x1b9b9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xa9e0[_0x2b4411];return _0x8e41ef;};'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(_0xbb298a,_0x5609de){var _0x4bfc4f=function(_0x3f84ab){while(--_0x3f84ab){_0xbb298a['push'](_0xbb298a['shift']());}};_0x4bfc4f(++_0x5609de);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'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 8d44367..4c73fb8 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 _0xb4c7=['Request','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','../client','update'];(function(_0x18da32,_0x43de62){var _0x2ab5c6=function(_0x2a3735){while(--_0x2a3735){_0x18da32['push'](_0x18da32['shift']());}};_0x2ab5c6(++_0x43de62);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x32eecf,_0x2b2d50){_0x32eecf=_0x32eecf-0x0;var _0x3581b8=_0xb4c7[_0x32eecf];return _0x3581b8;};'use strict';var client=require(_0x7b4c('0x0'));exports[_0x7b4c('0x1')]=function(_0x144dc5,_0xa0d9f1){return client[_0x7b4c('0x2')]('UpdateWhatsappInteraction',{'body':_0xa0d9f1,'options':{'where':{'id':_0x144dc5}},'log':_0x7b4c('0x3')});};exports[_0x7b4c('0x4')]=function(_0x3ebc75,_0x17cea2){return client[_0x7b4c('0x2')]('AddTagsToWhatsappInteraction',{'body':_0x17cea2,'options':{'where':{'id':_0x3ebc75}},'log':_0x7b4c('0x5')});}; \ No newline at end of file +var _0x9f02=['addTags','addTagsToWhatsappInteraction','../client','Request','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x24f326,_0x616a7){var _0x488e2d=function(_0x293d9a){while(--_0x293d9a){_0x24f326['push'](_0x24f326['shift']());}};_0x488e2d(++_0x616a7);}(_0x9f02,0x68));var _0x29f0=function(_0x3cf307,_0xfb7f18){_0x3cf307=_0x3cf307-0x0;var _0x1fcbce=_0x9f02[_0x3cf307];return _0x1fcbce;};'use strict';var client=require(_0x29f0('0x0'));exports['update']=function(_0x51f5c2,_0x4bb7b2){return client[_0x29f0('0x1')](_0x29f0('0x2'),{'body':_0x4bb7b2,'options':{'where':{'id':_0x51f5c2}},'log':_0x29f0('0x3')});};exports[_0x29f0('0x4')]=function(_0x1a49c1,_0x47e569){return client[_0x29f0('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x47e569,'options':{'where':{'id':_0x1a49c1}},'log':_0x29f0('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index ed7bfdb..2a8e57e 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 _0xfa12=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x1c10e7,_0x15ce40){var _0x1999af=function(_0x2f9f5c){while(--_0x2f9f5c){_0x1c10e7['push'](_0x1c10e7['shift']());}};_0x1999af(++_0x15ce40);}(_0xfa12,0x11a));var _0x2fa1=function(_0x22d541,_0xc01585){_0x22d541=_0x22d541-0x0;var _0x35cd83=_0xfa12[_0x22d541];return _0x35cd83;};'use strict';var client=require(_0x2fa1('0x0'));exports[_0x2fa1('0x1')]=function(_0x54a3ec){return client[_0x2fa1('0x2')](_0x2fa1('0x3'),{'body':_0x54a3ec,'log':_0x2fa1('0x4')});}; \ No newline at end of file +var _0xe4b4=['../client','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x403c8d,_0x5e3825){var _0x4ca60d=function(_0x9326c1){while(--_0x9326c1){_0x403c8d['push'](_0x403c8d['shift']());}};_0x4ca60d(++_0x5e3825);}(_0xe4b4,0x178));var _0x4e4b=function(_0x171bff,_0x192cb0){_0x171bff=_0x171bff-0x0;var _0x4ac85b=_0xe4b4[_0x171bff];return _0x4ac85b;};'use strict';var client=require(_0x4e4b('0x0'));exports['create']=function(_0x5c18db){return client[_0x4e4b('0x1')](_0x4e4b('0x2'),{'body':_0x5c18db,'log':_0x4e4b('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 7dcb24e..27d1630 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 _0xb8b5=['name','timeout','strategy','User','online','whatsappPause','../client','getWhatsappQueues','Request','GetWhatsappQueue'];(function(_0x244cac,_0x4da255){var _0x94653e=function(_0x5511bd){while(--_0x5511bd){_0x244cac['push'](_0x244cac['shift']());}};_0x94653e(++_0x4da255);}(_0xb8b5,0x10a));var _0x5b8b=function(_0x914c50,_0x2ba74c){_0x914c50=_0x914c50-0x0;var _0x1f557c=_0xb8b5[_0x914c50];return _0x1f557c;};'use strict';var client=require(_0x5b8b('0x0'));exports[_0x5b8b('0x1')]=function(){return function(){return client[_0x5b8b('0x2')](_0x5b8b('0x3'),{'options':{'raw':![],'attributes':['id',_0x5b8b('0x4'),_0x5b8b('0x5'),_0x5b8b('0x6')],'include':[{'model':_0x5b8b('0x7'),'as':'Agents','attributes':['id','name',_0x5b8b('0x8'),_0x5b8b('0x9')]}]},'log':_0x5b8b('0x1')});};}; \ No newline at end of file +var _0xe9c7=['GetWhatsappQueue','name','timeout','strategy','Agents','whatsappPause','getWhatsappQueues','../client','Request'];(function(_0x828c9c,_0x3ab7b2){var _0x375a9a=function(_0x2f1da5){while(--_0x2f1da5){_0x828c9c['push'](_0x828c9c['shift']());}};_0x375a9a(++_0x3ab7b2);}(_0xe9c7,0xdf));var _0x7e9c=function(_0x53e0b1,_0x3ff1df){_0x53e0b1=_0x53e0b1-0x0;var _0x435d05=_0xe9c7[_0x53e0b1];return _0x435d05;};'use strict';var client=require(_0x7e9c('0x0'));exports['getWhatsappQueues']=function(){return function(){return client[_0x7e9c('0x1')](_0x7e9c('0x2'),{'options':{'raw':![],'attributes':['id',_0x7e9c('0x3'),_0x7e9c('0x4'),_0x7e9c('0x5')],'include':[{'model':'User','as':_0x7e9c('0x6'),'attributes':['id',_0x7e9c('0x3'),'online',_0x7e9c('0x7')]}]},'log':_0x7e9c('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 760a6e0..3961ffc 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 _0xdf18=['create','Request','CreateWhatsappQueueReport','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xdf18,0xe3));var _0x8df1=function(_0x4005e8,_0x4aefca){_0x4005e8=_0x4005e8-0x0;var _0xa7cdf7=_0xdf18[_0x4005e8];return _0xa7cdf7;};'use strict';var client=require(_0x8df1('0x0'));exports[_0x8df1('0x1')]=function(_0xeeb5b9){return client[_0x8df1('0x2')](_0x8df1('0x3'),{'body':_0xeeb5b9,'log':_0x8df1('0x3')});};exports['update']=function(_0x101a83,_0x6d721a){return client[_0x8df1('0x2')](_0x8df1('0x4'),{'body':_0x6d721a,'options':{'where':{'uniqueid':_0x101a83},'order':[['id',_0x8df1('0x5')]],'limit':0x1},'log':_0x8df1('0x4')});}; \ No newline at end of file +var _0xad25=['../client','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xad25,0x82));var _0x5ad2=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xad25[_0xbd08b4];return _0x314f1e;};'use strict';var client=require(_0x5ad2('0x0'));exports['create']=function(_0x24b5b1){return client[_0x5ad2('0x1')](_0x5ad2('0x2'),{'body':_0x24b5b1,'log':'CreateWhatsappQueueReport'});};exports[_0x5ad2('0x3')]=function(_0x223c8d,_0x28b1ce){return client[_0x5ad2('0x1')](_0x5ad2('0x4'),{'body':_0x28b1ce,'options':{'where':{'uniqueid':_0x223c8d},'order':[['id','DESC']],'limit':0x1},'log':_0x5ad2('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 7044deb..5c03330 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 _0x1acf=['timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','error','map','message','join','agents'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x1acf,0x1b4));var _0xf1ac=function(_0x170bb4,_0x283dc4){_0x170bb4=_0x170bb4-0x0;var _0x15b620=_0x1acf[_0x170bb4];return _0x15b620;};'use strict';var schema=require(_0xf1ac('0x0'));var _=require(_0xf1ac('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require(_0xf1ac('0x2'))(_0xf1ac('0x3'));var strategy=require(_0xf1ac('0x4'));var queue=schema({'name':{'type':_0xf1ac('0x5'),'required':!![],'message':_0xf1ac('0x6')},'timeout':{'type':_0xf1ac('0x7'),'message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x3ee675,_0x4de5e8,_0x55845d){return logger[_0xf1ac('0x8')](util[_0xf1ac('0x9')](_0xf1ac('0xa'),_0x3ee675,_0x4de5e8['name'],_0x55845d));}function handleFindAgent(_0x1a9f69){return function(_0x9c6bc){return _0x9c6bc[_0xf1ac('0xb')]['toLowerCase']()===_0x1a9f69[_0xf1ac('0xc')]();};}exports[_0xf1ac('0xd')]=function(_0x16aa3c,_0x1d4510,_0x2ebb0a,_0xc73106){return function(_0x37a25f){try{var _0x3454b8={'name':_0x1d4510[0x0],'timeout':_0x1d4510[0x1]};var _0x60ffcd=queue[_0xf1ac('0x0')](_0x3454b8,{'typecast':!![]});if(_0x60ffcd['length']){logger[_0xf1ac('0xe')]('[%s][AGENT]\x20%s',_0x16aa3c,_[_0xf1ac('0xf')](_0x60ffcd,_0xf1ac('0x10'))[_0xf1ac('0x11')](',\x20'));_0x37a25f['stop']();}else{var _0x22ce0a=_['find'](_0x2ebb0a[_0xf1ac('0x12')],handleFindAgent(_0x3454b8[_0xf1ac('0xb')]));if(_0x22ce0a){var _0x33e632=(_0x3454b8[_0xf1ac('0x13')]||0xa)*0x3e8;var _0x3d7695,_0x447f74;var _0x515cf1=seqqueue[_0xf1ac('0x14')](_0x33e632);_0x515cf1['id']=_0x16aa3c;_0x515cf1[_0xf1ac('0x15')]=_0x33e632;_0x515cf1[_0xf1ac('0x16')]=_0xc73106['channel'];writeLog(_0x16aa3c,_0x22ce0a,util['format'](_0xf1ac('0x17'),_0x33e632));_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]['on'](_0xf1ac('0x19'),function(){logger[_0xf1ac('0x8')](_0xf1ac('0x1a'),_0x16aa3c);clearTimeout(_0x447f74);_0x447f74=undefined;_0x515cf1[_0xf1ac('0x1b')]();if(_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]){delete _0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c];}_0x37a25f[_0xf1ac('0x1c')]();});_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]['on'](_0xf1ac('0x1d'),function(){if(_0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c]){delete _0x2ebb0a[_0xf1ac('0x18')][_0x16aa3c];}});_0x447f74=setTimeout(function(){logger[_0xf1ac('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x16aa3c);clearTimeout(_0x447f74);_0x515cf1['close']();_0x37a25f[_0xf1ac('0x1e')]();},_0x33e632);strategy['agent'](_0x515cf1,_0x22ce0a,_0x2ebb0a,_0xc73106);}else{logger[_0xf1ac('0xe')](_0xf1ac('0x1f'),_0x16aa3c,_0x3454b8[_0xf1ac('0xb')]);_0x37a25f[_0xf1ac('0x1c')]();}}}catch(_0x40e9ac){console[_0xf1ac('0x20')](_0x40e9ac);logger['error'](_0xf1ac('0x21'),_0x16aa3c,_0x40e9ac[_0xf1ac('0x22')]);_0x37a25f[_0xf1ac('0x1c')]();}};}; \ No newline at end of file +var _0xef8b=['toLowerCase','consequence','length','map','message','stop','find','timeout','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','error','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','util','../../../../config/logger','routing','./strategy','timeout\x20is\x20a\x20number','info','format','name'];(function(_0x128cde,_0x210399){var _0x581f0f=function(_0xebf685){while(--_0xebf685){_0x128cde['push'](_0x128cde['shift']());}};_0x581f0f(++_0x210399);}(_0xef8b,0x19b));var _0xbef8=function(_0x4eb662,_0x540e40){_0x4eb662=_0x4eb662-0x0;var _0x2d7889=_0xef8b[_0x4eb662];return _0x2d7889;};'use strict';var schema=require(_0xbef8('0x0'));var _=require('lodash');var util=require(_0xbef8('0x1'));var seqqueue=require('seq-queue');var logger=require(_0xbef8('0x2'))(_0xbef8('0x3'));var strategy=require(_0xbef8('0x4'));var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xbef8('0x5')}});function writeLog(_0x430cfa,_0x2514a9,_0x31ff75){return logger[_0xbef8('0x6')](util[_0xbef8('0x7')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x430cfa,_0x2514a9[_0xbef8('0x8')],_0x31ff75));}function handleFindAgent(_0x2e1a4c){return function(_0x339eb7){return _0x339eb7['name']['toLowerCase']()===_0x2e1a4c[_0xbef8('0x9')]();};}exports[_0xbef8('0xa')]=function(_0x3b3cd2,_0x198b31,_0x30080a,_0x50d550){return function(_0xe1728e){try{var _0x1dac5c={'name':_0x198b31[0x0],'timeout':_0x198b31[0x1]};var _0x6fc4b0=queue[_0xbef8('0x0')](_0x1dac5c,{'typecast':!![]});if(_0x6fc4b0[_0xbef8('0xb')]){logger['error']('[%s][AGENT]\x20%s',_0x3b3cd2,_[_0xbef8('0xc')](_0x6fc4b0,_0xbef8('0xd'))['join'](',\x20'));_0xe1728e[_0xbef8('0xe')]();}else{var _0x17a1cb=_[_0xbef8('0xf')](_0x30080a['agents'],handleFindAgent(_0x1dac5c['name']));if(_0x17a1cb){var _0x380a22=(_0x1dac5c[_0xbef8('0x10')]||0xa)*0x3e8;var _0x5c8fa6,_0x2e84d9;var _0x559685=seqqueue['createQueue'](_0x380a22);_0x559685['id']=_0x3b3cd2;_0x559685[_0xbef8('0x11')]=_0x380a22;_0x559685['channel']=_0x50d550[_0xbef8('0x12')];writeLog(_0x3b3cd2,_0x17a1cb,util['format']('START:%s',_0x380a22));_0x30080a[_0xbef8('0x13')][_0x3b3cd2]['on'](_0xbef8('0x14'),function(){logger[_0xbef8('0x6')](_0xbef8('0x15'),_0x3b3cd2);clearTimeout(_0x2e84d9);_0x2e84d9=undefined;_0x559685[_0xbef8('0x16')]();if(_0x30080a['rules'][_0x3b3cd2]){delete _0x30080a[_0xbef8('0x13')][_0x3b3cd2];}_0xe1728e[_0xbef8('0xe')]();});_0x30080a[_0xbef8('0x13')][_0x3b3cd2]['on'](_0xbef8('0x17'),function(){if(_0x30080a[_0xbef8('0x13')][_0x3b3cd2]){delete _0x30080a[_0xbef8('0x13')][_0x3b3cd2];}});_0x2e84d9=setTimeout(function(){logger[_0xbef8('0x6')](_0xbef8('0x18'),_0x3b3cd2);clearTimeout(_0x2e84d9);_0x559685[_0xbef8('0x16')]();_0xe1728e[_0xbef8('0x19')]();},_0x380a22);strategy['agent'](_0x559685,_0x17a1cb,_0x30080a,_0x50d550);}else{logger[_0xbef8('0x1a')](_0xbef8('0x1b'),_0x3b3cd2,_0x1dac5c[_0xbef8('0x8')]);_0xe1728e['stop']();}}}catch(_0x5730fb){console[_0xbef8('0x1c')](_0x5730fb);logger[_0xbef8('0x1a')]('[%s][QUEUE]\x20%s',_0x3b3cd2,_0x5730fb[_0xbef8('0x1d')]);_0xe1728e['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 430f697..3056710 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 _0x3173=['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','toString','postText','providerName','amazonlex','providerResponse','Message','dialogState','Failed','catch','lodash','moment','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','sms','channel','phone','chat','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','create','then'];(function(_0x1dc445,_0x40fb63){var _0x18ee50=function(_0x44896f){while(--_0x44896f){_0x1dc445['push'](_0x1dc445['shift']());}};_0x18ee50(++_0x40fb63);}(_0x3173,0x161));var _0x3317=function(_0x2cd8ba,_0x3022ed){_0x2cd8ba=_0x2cd8ba-0x0;var _0x32ecf9=_0x3173[_0x2cd8ba];return _0x32ecf9;};'use strict';var _=require(_0x3317('0x0'));var moment=require(_0x3317('0x1'));var AWS=require(_0x3317('0x2'));var utils=require(_0x3317('0x3'));var logger=require(_0x3317('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3317('0x5')),'mailMessage':require(_0x3317('0x6')),'smsMessage':require(_0x3317('0x7')),'faxMessage':require(_0x3317('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3317('0x9')]=function(_0x53250a,_0x368097){return function(_0x29ea5b){try{if(!_[_0x3317('0xa')](this[_0x3317('0xb')][_0x3317('0xc')])){logger[_0x3317('0xd')](_0x3317('0xe'),_0x53250a,_0x3317('0xf'));return _0x29ea5b[_0x3317('0x10')]();}var _0x5e15c3={'ContactId':this[_0x3317('0x11')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0x3317('0x12')||this[_0x3317('0x13')]==='whatsapp'){_0x5e15c3[_0x3317('0x14')]=this['interaction'][_0x3317('0x14')];}var _0x523dd2=this[_0x3317('0x13')];if(_0x523dd2===_0x3317('0x15')){_0x5e15c3['ChatWebsiteId']=this[_0x3317('0x16')]['id'];}else{_0x5e15c3[_[_0x3317('0x17')](_0x523dd2)+_0x3317('0x18')]=this[_0x3317('0x16')]['id'];}_0x5e15c3[_[_0x3317('0x17')](_0x523dd2)+_0x3317('0x19')]=this[_0x3317('0xb')]['id'];if(this[_0x3317('0xb')][_0x3317('0x1a')]){var _0x27b87c=_0x368097[0x4];if(!_['isEmpty'](_0x27b87c)){_0x5e15c3[_0x3317('0x1b')]=utils[_0x3317('0x1c')](_0x27b87c,this);return rpc[_0x523dd2+'Message'][_0x3317('0x1d')](_0x5e15c3)[_0x3317('0x1e')](function(_0x3bed1d){logger[_0x3317('0xd')](_0x3317('0xe'),_0x53250a,_0x5e15c3[_0x3317('0x1b')]);})['catch'](function(_0x541313){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,JSON[_0x3317('0x20')](_0x541313));})['finally'](function(){logger[_0x3317('0xd')](_0x3317('0x21'),_0x53250a);_0x29ea5b[_0x3317('0x22')]();});}else{logger[_0x3317('0xd')](_0x3317('0x23'),_0x53250a);_0x29ea5b[_0x3317('0x22')]();}}else{var _0x41f7d7=this;var _0x1a1800=new AWS[(_0x3317('0x24'))]({'accessKeyId':_0x368097[0x0],'secretAccessKey':_0x368097[0x1],'region':_0x368097[0x2]});var _0x2122d3={'botAlias':_0x3317('0x25'),'botName':_0x368097[0x3],'inputText':this[_0x3317('0x26')][_0x3317('0x1b')],'userId':this[_0x3317('0x13')]+':'+this[_0x3317('0xb')]['id'][_0x3317('0x27')]()};_0x1a1800[_0x3317('0x28')](_0x2122d3,function(_0x595cb6,_0x1de9d9){if(_0x595cb6){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,_0x595cb6[_0x3317('0x26')]);_0x29ea5b[_0x3317('0x10')]();}else if(_0x1de9d9&&_0x1de9d9[_0x3317('0x26')]){_0x41f7d7[_0x3317('0x1b')]['amazonlex']=_0x1de9d9;_0x5e15c3[_0x3317('0x1b')]=_0x1de9d9[_0x3317('0x26')];_0x5e15c3[_0x3317('0x29')]=_0x3317('0x2a');_0x5e15c3[_0x3317('0x2b')]=JSON[_0x3317('0x20')](_0x1de9d9);return rpc[_0x523dd2+_0x3317('0x2c')]['create'](_0x5e15c3)[_0x3317('0x1e')](function(_0x492e58){logger[_0x3317('0xd')](_0x3317('0xe'),_0x53250a,_0x5e15c3[_0x3317('0x1b')]);if(_0x1de9d9[_0x3317('0x2d')]==_0x3317('0x2e')){_0x29ea5b[_0x3317('0x10')]();}else{_0x29ea5b[_0x3317('0x22')]();}})[_0x3317('0x2f')](function(_0x30f397){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,JSON['stringify'](_0x30f397));_0x29ea5b[_0x3317('0x10')]();});}else{_0x29ea5b[_0x3317('0x10')]();}});}}catch(_0x293ddc){logger[_0x3317('0x1f')](_0x3317('0xe'),_0x53250a,JSON['stringify'](_0x293ddc));_0x29ea5b[_0x3317('0x22')]();}};}; \ No newline at end of file +var _0x308c=['amazonlex','providerName','providerResponse','Message','dialogState','Failed','stringify','lodash','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/whatsappMessage','consequence','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','sms','channel','phone','ChatWebsiteId','account','AccountId','upperFirst','created','body','getMustacheRender','create','then','catch','error','finally','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText'];(function(_0x1ad87,_0xbf0041){var _0x5c5635=function(_0x52483f){while(--_0x52483f){_0x1ad87['push'](_0x1ad87['shift']());}};_0x5c5635(++_0xbf0041);}(_0x308c,0x149));var _0xc308=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x308c[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xc308('0x0'));var moment=require('moment');var AWS=require(_0xc308('0x1'));var utils=require('./utils');var logger=require(_0xc308('0x2'))(_0xc308('0x3'));var rpc={'chatMessage':require(_0xc308('0x4')),'openchannelMessage':require(_0xc308('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc308('0x6'))};exports[_0xc308('0x7')]=function(_0x212f78,_0x1809d0){return function(_0x315425){try{if(!_['isNil'](this[_0xc308('0x8')][_0xc308('0x9')])){logger[_0xc308('0xa')](_0xc308('0xb'),_0x212f78,_0xc308('0xc'));return _0x315425[_0xc308('0xd')]();}var _0x5df6b4={'ContactId':this['contact']['id'],'sentAt':moment()[_0xc308('0xe')](_0xc308('0xf')),'direction':_0xc308('0x10')};if(this['channel']===_0xc308('0x11')||this[_0xc308('0x12')]==='whatsapp'){_0x5df6b4[_0xc308('0x13')]=this[_0xc308('0x8')][_0xc308('0x13')];}var _0x5bf0ee=this['channel'];if(_0x5bf0ee==='chat'){_0x5df6b4[_0xc308('0x14')]=this[_0xc308('0x15')]['id'];}else{_0x5df6b4[_['upperFirst'](_0x5bf0ee)+_0xc308('0x16')]=this['account']['id'];}_0x5df6b4[_[_0xc308('0x17')](_0x5bf0ee)+'InteractionId']=this[_0xc308('0x8')]['id'];if(this[_0xc308('0x8')][_0xc308('0x18')]){var _0x2852b9=_0x1809d0[0x4];if(!_['isEmpty'](_0x2852b9)){_0x5df6b4[_0xc308('0x19')]=utils[_0xc308('0x1a')](_0x2852b9,this);return rpc[_0x5bf0ee+'Message'][_0xc308('0x1b')](_0x5df6b4)[_0xc308('0x1c')](function(_0xfdce7a){logger[_0xc308('0xa')](_0xc308('0xb'),_0x212f78,_0x5df6b4[_0xc308('0x19')]);})[_0xc308('0x1d')](function(_0x33f9c5){logger[_0xc308('0x1e')]('[%s][AMAZONLEX]\x20%s',_0x212f78,JSON['stringify'](_0x33f9c5));})[_0xc308('0x1f')](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x212f78);_0x315425[_0xc308('0x20')]();});}else{logger[_0xc308('0xa')](_0xc308('0x21'),_0x212f78);_0x315425[_0xc308('0x20')]();}}else{var _0x489a41=this;var _0x3bce1e=new AWS[(_0xc308('0x22'))]({'accessKeyId':_0x1809d0[0x0],'secretAccessKey':_0x1809d0[0x1],'region':_0x1809d0[0x2]});var _0x14c241={'botAlias':_0xc308('0x23'),'botName':_0x1809d0[0x3],'inputText':this[_0xc308('0x24')][_0xc308('0x19')],'userId':this['channel']+':'+this[_0xc308('0x8')]['id'][_0xc308('0x25')]()};_0x3bce1e[_0xc308('0x26')](_0x14c241,function(_0x1de791,_0x4bb689){if(_0x1de791){logger[_0xc308('0x1e')](_0xc308('0xb'),_0x212f78,_0x1de791['message']);_0x315425[_0xc308('0xd')]();}else if(_0x4bb689&&_0x4bb689[_0xc308('0x24')]){_0x489a41[_0xc308('0x19')][_0xc308('0x27')]=_0x4bb689;_0x5df6b4[_0xc308('0x19')]=_0x4bb689[_0xc308('0x24')];_0x5df6b4[_0xc308('0x28')]=_0xc308('0x27');_0x5df6b4[_0xc308('0x29')]=JSON['stringify'](_0x4bb689);return rpc[_0x5bf0ee+_0xc308('0x2a')]['create'](_0x5df6b4)[_0xc308('0x1c')](function(_0x3e6043){logger[_0xc308('0xa')](_0xc308('0xb'),_0x212f78,_0x5df6b4[_0xc308('0x19')]);if(_0x4bb689[_0xc308('0x2b')]==_0xc308('0x2c')){_0x315425[_0xc308('0xd')]();}else{_0x315425[_0xc308('0x20')]();}})['catch'](function(_0x26a46e){logger['error'](_0xc308('0xb'),_0x212f78,JSON['stringify'](_0x26a46e));_0x315425[_0xc308('0xd')]();});}else{_0x315425[_0xc308('0xd')]();}});}}catch(_0x3f258e){logger['error'](_0xc308('0xb'),_0x212f78,JSON[_0xc308('0x2d')](_0x3f258e));_0x315425['stop']();}};}; \ 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 34b7083..e471b63 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 _0x1cf3=['sendMailMessage','smtpOptions','then','create','stringify','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','Interaction','catch','update','stop','lodash','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','created','interaction','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','channel','phone','subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','All','auto_reply'];(function(_0x5a814d,_0x1181c1){var _0x4d622f=function(_0x4f0280){while(--_0x4f0280){_0x5a814d['push'](_0x5a814d['shift']());}};_0x4d622f(++_0x1181c1);}(_0x1cf3,0xca));var _0x31cf=function(_0x1b4894,_0xa922a6){_0x1b4894=_0x1b4894-0x0;var _0x45d1fa=_0x1cf3[_0x1b4894];return _0x45d1fa;};'use strict';var _=require(_0x31cf('0x0'));var moment=require('moment');var utils=require(_0x31cf('0x1'));var logger=require(_0x31cf('0x2'))('routing');var rpc={'chatMessage':require(_0x31cf('0x3')),'openchannelMessage':require(_0x31cf('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x31cf('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x31cf('0x6')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x31cf('0x7'))};var mailRpc=require(_0x31cf('0x8'));exports[_0x31cf('0x9')]=function(_0x319160,_0x4daa5a,_0x29194d,_0x3b70ae){return function(_0x8912cc){try{var _0xefa5d7=this['channel'];if(_0xefa5d7===_0x31cf('0xa')&&_0x3b70ae[_0x31cf('0xb')]['isAutoreply']){logger[_0x31cf('0xc')](_0x31cf('0xd'),_0x319160,_0x31cf('0xe'));return _0x8912cc[_0x31cf('0xf')]();}if(_0x4daa5a[0x0]==='1'&&(_[_0x31cf('0x10')](this['interaction'][_0x31cf('0x11')])||!this[_0x31cf('0x12')]['created'])){logger['info'](_0x31cf('0xd'),_0x319160,_0x31cf('0x13'));return _0x8912cc[_0x31cf('0xf')]();}if(_0x4daa5a[0x0]==='2'&&this[_0x31cf('0x12')][_0x31cf('0x14')]){logger[_0x31cf('0xc')](_0x31cf('0x15'),_0x319160,_0x31cf('0x16'));return _0x8912cc[_0x31cf('0xf')]();}var _0x1c7463={'ContactId':this[_0x31cf('0x17')]['id'],'sentAt':moment()['format'](_0x31cf('0x18')),'direction':_0x31cf('0x19')};if(this['channel']===_0x31cf('0xa')){_0x1c7463[_0x31cf('0xb')]=utils[_0x31cf('0x1a')](_0x4daa5a[0x2],this);}else{_0x1c7463['body']=utils['getMustacheRender'](_0x4daa5a[0x1],this);}if(this[_0x31cf('0x1b')]){_0x1c7463['to']=this['message'][_0x31cf('0x1c')]||'';if(this[_0x31cf('0x1d')]===_0x31cf('0xa')&&_0x4daa5a[0x1]==='1'){_0x1c7463['cc']=this['message']['cc']||'';}_0x1c7463['from']=this['message']['to']||'';_0x1c7463[_0x31cf('0x1e')]=this[_0x31cf('0x1b')]['phone']||'';_0x1c7463['read']=!![];if(this[_0x31cf('0x1b')]['subject']){_0x1c7463[_0x31cf('0x1f')]='';_0x1c7463['subject']+=_[_0x31cf('0x20')](this[_0x31cf('0x1b')][_0x31cf('0x1f')],_0x31cf('0x21'))?'':_0x31cf('0x22');_0x1c7463[_0x31cf('0x1f')]+=this[_0x31cf('0x1b')][_0x31cf('0x1f')];}}if(this['channel']===_0x31cf('0x23')){_0x1c7463[_0x31cf('0x24')]=this[_0x31cf('0x25')]['id'];}else{_0x1c7463[_[_0x31cf('0x26')](this[_0x31cf('0x1d')])+_0x31cf('0x27')]=this[_0x31cf('0x25')]['id'];}_0x1c7463[_[_0x31cf('0x26')](this[_0x31cf('0x1d')])+_0x31cf('0x28')]=this['interaction']['id'];var _0x1063eb=this[_0x31cf('0x12')];if(rpc[this[_0x31cf('0x1d')]+_0x31cf('0x29')]){if(this[_0x31cf('0x1d')]===_0x31cf('0xa')){_0x1c7463[_0x31cf('0x2a')]=this[_0x31cf('0x1b')][_0x31cf('0x2b')];_0x1c7463[_0x31cf('0x2c')]=_0x31cf('0x2d')+_[_0x31cf('0x2e')](_0x1c7463[_0x31cf('0xb')],''+_[_0x331c('0x2e')](_0x158bdd[_0x331c('0x11')],_0x331c('0x2f'),_0x331c('0x30'))+'';_0x158bdd[_0x331c('0x31')]={'Auto-Submitted':_0x331c('0x32'),'X-Auto-Response-Suppress':_0x331c('0x33'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x331c('0x27')]['smtpOptions'],_0x158bdd)[_0x331c('0x34')](function(_0x354659){logger[_0x331c('0x13')](_0x331c('0x35'),_0x33bf63);_0x158bdd['messageId']=_0x354659[_0x331c('0x21')]['messageId'];return rpc[_0xb774c1+_0x331c('0x2a')]['create'](_0x158bdd);})[_0x331c('0x34')](function(_0x24c377){logger[_0x331c('0x13')](_0x331c('0x14'),_0x33bf63,JSON['stringify'](_0x24c377));})[_0x331c('0x36')](function(_0x1d4ab3){logger[_0x331c('0x37')](_0x331c('0x38'),_0x33bf63,JSON[_0x331c('0x39')](_0x1d4ab3));})[_0x331c('0x3a')](function(){Promise['resolve']()['then'](function(){if(_0x768252[0x0]!=='2'||_0x3a218e[_0x331c('0x1b')])return;return rpc[_0xb774c1+'Interaction'][_0x331c('0x3b')](_0x3a218e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x5435f9){logger[_0x331c('0x13')](_0x331c('0x3c'),_0x33bf63,JSON[_0x331c('0x39')](_0x5435f9));})[_0x331c('0x36')](function(_0x131fe4){logger[_0x331c('0x37')](_0x331c('0x3d'),_0x33bf63,JSON[_0x331c('0x39')](_0x131fe4));});})[_0x331c('0x34')](function(){_0x5bdefd[_0x331c('0x16')]();});});}else{return rpc[this[_0x331c('0xf')]+_0x331c('0x2a')][_0x331c('0x3e')](_0x158bdd)[_0x331c('0x34')](function(){logger[_0x331c('0x13')](_0x331c('0x14'),_0x33bf63,_0x158bdd[_0x331c('0x11')]);})['catch'](function(_0x10cc81){logger[_0x331c('0x37')](_0x331c('0x14'),_0x33bf63,JSON['stringify'](_0x10cc81));})['finally'](function(){Promise[_0x331c('0x3f')]()['then'](function(){if(_0x768252[0x0]!=='2'||_0x3a218e[_0x331c('0x1b')])return;return rpc[_0xb774c1+_0x331c('0x40')][_0x331c('0x3b')](_0x3a218e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x1bb4fd){logger[_0x331c('0x13')](_0x331c('0x3c'),_0x33bf63,JSON['stringify'](_0x1bb4fd));})[_0x331c('0x36')](function(_0x2580bb){logger[_0x331c('0x37')](_0x331c('0x3d'),_0x33bf63,JSON['stringify'](_0x2580bb));});})[_0x331c('0x34')](function(){_0x5bdefd[_0x331c('0x16')]();});});}}}catch(_0x13cd63){logger['error']('[%s][AUTOREPLY]\x20%s',_0x33bf63,JSON['stringify'](_0x13cd63));_0x5bdefd[_0x331c('0x41')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/close.js b/server/services/routing/server/applications/close.js index 157b9db..9967e5a 100644 --- a/server/services/routing/server/applications/close.js +++ b/server/services/routing/server/applications/close.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0469=['../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','[%s][CLOSE]\x20reason\x20%s','YYYY-MM-DD\x20HH:mm:ss','system','Interaction','channel','interaction','then','info','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment'];(function(_0x53dc2f,_0x352f5f){var _0x2db8b6=function(_0x1c82c9){while(--_0x1c82c9){_0x53dc2f['push'](_0x53dc2f['shift']());}};_0x2db8b6(++_0x352f5f);}(_0x0469,0xbc));var _0x9046=function(_0x101ed5,_0x4f5c30){_0x101ed5=_0x101ed5-0x0;var _0x5ae524=_0x0469[_0x101ed5];return _0x5ae524;};'use strict';var moment=require(_0x9046('0x0'));var logger=require(_0x9046('0x1'))(_0x9046('0x2'));var rpc={'chatInteraction':require(_0x9046('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x9046('0x4')),'mailInteraction':require(_0x9046('0x5')),'faxInteraction':require(_0x9046('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports['consequence']=function(_0x2a5855,_0x39d822,_0x52aa14,_0x563730){return function(_0x3be63f){try{logger['info'](_0x9046('0x7'),_0x2a5855,_0x39d822[0x0]);var _0x161257={'closed':0x1,'closedAt':moment()['format'](_0x9046('0x8')),'closeReason':_0x9046('0x9'),'disposition':_0x39d822[0x0]};if(rpc[_0x563730['channel']+_0x9046('0xa')]){rpc[_0x563730[_0x9046('0xb')]+'Interaction']['update'](_0x563730[_0x9046('0xc')]['id'],_0x161257)[_0x9046('0xd')](function(_0x437a3){logger[_0x9046('0xe')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x2a5855,_0x563730['interaction']['id']);})[_0x9046('0xf')](function(_0x37af70){logger[_0x9046('0x10')](_0x9046('0x11'),_0x2a5855,JSON[_0x9046('0x12')](_0x37af70));})[_0x9046('0x13')](function(){_0x3be63f[_0x9046('0x14')]();});}}catch(_0x5d02c0){logger[_0x9046('0x10')]('[%s][CLOSE]\x20%s',_0x2a5855,JSON['stringify'](_0x5d02c0));_0x3be63f[_0x9046('0x14')]();}};}; \ No newline at end of file +var _0xe9f4=['stop','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','channel','update','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','interaction','error','[%s][CLOSE]\x20%s','stringify','finally'];(function(_0x571d83,_0x4cb677){var _0x36e67f=function(_0x39022b){while(--_0x39022b){_0x571d83['push'](_0x571d83['shift']());}};_0x36e67f(++_0x4cb677);}(_0xe9f4,0x13c));var _0x4e9f=function(_0xe4b024,_0x8deaf5){_0xe4b024=_0xe4b024-0x0;var _0x443a04=_0xe9f4[_0xe4b024];return _0x443a04;};'use strict';var moment=require(_0x4e9f('0x0'));var logger=require(_0x4e9f('0x1'))(_0x4e9f('0x2'));var rpc={'chatInteraction':require(_0x4e9f('0x3')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x4e9f('0x4')),'mailInteraction':require(_0x4e9f('0x5')),'faxInteraction':require(_0x4e9f('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x4e9f('0x7')]=function(_0x39a1d0,_0x2821d3,_0x26d163,_0x3968c8){return function(_0x2d9d95){try{logger[_0x4e9f('0x8')](_0x4e9f('0x9'),_0x39a1d0,_0x2821d3[0x0]);var _0x2fa88f={'closed':0x1,'closedAt':moment()[_0x4e9f('0xa')](_0x4e9f('0xb')),'closeReason':'system','disposition':_0x2821d3[0x0]};if(rpc[_0x3968c8['channel']+'Interaction']){rpc[_0x3968c8[_0x4e9f('0xc')]+'Interaction'][_0x4e9f('0xd')](_0x3968c8['interaction']['id'],_0x2fa88f)['then'](function(_0x4d161d){logger[_0x4e9f('0x8')](_0x4e9f('0xe'),_0x39a1d0,_0x3968c8[_0x4e9f('0xf')]['id']);})['catch'](function(_0x14f276){logger[_0x4e9f('0x10')](_0x4e9f('0x11'),_0x39a1d0,JSON[_0x4e9f('0x12')](_0x14f276));})[_0x4e9f('0x13')](function(){_0x2d9d95[_0x4e9f('0x14')]();});}}catch(_0x90a07e){logger[_0x4e9f('0x10')](_0x4e9f('0x11'),_0x39a1d0,JSON[_0x4e9f('0x12')](_0x90a07e));_0x2d9d95[_0x4e9f('0x14')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflow.js b/server/services/routing/server/applications/dialogflow.js index 206c078..2fb5d72 100644 --- a/server/services/routing/server/applications/dialogflow.js +++ b/server/services/routing/server/applications/dialogflow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1fa9=['sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','body','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','dialogflow','fulfillment','speech','providerName','result','metadata','stop','lodash','apiai-promise','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel'];(function(_0xa5068c,_0x4b674c){var _0x5bc195=function(_0x301dfd){while(--_0x301dfd){_0xa5068c['push'](_0xa5068c['shift']());}};_0x5bc195(++_0x4b674c);}(_0x1fa9,0x136));var _0x91fa=function(_0x5292a1,_0x46ad44){_0x5292a1=_0x5292a1-0x0;var _0x2af6b0=_0x1fa9[_0x5292a1];return _0x2af6b0;};'use strict';var _=require(_0x91fa('0x0'));var moment=require('moment');var apiai=require(_0x91fa('0x1'));var md5=require('md5');var utils=require(_0x91fa('0x2'));var logger=require(_0x91fa('0x3'))(_0x91fa('0x4'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x91fa('0x5')),'mailMessage':require(_0x91fa('0x6')),'smsMessage':require(_0x91fa('0x7')),'faxMessage':require(_0x91fa('0x8')),'whatsappMessage':require(_0x91fa('0x9'))};exports['consequence']=function(_0x261d51,_0x2675e3){return function(_0x483dde){try{if(!_['isNil'](this[_0x91fa('0xa')][_0x91fa('0xb')])){logger[_0x91fa('0xc')](_0x91fa('0xd'),_0x261d51,_0x91fa('0xe'));return _0x483dde[_0x91fa('0xf')]();}var _0x132eb2={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x91fa('0x10')),'direction':_0x91fa('0x11')};if(this[_0x91fa('0x12')]===_0x91fa('0x13')||this[_0x91fa('0x12')]===_0x91fa('0x14')){_0x132eb2[_0x91fa('0x15')]=this['interaction']['phone'];}var _0x4fb2d6=this[_0x91fa('0x12')];if(_0x4fb2d6==='chat'){_0x132eb2[_0x91fa('0x16')]=this[_0x91fa('0x17')]['id'];}else{_0x132eb2[_[_0x91fa('0x18')](_0x4fb2d6)+_0x91fa('0x19')]=this['account']['id'];}_0x132eb2[_[_0x91fa('0x18')](_0x4fb2d6)+_0x91fa('0x1a')]=this[_0x91fa('0xa')]['id'];if(this[_0x91fa('0xa')][_0x91fa('0x1b')]){var _0x1f43fa=_0x2675e3[0x2];if(!_['isEmpty'](_0x1f43fa)){_0x132eb2[_0x91fa('0x1c')]=utils[_0x91fa('0x1d')](_0x1f43fa,this);return rpc[_0x4fb2d6+_0x91fa('0x1e')][_0x91fa('0x1f')](_0x132eb2)[_0x91fa('0x20')](function(_0x4dcbcf){logger[_0x91fa('0xc')](_0x91fa('0xd'),_0x261d51,_0x132eb2[_0x91fa('0x1c')]);})[_0x91fa('0x21')](function(_0xaaf2eb){logger[_0x91fa('0x22')](_0x91fa('0xd'),_0x261d51,JSON[_0x91fa('0x23')](_0xaaf2eb));})[_0x91fa('0x24')](function(){logger[_0x91fa('0xc')](_0x91fa('0x25'),_0x261d51);_0x483dde['stop']();});}else{logger[_0x91fa('0xc')](_0x91fa('0x26'),_0x261d51);_0x483dde['stop']();}}else{var _0x1a6480=this;var _0x50596c=apiai(_0x2675e3[0x0],{'language':_0x2675e3[0x1]||'en'});return _0x50596c[_0x91fa('0x27')](this['message']['body'],{'sessionId':md5(this['interaction']['id'])})[_0x91fa('0x20')](function(_0x6d4e53){_0x1a6480[_0x91fa('0x1c')][_0x91fa('0x28')]=_0x6d4e53;_0x132eb2[_0x91fa('0x1c')]=_0x6d4e53['result'][_0x91fa('0x29')][_0x91fa('0x2a')];_0x132eb2[_0x91fa('0x2b')]=_0x91fa('0x28');_0x132eb2['providerResponse']=JSON['stringify'](_0x6d4e53);return rpc[_0x4fb2d6+_0x91fa('0x1e')][_0x91fa('0x1f')](_0x132eb2)[_0x91fa('0x20')](function(_0x44af0b){logger[_0x91fa('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x261d51,_0x132eb2[_0x91fa('0x1c')]);if(_0x6d4e53[_0x91fa('0x2c')][_0x91fa('0x2d')]['endConversation']){_0x483dde['next']();}else{_0x483dde[_0x91fa('0x2e')]();}})[_0x91fa('0x21')](function(_0x3ec667){logger[_0x91fa('0x22')](_0x91fa('0xd'),_0x261d51,JSON[_0x91fa('0x23')](_0x3ec667));_0x483dde[_0x91fa('0xf')]();});})[_0x91fa('0x21')](function(_0x455e8c){logger[_0x91fa('0x22')](_0x91fa('0xd'),_0x261d51,_0x455e8c['message']);_0x483dde['next']();});}}catch(_0x291ff2){logger[_0x91fa('0x22')](_0x91fa('0xd'),_0x261d51,JSON[_0x91fa('0x23')](_0x291ff2));_0x483dde[_0x91fa('0x2e')]();}};}; \ No newline at end of file +var _0x44fe=['consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][DIALOGFLOW]\x20%s','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','dialogflow','result','fulfillment','providerName','providerResponse','metadata','endConversation','message','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage'];(function(_0x15f38c,_0x5cba33){var _0x3b94dd=function(_0x5012f9){while(--_0x5012f9){_0x15f38c['push'](_0x15f38c['shift']());}};_0x3b94dd(++_0x5cba33);}(_0x44fe,0x16f));var _0xe44f=function(_0x1bdd6d,_0x1aa667){_0x1bdd6d=_0x1bdd6d-0x0;var _0x3ed9eb=_0x44fe[_0x1bdd6d];return _0x3ed9eb;};'use strict';var _=require(_0xe44f('0x0'));var moment=require(_0xe44f('0x1'));var apiai=require(_0xe44f('0x2'));var md5=require(_0xe44f('0x3'));var utils=require(_0xe44f('0x4'));var logger=require(_0xe44f('0x5'))(_0xe44f('0x6'));var rpc={'chatMessage':require(_0xe44f('0x7')),'openchannelMessage':require(_0xe44f('0x8')),'mailMessage':require(_0xe44f('0x9')),'smsMessage':require(_0xe44f('0xa')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xe44f('0xb')]=function(_0x18320f,_0x5c5234){return function(_0x1a4e3b){try{if(!_[_0xe44f('0xc')](this[_0xe44f('0xd')][_0xe44f('0xe')])){logger[_0xe44f('0xf')]('[%s][DIALOGFLOW]\x20%s',_0x18320f,_0xe44f('0x10'));return _0x1a4e3b[_0xe44f('0x11')]();}var _0x44b180={'ContactId':this[_0xe44f('0x12')]['id'],'sentAt':moment()[_0xe44f('0x13')](_0xe44f('0x14')),'direction':_0xe44f('0x15')};if(this[_0xe44f('0x16')]===_0xe44f('0x17')||this['channel']===_0xe44f('0x18')){_0x44b180[_0xe44f('0x19')]=this['interaction'][_0xe44f('0x19')];}var _0x59bf6a=this[_0xe44f('0x16')];if(_0x59bf6a===_0xe44f('0x1a')){_0x44b180[_0xe44f('0x1b')]=this[_0xe44f('0x1c')]['id'];}else{_0x44b180[_[_0xe44f('0x1d')](_0x59bf6a)+_0xe44f('0x1e')]=this['account']['id'];}_0x44b180[_[_0xe44f('0x1d')](_0x59bf6a)+_0xe44f('0x1f')]=this[_0xe44f('0xd')]['id'];if(this[_0xe44f('0xd')][_0xe44f('0x20')]){var _0x3d334f=_0x5c5234[0x2];if(!_[_0xe44f('0x21')](_0x3d334f)){_0x44b180[_0xe44f('0x22')]=utils[_0xe44f('0x23')](_0x3d334f,this);return rpc[_0x59bf6a+_0xe44f('0x24')][_0xe44f('0x25')](_0x44b180)[_0xe44f('0x26')](function(_0x4c70e5){logger['info'](_0xe44f('0x27'),_0x18320f,_0x44b180[_0xe44f('0x22')]);})[_0xe44f('0x28')](function(_0x117a30){logger[_0xe44f('0x29')](_0xe44f('0x27'),_0x18320f,JSON[_0xe44f('0x2a')](_0x117a30));})[_0xe44f('0x2b')](function(){logger[_0xe44f('0xf')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x18320f);_0x1a4e3b['stop']();});}else{logger[_0xe44f('0xf')](_0xe44f('0x2c'),_0x18320f);_0x1a4e3b[_0xe44f('0x2d')]();}}else{var _0x3f7ef8=this;var _0xf3c259=apiai(_0x5c5234[0x0],{'language':_0x5c5234[0x1]||'en'});return _0xf3c259['textRequest'](this['message'][_0xe44f('0x22')],{'sessionId':md5(this[_0xe44f('0xd')]['id'])})[_0xe44f('0x26')](function(_0x20c7aa){_0x3f7ef8['body'][_0xe44f('0x2e')]=_0x20c7aa;_0x44b180[_0xe44f('0x22')]=_0x20c7aa[_0xe44f('0x2f')][_0xe44f('0x30')]['speech'];_0x44b180[_0xe44f('0x31')]=_0xe44f('0x2e');_0x44b180[_0xe44f('0x32')]=JSON['stringify'](_0x20c7aa);return rpc[_0x59bf6a+'Message'][_0xe44f('0x25')](_0x44b180)[_0xe44f('0x26')](function(_0x466e26){logger['info'](_0xe44f('0x27'),_0x18320f,_0x44b180['body']);if(_0x20c7aa[_0xe44f('0x2f')][_0xe44f('0x33')][_0xe44f('0x34')]){_0x1a4e3b['next']();}else{_0x1a4e3b['stop']();}})['catch'](function(_0x4f9ca8){logger[_0xe44f('0x29')](_0xe44f('0x27'),_0x18320f,JSON['stringify'](_0x4f9ca8));_0x1a4e3b[_0xe44f('0x11')]();});})[_0xe44f('0x28')](function(_0x386272){logger[_0xe44f('0x29')](_0xe44f('0x27'),_0x18320f,_0x386272[_0xe44f('0x35')]);_0x1a4e3b['next']();});}}catch(_0x2f22d9){logger['error'](_0xe44f('0x27'),_0x18320f,JSON[_0xe44f('0x2a')](_0x2f22d9));_0x1a4e3b[_0xe44f('0x2d')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/dialogflowV2.js b/server/services/routing/server/applications/dialogflowV2.js index cd7e62d..1761d68 100644 --- a/server/services/routing/server/applications/dialogflowV2.js +++ b/server/services/routing/server/applications/dialogflowV2.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb794=['sms','channel','whatsapp','phone','chat','ChatWebsiteId','upperFirst','account','InteractionId','created','isEmpty','getMustacheRender','then','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','all','stack','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','clone','body','Message','create','catch','error','[%s][DIALOGFLOWV2]\x20%s','stringify','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xb794,0x77));var _0x4b79=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb794[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4b79('0x0'));var dialogflow=require('dialogflow');var md5=require('md5');var moment=require(_0x4b79('0x1'));var Promise=require('bluebird');var logger=require(_0x4b79('0x2'))(_0x4b79('0x3'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4b79('0x4')),'mailMessage':require(_0x4b79('0x5')),'smsMessage':require(_0x4b79('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x4b79('0x7'))};function createMessage(_0x2f9e93,_0x22deca,_0xc41ee7,_0x532c86){return new Promise(function(_0x54460c,_0x383698){var _0x4fca21=_[_0x4b79('0x8')](_0xc41ee7);_0x4fca21[_0x4b79('0x9')]=_0x532c86;return rpc[_0x22deca+_0x4b79('0xa')][_0x4b79('0xb')](_0x4fca21)['then'](function(){logger['info']('[%s][DIALOGFLOWV2]\x20%s',_0x2f9e93,_0x4fca21['body']);_0x54460c();})[_0x4b79('0xc')](function(_0x1817fc){logger[_0x4b79('0xd')](_0x4b79('0xe'),_0x2f9e93,JSON[_0x4b79('0xf')](_0x1817fc));_0x383698(_0x1817fc);});});}exports['consequence']=function(_0x1a2425,_0x3c12a6){return function(_0x3f5ca6){try{if(!_['isNil'](this[_0x4b79('0x10')][_0x4b79('0x11')])){logger[_0x4b79('0x12')](_0x4b79('0xe'),_0x1a2425,_0x4b79('0x13'));return _0x3f5ca6[_0x4b79('0x14')]();}var _0x7d48ba={'ContactId':this['contact']['id'],'sentAt':moment()[_0x4b79('0x15')](_0x4b79('0x16')),'direction':'out'};if(this['channel']===_0x4b79('0x17')||this[_0x4b79('0x18')]===_0x4b79('0x19')){_0x7d48ba[_0x4b79('0x1a')]=this[_0x4b79('0x10')][_0x4b79('0x1a')];}var _0x3b5d5c=this[_0x4b79('0x18')];if(_0x3b5d5c===_0x4b79('0x1b')){_0x7d48ba[_0x4b79('0x1c')]=this['account']['id'];}else{_0x7d48ba[_[_0x4b79('0x1d')](_0x3b5d5c)+'AccountId']=this[_0x4b79('0x1e')]['id'];}_0x7d48ba[_[_0x4b79('0x1d')](_0x3b5d5c)+_0x4b79('0x1f')]=this[_0x4b79('0x10')]['id'];if(this[_0x4b79('0x10')][_0x4b79('0x20')]){var _0x3df418=_0x3c12a6[0x4];if(!_[_0x4b79('0x21')](_0x3df418)){_0x7d48ba[_0x4b79('0x9')]=utils[_0x4b79('0x22')](_0x3df418,this);return rpc[_0x3b5d5c+_0x4b79('0xa')][_0x4b79('0xb')](_0x7d48ba)[_0x4b79('0x23')](function(_0x2b4f1e){logger[_0x4b79('0x12')](_0x4b79('0xe'),_0x1a2425,_0x7d48ba[_0x4b79('0x9')]);})[_0x4b79('0xc')](function(_0x452c7a){logger[_0x4b79('0xd')](_0x4b79('0xe'),_0x1a2425,JSON[_0x4b79('0xf')](_0x452c7a));})['finally'](function(){logger[_0x4b79('0x12')](_0x4b79('0x24'),_0x1a2425);_0x3f5ca6[_0x4b79('0x25')]();});}else{logger['info'](_0x4b79('0x26'),_0x1a2425);_0x3f5ca6['stop']();}}else{var _0x1aaf5b=this;var _0x351192=_0x3c12a6[0x2][_0x4b79('0x27')](/\\n/g,'\x0a');var _0x2ac8f2={'credentials':{'private_key':_0x351192,'client_email':_0x3c12a6[0x1]}};var _0x629640=new dialogflow[(_0x4b79('0x28'))](_0x2ac8f2);var _0x5995bc=_0x629640[_0x4b79('0x29')](_0x3c12a6[0x0],md5(_0x1aaf5b[_0x4b79('0x10')]['id']));var _0x1f1f27={'session':_0x5995bc,'queryInput':{'text':{'text':_0x1aaf5b[_0x4b79('0x2a')][_0x4b79('0x9')],'languageCode':_0x3c12a6[0x3]||'en'}}};return _0x629640[_0x4b79('0x2b')](_0x1f1f27)[_0x4b79('0x23')](function(_0x278615){if(_0x278615&&_0x278615[_0x4b79('0x2c')]){_0x1aaf5b[_0x4b79('0x9')][_0x4b79('0x2d')]=_0x278615;var _0x412e55=_0x278615[0x0];var _0xc6e2b6=_0x412e55[_0x4b79('0x2e')][_0x4b79('0x2f')]&&_0x412e55[_0x4b79('0x2e')][_0x4b79('0x2f')][_0x4b79('0x30')]?_0x412e55[_0x4b79('0x2e')][_0x4b79('0x2f')][_0x4b79('0x30')][_0x4b79('0x31')][_0x4b79('0x32')]:![];_0x1aaf5b[_0x4b79('0x9')]['DIALOGFLOWV2_ACTION']=_0x412e55[_0x4b79('0x2e')]['action'];_0x1aaf5b[_0x4b79('0x9')][_0x4b79('0x33')]=_0x412e55['queryResult'][_0x4b79('0x34')];_0x1aaf5b[_0x4b79('0x9')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x412e55['queryResult']['diagnosticInfo']&&_0x412e55['queryResult']['diagnosticInfo'][_0x4b79('0x30')]?_0x412e55[_0x4b79('0x2e')]['diagnosticInfo'][_0x4b79('0x30')][_0x4b79('0x31')][_0x4b79('0x32')]:![];_0x1aaf5b[_0x4b79('0x9')][_0x4b79('0x35')]=_0x412e55[_0x4b79('0x2e')][_0x4b79('0x36')][_0x4b79('0x37')];_0x1aaf5b[_0x4b79('0x9')][_0x4b79('0x38')]=_0x412e55[_0x4b79('0x2e')][_0x4b79('0x36')][_0x4b79('0x39')];_0x1aaf5b['body'][_0x4b79('0x3a')]=_0x412e55[_0x4b79('0x2e')]['intent'][_0x4b79('0x3b')];_0x1aaf5b['body'][_0x4b79('0x3c')]=_0x412e55[_0x4b79('0x2e')][_0x4b79('0x3d')];_0x1aaf5b[_0x4b79('0x9')][_0x4b79('0x3e')]=_0x412e55['queryResult'][_0x4b79('0x3f')];_0x1aaf5b[_0x4b79('0x9')][_0x4b79('0x40')]=_0x412e55[_0x4b79('0x2e')][_0x4b79('0x41')];_0x7d48ba[_0x4b79('0x42')]=_0x4b79('0x2d');_0x7d48ba[_0x4b79('0x43')]=JSON[_0x4b79('0xf')](_0x278615);var _0x3be189=[];for(var _0x107f2c=0x0;_0x107f2c<_0x278615[_0x4b79('0x2c')];_0x107f2c++){var _0x33b9e4=_0x278615[_0x107f2c];if(_0x33b9e4&&_0x33b9e4[_0x4b79('0x2e')]&&_0x33b9e4[_0x4b79('0x2e')][_0x4b79('0x44')]){_0x3be189['push'](createMessage(_0x1a2425,_0x3b5d5c,_0x7d48ba,_0x33b9e4[_0x4b79('0x2e')][_0x4b79('0x44')]));}}return Promise[_0x4b79('0x45')](_0x3be189)[_0x4b79('0x23')](function(){if(_0xc6e2b6){_0x3f5ca6[_0x4b79('0x14')]();}else{_0x3f5ca6[_0x4b79('0x25')]();}})[_0x4b79('0xc')](function(_0x271e92){logger[_0x4b79('0xd')](_0x4b79('0xe'),_0x1a2425,JSON[_0x4b79('0xf')](_0x271e92));_0x3f5ca6[_0x4b79('0x14')]();});}})[_0x4b79('0xc')](function(_0x4f3fa5){logger['error']('[%s][DIALOGFLOWV2]\x20%s',_0x1a2425,_0x4f3fa5[_0x4b79('0x2a')],_0x4f3fa5[_0x4b79('0x46')]);_0x3f5ca6['next']();});}}catch(_0x5e6546){logger[_0x4b79('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x1a2425,JSON['stringify'](_0x5e6546));_0x3f5ca6[_0x4b79('0x25')]();}};}; \ No newline at end of file +var _0xe7e7=['queryResult','diagnosticInfo','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','fields','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','isFallback','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','fulfillmentText','push','all','message','stack','dialogflow','moment','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','clone','body','create','then','[%s][DIALOGFLOWV2]\x20%s','catch','error','consequence','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','interaction','ChatWebsiteId','account','upperFirst','AccountId','created','getMustacheRender','stringify','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','detectIntent','length','dialogflowV2'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0xe7e7,0x12b));var _0x7e7e=function(_0x4fdd28,_0x267d54){_0x4fdd28=_0x4fdd28-0x0;var _0x40be31=_0xe7e7[_0x4fdd28];return _0x40be31;};'use strict';var _=require('lodash');var dialogflow=require(_0x7e7e('0x0'));var md5=require('md5');var moment=require(_0x7e7e('0x1'));var Promise=require(_0x7e7e('0x2'));var logger=require(_0x7e7e('0x3'))(_0x7e7e('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0x7e7e('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x7e7e('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x352e98,_0x5ab0e0,_0x560b48,_0x51c1b1){return new Promise(function(_0x48f91e,_0x2c6118){var _0x26ea2d=_[_0x7e7e('0x7')](_0x560b48);_0x26ea2d[_0x7e7e('0x8')]=_0x51c1b1;return rpc[_0x5ab0e0+'Message'][_0x7e7e('0x9')](_0x26ea2d)[_0x7e7e('0xa')](function(){logger['info'](_0x7e7e('0xb'),_0x352e98,_0x26ea2d[_0x7e7e('0x8')]);_0x48f91e();})[_0x7e7e('0xc')](function(_0x2b69c5){logger[_0x7e7e('0xd')](_0x7e7e('0xb'),_0x352e98,JSON['stringify'](_0x2b69c5));_0x2c6118(_0x2b69c5);});});}exports[_0x7e7e('0xe')]=function(_0x22502d,_0x2ebf8a){return function(_0x26a05d){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x7e7e('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x22502d,_0x7e7e('0x10'));return _0x26a05d[_0x7e7e('0x11')]();}var _0x41049c={'ContactId':this[_0x7e7e('0x12')]['id'],'sentAt':moment()[_0x7e7e('0x13')](_0x7e7e('0x14')),'direction':_0x7e7e('0x15')};if(this[_0x7e7e('0x16')]===_0x7e7e('0x17')||this[_0x7e7e('0x16')]===_0x7e7e('0x18')){_0x41049c['phone']=this[_0x7e7e('0x19')]['phone'];}var _0x227166=this[_0x7e7e('0x16')];if(_0x227166==='chat'){_0x41049c[_0x7e7e('0x1a')]=this[_0x7e7e('0x1b')]['id'];}else{_0x41049c[_[_0x7e7e('0x1c')](_0x227166)+_0x7e7e('0x1d')]=this[_0x7e7e('0x1b')]['id'];}_0x41049c[_[_0x7e7e('0x1c')](_0x227166)+'InteractionId']=this[_0x7e7e('0x19')]['id'];if(this[_0x7e7e('0x19')][_0x7e7e('0x1e')]){var _0x19a310=_0x2ebf8a[0x4];if(!_['isEmpty'](_0x19a310)){_0x41049c[_0x7e7e('0x8')]=utils[_0x7e7e('0x1f')](_0x19a310,this);return rpc[_0x227166+'Message'][_0x7e7e('0x9')](_0x41049c)[_0x7e7e('0xa')](function(_0x1dfe8d){logger[_0x7e7e('0xf')](_0x7e7e('0xb'),_0x22502d,_0x41049c[_0x7e7e('0x8')]);})[_0x7e7e('0xc')](function(_0x4048c2){logger[_0x7e7e('0xd')](_0x7e7e('0xb'),_0x22502d,JSON[_0x7e7e('0x20')](_0x4048c2));})['finally'](function(){logger[_0x7e7e('0xf')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x22502d);_0x26a05d[_0x7e7e('0x21')]();});}else{logger[_0x7e7e('0xf')](_0x7e7e('0x22'),_0x22502d);_0x26a05d[_0x7e7e('0x21')]();}}else{var _0x511ce2=this;var _0x21785b=_0x2ebf8a[0x2][_0x7e7e('0x23')](/\\n/g,'\x0a');var _0x389f8f={'credentials':{'private_key':_0x21785b,'client_email':_0x2ebf8a[0x1]}};var _0x542e3a=new dialogflow[(_0x7e7e('0x24'))](_0x389f8f);var _0x3b1653=_0x542e3a[_0x7e7e('0x25')](_0x2ebf8a[0x0],md5(_0x511ce2[_0x7e7e('0x19')]['id']));var _0x258a07={'session':_0x3b1653,'queryInput':{'text':{'text':_0x511ce2['message']['body'],'languageCode':_0x2ebf8a[0x3]||'en'}}};return _0x542e3a[_0x7e7e('0x26')](_0x258a07)[_0x7e7e('0xa')](function(_0x4bf7e5){if(_0x4bf7e5&&_0x4bf7e5[_0x7e7e('0x27')]){_0x511ce2['body'][_0x7e7e('0x28')]=_0x4bf7e5;var _0x1677b8=_0x4bf7e5[0x0];var _0x467443=_0x1677b8[_0x7e7e('0x29')]['diagnosticInfo']&&_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x2a')]['fields']?_0x1677b8[_0x7e7e('0x29')]['diagnosticInfo']['fields'][_0x7e7e('0x2b')][_0x7e7e('0x2c')]:![];_0x511ce2[_0x7e7e('0x8')][_0x7e7e('0x2d')]=_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x2e')];_0x511ce2['body'][_0x7e7e('0x2f')]=_0x1677b8['queryResult'][_0x7e7e('0x30')];_0x511ce2[_0x7e7e('0x8')][_0x7e7e('0x31')]=_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x2a')]&&_0x1677b8[_0x7e7e('0x29')]['diagnosticInfo'][_0x7e7e('0x32')]?_0x1677b8['queryResult'][_0x7e7e('0x2a')][_0x7e7e('0x32')]['end_conversation'][_0x7e7e('0x2c')]:![];_0x511ce2[_0x7e7e('0x8')][_0x7e7e('0x33')]=_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x34')][_0x7e7e('0x35')];_0x511ce2[_0x7e7e('0x8')][_0x7e7e('0x36')]=_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x34')][_0x7e7e('0x37')];_0x511ce2[_0x7e7e('0x8')]['DIALOGFLOWV2_ISFALLBACKINTENT']=_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x34')][_0x7e7e('0x38')];_0x511ce2[_0x7e7e('0x8')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1677b8[_0x7e7e('0x29')]['languageCode'];_0x511ce2[_0x7e7e('0x8')][_0x7e7e('0x39')]=_0x1677b8[_0x7e7e('0x29')][_0x7e7e('0x3a')];_0x511ce2[_0x7e7e('0x8')][_0x7e7e('0x3b')]=_0x1677b8['queryResult'][_0x7e7e('0x3c')];_0x41049c[_0x7e7e('0x3d')]=_0x7e7e('0x28');_0x41049c[_0x7e7e('0x3e')]=JSON[_0x7e7e('0x20')](_0x4bf7e5);var _0x3e5181=[];for(var _0x3454bf=0x0;_0x3454bf<_0x4bf7e5[_0x7e7e('0x27')];_0x3454bf++){var _0x39eb78=_0x4bf7e5[_0x3454bf];if(_0x39eb78&&_0x39eb78[_0x7e7e('0x29')]&&_0x39eb78['queryResult'][_0x7e7e('0x3f')]){_0x3e5181[_0x7e7e('0x40')](createMessage(_0x22502d,_0x227166,_0x41049c,_0x39eb78[_0x7e7e('0x29')][_0x7e7e('0x3f')]));}}return Promise[_0x7e7e('0x41')](_0x3e5181)[_0x7e7e('0xa')](function(){if(_0x467443){_0x26a05d[_0x7e7e('0x11')]();}else{_0x26a05d[_0x7e7e('0x21')]();}})[_0x7e7e('0xc')](function(_0x5a1283){logger[_0x7e7e('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x22502d,JSON[_0x7e7e('0x20')](_0x5a1283));_0x26a05d[_0x7e7e('0x11')]();});}})[_0x7e7e('0xc')](function(_0xd7ca18){logger[_0x7e7e('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x22502d,_0xd7ca18[_0x7e7e('0x42')],_0xd7ca18[_0x7e7e('0x43')]);_0x26a05d[_0x7e7e('0x11')]();});}}catch(_0x5f3490){logger[_0x7e7e('0xd')](_0x7e7e('0xb'),_0x22502d,JSON[_0x7e7e('0x20')](_0x5f3490));_0x26a05d[_0x7e7e('0x21')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotoif.js b/server/services/routing/server/applications/gotoif.js index 177473b..c721c0c 100644 --- a/server/services/routing/server/applications/gotoif.js +++ b/server/services/routing/server/applications/gotoif.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4054=['priority\x20true\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number'];(function(_0x251f29,_0x285d22){var _0x188739=function(_0x564e8d){while(--_0x564e8d){_0x251f29['push'](_0x251f29['shift']());}};_0x188739(++_0x285d22);}(_0x4054,0x165));var _0x4405=function(_0x56d22c,_0x34f096){_0x56d22c=_0x56d22c-0x0;var _0x32768c=_0x4054[_0x56d22c];return _0x32768c;};'use strict';var schema=require(_0x4405('0x0'));var _=require(_0x4405('0x1'));var htmlToText=require('html-to-text');var utils=require(_0x4405('0x2'));var logger=require(_0x4405('0x3'))(_0x4405('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x4405('0x5')},'priorityTrue':{'type':_0x4405('0x6'),'message':_0x4405('0x7')},'priorityFalse':{'type':_0x4405('0x6'),'message':'priority\x20false\x20is\x20a\x20number'}});exports['consequence']=function(_0x18cda3,_0x4c7687){return function(_0x5f548a){try{var _0x33bc82={'condition':htmlToText['fromString'](utils[_0x4405('0x8')](_0x4c7687[0x0],this),{'wordwrap':![]})[_0x4405('0x9')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x4c7687[0x1],'priorityFalse':_0x4c7687[0x2]};var _0x112af2=gotoif['validate'](_0x33bc82,{'typecast':!![]});if(_0x112af2[_0x4405('0xa')]){logger[_0x4405('0xb')](_0x4405('0xc'),_0x18cda3,_['map'](_0x112af2,'message')['join'](',\x20'));_0x5f548a[_0x4405('0xd')]();}else{try{var _0x28b59a=eval('('+_0x33bc82[_0x4405('0xe')]+')');var _0x4c47e3=_0x28b59a?_0x33bc82[_0x4405('0xf')]:_0x33bc82[_0x4405('0x10')];logger[_0x4405('0x11')](_0x4405('0x12'),_0x18cda3,_0x33bc82[_0x4405('0xe')],_0x28b59a,_0x4c47e3||_0x4405('0x13'));if(_0x4c47e3){var _0xf030c=_[_0x4405('0x14')](_0x5f548a['rules'](),{'p':_0x4c47e3});if(_0xf030c>=0x0){logger['info'](_0x4405('0x15'),_0x18cda3,_0x4c47e3||_0x4405('0x13'),_0xf030c);_0x5f548a[_0x4405('0x13')](_0xf030c);}else{logger[_0x4405('0x11')](_0x4405('0x16'),_0x18cda3,_0x4c47e3||_0x4405('0x13'));_0x5f548a['stop']();}}else{_0x5f548a[_0x4405('0x13')]();}}catch(_0x4e8578){logger[_0x4405('0xb')](_0x4405('0x17'),_0x18cda3,_0x4e8578[_0x4405('0x18')]);_0x5f548a['stop']();}}}catch(_0x5799a7){logger[_0x4405('0xb')](_0x4405('0xc'),_0x18cda3,JSON[_0x4405('0x19')](_0x5799a7));_0x5f548a[_0x4405('0xd')]();}};}; \ No newline at end of file +var _0x4a96=['number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','condition','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','info','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','../../../../config/logger','routing','string'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4a96,0x1ad));var _0x64a9=function(_0x1e01e5,_0x2e127f){_0x1e01e5=_0x1e01e5-0x0;var _0x1f505d=_0x4a96[_0x1e01e5];return _0x1f505d;};'use strict';var schema=require(_0x64a9('0x0'));var _=require('lodash');var htmlToText=require(_0x64a9('0x1'));var utils=require(_0x64a9('0x2'));var logger=require(_0x64a9('0x3'))(_0x64a9('0x4'));var gotoif=schema({'condition':{'type':_0x64a9('0x5'),'required':!![],'message':'condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'priorityTrue':{'type':_0x64a9('0x6'),'message':_0x64a9('0x7')},'priorityFalse':{'type':_0x64a9('0x6'),'message':_0x64a9('0x8')}});exports[_0x64a9('0x9')]=function(_0x5e8ed8,_0x560d5d){return function(_0x21954f){try{var _0x49132f={'condition':htmlToText['fromString'](utils[_0x64a9('0xa')](_0x560d5d[0x0],this),{'wordwrap':![]})[_0x64a9('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x560d5d[0x1],'priorityFalse':_0x560d5d[0x2]};var _0x406ce8=gotoif[_0x64a9('0x0')](_0x49132f,{'typecast':!![]});if(_0x406ce8[_0x64a9('0xc')]){logger[_0x64a9('0xd')](_0x64a9('0xe'),_0x5e8ed8,_[_0x64a9('0xf')](_0x406ce8,_0x64a9('0x10'))[_0x64a9('0x11')](',\x20'));_0x21954f[_0x64a9('0x12')]();}else{try{var _0x88263f=eval('('+_0x49132f[_0x64a9('0x13')]+')');var _0x474fab=_0x88263f?_0x49132f['priorityTrue']:_0x49132f[_0x64a9('0x14')];logger['info'](_0x64a9('0x15'),_0x5e8ed8,_0x49132f[_0x64a9('0x13')],_0x88263f,_0x474fab||_0x64a9('0x16'));if(_0x474fab){var _0x481ee2=_['findIndex'](_0x21954f[_0x64a9('0x17')](),{'p':_0x474fab});if(_0x481ee2>=0x0){logger['info'](_0x64a9('0x18'),_0x5e8ed8,_0x474fab||_0x64a9('0x16'),_0x481ee2);_0x21954f[_0x64a9('0x16')](_0x481ee2);}else{logger[_0x64a9('0x19')](_0x64a9('0x1a'),_0x5e8ed8,_0x474fab||_0x64a9('0x16'));_0x21954f['stop']();}}else{_0x21954f[_0x64a9('0x16')]();}}catch(_0x582c70){logger['error'](_0x64a9('0x1b'),_0x5e8ed8,_0x582c70[_0x64a9('0x10')]);_0x21954f['stop']();}}}catch(_0x26f2c5){logger[_0x64a9('0xd')]('[%s][GOTOIF]\x20%s',_0x5e8ed8,JSON[_0x64a9('0x1c')](_0x26f2c5));_0x21954f[_0x64a9('0x12')]();}};}; \ 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 7d936d5..01a5f47 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 _0xafe5=['message','join','stop','info','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','error','stringify','validate','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','[%s][GOTOP]\x20%s','map'];(function(_0x513046,_0x570f8c){var _0x436406=function(_0x1dfb8e){while(--_0x1dfb8e){_0x513046['push'](_0x513046['shift']());}};_0x436406(++_0x570f8c);}(_0xafe5,0xd4));var _0x5afe=function(_0x4bf926,_0x139ab8){_0x4bf926=_0x4bf926-0x0;var _0x4894b3=_0xafe5[_0x4bf926];return _0x4894b3;};'use strict';var schema=require(_0x5afe('0x0'));var _=require('lodash');var logger=require(_0x5afe('0x1'))(_0x5afe('0x2'));var gotop=schema({'priority':{'type':_0x5afe('0x3'),'required':!![],'message':_0x5afe('0x4')}});exports[_0x5afe('0x5')]=function(_0x2ae8fa,_0x463fa2){return function(_0x5d37b3){try{var _0x25e562={'priority':_0x463fa2[0x0]};var _0x17f0d6=gotop['validate'](_0x25e562,{'typecast':!![]});if(_0x17f0d6['length']){logger['error'](_0x5afe('0x6'),_0x2ae8fa,_[_0x5afe('0x7')](_0x17f0d6,_0x5afe('0x8'))[_0x5afe('0x9')](',\x20'));_0x5d37b3[_0x5afe('0xa')]();}else{logger[_0x5afe('0xb')]('[%s][GOTOP]\x20priority\x20%s',_0x2ae8fa,_0x25e562[_0x5afe('0xc')]);if(_0x25e562[_0x5afe('0xc')]){var _0x43a54e=_[_0x5afe('0xd')](_0x5d37b3[_0x5afe('0xe')](),{'p':_0x25e562['priority']});if(_0x43a54e>=0x0){logger[_0x5afe('0xb')](_0x5afe('0xf'),_0x2ae8fa,_0x25e562[_0x5afe('0xc')]||_0x5afe('0x10'),_0x43a54e);_0x5d37b3[_0x5afe('0x10')](_0x43a54e);}else{logger[_0x5afe('0xb')](_0x5afe('0x11'),_0x2ae8fa,_0x25e562[_0x5afe('0xc')]||'next');_0x5d37b3['stop']();}}else{_0x5d37b3['next']();}}}catch(_0x347850){logger[_0x5afe('0x12')](_0x5afe('0x6'),_0x2ae8fa,JSON[_0x5afe('0x13')](_0x347850));_0x5d37b3[_0x5afe('0xa')]();}};}; \ No newline at end of file +var _0xa03b=['[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','join','stop','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','info','next'];(function(_0x28ee57,_0x3fa4f9){var _0x2d04a3=function(_0x182ade){while(--_0x182ade){_0x28ee57['push'](_0x28ee57['shift']());}};_0x2d04a3(++_0x3fa4f9);}(_0xa03b,0x167));var _0xba03=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xa03b[_0x582274];return _0x8f14d3;};'use strict';var schema=require(_0xba03('0x0'));var _=require(_0xba03('0x1'));var logger=require('../../../../config/logger')(_0xba03('0x2'));var gotop=schema({'priority':{'type':_0xba03('0x3'),'required':!![],'message':_0xba03('0x4')}});exports[_0xba03('0x5')]=function(_0x22a46f,_0x56b85b){return function(_0x2143db){try{var _0x10239a={'priority':_0x56b85b[0x0]};var _0x22c077=gotop['validate'](_0x10239a,{'typecast':!![]});if(_0x22c077[_0xba03('0x6')]){logger[_0xba03('0x7')]('[%s][GOTOP]\x20%s',_0x22a46f,_['map'](_0x22c077,'message')[_0xba03('0x8')](',\x20'));_0x2143db[_0xba03('0x9')]();}else{logger['info'](_0xba03('0xa'),_0x22a46f,_0x10239a['priority']);if(_0x10239a[_0xba03('0xb')]){var _0x300a97=_[_0xba03('0xc')](_0x2143db['rules'](),{'p':_0x10239a[_0xba03('0xb')]});if(_0x300a97>=0x0){logger[_0xba03('0xd')]('[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x22a46f,_0x10239a[_0xba03('0xb')]||'next',_0x300a97);_0x2143db[_0xba03('0xe')](_0x300a97);}else{logger[_0xba03('0xd')](_0xba03('0xf'),_0x22a46f,_0x10239a[_0xba03('0xb')]||'next');_0x2143db[_0xba03('0x9')]();}}else{_0x2143db[_0xba03('0xe')]();}}}catch(_0x44606a){logger[_0xba03('0x7')]('[%s][GOTOP]\x20%s',_0x22a46f,JSON[_0xba03('0x10')](_0x44606a));_0x2143db[_0xba03('0x9')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index ee9ff4f..4582ec5 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 _0x152f=['lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','getMustacheRender','chat','ChatWebsiteId','upperFirst','channel','account','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','next','catch','error','stringify','stop'];(function(_0x3af62a,_0x3e13dd){var _0x1601df=function(_0x5addcd){while(--_0x5addcd){_0x3af62a['push'](_0x3af62a['shift']());}};_0x1601df(++_0x3e13dd);}(_0x152f,0x144));var _0xf152=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x152f[_0x1e7b16];return _0x37fadc;};'use strict';var _=require(_0xf152('0x0'));var utils=require(_0xf152('0x1'));var logger=require(_0xf152('0x2'))(_0xf152('0x3'));var rpc={'chatMessage':require(_0xf152('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xf152('0x5')),'smsMessage':require(_0xf152('0x6')),'faxMessage':require(_0xf152('0x7')),'whatsappMessage':require(_0xf152('0x8'))};exports['consequence']=function(_0x286a5f,_0x542973){return function(_0xa9deff){try{var _0x504fb6={'body':utils[_0xf152('0x9')](_0x542973[0x0],this),'ContactId':this['contact']['id']};if(this['channel']===_0xf152('0xa')){_0x504fb6[_0xf152('0xb')]=this['account']['id'];}else{_0x504fb6[_[_0xf152('0xc')](this[_0xf152('0xd')])+'AccountId']=this[_0xf152('0xe')]['id'];}_0x504fb6[_[_0xf152('0xc')](this[_0xf152('0xd')])+_0xf152('0xf')]=this[_0xf152('0x10')]['id'];if(rpc[this[_0xf152('0xd')]+_0xf152('0x11')]){return rpc[this[_0xf152('0xd')]+_0xf152('0x11')][_0xf152('0x12')](_0x504fb6)[_0xf152('0x13')](function(_0x445e61){logger[_0xf152('0x14')](_0xf152('0x15'),_0x286a5f,_0x504fb6['body']);_0xa9deff[_0xf152('0x16')]();})[_0xf152('0x17')](function(_0x4cf355){logger[_0xf152('0x18')](_0xf152('0x15'),_0x286a5f,JSON[_0xf152('0x19')](_0x4cf355));_0xa9deff['stop']();});}}catch(_0x3bf2ab){logger[_0xf152('0x18')]('[%s][MESSAGE]\x20%s',_0x286a5f,JSON[_0xf152('0x19')](_0x3bf2ab));_0xa9deff[_0xf152('0x1a')]();}};}; \ No newline at end of file +var _0x478a=['error','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','consequence','getMustacheRender','contact','channel','chat','upperFirst','AccountId','account','InteractionId','Message','create','info','[%s][MESSAGE]\x20%s','next','catch','stop'];(function(_0x1672f5,_0x2b5931){var _0x45866d=function(_0x26f1fd){while(--_0x26f1fd){_0x1672f5['push'](_0x1672f5['shift']());}};_0x45866d(++_0x2b5931);}(_0x478a,0x19f));var _0xa478=function(_0x4edde1,_0x111eeb){_0x4edde1=_0x4edde1-0x0;var _0x4cca18=_0x478a[_0x4edde1];return _0x4cca18;};'use strict';var _=require('lodash');var utils=require(_0xa478('0x0'));var logger=require(_0xa478('0x1'))(_0xa478('0x2'));var rpc={'chatMessage':require(_0xa478('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xa478('0x4')),'smsMessage':require(_0xa478('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xa478('0x6')]=function(_0x442ad5,_0xd36106){return function(_0x256bb7){try{var _0x145724={'body':utils[_0xa478('0x7')](_0xd36106[0x0],this),'ContactId':this[_0xa478('0x8')]['id']};if(this[_0xa478('0x9')]===_0xa478('0xa')){_0x145724['ChatWebsiteId']=this['account']['id'];}else{_0x145724[_[_0xa478('0xb')](this[_0xa478('0x9')])+_0xa478('0xc')]=this[_0xa478('0xd')]['id'];}_0x145724[_['upperFirst'](this[_0xa478('0x9')])+_0xa478('0xe')]=this['interaction']['id'];if(rpc[this[_0xa478('0x9')]+_0xa478('0xf')]){return rpc[this[_0xa478('0x9')]+_0xa478('0xf')][_0xa478('0x10')](_0x145724)['then'](function(_0x1ce012){logger[_0xa478('0x11')](_0xa478('0x12'),_0x442ad5,_0x145724['body']);_0x256bb7[_0xa478('0x13')]();})[_0xa478('0x14')](function(_0x3b8aeb){logger['error'](_0xa478('0x12'),_0x442ad5,JSON['stringify'](_0x3b8aeb));_0x256bb7[_0xa478('0x15')]();});}}catch(_0x5c6c12){logger[_0xa478('0x16')](_0xa478('0x12'),_0x442ad5,JSON['stringify'](_0x5c6c12));_0x256bb7[_0xa478('0x15')]();}};}; \ 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 19aee84..8915b7c 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 _0xe3a9=['next','error','stringify','stop','./utils','../../../../config/logger','consequence','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x3644b9,_0x5cd3a6){var _0x4d196d=function(_0x2bb4ef){while(--_0x2bb4ef){_0x3644b9['push'](_0x3644b9['shift']());}};_0x4d196d(++_0x5cd3a6);}(_0xe3a9,0xc2));var _0x9e3a=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0xe3a9[_0xa8883];return _0x479426;};'use strict';var utils=require(_0x9e3a('0x0'));var logger=require(_0x9e3a('0x1'))('routing');exports[_0x9e3a('0x2')]=function(_0x2b772f,_0x460e65){return function(_0x232b08){try{logger[_0x9e3a('0x3')](_0x9e3a('0x4'),_0x2b772f,utils[_0x9e3a('0x5')](_0x460e65[0x0],this));_0x232b08[_0x9e3a('0x6')]();}catch(_0x3f8530){logger[_0x9e3a('0x7')](_0x9e3a('0x4'),_0x2b772f,JSON[_0x9e3a('0x8')](_0x3f8530));_0x232b08[_0x9e3a('0x9')]();}};}; \ No newline at end of file +var _0xa76e=['consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','../../../../config/logger','routing'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0xa76e,0x13c));var _0xea76=function(_0x4d8a8f,_0x2afd4c){_0x4d8a8f=_0x4d8a8f-0x0;var _0xfc4adc=_0xa76e[_0x4d8a8f];return _0xfc4adc;};'use strict';var utils=require(_0xea76('0x0'));var logger=require(_0xea76('0x1'))(_0xea76('0x2'));exports[_0xea76('0x3')]=function(_0x26e9ea,_0xe5ea19){return function(_0x498571){try{logger[_0xea76('0x4')](_0xea76('0x5'),_0x26e9ea,utils[_0xea76('0x6')](_0xe5ea19[0x0],this));_0x498571[_0xea76('0x7')]();}catch(_0x399299){logger[_0xea76('0x8')](_0xea76('0x5'),_0x26e9ea,JSON[_0xea76('0x9')](_0x399299));_0x498571[_0xea76('0xa')]();}};}; \ 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 bc8fb9c..60ce8ac 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 _0x54d5=['../../rpc/whatsappInteraction','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create\x20queue\x20report','accepted','[%s][STOP:QUEUE][NAME:%s]','update','then','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','error','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','stop','Queues','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','rules','[%s][QUEUE]\x20APPLICATION\x20END','close','next','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','clone','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x54d5,0x1c9));var _0x554d=function(_0x240b3a,_0x1586aa){_0x240b3a=_0x240b3a-0x0;var _0x5a81ed=_0x54d5[_0x240b3a];return _0x5a81ed;};'use strict';var schema=require(_0x554d('0x0'));var _=require(_0x554d('0x1'));var util=require(_0x554d('0x2'));var seqqueue=require(_0x554d('0x3'));var moment=require(_0x554d('0x4'));var Redis=require(_0x554d('0x5'));var config=require(_0x554d('0x6'));var logger=require(_0x554d('0x7'))(_0x554d('0x8'));var strategy=require(_0x554d('0x9'));config[_0x554d('0xa')]=_[_0x554d('0xb')](config[_0x554d('0xa')],{'host':_0x554d('0xc'),'port':0x18eb});var io=require(_0x554d('0xd'))(new Redis(config[_0x554d('0xa')]));var attributes=['id',_0x554d('0xe'),_0x554d('0xf'),_0x554d('0x10'),_0x554d('0x11'),_0x554d('0x12')];function emit(_0x297ca0,_0x1a59b0,_0x2c4e2c){io['to'](_0x297ca0)[_0x554d('0x13')](_0x1a59b0,_0x2c4e2c);}function emitChannelQueueInteraction(_0x5e387a,_0x3912e6,_0x293ed4,_0x36dceb,_0x563535,_0x44f612,_0xd1822e,_0x5c1633){var _0x42214a=_[_0x554d('0x14')](_0x293ed4);_0x42214a['queue_id']=_0x5c1633;_0x42214a[_0x554d('0x10')]=_0x3912e6;_0x42214a[_0x554d('0xf')]=_0x36dceb;_0x42214a['id']=_0x563535;if(_0x44f612){attributes['push'](_['capitalize'](_0x5e387a)+_0x554d('0x15'));_0xd1822e[util[_0x554d('0x16')](_0x554d('0x17'),_0x5e387a)][_0x563535]=_[_0x554d('0x18')](_0x42214a,attributes);}else{delete _0xd1822e[util['format'](_0x554d('0x17'),_0x5e387a)][_0x563535];}emit(util[_0x554d('0x16')](_0x554d('0x19'),_0x5e387a,_0x3912e6),util[_0x554d('0x16')](_0x554d('0x1a'),_0x5e387a,_0x44f612?_0x554d('0x1b'):_0x554d('0x1c')),_[_0x554d('0x18')](_0x42214a,attributes));}var rpc={'openchannelQueueReport':require(_0x554d('0x1d')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x554d('0x1e')),'smsQueueReport':require(_0x554d('0x1f')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport'),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x554d('0x20')),'mailInteraction':require(_0x554d('0x21')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x554d('0x22')),'whatsappInteraction':require(_0x554d('0x23'))};var queue=schema({'name':{'type':'string','required':!![],'message':_0x554d('0x24')},'timeout':{'type':_0x554d('0x25'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x207178,_0x18aaa3,_0x306851,_0x43bd4e){if(_0x207178&&_0x18aaa3&&_0x306851){_0x18aaa3[_0x554d('0x26')]+=0x1;var _0x3195d0={'uniqueid':_0x207178,'from':_0x306851[_0x554d('0x27')]?_0x306851[_0x554d('0x27')][_0x554d('0x11')]:'','joinAt':moment()[_0x554d('0x16')](_0x554d('0x28')),'ContactId':_0x306851[_0x554d('0x29')]?_0x306851[_0x554d('0x29')]['id']:null,'ListId':_0x306851[_0x554d('0x2a')]?_0x306851['list']['id']:null};_0x3195d0[_['upperFirst'](_0x306851[_0x554d('0x2b')])+_0x554d('0x2c')]=_0x18aaa3['id']||null;_0x3195d0[_[_0x554d('0x2d')](_0x306851['channel'])+_0x554d('0x15')]=_0x306851[_0x554d('0x2e')]?_0x306851[_0x554d('0x2e')]['id']:null;_0x3195d0[_['upperFirst'](_0x306851[_0x554d('0x2b')])+_0x554d('0x2f')]=_0x306851[_0x554d('0x30')]?_0x306851[_0x554d('0x30')]['id']:null;_0x3195d0[_[_0x554d('0x2d')](_0x306851[_0x554d('0x2b')])+(_0x306851[_0x554d('0x2b')]!==_0x554d('0x31')?_0x554d('0x32'):'WebsiteId')]=_0x306851[_0x554d('0xf')]?_0x306851['account']['id']:null;logger[_0x554d('0x33')](util[_0x554d('0x16')](_0x554d('0x34'),_0x207178,_0x18aaa3[_0x554d('0x35')]));emitChannelQueueInteraction(_0x306851[_0x554d('0x2b')],_0x18aaa3[_0x554d('0x35')],_0x3195d0,_0x306851[_0x554d('0xf')][_0x554d('0x35')],_0x306851[_0x554d('0x30')]['id'],!![],_0x43bd4e,_0x18aaa3['id']);if(rpc[_0x306851[_0x554d('0x2b')]+_0x554d('0x36')]){return rpc[_0x306851['channel']+_0x554d('0x36')]['create'](_0x3195d0)['catch'](function(_0x5cb28d){logger['error'](_0x554d('0x37'),_0x5cb28d);});}}}function stopRouting(_0x523b8d,_0x150ff8,_0x1d0468,_0x107a24){if(_0x523b8d&&_0x150ff8){_0x150ff8[_0x554d('0x26')]-=0x1;var _0x389510={'leaveAt':moment()[_0x554d('0x16')](_0x554d('0x28')),'acceptAt':moment()['format'](_0x554d('0x28')),'reason':_0x554d('0x38')};logger[_0x554d('0x33')](util[_0x554d('0x16')](_0x554d('0x39'),_0x523b8d,_0x150ff8[_0x554d('0x35')]));emitChannelQueueInteraction(_0x1d0468['channel'],_0x150ff8[_0x554d('0x35')],_0x1d0468[_0x554d('0x27')],_0x1d0468[_0x554d('0xf')][_0x554d('0x35')],_0x1d0468[_0x554d('0x30')]['id'],![],_0x107a24,_0x150ff8['id']);return rpc[_0x1d0468[_0x554d('0x2b')]+'Interaction'][_0x554d('0x3a')](_0x1d0468[_0x554d('0x2e')]['id'],{'queueId':_0x150ff8['id']})[_0x554d('0x3b')](function(){if(rpc[_0x1d0468[_0x554d('0x2b')]+_0x554d('0x36')]){return rpc[_0x1d0468[_0x554d('0x2b')]+'QueueReport']['update'](_0x523b8d,_0x389510)[_0x554d('0x3c')](function(_0xc12129){logger['error'](_0x554d('0x3d'),_0xc12129);});}});}}function endRouting(_0x1869c1,_0x5ecd67,_0x438ce2,_0x350dd3){if(_0x1869c1&&_0x5ecd67){_0x5ecd67[_0x554d('0x26')]-=0x1;var _0x5bde4c={'leaveAt':moment()['format'](_0x554d('0x28')),'exitAt':moment()[_0x554d('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x554d('0x3e')};logger[_0x554d('0x33')](util[_0x554d('0x16')](_0x554d('0x3f'),_0x1869c1,_0x5ecd67['name']));emitChannelQueueInteraction(_0x438ce2[_0x554d('0x2b')],_0x5ecd67[_0x554d('0x35')],_0x438ce2[_0x554d('0x27')],_0x438ce2[_0x554d('0xf')][_0x554d('0x35')],_0x438ce2[_0x554d('0x30')]['id'],![],_0x350dd3);if(rpc[_0x438ce2[_0x554d('0x2b')]+_0x554d('0x36')]){return rpc[_0x438ce2['channel']+_0x554d('0x36')]['update'](_0x1869c1,_0x5bde4c)[_0x554d('0x3c')](function(_0x2e5f6e){logger[_0x554d('0x40')](_0x554d('0x3d'),_0x2e5f6e);});}}}function handleFindQueue(_0x4cbe01){return function(_0xf6d48d){return _0xf6d48d[_0x554d('0x35')][_0x554d('0x41')]()===_0x4cbe01[_0x554d('0x41')]();};}exports[_0x554d('0x42')]=function(_0x3394dc,_0x2543e7,_0x55af74,_0x528795){return function(_0x2da5db){try{var _0x39e34e={'name':_0x2543e7[0x0],'timeout':_0x2543e7[0x1]};var _0x41db09=queue[_0x554d('0x0')](_0x39e34e,{'typecast':!![]});if(_0x41db09[_0x554d('0x43')]){logger[_0x554d('0x40')](_0x554d('0x44'),_0x3394dc,_['map'](_0x41db09,_0x554d('0x30'))['join'](',\x20'));_0x2da5db[_0x554d('0x45')]();}else{var _0x18f135=_['find'](_0x55af74[_0x528795[_0x554d('0x2b')]+_0x554d('0x46')],handleFindQueue(_0x39e34e[_0x554d('0x35')]));if(_0x18f135){startRouting(_0x3394dc,_0x18f135,_0x528795,_0x55af74);var _0x402797=(_0x18f135[_0x554d('0x3e')]||0xa)*0x3e8;var _0x36d89f=(_0x39e34e[_0x554d('0x3e')]||0x14)*0x3e8;var _0x2b2c91;if(_0x402797>_0x36d89f){_0x36d89f=_0x402797;}var _0x21eec6=seqqueue['createQueue'](_0x402797);_0x21eec6['id']=_0x3394dc;_0x21eec6['atimeout']=_0x402797;_0x21eec6[_0x554d('0x47')]=_0x36d89f;_0x21eec6['channel']=_0x528795[_0x554d('0x2b')];_0x55af74['rules'][_0x3394dc]['on'](_0x554d('0x48'),function(){logger[_0x554d('0x33')](_0x554d('0x49'),_0x3394dc);stopRouting(_0x3394dc,_0x18f135,_0x528795,_0x55af74);clearTimeout(_0x2b2c91);_0x2b2c91=undefined;_0x21eec6['close'](!![]);if(_0x55af74[_0x554d('0x4a')][_0x3394dc]){delete _0x55af74['rules'][_0x3394dc];}_0x2da5db[_0x554d('0x45')]();});_0x55af74[_0x554d('0x4a')][_0x3394dc]['on']('complete',function(){if(_0x55af74[_0x554d('0x4a')][_0x3394dc]){delete _0x55af74[_0x554d('0x4a')][_0x3394dc];}});_0x2b2c91=setTimeout(function(){logger[_0x554d('0x33')](_0x554d('0x4b'),_0x3394dc);endRouting(_0x3394dc,_0x18f135,_0x528795,_0x55af74);clearTimeout(_0x2b2c91);_0x21eec6[_0x554d('0x4c')](!![]);_0x2da5db[_0x554d('0x4d')]();},_0x36d89f);switch(_0x18f135['strategy']){case _0x554d('0x4e'):strategy['rrmemory'](_0x21eec6,_0x18f135,_0x55af74,_0x528795);break;default:strategy[_0x554d('0x4f')](_0x21eec6,_0x18f135,_0x55af74,_0x528795);}}else{logger['error'](_0x554d('0x50'),_0x3394dc,_0x39e34e[_0x554d('0x35')]);_0x2da5db[_0x554d('0x45')]();}}}catch(_0x1fb624){logger[_0x554d('0x40')]('[%s][QUEUE]\x20%s',_0x3394dc,_0x1fb624[_0x554d('0x51')]);_0x2da5db[_0x554d('0x45')]();}};}; \ No newline at end of file +var _0x7023=['from','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','update\x20queue\x20report','timeout','info','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','join','find','Queues','createQueue','qtimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','close','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','stack','stop','validate','lodash','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','socket.io-emitter','queue_id','account','queue','joinAt','emit','pick','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','timeout\x20is\x20a\x20number','waiting','body'];(function(_0x1b2722,_0x4d6069){var _0x37f833=function(_0x554b0a){while(--_0x554b0a){_0x1b2722['push'](_0x1b2722['shift']());}};_0x37f833(++_0x4d6069);}(_0x7023,0x167));var _0x3702=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x7023[_0x3bf83f];return _0x22c4a9;};'use strict';var schema=require(_0x3702('0x0'));var _=require(_0x3702('0x1'));var util=require('util');var seqqueue=require('seq-queue');var moment=require(_0x3702('0x2'));var Redis=require(_0x3702('0x3'));var config=require(_0x3702('0x4'));var logger=require(_0x3702('0x5'))(_0x3702('0x6'));var strategy=require(_0x3702('0x7'));config[_0x3702('0x8')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x3702('0x9'))(new Redis(config['redis']));var attributes=['id',_0x3702('0xa'),_0x3702('0xb'),_0x3702('0xc'),'from',_0x3702('0xd')];function emit(_0x1d51f6,_0x1a8120,_0x4212ae){io['to'](_0x1d51f6)[_0x3702('0xe')](_0x1a8120,_0x4212ae);}function emitChannelQueueInteraction(_0x3c4967,_0x2c8846,_0x42ec6f,_0x42ac20,_0x5dc083,_0x161e38,_0x390f15,_0x5c0a13){var _0x3d3f37=_['clone'](_0x42ec6f);_0x3d3f37[_0x3702('0xa')]=_0x5c0a13;_0x3d3f37[_0x3702('0xc')]=_0x2c8846;_0x3d3f37[_0x3702('0xb')]=_0x42ac20;_0x3d3f37['id']=_0x5dc083;if(_0x161e38){attributes['push'](_['capitalize'](_0x3c4967)+'InteractionId');_0x390f15[util['format']('%sQueuesWaitingInteractions',_0x3c4967)][_0x5dc083]=_[_0x3702('0xf')](_0x3d3f37,attributes);}else{delete _0x390f15[util[_0x3702('0x10')](_0x3702('0x11'),_0x3c4967)][_0x5dc083];}emit(util[_0x3702('0x10')](_0x3702('0x12'),_0x3c4967,_0x2c8846),util[_0x3702('0x10')](_0x3702('0x13'),_0x3c4967,_0x161e38?'save':_0x3702('0x14')),_['pick'](_0x3d3f37,attributes));}var rpc={'openchannelQueueReport':require(_0x3702('0x15')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x3702('0x16')),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require(_0x3702('0x17')),'whatsappQueueReport':require(_0x3702('0x18')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require('../../rpc/mailInteraction'),'openchannelInteraction':require(_0x3702('0x19')),'smsInteraction':require(_0x3702('0x1a')),'whatsappInteraction':require(_0x3702('0x1b'))};var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0x3702('0x1c')}});function startRouting(_0x7da465,_0x183088,_0x309d8c,_0xbde3cb){if(_0x7da465&&_0x183088&&_0x309d8c){_0x183088[_0x3702('0x1d')]+=0x1;var _0x1161c4={'uniqueid':_0x7da465,'from':_0x309d8c['body']?_0x309d8c[_0x3702('0x1e')][_0x3702('0x1f')]:'','joinAt':moment()[_0x3702('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x309d8c[_0x3702('0x20')]?_0x309d8c[_0x3702('0x20')]['id']:null,'ListId':_0x309d8c[_0x3702('0x21')]?_0x309d8c[_0x3702('0x21')]['id']:null};_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+_0x3702('0x24')]=_0x183088['id']||null;_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+_0x3702('0x25')]=_0x309d8c[_0x3702('0x26')]?_0x309d8c[_0x3702('0x26')]['id']:null;_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+_0x3702('0x27')]=_0x309d8c['message']?_0x309d8c[_0x3702('0x28')]['id']:null;_0x1161c4[_[_0x3702('0x22')](_0x309d8c[_0x3702('0x23')])+(_0x309d8c['channel']!==_0x3702('0x29')?'AccountId':_0x3702('0x2a'))]=_0x309d8c[_0x3702('0xb')]?_0x309d8c[_0x3702('0xb')]['id']:null;logger['info'](util[_0x3702('0x10')](_0x3702('0x2b'),_0x7da465,_0x183088[_0x3702('0x2c')]));emitChannelQueueInteraction(_0x309d8c[_0x3702('0x23')],_0x183088[_0x3702('0x2c')],_0x1161c4,_0x309d8c[_0x3702('0xb')][_0x3702('0x2c')],_0x309d8c[_0x3702('0x28')]['id'],!![],_0xbde3cb,_0x183088['id']);if(rpc[_0x309d8c['channel']+_0x3702('0x2d')]){return rpc[_0x309d8c[_0x3702('0x23')]+_0x3702('0x2d')][_0x3702('0x2e')](_0x1161c4)[_0x3702('0x2f')](function(_0x60d07f){logger[_0x3702('0x30')](_0x3702('0x31'),_0x60d07f);});}}}function stopRouting(_0x14a68e,_0x142fa1,_0x53711a,_0x3fe3a2){if(_0x14a68e&&_0x142fa1){_0x142fa1['waiting']-=0x1;var _0xbe0a0f={'leaveAt':moment()[_0x3702('0x10')](_0x3702('0x32')),'acceptAt':moment()[_0x3702('0x10')](_0x3702('0x32')),'reason':'accepted'};logger['info'](util['format'](_0x3702('0x33'),_0x14a68e,_0x142fa1['name']));emitChannelQueueInteraction(_0x53711a[_0x3702('0x23')],_0x142fa1[_0x3702('0x2c')],_0x53711a['body'],_0x53711a['account'][_0x3702('0x2c')],_0x53711a[_0x3702('0x28')]['id'],![],_0x3fe3a2,_0x142fa1['id']);return rpc[_0x53711a[_0x3702('0x23')]+_0x3702('0x34')][_0x3702('0x35')](_0x53711a['interaction']['id'],{'queueId':_0x142fa1['id']})[_0x3702('0x36')](function(){if(rpc[_0x53711a[_0x3702('0x23')]+'QueueReport']){return rpc[_0x53711a['channel']+_0x3702('0x2d')][_0x3702('0x35')](_0x14a68e,_0xbe0a0f)[_0x3702('0x2f')](function(_0x10127c){logger[_0x3702('0x30')](_0x3702('0x37'),_0x10127c);});}});}}function endRouting(_0x5aed7f,_0x338072,_0x2bb23a,_0x79c782){if(_0x5aed7f&&_0x338072){_0x338072['waiting']-=0x1;var _0x146252={'leaveAt':moment()['format'](_0x3702('0x32')),'exitAt':moment()['format'](_0x3702('0x32')),'reason':_0x3702('0x38')};logger[_0x3702('0x39')](util['format'](_0x3702('0x3a'),_0x5aed7f,_0x338072[_0x3702('0x2c')]));emitChannelQueueInteraction(_0x2bb23a['channel'],_0x338072[_0x3702('0x2c')],_0x2bb23a['body'],_0x2bb23a[_0x3702('0xb')][_0x3702('0x2c')],_0x2bb23a[_0x3702('0x28')]['id'],![],_0x79c782);if(rpc[_0x2bb23a[_0x3702('0x23')]+_0x3702('0x2d')]){return rpc[_0x2bb23a[_0x3702('0x23')]+'QueueReport'][_0x3702('0x35')](_0x5aed7f,_0x146252)[_0x3702('0x2f')](function(_0x28a18a){logger[_0x3702('0x30')](_0x3702('0x37'),_0x28a18a);});}}}function handleFindQueue(_0x1c7b94){return function(_0x421c6f){return _0x421c6f[_0x3702('0x2c')][_0x3702('0x3b')]()===_0x1c7b94[_0x3702('0x3b')]();};}exports[_0x3702('0x3c')]=function(_0x4a161b,_0x2731bb,_0x38d59f,_0x4b9aeb){return function(_0xe322d0){try{var _0x620edf={'name':_0x2731bb[0x0],'timeout':_0x2731bb[0x1]};var _0x59f8b4=queue[_0x3702('0x0')](_0x620edf,{'typecast':!![]});if(_0x59f8b4['length']){logger[_0x3702('0x30')](_0x3702('0x3d'),_0x4a161b,_['map'](_0x59f8b4,'message')[_0x3702('0x3e')](',\x20'));_0xe322d0['stop']();}else{var _0x4f8442=_[_0x3702('0x3f')](_0x38d59f[_0x4b9aeb['channel']+_0x3702('0x40')],handleFindQueue(_0x620edf[_0x3702('0x2c')]));if(_0x4f8442){startRouting(_0x4a161b,_0x4f8442,_0x4b9aeb,_0x38d59f);var _0x496eb1=(_0x4f8442['timeout']||0xa)*0x3e8;var _0x402c78=(_0x620edf['timeout']||0x14)*0x3e8;var _0x4ee181;if(_0x496eb1>_0x402c78){_0x402c78=_0x496eb1;}var _0xcaa651=seqqueue[_0x3702('0x41')](_0x496eb1);_0xcaa651['id']=_0x4a161b;_0xcaa651['atimeout']=_0x496eb1;_0xcaa651[_0x3702('0x42')]=_0x402c78;_0xcaa651[_0x3702('0x23')]=_0x4b9aeb[_0x3702('0x23')];_0x38d59f[_0x3702('0x43')][_0x4a161b]['on']('end',function(){logger[_0x3702('0x39')](_0x3702('0x44'),_0x4a161b);stopRouting(_0x4a161b,_0x4f8442,_0x4b9aeb,_0x38d59f);clearTimeout(_0x4ee181);_0x4ee181=undefined;_0xcaa651['close'](!![]);if(_0x38d59f['rules'][_0x4a161b]){delete _0x38d59f[_0x3702('0x43')][_0x4a161b];}_0xe322d0['stop']();});_0x38d59f[_0x3702('0x43')][_0x4a161b]['on'](_0x3702('0x45'),function(){if(_0x38d59f[_0x3702('0x43')][_0x4a161b]){delete _0x38d59f[_0x3702('0x43')][_0x4a161b];}});_0x4ee181=setTimeout(function(){logger[_0x3702('0x39')](_0x3702('0x46'),_0x4a161b);endRouting(_0x4a161b,_0x4f8442,_0x4b9aeb,_0x38d59f);clearTimeout(_0x4ee181);_0xcaa651[_0x3702('0x47')](!![]);_0xe322d0[_0x3702('0x48')]();},_0x402c78);switch(_0x4f8442[_0x3702('0x49')]){case _0x3702('0x4a'):strategy[_0x3702('0x4a')](_0xcaa651,_0x4f8442,_0x38d59f,_0x4b9aeb);break;default:strategy['beepall'](_0xcaa651,_0x4f8442,_0x38d59f,_0x4b9aeb);}}else{logger[_0x3702('0x30')](_0x3702('0x4b'),_0x4a161b,_0x620edf[_0x3702('0x2c')]);_0xe322d0['stop']();}}}catch(_0x2fe946){logger[_0x3702('0x30')](_0x3702('0x3d'),_0x4a161b,_0x2fe946[_0x3702('0x4c')]);_0xe322d0[_0x3702('0x4d')]();}};}; \ 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 0d5f493..fab2900 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 _0x7217=['[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','exports','lodash','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','[%s][AGENT]\x20try\x20with\x20%s','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','writeLog','RINGING'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x7217,0x19e));var _0x7721=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7217[_0x3b5250];return _0xc844a1;};'use strict';var _=require(_0x7721('0x0'));var uuid=require('uuid');var util=require(_0x7721('0x1'));var logger=require(_0x7721('0x2'))(_0x7721('0x3'));var Agent=function(_0x2a78d8,_0x115ab3,_0x4d6446,_0x5bf160){this[_0x7721('0x4')]=uuid['v4']();this[_0x7721('0x5')]=_0x2a78d8;this[_0x7721('0x6')]=_0x115ab3;this[_0x7721('0x7')]=_0x4d6446;this[_0x7721('0x3')]=_0x5bf160;this[_0x7721('0x5')][_0x7721('0x8')](this[_0x7721('0x9')][_0x7721('0xa')](this),this[_0x7721('0xb')][_0x7721('0xa')](this));this[_0x7721('0x5')]['on'](_0x7721('0xc'),this[_0x7721('0xb')][_0x7721('0xa')](this));this['squeue']['on'](_0x7721('0xd'),this[_0x7721('0xe')][_0x7721('0xa')](this));};Agent[_0x7721('0xf')][_0x7721('0x8')]=function(){this[_0x7721('0x5')][_0x7721('0x8')](this[_0x7721('0x9')]['bind'](this),this[_0x7721('0xb')][_0x7721('0xa')](this));};Agent['prototype'][_0x7721('0xe')]=function(){this[_0x7721('0xb')](!![]);};Agent[_0x7721('0xf')][_0x7721('0x9')]=function(){logger['debug'](_0x7721('0x10'),this[_0x7721('0x5')]['id'],this['agent']['id']);if(_['isNil'](this['realtime'][_0x7721('0x11')][this[_0x7721('0x6')]['id']])){logger[_0x7721('0x12')](_0x7721('0x13'),this['squeue']['id'],this[_0x7721('0x6')]['id']);setTimeout(this['push'][_0x7721('0xa')](this),0x3e8);}else{if(this['routing'][_0x7721('0x14')]||util[_0x7721('0x15')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],this[_0x7721('0x5')][_0x7721('0x16')],![])){this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']][_0x7721('0x17')]=!![];this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']]['busyQueue']=undefined;util[_0x7721('0x18')](this['realtime'],this[_0x7721('0x3')],this[_0x7721('0x6')],this[_0x7721('0x5')][_0x7721('0x16')]);util[_0x7721('0x19')](this[_0x7721('0x4')],this[_0x7721('0x5')]['id'],this['realtime'][_0x7721('0x11')][this[_0x7721('0x6')]['id']],null,this[_0x7721('0x3')]);util[_0x7721('0x1a')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],_0x7721('0x1b')+(this['routing'][_0x7721('0x14')]?':FORCED':''));}else{logger['debug'](_0x7721('0x1c'),this[_0x7721('0x5')]['id'],this[_0x7721('0x6')]['id']);setTimeout(this[_0x7721('0x8')][_0x7721('0xa')](this),0x3e8);}}};Agent[_0x7721('0xf')][_0x7721('0xb')]=function(_0x1da2d8){if(_['isNil'](this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']])){return logger['debug'](_0x7721('0x13'),this[_0x7721('0x5')]['id'],this['agent']['id']);}else{logger[_0x7721('0x12')](_0x7721('0x1d'),this[_0x7721('0x5')]['id'],this['agent']['id']);util[_0x7721('0x1e')](this[_0x7721('0x4')],this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']],null,this[_0x7721('0x3')]);this[_0x7721('0x7')][_0x7721('0x11')][this['agent']['id']][_0x7721('0x17')]=![];this[_0x7721('0x7')]['agents'][this[_0x7721('0x6')]['id']]['busyQueue']=undefined;util[_0x7721('0x1f')](this[_0x7721('0x7')],this[_0x7721('0x3')],this[_0x7721('0x6')],this[_0x7721('0x5')][_0x7721('0x16')]);util[_0x7721('0x1a')](this[_0x7721('0x5')]['id'],this[_0x7721('0x7')][_0x7721('0x11')][this[_0x7721('0x6')]['id']],_0x1da2d8?'STOP':_0x7721('0x20'));}if(!_0x1da2d8){setTimeout(this['push'][_0x7721('0xa')](this),0x3e8);}};function agent(_0x35614c,_0x7942f7,_0x1d03de,_0x3968f3){return new Agent(_0x35614c,_0x7942f7,_0x1d03de,_0x3968f3);}module[_0x7721('0x21')]=agent; \ No newline at end of file +var _0xcb99=['busy','busyQueue','saveWaitingNotification','routing','writeLog','RINGING','forcedOwnership','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','lodash','./util','notificationId','squeue','realtime','push','handleRun','bind','handleTimeout','timeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','agent','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel'];(function(_0x4bf4a1,_0xaf7845){var _0x588de8=function(_0x12e036){while(--_0x12e036){_0x4bf4a1['push'](_0x4bf4a1['shift']());}};_0x588de8(++_0xaf7845);}(_0xcb99,0x8b));var _0x9cb9=function(_0x96691d,_0x544a9d){_0x96691d=_0x96691d-0x0;var _0x5a79ca=_0xcb99[_0x96691d];return _0x5a79ca;};'use strict';var _=require(_0x9cb9('0x0'));var uuid=require('uuid');var util=require(_0x9cb9('0x1'));var logger=require('../../../../../config/logger')('routing');var Agent=function(_0x3a2f21,_0x1308a8,_0x124c48,_0x51f2ee){this[_0x9cb9('0x2')]=uuid['v4']();this[_0x9cb9('0x3')]=_0x3a2f21;this['agent']=_0x1308a8;this[_0x9cb9('0x4')]=_0x124c48;this['routing']=_0x51f2ee;this[_0x9cb9('0x3')][_0x9cb9('0x5')](this[_0x9cb9('0x6')][_0x9cb9('0x7')](this),this[_0x9cb9('0x8')][_0x9cb9('0x7')](this));this[_0x9cb9('0x3')]['on'](_0x9cb9('0x9'),this['handleTimeout']['bind'](this));this[_0x9cb9('0x3')]['on'](_0x9cb9('0xa'),this[_0x9cb9('0xb')]['bind'](this));};Agent[_0x9cb9('0xc')][_0x9cb9('0x5')]=function(){this['squeue']['push'](this[_0x9cb9('0x6')][_0x9cb9('0x7')](this),this[_0x9cb9('0x8')][_0x9cb9('0x7')](this));};Agent['prototype'][_0x9cb9('0xb')]=function(){this[_0x9cb9('0x8')](!![]);};Agent[_0x9cb9('0xc')][_0x9cb9('0x6')]=function(){logger[_0x9cb9('0xd')](_0x9cb9('0xe'),this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);if(_[_0x9cb9('0x10')](this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']])){logger[_0x9cb9('0xd')](_0x9cb9('0x12'),this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);setTimeout(this[_0x9cb9('0x5')][_0x9cb9('0x7')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x9cb9('0x13')](this['squeue']['id'],this['realtime']['agents'][this[_0x9cb9('0xf')]['id']],this['squeue'][_0x9cb9('0x14')],![])){this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x15')]=!![];this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x16')]=undefined;util[_0x9cb9('0x17')](this[_0x9cb9('0x4')],this[_0x9cb9('0x18')],this[_0x9cb9('0xf')],this[_0x9cb9('0x3')]['channel']);util['showNotification'](this[_0x9cb9('0x2')],this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0x4')][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']],null,this[_0x9cb9('0x18')]);util[_0x9cb9('0x19')](this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0x4')]['agents'][this[_0x9cb9('0xf')]['id']],_0x9cb9('0x1a')+(this[_0x9cb9('0x18')][_0x9cb9('0x1b')]?':FORCED':''));}else{logger[_0x9cb9('0xd')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);setTimeout(this[_0x9cb9('0x5')][_0x9cb9('0x7')](this),0x3e8);}}};Agent['prototype'][_0x9cb9('0x8')]=function(_0x3b7bba){if(_[_0x9cb9('0x10')](this['realtime'][_0x9cb9('0x11')][this['agent']['id']])){return logger[_0x9cb9('0xd')](_0x9cb9('0x12'),this[_0x9cb9('0x3')]['id'],this[_0x9cb9('0xf')]['id']);}else{logger[_0x9cb9('0xd')](_0x9cb9('0x1c'),this['squeue']['id'],this[_0x9cb9('0xf')]['id']);util[_0x9cb9('0x1d')](this[_0x9cb9('0x2')],this['squeue']['id'],this['realtime'][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']],null,this[_0x9cb9('0x18')]);this['realtime']['agents'][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x15')]=![];this['realtime'][_0x9cb9('0x11')][this[_0x9cb9('0xf')]['id']][_0x9cb9('0x16')]=undefined;util[_0x9cb9('0x1e')](this[_0x9cb9('0x4')],this['routing'],this[_0x9cb9('0xf')],this[_0x9cb9('0x3')]['channel']);util[_0x9cb9('0x19')](this['squeue']['id'],this[_0x9cb9('0x4')][_0x9cb9('0x11')][this['agent']['id']],_0x3b7bba?'STOP':_0x9cb9('0x1f'));}if(!_0x3b7bba){setTimeout(this[_0x9cb9('0x5')][_0x9cb9('0x7')](this),0x3e8);}};function agent(_0x2595f9,_0x448e2c,_0x2dd463,_0x10a355){return new Agent(_0x2595f9,_0x448e2c,_0x2dd463,_0x10a355);}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 fd621ef..ef48d51 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 _0x0757=['../../../../../config/logger','routing','squeue','queue','realtime','bind','handleTimeout','timeout','drained','handleDrained','push','handleRun','prototype','isNil','Agents','length','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','busy','busyQueue','name','debug','[%s][QUEUE]\x20EMPTY','hideNotification','notificationId','STOP','TIMEOUT','removeWaitingNotification','exports','./util'];(function(_0x3e8527,_0x390be2){var _0x1a43da=function(_0x3975c9){while(--_0x3975c9){_0x3e8527['push'](_0x3e8527['shift']());}};_0x1a43da(++_0x390be2);}(_0x0757,0xa4));var _0x7075=function(_0x9e3104,_0x219728){_0x9e3104=_0x9e3104-0x0;var _0x3abd65=_0x0757[_0x9e3104];return _0x3abd65;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x7075('0x0'));var logger=require(_0x7075('0x1'))(_0x7075('0x2'));var Beepall=function(_0x143df2,_0x1185b3,_0x5780cb,_0x41be38){this['notificationId']=uuid['v4']();this[_0x7075('0x3')]=_0x143df2;this[_0x7075('0x4')]=_0x1185b3;this[_0x7075('0x5')]=_0x5780cb;this[_0x7075('0x2')]=_0x41be38;this['squeue']['push'](this['handleRun'][_0x7075('0x6')](this),this[_0x7075('0x7')][_0x7075('0x6')](this));this['squeue']['on'](_0x7075('0x8'),this['handleTimeout'][_0x7075('0x6')](this));this['squeue']['on'](_0x7075('0x9'),this[_0x7075('0xa')][_0x7075('0x6')](this));};Beepall['prototype'][_0x7075('0xb')]=function(){this[_0x7075('0x3')][_0x7075('0xb')](this[_0x7075('0xc')]['bind'](this),this[_0x7075('0x7')]['bind'](this));};Beepall[_0x7075('0xd')]['handleDrained']=function(){this['handleTimeout'](!![]);};Beepall[_0x7075('0xd')][_0x7075('0xc')]=function(){var _0x33be8b=!![];if(!_[_0x7075('0xe')](this[_0x7075('0x4')])&&!_[_0x7075('0xe')](this[_0x7075('0x4')]['Agents'])&&this[_0x7075('0x4')][_0x7075('0xf')]['length']>0x0){for(var _0xe27b64=0x0,_0xe24b93;_0xe27b640x0){for(var _0x510183=0x0,_0x503fab;_0x5101830x0&&_0x23f31a[_0x37ef2c+_0x6854('0x27')]>=_0x23f31a[_0x37ef2c+_0x6854('0x26')]){writeLog(_0x3bd157,_0x23f31a,_0x37ef2c[_0x6854('0x28')]()+_0x6854('0x29'));return![];}}return!![];};exports[_0x6854('0x2a')]=function(_0x38b7dd,_0x4c1081,_0x4e647c,_0x250d49,_0x5b74cc){return sendNotification(!![],_0x38b7dd,_0x4c1081,_0x4e647c,_0x250d49,_0x5b74cc);};exports[_0x6854('0x2b')]=function(_0x3c35b4,_0x1c4f6,_0xcca868,_0x2e3cce,_0x3f3a63){return sendNotification(![],_0x3c35b4,_0x1c4f6,_0xcca868,_0x2e3cce,_0x3f3a63);};exports[_0x6854('0x2c')]=function(_0x4e7c33,_0x3043b3,_0x1a8fb6){var _0x34245b=_0x3043b3['interaction'][_0x6854('0x2d')];if(!_0x34245b&&_0x1a8fb6){_0x34245b=_0x1a8fb6['id'];}var _0x1586f2=_[_0x6854('0x2e')](_0x4e7c33[_0x3043b3['channel']+_0x6854('0x2f')],function(_0x5e1a23){var _0x156a48=_[_0x6854('0x30')](_0x3043b3[_0x6854('0x31')])+_0x6854('0x32');return _0x5e1a23[_0x156a48]===_0x3043b3[_0x6854('0x33')]['id'];});if(!_0x1586f2&&_0x34245b&&_0x4e7c33['agents'][_0x34245b]){_0x1586f2=_['some'](_0x4e7c33[_0x6854('0x34')][_0x34245b][_0x3043b3[_0x6854('0x31')]+_0x6854('0x35')],function(_0x169454){return _0x169454['id']===_0x3043b3[_0x6854('0x33')]['id'];});}return _0x1586f2;};exports['saveWaitingNotification']=function(_0x1bb6c6,_0x429f7c,_0x229d48,_0x34bcf5){if(_0x229d48&&_0x229d48['id']&&_0x1bb6c6[_0x6854('0x34')]&&_0x1bb6c6[_0x6854('0x34')][_0x229d48['id']]){_0x1bb6c6[_0x6854('0x34')][_0x229d48['id']][_0x34bcf5+_0x6854('0x35')][_0x429f7c[_0x6854('0x17')]['id']]={'id':_0x429f7c[_0x6854('0x33')]['id']};}};exports['removeWaitingNotification']=function(_0x2b8c9f,_0x135dee,_0x3ad3fa,_0x1deccd){if(_0x3ad3fa&&_0x3ad3fa['id']&&_0x2b8c9f['agents']&&_0x2b8c9f[_0x6854('0x34')][_0x3ad3fa['id']]){delete _0x2b8c9f[_0x6854('0x34')][_0x3ad3fa['id']][_0x1deccd+_0x6854('0x35')][_0x135dee[_0x6854('0x17')]['id']];}};exports[_0x6854('0x36')]=writeLog; \ No newline at end of file +var _0x579a=['toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','channel','QueuesWaitingInteractions','capitalize','InteractionId','agents','some','saveWaitingNotification','WaitingInteractions','removeWaitingNotification','writeLog','lodash','util','../utils','ioredis','routing','redis','socket.io-emitter','\x20interaction','name','account','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','format','[%s][QUEUE]\x20%s','message','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','isAgentAvailable','busy','BUSY','OFFLINE','Pause','hasOwnProperty','Capacity','CurrentCapacity'];(function(_0x15b8cf,_0xb9e71f){var _0x124ac3=function(_0x87220d){while(--_0x87220d){_0x15b8cf['push'](_0x15b8cf['shift']());}};_0x124ac3(++_0xb9e71f);}(_0x579a,0x9d));var _0xa579=function(_0x3c7dee,_0x463cbe){_0x3c7dee=_0x3c7dee-0x0;var _0x4f2e45=_0x579a[_0x3c7dee];return _0x4f2e45;};'use strict';var _=require(_0xa579('0x0'));var util=require(_0xa579('0x1'));var utils=require(_0xa579('0x2'));var Redis=require(_0xa579('0x3'));var config=require('../../../../../config/environment');var logger=require('../../../../../config/logger')(_0xa579('0x4'));config[_0xa579('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xa579('0x6'))(new Redis(config['redis']));function sendNotification(_0x354f3b,_0x14a544,_0x770152,_0x2aeb20,_0x27e490,_0x4418fd){var _0x2d770d=_0x4418fd||{};var _0x1c0cab=_0x770152['split']('.');var _0x195c06={'uniqueid':_0x14a544,'channel':_0x1c0cab[0x0],'id':_0x1c0cab[0x1],'title':_0x1c0cab[0x0]+_0xa579('0x7'),'interactionId':_0x1c0cab[0x2],'queue':_0x27e490?_0x27e490[_0xa579('0x8')]:null,'sound':_0x2d770d[_0xa579('0x9')]['notificationSound'],'shake':_0x2d770d[_0xa579('0x9')][_0xa579('0xa')]};try{if(!_0x2d770d[_0xa579('0xb')]){_0x2d770d[_0xa579('0xb')]={};}if(_0x27e490){_0x2d770d['body'][_0xa579('0xc')]=_0x27e490;}else if(_0x2d770d[_0xa579('0xb')][_0xa579('0xc')]){delete _0x2d770d[_0xa579('0xb')][_0xa579('0xc')];}_0x195c06[_0xa579('0xd')]=utils['getMustacheRender'](_0x2d770d[_0xa579('0x9')]['notificationTemplate'],_0x2d770d);}catch(_0x45bf75){_0x195c06[_0xa579('0xd')]=_0xa579('0xe');logger[_0xa579('0xf')](util[_0xa579('0x10')](_0xa579('0x11'),_0x14a544,_0x45bf75[_0xa579('0x12')]));}io['to'](util[_0xa579('0x10')]('user:%s',_0x2aeb20[_0xa579('0x8')]))['emit'](util[_0xa579('0x10')](_0xa579('0x13'),_0x354f3b?_0xa579('0x14'):'remove'),_0x195c06);}function writeLog(_0x285d4d,_0x47edf9,_0x4939af){return logger[_0xa579('0x15')](util[_0xa579('0x10')](_0xa579('0x16'),_0x285d4d,_0x47edf9[_0xa579('0x8')],_0x4939af));}exports[_0xa579('0x17')]=function(_0x1a83bb,_0x414575,_0x2843c3,_0x4b7489){if(_0x414575[_0xa579('0x18')]){writeLog(_0x1a83bb,_0x414575,_0xa579('0x19'));return![];}if(!_0x414575['online']){writeLog(_0x1a83bb,_0x414575,_0xa579('0x1a'));return![];}if(_0x414575[_0x2843c3+_0xa579('0x1b')]){writeLog(_0x1a83bb,_0x414575,'PAUSE');return![];}if(_0x4b7489&&_0x414575[_0xa579('0x1c')](_0x2843c3+_0xa579('0x1d'))&&_0x414575['hasOwnProperty'](_0x2843c3+'CurrentCapacity')){if(_0x414575[_0x2843c3+'Capacity']>0x0&&_0x414575[_0x2843c3+_0xa579('0x1e')]>=_0x414575[_0x2843c3+'Capacity']){writeLog(_0x1a83bb,_0x414575,_0x2843c3[_0xa579('0x1f')]()+_0xa579('0x20'));return![];}}return!![];};exports[_0xa579('0x21')]=function(_0xd9b013,_0x401cb8,_0x475259,_0x31b9fd,_0xb2a714){return sendNotification(!![],_0xd9b013,_0x401cb8,_0x475259,_0x31b9fd,_0xb2a714);};exports[_0xa579('0x22')]=function(_0x153912,_0x4bc0fb,_0x1fc98a,_0x5cac4f,_0x37fe1d){return sendNotification(![],_0x153912,_0x4bc0fb,_0x1fc98a,_0x5cac4f,_0x37fe1d);};exports[_0xa579('0x23')]=function(_0x9c8e75,_0x1ef981,_0x1e59f0){var _0x321a77=_0x1ef981[_0xa579('0x24')]['UserId'];if(!_0x321a77&&_0x1e59f0){_0x321a77=_0x1e59f0['id'];}var _0x444df4=_['some'](_0x9c8e75[_0x1ef981[_0xa579('0x25')]+_0xa579('0x26')],function(_0x3d0630){var _0x35bb8a=_[_0xa579('0x27')](_0x1ef981[_0xa579('0x25')])+_0xa579('0x28');return _0x3d0630[_0x35bb8a]===_0x1ef981[_0xa579('0x24')]['id'];});if(!_0x444df4&&_0x321a77&&_0x9c8e75[_0xa579('0x29')][_0x321a77]){_0x444df4=_[_0xa579('0x2a')](_0x9c8e75['agents'][_0x321a77][_0x1ef981[_0xa579('0x25')]+'WaitingInteractions'],function(_0x3b5850){return _0x3b5850['id']===_0x1ef981['interaction']['id'];});}return _0x444df4;};exports[_0xa579('0x2b')]=function(_0x39da14,_0x6b991f,_0x18b425,_0xd1d698){if(_0x18b425&&_0x18b425['id']&&_0x39da14[_0xa579('0x29')]&&_0x39da14[_0xa579('0x29')][_0x18b425['id']]){_0x39da14[_0xa579('0x29')][_0x18b425['id']][_0xd1d698+_0xa579('0x2c')][_0x6b991f[_0xa579('0x12')]['id']]={'id':_0x6b991f[_0xa579('0x24')]['id']};}};exports[_0xa579('0x2d')]=function(_0x416184,_0x22f9e9,_0xa8c338,_0x1efb0f){if(_0xa8c338&&_0xa8c338['id']&&_0x416184[_0xa579('0x29')]&&_0x416184[_0xa579('0x29')][_0xa8c338['id']]){delete _0x416184[_0xa579('0x29')][_0xa8c338['id']][_0x1efb0f+_0xa579('0x2c')][_0x22f9e9[_0xa579('0x12')]['id']];}};exports[_0xa579('0x2e')]=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 fda827f..d01b1a7 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 _0xabf2=['routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','isObject','stringify','validate','shelljs','./utils','../../../../config/logger'];(function(_0x10f5b2,_0x1cda8b){var _0xb3f77c=function(_0x5dead6){while(--_0x5dead6){_0x10f5b2['push'](_0x10f5b2['shift']());}};_0xb3f77c(++_0x1cda8b);}(_0xabf2,0xe6));var _0x2abf=function(_0x3bf610,_0x3bdc43){_0x3bf610=_0x3bf610-0x0;var _0x143e12=_0xabf2[_0x3bf610];return _0x143e12;};'use strict';var schema=require(_0x2abf('0x0'));var sh=require(_0x2abf('0x1'));var _=require('lodash');var utils=require(_0x2abf('0x2'));var logger=require(_0x2abf('0x3'))(_0x2abf('0x4'));var system=schema({'command':{'type':_0x2abf('0x5'),'required':!![],'message':_0x2abf('0x6')}});exports[_0x2abf('0x7')]=function(_0x5cac4e,_0x113984){return function(_0x44030d){try{var _0x9f9c63={'command':_0x113984[0x0]};var _0x228ff1=system[_0x2abf('0x0')](_0x9f9c63,{'typecast':!![]});if(_0x228ff1[_0x2abf('0x8')]){logger[_0x2abf('0x9')](_0x2abf('0xa'),_0x5cac4e,_[_0x2abf('0xb')](_0x228ff1,_0x2abf('0xc'))['join'](',\x20'));logger[_0x2abf('0xd')](_0x2abf('0xe'),_0x5cac4e);_0x44030d[_0x2abf('0xf')]();}else{var _0xb580e0=this;var _0x15a85c=utils[_0x2abf('0x10')](_0x113984[0x0],this);logger[_0x2abf('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5cac4e,_0x15a85c);sh[_0x2abf('0x11')](_[_0x2abf('0x12')](_0x15a85c),function(_0x16ae20,_0x503c21){logger[_0x2abf('0xd')](_0x2abf('0x13'),_0x5cac4e,_0x16ae20);if(_0x16ae20==0x0){var _0x10aa3a=_0x503c21[_0x2abf('0x14')](/(\r\n|\n|\r)/gm,'');if(_[_0x2abf('0x15')](_0x113984[0x1])||_[_0x2abf('0x16')](_0x113984[0x1])){logger['info']('[%s][SYSTEM]\x20no\x20variable',_0x5cac4e);_0xb580e0[_0x2abf('0x17')][_0x113984[0x1]]=_0x10aa3a;}else{logger[_0x2abf('0xd')]('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x5cac4e,_0x113984[0x1],_0x10aa3a);_0xb580e0[_0x2abf('0x17')][_0x113984[0x1]]=_0x10aa3a;}}_0x44030d[_0x2abf('0xf')]();});}}catch(_0x1b4339){logger[_0x2abf('0x9')](_0x2abf('0xa'),_0x5cac4e,_[_0x2abf('0x18')](_0x1b4339)?JSON[_0x2abf('0x19')](_0x1b4339):_0x1b4339);logger['info'](_0x2abf('0xe'),_0x5cac4e);_0x44030d['next']();}};}; \ No newline at end of file +var _0xe1bc=['command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','replace','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string'];(function(_0x5a97d2,_0x508930){var _0x26e642=function(_0x102d3c){while(--_0x102d3c){_0x5a97d2['push'](_0x5a97d2['shift']());}};_0x26e642(++_0x508930);}(_0xe1bc,0xf4));var _0xce1b=function(_0x26d6a2,_0x25cc1e){_0x26d6a2=_0x26d6a2-0x0;var _0x11165f=_0xe1bc[_0x26d6a2];return _0x11165f;};'use strict';var schema=require('validate');var sh=require(_0xce1b('0x0'));var _=require(_0xce1b('0x1'));var utils=require(_0xce1b('0x2'));var logger=require(_0xce1b('0x3'))(_0xce1b('0x4'));var system=schema({'command':{'type':_0xce1b('0x5'),'required':!![],'message':_0xce1b('0x6')}});exports[_0xce1b('0x7')]=function(_0x208d53,_0x3ee979){return function(_0x3cdbda){try{var _0x2700a0={'command':_0x3ee979[0x0]};var _0x286300=system['validate'](_0x2700a0,{'typecast':!![]});if(_0x286300['length']){logger[_0xce1b('0x8')](_0xce1b('0x9'),_0x208d53,_[_0xce1b('0xa')](_0x286300,'message')[_0xce1b('0xb')](',\x20'));logger[_0xce1b('0xc')](_0xce1b('0xd'),_0x208d53);_0x3cdbda[_0xce1b('0xe')]();}else{var _0x17b8eb=this;var _0x3d43ea=utils[_0xce1b('0xf')](_0x3ee979[0x0],this);logger[_0xce1b('0xc')](_0xce1b('0x10'),_0x208d53,_0x3d43ea);sh[_0xce1b('0x11')](_['trim'](_0x3d43ea),function(_0x549693,_0x52bce3){logger[_0xce1b('0xc')]('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x208d53,_0x549693);if(_0x549693==0x0){var _0x3c734a=_0x52bce3[_0xce1b('0x12')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x3ee979[0x1])||_[_0xce1b('0x13')](_0x3ee979[0x1])){logger[_0xce1b('0xc')](_0xce1b('0x14'),_0x208d53);_0x17b8eb[_0xce1b('0x15')][_0x3ee979[0x1]]=_0x3c734a;}else{logger[_0xce1b('0xc')](_0xce1b('0x16'),_0x208d53,_0x3ee979[0x1],_0x3c734a);_0x17b8eb[_0xce1b('0x15')][_0x3ee979[0x1]]=_0x3c734a;}}_0x3cdbda[_0xce1b('0xe')]();});}}catch(_0x1a35d6){logger[_0xce1b('0x8')](_0xce1b('0x9'),_0x208d53,_[_0xce1b('0x17')](_0x1a35d6)?JSON[_0xce1b('0x18')](_0x1a35d6):_0x1a35d6);logger[_0xce1b('0xc')](_0xce1b('0xd'),_0x208d53);_0x3cdbda[_0xce1b('0xe')]();}};}; \ 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 84778d7..c54b09b 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 _0x0228=['../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','[%s][TAG]\x20%s','message','join','info','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','error','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x3bc265,_0x4f9c45){var _0x50f7ab=function(_0x7c39c9){while(--_0x7c39c9){_0x3bc265['push'](_0x3bc265['shift']());}};_0x50f7ab(++_0x4f9c45);}(_0x0228,0xc4));var _0x8022=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x0228[_0x53a7a8];return _0x555f71;};'use strict';var schema=require(_0x8022('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0x8022('0x1')),'openchannelInteraction':require(_0x8022('0x2')),'smsInteraction':require(_0x8022('0x3')),'mailInteraction':require(_0x8022('0x4')),'faxInteraction':require(_0x8022('0x5')),'whatsappInteraction':require(_0x8022('0x6'))};var logger=require(_0x8022('0x7'))(_0x8022('0x8'));var tag=schema({'tag':{'type':_0x8022('0x9'),'required':!![],'message':_0x8022('0xa')}});exports['consequence']=function(_0x154b50,_0x25e16e,_0x7f6265,_0xc3c1a2){return function(_0x19a423){try{var _0x27d141={'tag':_0x25e16e[0x0]};var _0x1b015d=tag[_0x8022('0x0')](_0x27d141,{'typecast':!![]});if(_0x1b015d[_0x8022('0xb')]){logger['error'](_0x8022('0xc'),_0x154b50,_['map'](_0x1b015d,_0x8022('0xd'))[_0x8022('0xe')](',\x20'));logger[_0x8022('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x154b50);_0x19a423[_0x8022('0x10')]();}else{var _0x28b6b2={'ids':[_0x25e16e[0x0]]};if(rpc[_0xc3c1a2[_0x8022('0x11')]+_0x8022('0x12')]){rpc[_0xc3c1a2['channel']+_0x8022('0x12')][_0x8022('0x13')](_0xc3c1a2[_0x8022('0x14')]['id'],_0x28b6b2)[_0x8022('0x15')](function(_0x29540a){logger['info'](_0x8022('0x16'),_0x154b50,_0x25e16e[0x1],_0xc3c1a2['channel'],_0xc3c1a2['interaction']['id']);})[_0x8022('0x17')](function(_0x45963b){logger[_0x8022('0x18')](_0x8022('0xc'),_0x154b50,JSON[_0x8022('0x19')](_0x45963b));logger[_0x8022('0xf')](_0x8022('0x1a'),_0x154b50);})[_0x8022('0x1b')](function(){_0x19a423[_0x8022('0x10')]();});}}}catch(_0x1d632e){logger[_0x8022('0x18')](_0x8022('0xc'),_0x154b50,_[_0x8022('0x1c')](_0x1d632e)?JSON[_0x8022('0x19')](_0x1d632e):_0x1d632e);logger[_0x8022('0xf')](_0x8022('0x1a'),_0x154b50);_0x19a423['next']();}};}; \ No newline at end of file +var _0xe4bf=['../../rpc/smsInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message','join','info','next','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','isObject','validate','../../rpc/chatInteraction','../../rpc/openchannelInteraction'];(function(_0x3d34f0,_0x4a5dc0){var _0x135ecd=function(_0x9a81d5){while(--_0x9a81d5){_0x3d34f0['push'](_0x3d34f0['shift']());}};_0x135ecd(++_0x4a5dc0);}(_0xe4bf,0x89));var _0xfe4b=function(_0x45313f,_0x46caf4){_0x45313f=_0x45313f-0x0;var _0x402910=_0xe4bf[_0x45313f];return _0x402910;};'use strict';var schema=require(_0xfe4b('0x0'));var _=require('lodash');var rpc={'chatInteraction':require(_0xfe4b('0x1')),'openchannelInteraction':require(_0xfe4b('0x2')),'smsInteraction':require(_0xfe4b('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0xfe4b('0x4'))(_0xfe4b('0x5'));var tag=schema({'tag':{'type':_0xfe4b('0x6'),'required':!![],'message':_0xfe4b('0x7')}});exports[_0xfe4b('0x8')]=function(_0x18dc2a,_0x3f2342,_0x2fa776,_0x220431){return function(_0x426084){try{var _0x21b845={'tag':_0x3f2342[0x0]};var _0x5b3993=tag[_0xfe4b('0x0')](_0x21b845,{'typecast':!![]});if(_0x5b3993[_0xfe4b('0x9')]){logger[_0xfe4b('0xa')](_0xfe4b('0xb'),_0x18dc2a,_[_0xfe4b('0xc')](_0x5b3993,_0xfe4b('0xd'))[_0xfe4b('0xe')](',\x20'));logger[_0xfe4b('0xf')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x18dc2a);_0x426084[_0xfe4b('0x10')]();}else{var _0x18ae62={'ids':[_0x3f2342[0x0]]};if(rpc[_0x220431['channel']+_0xfe4b('0x11')]){rpc[_0x220431[_0xfe4b('0x12')]+_0xfe4b('0x11')][_0xfe4b('0x13')](_0x220431[_0xfe4b('0x14')]['id'],_0x18ae62)[_0xfe4b('0x15')](function(_0x9e5c9c){logger[_0xfe4b('0xf')](_0xfe4b('0x16'),_0x18dc2a,_0x3f2342[0x1],_0x220431['channel'],_0x220431[_0xfe4b('0x14')]['id']);})[_0xfe4b('0x17')](function(_0x4bd63d){logger[_0xfe4b('0xa')](_0xfe4b('0xb'),_0x18dc2a,JSON[_0xfe4b('0x18')](_0x4bd63d));logger['info'](_0xfe4b('0x19'),_0x18dc2a);})[_0xfe4b('0x1a')](function(){_0x426084[_0xfe4b('0x10')]();});}}}catch(_0x4b1d92){logger['error'](_0xfe4b('0xb'),_0x18dc2a,_[_0xfe4b('0x1b')](_0x4b1d92)?JSON['stringify'](_0x4b1d92):_0x4b1d92);logger[_0xfe4b('0xf')](_0xfe4b('0x19'),_0x18dc2a);_0x426084[_0xfe4b('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 c86464a..5e33c03 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 _0xec1d=['&sessionId=','&data=','info','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','lodash','consequence','\x20-\x20','push','urlOnAnswer','urlOnRing','?params=','title','2.0','method','params','stringify','utf8','application/json-rpc','then','parse','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&serviceId='];(function(_0x492e0d,_0x52a2d3){var _0x37930d=function(_0x50108d){while(--_0x50108d){_0x492e0d['push'](_0x492e0d['shift']());}};_0x37930d(++_0x52a2d3);}(_0xec1d,0x164));var _0xdec1=function(_0x1d1d28,_0xcf8aa1){_0x1d1d28=_0x1d1d28-0x0;var _0x5140ff=_0xec1d[_0x1d1d28];return _0x5140ff;};'use strict';var rp=require(_0xdec1('0x0'));var logger=require(_0xdec1('0x1'))('routing');var _=require(_0xdec1('0x2'));var arr=[];exports[_0xdec1('0x3')]=function(_0x381550,_0x51aef0){return function(_0x220dce){var _0x1c7be8=_0x51aef0[0xa];var _0x54b580=_0x51aef0[0xb];var _0x41507e=_0x51aef0[0xc];var _0x582d70=_0x51aef0[0xd];var _0x41b5ba=_0x51aef0[0xe];var _0x263e29=_0x51aef0[0xf]['replace'](/\n/g,_0xdec1('0x4'));var _0x1ac952=_0x51aef0[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x54b580)){arr[_0xdec1('0x5')](_0x54b580);var _0xde7189=_0x51aef0[0x3];var _0x42b362=_0x51aef0[0x4];var _0x36dceb=_0x51aef0[0x1];var _0x583f0e=_0x51aef0[0x0];var _0x1b959e={};_0x1b959e[_0xdec1('0x6')]=_0x51aef0[0x8]+'?params='+_0x41507e+'|'+_0x1c7be8+'|'+_0x582d70+'|'+_0x54b580+'|'+_0x41b5ba;_0x1b959e[_0xdec1('0x7')]=_0x51aef0[0x7]+_0xdec1('0x8')+_0x41507e+'|'+_0x1c7be8+'|'+_0x582d70+'|'+_0x54b580+'|'+_0x41b5ba+'|'+_0x263e29+'|'+_0x1ac952;_0x1b959e[_0xdec1('0x9')]=_0x51aef0[0x9];var _0xef2a0f={};_0xef2a0f['jsonrpc']=_0xdec1('0xa');_0xef2a0f[_0xdec1('0xb')]='login';var _0x51010d=[];_0x51010d[_0xdec1('0x5')](_0x51aef0[0x2]);_0x51010d[_0xdec1('0x5')](_0x51aef0[0x5]);_0x51010d[_0xdec1('0x5')](_0x51aef0[0x6]);_0xef2a0f[_0xdec1('0xc')]=_0x51010d;_0xef2a0f['id']=0x1;var _0x180637=JSON[_0xdec1('0xd')](_0xef2a0f);var _0x3c979e={'encoding':_0xdec1('0xe'),'method':'POST','timeout':0x2710,'url':_0xde7189,'headers':{'Content-Type':_0xdec1('0xf')},'body':_0x180637};return rp(_0x3c979e)[_0xdec1('0x10')](function(_0x2de965){const _0x1c9ea8=JSON[_0xdec1('0x11')](_0x2de965);if(!_0x1c9ea8['result'][_0xdec1('0x12')]){throw new Error(_0xdec1('0x13'));}var _0x38d55b=_0x54b580;var _0x2e60fe='channelId='+_0x36dceb+_0xdec1('0x14')+_0x583f0e+_0xdec1('0x15')+_0x38d55b+_0xdec1('0x16')+JSON[_0xdec1('0xd')](_0x1b959e);var _0x524e5d=_0x42b362+'?'+_0x2e60fe;return rp(_0x524e5d);})[_0xdec1('0x10')](function(_0xedad38){logger[_0xdec1('0x17')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x381550,_0xedad38);_0x220dce['stop']();})['catch'](function(_0x5acf3f){logger[_0xdec1('0x18')](_0xdec1('0x19'),_0x381550,_[_0xdec1('0x1a')](_0x5acf3f)?JSON[_0xdec1('0xd')](_0x5acf3f):_0x5acf3f);_0x220dce['stop']();});}else{logger[_0xdec1('0x17')](_0xdec1('0x1b'),_0x381550);_0x220dce[_0xdec1('0x1c')]();}};}; \ No newline at end of file +var _0x19c4=['channelId=','&serviceId=','&sessionId=','&data=','info','catch','error','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','2.0','method','push','params','stringify','utf8','then','parse','result','logged','Unable\x20to\x20login\x20with\x20TVox\x20application'];(function(_0x1d06c,_0x5548b3){var _0x247024=function(_0x55f76a){while(--_0x55f76a){_0x1d06c['push'](_0x1d06c['shift']());}};_0x247024(++_0x5548b3);}(_0x19c4,0x196));var _0x419c=function(_0x2e913b,_0x4b7071){_0x2e913b=_0x2e913b-0x0;var _0x173899=_0x19c4[_0x2e913b];return _0x173899;};'use strict';var rp=require(_0x419c('0x0'));var logger=require(_0x419c('0x1'))(_0x419c('0x2'));var _=require(_0x419c('0x3'));var arr=[];exports['consequence']=function(_0x4e1024,_0x59c7d3){return function(_0x57cc34){var _0x3ab50f=_0x59c7d3[0xa];var _0x440ad9=_0x59c7d3[0xb];var _0x3a1605=_0x59c7d3[0xc];var _0x5ded05=_0x59c7d3[0xd];var _0x4bf888=_0x59c7d3[0xe];var _0x22fc53=_0x59c7d3[0xf][_0x419c('0x4')](/\n/g,_0x419c('0x5'));var _0x276245=_0x59c7d3[0x10][_0x419c('0x4')](/\n/g,'\x20');if(!arr[_0x419c('0x6')](_0x440ad9)){arr['push'](_0x440ad9);var _0x720c7a=_0x59c7d3[0x3];var _0x3dd6e4=_0x59c7d3[0x4];var _0x5128f7=_0x59c7d3[0x1];var _0x42963a=_0x59c7d3[0x0];var _0x534b9b={};_0x534b9b[_0x419c('0x7')]=_0x59c7d3[0x8]+_0x419c('0x8')+_0x3a1605+'|'+_0x3ab50f+'|'+_0x5ded05+'|'+_0x440ad9+'|'+_0x4bf888;_0x534b9b[_0x419c('0x9')]=_0x59c7d3[0x7]+_0x419c('0x8')+_0x3a1605+'|'+_0x3ab50f+'|'+_0x5ded05+'|'+_0x440ad9+'|'+_0x4bf888+'|'+_0x22fc53+'|'+_0x276245;_0x534b9b[_0x419c('0xa')]=_0x59c7d3[0x9];var _0x50a8b7={};_0x50a8b7[_0x419c('0xb')]=_0x419c('0xc');_0x50a8b7[_0x419c('0xd')]='login';var _0x1cc372=[];_0x1cc372[_0x419c('0xe')](_0x59c7d3[0x2]);_0x1cc372[_0x419c('0xe')](_0x59c7d3[0x5]);_0x1cc372[_0x419c('0xe')](_0x59c7d3[0x6]);_0x50a8b7[_0x419c('0xf')]=_0x1cc372;_0x50a8b7['id']=0x1;var _0x31e7b2=JSON[_0x419c('0x10')](_0x50a8b7);var _0x439821={'encoding':_0x419c('0x11'),'method':'POST','timeout':0x2710,'url':_0x720c7a,'headers':{'Content-Type':'application/json-rpc'},'body':_0x31e7b2};return rp(_0x439821)[_0x419c('0x12')](function(_0x1f659b){const _0x2194e5=JSON[_0x419c('0x13')](_0x1f659b);if(!_0x2194e5[_0x419c('0x14')][_0x419c('0x15')]){throw new Error(_0x419c('0x16'));}var _0x3fb9c1=_0x440ad9;var _0x31539f=_0x419c('0x17')+_0x5128f7+_0x419c('0x18')+_0x42963a+_0x419c('0x19')+_0x3fb9c1+_0x419c('0x1a')+JSON[_0x419c('0x10')](_0x534b9b);var _0x39f0f1=_0x3dd6e4+'?'+_0x31539f;return rp(_0x39f0f1);})[_0x419c('0x12')](function(_0x304198){logger[_0x419c('0x1b')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x4e1024,_0x304198);_0x57cc34['stop']();})[_0x419c('0x1c')](function(_0x394120){logger[_0x419c('0x1d')]('[%s][TVOX]\x20%s',_0x4e1024,_['isObject'](_0x394120)?JSON[_0x419c('0x10')](_0x394120):_0x394120);_0x57cc34[_0x419c('0x1e')]();});}else{logger[_0x419c('0x1b')](_0x419c('0x1f'),_0x4e1024);_0x57cc34[_0x419c('0x20')]();}};}; \ 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 4bdc23a..8d39ab9 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(_0x3735f9,_0x21dd55){var _0x59cfd2=function(_0x509649){while(--_0x509649){_0x3735f9['push'](_0x3735f9['shift']());}};_0x59cfd2(++_0x21dd55);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'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 _0x9c44=['merge','body','account','list','exports','render'];(function(_0x6af4d9,_0x45c018){var _0x33d405=function(_0x382274){while(--_0x382274){_0x6af4d9['push'](_0x6af4d9['shift']());}};_0x33d405(++_0x45c018);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index b15838e..9f81a6e 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 _0xcf37=['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','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','checkWaitingNotifications','transfer','isArray','applications','length','existsSync','join','app','.js','autoreply','appdata','push','slice','split','dialogflowv2','amazonlex','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','interaction','body','format','%s:%s:%s','./interval','intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','error','execute','Applications\x20executed','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues'];(function(_0x366322,_0x46f476){var _0x130c31=function(_0x137307){while(--_0x137307){_0x366322['push'](_0x366322['shift']());}};_0x130c31(++_0x46f476);}(_0xcf37,0xdc));var _0x7cf3=function(_0x2faeae,_0xef8825){_0x2faeae=_0x2faeae-0x0;var _0x4494c8=_0xcf37[_0x2faeae];return _0x4494c8;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var path=require(_0x7cf3('0x1'));var fs=require('fs');var jayson=require(_0x7cf3('0x2'));var BPromise=require(_0x7cf3('0x3'));var utils=require(_0x7cf3('0x4'));var sUtils=require('./applications/strategy/util');var logger=require(_0x7cf3('0x5'))(_0x7cf3('0x6'));var rpc={'openchannelQueueReport':require(_0x7cf3('0x7')),'mailQueueReport':require(_0x7cf3('0x8')),'chatQueueReport':require(_0x7cf3('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x78b9a4,_0x53502d,_0x110c99){return util['format'](_0x7cf3('0xa'),_0x78b9a4,_0x53502d||0x0,_0x110c99||0x0);}function getIntervals(_0x377577,_0x242ffc){var _0x2acdde=[];if(!_[_0x7cf3('0xb')](_0x242ffc[_0x7cf3('0xc')])&&!_['isNil'](_0x377577[_0x242ffc[_0x7cf3('0xc')]])&&!_[_0x7cf3('0xb')](_0x377577[_0x242ffc[_0x7cf3('0xc')]][_0x7cf3('0xd')])){_0x2acdde=_[_0x7cf3('0xe')](_0x377577[_0x242ffc['IntervalId']][_0x7cf3('0xd')],'interval');}else if(!_[_0x7cf3('0xb')](_0x242ffc['interval'])){_0x2acdde=[_0x242ffc[_0x7cf3('0xf')]];}return _0x2acdde;}exports[_0x7cf3('0x10')]=function(_0x5a9ead){_0x5a9ead[_0x7cf3('0x11')]={};return new BPromise(function(_0x2b477e,_0x3f4338){var _0x11b967={'Start':function(_0x5d763d){var _0x34d074=this;return new Promise(function(_0x5d38cd,_0x32c1d7){if(_0x5d763d){try{var _0x247406=[];var _0x346dae=getId(_0x5d763d[_0x7cf3('0x12')],_0x5d763d[_0x7cf3('0x13')]?_0x5d763d[_0x7cf3('0x13')]['id']:0x0,_0x5d763d['interaction']?_0x5d763d['interaction']['id']:0x0);var _0xd7e354=sUtils[_0x7cf3('0x14')](_0x5a9ead,_0x5d763d);if(_0x5d763d[_0x7cf3('0x15')]||!_0xd7e354&&_0x5d763d['applications']&&_[_0x7cf3('0x16')](_0x5d763d[_0x7cf3('0x17')])&&_0x5d763d[_0x7cf3('0x17')][_0x7cf3('0x18')]){for(var _0x369e30=0x0;_0x369e30<_0x5d763d['applications'][_0x7cf3('0x18')];_0x369e30+=0x1){var _0x10508f=_0x5d763d[_0x7cf3('0x17')][_0x369e30];if(fs[_0x7cf3('0x19')](path[_0x7cf3('0x1a')](__dirname,'applications',_0x10508f[_0x7cf3('0x1b')]+_0x7cf3('0x1c')))){var _0x57e177=[];switch(_0x10508f['app']['toLowerCase']()){case _0x7cf3('0x1d'):var _0x5b1f72=_0x10508f[_0x7cf3('0x1e')]['split'](',');if(_0x5d763d[_0x7cf3('0x12')]==='mail'){_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[0x0]);_0x57e177['push'](_0x5b1f72[0x1]);_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[_0x7cf3('0x20')](0x2,_0x5b1f72[_0x7cf3('0x18')])[_0x7cf3('0x1a')](','));}else{_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[0x0]);_0x57e177[_0x7cf3('0x1f')](_0x5b1f72[_0x7cf3('0x20')](0x1,_0x5b1f72[_0x7cf3('0x18')])[_0x7cf3('0x1a')](','));}break;case'dialogflow':var _0x4cbd7c=_0x10508f[_0x7cf3('0x1e')][_0x7cf3('0x21')](',');_0x57e177[_0x7cf3('0x1f')](_0x4cbd7c[0x0]);_0x57e177['push'](_0x4cbd7c[0x1]);_0x57e177[_0x7cf3('0x1f')](_0x4cbd7c[_0x7cf3('0x20')](0x2,_0x4cbd7c['length'])[_0x7cf3('0x1a')](','));break;case _0x7cf3('0x22'):var _0x3cc17e=_0x10508f[_0x7cf3('0x1e')][_0x7cf3('0x21')](',');_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x0]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x1]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x2]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e[0x3]);_0x57e177[_0x7cf3('0x1f')](_0x3cc17e['slice'](0x4,_0x3cc17e[_0x7cf3('0x18')])['join'](','));break;case _0x7cf3('0x23'):var _0x7fc6c0=_0x10508f[_0x7cf3('0x1e')]['split'](',');_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[0x0]);_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[0x1]);_0x57e177['push'](_0x7fc6c0[0x2]);_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[0x3]);_0x57e177[_0x7cf3('0x1f')](_0x7fc6c0[_0x7cf3('0x20')](0x4,_0x7fc6c0[_0x7cf3('0x18')])[_0x7cf3('0x1a')](','));break;case _0x7cf3('0x13'):_0x57e177['push'](_0x10508f[_0x7cf3('0x1e')]);break;case _0x7cf3('0x24'):_0x57e177[_0x7cf3('0x1f')](_0x10508f[_0x7cf3('0x25')]);_0x57e177['push'](_0x10508f[_0x7cf3('0x1e')]);break;case _0x7cf3('0x26'):var _0x5ce329=utils[_0x7cf3('0x27')](_0x5d763d[_0x7cf3('0x28')][_0x7cf3('0x29')],_0x5d763d);var _0x1e1634=_0x10508f[_0x7cf3('0x1e')][_0x7cf3('0x21')](',');_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x0]);_0x57e177['push'](_0x1e1634[0x1]);_0x57e177['push'](_0x1e1634[0x2]);_0x57e177['push'](_0x1e1634[0x3]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x4]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x5]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x6]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x7]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x8]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0x9]);_0x57e177[_0x7cf3('0x1f')](_0x1e1634[0xa]);_0x57e177[_0x7cf3('0x1f')](_0x5d763d[_0x7cf3('0x2a')]['id']);_0x57e177['push'](_0x5d763d['message']['id']);_0x57e177[_0x7cf3('0x1f')](_0x10508f['ChatWebsiteId']);_0x57e177['push'](_0x5d763d[_0x7cf3('0x2a')]['ContactId']);_0x57e177[_0x7cf3('0x1f')](_0x5d763d[_0x7cf3('0x2b')]['body']);_0x57e177[_0x7cf3('0x1f')](_0x5ce329);break;default:_0x57e177=_[_0x7cf3('0xb')](_0x10508f[_0x7cf3('0x1e')])?[]:_0x10508f[_0x7cf3('0x1e')]['split'](',');}var _0x2c7786={'id':util[_0x7cf3('0x2c')](_0x7cf3('0x2d'),_0x346dae,_0x10508f['id'],_0x10508f[_0x7cf3('0x1b')]),'condition':require(_0x7cf3('0x2e'))['condition'](_0x346dae,getIntervals(_0x5a9ead[_0x7cf3('0x2f')],_0x10508f),_0x5a9ead),'consequence':require(_0x7cf3('0x30')+_0x10508f['app'])[_0x7cf3('0x31')](_0x346dae,_0x57e177,_0x5a9ead,_0x5d763d),'p':_0x10508f[_0x7cf3('0x32')]||0x0};logger[_0x7cf3('0x33')](_0x7cf3('0x34'),_0x2c7786['id'],_0x7cf3('0x35'),getIntervals(_0x5a9ead[_0x7cf3('0x2f')],_0x10508f)[_0x7cf3('0x1a')]('\x20|\x20'));_0x247406[_0x7cf3('0x1f')](_0x2c7786);}else{logger[_0x7cf3('0x36')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x7cf3('0x1a')](__dirname,_0x7cf3('0x17'),_0x10508f[_0x7cf3('0x1b')]+_0x7cf3('0x1c')));}}_0x5a9ead[_0x7cf3('0x11')][_0x346dae]=new RuleEngine(_0x247406);_0x5a9ead[_0x7cf3('0x11')][_0x346dae][_0x7cf3('0x37')](_0x5d763d,function(_0x20c9ce){logger[_0x7cf3('0x33')](_0x7cf3('0x38'),JSON['stringify'](_0x20c9ce[_0x7cf3('0x39')]));if(_0x5a9ead['rules'][_0x346dae]){_0x5a9ead['rules'][_0x346dae][_0x7cf3('0x3a')](_0x7cf3('0x3b'));}});return _0x5d38cd({'code':0xc8,'message':_0x5d763d});}else{if(_0xd7e354){logger[_0x7cf3('0x33')](util[_0x7cf3('0x2c')]('Skipped\x20routing\x20for\x20%s',_0x346dae));}else{logger['info'](_0x7cf3('0x3c'));}return _0x5d38cd({'code':0xc8,'message':_0x5d763d});}}catch(_0x185c1b){logger[_0x7cf3('0x36')](_0x185c1b[_0x7cf3('0x3d')]);return _0x32c1d7(_0x34d074['error'](0x1f4,_0x185c1b));}}return _0x32c1d7(_0x7cf3('0x3e'));});},'AcceptMessage':function(_0x164a55){var _0x2b3346=this;return new Promise(function(_0x3164ef,_0x530cd4){if(_0x164a55[_0x7cf3('0x3f')]&&_0x164a55[_0x7cf3('0x3f')]['id']){if(_0x5a9ead[_0x7cf3('0x40')][_0x164a55[_0x7cf3('0x3f')]['id']]){_0x5a9ead[_0x7cf3('0x40')][_0x164a55[_0x7cf3('0x3f')]['id']][_0x7cf3('0x41')]=![];_0x5a9ead[_0x7cf3('0x40')][_0x164a55[_0x7cf3('0x3f')]['id']]['busyQueue']=undefined;}}if(_0x164a55['message']&&_0x164a55[_0x7cf3('0x13')]['id']){try{var _0x1d8c03=getId(_0x164a55[_0x7cf3('0x12')],_0x164a55['message']?_0x164a55['message']['id']:0x0,_0x164a55[_0x7cf3('0x2a')]?_0x164a55[_0x7cf3('0x2a')]['id']:0x0);if(_0x5a9ead['rules'][_0x1d8c03]){_0x5a9ead[_0x7cf3('0x11')][_0x1d8c03][_0x7cf3('0x3a')](_0x7cf3('0x42'));if(rpc[_0x164a55[_0x7cf3('0x12')]+_0x7cf3('0x43')]){rpc[_0x164a55['channel']+_0x7cf3('0x43')][_0x7cf3('0x44')](_0x1d8c03,{'UserId':_0x164a55[_0x7cf3('0x13')][_0x7cf3('0x45')]})[_0x7cf3('0x46')](function(){logger[_0x7cf3('0x36')](_0x7cf3('0x47'));});}}return _0x3164ef({'code':0xc8,'message':_0x164a55});}catch(_0x29b752){logger[_0x7cf3('0x36')](_0x29b752[_0x7cf3('0x3d')]);return _0x530cd4(_0x2b3346[_0x7cf3('0x36')](0x1f4,_0x29b752));}}logger['error'](_0x7cf3('0x48'));return _0x530cd4(_0x2b3346[_0x7cf3('0x36')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x2c4390){var _0x497308=this;return new Promise(function(_0x360bf1,_0x3df781){if(_0x2c4390[_0x7cf3('0x3f')]&&_0x2c4390['agent']['id']){try{if(_0x5a9ead[_0x7cf3('0x40')][_0x2c4390[_0x7cf3('0x3f')]['id']]){_0x5a9ead[_0x7cf3('0x40')][_0x2c4390[_0x7cf3('0x3f')]['id']][_0x7cf3('0x41')]=![];_0x5a9ead[_0x7cf3('0x40')][_0x2c4390[_0x7cf3('0x3f')]['id']]['busyQueue']=undefined;}return _0x360bf1({'code':0xc8,'message':_0x2c4390});}catch(_0x259c7e){logger['error'](_0x259c7e[_0x7cf3('0x3d')]);return _0x3df781(_0x497308[_0x7cf3('0x36')](0x1f4,_0x259c7e));}}logger[_0x7cf3('0x36')]('message\x20is\x20empty');return _0x3df781(_0x497308[_0x7cf3('0x36')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x158d71){var _0x3fd1cc=this;return new Promise(function(_0x449099,_0x188df8){if(_0x158d71[_0x7cf3('0x12')]&&_0x158d71[_0x7cf3('0x2a')]&&_0x158d71[_0x7cf3('0x2a')]['id']){try{var _0x40be43=getId(_0x158d71[_0x7cf3('0x12')],_0x158d71['message']?_0x158d71[_0x7cf3('0x13')]['id']:0x0,_0x158d71[_0x7cf3('0x2a')]?_0x158d71[_0x7cf3('0x2a')]['id']:0x0);if(_0x5a9ead[_0x7cf3('0x11')][_0x40be43]){_0x5a9ead['rules'][_0x40be43]['emit'](_0x7cf3('0x42'));}return _0x449099({'code':0xc8,'message':_0x158d71});}catch(_0x37bcc1){logger['error'](_0x37bcc1['stack']);return _0x188df8(_0x3fd1cc[_0x7cf3('0x36')](0x1f4,_0x37bcc1));}}logger['error'](_0x7cf3('0x48'));return _0x188df8(_0x3fd1cc[_0x7cf3('0x36')](0x1f4,_0x7cf3('0x48')));});},'AgentCapacity':function(_0x45f9bd){var _0x62d4d9=this;return new Promise(function(_0x31d32e,_0x18d519){if(_0x5a9ead[_0x7cf3('0x40')][_0x7cf3('0x49')](_0x45f9bd['id'])){for(var _0x4d41aa in _0x45f9bd[_0x7cf3('0x4a')]){if(_0x45f9bd[_0x7cf3('0x4a')][_0x7cf3('0x49')](_0x4d41aa)){if(_0x5a9ead[_0x7cf3('0x40')][_0x45f9bd['id']][_0x7cf3('0x49')](_0x4d41aa+_0x7cf3('0x4b'))){_0x5a9ead[_0x7cf3('0x40')][_0x45f9bd['id']][_0x4d41aa+'CurrentCapacity']=parseInt(_0x45f9bd[_0x7cf3('0x4a')][_0x4d41aa],0xa);}}}_0x5a9ead[_0x7cf3('0x40')][_0x45f9bd['id']][_0x7cf3('0x4c')]();return _0x31d32e({'code':0xc8,'message':_0x5a9ead['agents'][_0x45f9bd['id']]});}else{return _0x18d519(_0x62d4d9['error'](0x1f4,_0x7cf3('0x4d')));}});},'Agents':function(_0x2f0f94){return new Promise(function(_0x4f9017){var _0x18d262=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x40')]);if(_0x2f0f94&&_0x2f0f94['id']){var _0x50887d=_[_0x7cf3('0x4f')](_0x18d262,function(_0x525821){return _0x525821['id']===_0x2f0f94['id'];});_0x4f9017(_0x50887d);}else{_0x4f9017({'count':_0x18d262[_0x7cf3('0x18')],'rows':_0x18d262});}});},'ChatQueues':function(){return new Promise(function(_0x2fcdd9){var _0x136c5a=[];for(var _0x52ebc9 in _0x5a9ead[_0x7cf3('0x50')]){if(_0x5a9ead['chatQueues']['hasOwnProperty'](_0x52ebc9)){var _0x357707=_0x5a9ead['chatQueues'][_0x52ebc9];var _0x4047bd={'id':_0x357707['id'],'available':_0x357707[_0x7cf3('0x51')],'loggedIn':_0x357707[_0x7cf3('0x52')],'name':_0x357707[_0x7cf3('0x53')],'paused':_0x357707[_0x7cf3('0x54')],'waiting':_0x357707[_0x7cf3('0x55')]};_0x136c5a[_0x7cf3('0x1f')](_0x4047bd);}}_0x2fcdd9({'count':_0x136c5a[_0x7cf3('0x18')],'rows':_0x136c5a});});},'MailQueues':function(){return new Promise(function(_0x1358f8){var _0xbc93e0=[];for(var _0x20f80a in _0x5a9ead[_0x7cf3('0x56')]){if(_0x5a9ead['mailQueues']['hasOwnProperty'](_0x20f80a)){var _0x56f142=_0x5a9ead[_0x7cf3('0x56')][_0x20f80a];var _0xbdff85={'id':_0x56f142['id'],'available':_0x56f142[_0x7cf3('0x51')],'loggedIn':_0x56f142[_0x7cf3('0x52')],'name':_0x56f142[_0x7cf3('0x53')],'paused':_0x56f142['paused'],'waiting':_0x56f142[_0x7cf3('0x55')]};_0xbc93e0['push'](_0xbdff85);}}_0x1358f8({'count':_0xbc93e0[_0x7cf3('0x18')],'rows':_0xbc93e0});});},'OpenchannelQueues':function(){return new Promise(function(_0x5287e4){var _0x4e5dd0=[];for(var _0x3c1bdc in _0x5a9ead[_0x7cf3('0x57')]){if(_0x5a9ead[_0x7cf3('0x57')][_0x7cf3('0x49')](_0x3c1bdc)){var _0x442a6c=_0x5a9ead[_0x7cf3('0x57')][_0x3c1bdc];var _0x8bfa38={'id':_0x442a6c['id'],'available':_0x442a6c[_0x7cf3('0x51')],'loggedIn':_0x442a6c['loggedIn'],'name':_0x442a6c[_0x7cf3('0x53')],'paused':_0x442a6c[_0x7cf3('0x54')],'waiting':_0x442a6c['waiting']};_0x4e5dd0[_0x7cf3('0x1f')](_0x8bfa38);}}_0x5287e4({'count':_0x4e5dd0[_0x7cf3('0x18')],'rows':_0x4e5dd0});});},'SmsQueues':function(){return new Promise(function(_0x2f138f){var _0x546db7=[];for(var _0x5c8b19 in _0x5a9ead[_0x7cf3('0x58')]){if(_0x5a9ead[_0x7cf3('0x58')]['hasOwnProperty'](_0x5c8b19)){var _0x40b2d3=_0x5a9ead[_0x7cf3('0x58')][_0x5c8b19];var _0x548566={'id':_0x40b2d3['id'],'available':_0x40b2d3['available'],'loggedIn':_0x40b2d3[_0x7cf3('0x52')],'name':_0x40b2d3[_0x7cf3('0x53')],'paused':_0x40b2d3[_0x7cf3('0x54')],'waiting':_0x40b2d3['waiting']};_0x546db7[_0x7cf3('0x1f')](_0x548566);}}_0x2f138f({'count':_0x546db7['length'],'rows':_0x546db7});});},'FaxQueues':function(){return new Promise(function(_0xa2f72){var _0x1aac08=[];for(var _0x354547 in _0x5a9ead['faxQueues']){if(_0x5a9ead[_0x7cf3('0x59')]['hasOwnProperty'](_0x354547)){var _0x169b4a=_0x5a9ead['faxQueues'][_0x354547];var _0x3b2248={'id':_0x169b4a['id'],'available':_0x169b4a[_0x7cf3('0x51')],'loggedIn':_0x169b4a[_0x7cf3('0x52')],'name':_0x169b4a[_0x7cf3('0x53')],'paused':_0x169b4a[_0x7cf3('0x54')],'waiting':_0x169b4a[_0x7cf3('0x55')]};_0x1aac08[_0x7cf3('0x1f')](_0x3b2248);}}_0xa2f72({'count':_0x1aac08['length'],'rows':_0x1aac08});});},'WhatsappQueues':function(){return new Promise(function(_0x294471){var _0x18d367=[];for(var _0x51f60f in _0x5a9ead[_0x7cf3('0x5a')]){if(_0x5a9ead[_0x7cf3('0x5a')]['hasOwnProperty'](_0x51f60f)){var _0x3ac596=_0x5a9ead[_0x7cf3('0x5a')][_0x51f60f];var _0x9f5e34={'id':_0x3ac596['id'],'available':_0x3ac596[_0x7cf3('0x51')],'loggedIn':_0x3ac596['loggedIn'],'name':_0x3ac596['name'],'paused':_0x3ac596['paused'],'waiting':_0x3ac596[_0x7cf3('0x55')]};_0x18d367['push'](_0x9f5e34);}}_0x294471({'count':_0x18d367['length'],'rows':_0x18d367});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x4847ea){var _0x2ccc86=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5b')]);_0x4847ea({'count':_0x2ccc86[_0x7cf3('0x18')],'rows':_0x2ccc86});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x2f0b15){var _0x4149ca=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5c')]);_0x2f0b15({'count':_0x4149ca['length'],'rows':_0x4149ca});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x184ba1){var _0x267f38=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5d')]);_0x184ba1({'count':_0x267f38['length'],'rows':_0x267f38});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x57ffbf){var _0x2e8b4e=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5e')]);_0x57ffbf({'count':_0x2e8b4e['length'],'rows':_0x2e8b4e});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4b35a9){var _0x37eca9=_[_0x7cf3('0x4e')](_0x5a9ead[_0x7cf3('0x5f')]);_0x4b35a9({'count':_0x37eca9[_0x7cf3('0x18')],'rows':_0x37eca9});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2df3f5){var _0xd19125=_['values'](_0x5a9ead[_0x7cf3('0x60')]);_0x2df3f5({'count':_0xd19125[_0x7cf3('0x18')],'rows':_0xd19125});});}};var _0x13f5c4=jayson[_0x7cf3('0x61')](_0x11b967)[_0x7cf3('0x62')]();_0x13f5c4['on'](_0x7cf3('0x36'),function(_0x21120f){logger[_0x7cf3('0x36')](JSON[_0x7cf3('0x63')](_0x21120f));return _0x3f4338(_0x21120f);});_0x13f5c4[_0x7cf3('0x10')](0x232c,_0x7cf3('0x64'),function(){console[_0x7cf3('0x65')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x2b477e(_0x7cf3('0x66')+0x232c);});});}; \ No newline at end of file +var _0xdf4d=['http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','map','Intervals','interval','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','length','join','app','toLowerCase','appdata','split','mail','push','slice','dialogflow','amazonlex','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','stack','agent','agents','end','update','UserId','catch','error\x20update\x20queue\x20report','busyQueue','message\x20is\x20empty','hasOwnProperty','capacity','agent\x20not\x20found','chatQueues','name','paused','waiting','mailQueues','available','openchannelQueues','loggedIn','smsQueues','faxQueues','whatsappQueues','values','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server'];(function(_0x3decce,_0x6b2739){var _0x49b330=function(_0x2e9ea7){while(--_0x2e9ea7){_0x3decce['push'](_0x3decce['shift']());}};_0x49b330(++_0x6b2739);}(_0xdf4d,0xcb));var _0xddf4=function(_0x26199c,_0x5edb0c){_0x26199c=_0x26199c-0x0;var _0x58f248=_0xdf4d[_0x26199c];return _0x58f248;};'use strict';var _=require('lodash');var util=require(_0xddf4('0x0'));var path=require(_0xddf4('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xddf4('0x2'));var utils=require(_0xddf4('0x3'));var sUtils=require(_0xddf4('0x4'));var logger=require(_0xddf4('0x5'))(_0xddf4('0x6'));var rpc={'openchannelQueueReport':require(_0xddf4('0x7')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xddf4('0x8')),'faxQueueReport':require(_0xddf4('0x9')),'whatsappQueueReport':require(_0xddf4('0xa'))};var RuleEngine=require(_0xddf4('0xb'));function getId(_0x2d2ccd,_0x76de3b,_0x3ab323){return util[_0xddf4('0xc')](_0xddf4('0xd'),_0x2d2ccd,_0x76de3b||0x0,_0x3ab323||0x0);}function getIntervals(_0x1e76fd,_0x338210){var _0x52f69f=[];if(!_[_0xddf4('0xe')](_0x338210['IntervalId'])&&!_[_0xddf4('0xe')](_0x1e76fd[_0x338210[_0xddf4('0xf')]])&&!_[_0xddf4('0xe')](_0x1e76fd[_0x338210[_0xddf4('0xf')]]['Intervals'])){_0x52f69f=_[_0xddf4('0x10')](_0x1e76fd[_0x338210[_0xddf4('0xf')]][_0xddf4('0x11')],_0xddf4('0x12'));}else if(!_['isNil'](_0x338210['interval'])){_0x52f69f=[_0x338210[_0xddf4('0x12')]];}return _0x52f69f;}exports['listen']=function(_0x1d3773){_0x1d3773[_0xddf4('0x13')]={};return new BPromise(function(_0x3754f5,_0x276ab2){var _0x3ef3a1={'Start':function(_0x48412e){var _0x151b7b=this;return new Promise(function(_0x5a8cba,_0x13c576){if(_0x48412e){try{var _0x464288=[];var _0x111e2e=getId(_0x48412e[_0xddf4('0x14')],_0x48412e[_0xddf4('0x15')]?_0x48412e[_0xddf4('0x15')]['id']:0x0,_0x48412e[_0xddf4('0x16')]?_0x48412e['interaction']['id']:0x0);var _0x49e4d3=sUtils[_0xddf4('0x17')](_0x1d3773,_0x48412e);if(_0x48412e[_0xddf4('0x18')]||!_0x49e4d3&&_0x48412e['applications']&&_['isArray'](_0x48412e['applications'])&&_0x48412e[_0xddf4('0x19')][_0xddf4('0x1a')]){for(var _0x459a71=0x0;_0x459a71<_0x48412e[_0xddf4('0x19')][_0xddf4('0x1a')];_0x459a71+=0x1){var _0x56ec8f=_0x48412e[_0xddf4('0x19')][_0x459a71];if(fs['existsSync'](path[_0xddf4('0x1b')](__dirname,_0xddf4('0x19'),_0x56ec8f[_0xddf4('0x1c')]+'.js'))){var _0x1f7a04=[];switch(_0x56ec8f[_0xddf4('0x1c')][_0xddf4('0x1d')]()){case'autoreply':var _0x2ee748=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');if(_0x48412e[_0xddf4('0x14')]===_0xddf4('0x20')){_0x1f7a04[_0xddf4('0x21')](_0x2ee748[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x2ee748[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x2ee748[_0xddf4('0x22')](0x2,_0x2ee748[_0xddf4('0x1a')])[_0xddf4('0x1b')](','));}else{_0x1f7a04['push'](_0x2ee748[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x2ee748['slice'](0x1,_0x2ee748[_0xddf4('0x1a')])[_0xddf4('0x1b')](','));}break;case _0xddf4('0x23'):var _0x67dbb1=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');_0x1f7a04[_0xddf4('0x21')](_0x67dbb1[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x67dbb1[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x67dbb1[_0xddf4('0x22')](0x2,_0x67dbb1[_0xddf4('0x1a')])['join'](','));break;case'dialogflowv2':var _0x5980f7=_0x56ec8f[_0xddf4('0x1e')]['split'](',');_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x2]);_0x1f7a04[_0xddf4('0x21')](_0x5980f7[0x3]);_0x1f7a04['push'](_0x5980f7['slice'](0x4,_0x5980f7[_0xddf4('0x1a')])[_0xddf4('0x1b')](','));break;case _0xddf4('0x24'):var _0x4f5d91=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');_0x1f7a04[_0xddf4('0x21')](_0x4f5d91[0x0]);_0x1f7a04['push'](_0x4f5d91[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x4f5d91[0x2]);_0x1f7a04[_0xddf4('0x21')](_0x4f5d91[0x3]);_0x1f7a04['push'](_0x4f5d91['slice'](0x4,_0x4f5d91[_0xddf4('0x1a')])['join'](','));break;case _0xddf4('0x15'):_0x1f7a04[_0xddf4('0x21')](_0x56ec8f['appdata']);break;case'tag':_0x1f7a04[_0xddf4('0x21')](_0x56ec8f['TagId']);_0x1f7a04[_0xddf4('0x21')](_0x56ec8f[_0xddf4('0x1e')]);break;case _0xddf4('0x25'):var _0x3c2c21=utils[_0xddf4('0x26')](_0x48412e[_0xddf4('0x27')][_0xddf4('0x28')],_0x48412e);var _0x4715b6=_0x56ec8f[_0xddf4('0x1e')][_0xddf4('0x1f')](',');_0x1f7a04['push'](_0x4715b6[0x0]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x1]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x2]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x3]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x4]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x5]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x6]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x7]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x8]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0x9]);_0x1f7a04[_0xddf4('0x21')](_0x4715b6[0xa]);_0x1f7a04[_0xddf4('0x21')](_0x48412e[_0xddf4('0x16')]['id']);_0x1f7a04[_0xddf4('0x21')](_0x48412e['message']['id']);_0x1f7a04[_0xddf4('0x21')](_0x56ec8f[_0xddf4('0x29')]);_0x1f7a04['push'](_0x48412e[_0xddf4('0x16')][_0xddf4('0x2a')]);_0x1f7a04[_0xddf4('0x21')](_0x48412e[_0xddf4('0x2b')][_0xddf4('0x2b')]);_0x1f7a04[_0xddf4('0x21')](_0x3c2c21);break;default:_0x1f7a04=_[_0xddf4('0xe')](_0x56ec8f[_0xddf4('0x1e')])?[]:_0x56ec8f['appdata'][_0xddf4('0x1f')](',');}var _0x5231d5={'id':util['format'](_0xddf4('0x2c'),_0x111e2e,_0x56ec8f['id'],_0x56ec8f[_0xddf4('0x1c')]),'condition':require(_0xddf4('0x2d'))[_0xddf4('0x2e')](_0x111e2e,getIntervals(_0x1d3773[_0xddf4('0x2f')],_0x56ec8f),_0x1d3773),'consequence':require('./applications/'+_0x56ec8f[_0xddf4('0x1c')])[_0xddf4('0x30')](_0x111e2e,_0x1f7a04,_0x1d3773,_0x48412e),'p':_0x56ec8f[_0xddf4('0x31')]||0x0};logger[_0xddf4('0x32')](_0xddf4('0x33'),_0x5231d5['id'],_0xddf4('0x34'),getIntervals(_0x1d3773[_0xddf4('0x2f')],_0x56ec8f)[_0xddf4('0x1b')](_0xddf4('0x35')));_0x464288[_0xddf4('0x21')](_0x5231d5);}else{logger[_0xddf4('0x36')](_0xddf4('0x37'),path[_0xddf4('0x1b')](__dirname,'applications',_0x56ec8f[_0xddf4('0x1c')]+_0xddf4('0x38')));}}_0x1d3773['rules'][_0x111e2e]=new RuleEngine(_0x464288);_0x1d3773[_0xddf4('0x13')][_0x111e2e][_0xddf4('0x39')](_0x48412e,function(_0x21d4f3){logger[_0xddf4('0x32')](_0xddf4('0x3a'),JSON[_0xddf4('0x3b')](_0x21d4f3[_0xddf4('0x3c')]));if(_0x1d3773[_0xddf4('0x13')][_0x111e2e]){_0x1d3773[_0xddf4('0x13')][_0x111e2e][_0xddf4('0x3d')](_0xddf4('0x3e'));}});return _0x5a8cba({'code':0xc8,'message':_0x48412e});}else{if(_0x49e4d3){logger[_0xddf4('0x32')](util['format']('Skipped\x20routing\x20for\x20%s',_0x111e2e));}else{logger[_0xddf4('0x32')](_0xddf4('0x3f'));}return _0x5a8cba({'code':0xc8,'message':_0x48412e});}}catch(_0x211ea9){logger[_0xddf4('0x36')](_0x211ea9[_0xddf4('0x40')]);return _0x13c576(_0x151b7b[_0xddf4('0x36')](0x1f4,_0x211ea9));}}return _0x13c576('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2c9db6){var _0x7953bd=this;return new Promise(function(_0x584395,_0x2053f0){if(_0x2c9db6[_0xddf4('0x41')]&&_0x2c9db6[_0xddf4('0x41')]['id']){if(_0x1d3773[_0xddf4('0x42')][_0x2c9db6['agent']['id']]){_0x1d3773[_0xddf4('0x42')][_0x2c9db6[_0xddf4('0x41')]['id']]['busy']=![];_0x1d3773['agents'][_0x2c9db6[_0xddf4('0x41')]['id']]['busyQueue']=undefined;}}if(_0x2c9db6[_0xddf4('0x15')]&&_0x2c9db6[_0xddf4('0x15')]['id']){try{var _0x303d34=getId(_0x2c9db6[_0xddf4('0x14')],_0x2c9db6['message']?_0x2c9db6[_0xddf4('0x15')]['id']:0x0,_0x2c9db6[_0xddf4('0x16')]?_0x2c9db6['interaction']['id']:0x0);if(_0x1d3773[_0xddf4('0x13')][_0x303d34]){_0x1d3773['rules'][_0x303d34][_0xddf4('0x3d')](_0xddf4('0x43'));if(rpc[_0x2c9db6[_0xddf4('0x14')]+'QueueReport']){rpc[_0x2c9db6[_0xddf4('0x14')]+'QueueReport'][_0xddf4('0x44')](_0x303d34,{'UserId':_0x2c9db6['message'][_0xddf4('0x45')]})[_0xddf4('0x46')](function(){logger[_0xddf4('0x36')](_0xddf4('0x47'));});}}return _0x584395({'code':0xc8,'message':_0x2c9db6});}catch(_0x112eca){logger['error'](_0x112eca[_0xddf4('0x40')]);return _0x2053f0(_0x7953bd[_0xddf4('0x36')](0x1f4,_0x112eca));}}logger[_0xddf4('0x36')]('message\x20is\x20empty');return _0x2053f0(_0x7953bd[_0xddf4('0x36')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x184c25){var _0x1c49a0=this;return new Promise(function(_0x7e031b,_0x196e96){if(_0x184c25[_0xddf4('0x41')]&&_0x184c25[_0xddf4('0x41')]['id']){try{if(_0x1d3773['agents'][_0x184c25[_0xddf4('0x41')]['id']]){_0x1d3773[_0xddf4('0x42')][_0x184c25[_0xddf4('0x41')]['id']]['busy']=![];_0x1d3773[_0xddf4('0x42')][_0x184c25[_0xddf4('0x41')]['id']][_0xddf4('0x48')]=undefined;}return _0x7e031b({'code':0xc8,'message':_0x184c25});}catch(_0x2789c4){logger[_0xddf4('0x36')](_0x2789c4['stack']);return _0x196e96(_0x1c49a0['error'](0x1f4,_0x2789c4));}}logger['error'](_0xddf4('0x49'));return _0x196e96(_0x1c49a0[_0xddf4('0x36')](0x1f4,_0xddf4('0x49')));});},'AbandonInteraction':function(_0x36f286){var _0x1ae44c=this;return new Promise(function(_0x5c46b0,_0x841198){if(_0x36f286[_0xddf4('0x14')]&&_0x36f286[_0xddf4('0x16')]&&_0x36f286['interaction']['id']){try{var _0x364812=getId(_0x36f286[_0xddf4('0x14')],_0x36f286[_0xddf4('0x15')]?_0x36f286['message']['id']:0x0,_0x36f286[_0xddf4('0x16')]?_0x36f286[_0xddf4('0x16')]['id']:0x0);if(_0x1d3773['rules'][_0x364812]){_0x1d3773[_0xddf4('0x13')][_0x364812][_0xddf4('0x3d')](_0xddf4('0x43'));}return _0x5c46b0({'code':0xc8,'message':_0x36f286});}catch(_0x1d06ea){logger[_0xddf4('0x36')](_0x1d06ea['stack']);return _0x841198(_0x1ae44c[_0xddf4('0x36')](0x1f4,_0x1d06ea));}}logger[_0xddf4('0x36')](_0xddf4('0x49'));return _0x841198(_0x1ae44c[_0xddf4('0x36')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x32dfbf){var _0x1b1a8c=this;return new Promise(function(_0x2eca89,_0x3ff134){if(_0x1d3773[_0xddf4('0x42')][_0xddf4('0x4a')](_0x32dfbf['id'])){for(var _0x2ed603 in _0x32dfbf[_0xddf4('0x4b')]){if(_0x32dfbf[_0xddf4('0x4b')][_0xddf4('0x4a')](_0x2ed603)){if(_0x1d3773[_0xddf4('0x42')][_0x32dfbf['id']][_0xddf4('0x4a')](_0x2ed603+'CurrentCapacity')){_0x1d3773[_0xddf4('0x42')][_0x32dfbf['id']][_0x2ed603+'CurrentCapacity']=parseInt(_0x32dfbf['capacity'][_0x2ed603],0xa);}}}_0x1d3773[_0xddf4('0x42')][_0x32dfbf['id']]['updateRealtime']();return _0x2eca89({'code':0xc8,'message':_0x1d3773['agents'][_0x32dfbf['id']]});}else{return _0x3ff134(_0x1b1a8c[_0xddf4('0x36')](0x1f4,_0xddf4('0x4c')));}});},'Agents':function(_0x30081b){return new Promise(function(_0x461073){var _0x329bd1=_['values'](_0x1d3773['agents']);if(_0x30081b&&_0x30081b['id']){var _0x1c18f1=_['find'](_0x329bd1,function(_0x42ff2a){return _0x42ff2a['id']===_0x30081b['id'];});_0x461073(_0x1c18f1);}else{_0x461073({'count':_0x329bd1[_0xddf4('0x1a')],'rows':_0x329bd1});}});},'ChatQueues':function(){return new Promise(function(_0x48e8a4){var _0xac7777=[];for(var _0x3c75e1 in _0x1d3773[_0xddf4('0x4d')]){if(_0x1d3773[_0xddf4('0x4d')][_0xddf4('0x4a')](_0x3c75e1)){var _0x372b63=_0x1d3773['chatQueues'][_0x3c75e1];var _0x4c2ad9={'id':_0x372b63['id'],'available':_0x372b63['available'],'loggedIn':_0x372b63['loggedIn'],'name':_0x372b63[_0xddf4('0x4e')],'paused':_0x372b63[_0xddf4('0x4f')],'waiting':_0x372b63[_0xddf4('0x50')]};_0xac7777[_0xddf4('0x21')](_0x4c2ad9);}}_0x48e8a4({'count':_0xac7777[_0xddf4('0x1a')],'rows':_0xac7777});});},'MailQueues':function(){return new Promise(function(_0x24612f){var _0xb7b514=[];for(var _0x58caf1 in _0x1d3773[_0xddf4('0x51')]){if(_0x1d3773[_0xddf4('0x51')][_0xddf4('0x4a')](_0x58caf1)){var _0x52fa38=_0x1d3773[_0xddf4('0x51')][_0x58caf1];var _0x514a40={'id':_0x52fa38['id'],'available':_0x52fa38[_0xddf4('0x52')],'loggedIn':_0x52fa38['loggedIn'],'name':_0x52fa38[_0xddf4('0x4e')],'paused':_0x52fa38[_0xddf4('0x4f')],'waiting':_0x52fa38[_0xddf4('0x50')]};_0xb7b514[_0xddf4('0x21')](_0x514a40);}}_0x24612f({'count':_0xb7b514[_0xddf4('0x1a')],'rows':_0xb7b514});});},'OpenchannelQueues':function(){return new Promise(function(_0x38c7e0){var _0x35de40=[];for(var _0x340ee8 in _0x1d3773[_0xddf4('0x53')]){if(_0x1d3773[_0xddf4('0x53')][_0xddf4('0x4a')](_0x340ee8)){var _0x37b462=_0x1d3773[_0xddf4('0x53')][_0x340ee8];var _0xe37710={'id':_0x37b462['id'],'available':_0x37b462[_0xddf4('0x52')],'loggedIn':_0x37b462[_0xddf4('0x54')],'name':_0x37b462[_0xddf4('0x4e')],'paused':_0x37b462['paused'],'waiting':_0x37b462['waiting']};_0x35de40[_0xddf4('0x21')](_0xe37710);}}_0x38c7e0({'count':_0x35de40[_0xddf4('0x1a')],'rows':_0x35de40});});},'SmsQueues':function(){return new Promise(function(_0x1a700b){var _0xd9034b=[];for(var _0x332fbf in _0x1d3773[_0xddf4('0x55')]){if(_0x1d3773['smsQueues'][_0xddf4('0x4a')](_0x332fbf)){var _0x296714=_0x1d3773[_0xddf4('0x55')][_0x332fbf];var _0x4c47e2={'id':_0x296714['id'],'available':_0x296714[_0xddf4('0x52')],'loggedIn':_0x296714[_0xddf4('0x54')],'name':_0x296714[_0xddf4('0x4e')],'paused':_0x296714[_0xddf4('0x4f')],'waiting':_0x296714[_0xddf4('0x50')]};_0xd9034b[_0xddf4('0x21')](_0x4c47e2);}}_0x1a700b({'count':_0xd9034b[_0xddf4('0x1a')],'rows':_0xd9034b});});},'FaxQueues':function(){return new Promise(function(_0x53619b){var _0x417db4=[];for(var _0xc2bf9e in _0x1d3773[_0xddf4('0x56')]){if(_0x1d3773[_0xddf4('0x56')]['hasOwnProperty'](_0xc2bf9e)){var _0x525548=_0x1d3773[_0xddf4('0x56')][_0xc2bf9e];var _0x382ac7={'id':_0x525548['id'],'available':_0x525548['available'],'loggedIn':_0x525548[_0xddf4('0x54')],'name':_0x525548[_0xddf4('0x4e')],'paused':_0x525548[_0xddf4('0x4f')],'waiting':_0x525548[_0xddf4('0x50')]};_0x417db4[_0xddf4('0x21')](_0x382ac7);}}_0x53619b({'count':_0x417db4['length'],'rows':_0x417db4});});},'WhatsappQueues':function(){return new Promise(function(_0x4a286b){var _0x275572=[];for(var _0x1c1976 in _0x1d3773['whatsappQueues']){if(_0x1d3773[_0xddf4('0x57')][_0xddf4('0x4a')](_0x1c1976)){var _0x563ce0=_0x1d3773[_0xddf4('0x57')][_0x1c1976];var _0x536dc2={'id':_0x563ce0['id'],'available':_0x563ce0[_0xddf4('0x52')],'loggedIn':_0x563ce0['loggedIn'],'name':_0x563ce0[_0xddf4('0x4e')],'paused':_0x563ce0['paused'],'waiting':_0x563ce0['waiting']};_0x275572[_0xddf4('0x21')](_0x536dc2);}}_0x4a286b({'count':_0x275572[_0xddf4('0x1a')],'rows':_0x275572});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x38c764){var _0x49d894=_[_0xddf4('0x58')](_0x1d3773['chatQueuesWaitingInteractions']);_0x38c764({'count':_0x49d894[_0xddf4('0x1a')],'rows':_0x49d894});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x52e6e8){var _0x152ca7=_['values'](_0x1d3773[_0xddf4('0x59')]);_0x52e6e8({'count':_0x152ca7[_0xddf4('0x1a')],'rows':_0x152ca7});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x5bffb4){var _0x426d55=_[_0xddf4('0x58')](_0x1d3773['openchannelQueuesWaitingInteractions']);_0x5bffb4({'count':_0x426d55[_0xddf4('0x1a')],'rows':_0x426d55});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2af3bd){var _0xb1325=_[_0xddf4('0x58')](_0x1d3773[_0xddf4('0x5a')]);_0x2af3bd({'count':_0xb1325[_0xddf4('0x1a')],'rows':_0xb1325});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x59259c){var _0x3f6d68=_['values'](_0x1d3773[_0xddf4('0x5b')]);_0x59259c({'count':_0x3f6d68[_0xddf4('0x1a')],'rows':_0x3f6d68});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x26273f){var _0x4ffd49=_[_0xddf4('0x58')](_0x1d3773[_0xddf4('0x5c')]);_0x26273f({'count':_0x4ffd49[_0xddf4('0x1a')],'rows':_0x4ffd49});});}};var _0x499d50=jayson[_0xddf4('0x5d')](_0x3ef3a1)[_0xddf4('0x5e')]();_0x499d50['on'](_0xddf4('0x36'),function(_0x247acc){logger['error'](JSON[_0xddf4('0x3b')](_0x247acc));return _0x276ab2(_0x247acc);});_0x499d50['listen'](0x232c,_0xddf4('0x5f'),function(){console[_0xddf4('0x60')](_0xddf4('0x61'),0x232c);return _0x3754f5(_0xddf4('0x62')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index c18f339..47bd10d 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 _0x9cbc=['routing','client','http','then','error','message','result','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','format','iftime\x20%s','indexOf','true','[%s][INTERVAL]\x20%s','all','some','info','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','join','stack','stop','util','jayson/promise'];(function(_0x4864f2,_0x2d13a5){var _0x34e355=function(_0x318ef4){while(--_0x318ef4){_0x4864f2['push'](_0x4864f2['shift']());}};_0x34e355(++_0x2d13a5);}(_0x9cbc,0x14e));var _0xc9cb=function(_0x41f55e,_0x264009){_0x41f55e=_0x41f55e-0x0;var _0x922b33=_0x9cbc[_0x41f55e];return _0x922b33;};'use strict';var util=require(_0xc9cb('0x0'));var BPromise=require('bluebird');var jayson=require(_0xc9cb('0x1'));var _=require('lodash');var logger=require('../../../config/logger')(_0xc9cb('0x2'));var client=jayson[_0xc9cb('0x3')][_0xc9cb('0x4')]({'port':0x232a});function request(_0x435567,_0x57c4cd){return new BPromise(function(_0x4c5a7d,_0x3d5a6d){return client['request'](_0x435567,_0x57c4cd)[_0xc9cb('0x5')](function(_0x4a9cce){if(_0x4a9cce[_0xc9cb('0x6')]){return _0x3d5a6d(_0x4a9cce[_0xc9cb('0x6')][_0xc9cb('0x7')]);}else{return _0x4c5a7d(_0x4a9cce[_0xc9cb('0x8')]);}})[_0xc9cb('0x9')](function(_0x26cc89){return _0x3d5a6d(_0x26cc89);});});}exports[_0xc9cb('0xa')]=function(_0x4297a1,_0x5a0e0e,_0xd7bfc8){return function(_0x271a0f){if(_0xd7bfc8[_0xc9cb('0xb')]&&!_0xd7bfc8[_0xc9cb('0xb')][_0x4297a1]){logger['info'](_0xc9cb('0xc'),_0x4297a1);return _0x271a0f['stop']();}var _0x1231b8=[];for(var _0x256830=0x0;_0x256830<_0x5a0e0e[_0xc9cb('0xd')];_0x256830+=0x1){_0x1231b8['push'](request('Command',{'command':util[_0xc9cb('0xe')](_0xc9cb('0xf'),_0x5a0e0e[_0x256830])})[_0xc9cb('0x5')](function(_0x2069d0){return _0x2069d0&&_0x2069d0[_0xc9cb('0x7')]&&_0x2069d0[_0xc9cb('0x7')][_0xc9cb('0x10')](_0xc9cb('0x11'))>=0x0?!![]:![];})[_0xc9cb('0x9')](function(){logger[_0xc9cb('0x6')](_0xc9cb('0x12'),_0x4297a1,_0x5a0e0e[_0x256830]);}));}BPromise[_0xc9cb('0x13')](_0x1231b8)[_0xc9cb('0x5')](function(_0x2b20b5){var _0x33e02e=_[_0xc9cb('0x14')](_0x2b20b5);logger[_0xc9cb('0x15')](_0xc9cb('0x16'),_0x4297a1,_0x5a0e0e['join'](_0xc9cb('0x17')),_0x33e02e);_0x271a0f[_0xc9cb('0x18')](_0x33e02e);})[_0xc9cb('0x9')](function(_0x31dd8b){logger[_0xc9cb('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x4297a1,_0x5a0e0e[_0xc9cb('0x19')](_0xc9cb('0x17')),_0x31dd8b[_0xc9cb('0x1a')]);_0x271a0f[_0xc9cb('0x1b')]();});};}; \ No newline at end of file +var _0x7e0c=['stack','stop','bluebird','jayson/promise','lodash','../../../config/logger','http','request','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','push','format','iftime\x20%s','then','indexOf','true','catch','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when'];(function(_0x30cb22,_0x8cea7a){var _0x1b8ebb=function(_0x54fb88){while(--_0x54fb88){_0x30cb22['push'](_0x30cb22['shift']());}};_0x1b8ebb(++_0x8cea7a);}(_0x7e0c,0xfe));var _0xc7e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e0c[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var BPromise=require(_0xc7e0('0x0'));var jayson=require(_0xc7e0('0x1'));var _=require(_0xc7e0('0x2'));var logger=require(_0xc7e0('0x3'))('routing');var client=jayson['client'][_0xc7e0('0x4')]({'port':0x232a});function request(_0xd486b8,_0x429af1){return new BPromise(function(_0x55d763,_0x409240){return client[_0xc7e0('0x5')](_0xd486b8,_0x429af1)['then'](function(_0x436ec9){if(_0x436ec9['error']){return _0x409240(_0x436ec9[_0xc7e0('0x6')][_0xc7e0('0x7')]);}else{return _0x55d763(_0x436ec9[_0xc7e0('0x8')]);}})['catch'](function(_0x5b5cfd){return _0x409240(_0x5b5cfd);});});}exports['condition']=function(_0x2c40ff,_0x43b506,_0x551f0f){return function(_0x128975){if(_0x551f0f[_0xc7e0('0x9')]&&!_0x551f0f[_0xc7e0('0x9')][_0x2c40ff]){logger[_0xc7e0('0xa')](_0xc7e0('0xb'),_0x2c40ff);return _0x128975['stop']();}var _0x33c8d0=[];for(var _0x36250f=0x0;_0x36250f<_0x43b506['length'];_0x36250f+=0x1){_0x33c8d0[_0xc7e0('0xc')](request('Command',{'command':util[_0xc7e0('0xd')](_0xc7e0('0xe'),_0x43b506[_0x36250f])})[_0xc7e0('0xf')](function(_0x48481b){return _0x48481b&&_0x48481b[_0xc7e0('0x7')]&&_0x48481b['message'][_0xc7e0('0x10')](_0xc7e0('0x11'))>=0x0?!![]:![];})[_0xc7e0('0x12')](function(){logger[_0xc7e0('0x6')](_0xc7e0('0x13'),_0x2c40ff,_0x43b506[_0x36250f]);}));}BPromise[_0xc7e0('0x14')](_0x33c8d0)[_0xc7e0('0xf')](function(_0x52283e){var _0x8c58e0=_[_0xc7e0('0x15')](_0x52283e);logger['info'](_0xc7e0('0x16'),_0x2c40ff,_0x43b506[_0xc7e0('0x17')](_0xc7e0('0x18')),_0x8c58e0);_0x128975[_0xc7e0('0x19')](_0x8c58e0);})['catch'](function(_0x200189){logger[_0xc7e0('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x2c40ff,_0x43b506[_0xc7e0('0x17')](_0xc7e0('0x18')),_0x200189[_0xc7e0('0x1a')]);_0x128975[_0xc7e0('0x1b')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 549f051..94a5740 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 _0xf109=['transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','transferuniqueid','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfer','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','agentcalledAt','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','./utils','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','then','type','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','now','called','info','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','error','queuecallerabandon','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connectedlinename','forIn','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer'];(function(_0x3e535b,_0x43d4e6){var _0x6887a2=function(_0x5bf467){while(--_0x5bf467){_0x3e535b['push'](_0x3e535b['shift']());}};_0x6887a2(++_0x43d4e6);}(_0xf109,0xce));var _0x9f10=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0xf109[_0x4ed520];return _0x4415a6;};'use strict';var _=require(_0x9f10('0x0'));var util=require(_0x9f10('0x1'));var utils=require(_0x9f10('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5d2950,_0x5b381d){utils['info'](util[_0x9f10('0x3')](_0x9f10('0x4'),_0x5d2950[_0x9f10('0x5')],_0x5d2950[_0x9f10('0x6')],_0x5d2950[_0x9f10('0x7')],_0x5d2950[_0x9f10('0x8')],_0x5d2950[_0x9f10('0x9')],_0x5d2950[_0x9f10('0xa')],_0x5d2950[_0x9f10('0xb')],_0x5d2950[_0x9f10('0xc')]));if(_0x5d2950[_0x9f10('0x7')]){utils['getVoiceQueueByName'](_0x5d2950[_0x9f10('0x7')])[_0x9f10('0xd')](function(_0x1a0668){if(_0x1a0668){_0x5d2950[_0x9f10('0xe')]=_0x1a0668[_0x9f10('0xe')];_0x5d2950['agentacw']=_0x5d2950[_0x9f10('0xf')]?_0x1a0668[_0x9f10('0x10')]:![];_0x5d2950[_0x9f10('0x11')]=_0x5d2950['agentacw']?_0x1a0668['acwTimeout']:0x0;}utils[_0x9f10('0x12')](_0x9f10('0x13'),_0x5d2950);});}else{utils[_0x9f10('0x12')]('CreateVoiceAgentReport',_0x5d2950);}if(_0x5b381d){delete transfers[_0x5d2950[_0x9f10('0x5')]];}else{delete agents[_0x5d2950[_0x9f10('0x14')]];}}exports[_0x9f10('0x15')]=function(_0x58067f){try{utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][agentcalled]',_0x58067f[_0x9f10('0x5')]),_0x58067f);agents[_0x58067f[_0x9f10('0x14')]]=_0x58067f;agents[_0x58067f['destuniqueid']]['agentcalledAt']=utils[_0x9f10('0x17')]();agents[_0x58067f[_0x9f10('0x14')]]['lastevent']=_0x9f10('0x18');agents[_0x58067f['destuniqueid']][_0x9f10('0xb')]=null;agents[_0x58067f[_0x9f10('0x14')]]['connectedlinename']=null;utils[_0x9f10('0x19')](util[_0x9f10('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x58067f[_0x9f10('0x5')],agents[_0x58067f['destuniqueid']][_0x9f10('0x8')],_0x58067f['destuniqueid']));}catch(_0x2c5064){utils['error'](util['format'](_0x9f10('0x1a'),_0x58067f[_0x9f10('0x5')]),_0x2c5064);}};exports[_0x9f10('0x1b')]=function(_0x3a78be){try{if(!_[_0x9f10('0x1c')](agents[_0x3a78be[_0x9f10('0x14')]])){utils[_0x9f10('0x16')](util['format'](_0x9f10('0x1d'),_0x3a78be['uniqueid']),_0x3a78be);utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x1e'),_0x3a78be['uniqueid'],agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x8')],_0x3a78be[_0x9f10('0x14')]));agents[_0x3a78be['destuniqueid']][_0x9f10('0x1b')]=!![];agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x1f')]=utils['now']();agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0xc')]=_0x9f10('0x20');agents[_0x3a78be[_0x9f10('0x14')]]['reason']='timeout';agents[_0x3a78be['destuniqueid']][_0x9f10('0x21')]=_0x3a78be['ringtime']?parseInt(_0x3a78be[_0x9f10('0x22')])/0x3e8:0x0;agents[_0x3a78be[_0x9f10('0x14')]][_0x9f10('0x23')]=0x0;unanswered[_0x9f10('0x24')](_0x3a78be[_0x9f10('0x14')]);}}catch(_0x4f6b0c){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x1d'),_0x3a78be[_0x9f10('0x5')]),_0x4f6b0c);}};exports[_0x9f10('0x26')]=function(_0x2c4373){try{_['forIn'](agents,function(_0x358d3f,_0x501ee){if(_0x358d3f[_0x9f10('0x5')]==_0x2c4373[_0x9f10('0x5')]&&!_['includes'](unanswered,_0x358d3f[_0x9f10('0x14')])){utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][queuecallerabandon]',_0x2c4373[_0x9f10('0x5')]),_0x2c4373);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x27'),_0x2c4373[_0x9f10('0x5')],_0x358d3f['membername'],_0x358d3f[_0x9f10('0x14')]));_0x358d3f[_0x9f10('0x1b')]=!![];_0x358d3f[_0x9f10('0x1f')]=utils[_0x9f10('0x17')]();_0x358d3f[_0x9f10('0xc')]='abandoned';_0x358d3f[_0x9f10('0x28')]='abandoned';_0x358d3f[_0x9f10('0x21')]=_0x2c4373[_0x9f10('0x21')];_0x358d3f[_0x9f10('0x23')]=0x0;writeDB(_0x358d3f);}});}catch(_0x11ee9c){utils[_0x9f10('0x25')](util[_0x9f10('0x3')]('[%s][agents][queuecallerabandon]',_0x2c4373[_0x9f10('0x5')]),_0x11ee9c);}};exports[_0x9f10('0x29')]=function(_0x1b8018){try{if(agents[_0x1b8018['destuniqueid']]){utils[_0x9f10('0x16')](util[_0x9f10('0x3')]('[%s][agents][agentconnect]',_0x1b8018[_0x9f10('0x5')]),_0x1b8018);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x2a'),_0x1b8018[_0x9f10('0x5')],agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0x8')],_0x1b8018[_0x9f10('0x14')]));agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0x2b')]=utils['now']();agents[_0x1b8018[_0x9f10('0x14')]][_0x9f10('0xb')]=_0x1b8018[_0x9f10('0xb')];agents[_0x1b8018['destuniqueid']][_0x9f10('0x2c')]=_0x1b8018[_0x9f10('0x2c')];agents[_0x1b8018['destuniqueid']][_0x9f10('0x21')]=_0x1b8018[_0x9f10('0x22')];agents[_0x1b8018[_0x9f10('0x14')]]['lastevent']='connect';_[_0x9f10('0x2d')](agents,function(_0x2ff98d,_0x1deed4){if(_0x2ff98d[_0x9f10('0x14')]!=_0x1b8018[_0x9f10('0x14')]&&_0x2ff98d[_0x9f10('0x5')]==_0x1b8018[_0x9f10('0x5')]){_0x2ff98d[_0x9f10('0x23')]=0x0;_0x2ff98d[_0x9f10('0x21')]=_0x1b8018[_0x9f10('0x22')];_0x2ff98d[_0x9f10('0x1b')]=!![];_0x2ff98d[_0x9f10('0x1f')]=utils['now']();_0x2ff98d['lastevent']='answered_elsewhere';_0x2ff98d[_0x9f10('0x28')]='answered_elsewhere';_0x2ff98d[_0x9f10('0x2e')]=_0x1b8018[_0x9f10('0x14')];_0x2ff98d[_0x9f10('0x2f')]=_0x1b8018['membername'];writeDB(_0x2ff98d);}});}}catch(_0x3cfce6){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x30'),_0x1b8018[_0x9f10('0x5')]),_0x3cfce6);}};exports['agentcomplete']=function(_0x578368){try{if(!_['isNil'](agents[_0x578368[_0x9f10('0x14')]])){utils['debug'](util[_0x9f10('0x3')]('[%s][agents][agentcomplete]',_0x578368[_0x9f10('0x5')]),_0x578368);utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x31'),_0x578368['uniqueid'],agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x8')],_0x578368['destuniqueid']));agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0xf')]=!![];agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x23')]=utils[_0x9f10('0x33')](agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0x32')],agents[_0x578368['destuniqueid']][_0x9f10('0x2b')]);agents[_0x578368[_0x9f10('0x14')]]['reason']=_0x578368[_0x9f10('0x28')];agents[_0x578368[_0x9f10('0x14')]][_0x9f10('0xc')]=_0x9f10('0x34');writeDB(agents[_0x578368['destuniqueid']]);}}catch(_0x283f04){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x35'),_0x578368[_0x9f10('0x5')]),_0x283f04);}};exports[_0x9f10('0x36')]=function(_0x479b46){try{if(!_[_0x9f10('0x1c')](agents[_0x479b46[_0x9f10('0x37')]])){utils[_0x9f10('0x16')](util[_0x9f10('0x3')](_0x9f10('0x38'),_0x479b46[_0x9f10('0x5')]),_0x479b46);utils['info'](util[_0x9f10('0x3')](_0x9f10('0x39'),_0x479b46[_0x9f10('0x5')],agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x8')],agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x5')]));agents[_0x479b46[_0x9f10('0x37')]]['transfer']=!![];agents[_0x479b46[_0x9f10('0x37')]]['transfertype']=_0x9f10('0x3a');agents[_0x479b46['transfereruniqueid']][_0x9f10('0x3b')]=_0x479b46[_0x9f10('0x3c')];agents[_0x479b46[_0x9f10('0x37')]][_0x9f10('0x3d')]=agents[_0x479b46[_0x9f10('0x37')]]['uniqueid'];}}catch(_0x12cf34){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x38'),_0x479b46['uniqueid']),_0x12cf34);}};exports['attendedtransfer']=function(_0x265f69){try{utils[_0x9f10('0x16')](util['format']('[%s][agents][attendedtransfer]',_0x265f69[_0x9f10('0x3e')]),_0x265f69);if(_0x265f69[_0x9f10('0x3e')]==_0x265f69[_0x9f10('0x3f')]){if(!_['isNil'](agents[_0x265f69[_0x9f10('0x40')]])){utils[_0x9f10('0x19')](util[_0x9f10('0x3')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x265f69[_0x9f10('0x3e')],agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x8')]));agents[_0x265f69['secondtransfereruniqueid']][_0x9f10('0x41')]=!![];agents[_0x265f69[_0x9f10('0x40')]]['transfertype']=_0x9f10('0x42');agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x3b')]=_0x265f69[_0x9f10('0x43')];agents[_0x265f69[_0x9f10('0x40')]]['transferuniqueid']=_0x265f69[_0x9f10('0x3e')];}if(_0x265f69['transfereeuniqueid']&&agents[_0x265f69['transfereeuniqueid']]){agents[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x45')]=0x1;transfers[_0x265f69[_0x9f10('0x44')]]=_[_0x9f10('0x46')](agents[_0x265f69[_0x9f10('0x44')]]);transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0xa')]=agents[_0x265f69['secondtransfereruniqueid']]['calleridnum'];transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x47')]=agents[_0x265f69[_0x9f10('0x40')]][_0x9f10('0x47')];transfers[_0x265f69[_0x9f10('0x44')]][_0x9f10('0x48')]=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfereeuniqueid']][_0x9f10('0x2b')]=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfereeuniqueid']][_0x9f10('0x21')]=0x0;transfers[_0x265f69[_0x9f10('0x44')]]['agententerreason']=0x2;}}else if(_0x265f69[_0x9f10('0x40')]==_0x265f69[_0x9f10('0x49')]){if(!_['isNil'](agents[_0x265f69[_0x9f10('0x3e')]])){utils['info'](util[_0x9f10('0x3')](_0x9f10('0x4a'),_0x265f69[_0x9f10('0x3e')],agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x8')]));agents[_0x265f69['origtransfereruniqueid']][_0x9f10('0x41')]=!![];agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x4b')]='ATTENDED';agents[_0x265f69['origtransfereruniqueid']][_0x9f10('0x3b')]=_0x265f69[_0x9f10('0x4c')];agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x3d')]=_0x265f69[_0x9f10('0x40')];}if(_0x265f69[_0x9f10('0x4d')]&&agents[_0x265f69[_0x9f10('0x4d')]]){agents[_0x265f69['transfertargetuniqueid']][_0x9f10('0x45')]=0x1;transfers[_0x265f69[_0x9f10('0x4d')]]=_['clone'](agents[_0x265f69[_0x9f10('0x4d')]]);transfers[_0x265f69['transfertargetuniqueid']][_0x9f10('0xa')]=agents[_0x265f69[_0x9f10('0x3e')]]['calleridnum'];transfers[_0x265f69[_0x9f10('0x4d')]]['calleridname']=agents[_0x265f69[_0x9f10('0x3e')]][_0x9f10('0x47')];transfers[_0x265f69[_0x9f10('0x4d')]]['agentcalledAt']=utils[_0x9f10('0x17')]();transfers[_0x265f69['transfertargetuniqueid']][_0x9f10('0x2b')]=utils[_0x9f10('0x17')]();transfers[_0x265f69[_0x9f10('0x4d')]]['holdtime']=0x0;transfers[_0x265f69[_0x9f10('0x4d')]]['agententerreason']=0x2;}}}catch(_0x5708c1){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x4e'),_0x265f69['origtransfereruniqueid']),_0x5708c1);}};exports[_0x9f10('0x4f')]=function(_0x5a64ae){try{utils['debug'](util[_0x9f10('0x3')]('[%s][agents][hangup]',_0x5a64ae['uniqueid']),_0x5a64ae);if(agents[_0x5a64ae[_0x9f10('0x5')]]&&agents[_0x5a64ae['uniqueid']][_0x9f10('0x28')]===_0x9f10('0x20')){if(_0x5a64ae[_0x9f10('0x50')]==='21'){agents[_0x5a64ae['uniqueid']][_0x9f10('0x28')]=_0x9f10('0x51');agents[_0x5a64ae['uniqueid']][_0x9f10('0xc')]='rejected';}utils['info'](util[_0x9f10('0x3')](_0x9f10('0x52'),_0x5a64ae[_0x9f10('0x5')],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x8')],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')],agents[_0x5a64ae['uniqueid']][_0x9f10('0xc')]));writeDB(agents[_0x5a64ae[_0x9f10('0x5')]]);var _0x27f337=unanswered[_0x9f10('0x53')](_0x5a64ae[_0x9f10('0x5')]);if(_0x27f337>-0x1){unanswered[_0x9f10('0x54')](_0x27f337,0x1);}}if(transfers[_0x5a64ae[_0x9f10('0x5')]]){transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xf')]=!![];transfers[_0x5a64ae['uniqueid']][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x23')]=utils['diffTime'](transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x2b')]);transfers[_0x5a64ae['uniqueid']]['reason']=_0x9f10('0x55');transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]=_0x9f10('0x34');utils[_0x9f10('0x19')](util[_0x9f10('0x3')](_0x9f10('0x52'),_0x5a64ae[_0x9f10('0x5')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x8')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')],transfers[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]));writeDB(transfers[_0x5a64ae[_0x9f10('0x5')]],!![]);}if(agents[_0x5a64ae['uniqueid']]&&agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x2b')]){agents[_0x5a64ae['uniqueid']][_0x9f10('0xf')]=!![];agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')]=utils[_0x9f10('0x17')]();agents[_0x5a64ae['uniqueid']][_0x9f10('0x23')]=utils['diffTime'](agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x32')],agents[_0x5a64ae[_0x9f10('0x5')]]['agentconnectAt']);agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0x28')]=agents[_0x5a64ae[_0x9f10('0x5')]]['transfer']?_0x9f10('0x41'):_0x9f10('0x55');agents[_0x5a64ae[_0x9f10('0x5')]]['lastevent']='complete';utils['info'](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5a64ae['uniqueid'],agents[_0x5a64ae['uniqueid']][_0x9f10('0x8')],agents[_0x5a64ae[_0x9f10('0x5')]]['reason'],agents[_0x5a64ae[_0x9f10('0x5')]][_0x9f10('0xc')]));writeDB(agents[_0x5a64ae[_0x9f10('0x5')]]);}}catch(_0x3b3dd8){utils[_0x9f10('0x25')](util[_0x9f10('0x3')](_0x9f10('0x56'),_0x5a64ae[_0x9f10('0x5')]),_0x3b3dd8);}}; \ No newline at end of file +var _0xbee3=['answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diffTime','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfer','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','transferexten','transfereeuniqueid','agententerreason','clone','calleridnum','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','calleridname','agentconnectAt','hangup','[%s][agents][hangup]','timeout','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','util','info','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','connectedlinenum','lastevent','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','format','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswer','agentringnoanswerAt','now','reason','holdtime','ringtime','talktime','push','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','answered_elsewhere','answeredelsewheredestinationuniqueid'];(function(_0x597351,_0xa9dc9){var _0x460eb7=function(_0x1e8d44){while(--_0x1e8d44){_0x597351['push'](_0x597351['shift']());}};_0x460eb7(++_0xa9dc9);}(_0xbee3,0xd5));var _0x3bee=function(_0x40e94f,_0x2d9aaf){_0x40e94f=_0x40e94f-0x0;var _0x547908=_0xbee3[_0x40e94f];return _0x547908;};'use strict';var _=require('lodash');var util=require(_0x3bee('0x0'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x56a879,_0x45a1bf){utils[_0x3bee('0x1')](util['format'](_0x3bee('0x2'),_0x56a879[_0x3bee('0x3')],_0x56a879[_0x3bee('0x4')],_0x56a879['queue'],_0x56a879[_0x3bee('0x5')],_0x56a879[_0x3bee('0x6')],_0x56a879['calleridnum'],_0x56a879[_0x3bee('0x7')],_0x56a879[_0x3bee('0x8')]));if(_0x56a879[_0x3bee('0x9')]){utils[_0x3bee('0xa')](_0x56a879[_0x3bee('0x9')])[_0x3bee('0xb')](function(_0x3485b8){if(_0x3485b8){_0x56a879['type']=_0x3485b8[_0x3bee('0xc')];_0x56a879[_0x3bee('0xd')]=_0x56a879[_0x3bee('0xe')]?_0x3485b8[_0x3bee('0xf')]:![];_0x56a879[_0x3bee('0x10')]=_0x56a879[_0x3bee('0xd')]?_0x3485b8['acwTimeout']:0x0;}utils[_0x3bee('0x11')]('CreateVoiceAgentReport',_0x56a879);});}else{utils[_0x3bee('0x11')](_0x3bee('0x12'),_0x56a879);}if(_0x45a1bf){delete transfers[_0x56a879[_0x3bee('0x3')]];}else{delete agents[_0x56a879[_0x3bee('0x13')]];}}exports[_0x3bee('0x14')]=function(_0x459129){try{utils[_0x3bee('0x15')](util['format'](_0x3bee('0x16'),_0x459129[_0x3bee('0x3')]),_0x459129);agents[_0x459129[_0x3bee('0x13')]]=_0x459129;agents[_0x459129[_0x3bee('0x13')]][_0x3bee('0x17')]=utils['now']();agents[_0x459129['destuniqueid']][_0x3bee('0x8')]='called';agents[_0x459129[_0x3bee('0x13')]][_0x3bee('0x7')]=null;agents[_0x459129['destuniqueid']]['connectedlinename']=null;utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x19'),_0x459129[_0x3bee('0x3')],agents[_0x459129['destuniqueid']][_0x3bee('0x5')],_0x459129[_0x3bee('0x13')]));}catch(_0x440644){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')](_0x3bee('0x16'),_0x459129[_0x3bee('0x3')]),_0x440644);}};exports['agentringnoanswer']=function(_0x4f36af){try{if(!_[_0x3bee('0x1b')](agents[_0x4f36af[_0x3bee('0x13')]])){utils['debug'](util[_0x3bee('0x18')](_0x3bee('0x1c'),_0x4f36af[_0x3bee('0x3')]),_0x4f36af);utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x1d'),_0x4f36af[_0x3bee('0x3')],agents[_0x4f36af['destuniqueid']][_0x3bee('0x5')],_0x4f36af[_0x3bee('0x13')]));agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x1e')]=!![];agents[_0x4f36af['destuniqueid']][_0x3bee('0x1f')]=utils[_0x3bee('0x20')]();agents[_0x4f36af[_0x3bee('0x13')]]['lastevent']='timeout';agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x21')]='timeout';agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x22')]=_0x4f36af[_0x3bee('0x23')]?parseInt(_0x4f36af['ringtime'])/0x3e8:0x0;agents[_0x4f36af[_0x3bee('0x13')]][_0x3bee('0x24')]=0x0;unanswered[_0x3bee('0x25')](_0x4f36af['destuniqueid']);}}catch(_0x239fa4){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')]('[%s][agents][agentringnoanswer]',_0x4f36af[_0x3bee('0x3')]),_0x239fa4);}};exports[_0x3bee('0x26')]=function(_0x27ed99){try{_[_0x3bee('0x27')](agents,function(_0x3433aa,_0x559c2b){if(_0x3433aa['uniqueid']==_0x27ed99[_0x3bee('0x3')]&&!_[_0x3bee('0x28')](unanswered,_0x3433aa[_0x3bee('0x13')])){utils[_0x3bee('0x15')](util['format']('[%s][agents][queuecallerabandon]',_0x27ed99[_0x3bee('0x3')]),_0x27ed99);utils[_0x3bee('0x1')](util['format']('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x27ed99[_0x3bee('0x3')],_0x3433aa[_0x3bee('0x5')],_0x3433aa[_0x3bee('0x13')]));_0x3433aa[_0x3bee('0x1e')]=!![];_0x3433aa[_0x3bee('0x1f')]=utils[_0x3bee('0x20')]();_0x3433aa[_0x3bee('0x8')]=_0x3bee('0x29');_0x3433aa[_0x3bee('0x21')]=_0x3bee('0x29');_0x3433aa['holdtime']=_0x27ed99['holdtime'];_0x3433aa[_0x3bee('0x24')]=0x0;writeDB(_0x3433aa);}});}catch(_0x4a4706){utils['error'](util[_0x3bee('0x18')](_0x3bee('0x2a'),_0x27ed99[_0x3bee('0x3')]),_0x4a4706);}};exports[_0x3bee('0x2b')]=function(_0xd926f8){try{if(agents[_0xd926f8[_0x3bee('0x13')]]){utils[_0x3bee('0x15')](util[_0x3bee('0x18')]('[%s][agents][agentconnect]',_0xd926f8[_0x3bee('0x3')]),_0xd926f8);utils[_0x3bee('0x1')](util['format'](_0x3bee('0x2c'),_0xd926f8[_0x3bee('0x3')],agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x5')],_0xd926f8[_0x3bee('0x13')]));agents[_0xd926f8['destuniqueid']]['agentconnectAt']=utils[_0x3bee('0x20')]();agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x7')]=_0xd926f8[_0x3bee('0x7')];agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x2d')]=_0xd926f8[_0x3bee('0x2d')];agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x22')]=_0xd926f8[_0x3bee('0x23')];agents[_0xd926f8[_0x3bee('0x13')]][_0x3bee('0x8')]='connect';_[_0x3bee('0x27')](agents,function(_0x1b5eca,_0x25158b){if(_0x1b5eca[_0x3bee('0x13')]!=_0xd926f8[_0x3bee('0x13')]&&_0x1b5eca[_0x3bee('0x3')]==_0xd926f8[_0x3bee('0x3')]){_0x1b5eca[_0x3bee('0x24')]=0x0;_0x1b5eca[_0x3bee('0x22')]=_0xd926f8[_0x3bee('0x23')];_0x1b5eca[_0x3bee('0x1e')]=!![];_0x1b5eca[_0x3bee('0x1f')]=utils[_0x3bee('0x20')]();_0x1b5eca['lastevent']=_0x3bee('0x2e');_0x1b5eca[_0x3bee('0x21')]=_0x3bee('0x2e');_0x1b5eca[_0x3bee('0x2f')]=_0xd926f8[_0x3bee('0x13')];_0x1b5eca[_0x3bee('0x30')]=_0xd926f8[_0x3bee('0x5')];writeDB(_0x1b5eca);}});}}catch(_0xd1140d){utils['error'](util[_0x3bee('0x18')](_0x3bee('0x31'),_0xd926f8[_0x3bee('0x3')]),_0xd1140d);}};exports['agentcomplete']=function(_0x4567f2){try{if(!_['isNil'](agents[_0x4567f2[_0x3bee('0x13')]])){utils['debug'](util['format'](_0x3bee('0x32'),_0x4567f2[_0x3bee('0x3')]),_0x4567f2);utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x33'),_0x4567f2['uniqueid'],agents[_0x4567f2['destuniqueid']][_0x3bee('0x5')],_0x4567f2['destuniqueid']));agents[_0x4567f2[_0x3bee('0x13')]]['agentcomplete']=!![];agents[_0x4567f2[_0x3bee('0x13')]]['agentcompleteAt']=utils[_0x3bee('0x20')]();agents[_0x4567f2[_0x3bee('0x13')]][_0x3bee('0x24')]=utils[_0x3bee('0x34')](agents[_0x4567f2['destuniqueid']]['agentcompleteAt'],agents[_0x4567f2[_0x3bee('0x13')]]['agentconnectAt']);agents[_0x4567f2['destuniqueid']]['reason']=_0x4567f2[_0x3bee('0x21')];agents[_0x4567f2['destuniqueid']][_0x3bee('0x8')]=_0x3bee('0x35');writeDB(agents[_0x4567f2[_0x3bee('0x13')]]);}}catch(_0x593427){utils[_0x3bee('0x1a')](util['format'](_0x3bee('0x32'),_0x4567f2['uniqueid']),_0x593427);}};exports[_0x3bee('0x36')]=function(_0x16b096){try{if(!_[_0x3bee('0x1b')](agents[_0x16b096['transfereruniqueid']])){utils[_0x3bee('0x15')](util[_0x3bee('0x18')](_0x3bee('0x37'),_0x16b096['uniqueid']),_0x16b096);utils['info'](util[_0x3bee('0x18')](_0x3bee('0x38'),_0x16b096[_0x3bee('0x3')],agents[_0x16b096[_0x3bee('0x39')]][_0x3bee('0x5')],agents[_0x16b096[_0x3bee('0x39')]][_0x3bee('0x3')]));agents[_0x16b096['transfereruniqueid']][_0x3bee('0x3a')]=!![];agents[_0x16b096[_0x3bee('0x39')]]['transfertype']='blind';agents[_0x16b096[_0x3bee('0x39')]]['transferexten']=_0x16b096[_0x3bee('0x3b')];agents[_0x16b096[_0x3bee('0x39')]][_0x3bee('0x3c')]=agents[_0x16b096['transfereruniqueid']][_0x3bee('0x3')];}}catch(_0x3beac9){utils[_0x3bee('0x1a')](util['format'](_0x3bee('0x37'),_0x16b096[_0x3bee('0x3')]),_0x3beac9);}};exports['attendedtransfer']=function(_0x7e37ed){try{utils[_0x3bee('0x15')](util['format'](_0x3bee('0x3d'),_0x7e37ed[_0x3bee('0x3e')]),_0x7e37ed);if(_0x7e37ed[_0x3bee('0x3e')]==_0x7e37ed[_0x3bee('0x3f')]){if(!_[_0x3bee('0x1b')](agents[_0x7e37ed[_0x3bee('0x40')]])){utils[_0x3bee('0x1')](util[_0x3bee('0x18')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x7e37ed['origtransfereruniqueid'],agents[_0x7e37ed[_0x3bee('0x40')]]['membername']));agents[_0x7e37ed[_0x3bee('0x40')]][_0x3bee('0x3a')]=!![];agents[_0x7e37ed[_0x3bee('0x40')]]['transfertype']=_0x3bee('0x41');agents[_0x7e37ed[_0x3bee('0x40')]][_0x3bee('0x42')]=_0x7e37ed['origtransfererexten'];agents[_0x7e37ed[_0x3bee('0x40')]]['transferuniqueid']=_0x7e37ed[_0x3bee('0x3e')];}if(_0x7e37ed[_0x3bee('0x43')]&&agents[_0x7e37ed[_0x3bee('0x43')]]){agents[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x44')]=0x1;transfers[_0x7e37ed[_0x3bee('0x43')]]=_[_0x3bee('0x45')](agents[_0x7e37ed['transfereeuniqueid']]);transfers[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x46')]=agents[_0x7e37ed[_0x3bee('0x40')]][_0x3bee('0x46')];transfers[_0x7e37ed['transfereeuniqueid']]['calleridname']=agents[_0x7e37ed[_0x3bee('0x40')]]['calleridname'];transfers[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x17')]=utils[_0x3bee('0x20')]();transfers[_0x7e37ed[_0x3bee('0x43')]]['agentconnectAt']=utils['now']();transfers[_0x7e37ed[_0x3bee('0x43')]][_0x3bee('0x22')]=0x0;transfers[_0x7e37ed['transfereeuniqueid']][_0x3bee('0x44')]=0x2;}}else if(_0x7e37ed['secondtransfereruniqueid']==_0x7e37ed[_0x3bee('0x47')]){if(!_[_0x3bee('0x1b')](agents[_0x7e37ed[_0x3bee('0x3e')]])){utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x48'),_0x7e37ed[_0x3bee('0x3e')],agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x5')]));agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x3a')]=!![];agents[_0x7e37ed['origtransfereruniqueid']]['transfertype']='ATTENDED';agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x42')]=_0x7e37ed[_0x3bee('0x49')];agents[_0x7e37ed[_0x3bee('0x3e')]]['transferuniqueid']=_0x7e37ed[_0x3bee('0x40')];}if(_0x7e37ed[_0x3bee('0x4a')]&&agents[_0x7e37ed['transfertargetuniqueid']]){agents[_0x7e37ed['transfertargetuniqueid']][_0x3bee('0x44')]=0x1;transfers[_0x7e37ed[_0x3bee('0x4a')]]=_[_0x3bee('0x45')](agents[_0x7e37ed['transfertargetuniqueid']]);transfers[_0x7e37ed[_0x3bee('0x4a')]][_0x3bee('0x46')]=agents[_0x7e37ed[_0x3bee('0x3e')]]['calleridnum'];transfers[_0x7e37ed[_0x3bee('0x4a')]][_0x3bee('0x4b')]=agents[_0x7e37ed[_0x3bee('0x3e')]][_0x3bee('0x4b')];transfers[_0x7e37ed['transfertargetuniqueid']]['agentcalledAt']=utils[_0x3bee('0x20')]();transfers[_0x7e37ed[_0x3bee('0x4a')]][_0x3bee('0x4c')]=utils[_0x3bee('0x20')]();transfers[_0x7e37ed[_0x3bee('0x4a')]]['holdtime']=0x0;transfers[_0x7e37ed[_0x3bee('0x4a')]]['agententerreason']=0x2;}}}catch(_0xddc56b){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')](_0x3bee('0x3d'),_0x7e37ed[_0x3bee('0x3e')]),_0xddc56b);}};exports[_0x3bee('0x4d')]=function(_0x3f7dad){try{utils['debug'](util[_0x3bee('0x18')](_0x3bee('0x4e'),_0x3f7dad[_0x3bee('0x3')]),_0x3f7dad);if(agents[_0x3f7dad[_0x3bee('0x3')]]&&agents[_0x3f7dad['uniqueid']][_0x3bee('0x21')]===_0x3bee('0x4f')){if(_0x3f7dad[_0x3bee('0x50')]==='21'){agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')]=_0x3bee('0x51');agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]='rejected';}utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x52'),_0x3f7dad['uniqueid'],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x5')],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]));writeDB(agents[_0x3f7dad[_0x3bee('0x3')]]);var _0x204843=unanswered[_0x3bee('0x53')](_0x3f7dad[_0x3bee('0x3')]);if(_0x204843>-0x1){unanswered[_0x3bee('0x54')](_0x204843,0x1);}}if(transfers[_0x3f7dad[_0x3bee('0x3')]]){transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0xe')]=!![];transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')]=utils[_0x3bee('0x20')]();transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x24')]=utils[_0x3bee('0x34')](transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')],transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x4c')]);transfers[_0x3f7dad[_0x3bee('0x3')]]['reason']=_0x3bee('0x56');transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]=_0x3bee('0x35');utils[_0x3bee('0x1')](util[_0x3bee('0x18')](_0x3bee('0x52'),_0x3f7dad[_0x3bee('0x3')],transfers[_0x3f7dad[_0x3bee('0x3')]]['membername'],transfers[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')],transfers[_0x3f7dad['uniqueid']][_0x3bee('0x8')]));writeDB(transfers[_0x3f7dad['uniqueid']],!![]);}if(agents[_0x3f7dad[_0x3bee('0x3')]]&&agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x4c')]){agents[_0x3f7dad['uniqueid']]['agentcomplete']=!![];agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')]=utils[_0x3bee('0x20')]();agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x24')]=utils[_0x3bee('0x34')](agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x55')],agents[_0x3f7dad['uniqueid']][_0x3bee('0x4c')]);agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')]=agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x3a')]?_0x3bee('0x3a'):_0x3bee('0x56');agents[_0x3f7dad['uniqueid']][_0x3bee('0x8')]=_0x3bee('0x35');utils['info'](util[_0x3bee('0x18')](_0x3bee('0x52'),_0x3f7dad['uniqueid'],agents[_0x3f7dad[_0x3bee('0x3')]]['membername'],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x21')],agents[_0x3f7dad[_0x3bee('0x3')]][_0x3bee('0x8')]));writeDB(agents[_0x3f7dad['uniqueid']]);}}catch(_0x62900b){utils[_0x3bee('0x1a')](util[_0x3bee('0x18')]('[%s][agents][hangup]',_0x3f7dad[_0x3bee('0x3')]),_0x62900b);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 6d73d3b..359ef5c 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 _0xb38e=['debug','[%s][calls][newchannel]','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','newstate','[%s][calls][newstate]','isNil','channelstate','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','error','hangup','[%s][calls][hangup]','callerid','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','destinationchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','source','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','appdata','toLowerCase','set','split','substring','lastIndexOf','execif','lodash','util','./utils','NO\x20ANSWER','FAILED','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','membername','interface','calleridnum','connectedlinenum','lastevent','getUserByInternal','accountcode','then','request','CreateVoiceCallReport'];(function(_0x14b287,_0xf299d1){var _0x3c4d82=function(_0x333adb){while(--_0x333adb){_0x14b287['push'](_0x14b287['shift']());}};_0x3c4d82(++_0xf299d1);}(_0xb38e,0x11e));var _0xeb38=function(_0x70f30e,_0x4a954c){_0x70f30e=_0x70f30e-0x0;var _0x207f73=_0xb38e[_0x70f30e];return _0x207f73;};'use strict';var _=require(_0xeb38('0x0'));var util=require(_0xeb38('0x1'));var utils=require(_0xeb38('0x2'));var dispositions=[_0xeb38('0x3'),'FAILED',_0xeb38('0x4'),_0xeb38('0x3'),_0xeb38('0x3'),'NO\x20ANSWER','ANSWERED','BUSY','FAILED',_0xeb38('0x4'),'FAILED'];var channels={};function writeDB(_0x30d6c2){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x7'),_0x30d6c2[_0xeb38('0x8')],_0x30d6c2[_0xeb38('0x9')],_0x30d6c2['queue'],_0x30d6c2[_0xeb38('0xa')],_0x30d6c2[_0xeb38('0xb')],_0x30d6c2[_0xeb38('0xc')],_0x30d6c2[_0xeb38('0xd')],_0x30d6c2[_0xeb38('0xe')]));if(_0x30d6c2['accountcode']){utils[_0xeb38('0xf')](_0x30d6c2[_0xeb38('0x10')])[_0xeb38('0x11')](function(_0x2640c0){if(_0x2640c0){_0x30d6c2['UserId']=_0x2640c0['id'];}utils[_0xeb38('0x12')](_0xeb38('0x13'),_0x30d6c2);});}else{utils['request'](_0xeb38('0x13'),_0x30d6c2);}if(channels[_0x30d6c2[_0xeb38('0x8')]]){delete channels[_0x30d6c2[_0xeb38('0x8')]];}}exports['newchannel']=function(_0x59f453){try{utils[_0xeb38('0x14')](util[_0xeb38('0x6')](_0xeb38('0x15'),_0x59f453['uniqueid']),_0x59f453);if(_0x59f453[_0xeb38('0x8')]==_0x59f453['linkedid']&&_0x59f453[_0xeb38('0x9')]!=_0xeb38('0x16')){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x17'),_0x59f453[_0xeb38('0x8')],_0x59f453[_0xeb38('0x18')],_0x59f453[_0xeb38('0x19')]));channels[_0x59f453['uniqueid']]={'uniqueid':_0x59f453[_0xeb38('0x8')],'accountcode':_0x59f453[_0xeb38('0x10')],'source':_0x59f453[_0xeb38('0xc')],'destination':_0x59f453[_0xeb38('0x19')],'destinationcontext':_0x59f453['context'],'channel':_0x59f453[_0xeb38('0x9')],'starttime':utils[_0xeb38('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xeb38('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x4b5da8){utils['error'](util[_0xeb38('0x6')](_0xeb38('0x15'),_0x59f453[_0xeb38('0x8')]),_0x4b5da8);}};exports[_0xeb38('0x1b')]=function(_0xb4f33f){try{utils['debug'](util[_0xeb38('0x6')](_0xeb38('0x1c'),_0xb4f33f['uniqueid']),_0xb4f33f);if(!_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x8')]])&&_0xb4f33f[_0xeb38('0x1e')]==0x6){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0xb4f33f[_0xeb38('0x8')],_0xb4f33f[_0xeb38('0x18')],_0xb4f33f[_0xeb38('0x9')]));if(_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x8')]]['systemanswertime'])){channels[_0xb4f33f['uniqueid']]['systemanswertime']=utils[_0xeb38('0x1a')]();}}else if(!_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x1f')]])&&_0xb4f33f['channelstate']==0x6&&_0xb4f33f[_0xeb38('0x18')]!=_0xeb38('0x20')){utils['info'](util[_0xeb38('0x6')](_0xeb38('0x21'),_0xb4f33f[_0xeb38('0x8')],_0xb4f33f['linkedid'],_0xb4f33f['context'],_0xb4f33f[_0xeb38('0x9')]));channels[_0xb4f33f['linkedid']][_0xeb38('0x10')]=_0xb4f33f[_0xeb38('0x10')];channels[_0xb4f33f[_0xeb38('0x1f')]]['destinationchannel']=_0xb4f33f[_0xeb38('0x9')];if(_[_0xeb38('0x1d')](channels[_0xb4f33f[_0xeb38('0x1f')]]['answertime'])){channels[_0xb4f33f['linkedid']][_0xeb38('0x22')]=utils['now']();}channels[_0xb4f33f[_0xeb38('0x1f')]][_0xeb38('0x23')]=dispositions[_[_0xeb38('0x24')](_0xb4f33f[_0xeb38('0x1e')])]||'ANSWERED';}}catch(_0x207731){utils[_0xeb38('0x25')](util[_0xeb38('0x6')]('[%s][calls][newstate]',_0xb4f33f[_0xeb38('0x8')]),_0x207731);}};exports[_0xeb38('0x26')]=function(_0x2aae34){try{if(!_[_0xeb38('0x1d')](channels[_0x2aae34[_0xeb38('0x8')]])){utils[_0xeb38('0x14')](util[_0xeb38('0x6')](_0xeb38('0x27'),_0x2aae34[_0xeb38('0x8')]),_0x2aae34);if(_[_0xeb38('0x1d')](channels[_0x2aae34[_0xeb38('0x8')]]['callerid'])){channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x28')]=_0x2aae34['calleridname']+'\x20<'+_0x2aae34[_0xeb38('0xc')]+'>';}utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x29'),_0x2aae34['uniqueid'],channels[_0x2aae34[_0xeb38('0x8')]]['callerid'],_0x2aae34[_0xeb38('0x2a')]));channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2b')]=utils[_0xeb38('0x1a')]();channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2c')]=utils[_0xeb38('0x2d')](channels[_0x2aae34['uniqueid']][_0xeb38('0x2b')],channels[_0x2aae34['uniqueid']][_0xeb38('0x2e')]);channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2f')]=channels[_0x2aae34[_0xeb38('0x8')]]['answertime']?utils[_0xeb38('0x2d')](channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x2b')],channels[_0x2aae34[_0xeb38('0x8')]][_0xeb38('0x22')]):0x0;writeDB(channels[_0x2aae34[_0xeb38('0x8')]]);}}catch(_0x109b1a){utils[_0xeb38('0x25')](util[_0xeb38('0x6')](_0xeb38('0x27'),_0x2aae34[_0xeb38('0x8')]),_0x109b1a);}};exports[_0xeb38('0x30')]=function(_0x219406){try{if(!_[_0xeb38('0x1d')](channels[_0x219406[_0xeb38('0x31')]])){utils[_0xeb38('0x14')](util[_0xeb38('0x6')](_0xeb38('0x32'),_0x219406['origtransfereruniqueid']),_0x219406);if(channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x9')]==_0x219406[_0xeb38('0x33')]){utils[_0xeb38('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x219406[_0xeb38('0x34')],_0x219406[_0xeb38('0x31')],_0x219406[_0xeb38('0x35')]));channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x36')]=_0x219406[_0xeb38('0x35')];channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x37')]=_0xeb38('0x38');}else if(channels[_0x219406['localtwolinkedid']][_0xeb38('0x9')]=_0x219406[_0xeb38('0x39')]){utils['info'](util[_0xeb38('0x6')](_0xeb38('0x3a'),_0x219406[_0xeb38('0x34')],_0x219406[_0xeb38('0x31')],_0x219406['origtransfererchannel']));channels[_0x219406['localtwolinkedid']][_0xeb38('0x36')]=_0x219406[_0xeb38('0x3b')];channels[_0x219406[_0xeb38('0x31')]][_0xeb38('0x37')]=_0xeb38('0x38');}}}catch(_0x44ef52){utils[_0xeb38('0x25')](util['format']('[%s][calls][attendedtransfer]',_0x219406[_0xeb38('0x34')]),_0x44ef52);}};exports[_0xeb38('0x3c')]=function(_0x56f3ae){try{if(!_[_0xeb38('0x1d')](channels[_0x56f3ae[_0xeb38('0x8')]])){utils['debug'](util['format'](_0xeb38('0x3d'),_0x56f3ae['uniqueid']),_0x56f3ae);channels[_0x56f3ae[_0xeb38('0x8')]]['musiconholdstartAt']=utils['now']();utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x3e'),_0x56f3ae[_0xeb38('0x8')],channels[_0x56f3ae[_0xeb38('0x8')]][_0xeb38('0x3f')]));}}catch(_0x3f5c7b){utils[_0xeb38('0x25')](util['format'](_0xeb38('0x3d'),_0x56f3ae[_0xeb38('0x8')]),_0x3f5c7b);}};exports[_0xeb38('0x40')]=function(_0x1da5f5){try{if(!_[_0xeb38('0x1d')](channels[_0x1da5f5[_0xeb38('0x8')]])){utils['debug'](util[_0xeb38('0x6')](_0xeb38('0x41'),_0x1da5f5[_0xeb38('0x8')]),_0x1da5f5);if(!_[_0xeb38('0x1d')](channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x3f')])){channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x42')]+=utils[_0xeb38('0x2d')](utils[_0xeb38('0x1a')](),channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x3f')]);utils[_0xeb38('0x5')](util['format'](_0xeb38('0x43'),_0x1da5f5[_0xeb38('0x8')],channels[_0x1da5f5['uniqueid']]['mohtime']));delete channels[_0x1da5f5[_0xeb38('0x8')]][_0xeb38('0x3f')];}}}catch(_0x268060){utils['error'](util[_0xeb38('0x6')]('[%s][calls][musiconholdstop]',_0x1da5f5[_0xeb38('0x8')]),_0x268060);}};exports[_0xeb38('0x44')]=function(_0x5341d3){try{if(!_[_0xeb38('0x1d')](channels[_0x5341d3[_0xeb38('0x8')]])){utils['debug'](util[_0xeb38('0x6')](_0xeb38('0x45'),_0x5341d3[_0xeb38('0x8')]),_0x5341d3);if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x47')])){utils['info'](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x5341d3[_0xeb38('0x8')],_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x49')]=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')]['xmd-phone'])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x4a'),_0x5341d3['uniqueid'],_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x4b')]=_0x5341d3[_0xeb38('0x48')];channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x28')]='\x22'+_0x5341d3['value']+_0xeb38('0x4c')+_0x5341d3[_0xeb38('0x48')]+'>';}if(!_['isNil'](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4d')])||!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4e')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5341d3[_0xeb38('0x8')],!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4d')])?_0xeb38('0x4d'):'xmd-callerid',_0x5341d3['value']));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x28')]=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')]['xmd-queue'])||!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x4f')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x5341d3[_0xeb38('0x8')],!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')]['xmd-queue'])?_0xeb38('0x50'):_0xeb38('0x4f'),_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3['uniqueid']][_0xeb38('0x51')]=_0xeb38('0x52');channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x53')]=_0x5341d3[_0xeb38('0x48')];channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x54')]=!![];}if(!_[_0xeb38('0x1d')](_0x5341d3['variable'][_0xeb38('0x55')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x5341d3[_0xeb38('0x8')],_0x5341d3['value']));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x56')]=_0x5341d3['value'];}if(!_[_0xeb38('0x1d')](_0x5341d3['variable']['xmd-cdrtype'])){utils[_0xeb38('0x5')](util['format']('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x5341d3['uniqueid'],_0x5341d3['value']));channels[_0x5341d3['uniqueid']][_0xeb38('0x57')]=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3['variable'][_0xeb38('0x58')])){utils['info'](util[_0xeb38('0x6')](_0xeb38('0x59'),_0x5341d3[_0xeb38('0x8')],_0x5341d3['value']));channels[_0x5341d3[_0xeb38('0x8')]]['routeid']=_0x5341d3[_0xeb38('0x48')];}if(!_[_0xeb38('0x1d')](_0x5341d3[_0xeb38('0x46')][_0xeb38('0x5a')])){utils[_0xeb38('0x5')](util[_0xeb38('0x6')](_0xeb38('0x5b'),_0x5341d3[_0xeb38('0x8')],_0x5341d3[_0xeb38('0x48')]));channels[_0x5341d3[_0xeb38('0x8')]][_0xeb38('0x5a')]=_0x5341d3[_0xeb38('0x48')];}}}catch(_0x153493){utils['error'](util[_0xeb38('0x6')](_0xeb38('0x45'),_0x5341d3[_0xeb38('0x8')]),_0x153493);}};exports[_0xeb38('0x5c')]=function(_0xcd51df){try{if(!_[_0xeb38('0x1d')](channels[_0xcd51df[_0xeb38('0x8')]])){utils[_0xeb38('0x14')](util['format'](_0xeb38('0x5d'),_0xcd51df[_0xeb38('0x8')]),_0xcd51df);utils[_0xeb38('0x5')](util[_0xeb38('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0xcd51df[_0xeb38('0x8')],_0xcd51df[_0xeb38('0x5e')],_0xcd51df[_0xeb38('0x5f')]));if(_0xcd51df[_0xeb38('0x5e')][_0xeb38('0x60')]()==_0xeb38('0x61')&&_['startsWith'](_0xcd51df[_0xeb38('0x5f')][_0xeb38('0x60')](),'cdr')){var _0x920170=_0xcd51df[_0xeb38('0x5f')][_0xeb38('0x62')]('=');var _0x22de16=_0x920170[0x0][_0xeb38('0x63')](_0x920170[0x0][_0xeb38('0x64')]('(')+0x1,_0x920170[0x0][_0xeb38('0x64')](')'));var _0xb8377d=_0x920170[0x1];channels[_0xcd51df[_0xeb38('0x8')]][_0x22de16]=_0xb8377d;}if(!_['includes'](['hangup','noop',_0xeb38('0x65'),_0xeb38('0x61'),'gotoif'],_0xcd51df[_0xeb38('0x5e')][_0xeb38('0x60')]())){channels[_0xcd51df[_0xeb38('0x8')]][_0xeb38('0x51')]=_0xcd51df[_0xeb38('0x5e')];channels[_0xcd51df[_0xeb38('0x8')]][_0xeb38('0x53')]=_0xcd51df[_0xeb38('0x5f')];}}}catch(_0x113e89){utils[_0xeb38('0x25')](util[_0xeb38('0x6')](_0xeb38('0x5d'),_0xcd51df[_0xeb38('0x8')]),_0x113e89);}}; \ No newline at end of file +var _0x8332=['lodash','util','FAILED','NO\x20ANSWER','ANSWERED','BUSY','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','lastevent','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','debug','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','format','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','calleridnum','now','newstate','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','error','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','starttime','attendedtransfer','origtransfereruniqueid','localtwolinkedid','secondtransfererchannel','_attended','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','[%s][calls][musiconholdstart]','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','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','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','includes','noop','gotoif'];(function(_0x40440f,_0x5890d2){var _0x3e43a7=function(_0x49b09f){while(--_0x49b09f){_0x40440f['push'](_0x40440f['shift']());}};_0x3e43a7(++_0x5890d2);}(_0x8332,0x184));var _0x2833=function(_0x1b7cc3,_0x390fc5){_0x1b7cc3=_0x1b7cc3-0x0;var _0x48d9d1=_0x8332[_0x1b7cc3];return _0x48d9d1;};'use strict';var _=require(_0x2833('0x0'));var util=require(_0x2833('0x1'));var utils=require('./utils');var dispositions=['NO\x20ANSWER',_0x2833('0x2'),'FAILED','NO\x20ANSWER','NO\x20ANSWER',_0x2833('0x3'),_0x2833('0x4'),_0x2833('0x5'),_0x2833('0x2'),_0x2833('0x2'),_0x2833('0x2')];var channels={};function writeDB(_0x1a3de8){utils[_0x2833('0x6')](util['format'](_0x2833('0x7'),_0x1a3de8[_0x2833('0x8')],_0x1a3de8[_0x2833('0x9')],_0x1a3de8['queue'],_0x1a3de8['membername'],_0x1a3de8[_0x2833('0xa')],_0x1a3de8['calleridnum'],_0x1a3de8['connectedlinenum'],_0x1a3de8[_0x2833('0xb')]));if(_0x1a3de8[_0x2833('0xc')]){utils[_0x2833('0xd')](_0x1a3de8['accountcode'])[_0x2833('0xe')](function(_0xce0eb6){if(_0xce0eb6){_0x1a3de8[_0x2833('0xf')]=_0xce0eb6['id'];}utils[_0x2833('0x10')](_0x2833('0x11'),_0x1a3de8);});}else{utils['request']('CreateVoiceCallReport',_0x1a3de8);}if(channels[_0x1a3de8[_0x2833('0x8')]]){delete channels[_0x1a3de8[_0x2833('0x8')]];}}exports['newchannel']=function(_0x47c7b8){try{utils[_0x2833('0x12')](util['format'](_0x2833('0x13'),_0x47c7b8[_0x2833('0x8')]),_0x47c7b8);if(_0x47c7b8['uniqueid']==_0x47c7b8[_0x2833('0x14')]&&_0x47c7b8[_0x2833('0x9')]!=_0x2833('0x15')){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x17'),_0x47c7b8[_0x2833('0x8')],_0x47c7b8[_0x2833('0x18')],_0x47c7b8['exten']));channels[_0x47c7b8['uniqueid']]={'uniqueid':_0x47c7b8[_0x2833('0x8')],'accountcode':_0x47c7b8[_0x2833('0xc')],'source':_0x47c7b8[_0x2833('0x19')],'destination':_0x47c7b8['exten'],'destinationcontext':_0x47c7b8['context'],'channel':_0x47c7b8[_0x2833('0x9')],'starttime':utils[_0x2833('0x1a')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x2833('0x3'),'amaflags':'DOCUMENTATION'};}}catch(_0x35fa39){utils['error'](util[_0x2833('0x16')]('[%s][calls][newchannel]',_0x47c7b8[_0x2833('0x8')]),_0x35fa39);}};exports[_0x2833('0x1b')]=function(_0x53606e){try{utils['debug'](util['format']('[%s][calls][newstate]',_0x53606e['uniqueid']),_0x53606e);if(!_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x8')]])&&_0x53606e[_0x2833('0x1d')]==0x6){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x1e'),_0x53606e[_0x2833('0x8')],_0x53606e[_0x2833('0x18')],_0x53606e[_0x2833('0x9')]));if(_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x8')]][_0x2833('0x1f')])){channels[_0x53606e[_0x2833('0x8')]][_0x2833('0x1f')]=utils['now']();}}else if(!_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x14')]])&&_0x53606e[_0x2833('0x1d')]==0x6&&_0x53606e[_0x2833('0x18')]!='transfer'){utils['info'](util[_0x2833('0x16')](_0x2833('0x20'),_0x53606e['uniqueid'],_0x53606e[_0x2833('0x14')],_0x53606e[_0x2833('0x18')],_0x53606e[_0x2833('0x9')]));channels[_0x53606e[_0x2833('0x14')]][_0x2833('0xc')]=_0x53606e[_0x2833('0xc')];channels[_0x53606e[_0x2833('0x14')]][_0x2833('0x21')]=_0x53606e[_0x2833('0x9')];if(_[_0x2833('0x1c')](channels[_0x53606e[_0x2833('0x14')]][_0x2833('0x22')])){channels[_0x53606e['linkedid']]['answertime']=utils[_0x2833('0x1a')]();}channels[_0x53606e[_0x2833('0x14')]][_0x2833('0x23')]=dispositions[_['toNumber'](_0x53606e[_0x2833('0x1d')])]||_0x2833('0x4');}}catch(_0x51d424){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x25'),_0x53606e['uniqueid']),_0x51d424);}};exports[_0x2833('0x26')]=function(_0x569487){try{if(!_[_0x2833('0x1c')](channels[_0x569487[_0x2833('0x8')]])){utils['debug'](util[_0x2833('0x16')](_0x2833('0x27'),_0x569487[_0x2833('0x8')]),_0x569487);if(_[_0x2833('0x1c')](channels[_0x569487[_0x2833('0x8')]][_0x2833('0x28')])){channels[_0x569487[_0x2833('0x8')]][_0x2833('0x28')]=_0x569487['calleridname']+'\x20<'+_0x569487[_0x2833('0x19')]+'>';}utils[_0x2833('0x6')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x569487['uniqueid'],channels[_0x569487['uniqueid']][_0x2833('0x28')],_0x569487[_0x2833('0x29')]));channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2a')]=utils['now']();channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2b')]=utils[_0x2833('0x2c')](channels[_0x569487['uniqueid']]['endtime'],channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2d')]);channels[_0x569487[_0x2833('0x8')]]['billableseconds']=channels[_0x569487[_0x2833('0x8')]]['answertime']?utils[_0x2833('0x2c')](channels[_0x569487[_0x2833('0x8')]][_0x2833('0x2a')],channels[_0x569487[_0x2833('0x8')]]['answertime']):0x0;writeDB(channels[_0x569487[_0x2833('0x8')]]);}}catch(_0x15dec9){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x27'),_0x569487[_0x2833('0x8')]),_0x15dec9);}};exports[_0x2833('0x2e')]=function(_0x57f1f2){try{if(!_[_0x2833('0x1c')](channels[_0x57f1f2['localtwolinkedid']])){utils[_0x2833('0x12')](util[_0x2833('0x16')]('[%s][calls][attendedtransfer]',_0x57f1f2[_0x2833('0x2f')]),_0x57f1f2);if(channels[_0x57f1f2[_0x2833('0x30')]][_0x2833('0x9')]==_0x57f1f2['transfereechannel']){utils[_0x2833('0x6')](util[_0x2833('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x57f1f2[_0x2833('0x2f')],_0x57f1f2[_0x2833('0x30')],_0x57f1f2['secondtransfererchannel']));channels[_0x57f1f2[_0x2833('0x30')]][_0x2833('0x21')]=_0x57f1f2[_0x2833('0x31')];channels[_0x57f1f2['localtwolinkedid']]['userfield']=_0x2833('0x32');}else if(channels[_0x57f1f2[_0x2833('0x30')]]['channel']=_0x57f1f2['transfertargetchannel']){utils[_0x2833('0x6')](util['format'](_0x2833('0x33'),_0x57f1f2[_0x2833('0x2f')],_0x57f1f2[_0x2833('0x30')],_0x57f1f2['origtransfererchannel']));channels[_0x57f1f2[_0x2833('0x30')]][_0x2833('0x21')]=_0x57f1f2[_0x2833('0x34')];channels[_0x57f1f2[_0x2833('0x30')]]['userfield']='_attended';}}}catch(_0x33d7b4){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x35'),_0x57f1f2[_0x2833('0x2f')]),_0x33d7b4);}};exports[_0x2833('0x36')]=function(_0x5e0290){try{if(!_[_0x2833('0x1c')](channels[_0x5e0290[_0x2833('0x8')]])){utils[_0x2833('0x12')](util[_0x2833('0x16')]('[%s][calls][musiconholdstart]',_0x5e0290[_0x2833('0x8')]),_0x5e0290);channels[_0x5e0290[_0x2833('0x8')]][_0x2833('0x37')]=utils['now']();utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x38'),_0x5e0290[_0x2833('0x8')],channels[_0x5e0290[_0x2833('0x8')]][_0x2833('0x37')]));}}catch(_0x78acb2){utils['error'](util[_0x2833('0x16')](_0x2833('0x39'),_0x5e0290['uniqueid']),_0x78acb2);}};exports[_0x2833('0x3a')]=function(_0x88d660){try{if(!_[_0x2833('0x1c')](channels[_0x88d660['uniqueid']])){utils[_0x2833('0x12')](util[_0x2833('0x16')](_0x2833('0x3b'),_0x88d660[_0x2833('0x8')]),_0x88d660);if(!_[_0x2833('0x1c')](channels[_0x88d660[_0x2833('0x8')]][_0x2833('0x37')])){channels[_0x88d660['uniqueid']][_0x2833('0x3c')]+=utils[_0x2833('0x2c')](utils[_0x2833('0x1a')](),channels[_0x88d660['uniqueid']][_0x2833('0x37')]);utils['info'](util[_0x2833('0x16')](_0x2833('0x3d'),_0x88d660[_0x2833('0x8')],channels[_0x88d660[_0x2833('0x8')]][_0x2833('0x3c')]));delete channels[_0x88d660['uniqueid']][_0x2833('0x37')];}}}catch(_0x3d380c){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x3b'),_0x88d660[_0x2833('0x8')]),_0x3d380c);}};exports[_0x2833('0x3e')]=function(_0x2ab5a5){try{if(!_['isNil'](channels[_0x2ab5a5[_0x2833('0x8')]])){utils[_0x2833('0x12')](util[_0x2833('0x16')](_0x2833('0x3f'),_0x2ab5a5['uniqueid']),_0x2ab5a5);if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x41')])){utils[_0x2833('0x6')](util[_0x2833('0x16')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5['uniqueid']]['source']=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x43')])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x44'),_0x2ab5a5['uniqueid'],_0x2ab5a5['value']));channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x45')]=_0x2ab5a5[_0x2833('0x42')];channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x28')]='\x22'+_0x2ab5a5[_0x2833('0x42')]+'\x22\x20<'+_0x2ab5a5[_0x2833('0x42')]+'>';}if(!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')]['xmd-callerid-preview'])||!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x46')])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x47'),_0x2ab5a5[_0x2833('0x8')],!_[_0x2833('0x1c')](_0x2ab5a5['variable'][_0x2833('0x48')])?'xmd-callerid-preview':_0x2833('0x46'),_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5['uniqueid']][_0x2833('0x28')]=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x49')])||!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x4a')])){utils['info'](util[_0x2833('0x16')](_0x2833('0x47'),_0x2ab5a5['uniqueid'],!_['isNil'](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x49')])?_0x2833('0x49'):_0x2833('0x4a'),_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x4b')]=_0x2833('0x4c');channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x4d')]=_0x2ab5a5[_0x2833('0x42')];channels[_0x2ab5a5[_0x2833('0x8')]]['queue']=!![];}if(!_[_0x2833('0x1c')](_0x2ab5a5['variable'][_0x2833('0x4e')])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x4f'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]]['ContactId']=_0x2ab5a5[_0x2833('0x42')];}if(!_[_0x2833('0x1c')](_0x2ab5a5[_0x2833('0x40')][_0x2833('0x50')])){utils[_0x2833('0x6')](util['format'](_0x2833('0x51'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]]['type']=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5[_0x2833('0x40')]['outboundrouteid'])){utils[_0x2833('0x6')](util[_0x2833('0x16')](_0x2833('0x52'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]][_0x2833('0x53')]=_0x2ab5a5[_0x2833('0x42')];}if(!_['isNil'](_0x2ab5a5['variable']['sipcallid'])){utils[_0x2833('0x6')](util['format'](_0x2833('0x54'),_0x2ab5a5[_0x2833('0x8')],_0x2ab5a5[_0x2833('0x42')]));channels[_0x2ab5a5[_0x2833('0x8')]]['sipcallid']=_0x2ab5a5[_0x2833('0x42')];}}}catch(_0x2999e){utils[_0x2833('0x24')](util['format'](_0x2833('0x3f'),_0x2ab5a5[_0x2833('0x8')]),_0x2999e);}};exports['newexten']=function(_0x7da627){try{if(!_[_0x2833('0x1c')](channels[_0x7da627[_0x2833('0x8')]])){utils[_0x2833('0x12')](util[_0x2833('0x16')](_0x2833('0x55'),_0x7da627[_0x2833('0x8')]),_0x7da627);utils[_0x2833('0x6')](util['format'](_0x2833('0x56'),_0x7da627[_0x2833('0x8')],_0x7da627[_0x2833('0x57')],_0x7da627[_0x2833('0x58')]));if(_0x7da627[_0x2833('0x57')][_0x2833('0x59')]()==_0x2833('0x5a')&&_[_0x2833('0x5b')](_0x7da627[_0x2833('0x58')]['toLowerCase'](),_0x2833('0x5c'))){var _0x3a3cc6=_0x7da627[_0x2833('0x58')]['split']('=');var _0x58f924=_0x3a3cc6[0x0][_0x2833('0x5d')](_0x3a3cc6[0x0]['lastIndexOf']('(')+0x1,_0x3a3cc6[0x0]['lastIndexOf'](')'));var _0x11bd8c=_0x3a3cc6[0x1];channels[_0x7da627[_0x2833('0x8')]][_0x58f924]=_0x11bd8c;}if(!_[_0x2833('0x5e')]([_0x2833('0x26'),_0x2833('0x5f'),'execif',_0x2833('0x5a'),_0x2833('0x60')],_0x7da627[_0x2833('0x57')]['toLowerCase']())){channels[_0x7da627[_0x2833('0x8')]][_0x2833('0x4b')]=_0x7da627[_0x2833('0x57')];channels[_0x7da627[_0x2833('0x8')]][_0x2833('0x4d')]=_0x7da627[_0x2833('0x58')];}}}catch(_0x3aee15){utils[_0x2833('0x24')](util[_0x2833('0x16')](_0x2833('0x55'),_0x7da627[_0x2833('0x8')]),_0x3aee15);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 6da3fac..0175092 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 _0x310b=['[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error'];(function(_0x24529e,_0x5e67cb){var _0x2072de=function(_0x1b8305){while(--_0x1b8305){_0x24529e['push'](_0x24529e['shift']());}};_0x2072de(++_0x5e67cb);}(_0x310b,0x10c));var _0xb310=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x310b[_0x4b369d];return _0x571a98;};'use strict';var utils=require(_0xb310('0x0'));exports[_0xb310('0x1')]=function(){utils[_0xb310('0x2')](_0xb310('0x3'));};exports['shutdown']=function(){utils[_0xb310('0x2')](_0xb310('0x4'));};exports[_0xb310('0x5')]=function(){utils[_0xb310('0x2')](_0xb310('0x6'));};exports[_0xb310('0x7')]=function(_0x15de4a){utils[_0xb310('0x7')](_0xb310('0x8'),_0x15de4a);};exports[_0xb310('0x9')]=function(){utils[_0xb310('0x2')](_0xb310('0xa'));};exports[_0xb310('0xb')]=function(_0x2294aa){}; \ No newline at end of file +var _0xbcc3=['fullybooted','[core]\x20fullybooted','error','[core]\x20error','[core]\x20close','managerevent','connect','[core]\x20connected','shutdown','info','[core]\x20shutdown'];(function(_0x63500b,_0x508aa1){var _0x492332=function(_0x1dc594){while(--_0x1dc594){_0x63500b['push'](_0x63500b['shift']());}};_0x492332(++_0x508aa1);}(_0xbcc3,0xab));var _0x3bcc=function(_0x344128,_0x9b9e88){_0x344128=_0x344128-0x0;var _0x693fae=_0xbcc3[_0x344128];return _0x693fae;};'use strict';var utils=require('./utils');exports[_0x3bcc('0x0')]=function(){utils['info'](_0x3bcc('0x1'));};exports[_0x3bcc('0x2')]=function(){utils[_0x3bcc('0x3')](_0x3bcc('0x4'));};exports[_0x3bcc('0x5')]=function(){utils[_0x3bcc('0x3')](_0x3bcc('0x6'));};exports['error']=function(_0x21f31a){utils[_0x3bcc('0x7')](_0x3bcc('0x8'),_0x21f31a);};exports['close']=function(){utils[_0x3bcc('0x3')](_0x3bcc('0x9'));};exports[_0x3bcc('0xa')]=function(_0x36bcdf){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index d46d9a1..b7c1806 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 _0x1ea0=['lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','CreateVoiceDialReport','newexten','application','appdata','toLowerCase','startsWith','[%s][dials][newexten]','debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend','[%s][dials][dialend]','ANSWER','answertime','connect','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','complete','duration','endtime','holdtime','diffTime'];(function(_0x3b95e2,_0x3d2dfb){var _0x1191c4=function(_0x4a18b3){while(--_0x4a18b3){_0x3b95e2['push'](_0x3b95e2['shift']());}};_0x1191c4(++_0x3d2dfb);}(_0x1ea0,0x1e0));var _0x01ea=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1ea0[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x01ea('0x0'));var util=require(_0x01ea('0x1'));var utils=require(_0x01ea('0x2'));var dials={};function writeDB(_0x1ea48d){utils[_0x01ea('0x3')](util[_0x01ea('0x4')](_0x01ea('0x5'),_0x1ea48d[_0x01ea('0x6')],_0x1ea48d[_0x01ea('0x7')],_0x1ea48d[_0x01ea('0x8')],_0x1ea48d[_0x01ea('0x9')],_0x1ea48d[_0x01ea('0xa')],_0x1ea48d[_0x01ea('0xb')]));utils['request'](_0x01ea('0xc'),_0x1ea48d);delete dials[_0x1ea48d[_0x01ea('0x6')]];}exports[_0x01ea('0xd')]=function(_0x14acd0){try{utils['debug'](util['format']('[%s][dials][newexten]',_0x14acd0[_0x01ea('0x6')]),_0x14acd0);utils[_0x01ea('0x3')](util[_0x01ea('0x4')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x14acd0[_0x01ea('0x6')],_0x14acd0[_0x01ea('0xe')],_0x14acd0[_0x01ea('0xf')]));if(_0x14acd0[_0x01ea('0xe')][_0x01ea('0x10')]()=='set'&&_[_0x01ea('0x11')](_0x14acd0[_0x01ea('0xf')]['toLowerCase'](),'cdr(routeid)')){var _0x41b2f1=_0x14acd0[_0x01ea('0xf')]['split']('=');dials[_0x14acd0[_0x01ea('0x6')]]={'routeId':_0x41b2f1[0x1]};}}catch(_0x5a2a87){utils['error'](util['format'](_0x01ea('0x12'),_0x14acd0[_0x01ea('0x6')]),_0x5a2a87);}};exports['varset']=function(_0x2fa0bb){try{utils[_0x01ea('0x13')](util['format']('[%s][dials][varset]',_0x2fa0bb[_0x01ea('0x6')]),_0x2fa0bb);if(!_[_0x01ea('0x14')](_0x2fa0bb[_0x01ea('0x15')][_0x01ea('0x16')])){utils[_0x01ea('0x3')](util['format'](_0x01ea('0x17'),_0x2fa0bb['uniqueid'],_0x2fa0bb[_0x01ea('0x18')]));dials[_0x2fa0bb[_0x01ea('0x6')]]={'routeId':_0x2fa0bb[_0x01ea('0x18')]};}}catch(_0x58a82d){utils['error'](util[_0x01ea('0x4')]('[%s][dials][varset]',_0x2fa0bb[_0x01ea('0x6')]),_0x58a82d);}};exports[_0x01ea('0x19')]=function(_0x557c58){try{if(!_[_0x01ea('0x14')](dials[_0x557c58[_0x01ea('0x6')]])){utils[_0x01ea('0x13')](util[_0x01ea('0x4')](_0x01ea('0x1a'),_0x557c58[_0x01ea('0x6')]),_0x557c58);dials[_0x557c58[_0x01ea('0x6')]]=_[_0x01ea('0x1b')](dials[_0x557c58[_0x01ea('0x6')]],_0x557c58);dials[_0x557c58[_0x01ea('0x6')]][_0x01ea('0x1c')]=utils[_0x01ea('0x1d')]();dials[_0x557c58[_0x01ea('0x6')]][_0x01ea('0x1e')]=_0x01ea('0x1f');utils['info'](util[_0x01ea('0x4')](_0x01ea('0x20'),_0x557c58[_0x01ea('0x6')],dials[_0x557c58[_0x01ea('0x6')]][_0x01ea('0x1c')]));}}catch(_0xfb1915){utils[_0x01ea('0x21')](util[_0x01ea('0x4')]('[%s][dials][dialbegin]',_0x557c58[_0x01ea('0x6')]),_0xfb1915);}};exports[_0x01ea('0x22')]=function(_0x14025f){try{if(!_['isNil'](dials[_0x14025f[_0x01ea('0x6')]])){utils[_0x01ea('0x13')](util[_0x01ea('0x4')](_0x01ea('0x23'),_0x14025f[_0x01ea('0x6')]),_0x14025f);dials[_0x14025f['uniqueid']][_0x01ea('0xb')]=_0x14025f[_0x01ea('0xb')];if(_0x14025f['dialstatus']==_0x01ea('0x24')){dials[_0x14025f[_0x01ea('0x6')]]=_[_0x01ea('0x1b')](dials[_0x14025f[_0x01ea('0x6')]],_0x14025f);dials[_0x14025f[_0x01ea('0x6')]][_0x01ea('0x25')]=utils[_0x01ea('0x1d')]();dials[_0x14025f[_0x01ea('0x6')]][_0x01ea('0x1e')]=_0x01ea('0x26');utils[_0x01ea('0x3')](util[_0x01ea('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x14025f[_0x01ea('0x6')],_0x14025f['dialstatus'],dials[_0x14025f[_0x01ea('0x6')]][_0x01ea('0x25')]));}else{utils[_0x01ea('0x3')](util[_0x01ea('0x4')]('[%s][dials][dialend]\x20dialstatus:%s',_0x14025f[_0x01ea('0x6')],_0x14025f[_0x01ea('0xb')]));}}}catch(_0x1a6692){utils['error'](util[_0x01ea('0x4')](_0x01ea('0x23'),_0x14025f['uniqueid']),_0x1a6692);}};exports[_0x01ea('0x27')]=function(_0x186a0e){try{if(!_['isNil'](dials[_0x186a0e['uniqueid']])){utils[_0x01ea('0x13')](util[_0x01ea('0x4')](_0x01ea('0x28'),_0x186a0e['uniqueid']),_0x186a0e);utils['info'](util[_0x01ea('0x4')](_0x01ea('0x29'),_0x186a0e[_0x01ea('0x6')],_0x186a0e[_0x01ea('0x9')],_0x186a0e['calleridname'],_0x186a0e[_0x01ea('0x2a')]));dials[_0x186a0e[_0x01ea('0x6')]]=_[_0x01ea('0x1b')](dials[_0x186a0e[_0x01ea('0x6')]],{'endtime':utils[_0x01ea('0x1d')](),'lastevent':_0x01ea('0x2b')});dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2c')]=utils['diffTime'](dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2d')],dials[_0x186a0e[_0x01ea('0x6')]]['starttime']);dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2e')]=utils['diffTime'](dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x25')]||dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x2d')],dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x1c')]);dials[_0x186a0e[_0x01ea('0x6')]]['billableseconds']=dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x25')]?utils[_0x01ea('0x2f')](dials[_0x186a0e['uniqueid']][_0x01ea('0x2d')],dials[_0x186a0e[_0x01ea('0x6')]][_0x01ea('0x25')]):0x0;writeDB(dials[_0x186a0e[_0x01ea('0x6')]]);}}catch(_0x22c5f0){utils[_0x01ea('0x21')](util[_0x01ea('0x4')](_0x01ea('0x28'),_0x186a0e['uniqueid']),_0x22c5f0);}}; \ No newline at end of file +var _0xa5f9=['answertime','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','cause-txt','complete','duration','diffTime','endtime','lodash','util','info','format','uniqueid','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr(routeid)','error','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','dialend','[%s][dials][dialend]','dialstatus','ANSWER'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xa5f9,0xd6));var _0x9a5f=function(_0x4a3f59,_0xe8bfdb){_0x4a3f59=_0x4a3f59-0x0;var _0x49d80e=_0xa5f9[_0x4a3f59];return _0x49d80e;};'use strict';var _=require(_0x9a5f('0x0'));var util=require(_0x9a5f('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x641072){utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x641072[_0x9a5f('0x4')],_0x641072['channel'],_0x641072[_0x9a5f('0x5')],_0x641072['calleridnum'],_0x641072[_0x9a5f('0x6')],_0x641072['dialstatus']));utils[_0x9a5f('0x7')](_0x9a5f('0x8'),_0x641072);delete dials[_0x641072[_0x9a5f('0x4')]];}exports[_0x9a5f('0x9')]=function(_0x51c1fa){try{utils[_0x9a5f('0xa')](util[_0x9a5f('0x3')](_0x9a5f('0xb'),_0x51c1fa['uniqueid']),_0x51c1fa);utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0xc'),_0x51c1fa[_0x9a5f('0x4')],_0x51c1fa[_0x9a5f('0xd')],_0x51c1fa[_0x9a5f('0xe')]));if(_0x51c1fa['application'][_0x9a5f('0xf')]()==_0x9a5f('0x10')&&_[_0x9a5f('0x11')](_0x51c1fa[_0x9a5f('0xe')][_0x9a5f('0xf')](),_0x9a5f('0x12'))){var _0x4c1be8=_0x51c1fa[_0x9a5f('0xe')]['split']('=');dials[_0x51c1fa['uniqueid']]={'routeId':_0x4c1be8[0x1]};}}catch(_0x276b23){utils[_0x9a5f('0x13')](util[_0x9a5f('0x3')](_0x9a5f('0xb'),_0x51c1fa[_0x9a5f('0x4')]),_0x276b23);}};exports['varset']=function(_0x550b4c){try{utils['debug'](util['format'](_0x9a5f('0x14'),_0x550b4c['uniqueid']),_0x550b4c);if(!_[_0x9a5f('0x15')](_0x550b4c['variable'][_0x9a5f('0x16')])){utils[_0x9a5f('0x2')](util['format']('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x550b4c['uniqueid'],_0x550b4c['value']));dials[_0x550b4c[_0x9a5f('0x4')]]={'routeId':_0x550b4c[_0x9a5f('0x17')]};}}catch(_0x11515f){utils['error'](util['format'](_0x9a5f('0x14'),_0x550b4c[_0x9a5f('0x4')]),_0x11515f);}};exports[_0x9a5f('0x18')]=function(_0x2b970e){try{if(!_[_0x9a5f('0x15')](dials[_0x2b970e[_0x9a5f('0x4')]])){utils[_0x9a5f('0xa')](util['format'](_0x9a5f('0x19'),_0x2b970e[_0x9a5f('0x4')]),_0x2b970e);dials[_0x2b970e[_0x9a5f('0x4')]]=_[_0x9a5f('0x1a')](dials[_0x2b970e[_0x9a5f('0x4')]],_0x2b970e);dials[_0x2b970e[_0x9a5f('0x4')]][_0x9a5f('0x1b')]=utils[_0x9a5f('0x1c')]();dials[_0x2b970e[_0x9a5f('0x4')]][_0x9a5f('0x1d')]=_0x9a5f('0x1e');utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x1f'),_0x2b970e[_0x9a5f('0x4')],dials[_0x2b970e[_0x9a5f('0x4')]][_0x9a5f('0x1b')]));}}catch(_0x3d4eb7){utils[_0x9a5f('0x13')](util['format'](_0x9a5f('0x19'),_0x2b970e[_0x9a5f('0x4')]),_0x3d4eb7);}};exports[_0x9a5f('0x20')]=function(_0xca2ad7){try{if(!_[_0x9a5f('0x15')](dials[_0xca2ad7[_0x9a5f('0x4')]])){utils[_0x9a5f('0xa')](util[_0x9a5f('0x3')](_0x9a5f('0x21'),_0xca2ad7[_0x9a5f('0x4')]),_0xca2ad7);dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x22')]=_0xca2ad7[_0x9a5f('0x22')];if(_0xca2ad7[_0x9a5f('0x22')]==_0x9a5f('0x23')){dials[_0xca2ad7[_0x9a5f('0x4')]]=_[_0x9a5f('0x1a')](dials[_0xca2ad7[_0x9a5f('0x4')]],_0xca2ad7);dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x24')]=utils['now']();dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x1d')]=_0x9a5f('0x25');utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x26'),_0xca2ad7['uniqueid'],_0xca2ad7[_0x9a5f('0x22')],dials[_0xca2ad7[_0x9a5f('0x4')]][_0x9a5f('0x24')]));}else{utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x27'),_0xca2ad7[_0x9a5f('0x4')],_0xca2ad7['dialstatus']));}}}catch(_0xd4fa92){utils[_0x9a5f('0x13')](util[_0x9a5f('0x3')](_0x9a5f('0x21'),_0xca2ad7[_0x9a5f('0x4')]),_0xd4fa92);}};exports[_0x9a5f('0x28')]=function(_0x18a89b){try{if(!_[_0x9a5f('0x15')](dials[_0x18a89b[_0x9a5f('0x4')]])){utils['debug'](util[_0x9a5f('0x3')](_0x9a5f('0x29'),_0x18a89b['uniqueid']),_0x18a89b);utils[_0x9a5f('0x2')](util[_0x9a5f('0x3')](_0x9a5f('0x2a'),_0x18a89b['uniqueid'],_0x18a89b[_0x9a5f('0x2b')],_0x18a89b[_0x9a5f('0x2c')],_0x18a89b[_0x9a5f('0x2d')]));dials[_0x18a89b[_0x9a5f('0x4')]]=_['assign'](dials[_0x18a89b[_0x9a5f('0x4')]],{'endtime':utils[_0x9a5f('0x1c')](),'lastevent':_0x9a5f('0x2e')});dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x2f')]=utils[_0x9a5f('0x30')](dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x31')],dials[_0x18a89b['uniqueid']]['starttime']);dials[_0x18a89b['uniqueid']]['holdtime']=utils[_0x9a5f('0x30')](dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x24')]||dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x31')],dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x1b')]);dials[_0x18a89b['uniqueid']]['billableseconds']=dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x24')]?utils['diffTime'](dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x31')],dials[_0x18a89b[_0x9a5f('0x4')]][_0x9a5f('0x24')]):0x0;writeDB(dials[_0x18a89b[_0x9a5f('0x4')]]);}}catch(_0x187187){utils[_0x9a5f('0x13')](util[_0x9a5f('0x3')](_0x9a5f('0x29'),_0x18a89b[_0x9a5f('0x4')]),_0x187187);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 32116cc..3a4ea03 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 _0x748b=['[%s][index][newexten]','newexten','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./queues.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','format','device','devicestatechange','[%s][index][devicestatechange]','agentcalled','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','debug','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]'];(function(_0x42e9b4,_0x5819f2){var _0x2d836a=function(_0x362d3c){while(--_0x362d3c){_0x42e9b4['push'](_0x42e9b4['shift']());}};_0x2d836a(++_0x5819f2);}(_0x748b,0x1f2));var _0xb748=function(_0x2474cb,_0x5bdeba){_0x2474cb=_0x2474cb-0x0;var _0x42c824=_0x748b[_0x2474cb];return _0x42c824;};var AsteriskManager=require(_0xb748('0x0'));var config=require(_0xb748('0x1'));var utils=require(_0xb748('0x2'));var util=require(_0xb748('0x3'));var isXDREnabled=config[_0xb748('0x4')]&&config['xdr'][_0xb748('0x5')]?!config[_0xb748('0x4')][_0xb748('0x5')]:!![];var isProduction=config['env']===_0xb748('0x6')||![];var isLocalAsterisk=config[_0xb748('0x4')]&&config[_0xb748('0x4')][_0xb748('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xb748('0x8')][_0xb748('0x9')],config[_0xb748('0x8')]['ip'],config[_0xb748('0x8')][_0xb748('0xa')],config[_0xb748('0x8')][_0xb748('0xb')],!![]);ami[_0xb748('0xc')]();if(!isXDREnabled){utils[_0xb748('0xd')](_0xb748('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xb748('0xd')](_0xb748('0xf'));}else{var agents=require(_0xb748('0x10'));var calls=require('./calls.controller');var queues=require(_0xb748('0x11'));var recordings=require(_0xb748('0x12'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xb748('0x13'));var core=require(_0xb748('0x14'));ami['on'](_0xb748('0x15'),core[_0xb748('0x15')]);ami['on'](_0xb748('0x16'),core[_0xb748('0x16')]);ami['on'](_0xb748('0x17'),core[_0xb748('0x17')]);ami['on']('error',core[_0xb748('0x18')]);ami['on'](_0xb748('0x19'),core[_0xb748('0x19')]);ami['on'](_0xb748('0x1a'),core[_0xb748('0x1a')]);ami['on']('devicestatechange',function(_0x5705b3){try{utils['debug'](util[_0xb748('0x1b')]('[%s][index][devicestatechange]',_0x5705b3[_0xb748('0x1c')]),_0x5705b3);members[_0xb748('0x1d')](_0x5705b3);}catch(_0x3ab81d){utils['error'](util[_0xb748('0x1b')](_0xb748('0x1e'),_0x5705b3[_0xb748('0x1c')]),_0x3ab81d);}});ami['on'](_0xb748('0x1f'),function(_0x3726b2){try{utils['debug'](util['format'](_0xb748('0x20'),_0x3726b2[_0xb748('0x21')]),_0x3726b2);agents[_0xb748('0x1f')](_0x3726b2);}catch(_0xdae21f){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x20'),_0x3726b2[_0xb748('0x21')]),_0xdae21f);}});ami['on']('agentringnoanswer',function(_0x2b4a31){try{utils['debug'](util[_0xb748('0x1b')](_0xb748('0x22'),_0x2b4a31[_0xb748('0x21')]),_0x2b4a31);agents['agentringnoanswer'](_0x2b4a31);}catch(_0x47e866){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x22'),_0x2b4a31[_0xb748('0x21')]),_0x47e866);}});ami['on'](_0xb748('0x23'),function(_0x4d27c9){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x25'),_0x4d27c9[_0xb748('0x21')]),_0x4d27c9);agents[_0xb748('0x23')](_0x4d27c9);queues[_0xb748('0x23')](_0x4d27c9);}catch(_0x3975a4){utils[_0xb748('0x18')](util['format'](_0xb748('0x25'),_0x4d27c9[_0xb748('0x21')]),_0x3975a4);}});ami['on'](_0xb748('0x26'),function(_0x144428){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x27'),_0x144428[_0xb748('0x21')]),_0x144428);agents[_0xb748('0x26')](_0x144428);queues[_0xb748('0x26')](_0x144428);members[_0xb748('0x26')](_0x144428);}catch(_0x249a35){utils[_0xb748('0x18')](util['format'](_0xb748('0x27'),_0x144428['uniqueid']),_0x249a35);}});ami['on']('queuecallerabandon',function(_0x37023b){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x28'),_0x37023b['uniqueid']),_0x37023b);agents['queuecallerabandon'](_0x37023b);queues['queuecallerabandon'](_0x37023b);}catch(_0x287761){utils['error'](util['format']('[%s][index][queuecallerabandon]',_0x37023b[_0xb748('0x21')]),_0x287761);}});ami['on']('queuecallerjoin',function(_0x7006be){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x29'),_0x7006be['uniqueid']),_0x7006be);queues['queuecallerjoin'](_0x7006be);recordings[_0xb748('0x2a')](_0x7006be);}catch(_0x268f02){utils['error'](util['format'](_0xb748('0x29'),_0x7006be[_0xb748('0x21')]),_0x268f02);}});ami['on'](_0xb748('0x2b'),function(_0x110503){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x2c'),_0x110503[_0xb748('0x21')]),_0x110503);queues[_0xb748('0x2b')](_0x110503);}catch(_0x3a83ec){utils[_0xb748('0x18')](util[_0xb748('0x1b')]('[%s][index][queuecallerleave]',_0x110503[_0xb748('0x21')]),_0x3a83ec);}});ami['on']('musiconholdstart',function(_0x539a77){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')]('[%s][index][musiconholdstart]',_0x539a77[_0xb748('0x21')]),_0x539a77);queues[_0xb748('0x2d')](_0x539a77);calls['musiconholdstart'](_0x539a77);}catch(_0x48b825){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x2e'),_0x539a77[_0xb748('0x21')]),_0x48b825);}});ami['on'](_0xb748('0x2f'),function(_0x24e9a5){try{utils[_0xb748('0x24')](util['format'](_0xb748('0x30'),_0x24e9a5[_0xb748('0x21')]),_0x24e9a5);queues[_0xb748('0x2f')](_0x24e9a5);calls[_0xb748('0x2f')](_0x24e9a5);}catch(_0x216878){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x30'),_0x24e9a5[_0xb748('0x21')]),_0x216878);}});ami['on'](_0xb748('0x31'),function(_0xcd780c){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x32'),_0xcd780c['uniqueid']),_0xcd780c);calls[_0xb748('0x31')](_0xcd780c);recordings['newstate'](_0xcd780c);}catch(_0x274f8b){utils['error'](util[_0xb748('0x1b')](_0xb748('0x32'),_0xcd780c[_0xb748('0x21')]),_0x274f8b);}});ami['on'](_0xb748('0x33'),function(_0x5e8b8c){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x34'),_0x5e8b8c[_0xb748('0x21')]),_0x5e8b8c);calls[_0xb748('0x33')](_0x5e8b8c);recordings[_0xb748('0x33')](_0x5e8b8c);dials[_0xb748('0x33')](_0x5e8b8c);agents[_0xb748('0x33')](_0x5e8b8c);queues[_0xb748('0x33')](_0x5e8b8c);}catch(_0x34c6f4){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x34'),_0x5e8b8c['uniqueid']),_0x34c6f4);}});ami['on']('cdr',function(_0x100370){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')]('[%s][index][cdr]',_0x100370[_0xb748('0x21')]),_0x100370);members[_0xb748('0x35')](_0x100370);}catch(_0x98126f){utils[_0xb748('0x18')](util['format'](_0xb748('0x36'),_0x100370['uniqueid']),_0x98126f);}});ami['on'](_0xb748('0x37'),function(_0x5b1b75){try{utils[_0xb748('0x24')](util['format'](_0xb748('0x38'),_0x5b1b75[_0xb748('0x21')]),_0x5b1b75);queues[_0xb748('0x37')](_0x5b1b75);agents[_0xb748('0x37')](_0x5b1b75);transfers['blindtransfer'](_0x5b1b75);}catch(_0x5e7857){utils[_0xb748('0x18')](util[_0xb748('0x1b')]('[%s][index][blindtransfer]',_0x5b1b75[_0xb748('0x21')]),_0x5e7857);}});ami['on'](_0xb748('0x39'),function(_0x384022){try{utils['debug'](util[_0xb748('0x1b')](_0xb748('0x3a'),_0x384022[_0xb748('0x3b')]),_0x384022);queues[_0xb748('0x39')](_0x384022);transfers[_0xb748('0x39')](_0x384022);agents['attendedtransfer'](_0x384022);calls[_0xb748('0x39')](_0x384022);}catch(_0x485890){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x3a'),_0x384022[_0xb748('0x3b')]),_0x485890);}});ami['on'](_0xb748('0x3c'),function(_0x8c080){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x3d'),_0x8c080[_0xb748('0x21')]),_0x8c080);queues[_0xb748('0x3c')](_0x8c080);recordings['varset'](_0x8c080);calls[_0xb748('0x3c')](_0x8c080);dials[_0xb748('0x3c')](_0x8c080);}catch(_0x5c1944){utils[_0xb748('0x18')](util['format'](_0xb748('0x3d'),_0x8c080[_0xb748('0x21')]),_0x5c1944);}});ami['on']('newexten',function(_0x11a1f4){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x3e'),_0x11a1f4['uniqueid']),_0x11a1f4);calls[_0xb748('0x3f')](_0x11a1f4);recordings[_0xb748('0x3f')](_0x11a1f4);dials['newexten'](_0x11a1f4);}catch(_0x2ad6b7){utils[_0xb748('0x18')](util['format']('[%s][index][newexten]',_0x11a1f4[_0xb748('0x21')]),_0x2ad6b7);}});ami['on']('newchannel',function(_0x240ae6){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x40'),_0x240ae6[_0xb748('0x21')]),_0x240ae6);calls[_0xb748('0x41')](_0x240ae6);recordings['newchannel'](_0x240ae6);}catch(_0x260e01){utils[_0xb748('0x18')](util['format'](_0xb748('0x40'),_0x240ae6[_0xb748('0x21')]),_0x260e01);}});ami['on'](_0xb748('0x42'),function(_0x5a821d){try{utils['debug'](util[_0xb748('0x1b')]('[%s][index][dialbegin]',_0x5a821d[_0xb748('0x21')]),_0x5a821d);dials[_0xb748('0x42')](_0x5a821d);}catch(_0x584030){utils['error'](util[_0xb748('0x1b')](_0xb748('0x43'),_0x5a821d[_0xb748('0x21')]),_0x584030);}});ami['on'](_0xb748('0x44'),function(_0x2586a3){try{utils[_0xb748('0x24')](util[_0xb748('0x1b')](_0xb748('0x45'),_0x2586a3[_0xb748('0x21')]),_0x2586a3);dials[_0xb748('0x44')](_0x2586a3);}catch(_0x5f2e70){utils[_0xb748('0x18')](util[_0xb748('0x1b')](_0xb748('0x45'),_0x2586a3[_0xb748('0x21')]),_0x5f2e70);}});} \ No newline at end of file +var _0xc7ee=['shutdown','fullybooted','error','close','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','uniqueid','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','debug','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect'];(function(_0x473d1e,_0x4df799){var _0x503be9=function(_0x4bcfff){while(--_0x4bcfff){_0x473d1e['push'](_0x473d1e['shift']());}};_0x503be9(++_0x4df799);}(_0xc7ee,0x1aa));var _0xec7e=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xc7ee[_0x3bf83f];return _0x22c4a9;};var AsteriskManager=require(_0xec7e('0x0'));var config=require(_0xec7e('0x1'));var utils=require(_0xec7e('0x2'));var util=require(_0xec7e('0x3'));var isXDREnabled=config[_0xec7e('0x4')]&&config[_0xec7e('0x4')]['disabled']?!config[_0xec7e('0x4')][_0xec7e('0x5')]:!![];var isProduction=config[_0xec7e('0x6')]===_0xec7e('0x7')||![];var isLocalAsterisk=config[_0xec7e('0x4')]&&config[_0xec7e('0x4')][_0xec7e('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xec7e('0x9')][_0xec7e('0xa')],config[_0xec7e('0x9')]['ip'],config[_0xec7e('0x9')][_0xec7e('0xb')],config[_0xec7e('0x9')][_0xec7e('0xc')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0xec7e('0xd')](_0xec7e('0xe'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xec7e('0xd')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xec7e('0xf'));var calls=require(_0xec7e('0x10'));var queues=require(_0xec7e('0x11'));var recordings=require(_0xec7e('0x12'));var members=require(_0xec7e('0x13'));var dials=require(_0xec7e('0x14'));var transfers=require(_0xec7e('0x15'));var core=require(_0xec7e('0x16'));ami['on']('connect',core[_0xec7e('0x17')]);ami['on'](_0xec7e('0x18'),core[_0xec7e('0x18')]);ami['on'](_0xec7e('0x19'),core['fullybooted']);ami['on'](_0xec7e('0x1a'),core['error']);ami['on'](_0xec7e('0x1b'),core[_0xec7e('0x1b')]);ami['on'](_0xec7e('0x1c'),core['managerevent']);ami['on'](_0xec7e('0x1d'),function(_0x50bc12){try{utils['debug'](util[_0xec7e('0x1e')](_0xec7e('0x1f'),_0x50bc12[_0xec7e('0x20')]),_0x50bc12);members[_0xec7e('0x1d')](_0x50bc12);}catch(_0x1a3e16){utils[_0xec7e('0x1a')](util['format'](_0xec7e('0x1f'),_0x50bc12[_0xec7e('0x20')]),_0x1a3e16);}});ami['on'](_0xec7e('0x21'),function(_0xdb6bc5){try{utils['debug'](util[_0xec7e('0x1e')]('[%s][index][agentcalled]',_0xdb6bc5[_0xec7e('0x22')]),_0xdb6bc5);agents[_0xec7e('0x21')](_0xdb6bc5);}catch(_0x4a1638){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x23'),_0xdb6bc5[_0xec7e('0x22')]),_0x4a1638);}});ami['on'](_0xec7e('0x24'),function(_0x4c5528){try{utils['debug'](util[_0xec7e('0x1e')](_0xec7e('0x25'),_0x4c5528['uniqueid']),_0x4c5528);agents[_0xec7e('0x24')](_0x4c5528);}catch(_0x5e0281){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x25'),_0x4c5528['uniqueid']),_0x5e0281);}});ami['on']('agentconnect',function(_0x3cb3df){try{utils['debug'](util['format'](_0xec7e('0x26'),_0x3cb3df['uniqueid']),_0x3cb3df);agents[_0xec7e('0x27')](_0x3cb3df);queues[_0xec7e('0x27')](_0x3cb3df);}catch(_0x2f61e7){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x26'),_0x3cb3df['uniqueid']),_0x2f61e7);}});ami['on'](_0xec7e('0x28'),function(_0x337faa){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x2a'),_0x337faa[_0xec7e('0x22')]),_0x337faa);agents[_0xec7e('0x28')](_0x337faa);queues[_0xec7e('0x28')](_0x337faa);members[_0xec7e('0x28')](_0x337faa);}catch(_0x51f315){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x2a'),_0x337faa[_0xec7e('0x22')]),_0x51f315);}});ami['on']('queuecallerabandon',function(_0x4a6a81){try{utils[_0xec7e('0x29')](util['format']('[%s][index][queuecallerabandon]',_0x4a6a81[_0xec7e('0x22')]),_0x4a6a81);agents[_0xec7e('0x2b')](_0x4a6a81);queues[_0xec7e('0x2b')](_0x4a6a81);}catch(_0x6b65e5){utils[_0xec7e('0x1a')](util['format'](_0xec7e('0x2c'),_0x4a6a81[_0xec7e('0x22')]),_0x6b65e5);}});ami['on'](_0xec7e('0x2d'),function(_0x234235){try{utils[_0xec7e('0x29')](util['format']('[%s][index][queuecallerjoin]',_0x234235[_0xec7e('0x22')]),_0x234235);queues[_0xec7e('0x2d')](_0x234235);recordings[_0xec7e('0x2d')](_0x234235);}catch(_0x3d1663){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x2e'),_0x234235[_0xec7e('0x22')]),_0x3d1663);}});ami['on'](_0xec7e('0x2f'),function(_0x1f0616){try{utils['debug'](util[_0xec7e('0x1e')](_0xec7e('0x30'),_0x1f0616[_0xec7e('0x22')]),_0x1f0616);queues['queuecallerleave'](_0x1f0616);}catch(_0x579593){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x30'),_0x1f0616['uniqueid']),_0x579593);}});ami['on'](_0xec7e('0x31'),function(_0x4b4a7f){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')]('[%s][index][musiconholdstart]',_0x4b4a7f['uniqueid']),_0x4b4a7f);queues[_0xec7e('0x31')](_0x4b4a7f);calls[_0xec7e('0x31')](_0x4b4a7f);}catch(_0xb0756c){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x32'),_0x4b4a7f[_0xec7e('0x22')]),_0xb0756c);}});ami['on'](_0xec7e('0x33'),function(_0x2b7f8e){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x34'),_0x2b7f8e[_0xec7e('0x22')]),_0x2b7f8e);queues[_0xec7e('0x33')](_0x2b7f8e);calls['musiconholdstop'](_0x2b7f8e);}catch(_0x34a0aa){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x34'),_0x2b7f8e[_0xec7e('0x22')]),_0x34a0aa);}});ami['on'](_0xec7e('0x35'),function(_0x26d122){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')]('[%s][index][newstate]',_0x26d122[_0xec7e('0x22')]),_0x26d122);calls['newstate'](_0x26d122);recordings[_0xec7e('0x35')](_0x26d122);}catch(_0x25a603){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x36'),_0x26d122[_0xec7e('0x22')]),_0x25a603);}});ami['on']('hangup',function(_0x11237f){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x37'),_0x11237f[_0xec7e('0x22')]),_0x11237f);calls[_0xec7e('0x38')](_0x11237f);recordings[_0xec7e('0x38')](_0x11237f);dials[_0xec7e('0x38')](_0x11237f);agents[_0xec7e('0x38')](_0x11237f);queues[_0xec7e('0x38')](_0x11237f);}catch(_0x38c584){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')]('[%s][index][hangup]',_0x11237f[_0xec7e('0x22')]),_0x38c584);}});ami['on'](_0xec7e('0x39'),function(_0x4784b9){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x3a'),_0x4784b9['uniqueid']),_0x4784b9);members[_0xec7e('0x39')](_0x4784b9);}catch(_0x2d0d72){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x3a'),_0x4784b9[_0xec7e('0x22')]),_0x2d0d72);}});ami['on'](_0xec7e('0x3b'),function(_0x2e0b05){try{utils[_0xec7e('0x29')](util['format'](_0xec7e('0x3c'),_0x2e0b05[_0xec7e('0x22')]),_0x2e0b05);queues[_0xec7e('0x3b')](_0x2e0b05);agents['blindtransfer'](_0x2e0b05);transfers[_0xec7e('0x3b')](_0x2e0b05);}catch(_0x2cb468){utils[_0xec7e('0x1a')](util['format'](_0xec7e('0x3c'),_0x2e0b05[_0xec7e('0x22')]),_0x2cb468);}});ami['on'](_0xec7e('0x3d'),function(_0x463bb9){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x3e'),_0x463bb9[_0xec7e('0x3f')]),_0x463bb9);queues[_0xec7e('0x3d')](_0x463bb9);transfers[_0xec7e('0x3d')](_0x463bb9);agents[_0xec7e('0x3d')](_0x463bb9);calls[_0xec7e('0x3d')](_0x463bb9);}catch(_0x27cd58){utils['error'](util[_0xec7e('0x1e')]('[%s][index][attendedtransfer]',_0x463bb9[_0xec7e('0x3f')]),_0x27cd58);}});ami['on']('varset',function(_0x92e0e5){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x40'),_0x92e0e5[_0xec7e('0x22')]),_0x92e0e5);queues[_0xec7e('0x41')](_0x92e0e5);recordings['varset'](_0x92e0e5);calls['varset'](_0x92e0e5);dials[_0xec7e('0x41')](_0x92e0e5);}catch(_0x11e9af){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x40'),_0x92e0e5['uniqueid']),_0x11e9af);}});ami['on'](_0xec7e('0x42'),function(_0x314e57){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x43'),_0x314e57[_0xec7e('0x22')]),_0x314e57);calls[_0xec7e('0x42')](_0x314e57);recordings[_0xec7e('0x42')](_0x314e57);dials[_0xec7e('0x42')](_0x314e57);}catch(_0x17d986){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')]('[%s][index][newexten]',_0x314e57[_0xec7e('0x22')]),_0x17d986);}});ami['on'](_0xec7e('0x44'),function(_0x2c6e6b){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x45'),_0x2c6e6b[_0xec7e('0x22')]),_0x2c6e6b);calls[_0xec7e('0x44')](_0x2c6e6b);recordings[_0xec7e('0x44')](_0x2c6e6b);}catch(_0x12213e){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x45'),_0x2c6e6b[_0xec7e('0x22')]),_0x12213e);}});ami['on']('dialbegin',function(_0x5665e6){try{utils[_0xec7e('0x29')](util[_0xec7e('0x1e')](_0xec7e('0x46'),_0x5665e6['uniqueid']),_0x5665e6);dials[_0xec7e('0x47')](_0x5665e6);}catch(_0x38e34a){utils[_0xec7e('0x1a')](util[_0xec7e('0x1e')](_0xec7e('0x48'),_0x5665e6['uniqueid']),_0x38e34a);}});ami['on'](_0xec7e('0x49'),function(_0x44cde2){try{utils[_0xec7e('0x29')](util['format'](_0xec7e('0x4a'),_0x44cde2['uniqueid']),_0x44cde2);dials[_0xec7e('0x49')](_0x44cde2);}catch(_0x5988ea){utils[_0xec7e('0x1a')](util['format']('[%s][index][dialend]',_0x44cde2[_0xec7e('0x22')]),_0x5988ea);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 10f1650..61a08d0 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 _0x5a89=['data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','destination','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','interface','channel','data2','membername','type','getUserByInterface','then','name','internal','request','getUserByName','split','CreateMemberReport','error','[%s][members][writeDB]','uniqueid','some','startsWith','devicestatechange','debug','device','state','INUSE','BUSY','voice','TALKING','now','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','cdr','[%s][members][cdr]'];(function(_0x2fd3e8,_0x1c8ea9){var _0x46f0ee=function(_0x43274c){while(--_0x43274c){_0x2fd3e8['push'](_0x2fd3e8['shift']());}};_0x46f0ee(++_0x1c8ea9);}(_0x5a89,0x6a));var _0x95a8=function(_0x1a1036,_0x184bfb){_0x1a1036=_0x1a1036-0x0;var _0x2efad9=_0x5a89[_0x1a1036];return _0x2efad9;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x95a8('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x95a8('0x1')];function writeDB(_0x27b97e){utils[_0x95a8('0x2')](util[_0x95a8('0x3')](_0x95a8('0x4'),_0x27b97e['uniqueid'],_0x27b97e[_0x95a8('0x5')],_0x27b97e[_0x95a8('0x6')],_0x27b97e[_0x95a8('0x7')],_0x27b97e[_0x95a8('0x8')],_0x27b97e[_0x95a8('0x9')]));if(_0x27b97e[_0x95a8('0x5')]){utils[_0x95a8('0xa')](_0x27b97e[_0x95a8('0x5')])[_0x95a8('0xb')](function(_0x3edf8e){if(_0x3edf8e){_0x27b97e[_0x95a8('0x8')]=_0x3edf8e[_0x95a8('0xc')];_0x27b97e[_0x95a8('0xd')]=_0x3edf8e[_0x95a8('0xd')];utils[_0x95a8('0xe')]('CreateMemberReport',_0x27b97e);}else{utils[_0x95a8('0xf')](_0x27b97e[_0x95a8('0x5')][_0x95a8('0x10')]('/')[0x1])[_0x95a8('0xb')](function(_0x4595ad){if(_0x4595ad){_0x27b97e[_0x95a8('0x8')]=_0x4595ad[_0x95a8('0xc')];_0x27b97e['internal']=_0x4595ad[_0x95a8('0xd')];utils[_0x95a8('0xe')](_0x95a8('0x11'),_0x27b97e);}});}})['catch'](function(_0x3bbbb3){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x13'),_0x27b97e[_0x95a8('0x14')]),_0x3bbbb3);});}delete members[_0x27b97e[_0x95a8('0x5')]];}function startsWith(_0x501ea0,_0x1912fc){return _[_0x95a8('0x15')](_0x501ea0,function(_0x5f2c2e){return _[_0x95a8('0x16')](_0x1912fc,_0x5f2c2e);});}exports[_0x95a8('0x17')]=function(_0x3cc7c6){try{utils[_0x95a8('0x18')](util['format']('[%s][members][devicestatechange]',members[_0x3cc7c6[_0x95a8('0x19')]]?members[_0x3cc7c6['device']][_0x95a8('0x14')]:_0x3cc7c6[_0x95a8('0x19')]),_0x3cc7c6);utils[_0x95a8('0x2')](util[_0x95a8('0x3')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x3cc7c6[_0x95a8('0x19')]]?members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x14')]:_0x3cc7c6[_0x95a8('0x19')],_0x3cc7c6[_0x95a8('0x1a')],_0x3cc7c6[_0x95a8('0x19')]));switch(_0x3cc7c6[_0x95a8('0x1a')]){case _0x95a8('0x1b'):case _0x95a8('0x1c'):if(!startsWith(exclude,_0x3cc7c6[_0x95a8('0x19')])){members[_0x3cc7c6['device']]={'channel':_0x95a8('0x1d'),'interface':_0x3cc7c6['device'],'type':_0x95a8('0x1e'),'enterAt':utils[_0x95a8('0x1f')](),'role':'agent'};}break;case _0x95a8('0x20'):if(!_[_0x95a8('0x21')](members[_0x3cc7c6[_0x95a8('0x19')]])){members[_0x3cc7c6['device']][_0x95a8('0x22')]=utils[_0x95a8('0x1f')]();members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x23')]=utils[_0x95a8('0x24')](members[_0x3cc7c6[_0x95a8('0x19')]]['exitAt'],members[_0x3cc7c6['device']][_0x95a8('0x25')]);if(members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x14')]){writeDB(members[_0x3cc7c6[_0x95a8('0x19')]]);}}break;default:break;}}catch(_0x1ef7a7){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x26'),members[_0x3cc7c6[_0x95a8('0x19')]]?members[_0x3cc7c6[_0x95a8('0x19')]][_0x95a8('0x14')]:_0x3cc7c6[_0x95a8('0x19')]),_0x1ef7a7);}};exports['agentcomplete']=function(_0x2f13fd){try{if(!_['isNil'](members[_0x2f13fd[_0x95a8('0x5')]])){utils[_0x95a8('0x18')](util[_0x95a8('0x3')](_0x95a8('0x27'),_0x2f13fd[_0x95a8('0x14')]),_0x2f13fd);utils[_0x95a8('0x2')](util[_0x95a8('0x3')](_0x95a8('0x28'),_0x2f13fd[_0x95a8('0x14')],_0x2f13fd['interface'],_0x2f13fd['queue']));members[_0x2f13fd[_0x95a8('0x5')]]=_[_0x95a8('0x29')](members[_0x2f13fd[_0x95a8('0x5')]],{'data4':_0x2f13fd['queue'],'uniqueid':_0x2f13fd[_0x95a8('0x14')]});}}catch(_0x4e0a9c){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x27'),_0x2f13fd['uniqueid']),_0x4e0a9c);}};exports[_0x95a8('0x2a')]=function(_0x57b1a4){try{utils['debug'](util['format'](_0x95a8('0x2b'),_0x57b1a4[_0x95a8('0x14')]),_0x57b1a4);if(_0x57b1a4[_0x95a8('0x6')]){var _0x3839f3=_0x57b1a4[_0x95a8('0x6')]['split']('-')[0x0];if(!_[_0x95a8('0x21')](members[_0x3839f3])){members[_0x3839f3]=_['assign'](members[_0x3839f3],{'data1':members[_0x3839f3][_0x95a8('0x2c')]||_0x57b1a4[_0x95a8('0x9')],'data2':members[_0x3839f3][_0x95a8('0x7')]||_0x57b1a4[_0x95a8('0x2d')],'data3':members[_0x3839f3]['data3']||_0x57b1a4['destination'],'uniqueid':members[_0x3839f3][_0x95a8('0x14')]||_0x57b1a4[_0x95a8('0x14')]});utils[_0x95a8('0x2')](util[_0x95a8('0x3')](_0x95a8('0x2e'),_0x57b1a4[_0x95a8('0x14')],members[_0x3839f3][_0x95a8('0x2c')],members[_0x3839f3][_0x95a8('0x7')],members[_0x3839f3][_0x95a8('0x2f')]));if(members[_0x3839f3][_0x95a8('0x22')]){writeDB(members[_0x3839f3]);}}}if(_0x57b1a4['destinationchannel']){var _0x11b932=_0x57b1a4[_0x95a8('0x30')][_0x95a8('0x10')]('-')[0x0];if(!_[_0x95a8('0x21')](members[_0x11b932])){members[_0x11b932]=_[_0x95a8('0x29')](members[_0x11b932],{'data1':members[_0x11b932][_0x95a8('0x2c')]||_0x57b1a4[_0x95a8('0x9')],'data2':members[_0x11b932][_0x95a8('0x7')]||_0x57b1a4[_0x95a8('0x2d')],'data3':members[_0x11b932][_0x95a8('0x2f')]||_0x57b1a4[_0x95a8('0x31')],'uniqueid':members[_0x11b932]['uniqueid']||_0x57b1a4['uniqueid']});utils[_0x95a8('0x2')](util['format']('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x57b1a4[_0x95a8('0x14')],members[_0x11b932][_0x95a8('0x2c')],members[_0x11b932]['data2'],members[_0x11b932][_0x95a8('0x2f')]));if(members[_0x11b932][_0x95a8('0x22')]){writeDB(members[_0x11b932]);}}}}catch(_0x798ab){utils[_0x95a8('0x12')](util[_0x95a8('0x3')](_0x95a8('0x2b'),_0x57b1a4[_0x95a8('0x14')]),_0x798ab);}}; \ No newline at end of file +var _0x15b7=['state','voice','now','agent','isNil','exitAt','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','error','cdr','[%s][members][cdr]','channel','split','data1','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','data3','destinationchannel','./utils','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','getUserByInterface','name','internal','request','CreateMemberReport','getUserByName','then','format','[%s][members][writeDB]','some','startsWith','debug','[%s][members][devicestatechange]','device'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x15b7,0x13a));var _0x715b=function(_0x4a5c9b,_0x38de78){_0x4a5c9b=_0x4a5c9b-0x0;var _0x285a08=_0x15b7[_0x4a5c9b];return _0x285a08;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x715b('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x715b('0x1')];function writeDB(_0x40b6e7){utils[_0x715b('0x2')](util['format'](_0x715b('0x3'),_0x40b6e7[_0x715b('0x4')],_0x40b6e7[_0x715b('0x5')],_0x40b6e7['channel'],_0x40b6e7['data2'],_0x40b6e7[_0x715b('0x6')],_0x40b6e7[_0x715b('0x7')]));if(_0x40b6e7[_0x715b('0x5')]){utils[_0x715b('0x8')](_0x40b6e7['interface'])['then'](function(_0x2546c0){if(_0x2546c0){_0x40b6e7['membername']=_0x2546c0[_0x715b('0x9')];_0x40b6e7[_0x715b('0xa')]=_0x2546c0['internal'];utils[_0x715b('0xb')](_0x715b('0xc'),_0x40b6e7);}else{utils[_0x715b('0xd')](_0x40b6e7[_0x715b('0x5')]['split']('/')[0x1])[_0x715b('0xe')](function(_0x177b5c){if(_0x177b5c){_0x40b6e7['membername']=_0x177b5c[_0x715b('0x9')];_0x40b6e7[_0x715b('0xa')]=_0x177b5c[_0x715b('0xa')];utils[_0x715b('0xb')](_0x715b('0xc'),_0x40b6e7);}});}})['catch'](function(_0x205bbe){utils['error'](util[_0x715b('0xf')](_0x715b('0x10'),_0x40b6e7['uniqueid']),_0x205bbe);});}delete members[_0x40b6e7[_0x715b('0x5')]];}function startsWith(_0x5004a6,_0x48e194){return _[_0x715b('0x11')](_0x5004a6,function(_0x31b79e){return _[_0x715b('0x12')](_0x48e194,_0x31b79e);});}exports['devicestatechange']=function(_0x13cc0b){try{utils[_0x715b('0x13')](util[_0x715b('0xf')](_0x715b('0x14'),members[_0x13cc0b[_0x715b('0x15')]]?members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x4')]:_0x13cc0b[_0x715b('0x15')]),_0x13cc0b);utils[_0x715b('0x2')](util[_0x715b('0xf')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x13cc0b['device']]?members[_0x13cc0b['device']]['uniqueid']:_0x13cc0b[_0x715b('0x15')],_0x13cc0b['state'],_0x13cc0b[_0x715b('0x15')]));switch(_0x13cc0b[_0x715b('0x16')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x13cc0b[_0x715b('0x15')])){members[_0x13cc0b[_0x715b('0x15')]]={'channel':_0x715b('0x17'),'interface':_0x13cc0b[_0x715b('0x15')],'type':'TALKING','enterAt':utils[_0x715b('0x18')](),'role':_0x715b('0x19')};}break;case'NOT_INUSE':if(!_[_0x715b('0x1a')](members[_0x13cc0b[_0x715b('0x15')]])){members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x1b')]=utils['now']();members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x1c')]=utils[_0x715b('0x1d')](members[_0x13cc0b['device']]['exitAt'],members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x1e')]);if(members[_0x13cc0b[_0x715b('0x15')]][_0x715b('0x4')]){writeDB(members[_0x13cc0b[_0x715b('0x15')]]);}}break;default:break;}}catch(_0x90eb0c){utils['error'](util[_0x715b('0xf')](_0x715b('0x14'),members[_0x13cc0b[_0x715b('0x15')]]?members[_0x13cc0b['device']][_0x715b('0x4')]:_0x13cc0b['device']),_0x90eb0c);}};exports[_0x715b('0x1f')]=function(_0x4b1ff7){try{if(!_[_0x715b('0x1a')](members[_0x4b1ff7[_0x715b('0x5')]])){utils[_0x715b('0x13')](util['format'](_0x715b('0x20'),_0x4b1ff7[_0x715b('0x4')]),_0x4b1ff7);utils[_0x715b('0x2')](util['format'](_0x715b('0x21'),_0x4b1ff7[_0x715b('0x4')],_0x4b1ff7[_0x715b('0x5')],_0x4b1ff7[_0x715b('0x22')]));members[_0x4b1ff7[_0x715b('0x5')]]=_[_0x715b('0x23')](members[_0x4b1ff7[_0x715b('0x5')]],{'data4':_0x4b1ff7[_0x715b('0x22')],'uniqueid':_0x4b1ff7[_0x715b('0x4')]});}}catch(_0x73de24){utils[_0x715b('0x24')](util[_0x715b('0xf')](_0x715b('0x20'),_0x4b1ff7['uniqueid']),_0x73de24);}};exports[_0x715b('0x25')]=function(_0x379e2e){try{utils[_0x715b('0x13')](util['format'](_0x715b('0x26'),_0x379e2e[_0x715b('0x4')]),_0x379e2e);if(_0x379e2e[_0x715b('0x27')]){var _0x42cf95=_0x379e2e[_0x715b('0x27')][_0x715b('0x28')]('-')[0x0];if(!_['isNil'](members[_0x42cf95])){members[_0x42cf95]=_[_0x715b('0x23')](members[_0x42cf95],{'data1':members[_0x42cf95][_0x715b('0x29')]||_0x379e2e[_0x715b('0x7')],'data2':members[_0x42cf95]['data2']||_0x379e2e[_0x715b('0x2a')],'data3':members[_0x42cf95]['data3']||_0x379e2e[_0x715b('0x2b')],'uniqueid':members[_0x42cf95][_0x715b('0x4')]||_0x379e2e[_0x715b('0x4')]});utils[_0x715b('0x2')](util[_0x715b('0xf')](_0x715b('0x2c'),_0x379e2e[_0x715b('0x4')],members[_0x42cf95][_0x715b('0x29')],members[_0x42cf95][_0x715b('0x2d')],members[_0x42cf95][_0x715b('0x2e')]));if(members[_0x42cf95][_0x715b('0x1b')]){writeDB(members[_0x42cf95]);}}}if(_0x379e2e[_0x715b('0x2f')]){var _0x2f31bd=_0x379e2e[_0x715b('0x2f')]['split']('-')[0x0];if(!_['isNil'](members[_0x2f31bd])){members[_0x2f31bd]=_[_0x715b('0x23')](members[_0x2f31bd],{'data1':members[_0x2f31bd][_0x715b('0x29')]||_0x379e2e['type'],'data2':members[_0x2f31bd]['data2']||_0x379e2e[_0x715b('0x2a')],'data3':members[_0x2f31bd][_0x715b('0x2e')]||_0x379e2e[_0x715b('0x2b')],'uniqueid':members[_0x2f31bd][_0x715b('0x4')]||_0x379e2e[_0x715b('0x4')]});utils[_0x715b('0x2')](util[_0x715b('0xf')](_0x715b('0x2c'),_0x379e2e['uniqueid'],members[_0x2f31bd][_0x715b('0x29')],members[_0x2f31bd][_0x715b('0x2d')],members[_0x2f31bd][_0x715b('0x2e')]));if(members[_0x2f31bd]['exitAt']){writeDB(members[_0x2f31bd]);}}}}catch(_0x11e6f9){utils[_0x715b('0x24')](util['format'](_0x715b('0x26'),_0x379e2e[_0x715b('0x4')]),_0x11e6f9);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a9add70..da55263 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 _0x570c=['blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','origtransfererlinkedid','secondtransfereruniqueid','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','mohtime','lodash','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','uniqueid','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s'];(function(_0x2b03e4,_0x2f1646){var _0xc19987=function(_0x41ac92){while(--_0x41ac92){_0x2b03e4['push'](_0x2b03e4['shift']());}};_0xc19987(++_0x2f1646);}(_0x570c,0xf9));var _0xc570=function(_0xf8daaa,_0x4ae2fb){_0xf8daaa=_0xf8daaa-0x0;var _0x389c5c=_0x570c[_0xf8daaa];return _0x389c5c;};'use strict';var _=require(_0xc570('0x0'));var util=require(_0xc570('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x100400){utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x4'),_0x100400['uniqueid'],_0x100400['channel'],_0x100400[_0xc570('0x5')],_0x100400[_0xc570('0x6')],_0x100400[_0xc570('0x7')],_0x100400[_0xc570('0x8')],_0x100400[_0xc570('0x9')]));if(_0x100400[_0xc570('0x5')]){utils[_0xc570('0xa')](_0x100400['queue'])[_0xc570('0xb')](function(_0x2474d2){if(_0x2474d2){_0x100400[_0xc570('0xc')]=_0x2474d2[_0xc570('0xc')];}utils[_0xc570('0xd')](_0xc570('0xe'),_0x100400);});}else{utils[_0xc570('0xd')]('CreateVoiceQueueReport',_0x100400);}if(_0x100400['transfereduniqueid']){delete queues[_0x100400[_0xc570('0xf')]];}else{delete queues[_0x100400[_0xc570('0x10')]];}}exports['queuecallerjoin']=function(_0x5d1ed9){try{utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x12'),_0x5d1ed9[_0xc570('0x10')]),_0x5d1ed9);utils[_0xc570('0x2')](util['format'](_0xc570('0x13'),_0x5d1ed9['uniqueid'],_0x5d1ed9[_0xc570('0x5')],_0x5d1ed9[_0xc570('0x14')]));queues[_0x5d1ed9['uniqueid']]=_[_0xc570('0x15')](_0x5d1ed9,{'originalposition':_0x5d1ed9[_0xc570('0x14')],'queuecallerjoinAt':utils[_0xc570('0x16')](),'mohtime':0x0});}catch(_0x29e081){utils[_0xc570('0x17')](util['format'](_0xc570('0x12'),_0x5d1ed9['uniqueid']),_0x29e081);}};exports[_0xc570('0x18')]=function(_0x4ffa01){try{if(!_['isNil'](queues[_0x4ffa01[_0xc570('0x10')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x19'),_0x4ffa01['uniqueid']),_0x4ffa01);if(queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1a')]){if(!queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1b')]&&!queues[_0x4ffa01['uniqueid']][_0xc570('0x1c')]){queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1d')]=!![];queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x1e')]=utils[_0xc570('0x16')]();queues[_0x4ffa01['uniqueid']]['queuecallerexitreason']=_0xc570('0x1f');}utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x20'),_0x4ffa01[_0xc570('0x10')],queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x21')],queues[_0x4ffa01['uniqueid']]['queuecallerexitreason']));writeDB(queues[_0x4ffa01[_0xc570('0x10')]]);}else if(queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0xf')]){utils['info'](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x4ffa01[_0xc570('0x10')],queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0x21')],queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0xf')]));queues[queues[_0x4ffa01['uniqueid']]['transfereduniqueid']]=queues[_0x4ffa01[_0xc570('0x10')]];queues[queues[_0x4ffa01[_0xc570('0x10')]][_0xc570('0xf')]][_0xc570('0x22')]=0x2;delete queues[_0x4ffa01[_0xc570('0x10')]];}}}catch(_0x449361){utils[_0xc570('0x17')](util[_0xc570('0x3')]('[%s][queues][hangup]',_0x4ffa01[_0xc570('0x10')]),_0x449361);}};exports[_0xc570('0x23')]=function(_0x4bc7db){try{utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x24'),_0x4bc7db['uniqueid']),_0x4bc7db);if(!_[_0xc570('0x25')](_0x4bc7db['variable']['queuestatus'])&&_0x4bc7db[_0xc570('0x26')]['toUpperCase']()!==_0xc570('0x27')){if(!_[_0xc570('0x25')](queues[_0x4bc7db[_0xc570('0x10')]])){queues[_0x4bc7db['uniqueid']][_0xc570('0x1b')]=![];queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x28')]=null;queues[_0x4bc7db['uniqueid']][_0xc570('0x1c')]=!![];queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x29')]=utils[_0xc570('0x16')]();queues[_0x4bc7db[_0xc570('0x10')]]['queuecallerexitreason']=_0x4bc7db[_0xc570('0x26')][_0xc570('0x2a')]();utils['info'](util[_0xc570('0x3')](_0xc570('0x2b'),_0x4bc7db[_0xc570('0x10')],queues[_0x4bc7db['uniqueid']][_0xc570('0x21')],_0x4bc7db[_0xc570('0x26')],queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x9')]));writeDB(queues[_0x4bc7db['uniqueid']]);}}else if(!_[_0xc570('0x25')](_0x4bc7db[_0xc570('0x2c')][_0xc570('0x2d')])){if(!_[_0xc570('0x25')](queues[_0x4bc7db[_0xc570('0x10')]])&&!queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x1b')]){queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x1b')]=![];queues[_0x4bc7db[_0xc570('0x10')]]['queuecallerabandonAt']=null;queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x1c')]=!![];queues[_0x4bc7db[_0xc570('0x10')]]['queuecallerexitAt']=utils[_0xc570('0x16')]();queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x9')]='EXITWITHKEY';utils['info'](util[_0xc570('0x3')](_0xc570('0x2e'),_0x4bc7db[_0xc570('0x10')],queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x21')],_0x4bc7db[_0xc570('0x26')],queues[_0x4bc7db[_0xc570('0x10')]][_0xc570('0x9')]));}}}catch(_0x1fa6da){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x24'),_0x4bc7db[_0xc570('0x10')]),_0x1fa6da);}};exports[_0xc570('0x1b')]=function(_0x5338cc){try{if(!_[_0xc570('0x25')](queues[_0x5338cc[_0xc570('0x10')]])){utils[_0xc570('0x11')](util['format'](_0xc570('0x2f'),_0x5338cc[_0xc570('0x10')]),_0x5338cc);queues[_0x5338cc[_0xc570('0x10')]]['queuecallerexit']=![];queues[_0x5338cc[_0xc570('0x10')]]['queuecallerexitAt']=null;queues[_0x5338cc[_0xc570('0x10')]]['queuecallerabandon']=!![];queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x28')]=utils['now']();queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x9')]=_0xc570('0x30');utils['info'](util['format'](_0xc570('0x31'),_0x5338cc['uniqueid'],queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x21')],queues[_0x5338cc[_0xc570('0x10')]][_0xc570('0x9')]));}}catch(_0x3286ac){utils[_0xc570('0x17')](util['format']('[%s][queues][queuecallerabandon]',_0x5338cc[_0xc570('0x10')]),_0x3286ac);}};exports[_0xc570('0x32')]=function(_0x1fef7f){try{if(!_[_0xc570('0x25')](queues[_0x1fef7f[_0xc570('0x10')]])){utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x33'),_0x1fef7f[_0xc570('0x10')]),_0x1fef7f);utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x34'),_0x1fef7f[_0xc570('0x10')],queues[_0x1fef7f[_0xc570('0x10')]]['name'],_0x1fef7f[_0xc570('0x35')],_0x1fef7f[_0xc570('0x36')]));queues[_0x1fef7f['uniqueid']]['queuecallerleave']=!![];queues[_0x1fef7f['uniqueid']]['queuecallerleaveAt']=utils[_0xc570('0x16')]();queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x37')]=utils[_0xc570('0x38')](queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x1a')],queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x39')]);queues[_0x1fef7f[_0xc570('0x10')]]['position']=_0x1fef7f[_0xc570('0x14')];queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x3a')]=_0x1fef7f[_0xc570('0x3a')];queues[_0x1fef7f[_0xc570('0x10')]]['connectedlinenum']=_0x1fef7f['connectedlinenum'];queues[_0x1fef7f[_0xc570('0x10')]][_0xc570('0x36')]=_0x1fef7f[_0xc570('0x36')];}}catch(_0x30e89e){utils['error'](util['format'](_0xc570('0x33'),_0x1fef7f[_0xc570('0x10')]),_0x30e89e);}};exports[_0xc570('0x3b')]=function(_0x5c4252){try{if(!_[_0xc570('0x25')](queues[_0x5c4252[_0xc570('0x10')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x3c'),_0x5c4252['uniqueid']),_0x5c4252);utils['info'](util[_0xc570('0x3')](_0xc570('0x3d'),_0x5c4252['uniqueid'],queues[_0x5c4252['uniqueid']][_0xc570('0x21')],_0x5c4252[_0xc570('0x3e')],_0x5c4252[_0xc570('0x3f')]));queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x1b')]=![];queues[_0x5c4252[_0xc570('0x10')]]['queuecallerabandon']=![];queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x28')]=null;queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x1c')]=![];queues[_0x5c4252['uniqueid']][_0xc570('0x9')]=null;queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x29')]=null;queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x40')]=!![];queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x8')]=_0x5c4252['destaccountcode'];queues[_0x5c4252[_0xc570('0x10')]][_0xc570('0x6')]=_0x5c4252[_0xc570('0x3e')];}}catch(_0x334976){utils[_0xc570('0x17')](util['format']('[%s][queues][agentconnect]',_0x5c4252[_0xc570('0x10')]),_0x334976);}};exports[_0xc570('0x41')]=function(_0x12cc43){try{if(!_[_0xc570('0x25')](queues[_0x12cc43[_0xc570('0x10')]])){if(queues[_0x12cc43['uniqueid']][_0xc570('0x1a')]){utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x42'),_0x12cc43[_0xc570('0x10')]),_0x12cc43);queues[_0x12cc43['uniqueid']][_0xc570('0x1b')]=![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1b')]=![];queues[_0x12cc43['uniqueid']]['queuecallerabandonAt']=null;queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1c')]=![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x29')]=null;queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x40')]=!![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x6')]=_0x12cc43['membername'];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1d')]=!![];queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x1e')]=utils['now']();if(_0x12cc43[_0xc570('0x43')]==_0xc570('0x44')){if(!queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x44')]){queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x9')]=_0xc570('0x45');}}else{queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x9')]=_0xc570('0x46')+_0x12cc43['reason'][_0xc570('0x2a')]();}utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x47'),_0x12cc43[_0xc570('0x10')],queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x21')],_0x12cc43['membername'],queues[_0x12cc43[_0xc570('0x10')]][_0xc570('0x9')]));writeDB(queues[_0x12cc43['uniqueid']]);}}}catch(_0x336366){utils[_0xc570('0x17')](util['format'](_0xc570('0x42'),_0x12cc43[_0xc570('0x10')]),_0x336366);}};exports[_0xc570('0x48')]=function(_0x15c410){try{if(!_[_0xc570('0x25')](queues[_0x15c410[_0xc570('0x49')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x4a'),_0x15c410[_0xc570('0x10')]),_0x15c410);queues[_0x15c410['transfereeuniqueid']][_0xc570('0x44')]=!![];queues[_0x15c410[_0xc570('0x49')]][_0xc570('0x4b')]=_0xc570('0x4c');queues[_0x15c410[_0xc570('0x49')]][_0xc570('0x4d')]=_0x15c410[_0xc570('0x4e')];queues[_0x15c410['transfereeuniqueid']]['transferuniqueid']=_0x15c410[_0xc570('0x49')];queues[_0x15c410[_0xc570('0x49')]]['queuecallerexitreason']=_0xc570('0x4f');utils[_0xc570('0x2')](util['format'](_0xc570('0x50'),_0x15c410['uniqueid'],queues[_0x15c410[_0xc570('0x49')]][_0xc570('0x21')],_0x15c410[_0xc570('0x49')],_0x15c410[_0xc570('0x4e')]));}}catch(_0x9afafb){utils['error'](util[_0xc570('0x3')](_0xc570('0x4a'),_0x15c410[_0xc570('0x10')]),_0x9afafb);}};exports[_0xc570('0x51')]=function(_0xbafd2f){try{utils[_0xc570('0x11')](util['format'](_0xc570('0x52'),_0xbafd2f[_0xc570('0x53')]),_0xbafd2f);if(_0xbafd2f['origtransfereruniqueid']==_0xbafd2f['origtransfererlinkedid']){if(!_['isNil'](queues[_0xbafd2f[_0xc570('0x54')]])){utils['info'](util['format'](_0xc570('0x55'),_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0x21')],_0xbafd2f[_0xc570('0x56')]));queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x44')]=!![];queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0x4b')]=_0xc570('0x57');queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0x4d')]=_0xbafd2f[_0xc570('0x56')];queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x58')]=_0xbafd2f['origtransfereruniqueid'];queues[_0xbafd2f[_0xc570('0x54')]]['queuecallerexitreason']=_0xc570('0x59');}if(!_[_0xc570('0x25')](queues[_0xbafd2f['origtransfererlinkedid']])){if(_0xbafd2f['transfereelinkedid']&&queues[_0xbafd2f[_0xc570('0x5a')]]){queues[_0xbafd2f['transfereelinkedid']][_0xc570('0x22')]=0x1;queues[_0xbafd2f[_0xc570('0x49')]]=_[_0xc570('0x5b')](queues[_0xbafd2f[_0xc570('0x5a')]]);queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0xf')]=_0xbafd2f[_0xc570('0x5c')];queues[_0xbafd2f[_0xc570('0x49')]]['queuecallerenterreason']=0x2;queues[_0xbafd2f[_0xc570('0x49')]]['calleridnum']=queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x7')];queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x5d')]=queues[_0xbafd2f['secondtransfererlinkedid']]['calleridname'];queues[_0xbafd2f['transfereeuniqueid']]['queuecallerjoinAt']=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x1a')]=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x37')]=0x0;queues[_0xbafd2f['transfereeuniqueid']]['mohtime']=0x0;utils[_0xc570('0x2')](util['format'](_0xc570('0x5e'),_0xbafd2f['origtransfereruniqueid'],queues[_0xbafd2f[_0xc570('0x49')]][_0xc570('0x21')],queues[_0xbafd2f['transfereeuniqueid']][_0xc570('0x7')],queues[_0xbafd2f['transfereeuniqueid']][_0xc570('0x5d')]));}else{utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x5f'),_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f['origtransfererlinkedid']][_0xc570('0x21')],_0xbafd2f[_0xc570('0x54')]));queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0xf')]=_0xbafd2f[_0xc570('0x54')];}}}else if(_0xbafd2f[_0xc570('0x61')]==_0xbafd2f[_0xc570('0x54')]){if(!_[_0xc570('0x25')](queues[_0xbafd2f[_0xc570('0x60')]])){utils['info'](util[_0xc570('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x21')],_0xbafd2f['secondtransfereruniqueid'],_0xbafd2f['secondtransfererexten']));queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x44')]=!![];queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x4b')]=_0xc570('0x57');queues[_0xbafd2f['origtransfererlinkedid']][_0xc570('0x4d')]=_0xbafd2f['secondtransfererexten'];queues[_0xbafd2f[_0xc570('0x60')]][_0xc570('0x58')]=_0xbafd2f['secondtransfereruniqueid'];queues[_0xbafd2f['origtransfererlinkedid']][_0xc570('0x9')]=_0xc570('0x59');}if(!_[_0xc570('0x25')](queues[_0xbafd2f[_0xc570('0x54')]])){if(_0xbafd2f['transfertargetlinkedid']&&queues[_0xbafd2f['transfertargetlinkedid']]){queues[_0xbafd2f[_0xc570('0x62')]][_0xc570('0x22')]=0x1;queues[_0xbafd2f[_0xc570('0x5c')]]=_[_0xc570('0x5b')](queues[_0xbafd2f['transfertargetlinkedid']]);queues[_0xbafd2f['transfertargetuniqueid']][_0xc570('0xf')]=_0xbafd2f['transfertargetuniqueid'];queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x22')]=0x2;queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x7')]=queues[_0xbafd2f[_0xc570('0x60')]]['calleridnum'];queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x5d')]=queues[_0xbafd2f[_0xc570('0x60')]]['calleridname'];queues[_0xbafd2f[_0xc570('0x5c')]]['queuecallerjoinAt']=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x1a')]=utils[_0xc570('0x16')]();queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x37')]=0x0;queues[_0xbafd2f[_0xc570('0x5c')]]['mohtime']=0x0;utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x63'),_0xbafd2f['origtransfereruniqueid'],queues[_0xbafd2f['transfertargetuniqueid']]['name'],queues[_0xbafd2f['transfertargetuniqueid']][_0xc570('0xf')],queues[_0xbafd2f[_0xc570('0x5c')]][_0xc570('0x7')],queues[_0xbafd2f[_0xc570('0x5c')]]['calleridname']));}else{utils[_0xc570('0x2')](util[_0xc570('0x3')](_0xc570('0x5f'),_0xbafd2f[_0xc570('0x53')],queues[_0xbafd2f['secondtransfererlinkedid']][_0xc570('0x21')],_0xbafd2f[_0xc570('0x60')]));queues[_0xbafd2f[_0xc570('0x54')]][_0xc570('0xf')]=_0xbafd2f['origtransfererlinkedid'];}}}}catch(_0x45b0ff){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x52'),_0xbafd2f[_0xc570('0x53')]),_0x45b0ff);}};exports['musiconholdstart']=function(_0xf9bc1c){try{if(!_[_0xc570('0x25')](queues[_0xf9bc1c[_0xc570('0x10')]])){utils['debug'](util[_0xc570('0x3')](_0xc570('0x64'),_0xf9bc1c[_0xc570('0x10')]),_0xf9bc1c);queues[_0xf9bc1c[_0xc570('0x10')]][_0xc570('0x65')]=utils[_0xc570('0x16')]();utils['info'](util[_0xc570('0x3')](_0xc570('0x66'),_0xf9bc1c['uniqueid'],queues[_0xf9bc1c[_0xc570('0x10')]][_0xc570('0x21')],queues[_0xf9bc1c[_0xc570('0x10')]][_0xc570('0x65')]));}}catch(_0x442efd){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x64'),_0xf9bc1c[_0xc570('0x10')]),_0x442efd);}};exports[_0xc570('0x67')]=function(_0xd1b918){try{if(!_['isNil'](queues[_0xd1b918['uniqueid']])){if(!_[_0xc570('0x25')](queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x65')])){utils[_0xc570('0x11')](util[_0xc570('0x3')](_0xc570('0x68'),_0xd1b918[_0xc570('0x10')]),_0xd1b918);queues[_0xd1b918[_0xc570('0x10')]]['mohtime']+=utils['diffTime'](utils[_0xc570('0x16')](),queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x65')]);utils['info'](util[_0xc570('0x3')](_0xc570('0x69'),_0xd1b918[_0xc570('0x10')],queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x21')],queues[_0xd1b918['uniqueid']][_0xc570('0x6a')]));delete queues[_0xd1b918[_0xc570('0x10')]][_0xc570('0x65')];}}}catch(_0x55302b){utils[_0xc570('0x17')](util[_0xc570('0x3')](_0xc570('0x68'),_0xd1b918[_0xc570('0x10')]),_0x55302b);}}; \ No newline at end of file +var _0xca89=['queuecallerexitreason','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','isNil','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','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','queuecallerjoinAt','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','[%s][queues][agentconnect]','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','[%s][queues][blindtransfer]','attendedtransfer','[%s][queues][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','holdtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererexten','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','accountcode'];(function(_0x1dd156,_0x25d0c9){var _0xac911f=function(_0x1e2b8e){while(--_0x1e2b8e){_0x1dd156['push'](_0x1dd156['shift']());}};_0xac911f(++_0x25d0c9);}(_0xca89,0x193));var _0x9ca8=function(_0x8a7179,_0x511713){_0x8a7179=_0x8a7179-0x0;var _0x2a81ce=_0xca89[_0x8a7179];return _0x2a81ce;};'use strict';var _=require('lodash');var util=require(_0x9ca8('0x0'));var utils=require(_0x9ca8('0x1'));var queues={};function writeDB(_0x2facaa){utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x2facaa[_0x9ca8('0x4')],_0x2facaa[_0x9ca8('0x5')],_0x2facaa[_0x9ca8('0x6')],_0x2facaa[_0x9ca8('0x7')],_0x2facaa['calleridnum'],_0x2facaa[_0x9ca8('0x8')],_0x2facaa[_0x9ca8('0x9')]));if(_0x2facaa['queue']){utils[_0x9ca8('0xa')](_0x2facaa[_0x9ca8('0x6')])['then'](function(_0x3f140c){if(_0x3f140c){_0x2facaa[_0x9ca8('0xb')]=_0x3f140c[_0x9ca8('0xb')];}utils[_0x9ca8('0xc')](_0x9ca8('0xd'),_0x2facaa);});}else{utils[_0x9ca8('0xc')]('CreateVoiceQueueReport',_0x2facaa);}if(_0x2facaa[_0x9ca8('0xe')]){delete queues[_0x2facaa[_0x9ca8('0xe')]];}else{delete queues[_0x2facaa['uniqueid']];}}exports[_0x9ca8('0xf')]=function(_0x1b1e2d){try{utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x11'),_0x1b1e2d[_0x9ca8('0x4')]),_0x1b1e2d);utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x12'),_0x1b1e2d[_0x9ca8('0x4')],_0x1b1e2d[_0x9ca8('0x6')],_0x1b1e2d[_0x9ca8('0x13')]));queues[_0x1b1e2d[_0x9ca8('0x4')]]=_[_0x9ca8('0x14')](_0x1b1e2d,{'originalposition':_0x1b1e2d[_0x9ca8('0x13')],'queuecallerjoinAt':utils[_0x9ca8('0x15')](),'mohtime':0x0});}catch(_0x379e54){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')](_0x9ca8('0x11'),_0x1b1e2d[_0x9ca8('0x4')]),_0x379e54);}};exports['hangup']=function(_0x23f085){try{if(!_['isNil'](queues[_0x23f085[_0x9ca8('0x4')]])){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x17'),_0x23f085[_0x9ca8('0x4')]),_0x23f085);if(queues[_0x23f085[_0x9ca8('0x4')]]['queuecallerleaveAt']){if(!queues[_0x23f085['uniqueid']][_0x9ca8('0x18')]&&!queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x19')]){queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x1a')]=!![];queues[_0x23f085['uniqueid']]['queuecallercompleteAt']=utils[_0x9ca8('0x15')]();queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x9')]=_0x9ca8('0x1b');}utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x1c'),_0x23f085[_0x9ca8('0x4')],queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x9')]));writeDB(queues[_0x23f085[_0x9ca8('0x4')]]);}else if(queues[_0x23f085['uniqueid']][_0x9ca8('0xe')]){utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x23f085['uniqueid'],queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x23f085['uniqueid']][_0x9ca8('0xe')]));queues[queues[_0x23f085[_0x9ca8('0x4')]][_0x9ca8('0xe')]]=queues[_0x23f085[_0x9ca8('0x4')]];queues[queues[_0x23f085['uniqueid']]['transfereduniqueid']][_0x9ca8('0x1e')]=0x2;delete queues[_0x23f085[_0x9ca8('0x4')]];}}}catch(_0x2a71d8){utils['error'](util[_0x9ca8('0x3')](_0x9ca8('0x17'),_0x23f085['uniqueid']),_0x2a71d8);}};exports[_0x9ca8('0x1f')]=function(_0xf5c8d6){try{utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x20'),_0xf5c8d6['uniqueid']),_0xf5c8d6);if(!_[_0x9ca8('0x21')](_0xf5c8d6[_0x9ca8('0x22')][_0x9ca8('0x23')])&&_0xf5c8d6[_0x9ca8('0x24')][_0x9ca8('0x25')]()!==_0x9ca8('0x26')){if(!_[_0x9ca8('0x21')](queues[_0xf5c8d6[_0x9ca8('0x4')]])){queues[_0xf5c8d6[_0x9ca8('0x4')]]['queuecallerabandon']=![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x27')]=null;queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x19')]=!![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x28')]=utils['now']();queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x9')]=_0xf5c8d6[_0x9ca8('0x24')]['toUpperCase']();utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x29'),_0xf5c8d6[_0x9ca8('0x4')],queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x1d')],_0xf5c8d6['value'],queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x9')]));writeDB(queues[_0xf5c8d6[_0x9ca8('0x4')]]);}}else if(!_[_0x9ca8('0x21')](_0xf5c8d6[_0x9ca8('0x22')][_0x9ca8('0x2a')])){if(!_[_0x9ca8('0x21')](queues[_0xf5c8d6[_0x9ca8('0x4')]])&&!queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x18')]){queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x18')]=![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x27')]=null;queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x19')]=!![];queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x28')]=utils[_0x9ca8('0x15')]();queues[_0xf5c8d6[_0x9ca8('0x4')]]['queuecallerexitreason']=_0x9ca8('0x2b');utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x2c'),_0xf5c8d6[_0x9ca8('0x4')],queues[_0xf5c8d6[_0x9ca8('0x4')]]['name'],_0xf5c8d6[_0x9ca8('0x24')],queues[_0xf5c8d6[_0x9ca8('0x4')]][_0x9ca8('0x9')]));}}}catch(_0x3e3f24){utils['error'](util['format'](_0x9ca8('0x20'),_0xf5c8d6[_0x9ca8('0x4')]),_0x3e3f24);}};exports[_0x9ca8('0x18')]=function(_0x1d46d3){try{if(!_[_0x9ca8('0x21')](queues[_0x1d46d3[_0x9ca8('0x4')]])){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x2d'),_0x1d46d3[_0x9ca8('0x4')]),_0x1d46d3);queues[_0x1d46d3[_0x9ca8('0x4')]][_0x9ca8('0x19')]=![];queues[_0x1d46d3[_0x9ca8('0x4')]]['queuecallerexitAt']=null;queues[_0x1d46d3['uniqueid']][_0x9ca8('0x18')]=!![];queues[_0x1d46d3['uniqueid']][_0x9ca8('0x27')]=utils[_0x9ca8('0x15')]();queues[_0x1d46d3['uniqueid']][_0x9ca8('0x9')]=_0x9ca8('0x2e');utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x2f'),_0x1d46d3['uniqueid'],queues[_0x1d46d3[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x1d46d3['uniqueid']][_0x9ca8('0x9')]));}}catch(_0x1fe773){utils['error'](util[_0x9ca8('0x3')](_0x9ca8('0x2d'),_0x1d46d3[_0x9ca8('0x4')]),_0x1fe773);}};exports[_0x9ca8('0x30')]=function(_0x260752){try{if(!_[_0x9ca8('0x21')](queues[_0x260752['uniqueid']])){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x31'),_0x260752[_0x9ca8('0x4')]),_0x260752);utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x32'),_0x260752[_0x9ca8('0x4')],queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x1d')],_0x260752[_0x9ca8('0x33')],_0x260752[_0x9ca8('0x34')]));queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x30')]=!![];queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x35')]=utils['now']();queues[_0x260752[_0x9ca8('0x4')]]['holdtime']=utils['diffTime'](queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x35')],queues[_0x260752['uniqueid']][_0x9ca8('0x36')]);queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x13')]=_0x260752['position'];queues[_0x260752['uniqueid']]['count']=_0x260752['count'];queues[_0x260752['uniqueid']][_0x9ca8('0x33')]=_0x260752[_0x9ca8('0x33')];queues[_0x260752[_0x9ca8('0x4')]][_0x9ca8('0x34')]=_0x260752[_0x9ca8('0x34')];}}catch(_0x31b347){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')](_0x9ca8('0x31'),_0x260752['uniqueid']),_0x31b347);}};exports[_0x9ca8('0x37')]=function(_0x129794){try{if(!_[_0x9ca8('0x21')](queues[_0x129794['uniqueid']])){utils[_0x9ca8('0x10')](util['format']('[%s][queues][agentconnect]',_0x129794[_0x9ca8('0x4')]),_0x129794);utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x38'),_0x129794[_0x9ca8('0x4')],queues[_0x129794['uniqueid']][_0x9ca8('0x1d')],_0x129794[_0x9ca8('0x39')],_0x129794[_0x9ca8('0x3a')]));queues[_0x129794[_0x9ca8('0x4')]]['queuecallerabandon']=![];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x18')]=![];queues[_0x129794['uniqueid']][_0x9ca8('0x27')]=null;queues[_0x129794[_0x9ca8('0x4')]]['queuecallerexit']=![];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x9')]=null;queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x28')]=null;queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x3b')]=!![];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x8')]=_0x129794[_0x9ca8('0x3a')];queues[_0x129794[_0x9ca8('0x4')]][_0x9ca8('0x7')]=_0x129794['membername'];}}catch(_0x282294){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')](_0x9ca8('0x3c'),_0x129794[_0x9ca8('0x4')]),_0x282294);}};exports['agentcomplete']=function(_0x4682ae){try{if(!_[_0x9ca8('0x21')](queues[_0x4682ae[_0x9ca8('0x4')]])){if(queues[_0x4682ae[_0x9ca8('0x4')]]['queuecallerleaveAt']){utils[_0x9ca8('0x10')](util[_0x9ca8('0x3')](_0x9ca8('0x3d'),_0x4682ae[_0x9ca8('0x4')]),_0x4682ae);queues[_0x4682ae['uniqueid']][_0x9ca8('0x18')]=![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x18')]=![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x27')]=null;queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x19')]=![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x28')]=null;queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x3b')]=!![];queues[_0x4682ae['uniqueid']][_0x9ca8('0x7')]=_0x4682ae['membername'];queues[_0x4682ae[_0x9ca8('0x4')]]['queuecallercomplete']=!![];queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x3e')]=utils[_0x9ca8('0x15')]();if(_0x4682ae[_0x9ca8('0x3f')]==_0x9ca8('0x40')){if(!queues[_0x4682ae[_0x9ca8('0x4')]]['transfer']){queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x9')]=_0x9ca8('0x41');}}else{queues[_0x4682ae['uniqueid']]['queuecallerexitreason']=_0x9ca8('0x42')+_0x4682ae[_0x9ca8('0x3f')][_0x9ca8('0x25')]();}utils[_0x9ca8('0x2')](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x4682ae['uniqueid'],queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x1d')],_0x4682ae[_0x9ca8('0x39')],queues[_0x4682ae[_0x9ca8('0x4')]][_0x9ca8('0x9')]));writeDB(queues[_0x4682ae[_0x9ca8('0x4')]]);}}}catch(_0x46e7fc){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')]('[%s][queues][agentcomplete]',_0x4682ae['uniqueid']),_0x46e7fc);}};exports[_0x9ca8('0x43')]=function(_0x66fa17){try{if(!_[_0x9ca8('0x21')](queues[_0x66fa17[_0x9ca8('0x44')]])){utils['debug'](util[_0x9ca8('0x3')]('[%s][queues][blindtransfer]',_0x66fa17[_0x9ca8('0x4')]),_0x66fa17);queues[_0x66fa17[_0x9ca8('0x44')]]['transfer']=!![];queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x45')]=_0x9ca8('0x46');queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x47')]=_0x66fa17['extension'];queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x48')]=_0x66fa17['transfereeuniqueid'];queues[_0x66fa17['transfereeuniqueid']]['queuecallerexitreason']='BLINDTRANSFER';utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x49'),_0x66fa17[_0x9ca8('0x4')],queues[_0x66fa17[_0x9ca8('0x44')]][_0x9ca8('0x1d')],_0x66fa17[_0x9ca8('0x44')],_0x66fa17['extension']));}}catch(_0x48a1c3){utils['error'](util['format'](_0x9ca8('0x4a'),_0x66fa17['uniqueid']),_0x48a1c3);}};exports[_0x9ca8('0x4b')]=function(_0x559313){try{utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x4c'),_0x559313[_0x9ca8('0x4d')]),_0x559313);if(_0x559313['origtransfereruniqueid']==_0x559313[_0x9ca8('0x4e')]){if(!_['isNil'](queues[_0x559313['secondtransfererlinkedid']])){utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x50')]));queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x40')]=!![];queues[_0x559313[_0x9ca8('0x4f')]]['transfertype']=_0x9ca8('0x51');queues[_0x559313['secondtransfererlinkedid']][_0x9ca8('0x47')]=_0x559313['origtransfererexten'];queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x48')]=_0x559313['origtransfereruniqueid'];queues[_0x559313['secondtransfererlinkedid']][_0x9ca8('0x9')]=_0x9ca8('0x52');}if(!_[_0x9ca8('0x21')](queues[_0x559313[_0x9ca8('0x4e')]])){if(_0x559313['transfereelinkedid']&&queues[_0x559313[_0x9ca8('0x53')]]){queues[_0x559313['transfereelinkedid']][_0x9ca8('0x1e')]=0x1;queues[_0x559313[_0x9ca8('0x44')]]=_['clone'](queues[_0x559313[_0x9ca8('0x53')]]);queues[_0x559313['transfereeuniqueid']][_0x9ca8('0xe')]=_0x559313[_0x9ca8('0x54')];queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x1e')]=0x2;queues[_0x559313[_0x9ca8('0x44')]]['calleridnum']=queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x55')];queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x56')]=queues[_0x559313[_0x9ca8('0x4f')]]['calleridname'];queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x36')]=utils[_0x9ca8('0x15')]();queues[_0x559313['transfereeuniqueid']][_0x9ca8('0x35')]=utils['now']();queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x57')]=0x0;queues[_0x559313[_0x9ca8('0x44')]]['mohtime']=0x0;utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x58'),_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x1d')],queues[_0x559313[_0x9ca8('0x44')]][_0x9ca8('0x55')],queues[_0x559313[_0x9ca8('0x44')]]['calleridname']));}else{utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x59'),_0x559313['origtransfereruniqueid'],queues[_0x559313['origtransfererlinkedid']][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x4f')]));queues[_0x559313['origtransfererlinkedid']]['transfereduniqueid']=_0x559313[_0x9ca8('0x4f')];}}}else if(_0x559313[_0x9ca8('0x5a')]==_0x559313[_0x9ca8('0x4f')]){if(!_[_0x9ca8('0x21')](queues[_0x559313['origtransfererlinkedid']])){utils['info'](util[_0x9ca8('0x3')](_0x9ca8('0x5b'),_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x5a')],_0x559313[_0x9ca8('0x5c')]));queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x40')]=!![];queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x45')]=_0x9ca8('0x51');queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x47')]=_0x559313['secondtransfererexten'];queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x48')]=_0x559313[_0x9ca8('0x5a')];queues[_0x559313[_0x9ca8('0x4e')]]['queuecallerexitreason']=_0x9ca8('0x52');}if(!_[_0x9ca8('0x21')](queues[_0x559313[_0x9ca8('0x4f')]])){if(_0x559313[_0x9ca8('0x5d')]&&queues[_0x559313[_0x9ca8('0x5d')]]){queues[_0x559313[_0x9ca8('0x5d')]][_0x9ca8('0x1e')]=0x1;queues[_0x559313[_0x9ca8('0x54')]]=_['clone'](queues[_0x559313[_0x9ca8('0x5d')]]);queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0xe')]=_0x559313['transfertargetuniqueid'];queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x1e')]=0x2;queues[_0x559313['transfertargetuniqueid']][_0x9ca8('0x55')]=queues[_0x559313['origtransfererlinkedid']][_0x9ca8('0x55')];queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x56')]=queues[_0x559313[_0x9ca8('0x4e')]][_0x9ca8('0x56')];queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x36')]=utils['now']();queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x35')]=utils['now']();queues[_0x559313['transfertargetuniqueid']][_0x9ca8('0x57')]=0x0;queues[_0x559313['transfertargetuniqueid']][_0x9ca8('0x5e')]=0x0;utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x559313[_0x9ca8('0x4d')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x1d')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0xe')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x55')],queues[_0x559313[_0x9ca8('0x54')]][_0x9ca8('0x56')]));}else{utils[_0x9ca8('0x2')](util['format'](_0x9ca8('0x59'),_0x559313['origtransfereruniqueid'],queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0x1d')],_0x559313[_0x9ca8('0x4e')]));queues[_0x559313[_0x9ca8('0x4f')]][_0x9ca8('0xe')]=_0x559313[_0x9ca8('0x4e')];}}}}catch(_0x51e945){utils[_0x9ca8('0x16')](util['format'](_0x9ca8('0x4c'),_0x559313[_0x9ca8('0x4d')]),_0x51e945);}};exports[_0x9ca8('0x5f')]=function(_0x2bc4eb){try{if(!_['isNil'](queues[_0x2bc4eb['uniqueid']])){utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x60'),_0x2bc4eb['uniqueid']),_0x2bc4eb);queues[_0x2bc4eb[_0x9ca8('0x4')]][_0x9ca8('0x61')]=utils[_0x9ca8('0x15')]();utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x62'),_0x2bc4eb[_0x9ca8('0x4')],queues[_0x2bc4eb[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x2bc4eb[_0x9ca8('0x4')]]['musiconholdstartAt']));}}catch(_0x5c1cda){utils[_0x9ca8('0x16')](util['format'](_0x9ca8('0x60'),_0x2bc4eb[_0x9ca8('0x4')]),_0x5c1cda);}};exports[_0x9ca8('0x63')]=function(_0x3dfdfa){try{if(!_['isNil'](queues[_0x3dfdfa[_0x9ca8('0x4')]])){if(!_[_0x9ca8('0x21')](queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x61')])){utils[_0x9ca8('0x10')](util['format'](_0x9ca8('0x64'),_0x3dfdfa[_0x9ca8('0x4')]),_0x3dfdfa);queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x5e')]+=utils[_0x9ca8('0x65')](utils[_0x9ca8('0x15')](),queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x61')]);utils[_0x9ca8('0x2')](util[_0x9ca8('0x3')](_0x9ca8('0x66'),_0x3dfdfa[_0x9ca8('0x4')],queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x1d')],queues[_0x3dfdfa['uniqueid']][_0x9ca8('0x5e')]));delete queues[_0x3dfdfa[_0x9ca8('0x4')]][_0x9ca8('0x61')];}}}catch(_0x3122e3){utils[_0x9ca8('0x16')](util[_0x9ca8('0x3')]('[%s][queues][musiconholdstop]',_0x3dfdfa[_0x9ca8('0x4')]),_0x3122e3);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index f2c6aa1..a718981 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 _0x5e95=['[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','cdr','lastIndexOf','[%s][recordings][newexten]','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','membername','name','UserId','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','context','exten','channel','error','newstate','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x5e95,0x19a));var _0x55e9=function(_0x4c7c09,_0x22ece7){_0x4c7c09=_0x4c7c09-0x0;var _0x354454=_0x5e95[_0x4c7c09];return _0x354454;};'use strict';var _=require(_0x55e9('0x0'));var util=require(_0x55e9('0x1'));var utils=require(_0x55e9('0x2'));var recordings={};function writeDB(_0x3be46a){utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x5'),_0x3be46a['uniqueid']));if(_0x3be46a[_0x55e9('0x6')]){utils[_0x55e9('0x7')](_0x3be46a[_0x55e9('0x6')])['then'](function(_0x37e78f){if(_0x37e78f){_0x3be46a[_0x55e9('0x8')]=_0x37e78f[_0x55e9('0x9')];_0x3be46a[_0x55e9('0xa')]=_0x37e78f['id'];}utils['request'](_0x55e9('0xb'),_0x3be46a);});}else{utils['request'](_0x55e9('0xb'),_0x3be46a);}}exports[_0x55e9('0xc')]=function(_0x470fc7){try{utils[_0x55e9('0xd')](util[_0x55e9('0x4')](_0x55e9('0xe'),_0x470fc7[_0x55e9('0xf')]),_0x470fc7);if(_0x470fc7[_0x55e9('0xf')]==_0x470fc7['linkedid']){utils['info'](util[_0x55e9('0x4')]('[%s][recordings][newchannel]\x20context:%s\x20exten:%s',_0x470fc7[_0x55e9('0xf')],_0x470fc7[_0x55e9('0x10')],_0x470fc7[_0x55e9('0x11')]));recordings[_0x470fc7[_0x55e9('0xf')]]={'uniqueid':_0x470fc7[_0x55e9('0xf')],'accountcode':_0x470fc7[_0x55e9('0x6')],'exten':_0x470fc7[_0x55e9('0x11')],'context':_0x470fc7[_0x55e9('0x10')],'channel':_0x470fc7[_0x55e9('0x12')],'monitors':[]};}}catch(_0x24d03c){utils[_0x55e9('0x13')](util['format'](_0x55e9('0xe'),_0x470fc7[_0x55e9('0xf')]),_0x24d03c);}};exports[_0x55e9('0x14')]=function(_0x309361){try{utils[_0x55e9('0xd')](util[_0x55e9('0x4')]('[%s][recordings][newstate]',_0x309361[_0x55e9('0xf')]),_0x309361);if(!_[_0x55e9('0x15')](recordings[_0x309361[_0x55e9('0xf')]])&&_0x309361[_0x55e9('0x16')]==0x6){utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x17'),_0x309361[_0x55e9('0xf')],_0x309361[_0x55e9('0x10')],_0x309361[_0x55e9('0x12')]));}else if(!_[_0x55e9('0x15')](recordings[_0x309361[_0x55e9('0x18')]])&&_0x309361['channelstate']==0x6&&_0x309361[_0x55e9('0x10')]!=_0x55e9('0x19')){utils[_0x55e9('0x3')](util['format'](_0x55e9('0x1a'),_0x309361[_0x55e9('0xf')],_0x309361[_0x55e9('0x18')],_0x309361[_0x55e9('0x10')],_0x309361[_0x55e9('0x12')]));recordings[_0x309361[_0x55e9('0x18')]][_0x55e9('0x6')]=_0x309361['accountcode'];}}catch(_0x2daa13){utils[_0x55e9('0x13')](util[_0x55e9('0x4')](_0x55e9('0x1b'),_0x309361['uniqueid']),_0x2daa13);}};exports[_0x55e9('0x1c')]=function(_0x1ae53f){try{if(!_[_0x55e9('0x15')](_0x1ae53f[_0x55e9('0x1d')])&&!_[_0x55e9('0x15')](_0x1ae53f['variable'][_0x55e9('0x1e')])){utils[_0x55e9('0xd')](util[_0x55e9('0x4')](_0x55e9('0x1f'),_0x1ae53f[_0x55e9('0xf')]),_0x1ae53f);utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x20'),_0x1ae53f[_0x55e9('0xf')],_0x1ae53f[_0x55e9('0x1d')],_0x1ae53f[_0x55e9('0x21')]));if(_[_0x55e9('0x22')](_0x1ae53f['value'],_0x55e9('0x23'))){_0x1ae53f[_0x55e9('0x21')]=_0x1ae53f['value'][_0x55e9('0x24')](_0x55e9('0x23'),_0x55e9('0x25'));}if(recordings[_0x1ae53f['linkedid']]){var _0x1b95c0=_[_0x55e9('0x26')](recordings[_0x1ae53f[_0x55e9('0x18')]]['monitors'],{'value':_0x1ae53f[_0x55e9('0x21')]});if(_[_0x55e9('0x15')](_0x1b95c0)){recordings[_0x1ae53f[_0x55e9('0x18')]][_0x55e9('0x27')][_0x55e9('0x28')]({'value':_0x1ae53f['value']});}}}}catch(_0x17af8f){utils[_0x55e9('0x13')](util[_0x55e9('0x4')]('[%s][recordings][varset]',_0x1ae53f[_0x55e9('0xf')]),_0x17af8f);}};exports[_0x55e9('0x29')]=function(_0x1559a6){try{if(!_['isNil'](recordings[_0x1559a6['uniqueid']])){utils[_0x55e9('0xd')](util[_0x55e9('0x4')](_0x55e9('0x2a'),_0x1559a6[_0x55e9('0xf')]),_0x1559a6);utils['info'](util[_0x55e9('0x4')](_0x55e9('0x2b'),_0x1559a6[_0x55e9('0xf')],_0x1559a6[_0x55e9('0x2c')],_0x1559a6[_0x55e9('0x2d')],_0x1559a6[_0x55e9('0x2e')]));recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2c')]=_0x1559a6[_0x55e9('0x2c')];recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2d')]=_0x1559a6[_0x55e9('0x2d')];recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2f')]=_0x1559a6['connectedlinenum'];recordings[_0x1559a6[_0x55e9('0xf')]]['connectedlinename']=_0x1559a6[_0x55e9('0x30')];if(recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x31')]==_0x55e9('0x32')&&recordings[_0x1559a6['uniqueid']][_0x55e9('0x6')]){recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x2f')]=recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x6')];recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x30')]='';}recordings[_0x1559a6[_0x55e9('0xf')]][_0x55e9('0x27')][_0x55e9('0x33')](function(_0x48d0e8){var _0x264d19=_['clone'](recordings[_0x1559a6[_0x55e9('0xf')]]);_0x264d19[_0x55e9('0x21')]=_0x48d0e8[_0x55e9('0x21')];writeDB(_0x264d19);});delete recordings[_0x1559a6[_0x55e9('0xf')]];}}catch(_0x237a6b){utils[_0x55e9('0x13')](util['format']('[%s][recordings][hangup]',_0x1559a6['uniqueid']),_0x237a6b);}};exports['newexten']=function(_0x45bd6e){try{if(!_[_0x55e9('0x15')](recordings[_0x45bd6e[_0x55e9('0xf')]])){utils[_0x55e9('0xd')](util[_0x55e9('0x4')]('[%s][recordings][newexten]',_0x45bd6e[_0x55e9('0xf')]),_0x45bd6e);utils[_0x55e9('0x3')](util[_0x55e9('0x4')](_0x55e9('0x34'),_0x45bd6e[_0x55e9('0xf')],_0x45bd6e[_0x55e9('0x35')],_0x45bd6e[_0x55e9('0x36')]));if(_0x45bd6e['application'][_0x55e9('0x37')]()==_0x55e9('0x38')&&_['startsWith'](_0x45bd6e[_0x55e9('0x36')][_0x55e9('0x37')](),_0x55e9('0x39'))){var _0x29590f=_0x45bd6e[_0x55e9('0x36')]['split']('=');var _0xf67e32=_0x29590f[0x0]['substring'](_0x29590f[0x0]['lastIndexOf']('(')+0x1,_0x29590f[0x0][_0x55e9('0x3a')](')'));var _0x10b27c=_0x29590f[0x1];recordings[_0x45bd6e[_0x55e9('0xf')]][_0xf67e32]=_0x10b27c;}}}catch(_0x173f73){utils[_0x55e9('0x13')](util[_0x55e9('0x4')](_0x55e9('0x3b'),_0x45bd6e[_0x55e9('0xf')]),_0x173f73);}};exports[_0x55e9('0x3c')]=function(_0x5c5098){try{if(!_['isNil'](recordings[_0x5c5098[_0x55e9('0xf')]])){utils[_0x55e9('0xd')](util['format']('[%s][recordings][queuecallerjoin]',_0x5c5098[_0x55e9('0xf')]),_0x5c5098);utils['info'](util['format'](_0x55e9('0x3d'),_0x5c5098[_0x55e9('0xf')],_0x5c5098[_0x55e9('0x3e')]));recordings[_0x5c5098['uniqueid']][_0x55e9('0x3e')]=_0x5c5098[_0x55e9('0x3e')];}}catch(_0x41fc23){utils[_0x55e9('0x13')](util[_0x55e9('0x4')]('[%s][recordings][queuecallerjoin]',_0x5c5098['uniqueid']),_0x41fc23);}}; \ No newline at end of file +var _0x2dcd=['request','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','replace','.WAV','find','monitors','value','[%s][recordings][hangup]','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','application','toLowerCase','set','appdata','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording'];(function(_0x17e16c,_0x14b603){var _0x1fa239=function(_0x11b397){while(--_0x11b397){_0x17e16c['push'](_0x17e16c['shift']());}};_0x1fa239(++_0x14b603);}(_0x2dcd,0x15c));var _0xd2dc=function(_0x138836,_0x229129){_0x138836=_0x138836-0x0;var _0x322688=_0x2dcd[_0x138836];return _0x322688;};'use strict';var _=require(_0xd2dc('0x0'));var util=require(_0xd2dc('0x1'));var utils=require(_0xd2dc('0x2'));var recordings={};function writeDB(_0x471378){utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][writeDB]',_0x471378[_0xd2dc('0x5')]));if(_0x471378[_0xd2dc('0x6')]){utils[_0xd2dc('0x7')](_0x471378['accountcode'])[_0xd2dc('0x8')](function(_0x82bd98){if(_0x82bd98){_0x471378[_0xd2dc('0x9')]=_0x82bd98[_0xd2dc('0xa')];_0x471378['UserId']=_0x82bd98['id'];}utils['request'](_0xd2dc('0xb'),_0x471378);});}else{utils[_0xd2dc('0xc')](_0xd2dc('0xb'),_0x471378);}}exports[_0xd2dc('0xd')]=function(_0x5cfb48){try{utils[_0xd2dc('0xe')](util['format'](_0xd2dc('0xf'),_0x5cfb48[_0xd2dc('0x5')]),_0x5cfb48);if(_0x5cfb48[_0xd2dc('0x5')]==_0x5cfb48[_0xd2dc('0x10')]){utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')](_0xd2dc('0x11'),_0x5cfb48[_0xd2dc('0x5')],_0x5cfb48[_0xd2dc('0x12')],_0x5cfb48[_0xd2dc('0x13')]));recordings[_0x5cfb48[_0xd2dc('0x5')]]={'uniqueid':_0x5cfb48[_0xd2dc('0x5')],'accountcode':_0x5cfb48[_0xd2dc('0x6')],'exten':_0x5cfb48[_0xd2dc('0x13')],'context':_0x5cfb48[_0xd2dc('0x12')],'channel':_0x5cfb48[_0xd2dc('0x14')],'monitors':[]};}}catch(_0x47abec){utils['error'](util[_0xd2dc('0x4')](_0xd2dc('0xf'),_0x5cfb48[_0xd2dc('0x5')]),_0x47abec);}};exports['newstate']=function(_0x23a9b8){try{utils[_0xd2dc('0xe')](util[_0xd2dc('0x4')](_0xd2dc('0x15'),_0x23a9b8[_0xd2dc('0x5')]),_0x23a9b8);if(!_[_0xd2dc('0x16')](recordings[_0x23a9b8['uniqueid']])&&_0x23a9b8[_0xd2dc('0x17')]==0x6){utils[_0xd2dc('0x3')](util['format'](_0xd2dc('0x18'),_0x23a9b8[_0xd2dc('0x5')],_0x23a9b8['context'],_0x23a9b8[_0xd2dc('0x14')]));}else if(!_[_0xd2dc('0x16')](recordings[_0x23a9b8[_0xd2dc('0x10')]])&&_0x23a9b8['channelstate']==0x6&&_0x23a9b8['context']!='transfer'){utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')](_0xd2dc('0x19'),_0x23a9b8[_0xd2dc('0x5')],_0x23a9b8['linkedid'],_0x23a9b8[_0xd2dc('0x12')],_0x23a9b8[_0xd2dc('0x14')]));recordings[_0x23a9b8[_0xd2dc('0x10')]][_0xd2dc('0x6')]=_0x23a9b8[_0xd2dc('0x6')];}}catch(_0x164cc0){utils[_0xd2dc('0x1a')](util[_0xd2dc('0x4')](_0xd2dc('0x15'),_0x23a9b8[_0xd2dc('0x5')]),_0x164cc0);}};exports[_0xd2dc('0x1b')]=function(_0x29a1a8){try{if(!_[_0xd2dc('0x16')](_0x29a1a8[_0xd2dc('0x1c')])&&!_[_0xd2dc('0x16')](_0x29a1a8[_0xd2dc('0x1c')][_0xd2dc('0x1d')])){utils[_0xd2dc('0xe')](util['format'](_0xd2dc('0x1e'),_0x29a1a8[_0xd2dc('0x5')]),_0x29a1a8);utils['info'](util[_0xd2dc('0x4')](_0xd2dc('0x1f'),_0x29a1a8[_0xd2dc('0x5')],_0x29a1a8[_0xd2dc('0x1c')],_0x29a1a8['value']));if(_[_0xd2dc('0x20')](_0x29a1a8['value'],_0xd2dc('0x21'))){_0x29a1a8['value']=_0x29a1a8['value'][_0xd2dc('0x22')]('.wav49',_0xd2dc('0x23'));}if(recordings[_0x29a1a8[_0xd2dc('0x10')]]){var _0x202d8b=_[_0xd2dc('0x24')](recordings[_0x29a1a8[_0xd2dc('0x10')]][_0xd2dc('0x25')],{'value':_0x29a1a8[_0xd2dc('0x26')]});if(_[_0xd2dc('0x16')](_0x202d8b)){recordings[_0x29a1a8[_0xd2dc('0x10')]][_0xd2dc('0x25')]['push']({'value':_0x29a1a8[_0xd2dc('0x26')]});}}}}catch(_0x4fac61){utils[_0xd2dc('0x1a')](util[_0xd2dc('0x4')](_0xd2dc('0x1e'),_0x29a1a8[_0xd2dc('0x5')]),_0x4fac61);}};exports['hangup']=function(_0x197adb){try{if(!_[_0xd2dc('0x16')](recordings[_0x197adb['uniqueid']])){utils['debug'](util['format'](_0xd2dc('0x27'),_0x197adb[_0xd2dc('0x5')]),_0x197adb);utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x197adb[_0xd2dc('0x5')],_0x197adb['calleridnum'],_0x197adb[_0xd2dc('0x28')],_0x197adb[_0xd2dc('0x29')]));recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2a')]=_0x197adb['calleridnum'];recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x28')]=_0x197adb['calleridname'];recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2b')]=_0x197adb[_0xd2dc('0x2b')];recordings[_0x197adb[_0xd2dc('0x5')]]['connectedlinename']=_0x197adb[_0xd2dc('0x2c')];if(recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2d')]==_0xd2dc('0x2e')&&recordings[_0x197adb['uniqueid']][_0xd2dc('0x6')]){recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2b')]=recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x6')];recordings[_0x197adb[_0xd2dc('0x5')]][_0xd2dc('0x2c')]='';}recordings[_0x197adb['uniqueid']][_0xd2dc('0x25')][_0xd2dc('0x2f')](function(_0xecb285){var _0x3e752f=_[_0xd2dc('0x30')](recordings[_0x197adb[_0xd2dc('0x5')]]);_0x3e752f['value']=_0xecb285[_0xd2dc('0x26')];writeDB(_0x3e752f);});delete recordings[_0x197adb[_0xd2dc('0x5')]];}}catch(_0x397123){utils['error'](util[_0xd2dc('0x4')](_0xd2dc('0x27'),_0x197adb['uniqueid']),_0x397123);}};exports['newexten']=function(_0x30ef56){try{if(!_[_0xd2dc('0x16')](recordings[_0x30ef56[_0xd2dc('0x5')]])){utils[_0xd2dc('0xe')](util['format'](_0xd2dc('0x31'),_0x30ef56['uniqueid']),_0x30ef56);utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x30ef56[_0xd2dc('0x5')],_0x30ef56[_0xd2dc('0x32')],_0x30ef56['appdata']));if(_0x30ef56[_0xd2dc('0x32')][_0xd2dc('0x33')]()==_0xd2dc('0x34')&&_['startsWith'](_0x30ef56[_0xd2dc('0x35')][_0xd2dc('0x33')](),'cdr')){var _0x276ef9=_0x30ef56[_0xd2dc('0x35')][_0xd2dc('0x36')]('=');var _0x2ae6c8=_0x276ef9[0x0][_0xd2dc('0x37')](_0x276ef9[0x0][_0xd2dc('0x38')]('(')+0x1,_0x276ef9[0x0][_0xd2dc('0x38')](')'));var _0x4f8f76=_0x276ef9[0x1];recordings[_0x30ef56[_0xd2dc('0x5')]][_0x2ae6c8]=_0x4f8f76;}}}catch(_0xa2e6b7){utils['error'](util[_0xd2dc('0x4')](_0xd2dc('0x31'),_0x30ef56[_0xd2dc('0x5')]),_0xa2e6b7);}};exports[_0xd2dc('0x39')]=function(_0x4f6e5e){try{if(!_[_0xd2dc('0x16')](recordings[_0x4f6e5e['uniqueid']])){utils['debug'](util['format'](_0xd2dc('0x3a'),_0x4f6e5e[_0xd2dc('0x5')]),_0x4f6e5e);utils[_0xd2dc('0x3')](util[_0xd2dc('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x4f6e5e[_0xd2dc('0x5')],_0x4f6e5e['queue']));recordings[_0x4f6e5e[_0xd2dc('0x5')]][_0xd2dc('0x3b')]=_0x4f6e5e['queue'];}}catch(_0x312554){utils[_0xd2dc('0x1a')](util[_0xd2dc('0x4')](_0xd2dc('0x3a'),_0x4f6e5e[_0xd2dc('0x5')]),_0x312554);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 5280ccb..97b38d2 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 _0x4453=['origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','util','./utils','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','debug','format','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','[%s][transfers][attendedtransfer]','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign'];(function(_0x2162c6,_0x2f9642){var _0x140e0d=function(_0x4b9df8){while(--_0x4b9df8){_0x2162c6['push'](_0x2162c6['shift']());}};_0x140e0d(++_0x2f9642);}(_0x4453,0x11d));var _0x3445=function(_0x42b931,_0x3b67f1){_0x42b931=_0x42b931-0x0;var _0x3cd6a2=_0x4453[_0x42b931];return _0x3cd6a2;};'use strict';var _=require('lodash');var util=require(_0x3445('0x0'));var utils=require(_0x3445('0x1'));function writeDB(_0x3f30cf){utils['info'](util['format'](_0x3445('0x2'),_0x3f30cf[_0x3445('0x3')]===_0x3445('0x4')?_0x3f30cf[_0x3445('0x5')]:_0x3f30cf[_0x3445('0x6')],_0x3f30cf[_0x3445('0x3')]));utils[_0x3445('0x7')]('CreateVoiceTransferReport',_0x3f30cf);}exports[_0x3445('0x8')]=function(_0x1cf230){try{utils[_0x3445('0x9')](util[_0x3445('0xa')]('[%s][transfers][blindtransfer]',_0x1cf230[_0x3445('0x6')]),_0x1cf230);utils[_0x3445('0xb')](util['format'](_0x3445('0xc'),_0x1cf230['uniqueid'],_0x1cf230[_0x3445('0xd')],_0x1cf230[_0x3445('0xe')],_0x1cf230['transfereecalleridnum'],_0x1cf230[_0x3445('0xf')]));_0x1cf230['type']=_0x3445('0x10');writeDB(_0x1cf230);}catch(_0x402df2){utils[_0x3445('0x11')](util[_0x3445('0xa')](_0x3445('0x12'),_0x1cf230['uniqueid']),_0x402df2);}};exports[_0x3445('0x13')]=function(_0x416fb9){try{utils[_0x3445('0x9')](util[_0x3445('0xa')](_0x3445('0x14'),_0x416fb9[_0x3445('0x5')]),_0x416fb9);utils[_0x3445('0xb')](util[_0x3445('0xa')](_0x3445('0x15'),_0x416fb9['origtransfereruniqueid'],_0x416fb9[_0x3445('0x16')],_0x416fb9[_0x3445('0x17')],_0x416fb9[_0x3445('0x18')],_0x416fb9[_0x3445('0x19')]));_0x416fb9=_[_0x3445('0x1a')](_0x416fb9,{'transfererchannel':_0x416fb9[_0x3445('0x1b')],'transferercalleridnum':_0x416fb9[_0x3445('0x16')],'transferercalleridname':_0x416fb9[_0x3445('0x17')],'transfererconnectedlinenum':_0x416fb9[_0x3445('0x1c')],'transfererconnectedlinename':_0x416fb9[_0x3445('0x1d')],'transfereraccountcode':_0x416fb9['origtransfereraccountcode'],'transferercontext':_0x416fb9['secondtransferercontext'],'transfererexten':_0x416fb9['secondtransfererexten'],'transfererlinkedid':_0x416fb9[_0x3445('0x1e')],'context':_0x416fb9[_0x3445('0x1f')],'extension':_0x416fb9['origtransfererexten'],'type':'attended'});if(_['isNil'](_0x416fb9[_0x3445('0x20')])){_0x416fb9=_[_0x3445('0x1a')](_0x416fb9,{'transfereechannel':_0x416fb9[_0x3445('0x21')],'transfereecalleridnum':_0x416fb9[_0x3445('0x18')],'transfereecalleridname':_0x416fb9[_0x3445('0x19')],'transfereeconnectedlinenum':_0x416fb9[_0x3445('0x22')],'transfereeconnectedlinename':_0x416fb9[_0x3445('0x23')],'transfereeaccountcode':_0x416fb9[_0x3445('0x24')],'transfereecontext':_0x416fb9['transfertargetcontext'],'transfereeexten':_0x416fb9[_0x3445('0x25')],'transfereelinkedid':_0x416fb9[_0x3445('0x26')]});}writeDB(_0x416fb9);}catch(_0xb598dd){utils[_0x3445('0x11')](util[_0x3445('0xa')](_0x3445('0x14'),_0x416fb9[_0x3445('0x5')]),_0xb598dd);}}; \ No newline at end of file +var _0x8b11=['info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request','CreateVoiceTransferReport','blindtransfer','debug','transferercalleridnum','transferercalleridname','error','[%s][transfers][blindtransfer]','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridname','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfereechannel','assign','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','lodash','util','./utils'];(function(_0x26f9fd,_0x301ab5){var _0x44a4bf=function(_0x42b9a5){while(--_0x42b9a5){_0x26f9fd['push'](_0x26f9fd['shift']());}};_0x44a4bf(++_0x301ab5);}(_0x8b11,0x165));var _0x18b1=function(_0x438e07,_0x590a1b){_0x438e07=_0x438e07-0x0;var _0x28f1a4=_0x8b11[_0x438e07];return _0x28f1a4;};'use strict';var _=require(_0x18b1('0x0'));var util=require(_0x18b1('0x1'));var utils=require(_0x18b1('0x2'));function writeDB(_0x3ad652){utils[_0x18b1('0x3')](util[_0x18b1('0x4')](_0x18b1('0x5'),_0x3ad652[_0x18b1('0x6')]===_0x18b1('0x7')?_0x3ad652['origtransfereruniqueid']:_0x3ad652[_0x18b1('0x8')],_0x3ad652[_0x18b1('0x6')]));utils[_0x18b1('0x9')](_0x18b1('0xa'),_0x3ad652);}exports[_0x18b1('0xb')]=function(_0x100dc5){try{utils[_0x18b1('0xc')](util[_0x18b1('0x4')]('[%s][transfers][blindtransfer]',_0x100dc5[_0x18b1('0x8')]),_0x100dc5);utils[_0x18b1('0x3')](util[_0x18b1('0x4')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x100dc5[_0x18b1('0x8')],_0x100dc5[_0x18b1('0xd')],_0x100dc5[_0x18b1('0xe')],_0x100dc5['transfereecalleridnum'],_0x100dc5['transfereecalleridname']));_0x100dc5['type']='blind';writeDB(_0x100dc5);}catch(_0x31b9f8){utils[_0x18b1('0xf')](util['format'](_0x18b1('0x10'),_0x100dc5[_0x18b1('0x8')]),_0x31b9f8);}};exports['attendedtransfer']=function(_0x3250dd){try{utils[_0x18b1('0xc')](util[_0x18b1('0x4')](_0x18b1('0x11'),_0x3250dd[_0x18b1('0x12')]),_0x3250dd);utils[_0x18b1('0x3')](util[_0x18b1('0x4')](_0x18b1('0x13'),_0x3250dd['origtransfereruniqueid'],_0x3250dd[_0x18b1('0x14')],_0x3250dd[_0x18b1('0x15')],_0x3250dd['transfertargetcalleridnum'],_0x3250dd[_0x18b1('0x16')]));_0x3250dd=_['assign'](_0x3250dd,{'transfererchannel':_0x3250dd[_0x18b1('0x17')],'transferercalleridnum':_0x3250dd['origtransferercalleridnum'],'transferercalleridname':_0x3250dd['origtransferercalleridname'],'transfererconnectedlinenum':_0x3250dd[_0x18b1('0x18')],'transfererconnectedlinename':_0x3250dd[_0x18b1('0x19')],'transfereraccountcode':_0x3250dd[_0x18b1('0x1a')],'transferercontext':_0x3250dd[_0x18b1('0x1b')],'transfererexten':_0x3250dd['secondtransfererexten'],'transfererlinkedid':_0x3250dd[_0x18b1('0x1c')],'context':_0x3250dd[_0x18b1('0x1d')],'extension':_0x3250dd[_0x18b1('0x1e')],'type':'attended'});if(_[_0x18b1('0x1f')](_0x3250dd[_0x18b1('0x20')])){_0x3250dd=_[_0x18b1('0x21')](_0x3250dd,{'transfereechannel':_0x3250dd['transfertargetchannel'],'transfereecalleridnum':_0x3250dd[_0x18b1('0x22')],'transfereecalleridname':_0x3250dd['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3250dd[_0x18b1('0x23')],'transfereeconnectedlinename':_0x3250dd[_0x18b1('0x24')],'transfereeaccountcode':_0x3250dd['transfertargetaccountcode'],'transfereecontext':_0x3250dd[_0x18b1('0x25')],'transfereeexten':_0x3250dd[_0x18b1('0x26')],'transfereelinkedid':_0x3250dd[_0x18b1('0x27')]});}writeDB(_0x3250dd);}catch(_0x2f2353){utils[_0x18b1('0xf')](util[_0x18b1('0x4')](_0x18b1('0x11'),_0x3250dd[_0x18b1('0x12')]),_0x2f2353);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 3f1a243..850413e 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 _0xfde2=['addTime','subtractTime','subtract','seconds','format','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr','info','inspect','debug','request','catch','error','GetUser','interface','[utils][getUser]\x20where:%s','result','length','getUserByInternal','found','notfound','[utils][getUserByInternal]','getUserByInterface','then','[utils][getUserByInterface]','getUserByName','getVoiceQueueByName','name','type','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]'];(function(_0x39f679,_0x1095a9){var _0x28a9f8=function(_0x122a5b){while(--_0x122a5b){_0x39f679['push'](_0x39f679['shift']());}};_0x28a9f8(++_0x1095a9);}(_0xfde2,0x86));var _0x2fde=function(_0x13c2cf,_0x568ba5){_0x13c2cf=_0x13c2cf-0x0;var _0x237785=_0xfde2[_0x13c2cf];return _0x237785;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x2fde('0x0'));var moment=require(_0x2fde('0x1'));var util=require('util');var client=jayson[_0x2fde('0x2')][_0x2fde('0x3')]({'port':0x2329});var logger=require(_0x2fde('0x4'))(_0x2fde('0x5'));exports[_0x2fde('0x6')]=function(_0xeeba70,_0x31c175){logger['info'](_0xeeba70,_0x31c175?util[_0x2fde('0x7')](_0x31c175,{'showHidden':![],'depth':null}):'');};exports[_0x2fde('0x8')]=function(_0x332d57,_0x4a4854){logger[_0x2fde('0x8')](_0x332d57,_0x4a4854?util[_0x2fde('0x7')](_0x4a4854,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x269e5e,_0x599bf6){logger['error'](_0x269e5e,_0x599bf6?util[_0x2fde('0x7')](_0x599bf6,{'showHidden':![],'depth':null}):'');};exports[_0x2fde('0x9')]=function(_0x3f3e53,_0x2e724d){return client['request'](_0x3f3e53,{'body':_0x2e724d})['then'](function(_0x433a97){logger[_0x2fde('0x8')]('[utils][request]\x20name:%s',_0x3f3e53,_0x433a97?util[_0x2fde('0x7')](_0x433a97,{'showHidden':![],'depth':null}):'');})[_0x2fde('0xa')](function(_0xf4f7ec){logger[_0x2fde('0xb')]('[utils][request]\x20name:%s',_0x3f3e53,_0xf4f7ec?util[_0x2fde('0x7')](_0xf4f7ec,{'showHidden':![],'depth':null}):'');});};function getUser(_0x314774){return client[_0x2fde('0x9')](_0x2fde('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x2fde('0xd')],'where':_0x314774,'limit':0x1}})['then'](function(_0xd629de){logger[_0x2fde('0x8')](_0x2fde('0xe'),JSON['stringify'](_0x314774),_0xd629de?util[_0x2fde('0x7')](_0xd629de,{'showHidden':![],'depth':null}):'');return _0xd629de[_0x2fde('0xf')][_0x2fde('0x10')]?_0xd629de[_0x2fde('0xf')][0x0]:null;});}exports[_0x2fde('0x11')]=function(_0x171c89){return new BPromise(function(_0x47a801,_0x379dd4){if(_0x171c89){return getUser({'internal':_0x171c89})['then'](function(_0x1f4fbf){logger[_0x2fde('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x171c89,_0x1f4fbf?_0x2fde('0x12'):_0x2fde('0x13'));return _0x47a801(_0x1f4fbf);})['catch'](function(_0x39d69d){logger['error'](_0x2fde('0x14'),_0x39d69d?util[_0x2fde('0x7')](_0x39d69d,{'showHidden':![],'depth':null}):'');return _0x47a801(null);});}return _0x47a801(null);});};exports[_0x2fde('0x15')]=function(_0x495278){return new BPromise(function(_0x18425c,_0x119886){if(_0x495278){return getUser({'interface':_0x495278})[_0x2fde('0x16')](function(_0x1ef013){logger[_0x2fde('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x495278,_0x1ef013?_0x2fde('0x12'):_0x2fde('0x13'));return _0x18425c(_0x1ef013);})[_0x2fde('0xa')](function(_0x19b09d){logger[_0x2fde('0xb')](_0x2fde('0x17'),_0x19b09d?util[_0x2fde('0x7')](_0x19b09d,{'showHidden':![],'depth':null}):'');return _0x18425c(null);});}return _0x18425c(null);});};exports[_0x2fde('0x18')]=function(_0x253165){return new BPromise(function(_0x3094a6,_0x39951e){if(_0x253165){return getUser({'name':_0x253165})[_0x2fde('0x16')](function(_0x548100){logger[_0x2fde('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x253165,_0x548100?'found':_0x2fde('0x13'));return _0x3094a6(_0x548100);})[_0x2fde('0xa')](function(_0x35c1e7){logger[_0x2fde('0xb')]('[utils][getUserByName]',_0x35c1e7?util[_0x2fde('0x7')](_0x35c1e7,{'showHidden':![],'depth':null}):'');return _0x3094a6(null);});}return _0x3094a6(null);});};exports[_0x2fde('0x19')]=function(_0x517d09){return new BPromise(function(_0x1530d3,_0x1cf6a4){if(_0x517d09){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x2fde('0x1a'),_0x2fde('0x1b'),'acw','acwTimeout'],'where':{'name':_0x517d09},'limit':0x1}})['then'](function(_0x4336c3){logger['debug'](_0x2fde('0x1c'),_0x517d09,_0x4336c3?util[_0x2fde('0x7')](_0x4336c3,{'showHidden':![],'depth':null}):'');logger[_0x2fde('0x6')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x517d09,_0x4336c3?_0x2fde('0x12'):_0x2fde('0x13'));return _0x1530d3(_0x4336c3['result'][_0x2fde('0x10')]?_0x4336c3[_0x2fde('0xf')][0x0]:null);})[_0x2fde('0xa')](function(_0x150f3c){logger['error'](_0x2fde('0x1d'),_0x150f3c?util[_0x2fde('0x7')](_0x150f3c,{'showHidden':![],'depth':null}):'');return _0x1530d3(null);});}return _0x1530d3(null);});};exports[_0x2fde('0x1e')]=function(_0x2e826a,_0x5d79a1){return moment(_0x2e826a)['add'](_0x5d79a1,'seconds')['format']('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2fde('0x1f')]=function(_0x570196,_0x560a12){return moment(_0x570196)[_0x2fde('0x20')](_0x560a12,_0x2fde('0x21'))[_0x2fde('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2fde('0x23')]=function(_0x520fd9,_0x38f3f8){return moment(_0x520fd9)[_0x2fde('0x24')](moment(_0x38f3f8),_0x2fde('0x21'));};exports[_0x2fde('0x25')]=function(_0x2bbec7,_0x298f2f){return parseInt(_0x2bbec7,0xa)+parseInt(_0x298f2f,0xa);};exports[_0x2fde('0x26')]=function(){return moment()[_0x2fde('0x22')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x2fde('0x27')]=function(_0x154e2b,_0x5357c7){if(_0x5357c7){return moment(_0x154e2b)[_0x2fde('0x27')](_0x5357c7);}return!![];};exports[_0x2fde('0x28')]=function(_0x53650f,_0x454f4b){if(_0x454f4b){return moment(_0x53650f)['isBefore'](_0x454f4b);}else if(_0x53650f){return!![];}return![];}; \ No newline at end of file +var _0xfbf5=['[utils][getUser]\x20where:%s','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','found','notfound','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','GetVoiceQueue','type','acw','[utils][getVoiceQueueByName]\x20name:%s\x20%s','result','length','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','moment','util','client','http','info','inspect','error','request','then','[utils][request]\x20name:%s','catch','GetUser','name','interface','debug'];(function(_0x5a1b31,_0x293ffd){var _0x273ef3=function(_0x12d585){while(--_0x12d585){_0x5a1b31['push'](_0x5a1b31['shift']());}};_0x273ef3(++_0x293ffd);}(_0xfbf5,0x174));var _0x5fbf=function(_0x290896,_0x273ad3){_0x290896=_0x290896-0x0;var _0x2628e6=_0xfbf5[_0x290896];return _0x2628e6;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var moment=require(_0x5fbf('0x0'));var util=require(_0x5fbf('0x1'));var client=jayson[_0x5fbf('0x2')][_0x5fbf('0x3')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0x5fbf('0x4')]=function(_0x3d3c77,_0x8c5b89){logger[_0x5fbf('0x4')](_0x3d3c77,_0x8c5b89?util['inspect'](_0x8c5b89,{'showHidden':![],'depth':null}):'');};exports['debug']=function(_0xdf2363,_0x7db035){logger['debug'](_0xdf2363,_0x7db035?util[_0x5fbf('0x5')](_0x7db035,{'showHidden':![],'depth':null}):'');};exports[_0x5fbf('0x6')]=function(_0xcf636e,_0x9ed5ef){logger[_0x5fbf('0x6')](_0xcf636e,_0x9ed5ef?util[_0x5fbf('0x5')](_0x9ed5ef,{'showHidden':![],'depth':null}):'');};exports[_0x5fbf('0x7')]=function(_0xf8e65f,_0x26548a){return client[_0x5fbf('0x7')](_0xf8e65f,{'body':_0x26548a})[_0x5fbf('0x8')](function(_0x4be8af){logger['debug'](_0x5fbf('0x9'),_0xf8e65f,_0x4be8af?util['inspect'](_0x4be8af,{'showHidden':![],'depth':null}):'');})[_0x5fbf('0xa')](function(_0x29ede8){logger['error'](_0x5fbf('0x9'),_0xf8e65f,_0x29ede8?util[_0x5fbf('0x5')](_0x29ede8,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3196a8){return client['request'](_0x5fbf('0xb'),{'options':{'raw':!![],'attributes':['id','internal',_0x5fbf('0xc'),_0x5fbf('0xd')],'where':_0x3196a8,'limit':0x1}})[_0x5fbf('0x8')](function(_0x57d1b2){logger[_0x5fbf('0xe')](_0x5fbf('0xf'),JSON['stringify'](_0x3196a8),_0x57d1b2?util[_0x5fbf('0x5')](_0x57d1b2,{'showHidden':![],'depth':null}):'');return _0x57d1b2['result']['length']?_0x57d1b2['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x5e48f9){return new BPromise(function(_0xee27b7,_0x2521d5){if(_0x5e48f9){return getUser({'internal':_0x5e48f9})[_0x5fbf('0x8')](function(_0xc5a071){logger['info']('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x5e48f9,_0xc5a071?'found':'notfound');return _0xee27b7(_0xc5a071);})['catch'](function(_0x2627e4){logger['error'](_0x5fbf('0x10'),_0x2627e4?util['inspect'](_0x2627e4,{'showHidden':![],'depth':null}):'');return _0xee27b7(null);});}return _0xee27b7(null);});};exports[_0x5fbf('0x11')]=function(_0x45c88a){return new BPromise(function(_0x1111be,_0x13e516){if(_0x45c88a){return getUser({'interface':_0x45c88a})['then'](function(_0x11c69d){logger[_0x5fbf('0x4')](_0x5fbf('0x12'),_0x45c88a,_0x11c69d?_0x5fbf('0x13'):_0x5fbf('0x14'));return _0x1111be(_0x11c69d);})[_0x5fbf('0xa')](function(_0x1e2d80){logger[_0x5fbf('0x6')](_0x5fbf('0x15'),_0x1e2d80?util[_0x5fbf('0x5')](_0x1e2d80,{'showHidden':![],'depth':null}):'');return _0x1111be(null);});}return _0x1111be(null);});};exports[_0x5fbf('0x16')]=function(_0x4fb20f){return new BPromise(function(_0x2c0c7b,_0x4b6e59){if(_0x4fb20f){return getUser({'name':_0x4fb20f})[_0x5fbf('0x8')](function(_0x28d244){logger['info'](_0x5fbf('0x17'),_0x4fb20f,_0x28d244?_0x5fbf('0x13'):_0x5fbf('0x14'));return _0x2c0c7b(_0x28d244);})[_0x5fbf('0xa')](function(_0x55f3e9){logger['error'](_0x5fbf('0x18'),_0x55f3e9?util[_0x5fbf('0x5')](_0x55f3e9,{'showHidden':![],'depth':null}):'');return _0x2c0c7b(null);});}return _0x2c0c7b(null);});};exports['getVoiceQueueByName']=function(_0x43a57d){return new BPromise(function(_0x42e76d,_0x3a111f){if(_0x43a57d){return client[_0x5fbf('0x7')](_0x5fbf('0x19'),{'options':{'raw':!![],'attributes':['id',_0x5fbf('0xc'),_0x5fbf('0x1a'),_0x5fbf('0x1b'),'acwTimeout'],'where':{'name':_0x43a57d},'limit':0x1}})[_0x5fbf('0x8')](function(_0xd7d20f){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x43a57d,_0xd7d20f?util[_0x5fbf('0x5')](_0xd7d20f,{'showHidden':![],'depth':null}):'');logger[_0x5fbf('0x4')](_0x5fbf('0x1c'),_0x43a57d,_0xd7d20f?_0x5fbf('0x13'):_0x5fbf('0x14'));return _0x42e76d(_0xd7d20f[_0x5fbf('0x1d')][_0x5fbf('0x1e')]?_0xd7d20f['result'][0x0]:null);})['catch'](function(_0x10c182){logger[_0x5fbf('0x6')]('[utils][getVoiceQueueByName]',_0x10c182?util['inspect'](_0x10c182,{'showHidden':![],'depth':null}):'');return _0x42e76d(null);});}return _0x42e76d(null);});};exports['addTime']=function(_0x5daa4e,_0x4396d6){return moment(_0x5daa4e)[_0x5fbf('0x1f')](_0x4396d6,_0x5fbf('0x20'))[_0x5fbf('0x21')](_0x5fbf('0x22'));};exports[_0x5fbf('0x23')]=function(_0x4b7fdb,_0x150f46){return moment(_0x4b7fdb)[_0x5fbf('0x24')](_0x150f46,_0x5fbf('0x20'))[_0x5fbf('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5fbf('0x25')]=function(_0x265217,_0x2f91d7){return moment(_0x265217)[_0x5fbf('0x26')](moment(_0x2f91d7),_0x5fbf('0x20'));};exports[_0x5fbf('0x27')]=function(_0x49ed1e,_0x384379){return parseInt(_0x49ed1e,0xa)+parseInt(_0x384379,0xa);};exports[_0x5fbf('0x28')]=function(){return moment()[_0x5fbf('0x21')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x5fbf('0x29')]=function(_0x53ec0a,_0x3268f4){if(_0x3268f4){return moment(_0x53ec0a)['isAfter'](_0x3268f4);}return!![];};exports[_0x5fbf('0x2a')]=function(_0x2ba083,_0x52f897){if(_0x52f897){return moment(_0x2ba083)[_0x5fbf('0x2a')](_0x52f897);}else if(_0x2ba083){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 40bff7d..cc279ec 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 _0xa68d=['%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','remoteAddress','statusCode','role','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','path','util','fileLogger','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','ensureDir','then','catch','log','user','no-user','data','timestamp','api','auth','set','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','headers','x-forwarded-for','connection','url','responseTime','name','inspect'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0xa68d,0x14b));var _0xda68=function(_0x37eb74,_0x3ada4c){_0x37eb74=_0x37eb74-0x0;var _0x5667b8=_0xa68d[_0x37eb74];return _0x5667b8;};var fs=require(_0xda68('0x0'));var _=require(_0xda68('0x1'));var ewinston=require(_0xda68('0x2'));var path=require(_0xda68('0x3'));var util=require(_0xda68('0x4'));var fileLogger=require('./loggers')[_0xda68('0x5')];var safeTemplate=require('./safe-template')[_0xda68('0x6')];var maskSensitiveData=require(_0xda68('0x7'))[_0xda68('0x8')];function ClientSideLogger(){function _0x29f8ab(_0xcf5997){var _0x40d418=path[_0xda68('0x9')](_0xda68('0xa'),'log',_0xda68('0xb'));var _0x135099=path['join'](_0xda68('0xc'),_0xcf5997['role']+'-'+_0xcf5997['name']);return fs[_0xda68('0xd')](path[_0xda68('0x9')](_0x40d418,_0x135099))[_0xda68('0xe')](function(){var _0x3e7445=fileLogger(_0xda68('0xc'),path[_0xda68('0x9')](_0x40d418,_0x135099));return _0x3e7445;})[_0xda68('0xf')](function(_0x26fb72){throw _0x26fb72;});}this[_0xda68('0x10')]=function(_0x2abece,_0x396030,_0x59d36b,_0x889841){return _0x29f8ab(_0x2abece['user'])[_0xda68('0xe')](function(_0x3eee3f){var _0x2e9da1=_0x3eee3f[_0x396030];return _0x2e9da1;})[_0xda68('0xe')](function(_0x40d91d){var _0x31012d=_0x2abece[_0xda68('0x11')]?_0x2abece[_0xda68('0x11')]['id']:_0xda68('0x12');var _0xe69951=_0x889841[_0xda68('0x13')];var _0x182c3f=_0x889841[_0xda68('0x14')];var _0x136f1c=new Date(Number(_0x182c3f));return _0x40d91d(_0x31012d,_0x136f1c,_0x59d36b,_0xe69951);})[_0xda68('0xf')](function(_0x34846d){fileLogger(_0xda68('0xc'))['error'](_0x34846d);});};}function setupLoggers(_0x4189b6){return new Promise(function(_0x5056cf){var _0x55d22d=new ClientSideLogger();var _0x9b636c=fileLogger(_0xda68('0x15'));var _0xe7a1f1=fileLogger(_0xda68('0x16'));_0x4189b6[_0xda68('0x17')]('client-side-logger',_0x55d22d);_0x4189b6['use'](ewinston[_0xda68('0x18')]({'winstonInstance':_0x9b636c,'meta':![],'statusLevels':!![],'msg':function(_0x2dd9a0,_0x50ab3e){var _0x1a5a03=_0xda68('0x19');if(!_[_0xda68('0x1a')](_0x2dd9a0[_0xda68('0x1b')])){_0x1a5a03+='\x20body=%s';var _0x48a4ad=_0x2dd9a0[_0xda68('0x1b')];maskSensitiveData(_0x48a4ad);}return safeTemplate(util[_0xda68('0x1c')](_0x1a5a03,_0x2dd9a0[_0xda68('0x1d')],_0x2dd9a0[_0xda68('0x1e')][_0xda68('0x1f')]?_0x2dd9a0[_0xda68('0x1e')][_0xda68('0x1f')]:_0x2dd9a0[_0xda68('0x20')]['remoteAddress']||_0x2dd9a0['ip'],_0x2dd9a0[_0xda68('0x21')],_0x50ab3e['statusCode'],_0x50ab3e[_0xda68('0x22')],_0x2dd9a0[_0xda68('0x11')]?_0x2dd9a0[_0xda68('0x11')]['id']:null,_0x2dd9a0[_0xda68('0x11')]?_0x2dd9a0[_0xda68('0x11')][_0xda68('0x23')]:null,_0x2dd9a0[_0xda68('0x11')]?_0x2dd9a0[_0xda68('0x11')]['role']:null,_0x48a4ad?util[_0xda68('0x24')](_0x48a4ad,![],null):''));}}));_0x4189b6['use'](ewinston[_0xda68('0x18')]({'winstonInstance':_0xe7a1f1,'meta':![],'statusLevels':!![],'msg':function(_0x5e33a7,_0x2e9df4){var _0x14837e=_0xda68('0x25');if(_0x5e33a7[_0xda68('0x1b')]&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x26')]&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x27')]){_0x14837e='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util['format'](_0x14837e,_0x5e33a7[_0xda68('0x1d')],_0x5e33a7[_0xda68('0x1e')][_0xda68('0x1f')]?_0x5e33a7['headers'][_0xda68('0x1f')]:_0x5e33a7['connection'][_0xda68('0x28')]||_0x5e33a7['ip'],_0x5e33a7['url'],_0x2e9df4[_0xda68('0x29')],_0x2e9df4[_0xda68('0x22')],_0x5e33a7[_0xda68('0x11')]?_0x5e33a7[_0xda68('0x11')]['id']:null,_0x5e33a7[_0xda68('0x11')]?_0x5e33a7[_0xda68('0x11')][_0xda68('0x23')]:null,_0x5e33a7['user']?_0x5e33a7['user'][_0xda68('0x2a')]:null,_0x5e33a7[_0xda68('0x1b')]&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x26')]?_0x5e33a7['body']['device']:'other',_0x5e33a7['body']&&_0x5e33a7[_0xda68('0x1b')][_0xda68('0x27')]?_0x5e33a7[_0xda68('0x1b')][_0xda68('0x27')]:'',_0x5e33a7[_0xda68('0x1b')]&&_0x5e33a7[_0xda68('0x1b')]['agent_name']?_0x5e33a7[_0xda68('0x1b')][_0xda68('0x2b')]:'');},'ignoreRoute':function(_0x3ca415){var _0x422891=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x422891[_0xda68('0x2c')](_0x3ca415[_0xda68('0x21')]);}}));return _0x5056cf();});}exports[_0xda68('0x2d')]=setupLoggers; \ No newline at end of file +var _0xc274=['api','set','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','format','method','x-forwarded-for','connection','remoteAddress','statusCode','responseTime','inspect','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','headers','url','device','agent_name','test','setupLoggers','lodash','express-winston','path','util','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','xcally','client','role','name','ensureDir','catch','log','user','then','no-user','data','error'];(function(_0x20bac4,_0x4b7189){var _0x5ceb3d=function(_0x300cf1){while(--_0x300cf1){_0x20bac4['push'](_0x20bac4['shift']());}};_0x5ceb3d(++_0x4b7189);}(_0xc274,0x11e));var _0x4c27=function(_0x143708,_0x55b81a){_0x143708=_0x143708-0x0;var _0x4b2da2=_0xc274[_0x143708];return _0x4b2da2;};var fs=require('fs-extra');var _=require(_0x4c27('0x0'));var ewinston=require(_0x4c27('0x1'));var path=require(_0x4c27('0x2'));var util=require(_0x4c27('0x3'));var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require(_0x4c27('0x4'))[_0x4c27('0x5')];var maskSensitiveData=require(_0x4c27('0x6'))[_0x4c27('0x7')];function ClientSideLogger(){function _0x1f264e(_0x247725){var _0x150763=path[_0x4c27('0x8')](_0x4c27('0x9'),'log',_0x4c27('0xa'));var _0x3ff9cc=path[_0x4c27('0x8')](_0x4c27('0xb'),_0x247725[_0x4c27('0xc')]+'-'+_0x247725[_0x4c27('0xd')]);return fs[_0x4c27('0xe')](path['join'](_0x150763,_0x3ff9cc))['then'](function(){var _0x196202=fileLogger(_0x4c27('0xb'),path[_0x4c27('0x8')](_0x150763,_0x3ff9cc));return _0x196202;})[_0x4c27('0xf')](function(_0x427227){throw _0x427227;});}this[_0x4c27('0x10')]=function(_0x68f321,_0x107835,_0x2a0a25,_0x46f8cc){return _0x1f264e(_0x68f321[_0x4c27('0x11')])[_0x4c27('0x12')](function(_0x10f06b){var _0x11d7a0=_0x10f06b[_0x107835];return _0x11d7a0;})[_0x4c27('0x12')](function(_0x5e15a2){var _0x56c0fb=_0x68f321[_0x4c27('0x11')]?_0x68f321[_0x4c27('0x11')]['id']:_0x4c27('0x13');var _0x13134c=_0x46f8cc[_0x4c27('0x14')];var _0x2ae06e=_0x46f8cc['timestamp'];var _0x5a1f23=new Date(Number(_0x2ae06e));return _0x5e15a2(_0x56c0fb,_0x5a1f23,_0x2a0a25,_0x13134c);})[_0x4c27('0xf')](function(_0x917610){fileLogger(_0x4c27('0xb'))[_0x4c27('0x15')](_0x917610);});};}function setupLoggers(_0x578d96){return new Promise(function(_0x315e11){var _0x4809b0=new ClientSideLogger();var _0x1cb5ce=fileLogger(_0x4c27('0x16'));var _0x4de712=fileLogger('auth');_0x578d96[_0x4c27('0x17')]('client-side-logger',_0x4809b0);_0x578d96['use'](ewinston[_0x4c27('0x18')]({'winstonInstance':_0x1cb5ce,'meta':![],'statusLevels':!![],'msg':function(_0x23bb32,_0x1979d8){var _0x3db600=_0x4c27('0x19');if(!_[_0x4c27('0x1a')](_0x23bb32[_0x4c27('0x1b')])){_0x3db600+='\x20body=%s';var _0x4048bb=_0x23bb32[_0x4c27('0x1b')];maskSensitiveData(_0x4048bb);}return safeTemplate(util[_0x4c27('0x1c')](_0x3db600,_0x23bb32[_0x4c27('0x1d')],_0x23bb32['headers']['x-forwarded-for']?_0x23bb32['headers'][_0x4c27('0x1e')]:_0x23bb32[_0x4c27('0x1f')][_0x4c27('0x20')]||_0x23bb32['ip'],_0x23bb32['url'],_0x1979d8[_0x4c27('0x21')],_0x1979d8[_0x4c27('0x22')],_0x23bb32[_0x4c27('0x11')]?_0x23bb32[_0x4c27('0x11')]['id']:null,_0x23bb32[_0x4c27('0x11')]?_0x23bb32['user'][_0x4c27('0xd')]:null,_0x23bb32[_0x4c27('0x11')]?_0x23bb32[_0x4c27('0x11')][_0x4c27('0xc')]:null,_0x4048bb?util[_0x4c27('0x23')](_0x4048bb,![],null):''));}}));_0x578d96['use'](ewinston['logger']({'winstonInstance':_0x4de712,'meta':![],'statusLevels':!![],'msg':function(_0x4cb729,_0x3df2b4){var _0x574729='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s';if(_0x4cb729[_0x4c27('0x1b')]&&_0x4cb729[_0x4c27('0x1b')]['device']&&_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x24')]){_0x574729=_0x4c27('0x25');}return util[_0x4c27('0x1c')](_0x574729,_0x4cb729[_0x4c27('0x1d')],_0x4cb729[_0x4c27('0x26')][_0x4c27('0x1e')]?_0x4cb729[_0x4c27('0x26')]['x-forwarded-for']:_0x4cb729[_0x4c27('0x1f')][_0x4c27('0x20')]||_0x4cb729['ip'],_0x4cb729[_0x4c27('0x27')],_0x3df2b4[_0x4c27('0x21')],_0x3df2b4[_0x4c27('0x22')],_0x4cb729[_0x4c27('0x11')]?_0x4cb729['user']['id']:null,_0x4cb729[_0x4c27('0x11')]?_0x4cb729[_0x4c27('0x11')][_0x4c27('0xd')]:null,_0x4cb729[_0x4c27('0x11')]?_0x4cb729['user'][_0x4c27('0xc')]:null,_0x4cb729[_0x4c27('0x1b')]&&_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x28')]?_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x28')]:'other',_0x4cb729['body']&&_0x4cb729[_0x4c27('0x1b')]['agent_id']?_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x24')]:'',_0x4cb729[_0x4c27('0x1b')]&&_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x29')]?_0x4cb729[_0x4c27('0x1b')][_0x4c27('0x29')]:'');},'ignoreRoute':function(_0x5339c0){var _0x3dbf3c=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3dbf3c[_0x4c27('0x2a')](_0x5339c0[_0x4c27('0x27')]);}}));return _0x315e11();});}exports[_0x4c27('0x2b')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 077e119..e905611 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8e6c=['format','includes','dowCompare','daysInMonth','max','min','domCompare','MMM','test','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','isValid','split','locale','weekdaysShort','indexOf','slice','concat','exports','monthsShort','toLowerCase','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','isBetween','timeCompare'];(function(_0x1e05db,_0x4db865){var _0x2a50da=function(_0x498b08){while(--_0x498b08){_0x1e05db['push'](_0x1e05db['shift']());}};_0x2a50da(++_0x4db865);}(_0x8e6c,0xcb));var _0xc8e6=function(_0x2e09b0,_0x4ffaa1){_0x2e09b0=_0x2e09b0-0x0;var _0x838cb9=_0x8e6c[_0x2e09b0];return _0x838cb9;};var _=require(_0xc8e6('0x0'));var moment=require(_0xc8e6('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xc8e6('0x2')](function(_0x1b706c){return _0x1b706c[_0xc8e6('0x3')];})[_0xc8e6('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc8e6('0x5');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x3178b4){if(!_0x3178b4[_0xc8e6('0x6')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3bf5a6){var _0x2023e1=_0x3bf5a6[_0xc8e6('0x7')](':')[_0xc8e6('0x2')](function(_0x42a74e){return parseInt(_0x42a74e,0xa);});var _0x558c7d=_0x2023e1[0x0];var _0x2b735b=_0x2023e1[0x1];if(_0x558c7d<0x0||_0x558c7d>0x17||_0x2b735b<0x0||_0x2b735b>0x3b){throw new Error(EINVALID_DATE);}return[_0x558c7d,_0x2b735b];}function circularDoWInterval(_0x15bdf6,_0x45ce9b){if(_0x15bdf6===_0x45ce9b){return[_0x15bdf6];}else{var _0x3cb4e8=moment[_0xc8e6('0x8')]();moment['locale']('en');var _0x4822be=moment[_0xc8e6('0x9')]()[_0xc8e6('0x2')](function(_0x18da6c){return _0x18da6c['toLowerCase']();});moment[_0xc8e6('0x8')](_0x3cb4e8);var _0x291d3b=_0x4822be[_0xc8e6('0xa')](_0x15bdf6);var _0x344f21=_0x4822be[_0xc8e6('0xa')](_0x45ce9b);if(_0x344f21>_0x291d3b){return _0x4822be[_0xc8e6('0xb')](_0x291d3b,_0x344f21+0x1);}else{var _0x2a7bff=_0x4822be[_0xc8e6('0xb')](0x0,_0x344f21+0x1);var _0x5c1c42=_0x4822be[_0xc8e6('0xb')](_0x291d3b);return _0x5c1c42[_0xc8e6('0xc')](_0x2a7bff);}}}module[_0xc8e6('0xd')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x3f69b4,_0x418171){if(_0x3f69b4===_0x418171){return[_0x3f69b4];}else{var _0x5e9c94=moment[_0xc8e6('0x8')]();moment[_0xc8e6('0x8')]('en');var _0x3bbc5e=moment[_0xc8e6('0xe')]()[_0xc8e6('0x2')](function(_0x565172){return _0x565172[_0xc8e6('0xf')]();});moment[_0xc8e6('0x8')](_0x5e9c94);var _0x4eaeb5=_0x3bbc5e['indexOf'](_0x3f69b4);var _0x3803a9=_0x3bbc5e[_0xc8e6('0xa')](_0x418171);if(_0x3803a9>_0x4eaeb5){return _0x3bbc5e['slice'](_0x4eaeb5,_0x3803a9+0x1);}else{var _0x370757=_0x3bbc5e[_0xc8e6('0xb')](0x0,_0x3803a9+0x1);var _0x7cf86=_0x3bbc5e['slice'](_0x4eaeb5);return _0x7cf86['concat'](_0x370757);}}}module[_0xc8e6('0xd')][_0xc8e6('0x10')]=circularMonthInterval;function parseDom(_0x11ba38){var _0x44b70f=parseInt(_0x11ba38,0xa);if(_0x44b70f<0x1||_0x44b70f>0x1f){throw new Error(EINVALID_DATE);}return _0x44b70f;}function timeCompare(_0x2e2739,_0x280b1d,_0x236cd4){var _0x3051ce=_0x2e2739[_0xc8e6('0x11')]();var _0x4da51c=extractTime(_0x280b1d);var _0x1d7b42=_0x4da51c[0x0];var _0x1c3796=_0x4da51c[0x1];var _0x434507=_0x2e2739[_0xc8e6('0x11')]()[_0xc8e6('0x12')](_0x1d7b42)[_0xc8e6('0x13')](_0x1c3796);throwIfDateNotValid(_0x434507);var _0x2ccbb5=extractTime(_0x236cd4);var _0x1f1e29=_0x2ccbb5[0x0];var _0x13fb9f=_0x2ccbb5[0x1];var _0x5c1a9b=_0x2e2739['clone']()[_0xc8e6('0x12')](_0x1f1e29)['minutes'](_0x13fb9f);throwIfDateNotValid(_0x5c1a9b);if(_0x5c1a9b[_0xc8e6('0x14')](_0x434507)){var _0x2f4d58=_0x3051ce['clone']()[_0xc8e6('0x15')](_0xc8e6('0x16'));var _0x54d4c7=_0x3051ce[_0xc8e6('0x11')]()['endOf'](_0xc8e6('0x16'));return _0x3051ce['isBetween'](_0x434507,_0x54d4c7,undefined,'[]')||_0x3051ce[_0xc8e6('0x17')](_0x2f4d58,_0x5c1a9b,undefined,'[]');}else{return _0x3051ce['isBetween'](_0x434507,_0x5c1a9b,undefined,'[]');}}module[_0xc8e6('0xd')][_0xc8e6('0x18')]=timeCompare;function dowCompare(_0x19581c,_0x3ab14d,_0x1ec0f5){var _0x4a30f9=_0x19581c[_0xc8e6('0x8')]('en')[_0xc8e6('0x19')]('ddd')[_0xc8e6('0xf')]();return circularDoWInterval(_0x3ab14d,_0x1ec0f5)[_0xc8e6('0x1a')](_0x4a30f9);}module[_0xc8e6('0xd')][_0xc8e6('0x1b')]=dowCompare;function domCompare(_0x3f5c9a,_0x45e3c7,_0x414250){var _0x305a0a=_0x3f5c9a['date']();if(_0x45e3c7===_0x414250){return _0x305a0a===_0x45e3c7;}else{var _0x56c7b7=_0x3f5c9a[_0xc8e6('0x1c')]();var _0x24d4ad=_0x45e3c7<_0x414250;let _0x7a9767=![];var _0x5acf19=0x0;var _0x2d5891=0x0;if(_0x24d4ad){_0x5acf19=Math[_0xc8e6('0x1d')](0x1,_0x45e3c7);_0x2d5891=Math[_0xc8e6('0x1e')](_0x414250,_0x56c7b7);_0x7a9767=_0x305a0a>=_0x5acf19&&_0x305a0a<=_0x2d5891;}else{_0x5acf19=Math[_0xc8e6('0x1e')](_0x45e3c7,_0x56c7b7);_0x2d5891=Math[_0xc8e6('0x1d')](0x1,_0x414250);_0x7a9767=_0x305a0a>=_0x5acf19||_0x305a0a<=_0x2d5891;}return _0x7a9767;}}module[_0xc8e6('0xd')][_0xc8e6('0x1f')]=domCompare;function monthCompare(_0x3d2b6c,_0x5146b2,_0x11894c){var _0x1acb13=_0x3d2b6c[_0xc8e6('0x8')]('en')[_0xc8e6('0x19')](_0xc8e6('0x20'))['toLowerCase']();return circularMonthInterval(_0x5146b2,_0x11894c)[_0xc8e6('0x1a')](_0x1acb13);}module[_0xc8e6('0xd')]['monthCompare']=monthCompare;function iftime(_0x30ff69,_0x4b16fe=moment['tz']['guess'](),_0x23e65b=moment()){if(!validateRx[_0xc8e6('0x21')](_0x30ff69)){throw new Error(EINVALID_STRING);}else{var _0x4521d3=(moment[_0xc8e6('0x22')](_0x23e65b)?_0x23e65b[_0xc8e6('0x11')]():moment(_0x23e65b))['tz'](_0x4b16fe)[_0xc8e6('0x8')]('en');throwIfDateNotValid(_0x4521d3);var _0x1f4ec2=_0x30ff69[_0xc8e6('0x7')](',');var _0x55f308=_0x1f4ec2[0x0];var _0x247bdb=_0x1f4ec2[0x1];var _0x3607ea=_0x1f4ec2[0x2];var _0x4b7cb3=_0x1f4ec2[0x3];let _0x5caa2a=!![];if(_0x55f308!=='*'){var _0x4cd79e=_0x55f308[_0xc8e6('0x7')]('-');var _0x1f3035=_[_0xc8e6('0x23')](_0x4cd79e[0x0],0x5,'0');var _0x158506=_0x4cd79e[_0xc8e6('0x24')]===0x2?_[_0xc8e6('0x23')](_0x4cd79e[0x1],0x5,'0'):_0x1f3035;_0x5caa2a=timeCompare(_0x4521d3,_0x1f3035,_0x158506);}let _0x4acb42=!![];if(_0x247bdb!=='*'){var _0x854b9e=_0x247bdb['split']('-');var _0x1de40b=_0x854b9e[0x0];var _0x390716=_0x854b9e['length']===0x2?_0x854b9e[0x1]:_0x1de40b;_0x4acb42=dowCompare(_0x4521d3,_0x1de40b,_0x390716);}let _0x32fc48=!![];if(_0x3607ea!=='*'){var _0x220de0=_0x3607ea['split']('-');var _0x50241a=parseDom(_0x220de0[0x0]);var _0x2f754b=_0x220de0[_0xc8e6('0x24')]===0x2?parseDom(_0x220de0[0x1]):_0x50241a;_0x32fc48=domCompare(_0x4521d3,_0x50241a,_0x2f754b);}let _0x25d276=!![];if(_0x4b7cb3!=='*'){var _0x5f5d31=_0x4b7cb3['split']('-');var _0x308c6d=_0x5f5d31[0x0];var _0x487adb=_0x5f5d31[_0xc8e6('0x24')]===0x2?_0x5f5d31[0x1]:_0x5f5d31[0x0];_0x25d276=monthCompare(_0x4521d3,_0x308c6d,_0x487adb);}return _0x5caa2a&&_0x4acb42&&_0x32fc48&&_0x25d276;}}module[_0xc8e6('0xd')][_0xc8e6('0x25')]=iftime; \ No newline at end of file +var _0x304c=['length','iftime','lodash','moment-timezone','source','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','split','map','locale','toLowerCase','indexOf','slice','concat','exports','circularDoWInterval','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','MMM','monthCompare','test','isMoment','padStart'];(function(_0x485a2e,_0x5254e3){var _0x33545d=function(_0x2cc980){while(--_0x2cc980){_0x485a2e['push'](_0x485a2e['shift']());}};_0x33545d(++_0x5254e3);}(_0x304c,0x7d));var _0xc304=function(_0x2f13a3,_0x1659ce){_0x2f13a3=_0x2f13a3-0x0;var _0x4275e2=_0x304c[_0x2f13a3];return _0x4275e2;};var _=require(_0xc304('0x0'));var moment=require(_0xc304('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x58a015){return _0x58a015[_0xc304('0x2')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xc304('0x3');var EINVALID_DATE=_0xc304('0x4');function throwIfDateNotValid(_0x3351f3){if(!_0x3351f3[_0xc304('0x5')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x36cc66){var _0xc3324=_0x36cc66[_0xc304('0x6')](':')[_0xc304('0x7')](function(_0x58df6b){return parseInt(_0x58df6b,0xa);});var _0x1e3424=_0xc3324[0x0];var _0x228ab6=_0xc3324[0x1];if(_0x1e3424<0x0||_0x1e3424>0x17||_0x228ab6<0x0||_0x228ab6>0x3b){throw new Error(EINVALID_DATE);}return[_0x1e3424,_0x228ab6];}function circularDoWInterval(_0x2b7dac,_0x45b1ce){if(_0x2b7dac===_0x45b1ce){return[_0x2b7dac];}else{var _0x5211a2=moment[_0xc304('0x8')]();moment[_0xc304('0x8')]('en');var _0x18df28=moment['weekdaysShort']()[_0xc304('0x7')](function(_0x46dbde){return _0x46dbde[_0xc304('0x9')]();});moment['locale'](_0x5211a2);var _0x254a7a=_0x18df28[_0xc304('0xa')](_0x2b7dac);var _0x1310d7=_0x18df28['indexOf'](_0x45b1ce);if(_0x1310d7>_0x254a7a){return _0x18df28[_0xc304('0xb')](_0x254a7a,_0x1310d7+0x1);}else{var _0x47b4a6=_0x18df28['slice'](0x0,_0x1310d7+0x1);var _0x3396b2=_0x18df28[_0xc304('0xb')](_0x254a7a);return _0x3396b2[_0xc304('0xc')](_0x47b4a6);}}}module[_0xc304('0xd')][_0xc304('0xe')]=circularDoWInterval;function circularMonthInterval(_0x3159ab,_0x188f39){if(_0x3159ab===_0x188f39){return[_0x3159ab];}else{var _0x45b263=moment[_0xc304('0x8')]();moment[_0xc304('0x8')]('en');var _0x7934d0=moment[_0xc304('0xf')]()[_0xc304('0x7')](function(_0x6e245d){return _0x6e245d[_0xc304('0x9')]();});moment['locale'](_0x45b263);var _0x911a0d=_0x7934d0[_0xc304('0xa')](_0x3159ab);var _0x2d3abe=_0x7934d0[_0xc304('0xa')](_0x188f39);if(_0x2d3abe>_0x911a0d){return _0x7934d0[_0xc304('0xb')](_0x911a0d,_0x2d3abe+0x1);}else{var _0x29135a=_0x7934d0[_0xc304('0xb')](0x0,_0x2d3abe+0x1);var _0x37348a=_0x7934d0['slice'](_0x911a0d);return _0x37348a[_0xc304('0xc')](_0x29135a);}}}module[_0xc304('0xd')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x3d5ded){var _0x777fde=parseInt(_0x3d5ded,0xa);if(_0x777fde<0x1||_0x777fde>0x1f){throw new Error(EINVALID_DATE);}return _0x777fde;}function timeCompare(_0x33c9f7,_0x3c5998,_0x294b52){var _0x40e27f=_0x33c9f7[_0xc304('0x10')]();var _0x409ca7=extractTime(_0x3c5998);var _0x5c1f11=_0x409ca7[0x0];var _0x4b50d3=_0x409ca7[0x1];var _0x4cc9fb=_0x33c9f7[_0xc304('0x10')]()[_0xc304('0x11')](_0x5c1f11)[_0xc304('0x12')](_0x4b50d3);throwIfDateNotValid(_0x4cc9fb);var _0x3e6df3=extractTime(_0x294b52);var _0x13c2db=_0x3e6df3[0x0];var _0x4fc282=_0x3e6df3[0x1];var _0x15d748=_0x33c9f7[_0xc304('0x10')]()[_0xc304('0x11')](_0x13c2db)['minutes'](_0x4fc282);throwIfDateNotValid(_0x15d748);if(_0x15d748[_0xc304('0x13')](_0x4cc9fb)){var _0x43af5c=_0x40e27f[_0xc304('0x10')]()[_0xc304('0x14')](_0xc304('0x15'));var _0x42d682=_0x40e27f['clone']()[_0xc304('0x16')]('day');return _0x40e27f[_0xc304('0x17')](_0x4cc9fb,_0x42d682,undefined,'[]')||_0x40e27f['isBetween'](_0x43af5c,_0x15d748,undefined,'[]');}else{return _0x40e27f[_0xc304('0x17')](_0x4cc9fb,_0x15d748,undefined,'[]');}}module[_0xc304('0xd')][_0xc304('0x18')]=timeCompare;function dowCompare(_0x345e7c,_0x31e9fc,_0x526085){var _0x3828fc=_0x345e7c[_0xc304('0x8')]('en')[_0xc304('0x19')](_0xc304('0x1a'))[_0xc304('0x9')]();return circularDoWInterval(_0x31e9fc,_0x526085)[_0xc304('0x1b')](_0x3828fc);}module['exports'][_0xc304('0x1c')]=dowCompare;function domCompare(_0x4d9756,_0x56d53a,_0x5884d2){var _0x2ebabb=_0x4d9756[_0xc304('0x1d')]();if(_0x56d53a===_0x5884d2){return _0x2ebabb===_0x56d53a;}else{var _0x1238d8=_0x4d9756[_0xc304('0x1e')]();var _0x2af93e=_0x56d53a<_0x5884d2;let _0x170550=![];var _0x399318=0x0;var _0x5c027f=0x0;if(_0x2af93e){_0x399318=Math[_0xc304('0x1f')](0x1,_0x56d53a);_0x5c027f=Math[_0xc304('0x20')](_0x5884d2,_0x1238d8);_0x170550=_0x2ebabb>=_0x399318&&_0x2ebabb<=_0x5c027f;}else{_0x399318=Math[_0xc304('0x20')](_0x56d53a,_0x1238d8);_0x5c027f=Math['max'](0x1,_0x5884d2);_0x170550=_0x2ebabb>=_0x399318||_0x2ebabb<=_0x5c027f;}return _0x170550;}}module[_0xc304('0xd')][_0xc304('0x21')]=domCompare;function monthCompare(_0x22b1cc,_0xb3084c,_0x418ddf){var _0x4c7c0e=_0x22b1cc[_0xc304('0x8')]('en')[_0xc304('0x19')](_0xc304('0x22'))['toLowerCase']();return circularMonthInterval(_0xb3084c,_0x418ddf)['includes'](_0x4c7c0e);}module[_0xc304('0xd')][_0xc304('0x23')]=monthCompare;function iftime(_0x387c68,_0x1cd2f5=moment['tz']['guess'](),_0x119a17=moment()){if(!validateRx[_0xc304('0x24')](_0x387c68)){throw new Error(EINVALID_STRING);}else{var _0x3f4c8e=(moment[_0xc304('0x25')](_0x119a17)?_0x119a17[_0xc304('0x10')]():moment(_0x119a17))['tz'](_0x1cd2f5)[_0xc304('0x8')]('en');throwIfDateNotValid(_0x3f4c8e);var _0x4644ca=_0x387c68[_0xc304('0x6')](',');var _0x43d82e=_0x4644ca[0x0];var _0x4ebc63=_0x4644ca[0x1];var _0x399fa0=_0x4644ca[0x2];var _0x5d7b9f=_0x4644ca[0x3];let _0xe1f8ee=!![];if(_0x43d82e!=='*'){var _0x1cd0ba=_0x43d82e['split']('-');var _0xafe3fc=_[_0xc304('0x26')](_0x1cd0ba[0x0],0x5,'0');var _0x55bc49=_0x1cd0ba[_0xc304('0x27')]===0x2?_['padStart'](_0x1cd0ba[0x1],0x5,'0'):_0xafe3fc;_0xe1f8ee=timeCompare(_0x3f4c8e,_0xafe3fc,_0x55bc49);}let _0x46c187=!![];if(_0x4ebc63!=='*'){var _0x1fc6a2=_0x4ebc63[_0xc304('0x6')]('-');var _0x1fb3a2=_0x1fc6a2[0x0];var _0x3e7b83=_0x1fc6a2[_0xc304('0x27')]===0x2?_0x1fc6a2[0x1]:_0x1fb3a2;_0x46c187=dowCompare(_0x3f4c8e,_0x1fb3a2,_0x3e7b83);}let _0x172c5f=!![];if(_0x399fa0!=='*'){var _0x5d0d6b=_0x399fa0['split']('-');var _0x31109a=parseDom(_0x5d0d6b[0x0]);var _0xcda1c8=_0x5d0d6b[_0xc304('0x27')]===0x2?parseDom(_0x5d0d6b[0x1]):_0x31109a;_0x172c5f=domCompare(_0x3f4c8e,_0x31109a,_0xcda1c8);}let _0x38e7db=!![];if(_0x5d7b9f!=='*'){var _0x3fbd97=_0x5d7b9f[_0xc304('0x6')]('-');var _0x50b586=_0x3fbd97[0x0];var _0x859c61=_0x3fbd97[_0xc304('0x27')]===0x2?_0x3fbd97[0x1]:_0x3fbd97[0x0];_0x38e7db=monthCompare(_0x3f4c8e,_0x50b586,_0x859c61);}return _0xe1f8ee&&_0x46c187&&_0x172c5f&&_0x38e7db;}}module[_0xc304('0xd')][_0xc304('0x28')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 03b5616..7bacb36 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5312=['join','%s-%s.log','message','replace','{{{','[%s]\x20[%s]\x20%s\x20-\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','}}}','meta','length','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','level','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','fileLogger','path','util','debugLevel','toLowerCase','info','red','bold\x20yellow','bold\x20white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0x5312,0x113));var _0x2531=function(_0x1ce30d,_0x415191){_0x1ce30d=_0x1ce30d-0x0;var _0x2e66e6=_0x5312[_0x1ce30d];return _0x2e66e6;};'use strict';var path=require(_0x2531('0x0'));var util=require(_0x2531('0x1'));var moment=require('moment');var winston=require('winston');var config=require('../config/environment');var debugLevel=config[_0x2531('0x2')]?config['debugLevel'][_0x2531('0x3')]():_0x2531('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':'redBG\x20white','error':_0x2531('0x5'),'warn':_0x2531('0x6'),'info':'white','print':_0x2531('0x7'),'success':_0x2531('0x8'),'http':_0x2531('0x9'),'verbose':_0x2531('0xa'),'debug':_0x2531('0xb'),'silly':_0x2531('0xc')};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x380dac,_0x44e011,_0x18aa89){var _0x367aee=_0x380dac||'/var/log/xcally';return path[_0x2531('0xd')](_0x367aee,util['format'](_0x2531('0xe'),_0x44e011,_0x18aa89));}function formatter(_0x40329e,_0x23bfce){_0x23bfce['message']=_0x23bfce[_0x2531('0xf')][_0x2531('0x10')](/@@{/g,_0x2531('0x11'))[_0x2531('0x10')](/}@@/g,'}}}')[_0x2531('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');return util['format'](_0x2531('0x12'),moment()[_0x2531('0x13')](_0x2531('0x14')),_0x23bfce['level']['toUpperCase'](),_0x40329e,_0x23bfce[_0x2531('0xf')]);}function fileFormat(_0x51b592,_0x36318f){_0x36318f[_0x2531('0xf')]=_0x36318f[_0x2531('0xf')][_0x2531('0x10')](/@@{/g,_0x2531('0x11'))[_0x2531('0x10')](/}@@/g,_0x2531('0x15'))[_0x2531('0x10')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x11fc4c=_0x36318f[_0x2531('0x16')]&&Object['keys'](_0x36318f[_0x2531('0x16')])[_0x2531('0x17')]?'\x0a\x09'+JSON['stringify'](_0x36318f[_0x2531('0x16')]):'';return util[_0x2531('0x13')](_0x2531('0x18'),moment()[_0x2531('0x13')](_0x2531('0x14')),_0x36318f[_0x2531('0x19')][_0x2531('0x1a')](),_0x51b592,_0x36318f[_0x2531('0xf')],_0x11fc4c);}function consoleLogger(){var _0x1c128c=new winston[(_0x2531('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2531('0x1c'))][(_0x2531('0x1d'))]({'level':_0x2531('0x1e'),'json':![],'formatter':function(_0x374658){return formatter('',_0x374658);}})]});return _0x1c128c;}function fileLogger(_0x45ff85,_0x43f652){var _0x81a882=new winston[(_0x2531('0x1b'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x2531('0x1c'))][(_0x2531('0x1f'))]({'name':util[_0x2531('0x13')](_0x2531('0x20'),_0x45ff85,_0x2531('0x21')),'filename':getLogFileName(_0x43f652,_0x45ff85,_0x2531('0x21')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2c3642){return fileFormat(_0x45ff85,_0x2c3642);}}),new winston[(_0x2531('0x1c'))]['File']({'name':util[_0x2531('0x13')]('%s-%s',_0x45ff85,debugLevel),'filename':getLogFileName(_0x43f652,_0x45ff85,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2f0d8b){return fileFormat(_0x45ff85,_0x2f0d8b);}}),new winston[(_0x2531('0x1c'))][(_0x2531('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x266ad9){return fileFormat(_0x45ff85,_0x266ad9);}})]});return _0x81a882;}exports[_0x2531('0x22')]=consoleLogger;exports[_0x2531('0x23')]=fileLogger; \ No newline at end of file +var _0xe5f5=['fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','white','bold\x20white','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','meta','keys','length','stringify','level','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger'];(function(_0x45ca0c,_0x328d3e){var _0x1ab4a9=function(_0x3250a6){while(--_0x3250a6){_0x45ca0c['push'](_0x45ca0c['shift']());}};_0x1ab4a9(++_0x328d3e);}(_0xe5f5,0x160));var _0x5e5f=function(_0x484e43,_0x2879d5){_0x484e43=_0x484e43-0x0;var _0x5eceec=_0xe5f5[_0x484e43];return _0x5eceec;};'use strict';var path=require('path');var util=require(_0x5e5f('0x0'));var moment=require(_0x5e5f('0x1'));var winston=require(_0x5e5f('0x2'));var config=require(_0x5e5f('0x3'));var debugLevel=config[_0x5e5f('0x4')]?config[_0x5e5f('0x4')][_0x5e5f('0x5')]():_0x5e5f('0x6');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x5e5f('0x7'),'error':_0x5e5f('0x8'),'warn':'bold\x20yellow','info':_0x5e5f('0x9'),'print':_0x5e5f('0xa'),'success':'bold\x20green','http':_0x5e5f('0xb'),'verbose':_0x5e5f('0xc'),'debug':_0x5e5f('0xd'),'silly':_0x5e5f('0xe')};winston[_0x5e5f('0xf')](XC_LOG_COLORS);function getLogFileName(_0x1a29d6,_0x276ebb,_0xd1ea0e){var _0x312414=_0x1a29d6||'/var/log/xcally';return path['join'](_0x312414,util['format'](_0x5e5f('0x10'),_0x276ebb,_0xd1ea0e));}function formatter(_0x410d8a,_0x15fa99){_0x15fa99[_0x5e5f('0x11')]=_0x15fa99[_0x5e5f('0x11')][_0x5e5f('0x12')](/@@{/g,_0x5e5f('0x13'))['replace'](/}@@/g,_0x5e5f('0x14'))[_0x5e5f('0x12')](/@{/g,'{{')[_0x5e5f('0x12')](/}@/g,'}}');return util[_0x5e5f('0x15')](_0x5e5f('0x16'),moment()['format'](_0x5e5f('0x17')),_0x15fa99['level'][_0x5e5f('0x18')](),_0x410d8a,_0x15fa99[_0x5e5f('0x11')]);}function fileFormat(_0x5a7d4a,_0xa1dacb){_0xa1dacb[_0x5e5f('0x11')]=_0xa1dacb[_0x5e5f('0x11')]['replace'](/@@{/g,_0x5e5f('0x13'))['replace'](/}@@/g,_0x5e5f('0x14'))['replace'](/@{/g,'{{')[_0x5e5f('0x12')](/}@/g,'}}');var _0x1475a9=_0xa1dacb[_0x5e5f('0x19')]&&Object[_0x5e5f('0x1a')](_0xa1dacb[_0x5e5f('0x19')])[_0x5e5f('0x1b')]?'\x0a\x09'+JSON[_0x5e5f('0x1c')](_0xa1dacb['meta']):'';return util['format']('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x5e5f('0x15')](_0x5e5f('0x17')),_0xa1dacb[_0x5e5f('0x1d')]['toUpperCase'](),_0x5a7d4a,_0xa1dacb[_0x5e5f('0x11')],_0x1475a9);}function consoleLogger(){var _0x9c95de=new winston[(_0x5e5f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5e5f('0x1f'))][(_0x5e5f('0x20'))]({'level':_0x5e5f('0x21'),'json':![],'formatter':function(_0x174613){return formatter('',_0x174613);}})]});return _0x9c95de;}function fileLogger(_0x38870b,_0x9442c7){var _0x2bff96=new winston[(_0x5e5f('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x5e5f('0x1f'))][(_0x5e5f('0x22'))]({'name':util[_0x5e5f('0x15')](_0x5e5f('0x23'),_0x38870b,'error'),'filename':getLogFileName(_0x9442c7,_0x38870b,_0x5e5f('0x24')),'level':_0x5e5f('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x42a89a){return fileFormat(_0x38870b,_0x42a89a);}}),new winston[(_0x5e5f('0x1f'))]['File']({'name':util[_0x5e5f('0x15')](_0x5e5f('0x23'),_0x38870b,debugLevel),'filename':getLogFileName(_0x9442c7,_0x38870b,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3619ef){return fileFormat(_0x38870b,_0x3619ef);}}),new winston['transports'][(_0x5e5f('0x20'))]({'level':'warn','json':![],'formatter':function(_0x2e5202){return fileFormat(_0x38870b,_0x2e5202);}})]});return _0x2bff96;}exports[_0x5e5f('0x25')]=consoleLogger;exports[_0x5e5f('0x26')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 1b74832..7bfce0b 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 _0x1a85=['isString','@@{','replace','}@@','includes','exports','maskSensitiveData','password','newPassword','apiKey','street','phone','mobile','email','clientSecret','code','accessKey','token','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','user','pass','accountSid','dsn','secret','registry','isPlainObject','isArray','length'];(function(_0x5756f8,_0x22b6d5){var _0x3bb749=function(_0x332204){while(--_0x332204){_0x5756f8['push'](_0x5756f8['shift']());}};_0x3bb749(++_0x22b6d5);}(_0x1a85,0x178));var _0x51a8=function(_0x4d0e8b,_0x25837e){_0x4d0e8b=_0x4d0e8b-0x0;var _0x1163d3=_0x1a85[_0x4d0e8b];return _0x1163d3;};var _=require('lodash');var sensitiveFields=['username',_0x51a8('0x0'),_0x51a8('0x1'),_0x51a8('0x2'),'firstName','lastName',_0x51a8('0x3'),_0x51a8('0x4'),_0x51a8('0x5'),'fax',_0x51a8('0x6'),'clientId',_0x51a8('0x7'),'securityToken',_0x51a8('0x8'),_0x51a8('0x9'),'tenantId',_0x51a8('0xa'),'channelSecret','accessToken',_0x51a8('0xb'),_0x51a8('0xc'),_0x51a8('0xd'),_0x51a8('0xe'),_0x51a8('0xf'),_0x51a8('0x10'),_0x51a8('0x11'),_0x51a8('0x12'),_0x51a8('0x13'),_0x51a8('0x14'),_0x51a8('0x15'),_0x51a8('0x16'),_0x51a8('0x17'),_0x51a8('0x18'),_0x51a8('0x19'),_0x51a8('0x1a'),_0x51a8('0x1b'),'localstationid',_0x51a8('0x1c'),_0x51a8('0x1d'),_0x51a8('0x1e'),'oldPassword'];function maskSensitiveData(_0xf4eb6e){const _0x547d40=/(?!^)[\s\S](?!$)/g;if(_[_0x51a8('0x1f')](_0xf4eb6e)){for(const _0x2b8d37 in _0xf4eb6e){if(_[_0x51a8('0x20')](_0xf4eb6e[_0x2b8d37])){for(let _0x2b0521=0x0;_0x2b0521<_0xf4eb6e[_0x2b8d37][_0x51a8('0x21')];_0x2b0521++){maskSensitiveData(_0xf4eb6e[_0x2b8d37][_0x2b0521]);}}else if(_[_0x51a8('0x1f')](_0xf4eb6e[_0x2b8d37])){maskSensitiveData(_0xf4eb6e[_0x2b8d37]);}else if(_[_0x51a8('0x22')](_0xf4eb6e[_0x2b8d37])){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](/{{{/g,_0x51a8('0x23'))[_0x51a8('0x24')](/}}}/g,_0x51a8('0x25'))[_0x51a8('0x24')](/{{/g,'@{')[_0x51a8('0x24')](/}}/g,'}@');if(_[_0x51a8('0x26')](sensitiveFields,_0x2b8d37)){_0xf4eb6e[_0x2b8d37]=_0xf4eb6e[_0x2b8d37]['replace'](_0x547d40,'*');}}}}}module[_0x51a8('0x27')][_0x51a8('0x28')]=maskSensitiveData; \ No newline at end of file +var _0x0b0e=['}@@','lodash','password','apiKey','firstName','lastName','street','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','authToken','consumerKey','membername','calleridname','exten','vidaooApiKey','clientEmail','accesskeyid','secretaccesskey','key','user','pass','localstationid','dsn','secret','registry','oldPassword','isArray','length','isString','replace'];(function(_0xae272f,_0x1918e5){var _0x1128c4=function(_0x15d8f0){while(--_0x15d8f0){_0xae272f['push'](_0xae272f['shift']());}};_0x1128c4(++_0x1918e5);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x0b0e[_0x3fad5a];return _0x4ca713;};var _=require(_0xe0b0('0x0'));var sensitiveFields=['username',_0xe0b0('0x1'),'newPassword',_0xe0b0('0x2'),_0xe0b0('0x3'),_0xe0b0('0x4'),_0xe0b0('0x5'),_0xe0b0('0x6'),_0xe0b0('0x7'),_0xe0b0('0x8'),_0xe0b0('0x9'),_0xe0b0('0xa'),_0xe0b0('0xb'),_0xe0b0('0xc'),'code','accessKey',_0xe0b0('0xd'),_0xe0b0('0xe'),_0xe0b0('0xf'),_0xe0b0('0x10'),'accessTokenSecret',_0xe0b0('0x11'),_0xe0b0('0x12'),'consumerSecret',_0xe0b0('0x13'),_0xe0b0('0x14'),'calleridnum',_0xe0b0('0x15'),_0xe0b0('0x16'),_0xe0b0('0x17'),'privateKey',_0xe0b0('0x18'),_0xe0b0('0x19'),_0xe0b0('0x1a'),_0xe0b0('0x1b'),_0xe0b0('0x1c'),'accountSid',_0xe0b0('0x1d'),_0xe0b0('0x1e'),_0xe0b0('0x1f'),_0xe0b0('0x20'),_0xe0b0('0x21')];function maskSensitiveData(_0x55d884){const _0x41a7e2=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x55d884)){for(const _0x35cb40 in _0x55d884){if(_[_0xe0b0('0x22')](_0x55d884[_0x35cb40])){for(let _0x519ae8=0x0;_0x519ae8<_0x55d884[_0x35cb40][_0xe0b0('0x23')];_0x519ae8++){maskSensitiveData(_0x55d884[_0x35cb40][_0x519ae8]);}}else if(_['isPlainObject'](_0x55d884[_0x35cb40])){maskSensitiveData(_0x55d884[_0x35cb40]);}else if(_[_0xe0b0('0x24')](_0x55d884[_0x35cb40])){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](/{{{/g,'@@{')['replace'](/}}}/g,_0xe0b0('0x26'))['replace'](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x35cb40)){_0x55d884[_0x35cb40]=_0x55d884[_0x35cb40][_0xe0b0('0x25')](_0x41a7e2,'*');}}}}}module['exports']['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index da1fd9c..dfea062 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['exports','replace','\x5c$&'];(function(_0x375bec,_0x2f32d9){var _0x3cb1f1=function(_0x45fff8){while(--_0x45fff8){_0x375bec['push'](_0x375bec['shift']());}};_0x3cb1f1(++_0x2f32d9);}(_0x66fa,0x117));var _0xa66f=function(_0x5c596,_0x3a918f){_0x5c596=_0x5c596-0x0;var _0x505af1=_0x66fa[_0x5c596];return _0x505af1;};module[_0xa66f('0x0')]={'escapeRegExp'(_0x3c905a,_0x52947a=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x3c905a[_0xa66f('0x1')](_0x52947a,_0xa66f('0x2'));}}; \ No newline at end of file +var _0x1967=['\x5c$&','replace'];(function(_0x54c802,_0x7959fd){var _0x168c4e=function(_0x56085d){while(--_0x56085d){_0x54c802['push'](_0x54c802['shift']());}};_0x168c4e(++_0x7959fd);}(_0x1967,0x173));var _0x7196=function(_0x1ac794,_0xc16902){_0x1ac794=_0x1ac794-0x0;var _0x3b3f3c=_0x1967[_0x1ac794];return _0x3b3f3c;};module['exports']={'escapeRegExp'(_0x1da98b,_0xdb72bb=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1da98b[_0x7196('0x0')](_0xdb72bb,_0x7196('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 05e176c..c7e435e 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 _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x5ec454,_0xfcd77e){var _0x5ebf50=function(_0x29de85){while(--_0x29de85){_0x5ec454['push'](_0x5ec454['shift']());}};_0x5ebf50(++_0xfcd77e);}(_0x8952,0x17e));var _0x2895=function(_0x54a935,_0x590d6e){_0x54a935=_0x54a935-0x0;var _0x24871f=_0x8952[_0x54a935];return _0x24871f;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file +var _0x1a85=['{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','reduce','exports'];(function(_0x54e765,_0x1827ae){var _0xea7918=function(_0x11ba7d){while(--_0x11ba7d){_0x54e765['push'](_0x54e765['shift']());}};_0xea7918(++_0x1827ae);}(_0x1a85,0x178));var _0x51a8=function(_0x3bfe11,_0x573678){_0x3bfe11=_0x3bfe11-0x0;var _0x19f6b2=_0x1a85[_0x3bfe11];return _0x19f6b2;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x54a0db){return _0x54a0db==='{{'?_0x51a8('0x0'):_0x51a8('0x1');}function safeTemplate(_0x43e22a){var _0x498466=_0x43e22a;if(typeof _0x43e22a==='string'){_0x498466=_0x43e22a[_0x51a8('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x51a8('0x3')](_0x43e22a)){_0x498466=_0x43e22a[_0x51a8('0x4')](function(_0x48a21b){return safeTemplate(_0x48a21b);});}else if(_[_0x51a8('0x5')](_0x43e22a)){_0x498466=Object['keys'](_0x43e22a)[_0x51a8('0x6')](function(_0x5cf430,_0x331117){_0x5cf430[_0x331117]=safeTemplate(_0x43e22a[_0x331117]);return _0x5cf430;},{});}return _0x498466;}module[_0x51a8('0x7')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index d0b75f4..8a66cf9 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 _0xfe57=['NODE_PATH','string','then','readJSON','updated','info','exports','path','../config/environment','root','resolve','server/app.json','isArray','apps','findIndex','motion2','env'];(function(_0x55ea95,_0x542cc6){var _0x3f6508=function(_0x5f448d){while(--_0x5f448d){_0x55ea95['push'](_0x55ea95['shift']());}};_0x3f6508(++_0x542cc6);}(_0xfe57,0x7e));var _0x7fe5=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xfe57[_0x2fc012];return _0x2891f9;};var fs=require('fs-extra');var path=require(_0x7fe5('0x0'));var config=require(_0x7fe5('0x1'));var root=config[_0x7fe5('0x2')];var APP_JSON_PATH=path[_0x7fe5('0x3')](root,_0x7fe5('0x4'));var NODEPATH=path[_0x7fe5('0x3')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x31ebf7){let _0x1c1e91=![];if(Array[_0x7fe5('0x5')](_0x31ebf7[_0x7fe5('0x6')])){var _0x33327d=_0x31ebf7[_0x7fe5('0x6')][_0x7fe5('0x7')](function(_0x44e53d){return _0x44e53d['name']===_0x7fe5('0x8');});if(_0x33327d>-0x1){var _0x367bf1=_0x31ebf7[_0x7fe5('0x6')][_0x33327d];if(typeof _0x367bf1[_0x7fe5('0x9')][_0x7fe5('0xa')]!==_0x7fe5('0xb')){_0x367bf1[_0x7fe5('0x9')][_0x7fe5('0xa')]=NODEPATH;_0x1c1e91=!![];}}return{'appConfig':_0x31ebf7,'updated':_0x1c1e91};}}function updateAppConfig(_0x104ed0){return fs['pathExists'](APP_JSON_PATH)[_0x7fe5('0xc')](function(_0xb0fb40){if(_0xb0fb40){return fs[_0x7fe5('0xd')](APP_JSON_PATH)[_0x7fe5('0xc')](function(_0x5588e3){var _0x243f02=setLegacyLibsNodeEnvPath(_0x5588e3);if(_0x243f02[_0x7fe5('0xe')]){_0x104ed0[_0x7fe5('0xf')]('Updating\x20app.json');return fs['writeJSON'](APP_JSON_PATH,_0x5588e3,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x7fe5('0x3')]();}});}module[_0x7fe5('0x10')]=updateAppConfig; \ No newline at end of file +var _0xf304=['Updating\x20app.json','writeJSON','path','root','resolve','legacy-libs','isArray','apps','findIndex','motion2','NODE_PATH','string','env','pathExists','then','readJSON','updated','info'];(function(_0xb7b878,_0x5c3b92){var _0x3c84b9=function(_0x21d5a2){while(--_0x21d5a2){_0xb7b878['push'](_0xb7b878['shift']());}};_0x3c84b9(++_0x5c3b92);}(_0xf304,0x17c));var _0x4f30=function(_0x4dd15b,_0x1d880a){_0x4dd15b=_0x4dd15b-0x0;var _0x2445f2=_0xf304[_0x4dd15b];return _0x2445f2;};var fs=require('fs-extra');var path=require(_0x4f30('0x0'));var config=require('../config/environment');var root=config[_0x4f30('0x1')];var APP_JSON_PATH=path[_0x4f30('0x2')](root,'server/app.json');var NODEPATH=path['resolve'](root,_0x4f30('0x3'));function setLegacyLibsNodeEnvPath(_0x4f8018){let _0x822136=![];if(Array[_0x4f30('0x4')](_0x4f8018[_0x4f30('0x5')])){var _0x3d4681=_0x4f8018[_0x4f30('0x5')][_0x4f30('0x6')](function(_0x43ea36){return _0x43ea36['name']===_0x4f30('0x7');});if(_0x3d4681>-0x1){var _0x5f48a7=_0x4f8018['apps'][_0x3d4681];if(typeof _0x5f48a7['env'][_0x4f30('0x8')]!==_0x4f30('0x9')){_0x5f48a7[_0x4f30('0xa')][_0x4f30('0x8')]=NODEPATH;_0x822136=!![];}}return{'appConfig':_0x4f8018,'updated':_0x822136};}}function updateAppConfig(_0x4edd1e){return fs[_0x4f30('0xb')](APP_JSON_PATH)[_0x4f30('0xc')](function(_0x1c49a5){if(_0x1c49a5){return fs[_0x4f30('0xd')](APP_JSON_PATH)[_0x4f30('0xc')](function(_0xb5101e){var _0x26364a=setLegacyLibsNodeEnvPath(_0xb5101e);if(_0x26364a[_0x4f30('0xe')]){_0x4edd1e[_0x4f30('0xf')](_0x4f30('0x10'));return fs[_0x4f30('0x11')](APP_JSON_PATH,_0xb5101e,{'spaces':0x2});}else{return Promise[_0x4f30('0x2')]();}});}else{return Promise['resolve']();}});}module['exports']=updateAppConfig; \ No newline at end of file